@narumitw/pi-subagents 0.52.0 → 0.54.0

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 (67) hide show
  1. package/README.md +154 -12
  2. package/package.json +1 -1
  3. package/src/agents/built-ins.ts +124 -0
  4. package/src/agents/catalog.ts +224 -0
  5. package/src/agents/discovery.ts +249 -0
  6. package/src/agents/types.ts +98 -0
  7. package/src/agents.ts +47 -665
  8. package/src/auto-transport.ts +2 -1
  9. package/src/automation-contract.ts +709 -0
  10. package/src/automation-planner.ts +65 -0
  11. package/src/automation.ts +585 -0
  12. package/src/capability-router.ts +1 -1
  13. package/src/completion-delivery.ts +2 -3
  14. package/src/config-status.ts +2 -2
  15. package/src/config-ui.ts +8 -8
  16. package/src/consult-resources.ts +1 -1
  17. package/src/consult.ts +9 -7
  18. package/src/create-stateful-transport.ts +2 -1
  19. package/src/cwd-policy.ts +1 -1
  20. package/src/execution/budget.ts +56 -0
  21. package/src/execution/runtime-policy.ts +19 -0
  22. package/src/execution-plan.ts +2 -2
  23. package/src/execution-profiles.ts +1 -1
  24. package/src/execution-ui.ts +1 -1
  25. package/src/execution.ts +269 -100
  26. package/src/in-process-transport.ts +3 -2
  27. package/src/inspect.ts +35 -8
  28. package/src/limits.ts +1 -0
  29. package/src/orchestration-metrics.ts +12 -5
  30. package/src/panel-execution.ts +1 -1
  31. package/src/panel-planning.ts +1 -1
  32. package/src/params.ts +3 -1
  33. package/src/persistence.ts +1 -1
  34. package/src/registry-types.ts +1 -1
  35. package/src/registry.ts +1 -1
  36. package/src/render.ts +1 -1
  37. package/src/retained-semantic-state.ts +1 -1
  38. package/src/rpc-transport-metadata.ts +1 -1
  39. package/src/rpc-transport.ts +2 -1
  40. package/src/runner.ts +6 -1
  41. package/src/settings/inspection.ts +275 -0
  42. package/src/settings/schema.ts +186 -0
  43. package/src/settings.ts +72 -420
  44. package/src/spawn-idempotency.ts +1 -1
  45. package/src/stateful-agent-view.ts +87 -0
  46. package/src/stateful-config.ts +1 -1
  47. package/src/stateful-guidance.ts +1 -1
  48. package/src/stateful-limits.ts +1 -1
  49. package/src/stateful-prompt.ts +2 -2
  50. package/src/stateful-safety.ts +2 -1
  51. package/src/stateful.ts +23 -103
  52. package/src/subagents.ts +10 -9
  53. package/src/subprocess-transport.ts +2 -6
  54. package/src/transport-types.ts +1 -1
  55. package/src/transport-ui.ts +1 -1
  56. package/src/verification-harness.ts +516 -0
  57. package/src/verification-receipt.ts +275 -0
  58. package/src/verified-execution-benchmark.ts +86 -0
  59. package/src/verified-execution-contract.ts +219 -0
  60. package/src/work-item-ledger.ts +510 -37
  61. package/src/work-item-persistence.ts +31 -0
  62. package/src/workflow-completion-controller.ts +397 -0
  63. package/src/workflow-plan-compiler.ts +618 -0
  64. package/src/workflow-plan-patch.ts +636 -0
  65. package/src/workflow-planning-benchmark.ts +95 -0
  66. package/src/workflow-planning.ts +11 -1
  67. package/src/workflow-ui.ts +3 -3
@@ -0,0 +1,95 @@
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
+ }
@@ -1,4 +1,4 @@
1
- import type { AgentConfig } from "./agents.js";
1
+ import type { AgentConfig } from "./agents/types.js";
2
2
  import { routeByCapability } from "./capability-router.js";
3
3
  import { normalizeDelegationContract } from "./delegation-contract.js";
4
4
  import type { SubagentParams } from "./params.js";
@@ -20,9 +20,12 @@ type WorkRequest = {
20
20
  writePaths?: string[];
21
21
  ownershipKeys?: string[];
22
22
  acceptanceCriteria?: string[];
23
+ requiredEvidence?: string[];
23
24
  integrationOwner?: boolean;
24
25
  verifierFor?: string;
25
26
  dependencyPolicy?: "completed" | "settled";
27
+ acceptanceRequired?: boolean;
28
+ maxReworkCycles?: 0 | 1;
26
29
  };
27
30
 
28
31
  export function resolveWorkflowTasks(
@@ -54,6 +57,7 @@ export function createBlockingWorkLedger(
54
57
  params: SubagentParams,
55
58
  resolvedWorkflowTasks: ResolvedWorkflowTask[],
56
59
  aggregator: Aggregator | undefined,
60
+ verifiedTarget?: { id: string; maxReworkCycles: 0 | 1 },
57
61
  ): WorkItemLedger | undefined {
58
62
  if (params.agent && params.task) {
59
63
  return WorkItemLedger.create({
@@ -109,6 +113,9 @@ export function createBlockingWorkLedger(
109
113
  integrationOwner:
110
114
  task.integrationOwner ??
111
115
  (!hasExplicitIntegrationOwner && index === defaultIntegrationOwnerIndex),
116
+ ...(verifiedTarget?.id === task.id
117
+ ? { acceptanceRequired: true, maxReworkCycles: verifiedTarget.maxReworkCycles }
118
+ : {}),
112
119
  }),
113
120
  ),
114
121
  });
@@ -155,8 +162,11 @@ function definition(
155
162
  writePaths: request.writePaths ?? contract?.requestedAuthority?.writePaths ?? [],
156
163
  ownershipKeys: request.ownershipKeys ?? [],
157
164
  acceptanceCriteria: request.acceptanceCriteria ?? contract?.acceptanceCriteria ?? [],
165
+ requiredEvidence: request.requiredEvidence ?? contract?.requiredEvidence ?? [],
158
166
  integrationOwner: request.integrationOwner,
159
167
  verifierFor: request.verifierFor,
160
168
  dependencyPolicy: request.dependencyPolicy,
169
+ acceptanceRequired: request.acceptanceRequired,
170
+ maxReworkCycles: request.maxReworkCycles,
161
171
  };
162
172
  }
@@ -1,5 +1,5 @@
1
1
  import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
2
- import type { DelegationWorkflow } from "./settings.js";
2
+ import type { DelegationWorkflow } from "./settings/inspection.js";
3
3
 
4
4
  export async function showWorkflowPreview(
5
5
  ctx: ExtensionCommandContext,
@@ -46,8 +46,8 @@ function workflowEffects(current: DelegationWorkflow, next: DelegationWorkflow):
46
46
  if (blockingEnabled(current) !== blockingEnabled(next)) {
47
47
  effects.push(
48
48
  blockingEnabled(next)
49
- ? "Add blocking `subagent` and read-only `subagent_consult`"
50
- : "Remove blocking `subagent` and read-only `subagent_consult`",
49
+ ? "Add blocking `subagent`, explicit `subagent_auto`, and read-only `subagent_consult`"
50
+ : "Remove blocking `subagent`, explicit `subagent_auto`, and read-only `subagent_consult`",
51
51
  );
52
52
  }
53
53
  if (asyncEnabled(current) !== asyncEnabled(next)) {