frizz-server 0.15.47 → 0.15.48

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 (102) hide show
  1. package/dist/claude-agent-broker.js +10586 -10129
  2. package/dist/dev-child.js +12968 -12072
  3. package/package.json +1 -1
  4. package/runtime/cc-worker/hooks/bash-background.d.mts +1 -0
  5. package/runtime/cc-worker/hooks/bash-background.mjs +8 -2
  6. package/runtime/cc-worker/lib/frizz-tools.mjs +155 -157
  7. package/web-dist/assets/{abnfDiagram-VRR7QNED-iDOCNbXO.js → abnfDiagram-VRR7QNED-B13Nf5uG.js} +1 -1
  8. package/web-dist/assets/{arc-BrF0Rm1i.js → arc-tjQgP-a1.js} +1 -1
  9. package/web-dist/assets/architecture-TIHT7OUA-cscbyVpp.js +1 -0
  10. package/web-dist/assets/{architectureDiagram-ZJ3FMSHR-COkFKHik.js → architectureDiagram-ZJ3FMSHR-Bse2UXVn.js} +1 -1
  11. package/web-dist/assets/{blockDiagram-677ZJIJ3-B8jHaw9w.js → blockDiagram-677ZJIJ3-BLJZnqTz.js} +1 -1
  12. package/web-dist/assets/{c4Diagram-LMCZKHZV-Bk68X3s1.js → c4Diagram-LMCZKHZV-DO7oo4h9.js} +1 -1
  13. package/web-dist/assets/channel-ChsreyIE.js +1 -0
  14. package/web-dist/assets/{chunk-32BRIVSS-D1k2xlst.js → chunk-32BRIVSS-DCVxFWaV.js} +1 -1
  15. package/web-dist/assets/{chunk-52WLFC77-PIA7tEec.js → chunk-52WLFC77-Cg3jpJ_e.js} +1 -1
  16. package/web-dist/assets/{chunk-C7G6YPKG-Cpq60F62.js → chunk-C7G6YPKG-Cb_zdGzQ.js} +1 -1
  17. package/web-dist/assets/{chunk-EX3LRPZG-B8pMnMFD.js → chunk-EX3LRPZG-C57JKsUG.js} +1 -1
  18. package/web-dist/assets/{chunk-FWX5IMBZ-DiB0mfEq.js → chunk-FWX5IMBZ-2PvmKNIs.js} +2 -2
  19. package/web-dist/assets/{chunk-HOUHSVGY-BWPPBtYe.js → chunk-HOUHSVGY-rlZvVAjI.js} +1 -1
  20. package/web-dist/assets/{chunk-ICXQ74PX-Bxo3FtCY.js → chunk-ICXQ74PX-CUDlgeXU.js} +1 -1
  21. package/web-dist/assets/{chunk-MOJQB5TN-Cn7YFv8n.js → chunk-MOJQB5TN-BGaw_67a.js} +1 -1
  22. package/web-dist/assets/{chunk-OGEWGWER-D0DZsO7H.js → chunk-OGEWGWER-CEeg8UMh.js} +1 -1
  23. package/web-dist/assets/{chunk-PUDLZKDR-lbu1PRL-.js → chunk-PUDLZKDR-xwNSwwyn.js} +1 -1
  24. package/web-dist/assets/{chunk-Q4XR5HBZ-DODjBb_2.js → chunk-Q4XR5HBZ-msU0GK4L.js} +1 -1
  25. package/web-dist/assets/{chunk-RYQCIY6F-UI2ov1Gm.js → chunk-RYQCIY6F-BBiFFmSH.js} +1 -1
  26. package/web-dist/assets/{chunk-V7JOEXUC-CoAxUYwV.js → chunk-V7JOEXUC-kdk1Kj1f.js} +1 -1
  27. package/web-dist/assets/{chunk-VAUOI2AC-DayQueQJ.js → chunk-VAUOI2AC-DpbSQ-0T.js} +1 -1
  28. package/web-dist/assets/{chunk-VR4S4FIN-BvE4-7uz.js → chunk-VR4S4FIN-BW2QJzbp.js} +1 -1
  29. package/web-dist/assets/{chunk-WYO6CB5R-C1b8f_Ha.js → chunk-WYO6CB5R-BouXl6Ea.js} +1 -1
  30. package/web-dist/assets/{chunk-XXDRQBXY-Db8h8vrX.js → chunk-XXDRQBXY-DISoSt1F.js} +1 -1
  31. package/web-dist/assets/{chunk-ZGVPDNZ5-BPvaPdjm.js → chunk-ZGVPDNZ5-C7QT30bj.js} +1 -1
  32. package/web-dist/assets/classDiagram-OUVF2IWQ-DzRcM19r.js +1 -0
  33. package/web-dist/assets/classDiagram-v2-EOCWNBFH-DzRcM19r.js +1 -0
  34. package/web-dist/assets/{cose-bilkent-JH36ORCC-6a5DuAKw.js → cose-bilkent-JH36ORCC-B4uC0Pku.js} +1 -1
  35. package/web-dist/assets/{cynefin-VYW2F7L2-CiaAgDBh.js → cynefin-VYW2F7L2-KGwY_f6i.js} +1 -1
  36. package/web-dist/assets/{cynefinDiagram-TSTJHNR4-C2-bZ39g.js → cynefinDiagram-TSTJHNR4-D1KgH5Uh.js} +1 -1
  37. package/web-dist/assets/{dagre-VKFMJZFB-B9ePaZcR.js → dagre-VKFMJZFB-CpBkJUGX.js} +1 -1
  38. package/web-dist/assets/{diagram-FQU43EPY-oBxIoUHV.js → diagram-FQU43EPY-DJLjwc2E.js} +1 -1
  39. package/web-dist/assets/{diagram-G47NLZAW-DUuYaukI.js → diagram-G47NLZAW-R_nxXPm1.js} +1 -1
  40. package/web-dist/assets/{diagram-NH7WQ7WH-DU4YRpGs.js → diagram-NH7WQ7WH-BgEKOFUU.js} +1 -1
  41. package/web-dist/assets/{diagram-OA4YK3LP-2ogMtbVh.js → diagram-OA4YK3LP-DQZYQQmQ.js} +1 -1
  42. package/web-dist/assets/{diagram-WEI45ONY-B3_rdnvV.js → diagram-WEI45ONY-BPJydYC6.js} +1 -1
  43. package/web-dist/assets/{dist-9O4kNbWa.js → dist-KklTF2b-.js} +1 -1
  44. package/web-dist/assets/{ebnfDiagram-CCIWWBDH-DNJfkzp6.js → ebnfDiagram-CCIWWBDH-DwgS-ruz.js} +1 -1
  45. package/web-dist/assets/{erDiagram-Q63AITRT-DTazNJT3.js → erDiagram-Q63AITRT-CpxSzpX_.js} +1 -1
  46. package/web-dist/assets/eventmodeling-45OFAUF4-pAxX2kmp.js +1 -0
  47. package/web-dist/assets/flowDiagram-23GEKE2U-CNUJOYgE.js +1 -0
  48. package/web-dist/assets/{ganttDiagram-NO4QXBWP-CAl6kamJ.js → ganttDiagram-NO4QXBWP-DKV9dDLx.js} +1 -1
  49. package/web-dist/assets/{gitGraph-TEB2WS4Q-VeGcf3-g.js → gitGraph-TEB2WS4Q-Di3-VfYF.js} +1 -1
  50. package/web-dist/assets/{gitGraphDiagram-IHSO6WYX-DGDk4E7F.js → gitGraphDiagram-IHSO6WYX-CZd5jqgf.js} +1 -1
  51. package/web-dist/assets/index-CnoKcjA-.css +2 -0
  52. package/web-dist/assets/index-dgMYbeEx.js +378 -0
  53. package/web-dist/assets/{info-DKCQHKI2--Ysy9pf-.js → info-DKCQHKI2-zUEOPGRX.js} +1 -1
  54. package/web-dist/assets/{infoDiagram-FWYZ7A6U-Vi583nbN.js → infoDiagram-FWYZ7A6U-C2fsvj8W.js} +1 -1
  55. package/web-dist/assets/{ishikawaDiagram-FXEZZL3T-C9HuPQ7n.js → ishikawaDiagram-FXEZZL3T-DDputQI8.js} +1 -1
  56. package/web-dist/assets/{journeyDiagram-5HDEW3XC-BaG6DHpc.js → journeyDiagram-5HDEW3XC-CiwOnh1u.js} +1 -1
  57. package/web-dist/assets/{kanban-definition-HUTT4EX6-D2idvTZZ.js → kanban-definition-HUTT4EX6-P8OTxob-.js} +1 -1
  58. package/web-dist/assets/{line-CHvSdfqI.js → line-Kk41edHq.js} +1 -1
  59. package/web-dist/assets/{linear-BfMiINPG.js → linear-CCCAZbB0.js} +1 -1
  60. package/web-dist/assets/{mermaid-parser.core-BC4Qutkz.js → mermaid-parser.core-BIyJ5CJF.js} +3 -3
  61. package/web-dist/assets/{mermaid.core-B68W9xIp.js → mermaid.core-CrqCm1sE.js} +3 -3
  62. package/web-dist/assets/{mindmap-definition-LN4V7U3C-oAq5mEJC.js → mindmap-definition-LN4V7U3C-CbKVoOZ5.js} +1 -1
  63. package/web-dist/assets/{packet-7NZHBO7P-B9zkni4H.js → packet-7NZHBO7P-Dk5Sv2nR.js} +1 -1
  64. package/web-dist/assets/{pegDiagram-2B236MQR-Bkh6geaD.js → pegDiagram-2B236MQR-DImDz479.js} +1 -1
  65. package/web-dist/assets/{pie-RZYD4A2V-BBHMXf27.js → pie-RZYD4A2V-D4HndtMy.js} +1 -1
  66. package/web-dist/assets/{pieDiagram-ENE6RG2P-DQ2f6w1c.js → pieDiagram-ENE6RG2P-C2e3M1_h.js} +1 -1
  67. package/web-dist/assets/{quadrantDiagram-ABIIQ3AL-BhYtyo0A.js → quadrantDiagram-ABIIQ3AL-Dt3f_lrO.js} +1 -1
  68. package/web-dist/assets/{radar-I7S5WNFK-CvWy-0Yr.js → radar-I7S5WNFK-Bgms7oi0.js} +1 -1
  69. package/web-dist/assets/{railroad-3IZDKUUU-C5xUcLo_.js → railroad-3IZDKUUU-BZvaJJq3.js} +1 -1
  70. package/web-dist/assets/railroad-abnf-AHOZXSZD-BaE30t8x.js +1 -0
  71. package/web-dist/assets/railroad-ebnf-EBAXGLYW-Cuetb6tx.js +1 -0
  72. package/web-dist/assets/railroad-peg-LSFZ7HO6-DDs0AouG.js +1 -0
  73. package/web-dist/assets/{railroadDiagram-RFXS5EU6-B_9aCfx8.js → railroadDiagram-RFXS5EU6-CBZHt0Mo.js} +1 -1
  74. package/web-dist/assets/{requirementDiagram-TGXJPOKE-DmrXK4rK.js → requirementDiagram-TGXJPOKE-BxSs_q3D.js} +1 -1
  75. package/web-dist/assets/{sankeyDiagram-HTMAVEWB-D17hTJxE.js → sankeyDiagram-HTMAVEWB-DeJR64nI.js} +1 -1
  76. package/web-dist/assets/{sequenceDiagram-DBY2YBRQ-DPey_smA.js → sequenceDiagram-DBY2YBRQ-oOI0fQW_.js} +1 -1
  77. package/web-dist/assets/{src-B-KeW2DM.js → src-DLhDEMjC.js} +1 -1
  78. package/web-dist/assets/{stateDiagram-2N3HPSRC-BxjJLKfe.js → stateDiagram-2N3HPSRC-C0geqCc2.js} +1 -1
  79. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-l7nncg_Z.js +1 -0
  80. package/web-dist/assets/{swimlanes-5IMT3BWC-dct_dfAy.js → swimlanes-5IMT3BWC-BABUQ-Hv.js} +1 -1
  81. package/web-dist/assets/swimlanesDiagram-G3AALYLV-BAhikHjx.js +8 -0
  82. package/web-dist/assets/{timeline-definition-FHXFAJF6-CEYAtheb.js → timeline-definition-FHXFAJF6-CCY_OuVM.js} +1 -1
  83. package/web-dist/assets/{treeView-QDETBFTQ-BCg0MbaM.js → treeView-QDETBFTQ-CjszFvr3.js} +1 -1
  84. package/web-dist/assets/{treemap-6X3UGDF4-ILmvrzMk.js → treemap-6X3UGDF4-BbdOWC-4.js} +1 -1
  85. package/web-dist/assets/{vennDiagram-L72KCM5P-CVz8QpMQ.js → vennDiagram-L72KCM5P-OGzW7d1w.js} +1 -1
  86. package/web-dist/assets/{wardley-OPB4EBWU-9fWETCs-.js → wardley-OPB4EBWU-GgVEIZwC.js} +1 -1
  87. package/web-dist/assets/{wardleyDiagram-EHGQE667-DTjemLX3.js → wardleyDiagram-EHGQE667-CJKRWMOx.js} +1 -1
  88. package/web-dist/assets/{xychartDiagram-FW5EYKEG-JtHdTmnr.js → xychartDiagram-FW5EYKEG-biGPRYAN.js} +1 -1
  89. package/web-dist/index.html +2 -2
  90. package/web-dist/assets/architecture-TIHT7OUA-BJ-2sVoF.js +0 -1
  91. package/web-dist/assets/channel-CC6hXCSg.js +0 -1
  92. package/web-dist/assets/classDiagram-OUVF2IWQ-CjYLtM5U.js +0 -1
  93. package/web-dist/assets/classDiagram-v2-EOCWNBFH-CjYLtM5U.js +0 -1
  94. package/web-dist/assets/eventmodeling-45OFAUF4-CAq-MItm.js +0 -1
  95. package/web-dist/assets/flowDiagram-23GEKE2U-CyeGrBNa.js +0 -1
  96. package/web-dist/assets/index-4uNIPs2R.js +0 -378
  97. package/web-dist/assets/index-BYeFPFV9.css +0 -2
  98. package/web-dist/assets/railroad-abnf-AHOZXSZD-D7ZNn3_u.js +0 -1
  99. package/web-dist/assets/railroad-ebnf-EBAXGLYW-rxkj4lNU.js +0 -1
  100. package/web-dist/assets/railroad-peg-LSFZ7HO6-DeZ6z_7C.js +0 -1
  101. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-DDJ14-db.js +0 -1
  102. package/web-dist/assets/swimlanesDiagram-G3AALYLV-CLLk0x4V.js +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frizz-server",
