@agentdocumentformat/cli 0.8.3 → 0.8.5

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-D7A77SNL.mjs → chunk-3FWPIWYM.mjs} +1 -1
  9. package/dist/chunks/chunk-4T745GJA.mjs +431 -0
  10. package/dist/chunks/{chunk-WPT3FAFX.mjs → chunk-7ADDKFT5.mjs} +3 -30
  11. package/dist/chunks/chunk-A53XYNJL.mjs +26 -0
  12. package/dist/chunks/{chunk-MZRXFWPQ.mjs → chunk-AN6USKYQ.mjs} +40 -8
  13. package/dist/chunks/{chunk-2Z7X3UUR.mjs → chunk-DHO5Z6HP.mjs} +14 -12
  14. package/dist/chunks/{chunk-F5ELW46V.mjs → chunk-GJYMGPH4.mjs} +1 -0
  15. package/dist/chunks/chunk-HONGRUAE.mjs +175 -0
  16. package/dist/chunks/{chunk-KCIRFUZH.mjs → chunk-IHARCBZH.mjs} +10 -3
  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-X5EVR3Q4.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-YRG2QUF4.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-YXnanvaL.js +161 -0
  52. package/web/assets/MeshGraphView-BZV40eAE.css +1 -0
  53. package/web/assets/MeshGraphView-ChgwUT3O.js +23 -0
  54. package/web/assets/SettingsPage-BTu2-Yon.js +6 -0
  55. package/web/assets/agent-window-DlJbRHzy.js +3 -0
  56. package/web/assets/agent.store-CGzsE0VA.js +1 -0
  57. package/web/assets/app.store-hw-ZYpyz.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-BcN3UW-e.js +1 -0
  62. package/web/assets/edit-recovery-uWM2umPk.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-B0BKR-7b.js +1 -0
  69. package/web/assets/index-Ba28S-D0.js +1 -0
  70. package/web/assets/index-BxmMf4oH.js +2 -0
  71. package/web/assets/index-BxrG4na5.js +1 -0
  72. package/web/assets/index-C0ujp8ua.js +1 -0
  73. package/web/assets/index-CBCcou8F.js +13 -0
  74. package/web/assets/index-CuTaWSEs.css +1 -0
  75. package/web/assets/index-Cuc6TCV0.js +1 -0
  76. package/web/assets/index-DlQ8IXY2.js +3 -0
  77. package/web/assets/index-Dms-d0wP.js +1 -0
  78. package/web/assets/index-LwIi-F1W.js +11 -0
  79. package/web/assets/index-mW7p_CTU.js +6 -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-CR7cfmOT.js +319 -0
  103. package/web/assets/main-Zf3qnQYd.css +1 -0
  104. package/web/assets/markdown-Cvjx9yec.js +1 -0
  105. package/web/assets/message-queue.store-BMjJTJTP.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-wKFncLeZ.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-35FHmfEB.js +1 -0
  127. package/web/assets/with-selector-CBB0rjuB.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,20 +4,22 @@ 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";
13
10
  import {
14
11
  cjs
15
12
  } from "./chunk-SGUTYISF.mjs";
13
+ import {
14
+ types_exports
15
+ } from "./chunk-KBXC5EHK.mjs";
16
16
  import {
17
17
  ask_form_exports,
18
- loop_parser_exports,
18
+ loop_parser_exports
19
+ } from "./chunk-7ADDKFT5.mjs";
20
+ import {
19
21
  owner_command_row_exports
20
- } from "./chunk-WPT3FAFX.mjs";
22
+ } from "./chunk-NRTRTR7C.mjs";
21
23
  import {
22
24
  require_react
23
25
  } from "./chunk-6GJ4QHRI.mjs";
@@ -277,8 +279,12 @@ function mergeHistory(existing, incoming) {
277
279
  default:
278
280
  return !0;
279
281
  }
280
- });
281
- 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)];
282
288
  }
