mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
feat: enable permission-aware subagents
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { inChildSessionContext, runInChildSessionContext } from "../src/child-context.js";
|
||||
import subagentsExtension from "../src/index.js";
|
||||
|
||||
describe("child session async context", () => {
|
||||
it("is scoped to the child async branch", async () => {
|
||||
expect(inChildSessionContext()).toBe(false);
|
||||
await runInChildSessionContext(async () => {
|
||||
expect(inChildSessionContext()).toBe(true);
|
||||
await Promise.resolve();
|
||||
expect(inChildSessionContext()).toBe(true);
|
||||
});
|
||||
expect(inChildSessionContext()).toBe(false);
|
||||
});
|
||||
|
||||
it("prevents a child resource load from creating another extension manager", async () => {
|
||||
const pi = new Proxy({}, {
|
||||
get: vi.fn(() => {
|
||||
throw new Error("child extension factory must be a no-op");
|
||||
}),
|
||||
});
|
||||
|
||||
await runInChildSessionContext(async () => {
|
||||
expect(() => subagentsExtension(pi as any)).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user