3
- "version": "0.15.47",
3
+ "version": "0.15.48",
4
4
  "private": false,
5
5
  "description": "Replaceable Frizz server runtime",
6
6
  "license": "MIT",
@@ -1,3 +1,4 @@
1
+ export const BACKGROUND_JOB_REFUSAL: string
1
2
  export function hasEscapingBackgroundJob(raw: unknown): boolean
2
3
  export function evaluateBashBackgroundHook(
3
4
  input: unknown,
@@ -196,6 +196,12 @@ export function hasEscapingBackgroundJob(raw, depth = 0) {
196
196
  return false;
197
197
  }
198
198
 
199
+ /**
200
+ * The opening of every refusal below. The transcript parser reads it back out of the tool result to
201
+ * tell a call this hook stopped, which launched nothing, from a `&` job that really escaped.
202
+ */
203
+ export const BACKGROUND_JOB_REFUSAL = 'Frizz blocked an untracked shell background job';
204
+
199
205
  export function evaluateBashBackgroundHook(input, env = process.env) {
200
206
  if (!String(env.FRIZZ_THREAD ?? '').trim()) return {};
201
207
  const command = input && typeof input === 'object'
@@ -209,8 +215,8 @@ export function evaluateBashBackgroundHook(input, env = process.env) {
209
215
  permissionDecision: 'deny',
210
216
  permissionDecisionReason:
211
217
  codex
212
- ? 'Frizz blocked an untracked shell background job (`&`). Shell job control can return without a Codex lifecycle handle, so Frizz cannot report completion or wake this agent. For work that must continue while you do something else, remove `&` and use the managed unified exec pattern: start `tools.exec_command(...)`, call `yield_control()`, then await and fully drain that same process. A returned `session_id` alone is only foreground continuation. For bounded parallel work inside one shell call, finish with `wait` (after `kill`, if used) or own cleanup with an EXIT trap.'
213
- : 'Frizz blocked an untracked shell background job (`&`). Shell job control can return from Bash without a Claude task ID, so Frizz cannot report completion or wake this agent. For a long-running local command, remove `&` and call Bash with `run_in_background:true`. For bounded parallel work inside one Bash call, finish with `wait` (after `kill`, if used) or own cleanup with an EXIT trap.',
218
+ ? BACKGROUND_JOB_REFUSAL + ' (`&`). Shell job control can return without a Codex lifecycle handle, so Frizz cannot report completion or wake this agent. For work that must continue while you do something else, remove `&` and use the managed unified exec pattern: start `tools.exec_command(...)`, call `yield_control()`, then await and fully drain that same process. A returned `session_id` alone is only foreground continuation. For bounded parallel work inside one shell call, finish with `wait` (after `kill`, if used) or own cleanup with an EXIT trap.'
219
+ : BACKGROUND_JOB_REFUSAL + ' (`&`). Shell job control can return from Bash without a Claude task ID, so Frizz cannot report completion or wake this agent. For a long-running local command, remove `&` and call Bash with `run_in_background:true`. For bounded parallel work inside one Bash call, finish with `wait` (after `kill`, if used) or own cleanup with an EXIT trap.',
214
220
  },
215
221
  };
216
222
  }