283
289
  function prependHistory(existing, older) {
284
290
  let ids = new Set(existing.map((item) => item.id)), orphans = /* @__PURE__ */ new Map();
@@ -673,7 +679,7 @@ function tuiReducer(state, action) {
673
679
  let page = historyToItems(action.entries);
674
680
  if (action.mode === "prepend")
675
681
  return { ...t, loading: !1, loaded: !0, total: action.total, oldestOffset: action.offset, items: prependHistory(t.items, page) };
676
- 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;
677
683
  return {
678
684
  ...t,
679
685
  loading: !1,
@@ -853,6 +859,10 @@ function applyEvent(state, event, log = !0) {
853
859
  if (TRANSCRIPT_EVENTS.has(event.event_type)) {
854
860
  let key = transcriptKey(agentId, loop);
855
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
+ }
856
866
  let items = applyEventToItems(t.items, event);
857
867
  if (event.event_type === "agent.state.changed" && turnOver(p.state)) return endLive(items === t.items ? t : { ...t, items });
858
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;
@@ -1031,7 +1041,7 @@ function serverText(server) {
1031
1041
  // src/main/tui/state/store.tsx
1032
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";
1033
1043
  function createTuiStore(options) {
1034
- 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) => {
1035
1045
  let next = tuiReducer(state, action);
1036
1046
  if (next !== state) {
1037
1047
  action.type === "select/agent" && selectionRevision++, state = next;
@@ -1083,7 +1093,7 @@ function createTuiStore(options) {
1083
1093
  let previous = client.baseUrl;
1084
1094
  stream?.close(), stream = null, endSession(client);
1085
1095
  for (let timer of debounced.values()) clearTimeout(timer);
1086
- 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;
1087
1097
  },
1088
1098
  async refreshAgents() {
1089
1099
  let c = client;
@@ -1274,27 +1284,27 @@ function createTuiStore(options) {
1274
1284
  t?.loaded || t?.loading || await actions.loadTranscript(agentId, loop);
1275
1285
  },
1276
1286
  async loadTranscript(agentId, loop) {
1277
- let key = transcriptKey(agentId, loop), c = client;
1287
+ let key = transcriptKey(agentId, loop), c = client, generation = historyGenerations.get(key) ?? 0;
1278
1288
  dispatch({ type: "transcript/loading", key });
1279
1289
  try {
1280
1290
  let page = await c.loopHistory(agentId, { loop, limit: pageSize });
1281
- if (stale(c)) return;
1291
+ if (stale(c) || generation !== (historyGenerations.get(key) ?? 0)) return;
1282
1292
  dispatch({ type: "transcript/history", key, entries: page.entries, total: page.total, offset: page.offset, mode: "replace" }), settleBackgroundTasks(c, agentId, key);
1283
1293
  } catch (err) {
1284
- 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) });
1285
1295
  }
1286
1296
  },
1287
1297
  async loadOlder(agentId, loop) {
1288
1298
  let key = transcriptKey(agentId, loop), t = state.transcripts[key];
1289
1299
  if (!t || t.loading || t.oldestOffset <= 0) return;
1290
- 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;
1291
1301
  dispatch({ type: "transcript/loading", key });
1292
1302
  try {
1293
1303
  let page = await c.loopHistory(agentId, { loop, limit, offset });
1294
- if (stale(c)) return;
1304
+ if (stale(c) || generation !== (historyGenerations.get(key) ?? 0)) return;
1295
1305
  dispatch({ type: "transcript/history", key, entries: page.entries, total: page.total, offset: page.offset, mode: "prepend" }), settleBackgroundTasks(c, agentId, key);
1296
1306
  } catch (err) {
1297
- 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) });
1298
1308
  }
1299
1309
  },
1300
1310
  async sendChat(text, target = {}) {
@@ -1530,10 +1540,14 @@ function createTuiStore(options) {
1530
1540
  actions.loadTranscript(agentId, loop);
1531
1541
  });
1532
1542
  break;
1533
- case "turn.completed":
1534
1543
  case "loop.cleared":
1535
1544
  case "loop.compacted":
1536
- 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}`, () => {
1537
1551
  actions.loadTranscript(agentId, loop);
1538
1552
  }), debounce(`loops:${agentId}`, () => {
1539
1553
  actions.refreshLoops(agentId);
@@ -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
+ };