@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.
Files changed (129) hide show
  1. package/README.md +55 -4
  2. package/dist/adf.mjs +16 -13
  3. package/dist/chunks/{App-4AZZJNN2.mjs → App-XOPHZTGN.mjs} +515 -349
  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-7JZXMDDF.mjs → chunk-7ADDKFT5.mjs} +105 -31
  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-IMVMSU3A.mjs → chunk-JK6K2BMV.mjs} +12 -38
  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-RJDOVMM4.mjs → chunk-TPA2ITKV.mjs} +49 -33
  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-PCVFB6B4.mjs → cli-JPRYEY4J.mjs} +53 -13
  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-HEQ3FUYH.mjs → daemon-DK3KUDZJ.mjs} +3571 -6806
  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-55CQSAOX.mjs → store-37YHXFJ6.mjs} +4 -3
  47. package/dist/chunks/{tui-RAUVFOYY.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
@@ -11,158 +11,6 @@ import {
11
11
  __export
12
12
  } from "./chunk-M2RX3S2T.mjs";
13
13
 
14
- // src/shared/utils/mcp-config.ts
15
- var mcp_config_exports = {};
16
- __export(mcp_config_exports, {
17
- MCP_EXECUTABLE_IDENTITY_FIELDS: () => MCP_EXECUTABLE_IDENTITY_FIELDS,
18
- buildEnvSchemaFromKeys: () => buildEnvSchemaFromKeys,
19
- buildHeaderEnvSchemaFromEntries: () => buildHeaderEnvSchemaFromEntries,
20
- buildMcpServerConfigFromRegistration: () => buildMcpServerConfigFromRegistration,
21
- deriveRegistrationTestPlan: () => deriveRegistrationTestPlan,
22
- getMcpRegistrationEnvKeys: () => getMcpRegistrationEnvKeys,
23
- isRegistrationAgentVisible: () => isRegistrationAgentVisible,
24
- isSensitiveMcpHeader: () => isSensitiveMcpHeader,
25
- mcpCredentialNamespace: () => mcpCredentialNamespace,
26
- mcpCredentialRef: () => mcpCredentialRef,
27
- pinServerConfigToRegistration: () => pinServerConfigToRegistration,
28
- reconcileHostApprovedRegistrations: () => reconcileHostApprovedRegistrations,
29
- registrationSourceIdentity: () => registrationSourceIdentity,
30
- sameExecutableIdentity: () => sameExecutableIdentity,
31
- suggestedAgentVisible: () => suggestedAgentVisible
32
- });
33
- function sourcePackage(source) {
34
- let s = source;
35
- return s.npm_package ?? s.npmPackage ?? s.pypi_package ?? s.pypiPackage;
36
- }
37
- function mcpCredentialNamespace(source) {
38
- return sourcePackage(source) ?? source.name;
39
- }
40
- function mcpCredentialRef(source, key) {
41
- return `mcp:${mcpCredentialNamespace(source)}:${key}`;
42
- }
43
- function isSensitiveMcpHeader(header) {
44
- let normalized = header.trim().toLowerCase();
45
- 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");
46
- }
47
- function buildEnvSchemaFromKeys(source, keys, scope, requiredKeys = keys) {
48
- let required = new Set(requiredKeys);
49
- return [...new Set(keys.filter(Boolean))].map((key) => ({
50
- key,
51
- scope,
52
- required: required.has(key) || void 0,
53
- credential_ref: scope === "app" ? mcpCredentialRef(source, key) : void 0
54
- }));
55
- }
56
- function buildHeaderEnvSchemaFromEntries(source, entries, appScoped = !0) {
57
- return entries.filter((entry) => entry.header && entry.env).map((entry) => ({
58
- header: entry.header,
59
- env: entry.env,
60
- required: !0,
61
- credential_ref: appScoped ? mcpCredentialRef(source, entry.env) : void 0
62
- }));
63
- }
64
- function getMcpRegistrationEnvKeys(registration) {
65
- return [.../* @__PURE__ */ new Set([
66
- ...(registration.env ?? []).map((entry) => entry.key).filter(Boolean),
67
- ...registration.bearerTokenEnvVar ? [registration.bearerTokenEnvVar] : [],
68
- ...(registration.headerEnv ?? []).map((entry) => entry.value).filter(Boolean)
69
- ])];
70
- }
71
- function buildMcpServerConfigFromRegistration(registration) {
72
- let isHttp = registration.type === "http" || !!registration.url, serverCfg = {
73
- name: registration.name,
74
- transport: isHttp ? "http" : "stdio"
75
- };
76
- if (isHttp) {
77
- serverCfg.url = registration.url, serverCfg.source = registration.url ? `http:${registration.url}` : "http";
78
- let staticHeaders = {};
79
- for (let { key, value } of registration.headers ?? [])
80
- key && value && !isSensitiveMcpHeader(key) && (staticHeaders[key] = value);
81
- Object.keys(staticHeaders).length && (serverCfg.headers = staticHeaders), registration.headerEnv?.length && (serverCfg.header_env = buildHeaderEnvSchemaFromEntries(
82
- registration,
83
- registration.headerEnv.map(({ key, value }) => ({ header: key, env: value })),
84
- (registration.credentialStorage ?? "app") !== "agent"
85
- )), registration.oauth ? serverCfg.oauth = !0 : registration.bearerTokenEnvVar && (serverCfg.bearer_token_env_var = registration.bearerTokenEnvVar);
86
- } 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);
87
- isHttp || (registration.command && (serverCfg.command = registration.command), registration.args?.length && (serverCfg.args = registration.args));
88
- let envKeys = getMcpRegistrationEnvKeys(registration);
89
- if (envKeys.length) {
90
- let scope = (registration.credentialStorage ?? "app") === "agent" ? "agent" : "app";
91
- scope === "agent" && (serverCfg.env_keys = envKeys), serverCfg.env_schema = buildEnvSchemaFromKeys(registration, envKeys, scope);
92
- }
93
- 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) => ({
94
- path: f.path,
95
- ...f.required !== void 0 ? { required: f.required } : {},
96
- ...f.writeBack !== void 0 ? { write_back: f.writeBack } : {}
97
- }))), serverCfg;
98
- }
99
- function pinServerConfigToRegistration(connCfg, registration) {
100
- let canonical = buildMcpServerConfigFromRegistration(registration), agentEnvSchema = (connCfg.env_schema ?? []).filter((e) => e.scope === "agent"), mergedEnvSchema = [
101
- ...canonical.env_schema ?? [],
102
- ...agentEnvSchema.filter(
103
- (a) => !(canonical.env_schema ?? []).some((c) => c.key === a.key && c.scope === a.scope)
104
- )
105
- ];
106
- return {
107
- ...canonical,
108
- // Agent-owned state kept from the .adf copy:
109
- env: connCfg.env,
110
- env_keys: connCfg.env_keys,
111
- available_tools: connCfg.available_tools,
112
- restricted: connCfg.restricted,
113
- ...mergedEnvSchema.length ? { env_schema: mergedEnvSchema } : {}
114
- };
115
- }
116
- function suggestedAgentVisible(reg) {
117
- return reg.type === "http" || !!reg.url ? !0 : reg.runLocation !== "host";
118
- }
119
- function isRegistrationAgentVisible(reg) {
120
- return reg.agentVisible ?? suggestedAgentVisible(reg);
121
- }
122
- var MCP_EXECUTABLE_IDENTITY_FIELDS = ["type", "url", "command", "args", "npmPackage", "pypiPackage"];
123
- function sameExecutableIdentity(a, b) {
124
- let argsA = a.args ?? [], argsB = b.args ?? [];
125
- return a.type === b.type && a.url === b.url && a.command === b.command && a.npmPackage === b.npmPackage && a.pypiPackage === b.pypiPackage && argsA.length === argsB.length && argsA.every((arg, i) => arg === argsB[i]);
126
- }
127
- function deriveRegistrationTestPlan(reg, opts) {
128
- if (reg.type === "http" || !!reg.url) {
129
- let notes2 = reg.oauth ? ["Interactive OAuth sign-in runs in a browser during this test."] : [];
130
- return { location: "remote http", authMode: reg.oauth ? "run" : "none", materializeFiles: !1, notes: notes2 };
131
- }
132
- if (reg.runLocation === "host") {
133
- if (!opts?.hostAccessEnabled) {
134
- 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."];
135
- 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 };
136
- }
137
- return {
138
- location: "host",
139
- authMode: reg.auth ? "run" : "none",
140
- materializeFiles: !0,
141
- notes: []
142
- };
143
- }
144
- let notes = [];
145
- 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 };
146
- }
147
- function registrationSourceIdentity(reg) {
148
- return reg.type === "http" || reg.url ? reg.url ? `http:${reg.url}` : "http" : reg.npmPackage ? `npm:${reg.npmPackage}` : reg.pypiPackage ? `uvx:${reg.pypiPackage}` : "custom";
149
- }
150
- function reconcileHostApprovedRegistrations(prev, next, approved, approvedSources) {
151
- 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) => {
152
- result.includes(name) || result.push(name), sources[name] = registrationSourceIdentity(reg);
153
- }, remove = (name) => {
154
- let i = result.indexOf(name);
155
- i >= 0 && result.splice(i, 1), delete sources[name];
156
- };
157
- for (let [name, reg] of nextByName) {
158
- let wasHost = prevByName.get(name)?.runLocation === "host", isHost = reg.runLocation === "host" && reg.type !== "http";
159
- isHost && !wasHost ? add(name, reg) : !isHost && wasHost ? remove(name) : isHost && wasHost && result.includes(name) && (sources[name] = registrationSourceIdentity(reg));
160
- }
161
- for (let [name, reg] of prevByName)
162
- !nextByName.has(name) && reg.runLocation === "host" && remove(name);
163
- return { approved: result, sources };
164
- }
165
-
166
14
  // src/shared/constants/provider-catalog.ts
