@joshuafolkken/kit 1.872.0 → 1.879.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/.github/workflows/publish.yml +39 -2
  2. package/README.md +3 -3
  3. package/package.json +6 -2
  4. package/scripts/init/distributed-paths.ts +14 -11
  5. package/scripts/init/hook-command-bootstrap.ts +51 -0
  6. package/scripts/init/hook-command-rewrite.ts +9 -1
  7. package/scripts/init/init-logic.ts +2 -8
  8. package/templates/workflows/ci.yml +6 -2
  9. package/dist/hooks/chunk-25JL6FMS.js +0 -4970
  10. package/dist/hooks/chunk-2ANGT3XM.js +0 -375
  11. package/dist/hooks/chunk-2EI5GBSW.js +0 -42
  12. package/dist/hooks/chunk-2OT5XE2N.js +0 -5014
  13. package/dist/hooks/chunk-33ELOKEV.js +0 -910
  14. package/dist/hooks/chunk-33YRTKM7.js +0 -230
  15. package/dist/hooks/chunk-36JQU5NN.js +0 -77
  16. package/dist/hooks/chunk-3EJBTWVS.js +0 -1769
  17. package/dist/hooks/chunk-3FK5SFAC.js +0 -432
  18. package/dist/hooks/chunk-3PWPYDD2.js +0 -240
  19. package/dist/hooks/chunk-3TQU7TDH.js +0 -375
  20. package/dist/hooks/chunk-3TVLSFZ6.js +0 -432
  21. package/dist/hooks/chunk-3VXYCB4E.js +0 -77
  22. package/dist/hooks/chunk-44M6JXGV.js +0 -3398
  23. package/dist/hooks/chunk-46EEEHC3.js +0 -240
  24. package/dist/hooks/chunk-4A7UVP2P.js +0 -364
  25. package/dist/hooks/chunk-4LFQEZS4.js +0 -137
  26. package/dist/hooks/chunk-4OCX3V2T.js +0 -469
  27. package/dist/hooks/chunk-4OHA5DE7.js +0 -49
  28. package/dist/hooks/chunk-4PMDW3YD.js +0 -68
  29. package/dist/hooks/chunk-4QHBNAI4.js +0 -68
  30. package/dist/hooks/chunk-4SSB3FEE.js +0 -3273
  31. package/dist/hooks/chunk-5A2WQ2CQ.js +0 -5390
  32. package/dist/hooks/chunk-5EVA2JQB.js +0 -5390
  33. package/dist/hooks/chunk-5P7VF5VE.js +0 -3230
  34. package/dist/hooks/chunk-5QWJGGZP.js +0 -49
  35. package/dist/hooks/chunk-5U5EZYG6.js +0 -77
  36. package/dist/hooks/chunk-5VUUF3ZV.js +0 -240
  37. package/dist/hooks/chunk-5WA7UBT3.js +0 -374
  38. package/dist/hooks/chunk-6EBGRQ3Q.js +0 -301
  39. package/dist/hooks/chunk-6TVHWMD3.js +0 -432
  40. package/dist/hooks/chunk-6VAGLEMB.js +0 -68
  41. package/dist/hooks/chunk-75BTXKFJ.js +0 -3424
  42. package/dist/hooks/chunk-75RHN67S.js +0 -137
  43. package/dist/hooks/chunk-76KC3BDD.js +0 -3414
  44. package/dist/hooks/chunk-76SLS7CZ.js +0 -898
  45. package/dist/hooks/chunk-7DHZ4DWT.js +0 -5015
  46. package/dist/hooks/chunk-7INSJDGE.js +0 -458
  47. package/dist/hooks/chunk-7VJ4FTDX.js +0 -268
  48. package/dist/hooks/chunk-7XCYNHQK.js +0 -77
  49. package/dist/hooks/chunk-A5YJ3H7E.js +0 -375
  50. package/dist/hooks/chunk-AAEXXUUL.js +0 -268
  51. package/dist/hooks/chunk-ABVEVV2M.js +0 -432
  52. package/dist/hooks/chunk-ACN3YXFL.js +0 -68
  53. package/dist/hooks/chunk-AD3XE3QZ.js +0 -397
  54. package/dist/hooks/chunk-AENFZPZH.js +0 -230
  55. package/dist/hooks/chunk-AFKRFQ6W.js +0 -68
  56. package/dist/hooks/chunk-AHD5IPWI.js +0 -375
  57. package/dist/hooks/chunk-AMK5JGV7.js +0 -77
  58. package/dist/hooks/chunk-ARN7NCQI.js +0 -425
  59. package/dist/hooks/chunk-AUFY653N.js +0 -3425
  60. package/dist/hooks/chunk-AXQBNFEF.js +0 -375
  61. package/dist/hooks/chunk-AYC7R6U4.js +0 -3316
  62. package/dist/hooks/chunk-AYEA2FJ7.js +0 -5015
  63. package/dist/hooks/chunk-B4HPNY2I.js +0 -375
  64. package/dist/hooks/chunk-B57S3VWT.js +0 -922
  65. package/dist/hooks/chunk-BINZ3PLI.js +0 -364
  66. package/dist/hooks/chunk-BODUSXKK.js +0 -410
  67. package/dist/hooks/chunk-BQBAT2YK.js +0 -375
  68. package/dist/hooks/chunk-BUJEBW75.js +0 -391
  69. package/dist/hooks/chunk-BVNWORKA.js +0 -72
  70. package/dist/hooks/chunk-BWI47LQS.js +0 -5205
  71. package/dist/hooks/chunk-C25HRMJX.js +0 -137
  72. package/dist/hooks/chunk-CBFZNC74.js +0 -375
  73. package/dist/hooks/chunk-CECYXS4Y.js +0 -3424
  74. package/dist/hooks/chunk-CELGUP5F.js +0 -49
  75. package/dist/hooks/chunk-CMHANU3F.js +0 -3442
  76. package/dist/hooks/chunk-CMN372LI.js +0 -68
  77. package/dist/hooks/chunk-CPGZLMMK.js +0 -3299
  78. package/dist/hooks/chunk-CTQKXDC7.js +0 -268
  79. package/dist/hooks/chunk-CYAT4RIT.js +0 -68
  80. package/dist/hooks/chunk-CYTWYCH2.js +0 -5014
  81. package/dist/hooks/chunk-CZSOLRBA.js +0 -77
  82. package/dist/hooks/chunk-D2PIDYJR.js +0 -3438
  83. package/dist/hooks/chunk-DE57HI6T.js +0 -137
  84. package/dist/hooks/chunk-DGXDGAPG.js +0 -5306
  85. package/dist/hooks/chunk-DNYRSYQG.js +0 -5014
  86. package/dist/hooks/chunk-DTAXH2A2.js +0 -240
  87. package/dist/hooks/chunk-E2IZUWI5.js +0 -375
  88. package/dist/hooks/chunk-E4L2K2BL.js +0 -397
  89. package/dist/hooks/chunk-ECXVCCVD.js +0 -3079
  90. package/dist/hooks/chunk-EPHO443D.js +0 -68
  91. package/dist/hooks/chunk-EUFK2BI2.js +0 -375
  92. package/dist/hooks/chunk-EYCD5ZAV.js +0 -137
  93. package/dist/hooks/chunk-F2SDYJU4.js +0 -240
  94. package/dist/hooks/chunk-F4B5D5TF.js +0 -68
  95. package/dist/hooks/chunk-FGEO3NDX.js +0 -432
  96. package/dist/hooks/chunk-FJYI52RE.js +0 -137
  97. package/dist/hooks/chunk-FYTZHIY4.js +0 -3085
  98. package/dist/hooks/chunk-G7JL2A5K.js +0 -375
  99. package/dist/hooks/chunk-GA3ITDBW.js +0 -42
  100. package/dist/hooks/chunk-GDR4H4SV.js +0 -469
  101. package/dist/hooks/chunk-GFKDXPSM.js +0 -2855
  102. package/dist/hooks/chunk-GIMRTKFU.js +0 -566
  103. package/dist/hooks/chunk-GOPHRLGO.js +0 -240
  104. package/dist/hooks/chunk-GX4HO7SJ.js +0 -230
  105. package/dist/hooks/chunk-GZ6FUVIK.js +0 -566
  106. package/dist/hooks/chunk-H5HPY5M5.js +0 -2869
  107. package/dist/hooks/chunk-HCF3OGEE.js +0 -1829
  108. package/dist/hooks/chunk-HDEXAOUM.js +0 -469
  109. package/dist/hooks/chunk-HM2TY3TN.js +0 -469
  110. package/dist/hooks/chunk-HOA7NXA2.js +0 -55
  111. package/dist/hooks/chunk-HOFEWH6H.js +0 -240
  112. package/dist/hooks/chunk-HUUI6S5J.js +0 -2669
  113. package/dist/hooks/chunk-I4D3NVUD.js +0 -469
  114. package/dist/hooks/chunk-I4Q6WAJE.js +0 -68
  115. package/dist/hooks/chunk-IB6N4CR2.js +0 -432
  116. package/dist/hooks/chunk-IFLDYJMD.js +0 -469
  117. package/dist/hooks/chunk-IGU466YD.js +0 -77
  118. package/dist/hooks/chunk-IJCQUHKY.js +0 -375
  119. package/dist/hooks/chunk-IKUMBDJB.js +0 -230
  120. package/dist/hooks/chunk-IM3BDIBJ.js +0 -5005
  121. package/dist/hooks/chunk-IMYMAODK.js +0 -3431
  122. package/dist/hooks/chunk-IN2ZVGXA.js +0 -5005
  123. package/dist/hooks/chunk-ITVJ2MKQ.js +0 -18
  124. package/dist/hooks/chunk-J5RIJYTM.js +0 -2669
  125. package/dist/hooks/chunk-JFLMH4K5.js +0 -3460
  126. package/dist/hooks/chunk-JR25IFML.js +0 -77
  127. package/dist/hooks/chunk-JT5AUXFI.js +0 -432
  128. package/dist/hooks/chunk-JY5YVN6N.js +0 -3234
  129. package/dist/hooks/chunk-K5Q4ETVI.js +0 -391
  130. package/dist/hooks/chunk-K67V2F24.js +0 -137
  131. package/dist/hooks/chunk-KATZESEC.js +0 -3273
  132. package/dist/hooks/chunk-KFH4H7W7.js +0 -469
  133. package/dist/hooks/chunk-KMUEI6RX.js +0 -910
  134. package/dist/hooks/chunk-KMV4OY77.js +0 -3438
  135. package/dist/hooks/chunk-KQAZNWEY.js +0 -137
  136. package/dist/hooks/chunk-KZZR6JER.js +0 -5015
  137. package/dist/hooks/chunk-LAR6DREP.js +0 -77
  138. package/dist/hooks/chunk-LNCJWEZD.js +0 -5015
  139. package/dist/hooks/chunk-LRYD2GLM.js +0 -6
  140. package/dist/hooks/chunk-LXBKYHDV.js +0 -77
  141. package/dist/hooks/chunk-LYLKIUNE.js +0 -5024
  142. package/dist/hooks/chunk-LZKCFOVC.js +0 -432
  143. package/dist/hooks/chunk-M4FCIYRI.js +0 -77
  144. package/dist/hooks/chunk-M5M7327Q.js +0 -3425
  145. package/dist/hooks/chunk-MF72MHSX.js +0 -3455
  146. package/dist/hooks/chunk-MK56LKDO.js +0 -397
  147. package/dist/hooks/chunk-N3MJADY7.js +0 -240
  148. package/dist/hooks/chunk-NFQSUDBN.js +0 -458
  149. package/dist/hooks/chunk-NHREKY45.js +0 -137
  150. package/dist/hooks/chunk-NP5TTAAW.js +0 -375
  151. package/dist/hooks/chunk-NQTLTKTJ.js +0 -2993
  152. package/dist/hooks/chunk-NVRCZPBZ.js +0 -391
  153. package/dist/hooks/chunk-O46HMMLJ.js +0 -469
  154. package/dist/hooks/chunk-OFJGH2L4.js +0 -240
  155. package/dist/hooks/chunk-OLFMCZH5.js +0 -240
  156. package/dist/hooks/chunk-OMCZS46I.js +0 -49
  157. package/dist/hooks/chunk-OQZEZW5G.js +0 -469
  158. package/dist/hooks/chunk-P2MDAT2Y.js +0 -1897
  159. package/dist/hooks/chunk-P3M2JJIF.js +0 -68
  160. package/dist/hooks/chunk-PDVHQITQ.js +0 -3453
  161. package/dist/hooks/chunk-PNT2AMDH.js +0 -391
  162. package/dist/hooks/chunk-PR2LVSY6.js +0 -3445
  163. package/dist/hooks/chunk-PRR5R4JK.js +0 -137
  164. package/dist/hooks/chunk-PXT44QVN.js +0 -566
  165. package/dist/hooks/chunk-PZLWJLAP.js +0 -469
  166. package/dist/hooks/chunk-Q2FEAZJ2.js +0 -77
  167. package/dist/hooks/chunk-Q32WETDO.js +0 -3265
  168. package/dist/hooks/chunk-Q45DUBLE.js +0 -3600
  169. package/dist/hooks/chunk-Q7NZSWQ5.js +0 -240
  170. package/dist/hooks/chunk-QH2JNAMK.js +0 -3085
  171. package/dist/hooks/chunk-QPU5H2OS.js +0 -68
  172. package/dist/hooks/chunk-QRAHZ5TO.js +0 -1829
  173. package/dist/hooks/chunk-QUZ5HPIE.js +0 -469
  174. package/dist/hooks/chunk-QVCRG34O.js +0 -2893
  175. package/dist/hooks/chunk-R3MY4E3S.js +0 -1675
  176. package/dist/hooks/chunk-R6TXJJXP.js +0 -77
  177. package/dist/hooks/chunk-REJU6VT7.js +0 -1829
  178. package/dist/hooks/chunk-REQAQLRC.js +0 -2993
  179. package/dist/hooks/chunk-RFCXPAHH.js +0 -391
  180. package/dist/hooks/chunk-RHI6Y22X.js +0 -137
  181. package/dist/hooks/chunk-RKZVOBBS.js +0 -469
  182. package/dist/hooks/chunk-RL57TT2Y.js +0 -566
  183. package/dist/hooks/chunk-RORDOD4S.js +0 -3321
  184. package/dist/hooks/chunk-RZKYW5P2.js +0 -77
  185. package/dist/hooks/chunk-SJPJ6VSI.js +0 -391
  186. package/dist/hooks/chunk-SKSIJQQQ.js +0 -432
  187. package/dist/hooks/chunk-SSQDZKXG.js +0 -268
  188. package/dist/hooks/chunk-SYHFKE4C.js +0 -77
  189. package/dist/hooks/chunk-TCGNI2ZY.js +0 -42
  190. package/dist/hooks/chunk-TG3WXJF5.js +0 -137
  191. package/dist/hooks/chunk-TH7IJAY5.js +0 -77
  192. package/dist/hooks/chunk-TLZ27PCY.js +0 -240
  193. package/dist/hooks/chunk-U652FXTN.js +0 -566
  194. package/dist/hooks/chunk-UEK47YUF.js +0 -268
  195. package/dist/hooks/chunk-UIO45H3O.js +0 -432
  196. package/dist/hooks/chunk-UNLZEEVH.js +0 -5005
  197. package/dist/hooks/chunk-UNRVF3SZ.js +0 -432
  198. package/dist/hooks/chunk-USLFAFOI.js +0 -3453
  199. package/dist/hooks/chunk-VAEELMLL.js +0 -442
  200. package/dist/hooks/chunk-VALSWLDQ.js +0 -3453
  201. package/dist/hooks/chunk-VC5JEPNY.js +0 -3398
  202. package/dist/hooks/chunk-VEZVK6C7.js +0 -230
  203. package/dist/hooks/chunk-VK5JKFAR.js +0 -49
  204. package/dist/hooks/chunk-VNF2KP7Z.js +0 -469
  205. package/dist/hooks/chunk-VWWCUMW6.js +0 -2669
  206. package/dist/hooks/chunk-W4JARUQV.js +0 -137
  207. package/dist/hooks/chunk-WEOBMNJG.js +0 -2993
  208. package/dist/hooks/chunk-WKJU3J5Y.js +0 -5390
  209. package/dist/hooks/chunk-WMN4TSVF.js +0 -3299
  210. package/dist/hooks/chunk-WNON54PT.js +0 -3469
  211. package/dist/hooks/chunk-WOVKBPPX.js +0 -137
  212. package/dist/hooks/chunk-WRVFORYJ.js +0 -432
  213. package/dist/hooks/chunk-WUBVYGQZ.js +0 -240
  214. package/dist/hooks/chunk-WWULTUOM.js +0 -68
  215. package/dist/hooks/chunk-WXHKKB45.js +0 -4962
  216. package/dist/hooks/chunk-XAI3YTHJ.js +0 -469
  217. package/dist/hooks/chunk-XFZH6JZJ.js +0 -77
  218. package/dist/hooks/chunk-XGPWX6IA.js +0 -137
  219. package/dist/hooks/chunk-XIXXIVGY.js +0 -566
  220. package/dist/hooks/chunk-XKDOYJGA.js +0 -922
  221. package/dist/hooks/chunk-YALTVBHM.js +0 -432
  222. package/dist/hooks/chunk-YEBEPBFK.js +0 -5014
  223. package/dist/hooks/chunk-YI2BQ3DK.js +0 -3441
  224. package/dist/hooks/chunk-YVNBCFGG.js +0 -1829
  225. package/dist/hooks/chunk-YXBN3RGG.js +0 -432
  226. package/dist/hooks/chunk-Z2OOJSW3.js +0 -3163
  227. package/dist/hooks/chunk-ZA3HVBOY.js +0 -2644
  228. package/dist/hooks/chunk-ZKID46U3.js +0 -137
  229. package/dist/hooks/chunk-ZPMU2JV6.js +0 -49
  230. package/dist/hooks/chunk-ZRKY4W7O.js +0 -432
  231. package/dist/hooks/chunk-ZTMRB7LJ.js +0 -268
  232. package/dist/hooks/chunk-ZVPPBQ3L.js +0 -3413
