@botbotgo/agent-harness 0.0.309 → 0.0.311

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 (195) hide show
  1. package/README.md +14 -0
  2. package/README.zh.md +14 -0
  3. package/dist/acp.d.ts +1 -116
  4. package/dist/acp.js +1 -310
  5. package/dist/api.d.ts +1 -1
  6. package/dist/api.js +1 -1
  7. package/dist/cli/chat-interactive.d.ts +24 -0
  8. package/dist/cli/chat-interactive.js +244 -0
  9. package/dist/cli/chat-rendering.d.ts +9 -0
  10. package/dist/cli/chat-rendering.js +102 -0
  11. package/dist/cli/chat-stream.d.ts +23 -0
  12. package/dist/cli/chat-stream.js +330 -0
  13. package/dist/cli/chat-ui.d.ts +20 -0
  14. package/dist/cli/chat-ui.js +198 -0
  15. package/dist/cli/chat-workspace.d.ts +15 -0
  16. package/dist/cli/chat-workspace.js +205 -0
  17. package/dist/cli/main.d.ts +52 -0
  18. package/dist/cli/main.js +323 -0
  19. package/dist/cli/managed-service-commands.d.ts +23 -0
  20. package/dist/cli/managed-service-commands.js +63 -0
  21. package/dist/cli/managed-service.d.ts +27 -0
  22. package/dist/cli/managed-service.js +61 -0
  23. package/dist/cli/options-init-chat.d.ts +16 -0
  24. package/dist/cli/options-init-chat.js +108 -0
  25. package/dist/cli/options-runtime.d.ts +27 -0
  26. package/dist/cli/options-runtime.js +158 -0
  27. package/dist/cli/options-serve.d.ts +24 -0
  28. package/dist/cli/options-serve.js +166 -0
  29. package/dist/cli/options.d.ts +5 -0
  30. package/dist/cli/options.js +47 -0
  31. package/dist/cli/process-guards.d.ts +14 -0
  32. package/dist/cli/process-guards.js +139 -0
  33. package/dist/cli/request-tree.d.ts +12 -0
  34. package/dist/cli/request-tree.js +296 -0
  35. package/dist/cli/runtime-commands.d.ts +15 -0
  36. package/dist/cli/runtime-commands.js +247 -0
  37. package/dist/cli/runtime-output.d.ts +5 -0
  38. package/dist/cli/runtime-output.js +124 -0
  39. package/dist/cli/server-commands.d.ts +36 -0
  40. package/dist/cli/server-commands.js +250 -0
  41. package/dist/cli/workspace.d.ts +6 -0
  42. package/dist/cli/workspace.js +71 -0
  43. package/dist/cli.d.ts +1 -77
  44. package/dist/cli.js +2 -3023
  45. package/dist/client/acp.d.ts +1 -50
  46. package/dist/client/acp.js +1 -219
  47. package/dist/client/in-process.d.ts +5 -5
  48. package/dist/client/index.d.ts +2 -2
  49. package/dist/client/index.js +1 -1
  50. package/dist/contracts/runtime-evaluation.d.ts +103 -0
  51. package/dist/contracts/runtime-evaluation.js +1 -0
  52. package/dist/contracts/runtime-memory.d.ts +162 -0
  53. package/dist/contracts/runtime-memory.js +1 -0
  54. package/dist/contracts/runtime-observability.d.ts +248 -0
  55. package/dist/contracts/runtime-observability.js +1 -0
  56. package/dist/contracts/runtime-requests.d.ts +342 -0
  57. package/dist/contracts/runtime-requests.js +1 -0
  58. package/dist/contracts/runtime-scheduling.d.ts +146 -0
  59. package/dist/contracts/runtime-scheduling.js +1 -0
  60. package/dist/contracts/runtime.d.ts +5 -1042
  61. package/dist/contracts/runtime.js +27 -1
  62. package/dist/flow/build-flow-graph.js +4 -875
  63. package/dist/flow/flow-graph-normalization.d.ts +56 -0
  64. package/dist/flow/flow-graph-normalization.js +214 -0
  65. package/dist/flow/flow-graph-runtime.d.ts +8 -0
  66. package/dist/flow/flow-graph-runtime.js +107 -0
  67. package/dist/flow/flow-graph-upstream.d.ts +18 -0
  68. package/dist/flow/flow-graph-upstream.js +498 -0
  69. package/dist/flow/types.d.ts +1 -1
  70. package/dist/index.d.ts +3 -3
  71. package/dist/index.js +1 -1
  72. package/dist/init-project.d.ts +1 -12
  73. package/dist/init-project.js +1 -651
  74. package/dist/{procedural → knowledge/procedural}/manager.d.ts +3 -3
  75. package/dist/{procedural → knowledge/procedural}/manager.js +6 -6
  76. package/dist/mcp.d.ts +2 -76
  77. package/dist/mcp.js +2 -428
  78. package/dist/package-version.d.ts +1 -1
  79. package/dist/package-version.js +1 -1
  80. package/dist/persistence/file-store.js +1 -1
  81. package/dist/persistence/sqlite-runtime.d.ts +19 -0
  82. package/dist/persistence/sqlite-runtime.js +86 -0
  83. package/dist/persistence/sqlite-store.js +11 -99
  84. package/dist/{request-events.d.ts → projections/request-events.d.ts} +1 -1
  85. package/dist/{upstream-events.js → projections/upstream-events.js} +1 -1
  86. package/dist/protocol/a2a/http-discovery.d.ts +39 -0
  87. package/dist/protocol/a2a/http-discovery.js +178 -0
  88. package/dist/protocol/a2a/http-rpc.d.ts +28 -0
  89. package/dist/protocol/a2a/http-rpc.js +623 -0
  90. package/dist/protocol/a2a/http.d.ts +72 -1
  91. package/dist/protocol/a2a/http.js +14 -1124
  92. package/dist/protocol/a2a/task-state.d.ts +29 -0
  93. package/dist/protocol/a2a/task-state.js +317 -0
  94. package/dist/protocol/acp/client.js +1 -1
  95. package/dist/protocol/acp/harness-client.d.ts +50 -0
  96. package/dist/protocol/acp/harness-client.js +219 -0
  97. package/dist/protocol/acp/server.d.ts +116 -0
  98. package/dist/protocol/acp/server.js +310 -0
  99. package/dist/protocol/ag-ui/http.js +1 -1
  100. package/dist/protocol/mcp/server.d.ts +76 -0
  101. package/dist/protocol/mcp/server.js +428 -0
  102. package/dist/resource/backend/workspace-scoped-backend.d.ts +40 -0
  103. package/dist/resource/backend/workspace-scoped-backend.js +296 -0
  104. package/dist/resource/mcp/tool-support.d.ts +35 -0
  105. package/dist/resource/mcp/tool-support.js +296 -0
  106. package/dist/resource/mcp-tool-support.d.ts +2 -35
  107. package/dist/resource/mcp-tool-support.js +2 -296
  108. package/dist/resource/providers/resource-provider.d.ts +22 -0
  109. package/dist/resource/providers/resource-provider.js +215 -0
  110. package/dist/resource/resource-impl.d.ts +3 -33
  111. package/dist/resource/resource-impl.js +2 -808
  112. package/dist/resource/resource-types.d.ts +33 -0
  113. package/dist/resource/resource-types.js +1 -0
  114. package/dist/resource/tools/function-tool-resolver.d.ts +2 -0
  115. package/dist/resource/tools/function-tool-resolver.js +306 -0
  116. package/dist/runtime/adapter/middleware-assembly.js +1 -1
  117. package/dist/runtime/adapter/model/invocation-request.js +2 -2
  118. package/dist/runtime/adapter/model/message-assembly.js +1 -1
  119. package/dist/runtime/agent-runtime-adapter.d.ts +3 -63
  120. package/dist/runtime/agent-runtime-adapter.js +7 -235
  121. package/dist/runtime/agent-runtime-assembly.d.ts +67 -0
  122. package/dist/runtime/agent-runtime-assembly.js +211 -0
  123. package/dist/runtime/harness/background-runtime.d.ts +1 -1
  124. package/dist/runtime/harness/events/event-sink.js +1 -1
  125. package/dist/runtime/harness/events/runtime-event-operations.d.ts +1 -1
  126. package/dist/runtime/harness/events/streaming.js +1 -1
  127. package/dist/runtime/harness/public-shapes.d.ts +43 -0
  128. package/dist/runtime/harness/public-shapes.js +186 -0
  129. package/dist/runtime/harness/run/inspection.js +2 -2
  130. package/dist/runtime/harness/run/resources.js +1 -1
  131. package/dist/runtime/harness/run/surface-semantics.js +1 -1
  132. package/dist/runtime/harness/system/inventory.d.ts +1 -1
  133. package/dist/runtime/harness/system/inventory.js +2 -2
  134. package/dist/runtime/harness/system/policy-engine.js +1 -1
  135. package/dist/runtime/harness/system/runtime-memory-manager.js +1 -1
  136. package/dist/runtime/harness/system/skill-requirements.d.ts +1 -1
  137. package/dist/runtime/harness/system/skill-requirements.js +1 -1
  138. package/dist/runtime/harness.d.ts +2 -2
  139. package/dist/runtime/harness.js +7 -191
  140. package/dist/runtime/maintenance/checkpoint-maintenance.js +1 -1
  141. package/dist/runtime/maintenance/runtime-record-maintenance.js +1 -1
  142. package/dist/runtime/parsing/output-content.d.ts +11 -0
  143. package/dist/runtime/parsing/output-content.js +442 -0
  144. package/dist/runtime/parsing/output-parsing.d.ts +3 -29
  145. package/dist/runtime/parsing/output-parsing.js +3 -806
  146. package/dist/runtime/parsing/output-recovery.d.ts +14 -0
  147. package/dist/runtime/parsing/output-recovery.js +288 -0
  148. package/dist/runtime/parsing/output-tool-args.d.ts +4 -0
  149. package/dist/runtime/parsing/output-tool-args.js +120 -0
  150. package/dist/runtime/support/runtime-factories.js +1 -1
  151. package/dist/scaffold/init-project.d.ts +12 -0
  152. package/dist/scaffold/init-project.js +651 -0
  153. package/dist/{extensions.d.ts → tooling/extensions.d.ts} +1 -1
  154. package/dist/{extensions.js → tooling/extensions.js} +3 -3
  155. package/dist/{tool-modules.d.ts → tooling/module-loader.d.ts} +1 -1
  156. package/dist/{tool-modules.js → tooling/module-loader.js} +2 -2
  157. package/dist/workspace/agent-binding-compiler.js +2 -2
  158. package/dist/workspace/compile.js +2 -2
  159. package/dist/workspace/object-loader-paths.d.ts +11 -0
  160. package/dist/workspace/object-loader-paths.js +75 -0
  161. package/dist/workspace/object-loader-readers.d.ts +21 -0
  162. package/dist/workspace/object-loader-readers.js +187 -0
  163. package/dist/workspace/object-loader.d.ts +0 -1
  164. package/dist/workspace/object-loader.js +6 -260
  165. package/dist/workspace/resource-compilers.js +1 -1
  166. package/dist/workspace/support/discovery.js +1 -1
  167. package/package.json +1 -1
  168. package/dist/runtime/adapter/index.d.ts +0 -13
  169. package/dist/runtime/adapter/index.js +0 -13
  170. package/dist/runtime/harness/index.d.ts +0 -19
  171. package/dist/runtime/harness/index.js +0 -19
  172. package/dist/runtime/maintenance/index.d.ts +0 -4
  173. package/dist/runtime/maintenance/index.js +0 -4
  174. package/dist/runtime/parsing/index.d.ts +0 -2
  175. package/dist/runtime/parsing/index.js +0 -2
  176. package/dist/runtime/support/index.d.ts +0 -4
  177. package/dist/runtime/support/index.js +0 -4
  178. package/dist/workspace/support/index.d.ts +0 -2
  179. package/dist/workspace/support/index.js +0 -2
  180. /package/dist/{procedural → knowledge/procedural}/config.d.ts +0 -0
  181. /package/dist/{procedural → knowledge/procedural}/config.js +0 -0
  182. /package/dist/{procedural → knowledge/procedural}/index.d.ts +0 -0
  183. /package/dist/{procedural → knowledge/procedural}/index.js +0 -0
  184. /package/dist/{presentation.d.ts → projections/presentation.d.ts} +0 -0
  185. /package/dist/{presentation.js → projections/presentation.js} +0 -0
  186. /package/dist/{request-events.js → projections/request-events.js} +0 -0
  187. /package/dist/{upstream-events.d.ts → projections/upstream-events.d.ts} +0 -0
  188. /package/dist/runtime/{support → env}/runtime-env.d.ts +0 -0
  189. /package/dist/runtime/{support → env}/runtime-env.js +0 -0
  190. /package/dist/runtime/{support → layout}/runtime-layout.d.ts +0 -0
  191. /package/dist/runtime/{support → layout}/runtime-layout.js +0 -0
  192. /package/dist/runtime/{support → prompts}/runtime-prompts.d.ts +0 -0
  193. /package/dist/runtime/{support → prompts}/runtime-prompts.js +0 -0
  194. /package/dist/runtime/{support → skills}/skill-metadata.d.ts +0 -0
  195. /package/dist/runtime/{support → skills}/skill-metadata.js +0 -0
