@north-light/cli 0.3.654 → 0.3.655

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 (43) hide show
  1. package/dist/clients/attach/config.js +1 -1
  2. package/dist/clients/attach/input/controller.d.ts +2 -3
  3. package/dist/clients/attach/input/controller.js +3 -3
  4. package/dist/clients/attach/render/chat-view.d.ts +41 -37
  5. package/dist/clients/attach/render/chat-view.js +3 -3
  6. package/dist/clients/attach/session/bindings.d.ts +1 -1
  7. package/dist/clients/attach/session/bindings.js +1 -1
  8. package/dist/clients/attach/session/input-wiring.d.ts +9 -9
  9. package/dist/clients/attach/session/input-wiring.js +1 -1
  10. package/dist/clients/attach/slash/dispatch.d.ts +6 -8
  11. package/dist/clients/attach/slash/dispatch.js +2 -2
  12. package/dist/clients/attach/viewer.js +514 -514
  13. package/dist/commands/node/create.js +1 -1
  14. package/dist/commands/sys/panels/prefs-panel.js +1 -1
  15. package/dist/core/config.js +1 -1
  16. package/dist/core/graph/documents.js +13 -11
  17. package/dist/core/graph/edges.js +4 -3
  18. package/dist/core/graph/exposures.js +7 -4
  19. package/dist/core/graph/kinds/document.js +4 -4
  20. package/dist/core/graph/kinds/dto.d.ts +2 -0
  21. package/dist/core/graph/kinds/dto.js +1 -1
  22. package/dist/core/graph/names.d.ts +4 -0
  23. package/dist/core/graph/names.js +9 -8
  24. package/dist/core/graph/rules.d.ts +2 -0
  25. package/dist/core/graph/rules.js +3 -3
  26. package/dist/core/keybindings/catalog.d.ts +3 -3
  27. package/dist/core/keybindings/catalog.js +1 -1
  28. package/dist/core/runtime/broker/tool-groups.js +1 -1
  29. package/dist/core/runtime/broker/turn-replies.d.ts +1 -4
  30. package/dist/core/runtime/broker/turn-replies.js +1 -1
  31. package/dist/core/runtime/broker-protocol.d.ts +2 -2
  32. package/dist/core/runtime/tmux-bindings.js +3 -3
  33. package/dist/core/substrate/delivery/corpus.d.ts +3 -0
  34. package/dist/core/substrate/delivery/corpus.js +2 -3
  35. package/dist/core/substrate/delivery/render-event.js +4 -4
  36. package/dist/core/user-settings.d.ts +13 -35
  37. package/dist/core/user-settings.js +1 -1
  38. package/dist/types.d.ts +13 -15
  39. package/dist/types.js +1 -1
  40. package/docs/cli/the-viewer.md +16 -2
  41. package/package.json +2 -2
  42. package/packages/crouter-identity/package.json +1 -1
  43. package/runtime.lock.json +13 -13
