@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
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
require_follow_redirects,
|
|
10
10
|
require_form_data
|
|
11
11
|
} from "./chunk-IIGMZHQQ.mjs";
|
|
12
|
+
import "./chunk-AUYKRQPJ.mjs";
|
|
13
|
+
import "./chunk-NZ7JTHEO.mjs";
|
|
12
14
|
import {
|
|
13
15
|
require_ws
|
|
14
16
|
} from "./chunk-6XUV6EK6.mjs";
|
|
@@ -22,8 +24,6 @@ import {
|
|
|
22
24
|
} from "./chunk-IC4JDZCI.mjs";
|
|
23
25
|
import "./chunk-M3WPIJYM.mjs";
|
|
24
26
|
import "./chunk-UYY5M2PB.mjs";
|
|
25
|
-
import "./chunk-AUYKRQPJ.mjs";
|
|
26
|
-
import "./chunk-NZ7JTHEO.mjs";
|
|
27
27
|
import "./chunk-ZJKXHM4Q.mjs";
|
|
28
28
|
import "./chunk-RIX34QHC.mjs";
|
|
29
29
|
import {
|
|
@@ -8022,10 +8022,9 @@ var SlackAdapter = class {
|
|
|
8022
8022
|
if (att.data)
|
|
8023
8023
|
try {
|
|
8024
8024
|
let upload = await this.web.filesUploadV2({
|
|
8025
|
-
channel_id: channel,
|
|
8026
8025
|
file: att.data,
|
|
8027
8026
|
filename: att.filename,
|
|
8028
|
-
...threadTs ? { thread_ts: threadTs } : {}
|
|
8027
|
+
...threadTs ? { channel_id: channel, thread_ts: threadTs } : { channel_id: channel }
|
|
8029
8028
|
});
|
|
8030
8029
|
if (upload.ok === !1)
|
|
8031
8030
|
throw new Error(String(upload.error ?? "upload returned ok=false"));
|
|
@@ -7,22 +7,26 @@ const __dirname = __adfDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
PROMPT_PREFILL_KEY,
|
|
9
9
|
StoreProvider,
|
|
10
|
+
TUI_MIN_CLIENT_API_VERSION,
|
|
10
11
|
createTuiStore,
|
|
11
12
|
shallowEqual,
|
|
12
13
|
useActions,
|
|
13
14
|
useClient,
|
|
14
15
|
useStore,
|
|
15
16
|
useTuiSelector
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-RJDOVMM4.mjs";
|
|
18
|
+
import "./chunk-75DC5EWN.mjs";
|
|
17
19
|
import "./chunk-7CV2SA3H.mjs";
|
|
18
|
-
import "./chunk-XNPZBLYL.mjs";
|
|
19
20
|
import "./chunk-SGUTYISF.mjs";
|
|
20
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-7JZXMDDF.mjs";
|
|
21
22
|
import "./chunk-6GJ4QHRI.mjs";
|
|
23
|
+
import "./chunk-LKFHERRV.mjs";
|
|
24
|
+
import "./chunk-VENQBMOA.mjs";
|
|
22
25
|
import "./chunk-M2RX3S2T.mjs";
|
|
23
26
|
export {
|
|
24
27
|
PROMPT_PREFILL_KEY,
|
|
25
28
|
StoreProvider,
|
|
29
|
+
TUI_MIN_CLIENT_API_VERSION,
|
|
26
30
|
createTuiStore,
|
|
27
31
|
shallowEqual,
|
|
28
32
|
useActions,
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
NO_TAILNET,
|
|
9
|
+
TailscaleClient,
|
|
10
|
+
parseServeStatus,
|
|
11
|
+
parseTailnetView,
|
|
12
|
+
parseTailscaleStatus,
|
|
13
|
+
tailnetNameOf,
|
|
14
|
+
tailnetUrlAllowed
|
|
15
|
+
} from "./chunk-V3MM6PCH.mjs";
|
|
16
|
+
import "./chunk-M2RX3S2T.mjs";
|
|
17
|
+
export {
|
|
18
|
+
NO_TAILNET,
|
|
19
|
+
TailscaleClient,
|
|
20
|
+
parseServeStatus,
|
|
21
|
+
parseTailnetView,
|
|
22
|
+
parseTailscaleStatus,
|
|
23
|
+
tailnetNameOf,
|
|
24
|
+
tailnetUrlAllowed
|
|
25
|
+
};
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
findTheme,
|
|
11
11
|
nextThemeName,
|
|
12
12
|
themeNames
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-GAZO6UMI.mjs";
|
|
14
|
+
import "./chunk-NZLEPJ5M.mjs";
|
|
15
15
|
import "./chunk-6GJ4QHRI.mjs";
|
|
16
16
|
import "./chunk-M2RX3S2T.mjs";
|
|
17
17
|
export {
|
|
@@ -5,11 +5,9 @@ const require = __adfCreateRequire(import.meta.url);
|
|
|
5
5
|
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
7
|
import {
|
|
8
|
+
require_token_error,
|
|
8
9
|
require_token_util
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
require_token_error
|
|
12
|
-
} from "./chunk-KWFOS5WC.mjs";
|
|
10
|
+
} from "./chunk-JZFONJSL.mjs";
|
|
13
11
|
import {
|
|
14
12
|
__commonJS
|
|
15
13
|
} from "./chunk-M2RX3S2T.mjs";
|
|
@@ -31,18 +29,24 @@ var require_token = __commonJS({
|
|
|
31
29
|
});
|
|
32
30
|
module.exports = __toCommonJS(token_exports);
|
|
33
31
|
var import_token_error = require_token_error(), import_token_util = require_token_util();
|
|
34
|
-
async function refreshToken() {
|
|
35
|
-
let
|
|
36
|
-
if (!
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
async function refreshToken(options) {
|
|
33
|
+
let projectId = options?.project, teamId = options?.team;
|
|
34
|
+
if (!projectId && !teamId) {
|
|
35
|
+
let projectInfo = (0, import_token_util.findProjectInfo)();
|
|
36
|
+
projectId = projectInfo.projectId, teamId = projectInfo.teamId;
|
|
37
|
+
} else if (!projectId || !teamId) {
|
|
38
|
+
let projectInfo = (0, import_token_util.findProjectInfo)();
|
|
39
|
+
projectId = projectId ?? projectInfo.projectId, teamId = teamId ?? projectInfo.teamId;
|
|
40
|
+
}
|
|
41
|
+
if (!projectId)
|
|
42
|
+
throw new import_token_error.VercelOidcTokenError(
|
|
43
|
+
"Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`"
|
|
44
|
+
);
|
|
45
|
+
let maybeToken = (0, import_token_util.loadToken)(projectId);
|
|
46
|
+
if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token), options?.expirationBufferMs)) {
|
|
47
|
+
let authToken = await (0, import_token_util.getVercelToken)({
|
|
48
|
+
expirationBufferMs: options?.expirationBufferMs
|
|
49
|
+
});
|
|
46
50
|
if (maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId), !maybeToken)
|
|
47
51
|
throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
|
|
48
52
|
(0, import_token_util.saveToken)(maybeToken, projectId);
|
|
@@ -6,7 +6,6 @@ const __filename = __adfFileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
require_token_util
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-KWFOS5WC.mjs";
|
|
9
|
+
} from "./chunk-JZFONJSL.mjs";
|
|
11
10
|
import "./chunk-M2RX3S2T.mjs";
|
|
12
11
|
export default require_token_util();
|
|
@@ -6,25 +6,28 @@ const __filename = __adfFileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
DaemonClient
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-XNPZBLYL.mjs";
|
|
11
|
-
import {
|
|
12
|
-
cjs
|
|
13
|
-
} from "./chunk-SGUTYISF.mjs";
|
|
9
|
+
} from "./chunk-IMVMSU3A.mjs";
|
|
14
10
|
import {
|
|
15
11
|
defaultPrefsPath,
|
|
16
12
|
loadPrefs,
|
|
17
13
|
savePrefs
|
|
18
14
|
} from "./chunk-5QU5VY7N.mjs";
|
|
15
|
+
import "./chunk-75DC5EWN.mjs";
|
|
16
|
+
import {
|
|
17
|
+
cjs
|
|
18
|
+
} from "./chunk-SGUTYISF.mjs";
|
|
19
19
|
import {
|
|
20
20
|
daemon_url_exports
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-AEAJDCVK.mjs";
|
|
22
|
+
import "./chunk-BS3USVEA.mjs";
|
|
23
|
+
import "./chunk-WJGPNHGX.mjs";
|
|
24
|
+
import "./chunk-PAK5JCO2.mjs";
|
|
25
|
+
import "./chunk-ZPB3HYM7.mjs";
|
|
26
|
+
import "./chunk-LTX74NU6.mjs";
|
|
24
27
|
import "./chunk-M2RX3S2T.mjs";
|
|
25
28
|
|
|
26
29
|
// src/main/tui/index.tsx
|
|
27
|
-
var { resolveDaemonUrl } = cjs(daemon_url_exports);
|
|
30
|
+
var { resolveDaemonUrl, DEFAULT_DAEMON_URL } = cjs(daemon_url_exports);
|
|
28
31
|
function preferProductionReact(env = process.env) {
|
|
29
32
|
env.NODE_ENV ??= "production";
|
|
30
33
|
}
|
|
@@ -38,7 +41,7 @@ such as a memory consolidator on a nightly timer or a researcher work on their
|
|
|
38
41
|
own goal, on demand or on a schedule.
|
|
39
42
|
|
|
40
43
|
Options:
|
|
41
|
-
--url, -u <url> Daemon URL (default ADF_DAEMON_URL
|
|
44
|
+
--url, -u <url> Daemon URL (default ADF_DAEMON_URL, the default remote, or ${DEFAULT_DAEMON_URL})
|
|
42
45
|
--token <token> Bearer token (default: ADF_DAEMON_TOKEN, else the local daemon's token file)
|
|
43
46
|
--view <id> Start view: chat | files | loops | inspect | fleet | runtime
|
|
44
47
|
--agent <id|handle> Preselect an agent
|
|
@@ -119,12 +122,12 @@ ${tuiUsage()}
|
|
|
119
122
|
] = await Promise.all([
|
|
120
123
|
import("./react-IUIDQ5LX.mjs"),
|
|
121
124
|
import("./build-QF5W473T.mjs"),
|
|
122
|
-
import("./App-
|
|
123
|
-
import("./themes-
|
|
124
|
-
import("./store-
|
|
125
|
-
import("./theme-
|
|
125
|
+
import("./App-4AZZJNN2.mjs"),
|
|
126
|
+
import("./themes-BQ72P446.mjs"),
|
|
127
|
+
import("./store-55CQSAOX.mjs"),
|
|
128
|
+
import("./theme-HLBDTF6F.mjs"),
|
|
126
129
|
import("./terminal-O5WO7C5U.mjs"),
|
|
127
|
-
import("./layout-
|
|
130
|
+
import("./layout-ECWGJF6M.mjs")
|
|
128
131
|
]), { installScreenMirror } = await import("./screen-54BUTYCW.mjs"), uninstallMirror = options.altScreen ? await installScreenMirror(io.stdout).catch(() => () => {
|
|
129
132
|
}) : () => {
|
|
130
133
|
};
|
|
@@ -159,9 +162,9 @@ ${tuiUsage()}
|
|
|
159
162
|
shiftEnterWorks(terminalCaps()) || prefs.tips?.shiftEnter || (savePrefs({ tips: { shiftEnter: !0 } }), store.actions.toast("This terminal sends Shift+Enter as Enter: Alt+Enter or Ctrl+J add a newline \xB7 /terminal-setup to fix", "info", 8e3));
|
|
160
163
|
}, 1500);
|
|
161
164
|
store.start().then(async () => {
|
|
162
|
-
let { recordWelcomeLaunch } = await import("./welcome-
|
|
165
|
+
let { recordWelcomeLaunch } = await import("./welcome-J5JZZAM5.mjs");
|
|
163
166
|
if (recordWelcomeLaunch()) {
|
|
164
|
-
let { openWelcome } = await import("./open-
|
|
167
|
+
let { openWelcome } = await import("./open-3OR6WT4T.mjs");
|
|
165
168
|
openWelcome(store);
|
|
166
169
|
}
|
|
167
170
|
if (!options.agent) return;
|
|
@@ -178,7 +181,7 @@ ${tuiUsage()}
|
|
|
178
181
|
try {
|
|
179
182
|
await instance.waitUntilExit();
|
|
180
183
|
} finally {
|
|
181
|
-
clearTimeout(tipTimer), store.
|
|
184
|
+
clearTimeout(tipTimer), await store.close(), uninstallMirror(), uninstallModes();
|
|
182
185
|
}
|
|
183
186
|
return io.stdout.write(`Left the ADF terminal app. Agents keep running in the daemon at ${client.baseUrl}.
|
|
184
187
|
`), 0;
|
|
@@ -7,9 +7,17 @@ const __dirname = __adfDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
wrapper_default
|
|
9
9
|
} from "./chunk-F5ELW46V.mjs";
|
|
10
|
+
import {
|
|
11
|
+
require_dist,
|
|
12
|
+
require_follow_redirects,
|
|
13
|
+
require_form_data
|
|
14
|
+
} from "./chunk-IIGMZHQQ.mjs";
|
|
10
15
|
import {
|
|
11
16
|
convertToOggOpus
|
|
12
17
|
} from "./chunk-BMNZ2VPS.mjs";
|
|
18
|
+
import "./chunk-AUYKRQPJ.mjs";
|
|
19
|
+
import "./chunk-NZ7JTHEO.mjs";
|
|
20
|
+
import "./chunk-3GNIDM53.mjs";
|
|
13
21
|
import {
|
|
14
22
|
require_atomic_sleep,
|
|
15
23
|
require_on_exit_leak_free,
|
|
@@ -19,11 +27,6 @@ import {
|
|
|
19
27
|
require_safe_stable_stringify,
|
|
20
28
|
require_sonic_boom
|
|
21
29
|
} from "./chunk-7N2R2VCG.mjs";
|
|
22
|
-
import {
|
|
23
|
-
require_dist,
|
|
24
|
-
require_follow_redirects,
|
|
25
|
-
require_form_data
|
|
26
|
-
} from "./chunk-IIGMZHQQ.mjs";
|
|
27
30
|
import "./chunk-NGK6PVSF.mjs";
|
|
28
31
|
import {
|
|
29
32
|
GroupMetaCache,
|
|
@@ -34,11 +37,8 @@ import {
|
|
|
34
37
|
} from "./chunk-IC4JDZCI.mjs";
|
|
35
38
|
import "./chunk-M3WPIJYM.mjs";
|
|
36
39
|
import "./chunk-UYY5M2PB.mjs";
|
|
37
|
-
import "./chunk-AUYKRQPJ.mjs";
|
|
38
|
-
import "./chunk-NZ7JTHEO.mjs";
|
|
39
40
|
import "./chunk-ZJKXHM4Q.mjs";
|
|
40
41
|
import "./chunk-RIX34QHC.mjs";
|
|
41
|
-
import "./chunk-3GNIDM53.mjs";
|
|
42
42
|
import {
|
|
43
43
|
__commonJS,
|
|
44
44
|
__export,
|
|
@@ -74833,7 +74833,7 @@ var extractVideoThumb = async (path, destPath, time, size) => new Promise((resol
|
|
|
74833
74833
|
};
|
|
74834
74834
|
};
|
|
74835
74835
|
async function getAudioDuration(buffer) {
|
|
74836
|
-
let musicMetadata = await import("./lib-
|
|
74836
|
+
let musicMetadata = await import("./lib-L27L5PXM.mjs"), metadata, options = {
|
|
74837
74837
|
duration: !0
|
|
74838
74838
|
};
|
|
74839
74839
|
return Buffer.isBuffer(buffer) ? metadata = await musicMetadata.parseBuffer(buffer, void 0, options) : typeof buffer == "string" ? metadata = await musicMetadata.parseFile(buffer, options) : metadata = await musicMetadata.parseStream(buffer, void 0, options), metadata.format.duration;
|
package/package.json
CHANGED
|
@@ -1,94 +0,0 @@
|
|
|
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
|
-
readLocalProof
|
|
9
|
-
} from "./chunk-UEZR2CNS.mjs";
|
|
10
|
-
import {
|
|
11
|
-
daemonSettingsDir,
|
|
12
|
-
readDaemonToken
|
|
13
|
-
} from "./chunk-IHDDCZBS.mjs";
|
|
14
|
-
import {
|
|
15
|
-
__export
|
|
16
|
-
} from "./chunk-M2RX3S2T.mjs";
|
|
17
|
-
|
|
18
|
-
// src/main/cli/daemon-url.ts
|
|
19
|
-
var daemon_url_exports = {};
|
|
20
|
-
__export(daemon_url_exports, {
|
|
21
|
-
DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
|
|
22
|
-
DEFAULT_DAEMON_URL: () => DEFAULT_DAEMON_URL,
|
|
23
|
-
isLocalDaemonUrl: () => isLocalDaemonUrl,
|
|
24
|
-
isLocalOnlyRoute: () => isLocalOnlyRoute,
|
|
25
|
-
localDaemonToken: () => localDaemonToken,
|
|
26
|
-
localProofHeaders: () => localProofHeaders,
|
|
27
|
-
loopbackPort: () => loopbackPort,
|
|
28
|
-
resolveDaemonToken: () => resolveDaemonToken,
|
|
29
|
-
resolveDaemonUrl: () => resolveDaemonUrl,
|
|
30
|
-
tunnelTokenHint: () => tunnelTokenHint
|
|
31
|
-
});
|
|
32
|
-
import { readFileSync } from "node:fs";
|
|
33
|
-
import { join } from "node:path";
|
|
34
|
-
var DEFAULT_DAEMON_PORT = 7385, DEFAULT_DAEMON_URL = `http://127.0.0.1:${DEFAULT_DAEMON_PORT}`;
|
|
35
|
-
function resolveDaemonUrl(explicit, env = process.env) {
|
|
36
|
-
return (explicit ?? env.ADF_DAEMON_URL ?? DEFAULT_DAEMON_URL).replace(/\/+$/, "");
|
|
37
|
-
}
|
|
38
|
-
function loopbackPort(url) {
|
|
39
|
-
try {
|
|
40
|
-
let parsed = new URL(url), host = parsed.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
41
|
-
return host === "localhost" || host === "::1" || /^127\./.test(host) ? parsed.port ? Number(parsed.port) : parsed.protocol === "https:" ? 443 : 80 : null;
|
|
42
|
-
} catch {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function pidFileAlive(file) {
|
|
47
|
-
try {
|
|
48
|
-
let raw = readFileSync(file, "utf-8").trim(), pid = raw.startsWith("{") ? JSON.parse(raw).pid : Number.parseInt(raw, 10);
|
|
49
|
-
if (typeof pid != "number" || !Number.isFinite(pid) || pid <= 0) return !1;
|
|
50
|
-
try {
|
|
51
|
-
return process.kill(pid, 0), !0;
|
|
52
|
-
} catch (err) {
|
|
53
|
-
return err?.code === "EPERM";
|
|
54
|
-
}
|
|
55
|
-
} catch {
|
|
56
|
-
return !1;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function isLocalDaemonUrl(url, env = process.env) {
|
|
60
|
-
let port = loopbackPort(url);
|
|
61
|
-
return port === null ? !1 : port === DEFAULT_DAEMON_PORT || port === Number(env.ADF_DAEMON_PORT) ? !0 : pidFileAlive(join(daemonSettingsDir(env), `adf-daemon-${port}.pid`));
|
|
62
|
-
}
|
|
63
|
-
function localDaemonToken(url, env = process.env) {
|
|
64
|
-
if (isLocalDaemonUrl(url, env))
|
|
65
|
-
return readDaemonToken(daemonSettingsDir(env)) ?? void 0;
|
|
66
|
-
}
|
|
67
|
-
function tunnelTokenHint(url, explicit, env = process.env) {
|
|
68
|
-
return explicit || env.ADF_DAEMON_TOKEN || loopbackPort(url) === null || isLocalDaemonUrl(url, env) ? null : `${url} is not this machine's daemon port (${Number(env.ADF_DAEMON_PORT) || DEFAULT_DAEMON_PORT}; e.g. an SSH tunnel), so the local token is not sent there. Pass --token or set ADF_DAEMON_TOKEN to the remote daemon's token (print it on that host with: adf daemon token).`;
|
|
69
|
-
}
|
|
70
|
-
function resolveDaemonToken(explicit, env = process.env, url) {
|
|
71
|
-
let token = explicit ?? env.ADF_DAEMON_TOKEN;
|
|
72
|
-
return token || (url ? localDaemonToken(url, env) : void 0);
|
|
73
|
-
}
|
|
74
|
-
function isLocalOnlyRoute(path) {
|
|
75
|
-
let p = path.split("?")[0];
|
|
76
|
-
return p === "/daemon/shutdown" || /^\/identity\/(create|restore|unlock|lock|confirm-backup)$/.test(p);
|
|
77
|
-
}
|
|
78
|
-
function localProofHeaders(url, path, env = process.env) {
|
|
79
|
-
if (!isLocalOnlyRoute(path) || !isLocalDaemonUrl(url, env)) return {};
|
|
80
|
-
let proof = readLocalProof(daemonSettingsDir(env), loopbackPort(url) ?? DEFAULT_DAEMON_PORT);
|
|
81
|
-
return proof ? { "X-ADF-Local-Proof": proof } : {};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export {
|
|
85
|
-
DEFAULT_DAEMON_PORT,
|
|
86
|
-
DEFAULT_DAEMON_URL,
|
|
87
|
-
resolveDaemonUrl,
|
|
88
|
-
loopbackPort,
|
|
89
|
-
isLocalDaemonUrl,
|
|
90
|
-
tunnelTokenHint,
|
|
91
|
-
resolveDaemonToken,
|
|
92
|
-
localProofHeaders,
|
|
93
|
-
daemon_url_exports
|
|
94
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
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
|
-
__require
|
|
9
|
-
} from "./chunk-M2RX3S2T.mjs";
|
|
10
|
-
|
|
11
|
-
// src/main/daemon/daemon-token.ts
|
|
12
|
-
import { chmodSync, existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
|
-
import { dirname, join as join2 } from "node:path";
|
|
14
|
-
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
15
|
-
|
|
16
|
-
// src/main/utils/user-data-path.ts
|
|
17
|
-
import { homedir } from "node:os";
|
|
18
|
-
import { tmpdir } from "node:os";
|
|
19
|
-
import { join } from "node:path";
|
|
20
|
-
import { existsSync } from "node:fs";
|
|
21
|
-
var PRODUCT_NAME = "ADF Studio", PACKAGE_NAME = "adf-studio", SETTINGS_FILE = "adf-settings.json";
|
|
22
|
-
function getUserDataPath() {
|
|
23
|
-
if (process.env.ADF_USER_DATA_DIR) return process.env.ADF_USER_DATA_DIR;
|
|
24
|
-
let electronApp = getElectronApp();
|
|
25
|
-
return electronApp?.getPath ? electronApp.getPath("userData") : defaultUserDataPath();
|
|
26
|
-
}
|
|
27
|
-
function getTempPath() {
|
|
28
|
-
if (process.env.ADF_TEMP_DIR) return process.env.ADF_TEMP_DIR;
|
|
29
|
-
let electronApp = getElectronApp();
|
|
30
|
-
return electronApp?.getPath ? electronApp.getPath("temp") : tmpdir();
|
|
31
|
-
}
|
|
32
|
-
function platformConfigBase() {
|
|
33
|
-
return process.platform === "darwin" ? join(homedir(), "Library", "Application Support") : process.platform === "win32" ? process.env.APPDATA ?? join(homedir(), "AppData", "Roaming") : process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config");
|
|
34
|
-
}
|
|
35
|
-
var loggedDefaultPath = null;
|
|
36
|
-
function defaultUserDataPath(options = {}) {
|
|
37
|
-
if (process.env.ADF_USER_DATA_DIR) return process.env.ADF_USER_DATA_DIR;
|
|
38
|
-
let base = platformConfigBase(), productDir = join(base, PRODUCT_NAME), packageDir = join(base, PACKAGE_NAME), chosen = existsSync(join(productDir, SETTINGS_FILE)) ? productDir : packageDir;
|
|
39
|
-
return !options.quiet && loggedDefaultPath !== chosen && (loggedDefaultPath = chosen, console.log(`[UserDataPath] Using user data directory: ${chosen}`)), chosen;
|
|
40
|
-
}
|
|
41
|
-
function getElectronApp() {
|
|
42
|
-
try {
|
|
43
|
-
return __require("electron").app ?? null;
|
|
44
|
-
} catch {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// src/main/daemon/daemon-token.ts
|
|
50
|
-
var DAEMON_TOKEN_FILENAME = "daemon-token", MIN_TOKEN_LENGTH = 32;
|
|
51
|
-
function daemonTokenPath(settingsDir) {
|
|
52
|
-
return join2(settingsDir, DAEMON_TOKEN_FILENAME);
|
|
53
|
-
}
|
|
54
|
-
function daemonSettingsDir(env = process.env) {
|
|
55
|
-
let settingsFile = env.ADF_DAEMON_SETTINGS ?? join2(defaultUserDataPath({ quiet: !0 }), "adf-settings.json");
|
|
56
|
-
return dirname(settingsFile);
|
|
57
|
-
}
|
|
58
|
-
function validToken(raw) {
|
|
59
|
-
let token = raw.trim();
|
|
60
|
-
return token.length >= MIN_TOKEN_LENGTH && /^[A-Za-z0-9_-]+$/.test(token) ? token : null;
|
|
61
|
-
}
|
|
62
|
-
function readDaemonToken(settingsDir) {
|
|
63
|
-
try {
|
|
64
|
-
return validToken(readFileSync(daemonTokenPath(settingsDir), "utf-8"));
|
|
65
|
-
} catch {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function ensureDaemonToken(settingsDir) {
|
|
70
|
-
let path = daemonTokenPath(settingsDir), existing = readDaemonToken(settingsDir);
|
|
71
|
-
if (existing) {
|
|
72
|
-
try {
|
|
73
|
-
chmodSync(path, 384);
|
|
74
|
-
} catch {
|
|
75
|
-
}
|
|
76
|
-
return { token: existing, path, created: !1 };
|
|
77
|
-
}
|
|
78
|
-
mkdirSync(settingsDir, { recursive: !0 });
|
|
79
|
-
let token = randomBytes(32).toString("base64url");
|
|
80
|
-
if (!existsSync2(path))
|
|
81
|
-
try {
|
|
82
|
-
return writeFileSync(path, `${token}
|
|
83
|
-
`, { mode: 384, flag: "wx" }), { token, path, created: !0 };
|
|
84
|
-
} catch (err) {
|
|
85
|
-
if (err?.code !== "EEXIST") throw err;
|
|
86
|
-
let raced = readDaemonToken(settingsDir);
|
|
87
|
-
if (raced) return { token: raced, path, created: !1 };
|
|
88
|
-
}
|
|
89
|
-
writeFileSync(path, `${token}
|
|
90
|
-
`, { mode: 384 });
|
|
91
|
-
try {
|
|
92
|
-
chmodSync(path, 384);
|
|
93
|
-
} catch {
|
|
94
|
-
}
|
|
95
|
-
return { token, path, created: !0 };
|
|
96
|
-
}
|
|
97
|
-
function tokensEqual(presented, expected) {
|
|
98
|
-
let a = createHash("sha256").update(presented, "utf-8").digest(), b = createHash("sha256").update(expected, "utf-8").digest();
|
|
99
|
-
return timingSafeEqual(a, b);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export {
|
|
103
|
-
getUserDataPath,
|
|
104
|
-
getTempPath,
|
|
105
|
-
defaultUserDataPath,
|
|
106
|
-
DAEMON_TOKEN_FILENAME,
|
|
107
|
-
daemonTokenPath,
|
|
108
|
-
daemonSettingsDir,
|
|
109
|
-
readDaemonToken,
|
|
110
|
-
ensureDaemonToken,
|
|
111
|
-
tokensEqual
|
|
112
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
__commonJS
|
|
9
|
-
} from "./chunk-M2RX3S2T.mjs";
|
|
10
|
-
|
|
11
|
-
// node_modules/@vercel/oidc/dist/token-error.js
|
|
12
|
-
var require_token_error = __commonJS({
|
|
13
|
-
"node_modules/@vercel/oidc/dist/token-error.js"(exports, module) {
|
|
14
|
-
"use strict";
|
|
15
|
-
var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __hasOwnProp = Object.prototype.hasOwnProperty, __export = (target, all) => {
|
|
16
|
-
for (var name in all)
|
|
17
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
18
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
-
return to;
|
|
23
|
-
}, __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod), token_error_exports = {};
|
|
24
|
-
__export(token_error_exports, {
|
|
25
|
-
VercelOidcTokenError: () => VercelOidcTokenError
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(token_error_exports);
|
|
28
|
-
var VercelOidcTokenError = class extends Error {
|
|
29
|
-
constructor(message, cause) {
|
|
30
|
-
super(message), this.name = "VercelOidcTokenError", this.cause = cause;
|
|
31
|
-
}
|
|
32
|
-
toString() {
|
|
33
|
-
return this.cause ? `${this.name}: ${this.message}: ${this.cause}` : `${this.name}: ${this.message}`;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
require_token_error
|
|
41
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
tokensEqual
|
|
9
|
-
} from "./chunk-IHDDCZBS.mjs";
|
|
10
|
-
|
|
11
|
-
// src/main/daemon/local-access.ts
|
|
12
|
-
import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
|
-
import { join } from "node:path";
|
|
14
|
-
import { randomBytes } from "node:crypto";
|
|
15
|
-
var LOCAL_PROOF_FILENAME = "daemon-local-proof", LOCAL_PROOF_HEADER = "x-adf-local-proof", BEHIND_PROXY_ENV = "ADF_DAEMON_BEHIND_PROXY", PROXY_HEADERS = ["forwarded", "x-forwarded-for", "x-forwarded-host", "x-forwarded-proto", "x-real-ip", "via"];
|
|
16
|
-
function isLoopbackAddress(address) {
|
|
17
|
-
return address ? address === "::1" || address.startsWith("127.") || address.startsWith("::ffff:127.") : !1;
|
|
18
|
-
}
|
|
19
|
-
function hasProxyHeaders(headers) {
|
|
20
|
-
return PROXY_HEADERS.some((name) => headers[name] !== void 0);
|
|
21
|
-
}
|
|
22
|
-
function behindProxyFromEnv(env = process.env) {
|
|
23
|
-
return /^(1|true|yes|on)$/i.test((env[BEHIND_PROXY_ENV] ?? "").trim());
|
|
24
|
-
}
|
|
25
|
-
var DEFAULT_PORT = 7385;
|
|
26
|
-
function localProofPath(settingsDir, port = DEFAULT_PORT) {
|
|
27
|
-
return join(settingsDir, port === DEFAULT_PORT ? LOCAL_PROOF_FILENAME : `${LOCAL_PROOF_FILENAME}-${port}`);
|
|
28
|
-
}
|
|
29
|
-
function mintLocalProof(settingsDir, port = DEFAULT_PORT) {
|
|
30
|
-
mkdirSync(settingsDir, { recursive: !0 });
|
|
31
|
-
let proof = randomBytes(32).toString("base64url"), path = localProofPath(settingsDir, port);
|
|
32
|
-
writeFileSync(path, `${proof}
|
|
33
|
-
`, { mode: 384 });
|
|
34
|
-
try {
|
|
35
|
-
chmodSync(path, 384);
|
|
36
|
-
} catch {
|
|
37
|
-
}
|
|
38
|
-
return { proof, path };
|
|
39
|
-
}
|
|
40
|
-
function readLocalProof(settingsDir, port = DEFAULT_PORT) {
|
|
41
|
-
try {
|
|
42
|
-
let proof = readFileSync(localProofPath(settingsDir, port), "utf-8").trim();
|
|
43
|
-
return /^[A-Za-z0-9_-]{32,}$/.test(proof) ? proof : null;
|
|
44
|
-
} catch {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function localAccessRefusal(request, opts) {
|
|
49
|
-
if (!isLoopbackAddress(request.remoteAddress)) return "the request did not come from this machine";
|
|
50
|
-
if (hasProxyHeaders(request.headers)) return "the request came through a proxy (forwarded headers)";
|
|
51
|
-
if (opts.behindProxy) {
|
|
52
|
-
let raw = request.headers[LOCAL_PROOF_HEADER], presented = (Array.isArray(raw) ? raw[0] : raw)?.trim();
|
|
53
|
-
if (!presented || !opts.localProof || !tokensEqual(presented, opts.localProof))
|
|
54
|
-
return `the daemon runs behind a proxy (${BEHIND_PROXY_ENV}) and the request lacks this machine's local proof`;
|
|
55
|
-
}
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
BEHIND_PROXY_ENV,
|
|
61
|
-
behindProxyFromEnv,
|
|
62
|
-
mintLocalProof,
|
|
63
|
-
readLocalProof,
|
|
64
|
-
localAccessRefusal
|
|
65
|
-
};
|