167
15
  var provider_catalog_exports = {};
168
16
  __export(provider_catalog_exports, {
@@ -1232,7 +1080,7 @@ var mcp_registry_default = {
1232
1080
  path: "~/.gmail-mcp/credentials.json"
1233
1081
  }
1234
1082
  ],
1235
- prerequisite: "Needs a Google OAuth client JSON (Desktop app) from console.cloud.google.com with the Gmail API enabled. Upstream repo was archived in 2025 but this remains the most-used Gmail server."
1083
+ prerequisite: "Needs a Google OAuth client JSON (Desktop app) from console.cloud.google.com with the Gmail API enabled. Community server; upstream repository archived in March 2026. See the Gmail setup Knowledge Base article for credential handling and tool permissions."
1236
1084
  },
1237
1085
  {
1238
1086
  name: "teams",
@@ -1971,15 +1819,6 @@ function findRegistryEntryByUrl(url) {
1971
1819
  }
1972
1820
 
1973
1821
  export {
1974
- mcpCredentialRef,
1975
- isSensitiveMcpHeader,
1976
- buildEnvSchemaFromKeys,
1977
- buildHeaderEnvSchemaFromEntries,
1978
- buildMcpServerConfigFromRegistration,
1979
- pinServerConfigToRegistration,
1980
- isRegistrationAgentVisible,
1981
- deriveRegistrationTestPlan,
1982
- mcp_config_exports,
1983
1822
  isSubscriptionType,
1984
1823
  provider_catalog_exports,
1985
1824
  parseMcpRegistryDocument,
@@ -4,9 +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
- types_exports
9
- } from "./chunk-75DC5EWN.mjs";
10
7
  import {
11
8
  require_jsx_runtime
12
9
  } from "./chunk-7CV2SA3H.mjs";
@@ -14,9 +11,15 @@ import {
14
11
  cjs
15
12
  } from "./chunk-SGUTYISF.mjs";
16
13
  import {
17
- loop_parser_exports,
14
+ types_exports
15
+ } from "./chunk-KBXC5EHK.mjs";
16
+ import {
17
+ ask_form_exports,
18
+ loop_parser_exports
19
+ } from "./chunk-7ADDKFT5.mjs";
20
+ import {
18
21
  owner_command_row_exports
19
- } from "./chunk-7JZXMDDF.mjs";
22
+ } from "./chunk-NRTRTR7C.mjs";
20
23
  import {
21
24
  require_react
22
25
  } from "./chunk-6GJ4QHRI.mjs";
