@jini-ai/cli 0.1.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/LICENSE +201 -0
- package/dist/command-registry.d.ts +82 -0
- package/dist/command-registry.d.ts.map +1 -0
- package/dist/command-registry.js +88 -0
- package/dist/command-registry.js.map +1 -0
- package/dist/daemon-command.d.ts +42 -0
- package/dist/daemon-command.d.ts.map +1 -0
- package/dist/daemon-command.js +103 -0
- package/dist/daemon-command.js.map +1 -0
- package/dist/daemon-url.d.ts +68 -0
- package/dist/daemon-url.d.ts.map +1 -0
- package/dist/daemon-url.js +99 -0
- package/dist/daemon-url.js.map +1 -0
- package/dist/errors.d.ts +82 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +103 -0
- package/dist/errors.js.map +1 -0
- package/dist/flags.d.ts +61 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +111 -0
- package/dist/flags.js.map +1 -0
- package/dist/http.d.ts +63 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +226 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/local-daemon-discovery.d.ts +31 -0
- package/dist/local-daemon-discovery.d.ts.map +1 -0
- package/dist/local-daemon-discovery.js +53 -0
- package/dist/local-daemon-discovery.js.map +1 -0
- package/dist/main.d.ts +21 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +231 -0
- package/dist/main.js.map +1 -0
- package/dist/prompt.d.ts +83 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +198 -0
- package/dist/prompt.js.map +1 -0
- package/dist/redact.d.ts +48 -0
- package/dist/redact.d.ts.map +1 -0
- package/dist/redact.js +134 -0
- package/dist/redact.js.map +1 -0
- package/dist/run-command.d.ts +39 -0
- package/dist/run-command.d.ts.map +1 -0
- package/dist/run-command.js +291 -0
- package/dist/run-command.js.map +1 -0
- package/dist/tokens.d.ts +3 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +12 -0
- package/dist/tokens.js.map +1 -0
- package/dist/usage.d.ts +24 -0
- package/dist/usage.d.ts.map +1 -0
- package/dist/usage.js +25 -0
- package/dist/usage.js.map +1 -0
- package/dist/version-command.d.ts +38 -0
- package/dist/version-command.d.ts.map +1 -0
- package/dist/version-command.js +78 -0
- package/dist/version-command.js.map +1 -0
- package/package.json +48 -0
package/dist/redact.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module redact
|
|
3
|
+
*
|
|
4
|
+
* Bounded, redacted rendering of text that ultimately traces back to an
|
|
5
|
+
* untrusted network peer — a daemon's error body, a `fetch()` rejection's
|
|
6
|
+
* cause message — rather than to this process's own code. Three problems
|
|
7
|
+
* are addressed together because a hostile or merely buggy daemon can
|
|
8
|
+
* combine them: an unbounded body can be enormous, an arbitrary body can
|
|
9
|
+
* contain terminal control/ANSI escape sequences that manipulate the
|
|
10
|
+
* user's terminal when printed verbatim, and it can echo back secrets (an
|
|
11
|
+
* `Authorization` header, an API key, a bearer/refresh token) that were
|
|
12
|
+
* present in the request or in an upstream provider's own error.
|
|
13
|
+
*
|
|
14
|
+
* Added per CR-004 / SEC-RB-009 (`ADS-memory/reports/code-review/CR-remaining-backend-audit-2026-07-21.md`,
|
|
15
|
+
* `ADS-memory/reports/security/SEC-remaining-backend-audit-2026-07-21.md`):
|
|
16
|
+
* `http.ts` and `errors.ts` previously wrote raw fetch-cause messages,
|
|
17
|
+
* arbitrary daemon JSON, or complete non-JSON response bodies straight to
|
|
18
|
+
* the terminal.
|
|
19
|
+
*/
|
|
20
|
+
/** Hard cap on how much untrusted text {@link sanitizeUntrustedText} will ever return, absent an override. */
|
|
21
|
+
const DEFAULT_MAX_EXCERPT_LENGTH = 500;
|
|
22
|
+
/** Recursion/branching caps for {@link sanitizeUnknownDeep} — bounds the work done on an arbitrary parsed-JSON tree. */
|
|
23
|
+
const MAX_SANITIZE_DEPTH = 4;
|
|
24
|
+
const MAX_SANITIZE_ENTRIES = 50;
|
|
25
|
+
const ESC = 0x1b;
|
|
26
|
+
const BEL = 0x07;
|
|
27
|
+
const BACKSLASH = 0x5c;
|
|
28
|
+
const OSC_OPEN = 0x5d; // ']'
|
|
29
|
+
const CSI_OPEN = 0x5b; // '['
|
|
30
|
+
function isCsiFinalByte(code) {
|
|
31
|
+
return code >= 0x40 && code <= 0x7e; // '@'..'~'
|
|
32
|
+
}
|
|
33
|
+
function isOtherControlCode(code) {
|
|
34
|
+
if (code === 0x09 || code === 0x0a || code === 0x0d)
|
|
35
|
+
return false; // tab / LF / CR pass through
|
|
36
|
+
if (code <= 0x1f)
|
|
37
|
+
return true; // remaining C0 controls (ESC itself is handled separately)
|
|
38
|
+
if (code === 0x7f)
|
|
39
|
+
return true; // DEL
|
|
40
|
+
if (code >= 0x80 && code <= 0x9f)
|
|
41
|
+
return true; // C1 controls
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Strip ANSI/terminal escape sequences (CSI `ESC [ ... final-byte`, OSC `ESC ] ... BEL-or-ST`,
|
|
46
|
+
* and bare ESC-prefixed bytes) plus other C0/C1 control characters from `text`. Written as an
|
|
47
|
+
* explicit char-code scanner rather than a regex literal with hex escapes, so the pattern is
|
|
48
|
+
* plain ASCII source with no embedded control bytes.
|
|
49
|
+
*/
|
|
50
|
+
export function stripControlSequences(text) {
|
|
51
|
+
let out = '';
|
|
52
|
+
for (let i = 0; i < text.length; i++) {
|
|
53
|
+
const code = text.charCodeAt(i);
|
|
54
|
+
if (code === ESC) {
|
|
55
|
+
const next = text.charCodeAt(i + 1);
|
|
56
|
+
if (next === CSI_OPEN) {
|
|
57
|
+
let j = i + 2;
|
|
58
|
+
while (j < text.length && !isCsiFinalByte(text.charCodeAt(j)))
|
|
59
|
+
j++;
|
|
60
|
+
i = j; // land on the final byte; the outer loop's i++ steps past it
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (next === OSC_OPEN) {
|
|
64
|
+
let j = i + 2;
|
|
65
|
+
while (j < text.length &&
|
|
66
|
+
text.charCodeAt(j) !== BEL &&
|
|
67
|
+
!(text.charCodeAt(j) === ESC && text.charCodeAt(j + 1) === BACKSLASH)) {
|
|
68
|
+
j++;
|
|
69
|
+
}
|
|
70
|
+
if (j < text.length && text.charCodeAt(j) === BEL)
|
|
71
|
+
i = j;
|
|
72
|
+
else
|
|
73
|
+
i = Math.min(j + 1, text.length - 1);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
continue; // bare ESC (or an unrecognized ESC-prefixed byte): drop just the ESC byte
|
|
77
|
+
}
|
|
78
|
+
if (isOtherControlCode(code))
|
|
79
|
+
continue;
|
|
80
|
+
out += text[i];
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
// A labeled credential (`Authorization: ...`, `api-key=...`) has everything after the label
|
|
85
|
+
// redacted. A bare run of 20+ base64url/hex-alphabet characters is treated as a possible
|
|
86
|
+
// opaque token/secret and redacted outright, even with no label.
|
|
87
|
+
const LABELED_SECRET_RE = /\b(authorization|bearer|api[-_]?key|access[-_]?token|refresh[-_]?token|client[-_]?secret|password|secret|cookie)\b\s*[:=]\s*\S+/gi;
|
|
88
|
+
const OPAQUE_TOKEN_RE = /[A-Za-z0-9_-]{20,}/g;
|
|
89
|
+
/** Redact labeled credentials and long opaque-token-looking substrings from `text`. */
|
|
90
|
+
export function redactSecretLike(text) {
|
|
91
|
+
return text
|
|
92
|
+
.replace(LABELED_SECRET_RE, (match) => match.replace(/\S+$/, '[redacted]'))
|
|
93
|
+
.replace(OPAQUE_TOKEN_RE, '[redacted]');
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Strip terminal control sequences, redact anything that looks like a secret, and cap the
|
|
97
|
+
* length of `text` — the one function every boundary that surfaces daemon/network-derived text
|
|
98
|
+
* to stderr/stdout should route through first.
|
|
99
|
+
*/
|
|
100
|
+
export function sanitizeUntrustedText(text, options = {}) {
|
|
101
|
+
const maxLength = options.maxLength ?? DEFAULT_MAX_EXCERPT_LENGTH;
|
|
102
|
+
const sanitized = redactSecretLike(stripControlSequences(text));
|
|
103
|
+
if (sanitized.length <= maxLength)
|
|
104
|
+
return sanitized;
|
|
105
|
+
const omitted = sanitized.length - maxLength;
|
|
106
|
+
return `${sanitized.slice(0, maxLength)}… [truncated ${omitted} more characters]`;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Recursively sanitize an arbitrary parsed-JSON value (the shape a daemon error envelope's
|
|
110
|
+
* `data`/`details` field can legitimately be): every string leaf is passed through
|
|
111
|
+
* {@link sanitizeUntrustedText}, and both array length and object key count are capped per
|
|
112
|
+
* level so a maliciously wide or deep payload can't blow up the work done here. Depth beyond
|
|
113
|
+
* the cap is replaced with a placeholder rather than silently dropped, so truncation is visible
|
|
114
|
+
* instead of looking like an empty/missing value.
|
|
115
|
+
*/
|
|
116
|
+
export function sanitizeUnknownDeep(value, depth = 0) {
|
|
117
|
+
if (depth > MAX_SANITIZE_DEPTH)
|
|
118
|
+
return '[omitted: nested too deeply]';
|
|
119
|
+
if (typeof value === 'string')
|
|
120
|
+
return sanitizeUntrustedText(value);
|
|
121
|
+
if (Array.isArray(value)) {
|
|
122
|
+
return value.slice(0, MAX_SANITIZE_ENTRIES).map((item) => sanitizeUnknownDeep(item, depth + 1));
|
|
123
|
+
}
|
|
124
|
+
if (value !== null && typeof value === 'object') {
|
|
125
|
+
const out = {};
|
|
126
|
+
for (const [key, val] of Object.entries(value).slice(0, MAX_SANITIZE_ENTRIES)) {
|
|
127
|
+
out[sanitizeUntrustedText(key, { maxLength: 100 })] = sanitizeUnknownDeep(val, depth + 1);
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
// numbers, booleans, null, undefined: nothing to sanitize.
|
|
132
|
+
return value;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,EAAE,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IAClG,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC,EAAE,CAAC;YAC9E,GAAG,CAAC,qBAAqB,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,mBAAmB,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QAC5F,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,2DAA2D;IAC3D,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ExitCodeTable } from './errors.js';
|
|
2
|
+
import type { CommandRegistry } from './command-registry.js';
|
|
3
|
+
export interface RunCommandDeps {
|
|
4
|
+
/** Resolves the daemon HTTP base URL once per command invocation (e.g. wraps `resolveDaemonUrl`). */
|
|
5
|
+
resolveBaseUrl: () => Promise<string> | string;
|
|
6
|
+
/** Defaults to `process.stdout.write`; inject for tests. Used for successful command output. */
|
|
7
|
+
write?: (text: string) => void;
|
|
8
|
+
/** Defaults to `process.stderr.write`; inject for tests. Used for usage/validation errors. */
|
|
9
|
+
writeErr?: (text: string) => void;
|
|
10
|
+
/** Defaults to the global `fetch`; inject for tests. */
|
|
11
|
+
fetchImpl?: typeof fetch;
|
|
12
|
+
/** Defaults to `process.exit`; inject for tests (must not return). */
|
|
13
|
+
exit?: (code: number) => never;
|
|
14
|
+
/** Extra/overriding `code -> exitCode` entries layered on the package default table. */
|
|
15
|
+
exitCodes?: ExitCodeTable;
|
|
16
|
+
}
|
|
17
|
+
/** `run start --context-ref <ref> [--agent-id <id>] [--idempotency-key <key>]` */
|
|
18
|
+
export declare function runStartCommand(args: readonly string[], deps: RunCommandDeps): Promise<void>;
|
|
19
|
+
/** `run list [--context-ref <ref>]` */
|
|
20
|
+
export declare function runListCommand(args: readonly string[], deps: RunCommandDeps): Promise<void>;
|
|
21
|
+
/** `run get <runId>` */
|
|
22
|
+
export declare function runGetCommand(args: readonly string[], deps: RunCommandDeps): Promise<void>;
|
|
23
|
+
/** `run cancel <runId> [--reason <text>]` */
|
|
24
|
+
export declare function runCancelCommand(args: readonly string[], deps: RunCommandDeps): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Streams `GET /api/runs/:runId/events` and writes one NDJSON line per event to `deps.write`,
|
|
27
|
+
* stopping once a terminal `'end'` event arrives (or the stream closes on its own). Each frame's
|
|
28
|
+
* `data` is stripped of terminal control sequences before being written — it originates from a
|
|
29
|
+
* prompt-influenced agent run and is not trusted to be safe to print verbatim (same posture as
|
|
30
|
+
* `redact.ts`'s other daemon-sourced-text handling), though it is not truncated or secret-redacted
|
|
31
|
+
* the way a diagnostic error message is, since it is the run's actual event payload, not incidental
|
|
32
|
+
* error detail.
|
|
33
|
+
*/
|
|
34
|
+
export declare function watchRunEvents(baseUrl: string, runId: string, args: readonly string[], deps: RunCommandDeps): Promise<void>;
|
|
35
|
+
/** `run watch <runId> [--after-cursor <cursor>]` */
|
|
36
|
+
export declare function runWatchCommand(args: readonly string[], deps: RunCommandDeps): Promise<void>;
|
|
37
|
+
/** Registers `run` (dispatching `start`/`list`/`cancel`/`watch` on the first remaining token) against `registry`. */
|
|
38
|
+
export declare function registerRunCommands(registry: CommandRegistry, deps: RunCommandDeps): void;
|
|
39
|
+
//# sourceMappingURL=run-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../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AE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBjI;AAED,oDAAoD;AACpD,wBAAsB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAWlG;AAED,qHAAqH;AACrH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CA2BzF"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module run-command
|
|
3
|
+
*
|
|
4
|
+
* `run start` / `run list` / `run get` / `run cancel` / `run watch` — the
|
|
5
|
+
* first concrete commands registered against this package's
|
|
6
|
+
* `CommandRegistry` (`command-registry.ts`'s own docblock notes none existed
|
|
7
|
+
* yet because no HTTP-client-mode pack had landed to call). Built directly
|
|
8
|
+
* against `@jini-ai/http`'s real run transport (`packages/http/src/runs.ts`:
|
|
9
|
+
* `POST /api/runs`, `GET /api/runs`, `GET /api/runs/:runId`,
|
|
10
|
+
* `POST /api/runs/:runId/cancel`, `GET /api/runs/:runId/events` SSE) — a
|
|
11
|
+
* thin HTTP-transport-mode CLI over the kernel's own `Run` noun, with no
|
|
12
|
+
* project/agent/plugin vocabulary anywhere in this file.
|
|
13
|
+
*
|
|
14
|
+
* Every network call goes through this package's already-hardened
|
|
15
|
+
* `postJsonToDaemon`/`getJsonFromDaemon` (bounded timeout, response-size cap,
|
|
16
|
+
* structured-error mapping, redaction) — nothing here re-implements that.
|
|
17
|
+
* `run watch`'s SSE consumption is new (this package's own `source-map.md`
|
|
18
|
+
* calls the mechanics — GET an SSE endpoint, translate frames to one NDJSON
|
|
19
|
+
* line per event on stdout, stop at a terminal `'end'` event — a clean
|
|
20
|
+
* pattern that had no route to call until now).
|
|
21
|
+
*/
|
|
22
|
+
import { parseFlags, positionalArgs } from './flags.js';
|
|
23
|
+
import { exitWithStructuredError, structuredHttpFailure } from './errors.js';
|
|
24
|
+
import { getJsonFromDaemon, postJsonToDaemon } from './http.js';
|
|
25
|
+
import { sanitizeUntrustedText, stripControlSequences } from './redact.js';
|
|
26
|
+
import { renderUsage } from './usage.js';
|
|
27
|
+
function defaultWrite(text) {
|
|
28
|
+
process.stdout.write(text);
|
|
29
|
+
}
|
|
30
|
+
function defaultWriteErr(text) {
|
|
31
|
+
process.stderr.write(text);
|
|
32
|
+
}
|
|
33
|
+
const RUN_START_USAGE = renderUsage({
|
|
34
|
+
usage: ['run start --context-ref <ref> [--agent-id <id>] [--idempotency-key <key>]'],
|
|
35
|
+
description: 'Starts a new run for the given contextRef.',
|
|
36
|
+
options: [
|
|
37
|
+
{ flag: '--context-ref', description: 'Opaque caller-supplied identity the run belongs to (required).' },
|
|
38
|
+
{ flag: '--agent-id', description: 'Which registered agent should drive this run.' },
|
|
39
|
+
{ flag: '--idempotency-key', description: 'Starting twice with the same key returns the original run.' },
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
const RUN_LIST_USAGE = renderUsage({
|
|
43
|
+
usage: ['run list [--context-ref <ref>]'],
|
|
44
|
+
description: 'Lists runs, optionally scoped to a contextRef.',
|
|
45
|
+
options: [{ flag: '--context-ref', description: 'Only list runs belonging to this contextRef.' }],
|
|
46
|
+
});
|
|
47
|
+
const RUN_GET_USAGE = renderUsage({
|
|
48
|
+
usage: ['run get <runId>'],
|
|
49
|
+
description: 'Fetches a single run by id.',
|
|
50
|
+
});
|
|
51
|
+
const RUN_CANCEL_USAGE = renderUsage({
|
|
52
|
+
usage: ['run cancel <runId> [--reason <text>]'],
|
|
53
|
+
description: 'Requests cancellation of an in-progress run. A no-op on an already-terminal run.',
|
|
54
|
+
options: [{ flag: '--reason', description: 'Optional human-readable cancellation reason.' }],
|
|
55
|
+
});
|
|
56
|
+
const RUN_WATCH_USAGE = renderUsage({
|
|
57
|
+
usage: ['run watch <runId> [--after-cursor <cursor>]'],
|
|
58
|
+
description: 'Streams a run\'s protocol events as one NDJSON line per event on stdout until a terminal event arrives.',
|
|
59
|
+
options: [{ flag: '--after-cursor', description: 'Resume streaming after this event cursor (reconnect support).' }],
|
|
60
|
+
});
|
|
61
|
+
const RUN_USAGE = renderUsage({
|
|
62
|
+
usage: ['run <start|list|get|cancel|watch> ...'],
|
|
63
|
+
description: 'Manage runs against a Jini daemon over HTTP.',
|
|
64
|
+
});
|
|
65
|
+
/** Builds `{write, exit, exitCodes?}` for `errors.ts`'s structured-error helpers, never assigning `exitCodes` when unset (required under `exactOptionalPropertyTypes`). */
|
|
66
|
+
function errorOptions(deps) {
|
|
67
|
+
return {
|
|
68
|
+
write: deps.writeErr ?? defaultWriteErr,
|
|
69
|
+
exit: deps.exit ?? ((code) => process.exit(code)),
|
|
70
|
+
...(deps.exitCodes !== undefined ? { exitCodes: deps.exitCodes } : {}),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Builds the transport-call options object for `postJsonToDaemon`/`getJsonFromDaemon`, only ever including a key when its value is actually set. */
|
|
74
|
+
function transportOptions(deps) {
|
|
75
|
+
return {
|
|
76
|
+
...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),
|
|
77
|
+
...(deps.writeErr !== undefined ? { write: deps.writeErr } : {}),
|
|
78
|
+
...(deps.exit !== undefined ? { exit: deps.exit } : {}),
|
|
79
|
+
...(deps.exitCodes !== undefined ? { exitCodes: deps.exitCodes } : {}),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function missingInput(deps, message) {
|
|
83
|
+
return exitWithStructuredError({ code: 'missing-input', message }, errorOptions(deps));
|
|
84
|
+
}
|
|
85
|
+
function invalidFlag(deps, message) {
|
|
86
|
+
return exitWithStructuredError({ code: 'invalid-flag', message }, errorOptions(deps));
|
|
87
|
+
}
|
|
88
|
+
function printJsonResult(deps, value) {
|
|
89
|
+
(deps.write ?? defaultWrite)(`${JSON.stringify(value)}\n`);
|
|
90
|
+
}
|
|
91
|
+
async function resolveBaseUrl(deps) {
|
|
92
|
+
return deps.resolveBaseUrl();
|
|
93
|
+
}
|
|
94
|
+
/** `run start --context-ref <ref> [--agent-id <id>] [--idempotency-key <key>]` */
|
|
95
|
+
export async function runStartCommand(args, deps) {
|
|
96
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
97
|
+
(deps.write ?? defaultWrite)(`${RUN_START_USAGE}\n`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const flags = parseFlags(args, { string: new Set(['context-ref', 'agent-id', 'idempotency-key']) });
|
|
101
|
+
const contextRef = flags['context-ref'];
|
|
102
|
+
if (typeof contextRef !== 'string' || contextRef.length === 0) {
|
|
103
|
+
missingInput(deps, '--context-ref is required');
|
|
104
|
+
}
|
|
105
|
+
const body = { contextRef };
|
|
106
|
+
if (typeof flags['agent-id'] === 'string')
|
|
107
|
+
body.agentId = flags['agent-id'];
|
|
108
|
+
if (typeof flags['idempotency-key'] === 'string')
|
|
109
|
+
body.idempotencyKey = flags['idempotency-key'];
|
|
110
|
+
const baseUrl = await resolveBaseUrl(deps);
|
|
111
|
+
const result = await postJsonToDaemon(baseUrl, '/api/runs', body, transportOptions(deps));
|
|
112
|
+
printJsonResult(deps, result);
|
|
113
|
+
}
|
|
114
|
+
/** `run list [--context-ref <ref>]` */
|
|
115
|
+
export async function runListCommand(args, deps) {
|
|
116
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
117
|
+
(deps.write ?? defaultWrite)(`${RUN_LIST_USAGE}\n`);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const flags = parseFlags(args, { string: new Set(['context-ref']) });
|
|
121
|
+
const contextRef = flags['context-ref'];
|
|
122
|
+
const route = typeof contextRef === 'string' && contextRef.length > 0
|
|
123
|
+
? `/api/runs?contextRef=${encodeURIComponent(contextRef)}`
|
|
124
|
+
: '/api/runs';
|
|
125
|
+
const baseUrl = await resolveBaseUrl(deps);
|
|
126
|
+
const result = await getJsonFromDaemon(baseUrl, route, transportOptions(deps));
|
|
127
|
+
printJsonResult(deps, result);
|
|
128
|
+
}
|
|
129
|
+
/** `run get <runId>` */
|
|
130
|
+
export async function runGetCommand(args, deps) {
|
|
131
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
132
|
+
(deps.write ?? defaultWrite)(`${RUN_GET_USAGE}\n`);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const runId = positionalArgs(args)[0];
|
|
136
|
+
if (typeof runId !== 'string' || runId.length === 0) {
|
|
137
|
+
missingInput(deps, 'runId is required: run get <runId>');
|
|
138
|
+
}
|
|
139
|
+
const baseUrl = await resolveBaseUrl(deps);
|
|
140
|
+
const result = await getJsonFromDaemon(baseUrl, `/api/runs/${encodeURIComponent(runId)}`, transportOptions(deps));
|
|
141
|
+
printJsonResult(deps, result);
|
|
142
|
+
}
|
|
143
|
+
/** `run cancel <runId> [--reason <text>]` */
|
|
144
|
+
export async function runCancelCommand(args, deps) {
|
|
145
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
146
|
+
(deps.write ?? defaultWrite)(`${RUN_CANCEL_USAGE}\n`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const flags = parseFlags(args, { string: new Set(['reason']) });
|
|
150
|
+
const runId = positionalArgs(args, { string: new Set(['reason']) })[0];
|
|
151
|
+
if (typeof runId !== 'string' || runId.length === 0) {
|
|
152
|
+
missingInput(deps, 'runId is required: run cancel <runId>');
|
|
153
|
+
}
|
|
154
|
+
const body = {};
|
|
155
|
+
if (typeof flags.reason === 'string')
|
|
156
|
+
body.reason = flags.reason;
|
|
157
|
+
const baseUrl = await resolveBaseUrl(deps);
|
|
158
|
+
const result = await postJsonToDaemon(baseUrl, `/api/runs/${encodeURIComponent(runId)}/cancel`, body, transportOptions(deps));
|
|
159
|
+
printJsonResult(deps, result);
|
|
160
|
+
}
|
|
161
|
+
/** Cap on total buffered-but-not-yet-frame-terminated SSE bytes — a daemon that never sends a blank-line frame terminator must not grow this without bound (mirrors `http.ts`'s `readJsonWithLimit` byte cap). */
|
|
162
|
+
const MAX_SSE_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
163
|
+
function parseSseFrame(rawFrame) {
|
|
164
|
+
let id;
|
|
165
|
+
let eventName;
|
|
166
|
+
const dataLines = [];
|
|
167
|
+
for (const line of rawFrame.split('\n')) {
|
|
168
|
+
if (line.startsWith('id: '))
|
|
169
|
+
id = line.slice(4);
|
|
170
|
+
else if (line.startsWith('event: '))
|
|
171
|
+
eventName = line.slice(7);
|
|
172
|
+
else if (line.startsWith('data: '))
|
|
173
|
+
dataLines.push(line.slice(6));
|
|
174
|
+
}
|
|
175
|
+
if (dataLines.length === 0)
|
|
176
|
+
return null;
|
|
177
|
+
return { ...(id !== undefined ? { id } : {}), ...(eventName !== undefined ? { event: eventName } : {}), data: dataLines.join('\n') };
|
|
178
|
+
}
|
|
179
|
+
/** Reads `body` as an SSE byte stream and yields one {@link SseFrame} per blank-line-terminated frame. */
|
|
180
|
+
async function* readSseFrames(body) {
|
|
181
|
+
const reader = body.getReader();
|
|
182
|
+
const decoder = new TextDecoder();
|
|
183
|
+
let buffer = '';
|
|
184
|
+
try {
|
|
185
|
+
for (;;) {
|
|
186
|
+
const { done, value } = await reader.read();
|
|
187
|
+
if (done)
|
|
188
|
+
break;
|
|
189
|
+
if (value !== undefined)
|
|
190
|
+
buffer += decoder.decode(value, { stream: true });
|
|
191
|
+
if (buffer.length > MAX_SSE_BUFFER_BYTES) {
|
|
192
|
+
throw new Error(`SSE stream exceeded the ${MAX_SSE_BUFFER_BYTES}-byte unterminated-frame buffer limit`);
|
|
193
|
+
}
|
|
194
|
+
let sepIndex;
|
|
195
|
+
while ((sepIndex = buffer.indexOf('\n\n')) >= 0) {
|
|
196
|
+
const rawFrame = buffer.slice(0, sepIndex);
|
|
197
|
+
buffer = buffer.slice(sepIndex + 2);
|
|
198
|
+
const frame = parseSseFrame(rawFrame);
|
|
199
|
+
if (frame !== null)
|
|
200
|
+
yield frame;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
reader.releaseLock();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/** True when a parsed SSE frame's `data` is the canonical `RunProtocolEvent` terminal `'end'` event. */
|
|
209
|
+
function isTerminalEventFrame(frame) {
|
|
210
|
+
try {
|
|
211
|
+
const parsed = JSON.parse(frame.data);
|
|
212
|
+
return parsed.kind === 'end';
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Streams `GET /api/runs/:runId/events` and writes one NDJSON line per event to `deps.write`,
|
|
220
|
+
* stopping once a terminal `'end'` event arrives (or the stream closes on its own). Each frame's
|
|
221
|
+
* `data` is stripped of terminal control sequences before being written — it originates from a
|
|
222
|
+
* prompt-influenced agent run and is not trusted to be safe to print verbatim (same posture as
|
|
223
|
+
* `redact.ts`'s other daemon-sourced-text handling), though it is not truncated or secret-redacted
|
|
224
|
+
* the way a diagnostic error message is, since it is the run's actual event payload, not incidental
|
|
225
|
+
* error detail.
|
|
226
|
+
*/
|
|
227
|
+
export async function watchRunEvents(baseUrl, runId, args, deps) {
|
|
228
|
+
const flags = parseFlags(args, { string: new Set(['after-cursor']) });
|
|
229
|
+
const afterCursor = flags['after-cursor'];
|
|
230
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
231
|
+
const write = deps.write ?? defaultWrite;
|
|
232
|
+
const headers = {};
|
|
233
|
+
if (typeof afterCursor === 'string' && afterCursor.length > 0)
|
|
234
|
+
headers['last-event-id'] = afterCursor;
|
|
235
|
+
const resp = await fetchImpl(`${baseUrl}/api/runs/${encodeURIComponent(runId)}/events`, { headers });
|
|
236
|
+
if (!resp.ok || resp.body === null) {
|
|
237
|
+
return structuredHttpFailure(resp, 'daemon-not-running', errorOptions(deps));
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
for await (const frame of readSseFrames(resp.body)) {
|
|
241
|
+
write(`${stripControlSequences(frame.data)}\n`);
|
|
242
|
+
if (isTerminalEventFrame(frame))
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
// A broken/hostile stream (e.g. the unbounded-buffer guard above) must exit through the same
|
|
248
|
+
// structured contract as every other failure here, not surface as an unhandled rejection.
|
|
249
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
250
|
+
return exitWithStructuredError({ code: 'daemon-not-running', message: sanitizeUntrustedText(message) }, errorOptions(deps));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/** `run watch <runId> [--after-cursor <cursor>]` */
|
|
254
|
+
export async function runWatchCommand(args, deps) {
|
|
255
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
256
|
+
(deps.write ?? defaultWrite)(`${RUN_WATCH_USAGE}\n`);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const runId = positionalArgs(args, { string: new Set(['after-cursor']) })[0];
|
|
260
|
+
if (typeof runId !== 'string' || runId.length === 0) {
|
|
261
|
+
missingInput(deps, 'runId is required: run watch <runId>');
|
|
262
|
+
}
|
|
263
|
+
const baseUrl = await resolveBaseUrl(deps);
|
|
264
|
+
await watchRunEvents(baseUrl, runId, args, deps);
|
|
265
|
+
}
|
|
266
|
+
/** Registers `run` (dispatching `start`/`list`/`cancel`/`watch` on the first remaining token) against `registry`. */
|
|
267
|
+
export function registerRunCommands(registry, deps) {
|
|
268
|
+
registry.add('run', async (args) => {
|
|
269
|
+
const [sub, ...rest] = args;
|
|
270
|
+
switch (sub) {
|
|
271
|
+
case 'start':
|
|
272
|
+
return runStartCommand(rest, deps);
|
|
273
|
+
case 'list':
|
|
274
|
+
return runListCommand(rest, deps);
|
|
275
|
+
case 'get':
|
|
276
|
+
return runGetCommand(rest, deps);
|
|
277
|
+
case 'cancel':
|
|
278
|
+
return runCancelCommand(rest, deps);
|
|
279
|
+
case 'watch':
|
|
280
|
+
return runWatchCommand(rest, deps);
|
|
281
|
+
case undefined:
|
|
282
|
+
case '--help':
|
|
283
|
+
case '-h':
|
|
284
|
+
(deps.write ?? defaultWrite)(`${RUN_USAGE}\n`);
|
|
285
|
+
return;
|
|
286
|
+
default:
|
|
287
|
+
invalidFlag(deps, `unknown "run" subcommand: ${sub}`);
|
|
288
|
+
}
|
|
289
|
+
}, { usage: RUN_USAGE });
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=run-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.js","sourceRoot":"","sources":["../src/run-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAsB,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAkBzC,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,eAAe,GAAG,WAAW,CAAC;IAClC,KAAK,EAAE,CAAC,2EAA2E,CAAC;IACpF,WAAW,EAAE,4CAA4C;IACzD,OAAO,EAAE;QACP,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,gEAAgE,EAAE;QACxG,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,+CAA+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
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@jini-ai/core` DI token for this package's one composable service, per
|
|
3
|
+
* extraction-plan §2.2 ("Kernel exports only kernel-service tokens... every
|
|
4
|
+
* other token lives in its owning feature package") and following the
|
|
5
|
+
* `XToken` naming precedent set by `packages/daemon/src/tokens.ts`. A pack's
|
|
6
|
+
* `cli` registrar (`Pack['cli']` in `packages/core/src/pack.ts`) resolves
|
|
7
|
+
* this token to get the concrete `CommandRegistry` it registers its own
|
|
8
|
+
* subcommands against.
|
|
9
|
+
*/
|
|
10
|
+
import { token } from '@jini-ai/core';
|
|
11
|
+
export const CommandRegistryToken = token('jini.cli.commandRegistry');
|
|
12
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAkB,0BAA0B,CAAC,CAAC"}
|
package/dist/usage.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module usage
|
|
3
|
+
*
|
|
4
|
+
* The generic *shape* of every OD `print*Help` function, extracted from
|
|
5
|
+
* `apps/daemon/src/cli.ts` (see `source-map.md`): one or more usage
|
|
6
|
+
* invocation lines, an optional prose description, and an optional flat
|
|
7
|
+
* list of `--option` descriptions. OD's actual help text is 100% product
|
|
8
|
+
* content and was not ported — only the rendering convention.
|
|
9
|
+
*/
|
|
10
|
+
export interface UsageOption {
|
|
11
|
+
flag: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
export interface UsageSpec {
|
|
15
|
+
/** One or more `cmd sub <arg>` invocation lines. */
|
|
16
|
+
usage: readonly string[];
|
|
17
|
+
/** Optional prose shown after the usage lines. */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Optional flat `--flag` reference list. */
|
|
20
|
+
options?: readonly UsageOption[];
|
|
21
|
+
}
|
|
22
|
+
/** Render a {@link UsageSpec} into the "Usage:\n ...\n\nOptions:\n ..." text every OD help command used. */
|
|
23
|
+
export declare function renderUsage(spec: UsageSpec): string;
|
|
24
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../src/usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAClC;AAED,8GAA8G;AAC9G,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAgBnD"}
|
package/dist/usage.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module usage
|
|
3
|
+
*
|
|
4
|
+
* The generic *shape* of every OD `print*Help` function, extracted from
|
|
5
|
+
* `apps/daemon/src/cli.ts` (see `source-map.md`): one or more usage
|
|
6
|
+
* invocation lines, an optional prose description, and an optional flat
|
|
7
|
+
* list of `--option` descriptions. OD's actual help text is 100% product
|
|
8
|
+
* content and was not ported — only the rendering convention.
|
|
9
|
+
*/
|
|
10
|
+
/** Render a {@link UsageSpec} into the "Usage:\n ...\n\nOptions:\n ..." text every OD help command used. */
|
|
11
|
+
export function renderUsage(spec) {
|
|
12
|
+
const lines = ['Usage:', ...spec.usage.map((line) => ` ${line}`)];
|
|
13
|
+
if (spec.description !== undefined && spec.description.length > 0) {
|
|
14
|
+
lines.push('', spec.description);
|
|
15
|
+
}
|
|
16
|
+
if (spec.options !== undefined && spec.options.length > 0) {
|
|
17
|
+
const longest = Math.max(...spec.options.map((option) => option.flag.length));
|
|
18
|
+
lines.push('', 'Options:');
|
|
19
|
+
for (const option of spec.options) {
|
|
20
|
+
lines.push(` ${option.flag.padEnd(longest)} ${option.description}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return lines.join('\n');
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../src/usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,8GAA8G;AAC9G,MAAM,UAAU,WAAW,CAAC,IAAe;IACzC,MAAM,KAAK,GAAa,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAE7E,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9E,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC3B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module version-command
|
|
3
|
+
*
|
|
4
|
+
* `version` — prints just the running daemon's version string. Sourced from
|
|
5
|
+
* `GET /api/daemon/status`'s `version` field (`packages/http/src/daemon-status.ts`,
|
|
6
|
+
* `DaemonStatusResponse.version`) — the same route `daemon-command.ts`'s `daemon status`
|
|
7
|
+
* already calls. `packages/cli/source-map.md`'s original UNCLEAR verdict on a standalone
|
|
8
|
+
* `version` command noted "@jini-ai/http has no version route yet ... nothing to call"; that
|
|
9
|
+
* blocker never actually required a *separate* route — `daemonStatusRoute`'s response body
|
|
10
|
+
* already carries a `version` field, so no new HTTP route was added for this command. It just
|
|
11
|
+
* extracts and prints that one field instead of the full status envelope `daemon status` prints.
|
|
12
|
+
*
|
|
13
|
+
* Same DI/testing/`resolveBaseUrl` conventions as `daemon-command.ts`'s `daemon status`/`daemon
|
|
14
|
+
* stop` (this file duplicates rather than imports their small `errorOptions`/`transportOptions`
|
|
15
|
+
* helpers, matching that file's own precedent of each command module owning its own copy rather
|
|
16
|
+
* than sharing a not-otherwise-needed abstraction across files).
|
|
17
|
+
*/
|
|
18
|
+
import { type ExitCodeTable } from './errors.js';
|
|
19
|
+
import type { CommandRegistry } from './command-registry.js';
|
|
20
|
+
export interface VersionCommandDeps {
|
|
21
|
+
/** Resolves the daemon HTTP base URL once per command invocation (e.g. wraps `resolveDaemonUrl`). */
|
|
22
|
+
resolveBaseUrl: () => Promise<string> | string;
|
|
23
|
+
/** Defaults to `process.stdout.write`; inject for tests. Used for the printed version string. */
|
|
24
|
+
write?: (text: string) => void;
|
|
25
|
+
/** Defaults to `process.stderr.write`; inject for tests. Used for usage/validation errors. */
|
|
26
|
+
writeErr?: (text: string) => void;
|
|
27
|
+
/** Defaults to the global `fetch`; inject for tests. */
|
|
28
|
+
fetchImpl?: typeof fetch;
|
|
29
|
+
/** Defaults to `process.exit`; inject for tests (must not return). */
|
|
30
|
+
exit?: (code: number) => never;
|
|
31
|
+
/** Extra/overriding `code -> exitCode` entries layered on the package default table. */
|
|
32
|
+
exitCodes?: ExitCodeTable;
|
|
33
|
+
}
|
|
34
|
+
/** `version` */
|
|
35
|
+
export declare function versionCommand(args: readonly string[], deps: VersionCommandDeps): Promise<void>;
|
|
36
|
+
/** Registers `version` against `registry`. */
|
|
37
|
+
export declare function registerVersionCommand(registry: CommandRegistry, deps: VersionCommandDeps): void;
|
|
38
|
+
//# sourceMappingURL=version-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-command.d.ts","sourceRoot":"","sources":["../src/version-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAG1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,qGAAqG;IACrG,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC/C,iGAAiG;IACjG,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,sEAAsE;IACtE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;IAC/B,wFAAwF;IACxF,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AAyDD,gBAAgB;AAChB,wBAAsB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CASrG;AAED,8CAA8C;AAC9C,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAEhG"}
|