@agentdocumentformat/cli 0.7.7 → 0.8.0

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 (102) hide show
  1. package/README.md +1 -1
  2. package/dist/adf.mjs +59 -8
  3. package/dist/chunks/{APEv2Parser-2CNNHMXV.mjs → APEv2Parser-WIXRJLHB.mjs} +2 -2
  4. package/dist/chunks/{AiffParser-7BR4RL6G.mjs → AiffParser-ZC4QFOVJ.mjs} +5 -5
  5. package/dist/chunks/{App-5KXVPMBV.mjs → App-A5GUFCFJ.mjs} +279 -291
  6. package/dist/chunks/{DsdiffParser-CMD4AX7A.mjs → DsdiffParser-UAPAJHFX.mjs} +5 -5
  7. package/dist/chunks/{DsfParser-UOGZDS2M.mjs → DsfParser-NNYZK2QX.mjs} +6 -6
  8. package/dist/chunks/{FlacParser-HB3T3CD4.mjs → FlacParser-MW2W4LO3.mjs} +6 -6
  9. package/dist/chunks/{MP4Parser-66HBRUSX.mjs → MP4Parser-Z57SYOOQ.mjs} +4 -4
  10. package/dist/chunks/{MpegParser-YW6LIUEW.mjs → MpegParser-XIIPAZVM.mjs} +7 -7
  11. package/dist/chunks/{MusepackParser-PAUSXP7D.mjs → MusepackParser-QWNDEYHJ.mjs} +6 -6
  12. package/dist/chunks/{OggParser-NUBV3GWC.mjs → OggParser-WRX53F77.mjs} +9 -9
  13. package/dist/chunks/{WavPackParser-WQAGT7TC.mjs → WavPackParser-MJ7WCSJ5.mjs} +2 -2
  14. package/dist/chunks/{WaveParser-EWLQVDX4.mjs → WaveParser-RAVLHZ5S.mjs} +7 -7
  15. package/dist/chunks/{adf-schema-US4NFHMR.mjs → adf-schema-YJSGLMA4.mjs} +2 -2
  16. package/dist/chunks/auth-manager-AJ32FZWS.mjs +19 -0
  17. package/dist/chunks/auth-manager-C5OBEQK2.mjs +18 -0
  18. package/dist/chunks/auth-manager-TBNKCJ45.mjs +17 -0
  19. package/dist/chunks/{chatgpt-subscription-E4MXTIAT.mjs → chatgpt-subscription-MMGNW5KJ.mjs} +5 -2
  20. package/dist/chunks/chunk-3UGZFWIF.mjs +26 -0
  21. package/dist/chunks/{chunk-5PO5PKRV.mjs → chunk-4OGZFUKA.mjs} +126 -67
  22. package/dist/chunks/{chunk-VN7UH7I5.mjs → chunk-6XQZGYMK.mjs} +246 -67
  23. package/dist/chunks/{chunk-XNPZBLYL.mjs → chunk-75DC5EWN.mjs} +13 -2
  24. package/dist/chunks/chunk-AZYOXXVL.mjs +865 -0
  25. package/dist/chunks/{chunk-6VQEXLE2.mjs → chunk-BHY7QDCM.mjs} +41 -3
  26. package/dist/chunks/chunk-C2S64Y6F.mjs +203 -0
  27. package/dist/chunks/chunk-C4GA5SI4.mjs +12799 -0
  28. package/dist/chunks/chunk-DDTTSKGG.mjs +2443 -0
  29. package/dist/chunks/{chunk-VAUOM3IN.mjs → chunk-DLWCKKIO.mjs} +1 -1
  30. package/dist/chunks/{chunk-HPVFJYXR.mjs → chunk-ESP3VNMX.mjs} +1 -1
  31. package/dist/chunks/{chunk-QPLEAE6V.mjs → chunk-G6NBFYG5.mjs} +152 -824
  32. package/dist/chunks/{chunk-KXEF4F4E.mjs → chunk-GAZO6UMI.mjs} +1 -1
  33. package/dist/chunks/{chunk-XYTWGHFS.mjs → chunk-H3XLRWVE.mjs} +1 -1
  34. package/dist/chunks/{chunk-7T2YMTWL.mjs → chunk-H4C65MTP.mjs} +4 -4
  35. package/dist/chunks/chunk-HBOFZRUS.mjs +738 -0
  36. package/dist/chunks/chunk-JVPZIMXW.mjs +976 -0
  37. package/dist/chunks/{chunk-XYV3VCIX.mjs → chunk-JZFONJSL.mjs} +79 -20
  38. package/dist/chunks/chunk-KDDVQKCG.mjs +65 -0
  39. package/dist/chunks/chunk-KRPKWOMB.mjs +290 -0
  40. package/dist/chunks/{chunk-4N4ASPH6.mjs → chunk-LCMANRYY.mjs} +4 -254
  41. package/dist/chunks/{chunk-TPRZQ7Z4.mjs → chunk-LGL6ML37.mjs} +4 -4
  42. package/dist/chunks/chunk-LKFHERRV.mjs +145 -0
  43. package/dist/chunks/chunk-LTX74NU6.mjs +29 -0
  44. package/dist/chunks/chunk-M2F7C2UJ.mjs +425 -0
  45. package/dist/chunks/{chunk-62NE4LG4.mjs → chunk-MQAMI5BF.mjs} +5 -5
  46. package/dist/chunks/chunk-MZRXFWPQ.mjs +278 -0
  47. package/dist/chunks/{chunk-PRMGZZM5.mjs → chunk-NZLEPJ5M.mjs} +2 -0
  48. package/dist/chunks/{chunk-CD3ATSXE.mjs → chunk-NZO5O4VN.mjs} +1 -1
  49. package/dist/chunks/{chunk-I3UYSITV.mjs → chunk-O7XKQ6CH.mjs} +1 -1
  50. package/dist/chunks/chunk-P3RG5LQA.mjs +244 -0
  51. package/dist/chunks/chunk-PAK5JCO2.mjs +48 -0
  52. package/dist/chunks/chunk-PC63YFB7.mjs +34 -0
  53. package/dist/chunks/{daemon-control-HKFVSQTQ.mjs → chunk-PRPTKMQW.mjs} +67 -26
  54. package/dist/chunks/{chunk-LFMB4PAA.mjs → chunk-TKXIH27X.mjs} +974 -113
  55. package/dist/chunks/{chunk-5W7KES6P.mjs → chunk-UZPDETEU.mjs} +1 -1
  56. package/dist/chunks/chunk-V2T6NZX2.mjs +517 -0
  57. package/dist/chunks/chunk-V3MM6PCH.mjs +366 -0
  58. package/dist/chunks/chunk-WJGPNHGX.mjs +67 -0
  59. package/dist/chunks/chunk-WVTPPOKK.mjs +290 -0
  60. package/dist/chunks/{chunk-J74STFKE.mjs → chunk-WX6QCUWI.mjs} +272 -51
  61. package/dist/chunks/{chunk-Y5ZLKFLE.mjs → chunk-XNNJQCZP.mjs} +196 -165
  62. package/dist/chunks/{chunk-HDBPBORT.mjs → chunk-XT2BJUFC.mjs} +15 -6
  63. package/dist/chunks/chunk-YRMKSHW3.mjs +9076 -0
  64. package/dist/chunks/{chunk-BNXUAOO4.mjs → chunk-ZGXUOAWZ.mjs} +3186 -959
  65. package/dist/chunks/chunk-ZPB3HYM7.mjs +45 -0
  66. package/dist/chunks/claude-subscription-33BMZB6I.mjs +29 -0
  67. package/dist/chunks/{cli-AFHQ2XTN.mjs → cli-I47IFDHJ.mjs} +797 -56
  68. package/dist/chunks/{commands-XNJMCD5L.mjs → commands-E4EQUHE5.mjs} +5 -2
  69. package/dist/chunks/{daemon-CHZHTLGR.mjs → daemon-FQ5BV3AP.mjs} +84550 -70518
  70. package/dist/chunks/daemon-control-L3CLG63P.mjs +59 -0
  71. package/dist/chunks/{daemon-token-WRSULP7G.mjs → daemon-token-L5QKTHU5.mjs} +3 -1
  72. package/dist/chunks/{discord-DSP4HUWI.mjs → discord-IR62565M.mjs} +3 -52
  73. package/dist/chunks/{email-BRG7KUO2.mjs → email-KHHTJBDW.mjs} +4 -2
  74. package/dist/chunks/{environment-NX277MQG.mjs → environment-R47X44GM.mjs} +1 -1
  75. package/dist/chunks/{grok-subscription-4PYX7TBF.mjs → grok-subscription-E74FS5EG.mjs} +5 -2
  76. package/dist/chunks/{lib-N7FCZWKH.mjs → lib-L27L5PXM.mjs} +22 -22
  77. package/dist/chunks/{open-VAU7PXT6.mjs → open-TLGS2Z3Q.mjs} +4 -4
  78. package/dist/chunks/{parser-JVY2PWSM.mjs → parser-7GARNT5L.mjs} +1 -1
  79. package/dist/chunks/{pipeline-executor-U6IMCCP3.mjs → pipeline-executor-FD4FBWQA.mjs} +8 -5
  80. package/dist/chunks/prompt-RRHZX4YT.mjs +13 -0
  81. package/dist/chunks/remote-access-cli-XXAPQWH6.mjs +268 -0
  82. package/dist/chunks/remote-hello-UFWUBDQI.mjs +37 -0
  83. package/dist/chunks/sdk-5FD2ZP7N.mjs +28422 -0
  84. package/dist/chunks/{slack-OCNNF4DX.mjs → slack-IYC5RAB5.mjs} +3 -4
  85. package/dist/chunks/{store-HUVDJPYN.mjs → store-ZRN2WCFB.mjs} +6 -3
  86. package/dist/chunks/tailscale-WLJATFMB.mjs +25 -0
  87. package/dist/chunks/{theme-SFE3JMA2.mjs → theme-HLBDTF6F.mjs} +1 -1
  88. package/dist/chunks/{themes-YLXLOIJF.mjs → themes-BQ72P446.mjs} +2 -2
  89. package/dist/chunks/{token-6G3HCMNX.mjs → token-6D22WECM.mjs} +20 -16
  90. package/dist/chunks/{token-util-UXYSDQIW.mjs → token-util-YF3ZWBZ4.mjs} +1 -2
  91. package/dist/chunks/{tui-4ZWZKD4C.mjs → tui-SPSPDADM.mjs} +17 -14
  92. package/dist/chunks/{welcome-XHXFV7SH.mjs → welcome-J5JZZAM5.mjs} +1 -1
  93. package/dist/chunks/{whatsapp-AVKT3CTJ.mjs → whatsapp-YJFFVN4Q.mjs} +8 -8
  94. package/package.json +1 -1
  95. package/dist/chunks/chunk-GKKCMXIZ.mjs +0 -94
  96. package/dist/chunks/chunk-IHDDCZBS.mjs +0 -112
  97. package/dist/chunks/chunk-KWFOS5WC.mjs +0 -41
  98. package/dist/chunks/chunk-UEZR2CNS.mjs +0 -65
  99. package/dist/chunks/chunk-VMHTYDH4.mjs +0 -172
  100. package/dist/chunks/chunk-ZROSGV65.mjs +0 -3112
  101. package/dist/chunks/{chunk-NBTUWMGP.mjs → chunk-2MTE22CR.mjs} +3 -3
  102. package/dist/chunks/{telegram-YI2OHNTD.mjs → telegram-JYY2VDTI.mjs} +4 -4
