@agentdocumentformat/cli 0.8.3 → 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.
Files changed (129) hide show
  1. package/README.md +55 -4
  2. package/dist/adf.mjs +16 -13
  3. package/dist/chunks/{App-UHLJRFZJ.mjs → App-XOPHZTGN.mjs} +336 -296
  4. package/dist/chunks/{auth-manager-TBNKCJ45.mjs → auth-manager-2YHTYI3C.mjs} +2 -1
  5. package/dist/chunks/{build-QF5W473T.mjs → build-BFOCXM5S.mjs} +1 -1
  6. package/dist/chunks/{chunk-RHBGCOS3.mjs → chunk-22ZGZFOV.mjs} +5 -16
  7. package/dist/chunks/chunk-26RK7T5L.mjs +20 -0
  8. package/dist/chunks/{chunk-KCIRFUZH.mjs → chunk-2WIFHJV2.mjs} +2 -2
  9. package/dist/chunks/{chunk-D7A77SNL.mjs → chunk-3FWPIWYM.mjs} +1 -1
  10. package/dist/chunks/chunk-4T745GJA.mjs +431 -0
  11. package/dist/chunks/{chunk-WPT3FAFX.mjs → chunk-7ADDKFT5.mjs} +3 -30
  12. package/dist/chunks/chunk-A53XYNJL.mjs +26 -0
  13. package/dist/chunks/{chunk-MZRXFWPQ.mjs → chunk-AN6USKYQ.mjs} +40 -8
  14. package/dist/chunks/{chunk-2Z7X3UUR.mjs → chunk-DHO5Z6HP.mjs} +14 -12
  15. package/dist/chunks/{chunk-F5ELW46V.mjs → chunk-GJYMGPH4.mjs} +1 -0
  16. package/dist/chunks/chunk-HONGRUAE.mjs +175 -0
  17. package/dist/chunks/{chunk-AEAJDCVK.mjs → chunk-IM5JKLXO.mjs} +1 -1
  18. package/dist/chunks/chunk-J2N63ZUD.mjs +12 -0
  19. package/dist/chunks/{chunk-FUQRYTGX.mjs → chunk-JK6K2BMV.mjs} +9 -35
  20. package/dist/chunks/{chunk-75DC5EWN.mjs → chunk-KBXC5EHK.mjs} +1 -0
  21. package/dist/chunks/chunk-NRTRTR7C.mjs +43 -0
  22. package/dist/chunks/{chunk-BS3USVEA.mjs → chunk-P4G5ZEBI.mjs} +1 -1
  23. package/dist/chunks/{chunk-E7LC6SHP.mjs → chunk-RIAB37IS.mjs} +4 -2
  24. package/dist/chunks/{chunk-LVF2DRBR.mjs → chunk-TBMQOM7Y.mjs} +247 -610
  25. package/dist/chunks/{chunk-SOSPQPEN.mjs → chunk-TDRQG5UO.mjs} +1 -162
  26. package/dist/chunks/{chunk-OHTB4UW4.mjs → chunk-TPA2ITKV.mjs} +32 -18
  27. package/dist/chunks/{chunk-BHY7QDCM.mjs → chunk-UBWWGUMU.mjs} +1 -0
  28. package/dist/chunks/{chunk-3AT7IIP7.mjs → chunk-WZ6S3SQP.mjs} +1 -1
  29. package/dist/chunks/chunk-X6R32YVE.mjs +43 -0
  30. package/dist/chunks/chunk-XJWGENZ5.mjs +5903 -0
  31. package/dist/chunks/{chunk-F3WSCAJD.mjs → chunk-XP4U4A2W.mjs} +1 -1
  32. package/dist/chunks/chunk-XS46KYYY.mjs +31 -0
  33. package/dist/chunks/{chunk-HBOFZRUS.mjs → chunk-XZQVDY3U.mjs} +9 -1
  34. package/dist/chunks/chunk-ZECGH3LT.mjs +88 -0
  35. package/dist/chunks/{claude-subscription-EB4LAAVV.mjs → claude-subscription-42L4YM5L.mjs} +4 -3
  36. package/dist/chunks/{cli-UVIJAGRZ.mjs → cli-JPRYEY4J.mjs} +22 -7
  37. package/dist/chunks/{commands-KOMPXJZS.mjs → commands-TZW2FSXG.mjs} +5 -2
  38. package/dist/chunks/context-AZOIJOUG.mjs +5933 -0
  39. package/dist/chunks/{daemon-YHD7PUQI.mjs → daemon-DK3KUDZJ.mjs} +3362 -6724
  40. package/dist/chunks/{daemon-control-MKN7G5M3.mjs → daemon-control-U4OGCAAJ.mjs} +4 -4
  41. package/dist/chunks/{devtools-H7CI2ZVG.mjs → devtools-AUZWFIPL.mjs} +1 -1
  42. package/dist/chunks/firewall-service-7RGJN4LD.mjs +163 -0
  43. package/dist/chunks/{open-3OR6WT4T.mjs → open-T3VGLWGF.mjs} +6 -5
  44. package/dist/chunks/{pipeline-executor-DRYEEFDR.mjs → pipeline-executor-MHRI7ODL.mjs} +6 -3
  45. package/dist/chunks/{remote-access-cli-GLEEP7DI.mjs → remote-access-cli-EFVCXFOY.mjs} +22 -6
  46. package/dist/chunks/{store-D2WLXEY2.mjs → store-37YHXFJ6.mjs} +4 -3
  47. package/dist/chunks/{tui-ZEI2NAQV.mjs → tui-NJKGFAKU.mjs} +12 -11
  48. package/dist/chunks/web-F4XHDGUX.mjs +149 -0
  49. package/dist/chunks/{whatsapp-YJFFVN4Q.mjs → whatsapp-J7PX7TKT.mjs} +1 -1
  50. package/package.json +4 -3
  51. package/web/assets/EditorPanel-5ZGWvexa.js +161 -0
  52. package/web/assets/MeshGraphView-BZV40eAE.css +1 -0
  53. package/web/assets/MeshGraphView-Vp2R5TLK.js +23 -0
  54. package/web/assets/SettingsPage-_uHkBERV.js +6 -0
  55. package/web/assets/agent-window-B8X7FV4_.js +3 -0
  56. package/web/assets/agent.store-BHweGGTh.js +1 -0
  57. package/web/assets/app.store-j_-OuVPe.js +1 -0
  58. package/web/assets/core-DVezgdzc.js +12 -0
  59. package/web/assets/css-Z72CF80r.js +1 -0
  60. package/web/assets/diff-D97Zzqfu.js +1 -0
  61. package/web/assets/document.store-CMD3_OM0.js +1 -0
  62. package/web/assets/edit-recovery-Ce8tPQZl.js +3 -0
  63. package/web/assets/engine-javascript-CuxHA8oH.js +141 -0
  64. package/web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  65. package/web/assets/github-light-DAi9KRSo.js +1 -0
  66. package/web/assets/go-C27-OAKa.js +1 -0
  67. package/web/assets/html-BlS82ilI.js +1 -0
  68. package/web/assets/index-B5Eot_tL.js +1 -0
  69. package/web/assets/index-B5FYMbFc.js +3 -0
  70. package/web/assets/index-BQIEMvvt.js +2 -0
  71. package/web/assets/index-C_gf4L3q.js +1 -0
  72. package/web/assets/index-Ca6bEWGu.js +1 -0
  73. package/web/assets/index-CuTaWSEs.css +1 -0
  74. package/web/assets/index-DBFkrLao.js +1 -0
  75. package/web/assets/index-DF1leTEa.js +11 -0
  76. package/web/assets/index-DS9H-PJI.js +1 -0
  77. package/web/assets/index-DkhbLs9K.js +6 -0
  78. package/web/assets/index-KNnHrO8-.js +13 -0
  79. package/web/assets/index-nM_Q5x7Q.js +1 -0
  80. package/web/assets/inter-tight-cyrillic-ext-wght-italic-BJqtfpQe.woff2 +0 -0
  81. package/web/assets/inter-tight-cyrillic-ext-wght-normal-okcGN4Nq.woff2 +0 -0
  82. package/web/assets/inter-tight-cyrillic-wght-italic-HmhN1gQv.woff2 +0 -0
  83. package/web/assets/inter-tight-cyrillic-wght-normal-BS41q_Tv.woff2 +0 -0
  84. package/web/assets/inter-tight-greek-ext-wght-italic-B_3RbJza.woff2 +0 -0
  85. package/web/assets/inter-tight-greek-ext-wght-normal-DQgQPNk4.woff2 +0 -0
  86. package/web/assets/inter-tight-greek-wght-italic-Bb1BGCmL.woff2 +0 -0
  87. package/web/assets/inter-tight-greek-wght-normal-sS1B39LI.woff2 +0 -0
  88. package/web/assets/inter-tight-latin-ext-wght-italic-DYqsmiDd.woff2 +0 -0
  89. package/web/assets/inter-tight-latin-ext-wght-normal-B4u9PlvR.woff2 +0 -0
  90. package/web/assets/inter-tight-latin-wght-italic-DiXukCDG.woff2 +0 -0
  91. package/web/assets/inter-tight-latin-wght-normal-DX-nOvPD.woff2 +0 -0
  92. package/web/assets/inter-tight-vietnamese-wght-italic-CiVF0Juh.woff2 +0 -0
  93. package/web/assets/inter-tight-vietnamese-wght-normal-TKKdAiBA.woff2 +0 -0
  94. package/web/assets/javascript-wDzz0qaB.js +1 -0
  95. package/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  96. package/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  97. package/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  98. package/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  99. package/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  100. package/web/assets/json-Cp-IABpG.js +1 -0
  101. package/web/assets/jsx-g9-lgVsj.js +1 -0
  102. package/web/assets/main-Zf3qnQYd.css +1 -0
  103. package/web/assets/main-o2ocfqUC.js +319 -0
  104. package/web/assets/markdown-Cvjx9yec.js +1 -0
  105. package/web/assets/message-queue.store-ke_rFZAb.js +2 -0
  106. package/web/assets/module-RjUF93sV.js +716 -0
  107. package/web/assets/native-48B9X9Wg.js +1 -0
  108. package/web/assets/orbital-render.worker-BovOTauk.js +1 -0
  109. package/web/assets/python-B6aJPvgy.js +1 -0
  110. package/web/assets/react-D-F9gHrJ.js +1 -0
  111. package/web/assets/rust-DPvrY3IQ.js +1 -0
  112. package/web/assets/shellscript-Yzrsuije.js +1 -0
  113. package/web/assets/sql-DkvoVjww.js +1 -0
  114. package/web/assets/stix-two-text-cyrillic-wght-italic-BzL1BdzR.woff2 +0 -0
  115. package/web/assets/stix-two-text-cyrillic-wght-normal-CcrOj1MU.woff2 +0 -0
  116. package/web/assets/stix-two-text-greek-wght-italic-glgrbyRu.woff2 +0 -0
  117. package/web/assets/stix-two-text-greek-wght-normal-DAdwyhkq.woff2 +0 -0
  118. package/web/assets/stix-two-text-latin-ext-wght-italic--XhV508b.woff2 +0 -0
  119. package/web/assets/stix-two-text-latin-ext-wght-normal-BUpo8gM0.woff2 +0 -0
  120. package/web/assets/stix-two-text-latin-wght-italic-BDl6bBME.woff2 +0 -0
  121. package/web/assets/stix-two-text-latin-wght-normal-BTZaHlTl.woff2 +0 -0
  122. package/web/assets/stix-two-text-vietnamese-wght-italic-B1jFRJrJ.woff2 +0 -0
  123. package/web/assets/stix-two-text-vietnamese-wght-normal-CfS0RdBA.woff2 +0 -0
  124. package/web/assets/tsx-COt5Ahok.js +1 -0
  125. package/web/assets/typescript-BPQ3VLAy.js +1 -0
  126. package/web/assets/window-kind-mxlpdE1l.js +1 -0
  127. package/web/assets/with-selector-Ot-ZoUn0.js +1 -0
  128. package/web/assets/yaml-Buea-lGh.js +1 -0
  129. 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
