@botbotgo/agent-harness 0.0.308 → 0.0.310
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 +17 -1
- package/README.zh.md +17 -1
- package/dist/acp.d.ts +1 -116
- package/dist/acp.js +1 -310
- package/dist/api.d.ts +4 -2
- package/dist/api.js +4 -1
- package/dist/cli/chat-interactive.d.ts +24 -0
- package/dist/cli/chat-interactive.js +244 -0
- package/dist/cli/chat-rendering.d.ts +9 -0
- package/dist/cli/chat-rendering.js +102 -0
- package/dist/cli/chat-stream.d.ts +23 -0
- package/dist/cli/chat-stream.js +330 -0
- package/dist/cli/chat-ui.d.ts +20 -0
- package/dist/cli/chat-ui.js +198 -0
- package/dist/cli/chat-workspace.d.ts +15 -0
- package/dist/cli/chat-workspace.js +205 -0
- package/dist/cli/main.d.ts +52 -0
- package/dist/cli/main.js +323 -0
- package/dist/cli/managed-service-commands.d.ts +23 -0
- package/dist/cli/managed-service-commands.js +63 -0
- package/dist/cli/managed-service.d.ts +27 -0
- package/dist/cli/managed-service.js +61 -0
- package/dist/cli/options-init-chat.d.ts +16 -0
- package/dist/cli/options-init-chat.js +108 -0
- package/dist/cli/options-runtime.d.ts +27 -0
- package/dist/cli/options-runtime.js +158 -0
- package/dist/cli/options-serve.d.ts +24 -0
- package/dist/cli/options-serve.js +166 -0
- package/dist/cli/options.d.ts +5 -0
- package/dist/cli/options.js +47 -0
- package/dist/cli/process-guards.d.ts +14 -0
- package/dist/cli/process-guards.js +139 -0
- package/dist/cli/request-tree.d.ts +12 -0
- package/dist/cli/request-tree.js +296 -0
- package/dist/cli/runtime-commands.d.ts +15 -0
- package/dist/cli/runtime-commands.js +247 -0
- package/dist/cli/runtime-output.d.ts +5 -0
- package/dist/cli/runtime-output.js +124 -0
- package/dist/cli/server-commands.d.ts +36 -0
- package/dist/cli/server-commands.js +250 -0
- package/dist/cli/workspace.d.ts +6 -0
- package/dist/cli/workspace.js +71 -0
- package/dist/cli.d.ts +1 -67
- package/dist/cli.js +2 -2734
- package/dist/client/acp.d.ts +1 -50
- package/dist/client/acp.js +1 -219
- package/dist/client/in-process.d.ts +5 -5
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +1 -1
- package/dist/contracts/runtime-evaluation.d.ts +103 -0
- package/dist/contracts/runtime-evaluation.js +1 -0
- package/dist/contracts/runtime-memory.d.ts +162 -0
- package/dist/contracts/runtime-memory.js +1 -0
- package/dist/contracts/runtime-observability.d.ts +248 -0
- package/dist/contracts/runtime-observability.js +1 -0
- package/dist/contracts/runtime-requests.d.ts +342 -0
- package/dist/contracts/runtime-requests.js +1 -0
- package/dist/contracts/runtime-scheduling.d.ts +146 -0
- package/dist/contracts/runtime-scheduling.js +1 -0
- package/dist/contracts/runtime.d.ts +5 -1042
- package/dist/contracts/runtime.js +27 -1
- package/dist/flow/build-flow-graph.js +4 -875
- package/dist/flow/flow-graph-normalization.d.ts +56 -0
- package/dist/flow/flow-graph-normalization.js +214 -0
- package/dist/flow/flow-graph-runtime.d.ts +8 -0
- package/dist/flow/flow-graph-runtime.js +107 -0
- package/dist/flow/flow-graph-upstream.d.ts +18 -0
- package/dist/flow/flow-graph-upstream.js +498 -0
- package/dist/flow/types.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/init-project.d.ts +1 -12
- package/dist/init-project.js +1 -651
- package/dist/{procedural → knowledge/procedural}/manager.d.ts +3 -3
- package/dist/{procedural → knowledge/procedural}/manager.js +6 -6
- package/dist/mcp.d.ts +2 -62
- package/dist/mcp.js +2 -253
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.js +1 -1
- package/dist/persistence/sqlite-runtime.d.ts +19 -0
- package/dist/persistence/sqlite-runtime.js +86 -0
- package/dist/persistence/sqlite-store.js +11 -99
- package/dist/{request-events.d.ts → projections/request-events.d.ts} +1 -1
- package/dist/{upstream-events.js → projections/upstream-events.js} +1 -1
- package/dist/protocol/a2a/http-discovery.d.ts +39 -0
- package/dist/protocol/a2a/http-discovery.js +178 -0
- package/dist/protocol/a2a/http-rpc.d.ts +28 -0
- package/dist/protocol/a2a/http-rpc.js +623 -0
- package/dist/protocol/a2a/http.d.ts +72 -1
- package/dist/protocol/a2a/http.js +14 -1124
- package/dist/protocol/a2a/task-state.d.ts +29 -0
- package/dist/protocol/a2a/task-state.js +317 -0
- package/dist/protocol/acp/client.js +1 -1
- package/dist/protocol/acp/harness-client.d.ts +50 -0
- package/dist/protocol/acp/harness-client.js +219 -0
- package/dist/protocol/acp/server.d.ts +116 -0
- package/dist/protocol/acp/server.js +310 -0
- package/dist/protocol/ag-ui/http.js +1 -1
- package/dist/protocol/mcp/server.d.ts +76 -0
- package/dist/protocol/mcp/server.js +428 -0
- package/dist/resource/backend/workspace-scoped-backend.d.ts +40 -0
- package/dist/resource/backend/workspace-scoped-backend.js +296 -0
- package/dist/resource/mcp/tool-support.d.ts +35 -0
- package/dist/resource/mcp/tool-support.js +296 -0
- package/dist/resource/mcp-tool-support.d.ts +2 -35
- package/dist/resource/mcp-tool-support.js +2 -296
- package/dist/resource/providers/resource-provider.d.ts +22 -0
- package/dist/resource/providers/resource-provider.js +215 -0
- package/dist/resource/resource-impl.d.ts +3 -33
- package/dist/resource/resource-impl.js +2 -808
- package/dist/resource/resource-types.d.ts +33 -0
- package/dist/resource/resource-types.js +1 -0
- package/dist/resource/tools/function-tool-resolver.d.ts +2 -0
- package/dist/resource/tools/function-tool-resolver.js +306 -0
- package/dist/runtime/adapter/middleware-assembly.js +1 -1
- package/dist/runtime/adapter/model/invocation-request.js +2 -2
- package/dist/runtime/adapter/model/message-assembly.js +1 -1
- package/dist/runtime/agent-runtime-adapter.d.ts +3 -63
- package/dist/runtime/agent-runtime-adapter.js +5 -233
- package/dist/runtime/agent-runtime-assembly.d.ts +67 -0
- package/dist/runtime/agent-runtime-assembly.js +211 -0
- package/dist/runtime/harness/background-runtime.d.ts +1 -1
- package/dist/runtime/harness/events/event-sink.js +1 -1
- package/dist/runtime/harness/events/runtime-event-operations.d.ts +1 -1
- package/dist/runtime/harness/events/streaming.js +1 -1
- package/dist/runtime/harness/public-shapes.d.ts +43 -0
- package/dist/runtime/harness/public-shapes.js +186 -0
- package/dist/runtime/harness/run/inspection.js +2 -2
- package/dist/runtime/harness/run/resources.js +1 -1
- package/dist/runtime/harness/run/surface-semantics.js +1 -1
- package/dist/runtime/harness/system/inventory.d.ts +1 -1
- package/dist/runtime/harness/system/inventory.js +2 -2
- package/dist/runtime/harness/system/policy-engine.js +1 -1
- package/dist/runtime/harness/system/runtime-memory-manager.js +1 -1
- package/dist/runtime/harness/system/skill-requirements.d.ts +1 -1
- package/dist/runtime/harness/system/skill-requirements.js +1 -1
- package/dist/runtime/harness.d.ts +3 -2
- package/dist/runtime/harness.js +11 -191
- package/dist/runtime/maintenance/checkpoint-maintenance.js +1 -1
- package/dist/runtime/maintenance/runtime-record-maintenance.js +1 -1
- package/dist/runtime/parsing/output-content.d.ts +11 -0
- package/dist/runtime/parsing/output-content.js +442 -0
- package/dist/runtime/parsing/output-parsing.d.ts +3 -29
- package/dist/runtime/parsing/output-parsing.js +3 -806
- package/dist/runtime/parsing/output-recovery.d.ts +14 -0
- package/dist/runtime/parsing/output-recovery.js +288 -0
- package/dist/runtime/parsing/output-tool-args.d.ts +4 -0
- package/dist/runtime/parsing/output-tool-args.js +120 -0
- package/dist/runtime/support/runtime-factories.js +1 -1
- package/dist/scaffold/init-project.d.ts +12 -0
- package/dist/scaffold/init-project.js +651 -0
- package/dist/{extensions.d.ts → tooling/extensions.d.ts} +1 -1
- package/dist/{extensions.js → tooling/extensions.js} +3 -3
- package/dist/{tool-modules.d.ts → tooling/module-loader.d.ts} +1 -1
- package/dist/{tool-modules.js → tooling/module-loader.js} +2 -2
- package/dist/workspace/agent-binding-compiler.js +2 -2
- package/dist/workspace/compile.js +2 -2
- package/dist/workspace/object-loader-paths.d.ts +11 -0
- package/dist/workspace/object-loader-paths.js +75 -0
- package/dist/workspace/object-loader-readers.d.ts +21 -0
- package/dist/workspace/object-loader-readers.js +187 -0
- package/dist/workspace/object-loader.d.ts +0 -1
- package/dist/workspace/object-loader.js +6 -260
- package/dist/workspace/resource-compilers.js +1 -1
- package/dist/workspace/support/discovery.js +1 -1
- package/package.json +1 -1
- package/dist/runtime/adapter/index.d.ts +0 -13
- package/dist/runtime/adapter/index.js +0 -13
- package/dist/runtime/harness/index.d.ts +0 -19
- package/dist/runtime/harness/index.js +0 -19
- package/dist/runtime/maintenance/index.d.ts +0 -4
- package/dist/runtime/maintenance/index.js +0 -4
- package/dist/runtime/parsing/index.d.ts +0 -2
- package/dist/runtime/parsing/index.js +0 -2
- package/dist/runtime/support/index.d.ts +0 -4
- package/dist/runtime/support/index.js +0 -4
- package/dist/workspace/support/index.d.ts +0 -2
- package/dist/workspace/support/index.js +0 -2
- /package/dist/{procedural → knowledge/procedural}/config.d.ts +0 -0
- /package/dist/{procedural → knowledge/procedural}/config.js +0 -0
- /package/dist/{procedural → knowledge/procedural}/index.d.ts +0 -0
- /package/dist/{procedural → knowledge/procedural}/index.js +0 -0
- /package/dist/{presentation.d.ts → projections/presentation.d.ts} +0 -0
- /package/dist/{presentation.js → projections/presentation.js} +0 -0
- /package/dist/{request-events.js → projections/request-events.js} +0 -0
- /package/dist/{upstream-events.d.ts → projections/upstream-events.d.ts} +0 -0
- /package/dist/runtime/{support → env}/runtime-env.d.ts +0 -0
- /package/dist/runtime/{support → env}/runtime-env.js +0 -0
- /package/dist/runtime/{support → layout}/runtime-layout.d.ts +0 -0
- /package/dist/runtime/{support → layout}/runtime-layout.js +0 -0
- /package/dist/runtime/{support → prompts}/runtime-prompts.d.ts +0 -0
- /package/dist/runtime/{support → prompts}/runtime-prompts.js +0 -0
- /package/dist/runtime/{support → skills}/skill-metadata.d.ts +0 -0
- /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 {};
|