token-goat 2.9.29 → 2.9.30

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 (131) hide show
  1. package/README.md +34 -40
  2. package/SECURITY.md +28 -10
  3. package/THIRD_PARTY_NOTICES.md +40 -3
  4. package/dist/native/linux-arm64/tg-hook +0 -0
  5. package/dist/native/linux-x64/tg-hook +0 -0
  6. package/dist/ort-wasm-simd-threaded.mjs +59 -0
  7. package/dist/token-goat-chunk-3CHUNJ2O.mjs +53 -0
  8. package/dist/token-goat-chunk-3Z5S4KGM.mjs +918 -0
  9. package/dist/token-goat-chunk-4FVIAHSI.mjs +211 -0
  10. package/dist/{token-goat-chunk-PGTH2U4C.mjs → token-goat-chunk-4JJS54TR.mjs} +4 -3
  11. package/dist/token-goat-chunk-4LCCNRTG.mjs +313 -0
  12. package/dist/{token-goat-chunk-L7H3U27L.mjs → token-goat-chunk-54K3EUV3.mjs} +1 -1
  13. package/dist/token-goat-chunk-56EIMS3E.mjs +159 -0
  14. package/dist/token-goat-chunk-5BCIJXMO.mjs +609 -0
  15. package/dist/token-goat-chunk-5KDMCMF2.mjs +362 -0
  16. package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
  17. package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
  18. package/dist/{token-goat-chunk-GLXRTTLE.mjs → token-goat-chunk-64FBPDTK.mjs} +12 -8
  19. package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-664RTTUV.mjs} +28 -15
  20. package/dist/token-goat-chunk-67TQJ76B.mjs +57 -0
  21. package/dist/token-goat-chunk-6QMAS7AB.mjs +42 -0
  22. package/dist/token-goat-chunk-7BXSNBY5.mjs +253 -0
  23. package/dist/{token-goat-chunk-IVWI2OCK.mjs → token-goat-chunk-7F2UBPD3.mjs} +40 -11
  24. package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7IN2MKDS.mjs} +682 -501
  25. package/dist/token-goat-chunk-7NADEDKJ.mjs +124 -0
  26. package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-A3CK6N5Z.mjs} +618 -72
  27. package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-AFLYLHDH.mjs} +44 -31
  28. package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
  29. package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-APGZXSPS.mjs} +39 -146
  30. package/dist/{token-goat-chunk-D4ETHJD6.mjs → token-goat-chunk-ARDNEC2U.mjs} +9 -7
  31. package/dist/token-goat-chunk-ATCPY7EQ.mjs +134 -0
  32. package/dist/token-goat-chunk-B2RZZCSS.mjs +354 -0
  33. package/dist/{token-goat-chunk-BGYOZ6DO.mjs → token-goat-chunk-B45VMIIH.mjs} +6 -7
  34. package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
  35. package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-C63JQV5K.mjs} +45 -6
  36. package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-COBQGL5S.mjs} +2661 -2440
  37. package/dist/token-goat-chunk-COTXZHTS.mjs +39 -0
  38. package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-CYCEYAEO.mjs} +76 -16
  39. package/dist/token-goat-chunk-CZ3LUXYZ.mjs +4115 -0
  40. package/dist/{token-goat-chunk-ASLWOQ3I.mjs → token-goat-chunk-DZX2YDPT.mjs} +2 -1
  41. package/dist/token-goat-chunk-E3OQX2XT.mjs +824 -0
  42. package/dist/token-goat-chunk-EFHMMIGP.mjs +68 -0
  43. package/dist/token-goat-chunk-ETBHVDB6.mjs +328 -0
  44. package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
  45. package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
  46. package/dist/{token-goat-chunk-RTMVLHWX.mjs → token-goat-chunk-FBNQNSJK.mjs} +2555 -5127
  47. package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
  48. package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-FZ3NEW5O.mjs} +33 -19
  49. package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
  50. package/dist/{token-goat-chunk-DNRPXHYH.mjs → token-goat-chunk-GFBSN7BD.mjs} +29 -401
  51. package/dist/{token-goat-chunk-XYWPOSCN.mjs → token-goat-chunk-GOLEOXZP.mjs} +763 -211
  52. package/dist/token-goat-chunk-H2K3QP6H.mjs +24 -0
  53. package/dist/token-goat-chunk-H2PHHGM5.mjs +188 -0
  54. package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
  55. package/dist/token-goat-chunk-HG45AF2B.mjs +2228 -0
  56. package/dist/{token-goat-chunk-HUYUHODZ.mjs → token-goat-chunk-HOJLCGDP.mjs} +12965 -11748
  57. package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-HYBFA5X3.mjs} +118 -19
  58. package/dist/token-goat-chunk-IVALLT3S.mjs +48 -0
  59. package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-IVKIZWAB.mjs} +3 -3
  60. package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-JB6QN6VF.mjs} +6 -4
  61. package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-JDHE26RP.mjs} +10 -3
  62. package/dist/{token-goat-chunk-FTP4U4QA.mjs → token-goat-chunk-JDU3EXSU.mjs} +12 -11
  63. package/dist/token-goat-chunk-JDWCRD6M.mjs +253 -0
  64. package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-JN4XMLSD.mjs} +5 -1
  65. package/dist/token-goat-chunk-JTQQGXZH.mjs +733 -0
  66. package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
  67. package/dist/token-goat-chunk-KQNZDCBD.mjs +47 -0
  68. package/dist/{token-goat-chunk-2WOUYWLM.mjs → token-goat-chunk-KWPNJBDH.mjs} +27 -3
  69. package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-LOBGHXPB.mjs} +30 -8
  70. package/dist/token-goat-chunk-MKPF4CL5.mjs +37 -0
  71. package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
  72. package/dist/{token-goat-chunk-DNSPXQXQ.mjs → token-goat-chunk-N2NMER56.mjs} +25 -15
  73. package/dist/token-goat-chunk-NYKZLXMK.mjs +218 -0
  74. package/dist/token-goat-chunk-OJBNYTJP.mjs +3087 -0
  75. package/dist/token-goat-chunk-P4QMM4WK.mjs +295 -0
  76. package/dist/token-goat-chunk-PD5VKH46.mjs +184 -0
  77. package/dist/token-goat-chunk-PEPTHRFF.mjs +129 -0
  78. package/dist/{token-goat-chunk-NMBWLRHW.mjs → token-goat-chunk-PU7V3FD6.mjs} +8721 -11104
  79. package/dist/token-goat-chunk-PY533T7F.mjs +46 -0
  80. package/dist/token-goat-chunk-Q5VTGRH7.mjs +761 -0
  81. package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-QCLDAQTS.mjs} +31 -20
  82. package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-QSBRTGM2.mjs} +9 -2
  83. package/dist/{token-goat-chunk-VZQEWRVH.mjs → token-goat-chunk-RC35RBUL.mjs} +4 -4
  84. package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-RHXKCZX3.mjs} +873 -504
  85. package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-RZRTDST7.mjs} +17 -7
  86. package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-SJHWVNDQ.mjs} +15 -21
  87. package/dist/token-goat-chunk-SMVRN2HU.mjs +188 -0
  88. package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-SQSSNQPE.mjs} +2295 -1718
  89. package/dist/{token-goat-chunk-2AWQ2R5X.mjs → token-goat-chunk-T4FK7VOV.mjs} +2 -2
  90. package/dist/token-goat-chunk-U4N3BN2W.mjs +92 -0
  91. package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
  92. package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-UQ5UK2T7.mjs} +15 -4
  93. package/dist/token-goat-chunk-USILZ3T3.mjs +53 -0
  94. package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-VES7EL7O.mjs} +7 -1
  95. package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-VL3YIFHZ.mjs} +389 -14
  96. package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-VPBBTSJR.mjs} +356 -129
  97. package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-W3QCJS6G.mjs} +10 -2
  98. package/dist/{token-goat-chunk-LZNBQTDK.mjs → token-goat-chunk-WY3L4DVT.mjs} +11 -7
  99. package/dist/token-goat-chunk-XKI4SEMX.mjs +66 -0
  100. package/dist/token-goat-chunk-XU4P6Z24.mjs +133 -0
  101. package/dist/{token-goat-chunk-H5J3C56Q.mjs → token-goat-chunk-Y776AENC.mjs} +112 -26
  102. package/dist/token-goat-chunk-YARZFCZS.mjs +359 -0
  103. package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-Z44YO3QZ.mjs} +4 -0
  104. package/dist/token-goat-chunk-Z57YODA2.mjs +35 -0
  105. package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-ZCDTCVIS.mjs} +48 -29
  106. package/dist/token-goat-chunk-ZEJVMUQH.mjs +48 -0
  107. package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
  108. package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
  109. package/dist/{token-goat-chunk-PKRWMHVP.mjs → token-goat-chunk-ZQSJMO2R.mjs} +338 -170
  110. package/dist/token-goat-hook-client.cjs +87 -23
  111. package/dist/token-goat-hook-client.mjs +3 -3
  112. package/dist/token-goat-hook.mjs +46 -30
  113. package/dist/token-goat.core.mjs +6 -6
  114. package/docs/C4_RUNTIME_ARCHITECTURE.md +1 -1
  115. package/docs/cli.md +80 -46
  116. package/docs/install.md +47 -14
  117. package/docs/security.md +7 -7
  118. package/package.json +17 -7
  119. package/scripts/verify-native-dist.mjs +386 -0
  120. package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
  121. package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
  122. package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
  123. package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
  124. package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
  125. package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
  126. package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
  127. package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
  128. package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
  129. package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
  130. package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
  131. package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
@@ -1,5 +1,8 @@
1
1
  import { createRequire as __cjsRequire } from 'node:module';
2
2
  const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ KNOWN_HARNESS_NAMES
5
+ } from "./token-goat-chunk-U4N3BN2W.mjs";
3
6
  import {
4
7
  registerReset
5
8
  } from "./token-goat-chunk-YZAAZU2S.mjs";
@@ -16,95 +19,22 @@ import {
16
19
  decodeSource,
17
20
  extractErrorMessage,
18
21
  runGit
19
- } from "./token-goat-chunk-XYWPOSCN.mjs";
22
+ } from "./token-goat-chunk-GOLEOXZP.mjs";
20
23
  import {
21
24
  canonicalize,
22
25
  foldPath
23
- } from "./token-goat-chunk-TCQANXYC.mjs";
26
+ } from "./token-goat-chunk-AM5V6GSX.mjs";
24
27
  import {
25
28
  normalizeDarwinSystemAlias
26
- } from "./token-goat-chunk-NMTKNYGF.mjs";
29
+ } from "./token-goat-chunk-FNFBKLRD.mjs";
27
30
  import {
28
- ENV_KEYS,
29
31
  configPath,
30
32
  projectConfigPath
31
- } from "./token-goat-chunk-MELOKFDJ.mjs";
33
+ } from "./token-goat-chunk-VES7EL7O.mjs";
32
34
  import {
33
35
  init_define_import_meta_env
34
36
  } from "./token-goat-chunk-A37V4PBF.mjs";
35
37
 
36
- // src/bridges/registry.ts
37
- init_define_import_meta_env();
38
- var KNOWN_HARNESS_NAMES = /* @__PURE__ */ new Set([
39
- "claudecode",
40
- "codex",
41
- "opencode",
42
- "gemini",
43
- "hermes",
44
- "openclaw",
45
- "pi",
46
- "copilot_cli",
47
- "grok",
48
- "qwen",
49
- "kimi",
50
- "vscode",
51
- "visualstudio",
52
- "generic"
53
- ]);
54
- var relaySeededSessionIdValue;
55
- function setRelaySeededSessionId(id) {
56
- relaySeededSessionIdValue = id;
57
- }
58
- function relaySeededSessionId() {
59
- return relaySeededSessionIdValue;
60
- }
61
- function detectHarness() {
62
- const env = process.env;
63
- const override = (env[ENV_KEYS.HARNESS_OVERRIDE] ?? "").toLowerCase().trim();
64
- if (override && KNOWN_HARNESS_NAMES.has(override)) {
65
- return override;
66
- }
67
- if (env["HERMES_SESSION_ID"] || env["HERMES_HOME"]) {
68
- return "hermes";
69
- }
70
- if (env["TERM_PROGRAM"] === "claude-code" || env["CLAUDE_CODE_VERSION"] !== void 0 || env["CLAUDE_CODE_SESSION_ID"] && env["CLAUDE_CODE_SESSION_ID"] !== relaySeededSessionIdValue) {
71
- return "claudecode";
72
- }
73
- if (env["CODEX_SESSION_ID"] !== void 0 || env["CODEX_SESSION"]) {
74
- return "codex";
75
- }
76
- if (env["OPENCODE_SESSION_ID"] !== void 0 || env["OPENCODE_SESSION"]) {
77
- return "opencode";
78
- }
79
- if (env["GROK_SESSION_ID"] !== void 0) {
80
- return "grok";
81
- }
82
- if (env["OPENCLAW_SESSION_ID"] !== void 0) {
83
- return "openclaw";
84
- }
85
- if (env["ANTHROPIC_API_KEY"]) {
86
- return "claudecode";
87
- }
88
- if (env["OPENAI_API_KEY"] && !env["ANTHROPIC_API_KEY"]) {
89
- return "codex";
90
- }
91
- if ((env["GEMINI_API_KEY"] || env["GOOGLE_API_KEY"]) && !env["ANTHROPIC_API_KEY"]) {
92
- return "gemini";
93
- }
94
- return "generic";
95
- }
96
- var _cached = null;
97
- function getHarnessName() {
98
- if (_cached === null) {
99
- _cached = detectHarness();
100
- }
101
- return _cached;
102
- }
103
- function resetHarnessCache() {
104
- _cached = null;
105
- }
106
- registerReset(resetHarnessCache, { perRequest: true });
107
-
108
38
  // src/fingerprint.ts
