@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.
- package/.github/workflows/publish.yml +39 -2
- package/README.md +3 -3
- package/package.json +6 -2
- package/scripts/init/distributed-paths.ts +14 -11
- package/scripts/init/hook-command-bootstrap.ts +51 -0
- package/scripts/init/hook-command-rewrite.ts +9 -1
- package/scripts/init/init-logic.ts +2 -8
- package/templates/workflows/ci.yml +6 -2
- package/dist/hooks/chunk-25JL6FMS.js +0 -4970
- package/dist/hooks/chunk-2ANGT3XM.js +0 -375
- package/dist/hooks/chunk-2EI5GBSW.js +0 -42
- package/dist/hooks/chunk-2OT5XE2N.js +0 -5014
- package/dist/hooks/chunk-33ELOKEV.js +0 -910
- package/dist/hooks/chunk-33YRTKM7.js +0 -230
- package/dist/hooks/chunk-36JQU5NN.js +0 -77
- package/dist/hooks/chunk-3EJBTWVS.js +0 -1769
- package/dist/hooks/chunk-3FK5SFAC.js +0 -432
- package/dist/hooks/chunk-3PWPYDD2.js +0 -240
- package/dist/hooks/chunk-3TQU7TDH.js +0 -375
- package/dist/hooks/chunk-3TVLSFZ6.js +0 -432
- package/dist/hooks/chunk-3VXYCB4E.js +0 -77
- package/dist/hooks/chunk-44M6JXGV.js +0 -3398
- package/dist/hooks/chunk-46EEEHC3.js +0 -240
- package/dist/hooks/chunk-4A7UVP2P.js +0 -364
- package/dist/hooks/chunk-4LFQEZS4.js +0 -137
- package/dist/hooks/chunk-4OCX3V2T.js +0 -469
- package/dist/hooks/chunk-4OHA5DE7.js +0 -49
- package/dist/hooks/chunk-4PMDW3YD.js +0 -68
- package/dist/hooks/chunk-4QHBNAI4.js +0 -68
- package/dist/hooks/chunk-4SSB3FEE.js +0 -3273
- package/dist/hooks/chunk-5A2WQ2CQ.js +0 -5390
- package/dist/hooks/chunk-5EVA2JQB.js +0 -5390
- package/dist/hooks/chunk-5P7VF5VE.js +0 -3230
- package/dist/hooks/chunk-5QWJGGZP.js +0 -49
- package/dist/hooks/chunk-5U5EZYG6.js +0 -77
- package/dist/hooks/chunk-5VUUF3ZV.js +0 -240
- package/dist/hooks/chunk-5WA7UBT3.js +0 -374
- package/dist/hooks/chunk-6EBGRQ3Q.js +0 -301
- package/dist/hooks/chunk-6TVHWMD3.js +0 -432
- package/dist/hooks/chunk-6VAGLEMB.js +0 -68
- package/dist/hooks/chunk-75BTXKFJ.js +0 -3424
- package/dist/hooks/chunk-75RHN67S.js +0 -137
- package/dist/hooks/chunk-76KC3BDD.js +0 -3414
- package/dist/hooks/chunk-76SLS7CZ.js +0 -898
- package/dist/hooks/chunk-7DHZ4DWT.js +0 -5015
- package/dist/hooks/chunk-7INSJDGE.js +0 -458
- package/dist/hooks/chunk-7VJ4FTDX.js +0 -268
- package/dist/hooks/chunk-7XCYNHQK.js +0 -77
- package/dist/hooks/chunk-A5YJ3H7E.js +0 -375
- package/dist/hooks/chunk-AAEXXUUL.js +0 -268
- package/dist/hooks/chunk-ABVEVV2M.js +0 -432
- package/dist/hooks/chunk-ACN3YXFL.js +0 -68
- package/dist/hooks/chunk-AD3XE3QZ.js +0 -397
- package/dist/hooks/chunk-AENFZPZH.js +0 -230
- package/dist/hooks/chunk-AFKRFQ6W.js +0 -68
- package/dist/hooks/chunk-AHD5IPWI.js +0 -375
- package/dist/hooks/chunk-AMK5JGV7.js +0 -77
- package/dist/hooks/chunk-ARN7NCQI.js +0 -425
- package/dist/hooks/chunk-AUFY653N.js +0 -3425
- package/dist/hooks/chunk-AXQBNFEF.js +0 -375
- package/dist/hooks/chunk-AYC7R6U4.js +0 -3316
- package/dist/hooks/chunk-AYEA2FJ7.js +0 -5015
- package/dist/hooks/chunk-B4HPNY2I.js +0 -375
- package/dist/hooks/chunk-B57S3VWT.js +0 -922
- package/dist/hooks/chunk-BINZ3PLI.js +0 -364
- package/dist/hooks/chunk-BODUSXKK.js +0 -410
- package/dist/hooks/chunk-BQBAT2YK.js +0 -375
- package/dist/hooks/chunk-BUJEBW75.js +0 -391
- package/dist/hooks/chunk-BVNWORKA.js +0 -72
- package/dist/hooks/chunk-BWI47LQS.js +0 -5205
- package/dist/hooks/chunk-C25HRMJX.js +0 -137
- package/dist/hooks/chunk-CBFZNC74.js +0 -375
- package/dist/hooks/chunk-CECYXS4Y.js +0 -3424
- package/dist/hooks/chunk-CELGUP5F.js +0 -49
- package/dist/hooks/chunk-CMHANU3F.js +0 -3442
- package/dist/hooks/chunk-CMN372LI.js +0 -68
- package/dist/hooks/chunk-CPGZLMMK.js +0 -3299
- package/dist/hooks/chunk-CTQKXDC7.js +0 -268
- package/dist/hooks/chunk-CYAT4RIT.js +0 -68
- package/dist/hooks/chunk-CYTWYCH2.js +0 -5014
- package/dist/hooks/chunk-CZSOLRBA.js +0 -77
- package/dist/hooks/chunk-D2PIDYJR.js +0 -3438
- package/dist/hooks/chunk-DE57HI6T.js +0 -137
- package/dist/hooks/chunk-DGXDGAPG.js +0 -5306
- package/dist/hooks/chunk-DNYRSYQG.js +0 -5014
- package/dist/hooks/chunk-DTAXH2A2.js +0 -240
- package/dist/hooks/chunk-E2IZUWI5.js +0 -375
- package/dist/hooks/chunk-E4L2K2BL.js +0 -397
- package/dist/hooks/chunk-ECXVCCVD.js +0 -3079
- package/dist/hooks/chunk-EPHO443D.js +0 -68
- package/dist/hooks/chunk-EUFK2BI2.js +0 -375
- package/dist/hooks/chunk-EYCD5ZAV.js +0 -137
- package/dist/hooks/chunk-F2SDYJU4.js +0 -240
- package/dist/hooks/chunk-F4B5D5TF.js +0 -68
- package/dist/hooks/chunk-FGEO3NDX.js +0 -432
- package/dist/hooks/chunk-FJYI52RE.js +0 -137
- package/dist/hooks/chunk-FYTZHIY4.js +0 -3085
- package/dist/hooks/chunk-G7JL2A5K.js +0 -375
- package/dist/hooks/chunk-GA3ITDBW.js +0 -42
- package/dist/hooks/chunk-GDR4H4SV.js +0 -469
- package/dist/hooks/chunk-GFKDXPSM.js +0 -2855
- package/dist/hooks/chunk-GIMRTKFU.js +0 -566
- package/dist/hooks/chunk-GOPHRLGO.js +0 -240
- package/dist/hooks/chunk-GX4HO7SJ.js +0 -230
- package/dist/hooks/chunk-GZ6FUVIK.js +0 -566
- package/dist/hooks/chunk-H5HPY5M5.js +0 -2869
- package/dist/hooks/chunk-HCF3OGEE.js +0 -1829
- package/dist/hooks/chunk-HDEXAOUM.js +0 -469
- package/dist/hooks/chunk-HM2TY3TN.js +0 -469
- package/dist/hooks/chunk-HOA7NXA2.js +0 -55
- package/dist/hooks/chunk-HOFEWH6H.js +0 -240
- package/dist/hooks/chunk-HUUI6S5J.js +0 -2669
- package/dist/hooks/chunk-I4D3NVUD.js +0 -469
- package/dist/hooks/chunk-I4Q6WAJE.js +0 -68
- package/dist/hooks/chunk-IB6N4CR2.js +0 -432
- package/dist/hooks/chunk-IFLDYJMD.js +0 -469
- package/dist/hooks/chunk-IGU466YD.js +0 -77
- package/dist/hooks/chunk-IJCQUHKY.js +0 -375
- package/dist/hooks/chunk-IKUMBDJB.js +0 -230
- package/dist/hooks/chunk-IM3BDIBJ.js +0 -5005
- package/dist/hooks/chunk-IMYMAODK.js +0 -3431
- package/dist/hooks/chunk-IN2ZVGXA.js +0 -5005
- package/dist/hooks/chunk-ITVJ2MKQ.js +0 -18
- package/dist/hooks/chunk-J5RIJYTM.js +0 -2669
- package/dist/hooks/chunk-JFLMH4K5.js +0 -3460
- package/dist/hooks/chunk-JR25IFML.js +0 -77
- package/dist/hooks/chunk-JT5AUXFI.js +0 -432
- package/dist/hooks/chunk-JY5YVN6N.js +0 -3234
- package/dist/hooks/chunk-K5Q4ETVI.js +0 -391
- package/dist/hooks/chunk-K67V2F24.js +0 -137
- package/dist/hooks/chunk-KATZESEC.js +0 -3273
- package/dist/hooks/chunk-KFH4H7W7.js +0 -469
- package/dist/hooks/chunk-KMUEI6RX.js +0 -910
- package/dist/hooks/chunk-KMV4OY77.js +0 -3438
- package/dist/hooks/chunk-KQAZNWEY.js +0 -137
- package/dist/hooks/chunk-KZZR6JER.js +0 -5015
- package/dist/hooks/chunk-LAR6DREP.js +0 -77
- package/dist/hooks/chunk-LNCJWEZD.js +0 -5015
- package/dist/hooks/chunk-LRYD2GLM.js +0 -6
- package/dist/hooks/chunk-LXBKYHDV.js +0 -77
- package/dist/hooks/chunk-LYLKIUNE.js +0 -5024
- package/dist/hooks/chunk-LZKCFOVC.js +0 -432
- package/dist/hooks/chunk-M4FCIYRI.js +0 -77
- package/dist/hooks/chunk-M5M7327Q.js +0 -3425
- package/dist/hooks/chunk-MF72MHSX.js +0 -3455
- package/dist/hooks/chunk-MK56LKDO.js +0 -397
- package/dist/hooks/chunk-N3MJADY7.js +0 -240
- package/dist/hooks/chunk-NFQSUDBN.js +0 -458
- package/dist/hooks/chunk-NHREKY45.js +0 -137
- package/dist/hooks/chunk-NP5TTAAW.js +0 -375
- package/dist/hooks/chunk-NQTLTKTJ.js +0 -2993
- package/dist/hooks/chunk-NVRCZPBZ.js +0 -391
- package/dist/hooks/chunk-O46HMMLJ.js +0 -469
- package/dist/hooks/chunk-OFJGH2L4.js +0 -240
- package/dist/hooks/chunk-OLFMCZH5.js +0 -240
- package/dist/hooks/chunk-OMCZS46I.js +0 -49
- package/dist/hooks/chunk-OQZEZW5G.js +0 -469
- package/dist/hooks/chunk-P2MDAT2Y.js +0 -1897
- package/dist/hooks/chunk-P3M2JJIF.js +0 -68
- package/dist/hooks/chunk-PDVHQITQ.js +0 -3453
- package/dist/hooks/chunk-PNT2AMDH.js +0 -391
- package/dist/hooks/chunk-PR2LVSY6.js +0 -3445
- package/dist/hooks/chunk-PRR5R4JK.js +0 -137
- package/dist/hooks/chunk-PXT44QVN.js +0 -566
- package/dist/hooks/chunk-PZLWJLAP.js +0 -469
- package/dist/hooks/chunk-Q2FEAZJ2.js +0 -77
- package/dist/hooks/chunk-Q32WETDO.js +0 -3265
- package/dist/hooks/chunk-Q45DUBLE.js +0 -3600
- package/dist/hooks/chunk-Q7NZSWQ5.js +0 -240
- package/dist/hooks/chunk-QH2JNAMK.js +0 -3085
- package/dist/hooks/chunk-QPU5H2OS.js +0 -68
- package/dist/hooks/chunk-QRAHZ5TO.js +0 -1829
- package/dist/hooks/chunk-QUZ5HPIE.js +0 -469
- package/dist/hooks/chunk-QVCRG34O.js +0 -2893
- package/dist/hooks/chunk-R3MY4E3S.js +0 -1675
- package/dist/hooks/chunk-R6TXJJXP.js +0 -77
- package/dist/hooks/chunk-REJU6VT7.js +0 -1829
- package/dist/hooks/chunk-REQAQLRC.js +0 -2993
- package/dist/hooks/chunk-RFCXPAHH.js +0 -391
- package/dist/hooks/chunk-RHI6Y22X.js +0 -137
- package/dist/hooks/chunk-RKZVOBBS.js +0 -469
- package/dist/hooks/chunk-RL57TT2Y.js +0 -566
- package/dist/hooks/chunk-RORDOD4S.js +0 -3321
- package/dist/hooks/chunk-RZKYW5P2.js +0 -77
- package/dist/hooks/chunk-SJPJ6VSI.js +0 -391
- package/dist/hooks/chunk-SKSIJQQQ.js +0 -432
- package/dist/hooks/chunk-SSQDZKXG.js +0 -268
- package/dist/hooks/chunk-SYHFKE4C.js +0 -77
- package/dist/hooks/chunk-TCGNI2ZY.js +0 -42
- package/dist/hooks/chunk-TG3WXJF5.js +0 -137
- package/dist/hooks/chunk-TH7IJAY5.js +0 -77
- package/dist/hooks/chunk-TLZ27PCY.js +0 -240
- package/dist/hooks/chunk-U652FXTN.js +0 -566
- package/dist/hooks/chunk-UEK47YUF.js +0 -268
- package/dist/hooks/chunk-UIO45H3O.js +0 -432
- package/dist/hooks/chunk-UNLZEEVH.js +0 -5005
- package/dist/hooks/chunk-UNRVF3SZ.js +0 -432
- package/dist/hooks/chunk-USLFAFOI.js +0 -3453
- package/dist/hooks/chunk-VAEELMLL.js +0 -442
- package/dist/hooks/chunk-VALSWLDQ.js +0 -3453
- package/dist/hooks/chunk-VC5JEPNY.js +0 -3398
- package/dist/hooks/chunk-VEZVK6C7.js +0 -230
- package/dist/hooks/chunk-VK5JKFAR.js +0 -49
- package/dist/hooks/chunk-VNF2KP7Z.js +0 -469
- package/dist/hooks/chunk-VWWCUMW6.js +0 -2669
- package/dist/hooks/chunk-W4JARUQV.js +0 -137
- package/dist/hooks/chunk-WEOBMNJG.js +0 -2993
- package/dist/hooks/chunk-WKJU3J5Y.js +0 -5390
- package/dist/hooks/chunk-WMN4TSVF.js +0 -3299
- package/dist/hooks/chunk-WNON54PT.js +0 -3469
- package/dist/hooks/chunk-WOVKBPPX.js +0 -137
- package/dist/hooks/chunk-WRVFORYJ.js +0 -432
- package/dist/hooks/chunk-WUBVYGQZ.js +0 -240
- package/dist/hooks/chunk-WWULTUOM.js +0 -68
- package/dist/hooks/chunk-WXHKKB45.js +0 -4962
- package/dist/hooks/chunk-XAI3YTHJ.js +0 -469
- package/dist/hooks/chunk-XFZH6JZJ.js +0 -77
- package/dist/hooks/chunk-XGPWX6IA.js +0 -137
- package/dist/hooks/chunk-XIXXIVGY.js +0 -566
- package/dist/hooks/chunk-XKDOYJGA.js +0 -922
- package/dist/hooks/chunk-YALTVBHM.js +0 -432
- package/dist/hooks/chunk-YEBEPBFK.js +0 -5014
- package/dist/hooks/chunk-YI2BQ3DK.js +0 -3441
- package/dist/hooks/chunk-YVNBCFGG.js +0 -1829
- package/dist/hooks/chunk-YXBN3RGG.js +0 -432
- package/dist/hooks/chunk-Z2OOJSW3.js +0 -3163
- package/dist/hooks/chunk-ZA3HVBOY.js +0 -2644
- package/dist/hooks/chunk-ZKID46U3.js +0 -137
- package/dist/hooks/chunk-ZPMU2JV6.js +0 -49
- package/dist/hooks/chunk-ZRKY4W7O.js +0 -432
- package/dist/hooks/chunk-ZTMRB7LJ.js +0 -268
- package/dist/hooks/chunk-ZVPPBQ3L.js +0 -3413
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
lane_child_marker
|
|
3
|
-
} from "./chunk-GX4HO7SJ.js";
|
|
4
|
-
import {
|
|
5
|
-
time_bundle_call,
|
|
6
|
-
time_format,
|
|
7
|
-
time_round_trips,
|
|
8
|
-
time_spans,
|
|
9
|
-
time_transcript_line
|
|
10
|
-
} from "./chunk-ECXVCCVD.js";
|
|
11
|
-
|
|
12
|
-
// scripts/lane/lane-guard-policy.ts
|
|
13
|
-
var LANE_GUARD_POLICY = [
|
|
14
|
-
{
|
|
15
|
-
id: "investigation",
|
|
16
|
-
fires_in_lane_child: false,
|
|
17
|
-
because: "the child is itself the delegated unit the refusal asks for \u2014 it cannot dispatch a sub-unit to read its own edit targets, and the remedy the reason names does not exist for it, the same exemption a subagent transcript already gets in `should_block`"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: "batching",
|
|
21
|
-
fires_in_lane_child: false,
|
|
22
|
-
because: "the reissue-in-one-turn correction presumes a main line that reshapes its next turn; a child doing dependent single reads of the files it is about to edit is not batching wrongly, and the refusal ends its turn instead of guiding it"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "rule",
|
|
26
|
-
fires_in_lane_child: true,
|
|
27
|
-
because: "it carries the lane-only rules a child depends on (`pre-gate-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"
|
|
28
|
-
}
|
|
29
|
-
];
|
|
30
|
-
var KNOWN_GUARD_IDS = LANE_GUARD_POLICY.map((entry) => entry.id);
|
|
31
|
-
function entry_for(id) {
|
|
32
|
-
return LANE_GUARD_POLICY.find((entry) => entry.id === id.trim());
|
|
33
|
-
}
|
|
34
|
-
function fires_in_lane_child(id) {
|
|
35
|
-
return entry_for(id)?.fires_in_lane_child ?? true;
|
|
36
|
-
}
|
|
37
|
-
function is_suppressed_here(id, directory = process.cwd(), source = process.env) {
|
|
38
|
-
if (fires_in_lane_child(id)) return false;
|
|
39
|
-
return lane_child_marker.is_child_of(directory, source);
|
|
40
|
-
}
|
|
41
|
-
var lane_guard_policy = {
|
|
42
|
-
LANE_GUARD_POLICY,
|
|
43
|
-
KNOWN_GUARD_IDS,
|
|
44
|
-
entry_for,
|
|
45
|
-
fires_in_lane_child,
|
|
46
|
-
is_suppressed_here
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// scripts/time-runtime/time-agent-bundles.ts
|
|
50
|
-
var NONE = 0;
|
|
51
|
-
var ONE = 1;
|
|
52
|
-
var MIN_GROUP = 2;
|
|
53
|
-
function is_launch(span) {
|
|
54
|
-
return span.category === time_spans.TOOL_CATEGORY && !span.is_continuation && time_bundle_call.is_launch_tool(span.label);
|
|
55
|
-
}
|
|
56
|
-
function new_walk() {
|
|
57
|
-
return { closed: [], open: NONE, wrote_since: false, turn_id: time_spans.NO_MESSAGE_ID };
|
|
58
|
-
}
|
|
59
|
-
function close_group(walk) {
|
|
60
|
-
if (walk.open >= MIN_GROUP) walk.closed.push(walk.open);
|
|
61
|
-
walk.open = NONE;
|
|
62
|
-
}
|
|
63
|
-
function is_same_turn(walk, span) {
|
|
64
|
-
return span.message_id !== time_spans.NO_MESSAGE_ID && span.message_id === walk.turn_id;
|
|
65
|
-
}
|
|
66
|
-
function open_turn(walk, span) {
|
|
67
|
-
if (walk.wrote_since || span.has_prior_reference) close_group(walk);
|
|
68
|
-
walk.open += ONE;
|
|
69
|
-
walk.turn_id = span.message_id;
|
|
70
|
-
walk.wrote_since = false;
|
|
71
|
-
}
|
|
72
|
-
function step(walk, span) {
|
|
73
|
-
if (span.is_writing) {
|
|
74
|
-
walk.wrote_since = true;
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (!is_launch(span) || is_same_turn(walk, span)) return;
|
|
78
|
-
open_turn(walk, span);
|
|
79
|
-
}
|
|
80
|
-
function agent_bundles(spans) {
|
|
81
|
-
const walk = new_walk();
|
|
82
|
-
for (const span of time_round_trips.in_time_order(spans)) step(walk, span);
|
|
83
|
-
close_group(walk);
|
|
84
|
-
return walk.closed;
|
|
85
|
-
}
|
|
86
|
-
var time_agent_bundles = { agent_bundles };
|
|
87
|
-
|
|
88
|
-
// scripts/time-runtime/time-bundles.ts
|
|
89
|
-
var { unmeasured_row } = time_format;
|
|
90
|
-
var HEADING = "Bundling:";
|
|
91
|
-
var SEQUENCE_LABEL = "bundleable sequences";
|
|
92
|
-
var RECOVERABLE_LABEL = "recoverable round trips";
|
|
93
|
-
var SAVING_LABEL = "recoverable wait";
|
|
94
|
-
var BY_TOOL_LABEL = "recoverable by tool";
|
|
95
|
-
var AGENT_ROW_LABEL = "Agent";
|
|
96
|
-
var ROW_INDENT = " ";
|
|
97
|
-
var MIN_SEQUENCE = 2;
|
|
98
|
-
var ONE_CALL = 1;
|
|
99
|
-
var NONE2 = 0;
|
|
100
|
-
var PATH_SEPARATOR = "/";
|
|
101
|
-
var FIRST_CALL = 1;
|
|
102
|
-
var NO_LABEL = "";
|
|
103
|
-
var NO_BUNDLES = {
|
|
104
|
-
sequence_count: 0,
|
|
105
|
-
longest_sequence: 0,
|
|
106
|
-
recoverable_round_trips: 0,
|
|
107
|
-
by_tool: [],
|
|
108
|
-
unattributed_round_trips: 0,
|
|
109
|
-
is_measured: false
|
|
110
|
-
};
|
|
111
|
-
function contains_segments(whole, part) {
|
|
112
|
-
if (whole.startsWith(`${part}${PATH_SEPARATOR}`)) return true;
|
|
113
|
-
return whole.endsWith(`${PATH_SEPARATOR}${part}`) || whole.includes(`${PATH_SEPARATOR}${part}${PATH_SEPARATOR}`);
|
|
114
|
-
}
|
|
115
|
-
function is_related(left, right) {
|
|
116
|
-
if (left === right) return true;
|
|
117
|
-
return contains_segments(left, right) || contains_segments(right, left);
|
|
118
|
-
}
|
|
119
|
-
function shares_target(left, right) {
|
|
120
|
-
return left.some((one) => right.some((other) => is_related(one, other)));
|
|
121
|
-
}
|
|
122
|
-
function is_dependent(earlier, later) {
|
|
123
|
-
if (earlier.is_writing && later.is_writing) return false;
|
|
124
|
-
return shares_target(earlier.targets, later.targets);
|
|
125
|
-
}
|
|
126
|
-
function conflicts(span, sequence) {
|
|
127
|
-
return sequence.some((earlier) => is_dependent(earlier, span));
|
|
128
|
-
}
|
|
129
|
-
function is_call(span) {
|
|
130
|
-
return span.category === time_spans.TOOL_CATEGORY && !span.is_continuation;
|
|
131
|
-
}
|
|
132
|
-
function is_turn_boundary(span) {
|
|
133
|
-
return span.category === time_spans.MODEL_CATEGORY;
|
|
134
|
-
}
|
|
135
|
-
function new_walk2() {
|
|
136
|
-
return { pending: [], sequence: [], closed: [] };
|
|
137
|
-
}
|
|
138
|
-
function flush(walk) {
|
|
139
|
-
if (walk.sequence.length >= MIN_SEQUENCE) walk.closed.push(walk.sequence);
|
|
140
|
-
walk.sequence = [];
|
|
141
|
-
}
|
|
142
|
-
function extend(walk, span) {
|
|
143
|
-
if (conflicts(span, walk.sequence)) flush(walk);
|
|
144
|
-
walk.sequence.push(span);
|
|
145
|
-
}
|
|
146
|
-
function close_trip(walk) {
|
|
147
|
-
const [only] = walk.pending;
|
|
148
|
-
if (walk.pending.length === ONE_CALL && only?.is_bundleable === true) extend(walk, only);
|
|
149
|
-
else if (walk.pending.length > NONE2) flush(walk);
|
|
150
|
-
walk.pending = [];
|
|
151
|
-
}
|
|
152
|
-
function is_same_turn2(span, pending) {
|
|
153
|
-
const [first] = pending;
|
|
154
|
-
if (first === void 0 || span.is_continuation || span.message_id === time_spans.NO_MESSAGE_ID) {
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
return span.message_id === first.message_id;
|
|
158
|
-
}
|
|
159
|
-
function step2(walk, span) {
|
|
160
|
-
if (is_call(span)) {
|
|
161
|
-
walk.pending.push(span);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (is_same_turn2(span, walk.pending)) return;
|
|
165
|
-
close_trip(walk);
|
|
166
|
-
if (!is_turn_boundary(span)) flush(walk);
|
|
167
|
-
}
|
|
168
|
-
function longest_of(sizes) {
|
|
169
|
-
return sizes.length === NONE2 ? NONE2 : Math.max(...sizes);
|
|
170
|
-
}
|
|
171
|
-
function recoverable_of(sizes) {
|
|
172
|
-
return sizes.reduce((sum, size) => sum + size - ONE_CALL, NONE2);
|
|
173
|
-
}
|
|
174
|
-
function sizes_of(closed) {
|
|
175
|
-
return closed.map((sequence) => sequence.length);
|
|
176
|
-
}
|
|
177
|
-
function tally_for(tallies, label) {
|
|
178
|
-
const found = tallies.get(label);
|
|
179
|
-
if (found !== void 0) return found;
|
|
180
|
-
const created = { sequence_count: NONE2, recoverable_round_trips: NONE2 };
|
|
181
|
-
tallies.set(label, created);
|
|
182
|
-
return created;
|
|
183
|
-
}
|
|
184
|
-
function count_trip(tallies, counted, label) {
|
|
185
|
-
const tally = tally_for(tallies, label);
|
|
186
|
-
tally.recoverable_round_trips += ONE_CALL;
|
|
187
|
-
if (!counted.has(label)) tally.sequence_count += ONE_CALL;
|
|
188
|
-
counted.add(label);
|
|
189
|
-
}
|
|
190
|
-
function tally_sequence(tallies, sequence) {
|
|
191
|
-
const counted = /* @__PURE__ */ new Set();
|
|
192
|
-
for (const span of sequence.slice(FIRST_CALL)) {
|
|
193
|
-
if (span.label !== NO_LABEL) count_trip(tallies, counted, span.label);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
function by_weight(left, right) {
|
|
197
|
-
if (left.recoverable_round_trips !== right.recoverable_round_trips) {
|
|
198
|
-
return right.recoverable_round_trips - left.recoverable_round_trips;
|
|
199
|
-
}
|
|
200
|
-
return left.label.localeCompare(right.label);
|
|
201
|
-
}
|
|
202
|
-
function tool_rows(closed) {
|
|
203
|
-
const tallies = /* @__PURE__ */ new Map();
|
|
204
|
-
for (const sequence of closed) tally_sequence(tallies, sequence);
|
|
205
|
-
return [...tallies].map(([label, tally]) => ({ label, ...tally })).toSorted(by_weight);
|
|
206
|
-
}
|
|
207
|
-
function attributed_of(rows) {
|
|
208
|
-
return rows.reduce((sum, row) => sum + row.recoverable_round_trips, NONE2);
|
|
209
|
-
}
|
|
210
|
-
function with_agent_row(rows, agent_sizes) {
|
|
211
|
-
const recoverable_round_trips = recoverable_of(agent_sizes);
|
|
212
|
-
if (recoverable_round_trips === NONE2) return [...rows];
|
|
213
|
-
const row = {
|
|
214
|
-
label: AGENT_ROW_LABEL,
|
|
215
|
-
sequence_count: agent_sizes.length,
|
|
216
|
-
recoverable_round_trips
|
|
217
|
-
};
|
|
218
|
-
return [...rows, row].toSorted(by_weight);
|
|
219
|
-
}
|
|
220
|
-
function build_bundles(spans) {
|
|
221
|
-
const walk = new_walk2();
|
|
222
|
-
for (const span of time_round_trips.in_time_order(spans)) step2(walk, span);
|
|
223
|
-
close_trip(walk);
|
|
224
|
-
flush(walk);
|
|
225
|
-
const sizes = sizes_of(walk.closed);
|
|
226
|
-
const agent_sizes = time_agent_bundles.agent_bundles(spans);
|
|
227
|
-
const by_tool = with_agent_row(tool_rows(walk.closed), agent_sizes);
|
|
228
|
-
const recoverable_round_trips = recoverable_of(sizes) + recoverable_of(agent_sizes);
|
|
229
|
-
return {
|
|
230
|
-
sequence_count: sizes.length + agent_sizes.length,
|
|
231
|
-
longest_sequence: Math.max(longest_of(sizes), longest_of(agent_sizes)),
|
|
232
|
-
recoverable_round_trips,
|
|
233
|
-
by_tool,
|
|
234
|
-
unattributed_round_trips: recoverable_round_trips - attributed_of(by_tool),
|
|
235
|
-
is_measured: time_spans.has_transcript_data(spans.length)
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
function open_sequence(spans) {
|
|
239
|
-
const walk = new_walk2();
|
|
240
|
-
for (const span of time_round_trips.in_time_order(spans)) step2(walk, span);
|
|
241
|
-
return walk.sequence;
|
|
242
|
-
}
|
|
243
|
-
function sequence_suffix(totals) {
|
|
244
|
-
return `longest ${String(totals.longest_sequence)} turn(s)`;
|
|
245
|
-
}
|
|
246
|
-
function recoverable_suffix(totals, round_trip_count) {
|
|
247
|
-
const share = time_format.format_share(totals.recoverable_round_trips, round_trip_count);
|
|
248
|
-
return `${share} of ${String(round_trip_count)} round trip(s)`;
|
|
249
|
-
}
|
|
250
|
-
function saving_line(totals, model_ms_per_round_trip) {
|
|
251
|
-
const saved_ms = totals.recoverable_round_trips * model_ms_per_round_trip;
|
|
252
|
-
const rate = `at ${time_format.format_seconds(model_ms_per_round_trip)} model time per round trip`;
|
|
253
|
-
return time_format.format_row(SAVING_LABEL, saved_ms, rate);
|
|
254
|
-
}
|
|
255
|
-
function by_tool_suffix(totals) {
|
|
256
|
-
const attributed = totals.recoverable_round_trips - totals.unattributed_round_trips;
|
|
257
|
-
return `${String(attributed)} of ${String(totals.recoverable_round_trips)} attributed`;
|
|
258
|
-
}
|
|
259
|
-
function tool_row(row) {
|
|
260
|
-
return time_format.format_columns(
|
|
261
|
-
`${ROW_INDENT}${row.label}`,
|
|
262
|
-
String(row.recoverable_round_trips),
|
|
263
|
-
`in ${String(row.sequence_count)} sequence(s)`
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
function by_tool_lines(totals) {
|
|
267
|
-
const heading = time_format.format_columns(
|
|
268
|
-
BY_TOOL_LABEL,
|
|
269
|
-
String(totals.by_tool.length),
|
|
270
|
-
by_tool_suffix(totals)
|
|
271
|
-
);
|
|
272
|
-
const rows = totals.by_tool.slice(NONE2, time_format.MAX_ROWS).map((row) => tool_row(row));
|
|
273
|
-
return [heading, ...rows, ...time_format.overflow_line(totals.by_tool.length)];
|
|
274
|
-
}
|
|
275
|
-
function measured_lines(totals, price) {
|
|
276
|
-
return [
|
|
277
|
-
time_format.format_columns(
|
|
278
|
-
SEQUENCE_LABEL,
|
|
279
|
-
String(totals.sequence_count),
|
|
280
|
-
sequence_suffix(totals)
|
|
281
|
-
),
|
|
282
|
-
time_format.format_columns(
|
|
283
|
-
RECOVERABLE_LABEL,
|
|
284
|
-
String(totals.recoverable_round_trips),
|
|
285
|
-
recoverable_suffix(totals, price.round_trip_count)
|
|
286
|
-
),
|
|
287
|
-
saving_line(totals, price.model_ms_per_round_trip),
|
|
288
|
-
...by_tool_lines(totals)
|
|
289
|
-
];
|
|
290
|
-
}
|
|
291
|
-
var LABELS = [SEQUENCE_LABEL, RECOVERABLE_LABEL, SAVING_LABEL, BY_TOOL_LABEL];
|
|
292
|
-
function no_divisor_lines() {
|
|
293
|
-
return LABELS.map((label) => time_format.format_columns(label, "", time_format.NO_CALLS));
|
|
294
|
-
}
|
|
295
|
-
function bundle_lines(totals, price) {
|
|
296
|
-
const heading = ["", HEADING];
|
|
297
|
-
if (!totals.is_measured) return [...heading, ...LABELS.map((label) => unmeasured_row(label))];
|
|
298
|
-
if (price.round_trip_count === NONE2) return [...heading, ...no_divisor_lines()];
|
|
299
|
-
return [...heading, ...measured_lines(totals, price)];
|
|
300
|
-
}
|
|
301
|
-
var time_bundles = {
|
|
302
|
-
HEADING,
|
|
303
|
-
SEQUENCE_LABEL,
|
|
304
|
-
RECOVERABLE_LABEL,
|
|
305
|
-
SAVING_LABEL,
|
|
306
|
-
BY_TOOL_LABEL,
|
|
307
|
-
MIN_SEQUENCE,
|
|
308
|
-
NO_BUNDLES,
|
|
309
|
-
build_bundles,
|
|
310
|
-
bundle_lines,
|
|
311
|
-
is_dependent,
|
|
312
|
-
open_sequence,
|
|
313
|
-
shares_target
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
// scripts/time-runtime/time-command-key.ts
|
|
317
|
-
var UNNAMED_KEY = "";
|
|
318
|
-
function command_key(span) {
|
|
319
|
-
if (span.label === time_spans.UNKNOWN_TOOL) return UNNAMED_KEY;
|
|
320
|
-
return span.josh_command === "" ? span.label : span.josh_command;
|
|
321
|
-
}
|
|
322
|
-
var time_command_key = { UNNAMED_KEY, command_key };
|
|
323
|
-
|
|
324
|
-
// scripts/time-runtime/time-call-identity.ts
|
|
325
|
-
var IDENTITY_SEPARATOR = "\0";
|
|
326
|
-
function identity_of(call) {
|
|
327
|
-
return [
|
|
328
|
-
time_command_key.command_key(call),
|
|
329
|
-
call.check_key,
|
|
330
|
-
[...call.targets].toSorted((left, right) => left.localeCompare(right)).join(",")
|
|
331
|
-
].join(IDENTITY_SEPARATOR);
|
|
332
|
-
}
|
|
333
|
-
var time_call_identity = { identity_of };
|
|
334
|
-
|
|
335
|
-
// scripts/time-runtime/time-batch-guard.ts
|
|
336
|
-
var CONSECUTIVE_LIMIT = 3;
|
|
337
|
-
var ONE_TURN = 1;
|
|
338
|
-
var NONE3 = 0;
|
|
339
|
-
var SEQUENCE_BEFORE_LIMIT = CONSECUTIVE_LIMIT - ONE_TURN;
|
|
340
|
-
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.`;
|
|
341
|
-
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 fires once per run of single-call turns.`;
|
|
342
|
-
var WHOLE_FILE_WRITE_TOOL = "Write";
|
|
343
|
-
function is_guarded_call(call) {
|
|
344
|
-
if (call.name === WHOLE_FILE_WRITE_TOOL) return false;
|
|
345
|
-
return time_bundle_call.call_facts(call.name, call.input).is_bundleable;
|
|
346
|
-
}
|
|
347
|
-
function is_notice_call(call) {
|
|
348
|
-
return call.name === WHOLE_FILE_WRITE_TOOL;
|
|
349
|
-
}
|
|
350
|
-
function is_read_only_call(call) {
|
|
351
|
-
const facts = time_bundle_call.call_facts(call.name, call.input);
|
|
352
|
-
return facts.is_bundleable && !facts.may_write;
|
|
353
|
-
}
|
|
354
|
-
function depends_on_sequence(sequence, facts) {
|
|
355
|
-
return sequence.some((span) => time_bundles.shares_target(span.targets, facts.targets));
|
|
356
|
-
}
|
|
357
|
-
function sequence_started_ms(sequence) {
|
|
358
|
-
return sequence[0]?.ended_ms ?? NONE3;
|
|
359
|
-
}
|
|
360
|
-
function is_sequence_at_limit(sequence, facts, refused_at_ms) {
|
|
361
|
-
if (sequence.length < SEQUENCE_BEFORE_LIMIT || depends_on_sequence(sequence, facts)) return false;
|
|
362
|
-
return sequence_started_ms(sequence) > refused_at_ms;
|
|
363
|
-
}
|
|
364
|
-
function is_at_limit(spans, call, last_fired_ms) {
|
|
365
|
-
return is_sequence_at_limit(
|
|
366
|
-
time_bundles.open_sequence(spans),
|
|
367
|
-
time_bundle_call.call_facts(call.name, call.input),
|
|
368
|
-
last_fired_ms
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
var GUARD_LABEL = time_transcript_line.guard_from_refusal(REASON);
|
|
372
|
-
function is_reissued_refusal(spans, call) {
|
|
373
|
-
const identity = time_call_identity.identity_of(
|
|
374
|
-
time_spans.to_tool_call(call.name, call.input, time_spans.NO_MESSAGE_ID)
|
|
375
|
-
);
|
|
376
|
-
return spans.some(
|
|
377
|
-
(span) => span.refusal_guard === GUARD_LABEL && time_call_identity.identity_of(span) === identity
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
function should_block(text, call, refused_at_ms) {
|
|
381
|
-
if (!is_guarded_call(call)) return false;
|
|
382
|
-
const { spans } = time_spans.parse_timeline(text);
|
|
383
|
-
if (is_reissued_refusal(spans, call)) return false;
|
|
384
|
-
return is_at_limit(spans, call, refused_at_ms);
|
|
385
|
-
}
|
|
386
|
-
function should_notify(text, call, notified_at_ms) {
|
|
387
|
-
if (!is_notice_call(call)) return false;
|
|
388
|
-
return is_at_limit(time_spans.parse_timeline(text).spans, call, notified_at_ms);
|
|
389
|
-
}
|
|
390
|
-
var STAMP_PREFIX = "josh-batch-guard-";
|
|
391
|
-
var NOTICE_STAMP_PREFIX = "josh-batch-guard-notice-";
|
|
392
|
-
var time_batch_guard = {
|
|
393
|
-
CONSECUTIVE_LIMIT,
|
|
394
|
-
GUARD_LABEL,
|
|
395
|
-
NOTICE,
|
|
396
|
-
NOTICE_STAMP_PREFIX,
|
|
397
|
-
REASON,
|
|
398
|
-
SEQUENCE_BEFORE_LIMIT,
|
|
399
|
-
STAMP_PREFIX,
|
|
400
|
-
is_guarded_call,
|
|
401
|
-
is_notice_call,
|
|
402
|
-
is_read_only_call,
|
|
403
|
-
should_block,
|
|
404
|
-
should_notify
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
export {
|
|
408
|
-
lane_guard_policy,
|
|
409
|
-
time_batch_guard
|
|
410
|
-
};
|