@@ -1,11 +1,12 @@
1
- var x=Object.defineProperty;var p=(t,e)=>x(t,"name",{value:e,configurable:!0});import{isSafeNodeId as F}from"../canvas/paths.js";import{OBJECT_TYPE as H}from"../permissions/builtin.js";import{ceilingFrag as W,readablePackageApps as v,resolveCeiling as Y}from"../permissions/ceiling.js";import{compilePermission as k}from"../permissions/compile.js";import{permits as P,readerUser as b,resolveReader as y}from"../permissions/evaluator.js";import{loadDefinitions as q}from"../permissions/schemas.js";import{and as B,or as J,raw as g}from"../permissions/sql.js";import{getById as V}from"./objects.js";import{flatMapAsync as O}from"../async-array.js";async function I(t,e){const o=await b(t,e),i=o===null?void 0:await t.prepare(`SELECT o.* FROM objects o JOIN identities i ON i.object = o.id AND i.scheme = 'user'
2
- WHERE o.type = 'person' AND o.home_machine IS NULL AND regexp_replace(i.external_id, '^user:', '') = ?`).get(o),a=await v(t,e,o),c=await t.prepare(`SELECT a.* FROM objects a WHERE a.type = 'app' AND a.deleted_at IS NULL AND ${a===null?`EXISTS (
1
+ var Y=Object.defineProperty;var w=(e,t)=>Y(e,"name",{value:t,configurable:!0});import{isSafeNodeId as k}from"../canvas/paths.js";import{OBJECT_TYPE as b}from"../permissions/builtin.js";import{ceilingFrag as q,readablePackageApps as P,resolveCeiling as B}from"../permissions/ceiling.js";import{compilePermission as J}from"../permissions/compile.js";import{permits as V,readerUser as X,resolveReader as j}from"../permissions/evaluator.js";import{loadDefinitions as z}from"../permissions/schemas.js";import{and as G,or as K,raw as W}from"../permissions/sql.js";import{getById as Q}from"./objects.js";import{flatMapAsync as U}from"../async-array.js";async function _(e,t){const a=await X(e,t),p=a===null?void 0:await e.prepare(`SELECT o.* FROM objects o JOIN identities i ON i.object = o.id AND i.scheme = 'user'
2
+ WHERE o.type = 'person' AND o.home_machine IS NULL AND regexp_replace(i.external_id, '^user:', '') = ?`).get(a),s=await P(e,t,a),f=await e.prepare(`SELECT a.* FROM objects a WHERE a.type = 'app' AND a.deleted_at IS NULL AND ${s===null?`EXISTS (
3
3
  SELECT 1 FROM objects o JOIN documents d ON d.object = o.id
4
4
  WHERE o.owner = a.id AND o.type = 'document' AND o.deleted_at IS NULL AND d.source_path IS NOT NULL)`:"a.id = ANY(?::text[])"}
5
- ORDER BY a.name = 'crtr', a.name`).all(...a===null?[]:[a]),r=e.class==="node"?[e.node,...e.repos,...e.projectRepos,e.profile,e.app]:e.class==="app"?[e.app]:e.class==="object"?[e.owner,...e.repos,e.app]:[],s=new Set;return[...r,i,...c].filter(l=>!!l&&!s.has(l.id)&&!!s.add(l.id))}p(I,"viewOf");async function X(t,e,o){const i=await P(t,e,"read",o),a=await Y(t,e.reader,e.userId,"read"),c=k(await q(t),e.subjects,H,"read",g("gr.id")),r={sql:`EXISTS (WITH RECURSIVE up(id, depth) AS (
6
- SELECT ${o}.id, 0
5
+ ORDER BY a.name = 'crtr', a.name`).all(...s===null?[]:[s]),i=t.class==="node"?[t.node,...t.repos,...t.projectRepos,t.profile,t.app]:t.class==="app"?[t.app]:t.class==="object"?[t.owner,...t.repos,t.app]:[],c=new Set;return[...i,p,...f].filter(l=>!!l&&!c.has(l.id)&&!!c.add(l.id))}w(_,"viewOf");async function Z(e,t,a){const p=await V(e,t,"read",a),s=await B(e,t.reader,t.userId,"read"),f=J(await z(e),t.subjects,b,"read",W("gr.id")),i={sql:`EXISTS (WITH RECURSIVE up(id, depth) AS (
6
+ SELECT ${a}.id, 0
7
7
  UNION ALL SELECT p.owner, up.depth + 1 FROM up JOIN objects p ON p.id = up.id WHERE p.owner IS NOT NULL AND up.depth < 12)
8
- SELECT 1 FROM up gr WHERE ${c.sql})`,params:c.params},s=B([g(`${o}.deleted_at IS NOT NULL AND ${o}.schema_type IS NULL`),...a===null?[]:[W(a,o)],r]);return J([i,s])}p(X,"readableOrDeleted");const S=new WeakMap;function A(t,e){let o=S.get(e);return o===void 0&&(o=X(t,e,"o"),o.catch(()=>S.delete(e)),S.set(e,o)),o}p(A,"readableFrag");async function z(t,e,o){const i=await A(t,e);return(await t.prepareUncached(`SELECT ${i.sql} AS ok FROM objects o WHERE o.id = ?`).get(...i.params,o))?.ok===!0}p(z,"canReadOrDeleted");async function E(t,e,o,i,a,c=!1){const r=await A(t,e);return await t.prepareUncached(`SELECT o.* FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0) AND o.owner = ? AND o.name = ? AND o.home_machine IS ${c?"NOT NULL":"NULL"}
9
- AND o.deleted_at IS ${a?"NOT NULL":"NULL"} AND ${r.sql}${a?" ORDER BY o.deleted_at DESC":""}`).all(o.id,i,...r.params)}p(E,"namedObjects");const ie=["person","app","repo","profile"],T=/^(person|app|repo|profile|node):([^/]+)\/(.+)$/,D=p(t=>t.trim().replace(/^\[\[(.*)\]\]$/,"$1").trim(),"unwrapRef");function j(t){const e=T.exec(t);if(e)return{type:e[1],handle:e[2],rest:e[3]};const o=t.indexOf("/");return o>0?{handle:t.slice(0,o),rest:t.slice(o+1)}:null}p(j,"splitOwnerRef");async function U(t,e,o){return o==="node"?await t.prepare("SELECT * FROM objects WHERE type = 'node' AND id = ?").all(e):o?await t.prepare("SELECT * FROM objects WHERE type = ? AND (name = ? OR id = ?) AND home_machine IS NULL").all(o,e,e):await t.prepare(`SELECT * FROM objects WHERE (type = 'node' AND id = ?)
10
- OR (type IN ('person','app','repo','profile') AND (name = ? OR id = ?) AND home_machine IS NULL)`).all(e,e,e)}p(U,"ownersByHandle");const _=/^([^:/]+):reports\/(.+?)(?:\.md)?$/;async function se(t,e,o){const i=[...new Set(o.filter(n=>D(n)===n&&!_.test(n)))],a=new Map;if(i.length===0||e.view.length===0)return a;const c=new Set((await t.prepare("SELECT id FROM objects WHERE id = ANY(?::text[])").all(i)).map(n=>n.id)),r=i.filter(n=>!c.has(n));for(const n of r)a.set(n,null);const s=await A(t,e.ev),l=await t.prepareUncached(`SELECT o.id, o.owner, o.name FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0)
11
- AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NULL AND ${s.sql}`).all(e.view.map(n=>n.id),r,...s.params),m=new Map(e.view.map((n,u)=>[n.id,u])),f=new Map;for(const n of l){const u=m.get(n.owner);u<(f.get(n.name)??1/0)&&(f.set(n.name,u),a.set(n.name,n.id))}return a}p(se,"viewResolutions");async function ce(t,e,o,i){let a=D(o);const c=_.exec(a);c&&!T.test(a)&&(a=`${c[1]}/reports/${c[2]}`);const r=i?.ev??await y(t,e),s=await V(t,a);if(s&&await z(t,r,s.id))return s.deleted_at?{deleted:s}:{object:s};const l=i?.view??await I(t,e);for(const f of l){const n=(await E(t,r,f,a,!1))[0];if(n)return{object:n}}const m=j(a);if(m){const{type:f,handle:n,rest:u}=m,C=f!==void 0,N=await U(t,n,f),R=p(d=>{const w=l.findIndex($=>$.id===d.id);return w<0?1/0:w},"rank"),M=N.filter(d=>R(d)<1/0).sort((d,w)=>R(d)-R(w));for(const d of M){const w=(await E(t,r,d,u,!1))[0];if(w)return{object:w}}const L=await O(N,async d=>await E(t,r,d,u,!1));if(L.length===1)return{object:L[0]};if(L.length>1)return{ambiguous:L};const h=(await O(N,async d=>await E(t,r,d,u,!0)))[0];return h?{deleted:h}:!C&&N.length===0&&F(n)?{remote:a}:{missing:!0}}for(const f of l){const n=(await E(t,r,f,a,!0))[0];if(n)return{deleted:n}}return{missing:!0}}p(ce,"resolveName");async function pe(t,e,o){const i=D(o),a=await y(t,e),c=p(async(l,m)=>await O(l,async f=>await E(t,a,f,m,!1,!0)),"found"),r=await c(await I(t,e),i);if(r.length)return r;const s=j(i);return s?await c(await U(t,s.handle,s.type),s.rest):[]}p(pe,"stubsNamed");export{ie as HANDLE_TYPES,z as canReadOrDeleted,U as ownersByHandle,X as readableOrDeleted,ce as resolveName,pe as stubsNamed,D as unwrapRef,I as viewOf,se as viewResolutions};
8
+ SELECT 1 FROM up gr WHERE ${f.sql})`,params:f.params},c=G([W(`${a}.deleted_at IS NOT NULL AND ${a}.schema_type IS NULL`),...s===null?[]:[q(s,a)],i]);return K([p,c])}w(Z,"readableOrDeleted");const x=new WeakMap;function M(e,t){let a=x.get(t);return a===void 0&&(a=Z(e,t,"o"),a.catch(()=>x.delete(t)),x.set(t,a)),a}w(M,"readableFrag");async function ee(e,t,a){const p=await M(e,t);return(await e.prepareUncached(`SELECT ${p.sql} AS ok FROM objects o WHERE o.id = ?`).get(...p.params,a))?.ok===!0}w(ee,"canReadOrDeleted");async function O(e,t,a,p,s,f=!1){const i=await M(e,t);return await e.prepareUncached(`SELECT o.* FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0) AND o.owner = ? AND o.name = ? AND o.home_machine IS ${f?"NOT NULL":"NULL"}
9
+ AND o.deleted_at IS ${s?"NOT NULL":"NULL"} AND ${i.sql}${s?" ORDER BY o.deleted_at DESC":""}`).all(a.id,p,...i.params)}w(O,"namedObjects");const we=["person","app","repo","profile"],C=/^(person|app|repo|profile|node):([^/]+)\/(.+)$/,T=w(e=>e.trim().replace(/^\[\[(.*)\]\]$/,"$1").trim(),"unwrapRef");function H(e){const t=C.exec(e);if(t)return{type:t[1],handle:t[2],rest:t[3]};const a=e.indexOf("/");return a>0?{handle:e.slice(0,a),rest:e.slice(a+1)}:null}w(H,"splitOwnerRef");async function v(e,t,a){return a==="node"?await e.prepare("SELECT * FROM objects WHERE type = 'node' AND id = ?").all(t):a?await e.prepare("SELECT * FROM objects WHERE type = ? AND (name = ? OR id = ?) AND home_machine IS NULL").all(a,t,t):await e.prepare(`SELECT * FROM objects WHERE (type = 'node' AND id = ?)
10
+ OR (type IN ('person','app','repo','profile') AND (name = ? OR id = ?) AND home_machine IS NULL)`).all(t,t,t)}w(v,"ownersByHandle");const F=/^([^:/]+):reports\/(.+?)(?:\.md)?$/;async function de(e,t,a){const p=[...new Set(a.filter(o=>T(o)===o&&!F.test(o)))],s=new Map;if(p.length===0||t.view.length===0)return s;const f=new Set((await e.prepare("SELECT id FROM objects WHERE id = ANY(?::text[])").all(p)).map(o=>o.id)),i=p.filter(o=>!f.has(o));for(const o of i)s.set(o,null);const c=await M(e,t.ev),l=await e.prepareUncached(`SELECT o.id, o.owner, o.name FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0)
11
+ AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NULL AND ${c.sql}`).all(t.view.map(o=>o.id),i,...c.params),N=new Map(t.view.map((o,d)=>[o.id,d])),m=new Map;for(const o of l){const d=N.get(o.owner);d<(m.get(o.name)??1/0)&&(m.set(o.name,d),s.set(o.name,o.id))}return s}w(de,"viewResolutions");async function te(e,t,a,p){let s=T(a);const f=F.exec(s);f&&!C.test(s)&&(s=`${f[1]}/reports/${f[2]}`);const i=p?.ev??await j(e,t),c=await Q(e,s);if(c&&await ee(e,i,c.id))return c.deleted_at?{deleted:c}:{object:c};const l=p?.view??await _(e,t);for(const m of l){const o=(await O(e,i,m,s,!1))[0];if(o)return{object:o}}const N=H(s);if(N){const{type:m,handle:o,rest:d}=N,R=m!==void 0,S=await v(e,o,m),y=w(u=>{const n=l.findIndex(r=>r.id===u.id);return n<0?1/0:n},"rank"),g=S.filter(u=>y(u)<1/0).sort((u,n)=>y(u)-y(n));for(const u of g){const n=(await O(e,i,u,d,!1))[0];if(n)return{object:n}}const E=await U(S,async u=>await O(e,i,u,d,!1));if(E.length===1)return{object:E[0]};if(E.length>1)return{ambiguous:E};const D=(await U(S,async u=>await O(e,i,u,d,!0)))[0];return D?{deleted:D}:!R&&S.length===0&&k(o)?{remote:s}:{missing:!0}}for(const m of l){const o=(await O(e,i,m,s,!0))[0];if(o)return{deleted:o}}return{missing:!0}}w(te,"resolveName");async function ue(e,t,a,p){const s=[...a];if(s.length===0)return new Map;const f=p?.ev??await j(e,t),i=p?.view??await _(e,t),c=new Map;for(const o of s){let d=T(o);const R=F.exec(d);R&&!C.test(d)&&(d=`${R[1]}/reports/${R[2]}`),c.set(o,d)}const l=new Map,N=[...new Set(c.values())];if(N.length>0){const o=await M(e,f),d=await e.prepareUncached(`SELECT o.*, ${o.sql} AS readable_ok FROM objects o WHERE o.id = ANY(?::text[])`).all(...o.params,N);for(const{readable_ok:n,...r}of d)n===!0&&l.set(r.id,r.deleted_at?{deleted:r}:{object:r});const R=w(async(n,r)=>{if(n.length===0||r.length===0)return new Map;const h=await e.prepareUncached(`SELECT o.* FROM objects o WHERE (o.type = 'document' OR strpos(o.type, '.') > 0)
12
+ AND o.owner = ANY(?::text[]) AND o.name = ANY(?::text[]) AND o.home_machine IS NULL AND o.deleted_at IS NULL AND ${o.sql}`).all(n,r,...o.params);return new Map(h.map(A=>[`${A.owner}\0${A.name}`,A]))},"live"),S=N.filter(n=>!l.has(n)),y=await R(i.map(n=>n.id),S);for(const n of S){const r=i.find(h=>y.has(`${h.id}\0${n}`));r&&l.set(n,{object:y.get(`${r.id}\0${n}`)})}const g=N.filter(n=>!l.has(n)).flatMap(n=>{const r=H(n);return r?[{name:n,...r}]:[]}),E=new Map;for(const n of g){const r=`${n.type??""}\0${n.handle}`;E.has(r)||E.set(r,await v(e,n.handle,n.type))}const D=await R([...new Set([...E.values()].flat().map(n=>n.id))],[...new Set(g.map(n=>n.rest))]),u=w(n=>{const r=i.findIndex(h=>h.id===n.id);return r<0?1/0:r},"rank");for(const n of g){const r=E.get(`${n.type??""}\0${n.handle}`),h=w(L=>D.get(`${L.id}\0${n.rest}`),"hitOf"),A=r.filter(L=>u(L)<1/0).sort((L,$)=>u(L)-u($)).find(L=>h(L)!==void 0),I=r.flatMap(L=>{const $=h(L);return $?[$]:[]});A?l.set(n.name,{object:h(A)}):I.length===1?l.set(n.name,{object:I[0]}):I.length>1&&l.set(n.name,{ambiguous:I})}}const m=new Map;for(const[o,d]of c)m.set(o,l.get(d)??await te(e,t,o,{ev:f,view:i}));return m}w(ue,"resolveNames");async function me(e,t,a){const p=T(a),s=await j(e,t),f=w(async(l,N)=>await U(l,async m=>await O(e,s,m,N,!1,!0)),"found"),i=await f(await _(e,t),p);if(i.length)return i;const c=H(p);return c?await f(await v(e,c.handle,c.type),c.rest):[]}w(me,"stubsNamed");export{we as HANDLE_TYPES,ee as canReadOrDeleted,v as ownersByHandle,Z as readableOrDeleted,te as resolveName,ue as resolveNames,me as stubsNamed,T as unwrapRef,_ as viewOf,de as viewResolutions};
@@ -13,6 +13,8 @@ export declare function replaceRules(db: CanvasDb, object: ObjectRow, specs: rea
13
13
  /** Re-point the document's rule rows at its current owner (after a move). */
14
14
  export declare function setRulesOwner(db: CanvasDb, object: ObjectRow): Promise<void>;
15
15
  export declare function rulesOf(db: CanvasDb, object: ObjectRow): Promise<RuleRow[]>;
16
+ /** The rules of every object in `ids`, keyed by object id, in one query; an object without rules has no entry. */
17
+ export declare function rulesOfMany(db: CanvasDb, ids: readonly string[]): Promise<Map<string, RuleRow[]>>;
16
18
  /** Every rule on one of `on` whose document satisfies `permitted`: SQL over the document's `objects` row aliased `o` (the evaluator's `permits`). */
17
19
  export declare function rulesOn(db: CanvasDb, on: readonly RuleOn[], permitted: {
18
20
  sql: string;
@@ -1,3 +1,3 @@
1
- var N=Object.defineProperty;var d=(e,n)=>N(e,"name",{value:n,configurable:!0});import{forEachAsync as R}from"../async-array.js";const h=["boot","workspace-open","file-read","document-read","command","pre-command","slash-command"],m=["name","preview","content"],y=["file-read","document-read","command","pre-command"],E=["on","match","matchFrontmatter","if","deliver"];function O(e){return{object:e.object,owner:e.owner,position:e.position,on:e.on_event,deliver:e.deliver,...e.match_json!==null?{match:JSON.parse(e.match_json)}:{},...e.match_frontmatter_json!==null?{matchFrontmatter:JSON.parse(e.match_frontmatter_json)}:{},...e.if_json!==null?{if:JSON.parse(e.if_json)}:{}}}d(O,"fromRaw");async function v(e,n,t){const i=S(t);if(i!==null)throw new Error(`replaceRules(${n.id}): ${i}`);await e.prepare("DELETE FROM rules WHERE object = ?").run(n.id);const c=e.prepare(`INSERT INTO rules (object, owner, position, on_event, match_json, match_frontmatter_json, if_json, deliver)
2
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);await R(t,async(r,o)=>{await c.run(n.id,n.owner,o,r.on,r.match!==void 0?JSON.stringify(r.match):null,r.matchFrontmatter!==void 0?JSON.stringify(r.matchFrontmatter):null,r.if!==void 0?JSON.stringify(r.if):null,r.deliver)})}d(v,"replaceRules");async function F(e,n){const t=await e.prepare("SELECT owner FROM objects WHERE id = ?").get(n.id);if(t===void 0)throw new Error(`setRulesOwner: object ${n.id} does not exist`);await e.prepare("UPDATE rules SET owner = ? WHERE object = ?").run(t.owner,n.id)}d(F,"setRulesOwner");async function $(e,n){return(await e.prepare("SELECT * FROM rules WHERE object = ? ORDER BY position").all(n.id)).map(O)}d($,"rulesOf");async function b(e,n,t){if(n.length===0)return[];const i=`SELECT r.* FROM rules r JOIN objects o ON o.id = r.object WHERE r.on_event IN (${n.map(()=>"?").join(",")})
3
- AND o.deleted_at IS NULL AND ${t.sql} ORDER BY r.object, r.position`;return(await e.prepareUncached(i).all(...n,...t.params)).map(O)}d(b,"rulesOn");const g={boot:"boot","workspace-open":"workspace-open",read:"file-read","memory-read":"document-read",command:"command","pre-command":"pre-command"};function s(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}d(s,"predicate");function j(e){if(typeof e=="string")return e.trim()===""?void 0:[e.trim()];if(!Array.isArray(e))return;const n=e.filter(t=>typeof t=="string"&&t.trim()!=="").map(t=>t.trim());return n.length>0?n:void 0}d(j,"globs");function A(e){const n=s(e.gate),t=d(r=>n!==void 0&&r!==void 0?{all:[n,r]}:n??r,"withGate"),i=[],c=Array.isArray(e.surfaces)?e.surfaces:[];for(const r of c){const o=s(r);if(o===void 0)continue;const a=typeof o.on=="string"?g[o.on]:void 0,u=o.at;if(a===void 0||typeof u!="string"||!m.includes(u))continue;const f=j(o.match),l=a==="file-read"?s(o["match-frontmatter"]):void 0;if(y.includes(a)&&f===void 0&&l===void 0)continue;const p=t(s(o.gate));i.push({on:a,deliver:u,...f!==void 0&&a!=="boot"&&a!=="workspace-open"?{match:f}:{},...l!==void 0?{matchFrontmatter:l}:{},...p!==void 0?{if:p}:{}})}return e.slash===!0&&i.push({on:"slash-command",deliver:"content",...n!==void 0?{if:n}:{}}),i}d(A,"rulesFromFrontmatter");function S(e){if(!Array.isArray(e))return`invalid rules: ${JSON.stringify(e)} (expected a list of {on, deliver, match?, matchFrontmatter?, if?} entries)`;for(const n of e){const t=s(n);if(t===void 0)return`invalid rule: ${JSON.stringify(n)} (expected an {on, deliver, match?, matchFrontmatter?, if?} object)`;for(const a of Object.keys(t))if(!E.includes(a))return`invalid rule: unknown key \`${a}\` (a rule carries only ${E.join(", ")})`;const i=t.on;if(typeof i!="string"||!h.includes(i))return`invalid rule \`on\`: ${JSON.stringify(i)} (expected ${h.join("|")})`;const c=t.deliver;if(typeof c!="string"||!m.includes(c))return`invalid rule \`deliver\`: ${JSON.stringify(c)} (expected ${m.join("|")})`;const r=t.match;if(r!==void 0){if(i==="boot"||i==="workspace-open"||i==="slash-command")return`invalid rule: \`match\` is meaningless on \`${i}\`; drop it`;if(!Array.isArray(r)||r.length===0||r.some(a=>typeof a!="string"||a.trim()===""))return`invalid rule \`match\`: ${JSON.stringify(r)} (expected a non-empty list of non-empty globs)`}const o=t.matchFrontmatter;if(o!==void 0){if(i!=="file-read")return"invalid rule: `matchFrontmatter` applies to `file-read` rules only";if(s(o)===void 0)return`invalid rule \`matchFrontmatter\`: ${JSON.stringify(o)} (expected a field\u2192matcher object)`}if(y.includes(i)&&r===void 0&&o===void 0)return`invalid rule: a \`${i}\` rule requires \`match\`${i==="file-read"?" or `matchFrontmatter`":""}`;if(t.if!==void 0&&s(t.if)===void 0)return`invalid rule \`if\`: ${JSON.stringify(t.if)} (expected a predicate object)`}return null}d(S,"lintRules");export{h as RULE_ONS,S as lintRules,v as replaceRules,A as rulesFromFrontmatter,$ as rulesOf,b as rulesOn,F as setRulesOwner};
1
+ var R=Object.defineProperty;var c=(e,n)=>R(e,"name",{value:n,configurable:!0});import{forEachAsync as j}from"../async-array.js";const y=["boot","workspace-open","file-read","document-read","command","pre-command","slash-command"],m=["name","preview","content"],E=["file-read","document-read","command","pre-command"],O=["on","match","matchFrontmatter","if","deliver"];function p(e){return{object:e.object,owner:e.owner,position:e.position,on:e.on_event,deliver:e.deliver,...e.match_json!==null?{match:JSON.parse(e.match_json)}:{},...e.match_frontmatter_json!==null?{matchFrontmatter:JSON.parse(e.match_frontmatter_json)}:{},...e.if_json!==null?{if:JSON.parse(e.if_json)}:{}}}c(p,"fromRaw");async function _(e,n,t){const r=N(t);if(r!==null)throw new Error(`replaceRules(${n.id}): ${r}`);await e.prepare("DELETE FROM rules WHERE object = ?").run(n.id);const s=e.prepare(`INSERT INTO rules (object, owner, position, on_event, match_json, match_frontmatter_json, if_json, deliver)
2
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);await j(t,async(o,i)=>{await s.run(n.id,n.owner,i,o.on,o.match!==void 0?JSON.stringify(o.match):null,o.matchFrontmatter!==void 0?JSON.stringify(o.matchFrontmatter):null,o.if!==void 0?JSON.stringify(o.if):null,o.deliver)})}c(_,"replaceRules");async function F(e,n){const t=await e.prepare("SELECT owner FROM objects WHERE id = ?").get(n.id);if(t===void 0)throw new Error(`setRulesOwner: object ${n.id} does not exist`);await e.prepare("UPDATE rules SET owner = ? WHERE object = ?").run(t.owner,n.id)}c(F,"setRulesOwner");async function v(e,n){return(await e.prepare("SELECT * FROM rules WHERE object = ? ORDER BY position").all(n.id)).map(p)}c(v,"rulesOf");async function $(e,n){const t=new Map;if(n.length===0)return t;const r=await e.prepare("SELECT * FROM rules WHERE object = ANY(?::text[]) ORDER BY object, position").all([...new Set(n)]);for(const s of r)t.set(s.object,[...t.get(s.object)??[],p(s)]);return t}c($,"rulesOfMany");async function A(e,n,t){if(n.length===0)return[];const r=`SELECT r.* FROM rules r JOIN objects o ON o.id = r.object WHERE r.on_event IN (${n.map(()=>"?").join(",")})
3
+ AND o.deleted_at IS NULL AND ${t.sql} ORDER BY r.object, r.position`;return(await e.prepareUncached(r).all(...n,...t.params)).map(p)}c(A,"rulesOn");const w={boot:"boot","workspace-open":"workspace-open",read:"file-read","memory-read":"document-read",command:"command","pre-command":"pre-command"};function d(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}c(d,"predicate");function g(e){if(typeof e=="string")return e.trim()===""?void 0:[e.trim()];if(!Array.isArray(e))return;const n=e.filter(t=>typeof t=="string"&&t.trim()!=="").map(t=>t.trim());return n.length>0?n:void 0}c(g,"globs");function x(e){const n=d(e.gate),t=c(o=>n!==void 0&&o!==void 0?{all:[n,o]}:n??o,"withGate"),r=[],s=Array.isArray(e.surfaces)?e.surfaces:[];for(const o of s){const i=d(o);if(i===void 0)continue;const a=typeof i.on=="string"?w[i.on]:void 0,u=i.at;if(a===void 0||typeof u!="string"||!m.includes(u))continue;const f=g(i.match),l=a==="file-read"?d(i["match-frontmatter"]):void 0;if(E.includes(a)&&f===void 0&&l===void 0)continue;const h=t(d(i.gate));r.push({on:a,deliver:u,...f!==void 0&&a!=="boot"&&a!=="workspace-open"?{match:f}:{},...l!==void 0?{matchFrontmatter:l}:{},...h!==void 0?{if:h}:{}})}return e.slash===!0&&r.push({on:"slash-command",deliver:"content",...n!==void 0?{if:n}:{}}),r}c(x,"rulesFromFrontmatter");function N(e){if(!Array.isArray(e))return`invalid rules: ${JSON.stringify(e)} (expected a list of {on, deliver, match?, matchFrontmatter?, if?} entries)`;for(const n of e){const t=d(n);if(t===void 0)return`invalid rule: ${JSON.stringify(n)} (expected an {on, deliver, match?, matchFrontmatter?, if?} object)`;for(const a of Object.keys(t))if(!O.includes(a))return`invalid rule: unknown key \`${a}\` (a rule carries only ${O.join(", ")})`;const r=t.on;if(typeof r!="string"||!y.includes(r))return`invalid rule \`on\`: ${JSON.stringify(r)} (expected ${y.join("|")})`;const s=t.deliver;if(typeof s!="string"||!m.includes(s))return`invalid rule \`deliver\`: ${JSON.stringify(s)} (expected ${m.join("|")})`;const o=t.match;if(o!==void 0){if(r==="boot"||r==="workspace-open"||r==="slash-command")return`invalid rule: \`match\` is meaningless on \`${r}\`; drop it`;if(!Array.isArray(o)||o.length===0||o.some(a=>typeof a!="string"||a.trim()===""))return`invalid rule \`match\`: ${JSON.stringify(o)} (expected a non-empty list of non-empty globs)`}const i=t.matchFrontmatter;if(i!==void 0){if(r!=="file-read")return"invalid rule: `matchFrontmatter` applies to `file-read` rules only";if(d(i)===void 0)return`invalid rule \`matchFrontmatter\`: ${JSON.stringify(i)} (expected a field\u2192matcher object)`}if(E.includes(r)&&o===void 0&&i===void 0)return`invalid rule: a \`${r}\` rule requires \`match\`${r==="file-read"?" or `matchFrontmatter`":""}`;if(t.if!==void 0&&d(t.if)===void 0)return`invalid rule \`if\`: ${JSON.stringify(t.if)} (expected a predicate object)`}return null}c(N,"lintRules");export{y as RULE_ONS,N as lintRules,_ as replaceRules,x as rulesFromFrontmatter,v as rulesOf,$ as rulesOfMany,A as rulesOn,F as setRulesOwner};
@@ -1,6 +1,6 @@
1
1
  import type { BindingDefinition, SafetyRequirement } from './types.js';
2
2
  import type { AttachBindingId, AttachMenuBindingId } from './attach-control.js';
3
- type TmuxMenuAction = 'open' | 'attach' | 'show' | 'view-settings' | 'provider-options' | 'fold-tools' | 'show-working' | 'metadata' | 'promote' | 'demote-mode' | 'resume' | 'fork' | 'demote' | 'make-resident' | 'detach' | 'close-subtree' | 'background-bash' | 'file-review' | 'pin' | 'reload-viewer' | 'recap' | 'context' | 'context-admin' | 'providers' | 'plugins' | 'analytics' | 'graph' | 'focus-manager' | 'copy-id' | 'issues' | 'dashboard';
3
+ type TmuxMenuAction = 'open' | 'attach' | 'show' | 'view-settings' | 'provider-options' | 'more-detail' | 'less-detail' | 'metadata' | 'promote' | 'demote-mode' | 'resume' | 'fork' | 'demote' | 'make-resident' | 'detach' | 'close-subtree' | 'background-bash' | 'file-review' | 'pin' | 'reload-viewer' | 'recap' | 'context' | 'context-admin' | 'providers' | 'plugins' | 'analytics' | 'graph' | 'focus-manager' | 'copy-id' | 'issues' | 'dashboard';
4
4
  type TmuxMenuEntryAction = Exclude<TmuxMenuAction, 'open' | 'attach'> | `issue.${'idea' | 'bug'}`;
