frizz-server 0.15.41 → 0.15.43

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 (100) hide show
  1. package/dist/dev-child.js +1417 -477
  2. package/package.json +1 -1
  3. package/runtime/cc-worker/bin/frizzctl.mjs +1 -1
  4. package/runtime/cc-worker/lib/frizz-tools.mjs +307 -7
  5. package/web-dist/assets/{abnfDiagram-VRR7QNED-DZgIn5ff.js → abnfDiagram-VRR7QNED-DZb1taeh.js} +1 -1
  6. package/web-dist/assets/{arc-DwPpA8R3.js → arc-hn35k2HI.js} +1 -1
  7. package/web-dist/assets/architecture-TIHT7OUA-BHGj5CkN.js +1 -0
  8. package/web-dist/assets/{architectureDiagram-ZJ3FMSHR-DbP9lkjM.js → architectureDiagram-ZJ3FMSHR-6QyzD8O3.js} +1 -1
  9. package/web-dist/assets/{blockDiagram-677ZJIJ3-DwQN1M8B.js → blockDiagram-677ZJIJ3-DV1zPeBU.js} +1 -1
  10. package/web-dist/assets/{c4Diagram-LMCZKHZV-BF5QrD37.js → c4Diagram-LMCZKHZV-DovAqz12.js} +1 -1
  11. package/web-dist/assets/channel-DXI8lxvm.js +1 -0
  12. package/web-dist/assets/{chunk-32BRIVSS-CA8c9JxF.js → chunk-32BRIVSS-DvtR4j-C.js} +1 -1
  13. package/web-dist/assets/{chunk-52WLFC77-CdYcy5t0.js → chunk-52WLFC77-DniKgsIc.js} +1 -1
  14. package/web-dist/assets/{chunk-C7G6YPKG-4uxANQmd.js → chunk-C7G6YPKG-BLfDXTkp.js} +1 -1
  15. package/web-dist/assets/{chunk-EX3LRPZG-4wMgoywY.js → chunk-EX3LRPZG-B6AnFQUN.js} +1 -1
  16. package/web-dist/assets/{chunk-FWX5IMBZ-BH3kLM9J.js → chunk-FWX5IMBZ-CucljzDo.js} +2 -2
  17. package/web-dist/assets/{chunk-HOUHSVGY-C6s3cxko.js → chunk-HOUHSVGY-Eii_EemL.js} +1 -1
  18. package/web-dist/assets/{chunk-ICXQ74PX-9fUt4TuP.js → chunk-ICXQ74PX-COVzp5Xd.js} +1 -1
  19. package/web-dist/assets/{chunk-MOJQB5TN-CXZbnRJB.js → chunk-MOJQB5TN-juE3sXKe.js} +1 -1
  20. package/web-dist/assets/{chunk-OGEWGWER-kBUaZg1h.js → chunk-OGEWGWER-Ctnj7hjO.js} +1 -1
  21. package/web-dist/assets/{chunk-PUDLZKDR-T8I9vJeW.js → chunk-PUDLZKDR-DieALR_4.js} +1 -1
  22. package/web-dist/assets/{chunk-Q4XR5HBZ-Bc1e-VQ6.js → chunk-Q4XR5HBZ-CdURCgLS.js} +1 -1
  23. package/web-dist/assets/{chunk-RYQCIY6F-ExoEx5xU.js → chunk-RYQCIY6F-BnZg3wIp.js} +1 -1
  24. package/web-dist/assets/{chunk-V7JOEXUC-BejALgmS.js → chunk-V7JOEXUC-uO2fUZzm.js} +1 -1
  25. package/web-dist/assets/{chunk-VAUOI2AC-DCxTR7U8.js → chunk-VAUOI2AC-CofEt-CQ.js} +1 -1
  26. package/web-dist/assets/{chunk-VR4S4FIN-BukySeYi.js → chunk-VR4S4FIN-9mIXe6Du.js} +1 -1
  27. package/web-dist/assets/{chunk-WYO6CB5R-Bws7hxsV.js → chunk-WYO6CB5R-DX8qax_q.js} +1 -1
  28. package/web-dist/assets/{chunk-XXDRQBXY-DjA78QDQ.js → chunk-XXDRQBXY-C28sBueC.js} +1 -1
  29. package/web-dist/assets/{chunk-ZGVPDNZ5-DKIh9xod.js → chunk-ZGVPDNZ5-BOCPG79n.js} +1 -1
  30. package/web-dist/assets/classDiagram-OUVF2IWQ-D-3vUl4W.js +1 -0
  31. package/web-dist/assets/classDiagram-v2-EOCWNBFH-D-3vUl4W.js +1 -0
  32. package/web-dist/assets/{cose-bilkent-JH36ORCC-C9L1n6fr.js → cose-bilkent-JH36ORCC-CPCiZ8I_.js} +1 -1
  33. package/web-dist/assets/{cynefin-VYW2F7L2-DI26e4Tc.js → cynefin-VYW2F7L2-8xgXFX87.js} +1 -1
  34. package/web-dist/assets/{cynefinDiagram-TSTJHNR4-Cp57PoPj.js → cynefinDiagram-TSTJHNR4-DwVrmsMT.js} +1 -1
  35. package/web-dist/assets/{dagre-VKFMJZFB-DBADVTqD.js → dagre-VKFMJZFB-VfKIjOrh.js} +1 -1
  36. package/web-dist/assets/{diagram-FQU43EPY-0HlOV1mt.js → diagram-FQU43EPY-CfRYwsX4.js} +1 -1
  37. package/web-dist/assets/{diagram-G47NLZAW-DgR5-Pxg.js → diagram-G47NLZAW-LZDctC2c.js} +1 -1
  38. package/web-dist/assets/{diagram-NH7WQ7WH-DoGKoxYE.js → diagram-NH7WQ7WH-B9I9O4q2.js} +1 -1
  39. package/web-dist/assets/{diagram-OA4YK3LP-D5GrLhaq.js → diagram-OA4YK3LP-DyLtLmXq.js} +1 -1
  40. package/web-dist/assets/{diagram-WEI45ONY-DPj7-RdX.js → diagram-WEI45ONY-Cq4XlICY.js} +1 -1
  41. package/web-dist/assets/{dist-Bo2PwwGZ.js → dist-BVACuJBo.js} +1 -1
  42. package/web-dist/assets/{ebnfDiagram-CCIWWBDH-DIXYEkGD.js → ebnfDiagram-CCIWWBDH-CXiLLBrP.js} +1 -1
  43. package/web-dist/assets/{erDiagram-Q63AITRT-Dg3MGwWR.js → erDiagram-Q63AITRT-E4Tq-3uJ.js} +1 -1
  44. package/web-dist/assets/eventmodeling-45OFAUF4-BAy8PeSd.js +1 -0
  45. package/web-dist/assets/flowDiagram-23GEKE2U-D9aeK_Sz.js +1 -0
  46. package/web-dist/assets/{ganttDiagram-NO4QXBWP-BIcCVXZQ.js → ganttDiagram-NO4QXBWP-CV5w3HxN.js} +1 -1
  47. package/web-dist/assets/{gitGraph-TEB2WS4Q-B5RytoFn.js → gitGraph-TEB2WS4Q-Ca8Dwhcu.js} +1 -1
  48. package/web-dist/assets/{gitGraphDiagram-IHSO6WYX-Cb-dT-cW.js → gitGraphDiagram-IHSO6WYX-1S-rnkir.js} +1 -1
  49. package/web-dist/assets/index-BWHvfz4p.css +2 -0
  50. package/web-dist/assets/index-EVfoZw3n.js +377 -0
  51. package/web-dist/assets/{info-DKCQHKI2-GIyDtSFf.js → info-DKCQHKI2-CAprcrba.js} +1 -1
  52. package/web-dist/assets/{infoDiagram-FWYZ7A6U-hajuuFGe.js → infoDiagram-FWYZ7A6U-BVskYXDu.js} +1 -1
  53. package/web-dist/assets/{ishikawaDiagram-FXEZZL3T-DFX-Hnma.js → ishikawaDiagram-FXEZZL3T-GLwxlM0Z.js} +1 -1
  54. package/web-dist/assets/{journeyDiagram-5HDEW3XC-DCAhU4Cx.js → journeyDiagram-5HDEW3XC-CFs0KY4W.js} +1 -1
  55. package/web-dist/assets/{kanban-definition-HUTT4EX6-C3WHlUdK.js → kanban-definition-HUTT4EX6-B1mrGDh-.js} +1 -1
  56. package/web-dist/assets/{line-CSYf7CnT.js → line-CH8_t-Bl.js} +1 -1
  57. package/web-dist/assets/{linear-Di1L0vVF.js → linear-B-zmv10o.js} +1 -1
  58. package/web-dist/assets/{mermaid-parser.core-CudEuGod.js → mermaid-parser.core-C4jXIK12.js} +3 -3
  59. package/web-dist/assets/{mermaid.core-D2s3bQBM.js → mermaid.core-D-5-wAck.js} +3 -3
  60. package/web-dist/assets/{mindmap-definition-LN4V7U3C-yXCjhQFg.js → mindmap-definition-LN4V7U3C-BYpjdopv.js} +1 -1
  61. package/web-dist/assets/{packet-7NZHBO7P-3EcXllio.js → packet-7NZHBO7P-Cjna6hCg.js} +1 -1
  62. package/web-dist/assets/{pegDiagram-2B236MQR-CvS28grz.js → pegDiagram-2B236MQR-DCpSFktT.js} +1 -1
  63. package/web-dist/assets/{pie-RZYD4A2V-CAmA2Snx.js → pie-RZYD4A2V-AOgScQVR.js} +1 -1
  64. package/web-dist/assets/{pieDiagram-ENE6RG2P-BYuB33BI.js → pieDiagram-ENE6RG2P-B3a0v6zL.js} +1 -1
  65. package/web-dist/assets/{quadrantDiagram-ABIIQ3AL-CDnklrlY.js → quadrantDiagram-ABIIQ3AL-CcqK-NK6.js} +1 -1
  66. package/web-dist/assets/{radar-I7S5WNFK-Bz7Vyy1A.js → radar-I7S5WNFK-DtuvXtCm.js} +1 -1
  67. package/web-dist/assets/{railroad-3IZDKUUU-CAUAJCaq.js → railroad-3IZDKUUU-BkqKVzRX.js} +1 -1
  68. package/web-dist/assets/railroad-abnf-AHOZXSZD-CHn7rlun.js +1 -0
  69. package/web-dist/assets/railroad-ebnf-EBAXGLYW-y-9egy8E.js +1 -0
  70. package/web-dist/assets/railroad-peg-LSFZ7HO6-CcjaBCCD.js +1 -0
  71. package/web-dist/assets/{railroadDiagram-RFXS5EU6-DZaYV9Io.js → railroadDiagram-RFXS5EU6-DDHj4uDb.js} +1 -1
  72. package/web-dist/assets/{requirementDiagram-TGXJPOKE-BFlpQunS.js → requirementDiagram-TGXJPOKE-B54HzGZC.js} +1 -1
  73. package/web-dist/assets/{sankeyDiagram-HTMAVEWB-DIOr2M-C.js → sankeyDiagram-HTMAVEWB-3E6dsZaw.js} +1 -1
  74. package/web-dist/assets/{sequenceDiagram-DBY2YBRQ-DpYJiT1u.js → sequenceDiagram-DBY2YBRQ-CVpuzOAQ.js} +1 -1
  75. package/web-dist/assets/{src-BkVLS0R9.js → src-pgycCSL8.js} +1 -1
  76. package/web-dist/assets/{stateDiagram-2N3HPSRC-C4UYGg5g.js → stateDiagram-2N3HPSRC-Cgfbv4Jj.js} +1 -1
  77. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-ROcJdvkR.js +1 -0
  78. package/web-dist/assets/{swimlanes-5IMT3BWC-cJ6KOezW.js → swimlanes-5IMT3BWC-DjH7BeS7.js} +1 -1
  79. package/web-dist/assets/swimlanesDiagram-G3AALYLV-45yhNrvo.js +8 -0
  80. package/web-dist/assets/{timeline-definition-FHXFAJF6-yi-2X9QL.js → timeline-definition-FHXFAJF6-BiHrEvsn.js} +1 -1
  81. package/web-dist/assets/{treeView-QDETBFTQ-Bnlc02cs.js → treeView-QDETBFTQ-BsXOB7X1.js} +1 -1
  82. package/web-dist/assets/{treemap-6X3UGDF4-DUWj2eOS.js → treemap-6X3UGDF4-CEPOvdmd.js} +1 -1
  83. package/web-dist/assets/{vennDiagram-L72KCM5P-jPHNRI-h.js → vennDiagram-L72KCM5P-CmM7sjoE.js} +1 -1
  84. package/web-dist/assets/{wardley-OPB4EBWU-CPbgZ6M1.js → wardley-OPB4EBWU-v6d2b-Ee.js} +1 -1
  85. package/web-dist/assets/{wardleyDiagram-EHGQE667-CrExyaRO.js → wardleyDiagram-EHGQE667-B8zMQrbQ.js} +1 -1
  86. package/web-dist/assets/{xychartDiagram-FW5EYKEG-CN06Wt1I.js → xychartDiagram-FW5EYKEG-BxfsO5vO.js} +1 -1
  87. package/web-dist/index.html +2 -2
  88. package/web-dist/assets/architecture-TIHT7OUA-DaAFvFkn.js +0 -1
  89. package/web-dist/assets/channel-B1iPbzai.js +0 -1
  90. package/web-dist/assets/classDiagram-OUVF2IWQ-DQlurrbL.js +0 -1
  91. package/web-dist/assets/classDiagram-v2-EOCWNBFH-DQlurrbL.js +0 -1
  92. package/web-dist/assets/eventmodeling-45OFAUF4-CeTMJyik.js +0 -1
  93. package/web-dist/assets/flowDiagram-23GEKE2U-QhaJlS-W.js +0 -1
  94. package/web-dist/assets/index-B5PLhSPz.js +0 -375
  95. package/web-dist/assets/index-D_uxez2a.css +0 -2
  96. package/web-dist/assets/railroad-abnf-AHOZXSZD-B9RdcI3r.js +0 -1
  97. package/web-dist/assets/railroad-ebnf-EBAXGLYW-Cimw_4Xu.js +0 -1
  98. package/web-dist/assets/railroad-peg-LSFZ7HO6-DJTpn0sf.js +0 -1
  99. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-CO0mbUgI.js +0 -1
  100. package/web-dist/assets/swimlanesDiagram-G3AALYLV-AkPUIZ-W.js +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frizz-server",