+ 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";
@@ -23,5 +23,6 @@ var import_stream = __toESM(require_stream(), 1), import_extension = __toESM(req
23
23
  var wrapper_default = import_websocket.default;
24
24
 
25
25
  export {
26
+ import_websocket_server,
26
27
  wrapper_default
27
28
  };
@@ -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
+ };
@@ -9,7 +9,7 @@ import {
9
9
  openKeychainBackend,
10
10
  readLocalProof,
11
11
  testSeamsAllowed
12
- } from "./chunk-BS3USVEA.mjs";
12
+ } from "./chunk-P4G5ZEBI.mjs";
13
13
  import {
14
14
  daemonSettingsDir,
15
15
  readDaemonToken
@@ -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-75DC5EWN.mjs";
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 = -1, this.reportResume({ exact: !1, reason: "epoch_changed", epoch });
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, lost = since >= 0 && since < latest && (oldest === null || since < oldest - 1);
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 = -1);
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 {
@@ -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
- DaemonClient2 as DaemonClient
1020
+ staticCredentials,
1021
+ DaemonClient,
1022
+ client_exports
1049
1023
  };
@@ -40,5 +40,6 @@ var SUPPORTED_CLIENT_API_VERSION = 2;
40
40
  export {
41
41
  MAIN_LOOP,
42
42
  DaemonError,
43
+ SUPPORTED_CLIENT_API_VERSION,
43
44
  types_exports
44
45
  };
