@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
@@ -24,12 +24,12 @@ import {
24
24
  stopDaemon,
25
25
  studioConflict,
26
26
  tailLines
27
- } from "./chunk-RHBGCOS3.mjs";
28
- import "./chunk-D7A77SNL.mjs";
27
+ } from "./chunk-22ZGZFOV.mjs";
28
+ import "./chunk-3FWPIWYM.mjs";
29
29
  import {
30
30
  DEFAULT_DAEMON_PORT
31
- } from "./chunk-AEAJDCVK.mjs";
32
- import "./chunk-BS3USVEA.mjs";
31
+ } from "./chunk-IM5JKLXO.mjs";
32
+ import "./chunk-P4G5ZEBI.mjs";
33
33
  import "./chunk-WJGPNHGX.mjs";
34
34
  import "./chunk-PAK5JCO2.mjs";
35
35
  import "./chunk-ZPB3HYM7.mjs";
@@ -6,7 +6,7 @@ const __filename = __adfFileURLToPath(import.meta.url);
6
6
  const __dirname = __adfDirname(__filename);
7
7
  import {
8
8
  wrapper_default
9
- } from "./chunk-F5ELW46V.mjs";
9
+ } from "./chunk-GJYMGPH4.mjs";
10
10
  import "./chunk-NGK6PVSF.mjs";
11
11
  import "./chunk-M2RX3S2T.mjs";
12
12
 
