@botbotgo/agent-harness 0.0.125 → 0.0.127
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 +12 -12
- package/README.zh.md +11 -11
- package/dist/api.d.ts +50 -11
- package/dist/api.js +134 -15
- package/dist/contracts/runtime.d.ts +14 -1
- package/dist/index.d.ts +1 -1
- 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/system/inventory.d.ts +8 -0
- package/dist/runtime/harness/system/inventory.js +23 -1
- package/dist/runtime/harness.d.ts +1 -0
- package/dist/runtime/harness.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -281,9 +281,9 @@ const result = await run(runtime, {
|
|
|
281
281
|
});
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
`run(runtime, { ... })` creates or continues a persisted
|
|
284
|
+
`run(runtime, { ... })` creates or continues a persisted session and returns `sessionId`, `requestId`, `state`, and compact text `output`. Richer upstream result shapes stay available through `outputContent`, `contentBlocks`, and `structuredResponse`.
|
|
285
285
|
|
|
286
|
-
Use `
|
|
286
|
+
Use `listRequests(runtime)` and `getRequest(runtime, requestId)` when a product needs a request-centric operations surface such as a review queue or execution dashboard.
|
|
287
287
|
|
|
288
288
|
Use `invocation` as the runtime-facing request envelope:
|
|
289
289
|
|
|
@@ -334,19 +334,19 @@ The runtime event stream includes:
|
|
|
334
334
|
- `approval.resolved`
|
|
335
335
|
- `output.delta`
|
|
336
336
|
|
|
337
|
-
### Inspect
|
|
337
|
+
### Inspect Sessions And Approvals
|
|
338
338
|
|
|
339
339
|
```ts
|
|
340
340
|
import {
|
|
341
|
+
getSession,
|
|
341
342
|
getApproval,
|
|
342
|
-
|
|
343
|
+
listSessions,
|
|
343
344
|
listApprovals,
|
|
344
|
-
listThreads,
|
|
345
345
|
resolveApproval,
|
|
346
346
|
} from "@botbotgo/agent-harness";
|
|
347
347
|
|
|
348
|
-
const
|
|
349
|
-
const
|
|
348
|
+
const sessions = await listSessions(runtime);
|
|
349
|
+
const session = await getSession(runtime, sessions[0]!.sessionId);
|
|
350
350
|
const approvals = await listApprovals(runtime, { status: "pending" });
|
|
351
351
|
const approval = approvals[0] ? await getApproval(runtime, approvals[0].approvalId) : null;
|
|
352
352
|
|
|
@@ -690,11 +690,11 @@ Primary exports:
|
|
|
690
690
|
- `run`
|
|
691
691
|
- `resolveApproval`
|
|
692
692
|
- `subscribe`
|
|
693
|
-
- `
|
|
694
|
-
- `
|
|
695
|
-
- `
|
|
696
|
-
- `
|
|
697
|
-
- `
|
|
693
|
+
- `listRequests`
|
|
694
|
+
- `getRequest`
|
|
695
|
+
- `listSessions`
|
|
696
|
+
- `getSession`
|
|
697
|
+
- `deleteSession`
|
|
698
698
|
- `listApprovals`
|
|
699
699
|
- `getApproval`
|
|
700
700
|
- `createToolMcpServer`
|
package/README.zh.md
CHANGED
|
@@ -281,9 +281,9 @@ const result = await run(runtime, {
|
|
|
281
281
|
});
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
`run(runtime, { ... })`
|
|
284
|
+
`run(runtime, { ... })` 会创建或延续持久化会话,并返回 `sessionId`、`requestId`、`state` 以及紧凑文本 `output`。更丰富的上游结果形态仍可通过 `outputContent`、`contentBlocks`、`structuredResponse` 等获得。
|
|
285
285
|
|
|
286
|
-
如果产品需要
|
|
286
|
+
如果产品需要 request 视角的操作界面,例如 review queue 或执行看板,可使用 `listRequests(runtime)` 与 `getRequest(runtime, requestId)`。
|
|
287
287
|
|
|
288
288
|
将 `invocation` 作为面向运行时的请求信封:
|
|
289
289
|
|
|
@@ -339,14 +339,14 @@ const result = await run(runtime, {
|
|
|
339
339
|
```ts
|
|
340
340
|
import {
|
|
341
341
|
getApproval,
|
|
342
|
-
|
|
342
|
+
getSession,
|
|
343
343
|
listApprovals,
|
|
344
|
-
|
|
344
|
+
listSessions,
|
|
345
345
|
resolveApproval,
|
|
346
346
|
} from "@botbotgo/agent-harness";
|
|
347
347
|
|
|
348
|
-
const
|
|
349
|
-
const
|
|
348
|
+
const sessions = await listSessions(runtime);
|
|
349
|
+
const session = await getSession(runtime, sessions[0]!.sessionId);
|
|
350
350
|
const approvals = await listApprovals(runtime, { status: "pending" });
|
|
351
351
|
const approval = approvals[0] ? await getApproval(runtime, approvals[0].approvalId) : null;
|
|
352
352
|
|
|
@@ -687,11 +687,11 @@ spec:
|
|
|
687
687
|
- `run`
|
|
688
688
|
- `resolveApproval`
|
|
689
689
|
- `subscribe`
|
|
690
|
-
- `
|
|
691
|
-
- `
|
|
692
|
-
- `
|
|
693
|
-
- `
|
|
694
|
-
- `
|
|
690
|
+
- `listRequests`
|
|
691
|
+
- `getRequest`
|
|
692
|
+
- `listSessions`
|
|
693
|
+
- `getSession`
|
|
694
|
+
- `deleteSession`
|
|
695
695
|
- `listApprovals`
|
|
696
696
|
- `getApproval`
|
|
697
697
|
- `createToolMcpServer`
|
package/dist/api.d.ts
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CancelOptions, RequestRecord, RequestSummary, ResumeOptions, RunDecisionOptions, RunResult, RunStartOptions, RuntimeHealthSnapshot, RuntimeAdapterOptions, SessionRecord, SessionSummary, 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";
|
|
5
5
|
import type { ToolMcpServerOptions } from "./mcp.js";
|
|
6
6
|
export { AgentHarnessRuntime } from "./runtime/harness.js";
|
|
7
7
|
export { createUpstreamTimelineReducer } from "./upstream-events.js";
|
|
8
|
+
type PublicApprovalRecord = {
|
|
9
|
+
approvalId: string;
|
|
10
|
+
pendingActionId: string;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
requestId: string;
|
|
13
|
+
toolName: string;
|
|
14
|
+
status: "pending" | "approved" | "edited" | "rejected" | "expired";
|
|
15
|
+
requestedAt: string;
|
|
16
|
+
resolvedAt: string | null;
|
|
17
|
+
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
18
|
+
inputPreview: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
type PublicApprovalFilter = {
|
|
21
|
+
status?: PublicApprovalRecord["status"];
|
|
22
|
+
sessionId?: string;
|
|
23
|
+
requestId?: string;
|
|
24
|
+
};
|
|
25
|
+
type PublicRunStartOptions = Omit<RunStartOptions, "threadId"> & {
|
|
26
|
+
sessionId?: string;
|
|
27
|
+
};
|
|
28
|
+
type PublicRunDecisionOptions = Omit<RunDecisionOptions, "threadId" | "runId"> & {
|
|
29
|
+
sessionId: string;
|
|
30
|
+
requestId?: string;
|
|
31
|
+
};
|
|
32
|
+
type PublicRunOptions = PublicRunStartOptions | PublicRunDecisionOptions;
|
|
33
|
+
type PublicRunResult = Omit<RunResult, "threadId" | "runId"> & {
|
|
34
|
+
sessionId: string;
|
|
35
|
+
requestId: string;
|
|
36
|
+
};
|
|
8
37
|
type CreateAgentHarnessOptions = {
|
|
9
38
|
/**
|
|
10
39
|
* Workspace loading behavior.
|
|
@@ -15,23 +44,33 @@ type CreateAgentHarnessOptions = {
|
|
|
15
44
|
};
|
|
16
45
|
export declare function createAgentHarness(): Promise<AgentHarnessRuntime>;
|
|
17
46
|
export declare function createAgentHarness(workspaceRoot: string, options?: CreateAgentHarnessOptions): Promise<AgentHarnessRuntime>;
|
|
18
|
-
export declare function run(runtime: AgentHarnessRuntime, options:
|
|
47
|
+
export declare function run(runtime: AgentHarnessRuntime, options: PublicRunOptions): Promise<PublicRunResult>;
|
|
19
48
|
export declare function subscribe(runtime: AgentHarnessRuntime, listener: Parameters<AgentHarnessRuntime["subscribe"]>[0]): () => void;
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare function
|
|
49
|
+
export declare function listSessions(runtime: AgentHarnessRuntime, filter?: Parameters<AgentHarnessRuntime["listThreads"]>[0]): Promise<SessionSummary[]>;
|
|
50
|
+
export declare function listRequests(runtime: AgentHarnessRuntime, filter?: {
|
|
51
|
+
agentId?: string;
|
|
52
|
+
sessionId?: string;
|
|
53
|
+
state?: RequestSummary["state"];
|
|
54
|
+
}): Promise<RequestSummary[]>;
|
|
55
|
+
export declare function getSession(runtime: AgentHarnessRuntime, sessionId: string): Promise<SessionRecord | null>;
|
|
56
|
+
export declare function getRequest(runtime: AgentHarnessRuntime, requestId: string): Promise<RequestRecord | null>;
|
|
57
|
+
export declare function deleteSession(runtime: AgentHarnessRuntime, sessionId: string): Promise<boolean>;
|
|
58
|
+
export declare function listApprovals(runtime: AgentHarnessRuntime, filter?: PublicApprovalFilter): Promise<PublicApprovalRecord[]>;
|
|
59
|
+
export declare function getApproval(runtime: AgentHarnessRuntime, approvalId: string): Promise<PublicApprovalRecord | null>;
|
|
27
60
|
export declare function getHealth(runtime: AgentHarnessRuntime): Promise<RuntimeHealthSnapshot>;
|
|
28
61
|
export declare function listAgentSkills(runtime: AgentHarnessRuntime, agentId: string, options?: RequirementAssessmentOptions): InventorySkillRecord[];
|
|
62
|
+
export declare function getAgent(runtime: AgentHarnessRuntime, agentId: string, options?: RequirementAssessmentOptions): InventoryAgentRecord | null;
|
|
29
63
|
export declare function describeInventory(runtime: AgentHarnessRuntime, options?: RequirementAssessmentOptions): {
|
|
30
64
|
workspaceRoot: string;
|
|
31
65
|
agents: InventoryAgentRecord[];
|
|
32
66
|
};
|
|
33
|
-
export declare function resolveApproval(runtime: AgentHarnessRuntime, options: ResumeOptions
|
|
34
|
-
|
|
67
|
+
export declare function resolveApproval(runtime: AgentHarnessRuntime, options: ResumeOptions & {
|
|
68
|
+
sessionId?: string;
|
|
69
|
+
requestId?: string;
|
|
70
|
+
}): Promise<PublicRunResult>;
|
|
71
|
+
export declare function cancelRun(runtime: AgentHarnessRuntime, options: CancelOptions & {
|
|
72
|
+
requestId?: string;
|
|
73
|
+
}): Promise<RunResult>;
|
|
35
74
|
export declare function stop(runtime: AgentHarnessRuntime): Promise<void>;
|
|
36
75
|
export declare function createToolMcpServer(runtime: AgentHarnessRuntime, options: ToolMcpServerOptions): Promise<import("@modelcontextprotocol/sdk/server/mcp.js").McpServer>;
|
|
37
76
|
export declare function serveToolsOverStdio(runtime: AgentHarnessRuntime, options: ToolMcpServerOptions): Promise<import("@modelcontextprotocol/sdk/server/mcp.js").McpServer>;
|
package/dist/api.js
CHANGED
|
@@ -2,6 +2,108 @@ import { AgentHarnessRuntime } from "./runtime/harness.js";
|
|
|
2
2
|
import { loadWorkspace } from "./workspace/compile.js";
|
|
3
3
|
export { AgentHarnessRuntime } from "./runtime/harness.js";
|
|
4
4
|
export { createUpstreamTimelineReducer } from "./upstream-events.js";
|
|
5
|
+
function toSessionSummary(summary) {
|
|
6
|
+
return {
|
|
7
|
+
agentId: summary.agentId,
|
|
8
|
+
sessionId: summary.threadId,
|
|
9
|
+
latestRequestId: summary.latestRunId,
|
|
10
|
+
createdAt: summary.createdAt,
|
|
11
|
+
updatedAt: summary.updatedAt,
|
|
12
|
+
status: summary.status,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function toRequestSummary(summary) {
|
|
16
|
+
return {
|
|
17
|
+
requestId: summary.runId,
|
|
18
|
+
sessionId: summary.threadId,
|
|
19
|
+
agentId: summary.agentId,
|
|
20
|
+
executionMode: summary.executionMode,
|
|
21
|
+
adapterKind: summary.adapterKind,
|
|
22
|
+
createdAt: summary.createdAt,
|
|
23
|
+
updatedAt: summary.updatedAt,
|
|
24
|
+
state: summary.state,
|
|
25
|
+
checkpointRef: summary.checkpointRef,
|
|
26
|
+
resumable: summary.resumable,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function toSessionRecord(record) {
|
|
30
|
+
return {
|
|
31
|
+
sessionId: record.threadId,
|
|
32
|
+
entryAgentId: record.entryAgentId,
|
|
33
|
+
currentState: record.currentState,
|
|
34
|
+
latestRequestId: record.latestRunId,
|
|
35
|
+
createdAt: record.createdAt,
|
|
36
|
+
updatedAt: record.updatedAt,
|
|
37
|
+
messages: record.messages,
|
|
38
|
+
requests: record.runs.map(toRequestSummary),
|
|
39
|
+
pendingDecision: record.pendingDecision,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function toRequestRecord(record) {
|
|
43
|
+
return toRequestSummary(record);
|
|
44
|
+
}
|
|
45
|
+
function toApprovalRecord(record) {
|
|
46
|
+
return {
|
|
47
|
+
approvalId: record.approvalId,
|
|
48
|
+
pendingActionId: record.pendingActionId,
|
|
49
|
+
sessionId: record.threadId,
|
|
50
|
+
requestId: record.runId,
|
|
51
|
+
toolName: record.toolName,
|
|
52
|
+
status: record.status,
|
|
53
|
+
requestedAt: record.requestedAt,
|
|
54
|
+
resolvedAt: record.resolvedAt,
|
|
55
|
+
allowedDecisions: record.allowedDecisions,
|
|
56
|
+
inputPreview: record.inputPreview,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function toPublicRunResult(result) {
|
|
60
|
+
return {
|
|
61
|
+
sessionId: result.threadId,
|
|
62
|
+
requestId: result.runId,
|
|
63
|
+
state: result.state,
|
|
64
|
+
output: result.output,
|
|
65
|
+
finalMessageText: result.finalMessageText,
|
|
66
|
+
outputContent: result.outputContent,
|
|
67
|
+
contentBlocks: result.contentBlocks,
|
|
68
|
+
structuredResponse: result.structuredResponse,
|
|
69
|
+
interruptContent: result.interruptContent,
|
|
70
|
+
agentId: result.agentId,
|
|
71
|
+
approvalId: result.approvalId,
|
|
72
|
+
pendingActionId: result.pendingActionId,
|
|
73
|
+
delegationId: result.delegationId,
|
|
74
|
+
artifacts: result.artifacts,
|
|
75
|
+
metadata: result.metadata,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function toInternalRunOptions(options) {
|
|
79
|
+
if ("decision" in options) {
|
|
80
|
+
return {
|
|
81
|
+
approvalId: options.approvalId,
|
|
82
|
+
decision: options.decision,
|
|
83
|
+
editedInput: options.editedInput,
|
|
84
|
+
listeners: options.listeners,
|
|
85
|
+
runId: options.requestId,
|
|
86
|
+
threadId: options.sessionId,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
agentId: options.agentId,
|
|
91
|
+
input: options.input,
|
|
92
|
+
invocation: options.invocation,
|
|
93
|
+
listeners: options.listeners,
|
|
94
|
+
priority: options.priority,
|
|
95
|
+
threadId: options.sessionId,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function toInternalResumeOptions(options) {
|
|
99
|
+
return {
|
|
100
|
+
approvalId: options.approvalId,
|
|
101
|
+
decision: options.decision,
|
|
102
|
+
editedInput: options.editedInput,
|
|
103
|
+
runId: options.requestId ?? options.runId,
|
|
104
|
+
threadId: options.sessionId ?? options.threadId,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
5
107
|
export async function createAgentHarness(workspaceRoot = process.cwd(), options = {}) {
|
|
6
108
|
const workspace = await loadWorkspace(workspaceRoot, options.load ?? {});
|
|
7
109
|
const harness = new AgentHarnessRuntime(workspace, options.adapter ?? {});
|
|
@@ -9,31 +111,42 @@ export async function createAgentHarness(workspaceRoot = process.cwd(), options
|
|
|
9
111
|
return harness;
|
|
10
112
|
}
|
|
11
113
|
export async function run(runtime, options) {
|
|
12
|
-
return runtime.run(options);
|
|
114
|
+
return toPublicRunResult(await runtime.run(toInternalRunOptions(options)));
|
|
13
115
|
}
|
|
14
116
|
export function subscribe(runtime, listener) {
|
|
15
117
|
return runtime.subscribe(listener);
|
|
16
118
|
}
|
|
17
|
-
export async function
|
|
18
|
-
return runtime.listThreads(filter);
|
|
119
|
+
export async function listSessions(runtime, filter) {
|
|
120
|
+
return (await runtime.listThreads(filter)).map(toSessionSummary);
|
|
19
121
|
}
|
|
20
|
-
export async function
|
|
21
|
-
return runtime.listRuns(
|
|
122
|
+
export async function listRequests(runtime, filter) {
|
|
123
|
+
return (await runtime.listRuns({
|
|
124
|
+
agentId: filter?.agentId,
|
|
125
|
+
state: filter?.state,
|
|
126
|
+
threadId: filter?.sessionId,
|
|
127
|
+
})).map(toRequestSummary);
|
|
22
128
|
}
|
|
23
|
-
export async function
|
|
24
|
-
|
|
129
|
+
export async function getSession(runtime, sessionId) {
|
|
130
|
+
const record = await runtime.getThread(sessionId);
|
|
131
|
+
return record ? toSessionRecord(record) : null;
|
|
25
132
|
}
|
|
26
|
-
export async function
|
|
27
|
-
|
|
133
|
+
export async function getRequest(runtime, requestId) {
|
|
134
|
+
const record = await runtime.getRun(requestId);
|
|
135
|
+
return record ? toRequestRecord(record) : null;
|
|
28
136
|
}
|
|
29
|
-
export async function
|
|
30
|
-
return runtime.deleteThread(
|
|
137
|
+
export async function deleteSession(runtime, sessionId) {
|
|
138
|
+
return runtime.deleteThread(sessionId);
|
|
31
139
|
}
|
|
32
140
|
export async function listApprovals(runtime, filter) {
|
|
33
|
-
return runtime.listApprovals(
|
|
141
|
+
return (await runtime.listApprovals({
|
|
142
|
+
runId: filter?.requestId,
|
|
143
|
+
status: filter?.status,
|
|
144
|
+
threadId: filter?.sessionId,
|
|
145
|
+
})).map(toApprovalRecord);
|
|
34
146
|
}
|
|
35
147
|
export async function getApproval(runtime, approvalId) {
|
|
36
|
-
|
|
148
|
+
const record = await runtime.getApproval(approvalId);
|
|
149
|
+
return record ? toApprovalRecord(record) : null;
|
|
37
150
|
}
|
|
38
151
|
export async function getHealth(runtime) {
|
|
39
152
|
return runtime.getHealth();
|
|
@@ -41,14 +154,20 @@ export async function getHealth(runtime) {
|
|
|
41
154
|
export function listAgentSkills(runtime, agentId, options) {
|
|
42
155
|
return runtime.listAgentSkills(agentId, options);
|
|
43
156
|
}
|
|
157
|
+
export function getAgent(runtime, agentId, options) {
|
|
158
|
+
return runtime.getAgent(agentId, options);
|
|
159
|
+
}
|
|
44
160
|
export function describeInventory(runtime, options) {
|
|
45
161
|
return runtime.describeWorkspaceInventory(options);
|
|
46
162
|
}
|
|
47
163
|
export async function resolveApproval(runtime, options) {
|
|
48
|
-
return runtime.resume(options);
|
|
164
|
+
return toPublicRunResult(await runtime.resume(toInternalResumeOptions(options)));
|
|
49
165
|
}
|
|
50
166
|
export async function cancelRun(runtime, options) {
|
|
51
|
-
return runtime.cancelRun(
|
|
167
|
+
return runtime.cancelRun({
|
|
168
|
+
...options,
|
|
169
|
+
runId: options.requestId ?? options.runId,
|
|
170
|
+
});
|
|
52
171
|
}
|
|
53
172
|
export async function stop(runtime) {
|
|
54
173
|
return runtime.stop();
|
|
@@ -13,7 +13,10 @@ export type ThreadSummary = {
|
|
|
13
13
|
updatedAt: string;
|
|
14
14
|
status: RunState;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
16
|
+
export type SessionSummary = Omit<ThreadSummary, "threadId" | "latestRunId"> & {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
latestRequestId: string;
|
|
19
|
+
};
|
|
17
20
|
export type KnownHarnessEventType = "run.created" | "run.queued" | "run.dequeued" | "run.state.changed" | "run.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "runtime.health.changed" | "runtime.synthetic_fallback";
|
|
18
21
|
export type HarnessEventType = KnownHarnessEventType | (string & {});
|
|
19
22
|
/**
|
|
@@ -172,6 +175,11 @@ export type ThreadRunRecord = {
|
|
|
172
175
|
*/
|
|
173
176
|
export type RunSummary = ThreadRunRecord;
|
|
174
177
|
export type RunRecord = RunSummary;
|
|
178
|
+
export type RequestSummary = Omit<RunSummary, "threadId" | "runId"> & {
|
|
179
|
+
sessionId: string;
|
|
180
|
+
requestId: string;
|
|
181
|
+
};
|
|
182
|
+
export type RequestRecord = RequestSummary;
|
|
175
183
|
/**
|
|
176
184
|
* Persisted thread inspection record assembled from runtime records.
|
|
177
185
|
* This is an inspectable projection, not a second thread semantic model.
|
|
@@ -193,6 +201,11 @@ export type ThreadRecord = {
|
|
|
193
201
|
requestedAt: string;
|
|
194
202
|
};
|
|
195
203
|
};
|
|
204
|
+
export type SessionRecord = Omit<ThreadRecord, "threadId" | "latestRunId" | "runs"> & {
|
|
205
|
+
sessionId: string;
|
|
206
|
+
latestRequestId: string;
|
|
207
|
+
requests: RequestSummary[];
|
|
208
|
+
};
|
|
196
209
|
export type ResumeOptions = {
|
|
197
210
|
threadId?: string;
|
|
198
211
|
runId?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AgentHarnessRuntime, cancelRun, createAgentHarness, createUpstreamTimelineReducer, createToolMcpServer,
|
|
1
|
+
export { AgentHarnessRuntime, cancelRun, createAgentHarness, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, getAgent, getApproval, getRequest, getHealth, getSession, listAgentSkills, listApprovals, listRequests, listSessions, resolveApproval, run, serveToolsOverStdio, subscribe, stop, } from "./api.js";
|
|
2
2
|
export type { ToolMcpServerOptions } from "./mcp.js";
|
|
3
3
|
export { tool } from "./tools.js";
|
|
4
4
|
export type { UpstreamTimelineProjection, UpstreamTimelineReducer } from "./upstream-events.js";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AgentHarnessRuntime, cancelRun, createAgentHarness, createUpstreamTimelineReducer, createToolMcpServer,
|
|
1
|
+
export { AgentHarnessRuntime, cancelRun, createAgentHarness, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, getAgent, getApproval, getRequest, getHealth, getSession, listAgentSkills, listApprovals, listRequests, listSessions, resolveApproval, run, serveToolsOverStdio, subscribe, stop, } 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.126";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.126";
|
|
@@ -17,10 +17,17 @@ export type InventorySkillRecord = {
|
|
|
17
17
|
openclaw?: OpenClawSkillMetadata;
|
|
18
18
|
requirements?: SkillRequirementAssessment;
|
|
19
19
|
};
|
|
20
|
+
export type InventoryModelRecord = {
|
|
21
|
+
id: string;
|
|
22
|
+
provider: string;
|
|
23
|
+
model: string;
|
|
24
|
+
baseUrl?: string;
|
|
25
|
+
};
|
|
20
26
|
export type InventoryAgentRecord = {
|
|
21
27
|
id: string;
|
|
22
28
|
description: string;
|
|
23
29
|
parentAgentId?: string;
|
|
30
|
+
model?: InventoryModelRecord;
|
|
24
31
|
tools: InventoryToolRecord[];
|
|
25
32
|
skills: InventorySkillRecord[];
|
|
26
33
|
};
|
|
@@ -29,6 +36,7 @@ export declare function listAgentTools(workspace: WorkspaceBundle, agentId: stri
|
|
|
29
36
|
export declare function listAgentSkills(workspace: WorkspaceBundle, agentId: string, options?: RequirementAssessmentOptions): InventorySkillRecord[];
|
|
30
37
|
export declare function listSubagents(workspace: WorkspaceBundle, options?: RequirementAssessmentOptions): InventoryAgentRecord[];
|
|
31
38
|
export declare function listAvailableAgents(workspace: WorkspaceBundle, options?: RequirementAssessmentOptions): InventoryAgentRecord[];
|
|
39
|
+
export declare function getAgentInventoryRecord(workspace: WorkspaceBundle, agentId: string, options?: RequirementAssessmentOptions): InventoryAgentRecord | null;
|
|
32
40
|
export declare function describeWorkspaceInventory(workspace: WorkspaceBundle, options?: RequirementAssessmentOptions): {
|
|
33
41
|
workspaceRoot: string;
|
|
34
42
|
agents: InventoryAgentRecord[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readSkillMetadata } from "../../support/skill-metadata.js";
|
|
2
|
-
import { getBindingBackendConfig, getBindingPrimaryTools, getBindingSkills, getBindingSubagents } from "../../support/compiled-binding.js";
|
|
2
|
+
import { getBindingBackendConfig, getBindingPrimaryModel, getBindingPrimaryTools, getBindingSkills, getBindingSubagents, } from "../../support/compiled-binding.js";
|
|
3
3
|
import { assessSkillRequirements, } from "./skill-requirements.js";
|
|
4
4
|
import { createRuntimeEnv } from "../../support/runtime-env.js";
|
|
5
5
|
function listHostBindings(workspace) {
|
|
@@ -60,6 +60,23 @@ function toSkillRecords(skillPaths, options = {}) {
|
|
|
60
60
|
};
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
+
function toInventoryModelRecord(model) {
|
|
64
|
+
if (!model) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const init = typeof model.init === "object" && model.init ? model.init : {};
|
|
68
|
+
const baseUrl = typeof init.baseUrl === "string" && init.baseUrl.trim().length > 0
|
|
69
|
+
? init.baseUrl.trim()
|
|
70
|
+
: typeof init.baseURL === "string" && init.baseURL.trim().length > 0
|
|
71
|
+
? init.baseURL.trim()
|
|
72
|
+
: undefined;
|
|
73
|
+
return {
|
|
74
|
+
id: model.id,
|
|
75
|
+
provider: model.provider,
|
|
76
|
+
model: model.model,
|
|
77
|
+
...(baseUrl ? { baseUrl } : {}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
63
80
|
export function listAgentTools(workspace, agentId) {
|
|
64
81
|
const binding = findAgentBinding(workspace, agentId);
|
|
65
82
|
if (!binding) {
|
|
@@ -80,6 +97,7 @@ function describeSubagent(subagent, parentAgentId, options = {}) {
|
|
|
80
97
|
id: subagent.name,
|
|
81
98
|
description: subagent.description,
|
|
82
99
|
parentAgentId,
|
|
100
|
+
model: toInventoryModelRecord(subagent.model),
|
|
83
101
|
tools: dedupeTools(subagent.tools ?? []),
|
|
84
102
|
skills: toSkillRecords(subagent.skills ?? [], options),
|
|
85
103
|
};
|
|
@@ -94,11 +112,15 @@ export function listAvailableAgents(workspace, options = {}) {
|
|
|
94
112
|
const topLevel = listHostBindings(workspace).map((binding) => ({
|
|
95
113
|
id: binding.agent.id,
|
|
96
114
|
description: binding.agent.description,
|
|
115
|
+
model: toInventoryModelRecord(getBindingPrimaryModel(binding)),
|
|
97
116
|
tools: listAgentTools(workspace, binding.agent.id),
|
|
98
117
|
skills: listAgentSkills(workspace, binding.agent.id, options),
|
|
99
118
|
}));
|
|
100
119
|
return [...topLevel, ...listSubagents(workspace, options)];
|
|
101
120
|
}
|
|
121
|
+
export function getAgentInventoryRecord(workspace, agentId, options = {}) {
|
|
122
|
+
return listAvailableAgents(workspace, options).find((agent) => agent.id === agentId) ?? null;
|
|
123
|
+
}
|
|
102
124
|
export function describeWorkspaceInventory(workspace, options = {}) {
|
|
103
125
|
return {
|
|
104
126
|
workspaceRoot: workspace.workspaceRoot,
|
|
@@ -66,6 +66,7 @@ export declare class AgentHarnessRuntime {
|
|
|
66
66
|
}): Promise<ApprovalRecord[]>;
|
|
67
67
|
getApproval(approvalId: string): Promise<ApprovalRecord | null>;
|
|
68
68
|
listAgentSkills(agentId: string, options?: RequirementAssessmentOptions): InventorySkillRecord[];
|
|
69
|
+
getAgent(agentId: string, options?: RequirementAssessmentOptions): InventoryAgentRecord | null;
|
|
69
70
|
describeWorkspaceInventory(options?: RequirementAssessmentOptions): {
|
|
70
71
|
workspaceRoot: string;
|
|
71
72
|
agents: InventoryAgentRecord[];
|
package/dist/runtime/harness.js
CHANGED
|
@@ -23,7 +23,7 @@ import { resolveStoreFromConfig, } from "./harness/run/resources.js";
|
|
|
23
23
|
import { createToolMcpServerFromTools, serveToolsOverStdioFromHarness } from "../mcp.js";
|
|
24
24
|
import { getBindingRuntimeExecutionMode, } from "./support/compiled-binding.js";
|
|
25
25
|
import { bindingSupportsRunningReplay, getWorkspaceBinding, resolveWorkspaceAgentTools, } from "./harness/bindings.js";
|
|
26
|
-
import { describeWorkspaceInventory, listAgentSkills as listWorkspaceAgentSkills, } from "./harness/system/inventory.js";
|
|
26
|
+
import { describeWorkspaceInventory, getAgentInventoryRecord, listAgentSkills as listWorkspaceAgentSkills, } from "./harness/system/inventory.js";
|
|
27
27
|
import { createDefaultHealthSnapshot, isInventoryEnabled, isThreadMemorySyncEnabled, } from "./harness/runtime-defaults.js";
|
|
28
28
|
import { resolveRuntimeAdapterOptions } from "./support/runtime-adapter-options.js";
|
|
29
29
|
import { initializeHarnessRuntime, reclaimExpiredClaimedRuns as reclaimHarnessExpiredClaimedRuns, recoverStartupRuns as recoverHarnessStartupRuns, isStaleRunningRun as isHarnessStaleRunningRun, } from "./harness/run/startup-runtime.js";
|
|
@@ -220,6 +220,12 @@ export class AgentHarnessRuntime {
|
|
|
220
220
|
...options,
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
+
getAgent(agentId, options = {}) {
|
|
224
|
+
return getAgentInventoryRecord(this.workspace, agentId, {
|
|
225
|
+
assessRequirements: isInventoryEnabled(this.workspace),
|
|
226
|
+
...options,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
223
229
|
describeWorkspaceInventory(options = {}) {
|
|
224
230
|
return describeWorkspaceInventory(this.workspace, {
|
|
225
231
|
assessRequirements: isInventoryEnabled(this.workspace),
|