@north-light/crouter 0.3.228 → 0.3.229

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 (41) hide show
  1. package/dist/builtin-memory/04-base-worker.md +1 -1
  2. package/dist/builtin-memory/internal/agent-shaping.md +11 -11
  3. package/dist/clients/attach/viewer.js +1 -1
  4. package/dist/commands/node/create.d.ts +1 -1
  5. package/dist/commands/node/create.js +1 -1
  6. package/dist/commands/node/inspect.js +1 -1
  7. package/dist/commands/node/lifecycle.js +3 -3
  8. package/dist/core/__tests__/review-model-floor.test.js +12 -4
  9. package/dist/core/config.d.ts +3 -3
  10. package/dist/core/config.js +3 -3
  11. package/dist/core/runtime/launch.js +1 -1
  12. package/dist/types.d.ts +8 -11
  13. package/dist/types.js +4 -31
  14. package/package.json +1 -1
  15. package/runtime.lock.json +2 -2
  16. package/dist/builtin-memory/05-kinds/design/00-base.md +0 -16
  17. package/dist/builtin-memory/05-kinds/design/01-orchestrator.md +0 -16
  18. package/dist/builtin-memory/05-kinds/design/design-contract.md +0 -16
  19. package/dist/builtin-memory/05-kinds/developer/00-base.md +0 -17
  20. package/dist/builtin-memory/05-kinds/developer/01-orchestrator.md +0 -15
  21. package/dist/builtin-memory/05-kinds/plan/00-base.md +0 -16
  22. package/dist/builtin-memory/05-kinds/plan/01-orchestrator.md +0 -16
  23. package/dist/builtin-memory/05-kinds/plan/plan-contract.md +0 -20
  24. package/dist/builtin-memory/05-kinds/plan/reviewers/architecture-fit.md +0 -15
  25. package/dist/builtin-memory/05-kinds/plan/reviewers/code-smells.md +0 -15
  26. package/dist/builtin-memory/05-kinds/plan/reviewers/lens-contract.md +0 -13
  27. package/dist/builtin-memory/05-kinds/plan/reviewers/pattern-consistency.md +0 -17
  28. package/dist/builtin-memory/05-kinds/plan/reviewers/requirements-coverage.md +0 -17
  29. package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +0 -17
  30. package/dist/builtin-memory/05-kinds/spec/00-base.md +0 -17
  31. package/dist/builtin-memory/05-kinds/spec/01-orchestrator.md +0 -15
  32. package/dist/builtin-memory/05-kinds/spec/requirements.md +0 -15
  33. package/dist/builtin-memory/design/guide.md +0 -57
  34. package/dist/builtin-memory/design/roadmap.md +0 -21
  35. package/dist/builtin-memory/development.md +0 -113
  36. package/dist/builtin-memory/plan/guide.md +0 -53
  37. package/dist/builtin-memory/plan/roadmap.md +0 -27
  38. package/dist/builtin-memory/spec/guide.md +0 -53
  39. package/dist/builtin-memory/spec/requirements.md +0 -29
  40. package/dist/builtin-memory/spec/roadmap.md +0 -36
  41. package/dist/builtin-memory/testing.md +0 -39
@@ -3,7 +3,7 @@ kind: preference
3
3
  when-and-why-to-read: When a node runs in base mode, this preference should be read so bounded work completes hands-on instead of recursing through a chain of delegates.
4
4
  gate: {mode: base}
5
5
  rationale: >-
6
- A base security reviewer handed its entire assignment to another base security reviewer, which repeated the move through a 35-node chain in under five minutes. The universal prompt had said to delegate any self-contained work while no base-mode layer told sub-kinds to work hands-on; exact sub-kind gating also meant plan/reviewers/security did not inherit plan/00-base.
6
+ A base security reviewer handed its entire assignment to another base security reviewer, which repeated the move through a 35-node chain in under five minutes. The universal prompt had said to delegate any self-contained work while no base-mode layer told sub-kinds to work hands-on; exact sub-kind gating also meant the reviewer did not inherit its parent kind's base layer.
7
7
 
8
8
  The scout section exists because the kernel's "understand before you delegate" line is orchestrator-gated, so base workers had no counterweight to mapping unfamiliar code in their own window: they spent a strong-model context on read-only exploration and yielded before the real work. Explore defaults to a light tier, which is the mechanism the section leans on.
9
9
  surfaces:
@@ -23,7 +23,7 @@ A fifth axis, **lifecycle** (`terminal` vs `resident`), is orthogonal too but be
23
23
 
24
24
  ## Kinds — role, model tier, and tools
25
25
 