@@ -0,0 +1,163 @@
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
+ getLanAddresses
9
+ } from "./chunk-A53XYNJL.mjs";
10
+ import "./chunk-M2RX3S2T.mjs";
11
+
12
+ // src/main/services/firewall-service.ts
13
+ import { execFile } from "child_process";
14
+ import { promisify } from "util";
15
+ var execFileAsync = promisify(execFile), FW_RULE_TCP = "ADF Mesh (LAN)", FW_RULE_UDP = "ADF mDNS (LAN)", MDNS_PORT = 5353;
16
+ function firstLanIpv4() {
17
+ let isRfc1918 = (ip) => /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(ip);
18
+ for (let a of getLanAddresses().addresses)
19
+ if (a.family === "IPv4" && isRfc1918(a.address)) return a.address;
20
+ return null;
21
+ }
22
+ function buildWindowsCheckScript() {
23
+ return [
24
+ `$r = Get-NetFirewallRule -DisplayName '${FW_RULE_TCP}' -ErrorAction SilentlyContinue`,
25
+ "$ok = $false",
26
+ "if ($r) { $ok = @($r | Where-Object { $_.Enabled -eq 'True' -and $_.Direction -eq 'Inbound' -and $_.Action -eq 'Allow' }).Count -gt 0 }",
27
+ "[Console]::Out.Write((@{ ruleConfigured = [bool]$ok } | ConvertTo-Json -Compress))"
28
+ ].join("; ");
29
+ }
30
+ function psQuote(s) {
31
+ return `'${s.replace(/['‘’‚‛]/g, "$&$&")}'`;
32
+ }
33
+ function shQuote(s) {
34
+ return `'${s.replace(/'/g, "'\\''")}'`;
35
+ }
36
+ function lanFirewallCommands(platform, port, exePath, manager) {
37
+ if (platform === "win32") {
38
+ let exe = psQuote(exePath), replace = (name) => `Get-NetFirewallRule -DisplayName ${psQuote(name)} -ErrorAction SilentlyContinue | Remove-NetFirewallRule; New-NetFirewallRule -DisplayName ${psQuote(name)}`;
39
+ return [
40
+ `${replace(FW_RULE_TCP)} -Direction Inbound -Action Allow -Protocol TCP -LocalPort ${port} -Program ${exe} -Profile Private,Domain`,
41
+ `${replace(FW_RULE_UDP)} -Direction Inbound -Action Allow -Protocol UDP -LocalPort ${MDNS_PORT} -Program ${exe} -Profile Private,Domain`
42
+ ];
43
+ }
44
+ if (platform === "darwin") {
45
+ let fw = "/usr/libexec/ApplicationFirewall/socketfilterfw";
46
+ return [`sudo ${fw} --add ${shQuote(exePath)}`, `sudo ${fw} --unblockapp ${shQuote(exePath)}`];
47
+ }
48
+ return platform === "linux" && manager ? buildLinuxApplyCommand(manager, port).split(" && ").map((c) => `sudo ${c}`) : [];
49
+ }
50
+ async function probeReachable(lanIp, port) {
51
+ try {
52
+ let ctrl = new AbortController(), t = setTimeout(() => ctrl.abort(), 2e3);
53
+ try {
54
+ return (await fetch(`http://${lanIp}:${port}/agents`, {
55
+ signal: ctrl.signal
56
+ })).ok;
57
+ } finally {
58
+ clearTimeout(t);
59
+ }
60
+ } catch {
61
+ return !1;
62
+ }
63
+ }
64
+ async function checkLanFirewall(port) {
65
+ let platform = process.platform, lanIp = firstLanIpv4(), reachable = lanIp ? await probeReachable(lanIp, port) : null;
66
+ if (platform === "win32")
67
+ try {
68
+ let { stdout } = await execFileAsync(
69
+ "powershell",
70
+ ["-NoProfile", "-NonInteractive", "-Command", buildWindowsCheckScript()],
71
+ { timeout: 15e3, windowsHide: !0 }
72
+ ), ruleConfigured = !!JSON.parse(stdout.trim() || "{}").ruleConfigured;
73
+ return {
74
+ platform,
75
+ supported: !0,
76
+ ruleConfigured,
77
+ reachable,
78
+ lanIp,
79
+ detail: ruleConfigured ? "Inbound firewall rule present." : "No inbound firewall rule: peers cannot fetch this runtime's agents.",
80
+ commands: ruleConfigured ? [] : lanFirewallCommands(platform, port, process.execPath)
81
+ };
82
+ } catch (err) {
83
+ return {
84
+ platform,
85
+ supported: !0,
86
+ ruleConfigured: null,
87
+ reachable,
88
+ lanIp,
89
+ detail: `Could not query Windows Firewall: ${err instanceof Error ? err.message : String(err)}`,
90
+ commands: lanFirewallCommands(platform, port, process.execPath)
91
+ };
92
+ }
93
+ return platform === "darwin" ? {
94
+ platform,
95
+ supported: !0,
96
+ ruleConfigured: null,
97
+ reachable,
98
+ lanIp,
99
+ detail: "The macOS application firewall is per app. If it is on, allow incoming connections for ADF Studio.",
100
+ commands: lanFirewallCommands(platform, port, process.execPath)
101
+ } : platform === "linux" ? checkLinuxFirewall(port, reachable, lanIp) : {
102
+ platform,
103
+ supported: !1,
104
+ ruleConfigured: null,
105
+ reachable,
106
+ lanIp,
107
+ detail: `Open TCP port ${port} and UDP port ${MDNS_PORT} for ADF Studio in this computer's firewall.`,
108
+ commands: []
109
+ };
110
+ }
111
+ async function tryExec(cmd, args) {
112
+ try {
113
+ let { stdout } = await execFileAsync(cmd, args, { timeout: 5e3, windowsHide: !0 });
114
+ return { code: 0, stdout: stdout.toString() };
115
+ } catch (err) {
116
+ let code = typeof err.code == "number" ? err.code : 1, stdout = err.stdout?.toString() ?? "";
117
+ return { code, stdout };
118
+ }
119
+ }
120
+ async function checkLinuxFirewall(port, reachable, lanIp) {
121
+ let base = { platform: "linux", reachable, lanIp }, fwState = await tryExec("firewall-cmd", ["--state"]);
122
+ if (fwState.code === 0 && /running/i.test(fwState.stdout)) {
123
+ let tcp = await tryExec("firewall-cmd", [`--query-port=${port}/tcp`]), udp = await tryExec("firewall-cmd", [`--query-port=${MDNS_PORT}/udp`]), ruleConfigured = tcp.code === 0 && udp.code === 0;
124
+ return {
125
+ ...base,
126
+ supported: !0,
127
+ manager: "firewalld",
128
+ ruleConfigured,
129
+ detail: ruleConfigured ? "firewalld is active and the ports are open." : "firewalld is active but the mesh ports are closed: peers cannot fetch this runtime's agents.",
130
+ commands: ruleConfigured ? [] : lanFirewallCommands("linux", port, "", "firewalld")
131
+ };
132
+ }
133
+ let ufwActive = await tryExec("systemctl", ["is-active", "ufw"]);
134
+ return ufwActive.code === 0 && /^active/.test(ufwActive.stdout.trim()) ? {
135
+ ...base,
136
+ supported: !0,
137
+ manager: "ufw",
138
+ ruleConfigured: null,
139
+ detail: "ufw is active. Allow the mesh ports so peers can fetch this runtime's agents.",
140
+ commands: lanFirewallCommands("linux", port, "", "ufw")
141
+ } : {
142
+ ...base,
143
+ supported: !0,
144
+ manager: null,
145
+ ruleConfigured: !0,
146
+ detail: "No active firewall detected: inbound LAN connections are open.",
147
+ commands: []
148
+ };
149
+ }
150
+ function buildLinuxApplyCommand(manager, port) {
151
+ return manager === "firewalld" ? `firewall-cmd --permanent --add-port=${port}/tcp --add-port=${MDNS_PORT}/udp && firewall-cmd --reload` : `ufw allow ${port}/tcp && ufw allow ${MDNS_PORT}/udp`;
152
+ }
153
+ export {
154
+ FW_RULE_TCP,
155
+ FW_RULE_UDP,
156
+ MDNS_PORT,
157
+ buildLinuxApplyCommand,
158
+ buildWindowsCheckScript,
159
+ checkLanFirewall,
160
+ firstLanIpv4,
161
+ lanFirewallCommands,
162
+ psQuote
163
+ };
@@ -12,14 +12,15 @@ import {
12
12
  openProviderAdd,
13
13
  openWelcome,
14
14
  secretStoreReady
15
- } from "./chunk-2Z7X3UUR.mjs";
16
- import "./chunk-O7XKQ6CH.mjs";
17
- import "./chunk-5QU5VY7N.mjs";
18
- import "./chunk-SOSPQPEN.mjs";
19
- import "./chunk-3AT7IIP7.mjs";
15
+ } from "./chunk-DHO5Z6HP.mjs";
20
16
  import "./chunk-NZLEPJ5M.mjs";
