@agentdocumentformat/cli 0.8.2 → 0.8.4
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 +55 -4
- package/dist/adf.mjs +16 -13
- package/dist/chunks/{App-4AZZJNN2.mjs → App-XOPHZTGN.mjs} +515 -349
- package/dist/chunks/{auth-manager-TBNKCJ45.mjs → auth-manager-2YHTYI3C.mjs} +2 -1
- package/dist/chunks/{build-QF5W473T.mjs → build-BFOCXM5S.mjs} +1 -1
- package/dist/chunks/{chunk-RHBGCOS3.mjs → chunk-22ZGZFOV.mjs} +5 -16
- package/dist/chunks/chunk-26RK7T5L.mjs +20 -0
- package/dist/chunks/{chunk-KCIRFUZH.mjs → chunk-2WIFHJV2.mjs} +2 -2
- package/dist/chunks/{chunk-D7A77SNL.mjs → chunk-3FWPIWYM.mjs} +1 -1
- package/dist/chunks/chunk-4T745GJA.mjs +431 -0
- package/dist/chunks/{chunk-7JZXMDDF.mjs → chunk-7ADDKFT5.mjs} +105 -31
- package/dist/chunks/chunk-A53XYNJL.mjs +26 -0
- package/dist/chunks/{chunk-MZRXFWPQ.mjs → chunk-AN6USKYQ.mjs} +40 -8
- package/dist/chunks/{chunk-2Z7X3UUR.mjs → chunk-DHO5Z6HP.mjs} +14 -12
- package/dist/chunks/{chunk-F5ELW46V.mjs → chunk-GJYMGPH4.mjs} +1 -0
- package/dist/chunks/chunk-HONGRUAE.mjs +175 -0
- package/dist/chunks/{chunk-AEAJDCVK.mjs → chunk-IM5JKLXO.mjs} +1 -1
- package/dist/chunks/chunk-J2N63ZUD.mjs +12 -0
- package/dist/chunks/{chunk-IMVMSU3A.mjs → chunk-JK6K2BMV.mjs} +12 -38
- package/dist/chunks/{chunk-75DC5EWN.mjs → chunk-KBXC5EHK.mjs} +1 -0
- package/dist/chunks/chunk-NRTRTR7C.mjs +43 -0
- package/dist/chunks/{chunk-BS3USVEA.mjs → chunk-P4G5ZEBI.mjs} +1 -1
- package/dist/chunks/{chunk-E7LC6SHP.mjs → chunk-RIAB37IS.mjs} +4 -2
- package/dist/chunks/{chunk-LVF2DRBR.mjs → chunk-TBMQOM7Y.mjs} +247 -610
- package/dist/chunks/{chunk-SOSPQPEN.mjs → chunk-TDRQG5UO.mjs} +1 -162
- package/dist/chunks/{chunk-RJDOVMM4.mjs → chunk-TPA2ITKV.mjs} +49 -33
- package/dist/chunks/{chunk-BHY7QDCM.mjs → chunk-UBWWGUMU.mjs} +1 -0
- package/dist/chunks/{chunk-3AT7IIP7.mjs → chunk-WZ6S3SQP.mjs} +1 -1
- package/dist/chunks/chunk-X6R32YVE.mjs +43 -0
- package/dist/chunks/chunk-XJWGENZ5.mjs +5903 -0
- package/dist/chunks/{chunk-F3WSCAJD.mjs → chunk-XP4U4A2W.mjs} +1 -1
- package/dist/chunks/chunk-XS46KYYY.mjs +31 -0
- package/dist/chunks/{chunk-HBOFZRUS.mjs → chunk-XZQVDY3U.mjs} +9 -1
- package/dist/chunks/chunk-ZECGH3LT.mjs +88 -0
- package/dist/chunks/{claude-subscription-EB4LAAVV.mjs → claude-subscription-42L4YM5L.mjs} +4 -3
- package/dist/chunks/{cli-PCVFB6B4.mjs → cli-JPRYEY4J.mjs} +53 -13
- package/dist/chunks/{commands-KOMPXJZS.mjs → commands-TZW2FSXG.mjs} +5 -2
- package/dist/chunks/context-AZOIJOUG.mjs +5933 -0
- package/dist/chunks/{daemon-HEQ3FUYH.mjs → daemon-DK3KUDZJ.mjs} +3571 -6806
- package/dist/chunks/{daemon-control-MKN7G5M3.mjs → daemon-control-U4OGCAAJ.mjs} +4 -4
- package/dist/chunks/{devtools-H7CI2ZVG.mjs → devtools-AUZWFIPL.mjs} +1 -1
- package/dist/chunks/firewall-service-7RGJN4LD.mjs +163 -0
- package/dist/chunks/{open-3OR6WT4T.mjs → open-T3VGLWGF.mjs} +6 -5
- package/dist/chunks/{pipeline-executor-DRYEEFDR.mjs → pipeline-executor-MHRI7ODL.mjs} +6 -3
- package/dist/chunks/{remote-access-cli-GLEEP7DI.mjs → remote-access-cli-EFVCXFOY.mjs} +22 -6
- package/dist/chunks/{store-55CQSAOX.mjs → store-37YHXFJ6.mjs} +4 -3
- package/dist/chunks/{tui-RAUVFOYY.mjs → tui-NJKGFAKU.mjs} +12 -11
- package/dist/chunks/web-F4XHDGUX.mjs +149 -0
- package/dist/chunks/{whatsapp-YJFFVN4Q.mjs → whatsapp-J7PX7TKT.mjs} +1 -1
- package/package.json +4 -3
- package/web/assets/EditorPanel-5ZGWvexa.js +161 -0
- package/web/assets/MeshGraphView-BZV40eAE.css +1 -0
- package/web/assets/MeshGraphView-Vp2R5TLK.js +23 -0
- package/web/assets/SettingsPage-_uHkBERV.js +6 -0
- package/web/assets/agent-window-B8X7FV4_.js +3 -0
- package/web/assets/agent.store-BHweGGTh.js +1 -0
- package/web/assets/app.store-j_-OuVPe.js +1 -0
- package/web/assets/core-DVezgdzc.js +12 -0
- package/web/assets/css-Z72CF80r.js +1 -0
- package/web/assets/diff-D97Zzqfu.js +1 -0
- package/web/assets/document.store-CMD3_OM0.js +1 -0
- package/web/assets/edit-recovery-Ce8tPQZl.js +3 -0
- package/web/assets/engine-javascript-CuxHA8oH.js +141 -0
- package/web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/web/assets/github-light-DAi9KRSo.js +1 -0
- package/web/assets/go-C27-OAKa.js +1 -0
- package/web/assets/html-BlS82ilI.js +1 -0
- package/web/assets/index-B5Eot_tL.js +1 -0
- package/web/assets/index-B5FYMbFc.js +3 -0
- package/web/assets/index-BQIEMvvt.js +2 -0
- package/web/assets/index-C_gf4L3q.js +1 -0
- package/web/assets/index-Ca6bEWGu.js +1 -0
- package/web/assets/index-CuTaWSEs.css +1 -0
- package/web/assets/index-DBFkrLao.js +1 -0
- package/web/assets/index-DF1leTEa.js +11 -0
- package/web/assets/index-DS9H-PJI.js +1 -0
- package/web/assets/index-DkhbLs9K.js +6 -0
- package/web/assets/index-KNnHrO8-.js +13 -0
- package/web/assets/index-nM_Q5x7Q.js +1 -0
- package/web/assets/inter-tight-cyrillic-ext-wght-italic-BJqtfpQe.woff2 +0 -0
- package/web/assets/inter-tight-cyrillic-ext-wght-normal-okcGN4Nq.woff2 +0 -0
- package/web/assets/inter-tight-cyrillic-wght-italic-HmhN1gQv.woff2 +0 -0
- package/web/assets/inter-tight-cyrillic-wght-normal-BS41q_Tv.woff2 +0 -0
- package/web/assets/inter-tight-greek-ext-wght-italic-B_3RbJza.woff2 +0 -0
- package/web/assets/inter-tight-greek-ext-wght-normal-DQgQPNk4.woff2 +0 -0
- package/web/assets/inter-tight-greek-wght-italic-Bb1BGCmL.woff2 +0 -0
- package/web/assets/inter-tight-greek-wght-normal-sS1B39LI.woff2 +0 -0
- package/web/assets/inter-tight-latin-ext-wght-italic-DYqsmiDd.woff2 +0 -0
- package/web/assets/inter-tight-latin-ext-wght-normal-B4u9PlvR.woff2 +0 -0
- package/web/assets/inter-tight-latin-wght-italic-DiXukCDG.woff2 +0 -0
- package/web/assets/inter-tight-latin-wght-normal-DX-nOvPD.woff2 +0 -0
- package/web/assets/inter-tight-vietnamese-wght-italic-CiVF0Juh.woff2 +0 -0
- package/web/assets/inter-tight-vietnamese-wght-normal-TKKdAiBA.woff2 +0 -0
- package/web/assets/javascript-wDzz0qaB.js +1 -0
- package/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/web/assets/json-Cp-IABpG.js +1 -0
- package/web/assets/jsx-g9-lgVsj.js +1 -0
- package/web/assets/main-Zf3qnQYd.css +1 -0
- package/web/assets/main-o2ocfqUC.js +319 -0
- package/web/assets/markdown-Cvjx9yec.js +1 -0
- package/web/assets/message-queue.store-ke_rFZAb.js +2 -0
- package/web/assets/module-RjUF93sV.js +716 -0
- package/web/assets/native-48B9X9Wg.js +1 -0
- package/web/assets/orbital-render.worker-BovOTauk.js +1 -0
- package/web/assets/python-B6aJPvgy.js +1 -0
- package/web/assets/react-D-F9gHrJ.js +1 -0
- package/web/assets/rust-DPvrY3IQ.js +1 -0
- package/web/assets/shellscript-Yzrsuije.js +1 -0
- package/web/assets/sql-DkvoVjww.js +1 -0
- package/web/assets/stix-two-text-cyrillic-wght-italic-BzL1BdzR.woff2 +0 -0
- package/web/assets/stix-two-text-cyrillic-wght-normal-CcrOj1MU.woff2 +0 -0
- package/web/assets/stix-two-text-greek-wght-italic-glgrbyRu.woff2 +0 -0
- package/web/assets/stix-two-text-greek-wght-normal-DAdwyhkq.woff2 +0 -0
- package/web/assets/stix-two-text-latin-ext-wght-italic--XhV508b.woff2 +0 -0
- package/web/assets/stix-two-text-latin-ext-wght-normal-BUpo8gM0.woff2 +0 -0
- package/web/assets/stix-two-text-latin-wght-italic-BDl6bBME.woff2 +0 -0
- package/web/assets/stix-two-text-latin-wght-normal-BTZaHlTl.woff2 +0 -0
- package/web/assets/stix-two-text-vietnamese-wght-italic-B1jFRJrJ.woff2 +0 -0
- package/web/assets/stix-two-text-vietnamese-wght-normal-CfS0RdBA.woff2 +0 -0
- package/web/assets/tsx-COt5Ahok.js +1 -0
- package/web/assets/typescript-BPQ3VLAy.js +1 -0
- package/web/assets/window-kind-mxlpdE1l.js +1 -0
- package/web/assets/with-selector-Ot-ZoUn0.js +1 -0
- package/web/assets/yaml-Buea-lGh.js +1 -0
- package/web/index.html +15 -0
|
@@ -4,6 +4,9 @@ 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
|
+
parseOwnerCommandRow
|
|
9
|
+
} from "./chunk-NRTRTR7C.mjs";
|
|
7
10
|
import {
|
|
8
11
|
attachmentsOf,
|
|
9
12
|
displayAttachment,
|
|
@@ -14,34 +17,6 @@ import {
|
|
|
14
17
|
__export
|
|
15
18
|
} from "./chunk-M2RX3S2T.mjs";
|
|
16
19
|
|
|
17
|
-
// src/shared/utils/owner-command-row.ts
|
|
18
|
-
var owner_command_row_exports = {};
|
|
19
|
-
__export(owner_command_row_exports, {
|
|
20
|
-
OWNER_COMMAND_MARKER: () => OWNER_COMMAND_MARKER,
|
|
21
|
-
formatOwnerCommandRow: () => formatOwnerCommandRow,
|
|
22
|
-
isOwnerCommandRow: () => isOwnerCommandRow,
|
|
23
|
-
parseOwnerCommandRow: () => parseOwnerCommandRow
|
|
24
|
-
});
|
|
25
|
-
var OWNER_COMMAND_MARKER = "[Owner command] ";
|
|
26
|
-
function formatOwnerCommandRow(header, body) {
|
|
27
|
-
return `${OWNER_COMMAND_MARKER}${JSON.stringify(header)}
|
|
28
|
-
${body}`;
|
|
29
|
-
}
|
|
30
|
-
function parseOwnerCommandRow(text) {
|
|
31
|
-
if (!text.startsWith(OWNER_COMMAND_MARKER)) return null;
|
|
32
|
-
let newline = text.indexOf(`
|
|
33
|
-
`);
|
|
34
|
-
try {
|
|
35
|
-
let header = JSON.parse(text.slice(OWNER_COMMAND_MARKER.length, newline < 0 ? void 0 : newline));
|
|
36
|
-
return !header || header.v !== 1 || typeof header.id != "string" || typeof header.command != "string" || typeof header.lambda != "string" || typeof header.authorized != "boolean" || typeof header.duration_ms != "number" || !Number.isFinite(header.duration_ms) || header.duration_ms < 0 || !["ok", "error", "denied"].includes(header.status) ? null : { header, body: newline < 0 ? "" : text.slice(newline + 1) };
|
|
37
|
-
} catch {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function isOwnerCommandRow(text) {
|
|
42
|
-
return parseOwnerCommandRow(text) !== null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
20
|
// src/shared/utils/loop-parser.ts
|
|
46
21
|
var loop_parser_exports = {};
|
|
47
22
|
__export(loop_parser_exports, {
|
|
@@ -447,11 +422,110 @@ function loopToLLMMessages(entries) {
|
|
|
447
422
|
}));
|
|
448
423
|
}
|
|
449
424
|
|
|
425
|
+
// src/shared/utils/ask-form.ts
|
|
426
|
+
var ask_form_exports = {};
|
|
427
|
+
__export(ask_form_exports, {
|
|
428
|
+
ASK_ALL_SKIPPED: () => ASK_ALL_SKIPPED,
|
|
429
|
+
ASK_SKIPPED: () => ASK_SKIPPED,
|
|
430
|
+
AskAnswerError: () => AskAnswerError,
|
|
431
|
+
askQuestions: () => askQuestions,
|
|
432
|
+
formatAskAnswers: () => formatAskAnswers,
|
|
433
|
+
normalizeAskAnswers: () => normalizeAskAnswers,
|
|
434
|
+
parseAskResult: () => parseAskResult,
|
|
435
|
+
summarizeAsk: () => summarizeAsk
|
|
436
|
+
});
|
|
437
|
+
var ASK_SKIPPED = "(skipped)", ASK_ALL_SKIPPED = "The human skipped all questions.", AskAnswerError = class extends Error {
|
|
438
|
+
constructor(message) {
|
|
439
|
+
super(message), this.name = "AskAnswerError";
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
function askQuestions(input) {
|
|
443
|
+
let obj = input && typeof input == "object" ? input : {};
|
|
444
|
+
if (Array.isArray(obj.questions)) {
|
|
445
|
+
let out = [];
|
|
446
|
+
for (let raw of obj.questions) {
|
|
447
|
+
if (!raw || typeof raw != "object") continue;
|
|
448
|
+
let q = raw;
|
|
449
|
+
if (typeof q.question != "string") continue;
|
|
450
|
+
let options = Array.isArray(q.options) ? q.options.flatMap((o) => {
|
|
451
|
+
if (o && typeof o == "object" && typeof o.label == "string") {
|
|
452
|
+
let { label, description } = o;
|
|
453
|
+
return [typeof description == "string" && description ? { label, description } : { label }];
|
|
454
|
+
}
|
|
455
|
+
return [];
|
|
456
|
+
}) : [];
|
|
457
|
+
out.push({
|
|
458
|
+
question: q.question,
|
|
459
|
+
...options.length > 0 ? { options } : {},
|
|
460
|
+
...options.length > 0 && q.multiple === !0 ? { multiple: !0 } : {}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
return out;
|
|
464
|
+
}
|
|
465
|
+
return typeof obj.question == "string" ? [{ question: obj.question }] : [];
|
|
466
|
+
}
|
|
467
|
+
function summarizeAsk(questions) {
|
|
468
|
+
if (questions.length === 0) return "";
|
|
469
|
+
let first = questions[0].question;
|
|
470
|
+
return questions.length > 1 ? `${first} (+${questions.length - 1} more)` : first;
|
|
471
|
+
}
|
|
472
|
+
function normalizeAskAnswers(questions, raw) {
|
|
473
|
+
if (!Array.isArray(raw)) throw new AskAnswerError("answers must be an array with one entry per question");
|
|
474
|
+
if (raw.length !== questions.length)
|
|
475
|
+
throw new AskAnswerError(`answers has ${raw.length} entries but the ask has ${questions.length} question${questions.length === 1 ? "" : "s"}`);
|
|
476
|
+
return questions.map((q, i) => {
|
|
477
|
+
let value = raw[i], n = i + 1;
|
|
478
|
+
if (value == null) return null;
|
|
479
|
+
if (typeof value == "string") return value.trim() || null;
|
|
480
|
+
if (!Array.isArray(value) || value.some((v) => typeof v != "string"))
|
|
481
|
+
throw new AskAnswerError(`answer ${n} must be a string, an array of strings, or null`);
|
|
482
|
+
let picks = value.map((v) => v.trim()).filter(Boolean);
|
|
483
|
+
return picks.length === 0 ? null : q.multiple ? picks : picks.join(", ");
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
function answerText(q, answer) {
|
|
487
|
+
if (answer === null) return ASK_SKIPPED;
|
|
488
|
+
let labels = new Set((q.options ?? []).map((o) => o.label)), picks = Array.isArray(answer) ? answer : [answer];
|
|
489
|
+
return q.options ? picks.map((p) => labels.has(p) ? p : `Other: ${p}`).join(", ") : picks.join(", ");
|
|
490
|
+
}
|
|
491
|
+
function formatAskAnswers(questions, answers) {
|
|
492
|
+
return answers.every((a) => a === null) ? ASK_ALL_SKIPPED : questions.map((q, i) => `Q: ${q.question}
|
|
493
|
+
A: ${answerText(q, answers[i] ?? null)}`).join(`
|
|
494
|
+
|
|
495
|
+
`);
|
|
496
|
+
}
|
|
497
|
+
var LEGACY_PREFIX = "Human answered: ";
|
|
498
|
+
function parseAskResult(questions, result) {
|
|
499
|
+
if (result === ASK_ALL_SKIPPED) return questions.map(() => null);
|
|
500
|
+
if (result.startsWith(LEGACY_PREFIX)) {
|
|
501
|
+
let text = result.slice(LEGACY_PREFIX.length);
|
|
502
|
+
return questions.map((_, i) => i === 0 && text && text !== "[skipped]" ? text : null);
|
|
503
|
+
}
|
|
504
|
+
let out = [], cursor = 0;
|
|
505
|
+
for (let i = 0; i < questions.length; i++) {
|
|
506
|
+
let head = `Q: ${questions[i].question}
|
|
507
|
+
A: `, start = result.indexOf(head, cursor);
|
|
508
|
+
if (start < 0) {
|
|
509
|
+
out.push(null);
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
let bodyStart = start + head.length, next = i + 1 < questions.length ? result.indexOf(`
|
|
513
|
+
|
|
514
|
+
Q: ${questions[i + 1].question}
|
|
515
|
+
A: `, bodyStart) : -1, body = next < 0 ? result.slice(bodyStart) : result.slice(bodyStart, next);
|
|
516
|
+
out.push(body === ASK_SKIPPED ? null : body), cursor = next < 0 ? result.length : next;
|
|
517
|
+
}
|
|
518
|
+
return out;
|
|
519
|
+
}
|
|
520
|
+
|
|
450
521
|
export {
|
|
451
|
-
formatOwnerCommandRow,
|
|
452
|
-
owner_command_row_exports,
|
|
453
522
|
formatTurnErrorRow,
|
|
454
523
|
providerContextCategory,
|
|
455
524
|
parseLoopToDisplay,
|
|
456
|
-
loop_parser_exports
|
|
525
|
+
loop_parser_exports,
|
|
526
|
+
AskAnswerError,
|
|
527
|
+
summarizeAsk,
|
|
528
|
+
normalizeAskAnswers,
|
|
529
|
+
formatAskAnswers,
|
|
530
|
+
ask_form_exports
|
|
457
531
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
|
|
8
|
+
// src/main/utils/network.ts
|
|
9
|
+
import { hostname, networkInterfaces } from "node:os";
|
|
10
|
+
function getLanAddresses() {
|
|
11
|
+
let ifaces = networkInterfaces(), addresses = [];
|
|
12
|
+
for (let [iface, infos] of Object.entries(ifaces))
|
|
13
|
+
if (infos)
|
|
14
|
+
for (let info of infos)
|
|
15
|
+
info.internal || info.family === "IPv6" && info.address.toLowerCase().startsWith("fe80") || addresses.push({
|
|
16
|
+
iface,
|
|
17
|
+
address: info.address,
|
|
18
|
+
family: info.family === "IPv4" ? "IPv4" : "IPv6",
|
|
19
|
+
mac: info.mac
|
|
20
|
+
});
|
|
21
|
+
return addresses.sort((a, b) => a.family !== b.family ? a.family === "IPv4" ? -1 : 1 : a.iface.localeCompare(b.iface)), { hostname: hostname(), addresses };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
getLanAddresses
|
|
26
|
+
};
|
|
@@ -4,6 +4,9 @@ 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
|
+
compareVersions
|
|
9
|
+
} from "./chunk-26RK7T5L.mjs";
|
|
7
10
|
|
|
8
11
|
// src/main/providers/claude-subscription/auth-manager.ts
|
|
9
12
|
import { execFile as execFile2, spawn } from "node:child_process";
|
|
@@ -58,14 +61,6 @@ function runVersion(path) {
|
|
|
58
61
|
});
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
|
-
function compareVersions(a, b) {
|
|
62
|
-
let pa = a.split(".").map(Number), pb = b.split(".").map(Number);
|
|
63
|
-
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
64
|
-
let d = (pa[i] ?? 0) - (pb[i] ?? 0);
|
|
65
|
-
if (d !== 0) return d < 0 ? -1 : 1;
|
|
66
|
-
}
|
|
67
|
-
return 0;
|
|
68
|
-
}
|
|
69
64
|
var cached = null, inflight = null, CACHE_MS = 6e4;
|
|
70
65
|
async function runProbe() {
|
|
71
66
|
let paths = await candidatePaths(), versions = await Promise.all(paths.map(runVersion)), install = null;
|
|
@@ -93,6 +88,34 @@ async function requireClaudeCode() {
|
|
|
93
88
|
);
|
|
94
89
|
return probe.install;
|
|
95
90
|
}
|
|
91
|
+
var NATIVE_INSTALL = isWindows ? { cmd: "powershell.exe", args: ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", "irm https://claude.ai/install.ps1 | iex"] } : { cmd: "bash", args: ["-c", "set -o pipefail; curl -fsSL https://claude.ai/install.sh | bash"] }, INSTALL_TIMEOUT_MS = 10 * 6e4;
|
|
92
|
+
function runInstallStep(cmd, args) {
|
|
93
|
+
return new Promise((resolve) => {
|
|
94
|
+
execFile(cmd, args, { timeout: INSTALL_TIMEOUT_MS, windowsHide: !0, env: claudeCodeEnv(), maxBuffer: 4 * 1024 * 1024 }, (err, stdout, stderr) => {
|
|
95
|
+
resolve({ ok: !err, output: `${stdout}
|
|
96
|
+
${stderr}${err && !stdout && !stderr ? err.message : ""}` });
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function lastLine(output) {
|
|
101
|
+
return output.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, "").trim().split(`
|
|
102
|
+
`).map((l) => l.trim()).filter(Boolean).pop() ?? "";
|
|
103
|
+
}
|
|
104
|
+
var installing = null;
|
|
105
|
+
function installClaudeCode() {
|
|
106
|
+
return installing || (installing = runInstall().finally(() => {
|
|
107
|
+
installing = null;
|
|
108
|
+
})), installing;
|
|
109
|
+
}
|
|
110
|
+
async function runInstall() {
|
|
111
|
+
let probe = await probeClaudeCode(!0);
|
|
112
|
+
if (probe.found && probe.supported || probe.found && (await runInstallStep(probe.install.path, ["update"]), probe = await probeClaudeCode(!0), probe.found && probe.supported))
|
|
113
|
+
return probe.install;
|
|
114
|
+
let { ok, output } = await runInstallStep(NATIVE_INSTALL.cmd, NATIVE_INSTALL.args);
|
|
115
|
+
if (probe = await probeClaudeCode(!0), probe.found && probe.supported) return probe.install;
|
|
116
|
+
let detail = lastLine(output);
|
|
117
|
+
throw probe.found ? new Error(`Claude Code ${probe.install.version} is installed; ADF needs ${MIN_CLAUDE_CODE_VERSION} or newer.${detail ? ` ${detail}` : ""}`) : new Error(`Claude Code could not be installed${ok ? "" : `: ${detail || "the installer failed"}`}. Install it from ${CLAUDE_CODE_INSTALL_URL}.`);
|
|
118
|
+
}
|
|
96
119
|
var CLAUDE_ENV_DENY = /^(CLAUDE_CODE_|ANTHROPIC_|CLAUDECODE$)/i;
|
|
97
120
|
function claudeCodeEnv(extra) {
|
|
98
121
|
let env = {};
|
|
@@ -180,6 +203,15 @@ var ClaudeAuthManager = class {
|
|
|
180
203
|
...cli.subscriptionType ? { plan: cli.subscriptionType } : {}
|
|
181
204
|
} : { authenticated: !1, installed: !0, ...version, ...pending, ...this.lastFlowError ? { flowError: this.lastFlowError } : {} };
|
|
182
205
|
}
|
|
206
|
+
/** Install or update Claude Code on this machine, then report the fresh status. */
|
|
207
|
+
async install() {
|
|
208
|
+
try {
|
|
209
|
+
await installClaudeCode();
|
|
210
|
+
} finally {
|
|
211
|
+
this.invalidateStatus();
|
|
212
|
+
}
|
|
213
|
+
return this.getAuthStatus({ fresh: !0 });
|
|
214
|
+
}
|
|
183
215
|
async isAuthenticated() {
|
|
184
216
|
return (await this.getAuthStatus()).authenticated;
|
|
185
217
|
}
|
|
@@ -4,18 +4,6 @@ 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
|
-
WELCOME_OVERLAY
|
|
9
|
-
} from "./chunk-O7XKQ6CH.mjs";
|
|
10
|
-
import {
|
|
11
|
-
mcp_config_exports,
|
|
12
|
-
mcp_registry_exports,
|
|
13
|
-
provider_catalog_exports
|
|
14
|
-
} from "./chunk-SOSPQPEN.mjs";
|
|
15
|
-
import {
|
|
16
|
-
Box_default,
|
|
17
|
-
Text
|
|
18
|
-
} from "./chunk-3AT7IIP7.mjs";
|
|
19
7
|
import {
|
|
20
8
|
useTheme
|
|
21
9
|
} from "./chunk-NZLEPJ5M.mjs";
|
|
@@ -25,6 +13,20 @@ import {
|
|
|
25
13
|
import {
|
|
26
14
|
cjs
|
|
27
15
|
} from "./chunk-SGUTYISF.mjs";
|
|
16
|
+
import {
|
|
17
|
+
WELCOME_OVERLAY
|
|
18
|
+
} from "./chunk-O7XKQ6CH.mjs";
|
|
19
|
+
import {
|
|
20
|
+
mcp_registry_exports,
|
|
21
|
+
provider_catalog_exports
|
|
22
|
+
} from "./chunk-TDRQG5UO.mjs";
|
|
23
|
+
import {
|
|
24
|
+
mcp_config_exports
|
|
25
|
+
} from "./chunk-HONGRUAE.mjs";
|
|
26
|
+
import {
|
|
27
|
+
Box_default,
|
|
28
|
+
Text
|
|
29
|
+
} from "./chunk-WZ6S3SQP.mjs";
|
|
28
30
|
import {
|
|
29
31
|
require_react
|
|
30
32
|
} from "./chunk-6GJ4QHRI.mjs";
|
|
@@ -0,0 +1,175 @@
|
|
|
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
|
+
__export
|
|
9
|
+
} from "./chunk-M2RX3S2T.mjs";
|
|
10
|
+
|
|
11
|
+
// src/shared/utils/mcp-config.ts
|
|
12
|
+
var mcp_config_exports = {};
|
|
13
|
+
__export(mcp_config_exports, {
|
|
14
|
+
MCP_EXECUTABLE_IDENTITY_FIELDS: () => MCP_EXECUTABLE_IDENTITY_FIELDS,
|
|
15
|
+
buildEnvSchemaFromKeys: () => buildEnvSchemaFromKeys,
|
|
16
|
+
buildHeaderEnvSchemaFromEntries: () => buildHeaderEnvSchemaFromEntries,
|
|
17
|
+
buildMcpServerConfigFromRegistration: () => buildMcpServerConfigFromRegistration,
|
|
18
|
+
deriveRegistrationTestPlan: () => deriveRegistrationTestPlan,
|
|
19
|
+
getMcpRegistrationEnvKeys: () => getMcpRegistrationEnvKeys,
|
|
20
|
+
isRegistrationAgentVisible: () => isRegistrationAgentVisible,
|
|
21
|
+
isSensitiveMcpHeader: () => isSensitiveMcpHeader,
|
|
22
|
+
mcpCredentialNamespace: () => mcpCredentialNamespace,
|
|
23
|
+
mcpCredentialRef: () => mcpCredentialRef,
|
|
24
|
+
pinServerConfigToRegistration: () => pinServerConfigToRegistration,
|
|
25
|
+
reconcileHostApprovedRegistrations: () => reconcileHostApprovedRegistrations,
|
|
26
|
+
registrationSourceIdentity: () => registrationSourceIdentity,
|
|
27
|
+
sameExecutableIdentity: () => sameExecutableIdentity,
|
|
28
|
+
suggestedAgentVisible: () => suggestedAgentVisible
|
|
29
|
+
});
|
|
30
|
+
function sourcePackage(source) {
|
|
31
|
+
let s = source;
|
|
32
|
+
return s.npm_package ?? s.npmPackage ?? s.pypi_package ?? s.pypiPackage;
|
|
33
|
+
}
|
|
34
|
+
function mcpCredentialNamespace(source) {
|
|
35
|
+
return sourcePackage(source) ?? source.name;
|
|
36
|
+
}
|
|
37
|
+
function mcpCredentialRef(source, key) {
|
|
38
|
+
return `mcp:${mcpCredentialNamespace(source)}:${key}`;
|
|
39
|
+
}
|
|
40
|
+
function isSensitiveMcpHeader(header) {
|
|
41
|
+
let normalized = header.trim().toLowerCase();
|
|
42
|
+
return normalized === "authorization" || normalized === "proxy-authorization" || normalized === "x-api-key" || normalized === "api-key" || normalized === "apikey" || normalized === "x-auth-token" || normalized === "x-access-token" || normalized.includes("token") || normalized.includes("secret") || normalized.includes("credential");
|
|
43
|
+
}
|
|
44
|
+
function buildEnvSchemaFromKeys(source, keys, scope, requiredKeys = keys) {
|
|
45
|
+
let required = new Set(requiredKeys);
|
|
46
|
+
return [...new Set(keys.filter(Boolean))].map((key) => ({
|
|
47
|
+
key,
|
|
48
|
+
scope,
|
|
49
|
+
required: required.has(key) || void 0,
|
|
50
|
+
credential_ref: scope === "app" ? mcpCredentialRef(source, key) : void 0
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
function buildHeaderEnvSchemaFromEntries(source, entries, appScoped = !0) {
|
|
54
|
+
return entries.filter((entry) => entry.header && entry.env).map((entry) => ({
|
|
55
|
+
header: entry.header,
|
|
56
|
+
env: entry.env,
|
|
57
|
+
required: !0,
|
|
58
|
+
credential_ref: appScoped ? mcpCredentialRef(source, entry.env) : void 0
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
function getMcpRegistrationEnvKeys(registration) {
|
|
62
|
+
return [.../* @__PURE__ */ new Set([
|
|
63
|
+
...(registration.env ?? []).map((entry) => entry.key).filter(Boolean),
|
|
64
|
+
...registration.bearerTokenEnvVar ? [registration.bearerTokenEnvVar] : [],
|
|
65
|
+
...(registration.headerEnv ?? []).map((entry) => entry.value).filter(Boolean)
|
|
66
|
+
])];
|
|
67
|
+
}
|
|
68
|
+
function buildMcpServerConfigFromRegistration(registration) {
|
|
69
|
+
let isHttp = registration.type === "http" || !!registration.url, serverCfg = {
|
|
70
|
+
name: registration.name,
|
|
71
|
+
transport: isHttp ? "http" : "stdio"
|
|
72
|
+
};
|
|
73
|
+
if (isHttp) {
|
|
74
|
+
serverCfg.url = registration.url, serverCfg.source = registration.url ? `http:${registration.url}` : "http";
|
|
75
|
+
let staticHeaders = {};
|
|
76
|
+
for (let { key, value } of registration.headers ?? [])
|
|
77
|
+
key && value && !isSensitiveMcpHeader(key) && (staticHeaders[key] = value);
|
|
78
|
+
Object.keys(staticHeaders).length && (serverCfg.headers = staticHeaders), registration.headerEnv?.length && (serverCfg.header_env = buildHeaderEnvSchemaFromEntries(
|
|
79
|
+
registration,
|
|
80
|
+
registration.headerEnv.map(({ key, value }) => ({ header: key, env: value })),
|
|
81
|
+
(registration.credentialStorage ?? "app") !== "agent"
|
|
82
|
+
)), registration.oauth ? serverCfg.oauth = !0 : registration.bearerTokenEnvVar && (serverCfg.bearer_token_env_var = registration.bearerTokenEnvVar);
|
|
83
|
+
} else registration.npmPackage ? (serverCfg.source = `npm:${registration.npmPackage}`, serverCfg.npm_package = registration.npmPackage) : registration.pypiPackage ? (serverCfg.source = `uvx:${registration.pypiPackage}`, serverCfg.pypi_package = registration.pypiPackage) : (serverCfg.source = "custom", serverCfg.command = registration.command, serverCfg.args = registration.args);
|
|
84
|
+
isHttp || (registration.command && (serverCfg.command = registration.command), registration.args?.length && (serverCfg.args = registration.args));
|
|
85
|
+
let envKeys = getMcpRegistrationEnvKeys(registration);
|
|
86
|
+
if (envKeys.length) {
|
|
87
|
+
let scope = (registration.credentialStorage ?? "app") === "agent" ? "agent" : "app";
|
|
88
|
+
scope === "agent" && (serverCfg.env_keys = envKeys), serverCfg.env_schema = buildEnvSchemaFromKeys(registration, envKeys, scope);
|
|
89
|
+
}
|
|
90
|
+
return registration.toolCallTimeout && (serverCfg.tool_call_timeout_ms = registration.toolCallTimeout * 1e3), !isHttp && registration.runLocation && (serverCfg.run_location = registration.runLocation), registration.credentialFiles?.length && (serverCfg.credential_files = registration.credentialFiles.map((f) => ({
|
|
91
|
+
path: f.path,
|
|
92
|
+
...f.required !== void 0 ? { required: f.required } : {},
|
|
93
|
+
...f.writeBack !== void 0 ? { write_back: f.writeBack } : {}
|
|
94
|
+
}))), serverCfg;
|
|
95
|
+
}
|
|
96
|
+
function pinServerConfigToRegistration(connCfg, registration) {
|
|
97
|
+
let canonical = buildMcpServerConfigFromRegistration(registration), agentEnvSchema = (connCfg.env_schema ?? []).filter((e) => e.scope === "agent"), mergedEnvSchema = [
|
|
98
|
+
...canonical.env_schema ?? [],
|
|
99
|
+
...agentEnvSchema.filter(
|
|
100
|
+
(a) => !(canonical.env_schema ?? []).some((c) => c.key === a.key && c.scope === a.scope)
|
|
101
|
+
)
|
|
102
|
+
];
|
|
103
|
+
return {
|
|
104
|
+
...canonical,
|
|
105
|
+
// Agent-owned state kept from the .adf copy:
|
|
106
|
+
env: connCfg.env,
|
|
107
|
+
env_keys: connCfg.env_keys,
|
|
108
|
+
available_tools: connCfg.available_tools,
|
|
109
|
+
restricted: connCfg.restricted,
|
|
110
|
+
...mergedEnvSchema.length ? { env_schema: mergedEnvSchema } : {}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function suggestedAgentVisible(reg) {
|
|
114
|
+
return reg.type === "http" || !!reg.url ? !0 : reg.runLocation !== "host";
|
|
115
|
+
}
|
|
116
|
+
function isRegistrationAgentVisible(reg) {
|
|
117
|
+
return reg.agentVisible ?? suggestedAgentVisible(reg);
|
|
118
|
+
}
|
|
119
|
+
var MCP_EXECUTABLE_IDENTITY_FIELDS = ["type", "url", "command", "args", "npmPackage", "pypiPackage", "oauth"];
|
|
120
|
+
function sameExecutableIdentity(a, b) {
|
|
121
|
+
let argsA = a.args ?? [], argsB = b.args ?? [];
|
|
122
|
+
return a.type === b.type && a.url === b.url && !!a.oauth == !!b.oauth && a.command === b.command && a.npmPackage === b.npmPackage && a.pypiPackage === b.pypiPackage && argsA.length === argsB.length && argsA.every((arg, i) => arg === argsB[i]);
|
|
123
|
+
}
|
|
124
|
+
function deriveRegistrationTestPlan(reg, opts) {
|
|
125
|
+
if (reg.type === "http" || !!reg.url) {
|
|
126
|
+
let notes2 = reg.oauth ? ["Interactive OAuth sign-in runs in a browser during this test."] : [];
|
|
127
|
+
return { location: "remote http", authMode: reg.oauth ? "run" : "none", materializeFiles: !1, notes: notes2 };
|
|
128
|
+
}
|
|
129
|
+
if (opts?.mcpOnHost && opts.hostAccessEnabled && reg.runLocation !== "shared")
|
|
130
|
+
return { location: "host", authMode: reg.auth ? "run" : "none", materializeFiles: !0, notes: [] };
|
|
131
|
+
if (reg.runLocation === "host") {
|
|
132
|
+
if (!opts?.hostAccessEnabled) {
|
|
133
|
+
let notes2 = ["Host access is disabled app-wide \u2014 this test ran in the shared container. Turn on Host access in Settings \u2192 Compute to test on the host."];
|
|
134
|
+
return reg.auth && notes2.push("Authorization for containerized servers happens per-agent when an agent attaches this server."), { location: "shared container", authMode: reg.auth ? "skip" : "none", materializeFiles: !1, notes: notes2 };
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
location: "host",
|
|
138
|
+
authMode: reg.auth ? "run" : "none",
|
|
139
|
+
materializeFiles: !0,
|
|
140
|
+
notes: []
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
let notes = [];
|
|
144
|
+
return reg.auth && notes.push("Authorization for containerized servers happens per-agent when an agent attaches this server."), reg.credentialFiles?.length && notes.push("Credential files for containerized servers are captured per-agent at attach; this test verifies the package launches and lists tools."), { location: "shared container", authMode: reg.auth ? "skip" : "none", materializeFiles: !1, notes };
|
|
145
|
+
}
|
|
146
|
+
function registrationSourceIdentity(reg) {
|
|
147
|
+
return reg.type === "http" || reg.url ? reg.url ? `http:${reg.url}` : "http" : reg.npmPackage ? `npm:${reg.npmPackage}` : reg.pypiPackage ? `uvx:${reg.pypiPackage}` : "custom";
|
|
148
|
+
}
|
|
149
|
+
function reconcileHostApprovedRegistrations(prev, next, approved, approvedSources) {
|
|
150
|
+
let result = [...approved], sources = { ...approvedSources ?? {} }, prevByName = new Map(prev.filter((r) => r.name).map((r) => [r.name, r])), nextByName = new Map(next.filter((r) => r.name).map((r) => [r.name, r])), add = (name, reg) => {
|
|
151
|
+
result.includes(name) || result.push(name), sources[name] = registrationSourceIdentity(reg);
|
|
152
|
+
}, remove = (name) => {
|
|
153
|
+
let i = result.indexOf(name);
|
|
154
|
+
i >= 0 && result.splice(i, 1), delete sources[name];
|
|
155
|
+
};
|
|
156
|
+
for (let [name, reg] of nextByName) {
|
|
157
|
+
let wasHost = prevByName.get(name)?.runLocation === "host", isHost = reg.runLocation === "host" && reg.type !== "http";
|
|
158
|
+
isHost && !wasHost ? add(name, reg) : !isHost && wasHost ? remove(name) : isHost && wasHost && result.includes(name) && (sources[name] = registrationSourceIdentity(reg));
|
|
159
|
+
}
|
|
160
|
+
for (let [name, reg] of prevByName)
|
|
161
|
+
!nextByName.has(name) && reg.runLocation === "host" && remove(name);
|
|
162
|
+
return { approved: result, sources };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
mcpCredentialRef,
|
|
167
|
+
isSensitiveMcpHeader,
|
|
168
|
+
buildEnvSchemaFromKeys,
|
|
169
|
+
buildHeaderEnvSchemaFromEntries,
|
|
170
|
+
buildMcpServerConfigFromRegistration,
|
|
171
|
+
pinServerConfigToRegistration,
|
|
172
|
+
isRegistrationAgentVisible,
|
|
173
|
+
deriveRegistrationTestPlan,
|
|
174
|
+
mcp_config_exports
|
|
175
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
exitIfUnsafeBrotliRuntime
|
|
9
|
+
} from "./chunk-ZECGH3LT.mjs";
|
|
10
|
+
|
|
11
|
+
// src/main/utils/brotli-runtime-check.ts
|
|
12
|
+
exitIfUnsafeBrotliRuntime();
|
|
@@ -7,13 +7,7 @@ const __dirname = __adfDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
DaemonError,
|
|
9
9
|
MAIN_LOOP
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
cjs
|
|
13
|
-
} from "./chunk-SGUTYISF.mjs";
|
|
14
|
-
import {
|
|
15
|
-
daemon_url_exports
|
|
16
|
-
} from "./chunk-AEAJDCVK.mjs";
|
|
10
|
+
} from "./chunk-KBXC5EHK.mjs";
|
|
17
11
|
import {
|
|
18
12
|
__export
|
|
19
13
|
} from "./chunk-M2RX3S2T.mjs";
|
|
@@ -212,15 +206,17 @@ var EventStream = class {
|
|
|
212
206
|
let previous = this.epoch;
|
|
213
207
|
if (this.epoch = epoch, name === "stream.hello") {
|
|
214
208
|
if (previous && previous !== epoch) {
|
|
215
|
-
this.forgetCursorKeys(), this.lastCursor =
|
|
209
|
+
this.forgetCursorKeys(), this.lastCursor = 0, this.reportResume({ exact: !1, reason: "epoch_changed", epoch });
|
|
216
210
|
return;
|
|
217
211
|
}
|
|
218
|
-
let oldest = typeof data.oldestCursor == "number" ? data.oldestCursor : null, latest = typeof data.latestCursor == "number" ? data.latestCursor : 0, since = this.lastCursor
|
|
212
|
+
let oldest = typeof data.oldestCursor == "number" ? data.oldestCursor : null, latest = typeof data.latestCursor == "number" ? data.latestCursor : 0, since = this.lastCursor;
|
|
213
|
+
!previous && since < 0 && this.options.since === void 0 && !this.options.replay && (this.lastCursor = latest);
|
|
214
|
+
let lost = since >= 0 && since < latest && (oldest === null || since < oldest - 1);
|
|
219
215
|
this.reportResume(lost ? { exact: !1, reason: "evicted", epoch } : { exact: !0, epoch });
|
|
220
216
|
return;
|
|
221
217
|
}
|
|
222
218
|
let reason = data.reason === "epoch_changed" ? "epoch_changed" : "evicted";
|
|
223
|
-
reason === "epoch_changed" && (this.forgetCursorKeys(), this.lastCursor =
|
|
219
|
+
reason === "epoch_changed" && (this.forgetCursorKeys(), this.lastCursor = 0);
|
|
224
220
|
let gap = { reason, epoch };
|
|
225
221
|
(typeof data.requestedCursor == "number" || data.requestedCursor === null) && (gap.requestedCursor = data.requestedCursor), (typeof data.oldestCursor == "number" || data.oldestCursor === null) && (gap.oldestCursor = data.oldestCursor), typeof data.latestCursor == "number" && (gap.latestCursor = data.latestCursor), typeof data.dropped == "number" && (gap.dropped = data.dropped);
|
|
226
222
|
try {
|
|
@@ -877,9 +873,9 @@ var DaemonClient = class {
|
|
|
877
873
|
asks(agentId) {
|
|
878
874
|
return this.get(`/agents/${enc(agentId)}/asks`);
|
|
879
875
|
}
|
|
880
|
-
/** `loop` picks the asking loop when request ids repeat across loops. */
|
|
881
|
-
answerAsk(agentId, requestId,
|
|
882
|
-
return this.post(`/agents/${enc(agentId)}/asks/${enc(requestId)}/respond`, {
|
|
876
|
+
/** One answer per question (`null` = skipped). `loop` picks the asking loop when request ids repeat across loops. */
|
|
877
|
+
answerAsk(agentId, requestId, answers, loop) {
|
|
878
|
+
return this.post(`/agents/${enc(agentId)}/asks/${enc(requestId)}/respond`, { answers, ...loop ? { loop } : {} });
|
|
883
879
|
}
|
|
884
880
|
respondSuspend(agentId, resume) {
|
|
885
881
|
return this.post(`/agents/${enc(agentId)}/suspend/respond`, { resume });
|
|
@@ -1020,30 +1016,8 @@ function errorMessage2(err) {
|
|
|
1020
1016
|
return String(err);
|
|
1021
1017
|
}
|
|
1022
1018
|
|
|
1023
|
-
// src/main/tui/api/client.ts
|
|
1024
|
-
var { daemonCredentials, resolveDaemonUrl } = cjs(daemon_url_exports), shared = cjs(client_exports), staticCredentials2 = shared.staticCredentials, DaemonClient2 = class _DaemonClient extends shared.DaemonClient {
|
|
1025
|
-
/** `resolved`: options already built for the shared client (derive); `options` is then ignored. */
|
|
1026
|
-
constructor(options = {}, resolved) {
|
|
1027
|
-
super(resolved ?? _DaemonClient.resolve(options));
|
|
1028
|
-
}
|
|
1029
|
-
static resolve(options) {
|
|
1030
|
-
let baseUrl = resolveDaemonUrl(options.baseUrl, options.env), lookup = { localToken: options.localToken, env: options.env, fetch: options.fetch };
|
|
1031
|
-
return {
|
|
1032
|
-
baseUrl,
|
|
1033
|
-
// `--token` belongs to this URL; another daemon (withBaseUrl) gets its
|
|
1034
|
-
// own `--token`, or ADF_DAEMON_TOKEN, or its own local token file (and
|
|
1035
|
-
// local proof, when it is this machine's daemon), never this one.
|
|
1036
|
-
credentials: daemonCredentials(baseUrl, { ...lookup, token: options.token }),
|
|
1037
|
-
credentialsFor: (url, token) => daemonCredentials(url, { ...lookup, token }),
|
|
1038
|
-
fetch: options.fetch,
|
|
1039
|
-
timeoutMs: options.timeoutMs
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
derive(options) {
|
|
1043
|
-
return new _DaemonClient({}, options);
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
1019
|
export {
|
|
1048
|
-
|
|
1020
|
+
staticCredentials,
|
|
1021
|
+
DaemonClient,
|
|
1022
|
+
client_exports
|
|
1049
1023
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
__export
|
|
9
|
+
} from "./chunk-M2RX3S2T.mjs";
|
|
10
|
+
|
|
11
|
+
// src/shared/utils/owner-command-row.ts
|
|
12
|
+
var owner_command_row_exports = {};
|
|
13
|
+
__export(owner_command_row_exports, {
|
|
14
|
+
OWNER_COMMAND_MARKER: () => OWNER_COMMAND_MARKER,
|
|
15
|
+
formatOwnerCommandRow: () => formatOwnerCommandRow,
|
|
16
|
+
isOwnerCommandRow: () => isOwnerCommandRow,
|
|
17
|
+
parseOwnerCommandRow: () => parseOwnerCommandRow
|
|
18
|
+
});
|
|
19
|
+
var OWNER_COMMAND_MARKER = "[Owner command] ";
|
|
20
|
+
function formatOwnerCommandRow(header, body) {
|
|
21
|
+
return `${OWNER_COMMAND_MARKER}${JSON.stringify(header)}
|
|
22
|
+
${body}`;
|
|
23
|
+
}
|
|
24
|
+
function parseOwnerCommandRow(text) {
|
|
25
|
+
if (!text.startsWith(OWNER_COMMAND_MARKER)) return null;
|
|
26
|
+
let newline = text.indexOf(`
|
|
27
|
+
`);
|
|
28
|
+
try {
|
|
29
|
+
let header = JSON.parse(text.slice(OWNER_COMMAND_MARKER.length, newline < 0 ? void 0 : newline));
|
|
30
|
+
return !header || header.v !== 1 || typeof header.id != "string" || typeof header.command != "string" || typeof header.lambda != "string" || typeof header.authorized != "boolean" || typeof header.duration_ms != "number" || !Number.isFinite(header.duration_ms) || header.duration_ms < 0 || !["ok", "error", "denied"].includes(header.status) ? null : { header, body: newline < 0 ? "" : text.slice(newline + 1) };
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function isOwnerCommandRow(text) {
|
|
36
|
+
return parseOwnerCommandRow(text) !== null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
formatOwnerCommandRow,
|
|
41
|
+
parseOwnerCommandRow,
|
|
42
|
+
owner_command_row_exports
|
|
43
|
+
};
|
|
@@ -66,7 +66,7 @@ function readLocalProof(settingsDir, port = DEFAULT_PORT) {
|
|
|
66
66
|
}
|
|
67
67
|
function isLocalOnlyRoute(path) {
|
|
68
68
|
let p = path.split("?")[0];
|
|
69
|
-
return p === "/daemon/shutdown" || p === "/client/reload-credentials" || p === "/client/sessions" || /^\/client\/sessions\/[^/]+\/exit-when-closed$/.test(p) || /^\/client\/sessions\/[^/]+\/quit$/.test(p) || /^\/identity\/(create|restore|import|unlock|lock|confirm-backup|trust-daemon|untrust-daemon)$/.test(p) || /^\/agents\/[^/]+\/identity\/reveal$/.test(p) || p === "/files/agent/identity/reveal" || p === "/settings/providers/keys/reveal" || p === "/remote-access" || p.startsWith("/remote-access/") || p === "/network/peers";
|
|
69
|
+
return p === "/web/launch" || p === "/daemon/shutdown" || p === "/client/reload-credentials" || p === "/client/sessions" || /^\/client\/sessions\/[^/]+\/exit-when-closed$/.test(p) || /^\/client\/sessions\/[^/]+\/quit$/.test(p) || /^\/identity\/(create|restore|import|unlock|lock|confirm-backup|trust-daemon|untrust-daemon)$/.test(p) || /^\/agents\/[^/]+\/identity\/reveal$/.test(p) || p === "/files/agent/identity/reveal" || p === "/settings/providers/keys/reveal" || p === "/remote-access" || p.startsWith("/remote-access/") || p === "/network/peers";
|
|
70
70
|
}
|
|
71
71
|
function isDeviceRefusedRoute(method, path) {
|
|
72
72
|
let p = path.split("?")[0];
|