3
- "version": "0.15.41",
3
+ "version": "0.15.43",
4
4
  "private": false,
5
5
  "description": "Replaceable Frizz server runtime",
6
6
  "license": "MIT",
@@ -276,7 +276,7 @@ function topHelp() {
276
276
  }).filter(Boolean)
277
277
  return [
278
278
  `${NAME} — the Frizz command line for the worker of one thread.`,
279
- "Every command acts on the thread whose worker runs it; there is no way to name another.",
279
+ "Every command acts AS the thread whose worker runs it; there is no way to act as another.",
280
280
  "",
281
281
  "Usage:",
282
282
  ` ${NAME} <command> [arguments]`,
@@ -841,10 +841,121 @@ const WATCH_COMMAND = {
841
841
  },
842
842
  }
843
843
 
844
- // WATCH_ISSUE rides at the END (2026-09-14), and SECRET, STEER and WATCH_COMMAND after it: the tool list is read by position
845
- // in frizz-mcp.test.ts, and a worker's runtime reads it by name, so the order costs nothing and appending
844
+ // ONE REGISTRATION, MANY WAKES (2026-11-02): a script the SERVER keeps running, every stdout line a wake.
845
+ // Claude Code's own Monitor tool moved into the server, so it outlives the session's turns and the thread
846
+ // can hibernate under it. A command watch row of kind `monitor`; see packages/server/src/command-watch.ts.
847
+ const MONITOR = {
848
+ name: "monitor",
849
+ description:
850
+ "WAKE ON EVERY LINE A LONG-RUNNING SCRIPT PRINTS. Give Frizz a script that keeps running and prints a " +
851
+ "line each time something happens — a log tail filtered to the lines you would act on, a poll loop that " +
852
+ "prints each new row a query returns, a listener on a socket — and the SERVER runs it for you: every " +
853
+ "line it prints on stdout wakes you with that line, for as long as `--for` lasts. Register once, woken " +
854
+ "many times. Nothing of yours runs meanwhile, so your thread can hibernate while it rests; Claude Code's " +
855
+ "own Monitor tool lives in your session, pins your process tree while it runs, and dies with it. A pull " +
856
+ "request or an issue needs none of this: `watch-pr` and `watch-issue` already wake you on each comment, " +
857
+ "review and check.\n\n" +
858
+ "STDOUT IS THE EVENT STREAM. Lines printed within 200ms of each other are one event; blank lines are " +
859
+ "nothing. Stderr is never an event, but its tail is reported when the script exits — merge it with " +
860
+ "`2>&1` into a filter if its failures are what you watch for. Every stage of a pipe must flush per line " +
861
+ "(`grep --line-buffered`, `awk` with `fflush()`), or lines sit in a buffer unseen.\n\n" +
862
+ "EVERY EVENT IS A TURN OF YOURS, so print only what you would act on — never raw logs. Events are " +
863
+ "merged while you work and for 5m after each wake, so a burst costs one turn; but a monitor that prints " +
864
+ "30 events inside 10m is stopped, and you are told to tighten its filter. Cover the failure signals as " +
865
+ "well as the success one: silence reads exactly like \"still running\".\n\n" +
866
+ "IT RUNS ON THE SERVER, NOT IN YOUR SHELL: `/bin/sh -c` in the project root, with the server's " +
867
+ "environment and PATH, stdin closed. Nothing your session exported, no aliases, no functions; use " +
868
+ "absolute paths. Registration watches it for 2s: anything it prints by then, or its exit, is in the " +
869
+ "reply instead of a wake. If Frizz restarts, the script is started again from the top — so make its " +
870
+ "first lines harmless to repeat (baseline silently, then print only what is new: `tail -n0 -F` starts " +
871
+ "at the end of the file). What happened while it was down is the script's to catch up on, or missed.\n\n" +
872
+ "IT ENDS when the script exits (you are woken once with the exit code and its last output), when " +
873
+ "`--for` runs out, or when you drop it. A poll loop that should stop on a known end — a CI run " +
874
+ "finishing — exits itself. ONLY ON A THREAD WITH NO PERMISSION CHECKS: Frizz refuses it unless this " +
875
+ "thread runs in `bypassPermissions` mode with Claude Code's sandbox off, and refuses it on Codex.\n\n" +
876
+ "Name its id in your ```awaiting fence — `commands: [cmw_…]` with `status: watching` — and come to rest. " +
877
+ "Idempotent on the exact script text. `list` reads back what is armed; `drop` stops one (so does " +
878
+ "`frizzctl unwatch <id>`). Only ever your OWN thread's.",
879
+ inputSchema: {
880
+ type: "object",
881
+ properties: {
882
+ action: {
883
+ type: "string",
884
+ enum: ["add", "list", "drop"],
885
+ 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.",
886
+ },
887
+ command: {
888
+ type: "string",
889
+ description:
890
+ "Required for `add`. The script, as one shell command line run with `/bin/sh -c` in the project root. " +
891
+ "Each line it prints on stdout is an event. A longer script belongs in a file this line runs.",
892
+ },
893
+ description: {
894
+ type: "string",
895
+ description:
896
+ "Required for `add`. What it watches, in a few words, sentence case (\"Errors in deploy.log\", " +
897
+ "\"Failed jobs in jobs.ndjson\"): the name the human sees on its row and its drawer, and the label " +
898
+ "on every wake. Never the script itself.",
899
+ },
900
+ for: {
901
+ type: "string",
902
+ 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.",
903
+ },
904
+ id: {
905
+ type: "string",
906
+ description: "Required for `drop`. The `cmw_…` id `add` printed (or that `list` and `frizzctl activity` show).",
907
+ },
908
+ },
909
+ required: ["action"],
910
+ },
911
+ }
912
+
913
+ // A BOARD'S THREADS, as another agent reads them (2026-11-03). Until then a worker could message any
914
+ // thread on the machine (`steer`) and start one anywhere (`spawn-thread`), but had no way to see which
915
+ // threads exist, what they are called, or whether they are working, waiting or finished — so it could not
916
+ // find the thread already on its bug, or the slug of the one it should tell. packages/server/src/
917
+ // thread-listing.ts is the readout; the band in it is the sidebar's own.
918
+ const THREADS = {
919
+ name: "threads",
920
+ description:
921
+ "LIST THE THREADS ON A BOARD — your own project's, or any other project this Frizz serves — each by " +
922
+ "its slug, the title the human's sidebar shows, and where it sits on the board:\n\n" +
923
+ " rested — in the human's QUEUE: it came to rest with a card waiting on them (a question, a " +
924
+ "handoff, finished work, a failure).\n" +
925
+ " active — open with no card, in practice SPINNING: a turn in flight, or its own sub-agents, " +
926
+ "shells or CI still running.\n" +
927
+ " snoozed — PARKED: the human snoozed it, or its worker rested on something outside the thread " +
928
+ "(a review, a release, a timer).\n" +
929
+ " done — archived. Left out unless `--all`, because on a long-lived board it is nearly every " +
930
+ "thread; the count is always printed.\n\n" +
931
+ "Each row also says what the thread is doing right now (the tool call in flight), the first line of " +
932
+ "its newest message, what it is waiting on (sub-agents, shells, watched PRs, open questions), and how " +
933
+ "long ago it last moved.\n\n" +
934
+ "USE IT BEFORE YOU DUPLICATE SOMEONE'S WORK, AND TO FIND WHO TO TELL. Another thread may already be on " +
935
+ "the bug you just found, or waiting on the commit you just landed; the slug in the first column is " +
936
+ "what `frizzctl steer` takes (with `--project` for a thread on another board).\n\n" +
937
+ "`--json` prints the whole listing — every field, ISO timestamps — for `jq`. It only reads: nothing is " +
938
+ "changed, and no thread is woken by being listed.",
939
+ inputSchema: {
940
+ type: "object",
941
+ properties: {
942
+ project: {
943
+ type: "string",
944
+ description:
945
+ "Another project's board: its slug, as its board URL shows it (`/project/<slug>/…`), or any link " +
946
+ "into that board. Omitted ⇒ your own project.",
947
+ },
948
+ all: { type: "boolean", description: "Also list the Done band — every archived thread, newest first." },
949
+ json: { type: "boolean", description: "Print the listing as JSON instead of text." },
950
+ },
951
+ required: [],
952
+ },
953
+ }
954
+
955
+ // WATCH_ISSUE rides at the END (2026-09-14), and SECRET, STEER, WATCH_COMMAND, MONITOR and THREADS after it: the tool list is
956
+ // read by position in frizz-mcp.test.ts, and a worker's runtime reads it by name, so the order costs nothing and appending
846
957
  // breaks nothing.