21
17
  import "./chunk-7CV2SA3H.mjs";
22
18
  import "./chunk-SGUTYISF.mjs";
19
+ import "./chunk-O7XKQ6CH.mjs";
20
+ import "./chunk-5QU5VY7N.mjs";
21
+ import "./chunk-TDRQG5UO.mjs";
22
+ import "./chunk-HONGRUAE.mjs";
23
+ import "./chunk-WZ6S3SQP.mjs";
23
24
  import "./chunk-6GJ4QHRI.mjs";
24
25
  import "./chunk-UYY5M2PB.mjs";
25
26
  import "./chunk-ZJKXHM4Q.mjs";
@@ -7,13 +7,16 @@ const __dirname = __adfDirname(__filename);
7
7
  import {
8
8
  MAX_SHELL_DEPTH,
9
9
  executeNode
10
- } from "./chunk-F3WSCAJD.mjs";
10
+ } from "./chunk-XP4U4A2W.mjs";
11
11
  import "./chunk-UZPDETEU.mjs";
12
12
  import "./chunk-ESP3VNMX.mjs";
13
- import "./chunk-LVF2DRBR.mjs";
14
- import "./chunk-E7LC6SHP.mjs";
13
+ import "./chunk-TBMQOM7Y.mjs";
14
+ import "./chunk-4T745GJA.mjs";
15
+ import "./chunk-RIAB37IS.mjs";
15
16
  import "./chunk-3GNIDM53.mjs";
16
17
  import "./chunk-LKFHERRV.mjs";
18
+ import "./chunk-ZECGH3LT.mjs";
19
+ import "./chunk-26RK7T5L.mjs";
17
20
  import "./chunk-BR3AD5QZ.mjs";
18
21
  import "./chunk-M2RX3S2T.mjs";
