frizz-server 0.15.60 → 0.15.62

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 (104) hide show
  1. package/dist/acp-daemon.js +4 -1
  2. package/dist/claude-agent-broker.js +6081 -5888
  3. package/dist/dev-child.js +16033 -13758
  4. package/package.json +1 -1
  5. package/runtime/cc-worker/DECISIONS.md +1 -1
  6. package/runtime/cc-worker/hooks/agent-bind.mjs +3 -1
  7. package/runtime/cc-worker/hooks/agent-dispatch.mjs +26 -3
  8. package/runtime/cc-worker/hooks/scratchpad.mjs +7 -2
  9. package/runtime/cc-worker/hooks/session-seed.mjs +6 -5
  10. package/runtime/cc-worker/lib/frizz-tools.mjs +2 -2
  11. package/runtime/cc-worker/lib/project-frizz-dir.mjs +59 -0
  12. package/web-dist/assets/{abnfDiagram-VCTEODGH-BwQAHYsL.js → abnfDiagram-VCTEODGH-B23viQiP.js} +1 -1
  13. package/web-dist/assets/architecture-7GRP2DOG-CNcdaCCI.js +1 -0
  14. package/web-dist/assets/{architectureDiagram-5GKGNRK7-gjqwTfQ1.js → architectureDiagram-5GKGNRK7-D8USefah.js} +1 -1
  15. package/web-dist/assets/{blockDiagram-I7D4REHJ-fFMe18t3.js → blockDiagram-I7D4REHJ-BtjLcrYi.js} +1 -1
  16. package/web-dist/assets/{c4Diagram-7LVT6UL2-BEqZdMzx.js → c4Diagram-7LVT6UL2-F76BIBsA.js} +1 -1
  17. package/web-dist/assets/channel-Ba68GPpA.js +1 -0
  18. package/web-dist/assets/{chunk-2E4U76K2-TbSfuA0I.js → chunk-2E4U76K2-CU1HWazS.js} +1 -1
  19. package/web-dist/assets/{chunk-4HAMMTFA-CVNkWrgU.js → chunk-4HAMMTFA-UxW05P_i.js} +1 -1
  20. package/web-dist/assets/{chunk-75Z2AOVW-Dizdh1uU.js → chunk-75Z2AOVW-hVVY0e1L.js} +1 -1
  21. package/web-dist/assets/{chunk-CLGD4ZFX-DBrOrKI3.js → chunk-CLGD4ZFX-C1O2SPPZ.js} +1 -1
  22. package/web-dist/assets/{chunk-DU6HZSFF-DjCzKTaE.js → chunk-DU6HZSFF-mBBDvwET.js} +1 -1
  23. package/web-dist/assets/{chunk-F27PBJKO-VCtsiMCI.js → chunk-F27PBJKO-YFj-bXUU.js} +1 -1
  24. package/web-dist/assets/{chunk-GMAD6QVW-uzzwIr1d.js → chunk-GMAD6QVW-DEtmMJEi.js} +1 -1
  25. package/web-dist/assets/{chunk-GVQU2GXP-DQH5EZ5s.js → chunk-GVQU2GXP-CJ12GvUv.js} +1 -1
  26. package/web-dist/assets/{chunk-IMKFNOWR-COkZXqzQ.js → chunk-IMKFNOWR-BWv1ipDL.js} +1 -1
  27. package/web-dist/assets/{chunk-L3NEJ4N5-C_q84AOx.js → chunk-L3NEJ4N5-CUhs1eCv.js} +1 -1
  28. package/web-dist/assets/{chunk-OSK3NFVY-U6VeVgyM.js → chunk-OSK3NFVY-wJEfgmTH.js} +1 -1
  29. package/web-dist/assets/{chunk-P2QGCYS3-7wuYNJ3b.js → chunk-P2QGCYS3-DUXmdiIi.js} +1 -1
  30. package/web-dist/assets/{chunk-POPQ4Y6H-DxG-N6Oe.js → chunk-POPQ4Y6H-DWV_sMOc.js} +1 -1
  31. package/web-dist/assets/{chunk-PWAF6VOD-BopeAnHr.js → chunk-PWAF6VOD-CI718SMM.js} +1 -1
  32. package/web-dist/assets/{chunk-SHT3W25Y-DAfLIYJT.js → chunk-SHT3W25Y-DnZEwNll.js} +1 -1
  33. package/web-dist/assets/{chunk-SVP7TREG-NJUBCeXl.js → chunk-SVP7TREG-DXl-FEaS.js} +1 -1
  34. package/web-dist/assets/{chunk-TICWLB2K-C1rRaKxH.js → chunk-TICWLB2K-DzrPNrL4.js} +1 -1
  35. package/web-dist/assets/{chunk-TLUHSLCS-DaglE7Ch.js → chunk-TLUHSLCS-cWeDLf7m.js} +2 -2
  36. package/web-dist/assets/classDiagram-ZZMXUADV-BIl8IrqN.js +1 -0
  37. package/web-dist/assets/classDiagram-v2-VYDZK3BY-BIl8IrqN.js +1 -0
  38. package/web-dist/assets/{cynefin-OW5HDTMX-B89A3TDp.js → cynefin-OW5HDTMX-CGivvV6j.js} +1 -1
  39. package/web-dist/assets/{cynefinDiagram-5FMLGOSQ-DmPIJ48s.js → cynefinDiagram-5FMLGOSQ-DA6ojANA.js} +1 -1
  40. package/web-dist/assets/{dagre-GXQ25YYZ-BPkCt9-V.js → dagre-GXQ25YYZ-BxTkg-lK.js} +1 -1
  41. package/web-dist/assets/{diagram-S7CK7UJ4-BTN_VTGQ.js → diagram-S7CK7UJ4-C8Hpstlc.js} +1 -1
  42. package/web-dist/assets/{diagram-UQ7AKVKN-DTvxPveF.js → diagram-UQ7AKVKN-BDm_PZpG.js} +1 -1
  43. package/web-dist/assets/{diagram-VSXAHHWV-BfH1hxIh.js → diagram-VSXAHHWV-RArgMOsc.js} +1 -1
  44. package/web-dist/assets/{diagram-VX7I27RA-BKB1mNd7.js → diagram-VX7I27RA-DSU_8ZkT.js} +1 -1
  45. package/web-dist/assets/{diagram-Z3DM3KII-Jc86CE2n.js → diagram-Z3DM3KII-BPbq1Sjk.js} +1 -1
  46. package/web-dist/assets/{ebnfDiagram-PWID7BFC-DhwMQBQE.js → ebnfDiagram-PWID7BFC-CxJgw_Ch.js} +1 -1
  47. package/web-dist/assets/{erDiagram-RLTQ6QDP-xZnP9dEA.js → erDiagram-RLTQ6QDP-C4Axha71.js} +1 -1
  48. package/web-dist/assets/eventmodeling-NTZA5JFV-Cye0HMxq.js +1 -0
  49. package/web-dist/assets/flowDiagram-HODETNUW-D-RU7U_9.js +1 -0
  50. package/web-dist/assets/{ganttDiagram-EL5Y4UJY-C30gGDDk.js → ganttDiagram-EL5Y4UJY-B0nxZ4Xc.js} +1 -1
  51. package/web-dist/assets/{gitGraph-4MIJSDKK-DQ6JKkWt.js → gitGraph-4MIJSDKK--aikGW2W.js} +1 -1
  52. package/web-dist/assets/{gitGraphDiagram-WWUBYQGX-CODdenHT.js → gitGraphDiagram-WWUBYQGX-BooAol-_.js} +1 -1
  53. package/web-dist/assets/index-BytW7hzV.css +2 -0
  54. package/web-dist/assets/index-OwSaXs6C.js +264 -0
  55. package/web-dist/assets/{info-A6RAGUB7-BVM1FcDF.js → info-A6RAGUB7-pI1TzLwA.js} +1 -1
  56. package/web-dist/assets/{infoDiagram-27XIBGKW-N9riiSX1.js → infoDiagram-27XIBGKW-M-kZYy18.js} +1 -1
  57. package/web-dist/assets/{ishikawaDiagram-5VMMS53U-DZo-3Ren.js → ishikawaDiagram-5VMMS53U-DF0j9Mru.js} +1 -1
  58. package/web-dist/assets/{journeyDiagram-3NMN7TZE-DH_xLuG3.js → journeyDiagram-3NMN7TZE-CuJaKMi7.js} +1 -1
  59. package/web-dist/assets/{kanban-definition-UXKFOSKX-B0jAyaHC.js → kanban-definition-UXKFOSKX-BW_bR4jD.js} +1 -1
  60. package/web-dist/assets/{line-CmTICjTN.js → line-C4nu-MyE.js} +1 -1
  61. package/web-dist/assets/{mermaid-parser.core-C1daiAo7.js → mermaid-parser.core-D4YANiO2.js} +3 -3
  62. package/web-dist/assets/{mermaid.core-DKpwa1E9.js → mermaid.core-B0rUdjKb.js} +3 -3
  63. package/web-dist/assets/{mindmap-definition-YA3MSWOX-DTYSSqMy.js → mindmap-definition-YA3MSWOX-C-oMLpqe.js} +1 -1
  64. package/web-dist/assets/{packet-AYTQ26CC-BzOI2NMN.js → packet-AYTQ26CC-C6UAHcr2.js} +1 -1
  65. package/web-dist/assets/{pegDiagram-XKGWAZYB-Cc2BVx67.js → pegDiagram-XKGWAZYB-5jrVGkld.js} +1 -1
  66. package/web-dist/assets/{pie-WAS4IAKB-G3kJB69v.js → pie-WAS4IAKB-D4F4ioaC.js} +1 -1
  67. package/web-dist/assets/{pieDiagram-E7YTZNPT-D0ekSraZ.js → pieDiagram-E7YTZNPT-hglGp1tZ.js} +1 -1
  68. package/web-dist/assets/{quadrantDiagram-AXDQQJYC-Cy26pgKX.js → quadrantDiagram-AXDQQJYC-LXRcDHFO.js} +1 -1
  69. package/web-dist/assets/{radar-RG4KPBEZ-BgRupjH3.js → radar-RG4KPBEZ-CTLrr81C.js} +1 -1
  70. package/web-dist/assets/{railroad-74A4TZTK-Dy4w728R.js → railroad-74A4TZTK-D4i0I4m9.js} +1 -1
  71. package/web-dist/assets/railroad-abnf-HS5TGJTU-CCyFeptO.js +1 -0
  72. package/web-dist/assets/railroad-ebnf-LZEXJU2U-Dt3_mZmI.js +1 -0
  73. package/web-dist/assets/railroad-peg-WCYAUIDC-BEn1Og7V.js +1 -0
  74. package/web-dist/assets/{railroadDiagram-O6MQD6OU-BOMyv_XT.js → railroadDiagram-O6MQD6OU-u1yMp_hI.js} +1 -1
  75. package/web-dist/assets/{requirementDiagram-BXWQKSXE-CSgiwXA6.js → requirementDiagram-BXWQKSXE-7ISLLKF3.js} +1 -1
  76. package/web-dist/assets/{sankeyDiagram-P5KCCOFB-G8KOXj9r.js → sankeyDiagram-P5KCCOFB-BnK6rnjU.js} +1 -1
  77. package/web-dist/assets/{sequenceDiagram-WJ2MYXX4-BHNtCXMK.js → sequenceDiagram-WJ2MYXX4-CnuvmaQF.js} +1 -1
  78. package/web-dist/assets/{stateDiagram-D77RDMKH--2jCbVWi.js → stateDiagram-D77RDMKH-Bj9ZPcRt.js} +1 -1
  79. package/web-dist/assets/stateDiagram-v2-MP3YSRHH-DlEsfbG-.js +1 -0
  80. package/web-dist/assets/{swimlanes-42K2YHIH-CvqTpnzu.js → swimlanes-42K2YHIH-COI9EGIy.js} +1 -1
  81. package/web-dist/assets/swimlanesDiagram-VR7AAH4N-DBboc6Jp.js +8 -0
  82. package/web-dist/assets/threadSurfaces-Bxomexi7.js +141 -0
  83. package/web-dist/assets/{timeline-definition-24CTP7MA-DRq0OMa5.js → timeline-definition-24CTP7MA-L1aCW1vQ.js} +1 -1
  84. package/web-dist/assets/{treeView-Q6P3EWNA-B0mMNh42.js → treeView-Q6P3EWNA-DePmdkjB.js} +1 -1
  85. package/web-dist/assets/{treemap-WGGIJYW6-q4XBS_CS.js → treemap-WGGIJYW6-DOlGwmCm.js} +1 -1
  86. package/web-dist/assets/{vennDiagram-4TSXK5OY-DA73sSwg.js → vennDiagram-4TSXK5OY-BCEFsIii.js} +1 -1
  87. package/web-dist/assets/{wardley-WFR3VGLG-D96pF1Mc.js → wardley-WFR3VGLG-CLVY7mnX.js} +1 -1
  88. package/web-dist/assets/{wardleyDiagram-VM6X3IG4-C_o0hirh.js → wardleyDiagram-VM6X3IG4-DYVUsvla.js} +1 -1
  89. package/web-dist/assets/{xychartDiagram-S5SC5T6Z-MJRy2rOZ.js → xychartDiagram-S5SC5T6Z-D86vmsc2.js} +1 -1
  90. package/web-dist/index.html +2 -2
  91. package/web-dist/assets/architecture-7GRP2DOG-DkKf0cZl.js +0 -1
  92. package/web-dist/assets/channel-Daeelc8v.js +0 -1
  93. package/web-dist/assets/classDiagram-ZZMXUADV-DHw5piuQ.js +0 -1
  94. package/web-dist/assets/classDiagram-v2-VYDZK3BY-DHw5piuQ.js +0 -1
  95. package/web-dist/assets/eventmodeling-NTZA5JFV-DrRtqwWQ.js +0 -1
  96. package/web-dist/assets/flowDiagram-HODETNUW-Oc7cmpE3.js +0 -1
  97. package/web-dist/assets/index-DRG5-nXT.js +0 -262
  98. package/web-dist/assets/index-eeejVGID.css +0 -2
  99. package/web-dist/assets/railroad-abnf-HS5TGJTU-CutbH4o5.js +0 -1
  100. package/web-dist/assets/railroad-ebnf-LZEXJU2U-CEvKf9AQ.js +0 -1
  101. package/web-dist/assets/railroad-peg-WCYAUIDC-qd0-kaxB.js +0 -1
  102. package/web-dist/assets/stateDiagram-v2-MP3YSRHH-Bt_vgX2P.js +0 -1
  103. package/web-dist/assets/swimlanesDiagram-VR7AAH4N-1m6qrGWm.js +0 -8
  104. package/web-dist/assets/threadSurfaces-lLUuzbLM.js +0 -141
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frizz-server",
3
- "version": "0.15.60",
3
+ "version": "0.15.62",
4
4
  "private": false,
