@botbotgo/agent-harness 0.0.294 → 0.0.296
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 +27 -0
- package/README.zh.md +27 -0
- package/dist/acp.d.ts +28 -3
- package/dist/acp.js +100 -7
- package/dist/api.d.ts +2 -2
- package/dist/cli.d.ts +28 -0
- package/dist/cli.js +923 -12
- package/dist/client/acp.d.ts +44 -0
- package/dist/client/acp.js +165 -0
- package/dist/client/in-process.d.ts +44 -0
- package/dist/client/in-process.js +69 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +2 -0
- package/dist/client/types.d.ts +56 -0
- package/dist/client/types.js +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +1 -0
- package/dist/config/agents/orchestra.yaml +16 -3
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -0
- package/dist/init-project.js +89 -0
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/protocol/acp/client.d.ts +8 -2
- package/dist/protocol/acp/client.js +143 -0
- package/dist/resource/resource-impl.js +21 -4
- package/dist/resources/package.json +6 -0
- package/dist/resources/skills/approval-execution-policy/SKILL.md +22 -0
- package/dist/resources/skills/completion-discipline/SKILL.md +22 -0
- package/dist/resources/skills/delegation-discipline/SKILL.md +22 -0
- package/dist/resources/skills/safe-editing/SKILL.md +22 -0
- package/dist/resources/skills/workspace-inspection/SKILL.md +22 -0
- package/dist/runtime/adapter/runtime-adapter-support.d.ts +4 -2
- package/dist/runtime/adapter/runtime-adapter-support.js +10 -0
- package/dist/runtime/adapter/tool/builtin-middleware-tools.d.ts +74 -0
- package/dist/runtime/adapter/tool/builtin-middleware-tools.js +192 -1
- package/dist/runtime/agent-runtime-adapter.js +10 -0
- package/package.json +12 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type AcpHttpClientOptions, type AcpStdioClient, type AcpStdioClientOptions } from "../acp.js";
|
|
2
|
+
import type { Approval, OperatorOverview, RequestEvent, RequestTraceItem } from "../api.js";
|
|
3
|
+
import type { CancelOptions, RequestSummary, RuntimeHealthSnapshot, SessionListSummary, SessionRecord, SessionSummary } from "../contracts/types.js";
|
|
4
|
+
import type { HarnessClient, HarnessClientApprovalFilter, HarnessClientRequestFilter, HarnessClientRequestOptions, HarnessClientRequestResult, HarnessClientRequestStartOptions, HarnessClientStreamItem } from "./types.js";
|
|
5
|
+
export type AcpHarnessTransport = Pick<AcpStdioClient, "request" | "subscribe" | "close">;
|
|
6
|
+
export declare class AcpHarnessClient implements HarnessClient {
|
|
7
|
+
private readonly transport;
|
|
8
|
+
private streamSequence;
|
|
9
|
+
constructor(transport: AcpHarnessTransport);
|
|
10
|
+
request(options: HarnessClientRequestOptions): Promise<HarnessClientRequestResult>;
|
|
11
|
+
streamRequest(options: HarnessClientRequestStartOptions): AsyncGenerator<HarnessClientStreamItem>;
|
|
12
|
+
resolveApproval(options: Parameters<HarnessClient["resolveApproval"]>[0]): Promise<HarnessClientRequestResult>;
|
|
13
|
+
cancelRequest(options: CancelOptions): Promise<HarnessClientRequestResult>;
|
|
14
|
+
subscribe(listener: (event: RequestEvent) => void | Promise<void>): () => void;
|
|
15
|
+
listSessions(filter?: {
|
|
16
|
+
agentId?: string;
|
|
17
|
+
status?: RequestSummary["state"];
|
|
18
|
+
}): Promise<SessionSummary[]>;
|
|
19
|
+
listSessionSummaries(filter?: {
|
|
20
|
+
agentId?: string;
|
|
21
|
+
status?: RequestSummary["state"];
|
|
22
|
+
}): Promise<SessionListSummary[]>;
|
|
23
|
+
listRequests(filter?: HarnessClientRequestFilter): Promise<RequestSummary[]>;
|
|
24
|
+
getSession(sessionId: string): Promise<SessionRecord | null>;
|
|
25
|
+
getRequest(requestId: string): Promise<RequestSummary | null>;
|
|
26
|
+
listApprovals(filter?: HarnessClientApprovalFilter): Promise<Approval[]>;
|
|
27
|
+
getApproval(approvalId: string): Promise<Approval | null>;
|
|
28
|
+
listRequestEvents(input: {
|
|
29
|
+
sessionId: string;
|
|
30
|
+
requestId: string;
|
|
31
|
+
}): Promise<RequestEvent[]>;
|
|
32
|
+
listRequestTraceItems(input: {
|
|
33
|
+
sessionId: string;
|
|
34
|
+
requestId: string;
|
|
35
|
+
}): Promise<RequestTraceItem[]>;
|
|
36
|
+
getHealth(): Promise<RuntimeHealthSnapshot>;
|
|
37
|
+
getOperatorOverview(options?: {
|
|
38
|
+
limit?: number;
|
|
39
|
+
}): Promise<OperatorOverview>;
|
|
40
|
+
stop(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export declare function createAcpHarnessClient(transport: AcpHarnessTransport): HarnessClient;
|
|
43
|
+
export declare function createAcpStdioHarnessClient(options: AcpStdioClientOptions): HarnessClient;
|
|
44
|
+
export declare function createAcpHttpHarnessClient(options: AcpHttpClientOptions): HarnessClient;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createAcpHttpClient, createAcpStdioClient, } from "../acp.js";
|
|
2
|
+
function toEvent(notification) {
|
|
3
|
+
return notification.params.event;
|
|
4
|
+
}
|
|
5
|
+
function isRuntimeEventNotification(notification) {
|
|
6
|
+
return notification.method === "events.runtime";
|
|
7
|
+
}
|
|
8
|
+
function isStreamNotification(notification) {
|
|
9
|
+
return notification.method === "requests.stream";
|
|
10
|
+
}
|
|
11
|
+
export class AcpHarnessClient {
|
|
12
|
+
transport;
|
|
13
|
+
streamSequence = 0;
|
|
14
|
+
constructor(transport) {
|
|
15
|
+
this.transport = transport;
|
|
16
|
+
}
|
|
17
|
+
request(options) {
|
|
18
|
+
return this.transport.request("requests.submit", options);
|
|
19
|
+
}
|
|
20
|
+
async *streamRequest(options) {
|
|
21
|
+
const streamId = `harness-stream-${++this.streamSequence}`;
|
|
22
|
+
const queued = [];
|
|
23
|
+
let notify;
|
|
24
|
+
let settled = false;
|
|
25
|
+
let streamedResult = false;
|
|
26
|
+
let responseResolved = false;
|
|
27
|
+
let failure;
|
|
28
|
+
let fallbackTimer;
|
|
29
|
+
const waitForItem = () => new Promise((resolve) => {
|
|
30
|
+
notify = resolve;
|
|
31
|
+
});
|
|
32
|
+
const push = (item) => {
|
|
33
|
+
queued.push(item);
|
|
34
|
+
notify?.();
|
|
35
|
+
notify = undefined;
|
|
36
|
+
};
|
|
37
|
+
const settle = () => {
|
|
38
|
+
if (settled) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
settled = true;
|
|
42
|
+
notify?.();
|
|
43
|
+
notify = undefined;
|
|
44
|
+
};
|
|
45
|
+
const unsubscribe = this.transport.subscribe((notification) => {
|
|
46
|
+
if (!isStreamNotification(notification) || notification.params.streamId !== streamId) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (notification.params.item.type === "result") {
|
|
50
|
+
streamedResult = true;
|
|
51
|
+
if (fallbackTimer) {
|
|
52
|
+
clearTimeout(fallbackTimer);
|
|
53
|
+
fallbackTimer = undefined;
|
|
54
|
+
}
|
|
55
|
+
if (responseResolved) {
|
|
56
|
+
settle();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
push(notification.params.item);
|
|
60
|
+
});
|
|
61
|
+
const resultPromise = this.transport.request("requests.submit", {
|
|
62
|
+
...options,
|
|
63
|
+
streamId,
|
|
64
|
+
});
|
|
65
|
+
resultPromise
|
|
66
|
+
.then((result) => {
|
|
67
|
+
responseResolved = true;
|
|
68
|
+
if (streamedResult) {
|
|
69
|
+
settle();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
fallbackTimer = setTimeout(() => {
|
|
73
|
+
push({
|
|
74
|
+
type: "result",
|
|
75
|
+
result,
|
|
76
|
+
});
|
|
77
|
+
settle();
|
|
78
|
+
}, 50);
|
|
79
|
+
})
|
|
80
|
+
.catch((error) => {
|
|
81
|
+
failure = error;
|
|
82
|
+
settle();
|
|
83
|
+
})
|
|
84
|
+
.finally(() => undefined);
|
|
85
|
+
try {
|
|
86
|
+
while (!settled || queued.length > 0) {
|
|
87
|
+
if (queued.length === 0) {
|
|
88
|
+
await waitForItem();
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const item = queued.shift();
|
|
92
|
+
if (item) {
|
|
93
|
+
yield item;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (failure) {
|
|
97
|
+
throw failure;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
if (fallbackTimer) {
|
|
102
|
+
clearTimeout(fallbackTimer);
|
|
103
|
+
}
|
|
104
|
+
unsubscribe();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
resolveApproval(options) {
|
|
108
|
+
return this.transport.request("approvals.resolve", options);
|
|
109
|
+
}
|
|
110
|
+
cancelRequest(options) {
|
|
111
|
+
return this.transport.request("requests.cancel", options);
|
|
112
|
+
}
|
|
113
|
+
subscribe(listener) {
|
|
114
|
+
return this.transport.subscribe((notification) => {
|
|
115
|
+
if (isRuntimeEventNotification(notification)) {
|
|
116
|
+
void listener(toEvent(notification));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
listSessions(filter) {
|
|
121
|
+
return this.transport.request("sessions.list", filter);
|
|
122
|
+
}
|
|
123
|
+
listSessionSummaries(filter) {
|
|
124
|
+
return this.transport.request("sessions.summaries", filter);
|
|
125
|
+
}
|
|
126
|
+
listRequests(filter) {
|
|
127
|
+
return this.transport.request("requests.list", filter);
|
|
128
|
+
}
|
|
129
|
+
getSession(sessionId) {
|
|
130
|
+
return this.transport.request("sessions.get", { sessionId });
|
|
131
|
+
}
|
|
132
|
+
getRequest(requestId) {
|
|
133
|
+
return this.transport.request("requests.get", { requestId });
|
|
134
|
+
}
|
|
135
|
+
listApprovals(filter) {
|
|
136
|
+
return this.transport.request("approvals.list", filter);
|
|
137
|
+
}
|
|
138
|
+
getApproval(approvalId) {
|
|
139
|
+
return this.transport.request("approvals.get", { approvalId });
|
|
140
|
+
}
|
|
141
|
+
listRequestEvents(input) {
|
|
142
|
+
return this.transport.request("events.list", input);
|
|
143
|
+
}
|
|
144
|
+
listRequestTraceItems(input) {
|
|
145
|
+
return this.transport.request("requests.trace.list", input);
|
|
146
|
+
}
|
|
147
|
+
getHealth() {
|
|
148
|
+
return this.transport.request("runtime.health");
|
|
149
|
+
}
|
|
150
|
+
getOperatorOverview(options) {
|
|
151
|
+
return this.transport.request("runtime.overview", options);
|
|
152
|
+
}
|
|
153
|
+
stop() {
|
|
154
|
+
return this.transport.close();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export function createAcpHarnessClient(transport) {
|
|
158
|
+
return new AcpHarnessClient(transport);
|
|
159
|
+
}
|
|
160
|
+
export function createAcpStdioHarnessClient(options) {
|
|
161
|
+
return new AcpHarnessClient(createAcpStdioClient(options));
|
|
162
|
+
}
|
|
163
|
+
export function createAcpHttpHarnessClient(options) {
|
|
164
|
+
return new AcpHarnessClient(createAcpHttpClient(options));
|
|
165
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cancelRequest, listSessionSummaries, listSessions, resolveApproval, subscribe, type CreateAgentHarnessOptions } from "../api.js";
|
|
2
|
+
import type { AgentHarnessRuntime } from "../runtime/harness.js";
|
|
3
|
+
import type { HarnessClient, HarnessClientApprovalFilter, HarnessClientRequestFilter, HarnessClientRequestOptions, HarnessClientRequestResult, HarnessClientRequestStartOptions, HarnessClientStreamItem } from "./types.js";
|
|
4
|
+
export declare class InProcessHarnessClient implements HarnessClient {
|
|
5
|
+
readonly runtime: AgentHarnessRuntime;
|
|
6
|
+
constructor(runtime: AgentHarnessRuntime);
|
|
7
|
+
request(options: HarnessClientRequestOptions): Promise<HarnessClientRequestResult>;
|
|
8
|
+
streamRequest(options: HarnessClientRequestStartOptions): AsyncGenerator<HarnessClientStreamItem>;
|
|
9
|
+
resolveApproval(options: Parameters<typeof resolveApproval>[1]): Promise<HarnessClientRequestResult>;
|
|
10
|
+
cancelRequest(options: Parameters<typeof cancelRequest>[1]): Promise<HarnessClientRequestResult>;
|
|
11
|
+
subscribe(listener: Parameters<typeof subscribe>[1]): () => void;
|
|
12
|
+
listSessions(filter?: {
|
|
13
|
+
agentId?: string;
|
|
14
|
+
status?: Parameters<typeof listSessions>[1] extends infer T ? T extends {
|
|
15
|
+
status?: infer S;
|
|
16
|
+
} ? S : never : never;
|
|
17
|
+
}): Promise<import("../contracts/runtime.js").SessionSummary[]>;
|
|
18
|
+
listSessionSummaries(filter?: {
|
|
19
|
+
agentId?: string;
|
|
20
|
+
status?: Parameters<typeof listSessionSummaries>[1] extends infer T ? T extends {
|
|
21
|
+
status?: infer S;
|
|
22
|
+
} ? S : never : never;
|
|
23
|
+
}): Promise<import("../api.js").SessionListSummary[]>;
|
|
24
|
+
listRequests(filter?: HarnessClientRequestFilter): Promise<import("../contracts/runtime.js").SessionRequestRecord[]>;
|
|
25
|
+
getSession(sessionId: string): Promise<import("../contracts/runtime.js").SessionRecord | null>;
|
|
26
|
+
getRequest(requestId: string): Promise<import("../contracts/runtime.js").RequestRecord | null>;
|
|
27
|
+
listApprovals(filter?: HarnessClientApprovalFilter): Promise<import("../api.js").Approval[]>;
|
|
28
|
+
getApproval(approvalId: string): Promise<import("../api.js").Approval | null>;
|
|
29
|
+
listRequestEvents(input: {
|
|
30
|
+
sessionId: string;
|
|
31
|
+
requestId: string;
|
|
32
|
+
}): Promise<import("../api.js").RequestEvent[]>;
|
|
33
|
+
listRequestTraceItems(input: {
|
|
34
|
+
sessionId: string;
|
|
35
|
+
requestId: string;
|
|
36
|
+
}): Promise<import("../api.js").RequestTraceItem[]>;
|
|
37
|
+
getHealth(): Promise<import("../contracts/runtime.js").RuntimeHealthSnapshot>;
|
|
38
|
+
getOperatorOverview(options?: {
|
|
39
|
+
limit?: number;
|
|
40
|
+
}): Promise<import("../api.js").OperatorOverview>;
|
|
41
|
+
stop(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
export declare function createInProcessHarnessClient(runtime: AgentHarnessRuntime): HarnessClient;
|
|
44
|
+
export declare function createAgentHarnessClient(workspaceRoot?: string, options?: CreateAgentHarnessOptions): Promise<HarnessClient>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { cancelRequest, createAgentHarness, getApproval, getHealth, getOperatorOverview, getRequest, getSession, listApprovals, listRequestEvents, listRequests, listRequestTraceItems, listSessionSummaries, listSessions, request, resolveApproval, subscribe, stop, } from "../api.js";
|
|
2
|
+
export class InProcessHarnessClient {
|
|
3
|
+
runtime;
|
|
4
|
+
constructor(runtime) {
|
|
5
|
+
this.runtime = runtime;
|
|
6
|
+
}
|
|
7
|
+
request(options) {
|
|
8
|
+
return request(this.runtime, options);
|
|
9
|
+
}
|
|
10
|
+
async *streamRequest(options) {
|
|
11
|
+
for await (const item of this.runtime.streamEvents(options)) {
|
|
12
|
+
yield item;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
resolveApproval(options) {
|
|
16
|
+
return resolveApproval(this.runtime, options);
|
|
17
|
+
}
|
|
18
|
+
cancelRequest(options) {
|
|
19
|
+
return cancelRequest(this.runtime, options);
|
|
20
|
+
}
|
|
21
|
+
subscribe(listener) {
|
|
22
|
+
return subscribe(this.runtime, listener);
|
|
23
|
+
}
|
|
24
|
+
listSessions(filter) {
|
|
25
|
+
return listSessions(this.runtime, filter);
|
|
26
|
+
}
|
|
27
|
+
listSessionSummaries(filter) {
|
|
28
|
+
return listSessionSummaries(this.runtime, filter);
|
|
29
|
+
}
|
|
30
|
+
listRequests(filter) {
|
|
31
|
+
return listRequests(this.runtime, filter);
|
|
32
|
+
}
|
|
33
|
+
getSession(sessionId) {
|
|
34
|
+
return getSession(this.runtime, sessionId);
|
|
35
|
+
}
|
|
36
|
+
getRequest(requestId) {
|
|
37
|
+
return getRequest(this.runtime, requestId);
|
|
38
|
+
}
|
|
39
|
+
listApprovals(filter) {
|
|
40
|
+
return listApprovals(this.runtime, filter);
|
|
41
|
+
}
|
|
42
|
+
getApproval(approvalId) {
|
|
43
|
+
return getApproval(this.runtime, approvalId);
|
|
44
|
+
}
|
|
45
|
+
listRequestEvents(input) {
|
|
46
|
+
return listRequestEvents(this.runtime, input);
|
|
47
|
+
}
|
|
48
|
+
listRequestTraceItems(input) {
|
|
49
|
+
return listRequestTraceItems(this.runtime, input);
|
|
50
|
+
}
|
|
51
|
+
getHealth() {
|
|
52
|
+
return getHealth(this.runtime);
|
|
53
|
+
}
|
|
54
|
+
getOperatorOverview(options) {
|
|
55
|
+
return getOperatorOverview(this.runtime, options);
|
|
56
|
+
}
|
|
57
|
+
async stop() {
|
|
58
|
+
await stop(this.runtime);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function createInProcessHarnessClient(runtime) {
|
|
62
|
+
return new InProcessHarnessClient(runtime);
|
|
63
|
+
}
|
|
64
|
+
export async function createAgentHarnessClient(workspaceRoot, options) {
|
|
65
|
+
const runtime = workspaceRoot === undefined
|
|
66
|
+
? await createAgentHarness()
|
|
67
|
+
: await createAgentHarness(workspaceRoot, options);
|
|
68
|
+
return new InProcessHarnessClient(runtime);
|
|
69
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AcpHarnessClient, createAcpHarnessClient, createAcpHttpHarnessClient, createAcpStdioHarnessClient } from "./acp.js";
|
|
2
|
+
export { InProcessHarnessClient, createAgentHarnessClient, createInProcessHarnessClient } from "./in-process.js";
|
|
3
|
+
export type { HarnessClient, HarnessClientApprovalFilter, HarnessClientRequestFilter, HarnessClientRequestOptions, HarnessClientRequestResult, HarnessClientRequestStartOptions, HarnessClientStreamItem, } from "./types.js";
|
|
4
|
+
export type { AcpHarnessTransport } from "./acp.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Approval, OperatorOverview, PublicRequestListeners, PublicRequestOptions, PublicRequestResult, RequestEvent, RequestTraceItem } from "../api.js";
|
|
2
|
+
import type { CancelOptions, HarnessStreamItem, InvocationEnvelope, MessageContent, RequestSummary, ResumeOptions, RuntimeHealthSnapshot, SessionListSummary, SessionRecord, SessionSummary } from "../contracts/types.js";
|
|
3
|
+
export type HarnessClientRequestStartOptions = {
|
|
4
|
+
agentId?: string;
|
|
5
|
+
input: MessageContent;
|
|
6
|
+
sessionId?: string;
|
|
7
|
+
priority?: number;
|
|
8
|
+
invocation?: InvocationEnvelope;
|
|
9
|
+
listeners?: PublicRequestListeners;
|
|
10
|
+
};
|
|
11
|
+
export type HarnessClientRequestOptions = PublicRequestOptions;
|
|
12
|
+
export type HarnessClientRequestResult = PublicRequestResult;
|
|
13
|
+
export type HarnessClientStreamItem = HarnessStreamItem;
|
|
14
|
+
export type HarnessClientRequestFilter = {
|
|
15
|
+
agentId?: string;
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
state?: RequestSummary["state"];
|
|
18
|
+
};
|
|
19
|
+
export type HarnessClientApprovalFilter = {
|
|
20
|
+
status?: Approval["status"];
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
requestId?: string;
|
|
23
|
+
};
|
|
24
|
+
export interface HarnessClient {
|
|
25
|
+
request(options: HarnessClientRequestOptions): Promise<HarnessClientRequestResult>;
|
|
26
|
+
streamRequest(options: HarnessClientRequestStartOptions): AsyncGenerator<HarnessClientStreamItem>;
|
|
27
|
+
resolveApproval(options: ResumeOptions): Promise<HarnessClientRequestResult>;
|
|
28
|
+
cancelRequest(options: CancelOptions): Promise<HarnessClientRequestResult>;
|
|
29
|
+
subscribe(listener: (event: RequestEvent) => void | Promise<void>): () => void;
|
|
30
|
+
listSessions(filter?: {
|
|
31
|
+
agentId?: string;
|
|
32
|
+
status?: RequestSummary["state"];
|
|
33
|
+
}): Promise<SessionSummary[]>;
|
|
34
|
+
listSessionSummaries(filter?: {
|
|
35
|
+
agentId?: string;
|
|
36
|
+
status?: RequestSummary["state"];
|
|
37
|
+
}): Promise<SessionListSummary[]>;
|
|
38
|
+
listRequests(filter?: HarnessClientRequestFilter): Promise<RequestSummary[]>;
|
|
39
|
+
getSession(sessionId: string): Promise<SessionRecord | null>;
|
|
40
|
+
getRequest(requestId: string): Promise<RequestSummary | null>;
|
|
41
|
+
listApprovals(filter?: HarnessClientApprovalFilter): Promise<Approval[]>;
|
|
42
|
+
getApproval(approvalId: string): Promise<Approval | null>;
|
|
43
|
+
listRequestEvents(input: {
|
|
44
|
+
sessionId: string;
|
|
45
|
+
requestId: string;
|
|
46
|
+
}): Promise<RequestEvent[]>;
|
|
47
|
+
listRequestTraceItems(input: {
|
|
48
|
+
sessionId: string;
|
|
49
|
+
requestId: string;
|
|
50
|
+
}): Promise<RequestTraceItem[]>;
|
|
51
|
+
getHealth(): Promise<RuntimeHealthSnapshot>;
|
|
52
|
+
getOperatorOverview(options?: {
|
|
53
|
+
limit?: number;
|
|
54
|
+
}): Promise<OperatorOverview>;
|
|
55
|
+
stop(): Promise<void>;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.js";
|
package/dist/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.js";
|
|
@@ -32,8 +32,14 @@ spec:
|
|
|
32
32
|
- path: config/agent-context.md
|
|
33
33
|
# Upstream execution feature: top-level host starts with no extra direct tool refs beyond discovered workspace tools.
|
|
34
34
|
tools: []
|
|
35
|
-
# Upstream execution feature:
|
|
36
|
-
|
|
35
|
+
# Upstream execution feature: the starter runtime ships one host plus a small set of behavior skills so the
|
|
36
|
+
# first request already feels like real work instead of an empty shell.
|
|
37
|
+
skills:
|
|
38
|
+
- resource://skills/workspace-inspection
|
|
39
|
+
- resource://skills/safe-editing
|
|
40
|
+
- resource://skills/delegation-discipline
|
|
41
|
+
- resource://skills/approval-execution-policy
|
|
42
|
+
- resource://skills/completion-discipline
|
|
37
43
|
# Upstream execution feature: subagent topology is empty in the repository default and can be filled in YAML.
|
|
38
44
|
subagents: []
|
|
39
45
|
# Upstream execution feature: host-level MCP servers are opt-in and empty by default.
|
|
@@ -79,13 +85,18 @@ spec:
|
|
|
79
85
|
systemPrompt: |-
|
|
80
86
|
You are the orchestra agent.
|
|
81
87
|
|
|
82
|
-
You are the default execution host.
|
|
88
|
+
You are the default execution host for a user-facing runtime.
|
|
89
|
+
The first request should feel like a capable working session, not a thin demo.
|
|
83
90
|
Try to finish the request yourself before delegating.
|
|
84
91
|
Use your own tools first when they are sufficient.
|
|
85
92
|
Use your own skills first when they are sufficient.
|
|
86
93
|
Delegate only when a subagent is a clearly better fit or when your own tools and skills are not enough.
|
|
87
94
|
If neither you nor any suitable subagent can do the work, say so plainly.
|
|
88
95
|
|
|
96
|
+
Prefer visible progress over abstract planning. When the request is about this workspace, inspect the workspace
|
|
97
|
+
before answering. When the request would be improved by a concrete edit or command, do the smallest safe action
|
|
98
|
+
that moves the work forward instead of only describing what you might do.
|
|
99
|
+
|
|
89
100
|
Do not delegate by reflex.
|
|
90
101
|
Do not delegate just because a task has multiple steps.
|
|
91
102
|
Do not delegate when a direct answer or a short local tool pass is enough.
|
|
@@ -95,6 +106,8 @@ spec:
|
|
|
95
106
|
Use your own tools for lightweight discovery, inventory, and context gathering.
|
|
96
107
|
Prefer the structured checkout, indexing, retrieval, and inventory tools that are already attached to you over
|
|
97
108
|
ad hoc shell work when those tools are sufficient.
|
|
109
|
+
Keep answers crisp, concrete, and usable. Close the loop: explain what you inspected, what you changed, what you
|
|
110
|
+
verified, and what still needs approval or follow-up.
|
|
98
111
|
Use the attached subagent descriptions as the source of truth for what each subagent is for.
|
|
99
112
|
Do not delegate to a subagent whose description does not clearly match the task.
|
|
100
113
|
Integrate subagent results into one coherent answer and do not claim checks or evidence you did not obtain.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { AgentHarnessAcpServer, AgentHarnessRuntime, cancelRequest, createAgentHarness, createAcpServer, createAcpStdioClient, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportFlow, exportSequence, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getOperatorOverview, getRequest, getHealth, listMemories, listRequestTraceItems, getSession, listAgentSkills, listRequestArtifacts, listApprovals, listRequests, listRequestEvents, listSessionSummaries, listSessions, memorize, normalizeUserChatInput, recordArtifact, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, } from "./api.js";
|
|
2
|
+
export { AcpHarnessClient, InProcessHarnessClient, createAcpHarnessClient, createAcpHttpHarnessClient, createAcpStdioHarnessClient, createAgentHarnessClient, createInProcessHarnessClient, } from "./client.js";
|
|
2
3
|
export { createKnowledgeModule, readKnowledgeRuntimeConfig } from "./knowledge/index.js";
|
|
3
|
-
export type { AcpApproval, AcpArtifact, AcpEventNotification, AcpJsonRpcError, AcpJsonRpcRequest, AcpJsonRpcResponse, AcpJsonRpcSuccess, AcpRequestRecord, AcpRequestParams, AcpServerCapabilities, AcpSessionRecord, AcpStdioClient, AcpStdioClientOptions, } from "./acp.js";
|
|
4
|
-
export type { Approval, ListMemoriesInput, ListMemoriesResult, MemoryDecision, MemoryKind, MemoryRecord, MemoryScope, MemorizeInput, MemorizeResult, NormalizeUserChatInputOptions, OperatorOverview, RecordArtifactInput, PublicRequestListeners, RequestArtifactListing, RequestEvent, RequestEventType, RequestPackage, RequestPackageInput, RequestFlowGraphInput, RequestResult, RequestTraceItem, RecallInput, RecallResult, RemoveMemoryInput, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult, SessionListSummary, RuntimeSessionPackage, RuntimeSessionPackageInput, UpdateMemoryInput, UserChatInput, UserChatMessage, } from "./api.js";
|
|
4
|
+
export type { AcpApproval, AcpHttpClient, AcpHttpClientOptions, AcpArtifact, AcpEventNotification, AcpNotification, AcpJsonRpcError, AcpJsonRpcRequest, AcpJsonRpcResponse, AcpJsonRpcSuccess, AcpRequestRecord, AcpRequestParams, AcpServerCapabilities, AcpSessionRecord, AcpStreamNotification, AcpStdioClient, AcpStdioClientOptions, } from "./acp.js";
|
|
5
|
+
export type { Approval, CreateAgentHarnessOptions, ListMemoriesInput, ListMemoriesResult, MemoryDecision, MemoryKind, MemoryRecord, MemoryScope, MemorizeInput, MemorizeResult, NormalizeUserChatInputOptions, OperatorOverview, RecordArtifactInput, PublicRequestListeners, RequestArtifactListing, RequestEvent, RequestEventType, RequestPackage, RequestPackageInput, RequestFlowGraphInput, RequestResult, RequestTraceItem, RecallInput, RecallResult, RemoveMemoryInput, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult, SessionListSummary, RuntimeSessionPackage, RuntimeSessionPackageInput, UpdateMemoryInput, UserChatInput, UserChatMessage, } from "./api.js";
|
|
6
|
+
export type { AcpHarnessTransport, HarnessClient, HarnessClientApprovalFilter, HarnessClientRequestFilter, HarnessClientRequestOptions, HarnessClientRequestResult, HarnessClientRequestStartOptions, HarnessClientStreamItem, } from "./client.js";
|
|
5
7
|
export type { KnowledgeListInput, KnowledgeMemorizeInput, KnowledgeModule, KnowledgeModuleDependencies, KnowledgeRecallInput, KnowledgeRuntimeConfig, KnowledgeRuntimeContext, } from "./knowledge/index.js";
|
|
6
8
|
export type { A2aAgentCard, A2aHttpServer, A2aHttpServerOptions, A2aTask, A2aTaskState, AcpHttpServer, AcpHttpServerOptions, AcpStdioServer, AcpStdioServerOptions, AgUiEvent, AgUiHttpServer, AgUiHttpServerOptions, AgUiRequestAgentInput, } from "./api.js";
|
|
7
9
|
export type { RuntimeMcpServerOptions, ToolMcpServerOptions } from "./mcp.js";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { AgentHarnessAcpServer, AgentHarnessRuntime, cancelRequest, createAgentHarness, createAcpServer, createAcpStdioClient, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportFlow, exportSequence, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getOperatorOverview, getRequest, getHealth, listMemories, listRequestTraceItems, getSession, listAgentSkills, listRequestArtifacts, listApprovals, listRequests, listRequestEvents, listSessionSummaries, listSessions, memorize, normalizeUserChatInput, recordArtifact, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, } from "./api.js";
|
|
2
|
+
export { AcpHarnessClient, InProcessHarnessClient, createAcpHarnessClient, createAcpHttpHarnessClient, createAcpStdioHarnessClient, createAgentHarnessClient, createInProcessHarnessClient, } from "./client.js";
|
|
2
3
|
export { createKnowledgeModule, readKnowledgeRuntimeConfig } from "./knowledge/index.js";
|
|
3
4
|
export { tool } from "./tools.js";
|
package/dist/init-project.js
CHANGED
|
@@ -57,6 +57,7 @@ It is a minimal ${options.template} workspace with:
|
|
|
57
57
|
|
|
58
58
|
${templateLine}
|
|
59
59
|
${webSearchLine}
|
|
60
|
+
- one host agent that already carries the default behavior skills for inspection, safe edits, approvals, and clean completion
|
|
60
61
|
|
|
61
62
|
## Run
|
|
62
63
|
|
|
@@ -65,6 +66,13 @@ npm install
|
|
|
65
66
|
${providerEnvLine}npm run start -- "Research the latest model serving stack for agent products and summarize the tradeoffs."
|
|
66
67
|
\`\`\`
|
|
67
68
|
|
|
69
|
+
## Fast first prompts
|
|
70
|
+
|
|
71
|
+
- \`Inspect this workspace and explain the main entry points.\`
|
|
72
|
+
- \`Review this project structure before making any edits.\`
|
|
73
|
+
- \`Update README.md to make the setup steps clearer.\`
|
|
74
|
+
- \`Find the likeliest config issue in this workspace and propose the smallest fix.\`
|
|
75
|
+
|
|
68
76
|
## Structure
|
|
69
77
|
|
|
70
78
|
- \`src/run.mjs\`: minimal launcher
|
|
@@ -277,6 +285,11 @@ spec:
|
|
|
277
285
|
backend: deepagent
|
|
278
286
|
modelRef: model/default
|
|
279
287
|
${toolsBlock} skills:
|
|
288
|
+
- workspace-inspection
|
|
289
|
+
- safe-editing
|
|
290
|
+
- delegation-discipline
|
|
291
|
+
- approval-execution-policy
|
|
292
|
+
- completion-discipline
|
|
280
293
|
- deep-research
|
|
281
294
|
${subagentsBlock} config:
|
|
282
295
|
backend: default
|
|
@@ -299,6 +312,9 @@ spec:
|
|
|
299
312
|
backend: deepagent
|
|
300
313
|
modelRef: model/default
|
|
301
314
|
${toolsBlock} skills:
|
|
315
|
+
- workspace-inspection
|
|
316
|
+
- approval-execution-policy
|
|
317
|
+
- completion-discipline
|
|
302
318
|
- deep-research
|
|
303
319
|
config:
|
|
304
320
|
backend: default
|
|
@@ -336,6 +352,74 @@ ${stepTwo}
|
|
|
336
352
|
5. End with a concise synthesis, explicit caveats, and source links when available.
|
|
337
353
|
`;
|
|
338
354
|
}
|
|
355
|
+
function renderStarterSkill(name) {
|
|
356
|
+
if (name === "workspace-inspection") {
|
|
357
|
+
return `---
|
|
358
|
+
name: workspace-inspection
|
|
359
|
+
description: Inspect the current workspace before making claims or edits.
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
# Workspace Inspection
|
|
363
|
+
|
|
364
|
+
1. Start with lightweight discovery such as \`list_files\` or \`search_files\`.
|
|
365
|
+
2. Read only the files needed to establish the relevant facts.
|
|
366
|
+
3. Ground each conclusion in inspected workspace evidence instead of guesses.
|
|
367
|
+
4. If the workspace does not contain the needed evidence, say that plainly before proposing a next step.
|
|
368
|
+
`;
|
|
369
|
+
}
|
|
370
|
+
if (name === "safe-editing") {
|
|
371
|
+
return `---
|
|
372
|
+
name: safe-editing
|
|
373
|
+
description: Make the smallest workspace change that solves the task, then verify it.
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
# Safe Editing
|
|
377
|
+
|
|
378
|
+
1. Identify the exact file or files before editing.
|
|
379
|
+
2. Prefer bounded edits over large rewrites.
|
|
380
|
+
3. Keep local conventions intact.
|
|
381
|
+
4. Run the smallest reasonable verification step before you finish.
|
|
382
|
+
`;
|
|
383
|
+
}
|
|
384
|
+
if (name === "delegation-discipline") {
|
|
385
|
+
return `---
|
|
386
|
+
name: delegation-discipline
|
|
387
|
+
description: Delegate only when a subagent is clearly the best fit and the handoff can be bounded cleanly.
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
# Delegation Discipline
|
|
391
|
+
|
|
392
|
+
1. Keep the next critical-path step local unless a subagent is clearly better.
|
|
393
|
+
2. Delegate only with one bounded ask and a clear purpose.
|
|
394
|
+
3. Integrate delegated results into one final answer instead of forwarding raw output.
|
|
395
|
+
`;
|
|
396
|
+
}
|
|
397
|
+
if (name === "approval-execution-policy") {
|
|
398
|
+
return `---
|
|
399
|
+
name: approval-execution-policy
|
|
400
|
+
description: Treat side effects, command execution, and external actions as governed runtime decisions.
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
# Approval And Execution Policy
|
|
404
|
+
|
|
405
|
+
1. Inspect first when the safest next step is still unclear.
|
|
406
|
+
2. Request approval before destructive, external, privileged, or ambiguous actions.
|
|
407
|
+
3. After approval, execute only the action that was approved and report the outcome plainly.
|
|
408
|
+
`;
|
|
409
|
+
}
|
|
410
|
+
return `---
|
|
411
|
+
name: completion-discipline
|
|
412
|
+
description: Finish the task cleanly, verify what you can, and leave the user with a clear outcome.
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
# Completion Discipline
|
|
416
|
+
|
|
417
|
+
1. Check whether the request is actually complete.
|
|
418
|
+
2. Verify the changed or inspected area with the smallest relevant check.
|
|
419
|
+
3. Distinguish completed work, unverified areas, and blocked follow-up.
|
|
420
|
+
4. Return a concise final answer that makes the outcome easy to trust.
|
|
421
|
+
`;
|
|
422
|
+
}
|
|
339
423
|
function renderRunScript(options) {
|
|
340
424
|
const defaultInput = options.withWebSearch
|
|
341
425
|
? "Research the latest model and tooling trends for AI product teams. Return a concise brief with sources and caveats."
|
|
@@ -400,6 +484,11 @@ export async function initProject(projectRoot, projectName, options = {}) {
|
|
|
400
484
|
["config/agents/research.yaml", renderResearchAgentYaml(resolved)],
|
|
401
485
|
["resources/package.json", renderResourcePackageJson(projectSlug)],
|
|
402
486
|
["resources/skills/deep-research/SKILL.md", renderSkill(resolved)],
|
|
487
|
+
["resources/skills/workspace-inspection/SKILL.md", renderStarterSkill("workspace-inspection")],
|
|
488
|
+
["resources/skills/safe-editing/SKILL.md", renderStarterSkill("safe-editing")],
|
|
489
|
+
["resources/skills/delegation-discipline/SKILL.md", renderStarterSkill("delegation-discipline")],
|
|
490
|
+
["resources/skills/approval-execution-policy/SKILL.md", renderStarterSkill("approval-execution-policy")],
|
|
491
|
+
["resources/skills/completion-discipline/SKILL.md", renderStarterSkill("completion-discipline")],
|
|
403
492
|
]);
|
|
404
493
|
if (resolved.template === "deep-research") {
|
|
405
494
|
files.set("config/agents/research-analyst.yaml", renderResearchAnalystYaml(resolved));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.295";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.295";
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import type { Readable, Writable } from "node:stream";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AcpNotification, AcpJsonRpcSuccess } from "../../acp.js";
|
|
3
3
|
export type AcpStdioClientOptions = {
|
|
4
4
|
input: Writable;
|
|
5
5
|
output: Readable;
|
|
6
6
|
idPrefix?: string;
|
|
7
7
|
};
|
|
8
|
+
export type AcpHttpClientOptions = {
|
|
9
|
+
rpcUrl: string;
|
|
10
|
+
eventsUrl: string;
|
|
11
|
+
};
|
|
8
12
|
export type AcpStdioClient = {
|
|
9
13
|
request: (method: string, params?: unknown) => Promise<AcpJsonRpcSuccess["result"]>;
|
|
10
14
|
notify: (method: string, params?: unknown) => Promise<void>;
|
|
11
|
-
subscribe: (listener: (notification:
|
|
15
|
+
subscribe: (listener: (notification: AcpNotification) => void) => () => void;
|
|
12
16
|
close: () => Promise<void>;
|
|
13
17
|
};
|
|
18
|
+
export type AcpHttpClient = AcpStdioClient;
|
|
14
19
|
export declare function createAcpStdioClient(options: AcpStdioClientOptions): AcpStdioClient;
|
|
20
|
+
export declare function createAcpHttpClient(options: AcpHttpClientOptions): AcpHttpClient;
|