@botbotgo/agent-harness 0.0.190 → 0.0.191
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 +2 -1
- package/README.zh.md +2 -1
- package/dist/api.d.ts +17 -1
- package/dist/api.js +35 -0
- package/dist/cli.js +56 -5
- package/dist/contracts/runtime.d.ts +25 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/runtime/harness/run/operator-overview.d.ts +7 -0
- package/dist/runtime/harness/run/operator-overview.js +73 -0
- package/dist/runtime/harness.d.ts +4 -1
- package/dist/runtime/harness.js +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
<p align="center">
|
|
35
35
|
<a href="./LICENSE">License</a> · <a href="./CONTRIBUTING.md">Contributing</a> ·
|
|
36
36
|
<a href="./SECURITY.md">Security</a> · <a href="./CODE_OF_CONDUCT.md">Code of Conduct</a>
|
|
37
|
+
· <a href="https://github.com/sponsors/botbotgo">Sponsorship</a>
|
|
37
38
|
</p>
|
|
38
39
|
|
|
39
40
|
<p align="center">
|
|
@@ -984,5 +985,5 @@ ACP transport notes:
|
|
|
984
985
|
- `exportRequestPackage(...)` and `exportSessionPackage(...)` package stable runtime records, transcript, approvals, events, and artifacts for operator tooling without reaching into persistence internals.
|
|
985
986
|
- `runtime/default.governance.remoteMcp` can now deny or allow specific MCP servers, raise approval requirements by transport, and stamp transport-based risk tiers into runtime governance bundles. MCP server catalogs can also declare trust tier, access mode, tenant scope, approval policy, prompt-injection risk, and OAuth scope metadata so governance bundles capture why one remote tool is treated as high-risk.
|
|
986
987
|
- `runtime/default.observability.tracing` can now describe exporter metadata such as OTLP endpoints and propagation mode, so frozen runtime snapshots keep trace-correlation plus operator-visible export context without exposing backend-private span internals.
|
|
987
|
-
- `agent-harness runtime health`, `agent-harness runtime approvals list|watch`, and `agent-harness runtime runs list|tail` provide a thin operator CLI over persisted runtime health, approval queues, and active run state.
|
|
988
|
+
- `agent-harness runtime overview`, `agent-harness runtime health`, `agent-harness runtime approvals list|watch`, and `agent-harness runtime runs list|tail` provide a thin operator CLI over persisted runtime health, queue pressure, governance risk, approval queues, and active run state.
|
|
988
989
|
- detailed A2A adapter guidance lives in [`docs/a2a-bridge.md`](docs/a2a-bridge.md)
|
package/README.zh.md
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
<p align="center">
|
|
35
35
|
<a href="./LICENSE">许可证</a> · <a href="./CONTRIBUTING.md">贡献指南</a> ·
|
|
36
36
|
<a href="./SECURITY.md">安全说明</a> · <a href="./CODE_OF_CONDUCT.md">行为准则</a>
|
|
37
|
+
· <a href="https://github.com/sponsors/botbotgo">赞助支持</a>
|
|
37
38
|
</p>
|
|
38
39
|
|
|
39
40
|
<p align="center">
|
|
@@ -943,5 +944,5 @@ ACP transport 说明:
|
|
|
943
944
|
- `exportRequestPackage(...)` 与 `exportSessionPackage(...)` 可把稳定 runtime 记录、transcript、approvals、events 和 artifacts 打包给 operator tooling,而不必直接访问 persistence 内部实现。
|
|
944
945
|
- `runtime/default.governance.remoteMcp` 现在可以按 MCP server 或 transport 做 allow/deny、审批升级,并把 transport 风险等级写进 runtime governance bundles。MCP server catalog 也可以声明 trust tier、access mode、tenant scope、approval policy、prompt-injection risk 与 OAuth scope 元数据,让治理快照能解释为什么某个远端工具被视为高风险。
|
|
945
946
|
- `runtime/default.observability.tracing` 现在可描述 OTLP endpoint 和 propagation mode 这类 exporter 元数据,使冻结的 runtime snapshot 在保留 trace correlation 的同时,也能保留对 operator 有意义的导出上下文,而不暴露 backend 私有 span 细节。
|
|
946
|
-
- `agent-harness runtime health`、`agent-harness runtime approvals list|watch` 与 `agent-harness runtime runs list|tail` 提供了一层轻量 operator CLI,可直接查看 runtime health、审批队列和运行状态。
|
|
947
|
+
- `agent-harness runtime overview`、`agent-harness runtime health`、`agent-harness runtime approvals list|watch` 与 `agent-harness runtime runs list|tail` 提供了一层轻量 operator CLI,可直接查看 runtime health、queue pressure、governance risk、审批队列和运行状态。
|
|
947
948
|
- 更详细的 A2A 适配层开发说明见 [`docs/a2a-bridge.md`](docs/a2a-bridge.md)
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArtifactListing, CancelOptions, InvocationEnvelope, ListMemoriesInput, ListMemoriesResult, MemoryRecord, MemorizeInput, MemorizeResult, MessageContent, RecallInput, RecallResult, RemoveMemoryInput, RequestRecord, RequestSummary, ResumeOptions, RunDecisionOptions, RunListeners, RunResult, RunStartOptions, RuntimeHealthSnapshot, RuntimeAdapterOptions, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult as InternalRuntimeEvaluationReplayResult, RuntimeSessionPackage, RuntimeSessionPackageInput, SessionRecord, SessionSummary, TranscriptMessage, UpdateMemoryInput, WorkspaceLoadOptions } from "./contracts/types.js";
|
|
1
|
+
import type { ArtifactListing, CancelOptions, InvocationEnvelope, ListMemoriesInput, ListMemoriesResult, MemoryRecord, MemorizeInput, MemorizeResult, MessageContent, RecallInput, RecallResult, RemoveMemoryInput, RequestRecord, RequestSummary, ResumeOptions, RunDecisionOptions, RunListeners, RunResult, RunStartOptions, RuntimeHealthSnapshot, RuntimeGovernanceDiagnostics, RuntimeOperatorOverview, RuntimeQueueDiagnostics, RuntimeAdapterOptions, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult as InternalRuntimeEvaluationReplayResult, RuntimeSessionPackage, RuntimeSessionPackageInput, SessionRecord, SessionSummary, TranscriptMessage, UpdateMemoryInput, WorkspaceLoadOptions } from "./contracts/types.js";
|
|
2
2
|
import { AgentHarnessRuntime } from "./runtime/harness.js";
|
|
3
3
|
import type { InventoryAgentRecord, InventorySkillRecord } from "./runtime/harness/system/inventory.js";
|
|
4
4
|
import type { RequirementAssessmentOptions } from "./runtime/harness/system/skill-requirements.js";
|
|
@@ -72,6 +72,19 @@ export type RequestPackage = {
|
|
|
72
72
|
export type RuntimeEvaluationReplayResult = Omit<InternalRuntimeEvaluationReplayResult, "result"> & {
|
|
73
73
|
result: PublicRunResult;
|
|
74
74
|
};
|
|
75
|
+
export type OperatorOverview = Omit<RuntimeOperatorOverview, "approvals" | "runs"> & {
|
|
76
|
+
approvals: {
|
|
77
|
+
total: number;
|
|
78
|
+
items: Approval[];
|
|
79
|
+
};
|
|
80
|
+
runs: {
|
|
81
|
+
total: number;
|
|
82
|
+
states: Partial<Record<RequestSummary["state"], number>>;
|
|
83
|
+
items: RequestSummary[];
|
|
84
|
+
};
|
|
85
|
+
queue: RuntimeQueueDiagnostics;
|
|
86
|
+
governance: RuntimeGovernanceDiagnostics;
|
|
87
|
+
};
|
|
75
88
|
type PublicApprovalFilter = {
|
|
76
89
|
status?: Approval["status"];
|
|
77
90
|
sessionId?: string;
|
|
@@ -144,6 +157,9 @@ export declare function listRequestEvents(runtime: AgentHarnessRuntime, input: {
|
|
|
144
157
|
requestId: string;
|
|
145
158
|
}): Promise<RequestEvent[]>;
|
|
146
159
|
export declare function getHealth(runtime: AgentHarnessRuntime): Promise<RuntimeHealthSnapshot>;
|
|
160
|
+
export declare function getOperatorOverview(runtime: AgentHarnessRuntime, options?: {
|
|
161
|
+
limit?: number;
|
|
162
|
+
}): Promise<OperatorOverview>;
|
|
147
163
|
export declare function exportRequestPackage(runtime: AgentHarnessRuntime, input: RequestPackageInput): Promise<RequestPackage>;
|
|
148
164
|
export declare function exportSessionPackage(runtime: AgentHarnessRuntime, input: RuntimeSessionPackageInput): Promise<RuntimeSessionPackage>;
|
|
149
165
|
export declare function exportEvaluationBundle(runtime: AgentHarnessRuntime, input: RuntimeEvaluationExportInput): Promise<RuntimeEvaluationExport>;
|
package/dist/api.js
CHANGED
|
@@ -134,6 +134,26 @@ function toInternalResumeOptions(options) {
|
|
|
134
134
|
threadId: options.sessionId ?? options.threadId,
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
+
function toPublicRequestSummary(run) {
|
|
138
|
+
return {
|
|
139
|
+
requestId: run.runId,
|
|
140
|
+
sessionId: run.threadId,
|
|
141
|
+
agentId: run.agentId,
|
|
142
|
+
executionMode: run.executionMode,
|
|
143
|
+
adapterKind: run.adapterKind,
|
|
144
|
+
createdAt: run.createdAt,
|
|
145
|
+
updatedAt: run.updatedAt,
|
|
146
|
+
state: run.state,
|
|
147
|
+
checkpointRef: run.checkpointRef,
|
|
148
|
+
resumable: run.resumable,
|
|
149
|
+
startedAt: run.startedAt,
|
|
150
|
+
endedAt: run.endedAt,
|
|
151
|
+
lastActivityAt: run.lastActivityAt,
|
|
152
|
+
currentAgentId: run.currentAgentId,
|
|
153
|
+
delegationChain: run.delegationChain,
|
|
154
|
+
runtimeSnapshot: run.runtimeSnapshot,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
137
157
|
export async function createAgentHarness(workspaceRoot = process.cwd(), options = {}) {
|
|
138
158
|
const workspace = await loadWorkspace(workspaceRoot, options.load ?? {});
|
|
139
159
|
const harness = new AgentHarnessRuntime(workspace, options.adapter ?? {});
|
|
@@ -207,6 +227,21 @@ export async function listRequestEvents(runtime, input) {
|
|
|
207
227
|
export async function getHealth(runtime) {
|
|
208
228
|
return runtime.getHealth();
|
|
209
229
|
}
|
|
230
|
+
export async function getOperatorOverview(runtime, options) {
|
|
231
|
+
const overview = await runtime.getOperatorOverview(options);
|
|
232
|
+
return {
|
|
233
|
+
...overview,
|
|
234
|
+
approvals: {
|
|
235
|
+
total: overview.approvals.total,
|
|
236
|
+
items: overview.approvals.items.map(toApprovalRecord),
|
|
237
|
+
},
|
|
238
|
+
runs: {
|
|
239
|
+
total: overview.runs.total,
|
|
240
|
+
states: overview.runs.states,
|
|
241
|
+
items: overview.runs.items.map(toPublicRequestSummary),
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
}
|
|
210
245
|
export async function exportRequestPackage(runtime, input) {
|
|
211
246
|
return toRequestPackage(await runtime.exportRequestPackage(input));
|
|
212
247
|
}
|
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ function renderUsage() {
|
|
|
14
14
|
agent-harness acp serve [--workspace <path>] [--transport stdio|http] [--host <hostname>] [--port <port>]
|
|
15
15
|
agent-harness a2a serve [--workspace <path>] [--host <hostname>] [--port <port>]
|
|
16
16
|
agent-harness ag-ui serve [--workspace <path>] [--host <hostname>] [--port <port>]
|
|
17
|
+
agent-harness runtime overview [--workspace <path>] [--limit <n>] [--json]
|
|
17
18
|
agent-harness runtime health [--workspace <path>] [--json]
|
|
18
19
|
agent-harness runtime approvals list [--workspace <path>] [--status <pending|approved|edited|rejected|expired>] [--json]
|
|
19
20
|
agent-harness runtime approvals watch [--workspace <path>] [--status <pending|approved|edited|rejected|expired>] [--poll-ms <ms>] [--once] [--json]
|
|
@@ -161,16 +162,17 @@ function parseRuntimeInspectOptions(args) {
|
|
|
161
162
|
let json = false;
|
|
162
163
|
let once = false;
|
|
163
164
|
let pollMs = 1000;
|
|
165
|
+
let limit = 5;
|
|
164
166
|
let status;
|
|
165
167
|
let state;
|
|
166
168
|
let agentId;
|
|
167
169
|
let threadId;
|
|
168
170
|
for (let index = 0; index < args.length; index += 1) {
|
|
169
171
|
const arg = args[index];
|
|
170
|
-
if (arg === "--workspace" || arg === "--status" || arg === "--state" || arg === "--agent" || arg === "--thread" || arg === "--poll-ms") {
|
|
172
|
+
if (arg === "--workspace" || arg === "--status" || arg === "--state" || arg === "--agent" || arg === "--thread" || arg === "--poll-ms" || arg === "--limit") {
|
|
171
173
|
const value = args[index + 1];
|
|
172
174
|
if (!value) {
|
|
173
|
-
return { json, once, pollMs, status, state, agentId, threadId, error: `Missing value for ${arg}` };
|
|
175
|
+
return { json, once, pollMs, limit, status, state, agentId, threadId, error: `Missing value for ${arg}` };
|
|
174
176
|
}
|
|
175
177
|
if (arg === "--workspace") {
|
|
176
178
|
workspaceRoot = value;
|
|
@@ -187,10 +189,17 @@ function parseRuntimeInspectOptions(args) {
|
|
|
187
189
|
else if (arg === "--thread") {
|
|
188
190
|
threadId = value;
|
|
189
191
|
}
|
|
192
|
+
else if (arg === "--limit") {
|
|
193
|
+
const parsedLimit = Number.parseInt(value, 10);
|
|
194
|
+
if (!Number.isFinite(parsedLimit) || parsedLimit <= 0) {
|
|
195
|
+
return { json, once, pollMs, limit, status, state, agentId, threadId, error: `Invalid limit: ${value}` };
|
|
196
|
+
}
|
|
197
|
+
limit = parsedLimit;
|
|
198
|
+
}
|
|
190
199
|
else {
|
|
191
200
|
const parsedPoll = Number.parseInt(value, 10);
|
|
192
201
|
if (!Number.isFinite(parsedPoll) || parsedPoll <= 0) {
|
|
193
|
-
return { json, once, pollMs, status, state, agentId, threadId, error: `Invalid poll interval: ${value}` };
|
|
202
|
+
return { json, once, pollMs, limit, status, state, agentId, threadId, error: `Invalid poll interval: ${value}` };
|
|
194
203
|
}
|
|
195
204
|
pollMs = parsedPoll;
|
|
196
205
|
}
|
|
@@ -205,9 +214,9 @@ function parseRuntimeInspectOptions(args) {
|
|
|
205
214
|
once = true;
|
|
206
215
|
continue;
|
|
207
216
|
}
|
|
208
|
-
return { workspaceRoot, json, once, pollMs, status, state, agentId, threadId, error: `Unknown option: ${arg}` };
|
|
217
|
+
return { workspaceRoot, json, once, pollMs, limit, status, state, agentId, threadId, error: `Unknown option: ${arg}` };
|
|
209
218
|
}
|
|
210
|
-
return { workspaceRoot, json, once, pollMs, status, state, agentId, threadId };
|
|
219
|
+
return { workspaceRoot, json, once, pollMs, limit, status, state, agentId, threadId };
|
|
211
220
|
}
|
|
212
221
|
function renderJson(value) {
|
|
213
222
|
return `${JSON.stringify(value, null, 2)}\n`;
|
|
@@ -302,6 +311,42 @@ function renderRunList(runs) {
|
|
|
302
311
|
return `${runId} thread=${threadId} agent=${agentId}${currentAgent} state=${state}${resumable}${updated}${lastActivity}`;
|
|
303
312
|
}).join("\n") + "\n";
|
|
304
313
|
}
|
|
314
|
+
function renderOperatorOverview(overview, workspacePath) {
|
|
315
|
+
const lines = [];
|
|
316
|
+
const summary = typeof overview.summary === "string" ? overview.summary : "";
|
|
317
|
+
lines.push(`Runtime overview ${workspacePath}`);
|
|
318
|
+
if (summary) {
|
|
319
|
+
lines.push(`Summary: ${summary}`);
|
|
320
|
+
}
|
|
321
|
+
const health = isObject(overview.health) ? overview.health : {};
|
|
322
|
+
if (Object.keys(health).length > 0) {
|
|
323
|
+
lines.push("");
|
|
324
|
+
lines.push(renderHealthSnapshot(health, workspacePath).trimEnd());
|
|
325
|
+
}
|
|
326
|
+
const queue = isObject(overview.queue) ? overview.queue : {};
|
|
327
|
+
if (Object.keys(queue).length > 0) {
|
|
328
|
+
lines.push("");
|
|
329
|
+
lines.push(`Queue: ${typeof queue.summary === "string" ? queue.summary : "unavailable"}`);
|
|
330
|
+
}
|
|
331
|
+
const governance = isObject(overview.governance) ? overview.governance : {};
|
|
332
|
+
if (Object.keys(governance).length > 0) {
|
|
333
|
+
lines.push("Governance:");
|
|
334
|
+
lines.push(` - ${typeof governance.summary === "string" ? governance.summary : "unavailable"}`);
|
|
335
|
+
}
|
|
336
|
+
const approvals = isObject(overview.approvals) ? overview.approvals : {};
|
|
337
|
+
const approvalItems = Array.isArray(approvals.items) ? approvals.items.filter(isObject) : [];
|
|
338
|
+
lines.push(`Pending approvals: ${typeof approvals.total === "number" ? approvals.total : approvalItems.length}`);
|
|
339
|
+
if (approvalItems.length > 0) {
|
|
340
|
+
lines.push(renderApprovalList(approvalItems).trimEnd());
|
|
341
|
+
}
|
|
342
|
+
const runs = isObject(overview.runs) ? overview.runs : {};
|
|
343
|
+
const runItems = Array.isArray(runs.items) ? runs.items.filter(isObject) : [];
|
|
344
|
+
lines.push(`Active runs: ${typeof runs.total === "number" ? runs.total : runItems.length}`);
|
|
345
|
+
if (runItems.length > 0) {
|
|
346
|
+
lines.push(renderRunList(runItems).trimEnd());
|
|
347
|
+
}
|
|
348
|
+
return `${lines.join("\n")}\n`;
|
|
349
|
+
}
|
|
305
350
|
export async function runCli(argv, io = {}, deps = {}) {
|
|
306
351
|
const cwd = io.cwd ?? process.cwd();
|
|
307
352
|
const stdout = io.stdout ?? ((message) => process.stdout.write(message));
|
|
@@ -496,6 +541,12 @@ export async function runCli(argv, io = {}, deps = {}) {
|
|
|
496
541
|
await runtime.stop();
|
|
497
542
|
return 0;
|
|
498
543
|
}
|
|
544
|
+
if (subcommand === "overview") {
|
|
545
|
+
const overview = await runtime.getOperatorOverview({ limit: parsed.limit });
|
|
546
|
+
stdout(parsed.json ? renderJson(overview) : renderOperatorOverview(overview, workspacePath));
|
|
547
|
+
await runtime.stop();
|
|
548
|
+
return 0;
|
|
549
|
+
}
|
|
499
550
|
if (subcommand === "approvals" && (nestedCommand === "list" || nestedCommand === "watch")) {
|
|
500
551
|
const renderApprovals = async () => {
|
|
501
552
|
const approvals = await runtime.listApprovals(parsed.status ? { status: parsed.status } : undefined);
|
|
@@ -70,6 +70,31 @@ export type RuntimeQueueDiagnostics = {
|
|
|
70
70
|
queueEvents: RuntimeTimelineItem[];
|
|
71
71
|
summary: string;
|
|
72
72
|
};
|
|
73
|
+
export type RuntimeGovernanceDiagnostics = {
|
|
74
|
+
runsWithGovernance: number;
|
|
75
|
+
highRiskTools: number;
|
|
76
|
+
approvalRequiredTools: number;
|
|
77
|
+
untrustedMcpTools: number;
|
|
78
|
+
crossTenantTools: number;
|
|
79
|
+
writeAccessMcpTools: number;
|
|
80
|
+
summary: string;
|
|
81
|
+
};
|
|
82
|
+
export type RuntimeOperatorOverview = {
|
|
83
|
+
updatedAt: string;
|
|
84
|
+
summary: string;
|
|
85
|
+
health: RuntimeHealthSnapshot;
|
|
86
|
+
queue: RuntimeQueueDiagnostics;
|
|
87
|
+
approvals: {
|
|
88
|
+
total: number;
|
|
89
|
+
items: ApprovalRecord[];
|
|
90
|
+
};
|
|
91
|
+
runs: {
|
|
92
|
+
total: number;
|
|
93
|
+
states: Partial<Record<RunState, number>>;
|
|
94
|
+
items: RunSummary[];
|
|
95
|
+
};
|
|
96
|
+
governance: RuntimeGovernanceDiagnostics;
|
|
97
|
+
};
|
|
73
98
|
export type RuntimeToolExecutionToolPolicy = {
|
|
74
99
|
toolId: string;
|
|
75
100
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { AgentHarnessAcpServer, AgentHarnessRuntime, buildFlowGraph, cancelRun, createAgentHarness, createAcpServer, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getRequest, getHealth, listMemories, getSession, listAgentSkills, listArtifacts, listApprovals, listRequests, listRequestEvents, listSessions, memorize, normalizeUserChatInput, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, exportFlowGraphToMermaid, exportFlowGraphToSequenceMermaid, } from "./api.js";
|
|
1
|
+
export { AgentHarnessAcpServer, AgentHarnessRuntime, buildFlowGraph, cancelRun, createAgentHarness, createAcpServer, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getOperatorOverview, getRequest, getHealth, listMemories, getSession, listAgentSkills, listArtifacts, listApprovals, listRequests, listRequestEvents, listSessions, memorize, normalizeUserChatInput, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, exportFlowGraphToMermaid, exportFlowGraphToSequenceMermaid, } from "./api.js";
|
|
2
2
|
export type { AcpApproval, AcpArtifact, AcpEventNotification, AcpJsonRpcError, AcpJsonRpcRequest, AcpJsonRpcResponse, AcpJsonRpcSuccess, AcpRequestRecord, AcpRunRequestParams, AcpServerCapabilities, AcpSessionRecord, } from "./acp.js";
|
|
3
|
-
export type { Approval, ListMemoriesInput, ListMemoriesResult, MemoryDecision, MemoryKind, MemoryRecord, MemoryScope, MemorizeInput, MemorizeResult, NormalizeUserChatInputOptions, PublicRunListeners, RequestArtifactListing, RequestEvent, RequestEventType, RequestPackage, RequestPackageInput, RequestResult, RequestUpstreamEventItem, RecallInput, RecallResult, RemoveMemoryInput, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult, RuntimeSessionPackage, RuntimeSessionPackageInput, UpdateMemoryInput, UserChatInput, UserChatMessage, } from "./api.js";
|
|
3
|
+
export type { Approval, ListMemoriesInput, ListMemoriesResult, MemoryDecision, MemoryKind, MemoryRecord, MemoryScope, MemorizeInput, MemorizeResult, NormalizeUserChatInputOptions, OperatorOverview, PublicRunListeners, RequestArtifactListing, RequestEvent, RequestEventType, RequestPackage, RequestPackageInput, RequestResult, RequestUpstreamEventItem, RecallInput, RecallResult, RemoveMemoryInput, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult, RuntimeSessionPackage, RuntimeSessionPackageInput, UpdateMemoryInput, UserChatInput, UserChatMessage, } from "./api.js";
|
|
4
4
|
export type { BuildFlowGraphInput, FlowEdge, FlowEdgeKind, FlowGraph, FlowGraphMermaidOptions, FlowGraphSequenceMermaidOptions, FlowGroup, FlowGroupKind, FlowNode, FlowNodeKind, FlowNodeLayer, FlowNodeStatus, } from "./flow/index.js";
|
|
5
5
|
export type { A2aAgentCard, A2aHttpServer, A2aHttpServerOptions, A2aTask, A2aTaskState, AcpHttpServer, AcpHttpServerOptions, AcpStdioServer, AcpStdioServerOptions, AgUiEvent, AgUiHttpServer, AgUiHttpServerOptions, AgUiRunAgentInput, } from "./api.js";
|
|
6
6
|
export type { RuntimeMcpServerOptions, ToolMcpServerOptions } from "./mcp.js";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AgentHarnessAcpServer, AgentHarnessRuntime, buildFlowGraph, cancelRun, createAgentHarness, createAcpServer, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getRequest, getHealth, listMemories, getSession, listAgentSkills, listArtifacts, listApprovals, listRequests, listRequestEvents, listSessions, memorize, normalizeUserChatInput, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, exportFlowGraphToMermaid, exportFlowGraphToSequenceMermaid, } from "./api.js";
|
|
1
|
+
export { AgentHarnessAcpServer, AgentHarnessRuntime, buildFlowGraph, cancelRun, createAgentHarness, createAcpServer, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getOperatorOverview, getRequest, getHealth, listMemories, getSession, listAgentSkills, listArtifacts, listApprovals, listRequests, listRequestEvents, listSessions, memorize, normalizeUserChatInput, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, exportFlowGraphToMermaid, exportFlowGraphToSequenceMermaid, } from "./api.js";
|
|
2
2
|
export { tool } from "./tools.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.190";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.190";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApprovalRecord, RunSummary, RuntimeOperatorOverview, RuntimeHealthSnapshot } from "../../../contracts/types.js";
|
|
2
|
+
export declare function projectOperatorOverview(input: {
|
|
3
|
+
health: RuntimeHealthSnapshot;
|
|
4
|
+
runs: RunSummary[];
|
|
5
|
+
approvals: ApprovalRecord[];
|
|
6
|
+
limit?: number;
|
|
7
|
+
}): RuntimeOperatorOverview;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { projectQueueDiagnostics } from "./queue-diagnostics.js";
|
|
2
|
+
const ACTIVE_RUN_STATES = new Set([
|
|
3
|
+
"queued",
|
|
4
|
+
"claimed",
|
|
5
|
+
"running",
|
|
6
|
+
"waiting_for_approval",
|
|
7
|
+
"resuming",
|
|
8
|
+
"cancelling",
|
|
9
|
+
]);
|
|
10
|
+
function sortNewestFirst(items, selectTimestamp) {
|
|
11
|
+
return [...items].sort((left, right) => {
|
|
12
|
+
const leftTs = selectTimestamp(left) ?? "";
|
|
13
|
+
const rightTs = selectTimestamp(right) ?? "";
|
|
14
|
+
return rightTs.localeCompare(leftTs);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function summarizeStates(runs) {
|
|
18
|
+
const states = {};
|
|
19
|
+
for (const run of runs) {
|
|
20
|
+
states[run.state] = (states[run.state] ?? 0) + 1;
|
|
21
|
+
}
|
|
22
|
+
return states;
|
|
23
|
+
}
|
|
24
|
+
function collectGovernanceToolPolicies(runs) {
|
|
25
|
+
return runs.flatMap((run) => run.runtimeSnapshot?.governance?.bundles ?? [])
|
|
26
|
+
.flatMap((bundle) => bundle.toolPolicies);
|
|
27
|
+
}
|
|
28
|
+
function projectGovernanceDiagnostics(runs) {
|
|
29
|
+
const toolPolicies = collectGovernanceToolPolicies(runs);
|
|
30
|
+
const highRiskTools = toolPolicies.filter((tool) => tool.risk === "high").length;
|
|
31
|
+
const approvalRequiredTools = toolPolicies.filter((tool) => tool.requiresApproval).length;
|
|
32
|
+
const untrustedMcpTools = toolPolicies.filter((tool) => tool.mcpTrustTier === "untrusted").length;
|
|
33
|
+
const crossTenantTools = toolPolicies.filter((tool) => tool.tenantScope === "cross-tenant").length;
|
|
34
|
+
const writeAccessMcpTools = toolPolicies.filter((tool) => tool.category === "mcp" && tool.mcpAccess === "read-write").length;
|
|
35
|
+
return {
|
|
36
|
+
runsWithGovernance: runs.filter((run) => (run.runtimeSnapshot?.governance?.bundles?.length ?? 0) > 0).length,
|
|
37
|
+
highRiskTools,
|
|
38
|
+
approvalRequiredTools,
|
|
39
|
+
untrustedMcpTools,
|
|
40
|
+
crossTenantTools,
|
|
41
|
+
writeAccessMcpTools,
|
|
42
|
+
summary: `highRisk=${highRiskTools} ` +
|
|
43
|
+
`approvalRequired=${approvalRequiredTools} ` +
|
|
44
|
+
`untrusted=${untrustedMcpTools} ` +
|
|
45
|
+
`crossTenant=${crossTenantTools}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function projectOperatorOverview(input) {
|
|
49
|
+
const limit = typeof input.limit === "number" && Number.isFinite(input.limit) && input.limit > 0 ? Math.floor(input.limit) : 5;
|
|
50
|
+
const activeRuns = sortNewestFirst(input.runs.filter((run) => ACTIVE_RUN_STATES.has(run.state)), (run) => run.lastActivityAt ?? run.updatedAt);
|
|
51
|
+
const pendingApprovals = sortNewestFirst(input.approvals.filter((approval) => approval.status === "pending"), (approval) => approval.requestedAt);
|
|
52
|
+
const queue = projectQueueDiagnostics(input.health, []);
|
|
53
|
+
const governance = projectGovernanceDiagnostics(activeRuns);
|
|
54
|
+
return {
|
|
55
|
+
updatedAt: input.health.updatedAt,
|
|
56
|
+
summary: `${queue.summary} ` +
|
|
57
|
+
`pendingApprovals=${pendingApprovals.length} ` +
|
|
58
|
+
`activeRuns=${activeRuns.length} ` +
|
|
59
|
+
`${governance.summary}`,
|
|
60
|
+
health: input.health,
|
|
61
|
+
queue,
|
|
62
|
+
approvals: {
|
|
63
|
+
total: pendingApprovals.length,
|
|
64
|
+
items: pendingApprovals.slice(0, limit),
|
|
65
|
+
},
|
|
66
|
+
runs: {
|
|
67
|
+
total: activeRuns.length,
|
|
68
|
+
states: summarizeStates(activeRuns),
|
|
69
|
+
items: activeRuns.slice(0, limit),
|
|
70
|
+
},
|
|
71
|
+
governance,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalRecord, ArtifactListing, CancelOptions, HarnessEvent, HarnessStreamItem, RuntimeHealthSnapshot, ListMemoriesInput, ListMemoriesResult, MessageContent, RemoveMemoryInput, RunRecord, RunStartOptions, RestartConversationOptions, RuntimeAdapterOptions, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult, RuntimeRunPackage, RuntimeRunPackageInput, RuntimeSessionPackage, RuntimeSessionPackageInput, ResumeOptions, RunOptions, RunResult, RunSummary, MemoryRecord, MemorizeInput, MemorizeResult, RecallInput, RecallResult, UpdateMemoryInput, SessionSummary, ThreadSummary, ThreadRecord, SessionRecord, RequestRecord, RequestSummary, WorkspaceBundle } from "../contracts/types.js";
|
|
1
|
+
import type { ApprovalRecord, ArtifactListing, CancelOptions, HarnessEvent, HarnessStreamItem, RuntimeHealthSnapshot, RuntimeOperatorOverview, ListMemoriesInput, ListMemoriesResult, MessageContent, RemoveMemoryInput, RunRecord, RunStartOptions, RestartConversationOptions, RuntimeAdapterOptions, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult, RuntimeRunPackage, RuntimeRunPackageInput, RuntimeSessionPackage, RuntimeSessionPackageInput, ResumeOptions, RunOptions, RunResult, RunSummary, MemoryRecord, MemorizeInput, MemorizeResult, RecallInput, RecallResult, UpdateMemoryInput, SessionSummary, ThreadSummary, ThreadRecord, SessionRecord, RequestRecord, RequestSummary, WorkspaceBundle } from "../contracts/types.js";
|
|
2
2
|
import { type RuntimeMcpServerOptions, type ToolMcpServerOptions } from "../mcp.js";
|
|
3
3
|
import { type InventoryAgentRecord, type InventorySkillRecord } from "./harness/system/inventory.js";
|
|
4
4
|
import type { RequirementAssessmentOptions } from "./harness/system/skill-requirements.js";
|
|
@@ -60,6 +60,9 @@ export declare class AgentHarnessRuntime {
|
|
|
60
60
|
initialize(): Promise<void>;
|
|
61
61
|
subscribe(listener: (event: HarnessEvent) => void): () => void;
|
|
62
62
|
getHealth(): Promise<RuntimeHealthSnapshot>;
|
|
63
|
+
getOperatorOverview(options?: {
|
|
64
|
+
limit?: number;
|
|
65
|
+
}): Promise<RuntimeOperatorOverview>;
|
|
63
66
|
listSessions(filter?: {
|
|
64
67
|
agentId?: string;
|
|
65
68
|
}): Promise<SessionSummary[]>;
|
package/dist/runtime/harness.js
CHANGED
|
@@ -18,6 +18,7 @@ import { appendAssistantMessage as appendLifecycleAssistantMessage, finalizeCanc
|
|
|
18
18
|
import { createListenerDispatchRuntime } from "./harness/events/listener-runtime.js";
|
|
19
19
|
import { buildResumePayload as buildHarnessResumePayload, resolveApprovalRecord as resolveHarnessApprovalRecord, } from "./harness/run/resume.js";
|
|
20
20
|
import { cancelRunOperation, executeQueuedRunOperation, resumeRun } from "./harness/run/run-operations.js";
|
|
21
|
+
import { projectOperatorOverview } from "./harness/run/operator-overview.js";
|
|
21
22
|
import { acquireRunSlot as acquireHarnessRunSlot } from "./harness/run/run-slot-acquisition.js";
|
|
22
23
|
import { dropPendingRunSlot, enqueuePendingRunSlot } from "./harness/run/run-queue.js";
|
|
23
24
|
import { getDefaultRuntimeEntryAgentId, resolveSelectedAgentId, routeAgentId } from "./harness/run/routing.js";
|
|
@@ -286,6 +287,19 @@ export class AgentHarnessRuntime {
|
|
|
286
287
|
}
|
|
287
288
|
return createDefaultHealthSnapshot(this.activeRunSlots, this.pendingRunSlots.length);
|
|
288
289
|
}
|
|
290
|
+
async getOperatorOverview(options) {
|
|
291
|
+
const [health, runs, approvals] = await Promise.all([
|
|
292
|
+
this.getHealth(),
|
|
293
|
+
this.listRuns(),
|
|
294
|
+
this.listApprovals(),
|
|
295
|
+
]);
|
|
296
|
+
return projectOperatorOverview({
|
|
297
|
+
health,
|
|
298
|
+
runs,
|
|
299
|
+
approvals,
|
|
300
|
+
limit: options?.limit,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
289
303
|
async listSessions(filter) {
|
|
290
304
|
const sessions = await this.persistence.listSessions(filter);
|
|
291
305
|
return sessions.map((session) => ({
|