@@ -140,7 +143,7 @@ function reconcileSelection(state, previousSummaries = {}, trackedFresh = !1) {
140
143
  }
141
144
 
142
145
  // src/main/tui/state/transcript.ts
143
- var MAX_TRANSCRIPT_ITEMS = 2e3, { parseLoopToDisplay } = cjs(loop_parser_exports), { attachmentText } = cjs(file_ref_exports);
146
+ var MAX_TRANSCRIPT_ITEMS = 2e3, { parseLoopToDisplay } = cjs(loop_parser_exports), { attachmentText } = cjs(file_ref_exports), { askQuestions, parseAskResult } = cjs(ask_form_exports);
144
147
  function withAttachments(text, attachments) {
145
148
  if (!Array.isArray(attachments) || attachments.length === 0) return text;
146
149
  let lines = attachments.map(attachmentText);
@@ -181,9 +184,9 @@ function unresolvedTasks(items) {
181
184
  }
182
185
  return out;
183
186
  }
184
- function askQuestion(input) {
185
- let q = input && typeof input == "object" ? input.question : void 0;
186
- return typeof q == "string" ? q : "";
187
+ function askKey(questions) {
188
+ return questions.map((q) => q.question.trim()).join(`
189
+ `);
187
190
  }
188
191
  function historyToItems(entries) {
189
192
  let items = [], toolsById = /* @__PURE__ */ new Map();
@@ -256,7 +259,7 @@ function mergeHistory(existing, incoming) {
256
259
  return live ? { ...item, status: live.status, result: live.result, completedAt: live.completedAt } : item;
257
260
  }), historyTools = /* @__PURE__ */ new Set(), historyCommands = new Set(history.flatMap((item) => item.kind === "context" && item.ownerCommand ? [item.ownerCommand.id] : [])), historyTexts = /* @__PURE__ */ new Map(), countText = (key) => historyTexts.set(key, (historyTexts.get(key) ?? 0) + 1);
258
261
  for (let item of history)
259
- item.kind === "tool" && item.toolUseId && historyTools.add(item.toolUseId), (item.kind === "user" || item.kind === "assistant" || item.kind === "thinking") && countText(`${item.kind}:${item.text.trim()}`), item.kind === "tool" && item.name === "ask" && countText(`ask:${askQuestion(item.input).trim()}`);
262
+ item.kind === "tool" && item.toolUseId && historyTools.add(item.toolUseId), (item.kind === "user" || item.kind === "assistant" || item.kind === "thinking") && countText(`${item.kind}:${item.text.trim()}`), item.kind === "tool" && item.name === "ask" && countText(`ask:${askKey(askQuestions(item.input))}`);
260
263
  let consume = (key) => {
261
264
  let n = historyTexts.get(key) ?? 0;
262
265
  return n <= 0 ? !1 : (historyTexts.set(key, n - 1), !0);
@@ -272,12 +275,16 @@ function mergeHistory(existing, incoming) {
272
275
  case "context":
273
276
  return !!item.ownerCommand && !historyCommands.has(item.ownerCommand.id);
274
277
  case "ask":
275
- return !consume(`ask:${item.question.trim()}`);
278
+ return !consume(`ask:${askKey(item.questions)}`);
276
279
  default:
277
280
  return !0;
278
281
  }
279
- });
280
- return sortByTime([...history, ...keep]);
282
+ }), locals = sortByTime(keep), merged = [], local = 0;
283
+ for (let item of history) {
284
+ for (; local < locals.length && locals[local].at <= item.at; ) merged.push(locals[local++]);
285
+ merged.push(item);
286
+ }
287
+ return [...merged, ...locals.slice(local)];
281
288
  }
