@buildanagent/cli 0.0.0-stage → 0.1.0-alpha.29
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/LICENSE +54 -0
- package/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +143 -2
- package/dist/args.d.ts +20 -0
- package/dist/args.js +76 -0
- package/dist/args.js.map +1 -0
- package/dist/ask.d.ts +22 -0
- package/dist/ask.js +108 -0
- package/dist/ask.js.map +1 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +26 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +111 -0
- package/dist/cli.js.map +1 -0
- package/dist/command-lines.d.ts +25 -0
- package/dist/command-lines.js +166 -0
- package/dist/command-lines.js.map +1 -0
- package/dist/commands/chat.d.ts +18 -0
- package/dist/commands/chat.js +52 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/keys.d.ts +3 -0
- package/dist/commands/keys.js +47 -0
- package/dist/commands/keys.js.map +1 -0
- package/dist/commands/rpc.d.ts +3 -0
- package/dist/commands/rpc.js +33 -0
- package/dist/commands/rpc.js.map +1 -0
- package/dist/commands/run.d.ts +3 -0
- package/dist/commands/run.js +20 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/sessions.d.ts +3 -0
- package/dist/commands/sessions.js +161 -0
- package/dist/commands/sessions.js.map +1 -0
- package/dist/commands/unlock.d.ts +3 -0
- package/dist/commands/unlock.js +31 -0
- package/dist/commands/unlock.js.map +1 -0
- package/dist/errors.d.ts +31 -0
- package/dist/errors.js +22 -0
- package/dist/errors.js.map +1 -0
- package/dist/host.d.ts +61 -0
- package/dist/host.js +114 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/io.d.ts +36 -0
- package/dist/io.js +18 -0
- package/dist/io.js.map +1 -0
- package/dist/live.d.ts +33 -0
- package/dist/live.js +100 -0
- package/dist/live.js.map +1 -0
- package/dist/meter.d.ts +50 -0
- package/dist/meter.js +91 -0
- package/dist/meter.js.map +1 -0
- package/dist/model.d.ts +12 -0
- package/dist/model.js +35 -0
- package/dist/model.js.map +1 -0
- package/dist/options.d.ts +30 -0
- package/dist/options.js +2 -0
- package/dist/options.js.map +1 -0
- package/dist/otlp.d.ts +28 -0
- package/dist/otlp.js +110 -0
- package/dist/otlp.js.map +1 -0
- package/dist/output.d.ts +18 -0
- package/dist/output.js +28 -0
- package/dist/output.js.map +1 -0
- package/dist/render.d.ts +18 -0
- package/dist/render.js +65 -0
- package/dist/render.js.map +1 -0
- package/dist/visible.d.ts +11 -0
- package/dist/visible.js +63 -0
- package/dist/visible.js.map +1 -0
- package/dist/watch.d.ts +63 -0
- package/dist/watch.js +219 -0
- package/dist/watch.js.map +1 -0
- package/llms.txt +31 -0
- package/package.json +43 -3
package/dist/watch.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { RpcFailure } from "@buildanagent/harness/server";
|
|
2
|
+
import { ErrorCodes, } from "@buildanagent/protocol";
|
|
3
|
+
import { CliError } from "./errors.js";
|
|
4
|
+
/** The stop reasons that mean a turn waits for a person. */
|
|
5
|
+
export const WAITING_REASONS = new Set(["awaiting_approval", "clarification_requested"]);
|
|
6
|
+
/** How long `whenAsked()` waits for the server to ask about a request before it checks the log. */
|
|
7
|
+
export const ASK_WAIT_MS = 5_000;
|
|
8
|
+
/**
|
|
9
|
+
* The `error.kind` of a resume's `turn/settled` when the server wrote none of its answers. The server forgets those
|
|
10
|
+
* answers and asks about each request again.
|
|
11
|
+
*/
|
|
12
|
+
const NOT_APPLIED = "answer_not_applied";
|
|
13
|
+
/** Watches one session on `client`. Call `stop()` when done with it. */
|
|
14
|
+
export class SessionWatch {
|
|
15
|
+
session;
|
|
16
|
+
/** The requests for a person that wait on this client, by request id. */
|
|
17
|
+
asked = new Map();
|
|
18
|
+
/** The input each approval request's call would run with, from its `approval_requested` entry. */
|
|
19
|
+
inputs = new Map();
|
|
20
|
+
#client;
|
|
21
|
+
#answered = new Set();
|
|
22
|
+
/** The answers this client gave that no resume has written yet. */
|
|
23
|
+
#unwritten = new Set();
|
|
24
|
+
/** The answers a resume has written whose turn has not settled yet. */
|
|
25
|
+
#written = new Set();
|
|
26
|
+
#settled = [];
|
|
27
|
+
#waiters = [];
|
|
28
|
+
#changes = [];
|
|
29
|
+
#unsubscribe;
|
|
30
|
+
#replaying = false;
|
|
31
|
+
constructor(client, session, listener) {
|
|
32
|
+
this.#client = client;
|
|
33
|
+
this.session = session;
|
|
34
|
+
this.#unsubscribe = client.onMessage((message) => {
|
|
35
|
+
if (!("method" in message))
|
|
36
|
+
return;
|
|
37
|
+
if (message.method === "$/cancelRequest")
|
|
38
|
+
this.#withdraw(message.params.id);
|
|
39
|
+
else if (message.params.session === session)
|
|
40
|
+
this.#take(message, listener);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Takes one message of this session. */
|
|
44
|
+
#take(message, listener) {
|
|
45
|
+
if (message.method === "event") {
|
|
46
|
+
const { event, seq } = message.params;
|
|
47
|
+
if (event.type === "entry_appended")
|
|
48
|
+
this.#entry(event.entry);
|
|
49
|
+
listener(event, seq, this.#replaying);
|
|
50
|
+
}
|
|
51
|
+
else if (message.method === "turn/settled") {
|
|
52
|
+
this.#written.clear();
|
|
53
|
+
// The server forgot the answers it could not write and asks about their requests again.
|
|
54
|
+
if (message.params.result.error?.kind === NOT_APPLIED)
|
|
55
|
+
this.#unwritten.clear();
|
|
56
|
+
const settled = { turn: message.params.turn, result: message.params.result };
|
|
57
|
+
const waiter = this.#waiters.shift();
|
|
58
|
+
if (waiter === undefined)
|
|
59
|
+
this.#settled.push(settled);
|
|
60
|
+
else
|
|
61
|
+
waiter(settled);
|
|
62
|
+
}
|
|
63
|
+
else if (message.method === "approval/request" || message.method === "clarification/request") {
|
|
64
|
+
this.asked.set(message.params.request.id, message);
|
|
65
|
+
this.#unwritten.delete(message.params.request.id);
|
|
66
|
+
this.#changed();
|
|
67
|
+
}
|
|
68
|
+
else if (message.method === "tool/call") {
|
|
69
|
+
// The terminal has no client side for a tool to run on, so the call fails at once instead of waiting forever.
|
|
70
|
+
this.#client.fail(message, {
|
|
71
|
+
code: ErrorCodes.MethodNotFound,
|
|
72
|
+
message: `the buildanagent CLI runs no client tools, so register ${message.params.tool} to run in process`,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** Notes what an entry says about the requests: the input an approval would run with, or an answer written. */
|
|
77
|
+
#entry(entry) {
|
|
78
|
+
if (entry.type === "approval_requested")
|
|
79
|
+
this.inputs.set(entry.request.id, entry.input);
|
|
80
|
+
else if (entry.type === "approval_resolved" && this.#unwritten.delete(entry.resolution.requestId)) {
|
|
81
|
+
this.#written.add(entry.resolution.requestId);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
#withdraw(id) {
|
|
85
|
+
for (const [requestId, request] of this.asked)
|
|
86
|
+
if (request.id === id)
|
|
87
|
+
this.asked.delete(requestId);
|
|
88
|
+
this.#changed();
|
|
89
|
+
}
|
|
90
|
+
#changed() {
|
|
91
|
+
for (const notify of this.#changes.splice(0))
|
|
92
|
+
notify();
|
|
93
|
+
}
|
|
94
|
+
/** Resolves `true` at the next change to `asked`, or `false` once `ms` pass without one. */
|
|
95
|
+
#changeWithin(ms) {
|
|
96
|
+
return new Promise((resolve) => {
|
|
97
|
+
const notify = () => {
|
|
98
|
+
clearTimeout(timer);
|
|
99
|
+
resolve(true);
|
|
100
|
+
};
|
|
101
|
+
const timer = setTimeout(() => {
|
|
102
|
+
const at = this.#changes.indexOf(notify);
|
|
103
|
+
if (at >= 0)
|
|
104
|
+
this.#changes.splice(at, 1);
|
|
105
|
+
resolve(false);
|
|
106
|
+
}, ms);
|
|
107
|
+
this.#changes.push(notify);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/** Marks the events that follow as replayed until `replayed` is called with false. */
|
|
111
|
+
replaying(on) {
|
|
112
|
+
this.#replaying = on;
|
|
113
|
+
}
|
|
114
|
+
/** The next turn to settle, or one that settled and has not been taken yet. */
|
|
115
|
+
nextSettled() {
|
|
116
|
+
const ready = this.#settled.shift();
|
|
117
|
+
if (ready !== undefined)
|
|
118
|
+
return Promise.resolve(ready);
|
|
119
|
+
return new Promise((resolve) => this.#waiters.push(resolve));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Resolves once every request in `ids` has been asked on this client, answered, withdrawn or settled elsewhere. The
|
|
123
|
+
* server asks about a stored session's requests when it opens, but it skips them when it can't read the log in
|
|
124
|
+
* time, so after `waitMs` without a change the log decides. Throws a `CliError`, code `session_unavailable`, when a
|
|
125
|
+
* request still waits there that the server never asked about.
|
|
126
|
+
*/
|
|
127
|
+
async whenAsked(ids, waitMs = ASK_WAIT_MS) {
|
|
128
|
+
const unasked = (id) => !this.asked.has(id) && !this.#answered.has(id);
|
|
129
|
+
let left = ids.filter(unasked);
|
|
130
|
+
while (left.length > 0) {
|
|
131
|
+
const changed = await this.#changeWithin(waitMs);
|
|
132
|
+
left = left.filter(unasked);
|
|
133
|
+
if (changed || left.length === 0)
|
|
134
|
+
continue;
|
|
135
|
+
const waiting = await this.#waitingIds();
|
|
136
|
+
left = left.filter((id) => waiting.has(id) && unasked(id));
|
|
137
|
+
if (left.length > 0) {
|
|
138
|
+
throw new CliError("session_unavailable", `session ${this.session} still waits on ${left.join(", ")}, which the server never asked about: ` +
|
|
139
|
+
"run resume again");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** Answers one request for a person. */
|
|
144
|
+
answer(request, resolution) {
|
|
145
|
+
const id = request.params.request.id;
|
|
146
|
+
this.asked.delete(id);
|
|
147
|
+
this.#answered.add(id);
|
|
148
|
+
this.#unwritten.add(id);
|
|
149
|
+
this.#client.respond(request, { resolutions: [resolution] });
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Whether another turn will settle for an answer this client gave: a settled turn is ready to take, a resume has
|
|
153
|
+
* written one of the answers and still runs, or the log still shows an answered request waiting, so a resume will
|
|
154
|
+
* take it. An answered request the log no longer shows, and that no resume of ours wrote, was settled by another
|
|
155
|
+
* process, and no turn settles for it here.
|
|
156
|
+
*/
|
|
157
|
+
async settlePending() {
|
|
158
|
+
if (this.#settled.length > 0 || this.#written.size > 0)
|
|
159
|
+
return true;
|
|
160
|
+
if (this.#unwritten.size === 0)
|
|
161
|
+
return false;
|
|
162
|
+
const waiting = await this.#waitingIds();
|
|
163
|
+
for (const id of this.#unwritten)
|
|
164
|
+
if (!waiting.has(id))
|
|
165
|
+
this.#unwritten.delete(id);
|
|
166
|
+
return this.#settled.length > 0 || this.#written.size > 0 || this.#unwritten.size > 0;
|
|
167
|
+
}
|
|
168
|
+
async #waitingIds() {
|
|
169
|
+
const { pending } = await this.#client.request("approval/list", { session: this.session });
|
|
170
|
+
return new Set(pending.map((request) => request.id));
|
|
171
|
+
}
|
|
172
|
+
/** Stops listening. */
|
|
173
|
+
stop() {
|
|
174
|
+
this.#unsubscribe();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const isUnknownSession = (error) => error instanceof RpcFailure && /^no session /.test(error.rpc.message);
|
|
178
|
+
/**
|
|
179
|
+
* Opens a stored session on `watch`'s client and replays its log into the watch, marked as replayed. Resolves with
|
|
180
|
+
* the ids of the requests that still wait, once the replay is in: the `approval/list` answer comes after it. Throws a
|
|
181
|
+
* `CliError`, code `unknown_session`, when no session has the id.
|
|
182
|
+
*/
|
|
183
|
+
export async function openStored(client, watch, cwd) {
|
|
184
|
+
watch.replaying(true);
|
|
185
|
+
try {
|
|
186
|
+
await client.request("session/open", { session: watch.session, cwd, fromSeq: 0 });
|
|
187
|
+
const { pending } = await client.request("approval/list", { session: watch.session });
|
|
188
|
+
return pending.map((request) => request.id);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
if (isUnknownSession(error))
|
|
192
|
+
throw new CliError("unknown_session", `no session ${JSON.stringify(watch.session)}`);
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
finally {
|
|
196
|
+
watch.replaying(false);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/** Starts a turn with `text` and resolves once it settles. Throws a `CliError` when the session refuses the turn. */
|
|
200
|
+
export async function runTurn(client, watch, text) {
|
|
201
|
+
const disposition = await client.request("turn/start", {
|
|
202
|
+
session: watch.session,
|
|
203
|
+
input: [{ type: "text", text }],
|
|
204
|
+
});
|
|
205
|
+
if (!disposition.accepted) {
|
|
206
|
+
const why = disposition.reason === "locked" ? "another process is writing it" : `the server said ${disposition.reason}`;
|
|
207
|
+
throw new CliError("session_unavailable", `session ${watch.session} can't take a turn: ${why}`);
|
|
208
|
+
}
|
|
209
|
+
// A settlement of another turn taken here is dropped safely. The server runs one turn of a session at a time and
|
|
210
|
+
// refuses `turn/start` while a resume runs, so such a settlement is a resume that ended before this turn started;
|
|
211
|
+
// and `settlePending()` never waits on it, because every `turn/settled` clears the written answers as it arrives,
|
|
212
|
+
// whoever takes it, and an unwritten answer counts only while the log still shows its request waiting.
|
|
213
|
+
for (;;) {
|
|
214
|
+
const settled = await watch.nextSettled();
|
|
215
|
+
if (settled.turn === disposition.turn)
|
|
216
|
+
return settled.result;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EACL,UAAU,GAOX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAcvC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC,CAAC,mBAA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AAG,EAAE,CAAC,CAAC;IAClG,CAAC;IACD,iHAAiH;IACjH,kHAAkH;IAClH,kHAAkH;IAClH,uGAAuG;IACvG,SAAS,CAAC;QACR,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAC/D,CAAC;AACH,CAAC","sourcesContent":["/**\n * One session as the CLI's client sees it: the events the server streams for it, the turns that settle, and the\n * requests for a person that wait for an answer. Opening a stored session replays its log first, and the replayed\n * events are marked, so the meter counts what the session has already cost while the screen shows only what is new.\n */\nimport type { InProcessClient } from \"@buildanagent/harness/server\";\nimport { RpcFailure } from \"@buildanagent/harness/server\";\nimport {\n ErrorCodes,\n type HarnessEvent,\n type ResponseMessage,\n type ServerMessage,\n type ServerRequest,\n type SessionEntry,\n type TurnResultSummary,\n} from \"@buildanagent/protocol\";\nimport type { AgentEvent, Resolution } from \"@buildanagent/sdk\";\nimport { CliError } from \"./errors.js\";\n\n/** A request for a person: an approval or a clarification. */\nexport type PersonRequest = Extract<ServerRequest, { method: \"approval/request\" | \"clarification/request\" }>;\n\n/** Called with each event of the session; `replayed` is true for an event read back from the log on open. */\nexport type EventListener = (event: AgentEvent | HarnessEvent, seq: number, replayed: boolean) => void;\n\n/** A settled turn. */\nexport interface Settled {\n readonly turn: string;\n readonly result: TurnResultSummary;\n}\n\n/** The stop reasons that mean a turn waits for a person. */\nexport const WAITING_REASONS: ReadonlySet<string> = new Set([\"awaiting_approval\", \"clarification_requested\"]);\n\n/** How long `whenAsked()` waits for the server to ask about a request before it checks the log. */\nexport const ASK_WAIT_MS = 5_000;\n\n/**\n * The `error.kind` of a resume's `turn/settled` when the server wrote none of its answers. The server forgets those\n * answers and asks about each request again.\n */\nconst NOT_APPLIED = \"answer_not_applied\";\n\n/** Watches one session on `client`. Call `stop()` when done with it. */\nexport class SessionWatch {\n readonly session: string;\n /** The requests for a person that wait on this client, by request id. */\n readonly asked = new Map<string, PersonRequest>();\n /** The input each approval request's call would run with, from its `approval_requested` entry. */\n readonly inputs = new Map<string, unknown>();\n readonly #client: InProcessClient;\n readonly #answered = new Set<string>();\n /** The answers this client gave that no resume has written yet. */\n readonly #unwritten = new Set<string>();\n /** The answers a resume has written whose turn has not settled yet. */\n readonly #written = new Set<string>();\n readonly #settled: Settled[] = [];\n readonly #waiters: ((settled: Settled) => void)[] = [];\n readonly #changes: (() => void)[] = [];\n readonly #unsubscribe: () => void;\n #replaying = false;\n\n constructor(client: InProcessClient, session: string, listener: EventListener) {\n this.#client = client;\n this.session = session;\n this.#unsubscribe = client.onMessage((message) => {\n if (!(\"method\" in message)) return;\n if (message.method === \"$/cancelRequest\") this.#withdraw(message.params.id);\n else if ((message.params as { session?: unknown }).session === session) this.#take(message, listener);\n });\n }\n\n /** Takes one message of this session. */\n #take(message: Exclude<ServerMessage, ResponseMessage<unknown>>, listener: EventListener): void {\n if (message.method === \"event\") {\n const { event, seq } = message.params;\n if (event.type === \"entry_appended\") this.#entry(event.entry);\n listener(event, seq, this.#replaying);\n } else if (message.method === \"turn/settled\") {\n this.#written.clear();\n // The server forgot the answers it could not write and asks about their requests again.\n if (message.params.result.error?.kind === NOT_APPLIED) this.#unwritten.clear();\n const settled = { turn: message.params.turn, result: message.params.result };\n const waiter = this.#waiters.shift();\n if (waiter === undefined) this.#settled.push(settled);\n else waiter(settled);\n } else if (message.method === \"approval/request\" || message.method === \"clarification/request\") {\n this.asked.set(message.params.request.id, message);\n this.#unwritten.delete(message.params.request.id);\n this.#changed();\n } else if (message.method === \"tool/call\") {\n // The terminal has no client side for a tool to run on, so the call fails at once instead of waiting forever.\n this.#client.fail(message, {\n code: ErrorCodes.MethodNotFound,\n message: `the buildanagent CLI runs no client tools, so register ${message.params.tool} to run in process`,\n });\n }\n }\n\n /** Notes what an entry says about the requests: the input an approval would run with, or an answer written. */\n #entry(entry: SessionEntry): void {\n if (entry.type === \"approval_requested\") this.inputs.set(entry.request.id, entry.input);\n else if (entry.type === \"approval_resolved\" && this.#unwritten.delete(entry.resolution.requestId)) {\n this.#written.add(entry.resolution.requestId);\n }\n }\n\n #withdraw(id: string | number): void {\n for (const [requestId, request] of this.asked) if (request.id === id) this.asked.delete(requestId);\n this.#changed();\n }\n\n #changed(): void {\n for (const notify of this.#changes.splice(0)) notify();\n }\n\n /** Resolves `true` at the next change to `asked`, or `false` once `ms` pass without one. */\n #changeWithin(ms: number): Promise<boolean> {\n return new Promise((resolve) => {\n const notify = () => {\n clearTimeout(timer);\n resolve(true);\n };\n const timer = setTimeout(() => {\n const at = this.#changes.indexOf(notify);\n if (at >= 0) this.#changes.splice(at, 1);\n resolve(false);\n }, ms);\n this.#changes.push(notify);\n });\n }\n\n /** Marks the events that follow as replayed until `replayed` is called with false. */\n replaying(on: boolean): void {\n this.#replaying = on;\n }\n\n /** The next turn to settle, or one that settled and has not been taken yet. */\n nextSettled(): Promise<Settled> {\n const ready = this.#settled.shift();\n if (ready !== undefined) return Promise.resolve(ready);\n return new Promise((resolve) => this.#waiters.push(resolve));\n }\n\n /**\n * Resolves once every request in `ids` has been asked on this client, answered, withdrawn or settled elsewhere. The\n * server asks about a stored session's requests when it opens, but it skips them when it can't read the log in\n * time, so after `waitMs` without a change the log decides. Throws a `CliError`, code `session_unavailable`, when a\n * request still waits there that the server never asked about.\n */\n async whenAsked(ids: readonly string[], waitMs = ASK_WAIT_MS): Promise<void> {\n const unasked = (id: string) => !this.asked.has(id) && !this.#answered.has(id);\n let left = ids.filter(unasked);\n while (left.length > 0) {\n const changed = await this.#changeWithin(waitMs);\n left = left.filter(unasked);\n if (changed || left.length === 0) continue;\n const waiting = await this.#waitingIds();\n left = left.filter((id) => waiting.has(id) && unasked(id));\n if (left.length > 0) {\n throw new CliError(\n \"session_unavailable\",\n `session ${this.session} still waits on ${left.join(\", \")}, which the server never asked about: ` +\n \"run resume again\",\n );\n }\n }\n }\n\n /** Answers one request for a person. */\n answer(request: PersonRequest, resolution: Resolution): void {\n const id = request.params.request.id;\n this.asked.delete(id);\n this.#answered.add(id);\n this.#unwritten.add(id);\n this.#client.respond(request, { resolutions: [resolution] });\n }\n\n /**\n * Whether another turn will settle for an answer this client gave: a settled turn is ready to take, a resume has\n * written one of the answers and still runs, or the log still shows an answered request waiting, so a resume will\n * take it. An answered request the log no longer shows, and that no resume of ours wrote, was settled by another\n * process, and no turn settles for it here.\n */\n async settlePending(): Promise<boolean> {\n if (this.#settled.length > 0 || this.#written.size > 0) return true;\n if (this.#unwritten.size === 0) return false;\n const waiting = await this.#waitingIds();\n for (const id of this.#unwritten) if (!waiting.has(id)) this.#unwritten.delete(id);\n return this.#settled.length > 0 || this.#written.size > 0 || this.#unwritten.size > 0;\n }\n\n async #waitingIds(): Promise<Set<string>> {\n const { pending } = await this.#client.request(\"approval/list\", { session: this.session });\n return new Set(pending.map((request) => request.id));\n }\n\n /** Stops listening. */\n stop(): void {\n this.#unsubscribe();\n }\n}\n\nconst isUnknownSession = (error: unknown): boolean =>\n error instanceof RpcFailure && /^no session /.test(error.rpc.message);\n\n/**\n * Opens a stored session on `watch`'s client and replays its log into the watch, marked as replayed. Resolves with\n * the ids of the requests that still wait, once the replay is in: the `approval/list` answer comes after it. Throws a\n * `CliError`, code `unknown_session`, when no session has the id.\n */\nexport async function openStored(client: InProcessClient, watch: SessionWatch, cwd: string): Promise<string[]> {\n watch.replaying(true);\n try {\n await client.request(\"session/open\", { session: watch.session, cwd, fromSeq: 0 });\n const { pending } = await client.request(\"approval/list\", { session: watch.session });\n return pending.map((request) => request.id);\n } catch (error) {\n if (isUnknownSession(error)) throw new CliError(\"unknown_session\", `no session ${JSON.stringify(watch.session)}`);\n throw error;\n } finally {\n watch.replaying(false);\n }\n}\n\n/** Starts a turn with `text` and resolves once it settles. Throws a `CliError` when the session refuses the turn. */\nexport async function runTurn(client: InProcessClient, watch: SessionWatch, text: string): Promise<TurnResultSummary> {\n const disposition = await client.request(\"turn/start\", {\n session: watch.session,\n input: [{ type: \"text\", text }],\n });\n if (!disposition.accepted) {\n const why =\n disposition.reason === \"locked\" ? \"another process is writing it\" : `the server said ${disposition.reason}`;\n throw new CliError(\"session_unavailable\", `session ${watch.session} can't take a turn: ${why}`);\n }\n // A settlement of another turn taken here is dropped safely. The server runs one turn of a session at a time and\n // refuses `turn/start` while a resume runs, so such a settlement is a resume that ended before this turn started;\n // and `settlePending()` never waits on it, because every `turn/settled` clears the written answers as it arrives,\n // whoever takes it, and an unwritten answer counts only while the log still shows its request waiting.\n for (;;) {\n const settled = await watch.nextSettled();\n if (settled.turn === disposition.turn) return settled.result;\n }\n}\n"]}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @buildanagent/cli
|
|
2
|
+
|
|
3
|
+
> The buildanagent command line: runs the harness in a terminal.
|
|
4
|
+
|
|
5
|
+
The sections of README.md and every public export, generated from this package's README and declaration files in the same commit as its code.
|
|
6
|
+
|
|
7
|
+
## Docs
|
|
8
|
+
|
|
9
|
+
- [Install the alpha with `pnpm add @buildanagent/cli@alpha`](README.md#install-the-alpha-with-pnpm-add-buildanagentclialpha)
|
|
10
|
+
- [Run one turn and read its events as JSON lines](README.md#run-one-turn-and-read-its-events-as-json-lines)
|
|
11
|
+
- [Chat, and answer approvals at the terminal](README.md#chat-and-answer-approvals-at-the-terminal)
|
|
12
|
+
- [Watch the cost and the context fill](README.md#watch-the-cost-and-the-context-fill)
|
|
13
|
+
- [List, show, search and replay stored sessions](README.md#list-show-search-and-replay-stored-sessions)
|
|
14
|
+
- [Fix a stuck lock or change the approval keys](README.md#fix-a-stuck-lock-or-change-the-approval-keys)
|
|
15
|
+
- [Nothing leaves your machine except the model call and the collector you name](README.md#nothing-leaves-your-machine-except-the-model-call-and-the-collector-you-name)
|
|
16
|
+
- [Serve the protocol to another program with `rpc`](README.md#serve-the-protocol-to-another-program-with-rpc)
|
|
17
|
+
- [Run the CLI from your own program](README.md#run-the-cli-from-your-own-program)
|
|
18
|
+
|
|
19
|
+
## Exports from `@buildanagent/cli`
|
|
20
|
+
|
|
21
|
+
- `class CliError`: Thrown for a command the CLI can't run as given.
|
|
22
|
+
- `type CliErrorCode`: Why a `CliError` was thrown.
|
|
23
|
+
- `interface CliIo`: The terminal a command talks to.
|
|
24
|
+
- `interface CliOptions`: The options of `runCli()`.
|
|
25
|
+
- `interface CliStreams`: The standard streams as bytes, which `rpc` serves the protocol over.
|
|
26
|
+
- `HELP`: The help `--help` prints.
|
|
27
|
+
- `interface HostRules`: The permission rules a host adds to the harness's default ask rules.
|
|
28
|
+
- `isCliError()`: True for a `CliError`, including one from another copy of the package.
|
|
29
|
+
- `linesOf()`: Splits a stream of text or bytes into lines at `\n`, dropping a `\r` before it.
|
|
30
|
+
- `PACKAGE_NAME`: The package name, `@buildanagent/cli`.
|
|
31
|
+
- `runCli()`: Runs the `buildanagent` command line `argv`, the arguments after the program's name, and resolves with the exit status.
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildanagent/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-alpha.29",
|
|
4
|
+
"description": "The buildanagent command line: runs the harness in a terminal.",
|
|
5
|
+
"license": "Apache-2.0 OR MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/laudebugs/buildanagent.git",
|
|
9
|
+
"directory": "packages/cli"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/laudebugs/buildanagent/tree/main/packages/cli#readme",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"./dist/bin.js"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.19.0"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"buildanagent": "./dist/bin.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"llms.txt",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"LICENSE-APACHE",
|
|
27
|
+
"LICENSE-MIT"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@buildanagent/gateway": "0.1.0-alpha.29",
|
|
37
|
+
"@buildanagent/harness": "0.1.0-alpha.29",
|
|
38
|
+
"@buildanagent/sdk": "0.1.0-alpha.29",
|
|
39
|
+
"@buildanagent/protocol": "0.1.0-alpha.29"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "node ../../scripts/clean-dist.mjs && tsc -p tsconfig.build.json",
|
|
43
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
44
|
+
"test": "vitest run"
|
|
45
|
+
}
|
|
6
46
|
}
|