@namzu/cli 6.0.2 → 8.0.0
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/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +27 -3
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/drain.d.ts +59 -0
- package/dist/commands/drain.d.ts.map +1 -0
- package/dist/commands/drain.js +301 -0
- package/dist/commands/drain.js.map +1 -0
- package/dist/commands/run-stream.d.ts +37 -9
- package/dist/commands/run-stream.d.ts.map +1 -1
- package/dist/commands/run-stream.js +149 -21
- package/dist/commands/run-stream.js.map +1 -1
- package/dist/doctor/checks/chain.d.ts.map +1 -1
- package/dist/doctor/checks/chain.js +11 -1
- package/dist/doctor/checks/chain.js.map +1 -1
- package/dist/doctor/checks/providers.d.ts +6 -1
- package/dist/doctor/checks/providers.d.ts.map +1 -1
- package/dist/doctor/checks/providers.js +7 -2
- package/dist/doctor/checks/providers.js.map +1 -1
- package/dist/doctor/checks/telemetry.d.ts +35 -1
- package/dist/doctor/checks/telemetry.d.ts.map +1 -1
- package/dist/doctor/checks/telemetry.js +64 -13
- package/dist/doctor/checks/telemetry.js.map +1 -1
- package/dist/doctor/checks/vault.d.ts +10 -1
- package/dist/doctor/checks/vault.d.ts.map +1 -1
- package/dist/doctor/checks/vault.js +11 -2
- package/dist/doctor/checks/vault.js.map +1 -1
- package/dist/doctor/registry.js +25 -1
- package/dist/doctor/registry.js.map +1 -1
- package/dist/exit-codes.d.ts +18 -1
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +17 -0
- package/dist/exit-codes.js.map +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +224 -50
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/PermissionOverlay.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.js +1 -1
- package/dist/tui/PermissionOverlay.js.map +1 -1
- package/dist/tui/agent.d.ts +57 -1
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +72 -3
- package/dist/tui/agent.js.map +1 -1
- package/dist/user-commands/store.d.ts +14 -1
- package/dist/user-commands/store.d.ts.map +1 -1
- package/dist/user-commands/store.js +6 -1
- package/dist/user-commands/store.js.map +1 -1
- package/package.json +5 -4
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgDH,MAAM,WAAW,aAAa;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAyGjE"}
|
package/dist/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ import { dirname, join } from 'node:path';
|
|
|
11
11
|
import { fileURLToPath } from 'node:url';
|
|
12
12
|
import { Command, CommanderError } from 'commander';
|
|
13
13
|
import { doctorCommand } from './commands/doctor.js';
|
|
14
|
+
import { drainCommand } from './commands/drain.js';
|
|
14
15
|
import { evalCommand } from './commands/eval.js';
|
|
15
16
|
import { registerAll } from './commands/registry.js';
|
|
16
17
|
import { historyCommand, providersJSONCommand, runStreamCommand, skillsJSONCommand, } from './commands/run-stream.js';
|
|
@@ -75,6 +76,7 @@ export async function runCli(opts) {
|
|
|
75
76
|
registerAll(program, [
|
|
76
77
|
doctorCommand,
|
|
77
78
|
runCommand,
|
|
79
|
+
drainCommand,
|
|
78
80
|
evalCommand,
|
|
79
81
|
runStreamCommand,
|
|
80
82
|
historyCommand,
|
package/dist/cli.js.map
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ourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAiO5C,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC/E;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAK3B,CAAA"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -26,10 +26,18 @@ Options:
|
|
|
26
26
|
-h, --help Show this help
|
|
27
27
|
|
|
28
28
|
Exit codes:
|
|
29
|
-
0
|
|
29
|
+
0 every check answered, and none of them failed
|
|
30
30
|
1 one or more checks reported \`fail\`
|
|
31
31
|
2 no checks registered (Namzu not configured here)
|
|
32
|
+
69 a check could not answer — it timed out, was aborted, or what it
|
|
33
|
+
reads threw. Separate from 0 because a report that did not manage
|
|
34
|
+
to look tells you nothing about the part it did look at, and
|
|
35
|
+
separate from 1 because nothing was established to have failed.
|
|
32
36
|
70 internal CLI error (sysexits EX_SOFTWARE)
|
|
37
|
+
|
|
38
|
+
A \`skipped\` check does not affect the exit code: it means there was
|
|
39
|
+
nothing here to check — an optional package absent, nothing configured
|
|
40
|
+
yet — which is an ordinary state of a healthy machine.
|
|
33
41
|
`;
|
|
34
42
|
function parseArgs(args) {
|
|
35
43
|
let json = false;
|
|
@@ -133,9 +141,15 @@ function statusGlyph(status) {
|
|
|
133
141
|
case 'fail':
|
|
134
142
|
return '✗';
|
|
135
143
|
case 'inconclusive':
|
|
136
|
-
return '
|
|
144
|
+
return '?';
|
|
137
145
|
case 'warn':
|
|
138
146
|
return '!';
|
|
147
|
+
// The glyph `inconclusive` used to carry. It reads as "not applicable",
|
|
148
|
+
// which is what this status means and what that status never did — so
|
|
149
|
+
// the mark moves to the row it was describing all along, and the check
|
|
150
|
+
// that could not answer takes the question mark.
|
|
151
|
+
case 'skipped':
|
|
152
|
+
return '⊘';
|
|
139
153
|
}
|
|
140
154
|
}
|
|
141
155
|
function formatHumanReport(report, verbose) {
|
|
@@ -167,8 +181,18 @@ function formatHumanReport(report, verbose) {
|
|
|
167
181
|
}
|
|
168
182
|
lines.push('');
|
|
169
183
|
const s = report.summary;
|
|
170
|
-
|
|
184
|
+
// Every status is counted, so the row sums to `total`. `skipped` was folded
|
|
185
|
+
// into `inconc` while they were one word, which meant the line silently
|
|
186
|
+
// reported an optional package's absence in the same figure as a check that
|
|
187
|
+
// timed out — and a reader adding the numbers up got the right total for the
|
|
188
|
+
// wrong reason.
|
|
189
|
+
lines.push(` pass: ${s.pass} fail: ${s.fail} warn: ${s.warn} inconc: ${s.inconclusive} skipped: ${s.skipped} total: ${s.total}`);
|
|
171
190
|
lines.push(` exit: ${report.exit}`);
|
|
191
|
+
// Named where the number is, because `69` is the one code here a reader will
|
|
192
|
+
// not recognise and the report is the only place they are looking.
|
|
193
|
+
if (report.exit === 69) {
|
|
194
|
+
lines.push(' (69: at least one check could not answer — see the ? rows above)');
|
|
195
|
+
}
|
|
172
196
|
if (verbose) {
|
|
173
197
|
const failed = report.checks.filter((c) => c.status === 'fail');
|
|
174
198
|
if (failed.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAyB,oBAAoB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,MAAM,gBAAgB,GAA8B;IACnD,SAAS;IACT,WAAW;IACX,OAAO;IACP,WAAW;IACX,SAAS;IACT,SAAS;IACT,QAAQ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I,CAAA;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAe;IACxC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uDAAuD;IACpE,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC;CACzD,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `namzu drain` — one pass over a queue of durable runs.
|
|
3
|
+
*
|
|
4
|
+
* namzu could park a run in one process and continue it in another, and no
|
|
5
|
+
* shipped surface ever did: `claimRun`, `listDurableRuns` and `resumeRun`
|
|
6
|
+
* all existed, and the only caller of any of them was a test. This is the
|
|
7
|
+
* caller. It lists the runs nobody holds under a scope, takes each one,
|
|
8
|
+
* continues it under that claim, and gives it back.
|
|
9
|
+
*
|
|
10
|
+
* **It is not a daemon, and `namzu serve` still says namzu has no daemon.**
|
|
11
|
+
* That refusal is not weakened by this command, it is the reason for its
|
|
12
|
+
* shape: one bounded pass, exit code says what happened, and whatever the
|
|
13
|
+
* operator already uses to run things periodically runs it again. A run is
|
|
14
|
+
* a process; a drain is a process that picks up processes somebody else's
|
|
15
|
+
* machine dropped.
|
|
16
|
+
*
|
|
17
|
+
* The store is named rather than assumed. namzu's own runs are not
|
|
18
|
+
* checkpointed to disk today, so every run this command can find was
|
|
19
|
+
* written by an SDK host — and a default path would have this command
|
|
20
|
+
* report "nothing parked" against a directory nobody writes to, which is
|
|
21
|
+
* the reading that makes an empty queue indistinguishable from a missing
|
|
22
|
+
* one.
|
|
23
|
+
*/
|
|
24
|
+
import type { ProjectId, SessionId, TenantId } from '@namzu/sdk';
|
|
25
|
+
import type { CommandDef } from './types.js';
|
|
26
|
+
export interface DrainFlags {
|
|
27
|
+
store: string | null;
|
|
28
|
+
tenant: string | null;
|
|
29
|
+
project: string | null;
|
|
30
|
+
session: string | null;
|
|
31
|
+
cwd: string | null;
|
|
32
|
+
holder: string | null;
|
|
33
|
+
ttlMs: number | null;
|
|
34
|
+
maxConcurrent: number | null;
|
|
35
|
+
provider: string | null;
|
|
36
|
+
model: string | null;
|
|
37
|
+
trust: boolean;
|
|
38
|
+
unknown: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Parse `namzu drain`'s flags.
|
|
42
|
+
*
|
|
43
|
+
* Exported and pure so the refusals below are testable without a provider,
|
|
44
|
+
* a store or a directory. Every one of them is a case where proceeding
|
|
45
|
+
* would act on a scope the operator did not name.
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseDrainFlags(rawArgs: readonly string[]): DrainFlags;
|
|
48
|
+
/** The scope refusal, or the scope. Contiguous prefix — see the store contract. */
|
|
49
|
+
export declare function resolveDrainScope(flags: Pick<DrainFlags, 'tenant' | 'project' | 'session'>): {
|
|
50
|
+
readonly error: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly tenantId: TenantId;
|
|
53
|
+
readonly projectId?: ProjectId;
|
|
54
|
+
readonly sessionId?: SessionId;
|
|
55
|
+
};
|
|
56
|
+
/** A per-process holder when the operator names none. */
|
|
57
|
+
export declare function defaultHolder(): string;
|
|
58
|
+
export declare const drainCommand: CommandDef;
|
|
59
|
+
//# sourceMappingURL=drain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drain.d.ts","sourceRoot":"","sources":["../../src/commands/drain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAmB,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAOjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAK5C,MAAM,WAAW,UAAU;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAgEtE;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC,GACxF;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1B;IACA,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAC7B,CAqBH;AAED,yDAAyD;AACzD,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAcD,eAAO,MAAM,YAAY,EAAE,UAuK1B,CAAA"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `namzu drain` — one pass over a queue of durable runs.
|
|
3
|
+
*
|
|
4
|
+
* namzu could park a run in one process and continue it in another, and no
|
|
5
|
+
* shipped surface ever did: `claimRun`, `listDurableRuns` and `resumeRun`
|
|
6
|
+
* all existed, and the only caller of any of them was a test. This is the
|
|
7
|
+
* caller. It lists the runs nobody holds under a scope, takes each one,
|
|
8
|
+
* continues it under that claim, and gives it back.
|
|
9
|
+
*
|
|
10
|
+
* **It is not a daemon, and `namzu serve` still says namzu has no daemon.**
|
|
11
|
+
* That refusal is not weakened by this command, it is the reason for its
|
|
12
|
+
* shape: one bounded pass, exit code says what happened, and whatever the
|
|
13
|
+
* operator already uses to run things periodically runs it again. A run is
|
|
14
|
+
* a process; a drain is a process that picks up processes somebody else's
|
|
15
|
+
* machine dropped.
|
|
16
|
+
*
|
|
17
|
+
* The store is named rather than assumed. namzu's own runs are not
|
|
18
|
+
* checkpointed to disk today, so every run this command can find was
|
|
19
|
+
* written by an SDK host — and a default path would have this command
|
|
20
|
+
* report "nothing parked" against a directory nobody writes to, which is
|
|
21
|
+
* the reading that makes an empty queue indistinguishable from a missing
|
|
22
|
+
* one.
|
|
23
|
+
*/
|
|
24
|
+
import { DiskCheckpointStore, drainRuns } from '@namzu/sdk';
|
|
25
|
+
import { configureLogger } from '@namzu/sdk';
|
|
26
|
+
import { EXIT_UNTRUSTED, EXIT_USAGE } from '../exit-codes.js';
|
|
27
|
+
import { decideHeadlessTrust } from '../permissions/headless-trust.js';
|
|
28
|
+
import { applyProviderFlags, resolveWorkingDirectory } from './run-flags.js';
|
|
29
|
+
/** Lease length when the operator names none. Long enough for a real turn. */
|
|
30
|
+
const DEFAULT_TTL_MS = 600_000;
|
|
31
|
+
/**
|
|
32
|
+
* Parse `namzu drain`'s flags.
|
|
33
|
+
*
|
|
34
|
+
* Exported and pure so the refusals below are testable without a provider,
|
|
35
|
+
* a store or a directory. Every one of them is a case where proceeding
|
|
36
|
+
* would act on a scope the operator did not name.
|
|
37
|
+
*/
|
|
38
|
+
export function parseDrainFlags(rawArgs) {
|
|
39
|
+
const out = {
|
|
40
|
+
store: null,
|
|
41
|
+
tenant: null,
|
|
42
|
+
project: null,
|
|
43
|
+
session: null,
|
|
44
|
+
cwd: null,
|
|
45
|
+
holder: null,
|
|
46
|
+
ttlMs: null,
|
|
47
|
+
maxConcurrent: null,
|
|
48
|
+
provider: null,
|
|
49
|
+
model: null,
|
|
50
|
+
trust: false,
|
|
51
|
+
unknown: [],
|
|
52
|
+
};
|
|
53
|
+
const value = (a, name, i) => {
|
|
54
|
+
if (a === `--${name}` && i.v + 1 < rawArgs.length)
|
|
55
|
+
return rawArgs[++i.v];
|
|
56
|
+
if (a.startsWith(`--${name}=`))
|
|
57
|
+
return a.slice(name.length + 3);
|
|
58
|
+
return undefined;
|
|
59
|
+
};
|
|
60
|
+
const strings = [
|
|
61
|
+
['store', 'store'],
|
|
62
|
+
['tenant', 'tenant'],
|
|
63
|
+
['project', 'project'],
|
|
64
|
+
['session', 'session'],
|
|
65
|
+
['cwd', 'cwd'],
|
|
66
|
+
['holder', 'holder'],
|
|
67
|
+
['provider', 'provider'],
|
|
68
|
+
['model', 'model'],
|
|
69
|
+
];
|
|
70
|
+
for (const idx = { v: 0 }; idx.v < rawArgs.length; idx.v++) {
|
|
71
|
+
const a = rawArgs[idx.v];
|
|
72
|
+
if (a === '--trust') {
|
|
73
|
+
out.trust = true;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
let matched = false;
|
|
77
|
+
for (const [flag, key] of strings) {
|
|
78
|
+
const v = value(a, flag, idx);
|
|
79
|
+
if (v !== undefined) {
|
|
80
|
+
out[key] = v.trim() || null;
|
|
81
|
+
matched = true;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (matched)
|
|
86
|
+
continue;
|
|
87
|
+
const ttl = value(a, 'ttl', idx);
|
|
88
|
+
if (ttl !== undefined) {
|
|
89
|
+
out.ttlMs = Number(ttl);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const conc = value(a, 'max-concurrent', idx);
|
|
93
|
+
if (conc !== undefined) {
|
|
94
|
+
out.maxConcurrent = Number(conc);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
// Anything unrecognised is refused rather than ignored, positional
|
|
98
|
+
// arguments included — this command takes none. It acts on other
|
|
99
|
+
// people's runs; a typo'd `--tenant` that fell through would drain a
|
|
100
|
+
// scope nobody asked for.
|
|
101
|
+
out.unknown.push(a.split('=')[0]);
|
|
102
|
+
}
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
/** The scope refusal, or the scope. Contiguous prefix — see the store contract. */
|
|
106
|
+
export function resolveDrainScope(flags) {
|
|
107
|
+
if (!flags.tenant) {
|
|
108
|
+
return {
|
|
109
|
+
error: '--tenant is required. A run listing with no tenant is a cross-tenant read with a friendly name, so there is no default to fall back to.',
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
// The disk store keys checkpoints by directory and needs the project and
|
|
113
|
+
// session to attribute what it finds, so this command asks for the full
|
|
114
|
+
// prefix rather than the contract's minimum.
|
|
115
|
+
if (!flags.project || !flags.session) {
|
|
116
|
+
return {
|
|
117
|
+
error: '--project and --session are both required for a disk store: its layout carries no attribution, so it cannot say which project and session the runs it finds belong to.',
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
tenantId: flags.tenant,
|
|
122
|
+
projectId: flags.project,
|
|
123
|
+
sessionId: flags.session,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/** A per-process holder when the operator names none. */
|
|
127
|
+
export function defaultHolder() {
|
|
128
|
+
return `namzu-drain-${process.pid}-${Date.now().toString(36)}`;
|
|
129
|
+
}
|
|
130
|
+
function describe(entry) {
|
|
131
|
+
const park = entry.park ? `${entry.park.state} ${entry.park.requestType}` : 'not parked';
|
|
132
|
+
return `${entry.runId} · ${entry.checkpointCount} checkpoints · ${park}`;
|
|
133
|
+
}
|
|
134
|
+
function defaultPrefs(detected) {
|
|
135
|
+
const first = detected[0];
|
|
136
|
+
return first
|
|
137
|
+
? { version: 3, providers: [{ id: first.entry.id }], subagents: { active: [] } }
|
|
138
|
+
: null;
|
|
139
|
+
}
|
|
140
|
+
export const drainCommand = {
|
|
141
|
+
name: 'drain',
|
|
142
|
+
description: 'Continue runs another process left behind (one pass, then exit)',
|
|
143
|
+
passThrough: true,
|
|
144
|
+
help: [
|
|
145
|
+
'Usage: namzu drain --store <dir> --tenant <id> --project <id> --session <id>',
|
|
146
|
+
'',
|
|
147
|
+
'Take every run under that scope that no worker currently holds, continue',
|
|
148
|
+
'it from its last checkpoint, and release it. One pass, then exit — namzu',
|
|
149
|
+
'has no daemon, and this is a command your scheduler runs, not a service.',
|
|
150
|
+
'',
|
|
151
|
+
'Options:',
|
|
152
|
+
' --store <dir> The runs/ directory a checkpoint store writes to',
|
|
153
|
+
' --tenant <id> Isolation boundary. Required; there is no default',
|
|
154
|
+
' --project <id> Required — the disk layout carries no attribution',
|
|
155
|
+
' --session <id> Required, same reason',
|
|
156
|
+
' --holder <id> Who is taking the runs. Must be unique PER PROCESS',
|
|
157
|
+
' --ttl <ms> Lease length (default 600000)',
|
|
158
|
+
' --max-concurrent <n> Runs in flight at once (default 1)',
|
|
159
|
+
' --cwd <path> Directory the resumed runs work in',
|
|
160
|
+
' --provider <id> Provider to continue with',
|
|
161
|
+
' --model <id> Model to continue with',
|
|
162
|
+
' --trust Accept this folder for this pass',
|
|
163
|
+
'',
|
|
164
|
+
'A run that is parked on a human decision is REPORTED, never resumed past.',
|
|
165
|
+
'The answer belongs to a person; a drainer that continued without it would',
|
|
166
|
+
'discard the question the run stopped to ask.',
|
|
167
|
+
'',
|
|
168
|
+
'Exit codes: 0 when every run it took was continued, 1 when any run failed,',
|
|
169
|
+
'64 when an argument is wrong, 77 when the folder has not been trusted.',
|
|
170
|
+
].join('\n'),
|
|
171
|
+
handler: async ({ ctx, rawArgs }) => {
|
|
172
|
+
const flags = parseDrainFlags(rawArgs);
|
|
173
|
+
if (flags.unknown.length > 0) {
|
|
174
|
+
ctx.formatter.error({ message: `unknown option(s): ${flags.unknown.join(', ')}` });
|
|
175
|
+
return EXIT_USAGE;
|
|
176
|
+
}
|
|
177
|
+
if (!flags.store) {
|
|
178
|
+
ctx.formatter.error({
|
|
179
|
+
message: '--store is required: name the runs/ directory the checkpoint store writes to. There is no default, because an empty queue and a directory nobody writes to would report the same thing.',
|
|
180
|
+
});
|
|
181
|
+
return EXIT_USAGE;
|
|
182
|
+
}
|
|
183
|
+
const scope = resolveDrainScope(flags);
|
|
184
|
+
if ('error' in scope) {
|
|
185
|
+
ctx.formatter.error({ message: scope.error });
|
|
186
|
+
return EXIT_USAGE;
|
|
187
|
+
}
|
|
188
|
+
const ttlMs = flags.ttlMs ?? DEFAULT_TTL_MS;
|
|
189
|
+
if (!Number.isFinite(ttlMs) || ttlMs <= 0) {
|
|
190
|
+
ctx.formatter.error({ message: `--ttl must be a positive number of ms, got ${flags.ttlMs}` });
|
|
191
|
+
return EXIT_USAGE;
|
|
192
|
+
}
|
|
193
|
+
const resolved = resolveWorkingDirectory(flags.cwd);
|
|
194
|
+
if ('error' in resolved) {
|
|
195
|
+
ctx.formatter.error({ message: resolved.error });
|
|
196
|
+
return EXIT_USAGE;
|
|
197
|
+
}
|
|
198
|
+
const trust = decideHeadlessTrust({ cwd: resolved.cwd, trustFlag: flags.trust });
|
|
199
|
+
if (!trust.allowed) {
|
|
200
|
+
ctx.formatter.error({ message: trust.message ?? 'folder not trusted' });
|
|
201
|
+
return EXIT_UNTRUSTED;
|
|
202
|
+
}
|
|
203
|
+
configureLogger({ level: 'silent' });
|
|
204
|
+
const { probeAgentSession, createAgentSession } = await import('../tui/agent.js');
|
|
205
|
+
const probe = await probeAgentSession();
|
|
206
|
+
let prefs = probe.preferences ?? defaultPrefs(probe.detected);
|
|
207
|
+
if (!prefs) {
|
|
208
|
+
ctx.formatter.error({
|
|
209
|
+
message: 'no LLM provider available — set a credential (e.g. ANTHROPIC_API_KEY) or run `namzu` to pick one',
|
|
210
|
+
});
|
|
211
|
+
return 1;
|
|
212
|
+
}
|
|
213
|
+
prefs = applyProviderFlags(prefs, flags);
|
|
214
|
+
const session = await createAgentSession(prefs, probe.detected, { cwd: resolved.cwd });
|
|
215
|
+
if (!session.hasProvider) {
|
|
216
|
+
await session.close();
|
|
217
|
+
ctx.formatter.error({ message: session.errorHint ?? 'agent is not ready' });
|
|
218
|
+
return 1;
|
|
219
|
+
}
|
|
220
|
+
// `resolveDrainScope` refuses a partial prefix above, so all three are
|
|
221
|
+
// present here; the store's attribution has no optional fields because
|
|
222
|
+
// a listing that guessed one would file runs under a project nobody
|
|
223
|
+
// named.
|
|
224
|
+
const store = new DiskCheckpointStore({ baseDir: flags.store }, {
|
|
225
|
+
tenantId: scope.tenantId,
|
|
226
|
+
projectId: scope.projectId,
|
|
227
|
+
sessionId: scope.sessionId,
|
|
228
|
+
});
|
|
229
|
+
const holder = flags.holder ?? defaultHolder();
|
|
230
|
+
const awaiting = [];
|
|
231
|
+
const empty = [];
|
|
232
|
+
try {
|
|
233
|
+
const result = await drainRuns({
|
|
234
|
+
store,
|
|
235
|
+
scope,
|
|
236
|
+
holder,
|
|
237
|
+
ttlMs,
|
|
238
|
+
...(flags.maxConcurrent !== null ? { maxConcurrent: flags.maxConcurrent } : {}),
|
|
239
|
+
onRun: async (entry, claim) => {
|
|
240
|
+
ctx.formatter.info(`⏵ ${describe(entry)} · fence ${claim.fence}`);
|
|
241
|
+
const outcome = await session.resumeDurable({
|
|
242
|
+
entry,
|
|
243
|
+
checkpointStore: store,
|
|
244
|
+
// The reason the claim is handed over at all: every durable
|
|
245
|
+
// write this run makes carries it, so a drainer that stalled
|
|
246
|
+
// past its lease cannot overwrite whoever took over.
|
|
247
|
+
claimFence: claim.fence,
|
|
248
|
+
});
|
|
249
|
+
if (outcome.resumed) {
|
|
250
|
+
ctx.formatter.info(`✔ ${entry.runId} · ${outcome.run.status}`);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
// Reported, not resumed past. The two non-resumed outcomes mean
|
|
254
|
+
// opposite things and an operator has to be able to tell them
|
|
255
|
+
// apart: one is a question waiting on a person, the other is a
|
|
256
|
+
// run with nothing to continue.
|
|
257
|
+
if (outcome.reason === 'awaiting-decision') {
|
|
258
|
+
awaiting.push(entry.runId);
|
|
259
|
+
ctx.formatter.info(`⏸ ${entry.runId} · waiting on a human decision`);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
empty.push(entry.runId);
|
|
263
|
+
ctx.formatter.info(`∅ ${entry.runId} · no checkpoint to continue from`);
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
ctx.formatter.print({
|
|
268
|
+
listed: result.listed,
|
|
269
|
+
resumed: result.drained.filter((id) => !awaiting.includes(id) && !empty.includes(id))
|
|
270
|
+
.length,
|
|
271
|
+
awaitingDecision: awaiting,
|
|
272
|
+
noCheckpoint: empty,
|
|
273
|
+
heldByOthers: result.skipped,
|
|
274
|
+
alreadyHandled: result.stale,
|
|
275
|
+
failed: result.failed,
|
|
276
|
+
unreleased: result.unreleased,
|
|
277
|
+
});
|
|
278
|
+
for (const f of result.failed) {
|
|
279
|
+
ctx.formatter.error({ message: `${f.runId}: ${f.error}` });
|
|
280
|
+
}
|
|
281
|
+
// A drain that could not give a lease back is reported too. The work
|
|
282
|
+
// landed, but the run is unavailable to the next reader until the
|
|
283
|
+
// lease lapses, and an operator watching throughput needs to know.
|
|
284
|
+
for (const u of result.unreleased) {
|
|
285
|
+
ctx.formatter.error({ message: `${u.runId}: lease not released — ${u.error}` });
|
|
286
|
+
}
|
|
287
|
+
return result.failed.length > 0 ? 1 : 0;
|
|
288
|
+
}
|
|
289
|
+
catch (err) {
|
|
290
|
+
// The refusals from `drainRuns` land here: a store that cannot claim,
|
|
291
|
+
// a lease that cannot mean what it says. Reported rather than
|
|
292
|
+
// swallowed into an empty pass that reads as "nothing was parked".
|
|
293
|
+
ctx.formatter.error({ message: err instanceof Error ? err.message : String(err) });
|
|
294
|
+
return 1;
|
|
295
|
+
}
|
|
296
|
+
finally {
|
|
297
|
+
await session.close();
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
//# sourceMappingURL=drain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drain.js","sourceR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AA0B,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;YAChF,CAAC;YACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACxC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,sEAAsE;YACtE,8DAA8D;YAC9D,mEAAmE;YACnE,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAClF,OAAO,CAAC,CAAA;QACT,CAAC;gBAAS,CAAC;YACV,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;QACtB,CAAC;IACF,CAAC;CACD,CAAA"}
|
|
@@ -16,15 +16,43 @@
|
|
|
16
16
|
* persisted (stateless one-shot).
|
|
17
17
|
*
|
|
18
18
|
* Status lines never hit stdout (logger silenced) so every stdout line is a
|
|
19
|
-
* valid JSON event
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
19
|
+
* valid JSON event, and EVERY failure is reported in band, including the ones
|
|
20
|
+
* that also carry an exit code.
|
|
21
|
+
*
|
|
22
|
+
* ## What the exit code means
|
|
23
|
+
*
|
|
24
|
+
* It used to be explained as "a run that STARTED and failed exits 0; a refusal
|
|
25
|
+
* to start exits non-zero", and that rule did not sort the cases it was applied
|
|
26
|
+
* to. An unknown option, a missing prompt, a `--cwd` that is not there and a
|
|
27
|
+
* tool server that will not connect are all refusals to start, and all four
|
|
28
|
+
* exited 0 while an untrusted folder exited 77. Neither does the retry argument
|
|
29
|
+
* the old comment appealed to: retrying an unknown option is exactly as
|
|
30
|
+
* pointless as retrying an untrusted folder.
|
|
31
|
+
*
|
|
32
|
+
* The axis that does sort them:
|
|
33
|
+
*
|
|
34
|
+
* CAN THE CALLER REACH THE RUN IT ASKED FOR BY CHANGING WHAT IT SENDS?
|
|
35
|
+
*
|
|
36
|
+
* - **Yes → `0`.** The host reads the `error` event and fixes its own
|
|
37
|
+
* invocation. An unknown option, no prompt, a `--cwd` that does not exist, a
|
|
38
|
+
* `--permission-mode` that is not a mode, an interactive command named
|
|
39
|
+
* headlessly, a provider id that is not a provider.
|
|
40
|
+
* - **A run that started and failed → `0`.** Unchanged: that is an outcome to
|
|
41
|
+
* render, and possibly to retry.
|
|
42
|
+
* - **No → non-zero, because a person has to go and do something.** `77` when
|
|
43
|
+
* the folder is untrusted — kept to that one condition, because being
|
|
44
|
+
* unambiguous is its entire justification. `1` for everything else in this
|
|
45
|
+
* group: a conversation that cannot be opened, no provider available, a
|
|
46
|
+
* credential or driver the session needs, a declared tool server that is not
|
|
47
|
+
* there, a command file that will not parse.
|
|
48
|
+
*
|
|
49
|
+
* `1` rather than a new code because `namzu run` — the same one-shot, differing
|
|
50
|
+
* only in how it prints — already exits `1` for these conditions and `77` for
|
|
51
|
+
* trust. A host that shells to one for a script and the other for a UI must not
|
|
52
|
+
* be handed two tables for one fact.
|
|
53
|
+
*
|
|
54
|
+
* Dropping `--session` is NOT "the caller fixing it": it abandons what was
|
|
55
|
+
* asked for rather than achieving it.
|
|
28
56
|
*/
|
|
29
57
|
import type { CommandDef } from './types.js';
|
|
30
58
|
export declare const runStreamCommand: CommandDef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-stream.d.ts","sourceRoot":"","sources":["../../src/commands/run-stream.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"run-stream.d.ts","sourceRoot":"","sources":["../../src/commands/run-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAwBH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAuC5C,eAAO,MAAM,gBAAgB,EAAE,UAgT9B,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,UAkD5B,CAAA;AAMD,eAAO,MAAM,iBAAiB,EAAE,UAqC/B,CAAA;AAOD,eAAO,MAAM,oBAAoB,EAAE,UAwClC,CAAA"}
|