5
5
  "description": "Replaceable Frizz server runtime",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@ what was ported from the orchestrator `cc/` plugin, what was dropped, and why.
32
32
  | `session-seed.mjs` | SessionStart (startup/resume/clear/compact) | cc `session-seed.mjs` | Injects the single-thread worker contract + the bound slug + its file path; re-grounds on compact. Also writes cc's `off` sentinel defensively (see interplay). |
33
33
  | `precompact-instructions.mjs` | PreCompact (auto/manual) | new — no cc equivalent | Steers WHAT SURVIVES compaction: emits an editorial brief asking the summarizer to preserve the high-level approach (plan, alternatives rejected, rationale) at high fidelity, plus a closing "Re-grounding before continuing:" section naming the thread's scratch-directory path and the files to re-read. **PLAIN STDOUT is the channel** — cc's usual `hookSpecificOutput` JSON would be handed to the summarizer as its literal instructions. Skips sub-agent contexts (the derived scratch-directory path is only guaranteed for the top-level worker). |
34
34
  | `scratchpad.mjs` | SessionStart (startup/resume/clear/compact) + PreCompact (auto/manual) + UserPromptSubmit + PostToolUse | new — no cc equivalent | Keeps a worker aware of its per-thread scratch DIRECTORY (`.frizz/threads/<sid>/`). `--mode=session-start` NAMES the files in it on the context-losing sources (compact/resume/clear) — a listing, never their content — and otherwise teaches the arrangement (write a doc, then arm `post_compaction`); `--mode=precompact` (**plain stdout**) tells the summarizer those files exist so it carries their paths forward; `--mode=nudge` fires on BOTH UserPromptSubmit and PostToolUse (mid-turn — the one that matters for long autonomous turns) once context has grown past `STALE_TOKENS` since the last write. Both nudge channels share one state file, so mid-turn firing does not multiply reminders. NOT gated on `FRIZZ_THREAD`; `--via=project` marks the repo-local registration and defers to this one inside a frizz worker. |
