@joshuafolkken/kit 1.1383.0 → 1.1387.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 (52) hide show
  1. package/dist/hooks/batch-guard.js +6 -6
  2. package/dist/hooks/{chunk-4MGHBTOM.js → chunk-2YSW3CXH.js} +8 -2
  3. package/dist/hooks/{chunk-KCF2YE7O.js → chunk-DCY2GWHC.js} +5 -5
  4. package/dist/hooks/{chunk-KC6LUZZ2.js → chunk-EAQEGME7.js} +1 -1
  5. package/dist/hooks/{chunk-LC56R53A.js → chunk-EBSHN25W.js} +3 -3
  6. package/dist/hooks/{chunk-6MAW7BCM.js → chunk-GJ7JPIHN.js} +14 -14
  7. package/dist/hooks/{chunk-6AC4C2IO.js → chunk-GNDJ7NJ7.js} +59 -462
  8. package/dist/hooks/{chunk-LOJTBU5V.js → chunk-IYVOLN6A.js} +3 -3
  9. package/dist/hooks/{chunk-Y5R47QHU.js → chunk-J3KSS7II.js} +1 -1
  10. package/dist/hooks/{chunk-RYP3TSUJ.js → chunk-LMWBRJIP.js} +3 -3
  11. package/dist/hooks/{chunk-TT742SIO.js → chunk-SL4GQ2XP.js} +2 -2
  12. package/dist/hooks/{chunk-YKUITFT7.js → chunk-STDSEPWU.js} +2 -2
  13. package/dist/hooks/{chunk-2X2ART5G.js → chunk-U32VSRNG.js} +420 -4
  14. package/dist/hooks/{chunk-7VSZ2N4B.js → chunk-WNFJLBXI.js} +3 -3
  15. package/dist/hooks/codex-hook-adapter.js +13 -13
  16. package/dist/hooks/duplicate-read-guard.js +7 -7
  17. package/dist/hooks/format-edited.js +3 -3
  18. package/dist/hooks/inputs.json +208 -206
  19. package/dist/hooks/investigation-guard.js +7 -7
  20. package/dist/hooks/pretool-guard.js +12 -12
  21. package/dist/hooks/session-lang.js +65 -9
  22. package/dist/hooks/stop-guard.js +91 -23
  23. package/dist/josh.js +1 -1
  24. package/package.json +1 -1
  25. package/scripts/backlog/backlog-drive-cli.ts +2 -4
  26. package/scripts/backlog/backlog-drive-launch.ts +2 -0
  27. package/scripts/backlog/backlog-drive-owner.ts +72 -5
  28. package/scripts/backlog/backlogrun-launch.ts +56 -5
  29. package/scripts/document/document-byte-budget.ts +1 -1
  30. package/scripts/init/start-plan.ts +15 -4
  31. package/scripts/init/start-steps.ts +31 -3
  32. package/scripts/init/start.ts +20 -13
  33. package/scripts/josh/josh-commands-project.ts +1 -1
  34. package/scripts/run/board/run-board-header.ts +39 -13
  35. package/scripts/run/board/run-board-read.ts +9 -2
  36. package/scripts/run/board/run-board-setup.ts +73 -0
  37. package/scripts/run/board/run-board-span.ts +49 -7
  38. package/scripts/run/board/run-board-status.ts +10 -6
  39. package/scripts/run/board/run-board-tick.ts +10 -2
  40. package/scripts/run/carry/run-carry-added.ts +1 -1
  41. package/scripts/run/carry/run-carry-change.ts +1 -1
  42. package/scripts/run/carry/run-carry-cli.ts +37 -7
  43. package/scripts/run/carry/run-carry-ended.ts +9 -1
  44. package/scripts/run/carry/run-carry.ts +16 -0
  45. package/scripts/run/event/run-event-render.ts +1 -0
  46. package/scripts/run/event/run-event-setup.ts +47 -0
  47. package/scripts/run/event/run-event-stream.ts +26 -5
  48. package/scripts/run/run-stranded-detect.ts +58 -12
  49. package/scripts/run/wake/run-wake-cli.ts +51 -6
  50. package/scripts/run/wake/run-wake-describe.ts +2 -0
  51. package/scripts/run/wake/run-wake-driver.ts +10 -1
  52. package/scripts/run/wake/run-wake-handoff.ts +1 -1
@@ -6,9 +6,9 @@ import {
6
6
  lane_child_invocation,
7
7
  repo_discovery,
8
8
  repo_origin,
9
- repository_lock,
10
- run_ship_stage
11
- } from "./chunk-2X2ART5G.js";
9
+ run_event_stream,
10
+ run_event_stream_emit
11
+ } from "./chunk-U32VSRNG.js";
12
12
  import {
13
13
  error_text
14
14
  } from "./chunk-CDY4NFQG.js";
