@agentdocumentformat/cli 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -21
- package/dist/adf.mjs +8 -6
- package/dist/chunks/{App-L5L37JI5.mjs → App-QMFRLBPQ.mjs} +1766 -1667
- package/dist/chunks/{adf-schema-JRU2BTOG.mjs → adf-schema-US4NFHMR.mjs} +2 -2
- package/dist/chunks/{chunk-4MQPTCXY.mjs → chunk-2WSQ7V6K.mjs} +1 -1
- package/dist/chunks/{chunk-X34PDRUH.mjs → chunk-3UCKYP7P.mjs} +55 -7
- package/dist/chunks/{chunk-WFQUVXML.mjs → chunk-CD3ATSXE.mjs} +6 -1
- package/dist/chunks/chunk-GKKCMXIZ.mjs +94 -0
- package/dist/chunks/{chunk-HWLWPXQ7.mjs → chunk-HDBPBORT.mjs} +7 -2
- package/dist/chunks/{chunk-3M4ZPOA3.mjs → chunk-J74STFKE.mjs} +35 -6
- package/dist/chunks/{chunk-TMT32MXT.mjs → chunk-TPRZQ7Z4.mjs} +1 -1
- package/dist/chunks/chunk-UEZR2CNS.mjs +65 -0
- package/dist/chunks/{chunk-7MTRVW2U.mjs → chunk-ZROSGV65.mjs} +16 -7
- package/dist/chunks/{cli-TCMBNZF6.mjs → cli-ZGVQRVSQ.mjs} +48 -22
- package/dist/chunks/{commands-DTEKM4ZL.mjs → commands-XNJMCD5L.mjs} +2 -2
- package/dist/chunks/{daemon-ZC3FZ2P4.mjs → daemon-G6OQZER2.mjs} +16380 -3911
- package/dist/chunks/{daemon-control-WDX7PMTC.mjs → daemon-control-HKFVSQTQ.mjs} +27 -9
- package/dist/chunks/{pipeline-executor-BHBSJX2K.mjs → pipeline-executor-U6IMCCP3.mjs} +3 -3
- package/dist/chunks/{store-WR7TZJZS.mjs → store-HUVDJPYN.mjs} +1 -1
- package/dist/chunks/{tui-ODVYUIMT.mjs → tui-LWLJUXZ3.mjs} +8 -7
- package/package.json +1 -1
- package/dist/chunks/chunk-G426FACA.mjs +0 -49
|
@@ -14,9 +14,14 @@ import {
|
|
|
14
14
|
import "./chunk-2NAP2ZF7.mjs";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_DAEMON_URL,
|
|
17
|
+
isLocalDaemonUrl,
|
|
18
|
+
localProofHeaders,
|
|
19
|
+
loopbackPort,
|
|
17
20
|
resolveDaemonToken,
|
|
18
|
-
resolveDaemonUrl
|
|
19
|
-
|
|
21
|
+
resolveDaemonUrl,
|
|
22
|
+
tunnelTokenHint
|
|
23
|
+
} from "./chunk-GKKCMXIZ.mjs";
|
|
24
|
+
import "./chunk-UEZR2CNS.mjs";
|
|
20
25
|
import "./chunk-IHDDCZBS.mjs";
|
|
21
26
|
import "./chunk-M2RX3S2T.mjs";
|
|
22
27
|
|
|
@@ -39,7 +44,7 @@ function tuiInvocation(argv) {
|
|
|
39
44
|
return argv.filter((a) => a !== "--json");
|
|
40
45
|
}
|
|
41
46
|
async function defaultLaunchTui(argv) {
|
|
42
|
-
let { runTui } = await import("./tui-
|
|
47
|
+
let { runTui } = await import("./tui-LWLJUXZ3.mjs");
|
|
43
48
|
return await runTui(argv);
|
|
44
49
|
}
|
|
45
50
|
function urlFromArgv(argv) {
|
|
@@ -221,11 +226,16 @@ async function requestJson(io, options, path, init) {
|
|
|
221
226
|
headers: {
|
|
222
227
|
...init?.headers ?? {},
|
|
223
228
|
Accept: "application/json",
|
|
224
|
-
...authHeader(options)
|
|
229
|
+
...authHeader(options),
|
|
230
|
+
...localProofHeaders(options.daemonUrl, path)
|
|
225
231
|
}
|
|
226
232
|
});
|
|
227
233
|
} catch (err) {
|
|
228
|
-
|
|
234
|
+
if (err instanceof TypeError) {
|
|
235
|
+
let forwarded = loopbackPort(options.daemonUrl) !== null && !isLocalDaemonUrl(options.daemonUrl);
|
|
236
|
+
throw new Error(`Cannot reach the ADF daemon at ${options.daemonUrl} (${err.message}). ${forwarded ? "That is not this machine's daemon port, so adf did not start one there: check the SSH tunnel, or start a daemon on it with: adf daemon start --port <n>" : "Start it with: adf daemon start"}`);
|
|
237
|
+
}
|
|
238
|
+
throw err;
|
|
229
239
|
}
|
|
230
240
|
let text = await response.text(), body = null;
|
|
231
241
|
if (text.trim())
|
|
@@ -235,8 +245,9 @@ async function requestJson(io, options, path, init) {
|
|
|
235
245
|
body = text;
|
|
236
246
|
}
|
|
237
247
|
if (!response.ok) {
|
|
238
|
-
let message = isRecord(body) && typeof body.error == "string" ? body.error : `HTTP ${response.status} ${response.statusText}
|
|
239
|
-
throw new Error(message
|
|
248
|
+
let message = isRecord(body) && typeof body.error == "string" ? body.error : `HTTP ${response.status} ${response.statusText}`, hint = response.status === 401 ? tunnelTokenHint(options.daemonUrl, options.token) : null;
|
|
249
|
+
throw new Error(hint ? `${message}
|
|
250
|
+
${hint}` : message);
|
|
240
251
|
}
|
|
241
252
|
return body;
|
|
242
253
|
}
|
|
@@ -421,8 +432,9 @@ async function streamEvents(io, options, args) {
|
|
|
421
432
|
headers: { Accept: "text/event-stream", ...authHeader(options) }
|
|
422
433
|
});
|
|
423
434
|
if (!response.ok || !response.body) {
|
|
424
|
-
let detail = await response.json().catch(() => null);
|
|
425
|
-
throw new Error(`Event stream failed: ${typeof detail?.error == "string" ? detail.error : `HTTP ${response.status} ${response.statusText}`}`
|
|
435
|
+
let detail = await response.json().catch(() => null), hint = response.status === 401 ? tunnelTokenHint(options.daemonUrl, options.token) : null;
|
|
436
|
+
throw new Error(`Event stream failed: ${typeof detail?.error == "string" ? detail.error : `HTTP ${response.status} ${response.statusText}`}${hint ? `
|
|
437
|
+
${hint}` : ""}`);
|
|
426
438
|
}
|
|
427
439
|
let reader = response.body.getReader(), decoder = new TextDecoder(), buffer = "";
|
|
428
440
|
for (; ; ) {
|
|
@@ -434,17 +446,29 @@ async function streamEvents(io, options, args) {
|
|
|
434
446
|
for (let part of parts) {
|
|
435
447
|
let dataLine = part.split(/\n/).find((line) => line.startsWith("data: "));
|
|
436
448
|
if (!dataLine) continue;
|
|
437
|
-
let payload = dataLine.slice(6);
|
|
438
|
-
if (
|
|
449
|
+
let payload = dataLine.slice(6), name = part.split(/\n/).find((line) => line.startsWith("event: "))?.slice(7);
|
|
450
|
+
if (name !== "stream.hello") {
|
|
451
|
+
if (name === "stream.gap") {
|
|
452
|
+
let reason = "unknown";
|
|
453
|
+
try {
|
|
454
|
+
reason = String(JSON.parse(payload).reason);
|
|
455
|
+
} catch {
|
|
456
|
+
}
|
|
457
|
+
io.stderr(`Some events were not replayed (${reason === "epoch_changed" ? "the daemon restarted" : "the replay buffer moved past them"}).
|
|
439
458
|
`);
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
if (options.json) io.stdout(`${payload}
|
|
443
462
|
`);
|
|
444
|
-
|
|
445
|
-
|
|
463
|
+
else
|
|
464
|
+
try {
|
|
465
|
+
io.stdout(`${formatEvent(JSON.parse(payload))}
|
|
446
466
|
`);
|
|
447
|
-
|
|
467
|
+
} catch {
|
|
468
|
+
io.stdout(`${payload}
|
|
469
|
+
`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
448
472
|
}
|
|
449
473
|
}
|
|
450
474
|
return 0;
|
|
@@ -920,12 +944,14 @@ function usage() {
|
|
|
920
944
|
|
|
921
945
|
Usage: adf [--url <daemon-url>] [--json] <command>
|
|
922
946
|
adf [tui] [--view <id>] [--agent <id>] [--loop <name>]
|
|
923
|
-
adf daemon [start|status|stop|restart|logs]
|
|
947
|
+
adf daemon [start|status|stop|restart|logs|token]
|
|
924
948
|
|
|
925
949
|
With no command, adf opens the terminal app (see \`adf tui --help\`).
|
|
926
|
-
When the daemon URL is
|
|
927
|
-
|
|
928
|
-
|
|
950
|
+
When the daemon URL is this machine's daemon (127.0.0.1 or localhost on
|
|
951
|
+
port 7385 or ADF_DAEMON_PORT) and nothing answers there, adf starts the
|
|
952
|
+
daemon in the background first (--no-daemon or ADF_NO_AUTOSTART=1 turn
|
|
953
|
+
that off). Quitting leaves it running. Another local port, such as an SSH
|
|
954
|
+
tunnel, is never auto-started and needs --token.
|
|
929
955
|
|
|
930
956
|
Commands:
|
|
931
957
|
tui The terminal app (the default)
|
|
@@ -1013,7 +1039,7 @@ Daemon:
|
|
|
1013
1039
|
Options:
|
|
1014
1040
|
--url, -u <url> Daemon URL
|
|
1015
1041
|
--token <token> Daemon access token (default: ADF_DAEMON_TOKEN,
|
|
1016
|
-
else
|
|
1042
|
+
else the local daemon's token file)
|
|
1017
1043
|
--json JSON output
|
|
1018
1044
|
--no-daemon Never start the daemon automatically
|
|
1019
1045
|
--version, -v Print the version
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
getCommand,
|
|
10
10
|
hasCommand,
|
|
11
11
|
registry
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-ZROSGV65.mjs";
|
|
13
|
+
import "./chunk-CD3ATSXE.mjs";
|
|
14
14
|
import "./chunk-M2RX3S2T.mjs";
|
|
15
15
|
export {
|
|
16
16
|
registry as commandRegistry,
|