@narumitw/pi-subagents 0.49.3 → 0.52.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 (83) hide show
  1. package/README.md +362 -53
  2. package/package.json +10 -7
  3. package/src/adaptive-scheduler.ts +224 -0
  4. package/src/admission-benchmark.ts +95 -0
  5. package/src/admission-policy.ts +78 -0
  6. package/src/agent-projection.ts +53 -0
  7. package/src/agents.ts +58 -1
  8. package/src/auto-transport.ts +114 -0
  9. package/src/blocking-status.ts +63 -0
  10. package/src/capabilities.ts +145 -0
  11. package/src/capability-grant.ts +115 -0
  12. package/src/capability-router.ts +107 -0
  13. package/src/completion-delivery.ts +257 -0
  14. package/src/config-status.ts +221 -0
  15. package/src/config-ui.ts +215 -236
  16. package/src/consult-resources.ts +4 -27
  17. package/src/consult.ts +9 -1
  18. package/src/create-stateful-transport.ts +55 -0
  19. package/src/delegation-contract.ts +417 -0
  20. package/src/execution-plan.ts +322 -0
  21. package/src/execution-profiles.ts +95 -0
  22. package/src/execution-ui.ts +320 -0
  23. package/src/execution.ts +1098 -158
  24. package/src/in-process-transport.ts +269 -25
  25. package/src/inspect-render.ts +101 -1
  26. package/src/inspect.ts +321 -3
  27. package/src/integration-controller.ts +98 -0
  28. package/src/limits.ts +3 -0
  29. package/src/orchestration-metrics.ts +109 -0
  30. package/src/outcome.ts +61 -0
  31. package/src/panel-child-group.ts +35 -0
  32. package/src/panel-contract.ts +343 -0
  33. package/src/panel-evidence.ts +59 -0
  34. package/src/panel-execution.ts +770 -0
  35. package/src/panel-failure.ts +56 -0
  36. package/src/panel-planning.ts +175 -0
  37. package/src/panel-prompts.ts +132 -0
  38. package/src/panel-reconciliation.ts +57 -0
  39. package/src/panel-render.ts +103 -0
  40. package/src/parallel-limit-ui.ts +112 -0
  41. package/src/params.ts +179 -3
  42. package/src/persistence.ts +182 -32
  43. package/src/prompt-resources.ts +38 -0
  44. package/src/registry-types.ts +175 -0
  45. package/src/registry.ts +466 -143
  46. package/src/render.ts +72 -6
  47. package/src/result-contract.ts +416 -0
  48. package/src/retained-semantic-state.ts +100 -0
  49. package/src/rpc-timeout-finalization.ts +207 -0
  50. package/src/rpc-transport-metadata.ts +65 -0
  51. package/src/rpc-transport.ts +990 -0
  52. package/src/rpc-turn-capture.ts +142 -0
  53. package/src/runner-result.ts +55 -0
  54. package/src/runner-usage.ts +48 -0
  55. package/src/runner.ts +325 -73
  56. package/src/semantic-snapshot.ts +214 -0
  57. package/src/settings.ts +254 -35
  58. package/src/spawn-idempotency.ts +61 -0
  59. package/src/stateful-config.ts +13 -0
  60. package/src/stateful-guidance.ts +1 -0
  61. package/src/stateful-lifecycle.ts +45 -2
  62. package/src/stateful-limit-ui.ts +246 -0
  63. package/src/stateful-limits.ts +96 -0
  64. package/src/stateful-prompt.ts +11 -2
  65. package/src/stateful-render.ts +48 -3
  66. package/src/stateful.ts +467 -357
  67. package/src/subagents.ts +114 -46
  68. package/src/subprocess-transport.ts +64 -5
  69. package/src/supervision.ts +103 -0
  70. package/src/timeout-checkpoint.ts +305 -0
  71. package/src/timeout-finalization.ts +75 -0
  72. package/src/transport-types.ts +68 -0
  73. package/src/transport-ui.ts +169 -0
  74. package/src/transport.ts +16 -4
  75. package/src/turn-budget.ts +109 -0
  76. package/src/verification-policy.ts +67 -0
  77. package/src/work-item-ledger.ts +931 -0
  78. package/src/work-item-persistence.ts +223 -0
  79. package/src/workflow-planning.ts +162 -0
  80. package/src/workflow-tree-identity.ts +289 -0
  81. package/src/workflow-ui.ts +61 -0
  82. package/src/workflow-verification.ts +296 -0
  83. package/src/workspace.ts +69 -12