35
- | `agent-dispatch.mjs` | PreToolUse(Agent) | cc `agent-dispatch.mjs` | Enforces `run_in_background:true`, strips `name`/`team_name`, appends a worker-flavored orchestration epilogue. |
35
+ | `agent-dispatch.mjs` | PreToolUse(Agent) | cc `agent-dispatch.mjs` | Enforces `run_in_background:true`, strips `name`/`team_name`, appends a worker-flavored orchestration epilogue. Exempts Claude Code's built-in `web-fetch` agent from the first and the last while `CLAUDE_CODE_WEB_FETCH_AGENT` is not false, the only case where that agent can exist. |
36
36
  | `bash-background.mjs` | PreToolUse(Bash) | new | Denies a local shell job that escapes through `&` without a later `wait` or EXIT trap, including one hidden inside a command-position `bash -c '…'`. Shell job control bypasses Claude's task registry, so Frizz cannot track or wake it; self-contained probe concurrency, and a wrapper handed to another program (`ssh`/`docker run`/`limactl shell`), remain allowed. |
37
37
  | `agent-bind.mjs` | PostToolUse(Agent) | cc `agent-bind.mjs` (verbatim behavior) | Records `agentId → thread` into `.frizz/.agent-bindings.jsonl` in cc's exact format, so a worker's THREAD-tagged helper renders on the frizz board's per-thread liveness. |