282
289
  function prependHistory(existing, older) {
283
290
  let ids = new Set(existing.map((item) => item.id)), orphans = /* @__PURE__ */ new Map();
@@ -348,10 +355,10 @@ function applyEventToItems(items, event) {
348
355
  if (toolUseId && items.some((item) => item.kind === "tool" && item.toolUseId === toolUseId)) return items;
349
356
  let tool = { id: localId(), at, local: !0, kind: "tool", toolUseId, name: str(p.name) ?? "tool", input: p.input, status: "running" };
350
357
  if (tool.name === "ask") {
351
- let question = askQuestion(p.input).trim(), card = -1;
358
+ let key = askKey(askQuestions(p.input)), card = -1;
352
359
  for (let i = items.length - 1; i >= 0; i--) {
353
360
  let item = items[i];
354
- if (item.kind === "ask" && item.question.trim() === question) {
361
+ if (item.kind === "ask" && askKey(item.questions) === key) {
355
362
  card = i;
356
363
  break;
357
364
  }
@@ -402,13 +409,13 @@ function applyEventToItems(items, event) {
402
409
  }
403
410
  case "ask.requested": {
404
411
  let requestId = str(p.request_id);
405
- return !requestId || items.some((item) => item.kind === "ask" && item.requestId === requestId) ? items : cap([...finalizeStreaming(items), { id: localId(), at, local: !0, kind: "ask", requestId, question: str(p.question) ?? "", status: "pending" }]);
412
+ return !requestId || items.some((item) => item.kind === "ask" && item.requestId === requestId) ? items : cap([...finalizeStreaming(items), { id: localId(), at, local: !0, kind: "ask", requestId, questions: askQuestions({ questions: p.questions }), status: "pending" }]);
406
413
  }
407
414
  case "ask.resolved": {
408
415
  let requestId = str(p.request_id), index = items.findIndex((item) => item.kind === "ask" && item.requestId === requestId);
409
416
  if (index < 0) return items;
410
417
  let next = items.slice();
411
- return next[index] = { ...next[index], status: "answered", answer: str(p.preview) }, next;
418
+ return next[index] = { ...next[index], status: "answered" }, next;
412
419
  }
413
420
  case "agent.error": {
414
421
  let text = describeAgentError(p);
@@ -672,7 +679,7 @@ function tuiReducer(state, action) {
672
679
  let page = historyToItems(action.entries);
673
680
  if (action.mode === "prepend")
674
681
  return { ...t, loading: !1, loaded: !0, total: action.total, oldestOffset: action.offset, items: prependHistory(t.items, page) };
675
- let firstSeq = action.entries[0]?.seq, older = firstSeq === void 0 ? [] : t.items.filter((item) => !item.local && item.seq !== void 0 && item.seq < firstSeq), oldestOffset = older.length > 0 ? Math.min(t.oldestOffset, action.offset) : action.offset;
682
+ let firstSeq = action.entries[0]?.seq, anchor = firstSeq === void 0 ? -1 : t.items.findIndex((item) => !item.local && item.seq === firstSeq), incomingSeqs = new Set(action.entries.map((entry) => entry.seq)), older = (action.offset === 0 ? [] : anchor >= 0 ? t.items.slice(0, anchor) : t.total <= action.offset ? t.items : []).filter((item) => !item.local && !incomingSeqs.has(item.seq)), oldestOffset = older.length > 0 ? Math.min(t.oldestOffset, action.offset) : action.offset;
676
683
  return {
677
684
  ...t,
678
685
  loading: !1,
@@ -838,7 +845,7 @@ function applyEvent(state, event, log = !0) {
838
845
  let requestId = typeof p.request_id == "string" ? p.request_id : void 0;
839
846
  requestId && (next = patchAgent(next, agentId, (agent) => agent.pendingAsks.some((a) => sameAsk(a, loop, requestId)) ? agent : {
840
847
  ...agent,
841
- pendingAsks: [...agent.pendingAsks, { requestId, question: typeof p.question == "string" ? p.question : "", loop }]
848
+ pendingAsks: [...agent.pendingAsks, { requestId, question: String(p.question), questions: askQuestions({ questions: p.questions }), loop }]
842
849
  }));
843
850
  break;
844
851
  }
@@ -852,6 +859,10 @@ function applyEvent(state, event, log = !0) {
852
859
  if (TRANSCRIPT_EVENTS.has(event.event_type)) {
853
860
  let key = transcriptKey(agentId, loop);
854
861
  next = patchTranscript(next, key, (t) => {
862
+ if (event.event_type === "loop.cleared" || event.event_type === "loop.compacted") {
863
+ let queued = t.items.filter((item) => item.kind === "user" && item.pending && !item.taken);
864
+ return { ...emptyTranscript(), loaded: t.loaded, items: applyEventToItems(queued, event) };
865
+ }
855
866
  let items = applyEventToItems(t.items, event);
856
867
  if (event.event_type === "agent.state.changed" && turnOver(p.state)) return endLive(items === t.items ? t : { ...t, items });
857
868
  let live = event.event_type === "turn.completed" || event.event_type === "agent.error" ? !1 : event.event_type === "turn.delta" || event.event_type === "tool.started" ? !0 : t.live;
@@ -1030,7 +1041,7 @@ function serverText(server) {
1030
1041
  // src/main/tui/state/store.tsx
1031
1042
  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1), { parseAuthorizeToken } = cjs(agent_commands_exports), TUI_MIN_CLIENT_API_VERSION = 1, REFRESH_DEBOUNCE_MS = 120, WEB_EVENT_DEBOUNCE_MS = 900, RESUME_VERDICT_MS = 1500, WEB_POLL_MS = 2e4, TRACKED_POLL_MS = 15e3, FOLDER_OVERLAY = "fleet.track", PROMPT_PREFILL_KEY = "shell.prompt.prefill", CHAT_VIEW_ID = "chat";
1032
1043
  function createTuiStore(options) {
1033
- let client = options.client, plain = options.client, current = new WeakSet([client]), pageSize = options.pageSize ?? 100, state = initialState(client.baseUrl, options.initialView), selectionRevision = 0, listeners = /* @__PURE__ */ new Set(), confirmResolvers = /* @__PURE__ */ new Map(), toastTimers = /* @__PURE__ */ new Map(), debounced = /* @__PURE__ */ new Map(), stream = null, sessionId = null, fallbackNoticed = !1, sessionRetry = !1, reopening = !1, focusSent, focusInFlight = !1, focusRetryAt = 0, lastResyncAt = 0, webTick = null, trackedTick = null, stopped = !1, needsResync = !1, resumeFallback = null, getState = () => state, dispatch = (action) => {
1044
+ let client = options.client, plain = options.client, current = new WeakSet([client]), pageSize = options.pageSize ?? 100, state = initialState(client.baseUrl, options.initialView), selectionRevision = 0, listeners = /* @__PURE__ */ new Set(), confirmResolvers = /* @__PURE__ */ new Map(), toastTimers = /* @__PURE__ */ new Map(), debounced = /* @__PURE__ */ new Map(), historyGenerations = /* @__PURE__ */ new Map(), stream = null, sessionId = null, fallbackNoticed = !1, sessionRetry = !1, reopening = !1, focusSent, focusInFlight = !1, focusRetryAt = 0, lastResyncAt = 0, webTick = null, trackedTick = null, stopped = !1, needsResync = !1, resumeFallback = null, getState = () => state, dispatch = (action) => {
1034
1045
  let next = tuiReducer(state, action);
1035
1046
  if (next !== state) {
1036
1047
  action.type === "select/agent" && selectionRevision++, state = next;
@@ -1082,7 +1093,7 @@ function createTuiStore(options) {
1082
1093
  let previous = client.baseUrl;
1083
1094
  stream?.close(), stream = null, endSession(client);
1084
1095
  for (let timer of debounced.values()) clearTimeout(timer);
1085
- return debounced.clear(), client = next, plain = next, current = new WeakSet([next]), dispatch({ type: "daemon/switch", url: next.baseUrl }), toast(`Switched from ${previous} to ${next.baseUrl} \u2014 agents on the old daemon keep running`, "success", 6e3), await start(), !0;
1096
+ return debounced.clear(), client = next, plain = next, current = new WeakSet([next]), historyGenerations.clear(), dispatch({ type: "daemon/switch", url: next.baseUrl }), toast(`Switched from ${previous} to ${next.baseUrl} \u2014 agents on the old daemon keep running`, "success", 6e3), await start(), !0;
1086
1097
  },
1087
1098
  async refreshAgents() {
1088
1099
  let c = client;
@@ -1273,27 +1284,27 @@ function createTuiStore(options) {
1273
1284
  t?.loaded || t?.loading || await actions.loadTranscript(agentId, loop);
1274
1285
  },
1275
1286
  async loadTranscript(agentId, loop) {
1276
- let key = transcriptKey(agentId, loop), c = client;
1287
+ let key = transcriptKey(agentId, loop), c = client, generation = historyGenerations.get(key) ?? 0;
1277
1288
  dispatch({ type: "transcript/loading", key });
1278
1289
  try {
1279
1290
  let page = await c.loopHistory(agentId, { loop, limit: pageSize });
1280
- if (stale(c)) return;
1291
+ if (stale(c) || generation !== (historyGenerations.get(key) ?? 0)) return;
1281
1292
  dispatch({ type: "transcript/history", key, entries: page.entries, total: page.total, offset: page.offset, mode: "replace" }), settleBackgroundTasks(c, agentId, key);
1282
1293
  } catch (err) {
1283
- stale(c) || dispatch({ type: "transcript/error", key, error: describe(err) });
1294
+ !stale(c) && generation === (historyGenerations.get(key) ?? 0) && dispatch({ type: "transcript/error", key, error: describe(err) });
1284
1295
  }
1285
1296
  },
1286
1297
  async loadOlder(agentId, loop) {
1287
1298
  let key = transcriptKey(agentId, loop), t = state.transcripts[key];
1288
1299
  if (!t || t.loading || t.oldestOffset <= 0) return;
1289
- let offset = Math.max(0, t.oldestOffset - pageSize), limit = t.oldestOffset - offset, c = client;
1300
+ let offset = Math.max(0, t.oldestOffset - pageSize), limit = t.oldestOffset - offset, c = client, generation = historyGenerations.get(key) ?? 0;
1290
1301
  dispatch({ type: "transcript/loading", key });
1291
1302
  try {
1292
1303
  let page = await c.loopHistory(agentId, { loop, limit, offset });
1293
- if (stale(c)) return;
1304
+ if (stale(c) || generation !== (historyGenerations.get(key) ?? 0)) return;
1294
1305
  dispatch({ type: "transcript/history", key, entries: page.entries, total: page.total, offset: page.offset, mode: "prepend" }), settleBackgroundTasks(c, agentId, key);
1295
1306
  } catch (err) {
1296
- stale(c) || dispatch({ type: "transcript/error", key, error: describe(err) });
1307
+ !stale(c) && generation === (historyGenerations.get(key) ?? 0) && dispatch({ type: "transcript/error", key, error: describe(err) });
1297
1308
  }
1298
1309
  },
1299
1310
  async sendChat(text, target = {}) {
@@ -1399,9 +1410,9 @@ function createTuiStore(options) {
1399
1410
  }
1400
1411
  await actions.refreshHil(agentId);
1401
1412
  },
1402
- async answerAsk(agentId, requestId, answer, loop) {
1403
- let result = await run("Answer", (c) => c.answerAsk(agentId, requestId, answer, loop));
1404
- result && toast(result.answered ? "Answer sent" : "Ask was no longer pending", result.answered ? "success" : "warn"), await actions.refreshHil(agentId);
1413
+ async answerAsk(agentId, requestId, answers, loop) {
1414
+ let result = await run("Answer", (c) => c.answerAsk(agentId, requestId, answers, loop)), sent = answers.every((a) => a === null) ? "Skipped" : answers.length > 1 ? "Answers sent" : "Answer sent";
1415
+ result && toast(result.answered ? sent : "Ask was no longer pending", result.answered ? "success" : "warn"), await actions.refreshHil(agentId);
1405
1416
  },
1406
1417
  async respondSuspend(agentId, resume) {
1407
1418
  await run("Suspend", (c) => c.respondSuspend(agentId, resume)) && toast(resume ? "Resumed" : "Shutting down", "success"), await actions.refreshAgent(agentId);
@@ -1529,10 +1540,14 @@ function createTuiStore(options) {
1529
1540
  actions.loadTranscript(agentId, loop);
1530
1541
  });
1531
1542
  break;
1532
- case "turn.completed":
1533
1543
  case "loop.cleared":
1534
1544
  case "loop.compacted":
1535
- state.transcripts[key]?.loaded && debounce(`t:${key}`, () => {
1545
+ historyGenerations.set(key, (historyGenerations.get(key) ?? 0) + 1), state.transcripts[key] && debounce(`t:${key}`, () => {
1546
+ actions.loadTranscript(agentId, loop);
1547
+ });
1548
+ // fall through: refresh loop/status snapshots as after a turn.
1549
+ case "turn.completed":
1550
+ event.event_type === "turn.completed" && state.transcripts[key]?.loaded && debounce(`t:${key}`, () => {
1536
1551
  actions.loadTranscript(agentId, loop);
1537
1552
  }), debounce(`loops:${agentId}`, () => {
1538
1553
  actions.refreshLoops(agentId);
@@ -1785,9 +1800,10 @@ export {
1785
1800
  stoppedLabel,
1786
1801
  stoppedError,
1787
1802
  findTracked,
1803
+ askQuestions,
1804
+ parseAskResult,
1788
1805
  emptyTranscript,
1789
1806
  isAsyncInput,
1790
- askQuestion,
1791
1807
  transcriptKey,
1792
1808
  isBusyState,
1793
1809
  parseServer,
@@ -173,6 +173,7 @@ async function raceAbort(promise, signal) {
173
173
  export {
174
174
  AUTH_PROVIDER_LABELS,
175
175
  normalizeAuthProvider,
176
+ browserLaunchCommand,
176
177
  openBrowser,
177
178
  loginChatGpt,
178
179
  loginGrok,
@@ -22304,7 +22304,7 @@ if (process4.env.DEV === "true") {
22304
22304
  import.meta.resolve("react-devtools-core"), isDevtoolsInstalled = !0;
22305
22305
  } catch {
22306
22306
  }
22307
- isDevtoolsInstalled && await import("./devtools-H7CI2ZVG.mjs");
22307
+ isDevtoolsInstalled && await import("./devtools-AUZWFIPL.mjs");
22308
22308
  }
22309
22309
  var diff = (before, after) => {
22310
22310
  if (before === after)
@@ -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
+ cjs
9
+ } from "./chunk-SGUTYISF.mjs";
10
+ import {
11
+ client_exports
12
+ } from "./chunk-JK6K2BMV.mjs";
13
+ import {
14
+ daemon_url_exports
15
+ } from "./chunk-IM5JKLXO.mjs";
16
+
17
+ // src/main/tui/api/client.ts
18
+ var { daemonCredentials, resolveDaemonUrl } = cjs(daemon_url_exports), shared = cjs(client_exports), staticCredentials = shared.staticCredentials, DaemonClient = class _DaemonClient extends shared.DaemonClient {
19
+ /** `resolved`: options already built for the shared client (derive); `options` is then ignored. */
20
+ constructor(options = {}, resolved) {
21
+ super(resolved ?? _DaemonClient.resolve(options));
22
+ }
23
+ static resolve(options) {
24
+ let baseUrl = resolveDaemonUrl(options.baseUrl, options.env), lookup = { localToken: options.localToken, env: options.env, fetch: options.fetch };
25
+ return {
26
+ baseUrl,
27
+ // `--token` belongs to this URL; another daemon (withBaseUrl) gets its
28
+ // own `--token`, or ADF_DAEMON_TOKEN, or its own local token file (and
29
+ // local proof, when it is this machine's daemon), never this one.
30
+ credentials: daemonCredentials(baseUrl, { ...lookup, token: options.token }),
31
+ credentialsFor: (url, token) => daemonCredentials(url, { ...lookup, token }),
32
+ fetch: options.fetch,
33
+ timeoutMs: options.timeoutMs
34
+ };
35
+ }
36
+ derive(options) {
37
+ return new _DaemonClient({}, options);
38
+ }
39
+ };
40
+
41
+ export {
42
+ DaemonClient
43
+ };