@agentdocumentformat/cli 0.7.8 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.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-4AZZJNN2.mjs} +917 -826
- 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-AIPBQTR2.mjs} +9 -3
- 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-2Z7X3UUR.mjs +678 -0
- package/dist/chunks/chunk-3UGZFWIF.mjs +26 -0
- package/dist/chunks/{chunk-XNPZBLYL.mjs → chunk-75DC5EWN.mjs} +13 -2
- package/dist/chunks/{chunk-5PO5PKRV.mjs → chunk-7JZXMDDF.mjs} +158 -67
- package/dist/chunks/chunk-AEAJDCVK.mjs +517 -0
- package/dist/chunks/{chunk-6VQEXLE2.mjs → chunk-BHY7QDCM.mjs} +41 -3
- package/dist/chunks/{chunk-CD3ATSXE.mjs → chunk-BR3AD5QZ.mjs} +8 -2
- package/dist/chunks/chunk-BS3USVEA.mjs +301 -0
- package/dist/chunks/chunk-C2S64Y6F.mjs +203 -0
- package/dist/chunks/chunk-D7A77SNL.mjs +976 -0
- package/dist/chunks/chunk-DDTTSKGG.mjs +2443 -0
- package/dist/chunks/{chunk-VAUOM3IN.mjs → chunk-DLWCKKIO.mjs} +1 -1
- package/dist/chunks/{chunk-G6PH7RPW.mjs → chunk-E7LC6SHP.mjs} +3 -3
- package/dist/chunks/{chunk-ZESQMP66.mjs → chunk-F3WSCAJD.mjs} +3 -3
- 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-VN7UH7I5.mjs → chunk-IMVMSU3A.mjs} +251 -68
- package/dist/chunks/{chunk-XYV3VCIX.mjs → chunk-JZFONJSL.mjs} +79 -20
- package/dist/chunks/chunk-KCIRFUZH.mjs +12799 -0
- package/dist/chunks/chunk-KDDVQKCG.mjs +65 -0
- package/dist/chunks/chunk-KRPKWOMB.mjs +290 -0
- package/dist/chunks/chunk-LKFHERRV.mjs +145 -0
- package/dist/chunks/chunk-LTX74NU6.mjs +29 -0
- package/dist/chunks/{chunk-HSBV6YFU.mjs → chunk-LVF2DRBR.mjs} +634 -99
- 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-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-RHBGCOS3.mjs} +67 -26
- package/dist/chunks/{chunk-J74STFKE.mjs → chunk-RJDOVMM4.mjs} +362 -58
- package/dist/chunks/{chunk-QPLEAE6V.mjs → chunk-SOSPQPEN.mjs} +167 -650
- 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-V3MM6PCH.mjs +366 -0
- package/dist/chunks/chunk-VENQBMOA.mjs +62 -0
- package/dist/chunks/chunk-WJGPNHGX.mjs +67 -0
- package/dist/chunks/{chunk-Y5ZLKFLE.mjs → chunk-XNNJQCZP.mjs} +196 -165
- package/dist/chunks/{chunk-HDBPBORT.mjs → chunk-YRBFIDLB.mjs} +46 -10
- package/dist/chunks/{chunk-BNXUAOO4.mjs → chunk-ZGXUOAWZ.mjs} +3186 -959
- package/dist/chunks/chunk-ZPB3HYM7.mjs +45 -0
- package/dist/chunks/claude-subscription-EB4LAAVV.mjs +29 -0
- package/dist/chunks/{cli-NMFIAR7Z.mjs → cli-PCVFB6B4.mjs} +797 -56
- package/dist/chunks/{commands-KPJWFRUE.mjs → commands-KOMPXJZS.mjs} +4 -3
- package/dist/chunks/{daemon-YDIK3AAM.mjs → daemon-BVDB565V.mjs} +83142 -64424
- package/dist/chunks/daemon-control-MKN7G5M3.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/{layout-EPJQNFAI.mjs → layout-ECWGJF6M.mjs} +2 -2
- package/dist/chunks/{lib-N7FCZWKH.mjs → lib-L27L5PXM.mjs} +22 -22
- package/dist/chunks/{open-VAU7PXT6.mjs → open-3OR6WT4T.mjs} +6 -6
- package/dist/chunks/{parser-JVY2PWSM.mjs → parser-7GARNT5L.mjs} +1 -1
- package/dist/chunks/{pipeline-executor-O77NTGLP.mjs → pipeline-executor-DRYEEFDR.mjs} +6 -5
- package/dist/chunks/prompt-RRHZX4YT.mjs +13 -0
- package/dist/chunks/remote-access-cli-GLEEP7DI.mjs +268 -0
- package/dist/chunks/remote-hello-UFWUBDQI.mjs +37 -0
- package/dist/chunks/sdk-OJOAF4DP.mjs +30014 -0
- package/dist/chunks/{slack-OCNNF4DX.mjs → slack-IYC5RAB5.mjs} +3 -4
- package/dist/chunks/{store-HUVDJPYN.mjs → store-55CQSAOX.mjs} +7 -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-RAUVFOYY.mjs} +21 -18
- 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/{chunk-APRU6PHC.mjs → chunk-JZ7AQNPM.mjs} +3 -3
- package/dist/chunks/{telegram-2EFGKIVK.mjs → telegram-JYY2VDTI.mjs} +5 -5
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
+
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
DaemonStartError,
|
|
9
|
+
STUDIO_ADVICE,
|
|
10
|
+
daemonLaunch,
|
|
11
|
+
daemonPaths,
|
|
12
|
+
daemonStatus,
|
|
13
|
+
daemonTarget,
|
|
14
|
+
daemonUrlFrom,
|
|
15
|
+
ensureDaemon,
|
|
16
|
+
followLog,
|
|
17
|
+
hostControlToken,
|
|
18
|
+
hostOnlyRefusal,
|
|
19
|
+
isHealthy,
|
|
20
|
+
isLoopbackHost,
|
|
21
|
+
processAlive,
|
|
22
|
+
readPidFile,
|
|
23
|
+
startDaemon,
|
|
24
|
+
stopDaemon,
|
|
25
|
+
studioConflict,
|
|
26
|
+
tailLines
|
|
27
|
+
} from "./chunk-RHBGCOS3.mjs";
|
|
28
|
+
import "./chunk-D7A77SNL.mjs";
|
|
29
|
+
import {
|
|
30
|
+
DEFAULT_DAEMON_PORT
|
|
31
|
+
} from "./chunk-AEAJDCVK.mjs";
|
|
32
|
+
import "./chunk-BS3USVEA.mjs";
|
|
33
|
+
import "./chunk-WJGPNHGX.mjs";
|
|
34
|
+
import "./chunk-PAK5JCO2.mjs";
|
|
35
|
+
import "./chunk-ZPB3HYM7.mjs";
|
|
36
|
+
import "./chunk-LTX74NU6.mjs";
|
|
37
|
+
import "./chunk-M2RX3S2T.mjs";
|
|
38
|
+
export {
|
|
39
|
+
DEFAULT_DAEMON_PORT,
|
|
40
|
+
DaemonStartError,
|
|
41
|
+
STUDIO_ADVICE,
|
|
42
|
+
daemonLaunch,
|
|
43
|
+
daemonPaths,
|
|
44
|
+
daemonStatus,
|
|
45
|
+
daemonTarget,
|
|
46
|
+
daemonUrlFrom,
|
|
47
|
+
ensureDaemon,
|
|
48
|
+
followLog,
|
|
49
|
+
hostControlToken,
|
|
50
|
+
hostOnlyRefusal,
|
|
51
|
+
isHealthy,
|
|
52
|
+
isLoopbackHost,
|
|
53
|
+
processAlive,
|
|
54
|
+
readPidFile,
|
|
55
|
+
startDaemon,
|
|
56
|
+
stopDaemon,
|
|
57
|
+
studioConflict,
|
|
58
|
+
tailLines
|
|
59
|
+
};
|
|
@@ -11,7 +11,9 @@ import {
|
|
|
11
11
|
ensureDaemonToken,
|
|
12
12
|
readDaemonToken,
|
|
13
13
|
tokensEqual
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WJGPNHGX.mjs";
|
|
15
|
+
import "./chunk-PAK5JCO2.mjs";
|
|
16
|
+
import "./chunk-LTX74NU6.mjs";
|
|
15
17
|
import "./chunk-M2RX3S2T.mjs";
|
|
16
18
|
export {
|
|
17
19
|
DAEMON_TOKEN_FILENAME,
|
|
@@ -7,6 +7,9 @@ const __dirname = __adfDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
require_fast_deep_equal
|
|
9
9
|
} from "./chunk-64OKE4X3.mjs";
|
|
10
|
+
import {
|
|
11
|
+
require_es6
|
|
12
|
+
} from "./chunk-KDDVQKCG.mjs";
|
|
10
13
|
import {
|
|
11
14
|
require_ws
|
|
12
15
|
} from "./chunk-6XUV6EK6.mjs";
|
|
@@ -42391,58 +42394,6 @@ var require_get = __commonJS({
|
|
|
42391
42394
|
}
|
|
42392
42395
|
});
|
|
42393
42396
|
|
|
42394
|
-
// node_modules/fast-deep-equal/es6/index.js
|
|
42395
|
-
var require_es6 = __commonJS({
|
|
42396
|
-
"node_modules/fast-deep-equal/es6/index.js"(exports2, module2) {
|
|
42397
|
-
"use strict";
|
|
42398
|
-
module2.exports = function equal(a, b) {
|
|
42399
|
-
if (a === b) return !0;
|
|
42400
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
42401
|
-
if (a.constructor !== b.constructor) return !1;
|
|
42402
|
-
var length, i, keys;
|
|
42403
|
-
if (Array.isArray(a)) {
|
|
42404
|
-
if (length = a.length, length != b.length) return !1;
|
|
42405
|
-
for (i = length; i-- !== 0; )
|
|
42406
|
-
if (!equal(a[i], b[i])) return !1;
|
|
42407
|
-
return !0;
|
|
42408
|
-
}
|
|
42409
|
-
if (a instanceof Map && b instanceof Map) {
|
|
42410
|
-
if (a.size !== b.size) return !1;
|
|
42411
|
-
for (i of a.entries())
|
|
42412
|
-
if (!b.has(i[0])) return !1;
|
|
42413
|
-
for (i of a.entries())
|
|
42414
|
-
if (!equal(i[1], b.get(i[0]))) return !1;
|
|
42415
|
-
return !0;
|
|
42416
|
-
}
|
|
42417
|
-
if (a instanceof Set && b instanceof Set) {
|
|
42418
|
-
if (a.size !== b.size) return !1;
|
|
42419
|
-
for (i of a.entries())
|
|
42420
|
-
if (!b.has(i[0])) return !1;
|
|
42421
|
-
return !0;
|
|
42422
|
-
}
|
|
42423
|
-
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
42424
|
-
if (length = a.length, length != b.length) return !1;
|
|
42425
|
-
for (i = length; i-- !== 0; )
|
|
42426
|
-
if (a[i] !== b[i]) return !1;
|
|
42427
|
-
return !0;
|
|
42428
|
-
}
|
|
42429
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
42430
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
42431
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
42432
|
-
if (keys = Object.keys(a), length = keys.length, length !== Object.keys(b).length) return !1;
|
|
42433
|
-
for (i = length; i-- !== 0; )
|
|
42434
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return !1;
|
|
42435
|
-
for (i = length; i-- !== 0; ) {
|
|
42436
|
-
var key = keys[i];
|
|
42437
|
-
if (!equal(a[key], b[key])) return !1;
|
|
42438
|
-
}
|
|
42439
|
-
return !0;
|
|
42440
|
-
}
|
|
42441
|
-
return a !== a && b !== b;
|
|
42442
|
-
};
|
|
42443
|
-
}
|
|
42444
|
-
});
|
|
42445
|
-
|
|
42446
42397
|
// node_modules/lodash/_setCacheAdd.js
|
|
42447
42398
|
var require_setCacheAdd = __commonJS({
|
|
42448
42399
|
"node_modules/lodash/_setCacheAdd.js"(exports2, module2) {
|
|
@@ -58496,6 +58496,8 @@ var EmailAdapter = class {
|
|
|
58496
58496
|
}
|
|
58497
58497
|
async processMessage(msg, policy, maxAttachmentSize) {
|
|
58498
58498
|
if (!this.ctx) return;
|
|
58499
|
+
if (!msg.source)
|
|
58500
|
+
throw new Error(`IMAP did not return the source for email UID ${msg.uid}`);
|
|
58499
58501
|
let parsed = await (0, import_mailparser.simpleParser)(msg.source), senderAddress = parsed.from?.value?.[0]?.address;
|
|
58500
58502
|
if (!senderAddress) return;
|
|
58501
58503
|
let dmPolicy = policy.dm ?? "all";
|
|
@@ -58538,10 +58540,10 @@ var EmailAdapter = class {
|
|
|
58538
58540
|
);
|
|
58539
58541
|
}
|
|
58540
58542
|
}
|
|
58541
|
-
let references = Array.isArray(parsed.references) ? parsed.references : parsed.references ? [parsed.references] : [], threadRoot = references.length > 0 ? references[0] : parsed.messageId,
|
|
58543
|
+
let references = Array.isArray(parsed.references) ? parsed.references : parsed.references ? [parsed.references] : [], threadRoot = references.length > 0 ? references[0] : parsed.messageId, addresses = (value) => (Array.isArray(value) ? value : value ? [value] : []).flatMap((group) => group.value), to = addresses(parsed.to), cc = addresses(parsed.cc), toAddrs = to.flatMap((v2) => v2.address ? [v2.address] : []), ccAddrs = cc.flatMap((v2) => v2.address ? [v2.address] : []), allRecipients = [...toAddrs, ...ccAddrs], meta;
|
|
58542
58544
|
if (allRecipients.length > 1) {
|
|
58543
58545
|
let named = /* @__PURE__ */ new Map();
|
|
58544
|
-
for (let v2 of [...
|
|
58546
|
+
for (let v2 of [...to, ...cc])
|
|
58545
58547
|
v2.address && named.set(v2.address, v2.name || void 0);
|
|
58546
58548
|
meta = {
|
|
58547
58549
|
group: buildGroupMeta({
|
|
@@ -5,14 +5,17 @@ const require = __adfCreateRequire(import.meta.url);
|
|
|
5
5
|
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
7
|
import {
|
|
8
|
+
GROK_SUBSCRIPTION_MEDIA,
|
|
8
9
|
GROK_SUBSCRIPTION_MODELS,
|
|
9
10
|
createGrokSubscriptionProvider,
|
|
10
11
|
listGrokSubscriptionModels
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-XNNJQCZP.mjs";
|
|
13
|
+
import "./chunk-TKXIH27X.mjs";
|
|
14
|
+
import "./chunk-LKFHERRV.mjs";
|
|
13
15
|
import "./chunk-RIX34QHC.mjs";
|
|
14
16
|
import "./chunk-M2RX3S2T.mjs";
|
|
15
17
|
export {
|
|
18
|
+
GROK_SUBSCRIPTION_MEDIA,
|
|
16
19
|
GROK_SUBSCRIPTION_MODELS,
|
|
17
20
|
createGrokSubscriptionProvider,
|
|
18
21
|
listGrokSubscriptionModels
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
readLayout,
|
|
10
10
|
setMouse,
|
|
11
11
|
setSidebarHidden
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-5QU5VY7N.mjs";
|
|
12
|
+
} from "./chunk-JZ7AQNPM.mjs";
|
|
14
13
|
import "./chunk-7XYNI52E.mjs";
|
|
14
|
+
import "./chunk-5QU5VY7N.mjs";
|
|
15
15
|
import "./chunk-6GJ4QHRI.mjs";
|
|
16
16
|
import "./chunk-M2RX3S2T.mjs";
|
|
17
17
|
export {
|
|
@@ -11,19 +11,10 @@ import {
|
|
|
11
11
|
} from "./chunk-EWL5FG4I.mjs";
|
|
12
12
|
import {
|
|
13
13
|
hasID3v1Header
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
LyricsContentType,
|
|
17
|
-
TimestampFormat
|
|
18
|
-
} from "./chunk-DXWDD5XJ.mjs";
|
|
14
|
+
} from "./chunk-DLWCKKIO.mjs";
|
|
19
15
|
import {
|
|
20
16
|
APEv2Parser
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import {
|
|
23
|
-
decodeString,
|
|
24
|
-
getUintBE,
|
|
25
|
-
toRatio
|
|
26
|
-
} from "./chunk-XX7OSWTO.mjs";
|
|
17
|
+
} from "./chunk-2MTE22CR.mjs";
|
|
27
18
|
import {
|
|
28
19
|
EndOfStreamError,
|
|
29
20
|
fromBlob,
|
|
@@ -32,6 +23,15 @@ import {
|
|
|
32
23
|
fromStream,
|
|
33
24
|
fromWebStream
|
|
34
25
|
} from "./chunk-HBUENVQL.mjs";
|
|
26
|
+
import {
|
|
27
|
+
LyricsContentType,
|
|
28
|
+
TimestampFormat
|
|
29
|
+
} from "./chunk-DXWDD5XJ.mjs";
|
|
30
|
+
import {
|
|
31
|
+
decodeString,
|
|
32
|
+
getUintBE,
|
|
33
|
+
toRatio
|
|
34
|
+
} from "./chunk-XX7OSWTO.mjs";
|
|
35
35
|
import {
|
|
36
36
|
CouldNotDetermineFileTypeError,
|
|
37
37
|
FieldDecodingError,
|
|
@@ -3715,7 +3715,7 @@ var mpegParserLoader = {
|
|
|
3715
3715
|
extensions: [".mp2", ".mp3", ".m2a", ".aac", "aacp"],
|
|
3716
3716
|
mimeTypes: ["audio/mpeg", "audio/mp3", "audio/aacs", "audio/aacp"],
|
|
3717
3717
|
async load() {
|
|
3718
|
-
return (await import("./MpegParser-
|
|
3718
|
+
return (await import("./MpegParser-XIIPAZVM.mjs")).MpegParser;
|
|
3719
3719
|
}
|
|
3720
3720
|
};
|
|
3721
3721
|
|
|
@@ -3725,7 +3725,7 @@ var apeParserLoader = {
|
|
|
3725
3725
|
extensions: [".ape"],
|
|
3726
3726
|
mimeTypes: ["audio/ape", "audio/monkeys-audio"],
|
|
3727
3727
|
async load() {
|
|
3728
|
-
return (await import("./APEv2Parser-
|
|
3728
|
+
return (await import("./APEv2Parser-WIXRJLHB.mjs")).APEv2Parser;
|
|
3729
3729
|
}
|
|
3730
3730
|
};
|
|
3731
3731
|
|
|
@@ -3745,7 +3745,7 @@ var dsdiffParserLoader = {
|
|
|
3745
3745
|
extensions: [".dff"],
|
|
3746
3746
|
mimeTypes: ["audio/dsf", "audio/dsd"],
|
|
3747
3747
|
async load() {
|
|
3748
|
-
return (await import("./DsdiffParser-
|
|
3748
|
+
return (await import("./DsdiffParser-UAPAJHFX.mjs")).DsdiffParser;
|
|
3749
3749
|
}
|
|
3750
3750
|
};
|
|
3751
3751
|
|
|
@@ -3755,7 +3755,7 @@ var aiffParserLoader = {
|
|
|
3755
3755
|
extensions: [".aif", "aiff", "aifc"],
|
|
3756
3756
|
mimeTypes: ["audio/aiff", "audio/aif", "audio/aifc", "application/aiff"],
|
|
3757
3757
|
async load() {
|
|
3758
|
-
return (await import("./AiffParser-
|
|
3758
|
+
return (await import("./AiffParser-ZC4QFOVJ.mjs")).AIFFParser;
|
|
3759
3759
|
}
|
|
3760
3760
|
};
|
|
3761
3761
|
|
|
@@ -3765,7 +3765,7 @@ var dsfParserLoader = {
|
|
|
3765
3765
|
extensions: [".dsf"],
|
|
3766
3766
|
mimeTypes: ["audio/dsf"],
|
|
3767
3767
|
async load() {
|
|
3768
|
-
return (await import("./DsfParser-
|
|
3768
|
+
return (await import("./DsfParser-NNYZK2QX.mjs")).DsfParser;
|
|
3769
3769
|
}
|
|
3770
3770
|
};
|
|
3771
3771
|
|
|
@@ -3775,7 +3775,7 @@ var flacParserLoader = {
|
|
|
3775
3775
|
extensions: [".flac"],
|
|
3776
3776
|
mimeTypes: ["audio/flac"],
|
|
3777
3777
|
async load() {
|
|
3778
|
-
return (await import("./FlacParser-
|
|
3778
|
+
return (await import("./FlacParser-MW2W4LO3.mjs")).FlacParser;
|
|
3779
3779
|
}
|
|
3780
3780
|
};
|
|
3781
3781
|
|
|
@@ -3795,7 +3795,7 @@ var mp4ParserLoader = {
|
|
|
3795
3795
|
extensions: [".mp4", ".m4a", ".m4b", ".m4pa", "m4v", "m4r", "3gp", ".mov", ".movie", ".qt"],
|
|
3796
3796
|
mimeTypes: ["audio/mp4", "audio/m4a", "video/m4v", "video/mp4", "video/quicktime"],
|
|
3797
3797
|
async load() {
|
|
3798
|
-
return (await import("./MP4Parser-
|
|
3798
|
+
return (await import("./MP4Parser-Z57SYOOQ.mjs")).MP4Parser;
|
|
3799
3799
|
}
|
|
3800
3800
|
};
|
|
3801
3801
|
|
|
@@ -3805,7 +3805,7 @@ var musepackParserLoader = {
|
|
|
3805
3805
|
extensions: [".mpc"],
|
|
3806
3806
|
mimeTypes: ["audio/musepack"],
|
|
3807
3807
|
async load() {
|
|
3808
|
-
return (await import("./MusepackParser-
|
|
3808
|
+
return (await import("./MusepackParser-QWNDEYHJ.mjs")).MusepackParser;
|
|
3809
3809
|
}
|
|
3810
3810
|
};
|
|
3811
3811
|
|
|
@@ -3816,7 +3816,7 @@ var oggParserLoader = {
|
|
|
3816
3816
|
mimeTypes: ["audio/ogg", "audio/opus", "audio/speex", "video/ogg"],
|
|
3817
3817
|
// RFC 7845, RFC 6716, RFC 5574
|
|
3818
3818
|
async load() {
|
|
3819
|
-
return (await import("./OggParser-
|
|
3819
|
+
return (await import("./OggParser-WRX53F77.mjs")).OggParser;
|
|
3820
3820
|
}
|
|
3821
3821
|
};
|
|
3822
3822
|
|
|
@@ -3826,7 +3826,7 @@ var wavpackParserLoader = {
|
|
|
3826
3826
|
extensions: [".wv", ".wvp"],
|
|
3827
3827
|
mimeTypes: ["audio/wavpack"],
|
|
3828
3828
|
async load() {
|
|
3829
|
-
return (await import("./WavPackParser-
|
|
3829
|
+
return (await import("./WavPackParser-MJ7WCSJ5.mjs")).WavPackParser;
|
|
3830
3830
|
}
|
|
3831
3831
|
};
|
|
3832
3832
|
|
|
@@ -3836,7 +3836,7 @@ var riffParserLoader = {
|
|
|
3836
3836
|
extensions: [".wav", "wave", ".bwf"],
|
|
3837
3837
|
mimeTypes: ["audio/vnd.wave", "audio/wav", "audio/wave"],
|
|
3838
3838
|
async load() {
|
|
3839
|
-
return (await import("./WaveParser-
|
|
3839
|
+
return (await import("./WaveParser-RAVLHZ5S.mjs")).WaveParser;
|
|
3840
3840
|
}
|
|
3841
3841
|
};
|
|
3842
3842
|
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
openProviderAdd,
|
|
13
13
|
openWelcome,
|
|
14
14
|
secretStoreReady
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-I3UYSITV.mjs";
|
|
18
|
-
import "./chunk-SGUTYISF.mjs";
|
|
15
|
+
} from "./chunk-2Z7X3UUR.mjs";
|
|
16
|
+
import "./chunk-O7XKQ6CH.mjs";
|
|
19
17
|
import "./chunk-5QU5VY7N.mjs";
|
|
20
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-SOSPQPEN.mjs";
|
|
21
19
|
import "./chunk-3AT7IIP7.mjs";
|
|
22
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-NZLEPJ5M.mjs";
|
|
21
|
+
import "./chunk-7CV2SA3H.mjs";
|
|
22
|
+
import "./chunk-SGUTYISF.mjs";
|
|
23
23
|
import "./chunk-6GJ4QHRI.mjs";
|
|
24
24
|
import "./chunk-UYY5M2PB.mjs";
|
|
25
25
|
import "./chunk-ZJKXHM4Q.mjs";
|
|
@@ -7,13 +7,14 @@ const __dirname = __adfDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
MAX_SHELL_DEPTH,
|
|
9
9
|
executeNode
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-F3WSCAJD.mjs";
|
|
11
|
+
import "./chunk-UZPDETEU.mjs";
|
|
12
12
|
import "./chunk-ESP3VNMX.mjs";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-LVF2DRBR.mjs";
|
|
14
|
+
import "./chunk-E7LC6SHP.mjs";
|
|
15
15
|
import "./chunk-3GNIDM53.mjs";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-LKFHERRV.mjs";
|
|
17
|
+
import "./chunk-BR3AD5QZ.mjs";
|
|
17
18
|
import "./chunk-M2RX3S2T.mjs";
|
|
18
19
|
export {
|
|
19
20
|
MAX_SHELL_DEPTH,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
+
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
stdinPrompt
|
|
9
|
+
} from "./chunk-PC63YFB7.mjs";
|
|
10
|
+
import "./chunk-M2RX3S2T.mjs";
|
|
11
|
+
export {
|
|
12
|
+
stdinPrompt
|
|
13
|
+
};
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
+
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
PUBLIC_WARNING,
|
|
9
|
+
unidentifiedText
|
|
10
|
+
} from "./chunk-3UGZFWIF.mjs";
|
|
11
|
+
import {
|
|
12
|
+
DEFAULT_DAEMON_PORT,
|
|
13
|
+
loopbackPort
|
|
14
|
+
} from "./chunk-AEAJDCVK.mjs";
|
|
15
|
+
import {
|
|
16
|
+
readLocalProof
|
|
17
|
+
} from "./chunk-BS3USVEA.mjs";
|
|
18
|
+
import {
|
|
19
|
+
readDaemonToken
|
|
20
|
+
} from "./chunk-WJGPNHGX.mjs";
|
|
21
|
+
import "./chunk-PAK5JCO2.mjs";
|
|
22
|
+
import "./chunk-ZPB3HYM7.mjs";
|
|
23
|
+
import "./chunk-LTX74NU6.mjs";
|
|
24
|
+
import "./chunk-M2RX3S2T.mjs";
|
|
25
|
+
|
|
26
|
+
// src/main/cli/remote-access-cli.ts
|
|
27
|
+
var REMOTE_USAGE = `Usage: adf daemon remote on [--name <name>] | off | status [--json]
|
|
28
|
+
adf daemon remote allow-network [<id|label>] Allow on this network (default: the one network not allowed)
|
|
29
|
+
adf daemon remote forget-network <id|label> Remove an allowed network; its listeners close now
|
|
30
|
+
adf daemon remote serve on | off https through tailscale serve
|
|
31
|
+
adf daemon devices [list] [--json]
|
|
32
|
+
adf daemon devices add <label> Print a new device token (shown once)
|
|
33
|
+
adf daemon devices revoke <id|label> Disconnect that computer and void its token
|
|
34
|
+
adf daemon pair Open a pairing window and show its code
|
|
35
|
+
|
|
36
|
+
Remote access: devices you pair or add use this computer's ADF daemon (no
|
|
37
|
+
restart; agents keep running). It listens only on private and Tailscale
|
|
38
|
+
addresses, and only on a network you allowed (once per network; the mesh's LAN
|
|
39
|
+
mode uses the same list). A device token gives full control of this
|
|
40
|
+
computer's agents: it is as powerful as your owner seed phrase.`, ManageError = class extends Error {
|
|
41
|
+
constructor(message, status, code) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.status = status;
|
|
44
|
+
this.code = code;
|
|
45
|
+
}
|
|
46
|
+
status;
|
|
47
|
+
code;
|
|
48
|
+
};
|
|
49
|
+
async function call(io, target, method, path, body) {
|
|
50
|
+
if (loopbackPort(target.url) === null) throw new ManageError(`adf daemon remote, devices and pair manage this computer's ADF daemon only; ${target.url} is not on this computer.`, 0, "not_local");
|
|
51
|
+
let token = readDaemonToken(target.dataDir), proof = readLocalProof(target.dataDir, target.port), res = await io.fetch(`${target.url}${path}`, {
|
|
52
|
+
method,
|
|
53
|
+
headers: {
|
|
54
|
+
Accept: "application/json",
|
|
55
|
+
...body !== void 0 ? { "Content-Type": "application/json" } : {},
|
|
56
|
+
...token ? { Authorization: `Bearer ${token}` } : {},
|
|
57
|
+
...proof ? { "X-ADF-Local-Proof": proof } : {}
|
|
58
|
+
},
|
|
59
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
60
|
+
}), text = await res.text(), parsed = text ? JSON.parse(text) : {};
|
|
61
|
+
if (!res.ok) {
|
|
62
|
+
let code = typeof parsed.code == "string" ? parsed.code : null, message = typeof parsed.error == "string" ? parsed.error : `HTTP ${res.status}`;
|
|
63
|
+
throw new ManageError(res.status === 404 && (code === null || code === "not_found") ? `The ADF daemon at ${target.url} does not support remote access. Update it (adf daemon restart after updating adf).` : message, res.status, code);
|
|
64
|
+
}
|
|
65
|
+
return parsed;
|
|
66
|
+
}
|
|
67
|
+
function ago(iso) {
|
|
68
|
+
if (!iso) return "never";
|
|
69
|
+
let s = Math.max(0, Math.round((Date.now() - Date.parse(iso)) / 1e3));
|
|
70
|
+
return s < 60 ? `${s} s ago` : s < 3600 ? `${Math.round(s / 60)} min ago` : s < 86400 ? `${Math.round(s / 3600)} h ago` : `${Math.round(s / 86400)} d ago`;
|
|
71
|
+
}
|
|
72
|
+
function formatDevices(devices) {
|
|
73
|
+
if (devices.length === 0) return `No computers yet. Pair one: adf daemon pair (or adf daemon devices add <label>).
|
|
74
|
+
`;
|
|
75
|
+
let rows = devices.map((d) => [d.id, d.label, d.origin === "paired" ? "paired" : "token", d.connected ? "connected now" : `last seen ${ago(d.lastSeenAt)}${d.lastSeenAddress ? ` from ${d.lastSeenAddress}` : ""}`]), widths = [0, 1, 2].map((i) => Math.max(...rows.map((r) => r[i].length), ["id", "label", "kind"][i].length)), line = (r) => `${r.slice(0, 3).map((c, i) => c.padEnd(widths[i])).join(" ")} ${r[3]}`.trimEnd();
|
|
76
|
+
return `${[line(["id", "label", "kind", "status"]), ...rows.map(line)].join(`
|
|
77
|
+
`)}
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
function formatRemoteStatus(s) {
|
|
81
|
+
let lines = [];
|
|
82
|
+
if (lines.push(`Remote access: ${s.enabled ? "on" : "off"}`), s.state !== "off" && lines.push(s.message), s.problem && lines.push(`Problem: ${s.problem}`), lines.push(`Name: ${s.name}${s.fingerprint ? ` Fingerprint: ${s.fingerprint}` : ""}`), s.urls.length) {
|
|
83
|
+
lines.push("Addresses:");
|
|
84
|
+
for (let u of s.urls) lines.push(` ${u.url} ${u.encrypted ? "encrypted" : "not encrypted"}${u.kind === "tailscale-https" ? " (tailscale serve)" : u.kind === "tailnet" ? " (tailnet)" : ""}`);
|
|
85
|
+
}
|
|
86
|
+
for (let a of s.addresses.filter((x) => !x.listening)) lines.push(`Not listening on ${a.address} (${a.iface}): ${a.problem ?? "not available"}`);
|
|
87
|
+
if (s.networks.length) {
|
|
88
|
+
lines.push("Networks now:");
|
|
89
|
+
for (let n of s.networks) {
|
|
90
|
+
let warn = n.kind === "lan" && !!n.id && n.osCategory !== "private" && (!n.allowed || s.enabled) ? ` ${PUBLIC_WARNING}` : "";
|
|
91
|
+
lines.push(` ${n.label} ${n.allowed ? `allowed${warn ? `.${warn}` : ""}` : n.id ? `not allowed (allow: adf daemon remote allow-network ${n.id})${warn}` : `not allowed. ${unidentifiedText(n.problem, "ADF")}${n.problem?.detail ? ` (${n.problem.detail})` : ""}`}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
lines.push(`Allowed networks (${s.allowedNetworks.length}):`);
|
|
95
|
+
for (let n of s.allowedNetworks) lines.push(` ${n.id} ${n.label}`);
|
|
96
|
+
if (s.enabled) {
|
|
97
|
+
s.tailscale.state === "running" && lines.push(`Tailscale: https through tailscale serve is ${s.tailscale.serve}${s.tailscale.httpsUrl ? ` at ${s.tailscale.httpsUrl}` : s.tailscale.serve === "off" ? " (turn on: adf daemon remote serve on)" : ""}`), lines.push(`mDNS: ${s.mdns.announcing ? "announcing" : `not announcing${s.mdns.problem ? ` (${s.mdns.problem})` : ""}`}`), lines.push(`Firewall: ${s.firewall.message}`);
|
|
98
|
+
for (let c of s.firewall.commands) lines.push(` ${c}`);
|
|
99
|
+
}
|
|
100
|
+
return s.pairing && lines.push(`Pairing window open until ${new Date(s.pairing.expiresAt).toLocaleTimeString()}${s.pairing.claim ? `; "${s.pairing.claim.deviceName}" is waiting for your answer (adf daemon pair)` : ""}`), lines.push(`Computers (${s.devices.length}):`), lines.push(formatDevices(s.devices).trimEnd().split(`
|
|
101
|
+
`).map((l) => ` ${l}`).join(`
|
|
102
|
+
`)), `${lines.join(`
|
|
103
|
+
`)}
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
async function remoteCommand(args, io, target) {
|
|
107
|
+
let [action, ...rest] = args, json = rest.includes("--json") || action === "--json";
|
|
108
|
+
if (!action || action === "status" || action === "--json") {
|
|
109
|
+
let status = await call(io, target, "GET", "/remote-access?refresh=1");
|
|
110
|
+
return io.stdout(json ? `${JSON.stringify(status, null, 2)}
|
|
111
|
+
` : formatRemoteStatus(status)), 0;
|
|
112
|
+
}
|
|
113
|
+
if (action === "on" || action === "off") {
|
|
114
|
+
let at = rest.indexOf("--name"), name = at >= 0 ? rest[at + 1] : void 0;
|
|
115
|
+
if (at >= 0 && !name)
|
|
116
|
+
return io.stderr(`--name requires a value
|
|
117
|
+
`), 2;
|
|
118
|
+
let status = await call(io, target, "PUT", "/remote-access", { enabled: action === "on", ...name ? { name } : {} });
|
|
119
|
+
return io.stdout(json ? `${JSON.stringify(status, null, 2)}
|
|
120
|
+
` : formatRemoteStatus(status)), action === "on" && !json && (io.stderr(`Other computers you pair or give a token get full control of this computer's agents, with the same power as your seed phrase.
|
|
121
|
+
`), io.stderr(`Add one: adf daemon pair (or adf daemon devices add <label>). It works while this daemon runs.
|
|
122
|
+
`)), 0;
|
|
123
|
+
}
|
|
124
|
+
if (action === "allow-network" || action === "forget-network") {
|
|
125
|
+
let which = rest.filter((a) => a !== "--json").join(" ").trim(), current = await call(io, target, "GET", "/remote-access?refresh=1"), id = null;
|
|
126
|
+
if (action === "allow-network") {
|
|
127
|
+
let candidates = current.networks.filter((n) => n.id && (which ? n.id === which || n.label === which : !n.allowed));
|
|
128
|
+
if (candidates.length !== 1)
|
|
129
|
+
return io.stderr(candidates.length === 0 ? `${which ? `No current network "${which}".` : "No network waiting to be allowed."} Networks now: ${current.networks.map((n) => `${n.label} (${n.id ?? unidentifiedText(n.problem, "ADF")}${n.allowed ? ", allowed" : ""})`).join(", ") || "none"}
|
|
130
|
+
` : `More than one network is not allowed; name one: ${candidates.map((n) => n.id).join(", ")}
|
|
131
|
+
`), 1;
|
|
132
|
+
id = candidates[0].id;
|
|
133
|
+
} else {
|
|
134
|
+
if (!which)
|
|
135
|
+
return io.stderr(`${REMOTE_USAGE}
|
|
136
|
+
`), 2;
|
|
137
|
+
let found = current.allowedNetworks.filter((n) => n.id === which || n.label === which);
|
|
138
|
+
if (found.length !== 1)
|
|
139
|
+
return io.stderr(`${found.length ? "More than one allowed network has that name; use its id." : `No allowed network "${which}".`}
|
|
140
|
+
`), 1;
|
|
141
|
+
id = found[0].id;
|
|
142
|
+
}
|
|
143
|
+
let status = action === "allow-network" ? await call(io, target, "POST", "/remote-access/networks", { id }) : await call(io, target, "DELETE", `/remote-access/networks/${encodeURIComponent(id)}`);
|
|
144
|
+
return io.stdout(json ? `${JSON.stringify(status, null, 2)}
|
|
145
|
+
` : formatRemoteStatus(status)), 0;
|
|
146
|
+
}
|
|
147
|
+
if (action === "serve") {
|
|
148
|
+
let mode = rest[0];
|
|
149
|
+
if (mode !== "on" && mode !== "off")
|
|
150
|
+
return io.stderr(`${REMOTE_USAGE}
|
|
151
|
+
`), 2;
|
|
152
|
+
let out = await call(io, target, "POST", "/remote-access/tailscale-serve", { enabled: mode === "on" });
|
|
153
|
+
return out.output && io.stderr(`${out.output}
|
|
154
|
+
`), io.stdout(`tailscale serve is ${out.tailscale.serve}${out.tailscale.httpsUrl ? ` at ${out.tailscale.httpsUrl}` : ""}
|
|
155
|
+
`), 0;
|
|
156
|
+
}
|
|
157
|
+
return io.stderr(`${REMOTE_USAGE}
|
|
158
|
+
`), 2;
|
|
159
|
+
}
|
|
160
|
+
async function devicesCommand(args, io, target) {
|
|
161
|
+
let [action, ...rest] = args, json = args.includes("--json");
|
|
162
|
+
if (!action || action === "list" || action === "--json") {
|
|
163
|
+
let status = await call(io, target, "GET", "/remote-access");
|
|
164
|
+
return io.stdout(json ? `${JSON.stringify(status.devices, null, 2)}
|
|
165
|
+
` : formatDevices(status.devices)), 0;
|
|
166
|
+
}
|
|
167
|
+
if (action === "add") {
|
|
168
|
+
let label = rest.filter((a) => a !== "--json").join(" ").trim();
|
|
169
|
+
if (!label)
|
|
170
|
+
return io.stderr(`Usage: adf daemon devices add <label>
|
|
171
|
+
`), 2;
|
|
172
|
+
let created = await call(io, target, "POST", "/remote-access/devices", { label });
|
|
173
|
+
io.stdout(`${created.token}
|
|
174
|
+
`);
|
|
175
|
+
let status = await call(io, target, "GET", "/remote-access"), url = status.urls.find((u) => u.encrypted)?.url ?? status.urls[0]?.url ?? "<this computer's address>";
|
|
176
|
+
return io.stderr(`Device token for "${created.device.label}" (id ${created.device.id}). It is shown once and is as powerful as your seed phrase.
|
|
177
|
+
`), io.stderr(`On the other computer: adf --url ${url} --token <token>, or paste both in ADF Studio \u2192 Settings \u2192 Connections \u2192 Add.
|
|
178
|
+
`), status.enabled || io.stderr(`Remote access is off: turn it on with adf daemon remote on.
|
|
179
|
+
`), 0;
|
|
180
|
+
}
|
|
181
|
+
if (action === "revoke" || action === "remove") {
|
|
182
|
+
let key = rest.join(" ").trim();
|
|
183
|
+
if (!key)
|
|
184
|
+
return io.stderr(`Usage: adf daemon devices revoke <id|label>
|
|
185
|
+
`), 2;
|
|
186
|
+
let status = await call(io, target, "GET", "/remote-access"), byId = status.devices.find((d) => d.id === key), byLabel = status.devices.filter((d) => d.label === key);
|
|
187
|
+
if (!byId && byLabel.length > 1)
|
|
188
|
+
return io.stderr(`Several computers are labelled "${key}"; give the id:
|
|
189
|
+
${formatDevices(byLabel)}`), 1;
|
|
190
|
+
let device = byId ?? byLabel[0];
|
|
191
|
+
if (!device)
|
|
192
|
+
return io.stderr(`No computer "${key}". List them with: adf daemon devices
|
|
193
|
+
`), 1;
|
|
194
|
+
let out = await call(io, target, "DELETE", `/remote-access/devices/${encodeURIComponent(device.id)}`);
|
|
195
|
+
return io.stdout(`Removed "${out.device.label}" (${out.device.id}): its token no longer works; closed ${out.closedSessions} session(s) and ${out.closedConnections} connection(s).
|
|
196
|
+
`), 0;
|
|
197
|
+
}
|
|
198
|
+
return io.stderr(`${REMOTE_USAGE}
|
|
199
|
+
`), 2;
|
|
200
|
+
}
|
|
201
|
+
async function pairCommand(io, target) {
|
|
202
|
+
let sleep = io.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms))), window;
|
|
203
|
+
try {
|
|
204
|
+
window = await call(io, target, "POST", "/remote-access/pairing");
|
|
205
|
+
} catch (err) {
|
|
206
|
+
if (err instanceof ManageError && err.code === "remote_access_off")
|
|
207
|
+
return io.stderr(`Remote access is off. Turn it on first: adf daemon remote on
|
|
208
|
+
`), 1;
|
|
209
|
+
if (err instanceof ManageError && err.code === "remote_access_paused")
|
|
210
|
+
return io.stderr(`${err.message.replace(/\.$/, "")}: adf daemon remote allow-network
|
|
211
|
+
`), 1;
|
|
212
|
+
if (err instanceof ManageError && err.code === "remote_access_not_listening")
|
|
213
|
+
return io.stderr(`${err.message} See: adf daemon remote status
|
|
214
|
+
`), 1;
|
|
215
|
+
throw err;
|
|
216
|
+
}
|
|
217
|
+
let host = (await call(io, target, "GET", "/remote-access")).urls.find((u) => u.kind === "tailnet" || u.kind === "lan")?.url.replace(/^http:\/\//, "").replace(new RegExp(`:${DEFAULT_DAEMON_PORT}$`), "");
|
|
218
|
+
io.stdout(`Pairing with "${window.name}" (fingerprint ${window.fingerprint}) is open for 2 minutes.
|
|
219
|
+
`), io.stdout(`On the other computer: adf pair${host ? ` ${host}` : ""}, or pair with this computer in ADF Studio \u2192 Settings \u2192 Connections.
|
|
220
|
+
`), io.stdout(`Code: ${window.code.slice(0, 3)} ${window.code.slice(3)}
|
|
221
|
+
`), io.stderr(`Waiting for the other computer\u2026 (Ctrl+C closes the window)
|
|
222
|
+
`);
|
|
223
|
+
let interrupted = !1, stop = io.onInterrupt?.(() => {
|
|
224
|
+
interrupted = !0;
|
|
225
|
+
}), lastAttempts = window.attemptsLeft, lastLocked = window.lockedSources ?? 0;
|
|
226
|
+
try {
|
|
227
|
+
for (; ; ) {
|
|
228
|
+
if (interrupted)
|
|
229
|
+
return await call(io, target, "DELETE", "/remote-access/pairing").catch(() => {
|
|
230
|
+
}), io.stderr(`Pairing window closed.
|
|
231
|
+
`), 130;
|
|
232
|
+
let p = (await call(io, target, "GET", "/remote-access")).pairing;
|
|
233
|
+
if (!p || p.openedAt !== window.openedAt)
|
|
234
|
+
return io.stderr(lastAttempts <= 1 && Date.now() < Date.parse(window.expiresAt) ? `Pairing closed after 20 wrong codes. Open a new window when you are ready: adf daemon pair
|
|
235
|
+
` : `Pairing closed: the 2 minutes are over. Open a new window: adf daemon pair
|
|
236
|
+
`), 1;
|
|
237
|
+
if (p.attemptsLeft < lastAttempts && io.stderr(`A wrong code was entered (${p.attemptsLeft} left in this window).
|
|
238
|
+
`), lastAttempts = p.attemptsLeft, p.lockedSources > lastLocked && (io.stderr(`A computer entered 5 wrong codes and is locked out of this window (${p.lockedSources} so far). Others can still pair.
|
|
239
|
+
`), lastLocked = p.lockedSources), p.claim) {
|
|
240
|
+
let c = p.claim, where = `${c.address}, ${c.via === "tailnet" ? "tailnet" : c.via === "proxy" ? "through a proxy on this computer" : "this network"}${c.tailnetLogin ? `, ${c.tailnetLogin}` : ""}`, answer = await io.prompt(`Allow "${c.deviceName}" (${where}) to control this computer's ADF daemon? It gets the same power as your seed phrase. [y/N] `), allow = answer !== null && /^\s*y(es)?\s*$/i.test(answer), decided = await call(io, target, "POST", `/remote-access/pairing/claims/${encodeURIComponent(c.claimId)}`, { allow });
|
|
241
|
+
return decided.state === "approved" ? (io.stdout(`Allowed: "${decided.device.label}" (${decided.device.id}) can now connect. Remove it any time: adf daemon devices revoke ${decided.device.id}
|
|
242
|
+
`), 0) : (io.stdout(`Denied: "${c.deviceName}" was not allowed.
|
|
243
|
+
`), 1);
|
|
244
|
+
}
|
|
245
|
+
await sleep(1e3);
|
|
246
|
+
}
|
|
247
|
+
} finally {
|
|
248
|
+
stop?.();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async function runHostRemoteCommand(sub, args, io, target) {
|
|
252
|
+
if (args.includes("--help") || args.includes("-h"))
|
|
253
|
+
return io.stdout(`${REMOTE_USAGE}
|
|
254
|
+
`), 0;
|
|
255
|
+
try {
|
|
256
|
+
return sub === "remote" ? await remoteCommand(args, io, target) : sub === "devices" ? await devicesCommand(args, io, target) : await pairCommand(io, target);
|
|
257
|
+
} catch (err) {
|
|
258
|
+
return err instanceof TypeError ? (io.stderr(`Cannot reach the ADF daemon at ${target.url} (${err.message}). Start it with: adf daemon start
|
|
259
|
+
`), 1) : (io.stderr(`${err instanceof Error ? err.message : String(err)}
|
|
260
|
+
`), 1);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
export {
|
|
264
|
+
REMOTE_USAGE,
|
|
265
|
+
formatDevices,
|
|
266
|
+
formatRemoteStatus,
|
|
267
|
+
runHostRemoteCommand
|
|
268
|
+
};
|