@ian-pascoe/pi-minimal-subagents 0.6.3 → 0.6.5
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/package.json
CHANGED
|
@@ -65,7 +65,10 @@ import {
|
|
|
65
65
|
MinimalSubagentsStatusPanelController,
|
|
66
66
|
type MinimalSubagentsStatusAccess,
|
|
67
67
|
} from "./minimal-subagents-status-panel.js";
|
|
68
|
-
import {
|
|
68
|
+
import {
|
|
69
|
+
createCoordinatorToolDefinitions,
|
|
70
|
+
type CoordinatorToolOperations,
|
|
71
|
+
} from "./minimal-subagents-tools.js";
|
|
69
72
|
import {
|
|
70
73
|
renderMinimalSubagentsMessage,
|
|
71
74
|
renderMinimalSubagentsResult,
|
|
@@ -393,6 +396,15 @@ const productionLifecycleEffects: MinimalSubagentsLifecycleEffects = {
|
|
|
393
396
|
/** Own coordinator, UI, and prepared-fork state for one root Pi session lifecycle. */
|
|
394
397
|
export class MinimalSubagentsLifecycleController {
|
|
395
398
|
private coordinator: MinimalSubagentsCoordinator | undefined;
|
|
399
|
+
private readonly coordinatorOperations: CoordinatorToolOperations = {
|
|
400
|
+
spawn: (...args) => this.requireCoordinator().spawn(...args),
|
|
401
|
+
inspectStatus: (...args) => this.requireCoordinator().inspectStatus(...args),
|
|
402
|
+
sendAgentMessage: (...args) => this.requireCoordinator().sendAgentMessage(...args),
|
|
403
|
+
wait: (...args) => this.requireCoordinator().wait(...args),
|
|
404
|
+
status: (...args) => this.requireCoordinator().status(...args),
|
|
405
|
+
cancel: (...args) => this.requireCoordinator().cancel(...args),
|
|
406
|
+
delete: (...args) => this.requireCoordinator().delete(...args),
|
|
407
|
+
};
|
|
396
408
|
private uiController: MinimalSubagentsUiController | undefined;
|
|
397
409
|
private statusPanelController: MinimalSubagentsStatusPanelController | undefined;
|
|
398
410
|
private accessSession: ActiveSubagentAccessSession | undefined;
|
|
@@ -406,8 +418,18 @@ export class MinimalSubagentsLifecycleController {
|
|
|
406
418
|
private readonly effects: MinimalSubagentsLifecycleEffects,
|
|
407
419
|
) {}
|
|
408
420
|
|
|
409
|
-
/** Register renderers and the six Pi lifecycle event handlers
|
|
421
|
+
/** Register stable tools, renderers, and the six Pi lifecycle event handlers. */
|
|
410
422
|
register(): void {
|
|
423
|
+
const rootTools = createCoordinatorToolDefinitions({
|
|
424
|
+
coordinator: this.coordinatorOperations,
|
|
425
|
+
callerId: "root",
|
|
426
|
+
allowFanoutTools: true,
|
|
427
|
+
schemas: createCoordinatorToolSchemas([]),
|
|
428
|
+
captureCaller: (context) => rootCallerSnapshot(this.pi, context),
|
|
429
|
+
onActivity: () => this.uiController?.refresh(),
|
|
430
|
+
onAttention: (message) => this.accessSession?.context.ui.notify(message, "error"),
|
|
431
|
+
});
|
|
432
|
+
for (const tool of rootTools) this.pi.registerTool(tool);
|
|
411
433
|
this.pi.registerMessageRenderer("minimal-subagents.message", renderMinimalSubagentsMessage);
|
|
412
434
|
this.pi.registerMessageRenderer("minimal-subagents.result", renderMinimalSubagentsResult);
|
|
413
435
|
this.pi.registerCommand("subagents", {
|
|
@@ -573,7 +595,7 @@ export class MinimalSubagentsLifecycleController {
|
|
|
573
595
|
this.uiController.refresh();
|
|
574
596
|
|
|
575
597
|
const rootTools = createCoordinatorToolDefinitions({
|
|
576
|
-
coordinator:
|
|
598
|
+
coordinator: this.coordinatorOperations,
|
|
577
599
|
callerId: "root",
|
|
578
600
|
allowFanoutTools: true,
|
|
579
601
|
modelRoles: minimalSubagentsConfig.modelRoles,
|
|
@@ -605,6 +627,13 @@ export class MinimalSubagentsLifecycleController {
|
|
|
605
627
|
}
|
|
606
628
|
}
|
|
607
629
|
|
|
630
|
+
private requireCoordinator(): MinimalSubagentsCoordinator {
|
|
631
|
+
if (!this.coordinator) {
|
|
632
|
+
throw new Error("Minimal subagents lifecycle: coordinator is not initialized");
|
|
633
|
+
}
|
|
634
|
+
return this.coordinator;
|
|
635
|
+
}
|
|
636
|
+
|
|
608
637
|
private async prepareSessionFork(
|
|
609
638
|
event: SessionBeforeForkEvent,
|
|
610
639
|
context: ExtensionContext,
|
|
@@ -1039,7 +1039,7 @@ export class PiAgentSessionFactory implements AgentSessionFactory {
|
|
|
1039
1039
|
agentDir: this.options.agentDir,
|
|
1040
1040
|
model,
|
|
1041
1041
|
thinkingLevel: agent.launch_contract.thinking_level,
|
|
1042
|
-
tools:
|
|
1042
|
+
tools: [...allowedToolNames, ...adapterToolNames],
|
|
1043
1043
|
customTools: coordinatorTools,
|
|
1044
1044
|
resourceLoader,
|
|
1045
1045
|
sessionManager,
|