847
- const TOOLS = [SPAWN_THREAD, GOAL, TIMER, WATCH_PR, WATCH, UNWATCH, ASK, UNASK, DONE, TITLE, ACTIVITY, LINK, UNLINK, WATCH_ISSUE, SECRET, STEER, WATCH_COMMAND]
958
+ const TOOLS = [SPAWN_THREAD, GOAL, TIMER, WATCH_PR, WATCH, UNWATCH, ASK, UNASK, DONE, TITLE, ACTIVITY, LINK, UNLINK, WATCH_ISSUE, SECRET, STEER, WATCH_COMMAND, MONITOR, THREADS]
848
959
 
849
960
  /** @type {Record<string, (args: Record<string, unknown>) => Promise<string>>} */
850
961
  const HANDLERS = {
@@ -865,6 +976,8 @@ const HANDLERS = {
865
976
  [UNLINK.name]: unlink,
866
977
  [STEER.name]: steer,
867
978
  [WATCH_COMMAND.name]: watchCommand,
979
+ [MONITOR.name]: monitor,
980
+ [THREADS.name]: threads,
868
981
  }
869
982
 
870
983
  // The slug out of whatever a worker has in hand for a thread: the slug itself, the `[title](/thread/<slug>)`
@@ -908,6 +1021,105 @@ async function steer(args) {
908
1021
  )
909
1022
  }