@@ -0,0 +1,175 @@
1
+ import type { SubagentThinkingLevel } from "./agents.js";
2
+ import type { CapabilityGrant } from "./capability-grant.js";
3
+ import type { TargetPolicyAudit } from "./cwd-policy.js";
4
+ import type { DelegationContract } from "./delegation-contract.js";
5
+ import type { ExecutionPlan } from "./execution-plan.js";
6
+ import type { ClassifiedSubagentOutcome } from "./outcome.js";
7
+ import type { AnyStructuredSubagentResult, SubagentResultFormat } from "./result-contract.js";
8
+ import type { SemanticCompatibility, SemanticSnapshot } from "./semantic-snapshot.js";
9
+ import type { TurnTerminationReport } from "./timeout-checkpoint.js";
10
+ import type { TransportTelemetry } from "./transport-types.js";
11
+
12
+ export type AgentLifecycleState =
13
+ | "starting"
14
+ | "running"
15
+ | "idle"
16
+ | "completed"
17
+ | "blocked"
18
+ | "needs-input"
19
+ | "abstained"
20
+ | "stale"
21
+ | "interrupted"
22
+ | "failed"
23
+ | "closed";
24
+
25
+ export interface AgentTurn {
26
+ task: string;
27
+ output: string;
28
+ startedAt: number;
29
+ completedAt: number;
30
+ exitCode: number;
31
+ truncated?: boolean;
32
+ termination?: TurnTerminationReport;
33
+ }
34
+
35
+ export interface AgentMailboxMessage {
36
+ id: string;
37
+ senderId: string;
38
+ recipientId: string;
39
+ content: string;
40
+ createdAt: number;
41
+ readAt?: number;
42
+ deduplicationKey?: string;
43
+ }
44
+
45
+ export interface ManagedAgent {
46
+ id: string;
47
+ agent: string;
48
+ parentId?: string;
49
+ rootId: string;
50
+ depth: number;
51
+ children: string[];
52
+ state: AgentLifecycleState;
53
+ createdAt: number;
54
+ updatedAt: number;
55
+ cwd: string;
56
+ agentScope?: "user" | "project" | "both";
57
+ thinkingLevel?: SubagentThinkingLevel;
58
+ timeoutMs?: number;
59
+ currentTimeoutMs?: number;
60
+ idleTimeoutMs?: number;
61
+ currentIdleTimeoutMs?: number;
62
+ maxTurns?: number;
63
+ currentMaxTurns?: number;
64
+ maxToolCalls?: number;
65
+ currentMaxToolCalls?: number;
66
+ currentTask?: string;
67
+ history: AgentTurn[];
68
+ error?: string;
69
+ context?: string;
70
+ contextSourceIds?: string[];
71
+ contextTruncated?: boolean;
72
+ contextTurns?: number;
73
+ contextBytes?: number;
74
+ workspaceMode?: "worktree";
75
+ spawnIdempotencyKey?: string;
76
+ spawnRequestHash?: string;
77
+ contract?: DelegationContract;
78
+ resultFormat?: SubagentResultFormat;
79
+ structuredResult?: AnyStructuredSubagentResult;
80
+ outcome?: ClassifiedSubagentOutcome;
81
+ executionPlan?: ExecutionPlan;
82
+ capabilityGrant?: CapabilityGrant;
83
+ semanticSnapshot?: SemanticSnapshot;
84
+ semanticCompatibility?: SemanticCompatibility;
85
+ termination?: TurnTerminationReport;
86
+ telemetry?: TransportTelemetry;
87
+ target?: TargetPolicyAudit;
88
+ policy?: { inherited: string[]; overridden: string[]; unsupported: string[] };
89
+ mailbox: AgentMailboxMessage[];
90
+ currentMailboxMessageIds?: string[];
91
+ }
92
+
93
+ export interface AgentRunInspectionSummary {
94
+ id: string;
95
+ agent: string;
96
+ state: AgentLifecycleState;
97
+ createdAt: number;
98
+ updatedAt: number;
99
+ historyCount: number;
100
+ unreadMessages: number;
101
+ }
102
+
103
+ export interface AgentRunInspectionDetail extends AgentRunInspectionSummary {
104
+ cwd: string;
105
+ thinkingLevel?: SubagentThinkingLevel;
106
+ timeoutMs?: number;
107
+ currentTimeoutMs?: number;
108
+ idleTimeoutMs?: number;
109
+ currentIdleTimeoutMs?: number;
110
+ maxTurns?: number;
111
+ currentMaxTurns?: number;
112
+ maxToolCalls?: number;
113
+ currentMaxToolCalls?: number;
114
+ currentTask?: string;
115
+ error?: string;
116
+ workspaceMode?: "worktree";
117
+ contextTurns?: number;
118
+ contextBytes?: number;
119
+ contextSources?: number;
120
+ contextTruncated?: boolean;
121
+ contract?: DelegationContract;
122
+ resultFormat?: SubagentResultFormat;
123
+ target?: TargetPolicyAudit;
124
+ policy?: { inherited: string[]; overridden: string[]; unsupported: string[] };
125
+ structuredResult?: AnyStructuredSubagentResult;
126
+ outcome?: ClassifiedSubagentOutcome;
127
+ executionPlan?: ExecutionPlan;
128
+ capabilityGrant?: CapabilityGrant;
129
+ semanticSnapshot?: SemanticSnapshot;
130
+ semanticCompatibility?: SemanticCompatibility;
131
+ termination?: TurnTerminationReport;
132
+ telemetry?: TransportTelemetry;
133
+ }
134
+
135
+ export interface AgentInspectionCounts {
136
+ activeAgents: number;
137
+ retainedAgents: number;
138
+ }
139
+
140
+ export interface TurnOutcome {
141
+ output: string;
142
+ exitCode: number;
143
+ aborted?: boolean;
144
+ truncated?: boolean;
145
+ error?: string;
146
+ policy?: ManagedAgent["policy"];
147
+ structuredResult?: AnyStructuredSubagentResult;
148
+ outcome?: ClassifiedSubagentOutcome;
149
+ executionPlan?: ExecutionPlan;
150
+ termination?: TurnTerminationReport;
151
+ telemetry?: TransportTelemetry;
152
+ }
153
+
154
+ export interface AgentTurnCompletion {
155
+ agent: ManagedAgent;
156
+ task: string;
157
+ output: string;
158
+ error?: string;
159
+ }
160
+
161
+ export interface AgentRegistryOptions {
162
+ maxAgents?: number;
163
+ maxActiveTurns?: number;
164
+ maxHistoryTurns?: number;
165
+ maxDepth?: number;
166
+ maxChildrenPerAgent?: number;
167
+ maxMailboxMessages?: number;
168
+ maxMailboxMessageBytes?: number;
169
+ maxTaskBytes?: number;
170
+ maxTurnOutputBytes?: number;
171
+ idleTtlMs?: number;
172
+ now?: () => number;
173
+ onChange?: (agents: ManagedAgent[]) => void | Promise<void>;
174
+ onTurnComplete?: (completion: AgentTurnCompletion) => void | Promise<void>;
175
+ }