@narumitw/pi-subagents 0.49.2 → 0.51.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.
- package/README.md +313 -53
- package/package.json +11 -8
- package/src/adaptive-scheduler.ts +196 -0
- package/src/admission-benchmark.ts +95 -0
- package/src/admission-policy.ts +78 -0
- package/src/agent-projection.ts +53 -0
- package/src/agents.ts +58 -1
- package/src/auto-transport.ts +114 -0
- package/src/blocking-status.ts +63 -0
- package/src/capabilities.ts +145 -0
- package/src/capability-grant.ts +115 -0
- package/src/capability-router.ts +107 -0
- package/src/completion-delivery.ts +257 -0
- package/src/config-status.ts +221 -0
- package/src/config-ui.ts +215 -236
- package/src/consult-resources.ts +4 -27
- package/src/consult.ts +9 -1
- package/src/create-stateful-transport.ts +55 -0
- package/src/delegation-contract.ts +417 -0
- package/src/execution-plan.ts +322 -0
- package/src/execution-profiles.ts +95 -0
- package/src/execution-ui.ts +320 -0
- package/src/execution.ts +848 -158
- package/src/in-process-transport.ts +269 -25
- package/src/inspect-render.ts +101 -1
- package/src/inspect.ts +296 -3
- package/src/integration-controller.ts +98 -0
- package/src/limits.ts +3 -0
- package/src/orchestration-metrics.ts +78 -0
- package/src/outcome.ts +61 -0
- package/src/panel-child-group.ts +35 -0
- package/src/panel-contract.ts +343 -0
- package/src/panel-evidence.ts +59 -0
- package/src/panel-execution.ts +772 -0
- package/src/panel-failure.ts +56 -0
- package/src/panel-planning.ts +175 -0
- package/src/panel-prompts.ts +132 -0
- package/src/panel-reconciliation.ts +57 -0
- package/src/panel-render.ts +103 -0
- package/src/parallel-limit-ui.ts +112 -0
- package/src/params.ts +172 -3
- package/src/persistence.ts +182 -32
- package/src/prompt-resources.ts +38 -0
- package/src/registry-types.ts +175 -0
- package/src/registry.ts +466 -143
- package/src/render.ts +72 -6
- package/src/result-contract.ts +416 -0
- package/src/retained-semantic-state.ts +100 -0
- package/src/rpc-timeout-finalization.ts +207 -0
- package/src/rpc-transport-metadata.ts +65 -0
- package/src/rpc-transport.ts +990 -0
- package/src/rpc-turn-capture.ts +142 -0
- package/src/runner-result.ts +55 -0
- package/src/runner-usage.ts +48 -0
- package/src/runner.ts +325 -73
- package/src/semantic-snapshot.ts +214 -0
- package/src/settings.ts +254 -35
- package/src/spawn-idempotency.ts +61 -0
- package/src/stateful-config.ts +13 -0
- package/src/stateful-guidance.ts +1 -0
- package/src/stateful-lifecycle.ts +45 -2
- package/src/stateful-limit-ui.ts +246 -0
- package/src/stateful-limits.ts +96 -0
- package/src/stateful-prompt.ts +11 -2
- package/src/stateful-render.ts +48 -3
- package/src/stateful.ts +467 -357
- package/src/subagents.ts +114 -46
- package/src/subprocess-transport.ts +64 -5
- package/src/supervision.ts +103 -0
- package/src/timeout-checkpoint.ts +305 -0
- package/src/timeout-finalization.ts +75 -0
- package/src/transport-types.ts +68 -0
- package/src/transport-ui.ts +169 -0
- package/src/transport.ts +16 -4
- package/src/turn-budget.ts +109 -0
- package/src/verification-policy.ts +17 -0
- package/src/work-item-ledger.ts +682 -0
- package/src/work-item-persistence.ts +218 -0
- package/src/workflow-planning.ts +150 -0
- package/src/workflow-ui.ts +61 -0
- 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
|
+
}
|