5
5
  type GraphAction = 'down' | 'up' | 'first' | 'last' | 'collapse-or-manager' | 'expand-or-child' | 'focus' | 'revive' | 'focus-manager' | 'close-subtree' | 'dismiss';
6
6
  type BrowseAction = 'quit' | 'down' | 'up' | 'first' | 'last' | 'expand-or-child' | 'collapse-or-parent' | 'toggle-fold' | 'tab-next' | 'tab-previous' | `tab.${1 | 2 | 3 | 4 | 5}` | 'close-subtree' | 'confirm-close' | 'sort' | 'scope' | 'profile' | 'residents' | 'preview' | 'report' | 'pin' | 'search' | 'revive-now' | 'focus' | 'focus-background' | 'yank-id';
@@ -9,8 +9,8 @@ type ProfileMenuAction = 'up' | 'down' | 'select' | 'accept-default' | 'abort' |
9
9
  type SetupAction = 'cancel' | 'tab-next' | 'tab-previous' | 'open' | 'list-down' | 'list-up' | 'toggle' | 'details' | 'advance' | 'cell-previous' | 'cell-next';
10
10
  type SetupKeybindingAction = 'edit' | 'commit-edit' | 'cancel-edit' | 'unbind' | 'reset-row' | 'reset-all' | 'save' | 'discard' | 'page-up' | 'page-down' | 'filter' | 'filter-delete' | 'filter-clear';
11
11
  type SetupModelsAction = 'open' | 'commit' | 'cancel' | 'scope-next';
12
- export type BindingId = `crtr.tmux.menu.${TmuxMenuAction}` | `crtr.tmux.menu.issue.${'idea' | 'bug'}` | AttachMenuBindingId | `crtr.tmux.menu-global.${TmuxMenuEntryAction}` | `crtr.tmux.node.${'next' | 'previous'}` | 'crtr.tmux.inbox.toggle' | `crtr.attach.scroll.${'up' | 'down' | 'page-up' | 'page-down' | 'live'}` | 'crtr.attach.mouse.toggle' | 'crtr.attach.copy.message' | 'crtr.attach.help.toggle' | `crtr.attach.search.${'next' | 'previous' | 'edit' | 'close'}` | AttachBindingId | `crtr.graph.${GraphAction}` | `crtr.graph.confirm.${'accept' | 'cancel'}` | `crtr.inspector.${'force-quit' | 'down' | 'up' | 'section-next' | 'section-prev' | 'page-down' | 'page-up' | 'toggle-detail' | 'cancel-item' | 'open-log' | 'confirm' | 'dismiss' | 'retarget' | 'refresh' | 'quit'}` | `crtr.browse.${BrowseAction}` | `crtr.browse.search.${'cancel' | 'commit' | 'delete' | 'quit'}` | `crtr.dashboard.${DashboardAction}` | `crtr.profile.menu.${ProfileMenuAction}` | `crtr.profile.search.${'up' | 'down' | 'pick' | 'back' | 'delete' | 'abort'}` | `crtr.setup.${SetupAction}` | `crtr.setup.confirm.${'accept' | 'back'}` | `crtr.setup.keybindings.${SetupKeybindingAction}` | `crtr.setup.models.${SetupModelsAction}`;
13
- export declare const BINDING_CATALOG: readonly [BindingDefinition<"crtr.tmux.menu.open">, BindingDefinition<"crtr.tmux.menu.attach">, ...(BindingDefinition<BindingId> | BindingDefinition<"crtr.tmux.node.next"> | BindingDefinition<"crtr.tmux.node.previous"> | BindingDefinition<"crtr.tmux.inbox.toggle"> | BindingDefinition<"crtr.attach.scroll.up"> | BindingDefinition<"crtr.attach.scroll.down"> | BindingDefinition<"crtr.attach.scroll.page-up"> | BindingDefinition<"crtr.attach.scroll.page-down"> | BindingDefinition<"crtr.attach.scroll.live"> | BindingDefinition<"crtr.attach.mouse.toggle"> | BindingDefinition<"crtr.attach.copy.message"> | BindingDefinition<"crtr.attach.search.next"> | BindingDefinition<"crtr.attach.search.previous"> | BindingDefinition<"crtr.attach.search.edit"> | BindingDefinition<"crtr.attach.search.close"> | BindingDefinition<"crtr.graph.down"> | BindingDefinition<"crtr.graph.up"> | BindingDefinition<"crtr.graph.first"> | BindingDefinition<"crtr.graph.last"> | BindingDefinition<"crtr.graph.collapse-or-manager"> | BindingDefinition<"crtr.graph.expand-or-child"> | BindingDefinition<"crtr.graph.focus"> | BindingDefinition<"crtr.graph.revive"> | BindingDefinition<"crtr.graph.focus-manager"> | BindingDefinition<"crtr.graph.close-subtree"> | BindingDefinition<"crtr.graph.dismiss"> | BindingDefinition<"crtr.graph.confirm.accept"> | BindingDefinition<"crtr.graph.confirm.cancel"> | BindingDefinition<"crtr.inspector.force-quit"> | BindingDefinition<"crtr.inspector.down"> | BindingDefinition<"crtr.inspector.up"> | BindingDefinition<"crtr.inspector.section-next"> | BindingDefinition<"crtr.inspector.section-prev"> | BindingDefinition<"crtr.inspector.page-down"> | BindingDefinition<"crtr.inspector.page-up"> | BindingDefinition<"crtr.inspector.toggle-detail"> | BindingDefinition<"crtr.inspector.cancel-item"> | BindingDefinition<"crtr.inspector.open-log"> | BindingDefinition<"crtr.inspector.confirm"> | BindingDefinition<"crtr.inspector.dismiss"> | BindingDefinition<"crtr.inspector.retarget"> | BindingDefinition<"crtr.inspector.refresh"> | BindingDefinition<"crtr.inspector.quit"> | BindingDefinition<"crtr.browse.quit"> | BindingDefinition<"crtr.browse.down"> | BindingDefinition<"crtr.browse.up"> | BindingDefinition<"crtr.browse.first"> | BindingDefinition<"crtr.browse.last"> | BindingDefinition<"crtr.browse.expand-or-child"> | BindingDefinition<"crtr.browse.collapse-or-parent"> | BindingDefinition<"crtr.browse.toggle-fold"> | BindingDefinition<"crtr.browse.tab-next"> | BindingDefinition<"crtr.browse.tab-previous"> | BindingDefinition<"crtr.browse.tab.1" | "crtr.browse.tab.2" | "crtr.browse.tab.3" | "crtr.browse.tab.4" | "crtr.browse.tab.5"> | BindingDefinition<"crtr.browse.close-subtree"> | BindingDefinition<"crtr.browse.confirm-close"> | BindingDefinition<"crtr.browse.sort"> | BindingDefinition<"crtr.browse.scope"> | BindingDefinition<"crtr.browse.profile"> | BindingDefinition<"crtr.browse.residents"> | BindingDefinition<"crtr.browse.preview"> | BindingDefinition<"crtr.browse.report"> | BindingDefinition<"crtr.browse.pin"> | BindingDefinition<"crtr.browse.search"> | BindingDefinition<"crtr.browse.revive-now"> | BindingDefinition<"crtr.browse.focus"> | BindingDefinition<"crtr.browse.focus-background"> | BindingDefinition<"crtr.browse.yank-id"> | BindingDefinition<"crtr.browse.search.cancel"> | BindingDefinition<"crtr.browse.search.commit"> | BindingDefinition<"crtr.browse.search.delete"> | BindingDefinition<"crtr.browse.search.quit"> | BindingDefinition<"crtr.dashboard.down"> | BindingDefinition<"crtr.dashboard.up"> | BindingDefinition<"crtr.dashboard.first"> | BindingDefinition<"crtr.dashboard.last"> | BindingDefinition<"crtr.dashboard.expand"> | BindingDefinition<"crtr.dashboard.collapse"> | BindingDefinition<"crtr.dashboard.open"> | BindingDefinition<"crtr.dashboard.pin"> | BindingDefinition<"crtr.dashboard.rename"> | BindingDefinition<"crtr.dashboard.close"> | BindingDefinition<"crtr.dashboard.confirm-close"> | BindingDefinition<"crtr.dashboard.cancel-close"> | BindingDefinition<"crtr.dashboard.profile"> | BindingDefinition<"crtr.dashboard.input"> | BindingDefinition<"crtr.dashboard.input-cancel"> | BindingDefinition<"crtr.dashboard.input-submit"> | BindingDefinition<"crtr.dashboard.directory-next"> | BindingDefinition<"crtr.dashboard.directory-previous"> | BindingDefinition<"crtr.dashboard.help"> | BindingDefinition<"crtr.profile.menu.up"> | BindingDefinition<"crtr.profile.menu.down"> | BindingDefinition<"crtr.profile.menu.select"> | BindingDefinition<"crtr.profile.menu.accept-default"> | BindingDefinition<"crtr.profile.menu.abort"> | BindingDefinition<"crtr.profile.menu.slot.1" | "crtr.profile.menu.slot.2" | "crtr.profile.menu.slot.3" | "crtr.profile.menu.slot.4" | "crtr.profile.menu.slot.5" | "crtr.profile.menu.slot.6" | "crtr.profile.menu.slot.7" | "crtr.profile.menu.slot.8" | "crtr.profile.menu.slot.9">)[], BindingDefinition<"crtr.profile.menu.create">, BindingDefinition<"crtr.profile.menu.search-existing">, BindingDefinition<"crtr.profile.menu.use-root">, BindingDefinition<"crtr.profile.menu.set-default">, BindingDefinition<"crtr.profile.menu.add-directory">, BindingDefinition<"crtr.profile.menu.unpin">, BindingDefinition<"crtr.profile.menu.manage">, BindingDefinition<"crtr.profile.search.up">, BindingDefinition<"crtr.profile.search.down">, BindingDefinition<"crtr.profile.search.pick">, BindingDefinition<"crtr.profile.search.back">, BindingDefinition<"crtr.profile.search.delete">, BindingDefinition<"crtr.profile.search.abort">, BindingDefinition<"crtr.setup.cancel">, BindingDefinition<"crtr.setup.tab-next">, BindingDefinition<"crtr.setup.tab-previous">, BindingDefinition<"crtr.setup.open">, BindingDefinition<"crtr.setup.list-down">, BindingDefinition<"crtr.setup.list-up">, BindingDefinition<"crtr.setup.toggle">, BindingDefinition<"crtr.setup.details">, BindingDefinition<"crtr.setup.advance">, BindingDefinition<"crtr.setup.confirm.accept">, BindingDefinition<"crtr.setup.confirm.back">, BindingDefinition<"crtr.setup.keybindings.edit">, BindingDefinition<"crtr.setup.keybindings.commit-edit">, BindingDefinition<"crtr.setup.keybindings.cancel-edit">, BindingDefinition<"crtr.setup.keybindings.unbind">, BindingDefinition<"crtr.setup.keybindings.reset-row">, BindingDefinition<"crtr.setup.keybindings.reset-all">, BindingDefinition<"crtr.setup.keybindings.save">, BindingDefinition<"crtr.setup.keybindings.discard">, BindingDefinition<"crtr.setup.keybindings.page-up">, BindingDefinition<"crtr.setup.keybindings.page-down">, BindingDefinition<"crtr.setup.keybindings.filter">, BindingDefinition<"crtr.setup.keybindings.filter-delete">, BindingDefinition<"crtr.setup.keybindings.filter-clear">, BindingDefinition<"crtr.setup.cell-previous">, BindingDefinition<"crtr.setup.cell-next">, BindingDefinition<"crtr.setup.models.open">, BindingDefinition<"crtr.setup.models.scope-next">, BindingDefinition<"crtr.setup.models.commit">, BindingDefinition<"crtr.setup.models.cancel">];
12
+ export type BindingId = `crtr.tmux.menu.${TmuxMenuAction}` | `crtr.tmux.menu.issue.${'idea' | 'bug'}` | AttachMenuBindingId | `crtr.tmux.menu-global.${TmuxMenuEntryAction}` | `crtr.tmux.node.${'next' | 'previous'}` | 'crtr.tmux.inbox.toggle' | `crtr.attach.scroll.${'up' | 'down' | 'page-up' | 'page-down' | 'live'}` | 'crtr.attach.mouse.toggle' | 'crtr.attach.copy.message' | 'crtr.attach.verbosity.less' | 'crtr.attach.help.toggle' | `crtr.attach.search.${'next' | 'previous' | 'edit' | 'close'}` | AttachBindingId | `crtr.graph.${GraphAction}` | `crtr.graph.confirm.${'accept' | 'cancel'}` | `crtr.inspector.${'force-quit' | 'down' | 'up' | 'section-next' | 'section-prev' | 'page-down' | 'page-up' | 'toggle-detail' | 'cancel-item' | 'open-log' | 'confirm' | 'dismiss' | 'retarget' | 'refresh' | 'quit'}` | `crtr.browse.${BrowseAction}` | `crtr.browse.search.${'cancel' | 'commit' | 'delete' | 'quit'}` | `crtr.dashboard.${DashboardAction}` | `crtr.profile.menu.${ProfileMenuAction}` | `crtr.profile.search.${'up' | 'down' | 'pick' | 'back' | 'delete' | 'abort'}` | `crtr.setup.${SetupAction}` | `crtr.setup.confirm.${'accept' | 'back'}` | `crtr.setup.keybindings.${SetupKeybindingAction}` | `crtr.setup.models.${SetupModelsAction}`;
13
+ export declare const BINDING_CATALOG: readonly [BindingDefinition<"crtr.tmux.menu.open">, BindingDefinition<"crtr.tmux.menu.attach">, ...(BindingDefinition<BindingId> | BindingDefinition<"crtr.tmux.node.next"> | BindingDefinition<"crtr.tmux.node.previous"> | BindingDefinition<"crtr.tmux.inbox.toggle"> | BindingDefinition<"crtr.attach.scroll.up"> | BindingDefinition<"crtr.attach.scroll.down"> | BindingDefinition<"crtr.attach.scroll.page-up"> | BindingDefinition<"crtr.attach.scroll.page-down"> | BindingDefinition<"crtr.attach.scroll.live"> | BindingDefinition<"crtr.attach.mouse.toggle"> | BindingDefinition<"crtr.attach.copy.message"> | BindingDefinition<"crtr.attach.verbosity.less"> | BindingDefinition<"crtr.attach.search.next"> | BindingDefinition<"crtr.attach.search.previous"> | BindingDefinition<"crtr.attach.search.edit"> | BindingDefinition<"crtr.attach.search.close"> | BindingDefinition<"crtr.graph.down"> | BindingDefinition<"crtr.graph.up"> | BindingDefinition<"crtr.graph.first"> | BindingDefinition<"crtr.graph.last"> | BindingDefinition<"crtr.graph.collapse-or-manager"> | BindingDefinition<"crtr.graph.expand-or-child"> | BindingDefinition<"crtr.graph.focus"> | BindingDefinition<"crtr.graph.revive"> | BindingDefinition<"crtr.graph.focus-manager"> | BindingDefinition<"crtr.graph.close-subtree"> | BindingDefinition<"crtr.graph.dismiss"> | BindingDefinition<"crtr.graph.confirm.accept"> | BindingDefinition<"crtr.graph.confirm.cancel"> | BindingDefinition<"crtr.inspector.force-quit"> | BindingDefinition<"crtr.inspector.down"> | BindingDefinition<"crtr.inspector.up"> | BindingDefinition<"crtr.inspector.section-next"> | BindingDefinition<"crtr.inspector.section-prev"> | BindingDefinition<"crtr.inspector.page-down"> | BindingDefinition<"crtr.inspector.page-up"> | BindingDefinition<"crtr.inspector.toggle-detail"> | BindingDefinition<"crtr.inspector.cancel-item"> | BindingDefinition<"crtr.inspector.open-log"> | BindingDefinition<"crtr.inspector.confirm"> | BindingDefinition<"crtr.inspector.dismiss"> | BindingDefinition<"crtr.inspector.retarget"> | BindingDefinition<"crtr.inspector.refresh"> | BindingDefinition<"crtr.inspector.quit"> | BindingDefinition<"crtr.browse.quit"> | BindingDefinition<"crtr.browse.down"> | BindingDefinition<"crtr.browse.up"> | BindingDefinition<"crtr.browse.first"> | BindingDefinition<"crtr.browse.last"> | BindingDefinition<"crtr.browse.expand-or-child"> | BindingDefinition<"crtr.browse.collapse-or-parent"> | BindingDefinition<"crtr.browse.toggle-fold"> | BindingDefinition<"crtr.browse.tab-next"> | BindingDefinition<"crtr.browse.tab-previous"> | BindingDefinition<"crtr.browse.tab.1" | "crtr.browse.tab.2" | "crtr.browse.tab.3" | "crtr.browse.tab.4" | "crtr.browse.tab.5"> | BindingDefinition<"crtr.browse.close-subtree"> | BindingDefinition<"crtr.browse.confirm-close"> | BindingDefinition<"crtr.browse.sort"> | BindingDefinition<"crtr.browse.scope"> | BindingDefinition<"crtr.browse.profile"> | BindingDefinition<"crtr.browse.residents"> | BindingDefinition<"crtr.browse.preview"> | BindingDefinition<"crtr.browse.report"> | BindingDefinition<"crtr.browse.pin"> | BindingDefinition<"crtr.browse.search"> | BindingDefinition<"crtr.browse.revive-now"> | BindingDefinition<"crtr.browse.focus"> | BindingDefinition<"crtr.browse.focus-background"> | BindingDefinition<"crtr.browse.yank-id"> | BindingDefinition<"crtr.browse.search.cancel"> | BindingDefinition<"crtr.browse.search.commit"> | BindingDefinition<"crtr.browse.search.delete"> | BindingDefinition<"crtr.browse.search.quit"> | BindingDefinition<"crtr.dashboard.down"> | BindingDefinition<"crtr.dashboard.up"> | BindingDefinition<"crtr.dashboard.first"> | BindingDefinition<"crtr.dashboard.last"> | BindingDefinition<"crtr.dashboard.expand"> | BindingDefinition<"crtr.dashboard.collapse"> | BindingDefinition<"crtr.dashboard.open"> | BindingDefinition<"crtr.dashboard.pin"> | BindingDefinition<"crtr.dashboard.rename"> | BindingDefinition<"crtr.dashboard.close"> | BindingDefinition<"crtr.dashboard.confirm-close"> | BindingDefinition<"crtr.dashboard.cancel-close"> | BindingDefinition<"crtr.dashboard.profile"> | BindingDefinition<"crtr.dashboard.input"> | BindingDefinition<"crtr.dashboard.input-cancel"> | BindingDefinition<"crtr.dashboard.input-submit"> | BindingDefinition<"crtr.dashboard.directory-next"> | BindingDefinition<"crtr.dashboard.directory-previous"> | BindingDefinition<"crtr.dashboard.help"> | BindingDefinition<"crtr.profile.menu.up"> | BindingDefinition<"crtr.profile.menu.down"> | BindingDefinition<"crtr.profile.menu.select"> | BindingDefinition<"crtr.profile.menu.accept-default"> | BindingDefinition<"crtr.profile.menu.abort"> | BindingDefinition<"crtr.profile.menu.slot.1" | "crtr.profile.menu.slot.2" | "crtr.profile.menu.slot.3" | "crtr.profile.menu.slot.4" | "crtr.profile.menu.slot.5" | "crtr.profile.menu.slot.6" | "crtr.profile.menu.slot.7" | "crtr.profile.menu.slot.8" | "crtr.profile.menu.slot.9">)[], BindingDefinition<"crtr.profile.menu.create">, BindingDefinition<"crtr.profile.menu.search-existing">, BindingDefinition<"crtr.profile.menu.use-root">, BindingDefinition<"crtr.profile.menu.set-default">, BindingDefinition<"crtr.profile.menu.add-directory">, BindingDefinition<"crtr.profile.menu.unpin">, BindingDefinition<"crtr.profile.menu.manage">, BindingDefinition<"crtr.profile.search.up">, BindingDefinition<"crtr.profile.search.down">, BindingDefinition<"crtr.profile.search.pick">, BindingDefinition<"crtr.profile.search.back">, BindingDefinition<"crtr.profile.search.delete">, BindingDefinition<"crtr.profile.search.abort">, BindingDefinition<"crtr.setup.cancel">, BindingDefinition<"crtr.setup.tab-next">, BindingDefinition<"crtr.setup.tab-previous">, BindingDefinition<"crtr.setup.open">, BindingDefinition<"crtr.setup.list-down">, BindingDefinition<"crtr.setup.list-up">, BindingDefinition<"crtr.setup.toggle">, BindingDefinition<"crtr.setup.details">, BindingDefinition<"crtr.setup.advance">, BindingDefinition<"crtr.setup.confirm.accept">, BindingDefinition<"crtr.setup.confirm.back">, BindingDefinition<"crtr.setup.keybindings.edit">, BindingDefinition<"crtr.setup.keybindings.commit-edit">, BindingDefinition<"crtr.setup.keybindings.cancel-edit">, BindingDefinition<"crtr.setup.keybindings.unbind">, BindingDefinition<"crtr.setup.keybindings.reset-row">, BindingDefinition<"crtr.setup.keybindings.reset-all">, BindingDefinition<"crtr.setup.keybindings.save">, BindingDefinition<"crtr.setup.keybindings.discard">, BindingDefinition<"crtr.setup.keybindings.page-up">, BindingDefinition<"crtr.setup.keybindings.page-down">, BindingDefinition<"crtr.setup.keybindings.filter">, BindingDefinition<"crtr.setup.keybindings.filter-delete">, BindingDefinition<"crtr.setup.keybindings.filter-clear">, BindingDefinition<"crtr.setup.cell-previous">, BindingDefinition<"crtr.setup.cell-next">, BindingDefinition<"crtr.setup.models.open">, BindingDefinition<"crtr.setup.models.scope-next">, BindingDefinition<"crtr.setup.models.commit">, BindingDefinition<"crtr.setup.models.cancel">];
14
14
  export declare const BINDING_IDS: ReadonlySet<string>;