@@ -0,0 +1,248 @@
1
+ import type { RequestState } from "./core.js";
2
+ export type SessionSummary = {
3
+ agentId: string;
4
+ sessionId: string;
5
+ latestRequestId: string;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ status: RequestState;
9
+ currentAgentId?: string;
10
+ };
11
+ export type SessionListSummary = SessionSummary & {
12
+ entryAgentId: string;
13
+ messageCount: number;
14
+ hasVisibleMessages: boolean;
15
+ lastMessageRole?: import("./runtime-requests.js").TranscriptMessage["role"];
16
+ title?: string;
17
+ snippet?: string;
18
+ };
19
+ export type KnownHarnessEventType = "request.created" | "request.queued" | "request.dequeued" | "request.state.changed" | "request.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "runtime.health.changed" | "runtime.synthetic_fallback";
20
+ export type HarnessEventType = KnownHarnessEventType | (string & {});
21
+ export type HarnessEvent = {
22
+ eventId: string;
23
+ eventType: HarnessEventType;
24
+ timestamp: string;
25
+ sessionId: string;
26
+ requestId: string;
27
+ sequence: number;
28
+ source: "runtime" | "policy" | "surface" | "worker";
29
+ payload: Record<string, unknown>;
30
+ };
31
+ export type HarnessEventListener = (event: HarnessEvent) => void | Promise<void>;
32
+ export type HarnessEventProjection = {
33
+ name?: string;
34
+ shouldHandle?: (event: HarnessEvent) => boolean;
35
+ handleEvent: HarnessEventListener;
36
+ };
37
+ export type RuntimeTimelineItem = {
38
+ eventId: string;
39
+ sessionId: string;
40
+ requestId: string;
41
+ eventType: HarnessEventType;
42
+ timestamp: string;
43
+ sequence: number;
44
+ source: HarnessEvent["source"];
45
+ kind: "request" | "queue" | "approval" | "recovery" | "artifact" | "other";
46
+ payload: Record<string, unknown>;
47
+ };
48
+ export type RuntimeTimelineProjectionOptions = {
49
+ sessionId?: string;
50
+ requestId?: string;
51
+ };
52
+ export type RuntimeHistoryItem = {
53
+ type: "thinking";
54
+ text: string;
55
+ } | {
56
+ type: "step";
57
+ step: string;
58
+ category: "llm" | "tool" | "skill" | "memory" | "chain" | "approval";
59
+ status: "started" | "completed" | "failed";
60
+ key: string;
61
+ } | {
62
+ type: "tool-result";
63
+ toolName: string;
64
+ output: unknown;
65
+ isError?: boolean;
66
+ key: string;
67
+ };
68
+ export type RuntimeSurfaceKind = "agent" | "llm" | "memory" | "skill" | "tool";
69
+ export type RuntimeSurfaceItem = {
70
+ kind: RuntimeSurfaceKind;
71
+ id: string;
72
+ name: string;
73
+ action: string;
74
+ status: "started" | "completed" | "failed";
75
+ agentId?: string;
76
+ agentName?: string;
77
+ ownerAgentId?: string;
78
+ ownerAgentName?: string;
79
+ sourceEventId?: string;
80
+ detail?: Record<string, unknown>;
81
+ };
82
+ export type AgentReference = {
83
+ id: string;
84
+ name: string;
85
+ };
86
+ export type HealthStatus = "healthy" | "degraded" | "unhealthy";
87
+ export type RuntimeQueueDiagnostics = {
88
+ status: HealthStatus;
89
+ activeRequestSlots: number;
90
+ pendingRequestSlots: number;
91
+ stuckRequests: number;
92
+ queueEvents: RuntimeTimelineItem[];
93
+ summary: string;
94
+ };
95
+ export type RuntimeGovernanceDiagnostics = {
96
+ runsWithGovernance: number;
97
+ highRiskTools: number;
98
+ approvalRequiredTools: number;
99
+ autoApprovedTools: number;
100
+ autoRejectedTools: number;
101
+ untrustedMcpTools: number;
102
+ crossTenantTools: number;
103
+ writeAccessMcpTools: number;
104
+ summary: string;
105
+ };
106
+ export type RuntimeOperatorOverview = {
107
+ updatedAt: string;
108
+ summary: string;
109
+ health: RuntimeHealthSnapshot;
110
+ queue: RuntimeQueueDiagnostics;
111
+ approvals: {
112
+ total: number;
113
+ items: import("./runtime-requests.js").ApprovalRecord[];
114
+ };
115
+ requests: {
116
+ total: number;
117
+ states: Partial<Record<RequestState, number>>;
118
+ items: import("./runtime-requests.js").RequestSummary[];
119
+ };
120
+ governance: RuntimeGovernanceDiagnostics;
121
+ };
122
+ export type RuntimeToolExecutionToolPolicy = {
123
+ toolId: string;
124
+ name: string;
125
+ retryable: boolean;
126
+ hasInputSchema: boolean;
127
+ requiresApproval: boolean;
128
+ };
129
+ export type RuntimeSnapshotModel = {
130
+ id: string;
131
+ provider: string;
132
+ model: string;
133
+ baseUrl?: string;
134
+ };
135
+ export type RuntimeSnapshotTool = {
136
+ name: string;
137
+ description: string;
138
+ };
139
+ export type RuntimeSnapshotSkill = {
140
+ name: string;
141
+ path: string;
142
+ description?: string;
143
+ };
144
+ export type RuntimeSnapshotTracing = {
145
+ enabled: boolean;
146
+ correlationId: string;
147
+ tags?: string[];
148
+ metadata?: Record<string, unknown>;
149
+ };
150
+ export type RuntimeGovernanceRiskLevel = "low" | "medium" | "high";
151
+ export type RuntimeGovernanceDecisionMode = "none" | "manual" | "auto-approve" | "auto-reject" | "deny-and-continue";
152
+ export type RuntimeGovernanceToolPolicy = {
153
+ toolName: string;
154
+ toolId: string;
155
+ toolType: string;
156
+ category: "local" | "backend" | "mcp" | "provider-native";
157
+ mcpServerRef?: string;
158
+ mcpTransport?: string;
159
+ mcpTrustTier?: "trusted" | "reviewed" | "untrusted";
160
+ mcpAccess?: "read-only" | "read-write";
161
+ tenantScope?: "workspace" | "project" | "tenant" | "cross-tenant";
162
+ approvalReason?: string;
163
+ promptInjectionRisk?: RuntimeGovernanceRiskLevel;
164
+ oauthScopes?: string[];
165
+ risk: RuntimeGovernanceRiskLevel;
166
+ requiresApproval: boolean;
167
+ approvalPolicy: "explicit-hitl" | "runtime-default" | "none";
168
+ decisionMode: RuntimeGovernanceDecisionMode;
169
+ hasInputSchema: boolean;
170
+ inputRiskHints: string[];
171
+ };
172
+ export type RuntimeGovernanceBundle = {
173
+ bundleId: string;
174
+ title: string;
175
+ summary: string;
176
+ toolPolicies: RuntimeGovernanceToolPolicy[];
177
+ };
178
+ export type RuntimeSnapshot = {
179
+ agentId: string;
180
+ model?: RuntimeSnapshotModel;
181
+ tools: RuntimeSnapshotTool[];
182
+ skills: RuntimeSnapshotSkill[];
183
+ memory: string[];
184
+ tracing?: RuntimeSnapshotTracing;
185
+ governance?: {
186
+ bundles: RuntimeGovernanceBundle[];
187
+ };
188
+ };
189
+ export type RuntimeToolExecutionPolicy = {
190
+ agentId: string;
191
+ invokeTimeoutMs?: number;
192
+ streamIdleTimeoutMs: number;
193
+ providerRetries: {
194
+ maxAttempts: number;
195
+ backoffMs: number;
196
+ retryableMessages: string[];
197
+ };
198
+ validation: {
199
+ schemaBoundToolCount: number;
200
+ allToolsHaveSchemas: boolean;
201
+ };
202
+ idempotencyHints: {
203
+ replayEligible: boolean;
204
+ retryableToolCount: number;
205
+ nonRetryableToolCount: number;
206
+ };
207
+ tools: RuntimeToolExecutionToolPolicy[];
208
+ };
209
+ export type RuntimeEventSink = {
210
+ publish: (event: HarnessEvent) => void;
211
+ subscribe: (listener: HarnessEventListener) => () => void;
212
+ registerProjection: (projection: HarnessEventProjection) => () => void;
213
+ };
214
+ export type RuntimeHealthCheck = {
215
+ status: HealthStatus;
216
+ updatedAt: string;
217
+ reason?: string;
218
+ };
219
+ export type RuntimeHealthSymptom = {
220
+ code: string;
221
+ severity: "info" | "warn" | "error";
222
+ message: string;
223
+ firstSeenAt: string;
224
+ lastSeenAt: string;
225
+ };
226
+ export type RuntimeHealthSnapshot = {
227
+ status: HealthStatus;
228
+ updatedAt: string;
229
+ checks: {
230
+ runtime: RuntimeHealthCheck;
231
+ llm: RuntimeHealthCheck;
232
+ persistence: RuntimeHealthCheck;
233
+ capacity: RuntimeHealthCheck;
234
+ workload: RuntimeHealthCheck;
235
+ };
236
+ symptoms: RuntimeHealthSymptom[];
237
+ stats: {
238
+ activeRequestSlots: number;
239
+ pendingRequestSlots: number;
240
+ pendingApprovals: number;
241
+ stuckRequests: number;
242
+ checkpointBytes?: number;
243
+ runtimeDbBytes?: number;
244
+ artifactBytes?: number;
245
+ llmSuccessRate1m?: number;
246
+ llmP95LatencyMs1m?: number;
247
+ };
248
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,342 @@
1
+ import type { RequestState } from "./core.js";
2
+ import type { HarnessEvent, RuntimeGovernanceBundle, RuntimeSnapshot, RuntimeSurfaceItem, RuntimeSurfaceKind, RuntimeTimelineItem } from "./runtime-observability.js";
3
+ export type RequestResult = {
4
+ sessionId: string;
5
+ requestId: string;
6
+ state: RequestState;
7
+ output: string;
8
+ finalMessageText?: string;
9
+ outputContent?: unknown;
10
+ contentBlocks?: unknown[];
11
+ structuredResponse?: unknown;
12
+ interruptContent?: string;
13
+ agentId?: string;
14
+ approvalId?: string;
15
+ pendingActionId?: string;
16
+ delegationId?: string;
17
+ artifacts?: ArtifactRecord[];
18
+ metadata?: Record<string, unknown>;
19
+ };
20
+ export type UpstreamRuntimeEvent = unknown;
21
+ export type UpstreamRuntimeEventItem = {
22
+ sessionId: string;
23
+ requestId: string;
24
+ surfaceItem: RuntimeSurfaceItem;
25
+ event: UpstreamRuntimeEvent;
26
+ };
27
+ export type RuntimeListeners = {
28
+ onEvent?: (event: HarnessEvent) => void | Promise<void>;
29
+ onUpstreamEvent?: (event: UpstreamRuntimeEvent) => void | Promise<void>;
30
+ onTraceItem?: (item: UpstreamRuntimeEventItem) => void | Promise<void>;
31
+ onPlanState?: (planState: RequestPlanState) => void | Promise<void>;
32
+ };
33
+ export type RequestExecutionStepKind = RuntimeSurfaceKind | "approval";
34
+ export type RequestExecutionStep = {
35
+ id: string;
36
+ kind: RequestExecutionStepKind;
37
+ name: string;
38
+ action: string;
39
+ status: "started" | "completed" | "failed";
40
+ occurredAt?: string;
41
+ startedAt?: string;
42
+ endedAt?: string;
43
+ agentId?: string;
44
+ agentName?: string;
45
+ ownerAgentId?: string;
46
+ ownerAgentName?: string;
47
+ sourceEventId?: string;
48
+ detail?: Record<string, unknown>;
49
+ output?: unknown;
50
+ isError?: boolean;
51
+ };
52
+ export type RequestPlanItemStatus = "pending" | "in_progress" | "completed" | "failed" | "cancelled" | "blocked" | (string & {});
53
+ export type RequestPlanItem = {
54
+ id?: string;
55
+ content: string;
56
+ status: RequestPlanItemStatus;
57
+ ownerAgentId?: string;
58
+ startedAt?: string;
59
+ endedAt?: string;
60
+ result?: unknown;
61
+ metadata?: Record<string, unknown>;
62
+ };
63
+ export type RequestPlanSummary = {
64
+ total: number;
65
+ pending: number;
66
+ inProgress: number;
67
+ completed: number;
68
+ failed: number;
69
+ cancelled: number;
70
+ blocked: number;
71
+ };
72
+ export type RequestPlanState = {
73
+ sessionId: string;
74
+ requestId: string;
75
+ version: number;
76
+ updatedAt: string;
77
+ items: RequestPlanItem[];
78
+ summary: RequestPlanSummary;
79
+ };
80
+ export type RequestTodoSnapshot = RequestPlanItem & {
81
+ key: string;
82
+ events: RequestExecutionStep[];
83
+ };
84
+ export type RequestApprovalSnapshot = {
85
+ approvalId?: string;
86
+ pendingActionId?: string;
87
+ toolName?: string;
88
+ status?: ApprovalRecord["status"];
89
+ allowedDecisions?: Array<"approve" | "edit" | "reject">;
90
+ };
91
+ export type RequestEventSnapshot = {
92
+ sessionId: string;
93
+ requestId: string;
94
+ updatedAt: string;
95
+ state: RequestResult["state"];
96
+ agentId?: string;
97
+ plan: {
98
+ version: number;
99
+ updatedAt: string;
100
+ summary: RequestPlanSummary;
101
+ items: RequestTodoSnapshot[];
102
+ };
103
+ activeTodoKey?: string;
104
+ activeEventId?: string;
105
+ approval?: RequestApprovalSnapshot;
106
+ output: string;
107
+ contentBlocks?: unknown[];
108
+ structuredResponse?: unknown;
109
+ interruptContent?: string;
110
+ events: RequestExecutionStep[];
111
+ };
112
+ export type RequestDataEvent = {
113
+ type: "output.text.delta";
114
+ sessionId: string;
115
+ requestId: string;
116
+ agentId: string;
117
+ text: string;
118
+ } | {
119
+ type: "progress.commentary";
120
+ sessionId: string;
121
+ requestId: string;
122
+ agentId: string;
123
+ text: string;
124
+ } | {
125
+ type: "output.content-blocks";
126
+ sessionId: string;
127
+ requestId: string;
128
+ agentId: string;
129
+ contentBlocks: unknown[];
130
+ } | {
131
+ type: "tool.result";
132
+ sessionId: string;
133
+ requestId: string;
134
+ agentId: string;
135
+ toolName: string;
136
+ output: unknown;
137
+ isError?: boolean;
138
+ } | {
139
+ type: "debug.upstream";
140
+ sessionId: string;
141
+ requestId: string;
142
+ surfaceItem?: RuntimeSurfaceItem;
143
+ event: UpstreamRuntimeEvent;
144
+ } | {
145
+ type: "debug.profile";
146
+ sessionId: string;
147
+ requestId: string;
148
+ step: RequestExecutionStep;
149
+ };
150
+ export type RequestListeners = RuntimeListeners & {
151
+ eventListener?: (snapshot: RequestEventSnapshot) => void | Promise<void>;
152
+ dataListener?: (event: RequestDataEvent) => void | Promise<void>;
153
+ };
154
+ export type MessageContentPart = {
155
+ type: "text";
156
+ text: string;
157
+ } | {
158
+ type: "image_url";
159
+ image_url: string;
160
+ };
161
+ export type MessageContent = string | MessageContentPart[];
162
+ export type InvocationEnvelope = {
163
+ context?: Record<string, unknown>;
164
+ inputs?: Record<string, unknown>;
165
+ attachments?: Record<string, unknown>;
166
+ capabilities?: Record<string, unknown>;
167
+ };
168
+ export type RequestStartOptions = {
169
+ agentId?: string;
170
+ input: MessageContent;
171
+ sessionId?: string;
172
+ priority?: number;
173
+ invocation?: InvocationEnvelope;
174
+ listeners?: RequestListeners;
175
+ };
176
+ export type RequestDecisionOptions = {
177
+ sessionId: string;
178
+ requestId?: string;
179
+ approvalId?: string;
180
+ decision: "approve" | "edit" | "reject";
181
+ editedInput?: Record<string, unknown>;
182
+ listeners?: RequestListeners;
183
+ };
184
+ export type RequestOptions = RequestStartOptions | RequestDecisionOptions;
185
+ export type HarnessStreamItem = {
186
+ type: "event";
187
+ event: HarnessEvent;
188
+ } | {
189
+ type: "commentary";
190
+ sessionId: string;
191
+ requestId: string;
192
+ agentId: string;
193
+ content: string;
194
+ } | {
195
+ type: "content";
196
+ sessionId: string;
197
+ requestId: string;
198
+ agentId: string;
199
+ content: string;
200
+ } | {
201
+ type: "content-blocks";
202
+ sessionId: string;
203
+ requestId: string;
204
+ agentId: string;
205
+ contentBlocks: unknown[];
206
+ } | {
207
+ type: "tool-result";
208
+ sessionId: string;
209
+ requestId: string;
210
+ agentId: string;
211
+ toolName: string;
212
+ output: unknown;
213
+ isError?: boolean;
214
+ } | {
215
+ type: "plan-state";
216
+ sessionId: string;
217
+ requestId: string;
218
+ agentId: string;
219
+ planState: RequestPlanState;
220
+ } | {
221
+ type: "upstream-event";
222
+ sessionId: string;
223
+ requestId: string;
224
+ surfaceItem?: RuntimeSurfaceItem;
225
+ event: UpstreamRuntimeEvent;
226
+ } | {
227
+ type: "profile-step";
228
+ sessionId: string;
229
+ requestId: string;
230
+ step: RequestExecutionStep;
231
+ } | {
232
+ type: "result";
233
+ result: RequestResult;
234
+ };
235
+ export type TranscriptMessage = {
236
+ role: "user" | "assistant";
237
+ content: MessageContent;
238
+ requestId: string;
239
+ createdAt: string;
240
+ };
241
+ export type SessionRequestRecord = {
242
+ requestId: string;
243
+ sessionId: string;
244
+ agentId: string;
245
+ parentRequestId?: string;
246
+ executionMode: string;
247
+ adapterKind?: string;
248
+ createdAt: string;
249
+ updatedAt: string;
250
+ state: RequestState;
251
+ checkpointRef: string | null;
252
+ resumable: boolean;
253
+ startedAt: string;
254
+ endedAt?: string;
255
+ lastActivityAt: string;
256
+ currentAgentId?: string;
257
+ delegationChain: string[];
258
+ runtimeSnapshot?: RuntimeSnapshot;
259
+ };
260
+ export type RequestSummary = SessionRequestRecord;
261
+ export type RequestRecord = RequestSummary & {
262
+ traceItems?: unknown[];
263
+ runtimeTimeline?: RuntimeTimelineItem[];
264
+ };
265
+ export type SessionRecord = {
266
+ sessionId: string;
267
+ entryAgentId: string;
268
+ currentAgentId?: string;
269
+ currentState: RequestState;
270
+ latestRequestId: string;
271
+ createdAt: string;
272
+ updatedAt: string;
273
+ messages: TranscriptMessage[];
274
+ requests: RequestRecord[];
275
+ pendingDecision?: {
276
+ approvalId: string;
277
+ pendingActionId: string;
278
+ toolName: string;
279
+ allowedDecisions: Array<"approve" | "edit" | "reject">;
280
+ requestedAt: string;
281
+ };
282
+ };
283
+ export type ResumeOptions = {
284
+ sessionId?: string;
285
+ requestId?: string;
286
+ approvalId?: string;
287
+ decision?: "approve" | "edit" | "reject";
288
+ editedInput?: Record<string, unknown>;
289
+ };
290
+ export type CancelOptions = {
291
+ requestId: string;
292
+ reason?: string;
293
+ };
294
+ export type RestartConversationOptions = {
295
+ sessionId: string;
296
+ mode: "restart-in-session" | "restart-new-session";
297
+ input: string;
298
+ };
299
+ export type ApprovalRecord = {
300
+ approvalId: string;
301
+ pendingActionId: string;
302
+ sessionId: string;
303
+ requestId: string;
304
+ toolName: string;
305
+ approvalReason?: string;
306
+ status: "pending" | "approved" | "edited" | "rejected" | "expired";
307
+ requestedAt: string;
308
+ resolvedAt: string | null;
309
+ allowedDecisions: Array<"approve" | "edit" | "reject">;
310
+ inputPreview: Record<string, unknown>;
311
+ };
312
+ export type InternalApprovalRecord = ApprovalRecord & {
313
+ toolCallId: string;
314
+ checkpointRef: string;
315
+ eventRefs: string[];
316
+ };
317
+ export type ArtifactRecord = {
318
+ artifactId: string;
319
+ kind: string;
320
+ path: string;
321
+ createdAt: string;
322
+ };
323
+ export type ArtifactListing = {
324
+ sessionId: string;
325
+ requestId: string;
326
+ items: ArtifactRecord[];
327
+ };
328
+ export type RuntimeApprovalSummary = {
329
+ total: number;
330
+ pending: number;
331
+ approved: number;
332
+ edited: number;
333
+ rejected: number;
334
+ expired: number;
335
+ toolNames: string[];
336
+ approvalReasons: string[];
337
+ };
338
+ export type RuntimeGovernanceEvidence = {
339
+ bundles: RuntimeGovernanceBundle[];
340
+ approvalSummary: RuntimeApprovalSummary;
341
+ summary: string;
342
+ };
@@ -0,0 +1 @@
1
+ export {};