forked from bai/curriculum-project-hub
feat: make agent roles and skills dynamic
This commit is contained in:
@@ -14,6 +14,7 @@ describe("agent subprocess security policy", () => {
|
||||
it("passes only the run proxy capability and safe runtime variables and protects the capability from tools", async () => {
|
||||
const { workspaceRoot, workspace } = await makeWorkspace();
|
||||
const policy = await createAgentSecurityPolicy({
|
||||
runId: "run-test",
|
||||
workspaceRoot,
|
||||
workspaceDir: workspace,
|
||||
providerProxyEnv: {
|
||||
@@ -51,14 +52,8 @@ describe("agent subprocess security policy", () => {
|
||||
expect(policy.env.TEMP).toBe(policy.env.TMPDIR);
|
||||
expect(policy.env.TMPDIR).toBe(join(canonicalWorkspace, ".cph", "t"));
|
||||
expect(Buffer.byteLength(policy.env.TMPDIR!)).toBeLessThanOrEqual(56);
|
||||
expect(policy.skillIds).toEqual([
|
||||
"cph-curated:outline",
|
||||
"cph-curated:lesson-project",
|
||||
"cph-curated:data-processing-spec",
|
||||
]);
|
||||
expect(policy.skillPluginRoot.startsWith(canonicalWorkspace)).toBe(false);
|
||||
expect(policy.sandbox.filesystem.allowRead).toContain(policy.skillPluginRoot);
|
||||
expect(policy.sandbox.filesystem.allowWrite).not.toContain(policy.skillPluginRoot);
|
||||
expect(policy.skillIds).toEqual([]);
|
||||
expect(policy.skillPluginRoot).toBeUndefined();
|
||||
|
||||
expect(policy.sandbox).toMatchObject({
|
||||
enabled: true,
|
||||
@@ -83,6 +78,7 @@ describe("agent subprocess security policy", () => {
|
||||
const { workspaceRoot, workspace } = await makeWorkspace();
|
||||
|
||||
await expect(createAgentSecurityPolicy({
|
||||
runId: "run-test",
|
||||
workspaceRoot,
|
||||
workspaceDir: workspace,
|
||||
providerProxyEnv: {
|
||||
@@ -96,6 +92,7 @@ describe("agent subprocess security policy", () => {
|
||||
it("keeps every SDK temp variable on a short path inside the project workspace", async () => {
|
||||
const { workspaceRoot, workspace } = await makeWorkspace();
|
||||
const policy = await createAgentSecurityPolicy({
|
||||
runId: "run-test",
|
||||
workspaceRoot,
|
||||
workspaceDir: workspace,
|
||||
hostEnv: { PATH: "/usr/bin:/bin" },
|
||||
@@ -121,6 +118,7 @@ describe("agent subprocess security policy", () => {
|
||||
await mkdir(workspace, { recursive: true });
|
||||
|
||||
await expect(createAgentSecurityPolicy({
|
||||
runId: "run-test",
|
||||
workspaceRoot,
|
||||
workspaceDir: workspace,
|
||||
hostEnv: { PATH: "/usr/bin:/bin" },
|
||||
@@ -135,6 +133,7 @@ describe("agent subprocess security policy", () => {
|
||||
await symlink(outside, linked);
|
||||
|
||||
await expect(createAgentSecurityPolicy({
|
||||
runId: "run-test",
|
||||
workspaceRoot,
|
||||
workspaceDir: linked,
|
||||
providerProxyEnv: { ANTHROPIC_AUTH_TOKEN: "run-proxy-capability" },
|
||||
@@ -150,6 +149,7 @@ describe("agent subprocess security policy", () => {
|
||||
await symlink(sibling, linked);
|
||||
|
||||
await expect(createAgentSecurityPolicy({
|
||||
runId: "run-test",
|
||||
workspaceRoot,
|
||||
workspaceDir: linked,
|
||||
providerProxyEnv: { ANTHROPIC_AUTH_TOKEN: "run-proxy-capability" },
|
||||
|
||||
Reference in New Issue
Block a user