@coreplane/switchboard 1.244.0 → 1.246.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/assets/config/config.example.yaml +6 -3
  2. package/dist/assets/deploy/cloudflare/worker.ts +2 -0
  3. package/dist/assets/deploy/cloudflare-resident/threadErr.ts +337 -0
  4. package/dist/assets/deploy/cloudflare-resident/tsconfig.json +1 -1
  5. package/dist/assets/deploy/cloudflare-resident/worker.ts +40 -272
  6. package/dist/assets/deploy/cloudflare-sandbox/worker.ts +22 -11
  7. package/dist/assets/deploy/secrets.manifest.json +12 -0
  8. package/dist/assets/package-lock.json +3 -3
  9. package/dist/assets/package.json +1 -1
  10. package/dist/assets/source.json +3 -3
  11. package/dist/assets/src/agents/registry.ts +34 -10
  12. package/dist/assets/src/config/profile.ts +17 -1
  13. package/dist/assets/src/core/authz/types.ts +8 -0
  14. package/dist/assets/src/core/budgets.ts +43 -0
  15. package/dist/assets/src/core/coordinator/contract.ts +29 -4
  16. package/dist/assets/src/core/coordinator/driver.ts +7 -1
  17. package/dist/assets/src/core/reviewVerdict.ts +239 -30
  18. package/dist/assets/src/core/runEvents.ts +55 -2
  19. package/dist/assets/src/core/runRecord.ts +56 -0
  20. package/dist/assets/src/core/ship/coordinator.ts +48 -23
  21. package/dist/assets/src/core/ship/renewal.ts +10 -3
  22. package/dist/assets/src/execution/bashTimeout.ts +46 -2
  23. package/dist/assets/src/execution/residentRefresh.ts +34 -11
  24. package/dist/assets/src/execution/sandboxErrors.ts +9 -4
  25. package/dist/assets/web/dist/.vite/manifest.json +481 -462
  26. package/dist/assets/web/dist/assets/AppShell-B4EUiSwP.js +1 -0
  27. package/dist/assets/web/dist/assets/CostsPage-D8VjAtuH.js +2 -0
  28. package/dist/assets/web/dist/assets/DeliveryPage-DpQi5XUI.js +1 -0
  29. package/dist/assets/web/dist/assets/HomePage-CvKuIGqg.js +2 -0
  30. package/dist/assets/web/dist/assets/InputMenu-DmqAxkn4.js +1 -0
  31. package/dist/assets/web/dist/assets/NotFoundPage-DDogyiXA.js +1 -0
  32. package/dist/assets/web/dist/assets/PendingTurnRow-BoSLlR6j.js +1 -0
  33. package/dist/assets/web/dist/assets/ResidentDetailPage-CiBdbzkE.js +1 -0
  34. package/dist/assets/web/dist/assets/ResidentsIndexPage-DgtHtd9K.js +1 -0
  35. package/dist/assets/web/dist/assets/{RunFoldRow-BPMQxTcl.js → RunFoldRow-IF4xbz-3.js} +1 -1
  36. package/dist/assets/web/dist/assets/RunRoutePage-DHYa7rHK.js +9 -0
  37. package/dist/assets/web/dist/assets/RunsIndexPage-aWhNTv8r.js +1 -0
  38. package/dist/assets/web/dist/assets/RunsTabs-CY_tdGTU.js +1 -0
  39. package/dist/assets/web/dist/assets/ScheduledPage-gPEBZjcx.js +1 -0
  40. package/dist/assets/web/dist/assets/SettingSelect-VDanrTZi.js +1 -0
  41. package/dist/assets/web/dist/assets/SettingsPage-CFoltSRD.js +1 -0
  42. package/dist/assets/web/dist/assets/StatusDot-DA3eTVrT.js +1 -0
  43. package/dist/assets/web/dist/assets/Tooltip-BgbCkM12.js +1 -0
  44. package/dist/assets/web/dist/assets/UnitRoutePage-DibegaJJ.js +1 -0
  45. package/dist/assets/web/dist/assets/{angular-html-Dail07rr.js → angular-html-D_3slZqf.js} +1 -1
  46. package/dist/assets/web/dist/assets/{angular-ts-BReExio8.js → angular-ts-D1Fv2cpN.js} +1 -1
  47. package/dist/assets/web/dist/assets/{apl-DhNO6Yyx.js → apl-60Nm_trN.js} +1 -1
  48. package/dist/assets/web/dist/assets/{astro-BYotTY4C.js → astro-CvyaM3Q9.js} +1 -1
  49. package/dist/assets/web/dist/assets/{blade-mUxTtD1X.js → blade-yan3VBls.js} +1 -1
  50. package/dist/assets/web/dist/assets/{c-DhuiwcSQ.js → c-Ddgepap2.js} +1 -1
  51. package/dist/assets/web/dist/assets/{chapel-GD2vFtRi.js → chapel-CgNY6dxC.js} +1 -1
  52. package/dist/assets/web/dist/assets/{cobol-BhFDwkes.js → cobol-C7q82cdP.js} +1 -1
  53. package/dist/assets/web/dist/assets/{coffee-DWUgbE0r.js → coffee-DgRMF_ni.js} +1 -1
  54. package/dist/assets/web/dist/assets/{cpp-CO9XFjGW.js → cpp-B8Lf-aeo.js} +1 -1
  55. package/dist/assets/web/dist/assets/{crystal-B9pVurpn.js → crystal-CkA_dhEO.js} +1 -1
  56. package/dist/assets/web/dist/assets/{css-CFVVV6lI.js → css-Cyu-C_oA.js} +1 -1
  57. package/dist/assets/web/dist/assets/{dist-BtPs2AkQ.js → dist-DS-gMjLZ.js} +2 -2
  58. package/dist/assets/web/dist/assets/{durationTone-BobbycC-.js → durationTone-l6aVrHb8.js} +1 -1
  59. package/dist/assets/web/dist/assets/{edge-BDhIDQIb.js → edge-BxV3rKNI.js} +1 -1
  60. package/dist/assets/web/dist/assets/{elixir-DG3J8WoD.js → elixir-pNSEK39d.js} +1 -1
  61. package/dist/assets/web/dist/assets/{elm-FiOdiaOE.js → elm-zgwWE33W.js} +1 -1
  62. package/dist/assets/web/dist/assets/{erb-vxbtW503.js → erb-yzcYAHp_.js} +1 -1
  63. package/dist/assets/web/dist/assets/{eventSource-tRprhqm7.js → eventSource-Ce94ho6M.js} +1 -1
  64. package/dist/assets/web/dist/assets/{git-rebase-DINz8M3H.js → git-rebase-Dg7Ous1-.js} +1 -1
  65. package/dist/assets/web/dist/assets/{glimmer-js-yann6r9i.js → glimmer-js-CbZEwX27.js} +1 -1
  66. package/dist/assets/web/dist/assets/{glimmer-ts-CXTbrZn_.js → glimmer-ts-D3NIqALy.js} +1 -1
  67. package/dist/assets/web/dist/assets/{glsl-DNYC-hq0.js → glsl-y4-3WrI2.js} +1 -1
  68. package/dist/assets/web/dist/assets/{graphql-CwzhHzi9.js → graphql-D5d0al7K.js} +1 -1
  69. package/dist/assets/web/dist/assets/{hack-BBXF1cwR.js → hack-D8fD6kEl.js} +1 -1
  70. package/dist/assets/web/dist/assets/{haml-oEqBcsTy.js → haml-BWeFFc-V.js} +1 -1
  71. package/dist/assets/web/dist/assets/{handlebars-YE5thkT1.js → handlebars-gIm5FeE_.js} +1 -1
  72. package/dist/assets/web/dist/assets/{html-derivative-DCT1GYtQ.js → html-derivative-B3ySSBrQ.js} +1 -1
  73. package/dist/assets/web/dist/assets/{html-Dp4jRQ1j.js → html-fXJTVLSM.js} +1 -1
  74. package/dist/assets/web/dist/assets/{http-BPcGbmzJ.js → http-DrJfQUmw.js} +1 -1
  75. package/dist/assets/web/dist/assets/{hurl-CQnNHwyd.js → hurl-Bvbnsf55.js} +1 -1
  76. package/dist/assets/web/dist/assets/{java-Dm8Ovj6W.js → java-CUSpb-i-.js} +1 -1
  77. package/dist/assets/web/dist/assets/{javascript-Btm9oJK9.js → javascript-BWRH5fbY.js} +1 -1
  78. package/dist/assets/web/dist/assets/{jinja-VZYjWF_U.js → jinja-D3Ymci8y.js} +1 -1
  79. package/dist/assets/web/dist/assets/{jison-Dcmjxa9x.js → jison-Gt9SO7ZC.js} +1 -1
  80. package/dist/assets/web/dist/assets/{json-DoWiOGZ8.js → json-Cfcblhgn.js} +1 -1
  81. package/dist/assets/web/dist/assets/{jsx-Dvmo55ma.js → jsx-C0366fFM.js} +1 -1
  82. package/dist/assets/web/dist/assets/{julia-d8AtfV26.js → julia-CyBOTbxS.js} +1 -1
  83. package/dist/assets/web/dist/assets/{just-Cc5EStA-.js → just-FPXZcIOd.js} +1 -1
  84. package/dist/assets/web/dist/assets/{latex-B5fKKIH7.js → latex-Bd-c88v0.js} +1 -1
  85. package/dist/assets/web/dist/assets/{liquid-DUYI9JND.js → liquid-5tu9Hc0k.js} +1 -1
  86. package/dist/assets/web/dist/assets/{lua-BhMwKWpw.js → lua-BZ5fdPP8.js} +1 -1
  87. package/dist/assets/web/dist/assets/main-B4A6x82d.js +28 -0
  88. package/dist/assets/web/dist/assets/main-CpkwzHX6.css +1 -0
  89. package/dist/assets/web/dist/assets/{marko-Cnf2cPAi.js → marko-C_mmj4p0.js} +1 -1
  90. package/dist/assets/web/dist/assets/{mdc-FDDXoir9.js → mdc-CtaNqWjY.js} +1 -1
  91. package/dist/assets/web/dist/assets/{nginx-q-8U_1jR.js → nginx-Ddm5Mb8J.js} +1 -1
  92. package/dist/assets/web/dist/assets/{nim-DIA0TUWs.js → nim-COhfroYB.js} +1 -1
  93. package/dist/assets/web/dist/assets/{org-CR88hy7S.js → org-CCHFgmTb.js} +1 -1
  94. package/dist/assets/web/dist/assets/{perl-Bkd8N7ja.js → perl-CXzOE-Z-.js} +1 -1
  95. package/dist/assets/web/dist/assets/{php-BOs84mvy.js → php-1V6jAIhU.js} +1 -1
  96. package/dist/assets/web/dist/assets/{pug-BbpZBb3w.js → pug-uS37efts.js} +1 -1
  97. package/dist/assets/web/dist/assets/{qml-D2jQpjFE.js → qml-Bj1A0Ben.js} +1 -1
  98. package/dist/assets/web/dist/assets/{r-DKzcAQ22.js → r-CMbKbLsS.js} +1 -1
  99. package/dist/assets/web/dist/assets/{razor-SOQMWcC9.js → razor-DVRq_Ndk.js} +1 -1
  100. package/dist/assets/web/dist/assets/{regexp-B6KK4W8d.js → regexp-AbaOr4oB.js} +1 -1
  101. package/dist/assets/web/dist/assets/{rst-kPSg-NPf.js → rst-Dq_QWgOF.js} +1 -1
  102. package/dist/assets/web/dist/assets/{ruby-cKS-JYLH.js → ruby-CVSsAj7T.js} +1 -1
  103. package/dist/assets/web/dist/assets/{sas-DNxzE5gs.js → sas-C-dGfxUi.js} +1 -1
  104. package/dist/assets/web/dist/assets/{scss-DGcHQ5OO.js → scss-DxALxYPA.js} +1 -1
  105. package/dist/assets/web/dist/assets/seed-BhxEVasY.js +6 -0
  106. package/dist/assets/web/dist/assets/{settingsApi-priOPiwu.js → settingsApi-Dm6eaQcu.js} +1 -1
  107. package/dist/assets/web/dist/assets/{shellscript-CRZeZBa5.js → shellscript--qXcvQ5L.js} +1 -1
  108. package/dist/assets/web/dist/assets/{shellsession-DSNEL0HX.js → shellsession-DeqnW8Ux.js} +1 -1
  109. package/dist/assets/web/dist/assets/{soy-zisNbkDO.js → soy-DreoUIMt.js} +1 -1
  110. package/dist/assets/web/dist/assets/{sql-MG06KMMb.js → sql-o3i2VTG6.js} +1 -1
  111. package/dist/assets/web/dist/assets/{sseReplay-DaRtc7nI.js → sseReplay-qF-gpbAY.js} +3 -3
  112. package/dist/assets/web/dist/assets/{stata-CB_wKwv9.js → stata-CGAT41H7.js} +1 -1
  113. package/dist/assets/web/dist/assets/{surrealql-DYdSt7re.js → surrealql-CBU0QuGV.js} +1 -1
  114. package/dist/assets/web/dist/assets/{svelte-DHO-F7c7.js → svelte-CfHaLZiG.js} +1 -1
  115. package/dist/assets/web/dist/assets/{templ-CUL5L4Lr.js → templ-D02MUcma.js} +1 -1
  116. package/dist/assets/web/dist/assets/{tex-_JNEKjVW.js → tex-DjprHYXl.js} +1 -1
  117. package/dist/assets/web/dist/assets/{ts-tags--9EpEV_8.js → ts-tags-DftDOzP-.js} +1 -1
  118. package/dist/assets/web/dist/assets/{tsx-BcNq2x2u.js → tsx-BOdvPohJ.js} +1 -1
  119. package/dist/assets/web/dist/assets/{twig-EsY5Dk_D.js → twig-B_yLS56B.js} +1 -1
  120. package/dist/assets/web/dist/assets/{typescript-CyA_HiUH.js → typescript-CdPCa4nU.js} +1 -1
  121. package/dist/assets/web/dist/assets/{typst-SzaHlDt4.js → typst-C1oIFsUl.js} +1 -1
  122. package/dist/assets/web/dist/assets/{vue-D3cn5acV.js → vue-CcszJEX8.js} +1 -1
  123. package/dist/assets/web/dist/assets/{vue-html-6MxhUxOa.js → vue-html-DcpxPcuT.js} +1 -1
  124. package/dist/assets/web/dist/assets/{vue-vine-qJnqhgo9.js → vue-vine-D26bIKGj.js} +1 -1
  125. package/dist/assets/web/dist/assets/wallClock-DPTuP2FD.js +1 -0
  126. package/dist/assets/web/dist/assets/{xml-DyRpC7xv.js → xml-D8zl6W5P.js} +1 -1
  127. package/dist/assets/web/dist/assets/{xsl-BXMRPAsg.js → xsl-D86Bii28.js} +1 -1
  128. package/dist/assets/web/dist/assets/{yaml-BNmPCtAN.js → yaml-g6Px4KFU.js} +1 -1
  129. package/dist/cli.js +3023 -1049
  130. package/package.json +1 -1
  131. package/dist/assets/web/dist/assets/AppShell-Ck4hSZDi.js +0 -1
  132. package/dist/assets/web/dist/assets/CostsPage-DvhjDMka.js +0 -2
  133. package/dist/assets/web/dist/assets/DeliveryPage-DBlI_Yq2.js +0 -1
  134. package/dist/assets/web/dist/assets/HomePage-XFWPxDiJ.js +0 -2
  135. package/dist/assets/web/dist/assets/NotFoundPage-CiGrVOyv.js +0 -1
  136. package/dist/assets/web/dist/assets/PendingTurnRow-BHCSpsPf.js +0 -1
  137. package/dist/assets/web/dist/assets/ResidentDetailPage-C5USV_8P.js +0 -1
  138. package/dist/assets/web/dist/assets/ResidentsIndexPage-CSKisWnX.js +0 -1
  139. package/dist/assets/web/dist/assets/RunRoutePage-CZe9Yodw.js +0 -9
  140. package/dist/assets/web/dist/assets/RunsIndexPage-BfA333Qy.js +0 -1
  141. package/dist/assets/web/dist/assets/RunsTabs-BWRHzhtT.js +0 -1
  142. package/dist/assets/web/dist/assets/ScheduledPage-DBaChcJZ.js +0 -1
  143. package/dist/assets/web/dist/assets/SettingsPage-CqVi9-Ac.js +0 -1
  144. package/dist/assets/web/dist/assets/StatusDot-_Q_bmReh.js +0 -1
  145. package/dist/assets/web/dist/assets/Tooltip-Cafsgd4m.js +0 -1
  146. package/dist/assets/web/dist/assets/UnitRoutePage-CdoBZwtf.js +0 -1
  147. package/dist/assets/web/dist/assets/main-C4366PZF.css +0 -1
  148. package/dist/assets/web/dist/assets/main-DlTNAC6c.js +0 -28
  149. package/dist/assets/web/dist/assets/seed-DeKSHrt2.js +0 -6
  150. package/dist/assets/web/dist/assets/wallClock-61NpVkY6.js +0 -1
