@narumitw/pi-subagents 1.0.2 → 2.0.1

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.
Files changed (47) hide show
  1. package/README.md +198 -188
  2. package/package.json +2 -2
  3. package/src/agents/built-ins.ts +13 -66
  4. package/src/agents/catalog.ts +19 -2
  5. package/src/agents/discovery.ts +31 -15
  6. package/src/auto-transport.ts +7 -1
  7. package/src/child-peer-bridge.ts +124 -0
  8. package/src/child-peer-tools.ts +132 -0
  9. package/src/completion-delivery.ts +19 -5
  10. package/src/completion-render.ts +189 -0
  11. package/src/completion-routing.ts +24 -0
  12. package/src/config-ui.ts +11 -17
  13. package/src/consult-registration.ts +3 -2
  14. package/src/create-stateful-transport.ts +15 -2
  15. package/src/execution-ui.ts +0 -72
  16. package/src/in-process-transport.ts +39 -7
  17. package/src/inspect-tool.ts +3 -1
  18. package/src/peer-communication.ts +352 -0
  19. package/src/peer-transport.ts +49 -0
  20. package/src/persistence.ts +26 -1
  21. package/src/pi-args.ts +2 -0
  22. package/src/registry-types.ts +7 -0
  23. package/src/registry.ts +240 -41
  24. package/src/result-contract.ts +20 -5
  25. package/src/rpc-transport.ts +56 -26
  26. package/src/runner.ts +13 -1
  27. package/src/spawn-idempotency.ts +2 -0
  28. package/src/stateful-agent-view.ts +3 -1
  29. package/src/stateful-guidance.ts +11 -11
  30. package/src/stateful-safety.ts +0 -45
  31. package/src/stateful-tool-params.ts +11 -3
  32. package/src/stateful.ts +119 -47
  33. package/src/subagents.ts +6 -8
  34. package/src/subprocess-transport.ts +49 -28
  35. package/src/task-path.ts +65 -0
  36. package/src/transport-ui.ts +0 -6
  37. package/src/transport.ts +2 -1
  38. package/src/workflow-ui.ts +4 -4
  39. package/src/automation-contract.ts +0 -709
  40. package/src/automation-planner.ts +0 -65
  41. package/src/automation-registration.ts +0 -137
  42. package/src/automation-tool.ts +0 -40
  43. package/src/automation.ts +0 -435
  44. package/src/execution-profiles.ts +0 -95
  45. package/src/workflow-plan-compiler.ts +0 -618
  46. package/src/workflow-plan-patch.ts +0 -636
  47. package/src/workflow-planning-benchmark.ts +0 -95
@@ -1,95 +0,0 @@
1
- export const AUTOMATION_BENCHMARK_VERSION = "pi-subagents:workflow-planning-benchmark:v1" as const;
2
-
3
- export const AUTOMATION_BENCHMARK_ARMS = [
4
- "strong-single-agent",
5
- "one-child",
6
- "caller-authored-workflow",
7
- "fixed-two-child",
8
- "equal-budget-best-of-n",
9
- "automation-compiled",
10
- ] as const;
11
-
12
- export type AutomationBenchmarkArm = (typeof AUTOMATION_BENCHMARK_ARMS)[number];
13
-
14
- export interface AutomationBenchmarkProtocol {
15
- version: typeof AUTOMATION_BENCHMARK_VERSION;
16
- model: string;
17
- evaluator: string;
18
- taskIds: string[];
19
- pairedSeeds: number[];
20
- maxTokens: number;
21
- maxCost: number;
22
- maxWallClockMs: number;
23
- maxMutatingChildren: number;
24
- maxRecursiveDepth: number;
25
- arms: AutomationBenchmarkArm[];
26
- }
27
-
28
- export interface AutomationBenchmarkAdapter {
29
- arm: AutomationBenchmarkArm;
30
- model: string;
31
- evaluator: string;
32
- maxTokens: number;
33
- maxCost: number;
34
- maxWallClockMs: number;
35
- mutatingChildren: number;
36
- recursiveDepth: number;
37
- informationPolicy: "identical-repository-context";
38
- toolPolicy: "matched-authority-ceiling";
39
- }
40
-
41
- export interface AutomationBenchmarkDryRun {
42
- version: typeof AUTOMATION_BENCHMARK_VERSION;
43
- pairedInstances: number;
44
- arms: AutomationBenchmarkArm[];
45
- valid: true;
46
- }
47
-
48
- export function validateAutomationBenchmark(
49
- protocol: AutomationBenchmarkProtocol,
50
- adapters: AutomationBenchmarkAdapter[],
51
- ): AutomationBenchmarkDryRun {
52
- if (protocol.version !== AUTOMATION_BENCHMARK_VERSION) {
53
- throw new Error("Unsupported automation benchmark protocol");
54
- }
55
- if (protocol.taskIds.length < 1 || protocol.pairedSeeds.length < 2) {
56
- throw new Error("Automation benchmark requires tasks and repeated paired seeds");
57
- }
58
- if (protocol.maxMutatingChildren !== 2 || protocol.maxRecursiveDepth !== 0) {
59
- throw new Error("Automation benchmark width and depth must remain two and zero");
60
- }
61
- const arms = [...new Set(protocol.arms)].sort();
62
- if (
63
- arms.length !== AUTOMATION_BENCHMARK_ARMS.length ||
64
- AUTOMATION_BENCHMARK_ARMS.some((arm) => !arms.includes(arm))
65
- ) {
66
- throw new Error("Automation benchmark must include every frozen comparison arm");
67
- }
68
- for (const arm of AUTOMATION_BENCHMARK_ARMS) {
69
- const adapter = adapters.find((candidate) => candidate.arm === arm);
70
- if (!adapter) throw new Error(`Missing automation benchmark adapter ${arm}`);
71
- if (
72
- adapter.model !== protocol.model ||
73
- adapter.evaluator !== protocol.evaluator ||
74
- adapter.maxTokens !== protocol.maxTokens ||
75
- adapter.maxCost !== protocol.maxCost ||
76
- adapter.maxWallClockMs !== protocol.maxWallClockMs ||
77
- adapter.informationPolicy !== "identical-repository-context" ||
78
- adapter.toolPolicy !== "matched-authority-ceiling"
79
- ) {
80
- throw new Error(`Automation benchmark adapter ${arm} violates matched resources`);
81
- }
82
- if (
83
- adapter.mutatingChildren > protocol.maxMutatingChildren ||
84
- adapter.recursiveDepth > protocol.maxRecursiveDepth
85
- ) {
86
- throw new Error(`Automation benchmark adapter ${arm} exceeds width or depth`);
87
- }
88
- }
89
- return {
90
- version: AUTOMATION_BENCHMARK_VERSION,
91
- pairedInstances: protocol.taskIds.length * protocol.pairedSeeds.length,
92
- arms: [...AUTOMATION_BENCHMARK_ARMS],
93
- valid: true,
94
- };
95
- }