19
22
  export {
@@ -11,10 +11,10 @@ import {
11
11
  import {
12
12
  DEFAULT_DAEMON_PORT,
13
13
  loopbackPort
14
- } from "./chunk-AEAJDCVK.mjs";
14
+ } from "./chunk-IM5JKLXO.mjs";
15
15
  import {
16
16
  readLocalProof
17
- } from "./chunk-BS3USVEA.mjs";
17
+ } from "./chunk-P4G5ZEBI.mjs";
18
18
  import {
19
19
  readDaemonToken
20
20
  } from "./chunk-WJGPNHGX.mjs";
@@ -31,7 +31,7 @@ var REMOTE_USAGE = `Usage: adf daemon remote on [--name <name>] | off | status [
31
31
  adf daemon devices [list] [--json]
32
32
  adf daemon devices add <label> Print a new device token (shown once)
33
33
  adf daemon devices revoke <id|label> Disconnect that computer and void its token
34
- adf daemon pair Open a pairing window and show its code
34
+ adf daemon pair Pair a browser or client; approve it in this terminal
35
35
 
36
36
  Remote access: devices you pair or add use this computer's ADF daemon (no
37
37
  restart; agents keep running). It listens only on private and Tailscale
@@ -214,11 +214,27 @@ async function pairCommand(io, target) {
214
214
  `), 1;
215
215
  throw err;
216
216
  }
