frizz-server 0.15.65 → 0.15.66

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 (97) hide show
  1. package/dist/dev-child.js +943 -63
  2. package/package.json +1 -1
  3. package/runtime/cc-worker/hooks/session-seed.mjs +4 -4
  4. package/runtime/cc-worker/lib/frizz-tools.mjs +167 -11
  5. package/runtime/cc-worker/skills/gh/SKILL.md +16 -2
  6. package/web-dist/assets/{abnfDiagram-VCTEODGH-BiJ4o5Ds.js → abnfDiagram-VCTEODGH-CnmzOcow.js} +1 -1
  7. package/web-dist/assets/architecture-7GRP2DOG-CnM-e-E8.js +1 -0
  8. package/web-dist/assets/{architectureDiagram-5GKGNRK7-CsLqK0BE.js → architectureDiagram-5GKGNRK7-CAXL719y.js} +1 -1
  9. package/web-dist/assets/{blockDiagram-I7D4REHJ-DWs5aRRO.js → blockDiagram-I7D4REHJ-BQzG6o7g.js} +1 -1
  10. package/web-dist/assets/{c4Diagram-7LVT6UL2-Dk9wYT5j.js → c4Diagram-7LVT6UL2-CdasYbB9.js} +1 -1
  11. package/web-dist/assets/channel-Df-yP_fy.js +1 -0
  12. package/web-dist/assets/{chunk-2E4U76K2-iLxD8PcN.js → chunk-2E4U76K2-CVwqmTfo.js} +1 -1
  13. package/web-dist/assets/{chunk-4HAMMTFA-B2bZyZs2.js → chunk-4HAMMTFA-9XUFh8iW.js} +1 -1
  14. package/web-dist/assets/{chunk-75Z2AOVW-DIZn8bvE.js → chunk-75Z2AOVW-CREHsMZR.js} +1 -1
  15. package/web-dist/assets/{chunk-CLGD4ZFX-DXth0YhX.js → chunk-CLGD4ZFX-CAZl_sMf.js} +1 -1
  16. package/web-dist/assets/{chunk-DU6HZSFF-D0BZQTG5.js → chunk-DU6HZSFF-DqlwHUqE.js} +1 -1
  17. package/web-dist/assets/{chunk-F27PBJKO-BF6w8taS.js → chunk-F27PBJKO-UjuynGyM.js} +1 -1
  18. package/web-dist/assets/{chunk-GMAD6QVW-BgS1USoA.js → chunk-GMAD6QVW-BSHkruVH.js} +1 -1
  19. package/web-dist/assets/{chunk-GVQU2GXP-BwmGDTq-.js → chunk-GVQU2GXP-DaxKzMUz.js} +1 -1
  20. package/web-dist/assets/{chunk-IMKFNOWR-C2hHnw7E.js → chunk-IMKFNOWR-B7ZJ5BgQ.js} +1 -1
  21. package/web-dist/assets/{chunk-L3NEJ4N5-Bbg747MC.js → chunk-L3NEJ4N5-BN1lIkwL.js} +1 -1
  22. package/web-dist/assets/{chunk-OSK3NFVY-DAQ50rcr.js → chunk-OSK3NFVY-3maCyMz-.js} +1 -1
  23. package/web-dist/assets/{chunk-P2QGCYS3-BObSA-cM.js → chunk-P2QGCYS3-_1r7nLEO.js} +1 -1
  24. package/web-dist/assets/{chunk-POPQ4Y6H-BqmJCF6N.js → chunk-POPQ4Y6H-3WdNTnoR.js} +1 -1
  25. package/web-dist/assets/{chunk-PWAF6VOD-CuDeijqS.js → chunk-PWAF6VOD-CGTu0qqE.js} +1 -1
  26. package/web-dist/assets/{chunk-SHT3W25Y-DbJTvHUA.js → chunk-SHT3W25Y-DgbGWu3x.js} +1 -1
  27. package/web-dist/assets/{chunk-SVP7TREG-BC8SdQcL.js → chunk-SVP7TREG-NKnLeN2y.js} +1 -1
  28. package/web-dist/assets/{chunk-TICWLB2K-DXexujNp.js → chunk-TICWLB2K-Bn-Uz8zX.js} +1 -1
  29. package/web-dist/assets/{chunk-TLUHSLCS-0wx9EWEa.js → chunk-TLUHSLCS-Ted8oIft.js} +2 -2
  30. package/web-dist/assets/classDiagram-ZZMXUADV-Dg3f5DFX.js +1 -0
  31. package/web-dist/assets/classDiagram-v2-VYDZK3BY-Dg3f5DFX.js +1 -0
  32. package/web-dist/assets/{cynefin-OW5HDTMX-CGrLGBfS.js → cynefin-OW5HDTMX-CCRF_ybb.js} +1 -1
  33. package/web-dist/assets/{cynefinDiagram-5FMLGOSQ-EyQdBwCu.js → cynefinDiagram-5FMLGOSQ-D6rvhh-N.js} +1 -1
  34. package/web-dist/assets/{dagre-GXQ25YYZ-BVqzmn7R.js → dagre-GXQ25YYZ-DImmEyGA.js} +1 -1
  35. package/web-dist/assets/{diagram-S7CK7UJ4-DZ1hfAmp.js → diagram-S7CK7UJ4-ty-OQ116.js} +1 -1
  36. package/web-dist/assets/{diagram-UQ7AKVKN-DpAP9cxe.js → diagram-UQ7AKVKN-CerxGyX7.js} +1 -1
  37. package/web-dist/assets/{diagram-VSXAHHWV-CU3WPzI-.js → diagram-VSXAHHWV-BcLOBn-L.js} +1 -1
  38. package/web-dist/assets/{diagram-VX7I27RA-Zbw7QxDA.js → diagram-VX7I27RA-Bhgjh6hM.js} +1 -1
  39. package/web-dist/assets/{diagram-Z3DM3KII-B1wgPjix.js → diagram-Z3DM3KII-JMZ6ukL1.js} +1 -1
  40. package/web-dist/assets/{ebnfDiagram-PWID7BFC-Dv7JWtKb.js → ebnfDiagram-PWID7BFC-tvEhrlys.js} +1 -1
  41. package/web-dist/assets/{erDiagram-RLTQ6QDP-C5sXCiIS.js → erDiagram-RLTQ6QDP-CEt1rREE.js} +1 -1
  42. package/web-dist/assets/eventmodeling-NTZA5JFV-C75CP-gt.js +1 -0
  43. package/web-dist/assets/flowDiagram-HODETNUW-Bu0OgrwI.js +1 -0
  44. package/web-dist/assets/{ganttDiagram-EL5Y4UJY-DZd_7lQ3.js → ganttDiagram-EL5Y4UJY-DJTHJ8v3.js} +1 -1
  45. package/web-dist/assets/{gitGraph-4MIJSDKK-B26quh1K.js → gitGraph-4MIJSDKK-rQizWXPN.js} +1 -1
  46. package/web-dist/assets/{gitGraphDiagram-WWUBYQGX-BqPUII5h.js → gitGraphDiagram-WWUBYQGX-BGyeamfF.js} +1 -1
  47. package/web-dist/assets/{index-D-Pgx7jI.js → index-B3hJal2M.js} +65 -64
  48. package/web-dist/assets/index-Dss-vmKc.css +2 -0
  49. package/web-dist/assets/{info-A6RAGUB7-BtK5rNNi.js → info-A6RAGUB7-DAFbBLlf.js} +1 -1
  50. package/web-dist/assets/{infoDiagram-27XIBGKW-rMo0hIHa.js → infoDiagram-27XIBGKW-BKrix0pJ.js} +1 -1
  51. package/web-dist/assets/{ishikawaDiagram-5VMMS53U-DKHMSlJD.js → ishikawaDiagram-5VMMS53U-BxptiH0R.js} +1 -1
  52. package/web-dist/assets/{journeyDiagram-3NMN7TZE-CZLE8Bqt.js → journeyDiagram-3NMN7TZE-BIjMg4r-.js} +1 -1
  53. package/web-dist/assets/{kanban-definition-UXKFOSKX-dqVMgmbb.js → kanban-definition-UXKFOSKX-DVZmrqen.js} +1 -1
  54. package/web-dist/assets/{line-CrnyN3Lt.js → line-Ceb-IItU.js} +1 -1
  55. package/web-dist/assets/{mermaid-parser.core-Dr2z-e4o.js → mermaid-parser.core-KkCejDNC.js} +3 -3
  56. package/web-dist/assets/{mermaid.core-BXpwwhdN.js → mermaid.core-DyJvp_Ez.js} +3 -3
  57. package/web-dist/assets/{mindmap-definition-YA3MSWOX-D-J1xW_j.js → mindmap-definition-YA3MSWOX-PTo3gqjQ.js} +1 -1
  58. package/web-dist/assets/{packet-AYTQ26CC-xrZeixjb.js → packet-AYTQ26CC-Dr47iOXY.js} +1 -1
  59. package/web-dist/assets/{pegDiagram-XKGWAZYB-BR5WwIHq.js → pegDiagram-XKGWAZYB-9tqLnb8c.js} +1 -1
  60. package/web-dist/assets/{pie-WAS4IAKB-dc_3hE8I.js → pie-WAS4IAKB-DXIQOsCL.js} +1 -1
  61. package/web-dist/assets/{pieDiagram-E7YTZNPT-B84B9L5r.js → pieDiagram-E7YTZNPT-DPoRo3Zn.js} +1 -1
  62. package/web-dist/assets/{quadrantDiagram-AXDQQJYC-Bm859-6L.js → quadrantDiagram-AXDQQJYC-ByGBaqxi.js} +1 -1
  63. package/web-dist/assets/{radar-RG4KPBEZ-DOlDnfZi.js → radar-RG4KPBEZ-Bj_-qng4.js} +1 -1
  64. package/web-dist/assets/{railroad-74A4TZTK-CB_W8mmn.js → railroad-74A4TZTK-BuCmRpxC.js} +1 -1
  65. package/web-dist/assets/railroad-abnf-HS5TGJTU-B3jvgOfi.js +1 -0
  66. package/web-dist/assets/railroad-ebnf-LZEXJU2U-C1Uftq5X.js +1 -0
  67. package/web-dist/assets/railroad-peg-WCYAUIDC-BLUFwpTM.js +1 -0
  68. package/web-dist/assets/{railroadDiagram-O6MQD6OU-Ce4wBI0Y.js → railroadDiagram-O6MQD6OU-DQHQnzjm.js} +1 -1
  69. package/web-dist/assets/{requirementDiagram-BXWQKSXE-DMfJJlOr.js → requirementDiagram-BXWQKSXE-DJJKhVpd.js} +1 -1
  70. package/web-dist/assets/{sankeyDiagram-P5KCCOFB-CWAtaK1M.js → sankeyDiagram-P5KCCOFB-DIBozOMw.js} +1 -1
  71. package/web-dist/assets/{sequenceDiagram-WJ2MYXX4-CGGVQ0p0.js → sequenceDiagram-WJ2MYXX4-wnp4YLHJ.js} +1 -1
  72. package/web-dist/assets/{stateDiagram-D77RDMKH-Z23iP6vB.js → stateDiagram-D77RDMKH-B_wVLjRp.js} +1 -1
  73. package/web-dist/assets/stateDiagram-v2-MP3YSRHH-BHuFcv1t.js +1 -0
  74. package/web-dist/assets/{swimlanes-42K2YHIH-Z1I7L9cr.js → swimlanes-42K2YHIH-DmANfD2b.js} +1 -1
  75. package/web-dist/assets/swimlanesDiagram-VR7AAH4N-CpmUrS01.js +8 -0
  76. package/web-dist/assets/threadSurfaces-YwwW7VVL.js +141 -0
  77. package/web-dist/assets/{timeline-definition-24CTP7MA-B9l0F0nK.js → timeline-definition-24CTP7MA-CSi_JQwA.js} +1 -1
  78. package/web-dist/assets/{treeView-Q6P3EWNA-BDHbzVhP.js → treeView-Q6P3EWNA-CC7W1CDc.js} +1 -1
  79. package/web-dist/assets/{treemap-WGGIJYW6-DIk7J7mj.js → treemap-WGGIJYW6-fALAp3pw.js} +1 -1
  80. package/web-dist/assets/{vennDiagram-4TSXK5OY-CXFQUhMh.js → vennDiagram-4TSXK5OY-CHcotWhX.js} +1 -1
  81. package/web-dist/assets/{wardley-WFR3VGLG-2-8sLGSL.js → wardley-WFR3VGLG-BTc0JH7l.js} +1 -1
  82. package/web-dist/assets/{wardleyDiagram-VM6X3IG4-CQJUGn_G.js → wardleyDiagram-VM6X3IG4-DAC-lbDU.js} +1 -1
  83. package/web-dist/assets/{xychartDiagram-S5SC5T6Z-hgi3z_lr.js → xychartDiagram-S5SC5T6Z-CbFQ6lx1.js} +1 -1
  84. package/web-dist/index.html +2 -2
  85. package/web-dist/assets/architecture-7GRP2DOG-DTQZDTlF.js +0 -1
  86. package/web-dist/assets/channel-DEEIlZEQ.js +0 -1
  87. package/web-dist/assets/classDiagram-ZZMXUADV-CS5b4mpy.js +0 -1
  88. package/web-dist/assets/classDiagram-v2-VYDZK3BY-CS5b4mpy.js +0 -1
  89. package/web-dist/assets/eventmodeling-NTZA5JFV-Bt0Eptkc.js +0 -1
  90. package/web-dist/assets/flowDiagram-HODETNUW-BNRmy-JK.js +0 -1
  91. package/web-dist/assets/index-DjVez4iB.css +0 -2
  92. package/web-dist/assets/railroad-abnf-HS5TGJTU-DB7tPOt1.js +0 -1
  93. package/web-dist/assets/railroad-ebnf-LZEXJU2U-Bl0t7Ei-.js +0 -1
  94. package/web-dist/assets/railroad-peg-WCYAUIDC-RTQXALoT.js +0 -1
  95. package/web-dist/assets/stateDiagram-v2-MP3YSRHH-Cctq6goD.js +0 -1
  96. package/web-dist/assets/swimlanesDiagram-VR7AAH4N-CkF-YA0k.js +0 -8
  97. package/web-dist/assets/threadSurfaces-DpQhUD3Q.js +0 -140
package/dist/dev-child.js CHANGED
@@ -15287,6 +15287,87 @@ function issueWatchWakeMessage(input) {
15287
15287
  lines.push("", ISSUE_WATCH_ARMED_TRAILER);
15288
15288
  return lines.join("\n");
15289
15289
  }
15290
+ function runWakeLabel(input) {
15291
+ return `${input.workflow?.trim() || "The run"}${input.runNumber ? ` #${input.runNumber}` : ""}`;
15292
+ }
15293
+ function runJobVerb(conclusion) {
15294
+ const c = conclusion.toLowerCase();
15295
+ return c === "failure" ? "failed" : c === "cancelled" ? "was cancelled" : c === "timed_out" ? "timed out" : c === "startup_failure" ? "failed to start" : c.replace(/_/g, " ");
15296
+ }
15297
+ function runEndVerb(conclusion) {
15298
+ const c = conclusion.toLowerCase();
15299
+ return c === "success" ? "PASSED" : c === "failure" ? "FAILED" : c === "cancelled" ? "was CANCELLED" : c === "timed_out" ? "TIMED OUT" : c === "startup_failure" ? "FAILED TO START" : c === "action_required" ? "NEEDS APPROVAL TO RUN" : `ended: ${c.toUpperCase().replace(/_/g, " ")}`;
15300
+ }
15301
+ function runConclusionGreen(conclusion) {
15302
+ const c = conclusion?.toLowerCase();
15303
+ return c === "success" || c === "neutral" || c === "skipped";
15304
+ }
15305
+ function runJobLines(input, jobs, more) {
15306
+ const lines = jobs.flatMap((j10) => [
15307
+ `- \`${j10.name}\` ${runJobVerb(j10.conclusion)}${j10.step ? ` at step "${j10.step}"` : ""}${j10.url ? `: ${j10.url}` : ""}`,
15308
+ ` \`gh run view ${input.runId} -R ${input.owner}/${input.repo} --log-failed --job ${j10.id}\``
15309
+ ]);
15310
+ if (more > 0) lines.push(`- and ${more} more`);
15311
+ return lines;
15312
+ }
15313
+ function runWatchWakeMessage(input) {
15314
+ const label = runWakeLabel(input);
15315
+ const drop = `\`frizzctl watch-run drop ${input.watchId}\``;
15316
+ if (input.noRun) {
15317
+ return [
15318
+ `\u23F3 ${input.target} \u2014 no ${input.noRun.workflow} run has started on ${shortCommit(input.noRun.sha)} in ${input.noRun.minutes}m.`,
15319
+ "",
15320
+ `A path filter or an \`if:\` on the workflow may have skipped it. The watcher keeps looking until it expires; drop it with ${drop} if no run is coming.`
15321
+ ].join("\n");
15322
+ }
15323
+ if (input.end) {
15324
+ const red = input.end.jobs.length + (input.end.more ?? 0);
15325
+ if (runConclusionGreen(input.end.conclusion)) {
15326
+ return [`\u2705 ${input.target} \u2014 ${label} ${runEndVerb(input.end.conclusion)}.`, "", RUN_WATCH_SPENT_TRAILER].join("\n");
15327
+ }
15328
+ const lines2 = [
15329
+ `\u274C ${input.target} \u2014 ${label} ${runEndVerb(input.end.conclusion)}${red > 0 ? `: ${red} of ${input.end.total} job${input.end.total === 1 ? "" : "s"} red` : ""}.`
15330
+ ];
15331
+ if (input.end.jobs.length) lines2.push("", ...runJobLines(input, input.end.jobs, input.end.more ?? 0));
15332
+ lines2.push(
15333
+ "",
15334
+ `The watcher stays armed${input.end.expiresAt ? ` until ${input.end.expiresAt}` : ""}, so a re-run of the failed jobs is followed with no new registration. Drop it with ${drop} if nobody will re-run it.`
15335
+ );
15336
+ return lines2.join("\n");
15337
+ }
15338
+ const lines = [];
15339
+ const holds = input.holds ?? [];
15340
+ if (holds.length) {
15341
+ const names2 = holds.map((h) => h.environment);
15342
+ lines.push(`\u23F8\uFE0F ${input.target} \u2014 ${label} is WAITING on the ${names2.join(", ")} environment${names2.length === 1 ? "" : "s"} for a reviewer's approval.`, "");
15343
+ for (const h of holds) {
15344
+ const who = h.reviewers.length ? h.reviewers.join(", ") : "its reviewers";
15345
+ if (h.canApprove && h.environmentId !== void 0) {
15346
+ lines.push(
15347
+ `- \`${h.environment}\` (reviewers: ${who}). The GitHub account Frizz reads with can approve it:`,
15348
+ ` \`gh api -X POST repos/${input.owner}/${input.repo}/actions/runs/${input.runId}/pending_deployments -F 'environment_ids[]=${h.environmentId}' -f state=approved -f comment='Approved'\``
15349
+ );
15350
+ } else {
15351
+ lines.push(`- \`${h.environment}\` (reviewers: ${who}). The GitHub account Frizz reads with cannot approve it: ask a reviewer (${who}) to approve it.`);
15352
+ }
15353
+ }
15354
+ if (holds.some((h) => h.canApprove && h.environmentId !== void 0)) {
15355
+ lines.push("", "That command needs a GitHub credential that can write; Frizz's own sign-in only reads.");
15356
+ }
15357
+ }
15358
+ if (input.jobsFailed && input.jobsFailed.jobs.length) {
15359
+ if (lines.length) lines.push("");
15360
+ const n = input.jobsFailed.jobs.length + (input.jobsFailed.more ?? 0);
15361
+ const running = input.jobsFailed.running;
15362
+ lines.push(
15363
+ `\u274C ${input.target} \u2014 ${label}: ${n} job${n === 1 ? "" : "s"} red while the run continues (${running} still running).`,
15364
+ "",
15365
+ ...runJobLines(input, input.jobsFailed.jobs, input.jobsFailed.more ?? 0)
15366
+ );
15367
+ }
15368
+ lines.push("", RUN_WATCH_ARMED_TRAILER);
15369
+ return lines.join("\n");
15370
+ }
15290
15371
  function shellDoneMessage(shell) {
15291
15372
  const what = shell.taskId ? `\`${shell.taskId}\` \u2014 ${shell.label}` : shell.label;
15292
15373
  const verb = shell.status === "failed" ? "FAILED" : shell.status === "killed" ? "was STOPPED" : "finished";
@@ -15317,6 +15398,7 @@ function liveOpsLines(ops, needsInput = false) {
15317
15398
  section("Timers you have armed:", "timers", ops?.timers ?? []);
15318
15399
  section("Pull requests you registered:", "prs", ops?.prs ?? []);
15319
15400
  section("Issues you registered:", "issues", ops?.issues ?? []);
15401
+ section("Workflow runs you registered:", "runs", ops?.runs ?? []);
15320
15402
  section("Monitors you registered:", "monitors", ops?.commands ?? []);
15321
15403
  return lines;
15322
15404
  }
@@ -15543,15 +15625,15 @@ function parkFinishedWakeMessage(status, several) {
15543
15625
  ].join("\n");
15544
15626
  }