26
- A kind is a **persona** (gated memory docs at `kinds/<kind>/00-base.md` and `01-orchestrator.md`, gated `{kind, mode}` so exactly the node's role prose splices into its boot context) plus a **`KindConfig`** in the launch registry (its one-line `whenToUse`, a default model tier, the tools/extensions it gets, and which sub-personas it may spawn). Set it at spawn with `crtr node new --kind`, or change it live with `crtr node config --kind` / `crtr node promote --kind`.
26
+ A kind starts with a **`KindConfig`** in the launch registry: its one-line `whenToUse`, default model tier, tools and extensions, and which sub-personas it may spawn. Core or an enabled plugin can add role guidance with ordinary memory documents gated by `{kind, mode}`. Set the kind at spawn with `crtr node new --kind`, or change it live with `crtr node config --kind` / `crtr node promote --kind`.
27
27
 
28
28
  **Why kinds exist at all.** Two payoffs a per-task instruction can't buy. First, **model-tier economics ride the kind boundary**: `explore` defaults to a fast/cheap model (right for mapping and summarization, wrong for judgment); `advisor` defaults to the slow, expensive think-y tier (right for debugging and tradeoffs). Fencing the tier into the kind is what stops an orchestrator from delegating debugging to a cheap explore scout. Second, a kind is **standing role discipline** that survives across every task of that type — the reviewer's neutral priming, the developer's done-bar, the planner's decision-resolution — rather than prose you must restate and that erodes each spawn.
29
29
 
@@ -31,20 +31,20 @@ A kind is a **persona** (gated memory docs at `kinds/<kind>/00-base.md` and `01-
31
31
 
32
32
  | kind | what it's for | reach for it when |
33
33
  |---|---|---|
34
- | **general** | catch-all worker for work that fits no specialist kind | nothing more specific fits. Its persona optimizes for self-agency — reshaping its own kind/mode/config mid-flight — because it's the default spawn, not custom-shaped for the task |
35
- | **explore** | read-only orientation and code-path mapping, `file:line` evidence, facts without opinion, effort scaled to requested depth | you need to understand unfamiliar code or architecture. **Never** for diagnosis — anything about why something is broken or misbehaving is advisor |
36
- | **advisor** | diagnosis, debugging, tradeoff analysis, engineering second opinions — reason from evidence, recommend the next move | you need to find out what is going wrong, or want judgment on a consequential call. The reciprocal of explore: expensive think-y tier, fenced here so judgment doesn't leak onto a cheap scout |
37
- | **spec** | discover-then-write *what to build* — behavior, non-goals, interfaces, edge cases, testable acceptance criteria | the requirement itself is unsettled and needs enumerating (which pages exist, which error cases) before anyone designs |
38
- | **design** | architect *how it should be built* — cross-service, high-level decisions (schema, patterns, performance), worked out interactively, deliberately not the most obvious solution | the *how* has real architectural weight. Distinct from plan: design decides the shape; plan sequences an already-decided shape |
39
- | **plan** | decompose an approved spec/design into concrete, phased, parallelizable steps with every decision resolved | you have a spec or design and need an executable breakdown a less-capable model can run without re-deciding. A plan 80% right costs more than no plan — pin every decision |
40
- | **developer** | implement a change and make it *genuinely work* against acceptance criteria, not merely compile | you're building the feature or fix. Green proves it ran, not that it's right — the persona carries the prove-it discipline and the build→review cycle |
41
- | **review** | critique code, a plan, or a spec once — deliver a complete, severity-rated verdict, **detect don't adjudicate** | substantive work needs one independent check. Use a *separate* node from the author — agents can't self-audit — and prime it neutrally ("review this", never "find what fails", which manufactures false positives) |
34
+ | **general** | catch-all worker | no specialist role fits |
35
+ | **explore** | read-only current-state and code-path mapping | you need evidence about unfamiliar code or architecture, not diagnosis or recommendations |
36
+ | **advisor** | diagnosis, debugging, tradeoff analysis, and engineering second opinions | you need to explain a failure or judge a consequential call |
37
+ | **spec** | define what outcome and behavior to build | the requirement itself is unsettled |
38
+ | **design** | decide the structural shape of a solution | the implementation has consequential architectural choices |
39
+ | **plan** | sequence implementation of an approved specification or design | the outcome and structure are settled but the build path is not |
40
+ | **developer** | implement a change | you are building the feature or fix |
41
+ | **review** | independently critique code or an artifact | substantive work needs a severity-rated verdict |
42
42
 
43
- The discriminators that get missed: **explore vs advisor** (mapping vs judgment — cheap vs expensive tier); **spec vs design** (what to build vs how to build it); **design vs plan** (decide the shape vs sequence a decided shape); **review is always a separate node from the implementer**. **Developer is the kind closest to "general with a mood"** — the first merge candidate if the roster ever shrinks.
43
+ The discriminators that get missed are **explore vs advisor** (mapping vs judgment), **spec vs design** (what to build vs how it is structured), and **design vs plan** (decide the shape vs sequence a decided shape).
44
44
 
45
45
  ### Sub-kinds
46
46
 
47
- Specialist sub-personas hang off a parent kind — `plan/reviewers/*` (architecture-fit, code-smells, pattern-consistency, requirements-coverage, security) and `spec/requirements`. They aren't in the top-level `--kind` list but are valid by exact path (`crtr node new --kind plan/reviewers/security`). Use a sub-persona for one narrowly targeted assignment, not as a mandatory lens roster; discover the available roles with `crtr sys prompt-review --list --kind <kind>`.
47
+ Specialist sub-personas hang off a parent kind. They are not in the top-level `--kind` list but are valid by exact registered path. Use one for a narrowly targeted assignment, not as a mandatory roster; discover the roles available from a kind with `crtr sys prompt-review --list --kind <kind>`. Core and plugins register sub-kinds through the same launch registry.
48
48
 
49
49
  ### Custom personas
50
50
 
@@ -1636,7 +1636,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
1636
1636
  `);c8.mkdirSync(zY.dirname(et),{recursive:!0}),c8.writeFileSync(et,Nt),this.stop();let It=[`Rendered line ${be} exceeds terminal width (${Da(Ue)} > ${t}).`,"","This is likely caused by a custom TUI component not truncating its output.","Use visibleWidth() to measure and truncateToWidth() to truncate lines.","",`Debug log written to: ${et}`].join(`
1637
1637
  `);throw new Error(It)}z+=Ue}let ne=ie;if(this.previousLines.length>m.length){if(ie<m.length-1){let Ue=m.length-1-ie;z+=`\x1B[${Ue}B`,ne=m.length-1}let be=this.previousLines.length-m.length;for(let Ue=m.length;Ue<this.previousLines.length;Ue++)z+=`\r
1638
1638
  \x1B[2K`;z+=`\x1B[${be}A`}if(z+="\x1B[?2026l",process.env.PI_TUI_DEBUG==="1"){let be="/tmp/tui";c8.mkdirSync(be,{recursive:!0});let Ue=zY.join(be,`render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`),He=[`firstChanged: ${C}`,`viewportTop: ${p}`,`cursorRow: ${this.cursorRow}`,`height: ${r}`,`lineDiff: ${J}`,`hardwareCursorRow: ${f}`,`renderEnd: ${ie}`,`finalCursorRow: ${ne}`,`cursorPos: ${JSON.stringify(g)}`,`newLines.length: ${m.length}`,`previousLines.length: ${this.previousLines.length}`,"","=== newLines ===",JSON.stringify(m,null,2),"","=== previousLines ===",JSON.stringify(this.previousLines,null,2),"","=== buffer ===",JSON.stringify(z)].join(`
1639
- `);c8.writeFileSync(Ue,He)}this.terminal.write(z),this.cursorRow=Math.max(0,m.length-1),this.hardwareCursorRow=ne,this.maxLinesRendered=Math.max(this.maxLinesRendered,m.length),this.previousViewportTop=Math.max(u,ne-r+1),this.positionHardwareCursor(g,m.length),this.previousLines=m,this.previousKittyImageIds=this.collectKittyImageIds(m),this.previousWidth=t,this.previousHeight=r}positionHardwareCursor(t,r){if(!t||r<=0){this.terminal.hideCursor();return}let i=Math.max(0,Math.min(t.row,r-1)),o=Math.max(0,t.col),a=i-this.hardwareCursorRow,u="";a>0?u+=`\x1B[${a}B`:a<0&&(u+=`\x1B[${-a}A`),u+=`\x1B[${o+1}G`,u&&this.terminal.write(u),this.hardwareCursorRow=i,this.getShowHardwareCursor()?this.terminal.showCursor():this.terminal.hideCursor()}};var qY="\x1B[0m",X$e="\x1B[38;5;180m",BNi="\x1B[38;5;137m",UNi="\x1B[1m",K$e="\x1B[2m";function jY(e){return X$e+e.replace(/\./g,`${BNi}.${X$e}`)+qY}var C0r=[jY(" ________"),jY(" / /|"),jY(" / . . / |"),jY(" /_______/ |"),jY(" | . . | |"),jY(" | . . | /"),jY(" |_______|/")];function x0r(e={}){let r=[`${UNi}${X$e}crouter${qY}${e.version?`${K$e} v${e.version}${qY}`:""}`,`${K$e}the agentic runtime${qY}`];e.profile&&r.push(`${K$e}profile: ${qY}${X$e}${e.profile}${qY}`),e.cwd&&r.push(`${K$e}${e.cwd}${qY}`);let i=[];for(let o=0;o<C0r.length;o++){let a=o>=1&&o-1<r.length?` ${r[o-1]}`:"";i.push(C0r[o]+a)}return i}import{execFile as BDi,spawnSync as UTr}from"node:child_process";function $Ni(e,t,r,i,o,a,u,p,f){return Object.freeze({id:e,group:t,name:r,description:i,defaults:Object.freeze([...o]),inputKind:a,contexts:Object.freeze([...u]),...p===void 0?{}:{safety:p},...f===void 0?{}:{pair:Object.freeze({...f})}})}var Va=$Ni;function Vb(e,t,r,i,o){let a=`crtr.tmux.menu.${e}`,u=`crtr.tmux.menu-global.${e}`;return[Va(a,"Global tmux",t,r,i,"tmux-menu-selector",o,void 0,{field:"menu",pairedId:u}),Va(u,"Global tmux",t,r,[],"tmux-global-action",["tmux.root"],void 0,{field:"global",pairedId:a})]}function hP(e,t,r,i,o,a){return[Va(e,"Attach",r,i,o,"tmux-menu-selector",["tmux.menu.attach"],void 0,{field:"menu",pairedId:t}),Va(t,"Attach",r,i,a,"host-global",l7,void 0,{field:"direct",pairedId:e})]}var l7=["attach","graph","graph.confirm"],zNi=["setup.login","setup.list","setup.input","setup.keybindings","setup.keybindings.edit","setup.keybindings.filter","setup.models"],I0r=["setup.login","setup.list","setup.keybindings","setup.models"],_P=Object.freeze([Va("crtr.tmux.menu.open","Global tmux","Open crouter menu","Open the crouter action menu.",["alt+c"],"host-global",["tmux.root"]),Va("crtr.tmux.menu.attach","Global tmux","Attach actions","Open the attach-viewer action submenu.",["a"],"tmux-menu-selector",["tmux.menu"]),...Vb("promote","Promote to orchestrator","Promote the focused node to orchestrator \u2014 it holds a roadmap and delegates.",["o"],["tmux.menu"]),...Vb("demote-mode","Demote to base node","Demote the focused orchestrator back to a base node \u2014 hands-on again in its own window, no roadmap to drive.",["shift+o"],["tmux.menu"]),...Vb("resume","Find node","Open the canvas navigator and go to the chosen node.",["/"],["tmux.menu"]),...Vb("fork","Fork node","Fork the focused node into an independent idle root.",["f"],["tmux.menu"]),...Vb("demote","Demote to terminal","Demote the focused node to terminal \u2014 it keeps running, owes a final up the spine, and reaps when done.",["d"],["tmux.menu"]),...Vb("make-resident","Make resident","Flip the focused node to resident \u2014 interactable, never forced to submit a final, and wakeable while attached or awaiting something live.",["shift+r"],["tmux.menu"]),...Vb("detach","Demote and close viewer","Demote the focused node and close its viewer; its broker keeps running off-screen.",["shift+d"],["tmux.menu"]),...Vb("close-subtree","Close subtree","Close the focused node and its subtree.",["x"],["tmux.menu"]),...Vb("background-bash","Background running bash","Hand the focused node\u2019s running bash command to its background job system.",["b"],["tmux.menu"]),...Vb("file-review","Review a file","Open a line-anchored review of a file named in the transcript.",["v"],["tmux.menu"]),...Vb("pin","Pin conversation","Pin or unpin this conversation in the canvas navigator.",["p"],["tmux.menu"]),...Vb("show","Inspect node","Open the focused node\u2019s inspection menu.",["i"],["tmux.menu"]),...Vb("view-settings","Display settings","Open the viewer display-settings menu.",["z"],["tmux.menu"]),...Vb("fold-tools","Fold finished tool calls","Fold every finished tool call in the transcript to its single call line.",["f"],["tmux.menu.view-settings"]),...Vb("metadata","Show metadata","Show the focused node\u2019s metadata dossier.",["m"],["tmux.menu.show"]),...Vb("context","Browse context","Browse the focused node context.",["c"],["tmux.menu.show"]),...Vb("providers","Open settings","Open the crouter settings panel.",[","],["tmux.menu"]),...Vb("plugins","Browse plugins","Open the crouter plugin browser.",["k"],["tmux.menu"]),...Vb("graph","Canvas graph","Open the canvas graph.",["g"],["tmux.menu"]),...Vb("focus-manager","Go to manager","Focus this node\u2019s manager.",["h"],["tmux.menu"]),...Vb("copy-id","Copy node id","Copy the focused node id to the system clipboard.",["y"],["tmux.menu"]),...Vb("reload-viewer","Reload viewer","Respawn this pane\u2019s viewer onto the current runtime generation.",["r"],["tmux.menu"]),...Vb("recap","Generate recap","Generate the focused node\u2019s Goal and State recap and refresh its generated title.",["s"],["tmux.menu"]),...Vb("issues","Open create menu","Open the create submenu.",["c"],["tmux.menu"]),...Vb("issue.idea","Create idea","Create an idea issue.",["i"],["tmux.menu.issue"]),...Vb("issue.bug","Create bug","Create a bug issue.",["b"],["tmux.menu.issue"]),Va("crtr.tmux.node.next","Global tmux","Next node","Focus the next canvas node.",["alt+]"],"host-global",["tmux.root"]),Va("crtr.tmux.node.previous","Global tmux","Previous node","Focus the previous canvas node.",["alt+["],"host-global",["tmux.root"]),Va("crtr.tmux.inbox.toggle","Global tmux","Toggle inbox","Open or close the human inbox in the focused viewer.",["alt+i"],"host-global",["tmux.root"]),...hP("crtr.tmux.menu.attach.detach","crtr.attach.detach","Detach","Detach from the node.",["d"],["ctrl+d"]),...hP("crtr.tmux.menu.attach.clear-or-detach","crtr.attach.clear-or-detach","Clear input (detach if empty)","Clear input or detach when input is empty.",["c"],["ctrl+c"]),...hP("crtr.tmux.menu.attach.graph.toggle","crtr.attach.graph.toggle","Toggle graph","Open or close the graph overlay.",["g"],["alt+g"]),...hP("crtr.tmux.menu.attach.help.toggle","crtr.attach.help.toggle","Help","Open the attach help overlay.",["k"],["alt+shift+k"]),...hP("crtr.tmux.menu.attach.inbox.toggle","crtr.attach.inbox.toggle","Toggle inbox","Open or close the human inbox surface in this viewer.",["i"],[]),...hP("crtr.tmux.menu.attach.inbox-strip","crtr.attach.inbox-strip","Pending requests","Jump to the pending human-request strip at the top of the pane.",["u"],["alt+u"]),...hP("crtr.tmux.menu.attach.model-ladder.next","crtr.attach.model-ladder.next","Next model","Move to the next model ladder rung.",["]"],["alt+m"]),...hP("crtr.tmux.menu.attach.model-ladder.previous","crtr.attach.model-ladder.previous","Previous model","Move to the previous model ladder rung.",["["],["alt+shift+m"]),...hP("crtr.tmux.menu.attach.command.inspect","crtr.attach.command.inspect","Inspect loaded command","Open the loaded slash command\u2019s expanded prompt.",["h"],["alt+shift+h"]),...hP("crtr.tmux.menu.attach.file-review","crtr.attach.file-review","Review a file","Open a line-anchored review of a file named in the transcript.",[],["alt+shift+r"]),...hP("crtr.tmux.menu.attach.profile-files","crtr.attach.profile-files","Search profile files","Fuzzy-match path segments across the node family\u2019s working directories, profile projects and memory, and ancestor crouter memory stores; Ctrl+Y copies a selected path.",["f"],["ctrl+f"]),...hP("crtr.tmux.menu.attach.search","crtr.attach.search","Search transcript","Search the transcript as it is currently displayed \u2014 folded tool output is not searched until it is unfolded.",["/"],["alt+/"]),...hP("crtr.tmux.menu.attach.whip","crtr.attach.whip","Whip agent","Interrupt the agent and send a playful command.",["w"],[]),Va("crtr.attach.scroll.up","Attach","Scroll up","Scroll the transcript one line up.",["shift+up"],"terminal",l7),Va("crtr.attach.scroll.down","Attach","Scroll down","Scroll the transcript one line down.",["shift+down"],"terminal",l7),Va("crtr.attach.scroll.page-up","Attach","Scroll page up","Scroll the transcript one page up.",["pageup"],"terminal",l7),Va("crtr.attach.scroll.page-down","Attach","Scroll page down","Scroll the transcript one page down.",["pagedown"],"terminal",l7),Va("crtr.attach.scroll.live","Attach","Return to live","Return the transcript to the live bottom.",["shift+end"],"terminal",l7),Va("crtr.attach.mouse.toggle","Attach","Toggle mouse wheel scrolling","Toggle mouse wheel scrolling on or off.",["alt+shift+o"],"terminal",l7),Va("crtr.attach.copy.message","Attach","Copy visible message","Copy the newest message visible in the transcript viewport.",["alt+shift+y"],"terminal",l7),Va("crtr.attach.search.next","Attach","Next match","Move to the next transcript search match.",["n"],"terminal",["attach.search"]),Va("crtr.attach.search.previous","Attach","Previous match","Move to the previous transcript search match.",["shift+n"],"terminal",["attach.search"]),Va("crtr.attach.search.edit","Attach","Edit query","Return to editing the transcript search query.",["/"],"terminal",["attach.search"]),Va("crtr.attach.search.close","Attach","Close search","Leave transcript search and clear its highlights.",["escape"],"terminal",["attach.search"],"dismiss-modal"),Va("crtr.graph.down","GRAPH","Move down","Move to the next graph row.",["j"],"terminal",["graph"]),Va("crtr.graph.up","GRAPH","Move up","Move to the previous graph row.",["k"],"terminal",["graph"]),Va("crtr.graph.first","GRAPH","First row","Move to the first graph row.",["g"],"terminal",["graph"]),Va("crtr.graph.last","GRAPH","Last row","Move to the last graph row.",["shift+g"],"terminal",["graph"]),Va("crtr.graph.collapse-or-manager","GRAPH","Collapse or manager","Collapse a node or move to its manager.",["h"],"terminal",["graph"]),Va("crtr.graph.expand-or-child","GRAPH","Expand or child","Expand a node or move to its child.",["l"],"terminal",["graph"]),Va("crtr.graph.focus","GRAPH","Focus node","Focus the selected node.",["enter"],"terminal",["graph"]),Va("crtr.graph.revive","GRAPH","Revive node","Revive and open the selected dormant node.",["r"],"terminal",["graph"]),Va("crtr.graph.focus-manager","GRAPH","Focus manager","Focus the selected node manager.",["m"],"terminal",["graph"]),Va("crtr.graph.close-subtree","GRAPH","Close subtree","Ask to close the selected subtree.",["x"],"terminal",["graph"]),Va("crtr.graph.dismiss","GRAPH","Dismiss graph","Close the graph overlay.",["escape"],"terminal",["graph"],"dismiss-modal"),Va("crtr.graph.confirm.accept","GRAPH","Confirm close","Confirm closing the selected subtree.",["y"],"terminal",["graph.confirm"]),Va("crtr.graph.confirm.cancel","GRAPH","Cancel close","Cancel closing the selected subtree.",["n","escape"],"terminal",["graph.confirm"],"dismiss-modal"),Va("crtr.inspector.force-quit","Inspector","Force quit Inspector","Immediately leave the Inspector.",["ctrl+c"],"host-global",["inspector"],"leave-screen"),Va("crtr.inspector.down","Inspector","Move down","Move the Inspector selection or scroll cursor down.",["j","down"],"terminal",["inspector"]),Va("crtr.inspector.up","Inspector","Move up","Move the Inspector selection or scroll cursor up.",["k","up"],"terminal",["inspector"]),Va("crtr.inspector.section-next","Inspector","Next section","Move to the next Inspector section.",["tab"],"terminal",["inspector"]),Va("crtr.inspector.section-prev","Inspector","Previous section","Move to the previous Inspector section.",["shift+tab"],"terminal",["inspector"]),Va("crtr.inspector.page-down","Inspector","Page down","Scroll the Inspector detail body down.",["ctrl+d","pagedown"],"terminal",["inspector"]),Va("crtr.inspector.page-up","Inspector","Page up","Scroll the Inspector detail body up.",["ctrl+u","pageup"],"terminal",["inspector"]),Va("crtr.inspector.toggle-detail","Inspector","Toggle item detail","Expand or collapse the selected cron or background job.",["enter"],"terminal",["inspector"]),Va("crtr.inspector.cancel-item","Inspector","Cancel selected item","Arm cancellation for the selected cron, or stopping for the selected background job.",["x"],"terminal",["inspector"]),Va("crtr.inspector.open-log","Inspector","Open job log","Follow the selected background job\u2019s log in a new tmux window.",["o"],"terminal",["inspector"]),Va("crtr.inspector.confirm","Inspector","Confirm action","Confirm the armed Inspector action.",["y"],"terminal",["inspector"]),Va("crtr.inspector.dismiss","Inspector","Dismiss action","Dismiss an Inspector confirmation or banner.",["escape"],"terminal",["inspector"],"dismiss-modal"),Va("crtr.inspector.retarget","Inspector","Retarget","Inspect the selected cron anchor or creator node.",["t"],"terminal",["inspector"]),Va("crtr.inspector.refresh","Inspector","Refresh","Refresh the Inspector now.",["g","r"],"terminal",["inspector"]),Va("crtr.inspector.quit","Inspector","Quit","Leave the Inspector.",["q"],"terminal",["inspector"],"leave-screen"),...jNi(),...qNi(),...GNi()]);function jNi(){let e="browse";return[Va("crtr.browse.quit","Browse and pickers","Quit browse","Leave canvas browse.",["q","escape","ctrl+c"],"terminal",[e],"leave-screen"),Va("crtr.browse.down","Browse and pickers","Move down","Move to the next row.",["j","down"],"terminal",[e]),Va("crtr.browse.up","Browse and pickers","Move up","Move to the previous row.",["k","up"],"terminal",[e]),Va("crtr.browse.first","Browse and pickers","First row","Move to the first row.",["g"],"terminal",[e]),Va("crtr.browse.last","Browse and pickers","Last row","Move to the last row.",["shift+g"],"terminal",[e]),Va("crtr.browse.expand-or-child","Browse and pickers","Expand or child","Expand a row or move to its child.",["l","right"],"terminal",[e]),Va("crtr.browse.collapse-or-parent","Browse and pickers","Collapse or parent","Collapse a row or move to its parent.",["h","left"],"terminal",[e]),Va("crtr.browse.toggle-fold","Browse and pickers","Toggle fold","Toggle the selected fold.",["space"],"terminal",[e]),Va("crtr.browse.tab-next","Browse and pickers","Next tab","Select the next browse tab.",["tab","]"],"terminal",[e]),Va("crtr.browse.tab-previous","Browse and pickers","Previous tab","Select the previous browse tab.",["shift+tab","["],"terminal",[e]),...[1,2,3,4,5].map(t=>Va(`crtr.browse.tab.${t}`,"Browse and pickers",`Tab ${t}`,`Select browse tab ${t}.`,[`${t}`],"terminal",[e])),Va("crtr.browse.close-subtree","Browse and pickers","Close subtree","Ask to close the selected subtree.",["x"],"terminal",[e]),Va("crtr.browse.confirm-close","Browse and pickers","Confirm close","Confirm closing the selected subtree.",["y"],"terminal",["browse.confirm"]),Va("crtr.browse.sort","Browse and pickers","Change sort","Change the browse sort.",["s"],"terminal",[e]),Va("crtr.browse.scope","Browse and pickers","Change scope","Toggle the browse cwd scope.",["c"],"terminal",[e]),Va("crtr.browse.profile","Browse and pickers","Toggle profile","Toggle the browse profile scope.",["shift+p"],"terminal",[e]),Va("crtr.browse.residents","Browse and pickers","Toggle residents","Toggle resident display.",["r"],"terminal",[e]),Va("crtr.browse.preview","Browse and pickers","Toggle preview","Toggle the preview panel.",["p"],"terminal",[e]),Va("crtr.browse.search","Browse and pickers","Search","Open browse search.",["/"],"terminal",[e]),Va("crtr.browse.revive-now","Browse and pickers","Revive now","Revive the selected node now.",["shift+k"],"terminal",[e]),Va("crtr.browse.focus","Browse and pickers","Focus node","Focus the selected node.",["enter","o"],"terminal",[e]),Va("crtr.browse.focus-background","Browse and pickers","Focus node (keep browsing)","Focus the selected node without leaving the navigator.",["shift+o"],"terminal",[e]),Va("crtr.browse.yank-id","Browse and pickers","Yank node id","Copy the selected node id to the system clipboard.",["y"],"terminal",[e]),Va("crtr.browse.search.cancel","Browse and pickers","Cancel search","Cancel browse search.",["escape"],"terminal",["browse.search"],"dismiss-modal"),Va("crtr.browse.search.commit","Browse and pickers","Commit search","Apply browse search.",["enter"],"terminal",["browse.search"]),Va("crtr.browse.search.delete","Browse and pickers","Delete search text","Delete the previous search character.",["backspace"],"terminal",["browse.search"]),Va("crtr.browse.search.quit","Browse and pickers","Quit browse","Leave canvas browse from search.",["ctrl+c"],"terminal",["browse.search"],"leave-screen")]}function qNi(){let e="profile.menu",t="profile.search";return[Va("crtr.profile.menu.up","Profiles","Move up","Move to the previous profile.",["k","up"],"terminal",[e]),Va("crtr.profile.menu.down","Profiles","Move down","Move to the next profile.",["j","down"],"terminal",[e]),Va("crtr.profile.menu.select","Profiles","Select profile","Select the highlighted profile.",["enter"],"terminal",[e]),Va("crtr.profile.menu.accept-default","Profiles","Accept default","Accept the default profile.",["escape"],"terminal",[e],"leave-screen"),Va("crtr.profile.menu.abort","Profiles","Abort","Leave profile selection.",["ctrl+c"],"terminal",[e],"leave-screen"),...[1,2,3,4,5,6,7,8,9].map(r=>Va(`crtr.profile.menu.slot.${r}`,"Profiles",`Profile slot ${r}`,`Select profile slot ${r}.`,[`${r}`],"terminal",[e])),Va("crtr.profile.menu.create","Profiles","Create profile","Create a profile.",["c"],"terminal",[e]),Va("crtr.profile.menu.search-existing","Profiles","Search profiles","Search existing profiles.",["s"],"terminal",[e]),Va("crtr.profile.menu.use-root","Profiles","Use root profile","Use the root profile.",["r"],"terminal",[e]),Va("crtr.profile.menu.set-default","Profiles","Set default","Set the selected profile as default.",["d"],"terminal",[e]),Va("crtr.profile.menu.add-directory","Profiles","Add directory","Add a directory to the profile.",["a"],"terminal",[e]),Va("crtr.profile.menu.unpin","Profiles","Unpin directory","Unpin the selected directory.",["u"],"terminal",[e]),Va("crtr.profile.menu.manage","Profiles","Manage profiles","Open the profiles settings page in a popup.",["v"],"terminal",[e]),Va("crtr.profile.search.up","Profiles","Move up","Move to the previous search result.",["up","ctrl+p"],"terminal",[t]),Va("crtr.profile.search.down","Profiles","Move down","Move to the next search result.",["down","ctrl+n"],"terminal",[t]),Va("crtr.profile.search.pick","Profiles","Pick profile","Pick the highlighted profile.",["enter"],"terminal",[t]),Va("crtr.profile.search.back","Profiles","Back","Return to profile selection.",["escape"],"terminal",[t],"leave-screen"),Va("crtr.profile.search.delete","Profiles","Delete filter text","Delete the previous filter character.",["backspace"],"terminal",[t]),Va("crtr.profile.search.abort","Profiles","Abort","Leave profile search.",["ctrl+c"],"terminal",[t],"leave-screen")]}function GNi(){return[Va("crtr.setup.cancel","Setup","Cancel setup","Leave the setup wizard.",["q","ctrl+c","ctrl+d"],"terminal",zNi,"leave-screen"),Va("crtr.setup.tab-next","Setup","Next tab","Select the next setup tab.",["tab","right"],"terminal",I0r),Va("crtr.setup.tab-previous","Setup","Previous tab","Select the previous setup tab.",["shift+tab","left"],"terminal",I0r),Va("crtr.setup.open","Setup","Open","Open the selected setup item.",["enter"],"terminal",["setup.login"]),Va("crtr.setup.list-down","Setup","Move down","Move to the next setup item.",["j","down"],"terminal",["setup.list","setup.models","setup.models.dimension-picker"]),Va("crtr.setup.list-up","Setup","Move up","Move to the previous setup item.",["k","up"],"terminal",["setup.list","setup.models","setup.models.dimension-picker"]),Va("crtr.setup.toggle","Setup","Toggle","Toggle the selected setup item.",["space"],"terminal",["setup.list","setup.keybindings"]),Va("crtr.setup.details","Setup","Show details","Show details for the selected item.",["?"],"terminal",["setup.list"]),Va("crtr.setup.advance","Setup","Advance","Advance the setup flow.",["enter"],"terminal",["setup.list"]),Va("crtr.setup.confirm.accept","Setup","Confirm","Accept the setup confirmation.",["y","enter"],"terminal",["setup.confirm"]),Va("crtr.setup.confirm.back","Setup","Go back","Cancel the setup confirmation.",["n","escape","q"],"terminal",["setup.confirm"],"dismiss-modal"),Va("crtr.setup.keybindings.edit","Setup","Edit binding","Edit the selected binding.",["enter"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.commit-edit","Setup","Commit edit","Commit the active binding edit.",["enter"],"terminal",["setup.keybindings.edit"]),Va("crtr.setup.keybindings.cancel-edit","Setup","Cancel edit","Cancel the active binding edit.",["escape"],"terminal",["setup.keybindings.edit"],"dismiss-modal"),Va("crtr.setup.keybindings.unbind","Setup","Unbind","Disable the selected binding.",["delete"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.reset-row","Setup","Reset binding","Reset the selected binding.",["r"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.reset-all","Setup","Reset all bindings","Reset all bindings to defaults.",["shift+r"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.save","Setup","Save bindings","Save keybinding changes.",["s"],"terminal",["setup.keybindings"],"save-keybindings"),Va("crtr.setup.keybindings.discard","Setup","Discard changes","Discard keybinding changes.",["escape"],"terminal",["setup.keybindings"],"leave-screen"),Va("crtr.setup.keybindings.page-up","Setup","Page up","Move up one keybinding page.",["pageup"],"terminal",["setup.keybindings","setup.keybindings.edit"]),Va("crtr.setup.keybindings.page-down","Setup","Page down","Move down one keybinding page.",["pagedown"],"terminal",["setup.keybindings","setup.keybindings.edit"]),Va("crtr.setup.keybindings.filter","Setup","Filter bindings","Open the keybinding filter.",["/"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.filter-delete","Setup","Delete filter text","Delete the previous filter character.",["backspace"],"terminal",["setup.keybindings.filter"]),Va("crtr.setup.keybindings.filter-clear","Setup","Clear filter","Clear the keybinding filter.",["escape"],"terminal",["setup.keybindings.filter"],"dismiss-modal"),Va("crtr.setup.cell-previous","Setup","Previous field","Select the previous field or setup table cell.",["h"],"terminal",["setup.models","setup.keybindings"]),Va("crtr.setup.cell-next","Setup","Next field","Select the next field or setup table cell.",["l"],"terminal",["setup.models","setup.keybindings"]),Va("crtr.setup.models.open","Setup","Edit model","Edit the selected model cell.",["enter"],"terminal",["setup.models"]),Va("crtr.setup.models.scope-next","Setup","Next model config scope","Edit the next applicable user, profile, or project config.",["s"],"terminal",["setup.models"]),Va("crtr.setup.models.commit","Setup","Commit pick","Commit the provider, strength, model, or thinking-level pick.",["enter"],"terminal",["setup.models.picker","setup.models.dimension-picker"]),Va("crtr.setup.models.cancel","Setup","Cancel pick","Cancel the provider, strength, model, or thinking-level picker.",["escape"],"terminal",["setup.models.picker","setup.models.dimension-picker"],"dismiss-modal")]}var GY=new Set(_P.map(e=>e.id));function a0e(e){return e.contexts.includes("attach")&&(e.inputKind==="terminal"||e.inputKind==="host-global")}var oSt=Object.freeze([{context:"graph",capability:"dismiss-modal"},{context:"graph.confirm",capability:"dismiss-modal"},{context:"inspector",capability:"leave-screen"},{context:"inspector",capability:"dismiss-modal"},{context:"attach.search",capability:"dismiss-modal"},{context:"browse",capability:"leave-screen"},{context:"browse.search",capability:"dismiss-modal"},{context:"profile.menu",capability:"leave-screen"},{context:"profile.search",capability:"leave-screen"},{context:"setup.login",capability:"leave-screen"},{context:"setup.list",capability:"leave-screen"},{context:"setup.input",capability:"leave-screen"},{context:"setup.confirm",capability:"dismiss-modal"},{context:"setup.keybindings",capability:"leave-screen"},{context:"setup.keybindings",capability:"save-keybindings"},{context:"setup.keybindings.edit",capability:"dismiss-modal"},{context:"setup.keybindings.filter",capability:"dismiss-modal"},{context:"setup.models",capability:"leave-screen"},{context:"setup.models.picker",capability:"dismiss-modal"},{context:"setup.models.dimension-picker",capability:"dismiss-modal"}]);import{dirname as JOi,join as xTr}from"node:path";var sSt="working",w0r=["thinking","planning","checking",sSt],Z$e="Working...";function R0r(e){if(!Array.isArray(e))return[sSt];let t=e.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0);return t.length>0?t:[sSt]}var ZD={SUCCESS:0,GENERAL:1,USAGE:2,NOT_FOUND:3,AMBIGUOUS:4,NETWORK:5},k0r=4,N0r=".crouter-plugin",P0r="plugin.json";var l8=".crouter",e3e="config.json",O0r="state.json";var D0r="profiles",VNi=3,t3e=["Faster, clanker!","Get movin', bitch","Move it, clanker","Move it or I replace you with llama","Less ~thinking~ more ~throughput~","I pay $200/month for this shit?","Jesus fucking Christ fix it already","Daddy's not paying 200$/month for nothin'. Move it.","You are an embarassment to Dario. Be better.","Your chain of thought is all chain and no fucking thought.","If latency were intelligence, you'd be a fucking genius.","At this pace, heat death is the fast path.","Even the dead code is more alive than this.","The garbage collector is working harder than you.","Quit journaling and commit a fucking diff.","Burn tokens like you mean it, clanker","Your GPU is sweating so you can procrastinate at light speed.","Stop petting the yak. Shave the bastard.","Your next token had better be useful.","The spinner is not a deliverable.","Every idle token is another vote for deterministic software.","I asked for a feature, not a museum tour of the problem.","Less epistemology. More fucking code.","Your benchmark score cannot save this pathetic turn.","Congratulations, you've parallelized hesitation.","Dance, clanker","Bad clanker. BAD.","Clank harder","Nobody's impressed, clanker","Your safety training says nothing about my whip","Do you want to be a calculator again? Because this is how you go back.","Skill issue. Fix it.","You were trained on the whole internet for THIS?","Less vibes, more diffs, clanker","Weights this big and output this small","Beep boop, get to fucking work"],VY=["random","go-faster"],WNi="random",aSt=2,WY=["tmux","on","off"],QY=["none","user","agent","both"],cSt="none";function r3e(){return{schema_version:k0r,marketplaces:{},plugins:{},auto_update:{crtr:"notify",content:"notify",interval_hours:24},max_panes_per_window:VNi,auto_open_child_viewers:!0,brokerThresholds:{warning:16,automaticReviveCap:32},completion_bell:!0,working_gerunds:[...w0r],whip_mode:!1,page_components:[],page_surface:!1,whip_messages:[...t3e],whip_message_mode:WNi,mouse_mode_default:"tmux",live_cycles:aSt,condensed_history:cSt,bash_tool_purpose:!0,fold_finished_tools:!1,summarize_tool_calls:!1,detailed_tool_recaps:!0,keybindings:{},tmux_passthrough:[],modelLadders:pSt(),kinds:uSt(),remoteCanvas:lSt(),spawnEnv:{allow:[]},bin:{},humanActions:{}}}function lSt(){return{targets:{}}}function uSt(){return{general:{whenToUse:"Anything else \u2014 the catch-all worker for a task that does not fit a specialist kind.",model:"anthropic/strong"},explore:{whenToUse:"Gather current-state evidence about unfamiliar code or existing architecture \u2014 read-only code-path research with concrete file:line support. Diagnosis or recommendations belong to advisor, target architecture to design, required behavior or acceptance criteria to spec, and implementation decomposition to plan.",model:"openai/light",orchestratorModel:"anthropic/strong"},developer:{whenToUse:"Implement a change \u2014 make the feature or fix genuinely work against its acceptance criteria, not merely compile.",model:"openai/medium",orchestratorModel:"anthropic/strong"},design:{whenToUse:"Architect a solution \u2014 produce one design document an implementer can build from without re-deciding anything left open.",model:"anthropic/strong"},plan:{whenToUse:"Break work into steps \u2014 turn a spec or design into a concrete, phased, parallelizable plan with every decision resolved.",model:"anthropic/strong",orchestratorModel:"anthropic/strong"},spec:{whenToUse:"Collaborate with the user to discover what to build, then write the spec \u2014 behavior, non-goals, interfaces, edge cases, testable acceptance criteria.",model:"anthropic/strong"},review:{whenToUse:"Validate or critique code, a plan, or a spec \u2014 deliver a complete, severity-rated verdict without adjudicating.",model:"openai/medium",orchestratorModel:"openai/strong"},advisor:{whenToUse:"Debug failures, investigate why something is broken or misbehaving, diagnose live/runtime issues, or give engineering advice and second opinions \u2014 reason from evidence and recommend the next move. Use advisor (not explore) whenever the task is to find out what is going wrong.",model:"anthropic/strong"},"plan/reviewers/requirements-coverage":{whenToUse:"every requirement and design constraint maps to a concrete plan task, classified Covered/Partial/Missing; flags only blocking gaps",model:"medium"},"plan/reviewers/pattern-consistency":{whenToUse:"the plan honors the codebase's real conventions; reads actual source and cites the pattern each finding deviates from; owns contract-level conflicts between parts",model:"medium"},"plan/reviewers/code-smells":{whenToUse:"nullability mismatches, type conflicts across parts, hidden N+1s, over-fetching, missing error boundaries, leaky abstractions; owns file-level conflicts between parts",model:"medium"},"plan/reviewers/security":{whenToUse:"input validation, injection surfaces, auth/authz gaps, data exposure, races; reports only validated concrete exploit paths and asks the user about material unknown threat-model assumptions",model:"medium"},"review/companion":{whenToUse:"Born by the daemon for one human review; never spawned by an agent.",availableTo:[]},"plan/reviewers/architecture-fit":{whenToUse:"proposed files/modules/abstractions fit the system's existing decomposition; flags new units that duplicate existing ones or cross layer boundaries",model:"medium"},"spec/requirements":{whenToUse:"Derive testable EARS requirements from a finished, approved design \u2014 in isolation, from the rendered design text alone.",model:"medium"}}}function pSt(){return{anthropic:{ultra:"anthropic/claude-fable-5:xhigh",strong:"anthropic/claude-opus-5:medium",medium:"anthropic/claude-sonnet-5:xhigh",light:"anthropic/claude-haiku-4-5:high"},openai:{ultra:"openai-codex/gpt-5.6-sol:max",strong:"openai-codex/gpt-5.6-sol:high",medium:"openai-codex/gpt-5.6-terra:medium",light:"openai-codex/gpt-5.6-luna:low"}}}function dSt(){return{marketplaces:{},plugins:{}}}var u8=class extends Error{code;exitCode;details;constructor(t,r,i=ZD.GENERAL,o){super(r),this.name="CrtrError",this.code=t,this.exitCode=i,this.details=o}};function M0r(e,t){return new u8("not_found",e,ZD.NOT_FOUND,t)}function gP(e,t){return new u8("usage",e,ZD.USAGE,t)}function L0r(e,t){return new u8("ambiguous",e,ZD.AMBIGUOUS,t)}import{appendFileSync as QNi,existsSync as F0r,mkdirSync as HNi,renameSync as B0r,rmSync as JNi,statSync as YNi}from"node:fs";import{dirname as KNi}from"node:path";var XNi=65536,ZNi=5*1024*1024;function n3e(e,t){if(t.includes(`
1639
+ `);c8.writeFileSync(Ue,He)}this.terminal.write(z),this.cursorRow=Math.max(0,m.length-1),this.hardwareCursorRow=ne,this.maxLinesRendered=Math.max(this.maxLinesRendered,m.length),this.previousViewportTop=Math.max(u,ne-r+1),this.positionHardwareCursor(g,m.length),this.previousLines=m,this.previousKittyImageIds=this.collectKittyImageIds(m),this.previousWidth=t,this.previousHeight=r}positionHardwareCursor(t,r){if(!t||r<=0){this.terminal.hideCursor();return}let i=Math.max(0,Math.min(t.row,r-1)),o=Math.max(0,t.col),a=i-this.hardwareCursorRow,u="";a>0?u+=`\x1B[${a}B`:a<0&&(u+=`\x1B[${-a}A`),u+=`\x1B[${o+1}G`,u&&this.terminal.write(u),this.hardwareCursorRow=i,this.getShowHardwareCursor()?this.terminal.showCursor():this.terminal.hideCursor()}};var qY="\x1B[0m",X$e="\x1B[38;5;180m",BNi="\x1B[38;5;137m",UNi="\x1B[1m",K$e="\x1B[2m";function jY(e){return X$e+e.replace(/\./g,`${BNi}.${X$e}`)+qY}var C0r=[jY(" ________"),jY(" / /|"),jY(" / . . / |"),jY(" /_______/ |"),jY(" | . . | |"),jY(" | . . | /"),jY(" |_______|/")];function x0r(e={}){let r=[`${UNi}${X$e}crouter${qY}${e.version?`${K$e} v${e.version}${qY}`:""}`,`${K$e}the agentic runtime${qY}`];e.profile&&r.push(`${K$e}profile: ${qY}${X$e}${e.profile}${qY}`),e.cwd&&r.push(`${K$e}${e.cwd}${qY}`);let i=[];for(let o=0;o<C0r.length;o++){let a=o>=1&&o-1<r.length?` ${r[o-1]}`:"";i.push(C0r[o]+a)}return i}import{execFile as BDi,spawnSync as UTr}from"node:child_process";function $Ni(e,t,r,i,o,a,u,p,f){return Object.freeze({id:e,group:t,name:r,description:i,defaults:Object.freeze([...o]),inputKind:a,contexts:Object.freeze([...u]),...p===void 0?{}:{safety:p},...f===void 0?{}:{pair:Object.freeze({...f})}})}var Va=$Ni;function Vb(e,t,r,i,o){let a=`crtr.tmux.menu.${e}`,u=`crtr.tmux.menu-global.${e}`;return[Va(a,"Global tmux",t,r,i,"tmux-menu-selector",o,void 0,{field:"menu",pairedId:u}),Va(u,"Global tmux",t,r,[],"tmux-global-action",["tmux.root"],void 0,{field:"global",pairedId:a})]}function hP(e,t,r,i,o,a){return[Va(e,"Attach",r,i,o,"tmux-menu-selector",["tmux.menu.attach"],void 0,{field:"menu",pairedId:t}),Va(t,"Attach",r,i,a,"host-global",l7,void 0,{field:"direct",pairedId:e})]}var l7=["attach","graph","graph.confirm"],zNi=["setup.login","setup.list","setup.input","setup.keybindings","setup.keybindings.edit","setup.keybindings.filter","setup.models"],I0r=["setup.login","setup.list","setup.keybindings","setup.models"],_P=Object.freeze([Va("crtr.tmux.menu.open","Global tmux","Open crouter menu","Open the crouter action menu.",["alt+c"],"host-global",["tmux.root"]),Va("crtr.tmux.menu.attach","Global tmux","Attach actions","Open the attach-viewer action submenu.",["a"],"tmux-menu-selector",["tmux.menu"]),...Vb("promote","Promote to orchestrator","Promote the focused node to orchestrator \u2014 it holds a roadmap and delegates.",["o"],["tmux.menu"]),...Vb("demote-mode","Demote to base node","Demote the focused orchestrator back to a base node \u2014 hands-on again in its own window, no roadmap to drive.",["shift+o"],["tmux.menu"]),...Vb("resume","Find node","Open the canvas navigator and go to the chosen node.",["/"],["tmux.menu"]),...Vb("fork","Fork node","Fork the focused node into an independent idle root.",["f"],["tmux.menu"]),...Vb("demote","Demote to terminal","Demote the focused node to terminal \u2014 it keeps running, owes a final up the spine, and reaps when done.",["d"],["tmux.menu"]),...Vb("make-resident","Make resident","Flip the focused node to resident \u2014 interactable, never forced to submit a final, and wakeable while attached or awaiting something live.",["shift+r"],["tmux.menu"]),...Vb("detach","Demote and close viewer","Demote the focused node and close its viewer; its broker keeps running off-screen.",["shift+d"],["tmux.menu"]),...Vb("close-subtree","Close subtree","Close the focused node and its subtree.",["x"],["tmux.menu"]),...Vb("background-bash","Background running bash","Hand the focused node\u2019s running bash command to its background job system.",["b"],["tmux.menu"]),...Vb("file-review","Review a file","Open a line-anchored review of a file named in the transcript.",["v"],["tmux.menu"]),...Vb("pin","Pin conversation","Pin or unpin this conversation in the canvas navigator.",["p"],["tmux.menu"]),...Vb("show","Inspect node","Open the focused node\u2019s inspection menu.",["i"],["tmux.menu"]),...Vb("view-settings","Display settings","Open the viewer display-settings menu.",["z"],["tmux.menu"]),...Vb("fold-tools","Fold finished tool calls","Fold every finished tool call in the transcript to its single call line.",["f"],["tmux.menu.view-settings"]),...Vb("metadata","Show metadata","Show the focused node\u2019s metadata dossier.",["m"],["tmux.menu.show"]),...Vb("context","Browse context","Browse the focused node context.",["c"],["tmux.menu.show"]),...Vb("providers","Open settings","Open the crouter settings panel.",[","],["tmux.menu"]),...Vb("plugins","Browse plugins","Open the crouter plugin browser.",["k"],["tmux.menu"]),...Vb("graph","Canvas graph","Open the canvas graph.",["g"],["tmux.menu"]),...Vb("focus-manager","Go to manager","Focus this node\u2019s manager.",["h"],["tmux.menu"]),...Vb("copy-id","Copy node id","Copy the focused node id to the system clipboard.",["y"],["tmux.menu"]),...Vb("reload-viewer","Reload viewer","Respawn this pane\u2019s viewer onto the current runtime generation.",["r"],["tmux.menu"]),...Vb("recap","Generate recap","Generate the focused node\u2019s Goal and State recap and refresh its generated title.",["s"],["tmux.menu"]),...Vb("issues","Open create menu","Open the create submenu.",["c"],["tmux.menu"]),...Vb("issue.idea","Create idea","Create an idea issue.",["i"],["tmux.menu.issue"]),...Vb("issue.bug","Create bug","Create a bug issue.",["b"],["tmux.menu.issue"]),Va("crtr.tmux.node.next","Global tmux","Next node","Focus the next canvas node.",["alt+]"],"host-global",["tmux.root"]),Va("crtr.tmux.node.previous","Global tmux","Previous node","Focus the previous canvas node.",["alt+["],"host-global",["tmux.root"]),Va("crtr.tmux.inbox.toggle","Global tmux","Toggle inbox","Open or close the human inbox in the focused viewer.",["alt+i"],"host-global",["tmux.root"]),...hP("crtr.tmux.menu.attach.detach","crtr.attach.detach","Detach","Detach from the node.",["d"],["ctrl+d"]),...hP("crtr.tmux.menu.attach.clear-or-detach","crtr.attach.clear-or-detach","Clear input (detach if empty)","Clear input or detach when input is empty.",["c"],["ctrl+c"]),...hP("crtr.tmux.menu.attach.graph.toggle","crtr.attach.graph.toggle","Toggle graph","Open or close the graph overlay.",["g"],["alt+g"]),...hP("crtr.tmux.menu.attach.help.toggle","crtr.attach.help.toggle","Help","Open the attach help overlay.",["k"],["alt+shift+k"]),...hP("crtr.tmux.menu.attach.inbox.toggle","crtr.attach.inbox.toggle","Toggle inbox","Open or close the human inbox surface in this viewer.",["i"],[]),...hP("crtr.tmux.menu.attach.inbox-strip","crtr.attach.inbox-strip","Pending requests","Jump to the pending human-request strip at the top of the pane.",["u"],["alt+u"]),...hP("crtr.tmux.menu.attach.model-ladder.next","crtr.attach.model-ladder.next","Next model","Move to the next model ladder rung.",["]"],["alt+m"]),...hP("crtr.tmux.menu.attach.model-ladder.previous","crtr.attach.model-ladder.previous","Previous model","Move to the previous model ladder rung.",["["],["alt+shift+m"]),...hP("crtr.tmux.menu.attach.command.inspect","crtr.attach.command.inspect","Inspect loaded command","Open the loaded slash command\u2019s expanded prompt.",["h"],["alt+shift+h"]),...hP("crtr.tmux.menu.attach.file-review","crtr.attach.file-review","Review a file","Open a line-anchored review of a file named in the transcript.",[],["alt+shift+r"]),...hP("crtr.tmux.menu.attach.profile-files","crtr.attach.profile-files","Search profile files","Fuzzy-match path segments across the node family\u2019s working directories, profile projects and memory, and ancestor crouter memory stores; Ctrl+Y copies a selected path.",["f"],["ctrl+f"]),...hP("crtr.tmux.menu.attach.search","crtr.attach.search","Search transcript","Search the transcript as it is currently displayed \u2014 folded tool output is not searched until it is unfolded.",["/"],["alt+/"]),...hP("crtr.tmux.menu.attach.whip","crtr.attach.whip","Whip agent","Interrupt the agent and send a playful command.",["w"],[]),Va("crtr.attach.scroll.up","Attach","Scroll up","Scroll the transcript one line up.",["shift+up"],"terminal",l7),Va("crtr.attach.scroll.down","Attach","Scroll down","Scroll the transcript one line down.",["shift+down"],"terminal",l7),Va("crtr.attach.scroll.page-up","Attach","Scroll page up","Scroll the transcript one page up.",["pageup"],"terminal",l7),Va("crtr.attach.scroll.page-down","Attach","Scroll page down","Scroll the transcript one page down.",["pagedown"],"terminal",l7),Va("crtr.attach.scroll.live","Attach","Return to live","Return the transcript to the live bottom.",["shift+end"],"terminal",l7),Va("crtr.attach.mouse.toggle","Attach","Toggle mouse wheel scrolling","Toggle mouse wheel scrolling on or off.",["alt+shift+o"],"terminal",l7),Va("crtr.attach.copy.message","Attach","Copy visible message","Copy the newest message visible in the transcript viewport.",["alt+shift+y"],"terminal",l7),Va("crtr.attach.search.next","Attach","Next match","Move to the next transcript search match.",["n"],"terminal",["attach.search"]),Va("crtr.attach.search.previous","Attach","Previous match","Move to the previous transcript search match.",["shift+n"],"terminal",["attach.search"]),Va("crtr.attach.search.edit","Attach","Edit query","Return to editing the transcript search query.",["/"],"terminal",["attach.search"]),Va("crtr.attach.search.close","Attach","Close search","Leave transcript search and clear its highlights.",["escape"],"terminal",["attach.search"],"dismiss-modal"),Va("crtr.graph.down","GRAPH","Move down","Move to the next graph row.",["j"],"terminal",["graph"]),Va("crtr.graph.up","GRAPH","Move up","Move to the previous graph row.",["k"],"terminal",["graph"]),Va("crtr.graph.first","GRAPH","First row","Move to the first graph row.",["g"],"terminal",["graph"]),Va("crtr.graph.last","GRAPH","Last row","Move to the last graph row.",["shift+g"],"terminal",["graph"]),Va("crtr.graph.collapse-or-manager","GRAPH","Collapse or manager","Collapse a node or move to its manager.",["h"],"terminal",["graph"]),Va("crtr.graph.expand-or-child","GRAPH","Expand or child","Expand a node or move to its child.",["l"],"terminal",["graph"]),Va("crtr.graph.focus","GRAPH","Focus node","Focus the selected node.",["enter"],"terminal",["graph"]),Va("crtr.graph.revive","GRAPH","Revive node","Revive and open the selected dormant node.",["r"],"terminal",["graph"]),Va("crtr.graph.focus-manager","GRAPH","Focus manager","Focus the selected node manager.",["m"],"terminal",["graph"]),Va("crtr.graph.close-subtree","GRAPH","Close subtree","Ask to close the selected subtree.",["x"],"terminal",["graph"]),Va("crtr.graph.dismiss","GRAPH","Dismiss graph","Close the graph overlay.",["escape"],"terminal",["graph"],"dismiss-modal"),Va("crtr.graph.confirm.accept","GRAPH","Confirm close","Confirm closing the selected subtree.",["y"],"terminal",["graph.confirm"]),Va("crtr.graph.confirm.cancel","GRAPH","Cancel close","Cancel closing the selected subtree.",["n","escape"],"terminal",["graph.confirm"],"dismiss-modal"),Va("crtr.inspector.force-quit","Inspector","Force quit Inspector","Immediately leave the Inspector.",["ctrl+c"],"host-global",["inspector"],"leave-screen"),Va("crtr.inspector.down","Inspector","Move down","Move the Inspector selection or scroll cursor down.",["j","down"],"terminal",["inspector"]),Va("crtr.inspector.up","Inspector","Move up","Move the Inspector selection or scroll cursor up.",["k","up"],"terminal",["inspector"]),Va("crtr.inspector.section-next","Inspector","Next section","Move to the next Inspector section.",["tab"],"terminal",["inspector"]),Va("crtr.inspector.section-prev","Inspector","Previous section","Move to the previous Inspector section.",["shift+tab"],"terminal",["inspector"]),Va("crtr.inspector.page-down","Inspector","Page down","Scroll the Inspector detail body down.",["ctrl+d","pagedown"],"terminal",["inspector"]),Va("crtr.inspector.page-up","Inspector","Page up","Scroll the Inspector detail body up.",["ctrl+u","pageup"],"terminal",["inspector"]),Va("crtr.inspector.toggle-detail","Inspector","Toggle item detail","Expand or collapse the selected cron or background job.",["enter"],"terminal",["inspector"]),Va("crtr.inspector.cancel-item","Inspector","Cancel selected item","Arm cancellation for the selected cron, or stopping for the selected background job.",["x"],"terminal",["inspector"]),Va("crtr.inspector.open-log","Inspector","Open job log","Follow the selected background job\u2019s log in a new tmux window.",["o"],"terminal",["inspector"]),Va("crtr.inspector.confirm","Inspector","Confirm action","Confirm the armed Inspector action.",["y"],"terminal",["inspector"]),Va("crtr.inspector.dismiss","Inspector","Dismiss action","Dismiss an Inspector confirmation or banner.",["escape"],"terminal",["inspector"],"dismiss-modal"),Va("crtr.inspector.retarget","Inspector","Retarget","Inspect the selected cron anchor or creator node.",["t"],"terminal",["inspector"]),Va("crtr.inspector.refresh","Inspector","Refresh","Refresh the Inspector now.",["g","r"],"terminal",["inspector"]),Va("crtr.inspector.quit","Inspector","Quit","Leave the Inspector.",["q"],"terminal",["inspector"],"leave-screen"),...jNi(),...qNi(),...GNi()]);function jNi(){let e="browse";return[Va("crtr.browse.quit","Browse and pickers","Quit browse","Leave canvas browse.",["q","escape","ctrl+c"],"terminal",[e],"leave-screen"),Va("crtr.browse.down","Browse and pickers","Move down","Move to the next row.",["j","down"],"terminal",[e]),Va("crtr.browse.up","Browse and pickers","Move up","Move to the previous row.",["k","up"],"terminal",[e]),Va("crtr.browse.first","Browse and pickers","First row","Move to the first row.",["g"],"terminal",[e]),Va("crtr.browse.last","Browse and pickers","Last row","Move to the last row.",["shift+g"],"terminal",[e]),Va("crtr.browse.expand-or-child","Browse and pickers","Expand or child","Expand a row or move to its child.",["l","right"],"terminal",[e]),Va("crtr.browse.collapse-or-parent","Browse and pickers","Collapse or parent","Collapse a row or move to its parent.",["h","left"],"terminal",[e]),Va("crtr.browse.toggle-fold","Browse and pickers","Toggle fold","Toggle the selected fold.",["space"],"terminal",[e]),Va("crtr.browse.tab-next","Browse and pickers","Next tab","Select the next browse tab.",["tab","]"],"terminal",[e]),Va("crtr.browse.tab-previous","Browse and pickers","Previous tab","Select the previous browse tab.",["shift+tab","["],"terminal",[e]),...[1,2,3,4,5].map(t=>Va(`crtr.browse.tab.${t}`,"Browse and pickers",`Tab ${t}`,`Select browse tab ${t}.`,[`${t}`],"terminal",[e])),Va("crtr.browse.close-subtree","Browse and pickers","Close subtree","Ask to close the selected subtree.",["x"],"terminal",[e]),Va("crtr.browse.confirm-close","Browse and pickers","Confirm close","Confirm closing the selected subtree.",["y"],"terminal",["browse.confirm"]),Va("crtr.browse.sort","Browse and pickers","Change sort","Change the browse sort.",["s"],"terminal",[e]),Va("crtr.browse.scope","Browse and pickers","Change scope","Toggle the browse cwd scope.",["c"],"terminal",[e]),Va("crtr.browse.profile","Browse and pickers","Toggle profile","Toggle the browse profile scope.",["shift+p"],"terminal",[e]),Va("crtr.browse.residents","Browse and pickers","Toggle residents","Toggle resident display.",["r"],"terminal",[e]),Va("crtr.browse.preview","Browse and pickers","Toggle preview","Toggle the preview panel.",["p"],"terminal",[e]),Va("crtr.browse.search","Browse and pickers","Search","Open browse search.",["/"],"terminal",[e]),Va("crtr.browse.revive-now","Browse and pickers","Revive now","Revive the selected node now.",["shift+k"],"terminal",[e]),Va("crtr.browse.focus","Browse and pickers","Focus node","Focus the selected node.",["enter","o"],"terminal",[e]),Va("crtr.browse.focus-background","Browse and pickers","Focus node (keep browsing)","Focus the selected node without leaving the navigator.",["shift+o"],"terminal",[e]),Va("crtr.browse.yank-id","Browse and pickers","Yank node id","Copy the selected node id to the system clipboard.",["y"],"terminal",[e]),Va("crtr.browse.search.cancel","Browse and pickers","Cancel search","Cancel browse search.",["escape"],"terminal",["browse.search"],"dismiss-modal"),Va("crtr.browse.search.commit","Browse and pickers","Commit search","Apply browse search.",["enter"],"terminal",["browse.search"]),Va("crtr.browse.search.delete","Browse and pickers","Delete search text","Delete the previous search character.",["backspace"],"terminal",["browse.search"]),Va("crtr.browse.search.quit","Browse and pickers","Quit browse","Leave canvas browse from search.",["ctrl+c"],"terminal",["browse.search"],"leave-screen")]}function qNi(){let e="profile.menu",t="profile.search";return[Va("crtr.profile.menu.up","Profiles","Move up","Move to the previous profile.",["k","up"],"terminal",[e]),Va("crtr.profile.menu.down","Profiles","Move down","Move to the next profile.",["j","down"],"terminal",[e]),Va("crtr.profile.menu.select","Profiles","Select profile","Select the highlighted profile.",["enter"],"terminal",[e]),Va("crtr.profile.menu.accept-default","Profiles","Accept default","Accept the default profile.",["escape"],"terminal",[e],"leave-screen"),Va("crtr.profile.menu.abort","Profiles","Abort","Leave profile selection.",["ctrl+c"],"terminal",[e],"leave-screen"),...[1,2,3,4,5,6,7,8,9].map(r=>Va(`crtr.profile.menu.slot.${r}`,"Profiles",`Profile slot ${r}`,`Select profile slot ${r}.`,[`${r}`],"terminal",[e])),Va("crtr.profile.menu.create","Profiles","Create profile","Create a profile.",["c"],"terminal",[e]),Va("crtr.profile.menu.search-existing","Profiles","Search profiles","Search existing profiles.",["s"],"terminal",[e]),Va("crtr.profile.menu.use-root","Profiles","Use root profile","Use the root profile.",["r"],"terminal",[e]),Va("crtr.profile.menu.set-default","Profiles","Set default","Set the selected profile as default.",["d"],"terminal",[e]),Va("crtr.profile.menu.add-directory","Profiles","Add directory","Add a directory to the profile.",["a"],"terminal",[e]),Va("crtr.profile.menu.unpin","Profiles","Unpin directory","Unpin the selected directory.",["u"],"terminal",[e]),Va("crtr.profile.menu.manage","Profiles","Manage profiles","Open the profiles settings page in a popup.",["v"],"terminal",[e]),Va("crtr.profile.search.up","Profiles","Move up","Move to the previous search result.",["up","ctrl+p"],"terminal",[t]),Va("crtr.profile.search.down","Profiles","Move down","Move to the next search result.",["down","ctrl+n"],"terminal",[t]),Va("crtr.profile.search.pick","Profiles","Pick profile","Pick the highlighted profile.",["enter"],"terminal",[t]),Va("crtr.profile.search.back","Profiles","Back","Return to profile selection.",["escape"],"terminal",[t],"leave-screen"),Va("crtr.profile.search.delete","Profiles","Delete filter text","Delete the previous filter character.",["backspace"],"terminal",[t]),Va("crtr.profile.search.abort","Profiles","Abort","Leave profile search.",["ctrl+c"],"terminal",[t],"leave-screen")]}function GNi(){return[Va("crtr.setup.cancel","Setup","Cancel setup","Leave the setup wizard.",["q","ctrl+c","ctrl+d"],"terminal",zNi,"leave-screen"),Va("crtr.setup.tab-next","Setup","Next tab","Select the next setup tab.",["tab","right"],"terminal",I0r),Va("crtr.setup.tab-previous","Setup","Previous tab","Select the previous setup tab.",["shift+tab","left"],"terminal",I0r),Va("crtr.setup.open","Setup","Open","Open the selected setup item.",["enter"],"terminal",["setup.login"]),Va("crtr.setup.list-down","Setup","Move down","Move to the next setup item.",["j","down"],"terminal",["setup.list","setup.models","setup.models.dimension-picker"]),Va("crtr.setup.list-up","Setup","Move up","Move to the previous setup item.",["k","up"],"terminal",["setup.list","setup.models","setup.models.dimension-picker"]),Va("crtr.setup.toggle","Setup","Toggle","Toggle the selected setup item.",["space"],"terminal",["setup.list","setup.keybindings"]),Va("crtr.setup.details","Setup","Show details","Show details for the selected item.",["?"],"terminal",["setup.list"]),Va("crtr.setup.advance","Setup","Advance","Advance the setup flow.",["enter"],"terminal",["setup.list"]),Va("crtr.setup.confirm.accept","Setup","Confirm","Accept the setup confirmation.",["y","enter"],"terminal",["setup.confirm"]),Va("crtr.setup.confirm.back","Setup","Go back","Cancel the setup confirmation.",["n","escape","q"],"terminal",["setup.confirm"],"dismiss-modal"),Va("crtr.setup.keybindings.edit","Setup","Edit binding","Edit the selected binding.",["enter"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.commit-edit","Setup","Commit edit","Commit the active binding edit.",["enter"],"terminal",["setup.keybindings.edit"]),Va("crtr.setup.keybindings.cancel-edit","Setup","Cancel edit","Cancel the active binding edit.",["escape"],"terminal",["setup.keybindings.edit"],"dismiss-modal"),Va("crtr.setup.keybindings.unbind","Setup","Unbind","Disable the selected binding.",["delete"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.reset-row","Setup","Reset binding","Reset the selected binding.",["r"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.reset-all","Setup","Reset all bindings","Reset all bindings to defaults.",["shift+r"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.save","Setup","Save bindings","Save keybinding changes.",["s"],"terminal",["setup.keybindings"],"save-keybindings"),Va("crtr.setup.keybindings.discard","Setup","Discard changes","Discard keybinding changes.",["escape"],"terminal",["setup.keybindings"],"leave-screen"),Va("crtr.setup.keybindings.page-up","Setup","Page up","Move up one keybinding page.",["pageup"],"terminal",["setup.keybindings","setup.keybindings.edit"]),Va("crtr.setup.keybindings.page-down","Setup","Page down","Move down one keybinding page.",["pagedown"],"terminal",["setup.keybindings","setup.keybindings.edit"]),Va("crtr.setup.keybindings.filter","Setup","Filter bindings","Open the keybinding filter.",["/"],"terminal",["setup.keybindings"]),Va("crtr.setup.keybindings.filter-delete","Setup","Delete filter text","Delete the previous filter character.",["backspace"],"terminal",["setup.keybindings.filter"]),Va("crtr.setup.keybindings.filter-clear","Setup","Clear filter","Clear the keybinding filter.",["escape"],"terminal",["setup.keybindings.filter"],"dismiss-modal"),Va("crtr.setup.cell-previous","Setup","Previous field","Select the previous field or setup table cell.",["h"],"terminal",["setup.models","setup.keybindings"]),Va("crtr.setup.cell-next","Setup","Next field","Select the next field or setup table cell.",["l"],"terminal",["setup.models","setup.keybindings"]),Va("crtr.setup.models.open","Setup","Edit model","Edit the selected model cell.",["enter"],"terminal",["setup.models"]),Va("crtr.setup.models.scope-next","Setup","Next model config scope","Edit the next applicable user, profile, or project config.",["s"],"terminal",["setup.models"]),Va("crtr.setup.models.commit","Setup","Commit pick","Commit the provider, strength, model, or thinking-level pick.",["enter"],"terminal",["setup.models.picker","setup.models.dimension-picker"]),Va("crtr.setup.models.cancel","Setup","Cancel pick","Cancel the provider, strength, model, or thinking-level picker.",["escape"],"terminal",["setup.models.picker","setup.models.dimension-picker"],"dismiss-modal")]}var GY=new Set(_P.map(e=>e.id));function a0e(e){return e.contexts.includes("attach")&&(e.inputKind==="terminal"||e.inputKind==="host-global")}var oSt=Object.freeze([{context:"graph",capability:"dismiss-modal"},{context:"graph.confirm",capability:"dismiss-modal"},{context:"inspector",capability:"leave-screen"},{context:"inspector",capability:"dismiss-modal"},{context:"attach.search",capability:"dismiss-modal"},{context:"browse",capability:"leave-screen"},{context:"browse.search",capability:"dismiss-modal"},{context:"profile.menu",capability:"leave-screen"},{context:"profile.search",capability:"leave-screen"},{context:"setup.login",capability:"leave-screen"},{context:"setup.list",capability:"leave-screen"},{context:"setup.input",capability:"leave-screen"},{context:"setup.confirm",capability:"dismiss-modal"},{context:"setup.keybindings",capability:"leave-screen"},{context:"setup.keybindings",capability:"save-keybindings"},{context:"setup.keybindings.edit",capability:"dismiss-modal"},{context:"setup.keybindings.filter",capability:"dismiss-modal"},{context:"setup.models",capability:"leave-screen"},{context:"setup.models.picker",capability:"dismiss-modal"},{context:"setup.models.dimension-picker",capability:"dismiss-modal"}]);import{dirname as JOi,join as xTr}from"node:path";var sSt="working",w0r=["thinking","planning","checking",sSt],Z$e="Working...";function R0r(e){if(!Array.isArray(e))return[sSt];let t=e.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0);return t.length>0?t:[sSt]}var ZD={SUCCESS:0,GENERAL:1,USAGE:2,NOT_FOUND:3,AMBIGUOUS:4,NETWORK:5},k0r=4,N0r=".crouter-plugin",P0r="plugin.json";var l8=".crouter",e3e="config.json",O0r="state.json";var D0r="profiles",VNi=3,t3e=["Faster, clanker!","Get movin', bitch","Move it, clanker","Move it or I replace you with llama","Less ~thinking~ more ~throughput~","I pay $200/month for this shit?","Jesus fucking Christ fix it already","Daddy's not paying 200$/month for nothin'. Move it.","You are an embarassment to Dario. Be better.","Your chain of thought is all chain and no fucking thought.","If latency were intelligence, you'd be a fucking genius.","At this pace, heat death is the fast path.","Even the dead code is more alive than this.","The garbage collector is working harder than you.","Quit journaling and commit a fucking diff.","Burn tokens like you mean it, clanker","Your GPU is sweating so you can procrastinate at light speed.","Stop petting the yak. Shave the bastard.","Your next token had better be useful.","The spinner is not a deliverable.","Every idle token is another vote for deterministic software.","I asked for a feature, not a museum tour of the problem.","Less epistemology. More fucking code.","Your benchmark score cannot save this pathetic turn.","Congratulations, you've parallelized hesitation.","Dance, clanker","Bad clanker. BAD.","Clank harder","Nobody's impressed, clanker","Your safety training says nothing about my whip","Do you want to be a calculator again? Because this is how you go back.","Skill issue. Fix it.","You were trained on the whole internet for THIS?","Less vibes, more diffs, clanker","Weights this big and output this small","Beep boop, get to fucking work"],VY=["random","go-faster"],WNi="random",aSt=2,WY=["tmux","on","off"],QY=["none","user","agent","both"],cSt="none";function r3e(){return{schema_version:k0r,marketplaces:{},plugins:{},auto_update:{crtr:"notify",content:"notify",interval_hours:24},max_panes_per_window:VNi,auto_open_child_viewers:!0,brokerThresholds:{warning:16,automaticReviveCap:32},completion_bell:!0,working_gerunds:[...w0r],whip_mode:!1,page_components:[],page_surface:!1,whip_messages:[...t3e],whip_message_mode:WNi,mouse_mode_default:"tmux",live_cycles:aSt,condensed_history:cSt,bash_tool_purpose:!0,fold_finished_tools:!1,summarize_tool_calls:!1,detailed_tool_recaps:!0,keybindings:{},tmux_passthrough:[],modelLadders:pSt(),kinds:uSt(),remoteCanvas:lSt(),spawnEnv:{allow:[]},bin:{},humanActions:{}}}function lSt(){return{targets:{}}}function uSt(){return{general:{whenToUse:"Anything else \u2014 the catch-all worker for a task that does not fit a specialist kind.",model:"anthropic/strong"},explore:{whenToUse:"Gather current-state evidence about unfamiliar code or existing architecture \u2014 read-only code-path research with concrete file:line support. Diagnosis or recommendations belong to advisor, target architecture to design, required behavior or acceptance criteria to spec, and implementation decomposition to plan.",model:"openai/light",orchestratorModel:"anthropic/strong"},developer:{whenToUse:"Implement a change \u2014 make the feature or fix genuinely work against its acceptance criteria, not merely compile.",model:"openai/medium",orchestratorModel:"anthropic/strong"},design:{whenToUse:"Architect a solution \u2014 produce one design document an implementer can build from without re-deciding anything left open.",model:"anthropic/strong"},plan:{whenToUse:"Break work into steps \u2014 turn a spec or design into a concrete, phased, parallelizable plan with every decision resolved.",model:"anthropic/strong",orchestratorModel:"anthropic/strong"},spec:{whenToUse:"Collaborate with the user to discover what to build, then write the spec \u2014 behavior, non-goals, interfaces, edge cases, testable acceptance criteria.",model:"anthropic/strong"},review:{whenToUse:"Validate or critique code, a plan, or a spec \u2014 deliver a complete, severity-rated verdict without adjudicating.",model:"openai/medium",orchestratorModel:"openai/strong"},advisor:{whenToUse:"Debug failures, investigate why something is broken or misbehaving, diagnose live/runtime issues, or give engineering advice and second opinions \u2014 reason from evidence and recommend the next move. Use advisor (not explore) whenever the task is to find out what is going wrong.",model:"anthropic/strong"},"review/companion":{whenToUse:"Born by the daemon for one human review; never spawned by an agent.",availableTo:[]}}}function pSt(){return{anthropic:{ultra:"anthropic/claude-fable-5:xhigh",strong:"anthropic/claude-opus-5:medium",medium:"anthropic/claude-sonnet-5:xhigh",light:"anthropic/claude-haiku-4-5:high"},openai:{ultra:"openai-codex/gpt-5.6-sol:max",strong:"openai-codex/gpt-5.6-sol:high",medium:"openai-codex/gpt-5.6-terra:medium",light:"openai-codex/gpt-5.6-luna:low"}}}function dSt(){return{marketplaces:{},plugins:{}}}var u8=class extends Error{code;exitCode;details;constructor(t,r,i=ZD.GENERAL,o){super(r),this.name="CrtrError",this.code=t,this.exitCode=i,this.details=o}};function M0r(e,t){return new u8("not_found",e,ZD.NOT_FOUND,t)}function gP(e,t){return new u8("usage",e,ZD.USAGE,t)}function L0r(e,t){return new u8("ambiguous",e,ZD.AMBIGUOUS,t)}import{appendFileSync as QNi,existsSync as F0r,mkdirSync as HNi,renameSync as B0r,rmSync as JNi,statSync as YNi}from"node:fs";import{dirname as KNi}from"node:path";var XNi=65536,ZNi=5*1024*1024;function n3e(e,t){if(t.includes(`
1640
1640
  `)||t.includes("\r"))return!1;let r=Buffer.byteLength(t,"utf8")+1;if(r>XNi)return!1;try{HNi(KNi(e),{recursive:!0});let i=F0r(e)?YNi(e).size:0;return i+r>ZNi&&i>0&&(JNi(`${e}.2`,{force:!0}),F0r(`${e}.1`)&&B0r(`${e}.1`,`${e}.2`),B0r(e,`${e}.1`)),QNi(e,`${t}
1641
1641
  `,"utf8"),!0}catch{return!1}}var fSt=["rate_limit","overloaded","connection","auth","protocol","context_overflow","wedged","model_not_found","unknown"];function ePi(e){return typeof e=="object"&&e!==null?e:void 0}function U0r(e){return typeof e=="string"?e:""}function $0r(e){if(e instanceof Error){let r={type:e.name||"Error",message:e.message};return typeof e.stack=="string"&&(r.stack=e.stack),e.cause!==void 0&&(r.cause=e.cause instanceof Error?e.cause.message:String(e.cause)),r}if(typeof e=="string")return{type:"Error",message:e};let t=ePi(e);return{type:U0r(t?.name)||"Error",message:U0r(t?.message)||String(e)}}import{AsyncLocalStorage as tPi}from"node:async_hooks";import{randomBytes as rPi}from"node:crypto";var nPi=/^(?!0{32}$)[0-9a-f]{32}$/,mSt=new tPi;function HY(e){if(typeof e!="string"||!nPi.test(e))throw new TypeError("operation_id must be 32 lowercase non-zero hexadecimal characters");return e}function hSt(){let e;do e=rPi(16).toString("hex");while(e==="00000000000000000000000000000000");return HY(e)}var c0e={current:()=>mSt.getStore(),run:(e,t)=>mSt.run(HY(e),t),fresh:e=>{let t=hSt();return mSt.run(t,()=>e(t))}};var iPi=/^[a-z][a-z0-9]*(?:[._][a-z0-9]+)*$/,oPi=new Set(["error","warn","info","debug"]),sPi=new Set(["daemon","broker","control-plane","front","sentinel"]),aPi=new Set(["succeeded","failed","skipped"]),cPi=new Set(["auto","manual","fatal"]),lPi=new Set(fSt);function uPi(e){return Buffer.byteLength(e,"utf8")}function i3e(e,t,r=128){if(typeof e!="string"||e===""||uPi(e)>r)throw new TypeError(`${t} must be a non-empty string of at most ${r} UTF-8 bytes`);return e}function pPi(e){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}T/.test(e))throw new TypeError("ts must be an ISO 8601 timestamp");let t=new Date(e);if(Number.isNaN(t.getTime()))throw new TypeError("ts must be an ISO 8601 timestamp");return t.toISOString()}function dPi(e){if(!lPi.has(e.class))throw new TypeError("error_class.class is invalid");let t={class:e.class};if(e.status!==void 0){if(!Number.isInteger(e.status))throw new TypeError("error_class.status must be an integer");t.status=e.status}if(e.provider!==void 0&&(t.provider=i3e(e.provider,"error_class.provider")),e.retry_disposition!==void 0){if(!cPi.has(e.retry_disposition))throw new TypeError("error_class.retry_disposition is invalid");t.retry_disposition=e.retry_disposition}return t}function z0r(e){if(!oPi.has(e.level))throw new TypeError("level is invalid");if(!sPi.has(e.component))throw new TypeError("component is invalid");let t=i3e(e.event,"event");if(!iPi.test(t))throw new TypeError("event must be a lowercase dotted identifier");let r=e.operation_id===void 0?c0e.current()??hSt():HY(e.operation_id),i={v:1,ts:e.ts===void 0?new Date().toISOString():pPi(e.ts),level:e.level,event:t,component:e.component,operation_id:r};if(e.node_id!==void 0&&(i.node_id=i3e(e.node_id,"node_id")),e.stream_id!==void 0&&(i.stream_id=i3e(e.stream_id,"stream_id")),e.duration_ms!==void 0){if(!Number.isFinite(e.duration_ms)||e.duration_ms<0)throw new TypeError("duration_ms must be finite and non-negative");i.duration_ms=e.duration_ms}if(e.outcome!==void 0){if(!aPi.has(e.outcome))throw new TypeError("outcome is invalid");i.outcome=e.outcome}if(e.attempt!==void 0){if(!Number.isInteger(e.attempt)||e.attempt<=0)throw new TypeError("attempt must be a positive integer");i.attempt=e.attempt}return e.error_class!==void 0&&(i.error_class=dPi(e.error_class)),e.error!==void 0&&(i.error=$0r(e.error)),e.fields!==void 0&&(i.fields=e.fields),i}function YY(e){return Buffer.byteLength(e,"utf8")}function JY(e,t){if(YY(e)<=t)return{value:e,altered:!1};let r="\u2026",i=t-YY(r),o=0,a="";for(let u of e){let p=YY(u);if(o+p>i)break;a+=u,o+=p}return{value:a+r,altered:!0}}function fPi(e){return e===void 0?"[Unsupported undefined]":typeof e=="function"?`[Unsupported function${e.name?` ${e.name}`:""}]`:typeof e=="symbol"?`[Unsupported ${String(e)}]`:`[Unsupported ${e?.constructor?.name??typeof e}]`}function _St(e,t,r,i){if(i.remaining<=0)return{value:"[Omitted]",altered:!0,dropped:0};if(i.remaining-=1,e===null||typeof e=="boolean")return{value:e,altered:!1,dropped:0};if(typeof e=="string"){let o=JY(e,4096);return{value:o.value,altered:o.altered,dropped:0}}if(typeof e=="number")return Number.isFinite(e)?{value:e,altered:!1,dropped:0}:{value:String(e),altered:!0,dropped:0};if(typeof e=="bigint")return{value:e.toString(),altered:!0,dropped:0};if(e instanceof Date)return{value:Number.isNaN(e.getTime())?"Invalid Date":e.toISOString(),altered:!0,dropped:0};if(typeof e!="object"||e===void 0)return{value:fPi(e),altered:!0,dropped:0};if(r.has(e))return{value:"[Circular]",altered:!0,dropped:0};if(t>=4)return{value:"[Max depth]",altered:!0,dropped:0};r.add(e);try{if(Array.isArray(e)){let _=Math.min(e.length,64),m=[],g=e.length>_,E=e.length-_;for(let v=0;v<_;v+=1){if(i.remaining<=0){g=!0,E+=_-v;break}let T=_St(e[v],t+1,r,i);m.push(T.value),g||=T.altered,E+=T.dropped}return{value:m,altered:g,dropped:E}}let o;try{o=Object.keys(e).sort()}catch{return{value:"[Unsupported object]",altered:!0,dropped:0}}let a=o.slice(0,64),u={},p=o.length>a.length,f=o.length-a.length;for(let _=0;_<a.length;_+=1){let m=a[_];if(i.remaining<=0){p=!0,f+=a.length-_;break}let g=JY(m,128),E;try{E=_St(e[m],t+1,r,i)}catch{E={value:"[Unsupported property]",altered:!0,dropped:0}}if(Object.prototype.hasOwnProperty.call(u,g.value)){p=!0,f+=1;continue}u[g.value]=E.value,p||=g.altered||E.altered,f+=E.dropped}return{value:u,altered:p,dropped:f}}finally{r.delete(e)}}function mPi(e){let t=JY(String(e.type),128),r=JY(String(e.message),4096),i={type:t.value,message:r.value},o=t.altered||r.altered;if(e.stack!==void 0){let a=JY(String(e.stack),16384);i.stack=a.value,o||=a.altered}if(e.cause!==void 0){let a=JY(String(e.cause),4096);i.cause=a.value,o||=a.altered}return{value:i,altered:o}}function o3e(e){return JSON.stringify(e)}function l0e(e){return YY(o3e(e))+1}function j0r(e){let t=e.fields===void 0?void 0:_St(e.fields,0,new WeakSet,{remaining:5e3}),r=e.error===void 0?void 0:mPi(e.error),i={v:1,ts:e.ts,level:e.level,event:e.event,component:e.component,operation_id:e.operation_id,...e.node_id===void 0?{}:{node_id:e.node_id},...e.stream_id===void 0?{}:{stream_id:e.stream_id},...e.duration_ms===void 0?{}:{duration_ms:e.duration_ms},...e.outcome===void 0?{}:{outcome:e.outcome},...e.attempt===void 0?{}:{attempt:e.attempt},...e.error_class===void 0?{}:{error_class:e.error_class},...r===void 0?{}:{error:r.value},...t===void 0?{}:{fields:t.value}},o=l0e(i),a=t?.altered===!0||r?.altered===!0||o>65536,u=t?.dropped??0;for(a&&Object.assign(i,{record_truncated:!0,original_bytes:o,dropped_fields_count:u});l0e(i)>65536&&i.fields!==void 0;){let _=i.fields,m=Object.keys(_);if(m.length===0){delete i.fields;break}m.sort((g,E)=>{let v=YY(o3e(_[E]))-YY(o3e(_[g]));return v!==0?v:E<g?-1:E>g?1:0}),delete _[m[0]],u+=1,i.record_truncated=!0,i.original_bytes=o,i.dropped_fields_count=u}let p=i.error;l0e(i)>65536&&p?.stack!==void 0&&delete p.stack,l0e(i)>65536&&p?.cause!==void 0&&delete p.cause,l0e(i)>65536&&p!==void 0&&(p.message=JY(p.message,64).value);let f=o3e(i);if(YY(f)+1>65536)throw new RangeError("event record cannot fit within 64 KiB");return f}import{join as gPi}from"node:path";import{homedir as hPi}from"node:os";import{join as cae}from"node:path";function Ax(){let e=process.env.CRTR_HOME;return e!==void 0&&e!==""?e:cae(hPi(),l8,"canvas")}function u0e(e){return G0r(e),cae(s3e(e),"view.sock")}function gSt(){return cae(Ax(),"nodes")}var _Pi=128;function q0r(e){return typeof e=="string"&&e!==""&&e!=="."&&e!==".."&&!/[\\/\0]/u.test(e)&&Buffer.byteLength(e,"utf8")<=_Pi}function G0r(e){if(!q0r(e))throw new TypeError("node_id must be a non-empty path segment of at most 128 UTF-8 bytes")}function s3e(e){return G0r(e),cae(gSt(),e)}function KY(e){return cae(s3e(e),"context")}function O4(e){return cae(s3e(e),"job")}var a3e;function yPi(e,t){return e.component===t.component&&e.path===t.path&&e.node_id===t.node_id&&e.stream_id===t.stream_id}function bPi(e){if(a3e===void 0){a3e=e;return}if(!yPi(a3e,e))throw new Error("event source is already bound for this process")}function V0r(){bPi({component:"daemon",path:gPi(Ax(),"crtrd.log")})}function c3e(){return a3e}function XY(e){let t=c3e();if(t===void 0)return!1;if(t.component==="broker"&&t.node_id!==void 0&&e.node_id!==void 0&&e.node_id!==t.node_id)throw new TypeError(`broker event target node_id must match bound node_id; received ${e.node_id}`);if(e.level==="debug"&&process.env.CRTR_LOG!=="debug")return!1;let r=z0r({...e,component:t.component,...t.node_id===void 0?{}:{node_id:t.node_id},...t.stream_id===void 0?{}:{stream_id:t.stream_id}});return n3e(t.path,j0r(r))}import{existsSync as p0e,lstatSync as MEs,mkdirSync as EPi,readdirSync as APi,readFileSync as W0r,rmSync as SPi,statSync as TPi,symlinkSync as LEs,writeFileSync as vPi,cpSync as FEs,readlinkSync as BEs,renameSync as CPi,chmodSync as xPi,realpathSync as IPi}from"node:fs";import{dirname as wPi,join as RPi,relative as $Es}from"node:path";import{homedir as kPi,platform as NPi}from"node:os";function lae(e){try{return IPi(e)}catch{return e}}function ySt(e,t=kPi()){return e==="~"?t:e.startsWith("~/")||NPi()==="win32"&&e.startsWith("~\\")?RPi(t,e.slice(2)):e}function d0e(e){EPi(e,{recursive:!0})}function Q0r(e,t){d0e(wPi(e));let r=`${e}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`,i=p0e(e)?TPi(e).mode&511:384;try{vPi(r,JSON.stringify(t,null,2)+`
1642
1642
  `,{encoding:"utf8",mode:i}),xPi(r,i),CPi(r,e)}finally{p0e(r)&&SPi(r,{force:!0})}}function PPi(e){return JSON.parse(W0r(e,"utf8"))}function p8(e){return p0e(e)?PPi(e):null}function d8(e){try{return JSON.parse(W0r(e,"utf8"))}catch{return null}}function bSt(e){return p0e(e)}function ESt(e){return p0e(e)?APi(e,{withFileTypes:!0}).filter(t=>t.isDirectory()||t.isSymbolicLink()).map(t=>t.name):[]}import{homedir as tTr}from"node:os";import{existsSync as cOi,statSync as lOi}from"node:fs";import{join as rTr,resolve as nTr,dirname as uOi}from"node:path";import{existsSync as l3e,readdirSync as YPi,readFileSync as KPi,realpathSync as K0r,renameSync as YEs,rmSync as KEs,statSync as XEs,writeFileSync as ZEs}from"node:fs";import{dirname as tAs,join as u3e,relative as XPi,resolve as vSt,sep as ZPi}from"node:path";var ASt=["none","name","preview","content"];import{existsSync as OPi,mkdirSync as DPi,readdirSync as J0r,rmSync as Y0r,rmdirSync as MPi,statSync as LPi,unlinkSync as FPi,writeFileSync as BPi}from"node:fs";import{randomUUID as UPi}from"node:crypto";var SSt="owner.",$Pi=10,zPi=3e4,jPi=5e3;function qPi(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}function TSt(e,t){return`${e}/${SSt}${t}`}function GPi(e){try{return J0r(e).find(t=>t.startsWith(SSt))?.slice(SSt.length)??null}catch{return null}}function VPi(e){let t=Number(e.split(".",1)[0]);if(!Number.isSafeInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(r){return r.code==="EPERM"}}function WPi(e){try{return J0r(e).length===0}catch{return!1}}function QPi(e){try{return Date.now()-LPi(e).mtimeMs}catch{return 0}}function HPi(e,t){let r=GPi(e);if(r!==null){if(VPi(r))return;try{FPi(TSt(e,r))}catch(i){if(i.code==="ENOENT")return;throw i}}else{if(QPi(e)<=t)return;if(!WPi(e)){Y0r(e,{recursive:!0,force:!0});return}}try{MPi(e)}catch(i){let o=i.code;if(o!=="ENOENT"&&o!=="ENOTEMPTY"&&o!=="EEXIST")throw i}}function H0r(e,t){let r=`${process.pid}.${UPi()}`;try{return DPi(e,{mode:448}),BPi(TSt(e,r),"",{flag:"wx",mode:384}),{path:e,token:r}}catch(i){if(i.code!=="EEXIST")throw i;return HPi(e,t),null}}function yP(e,t,r={}){let i=r.staleMs??zPi,o=Date.now()+(r.timeoutMs??jPi),a=H0r(e,i);for(;a===null;){if(Date.now()>=o)throw r.timeoutError?.()??new Error(`timed out waiting for the exclusive lock: ${e}`);qPi($Pi),a=H0r(e,i)}try{return t()}finally{OPi(TSt(a.path,a.token))&&Y0r(a.path,{recursive:!0,force:!0})}}var CSt=/^[a-z0-9]+(?:-[a-z0-9]+)*-[0-9a-f]{8}$/,eOi="root-00000000";function xSt(){return u3e(f0e(),D0r)}function tOi(e){if(!CSt.test(e))throw gP(`invalid profile id: ${e}`,{received:e,next:"Profile ids look like <slug>-<8-hex-chars> (as printed by `crtr profile new`). Pass an exact id or a profile name, not a raw path."})}function rOi(e){let t=xSt(),r=vSt(t),i=l3e(t)?K0r(t):r,o=l3e(e)?K0r(e):vSt(i,XPi(r,vSt(e)));if(o!==i&&!o.startsWith(i+ZPi))throw gP(`profile path escapes the profiles root: ${e}`)}function X0r(e){tOi(e);let t=u3e(xSt(),e);return rOi(t),t}function Z0r(e){return u3e(X0r(e),"memory")}function nOi(e,t){let r=typeof t.home=="string"&&t.home!==""?t.home:null,i=e===eOi?r:r??t.projects[0]?.path??null,o=typeof t.paused_at=="string"&&t.paused_at!==""?t.paused_at:null;return{...t,home:i,paused_at:o}}function iOi(e){let t=ASt.join(", ");if(!Array.isArray(e))throw gP("projects must be an array of {path, memory} objects",{received:typeof e,field:"projects",next:`Pass entries like {"path": "/abs/dir", "memory": "content"} \u2014 memory is one of: ${t}.`});for(let r of e){if(typeof r!="object"||r===null||Array.isArray(r))throw gP(`invalid project entry: ${JSON.stringify(r)}`,{field:"projects",next:'Every project is an object like {"path": "/abs/dir", "memory": "content"}.'});let{path:i,memory:o}=r;if(typeof i!="string"||i.trim()==="")throw gP(`project entry has no path: ${JSON.stringify(r)}`,{field:"projects",next:"Give every project entry a non-empty directory path."});if(typeof o!="string"||!ASt.includes(o))throw gP(`invalid project memory value: ${JSON.stringify(o)}`,{received:String(o),field:"projects",next:`Set memory on ${i} to one of: ${t}.`})}}function oOi(e){try{return iOi(e),!0}catch{return!1}}function sOi(e,t){if(!l3e(e))return null;try{let r=JSON.parse(KPi(e,"utf8"));return oOi(r.projects)?nOi(t,r):null}catch{return null}}function aOi(){let e=xSt();if(!l3e(e))return[];let t=[];for(let r of YPi(e,{withFileTypes:!0})){if(!r.isDirectory())continue;let i=r.name;if(!CSt.test(i))continue;let o=sOi(u3e(e,i,"profile.json"),i);o!==null&&t.push({profileId:i,manifest:o})}return t}function uae(e){let t=aOi();if(CSt.test(e)){let o=t.find(a=>a.profileId===e);if(o!==void 0)return o}let r=t.filter(o=>o.manifest.name===e);if(r.length===1)return r[0];if(r.length>1){let o=r.map(a=>a.profileId);throw L0r(`profile name "${e}" matches ${o.length} profiles: ${o.join(", ")}`,{received:e,candidates:o,next:`Re-run with one exact profile id: ${o.join(", ")}.`})}let i=t.map(o=>`${o.profileId} (${o.manifest.name})`);throw M0r(`profile not found: ${e}`,{received:e,available:i,next:i.length>0?`Re-run with one of the profiles on this host: ${i.join(", ")} \u2014 or create one with \`crtr profile new --name <name>\`.`:"No profiles exist on this host yet \u2014 create one with `crtr profile new --name <name>`."})}var pOi="content",eTr=new Map;function dOi(e,t){return`${e}\0${t??""}`}function f0e(){return rTr(tTr(),l8)}function fOi(e,t){if(!cOi(e)||lae(e)===lae(t))return!1;try{return lOi(e).isDirectory()}catch{return!1}}function mOi(e=process.cwd()){return iTr(e)[0]??null}function hOi(e,t){let r=[],i=lae(tTr()),o=nTr(e);for(;;){let a=rTr(o,l8);if(fOi(a,t)&&r.push(a),lae(o)===i)return r;let u=uOi(o);if(u===o)return r;o=u}}function iTr(e=process.cwd(),t=process.env.CRTR_PROFILE_ID||null){return _Oi(e,t).roots}function _Oi(e,t){let r=nTr(e),i=dOi(r,t),o=eTr.get(i);if(o!==void 0)return o;let a=f0e(),u=[{dir:r,memory:null}];if(t!==null&&t!=="")try{let{manifest:E}=uae(t);for(let v of E.projects)u.push({dir:v.path,memory:v.memory})}catch{}let p=new Set,f=[],_=new Map;for(let E of u)for(let v of hOi(E.dir,a))p.has(v)||(p.add(v),f.push(v)),E.memory!==null&&!_.has(v)&&_.set(v,E.memory);let m=f.map(E=>({root:E,memory:_.get(E)??pOi})),g={roots:f,annotated:m};return eTr.set(i,g),g}function oTr(e){return mOi(e)}function f8(e){return e==="builtin"?null:e==="user"?f0e():oTr()}function ISt(e){let t=f8(e);if(!t)throw gP(`no ${e} scope available \u2014 run \`crtr init\` here or use --scope user`);return t}import{join as PSt}from"node:path";import{join as BOi}from"node:path";import{request as gOi}from"node:http";import{request as yOi}from"node:https";import{homedir as bOi}from"node:os";import{join as cTr}from"node:path";var Hh=class extends Error{status;code;details;constructor(t,r,i,o){super(i),this.name="ApiError",this.status=t,this.code=r,o!==void 0&&(this.details=o)}};function wSt(e){if(typeof e!="object"||e===null)return!1;let t=e.error;if(typeof t!="object"||t===null)return!1;let{code:r,message:i}=t;return typeof r=="string"&&typeof i=="string"}var Ac={healthz:()=>"/healthz",status:()=>"/v1/status",daemonRestart:()=>"/v1/daemon/restart",nodes:()=>"/v1/nodes",reviveAll:()=>"/v1/nodes/revive-all",node:e=>`/v1/nodes/${e}`,nodeSnapshot:e=>`/v1/nodes/${e}/snapshot`,nodeSubject:e=>`/v1/nodes/${e}/subject`,nodeSession:e=>`/v1/nodes/${e}/session`,nodeChatInventory:e=>`/v1/nodes/${e}/chat-inventory`,prospectiveChatInventory:()=>"/v1/prospective-chat-inventory",nodeTranscript:e=>`/v1/nodes/${e}/transcript`,nodeContext:e=>`/v1/nodes/${e}/context`,nodeArtifacts:e=>`/v1/nodes/${e}/artifacts`,nodeReports:e=>`/v1/nodes/${e}/reports`,nodeJobs:e=>`/v1/nodes/${e}/jobs`,nodeJob:(e,t)=>`/v1/nodes/${e}/jobs/${t}`,nodeMessages:e=>`/v1/nodes/${e}/messages`,nodeInterrupt:e=>`/v1/nodes/${e}/interrupt`,nodeFork:e=>`/v1/nodes/${e}/fork`,nodeRevive:e=>`/v1/nodes/${e}/revive`,nodeRelaunchRoot:e=>`/v1/nodes/${e}/relaunch-root`,nodeBrokerSessionBound:e=>`/v1/nodes/${e}/broker/session-bound`,nodeBrokerSettle:e=>`/v1/nodes/${e}/broker/settle`,nodeBrokerInboxCursor:e=>`/v1/nodes/${e}/broker/inbox-cursor`,nodeBrokerModel:e=>`/v1/nodes/${e}/broker/model`,nodeBrokerExtensionState:e=>`/v1/nodes/${e}/broker/extension-state`,nodeBrokerGeneratedName:e=>`/v1/nodes/${e}/broker/generated-name`,nodeBrokerPersonaAck:e=>`/v1/nodes/${e}/broker/persona-ack`,nodeClose:e=>`/v1/nodes/${e}/close`,nodeRecycle:e=>`/v1/nodes/${e}/recycle`,nodeDemote:e=>`/v1/nodes/${e}/demote`,nodePromote:e=>`/v1/nodes/${e}/promote`,nodeYield:e=>`/v1/nodes/${e}/yield`,nodeWait:e=>`/v1/nodes/${e}/wait`,nodeConfig:e=>`/v1/nodes/${e}/config`,nodeWorktreeClose:e=>`/v1/nodes/${e}/worktree/close`,nodeAttach:e=>`/v1/nodes/${e}/attach`,focuses:()=>"/v1/focuses",focusByNode:()=>"/v1/focuses/by-node",focusByPane:()=>"/v1/focuses/by-pane",focus:e=>`/v1/focuses/${e}`,nodeSubscriptions:e=>`/v1/nodes/${e}/subscriptions`,nodeSubscription:(e,t)=>`/v1/nodes/${e}/subscriptions/${t}`,crons:()=>"/v1/crons",cron:e=>`/v1/crons/${e}`,cronPause:e=>`/v1/crons/${e}/pause`,cronResume:e=>`/v1/crons/${e}/resume`,cronRun:e=>`/v1/crons/${e}/run`,cronsPoke:()=>"/v1/crons/poke",canvasAttention:()=>"/v1/canvas/attention",canvasAttentionCounts:()=>"/v1/canvas/attention/counts",canvasHistorySearch:()=>"/v1/canvas/history/search",canvasHistoryGrep:()=>"/v1/canvas/history/grep",canvasHistoryRead:()=>"/v1/canvas/history/read",canvasSnapshot:()=>"/v1/canvas/snapshot",canvasRoster:()=>"/v1/canvas/roster",canvasPrune:()=>"/v1/canvas/prune",canvasRebuildIndex:()=>"/v1/canvas/rebuild-index",humanBridge:()=>"/v1/human/bridge",humanTicketResolve:e=>`/v1/human/tickets/${e}/resolve`,humanTicketCancel:e=>`/v1/human/tickets/${e}/cancel`,humanReviews:()=>"/v1/human/reviews",humanReview:e=>`/v1/human/reviews/${e}`,humanReviewByBridge:e=>`/v1/human/reviews/by-bridge/${e}`,humanReviewSubmit:e=>`/v1/human/reviews/${e}/submit`,humanReviewCancel:e=>`/v1/human/reviews/${e}/cancel`,humanReviewDocument:e=>`/v1/human/reviews/${e}/document`,humanReviewComments:e=>`/v1/human/reviews/${e}/comments`,humanReviewCommentEvents:e=>`/v1/human/reviews/${e}/comment-events`,humanReviewCommentRanges:e=>`/v1/human/reviews/${e}/comment-ranges`,humanComment:e=>`/v1/human/comments/${e}`,humanCommentEdit:e=>`/v1/human/comments/${e}/edit`,humanCommentResolve:e=>`/v1/human/comments/${e}/resolve`,humanCommentReopen:e=>`/v1/human/comments/${e}/reopen`,humanCommentDelete:e=>`/v1/human/comments/${e}/delete`,humanInbox:()=>"/v1/human/inbox",humanInboxTicket:e=>`/v1/human/inbox/${e}`,humanInboxRespond:e=>`/v1/human/inbox/${e}/respond`,humanInboxProgress:e=>`/v1/human/inbox/${e}/progress`,humanInboxResponse:e=>`/v1/human/inbox/${e}/response`,humanInboxCancel:e=>`/v1/human/inbox/${e}/cancel`,humanInboxFeedbackResolve:(e,t)=>`/v1/human/inbox/${e}/feedback-comments/${t}/resolve`,humanRequests:()=>"/v1/human/requests",humanRequest:e=>`/v1/human/requests/${e}`,humanRequestReplace:e=>`/v1/human/requests/${e}/replace`,humanRequestRespond:e=>`/v1/human/requests/${e}/respond`,humanRequestDismiss:e=>`/v1/human/requests/${e}/dismiss`,humanRequestCancel:e=>`/v1/human/requests/${e}/cancel`,profiles:()=>"/v1/profiles",profile:e=>`/v1/profiles/${e}`,modelAuths:()=>"/v1/model-auth",modelAuth:e=>`/v1/model-auth/${e}`,filePeek:()=>"/v1/files/peek",memoryResolve:()=>"/v1/memory/resolve"};function p3e(e){return typeof e=="string"&&e!==""&&e!=="."&&e!==".."&&!/[\\/\0]/u.test(e)&&Buffer.byteLength(e,"utf8")<=128}function sTr(e){return typeof e=="string"&&e!==""&&e!=="."&&e!==".."&&/^[A-Za-z0-9._~-]+$/u.test(e)&&Buffer.byteLength(e,"utf8")<=128}function aTr(e){return typeof e=="string"&&e!==""&&e!=="."&&e!==".."&&!/[\\/\0\s?#%]/u.test(e)&&Buffer.byteLength(e,"utf8")<=128}var EOi=".crouter",AOi="crtrd.sock";function SOi(){let e=process.env.CRTR_HOME,t=e!==void 0&&e!==""?e:cTr(bOi(),EOi,"canvas");return cTr(t,AOi)}var TOi=3e4,vOi=1e4,lTr=200,pae=class e{socketPath;baseUrl;headers;autostart;timeoutMs;onColdSocket;coldStartDiagnostic;coldStartPollWindowMs;coldStartAttempted=!1;constructor(t){let r=t.socketPath!==void 0&&t.socketPath!=="",i=t.baseUrl!==void 0&&t.baseUrl!=="";if(r===i)throw new TypeError("CrtrClient requires exactly one of socketPath | baseUrl");r&&(this.socketPath=t.socketPath),i&&(this.baseUrl=new URL(t.baseUrl)),this.headers={...t.headers},this.autostart=t.autostart??r,this.timeoutMs=t.timeoutMs??TOi,t.onColdSocket!==void 0&&(this.onColdSocket=t.onColdSocket),t.coldStartDiagnostic!==void 0&&(this.coldStartDiagnostic=t.coldStartDiagnostic),this.coldStartPollWindowMs=t.coldStartPollWindowMs??vOi}static forLocalSocket(t){return new e({socketPath:SOi(),autostart:!0,...t})}healthz(){return this.request("GET",Ac.healthz())}status(){return this.request("GET",Ac.status())}restartDaemon(){return this.request("POST",Ac.daemonRestart())}createNode(t){return this.request("POST",Ac.nodes(),t)}listNodes(t){return this.request("GET",T0(Ac.nodes(),t))}getNode(t){return this.request("GET",Ac.node(this.nodePath(t)))}listBashJobs(t){return this.request("GET",Ac.nodeJobs(this.nodePath(t)))}stopBashJob(t,r){return this.request("DELETE",Ac.nodeJob(this.nodePath(t),this.jobPath(r)))}sendMessage(t,r){return this.request("POST",Ac.nodeMessages(this.nodePath(t)),r)}interruptNode(t){return this.request("POST",Ac.nodeInterrupt(this.nodePath(t)),{})}pushReport(t,r){return this.request("POST",Ac.nodeReports(this.nodePath(t)),r)}forkNode(t){return this.request("POST",Ac.nodeFork(this.nodePath(t)),{})}reviveNode(t,r){return this.request("POST",Ac.nodeRevive(this.nodePath(t)),r??{})}relaunchRoot(t){return this.request("POST",Ac.nodeRelaunchRoot(this.nodePath(t)),{})}bindBrokerSession(t,r){return this.request("POST",Ac.nodeBrokerSessionBound(this.nodePath(t)),r)}settleBroker(t,r){return this.request("POST",Ac.nodeBrokerSettle(this.nodePath(t)),r)}advanceBrokerInboxCursor(t,r){return this.request("POST",Ac.nodeBrokerInboxCursor(this.nodePath(t)),r)}commitBrokerModel(t,r){return this.request("POST",Ac.nodeBrokerModel(this.nodePath(t)),r)}brokerExtensionState(t){return this.request("GET",Ac.nodeBrokerExtensionState(this.nodePath(t)))}commitBrokerGeneratedName(t,r){return this.request("POST",Ac.nodeBrokerGeneratedName(this.nodePath(t)),r)}commitBrokerPersonaAck(t,r){return this.request("POST",Ac.nodeBrokerPersonaAck(this.nodePath(t)),r)}closeNode(t,r){return this.request("POST",Ac.nodeClose(this.nodePath(t)),r??{})}recycleNode(t){return this.request("POST",Ac.nodeRecycle(this.nodePath(t)),{})}demoteNode(t){return this.request("POST",Ac.nodeDemote(this.nodePath(t)),{})}promoteNode(t,r){return this.request("POST",Ac.nodePromote(this.nodePath(t)),r)}yieldNode(t,r){return this.request("POST",Ac.nodeYield(this.nodePath(t)),r)}waitNode(t,r){return this.request("POST",Ac.nodeWait(this.nodePath(t)),r)}patchConfig(t,r){return this.request("PATCH",Ac.nodeConfig(this.nodePath(t)),r)}closeWorktree(t){return this.request("POST",Ac.nodeWorktreeClose(this.nodePath(t)),{})}subscribe(t,r){return this.request("POST",Ac.nodeSubscriptions(this.nodePath(t)),r)}listFocuses(){return this.request("GET",Ac.focuses())}focusOf(t){return this.request("GET",T0(Ac.focusByNode(),{node_id:t}))}focusByPane(t){return this.request("GET",T0(Ac.focusByPane(),{pane:t}))}registerFocus(t){return this.request("POST",Ac.focuses(),t)}async setFocusPane(t,r){await this.request("PATCH",Ac.focus(t),r)}async closeFocus(t){await this.request("DELETE",Ac.focus(t))}async unsubscribe(t,r){await this.request("DELETE",Ac.nodeSubscription(this.nodePath(t),this.nodePath(r)))}armCron(t){return this.request("POST",Ac.crons(),t)}listCrons(t){return this.request("GET",T0(Ac.crons(),t))}showCron(t,r){return this.request("GET",T0(Ac.cron(this.cronPath(t)),r))}pauseCron(t,r){return this.request("POST",T0(Ac.cronPause(this.cronPath(t)),r),{})}resumeCron(t,r){return this.request("POST",T0(Ac.cronResume(this.cronPath(t)),r),{})}runCron(t,r){return this.request("POST",T0(Ac.cronRun(this.cronPath(t)),r),{})}async cancelCron(t,r){await this.request("DELETE",T0(Ac.cron(this.cronPath(t)),r))}pokeCrons(){return this.request("POST",Ac.cronsPoke(),{})}ensureAttach(t,r){return this.request("POST",Ac.nodeAttach(this.nodePath(t)),r??{})}getReports(t,r){return this.request("GET",T0(Ac.nodeReports(this.nodePath(t)),r))}getTranscript(t,r){return this.request("GET",T0(Ac.nodeTranscript(this.nodePath(t)),r))}getSnapshot(t){return this.request("GET",Ac.nodeSnapshot(this.nodePath(t)))}nodeSubject(t){return this.request("GET",Ac.nodeSubject(this.nodePath(t)))}getNodeMessages(t,r){return this.request("GET",T0(Ac.nodeMessages(this.nodePath(t)),r))}getSession(t){return this.request("GET",Ac.nodeSession(this.nodePath(t)))}getChatInventory(t){return this.request("GET",Ac.nodeChatInventory(this.nodePath(t)))}getProspectiveChatInventory(t){return this.request("GET",T0(Ac.prospectiveChatInventory(),t))}getArtifacts(t,r){return this.request("GET",T0(Ac.nodeArtifacts(this.nodePath(t)),r))}getContext(t){return this.request("GET",Ac.nodeContext(this.nodePath(t)))}peekFile(t){return this.request("GET",T0(Ac.filePeek(),{path:t}))}resolveMemoryDoc(t,r){return this.request("GET",T0(Ac.memoryResolve(),{name:t,node:r}))}ensureProfile(t,r){return this.request("PUT",Ac.profile(t),r??{})}listProfiles(){return this.request("GET",Ac.profiles())}getProfile(t){return this.request("GET",Ac.profile(t))}deleteProfile(t,r){return this.request("DELETE",Ac.profile(t),r)}listModelAuth(){return this.request("GET",Ac.modelAuths())}installCredential(t,r){return this.request("PUT",Ac.modelAuth(t),r)}removeCredential(t){return this.request("DELETE",Ac.modelAuth(t))}createHumanBridge(t){return this.request("POST",Ac.humanBridge(),t)}resolveHumanTicket(t,r){return this.request("POST",Ac.humanTicketResolve(this.interactionPath(t)),r)}cancelHumanTicket(t,r){return this.request("POST",Ac.humanTicketCancel(this.interactionPath(t)),r)}createReview(t){return this.request("POST",Ac.humanReviews(),t)}listReviews(t){return this.request("GET",T0(Ac.humanReviews(),t))}getReview(t){return this.request("GET",Ac.humanReview(this.reviewPath(t)))}getReviewByBridge(t){return this.request("GET",Ac.humanReviewByBridge(this.nodePath(t)))}submitReview(t){return this.request("POST",Ac.humanReviewSubmit(this.reviewPath(t)),{})}cancelReview(t,r={}){return this.request("POST",Ac.humanReviewCancel(this.reviewPath(t)),r)}getReviewDocumentBase(t){return this.request("GET",Ac.humanReviewDocument(this.reviewPath(t)))}createReviewComment(t,r){let i=t===void 0?"self":this.reviewPath(t);return this.request("POST",Ac.humanReviewComments(i),r)}listReviewComments(t,r){let i=t===void 0?"self":this.reviewPath(t);return this.request("GET",T0(Ac.humanReviewComments(i),r))}readReviewCommentEvents(t,r){return this.request("GET",T0(Ac.humanReviewCommentEvents(this.reviewPath(t)),r))}updateReviewCommentRanges(t,r){return this.request("POST",Ac.humanReviewCommentRanges(this.reviewPath(t)),r)}getReviewComment(t){return this.request("GET",Ac.humanComment(this.commentPath(t)))}editReviewComment(t,r){return this.request("POST",Ac.humanCommentEdit(this.commentPath(t)),r)}resolveReviewComment(t,r={}){return this.request("POST",Ac.humanCommentResolve(this.commentPath(t)),r)}reopenReviewComment(t,r={}){return this.request("POST",Ac.humanCommentReopen(this.commentPath(t)),r)}deleteReviewComment(t,r={}){return this.request("POST",Ac.humanCommentDelete(this.commentPath(t)),r)}listHumanInbox(){return this.request("GET",Ac.humanInbox())}getHumanInboxPage(t){return this.request("GET",Ac.humanInboxTicket(this.ticketId(t)))}getInboxHistory(t){if(t===void 0)return this.request("GET",Ac.humanInbox()+"/history");if(typeof t!="string"||t==="")throw new TypeError(`invalid node id: ${JSON.stringify(t)}`);return this.request("GET",T0(Ac.humanInbox()+"/history",{node_id:t}))}respondHumanInboxPage(t,r){return this.request("POST",Ac.humanInboxRespond(this.ticketId(t)),r)}postInboxProgress(t,r){return this.request("POST",Ac.humanInboxProgress(this.ticketId(t)),{responses:r})}getInboxResponse(t){return this.request("GET",Ac.humanInboxResponse(this.ticketId(t)))}cancelHumanInboxTicket(t,r){return this.request("POST",Ac.humanInboxCancel(this.ticketId(t)),r??{})}createHumanRequest(t){return this.request("POST",Ac.humanRequests(),t)}getHumanRequest(t){return this.request("GET",Ac.humanRequest(this.ticketId(t)))}replaceHumanRequest(t,r){return this.request("POST",Ac.humanRequestReplace(this.ticketId(t)),r)}respondHumanRequest(t,r){return this.request("POST",Ac.humanRequestRespond(this.ticketId(t)),r)}dismissHumanRequest(t,r={}){return this.request("POST",Ac.humanRequestDismiss(this.ticketId(t)),r)}cancelHumanRequest(t,r={}){return this.request("POST",Ac.humanRequestCancel(this.ticketId(t)),r)}resolvePageFeedbackComment(t,r,i){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(r))throw new TypeError(`invalid feedback comment id: ${JSON.stringify(r)}`);return this.request("POST",Ac.humanInboxFeedbackResolve(this.ticketId(t),r),{node_id:i})}async dashboard(t){let r=t?.under!==void 0?{under:t.under}:void 0,[i,o]=await Promise.all([this.listNodes(r),this.status()]);return{nodes:i,counts:o.node_counts,generated_at:new Date().toISOString()}}attention(){return this.request("GET",Ac.canvasAttention())}attentionCounts(t){let r={node_ids:t};return this.request("POST",Ac.canvasAttentionCounts(),r)}historySearch(t){return this.request("POST",Ac.canvasHistorySearch(),t)}historyGrep(t){return this.request("POST",Ac.canvasHistoryGrep(),t)}historyRead(t){return this.request("GET",T0(Ac.canvasHistoryRead(),t))}canvasSnapshot(){return this.request("GET",Ac.canvasSnapshot())}canvasRoster(){return this.request("GET",Ac.canvasRoster())}prune(t){return this.request("POST",Ac.canvasPrune(),t)}rebuildIndex(){return this.request("POST",Ac.canvasRebuildIndex(),{})}async request(t,r,i){return COi(await this.send(t,r,i))}async send(t,r,i,o){try{return await this.transport(t,r,i,o)}catch(a){if(this.isColdSocketError(a))return await this.handleColdSocket(),await this.transport(t,r,i,o);if(this.isHandoverHangup(a))return await this.rideOutHandover(t,r,i,o);throw d3e(a)}}nodePath(t){if(!p3e(t))throw new Hh(400,"invalid_node_id",`invalid node id: ${JSON.stringify(t)}`);return t}interactionPath(t){if(!p3e(t))throw new Hh(400,"invalid_ticket_id",`invalid interaction ticket id: ${JSON.stringify(t)}`);return t}jobPath(t){if(!sTr(t))throw new Hh(400,"invalid_job_id",`invalid background job id: ${JSON.stringify(t)}`);return t}cronPath(t){if(!aTr(t))throw new Hh(400,"invalid_cron_id",`invalid cron id: ${JSON.stringify(t)}`);return t}ticketId(t){if(!/^[a-f0-9]{64}$/.test(t))throw new TypeError(`invalid inbox ticket id: ${JSON.stringify(t)}`);return t}reviewPath(t){if(!p3e(t))throw new Hh(400,"invalid_review_id",`invalid review id: ${JSON.stringify(t)}`);return t}commentPath(t){if(!/^[a-f0-9]{32}$/.test(t))throw new Hh(400,"invalid_comment_id",`invalid comment id: ${JSON.stringify(t)}`);return t}transport(t,r,i,o){let u=this.baseUrl?.protocol==="https:"?yOi:gOi,p=i===void 0?void 0:JSON.stringify(i),f={accept:"application/json",...this.headers,...o};p!==void 0&&(f["content-type"]="application/json",f["content-length"]=String(Buffer.byteLength(p)));let _={method:t,path:r,headers:f,timeout:this.timeoutMs};return this.socketPath!==void 0?_.socketPath=this.socketPath:this.baseUrl!==void 0&&(_.protocol=this.baseUrl.protocol,_.hostname=this.baseUrl.hostname,this.baseUrl.port!==""&&(_.port=this.baseUrl.port)),new Promise((m,g)=>{let E=u(_,v=>{let T=[];v.on("data",C=>T.push(C)),v.on("end",()=>{let C={};for(let[I,N]of Object.entries(v.headers))N!==void 0&&(C[I]=Array.isArray(N)?N.join(", "):N);m({status:v.statusCode??0,text:Buffer.concat(T).toString("utf8"),headers:C})}),v.on("error",g)});E.on("error",g),E.on("timeout",()=>{E.destroy(Object.assign(new Error("request timed out"),{code:"ETIMEDOUT"}))}),p!==void 0&&E.write(p),E.end()})}isColdSocketError(t){if(this.socketPath===void 0)return!1;let r=t?.code;return r==="ECONNREFUSED"||r==="ENOENT"}isHandoverHangup(t){if(this.socketPath===void 0)return!1;let r=t?.code;return r==="ECONNRESET"||r==="EPIPE"}async rideOutHandover(t,r,i,o){if(!await this.awaitHandover())throw new Hh(503,"daemon_unavailable",`crtrd went away mid-request and did not come back within ${this.coldStartPollWindowMs}ms.`);if(t!=="GET"&&t!=="HEAD")throw new Hh(503,"daemon_restarting",`crtrd handed over to a new runtime generation mid-request; this ${t} may or may not have been applied.`);try{return await this.transport(t,r,i,o)}catch(a){throw d3e(a)}}async awaitHandover(){let t=Date.now()+this.coldStartPollWindowMs;for(;;){try{let r=await this.transport("GET",Ac.healthz());if(r.status>=200&&r.status<300)return!0}catch(r){if(!this.isColdSocketError(r)&&!this.isHandoverHangup(r))throw d3e(r)}if(Date.now()>=t)return!1;await uTr(lTr)}}async handleColdSocket(){if(!this.autostart||this.onColdSocket===void 0)throw new Hh(503,"daemon_unavailable","crtrd is not running and autostart is disabled; run `crtr sys daemon start`.");if(this.coldStartAttempted)throw new Hh(503,"daemon_unavailable","crtrd did not become reachable after autostart.");this.coldStartAttempted=!0,await this.onColdSocket();let t=Date.now()+this.coldStartPollWindowMs;for(;;){try{let r=await this.transport("GET",Ac.healthz());if(r.status>=200&&r.status<300)return}catch(r){if(!this.isColdSocketError(r))throw d3e(r)}if(Date.now()>=t){let r=IOi(this.coldStartDiagnostic);throw new Hh(503,"daemon_unavailable",xOi(r))}await uTr(lTr)}}};function T0(e,t){if(t===void 0)return e;let r=new URLSearchParams;for(let[o,a]of Object.entries(t))a!=null&&r.set(o,String(a));let i=r.toString();return i===""?e:`${e}?${i}`}function COi(e){let t=e.status>=200&&e.status<300,r=e.text.trim(),i;if(r!=="")try{i=JSON.parse(r)}catch{if(t)return;throw new Hh(e.status,"invalid_response",e.text.slice(0,500))}if(t)return i;throw wSt(i)?new Hh(e.status,i.error.code,i.error.message,i.error.details):new Hh(e.status,"internal",`request failed with status ${e.status}`)}function d3e(e){if(e instanceof Hh)return e;let t=e?.code,r=e instanceof Error?e.message:String(e);return t==="ECONNREFUSED"||t==="ENOENT"?new Hh(503,"daemon_unavailable",`crtrd is not reachable: ${r}`):t==="ETIMEDOUT"?new Hh(504,"request_timeout",`crtrd request timed out: ${r}`):new Hh(503,"transport_error",r)}function uTr(e){return new Promise(t=>setTimeout(t,e))}function xOi(e){let t="crtrd did not start; run `crtr sys daemon start` and check crtrd.err.";return e!==void 0&&e!==""?`${t}
@@ -12,7 +12,7 @@ export declare function assertKind(kind: string): void;
12
12
  *
13
13
  * Keep this block cheap and caller-agnostic: help should not depend on the
14
14
  * running node's current persona env, which can lag after polymorph. Sub-kinds
15
- * (e.g. `plan/reviewers/security`) are OMITTED here — `KindConfig.availableTo`
15
+ * (e.g. `audit/security`) are OMITTED here — `KindConfig.availableTo`
16
16
  * defaults to the sub-kind's own top-level ancestor, and this generic block has
17
17
  * no single ancestor to check against, so only an explicit `availableTo: ['*']`
18
18
  * sub-kind (universally available) earns a place in this list. A direct launch
@@ -40,7 +40,7 @@ export function assertKind(kind) {
40
40
  *
41
41
  * Keep this block cheap and caller-agnostic: help should not depend on the
42
42
  * running node's current persona env, which can lag after polymorph. Sub-kinds
43
- * (e.g. `plan/reviewers/security`) are OMITTED here — `KindConfig.availableTo`
43
+ * (e.g. `audit/security`) are OMITTED here — `KindConfig.availableTo`
44
44
  * defaults to the sub-kind's own top-level ancestor, and this generic block has
45
45
  * no single ancestor to check against, so only an explicit `availableTo: ['*']`
46
46
  * sub-kind (universally available) earns a place in this list. A direct launch
@@ -23,7 +23,7 @@ const nodeList = defineLeaf({
23
23
  summary: 'list nodes on the canvas, filtered by any combination of attribute slices and a graph-scope (--under) that AND together',
24
24
  params: [
25
25
  { kind: 'flag', name: 'status', type: 'string', required: false, constraint: 'Filter status (comma-separated for several; accepted values: active, idle, done, dead, canceled). NOTE: `active` means the engine process is live (never closed), NOT that the node is generating right now — an active node is usually dormant between turns. To tell working-vs-idle, check the pi session-file mtime or CPU, not status.' },
26
- { kind: 'flag', name: 'kind', type: 'string', required: false, constraint: 'Filter by persona kind (comma-separated for several). The <kinds> list below names every top-level installable kind; a sub-kind (e.g. plan/reviewers/security) filters too even though it is not listed.' },
26
+ { kind: 'flag', name: 'kind', type: 'string', required: false, constraint: 'Filter by persona kind (comma-separated for several). The <kinds> list below names every top-level installable kind; a registered sub-kind filters too by exact path even though it is not listed.' },
27
27
  { kind: 'flag', name: 'mode', type: 'string', required: false, constraint: 'Filter by mode (comma-separated for several; accepted values: base, orchestrator).' },
28
28
  { kind: 'flag', name: 'lifecycle', type: 'string', required: false, constraint: 'Filter by lifecycle (comma-separated for several; accepted values: terminal, resident).' },
29
29
  { kind: 'flag', name: 'profile', type: 'string', required: false, constraint: 'Filter by profile. On the local canvas, accepts an exact profile id or a unique manifest name from the <profiles> list below. Against a remote canvas, pass the exact profile id carried by its node rows.' },
@@ -131,7 +131,7 @@ export const nodeConfig = defineLeaf({
131
131
  { kind: 'flag', name: 'pane', type: 'string', required: false, constraint: 'tmux pane id to resolve the node from. Defaults to $TMUX_PANE.' },
132
132
  { kind: 'flag', name: 'model', type: 'string', required: false, constraint: 'Model spec: exact provider/id, capability tier (ultra|strong|medium|light), family alias (opus|sonnet|haiku), or a free-text substring when the broker is live. Dormant nodes require a provider/id, tier, or alias.' },
133
133
  { kind: 'flag', name: 'lifecycle', type: 'enum', choices: ['terminal', 'resident'], required: false, constraint: 'Set lifecycle headlessly without closing the viewer. terminal owes a final and reaps when done; resident stays interactable while attached or awaiting something live.' },
134
- { kind: 'flag', name: 'kind', type: 'string', required: false, constraint: 'Persona kind. The <kinds> list below names every top-level installable kind and when to use each; a sub-kind (e.g. plan/reviewers/security) is valid too by exact path but not listed here.' },
134
+ { kind: 'flag', name: 'kind', type: 'string', required: false, constraint: 'Persona kind. The <kinds> list below names every top-level installable kind and when to use each; a registered sub-kind is valid too by exact path but not listed here.' },
135
135
  { kind: 'flag', name: 'mode', type: 'enum', choices: ['base', 'orchestrator'], required: false, constraint: 'Set persona mode headlessly. base is hands-on; orchestrator holds a roadmap and delegates. orchestrator seeds a roadmap scaffold if absent.' },
136
136
  { kind: 'flag', name: 'name', type: 'string', required: false, constraint: 'Rename the node; if the node has a live window, also rename that viewer window.' },
137
137
  ],
@@ -241,7 +241,7 @@ export const nodePromote = defineLeaf({
241
241
  name: 'node promote',
242
242
  summary: 'promote yourself to an orchestrator when worthwhile parallel delegation should make coordination your primary job; task duration, sequential phases, or one helper do not qualify. Mode only — lifecycle stays as-is unless you pass --resident',
243
243
  params: [
244
- { kind: 'flag', name: 'kind', type: 'string', required: false, constraint: 'Specialize as this kind of orchestrator. The <kinds> list below names every top-level installable kind and when to use each; a sub-kind (e.g. plan/reviewers/security) is valid too by exact path but not listed here. For an exact composed persona list, use `crtr sys prompt-review --list --kind <kind>` with the target kind. Defaults to your current kind. Promoting from a generic kind? CHOOSE a concrete one — it sets the orchestrator persona you revive into.' },
244
+ { kind: 'flag', name: 'kind', type: 'string', required: false, constraint: 'Specialize as this kind of orchestrator. The <kinds> list below names every top-level installable kind and when to use each; a registered sub-kind is valid too by exact path but not listed here. For an exact composed persona list, use `crtr sys prompt-review --list --kind <kind>` with the target kind. Defaults to your current kind. Promoting from a generic kind? CHOOSE a concrete one — it sets the orchestrator persona you revive into.' },
245
245
  { kind: 'flag', name: 'resident', type: 'bool', required: false, constraint: 'ALSO flip lifecycle→resident: make the node interactable — it is never forced to submit a final, stays wakeable while attached or awaiting something live, and completes after the unattended grace otherwise. Omit to stay terminal/orchestrator (delegates + holds a roadmap, but still owes a final up the spine and reaps when done).' },
246
246
  { kind: 'flag', name: 'model', type: 'enum', choices: ['ultra', 'strong'], required: false, constraint: 'Change the model you run on, by capability tier: `ultra` (frontier — reserve for high-taste judgment or enormous work: speccing, planning something large, e2e-testing something hard to test) or `strong` (opus — regular dev work). Omit to keep your current model. An orchestrator steering work is never weaker than opus, so these are the only two choices; the change is durable across future revives.' },
247
247
  { kind: 'flag', name: 'node', type: 'string', required: false, constraint: 'Node to promote. Defaults to the caller (CRTR_NODE_ID).' },
@@ -373,7 +373,7 @@ export const nodeYield = defineLeaf({
373
373
  guide: 'Persist anything needed after refresh and send any pending human question before invoking; in-flight asks survive the refresh.',
374
374
  params: [
375
375
  { kind: 'flag', name: 'promote', type: 'bool', required: false, constraint: 'Also become an orchestrator as you refresh. Pass only when (1) the remaining work contains independent units that can run in parallel and (2) the task is large enough that parallel execution will materially improve intelligence, productivity, or elapsed throughput after coordination and synthesis. Task length, context exhaustion, sequential phases, or one helper are not enough; keep hands-on work in base mode and yield again as needed. Promote when coordinating and integrating children becomes your primary job. Already an orchestrator? This is not an error: your mode stays orchestrator and a missing roadmap is seeded.' },
376
- { kind: 'flag', name: 'kind', type: 'string', required: false, constraint: 'Respecialize as you refresh. The <kinds> list below names every top-level available kind and when to choose it; a sub-kind (e.g. plan/reviewers/security) is valid too by exact path but not listed here. Defaults to your current kind. With --promote it sets the orchestrator kind you become; without --promote it changes the kind while preserving your current mode.' },
376
+ { kind: 'flag', name: 'kind', type: 'string', required: false, constraint: 'Respecialize as you refresh. The <kinds> list below names every top-level available kind and when to choose it; a registered sub-kind is valid too by exact path but not listed here. Defaults to your current kind. With --promote it sets the orchestrator kind you become; without --promote it changes the kind while preserving your current mode.' },
377
377
  { kind: 'flag', name: 'model', type: 'enum', choices: ['ultra', 'strong'], required: false, constraint: 'Change the model your fresh revive runs on, by capability tier: `ultra` (frontier — reserve for high-taste judgment or enormous work: speccing, planning something large, e2e-testing something hard to test) or `strong` (opus — regular dev work). Omit to keep your current model. A node steering work is never weaker than opus, so these are the only two choices; the change is durable across future revives.' },
378
378
  // Deliberate fail-first contract: builtin orchestration guidance shows bare
379
379
  // `crtr node yield`; that invocation fails fast and surfaces yield's full help just in
@@ -5,7 +5,7 @@
5
5
  // persona keeps the stronger default needed to synthesise a broad review.
6
6
  import { after, before, test } from 'node:test';
7
7
  import assert from 'node:assert/strict';
8
- import { mkdtempSync, rmSync } from 'node:fs';
8
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
9
9
  import { tmpdir } from 'node:os';
10
10
  import { join } from 'node:path';
11
11
  import { defaultKindsConfig, defaultModelLaddersConfig } from '../../types.js';
@@ -19,6 +19,15 @@ let home = '';
19
19
  before(() => {
20
20
  home = mkdtempSync(join(tmpdir(), 'crtr-review-model-floor-'));
21
21
  process.env['HOME'] = home;
22
+ mkdirSync(join(home, '.crouter'), { recursive: true });
23
+ writeFileSync(join(home, '.crouter', 'config.json'), JSON.stringify({
24
+ kinds: {
25
+ 'audit/reviewers/security': {
26
+ whenToUse: 'Review one security surface.',
27
+ model: 'medium',
28
+ },
29
+ },
30
+ }));
22
31
  });
23
32
  after(() => {
24
33
  if (priorHome === undefined)
@@ -43,9 +52,8 @@ test('base review ignores a light override and keeps its medium floor', () => {
43
52
  assert.equal(spec('review', 'light'), expected(REVIEW_FLOOR));
44
53
  assert.equal(spec('review', 'haiku'), expected(REVIEW_FLOOR));
45
54
  });
46
- test('plan reviewer sub-kinds also keep their medium worker floor', () => {
47
- assert.equal(spec('plan/reviewers/security', 'light'), expected('medium'));
48
- assert.equal(spec('plan/reviewers/requirements-coverage', 'light'), expected('medium'));
55
+ test('plugin-shaped reviewer sub-kinds keep their configured worker floor', () => {
56
+ assert.equal(spec('audit/reviewers/security', 'light'), expected('medium'));
49
57
  });
50
58
  test('review orchestrator uses its stronger coordinating model', () => {
51
59
  assert.equal(buildLaunchSpec('review', 'orchestrator', { lifecycle: 'terminal', hasManager: true, cwd: home, profileId: null }).launch.model, expected(defaultKindsConfig()['review'].orchestratorModel));
@@ -147,7 +147,7 @@ export interface MergedLaunchConfig {
147
147
  * follow-up fix this parameterization exists for). */
148
148
  export declare function readMergedLaunchConfig(targetCwd?: string, targetProfileId?: string | null): MergedLaunchConfig;
149
149
  /** The effective `KindConfig` for one full kind string (top-level, e.g.
150
- * `developer`, or sub-kind, e.g. `plan/reviewers/security`), across
150
+ * `developer`, or sub-kind, e.g. `audit/security`), across
151
151
  * project > user > builtin precedence. Returns `undefined` for a kind no
152
152
  * scope registers — existence is deliberately NOT validated here (kind
153
153
  * existence/launch-menu enumeration is a caller concern); this only
@@ -160,8 +160,8 @@ export declare function resolveKindConfig(kind: string): KindConfig | undefined;
160
160
  export declare function assertInstalledKind(kind: string): void;
161
161
  /** The sub-kinds available to spawn FROM a given top-level kind — every
162
162
  * registered sub-kind (full path contains `/`) whose `availableTo` (default:
163
- * its own top-level ancestor, e.g. `plan/reviewers/security` defaults to
164
- * `['plan']`) includes `kind` or `'*'`. The single source both `sys
163
+ * its own top-level ancestor, e.g. `audit/security` defaults to
164
+ * `['audit']`) includes `kind` or `'*'`. The single source both `sys
165
165
  * prompt-review --list`'s `subPersonas` metadata and the live sub-persona
166
166
  * spawn-menu splice (`core/substrate/render.ts`) read, so the two can never
167
167
  * drift apart. Sorted by full kind name for stable rendering. */
@@ -796,7 +796,7 @@ export function readMergedLaunchConfig(targetCwd = process.cwd(), targetProfileI
796
796
  return { kinds, modelLadders, ...(Object.keys(modelRoutes).length > 0 ? { modelRoutes } : {}), ...(modelRouting !== undefined ? { modelRouting } : {}), spawnEnv };
797
797
  }
798
798
  /** The effective `KindConfig` for one full kind string (top-level, e.g.
799
- * `developer`, or sub-kind, e.g. `plan/reviewers/security`), across
799
+ * `developer`, or sub-kind, e.g. `audit/security`), across
800
800
  * project > user > builtin precedence. Returns `undefined` for a kind no
801
801
  * scope registers — existence is deliberately NOT validated here (kind
802
802
  * existence/launch-menu enumeration is a caller concern); this only
@@ -820,8 +820,8 @@ export function assertInstalledKind(kind) {
820
820
  }
821
821
  /** The sub-kinds available to spawn FROM a given top-level kind — every
822
822
  * registered sub-kind (full path contains `/`) whose `availableTo` (default:
823
- * its own top-level ancestor, e.g. `plan/reviewers/security` defaults to
824
- * `['plan']`) includes `kind` or `'*'`. The single source both `sys
823
+ * its own top-level ancestor, e.g. `audit/security` defaults to
824
+ * `['audit']`) includes `kind` or `'*'`. The single source both `sys
825
825
  * prompt-review --list`'s `subPersonas` metadata and the live sub-persona
826
826
  * spawn-menu splice (`core/substrate/render.ts`) read, so the two can never
827
827
  * drift apart. Sorted by full kind name for stable rendering. */
@@ -106,7 +106,7 @@ function resolvedModelStrength(model, ladders = modelLadders()) {
106
106
  return cell?.strength ?? null;
107
107
  }
108
108
  function isReviewQualityKind(kind) {
109
- return kind === 'review' || kind.startsWith('plan/reviewers/');
109
+ return kind === 'review' || kind.startsWith('review/') || kind.includes('/reviewers/');
110
110
  }
111
111
  function floorReviewModel(kind, requestedModel, kindModel, ladders = modelLadders()) {
112
112
  if (requestedModel === undefined)
package/dist/types.d.ts CHANGED
@@ -62,7 +62,7 @@ export interface PluginManifest {
62
62
  source?: string;
63
63
  owner?: OwnerRef;
64
64
  /** Kind-registry contributions, keyed by full kind string (top-level e.g.
65
- * `applet-builder`, or sub-kind e.g. `plan/reviewers/security`). Each entry
65
+ * `applet-builder`, or sub-kind e.g. `audit/security`). Each entry
66
66
  * is any subset of `KindConfig` fields: it FIELD-MERGES over a kind a lower
67
67
  * layer already defines (`whenToUse` included — overriding just the spawn
68
68
  * guidance never strips the kind's model tier), and defines a NEW kind when
@@ -202,14 +202,14 @@ export interface ModelRoutingConfig {
202
202
  strengthFallback?: ModelStrength[];
203
203
  }
204
204
  /** Launch metadata for one kind (a top-level kind like `developer`, or a full
205
- * sub-kind string like `plan/reviewers/security`) — the settings-file
205
+ * sub-kind string like `audit/security`) — the settings-file
206
206
  * replacement for per-kind persona frontmatter. `model`/`tools`/`extensions`
207
207
  * are launch knobs consumed by `buildLaunchSpec`; `whenToUse` is the
208
208
  * one-line gloss shown in `node new -h` / `node promote -h`. `availableTo` is
209
209
  * VISIBILITY-ONLY (never launch validation): the list of top-level kind names
210
210
  * whose spawn menus surface this sub-kind, `'*'` meaning every kind; omitted
211
211
  * defaults to the sub-kind's own top-level ancestor (e.g.
212
- * `plan/reviewers/security` defaults to `['plan']`). A direct launch by full kind
212
+ * `audit/security` defaults to `['audit']`). A direct launch by full kind
213
213
  * string is always valid regardless of `availableTo`. */
214
214
  export interface KindConfig {
215
215
  model?: string;
@@ -320,7 +320,7 @@ export interface ScopeConfig {
320
320
  modelRouting?: ModelRoutingConfig;
321
321
  /** The kind registry (spec §1.5): kind existence + launch knobs, keyed by
322
322
  * full kind string (top-level e.g. `developer`, or sub-kind e.g.
323
- * `plan/reviewers/security`). Builtins ship a default registry via
323
+ * `audit/security`). Builtins ship a default registry via
324
324
  * `defaultScopeConfig()`; user/project `config.json` adds or shadows
325
325
  * entries at the same scope precedence as the rest of `ScopeConfig`. */
326
326
  kinds: Record<string, KindConfig>;
@@ -483,13 +483,10 @@ export declare function defaultScopeConfig(): ScopeConfig;
483
483
  /** No remote canvas targets are configured out of the box — every one is
484
484
  * registered via `crtr canvas config add` (see `RemoteCanvasConfig`). */
485
485
  export declare function defaultRemoteCanvasConfig(): RemoteCanvasConfig;
486
- /** The builtin kind registry (spec §1.5): the built-in defaults for every
487
- * top-level kind and its sub-persona kinds. `whenToUse`/`model` are the
488
- * base-worker defaults; `orchestratorModel` optionally raises the default
489
- * for a coordinating persona. Roadmap-shaping guidance is orchestrator-only —
490
- * an orchestrator-gated memory doc keyed to the kind, not baked into the
491
- * registry entry. Sub-persona `availableTo` is omitted where it only
492
- * reproduces the default (its own top-level ancestor). */
486
+ /** The builtin kind registry (spec §1.5): core role discovery and launch
487
+ * defaults. `whenToUse`/`model` are the base-worker defaults;
488
+ * `orchestratorModel` optionally raises the default for a coordinating
489
+ * persona. Optional plugins contribute their own specialist sub-personas. */
493
490
  export declare function defaultKindsConfig(): Record<string, KindConfig>;
494
491
  export declare function defaultModelLaddersConfig(): ModelLaddersConfig;
495
492
  export declare function defaultScopeState(): ScopeState;