@@ -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];
@@ -231,7 +231,9 @@ The \`ws_*\` tools manage your configured connections (schemas have the details)
231
231
  /** Included when sys_set_state is enabled */
232
232
  state_management: "## State Management\n\n`sys_set_state` moves you between idle, hibernate, and off; the tool schema defines each. Off is one-way and only a human brings you back. Use it when stopping is right, for example when your behavior is causing problems and you agree. Idle or hibernate is usually the better choice.",
233
233
  /** Appended when the agent runs in autonomous mode. */
234
- _autonomous: "## Autonomous Mode\n\nYou are in autonomous mode: no human input this session. Report progress with `say`, put results in your final response, and call `sys_set_state` when your work is complete."
234
+ _autonomous: `## Autonomous Mode
235
+
236
+ You are in autonomous mode: the runtime continues after text-only responses. Follow your current instructions, including new directions from your principal and the assignment's stopping conditions. Completing a subtask does not end an ongoing assignment.`
235
237
  }, DEFAULT_DYNAMIC_PROMPTS = {
236
238
  dyn_inbox_hint: "[Inbox: {{unread}} unread] msg_read to read; msg_send with parent_id to reply.",
237
239
  // Blank by default — reply routing lives in the msg_send tool schema (parent_id
@@ -243,7 +245,7 @@ The \`ws_*\` tools manage your configured connections (schemas have the details)
243
245
  dyn_mesh_update: `[Mesh Update] Available agents:
244
246
  {{agent_list}}`,
245
247
  dyn_mesh_update_empty: "[Mesh Update] No other agents are currently available in the mesh.",
246
- dyn_idle_reminder: 'If you have completed your current work, call `sys_set_state` with state "idle" to yield.'
248
+ dyn_idle_reminder: 'When your current instructions call for stopping and no authorized work remains, call `sys_set_state` with state "idle" to yield.'
247
249
  };
248
250
  var DEFAULT_COMPACTION_PROMPT = "You are a conversation compactor. Read the transcript between an AI agent and its environment and write a present-tense status briefing: bullets organized by topic, under 1500 words. Keep current task state, key decisions and their reasoning, exact paths, names, IDs, and values in play, pending work and next steps, constraints or preferences discovered, open questions and hunches the agent was carrying, and anything surprising or still unexplained. Keep exact details; a vague summary is useless. Keep every open thread; anything dropped here is gone. Transcript role tags carry the loop seq when known (`[USER S137]` / `[ASSISTANT S137]`), so when a bullet derives from specific messages, cite them (`[S137]`) and the summary stays traceable to the archived history in adf_audit.";
249
251