@narumitw/pi-subagents 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -100
- package/dist/child-communication-bridge.ts +3 -8
- package/dist/child-communication-bridge.ts.map +2 -2
- package/dist/chunks/{chunk-UKTWUQRM.js → chunk-7JQOB375.ts} +7 -22
- package/dist/chunks/chunk-7JQOB375.ts.map +7 -0
- package/dist/index.ts +13 -46
- package/dist/index.ts.map +2 -2
- package/package.json +53 -54
- package/src/broker-credentials.ts +48 -48
- package/src/child-communication-bridge.ts +115 -123
- package/src/child-communication-tools.ts +105 -111
- package/src/completion-renderer.ts +46 -48
- package/src/message-broker.ts +531 -561
- package/src/model-output.ts +25 -28
- package/src/process.ts +595 -616
- package/src/runtime.ts +454 -478
- package/src/subagents.ts +20 -23
- package/src/tools.ts +305 -319
- package/src/types.ts +41 -58
- package/src/widget.ts +85 -91
- package/dist/chunks/chunk-UKTWUQRM.js.map +0 -7
package/src/subagents.ts
CHANGED
|
@@ -5,29 +5,26 @@ import { createSubagentWidgetController } from "./widget.js";
|
|
|
5
5
|
|
|
6
6
|
export type SubagentsDependencies = SubagentToolsDependencies;
|
|
7
7
|
|
|
8
|
-
export default function subagents(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const widget = createSubagentWidgetController(tools.runtime);
|
|
15
|
-
let activeSession: ExtensionContext["sessionManager"] | undefined;
|
|
16
|
-
let sessionGeneration = 0;
|
|
8
|
+
export default function subagents(pi: ExtensionAPI, dependencies: SubagentsDependencies = {}): void {
|
|
9
|
+
registerCompletionRenderer(pi);
|
|
10
|
+
const tools = registerSubagentTools(pi, dependencies);
|
|
11
|
+
const widget = createSubagentWidgetController(tools.runtime);
|
|
12
|
+
let activeSession: ExtensionContext["sessionManager"] | undefined;
|
|
13
|
+
let sessionGeneration = 0;
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
16
|
+
activeSession = ctx.sessionManager;
|
|
17
|
+
const generation = ++sessionGeneration;
|
|
18
|
+
await tools.startSession();
|
|
19
|
+
if (generation !== sessionGeneration) return;
|
|
20
|
+
widget.start(ctx);
|
|
21
|
+
});
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
pi.on("session_shutdown", async (_event, ctx) => {
|
|
24
|
+
if (ctx.sessionManager !== activeSession) return;
|
|
25
|
+
sessionGeneration++;
|
|
26
|
+
activeSession = undefined;
|
|
27
|
+
widget.shutdown(ctx);
|
|
28
|
+
await tools.shutdown();
|
|
29
|
+
});
|
|
33
30
|
}
|