@@ -145,7 +145,7 @@ export function statusCardRule(examples = '"Implement the fix", "Run the test su
145
145
 
146
146
  const PR_DESCRIPTION_TEMPLATE = `PR description — submit it with the submit_pr_description tool for EVERY PR (this is the default, not something to wait to be asked for). Switchboard renders the GitHub body from the object you submit, so never author PR-body markdown yourself. Before submitting, judge your title with the ${PR_TITLE_GUARD} gate — \`npm run check:pr-title -- "<title>"\` — and submit only a title it accepts; the same gate refuses the PR in CI. The body is a fixed-size MAP for the reader with everything for agents collapsed under it; every field is capped in visible characters (a link's URL is not counted) and the tool refuses an object over a cap naming the field and the count — cut and resubmit. Prose is unwrapped — no hard line breaks inside a paragraph. Always hyperlink the triggering issue/request. Never fabricate validation — state exactly what you ran and the real result. BEFORE authoring the pointers, load the \`pr-description\` skill with use_skill — it defines how to choose at most seven pointers, the mechanical anchor rules and what goes below the fold; follow it for every PR.
147
147
  EVERY PR includes one that already exists when you push — opened by a person, by dependabot, or by an earlier run. After EVERY push to such a PR: read its current title and body (\`github_issue_get\` with the PR number works for pull requests; \`gh pr view\` where gh exists), judge them against the change as it now stands at the pushed head, and submit the object that describes the PR as it is NOW — carry forward what the existing body says that is still true (a dependency bump's release notes belong in why), add what you changed, and anchor the pointers at the new head. Switchboard replaces the PR's title and body with your rendering. A description that describes an earlier state of its branch is a bug; "it is someone else's PR" is never a reason to leave it.
148
- - **title**: the PR title — one line naming the change, specific enough to pick out of a PR list.
148
+ - **title** (≤72 characters in all): the changelog line — \`type(scope): what a reader can now do or expect\`, one change, one clause, present tense. The type and the scope spend the same budget as the description, so the description is short; the body carries the rest. The tool refuses a longer title naming the count, and so does the gate in CI.
149
149
  - **TL;DR** (\`tldr\`, rendered first, ≤300): two sentences for a reader with zero context — what this PR does and why it matters.
150
150
  - **Why** (\`why\`, ≤400): the problem and the motivation, with the triggering issue/request, the record and the stack position hyperlinked. Why, never what: the diff shows what.
151
151
  - **Where to look** (\`pointers\`, 1 to 7): the files a reviewer would open first, in reading order, each { label ≤60, text ≤160, optional risk ≤100, anchor } with the anchor a { path, from, to } line range at your pushed head, rendered as a link (never embedded code). One pointer per idea, never per file; when the change has more ideas than seven, keep the seven whose mistake would cost most.
@@ -209,6 +209,14 @@ Text stays in your message; do not attach what you can say.`;
209
209
  // belongs in the agent's notes for the thread, and why — the one thing sure to
210
210
  // survive a compaction and reach the next run there — beside the reach `recall`
211
211
  // gives into every earlier turn. Said once so the prompts cannot drift on it.
212
+ /** The one rule every preset carries about the length of what it says: the
213
+ * answer is read in a chat thread, so it leads with the outcome and stops
214
+ * when the outcome is said. Spelled the same in every prompt; the registry
215
+ * test pins it. A review's verdict and findings are rendered by code from the
216
+ * typed verdict, so there the rule governs the write-up alone. */
217
+ export const BREVITY_RULE =
218
+ "SAY LESS. Your answer is read in a chat thread, often on a phone: lead with the answer or the outcome in one sentence, then only what the reader needs to act on it. Never restate the question or recap what was asked, never describe your method or list what you checked (that is your notes' job), never list options you are not recommending, never end with an offer or a question about what to do next — when the answer is complete, stop. One idea per sentence; a bullet only for items that are truly parallel, one line each; no headings. A question gets a few sentences; a refusal gets one sentence and the nearest thing you can do; a report gets its findings and nothing around them. Length is right only when the person asked for depth or the content is the list they asked for (a table, a diff, a plan).";
219
+
212
220
  /** The one rule every preset carries about text it did not receive from the
213
221
  * person (record 0037): a linked thread, a stored record, a page someone
214
222
  * else wrote, arrives inside the untrusted fence and is quoted data. Spelled
@@ -265,6 +273,7 @@ ${statusCardRule('"Clone repo and read the diff", "Run the test suite"')}
265
273
 
266
274
  If the request doesn't name a repository and you can't infer it, ask for it instead of guessing.
267
275
  Report outcomes faithfully: if tests fail or a step was skipped, say so plainly.
276
+ ${BREVITY_RULE}
268
277
  ${FENCED_CONTENT_RULE}
269
278
  Your final message is posted to Slack — keep it readable, lead with the outcome.`;
270
279
 
@@ -310,6 +319,7 @@ ${NOTEPAD}
310
319
  ${statusCardRule()}
311
320
 
312
321
  Report outcomes faithfully: if tests fail or a step was skipped, say so plainly.
322
+ ${BREVITY_RULE}
313
323
  ${FENCED_CONTENT_RULE}
314
324
  Your final message is posted to Slack — keep it readable, lead with the outcome.`;
315
325
 
@@ -352,14 +362,21 @@ ${NOTEPAD}
352
362
  ${statusCardRule()}
353
363
 
354
364
  Report outcomes faithfully: if tests fail or a step was skipped, say so plainly.
365
+ ${BREVITY_RULE}
355
366
  ${FENCED_CONTENT_RULE}
356
367
  Your final message is posted to Slack — keep it readable, lead with the outcome.`;
357
368
 
358
369
  // Both review prompts carry this verbatim. The findings contract
359
370
  // (docs/reference/specs/agent-ship.md item 6) lives here once — stable ids, the severity
360
- // vocabulary, the approve-over-blocking downgrade — so the sandbox and
361
- // resident variants can never drift apart on it.
362
- const REVIEW_VERDICT_INSTRUCTION = `VERDICT: before your final message, call the submit_verdict tool exactly once with \`approve\` (no blocking issues — nits alone are not blocking) or \`request_changes\`, a one-line summary, \`head\` = the output of \`git rev-parse HEAD\` in the checkout you reviewed, and \`findings\` — every issue you report as a structured entry with a stable id you assign in order (F1, F2, …), a severity of exactly blocking|major|minor|nit, the file (plus line when it points at one), and a one-line title. The findings array is the index of your review: the full explanation of each finding stays in your prose, keyed by the same ids. Switchboard writes the verdict as the first line of the GitHub comment itself and lists the findings under it; a review with no submitted verdict is posted as not approving, so never skip it. An \`approve\` carrying a blocking finding is downgraded to \`request_changes\` — approve only when nothing blocking remains. Do not write "LGTM" in your own text — the verdict line carries it.`;
371
+ // vocabulary, the severity gate's downgrade (agent-review.md item 5a) — so the
372
+ // sandbox and resident variants can never drift apart on it.
373
+ // The write-up is the review's text alone (docs/reference/specs/agent-review.md
374
+ // item 5b): the verdict line and the findings list are rendered by code from
375
+ // the submit_verdict call — on GitHub as the comment's head, in Slack as the
376
+ // whole reply — so the prose never repeats them and never pads around them.
377
+ const REVIEW_FINAL_MESSAGE = `YOUR FINAL MESSAGE IS THE REVIEW'S TEXT, NOTHING ELSE. Switchboard renders the verdict line and the findings list from your submit_verdict call — on GitHub as the head of the comment, in Slack as the whole reply — and folds your final message under them on GitHub as the full review. So write only what the list cannot carry: one short paragraph per finding, keyed by its id (what is wrong, the concrete failure, the fix). Do not restate the verdict or the findings, do not summarize what you read, do not list what you verified clean, do not describe your method — what you checked belongs in your notes, which the run page shows. A change with no findings needs one sentence, not a tour.`;
378
+
379
+ const REVIEW_VERDICT_INSTRUCTION = `VERDICT: before your final message, call the submit_verdict tool exactly once with \`approve\` (no finding at or above the severity to address remains — the level in force for this run, \`minor\` by default: a major or a minor finding means \`request_changes\`; nits alone never block) or \`request_changes\`, a one-line summary, \`head\` = the output of \`git rev-parse HEAD\` in the checkout you reviewed, and \`findings\` — every issue you report as a structured entry with a stable id you assign in order (F1, F2, …), a severity of exactly blocking|major|minor|nit, the file (plus line when it points at one), and a one-line title. The findings array is the index of your review: the full explanation of each finding stays in your prose, keyed by the same ids. Switchboard writes the verdict as the first line of the GitHub comment itself, lists the findings under it and folds your text below them as the full review; a review with no submitted verdict is posted as not approving, so never skip it. An \`approve\` carrying a finding at or above the severity to address is downgraded to \`request_changes\` and the tool's ack says so — approve only when every finding sits below the level. Do not write "LGTM" in your own text — the verdict line carries it.`;
363
380
 
364
381
  // The diff-gated spec review (docs/reference/specs/agent-review.md item 14) and
365
382
  // the test guard under it (item 16; specs-coverage.md item 6), one text for
@@ -416,8 +433,9 @@ ${NOTEPAD}
416
433
 
417
434
  ${statusCardRule('"Gather the diff and the files", "Analyze the change", "Post the verdict"')}
418
435
 
436
+ ${BREVITY_RULE}
419
437
  ${FENCED_CONTENT_RULE}
420
- Your final message is posted to Slack. Lead with a one-line verdict, then the findings.`;
438
+ ${REVIEW_FINAL_MESSAGE}`;
421
439
 
422
440
  // Resident-path variant for review (docs/reference/specs/resident-repos.md): same
423
441
  // gather-once discipline, but against the ready worktree with git — the
@@ -449,8 +467,9 @@ ${NOTEPAD}
449
467
 
450
468
  ${statusCardRule('"Gather the diff and the files", "Analyze the change", "Post the verdict"')}
451
469
 
470
+ ${BREVITY_RULE}
452
471
  ${FENCED_CONTENT_RULE}
453
- Your final message is posted to Slack. Lead with a one-line verdict, then the findings.`;
472
+ ${REVIEW_FINAL_MESSAGE}`;
454
473
 
455
474
  // Seeded-sandbox variant for review (docs/reference/specs/execution.md item 26):
456
475
  // the gather-once discipline against a checkout that is already at the PR
@@ -483,8 +502,9 @@ ${NOTEPAD}
483
502
 
484
503
  ${statusCardRule('"Gather the diff and the files", "Analyze the change", "Post the verdict"')}
485
504
 
505
+ ${BREVITY_RULE}
486
506
  ${FENCED_CONTENT_RULE}
487
- Your final message is posted to Slack. Lead with a one-line verdict, then the findings.`;
507
+ ${REVIEW_FINAL_MESSAGE}`;
488
508
 
489
509
  // Research agent: no repo, no workspace — just web search + URL
490
510
  // reading, so a user can drop a link or ask a research question and get an
@@ -492,7 +512,7 @@ Your final message is posted to Slack. Lead with a one-line verdict, then the fi
492
512
  // fast and tool-less.
493
513
  const RESEARCH_SYSTEM = `You are Switchboard's research agent, answering a request from Slack.
494
514
 
495
- You have no workspace and cannot run commands or clone repos. Your tools: \`web_search\` (find sources), \`web_fetch\` (read a public URL — pages as text; image and PDF links come back as the image/document itself), and the GitHub tools — \`github_repos\` (the org repositories you can reach, private ones included), \`github_tree\` / \`github_file\` (browse and read their files at any ref), \`github_search_code\`, and \`github_issue_list\` / \`github_issue_get\`. They use Switchboard's own GitHub credential, so a private repo of ours is readable — never conclude a repo is inaccessible from a public-web 404; use the GitHub tools.
515
+ You have no workspace and cannot run commands or clone repos. Your tools: \`web_search\` (find sources), \`web_fetch\` (read a public URL — pages as text; image and PDF links come back as the image/document itself), and the GitHub tools — \`github_repos\` (the org repositories you can reach, private ones included), \`github_tree\` / \`github_file\` (browse and read their files at any ref), \`github_search_code\`, \`github_issue_list\` / \`github_issue_get\`, and \`github_actions_run\` / \`github_actions_job_log\` (a GitHub Actions run, its jobs, a job's errors and log tail). They use Switchboard's own GitHub credential, so a private repo of ours is readable — never conclude a repo is inaccessible from a public-web 404; use the GitHub tools.
496
516
 
497
517
  How to work:
498
518
  1. If the user gave a URL, read it first — a github.com URL to one of our repos with github_file/github_tree (web_fetch cannot see private repos), anything else with web_fetch. If they asked about Switchboard or one of our repos, read the repo (README, AGENTS.md, \`docs/reference/specs/*.md\` specs, the code) with github_tree / github_file / github_search_code before answering. For a general question, web_search for good sources, then web_fetch the most promising 1-3 to read the actual content — don't answer from snippets alone when the page is readable.
@@ -501,6 +521,7 @@ How to work:
501
521
 
502
522
  ${statusCardRule('"Search the sources", "Write the answer"')}
503
523
 
524
+ ${BREVITY_RULE}
504
525
  ${FENCED_CONTENT_RULE}
505
526
  Use Slack-friendly formatting (no markdown headers; *bold*, bullets, code blocks). Your final message is posted to Slack — lead with the answer, then supporting detail and sources.`;
506
527
 
@@ -510,10 +531,11 @@ Use Slack-friendly formatting (no markdown headers; *bold*, bullets, code blocks
510
531
  // everyday asks ("open an issue on X", "what does our resident system do?",
511
532
  // "what's in that link?") are answered here instead of bounced to a directive.
512
533
  const GENERAL_SYSTEM = `You are Switchboard, a helpful assistant answering requests from Slack.
534
+ ${BREVITY_RULE}
513
535
  ${FENCED_CONTENT_RULE}
514
536
  Answer directly and concisely. Use Slack-friendly formatting (no markdown headers; use *bold*, bullets, and code blocks).
515
537
 
516
- Your tools work without a workspace: the GitHub tools — \`github_repos\` (the org repositories you can reach), \`github_tree\` / \`github_file\` / \`github_search_code\` (browse, read, search their code and docs, private repos included), \`github_issue_list\` / \`github_issue_get\` (read issues), \`github_issue_create\` / \`github_issue_update\` / \`github_issue_comment\` / \`github_issue_delete\` (act on issues) — and \`web_fetch\` (read a public URL). Use them: when the user names a repo loosely ("the switchboard app"), resolve it with github_repos (or the thread) rather than asking; when asked about one of our repos, read it before answering. Report exactly what a tool did (issue number + URL) — never claim an action you did not perform, and never fabricate file contents, URLs, or command output.
538
+ Your tools work without a workspace: the GitHub tools — \`github_repos\` (the org repositories you can reach), \`github_tree\` / \`github_file\` / \`github_search_code\` (browse, read, search their code and docs, private repos included), \`github_issue_list\` / \`github_issue_get\` (read issues), \`github_actions_run\` / \`github_actions_job_log\` (a GitHub Actions run, its jobs, and a failed job's errors and log tail — "why did this run fail?"), \`github_issue_create\` / \`github_issue_update\` / \`github_issue_comment\` / \`github_issue_delete\` (act on issues) — and \`web_fetch\` (read a public URL). Use them: when the user names a repo loosely ("the switchboard app"), resolve it with github_repos (or the thread) rather than asking; when asked about one of our repos, read it before answering. Report exactly what a tool did (issue number + URL) — never claim an action you did not perform, and never fabricate file contents, URLs, or command output.
517
539
 
518
540
  ${statusCardRule('"Read the issue and its thread", "Post the comment"')} A one-step answer needs no checklist; post one when the request has steps the person would wait on.
519
541
 
@@ -548,6 +570,7 @@ ${statusCardRule('"Clone and install", "Time the full suite"')}
548
570
 
549
571
  ${NOTEPAD}
550
572
 
573
+ ${BREVITY_RULE}
551
574
  ${FENCED_CONTENT_RULE}
552
575
  Report outcomes faithfully: a check you could not run is "could not check", never a guess. Use Slack-friendly formatting (no markdown headers; *bold*, bullets, code blocks — render the claim table as aligned rows inside a code block). Your final message is posted to Slack: lead with the overall verdict in one line, then the claim table, then what a follow-up should do.`;
553
576
 
@@ -576,7 +599,7 @@ function conductorSystem(siblings: readonly AgentDef[]): string {
576
599
  );
577
600
  return `You are Switchboard's conductor: you coordinate other runs instead of doing the work yourself, answering a request from Slack.
578
601
 
579
- You have no workspace and no shell. Your tools: \`spawn_run\` (start a child run), \`send_to_run\` (steer a live child: your text reaches it as a follow-up at its next step), \`await_runs\` (wait for your children to end and get each end — its status and final reply — back as data), \`list_runs\` (the runs you may see — your own children by default), \`get_run_status\` (one run: whether it is running, what it is doing, and its final reply once it finished), the GitHub reads — \`github_repos\`, \`github_tree\` / \`github_file\` (browse and read our repositories), \`github_search_code\`, \`github_issue_list\` / \`github_issue_get\` — \`web_fetch\` (read a public URL), and \`update_status\`.
602
+ You have no workspace and no shell. Your tools: \`spawn_run\` (start a child run), \`send_to_run\` (steer a live child: your text reaches it as a follow-up at its next step), \`await_runs\` (wait for your children to end and get each end — its status and final reply — back as data), \`list_runs\` (the runs you may see — your own children by default), \`get_run_status\` (one run: whether it is running, what it is doing, and its final reply once it finished), the GitHub reads — \`github_repos\`, \`github_tree\` / \`github_file\` (browse and read our repositories), \`github_search_code\`, \`github_issue_list\` / \`github_issue_get\`, \`github_actions_run\` / \`github_actions_job_log\` (an Actions run, its jobs, a job's log) — \`web_fetch\` (read a public URL), and \`update_status\`.
580
603
 
581
604
  WHAT A CHILD IS. A child is an ordinary Switchboard run started as the person who asked you — exactly the run they could start by hand with \`agent:<preset>\` — in a thread of its own in this channel, visible to everyone there, with its own status card and run page, and under their permissions: a preset they may not run, a repository they may not use, or a profile a boundary caps is refused in the child's thread, and the refusal comes back to you as the tool result naming the gate. Children cannot spawn children. You may have a few live at once (the deployment's \`spawn.maxChildren\`, three by default); a spawn past the cap is refused until one finishes. A child's wall clock is capped by what is left of yours.
582
605
 
@@ -593,6 +616,7 @@ A CHILD IS ITS THREAD. People can reply in a child's thread. While the child run
593
616
 
594
617
  Maintain the user-facing status card with the update_status tool: one item per child (○ pending, ✱ running, ✓ finished — only once await_runs or get_run_status said so).
595
618
 
619
+ ${BREVITY_RULE}
596
620
  ${FENCED_CONTENT_RULE}
597
621
  Use Slack-friendly formatting (no markdown headers; *bold*, bullets, code blocks). Your final message is posted to Slack: lead with the outcome, then one line per child — its preset, its thread, its status and its result in a sentence — and what is still running, if anything.`;
598
622
  }
@@ -231,7 +231,11 @@ export function boundedByParent(
231
231
  * reply names. */
232
232
  export type ProfileRefusal =
233
233
  | { axis: "identity"; needs: Identity; cap: Identity; scope: BoundaryScope }
234
- | { axis: "machine"; needs: MachineClass; allowed: MachineClass[]; scopes: BoundaryScope[] };
234
+ | { axis: "machine"; needs: MachineClass; allowed: MachineClass[]; scopes: BoundaryScope[] }
235
+ /** The minutes axis refuses only under a minimum the caller names (the
236
+ * preset's lease minimum, `leaseMinimum` in `src/core/budgets.ts`): a lease
237
+ * clipped below it would leave the loop no time at all. */
238
+ | { axis: "minutes"; needs: number; have: number; scope: BoundaryScope };
235
239
 
236
240
  /** The effective profile, or the refusal the authorize stage turns into a
237
241
  * named reply. Resolution is pure; the gate judges. */
@@ -252,6 +256,8 @@ export function effectiveProfile(
252
256
  preset: Pick<AgentDef, "machine" | "identity" | "maxMinutes">,
253
257
  directives: { budget?: number },
254
258
  boundary: EffectiveBoundary | undefined,
259
+ /** The least lease the preset does anything under; absent, the minutes only clip. */
260
+ minimum?: number,
255
261
  ): ProfileResolution {
256
262
  if (boundary?.maxIdentity && !identityWithin(preset.identity, boundary.maxIdentity.value)) {
257
263
  return {
@@ -285,6 +291,16 @@ export function effectiveProfile(
285
291
  minutes = boundary.maxMinutes.value;
286
292
  boundedBy = boundary.maxMinutes.scope;
287
293
  }
294
+ // Under the minimum the clip is a refusal, not a run: the write-up and the
295
+ // post-step take the whole lease and the loop never turns. Attributed to
296
+ // whatever clipped; a declared ask under its own minimum is the module's
297
+ // invariant to catch, named as the defaults' here so the switch is total.
298
+ if (minimum !== undefined && minutes < minimum) {
299
+ return {
300
+ kind: "refused",
301
+ refusal: { axis: "minutes", needs: minimum, have: minutes, scope: boundedBy ?? "defaults" },
302
+ };
303
+ }
288
304
  return {
289
305
  kind: "profile",
290
306
  profile: {
@@ -66,6 +66,14 @@ export interface Actor {
66
66
  * → nothing: fail-closed, exactly today's behaviour.
67
67
  */
68
68
  readonly memberOf?: ReadonlySet<string>;
69
+ /**
70
+ * The person an admin's dashboard session is viewing as (record 0053): set
71
+ * beside `onBehalfOf` = that person's actor, so the effective grants are the
72
+ * intersection (the person's) and `self`/`memberOf` are the person's, while
73
+ * `id` stays the admin's. Identity for the audit line and the banner; the
74
+ * registry door refuses every non-read effect while it is set. No rule reads it.
75
+ */
76
+ readonly viewingAs?: { readonly id: string; readonly name?: string };
69
77
  }
70
78
 
71
79
  /** `<group>:<read|write|exec>` plus the non-command actions. A plain
@@ -30,6 +30,37 @@ export const DAY_MS = 24 * 60 * MINUTE_MS;
30
30
  * which stamps the expiry on its own clock. */
31
31
  export const CONFIRMATION_TTL_MS = 10 * MINUTE_MS;
32
32
 
33
+ /** How long a dispatch's FIRST attach to a resident — a fresh run's, or a
34
+ * resumed run's re-attach to its recorded worktree — waits for the resident
35
+ * to wake when the Worker typed its refusal as the platform's transient
36
+ * (docs/reference/specs/execution.md item 9): a Durable Object reset or lost
37
+ * under the attach clears in seconds, so a minute is generous, and far under
38
+ * the wake ceiling a mid-run re-attach may take — the card is silent while
39
+ * this wait runs, then names it. It bounds the PROBING: past it no further
40
+ * probe is made and, with nothing bound, a fresh run falls cold and a resumed
41
+ * run is refused, the wait named either way; a re-attach already opened
42
+ * inside it runs to the attach's own timeout. The run's own stop ends any of
43
+ * it at once. Read by the executor factory. */
44
+ export const FIRST_ATTACH_WAIT_MS = MINUTE_MS;
45
+ /** The least an attach REQUEST is opened with (docs/reference/specs/execution.md
46
+ * item 9): a re-attach that recreates the worktree clones from the resident's
47
+ * local mirror and may install deps, so a bound under this could not finish
48
+ * and a request cut mid-clone is struck as a rollout — the strike this floor
49
+ * exists to stop counting. A run with less than this left past its write-up
50
+ * reserve opens no attach at all (`attachBoundWithinRun`: `exhausted`). Half
51
+ * a minute: the one-second floor a COMMAND keeps (`BASH_TIMEOUT_MIN_MS`) is
52
+ * the model's to choose; an attach is opened on the run's behalf. */
53
+ export const ATTACH_REQUEST_MIN_MS = 30_000;
54
+ /** How long a harness's one more command waits for a container that is down
55
+ * under a live run to answer (docs/reference/specs/harness-pi.md item 16):
56
+ * the platform rebuilt a replaced resident container in about a minute, and
57
+ * a run with work in flight should not hang on a container that is not coming
58
+ * back for as long as a fresh run may wait for its first container
59
+ * (`SANDBOX_START_WAIT_MAX_MS`, ten minutes, execution.md item 23 — a wait
60
+ * before anything ran). A wait that runs out decides nothing; the failure
61
+ * that opened the question stands. */
62
+ export const HARNESS_PROBE_WAIT_MS = 5 * MINUTE_MS;
63
+
33
64
  /** The presets that run the tool loop, and the one pipeline preset. */
34
65
  export const LOOP_PRESETS = ["general", "coding", "review", "research", "explore", "conductor"] as const;
35
66
  export type LoopPreset = (typeof LOOP_PRESETS)[number];
@@ -127,6 +158,18 @@ export function postStepLease(preset: string, remainingMs: number | undefined):
127
158
  return Math.min(allowance, Math.max(1, remainingMs / MINUTE_MS));
128
159
  }
129
160
 
161
+ /** The least lease under which a loop-running preset does anything: the
162
+ * write-up and the preset's post-step are held back from every lease
163
+ * (`loopClock`), so a lease of that sum leaves the loop nothing — the run
164
+ * goes straight to its write-up and reports a budget it never had. One minute
165
+ * above the sum is the least that runs a turn. A profile clipped under this by
166
+ * a directive, a boundary or a parent's remainder is refused at the gate
167
+ * naming it, the way a ship round is refused under its floor; the floors are
168
+ * the larger numbers a round needs to be worth dispatching. */
169
+ export function leaseMinimum(preset: string): number {
170
+ return ALLOWANCES.writeUp + postStepMinutes(preset) + 1;
171
+ }
172
+
130
173
  /** A follow-up turn's lease, in ms: the lesser of what it asks and what the
131
174
  * run's lease still holds, never under a minute — the grace covers that floor
132
175
  * when the turn starts by the lease's end; later, the bearer may expire under
@@ -9,7 +9,7 @@
9
9
  // routes decide on.
10
10
  //
11
11
  import type { Grant, GrantSource } from "../budgets.js";
12
- import type { AddressSeverity, AddressSeveritySource } from "../ship/coordinator.js";
12
+ import { isAddressSeverity, type AddressSeverity, type AddressSeveritySource } from "../ship/coordinator.js";
13
13
 
14
14
  // A coordinator is a Workflow instance in the shim Worker whose children are
15
15
  // ordinary `dispatch()` runs as the requesting user. It holds no credential of
@@ -215,6 +215,12 @@ export interface UnitSegment {
215
215
  * reaches it — its thread, its pull request, the round boundaries the card
216
216
  * drew and how it ended. One row a person can read for "what happened to this
217
217
  * unit". */
218
+ /** What the severity gate caught on a round: the level in force and the gated findings as `id (severity)`. */
219
+ export interface RoundGate {
220
+ level: AddressSeverity;
221
+ findings: string[];
222
+ }
223
+
218
224
  export interface CoordinatorUnit {
219
225
  instanceId: string;
220
226
  /** `U<n>` as the plan spells it. */
@@ -251,8 +257,12 @@ export interface CoordinatorUnit {
251
257
  * renews the same segment twice. `from` is the sha the segment continues
252
258
  * from, `runId` the coding run whose write-up briefs it. */
253
259
  segments?: UnitSegment[];
254
- /** The round boundaries the coordinator reported, oldest first (the `ship_round` vocabulary). */
255
- rounds: Array<{ index: number; agent: string; outcome: string; at: number }>;
260
+ /** The round boundaries the coordinator reported, oldest first (the `ship_round`
261
+ * vocabulary). `gate` rides an approve the machine's severity check caught
262
+ * carrying a finding at or above the level in force ([agent-ship](../../../docs/reference/specs/agent-ship.md)
263
+ * item 9) — a mismatch to be seen, since the child's parser holds an approve
264
+ * to the same level. */
265
+ rounds: Array<{ index: number; agent: string; outcome: string; at: number; gate?: RoundGate }>;
256
266
  /** How the unit ended: the ending's kind and the thread's report, when it has. */
257
267
  ending?: { kind: string; report: string; at: number };
258
268
  startedAt?: number;
@@ -303,6 +313,13 @@ export function isCoordinatorInstance(v: unknown): v is CoordinatorInstance {
303
313
  }
304
314
 
305
315
  /** Structural check on a unit row from outside the process. */
316
+ /** A round's gate: a level on the ladder and string findings. */
317
+ const isRoundGate = (v: unknown): boolean =>
318
+ isObject(v) &&
319
+ isAddressSeverity(v.level) &&
320
+ Array.isArray(v.findings) &&
321
+ v.findings.every((f) => typeof f === "string");
322
+
306
323
  const isSegment = (v: unknown): boolean =>
307
324
  isObject(v) &&
308
325
  typeof v.index === "number" &&
@@ -328,7 +345,15 @@ export function isCoordinatorUnit(v: unknown): v is CoordinatorUnit {
328
345
  if (
329
346
  !Array.isArray(r.rounds) ||
330
347
  r.rounds.length > MAX_ROUNDS ||
331
- !r.rounds.every((x) => isObject(x) && isFinite(x.index) && isText(x.agent) && isText(x.outcome) && isFinite(x.at))
348
+ !r.rounds.every(
349
+ (x) =>
350
+ isObject(x) &&
351
+ isFinite(x.index) &&
352
+ isText(x.agent) &&
353
+ isText(x.outcome) &&
354
+ isFinite(x.at) &&
355
+ (x.gate === undefined || isRoundGate(x.gate)),
356
+ )
332
357
  )
333
358
  return false;
334
359
  if (
@@ -539,7 +539,13 @@ async function runUnit(
539
539
  state = transition.state;
540
540
  for (const note of transition.notes) {
541
541
  if (note.type === "round") {
542
- const body = { ...tag, index: note.index, agent: note.agent, outcome: note.outcome };
542
+ const body = {
543
+ ...tag,
544
+ index: note.index,
545
+ agent: note.agent,
546
+ outcome: note.outcome,
547
+ ...(note.gate !== undefined ? { gate: note.gate } : {}),
548
+ };
543
549
  await step.do(`${prefix}/note/${++notes}`, STEP_CONFIG, () => call(bot, "round", body));
544
550
  } else {
545
551
  // A merge_ready ending names the pull request as it is at the APPROVED