910
1023
 
1024
+ /** The `threads` handler: one board's threads, from this project's `listThreads`, which finds the other
1025
+ * project itself when one is named (as `steer` and `spawn-thread --project` do).
1026
+ * @param {Record<string, unknown>} args @returns {Promise<string>} */
1027
+ async function threads(args) {
1028
+ const raw = typeof args.project === "string" ? args.project.trim() : ""
1029
+ const project = raw ? decodeURIComponent(PROJECT_SEGMENT.exec(raw)?.[1] ?? raw) : ""
1030
+ const result = (await callRpc("listThreads", { ...(project ? { project } : {}), ...(args.all === true ? { all: true } : {}) }))?.result
1031
+ if (!result?.project || !Array.isArray(result.threads) || !result.counts) {
1032
+ throw new Error(`listThreads returned no listing: ${JSON.stringify(result)?.slice(0, 300)}`)
1033
+ }
1034
+ if (args.json === true) return JSON.stringify(result, null, 2)
1035
+ // THE CALLER IS MARKED, not left out: a worker reading its own board should see itself where the human
1036
+ // sees it. Optional — a shell with no thread can list a board too, and simply has no row to mark.
1037
+ const own = !project || result.project.id === projectSegment()
1038
+ const caller = own ? process.env.FRIZZ_THREAD_SLUG || process.env.FRIZZ_THREAD || "" : ""
1039
+ return threadsReport(result, { caller, all: args.all === true, nowMs: Date.now() })
1040
+ }
1041
+
1042
+ const BAND_HEADINGS = {
1043
+ rested: "Rested — in the human's queue",
1044
+ active: "Active — spinning",
1045
+ snoozed: "Snoozed — parked",
1046
+ done: "Done — archived",
1047
+ }
1048
+
1049
+ /** How long ago an instant was, in the house duration grammar (`40m`, `2h 35m`, `3d 4h`; see
1050
+ * `packages/web/src/lib/durationLabels.ts`). @param {string|undefined} iso @param {number} nowMs */
1051
+ function agoLabel(iso, nowMs) {
1052
+ const at = Date.parse(iso ?? "")
1053
+ if (!Number.isFinite(at)) return undefined
1054
+ const s = Math.max(0, Math.floor((nowMs - at) / 1000))
1055
+ if (s < 60) return `${s}s`
1056
+ const m = Math.floor(s / 60)
1057
+ if (m < 60) return `${m}m`
1058
+ const h = Math.floor(m / 60)
1059
+ if (h < 24) return m % 60 ? `${h}h ${m % 60}m` : `${h}h`
1060
+ const d = Math.floor(h / 24)
1061
+ if (d < 7) return h % 24 ? `${d}d ${h % 24}h` : `${d}d`
1062
+ if (d < 30) return `${Math.floor(d / 7)}w`
1063
+ if (d < 365) return `${Math.floor(d / 30)}mo`
1064
+ return `${Math.floor(d / 365)}y`
1065
+ }
1066
+
1067
+ const plural = (/** @type {number} */ n, /** @type {string} */ one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`
1068
+
1069
+ /** One thread's facts line: what it is doing or waiting on, and when it last moved.
1070
+ * @param {any} t @param {number} nowMs */
1071
+ function threadFacts(t, nowMs) {
1072
+ const facts = []
1073
+ if (t.runtime === "running" || t.runtime === "spawning") facts.push(t.doing ? `turn in flight: ${t.doing}` : "turn in flight")
1074
+ if (t.runtime === "perm-prompt") facts.push("on a permission prompt")
1075
+ if (t.questions > 0) facts.push(`${plural(t.questions, "question")} open`)
1076
+ if (t.subAgents > 0) facts.push(`${plural(t.subAgents, "sub-agent")} running`)
1077
+ if (t.shells > 0) facts.push(`${plural(t.shells, "shell")} running`)
1078
+ for (const w of t.watches ?? []) facts.push(`watching ${w}`)
1079
+ if (t.limited) facts.push("stopped by a usage limit")
1080
+ else if (t.crashed) facts.push("crashed mid-turn")
1081
+ else if (t.runtime === "exited" && t.band !== "done" && t.fence !== "done") facts.push("worker exited")
1082
+ if (t.fence === "done") facts.push("signed off done")
1083
+ // An awaiting fence on a QUEUED thread is a handoff (`needs_input`, `steps:`); elsewhere it is the park
1084
+ // the band already states, and the watches above already name what it is parked on.
1085
+ else if (t.fence === "awaiting" && t.band === "rested") facts.push("handed off to the human")
1086
+ if (t.snoozedUntil) facts.push(`snoozed until ${t.snoozedUntil}`)
1087
+ const moved = t.band === "done"
1088
+ ? agoLabel(t.archivedAt ?? t.lastActivityAt, nowMs)
1089
+ : agoLabel(t.lastActivityAt ?? t.restedAt ?? t.spawnedAt, nowMs)
1090
+ if (moved) facts.push(`${t.band === "done" ? "archived" : "last moved"} ${moved} ago`)
1091
+ return facts.join(" · ")
1092
+ }
1093
+
1094
+ /** The text readout: a count line, then one block per band, one thread per two or three lines.
1095
+ * @param {any} result @param {{ caller: string, all: boolean, nowMs: number }} opts */
1096
+ function threadsReport(result, { caller, all, nowMs }) {
1097
+ const { counts } = result
1098
+ const open = counts.rested + counts.active + counts.snoozed
1099
+ const tally = [`${counts.rested} rested`, `${counts.active} active`, `${counts.snoozed} snoozed`].join(", ")
1100
+ const doneNote = all ? `${counts.done} done` : `${counts.done} done, not listed (\`--all\` lists them)`
1101
+ const head = `${result.project.name} (\`${result.project.slug}\`) — ${plural(open, "open thread")} (${tally}); ${doneNote}.`
1102
+ if (result.threads.length === 0) return `${head}\n\nNothing to list.`
1103
+ const blocks = []
1104
+ for (const band of ["rested", "active", "snoozed", "done"]) {
1105
+ const rows = result.threads.filter((/** @type {any} */ t) => t.band === band)
1106
+ if (!rows.length) continue
1107
+ const lines = rows.map((/** @type {any} */ t) => {
1108
+ const mark = [t.slug === caller ? "this thread" : "", t.pinned ? "pinned" : ""].filter(Boolean).join(", ")
1109
+ const out = [` ${t.slug} ${t.title}${mark ? ` (${mark})` : ""}`]
1110
+ const facts = threadFacts(t, nowMs)
1111
+ if (facts) out.push(` ${facts}`)
1112
+ if (t.lastLine) out.push(` > ${t.lastLine.replace(/\s+/g, " ").slice(0, 160)}`)
1113
+ return out.join("\n")
1114
+ })
1115
+ blocks.push(`${BAND_HEADINGS[/** @type {keyof typeof BAND_HEADINGS} */ (band)]}\n${lines.join("\n")}`)
1116
+ }
1117
+ const steerHint = result.project.id === projectSegment()
1118
+ ? "Message one with `frizzctl steer <slug>`."
1119
+ : `Message one with \`frizzctl steer <slug> --project ${result.project.slug}\`.`
1120
+ return `${head}\n\n${blocks.join("\n\n")}\n\n${steerHint} \`--json\` prints every field.`
1121
+ }
1122
+
911
1123
  /** @param {Record<string, unknown>} args @returns {Promise<string>} */
912
1124
  async function link(args) {
913
1125
  const label = typeof args.label === "string" ? args.label.trim() : ""
@@ -1700,8 +1912,8 @@ async function unwatch(args) {
1700
1912
  if (id.startsWith("cmw_")) {
1701
1913
  const dropped = (await callRpc("dropOwnCommandWatch", { slug, id }))?.result
1702
1914
  const head = dropped?.dropped
1703
- ? `Command watch ${id} dropped. Frizz will not run it again, and it will not wake you.`
1704
- : `No ARMED command watch ${id} on this thread — it already passed, expired or was cancelled, or the id is not one of yours.`
1915
+ ? `Command watch or monitor ${id} dropped. Frizz will not run it again, and it will not wake you.`
1916
+ : `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.`
1705
1917
  return `${head}\n\n${armedCommandWatchList(dropped)}`
1706
1918
  }
1707
1919
  if (id.startsWith("tmr_")) {
@@ -1950,14 +2162,26 @@ async function watchIssue(args) {
1950
2162
  * @param {{ watches?: Array<{id: string, command: string, every: string, expiresAt: string, runs: number, lastRun?: {outcome: string, exitCode: number|null}}> }|undefined} result */
1951
2163
  function armedCommandWatchList(result) {
1952
2164
  const watches = Array.isArray(result?.watches) ? result.watches : []
1953
- if (!watches.length) return "No command watches are armed on this thread — none will wake you."
2165
+ if (!watches.length) return "No command watches or monitors are armed on this thread — none will wake you."
1954
2166
  const lines = watches.map((w) => {
2167
+ if (w.monitor) {
2168
+ const events = `${w.monitor.events} event${w.monitor.events === 1 ? "" : "s"} so far`
2169
+ const latest = w.monitor.lastEvent ? `, the latest at ${w.monitor.lastEvent.at}: ${firstLine(w.monitor.lastEvent.text)}` : ""
2170
+ const label = w.monitor.description ? ` "${w.monitor.description}"` : ""
2171
+ return ` ${w.id} monitor${label}, running until ${w.expiresAt} — ${events}${latest}\n $ ${w.command}`
2172
+ }
1955
2173
  const last = !w.lastRun
1956
2174
  ? "no check finished yet"
1957
2175
  : `last check ${commandRunClause(w.lastRun)}`
1958
2176
  return ` ${w.id} every ${w.every}, until ${w.expiresAt} — ${w.runs} check${w.runs === 1 ? "" : "s"}, ${last}\n $ ${w.command}`
1959
2177
  })
1960
- return `Command watches on this thread now:\n${lines.join("\n")}`
2178
+ return `Command watches and monitors on this thread now:\n${lines.join("\n")}`
2179
+ }
2180
+
2181
+ /** One line of an event, short enough for a list. @param {string} text */
2182
+ function firstLine(text) {
2183
+ const line = String(text ?? "").split("\n")[0].trim()
2184
+ return line.length > 120 ? `${line.slice(0, 119)}…` : line
1961
2185
  }
1962
2186
 
1963
2187
  /** "exited 1", "timed out", … — how one check ended. @param {{outcome: string, exitCode: number|null}} run */
@@ -2043,6 +2267,65 @@ async function watchCommand(args) {
2043
2267
  )
2044
2268
  }
2045
2269
 
2270
+ /** The `monitor` handler: start, stop, or read back this thread's monitors.
2271
+ * @param {Record<string, unknown>} args @returns {Promise<string|Refused>} */
2272
+ async function monitor(args) {
2273
+ const slug = threadSlug()
2274
+ const action = typeof args.action === "string" ? args.action.trim() : ""
2275
+ if (action !== "add" && action !== "list" && action !== "drop") {
2276
+ throw new Error("`action` must be one of \"add\", \"list\" or \"drop\"")
2277
+ }
2278
+ if (action === "list") {
2279
+ return armedCommandWatchList((await callRpc("listOwnCommandWatches", { slug }))?.result)
2280
+ }
2281
+ if (action === "drop") {
2282
+ const id = typeof args.id === "string" ? args.id.trim() : ""
2283
+ if (!id) throw new Error("`id` is required to drop a monitor — take it from `add` or from `list`")
2284
+ const result = (await callRpc("dropOwnCommandWatch", { slug, id }))?.result
2285
+ const head = result?.dropped
2286
+ ? `Monitor ${id} stopped. Its script was killed, and it will not wake you again.`
2287
+ : `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.`
2288
+ return `${head}\n\n${armedCommandWatchList(result)}`
2289
+ }
2290
+
2291
+ const command = typeof args.command === "string" ? args.command.trim() : ""
2292
+ if (!command) throw new Error("`command` is required — a script that keeps running and prints a line per event")
2293
+ const forValue = typeof args.for === "string" ? args.for.trim() : ""
2294
+ if (!forValue) throw new Error("`for` is required — how long to keep it running, a DURATION like `6h` or `3d` (max 7d)")
2295
+ const description = typeof args.description === "string" ? args.description.trim() : ""
2296
+ 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")
2297
+ const result = (await callRpc("addOwnMonitor", { slug, command, for: forValue, description }))?.result
2298
+ const printed = Array.isArray(result?.events) && result.events.length
2299
+ ? `\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")}`
2300
+ : ""
2301
+ if (result?.refused) {
2302
+ const ran = result.exited ? `\n\n${outputTail(result.exited.output)}` : ""
2303
+ return new Refused(`NOT registered. ${result.refused}${printed}${ran}`)
2304
+ }
2305
+ if (result?.exited) {
2306
+ return (
2307
+ `NOTHING IS RUNNING: your script ${commandRunClause(result.exited)} within its first 2s, so the monitor ended ` +
2308
+ `as soon as it started. A monitor's script must keep running — loop, tail, or listen.${printed}\n\n${outputTail(result.exited.output)}`
2309
+ )
2310
+ }
2311
+ const id = result?.id ?? "(unknown)"
2312
+ if (result?.alreadyArmed) {
2313
+ return (
2314
+ `Already running this script as ${id} (until ${result.expiresAt}) — nothing new was started, and its ` +
2315
+ `original expiry stands.\n\n${armedCommandWatchList(result)}`
2316
+ )
2317
+ }
2318
+ const clamped = result?.clamped?.for
2319
+ ? `\n\nYOUR \`--for ${result.clamped.for}\` was capped at the 7d ceiling — what is listed below is what you hold.`
2320
+ : ""
2321
+ return (
2322
+ `Monitoring as ${id}: Frizz keeps your script running until ${result?.expiresAt}, and every line it prints wakes ` +
2323
+ `you with that line. Nothing of yours runs meanwhile.${printed}${clamped}\n\n` +
2324
+ `NAME IT IN YOUR \`\`\`awaiting FENCE (\`commands: [${id}]\`, \`status: watching\`) and come to rest. STOP IT ` +
2325
+ `when it stops mattering (\`frizzctl monitor drop ${id}\`).\n\n${armedCommandWatchList(result)}`
2326
+ )
2327
+ }
2328
+
2046
2329
  /**
2047
2330
  * HOW EACH COMMAND IS SPELLED ON A COMMAND LINE. The schema above already says what a command takes;
2048
2331
  * this says the three things a schema cannot:
@@ -2124,6 +2407,17 @@ const CLI = {
2124
2407
  then: { add: ["target"], drop: ["id"] },
2125
2408
  examples: ["frizzctl watch-issue add acme/app#482 --for 30d", "frizzctl watch-issue list", "frizzctl watch-issue drop isw_ab12cd34"],
2126
2409
  },
2410
+ monitor: {
2411
+ group: "Waiting",
2412
+ summary: "Wake on every line a long-running script prints (a filtered log tail, a poll loop)",
2413
+ positional: ["action"],
2414
+ then: { add: ["command"], drop: ["id"] },
2415
+ examples: [
2416
+ 'frizzctl monitor add "tail -n0 -F /var/log/app.log | grep --line-buffered -E \'ERROR|FATAL\'" --description "errors in app.log" --for 1d',
2417
+ "frizzctl monitor list",
2418
+ "frizzctl monitor drop cmw_ab12cd34ef56",
2419
+ ],
2420
+ },
2127
2421
  watch_command: {
2128
2422
  group: "Waiting",
2129
2423
  summary: "Wake when a shell command the server re-runs exits 0 (a version published, a URL up)",
@@ -2174,6 +2468,12 @@ const CLI = {
2174
2468
  positional: ["id"],
2175
2469
  examples: ["frizzctl unlink lnk_ab12cd34"],
2176
2470
  },
2471
+ threads: {
2472
+ group: "Other threads",
2473
+ summary: "List a project's threads: each one's slug, title and where it sits on the board",
2474
+ positional: ["project"],
2475
+ examples: ["frizzctl threads", "frizzctl threads nub", "frizzctl threads --all --json"],
2476
+ },
2177
2477
  steer: {
2178
2478
  group: "Other threads",
2179
2479
  summary: "Send a message into another thread, in any project",
@@ -1 +1 @@
1
- import{m as e,t}from"./mermaid-parser.core-CudEuGod.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-BkVLS0R9.js";import"./chunk-WYO6CB5R-Bws7hxsV.js";import"./chunk-VAUOI2AC-DCxTR7U8.js";import{n as i,r as a,t as o}from"./chunk-MOJQB5TN-CXZbnRJB.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-C4jXIK12.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-pgycCSL8.js";import"./chunk-WYO6CB5R-DX8qax_q.js";import"./chunk-VAUOI2AC-CofEt-CQ.js";import{n as i,r as a,t as o}from"./chunk-MOJQB5TN-juE3sXKe.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-Bo2PwwGZ.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-BVACuJBo.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-C4jXIK12.js";export{e as createArchitectureServices};