@@ -30,10 +30,10 @@ import {
30
30
  time_density_hook,
31
31
  time_shell,
32
32
  time_transcript_line
33
- } from "./chunk-TT742SIO.js";
33
+ } from "./chunk-SL4GQ2XP.js";
34
34
  import {
35
35
  lane_child_marker
36
- } from "./chunk-Y5R47QHU.js";
36
+ } from "./chunk-J3KSS7II.js";
37
37
  import {
38
38
  agent_session_environment,
39
39
  backlog_budget,
@@ -41,9 +41,8 @@ import {
41
41
  git_command,
42
42
  has_timed_out,
43
43
  json_value,
44
- process_identity,
45
- run_carry
46
- } from "./chunk-4MGHBTOM.js";
44
+ process_identity
45
+ } from "./chunk-2YSW3CXH.js";
47
46
  import {
48
47
  COMMAND_TIMEOUT_MS,
49
48
  stamp_file
@@ -1061,406 +1060,7 @@ var lane_background = {
1061
1060
  // scripts/run/ship/run-ship-detach.ts
1062
1061
  import { randomUUID } from "node:crypto";
1063
1062
  import { setTimeout as sleep } from "node:timers/promises";
1064
-
1065
- // scripts/run/event/run-event-stream.ts
1066
1063
  import { z as z4 } from "zod";
1067
- var EVENT_PREFIX = "josh-run-events-";
1068
- var EVENT_SUFFIX = ".jsonl";
1069
- var EVENT_CAP = 500;
1070
- var FIRST_POSITION = 0;
1071
- var POSITION_INCREMENT = 1;
1072
- var LINE_SEPARATOR = "\n";
1073
- var WORD_SEPARATOR = " ";
1074
- var STAGE_PHASE_INDEX = 2;
1075
- var LOCK_SUFFIX = ".lock";
1076
- var LOCK_WAIT_MS = 5e3;
1077
- var EVENT_KIND = {
1078
- PLAN: "plan",
1079
- CHILD_LAUNCH: "child-launch",
1080
- MERGE: "merge",
1081
- PARK: "park",
1082
- SPLIT: "split",
1083
- OUTAGE: "outage",
1084
- CUT: "cut",
1085
- // A fresh session adopted an implementation cut — `run:cut --resume` answered `resume-impl`. The
1086
- // resume clears the cut record, so without this the `cut` would stay the newest position and
1087
- // `run:step` would keep answering the resume command it had just run.
1088
- RESUME: "resume",
1089
- // The backlog emptied while nothing of the run's own was in flight — the drain. It marks the position
1090
- // at which the end-of-run retrospective is owed, *before* the idle watch opens, so `run:step` fires
1091
- // the retrospective at the drain rather than after the watch runs its course. It is not itself a
1092
- // stop: the run watches on once the retrospective has run, and the real `STOP` follows when the watch
1093
- // expires.
1094
- DRAIN: "drain",
1095
- STOP: "stop",
1096
- PR_OPENED: "pr-opened",
1097
- REVIEW_ROUND: "review-round",
1098
- // The end-of-run retrospective's result, recorded when the run marks the retrospective done. A
1099
- // retrospective that files zero improvements and one that never ran look
1100
- // the same from outside — no new Issue either way — so the result is put on the stream the report is
1101
- // generated from: the issues filed (or that none were), and the candidates dropped with why. It is
1102
- // emitted from the `run:carry --retrospective` close, so marking the retrospective done and recording
1103
- // what it found are one action rather than two the run could do only one of.
1104
- RETROSPECTIVE: "retrospective",
1105
- // Ready backlog work is sitting undispatched while a lane is free and nothing has dispatched for a
1106
- // while. Emitted once per stall episode by the stop-time detector, it is both the dedup marker —
1107
- // `emit_once_since` refuses a second until a `CHILD_LAUNCH` intervenes — and the line a terminal
1108
- // reader following the stream sees. `run:step` reads it as `backlog:next`, so a run that
1109
- // stalled is pointed straight at dispatching the work rather than left waiting.
1110
- STALL: "stall",
1111
- // The run's own driver is gone: the cut handed the budget off, the owner has died, and no supervisor
1112
- // is watching. Emitted once per strand episode by the stop-time detector,
1113
- // exactly as `STALL` is — the newest-event dedup keeps a run polled every stop from notifying more
1114
- // than once, and a terminal reader following the stream sees the line. The strand is the step before
1115
- // the stall: a stalled run still has a driver that could dispatch, a stranded one has none.
1116
- STRANDED: "stranded",
1117
- // One `josh ship` stage starting, succeeding or failing. It is a trace of the
1118
- // composite's progress rather than a position the run is at — the positions a ship leaves behind are
1119
- // the closed issue its `followup` merges, or a detached supervisor's `SHIP_LAUNCH` / `SHIP_STOP` below
1120
- // — so it is one of the `TRACE_KINDS` the last-event read skips.
1121
- SHIP_STAGE: "ship-stage",
1122
- // One progress watcher line — the `at … / next …` heartbeat `run:progress` prints. Printed only to
1123
- // the watcher's own output, a headless successor's heartbeat would be buried in its log after a cut;
1124
- // on the stream it reaches the attached session's relay. It says
1125
- // the run is alive rather than where it is, so it is a trace kind like `SHIP_STAGE`.
1126
- HEARTBEAT: "heartbeat",
1127
- // The post-implementation region handed to a detached `josh ship --detach` supervisor. Unlike a stage
1128
- // trace it is a position: the agent has ended and the
1129
- // supervisor carries the run, so `run:step` answers `wait` until it stops or the issue closes.
1130
- SHIP_LAUNCH: "ship-launch",
1131
- // The supervisor stopped at a failed stage — a red gate, a High/Medium review, a failed push, red CI
1132
- // The position that hands control back: `run:step` prints the command that
1133
- // shows the stopped report, so the agent fixes it and relaunches rather than rebuilding the context.
1134
- SHIP_STOP: "ship-stop",
1135
- // An Issue the run filed on its way, written by `issue:file`, so a run started from the command line
1136
- // still surfaces what it found — `run:board`'s findings section reads it.
1137
- FILED: "filed",
1138
- // A one-line observation short of an Issue, written with `run:event --append note` and shown in the
1139
- // same section.
1140
- NOTE: "note",
1141
- // A lane child reached a phase no other event marks — its first implementation edit, written by the
1142
- // PreToolUse hook — so `run:board` draws how far the child has got. A trace,
1143
- // like `SHIP_STAGE`: it says where the child's work is, not where the run is.
1144
- LANE_PHASE: "lane-phase",
1145
- // An issue `run:add` put into the live run. The parent's `--wait` watcher
1146
- // ends on it, so the issue takes the next free lane without waiting out the arrival probe's minute. A
1147
- // trace: it says what the run was handed, not where the run is.
1148
- ADD: "add",
1149
- // `josh lane:limit` raised a live run's lane limit. The `--wait` watcher's
1150
- // arrival probe reads it as a wake: the lanes a raise frees are new room for a pool its baseline
1151
- // already holds. A trace: it says the run gained room, not where the run is.
1152
- LANE_LIMIT: "lane-limit"
1153
- };
1154
- var EVENT_KINDS = Object.values(EVENT_KIND);
1155
- var TRACE_KINDS = /* @__PURE__ */ new Set([
1156
- EVENT_KIND.SHIP_STAGE,
1157
- EVENT_KIND.HEARTBEAT,
1158
- EVENT_KIND.FILED,
1159
- EVENT_KIND.NOTE,
1160
- EVENT_KIND.LANE_PHASE,
1161
- EVENT_KIND.ADD,
1162
- EVENT_KIND.LANE_LIMIT
1163
- ]);
1164
- var DISPOSABLE_KINDS = /* @__PURE__ */ new Set([EVENT_KIND.SHIP_STAGE, EVENT_KIND.HEARTBEAT]);
1165
- var event_schema = z4.object({
1166
- pos: z4.number(),
1167
- at: z4.string(),
1168
- kind: z4.string(),
1169
- text: z4.string()
1170
- });
1171
- function is_event_kind(value) {
1172
- return EVENT_KINDS.includes(value);
1173
- }
1174
- function target_of(repository) {
1175
- return stamp_file.stamp_path(EVENT_PREFIX, repository, EVENT_SUFFIX);
1176
- }
1177
- function is_present(event) {
1178
- return event !== void 0;
1179
- }
1180
- function parse_line(line) {
1181
- return event_schema.safeParse(json_value.parse_or_undefined(line)).data;
1182
- }
1183
- function read_lines(target) {
1184
- const raw = stamp_file.read_stamp_text(target);
1185
- if (raw === void 0) return [];
1186
- return raw.split(LINE_SEPARATOR).map((line) => line.trim()).filter((line) => line.length > 0).map((line) => parse_line(line)).filter(is_present);
1187
- }
1188
- function read_events(target) {
1189
- return read_lines(target).filter((event) => is_event_kind(event.kind));
1190
- }
1191
- function last_position(events) {
1192
- return events[events.length - POSITION_INCREMENT]?.pos ?? FIRST_POSITION;
1193
- }
1194
- function issue_of(event) {
1195
- return event.text.split(WORD_SEPARATOR)[FIRST_POSITION] ?? "";
1196
- }
1197
- function newest_stages(events) {
1198
- const newest = /* @__PURE__ */ new Map();
1199
- for (const event of events) {
1200
- if (event.kind === EVENT_KIND.SHIP_STAGE) newest.set(issue_of(event), event);
1201
- }
1202
- return new Set(newest.values());
1203
- }
1204
- function is_stage_start(event) {
1205
- if (event.kind !== EVENT_KIND.SHIP_STAGE) return false;
1206
- return event.text.split(WORD_SEPARATOR)[STAGE_PHASE_INDEX] === run_ship_stage.PHASE.START;
1207
- }
1208
- function droppable(events) {
1209
- const kept = newest_stages(events);
1210
- const disposable = events.filter((event) => DISPOSABLE_KINDS.has(event.kind) && !kept.has(event));
1211
- return [
1212
- ...disposable.filter((event) => !is_stage_start(event)),
1213
- ...disposable.filter((event) => is_stage_start(event))
1214
- ];
1215
- }
1216
- function bounded(events) {
1217
- const excess = events.length - EVENT_CAP;
1218
- if (excess <= 0) return events;
1219
- const dropped = new Set(droppable(events).slice(0, excess));
1220
- return events.filter((event) => !dropped.has(event)).slice(-EVENT_CAP);
1221
- }
1222
- function serialize(events) {
1223
- return `${events.map((event) => JSON.stringify(event)).join(LINE_SEPARATOR)}${LINE_SEPARATOR}`;
1224
- }
1225
- function append_held(target, event) {
1226
- const position = last_position(read_lines(target)) + POSITION_INCREMENT;
1227
- const events = bounded([...read_events(target), { pos: position, ...event }]);
1228
- stamp_file.replace_text_stamp(target, serialize(events));
1229
- return position;
1230
- }
1231
- function append(target, kind, text2, at) {
1232
- if (!is_event_kind(kind)) return { appended: false, position: FIRST_POSITION };
1233
- const lock = `${target}${LOCK_SUFFIX}`;
1234
- const position = repository_lock.with_lock_sync(
1235
- () => append_held(target, { at, kind, text: text2 }),
1236
- lock,
1237
- LOCK_WAIT_MS
1238
- );
1239
- if (position === void 0) {
1240
- const message = `run event stream: gave up waiting for the lock at ${lock}`;
1241
- process.stderr.write(`${message}
1242
- `);
1243
- throw new Error(message);
1244
- }
1245
- return { appended: true, position };
1246
- }
1247
- function read_from(target, position) {
1248
- const events = read_events(target);
1249
- return {
1250
- events: events.filter((event) => event.pos > position),
1251
- next_position: last_position(events)
1252
- };
1253
- }
1254
- function read_last(target) {
1255
- return read_events(target).findLast((event) => !TRACE_KINDS.has(event.kind));
1256
- }
1257
- function has_since(events, kind, reset_kind) {
1258
- const reset_at = events.findLastIndex((event) => event.kind === reset_kind);
1259
- return events.slice(reset_at + POSITION_INCREMENT).some((event) => event.kind === kind);
1260
- }
1261
- var FIELD_SEPARATOR = " \xB7 ";
1262
- function format_event(event) {
1263
- return [event.at, event.kind, event.text].join(FIELD_SEPARATOR);
1264
- }
1265
- var run_event_stream = {
1266
- EVENT_CAP,
1267
- EVENT_KIND,
1268
- EVENT_KINDS,
1269
- TRACE_KINDS,
1270
- append,
1271
- format_event,
1272
- has_since,
1273
- is_stage_start,
1274
- read_events,
1275
- read_from,
1276
- read_last,
1277
- target_of
1278
- };
1279
-
1280
- // scripts/run/event/run-event-scope.ts
1281
- var SINCE_SCOPE = "since";
1282
- var UNKNOWN_SCOPE = "unknown";
1283
- var UNKNOWN_EVENT_SCOPE = { kind: UNKNOWN_SCOPE };
1284
- function moment_of(at) {
1285
- const parsed = Date.parse(at);
1286
- return Number.isNaN(parsed) ? void 0 : parsed;
1287
- }
1288
- function is_within(event, floor) {
1289
- const at = moment_of(event.at);
1290
- return at !== void 0 && at >= floor;
1291
- }
1292
- function scoped_events(events, scope) {
1293
- if (scope.kind === UNKNOWN_SCOPE) return void 0;
1294
- const floor = moment_of(scope.started_at);
1295
- if (floor === void 0) return void 0;
1296
- return events.filter((event) => is_within(event, floor));
1297
- }
1298
- function scope_of(read) {
1299
- if (read.kind !== "carried") return UNKNOWN_EVENT_SCOPE;
1300
- return { kind: SINCE_SCOPE, started_at: read.carry.started_at };
1301
- }
1302
- function last_scoped_event(events, scope) {
1303
- return scoped_events(events, scope)?.findLast(
1304
- (event) => !run_event_stream.TRACE_KINDS.has(event.kind)
1305
- );
1306
- }
1307
- var SHIP_POSITION_KINDS = /* @__PURE__ */ new Set([
1308
- run_event_stream.EVENT_KIND.SHIP_LAUNCH,
1309
- run_event_stream.EVENT_KIND.SHIP_STOP
1310
- ]);
1311
- var KIND = run_event_stream.EVENT_KIND;
1312
- var BATCH_RECORD_KINDS = /* @__PURE__ */ new Set([
1313
- KIND.CHILD_LAUNCH,
1314
- KIND.PARK,
1315
- KIND.SPLIT,
1316
- KIND.RETROSPECTIVE,
1317
- KIND.STRANDED
1318
- ]);
1319
- var ISSUE_REFERENCE = /#(\d+)/u;
1320
- function is_foreign_ship_event(event, issue2) {
1321
- return SHIP_POSITION_KINDS.has(event.kind) && !event.text.startsWith(`${issue_cite.plain(issue2)} `);
1322
- }
1323
- function is_own_ship_event(event, issue2) {
1324
- return SHIP_POSITION_KINDS.has(event.kind) && !is_foreign_ship_event(event, issue2);
1325
- }
1326
- function issue_named(event) {
1327
- return ISSUE_REFERENCE.exec(event.text)?.[1];
1328
- }
1329
- function names_issue(event, issue2) {
1330
- return issue_named(event) === issue2;
1331
- }
1332
- function is_lane_position(event, issue2) {
1333
- return !BATCH_RECORD_KINDS.has(event.kind) && names_issue(event, issue2);
1334
- }
1335
- function since_own_launch(events, issue2) {
1336
- const launch2 = events.findLastIndex(
1337
- (event) => event.kind === KIND.CHILD_LAUNCH && names_issue(event, issue2)
1338
- );
1339
- return events.slice(launch2 + 1);
1340
- }
1341
- function is_foreign_event(event, issue2, is_lane_child) {
1342
- if (is_lane_child) return !is_lane_position(event, issue2);
1343
- return is_foreign_ship_event(event, issue2);
1344
- }
1345
- function last_issue_event(events, scope, issue2, is_lane_child) {
1346
- const attempt = is_lane_child ? since_own_launch(events, issue2) : events;
1347
- const own = attempt.filter((event) => !is_foreign_event(event, issue2, is_lane_child));
1348
- if (scope.kind === SINCE_SCOPE) return last_scoped_event(own, scope);
1349
- return own.findLast((event) => is_own_ship_event(event, issue2));
1350
- }
1351
- var LAUNCH_OR_SETTLE_KINDS = /* @__PURE__ */ new Set([
1352
- KIND.CHILD_LAUNCH,
1353
- KIND.MERGE,
1354
- KIND.PARK,
1355
- KIND.SPLIT
1356
- ]);
1357
- function is_merge_owed(events, scope, issue2) {
1358
- const newest = (scoped_events(events, scope) ?? []).findLast(
1359
- (event) => LAUNCH_OR_SETTLE_KINDS.has(event.kind) && names_issue(event, issue2)
1360
- );
1361
- return newest?.kind === KIND.CHILD_LAUNCH;
1362
- }
1363
- var run_event_scope = {
1364
- UNKNOWN_EVENT_SCOPE,
1365
- is_merge_owed,
1366
- issue_named,
1367
- last_issue_event,
1368
- last_scoped_event,
1369
- moment_of,
1370
- scope_of,
1371
- scoped_events,
1372
- since_own_launch
1373
- };
1374
-
1375
- // scripts/run/event/run-event-stream-emit.ts
1376
- function now_iso() {
1377
- return (/* @__PURE__ */ new Date()).toISOString();
1378
- }
1379
- async function stream_target() {
1380
- const repository = await run_carry.repository_directory();
1381
- return repository === void 0 ? void 0 : run_event_stream.target_of(repository);
1382
- }
1383
- async function emit(kind, text2) {
1384
- try {
1385
- const target = await stream_target();
1386
- if (target === void 0) return;
1387
- run_event_stream.append(target, kind, text2, now_iso());
1388
- } catch {
1389
- }
1390
- }
1391
- async function emit_once(kind, text2) {
1392
- try {
1393
- const target = await stream_target();
1394
- if (target === void 0 || run_event_stream.read_last(target)?.kind === kind) return false;
1395
- return run_event_stream.append(target, kind, text2, now_iso()).appended;
1396
- } catch (error) {
1397
- error_text.trace_swallowed("run_event_stream_emit.emit_once", error);
1398
- return false;
1399
- }
1400
- }
1401
- function invocation_events(repository, target) {
1402
- const events = run_event_stream.read_events(target);
1403
- const scope = run_event_scope.scope_of(run_carry.read_carry(run_carry.carry_path(repository)));
1404
- return run_event_scope.scoped_events(events, scope) ?? events;
1405
- }
1406
- async function emit_once_since(kind, text2, reset_kind) {
1407
- try {
1408
- const repository = await run_carry.repository_directory();
1409
- if (repository === void 0) return false;
1410
- const target = run_event_stream.target_of(repository);
1411
- if (run_event_stream.has_since(invocation_events(repository, target), kind, reset_kind)) {
1412
- return false;
1413
- }
1414
- return run_event_stream.append(target, kind, text2, now_iso()).appended;
1415
- } catch (error) {
1416
- error_text.trace_swallowed("run_event_stream_emit.emit_once_since", error);
1417
- return false;
1418
- }
1419
- }
1420
- async function emit_heartbeat(line) {
1421
- await emit(run_event_stream.EVENT_KIND.HEARTBEAT, line);
1422
- }
1423
- async function current_events() {
1424
- try {
1425
- const repository = await run_carry.repository_directory();
1426
- if (repository === void 0) return [];
1427
- const read = run_carry.read_carry(run_carry.carry_path(repository));
1428
- const scope = run_event_scope.scope_of(read);
1429
- const events = run_event_stream.read_events(run_event_stream.target_of(repository));
1430
- return run_event_scope.scoped_events(events, scope) ?? [];
1431
- } catch {
1432
- return [];
1433
- }
1434
- }
1435
- async function invocation_or_all_events() {
1436
- try {
1437
- const repository = await run_carry.repository_directory();
1438
- return repository === void 0 ? [] : invocation_events(repository, run_event_stream.target_of(repository));
1439
- } catch {
1440
- return [];
1441
- }
1442
- }
1443
- async function all_events() {
1444
- try {
1445
- const target = await stream_target();
1446
- return target === void 0 ? [] : run_event_stream.read_events(target);
1447
- } catch {
1448
- return [];
1449
- }
1450
- }
1451
- var run_event_stream_emit = {
1452
- all_events,
1453
- current_events,
1454
- emit,
1455
- emit_heartbeat,
1456
- emit_once,
1457
- emit_once_since,
1458
- invocation_or_all_events,
1459
- stream_target
1460
- };
1461
-
1462
- // scripts/run/ship/run-ship-detach.ts
1463
- import { z as z5 } from "zod";
1464
1064
  var LOG_PREFIX = "josh-ship-log-";
1465
1065
  var PID_PREFIX = "josh-ship-pid-";
1466
1066
  var BODY_PREFIX = "josh-ship-notify-";
@@ -1481,14 +1081,14 @@ var RESULT_PREFIX = "josh-ship-result-";
1481
1081
  var RECORD_POLL_MS = 25;
1482
1082
  var RECORD_WAIT_ATTEMPTS = 200;
1483
1083
  var CLAIM_WINDOW_MS = 12e4;
1484
- var ship_record_schema = z5.object({
1485
- pid: z5.number().int().positive().optional(),
1486
- process_start: z5.string().optional(),
1487
- launched_at: z5.number().optional(),
1488
- launcher_pid: z5.number().int().positive().optional(),
1489
- launcher_start: z5.string().optional(),
1490
- launch_id: z5.string(),
1491
- result: z5.enum(["success", "failed"]).optional()
1084
+ var ship_record_schema = z4.object({
1085
+ pid: z4.number().int().positive().optional(),
1086
+ process_start: z4.string().optional(),
1087
+ launched_at: z4.number().optional(),
1088
+ launcher_pid: z4.number().int().positive().optional(),
1089
+ launcher_start: z4.string().optional(),
1090
+ launch_id: z4.string(),
1091
+ result: z4.enum(["success", "failed"]).optional()
1492
1092
  });
1493
1093
  var LAUNCH_MARK = " \xB7 started by process ";
1494
1094
  var HEADER_START = "\n";
@@ -2021,8 +1621,8 @@ var parse_json = {
2021
1621
  };
2022
1622
 
2023
1623
  // scripts/gh/git-gh-failure.ts
2024
- import { z as z6 } from "zod";
2025
- var error_document_schema = z6.object({ status: z6.union([z6.string(), z6.number()]).optional() }).catch({});
1624
+ import { z as z5 } from "zod";
1625
+ var error_document_schema = z5.object({ status: z5.union([z5.string(), z5.number()]).optional() }).catch({});
2026
1626
  var GH_FAILURE_FIELD = "gh_failure";
2027
1627
  function has_gh_failure(error) {
2028
1628
  return error instanceof Error && Object.hasOwn(error, GH_FAILURE_FIELD);
@@ -2225,7 +1825,7 @@ var git_gh_helpers = {
2225
1825
  };
2226
1826
 
2227
1827
  // scripts/gh/git-gh-issue-rest.ts
2228
- import { z as z7 } from "zod";
1828
+ import { z as z6 } from "zod";
2229
1829
 
2230
1830
  // scripts/gh/git-gh-rest-state.ts
2231
1831
  var MERGED_STATE = "MERGED";
@@ -2234,11 +1834,11 @@ function to_gh_state(state) {
2234
1834
  }
2235
1835
 
2236
1836
  // scripts/gh/git-gh-issue-rest.ts
2237
- var rest_issue_schema = z7.looseObject({
2238
- number: z7.number(),
2239
- issue_dependencies_summary: z7.looseObject({ total_blocked_by: z7.number().optional() }).nullish(),
1837
+ var rest_issue_schema = z6.looseObject({
1838
+ number: z6.number(),
1839
+ issue_dependencies_summary: z6.looseObject({ total_blocked_by: z6.number().optional() }).nullish(),
2240
1840
  // Present only on a pull request, which this endpoint serves as readily as an issue.
2241
- pull_request: z7.looseObject({ merged_at: z7.string().nullish() }).nullish()
1841
+ pull_request: z6.looseObject({ merged_at: z6.string().nullish() }).nullish()
2242
1842
  });
2243
1843
  var REPOSITORY_URL = /\/repos\/([\w.-]+\/[\w.-]+)$/u;
2244
1844
  var REPOSITORY_URL_GROUP = 1;
@@ -2246,7 +1846,7 @@ var BLOCKED_BY_FIELD = "blockedBy";
2246
1846
  var BLOCKED_BY_COUNT_FIELD = "blocked_by_count";
2247
1847
  var STATE_FIELD = "state";
2248
1848
  var BODY_FIELD = "body";
2249
- var FIELD_SEPARATOR2 = ",";
1849
+ var FIELD_SEPARATOR = ",";
2250
1850
  var EMPTY_BODY = "";
2251
1851
  var REST_FIELD_NAMES = /* @__PURE__ */ new Map([
2252
1852
  ["url", "html_url"],
@@ -2260,7 +1860,7 @@ function rest_field_name(field) {
2260
1860
  return REST_FIELD_NAMES.get(field) ?? field;
2261
1861
  }
2262
1862
  function split_fields(fields) {
2263
- return fields.split(FIELD_SEPARATOR2).map((field) => field.trim()).filter((field) => field.length > 0);
1863
+ return fields.split(FIELD_SEPARATOR).map((field) => field.trim()).filter((field) => field.length > 0);
2264
1864
  }
2265
1865
  function to_issue_state(rest, value) {
2266
1866
  if (typeof rest.pull_request?.merged_at === "string") return MERGED_STATE;
@@ -2808,18 +2408,18 @@ var git_gh_issue = {
2808
2408
  // scripts/ci/pr-classification.ts
2809
2409
  import { readFileSync as readFileSync2 } from "node:fs";
2810
2410
  import { fileURLToPath } from "node:url";
2811
- import { z as z8 } from "zod";
2411
+ import { z as z7 } from "zod";
2812
2412
  var CLASSIFICATION_SET = new Set(RELEASE_CLASSIFICATION_NAMES);
2813
2413
  var ISSUE_BUG_LABEL = "bug";
2814
2414
  var DECLARATION_PREFIX = "- \u30EA\u30EA\u30FC\u30B9\u5206\u985E: ";
2815
2415
  var DECLARATION = new RegExp(`^${DECLARATION_PREFIX}(.+)$`, "gmu");
2816
2416
  var LEGACY_LABELS = /* @__PURE__ */ new Set(["semver-major", "semver-minor"]);
2817
- var LABEL = z8.object({ name: z8.string() });
2818
- var USER = z8.object({ login: z8.string() });
2819
- var PULL_REQUEST = z8.object({ number: z8.number(), user: USER });
2820
- var EVENT = z8.object({
2417
+ var LABEL = z7.object({ name: z7.string() });
2418
+ var USER = z7.object({ login: z7.string() });
2419
+ var PULL_REQUEST = z7.object({ number: z7.number(), user: USER });
2420
+ var EVENT = z7.object({
2821
2421
  pull_request: PULL_REQUEST,
2822
- repository: z8.object({ full_name: z8.string() })
2422
+ repository: z7.object({ full_name: z7.string() })
2823
2423
  });
2824
2424
  function classification_error(labels, author) {
2825
2425
  const legacy = labels.filter((label) => LEGACY_LABELS.has(label.toLowerCase()));
@@ -2842,7 +2442,7 @@ function release_candidates(candidates) {
2842
2442
  return candidates.filter((candidate) => candidate !== ENHANCEMENT_LABEL);
2843
2443
  }
2844
2444
  function issue_candidates(issue_json) {
2845
- const issue2 = z8.object({ labels: z8.array(LABEL), body: z8.string().nullable() }).parse(JSON.parse(issue_json));
2445
+ const issue2 = z7.object({ labels: z7.array(LABEL), body: z7.string().nullable() }).parse(JSON.parse(issue_json));
2846
2446
  const names = issue2.labels.map((label) => label.name.toLowerCase());
2847
2447
  const declared = [...(issue2.body ?? "").matchAll(DECLARATION)].map((match) => match[1] ?? "");
2848
2448
  const candidates = [...release_candidates([...names, ...declared].filter(is_classification))];
@@ -2917,30 +2517,30 @@ async function poll_until(is_done, options) {
2917
2517
  var poll = { poll_until, sleep: sleep2 };
2918
2518
 
2919
2519
  // scripts/gh/git-gh-pr.ts
2920
- import { z as z12 } from "zod";
2520
+ import { z as z11 } from "zod";
2921
2521
 
2922
2522
  // scripts/gh/git-gh-pr-rest.ts
2923
- import { z as z9 } from "zod";
2924
- var rest_repo_schema = z9.looseObject({ full_name: z9.string().optional() }).nullish();
2925
- var rest_pull_side_schema = z9.looseObject({ repo: rest_repo_schema });
2926
- var rest_pull_schema = z9.looseObject({
2927
- number: z9.number(),
2928
- html_url: z9.string().optional(),
2929
- body: z9.string().nullish(),
2930
- state: z9.string().optional(),
2931
- merged: z9.boolean().nullish(),
2932
- merged_at: z9.string().nullish(),
2933
- mergeable: z9.boolean().nullish(),
2934
- mergeable_state: z9.string().optional(),
2523
+ import { z as z8 } from "zod";
2524
+ var rest_repo_schema = z8.looseObject({ full_name: z8.string().optional() }).nullish();
2525
+ var rest_pull_side_schema = z8.looseObject({ repo: rest_repo_schema });
2526
+ var rest_pull_schema = z8.looseObject({
2527
+ number: z8.number(),
2528
+ html_url: z8.string().optional(),
2529
+ body: z8.string().nullish(),
2530
+ state: z8.string().optional(),
2531
+ merged: z8.boolean().nullish(),
2532
+ merged_at: z8.string().nullish(),
2533
+ mergeable: z8.boolean().nullish(),
2534
+ mergeable_state: z8.string().optional(),
2935
2535
  // `sha` is the head commit, which is what both halves of the merge-gate rollup are keyed by —
2936
2536
  // REST hangs the check runs and the status contexts off the commit rather than off the pull
2937
2537
  // request.
2938
- head: z9.looseObject({ ref: z9.string().optional(), sha: z9.string().optional(), repo: rest_repo_schema }).nullish(),
2538
+ head: z8.looseObject({ ref: z8.string().optional(), sha: z8.string().optional(), repo: rest_repo_schema }).nullish(),
2939
2539
  base: rest_pull_side_schema.nullish(),
2940
2540
  // `node_id` is what the GraphQL auto-merge mutation addresses a pull request by, and `auto_merge`
2941
2541
  // is `null` until auto-merge is enabled — both read by `git-gh-pr-auto-merge.ts`.
2942
- node_id: z9.string().optional(),
2943
- auto_merge: z9.looseObject({}).nullish()
2542
+ node_id: z8.string().optional(),
2543
+ auto_merge: z8.looseObject({}).nullish()
2944
2544
  });
2945
2545
  var NOT_A_PULL_MESSAGE = "gh api answered something other than a pull request object";
2946
2546
  var NOT_A_PULL_LISTING_MESSAGE = "gh api answered something other than a pull request listing";
@@ -3159,14 +2759,14 @@ var git_gh_pr_read = {
3159
2759
  };
3160
2760
 
3161
2761
  // scripts/gh/git-gh-pr-review.ts
3162
- import { z as z10 } from "zod";
2762
+ import { z as z9 } from "zod";
3163
2763
  var REVIEW_APPROVED = "APPROVED";
3164
2764
  var REVIEW_CHANGES_REQUESTED = "CHANGES_REQUESTED";
3165
2765
  var REVIEW_NONE = "";
3166
2766
  var STATE_CHANGING_REVIEWS = /* @__PURE__ */ new Set([REVIEW_APPROVED, REVIEW_CHANGES_REQUESTED]);
3167
- var rest_review_schema = z10.looseObject({
3168
- state: z10.string().optional(),
3169
- user: z10.looseObject({ login: z10.string().optional() }).nullish()
2767
+ var rest_review_schema = z9.looseObject({
2768
+ state: z9.string().optional(),
2769
+ user: z9.looseObject({ login: z9.string().optional() }).nullish()
3170
2770
  });
3171
2771
  var NOT_A_REVIEW_LISTING = "gh api answered something other than a review listing";
3172
2772
  function parse_rest_reviews(reviews_json) {
@@ -3199,18 +2799,18 @@ function to_review_decision(reviews_json) {
3199
2799
  var git_gh_pr_review = { to_review_decision };
3200
2800
 
3201
2801
  // scripts/gh/git-gh-pr-rollup.ts
3202
- import { z as z11 } from "zod";
2802
+ import { z as z10 } from "zod";
3203
2803
  var STATUS_CONTEXT_TYPE_NAME = "StatusContext";
3204
2804
  var TYPE_NAME_KEY = "__typename";
3205
- var rollup_element_schema = z11.looseObject({});
3206
- var check_runs_page_schema = z11.looseObject({
2805
+ var rollup_element_schema = z10.looseObject({});
2806
+ var check_runs_page_schema = z10.looseObject({
3207
2807
  // Required, not optional: GitHub always names the key, and accepting a page without one would
3208
2808
  // answer an empty rollup — which `git-pr-followup.ts` reports as "this branch has no checks".
3209
- check_runs: z11.array(rollup_element_schema)
2809
+ check_runs: z10.array(rollup_element_schema)
3210
2810
  });
3211
- var id_holder_schema = z11.object({ id: z11.number() });
3212
- var status_page_schema = z11.looseObject({
3213
- statuses: z11.array(rollup_element_schema)
2811
+ var id_holder_schema = z10.object({ id: z10.number() });
2812
+ var status_page_schema = z10.looseObject({
2813
+ statuses: z10.array(rollup_element_schema)
3214
2814
  });
3215
2815
  var NOT_A_CHECK_RUNS_LISTING = "gh api answered something other than a check run listing";
3216
2816
  var NOT_A_STATUS_LISTING = "gh api answered something other than a commit status listing";
@@ -3344,7 +2944,7 @@ var MERGE_READ_BACK_ATTEMPTS = 3;
3344
2944
  var MERGE_READ_BACK_INTERVAL_MS = 1e3;
3345
2945
  var PR_NUMBER_PATTERN = /\/pull\/([1-9]\d*)$/u;
3346
2946
  var LABELS_SEGMENT2 = "/labels";
3347
- var PR_LABELS = z12.array(z12.object({ name: z12.string() }));
2947
+ var PR_LABELS = z11.array(z11.object({ name: z11.string() }));
3348
2948
  async function add_pr_classification(number, label) {
3349
2949
  await git_gh_exec.exec_gh_api({
3350
2950
  path: `${git_gh_api_path.issue_api_path(number)}${LABELS_SEGMENT2}`,
@@ -3693,9 +3293,6 @@ var git_gh_command = {
3693
3293
 
3694
3294
  export {
3695
3295
  bounded_pool,
3696
- run_event_stream,
3697
- run_event_scope,
3698
- run_event_stream_emit,
3699
3296
  shell_segments,
3700
3297
  bash_triggers,
3701
3298
  tail_commands,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  investigation_reads
3
- } from "./chunk-7VSZ2N4B.js";
3
+ } from "./chunk-WNFJLBXI.js";
4
4
  import {
5
5
  lane_guard_policy
6
- } from "./chunk-KC6LUZZ2.js";
6
+ } from "./chunk-EAQEGME7.js";
7
7
  import {
8
8
  hook_decision
9
- } from "./chunk-LC56R53A.js";
9
+ } from "./chunk-EBSHN25W.js";
10
10
 
11
11
  // scripts/delegation/investigation-guard.ts
12
12
  import { text } from "node:stream/consumers";