15
15
  /** True for an action whose direct gesture is handled inside an attach viewer.
16
16
  * Tmux menu selectors and root shortcuts are chrome, not pane input. */
@@ -1 +1 @@
1
- var g=Object.defineProperty;var a=(t,n)=>g(t,"name",{value:n,configurable:!0});function b(t,n,s,o,l,p,u,d,m){return Object.freeze({id:t,group:n,name:s,description:o,defaults:Object.freeze([...l]),inputKind:p,contexts:Object.freeze([...u]),...d===void 0?{}:{safety:d},...m===void 0?{}:{pair:Object.freeze({...m})}})}a(b,"binding");const e=b;function r(t,n,s,o,l,p=[]){const u=`crtr.tmux.menu.${t}`,d=`crtr.tmux.menu-global.${t}`;return[e(u,"Global tmux",n,s,o,"tmux-menu-selector",l,void 0,{field:"menu",pairedId:d}),e(d,"Global tmux",n,s,p,"tmux-global-action",["tmux.root"],void 0,{field:"global",pairedId:u})]}a(r,"menuEntry");function i(t,n,s,o,l,p){return[e(t,"Attach",s,o,l,"tmux-menu-selector",["tmux.menu.attach"],void 0,{field:"menu",pairedId:n}),e(n,"Attach",s,o,p,"host-global",c,void 0,{field:"direct",pairedId:t})]}a(i,"attachEntry");const c=["attach","graph","graph.confirm"],f=["setup.login","setup.list","setup.input","setup.keybindings","setup.keybindings.edit","setup.keybindings.filter","setup.models"],h=["setup.login","setup.list","setup.keybindings","setup.models"],w=Object.freeze([e("crtr.tmux.menu.open","Global tmux","Open crouter menu","Open the crouter action menu.",["alt+c"],"host-global",["tmux.root"]),e("crtr.tmux.menu.attach","Global tmux","Attach actions","Open the attach-viewer action submenu.",["a"],"tmux-menu-selector",["tmux.menu"]),...r("dashboard","Dashboard","Show the live root conversations in this pane: which need you, which are running, which are idle.",["w"],["tmux.menu"],["alt+shift+d"]),...r("promote","Promote to orchestrator","Promote the focused node to orchestrator \u2014 it holds a roadmap and delegates.",["o"],["tmux.menu"]),...r("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"]),...r("resume","Find node","Open the canvas navigator and go to the chosen node.",["/"],["tmux.menu"]),...r("fork","Fork node","Fork the focused node into an independent idle root.",["f"],["tmux.menu"]),...r("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"]),...r("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"]),...r("detach","Demote and close viewer","Demote the focused node and close its viewer; its broker keeps running off-screen.",["shift+d"],["tmux.menu"]),...r("close-subtree","Close subtree","Close the focused node and its subtree.",["x"],["tmux.menu"]),...r("background-bash","Background running bash","Hand the focused node\u2019s running bash command to its background job system.",["b"],["tmux.menu"]),...r("file-review","Review a file","Open a line-anchored review of a file named in the transcript.",["v"],["tmux.menu"]),...r("pin","Pin conversation","Pin or unpin this conversation in the canvas navigator.",["p"],["tmux.menu"]),...r("show","Inspect node","Open the focused node\u2019s inspection menu.",["i"],["tmux.menu"]),...r("view-settings","Display settings","Open the viewer display-settings menu.",["z"],["tmux.menu"]),...r("fold-tools","Fold finished tool calls","Fold every finished tool call in the transcript to its single call line.",["f"],["tmux.menu.view-settings"]),...r("show-working","Show working","With consolidated replies on, show or hide the messages and tool calls behind each reply.",["w"],["tmux.menu.view-settings"]),...r("metadata","Show metadata","Show the focused node\u2019s metadata dossier.",["m"],["tmux.menu.show"]),...r("context","Browse context","Browse the focused node context.",["c"],["tmux.menu.show"]),...r("providers","Open settings","Open the crouter settings panel.",[","],["tmux.menu"]),...r("provider-options","Provider options","Open provider options \u2014 how an authenticated provider serves your turns, including Codex fast mode.",["."],["tmux.menu"]),...r("plugins","Browse plugins","Open the crouter plugin browser.",["l"],["tmux.menu"]),...r("analytics","Analytics","Open the Analytics page: how agents worked in the last 24 hours or 7 days.",["shift+a"],["tmux.menu"]),...r("context-admin","Context surface","Open the context surface: which documents each event delivers, and the surfaces, gates, and caps that decide it.",["shift+c"],["tmux.menu"]),...r("graph","Canvas graph","Open the canvas graph.",["g"],["tmux.menu"]),...r("focus-manager","Go to manager","Focus this node\u2019s manager.",["h"],["tmux.menu"]),...r("copy-id","Copy node id","Copy the focused node id to the system clipboard.",["y"],["tmux.menu"]),...r("reload-viewer","Reload viewer","Respawn this pane\u2019s viewer onto the current runtime generation.",["r"],["tmux.menu"]),...r("recap","Generate recap","Generate the focused node\u2019s Goal and State recap and refresh its generated title.",["s"],["tmux.menu"]),...r("issues","Open create menu","Open the create submenu.",["c"],["tmux.menu"]),...r("issue.idea","Create idea","Create an idea issue.",["i"],["tmux.menu.issue"]),...r("issue.bug","Create bug","Create a bug issue.",["b"],["tmux.menu.issue"]),e("crtr.tmux.node.next","Global tmux","Next node","Focus the next canvas node.",["alt+]"],"host-global",["tmux.root"]),e("crtr.tmux.node.previous","Global tmux","Previous node","Focus the previous canvas node.",["alt+["],"host-global",["tmux.root"]),e("crtr.tmux.inbox.toggle","Global tmux","Toggle inbox","Open or close the human inbox in the focused viewer.",["alt+i"],"host-global",["tmux.root"]),...i("crtr.tmux.menu.attach.detach","crtr.attach.detach","Detach","Detach from the node.",["d"],["ctrl+d"]),...i("crtr.tmux.menu.attach.clear-or-detach","crtr.attach.clear-or-detach","Clear input (cancel agent on repeat)","Clear the input; press again within a second to cancel the running agent turn. Detach lives on its own binding.",["c"],["ctrl+c"]),...i("crtr.tmux.menu.attach.graph.toggle","crtr.attach.graph.toggle","Toggle graph","Open or close the graph overlay.",["g"],["alt+g"]),...i("crtr.tmux.menu.attach.help.toggle","crtr.attach.help.toggle","Help","Open the attach help overlay.",["?"],["alt+shift+k"]),...i("crtr.tmux.menu.attach.inbox.toggle","crtr.attach.inbox.toggle","Toggle inbox","Open or close the human inbox surface in this viewer.",["i"],[]),...i("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"]),...i("crtr.tmux.menu.attach.model-ladder.next","crtr.attach.model-ladder.next","Next model","Move to the next model ladder rung.",["]"],["alt+m"]),...i("crtr.tmux.menu.attach.model-ladder.previous","crtr.attach.model-ladder.previous","Previous model","Move to the previous model ladder rung.",["["],["alt+shift+m"]),...i("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"]),...i("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"]),...i("crtr.tmux.menu.attach.profile-files","crtr.attach.profile-files","Search profile files","Fuzzy-match path segments across the node family\u2019s working directories, their context directories (files), profile projects and the profile\u2019s own directory; Ctrl+Y copies a selected path.",["f"],["ctrl+f"]),...i("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+/"]),...i("crtr.tmux.menu.attach.whip","crtr.attach.whip","Whip agent","Interrupt the agent and send a playful command.",["w"],[]),e("crtr.attach.scroll.up","Attach","Scroll up","Scroll the transcript one line up.",["shift+up"],"terminal",c),e("crtr.attach.scroll.down","Attach","Scroll down","Scroll the transcript one line down.",["shift+down"],"terminal",c),e("crtr.attach.scroll.page-up","Attach","Scroll page up","Scroll the transcript one page up.",["pageup"],"terminal",c),e("crtr.attach.scroll.page-down","Attach","Scroll page down","Scroll the transcript one page down.",["pagedown"],"terminal",c),e("crtr.attach.scroll.live","Attach","Return to live","Return the transcript to the live bottom.",["shift+end"],"terminal",c),e("crtr.attach.mouse.toggle","Attach","Toggle mouse wheel scrolling","Toggle mouse wheel scrolling on or off.",["alt+shift+o"],"terminal",c),e("crtr.attach.copy.message","Attach","Copy visible message","Copy the newest message visible in the transcript viewport.",["alt+shift+y"],"terminal",c),e("crtr.attach.search.next","Attach","Next match","Move to the next transcript search match.",["n"],"terminal",["attach.search"]),e("crtr.attach.search.previous","Attach","Previous match","Move to the previous transcript search match.",["shift+n"],"terminal",["attach.search"]),e("crtr.attach.search.edit","Attach","Edit query","Return to editing the transcript search query.",["/"],"terminal",["attach.search"]),e("crtr.attach.search.close","Attach","Close search","Leave transcript search and clear its highlights.",["escape"],"terminal",["attach.search"],"dismiss-modal"),e("crtr.graph.down","GRAPH","Move down","Move to the next graph row.",["j","down"],"terminal",["graph"]),e("crtr.graph.up","GRAPH","Move up","Move to the previous graph row.",["k","up"],"terminal",["graph"]),e("crtr.graph.first","GRAPH","First row","Move to the first graph row.",["g"],"terminal",["graph"]),e("crtr.graph.last","GRAPH","Last row","Move to the last graph row.",["shift+g"],"terminal",["graph"]),e("crtr.graph.collapse-or-manager","GRAPH","Collapse or manager","Collapse a node or move to its manager.",["h","left"],"terminal",["graph"]),e("crtr.graph.expand-or-child","GRAPH","Expand or child","Expand a node or move to its child.",["l","right"],"terminal",["graph"]),e("crtr.graph.focus","GRAPH","Focus node","Focus the selected node.",["enter"],"terminal",["graph"]),e("crtr.graph.revive","GRAPH","Revive node","Revive and open the selected dormant node.",["r"],"terminal",["graph"]),e("crtr.graph.focus-manager","GRAPH","Focus manager","Focus the selected node manager.",["m"],"terminal",["graph"]),e("crtr.graph.close-subtree","GRAPH","Close subtree","Ask to close the selected subtree.",["x"],"terminal",["graph"]),e("crtr.graph.dismiss","GRAPH","Dismiss graph","Close the graph overlay.",["escape"],"terminal",["graph"],"dismiss-modal"),e("crtr.graph.confirm.accept","GRAPH","Confirm close","Confirm closing the selected subtree.",["y"],"terminal",["graph.confirm"]),e("crtr.graph.confirm.cancel","GRAPH","Cancel close","Cancel closing the selected subtree.",["n","escape"],"terminal",["graph.confirm"],"dismiss-modal"),e("crtr.inspector.force-quit","Inspector","Force quit Inspector","Immediately leave the Inspector.",["ctrl+c"],"host-global",["inspector"],"leave-screen"),e("crtr.inspector.down","Inspector","Move down","Move the Inspector selection or scroll cursor down.",["j","down"],"terminal",["inspector"]),e("crtr.inspector.up","Inspector","Move up","Move the Inspector selection or scroll cursor up.",["k","up"],"terminal",["inspector"]),e("crtr.inspector.section-next","Inspector","Next section","Move to the next Inspector section.",["tab"],"terminal",["inspector"]),e("crtr.inspector.section-prev","Inspector","Previous section","Move to the previous Inspector section.",["shift+tab"],"terminal",["inspector"]),e("crtr.inspector.page-down","Inspector","Page down","Scroll the Inspector detail body down.",["ctrl+d","pagedown"],"terminal",["inspector"]),e("crtr.inspector.page-up","Inspector","Page up","Scroll the Inspector detail body up.",["ctrl+u","pageup"],"terminal",["inspector"]),e("crtr.inspector.toggle-detail","Inspector","Toggle item detail","Expand or collapse the selected cron or background job.",["enter"],"terminal",["inspector"]),e("crtr.inspector.cancel-item","Inspector","Cancel selected item","Arm cancellation for the selected cron, or stopping for the selected background job.",["x"],"terminal",["inspector"]),e("crtr.inspector.open-log","Inspector","Open job log","Follow the selected background job\u2019s log in a new tmux window.",["o"],"terminal",["inspector"]),e("crtr.inspector.confirm","Inspector","Confirm action","Confirm the armed Inspector action.",["y"],"terminal",["inspector"]),e("crtr.inspector.dismiss","Inspector","Dismiss action","Dismiss an Inspector confirmation or banner.",["escape"],"terminal",["inspector"],"dismiss-modal"),e("crtr.inspector.retarget","Inspector","Retarget","Inspect the selected cron anchor or creator node.",["t"],"terminal",["inspector"]),e("crtr.inspector.refresh","Inspector","Refresh","Refresh the Inspector now.",["g","r"],"terminal",["inspector"]),e("crtr.inspector.quit","Inspector","Quit","Leave the Inspector.",["q"],"terminal",["inspector"],"leave-screen"),...v(),...x(),...k(),...y()]);function v(){const t="browse";return[e("crtr.browse.quit","Browse and pickers","Quit browse","Leave canvas browse.",["q","escape","ctrl+c"],"terminal",[t],"leave-screen"),e("crtr.browse.down","Browse and pickers","Move down","Move to the next row.",["j","down"],"terminal",[t]),e("crtr.browse.up","Browse and pickers","Move up","Move to the previous row.",["k","up"],"terminal",[t]),e("crtr.browse.first","Browse and pickers","First row","Move to the first row.",["g"],"terminal",[t]),e("crtr.browse.last","Browse and pickers","Last row","Move to the last row.",["shift+g"],"terminal",[t]),e("crtr.browse.expand-or-child","Browse and pickers","Expand or child","Expand a row or move to its child.",["l","right"],"terminal",[t]),e("crtr.browse.collapse-or-parent","Browse and pickers","Collapse or parent","Collapse a row or move to its parent.",["h","left"],"terminal",[t]),e("crtr.browse.toggle-fold","Browse and pickers","Toggle fold","Toggle the selected fold.",["space"],"terminal",[t]),e("crtr.browse.tab-next","Browse and pickers","Next tab","Select the next browse tab.",["tab","]"],"terminal",[t]),e("crtr.browse.tab-previous","Browse and pickers","Previous tab","Select the previous browse tab.",["shift+tab","["],"terminal",[t]),...[1,2,3,4,5].map(n=>e(`crtr.browse.tab.${n}`,"Browse and pickers",`Tab ${n}`,`Select browse tab ${n}.`,[`${n}`],"terminal",[t])),e("crtr.browse.close-subtree","Browse and pickers","Close subtree","Ask to close the selected subtree.",["x"],"terminal",[t]),e("crtr.browse.confirm-close","Browse and pickers","Confirm close","Confirm closing the selected subtree.",["y"],"terminal",["browse.confirm"]),e("crtr.browse.sort","Browse and pickers","Change sort","Change the browse sort.",["s"],"terminal",[t]),e("crtr.browse.scope","Browse and pickers","Change scope","Toggle the browse cwd scope.",["c"],"terminal",[t]),e("crtr.browse.profile","Browse and pickers","Toggle profile","Toggle the browse profile scope.",["shift+p"],"terminal",[t]),e("crtr.browse.residents","Browse and pickers","Toggle residents","Toggle resident display.",["r"],"terminal",[t]),e("crtr.browse.preview","Browse and pickers","Toggle preview","Toggle the preview panel.",["v"],"terminal",[t]),e("crtr.browse.report","Browse and pickers","Toggle report","Swap the preview panel between the conversation and the node's newest report.",["shift+v"],"terminal",[t]),e("crtr.browse.pin","Browse and pickers","Pin node","Star or unstar the selected node.",["p"],"terminal",[t]),e("crtr.browse.search","Browse and pickers","Search","Open browse search.",["/"],"terminal",[t]),e("crtr.browse.revive-now","Browse and pickers","Revive now","Revive the selected node now.",["shift+k"],"terminal",[t]),e("crtr.browse.focus","Browse and pickers","Focus node","Focus the selected node.",["enter","o"],"terminal",[t]),e("crtr.browse.focus-background","Browse and pickers","Focus node (keep browsing)","Focus the selected node without leaving the navigator.",["shift+o"],"terminal",[t]),e("crtr.browse.yank-id","Browse and pickers","Yank node id","Copy the selected node id to the system clipboard.",["y"],"terminal",[t]),e("crtr.browse.search.cancel","Browse and pickers","Cancel search","Cancel browse search.",["escape"],"terminal",["browse.search"],"dismiss-modal"),e("crtr.browse.search.commit","Browse and pickers","Commit search","Apply browse search.",["enter"],"terminal",["browse.search"]),e("crtr.browse.search.delete","Browse and pickers","Delete search text","Delete the previous search character.",["backspace"],"terminal",["browse.search"]),e("crtr.browse.search.quit","Browse and pickers","Quit browse","Leave canvas browse from search.",["ctrl+c"],"terminal",["browse.search"],"leave-screen")]}a(v,"browseBindings");function x(){const t="dashboard",n="dashboard.confirm",s="dashboard.input",o="Dashboard";return[e("crtr.dashboard.down",o,"Move down","Move to the next row.",["j","down"],"terminal",[t]),e("crtr.dashboard.up",o,"Move up","Move to the previous row.",["k","up"],"terminal",[t]),e("crtr.dashboard.first",o,"First row","Move to the first row.",["g"],"terminal",[t]),e("crtr.dashboard.last",o,"Last row","Move to the last row.",["shift+g"],"terminal",[t]),e("crtr.dashboard.expand",o,"Expand","Show the selected conversation\u2019s children.",["l","right"],"terminal",[t]),e("crtr.dashboard.collapse",o,"Collapse","Hide the selected conversation\u2019s children.",["h","left"],"terminal",[t]),e("crtr.dashboard.open",o,"Open","Open the selected conversation in this pane.",["enter"],"terminal",[t]),e("crtr.dashboard.pin",o,"Pin","Star or unstar the selected conversation.",["p"],"terminal",[t]),e("crtr.dashboard.rename",o,"Rename","Rename the selected conversation.",["shift+r"],"terminal",[t]),e("crtr.dashboard.close",o,"Close","Finish the selected conversation and remove its row.",["x"],"terminal",[t]),e("crtr.dashboard.confirm-close",o,"Confirm close","Close a conversation that is running.",["y"],"terminal",[n]),e("crtr.dashboard.cancel-close",o,"Cancel close","Keep the running conversation.",["n","escape"],"terminal",[n]),e("crtr.dashboard.profile",o,"Toggle profile","Switch between this profile and all profiles.",["shift+p"],"terminal",[t]),e("crtr.dashboard.input",o,"New conversation","Focus the new-conversation input.",["n"],"terminal",[t]),e("crtr.dashboard.input-cancel",o,"Leave input","Leave the input without clearing it.",["escape"],"terminal",[s]),e("crtr.dashboard.input-submit",o,"Start conversation","Start a root conversation from the input text.",["enter"],"terminal",[s]),e("crtr.dashboard.directory-next",o,"Next directory","Select the next directory for the new conversation.",["tab"],"terminal",[s]),e("crtr.dashboard.directory-previous",o,"Previous directory","Select the previous directory for the new conversation.",["shift+tab"],"terminal",[s]),e("crtr.dashboard.help",o,"Help","Show the dashboard keys.",["?"],"terminal",[t])]}a(x,"dashboardBindings");function k(){const t="profile.menu",n="profile.search";return[e("crtr.profile.menu.up","Profiles","Move up","Move to the previous profile.",["k","up"],"terminal",[t]),e("crtr.profile.menu.down","Profiles","Move down","Move to the next profile.",["j","down"],"terminal",[t]),e("crtr.profile.menu.select","Profiles","Select profile","Select the highlighted profile.",["enter"],"terminal",[t]),e("crtr.profile.menu.accept-default","Profiles","Accept default","Accept the default profile.",["escape"],"terminal",[t],"leave-screen"),e("crtr.profile.menu.abort","Profiles","Abort","Leave profile selection.",["ctrl+c"],"terminal",[t],"leave-screen"),...[1,2,3,4,5,6,7,8,9].map(s=>e(`crtr.profile.menu.slot.${s}`,"Profiles",`Profile slot ${s}`,`Select profile slot ${s}.`,[`${s}`],"terminal",[t])),e("crtr.profile.menu.create","Profiles","Create profile","Create a profile.",["c"],"terminal",[t]),e("crtr.profile.menu.search-existing","Profiles","Search profiles","Search existing profiles.",["s"],"terminal",[t]),e("crtr.profile.menu.use-root","Profiles","Use root profile","Use the root profile.",["r"],"terminal",[t]),e("crtr.profile.menu.set-default","Profiles","Set default","Set the selected profile as default.",["d"],"terminal",[t]),e("crtr.profile.menu.add-directory","Profiles","Add directory","Add a directory to the profile.",["a"],"terminal",[t]),e("crtr.profile.menu.unpin","Profiles","Unpin directory","Unpin the selected directory.",["u"],"terminal",[t]),e("crtr.profile.menu.manage","Profiles","Manage profiles","Open the profiles settings page in a popup.",["v"],"terminal",[t]),e("crtr.profile.search.up","Profiles","Move up","Move to the previous search result.",["up","ctrl+p"],"terminal",[n]),e("crtr.profile.search.down","Profiles","Move down","Move to the next search result.",["down","ctrl+n"],"terminal",[n]),e("crtr.profile.search.pick","Profiles","Pick profile","Pick the highlighted profile.",["enter"],"terminal",[n]),e("crtr.profile.search.back","Profiles","Back","Return to profile selection.",["escape"],"terminal",[n],"leave-screen"),e("crtr.profile.search.delete","Profiles","Delete filter text","Delete the previous filter character.",["backspace"],"terminal",[n]),e("crtr.profile.search.abort","Profiles","Abort","Leave profile search.",["ctrl+c"],"terminal",[n],"leave-screen")]}a(k,"profileBindings");function y(){return[e("crtr.setup.cancel","Setup","Cancel setup","Leave the setup wizard.",["q","ctrl+c","ctrl+d"],"terminal",f,"leave-screen"),e("crtr.setup.tab-next","Setup","Next tab","Select the next setup tab.",["tab","right"],"terminal",h),e("crtr.setup.tab-previous","Setup","Previous tab","Select the previous setup tab.",["shift+tab","left"],"terminal",h),e("crtr.setup.open","Setup","Open","Open the selected setup item.",["enter"],"terminal",["setup.login"]),e("crtr.setup.list-down","Setup","Move down","Move to the next setup item.",["j","down"],"terminal",["setup.list","setup.models","setup.models.dimension-picker","setup.models.route-form"]),e("crtr.setup.list-up","Setup","Move up","Move to the previous setup item.",["k","up"],"terminal",["setup.list","setup.models","setup.models.dimension-picker","setup.models.route-form"]),e("crtr.setup.toggle","Setup","Toggle","Toggle the selected setup item.",["space"],"terminal",["setup.list","setup.keybindings"]),e("crtr.setup.details","Setup","Show details","Show details for the selected item.",["?"],"terminal",["setup.list"]),e("crtr.setup.advance","Setup","Advance","Advance the setup flow.",["enter"],"terminal",["setup.list"]),e("crtr.setup.confirm.accept","Setup","Confirm","Accept the setup confirmation.",["y","enter"],"terminal",["setup.confirm","setup.models.confirm"]),e("crtr.setup.confirm.back","Setup","Go back","Cancel the setup confirmation.",["n","escape","q"],"terminal",["setup.confirm","setup.models.confirm"],"dismiss-modal"),e("crtr.setup.keybindings.edit","Setup","Edit binding","Edit the selected binding.",["enter"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.commit-edit","Setup","Commit edit","Commit the active binding edit.",["enter"],"terminal",["setup.keybindings.edit"]),e("crtr.setup.keybindings.cancel-edit","Setup","Cancel edit","Cancel the active binding edit.",["escape"],"terminal",["setup.keybindings.edit"],"dismiss-modal"),e("crtr.setup.keybindings.unbind","Setup","Unbind","Disable the selected binding.",["delete"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.reset-row","Setup","Reset binding","Reset the selected binding.",["r"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.reset-all","Setup","Reset all bindings","Reset all bindings to defaults.",["shift+r"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.save","Setup","Save bindings","Save keybinding changes.",["s"],"terminal",["setup.keybindings"],"save-keybindings"),e("crtr.setup.keybindings.discard","Setup","Discard changes","Discard keybinding changes.",["escape"],"terminal",["setup.keybindings"],"leave-screen"),e("crtr.setup.keybindings.page-up","Setup","Page up","Move up one keybinding page.",["pageup"],"terminal",["setup.keybindings","setup.keybindings.edit"]),e("crtr.setup.keybindings.page-down","Setup","Page down","Move down one keybinding page.",["pagedown"],"terminal",["setup.keybindings","setup.keybindings.edit"]),e("crtr.setup.keybindings.filter","Setup","Filter bindings","Open the keybinding filter.",["/"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.filter-delete","Setup","Delete filter text","Delete the previous filter character.",["backspace"],"terminal",["setup.keybindings.filter"]),e("crtr.setup.keybindings.filter-clear","Setup","Clear filter","Clear the keybinding filter.",["escape"],"terminal",["setup.keybindings.filter"],"dismiss-modal"),e("crtr.setup.cell-previous","Setup","Previous field","Select the previous field or setup table cell.",["h"],"terminal",["setup.models","setup.keybindings"]),e("crtr.setup.cell-next","Setup","Next field","Select the next field or setup table cell.",["l"],"terminal",["setup.models","setup.keybindings"]),e("crtr.setup.models.open","Setup","Edit model","Edit the selected model cell or route field.",["enter"],"terminal",["setup.models","setup.models.route-form"]),e("crtr.setup.models.scope-next","Setup","Next model config scope","Edit the next applicable user, profile, or project config.",["s"],"terminal",["setup.models"]),e("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"]),e("crtr.setup.models.cancel","Setup","Cancel pick","Cancel the model picker or route form.",["escape"],"terminal",["setup.models.picker","setup.models.dimension-picker","setup.models.route-form"],"dismiss-modal")]}a(y,"setupBindings");const C=new Set(w.map(t=>t.id));function P(t){return t.contexts.includes("attach")&&(t.inputKind==="terminal"||t.inputKind==="host-global")}a(P,"isAttachPaneBinding");const A=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"},{context:"setup.models.route-form",capability:"dismiss-modal"},{context:"setup.models.confirm",capability:"dismiss-modal"}]);export{w as BINDING_CATALOG,C as BINDING_IDS,A as SAFETY_REQUIREMENTS,P as isAttachPaneBinding};
1
+ var g=Object.defineProperty;var a=(t,n)=>g(t,"name",{value:n,configurable:!0});function b(t,n,s,o,l,p,u,d,m){return Object.freeze({id:t,group:n,name:s,description:o,defaults:Object.freeze([...l]),inputKind:p,contexts:Object.freeze([...u]),...d===void 0?{}:{safety:d},...m===void 0?{}:{pair:Object.freeze({...m})}})}a(b,"binding");const e=b;function r(t,n,s,o,l,p=[]){const u=`crtr.tmux.menu.${t}`,d=`crtr.tmux.menu-global.${t}`;return[e(u,"Global tmux",n,s,o,"tmux-menu-selector",l,void 0,{field:"menu",pairedId:d}),e(d,"Global tmux",n,s,p,"tmux-global-action",["tmux.root"],void 0,{field:"global",pairedId:u})]}a(r,"menuEntry");function i(t,n,s,o,l,p){return[e(t,"Attach",s,o,l,"tmux-menu-selector",["tmux.menu.attach"],void 0,{field:"menu",pairedId:n}),e(n,"Attach",s,o,p,"host-global",c,void 0,{field:"direct",pairedId:t})]}a(i,"attachEntry");const c=["attach","graph","graph.confirm"],f=["setup.login","setup.list","setup.input","setup.keybindings","setup.keybindings.edit","setup.keybindings.filter","setup.models"],h=["setup.login","setup.list","setup.keybindings","setup.models"],w=Object.freeze([e("crtr.tmux.menu.open","Global tmux","Open crouter menu","Open the crouter action menu.",["alt+c"],"host-global",["tmux.root"]),e("crtr.tmux.menu.attach","Global tmux","Attach actions","Open the attach-viewer action submenu.",["a"],"tmux-menu-selector",["tmux.menu"]),...r("dashboard","Dashboard","Show the live root conversations in this pane: which need you, which are running, which are idle.",["w"],["tmux.menu"],["alt+shift+d"]),...r("promote","Promote to orchestrator","Promote the focused node to orchestrator \u2014 it holds a roadmap and delegates.",["o"],["tmux.menu"]),...r("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"]),...r("resume","Find node","Open the canvas navigator and go to the chosen node.",["/"],["tmux.menu"]),...r("fork","Fork node","Fork the focused node into an independent idle root.",["f"],["tmux.menu"]),...r("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"]),...r("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"]),...r("detach","Demote and close viewer","Demote the focused node and close its viewer; its broker keeps running off-screen.",["shift+d"],["tmux.menu"]),...r("close-subtree","Close subtree","Close the focused node and its subtree.",["x"],["tmux.menu"]),...r("background-bash","Background running bash","Hand the focused node\u2019s running bash command to its background job system.",["b"],["tmux.menu"]),...r("file-review","Review a file","Open a line-anchored review of a file named in the transcript.",["v"],["tmux.menu"]),...r("pin","Pin conversation","Pin or unpin this conversation in the canvas navigator.",["p"],["tmux.menu"]),...r("show","Inspect node","Open the focused node\u2019s inspection menu.",["i"],["tmux.menu"]),...r("view-settings","Display settings","Open the viewer display-settings menu.",["z"],["tmux.menu"]),...r("more-detail","More detail","Show the transcript one verbosity level more open, in this viewer only (same as Ctrl+O).",["m"],["tmux.menu.view-settings"]),...r("less-detail","Less detail","Show the transcript one verbosity level more collapsed, in this viewer only.",["l"],["tmux.menu.view-settings"]),...r("metadata","Show metadata","Show the focused node\u2019s metadata dossier.",["m"],["tmux.menu.show"]),...r("context","Browse context","Browse the focused node context.",["c"],["tmux.menu.show"]),...r("providers","Open settings","Open the crouter settings panel.",[","],["tmux.menu"]),...r("provider-options","Provider options","Open provider options \u2014 how an authenticated provider serves your turns, including Codex fast mode.",["."],["tmux.menu"]),...r("plugins","Browse plugins","Open the crouter plugin browser.",["l"],["tmux.menu"]),...r("analytics","Analytics","Open the Analytics page: how agents worked in the last 24 hours or 7 days.",["shift+a"],["tmux.menu"]),...r("context-admin","Context surface","Open the context surface: which documents each event delivers, and the surfaces, gates, and caps that decide it.",["shift+c"],["tmux.menu"]),...r("graph","Canvas graph","Open the canvas graph.",["g"],["tmux.menu"]),...r("focus-manager","Go to manager","Focus this node\u2019s manager.",["h"],["tmux.menu"]),...r("copy-id","Copy node id","Copy the focused node id to the system clipboard.",["y"],["tmux.menu"]),...r("reload-viewer","Reload viewer","Respawn this pane\u2019s viewer onto the current runtime generation.",["r"],["tmux.menu"]),...r("recap","Generate recap","Generate the focused node\u2019s Goal and State recap and refresh its generated title.",["s"],["tmux.menu"]),...r("issues","Open create menu","Open the create submenu.",["c"],["tmux.menu"]),...r("issue.idea","Create idea","Create an idea issue.",["i"],["tmux.menu.issue"]),...r("issue.bug","Create bug","Create a bug issue.",["b"],["tmux.menu.issue"]),e("crtr.tmux.node.next","Global tmux","Next node","Focus the next canvas node.",["alt+]"],"host-global",["tmux.root"]),e("crtr.tmux.node.previous","Global tmux","Previous node","Focus the previous canvas node.",["alt+["],"host-global",["tmux.root"]),e("crtr.tmux.inbox.toggle","Global tmux","Toggle inbox","Open or close the human inbox in the focused viewer.",["alt+i"],"host-global",["tmux.root"]),...i("crtr.tmux.menu.attach.detach","crtr.attach.detach","Detach","Detach from the node.",["d"],["ctrl+d"]),...i("crtr.tmux.menu.attach.clear-or-detach","crtr.attach.clear-or-detach","Clear input (cancel agent on repeat)","Clear the input; press again within a second to cancel the running agent turn. Detach lives on its own binding.",["c"],["ctrl+c"]),...i("crtr.tmux.menu.attach.graph.toggle","crtr.attach.graph.toggle","Toggle graph","Open or close the graph overlay.",["g"],["alt+g"]),...i("crtr.tmux.menu.attach.help.toggle","crtr.attach.help.toggle","Help","Open the attach help overlay.",["?"],["alt+shift+k"]),...i("crtr.tmux.menu.attach.inbox.toggle","crtr.attach.inbox.toggle","Toggle inbox","Open or close the human inbox surface in this viewer.",["i"],[]),...i("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"]),...i("crtr.tmux.menu.attach.model-ladder.next","crtr.attach.model-ladder.next","Next model","Move to the next model ladder rung.",["]"],["alt+m"]),...i("crtr.tmux.menu.attach.model-ladder.previous","crtr.attach.model-ladder.previous","Previous model","Move to the previous model ladder rung.",["["],["alt+shift+m"]),...i("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"]),...i("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"]),...i("crtr.tmux.menu.attach.profile-files","crtr.attach.profile-files","Search profile files","Fuzzy-match path segments across the node family\u2019s working directories, their context directories (files), profile projects and the profile\u2019s own directory; Ctrl+Y copies a selected path.",["f"],["ctrl+f"]),...i("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+/"]),...i("crtr.tmux.menu.attach.whip","crtr.attach.whip","Whip agent","Interrupt the agent and send a playful command.",["w"],[]),e("crtr.attach.scroll.up","Attach","Scroll up","Scroll the transcript one line up.",["shift+up"],"terminal",c),e("crtr.attach.scroll.down","Attach","Scroll down","Scroll the transcript one line down.",["shift+down"],"terminal",c),e("crtr.attach.scroll.page-up","Attach","Scroll page up","Scroll the transcript one page up.",["pageup"],"terminal",c),e("crtr.attach.scroll.page-down","Attach","Scroll page down","Scroll the transcript one page down.",["pagedown"],"terminal",c),e("crtr.attach.scroll.live","Attach","Return to live","Return the transcript to the live bottom.",["shift+end"],"terminal",c),e("crtr.attach.mouse.toggle","Attach","Toggle mouse wheel scrolling","Toggle mouse wheel scrolling on or off.",["alt+shift+o"],"terminal",c),e("crtr.attach.copy.message","Attach","Copy visible message","Copy the newest message visible in the transcript viewport.",["alt+shift+y"],"terminal",c),e("crtr.attach.verbosity.less","Attach","Less detail","Show the transcript one verbosity level more collapsed, in this viewer only; Ctrl+O shows more.",["ctrl+shift+o"],"terminal",c),e("crtr.attach.search.next","Attach","Next match","Move to the next transcript search match.",["n"],"terminal",["attach.search"]),e("crtr.attach.search.previous","Attach","Previous match","Move to the previous transcript search match.",["shift+n"],"terminal",["attach.search"]),e("crtr.attach.search.edit","Attach","Edit query","Return to editing the transcript search query.",["/"],"terminal",["attach.search"]),e("crtr.attach.search.close","Attach","Close search","Leave transcript search and clear its highlights.",["escape"],"terminal",["attach.search"],"dismiss-modal"),e("crtr.graph.down","GRAPH","Move down","Move to the next graph row.",["j","down"],"terminal",["graph"]),e("crtr.graph.up","GRAPH","Move up","Move to the previous graph row.",["k","up"],"terminal",["graph"]),e("crtr.graph.first","GRAPH","First row","Move to the first graph row.",["g"],"terminal",["graph"]),e("crtr.graph.last","GRAPH","Last row","Move to the last graph row.",["shift+g"],"terminal",["graph"]),e("crtr.graph.collapse-or-manager","GRAPH","Collapse or manager","Collapse a node or move to its manager.",["h","left"],"terminal",["graph"]),e("crtr.graph.expand-or-child","GRAPH","Expand or child","Expand a node or move to its child.",["l","right"],"terminal",["graph"]),e("crtr.graph.focus","GRAPH","Focus node","Focus the selected node.",["enter"],"terminal",["graph"]),e("crtr.graph.revive","GRAPH","Revive node","Revive and open the selected dormant node.",["r"],"terminal",["graph"]),e("crtr.graph.focus-manager","GRAPH","Focus manager","Focus the selected node manager.",["m"],"terminal",["graph"]),e("crtr.graph.close-subtree","GRAPH","Close subtree","Ask to close the selected subtree.",["x"],"terminal",["graph"]),e("crtr.graph.dismiss","GRAPH","Dismiss graph","Close the graph overlay.",["escape"],"terminal",["graph"],"dismiss-modal"),e("crtr.graph.confirm.accept","GRAPH","Confirm close","Confirm closing the selected subtree.",["y"],"terminal",["graph.confirm"]),e("crtr.graph.confirm.cancel","GRAPH","Cancel close","Cancel closing the selected subtree.",["n","escape"],"terminal",["graph.confirm"],"dismiss-modal"),e("crtr.inspector.force-quit","Inspector","Force quit Inspector","Immediately leave the Inspector.",["ctrl+c"],"host-global",["inspector"],"leave-screen"),e("crtr.inspector.down","Inspector","Move down","Move the Inspector selection or scroll cursor down.",["j","down"],"terminal",["inspector"]),e("crtr.inspector.up","Inspector","Move up","Move the Inspector selection or scroll cursor up.",["k","up"],"terminal",["inspector"]),e("crtr.inspector.section-next","Inspector","Next section","Move to the next Inspector section.",["tab"],"terminal",["inspector"]),e("crtr.inspector.section-prev","Inspector","Previous section","Move to the previous Inspector section.",["shift+tab"],"terminal",["inspector"]),e("crtr.inspector.page-down","Inspector","Page down","Scroll the Inspector detail body down.",["ctrl+d","pagedown"],"terminal",["inspector"]),e("crtr.inspector.page-up","Inspector","Page up","Scroll the Inspector detail body up.",["ctrl+u","pageup"],"terminal",["inspector"]),e("crtr.inspector.toggle-detail","Inspector","Toggle item detail","Expand or collapse the selected cron or background job.",["enter"],"terminal",["inspector"]),e("crtr.inspector.cancel-item","Inspector","Cancel selected item","Arm cancellation for the selected cron, or stopping for the selected background job.",["x"],"terminal",["inspector"]),e("crtr.inspector.open-log","Inspector","Open job log","Follow the selected background job\u2019s log in a new tmux window.",["o"],"terminal",["inspector"]),e("crtr.inspector.confirm","Inspector","Confirm action","Confirm the armed Inspector action.",["y"],"terminal",["inspector"]),e("crtr.inspector.dismiss","Inspector","Dismiss action","Dismiss an Inspector confirmation or banner.",["escape"],"terminal",["inspector"],"dismiss-modal"),e("crtr.inspector.retarget","Inspector","Retarget","Inspect the selected cron anchor or creator node.",["t"],"terminal",["inspector"]),e("crtr.inspector.refresh","Inspector","Refresh","Refresh the Inspector now.",["g","r"],"terminal",["inspector"]),e("crtr.inspector.quit","Inspector","Quit","Leave the Inspector.",["q"],"terminal",["inspector"],"leave-screen"),...v(),...x(),...k(),...y()]);function v(){const t="browse";return[e("crtr.browse.quit","Browse and pickers","Quit browse","Leave canvas browse.",["q","escape","ctrl+c"],"terminal",[t],"leave-screen"),e("crtr.browse.down","Browse and pickers","Move down","Move to the next row.",["j","down"],"terminal",[t]),e("crtr.browse.up","Browse and pickers","Move up","Move to the previous row.",["k","up"],"terminal",[t]),e("crtr.browse.first","Browse and pickers","First row","Move to the first row.",["g"],"terminal",[t]),e("crtr.browse.last","Browse and pickers","Last row","Move to the last row.",["shift+g"],"terminal",[t]),e("crtr.browse.expand-or-child","Browse and pickers","Expand or child","Expand a row or move to its child.",["l","right"],"terminal",[t]),e("crtr.browse.collapse-or-parent","Browse and pickers","Collapse or parent","Collapse a row or move to its parent.",["h","left"],"terminal",[t]),e("crtr.browse.toggle-fold","Browse and pickers","Toggle fold","Toggle the selected fold.",["space"],"terminal",[t]),e("crtr.browse.tab-next","Browse and pickers","Next tab","Select the next browse tab.",["tab","]"],"terminal",[t]),e("crtr.browse.tab-previous","Browse and pickers","Previous tab","Select the previous browse tab.",["shift+tab","["],"terminal",[t]),...[1,2,3,4,5].map(n=>e(`crtr.browse.tab.${n}`,"Browse and pickers",`Tab ${n}`,`Select browse tab ${n}.`,[`${n}`],"terminal",[t])),e("crtr.browse.close-subtree","Browse and pickers","Close subtree","Ask to close the selected subtree.",["x"],"terminal",[t]),e("crtr.browse.confirm-close","Browse and pickers","Confirm close","Confirm closing the selected subtree.",["y"],"terminal",["browse.confirm"]),e("crtr.browse.sort","Browse and pickers","Change sort","Change the browse sort.",["s"],"terminal",[t]),e("crtr.browse.scope","Browse and pickers","Change scope","Toggle the browse cwd scope.",["c"],"terminal",[t]),e("crtr.browse.profile","Browse and pickers","Toggle profile","Toggle the browse profile scope.",["shift+p"],"terminal",[t]),e("crtr.browse.residents","Browse and pickers","Toggle residents","Toggle resident display.",["r"],"terminal",[t]),e("crtr.browse.preview","Browse and pickers","Toggle preview","Toggle the preview panel.",["v"],"terminal",[t]),e("crtr.browse.report","Browse and pickers","Toggle report","Swap the preview panel between the conversation and the node's newest report.",["shift+v"],"terminal",[t]),e("crtr.browse.pin","Browse and pickers","Pin node","Star or unstar the selected node.",["p"],"terminal",[t]),e("crtr.browse.search","Browse and pickers","Search","Open browse search.",["/"],"terminal",[t]),e("crtr.browse.revive-now","Browse and pickers","Revive now","Revive the selected node now.",["shift+k"],"terminal",[t]),e("crtr.browse.focus","Browse and pickers","Focus node","Focus the selected node.",["enter","o"],"terminal",[t]),e("crtr.browse.focus-background","Browse and pickers","Focus node (keep browsing)","Focus the selected node without leaving the navigator.",["shift+o"],"terminal",[t]),e("crtr.browse.yank-id","Browse and pickers","Yank node id","Copy the selected node id to the system clipboard.",["y"],"terminal",[t]),e("crtr.browse.search.cancel","Browse and pickers","Cancel search","Cancel browse search.",["escape"],"terminal",["browse.search"],"dismiss-modal"),e("crtr.browse.search.commit","Browse and pickers","Commit search","Apply browse search.",["enter"],"terminal",["browse.search"]),e("crtr.browse.search.delete","Browse and pickers","Delete search text","Delete the previous search character.",["backspace"],"terminal",["browse.search"]),e("crtr.browse.search.quit","Browse and pickers","Quit browse","Leave canvas browse from search.",["ctrl+c"],"terminal",["browse.search"],"leave-screen")]}a(v,"browseBindings");function x(){const t="dashboard",n="dashboard.confirm",s="dashboard.input",o="Dashboard";return[e("crtr.dashboard.down",o,"Move down","Move to the next row.",["j","down"],"terminal",[t]),e("crtr.dashboard.up",o,"Move up","Move to the previous row.",["k","up"],"terminal",[t]),e("crtr.dashboard.first",o,"First row","Move to the first row.",["g"],"terminal",[t]),e("crtr.dashboard.last",o,"Last row","Move to the last row.",["shift+g"],"terminal",[t]),e("crtr.dashboard.expand",o,"Expand","Show the selected conversation\u2019s children.",["l","right"],"terminal",[t]),e("crtr.dashboard.collapse",o,"Collapse","Hide the selected conversation\u2019s children.",["h","left"],"terminal",[t]),e("crtr.dashboard.open",o,"Open","Open the selected conversation in this pane.",["enter"],"terminal",[t]),e("crtr.dashboard.pin",o,"Pin","Star or unstar the selected conversation.",["p"],"terminal",[t]),e("crtr.dashboard.rename",o,"Rename","Rename the selected conversation.",["shift+r"],"terminal",[t]),e("crtr.dashboard.close",o,"Close","Finish the selected conversation and remove its row.",["x"],"terminal",[t]),e("crtr.dashboard.confirm-close",o,"Confirm close","Close a conversation that is running.",["y"],"terminal",[n]),e("crtr.dashboard.cancel-close",o,"Cancel close","Keep the running conversation.",["n","escape"],"terminal",[n]),e("crtr.dashboard.profile",o,"Toggle profile","Switch between this profile and all profiles.",["shift+p"],"terminal",[t]),e("crtr.dashboard.input",o,"New conversation","Focus the new-conversation input.",["n"],"terminal",[t]),e("crtr.dashboard.input-cancel",o,"Leave input","Leave the input without clearing it.",["escape"],"terminal",[s]),e("crtr.dashboard.input-submit",o,"Start conversation","Start a root conversation from the input text.",["enter"],"terminal",[s]),e("crtr.dashboard.directory-next",o,"Next directory","Select the next directory for the new conversation.",["tab"],"terminal",[s]),e("crtr.dashboard.directory-previous",o,"Previous directory","Select the previous directory for the new conversation.",["shift+tab"],"terminal",[s]),e("crtr.dashboard.help",o,"Help","Show the dashboard keys.",["?"],"terminal",[t])]}a(x,"dashboardBindings");function k(){const t="profile.menu",n="profile.search";return[e("crtr.profile.menu.up","Profiles","Move up","Move to the previous profile.",["k","up"],"terminal",[t]),e("crtr.profile.menu.down","Profiles","Move down","Move to the next profile.",["j","down"],"terminal",[t]),e("crtr.profile.menu.select","Profiles","Select profile","Select the highlighted profile.",["enter"],"terminal",[t]),e("crtr.profile.menu.accept-default","Profiles","Accept default","Accept the default profile.",["escape"],"terminal",[t],"leave-screen"),e("crtr.profile.menu.abort","Profiles","Abort","Leave profile selection.",["ctrl+c"],"terminal",[t],"leave-screen"),...[1,2,3,4,5,6,7,8,9].map(s=>e(`crtr.profile.menu.slot.${s}`,"Profiles",`Profile slot ${s}`,`Select profile slot ${s}.`,[`${s}`],"terminal",[t])),e("crtr.profile.menu.create","Profiles","Create profile","Create a profile.",["c"],"terminal",[t]),e("crtr.profile.menu.search-existing","Profiles","Search profiles","Search existing profiles.",["s"],"terminal",[t]),e("crtr.profile.menu.use-root","Profiles","Use root profile","Use the root profile.",["r"],"terminal",[t]),e("crtr.profile.menu.set-default","Profiles","Set default","Set the selected profile as default.",["d"],"terminal",[t]),e("crtr.profile.menu.add-directory","Profiles","Add directory","Add a directory to the profile.",["a"],"terminal",[t]),e("crtr.profile.menu.unpin","Profiles","Unpin directory","Unpin the selected directory.",["u"],"terminal",[t]),e("crtr.profile.menu.manage","Profiles","Manage profiles","Open the profiles settings page in a popup.",["v"],"terminal",[t]),e("crtr.profile.search.up","Profiles","Move up","Move to the previous search result.",["up","ctrl+p"],"terminal",[n]),e("crtr.profile.search.down","Profiles","Move down","Move to the next search result.",["down","ctrl+n"],"terminal",[n]),e("crtr.profile.search.pick","Profiles","Pick profile","Pick the highlighted profile.",["enter"],"terminal",[n]),e("crtr.profile.search.back","Profiles","Back","Return to profile selection.",["escape"],"terminal",[n],"leave-screen"),e("crtr.profile.search.delete","Profiles","Delete filter text","Delete the previous filter character.",["backspace"],"terminal",[n]),e("crtr.profile.search.abort","Profiles","Abort","Leave profile search.",["ctrl+c"],"terminal",[n],"leave-screen")]}a(k,"profileBindings");function y(){return[e("crtr.setup.cancel","Setup","Cancel setup","Leave the setup wizard.",["q","ctrl+c","ctrl+d"],"terminal",f,"leave-screen"),e("crtr.setup.tab-next","Setup","Next tab","Select the next setup tab.",["tab","right"],"terminal",h),e("crtr.setup.tab-previous","Setup","Previous tab","Select the previous setup tab.",["shift+tab","left"],"terminal",h),e("crtr.setup.open","Setup","Open","Open the selected setup item.",["enter"],"terminal",["setup.login"]),e("crtr.setup.list-down","Setup","Move down","Move to the next setup item.",["j","down"],"terminal",["setup.list","setup.models","setup.models.dimension-picker","setup.models.route-form"]),e("crtr.setup.list-up","Setup","Move up","Move to the previous setup item.",["k","up"],"terminal",["setup.list","setup.models","setup.models.dimension-picker","setup.models.route-form"]),e("crtr.setup.toggle","Setup","Toggle","Toggle the selected setup item.",["space"],"terminal",["setup.list","setup.keybindings"]),e("crtr.setup.details","Setup","Show details","Show details for the selected item.",["?"],"terminal",["setup.list"]),e("crtr.setup.advance","Setup","Advance","Advance the setup flow.",["enter"],"terminal",["setup.list"]),e("crtr.setup.confirm.accept","Setup","Confirm","Accept the setup confirmation.",["y","enter"],"terminal",["setup.confirm","setup.models.confirm"]),e("crtr.setup.confirm.back","Setup","Go back","Cancel the setup confirmation.",["n","escape","q"],"terminal",["setup.confirm","setup.models.confirm"],"dismiss-modal"),e("crtr.setup.keybindings.edit","Setup","Edit binding","Edit the selected binding.",["enter"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.commit-edit","Setup","Commit edit","Commit the active binding edit.",["enter"],"terminal",["setup.keybindings.edit"]),e("crtr.setup.keybindings.cancel-edit","Setup","Cancel edit","Cancel the active binding edit.",["escape"],"terminal",["setup.keybindings.edit"],"dismiss-modal"),e("crtr.setup.keybindings.unbind","Setup","Unbind","Disable the selected binding.",["delete"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.reset-row","Setup","Reset binding","Reset the selected binding.",["r"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.reset-all","Setup","Reset all bindings","Reset all bindings to defaults.",["shift+r"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.save","Setup","Save bindings","Save keybinding changes.",["s"],"terminal",["setup.keybindings"],"save-keybindings"),e("crtr.setup.keybindings.discard","Setup","Discard changes","Discard keybinding changes.",["escape"],"terminal",["setup.keybindings"],"leave-screen"),e("crtr.setup.keybindings.page-up","Setup","Page up","Move up one keybinding page.",["pageup"],"terminal",["setup.keybindings","setup.keybindings.edit"]),e("crtr.setup.keybindings.page-down","Setup","Page down","Move down one keybinding page.",["pagedown"],"terminal",["setup.keybindings","setup.keybindings.edit"]),e("crtr.setup.keybindings.filter","Setup","Filter bindings","Open the keybinding filter.",["/"],"terminal",["setup.keybindings"]),e("crtr.setup.keybindings.filter-delete","Setup","Delete filter text","Delete the previous filter character.",["backspace"],"terminal",["setup.keybindings.filter"]),e("crtr.setup.keybindings.filter-clear","Setup","Clear filter","Clear the keybinding filter.",["escape"],"terminal",["setup.keybindings.filter"],"dismiss-modal"),e("crtr.setup.cell-previous","Setup","Previous field","Select the previous field or setup table cell.",["h"],"terminal",["setup.models","setup.keybindings"]),e("crtr.setup.cell-next","Setup","Next field","Select the next field or setup table cell.",["l"],"terminal",["setup.models","setup.keybindings"]),e("crtr.setup.models.open","Setup","Edit model","Edit the selected model cell or route field.",["enter"],"terminal",["setup.models","setup.models.route-form"]),e("crtr.setup.models.scope-next","Setup","Next model config scope","Edit the next applicable user, profile, or project config.",["s"],"terminal",["setup.models"]),e("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"]),e("crtr.setup.models.cancel","Setup","Cancel pick","Cancel the model picker or route form.",["escape"],"terminal",["setup.models.picker","setup.models.dimension-picker","setup.models.route-form"],"dismiss-modal")]}a(y,"setupBindings");const C=new Set(w.map(t=>t.id));function P(t){return t.contexts.includes("attach")&&(t.inputKind==="terminal"||t.inputKind==="host-global")}a(P,"isAttachPaneBinding");const A=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"},{context:"setup.models.route-form",capability:"dismiss-modal"},{context:"setup.models.confirm",capability:"dismiss-modal"}]);export{w as BINDING_CATALOG,C as BINDING_IDS,A as SAFETY_REQUIREMENTS,P as isAttachPaneBinding};
@@ -1 +1 @@
1
- var T=Object.defineProperty;var m=(a,e)=>T(a,"name",{value:e,configurable:!0});import{existsSync as S,unlinkSync as p}from"node:fs";import{join as h}from"node:path";import{nodeRunJobDir as y}from"../../canvas/paths.js";import{readConfig as G}from"../../config.js";import{emitEvent as u}from"../../events/emit.js";import{atomicWriteJson as f,readJsonIfExists as d}from"../../fs-utils.js";import{assistantVisibleText as k,isGroupBoundaryKind as _,isTrueUserMessage as P,normalizeToolGroupSummaryRecord as b}from"../../../shared/tool-groups.js";import{generatedContextText as g,parseCard as I}from"../../../shared/generated-context.js";import{headlessToolGroupSummary as w,serializeToolGroup as A}from"../tool-group-summary.js";import{putBrokerSummaries as C}from"./summaries-post.js";const E=1e3,O=1e4;function c(a){if(a===null||typeof a!="object"||Array.isArray(a))return null;const e=a;return Object.keys(e).sort().join(",")!=="key,segment,version"||e.version!==1||typeof e.key!="string"||typeof e.segment!="string"||e.key.length===0||e.key.length>E||e.segment.length===0||e.segment.length>O?null:{version:1,key:e.key,segment:e.segment}}m(c,"normalizePendingToolGroupSummary");class Y{static{m(this,"ToolGroupTracker")}nodeId;broadcast;toolSummariesPath;pendingToolSummaryPath;toolGroupSummaries=new Map;summaryAttempted;generatingToolGroups=new Map;toolGroupsByCallId=new Map;summaryTasks=new Set;openToolGroup;lastToolGroupBoundaryProse="";sawAssistantProse=!1;constructor(e,o){this.nodeId=e,this.broadcast=o,this.toolSummariesPath=h(y(e),"tool-summaries.json"),this.pendingToolSummaryPath=h(y(e),"pending-tool-summary.json");try{const s=d(this.toolSummariesPath);for(const[i,n]of Object.entries(b(s)))this.toolGroupSummaries.set(i,n)}catch{}this.summaryAttempted=new Set(this.toolGroupSummaries.keys()),this.resumePendingSummary()}postSummaries(e){C(this.nodeId,{tool_summaries:e}).catch(o=>{u({level:"warn",event:"broker.runtime.diagnostic",fields:{message:`failed to post tool summaries: ${o instanceof Error?o.message:String(o)}`}})})}summaries(){return Object.fromEntries(this.toolGroupSummaries)}resetForSession(){this.openToolGroup=void 0,this.toolGroupsByCallId.clear(),this.sawAssistantProse=!1}finishOpenToolGroup(e=!1){const o=this.openToolGroup;if(this.openToolGroup=void 0,o!==void 0){if(o.closed=!0,e){for(const s of o.pendingToolIds)this.toolGroupsByCallId.delete(s);o.pendingToolIds.clear()}o.summarizeWhenSettled=G("user").summarize_tool_calls,this.generateSettledToolGroup(o)}}observeToolGroupEvent(e){if(e.type==="compaction_end"||e.type==="auto_retry_end"&&e.success!==!0){this.finishOpenToolGroup();return}if(e.type==="message_end"){const t=e.message;if(t!==null&&typeof t=="object"){const r=t;r.role==="assistant"&&(r.stopReason==="aborted"||r.stopReason==="error")&&this.finishOpenToolGroup(!0)}return}if(e.type==="tool_execution_start"){const t=this.ensureOpenToolGroup(),r=typeof e.toolCallId=="string"?e.toolCallId:"";t.key===void 0&&r!==""&&(t.key=r),r!==""&&(t.pendingToolIds.add(r),this.toolGroupsByCallId.set(r,t)),t.toolCount+=1,t.pieces.push({type:"tool",name:typeof e.toolName=="string"?e.toolName:"tool",args:e.args});return}if(e.type==="tool_execution_end"){const t=typeof e.toolCallId=="string"?e.toolCallId:"",r=t===""?this.openToolGroup:this.toolGroupsByCallId.get(t);r!==void 0&&(r.pieces.push({type:"result",name:typeof e.toolName=="string"?e.toolName:"tool",result:e.result,isError:e.isError===!0}),t!==""&&(r.pendingToolIds.delete(t),this.toolGroupsByCallId.delete(t)),this.generateSettledToolGroup(r));return}if(e.type!=="message_start"&&e.type!=="message_update")return;const o=e.message;if(o===null||typeof o!="object")return;const s=o;if(s.role==="assistant"){e.type==="message_start"&&(this.sawAssistantProse=!1);const t=k(s);!this.sawAssistantProse&&t.trim()!==""&&(this.sawAssistantProse=!0,this.visibleBoundary(t));return}if(e.type!=="message_start")return;if(s.role==="compactionSummary"||s.role==="branchSummary"||s.role==="bashExecution"||s.role==="status"||s.role==="error"||s.customType==="crtr-cycle-divider"){this.finishOpenToolGroup();return}if(P(s)){this.visibleBoundary(g(s));return}if(s.display===!1)return;const i=g(s),n=I(s);if(n!==null&&_(n.kind)){this.visibleBoundary(i);return}const l=this.ensureOpenToolGroup();i!==""&&l.pieces.push({type:"text",text:i})}persistPendingSummary(){const e=[...this.generatingToolGroups.values()].at(-1);if(e!==void 0)try{f(this.pendingToolSummaryPath,e)}catch(o){u({level:"warn",event:"broker.runtime.diagnostic",fields:{message:`failed to persist pending tool summary: ${o instanceof Error?o.message:String(o)}`}})}}hasSummaryTasks(){return this.summaryTasks.size>0}waitForSummaryTasks(){return Promise.allSettled([...this.summaryTasks])}ensureOpenToolGroup(){return this.openToolGroup===void 0&&(this.openToolGroup={toolCount:0,pieces:[],boundaryProse:this.lastToolGroupBoundaryProse,pendingToolIds:new Set,closed:!1,summarizeWhenSettled:!1}),this.openToolGroup}visibleBoundary(e){this.finishOpenToolGroup(),this.lastToolGroupBoundaryProse=e}clearPendingToolGroupSummary(e){try{const o=c(d(this.pendingToolSummaryPath));o?.key===e.key&&o.segment===e.segment&&p(this.pendingToolSummaryPath)}catch{}}generateToolGroupSummary(e){const{key:o,segment:s}=e;if(this.summaryAttempted.has(o)||this.generatingToolGroups.has(o))return;this.summaryAttempted.add(o),this.generatingToolGroups.set(o,e);let i;i=w(s).then(n=>{if(n!==null){this.toolGroupSummaries.set(o,n);try{const l=Object.fromEntries(this.toolGroupSummaries);f(this.toolSummariesPath,l),this.postSummaries(l)}catch{this.toolGroupSummaries.delete(o);return}this.clearPendingToolGroupSummary(e),this.broadcast({type:"tool_group_summary",key:o,summary:n})}}).catch(()=>{}).finally(()=>{this.generatingToolGroups.delete(o),this.summaryTasks.delete(i)}),this.summaryTasks.add(i)}generateSettledToolGroup(e){!e.closed||e.pendingToolIds.size>0||e.key===void 0||!e.summarizeWhenSettled||this.generateToolGroupSummary({version:1,key:e.key,segment:A(e.boundaryProse,e.pieces)})}resumePendingSummary(){try{const e=c(d(this.pendingToolSummaryPath));e===null?S(this.pendingToolSummaryPath)&&(p(this.pendingToolSummaryPath),u({level:"warn",event:"broker.startup.warning",fields:{stage:"pending_tool_summary",message:"removed an invalid pending tool summary"}})):this.toolGroupSummaries.has(e.key)?p(this.pendingToolSummaryPath):this.generateToolGroupSummary(e)}catch(e){u({level:"warn",event:"broker.startup.warning",fields:{stage:"pending_tool_summary",message:e instanceof Error?e.message:String(e)}})}}}export{Y as ToolGroupTracker};
1
+ var T=Object.defineProperty;var m=(a,e)=>T(a,"name",{value:e,configurable:!0});import{existsSync as S,unlinkSync as p}from"node:fs";import{join as y}from"node:path";import{nodeRunJobDir as h}from"../../canvas/paths.js";import{emitEvent as u}from"../../events/emit.js";import{atomicWriteJson as g,readJsonIfExists as d}from"../../fs-utils.js";import{assistantVisibleText as G,isGroupBoundaryKind as k,isTrueUserMessage as P,normalizeToolGroupSummaryRecord as _}from"../../../shared/tool-groups.js";import{generatedContextText as f,parseCard as b}from"../../../shared/generated-context.js";import{headlessToolGroupSummary as I,serializeToolGroup as w}from"../tool-group-summary.js";import{putBrokerSummaries as A}from"./summaries-post.js";const C=1e3,E=1e4;function c(a){if(a===null||typeof a!="object"||Array.isArray(a))return null;const e=a;return Object.keys(e).sort().join(",")!=="key,segment,version"||e.version!==1||typeof e.key!="string"||typeof e.segment!="string"||e.key.length===0||e.key.length>C||e.segment.length===0||e.segment.length>E?null:{version:1,key:e.key,segment:e.segment}}m(c,"normalizePendingToolGroupSummary");class U{static{m(this,"ToolGroupTracker")}nodeId;broadcast;toolSummariesPath;pendingToolSummaryPath;toolGroupSummaries=new Map;summaryAttempted;generatingToolGroups=new Map;toolGroupsByCallId=new Map;summaryTasks=new Set;openToolGroup;lastToolGroupBoundaryProse="";sawAssistantProse=!1;constructor(e,o){this.nodeId=e,this.broadcast=o,this.toolSummariesPath=y(h(e),"tool-summaries.json"),this.pendingToolSummaryPath=y(h(e),"pending-tool-summary.json");try{const s=d(this.toolSummariesPath);for(const[i,n]of Object.entries(_(s)))this.toolGroupSummaries.set(i,n)}catch{}this.summaryAttempted=new Set(this.toolGroupSummaries.keys()),this.resumePendingSummary()}postSummaries(e){A(this.nodeId,{tool_summaries:e}).catch(o=>{u({level:"warn",event:"broker.runtime.diagnostic",fields:{message:`failed to post tool summaries: ${o instanceof Error?o.message:String(o)}`}})})}summaries(){return Object.fromEntries(this.toolGroupSummaries)}resetForSession(){this.openToolGroup=void 0,this.toolGroupsByCallId.clear(),this.sawAssistantProse=!1}finishOpenToolGroup(e=!1){const o=this.openToolGroup;if(this.openToolGroup=void 0,o!==void 0){if(o.closed=!0,e){for(const s of o.pendingToolIds)this.toolGroupsByCallId.delete(s);o.pendingToolIds.clear()}this.generateSettledToolGroup(o)}}observeToolGroupEvent(e){if(e.type==="compaction_end"||e.type==="auto_retry_end"&&e.success!==!0){this.finishOpenToolGroup();return}if(e.type==="message_end"){const t=e.message;if(t!==null&&typeof t=="object"){const r=t;r.role==="assistant"&&(r.stopReason==="aborted"||r.stopReason==="error")&&this.finishOpenToolGroup(!0)}return}if(e.type==="tool_execution_start"){const t=this.ensureOpenToolGroup(),r=typeof e.toolCallId=="string"?e.toolCallId:"";t.key===void 0&&r!==""&&(t.key=r),r!==""&&(t.pendingToolIds.add(r),this.toolGroupsByCallId.set(r,t)),t.toolCount+=1,t.pieces.push({type:"tool",name:typeof e.toolName=="string"?e.toolName:"tool",args:e.args});return}if(e.type==="tool_execution_end"){const t=typeof e.toolCallId=="string"?e.toolCallId:"",r=t===""?this.openToolGroup:this.toolGroupsByCallId.get(t);r!==void 0&&(r.pieces.push({type:"result",name:typeof e.toolName=="string"?e.toolName:"tool",result:e.result,isError:e.isError===!0}),t!==""&&(r.pendingToolIds.delete(t),this.toolGroupsByCallId.delete(t)),this.generateSettledToolGroup(r));return}if(e.type!=="message_start"&&e.type!=="message_update")return;const o=e.message;if(o===null||typeof o!="object")return;const s=o;if(s.role==="assistant"){e.type==="message_start"&&(this.sawAssistantProse=!1);const t=G(s);!this.sawAssistantProse&&t.trim()!==""&&(this.sawAssistantProse=!0,this.visibleBoundary(t));return}if(e.type!=="message_start")return;if(s.role==="compactionSummary"||s.role==="branchSummary"||s.role==="bashExecution"||s.role==="status"||s.role==="error"||s.customType==="crtr-cycle-divider"){this.finishOpenToolGroup();return}if(P(s)){this.visibleBoundary(f(s));return}if(s.display===!1)return;const i=f(s),n=b(s);if(n!==null&&k(n.kind)){this.visibleBoundary(i);return}const l=this.ensureOpenToolGroup();i!==""&&l.pieces.push({type:"text",text:i})}persistPendingSummary(){const e=[...this.generatingToolGroups.values()].at(-1);if(e!==void 0)try{g(this.pendingToolSummaryPath,e)}catch(o){u({level:"warn",event:"broker.runtime.diagnostic",fields:{message:`failed to persist pending tool summary: ${o instanceof Error?o.message:String(o)}`}})}}hasSummaryTasks(){return this.summaryTasks.size>0}waitForSummaryTasks(){return Promise.allSettled([...this.summaryTasks])}ensureOpenToolGroup(){return this.openToolGroup===void 0&&(this.openToolGroup={toolCount:0,pieces:[],boundaryProse:this.lastToolGroupBoundaryProse,pendingToolIds:new Set,closed:!1}),this.openToolGroup}visibleBoundary(e){this.finishOpenToolGroup(),this.lastToolGroupBoundaryProse=e}clearPendingToolGroupSummary(e){try{const o=c(d(this.pendingToolSummaryPath));o?.key===e.key&&o.segment===e.segment&&p(this.pendingToolSummaryPath)}catch{}}generateToolGroupSummary(e){const{key:o,segment:s}=e;if(this.summaryAttempted.has(o)||this.generatingToolGroups.has(o))return;this.summaryAttempted.add(o),this.generatingToolGroups.set(o,e);let i;i=I(s).then(n=>{if(n!==null){this.toolGroupSummaries.set(o,n);try{const l=Object.fromEntries(this.toolGroupSummaries);g(this.toolSummariesPath,l),this.postSummaries(l)}catch{this.toolGroupSummaries.delete(o);return}this.clearPendingToolGroupSummary(e),this.broadcast({type:"tool_group_summary",key:o,summary:n})}}).catch(()=>{}).finally(()=>{this.generatingToolGroups.delete(o),this.summaryTasks.delete(i)}),this.summaryTasks.add(i)}generateSettledToolGroup(e){!e.closed||e.pendingToolIds.size>0||e.key===void 0||this.generateToolGroupSummary({version:1,key:e.key,segment:w(e.boundaryProse,e.pieces)})}resumePendingSummary(){try{const e=c(d(this.pendingToolSummaryPath));e===null?S(this.pendingToolSummaryPath)&&(p(this.pendingToolSummaryPath),u({level:"warn",event:"broker.startup.warning",fields:{stage:"pending_tool_summary",message:"removed an invalid pending tool summary"}})):this.toolGroupSummaries.has(e.key)?p(this.pendingToolSummaryPath):this.generateToolGroupSummary(e)}catch(e){u({level:"warn",event:"broker.startup.warning",fields:{stage:"pending_tool_summary",message:e instanceof Error?e.message:String(e)}})}}}export{U as ToolGroupTracker};
@@ -3,10 +3,8 @@ import type { BrokerToClient } from '../broker-protocol.js';
3
3
  export interface TurnReplyTrackerOptions {
4
4
  /** Rewrites a turn's prose; null on failure. Defaults to the light-model call. */
5
5
  generate?: (userText: string, prose: readonly string[]) => Promise<string | null>;
6
- /** Whether the `consolidate_replies` experiment is on. Defaults to user config. */
7
- enabled?: () => boolean;
8
6
  }
9
- /** Consolidated replies (`consolidate_replies` experiment): tracks the open
7
+ /** Consolidated replies (the viewer's `replies` verbosity): tracks the open
10
8
  * turn's prose messages and rewrites them into one reply with a no-context light
11
9
  * model whenever a second or later prose message ends. A turn runs from one
12
10
  * message the person typed to the next; everything the runtime injects stays
@@ -31,7 +29,6 @@ export declare class TurnReplyTracker {
31
29
  * may name prose that branch no longer holds, so its result is dropped. */
32
30
  private epoch;
33
31
  private readonly generate;
34
- private readonly enabled;
35
32
  constructor(nodeId: string, broadcast: (frame: BrokerToClient) => void, options?: TurnReplyTrackerOptions);
36
33
  snapshot(): Record<string, TurnReply>;
37
34
  /** Rebuild the open turn from the bound session's messages, so a broker
@@ -1 +1 @@
1
- var l=Object.defineProperty;var a=(n,e)=>l(n,"name",{value:e,configurable:!0});import{join as m}from"node:path";import{nodeRunJobDir as y}from"../../canvas/paths.js";import{readConfig as k}from"../../config.js";import{emitEvent as h}from"../../events/emit.js";import{atomicWriteJson as g,readJsonIfExists as b}from"../../fs-utils.js";import{assistantVisibleText as T,isTrueUserMessage as p}from"../../../shared/tool-groups.js";import{generatedContextText as d}from"../../../shared/generated-context.js";import{isSettledAssistant as x,messageKey as u,normalizeTurnReplyRecord as w,START_TURN_KEY as f}from"../../../shared/turn-replies.js";import{headlessTurnReply as S}from"../turn-reply-summary.js";import{putBrokerSummaries as _}from"./summaries-post.js";function c(n,e){return n!==void 0&&n.sources.length===e.length&&n.sources.every((s,t)=>s===e[t].key)}a(c,"sameSources");class C{static{a(this,"TurnReplyTracker")}nodeId;broadcast;path;replies=new Map;tasks=new Set;turn={key:f,userText:"",prose:[]};inFlight;queued;epoch=0;generate;enabled;constructor(e,s,t={}){this.nodeId=e,this.broadcast=s,this.generate=t.generate??S,this.enabled=t.enabled??(()=>k("user").consolidate_replies),this.path=m(y(e),"turn-replies.json");try{for(const[i,r]of Object.entries(w(b(this.path))))this.replies.set(i,r)}catch{}}snapshot(){return Object.fromEntries(this.replies)}seed(e){this.epoch+=1,this.queued=void 0;let s={key:f,userText:"",prose:[]};for(const t of e){if(t===null||typeof t!="object")continue;const i=t;if(p(i)){const o=u(i);o!==void 0&&(s={key:o,userText:d(i),prose:[]});continue}const r=this.proseOf(i);r!==void 0&&s.prose.push(r)}this.turn=s,this.maybeGenerate()}observe(e){if(e.type!=="message_start"&&e.type!=="message_end")return;const s=e.message;if(s===null||typeof s!="object")return;const t=s;if(e.type==="message_start"){if(!p(t))return;const r=u(t);r!==void 0&&r!==this.turn.key&&(this.turn={key:r,userText:d(t),prose:[]});return}const i=this.proseOf(t);i===void 0||this.turn.prose.some(r=>r.key===i.key)||(this.turn.prose.push(i),this.maybeGenerate())}hasTasks(){return this.tasks.size>0}async waitForTasks(){for(;this.tasks.size>0;)await Promise.allSettled([...this.tasks])}proseOf(e){if(e.role!=="assistant"||!x(e))return;const s=T(e).trim(),t=u(e);return s===""||t===void 0?void 0:{key:t,text:s}}maybeGenerate(){const{key:e,userText:s,prose:t}=this.turn;if(t.length<2||!this.enabled()||c(this.replies.get(e),t))return;const i={key:e,userText:s,prose:[...t],epoch:this.epoch};if(this.inFlight!==void 0){this.queued=i;return}this.run(i)}run(e){this.inFlight=e;let s;s=this.generate(e.userText,e.prose.map(t=>t.text)).then(t=>{if(t===null||e.epoch!==this.epoch)return;const i={version:1,sources:e.prose.map(r=>r.key),text:t};this.replies.set(e.key,i);try{const r=Object.fromEntries(this.replies);g(this.path,r),_(this.nodeId,{turn_replies:r}).catch(o=>{h({level:"warn",event:"broker.runtime.diagnostic",fields:{message:`failed to post turn replies: ${o instanceof Error?o.message:String(o)}`}})})}catch(r){h({level:"warn",event:"broker.runtime.diagnostic",fields:{message:`failed to persist turn reply: ${r instanceof Error?r.message:String(r)}`}})}this.broadcast({type:"turn_reply",key:e.key,reply:i})}).catch(()=>{}).finally(()=>{this.tasks.delete(s),this.inFlight=void 0;const t=this.queued;this.queued=void 0,t!==void 0&&!c(this.replies.get(t.key),t.prose)&&this.run(t)}),this.tasks.add(s)}}export{C as TurnReplyTracker};
1
+ var l=Object.defineProperty;var a=(n,e)=>l(n,"name",{value:e,configurable:!0});import{join as m}from"node:path";import{nodeRunJobDir as y}from"../../canvas/paths.js";import{emitEvent as h}from"../../events/emit.js";import{atomicWriteJson as k,readJsonIfExists as g}from"../../fs-utils.js";import{assistantVisibleText as T,isTrueUserMessage as p}from"../../../shared/tool-groups.js";import{generatedContextText as d}from"../../../shared/generated-context.js";import{isSettledAssistant as b,messageKey as u,normalizeTurnReplyRecord as x,START_TURN_KEY as f}from"../../../shared/turn-replies.js";import{headlessTurnReply as w}from"../turn-reply-summary.js";import{putBrokerSummaries as S}from"./summaries-post.js";function c(n,e){return n!==void 0&&n.sources.length===e.length&&n.sources.every((s,t)=>s===e[t].key)}a(c,"sameSources");class J{static{a(this,"TurnReplyTracker")}nodeId;broadcast;path;replies=new Map;tasks=new Set;turn={key:f,userText:"",prose:[]};inFlight;queued;epoch=0;generate;constructor(e,s,t={}){this.nodeId=e,this.broadcast=s,this.generate=t.generate??w,this.path=m(y(e),"turn-replies.json");try{for(const[i,r]of Object.entries(x(g(this.path))))this.replies.set(i,r)}catch{}}snapshot(){return Object.fromEntries(this.replies)}seed(e){this.epoch+=1,this.queued=void 0;let s={key:f,userText:"",prose:[]};for(const t of e){if(t===null||typeof t!="object")continue;const i=t;if(p(i)){const o=u(i);o!==void 0&&(s={key:o,userText:d(i),prose:[]});continue}const r=this.proseOf(i);r!==void 0&&s.prose.push(r)}this.turn=s,this.maybeGenerate()}observe(e){if(e.type!=="message_start"&&e.type!=="message_end")return;const s=e.message;if(s===null||typeof s!="object")return;const t=s;if(e.type==="message_start"){if(!p(t))return;const r=u(t);r!==void 0&&r!==this.turn.key&&(this.turn={key:r,userText:d(t),prose:[]});return}const i=this.proseOf(t);i===void 0||this.turn.prose.some(r=>r.key===i.key)||(this.turn.prose.push(i),this.maybeGenerate())}hasTasks(){return this.tasks.size>0}async waitForTasks(){for(;this.tasks.size>0;)await Promise.allSettled([...this.tasks])}proseOf(e){if(e.role!=="assistant"||!b(e))return;const s=T(e).trim(),t=u(e);return s===""||t===void 0?void 0:{key:t,text:s}}maybeGenerate(){const{key:e,userText:s,prose:t}=this.turn;if(t.length<2||c(this.replies.get(e),t))return;const i={key:e,userText:s,prose:[...t],epoch:this.epoch};if(this.inFlight!==void 0){this.queued=i;return}this.run(i)}run(e){this.inFlight=e;let s;s=this.generate(e.userText,e.prose.map(t=>t.text)).then(t=>{if(t===null||e.epoch!==this.epoch)return;const i={version:1,sources:e.prose.map(r=>r.key),text:t};this.replies.set(e.key,i);try{const r=Object.fromEntries(this.replies);k(this.path,r),S(this.nodeId,{turn_replies:r}).catch(o=>{h({level:"warn",event:"broker.runtime.diagnostic",fields:{message:`failed to post turn replies: ${o instanceof Error?o.message:String(o)}`}})})}catch(r){h({level:"warn",event:"broker.runtime.diagnostic",fields:{message:`failed to persist turn reply: ${r instanceof Error?r.message:String(r)}`}})}this.broadcast({type:"turn_reply",key:e.key,reply:i})}).catch(()=>{}).finally(()=>{this.tasks.delete(s),this.inFlight=void 0;const t=this.queued;this.queued=void 0,t!==void 0&&!c(this.replies.get(t.key),t.prose)&&this.run(t)}),this.tasks.add(s)}}export{J as TurnReplyTracker};
@@ -75,7 +75,7 @@ export interface BrokerSnapshot {
75
75
  * Structured objects with bullets and filesDeleted.
76
76
  * Optional so snapshots from an older live runtime remain readable. */
77
77
  toolGroupSummaries?: Record<string, ToolGroupSummary>;
78
- /** Consolidated replies (`consolidate_replies` experiment), keyed by the
78
+ /** Consolidated replies (the viewer's `replies` verbosity), keyed by the
79
79
  * turn's opening user-message timestamp (or `start`). Optional: absent from
80
80
  * older runtimes and when no turn has been rewritten. */
81
81
  turnReplies?: Record<string, TurnReply>;
@@ -643,7 +643,7 @@ export interface ToolGroupSummaryFrame {
643
643
  key: string;
644
644
  summary: ToolGroupSummary;
645
645
  }
646
- /** A completed consolidated-reply rewrite for one turn (`consolidate_replies`). */
646
+ /** A completed consolidated-reply rewrite for one turn (the viewer's `replies` verbosity). */
647
647
  export interface TurnReplyFrame {
648
648
  type: 'turn_reply';
649
649
  key: string;