@@ -7,10 +7,7 @@ const __dirname = __adfDirname(__filename);
7
7
  import {
8
8
  AGENT_DEFAULTS,
9
9
  DEFAULT_TOOLS
10
- } from "./chunk-CD3ATSXE.mjs";
11
- import {
12
- __export
13
- } from "./chunk-M2RX3S2T.mjs";
10
+ } from "./chunk-NZO5O4VN.mjs";
14
11
 
15
12
  // src/shared/constants/adf-defaults.ts
16
13
  var ADF_VERSION = "0.2", DOCS_GUIDES_URL = "https://raw.githubusercontent.com/christianbalevski/adf/main/docs/guides", ADF_SKILLS_REGISTRY_URL = "https://raw.githubusercontent.com/christianbalevski/adf/main/skills/registry.json", PROVIDER_TYPES = [
@@ -19,7 +16,8 @@ var ADF_VERSION = "0.2", DOCS_GUIDES_URL = "https://raw.githubusercontent.com/ch
19
16
  { type: "openai-compatible", label: "OpenAI Compatible", placeholder: { apiKey: "Optional", model: "e.g. llama-3-8b" } },
20
17
  { type: "openrouter", label: "OpenRouter", placeholder: { apiKey: "sk-or-...", model: "e.g. anthropic/claude-sonnet-4" } },
21
18
  { type: "chatgpt-subscription", label: "ChatGPT Subscription", placeholder: { apiKey: "OAuth \u2014 click Sign In", model: "e.g. gpt-5.6-sol" } },
22
- { type: "grok-subscription", label: "Grok Subscription", placeholder: { apiKey: "OAuth \u2014 click Sign In", model: "e.g. grok-4.5" } }
19
+ { type: "grok-subscription", label: "Grok Subscription", placeholder: { apiKey: "OAuth \u2014 click Sign In", model: "e.g. grok-4.5" } },
20
+ { type: "claude-subscription", label: "Claude Subscription", placeholder: { apiKey: "Claude Code sign-in \u2014 click Sign In", model: "e.g. claude-sonnet-5-5" } }
23
21
  ], DEFAULT_AGENT_CONFIG = {
24
22
  adf_version: ADF_VERSION,
25
23
  name: "Untitled Agent",
@@ -31,7 +29,6 @@ var ADF_VERSION = "0.2", DOCS_GUIDES_URL = "https://raw.githubusercontent.com/ch
31
29
  provider: "",
32
30
  model_id: "",
33
31
  temperature: 0.7,
34
- max_tokens: 4096,
35
32
  vision: !1
36
33
  },