217
- let host = (await call(io, target, "GET", "/remote-access")).urls.find((u) => u.kind === "tailnet" || u.kind === "lan")?.url.replace(/^http:\/\//, "").replace(new RegExp(`:${DEFAULT_DAEMON_PORT}$`), "");
217
+ let status = await call(io, target, "GET", "/remote-access"), host = status.urls.find((u) => u.kind === "tailnet" || u.kind === "lan")?.url.replace(/^http:\/\//, "").replace(new RegExp(`:${DEFAULT_DAEMON_PORT}$`), "");
218
218
  io.stdout(`Pairing with "${window.name}" (fingerprint ${window.fingerprint}) is open for 2 minutes.
219
- `), io.stdout(`On the other computer: adf pair${host ? ` ${host}` : ""}, or pair with this computer in ADF Studio \u2192 Settings \u2192 Connections.
219
+ `);
220
+ let browserUrls = /* @__PURE__ */ new Set();
221
+ for (let address of [...status.urls].sort((a, b) => Number(b.encrypted) - Number(a.encrypted)))
222
+ try {
223
+ let url = new URL(address.url);
224
+ (url.protocol === "http:" || url.protocol === "https:") && !url.username && !url.password && browserUrls.add(new URL("/studio/", url).href);
225
+ } catch {
226
+ }
227
+ if (browserUrls.size > 0) {
228
+ io.stdout(`In the other device\u2019s browser, open:
229
+ `);
230
+ for (let url of browserUrls) io.stdout(` ${url}
231
+ `);
232
+ io.stdout(`Enter the code below and a browser name, then return to this terminal to approve the request. No desktop app is needed.
233
+ `);
234
+ }
235
+ io.stdout(`On the other computer: adf pair${host ? ` ${host}` : ""}, or pair with this computer in ADF Studio \u2192 Settings \u2192 Connections.
220
236
  `), io.stdout(`Code: ${window.code.slice(0, 3)} ${window.code.slice(3)}
221
- `), io.stderr(`Waiting for the other computer\u2026 (Ctrl+C closes the window)
237
+ `), io.stderr(`Waiting for a browser or client request to approve here\u2026 (Ctrl+C closes the window)
222
238
  `);
223
239
  let interrupted = !1, stop = io.onInterrupt?.(() => {
224
240
  interrupted = !0;
@@ -14,11 +14,12 @@ import {
14
14
  useClient,
15
15
  useStore,
16
16
  useTuiSelector
17
- } from "./chunk-OHTB4UW4.mjs";
18
- import "./chunk-75DC5EWN.mjs";
17
+ } from "./chunk-TPA2ITKV.mjs";
19
18
  import "./chunk-7CV2SA3H.mjs";
20
19
  import "./chunk-SGUTYISF.mjs";
21
- import "./chunk-WPT3FAFX.mjs";
20
+ import "./chunk-KBXC5EHK.mjs";
21
+ import "./chunk-7ADDKFT5.mjs";
22
+ import "./chunk-NRTRTR7C.mjs";
22
23
  import "./chunk-6GJ4QHRI.mjs";
23
24
  import "./chunk-LKFHERRV.mjs";
24
25
  import "./chunk-VENQBMOA.mjs";
@@ -6,20 +6,21 @@ const __filename = __adfFileURLToPath(import.meta.url);
6
6
  const __dirname = __adfDirname(__filename);
7
7
  import {
8
8
  DaemonClient
9
- } from "./chunk-FUQRYTGX.mjs";
9
+ } from "./chunk-X6R32YVE.mjs";
10
+ import {
11
+ cjs
12
+ } from "./chunk-SGUTYISF.mjs";
10
13
  import {
11
14
  defaultPrefsPath,
12
15
  loadPrefs,
13
16
  savePrefs
14
17
  } from "./chunk-5QU5VY7N.mjs";
15
- import "./chunk-75DC5EWN.mjs";
16
- import {
17
- cjs
18
- } from "./chunk-SGUTYISF.mjs";
18
+ import "./chunk-JK6K2BMV.mjs";
19
+ import "./chunk-KBXC5EHK.mjs";
19
20
  import {
20
21
  daemon_url_exports
21
- } from "./chunk-AEAJDCVK.mjs";
22
- import "./chunk-BS3USVEA.mjs";
22
+ } from "./chunk-IM5JKLXO.mjs";
23
+ import "./chunk-P4G5ZEBI.mjs";
23
24
  import "./chunk-WJGPNHGX.mjs";
24
25
  import "./chunk-PAK5JCO2.mjs";
25
26
  import "./chunk-ZPB3HYM7.mjs";
@@ -121,10 +122,10 @@ ${tuiUsage()}
121
122
  { LAYOUT_STATE_KEY }
122
123
  ] = await Promise.all([
123
124
  import("./react-IUIDQ5LX.mjs"),
124
- import("./build-QF5W473T.mjs"),
125
- import("./App-UHLJRFZJ.mjs"),
125
+ import("./build-BFOCXM5S.mjs"),
126
+ import("./App-XOPHZTGN.mjs"),
126
127
  import("./themes-BQ72P446.mjs"),
127
- import("./store-D2WLXEY2.mjs"),
128
+ import("./store-37YHXFJ6.mjs"),
128
129
  import("./theme-HLBDTF6F.mjs"),
129
130
  import("./terminal-O5WO7C5U.mjs"),
130
131
  import("./layout-ECWGJF6M.mjs")
@@ -164,7 +165,7 @@ ${tuiUsage()}
164
165
  store.start().then(async () => {
165
166
  let { recordWelcomeLaunch } = await import("./welcome-J5JZZAM5.mjs");
166
167
  if (recordWelcomeLaunch()) {
167
- let { openWelcome } = await import("./open-3OR6WT4T.mjs");
168
+ let { openWelcome } = await import("./open-T3VGLWGF.mjs");
168
169
  openWelcome(store);
169
170
  }
170
171
  if (!options.agent) return;
@@ -0,0 +1,149 @@
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
+ browserLaunchCommand
9
+ } from "./chunk-UBWWGUMU.mjs";
10
+ import "./chunk-2NAP2ZF7.mjs";
11
+ import {
12
+ DEFAULT_DAEMON_PORT,
13
+ isLocalDaemonUrl
14
+ } from "./chunk-IM5JKLXO.mjs";
15
+ import {
16
+ readLocalProof
17
+ } from "./chunk-P4G5ZEBI.mjs";
18
+ import {
19
+ daemonSettingsDir,
20
+ readDaemonToken
21
+ } from "./chunk-WJGPNHGX.mjs";
22
+ import "./chunk-PAK5JCO2.mjs";
23
+ import "./chunk-ZPB3HYM7.mjs";
24
+ import "./chunk-LTX74NU6.mjs";
25
+ import "./chunk-M2RX3S2T.mjs";
26
+
27
+ // src/main/cli/web.ts
28
+ import { spawn } from "node:child_process";
29
+
30
+ // src/main/services/studio-browser-launch.ts
31
+ import { isIP } from "node:net";
32
+ function localBrowserOrigin(value) {
33
+ let url = new URL(value), host = url.hostname.replace(/^\[|\]$/g, "");
34
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.pathname !== "/" || url.search || url.hash || !(host === "localhost" || host === "::1" || isIP(host) === 4 && host.startsWith("127.")))
35
+ throw new Error("Browser sign-in requires this computer\u2019s local daemon address.");
36
+ return url;
37
+ }
38
+ function validatedBrowserLaunch(baseUrl, value) {
39
+ let base = localBrowserOrigin(baseUrl);
40
+ if (typeof value != "string") throw new Error("Invalid browser launch address.");
41
+ let target = new URL(value), fragment = new URLSearchParams(target.hash.slice(1)), ticket = fragment.get("ticket");
42
+ if (target.origin !== base.origin || target.pathname !== "/studio/" || target.search || target.username || target.password || [...fragment.keys()].length !== 1 || !ticket || !/^[A-Za-z0-9_-]{43}$/.test(ticket))
43
+ throw new Error("Invalid browser launch address.");
44
+ return target.href;
45
+ }
46
+
47
+ // src/main/cli/web.ts
48
+ var WEB_USAGE = `Usage: adf web [--port <n> | --url <local-daemon-url>] [--no-daemon]
49
+
50
+ Open Browser Studio already signed in. Starts this computer's daemon if needed.
51
+ No desktop Studio installation or token copying is required.
52
+ --no-daemon (or ADF_NO_AUTOSTART=1) disables automatic daemon startup.
53
+
54
+ On a headless host or for another device:
55
+ adf daemon remote on
56
+ adf daemon remote allow-network
57
+ adf daemon pair
58
+ Open the displayed /studio/ address, enter the code, and approve in the terminal.
59
+ Remote access uses only the networks you allow.
60
+ `;
61
+ function openWebBrowser(url, deps = {}) {
62
+ let { command, args } = browserLaunchCommand(url);
63
+ return new Promise((resolve, reject) => {
64
+ let child = (deps.spawn ?? spawn)(command, args, { detached: !0, stdio: "ignore", windowsHide: !0 }), timer = setTimeout(() => {
65
+ child.unref(), resolve();
66
+ }, 1e4);
67
+ child.once("error", () => {
68
+ clearTimeout(timer), reject(new Error("Browser launcher unavailable."));
69
+ }), child.once("exit", (code) => {
70
+ clearTimeout(timer), code === 0 ? resolve() : reject(new Error("Browser launch failed."));
71
+ });
72
+ });
73
+ }
74
+ async function runWebCommand(args, io) {
75
+ if (args.includes("--help") || args.includes("-h"))
76
+ return io.stdout(WEB_USAGE), 0;
77
+ let env = { ...io.env ?? process.env }, explicitUrl, port, noDaemon = env.ADF_NO_AUTOSTART === "1";
78
+ try {
79
+ for (let i = 0; i < args.length; i++) {
80
+ let [flag, inline] = args[i].split(/=(.*)/s);
81
+ if (flag === "--no-daemon" && inline === void 0) {
82
+ noDaemon = !0;
83
+ continue;
84
+ }
85
+ let value = inline ?? args[++i];
86
+ if (!value || value.startsWith("-")) throw new Error("Missing value.");
87
+ if (flag === "--port" || flag === "-p") port = value;
88
+ else if (flag === "--url" || flag === "-u") explicitUrl = value;
89
+ else throw new Error("Unknown option.");
90
+ }
91
+ if (explicitUrl && port) throw new Error("Choose --port or --url.");
92
+ if (port !== void 0 && (!/^\d+$/.test(port) || Number(port) < 1 || Number(port) > 65535)) throw new Error("Invalid port.");
93
+ } catch {
94
+ return io.stderr(WEB_USAGE), 2;
95
+ }
96
+ port && (env.ADF_DAEMON_PORT = port);
97
+ let configuredPort = port ?? env.ADF_DAEMON_PORT, address = explicitUrl ?? (configuredPort ? `http://127.0.0.1:${configuredPort}` : env.ADF_DAEMON_URL ?? `http://127.0.0.1:${DEFAULT_DAEMON_PORT}`), base;
98
+ try {
99
+ base = localBrowserOrigin(address);
100
+ } catch {
101
+ return io.stderr(`adf web signs in only to this computer\u2019s daemon. On another host, use adf daemon pair and open its /studio/ address.
102
+ `), 2;
103
+ }
104
+ let origin = base.origin;
105
+ if (!isLocalDaemonUrl(origin, env))
106
+ return io.stderr(`That address is not a known local daemon port. For a local daemon, select it with --port; for a tunnel or another host, use browser pairing.
107
+ `), 2;
108
+ try {
109
+ noDaemon || await io.ensureDaemon?.(origin, env);
110
+ } catch {
111
+ return io.stderr(`Could not start the local daemon. Run adf daemon start for details.
112
+ `), 1;
113
+ }
114
+ let daemonPort = Number(base.port) || (base.protocol === "https:" ? 443 : 80), dataDir = daemonSettingsDir(env), token = env.ADF_DAEMON_TOKEN || readDaemonToken(dataDir), proof = readLocalProof(dataDir, daemonPort);
115
+ if (!token || !proof)
116
+ return io.stderr(`The local daemon is not ready for browser sign-in. Start it with adf daemon start, or update it if it is already running.
117
+ `), 1;
118
+ let target;
119
+ try {
120
+ let response = await io.fetch(`${origin}/web/launch`, {
121
+ method: "POST",
122
+ redirect: "error",
123
+ signal: AbortSignal.timeout(1e4),
124
+ headers: { Accept: "application/json", Authorization: `Bearer ${token}`, "X-ADF-Local-Proof": proof }
125
+ });
126
+ if (!response.ok)
127
+ return io.stderr(response.status === 404 ? `This daemon does not support Browser Studio yet. Update adf and restart the daemon when you are ready.
128
+ ` : `Browser sign-in was refused (${response.status}). Check that this is the local daemon and run adf daemon status.
129
+ `), 1;
130
+ let body = await response.json();
131
+ target = validatedBrowserLaunch(origin, body?.url);
132
+ } catch {
133
+ return io.stderr(`Could not get a valid browser sign-in link from the local daemon. Check adf daemon status and update adf if needed.
134
+ `), 1;
135
+ }
136
+ try {
137
+ await (io.openBrowser ?? openWebBrowser)(target);
138
+ } catch {
139
+ return io.stderr(`Could not open a browser on this computer. On a headless host, run adf daemon pair and open the displayed address on another device.
140
+ `), 1;
141
+ }
142
+ return io.stdout(`Opened Browser Studio at ${origin}/studio/ and requested automatic sign-in.
143
+ `), 0;
144
+ }
145
+ export {
146
+ WEB_USAGE,
147
+ openWebBrowser,
148
+ runWebCommand
149
+ };
@@ -6,7 +6,7 @@ const __filename = __adfFileURLToPath(import.meta.url);
6
6
  const __dirname = __adfDirname(__filename);
7
7
  import {
8
8
  wrapper_default
9
- } from "./chunk-F5ELW46V.mjs";
9
+ } from "./chunk-GJYMGPH4.mjs";
10
10
  import {
11
11
  require_dist,
12
12
  require_follow_redirects,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentdocumentformat/cli",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "ADF CLI: the ADF (Agent Document Format) daemon, command line and terminal app. Run your agents headless: `adf daemon`, then `adf`.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,12 +8,13 @@
8
8
  },
9
9
  "files": [
10
10
  "dist/",
11
+ "web/",
11
12
  "resources/",
12
13
  "README.md",
13
14
  "LICENSE"
14
15
  ],
15
16
  "engines": {
16
- "node": ">=22"
17
+ "node": "^22.23.4 || ^24.22.1 || ^26.12.1"
17
18
  },
18
19
  "keywords": [
19
20
  "adf",
@@ -41,7 +42,7 @@
41
42
  "url": "git+https://github.com/christianbalevski/adf.git"
42
43
  },
43
44
  "dependencies": {
44
- "better-sqlite3": "^12.8.0",
45
+ "better-sqlite3": "^13.0.3",
45
46
  "@napi-rs/keyring": "^2.1.0",
46
47
  "sqlite-vec": "^0.1.9",
47
48
  "@modelcontextprotocol/sdk": "^1.27.1",