@@ -501,7 +501,7 @@ const UNWATCH = {
501
501
  "it blocks `done` until it is withdrawn.\n\n" +
502
502
  "You do NOT need this when the work simply finishes: frizz settles the row itself and wakes you. " +
503
503
  "`frizzctl activity` prints the id of everything you hold. A `watch-pr` / `watch-issue` id (`prw_…` / " +
504
- "`isw_…`), a `timer` id (`tmr_…`) or a `watch-command` id (`cmw_…`) is withdrawn here too.",
504
+ "`isw_…`), a `timer` id (`tmr_…`) or a `monitor` id (`cmw_…`) is withdrawn here too.",
505
505
  inputSchema: {
506
506
  type: "object",
507
507
  properties: {
@@ -662,7 +662,7 @@ const STEER = {
662
662
  description:
663
663
  "The thread to message: its slug (`fix-queue-focus`), or any link naming it — the " +
664
664
  "`[title](/thread/<slug>)` link `frizzctl spawn-thread` prints, or a full board URL such as " +
665
- "`http://localhost:9393/project/frizz/thread/<slug>/full`, whose `/project/<slug>/` also " +
665
+ "`http://localhost:9393/project/frizz/thread/<slug>`, whose `/project/<slug>/` also " +
666
666
  "names the thread's project.",
667
667
  },
668
668
  project: {
@@ -819,129 +819,123 @@ const UNLINK = {
819
819
  },
820
820
  }
821
821
 
822
- // A wait on an OUTSIDE condition that a command can check, run by the SERVER (2026-10-11). It exists
823
- // because the alternative was a polling loop in a background shell, which pins the thread's whole
824
- // process tree: hibernation refuses a thread holding one. See packages/server/src/command-watch.ts.
822
+ // RETIRED (2026-11-06): `frizzctl watch-command` is `frizzctl monitor` now. The two shared a table, an id and
823
+ // a fence key, and for an hour on 2026-11-06 they were one command under this name with `--persistent`;
824
+ // then the maintainer named it: "I want them to be called monitors. That's a better name." It stays in the
825
+ // tool list, in its place, as `ask` and `secret` do: a resumed worker keeps the contract it started with,
826
+ // so it may still call this, and the refusal is the command to run instead.
827
+ const WATCH_COMMAND_RETIRED =
828
+ "NOT registered — `frizzctl watch-command` is retired (2026-11-06), and nothing was armed or dropped. It is " +
829
+ "`frizzctl monitor` now, with the same arguments:\n\n" +
830
+ " frizzctl monitor add \"<check that exits 0 once it holds>\" --every 5m --for 6h\n" +
831
+ " frizzctl monitor add \"<script>\" --persistent --description \"<what it watches>\" --for 1d\n" +
832
+ " frizzctl monitor list\n" +
833
+ " frizzctl monitor drop <id>\n\n" +
834
+ "Anything you already registered keeps running under the same `cmw_…` id. Rest on it with " +
835
+ "`monitors: [cmw_…]`. `frizzctl monitor --help` has the rest."
825
836
  const WATCH_COMMAND = {
826
837
  name: "watch_command",
827
- description:
828
- "WAIT ON AN OUTSIDE CONDITION WITHOUT HOLDING A PROCESS. Give Frizz a shell command that exits 0 once " +
829
- "the thing you are waiting for is true — a package version npm serves, a release run that finished, a " +
830
- "URL that answers — and the SERVER runs it every `--every` until it does, then wakes you ONCE with " +
831
- "the command and the end of its output. Nothing of yours runs meanwhile, so your thread can be " +
832
- "hibernated while it rests. A polling loop in a background shell (`until …; do sleep 300; done`) pins " +
833
- "your whole process tree, ~250 MB, for as long as it loops; this is that loop without the cost.\n\n" +
834
- "THE CONDITION IS EXIT STATUS 0, and nothing else. Write the check so it FAILS until the condition " +
835
- "holds: `npm view frizz@0.13.12 version` (non-zero while npm does not serve it), `gh run view 123 " +
836
- "--json conclusion -q .conclusion | grep -qx success`, `curl -fsS http://localhost:5173/health`.\n\n" +
837
- "IT RUNS ON THE SERVER, NOT IN YOUR SHELL: `/bin/sh -c` in the project root, with the server's " +
838
- "environment and PATH, stdin closed, killed after 2m. Nothing your session exported, no aliases, no " +
839
- "functions. A first check runs at registration: exit 0 means the condition already holds and nothing " +
840
- "is armed, and a command the server cannot run at all (`command not found`) is refused.\n\n" +
841
- "ONLY ON A THREAD WITH NO PERMISSION CHECKS. The server runs the command with no permission prompt and " +
842
- "outside any sandbox, so Frizz refuses it unless this thread runs in `bypassPermissions` mode with " +
843
- "Claude Code's sandbox off, and refuses it on Codex. The refusal says why; wait in a background shell " +
844
- "then.\n\n" +
845
- "ONE-SHOT: the first passing check settles it. When `--for` runs out it is cancelled and you are woken " +
846
- "to re-decide. Name its id in your ```awaiting fence — `commands: [cmw_…]` with `status: watching`. " +
847
- "Registering is idempotent on the exact command text. `list` reads back what is armed, with each " +
848
- "watch's last check; `drop` withdraws one (so does `frizzctl unwatch <id>`). Only ever your OWN thread's.",
849
- inputSchema: {
850
- type: "object",
851
- properties: {
852
- action: {
853
- type: "string",
854
- enum: ["add", "list", "drop"],
855
- description:
856
- "`add` registers a watch (idempotent per command); `drop` withdraws one by id; `list` reads back " +
857
- "every watch armed on this thread, with its last check, without changing anything.",
858
- },
859
- command: {
860
- type: "string",
861
- description:
862
- "Required for `add`. The check, as one shell command line run with `/bin/sh -c` in the project " +
863
- "root. Exit 0 means the condition holds. Use absolute paths for anything not on a plain PATH.",
864
- },
865
- every: {
866
- type: "string",
867
- description:
868
- "Required for `add`. How often to check, as a DURATION — `1m`, `5m`, `1h` (min 1m, max 24h). " +
869
- "Pick it for how soon you need to know: a release in npm's review is minutes to hours, so `5m`.",
870
- },
871
- for: {
872
- type: "string",
873
- description:
874
- "Required for `add`. How long to keep checking, as a DURATION — `2h`, `1d`, `7d` (max 7d). When it " +
875
- "runs out the watch is cancelled and you are woken to decide what the silence means.",
876
- },
877
- id: {
878
- type: "string",
879
- description: "Required for `drop`. The `cmw_…` id `add` printed (or that `list` and `frizzctl activity` show).",
880
- },
881
- },
882
- required: ["action"],
883
- },
838
+ description: "RETIRED (2026-11-06): `watch_command` is `monitor` now, with the same arguments. This only refuses, and the refusal shows the command.",
839
+ inputSchema: { type: "object", properties: {} },
884
840
  }
885
841
 
886
- // ONE REGISTRATION, MANY WAKES (2026-11-02): a script the SERVER keeps running, every stdout line a wake.
887
- // Claude Code's own Monitor tool moved into the server, so it outlives the session's turns and the thread
888
- // can hibernate under it. A command watch row of kind `monitor`; see packages/server/src/command-watch.ts.
842
+ // A MONITOR (2026-10-11 as `watch-command`; one command with `--persistent` since 2026-11-06): a wait on
843
+ // something outside the thread, run by the SERVER. It exists because the alternative was a polling loop or
844
+ // Claude Code's own Monitor tool in the worker's session, either of which pins the thread's whole process
845
+ // tree: hibernation refuses a thread holding one. See packages/server/src/command-watch.ts, where the rows
846
+ // are still called command watches.
889
847
  const MONITOR = {
890
848
  name: "monitor",
891
849
  description:
892
- "WAKE ON EVERY LINE A LONG-RUNNING SCRIPT PRINTS. Give Frizz a script that keeps running and prints a " +
893
- "line each time something happens — a log tail filtered to the lines you would act on, a poll loop that " +
894
- "prints each new row a query returns, a listener on a socket — and the SERVER runs it for you: every " +
895
- "line it prints on stdout wakes you with that line, for as long as `--for` lasts. Register once, woken " +
896
- "many times. Nothing of yours runs meanwhile, so your thread can hibernate while it rests; Claude Code's " +
897
- "own Monitor tool lives in your session, pins your process tree while it runs, and dies with it. A pull " +
898
- "request or an issue needs none of this: `watch-pr` and `watch-issue` already wake you on each comment, " +
899
- "review and check.\n\n" +
900
- "STDOUT IS THE EVENT STREAM. Lines printed within 200ms of each other are one event; blank lines are " +
850
+ "A MONITOR: WAIT ON SOMETHING OUTSIDE THE THREAD WITHOUT HOLDING A PROCESS. The SERVER runs a shell " +
851
+ "command for you, so nothing of yours runs meanwhile and your thread can be hibernated while it rests. A polling " +
852
+ "loop in a background shell (`until …; do sleep 300; done`) pins your whole process tree, ~250 MB, for " +
853
+ "as long as it loops; this is that loop without the cost. `--persistent` picks between two shapes, and " +
854
+ "it changes what the command has to be: a check that finishes, or a script that keeps running.\n\n" +
855
+ "BY DEFAULT, A CHECK THAT WAKES YOU ONCE. Give it a command that exits 0 once the thing you are waiting " +
856
+ "for is true — a package version npm serves, a release run that finished, a URL that answers. Frizz " +
857
+ "runs it every `--every` until it does, then wakes you with the command and the end of its output. EXIT " +
858
+ "STATUS 0 IS THE CONDITION, and nothing else, so write the check to FAIL until it holds: `npm view " +
859
+ "frizz@0.13.12 version` (non-zero while npm does not serve it), `gh run view 123 --json conclusion -q " +
860
+ ".conclusion | grep -qx success`, `curl -fsS http://localhost:5173/health`. Each run is killed after " +
861
+ "2m. A first check runs at registration: exit 0 means the condition already holds and nothing is armed, " +
862
+ "and a command the server cannot run at all (`command not found`) is refused. The first passing check " +
863
+ "settles it.\n\n" +
864
+ "WITH `--persistent`, A SCRIPT THAT WAKES YOU ON EVERY LINE. Give it a script that keeps running and " +
865
+ "prints a line each time something happens — a log tail filtered to the lines you would act on, a poll " +
866
+ "loop that prints each new row a query returns, a listener on a socket — with a `--description` and no " +
867
+ "`--every`. Register once, woken many times. Claude Code's own Monitor tool lives in your session, pins " +
868
+ "your process tree while it runs, and dies with it; this does none of that. A pull request or an issue " +
869
+ "needs neither shape: `watch-pr` and `watch-issue` already wake you on each comment, review and check.\n\n" +
870
+ "ITS STDOUT IS THE EVENT STREAM. Lines printed within 200ms of each other are one event; blank lines are " +
901
871
  "nothing. Stderr is never an event, but its tail is reported when the script exits — merge it with " +
902
872
  "`2>&1` into a filter if its failures are what you watch for. Every stage of a pipe must flush per line " +
903
873
  "(`grep --line-buffered`, `awk` with `fflush()`), or lines sit in a buffer unseen.\n\n" +
904
874
  "EVERY EVENT IS A TURN OF YOURS, so print only what you would act on — never raw logs. Events are " +
905
- "merged while you work and for 5m after each wake, so a burst costs one turn; but a monitor that prints " +
875
+ "merged while you work and for 5m after each wake, so a burst costs one turn; but a script that prints " +
906
876
  "30 events inside 10m is stopped, and you are told to tighten its filter. Cover the failure signals as " +
907
877
  "well as the success one: silence reads exactly like \"still running\".\n\n" +
908
- "IT RUNS ON THE SERVER, NOT IN YOUR SHELL: `/bin/sh -c` in the project root, with the server's " +
909
- "environment and PATH, stdin closed. Nothing your session exported, no aliases, no functions; use " +
910
- "absolute paths. Registration watches it for 2s: anything it prints by then, or its exit, is in the " +
878
+ "Registration watches a persistent script for 2s: anything it prints by then, or its exit, is in the " +
911
879
  "reply instead of a wake. If Frizz restarts, the script is started again from the top — so make its " +
912
880
  "first lines harmless to repeat (baseline silently, then print only what is new: `tail -n0 -F` starts " +
913
- "at the end of the file). What happened while it was down is the script's to catch up on, or missed.\n\n" +
914
- "IT ENDS when the script exits (you are woken once with the exit code and its last output), when " +
881
+ "at the end of the file). What happened while it was down is the script's to catch up on, or missed. " +
882
+ "It ends when the script exits (you are woken once with the exit code and its last output), when " +
915
883
  "`--for` runs out, or when you drop it. A poll loop that should stop on a known end — a CI run " +
916
- "finishing — exits itself. ONLY ON A THREAD WITH NO PERMISSION CHECKS: Frizz refuses it unless this " +
917
- "thread runs in `bypassPermissions` mode with Claude Code's sandbox off, and refuses it on Codex.\n\n" +
918
- "Name its id in your ```awaiting fence — `commands: [cmw_…]` with `status: watching` — and come to rest. " +
919
- "Idempotent on the exact script text. `list` reads back what is armed; `drop` stops one (so does " +
920
- "`frizzctl unwatch <id>`). Only ever your OWN thread's.",
884
+ "finishing — exits itself.\n\n" +
885
+ "BOTH RUN ON THE SERVER, NOT IN YOUR SHELL: `/bin/sh -c` in the project root, with the server's " +
886
+ "environment and PATH, stdin closed. Nothing your session exported, no aliases, no functions; use " +
887
+ "absolute paths.\n\n" +
888
+ "BOTH ONLY ON A THREAD WITH NO PERMISSION CHECKS. The server runs the command with no permission prompt " +
889
+ "and outside any sandbox, so Frizz refuses it unless this thread runs in `bypassPermissions` mode with " +
890
+ "Claude Code's sandbox off, and refuses it on Codex. The refusal says why; wait in a background shell " +
891
+ "then.\n\n" +
892
+ "When `--for` runs out either one is stopped and you are woken to re-decide. Name its id in your " +
893
+ "```awaiting fence — `monitors: [cmw_…]` with `status: watching`. Registering is idempotent on the " +
894
+ "exact command text. `list` reads back what is armed; `drop` withdraws one and kills a running script " +
895
+ "(so does `frizzctl unwatch <id>`). Only ever your OWN thread's.",
921
896
  inputSchema: {
922
897
  type: "object",
923
898
  properties: {
924
899
  action: {
925
900
  type: "string",
926
901
  enum: ["add", "list", "drop"],
927
- description: "`add` starts a monitor (idempotent per script); `drop` stops one by id; `list` reads back every monitor and command watch armed on this thread.",
902
+ description:
903
+ "`add` registers a monitor (idempotent per command); `drop` withdraws one by id; `list` reads back " +
904
+ "every monitor armed on this thread, with its last check or its events, without changing anything.",
928
905
  },
929
906
  command: {
930
907
  type: "string",
931
908
  description:
932
- "Required for `add`. The script, as one shell command line run with `/bin/sh -c` in the project root. " +
933
- "Each line it prints on stdout is an event. A longer script belongs in a file this line runs.",
909
+ "Required for `add`. One shell command line run with `/bin/sh -c` in the project root: the check, " +
910
+ "whose exit 0 means the condition holds, or with `--persistent` the script, each line of whose " +
911
+ "stdout is an event. A longer script belongs in a file this line runs. Use absolute paths for " +
912
+ "anything not on a plain PATH.",
934
913
  },
935
- description: {
914
+ every: {
936
915
  type: "string",
937
916
  description:
938
- "Required for `add`. What it watches, in a few words, sentence case (\"Errors in deploy.log\", " +
939
- "\"Failed jobs in jobs.ndjson\"): the name the human sees on its row and its drawer, and the label " +
940
- "on every wake. Never the script itself.",
917
+ "Required for `add`, and refused with `--persistent`. How often to check, as a DURATION — `1m`, " +
918
+ "`5m`, `1h` (min 1m, max 24h). Pick it for how soon you need to know: a release in npm's review is " +
919
+ "minutes to hours, so `5m`.",
941
920
  },
942
921
  for: {
943
922
  type: "string",
944
- description: "Required for `add`. How long to keep it running, as a DURATION — `2h`, `1d`, `7d` (max 7d). When it runs out the script is stopped and you are woken once.",
923
+ description:
924
+ "Required for `add`. How long to keep it going, as a DURATION — `2h`, `1d`, `7d` (max 7d). When it " +
925
+ "runs out the monitor is stopped and you are woken to decide what the silence means.",
926
+ },
927
+ persistent: {
928
+ type: "boolean",
929
+ description:
930
+ "Run the command as a script that keeps running, and wake on every line it prints, instead of " +
931
+ "re-running it until it exits 0. Takes `--description` in place of `--every`.",
932
+ },
933
+ description: {
934
+ type: "string",
935
+ description:
936
+ "Required with `--persistent`, and refused without it. What it watches, in a few words, sentence " +
937
+ "case (\"Errors in deploy.log\", \"Failed jobs in jobs.ndjson\"): the name the human sees on its row " +
938
+ "and its drawer, and the label on every wake. Never the script itself.",
945
939
  },
946
940
  id: {
947
941
  type: "string",
@@ -1024,10 +1018,13 @@ const HANDLERS = {
1024
1018
  }
1025
1019
 
1026
1020
  // The slug out of whatever a worker has in hand for a thread: the slug itself, the `[title](/thread/<slug>)`
1027
- // link spawn_thread returns, or a board URL (`…/project/<p>/thread/<slug>/full`) — which also names the
1028
- // thread's project.
1029
- const THREAD_LINK = /\/thread\/([^/?#)\s]+)/
1030
- const PROJECT_LINK = /\/project\/([^/?#)\s]+)\/thread\//
1021
+ // link spawn_thread returns, or a URL the human copied out of the address bar — the thread's full-screen
1022
+ // page (`…/project/<p>/thread/<slug>`, `/full` on one minted before 2026-11-07) or a board with it open in
1023
+ // the drawer (`…/project/<p>?thread=<slug>`). Both also name the thread's project.
1024
+ const THREAD_LINK = /\/thread\/([^/?#)\s]+)|[?&]thread=([^&#)\s]+)/
1025
+ const PROJECT_LINK = /\/project\/([^/?#)\s]+)(?:\/thread\/|[^?#)\s]*\?(?:[^#)\s]*&)?thread=)/
1026
+ // The Console's drawer names a thread by key, `<project>~<slug>` (`/console?thread=billing~retry`).
1027
+ const THREAD_KEY = /^([^~]+)~(.+)$/
1031
1028
  // The project out of any link into a board (`…/project/<p>/…`), for `spawn-thread --project`.
1032
1029
  const PROJECT_SEGMENT = /\/project\/([^/?#)\s]+)/
1033
1030
 
@@ -1038,8 +1035,11 @@ async function steer(args) {
1038
1035
  const message = typeof args.message === "string" ? args.message.trim() : ""
1039
1036
  if (!raw) throw new Error("`to` is required — the slug of the thread to message, or a link naming it")
1040
1037
  if (!message) throw new Error("`message` is required and must be a non-empty string")
1041
- const to = decodeURIComponent(THREAD_LINK.exec(raw)?.[1] ?? raw)
1042
- const linked = PROJECT_LINK.exec(raw)?.[1]
1038
+ const linkedThread = THREAD_LINK.exec(raw)
1039
+ const linkedSlug = decodeURIComponent(linkedThread?.[1] ?? linkedThread?.[2] ?? raw)
1040
+ const keyed = linkedThread ? THREAD_KEY.exec(linkedSlug) : null
1041
+ const to = keyed ? keyed[2] : linkedSlug
1042
+ const linked = PROJECT_LINK.exec(raw)?.[1] ?? (keyed ? encodeURIComponent(keyed[1]) : undefined)
1043
1043
  const named = typeof args.project === "string" ? args.project.trim() : ""
1044
1044
  const project = named || (linked ? decodeURIComponent(linked) : "")
1045
1045
  if (named && linked && decodeURIComponent(linked) !== named) {
@@ -1986,8 +1986,8 @@ async function unwatch(args) {
1986
1986
  if (id.startsWith("cmw_")) {
1987
1987
  const dropped = (await callRpc("dropOwnCommandWatch", { slug, id }))?.result
1988
1988
  const head = dropped?.dropped
1989
- ? `Command watch or monitor ${id} dropped. Frizz will not run it again, and it will not wake you.`
1990
- : `No ARMED command watch or monitor ${id} on this thread — it already ended, expired or was cancelled, or the id is not one of yours.`
1989
+ ? `Monitor ${id} dropped. Frizz will not run it again, and it will not wake you.`
1990
+ : `No ARMED monitor ${id} on this thread — it already ended, expired or was cancelled, or the id is not one of yours.`
1991
1991
  return `${head}\n\n${armedCommandWatchList(dropped)}`
1992
1992
  }
1993
1993
  if (id.startsWith("tmr_")) {
@@ -2130,7 +2130,7 @@ async function done(args) {
2130
2130
  parts.push(
2131
2131
  `${watches.length} registration${watches.length === 1 ? "" : "s"} still armed:\n${watches.join("\n")}\n` +
2132
2132
  "A live wait means the thing you were waiting for has not happened. Wait for it, or drop the ones " +
2133
- "that stopped mattering (`frizzctl unwatch <id>` takes a watch, a PR or issue watcher, a timer, or a command watch).",
2133
+ "that stopped mattering (`frizzctl unwatch <id>` takes a watch, a PR or issue watcher, a timer, or a monitor).",
2134
2134
  )
2135
2135
  }
2136
2136
  parts.push("There is no force flag. Resolve them and run `frizzctl done` again.")
@@ -2232,24 +2232,24 @@ async function watchIssue(args) {
2232
2232
  )
2233
2233
  }
2234
2234
 
2235
- /** The command watches armed on this thread, as every `watch-command` action reads them back.
2235
+ /** The monitors armed on this thread, as every `monitor` action reads them back.
2236
2236
  * @param {{ watches?: Array<{id: string, command: string, every: string, expiresAt: string, runs: number, lastRun?: {outcome: string, exitCode: number|null}}> }|undefined} result */
2237
2237
  function armedCommandWatchList(result) {
2238
2238
  const watches = Array.isArray(result?.watches) ? result.watches : []
2239
- if (!watches.length) return "No command watches or monitors are armed on this thread — none will wake you."
2239
+ if (!watches.length) return "No monitors are armed on this thread — none will wake you."
2240
2240
  const lines = watches.map((w) => {
2241
2241
  if (w.monitor) {
2242
2242
  const events = `${w.monitor.events} event${w.monitor.events === 1 ? "" : "s"} so far`
2243
2243
  const latest = w.monitor.lastEvent ? `, the latest at ${w.monitor.lastEvent.at}: ${firstLine(w.monitor.lastEvent.text)}` : ""
2244
2244
  const label = w.monitor.description ? ` "${w.monitor.description}"` : ""
2245
- return ` ${w.id} monitor${label}, running until ${w.expiresAt} — ${events}${latest}\n $ ${w.command}`
2245
+ return ` ${w.id} persistent${label}, running until ${w.expiresAt} — ${events}${latest}\n $ ${w.command}`
2246
2246
  }
2247
2247
  const last = !w.lastRun
2248
2248
  ? "no check finished yet"
2249
2249
  : `last check ${commandRunClause(w.lastRun)}`
2250
2250
  return ` ${w.id} every ${w.every}, until ${w.expiresAt} — ${w.runs} check${w.runs === 1 ? "" : "s"}, ${last}\n $ ${w.command}`
2251
2251
  })
2252
- return `Command watches and monitors on this thread now:\n${lines.join("\n")}`
2252
+ return `Monitors on this thread now:\n${lines.join("\n")}`
2253
2253
  }
2254
2254
 
2255
2255
  /** One line of an event, short enough for a list. @param {string} text */
@@ -2274,9 +2274,9 @@ function outputTail(output) {
2274
2274
  return `Its output ended:\n${tail.split("\n").map((l) => ` ${l}`).join("\n")}`
2275
2275
  }
2276
2276
 
2277
- /** The `watch_command` handler: register, withdraw, or read back this thread's command watches.
2277
+ /** The `monitor` handler: register, withdraw, or read back this thread's monitors.
2278
2278
  * @param {Record<string, unknown>} args @returns {Promise<string|Refused>} */
2279
- async function watchCommand(args) {
2279
+ async function monitor(args) {
2280
2280
  const slug = threadSlug()
2281
2281
  const action = typeof args.action === "string" ? args.action.trim() : ""
2282
2282
  if (action !== "add" && action !== "list" && action !== "drop") {
@@ -2289,20 +2289,38 @@ async function watchCommand(args) {
2289
2289
 
2290
2290
  if (action === "drop") {
2291
2291
  const id = typeof args.id === "string" ? args.id.trim() : ""
2292
- if (!id) throw new Error("`id` is required to drop a command watch — take it from `add` or from `list`")
2292
+ if (!id) throw new Error("`id` is required to drop a monitor — take it from `add` or from `list`")
2293
2293
  const result = (await callRpc("dropOwnCommandWatch", { slug, id }))?.result
2294
2294
  const head = result?.dropped
2295
- ? `Command watch ${id} dropped. Frizz will not run it again, and it will not wake you.`
2296
- : `No ARMED command watch ${id} on this thread — it already passed, expired or was cancelled, or the id is not one of yours.`
2295
+ ? `Monitor ${id} dropped. Frizz will not run it again, and it will not wake you.`
2296
+ : `No ARMED monitor ${id} on this thread — it already ended, expired or was cancelled, or the id is not one of yours.`
2297
2297
  return `${head}\n\n${armedCommandWatchList(result)}`
2298
2298
  }
2299
2299
 
2300
+ const persistent = args.persistent === true
2300
2301
  const command = typeof args.command === "string" ? args.command.trim() : ""
2301
- if (!command) throw new Error("`command` is required — a shell command that exits 0 once the condition holds")
2302
+ if (!command) {
2303
+ throw new Error(`\`command\` is required — ${persistent ? "a script that keeps running and prints a line per event" : "a shell command that exits 0 once the condition holds"}`)
2304
+ }
2302
2305
  const every = typeof args.every === "string" ? args.every.trim() : ""
2303
- if (!every) throw new Error("`every` is required — how often to check, a DURATION like `5m` (min 1m, max 24h)")
2306
+ const description = typeof args.description === "string" ? args.description.trim() : ""
2307
+ // THE FLAG CHANGES WHAT THE COMMAND HAS TO BE, so neither shape quietly accepts the other's argument: a
2308
+ // cadence on a script would read as if Frizz re-ran it, and a name on a check would go nowhere.
2309
+ if (persistent && every) {
2310
+ throw new Error("`every` does not go with `persistent`: a persistent monitor is one script that keeps running, not a check Frizz re-runs. Drop `every`, or drop `persistent` for a check that exits 0 once the condition holds")
2311
+ }
2312
+ if (!persistent && description) {
2313
+ throw new Error("`description` goes with `persistent`: a check is named by its command. Drop `description`, or add `persistent` for a script that keeps running")
2314
+ }
2315
+ if (!persistent && !every) {
2316
+ throw new Error("`every` is required — how often to check, a DURATION like `5m` (min 1m, max 24h). A script that keeps running and wakes you on every line takes `persistent` instead")
2317
+ }
2304
2318
  const forValue = typeof args.for === "string" ? args.for.trim() : ""
2305
- if (!forValue) throw new Error("`for` is required — how long to keep checking, a DURATION like `6h` or `3d` (max 7d)")
2319
+ if (!forValue) throw new Error("`for` is required — how long to keep it going, a DURATION like `6h` or `3d` (max 7d)")
2320
+ if (persistent) {
2321
+ if (!description) throw new Error("`description` is required with `persistent` — what it watches in a few words (\"Errors in deploy.log\"), the name the human sees on its row")
2322
+ return addPersistentWatch(slug, command, forValue, description)
2323
+ }
2306
2324
  const result = (await callRpc("addOwnCommandWatch", { slug, command, every, for: forValue }))?.result
2307
2325
  // A REFUSAL is the gate doing its job, not a fault: exit 2, with the reason and the background-shell
2308
2326
  // fallback in the server's own words.
@@ -2325,7 +2343,7 @@ async function watchCommand(args) {
2325
2343
  }
2326
2344
  const first = result?.firstRun
2327
2345
  ? result.firstRun.outcome === "timeout"
2328
- ? "Its first check did not finish in time, so Frizz runs it again now with the full 2m."
2346
+ ? "Its first check did not finish in time, so Frizz runs it again now with the full 2m. A script that never exits cannot pass a check: it takes `--persistent`."
2329
2347
  : `Its first check ${commandRunClause(result.firstRun)}. ${outputTail(result.firstRun.output)}`
2330
2348
  : "Frizz runs its first check within the next minute."
2331
2349
  // A CLAMP IS NEWS, as on every other `for` — a worker told nothing rests on coverage it does not have.
@@ -2334,40 +2352,23 @@ async function watchCommand(args) {
2334
2352
  if (result?.clamped?.for) clamps.push(`\`--for ${result.clamped.for}\` was capped at the 7d ceiling`)
2335
2353
  const clamped = clamps.length ? `\n\nYOUR ${clamps.join(", and ")} — what is listed below is what you hold.` : ""
2336
2354
  return (
2337
- `Watching as ${id}: Frizz runs it every ${result?.every} until it exits 0, or until ${result?.expiresAt}, and ` +
2355
+ `Monitoring as ${id}: Frizz runs it every ${result?.every} until it exits 0, or until ${result?.expiresAt}, and ` +
2338
2356
  `then wakes you once with its output. Nothing of yours runs meanwhile.\n\n${first}${clamped}\n\n` +
2339
- `NAME IT IN YOUR \`\`\`awaiting FENCE (\`commands: [${id}]\`, \`status: watching\`) and come to rest. DROP IT ` +
2340
- `when it stops mattering (\`frizzctl watch-command drop ${id}\`).\n\n${armedCommandWatchList(result)}`
2357
+ `NAME IT IN YOUR \`\`\`awaiting FENCE (\`monitors: [${id}]\`, \`status: watching\`) and come to rest. DROP IT ` +
2358
+ `when it stops mattering (\`frizzctl monitor drop ${id}\`).\n\n${armedCommandWatchList(result)}`
2341
2359
  )
2342
2360
  }
2343
2361
 
2344
- /** The `monitor` handler: start, stop, or read back this thread's monitors.
2345
- * @param {Record<string, unknown>} args @returns {Promise<string|Refused>} */
2346
- async function monitor(args) {
2347
- const slug = threadSlug()
2348
- const action = typeof args.action === "string" ? args.action.trim() : ""
2349
- if (action !== "add" && action !== "list" && action !== "drop") {
2350
- throw new Error("`action` must be one of \"add\", \"list\" or \"drop\"")
2351
- }
2352
- if (action === "list") {
2353
- return armedCommandWatchList((await callRpc("listOwnCommandWatches", { slug }))?.result)
2354
- }
2355
- if (action === "drop") {
2356
- const id = typeof args.id === "string" ? args.id.trim() : ""
2357
- if (!id) throw new Error("`id` is required to drop a monitor — take it from `add` or from `list`")
2358
- const result = (await callRpc("dropOwnCommandWatch", { slug, id }))?.result
2359
- const head = result?.dropped
2360
- ? `Monitor ${id} stopped. Its script was killed, and it will not wake you again.`
2361
- : `No ARMED monitor ${id} on this thread — its script already ended, its \`for\` ran out or Frizz stopped it, or the id is not one of yours.`
2362
- return `${head}\n\n${armedCommandWatchList(result)}`
2363
- }
2362
+ /** The `watch_command` handler: RETIRED (2026-11-06). It refuses without calling Frizz, and the refusal is the command.
2363
+ * @returns {Promise<Refused>} */
2364
+ async function watchCommand() {
2365
+ return new Refused(WATCH_COMMAND_RETIRED)
2366
+ }
2364
2367
 
2365
- const command = typeof args.command === "string" ? args.command.trim() : ""
2366
- if (!command) throw new Error("`command` is required — a script that keeps running and prints a line per event")
2367
- const forValue = typeof args.for === "string" ? args.for.trim() : ""
2368
- if (!forValue) throw new Error("`for` is required — how long to keep it running, a DURATION like `6h` or `3d` (max 7d)")
2369
- const description = typeof args.description === "string" ? args.description.trim() : ""
2370
- if (!description) throw new Error("`description` is required — what it watches in a few words (\"Errors in deploy.log\"), the name the human sees on its row")
2368
+ /** `monitor add` with `persistent`: start a script the server keeps running.
2369
+ * @param {string} slug @param {string} command @param {string} forValue @param {string} description
2370
+ * @returns {Promise<string|Refused>} */
2371
+ async function addPersistentWatch(slug, command, forValue, description) {
2371
2372
  const result = (await callRpc("addOwnMonitor", { slug, command, for: forValue, description }))?.result
2372
2373
  const printed = Array.isArray(result?.events) && result.events.length
2373
2374
  ? `\n\nIt printed in its first 2s (handed to you here, not as a wake):\n${result.events.map((e) => e.split("\n").map((l) => ` ${l}`).join("\n")).join("\n")}`
@@ -2379,7 +2380,8 @@ async function monitor(args) {
2379
2380
  if (result?.exited) {
2380
2381
  return (
2381
2382
  `NOTHING IS RUNNING: your script ${commandRunClause(result.exited)} within its first 2s, so the monitor ended ` +
2382
- `as soon as it started. A monitor's script must keep running — loop, tail, or listen.${printed}\n\n${outputTail(result.exited.output)}`
2383
+ `as soon as it started. With \`--persistent\` the script must keep running — loop, tail, or listen. A check ` +
2384
+ `that finishes takes \`--every\` instead.${printed}\n\n${outputTail(result.exited.output)}`
2383
2385
  )
2384
2386
  }
2385
2387
  const id = result?.id ?? "(unknown)"
@@ -2395,7 +2397,7 @@ async function monitor(args) {
2395
2397
  return (
2396
2398
  `Monitoring as ${id}: Frizz keeps your script running until ${result?.expiresAt}, and every line it prints wakes ` +
2397
2399
  `you with that line. Nothing of yours runs meanwhile.${printed}${clamped}\n\n` +
2398
- `NAME IT IN YOUR \`\`\`awaiting FENCE (\`commands: [${id}]\`, \`status: watching\`) and come to rest. STOP IT ` +
2400
+ `NAME IT IN YOUR \`\`\`awaiting FENCE (\`monitors: [${id}]\`, \`status: watching\`) and come to rest. DROP IT ` +
2399
2401
  `when it stops mattering (\`frizzctl monitor drop ${id}\`).\n\n${armedCommandWatchList(result)}`
2400
2402
  )
2401
2403
  }
@@ -2483,25 +2485,21 @@ const CLI = {
2483
2485
  },
2484
2486
  monitor: {
2485
2487
  group: "Waiting",
2486
- summary: "Wake on every line a long-running script prints (a filtered log tail, a poll loop)",
2488
+ summary: "Wake when a command the server re-runs exits 0, or with --persistent on every line a script prints",
2487
2489
  positional: ["action"],
2488
2490
  then: { add: ["command"], drop: ["id"] },
2489
2491
  examples: [
2490
- 'frizzctl monitor add "tail -n0 -F /var/log/app.log | grep --line-buffered -E \'ERROR|FATAL\'" --description "errors in app.log" --for 1d',
2492
+ 'frizzctl monitor add "npm view frizz@0.13.12 version" --every 5m --for 6h',
2493
+ 'frizzctl monitor add "tail -n0 -F /var/log/app.log | grep --line-buffered -E \'ERROR|FATAL\'" --persistent --description "Errors in app.log" --for 1d',
2491
2494
  "frizzctl monitor list",
2492
2495
  "frizzctl monitor drop cmw_ab12cd34ef56",
2493
2496
  ],
2494
2497
  },
2498
+ // RETIRED (2026-11-06): `watch-command` is `monitor` now.
2495
2499
  watch_command: {
2496
- group: "Waiting",
2497
- summary: "Wake when a shell command the server re-runs exits 0 (a version published, a URL up)",
2498
- positional: ["action"],
2499
- then: { add: ["command"], drop: ["id"] },
2500
- examples: [
2501
- 'frizzctl watch-command add "npm view frizz@0.13.12 version" --every 5m --for 6h',
2502
- "frizzctl watch-command list",
2503
- "frizzctl watch-command drop cmw_ab12cd34ef56",
2504
- ],
2500
+ summary: "Retired: it is `frizzctl monitor` now, with the same arguments",
2501
+ retired: WATCH_COMMAND_RETIRED,
2502
+ examples: [],
2505
2503
  },
2506
2504
  timer: {
2507
2505
  group: "Waiting",
@@ -1 +1 @@
1
- import{m as e,t}from"./mermaid-parser.core-BC4Qutkz.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-B-KeW2DM.js";import"./chunk-WYO6CB5R-C1b8f_Ha.js";import"./chunk-VAUOI2AC-DayQueQJ.js";import{n as i,r as a,t as o}from"./chunk-MOJQB5TN-Cn7YFv8n.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
1
+ import{m as e,t}from"./mermaid-parser.core-BIyJ5CJF.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-DLhDEMjC.js";import"./chunk-WYO6CB5R-BouXl6Ea.js";import"./chunk-VAUOI2AC-DpbSQ-0T.js";import{n as i,r as a,t as o}from"./chunk-MOJQB5TN-BGaw_67a.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
@@ -1 +1 @@
1
- import{n as e,t}from"./path-BWPyau1x.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-9O4kNbWa.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
1
+ import{n as e,t}from"./path-BWPyau1x.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-KklTF2b-.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
@@ -0,0 +1 @@
1
+ import"./chunk-KEIR6QF5-BfrZ3jm6.js";import{M as e}from"./mermaid-parser.core-BIyJ5CJF.js";export{e as createArchitectureServices};