@oyasmi/pipiclaw 0.9.5 → 0.9.6-beta.1
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.en.md +220 -126
- package/README.md +217 -123
- package/dist/agent/channel-runner.d.ts +1 -1
- package/dist/agent/channel-runner.js +1 -1
- package/dist/agent/prompt/sections.js +1 -1
- package/dist/agent/prompt/types.d.ts +2 -1
- package/dist/agent/session/compaction.d.ts +2 -0
- package/dist/agent/session/compaction.js +22 -14
- package/dist/agent/session/session-host.d.ts +1 -1
- package/dist/agent/session/session-host.js +3 -1
- package/dist/agent/stop-watchdog.js +5 -1
- package/dist/agent/turn/turn-state.d.ts +2 -0
- package/dist/agent/turn/turn-state.js +2 -1
- package/dist/agent/types.d.ts +3 -1
- package/dist/channel/attachments.d.ts +4 -0
- package/dist/channel/attachments.js +4 -0
- package/dist/channel/store.d.ts +1 -1
- package/dist/commands/catalog.js +25 -9
- package/dist/commands/router.js +5 -1
- package/dist/desk/commands.d.ts +14 -2
- package/dist/desk/commands.js +68 -20
- package/dist/desk/registry.d.ts +6 -2
- package/dist/desk/registry.js +70 -4
- package/dist/desk/types.d.ts +17 -0
- package/dist/dingtalk/bot.d.ts +1 -1
- package/dist/dingtalk/bot.js +4 -3
- package/dist/dingtalk/delivery.js +13 -8
- package/dist/dingtalk/inbound-media.d.ts +36 -14
- package/dist/dingtalk/inbound-media.js +71 -12
- package/dist/dingtalk/inbound.d.ts +9 -2
- package/dist/dingtalk/inbound.js +18 -2
- package/dist/dingtalk/media.d.ts +4 -10
- package/dist/dingtalk/media.js +58 -32
- package/dist/events/commands.d.ts +2 -0
- package/dist/events/commands.js +13 -8
- package/dist/events/history.d.ts +9 -0
- package/dist/events/history.js +66 -0
- package/dist/events/parse.js +7 -3
- package/dist/events/types.d.ts +3 -0
- package/dist/events/watcher.d.ts +3 -7
- package/dist/events/watcher.js +51 -56
- package/dist/jobs/kill.d.ts +23 -0
- package/dist/jobs/kill.js +65 -0
- package/dist/jobs/manager.d.ts +19 -18
- package/dist/jobs/manager.js +36 -103
- package/dist/memory/reflect.js +23 -3
- package/dist/memory/session-corpus.d.ts +1 -1
- package/dist/memory/session-corpus.js +70 -1
- package/dist/memory/session-search.js +13 -11
- package/dist/memory/store.d.ts +2 -0
- package/dist/memory/store.js +19 -9
- package/dist/playbooks/agent-delegation.md +5 -4
- package/dist/playbooks/memory-and-learning.md +1 -1
- package/dist/playbooks/task-lead.md +4 -4
- package/dist/runtime/bootstrap.d.ts +6 -0
- package/dist/runtime/bootstrap.js +11 -7
- package/dist/runtime/desk-runtime.d.ts +8 -2
- package/dist/runtime/desk-runtime.js +35 -4
- package/dist/runtime/durable-dispatch.d.ts +14 -2
- package/dist/runtime/durable-dispatch.js +207 -65
- package/dist/runtime/ingress-busy.js +17 -8
- package/dist/runtime/ingress-deps.d.ts +4 -1
- package/dist/runtime/ingress.js +6 -1
- package/dist/runtime/request-execution.js +7 -6
- package/dist/runtime/shutdown.d.ts +1 -0
- package/dist/runtime/shutdown.js +87 -35
- package/dist/runtime/task-control.d.ts +1 -0
- package/dist/runtime/task-control.js +25 -2
- package/dist/runtime/task-lane.d.ts +1 -0
- package/dist/runtime/task-lane.js +21 -6
- package/dist/runtime/task-step.js +11 -2
- package/dist/runtime/turn-run.js +103 -66
- package/dist/security/command-guard.d.ts +1 -1
- package/dist/security/command-guard.js +237 -314
- package/dist/security/path-guard.js +48 -7
- package/dist/security/shell-parse.d.ts +10 -0
- package/dist/security/shell-parse.js +224 -0
- package/dist/security/types.d.ts +2 -0
- package/dist/subagents/commands.d.ts +1 -1
- package/dist/subagents/detached-discovery.d.ts +1 -1
- package/dist/subagents/discovery.d.ts +18 -199
- package/dist/subagents/discovery.js +35 -289
- package/dist/subagents/dispatch.d.ts +1 -2
- package/dist/subagents/dispatch.js +39 -20
- package/dist/subagents/external/antigravity-cli.d.ts +2 -0
- package/dist/subagents/external/antigravity-cli.js +517 -0
- package/dist/subagents/external/claude-code.js +8 -17
- package/dist/subagents/external/codex-cli.js +8 -18
- package/dist/subagents/external/cursor-cli.js +34 -31
- package/dist/subagents/external/dispatch.d.ts +21 -7
- package/dist/subagents/external/dispatch.js +139 -11
- package/dist/subagents/external/exec.js +3 -0
- package/dist/subagents/external/harness.d.ts +57 -33
- package/dist/subagents/external/harness.js +69 -40
- package/dist/subagents/external/reconciliation.js +1 -0
- package/dist/subagents/external/registry.js +4 -1
- package/dist/subagents/external/role-warnings.d.ts +4 -13
- package/dist/subagents/external/role-warnings.js +4 -28
- package/dist/subagents/external/run.d.ts +1 -2
- package/dist/subagents/external/run.js +11 -11
- package/dist/subagents/external/settlement.d.ts +2 -0
- package/dist/subagents/external/settlement.js +8 -2
- package/dist/subagents/format.d.ts +1 -1
- package/dist/subagents/format.js +1 -1
- package/dist/subagents/internal/outcome.d.ts +1 -2
- package/dist/subagents/internal/provider-retry.d.ts +1 -2
- package/dist/subagents/internal/provider-retry.js +1 -1
- package/dist/subagents/internal/run.d.ts +1 -2
- package/dist/subagents/internal/state.d.ts +1 -2
- package/dist/subagents/internal/worker.d.ts +1 -2
- package/dist/subagents/internal/worker.js +3 -1
- package/dist/subagents/resolve.d.ts +56 -0
- package/dist/subagents/resolve.js +202 -0
- package/dist/subagents/result.d.ts +1 -2
- package/dist/subagents/result.js +7 -3
- package/dist/subagents/run-record.d.ts +33 -2
- package/dist/subagents/run-record.js +2 -0
- package/dist/subagents/runs.d.ts +2 -24
- package/dist/subagents/runs.js +6 -0
- package/dist/subagents/task-envelope.d.ts +1 -2
- package/dist/subagents/task-envelope.js +8 -4
- package/dist/subagents/types.d.ts +93 -4
- package/dist/subagents/types.js +16 -1
- package/dist/subagents/workspace-lease.d.ts +11 -21
- package/dist/subagents/workspace-lease.js +48 -21
- package/dist/subagents/worktree.d.ts +10 -0
- package/dist/subagents/worktree.js +77 -0
- package/dist/tasks/archive.js +4 -0
- package/dist/tasks/commands.d.ts +3 -0
- package/dist/tasks/commands.js +16 -2
- package/dist/tasks/control.d.ts +2 -0
- package/dist/tasks/delivery.d.ts +2 -0
- package/dist/tasks/delivery.js +141 -21
- package/dist/tasks/loop-log.d.ts +2 -0
- package/dist/tasks/loop-log.js +9 -0
- package/dist/tools/bash.js +2 -0
- package/dist/tools/contract/presentation.js +3 -4
- package/dist/tools/event-manage.d.ts +2 -0
- package/dist/tools/event-manage.js +20 -2
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/registry.js +3 -1
- package/dist/tools/send-media.js +9 -5
- package/dist/tools/session-search.js +1 -1
- package/dist/tools/subagent-manage.d.ts +1 -1
- package/dist/tools/subagent-manage.js +15 -149
- package/dist/tools/subagent.d.ts +2 -0
- package/dist/tools/subagent.js +6 -1
- package/dist/tools/task-manage/factory.js +2 -2
- package/dist/tools/task-manage/lifecycle.d.ts +3 -3
- package/dist/tools/task-manage/lifecycle.js +49 -9
- package/dist/tools/task-manage/schema.d.ts +4 -1
- package/dist/tools/task-manage/schema.js +4 -1
- package/dist/tools/task-manage/types.d.ts +4 -1
- package/dist/tui/cli.d.ts +1 -6
- package/dist/tui/cli.js +29 -3
- package/dist/tui/client.d.ts +2 -0
- package/dist/tui/client.js +13 -4
- package/dist/usage/ledger.d.ts +1 -1
- package/dist/usage/render.js +1 -1
- package/examples/sub-agents/README.md +39 -73
- package/examples/sub-agents/agents/agy-main.md +23 -0
- package/examples/sub-agents/agents/claude-high.md +9 -9
- package/examples/sub-agents/agents/claude-main.md +9 -9
- package/examples/sub-agents/agents/codex-flash.md +9 -9
- package/examples/sub-agents/agents/codex-high.md +9 -9
- package/examples/sub-agents/agents/codex-main.md +9 -9
- package/examples/sub-agents/agents/codex-review.md +9 -9
- package/examples/sub-agents/agents/cursor-high.md +9 -9
- package/examples/sub-agents/agents/cursor-main.md +9 -9
- package/examples/sub-agents/agents/glm-flash.md +9 -9
- package/examples/sub-agents/agents/glm-high.md +9 -9
- package/package.json +8 -8
- package/examples/sub-agents/agents/scout.md +0 -30
- package/examples/sub-agents/roles/builder-hard.md +0 -34
- package/examples/sub-agents/roles/builder.md +0 -34
- package/examples/sub-agents/roles/explorer.md +0 -39
- package/examples/sub-agents/roles/git-committer.md +0 -43
- package/examples/sub-agents/roles/planner.md +0 -33
- package/examples/sub-agents/roles/reviewer.md +0 -33
- package/examples/sub-agents/roles/verifier.md +0 -35
- package/examples/sub-agents/roles/worker.md +0 -34
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import {
|
|
2
|
+
import { join } from "node:path";
|
|
3
3
|
import { Type } from "typebox";
|
|
4
|
-
import { DEFAULT_SECURITY_CONFIG } from "../security/config.js";
|
|
5
4
|
import { RecoverableToolError } from "../shared/recoverable-error.js";
|
|
6
|
-
import {
|
|
5
|
+
import { dispatchExternalFollowUp } from "../subagents/external/dispatch.js";
|
|
7
6
|
import { readLastOutputAt, STALL_THRESHOLD_MS } from "../subagents/external/progress-tail.js";
|
|
8
|
-
import { launchExternalRun } from "../subagents/external/run.js";
|
|
9
7
|
import { formatCost, formatRunDuration, harnessLabel } from "../subagents/format.js";
|
|
10
|
-
import {
|
|
11
|
-
import { acquireWorkspaceLease, formatWorkspaceLeaseConflict, releaseWorkspaceLease, } from "../subagents/workspace-lease.js";
|
|
12
|
-
import { snapshotWorkspace } from "../subagents/workspace-summary.js";
|
|
8
|
+
import { validateSubAgentTask } from "../subagents/resolve.js";
|
|
13
9
|
// Spec 047, P3: `subagent_list` is zero-argument and shape-independent (like `task_list`); the
|
|
14
10
|
// other three ops all take `runId`, so they stay together in `subagent_run` rather than being
|
|
15
11
|
// split per-verb (`cancel` and `show` have identical parameter sets).
|
|
@@ -93,16 +89,6 @@ async function formatRunShow(record) {
|
|
|
93
89
|
}
|
|
94
90
|
return lines.join("\n");
|
|
95
91
|
}
|
|
96
|
-
/** Resumable harnesses only: `claude-code`/`codex-cli`/`cursor-cli`. `exec` has no session concept,
|
|
97
|
-
* and internal runs have no persisted transcript by design (spec 040, non-goals). */
|
|
98
|
-
function resumableHarnessOf(record) {
|
|
99
|
-
if (record.runtime !== "external")
|
|
100
|
-
return undefined;
|
|
101
|
-
if (record.harness === "codex-cli" || record.harness === "claude-code" || record.harness === "cursor-cli") {
|
|
102
|
-
return record.harness;
|
|
103
|
-
}
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
92
|
export function createSubAgentListTool(options) {
|
|
107
93
|
const manager = options.runManager;
|
|
108
94
|
return {
|
|
@@ -168,7 +154,7 @@ export function createSubAgentRunTool(options) {
|
|
|
168
154
|
details: { op, runId: resolvedRunId, status },
|
|
169
155
|
};
|
|
170
156
|
}
|
|
171
|
-
// follow_up
|
|
157
|
+
// follow_up: validate parameters in the adapter, then delegate domain orchestration.
|
|
172
158
|
if (!task || !task.trim()) {
|
|
173
159
|
throw new RecoverableToolError("follow_up requires task.");
|
|
174
160
|
}
|
|
@@ -176,137 +162,17 @@ export function createSubAgentRunTool(options) {
|
|
|
176
162
|
if (taskLengthError) {
|
|
177
163
|
throw new RecoverableToolError(taskLengthError);
|
|
178
164
|
}
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
if (!record.sessionId) {
|
|
192
|
-
throw new RecoverableToolError(`Run "${resolvedRunId}" never reported a session id (it likely failed before producing one); it cannot be resumed. Delegate a new run instead.`);
|
|
193
|
-
}
|
|
194
|
-
const discovery = options.getSubAgentDiscovery?.();
|
|
195
|
-
const role = discovery?.agents.find((agent) => agent.name === record.agent && agent.runtime === "external");
|
|
196
|
-
if (!role) {
|
|
197
|
-
throw new RecoverableToolError(`Role "${record.agent}" is no longer configured as an external role; cannot follow up run "${resolvedRunId}".`);
|
|
198
|
-
}
|
|
199
|
-
if (role.unavailable) {
|
|
200
|
-
throw new RecoverableToolError(`Role "${record.agent}" is currently unavailable: ${role.unavailable}`);
|
|
201
|
-
}
|
|
202
|
-
// P1-2: a role hot-edited between the original run and this follow-up must not silently
|
|
203
|
-
// resume under a stale harness (the wrong CLI would parse a command it never wrote), or
|
|
204
|
-
// masquerade a shell role as resumable (there is no flag to carry `resumeSessionId` into
|
|
205
|
-
// `/bin/sh -lc`, so the run would silently start a fresh, unrelated session anyway).
|
|
206
|
-
if (role.harness !== harness) {
|
|
207
|
-
throw new RecoverableToolError(`Role "${record.agent}" now uses harness "${role.harness}", but run "${resolvedRunId}" was started on "${harness}". Delegate a new run instead of resuming across a harness change.`);
|
|
208
|
-
}
|
|
209
|
-
if (role.shell) {
|
|
210
|
-
throw new RecoverableToolError(`Role "${record.agent}" runs its command through a shell, which has no way to carry a resume session id. Delegate a new run instead, carrying forward whatever context it needs.`);
|
|
211
|
-
}
|
|
212
|
-
// Verify admission is re-checked against the *current* role config, shared with the initial
|
|
213
|
-
// dispatch. A write-capable verify follow-up takes the same exclusive lease as any writer;
|
|
214
|
-
// `exec` remains barred because it has no verification protocol terminal.
|
|
215
|
-
assertVerifyAdmissible(role, record.purpose, record.workingDirectory);
|
|
216
|
-
// Spec 042 D7: a role hot-edited since the original dispatch (different command, model,
|
|
217
|
-
// or shell mode) would resume the old session under a harness invocation it never wrote.
|
|
218
|
-
// Only enforced when the original run actually recorded a fingerprint — an older record
|
|
219
|
-
// predating this field cannot be checked, so it is let through rather than made
|
|
220
|
-
// permanently unresumable.
|
|
221
|
-
const currentFingerprint = externalRoleFingerprint(role);
|
|
222
|
-
if (record.roleFingerprint !== undefined && record.roleFingerprint !== currentFingerprint) {
|
|
223
|
-
throw new RecoverableToolError(`Role "${record.agent}" has changed (command, model, or shell mode) since run "${resolvedRunId}" was dispatched; resuming under the new config could reinterpret the old session incorrectly. Delegate a new run instead.`);
|
|
224
|
-
}
|
|
225
|
-
// A short, human-typeable id (spec 041) — the follow-up gets a fresh identity, not the
|
|
226
|
-
// dispatching tool call's own id.
|
|
227
|
-
const newRunId = manager.mintRunId();
|
|
228
|
-
let leaseKey;
|
|
229
|
-
if (role.mutates === "write") {
|
|
230
|
-
const lease = acquireWorkspaceLease({
|
|
231
|
-
runId: newRunId,
|
|
232
|
-
channelId: options.channelId,
|
|
233
|
-
workingDirectory: record.workingDirectory,
|
|
234
|
-
});
|
|
235
|
-
if (!lease.ok) {
|
|
236
|
-
throw new RecoverableToolError(formatWorkspaceLeaseConflict(lease.heldBy));
|
|
237
|
-
}
|
|
238
|
-
leaseKey = lease.leaseKey;
|
|
239
|
-
}
|
|
240
|
-
// Spec 042 D7: the same `<subagent-artifacts>/<runId>` layout the initial dispatch uses,
|
|
241
|
-
// computed with a real path join rather than a regex substitution that assumed the old
|
|
242
|
-
// runId was the last path segment with no separators of its own.
|
|
243
|
-
const artifactDir = join(dirname(record.artifactDir), newRunId);
|
|
244
|
-
const runContext = {
|
|
245
|
-
runId: newRunId,
|
|
246
|
-
purpose: record.purpose,
|
|
247
|
-
taskId: record.taskId,
|
|
248
|
-
item: record.item,
|
|
249
|
-
workingDirectory: record.workingDirectory,
|
|
250
|
-
artifactDir,
|
|
251
|
-
};
|
|
252
|
-
// The resumed session already holds the first dispatch's full envelope; the follow-up
|
|
253
|
-
// envelope carries only what is new (its own artifact directory, the instruction, and the
|
|
254
|
-
// checker protocol again for a verify run) — see `buildFollowUpTask`.
|
|
255
|
-
let launchResult;
|
|
256
|
-
try {
|
|
257
|
-
const envelopedTask = buildFollowUpTask(task, {
|
|
258
|
-
workspaceDir: options.workspaceDir,
|
|
259
|
-
desk: options.desk,
|
|
260
|
-
deskDir: options.deskDir,
|
|
261
|
-
channelId: options.channelId,
|
|
262
|
-
}, runContext);
|
|
263
|
-
const workspaceBaseline = role.mutates === "write" ? await snapshotWorkspace(record.workingDirectory) : undefined;
|
|
264
|
-
launchResult = await launchExternalRun({
|
|
265
|
-
runManager: manager,
|
|
266
|
-
runId: newRunId,
|
|
267
|
-
channelId: options.channelId,
|
|
268
|
-
deskDir: options.deskDir,
|
|
269
|
-
label: `follow-up: ${task.slice(0, 80)}`,
|
|
270
|
-
agent: role.name,
|
|
271
|
-
source: role.source,
|
|
272
|
-
harness,
|
|
273
|
-
command: role.command ?? "",
|
|
274
|
-
shell: role.shell,
|
|
275
|
-
env: role.env,
|
|
276
|
-
externalModelRef: role.externalModelRef,
|
|
277
|
-
thinkingLevel: role.thinkingLevel,
|
|
278
|
-
maxWallTimeSec: role.maxWallTimeSec,
|
|
279
|
-
systemPrompt: role.systemPrompt,
|
|
280
|
-
task: envelopedTask,
|
|
281
|
-
workingDirectory: record.workingDirectory,
|
|
282
|
-
artifactDir,
|
|
283
|
-
purpose: record.purpose,
|
|
284
|
-
taskId: record.taskId,
|
|
285
|
-
item: record.item,
|
|
286
|
-
leaseKey,
|
|
287
|
-
resumeSessionId: record.sessionId,
|
|
288
|
-
mutates: role.mutates,
|
|
289
|
-
workspaceBaseline,
|
|
290
|
-
roleFingerprint: currentFingerprint,
|
|
291
|
-
workspaceDir: options.workspaceDir,
|
|
292
|
-
securityConfig: options.securityConfig ?? DEFAULT_SECURITY_CONFIG,
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
catch (error) {
|
|
296
|
-
// Until launchExternalRun has durably registered the run, no settlement authority owns
|
|
297
|
-
// this lease. Releasing here mirrors the initial subagent dispatch path and covers prompt,
|
|
298
|
-
// artifact, audit, invocation, and pre-spawn failures in follow_up.
|
|
299
|
-
releaseWorkspaceLease(leaseKey, newRunId);
|
|
300
|
-
throw error;
|
|
301
|
-
}
|
|
302
|
-
// Spec 042 D2: a pre-spawn failure is reported in this same turn — settle() already
|
|
303
|
-
// released the lease, so there is nothing left to clean up here.
|
|
304
|
-
if (!launchResult.ok) {
|
|
305
|
-
if (launchResult.kind === "missing-binary") {
|
|
306
|
-
throw new Error(`Follow-up on run "${resolvedRunId}" failed to launch: ${launchResult.reason} Install the CLI or fix "command" in its role file; the follow-up was not dispatched.`);
|
|
307
|
-
}
|
|
308
|
-
throw new RecoverableToolError(`Follow-up on run "${resolvedRunId}" failed to launch: ${launchResult.reason} The follow-up was not dispatched.`);
|
|
309
|
-
}
|
|
165
|
+
const { newRunId } = await dispatchExternalFollowUp({
|
|
166
|
+
runManager: manager,
|
|
167
|
+
record: resolution.record,
|
|
168
|
+
task,
|
|
169
|
+
channelId: options.channelId,
|
|
170
|
+
workspaceDir: options.workspaceDir,
|
|
171
|
+
desk: options.desk,
|
|
172
|
+
deskDir: options.deskDir,
|
|
173
|
+
discovery: options.getSubAgentDiscovery?.(),
|
|
174
|
+
securityConfig: options.securityConfig,
|
|
175
|
+
});
|
|
310
176
|
return {
|
|
311
177
|
content: [
|
|
312
178
|
{
|
package/dist/tools/subagent.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare const subagentSchema: Type.TObject<{
|
|
|
15
15
|
agent: Type.TString;
|
|
16
16
|
task: Type.TString;
|
|
17
17
|
workingDirectory: Type.TOptional<Type.TString>;
|
|
18
|
+
worktree: Type.TOptional<Type.TBoolean>;
|
|
18
19
|
purpose: Type.TOptional<Type.TUnion<[Type.TLiteral<"work">, Type.TLiteral<"verify">]>>;
|
|
19
20
|
item: Type.TOptional<Type.TString>;
|
|
20
21
|
}>;
|
|
@@ -32,6 +33,7 @@ declare const subagentInlineSchema: Type.TObject<{
|
|
|
32
33
|
thinkingLevel: Type.TOptional<Type.TUnion<[Type.TLiteral<"off">, Type.TLiteral<"minimal">, Type.TLiteral<"low">, Type.TLiteral<"medium">, Type.TLiteral<"high">, Type.TLiteral<"xhigh">, Type.TLiteral<"max">]>>;
|
|
33
34
|
mutates: Type.TOptional<Type.TUnion<[Type.TLiteral<"read">, Type.TLiteral<"write">]>>;
|
|
34
35
|
workingDirectory: Type.TOptional<Type.TString>;
|
|
36
|
+
worktree: Type.TOptional<Type.TBoolean>;
|
|
35
37
|
purpose: Type.TOptional<Type.TUnion<[Type.TLiteral<"work">, Type.TLiteral<"verify">]>>;
|
|
36
38
|
item: Type.TOptional<Type.TString>;
|
|
37
39
|
}>;
|
package/dist/tools/subagent.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { RecoverableToolError } from "../shared/recoverable-error.js";
|
|
3
|
-
import { formatSubAgentList, resolveConfiguredRole, resolveInlineAgent, validateSubAgentTask, } from "../subagents/discovery.js";
|
|
4
3
|
import { dispatchSubAgentRun } from "../subagents/dispatch.js";
|
|
4
|
+
import { formatSubAgentList, resolveConfiguredRole, resolveInlineAgent, validateSubAgentTask, } from "../subagents/resolve.js";
|
|
5
5
|
/** Shared by both invocation surfaces (spec 046, D2.1). */
|
|
6
6
|
const workingDirectoryField = Type.Optional(Type.String({
|
|
7
7
|
description: "Optional existing directory to run the sub-agent in (its shell cwd and relative-path root). Use it to work on another checkout — e.g. a `git worktree add`ed one. Defaults to this runtime's own working directory.",
|
|
8
8
|
}));
|
|
9
|
+
const worktreeField = Type.Optional(Type.Boolean({
|
|
10
|
+
description: "Optional: set true on a write delegation inside a Git repository to run it in a fresh detached Git worktree under its artifact directory, avoiding workspace lease conflicts with concurrent runs. Clean unchanged worktrees are removed automatically when the run settles.",
|
|
11
|
+
}));
|
|
9
12
|
const purposeField = Type.Optional(Type.Union([Type.Literal("work"), Type.Literal("verify")], {
|
|
10
13
|
description: 'Use "verify" for an independent check: the sub-agent is given the checker protocol and ends with VERDICT: PASS|FAIL. The verdict is information for you to weigh, not a gate.',
|
|
11
14
|
}));
|
|
@@ -21,6 +24,7 @@ const subagentSchema = Type.Object({
|
|
|
21
24
|
agent: Type.String({ description: "Name of a configured sub-agent from workspaceDir/sub-agents/" }),
|
|
22
25
|
task: Type.String({ description: "Complete task description for the sub-agent" }),
|
|
23
26
|
workingDirectory: workingDirectoryField,
|
|
27
|
+
worktree: worktreeField,
|
|
24
28
|
purpose: purposeField,
|
|
25
29
|
item: itemField,
|
|
26
30
|
});
|
|
@@ -55,6 +59,7 @@ const subagentInlineSchema = Type.Object({
|
|
|
55
59
|
"files (including through bash) so it takes the exclusive workspace write lease.",
|
|
56
60
|
})),
|
|
57
61
|
workingDirectory: workingDirectoryField,
|
|
62
|
+
worktree: worktreeField,
|
|
58
63
|
purpose: purposeField,
|
|
59
64
|
item: itemField,
|
|
60
65
|
});
|
|
@@ -20,9 +20,9 @@ export function createTaskListTool(options) {
|
|
|
20
20
|
return {
|
|
21
21
|
name: "task_list",
|
|
22
22
|
label: "task_list",
|
|
23
|
-
description: "List this desk's active tasks, including those created from other channels (each reports to its own `channel`; `deliversHere` marks the ones that report to this chat). Shows each task's state, what a waiting one waits for, the step in progress and the delegations in flight — the live status to answer a progress question from.",
|
|
23
|
+
description: "List this desk's active tasks (or include closed/archived ones with `includeArchived: true` and optional `query`), including those created from other channels (each reports to its own `channel`; `deliversHere` marks the ones that report to this chat). Shows each task's state, what a waiting one waits for, the step in progress and the delegations in flight — the live status to answer a progress question from.",
|
|
24
24
|
parameters: taskListSchema,
|
|
25
|
-
execute: async () => asResult(await listTasks(options)),
|
|
25
|
+
execute: async (_toolCallId, args) => asResult(await listTasks(options, args)),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
export function createTaskCreateTool(options) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { TaskCloseRequest, TaskManageResult, TaskManageToolOptions } from "./types.js";
|
|
1
|
+
import type { TaskCloseRequest, TaskListRequest, TaskManageResult, TaskManageToolOptions } from "./types.js";
|
|
2
2
|
export declare function requireTask(options: TaskManageToolOptions, id: string): Promise<import("../../tasks/store.js").StoredTaskDocument>;
|
|
3
|
-
/** `task_list`:
|
|
4
|
-
export declare function listTasks(options: TaskManageToolOptions): Promise<TaskManageResult>;
|
|
3
|
+
/** `task_list`: active tasks of the desk (plus archived tasks when requested), optionally filtered by keyword. */
|
|
4
|
+
export declare function listTasks(options: TaskManageToolOptions, request?: TaskListRequest): Promise<TaskManageResult>;
|
|
5
5
|
/**
|
|
6
6
|
* `task_close` from a chat: `complete` archives a task nothing is working on, `cancel` stops the
|
|
7
7
|
* running step and everything bound to it through the lane (spec 064, D23).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { mkdir } from "node:fs/promises";
|
|
1
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
2
3
|
import { finalTaskReport } from "../../tasks/completion.js";
|
|
3
4
|
import { extractTaskTitle, normalizeTaskId, readActiveTasks } from "../../tasks/contract.js";
|
|
4
5
|
import { readTaskLog } from "../../tasks/loop-log.js";
|
|
@@ -42,19 +43,31 @@ function describeInFlight(live, now) {
|
|
|
42
43
|
return `${work.ref} (${work.label}) running ${running}m${quiet}${work.stalled ? " — looks stalled" : ""}`;
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
/** `task_list`:
|
|
46
|
-
export async function listTasks(options) {
|
|
46
|
+
/** `task_list`: active tasks of the desk (plus archived tasks when requested), optionally filtered by keyword. */
|
|
47
|
+
export async function listTasks(options, request = {}) {
|
|
47
48
|
const dir = tasksDir(options);
|
|
48
49
|
await mkdir(dir, { recursive: true });
|
|
49
|
-
const
|
|
50
|
+
const needle = request.query?.trim().toLowerCase();
|
|
51
|
+
const matchesQuery = async (entry, mdPath) => {
|
|
52
|
+
if (!needle)
|
|
53
|
+
return true;
|
|
54
|
+
if (entry.id.toLowerCase().includes(needle) || entry.title.toLowerCase().includes(needle))
|
|
55
|
+
return true;
|
|
56
|
+
const content = await readFile(mdPath, "utf-8").catch(() => "");
|
|
57
|
+
return content.toLowerCase().includes(needle);
|
|
58
|
+
};
|
|
59
|
+
const activeEntries = (await readActiveTasks(dir)).filter((entry) => !entry.fields.outcome);
|
|
50
60
|
const snapshots = new Map(((await options.control?.snapshot(options.desk).catch(() => [])) ?? []).map((snapshot) => [
|
|
51
61
|
snapshot.id,
|
|
52
62
|
snapshot,
|
|
53
63
|
]));
|
|
54
64
|
const now = Date.now();
|
|
55
|
-
const tasks =
|
|
65
|
+
const tasks = [];
|
|
66
|
+
for (const entry of activeEntries) {
|
|
67
|
+
if (!(await matchesQuery(entry, join(dir, `${entry.id}.md`))))
|
|
68
|
+
continue;
|
|
56
69
|
const live = snapshots.get(entry.id);
|
|
57
|
-
|
|
70
|
+
tasks.push({
|
|
58
71
|
id: entry.id,
|
|
59
72
|
title: entry.title,
|
|
60
73
|
state: entry.readable ? (live?.closing ? "closing" : entry.fields.state) : "unreadable",
|
|
@@ -68,12 +81,39 @@ export async function listTasks(options) {
|
|
|
68
81
|
items: entry.items ? `${entry.items.done}/${entry.items.total}` : undefined,
|
|
69
82
|
activity: describeActivity(live, now),
|
|
70
83
|
inFlight: describeInFlight(live, now),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (request.includeArchived) {
|
|
87
|
+
const archiveDir = join(dir, "archive");
|
|
88
|
+
const archivedEntries = (await readActiveTasks(archiveDir)).sort((a, b) => (b.fields.closedAt ?? "").localeCompare(a.fields.closedAt ?? ""));
|
|
89
|
+
for (const entry of archivedEntries.slice(0, 50)) {
|
|
90
|
+
if (!(await matchesQuery(entry, join(archiveDir, `${entry.id}.md`))))
|
|
91
|
+
continue;
|
|
92
|
+
tasks.push({
|
|
93
|
+
id: entry.id,
|
|
94
|
+
title: entry.title,
|
|
95
|
+
state: entry.fields.outcome ?? "archived",
|
|
96
|
+
archived: true,
|
|
97
|
+
closedAt: entry.fields.closedAt,
|
|
98
|
+
channel: entry.fields.channel,
|
|
99
|
+
deliversHere: entry.fields.channel === options.channelId,
|
|
100
|
+
steps: entry.fields.usage?.steps,
|
|
101
|
+
usd: entry.fields.usage ? Number(entry.fields.usage.usd.toFixed(2)) : undefined,
|
|
102
|
+
unknownCostCount: entry.fields.usage?.unknownCostCount ?? 0,
|
|
103
|
+
items: entry.items ? `${entry.items.done}/${entry.items.total}` : undefined,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
73
107
|
return {
|
|
74
108
|
action: "list",
|
|
75
109
|
tasks,
|
|
76
|
-
notice: tasks.length === 0
|
|
110
|
+
notice: tasks.length === 0
|
|
111
|
+
? request.includeArchived || needle
|
|
112
|
+
? "未找到匹配的任务。"
|
|
113
|
+
: "暂无进行中的任务。"
|
|
114
|
+
: request.includeArchived
|
|
115
|
+
? `共 ${tasks.length} 个匹配任务(含已归档任务)。`
|
|
116
|
+
: `共 ${tasks.length} 个进行中的任务。`,
|
|
77
117
|
};
|
|
78
118
|
}
|
|
79
119
|
/**
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
-
export declare const taskListSchema: Type.TObject<{
|
|
2
|
+
export declare const taskListSchema: Type.TObject<{
|
|
3
|
+
includeArchived: Type.TOptional<Type.TBoolean>;
|
|
4
|
+
query: Type.TOptional<Type.TString>;
|
|
5
|
+
}>;
|
|
3
6
|
export declare const taskCreateSchema: Type.TObject<{
|
|
4
7
|
id: Type.TString;
|
|
5
8
|
title: Type.TString;
|
|
@@ -4,7 +4,10 @@ const budgetField = Type.Optional(Type.Object({
|
|
|
4
4
|
steps: Type.Optional(Type.Integer({ minimum: 1, description: "Max model steps for the whole task." })),
|
|
5
5
|
usd: Type.Optional(Type.Number({ description: "Max attributable cost for the whole task, including bound delegations." })),
|
|
6
6
|
}, { description: "Per-task budget; omitted keys fall back to the runtime defaults." }));
|
|
7
|
-
export const taskListSchema = Type.Object({
|
|
7
|
+
export const taskListSchema = Type.Object({
|
|
8
|
+
includeArchived: Type.Optional(Type.Boolean({ description: "Also include closed/archived tasks from tasks/archive/." })),
|
|
9
|
+
query: Type.Optional(Type.String({ description: "Filter tasks by keyword across id, title, and contract/archive summary." })),
|
|
10
|
+
});
|
|
8
11
|
export const taskCreateSchema = Type.Object({
|
|
9
12
|
id: idField,
|
|
10
13
|
title: Type.String({ description: "Task title (H1 heading)." }),
|
|
@@ -2,7 +2,7 @@ import type { Static } from "typebox";
|
|
|
2
2
|
import type { DeskJobManager } from "../../jobs/manager.js";
|
|
3
3
|
import type { SubAgentRunManager } from "../../subagents/runs.js";
|
|
4
4
|
import type { TaskControl, TaskSessionContext } from "../../tasks/control.js";
|
|
5
|
-
import type { taskAskSchema, taskCloseSchema, taskCreateSchema, taskLogSchema, taskMessageSchema, taskPauseSchema, taskReportSchema, taskResumeSchema, taskWaitSchema } from "./schema.js";
|
|
5
|
+
import type { taskAskSchema, taskCloseSchema, taskCreateSchema, taskListSchema, taskLogSchema, taskMessageSchema, taskPauseSchema, taskReportSchema, taskResumeSchema, taskWaitSchema } from "./schema.js";
|
|
6
6
|
export interface TaskManageResult {
|
|
7
7
|
action: "create" | "close" | "list" | "log" | "message" | "pause" | "resume" | "report" | "ask" | "wait";
|
|
8
8
|
id?: string;
|
|
@@ -26,6 +26,8 @@ export interface TaskManageResult {
|
|
|
26
26
|
/** The step in progress and what the model is doing in it. */
|
|
27
27
|
activity?: string;
|
|
28
28
|
inFlight?: string[];
|
|
29
|
+
archived?: boolean;
|
|
30
|
+
closedAt?: string;
|
|
29
31
|
}>;
|
|
30
32
|
/** Rendered log lines, for `task_log`. */
|
|
31
33
|
entries?: string[];
|
|
@@ -37,6 +39,7 @@ export interface TaskManageResult {
|
|
|
37
39
|
* One request type per schema the model actually sees (spec 046, D3.3): each tool's required
|
|
38
40
|
* fields are non-optional in the type rather than documented as "required for X" in shared prose.
|
|
39
41
|
*/
|
|
42
|
+
export type TaskListRequest = Static<typeof taskListSchema>;
|
|
40
43
|
export type TaskCreateRequest = Static<typeof taskCreateSchema>;
|
|
41
44
|
export type TaskCloseRequest = Static<typeof taskCloseSchema>;
|
|
42
45
|
export type TaskLogRequest = Static<typeof taskLogSchema>;
|
package/dist/tui/cli.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `pipiclaw tui` CLI: argument parsing and entry. Parsing is a pure function (`parseTuiArgs`) so
|
|
3
|
-
* it can be unit-tested. The terminal is a client of the Web API (spec 061, D25): it connects to
|
|
4
|
-
* the daemon's socket, or — when no daemon is running — to a runtime it starts inside this
|
|
5
|
-
* process (D26, `startEmbeddedRuntime`, supplied by the entry so `tui/` never imports `runtime/`).
|
|
6
|
-
*/
|
|
7
1
|
import { type BootstrapIO, type BootstrapPaths } from "../app/home.js";
|
|
8
2
|
export type ParsedTui = {
|
|
9
3
|
kind: "run";
|
|
10
4
|
desk?: string;
|
|
5
|
+
cwd?: string;
|
|
11
6
|
create: boolean;
|
|
12
7
|
fresh: boolean;
|
|
13
8
|
print: boolean;
|
package/dist/tui/cli.js
CHANGED
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
* the daemon's socket, or — when no daemon is running — to a runtime it starts inside this
|
|
5
5
|
* process (D26, `startEmbeddedRuntime`, supplied by the entry so `tui/` never imports `runtime/`).
|
|
6
6
|
*/
|
|
7
|
+
import { resolve } from "node:path";
|
|
7
8
|
import { BootstrapExitError, DEFAULT_BOOTSTRAP_PATHS, readCliVersion, } from "../app/home.js";
|
|
8
9
|
import { PipiclawSettingsManager } from "../config/settings.js";
|
|
10
|
+
import { DEFAULT_DESK, normalizeDeskName } from "../desk/paths.js";
|
|
11
|
+
import { resolveDeskCwdSync } from "../desk/registry.js";
|
|
9
12
|
import * as log from "../log.js";
|
|
10
13
|
import { errorMessage } from "../shared/text-utils.js";
|
|
11
14
|
import { createLink, createSocketClient, openConversation, printOnce, requireSocket } from "./client.js";
|
|
@@ -16,6 +19,7 @@ import { TuiSession } from "./session.js";
|
|
|
16
19
|
/** Parse `pipiclaw tui` arguments (everything after the `tui` subcommand). */
|
|
17
20
|
export function parseTuiArgs(args) {
|
|
18
21
|
let desk;
|
|
22
|
+
let cwd;
|
|
19
23
|
let create = false;
|
|
20
24
|
let fresh = false;
|
|
21
25
|
let print = false;
|
|
@@ -33,6 +37,15 @@ export function parseTuiArgs(args) {
|
|
|
33
37
|
else if (arg.startsWith("--desk=")) {
|
|
34
38
|
desk = arg.slice("--desk=".length);
|
|
35
39
|
}
|
|
40
|
+
else if (arg === "--cwd") {
|
|
41
|
+
cwd = args[index + 1];
|
|
42
|
+
if (!cwd || cwd.startsWith("-"))
|
|
43
|
+
return { kind: "error", message: "--cwd needs a directory path." };
|
|
44
|
+
index += 1;
|
|
45
|
+
}
|
|
46
|
+
else if (arg.startsWith("--cwd=")) {
|
|
47
|
+
cwd = arg.slice("--cwd=".length);
|
|
48
|
+
}
|
|
36
49
|
else if (arg === "--create") {
|
|
37
50
|
create = true;
|
|
38
51
|
}
|
|
@@ -63,7 +76,17 @@ export function parseTuiArgs(args) {
|
|
|
63
76
|
positional.push(arg);
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
|
-
return {
|
|
79
|
+
return {
|
|
80
|
+
kind: "run",
|
|
81
|
+
desk,
|
|
82
|
+
...(cwd !== undefined ? { cwd } : {}),
|
|
83
|
+
create,
|
|
84
|
+
fresh,
|
|
85
|
+
print,
|
|
86
|
+
quiet,
|
|
87
|
+
plain,
|
|
88
|
+
positional,
|
|
89
|
+
};
|
|
67
90
|
}
|
|
68
91
|
function printTuiHelp(io) {
|
|
69
92
|
io.log("Usage: pipiclaw tui [options] [prompt]");
|
|
@@ -78,6 +101,7 @@ function printTuiHelp(io) {
|
|
|
78
101
|
io.log("");
|
|
79
102
|
io.log("Options:");
|
|
80
103
|
io.log(" --desk <name> Open a desk (default: default)");
|
|
104
|
+
io.log(" --cwd <dir> Set the desk's working directory (repo path)");
|
|
81
105
|
io.log(" --create Create the desk first (like `/desk new`)");
|
|
82
106
|
io.log(" --new Start a new conversation instead of resuming");
|
|
83
107
|
io.log(" --print, -p One-shot: run [prompt] (or stdin), print the answer, exit");
|
|
@@ -138,7 +162,8 @@ export async function runTui(argv, hooks, io = console, paths = DEFAULT_BOOTSTRA
|
|
|
138
162
|
}
|
|
139
163
|
async function runClient(parsed, initialPrompt, paths, io) {
|
|
140
164
|
const client = createSocketClient(paths);
|
|
141
|
-
const
|
|
165
|
+
const resolvedCwdArg = parsed.cwd ? resolve(parsed.cwd) : undefined;
|
|
166
|
+
const { id, replies } = await openConversation(client, paths, { desk: parsed.desk, cwd: resolvedCwdArg, create: parsed.create, fresh: parsed.fresh }, io);
|
|
142
167
|
if (parsed.print) {
|
|
143
168
|
const frontend = createFrontend({ plain: true, quiet: parsed.quiet, interactive: false });
|
|
144
169
|
for (const reply of replies)
|
|
@@ -148,12 +173,13 @@ async function runClient(parsed, initialPrompt, paths, io) {
|
|
|
148
173
|
frontend.stop();
|
|
149
174
|
return;
|
|
150
175
|
}
|
|
176
|
+
const deskName = normalizeDeskName(parsed.desk ?? DEFAULT_DESK);
|
|
151
177
|
const frontend = createFrontend({
|
|
152
178
|
plain: parsed.plain,
|
|
153
179
|
quiet: parsed.quiet,
|
|
154
180
|
interactive: true,
|
|
155
181
|
commands: TUI_SLASH_COMMANDS,
|
|
156
|
-
basePath: paths.workspaceDir,
|
|
182
|
+
basePath: resolveDeskCwdSync(paths.workspaceDir, deskName),
|
|
157
183
|
});
|
|
158
184
|
const traits = traitsOf(new PipiclawSettingsManager(paths.appHomeDir).getTuiSettings().responseMode);
|
|
159
185
|
const session = new TuiSession({
|
package/dist/tui/client.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import type { SessionLink } from "./session.js";
|
|
|
4
4
|
export interface OpenOptions {
|
|
5
5
|
/** The desk to work in; defaults to `default`. */
|
|
6
6
|
desk?: string;
|
|
7
|
+
/** Optional repository / working directory to configure on the desk (`--cwd`). */
|
|
8
|
+
cwd?: string;
|
|
7
9
|
/** Create the desk first — an explicit creation, like `/desk new`. */
|
|
8
10
|
create: boolean;
|
|
9
11
|
/** Start a new conversation instead of resuming the desk's last one. */
|
package/dist/tui/client.js
CHANGED
|
@@ -132,21 +132,30 @@ export async function openConversation(client, paths, options, io) {
|
|
|
132
132
|
const exists = await client.conversations.retrieve(id).then(() => true, (error) => (error.status === 404 ? false : Promise.reject(error)));
|
|
133
133
|
// A conversation rebound to another desk since is not this desk's any more.
|
|
134
134
|
const bound = exists ? await boundDesk(paths, id) : undefined;
|
|
135
|
-
if (exists && (bound === desk || (bound === undefined && desk === DEFAULT_DESK)))
|
|
136
|
-
|
|
135
|
+
if (exists && (bound === desk || (bound === undefined && desk === DEFAULT_DESK))) {
|
|
136
|
+
const replies = options.cwd ? [await ask(client, id, `/desk cwd ${options.cwd}`)] : [];
|
|
137
|
+
return { id, replies };
|
|
138
|
+
}
|
|
137
139
|
}
|
|
138
140
|
const id = (await client.conversations.create({})).id;
|
|
139
141
|
const replies = [];
|
|
140
142
|
// A conversation starts on the default desk by itself; any other desk is an explicit request.
|
|
141
143
|
if (desk !== DEFAULT_DESK || options.create) {
|
|
142
|
-
if (options.create)
|
|
143
|
-
replies.push(await ask(client, id, `/desk new ${desk}`));
|
|
144
|
+
if (options.create) {
|
|
145
|
+
replies.push(await ask(client, id, options.cwd ? `/desk new ${desk} ${options.cwd}` : `/desk new ${desk}`));
|
|
146
|
+
}
|
|
144
147
|
replies.push(await ask(client, id, `/desk bind ${desk}`));
|
|
145
148
|
if ((await boundDesk(paths, id)) !== desk) {
|
|
146
149
|
for (const reply of replies)
|
|
147
150
|
io.error(reply);
|
|
148
151
|
fail(`Could not open desk "${desk}".`);
|
|
149
152
|
}
|
|
153
|
+
if (options.cwd && !options.create) {
|
|
154
|
+
replies.push(await ask(client, id, `/desk cwd ${options.cwd}`));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else if (options.cwd) {
|
|
158
|
+
replies.push(await ask(client, id, `/desk cwd ${options.cwd}`));
|
|
150
159
|
}
|
|
151
160
|
await writeState(paths, { ...state, [desk]: id });
|
|
152
161
|
return { id, replies };
|
package/dist/usage/ledger.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface UsageLedgerEntry {
|
|
|
32
32
|
cost: UsageCost;
|
|
33
33
|
/** False when the harness cannot report tokens at all (external `cursor-cli`/`exec`). Display as "unknown", not 0. */
|
|
34
34
|
usageKnown?: boolean;
|
|
35
|
-
/** False when the harness omits a cost field (external `cursor-cli`/`codex-cli`/`exec`). Display as "unknown", not 0. */
|
|
35
|
+
/** False when the harness omits a cost field (external `cursor-cli`/`codex-cli`/`antigravity-cli`/`exec`). Display as "unknown", not 0. */
|
|
36
36
|
costKnown?: boolean;
|
|
37
37
|
}
|
|
38
38
|
export interface UsageSummary {
|
package/dist/usage/render.js
CHANGED
|
@@ -50,7 +50,7 @@ function renderKindBreakdown(summary) {
|
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Some harnesses cannot report tokens or cost at all (`cursor-cli` and `exec` report neither;
|
|
53
|
-
* `codex-cli`
|
|
53
|
+
* `codex-cli` and `antigravity-cli` report no cost). Those runs are never dropped from the ledger (spec 040, T7) but their totals are
|
|
54
54
|
* always 0 by construction, so the aggregate total must say so explicitly — otherwise "$0.0000"
|
|
55
55
|
* reads as "these runs cost nothing" instead of "cost unknown for some of these runs".
|
|
56
56
|
*/
|