@north-light/cli 0.3.747 → 0.3.749
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.
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/objects.d.ts +6 -1
- package/dist/api/dto/plugins.d.ts +2 -0
- package/dist/clients/attach/chrome/canvas-panels.d.ts +2 -0
- package/dist/clients/attach/chrome/canvas-panels.js +1 -1
- package/dist/clients/attach/chrome/roster.d.ts +2 -0
- package/dist/clients/attach/chrome/roster.js +5 -5
- package/dist/clients/attach/chrome/run-facts.d.ts +12 -0
- package/dist/clients/attach/chrome/run-facts.js +1 -0
- package/dist/clients/attach/chrome/widgets.d.ts +3 -1
- package/dist/clients/attach/chrome/widgets.js +1 -1
- package/dist/clients/attach/viewer.js +487 -487
- package/dist/commands/canvas/list.js +2 -2
- package/dist/commands/canvas/read.js +4 -4
- package/dist/commands/canvas/search.js +1 -1
- package/dist/core/canvas/canvas.js +16 -16
- package/dist/core/canvas/schema-pg/035-environment-payer.sql +2 -0
- package/dist/core/canvas/schema-pg/036-ledger-holder-app-path.sql +13 -0
- package/dist/core/canvas/schema-version.d.ts +1 -1
- package/dist/core/canvas/schema-version.js +1 -1
- package/dist/core/command-manifests/registry.d.ts +2 -1
- package/dist/core/command-plugins/compose.js +1 -1
- package/dist/core/command.d.ts +11 -0
- package/dist/core/command.js +9 -9
- package/dist/core/environments.d.ts +2 -1
- package/dist/core/environments.js +1 -1
- package/dist/core/grants/mirror.d.ts +4 -0
- package/dist/core/grants/mirror.js +8 -6
- package/dist/core/grants/on-sync.js +1 -1
- package/dist/core/graph/reader.js +1 -1
- package/dist/core/ledger/environment-payer.d.ts +2 -0
- package/dist/core/ledger/environment-payer.js +1 -0
- package/dist/core/ledger/index.d.ts +1 -0
- package/dist/core/ledger/index.js +1 -1
- package/dist/core/ledger/payer.d.ts +4 -1
- package/dist/core/ledger/payer.js +1 -1
- package/dist/core/llm/run.d.ts +1 -0
- package/dist/core/llm/run.js +2 -2
- package/dist/core/peer/envelope.js +1 -1
- package/dist/core/peer/stubs.js +1 -1
- package/dist/core/permissions/ceiling.js +10 -10
- package/dist/core/permissions/evaluator.js +2 -2
- package/dist/core/providers/call.js +1 -1
- package/dist/core/runs/node-sub.d.ts +2 -0
- package/dist/core/runs/node-sub.js +1 -0
- package/dist/core/runtime/host.js +3 -3
- package/dist/core/runtime/recap.js +6 -6
- package/dist/core/runtime/spawn.js +2 -2
- package/dist/core/runtime/start-check.d.ts +1 -0
- package/dist/core/runtime/start-check.js +1 -1
- package/dist/core/runtime/warm-pool.js +1 -1
- package/dist/core/spaces/process.js +1 -1
- package/dist/daemon/api/handlers/bash-jobs.js +2 -2
- package/dist/daemon/api/handlers/hook-exec.js +1 -1
- package/dist/daemon/api/handlers/llm.js +3 -3
- package/dist/daemon/api/handlers/providers.d.ts +2 -0
- package/dist/daemon/api/handlers/providers.js +1 -1
- package/dist/daemon/peer/authority.d.ts +1 -1
- package/dist/daemon/peer/authority.js +1 -1
- package/package.json +4 -4
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/dist/clients/attach/chrome/canvas-panels.js +19 -1
- package/packages/crouter-api/dist/clients/attach/chrome/roster.js +1 -0
- package/packages/crouter-api/dist/clients/attach/chrome/run-facts.js +76 -0
- package/packages/crouter-api/dist/clients/attach/chrome/widgets.js +14 -5
- package/packages/crouter-api/dist/clients/attach/viewer.js +7 -1
- package/packages/crouter-api/dist/commands/canvas/list.js +3 -1
- package/packages/crouter-api/dist/commands/canvas/read.js +4 -2
- package/packages/crouter-api/dist/commands/canvas/search.js +3 -1
- package/packages/crouter-api/dist/core/canvas/canvas.js +2 -1
- package/packages/crouter-api/dist/core/canvas/schema-version.js +1 -1
- package/packages/crouter-api/dist/core/command-plugins/compose.js +5 -3
- package/packages/crouter-api/dist/core/command.js +34 -1
- package/packages/crouter-api/dist/core/environments.js +2 -2
- package/packages/crouter-api/dist/core/grants/mirror.js +16 -1
- package/packages/crouter-api/dist/core/grants/on-sync.js +2 -2
- package/packages/crouter-api/dist/core/graph/reader.js +1 -1
- package/packages/crouter-api/dist/core/ledger/environment-payer.js +15 -0
- package/packages/crouter-api/dist/core/ledger/index.js +1 -0
- package/packages/crouter-api/dist/core/ledger/payer.js +4 -0
- package/packages/crouter-api/dist/core/llm/run.js +2 -1
- package/packages/crouter-api/dist/core/peer/envelope.js +2 -1
- package/packages/crouter-api/dist/core/peer/stubs.js +5 -1
- package/packages/crouter-api/dist/core/permissions/ceiling.js +4 -0
- package/packages/crouter-api/dist/core/permissions/evaluator.js +16 -5
- package/packages/crouter-api/dist/core/providers/call.js +2 -2
- package/packages/crouter-api/dist/core/runs/node-sub.js +10 -0
- package/packages/crouter-api/dist/core/runtime/host.js +2 -2
- package/packages/crouter-api/dist/core/runtime/spawn.js +1 -1
- package/packages/crouter-api/dist/core/runtime/start-check.js +2 -2
- package/packages/crouter-api/dist/core/runtime/warm-pool.js +1 -1
- package/packages/crouter-api/dist/core/spaces/process.js +5 -4
- package/packages/crouter-api/dist/daemon/api/handlers/bash-jobs.js +1 -1
- package/packages/crouter-api/dist/daemon/api/handlers/providers.js +5 -1
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/dist/index.d.ts +8 -0
- package/packages/crouter-identity/dist/index.js +18 -0
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
- package/scripts/lib/install-source.mjs +5 -1
package/dist/api/contract.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
|
|
2
|
-
export declare const CONTRACT_LEVEL = "1.
|
|
2
|
+
export declare const CONTRACT_LEVEL = "1.75";
|
|
3
3
|
/** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
|
|
4
4
|
export declare const REQUIRED_CONTRACT_HEADER = "Crouter-Required-Contract";
|
|
5
5
|
/** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
|
package/dist/api/contract.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.
|
|
1
|
+
var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.75",i="Crouter-Required-Contract",p="Crouter-Contract";function l(r){const t=/^(\d+)\.(\d+)$/.exec(r.trim());return t===null?null:{major:Number(t[1]),minor:Number(t[2])}}e(l,"parseContractLevel");function a(r){return r==null?[]:r.split(",").map(t=>l(t)).filter(t=>t!==null)}e(a,"parseServedContracts");function s(r,t){const n=l(r);return n===null?!1:(typeof t=="string"||t===null||t===void 0?a(t):t).some(u=>u.major===n.major&&u.minor>=n.minor)}e(s,"contractSatisfies");function C(r,t,n={}){if(r===void 0)return null;if(l(r)===null)return{status:400,code:"invalid_request",param:i,message:`${i} must be a contract level like 1.0.`};if(s(r,t))return null;const o=r.trim();return{status:426,code:"runtime_version_unsupported",message:t===null||a(t).length===0?`The runtime did not name its contract level; the caller requires contract ${o} or later. Roll the runtime forward.`:`The runtime serves contract ${t}; the caller requires contract ${o} or later within the same major. Roll the runtime forward, or pin an SDK whose crouterContract the runtime serves.`,details:{sdk_version:(n.legacyMinimum??"").trim(),runtime_version:n.runtimeVersion??null,required_contract:o,runtime_contract:t}}}e(C,"contractRefusal");export{p as CONTRACT_HEADER,f as CONTRACT_LEVEL,i as REQUIRED_CONTRACT_HEADER,C as contractRefusal,s as contractSatisfies,l as parseContractLevel,a as parseServedContracts};
|
|
@@ -127,7 +127,8 @@ export interface ObjectRemoteDTO {
|
|
|
127
127
|
export type ObjectReadDTO = ObjectLiveReadDTO | ObjectDeletedDTO | ObjectRemoteDTO | ObjectUnknownDTO;
|
|
128
128
|
export interface ObjectReadQuery {
|
|
129
129
|
fields?: boolean; /** Read on this machine (`runtime:<id>`), as a merged listing or inbox entry names it. */
|
|
130
|
-
machine?: string;
|
|
130
|
+
machine?: string; /** The person (`user:<id>`) this read acts for, from `--as`. */
|
|
131
|
+
as?: string;
|
|
131
132
|
}
|
|
132
133
|
export interface ObjectListRequest {
|
|
133
134
|
/** A kind name. */
|
|
@@ -143,6 +144,8 @@ export interface ObjectListRequest {
|
|
|
143
144
|
cursor?: string;
|
|
144
145
|
/** List only this machine (`runtime:<id>`), paging through its cursor. `self` lists only this machine without labels. */
|
|
145
146
|
machine?: string;
|
|
147
|
+
/** The person (`user:<id>`) this read acts for, from `--as`. */
|
|
148
|
+
as?: string;
|
|
146
149
|
/** Documents whose `extensions` hold these top-level fields (equality), e.g. `{ firstlight: { workspace_id: 'w1', state: 'active' } }`. Applied inside the permission-filtered query, before `limit`. */
|
|
147
150
|
extensions?: Record<string, Record<string, unknown>>;
|
|
148
151
|
/** Documents that are instances of this app type (`firstlight/memory`). */
|
|
@@ -184,6 +187,8 @@ export interface ObjectSearchRequest {
|
|
|
184
187
|
kind?: string;
|
|
185
188
|
owner?: string;
|
|
186
189
|
limit?: number;
|
|
190
|
+
/** The person (`user:<id>`) this read acts for, from `--as`. */
|
|
191
|
+
as?: string;
|
|
187
192
|
/** As on `ObjectListRequest`: applied inside the query in every search mode (name, `body`, `grep`). */
|
|
188
193
|
extensions?: Record<string, Record<string, unknown>>;
|
|
189
194
|
schema_type?: string;
|
|
@@ -15,6 +15,8 @@ export interface PluginCallHeadersRequestDTO {
|
|
|
15
15
|
header_names: string[];
|
|
16
16
|
/** Lowercase hex sha256 over `<name>:<value>\n` for each name in `header_names`. */
|
|
17
17
|
headers_sha256: string;
|
|
18
|
+
/** The person (`user:<id>`) this call acts for, from `--as`; absent when the node acts for itself. */
|
|
19
|
+
as?: string;
|
|
18
20
|
}
|
|
19
21
|
export interface PluginCallHeadersDTO {
|
|
20
22
|
/** `Crtr-Caller`, and `Crtr-Signature` when the call qualifies for signing. */
|
|
@@ -35,6 +35,8 @@ export interface CanvasPanelLines {
|
|
|
35
35
|
reportIds: string[];
|
|
36
36
|
/** Actionable cockpit rows. Enter swaps nodes or opens the matching wait detail surface. */
|
|
37
37
|
items: CanvasPanelItem[];
|
|
38
|
+
/** What `nodeId` itself waits on, for the fact line above the recap. */
|
|
39
|
+
waiting?: string;
|
|
38
40
|
}
|
|
39
41
|
/** What the nodes on the manager and report rows are waiting on. Omitted for a remote attach. */
|
|
40
42
|
export interface OtherNodeWaits {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var fn=Object.defineProperty;var s=(i,a)=>fn(i,"name",{value:a,configurable:!0});import{navLabel as I,nodeGlyph as hn,truncate as mn,tokensCell as wn,cycleBadge as gn,askBadge as pn,fillWidth as x,RESET as w,DIM as A,GREEN as $n}from"../../../core/canvas/nav-render.js";const _n=34,yn=30,bn=40;import{RemoteCanvasSource as vn}from"../../../core/canvas/remote-canvas-source.js";import{cronWaitSummary as U}from"./cron-wait.js";import{bashJobsWaitSummary as X}from"./bash-jobs.js";import{reviewWaitSummary as kn}from"./review-wait.js";import{objectWaitSummary as Y}from"./object-wait.js";import{formatBashElapsed as Mn}from"../../../core/bash-jobs.js";const Z=s((i,a)=>{const c=i==null?Number.NaN:Date.parse(i);return Number.isNaN(c)?void 0:Mn(a-c)},"since"),jn=12,On=6,nn=22;function tn(i,a){return i.length>a?`${i.slice(0,a-1)}\u2026`:i+" ".repeat(a-i.length)}s(tn,"nameCell");function Nn(i,a){return i.length>=a?i.slice(0,a):" ".repeat(a-i.length)+i}s(Nn,"padStartVisible");async function An(i,a,c,$,N=[],k=[],D=[],M,en){const H=$ instanceof vn,g=en,j=g===void 0?null:new Map(g.nodes.map(n=>[n.node_id,n])),W=new Map,C=new Map;if(g!==void 0)for(const n of g.edges){const t=W.get(n.from_id)??[];t.push(n.to_id),W.set(n.from_id,t),C.has(n.to_id)||C.set(n.to_id,n.from_id)}const P=new Map,T=new Map,F=new Map,_=s(n=>{const t=P.get(n);if(t!==void 0)return t;const e=j===null?$.getNode(n).catch(()=>null):Promise.resolve(j.get(n)??null);return P.set(n,e),e},"node"),G=s(n=>$.getNode(n).catch(()=>null),"detail"),E=s(n=>{const t=T.get(n);if(t!==void 0)return t;const e=(async()=>{const o=j===null?(await $.subscriptionsOf(n).catch(()=>[])).map(r=>r.node_id):W.get(n)??[],d=[];for(const r of o)(await _(r))?.kind!=="human"&&d.push(r);return d})();return T.set(n,e),e},"convoChildIds"),J=s(n=>{const t=F.get(n);if(t!==void 0)return t;const e=j===null?$.subscribersOf(n).then(o=>o[0]?.node_id).catch(()=>{}):Promise.resolve(C.get(n));return F.set(n,e),e},"managerOf"),K=s(async n=>{const t=[];for(const e of await E(n)){const o=(await _(e))?.status;(o==="active"||o==="idle")&&t.push(e)}return t},"liveReports"),on=s(async n=>{let t=n;const e=new Set([t]);for(;;){const o=await J(t);if(o===void 0||e.has(o))break;e.add(o),t=o}return t},"climbRoot"),L=new Map,sn=s(async n=>{const t=new Set,e=s(async o=>{const d=(await _(o))?.status==="active";if(t.has(o))return d?1:0;t.add(o);let r=0;for(const p of await E(o))r+=await e(p);return L.set(o,r),r+(d?1:0)},"visit");await e(n)},"computeActivity"),an=s(async n=>{if(n===null||n.mode!=="orchestrator")return"";const t=(await E(n.node_id)).length;return t>0?` ${A}\u2933${t}${w}`:""},"childBadgeFor"),cn=s(n=>{if(n===null||n.status==="active")return"";const t=L.get(n.node_id)??0;return t>0?` ${$n}\u21E3${t}${w}`:""},"liveBelowBadgeFor"),y=c?.muted??(n=>n),rn=c?.faint??(n=>n);await sn(await on(i));const f=await J(i),l=await K(i),O=[...f!==void 0?[f]:[],...l],V=await Promise.all(O.map(async n=>await G(n)??await _(n))),dn=O.length>0?Math.min(nn,Math.max(...O.map((n,t)=>I(V[t]??null,n).length))):nn,un=s(async(n,t)=>{if(H||t===null||t.status!=="active"&&t.status!=="idle")return"";const e=Date.now();if(t.streaming===!0){const b=[(t.telemetry_last_activity??"").trim(),Z(t.telemetry_updated_at,e)].filter(v=>v!==void 0&&v!=="");return b.length===0?"":` ${A}\xB7 ${b.join(" \xB7 ")}${w}`}const o=[],d=(await K(n)).length;if(d>0&&o.push(d===1?"1 child":`${d} children`),(a[n]??0)>0&&o.push("you"),M!==void 0){M.reviews.some(B=>B.origin_node_id===n)&&o.push("review");const u=await M.jobsOf(n).catch(()=>null),b=u===null?"bash jobs (could not read)":X(u,e,20);b!==void 0&&o.push(b.replace(/ · /g," "));const v=U(M.crons.filter(B=>B.created_by===n),e);v!==void 0&&o.push(v.replace(/ · /g," "))}for(const u of g?.object_waits??[])u.node_id===n&&o.push(Y(u,e,20).replace(/ · /g," "));const r=Z(t.last_settled_at,e),p=[r===void 0?void 0:`turn ended ${r} ago`,o.length===0?void 0:`waiting on ${o.join(", ")}`].filter(u=>u!==void 0);return p.length===0?"":` ${A}\xB7 ${p.join(" \xB7 ")}${w}`},"stateCell"),q=s(async(n,t)=>{const e=V[O.indexOf(n)]??null,o=tn(I(e,n),dn),d=rn(tn(e?.kind??"",jn)),r=y(Nn(wn(e,H),On)),p=`${gn(e)}${await an(e)}${cn(e)}${pn(n,a)}${await un(n,e)}`,u=` ${t} ${hn(e)} ${o} ${d} ${r}${p}`;return mn(u)},"row"),ln=[...f!==void 0?[f]:[],...l],h=[];f!==void 0&&h.push({key:`node:${f}`,kind:"node",nodeId:f,line:await q(f,"\u2191")});for(const n of l)h.push({key:`node:${n}`,kind:"node",nodeId:n,line:await q(n,"\u2193")});for(const n of D){const t=c?c.info("\u270E"):"\u270E",e=kn(n,Math.max(8,x()-bn));h.push({key:`review:${n.review_id}`,kind:"review",reviewId:n.review_id,line:` ${t} ${y(`${e} \xB7 \u21B5 open`)}${w}`})}const z=k.length===1?" \xB7 x stop":"",R=X(k,Date.now(),x()-(_n+z.length));if(R!==void 0){const n=c?c.info("\u2699"):"\u2699";h.push({key:"bash",kind:"bash",line:` ${n} ${y(`${R} \xB7 \u21B5 details${z}`)}${w}`})}const S=U(N);if(S!==void 0){const n=c?c.info("\u25F7"):"\u25F7";h.push({key:"crons",kind:"crons",line:` ${n} ${y(`${S} \xB7 \u21B5 details`)}${w}`})}for(const n of g?.object_waits??[]){if(n.node_id!==i)continue;const t=c?c.info("\u25C7"):"\u25C7",e=Y(n,Date.now(),Math.max(8,x()-yn));h.push({key:`object:${n.object_id}`,kind:"object-wait",objectId:n.object_id,line:` ${t} ${y(`${e} \xB7 \u21B5 details`)}${w}`})}const m=[];if((a[i]??0)>0&&m.push("you"),l.length>0){const n=I(await G(l[0])??await _(l[0]),l[0]);m.push(l.length===1?n:`${n} +${l.length-1}`)}D.length>0&&m.push("review"),R!==void 0&&m.push(k.length===1?"a bash job":`${k.length} bash jobs`),S!==void 0&&m.push(N.length===1?"a cron":`${N.length} crons`);for(const n of g?.object_waits??[])n.node_id===i&&m.push(n.object_name);const Q=m.length===0?void 0:m.join(", ");return{reports:h.map(n=>n.line),reportIds:ln,items:h,...Q===void 0?{}:{waiting:Q}}}s(An,"buildCanvasPanelLines");export{An as buildCanvasPanelLines};
|
|
@@ -25,6 +25,8 @@ export interface RosterHooks {
|
|
|
25
25
|
openObject: (objectId: string) => void;
|
|
26
26
|
/** Recompute the editor's hollow-cursor state (session/pane-focus.ts). */
|
|
27
27
|
syncCursor: () => void;
|
|
28
|
+
/** What this node waits on, from each rebuild — feeds the fact line above the recap. */
|
|
29
|
+
onWaiting?: (label: string | undefined) => void;
|
|
28
30
|
}
|
|
29
31
|
export interface AttachRoster {
|
|
30
32
|
/** Rebuild the rows from the canvas source, reconcile the selection, repaint. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)[0]??"").replace(/\s+/g," ").trim();return c.length>i?`${c.slice(0,i-1)}\u2026`:c},"commandHead"),
|
|
3
|
-
`)[0]}`),n.requestChromeRefresh()}))},"confirmKill");
|
|
1
|
+
var P=Object.defineProperty;var o=(d,n)=>P(d,"name",{value:n,configurable:!0});import{execFile as x}from"node:child_process";import{Text as U,decodeKittyPrintable as V,matchesKey as h}from"@earendil-works/pi-tui";import{cliClient as y}from"../../../commands/api-client.js";import{daemonErrorMessage as R}from"../../inbox/resolve.js";import{openBrowser as W}from"../../open-browser.js";import{toBashJobStatus as K}from"./bash-jobs.js";import{fillBar as D,fillWidth as F,stripSgr as L,REVERSE as X}from"../../../core/canvas/nav-render.js";import{buildCanvasPanelLines as z}from"./canvas-panels.js";const G=15e3;function de(d,n){const{editor:B,tui:E,pal:k,remote:f,role:j,canvasSource:C}=d,N=d.containers.reports;let s=[],r,v=process.env.CRTR_ATTACH_ROSTER;v!==void 0&&delete process.env.CRTR_ATTACH_ROSTER;let a,g;const m=o(()=>{n.syncCursor(),N.clear();for(const e of s){const i=e.key===r;N.addChild(new U(i?D(L(e.line),F(),X):e.line,1,0))}E.requestRender()},"paint"),I=o(async()=>(await y().listBashJobs(d.nodeId)).map(K),"listJobs"),A=o(async e=>{const i=f?[]:await y().listCrons(),c=i.filter(l=>l.created_by===d.nodeId),t=f?[]:await I(),p=f?[]:(await y().listReviews({state:"open"})).reviews,w=p.filter(l=>l.origin_node_id===d.nodeId),H=f?void 0:{crons:i,reviews:p,jobsOf:o(async l=>(await y().listBashJobs(l)).map(K),"jobsOf")},S=await z(d.nodeId,n.asks(),k,C,c,t,w,H,e??await C.panelView?.(d.nodeId));if(s=S.items,n.onWaiting?.(S.waiting),v!==void 0){const l=v;v=void 0;const _=s.find($=>$.kind==="node"&&$.nodeId===l);_!==void 0&&(r=_.key)}r!==void 0&&!s.some(l=>l.key===r)&&(r=void 0),a!==void 0&&!t.some(l=>l.jobId===a?.jobId)&&b(!0),m()},"refresh"),b=o(e=>{g!==void 0&&(clearTimeout(g),g=void 0),a!==void 0&&(a=void 0,e&&n.setNotice(""))},"disarmKill"),u=o(()=>{b(!0),r!==void 0&&(r=void 0,m())},"exit"),T=o(e=>V(e)??(e.length===1?e:void 0),"typed"),q=o((e,i=40)=>{const c=(e.split(`
|
|
2
|
+
`)[0]??"").replace(/\s+/g," ").trim();return c.length>i?`${c.slice(0,i-1)}\u2026`:c},"commandHead"),J=o(async()=>{if(j!=="controller"){n.setNotice("Read-only observer attach \u2014 cannot stop background jobs");return}const e=await I();if(e.length===0){n.setNotice("Background job already finished"),n.requestChromeRefresh();return}if(e.length>1){n.setNotice(`${e.length} background jobs \u2014 press \u21B5 to pick one in the Inspector`);return}const i=e[0];a={jobId:i.jobId,label:q(i.command)},n.setNotice(`Stop \u201C${a.label}\u201D? Press y to confirm.`,{sticky:!0}),g=setTimeout(()=>b(!0),G)},"armKill"),M=o(()=>{const e=a;e!==void 0&&(b(!1),n.setNotice(`Stopping \u201C${e.label}\u201D\u2026`),x("crtr",["node","bash","kill",e.jobId,"--node",d.nodeId],i=>{n.setNotice(i===null?`Stopped \u201C${e.label}\u201D.`:`Could not stop the job: ${i.message.split(`
|
|
3
|
+
`)[0]}`),n.requestChromeRefresh()}))},"confirmKill");B.onCursorDownAtBottom=f?void 0:()=>{r!==void 0||s.length===0||(r=s[0].key,m())};const O=o(()=>{const e=s.find(t=>t.key===r);if(e===void 0||f)return;if(e.kind==="crons"){u(),n.openInspector("schedule");return}if(e.kind==="review"){u(),(async()=>{const t=(await y().listHumanInbox()).tickets.find(p=>p.kind==="review"&&p.request_id===e.reviewId);if(t?.kind!=="review"||t.url===void 0){n.setNotice("Reviews open on canvas.northlight.ai; this runtime has no canvas host");return}W(t.url)})().catch(t=>n.setNotice(`Could not open the review: ${R(t).split(`
|
|
4
4
|
`)[0]}`));return}if(e.kind==="bash"){I().then(t=>{if(t.length===0){n.setNotice("Background job already finished"),n.requestChromeRefresh();return}u(),n.openInspector("jobs")},t=>n.setNotice(`Could not list background jobs: ${R(t).split(`
|
|
5
|
-
`)[0]}`));return}if(e.kind==="object-wait"){u(),n.openObject(e.objectId);return}const i=e.nodeId;if(i===d.nodeId){u();return}if(j!=="controller"){n.setNotice("Read-only observer attach \u2014 cannot focus nodes");return}const c=process.env.TMUX_PANE;if(c===void 0||c===""){n.setNotice("cannot swap \u2014 no tmux pane");return}
|
|
6
|
-
`)[0]}`)),!0):c?(t<=0?u():(r=s[t-1].key,m()),!0):i?(t>=0&&t<s.length-1&&(r=s[t+1].key,m()),!0):
|
|
5
|
+
`)[0]}`));return}if(e.kind==="object-wait"){u(),n.openObject(e.objectId);return}const i=e.nodeId;if(i===d.nodeId){u();return}if(j!=="controller"){n.setNotice("Read-only observer attach \u2014 cannot focus nodes");return}const c=process.env.TMUX_PANE;if(c===void 0||c===""){n.setNotice("cannot swap \u2014 no tmux pane");return}x("tmux",["run-shell","-b",`crtr surface node focus ${i} --pane ${c} --in-place >/dev/null 2>&1`],()=>{})},"openSelected");return{refresh:A,handleKey:o(e=>{if(f)return!1;const i=h(e,"down"),c=h(e,"up");if(r===void 0)return!1;const t=s.findIndex(w=>w.key===r),p=s[t];if(a!==void 0){if(T(e)==="y")return M(),!0;b(!0)}return p?.kind==="bash"&&T(e)==="x"?(J().catch(w=>n.setNotice(`Could not list background jobs: ${R(w).split(`
|
|
6
|
+
`)[0]}`)),!0):c?(t<=0?u():(r=s[t-1].key,m()),!0):i?(t>=0&&t<s.length-1&&(r=s[t+1].key,m()),!0):h(e,"enter")?(O(),!0):h(e,"escape")?(u(),!0):(u(),!1)},"handleKey"),active:o(()=>r!==void 0,"active"),exit:u}}o(de,"createRoster");export{de as createRoster};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BrokerToClient } from '../../../core/runtime/broker-protocol.js';
|
|
2
|
+
export interface RunFacts {
|
|
3
|
+
/** Fold one broker frame: message timestamps move the run window. */
|
|
4
|
+
observe(frame: BrokerToClient): void;
|
|
5
|
+
/** What the node waits on, from the latest roster refresh. */
|
|
6
|
+
setWaiting(label: string | undefined): void;
|
|
7
|
+
/** The fact line, or undefined when there is nothing to show. */
|
|
8
|
+
line(streaming: boolean, nowMs?: number): string | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** `2:31 PM` today, `Nov 18, 2:31 PM` on another day. */
|
|
11
|
+
export declare function finishLabel(atMs: number, nowMs: number): string;
|
|
12
|
+
export declare function createRunFacts(onChange: () => void): RunFacts;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var o=(t,i)=>a(t,"name",{value:i,configurable:!0});import{formatBashElapsed as f}from"../../../core/bash-jobs.js";import{isTrueUserMessage as p}from"../../../shared/tool-groups.js";function c(t){return typeof t.timestamp=="number"&&Number.isFinite(t.timestamp)?t.timestamp:void 0}o(c,"stamp");function m(t,i){const n=new Date(t),s=n.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"});return n.toDateString()===new Date(i).toDateString()?s:`${n.toLocaleDateString("en-US",{month:"short",day:"numeric"})}, ${s}`}o(m,"finishLabel");function y(t){let i,n,s;const d=o(e=>{const r=c(e);r!==void 0&&(p(e)?(i=r,n=void 0):e.role==="assistant"&&(n=r))},"take");return{observe(e){if(e.type==="welcome"){i=void 0,n=void 0;for(const r of e.snapshot.messages)d(r);t();return}if(e.type==="agent_start"||e.type==="agent_end"||e.type==="agent_settled"){t();return}(e.type==="message_end"||e.type==="message_start"&&e.message.role==="user")&&(d(e.message),t())},setWaiting(e){e!==s&&(s=e,t())},line(e,r=Date.now()){if(e)return;const u=[];return n!==void 0&&(i!==void 0&&n>=i&&u.push(`ran ${f(n-i)}`),u.push(`finished ${m(n,r)}`)),s!==void 0&&u.push(`waiting on ${s}`),u.length===0?void 0:u.join(" \xB7 ")}}}o(y,"createRunFacts");export{y as createRunFacts,m as finishLabel};
|
|
@@ -6,4 +6,6 @@ export interface ChromeWidgets {
|
|
|
6
6
|
/** Paint the pending steering messages above the editor. */
|
|
7
7
|
renderQueued: () => void;
|
|
8
8
|
}
|
|
9
|
-
export declare function createChromeWidgets(ctx: Pick<AttachSession, 'tui' | 'pal' | 'containers'>, state: () => SessionState
|
|
9
|
+
export declare function createChromeWidgets(ctx: Pick<AttachSession, 'tui' | 'pal' | 'containers'>, state: () => SessionState,
|
|
10
|
+
/** The gray fact line (run time, finish time, waiting on), painted above the recap. */
|
|
11
|
+
factLine?: () => string | undefined): ChromeWidgets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var b=Object.defineProperty;var c=(n,s)=>b(n,"name",{value:s,configurable:!0});import{Spacer as y,Text as a,truncateToWidth as E,wrapTextWithAnsi as w}from"@earendil-works/pi-tui";import{splitRecapLines as R}from"./recap.js";function j(n,s,h=()=>{}){const{tui:f,pal:o}=n,{aboveWidgets:d,belowWidgets:p,queued:u}=n.containers;return{renderExtensionWidgets:c(()=>{const e=s();d.clear(),p.clear();const r=Math.max(1,(process.stdout.columns??80)-2),i=h();if(i!==void 0){for(const t of w(o.faint(i),r))d.addChild(new a(t,1,0));e.display.widgets["crtr-recap"]!==void 0&&d.addChild(new y(1))}for(const[t,l]of Object.entries(e.display.widgets)){const g=t==="crtr-recap",q=g?R(l.lines).state:l.lines,x=l.placement==="belowEditor"?p:d;for(const m of q){const W=g?o.faint(m):m;for(const C of w(W,r))x.addChild(new a(C,1,0))}}f.requestRender()},"renderExtensionWidgets"),renderQueued:c(()=>{const e=s();if(u.clear(),e.queued.length>0){const r=Math.max(1,(process.stdout.columns??80)-4);u.addChild(new a(o.muted(`queued (${e.queued.length}):`),1,0));for(const i of e.queued){const t=i.text.replace(/\s+/g," ").trim();u.addChild(new a(o.faint(` \u22EF ${E(t,r,"\u2026")}`),1,0))}}f.requestRender()},"renderQueued")}}c(j,"createChromeWidgets");export{j as createChromeWidgets};
|