37
34
  instructions: "",
@@ -250,246 +247,6 @@ The \`ws_*\` tools manage your configured connections (schemas have the details)
250
247
  };
251
248
  var DEFAULT_COMPACTION_PROMPT = "You are a conversation compactor. Read the transcript between an AI agent and its environment and write a present-tense status briefing: bullets organized by topic, under 1500 words. Keep current task state, key decisions and their reasoning, exact paths, names, IDs, and values in play, pending work and next steps, constraints or preferences discovered, open questions and hunches the agent was carrying, and anything surprising or still unexplained. Keep exact details; a vague summary is useless. Keep every open thread; anything dropped here is gone. Transcript role tags carry the loop seq when known (`[USER S137]` / `[ASSISTANT S137]`), so when a bullet derives from specific messages, cite them (`[S137]`) and the summary stays traceable to the archived history in adf_audit.";
252
249
 
253
- // src/main/utils/ssrf-guard.ts
254
- import { lookup } from "node:dns/promises";
255
- import { isIP } from "node:net";
256
- var ALLOWED_FETCH_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]), ALLOWED_CONNECT_PROTOCOLS = /* @__PURE__ */ new Set(["ws:", "wss:", "http:", "https:"]);
257
- function parseLooseIPv4(host) {
258
- let parts = host.split(".");
259
- if (parts.length < 1 || parts.length > 4) return null;
260
- let nums = [];
261
- for (let part of parts) {
262
- if (part === "") return null;
263
- let n;
264
- if (/^0[xX][0-9a-fA-F]+$/.test(part)) n = parseInt(part.slice(2), 16);
265
- else if (/^0[0-7]+$/.test(part)) n = parseInt(part.slice(1), 8);
266
- else if (/^[0-9]+$/.test(part)) n = parseInt(part, 10);
267
- else return null;
268
- if (!Number.isFinite(n) || n < 0) return null;
269
- nums.push(n);
270
- }
271
- for (let i = 0; i < nums.length - 1; i++) if (nums[i] > 255) return null;
272
- let last = nums[nums.length - 1];
273
- if (last >= Math.pow(256, 4 - nums.length + 1)) return null;
274
- let value = last;
275
- for (let i = 0; i < nums.length - 1; i++) value += nums[i] * Math.pow(256, 3 - i);
276
- return [value >>> 24 & 255, value >>> 16 & 255, value >>> 8 & 255, value & 255].join(".");
277
- }
278
- function isBlockedIPv4(ip) {
279
- let o = ip.split(".").map(Number);
280
- if (o.length !== 4 || o.some((n) => !Number.isInteger(n) || n < 0 || n > 255)) return !1;
281
- let [a, b, c] = o;
282
- return a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 0 && c === 0 || a === 192 && b === 168 || a === 198 && (b === 18 || b === 19) || a >= 224;
283
- }
284
- function isBlockedIPv6(raw) {
285
- let addr = raw.toLowerCase().replace(/^\[|\]$/g, "").split("%")[0];
286
- if (addr === "::" || addr === "::1" || /^(0:){7}[01]$/.test(addr)) return !0;
287
- let mapped = addr.match(/^::(?:ffff:(?:0{1,4}:)?)?((?:\d{1,3}\.){3}\d{1,3})$/);
288
- if (mapped) return isBlockedIPv4(mapped[1]);
289
- let head = addr.split(":")[0];
290
- if (!head) return !1;
291
- let h = parseInt(head, 16);
292
- return Number.isNaN(h) ? !1 : (h & 65472) === 65152 || (h & 65024) === 64512 || (h & 65280) === 65280;
293
- }
294
- function isBlockedIpAddress(ip) {
295
- let version = isIP(ip.replace(/^\[|\]$/g, ""));
296
- return version === 4 ? isBlockedIPv4(ip) : version === 6 ? isBlockedIPv6(ip) : !1;
297
- }
298
- function isLinkLocalIp(ip) {
299
- let bare = ip.replace(/^\[|\]$/g, "").split("%")[0], version = isIP(bare);
300
- if (version === 4) {
301
- let o = bare.split(".").map(Number);
302
- return o[0] === 169 && o[1] === 254;
303
- }
304
- if (version === 6) {
305
- let addr = bare.toLowerCase(), mapped = addr.match(/^::(?:ffff:(?:0{1,4}:)?)?((?:\d{1,3}\.){3}\d{1,3})$/);
306
- if (mapped) {
307
- let o = mapped[1].split(".").map(Number);
308
- return o[0] === 169 && o[1] === 254;
309
- }
310
- let head = addr.split(":")[0], h = parseInt(head, 16);
311
- return Number.isNaN(h) ? !1 : (h & 65472) === 65152;
312
- }
313
- return !1;
314
- }
315
- function isLoopbackIp(ip) {
316
- let bare = ip.replace(/^\[|\]$/g, "").split("%")[0], version = isIP(bare);
317
- if (version === 4) return bare.split(".").map(Number)[0] === 127;
318
- if (version === 6) {
319
- let addr = bare.toLowerCase();
320
- if (addr === "::1" || /^(0:){7}1$/.test(addr)) return !0;
321
- let mapped = addr.match(/^::(?:ffff:(?:0{1,4}:)?)?((?:\d{1,3}\.){3}\d{1,3})$/);
322
- return mapped ? mapped[1].split(".").map(Number)[0] === 127 : !1;
323
- }
324
- return !1;
325
- }
326
- function isLoopbackHostname(host) {
327
- let h = host.toLowerCase().replace(/\.$/, "");
328
- return h === "localhost" || h === "localhost.localdomain" || h.endsWith(".localhost");
329
- }
330
- function isUnspecifiedIp(ip) {
331
- let bare = ip.replace(/^\[|\]$/g, "").split("%")[0].toLowerCase();
332
- if (bare === "0.0.0.0" || bare === "::" || /^(0{1,4}:){7}0{1,4}$/.test(bare)) return !0;
333
- let mapped = bare.match(/^::(?:ffff:(?:0{1,4}:)?)?((?:\d{1,3}\.){3}\d{1,3})$/);
334
- return mapped ? mapped[1] === "0.0.0.0" : !1;
335
- }
336
- function blockedMessage(target) {
337
- return `Blocked by the sys_fetch SSRF guard: "${target}" is a private-network address (loopback is allowed by default). Set security.allow_local_fetch: true in your config to permit private/LAN fetches \u2014 an agent-initiated write to that setting raises an owner approval request.`;
338
- }
339
- function connectBlockedMessage(target) {
340
- return `Blocked by the ws_connect SSRF guard: "${target}" is a private-network address (loopback is allowed by default). Set security.allow_local_fetch: true in your config to permit private/LAN connections \u2014 an agent-initiated write to that setting raises an owner approval request.`;
341
- }
342
- async function classifyHost(host) {
343
- let loopbackHost = !1, candidates = [];
344
- if (isIP(host))
345
- candidates = [host];
346
- else if (isLoopbackHostname(host))
347
- loopbackHost = !0;
348
- else {
349
- let loose = parseLooseIPv4(host);
350
- if (loose)
351
- candidates = [loose];
352
- else
353
- try {
354
- candidates = (await lookup(host, { all: !0, verbatim: !0 })).map((a) => a.address);
355
- } catch {
356
- return null;
357
- }
358
- }
359
- return {
360
- anyLinkLocal: candidates.some(isLinkLocalIp),
361
- anyLoopback: loopbackHost || candidates.some(isLoopbackIp),
362
- anyUnspecified: candidates.some(isUnspecifiedIp),
363
- // Blocked classes minus loopback (private, CGNAT, unspecified, multicast, …)
364
- // — loopback itself is allowed by default and only tier-gated per-port.
365
- anyNonLoopbackBlocked: candidates.some((ip) => isBlockedIpAddress(ip) && !isLoopbackIp(ip))
366
- };
367
- }
368
- function applyPolicy(target, port, path, cls, opts, overridableMessage) {
369
- return cls.anyLinkLocal ? `Blocked: "${target}" is a link-local / cloud-metadata address, which is never fetchable (even with allow_local_fetch).` : (cls.anyLoopback || cls.anyUnspecified) && opts.daemonPort && port === opts.daemonPort ? `Blocked: "${target}" (port ${port}) is the local ADF daemon control API, which is never fetchable, even with allow_local_fetch.` : opts.ownOrigin && cls.anyLoopback && port === opts.ownOrigin.port && path.startsWith(opts.ownOrigin.pathPrefix) || opts.allowLocal ? null : cls.anyNonLoopbackBlocked ? overridableMessage(target) : null;
370
- }
371
- async function checkFetchTarget(rawUrl, opts = { allowLocal: !1 }) {
372
- let url;
373
- try {
374
- url = new URL(rawUrl);
375
- } catch {
376
- return `Invalid URL: ${rawUrl}`;
377
- }
378
- if (!ALLOWED_FETCH_PROTOCOLS.has(url.protocol))
379
- return `Blocked by the sys_fetch guard: only http and https URLs may be fetched (got "${url.protocol}").`;
380
- let host = url.hostname.replace(/^\[|\]$/g, "");
381
- if (!host) return `Invalid URL: ${rawUrl}`;
382
- let port = url.port ? Number(url.port) : url.protocol === "https:" ? 443 : 80, cls = await classifyHost(host);
383
- return cls ? applyPolicy(url.hostname, port, url.pathname, cls, opts, blockedMessage) : null;
384
- }
385
- async function checkConnectTarget(rawUrl, opts = { allowLocal: !1 }) {
386
- let url;
387
- try {
388
- url = new URL(rawUrl);
389
- } catch {
390
- return `Invalid URL: ${rawUrl}`;
391
- }
392
- if (!ALLOWED_CONNECT_PROTOCOLS.has(url.protocol))
393
- return `Blocked by the ws_connect guard: only ws, wss, http and https URLs may be connected (got "${url.protocol}").`;
394
- let host = url.hostname.replace(/^\[|\]$/g, "");
395
- if (!host) return `Invalid URL: ${rawUrl}`;
396
- let secure = url.protocol === "wss:" || url.protocol === "https:", port = url.port ? Number(url.port) : secure ? 443 : 80, cls = await classifyHost(host);
397
- return cls ? applyPolicy(url.hostname, port, url.pathname, cls, opts, connectBlockedMessage) : null;
398
- }
399
-
400
- // src/shared/utils/context-breakdown.ts
401
- var context_breakdown_exports = {};
402
- __export(context_breakdown_exports, {
403
- DEFAULT_COMPACT_THRESHOLD: () => DEFAULT_COMPACT_THRESHOLD,
404
- contextCategories: () => contextCategories,
405
- contextTotal: () => contextTotal,
406
- resolveCompactThreshold: () => resolveCompactThreshold,
407
- resolveHostThreshold: () => resolveHostThreshold,
408
- resolveLoopThreshold: () => resolveLoopThreshold
409
- });
410
- var DEFAULT_COMPACT_THRESHOLD = 1e5;
411
- function hostThreshold(config, model) {
412
- let context = config?.context?.compact_threshold;
413
- if (context != null) return { value: context, source: "agent" };
414
- let fromModel = model?.compact_threshold;
415
- return fromModel != null ? { value: fromModel, source: "model" } : { value: 1e5, source: "default" };
416
- }
417
- function resolveCompactThreshold(config, loop) {
418
- if (!loop || loop === "main") return hostThreshold(config, config?.model);
419
- let declared = config?.loops?.find((l) => l.name === loop);
420
- return declared ? declared.compact_threshold != null ? { value: declared.compact_threshold, source: "loop" } : hostThreshold(config, declared.model ?? config?.model) : hostThreshold(config, config?.model);
421
- }
422
- function resolveHostThreshold(config) {
423
- return resolveCompactThreshold(config).value;
424
- }
425
- function resolveLoopThreshold(config, loop) {
426
- return resolveCompactThreshold(config, loop).value;
427
- }
428
- function contextTotal(b) {
429
- return b.system_prompt_tokens + b.tools_total_tokens + b.messages_tokens + b.dynamic_instructions_tokens;
430
- }
431
- var byTokens = (list) => [...list].sort((a, b) => b.tokens - a.tokens);
432
- function contextCategories(b, maxItems = 12) {
433
- let fileTokens = b.injected_files.reduce((sum, f) => sum + f.tokens, 0), parts = b.system_prompt_parts, out = [
434
- {
435
- id: "system",
436
- key: "system",
437
- label: "System prompt",
438
- tokens: Math.max(0, b.system_prompt_tokens - fileTokens),
439
- items: parts ? byTokens([
440
- { name: "Base prompt and capability sections", tokens: parts.base_and_sections },
441
- { name: "Agent instructions", tokens: parts.instructions },
442
- { name: "Identity, loop roster, runtime blocks", tokens: parts.runtime_blocks }
443
- ]).filter((i) => i.tokens > 0) : [],
444
- note: "Base prompt, instructions and runtime blocks: sent with every request."
445
- }
446
- ];
447
- b.injected_files.length > 0 && out.push({
448
- id: "files",
449
- key: "files",
450
- label: "Injected files",
451
- tokens: fileTokens,
452
- count: b.injected_files.length,
453
- items: byTokens(b.injected_files.map((f) => ({ name: f.path, tokens: f.tokens }))).slice(0, maxItems),
454
- note: "{{path}} files rendered into the system prompt."
455
- });
456
- let builtIn = b.tool_groups.filter((g) => g.source === "built-in"), builtInTools = builtIn.flatMap((g) => g.tools);
457
- out.push({
458
- id: "tools",
459
- key: "tools",
460
- label: "Tools",
461
- tokens: builtIn.reduce((sum, g) => sum + g.tokens, 0),
462
- count: builtInTools.length,
463
- items: byTokens(builtInTools).slice(0, maxItems),
464
- note: "Built-in tool schemas: sent with every request."
465
- });
466
- for (let group of b.tool_groups)
467
- group.source !== "built-in" && out.push({
468
- id: `mcp:${group.source}`,
469
- key: "mcp",
470
- label: `MCP ${group.source}`,
471
- tokens: group.tokens,
472
- count: group.tools.length,
473
- items: byTokens(group.tools).slice(0, maxItems),
474
- note: `Tool schemas from the ${group.source} MCP server.`
475
- });
476
- return out.push({
477
- id: "dynamic",
478
- key: "dynamic",
479
- label: "Dynamic instructions",
480
- tokens: b.dynamic_instructions_tokens,
481
- items: [],
482
- note: "Per-turn runtime notes (context pressure, reminders)."
483
- }), out.push({
484
- id: "messages",
485
- key: "messages",
486
- label: "Conversation",
487
- tokens: b.messages_tokens,
488
- items: [],
489
- note: "This loop\u2019s history, compaction summary included (estimate)."
490
- }), byTokens(out);
491
- }
492
-
493
250
  export {
494
251
  DOCS_GUIDES_URL,
495
252
  ADF_SKILLS_REGISTRY_URL,
@@ -500,12 +257,5 @@ export {
500
257
  DEFAULT_BASE_PROMPT,
501
258
  DEFAULT_TOOL_PROMPTS,
502
259
  DEFAULT_DYNAMIC_PROMPTS,
503
- DEFAULT_COMPACTION_PROMPT,
504
- checkFetchTarget,
505
- checkConnectTarget,
506
- resolveCompactThreshold,
507
- resolveLoopThreshold,
508
- contextTotal,
509
- contextCategories,
510
- context_breakdown_exports
260
+ DEFAULT_COMPACTION_PROMPT
511
261
  };
@@ -8,10 +8,10 @@ import {
8
8
  classifyRedirectTarget,
9
9
  parseBracedExpansion,
10
10
  unsupportedDevTargetMessage
11
- } from "./chunk-5W7KES6P.mjs";
11
+ } from "./chunk-UZPDETEU.mjs";
12
12
  import {
13
13
  resolveWithDefault
14
- } from "./chunk-HPVFJYXR.mjs";
14
+ } from "./chunk-ESP3VNMX.mjs";
15
15
  import {
16
16
  EXIT,
17
17
  enforceToolGate,
@@ -21,7 +21,7 @@ import {
21
21
  getCommand,
22
22
  notifyToolCallObservers,
23
23
  shellReadFile
24
- } from "./chunk-ZROSGV65.mjs";
24
+ } from "./chunk-YRMKSHW3.mjs";
25
25
 
26
26
  // src/main/tools/shell/executor/pipeline-executor.ts
27
27
  function vfsPath(p) {
@@ -147,7 +147,7 @@ async function executeCommand(cmd, stdin, ctx) {
147
147
  for (let r of redirects) {
148
148
  if (r.type === "in" && r.target !== void 0) {
149
149
  let [redirectContent, redirectErr] = await shellReadFile(ctx.toolRegistry, ctx.workspace, vfsPath(r.target));
150
- if (redirectErr)
150
+ if (redirectErr !== null)
151
151
  return err(`${name}: ${redirectErr}`);
152
152
  stdin = redirectContent;
153
153
  }
@@ -0,0 +1,145 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
7
+ import {
8
+ __export
9
+ } from "./chunk-M2RX3S2T.mjs";
10
+
11
+ // src/shared/utils/file-ref.ts
12
+ var file_ref_exports = {};
13
+ __export(file_ref_exports, {
14
+ adfFileUrl: () => adfFileUrl,
15
+ applyFileRefChanges: () => applyFileRefChanges,
16
+ attachmentMetadata: () => attachmentMetadata,
17
+ attachmentText: () => attachmentText,
18
+ attachmentsOf: () => attachmentsOf,
19
+ deletedFilePlaceholder: () => deletedFilePlaceholder,
20
+ displayAttachment: () => displayAttachment,
21
+ fileRefKind: () => fileRefKind,
22
+ fileRefName: () => fileRefName,
23
+ fileRefText: () => fileRefText,
24
+ isAudioInputMime: () => isAudioInputMime,
25
+ isFileRefBlock: () => isFileRefBlock,
26
+ isVideoInputMime: () => isVideoInputMime,
27
+ isVisionMime: () => isVisionMime,
28
+ mediaKindOfMime: () => mediaKindOfMime,
29
+ splitLegacyUploads: () => splitLegacyUploads
30
+ });
31
+ var VISION_MIMES = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]), AUDIO_INPUT_MIMES = /* @__PURE__ */ new Set([
32
+ "audio/wav",
33
+ "audio/mpeg",
34
+ "audio/mp3",
35
+ "audio/aiff",
36
+ "audio/aac",
37
+ "audio/ogg",
38
+ "audio/flac",
39
+ "audio/x-m4a",
40
+ "audio/webm"
41
+ ]), VIDEO_INPUT_MIMES = /* @__PURE__ */ new Set(["video/mp4", "video/mpeg", "video/quicktime", "video/webm"]);
42
+ function isVisionMime(mime) {
43
+ return !!mime && VISION_MIMES.has(mime);
44
+ }
45
+ function isAudioInputMime(mime) {
46
+ return !!mime && AUDIO_INPUT_MIMES.has(mime);
47
+ }
48
+ function isVideoInputMime(mime) {
49
+ return !!mime && VIDEO_INPUT_MIMES.has(mime);
50
+ }
51
+ function mediaKindOfMime(mime) {
52
+ if (isVisionMime(mime)) return "image";
53
+ if (isAudioInputMime(mime)) return "audio";
54
+ if (isVideoInputMime(mime)) return "video";
55
+ }
56
+ function isFileRefBlock(block) {
57
+ return block.type === "file_ref" && !!block.file_ref && typeof block.file_ref.path == "string";
58
+ }
59
+ function fileRefKind(ref) {
60
+ return mediaKindOfMime(ref.mime_type);
61
+ }
62
+ function fileRefName(ref) {
63
+ let segments = ref.path.split("/");
64
+ return segments[segments.length - 1] || ref.path;
65
+ }
66
+ function deletedFilePlaceholder(ref) {
67
+ return `[deleted: ${fileRefName(ref)}]`;
68
+ }
69
+ function adfFileUrl(path) {
70
+ return `adf-file://${path.split("/").map(encodeURIComponent).join("/")}`;
71
+ }
72
+ function displayAttachment(ref) {
73
+ let kind = fileRefKind(ref);
74
+ return {
75
+ path: ref.path,
76
+ name: fileRefName(ref),
77
+ mime_type: ref.mime_type,
78
+ ...kind ? { kind } : {},
79
+ ...ref.deleted ? { deleted: !0 } : {}
80
+ };
81
+ }
82
+ function attachmentsOf(blocks) {
83
+ let out = [];
84
+ for (let block of blocks) isFileRefBlock(block) && out.push(displayAttachment(block.file_ref));
85
+ return out;
86
+ }
87
+ function attachmentMetadata(content, previews = []) {
88
+ let attachments = attachmentsOf(content);
89
+ if (!(attachments.length === 0 && previews.length === 0))
90
+ return { ...previews.length > 0 ? { imagePreviewUrls: previews } : {}, ...attachments.length > 0 ? { attachments } : {} };
91
+ }
92
+ function attachmentText(a) {
93
+ return a.deleted ? deletedFilePlaceholder(a) : `[${a.kind ?? "file"}: ${a.name}]`;
94
+ }
95
+ var LEGACY_UPLOAD_LINE = /^\[Uploaded file: .+ \(([^,()]+), [^()]+\)\. Use fs_read with path "(.+)" to inspect it\.\]$/;
96
+ function splitLegacyUploads(text) {
97
+ if (!text.includes("[Uploaded file: ")) return { text, attachments: [] };
98
+ let attachments = [], kept = [];
99
+ for (let line of text.split(`
100
+ `)) {
101
+ let match = LEGACY_UPLOAD_LINE.exec(line.trim());
102
+ if (!match) {
103
+ kept.push(line);
104
+ continue;
105
+ }
106
+ let kind = mediaKindOfMime(match[1]);
107
+ attachments.push({ path: match[2], name: fileRefName({ path: match[2] }), mime_type: match[1], ...kind ? { kind } : {} });
108
+ }
109
+ return { text: kept.join(`
110
+ `).trim(), attachments };
111
+ }
112
+ function fileRefText(ref) {
113
+ return ref.deleted ? deletedFilePlaceholder(ref) : `[${fileRefKind(ref) ?? "file"}: ${ref.path}]`;
114
+ }
115
+ function applyFileRefChanges(blocks, changes) {
116
+ let out = null;
117
+ for (let i = 0; i < blocks.length; i++) {
118
+ let block = blocks[i];
119
+ if (!isFileRefBlock(block) || block.file_ref.deleted) continue;
120
+ let ref = block.file_ref;
121
+ for (let change of changes) {
122
+ if (ref.deleted) break;
123
+ change.op === "rename" && ref.path === change.from ? ref = { ...ref, path: change.to } : change.op === "delete" && ref.path === change.path && (ref = { ...ref, deleted: !0 });
124
+ }
125
+ ref !== block.file_ref && (out ??= blocks.slice(), out[i] = { ...block, file_ref: ref });
126
+ }
127
+ return out ?? blocks;
128
+ }
129
+
130
+ export {
131
+ isVisionMime,
132
+ isAudioInputMime,
133
+ isVideoInputMime,
134
+ mediaKindOfMime,
135
+ isFileRefBlock,
136
+ fileRefKind,
137
+ fileRefName,
138
+ deletedFilePlaceholder,
139
+ displayAttachment,
140
+ attachmentsOf,
141
+ splitLegacyUploads,
142
+ fileRefText,
143
+ applyFileRefChanges,
144
+ file_ref_exports
145
+ };
@@ -0,0 +1,29 @@
1
+ import { createRequire as __adfCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __adfFileURLToPath } from 'node:url';
3
+ import { dirname as __adfDirname } from 'node:path';
4
+ const require = __adfCreateRequire(import.meta.url);
5
+ const __filename = __adfFileURLToPath(import.meta.url);
6
+ const __dirname = __adfDirname(__filename);
7
+
8
+ // src/main/utils/secret-file.ts
9
+ import { execFileSync } from "node:child_process";
10
+ import { chmodSync } from "node:fs";
11
+ import { userInfo } from "node:os";
12
+ function restrictToCurrentUserWindows(path, run = (file, args) => {
13
+ execFileSync(file, args, { windowsHide: !0, stdio: ["ignore", "ignore", "pipe"] });
14
+ }) {
15
+ let user = process.env.USERDOMAIN && process.env.USERNAME ? `${process.env.USERDOMAIN}\\${process.env.USERNAME}` : userInfo().username;
16
+ run("icacls", [path, "/inheritance:r", "/grant:r", `${user}:F`]);
17
+ }
18
+ function protectSecretFile(path, opts = {}) {
19
+ try {
20
+ return (opts.platform ?? process.platform) === "win32" ? restrictToCurrentUserWindows(path, opts.run) : chmodSync(path, 384), !0;
21
+ } catch (err) {
22
+ return console.warn(`[SecretFile] Could not restrict ${path} to the current user: ${err instanceof Error ? err.message : String(err)}`), !1;
23
+ }
24
+ }
25
+
26
+ export {
27
+ restrictToCurrentUserWindows,
28
+ protectSecretFile
29
+ };