@@ -1,137 +0,0 @@
1
- import {
2
- investigation_reads
3
- } from "./chunk-B4HPNY2I.js";
4
- import {
5
- lane_guard_policy
6
- } from "./chunk-O46HMMLJ.js";
7
- import {
8
- hook_decision
9
- } from "./chunk-HOFEWH6H.js";
10
- import {
11
- json_value,
12
- time_spans
13
- } from "./chunk-USLFAFOI.js";
14
-
15
- // scripts/delegation/duplicate-read-guard.ts
16
- import { statSync } from "node:fs";
17
- import { text } from "node:stream/consumers";
18
- import { fileURLToPath } from "node:url";
19
- var SWITCH_ENV_KEY = "JOSH_DUPLICATE_READ_GUARD";
20
- var LANE_GUARD_ID = "duplicate-read";
21
- var STAMP_PREFIX = "josh-duplicate-read-guard-";
22
- var NOTICE_STAMP_PREFIX = "josh-duplicate-read-notice-";
23
- var READ_TOOL = "Read";
24
- var GLOB_CHARACTERS = /[*?]/u;
25
- var REASON = `\u26D4 duplicate read: this file was already read in this session and has not changed since (its mtime predates that read), so reading it again returns nothing new. Scroll up to the earlier result instead of re-reading it. A read with a new offset/limit, or of a file that has since changed, is allowed; set \`JOSH_DUPLICATE_READ_GUARD=off\` to disable this guard.`;
26
- var NOTICE = `\u26A0 duplicate read: this file was already read in this session and has not changed since, so re-reading it returns nothing new \u2014 scroll up to the earlier result instead of re-reading it. Set \`JOSH_DUPLICATE_READ_GUARD=off\` to silence this.`;
27
- function is_paginated(input) {
28
- return input["offset"] !== void 0 || input["limit"] !== void 0;
29
- }
30
- function names_one_file(file_path) {
31
- return typeof file_path === "string" && file_path !== "" && !GLOB_CHARACTERS.test(file_path);
32
- }
33
- function read_target(call) {
34
- if (call.name !== READ_TOOL || !json_value.is_record(call.input)) return void 0;
35
- const { input } = call;
36
- if (is_paginated(input) || !names_one_file(input["file_path"])) return void 0;
37
- return investigation_reads.resolved(input["file_path"]);
38
- }
39
- function is_refusable_call(call) {
40
- return read_target(call) !== void 0;
41
- }
42
- function is_successful_read(span) {
43
- const is_read = investigation_reads.READ_TOOLS.has(span.label);
44
- return is_read && span.outcome !== time_spans.FAILED_OUTCOME;
45
- }
46
- function reads_target(span, target) {
47
- return span.targets.some((one) => investigation_reads.resolved(one) === target);
48
- }
49
- function last_read_ms(spans, target) {
50
- const times = spans.filter((span) => is_successful_read(span) && reads_target(span, target)).map((span) => span.ended_ms);
51
- return times.length === 0 ? hook_decision.NEVER_MS : Math.max(...times);
52
- }
53
- function file_mtime_ms(target) {
54
- try {
55
- return statSync(target).mtimeMs;
56
- } catch {
57
- return void 0;
58
- }
59
- }
60
- function read_window(tail, target) {
61
- const { spans, started_ms } = time_spans.parse_timeline(tail);
62
- return { last_ms: last_read_ms(spans, target), window_start_ms: started_ms };
63
- }
64
- function is_unchanged_reread(last_ms, mtime) {
65
- if (mtime === void 0 || last_ms === hook_decision.NEVER_MS) return false;
66
- return mtime < last_ms;
67
- }
68
- function is_rearmed(window, fired_at_ms) {
69
- if (fired_at_ms === hook_decision.NEVER_MS || fired_at_ms < window.window_start_ms) return true;
70
- return window.last_ms > fired_at_ms;
71
- }
72
- function is_redundant_reread(tail, call, fired_at_ms) {
73
- const target = read_target(call);
74
- if (target === void 0) return false;
75
- const window = read_window(tail, target);
76
- if (!is_unchanged_reread(window.last_ms, file_mtime_ms(target))) return false;
77
- return is_rearmed(window, fired_at_ms);
78
- }
79
- function duplicate_mode() {
80
- return lane_guard_policy.mode_here(LANE_GUARD_ID);
81
- }
82
- function is_candidate(call) {
83
- return is_refusable_call(call) && duplicate_mode() !== "off";
84
- }
85
- function should_block_here(tail, call, refused_at_ms) {
86
- if (duplicate_mode() !== "refuse") return false;
87
- return is_redundant_reread(tail, call, refused_at_ms);
88
- }
89
- function should_notify_here(tail, call, notified_at_ms) {
90
- if (duplicate_mode() !== "notice") return false;
91
- return is_redundant_reread(tail, call, notified_at_ms);
92
- }
93
- var GUARD = hook_decision.create_transcript_guard({
94
- prefix: STAMP_PREFIX,
95
- switch_key: SWITCH_ENV_KEY,
96
- is_candidate,
97
- should_block: should_block_here,
98
- reason: REASON,
99
- notify: {
100
- prefix: NOTICE_STAMP_PREFIX,
101
- should_notify: should_notify_here,
102
- text: () => NOTICE
103
- }
104
- });
105
- var duplicate_read_refusal = GUARD.refusal;
106
- var duplicate_read_outcome = GUARD.outcome;
107
- var { is_enabled, refusal_path } = GUARD;
108
- var notice_refusal_path = hook_decision.create_refusal_stamp(NOTICE_STAMP_PREFIX).path;
109
- var { deny_envelope, DISABLED_VALUES } = hook_decision;
110
- var duplicate_reads = {
111
- REASON,
112
- NOTICE,
113
- SWITCH_ENV_KEY,
114
- is_candidate,
115
- is_rearmed,
116
- is_redundant_reread,
117
- is_refusable_call,
118
- is_unchanged_reread,
119
- last_read_ms,
120
- read_target
121
- };
122
- if (process.argv[1] === fileURLToPath(import.meta.url)) {
123
- if (process.stdin.isTTY) hook_decision.report_no_payload("duplicate-read:guard");
124
- else hook_decision.write_outcome(await text(process.stdin), duplicate_read_outcome);
125
- }
126
-
127
- export {
128
- SWITCH_ENV_KEY,
129
- duplicate_read_refusal,
130
- duplicate_read_outcome,
131
- is_enabled,
132
- refusal_path,
133
- notice_refusal_path,
134
- deny_envelope,
135
- DISABLED_VALUES,
136
- duplicate_reads
137
- };
@@ -1,469 +0,0 @@
1
- import {
2
- lane_child_marker
3
- } from "./chunk-OFJGH2L4.js";
4
- import {
5
- time_bundle_call,
6
- time_format,
7
- time_round_trips,
8
- time_spans,
9
- time_transcript_line
10
- } from "./chunk-ZVPPBQ3L.js";
11
-
12
- // scripts/lane/lane-guard-policy.ts
13
- var DEFAULT_MODE = "refuse";
14
- var OFF_MODE = "off";
15
- var LANE_GUARD_POLICY = [
16
- {
17
- id: "investigation",
18
- mode_in_lane_child: "notice",
19
- because: 'a refusal ends a child turn so it cannot fire as one (kit#2138), which is why it was `off` from #2138 to #2382. The exemption reason \u2014 "the child is itself the delegated unit, so it cannot dispatch a sub-unit to read its own edit targets" \u2014 did not hold in measurement: kit#2382 re-measured the six lane children after #2347 (#2366 #2370 #2371 #2372 #2374 #2375) and every one dispatched sub-agents (10 launches, 2 of them investigation fan-outs) and read 4\u201317 files it never edited, all six over the threshold of 3. So the reading the guard exists to send out was there to send. It takes `notice`, not `off`: the child is nudged to delegate rather than killed, on the `additionalContext` path batching and duplicate-read already use, and the notice names the concrete unedited files this run read (the #2276 precedent) rather than the generic "delegate" #2164 \u2192 #2178 measured not to move the number. The density is a genuine experiment \u2014 re-measured on the next backlogrun, and a notice that still does not move it is redesigned rather than kept'
20
- },
21
- {
22
- id: "batching",
23
- mode_in_lane_child: "notice",
24
- because: 'a refusal ends a child turn so it cannot fire as one (kit#2138); kit#2164 replaced it with a notice, kit#2178 took that notice off after it did not move the density (1.00 calls per turn on both sides of it, transcript f39efeb5), and kit#2276 restores it as a notice \u2014 but a different one. #2178 turned the notice fully off, so across the 2026-09-21 backlogrun 13 runs it fired zero times and the measured 1.147 is the rate with no guidance at all, not guidance that failed. #2276 re-enables it with the two things #2164 lacked: it names the concrete recent calls the run issued one-per-turn (not just "batch more"), and it recurs every single-call turn rather than every three, so the pressure arrives as often as the mistake. The density is to be re-measured on the next backlogrun; if it still does not reach 1.40 the notice is redesigned rather than kept, per the issue'
25
- },
26
- {
27
- id: "duplicate-read",
28
- mode_in_lane_child: "notice",
29
- because: "a refusal ends a child turn so it cannot fire as one (kit#2138), and the unchanged re-reads the guard catches are measured in lane children above all (kit#2298 baseline: 8.0 per lane run) \u2014 so silencing it there (`off`) would neuter it exactly where the count lives. It takes `notice` instead: the child is nudged to scroll up to the earlier read rather than killed. The mode is a genuine experiment, as the batching notice is \u2014 a notice that does not reduce the duplicate reads on the next backlogrun is redesigned rather than kept"
30
- },
31
- {
32
- id: "rule",
33
- mode_in_lane_child: "refuse",
34
- because: "it carries the lane-only rules a child depends on (`pre-gate-cut`, `implementation-cut`, `lane-park`) and the safety rules a child must still obey (`shell-body`, `piped-verification`); a blanket suppression would disarm exactly the guards written for the child. `implementation-cut` (joshuafolkken/kit#2310) needs `refuse` for the same reason the pre-gate cut does \u2014 kit#1864 and kit#2310 both measured a cut carried as prose firing 0 times, so a notice, being prose in front of the run, would drop enforcement without a procedural replacement. The pre-gate-cut refusal does collateral a sibling call batched in the same turn \u2014 a `PreToolUse` deny cancels the turn's other parallel calls, which is the harness behavior kit#2177 measured on #2160 (gate refused, its batched `review:brief` cancelled) \u2014 and that collateral is not avoidable at the guard level. `notice` was considered for the pre-gate-cut point and rejected: kit#1864 measured the cut taken 0 times while it was carried as prose, and a notice is prose in front of the run (kit#2178 measured a lane-child notice not moving the number), so a notice would drop enforcement without a procedural replacement. kit#2177 supplies that replacement in the procedure instead \u2014 the chain orders the cut before the gate, so the cut is issued on its own (its `cut` verdict ends the turn, batching with nothing) and the gate runs in the fresh process where the carried cut keeps this guard silent; the refusal therefore stays `refuse` as insurance and the collateral is gone from the default path rather than from the guard"
35
- }
36
- ];
37
- var KNOWN_GUARD_IDS = LANE_GUARD_POLICY.map((entry) => entry.id);
38
- function entry_for(id) {
39
- return LANE_GUARD_POLICY.find((entry) => entry.id === id.trim());
40
- }
41
- function mode_in_lane_child(id) {
42
- return entry_for(id)?.mode_in_lane_child ?? DEFAULT_MODE;
43
- }
44
- function mode_here(id, directory = process.cwd(), source = process.env) {
45
- const lane_mode = mode_in_lane_child(id);
46
- if (lane_mode === DEFAULT_MODE) return DEFAULT_MODE;
47
- return lane_child_marker.is_child_of(directory, source) ? lane_mode : DEFAULT_MODE;
48
- }
49
- function is_suppressed_here(id, directory = process.cwd(), source = process.env) {
50
- return mode_here(id, directory, source) === OFF_MODE;
51
- }
52
- var lane_guard_policy = {
53
- LANE_GUARD_POLICY,
54
- KNOWN_GUARD_IDS,
55
- entry_for,
56
- mode_in_lane_child,
57
- mode_here,
58
- is_suppressed_here
59
- };
60
-
61
- // scripts/time-runtime/time-agent-bundles.ts
62
- var NONE = 0;
63
- var ONE = 1;
64
- var MIN_GROUP = 2;
65
- function is_launch(span) {
66
- return span.category === time_spans.TOOL_CATEGORY && !span.is_continuation && time_bundle_call.is_launch_tool(span.label);
67
- }
68
- function new_walk() {
69
- return { closed: [], open: NONE, wrote_since: false, turn_id: time_spans.NO_MESSAGE_ID };
70
- }
71
- function close_group(walk) {
72
- if (walk.open >= MIN_GROUP) walk.closed.push(walk.open);
73
- walk.open = NONE;
74
- }
75
- function is_same_turn(walk, span) {
76
- return span.message_id !== time_spans.NO_MESSAGE_ID && span.message_id === walk.turn_id;
77
- }
78
- function open_turn(walk, span) {
79
- if (walk.wrote_since || span.has_prior_reference) close_group(walk);
80
- walk.open += ONE;
81
- walk.turn_id = span.message_id;
82
- walk.wrote_since = false;
83
- }
84
- function step(walk, span) {
85
- if (span.is_writing) {
86
- walk.wrote_since = true;
87
- return;
88
- }
89
- if (!is_launch(span) || is_same_turn(walk, span)) return;
90
- open_turn(walk, span);
91
- }
92
- function agent_bundles(spans) {
93
- const walk = new_walk();
94
- for (const span of time_round_trips.in_time_order(spans)) step(walk, span);
95
- close_group(walk);
96
- return walk.closed;
97
- }
98
- var time_agent_bundles = { agent_bundles };
99
-
100
- // scripts/time-runtime/time-bundles.ts
101
- var { unmeasured_row } = time_format;
102
- var HEADING = "Bundling:";
103
- var SEQUENCE_LABEL = "bundleable sequences";
104
- var RECOVERABLE_LABEL = "recoverable round trips";
105
- var SAVING_LABEL = "recoverable wait";
106
- var BY_TOOL_LABEL = "recoverable by tool";
107
- var AGENT_ROW_LABEL = "Agent";
108
- var ROW_INDENT = " ";
109
- var MIN_SEQUENCE = 2;
110
- var ONE_CALL = 1;
111
- var NONE2 = 0;
112
- var PATH_SEPARATOR = "/";
113
- var FIRST_CALL = 1;
114
- var NO_LABEL = "";
115
- var NO_BUNDLES = {
116
- sequence_count: 0,
117
- longest_sequence: 0,
118
- recoverable_round_trips: 0,
119
- by_tool: [],
120
- unattributed_round_trips: 0,
121
- is_measured: false
122
- };
123
- function contains_segments(whole, part) {
124
- if (whole.startsWith(`${part}${PATH_SEPARATOR}`)) return true;
125
- return whole.endsWith(`${PATH_SEPARATOR}${part}`) || whole.includes(`${PATH_SEPARATOR}${part}${PATH_SEPARATOR}`);
126
- }
127
- function is_related(left, right) {
128
- if (left === right) return true;
129
- return contains_segments(left, right) || contains_segments(right, left);
130
- }
131
- function shares_target(left, right) {
132
- return left.some((one) => right.some((other) => is_related(one, other)));
133
- }
134
- function is_dependent(earlier, later) {
135
- if (earlier.is_writing && later.is_writing) return false;
136
- return shares_target(earlier.targets, later.targets);
137
- }
138
- function conflicts(span, sequence) {
139
- return sequence.some((earlier) => is_dependent(earlier, span));
140
- }
141
- function is_call(span) {
142
- return span.category === time_spans.TOOL_CATEGORY && !span.is_continuation;
143
- }
144
- function is_turn_boundary(span) {
145
- return span.category === time_spans.MODEL_CATEGORY;
146
- }
147
- function new_walk2() {
148
- return { pending: [], sequence: [], closed: [] };
149
- }
150
- function flush(walk) {
151
- if (walk.sequence.length >= MIN_SEQUENCE) walk.closed.push(walk.sequence);
152
- walk.sequence = [];
153
- }
154
- function extend(walk, span) {
155
- if (conflicts(span, walk.sequence)) flush(walk);
156
- walk.sequence.push(span);
157
- }
158
- function close_trip(walk) {
159
- const [only] = walk.pending;
160
- if (walk.pending.length === ONE_CALL && only?.is_bundleable === true) extend(walk, only);
161
- else if (walk.pending.length > NONE2) flush(walk);
162
- walk.pending = [];
163
- }
164
- function is_same_turn2(span, pending) {
165
- const [first] = pending;
166
- if (first === void 0 || span.is_continuation || span.message_id === time_spans.NO_MESSAGE_ID) {
167
- return false;
168
- }
169
- return span.message_id === first.message_id;
170
- }
171
- function step2(walk, span) {
172
- if (is_call(span)) {
173
- walk.pending.push(span);
174
- return;
175
- }
176
- if (is_same_turn2(span, walk.pending)) return;
177
- close_trip(walk);
178
- if (!is_turn_boundary(span)) flush(walk);
179
- }
180
- function longest_of(sizes) {
181
- return sizes.length === NONE2 ? NONE2 : Math.max(...sizes);
182
- }
183
- function recoverable_of(sizes) {
184
- return sizes.reduce((sum, size) => sum + size - ONE_CALL, NONE2);
185
- }
186
- function sizes_of(closed) {
187
- return closed.map((sequence) => sequence.length);
188
- }
189
- function tally_for(tallies, label) {
190
- const found = tallies.get(label);
191
- if (found !== void 0) return found;
192
- const created = { sequence_count: NONE2, recoverable_round_trips: NONE2 };
193
- tallies.set(label, created);
194
- return created;
195
- }
196
- function count_trip(tallies, counted, label) {
197
- const tally = tally_for(tallies, label);
198
- tally.recoverable_round_trips += ONE_CALL;
199
- if (!counted.has(label)) tally.sequence_count += ONE_CALL;
200
- counted.add(label);
201
- }
202
- function tally_sequence(tallies, sequence) {
203
- const counted = /* @__PURE__ */ new Set();
204
- for (const span of sequence.slice(FIRST_CALL)) {
205
- if (span.label !== NO_LABEL) count_trip(tallies, counted, span.label);
206
- }
207
- }
208
- function by_weight(left, right) {
209
- if (left.recoverable_round_trips !== right.recoverable_round_trips) {
210
- return right.recoverable_round_trips - left.recoverable_round_trips;
211
- }
212
- return left.label.localeCompare(right.label);
213
- }
214
- function tool_rows(closed) {
215
- const tallies = /* @__PURE__ */ new Map();
216
- for (const sequence of closed) tally_sequence(tallies, sequence);
217
- return [...tallies].map(([label, tally]) => ({ label, ...tally })).toSorted(by_weight);
218
- }
219
- function attributed_of(rows) {
220
- return rows.reduce((sum, row) => sum + row.recoverable_round_trips, NONE2);
221
- }
222
- function with_agent_row(rows, agent_sizes) {
223
- const recoverable_round_trips = recoverable_of(agent_sizes);
224
- if (recoverable_round_trips === NONE2) return [...rows];
225
- const row = {
226
- label: AGENT_ROW_LABEL,
227
- sequence_count: agent_sizes.length,
228
- recoverable_round_trips
229
- };
230
- return [...rows, row].toSorted(by_weight);
231
- }
232
- function build_bundles(spans) {
233
- const walk = new_walk2();
234
- for (const span of time_round_trips.in_time_order(spans)) step2(walk, span);
235
- close_trip(walk);
236
- flush(walk);
237
- const sizes = sizes_of(walk.closed);
238
- const agent_sizes = time_agent_bundles.agent_bundles(spans);
239
- const by_tool = with_agent_row(tool_rows(walk.closed), agent_sizes);
240
- const recoverable_round_trips = recoverable_of(sizes) + recoverable_of(agent_sizes);
241
- return {
242
- sequence_count: sizes.length + agent_sizes.length,
243
- longest_sequence: Math.max(longest_of(sizes), longest_of(agent_sizes)),
244
- recoverable_round_trips,
245
- by_tool,
246
- unattributed_round_trips: recoverable_round_trips - attributed_of(by_tool),
247
- is_measured: time_spans.has_transcript_data(spans.length)
248
- };
249
- }
250
- function open_sequence(spans) {
251
- const walk = new_walk2();
252
- for (const span of time_round_trips.in_time_order(spans)) step2(walk, span);
253
- return walk.sequence;
254
- }
255
- function sequence_suffix(totals) {
256
- return `longest ${String(totals.longest_sequence)} turn(s)`;
257
- }
258
- function recoverable_suffix(totals, round_trip_count) {
259
- const share = time_format.format_share(totals.recoverable_round_trips, round_trip_count);
260
- return `${share} of ${String(round_trip_count)} round trip(s)`;
261
- }
262
- function saving_line(totals, model_ms_per_round_trip) {
263
- const saved_ms = totals.recoverable_round_trips * model_ms_per_round_trip;
264
- const rate = `at ${time_format.format_seconds(model_ms_per_round_trip)} model time per round trip`;
265
- return time_format.format_row(SAVING_LABEL, saved_ms, rate);
266
- }
267
- function by_tool_suffix(totals) {
268
- const attributed = totals.recoverable_round_trips - totals.unattributed_round_trips;
269
- return `${String(attributed)} of ${String(totals.recoverable_round_trips)} attributed`;
270
- }
271
- function tool_row(row) {
272
- return time_format.format_columns(
273
- `${ROW_INDENT}${row.label}`,
274
- String(row.recoverable_round_trips),
275
- `in ${String(row.sequence_count)} sequence(s)`
276
- );
277
- }
278
- function by_tool_lines(totals) {
279
- const heading = time_format.format_columns(
280
- BY_TOOL_LABEL,
281
- String(totals.by_tool.length),
282
- by_tool_suffix(totals)
283
- );
284
- const rows = totals.by_tool.slice(NONE2, time_format.MAX_ROWS).map((row) => tool_row(row));
285
- return [heading, ...rows, ...time_format.overflow_line(totals.by_tool.length)];
286
- }
287
- function measured_lines(totals, price) {
288
- return [
289
- time_format.format_columns(
290
- SEQUENCE_LABEL,
291
- String(totals.sequence_count),
292
- sequence_suffix(totals)
293
- ),
294
- time_format.format_columns(
295
- RECOVERABLE_LABEL,
296
- String(totals.recoverable_round_trips),
297
- recoverable_suffix(totals, price.round_trip_count)
298
- ),
299
- saving_line(totals, price.model_ms_per_round_trip),
300
- ...by_tool_lines(totals)
301
- ];
302
- }
303
- var LABELS = [SEQUENCE_LABEL, RECOVERABLE_LABEL, SAVING_LABEL, BY_TOOL_LABEL];
304
- function no_divisor_lines() {
305
- return LABELS.map((label) => time_format.format_columns(label, "", time_format.NO_CALLS));
306
- }
307
- function bundle_lines(totals, price) {
308
- const heading = ["", HEADING];
309
- if (!totals.is_measured) return [...heading, ...LABELS.map((label) => unmeasured_row(label))];
310
- if (price.round_trip_count === NONE2) return [...heading, ...no_divisor_lines()];
311
- return [...heading, ...measured_lines(totals, price)];
312
- }
313
- var time_bundles = {
314
- HEADING,
315
- SEQUENCE_LABEL,
316
- RECOVERABLE_LABEL,
317
- SAVING_LABEL,
318
- BY_TOOL_LABEL,
319
- MIN_SEQUENCE,
320
- NO_BUNDLES,
321
- build_bundles,
322
- bundle_lines,
323
- is_dependent,
324
- open_sequence,
325
- shares_target
326
- };
327
-
328
- // scripts/time-runtime/time-command-key.ts
329
- var UNNAMED_KEY = "";
330
- function command_key(span) {
331
- if (span.label === time_spans.UNKNOWN_TOOL) return UNNAMED_KEY;
332
- return span.josh_command === "" ? span.label : span.josh_command;
333
- }
334
- var time_command_key = { UNNAMED_KEY, command_key };
335
-
336
- // scripts/time-runtime/time-call-identity.ts
337
- var IDENTITY_SEPARATOR = "\0";
338
- function identity_of(call) {
339
- return [
340
- time_command_key.command_key(call),
341
- call.check_key,
342
- [...call.targets].toSorted((left, right) => left.localeCompare(right)).join(",")
343
- ].join(IDENTITY_SEPARATOR);
344
- }
345
- var time_call_identity = { identity_of };
346
-
347
- // scripts/time-runtime/time-batch-guard.ts
348
- var CONSECUTIVE_LIMIT = 3;
349
- var REFIRE_EVERY = CONSECUTIVE_LIMIT;
350
- var ONE_TURN = 1;
351
- var NONE3 = 0;
352
- var NOTICE_REFIRE_EVERY = ONE_TURN;
353
- var NAMED_CANDIDATE_COUNT = 3;
354
- var SEQUENCE_BEFORE_LIMIT = CONSECUTIVE_LIMIT - ONE_TURN;
355
- var REASON = `\u26D4 batching: the last ${String(SEQUENCE_BEFORE_LIMIT)} turns each issued a single tool call, so this one would make ${String(CONSECUTIVE_LIMIT)} in a row. Reissue it in one turn together with the calls meant to follow it that do not need its result. **The criterion is whether this call's input needs another call's result, not what kind of call it is** \u2014 edits are covered exactly as reads are, and it never authorizes weakening a verification gate or a review: fewer turns, never less work. The measured cost and the rejected mechanisms are in \`prompts/collaboration-workflow/turn-batching.md\`. If this turn was already batching, or the call genuinely has nothing to go beside it, reissue it as it was: this fires once per run of single-call turns and cannot repeat on the call in hand.`;
356
- var NOTICE = `\u{1F4A1} batching: the last ${String(SEQUENCE_BEFORE_LIMIT)} turns each issued a single tool call, so this Write makes ${String(CONSECUTIVE_LIMIT)} in a row. This is a notice, not a refusal \u2014 the write proceeds. Where the writes meant to follow it do not need its result, issue them in one turn together. **The criterion is whether a call's input needs another call's result, not what kind of call it is** \u2014 it never authorizes weakening a verification gate or a review: fewer turns, never less work. The measured cost and the rejected mechanisms are in \`prompts/collaboration-workflow/turn-batching.md\`. If this run was already batching, or the write genuinely has nothing to go beside it, carry on: this recurs every ${String(NOTICE_REFIRE_EVERY)} further single-call turn(s).`;
357
- var LANE_NOTICE = `\u{1F4A1} batching: the last ${String(SEQUENCE_BEFORE_LIMIT)} turns each issued a single tool call, so this one makes ${String(CONSECUTIVE_LIMIT)} in a row. This is a notice, not a refusal \u2014 the call proceeds, because a dispatched lane child ends its turn on a denial. Where the calls meant to follow it do not need its result, issue them in one turn together. **The criterion is whether a call's input needs another call's result, not what kind of call it is** \u2014 it never authorizes weakening a verification gate or a review: fewer turns, never less work. The measured cost and the rejected mechanisms are in \`prompts/collaboration-workflow/turn-batching.md\`. If this run was already batching, or the call genuinely has nothing to go beside it, carry on: this recurs every ${String(NOTICE_REFIRE_EVERY)} further single-call turn(s).`;
358
- var WHOLE_FILE_WRITE_TOOL = "Write";
359
- var EDIT_TOOL = "Edit";
360
- function is_guarded_call(call) {
361
- if (call.name === WHOLE_FILE_WRITE_TOOL) return false;
362
- return time_bundle_call.call_facts(call.name, call.input).is_bundleable;
363
- }
364
- function is_notice_call(call) {
365
- return call.name === WHOLE_FILE_WRITE_TOOL;
366
- }
367
- function is_read_only_call(call) {
368
- const facts = time_bundle_call.call_facts(call.name, call.input);
369
- return facts.is_bundleable && !facts.may_write;
370
- }
371
- function depends_on_sequence(sequence, facts) {
372
- return sequence.some((span) => time_bundles.shares_target(span.targets, facts.targets));
373
- }
374
- function sequence_started_ms(sequence) {
375
- return sequence[0]?.ended_ms ?? NONE3;
376
- }
377
- function turns_since(sequence, last_fired_ms) {
378
- return sequence.filter((span) => span.ended_ms > last_fired_ms).length;
379
- }
380
- function is_sequence_at_limit(sequence, facts, last_fired_ms, refire_every) {
381
- if (sequence.length < SEQUENCE_BEFORE_LIMIT || depends_on_sequence(sequence, facts)) return false;
382
- if (last_fired_ms < sequence_started_ms(sequence)) return true;
383
- return turns_since(sequence, last_fired_ms) >= refire_every;
384
- }
385
- function is_at_limit(spans, call, last_fired_ms, refire_every) {
386
- return is_sequence_at_limit(
387
- time_bundles.open_sequence(spans),
388
- time_bundle_call.call_facts(call.name, call.input),
389
- last_fired_ms,
390
- refire_every
391
- );
392
- }
393
- var GUARD_LABEL = time_transcript_line.guard_from_refusal(REASON);
394
- function is_reissued_refusal(spans, call) {
395
- const identity = time_call_identity.identity_of(
396
- time_spans.to_tool_call(call.name, call.input, time_spans.NO_MESSAGE_ID)
397
- );
398
- return spans.some(
399
- (span) => span.refusal_guard === GUARD_LABEL && time_call_identity.identity_of(span) === identity
400
- );
401
- }
402
- function should_block(text, call, refused_at_ms, refire_every = REFIRE_EVERY) {
403
- if (!is_guarded_call(call)) return false;
404
- const { spans } = time_spans.parse_timeline(text);
405
- if (is_reissued_refusal(spans, call)) return false;
406
- return is_at_limit(spans, call, refused_at_ms, refire_every);
407
- }
408
- function should_notify(text, call, notified_at_ms) {
409
- if (!is_notice_call(call)) return false;
410
- const { spans } = time_spans.parse_timeline(text);
411
- return is_at_limit(spans, call, notified_at_ms, NOTICE_REFIRE_EVERY);
412
- }
413
- function describe_span(span) {
414
- const target = span.targets[0] ?? "";
415
- if (target === "" || span.label.includes(target)) return span.label;
416
- return `${span.label} ${target}`;
417
- }
418
- var FOLD_MINIMUM = 2;
419
- function read_targets(sequence) {
420
- const paths = sequence.filter((span) => span.is_bundleable && !span.is_writing).map((span) => span.targets[0] ?? "").filter((path) => path !== "" && time_bundle_call.has_extension(path));
421
- return [...new Set(paths)];
422
- }
423
- function read_fold_directive(sequence) {
424
- const paths = read_targets(sequence);
425
- if (paths.length < FOLD_MINIMUM) return "";
426
- return ` Fold them into one call: \`pnpm josh read:files ${paths.join(" ")}\`.`;
427
- }
428
- function write_targets(sequence) {
429
- const paths = sequence.filter((span) => span.label === EDIT_TOOL).map((span) => span.targets[0] ?? "").filter((path) => path !== "" && time_bundle_call.has_extension(path));
430
- return [...new Set(paths)];
431
- }
432
- function write_fold_directive(sequence) {
433
- const paths = write_targets(sequence);
434
- if (paths.length < FOLD_MINIMUM) return "";
435
- return ` Fold them into one \`pnpm josh edit:files\` call with a plan over: ${paths.join(" ")}.`;
436
- }
437
- function recent_candidates(tail) {
438
- const recent = time_bundles.open_sequence(time_spans.parse_timeline(tail).spans).slice(-NAMED_CANDIDATE_COUNT);
439
- if (recent.length === NONE3) return "";
440
- const named = recent.map((span) => describe_span(span)).join(", ");
441
- const folds = `${read_fold_directive(recent)}${write_fold_directive(recent)}`;
442
- return ` Just issued one per turn, so at least these could have shared a turn: ${named}.${folds}`;
443
- }
444
- var STAMP_PREFIX = "josh-batch-guard-";
445
- var NOTICE_STAMP_PREFIX = "josh-batch-guard-notice-";
446
- var time_batch_guard = {
447
- CONSECUTIVE_LIMIT,
448
- GUARD_LABEL,
449
- LANE_NOTICE,
450
- NAMED_CANDIDATE_COUNT,
451
- NOTICE,
452
- NOTICE_REFIRE_EVERY,
453
- NOTICE_STAMP_PREFIX,
454
- REASON,
455
- REFIRE_EVERY,
456
- SEQUENCE_BEFORE_LIMIT,
457
- STAMP_PREFIX,
458
- is_guarded_call,
459
- is_notice_call,
460
- is_read_only_call,
461
- recent_candidates,
462
- should_block,
463
- should_notify
464
- };
465
-
466
- export {
467
- lane_guard_policy,
468
- time_batch_guard
469
- };
@@ -1,49 +0,0 @@
1
- import {
2
- hook_decision,
3
- time_batch_guard
4
- } from "./chunk-PXT44QVN.js";
5
-
6
- // scripts/hooks/batch-guard.ts
7
- import { text } from "node:stream/consumers";
8
- import { fileURLToPath } from "node:url";
9
- var SWITCH_ENV_KEY = "JOSH_BATCH_GUARD";
10
- function is_batch_candidate(call) {
11
- return time_batch_guard.is_guarded_call(call) || time_batch_guard.is_notice_call(call);
12
- }
13
- var GUARD = hook_decision.create_transcript_guard({
14
- prefix: time_batch_guard.STAMP_PREFIX,
15
- switch_key: SWITCH_ENV_KEY,
16
- is_candidate: is_batch_candidate,
17
- should_block: time_batch_guard.should_block,
18
- reason: time_batch_guard.REASON,
19
- // The whole-file write is notified rather than refused, on a record of its own so it never spends
20
- // the refusal's stamp (joshuafolkken/kit#1848).
21
- notify: {
22
- prefix: time_batch_guard.NOTICE_STAMP_PREFIX,
23
- should_notify: time_batch_guard.should_notify,
24
- text: time_batch_guard.NOTICE
25
- }
26
- });
27
- var batch_refusal = GUARD.refusal;
28
- var batch_outcome = GUARD.outcome;
29
- var { is_enabled, refusal_path } = GUARD;
30
- var notice_refusal_path = hook_decision.create_refusal_stamp(
31
- time_batch_guard.NOTICE_STAMP_PREFIX
32
- ).path;
33
- var { deny_envelope, load_environment_file, DISABLED_VALUES } = hook_decision;
34
- if (process.argv[1] === fileURLToPath(import.meta.url)) {
35
- if (process.stdin.isTTY) hook_decision.report_no_payload("batch:guard");
36
- else hook_decision.write_outcome(await text(process.stdin), batch_outcome);
37
- }
38
-
39
- export {
40
- SWITCH_ENV_KEY,
41
- batch_refusal,
42
- batch_outcome,
43
- is_enabled,
44
- refusal_path,
45
- notice_refusal_path,
46
- deny_envelope,
47
- load_environment_file,
48
- DISABLED_VALUES
49
- };