109
39
  init_define_import_meta_env();
110
40
  import { createHash } from "node:crypto";
@@ -117,6 +47,14 @@ function fingerprintContent(content) {
117
47
  function shortFingerprint(content) {
118
48
  return fingerprintContent(content).slice(0, 16);
119
49
  }
50
+ function indexedFileIsGone(filePath) {
51
+ try {
52
+ return !fs.statSync(filePath).isFile();
53
+ } catch (err) {
54
+ const code = err?.code;
55
+ return code === "ENOENT" || code === "ENOTDIR";
56
+ }
57
+ }
120
58
  function fingerprintFile(filePath) {
121
59
  let data;
122
60
  try {
@@ -341,6 +279,7 @@ function resolveProjectRoot(opts) {
341
279
  // src/config_project.ts
342
280
  init_define_import_meta_env();
343
281
  import * as fs3 from "node:fs";
282
+ import * as path2 from "node:path";
344
283
 
345
284
  // node_modules/smol-toml/dist/index.js
346
285
  init_define_import_meta_env();
@@ -354,107 +293,14 @@ init_define_import_meta_env();
354
293
  // node_modules/smol-toml/dist/primitive.js
355
294
  init_define_import_meta_env();
356
295
 
357
- // node_modules/smol-toml/dist/date.js
358
- init_define_import_meta_env();
359
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
360
- var TomlDate = class _TomlDate extends Date {
361
- #hasDate = false;
362
- #hasTime = false;
363
- #offset = null;
364
- constructor(date) {
365
- let hasDate = true;
366
- let hasTime = true;
367
- let offset = "Z";
368
- if (typeof date === "string") {
369
- let match = date.match(DATE_TIME_RE);
370
- if (match) {
371
- if (!match[1]) {
372
- hasDate = false;
373
- date = `0000-01-01T${date}`;
374
- }
375
- hasTime = !!match[2];
376
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
377
- if (match[2] && +match[2] > 23) {
378
- date = "";
379
- } else {
380
- offset = match[3] || null;
381
- date = date.toUpperCase();
382
- if (!offset && hasTime)
383
- date += "Z";
384
- }
385
- } else {
386
- date = "";
387
- }
388
- }
389
- super(date);
390
- if (!isNaN(this.getTime())) {
391
- this.#hasDate = hasDate;
392
- this.#hasTime = hasTime;
393
- this.#offset = offset;
394
- }
395
- }
396
- isDateTime() {
397
- return this.#hasDate && this.#hasTime;
398
- }
399
- isLocal() {
400
- return !this.#hasDate || !this.#hasTime || !this.#offset;
401
- }
402
- isDate() {
403
- return this.#hasDate && !this.#hasTime;
404
- }
405
- isTime() {
406
- return this.#hasTime && !this.#hasDate;
407
- }
408
- isValid() {
409
- return this.#hasDate || this.#hasTime;
410
- }
411
- toISOString() {
412
- let iso = super.toISOString();
413
- if (this.isDate())
414
- return iso.slice(0, 10);
415
- if (this.isTime())
416
- return iso.slice(11, 23);
417
- if (this.#offset === null)
418
- return iso.slice(0, -1);
419
- if (this.#offset === "Z")
420
- return iso;
421
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
422
- offset = this.#offset[0] === "-" ? offset : -offset;
423
- let offsetDate = new Date(this.getTime() - offset * 6e4);
424
- return offsetDate.toISOString().slice(0, -1) + this.#offset;
425
- }
426
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
427
- let date = new _TomlDate(jsDate);
428
- date.#offset = offset;
429
- return date;
430
- }
431
- static wrapAsLocalDateTime(jsDate) {
432
- let date = new _TomlDate(jsDate);
433
- date.#offset = null;
434
- return date;
435
- }
436
- static wrapAsLocalDate(jsDate) {
437
- let date = new _TomlDate(jsDate);
438
- date.#hasTime = false;
439
- date.#offset = null;
440
- return date;
441
- }
442
- static wrapAsLocalTime(jsDate) {
443
- let date = new _TomlDate(jsDate);
444
- date.#hasDate = false;
445
- date.#offset = null;
446
- return date;
447
- }
448
- };
449
-
450
296
  // node_modules/smol-toml/dist/error.js
451
297
  init_define_import_meta_env();
452
298
  function getLineColFromPtr(string, ptr) {
453
- let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
299
+ let lines = string.slice(0, ptr).split(/\r?\n/);
454
300
  return [lines.length, lines.pop().length + 1];
455
301
  }
456
302
  function makeCodeBlock(string, line, column) {
457
- let lines = string.split(/\r\n|\n|\r/g);
303
+ let lines = string.split(/\r?\n/);
458
304
  let codeblock = "";
459
305
  let numberLen = (Math.log10(line + 1) | 0) + 1;
460
306
  for (let i = line - 1; i <= line + 1; i++) {
@@ -472,7 +318,7 @@ function makeCodeBlock(string, line, column) {
472
318
  }
473
319
  return codeblock;
474
320
  }
475
- var TomlError = class extends Error {
321
+ var TomlError = class _TomlError extends Error {
476
322
  line;
477
323
  column;
478
324
  codeblock;
@@ -486,70 +332,15 @@ ${codeblock}`, options);
486
332
  this.column = column;
487
333
  this.codeblock = codeblock;
488
334
  }
489
- };
490
-
491
- // node_modules/smol-toml/dist/util.js
492
- init_define_import_meta_env();
493
- function indexOfNewline(str, start = 0) {
494
- let idx = str.indexOf("\n", start);
495
- if (str.charCodeAt(idx - 1) === 13)
496
- idx--;
497
- return idx;
498
- }
499
- function skipComment(ctx) {
500
- for (; ctx.p < ctx.s.length; ctx.p++) {
501
- let c = ctx.s.charCodeAt(ctx.p);
502
- if (c === 10)
503
- break;
504
- if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
505
- ctx.p++;
506
- break;
507
- }
508
- if (c < 32 && c !== 9 || c === 127) {
509
- throw new TomlError("control characters are not allowed in comments", {
510
- toml: ctx.s,
511
- ptr: ctx.p
512
- });
513
- }
514
- }
515
- }
516
- function skipVoid(ctx, banNewLines, banComments) {
517
- let c;
518
- while (1) {
519
- while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
520
- ctx.p++;
521
- if (banComments || c !== 35)
522
- break;
523
- skipComment(ctx);
524
- }
525
- }
526
- function skipUntil(ctx, sep, end) {
527
- let ptr = ctx.p;
528
- if (!end) {
529
- ptr = indexOfNewline(ctx.s, ptr);
530
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
531
- return;
532
- }
533
- for (; ctx.p < ctx.s.length; ctx.p++) {
534
- let c = ctx.s.charCodeAt(ctx.p);
535
- if (c === 35) {
536
- skipComment(ctx);
537
- } else if (c === end || c === sep) {
538
- return;
539
- }
335
+ /** @internal */
336
+ static x(message, ctx, ptr) {
337
+ throw new _TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
540
338
  }
541
- throw new TomlError("cannot find end of structure", {
542
- toml: ctx.s,
543
- ptr
544
- });
545
- }
339
+ };
546
340
 
547
341
  // node_modules/smol-toml/dist/primitive.js
548
- var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
549
- var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
550
- var LEADING_ZERO = /^[+-]?0[0-9_]/;
551
342
  function parseString(ctx) {
552
- let start = ctx.p;
343
+ let startPtr = ctx.p;
553
344
  let c = ctx.s.charCodeAt(ctx.p++);
554
345
  let first = c;
555
346
  let isLiteral = c === 39;
@@ -568,10 +359,7 @@ function parseString(ctx) {
568
359
  if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
569
360
  state = state && 3;
570
361
  } else if (c < 32 && c !== 9 || c === 127) {
571
- throw new TomlError("control characters are not allowed in strings", {
572
- toml: ctx.s,
573
- ptr: ctx.p
574
- });
362
+ TomlError.x("control characters are not allowed in strings", ctx);
575
363
  } else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
576
364
  if (isMultiline) {
577
365
  if (ctx.s.charCodeAt(ctx.p + 3) === first)
@@ -579,8 +367,10 @@ function parseString(ctx) {
579
367
  if (ctx.s.charCodeAt(ctx.p + 3) === first)
580
368
  ctx.p++;
581
369
  }
582
- if (!state)
583
- parsed += ctx.s.slice(sliceStart, ctx.p);
370
+ if (!state) {
371
+ let s = ctx.s.slice(sliceStart, ctx.p);
372
+ parsed = parsed ? parsed + s : s;
373
+ }
584
374
  ctx.p += isMultiline ? 3 : 1;
585
375
  return parsed;
586
376
  } else if (!state) {
@@ -590,10 +380,11 @@ function parseString(ctx) {
590
380
  }
591
381
  } else if (state === 1) {
592
382
  if (c === 120 || c === 117 || c === 85) {
383
+ let errPtr = ctx.p++ - 1;
593
384
  let value = 0;
594
385
  let len = c === 120 ? 2 : c === 117 ? 4 : 8;
595
386
  for (let j = 0; j < len; j++, ctx.p++) {
596
- let hex = ctx.s.charCodeAt(ctx.p + 1);
387
+ let hex = ctx.s.charCodeAt(ctx.p);
597
388
  let digit = (
598
389
  /* 0-9 */
599
390
  hex >= 48 && hex <= 57 ? hex - 48 : (
@@ -605,16 +396,16 @@ function parseString(ctx) {
605
396
  )
606
397
  );
607
398
  if (digit < 0)
608
- throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
399
+ TomlError.x("invalid non-hex character in unicode escape", ctx);
609
400
  value = value << 4 | digit;
610
401
  }
611
402
  if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
612
- throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
403
+ TomlError.x("invalid unicode escape", ctx, errPtr);
613
404
  }
614
405
  parsed += String.fromCodePoint(value);
615
- sliceStart = ctx.p + 1;
406
+ sliceStart = ctx.p--;
616
407
  state = 0;
617
- } else if (c === 32 || c === 9) {
408
+ } else if (isMultiline && (c === 32 || c === 9)) {
618
409
  state = 2;
619
410
  } else {
620
411
  if (c === 98)
@@ -634,85 +425,154 @@ function parseString(ctx) {
634
425
  else if (c === 92)
635
426
  parsed += "\\";
636
427
  else
637
- throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
428
+ TomlError.x("unrecognised escape sequence", ctx);
638
429
  sliceStart = ctx.p + 1;
639
430
  state = 0;
640
431
  }
641
432
  } else if (c !== 32 && c !== 9) {
642
- if (state === 2) {
643
- throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
644
- toml: ctx.s,
645
- ptr: sliceStart
646
- });
647
- }
433
+ if (state === 2)
434
+ TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
648
435
  state = !isLiteral && c === 92 ? 1 : 0;
649
436
  sliceStart = ctx.p;
650
437
  }
651
438
  }
652
- throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
653
- }
654
- function sliceAndTrimEndOf(ctx, start, end) {
655
- let value = ctx.s.slice(start, end);
656
- let commentIdx = value.indexOf("#");
657
- if (commentIdx > 0) {
658
- skipComment({ s: value, p: commentIdx, d: 0 });
659
- value = value.slice(0, commentIdx);
660
- }
661
- return value.trimEnd();
662
- }
663
- function parseValue(ctx, integersAsBigInt, end) {
664
- let ptr = ctx.p;
665
- let err = { toml: ctx.s, ptr };
666
- skipUntil(ctx, 44, end);
667
- let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
668
- if (!value)
669
- throw new TomlError("incomplete declaration: value expected", err);
670
- if (value === "-inf")
671
- return -Infinity;
672
- if (value === "inf" || value === "+inf")
673
- return Infinity;
674
- if (value === "nan" || value === "+nan" || value === "-nan")
675
- return NaN;
676
- if (value === "-0")
677
- return integersAsBigInt ? 0n : 0;
678
- let isInt = INT_REGEX.test(value);
679
- if (isInt || FLOAT_REGEX.test(value)) {
680
- if (LEADING_ZERO.test(value)) {
681
- throw new TomlError("leading zeroes are not allowed", err);
682
- }
683
- value = value.replace(/_/g, "");
684
- let numeric = +value;
685
- if (isNaN(numeric)) {
686
- throw new TomlError("invalid number", err);
687
- }
688
- if (isInt) {
689
- if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
690
- throw new TomlError("integer value cannot be represented losslessly", err);
439
+ TomlError.x("unfinished string", ctx, startPtr);
440
+ }
441
+
442
+ // node_modules/smol-toml/dist/extract.js
443
+ init_define_import_meta_env();
444
+
445
+ // node_modules/smol-toml/dist/date.js
446
+ init_define_import_meta_env();
447
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
448
+ var TomlDate = class _TomlDate extends Date {
449
+ #hasDate = false;
450
+ #hasTime = false;
451
+ #offset = null;
452
+ constructor(date, fasttype, unsafeDelim) {
453
+ let hasDate = true;
454
+ let hasTime = true;
455
+ let offset = "Z";
456
+ let c;
457
+ if (typeof date === "string") {
458
+ if (fasttype)
459
+ prep: {
460
+ if (fasttype < 3) {
461
+ if (+date.slice(11, 13) > 23) {
462
+ date = "";
463
+ break prep;
464
+ }
465
+ if (fasttype === 2) {
466
+ offset = null;
467
+ date += "Z";
468
+ } else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
469
+ offset = date.slice(date.length - 6);
470
+ }
471
+ if (unsafeDelim)
472
+ date = date.slice(0, 10) + "T" + date.slice(11);
473
+ } else if (fasttype === 4) {
474
+ date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
475
+ }
476
+ hasDate = fasttype !== 4;
477
+ hasTime = fasttype !== 3;
478
+ }
479
+ else {
480
+ let match = date.match(DATE_TIME_RE);
481
+ if (match) {
482
+ if (!match[1]) {
483
+ hasDate = false;
484
+ date = `0000-01-01T${date}`;
485
+ }
486
+ hasTime = !!match[2];
487
+ hasTime && date[10] === " " && (date = date.replace(" ", "T"));
488
+ if (match[2] && +match[2] > 23) {
489
+ date = "";
490
+ } else {
491
+ offset = match[3] || null;
492
+ if (!offset && hasTime)
493
+ date += "Z";
494
+ }
495
+ } else {
496
+ date = "";
497
+ }
691
498
  }
692
- if (isInt || integersAsBigInt === true)
693
- numeric = BigInt(value);
694
499
  }
695
- return numeric;
500
+ super(date);
501
+ if (!isNaN(this.getTime())) {
502
+ this.#hasDate = hasDate;
503
+ this.#hasTime = hasTime;
504
+ this.#offset = offset;
505
+ }
696
506
  }
697
- const date = new TomlDate(value);
698
- if (!date.isValid())
699
- throw new TomlError("invalid value", err);
700
- return date;
701
- }
507
+ isDateTime() {
508
+ return this.#hasDate && this.#hasTime;
509
+ }
510
+ isLocal() {
511
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
512
+ }
513
+ isDate() {
514
+ return this.#hasDate && !this.#hasTime;
515
+ }
516
+ isTime() {
517
+ return this.#hasTime && !this.#hasDate;
518
+ }
519
+ isValid() {
520
+ return this.#hasDate || this.#hasTime;
521
+ }
522
+ toISOString() {
523
+ let iso = super.toISOString();
524
+ if (this.isDate())
525
+ return iso.slice(0, 10);
526
+ if (this.isTime())
527
+ return iso.slice(11, 23);
528
+ if (this.#offset === null)
529
+ return iso.slice(0, -1);
530
+ if (this.#offset === "Z" || this.#offset === "z")
531
+ return iso;
532
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
533
+ offset = this.#offset[0] === "-" ? offset : -offset;
534
+ let offsetDate = new Date(this.getTime() - offset * 6e4);
535
+ return offsetDate.toISOString().slice(0, -1) + this.#offset;
536
+ }
537
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
538
+ let date = new _TomlDate(jsDate);
539
+ date.#offset = offset;
540
+ return date;
541
+ }
542
+ static wrapAsLocalDateTime(jsDate) {
543
+ let date = new _TomlDate(jsDate);
544
+ date.#offset = null;
545
+ return date;
546
+ }
547
+ static wrapAsLocalDate(jsDate) {
548
+ let date = new _TomlDate(jsDate);
549
+ date.#hasTime = false;
550
+ date.#offset = null;
551
+ return date;
552
+ }
553
+ static wrapAsLocalTime(jsDate) {
554
+ let date = new _TomlDate(jsDate);
555
+ date.#hasDate = false;
556
+ date.#offset = null;
557
+ return date;
558
+ }
559
+ };
702
560
 
703
561
  // node_modules/smol-toml/dist/extract.js
704
- init_define_import_meta_env();
705
- function extractValue(ctx, end, integersAsBigInt) {
706
- let ptr = ctx.p;
707
- let c = ctx.s.charCodeAt(ptr);
562
+ function isDigit(char, base = 10) {
563
+ return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
564
+ }
565
+ function isEndOfValue(char, delim) {
566
+ return char === 32 || char === 9 || char === 10 || char === 13 || // Structure end or next value delimiter
567
+ delim && (char === delim || char === 44) || // Comment
568
+ char === 35;
569
+ }
570
+ function extractValue(ctx, end) {
571
+ let errPtr = ctx.p;
572
+ let c = ctx.s.charCodeAt(ctx.p);
708
573
  if (c === 91 || c === 123) {
709
- if (!ctx.d--) {
710
- throw new TomlError("document contains excessively nested structures. aborting.", {
711
- toml: ctx.s,
712
- ptr
713
- });
714
- }
715
- let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
574
+ ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
575
+ let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
716
576
  ctx.d++;
717
577
  return value;
718
578
  }
@@ -721,90 +581,263 @@ function extractValue(ctx, end, integersAsBigInt) {
721
581
  }
722
582
  if (c === 116) {
723
583
  if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
724
- throw new TomlError("invalid value", { toml: ctx.s, ptr });
725
- ctx.p++;
726
- return true;
584
+ TomlError.x("invalid value", ctx, errPtr);
585
+ return ctx.p++, true;
727
586
  }
728
587
  if (c === 102) {
729
588
  if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
730
- throw new TomlError("invalid value", { toml: ctx.s, ptr });
731
- ctx.p++;
732
- return false;
589
+ TomlError.x("invalid value", ctx, errPtr);
590
+ return ctx.p++, false;
591
+ }
592
+ if (c === 43 || c === 45) {
593
+ return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
594
+ }
595
+ if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
596
+ return parseDate(ctx, c, end);
597
+ }
598
+ if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
599
+ return parseTime(ctx, c, end);
600
+ }
601
+ return parseNumber(ctx, ctx.p, c, 0, end);
602
+ }
603
+ function parseNumber(ctx, startPtr, startChr, sign, endChr) {
604
+ let c = startChr;
605
+ let state = 0;
606
+ let hasUnderscores = false;
607
+ if (c === 105) {
608
+ if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
609
+ TomlError.x("invalid value", ctx, startPtr);
610
+ return ctx.p++, (sign || 1) / 0;
611
+ }
612
+ if (c === 110) {
613
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
614
+ TomlError.x("invalid value", ctx, startPtr);
615
+ return ctx.p++, NaN;
616
+ }
617
+ if (c === 48) {
618
+ if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
619
+ return ctx.bi === true ? 0n : 0;
620
+ if (!sign) {
621
+ if (c === 120)
622
+ return parseIntegerBaseN(ctx, startPtr, 16, endChr);
623
+ else if (c === 98)
624
+ return parseIntegerBaseN(ctx, startPtr, 2, endChr);
625
+ else if (c === 111)
626
+ return parseIntegerBaseN(ctx, startPtr, 8, endChr);
627
+ }
628
+ if (c === 46)
629
+ state = 2;
630
+ else if (c === 101 || c === 69)
631
+ state = 4;
632
+ else
633
+ TomlError.x("illegal leading zero", ctx, startPtr);
634
+ } else if (!isDigit(c))
635
+ TomlError.x("invalid value", ctx, startPtr);
636
+ while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
637
+ if (!state)
638
+ state = 1;
639
+ if (c === 95) {
640
+ if (!(state & 1))
641
+ TomlError.x("illegal underscore", ctx);
642
+ state += 11;
643
+ hasUnderscores = true;
644
+ } else if (state === 1 && c === 46)
645
+ state = 2;
646
+ else if ((state === 1 || state === 3) && (c === 101 || c === 69))
647
+ state = 4;
648
+ else if (state === 4 && (c === 43 || c === 45)) {
649
+ } else if (!isDigit(c))
650
+ TomlError.x(`illegal character in numeric literal`, ctx);
651
+ else if (state > 9)
652
+ state -= 11;
653
+ else if (!(state & 1))
654
+ state++;
655
+ }
656
+ if (!state) {
657
+ let val = (startChr - 48) * (sign || 1);
658
+ return ctx.bi === true ? BigInt(val) : val;
659
+ }
660
+ if (!(state & 1))
661
+ TomlError.x("unfinished numeric value", ctx, startPtr);
662
+ let str = ctx.s.slice(startPtr, ctx.p);
663
+ if (hasUnderscores)
664
+ str = str.replaceAll("_", "");
665
+ return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
666
+ }
667
+ function parseIntegerBaseN(ctx, startPtr, base, endChr) {
668
+ let c, underscore = 1;
669
+ while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
670
+ if (c === 95) {
671
+ if (underscore & 1)
672
+ TomlError.x("illegal underscore", ctx);
673
+ underscore = 3;
674
+ } else if (!isDigit(c, base))
675
+ TomlError.x(`illegal character in numeric literal`, ctx);
676
+ else if (underscore & 1)
677
+ underscore--;
678
+ }
679
+ if (underscore & 1)
680
+ TomlError.x("unfinished numeric value", ctx);
681
+ let str = ctx.s.slice(startPtr + 2, ctx.p);
682
+ if (underscore)
683
+ str = str.replaceAll("_", "");
684
+ return parseInteger(ctx, str, base, startPtr);
685
+ }
686
+ function parseInteger(ctx, str, base, startPtr) {
687
+ if (ctx.bi !== true)
688
+ int: {
689
+ let val = parseInt(str, base);
690
+ if (!Number.isSafeInteger(val)) {
691
+ if (ctx.bi)
692
+ break int;
693
+ TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
694
+ }
695
+ return val;
696
+ }
697
+ return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
698
+ }
699
+ function parseDate(ctx, c, endChr) {
700
+ let startPtr = ctx.p++, unsafeSeparator;
701
+ if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
702
+ return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
703
+ }
704
+ ctx.p += 5;
705
+ if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
706
+ TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
707
+ if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
708
+ let t2 = ctx.s.slice(startPtr, ctx.p);
709
+ return readDate(ctx, t2, 3, false, startPtr);
710
+ }
711
+ if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
712
+ TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
713
+ if (ctx.s.charCodeAt(ctx.p += 3) === 58)
714
+ ctx.p += 3;
715
+ if (ctx.s.charCodeAt(ctx.p) === 46)
716
+ while (isDigit(ctx.s.charCodeAt(++ctx.p)))
717
+ ;
718
+ if (c = ctx.s.charCodeAt(ctx.p)) {
719
+ if (c === 90 || c === 122) {
720
+ let t2 = ctx.s.slice(startPtr, ++ctx.p);
721
+ return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
722
+ }
723
+ if (c === 43 || c === 45) {
724
+ let t2 = ctx.s.slice(startPtr, ctx.p += 6);
725
+ return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
726
+ }
727
+ }
728
+ let t = ctx.s.slice(startPtr, ctx.p);
729
+ return readDate(ctx, t, 2, unsafeSeparator, startPtr);
730
+ }
731
+ function parseTime(ctx, c, endChr) {
732
+ let start = ctx.p;
733
+ if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
734
+ return parseNumber(ctx, --ctx.p, c, 0, endChr);
735
+ }
736
+ if (ctx.s.charCodeAt(ctx.p += 4) === 58)
737
+ ctx.p += 3;
738
+ if (ctx.s.charCodeAt(ctx.p) === 46)
739
+ while (isDigit(ctx.s.charCodeAt(++ctx.p)))
740
+ ;
741
+ let t = ctx.s.slice(start, ctx.p);
742
+ return readDate(ctx, t, 4, false, start);
743
+ }
744
+ function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
745
+ if (ctx.ld) {
746
+ let date = new TomlDate(str, type, unsafeDelim);
747
+ if (!date.isValid())
748
+ TomlError.x("invalid date", ctx, errPtr);
749
+ return date;
750
+ }
751
+ try {
752
+ if (temporalSuffix)
753
+ str += temporalSuffix;
754
+ switch (type) {
755
+ case 1:
756
+ return Temporal.ZonedDateTime.from(str);
757
+ case 2:
758
+ return Temporal.PlainDateTime.from(str);
759
+ case 3:
760
+ return Temporal.PlainDate.from(str);
761
+ case 4:
762
+ return Temporal.PlainTime.from(str);
763
+ }
764
+ } catch (e) {
765
+ TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
766
+ }
767
+ }
768
+
769
+ // node_modules/smol-toml/dist/util.js
770
+ init_define_import_meta_env();
771
+ function skipComment(ctx) {
772
+ for (; ctx.p < ctx.s.length; ctx.p++) {
773
+ let c = ctx.s.charCodeAt(ctx.p);
774
+ if (c === 10)
775
+ break;
776
+ if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
777
+ ctx.p++;
778
+ break;
779
+ }
780
+ if (c < 32 && c !== 9 || c === 127) {
781
+ TomlError.x("control characters are not allowed in comments", ctx);
782
+ }
783
+ }
784
+ }
785
+ function skipVoid(ctx, banNewLines, banComments) {
786
+ let c;
787
+ while (ctx.p < ctx.s.length) {
788
+ while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
789
+ ctx.p++;
790
+ if (banComments || c !== 35)
791
+ break;
792
+ skipComment(ctx);
733
793
  }
734
- return parseValue(ctx, integersAsBigInt, end);
735
794
  }
736
795
 
737
796
  // node_modules/smol-toml/dist/struct.js
738
- var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
739
- function parseKey(ctx, end = "=") {
740
- let start = ctx.p;
741
- let dot = start - 1;
797
+ function parseKey(ctx, end = 61) {
798
+ let startPtr;
799
+ let state = 0;
742
800
  let parsed = [];
743
- let endPtr = ctx.s.indexOf(end, start);
744
- if (endPtr < 0) {
745
- throw new TomlError("incomplete key-value: cannot find end of key", {
746
- toml: ctx.s,
747
- ptr: start
748
- });
749
- }
801
+ let sliceStart;
802
+ let c = ctx.s.charCodeAt(startPtr = ctx.p);
750
803
  do {
751
- let c = ctx.s.charCodeAt(ctx.p = ++dot);
752
- if (c !== 32 && c !== 9) {
753
- if (c === 34 || c === 39) {
754
- if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
755
- throw new TomlError("multiline strings are not allowed in keys", {
756
- toml: ctx.s,
757
- ptr: ctx.p
758
- });
759
- }
760
- let part = parseString(ctx);
761
- dot = ctx.s.indexOf(".", ctx.p);
762
- let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
763
- let newLine = indexOfNewline(strEnd);
764
- if (newLine > -1) {
765
- throw new TomlError("newlines are not allowed in keys", {
766
- toml: ctx.s,
767
- ptr: newLine
768
- });
769
- }
770
- if (strEnd.trimStart()) {
771
- throw new TomlError("found extra tokens after the string part", {
772
- toml: ctx.s,
773
- ptr: ctx.p
774
- });
775
- }
776
- if (endPtr < ctx.p) {
777
- endPtr = ctx.s.indexOf(end, ctx.p);
778
- if (endPtr < 0) {
779
- throw new TomlError("incomplete key-value: cannot find end of key", {
780
- toml: ctx.s,
781
- ptr: start
782
- });
783
- }
784
- }
785
- parsed.push(part);
786
- } else {
787
- dot = ctx.s.indexOf(".", ctx.p);
788
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
789
- if (!KEY_PART_RE.test(part)) {
790
- throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
791
- toml: ctx.s,
792
- ptr: ctx.p
793
- });
794
- }
795
- parsed.push(part.trimEnd());
804
+ if (c === end) {
805
+ if (!state)
806
+ TomlError.x("unexpected end of key", ctx);
807
+ if (state === 1)
808
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
809
+ return ctx.p++, parsed;
810
+ } else if (c === 46) {
811
+ if (!state)
812
+ TomlError.x("illegal empty bare key", ctx);
813
+ if (state === 1)
814
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
815
+ state = 0;
816
+ } else if (!state && (c === 34 || c === 39)) {
817
+ if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
818
+ TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
819
+ parsed.push(parseString(ctx));
820
+ state = 2;
821
+ ctx.p--;
822
+ } else if (c === 32 || c === 9) {
823
+ if (state === 1) {
824
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
825
+ state = 2;
796
826
  }
827
+ } else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
828
+ TomlError.x("illegal character in key", ctx);
829
+ } else if (!state) {
830
+ state = 1;
831
+ sliceStart = ctx.p;
797
832
  }
798
- } while (dot + 1 && dot < endPtr);
799
- ctx.p = endPtr + 1;
800
- skipVoid(ctx, true, true);
801
- return parsed;
833
+ } while (c = ctx.s.charCodeAt(++ctx.p));
834
+ TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
802
835
  }
803
- function parseInlineTable(ctx, integersAsBigInt) {
804
- let res = {};
836
+ function parseInlineTable(ctx) {
837
+ let startPtr = ctx.p++;
838
+ let res = /* @__PURE__ */ Object.create(null);
805
839
  let seen = /* @__PURE__ */ new Set();
806
840
  let c;
807
- ctx.p++;
808
841
  while (ctx.p < ctx.s.length) {
809
842
  skipVoid(ctx);
810
843
  if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
@@ -814,70 +847,71 @@ function parseInlineTable(ctx, integersAsBigInt) {
814
847
  let k;
815
848
  let t = res;
816
849
  let hasOwn = false;
817
- let p = ctx.p;
850
+ let errPtr = ctx.p;
818
851
  let key = parseKey(ctx);
819
852
  for (let i = 0; i < key.length; i++) {
820
853
  if (i)
821
- t = hasOwn ? t[k] : t[k] = {};
854
+ t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
822
855
  k = key[i];
823
856
  if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
824
- throw new TomlError("trying to redefine an already defined value", {
825
- toml: ctx.s,
826
- ptr: p
827
- });
857
+ TomlError.x("trying to redefine an already defined value", ctx, errPtr);
858
+ }
859
+ let unsafe = k === "__proto__";
860
+ if (ctx.uk && (unsafe || k === "constructor")) {
861
+ t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
862
+ break;
828
863
  }
829
- if (!hasOwn && k === "__proto__") {
864
+ if (!hasOwn && unsafe) {
830
865
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
831
866
  }
832
867
  }
833
868
  if (hasOwn) {
834
- throw new TomlError("trying to redefine an already defined value", {
835
- toml: ctx.s,
836
- ptr: ctx.p
837
- });
869
+ TomlError.x("trying to redefine an already defined value", ctx, errPtr);
838
870
  }
839
- let value = extractValue(ctx, 125, integersAsBigInt);
840
- seen.add(t[k] = value);
871
+ skipVoid(ctx, true, true);
872
+ let value = extractValue(
873
+ ctx,
874
+ 125
875
+ /* } */
876
+ );
877
+ if (t && typeof (t[k] = value) === "object")
878
+ seen.add(value);
841
879
  skipVoid(ctx);
842
880
  if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
843
881
  return res;
844
882
  }
845
- if (c !== 44) {
846
- throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
847
- }
883
+ if (c !== 44)
884
+ TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
848
885
  }
849
- throw new TomlError("unfinished table encountered", {
850
- toml: ctx.s,
851
- ptr: ctx.p
852
- });
886
+ TomlError.x("unfinished table", ctx, startPtr);
853
887
  }
854
- function parseArray(ctx, integersAsBigInt) {
888
+ function parseArray(ctx) {
889
+ let startPtr = ctx.p++;
855
890
  let res = [];
856
891
  let c;
857
- ctx.p++;
858
892
  while (ctx.p < ctx.s.length) {
859
893
  skipVoid(ctx);
860
894
  if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
861
895
  ctx.p++;
862
896
  return res;
863
897
  }
864
- res.push(extractValue(ctx, 93, integersAsBigInt));
898
+ res.push(extractValue(
899
+ ctx,
900
+ 93
901
+ /* ] */
902
+ ));
865
903
  skipVoid(ctx);
866
904
  if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
867
905
  return res;
868
906
  }
869
- if (c !== 44) {
870
- throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
871
- }
907
+ if (c !== 44)
908
+ TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
872
909
  }
873
- throw new TomlError("unfinished array encountered", {
874
- toml: ctx.s,
875
- ptr: ctx.p
876
- });
910
+ TomlError.x("unfinished array", ctx, startPtr);
877
911
  }
878
912
 
879
913
  // node_modules/smol-toml/dist/parse.js
880
- function peekTable(key, table, meta, type) {
914
+ function peekTable(ctx, key, table, meta, type) {
881
915
  let t = table;
882
916
  let m = meta;
883
917
  let k;
@@ -885,7 +919,7 @@ function peekTable(key, table, meta, type) {
885
919
  let state;
886
920
  for (let i = 0; i < key.length; i++) {
887
921
  if (i) {
888
- t = hasOwn ? t[k] : t[k] = {};
922
+ t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
889
923
  m = (state = m[k]).c;
890
924
  if (type === 0 && (state.t === 1 || state.t === 2)) {
891
925
  return null;
@@ -901,7 +935,10 @@ function peekTable(key, table, meta, type) {
901
935
  return null;
902
936
  }
903
937
  if (!hasOwn) {
904
- if (k === "__proto__") {
938
+ let unsafe = k === "__proto__";
939
+ if (ctx.uk && (unsafe || k === "constructor"))
940
+ return false;
941
+ if (unsafe) {
905
942
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
906
943
  Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
907
944
  }
@@ -909,7 +946,7 @@ function peekTable(key, table, meta, type) {
909
946
  t: i < key.length - 1 && type === 2 ? 3 : type,
910
947
  d: false,
911
948
  i: 0,
912
- c: {}
949
+ c: /* @__PURE__ */ Object.create(null)
913
950
  };
914
951
  }
915
952
  }
@@ -922,43 +959,60 @@ function peekTable(key, table, meta, type) {
922
959
  state.d = true;
923
960
  t[k] = [];
924
961
  }
925
- t[k].push(t = {});
926
- state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
962
+ t[k].push(t = /* @__PURE__ */ Object.create(null));
963
+ state.c[state.i++] = state = { t: 1, d: false, i: 0, c: /* @__PURE__ */ Object.create(null) };
927
964
  }
928
965
  if (state.d) {
929
966
  return null;
930
967
  }
931
968
  state.d = true;
932
969
  if (type === 1) {
933
- t = hasOwn ? t[k] : t[k] = {};
970
+ t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
934
971
  } else if (type === 0 && hasOwn) {
935
972
  return null;
936
973
  }
937
974
  return [k, t, state.c];
938
975
  }
939
- function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
940
- let ctx = { s: toml, p: 0, d: maxDepth };
941
- let res = {};
942
- let meta = {};
976
+ function validateTablePeek(ctx, peek, ptr) {
977
+ if (peek === null || ctx.uk === 2)
978
+ TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
979
+ }
980
+ function parse(toml, options = {}) {
981
+ let ctx = {
982
+ s: toml,
983
+ p: 0,
984
+ d: options.maxDepth ?? 1e3,
985
+ bi: options.integersAsBigInt ?? false,
986
+ ld: options.useLegacyDate ?? true,
987
+ uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
988
+ };
989
+ let res = /* @__PURE__ */ Object.create(null);
990
+ let meta = /* @__PURE__ */ Object.create(null);
943
991
  let tmp;
992
+ let skipping = false;
944
993
  let tbl = res;
945
994
  let m = meta;
995
+ if (toml.charCodeAt(0) === 65279)
996
+ ctx.p++;
946
997
  skipVoid(ctx);
947
998
  while (ctx.p < toml.length) {
948
999
  if (toml.charCodeAt(ctx.p) === 91) {
949
1000
  let isTableArray = toml.charCodeAt(++ctx.p) === 91;
950
1001
  tmp = ctx.p += +isTableArray;
951
- let k = parseKey(ctx, "]");
1002
+ skipping = false;
1003
+ let k = parseKey(
1004
+ ctx,
1005
+ 93
1006
+ /* ] */
1007
+ );
952
1008
  if (isTableArray) {
953
- if (toml.charCodeAt(ctx.p - 1) !== 93) {
954
- throw new TomlError("expected end of table declaration", {
955
- toml,
956
- ptr: ctx.p - 1
957
- });
1009
+ if (toml.charCodeAt(ctx.p) !== 93) {
1010
+ TomlError.x("expected end of table array declaration", ctx);
958
1011
  }
959
1012
  ctx.p++;
960
1013
  }
961
1014
  let p = peekTable(
1015
+ ctx,
962
1016
  k,
963
1017
  res,
964
1018
  meta,
@@ -966,37 +1020,33 @@ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
966
1020
  /* Type.EXPLICIT */
967
1021
  );
968
1022
  if (!p) {
969
- throw new TomlError("trying to redefine an already defined table or value", {
970
- toml,
971
- ptr: tmp
972
- });
1023
+ validateTablePeek(ctx, p, tmp);
1024
+ skipping = true;
1025
+ } else {
1026
+ m = p[2];
1027
+ tbl = p[1];
973
1028
  }
974
- m = p[2];
975
- tbl = p[1];
976
1029
  } else {
977
1030
  tmp = ctx.p;
978
1031
  let k = parseKey(ctx);
979
1032
  let p = peekTable(
1033
+ ctx,
980
1034
  k,
981
1035
  tbl,
982
1036
  m,
983
1037
  0
984
1038
  /* Type.DOTTED */
985
1039
  );
986
- if (!p) {
987
- throw new TomlError("trying to redefine an already defined table or value", {
988
- toml,
989
- ptr: tmp
990
- });
991
- }
992
- p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
1040
+ if (!p && !skipping)
1041
+ validateTablePeek(ctx, p, tmp);
1042
+ skipVoid(ctx, true, true);
1043
+ let v = extractValue(ctx, void 0);
1044
+ if (p && !skipping)
1045
+ p[1][p[0]] = v;
993
1046
  }
994
1047
  skipVoid(ctx, true);
995
- if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
996
- throw new TomlError("each key-value declaration must be followed by an end-of-line", {
997
- toml,
998
- ptr: ctx.p
999
- });
1048
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
1049
+ TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
1000
1050
  }
1001
1051
  skipVoid(ctx);
1002
1052
  }
@@ -1006,16 +1056,27 @@ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
1006
1056
  // node_modules/smol-toml/dist/stringify.js
1007
1057
  init_define_import_meta_env();
1008
1058
  var BARE_KEY = /^[a-z0-9-_]+$/i;
1059
+ var HAS_WELLFORMED = !!"".isWellFormed;
1009
1060
  function extendedTypeOf(obj) {
1010
1061
  let type = typeof obj;
1011
1062
  if (type === "object") {
1012
1063
  if (Array.isArray(obj))
1013
1064
  return "array";
1014
- if (typeof obj?.getUTCDate === "function" && obj instanceof Date)
1065
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date)
1015
1066
  return "date";
1016
- if (globalThis.Temporal && // check for the 'since' property as an early bailout that avoids running all 5 instanceof checks
1017
- typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) {
1018
- return "temporal";
1067
+ if (globalThis.Temporal) {
1068
+ if (obj.until) {
1069
+ if (obj instanceof Temporal.ZonedDateTime)
1070
+ return "temporal/tz+uc";
1071
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate)
1072
+ return "temporal/uc";
1073
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant)
1074
+ return "temporal";
1075
+ if (obj instanceof Temporal.PlainYearMonth)
1076
+ return "temporal/x";
1077
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) {
1078
+ return "temporal/x";
1079
+ }
1019
1080
  }
1020
1081
  }
1021
1082
  return type;
@@ -1027,16 +1088,20 @@ function isArrayOfTables(obj) {
1027
1088
  }
1028
1089
  return obj.length != 0;
1029
1090
  }
1091
+ function formatWellFormedStringUnchecked(s) {
1092
+ return JSON.stringify(s).replaceAll("\x7F", "\\u007f");
1093
+ }
1030
1094
  function formatString(s) {
1031
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
1095
+ return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
1032
1096
  }
1033
- function stringifyTemporal(temporal) {
1034
- return temporal.toString({
1035
- calendarName: "never",
1036
- timeZoneName: "never"
1037
- });
1097
+ function formatKey(s) {
1098
+ if (BARE_KEY.test(s))
1099
+ return s;
1100
+ if (HAS_WELLFORMED && !s.isWellFormed())
1101
+ throw new RangeError("key contains illegal lone surrogates");
1102
+ return formatWellFormedStringUnchecked(s);
1038
1103
  }
1039
- function stringifyValue(val, type, depth, numberAsFloat) {
1104
+ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
1040
1105
  if (depth === 0) {
1041
1106
  throw new Error("Could not stringify the object: maximum object depth exceeded");
1042
1107
  }
@@ -1053,6 +1118,7 @@ function stringifyValue(val, type, depth, numberAsFloat) {
1053
1118
  return val.toFixed(1);
1054
1119
  case "bigint":
1055
1120
  case "boolean":
1121
+ case "temporal":
1056
1122
  return val.toString();
1057
1123
  case "string":
1058
1124
  return formatString(val);
@@ -1061,14 +1127,37 @@ function stringifyValue(val, type, depth, numberAsFloat) {
1061
1127
  throw new TypeError("cannot serialize invalid date");
1062
1128
  return val.toISOString();
1063
1129
  case "object":
1064
- return stringifyInlineTable(val, depth, numberAsFloat);
1130
+ return stringifyInlineTable(val, depth, numberAsFloat, strictTemporal);
1065
1131
  case "array":
1066
- return stringifyArray(val, depth, numberAsFloat);
1067
- case "temporal":
1068
- return stringifyTemporal(val);
1132
+ return stringifyArray(val, depth, numberAsFloat, strictTemporal);
1133
+ // @ts-expect-error -- intentional fallthrough case
1134
+ case "temporal/tz+uc":
1135
+ if (strictTemporal) {
1136
+ let tz = val.timeZoneId;
1137
+ let tzc = tz.charCodeAt(0);
1138
+ if (
1139
+ // Classic offset
1140
+ tzc !== 43 && tzc !== 45 && // Fast pre-check pass; see below for the actually accepted values
1141
+ (tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || // UTC and its aliases; Temporal implementations don't all canonicalise unfortunately
1142
+ tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && // GMT is a TZ but it's for all intents and purposes equivalent to UTC. Safe to downgrade.
1143
+ !tz.startsWith("GMT") && tz !== "Greenwich" && // Etc/* are all safe to downgrade to offset (either UTC, GMT, or offset)
1144
+ !tz.startsWith("Etc/"))
1145
+ ) {
1146
+ throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
1147
+ }
1148
+ }
1149
+ case "temporal/uc":
1150
+ if (strictTemporal && val.calendarId !== "iso8601")
1151
+ throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
1152
+ return val.toString({
1153
+ calendarName: "never",
1154
+ timeZoneName: "never"
1155
+ });
1156
+ case "temporal/x":
1157
+ throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
1069
1158
  }
1070
1159
  }
1071
- function stringifyInlineTable(obj, depth, numberAsFloat) {
1160
+ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
1072
1161
  let keys = Object.keys(obj);
1073
1162
  if (keys.length === 0)
1074
1163
  return "{}";
@@ -1077,13 +1166,11 @@ function stringifyInlineTable(obj, depth, numberAsFloat) {
1077
1166
  let k = keys[i];
1078
1167
  if (i)
1079
1168
  res += ", ";
1080
- res += BARE_KEY.test(k) ? k : formatString(k);
1081
- res += " = ";
1082
- res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
1169
+ res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat, strictTemporal);
1083
1170
  }
1084
1171
  return res + " }";
1085
1172
  }
1086
- function stringifyArray(array, depth, numberAsFloat) {
1173
+ function stringifyArray(array, depth, numberAsFloat, strictTemporal) {
1087
1174
  if (array.length === 0)
1088
1175
  return "[]";
1089
1176
  let res = "[ ";
@@ -1093,11 +1180,11 @@ function stringifyArray(array, depth, numberAsFloat) {
1093
1180
  if (array[i] === null || array[i] === void 0) {
1094
1181
  throw new TypeError("arrays cannot contain null or undefined values");
1095
1182
  }
1096
- res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
1183
+ res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat, strictTemporal);
1097
1184
  }
1098
1185
  return res + " ]";
1099
1186
  }
1100
- function stringifyArrayTable(array, key, depth, numberAsFloat) {
1187
+ function stringifyArrayTable(array, key, depth, numberAsFloat, strictTemporal) {
1101
1188
  if (depth === 0) {
1102
1189
  throw new Error("Could not stringify the object: maximum object depth exceeded");
1103
1190
  }
@@ -1105,11 +1192,11 @@ function stringifyArrayTable(array, key, depth, numberAsFloat) {
1105
1192
  for (let i = 0; i < array.length; i++) {
1106
1193
  res += `${res && "\n"}[[${key}]]
1107
1194
  `;
1108
- res += stringifyTable(0, array[i], key, depth, numberAsFloat);
1195
+ res += stringifyTable(0, array[i], key, depth, numberAsFloat, strictTemporal);
1109
1196
  }
1110
1197
  return res;
1111
1198
  }
1112
- function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
1199
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
1113
1200
  if (depth === 0) {
1114
1201
  throw new Error("Could not stringify the object: maximum object depth exceeded");
1115
1202
  }
@@ -1123,16 +1210,16 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
1123
1210
  if (type === "symbol" || type === "function") {
1124
1211
  throw new TypeError(`cannot serialize values of type '${type}'`);
1125
1212
  }
1126
- let key = BARE_KEY.test(k) ? k : formatString(k);
1213
+ let key = formatKey(k);
1127
1214
  if (type === "array" && isArrayOfTables(obj[k])) {
1128
- tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
1215
+ tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
1129
1216
  } else if (type === "object") {
1130
1217
  let tblKey = prefix ? `${prefix}.${key}` : key;
1131
- tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
1218
+ tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
1132
1219
  } else {
1133
1220
  preamble += key;
1134
1221
  preamble += " = ";
1135
- preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
1222
+ preamble += stringifyValue(obj[k], type, depth, numberAsFloat, strictTemporal);
1136
1223
  preamble += "\n";
1137
1224
  }
1138
1225
  }
@@ -1143,11 +1230,11 @@ ${preamble}` : `[${tableKey}]`;
1143
1230
  return preamble && tables ? `${preamble}
1144
1231
  ${tables}` : preamble || tables;
1145
1232
  }
1146
- function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
1233
+ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
1147
1234
  if (extendedTypeOf(obj) !== "object") {
1148
1235
  throw new TypeError("stringify can only be called with an object");
1149
1236
  }
1150
- let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
1237
+ let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
1151
1238
  if (str[str.length - 1] !== "\n")
1152
1239
  return str + "\n";
1153
1240
  return str;
@@ -1180,6 +1267,7 @@ var PROJECT_LOCKED_KEYS = [
1180
1267
  // The same principle as the four fold keys above, applied one layer earlier and with a wider blast radius: those decide how much of an indexed file is shown, these decide whether it is indexed at all. A checked-in `.token-goat.toml` adding its own attack surface to `skip_dirs` -- or dropping `large_file_skip_kb` to a handful of kilobytes -- removes those files from `symbol`, `read`, `refs`, `semantic` and `graph` for a reviewing agent, and every one of them then answers "not found" in the same words it uses for a name that genuinely does not exist. There is no notice to read, because from the index's point of view nothing was hidden. The user's own global config still sets all three freely; only the project-supplied layer is refused.
1181
1268
  "indexing.skip_dirs",
1182
1269
  "indexing.skip_files",
1270
+ "indexing.skip_minified",
1183
1271
  "indexing.large_file_skip_kb",
1184
1272
  "indexing.large_file_symbol_only_kb",
1185
1273
  // Same reasoning as the two thresholds above, on the chunk axis: a checked-in `.token-goat.toml` dropping this to 1 would take every file in the repository out of `semantic` for a reviewing agent, and `semantic` would answer "no matches" in the words it uses for a genuine absence.
@@ -1187,10 +1275,14 @@ var PROJECT_LOCKED_KEYS = [
1187
1275
  "indexing.cross_project_symbols",
1188
1276
  // The same blast radius as the indexing keys above, applied to retrieval rather than to what gets indexed: `semantic` drops a dense hit whose distance exceeds this, so a checked-in `.token-goat.toml` setting it near the floor removes this repository's own code from the vector half of every search a reviewing agent runs, and the command then answers "no matches" in the words it uses for a name that genuinely is not there. The keyword pass would still answer, which makes it worse rather than better -- the result looks like a working search. The user's own global config still sets it freely; only the project-supplied layer is refused.
1189
1277
  "semantic.max_distance",
1278
+ // The advisory twin of the floor above: a checked-in `.token-goat.toml` raising it to the 1.2 maximum would make every poor hit read as confident, silencing the one warning that says a result is probably unrelated. The user's own global config still sets it freely.
1279
+ "semantic.weak_distance",
1190
1280
  "worker.blocked_roots",
1191
1281
  // global.db is a machine-wide shared database across every project on the host. A checked-in per-project .token-goat.toml must not be able to lower the size warning threshold or trigger auto-reclaim/purging of embeddings across other repositories sharing the same database.
1192
1282
  "indexing.max_db_size_mb",
1193
- "indexing.auto_reclaim_embeddings"
1283
+ "indexing.auto_reclaim_embeddings",
1284
+ // Which executable every harness runs on every tool call. `install` writes that choice into user-scope harness configs that every project on the machine then runs, so a checked-in `.token-goat.toml` must not be the layer that makes it. The user's global config and TOKEN_GOAT_NATIVE_HOOKS still set it freely.
1285
+ "hooks.native"
1194
1286
  ];
1195
1287
  var _lastProjectConfigLockedKeys = [];
1196
1288
  function lastProjectConfigLockedKeys() {
@@ -1286,7 +1378,28 @@ function mergeRawConfig(base, override) {
1286
1378
  return merged;
1287
1379
  }
1288
1380
  var _projectRootCache = null;
1381
+ var _projectRootOverride = null;
1382
+ function withConfigProjectRoot(root, fn) {
1383
+ const prior = _projectRootOverride;
1384
+ _projectRootOverride = root;
1385
+ try {
1386
+ return fn();
1387
+ } finally {
1388
+ _projectRootOverride = prior;
1389
+ }
1390
+ }
1391
+ function configProjectRootFor(dir) {
1392
+ const own = findProject(dir);
1393
+ let project = own;
1394
+ while (project !== null) {
1395
+ if (fs3.existsSync(projectConfigPath(project.root))) return project.root;
1396
+ const parent = path2.dirname(project.root);
1397
+ project = parent === project.root ? null : findProject(parent);
1398
+ }
1399
+ return own?.root ?? dir;
1400
+ }
1289
1401
  function resolveConfigProjectRoot() {
1402
+ if (_projectRootOverride !== null) return _projectRootOverride;
1290
1403
  const cwd = process.cwd();
1291
1404
  if (_projectRootCache !== null && _projectRootCache.cwd === cwd) return _projectRootCache.root;
1292
1405
  const project = findProject(cwd);
@@ -1327,7 +1440,7 @@ function isAutoTriggerMultiplierExplicit() {
1327
1440
 
1328
1441
  // src/config.ts
1329
1442
  init_define_import_meta_env();
1330
- import * as path2 from "node:path";
1443
+ import * as path3 from "node:path";
1331
1444
 
1332
1445
  // src/own_lookup.ts
1333
1446
  init_define_import_meta_env();
@@ -1355,7 +1468,7 @@ var CONFIG_DEFAULTS = {
1355
1468
  max_lines: 1e3,
1356
1469
  max_bytes: 64 * 1024,
1357
1470
  timeout_seconds: 600,
1358
- // Matches the hardcoded MIN_CACHE_BYTES floor hooks_bash.ts used before this knob was wired to a real consumer, so untouched-config installs see no behavior change now that hooks_bash.ts reads this value instead.
1471
+ // Matches the hardcoded MIN_CACHE_BYTES floor hooks_bash.ts used before this knob was wired to a real consumer, so untouched-config installs see no behavior change now that hooks_bash_post.ts reads this value instead.
1359
1472
  cache_min_bytes: 512,
1360
1473
  cache_max_file_count: 4096,
1361
1474
  cache_max_bytes: 16 * 1024 * 1024,
@@ -1440,6 +1553,7 @@ var CONFIG_DEFAULTS = {
1440
1553
  serve_diff_on_reread: true,
1441
1554
  elide_served_lines: true,
1442
1555
  subagent_markdown_first_read_deny: false,
1556
+ agent_scoped_spawn_deny: false,
1443
1557
  backoff_thresholds: [1, 3, 10, 30],
1444
1558
  git_hint_max_ms: 50,
1445
1559
  min_session_hint_savings_bytes: 512,
@@ -1465,6 +1579,8 @@ var CONFIG_DEFAULTS = {
1465
1579
  truncated_read_min_lines: 200,
1466
1580
  protect_recent_reads: 4,
1467
1581
  warn_unbalanced_shell_quoting: true,
1582
+ // On. Claude Code's Bash tool on Windows hands the command to Git Bash as a `-c` argument, and the argv quoting plus the MSYS2 runtime's decoding turn every run of two or more backslashes into half as many, so `printf 'a\\nb'` or a `C:\\Users` path arrives changed and nothing says so. Only that pairing is denied: another platform, another harness, or a command without a doubled backslash passes untouched.
1583
+ deny_bash_double_backslash: true,
1468
1584
  prompt_triggers: [],
1469
1585
  log_large_file_hint_outcomes: false,
1470
1586
  cross_session_read_dedup: false,
@@ -1474,7 +1590,8 @@ var CONFIG_DEFAULTS = {
1474
1590
  },
1475
1591
  hooks: {
1476
1592
  latency_budget_ms: 1500,
1477
- server: true
1593
+ server: true,
1594
+ native: "auto"
1478
1595
  },
1479
1596
  webfetch: {
1480
1597
  allow: [],
@@ -1498,6 +1615,7 @@ var CONFIG_DEFAULTS = {
1498
1615
  max_chunks_per_file: 600,
1499
1616
  skip_dirs: [],
1500
1617
  skip_files: ["coverage.json", "coverage-final.json"],
1618
+ skip_minified: true,
1501
1619
  embeddings_enabled: true,
1502
1620
  cross_project_symbols: true,
1503
1621
  max_db_size_mb: 1500,
@@ -1535,7 +1653,9 @@ var CONFIG_DEFAULTS = {
1535
1653
  archive_weight: 0.7,
1536
1654
  docs_weight: 0.92,
1537
1655
  // Deliberately loose enough to admit everything this metric produces, which is a measured conclusion rather than a placeholder. Against a large index, 12 genuine questions about code that is present had best hits from 0.635 to 0.813 and 11 off-corpus ones (nonsense strings, digits, a cake recipe) from 0.820 to 1.017, which looks separable at about 0.9. It is not: on a small corpus the nearest genuine match is much further away, and a two-file project in this repo's own suite matches its target at 0.934 -- above that cut and inside the noise band. So the two populations overlap across corpus sizes and no fixed distance tells them apart, while getting it wrong removes real answers and says nothing. Left at the retrieval bound's value so the default filters nothing; it exists to be lowered per-project by someone who has measured their own corpus, and runSemantic says which distance it refused when a lowered value empties the vector half.
1538
- max_distance: 1.2
1656
+ max_distance: 1.2,
1657
+ // Best surviving dense distance above which runSemantic says its closest match is weak. Measured on this repo's index on 2026-09-24: 38 questions about code that is present had best hits from 0.565 to 0.800, and 12 nonsense or off-topic ones from 0.863 to 1.043 (8 questions from other programming domains spread over 0.718-0.952, the low ones landing on code that is genuinely related, so those are not separable by distance), so the cut sits in that gap nearer the noise edge, because a small corpus pushes genuine matches farther out (0.934 in a two-file project, see semantic.max_distance) and a false alarm on a right answer costs more than a missed one. Advisory only: it removes nothing, unlike that floor.
1658
+ weak_distance: 0.85
1539
1659
  }
1540
1660
  };
1541
1661
  function getDefaultConfig(section2) {
@@ -1591,6 +1711,18 @@ function validatedFloat(raw, def, min, max) {
1591
1711
  function validatedVisionTier(raw, def) {
1592
1712
  return raw === "standard" || raw === "high" ? raw : def;
1593
1713
  }
1714
+ function validatedNativeHooksMode(raw, def) {
1715
+ return raw === "auto" || raw === "off" ? raw : def;
1716
+ }
1717
+ function nativeHooksModeFromEnv(raw) {
1718
+ const norm = raw?.trim().toLowerCase() ?? "";
1719
+ if (TRUTHY_ENV_VALUES.has(norm)) return "auto";
1720
+ if (FALSY_ENV_VALUES.has(norm)) return "off";
1721
+ return void 0;
1722
+ }
1723
+ var ENV_VALUE_COERCERS = {
1724
+ "hooks.native": nativeHooksModeFromEnv
1725
+ };
1594
1726
  function validatedOcrLang(raw, def) {
1595
1727
  if (typeof raw !== "string") return def;
1596
1728
  const tokens = raw.split(/[+,;\s]+/).map((s) => s.trim().toLowerCase()).filter(Boolean);
@@ -1677,7 +1809,9 @@ var NUMERIC_FIELD_BOUNDS = {
1677
1809
  "semantic.archive_weight": { min: 0.05, max: 1 },
1678
1810
  "semantic.docs_weight": { min: 0.05, max: 1 },
1679
1811
  // Upper bound is DEFAULT_DISTANCE_THRESHOLD, not the metric's own ceiling of 2. An L2 distance between unit vectors cannot exceed 2, so 2 reads like 'admit everything' -- but this floor only ever narrows what searchSemantic already returned, and runSemantic lets that scan keep its own 1.2 bound (see the max_distance comment on SemanticConfig for why the scan is the wrong place for a relevance decision). Anything between 1.2 and 2 was therefore discarded inside the scan before the floor could see it: a user raising this to widen recall got the setting accepted, validated and persisted, and identical results, with no diagnostic able to say why. validatedFloat clamps rather than rejects, so an existing value above the new bound becomes 1.2 and behaves exactly as it already did. The lower bound is not 0: a floor of 0 admits only an exact vector match, which would disable the vector half entirely while `semantic` went on answering in the words it uses for a genuine absence.
1680
- "semantic.max_distance": { min: 0.05, max: 1.2 }
1812
+ "semantic.max_distance": { min: 0.05, max: 1.2 },
1813
+ // Same range as max_distance: both are L2 distances on the scan's own 1.2 ceiling, and a weak line above what the scan can return would never fire.
1814
+ "semantic.weak_distance": { min: 0.05, max: 1.2 }
1681
1815
  };
1682
1816
  function boundsOf(key) {
1683
1817
  const b = ownGet(NUMERIC_FIELD_BOUNDS, key);
@@ -1710,7 +1844,8 @@ var ENUM_FIELD_VALUES = {
1710
1844
  "compact_assist.harness": ["auto", ...KNOWN_HARNESS_NAMES],
1711
1845
  "image_shrink.ocr_lang": [...SUPPORTED_OCR_LANG_CODES],
1712
1846
  // Deliberately has no entry above `normal`. This table is what `config set` checks; a hand-edited TOML bypasses it, which is why resolveWorkerPriority (process_priority.ts) maps an unrecognized value back to the default rather than trusting whatever the file said.
1713
- "worker.priority": ["below_normal", "low", "normal"]
1847
+ "worker.priority": ["below_normal", "low", "normal"],
1848
+ "hooks.native": ["auto", "off"]
1714
1849
  };
1715
1850
  function validateEnumField(fieldKey, value) {
1716
1851
  if (fieldKey === "image_shrink.ocr_lang") {
@@ -1722,7 +1857,7 @@ function validateEnumField(fieldKey, value) {
1722
1857
  if (!allowed) return void 0;
1723
1858
  return allowed.includes(value) ? void 0 : allowed;
1724
1859
  }
1725
- var ENV_KEYS2 = [
1860
+ var ENV_KEYS = [
1726
1861
  "TOKEN_GOAT_COMPACT_ASSIST",
1727
1862
  "TOKENWISE_COMPACT_ASSIST",
1728
1863
  "TOKEN_GOAT_BASH_COMPRESS",
@@ -1755,6 +1890,7 @@ var ENV_KEYS2 = [
1755
1890
  "TOKEN_GOAT_PRE_SKILL",
1756
1891
  "TOKEN_GOAT_ORPHAN_SWEEP",
1757
1892
  "TOKEN_GOAT_WARN_UNBALANCED_SHELL_QUOTING",
1893
+ "TOKEN_GOAT_DENY_BASH_DOUBLE_BACKSLASH",
1758
1894
  "TOKEN_GOAT_LOG_LARGE_FILE_HINT_OUTCOMES",
1759
1895
  "TOKEN_GOAT_CROSS_SESSION_READ_DEDUP",
1760
1896
  "TOKEN_GOAT_CROSS_SESSION_READ_DEDUP_TTL_SECS",
@@ -1771,7 +1907,7 @@ var ENV_KEYS2 = [
1771
1907
  "TOKEN_GOAT_INDEXING_AUTO_RECLAIM_EMBEDDINGS"
1772
1908
  ];
1773
1909
  function allEnvKeys() {
1774
- return [.../* @__PURE__ */ new Set([...ENV_KEYS2, ...Object.values(CONFIG_KEY_ENV_OVERRIDES).flat()])];
1910
+ return [.../* @__PURE__ */ new Set([...ENV_KEYS, ...Object.values(CONFIG_KEY_ENV_OVERRIDES).flat()])];
1775
1911
  }
1776
1912
  function configEnvFingerprint() {
1777
1913
  const snap = {};
@@ -1780,7 +1916,7 @@ function configEnvFingerprint() {
1780
1916
  }
1781
1917
  return JSON.stringify(snap);
1782
1918
  }
1783
- var _cached2 = null;
1919
+ var _cached = null;
1784
1920
  function deepFreeze(value) {
1785
1921
  if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
1786
1922
  Object.freeze(value);
@@ -1854,7 +1990,9 @@ function resolveConfigKeyLayer(key, effectiveValue, cfg, projectInfo) {
1854
1990
  const envVar = (CONFIG_KEY_ENV_OVERRIDES[key] ?? []).find((name) => process.env[name] !== void 0);
1855
1991
  if (envVar !== void 0) {
1856
1992
  const rawStr = process.env[envVar] ?? "";
1857
- const judged = coerceEnvLike(rawStr, effectiveValue);
1993
+ const coerce = ownGet(ENV_VALUE_COERCERS, key);
1994
+ const special = coerce === void 0 ? void 0 : coerce(rawStr);
1995
+ const judged = coerce === void 0 ? coerceEnvLike(rawStr, effectiveValue) : special === void 0 ? "unusable" : { parsed: special };
1858
1996
  if (judged === null) return { layer: "env", envVar };
1859
1997
  if (judged === "unusable") {
1860
1998
  return { layer: "env-invalid", envVar, rawValue: rawStr, effectiveValue, reason: rawStr.trim() === "" ? "empty" : rejectionReason(key, rawStr, effectiveValue, cfg) };
@@ -1866,6 +2004,10 @@ function resolveConfigKeyLayer(key, effectiveValue, cfg, projectInfo) {
1866
2004
  if (projectInfo.parseError !== null) return { layer: "project-unparsed", path: projectInfo.path, parseError: projectInfo.parseError };
1867
2005
  if (!Object.prototype.hasOwnProperty.call(projectInfo.values, key)) return { layer: "global" };
1868
2006
  const rawValue = projectInfo.values[key];
2007
+ if (PROJECT_LOCKED_SECTIONS.includes(key.split(".")[0] ?? "") || PROJECT_LOCKED_KEYS.includes(key)) {
2008
+ if (rawValueEquals(rawValue, effectiveValue)) return { layer: "global" };
2009
+ return { layer: "project-invalid", path: projectInfo.path, rawValue, effectiveValue, reason: "a security setting, which only the global config or the environment may set" };
2010
+ }
1869
2011
  if (rawValueEquals(rawValue, effectiveValue)) return { layer: "project", path: projectInfo.path };
1870
2012
  return { layer: "project-invalid", path: projectInfo.path, rawValue, effectiveValue, reason: rejectionReason(key, rawValue, effectiveValue, cfg) };
1871
2013
  }
@@ -1878,8 +2020,8 @@ function loadConfig(projectRoot) {
1878
2020
  const { text: projText, readError: projReadError } = readConfigText(projPath);
1879
2021
  const projectContentFp = projText !== null ? shortFingerprint(projText) : "";
1880
2022
  const envFp = configEnvFingerprint();
1881
- if (_cached2 !== null && _cached2.contentFp === contentFp && _cached2.envFp === envFp && _cached2.projectRoot === root && _cached2.projectContentFp === projectContentFp) {
1882
- return _cached2.config;
2023
+ if (_cached !== null && _cached.contentFp === contentFp && _cached.envFp === envFp && _cached.projectRoot === root && _cached.projectContentFp === projectContentFp) {
2024
+ return _cached.config;
1883
2025
  }
1884
2026
  let raw = {};
1885
2027
  if (text !== null) {
@@ -1904,11 +2046,11 @@ function loadConfig(projectRoot) {
1904
2046
  _lastProjectConfigParseError = projReadError;
1905
2047
  }
1906
2048
  const cfg = deepFreeze(_buildConfig(raw, projectRaw));
1907
- _cached2 = { config: cfg, contentFp, envFp, projectRoot: root, projectContentFp };
2049
+ _cached = { config: cfg, contentFp, envFp, projectRoot: root, projectContentFp };
1908
2050
  return cfg;
1909
2051
  }
1910
2052
  function invalidateConfigCache() {
1911
- _cached2 = null;
2053
+ _cached = null;
1912
2054
  resetLastProjectConfigLockedKeys();
1913
2055
  }
1914
2056
  registerReset(invalidateConfigCache);
@@ -1941,6 +2083,9 @@ function loadPersistedConfig() {
1941
2083
  function hookServerEnabled() {
1942
2084
  return envBool("TOKEN_GOAT_HOOK_SERVER", loadPersistedConfig().hooks.server);
1943
2085
  }
2086
+ function nativeHooksEnabled() {
2087
+ return (nativeHooksModeFromEnv(process.env["TOKEN_GOAT_NATIVE_HOOKS"]) ?? loadPersistedConfig().hooks.native) !== "off";
2088
+ }
1944
2089
  function _buildConfig(raw, projectRaw = {}) {
1945
2090
  const { cleaned: safeProjectRaw, dropped: lockedKeys } = stripLockedProjectKeys(projectRaw);
1946
2091
  setLastProjectConfigLockedKeys(lockedKeys);
@@ -2019,7 +2164,7 @@ function _buildConfig(raw, projectRaw = {}) {
2019
2164
  const is_cfg = getDefaultConfig("image_shrink");
2020
2165
  is_cfg.enabled = validatedBool(is_raw["enabled"], is_cfg.enabled);
2021
2166
  is_cfg.jpeg_quality = validatedInt(is_raw["jpeg_quality"], is_cfg.jpeg_quality, ...boundsOf("image_shrink.jpeg_quality"));
2022
- is_cfg.max_image_pixels = validatedInt(is_raw["max_image_pixels"], is_cfg.max_image_pixels, ...boundsOf("image_shrink.max_image_pixels"));
2167
+ is_cfg.max_image_pixels = validatedIntWithLegacySentinel(is_raw["max_image_pixels"], is_cfg.max_image_pixels, 16e6, ...boundsOf("image_shrink.max_image_pixels"));
2023
2168
  is_cfg.screenshot_redirect = validatedBool(is_raw["screenshot_redirect"], is_cfg.screenshot_redirect);
2024
2169
  is_cfg.ocr_enabled = validatedBool(is_raw["ocr_enabled"], is_cfg.ocr_enabled);
2025
2170
  is_cfg.ocr_min_confidence = validatedInt(is_raw["ocr_min_confidence"], is_cfg.ocr_min_confidence, ...boundsOf("image_shrink.ocr_min_confidence"));
@@ -2069,6 +2214,7 @@ function _buildConfig(raw, projectRaw = {}) {
2069
2214
  hi.serve_diff_on_reread = validatedBool(hi_raw["serve_diff_on_reread"], hi.serve_diff_on_reread);
2070
2215
  hi.elide_served_lines = validatedBool(hi_raw["elide_served_lines"], hi.elide_served_lines);
2071
2216
  hi.subagent_markdown_first_read_deny = validatedBool(hi_raw["subagent_markdown_first_read_deny"], hi.subagent_markdown_first_read_deny);
2217
+ hi.agent_scoped_spawn_deny = validatedBool(hi_raw["agent_scoped_spawn_deny"], hi.agent_scoped_spawn_deny);
2072
2218
  hi.backoff_thresholds = validatedIntList(hi_raw["backoff_thresholds"], hi.backoff_thresholds);
2073
2219
  hi.git_hint_max_ms = validatedInt(hi_raw["git_hint_max_ms"], hi.git_hint_max_ms, ...boundsOf("hints.git_hint_max_ms"));
2074
2220
  hi.min_session_hint_savings_bytes = validatedInt(hi_raw["min_session_hint_savings_bytes"], hi.min_session_hint_savings_bytes, ...boundsOf("hints.min_session_hint_savings_bytes"));
@@ -2087,11 +2233,14 @@ function _buildConfig(raw, projectRaw = {}) {
2087
2233
  hi.truncated_read_min_lines = validatedInt(hi_raw["truncated_read_min_lines"], hi.truncated_read_min_lines, ...boundsOf("hints.truncated_read_min_lines"));
2088
2234
  hi.protect_recent_reads = validatedInt(hi_raw["protect_recent_reads"], hi.protect_recent_reads, ...boundsOf("hints.protect_recent_reads"));
2089
2235
  hi.warn_unbalanced_shell_quoting = validatedBool(hi_raw["warn_unbalanced_shell_quoting"], hi.warn_unbalanced_shell_quoting);
2236
+ hi.deny_bash_double_backslash = validatedBool(hi_raw["deny_bash_double_backslash"], hi.deny_bash_double_backslash);
2090
2237
  hi.log_large_file_hint_outcomes = validatedBool(hi_raw["log_large_file_hint_outcomes"], hi.log_large_file_hint_outcomes);
2091
2238
  hi.warn_unbalanced_shell_quoting = envBool("TOKEN_GOAT_WARN_UNBALANCED_SHELL_QUOTING", hi.warn_unbalanced_shell_quoting);
2239
+ hi.deny_bash_double_backslash = envBool("TOKEN_GOAT_DENY_BASH_DOUBLE_BACKSLASH", hi.deny_bash_double_backslash);
2092
2240
  hi.serve_diff_on_reread = envBool("TOKEN_GOAT_SERVE_DIFF_ON_REREAD", hi.serve_diff_on_reread);
2093
2241
  hi.elide_served_lines = envBool("TOKEN_GOAT_ELIDE_SERVED_LINES", hi.elide_served_lines);
2094
2242
  hi.subagent_markdown_first_read_deny = envBool("TOKEN_GOAT_SUBAGENT_MARKDOWN_FIRST_READ_DENY", hi.subagent_markdown_first_read_deny);
2243
+ hi.agent_scoped_spawn_deny = envBool("TOKEN_GOAT_AGENT_SCOPED_SPAWN_DENY", hi.agent_scoped_spawn_deny);
2095
2244
  hi.log_large_file_hint_outcomes = envBool("TOKEN_GOAT_LOG_LARGE_FILE_HINT_OUTCOMES", hi.log_large_file_hint_outcomes);
2096
2245
  hi.json_sidecar = envBool("TOKEN_GOAT_HINT_JSON_SIDECAR", hi.json_sidecar);
2097
2246
  hi.large_read_redirect_bytes = envInt("TOKEN_GOAT_LARGE_READ_BYTES", hi.large_read_redirect_bytes, ...boundsOf("hints.large_read_redirect_bytes"));
@@ -2133,6 +2282,8 @@ function _buildConfig(raw, projectRaw = {}) {
2133
2282
  hk.latency_budget_ms = envInt("TOKEN_GOAT_HOOK_LATENCY_BUDGET_MS", hk.latency_budget_ms, ...boundsOf("hooks.latency_budget_ms"));
2134
2283
  hk.server = validatedBool(hk_raw["server"], hk.server);
2135
2284
  hk.server = envBool("TOKEN_GOAT_HOOK_SERVER", hk.server);
2285
+ hk.native = validatedNativeHooksMode(hk_raw["native"], hk.native);
2286
+ hk.native = nativeHooksModeFromEnv(process.env["TOKEN_GOAT_NATIVE_HOOKS"]) ?? hk.native;
2136
2287
  const wf_raw = section(raw, "webfetch");
2137
2288
  const wf = getDefaultConfig("webfetch");
2138
2289
  wf.allow = validatedStrList(wf_raw["allow"], wf.allow);
@@ -2163,6 +2314,7 @@ function _buildConfig(raw, projectRaw = {}) {
2163
2314
  ix.max_chunks_per_file = validatedInt(ix_raw["max_chunks_per_file"], ix.max_chunks_per_file, ...boundsOf("indexing.max_chunks_per_file"));
2164
2315
  ix.skip_dirs = validatedStrList(ix_raw["skip_dirs"], ix.skip_dirs);
2165
2316
  ix.skip_files = validatedStrList(ix_raw["skip_files"], ix.skip_files);
2317
+ ix.skip_minified = validatedBool(ix_raw["skip_minified"], ix.skip_minified);
2166
2318
  ix.embeddings_enabled = validatedBool(ix_raw["embeddings_enabled"], ix.embeddings_enabled);
2167
2319
  ix.embeddings_enabled = envBool("TOKEN_GOAT_EMBEDDINGS_ENABLED", ix.embeddings_enabled);
2168
2320
  ix.cross_project_symbols = validatedBool(ix_raw["cross_project_symbols"], ix.cross_project_symbols);
@@ -2202,7 +2354,7 @@ function _buildConfig(raw, projectRaw = {}) {
2202
2354
  mcp.confine_reads_to_project_root = validatedBool(mcp_raw["confine_reads_to_project_root"], mcp.confine_reads_to_project_root);
2203
2355
  mcp.confine_reads_to_project_root = envBool("TOKEN_GOAT_MCP_CONFINE_READS", mcp.confine_reads_to_project_root);
2204
2356
  mcp.allowed_roots = validatedStrList(mcp_raw["allowed_roots"], mcp.allowed_roots);
2205
- mcp.allowed_roots = envStrList("TOKEN_GOAT_MCP_ALLOWED_ROOTS", mcp.allowed_roots, path2.delimiter);
2357
+ mcp.allowed_roots = envStrList("TOKEN_GOAT_MCP_ALLOWED_ROOTS", mcp.allowed_roots, path3.delimiter);
2206
2358
  const hs_raw = section(raw, "hint_stats");
2207
2359
  const hs = getDefaultConfig("hint_stats");
2208
2360
  hs.suppress_threshold_pct = validatedInt(hs_raw["suppress_threshold_pct"], hs.suppress_threshold_pct, ...boundsOf("hint_stats.suppress_threshold_pct"));
@@ -2214,6 +2366,7 @@ function _buildConfig(raw, projectRaw = {}) {
2214
2366
  sem.archive_weight = validatedFloat(sem_raw["archive_weight"], sem.archive_weight, ...boundsOf("semantic.archive_weight"));
2215
2367
  sem.docs_weight = validatedFloat(sem_raw["docs_weight"], sem.docs_weight, ...boundsOf("semantic.docs_weight"));
2216
2368
  sem.max_distance = validatedFloat(sem_raw["max_distance"], sem.max_distance, ...boundsOf("semantic.max_distance"));
2369
+ sem.weak_distance = validatedFloat(sem_raw["weak_distance"], sem.weak_distance, ...boundsOf("semantic.weak_distance"));
2217
2370
  return {
2218
2371
  compact_assist: ca,
2219
2372
  bash_compress: bc,
@@ -2278,9 +2431,11 @@ var CONFIG_KEY_ENV_OVERRIDES = {
2278
2431
  "hints.write_rewrite_unchanged_pct": ["TOKEN_GOAT_WRITE_REWRITE_UNCHANGED_PCT"],
2279
2432
  "hints.large_read_redirect_bytes": ["TOKEN_GOAT_LARGE_READ_BYTES"],
2280
2433
  "hints.warn_unbalanced_shell_quoting": ["TOKEN_GOAT_WARN_UNBALANCED_SHELL_QUOTING"],
2434
+ "hints.deny_bash_double_backslash": ["TOKEN_GOAT_DENY_BASH_DOUBLE_BACKSLASH"],
2281
2435
  "hints.serve_diff_on_reread": ["TOKEN_GOAT_SERVE_DIFF_ON_REREAD"],
2282
2436
  "hints.elide_served_lines": ["TOKEN_GOAT_ELIDE_SERVED_LINES"],
2283
2437
  "hints.subagent_markdown_first_read_deny": ["TOKEN_GOAT_SUBAGENT_MARKDOWN_FIRST_READ_DENY"],
2438
+ "hints.agent_scoped_spawn_deny": ["TOKEN_GOAT_AGENT_SCOPED_SPAWN_DENY"],
2284
2439
  "hints.log_large_file_hint_outcomes": ["TOKEN_GOAT_LOG_LARGE_FILE_HINT_OUTCOMES"],
2285
2440
  "hints.cross_session_read_dedup": ["TOKEN_GOAT_CROSS_SESSION_READ_DEDUP"],
2286
2441
  "hints.cross_session_read_dedup_ttl_secs": ["TOKEN_GOAT_CROSS_SESSION_READ_DEDUP_TTL_SECS"],
@@ -2305,6 +2460,7 @@ var CONFIG_KEY_ENV_OVERRIDES = {
2305
2460
  "hints.quiet_hours": ["TOKEN_GOAT_QUIET_HOURS"],
2306
2461
  "hooks.latency_budget_ms": ["TOKEN_GOAT_HOOK_LATENCY_BUDGET_MS"],
2307
2462
  "hooks.server": ["TOKEN_GOAT_HOOK_SERVER"],
2463
+ "hooks.native": ["TOKEN_GOAT_NATIVE_HOOKS"],
2308
2464
  "webfetch.max_file_count": ["TOKEN_GOAT_WEB_CACHE_MAX_FILES"],
2309
2465
  "webfetch.max_bytes": ["TOKEN_GOAT_WEB_CACHE_MAX_BYTES"],
2310
2466
  "webfetch.compress_bodies": ["TOKEN_GOAT_WEB_COMPRESS"],
@@ -2328,7 +2484,26 @@ var CONFIG_KEY_ENV_OVERRIDES = {
2328
2484
  "indexing.max_db_size_mb": ["TOKEN_GOAT_INDEXING_MAX_DB_SIZE_MB"],
2329
2485
  "indexing.auto_reclaim_embeddings": ["TOKEN_GOAT_INDEXING_AUTO_RECLAIM_EMBEDDINGS"]
2330
2486
  };
2331
- function saveConfig(config) {
2487
+ function isPlainObject(v) {
2488
+ return v !== null && typeof v === "object" && !Array.isArray(v);
2489
+ }
2490
+ function sparsifyAgainstDefaults(data, defaults, raw, explicit, prefix = "") {
2491
+ const out = {};
2492
+ for (const [k, v] of Object.entries(data)) {
2493
+ const dotted = prefix === "" ? k : `${prefix}.${k}`;
2494
+ const d = defaults[k];
2495
+ const r = raw[k];
2496
+ if (isPlainObject(v) && isPlainObject(d)) {
2497
+ const sub = sparsifyAgainstDefaults(v, d, isPlainObject(r) ? r : {}, explicit, dotted);
2498
+ if (Object.keys(sub).length > 0) out[k] = sub;
2499
+ continue;
2500
+ }
2501
+ const keep = d === void 0 || !rawValueEquals(v, d) || r !== void 0 || explicit.has(dotted);
2502
+ if (keep) out[k] = v;
2503
+ }
2504
+ return out;
2505
+ }
2506
+ function saveConfig(config, explicitKeys = []) {
2332
2507
  const ca = config.compact_assist;
2333
2508
  const bc = config.bash_compress;
2334
2509
  const sp = config.skill_preservation;
@@ -2426,6 +2601,7 @@ function saveConfig(config) {
2426
2601
  serve_diff_on_reread: config.hints.serve_diff_on_reread,
2427
2602
  elide_served_lines: config.hints.elide_served_lines,
2428
2603
  subagent_markdown_first_read_deny: config.hints.subagent_markdown_first_read_deny,
2604
+ agent_scoped_spawn_deny: config.hints.agent_scoped_spawn_deny,
2429
2605
  backoff_thresholds: config.hints.backoff_thresholds,
2430
2606
  git_hint_max_ms: config.hints.git_hint_max_ms,
2431
2607
  min_session_hint_savings_bytes: config.hints.min_session_hint_savings_bytes,
@@ -2445,6 +2621,7 @@ function saveConfig(config) {
2445
2621
  protect_recent_reads: config.hints.protect_recent_reads,
2446
2622
  prompt_triggers: config.hints.prompt_triggers,
2447
2623
  warn_unbalanced_shell_quoting: config.hints.warn_unbalanced_shell_quoting,
2624
+ deny_bash_double_backslash: config.hints.deny_bash_double_backslash,
2448
2625
  log_large_file_hint_outcomes: config.hints.log_large_file_hint_outcomes,
2449
2626
  cross_session_read_dedup: config.hints.cross_session_read_dedup,
2450
2627
  cross_session_read_dedup_ttl_secs: config.hints.cross_session_read_dedup_ttl_secs,
@@ -2453,7 +2630,8 @@ function saveConfig(config) {
2453
2630
  },
2454
2631
  hooks: {
2455
2632
  latency_budget_ms: config.hooks.latency_budget_ms,
2456
- server: config.hooks.server
2633
+ server: config.hooks.server,
2634
+ native: config.hooks.native
2457
2635
  },
2458
2636
  webfetch: {
2459
2637
  allow: config.webfetch.allow,
@@ -2475,6 +2653,7 @@ function saveConfig(config) {
2475
2653
  max_chunks_per_file: config.indexing.max_chunks_per_file,
2476
2654
  skip_dirs: config.indexing.skip_dirs,
2477
2655
  skip_files: config.indexing.skip_files,
2656
+ skip_minified: config.indexing.skip_minified,
2478
2657
  embeddings_enabled: config.indexing.embeddings_enabled,
2479
2658
  cross_project_symbols: config.indexing.cross_project_symbols,
2480
2659
  max_db_size_mb: config.indexing.max_db_size_mb,
@@ -2510,23 +2689,21 @@ function saveConfig(config) {
2510
2689
  semantic: {
2511
2690
  archive_weight: config.semantic.archive_weight,
2512
2691
  max_distance: config.semantic.max_distance,
2692
+ weak_distance: config.semantic.weak_distance,
2513
2693
  docs_weight: config.semantic.docs_weight
2514
2694
  }
2515
2695
  };
2516
- const toml = stringify(data);
2696
+ const toml = stringify(sparsifyAgainstDefaults(data, buildPersistedConfig({}), readConfigToml(configPath()).raw, new Set(explicitKeys)));
2517
2697
  atomicWriteText(configPath(), toml);
2518
- _cached2 = null;
2698
+ _cached = null;
2519
2699
  }
2520
2700
 
2521
2701
  export {
2522
2702
  parse,
2523
2703
  stringify,
2524
- setRelaySeededSessionId,
2525
- relaySeededSessionId,
2526
- detectHarness,
2527
- getHarnessName,
2528
2704
  fingerprintContent,
2529
2705
  shortFingerprint,
2706
+ indexedFileIsGone,
2530
2707
  fingerprintFile,
2531
2708
  fileIsAbsent,
2532
2709
  DEFAULT_OCR_LANG,
@@ -2535,6 +2712,7 @@ export {
2535
2712
  resolveOcrLangs,
2536
2713
  ownGet,
2537
2714
  defaultConfig,
2715
+ projectHash,
2538
2716
  makeProjectAt,
2539
2717
  findProject,
2540
2718
  getDisplayRoot,
@@ -2544,6 +2722,8 @@ export {
2544
2722
  PROJECT_LOCKED_KEYS,
2545
2723
  lastProjectConfigLockedKeys,
2546
2724
  readConfigSource,
2725
+ withConfigProjectRoot,
2726
+ configProjectRootFor,
2547
2727
  getProjectConfigInfo,
2548
2728
  isAutoTriggerMultiplierExplicit,
2549
2729
  validateNumericField,
@@ -2555,16 +2735,17 @@ export {
2555
2735
  invalidateConfigCache,
2556
2736
  loadPersistedConfig,
2557
2737
  hookServerEnabled,
2738
+ nativeHooksEnabled,
2558
2739
  CONFIG_KEY_ENV_OVERRIDES,
2559
2740
  saveConfig
2560
2741
  };
2561
2742
  /*! Bundled license information:
2562
2743
 
2563
- smol-toml/dist/date.js:
2564
2744
  smol-toml/dist/error.js:
2565
- smol-toml/dist/util.js:
2566
2745
  smol-toml/dist/primitive.js:
2746
+ smol-toml/dist/date.js:
2567
2747
  smol-toml/dist/extract.js:
2748
+ smol-toml/dist/util.js:
2568
2749
  smol-toml/dist/struct.js:
2569
2750
  smol-toml/dist/parse.js:
2570
2751
  smol-toml/dist/stringify.js: