token-goat 2.9.28 → 2.9.29

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 (77) hide show
  1. package/README.md +2 -0
  2. package/dist/{token-goat-chunk-OZRSREKR.mjs → token-goat-chunk-2AWQ2R5X.mjs} +2 -2
  3. package/dist/{token-goat-chunk-5NNYIUGV.mjs → token-goat-chunk-2NNUA2LR.mjs} +4 -4
  4. package/dist/{token-goat-chunk-4RN64ZND.mjs → token-goat-chunk-2WOUYWLM.mjs} +2 -1
  5. package/dist/{token-goat-chunk-HUDC5GS5.mjs → token-goat-chunk-435UQTKD.mjs} +5 -3
  6. package/dist/{token-goat-chunk-6DQNNFJ6.mjs → token-goat-chunk-44BM7DDQ.mjs} +3 -3
  7. package/dist/{token-goat-chunk-4JMWPWCS.mjs → token-goat-chunk-52NSDWYY.mjs} +2 -2
  8. package/dist/{token-goat-chunk-IHKZ3QNA.mjs → token-goat-chunk-67BNIKKO.mjs} +19 -16
  9. package/dist/{token-goat-chunk-XBESNWEX.mjs → token-goat-chunk-6AK46ZT7.mjs} +2 -3
  10. package/dist/{token-goat-chunk-M56BWPBN.mjs → token-goat-chunk-7CPMDFGB.mjs} +166 -40
  11. package/dist/token-goat-chunk-ASLWOQ3I.mjs +14 -0
  12. package/dist/{token-goat-chunk-QM76S6YS.mjs → token-goat-chunk-BGYOZ6DO.mjs} +6 -4
  13. package/dist/{token-goat-chunk-JXK2HQXS.mjs → token-goat-chunk-C5YPNZKQ.mjs} +3 -3
  14. package/dist/{token-goat-chunk-MVSWBNMD.mjs → token-goat-chunk-CIQ2FTY3.mjs} +19 -14
  15. package/dist/{token-goat-chunk-BJBRGPBX.mjs → token-goat-chunk-D4ETHJD6.mjs} +6 -4
  16. package/dist/{token-goat-chunk-VE27HPIF.mjs → token-goat-chunk-DNRPXHYH.mjs} +21 -17
  17. package/dist/{token-goat-chunk-YWSP6IU7.mjs → token-goat-chunk-DNSPXQXQ.mjs} +2 -2
  18. package/dist/token-goat-chunk-DPNLUJWB.mjs +220 -0
  19. package/dist/{token-goat-chunk-I7CB3X4K.mjs → token-goat-chunk-E4ZOJIZK.mjs} +10 -7
  20. package/dist/{token-goat-chunk-IZXKVT4A.mjs → token-goat-chunk-E5TK5DNO.mjs} +11 -4
  21. package/dist/{token-goat-chunk-MMLMALWK.mjs → token-goat-chunk-EUSDXRXU.mjs} +60 -12
  22. package/dist/{token-goat-chunk-7R2XYKC5.mjs → token-goat-chunk-FTP4U4QA.mjs} +12 -9
  23. package/dist/{token-goat-chunk-LEG3JNJ6.mjs → token-goat-chunk-G23DWHV4.mjs} +17 -14
  24. package/dist/{token-goat-chunk-L7SDVGBT.mjs → token-goat-chunk-G7IWXCFF.mjs} +49 -23
  25. package/dist/{token-goat-chunk-NILVK7XM.mjs → token-goat-chunk-GLXRTTLE.mjs} +7 -5
  26. package/dist/{token-goat-chunk-6CCQDAYY.mjs → token-goat-chunk-H5J3C56Q.mjs} +35 -16
  27. package/dist/{token-goat-chunk-Q4S3UQGO.mjs → token-goat-chunk-HNFZZHFW.mjs} +2 -2
  28. package/dist/{token-goat-chunk-CBMY2FGI.mjs → token-goat-chunk-HUYUHODZ.mjs} +572 -230
  29. package/dist/token-goat-chunk-IVE6U7KV.mjs +53 -0
  30. package/dist/{token-goat-chunk-F7QZRIWM.mjs → token-goat-chunk-IVWI2OCK.mjs} +8 -30
  31. package/dist/{token-goat-chunk-GMOUBOX4.mjs → token-goat-chunk-JTKCQMQA.mjs} +37 -5
  32. package/dist/{token-goat-chunk-6SGLIPQB.mjs → token-goat-chunk-KOPIR3KZ.mjs} +12 -9
  33. package/dist/token-goat-chunk-L7H3U27L.mjs +35 -0
  34. package/dist/{token-goat-chunk-FSTWAOW6.mjs → token-goat-chunk-LZNBQTDK.mjs} +6 -4
  35. package/dist/token-goat-chunk-MELOKFDJ.mjs +199 -0
  36. package/dist/{token-goat-chunk-VWZKZPSR.mjs → token-goat-chunk-NMBWLRHW.mjs} +76 -39
  37. package/dist/{token-goat-chunk-HXNAC4ZF.mjs → token-goat-chunk-O6I2XU4P.mjs} +12 -10
  38. package/dist/{token-goat-chunk-MAMQPC43.mjs → token-goat-chunk-ONXH6NZ5.mjs} +1 -1
  39. package/dist/token-goat-chunk-ORNFMIER.mjs +295 -0
  40. package/dist/{token-goat-chunk-66LODAUT.mjs → token-goat-chunk-PGTH2U4C.mjs} +1 -1
  41. package/dist/{token-goat-chunk-SJEKA7Y2.mjs → token-goat-chunk-PKRWMHVP.mjs} +76 -64
  42. package/dist/{token-goat-chunk-DA43OE7L.mjs → token-goat-chunk-PQ53BSCF.mjs} +1 -1
  43. package/dist/{token-goat-chunk-RSS3TLXU.mjs → token-goat-chunk-PYSUADX4.mjs} +2 -2
  44. package/dist/{token-goat-chunk-EL7M26WP.mjs → token-goat-chunk-QO3LXVVR.mjs} +185 -104
  45. package/dist/{token-goat-chunk-XI2VFAV6.mjs → token-goat-chunk-RLP6J7WR.mjs} +6 -6
  46. package/dist/token-goat-chunk-RQGGMPCR.mjs +205 -0
  47. package/dist/{token-goat-chunk-6Z5ULNE5.mjs → token-goat-chunk-RTMVLHWX.mjs} +165 -60
  48. package/dist/{token-goat-chunk-E3K3BTEQ.mjs → token-goat-chunk-S4VSXURL.mjs} +8 -6
  49. package/dist/{token-goat-chunk-LKSXAMJB.mjs → token-goat-chunk-SE6E4BKJ.mjs} +1 -1
  50. package/dist/token-goat-chunk-TCQANXYC.mjs +351 -0
  51. package/dist/{token-goat-chunk-GGLEE35R.mjs → token-goat-chunk-TDUT2CL6.mjs} +7 -7
  52. package/dist/{token-goat-chunk-CC2PYJM7.mjs → token-goat-chunk-TGOXNAHW.mjs} +54 -112
  53. package/dist/{token-goat-chunk-XKY4VKJ4.mjs → token-goat-chunk-UA5BKWWQ.mjs} +1 -1
  54. package/dist/{token-goat-chunk-UBUKHVYW.mjs → token-goat-chunk-UXSXQQIY.mjs} +1 -1
  55. package/dist/{token-goat-chunk-D5ICEPSB.mjs → token-goat-chunk-VMFWNHGR.mjs} +79 -68
  56. package/dist/token-goat-chunk-VQ6F6T7X.mjs +36 -0
  57. package/dist/{token-goat-chunk-4STDIGYC.mjs → token-goat-chunk-VZQEWRVH.mjs} +6 -4
  58. package/dist/{token-goat-chunk-OSUFN2FV.mjs → token-goat-chunk-XB5KKOCG.mjs} +5 -25
  59. package/dist/{token-goat-chunk-L45ZQRT7.mjs → token-goat-chunk-XYWPOSCN.mjs} +57 -615
  60. package/dist/{token-goat-chunk-4JJBFT7V.mjs → token-goat-chunk-YAGLESS3.mjs} +8 -5
  61. package/dist/token-goat-chunk-YKSRAWUU.mjs +33 -0
  62. package/dist/{token-goat-chunk-F2ARFHLJ.mjs → token-goat-chunk-YOOVFPTP.mjs} +2 -2
  63. package/dist/{token-goat-chunk-EEIDFMEM.mjs → token-goat-chunk-YZAAZU2S.mjs} +12 -3
  64. package/dist/token-goat-chunk-Z6KBMOBI.mjs +53 -0
  65. package/dist/{token-goat-chunk-RJH64KQH.mjs → token-goat-chunk-ZER6EAXZ.mjs} +3 -3
  66. package/dist/token-goat-hook-client.cjs +475 -0
  67. package/dist/token-goat-hook-client.mjs +26 -0
  68. package/dist/token-goat-hook.mjs +31 -27
  69. package/dist/token-goat.core.mjs +9 -44
  70. package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
  71. package/docs/cli.md +3 -2
  72. package/docs/install.md +16 -14
  73. package/package.json +1 -1
  74. package/dist/token-goat-chunk-7MAFDRVR.mjs +0 -47
  75. package/dist/token-goat-chunk-BCN2YQC6.mjs +0 -32
  76. package/dist/token-goat-chunk-D7GHQKQD.mjs +0 -30
  77. package/dist/token-goat-chunk-IFORDBGC.mjs +0 -192
@@ -3,64 +3,8 @@ const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  MAX_CAPTURE_BYTES,
5
5
  canRunPowerShell,
6
- canRunWrappedShell,
7
- clipToDeliveryCap,
8
- deliveredOutputBytes
9
- } from "./token-goat-chunk-F7QZRIWM.mjs";
10
- import {
11
- GH_VIEW_BATCH_HINT_KEY,
12
- SEARCH_COMMAND_RE,
13
- buildGhViewBatchAdvisory,
14
- buildRecallHint,
15
- classifyToolError,
16
- commandOptsOutOfCompression,
17
- extractCatFile,
18
- extractCatFilesMulti,
19
- extractCatJsonPipe,
20
- extractCatSourceFile,
21
- extractCurlDownload,
22
- extractCurlUrl,
23
- extractDirectoryListing,
24
- extractFindCommand,
25
- extractForLoopWcL,
26
- extractGetContentHead,
27
- extractGetContentSelectFirst,
28
- extractGetContentTail,
29
- extractGhViewForBatchAdvisory,
30
- extractGrepPipeChain,
31
- extractHeadFile,
32
- extractLineRangeRead,
33
- extractLineRangeReadsCompound,
34
- extractMarkdownHeadingGrep,
35
- extractNodeFileRead,
36
- extractPowerShellFileMethodRead,
37
- extractPowerShellJsonPipeline,
38
- extractPowerShellWrappedGetContent,
39
- extractPythonFileRead,
40
- extractRgStructuralSearch,
41
- extractRgSymbolSearch,
42
- extractTailFile,
43
- extractTasksOutput,
44
- extractTerminalXmlParsing,
45
- extractTgSurgicalRead,
46
- extractToolResultsFile,
47
- extractWslCatFile,
48
- findRangeOverlap,
49
- isCompressibleSingleCommand,
50
- isCurlGetCommand,
51
- isReadOnlyGhApi,
52
- isTscCommand,
53
- leadingLinesHint,
54
- sedOverlapHint,
55
- sedRangeHint,
56
- shellQuoteSingle,
57
- splitShellSegments,
58
- sqlTableHint,
59
- stripLeadingAssignments,
60
- surgicalHintFor,
61
- surgicalHintForConfigDoc,
62
- taskOutputIsJsonlTranscript
63
- } from "./token-goat-chunk-I7CB3X4K.mjs";
6
+ canRunWrappedShell
7
+ } from "./token-goat-chunk-IVWI2OCK.mjs";
64
8
  import {
65
9
  DEFAULT_RECONCILE_BUDGET_MS,
66
10
  HOOK_EVENTS,
@@ -75,10 +19,11 @@ import {
75
19
  readStdinJson,
76
20
  reconcileProject,
77
21
  storeWebOutput
78
- } from "./token-goat-chunk-VE27HPIF.mjs";
22
+ } from "./token-goat-chunk-DNRPXHYH.mjs";
79
23
  import {
80
24
  OUTLINE_MAX_REPLACEMENT_RATIO,
81
25
  OUTLINE_MIN_HEADINGS,
26
+ SLICE_ESTIMATE_SCAN_CAP_BYTES,
82
27
  appendDirtyPath,
83
28
  applyHintTracking,
84
29
  buildDeltaCapsule,
@@ -86,6 +31,7 @@ import {
86
31
  classifyBashHint,
87
32
  classifyEditHint,
88
33
  compactPathFor,
34
+ countTextLines,
89
35
  enqueueDirtyPathSafe,
90
36
  ensureWorkerAlive,
91
37
  fenceUntrusted,
@@ -127,7 +73,66 @@ import {
127
73
  uncorrelatedHint,
128
74
  visionTokens,
129
75
  visionTokensSaved
130
- } from "./token-goat-chunk-6Z5ULNE5.mjs";
76
+ } from "./token-goat-chunk-RTMVLHWX.mjs";
77
+ import {
78
+ clipToDeliveryCap,
79
+ deliveredOutputBytes
80
+ } from "./token-goat-chunk-L7H3U27L.mjs";
81
+ import {
82
+ GH_VIEW_BATCH_HINT_KEY,
83
+ SEARCH_COMMAND_RE,
84
+ buildGhViewBatchAdvisory,
85
+ buildRecallHint,
86
+ classifyCatPath,
87
+ classifyToolError,
88
+ commandOptsOutOfCompression,
89
+ extractCatFile,
90
+ extractCatFilesMulti,
91
+ extractCatJsonPipe,
92
+ extractCatSourceFile,
93
+ extractCurlDownload,
94
+ extractCurlUrl,
95
+ extractDirectoryListing,
96
+ extractFindCommand,
97
+ extractForLoopWcL,
98
+ extractGetContentHead,
99
+ extractGetContentSelectFirst,
100
+ extractGetContentTail,
101
+ extractGhViewForBatchAdvisory,
102
+ extractGrepPipeChain,
103
+ extractHeadFile,
104
+ extractLineRangeRead,
105
+ extractLineRangeReadsCompound,
106
+ extractMarkdownHeadingGrep,
107
+ extractNodeFileRead,
108
+ extractPowerShellFileMethodRead,
109
+ extractPowerShellJsonPipeline,
110
+ extractPowerShellWrappedGetContent,
111
+ extractPythonFileRead,
112
+ extractRgStructuralSearch,
113
+ extractRgSymbolSearch,
114
+ extractTailFile,
115
+ extractTasksOutput,
116
+ extractTerminalXmlParsing,
117
+ extractTgSurgicalRead,
118
+ extractToolResultsFile,
119
+ extractWslCatFile,
120
+ findRangeOverlap,
121
+ isCompressibleSingleCommand,
122
+ isCurlGetCommand,
123
+ isReadOnlyGhApi,
124
+ isTscCommand,
125
+ leadingLinesHint,
126
+ sedOverlapHint,
127
+ sedRangeHint,
128
+ shellQuoteSingle,
129
+ splitShellSegments,
130
+ sqlTableHint,
131
+ stripLeadingAssignments,
132
+ surgicalHintFor,
133
+ surgicalHintForConfigDoc,
134
+ taskOutputIsJsonlTranscript
135
+ } from "./token-goat-chunk-E4ZOJIZK.mjs";
131
136
  import {
132
137
  BODY_FIRST_TOOL_RESPONSE_KEYS,
133
138
  OUTPUT_FIRST_TOOL_RESPONSE_KEYS,
@@ -156,7 +161,7 @@ import {
156
161
  structuredResultCount,
157
162
  vscodePathAllowed,
158
163
  withPreservedBlocks
159
- } from "./token-goat-chunk-IZXKVT4A.mjs";
164
+ } from "./token-goat-chunk-E5TK5DNO.mjs";
160
165
  import {
161
166
  compressOutput,
162
167
  detectFromCommand,
@@ -165,13 +170,13 @@ import {
165
170
  looksLikePytestOutput,
166
171
  pytestFilter,
167
172
  resolveMinNetSavingsBytes
168
- } from "./token-goat-chunk-RJH64KQH.mjs";
173
+ } from "./token-goat-chunk-ZER6EAXZ.mjs";
169
174
  import {
170
175
  projectTranscriptsDir
171
- } from "./token-goat-chunk-6DQNNFJ6.mjs";
176
+ } from "./token-goat-chunk-44BM7DDQ.mjs";
172
177
  import {
173
178
  readCopilotHooksOwners
174
- } from "./token-goat-chunk-MMLMALWK.mjs";
179
+ } from "./token-goat-chunk-EUSDXRXU.mjs";
175
180
  import {
176
181
  BUDGET_ESCALATION_MARKER,
177
182
  MANIFEST_PREAMBLE,
@@ -180,7 +185,7 @@ import {
180
185
  manifestPrintedPaths,
181
186
  projectNotesFor,
182
187
  summaryBudgetDirective
183
- } from "./token-goat-chunk-L7SDVGBT.mjs";
188
+ } from "./token-goat-chunk-G7IWXCFF.mjs";
184
189
  import {
185
190
  extractCompactFromMarker,
186
191
  hasSessionOutput,
@@ -191,7 +196,7 @@ import {
191
196
  sessionOutputBodyBytes,
192
197
  sessionSidecarPath,
193
198
  storeOutput
194
- } from "./token-goat-chunk-6CCQDAYY.mjs";
199
+ } from "./token-goat-chunk-H5J3C56Q.mjs";
195
200
  import {
196
201
  GENERIC_SERVED_OUTPUT_KEY,
197
202
  clearCurlDownload,
@@ -231,7 +236,7 @@ import {
231
236
  wasCliReadThisSession,
232
237
  wasFileReadThisSession,
233
238
  wasHintShown
234
- } from "./token-goat-chunk-GGLEE35R.mjs";
239
+ } from "./token-goat-chunk-TDUT2CL6.mjs";
235
240
  import {
236
241
  accumulateResidentLines,
237
242
  claudeConfigDir,
@@ -240,7 +245,7 @@ import {
240
245
  repeatedSkillBodyHint,
241
246
  summarizeResidentContext,
242
247
  taskListPruneHint
243
- } from "./token-goat-chunk-MAMQPC43.mjs";
248
+ } from "./token-goat-chunk-ONXH6NZ5.mjs";
244
249
  import {
245
250
  BASH_OUTPUT_SUBDIR,
246
251
  bashOutputIdSync,
@@ -254,71 +259,74 @@ import {
254
259
  isTestRunnerCommand,
255
260
  storeBashOutput,
256
261
  summarizeOutputDelta
257
- } from "./token-goat-chunk-HXNAC4ZF.mjs";
262
+ } from "./token-goat-chunk-O6I2XU4P.mjs";
258
263
  import {
259
264
  storeBlob
260
- } from "./token-goat-chunk-BJBRGPBX.mjs";
265
+ } from "./token-goat-chunk-D4ETHJD6.mjs";
261
266
  import {
262
267
  estimateTokens
263
- } from "./token-goat-chunk-4JMWPWCS.mjs";
268
+ } from "./token-goat-chunk-52NSDWYY.mjs";
264
269
  import {
265
270
  dedupeConsecutive,
266
271
  hasBareBackground,
267
272
  hasBareBackgroundOrNewline,
268
273
  hasUnquotedOperator,
274
+ maskQuotedSpans,
269
275
  pathStem,
270
276
  shlexSplit,
271
277
  splitOwnTrailingNotices
272
- } from "./token-goat-chunk-4RN64ZND.mjs";
278
+ } from "./token-goat-chunk-2WOUYWLM.mjs";
273
279
  import {
274
280
  recordStat,
275
281
  redactSecrets,
276
282
  savedTokensFromBytes,
277
283
  stripAnsiEscapes
278
- } from "./token-goat-chunk-MVSWBNMD.mjs";
284
+ } from "./token-goat-chunk-CIQ2FTY3.mjs";
279
285
  import {
280
286
  extractMarkdownHeadings,
281
287
  formatHeadingTreeParts
282
- } from "./token-goat-chunk-D5ICEPSB.mjs";
288
+ } from "./token-goat-chunk-VMFWNHGR.mjs";
283
289
  import {
284
290
  countSymbols,
285
291
  querySymbols
286
- } from "./token-goat-chunk-HUDC5GS5.mjs";
292
+ } from "./token-goat-chunk-435UQTKD.mjs";
287
293
  import {
288
294
  buildLineIndex,
289
295
  detectLanguage,
290
296
  getDb,
291
297
  languageHasFlag,
292
298
  offsetToLine
293
- } from "./token-goat-chunk-M56BWPBN.mjs";
299
+ } from "./token-goat-chunk-7CPMDFGB.mjs";
294
300
  import {
295
301
  detectHarness,
296
- envBool,
297
- envInt,
298
302
  findProject,
299
303
  getHarnessName,
300
304
  isUnderSystemTemp,
301
305
  loadConfig,
306
+ relaySeededSessionId,
307
+ setRelaySeededSessionId,
302
308
  shortFingerprint
303
- } from "./token-goat-chunk-CC2PYJM7.mjs";
309
+ } from "./token-goat-chunk-TGOXNAHW.mjs";
310
+ import {
311
+ envBool,
312
+ envInt
313
+ } from "./token-goat-chunk-IVE6U7KV.mjs";
304
314
  import {
305
- ENV_KEYS,
306
315
  IDENTICAL_READ_MIN_BODY_BYTES,
307
316
  PER_FILE_COUNTERFACTUAL_CEILING,
308
- VERSION,
309
317
  atomicWriteText,
310
318
  containsLineRun,
311
319
  countNoun,
312
- dataDir,
313
320
  ensureDirSync,
314
321
  extractErrorMessage,
315
- foldPath,
316
- globalDbPath,
317
322
  hasCreatedConfig,
318
- isInsideRoot,
319
323
  runGit,
320
324
  toKB
321
- } from "./token-goat-chunk-L45ZQRT7.mjs";
325
+ } from "./token-goat-chunk-XYWPOSCN.mjs";
326
+ import {
327
+ foldPath,
328
+ isInsideRoot
329
+ } from "./token-goat-chunk-TCQANXYC.mjs";
322
330
  import {
323
331
  UNTRUSTED_TOOL_TAG,
324
332
  displaySafePath,
@@ -329,6 +337,12 @@ import {
329
337
  resolveIndexPath,
330
338
  toDisplayPath
331
339
  } from "./token-goat-chunk-NMTKNYGF.mjs";
340
+ import {
341
+ ENV_KEYS,
342
+ VERSION,
343
+ dataDir,
344
+ globalDbPath
345
+ } from "./token-goat-chunk-MELOKFDJ.mjs";
332
346
  import {
333
347
  init_define_import_meta_env
334
348
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -349,8 +363,19 @@ function stripCdPrefix(cmd) {
349
363
  const stripped = cmd.replace(CD_PREFIX_RE, "");
350
364
  return stripped.trim() || cmd;
351
365
  }
366
+ function stripSubshellGroup(cmd) {
367
+ const t = cmd.trim();
368
+ if (!t.startsWith("(") || t.startsWith("((") || !t.endsWith(")")) return cmd;
369
+ const masked = maskQuotedSpans(t);
370
+ let depth = 0;
371
+ for (let i = 0; i < masked.length; i++) {
372
+ if (masked[i] === "(") depth++;
373
+ else if (masked[i] === ")" && --depth === 0) return i === masked.length - 1 ? t.slice(1, -1).trim() || cmd : cmd;
374
+ }
375
+ return cmd;
376
+ }
352
377
  function stripCommandPrefix(rawCmd) {
353
- return stripLeadingAssignments(stripCdPrefix(rawCmd));
378
+ return stripLeadingAssignments(stripCdPrefix(stripSubshellGroup(rawCmd)));
354
379
  }
355
380
  function stripTrailingStderrRedirect(cmd) {
356
381
  const stripped = cmd.replace(/\s*2>&1\s*$/, "");
@@ -365,7 +390,7 @@ function isDirectTestRunnerCommand(cmd) {
365
390
  return /^(?:pytest|(?:npx\s+)?(?:jest|vitest)|go\s+test|cargo\s+test)\b/i.test(cmd);
366
391
  }
367
392
  function extractCdPrefixDirs(rawCmd) {
368
- const prefixMatch = rawCmd.match(CD_PREFIX_RE);
393
+ const prefixMatch = stripSubshellGroup(rawCmd).match(CD_PREFIX_RE);
369
394
  if (prefixMatch === null) return [];
370
395
  const dirs = [];
371
396
  const segmentPattern = /cd\s+(?:"([^"]*)"|'([^']*)'|(\S+))[ \t]*(?:&&|;|\r?\n)/g;
@@ -1598,7 +1623,7 @@ init_define_import_meta_env();
1598
1623
  var TRACKED_SKILL = "token-goat";
1599
1624
  var MAX_COMMANDS_SHOWN = 8;
1600
1625
  async function currentCommandNames() {
1601
- const { buildProgram } = await import("./token-goat-chunk-IFORDBGC.mjs");
1626
+ const { buildProgram } = await import("./token-goat-chunk-HUYUHODZ.mjs");
1602
1627
  return flattenCommandNames(buildCommandManifest(buildProgram()));
1603
1628
  }
1604
1629
  async function recordSkillVersionSnapshot(sessionId, skillName) {
@@ -1870,7 +1895,7 @@ async function postCompactRecovery(event) {
1870
1895
  if (event.raw["source"] !== "compact" || event.sessionId === void 0) return null;
1871
1896
  if (!loadConfig().compact_assist.enabled) return null;
1872
1897
  try {
1873
- const { buildResumePacket } = await import("./token-goat-chunk-D7GHQKQD.mjs");
1898
+ const { buildResumePacket } = await import("./token-goat-chunk-YKSRAWUU.mjs");
1874
1899
  return await buildResumePacket(event.sessionId);
1875
1900
  } catch {
1876
1901
  return null;
@@ -8199,14 +8224,14 @@ function resolveSkillContext(event) {
8199
8224
  }
8200
8225
  return { skillName };
8201
8226
  }
8202
- function planHeadingTree(body, bodyBytes, skillName) {
8227
+ function planHeadingTree(body, bodyBytes, skillName, sourcePath) {
8203
8228
  const headings = extractMarkdownHeadings(body);
8204
8229
  if (headings.length < OUTLINE_MIN_HEADINGS) return null;
8205
8230
  const { sectionsList } = formatHeadingTreeParts(headings, skillName);
8206
8231
  const treeBytes = Buffer.byteLength(sectionsList, "utf-8");
8207
8232
  if (treeBytes > bodyBytes * OUTLINE_MAX_REPLACEMENT_RATIO) return null;
8208
8233
  const totalHeadings = extractMarkdownHeadings(body, Number.MAX_SAFE_INTEGER).length;
8209
- const phrase = totalHeadings > headings.length ? "its heading tree shows " + headings.length + " of " + totalHeadings + " headings below instead of the full body; the remaining sections are reachable only through `token-goat skill-body " + skillName + "`." : "its heading tree (" + headings.length + " headings) is inlined below instead of the full body.";
8234
+ const phrase = totalHeadings > headings.length ? "its heading tree shows " + headings.length + " of " + totalHeadings + " headings below instead of the full body; the other " + (totalHeadings - headings.length) + ' load by name just the same, and `token-goat outline "' + displaySafeText(sourcePath) + '"` lists all ' + totalHeadings + "." : "its heading tree (" + headings.length + " headings) is inlined below instead of the full body.";
8210
8235
  return { sectionsList, treeBytes, phrase };
8211
8236
  }
8212
8237
  async function preSkillHandler(event) {
@@ -8244,7 +8269,7 @@ async function preSkillHandler(event) {
8244
8269
  );
8245
8270
  }
8246
8271
  }
8247
- const tree = planHeadingTree(body, bodyBytes, skillName);
8272
+ const tree = planHeadingTree(body, bodyBytes, skillName, sourcePath);
8248
8273
  if (tree !== null) {
8249
8274
  const replaced = compact !== null ? Buffer.byteLength(compact, "utf-8") : bodyBytes;
8250
8275
  const savedBytes = Math.max(0, replaced - tree.treeBytes);
@@ -8719,15 +8744,38 @@ function maybeFoldCurlHtml(cmd, output, id) {
8719
8744
  }
8720
8745
  return emitRewrite(notice + fenced, "curl HTML body cleaned", { kind: "bash_compress:curl-html", originalBytes: deliveredOutputBytes(originalBytes) });
8721
8746
  }
8747
+ function wholeFileRange(filePath, hintPath, cwd, ranges, tool) {
8748
+ const [range] = ranges;
8749
+ if (ranges.length !== 1 || range === void 0 || range[0] > 1) return null;
8750
+ const cat = classifyCatPath(filePath, tool);
8751
+ if (cat === null) return null;
8752
+ try {
8753
+ const resolved = resolveIndexPath(hintPath, cwd);
8754
+ const st = statSync7(resolved);
8755
+ if (!st.isFile() || st.size > SLICE_ESTIMATE_SCAN_CAP_BYTES) return null;
8756
+ const total = countTextLines(readFileSync5(resolved, "utf8"));
8757
+ if (total === 0 || range[1] < total) return null;
8758
+ return { start: range[0], end: range[1], cat, reason: "`" + tool + "` over lines " + range[0] + "-" + range[1] + " is the whole file (" + total + " lines), and loads all of it into context." };
8759
+ } catch {
8760
+ return null;
8761
+ }
8762
+ }
8722
8763
  function preBashHandlerInner(event) {
8723
8764
  const rawCmd = extractCommand(event);
8724
8765
  if (rawCmd === void 0) return passOutput();
8725
8766
  const cmd = stripCommandPrefix(rawCmd);
8726
- const cdStripped = stripCdPrefix(rawCmd) !== rawCmd;
8767
+ const grouped = stripSubshellGroup(rawCmd);
8768
+ const cdStripped = stripCdPrefix(grouped) !== grouped;
8727
8769
  const preHookCwd = getCwd(event) ?? null;
8728
8770
  const hintCwd = preHookCwd ?? process.cwd();
8729
8771
  const pathHint = (paths, text) => contextOutput(text, typeof paths === "string" ? [paths] : paths);
8730
8772
  const targetFor = (hintPath, slice = sliceForPath(hintPath)) => hintTarget(hintPath, slice, { cwd: hintCwd, event });
8773
+ const taskOutputPath = (typed) => {
8774
+ if (!commandPathIsTouchable(typed, event)) return null;
8775
+ if (path4.isAbsolute(typed) || path4.win32.isAbsolute(typed)) return { probe: typed, shown: displaySafePath(typed) };
8776
+ const probe = resolveIndexPath(typed, cdPrefixCwd(rawCmd, hintCwd));
8777
+ return { probe, shown: displaySafePath(probe) };
8778
+ };
8731
8779
  const pricedSubstitute = (hintPath, start, end) => {
8732
8780
  const sub = rangeSubstituteFor(hintPath, hintCwd, [[start, end]]);
8733
8781
  return sub !== null && meetsSavingsFloor(sub.requestedBytes - sub.replacementBytes) ? sub : null;
@@ -8754,9 +8802,11 @@ function preBashHandlerInner(event) {
8754
8802
  }
8755
8803
  const taskOutput = extractTasksOutput(cmd);
8756
8804
  if (taskOutput !== null) {
8757
- const { id, path: outPath, n } = taskOutput;
8805
+ const { id, n } = taskOutput;
8806
+ const outPaths = taskOutputPath(taskOutput.path);
8758
8807
  recordStat("session_hint", 0, 0);
8759
- if (taskOutputIsJsonlTranscript(outPath)) {
8808
+ if (outPaths !== null && taskOutputIsJsonlTranscript(outPaths.probe)) {
8809
+ const outPath = outPaths.shown;
8760
8810
  const tail = n ?? 50;
8761
8811
  return denyOutput(
8762
8812
  "Task output " + id + ' is a JSONL agent transcript on disk. Use `token-goat bash-output --file "' + outPath + '" --transcript` to read the assistant text, then narrow with `--grep PATTERN` or `--tail ' + tail + '`, or read a specific line range (the only way to reach the MIDDLE of a large artifact) with `token-goat read "' + outPath + '@START-END"`, instead of reading the whole file.'
@@ -8816,6 +8866,13 @@ function preBashHandlerInner(event) {
8816
8866
  const hintPath = displaySafePath(cdStripped ? resolveCdHintPath(rawCmd, filePath, hintCwd) : filePath);
8817
8867
  hintPaths.push(hintPath);
8818
8868
  const sedDedupKey = resolveIndexPath(hintPath, preHookCwd ?? process.cwd());
8869
+ const whole = singleLineRangeRead === null ? null : wholeFileRange(filePath, hintPath, hintCwd, ranges, tool);
8870
+ if (whole !== null && findRangeOverlap(getFileLineRanges(sedDedupKey), whole.start, whole.end) === null) {
8871
+ recordStat("session_hint", 0, 0);
8872
+ if (whole.cat.isSql) return pathHint(hintPath, sqlTableHint(hintPath, targetFor(hintPath, "table"), whole.reason));
8873
+ const hint = surgicalHintFor(hintPath, whole.cat.isEnv, whole.cat.isConfig, whole.cat.isDoc, whole.cat.isXml, targetFor(hintPath, whole.cat.isEnv ? "key" : void 0), whole.reason);
8874
+ return cdStripped ? pathHint(hintPath, hint) : denyOutput(hint);
8875
+ }
8819
8876
  const overlapHints = [];
8820
8877
  const freshRanges = [];
8821
8878
  for (const [start, end] of ranges) {
@@ -8933,8 +8990,9 @@ function preBashHandlerInner(event) {
8933
8990
  const hintPath = displaySafePath(cdStripped ? resolveCdHintPath(rawCmd, filePath, hintCwd) : filePath);
8934
8991
  recordStat("session_hint", 0, 0);
8935
8992
  if (isOutputFile) {
8936
- if (taskOutputIsJsonlTranscript(filePath)) {
8937
- const tHint = 'This `.output` file is a JSONL agent transcript. Use `token-goat bash-output --file "' + hintPath + '" --transcript` to read the assistant text, then narrow with `--grep PATTERN` or `--tail N`, instead of hand-parsing the JSONL.';
8993
+ const outPaths = taskOutputPath(filePath);
8994
+ if (outPaths !== null && taskOutputIsJsonlTranscript(outPaths.probe)) {
8995
+ const tHint = 'This `.output` file is a JSONL agent transcript. Use `token-goat bash-output --file "' + outPaths.shown + '" --transcript` to read the assistant text, then narrow with `--grep PATTERN` or `--tail N`, instead of hand-parsing the JSONL.';
8938
8996
  return cdStripped ? pathHint(hintPath, tHint) : denyOutput(tHint);
8939
8997
  }
8940
8998
  return pathHint(
@@ -10974,13 +11032,24 @@ function safeSuggestions(output) {
10974
11032
  return output;
10975
11033
  }
10976
11034
  var relayQueue = Promise.resolve();
10977
- function relayInProcess(eventName, rawPayload, harnessWaitMs) {
11035
+ var RELAY_QUEUE_WAIT_MS = 12e4;
11036
+ function afterPredecessor(previous) {
11037
+ return new Promise((resolve2) => {
11038
+ const timer = setTimeout(resolve2, RELAY_QUEUE_WAIT_MS);
11039
+ timer.unref();
11040
+ void previous.then(() => {
11041
+ clearTimeout(timer);
11042
+ resolve2();
11043
+ });
11044
+ });
11045
+ }
11046
+ function relayInProcess(eventName, rawPayload, harnessWaitMs, opts = {}) {
10978
11047
  const receivedAt = Date.now();
10979
- const run = relayQueue.then(() => relayOne(eventName, rawPayload, harnessWaitMs, receivedAt));
11048
+ const run = afterPredecessor(relayQueue).then(() => relayOne(eventName, rawPayload, harnessWaitMs, receivedAt, opts.elapsedMs ?? (() => performance.now()), opts.afterReply));
10980
11049
  relayQueue = run.catch(() => void 0);
10981
11050
  return run;
10982
11051
  }
10983
- async function relayOne(eventName, rawPayload, harnessWaitMs, receivedAt) {
11052
+ async function relayOne(eventName, rawPayload, harnessWaitMs, receivedAt, elapsedMs, afterReply) {
10984
11053
  if (!isHookEventName(eventName)) {
10985
11054
  return "{}";
10986
11055
  }
@@ -10989,8 +11058,16 @@ async function relayOne(eventName, rawPayload, harnessWaitMs, receivedAt) {
10989
11058
  const payload = eventName === "pre_tool_use" || eventName === "post_tool_use" ? normalizePayload(rawPayload, harnessForNormalization()) : rawPayload;
10990
11059
  const event = buildEvent(eventName, payload);
10991
11060
  if (shouldSuppressDuplicateVscodeHook(event, harness)) return "{}";
10992
- if (!process.env["CLAUDE_CODE_SESSION_ID"] && event.sessionId) {
10993
- process.env["CLAUDE_CODE_SESSION_ID"] = event.sessionId;
11061
+ const envSessionId = process.env["CLAUDE_CODE_SESSION_ID"];
11062
+ const seededSessionId = relaySeededSessionId();
11063
+ if (!envSessionId || envSessionId === seededSessionId) {
11064
+ if (event.sessionId) {
11065
+ process.env["CLAUDE_CODE_SESSION_ID"] = event.sessionId;
11066
+ setRelaySeededSessionId(event.sessionId);
11067
+ } else if (seededSessionId !== void 0) {
11068
+ delete process.env["CLAUDE_CODE_SESSION_ID"];
11069
+ setRelaySeededSessionId(void 0);
11070
+ }
10994
11071
  }
10995
11072
  const rawTranscriptPath = event.raw["transcript_path"];
10996
11073
  if (typeof rawTranscriptPath === "string" && rawTranscriptPath !== "") {
@@ -11019,7 +11096,10 @@ async function relayOne(eventName, rawPayload, harnessWaitMs, receivedAt) {
11019
11096
  } catch {
11020
11097
  return "{}";
11021
11098
  } finally {
11022
- recordStat(`hook:${eventName}`, 0, 0, void 0, void 0, void 0, harnessWaitMs ?? performance.now());
11099
+ const durationMs = harnessWaitMs ?? elapsedMs();
11100
+ const record = () => recordStat(`hook:${eventName}`, 0, 0, void 0, void 0, void 0, durationMs);
11101
+ if (afterReply) afterReply(record);
11102
+ else record();
11023
11103
  }
11024
11104
  }
11025
11105
  async function relay(eventName) {
@@ -11045,6 +11125,7 @@ async function relay(eventName) {
11045
11125
 
11046
11126
  export {
11047
11127
  buildEvent,
11128
+ RELAY_QUEUE_WAIT_MS,
11048
11129
  relayInProcess,
11049
11130
  relay
11050
11131
  };
@@ -2,26 +2,26 @@ import { createRequire as __cjsRequire } from 'node:module';
2
2
  const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  renderWebFetchRow
5
- } from "./token-goat-chunk-L7SDVGBT.mjs";
5
+ } from "./token-goat-chunk-G7IWXCFF.mjs";
6
6
  import {
7
7
  SESSIONS_SUBDIR,
8
8
  extractChecklistSection,
9
9
  getSkillFilePath,
10
10
  listSkills
11
- } from "./token-goat-chunk-6CCQDAYY.mjs";
11
+ } from "./token-goat-chunk-H5J3C56Q.mjs";
12
12
  import {
13
13
  getBashOutput
14
- } from "./token-goat-chunk-HXNAC4ZF.mjs";
14
+ } from "./token-goat-chunk-O6I2XU4P.mjs";
15
15
  import {
16
16
  loadBlob
17
- } from "./token-goat-chunk-BJBRGPBX.mjs";
17
+ } from "./token-goat-chunk-D4ETHJD6.mjs";
18
18
  import {
19
19
  resolveProjectRoot
20
- } from "./token-goat-chunk-CC2PYJM7.mjs";
20
+ } from "./token-goat-chunk-TGOXNAHW.mjs";
21
21
  import {
22
22
  runGit,
23
23
  safeSlice
24
- } from "./token-goat-chunk-L45ZQRT7.mjs";
24
+ } from "./token-goat-chunk-XYWPOSCN.mjs";
25
25
  import {
26
26
  displaySafePath,
27
27
  displaySafeText,