@ian-pascoe/pi-minimal-subagents 0.6.4 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ian-pascoe/pi-minimal-subagents",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "private": false,
5
5
  "description": "Persistent nested subagents with bounded delegation for Pi",
6
6
  "keywords": [
@@ -65,7 +65,10 @@ import {
65
65
  MinimalSubagentsStatusPanelController,
66
66
  type MinimalSubagentsStatusAccess,
67
67
  } from "./minimal-subagents-status-panel.js";
68
- import { createCoordinatorToolDefinitions } from "./minimal-subagents-tools.js";
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 owned by Minimal Subagents. */
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: activeCoordinator,
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,