38
38
  | `stop-flush.mjs` | Stop | cc `frizz-stop-reminder.mjs` (dirty-check idea only) | If the worker's ONE thread file wasn't edited since the last rest, nudges it to flush its state (mtime dirty-check, cooldown-limited, least-alarming `additionalContext` channel). |
@@ -10,6 +10,7 @@
10
10
  // A missed binding just means one helper isn't surfaced; a PostToolUse hook must never disturb the turn.
11
11
  import { readFileSync } from 'node:fs';
12
12
  import { recordBinding, threadFromPrompt } from '../scripts/frizz/agent-bindings.mjs';
13
+ import { isHomeDirectory } from '../lib/project-frizz-dir.mjs';
13
14
 
14
15
  try {
15
16
  // WORKER GATE.
@@ -31,7 +32,8 @@ try {
31
32
  const thread = threadFromPrompt(prompt);
32
33
  const label = (typeof ti.description === 'string' && ti.description) || trInner.description || null;
33
34
 
34
- if (agentId && thread) {
35
+ // Not in the home project, whose `.frizz` would be Frizz's own legacy state root (lib/project-frizz-dir.mjs).
36
+ if (agentId && thread && !isHomeDirectory(dir)) {
35
37
  recordBinding(dir, { agentId, thread, label, session: input.session_id ?? null });
36
38
  }
37
39
  } catch {
@@ -3,7 +3,8 @@
3
3
  // PreToolUse hook on the `Agent` tool (frizz-worker). A worker MAY spin up its own helper
4
4
  // sub-agents; this hook holds them to the same rules cc enforces for the orchestrator:
5
5
  // 1) ENFORCE background dispatch — deny any Agent call lacking run_in_background:true (a
6
- // foreground agent blocks the worker's turn; a human interjection orphans it).
6
+ // foreground agent blocks the worker's turn; a human interjection orphans it). Claude Code's
7
+ // built-in `web-fetch` agent is the one exemption, see below.
7
8
  // 2) STRIP `name`/`team_name` — setting either strands a nested dispatch (its result routes
8
9
  // wrong and never returns cleanly), so scrub both silently.
9
10
  // 3) AUTO-APPEND a short ORCHESTRATION EPILOGUE carrying only what a helper cannot discover on
@@ -55,6 +56,19 @@
55
56
  // dispatcher discarded it and redid the work itself. This paragraph is the only place that reaches
56
57
  // a nested dispatcher without depending on its parent remembering to restate the norm.
57
58
  //
59
+ // THE ONE EXEMPTION, Claude Code's built-in `web-fetch` agent (2026-11-20). Where Claude Code's
60
+ // `tengu_clever_orbit` rollout is on, it takes WebFetch away from the session and registers that agent
61
+ // as its only way to read a page, described as running "in the foreground" with its report as the
62
+ // tool result. Held to rule 1, every page read became a background helper and a lost turn. Frizz
63
+ // switches the mode off in every worker it forks (CLAUDE_CODE_WEB_FETCH_AGENT=0 in CLAUDE_WORKER_ENV),
64
+ // so the agent can only exist where that switch is NOT false: a daemon forked before the switch
65
+ // shipped, or an operator who turned the mode on. The exemption keys on the same variable, which this
66
+ // hook inherits from the Claude Code process, because the name alone is not proof: a project or user
67
+ // agent called `web-fetch` passes a name match with whatever tools it declares. With the switch false
68
+ // the built-in cannot be registered, so the name can only be such an agent and rule 1 holds. The
69
+ // exempted call gets no epilogue either: the agent has WebFetch and nothing else, and every rule in the
70
+ // epilogue is about tools it does not hold.
71
+ //
58
72
  // GATE: inert unless FRIZZ_THREAD is set (not a frizz worker → allow every dispatch unmodified).
59
73
  //
60
74
  // DROPPED vs cc's agent-dispatch.mjs (see DECISIONS.md): the `.dispatch-count` bump (it only gates
@@ -87,6 +101,16 @@ try {
87
101
 
88
102
  const input = JSON.parse(readFileSync(0, 'utf8'));
89
103
  const ti = input.tool_input ?? {};
104
+ const { name: _droppedName, team_name: _droppedTeam, ...tiStripped } = ti;
105
+
106
+ // Claude Code's own tri-state reading of the switch: these four spellings are false, anything else
107
+ // (unset included) leaves the decision to its feature flag.
108
+ const webFetchAgentOff = ['0', 'false', 'no', 'off'].includes(
109
+ (process.env.CLAUDE_CODE_WEB_FETCH_AGENT ?? '').trim().toLowerCase(),
110
+ );
111
+ if (ti.subagent_type === 'web-fetch' && !webFetchAgentOff) {
112
+ emit({ hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'allow', updatedInput: tiStripped } });
113
+ }
90
114
 
91
115
  if (ti.run_in_background !== true) {
92
116
  emit({
@@ -99,8 +123,7 @@ try {
99
123
  });
100
124
  }
101
125
 
102
- // Strip name/team_name (they strand nested dispatches), then append the epilogue once.
103
- const { name: _droppedName, team_name: _droppedTeam, ...tiStripped } = ti;
126
+ // Strip name/team_name (they strand nested dispatches; done above), then append the epilogue once.
104
127
  // Idempotence is "this prompt ALREADY ENDS WITH the epilogue", not "this prompt mentions the
105
128
  // marker anywhere". A substring test silently ate the epilogue for any prompt that merely QUOTED
106
129
  // the marker — e.g. a worker asking a helper to report whether the epilogue reached it, which is
@@ -57,6 +57,7 @@
57
57
  import { existsSync, readFileSync, writeFileSync, mkdirSync, statSync, readdirSync, openSync, readSync, closeSync } from 'node:fs';
58
58
  import { join } from 'node:path';
59
59
  import { currentSessionId } from '../scripts/frizz/config.mjs';
60
+ import { projectFrizzDir, scratchDirLabel } from '../lib/project-frizz-dir.mjs';
60
61
 
61
62
  /** How many filenames a listing names before it summarizes the rest. A worker with 200 scratch files
62
63
  * needs to know that, not to be handed 200 lines of them. */
@@ -131,8 +132,12 @@ try {
131
132
  // Without a session id there is no key, and an unkeyed pad would bleed between sessions.
132
133
  if (!sid) process.exit(0);
133
134
 
134
- const threadDir = join(projectDir, '.frizz', 'threads', sid);
135
- const relPath = '.frizz/threads/' + sid + '/';
135
+ // The home project keeps its Frizz folder in Frizz's data root, never `~/.frizz` (lib/project-frizz-dir.mjs).
136
+ // Where that cannot be told there is no scratch directory to name, and the hook says nothing.
137
+ const frizzDir = projectFrizzDir(projectDir);
138
+ if (!frizzDir) process.exit(0);
139
+ const threadDir = join(frizzDir, 'threads', sid);
140
+ const relPath = scratchDirLabel(projectDir, sid) ?? '';
136
141
 
137
142
  // ── mode: subagent-start (Codex child-only merge epilogue) ───────────────────────────────────────
138
143
  if (mode === 'subagent-start') {
@@ -27,6 +27,7 @@ import { accessSync, constants, existsSync, readFileSync, statSync } from 'node:
27
27
  import { delimiter, join } from 'node:path';
28
28
  import { execFileSync } from 'node:child_process';
29
29
  import { setSessionOverride, currentSessionId } from '../scripts/frizz/config.mjs';
30
+ import { isHomeDirectory, scratchDirLabel } from '../lib/project-frizz-dir.mjs';
30
31
 
31
32
  /** @type {{ agent_id?: unknown, agentId?: unknown, source?: string, session_id?: string }} */
32
33
  let input = {};
@@ -51,13 +52,13 @@ try {
51
52
  sid = currentSessionId(input.session_id);
52
53
  // Never into a project folder that has gone: CLAUDE_PROJECT_DIR keeps the old path after a rename,
53
54
  // and the sentinel's `mkdir -p` would recreate it as an empty stub (see scratchpad.mjs).
54
- if (sid && existsSync(dir)) setSessionOverride(dir, sid, 'off');
55
+ // Never in the home project: the sentinel's folder would be `~/.frizz`, Frizz's own legacy state root,
56
+ // and the classic plugin it silences is dormant there anyway, with no `.frizz/` of the project's own.
57
+ if (sid && existsSync(dir) && !isHomeDirectory(dir)) setSessionOverride(dir, sid, 'off');
55
58
  } catch {
56
59
  /* best-effort — a failed sentinel write just leaves cc at its dormant default */
57
60
  }
58
- const scratch = sid
59
- ? '.frizz/threads/' + sid + '/'
60
- : '.frizz/threads/<session-id>/';
61
+ const scratch = scratchDirLabel(dir, sid ?? '<session-id>') ?? 'the scratch directory named in your prompt';
61
62
 
62
63
  // A RUNTIME pointer, NOT a copy of the contract. The full worker contract (signal fences,
63
64
  // scratch-directory rules, sub-agent rules, the question handback, the stop criterion) lives ONCE in
@@ -71,7 +72,7 @@ const scratch = sid
71
72
  // prompt. Trimmed 2026-08-26 (maintainer: "Definitely trim the session seed hook if it's fully
72
73
  // repetitive") as part of cutting the per-session token overhead Frizz adds over a plain TUI session.
73
74
  const core =
74
- '⟦frizz worker contract⟧ You are a frizz WORKER driving EXACTLY ONE effort. Your FULL operating contract — the end-of-turn signal fences (```done / ```awaiting), the ```question fence that asks the human (a new `id:` registers a question where you write it; an `id:` alone references one you asked before), the scratch-directory rules, the sub-agent rules, the question handback and the stop criterion — lives in your SYSTEM PROMPT; follow it there. SIGN OFF with a fence, a registration (`frizzctl done`, or a question you ask or reference at this rest, which is the sign-off: rest normally), or — when your message is itself what the human needs and nothing is running or to decide — the message alone, with no fence. A rest on running work takes the ```awaiting fence with `status: working|watching|needs_input` — `working` and `watching` are quiet parks and need no write-up.\n' +
75
+ '⟦frizz worker contract⟧ You are a frizz WORKER driving EXACTLY ONE effort. Your FULL operating contract — the end-of-turn signal fences (```done / ```awaiting), the ```question fence that asks the human (a new `id:` registers a question where you write it; an `id:` alone references one you asked before), the scratch-directory rules, the sub-agent rules, the question handback and the stop criterion — lives in your SYSTEM PROMPT; follow it there. ALWAYS SIGN OFF — a fence OR a registration (`frizzctl done`, or a question you ask or reference at this rest, which is the sign-off: rest normally). A rest on running work takes the ```awaiting fence with `status: working|watching|needs_input` — `working` and `watching` are quiet parks and need no write-up.\n' +
75
76
  'SCRATCH DIRECTORY (OPTIONAL): `' + scratch + '` — a folder kept FOR YOU, nothing in it read automatically, never a substitute for doing the work. Give each sub-agent its OWN file rather than a shared one.';
76
77
 
77
78
  const grounding =
@@ -1481,8 +1481,8 @@ async function activity() {
1481
1481
  return (
1482
1482
  "Nothing is running on this thread — no background shells, no sub-agents, no armed timers, no " +
1483
1483
  "registered PRs, and no open questions.\n\nSo there is nothing to wait on: an ```awaiting fence " +
1484
- "would have nothing to name. End finished work with ```done, ask a ```question if you need the " +
1485
- "human's decision, or rest on your reply with no fence if your message is what they need." + linksBlock
1484
+ "would have nothing to name, and a fence naming nothing is not a park. End with ```done, or " +
1485
+ "ask a ```question if you need the human." + linksBlock
1486
1486
  )
1487
1487
  }
1488
1488
  const lines = items.map((i) => {
@@ -0,0 +1,59 @@
1
+ // WHERE A PROJECT'S FRIZZ FOLDER IS, as the worker hooks see it — the copy of
2
+ // packages/server/src/project-root.ts `projectFrizzDir` for code that runs inside a worker.
3
+ //
4
+ // `<project>/.frizz`, except for the home directory. The home project's folder cannot be `~/.frizz`,
5
+ // because that path is Frizz's legacy state root and its mere existence moves every Frizz process on
6
+ // the machine onto it. Its folder is `<data root>/home/.frizz` instead, and a hook finds the data root
7
+ // the way the frizz command line does: two levels up from this project's state dir
8
+ // (`<data root>/projects/<project id>`), which every worker is handed as FRIZZ_STATE_DIR, or which older
9
+ // workers can derive from FRIZZ_PERM_DIR (`<state dir>/perm-requests`).
10
+ //
11
+ // A home project whose data root cannot be told gets NULL, never a guess: a hook that falls back to
12
+ // `~/.frizz` is the one mistake this file exists to make impossible.
13
+
14
+ import { realpathSync } from 'node:fs';
15
+ import { homedir } from 'node:os';
16
+ import { basename, dirname, join, resolve } from 'node:path';
17
+
18
+ /** @param {string} path @returns {string} */
19
+ function canonical(path) {
20
+ try {
21
+ return realpathSync(resolve(path));
22
+ } catch {
23
+ return resolve(path);
24
+ }
25
+ }
26
+
27
+ /** @param {string} dir @returns {boolean} */
28
+ export function isHomeDirectory(dir) {
29
+ return canonical(dir) === canonical(homedir());
30
+ }
31
+
32
+ /** @param {NodeJS.ProcessEnv} env @returns {string | undefined} */
33
+ function stateDirFrom(env) {
34
+ if (env.FRIZZ_STATE_DIR) return env.FRIZZ_STATE_DIR;
35
+ const perm = env.FRIZZ_PERM_DIR;
36
+ return perm && basename(perm) === 'perm-requests' ? dirname(perm) : undefined;
37
+ }
38
+
39
+ /**
40
+ * The project's Frizz folder, or null for a home project whose data root this process cannot tell.
41
+ * @param {string} projectDir @param {NodeJS.ProcessEnv} [env] @returns {string | null}
42
+ */
43
+ export function projectFrizzDir(projectDir, env = process.env) {
44
+ if (!isHomeDirectory(projectDir)) return join(projectDir, '.frizz');
45
+ const stateDir = stateDirFrom(env);
46
+ if (!stateDir || basename(dirname(stateDir)) !== 'projects') return null;
47
+ return join(dirname(dirname(stateDir)), 'home', '.frizz');
48
+ }
49
+
50
+ /**
51
+ * How a worker is told its scratch directory: relative to the project it runs in, or absolute in the
52
+ * home project, whose folder is not under it. Null exactly when projectFrizzDir is.
53
+ * @param {string} projectDir @param {string} sessionId @param {NodeJS.ProcessEnv} [env] @returns {string | null}
54
+ */
55
+ export function scratchDirLabel(projectDir, sessionId, env = process.env) {
56
+ if (!isHomeDirectory(projectDir)) return '.frizz/threads/' + sessionId + '/';
57
+ const frizzDir = projectFrizzDir(projectDir, env);
58
+ return frizzDir ? join(frizzDir, 'threads', sessionId) + '/' : null;
59
+ }
@@ -1 +1 @@
1
- import{m as e,t}from"./mermaid-parser.core-C1daiAo7.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-C4XfhTaE.js";import"./chunk-DU6HZSFF-DjCzKTaE.js";import"./chunk-CLGD4ZFX-DBrOrKI3.js";import{n as i,r as a,t as o}from"./chunk-SVP7TREG-NJUBCeXl.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-D4YANiO2.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-C4XfhTaE.js";import"./chunk-DU6HZSFF-mBBDvwET.js";import"./chunk-CLGD4ZFX-C1O2SPPZ.js";import{n as i,r as a,t as o}from"./chunk-SVP7TREG-DXl-FEaS.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};
@@ -0,0 +1 @@
1
+ import"./chunk-FOHPRMQF-CyTuVbu3.js";import{M as e}from"./mermaid-parser.core-D4YANiO2.js";export{e as createArchitectureServices};