15545
15627
  function prWatchExpiredWakeMessage(ref, kind = "pull") {
15546
- const noun = kind === "issue" ? "issue" : "PR";
15547
- const command = kind === "issue" ? "frizzctl watch-issue add" : "frizzctl watch-pr add";
15628
+ const noun = kind === "issue" ? "issue" : kind === "run" ? "run" : "PR";
15629
+ const command = kind === "issue" ? "frizzctl watch-issue add" : kind === "run" ? "frizzctl watch-run add" : "frizzctl watch-pr add";
15548
15630
  return `\u23F0 Your watcher on ${ref} has expired and is no longer armed \u2014 nothing on that ${noun} will wake you now.
15549
15631
 
15550
15632
  If you still care about it, register it again with \`${command}\` and a fresh \`--for\`. If you do not, and it was the only thing you were waiting on, end in a proper terminal state instead of parking on it again.`;
15551
15633
  }
15552
15634
  function prWatchGoneWakeMessage(ref, kind, forMinutes) {
15553
- const noun = kind === "issue" ? "issue" : "PR";
15554
- const tool = kind === "issue" ? "frizzctl watch-issue add" : "frizzctl watch-pr add";
15635
+ const noun = kind === "issue" ? "issue" : kind === "run" ? "run" : "PR";
15636
+ const tool = kind === "issue" ? "frizzctl watch-issue add" : kind === "run" ? "frizzctl watch-run add" : "frizzctl watch-pr add";
15555
15637
  return `\u23F0 ${ref} can no longer be read \u2014 GitHub has answered that it does not exist for ${forMinutes}m. It was deleted, transferred to another repository, or this machine's \`gh\` login lost access to it.
15556
15638
 
15557
15639
  Your watcher on it is settled, so nothing on that ${noun} will wake you now. Find out where it went; if you still need to wait on it, register the new reference with \`${tool}\`.`;
@@ -16222,7 +16304,7 @@ function parseGithubWakeSteer(text2) {
16222
16304
  if (!items.length || items.length + omitted !== Number(head[2])) return null;
16223
16305
  return { ref: head[3], omitted, items };
16224
16306
  }
16225
- var import_yaml2, FrizzStatus, BlockMechanism, RuntimeState, Backend, BACKEND_FOLLOW_UPS, CodexModel, ClaudeModel, CODEX_MODELS_FALLBACK, AcpAgent, ACP_MODEL_PREFIX, OPENCODE_MODEL_PREFIX, ANTIGRAVITY_MODEL_PREFIX, AntigravityModel, AntigravityModels, AntigravityModelsInput, AntigravityQuotaInput, OpencodeModel, OpencodeModels, AcpAgentModel, AcpAgentModels, AcpAgentModelsInput, ThreadProfileOption, ThreadAgent, SubAgentView, BgShellView, CompletionHoldOp, CompletionHold, AskOption, AskQuestion, PendingAsk, AwaitingHint, RETIRED_AWAITING_KINDS, RETIRED_LINE_RE, RETIRED_AWAITING_REPLACEMENT, AWAITING_KEY_RE, AWAITING_YAML_KEYS, AWAITING_SEQUENCE_KEYS, AWAITING_HINT_MAX, AWAITING_HINT_VALUE_MAX, AWAITING_SCALAR_KINDS, AWAITING_STEPS_MAX, AWAITING_STEP_VALUE_MAX, AWAITING_STEP_BODY_MAX, AWAITING_QUESTIONS_MAX, AWAITING_TITLE_MAX, FENCE_DELIMITER_RE, STEP_CODE_FENCE_RE, indentOf2, AWAITING_STATUSES, AWAITING_ITEM_KINDS, AWAITING_DURATION_RE, DURATION_UNIT_MS, AWAITING_FOR_MAX_MS, SnoozeUntil, SNOOZE_PROMPT_MAX, SnoozePrompt, RECURRING_PROMPT_MAX, RECURRING_MIN_INTERVAL_SECONDS, RECURRING_MAX_INTERVAL_SECONDS, RecurringPromptText, RecurringIntervalSeconds, ThreadRecurringPrompt, INTERRUPT_MARKERS, ALLDONE_SENTINEL, OPT_OUT_NOTE, OVER_QUESTION_NOTE, TIMER_PROMPT_MAX, TIMER_MAX_DELAY_SECONDS, TIMER_MAX_ARMED, TimerPromptText, TIMER_DESCRIPTION_MAX, TimerDescriptionText, PR_WATCH_SPENT_TRAILER, PR_WATCH_ARMED_TRAILER, SHELL_DONE_TRAILER, ISSUE_WATCH_SPENT_TRAILER, ISSUE_WATCH_ARMED_TRAILER, LEGACY_PR_WATCH_ARMED_TRAILER, LEGACY_ISSUE_WATCH_ARMED_TRAILER, INTERRUPT_ENDED_LEAD, SIGNOFF_NUDGE_MARKER, SIGNOFF_NUDGE_BARE_LINE, SIGNOFF_NUDGE_STRAY_LINE, SIGNOFF_NUDGE_MESSAGE, SIGNOFF_NUDGE_MESSAGE_NEEDS_INPUT, PARK_CORRECTION_NAMES_LEAD, PARK_CORRECTION_RETIRED_LEAD, PARK_CORRECTION_QUESTION_LEAD, PARK_CORRECTION_NEEDS_INPUT_LEAD, QUESTION_FENCE_CORRECTION_LEAD, DONE_FENCE_CORRECTION_LEAD, SIGNOFF_CORRECTION_LEAD, ThreadWatchKind, GithubChecksState, GithubMergeState, GithubWatchStatus, GITHUB_READING_STALE_MS, GithubIssueStatus, CommandWatchRun, MonitorStatus, ThreadWatchView, PR_WATCH_FOR_MAX_MS, PR_WATCH_DEFAULT_FOR_MS, PR_WATCH_MAX_ARMED, PrWatchView, AddOwnPrWatchInput, AddOwnPrWatchResult, DropOwnPrWatchInput, DropOwnPrWatchResult, OwnWatchKind, AddOwnWatchInput, OwnWatchView, AddOwnWatchResult, DropOwnWatchInput, DropOwnWatchResult, OWN_WATCH_MAX_ARMED, COMMAND_WATCH_EVERY_MIN_MS, COMMAND_WATCH_EVERY_MAX_MS, COMMAND_WATCH_FOR_MAX_MS, COMMAND_WATCH_MAX_ARMED, COMMAND_WATCH_COMMAND_MAX, COMMAND_WATCH_OUTPUT_MAX_BYTES, COMMAND_WATCH_RUN_TIMEOUT_MS, MONITOR_DESCRIPTION_MAX, CommandWatchState, CommandWatchView, AddOwnCommandWatchInput, AddOwnCommandWatchResult, DropOwnCommandWatchInput, DropOwnCommandWatchResult, ListOwnCommandWatchesInput, OwnCommandWatchesResult, COMMAND_WATCH_FALLBACK, COMMAND_WATCH_PASSED_TRAILER, COMMAND_WATCH_EXPIRED_TRAILER, COMMAND_WATCH_CANCELLED_TRAILER, COMMAND_WATCH_TRAILERS_EXPIRED, MONITOR_BATCH_MS, MONITOR_LINE_MAX_CHARS, MONITOR_EVENT_MAX_LINES, MONITOR_FLOOD_MAX_EVENTS, MONITOR_FLOOD_WINDOW_MS, MONITOR_REGISTRATION_WINDOW_MS, MONITOR_SERVER_MAX_RUNNING, AddOwnMonitorInput, AddOwnMonitorResult, MONITOR_FALLBACK, MONITOR_EVENT_TRAILER, MONITOR_EXITED_TRAILER, MONITOR_EXPIRED_TRAILER, MONITOR_CANCELLED_TRAILER, MONITOR_FLOOD_REASON, MONITOR_STOPPED_BY_HUMAN_REASON, QUESTION_FENCE_RETIRED_AT, NEEDS_INPUT_REQUIRED_AT, AskQuestionKind, ASK_MAX_DEPTH, AskedOptionSchema, AskedQuestionSchema, AskInput, RegisteredQuestionView, QuestionFenceFaultView, ClosedQuestionView, SECRET_ANSWER_PREFIX, SECRET_TTL_MS, AskResult, UnaskInput, UnaskResult, QuestionAnswerSchema, AnswerQuestionsInput, AnswerQuestionsResult, DismissQuestionsInput, DismissQuestionsResult, SettledQuestionView, ClosedQuestionSpecView, ThreadSettledQuestionsResult, ThreadRegisteredDoneResult, BURIED_ANSWERS_HEADER, ANSWER_FOLLOW_UP_MARKER, ANSWER_CONTINUATION_INDENT, indentAnswerContinuation, ANSWER_PICK_PREFIX, DISMISSED_ANSWER, ANSWER_ROW_ID_PATTERN, ANSWER_ROW_ID, answerRowId, ANSWERS_NOTE_HEADER, STEPS_DONE, MarkOwnDoneInput, MarkOwnDoneResult, ListOwnPrWatchesInput, OwnPrWatchesResult, ThreadTimerView, ThreadFence, LimitWindow, LimitPause, ProviderError, ThreadLinkView, HumanTodo, SetHumanTodoInput, UpsertOwnLinkInput, UpsertOwnLinkResult, DropOwnLinkInput, DropOwnLinkResult, ThreadWorktreeView, GitRevision, AddOwnWorktreeInput, OwnWorktreesResult, AddOwnWorktreeResult, DropOwnWorktreeInput, DropOwnWorktreeResult, ListOwnWorktreesInput, LiveTool, ThreadView, SPINNING_UP_TITLE, UNTITLED_THREAD_TITLE, SPIN_UP_MS, CODEX_TITLE_SIGNAL_GRACE_MS, BoardErrorItem, BoardSnapshot, BoardState, QuotaWindow, ProviderQuota, QuotaSnapshot, ProviderAuth, AccountEmails, AuthSnapshot, AccountBackend, AccountLogoutInput, AccountLogoutResult, PermissionMode, LocalFileOpener, Settings, DispatchProviderPreferences, DispatchPreferences, DispatchProfileSnapshotShape, DispatchProfileSnapshot, SetDispatchPreferenceInput, DispatchInput, ADOPT_THREAD_MESSAGE_MAX_CHARS, AdoptThreadInput, AdoptThreadResult, AdoptSessionInput, FollowUpInput, SteerThreadInput, SteerThreadResult, SpawnThreadInput, SpawnThreadResult, SpawnChildInput, SpawnChildResult, DismissFailedFollowUpInput, DismissFailedFollowUpResult, UnqueueFollowUpInput, UnqueueFollowUpResult, DeliverQueuedNowInput, DeliverQueuedNowResult, CompactThreadInput, SetThreadSnoozeInput, SetThreadPinnedInput, ReorderPinnedThreadsInput, SetThreadConsolePinnedInput, ReorderConsolePinnedThreadsInput, SetThreadRecurringPromptInput, SetOwnThreadRecurringPromptInput, SetOwnThreadRecurringPromptResult, GetOwnThreadRecurringPromptInput, OwnThreadRecurringPromptResult, SetOwnThreadTimerInput, CancelOwnThreadTimerInput, ListOwnThreadTimersInput, OwnThreadTimersResult, ThreadActivityItem, ListOwnThreadActivityInput, OwnThreadActivityResult, ThreadBand, ThreadListing, ListThreadsInput, ListThreadsResult, FindThreadsInput, ThreadMatch, FindThreadsResult, SetOwnThreadTimerResult, CancelOwnThreadTimerResult, SetOwnThreadStopHookInput, SetOwnThreadHeartbeatInput, RenameThreadInput, AiRenameThreadInput, AiRenameThreadResult, SetOwnThreadTitleInput, SetOwnThreadTitleResult, SetThreadPermissionInput, SetThreadPermissionResult, ThreadProfileOptionsInput, ThreadProfileOptionsResult, ThreadSkillSource, ThreadSkill, ThreadSkillsInput, ThreadSkillsResult, McpTarget, McpServerState, McpServerReading, McpStatusInput, McpStatusResult, McpServerName, McpReloadChange, McpReloadInput, McpReloadResult, McpSignInInput, McpSignInState, McpSignInResult, McpSignInAttemptInput, McpSignInPollResult, McpSignInFinishInput, SetThreadProfileInput, SetThreadProfileResult, UpgradeThreadModelInput, UpgradeThreadModelResult, DISPATCH_TASK_BANNER, DISPATCH_TASK_BANNER_MARKER, GITHUB_DISPATCH_UI_BOUNDARY, WAKE_TIME_HEADER_TAIL, WAKE_TRAILERS, HUMAN_GAP_FLOOR_MS, HUMAN_GAP_NOTE_TAIL, WAKE_DELIVERY_TOKEN_TAIL, WAKE_DELIVERY_TOKEN_LINE, MERGED_WAKE_LEAD, MERGED_WAKE_HEADING, NOISE_PREFIXES, AGENT_MESSAGE_WRAPPER, CROSS_SESSION_PREAMBLE, CROSS_SESSION_WRAPPER, CROSS_SESSION_GUIDANCE, XML_ATTRIBUTE, THREAD_MESSAGE_OPEN, THREAD_MESSAGE_CLOSE, THREAD_MESSAGE_GUIDANCE, sealThreadMessageBody, unsealThreadMessageBody, RETRY_FOLLOW_UP, GithubWakeItem, GithubWakeSteer, WAKE_SCOPE, WAKE_REVIEW_LEAD, WAKE_BACKLOG_TAIL, WAKE_REF, WAKE_SINGLE, WAKE_MULTI_HEAD, WAKE_ITEM, WAKE_MORE, PR_WATCH_FINISHED, PR_WATCH_CI_PASSED, PR_WATCH_CI_GATED, PR_WATCH_STATE, PR_WATCH_CI_FAILED, GithubStatus, GithubAccount, GithubRefCard, GithubRefPreviewInput, GithubRefPreviewResult, GithubItem, GithubListInput, GithubListResult, GithubBatchInput, GithubBatchResult, BoardMeta, BoardDeltaEvent, ServerEvent, BoardDeltasInput, BoardDeltasResult, TranscriptEdit, TranscriptTodo, TranscriptToolCall, TranscriptPart, TranscriptMessage, TranscriptPageCursor, EditedFile, WorktreeChangedFile, WorktreeChanges, ScratchFiles, TranscriptPage, TranscriptEarlierInput, SocketTranscriptSlug, SocketFilePath, SocketTranscriptClientMsg, SocketFileClientMsg, SocketBoardClientMsg, SocketClientMsg, ProjectCard, ProjectRailCounts, PROJECT_ICON_EXTENSIONS, PROJECT_ICON_MAX_BASE64_CHARS, DirectoryPickResult, ThreadLocation, threadIdentityName;
16307
+ var import_yaml2, FrizzStatus, BlockMechanism, RuntimeState, Backend, BACKEND_FOLLOW_UPS, CodexModel, ClaudeModel, CODEX_MODELS_FALLBACK, AcpAgent, ACP_MODEL_PREFIX, OPENCODE_MODEL_PREFIX, ANTIGRAVITY_MODEL_PREFIX, AntigravityModel, AntigravityModels, AntigravityModelsInput, AntigravityQuotaInput, OpencodeModel, OpencodeModels, AcpAgentModel, AcpAgentModels, AcpAgentModelsInput, ThreadProfileOption, ThreadAgent, SubAgentView, BgShellView, CompletionHoldOp, CompletionHold, AskOption, AskQuestion, PendingAsk, AwaitingHint, RETIRED_AWAITING_KINDS, RETIRED_LINE_RE, RETIRED_AWAITING_REPLACEMENT, AWAITING_KEY_RE, AWAITING_YAML_KEYS, AWAITING_SEQUENCE_KEYS, AWAITING_HINT_MAX, AWAITING_HINT_VALUE_MAX, AWAITING_SCALAR_KINDS, AWAITING_STEPS_MAX, AWAITING_STEP_VALUE_MAX, AWAITING_STEP_BODY_MAX, AWAITING_QUESTIONS_MAX, AWAITING_TITLE_MAX, FENCE_DELIMITER_RE, STEP_CODE_FENCE_RE, indentOf2, AWAITING_STATUSES, AWAITING_ITEM_KINDS, AWAITING_DURATION_RE, DURATION_UNIT_MS, AWAITING_FOR_MAX_MS, SnoozeUntil, SNOOZE_PROMPT_MAX, SnoozePrompt, RECURRING_PROMPT_MAX, RECURRING_MIN_INTERVAL_SECONDS, RECURRING_MAX_INTERVAL_SECONDS, RecurringPromptText, RecurringIntervalSeconds, ThreadRecurringPrompt, INTERRUPT_MARKERS, ALLDONE_SENTINEL, OPT_OUT_NOTE, OVER_QUESTION_NOTE, TIMER_PROMPT_MAX, TIMER_MAX_DELAY_SECONDS, TIMER_MAX_ARMED, TimerPromptText, TIMER_DESCRIPTION_MAX, TimerDescriptionText, PR_WATCH_SPENT_TRAILER, PR_WATCH_ARMED_TRAILER, SHELL_DONE_TRAILER, ISSUE_WATCH_SPENT_TRAILER, ISSUE_WATCH_ARMED_TRAILER, RUN_WATCH_SPENT_TRAILER, RUN_WATCH_ARMED_TRAILER, LEGACY_PR_WATCH_ARMED_TRAILER, LEGACY_ISSUE_WATCH_ARMED_TRAILER, INTERRUPT_ENDED_LEAD, SIGNOFF_NUDGE_MARKER, SIGNOFF_NUDGE_BARE_LINE, SIGNOFF_NUDGE_STRAY_LINE, SIGNOFF_NUDGE_MESSAGE, SIGNOFF_NUDGE_MESSAGE_NEEDS_INPUT, PARK_CORRECTION_NAMES_LEAD, PARK_CORRECTION_RETIRED_LEAD, PARK_CORRECTION_QUESTION_LEAD, PARK_CORRECTION_NEEDS_INPUT_LEAD, QUESTION_FENCE_CORRECTION_LEAD, DONE_FENCE_CORRECTION_LEAD, SIGNOFF_CORRECTION_LEAD, ThreadWatchKind, GithubChecksState, GithubMergeState, GithubWatchStatus, GITHUB_READING_STALE_MS, GithubIssueStatus, GithubRunStatus, RUN_WATCH_FOR_MAX_MS, RUN_WATCH_NO_RUN_MS, CommandWatchRun, MonitorStatus, ThreadWatchView, PR_WATCH_FOR_MAX_MS, PR_WATCH_DEFAULT_FOR_MS, PR_WATCH_MAX_ARMED, PrWatchView, AddOwnPrWatchInput, AddOwnPrWatchResult, DropOwnPrWatchInput, DropOwnPrWatchResult, OwnWatchKind, AddOwnWatchInput, OwnWatchView, AddOwnWatchResult, DropOwnWatchInput, DropOwnWatchResult, OWN_WATCH_MAX_ARMED, COMMAND_WATCH_EVERY_MIN_MS, COMMAND_WATCH_EVERY_MAX_MS, COMMAND_WATCH_FOR_MAX_MS, COMMAND_WATCH_MAX_ARMED, COMMAND_WATCH_COMMAND_MAX, COMMAND_WATCH_OUTPUT_MAX_BYTES, COMMAND_WATCH_RUN_TIMEOUT_MS, MONITOR_DESCRIPTION_MAX, CommandWatchState, CommandWatchView, AddOwnCommandWatchInput, AddOwnCommandWatchResult, DropOwnCommandWatchInput, DropOwnCommandWatchResult, ListOwnCommandWatchesInput, OwnCommandWatchesResult, COMMAND_WATCH_FALLBACK, COMMAND_WATCH_PASSED_TRAILER, COMMAND_WATCH_EXPIRED_TRAILER, COMMAND_WATCH_CANCELLED_TRAILER, COMMAND_WATCH_TRAILERS_EXPIRED, MONITOR_BATCH_MS, MONITOR_LINE_MAX_CHARS, MONITOR_EVENT_MAX_LINES, MONITOR_FLOOD_MAX_EVENTS, MONITOR_FLOOD_WINDOW_MS, MONITOR_REGISTRATION_WINDOW_MS, MONITOR_SERVER_MAX_RUNNING, AddOwnMonitorInput, AddOwnMonitorResult, MONITOR_FALLBACK, MONITOR_EVENT_TRAILER, MONITOR_EXITED_TRAILER, MONITOR_EXPIRED_TRAILER, MONITOR_CANCELLED_TRAILER, MONITOR_FLOOD_REASON, MONITOR_STOPPED_BY_HUMAN_REASON, QUESTION_FENCE_RETIRED_AT, NEEDS_INPUT_REQUIRED_AT, AskQuestionKind, ASK_MAX_DEPTH, AskedOptionSchema, AskedQuestionSchema, AskInput, RegisteredQuestionView, QuestionFenceFaultView, ClosedQuestionView, SECRET_ANSWER_PREFIX, SECRET_TTL_MS, AskResult, UnaskInput, UnaskResult, QuestionAnswerSchema, AnswerQuestionsInput, AnswerQuestionsResult, DismissQuestionsInput, DismissQuestionsResult, SettledQuestionView, ClosedQuestionSpecView, ThreadSettledQuestionsResult, ThreadRegisteredDoneResult, BURIED_ANSWERS_HEADER, ANSWER_FOLLOW_UP_MARKER, ANSWER_CONTINUATION_INDENT, indentAnswerContinuation, ANSWER_PICK_PREFIX, DISMISSED_ANSWER, ANSWER_ROW_ID_PATTERN, ANSWER_ROW_ID, answerRowId, ANSWERS_NOTE_HEADER, STEPS_DONE, MarkOwnDoneInput, MarkOwnDoneResult, ListOwnPrWatchesInput, OwnPrWatchesResult, ThreadTimerView, ThreadFence, LimitWindow, LimitPause, ProviderError, ThreadLinkView, HumanTodo, SetHumanTodoInput, UpsertOwnLinkInput, UpsertOwnLinkResult, DropOwnLinkInput, DropOwnLinkResult, ThreadWorktreeView, GitRevision, AddOwnWorktreeInput, OwnWorktreesResult, AddOwnWorktreeResult, DropOwnWorktreeInput, DropOwnWorktreeResult, ListOwnWorktreesInput, LiveTool, ThreadView, SPINNING_UP_TITLE, UNTITLED_THREAD_TITLE, SPIN_UP_MS, CODEX_TITLE_SIGNAL_GRACE_MS, BoardErrorItem, BoardSnapshot, BoardState, QuotaWindow, ProviderQuota, QuotaSnapshot, ProviderAuth, AccountEmails, AuthSnapshot, AccountBackend, AccountLogoutInput, AccountLogoutResult, PermissionMode, LocalFileOpener, Settings, DispatchProviderPreferences, DispatchPreferences, DispatchProfileSnapshotShape, DispatchProfileSnapshot, SetDispatchPreferenceInput, DispatchInput, ADOPT_THREAD_MESSAGE_MAX_CHARS, AdoptThreadInput, AdoptThreadResult, AdoptSessionInput, FollowUpInput, SteerThreadInput, SteerThreadResult, SpawnThreadInput, SpawnThreadResult, SpawnChildInput, SpawnChildResult, DismissFailedFollowUpInput, DismissFailedFollowUpResult, UnqueueFollowUpInput, UnqueueFollowUpResult, DeliverQueuedNowInput, DeliverQueuedNowResult, CompactThreadInput, SetThreadSnoozeInput, SetThreadPinnedInput, ReorderPinnedThreadsInput, SetThreadConsolePinnedInput, ReorderConsolePinnedThreadsInput, SetThreadRecurringPromptInput, SetOwnThreadRecurringPromptInput, SetOwnThreadRecurringPromptResult, GetOwnThreadRecurringPromptInput, OwnThreadRecurringPromptResult, SetOwnThreadTimerInput, CancelOwnThreadTimerInput, ListOwnThreadTimersInput, OwnThreadTimersResult, ThreadActivityItem, ListOwnThreadActivityInput, OwnThreadActivityResult, ThreadBand, ThreadListing, ListThreadsInput, ListThreadsResult, FindThreadsInput, ThreadMatch, FindThreadsResult, SetOwnThreadTimerResult, CancelOwnThreadTimerResult, SetOwnThreadStopHookInput, SetOwnThreadHeartbeatInput, RenameThreadInput, AiRenameThreadInput, AiRenameThreadResult, SetOwnThreadTitleInput, SetOwnThreadTitleResult, SetThreadPermissionInput, SetThreadPermissionResult, ThreadProfileOptionsInput, ThreadProfileOptionsResult, ThreadSkillSource, ThreadSkill, ThreadSkillsInput, ThreadSkillsResult, McpTarget, McpServerState, McpServerReading, McpStatusInput, McpStatusResult, McpServerName, McpReloadChange, McpReloadInput, McpReloadResult, McpSignInInput, McpSignInState, McpSignInResult, McpSignInAttemptInput, McpSignInPollResult, McpSignInFinishInput, SetThreadProfileInput, SetThreadProfileResult, UpgradeThreadModelInput, UpgradeThreadModelResult, DISPATCH_TASK_BANNER, DISPATCH_TASK_BANNER_MARKER, GITHUB_DISPATCH_UI_BOUNDARY, WAKE_TIME_HEADER_TAIL, WAKE_TRAILERS, HUMAN_GAP_FLOOR_MS, HUMAN_GAP_NOTE_TAIL, WAKE_DELIVERY_TOKEN_TAIL, WAKE_DELIVERY_TOKEN_LINE, MERGED_WAKE_LEAD, MERGED_WAKE_HEADING, NOISE_PREFIXES, AGENT_MESSAGE_WRAPPER, CROSS_SESSION_PREAMBLE, CROSS_SESSION_WRAPPER, CROSS_SESSION_GUIDANCE, XML_ATTRIBUTE, THREAD_MESSAGE_OPEN, THREAD_MESSAGE_CLOSE, THREAD_MESSAGE_GUIDANCE, sealThreadMessageBody, unsealThreadMessageBody, RETRY_FOLLOW_UP, GithubWakeItem, GithubWakeSteer, WAKE_SCOPE, WAKE_REVIEW_LEAD, WAKE_BACKLOG_TAIL, WAKE_REF, WAKE_SINGLE, WAKE_MULTI_HEAD, WAKE_ITEM, WAKE_MORE, PR_WATCH_FINISHED, PR_WATCH_CI_PASSED, PR_WATCH_CI_GATED, PR_WATCH_STATE, PR_WATCH_CI_FAILED, RUN_REF, RUN_WATCH_LINE, GithubStatus, GithubAccount, GithubRefCard, GithubRefPreviewInput, GithubRefPreviewResult, GithubItem, GithubListInput, GithubListResult, GithubBatchInput, GithubBatchResult, BoardMeta, BoardDeltaEvent, ServerEvent, BoardDeltasInput, BoardDeltasResult, TranscriptEdit, TranscriptTodo, TranscriptToolCall, TranscriptPart, TranscriptMessage, TranscriptPageCursor, EditedFile, WorktreeChangedFile, WorktreeChanges, ScratchFiles, TranscriptPage, TranscriptEarlierInput, SocketTranscriptSlug, SocketFilePath, SocketTranscriptClientMsg, SocketFileClientMsg, SocketBoardClientMsg, SocketClientMsg, ProjectCard, ProjectRailCounts, PROJECT_ICON_EXTENSIONS, PROJECT_ICON_MAX_BASE64_CHARS, DirectoryPickResult, ThreadLocation, threadIdentityName;
16226
16308
  var init_src = __esm({
16227
16309
  "packages/shared/src/index.ts"() {
16228
16310
  "use strict";
@@ -16556,7 +16638,7 @@ var init_src = __esm({
16556
16638
  questions: external_exports.array(AskQuestion)
16557
16639
  });
16558
16640
  AwaitingHint = external_exports.object({
16559
- kind: external_exports.enum(["shell", "agent", "timer", "pr", "issue", "command", "thread", "for", "title", "status", "needs_input", "step", "question"]),
16641
+ kind: external_exports.enum(["shell", "agent", "timer", "pr", "issue", "run", "command", "thread", "for", "title", "status", "needs_input", "step", "question"]),
16560
16642
  value: external_exports.string(),
16561
16643
  /** A step's Markdown body, drawn under its title (splitAwaitingFrontmatter). No other kind has one. */
16562
16644
  body: external_exports.string().optional()
@@ -16580,7 +16662,7 @@ var init_src = __esm({
16580
16662
  "reason": "put it below the `---` as ordinary Markdown \u2014 the frontmatter is YAML now and takes no prose"
16581
16663
  };
16582
16664
  AWAITING_KEY_RE = /^([a-z][a-z_-]*):\s*(\S.*)?$/i;
16583
- AWAITING_YAML_KEYS = /* @__PURE__ */ new Set(["shells", "agents", "timers", "prs", "issues", "monitors", "commands", "threads", "questions", "for", "title", "steps", "status", "needs_input", "needs-input"]);
16665
+ AWAITING_YAML_KEYS = /* @__PURE__ */ new Set(["shells", "agents", "timers", "prs", "issues", "runs", "monitors", "commands", "threads", "questions", "for", "title", "steps", "status", "needs_input", "needs-input"]);
16584
16666
  AWAITING_SEQUENCE_KEYS = {
16585
16667
  shells: "shell",
16586
16668
  agents: "agent",
@@ -16590,6 +16672,11 @@ var init_src = __esm({
16590
16672
  // rather than a second spelling under `prs:`, because the two are different registrations: an issue
16591
16673
  // has no CI and no merge, and the correction for an unregistered one names a different command.
16592
16674
  issues: "issue",
16675
+ // `runs:` (2026-11-27) names a GitHub Actions WORKFLOW RUN registered with `frizzctl watch-run`:
16676
+ // `owner/repo/actions/runs/<id>`, a run URL, or `owner/repo@<sha>` for a run followed by commit. Its
16677
+ // own key for the reason `issues:` has one: a run has jobs and environments, no reviews, and the
16678
+ // correction for an unregistered one names a different command.
16679
+ runs: "run",
16593
16680
  // `monitors:` names a monitor registered with `frizzctl monitor`, by its `cmw_…` id. Checked like a
16594
16681
  // timer: the row must be armed on THIS thread. It was `commands:` from 2026-10-11, when the command was
16595
16682
  // `frizzctl monitor`, until the name became "monitor" on 2026-11-06; a resumed worker keeps the
@@ -16612,7 +16699,7 @@ var init_src = __esm({
16612
16699
  STEP_CODE_FENCE_RE = /^\s*(`{3,}|~{3,})(.*)$/;
16613
16700
  indentOf2 = (line) => line.length - line.trimStart().length;
16614
16701
  AWAITING_STATUSES = ["needs_input", "working", "watching"];
16615
- AWAITING_ITEM_KINDS = ["shell", "agent", "timer", "pr", "issue", "command", "thread"];
16702
+ AWAITING_ITEM_KINDS = ["shell", "agent", "timer", "pr", "issue", "run", "command", "thread"];
16616
16703
  AWAITING_DURATION_RE = /^(\d{1,5})(s|m|h|d)$/;
16617
16704
  DURATION_UNIT_MS = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
16618
16705
  AWAITING_FOR_MAX_MS = 24 * 60 * 60 * 1e3;
@@ -16662,6 +16749,8 @@ var init_src = __esm({
16662
16749
  SHELL_DONE_TRAILER = "(Frizz sends this because it finished after you came to rest, where your runtime's own completion notification does not reach you. Read its output if you still need it.)";
16663
16750
  ISSUE_WATCH_SPENT_TRAILER = "(This watcher is spent \u2014 there is nothing further to report on a closed issue.)";
16664
16751
  ISSUE_WATCH_ARMED_TRAILER = "(Registered issue watcher \u2014 STILL ARMED. It reports again on the next comment, label or assignee change, and once more when the issue closes. Drop it with `frizzctl watch-issue drop <id>` when it stops mattering.)";
16752
+ RUN_WATCH_SPENT_TRAILER = "(This watcher is spent \u2014 the run passed, and there is nothing further to report.)";
16753
+ RUN_WATCH_ARMED_TRAILER = "(Registered run watcher \u2014 STILL ARMED. It reports again when a job fails, when the run waits on an environment's approval, and when the run ends. Drop it with `frizzctl watch-run drop <id>` when it stops mattering.)";
16665
16754
  LEGACY_PR_WATCH_ARMED_TRAILER = "(Registered PR watcher \u2014 STILL ARMED. It reports again on the next CI change, review, comment, label, conflict or review request. Drop it with `mcp__frizz__watch_pr` when it stops mattering.)";
16666
16755
  LEGACY_ISSUE_WATCH_ARMED_TRAILER = "(Registered issue watcher \u2014 STILL ARMED. It reports again on the next comment, label or assignee change, and once more when the issue closes. Drop it with `mcp__frizz__watch_issue` when it stops mattering.)";
16667
16756
  INTERRUPT_ENDED_LEAD = "\u26A0\uFE0F The human's last follow-up was sent with INTERRUPT, which aborted your turn \u2014 and the runtime ends every background sub-agent with the turn. These did not return:";
@@ -16753,6 +16842,33 @@ var init_src = __esm({
16753
16842
  /** When frizz last heard from GitHub, for the same reason `GithubWatchStatus.polledAt` carries it. */
16754
16843
  polledAt: external_exports.string()
16755
16844
  }).strict();
16845
+ GithubRunStatus = external_exports.object({
16846
+ status: external_exports.enum(["queued", "in_progress", "waiting", "completed"]),
16847
+ /** The run's own verdict, lowercased (`success`, `failure`, `cancelled`, `timed_out`, …). Present once
16848
+ * the run has completed. The verdict is GitHub's, never one added up from the job list below. */
16849
+ conclusion: external_exports.string().optional(),
16850
+ /** The workflow's name (`Release on npm`), its run number and which attempt this is. */
16851
+ workflow: external_exports.string().optional(),
16852
+ runNumber: external_exports.number().int().nonnegative().optional(),
16853
+ attempt: external_exports.number().int().nonnegative().optional(),
16854
+ /** The run's page on GitHub. */
16855
+ url: external_exports.string().optional(),
16856
+ /** The commit the run is on. */
16857
+ head: external_exports.string().optional(),
16858
+ /** Jobs in this attempt (GitHub's `totalCount`), and how many of those read have finished. The poll
16859
+ * reads the first 100, so on a bigger run `done` counts within those. */
16860
+ jobs: external_exports.number().int().nonnegative(),
16861
+ done: external_exports.number().int().nonnegative(),
16862
+ /** The red job NAMES (failed, cancelled, timed out), capped. */
16863
+ failing: external_exports.array(external_exports.string()).max(8).default([]),
16864
+ /** Environments the run is held on for a reviewer's approval, by name. A pure wait timer is not here: it
16865
+ * ends by itself. */
16866
+ held: external_exports.array(external_exports.string()).max(8).default([]),
16867
+ /** When frizz last heard from GitHub. */
16868
+ polledAt: external_exports.string()
16869
+ }).strict();
16870
+ RUN_WATCH_FOR_MAX_MS = 30 * 24 * 60 * 60 * 1e3;
16871
+ RUN_WATCH_NO_RUN_MS = 15 * 60 * 1e3;
16756
16872
  CommandWatchRun = external_exports.object({
16757
16873
  at: external_exports.string(),
16758
16874
  outcome: external_exports.enum(["exit", "timeout", "signal", "error"]),
@@ -16780,10 +16896,15 @@ var init_src = __esm({
16780
16896
  * differ in what the poll can read off them, which is what this field lets a card branch on.
16781
16897
  * Optional, and absent means a pull request — a row from a server that predates issues reads as the
16782
16898
  * PR it always was, and the non-github kinds never carry it. */
16783
- subject: external_exports.enum(["pull", "issue"]).optional(),
16899
+ subject: external_exports.enum(["pull", "issue", "run"]).optional(),
16784
16900
  /** `github` rows watching an ISSUE only, and absent until the first successful poll — the twin of the
16785
16901
  * `github` half above, for the rows whose subject has no checks to report. */
16786
16902
  issue: GithubIssueStatus.optional(),
16903
+ /** `github` rows watching a WORKFLOW RUN only (`subject: "run"`, 2026-11-27), absent until polled. The
16904
+ * row's `target` is `owner/repo/actions/runs/N`, or `owner/repo@<sha>` while a commit-form watch has
16905
+ * not found its run yet; `workflow` is then the workflow it waits for. */
16906
+ run: GithubRunStatus.optional(),
16907
+ workflow: external_exports.string().optional(),
16787
16908
  /** `timer` rows only: the armed timer's own registration, which is everything the row renders — the
16788
16909
  * worker's prompt is the row's NAME (a `tmr_…` id names nothing to a human) and the fire instant is
16789
16910
  * its status. Unlike `github` there is no polled half to be absent: a timer that exists is fully
@@ -16822,13 +16943,19 @@ var init_src = __esm({
16822
16943
  target: external_exports.string(),
16823
16944
  /** A pull request or an issue. Both live in one registry (`pr_watch`) and answer to one drop verb;
16824
16945
  * `watch_pr` and `watch_issue` each list only their own. Defaulted for a row an older server sends. */
16825
- kind: external_exports.enum(["pull", "issue"]).default("pull"),
16946
+ kind: external_exports.enum(["pull", "issue", "run"]).default("pull"),
16826
16947
  state: external_exports.enum(["armed", "dropped", "settled"]),
16827
16948
  createdAt: external_exports.string(),
16949
+ /** When this watcher runs out. Absent from a server that predates it. */
16950
+ expiresAt: external_exports.string().optional(),
16828
16951
  /** The PR's checks/mergeability as the poller last saw it. Absent until the first successful poll. */
16829
16952
  github: GithubWatchStatus.optional(),
16830
16953
  /** An ISSUE's state as the poller last saw it — `kind: "issue"` rows only, absent until polled. */
16831
- issue: GithubIssueStatus.optional()
16954
+ issue: GithubIssueStatus.optional(),
16955
+ /** A WORKFLOW RUN's state as the poller last saw it — `kind: "run"` rows only, absent until polled. */
16956
+ run: GithubRunStatus.optional(),
16957
+ /** `kind: "run"` rows registered by commit: the workflow whose run on that commit the watcher follows. */
16958
+ workflow: external_exports.string().optional()
16832
16959
  }).strict();
16833
16960
  AddOwnPrWatchInput = external_exports.object({
16834
16961
  slug: ThreadSlug,
@@ -16859,7 +16986,10 @@ var init_src = __esm({
16859
16986
  * view`), a different GraphQL fragment and a report with no CI in it. ABSENT MEANS A PULL REQUEST,
16860
16987
  * for the same reason `for` is optional on the wire: every `watch_pr` binary dispatched before this
16861
16988
  * field existed sends nothing here and must go on meaning what it always did. */
16862
- kind: external_exports.enum(["pull", "issue"]).optional()
16989
+ kind: external_exports.enum(["pull", "issue", "run"]).optional(),
16990
+ /** `kind: "run"` with an `owner/repo@<sha>` target only (`frizzctl watch-run add … --workflow test.yml`):
16991
+ * the workflow, by file name or name, whose run on that commit to follow. Required for that form. */
16992
+ workflow: external_exports.string().trim().min(1).max(200).optional()
16863
16993
  }).strict();
16864
16994
  AddOwnPrWatchResult = external_exports.object({
16865
16995
  id: external_exports.string(),
@@ -18196,7 +18326,7 @@ ${ANSWER_CONTINUATION_INDENT}`);
18196
18326
  timers: external_exports.array(ThreadTimerView)
18197
18327
  }).strict();
18198
18328
  ThreadActivityItem = external_exports.object({
18199
- kind: external_exports.enum(["shell", "agent", "timer", "pr", "issue", "command", "thread"]),
18329
+ kind: external_exports.enum(["shell", "agent", "timer", "pr", "issue", "run", "command", "thread"]),
18200
18330
  /** The string a `<kind>:` fence line must carry. For a shell that is the runtime task id the worker
18201
18331
  * was shown; for a PR, `owner/repo#N`; for a timer, its `tmr_…` row id. */
18202
18332
  id: external_exports.string(),
@@ -18458,7 +18588,7 @@ ${DISPATCH_TASK_BANNER}
18458
18588
  `;
18459
18589
  GITHUB_DISPATCH_UI_BOUNDARY = "<!-- frizz:github-dispatch-ui-boundary:v1 -->";
18460
18590
  WAKE_TIME_HEADER_TAIL = /\n+⏱ \d{4}-\d{2}-\d{2} \d{2}:\d{2}(?: — you last spoke [^\n]*? ago)?\.[ \t]*$/;
18461
- WAKE_TRAILERS = [PR_WATCH_ARMED_TRAILER, PR_WATCH_SPENT_TRAILER, ISSUE_WATCH_ARMED_TRAILER, ISSUE_WATCH_SPENT_TRAILER, SHELL_DONE_TRAILER, LEGACY_PR_WATCH_ARMED_TRAILER, LEGACY_ISSUE_WATCH_ARMED_TRAILER];
18591
+ WAKE_TRAILERS = [PR_WATCH_ARMED_TRAILER, PR_WATCH_SPENT_TRAILER, ISSUE_WATCH_ARMED_TRAILER, ISSUE_WATCH_SPENT_TRAILER, RUN_WATCH_ARMED_TRAILER, RUN_WATCH_SPENT_TRAILER, SHELL_DONE_TRAILER, LEGACY_PR_WATCH_ARMED_TRAILER, LEGACY_ISSUE_WATCH_ARMED_TRAILER];
18462
18592
  HUMAN_GAP_FLOOR_MS = 20 * 6e4;
18463
18593
  HUMAN_GAP_NOTE_TAIL = /\n+⏱ Frizz: the message above arrived [^\n]* after your last one\. It is now \d{4}-\d{2}-\d{2} \d{2}:\d{2}\.[ \t]*$/;
18464
18594
  WAKE_DELIVERY_TOKEN_TAIL = /\n*<!-- frizz-wake:[A-Za-z0-9_-]+ -->\s*$/;
@@ -18513,6 +18643,8 @@ ${DISPATCH_TASK_BANNER}
18513
18643
  PR_WATCH_CI_GATED = new RegExp(String.raw`^⏸️ CI on (${WAKE_REF}) is WAITING FOR APPROVAL — (\d+) workflows? held(?:: (.+?))?\.$`);
18514
18644
  PR_WATCH_STATE = new RegExp(String.raw`^🔔 (${WAKE_REF}): (.+)\.$`);
18515
18645
  PR_WATCH_CI_FAILED = new RegExp(String.raw`^❌ CI FAILED on (${WAKE_REF})(?: at ([0-9a-f]+))?(?:: (.+?))?\.$`);
18646
+ RUN_REF = String.raw`[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*(?:\/actions\/runs\/\d+|@[0-9a-f]{7,40})`;
18647
+ RUN_WATCH_LINE = new RegExp(String.raw`^(❌|⏸️|✅|⏳) (${RUN_REF}) — (.+?)\.$`);
18516
18648
  GithubStatus = external_exports.object({
18517
18649
  installed: external_exports.boolean(),
18518
18650
  inRepo: external_exports.boolean(),
@@ -25507,7 +25639,12 @@ function ensureStorageSchema(db2) {
25507
25639
  ["command_watch", "pid_started_at INTEGER"],
25508
25640
  // `thread_timer.description` (2026-11-12): a timer's name for the human, which its prompt (written
25509
25641
  // to the worker's future self) is not.
25510
- ["thread_timer", "description TEXT"]
25642
+ ["thread_timer", "description TEXT"],
25643
+ // `pr_watch.run_*` (2026-11-27): a workflow run watcher is a row in the PR watcher's table, and
25644
+ // every live file predates the columns. See PrWatchRow.
25645
+ ["pr_watch", "run_sha TEXT"],
25646
+ ["pr_watch", "run_workflow TEXT"],
25647
+ ["pr_watch", "run_node_id TEXT"]
25511
25648
  ]) {
25512
25649
  try {
25513
25650
  db2.exec(`ALTER TABLE ${table} ADD COLUMN ${column}`);
@@ -25970,9 +26107,12 @@ function createStorage(source, projectId) {
25970
26107
  WHERE project_id = @project_id AND slug = ? AND park_bumps > 0
25971
26108
  `);
25972
26109
  const armPrWatchStmt = scope.prepare(`
25973
- INSERT INTO pr_watch (project_id, id, thread_slug, kind, owner, repo, number, state, created_at, settled_at, cursor, expires_at)
25974
- VALUES (@project_id, @id, @slug, @kind, @owner, @repo, @number, 'armed', @createdAtMs, NULL, NULL, @expiresAtMs)
26110
+ INSERT INTO pr_watch (project_id, id, thread_slug, kind, owner, repo, number, state, created_at, settled_at, cursor, expires_at, run_sha, run_workflow, run_node_id)
26111
+ VALUES (@project_id, @id, @slug, @kind, @owner, @repo, @number, 'armed', @createdAtMs, NULL, @cursor, @expiresAtMs, @runSha, @runWorkflow, @runNodeId)
25975
26112
  `);
26113
+ const resolveRunWatchStmt = scope.prepare(
26114
+ "UPDATE pr_watch SET number = ?, run_node_id = ? WHERE project_id = @project_id AND id = ? AND state = 'armed' AND kind = 'run'"
26115
+ );
25976
26116
  const expiredPrWatchesStmt = scope.prepare(
25977
26117
  "SELECT * FROM pr_watch WHERE project_id = @project_id AND state = 'armed' AND expires_at IS NOT NULL AND expires_at <= ? ORDER BY expires_at, id"
25978
26118
  );
@@ -26714,7 +26854,21 @@ function createStorage(source, projectId) {
26714
26854
  resetSignoffNudges: (slug) => void resetNudgesStmt.run(slug),
26715
26855
  countParkBump: (slug, anchor) => void countParkBumpStmt.run(anchor, slug, anchor),
26716
26856
  resetParkBumps: (slug) => void resetParkBumpsStmt.run(slug),
26717
- armPrWatch: (watch2) => void armPrWatchStmt.run({ ...watch2, kind: watch2.kind ?? "pull" }),
26857
+ armPrWatch: (watch2) => void armPrWatchStmt.run({
26858
+ id: watch2.id,
26859
+ slug: watch2.slug,
26860
+ owner: watch2.owner,
26861
+ repo: watch2.repo,
26862
+ number: watch2.number,
26863
+ createdAtMs: watch2.createdAtMs,
26864
+ expiresAtMs: watch2.expiresAtMs,
26865
+ kind: watch2.kind ?? "pull",
26866
+ cursor: watch2.cursor ?? null,
26867
+ runSha: watch2.runSha ?? null,
26868
+ runWorkflow: watch2.runWorkflow ?? null,
26869
+ runNodeId: watch2.runNodeId ?? null
26870
+ }),
26871
+ resolveRunWatch: (id2, runId, nodeId) => resolveRunWatchStmt.run(runId, nodeId, id2).changes === 1,
26718
26872
  listPrWatches: (slug, opts) => (opts?.armedOnly ? armedPrWatchesBySlugStmt : prWatchesBySlugStmt).all(slug),
26719
26873
  // Grouped off `armedPrWatchesStmt` — the scheduler's own whole-project read, which already carries
26720
26874
  // the identical `state = 'armed'` predicate and `created_at, id` order the per-slug statement uses.
@@ -27257,6 +27411,11 @@ var init_storage = __esm({
27257
27411
  -- 'pull' or 'issue' (2026-09-14). Defaulted so every row written before issues existed reads as
27258
27412
  -- the pull request it was; added to a live file by the ALTER in ensureStorageSchema.
27259
27413
  kind TEXT NOT NULL DEFAULT 'pull',
27414
+ -- A 'run' row (2026-11-27, frizzctl watch-run): the commit and workflow a commit-form watch
27415
+ -- follows, and the run's GraphQL node id once known. Null on a PR or issue row.
27416
+ run_sha TEXT,
27417
+ run_workflow TEXT,
27418
+ run_node_id TEXT,
27260
27419
  -- When this watcher stops polling by itself. REQUIRED at registration (2026-08-15): a PR nobody
27261
27420
  -- ever touches would otherwise be polled forever, and the thread parked on it would wait forever
27262
27421
  -- with it. Nullable in the column only so an imported older row reads; the tool refuses to arm
@@ -48523,6 +48682,40 @@ var init_frizz = __esm({
48523
48682
  }
48524
48683
  });
48525
48684
 
48685
+ // packages/server/src/github-run-ref.ts
48686
+ function isRunIdRef(ref) {
48687
+ return "runId" in ref;
48688
+ }
48689
+ function parseRunRef(value) {
48690
+ const v2 = value.trim();
48691
+ const byId = RUN_ID_RE.exec(v2);
48692
+ if (byId) {
48693
+ const runId = Number(byId[3]);
48694
+ if (!Number.isSafeInteger(runId) || runId <= 0) return void 0;
48695
+ return { owner: byId[1], repo: byId[2].replace(/\.git$/, ""), runId };
48696
+ }
48697
+ const byCommit = RUN_COMMIT_RE.exec(v2);
48698
+ if (byCommit) return { owner: byCommit[1], repo: byCommit[2].replace(/\.git$/, ""), sha: byCommit[3].toLowerCase() };
48699
+ return void 0;
48700
+ }
48701
+ function runTarget(owner, repo, runId) {
48702
+ return `${owner}/${repo}/actions/runs/${runId}`;
48703
+ }
48704
+ function runCommitTarget(owner, repo, sha) {
48705
+ return `${owner}/${repo}@${sha.slice(0, 7)}`;
48706
+ }
48707
+ function workflowFileName(workflow) {
48708
+ return workflow.trim().replace(/^.*\//, "");
48709
+ }
48710
+ var RUN_ID_RE, RUN_COMMIT_RE;
48711
+ var init_github_run_ref = __esm({
48712
+ "packages/server/src/github-run-ref.ts"() {
48713
+ "use strict";
48714
+ RUN_ID_RE = /^(?:https?:\/\/github\.com\/)?([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*)\/actions\/runs\/(\d+)(?:\/(?:attempts\/\d+|job\/\d+))?\/?(?:[?#].*)?$/;
48715
+ RUN_COMMIT_RE = /^([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*)@([0-9a-fA-F]{7,40})$/;
48716
+ }
48717
+ });
48718
+
48526
48719
  // packages/server/src/awaiting.ts
48527
48720
  function parsePrRef(value) {
48528
48721
  const m = value.trim().match(PR_REF_RE);
@@ -48551,7 +48744,7 @@ function readAwaitingPark(hints) {
48551
48744
  }
48552
48745
  return { items, forMs, steps: awaitingSteps(hints), questions: awaitingQuestions(hints) };
48553
48746
  }
48554
- function liveActivityOf(tele, registeredPrWatches, armedTimerIds, registeredIssueWatches = /* @__PURE__ */ new Set(), armedCommandWatches = /* @__PURE__ */ new Set(), idlePrs, liveChildThreads2 = /* @__PURE__ */ new Set()) {
48747
+ function liveActivityOf(tele, registeredPrWatches, armedTimerIds, registeredIssueWatches = /* @__PURE__ */ new Set(), armedCommandWatches = /* @__PURE__ */ new Set(), idlePrs, liveChildThreads2 = /* @__PURE__ */ new Set(), registeredRunWatches = /* @__PURE__ */ new Set()) {
48555
48748
  const shells = /* @__PURE__ */ new Set();
48556
48749
  for (const sh2 of tele?.bgShells ?? []) {
48557
48750
  if (sh2.state !== "running") continue;
@@ -48562,10 +48755,20 @@ function liveActivityOf(tele, registeredPrWatches, armedTimerIds, registeredIssu
48562
48755
  if (a.state !== "running") continue;
48563
48756
  for (const h of [a.taskId, a.id, a.label]) if (h) agents.add(h);
48564
48757
  }
48565
- return { shells, agents, timers: armedTimerIds, prs: registeredPrWatches, issues: registeredIssueWatches, commands: armedCommandWatches, threads: liveChildThreads2, ...idlePrs ? { idlePrs } : {} };
48758
+ return { shells, agents, timers: armedTimerIds, prs: registeredPrWatches, issues: registeredIssueWatches, commands: armedCommandWatches, threads: liveChildThreads2, runs: registeredRunWatches, ...idlePrs ? { idlePrs } : {} };
48566
48759
  }
48567
48760
  function unaccountedItems(items, live2) {
48568
- return items.filter((i) => !live2[LIVE_SET[i.kind]]?.has(liveKey(i)));
48761
+ return items.filter((i) => !itemIsLive(i, live2));
48762
+ }
48763
+ function runEntryLive(value, keys) {
48764
+ return itemIsLive({ kind: "run", value: value.trim() }, { shells: /* @__PURE__ */ new Set(), agents: /* @__PURE__ */ new Set(), timers: /* @__PURE__ */ new Set(), prs: /* @__PURE__ */ new Set(), runs: keys });
48765
+ }
48766
+ function itemIsLive(i, live2) {
48767
+ const set = live2[LIVE_SET[i.kind]];
48768
+ const key = liveKey(i);
48769
+ if (set?.has(key)) return true;
48770
+ if (i.kind === "run" && key.includes("@")) return [...set ?? []].some((k) => k.includes("@") && k.startsWith(key));
48771
+ return false;
48569
48772
  }
48570
48773
  function liveKey(i) {
48571
48774
  if (i.kind === "pr") {
@@ -48576,8 +48779,30 @@ function liveKey(i) {
48576
48779
  const ref = parseIssueRef(i.value);
48577
48780
  return ref ? githubStatusKey(ref) : i.value;
48578
48781
  }
48782
+ if (i.kind === "run") return runFenceKey(i.value) ?? i.value;
48579
48783
  return i.value;
48580
48784
  }
48785
+ function runFenceKey(value) {
48786
+ const ref = parseRunRef(value);
48787
+ if (!ref) return void 0;
48788
+ return (isRunIdRef(ref) ? `${ref.owner}/${ref.repo}/actions/runs/${ref.runId}` : `${ref.owner}/${ref.repo}@${ref.sha}`).toLowerCase();
48789
+ }
48790
+ function runWatchLiveKeys(rows) {
48791
+ const keys = /* @__PURE__ */ new Set();
48792
+ for (const w of rows) for (const k of runWatchKeys(w)) keys.add(k);
48793
+ return keys;
48794
+ }
48795
+ function runWatchKeys(w) {
48796
+ if (w.kind !== "run") return [];
48797
+ const base = `${w.owner}/${w.repo}`.toLowerCase();
48798
+ return [
48799
+ ...w.number > 0 ? [`${base}/actions/runs/${w.number}`] : [],
48800
+ ...w.run_sha ? [`${base}@${w.run_sha.toLowerCase()}`] : []
48801
+ ];
48802
+ }
48803
+ function runBookKey(owner, repo, runId) {
48804
+ return `${owner}/${repo}/actions/runs/${runId}`.toLowerCase();
48805
+ }
48581
48806
  function parkIsHonoured(park, live2) {
48582
48807
  const onHuman = parkOnHuman(park);
48583
48808
  if (park.items.length === 0 && !onHuman) return false;
@@ -48638,10 +48863,47 @@ function readGithubIssueStatusBook(raw2) {
48638
48863
  }
48639
48864
  return out2;
48640
48865
  }
48641
- var PR_REF_RE, ISSUE_REF_RE, LIVE_SET, GITHUB_STATUS_SETTING, GITHUB_ISSUE_STATUS_SETTING;
48866
+ function readGithubRunStatusBook(raw2) {
48867
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) return {};
48868
+ const out2 = {};
48869
+ for (const [key, value] of Object.entries(raw2)) {
48870
+ const parsed = GithubRunStatus.safeParse(value);
48871
+ if (parsed.success) out2[key] = parsed.data;
48872
+ }
48873
+ return out2;
48874
+ }
48875
+ function publishGithubRunStatus(storage, key, reading) {
48876
+ const raw2 = storage.getSetting(GITHUB_RUN_STATUS_SETTING);
48877
+ const book = raw2 && typeof raw2 === "object" && !Array.isArray(raw2) ? { ...raw2 } : {};
48878
+ delete book[key];
48879
+ book[key] = reading;
48880
+ const keys = Object.keys(book);
48881
+ for (const stale of keys.slice(0, Math.max(0, keys.length - GITHUB_RUN_STATUS_CAP))) delete book[stale];
48882
+ storage.setSetting(GITHUB_RUN_STATUS_SETTING, book);
48883
+ }
48884
+ function runReadingAsCi(run5) {
48885
+ const completed = run5.status === "completed";
48886
+ const green = completed && (run5.conclusion === "success" || run5.conclusion === "neutral" || run5.conclusion === "skipped");
48887
+ return {
48888
+ checks: completed ? green ? "passing" : "failing" : "running",
48889
+ running: run5.status === "queued" || run5.status === "in_progress" ? Math.max(1, run5.jobs - run5.done) : 0,
48890
+ passed: 0,
48891
+ failed: run5.failing.length,
48892
+ skipped: 0,
48893
+ gated: run5.status === "waiting" ? Math.max(1, run5.held.length) : 0,
48894
+ gating: run5.held,
48895
+ failing: run5.failing,
48896
+ merge: "unknown",
48897
+ state: "open",
48898
+ polledAt: run5.polledAt,
48899
+ ...run5.head ? { head: run5.head } : {}
48900
+ };
48901
+ }
48902
+ var PR_REF_RE, ISSUE_REF_RE, LIVE_SET, GITHUB_STATUS_SETTING, GITHUB_ISSUE_STATUS_SETTING, GITHUB_RUN_STATUS_SETTING, GITHUB_RUN_STATUS_CAP;
48642
48903
  var init_awaiting = __esm({
48643
48904
  "packages/server/src/awaiting.ts"() {
48644
48905
  "use strict";
48906
+ init_github_run_ref();
48645
48907
  init_src();
48646
48908
  PR_REF_RE = /(?:https?:\/\/github\.com\/)?([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*?)(?:\/pull\/|\/pulls\/|#)(\d+)/;
48647
48909
  ISSUE_REF_RE = /(?:https?:\/\/github\.com\/)?([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*?)(?:\/issues\/|#)(\d+)/;
@@ -48651,11 +48913,14 @@ var init_awaiting = __esm({
48651
48913
  timer: "timers",
48652
48914
  pr: "prs",
48653
48915
  issue: "issues",
48916
+ run: "runs",
48654
48917
  command: "commands",
48655
48918
  thread: "threads"
48656
48919
  };
48657
48920
  GITHUB_STATUS_SETTING = "waker.github.status.v1";
48658
48921
  GITHUB_ISSUE_STATUS_SETTING = "waker.github.issue.status.v1";
48922
+ GITHUB_RUN_STATUS_SETTING = "waker.github.run.status.v1";
48923
+ GITHUB_RUN_STATUS_CAP = 200;
48659
48924
  }
48660
48925
  });
48661
48926
 
@@ -49037,7 +49302,7 @@ var init_workerPrompt = __esm({
49037
49302
  COMMANDS_FOR_CLAUDE = `, and one naming
49038
49303
  \`monitors:\` with nothing but those, where it runs to a week`;
49039
49304
  COMMANDS_CI_CLAUDE = `;
49040
- for anything a shell command can check \u2014 a version published, a release run finished, a URL up \u2014
49305
+ for anything else a shell command can check \u2014 a version published, a URL up \u2014
49041
49306
  \`frizzctl monitor\` where Frizz allows it`;
49042
49307
  NO_COMMAND_WATCHES = { "COMMANDS_KEY": "", "COMMANDS_FOR": "", "COMMANDS_CI": "" };
49043
49308
  COMMAND_WATCH_WAITS = {
@@ -49462,7 +49727,14 @@ exactly ONE of them.
49462
49727
  - \`issues:\` \u2014 GitHub issues you REGISTERED with \`frizzctl watch-issue add\`, written \`owner/repo#N\`.
49463
49728
  Same shape as \`prs:\`, same register-first rule. That watcher wakes you on every later comment, when a
49464
49729
  label moves or someone is assigned, and once more when the issue closes \u2014 the wait for a reporter's
49465
- reproduction or a maintainer's triage. An issue has no CI and no merge, so it never says either.{{FRIZZ_COMMANDS_KEY}}
49730
+ reproduction or a maintainer's triage. An issue has no CI and no merge, so it never says either.
49731
+ - \`runs:\` \u2014 GitHub Actions runs you REGISTERED with \`frizzctl watch-run add\`, written as you
49732
+ registered them: \`owner/repo/actions/runs/N\`, or \`owner/repo@<sha>\` for one followed by commit
49733
+ (\`--workflow test.yml\`). Same register-first rule. That watcher wakes you when a job goes red while
49734
+ the run is still going, when the run waits on an environment that needs a reviewer's approval (with
49735
+ the approve command, which needs a credential that can write), and when the run ends. A pass settles
49736
+ it; a red end leaves it armed, so a re-run of the failed jobs is followed. \`status: working\` while
49737
+ the run is going.{{FRIZZ_COMMANDS_KEY}}
49466
49738
  - \`for:\` \u2014 **REQUIRED**, and a DURATION: \`30s\`, \`15m\`, \`2h\`, \`3d\`. Never an instant. When it runs
49467
49739
  out frizz brings you back to re-check everything; re-parking is fine and uncapped. Capped at a day,
49468
49740
  except on a park naming ONLY \`prs:\` and \`issues:\`, where it runs to a year{{FRIZZ_COMMANDS_FOR}}.
@@ -49548,7 +49820,8 @@ exactly ONE of them.
49548
49820
  sign-off, its \`id:\` alone. **WAITING ON ONE TO ACT IS \`steps:\`.** There is no
49549
49821
  human gate and no prose park.
49550
49822
  - **CI, RELEASES, DEPLOYS AND MERGE PROGRESSION ARE AUTOMATABLE \u2014 never \` \`\`\`awaiting \` them
49551
- BLINDLY.** For a pull request, \`frizzctl watch-pr\`; for a GitHub issue, \`frizzctl watch-issue\`{{FRIZZ_COMMANDS_CI}}.
49823
+ BLINDLY.** For a pull request, \`frizzctl watch-pr\`; for a GitHub issue, \`frizzctl watch-issue\`;
49824
+ for a GitHub Actions run \u2014 a release, main's CI after a merge, a deploy \u2014 \`frizzctl watch-run\`{{FRIZZ_COMMANDS_CI}}.
49552
49825
  For anything else stay ACTIVE: dispatch a sub-agent to own the wait (its return re-invokes you), or
49553
49826
  set a timer and name it here.
49554
49827
  - **THE PARK SURVIVES A RESTART.** Registration and fence are both durable, so frizz brings you back
@@ -50255,8 +50528,9 @@ answering \`status: working\` or \`status: watching\` keeps a rested thread out
50255
50528
  sub-agent alone does not.
50256
50529
 
50257
50530
  - **Resting until a condition is met** (the usual CI / PR / release wait) \u2192 for a pull request,
50258
- \`frizzctl watch-pr\`; for a GitHub issue, \`frizzctl watch-issue\`; for any other OUTSIDE condition a
50259
- shell command can check \u2014 a package version published, a release run finished, a URL answering \u2014
50531
+ \`frizzctl watch-pr\`; for a GitHub issue, \`frizzctl watch-issue\`; for a GitHub Actions run \u2014 a
50532
+ release run, main's CI after a merge, a deploy \u2014 \`frizzctl watch-run\`; for any other OUTSIDE
50533
+ condition a shell command can check \u2014 a package version published, a URL answering \u2014
50260
50534
  {{FRIZZ_WAIT_ANY_CONDITION}} For a wait no command can judge, dispatch a SUB-AGENT
50261
50535
  to own it. It runs the watcher
50262
50536
  to completion in its own foreground and returns the verdict, and its return re-invokes you; rest on
@@ -50315,7 +50589,8 @@ sub-agents, parallelization, delegation, or independent fresh-context review.
50315
50589
  ### Waiting on CI and reviews
50316
50590
 
50317
50591
  **For a pull request or an issue, register \`frizzctl watch-pr add\` / \`frizzctl watch-issue add\` and
50318
- rest on it** (\`prs:\` / \`issues:\` in your fence). Frizz's server runs that watch on its own GitHub
50592
+ rest on it** (\`prs:\` / \`issues:\` in your fence); for a GitHub Actions run (a release, main's CI, a
50593
+ deploy), \`frizzctl watch-run add\` and \`runs:\`. Frizz's server runs that watch on its own GitHub
50319
50594
  credential, so it needs no \`gh\` sign-in from you, survives a restart, and keeps working while the
50320
50595
  machine's screen is locked. Reach for a monitor only when you need the verdict inside this turn.
50321
50596
 
@@ -50419,12 +50694,12 @@ When delegation is explicitly authorized:
50419
50694
 
50420
50695
  ## Automated waits in Codex
50421
50696
 
50422
- A pull request or an issue you can rest on: register \`frizzctl watch-pr\` / \`frizzctl watch-issue\`
50423
- (above). Keep other automatable waits inside the active turn through the selected persistent \`exec_command\` /
50697
+ A pull request, an issue or a GitHub Actions run you can rest on: register \`frizzctl watch-pr\` /
50698
+ \`frizzctl watch-issue\` / \`frizzctl watch-run\` (above). Keep other automatable waits inside the active turn through the selected persistent \`exec_command\` /
50424
50699
  \`write_stdin\` monitor session until it reaches a terminal condition. Then diagnose/fix/retry/merge as
50425
50700
  authorized. Do not emit a blind \`awaiting\` for CI,
50426
- automated review, release, or merge progression; a fence naming a registered \`prs:\` or \`issues:\`
50427
- watch is not blind. Those tool sessions are process-bound; set a durable
50701
+ automated review, release, or merge progression; a fence naming a registered \`prs:\`, \`issues:\` or
50702
+ \`runs:\` watch is not blind. Those tool sessions are process-bound; set a durable
50428
50703
  timer with \`frizzctl timer set\` and name it in your fence only when the next check belongs at a later
50429
50704
  wall-clock time. A partial
50430
50705
  \`gh pr checks\` rollup is not a CI-green verdict: inspect workflow runs for the exact PR head too, and
@@ -53347,11 +53622,19 @@ function hasLiveOwnWork(tele, registeredPrWatches) {
53347
53622
  function hasParkedPrWatch(tele, registered) {
53348
53623
  if (tele?.lastFence?.kind !== "awaiting") return registered.size > 0;
53349
53624
  return tele.lastFence.hints.some((hint) => {
53625
+ if (hint.kind === "run") return runEntryLive(hint.value, registered);
53350
53626
  if (hint.kind !== "pr" && hint.kind !== "issue") return false;
53351
53627
  const ref = hint.kind === "pr" ? parsePrRef(hint.value) : parseIssueRef(hint.value);
53352
53628
  return ref !== void 0 && registered.has(githubStatusKey(ref));
53353
53629
  });
53354
53630
  }
53631
+ function githubWithRunReadings(github, rows, runBook) {
53632
+ const entries2 = rows.flatMap((w) => {
53633
+ const reading = w.kind === "run" && w.number > 0 ? runBook[runBookKey(w.owner, w.repo, w.number)] : void 0;
53634
+ return reading ? runWatchKeys(w).map((key) => [key, runReadingAsCi(reading)]) : [];
53635
+ });
53636
+ return entries2.length ? { ...github, ...Object.fromEntries(entries2) } : github;
53637
+ }
53355
53638
  function bgSnoozeArmed(row) {
53356
53639
  return row.bg_snooze_rested_at != null && row.rested_at != null && row.bg_snooze_rested_at === row.rested_at;
53357
53640
  }
@@ -53364,7 +53647,7 @@ function wakesOnItsOwn(row, tele, registeredWatches, armedTimerIds, liveChildren
53364
53647
  function hasParkedExternalWait(tele, _nowMs) {
53365
53648
  return false;
53366
53649
  }
53367
- function fenceWatchViews(slug, tele, fenceAt, github = {}, registered = [], armedTimers = [], armedWatches = [], issueBook = {}, armedCommands = []) {
53650
+ function fenceWatchViews(slug, tele, fenceAt, github = {}, registered = [], armedTimers = [], armedWatches = [], issueBook = {}, armedCommands = [], runBook = {}) {
53368
53651
  const seen = /* @__PURE__ */ new Set();
53369
53652
  const out2 = [];
53370
53653
  for (const t of armedTimers) {
@@ -53406,6 +53689,23 @@ function fenceWatchViews(slug, tele, fenceAt, github = {}, registered = [], arme
53406
53689
  });
53407
53690
  }
53408
53691
  for (const w of registered) {
53692
+ if (w.kind === "run") {
53693
+ const dedupe2 = `github:run:${w.target}`;
53694
+ if (seen.has(dedupe2)) continue;
53695
+ seen.add(dedupe2);
53696
+ const reading = w.bookKey ? runBook[w.bookKey] : void 0;
53697
+ out2.push({
53698
+ id: `github:${slug}:run:${w.target}`,
53699
+ kind: "github",
53700
+ target: w.target,
53701
+ state: "armed",
53702
+ createdAt: w.createdAt,
53703
+ subject: "run",
53704
+ ...reading ? { run: reading } : {},
53705
+ ...w.workflow ? { workflow: w.workflow } : {}
53706
+ });
53707
+ continue;
53708
+ }
53409
53709
  const subject = w.kind === "issue" ? "issue" : "pull";
53410
53710
  const dedupe = `github:${subject}:${w.target}`;
53411
53711
  if (seen.has(dedupe)) continue;
@@ -53514,7 +53814,9 @@ function quietParkHolds(tele, runtime, nowMs, registeredPrWatches, armedTimerIds
53514
53814
  registeredPrWatches,
53515
53815
  new Set([...armedTimerIds].filter(isCommandWatchId)),
53516
53816
  idlePrsOf(github, Date.parse(tele?.lastAssistantAt ?? "")),
53517
- liveChildren
53817
+ liveChildren,
53818
+ // …and for `runs:` (2026-11-27), whose keys ride the same set (runWatchKeys).
53819
+ registeredPrWatches
53518
53820
  ),
53519
53821
  Date.parse(tele?.lastAssistantAt ?? ""),
53520
53822
  nowMs
@@ -53695,13 +53997,21 @@ function questionViewsOf(questionRows, rawTele, questionFaults) {
53695
53997
  if (questionRows.length > 0) questionViewMemo.set(questionRows, { rows: questionRows.map((q) => ({ ...q })), tele: rawTele, faults: questionFaults, value });
53696
53998
  return value;
53697
53999
  }
53698
- function sessionThreadView(projectDir, storage, row, rawTele, registeredLegacyTerminal, interactionPresence, nowMs, codexTurnLiveness, claudeBrokerDaemonAlive, registries, github = {}, issueBook = {}, claudeCatalogue = void 0, questionFaults = void 0, liveChildren = /* @__PURE__ */ new Set()) {
53699
- const armedPrWatches = (registries.prWatches.get(row.slug) ?? []).map((w) => ({
54000
+ function sessionThreadView(projectDir, storage, row, rawTele, registeredLegacyTerminal, interactionPresence, nowMs, codexTurnLiveness, claudeBrokerDaemonAlive, registries, github = {}, issueBook = {}, claudeCatalogue = void 0, questionFaults = void 0, liveChildren = /* @__PURE__ */ new Set(), runBook = {}) {
54001
+ const prWatchRows = registries.prWatches.get(row.slug) ?? [];
54002
+ const armedPrWatches = prWatchRows.map((w) => w.kind === "run" ? {
54003
+ target: w.number > 0 ? runTarget(w.owner, w.repo, w.number) : runCommitTarget(w.owner, w.repo, w.run_sha ?? ""),
54004
+ kind: w.kind,
54005
+ createdAt: new Date(w.created_at).toISOString(),
54006
+ ...w.number > 0 ? { bookKey: runBookKey(w.owner, w.repo, w.number) } : {},
54007
+ ...w.run_workflow ? { workflow: w.run_workflow } : {}
54008
+ } : {
53700
54009
  target: `${w.owner}/${w.repo}#${w.number}`,
53701
54010
  kind: w.kind,
53702
54011
  createdAt: new Date(w.created_at).toISOString()
53703
- }));
53704
- const registeredPrWatches = new Set(armedPrWatches.map((w) => w.target));
54012
+ });
54013
+ const registeredPrWatches = new Set(prWatchRows.flatMap((w) => w.kind === "run" ? runWatchKeys(w) : [`${w.owner}/${w.repo}#${w.number}`]));
54014
+ github = githubWithRunReadings(github, prWatchRows, runBook);
53705
54015
  const armedTimers = (registries.timers.get(row.slug) ?? []).map((t) => ({
53706
54016
  id: t.id,
53707
54017
  prompt: t.prompt,
@@ -53842,7 +54152,7 @@ function sessionThreadView(projectDir, storage, row, rawTele, registeredLegacyTe
53842
54152
  // become the github rows, `watch:` lines the shell rows — so this strip lists exactly what will
53843
54153
  // actually wake the thread, and the two cannot drift into claiming different things. There is no
53844
54154
  // registry behind either any more (`thread_watch`, retired 2026-08-14).
53845
- watches: fenceWatchViews(row.slug, tele, tele?.lastAssistantAt, github, armedPrWatches, armedTimers, armedWatches, issueBook, armedCommandWatches),
54155
+ watches: fenceWatchViews(row.slug, tele, tele?.lastAssistantAt, github, armedPrWatches, armedTimers, armedWatches, issueBook, armedCommandWatches, runBook),
53846
54156
  pendingAsk: tele?.pendingAsk ? { questions: tele.pendingAsk.questions } : void 0,
53847
54157
  pendingQuestion: tele?.pendingQuestion ?? false,
53848
54158
  questions,
@@ -54007,7 +54317,7 @@ function foreignThreadView(sessionId, tele, backend) {
54007
54317
  context: tele.contextTokens !== void 0 && tele.contextWindow !== void 0 && tele.contextWindow > 0 ? { tokens: tele.contextTokens, window: tele.contextWindow } : void 0
54008
54318
  };
54009
54319
  }
54010
- function archivedViewInputs(row, tele, legacyTerminal, presence, brokerAlive, registries, github, issueBook, catalogue, faults) {
54320
+ function archivedViewInputs(row, tele, legacyTerminal, presence, brokerAlive, registries, github, issueBook, runBook, catalogue, faults) {
54011
54321
  if (effectiveSessionState(row, legacyTerminal) !== "archived") return void 0;
54012
54322
  if (row.codex_runtime === "app-server") return void 0;
54013
54323
  if (row.snoozed_until !== null && row.snoozed_until !== void 0) return void 0;
@@ -54033,12 +54343,13 @@ function archivedViewInputs(row, tele, legacyTerminal, presence, brokerAlive, re
54033
54343
  confirmedIn: registries,
54034
54344
  github,
54035
54345
  issueBook,
54346
+ runBook,
54036
54347
  catalogue,
54037
54348
  faults
54038
54349
  };
54039
54350
  }
54040
- function memoStillHolds(m, row, tele, legacyTerminal, presence, brokerAlive, registries, github, issueBook, catalogue, faults) {
54041
- if (m.row !== row || m.tele !== tele || m.legacyTerminal !== legacyTerminal || m.presence !== presence || m.github !== github || m.issueBook !== issueBook || m.catalogue !== catalogue || m.faults !== faults) return false;
54351
+ function memoStillHolds(m, row, tele, legacyTerminal, presence, brokerAlive, registries, github, issueBook, runBook, catalogue, faults) {
54352
+ if (m.row !== row || m.tele !== tele || m.legacyTerminal !== legacyTerminal || m.presence !== presence || m.github !== github || m.issueBook !== issueBook || m.runBook !== runBook || m.catalogue !== catalogue || m.faults !== faults) return false;
54042
54353
  if (m.confirmedIn !== registries) {
54043
54354
  const slug = row.slug;
54044
54355
  if (m.links !== registries.links.get(slug) || m.prWatches !== registries.prWatches.get(slug) || m.timers !== registries.timers.get(slug) || m.commandWatches !== registries.commandWatches.get(slug) || m.questions !== registries.questions.get(slug) || m.watches !== registries.watches.get(slug) || m.done !== registries.done.get(slug)) return false;
@@ -54134,6 +54445,7 @@ function createBoard(project, storage, bus, tailer, bootId, deps = {}) {
54134
54445
  let lastRegistries;
54135
54446
  const githubBook = parsedSetting(readGithubStatusBook);
54136
54447
  const issueStatusBook = parsedSetting(readGithubIssueStatusBook);
54448
+ const runStatusBook = parsedSetting(readGithubRunStatusBook);
54137
54449
  const archivedViews = /* @__PURE__ */ new Map();
54138
54450
  let shippedViews = /* @__PURE__ */ new Map();
54139
54451
  const shippedViewOr = (fresh) => {
@@ -54146,6 +54458,7 @@ function createBoard(project, storage, bus, tailer, bootId, deps = {}) {
54146
54458
  const rows = validRowsOf.valid;
54147
54459
  const github = githubBook.read(storage.getSetting(GITHUB_STATUS_SETTING));
54148
54460
  const issueBook = issueStatusBook.read(storage.getSetting(GITHUB_ISSUE_STATUS_SETTING));
54461
+ const runBook = runStatusBook.read(storage.getSetting(GITHUB_RUN_STATUS_SETTING));
54149
54462
  const registries = lastRegistries = readThreadRegistries(storage, lastRegistries);
54150
54463
  const brokerAlive = deps.claudeBrokerLiveness?.() ?? claudeBrokerDaemonAlive;
54151
54464
  const catalogue = claudeModels();
@@ -54178,11 +54491,11 @@ function createBoard(project, storage, bus, tailer, bootId, deps = {}) {
54178
54491
  const legacyTerminal = legacyTerminalCache.has(row.slug);
54179
54492
  const faults = questionFaults(row.slug);
54180
54493
  const memo3 = archivedViews.get(row.slug);
54181
- if (memo3 && memoStillHolds(memo3.inputs, row, tele, legacyTerminal, interactionPresence, brokerAlive, registries, github, issueBook, catalogue, faults)) {
54494
+ if (memo3 && memoStillHolds(memo3.inputs, row, tele, legacyTerminal, interactionPresence, brokerAlive, registries, github, issueBook, runBook, catalogue, faults)) {
54182
54495
  out2.push(memo3.view);
54183
54496
  continue;
54184
54497
  }
54185
- const inputs = archivedViewInputs(row, tele, legacyTerminal, interactionPresence, brokerAlive, registries, github, issueBook, catalogue, faults);
54498
+ const inputs = archivedViewInputs(row, tele, legacyTerminal, interactionPresence, brokerAlive, registries, github, issueBook, runBook, catalogue, faults);
54186
54499
  const view = shippedViewOr(sessionThreadView(
54187
54500
  project.dir,
54188
54501
  storage,
@@ -54198,7 +54511,8 @@ function createBoard(project, storage, bus, tailer, bootId, deps = {}) {
54198
54511
  issueBook,
54199
54512
  catalogue,
54200
54513
  faults,
54201
- liveChildThreads(children2.get(row.slug) ?? [], (slug) => tailer.get(slug))
54514
+ liveChildThreads(children2.get(row.slug) ?? [], (slug) => tailer.get(slug)),
54515
+ runBook
54202
54516
  ));
54203
54517
  if (inputs) archivedViews.set(row.slug, { inputs, view });
54204
54518
  else archivedViews.delete(row.slug);
@@ -54490,6 +54804,7 @@ var init_board = __esm({
54490
54804
  init_frizz();
54491
54805
  init_project_root();
54492
54806
  init_awaiting();
54807
+ init_github_run_ref();
54493
54808
  init_project_registry();
54494
54809
  init_json_value();
54495
54810
  init_delivery_ledger();
@@ -54991,6 +55306,7 @@ var init_wake_store = __esm({
54991
55306
 
54992
55307
  // packages/server/src/github-review.ts
54993
55308
  function refKey(ref) {
55309
+ if (ref.kind === "run") return `run:${ref.owner}/${ref.repo}#${ref.number}`;
54994
55310
  return `${ref.kind === "issue" ? "issue:" : ""}${ref.owner}/${ref.repo}#${ref.number}`;
54995
55311
  }
54996
55312
  function conciseError(error) {
@@ -55123,6 +55439,55 @@ function parseGithubIssueSnapshot(issue) {
55123
55439
  comments: Number.isFinite(comments) && comments >= 0 ? comments : 0
55124
55440
  };
55125
55441
  }
55442
+ function parseGithubRunSnapshot(node) {
55443
+ if (!node || typeof node !== "object") return void 0;
55444
+ const n = node;
55445
+ const suite = n.checkSuite;
55446
+ if (typeof suite?.status !== "string" || !suite.status) return void 0;
55447
+ const runs = suite.checkRuns;
55448
+ const jobs = (Array.isArray(runs?.nodes) ? runs.nodes : []).flatMap((j10) => {
55449
+ if (!j10 || typeof j10 !== "object") return [];
55450
+ const r = j10;
55451
+ if (!Number.isSafeInteger(r.databaseId) || typeof r.name !== "string" || typeof r.status !== "string") return [];
55452
+ return [{
55453
+ id: r.databaseId,
55454
+ name: r.name,
55455
+ status: r.status,
55456
+ ...typeof r.conclusion === "string" && r.conclusion ? { conclusion: r.conclusion } : {},
55457
+ ...typeof r.detailsUrl === "string" && r.detailsUrl ? { url: r.detailsUrl } : {},
55458
+ ...typeof r.startedAt === "string" && r.startedAt ? { startedAt: r.startedAt } : {}
55459
+ }];
55460
+ });
55461
+ const total = Number(runs?.totalCount);
55462
+ const deployments = (Array.isArray(n.pendingDeploymentRequests?.nodes) ? n.pendingDeploymentRequests.nodes : []).flatMap((d5) => {
55463
+ if (!d5 || typeof d5 !== "object") return [];
55464
+ const r = d5;
55465
+ const name = r.environment?.name;
55466
+ if (typeof name !== "string" || !name) return [];
55467
+ return [{
55468
+ environment: name,
55469
+ ...Number.isSafeInteger(r.environment?.databaseId) ? { environmentId: r.environment.databaseId } : {},
55470
+ // A User or a Bot answers to `login`, a Team to `name` — the reviewer either way.
55471
+ reviewers: strings(r.reviewers?.nodes, (v2) => v2.login ?? v2.name),
55472
+ canApprove: r.currentUserCanApprove === true,
55473
+ waitTimer: Number.isFinite(r.waitTimer) ? r.waitTimer : 0
55474
+ }];
55475
+ });
55476
+ return {
55477
+ status: suite.status,
55478
+ ...typeof suite.conclusion === "string" && suite.conclusion ? { conclusion: suite.conclusion } : {},
55479
+ ...Number.isSafeInteger(n.databaseId) ? { runId: n.databaseId } : {},
55480
+ ...Number.isSafeInteger(n.runNumber) ? { runNumber: n.runNumber } : {},
55481
+ ...Number.isSafeInteger(n.runAttempt) ? { attempt: n.runAttempt } : {},
55482
+ ...typeof n.url === "string" && n.url ? { url: n.url } : {},
55483
+ ...typeof n.event === "string" && n.event ? { event: n.event } : {},
55484
+ ...typeof n.workflow?.name === "string" && n.workflow.name ? { workflow: n.workflow.name } : {},
55485
+ ...typeof suite.commit?.oid === "string" && suite.commit.oid ? { head: suite.commit.oid } : {},
55486
+ jobs,
55487
+ jobTotal: Number.isFinite(total) && total >= jobs.length ? total : jobs.length,
55488
+ deployments
55489
+ };
55490
+ }
55126
55491
  function isBotGithubActor(a) {
55127
55492
  return a.actorType?.toLowerCase() === "bot" || a.actor.toLowerCase().endsWith("[bot]");
55128
55493
  }
@@ -55131,6 +55496,26 @@ function buildQuery(refs) {
55131
55496
  const declarations = [];
55132
55497
  const fields = [];
55133
55498
  refs.forEach((ref, index) => {
55499
+ if (ref.kind === "run") {
55500
+ declarations.push(`$node${index}: ID!`);
55501
+ variables[`node${index}`] = ref.nodeId ?? "";
55502
+ fields.push(`
55503
+ ref${index}: node(id: $node${index}) {
55504
+ ... on WorkflowRun {
55505
+ databaseId runNumber runAttempt url event
55506
+ workflow { name }
55507
+ pendingDeploymentRequests(first: ${RUN_DEPLOYMENT_CAP}) { nodes {
55508
+ environment { name databaseId } currentUserCanApprove waitTimer
55509
+ reviewers(first: ${RUN_REVIEWER_CAP}) { nodes { __typename ... on User { login } ... on Team { name } } }
55510
+ } }
55511
+ checkSuite {
55512
+ status conclusion commit { oid }
55513
+ checkRuns(first: ${RUN_JOB_CAP}, filterBy: { checkType: LATEST }) { totalCount nodes { databaseId name status conclusion detailsUrl startedAt } }
55514
+ }
55515
+ }
55516
+ }`);
55517
+ return;
55518
+ }
55134
55519
  declarations.push(`$owner${index}: String!`, `$repo${index}: String!`, `$number${index}: Int!`);
55135
55520
  variables[`owner${index}`] = ref.owner;
55136
55521
  variables[`repo${index}`] = ref.repo;
@@ -55407,6 +55792,28 @@ function createGithubReviewFetcher(deps = {}) {
55407
55792
  if (error?.type === "NOT_FOUND" && typeof alias === "string") notFound.set(alias, typeof error.message === "string" ? error.message : "not found");
55408
55793
  }
55409
55794
  refs.forEach((ref, index) => {
55795
+ if (ref.kind === "run") {
55796
+ const node = body?.data?.[`ref${index}`];
55797
+ const missingRun = notFound.get(`ref${index}`);
55798
+ if (missingRun && !node) {
55799
+ results.set(refKey(ref), { status: "error", failure: { kind: "not-found", message: `GitHub: ${missingRun}` } });
55800
+ return;
55801
+ }
55802
+ const run5 = parseGithubRunSnapshot(node);
55803
+ if (!run5) {
55804
+ results.set(refKey(ref), {
55805
+ status: "error",
55806
+ failure: {
55807
+ kind: graphRateLimited ? "rate-limit" : genericGraphError ? "graphql" : "shape",
55808
+ message: graphRateLimited ? `GitHub API rate limit exhausted${graphResetAt ? `; resets at ${graphResetAt}` : ""}` : genericGraphError ? `GitHub GraphQL error: ${genericGraphError}` : `GitHub returned no readable workflow run for ${refKey(ref)}`,
55809
+ ...graphRateLimited && graphResetAt ? { retryAt: graphResetAt } : {}
55810
+ }
55811
+ });
55812
+ return;
55813
+ }
55814
+ results.set(refKey(ref), { status: "ok", activity: [], run: run5 });
55815
+ return;
55816
+ }
55410
55817
  const repository = body?.data?.[`ref${index}`];
55411
55818
  const missing = notFound.get(`ref${index}`);
55412
55819
  if (missing && !(ref.kind === "issue" ? repository?.issue : repository?.pullRequest)) {
@@ -55513,7 +55920,7 @@ function createGithubReviewFetcher(deps = {}) {
55513
55920
  }
55514
55921
  });
55515
55922
  }
55516
- var REQUEST_TIMEOUT_MS2, MAX_REFS_PER_REQUEST, RATE_LIMIT_RESERVE, ROLLUP_PAGE_SIZE, ROLLUP_MAX_PAGES, CHECK_SUITE_CAP, LABEL_CAP, MERGE_EXIT_CAP, REVIEW_REQUEST_CAP, ASSIGNEE_CAP, strings, ROLLUP_NODE_FIELDS;
55923
+ var REQUEST_TIMEOUT_MS2, MAX_REFS_PER_REQUEST, RATE_LIMIT_RESERVE, ROLLUP_PAGE_SIZE, ROLLUP_MAX_PAGES, CHECK_SUITE_CAP, LABEL_CAP, MERGE_EXIT_CAP, REVIEW_REQUEST_CAP, ASSIGNEE_CAP, RUN_JOB_CAP, RUN_DEPLOYMENT_CAP, RUN_REVIEWER_CAP, strings, ROLLUP_NODE_FIELDS;
55517
55924
  var init_github_review = __esm({
55518
55925
  "packages/server/src/github-review.ts"() {
55519
55926
  "use strict";
@@ -55528,6 +55935,9 @@ var init_github_review = __esm({
55528
55935
  MERGE_EXIT_CAP = 5;
55529
55936
  REVIEW_REQUEST_CAP = 20;
55530
55937
  ASSIGNEE_CAP = 20;
55938
+ RUN_JOB_CAP = 100;
55939
+ RUN_DEPLOYMENT_CAP = 10;
55940
+ RUN_REVIEWER_CAP = 10;
55531
55941
  strings = (nodes, pick) => (Array.isArray(nodes) ? nodes : []).flatMap((node) => {
55532
55942
  if (!node || typeof node !== "object") return [];
55533
55943
  const value = pick(node);
@@ -55657,6 +56067,99 @@ var init_pr_watch_noise = __esm({
55657
56067
  }
55658
56068
  });
55659
56069
 
56070
+ // packages/server/src/github-run.ts
56071
+ async function ghApi(path5) {
56072
+ const { stdout } = await runFrizzGh(["api", path5], { timeout: GH_TIMEOUT_MS, maxBuffer: 4e6 });
56073
+ return JSON.parse(stdout);
56074
+ }
56075
+ function probeRunOf(raw2) {
56076
+ if (!raw2 || typeof raw2 !== "object") return void 0;
56077
+ const r = raw2;
56078
+ if (!Number.isSafeInteger(r.id) || typeof r.node_id !== "string" || !r.node_id || typeof r.status !== "string") return void 0;
56079
+ return {
56080
+ id: r.id,
56081
+ nodeId: r.node_id,
56082
+ status: r.status,
56083
+ ...typeof r.conclusion === "string" && r.conclusion ? { conclusion: r.conclusion } : {},
56084
+ ...typeof r.name === "string" && r.name ? { name: r.name } : {},
56085
+ ...Number.isSafeInteger(r.run_number) ? { runNumber: r.run_number } : {},
56086
+ ...Number.isSafeInteger(r.run_attempt) ? { attempt: r.run_attempt } : {},
56087
+ ...typeof r.html_url === "string" && r.html_url ? { url: r.html_url } : {},
56088
+ ...typeof r.head_sha === "string" && r.head_sha ? { head: r.head_sha } : {}
56089
+ };
56090
+ }
56091
+ async function newestWorkflowRun(owner, repo, workflow, sha) {
56092
+ const body = await ghApi(`repos/${owner}/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?head_sha=${sha}&per_page=20`);
56093
+ const runs = (Array.isArray(body?.workflow_runs) ? body.workflow_runs : []).map((r) => ({ run: probeRunOf(r), created: Date.parse(String(r?.created_at ?? "")) })).filter((r) => r.run !== void 0);
56094
+ runs.sort((a, b) => (b.created || 0) - (a.created || 0) || b.run.id - a.run.id);
56095
+ return runs[0]?.run;
56096
+ }
56097
+ async function probeRunReadable(ref, workflow) {
56098
+ try {
56099
+ if (isRunIdRef(ref)) {
56100
+ const run6 = probeRunOf(await ghApi(`repos/${ref.owner}/${ref.repo}/actions/runs/${ref.runId}`));
56101
+ return run6 ? { ok: true, run: run6 } : { ok: false, reason: "GitHub's answer for that run was not one Frizz could read" };
56102
+ }
56103
+ if (!workflow) return { ok: false, reason: "a commit target needs `--workflow <file or name>`" };
56104
+ const commit = await ghApi(`repos/${ref.owner}/${ref.repo}/commits/${ref.sha}`);
56105
+ const sha = typeof commit?.sha === "string" && /^[0-9a-f]{40}$/.test(commit.sha) ? commit.sha : void 0;
56106
+ if (!sha) return { ok: false, reason: `no commit \`${ref.sha}\` in ${ref.owner}/${ref.repo}` };
56107
+ const file = await resolveWorkflowFile(ref.owner, ref.repo, workflow);
56108
+ if (!file.ok) return file;
56109
+ const run5 = await newestWorkflowRun(ref.owner, ref.repo, file.file, sha);
56110
+ return { ok: true, sha, workflow: file.file, ...run5 ? { run: run5 } : {} };
56111
+ } catch (err) {
56112
+ return { ok: false, reason: conciseGhError(err) };
56113
+ }
56114
+ }
56115
+ async function resolveWorkflowFile(owner, repo, workflow) {
56116
+ const asFile = workflowFileName(workflow);
56117
+ if (/\.ya?ml$/i.test(asFile)) {
56118
+ try {
56119
+ const body2 = await ghApi(`repos/${owner}/${repo}/actions/workflows/${encodeURIComponent(asFile)}`);
56120
+ return { ok: true, file: typeof body2?.path === "string" ? workflowFileName(body2.path) : asFile };
56121
+ } catch (err) {
56122
+ return { ok: false, reason: `no workflow \`${asFile}\` in ${owner}/${repo} (${conciseGhError(err)})` };
56123
+ }
56124
+ }
56125
+ const body = await ghApi(`repos/${owner}/${repo}/actions/workflows?per_page=100`);
56126
+ const all = Array.isArray(body?.workflows) ? body.workflows : [];
56127
+ const hit = all.find((w) => typeof w.name === "string" && w.name.toLowerCase() === workflow.trim().toLowerCase());
56128
+ if (hit && typeof hit.path === "string") return { ok: true, file: workflowFileName(hit.path) };
56129
+ const names2 = all.flatMap((w) => typeof w.path === "string" && workflowFileName(w.path) ? [workflowFileName(w.path)] : []).slice(0, 12);
56130
+ return { ok: false, reason: `no workflow named \`${workflow}\` in ${owner}/${repo}${names2.length ? ` (its workflow files: ${names2.join(", ")})` : ""}` };
56131
+ }
56132
+ async function failedJobStep(owner, repo, jobId) {
56133
+ try {
56134
+ const body = await ghApi(`repos/${owner}/${repo}/actions/jobs/${jobId}`);
56135
+ const steps = Array.isArray(body?.steps) ? body.steps : [];
56136
+ const failed = steps.find((s) => s?.conclusion === "failure") ?? steps.find((s) => s?.conclusion === "timed_out" || s?.conclusion === "cancelled");
56137
+ return typeof failed?.name === "string" && failed.name ? failed.name : void 0;
56138
+ } catch {
56139
+ return void 0;
56140
+ }
56141
+ }
56142
+ async function runAttemptStart(owner, repo, runId) {
56143
+ try {
56144
+ const body = await ghApi(`repos/${owner}/${repo}/actions/runs/${runId}`);
56145
+ const startedAtMs2 = Date.parse(String(body?.run_started_at ?? ""));
56146
+ return Number.isSafeInteger(body?.run_attempt) && Number.isFinite(startedAtMs2) ? { attempt: body.run_attempt, startedAtMs: startedAtMs2 } : void 0;
56147
+ } catch {
56148
+ return void 0;
56149
+ }
56150
+ }
56151
+ var GH_TIMEOUT_MS;
56152
+ var init_github_run = __esm({
56153
+ "packages/server/src/github-run.ts"() {
56154
+ "use strict";
56155
+ init_github_credential();
56156
+ init_scheduler();
56157
+ init_github_run_ref();
56158
+ init_github_run_ref();
56159
+ GH_TIMEOUT_MS = 15e3;
56160
+ }
56161
+ });
56162
+
55660
56163
  // packages/server/src/scheduler.ts
55661
56164
  import { createHash as createHash21, randomUUID as randomUUID17 } from "node:crypto";
55662
56165
  function failureSignature(rollup) {
@@ -55877,7 +56380,14 @@ function restMessageIsSignedOff(storage, slug, tele, _registeredPrWatches = /* @
55877
56380
  return threadSaidDone(storage, slug, tele, armedAt);
55878
56381
  }
55879
56382
  function registeredPrWatchesOf(storage, slug) {
55880
- return new Set(storage.listPrWatches(slug, { armedOnly: true }).filter((w) => w.kind !== "issue").map((w) => `${w.owner}/${w.repo}#${w.number}`));
56383
+ return new Set(storage.listPrWatches(slug, { armedOnly: true }).filter((w) => w.kind === "pull").map((w) => `${w.owner}/${w.repo}#${w.number}`));
56384
+ }
56385
+ function registeredRunWatchesOf(storage, slug) {
56386
+ return runWatchLiveKeys(storage.listPrWatches(slug, { armedOnly: true }));
56387
+ }
56388
+ function runWatchOp(w) {
56389
+ const id2 = w.number > 0 ? runTarget(w.owner, w.repo, w.number) : runCommitTarget(w.owner, w.repo, w.run_sha ?? "");
56390
+ return { id: id2, label: w.run_workflow ? `${w.run_workflow} on ${runCommitTarget(w.owner, w.repo, w.run_sha ?? "")}` : id2 };
55881
56391
  }
55882
56392
  function registeredIssueWatchesOf(storage, slug) {
55883
56393
  return new Set(storage.listPrWatches(slug, { armedOnly: true }).filter((w) => w.kind === "issue").map((w) => `${w.owner}/${w.repo}#${w.number}`));
@@ -56118,6 +56628,9 @@ function createScheduler(deps) {
56118
56628
  const now = deps.now ?? Date.now;
56119
56629
  const fetchPr = deps.fetchPr ?? defaultFetchPr;
56120
56630
  const fetchGithubReview = deps.fetchGithubReview ?? createGithubReviewFetcher({ now });
56631
+ const findWorkflowRun = deps.findWorkflowRun ?? newestWorkflowRun;
56632
+ const fetchFailedStep = deps.fetchFailedStep ?? failedJobStep;
56633
+ const fetchAttemptStart = deps.fetchAttemptStart ?? runAttemptStart;
56121
56634
  const log3 = deps.log ?? ((m) => log.info("scheduler", m));
56122
56635
  const tickMs = deps.tickMs ?? 1e4;
56123
56636
  const deliveryLeaseMs = Math.max(1, deps.deliveryLeaseMs ?? 3e4);
@@ -56525,8 +57038,9 @@ function createScheduler(deps) {
56525
57038
  // than the two the fold happens to know about — a worker told about half its work writes half
56526
57039
  // a fence, and the half it left out is not what gets it bumped.
56527
57040
  timers: deps.storage.listThreadTimers(row.slug, { armedOnly: true }).map((t) => ({ id: t.id, label: t.prompt.trim().replace(/\s+/g, " ").slice(0, 80) })),
56528
- prs: deps.storage.listPrWatches(row.slug, { armedOnly: true }).filter((w) => w.kind !== "issue").map((w) => ({ id: `${w.owner}/${w.repo}#${w.number}`, label: `${w.owner}/${w.repo}#${w.number}` })),
57041
+ prs: deps.storage.listPrWatches(row.slug, { armedOnly: true }).filter((w) => w.kind === "pull").map((w) => ({ id: `${w.owner}/${w.repo}#${w.number}`, label: `${w.owner}/${w.repo}#${w.number}` })),
56529
57042
  issues: deps.storage.listPrWatches(row.slug, { armedOnly: true }).filter((w) => w.kind === "issue").map((w) => ({ id: `${w.owner}/${w.repo}#${w.number}`, label: `${w.owner}/${w.repo}#${w.number}` })),
57043
+ runs: deps.storage.listPrWatches(row.slug, { armedOnly: true }).filter((w) => w.kind === "run").map(runWatchOp),
56530
57044
  commands: commandWatchOps(deps.storage, row.slug)
56531
57045
  };
56532
57046
  const item = outbox.enqueue({
@@ -56765,7 +57279,8 @@ ${wakeTimeHeader(nowMs, spokeAt)}`,
56765
57279
  // (needsInputParkHolds). A `needs_input` handoff naming its own green PR is exactly the rest this
56766
57280
  // asks for, and a fence with no answer is judged by rules that never see the PR readings.
56767
57281
  awaitingNeedsInput(tele.lastFence.hints) === false ? idlePrsOf(github, Date.parse(spokeAt)) : void 0,
56768
- liveChildThreads(children2.get(row.slug) ?? [], (slug) => deps.tailer.get(slug))
57282
+ liveChildThreads(children2.get(row.slug) ?? [], (slug) => deps.tailer.get(slug)),
57283
+ registeredRunWatchesOf(deps.storage, row.slug)
56769
57284
  );
56770
57285
  const settledCommands = new Map(
56771
57286
  deps.storage.listCommandWatches(row.slug).filter((w) => w.state !== "armed").map((w) => [w.id, w])
@@ -56793,7 +57308,21 @@ ${wakeTimeHeader(nowMs, spokeAt)}`,
56793
57308
  const at = finishedUnderRest.get(i.value);
56794
57309
  return at !== void 0 && nowMs - at < OWN_COMPLETION_NOTICE_GRACE_MS;
56795
57310
  };
56796
- const dead = deadAll.filter((i) => !ownWakeInFlight(i) && !ownNoticeInFlight(i));
57311
+ const reportInFlight = deps.storage.listPrWatches(row.slug).filter((w) => w.state === "settled" && outbox.listOpen().some(
57312
+ (d5) => d5.slug === row.slug && d5.fenceId.startsWith(`${PR_WATCH_FENCE_PREFIX}:${w.id}:`)
57313
+ ));
57314
+ const settledLive = reportInFlight.length === 0 ? void 0 : liveActivityOf(
57315
+ void 0,
57316
+ new Set(reportInFlight.filter((w) => w.kind === "pull").map((w) => `${w.owner}/${w.repo}#${w.number}`)),
57317
+ /* @__PURE__ */ new Set(),
57318
+ new Set(reportInFlight.filter((w) => w.kind === "issue").map((w) => `${w.owner}/${w.repo}#${w.number}`)),
57319
+ /* @__PURE__ */ new Set(),
57320
+ void 0,
57321
+ /* @__PURE__ */ new Set(),
57322
+ runWatchLiveKeys(reportInFlight)
57323
+ );
57324
+ const ownReportInFlight = (i) => settledLive !== void 0 && (i.kind === "pr" || i.kind === "issue" || i.kind === "run") && unaccountedItems([i], settledLive).length === 0;
57325
+ const dead = deadAll.filter((i) => !ownWakeInFlight(i) && !ownNoticeInFlight(i) && !ownReportInFlight(i));
56797
57326
  const expiresAt = parkExpiresAt(park, Date.parse(spokeAt));
56798
57327
  const expired = expiresAt !== null && nowMs >= expiresAt;
56799
57328
  const onParent = awaitingNeedsInput(tele.lastFence.hints) === true && childOfRow(deps.storage, row) !== void 0;
@@ -56889,7 +57418,7 @@ ${wakeTimeHeader(nowMs, spokeAt)}`,
56889
57418
  const finishedItem = (i) => finishedHandles.has(i.value) || i.kind === "timer" && firedTimers.has(i.value) || i.kind === "command" && settledCommands.get(i.value)?.state === "passed";
56890
57419
  const status = park.items.map((i) => {
56891
57420
  const gone = deadAll.some((d5) => d5.kind === i.kind && d5.value === i.value);
56892
- const note = !gone ? "still running" : i.kind === "timer" && firedTimers.has(i.value) ? "already FIRED \u2014 its wake was delivered; there is nothing left to wait on" : i.kind === "command" && settledCommands.get(i.value)?.state === "passed" ? settledCommands.get(i.value)?.kind === "monitor" ? "already ENDED \u2014 its script exited and that wake was delivered; there is nothing left to wait on" : "already PASSED \u2014 its wake was delivered; there is nothing left to wait on" : i.kind === "command" && settledCommands.has(i.value) ? `no longer armed (${settledCommands.get(i.value)?.state}) \u2014 register it again with \`frizzctl monitor add${settledCommands.get(i.value)?.kind === "monitor" ? " --persistent" : ""}\` if you still need the wait` : finishedItem(i) ? "FINISHED \u2014 its result is waiting for you" : i.kind === "shell" && staleShellHandles.has(i.value) ? "GONE WITHOUT A COMPLETION NOTICE \u2014 frizz knows this shell, but nothing holds its output file and no process it could be is still running; read its output to see how it ended" : i.kind === "agent" && staleAgentHandles.has(i.value) ? "QUIET WITHOUT A COMPLETION NOTICE \u2014 Frizz knows this sub-agent, but its transcript has not moved in 15m and nothing said it finished; it may be stuck or gone, so look at it before you wait on it again or start it over" : i.kind === "pr" ? "NOT REGISTERED \u2014 register it with `frizzctl watch-pr add` first, then name it here" : i.kind === "issue" ? "NOT REGISTERED \u2014 register it with `frizzctl watch-issue add` first, then name it here" : i.kind === "command" ? "NOT REGISTERED \u2014 register it with `frizzctl monitor add` first, then name the id it gives you here" : i.kind === "thread" ? children2.get(row.slug)?.some((c) => c.slug === i.value) ? "ALREADY REPORTED \u2014 that child's latest handoff was delivered to you; read it, and steer the child if it needs more" : "NOT YOUR CHILD \u2014 name only a thread you started with `frizzctl spawn-child`, by its slug" : "NOT RUNNING (nothing by that name)";
57421
+ const note = !gone ? "still running" : i.kind === "timer" && firedTimers.has(i.value) ? "already FIRED \u2014 its wake was delivered; there is nothing left to wait on" : i.kind === "command" && settledCommands.get(i.value)?.state === "passed" ? settledCommands.get(i.value)?.kind === "monitor" ? "already ENDED \u2014 its script exited and that wake was delivered; there is nothing left to wait on" : "already PASSED \u2014 its wake was delivered; there is nothing left to wait on" : i.kind === "command" && settledCommands.has(i.value) ? `no longer armed (${settledCommands.get(i.value)?.state}) \u2014 register it again with \`frizzctl monitor add${settledCommands.get(i.value)?.kind === "monitor" ? " --persistent" : ""}\` if you still need the wait` : finishedItem(i) ? "FINISHED \u2014 its result is waiting for you" : i.kind === "shell" && staleShellHandles.has(i.value) ? "GONE WITHOUT A COMPLETION NOTICE \u2014 frizz knows this shell, but nothing holds its output file and no process it could be is still running; read its output to see how it ended" : i.kind === "agent" && staleAgentHandles.has(i.value) ? "QUIET WITHOUT A COMPLETION NOTICE \u2014 Frizz knows this sub-agent, but its transcript has not moved in 15m and nothing said it finished; it may be stuck or gone, so look at it before you wait on it again or start it over" : i.kind === "pr" ? "NOT REGISTERED \u2014 register it with `frizzctl watch-pr add` first, then name it here" : i.kind === "issue" ? "NOT REGISTERED \u2014 register it with `frizzctl watch-issue add` first, then name it here" : i.kind === "run" ? "NOT REGISTERED \u2014 register it with `frizzctl watch-run add` first, then name it here" : i.kind === "command" ? "NOT REGISTERED \u2014 register it with `frizzctl monitor add` first, then name the id it gives you here" : i.kind === "thread" ? children2.get(row.slug)?.some((c) => c.slug === i.value) ? "ALREADY REPORTED \u2014 that child's latest handoff was delivered to you; read it, and steer the child if it needs more" : "NOT YOUR CHILD \u2014 name only a thread you started with `frizzctl spawn-child`, by its slug" : "NOT RUNNING (nothing by that name)";
56893
57422
  return `- \`${AWAITING_KEY_OF[i.kind]}: [${i.value}]\` \u2014 ${note}`;
56894
57423
  });
56895
57424
  if (park.steps.length > 0) {
@@ -56938,6 +57467,8 @@ ${wakeTimeHeader(nowMs, spokeAt)}`,
56938
57467
  " later review and comment) \u2192 `prs: [owner/repo#123]`",
56939
57468
  "- a GitHub issue \u2192 `frizzctl watch-issue add` (every later comment, a label or assignee moving,",
56940
57469
  " and the close) \u2192 `issues: [owner/repo#45]`",
57470
+ "- a GitHub Actions run \u2192 `frizzctl watch-run add` (a job going red, a hold on an environment's",
57471
+ " approval, and the run ending) \u2192 `runs: [owner/repo/actions/runs/123]`",
56941
57472
  "- a wall-clock check \u2192 `frizzctl timer set` \u2192 `timers: [tmr_\u2026]`",
56942
57473
  "- an outside condition a command can check (a package version, a release run, a URL coming up)",
56943
57474
  " \u2192 `frizzctl monitor add` \u2192 `monitors: [cmw_\u2026]`",
@@ -56963,8 +57494,9 @@ ${wakeTimeHeader(nowMs, spokeAt)}`,
56963
57494
  shells: (tele.bgShells ?? []).filter((sh2) => sh2.state === "running").map((sh2) => ({ id: sh2.taskId ?? sh2.id, label: sh2.label })),
56964
57495
  subAgents: (tele.subAgents ?? []).filter((a) => a.state === "running").map((a) => ({ id: a.taskId ?? a.id, label: a.label })),
56965
57496
  timers: deps.storage.listThreadTimers(row.slug, { armedOnly: true }).map((t) => ({ id: t.id, label: t.prompt.trim().replace(/\s+/g, " ").slice(0, 80) })),
56966
- prs: deps.storage.listPrWatches(row.slug, { armedOnly: true }).filter((w) => w.kind !== "issue").map((w) => ({ id: `${w.owner}/${w.repo}#${w.number}`, label: `${w.owner}/${w.repo}#${w.number}` })),
57497
+ prs: deps.storage.listPrWatches(row.slug, { armedOnly: true }).filter((w) => w.kind === "pull").map((w) => ({ id: `${w.owner}/${w.repo}#${w.number}`, label: `${w.owner}/${w.repo}#${w.number}` })),
56967
57498
  issues: deps.storage.listPrWatches(row.slug, { armedOnly: true }).filter((w) => w.kind === "issue").map((w) => ({ id: `${w.owner}/${w.repo}#${w.number}`, label: `${w.owner}/${w.repo}#${w.number}` })),
57499
+ runs: deps.storage.listPrWatches(row.slug, { armedOnly: true }).filter((w) => w.kind === "run").map(runWatchOp),
56968
57500
  commands: commandWatchOps(deps.storage, row.slug)
56969
57501
  });
56970
57502
  const clock = wakeTimeHeader(nowMs, spokeAt);
@@ -56997,7 +57529,9 @@ ${clock}`;
56997
57529
  }
56998
57530
  const prWatchPolledAt = /* @__PURE__ */ new Map();
56999
57531
  const prWatchMissingSince = /* @__PURE__ */ new Map();
57000
- const watchKey = (w) => `${w.kind === "issue" ? "issue:" : ""}${w.owner}/${w.repo}#${w.number}`;
57532
+ const watchKey = (w) => `${w.kind === "issue" ? "issue:" : w.kind === "run" ? "run:" : ""}${w.owner}/${w.repo}#${w.number}`;
57533
+ const watchRef = (w) => w.kind !== "run" ? `${w.owner}/${w.repo}#${w.number}` : w.number > 0 ? runTarget(w.owner, w.repo, w.number) : runCommitTarget(w.owner, w.repo, w.run_sha ?? "");
57534
+ const watchNoun = (w) => w.kind === "issue" ? "issue" : w.kind === "run" ? "run" : "pr";
57001
57535
  const prStatusFallback = concurrencyGate(PR_STATUS_FALLBACK_LIMIT);
57002
57536
  function readPrWatchHeld(raw2) {
57003
57537
  if (!raw2 || typeof raw2 !== "object") return void 0;
@@ -57087,8 +57621,8 @@ ${clock}`;
57087
57621
  for (const w of deps.storage.expiredPrWatches(nowMs)) {
57088
57622
  const row = deps.storage.getSession(w.thread_slug);
57089
57623
  deps.storage.settlePrWatch(w.id, nowMs);
57090
- const ref = `${w.owner}/${w.repo}#${w.number}`;
57091
- log3(`waker: settled ${w.thread_slug} \u2014 ${w.kind === "issue" ? "issue" : "pr"} watcher ${w.id} expired (${ref})`);
57624
+ const ref = watchRef(w);
57625
+ log3(`waker: settled ${w.thread_slug} \u2014 ${watchNoun(w)} watcher ${w.id} expired (${ref})`);
57092
57626
  if (!row || row.state === "archived" || row.archived === 1) continue;
57093
57627
  const fenceId = prWatchExpiredFenceId(w.id);
57094
57628
  const deliveryId = wakeDeliveryId(row.slug, row.session_id, fenceId);
@@ -57100,8 +57634,8 @@ ${clock}`;
57100
57634
  fenceId,
57101
57635
  hintKey: fenceId,
57102
57636
  // In @frizz/shared beside `parsePrWatchExpiredWake`, for the reason above.
57103
- message: prWatchExpiredWakeMessage(ref, w.kind === "issue" ? "issue" : "pull"),
57104
- reason: `${w.kind === "issue" ? "issue" : "pr"} watcher ${w.id} expired (${ref})`
57637
+ message: prWatchExpiredWakeMessage(ref, w.kind === "issue" ? "issue" : w.kind === "run" ? "run" : "pull"),
57638
+ reason: `${watchNoun(w)} watcher ${w.id} expired (${ref})`
57105
57639
  }, nowMs).delivery;
57106
57640
  log3(`waker: queued ${row.slug} \u2014 ${item.reason}`);
57107
57641
  checkpoint("after-enqueue", item);
@@ -57118,8 +57652,33 @@ ${clock}`;
57118
57652
  return live2;
57119
57653
  };
57120
57654
  const refs = /* @__PURE__ */ new Map();
57121
- for (const w of armed) {
57655
+ const resolved2 = /* @__PURE__ */ new Map();
57656
+ await Promise.all(armed.filter((w) => w.kind === "run" && w.number === 0 && isThreadLive(w.thread_slug)).map(async (w) => {
57657
+ if (!w.run_sha || !w.run_workflow) return;
57658
+ const key = `runsha:${w.owner}/${w.repo}@${w.run_sha}:${w.run_workflow}`.toLowerCase();
57659
+ if (nowMs - (prWatchPolledAt.get(key) ?? 0) < PR_WATCH_POLL_MS) return;
57660
+ prWatchPolledAt.set(key, nowMs);
57661
+ try {
57662
+ const run5 = await findWorkflowRun(w.owner, w.repo, w.run_workflow, w.run_sha);
57663
+ if (!run5) return;
57664
+ deps.storage.resolveRunWatch(w.id, run5.id, run5.nodeId);
57665
+ const row = deps.storage.getPrWatch(w.id);
57666
+ if (row) resolved2.set(w.id, row);
57667
+ log3(`waker: run watcher ${w.id} found ${runTarget(w.owner, w.repo, run5.id)} for ${w.run_workflow} on ${shortCommit(w.run_sha)}`);
57668
+ } catch (err) {
57669
+ recordStatusFailure(key, err instanceof Error ? err.message : String(err), nowMs);
57670
+ }
57671
+ }));
57672
+ for (const w02 of armed) {
57673
+ const w = resolved2.get(w02.id) ?? w02;
57122
57674
  if (!isThreadLive(w.thread_slug)) continue;
57675
+ if (w.kind === "run") {
57676
+ if (w.number === 0 || !w.run_node_id) continue;
57677
+ const key2 = watchKey(w);
57678
+ if (nowMs - (prWatchPolledAt.get(key2) ?? 0) < PR_WATCH_POLL_MS) continue;
57679
+ refs.set(key2, { owner: w.owner, repo: w.repo, number: w.number, kind: "run", nodeId: w.run_node_id });
57680
+ continue;
57681
+ }
57123
57682
  const key = watchKey(w);
57124
57683
  const last = prWatchPolledAt.get(key) ?? 0;
57125
57684
  if (nowMs - last < PR_WATCH_POLL_MS) continue;
@@ -57128,9 +57687,28 @@ ${clock}`;
57128
57687
  const status = /* @__PURE__ */ new Map();
57129
57688
  const activity = /* @__PURE__ */ new Map();
57130
57689
  const issues = /* @__PURE__ */ new Map();
57690
+ const runs = /* @__PURE__ */ new Map();
57131
57691
  const meta = /* @__PURE__ */ new Map();
57132
57692
  await Promise.all([...refs].map(async ([key, ref]) => {
57133
57693
  prWatchPolledAt.set(key, nowMs);
57694
+ if (ref.kind === "run") {
57695
+ try {
57696
+ const result = normalizeReviewResult(await fetchGithubReview(ref));
57697
+ trackMissing(key, result, nowMs);
57698
+ if (result.status === "ok" && result.run) {
57699
+ runs.set(key, result.run);
57700
+ publishGithubRunStatus(deps.storage, runBookKey(ref.owner, ref.repo, ref.number), runReading(result.run, nowMs));
57701
+ recordReviewSuccess(key, "run-watch registry");
57702
+ } else if (result.status === "error") recordReviewFailure(key, "run-watch registry", result, nowMs);
57703
+ } catch (err) {
57704
+ prWatchMissingSince.delete(key);
57705
+ recordReviewFailure(key, "run-watch registry", {
57706
+ status: "error",
57707
+ failure: { kind: "network", message: err instanceof Error ? err.message : String(err) }
57708
+ }, nowMs);
57709
+ }
57710
+ return;
57711
+ }
57134
57712
  if (ref.kind === "issue") {
57135
57713
  try {
57136
57714
  const result = normalizeReviewResult(await fetchGithubReview(ref));
@@ -57183,7 +57761,8 @@ ${clock}`;
57183
57761
  recordStatusFailure(key, err instanceof Error ? err.message : String(err), nowMs);
57184
57762
  }
57185
57763
  }));
57186
- for (const w of armed) {
57764
+ for (const w02 of armed) {
57765
+ const w = resolved2.get(w02.id) ?? w02;
57187
57766
  const row = deps.storage.getSession(w.thread_slug);
57188
57767
  if (!row || row.state === "archived" || row.archived === 1) continue;
57189
57768
  const key = watchKey(w);
@@ -57192,12 +57771,16 @@ ${clock}`;
57192
57771
  deps.storage.settlePrWatch(w.id, nowMs);
57193
57772
  const waiting3 = undeliveredPrWatchReport(row.slug, w.id);
57194
57773
  if (waiting3) outbox.supersede(waiting3.id, nowMs, "replaced by the watcher's not-found report");
57195
- const kind = w.kind === "issue" ? "issue" : "pull";
57774
+ const kind = w.kind === "issue" ? "issue" : w.kind === "run" ? "run" : "pull";
57196
57775
  enqueuePrWatchWake(row, w.id, nextReport(readPrWatchCursor(w.cursor)), prWatchGoneWakeMessage(
57197
- `${w.owner}/${w.repo}#${w.number}`,
57776
+ watchRef(w),
57198
57777
  kind,
57199
57778
  Math.round(PR_WATCH_GONE_MS / 6e4)
57200
- ), `${kind === "issue" ? "issue" : "pr"}-watch ${key} not found`, nowMs);
57779
+ ), `${watchNoun(w)}-watch ${key} not found`, nowMs);
57780
+ continue;
57781
+ }
57782
+ if (w.kind === "run") {
57783
+ await evalRunWatch(row, w, runs.get(key), nowMs);
57201
57784
  continue;
57202
57785
  }
57203
57786
  if (w.kind === "issue") {
@@ -57418,6 +58001,185 @@ ${clock}`;
57418
58001
  }), `issue-watch ${target}${carried.changes?.length ? " state" : ""}${review ? " comment" : ""}`, nowMs);
57419
58002
  deps.storage.setPrWatchCursor(w.id, JSON.stringify({ ...nextCursor, report, held: carried }));
57420
58003
  }
58004
+ const RED_RUN_JOB = /* @__PURE__ */ new Set(["FAILURE", "CANCELLED", "TIMED_OUT", "STARTUP_FAILURE"]);
58005
+ const RUN_WAKE_JOB_CAP = 8;
58006
+ function readRunWatchCursor(raw2) {
58007
+ try {
58008
+ const c = raw2 ? JSON.parse(raw2) : null;
58009
+ if (!c || typeof c !== "object") return { report: 0, red: [], holds: [] };
58010
+ const h = c.held && typeof c.held === "object" ? c.held : void 0;
58011
+ const held = h && Number.isFinite(h.attempt) ? {
58012
+ attempt: Number(h.attempt),
58013
+ jobs: Array.isArray(h.jobs) ? h.jobs.filter((j10) => j10 && Number.isFinite(j10.id) && typeof j10.name === "string" && typeof j10.conclusion === "string") : [],
58014
+ running: Number(h.running) || 0,
58015
+ more: Number(h.more) || 0,
58016
+ holds: Array.isArray(h.holds) ? h.holds.filter((x) => x && typeof x.environment === "string" && Array.isArray(x.reviewers)) : [],
58017
+ ...h.end === true ? { end: true } : {}
58018
+ } : void 0;
58019
+ return {
58020
+ report: Number(c.report) || 0,
58021
+ ...Number.isFinite(c.attempt) ? { attempt: Number(c.attempt) } : {},
58022
+ red: Array.isArray(c.red) ? c.red.filter((x) => Number.isFinite(x)) : [],
58023
+ holds: Array.isArray(c.holds) ? c.holds.filter((x) => typeof x === "string") : [],
58024
+ ...Number.isFinite(c.attemptStart) || c.attemptStart === null ? { attemptStart: c.attemptStart } : {},
58025
+ ...typeof c.ended === "string" ? { ended: c.ended } : {},
58026
+ ...c.noRun === true ? { noRun: true } : {},
58027
+ ...held ? { held } : {}
58028
+ };
58029
+ } catch {
58030
+ return { report: 0, red: [], holds: [] };
58031
+ }
58032
+ }
58033
+ function runReading(snap, nowMs, attemptStartMs) {
58034
+ const status = snap.status === "COMPLETED" ? "completed" : snap.status === "IN_PROGRESS" ? "in_progress" : snap.status === "WAITING" ? "waiting" : "queued";
58035
+ return {
58036
+ status,
58037
+ ...status === "completed" && snap.conclusion ? { conclusion: snap.conclusion.toLowerCase() } : {},
58038
+ ...snap.workflow ? { workflow: snap.workflow } : {},
58039
+ ...snap.runNumber !== void 0 ? { runNumber: snap.runNumber } : {},
58040
+ ...snap.attempt !== void 0 ? { attempt: snap.attempt } : {},
58041
+ ...snap.url ? { url: snap.url } : {},
58042
+ ...snap.head ? { head: snap.head } : {},
58043
+ jobs: snap.jobTotal,
58044
+ done: snap.jobs.filter((j10) => j10.status === "COMPLETED").length,
58045
+ failing: snap.jobs.filter((j10) => isRedRunJob(j10) && ofThisAttempt(j10, attemptStartMs)).map((j10) => j10.name).slice(0, 8),
58046
+ held: snap.deployments.filter((d5) => d5.reviewers.length > 0).map((d5) => d5.environment).slice(0, 8),
58047
+ polledAt: new Date(nowMs).toISOString()
58048
+ };
58049
+ }
58050
+ function isRedRunJob(j10) {
58051
+ return j10.status === "COMPLETED" && RED_RUN_JOB.has((j10.conclusion ?? "").toUpperCase());
58052
+ }
58053
+ function ofThisAttempt(j10, attemptStartMs) {
58054
+ if (!attemptStartMs || !j10.startedAt) return true;
58055
+ const started = Date.parse(j10.startedAt);
58056
+ return !Number.isFinite(started) || started >= attemptStartMs;
58057
+ }
58058
+ const holdKey = (h) => String(h.environmentId ?? h.environment);
58059
+ async function namedRunJobs(w, jobs) {
58060
+ return await Promise.all(jobs.map(async (j10) => {
58061
+ const step = await fetchFailedStep(w.owner, w.repo, j10.id).catch(() => void 0);
58062
+ return { id: j10.id, name: j10.name, conclusion: (j10.conclusion ?? "failure").toLowerCase(), ...step ? { step } : {}, ...j10.url ? { url: j10.url } : {} };
58063
+ }));
58064
+ }
58065
+ async function evalRunWatch(row, w, snap, nowMs) {
58066
+ const cursor = readRunWatchCursor(w.cursor);
58067
+ const writeCursor = (next) => {
58068
+ if (JSON.stringify(next) !== JSON.stringify(cursor)) deps.storage.setPrWatchCursor(w.id, JSON.stringify(next));
58069
+ };
58070
+ if (w.number === 0) {
58071
+ if (cursor.noRun || nowMs - w.created_at < RUN_WATCH_NO_RUN_MS || !w.run_sha || !w.run_workflow) return;
58072
+ const report2 = nextReport(cursor);
58073
+ const target2 = runCommitTarget(w.owner, w.repo, w.run_sha);
58074
+ deps.storage.setSnoozedUntil(row.slug, null);
58075
+ enqueuePrWatchWake(row, w.id, report2, runWatchWakeMessage({
58076
+ target: target2,
58077
+ owner: w.owner,
58078
+ repo: w.repo,
58079
+ runId: 0,
58080
+ watchId: w.id,
58081
+ noRun: { workflow: w.run_workflow, sha: w.run_sha, minutes: Math.round(RUN_WATCH_NO_RUN_MS / 6e4) }
58082
+ }), `run-watch ${target2} no run`, nowMs);
58083
+ writeCursor({ ...cursor, report: report2, noRun: true });
58084
+ return;
58085
+ }
58086
+ if (!snap) return;
58087
+ const target = runTarget(w.owner, w.repo, w.number);
58088
+ const attempt = snap.attempt ?? 1;
58089
+ const completed = snap.status === "COMPLETED";
58090
+ const conclusion = completed ? snap.conclusion?.toLowerCase() : void 0;
58091
+ const restarted = cursor.attempt !== void 0 && (cursor.attempt !== attempt || cursor.ended !== void 0 && !completed);
58092
+ const base = restarted || cursor.attempt === void 0 ? { red: cursor.red, holds: [], ended: void 0 } : cursor;
58093
+ let attemptStart = cursor.attempt === attempt ? cursor.attemptStart : void 0;
58094
+ if (attempt > 1 && attemptStart === void 0) {
58095
+ const read = await fetchAttemptStart(w.owner, w.repo, w.number).catch(() => void 0);
58096
+ attemptStart = read && read.attempt === attempt ? read.startedAtMs : null;
58097
+ }
58098
+ if (attemptStart !== void 0) publishGithubRunStatus(deps.storage, runBookKey(w.owner, w.repo, w.number), runReading(snap, nowMs, attemptStart));
58099
+ let waiting2 = undeliveredPrWatchReport(row.slug, w.id);
58100
+ let held = waiting2 ? cursor.held : void 0;
58101
+ if (waiting2 && held && held.attempt !== attempt) {
58102
+ outbox.supersede(waiting2.id, nowMs, `it was about attempt ${held.attempt}, and the run is on attempt ${attempt}`);
58103
+ log3(`waker: retracted ${row.slug} \u2014 run-watch ${target} report on a replaced attempt`);
58104
+ waiting2 = void 0;
58105
+ held = void 0;
58106
+ }
58107
+ const redJobs = snap.jobs.filter((j10) => isRedRunJob(j10) && ofThisAttempt(j10, attemptStart));
58108
+ const seenRed = new Set(base.red);
58109
+ const newRed = completed ? [] : redJobs.filter((j10) => !seenRed.has(j10.id));
58110
+ const pendingHolds = completed ? [] : snap.deployments.filter((d5) => d5.reviewers.length > 0);
58111
+ const seenHolds = new Set(base.holds);
58112
+ const newHolds = pendingHolds.filter((d5) => !seenHolds.has(holdKey(d5)));
58113
+ const endStamp = conclusion ? `${attempt}:${conclusion}` : void 0;
58114
+ const stamps = {
58115
+ attempt,
58116
+ red: [.../* @__PURE__ */ new Set([...base.red, ...redJobs.map((j10) => j10.id)])],
58117
+ // Only what is pending NOW: an environment GitHub no longer lists is forgotten, so a second hold on it
58118
+ // (a deploy job, then a smoke job, both `environment: production`) wakes the worker again.
58119
+ holds: pendingHolds.map(holdKey),
58120
+ ...attemptStart !== void 0 ? { attemptStart } : {}
58121
+ };
58122
+ const common = { owner: w.owner, repo: w.repo, runId: w.number, watchId: w.id, ...snap.workflow ? { workflow: snap.workflow } : {}, ...snap.runNumber !== void 0 ? { runNumber: snap.runNumber } : {} };
58123
+ if (endStamp !== void 0 && base.ended !== endStamp) {
58124
+ const named = await namedRunJobs(w, redJobs.slice(0, RUN_WAKE_JOB_CAP));
58125
+ const green = runConclusionGreen(conclusion);
58126
+ if (green) deps.storage.settlePrWatch(w.id, nowMs);
58127
+ if (waiting2) outbox.supersede(waiting2.id, nowMs, `replaced by the watcher's end-of-run report`);
58128
+ deps.storage.setSnoozedUntil(row.slug, null);
58129
+ const report2 = nextReport(cursor);
58130
+ enqueuePrWatchWake(row, w.id, report2, runWatchWakeMessage({
58131
+ target,
58132
+ ...common,
58133
+ end: {
58134
+ conclusion,
58135
+ jobs: named,
58136
+ total: snap.jobTotal,
58137
+ more: redJobs.length - named.length,
58138
+ ...w.expires_at ? { expiresAt: new Date(w.expires_at).toISOString() } : {}
58139
+ }
58140
+ }), `run-watch ${target} ${conclusion}`, nowMs);
58141
+ writeCursor({ report: report2, ...stamps, holds: [], ended: endStamp, held: { attempt, jobs: [], running: 0, more: 0, holds: [], end: true } });
58142
+ return;
58143
+ }
58144
+ const pendingKeys = new Set(pendingHolds.map(holdKey));
58145
+ const stillHeld = (held?.holds ?? []).filter((h) => pendingKeys.has(holdKey(h)));
58146
+ const holdsGone = (held?.holds.length ?? 0) > stillHeld.length;
58147
+ const news = newRed.length > 0 || newHolds.length > 0;
58148
+ const nextBase = { report: cursor.report, ...stamps, ...base.ended ? { ended: base.ended } : {}, ...cursor.noRun ? { noRun: true } : {}, ...held ? { held } : {} };
58149
+ if (!news && !(waiting2 && held && holdsGone && !held.end)) {
58150
+ writeCursor(nextBase);
58151
+ return;
58152
+ }
58153
+ if (!news && waiting2 && held && held.jobs.length === 0 && stillHeld.length === 0) {
58154
+ outbox.supersede(waiting2.id, nowMs, "the environment it named is no longer waiting on a reviewer");
58155
+ log3(`waker: retracted ${row.slug} \u2014 run-watch ${target} hold no longer pending`);
58156
+ const { held: _gone, ...rest } = nextBase;
58157
+ writeCursor(rest);
58158
+ return;
58159
+ }
58160
+ const room = Math.max(0, RUN_WAKE_JOB_CAP - (held?.jobs.length ?? 0));
58161
+ const freshNamed = await namedRunJobs(w, newRed.slice(0, room));
58162
+ const carried = {
58163
+ attempt,
58164
+ jobs: [...held && !held.end ? held.jobs : [], ...freshNamed],
58165
+ running: snap.jobs.filter((j10) => j10.status !== "COMPLETED").length,
58166
+ more: (held && !held.end ? held.more : 0) + (newRed.length - freshNamed.length),
58167
+ holds: [
58168
+ ...held && !held.end ? stillHeld : [],
58169
+ ...newHolds.map((d5) => ({ environment: d5.environment, ...d5.environmentId !== void 0 ? { environmentId: d5.environmentId } : {}, reviewers: d5.reviewers, canApprove: d5.canApprove }))
58170
+ ]
58171
+ };
58172
+ if (news) deps.storage.setSnoozedUntil(row.slug, null);
58173
+ const report = nextReport(cursor);
58174
+ if (waiting2) outbox.supersede(waiting2.id, nowMs, `folded into report ${report}, which says this and everything since`);
58175
+ enqueuePrWatchWake(row, w.id, report, runWatchWakeMessage({
58176
+ target,
58177
+ ...common,
58178
+ ...carried.jobs.length ? { jobsFailed: { jobs: carried.jobs, running: carried.running, more: carried.more } } : {},
58179
+ ...carried.holds.length ? { holds: carried.holds } : {}
58180
+ }), `run-watch ${target}${carried.jobs.length ? " jobs red" : ""}${carried.holds.length ? " held" : ""}`, nowMs);
58181
+ writeCursor({ ...nextBase, report, held: carried });
58182
+ }
57421
58183
  function trackMissing(key, result, nowMs) {
57422
58184
  if (result.status === "error" && result.failure.kind === "not-found") {
57423
58185
  if (!prWatchMissingSince.has(key)) prWatchMissingSince.set(key, nowMs);
@@ -58482,6 +59244,7 @@ var init_scheduler = __esm({
58482
59244
  init_completion_relay();
58483
59245
  init_github_review();
58484
59246
  init_pr_watch_noise();
59247
+ init_github_run();
58485
59248
  init_github_credential();
58486
59249
  init_github_review();
58487
59250
  init_logging();
@@ -58547,6 +59310,7 @@ var init_scheduler = __esm({
58547
59310
  timer: "timers",
58548
59311
  pr: "prs",
58549
59312
  issue: "issues",
59313
+ run: "runs",
58550
59314
  command: "monitors",
58551
59315
  thread: "threads"
58552
59316
  };
@@ -100357,6 +101121,7 @@ ${wakeDeliveryToken(deliveryId)}`;
100357
101121
  scheduler,
100358
101122
  probePr: probePrReadable,
100359
101123
  probeIssue: probeIssueReadable,
101124
+ probeRun: probeRunReadable,
100360
101125
  commandWatches,
100361
101126
  stopSubscriptions,
100362
101127
  endWithContext: (end) => {
@@ -100408,6 +101173,7 @@ var init_context = __esm({
100408
101173
  init_tailer();
100409
101174
  init_dispatch();
100410
101175
  init_scheduler();
101176
+ init_github_run();
100411
101177
  init_resume();
100412
101178
  init_claude();
100413
101179
  init_codex();
@@ -105852,10 +106618,110 @@ ${gapNote}` : input.message;
105852
106618
  function armedCommandWatchViews(slug) {
105853
106619
  return ctx.storage.listCommandWatches(slug, { armedOnly: true }).map(commandWatchView);
105854
106620
  }
106621
+ async function addOwnRunWatch(input) {
106622
+ const ref = parseRunRef(input.target);
106623
+ if (!ref) {
106624
+ throw new RpcRefusal(`\`${input.target}\` is not a workflow run I can watch \u2014 give owner/repo/actions/runs/123, a run URL, or owner/repo@<sha> with --workflow <file or name>`);
106625
+ }
106626
+ if (isRunIdRef(ref) && input.workflow) {
106627
+ throw new RpcRefusal(`\`--workflow\` goes with a commit target (owner/repo@<sha>); \`${input.target}\` already names its run, so drop \`--workflow\``);
106628
+ }
106629
+ if (!isRunIdRef(ref) && !input.workflow) {
106630
+ throw new RpcRefusal(`\`${input.target}\` names a commit, which several workflows run on \u2014 say which with \`--workflow <file or name>\` (e.g. \`--workflow test.yml\`)`);
106631
+ }
106632
+ if (input.for === void 0) throw new RpcRefusal("`--for` is required \u2014 a duration like `30m`, `6h` or `3d` (max 30d)");
106633
+ const asked = parseAwaitingDurationRaw(input.for);
106634
+ if (asked === null) throw new RpcRefusal(`\`for: ${input.for}\` is not a duration \u2014 give one like \`30m\`, \`6h\` or \`3d\` (max 30d)`);
106635
+ const forMs = Math.min(asked, RUN_WATCH_FOR_MAX_MS);
106636
+ const clampedFrom = asked > RUN_WATCH_FOR_MAX_MS ? { clampedFrom: input.for } : {};
106637
+ const armed = ctx.storage.listPrWatches(input.slug, { armedOnly: true });
106638
+ const sameName = (a, b) => a.toLowerCase() === b.toLowerCase();
106639
+ const findExisting = (runId, sha, workflow) => armed.find((w) => w.kind === "run" && sameName(w.owner, ref.owner) && sameName(w.repo, ref.repo) && (runId !== void 0 && w.number === runId || sha !== void 0 && workflow !== void 0 && !!w.run_sha && w.run_sha.startsWith(sha.toLowerCase()) && sameName(w.run_workflow ?? "", workflowFileName(workflow))));
106640
+ const answer = (w, alreadyArmed, extra = {}) => ({
106641
+ id: w.id,
106642
+ target: w.number > 0 ? runTarget(w.owner, w.repo, w.number) : runCommitTarget(w.owner, w.repo, w.run_sha ?? ""),
106643
+ alreadyArmed,
106644
+ expiresAt: new Date(w.expires_at ?? Date.now()).toISOString(),
106645
+ ...extra,
106646
+ watches: armedPrWatchViews(input.slug)
106647
+ });
106648
+ const early = isRunIdRef(ref) ? findExisting(ref.runId, void 0, void 0) : findExisting(void 0, ref.sha, input.workflow);
106649
+ if (early) return answer(early, true);
106650
+ if (armed.length >= PR_WATCH_MAX_ARMED) {
106651
+ throw new RpcRefusal(`this thread already watches ${armed.length} pull requests, issues and runs (the limit is ${PR_WATCH_MAX_ARMED}) \u2014 drop one first`);
106652
+ }
106653
+ const probe = await ctx.probeRun(ref, input.workflow);
106654
+ if (!probe.ok) {
106655
+ throw new RpcRefusal(
106656
+ `\`${input.target}\` cannot be watched as a workflow run \u2014 Frizz could not read it: ${probe.reason}. Frizz polls with its OWN read-only GitHub sign-in (Settings \u2192 GitHub), not yours or the \`gh\` CLI's, so a private repo is readable only where that sign-in can see it. Check that, and that the run exists, then register again. If GitHub itself was briefly down, registering again in a minute is enough.`
106657
+ );
106658
+ }
106659
+ const run5 = probe.run;
106660
+ const late2 = run5 ? findExisting(run5.id, probe.sha, probe.workflow) : probe.sha ? findExisting(void 0, probe.sha, probe.workflow) : void 0;
106661
+ if (late2) return answer(late2, true);
106662
+ const conclusion = run5?.status === "completed" ? run5.conclusion?.toLowerCase() : void 0;
106663
+ if (run5 && (conclusion === "success" || conclusion === "neutral" || conclusion === "skipped")) {
106664
+ throw new RpcRefusal(`${runTarget(ref.owner, ref.repo, run5.id)}${run5.name ? ` (${run5.name}${run5.runNumber ? ` #${run5.runNumber}` : ""})` : ""} already passed \u2014 there is nothing left to wait for, so no watcher was armed`);
106665
+ }
106666
+ const now = Date.now();
106667
+ const id2 = `rnw_${randomUUID26().replace(/-/g, "").slice(0, 12)}`;
106668
+ ctx.storage.clearThreadDone(input.slug);
106669
+ ctx.storage.armPrWatch({
106670
+ id: id2,
106671
+ slug: input.slug,
106672
+ kind: "run",
106673
+ owner: ref.owner,
106674
+ repo: ref.repo,
106675
+ number: run5?.id ?? 0,
106676
+ createdAtMs: now,
106677
+ expiresAtMs: now + forMs,
106678
+ runSha: probe.sha ?? null,
106679
+ runWorkflow: probe.workflow ?? null,
106680
+ runNodeId: run5?.nodeId ?? null,
106681
+ // A run that already ENDED RED was just told in this answer: its end is recorded as said, so the
106682
+ // first poll does not wake the worker to say it again. A re-run starts a new attempt and is followed.
106683
+ ...run5 && conclusion ? { cursor: JSON.stringify({ report: 0, attempt: run5.attempt ?? 1, red: [], holds: [], ended: `${run5.attempt ?? 1}:${conclusion}` }) } : {}
106684
+ });
106685
+ if (run5) publishGithubRunStatus(ctx.storage, runBookKey(ref.owner, ref.repo, run5.id), restRunReading(run5, now));
106686
+ ctx.board.refresh();
106687
+ const row = ctx.storage.getPrWatch(id2);
106688
+ return answer(row, false, clampedFrom);
106689
+ }
106690
+ function restRunReading(run5, nowMs) {
106691
+ const status = run5.status === "completed" ? "completed" : run5.status === "in_progress" ? "in_progress" : run5.status === "waiting" ? "waiting" : "queued";
106692
+ return {
106693
+ status,
106694
+ ...status === "completed" && run5.conclusion ? { conclusion: run5.conclusion.toLowerCase() } : {},
106695
+ ...run5.name ? { workflow: run5.name } : {},
106696
+ ...run5.runNumber !== void 0 ? { runNumber: run5.runNumber } : {},
106697
+ ...run5.attempt !== void 0 ? { attempt: run5.attempt } : {},
106698
+ ...run5.url ? { url: run5.url } : {},
106699
+ ...run5.head ? { head: run5.head } : {},
106700
+ jobs: 0,
106701
+ done: 0,
106702
+ failing: [],
106703
+ held: [],
106704
+ polledAt: new Date(nowMs).toISOString()
106705
+ };
106706
+ }
105855
106707
  function armedPrWatchViews(slug) {
105856
106708
  const github = readGithubStatusBook(ctx.storage.getSetting(GITHUB_STATUS_SETTING));
105857
106709
  const issues = readGithubIssueStatusBook(ctx.storage.getSetting(GITHUB_ISSUE_STATUS_SETTING));
106710
+ const runs = readGithubRunStatusBook(ctx.storage.getSetting(GITHUB_RUN_STATUS_SETTING));
105858
106711
  return ctx.storage.listPrWatches(slug, { armedOnly: true }).map((w) => {
106712
+ if (w.kind === "run") {
106713
+ const reading = w.number > 0 ? runs[runBookKey(w.owner, w.repo, w.number)] : void 0;
106714
+ return {
106715
+ id: w.id,
106716
+ target: w.number > 0 ? runTarget(w.owner, w.repo, w.number) : runCommitTarget(w.owner, w.repo, w.run_sha ?? ""),
106717
+ kind: "run",
106718
+ state: w.state,
106719
+ createdAt: new Date(w.created_at).toISOString(),
106720
+ ...w.expires_at ? { expiresAt: new Date(w.expires_at).toISOString() } : {},
106721
+ ...reading ? { run: reading } : {},
106722
+ ...w.run_workflow ? { workflow: w.run_workflow } : {}
106723
+ };
106724
+ }
105859
106725
  const target = `${w.owner}/${w.repo}#${w.number}`;
105860
106726
  const kind = w.kind === "issue" ? "issue" : "pull";
105861
106727
  return {
@@ -105864,6 +106730,7 @@ ${gapNote}` : input.message;
105864
106730
  kind,
105865
106731
  state: w.state,
105866
106732
  createdAt: new Date(w.created_at).toISOString(),
106733
+ ...w.expires_at ? { expiresAt: new Date(w.expires_at).toISOString() } : {},
105867
106734
  ...kind === "pull" && github[target] ? { github: github[target] } : {},
105868
106735
  ...kind === "issue" && issues[target] ? { issue: issues[target] } : {}
105869
106736
  };
@@ -107569,6 +108436,17 @@ ${gapNote}` : input.message;
107569
108436
  });
107570
108437
  }
107571
108438
  for (const w of ctx.storage.listPrWatches(input.slug, { armedOnly: true })) {
108439
+ if (w.kind === "run") {
108440
+ const id2 = w.number > 0 ? runTarget(w.owner, w.repo, w.number) : runCommitTarget(w.owner, w.repo, w.run_sha ?? "");
108441
+ activity.push({
108442
+ kind: "run",
108443
+ id: id2,
108444
+ label: w.run_workflow ? `${w.run_workflow} on ${runCommitTarget(w.owner, w.repo, w.run_sha ?? "")} (${w.id})` : `${id2} (${w.id})`,
108445
+ since: new Date(w.created_at).toISOString(),
108446
+ ...w.expires_at ? { until: new Date(w.expires_at).toISOString() } : {}
108447
+ });
108448
+ continue;
108449
+ }
107572
108450
  activity.push({
107573
108451
  kind: w.kind === "issue" ? "issue" : "pr",
107574
108452
  id: `${w.owner}/${w.repo}#${w.number}`,
@@ -107724,6 +108602,7 @@ ${gapNote}` : input.message;
107724
108602
  if (row.state === "archived" || row.archived === 1) {
107725
108603
  throw new RpcRefusal("Reopen this thread before registering a watcher on it");
107726
108604
  }
108605
+ if (input.kind === "run") return await addOwnRunWatch(input);
107727
108606
  const kind = input.kind ?? "pull";
107728
108607
  const noun = kind === "issue" ? "issue" : "pull request";
107729
108608
  const ref = kind === "issue" ? parseIssueRef(input.target) : parsePrRef(input.target);
@@ -108256,7 +109135,7 @@ Say which way you went and why in your write-up, so the human can course-correct
108256
109135
  id: w.id,
108257
109136
  what: `${w.kind === "agent" ? "sub-agent" : "shell"}: ${w.label ? `${w.label} (${w.target})` : w.target}`
108258
109137
  })),
108259
- ...armedPrWatchViews(input.slug).map((w) => ({ id: w.id, what: `${w.kind === "issue" ? "issue" : "pull request"}: ${w.target}` })),
109138
+ ...armedPrWatchViews(input.slug).map((w) => ({ id: w.id, what: `${w.kind === "issue" ? "issue" : w.kind === "run" ? "workflow run" : "pull request"}: ${w.target}` })),
108260
109139
  ...ctx.storage.listThreadTimers(input.slug, { armedOnly: true }).map((t) => ({ id: t.id, what: `timer, fires ${new Date(t.fire_at).toISOString()}` })),
108261
109140
  ...ctx.storage.listCommandWatches(input.slug, { armedOnly: true }).map((w) => ({ id: w.id, what: `monitor: ${w.command.trim().replace(/\s+/g, " ").slice(0, 120)}` }))
108262
109141
  ];
@@ -109254,6 +110133,7 @@ var init_router5 = __esm({
109254
110133
  init_thread_profiles();
109255
110134
  init_adoption_recovery();
109256
110135
  init_awaiting();
110136
+ init_github_run();
109257
110137
  init_storage();
109258
110138
  init_question_fences();
109259
110139
  init_child_threads();