@agentdocumentformat/cli 0.7.8 → 0.8.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/README.md +1 -1
- package/dist/adf.mjs +59 -8
- package/dist/chunks/{APEv2Parser-2CNNHMXV.mjs → APEv2Parser-WIXRJLHB.mjs} +2 -2
- package/dist/chunks/{AiffParser-7BR4RL6G.mjs → AiffParser-ZC4QFOVJ.mjs} +5 -5
- package/dist/chunks/{App-7RIIOHJJ.mjs → App-A5GUFCFJ.mjs} +279 -293
- package/dist/chunks/{DsdiffParser-CMD4AX7A.mjs → DsdiffParser-UAPAJHFX.mjs} +5 -5
- package/dist/chunks/{DsfParser-UOGZDS2M.mjs → DsfParser-NNYZK2QX.mjs} +6 -6
- package/dist/chunks/{FlacParser-HB3T3CD4.mjs → FlacParser-MW2W4LO3.mjs} +6 -6
- package/dist/chunks/{MP4Parser-66HBRUSX.mjs → MP4Parser-Z57SYOOQ.mjs} +4 -4
- package/dist/chunks/{MpegParser-YW6LIUEW.mjs → MpegParser-XIIPAZVM.mjs} +7 -7
- package/dist/chunks/{MusepackParser-PAUSXP7D.mjs → MusepackParser-QWNDEYHJ.mjs} +6 -6
- package/dist/chunks/{OggParser-NUBV3GWC.mjs → OggParser-WRX53F77.mjs} +9 -9
- package/dist/chunks/{WavPackParser-WQAGT7TC.mjs → WavPackParser-MJ7WCSJ5.mjs} +2 -2
- package/dist/chunks/{WaveParser-EWLQVDX4.mjs → WaveParser-RAVLHZ5S.mjs} +7 -7
- package/dist/chunks/{adf-schema-US4NFHMR.mjs → adf-schema-YJSGLMA4.mjs} +2 -2
- package/dist/chunks/auth-manager-AJ32FZWS.mjs +19 -0
- package/dist/chunks/auth-manager-C5OBEQK2.mjs +18 -0
- package/dist/chunks/auth-manager-TBNKCJ45.mjs +17 -0
- package/dist/chunks/{chatgpt-subscription-E4MXTIAT.mjs → chatgpt-subscription-MMGNW5KJ.mjs} +5 -2
- package/dist/chunks/chunk-3UGZFWIF.mjs +26 -0
- package/dist/chunks/{chunk-5PO5PKRV.mjs → chunk-4OGZFUKA.mjs} +126 -67
- package/dist/chunks/{chunk-VN7UH7I5.mjs → chunk-6XQZGYMK.mjs} +246 -67
- package/dist/chunks/{chunk-XNPZBLYL.mjs → chunk-75DC5EWN.mjs} +13 -2
- package/dist/chunks/chunk-AZYOXXVL.mjs +865 -0
- package/dist/chunks/{chunk-6VQEXLE2.mjs → chunk-BHY7QDCM.mjs} +41 -3
- package/dist/chunks/chunk-C2S64Y6F.mjs +203 -0
- package/dist/chunks/chunk-C4GA5SI4.mjs +12799 -0
- package/dist/chunks/chunk-DDTTSKGG.mjs +2443 -0
- package/dist/chunks/{chunk-VAUOM3IN.mjs → chunk-DLWCKKIO.mjs} +1 -1
- package/dist/chunks/{chunk-QPLEAE6V.mjs → chunk-G6NBFYG5.mjs} +152 -824
- package/dist/chunks/{chunk-KXEF4F4E.mjs → chunk-GAZO6UMI.mjs} +1 -1
- package/dist/chunks/{chunk-XYTWGHFS.mjs → chunk-H3XLRWVE.mjs} +1 -1
- package/dist/chunks/{chunk-7T2YMTWL.mjs → chunk-H4C65MTP.mjs} +4 -4
- package/dist/chunks/chunk-HBOFZRUS.mjs +738 -0
- package/dist/chunks/chunk-JVPZIMXW.mjs +976 -0
- package/dist/chunks/{chunk-XYV3VCIX.mjs → chunk-JZFONJSL.mjs} +79 -20
- package/dist/chunks/chunk-KDDVQKCG.mjs +65 -0
- package/dist/chunks/chunk-KRPKWOMB.mjs +290 -0
- package/dist/chunks/{chunk-G6PH7RPW.mjs → chunk-LCMANRYY.mjs} +3 -3
- package/dist/chunks/{chunk-ZESQMP66.mjs → chunk-LGL6ML37.mjs} +3 -3
- package/dist/chunks/chunk-LKFHERRV.mjs +145 -0
- package/dist/chunks/chunk-LTX74NU6.mjs +29 -0
- package/dist/chunks/chunk-M2F7C2UJ.mjs +425 -0
- package/dist/chunks/{chunk-62NE4LG4.mjs → chunk-MQAMI5BF.mjs} +5 -5
- package/dist/chunks/chunk-MZRXFWPQ.mjs +278 -0
- package/dist/chunks/{chunk-PRMGZZM5.mjs → chunk-NZLEPJ5M.mjs} +2 -0
- package/dist/chunks/{chunk-CD3ATSXE.mjs → chunk-NZO5O4VN.mjs} +1 -1
- package/dist/chunks/{chunk-I3UYSITV.mjs → chunk-O7XKQ6CH.mjs} +1 -1
- package/dist/chunks/chunk-P3RG5LQA.mjs +244 -0
- package/dist/chunks/chunk-PAK5JCO2.mjs +48 -0
- package/dist/chunks/chunk-PC63YFB7.mjs +34 -0
- package/dist/chunks/{daemon-control-HKFVSQTQ.mjs → chunk-PRPTKMQW.mjs} +67 -26
- package/dist/chunks/{chunk-LFMB4PAA.mjs → chunk-TKXIH27X.mjs} +974 -113
- package/dist/chunks/{chunk-5W7KES6P.mjs → chunk-UZPDETEU.mjs} +1 -1
- package/dist/chunks/chunk-V2T6NZX2.mjs +517 -0
- package/dist/chunks/chunk-V3MM6PCH.mjs +366 -0
- package/dist/chunks/chunk-WJGPNHGX.mjs +67 -0
- package/dist/chunks/chunk-WVTPPOKK.mjs +290 -0
- package/dist/chunks/{chunk-J74STFKE.mjs → chunk-WX6QCUWI.mjs} +272 -51
- package/dist/chunks/{chunk-Y5ZLKFLE.mjs → chunk-XNNJQCZP.mjs} +196 -165
- package/dist/chunks/{chunk-HDBPBORT.mjs → chunk-XT2BJUFC.mjs} +15 -6
- package/dist/chunks/{chunk-HSBV6YFU.mjs → chunk-YRMKSHW3.mjs} +614 -92
- package/dist/chunks/{chunk-BNXUAOO4.mjs → chunk-ZGXUOAWZ.mjs} +3186 -959
- package/dist/chunks/chunk-ZPB3HYM7.mjs +45 -0
- package/dist/chunks/claude-subscription-33BMZB6I.mjs +29 -0
- package/dist/chunks/{cli-NMFIAR7Z.mjs → cli-I47IFDHJ.mjs} +797 -56
- package/dist/chunks/{commands-KPJWFRUE.mjs → commands-E4EQUHE5.mjs} +4 -3
- package/dist/chunks/{daemon-YDIK3AAM.mjs → daemon-FQ5BV3AP.mjs} +82058 -63958
- package/dist/chunks/daemon-control-L3CLG63P.mjs +59 -0
- package/dist/chunks/{daemon-token-WRSULP7G.mjs → daemon-token-L5QKTHU5.mjs} +3 -1
- package/dist/chunks/{discord-DSP4HUWI.mjs → discord-IR62565M.mjs} +3 -52
- package/dist/chunks/{email-BRG7KUO2.mjs → email-KHHTJBDW.mjs} +4 -2
- package/dist/chunks/{grok-subscription-4PYX7TBF.mjs → grok-subscription-E74FS5EG.mjs} +5 -2
- package/dist/chunks/{lib-N7FCZWKH.mjs → lib-L27L5PXM.mjs} +22 -22
- package/dist/chunks/{open-VAU7PXT6.mjs → open-TLGS2Z3Q.mjs} +4 -4
- package/dist/chunks/{parser-JVY2PWSM.mjs → parser-7GARNT5L.mjs} +1 -1
- package/dist/chunks/{pipeline-executor-O77NTGLP.mjs → pipeline-executor-FD4FBWQA.mjs} +6 -5
- package/dist/chunks/prompt-RRHZX4YT.mjs +13 -0
- package/dist/chunks/remote-access-cli-XXAPQWH6.mjs +268 -0
- package/dist/chunks/remote-hello-UFWUBDQI.mjs +37 -0
- package/dist/chunks/sdk-5FD2ZP7N.mjs +28422 -0
- package/dist/chunks/{slack-OCNNF4DX.mjs → slack-IYC5RAB5.mjs} +3 -4
- package/dist/chunks/{store-HUVDJPYN.mjs → store-ZRN2WCFB.mjs} +6 -3
- package/dist/chunks/tailscale-WLJATFMB.mjs +25 -0
- package/dist/chunks/{theme-SFE3JMA2.mjs → theme-HLBDTF6F.mjs} +1 -1
- package/dist/chunks/{themes-YLXLOIJF.mjs → themes-BQ72P446.mjs} +2 -2
- package/dist/chunks/{token-6G3HCMNX.mjs → token-6D22WECM.mjs} +20 -16
- package/dist/chunks/{token-util-UXYSDQIW.mjs → token-util-YF3ZWBZ4.mjs} +1 -2
- package/dist/chunks/{tui-UQJLK7XI.mjs → tui-SPSPDADM.mjs} +17 -14
- package/dist/chunks/{welcome-XHXFV7SH.mjs → welcome-J5JZZAM5.mjs} +1 -1
- package/dist/chunks/{whatsapp-AJMRQBT7.mjs → whatsapp-YJFFVN4Q.mjs} +9 -9
- package/package.json +1 -1
- package/dist/chunks/chunk-GKKCMXIZ.mjs +0 -94
- package/dist/chunks/chunk-IHDDCZBS.mjs +0 -112
- package/dist/chunks/chunk-KWFOS5WC.mjs +0 -41
- package/dist/chunks/chunk-UEZR2CNS.mjs +0 -65
- package/dist/chunks/chunk-VMHTYDH4.mjs +0 -172
- package/dist/chunks/chunk-Y2QA53AN.mjs +0 -259
- package/dist/chunks/{chunk-NBTUWMGP.mjs → chunk-2MTE22CR.mjs} +3 -3
- package/dist/chunks/{telegram-2EFGKIVK.mjs → telegram-JYY2VDTI.mjs} +5 -5
|
@@ -4,22 +4,25 @@ import { dirname as __adfDirname } from 'node:path';
|
|
|
4
4
|
const require = __adfCreateRequire(import.meta.url);
|
|
5
5
|
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
leaseDir,
|
|
9
|
+
listRuntimeHosts,
|
|
10
|
+
listStudioClients
|
|
11
|
+
} from "./chunk-JVPZIMXW.mjs";
|
|
7
12
|
import {
|
|
8
13
|
DEFAULT_DAEMON_PORT,
|
|
9
14
|
DEFAULT_DAEMON_URL,
|
|
10
15
|
isLocalDaemonUrl,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-UEZR2CNS.mjs";
|
|
16
|
+
localDaemonToken,
|
|
17
|
+
localProofHeaders
|
|
18
|
+
} from "./chunk-V2T6NZX2.mjs";
|
|
15
19
|
import {
|
|
16
20
|
defaultUserDataPath
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-M2RX3S2T.mjs";
|
|
21
|
+
} from "./chunk-PAK5JCO2.mjs";
|
|
19
22
|
|
|
20
23
|
// src/main/cli/daemon-control.ts
|
|
21
24
|
import { spawn, execFileSync } from "node:child_process";
|
|
22
|
-
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, rmSync, statSync, readSync } from "node:fs";
|
|
25
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, realpathSync, rmSync, statSync, readSync } from "node:fs";
|
|
23
26
|
import { homedir } from "node:os";
|
|
24
27
|
import { dirname, join, resolve } from "node:path";
|
|
25
28
|
import { fileURLToPath } from "node:url";
|
|
@@ -87,8 +90,21 @@ function readJson(file) {
|
|
|
87
90
|
return null;
|
|
88
91
|
}
|
|
89
92
|
}
|
|
93
|
+
function sameFile(a, b) {
|
|
94
|
+
let norm = (p) => {
|
|
95
|
+
let out = resolve(p);
|
|
96
|
+
try {
|
|
97
|
+
out = realpathSync.native(out);
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
100
|
+
return process.platform === "linux" ? out : out.toLowerCase();
|
|
101
|
+
};
|
|
102
|
+
return norm(a) === norm(b);
|
|
103
|
+
}
|
|
90
104
|
async function studioConflict(paths, env = process.env, fetchImpl = fetch) {
|
|
91
|
-
let
|
|
105
|
+
let registry = leaseDir({ ...process.env, ...env }), embedded = (await listRuntimeHosts(registry)).filter((h) => h.alive && h.kind === "studio-embedded"), same = embedded.find((h) => sameFile(h.settingsPath, paths.settingsFile));
|
|
106
|
+
if (same) return `ADF Studio (pid ${same.pid}) is running agents from the same settings file (${paths.settingsFile}).`;
|
|
107
|
+
let studioRegistered = embedded.length > 0 || (await listStudioClients(registry)).some((c) => c.alive), settings = readJson(paths.settingsFile) ?? {}, meshPort = Number(env.MESH_PORT) || (typeof settings.meshPort == "number" ? settings.meshPort : DEFAULT_MESH_PORT), runtimeId = typeof settings.runtimeId == "string" ? settings.runtimeId : null;
|
|
92
108
|
if (runtimeId)
|
|
93
109
|
try {
|
|
94
110
|
let res = await fetchImpl(`http://127.0.0.1:${meshPort}/ping`, { signal: AbortSignal.timeout(800) });
|
|
@@ -96,7 +112,7 @@ async function studioConflict(paths, env = process.env, fetchImpl = fetch) {
|
|
|
96
112
|
return `Another ADF runtime on the same settings is already running (its mesh answers on 127.0.0.1:${meshPort}), most likely ADF Studio.`;
|
|
97
113
|
} catch {
|
|
98
114
|
}
|
|
99
|
-
return !paths.custom && studioProcessRunning() ? "ADF Studio is running." : null;
|
|
115
|
+
return !paths.custom && !studioRegistered && studioProcessRunning() ? "ADF Studio is running." : null;
|
|
100
116
|
}
|
|
101
117
|
function studioProcessRunning() {
|
|
102
118
|
try {
|
|
@@ -216,8 +232,15 @@ async function ensureDaemon(url, options = {}) {
|
|
|
216
232
|
let env = options.env ?? process.env, fetchImpl = options.fetch ?? fetch, target = daemonTarget(url);
|
|
217
233
|
return await isHealthy(target.url, fetchImpl) || !target.loopback || !isLocalDaemonUrl(target.url, env) || options.disabled || env.ADF_NO_AUTOSTART === "1" ? null : await startDaemon(target, options);
|
|
218
234
|
}
|
|
235
|
+
function hostControlToken(url, env = process.env) {
|
|
236
|
+
if (daemonTarget(url).loopback)
|
|
237
|
+
return env.ADF_DAEMON_TOKEN || localDaemonToken(url, env);
|
|
238
|
+
}
|
|
239
|
+
function hostOnlyRefusal(sub, target) {
|
|
240
|
+
return target.loopback ? null : `adf daemon ${sub} manages this computer's ADF daemon only; run it on ${target.host}.`;
|
|
241
|
+
}
|
|
219
242
|
async function stopDaemon(target, options = {}) {
|
|
220
|
-
let env = options.env ?? process.env, fetchImpl = options.fetch ?? fetch, paths = daemonPaths(target.port, env), record = readPidFile(paths.pidFile), token =
|
|
243
|
+
let env = options.env ?? process.env, fetchImpl = options.fetch ?? fetch, paths = daemonPaths(target.port, env), record = readPidFile(paths.pidFile), token = hostControlToken(target.url, env);
|
|
221
244
|
if (!await isHealthy(target.url, fetchImpl))
|
|
222
245
|
return record && processAlive(record.pid) ? { stopped: !1, message: `No daemon answers ${target.url}, but pid ${record.pid} from ${paths.pidFile} is alive. It may be starting or stuck; see adf daemon logs.` } : { stopped: !0, message: `No daemon running at ${target.url}.` };
|
|
223
246
|
let accepted = !1;
|
|
@@ -246,13 +269,29 @@ async function stopDaemon(target, options = {}) {
|
|
|
246
269
|
}
|
|
247
270
|
async function daemonStatus(target, options = {}) {
|
|
248
271
|
let env = options.env ?? process.env, fetchImpl = options.fetch ?? fetch, paths = daemonPaths(target.port, env), running = await isHealthy(target.url, fetchImpl), record = readPidFile(paths.pidFile), lines = [`url ${target.url}`, `status ${running ? "running" : "not running"}`];
|
|
249
|
-
if (running)
|
|
272
|
+
if (running) {
|
|
250
273
|
try {
|
|
251
|
-
let token =
|
|
274
|
+
let token = hostControlToken(target.url, env), body = await (await fetchImpl(`${target.url}/runtime`, { headers: token ? { Authorization: `Bearer ${token}` } : {}, signal: AbortSignal.timeout(3e3) })).json();
|
|
252
275
|
body.daemon?.pid && lines.push(`pid ${body.daemon.pid}`), typeof body.daemon?.uptime == "number" && lines.push(`uptime ${formatUptime(body.daemon.uptime)}`), body.daemon?.version && lines.push(`version ${body.daemon.version}`), Array.isArray(body.agents) && lines.push(`agents ${body.agents.length} loaded`);
|
|
253
276
|
} catch {
|
|
254
277
|
}
|
|
255
|
-
|
|
278
|
+
try {
|
|
279
|
+
let token = hostControlToken(target.url, env), res = await fetchImpl(`${target.url}/version`, { headers: token ? { Authorization: `Bearer ${token}` } : {}, signal: AbortSignal.timeout(3e3) });
|
|
280
|
+
if (res.ok) {
|
|
281
|
+
let info = await res.json();
|
|
282
|
+
info.startedBy && lines.push(`started by ${info.startedBy}`), info.trust?.state && info.trust.state !== "not-applicable" && lines.push(`trust ${info.trust.state === "trusted" ? `key ${info.trust.label ?? ""} trusted by the owner` : "key not trusted"}: ${info.trust.message ?? ""}`), info.localProof && !info.localProof.available && lines.push(`proof unavailable: ${info.localProof.problem ?? "unknown reason"} (owner import and stored-value reveal refuse until the daemon restarts with a protected proof file)`), info.keychainProblem && lines.push(`keychain unavailable: ${info.keychainProblem}`);
|
|
283
|
+
}
|
|
284
|
+
} catch {
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
287
|
+
let token = hostControlToken(target.url, env), res = await fetchImpl(`${target.url}/network/server`, { headers: token ? { Authorization: `Bearer ${token}` } : {}, signal: AbortSignal.timeout(3e3) });
|
|
288
|
+
if (res.ok) {
|
|
289
|
+
let server = await res.json();
|
|
290
|
+
typeof server.warning == "string" && server.warning && lines.push(`mesh ${server.warning}`);
|
|
291
|
+
}
|
|
292
|
+
} catch {
|
|
293
|
+
}
|
|
294
|
+
} else record && processAlive(record.pid) && lines.push(`pid ${record.pid} (alive, not answering: starting or stuck)`);
|
|
256
295
|
return target.loopback && (lines.push(`data ${paths.dataDir}`), lines.push(`log ${paths.logFile}${existsSync(paths.logFile) ? "" : " (none yet)"}`)), { running, lines };
|
|
257
296
|
}
|
|
258
297
|
function formatUptime(seconds) {
|
|
@@ -296,23 +335,25 @@ function daemonUrlFrom(args, env = process.env) {
|
|
|
296
335
|
let p = port ?? env.ADF_DAEMON_PORT;
|
|
297
336
|
return p ? { url: `http://127.0.0.1:${p}`, rest } : { url: (env.ADF_DAEMON_URL ?? DEFAULT_DAEMON_URL).replace(/\/+$/, ""), rest };
|
|
298
337
|
}
|
|
338
|
+
|
|
299
339
|
export {
|
|
300
|
-
DEFAULT_DAEMON_PORT,
|
|
301
|
-
DaemonStartError,
|
|
302
|
-
STUDIO_ADVICE,
|
|
303
|
-
daemonLaunch,
|
|
304
|
-
daemonPaths,
|
|
305
|
-
daemonStatus,
|
|
306
340
|
daemonTarget,
|
|
307
|
-
daemonUrlFrom,
|
|
308
|
-
ensureDaemon,
|
|
309
|
-
followLog,
|
|
310
|
-
isHealthy,
|
|
311
341
|
isLoopbackHost,
|
|
312
|
-
|
|
342
|
+
daemonPaths,
|
|
343
|
+
isHealthy,
|
|
313
344
|
readPidFile,
|
|
345
|
+
processAlive,
|
|
346
|
+
studioConflict,
|
|
347
|
+
STUDIO_ADVICE,
|
|
348
|
+
daemonLaunch,
|
|
349
|
+
DaemonStartError,
|
|
314
350
|
startDaemon,
|
|
351
|
+
ensureDaemon,
|
|
352
|
+
hostControlToken,
|
|
353
|
+
hostOnlyRefusal,
|
|
315
354
|
stopDaemon,
|
|
316
|
-
|
|
317
|
-
tailLines
|
|
355
|
+
daemonStatus,
|
|
356
|
+
tailLines,
|
|
357
|
+
followLog,
|
|
358
|
+
daemonUrlFrom
|
|
318
359
|
};
|