@north-light/cli 0.3.781 → 0.3.783
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/README.md +9 -19
- package/dist/api/client.d.ts +3 -1
- package/dist/api/client.js +1 -1
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/charges.d.ts +3 -3
- package/dist/api/dto/charges.js +1 -1
- package/dist/api/dto/inbox.d.ts +2 -0
- package/dist/build-root.js +1 -1
- package/dist/builtin-memory/crouter-concepts/why-a-daemon.md +1 -1
- package/dist/builtin-memory/crouter-sdk/README.md +3 -2
- package/dist/builtin-memory/crouter-sdk/client.md +3 -3
- package/dist/builtin-memory/crouter-sdk/docker.md +6 -10
- package/dist/builtin-memory/crouter-sdk/release-notes.md +25 -3
- package/dist/builtin-memory/crouter-sdk/sourcing.md +94 -0
- package/dist/builtin-memory/insights/capture.md +2 -2
- package/dist/builtin-memory/internal/marketplaces.md +1 -1
- package/dist/builtin-memory/internal/storage-tiers.md +1 -1
- package/dist/builtin-memory/northlight-apps/cli.md +1 -1
- package/dist/builtin-memory/northlight-apps/coding-agents.md +1 -1
- package/dist/builtin-memory/northlight-apps/get-started.md +2 -2
- package/dist/builtin-memory/northlight-apps/guides/watchable-objects.md +1 -1
- package/dist/builtin-memory/northlight-apps/how-it-fits.md +1 -1
- package/dist/builtin-memory/northlight-apps/let-their-ai-use-your-app.md +1 -4
- package/dist/builtin-memory/northlight-apps/quickstart.md +1 -1
- package/dist/cli.js +2 -8
- package/dist/clients/attach/command.js +1 -1
- package/dist/clients/attach/input/capabilities.js +1 -1
- package/dist/clients/attach/viewer.js +524 -524
- package/dist/clients/inbox/controller.d.ts +34 -11
- package/dist/clients/inbox/controller.js +1 -1
- package/dist/clients/inbox/dto-adapt.d.ts +1 -0
- package/dist/clients/inbox/dto-adapt.js +1 -1
- package/dist/clients/inbox/surface.js +1 -1
- package/dist/commands/canvas-config.js +2 -2
- package/dist/commands/canvas-use.js +1 -1
- package/dist/commands/node/inspect.js +6 -6
- package/dist/commands/pkg/account-installs.d.ts +9 -0
- package/dist/commands/pkg/account-installs.js +1 -0
- package/dist/commands/profile/default.js +1 -1
- package/dist/commands/sys/setup-core.d.ts +1 -52
- package/dist/commands/sys/setup-core.js +6 -6
- package/dist/commands/sys/setup-wizard.d.ts +4 -9
- package/dist/commands/sys/setup-wizard.js +2 -1
- package/dist/commands/sys/setup.js +1 -1
- package/dist/commands/sys/signin.d.ts +1 -1
- package/dist/commands/sys/signin.js +6 -3
- package/dist/core/command.d.ts +1 -2
- package/dist/core/command.js +6 -6
- package/dist/core/grants/sync.js +1 -1
- package/dist/core/human/requests.d.ts +2 -0
- package/dist/core/human/requests.js +18 -18
- package/dist/core/ledger/check.d.ts +6 -2
- package/dist/core/ledger/check.js +1 -1
- package/dist/core/llm/run.js +2 -2
- package/dist/core/providers/call.js +1 -1
- package/dist/core/runtime/broker/cli-relay.d.ts +0 -2
- package/dist/core/runtime/broker/cli-relay.js +1 -1
- package/dist/core/runtime/broker/run-turn-queue.js +1 -1
- package/dist/core/runtime/broker/turn-cause.d.ts +2 -0
- package/dist/core/runtime/broker/turn-cause.js +1 -1
- package/dist/core/runtime/first-run-offer.d.ts +2 -6
- package/dist/core/runtime/first-run-offer.js +2 -10
- package/dist/core/runtime/front-door.js +8 -9
- package/dist/core/runtime/start-refusal-notice.d.ts +5 -0
- package/dist/core/runtime/start-refusal-notice.js +1 -0
- package/dist/core/scoped-state/seed-terminal-defaults.d.ts +2 -0
- package/dist/core/scoped-state/seed-terminal-defaults.js +1 -0
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/router.js +1 -1
- package/dist/daemon/cron-run.js +2 -2
- package/dist/daemon/fleet.js +5 -5
- package/dist/daemon/machine-link/config.d.ts +2 -4
- package/dist/daemon/machine-link/config.js +4 -4
- package/dist/daemon/manage.js +2 -2
- package/dist/daemon/postgres/cluster.d.ts +3 -3
- package/dist/daemon/postgres/cluster.js +5 -5
- package/dist/daemon/postgres/supervisor.js +1 -1
- package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
- package/dist/pi-extensions/canvas-inbox-watcher.js +2 -2
- package/docs/apps/cli.md +1 -1
- package/docs/apps/coding-agents.md +1 -1
- package/docs/apps/get-started.md +2 -2
- package/docs/apps/guides/watchable-objects.md +1 -1
- package/docs/apps/how-it-fits.md +1 -1
- package/docs/apps/let-their-ai-use-your-app.md +1 -4
- package/docs/apps/quickstart.md +1 -1
- package/docs/concepts/why-a-daemon.md +1 -1
- package/docs/sdk/README.md +3 -2
- package/docs/sdk/client.md +3 -3
- package/docs/sdk/docker.md +5 -9
- package/docs/sdk/release-notes.md +25 -3
- package/docs/sdk/sourcing.md +91 -0
- package/package.json +3 -3
- package/packages/crouter-api/dist/api/client.js +2 -2
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/dist/api/dto/charges.js +1 -1
- package/packages/crouter-api/dist/daemon/machine-link/config.js +3 -5
- package/packages/crouter-api/dist/daemon/manage.js +3 -3
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
- package/scripts/install-runtime.mjs +1 -1
- package/dist/commands/sys/panels/plugin-env-panel.d.ts +0 -19
- package/dist/commands/sys/panels/plugin-env-panel.js +0 -2
- package/dist/commands/sys/panels/plugins-panel.d.ts +0 -16
- package/dist/commands/sys/panels/plugins-panel.js +0 -1
- package/dist/core/northlight/previews.d.ts +0 -22
- package/dist/core/northlight/previews.js +0 -1
- package/dist/core/runtime/front-door-login.d.ts +0 -2
- package/dist/core/runtime/front-door-login.js +0 -1
|
@@ -24,6 +24,9 @@ export interface InboxControllerOptions {
|
|
|
24
24
|
onInboxActivity?: () => void;
|
|
25
25
|
/** Ticket dir to seat the selection on at construction, when present. */
|
|
26
26
|
initialSelection?: string;
|
|
27
|
+
/** Rows the surface already read to decide whether to open, so the first
|
|
28
|
+
* frame draws them instead of waiting for a second identical read. */
|
|
29
|
+
initialRows?: InboxRow[];
|
|
27
30
|
profile?: InboxProfileScope;
|
|
28
31
|
}
|
|
29
32
|
type Screen = 'list' | 'detail';
|
|
@@ -61,15 +64,18 @@ export declare class InboxController {
|
|
|
61
64
|
private selectedWatcher;
|
|
62
65
|
private started;
|
|
63
66
|
private closed;
|
|
64
|
-
/** The selected page's projection,
|
|
65
|
-
* a round trip. `view` is held so a width change re-wraps without one. */
|
|
67
|
+
/** The selected page's wrapped projection, so a frame does not re-wrap it. */
|
|
66
68
|
private preview;
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
/** Every page read so far, by ticket dir. A page read is a round trip, so the
|
|
70
|
+
* list prefetches them and opening or previewing a row reads from here. */
|
|
71
|
+
private pages;
|
|
72
|
+
/** Page reads that failed, so the panel says so instead of staying blank. */
|
|
73
|
+
private pageFailed;
|
|
74
|
+
/** Page reads in flight, by ticket dir: one request per ticket at a time. */
|
|
75
|
+
private pageFetching;
|
|
76
|
+
/** Tickets this inbox settled. The server can still list one for a moment
|
|
77
|
+
* after the settle returns, so a scan hides them until it stops listing them. */
|
|
78
|
+
private settledHere;
|
|
73
79
|
/** The revision the open detail was loaded from, so a replacement published
|
|
74
80
|
* while the reader has the page open reloads it. */
|
|
75
81
|
private openRevision;
|
|
@@ -81,6 +87,12 @@ export declare class InboxController {
|
|
|
81
87
|
inputBuffer?: string;
|
|
82
88
|
};
|
|
83
89
|
rescan(): Promise<void>;
|
|
90
|
+
/** Take a fresh row list, hiding tickets this inbox already settled until
|
|
91
|
+
* the server stops listing them. */
|
|
92
|
+
private applyScan;
|
|
93
|
+
/** Remove a ticket this inbox just settled at once, without waiting for the
|
|
94
|
+
* rescan that confirms it. */
|
|
95
|
+
private dropSettled;
|
|
84
96
|
/** Apply the active filter to the eligible list. A ticket belongs to the
|
|
85
97
|
* profile exactly when its requesting node is one of that profile's nodes;
|
|
86
98
|
* an absent or unknown requester is reachable under all profiles only. */
|
|
@@ -119,6 +131,7 @@ export declare class InboxController {
|
|
|
119
131
|
* whichever one the selected row actually is. */
|
|
120
132
|
private cancelFromInbox;
|
|
121
133
|
activate(): Promise<void>;
|
|
134
|
+
private openDetail;
|
|
122
135
|
/** A review opens in the browser at its canvas page; a runtime with no canvas host has none. */
|
|
123
136
|
private activateReview;
|
|
124
137
|
/** Seat the selection on a ticket dir, when present in the current list. */
|
|
@@ -131,6 +144,12 @@ export declare class InboxController {
|
|
|
131
144
|
reloadSelectedPage(): Promise<void>;
|
|
132
145
|
close(): void;
|
|
133
146
|
private complete;
|
|
147
|
+
/** A settled page the server still lists after its own post-resolve rescan
|
|
148
|
+
* is the "row won't leave" defect. This records whether the request reached
|
|
149
|
+
* a terminal state and whether the scan still lists it, so a live recurrence
|
|
150
|
+
* is diagnosable without a reproduction. It runs after the row has already
|
|
151
|
+
* left the screen, so its reads never delay the reader. */
|
|
152
|
+
private recordResolved;
|
|
134
153
|
/** Edit the active buffer while the host releases the terminal to $EDITOR. */
|
|
135
154
|
private editActivePageInput;
|
|
136
155
|
private leaveDetail;
|
|
@@ -146,9 +165,13 @@ export declare class InboxController {
|
|
|
146
165
|
* fetch, marking the frame dirty when it lands. A width change re-wraps the
|
|
147
166
|
* held projection without another read. */
|
|
148
167
|
private pagePreviewBody;
|
|
149
|
-
/**
|
|
150
|
-
* the
|
|
151
|
-
|
|
168
|
+
/** Read every visible page ahead of the reader, a few at a time, so moving
|
|
169
|
+
* the selection or pressing Enter does not wait on a round trip. The
|
|
170
|
+
* selected row goes first. */
|
|
171
|
+
private prefetchPages;
|
|
172
|
+
/** One in-flight read per ticket. A revision that did not move keeps the
|
|
173
|
+
* held view, so activity on an unrelated ticket costs no re-wrap. */
|
|
174
|
+
private fetchPage;
|
|
152
175
|
/** The request record is the settlement authority: a settled page publishes
|
|
153
176
|
* no file in its directory. An unreachable
|
|
154
177
|
* daemon reads as "not known to be settled" — the settle attempt that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var I=Object.defineProperty;var h=(a,e)=>I(a,"name",{value:e,configurable:!0});import{watch as R}from"node:fs";import{visibleWidth as F}from"@earendil-works/pi-tui";import{renderMarkdown as P}from"../../core/termrender/termrender.js";import{BOLD as M,CYAN as A,DIM as o,GRAY as C,RESET as n,YELLOW as D,clipLine as f,singleLine as L,wrap as W}from"./tui/ansi.js";import{buildInboxLines as q,recommendedLabel as O}from"./tui.js";import{inboxLayout as v}from"./layout.js";import{resolvePageComponents as E}from"../../core/config.js";import{watchInboxActivity as N}from"../../core/human/root.js";import{clearProgress as B}from"../../core/human/convention.js";import{emitEvent as H}from"../../core/events/emit.js";import{cliClient as u}from"../../commands/api-client.js";import{projectPageDisplayMarkdown as T}from"../../core/human/page-markdown.js";import{projectHtmlDocumentMarkdown as z}from"../../core/human/page-html-markdown.js";import{pageBodyLines as V}from"./tui/page-body.js";import{docLinksRevision as g}from"../attach/render/doc-links.js";import{byNewestFirst as _,inboxRowFromDTO as j,pageViewFromDTO as b,settledStatusOf as k}from"./dto-adapt.js";import{PageAdapter as K}from"./page-adapter.js";import{editBufferInEditor as Y}from"../editor-roundtrip.js";import{openBrowser as G}from"../open-browser.js";import{daemonErrorMessage as m,dismissTicketViaDaemon as X,resolveFailureKind as x,resolveTicketPage as $}from"./resolve.js";class ge{static{h(this,"InboxController")}options;host;scan;items=[];visible=[];profile;filter;pendingSeat;selectedDir;selectedIndex=0;screen="list";adapter;focusingSource=!1;open;submittingDir;cancelConfirmation;cols;rows;status;refreshError;watchers=[];selectedWatcher;started=!1;closed=!1;preview;previewFailed;previewFetching;previewStale=!1;openRevision;constructor(e){this.options=e,this.host=e.host,this.scan=e.scan??J,this.cols=e.cols??80,this.rows=e.rows??24,this.profile=e.profile,this.filter=e.profile===void 0?"all":"profile",this.selectedDir=e.initialSelection,this.pendingSeat=e.initialSelection,this.rescan()}snapshot(){return{items:[...this.items],selectedDir:this.selectedDir,screen:this.screen,inputBuffer:this.adapter?.inputBuffer()}}async rescan(){const e=this.selectedDir,t=this.open;try{this.items=await this.scan()}catch(s){if(this.closed)return;this.status=m(s),this.markDirty();return}if(this.closed)return;if(this.recomputeVisible(),this.pendingSeat!==void 0){const s=this.pendingSeat;this.pendingSeat=void 0,this.seatOn(s)}if(!(e!==void 0&&this.items.some(s=>s.dir===e))&&this.adapter!==void 0&&e!==void 0&&t!==void 0){const s=(await this.requestOrNull(t.id))?.state==="canceled";if(this.closed)return;s&&B(e),e!==this.submittingDir&&(this.status=s?"canceled by requester":"ticket resolved elsewhere"),this.leaveDetail()}this.reseatSelection()}recomputeVisible(){if(this.filter==="all"||this.profile===void 0){this.visible=this.items;return}const e=this.profile.members();this.visible=this.items.filter(t=>{const i=t.source.nodeId;return i!==void 0&&e.has(i)})}reseatSelection(){const e=this.selectedDir===void 0?-1:this.visible.findIndex(t=>t.dir===this.selectedDir);if(e>=0){this.selectedIndex=e;return}if(!(this.adapter!==void 0&&this.selectedDir!==void 0&&this.items.some(t=>t.dir===this.selectedDir))){if(this.visible.length===0){this.selectedIndex=0,this.selectedDir=void 0;return}this.selectedIndex=Math.min(Math.max(0,this.selectedIndex),this.visible.length-1),this.selectedDir=this.visible[this.selectedIndex].dir}}highlightIndex(){return this.selectedDir===void 0?-1:this.visible.findIndex(e=>e.dir===this.selectedDir)}currentRow(){const e=this.highlightIndex();return e>=0?this.visible[e]:void 0}scopeHeading(){return this.profile===void 0?{label:"all profiles"}:this.filter==="profile"?{label:this.profile.label,hint:"P all profiles"}:{label:"all profiles",hint:`P ${this.profile.label} only`}}refreshOutcome(e){if(this.refreshError=e,e===void 0){this.invalidate();return}this.markDirty()}start(){this.started||this.closed||(this.started=!0,this.watchRoots())}async invalidate(){if(this.previewStale=!0,await this.rescan(),!this.closed){if(this.adapter!==void 0&&this.open!==void 0){await this.reloadSelectedPage();return}this.markDirty()}}resize(e,t){this.cols=e,this.rows=t,this.adapter?.resize(this.detailSize().cols,this.detailSize().rows),this.markDirty()}render(){const e=v(this.cols,this.rows,this.screen);if(e.mode==="minimum")return[`${D}Resize terminal to at least 60\xD718 to use inbox.${n}`];const t=q(this.visible,e.listWidth,this.highlightIndex(),this.scopeHeading(),e.height),i=this.detailLines(e.detailWidth,e.height);if(e.mode==="list")return this.withStatus(t);if(e.mode==="detail")return this.withStatus(i);const s=[],r=`${C}\u2502${n}`;for(let d=0;d<e.height;d++){const l=f(t[d]??"",e.listWidth),c=f(i[d]??"",e.detailWidth),w=" ".repeat(Math.max(0,e.listWidth-F(l)));s.push(`${l}${w}${r}${c}`)}return this.withStatus(s)}handleKey(e,t){if(t.ctrl&&e==="c"){this.close();return}if(this.screen==="detail"&&this.adapter!==void 0){if((e==="g"||e==="G")&&this.adapter.canAcceptHostKeys()&&!this.adapter.hasShortcut(e)){this.focusSelectedSource();return}this.adapter.handleKey(e,t),this.markDirty();return}if(this.cancelConfirmation!==void 0){if(e==="y"||e==="Y"){const i=this.cancelConfirmation.item;this.cancelConfirmation=void 0,this.status="canceling\u2026",this.cancelFromInbox(i)}else(e==="n"||e==="N"||t.escape)&&(this.cancelConfirmation=void 0,this.status=void 0);this.markDirty();return}if(e==="P"&&this.profile!==void 0){this.toggleProfileFilter(),this.markDirty();return}if(e==="x"||e==="X"){const i=this.currentRow();i!==void 0&&(this.cancelConfirmation={item:i},this.status=void 0),this.markDirty();return}if(e==="s"||e==="S"){this.sendFastAction(),this.markDirty();return}if(t.escape||e==="q"){this.close();return}e==="j"||t.downArrow?this.select(this.selectedIndex+1):e==="k"||t.upArrow?this.select(this.selectedIndex-1):e==="g"||e==="G"?this.focusSelectedSource():(t.return||e==="a")&&this.activate(),this.markDirty()}toggleProfileFilter(){this.filter=this.filter==="profile"?"all":"profile",this.recomputeVisible(),this.reseatSelection()}async sendFastAction(){const e=this.currentRow();if(e===void 0)return;if(e.kind!=="page"||e.fastAction===void 0){this.status="no recommended answer on this ticket \u2014 Enter opens it";return}const t=await this.requestOrNull(e.id);if(y(t)){this.status=p(t),await this.rescan();return}const i=e.fastAction.kind==="acknowledge"?"acknowledged":`sent: ${O(e)??"recommended answer"}`;this.submittingDir=e.dir;try{await $(e.id,e.fastAction.responses),this.status=i}catch(s){this.status=x(s)==="already_settled"?p(await this.requestOrNull(e.id)):m(s)}finally{this.submittingDir=void 0,await this.rescan(),this.markDirty()}}async cancelFromInbox(e){this.submittingDir=e.dir;try{e.kind==="review"?await u().cancelReview(e.id,{reason:"Canceled from the inbox."}):await X(e.id,{reason:"Canceled from the inbox.",actor:"human"}),this.status="canceled"}catch(t){this.status=m(t)}finally{this.submittingDir=void 0,await this.rescan(),this.markDirty()}}async activate(){const e=this.currentRow();if(e===void 0)return;if(e.kind==="review"){this.activateReview(e);return}const t=await this.requestOrNull(e.id);if(this.closed)return;if(y(t)){this.status=p(t),await this.rescan();return}let i,s;try{const r=await u().getHumanInboxPage(e.inboxTicketId);if(r.state==="resolved"||r.state==="canceled"){this.status=k(r),await this.rescan();return}i=b(r),s=r.revision}catch{this.status="page could not be read",await this.invalidate();return}this.closed||this.open!==void 0||this.adapter!==void 0||(this.open={dir:e.dir,id:e.id,ticketId:e.inboxTicketId},this.screen="detail",this.adapter=new K({ticketId:e.inboxTicketId,page:i,productKinds:E(),cols:this.detailSize().cols,rows:this.detailSize().rows,onDirty:h(()=>this.markDirty(),"onDirty"),onEditorRequest:h(()=>this.editActivePageInput(),"onEditorRequest"),onBack:h(()=>{this.leaveDetail(),this.markDirty()},"onBack"),onComplete:h(r=>{this.complete(r)},"onComplete")}),this.openRevision=s,this.watchSelected(e.dir),this.markDirty())}activateReview(e){e.url===void 0?this.status="Reviews open on canvas.northlight.ai; this runtime has no canvas host":(G(e.url),this.status="opened the review in your browser"),this.markDirty()}selectDir(e){this.seatOn(e)&&this.markDirty()}seatOn(e){let t=this.visible.findIndex(i=>i.dir===e);return t<0&&this.items.some(i=>i.dir===e)&&(this.filter="all",this.recomputeVisible(),t=this.visible.findIndex(i=>i.dir===e)),t<0?!1:(this.select(t),!0)}async reloadSelectedPage(){const e=this.open;if(this.adapter===void 0||e===void 0){this.markDirty();return}try{const t=await u().getHumanInboxPage(e.ticketId);if(this.closed||this.open!==e||this.adapter===void 0)return;t.revision!==this.openRevision&&(this.openRevision=t.revision,this.adapter.reload(b(t)))}catch{this.status="page could not be read"}this.markDirty()}close(){if(!this.closed){this.closed=!0,this.started=!1,this.leaveDetail();for(const e of this.watchers)e.close();this.watchers=[],this.selectedWatcher?.close(),this.selectedWatcher=void 0,this.options.onClosed()}}async complete(e){const t=this.open;if(t===void 0)return;this.submittingDir=t.dir;try{await $(t.id,e)}catch(s){this.submittingDir=void 0,this.status=m(s);const r=x(s);if(r==="unreachable"||r==="other"){this.markDirty();return}r==="already_settled"&&(this.status=p(await this.requestOrNull(t.id))),this.leaveDetail(),await this.rescan(),this.markDirty();return}this.submittingDir=void 0,this.leaveDetail(),await this.rescan();const i=this.items.some(s=>s.dir===t.dir);H({level:i?"warn":"info",event:"inbox.page.resolved",fields:{ticket_id:t.id,request_settled:y(await this.requestOrNull(t.id)),still_listed:i}}),this.markDirty()}editActivePageInput(){const e=this.adapter?.inputBuffer();if(e===void 0)return;const t=this.host.suspendForChild();let i={text:e};try{i=Y(e)}finally{t(),this.adapter?.setInputBuffer(i.text),i.error!==void 0&&(this.status=i.error),this.markDirty()}}leaveDetail(){this.adapter?.close(),this.adapter=void 0,this.selectedWatcher?.close(),this.selectedWatcher=void 0,this.open=void 0,this.openRevision=void 0,this.screen="list",this.reseatSelection()}select(e){this.visible.length!==0&&(this.selectedIndex=Math.max(0,Math.min(e,this.visible.length-1)),this.selectedDir=this.visible[this.selectedIndex].dir)}detailSize(){const e=v(this.cols,this.rows,this.screen);return{cols:Math.max(1,e.detailWidth-2),rows:e.height}}detailLines(e,t){if(this.adapter!==void 0)return this.adapter.render();const i=this.currentRow();if(i===void 0)return this.passiveDetailLines(e,t);const s=this.focusAvailable(i.dir)?` ${o}g${n} chat`:"",r=i.kind==="page"&&i.fastAction!==void 0?` ${o}s${n} ${i.fastAction.kind==="acknowledge"?"acknowledge":"send recommended"}`:"",d=i.kind==="page"?[` ${o}Enter${n} opens the full page ${o}\u2191\u2193/jk${n} select${r} ${o}x${n} cancel`,` ${o}Page:${n} c comment u/d scroll${s} ${o}q${n} close`]:[` ${o}Enter${n} opens the review in your browser ${o}\u2191\u2193/jk${n} select ${o}x${n} cancel`,` ${s} ${o}q${n} close`],l=Math.max(0,t-d.length),c=this.passiveDetailLines(e,l);for(;c.length<l;)c.push("");return[...c,...d.map(w=>f(w,e))]}focusAvailable(e){return this.host.capabilities.canFocusNode}async focusSelectedSource(){const e=this.screen==="detail"?this.open?.dir:this.currentRow()?.dir,t=e===void 0?void 0:this.items.find(s=>s.dir===e);if(t===void 0||this.focusingSource)return;const i=t.source.nodeId;if(i===void 0){this.status="This request was not raised by a canvas node",this.markDirty();return}this.focusingSource=!0;try{await this.host.focusNode(i)?this.close():(this.status="Could not open that node\u2019s viewer",this.markDirty())}finally{this.focusingSource=!1}}pagePreviewBody(e,t){const i=this.preview;if(i!==void 0&&i.dir===e.dir){if(this.previewStale&&this.schedulePreview(e),i.width===t&&i.links===g())return i.lines;const s=S(i.view,t);return this.preview={...i,width:t,links:g(),lines:s},s}return this.schedulePreview(e),this.previewFailed===e.dir?[`${o}page could not be read${n}`]:[]}schedulePreview(e){this.previewFetching!==e.dir&&(this.previewFetching=e.dir,this.previewStale=!1,u().getHumanInboxPage(e.inboxTicketId).then(t=>{if(this.closed||this.previewFetching!==e.dir||(this.previewFetching=void 0,this.previewFailed=void 0,this.preview?.dir===e.dir&&this.preview.revision===t.revision))return;const i=b(t),s=this.preview?.width??v(this.cols,this.rows,this.screen).detailWidth;this.preview={dir:e.dir,revision:t.revision,view:i,width:s,links:g(),lines:S(i,s)},this.markDirty()},()=>{this.closed||this.previewFetching!==e.dir||(this.previewFetching=void 0,this.previewFailed=e.dir,this.preview?.dir===e.dir&&(this.preview=void 0),this.markDirty())}))}async requestOrNull(e){try{return await u().getHumanRequest(e)}catch{return}}passiveDetailLines(e,t){const i=this.currentRow();if(i===void 0)return[` ${o}Select a pending interaction.${n}`];const s=[...W(L(i.title),Math.max(10,e-2)).map(d=>` ${M}${A}${d}${n}`),""];for(const d of P(i.subtitle,Math.max(1,e-2)))s.push(` ${d}`);const r=i.kind==="page"?this.pagePreviewBody(i,e):[`${o}1 file to review${n}`];if(r.length>0){s.push("");const d=Math.max(0,t-s.length),l=r.length<=d?r:r.slice(0,Math.max(0,d-1));for(const c of l)s.push(` ${c}`);l.length<r.length&&s.push(` ${o}\u2026 +${r.length-l.length} more lines${n}`)}return s.map(d=>f(d,e)).slice(0,Math.max(1,t))}withStatus(e){const t=this.cancelConfirmation===void 0?this.refreshError??this.status:`cancel \u201C${this.cancelConfirmation.item.title}\u201D? y yes \xB7 n/Esc no`;if(t===void 0||this.rows<1)return e;const i=[...e];for(;i.length<this.rows;)i.push("");return i[this.rows-1]=`${D}${t}${n}`,i}markDirty(){this.options.onDirty()}watchRoots(){const e=N(this.options.onInboxActivity??(()=>{this.invalidate()}));this.watchers.push({close:e})}watchSelected(e){this.selectedWatcher?.close();try{this.selectedWatcher=R(e,()=>{this.invalidate()})}catch{this.selectedWatcher=void 0}}}async function J(){const{tickets:a}=await u().listHumanInbox();return a.map(j).sort(_)}h(J,"defaultScan");function S(a,e){const t=a.manifest.dialect==="html"?z(a.document):T(a.document,a.manifest);return V(a.manifest,t,Math.min(Math.max(20,e-4),100),Math.max(20,e-4))}h(S,"previewLines");function y(a){return a!==void 0&&a.state!=="pending"}h(y,"isSettled");function p(a){return a?.page===void 0?"ticket was already resolved":k(a.page)}h(p,"settledStatus");export{ge as InboxController};
|
|
1
|
+
var S=Object.defineProperty;var h=(a,e)=>S(a,"name",{value:e,configurable:!0});import{watch as $}from"node:fs";import{visibleWidth as I}from"@earendil-works/pi-tui";import{renderMarkdown as R}from"../../core/termrender/termrender.js";import{BOLD as P,CYAN as F,DIM as o,GRAY as C,RESET as n,YELLOW as w,clipLine as u,singleLine as M,wrap as A}from"./tui/ansi.js";import{buildInboxLines as H,recommendedLabel as E}from"./tui.js";import{inboxLayout as y}from"./layout.js";import{resolvePageComponents as L}from"../../core/config.js";import{watchInboxActivity as O}from"../../core/human/root.js";import{clearProgress as W}from"../../core/human/convention.js";import{emitEvent as q}from"../../core/events/emit.js";import{cliClient as f}from"../../commands/api-client.js";import{projectPageDisplayMarkdown as N}from"../../core/human/page-markdown.js";import{projectHtmlDocumentMarkdown as B}from"../../core/human/page-html-markdown.js";import{pageBodyLines as T}from"./tui/page-body.js";import{docLinksRevision as b}from"../attach/render/doc-links.js";import{byNewestFirst as z,inboxRowFromDTO as V,listedPageOf as _,pageViewFromDTO as p,settledStatusOf as v}from"./dto-adapt.js";import{PageAdapter as j}from"./page-adapter.js";import{editBufferInEditor as K}from"../editor-roundtrip.js";import{openBrowser as Y}from"../open-browser.js";import{daemonErrorMessage as m,dismissTicketViaDaemon as G,resolveFailureKind as D,resolveTicketPage as k}from"./resolve.js";const U=4;class be{static{h(this,"InboxController")}options;host;scan;items=[];visible=[];profile;filter;pendingSeat;selectedDir;selectedIndex=0;screen="list";adapter;focusingSource=!1;open;submittingDir;cancelConfirmation;cols;rows;status;refreshError;watchers=[];selectedWatcher;started=!1;closed=!1;preview;pages=new Map;pageFailed=new Set;pageFetching=new Set;settledHere=new Set;openRevision;constructor(e){this.options=e,this.host=e.host,this.scan=e.scan??X,this.cols=e.cols??80,this.rows=e.rows??24,this.profile=e.profile,this.filter=e.profile===void 0?"all":"profile",this.selectedDir=e.initialSelection,this.pendingSeat=e.initialSelection,e.initialRows!==void 0?(this.applyScan(e.initialRows),this.prefetchPages()):this.rescan()}snapshot(){return{items:[...this.items],selectedDir:this.selectedDir,screen:this.screen,inputBuffer:this.adapter?.inputBuffer()}}async rescan(){const e=this.selectedDir,i=this.open;let t;try{t=await this.scan()}catch(r){if(this.closed)return;this.status=m(r),this.markDirty();return}if(this.closed)return;if(this.applyScan(t),!(e!==void 0&&this.items.some(r=>r.dir===e))&&this.adapter!==void 0&&e!==void 0&&i!==void 0){const r=(await this.requestOrNull(i.id))?.state==="canceled";if(this.closed)return;r&&W(e),e!==this.submittingDir&&(this.status=r?"canceled by requester":"ticket resolved elsewhere"),this.leaveDetail()}this.reseatSelection(),this.prefetchPages()}applyScan(e){const i=new Set(e.map(t=>t.dir));for(const t of this.settledHere)i.has(t)||this.settledHere.delete(t);this.items=e.filter(t=>!this.settledHere.has(t.dir));for(const t of this.pages.keys())i.has(t)||this.pages.delete(t);for(const t of this.items){const s=t.kind==="page"?_(t):void 0;if(s===void 0)continue;const r=this.pages.get(t.dir);if(r!==void 0&&r.revision===s.revision){r.stale=!1;continue}try{this.pages.set(t.dir,{revision:s.revision,view:p(s),stale:!1})}catch{}}if(this.recomputeVisible(),this.pendingSeat!==void 0){const t=this.pendingSeat;this.pendingSeat=void 0,this.seatOn(t)}this.reseatSelection()}dropSettled(e){this.settledHere.add(e),this.items=this.items.filter(i=>i.dir!==e),this.pages.delete(e),this.recomputeVisible(),this.reseatSelection(),this.markDirty()}recomputeVisible(){if(this.filter==="all"||this.profile===void 0){this.visible=this.items;return}const e=this.profile.members();this.visible=this.items.filter(i=>{const t=i.source.nodeId;return t!==void 0&&e.has(t)})}reseatSelection(){const e=this.selectedDir===void 0?-1:this.visible.findIndex(i=>i.dir===this.selectedDir);if(e>=0){this.selectedIndex=e;return}if(!(this.adapter!==void 0&&this.selectedDir!==void 0&&this.items.some(i=>i.dir===this.selectedDir))){if(this.visible.length===0){this.selectedIndex=0,this.selectedDir=void 0;return}this.selectedIndex=Math.min(Math.max(0,this.selectedIndex),this.visible.length-1),this.selectedDir=this.visible[this.selectedIndex].dir}}highlightIndex(){return this.selectedDir===void 0?-1:this.visible.findIndex(e=>e.dir===this.selectedDir)}currentRow(){const e=this.highlightIndex();return e>=0?this.visible[e]:void 0}scopeHeading(){return this.profile===void 0?{label:"all profiles"}:this.filter==="profile"?{label:this.profile.label,hint:"P all profiles"}:{label:"all profiles",hint:`P ${this.profile.label} only`}}refreshOutcome(e){if(this.refreshError=e,e===void 0){this.invalidate();return}this.markDirty()}start(){this.started||this.closed||(this.started=!0,this.watchRoots())}async invalidate(){for(const e of this.pages.values())e.stale=!0;if(await this.rescan(),!this.closed){if(this.adapter!==void 0&&this.open!==void 0){await this.reloadSelectedPage();return}this.markDirty()}}resize(e,i){this.cols=e,this.rows=i,this.adapter?.resize(this.detailSize().cols,this.detailSize().rows),this.markDirty()}render(){const e=y(this.cols,this.rows,this.screen);if(e.mode==="minimum")return[`${w}Resize terminal to at least 60\xD718 to use inbox.${n}`];const i=H(this.visible,e.listWidth,this.highlightIndex(),this.scopeHeading(),e.height),t=this.detailLines(e.detailWidth,e.height);if(e.mode==="list")return this.withStatus(i);if(e.mode==="detail")return this.withStatus(t);const s=[],r=`${C}\u2502${n}`;for(let d=0;d<e.height;d++){const l=u(i[d]??"",e.listWidth),c=u(t[d]??"",e.detailWidth),g=" ".repeat(Math.max(0,e.listWidth-I(l)));s.push(`${l}${g}${r}${c}`)}return this.withStatus(s)}handleKey(e,i){if(i.ctrl&&e==="c"){this.close();return}if(this.screen==="detail"&&this.adapter!==void 0){if((e==="g"||e==="G")&&this.adapter.canAcceptHostKeys()&&!this.adapter.hasShortcut(e)){this.focusSelectedSource();return}this.adapter.handleKey(e,i),this.markDirty();return}if(this.cancelConfirmation!==void 0){if(e==="y"||e==="Y"){const t=this.cancelConfirmation.item;this.cancelConfirmation=void 0,this.status="canceling\u2026",this.cancelFromInbox(t)}else(e==="n"||e==="N"||i.escape)&&(this.cancelConfirmation=void 0,this.status=void 0);this.markDirty();return}if(e==="P"&&this.profile!==void 0){this.toggleProfileFilter(),this.markDirty();return}if(e==="x"||e==="X"){const t=this.currentRow();t!==void 0&&(this.cancelConfirmation={item:t},this.status=void 0),this.markDirty();return}if(e==="s"||e==="S"){this.sendFastAction(),this.markDirty();return}if(i.escape||e==="q"){this.close();return}e==="j"||i.downArrow?this.select(this.selectedIndex+1):e==="k"||i.upArrow?this.select(this.selectedIndex-1):e==="g"||e==="G"?this.focusSelectedSource():(i.return||e==="a")&&this.activate(),this.markDirty()}toggleProfileFilter(){this.filter=this.filter==="profile"?"all":"profile",this.recomputeVisible(),this.reseatSelection()}async sendFastAction(){const e=this.currentRow();if(e===void 0)return;if(e.kind!=="page"||e.fastAction===void 0){this.status="no recommended answer on this ticket \u2014 Enter opens it";return}const i=e.fastAction.kind==="acknowledge"?"acknowledged":`sent: ${E(e)??"recommended answer"}`;this.submittingDir=e.dir;try{await k(e.id,e.fastAction.responses),this.status=i,this.dropSettled(e.dir)}catch(t){this.status=D(t)==="already_settled"?x(await this.requestOrNull(e.id)):m(t)}finally{this.submittingDir=void 0,await this.rescan(),this.markDirty()}}async cancelFromInbox(e){this.submittingDir=e.dir;try{e.kind==="review"?await f().cancelReview(e.id,{reason:"Canceled from the inbox."}):await G(e.id,{reason:"Canceled from the inbox.",actor:"human"}),this.status="canceled",this.dropSettled(e.dir)}catch(i){this.status=m(i)}finally{this.submittingDir=void 0,await this.rescan(),this.markDirty()}}async activate(){const e=this.currentRow();if(e===void 0)return;if(e.kind==="review"){this.activateReview(e);return}const i=this.pages.get(e.dir);if(i!==void 0){this.openDetail(e,i.view,i.revision),this.reloadSelectedPage();return}let t,s;try{const r=await f().getHumanInboxPage(e.inboxTicketId);if(r.state==="resolved"||r.state==="canceled"){this.status=v(r),await this.rescan();return}t=p(r),s=r.revision,this.pages.set(e.dir,{revision:s,view:t,stale:!1})}catch{this.status="page could not be read",await this.invalidate();return}this.openDetail(e,t,s)}openDetail(e,i,t){this.closed||this.open!==void 0||this.adapter!==void 0||(this.open={dir:e.dir,id:e.id,ticketId:e.inboxTicketId},this.screen="detail",this.adapter=new j({ticketId:e.inboxTicketId,page:i,productKinds:L(),cols:this.detailSize().cols,rows:this.detailSize().rows,onDirty:h(()=>this.markDirty(),"onDirty"),onEditorRequest:h(()=>this.editActivePageInput(),"onEditorRequest"),onBack:h(()=>{this.leaveDetail(),this.markDirty()},"onBack"),onComplete:h(s=>{this.complete(s)},"onComplete")}),this.openRevision=t,this.watchSelected(e.dir),this.markDirty())}activateReview(e){e.url===void 0?this.status="Reviews open on canvas.northlight.ai; this runtime has no canvas host":(Y(e.url),this.status="opened the review in your browser"),this.markDirty()}selectDir(e){this.seatOn(e)&&this.markDirty()}seatOn(e){let i=this.visible.findIndex(t=>t.dir===e);return i<0&&this.items.some(t=>t.dir===e)&&(this.filter="all",this.recomputeVisible(),i=this.visible.findIndex(t=>t.dir===e)),i<0?!1:(this.select(i),!0)}async reloadSelectedPage(){const e=this.open;if(this.adapter===void 0||e===void 0){this.markDirty();return}try{const i=await f().getHumanInboxPage(e.ticketId);if(this.closed||this.open!==e||this.adapter===void 0)return;if(i.state==="resolved"||i.state==="canceled"){this.status=this.submittingDir===e.dir?this.status:v(i),this.submittingDir!==e.dir&&(this.leaveDetail(),this.rescan()),this.markDirty();return}i.revision!==this.openRevision&&(this.openRevision=i.revision,this.adapter.reload(p(i)))}catch{this.status="page could not be read"}this.markDirty()}close(){if(!this.closed){this.closed=!0,this.started=!1,this.leaveDetail();for(const e of this.watchers)e.close();this.watchers=[],this.selectedWatcher?.close(),this.selectedWatcher=void 0,this.options.onClosed()}}async complete(e){const i=this.open;if(i!==void 0){this.submittingDir=i.dir;try{await k(i.id,e)}catch(t){this.submittingDir=void 0,this.status=m(t);const s=D(t);if(s==="unreachable"||s==="other"){this.markDirty();return}s==="already_settled"&&(this.status=x(await this.requestOrNull(i.id))),this.leaveDetail(),await this.rescan(),this.markDirty();return}this.submittingDir=void 0,this.leaveDetail(),this.dropSettled(i.dir),this.recordResolved(i)}}async recordResolved(e){let i=!1;try{i=(await this.scan()).some(t=>t.dir===e.dir)}catch{}i||this.settledHere.delete(e.dir),q({level:i?"warn":"info",event:"inbox.page.resolved",fields:{ticket_id:e.id,request_settled:Q(await this.requestOrNull(e.id)),still_listed:i}})}editActivePageInput(){const e=this.adapter?.inputBuffer();if(e===void 0)return;const i=this.host.suspendForChild();let t={text:e};try{t=K(e)}finally{i(),this.adapter?.setInputBuffer(t.text),t.error!==void 0&&(this.status=t.error),this.markDirty()}}leaveDetail(){this.adapter?.close(),this.adapter=void 0,this.selectedWatcher?.close(),this.selectedWatcher=void 0,this.open=void 0,this.openRevision=void 0,this.screen="list",this.reseatSelection()}select(e){this.visible.length!==0&&(this.selectedIndex=Math.max(0,Math.min(e,this.visible.length-1)),this.selectedDir=this.visible[this.selectedIndex].dir)}detailSize(){const e=y(this.cols,this.rows,this.screen);return{cols:Math.max(1,e.detailWidth-2),rows:e.height}}detailLines(e,i){if(this.adapter!==void 0)return this.adapter.render();const t=this.currentRow();if(t===void 0)return this.passiveDetailLines(e,i);const s=this.focusAvailable(t.dir)?` ${o}g${n} chat`:"",r=t.kind==="page"&&t.fastAction!==void 0?` ${o}s${n} ${t.fastAction.kind==="acknowledge"?"acknowledge":"send recommended"}`:"",d=t.kind==="page"?[` ${o}Enter${n} opens the full page ${o}\u2191\u2193/jk${n} select${r} ${o}x${n} cancel`,` ${o}Page:${n} c comment u/d scroll${s} ${o}q${n} close`]:[` ${o}Enter${n} opens the review in your browser ${o}\u2191\u2193/jk${n} select ${o}x${n} cancel`,` ${s} ${o}q${n} close`],l=Math.max(0,i-d.length),c=this.passiveDetailLines(e,l);for(;c.length<l;)c.push("");return[...c,...d.map(g=>u(g,e))]}focusAvailable(e){return this.host.capabilities.canFocusNode}async focusSelectedSource(){const e=this.screen==="detail"?this.open?.dir:this.currentRow()?.dir,i=e===void 0?void 0:this.items.find(s=>s.dir===e);if(i===void 0||this.focusingSource)return;const t=i.source.nodeId;if(t===void 0){this.status="This request was not raised by a canvas node",this.markDirty();return}this.focusingSource=!0;try{await this.host.focusNode(t)?this.close():(this.status="Could not open that node\u2019s viewer",this.markDirty())}finally{this.focusingSource=!1}}pagePreviewBody(e,i){const t=this.pages.get(e.dir);if((t===void 0||t.stale)&&this.fetchPage(e),t===void 0)return this.pageFailed.has(e.dir)?[`${o}page could not be read${n}`]:[];const s=this.preview;if(s!==void 0&&s.dir===e.dir&&s.revision===t.revision&&s.width===i&&s.links===b())return s.lines;const r=J(t.view,i);return this.preview={dir:e.dir,revision:t.revision,width:i,links:b(),lines:r},r}prefetchPages(){const i=[this.currentRow(),...this.visible].filter(s=>s!==void 0&&s.kind==="page"&&(this.pages.get(s.dir)?.stale??!0)),t=h(()=>{for(;!this.closed&&this.pageFetching.size<U&&i.length>0;){const s=i.shift();this.pageFetching.has(s.dir)||this.pages.get(s.dir)?.stale===!1||this.fetchPage(s)?.finally(t)}},"pump");t()}fetchPage(e){if(!this.pageFetching.has(e.dir))return this.pageFetching.add(e.dir),f().getHumanInboxPage(e.inboxTicketId).then(i=>{if(this.pageFetching.delete(e.dir),this.closed||(this.pageFailed.delete(e.dir),!this.items.some(s=>s.dir===e.dir)))return;const t=this.pages.get(e.dir);if(t!==void 0&&t.revision===i.revision){t.stale=!1;return}this.pages.set(e.dir,{revision:i.revision,view:p(i),stale:!1}),this.currentRow()?.dir===e.dir&&this.markDirty()},()=>{this.pageFetching.delete(e.dir),!this.closed&&(this.pageFailed.add(e.dir),this.pages.delete(e.dir),this.currentRow()?.dir===e.dir&&this.markDirty())})}async requestOrNull(e){try{return await f().getHumanRequest(e)}catch{return}}passiveDetailLines(e,i){const t=this.currentRow();if(t===void 0)return[` ${o}Select a pending interaction.${n}`];const s=[...A(M(t.title),Math.max(10,e-2)).map(d=>` ${P}${F}${d}${n}`),""];for(const d of R(t.subtitle,Math.max(1,e-2)))s.push(` ${d}`);const r=t.kind==="page"?this.pagePreviewBody(t,e):[`${o}1 file to review${n}`];if(r.length>0){s.push("");const d=Math.max(0,i-s.length),l=r.length<=d?r:r.slice(0,Math.max(0,d-1));for(const c of l)s.push(` ${c}`);l.length<r.length&&s.push(` ${o}\u2026 +${r.length-l.length} more lines${n}`)}return s.map(d=>u(d,e)).slice(0,Math.max(1,i))}withStatus(e){const i=this.cancelConfirmation===void 0?this.refreshError??this.status:`cancel \u201C${this.cancelConfirmation.item.title}\u201D? y yes \xB7 n/Esc no`;if(i===void 0||this.rows<1)return e;const t=[...e];for(;t.length<this.rows;)t.push("");return t[this.rows-1]=`${w}${i}${n}`,t}markDirty(){this.options.onDirty()}watchRoots(){const e=O(this.options.onInboxActivity??(()=>{this.invalidate()}));this.watchers.push({close:e})}watchSelected(e){this.selectedWatcher?.close();try{this.selectedWatcher=$(e,()=>{this.invalidate()})}catch{this.selectedWatcher=void 0}}}async function X(){const{tickets:a}=await f().listHumanInbox({includePages:!0});return a.map(V).sort(z)}h(X,"defaultScan");function J(a,e){const i=a.manifest.dialect==="html"?B(a.document):N(a.document,a.manifest);return T(a.manifest,i,Math.min(Math.max(20,e-4),100),Math.max(20,e-4))}h(J,"previewLines");function Q(a){return a!==void 0&&a.state!=="pending"}h(Q,"isSettled");function x(a){return a?.page===void 0?"ticket was already resolved":v(a.page)}h(x,"settledStatus");export{be as InboxController};
|
|
@@ -18,6 +18,7 @@ export interface InboxPageView {
|
|
|
18
18
|
revision: string;
|
|
19
19
|
}
|
|
20
20
|
export declare function inboxRowFromDTO(dto: InboxTicketSummaryDTO): InboxRow;
|
|
21
|
+
export declare function listedPageOf(row: InboxRow): InboxPageDTO | undefined;
|
|
21
22
|
export declare function pageViewFromDTO(dto: InboxPageDTO): InboxPageView;
|
|
22
23
|
/** The stored one-line answer digest, or undefined when the page was not
|
|
23
24
|
* answered. A canceled page carries no digest by construction. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=Object.defineProperty;var n=(e,i)=>a(e,"name",{value:i,configurable:!0});import{validatePageManifest as u}from"../../core/human/page-schema.js";function d(e){return e}n(d,"responsesFromDTO");function l(e){return{dir:e.request_dir,id:e.request_id,inboxTicketId:e.ticket_id,kind:"page",title:e.title,subtitle:e.subtitle??"",dialect:e.dialect,placement:e.placement,inbox:e.inbox,steps:e.steps,slotKinds:e.slot_kinds,awaitsResponse:e.awaits_response,source:e.source,emittedAt:e.emitted_at,recommendedOptions:(e.recommended_options??[]).map(i=>({slotId:i.slot_id,optionId:i.option_id,label:i.label})),...e.fast_action===void 0?{}:{fastAction:{kind:e.fast_action.kind,responses:e.fast_action.responses}},state:e.state,...e.answer_digest===void 0?{}:{answerDigest:e.answer_digest}}}n(l,"pageRowFromDTO");function c(e){return{dir:e.request_dir,id:e.request_id,inboxTicketId:e.ticket_id,kind:"review",title:e.title,subtitle:e.subtitle,blockedSince:e.blocked_since,source:e.source,...e.url===void 0?{}:{url:e.url}}}n(c,"reviewRowFromDTO");function f(e){if(e.kind!=="page")return c(e);const i=l(e);return e.page!==void 0&&r.set(i,e.page),i}n(f,"inboxRowFromDTO");const r=new WeakMap;function m(e){return r.get(e)}n(m,"listedPageOf");function g(e){return{manifest:u(e.page),document:e.source_document,progress:e.progress===null?null:e.progress.responses,state:e.state,revision:e.revision}}n(g,"pageViewFromDTO");function k(e){const i=e.result;if(!(i===null||i.kind!=="page"))return i.summary.replace(/\s+/g," ").trim()}n(k,"answerDigestOf");function _(e){const i=e.result;return i!==null&&i.kind==="canceled"?"ticket was already canceled":i!==null&&i.kind==="page"?"ticket was already resolved: page submitted":"ticket was already resolved"}n(_,"settledStatusOf");function w(e,i){const s=n(t=>t.kind==="page"?t.emittedAt:t.blockedSince,"time");return s(i).localeCompare(s(e))||e.id.localeCompare(i.id)}n(w,"byNewestFirst");export{k as answerDigestOf,w as byNewestFirst,f as inboxRowFromDTO,m as listedPageOf,g as pageViewFromDTO,_ as settledStatusOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var g=Object.defineProperty;var t=(o,n)=>g(o,"name",{value:n,configurable:!0});import{InboxController as x}from"./controller.js";import{byNewestFirst as y,inboxRowFromDTO as v}from"./dto-adapt.js";import{cliClient as b}from"../../commands/api-client.js";import{decodeInboxKey as C}from"./tui/keys.js";import{clipLine as I,visibleWidth as R}from"./tui/ansi.js";class S{static{t(this,"InboxComponent")}controller;focused=!1;rows=0;width=-1;height=-1;handle;constructor(n){this.controller=n}setRows(n){this.rows=n}render(n){const i=this.rows;return(n!==this.width||i!==this.height)&&(this.width=n,this.height=i,this.controller.resize(n,i)),G(this.controller.render(),n,i)}handleInput(n){const{input:i,key:d}=C(n);this.controller.handleKey(i,d)}invalidate(){this.handle?.invalidate()}setHandle(n){this.handle=n}}function G(o,n,i){const d=o.slice(0,i);for(;d.length<i;)d.push("");return d.map(c=>{const a=I(c,n);return a+" ".repeat(Math.max(0,n-R(a)))})}t(G,"padFrame");async function M(o){if(o.scan!==void 0)return o.scan();const{tickets:n}=await b().listHumanInbox({includePages:!0});return n.map(v).sort(y)}t(M,"probeRows");async function p(o,n){try{return await n()}catch(i){throw new Error(`Could not load ${o}: ${i instanceof Error?i.message:String(i)}`)}}t(p,"named");function N(o){let n;const i=t(()=>{const e=n;e===void 0||e.closed||(e.closed=!0,n=void 0,e.controller?.close(),e.handle?.close(),e.controller=void 0,e.handle=void 0)},"close"),d=t(e=>{if(e.closed||n!==e)return;const s=new x({host:o.host,onDirty:t(()=>e.handle?.invalidate(),"onDirty"),onClosed:i,...o.scan===void 0?{}:{scan:o.scan},onInboxActivity:t(()=>a(e),"onInboxActivity"),...e.preselectDir===void 0?{}:{initialSelection:e.preselectDir},...e.initialRows===void 0?{}:{initialRows:e.initialRows},...o.profile===void 0?{}:{profile:{id:o.profile.id,label:o.profile.label,members:t(()=>e.profileMembers,"members")}}}),r=new S(s);e.controller=s;try{const l=o.host.mount(r);e.handle=l,r.setHandle(l),l.onClose(()=>{e.handle===l&&(e.handle=void 0),s.close()}),s.start()}catch(l){throw i(),l}},"mount"),c=t(async(e,s)=>{const r=o.profile,l=s?p("inbox visibility",()=>M(o)):void 0,f=r===void 0?void 0:p("profile membership",()=>b().listNodes({profile_id:r.id})),[u,m]=await Promise.all([l,f]);return u!==void 0&&(e.initialRows=u),m===void 0?void 0:new Set(m.map(w=>w.node_id))},"load"),a=t((e,s=!1)=>{if(!s&&e.controller!==void 0&&o.profile===void 0){e.controller.invalidate();return}const r=++e.refreshGeneration;c(e,e.controller===void 0).then(l=>{e.closed||n!==e||r!==e.refreshGeneration||(l!==void 0&&(e.profileMembers=l),e.controller===void 0?d(e):e.controller.refreshOutcome())},l=>{if(e.closed||n!==e||r!==e.refreshGeneration)return;const f=l instanceof Error?l.message:String(l);if(s){i(),o.host.notice(f);return}e.controller?.refreshOutcome(f)})},"refresh"),h=t(e=>{if(n!==void 0){e!==void 0&&n.controller?.selectDir(e);return}if(o.host.capabilities.remote){o.host.notice("The inbox is unavailable in a remote attach.");return}const s={closed:!1,refreshGeneration:0,profileMembers:new Set,...e===void 0?{}:{preselectDir:e}};n=s,a(s,!0)},"open");return{toggle:t(()=>{if(n!==void 0){i();return}h()},"toggle"),open:h,close:i,isOpen:t(()=>n!==void 0,"isOpen")}}t(N,"createInboxSurface");export{N as createInboxSurface};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)},"render")}),j=i({name:"show",description:"show one registered remote canvas target",whenToUse:"inspecting a single remote canvas target\u2019s config \u2014 masked the same way as `list`.",help:{name:"canvas config show",summary:"show one remote canvas target (masked \u2014 no raw token)",params:[{kind:"positional",name:"name",required:!0,constraint:"Target name."}],output:[{name:"name",type:"string",required:!0,constraint:"The target name."},{name:"previewEndpoint",type:"string",required:!0,constraint:"The stored preview endpoint."},{name:"relayTokenRef",type:"string",required:!0,constraint:"The secrets-store key holding the token."},{name:"cpOrigin",type:"string",required:!1,constraint:"The stored control-plane origin, when this target has one distinct from the preview endpoint."},{name:"tokenStored",type:"boolean",required:!0,constraint:"Whether a token is currently stored under relayTokenRef."}],outputKind:"object",effects:["Read-only."]},run:a(async n=>{const e=n.name,t=d(o).remoteCanvas.targets[e];if(t===void 0)throw new c({error:"not_found",message:`no remote canvas target named '${e}'`,next:"List configured targets with `crtr canvas config list`."});return f(e,t,p(o))},"run"),render:a(n=>`${n.name} \u2014 ${n.previewEndpoint} (${n.tokenStored?`token ${n.fingerprint}`:"no token stored"})`,"render")}),C=i({name:"remove",description:"remove a registered remote canvas target and its stored token",whenToUse:"decommissioning a remote canvas target \u2014 drops it from config.json and deletes its raw token from the secrets store.",help:{name:"canvas config remove",summary:"remove a remote canvas target and its stored token",params:[{kind:"positional",name:"name",required:!0,constraint:"Target name."}],output:[],outputKind:"object",effects:["Deletes remoteCanvas.targets.<name> from config.json.","Deletes the stored token under relayTokenRef from the secrets store."]},run:a(async n=>{const e=n.name,t=d(o).remoteCanvas.targets[e];if(t===void 0)throw new c({error:"not_found",message:`no remote canvas target named '${e}'`,next:"List configured targets with `crtr canvas config list`."});return await m(o,s=>{delete s.remoteCanvas.targets[e]}),y(t.relayTokenRef,o),{}},"run"),render:a(()=>"Removed remote canvas target.","render")}),x=h({name:"config",description:"register/list/inspect/remove remote canvas targets",whenToUse:"setting up or auditing a remote canvas target (preview endpoint + relay token) before selecting one with `crtr canvas use`.",help:{name:"canvas config",summary:"manage named remote canvas targets",model:"A remote canvas target is a preview endpoint + a relay token registered under a name. `add` registers one (token goes to the 0600 secrets store, never config.json); `list`/`show` display masked entries (fingerprint only, never the raw token); `remove` deletes both the config entry and the stored token. Select a target for read commands with `crtr canvas use <name>`, or back to
|
|
1
|
+
var l=Object.defineProperty;var a=(n,e)=>l(n,"name",{value:e,configurable:!0});import{defineBranch as h,defineLeaf as i}from"../core/command.js";import{InputError as c,readStdinRaw as k}from"../core/io.js";import{readConfig as d,updateConfig as m}from"../core/config.js";import{readSecrets as p,setRelayToken as w,deleteRelayToken as y,fingerprint as T}from"../core/secrets.js";const o="user";function f(n,e,r){const t=r.relayTokens[e.relayTokenRef];return{name:n,previewEndpoint:e.previewEndpoint,relayTokenRef:e.relayTokenRef,...e.cpOrigin?{cpOrigin:e.cpOrigin}:{},tokenStored:t!==void 0&&t!=="",...t!==void 0&&t!==""?{fingerprint:T(t)}:{}}}a(f,"maskedTarget");const R=i({name:"add",description:"register a remote canvas target (preview endpoint + relay token)",whenToUse:"wiring up a remote canvas so `node inspect` or `surface attach --canvas` can reach it \u2014 stores the preview endpoint in config.json and the raw relay token in the 0600 secrets store (never together, never persisted to config.json or logged). Re-running with the same name overwrites both.",help:{name:"canvas config add",summary:"register (or overwrite) a named remote canvas target",params:[{kind:"positional",name:"name",required:!0,constraint:"Target name \u2014 the id every other `canvas config`/`canvas use`/`--canvas` reference uses."},{kind:"flag",name:"preview",type:"string",required:!0,constraint:"The Blaxel preview endpoint base URL (e.g. https://<hash>.preview.bl.run)."},{kind:"flag",name:"relay-token",type:"string",required:!0,constraint:"Must be exactly `-` \u2014 the raw token is read from stdin, never argv (keeps it out of shell history). Any other value is rejected."},{kind:"flag",name:"cp",type:"string",required:!1,constraint:"Optional control-plane origin, when this target has one distinct from the preview endpoint."}],output:[],outputKind:"object",effects:["Writes remoteCanvas.targets.<name> to config.json (previewEndpoint, relayTokenRef, cpOrigin).","Writes the raw token to the 0600 secrets store under relayTokenRef \u2014 never to config.json or stdout."]},run:a(async n=>{const e=n.name,r=n.preview,t=n.relayToken,s=n.cp;if(t!=="-")throw new c({error:"invalid_relay_token_arg",message:"relay token must be piped on stdin \u2014 pass `--relay-token -`",field:"relay-token",next:'Re-run with `--relay-token -` and pipe the raw token on stdin (e.g. `echo "$TOKEN" | crtr canvas config add <name> --preview <url> --relay-token -`).'});const g=(await k()).trim();if(g==="")throw new c({error:"empty_token",message:"relay token is empty",field:"relay-token",next:"Pass a non-empty token, or `--relay-token -` and pipe it on stdin."});const u={previewEndpoint:r,relayTokenRef:e,...s?{cpOrigin:s}:{}};return await m(o,v=>{v.remoteCanvas.targets[e]=u}),w(e,g,o),{}},"run"),render:a(()=>"Registered remote canvas target (token stored).","render")}),b=i({name:"list",description:"list registered remote canvas targets",whenToUse:"checking which remote canvas targets exist before `canvas use`/`--canvas <name>` \u2014 never prints a raw token, only a non-reversible fingerprint.",help:{name:"canvas config list",summary:"list every registered remote canvas target (masked \u2014 no raw tokens)",output:[{name:"targets",type:"object[]",required:!0,constraint:"Each: {name, previewEndpoint, relayTokenRef, cpOrigin?, tokenStored, fingerprint?}. fingerprint is a non-reversible sha256 prefix, present only when a token is stored."}],outputKind:"object",effects:["Read-only: reads config.json and the secrets-store token presence/fingerprint (never the raw token)."]},run:a(async()=>{const n=d(o),e=p(o);return{targets:Object.entries(n.remoteCanvas.targets).map(([t,s])=>f(t,s,e))}},"run"),render:a(n=>{const e=n.targets;return e.length===0?"No remote canvas targets configured.":e.map(r=>`${r.name} \u2014 ${r.previewEndpoint} (${r.tokenStored?`token ${r.fingerprint}`:"no token stored"})`).join(`
|
|
2
|
+
`)},"render")}),j=i({name:"show",description:"show one registered remote canvas target",whenToUse:"inspecting a single remote canvas target\u2019s config \u2014 masked the same way as `list`.",help:{name:"canvas config show",summary:"show one remote canvas target (masked \u2014 no raw token)",params:[{kind:"positional",name:"name",required:!0,constraint:"Target name."}],output:[{name:"name",type:"string",required:!0,constraint:"The target name."},{name:"previewEndpoint",type:"string",required:!0,constraint:"The stored preview endpoint."},{name:"relayTokenRef",type:"string",required:!0,constraint:"The secrets-store key holding the token."},{name:"cpOrigin",type:"string",required:!1,constraint:"The stored control-plane origin, when this target has one distinct from the preview endpoint."},{name:"tokenStored",type:"boolean",required:!0,constraint:"Whether a token is currently stored under relayTokenRef."}],outputKind:"object",effects:["Read-only."]},run:a(async n=>{const e=n.name,t=d(o).remoteCanvas.targets[e];if(t===void 0)throw new c({error:"not_found",message:`no remote canvas target named '${e}'`,next:"List configured targets with `crtr canvas config list`."});return f(e,t,p(o))},"run"),render:a(n=>`${n.name} \u2014 ${n.previewEndpoint} (${n.tokenStored?`token ${n.fingerprint}`:"no token stored"})`,"render")}),C=i({name:"remove",description:"remove a registered remote canvas target and its stored token",whenToUse:"decommissioning a remote canvas target \u2014 drops it from config.json and deletes its raw token from the secrets store.",help:{name:"canvas config remove",summary:"remove a remote canvas target and its stored token",params:[{kind:"positional",name:"name",required:!0,constraint:"Target name."}],output:[],outputKind:"object",effects:["Deletes remoteCanvas.targets.<name> from config.json.","Deletes the stored token under relayTokenRef from the secrets store."]},run:a(async n=>{const e=n.name,t=d(o).remoteCanvas.targets[e];if(t===void 0)throw new c({error:"not_found",message:`no remote canvas target named '${e}'`,next:"List configured targets with `crtr canvas config list`."});return await m(o,s=>{delete s.remoteCanvas.targets[e]}),y(t.relayTokenRef,o),{}},"run"),render:a(()=>"Removed remote canvas target.","render")}),x=h({name:"config",description:"register/list/inspect/remove remote canvas targets",whenToUse:"setting up or auditing a remote canvas target (preview endpoint + relay token) before selecting one with `crtr canvas use`.",help:{name:"canvas config",summary:"manage named remote canvas targets",model:"A remote canvas target is a preview endpoint + a relay token registered under a name. `add` registers one (token goes to the 0600 secrets store, never config.json); `list`/`show` display masked entries (fingerprint only, never the raw token); `remove` deletes both the config entry and the stored token. Select a target for read commands with `crtr canvas use <name>`, or back to the default with `crtr canvas use --default`."},children:[R,b,j,C]});export{x as canvasConfigBranch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var i=Object.defineProperty;var r=(a,e)=>i(a,"name",{value:e,configurable:!0});import{defineLeaf as
|
|
1
|
+
var i=Object.defineProperty;var r=(a,e)=>i(a,"name",{value:e,configurable:!0});import{defineLeaf as u}from"../core/command.js";import{InputError as o}from"../core/io.js";import{updateState as c}from"../core/config.js";import{getRemoteCanvasTarget as d}from"../core/remote-canvas-target.js";const s="user",h=u({name:"use",description:"select the durable default canvas for read commands (a remote target, or the default account canvas)",whenToUse:"switching what remote-capable read commands such as `node inspect list/show` read from by default, without passing `--canvas <name>` on every invocation \u2014 select a remote target registered via `crtr canvas config add`, or switch back to the default account canvas. A command\u2019s own `--canvas <name>` flag always overrides this for that one call.",help:{name:"canvas use",summary:"select the durable default canvas (a registered remote target, or the default account canvas) for read commands",params:[{kind:"positional",name:"name",required:!1,constraint:"A remote canvas target registered via `crtr canvas config add`. Mutually exclusive with --default; exactly one of the two is required."},{kind:"flag",name:"default",type:"bool",required:!1,constraint:"Clear the selection and use the default canvas, the account's canvas in Northlight. Mutually exclusive with <name>."}],output:[],outputKind:"object",effects:["Writes state.json\u2019s activeCanvas (user scope)."]},run:r(async a=>{const e=a.name,t=a.default===!0;if(e!==void 0&&t)throw new o({error:"ambiguous_scope",message:"<name> and --default are mutually exclusive",next:"Pass a target name to go remote, or --default to go back to the default \u2014 not both."});if(e===void 0&&!t)throw new o({error:"missing_target",message:"nothing to select \u2014 pass a target name or --default",next:"Pass a target name (see `crtr canvas config list`) to go remote, or --default to go back to the default."});if(t)return await c(s,n=>{n.activeCanvas=null}),{};if(d(e,s)===void 0)throw new o({error:"not_found",message:`no remote canvas target named '${e}'`,next:"List configured targets with `crtr canvas config list`, or register one with `crtr canvas config add`."});return await c(s,n=>{n.activeCanvas=e}),{}},"run"),render:r(()=>"Canvas selection updated.","render")});export{h as canvasUseLeaf};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),"leaf")},run:h(async n=>{const e=h(c=>{const b=n[c];return b!==void 0&&b!==""?b.split(",").map(v=>v.trim()).filter(v=>v!==""):void 0},"csv"),o=e("status"),s=e("kind"),p=e("mode"),i=e("lifecycle"),
|
|
3
|
-
`)};return(i.runner==="blaxel"||i.profile_id!==null&&await
|
|
4
|
-
`));const d=h((
|
|
5
|
-
`);return`${g.length} ${
|
|
1
|
+
var A=Object.defineProperty;var h=(n,e)=>A(n,"name",{value:e,configurable:!0});import{defineBranch as P,defineLeaf as $}from"../../core/command.js";import{InputError as k}from"../../core/io.js";import{requireScope as I}from"../../core/errors.js";import{isPidAlive as L}from"../../core/canvas/pid.js";import{fullName as x}from"../../core/canvas/labels.js";import{fuzzyMatch as F}from"../../core/tui/fuzzy.js";import{nodeSnapshotLeaf as O}from"../node-snapshot.js";import{nodeTranscriptLeaf as C}from"../node-transcript.js";import{nodeContextLeaf as U}from"../node-context.js";import{ApiError as E}from"../../api/index.js";import{describeVendorLimit as D}from"../../core/provider-failure.js";import{cliClient as _,cliCanvasSource as S,rethrowAsCliError as w}from"../api-client.js";import{RemoteCanvasSource as q}from"../../core/canvas/remote-canvas-source.js";import{kindsStateBlock as z,profilesStateBlock as M,resolveProfileViaDaemon as B}from"../profile/daemon-profiles.js";import{focusViewer as V,nodeInPane as W}from"../surface/node/placement.js";const K=$({name:"list",description:"list nodes on the canvas",whenToUse:"you want a flat roster of the nodes on the canvas, sliced by displayed name, status, kind, mode, lifecycle, profile, cwd, and graph scope (--under a node, for that node plus its subscription descendants). The filters AND together. Use `node inspect show` instead to drill into one node and its spine neighbors, `canvas dashboard` for the tree shape, and `canvas attention` to find nodes blocked on the user",help:{name:"node inspect list",summary:"list nodes on the canvas, filtered by any combination of attribute slices and a graph-scope (--under) that AND together",params:[{kind:"flag",name:"status",type:"string",required:!1,constraint:"Filter status (comma-separated for several; accepted values: active, idle, done, dead, canceled). NOTE: `active` means the engine process is live (never closed), NOT that the node is generating right now \u2014 an active node is usually dormant between turns. To tell working-vs-idle, check the pi session-file mtime or CPU, not status."},{kind:"flag",name:"kind",type:"string",required:!1,constraint:"Filter by persona kind (comma-separated for several). The <kinds> list below names every top-level installable kind; a registered sub-kind filters too by exact path even though it is not listed."},{kind:"flag",name:"mode",type:"string",required:!1,constraint:"Filter by mode (comma-separated for several; accepted values: base, orchestrator)."},{kind:"flag",name:"lifecycle",type:"string",required:!1,constraint:"Filter by lifecycle (comma-separated for several; accepted values: terminal, resident)."},{kind:"flag",name:"profile",type:"string",required:!1,constraint:"Filter by profile. Against the default account canvas, accepts a profile id or manifest name from the <profiles> list below, or a close-enough name that resolves to the nearest profile. Against a remote canvas, pass the exact profile id carried by its node rows."},{kind:"flag",name:"name",type:"string",required:!1,constraint:"Filter by the displayed node label (handle plus generated description) with the canvas browser\u2019s case-insensitive fuzzy subsequence match."},{kind:"flag",name:"cwd",type:"string",required:!1,constraint:"Filter to nodes pinned to this exact cwd (absolute path). Roster is canvas-wide (all cwds) by default."},{kind:"flag",name:"under",type:"string",required:!1,constraint:'Graph scope: restrict to this node and its subscription descendants (the sub-DAG reachable downward \u2014 its reports, theirs, \u2026). This is "one initiative / my subtree". ANDs with every attribute filter above, narrowing any of them to this subtree.'},{kind:"flag",name:"canvas",type:"string",required:!1,constraint:"Read from the named remote canvas target (see `crtr canvas config list`) instead of the default account canvas. Overrides `crtr canvas use`."}],output:[{name:"nodes",type:"object[]",required:!0,constraint:"Rows include {node_id, name, kind, mode, lifecycle, status, cwd, profile_id, parent, created}. `name` is the displayed node label searched by --name and shown in canvas views. `profile_id` is the stable profile-directory id (null only for historical no-profile nodes)."}],outputKind:"object",effects:["Read-only: lists nodes through the daemon API."]},helpState:{leaf:h(async()=>(await Promise.all([z(),M()])).join(`
|
|
2
|
+
`),"leaf")},run:h(async n=>{const e=h(c=>{const b=n[c];return b!==void 0&&b!==""?b.split(",").map(v=>v.trim()).filter(v=>v!==""):void 0},"csv"),o=e("status"),s=e("kind"),p=e("mode"),i=e("lifecycle"),f=n.profile,r=n.name,l=n.cwd,a=n.under,u=S({canvasName:n.canvas}),d=u instanceof q?f:f===void 0?void 0:(await B(f)).id,m=a!==void 0&&a!=="";if(m&&await u.getNode(a).catch(w)===null)throw new k({error:"not_found",message:`no node: ${a}`,next:"List nodes with `crtr node inspect list`, then pass a real id to --under."});return{nodes:(await u.listNodes({...o!==void 0?{status:o}:{},...m?{under:a}:{}}).catch(w)).filter(c=>!(s!==void 0&&!s.includes(c.kind)||p!==void 0&&!p.includes(c.mode)||i!==void 0&&!i.includes(c.lifecycle)||d!==void 0&&c.profile_id!==d||l!==void 0&&l!==""&&c.cwd!==l)).map(c=>({...c,name:x(c)})).filter(c=>r===void 0||r===""||F(r,c.name))}},"run")}),j=new WeakSet,T=new WeakSet;async function N(n,e){const o=await n.getNode(e.node_id).catch(w);return{node_id:e.node_id,name:o?x(o):"(missing)",kind:o?.kind??"?",status:o?o.intent?`${o.status}/${o.intent}`:o.status:"?",active:e.active}}h(N,"enrichNeighbor");const G=$({name:"show",description:"show a node + its spine neighbors and drill-in pointers",whenToUse:"you want one node in depth \u2014 the debugging entrypoint: a glanceable meta slice, named spine neighbors, a pending-cron count, and exact drill-in paths. Use `node inspect list` for the flat roster or `canvas dashboard` for the whole-tree shape",help:{name:"node inspect show",summary:"show a node in depth \u2014 meta slice, named neighbors, pending-cron count, and drill-in pointers",params:[{kind:"positional",name:"node",required:!0,constraint:"Node id."},{kind:"flag",name:"canvas",type:"string",required:!1,constraint:"Read from the named remote canvas target (see `crtr canvas config list`) instead of the default account canvas. Overrides `crtr canvas use`."}],output:[{name:"node",type:"object",required:!0,constraint:"The full node meta (system prompt + every telemetry field). The render surfaces a glanceable slice; `--json` carries the complete dump."},{name:"fault",type:"object",required:!0,constraint:"The active runtime fault projection, or null: {link, kind, retry: {disposition}, since}."},{name:"reports",type:"object[]",required:!0,constraint:"Who this node subscribes to (its reports/down), each enriched with {node_id, name, kind, status, active} \u2014 these are typically its spawned children."},{name:"managers",type:"object[]",required:!0,constraint:"Who subscribes to this node (its managers/up), same enriched shape."},{name:"pending_crons",type:"number",required:!0,constraint:"How many pending crons were created by this node. Inspect with `crtr cron list`."},{name:"paths",type:"object",required:!0,constraint:"Resolved on-disk locations: {context_dir, session_file} \u2014 read these directly to debug. Reports are documents: `crtr canvas read <node>/reports/<name>`."},{name:"follow_up",type:"string",required:!0,constraint:"The concrete next commands to drill deeper."}],outputKind:"object",effects:["Read-only: reads the node, its edges, and pending crons through crtrd."],preview:{suppressOutput:!0}},run:h(async n=>{const e=n.node,o=n.canvas,s=S({canvasName:o});if(s instanceof q){const t=await s.rawShow(e);if(t===null)throw new k({error:"not_found",message:`no node: ${e}`,next:"List nodes with `crtr node inspect list --canvas <name>`."});const y={...t};return j.add(y),y}const p=await s.getNode(e).catch(t=>w(t,"List nodes with `crtr node inspect list`."));if(p===null)throw new k({error:"not_found",message:`no node: ${e}`,next:"List nodes with `crtr node inspect list`."});const i=p,f=_(),r=await Promise.all((await s.subscriptionsOf(e)).map(t=>N(s,t))),l=await Promise.all((await s.subscribersOf(e)).map(t=>N(s,t))),a=(await f.listCrons({created_by:e}).catch(w)).filter(t=>t.created_by===e).length,u={context_dir:i.paths.context_dir,...i.pi_session_file!==void 0?{session_file:i.pi_session_file}:{}},d=[];d.push(`List the documents it owns (reports, plans, notes): \`crtr canvas list --owner ${e}\`.`),d.push(`Browse its context dir (and its subscriptions') in nvim: \`crtr node inspect context ${e}\`.`),u.session_file&&d.push(`Read the raw conversation transcript: ${u.session_file}`),d.push(`On-disk context dir (ls/read directly): ${u.context_dir}`),a>0&&d.push(`It created ${a} pending cron(s): \`crtr cron list\`.`),r.length>0&&d.push(`Drill into a child/report: \`crtr node inspect show <node_id>\` (${r.map(t=>t.node_id).join(", ")}).`),d.push(`Full machine dump (system prompt + all telemetry): \`crtr --json node inspect show ${e}\`.`);const m={node:i,fault:i.fault??null,reports:r,managers:l,pending_crons:a,paths:u,follow_up:d.join(`
|
|
3
|
+
`)};return(i.runner==="blaxel"||i.profile_id!==null&&await f.getProfileEnvironment(i.profile_id).then(()=>!0,t=>t instanceof E&&(t.status===400||t.status===404)?!1:w(t)))&&T.add(m),m},"run"),render:h(n=>{const e=n.node,o=String(e.node_id),s=e.pi_pid,i=j.has(n)?"remote (liveness not checked locally)":e.runner==="machine"?"on a Mac (liveness not checked locally)":T.has(n)?"in a cloud sandbox (liveness not checked locally)":L(s)?"alive":"dead",f=e.intent?`/${String(e.intent)}`:"",r=n.fault,l=[];l.push(`# ${x(e)} (${o})`);const a=[`- kind/mode/lifecycle: ${e.kind} / ${e.mode} / ${e.lifecycle}`,`- status: ${e.status}${f}`,...r==null?[]:[`- fault: ${String(r.kind)} / ${String(r.retry?.disposition)} since ${String(r.since)}${r.retry?.nextAt===void 0?"":`. Next router probe: ${r.retry.nextAt}.`}${D(r.providerError)}`],`- broker pid: ${s??"(none)"} \u2014 ${i}`,`- cwd: ${e.cwd}`,`- host: ${e.host_kind}`+(e.profile_id?` \xB7 profile ${e.profile_id}`:""),`- cycles: ${e.cycles} \xB7 created ${e.created}`],u=e.machine;u&&a.push(`- machine: ${u.name??u.id}`),e.parent&&a.push(`- parent: ${e.parent}`),a.push(`- creator: ${e.creator??"an external process"}`),e.waiting_for&&a.push(`- waiting for message: ${e.waiting_for}`),l.push(a.join(`
|
|
4
|
+
`));const d=h((m,g)=>{if(g.length===0)return`${m}: none`;const t=["node_id","name","kind","status","active"],y=`| ${t.join(" | ")} |`,c=`| ${t.map(()=>"---").join(" | ")} |`,b=g.map(v=>`| ${t.map(R=>String(v[R]??"").replace(/\|/g,"\\|").replace(/\n/g," ")).join(" | ")} |`).join(`
|
|
5
|
+
`);return`${g.length} ${m}:
|
|
6
6
|
|
|
7
7
|
${y}
|
|
8
8
|
${c}
|
|
9
9
|
${b}`},"table");return l.push(d("reports (down \u2014 subscriptions, usually children)",n.reports)),l.push(d("managers (up \u2014 subscribers)",n.managers)),l.push(`${n.pending_crons} pending cron(s)`),l.push(`Drill deeper:
|
|
10
10
|
${String(n.follow_up)}`),l.join(`
|
|
11
11
|
|
|
12
|
-
`)},"render")}),le=$({name:"fork",description:"fork a node into an independent idle root with the same conversation and durable context",whenToUse:"a conversation has already accumulated the context you want, and you want a new user-driven branch beside it without sending a prompt or inheriting any graph-management responsibility. This copies the conversation and durable context, then waits for the fork\u2019s first real user message to supply its mandate. Use `node new --fork-from` instead when spawning a managed worker with an immediate task",help:{name:"node fork",summary:"create an independent resident root from a node\u2019s conversation and durable context, with no kickoff prompt or model turn",params:[{kind:"flag",name:"node",type:"string",required:!1,constraint:"Source node id. Mutually exclusive with --pane; one of them is required."},{kind:"flag",name:"pane",type:"string",required:!1,constraint:"tmux pane showing the source node. Mutually exclusive with --node; one of them is required. The prefix menu passes this for you and the new viewer splits beside this pane."}],output:[{name:"node_id",type:"string",required:!0,constraint:"The new independent root id."},{name:"focused",type:"boolean",required:!0,constraint:"True when a new viewer pane opened beside the caller; false outside tmux."},{name:"session",type:"string",required:!1,constraint:"The tmux session containing the new viewer, when one opened."}],outputKind:"object",effects:["Creates a resident base-mode root with the source node\u2019s copied pi conversation, cwd, profile, kind, model override, and durable context files. Top-level initial-prompt.md, yield-message.md, result.json, and the jobs/ folder of background bash jobs are omitted.","Copies no parent, subscriptions, subscribers, children, crons, worktree, situational context, or lifecycle responsibility. Sends no prompt and consumes no model turn; the first real user message becomes the fork\u2019s mandate.","Inside tmux, opens and focuses a surface-attach viewer as an even-horizontal split in the source pane\u2019s window. Outside tmux, the root is still created but no interactive fallback opens."]},run:h(async n=>{I("crtr:act","crtr node fork");const e=n.pane,o=n.node;if(o!==void 0&&e!==void 0)throw new k({error:"conflicting_target",message:"--node and --pane are mutually exclusive",next:"Pass the source node id or its viewer pane, not both."});let s=o;if(s===void 0&&e!==void 0&&(s=W(e)),s===void 0||s==="")throw new k({error:"no_node",message:"no source node was provided or found in the pane",next:"Pass --node <id>, or --pane <pane-id> for a pane showing a node."});const p=await _().forkNode(s).catch(w),i=await V(p.node_id,{cwd:p.cwd,name:p.name,...e!==void 0?{pane:e}:{},newPane:!0});return{node_id:p.node_id,focused:i.focused,session:i.session}},"run"),render:h(n=>{const e=n.focused===!0?` Viewer opened beside the source${n.session?` in session ${n.session}`:""}.`:" No viewer opened because no tmux pane was available.";return`Forked independent idle root ${n.node_id}.${e} It will make no model call until its first real user message.`},"render")}),ue=
|
|
12
|
+
`)},"render")}),le=$({name:"fork",description:"fork a node into an independent idle root with the same conversation and durable context",whenToUse:"a conversation has already accumulated the context you want, and you want a new user-driven branch beside it without sending a prompt or inheriting any graph-management responsibility. This copies the conversation and durable context, then waits for the fork\u2019s first real user message to supply its mandate. Use `node new --fork-from` instead when spawning a managed worker with an immediate task",help:{name:"node fork",summary:"create an independent resident root from a node\u2019s conversation and durable context, with no kickoff prompt or model turn",params:[{kind:"flag",name:"node",type:"string",required:!1,constraint:"Source node id. Mutually exclusive with --pane; one of them is required."},{kind:"flag",name:"pane",type:"string",required:!1,constraint:"tmux pane showing the source node. Mutually exclusive with --node; one of them is required. The prefix menu passes this for you and the new viewer splits beside this pane."}],output:[{name:"node_id",type:"string",required:!0,constraint:"The new independent root id."},{name:"focused",type:"boolean",required:!0,constraint:"True when a new viewer pane opened beside the caller; false outside tmux."},{name:"session",type:"string",required:!1,constraint:"The tmux session containing the new viewer, when one opened."}],outputKind:"object",effects:["Creates a resident base-mode root with the source node\u2019s copied pi conversation, cwd, profile, kind, model override, and durable context files. Top-level initial-prompt.md, yield-message.md, result.json, and the jobs/ folder of background bash jobs are omitted.","Copies no parent, subscriptions, subscribers, children, crons, worktree, situational context, or lifecycle responsibility. Sends no prompt and consumes no model turn; the first real user message becomes the fork\u2019s mandate.","Inside tmux, opens and focuses a surface-attach viewer as an even-horizontal split in the source pane\u2019s window. Outside tmux, the root is still created but no interactive fallback opens."]},run:h(async n=>{I("crtr:act","crtr node fork");const e=n.pane,o=n.node;if(o!==void 0&&e!==void 0)throw new k({error:"conflicting_target",message:"--node and --pane are mutually exclusive",next:"Pass the source node id or its viewer pane, not both."});let s=o;if(s===void 0&&e!==void 0&&(s=W(e)),s===void 0||s==="")throw new k({error:"no_node",message:"no source node was provided or found in the pane",next:"Pass --node <id>, or --pane <pane-id> for a pane showing a node."});const p=await _().forkNode(s).catch(w),i=await V(p.node_id,{cwd:p.cwd,name:p.name,...e!==void 0?{pane:e}:{},newPane:!0});return{node_id:p.node_id,focused:i.focused,session:i.session}},"run"),render:h(n=>{const e=n.focused===!0?` Viewer opened beside the source${n.session?` in session ${n.session}`:""}.`:" No viewer opened because no tmux pane was available.";return`Forked independent idle root ${n.node_id}.${e} It will make no model call until its first real user message.`},"render")}),ue=P({name:"inspect",description:"read one node \u2014 its graph position, conversation, and context dir",whenToUse:"reading everything about ONE node you can name: enumerate the roster (`list`), inspect a node and its spine neighbors (`show`), or browse its on-disk context dir (`context`). The documents a node owns are `crtr canvas list --owner <id>`. Use `canvas dashboard` instead to render the whole tree SHAPE, or `canvas attention` to find which nodes are blocked on the user",help:{name:"node inspect",summary:"read one node (or the roster) \u2014 topology, conversation, and context dir",model:"Inspection is read-only and never revives a node. The roster is the selection surface; one-node metadata points to progressively heavier views: a parsed broker snapshot, rendered conversation, or context browser."},children:[K,G,O,C,U]});export{le as nodeFork,ue as nodeInspect};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AccountInstallResult {
|
|
2
|
+
installed: string[];
|
|
3
|
+
failed: {
|
|
4
|
+
item: string;
|
|
5
|
+
message: string;
|
|
6
|
+
}[];
|
|
7
|
+
}
|
|
8
|
+
/** Install what the account lists and this Mac lacks. Never throws: a failure is returned so sign-in and daemon start are not blocked. */
|
|
9
|
+
export declare function installAccountPlugins(): Promise<AccountInstallResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=Object.defineProperty;var i=(n,t)=>s(n,"name",{value:t,configurable:!0});import{currentSnapshot as l}from"../../core/scoped-state/person-store.js";import{TERMINAL_APP as c}from"../../core/scoped-state/imported-mac-installs.js";import{findMarketplaceByName as u,findPluginByName as f}from"../../core/resolver.js";import{addMarketplace as p}from"./market-manage.js";import{installFromMarketplace as m}from"./plugin-manage.js";async function P(){const n={installed:[],failed:[]},t=l().apps[c];if(t===void 0)return n;const o=i(async(e,r)=>{try{await r(),n.installed.push(e)}catch(a){n.failed.push({item:e,message:a instanceof Error?a.message:String(a)})}},"attempt");for(const[e,r]of Object.entries(t.marketplaces))r.url===void 0||u(e,"user")!==null||await o(e,()=>p({url:r.url,...r.ref===void 0?{}:{ref:r.ref},scope:"user"}));for(const[e,r]of Object.entries(t.plugins))r.source_marketplace===void 0||f(e,"user")!==null||await o(e,()=>m({marketplace:r.source_marketplace,plugin:e},"user"));return n}i(P,"installAccountPlugins");export{P as installAccountPlugins};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var c=Object.defineProperty;var o=(r,e)=>c(r,"name",{value:e,configurable:!0});import{defineLeaf as s,defineBranch as f}from"../../core/command.js";import{InputError as d}from"../../core/io.js";import{loadProfileManifest as l,resolveProfileOperand as u}from"../../core/profiles/manifest.js";import{profileCoversCwd as h}from"../../core/profiles/select.js";import{existsSync as m}from"node:fs";import{getDefaultProfileId as p,setDefaultProfileId as y,clearDefaultProfile as w,clearMissingDefaultDirs as g,listDefaultPins as v,resolveBindingCwd as a}from"../../core/profiles/default-binding.js";const x=s({name:"set",description:"pin a profile as the default for the current directory",whenToUse:"you want crtr to stop asking which profile to use here and always default to a chosen one \u2014 the command form of the startup menu\u2019s `d` action. The profile must already cover this directory (add its purview relationship with `profile project add --dir` first if not).",help:{name:"profile default set",summary:"pin a profile as the current directory's default, so the startup chooser stops asking",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr. Must already cover the current directory (be at/above/below it in its project purview); this pin does not change automatic document delivery limits."}],output:[{name:"dir",type:"string",required:!0,constraint:"The resolved directory the pin was set for."},{name:"profile_id",type:"string",required:!0,constraint:"The pinned profile id."},{name:"name",type:"string",required:!0,constraint:"The pinned profile name."},{name:"follow_up",type:"string",required:!0,constraint:"The resulting ambient effect."}],outputKind:"object",effects:["Writes this directory's pin into
|
|
1
|
+
var c=Object.defineProperty;var o=(r,e)=>c(r,"name",{value:e,configurable:!0});import{defineLeaf as s,defineBranch as f}from"../../core/command.js";import{InputError as d}from"../../core/io.js";import{loadProfileManifest as l,resolveProfileOperand as u}from"../../core/profiles/manifest.js";import{profileCoversCwd as h}from"../../core/profiles/select.js";import{existsSync as m}from"node:fs";import{getDefaultProfileId as p,setDefaultProfileId as y,clearDefaultProfile as w,clearMissingDefaultDirs as g,listDefaultPins as v,resolveBindingCwd as a}from"../../core/profiles/default-binding.js";const x=s({name:"set",description:"pin a profile as the default for the current directory",whenToUse:"you want crtr to stop asking which profile to use here and always default to a chosen one \u2014 the command form of the startup menu\u2019s `d` action. The profile must already cover this directory (add its purview relationship with `profile project add --dir` first if not).",help:{name:"profile default set",summary:"pin a profile as the current directory's default, so the startup chooser stops asking",params:[{kind:"positional",name:"profile",required:!0,constraint:"Profile id or manifest name; a close-enough name resolves to the nearest profile, reported on stderr. Must already cover the current directory (be at/above/below it in its project purview); this pin does not change automatic document delivery limits."}],output:[{name:"dir",type:"string",required:!0,constraint:"The resolved directory the pin was set for."},{name:"profile_id",type:"string",required:!0,constraint:"The pinned profile id."},{name:"name",type:"string",required:!0,constraint:"The pinned profile name."},{name:"follow_up",type:"string",required:!0,constraint:"The resulting ambient effect."}],outputKind:"object",effects:["Writes this directory's pin into `the user-root `profile-defaults.json` state`. The next launch here auto-picks this profile with no prompt (override once with `crtr --pick-profile`)."]},run:o(async r=>{const e=process.cwd(),t=a(e),i=u(r.profile);if(!h(i,t))throw new d({error:"not_covered",message:`profile "${i.manifest.name}" does not cover ${t}, so a default pinned here would be ignored.`,next:`Widen its purview first: \`crtr profile project add ${i.profileId} --dir ${t}\`, then re-run this.`});return await y(e,i.profileId),{dir:t,profile_id:i.profileId,name:i.manifest.name,follow_up:`Launches here now auto-pick "${i.manifest.name}".`}},"run")}),_=s({name:"clear",description:"remove the current directory's default-profile pin",whenToUse:"you no longer want a fixed default here \u2014 go back to the normal startup chooser (MRU / covering menu). No-op if nothing was pinned.",help:{name:"profile default clear",summary:"remove a directory's default-profile pin \u2014 the current directory's, or any path with --dir, or every pin whose directory is gone with --missing",params:[{kind:"flag",name:"dir",type:"string",required:!1,constraint:"Directory whose pin to clear instead of the current one. It need not exist any more \u2014 a pin for a deleted directory is addressed by the path it was set with (a symlinked path that still exists resolves to its real path, as `set` stored it)."},{kind:"flag",name:"missing",type:"bool",required:!1,constraint:"Clear every pin whose directory no longer exists on disk, in one write. Used alone."}],output:[{name:"dir",type:"string",required:!1,constraint:"The resolved directory the pin was cleared for; absent with --missing."},{name:"cleared",type:"boolean",required:!0,constraint:"True when a pin existed and was removed; false when nothing was pinned."},{name:"cleared_dirs",type:"array",required:!1,constraint:"With --missing: each removed pin as {dir, profile_id}."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next commands."}],outputKind:"object",effects:["Deletes the directory's pin from the user-root profile-defaults state, if present. `--missing` deletes every pin whose directory no longer exists."]},run:o(async r=>{if(r.missing===!0){if(r.dir!==void 0)throw new d({error:"missing_not_exclusive",message:"--missing cannot be combined with --dir",field:"missing",next:"Pass --missing alone."});const n=await g();return{cleared:n.length>0,cleared_dirs:n,follow_up:n.length>0?`Cleared ${n.length} pin(s) whose directory no longer exists.`:"Every pinned directory still exists."}}const e=r.dir??process.cwd(),t=a(e),i=p(e)!==null;return await w(e),{dir:t,cleared:i,follow_up:i?"The startup chooser will ask again here. Re-pin with `crtr profile default set <profile>`.":"Nothing was pinned here."}},"run")}),b=s({name:"show",description:"show the current directory's default-profile pin",whenToUse:"you want to know which profile (if any) is pinned as this directory's default.",help:{name:"profile default show",summary:"report the current directory's pinned default profile, or none; --dir asks about another path",params:[{kind:"flag",name:"dir",type:"string",required:!1,constraint:"Directory whose pin to report instead of the current one. It need not exist any more \u2014 a pin for a deleted directory is addressed by the path it was set with (a symlinked path that still exists resolves to its real path, as `set` stored it)."}],output:[{name:"dir",type:"string",required:!0,constraint:"The resolved directory queried."},{name:"pinned",type:"boolean",required:!0,constraint:"True when a default is pinned here."},{name:"profile_id",type:"string",required:!1,constraint:"The pinned profile id, when pinned."},{name:"name",type:"string",required:!1,constraint:"The pinned profile name, when it still resolves."},{name:"stale",type:"boolean",required:!1,constraint:"True when a pin exists but its profile no longer resolves (deleted); the selector will self-heal it on next launch."},{name:"follow_up",type:"string",required:!0,constraint:"Concrete next commands."}],outputKind:"object",effects:["Read-only."]},run:o(async r=>{const e=r.dir??process.cwd(),t=a(e),i=p(e);if(i===null)return{dir:t,pinned:!1,follow_up:"Pin one with `crtr profile default set <profile>`."};let n;try{n=l(i).manifest.name}catch{n=void 0}return{dir:t,pinned:!0,profile_id:i,...n!==void 0?{name:n}:{stale:!0},follow_up:n!==void 0?"Change it with `crtr profile default set <profile>`, or clear it with `crtr profile default clear`.":"This profile no longer exists; clear the stale pin with `crtr profile default clear`."}},"run")}),T=s({name:"list",description:"list every directory pinned to a default profile",whenToUse:"you want to see all default-profile pins at once \u2014 including pins for directories that no longer exist \u2014 before clearing stale ones with `profile default clear --dir <path>` or `--missing`.",help:{name:"profile default list",summary:"every directory \u2192 default profile pin, with whether the directory and the profile still exist",params:[],output:[{name:"pins",type:"array",required:!0,constraint:"Each pin as {dir, profile_id, name?, dir_exists, profile_exists}, sorted by dir."}],outputKind:"object",effects:["Read-only."]},run:o(async()=>({pins:v().map(r=>{let e;try{e=l(r.profileId).manifest.name}catch{e=void 0}return{dir:r.dir,profile_id:r.profileId,...e!==void 0?{name:e}:{},dir_exists:m(r.dir),profile_exists:e!==void 0}})}),"run"),render:o(r=>{const e=r.pins;return e.length===0?"No default-profile pins.":e.map(t=>`${t.dir} \u2192 ${t.name??t.profile_id}${t.dir_exists?"":" [directory missing]"}${t.profile_exists?"":" [profile missing]"}`).join(`
|
|
2
2
|
`)},"render")}),P=f({name:"default",description:"manage this directory's default-profile pin",whenToUse:"setting, clearing, or inspecting which profile a directory defaults to at startup \u2014 so crtr stops asking. Directory-scoped, independent of project purview and automatic document delivery limits.",help:{name:"profile default",summary:"the per-directory default profile \u2014 pin one so the startup chooser stops asking",model:"A pin binds the CURRENT directory to a profile: launches here auto-pick it with no prompt (`crtr --pick-profile` reopens the chooser once). `set` pins a profile (which must already cover this dir), `clear` removes the pin (`--dir <path>` for another path, even a deleted one; `--missing` for every pin whose directory is gone), `show` reports it (`--dir` too), `list` shows every pin. This is directory-scoped selection, independent of `crtr profile project`: project `path` values govern purview and each `memory` value caps automatic disclosure. The startup menu's `d` action writes the same pin."},children:[x,_,b,T]});export{P as defaultBranch};
|
|
@@ -1,32 +1,7 @@
|
|
|
1
1
|
import { type BindingId, type BindingResolution, type KeybindingDiagnostic, type SparseKeybindingOverrides } from '../../core/keybindings/index.js';
|
|
2
|
-
import { type PluginEnvDeclaration } from '../../core/plugin-env.js';
|
|
3
2
|
import { type TerminalConfigEdit } from './terminal-option.js';
|
|
4
|
-
export
|
|
5
|
-
export declare const OFFICIAL_MARKETPLACE_URL = "https://github.com/crouton-labs/crouter-official-marketplace.git";
|
|
6
|
-
export declare const OFFICIAL_MARKETPLACE_REF = "main";
|
|
7
|
-
export type SetupPackageId = 'official-marketplace' | 'crtr-extensions' | 'oauth-adapter' | 'capture-plugin' | 'dev-plugin';
|
|
8
|
-
/** `nerd-font` is not a command on PATH like the other two — it is an installed
|
|
9
|
-
* font face, detected by fontconfig/font-directory scan. The viewer renders
|
|
10
|
-
* every tool and command icon with Nerd Font codepoints, so without it a fresh
|
|
11
|
-
* machine shows tofu boxes. */
|
|
12
|
-
export type SetupTool = 'tmux' | 'nvim' | 'nerd-font';
|
|
13
|
-
/** `marketplace-source` clones and registers a marketplace repo
|
|
14
|
-
* (`installSource` is its git URL); `marketplace-plugin` installs one plugin
|
|
15
|
-
* from a registered marketplace (`installSource` is a `<marketplace>/<plugin>`
|
|
16
|
-
* ref). Neither runs the bundled pi CLI, and neither happens anywhere but
|
|
17
|
-
* setup: an install that never runs setup — a Northlight guest image, CI —
|
|
18
|
-
* fetches no catalog and carries no command whose external binary it lacks. */
|
|
19
|
-
export type SetupPackageSourceKind = 'local-path' | 'npm' | 'marketplace-source' | 'marketplace-plugin';
|
|
20
|
-
export type SetupPackageIdentity = string;
|
|
3
|
+
export type SetupTool = 'tmux' | 'nvim' | 'nerd-font' | 'uv';
|
|
21
4
|
export type PackageManager = 'brew' | 'apt-get' | 'dnf' | 'pacman' | 'manual';
|
|
22
|
-
export interface SetupPackageManifestEntry {
|
|
23
|
-
id: SetupPackageId;
|
|
24
|
-
name: string;
|
|
25
|
-
sourceKind: SetupPackageSourceKind;
|
|
26
|
-
installSource: string;
|
|
27
|
-
shortDescription: string;
|
|
28
|
-
longDescription: string;
|
|
29
|
-
}
|
|
30
5
|
export interface SetupSystemInstallPlan {
|
|
31
6
|
tool: SetupTool;
|
|
32
7
|
installed: boolean;
|
|
@@ -34,18 +9,8 @@ export interface SetupSystemInstallPlan {
|
|
|
34
9
|
hint: string;
|
|
35
10
|
autoInstall: boolean;
|
|
36
11
|
}
|
|
37
|
-
export interface SetupPluginEnvField {
|
|
38
|
-
name: string;
|
|
39
|
-
plugin: string;
|
|
40
|
-
declaration: PluginEnvDeclaration;
|
|
41
|
-
}
|
|
42
|
-
/** Read declarations without installing or registering a marketplace until confirmation. */
|
|
43
|
-
export declare function setupPluginEnvFields(packages: readonly SetupPackageManifestEntry[]): SetupPluginEnvField[];
|
|
44
12
|
export interface SetupSubmission {
|
|
45
|
-
packages: SetupPackageManifestEntry[];
|
|
46
|
-
installedPackageIds: Set<SetupPackageId>;
|
|
47
13
|
systemDeps: SetupSystemInstallPlan[];
|
|
48
|
-
pluginEnv: Map<string, string>;
|
|
49
14
|
/** A terminal-config write the person explicitly ticked in the Option key step. */
|
|
50
15
|
terminalEdit?: TerminalConfigEdit;
|
|
51
16
|
}
|
|
@@ -54,8 +19,6 @@ export interface SetupExecutionSummary {
|
|
|
54
19
|
skipped: string[];
|
|
55
20
|
}
|
|
56
21
|
export interface SetupInitialState {
|
|
57
|
-
manifest: SetupPackageManifestEntry[];
|
|
58
|
-
installedPackageIds: Set<SetupPackageId>;
|
|
59
22
|
systemPlans: SetupSystemInstallPlan[];
|
|
60
23
|
}
|
|
61
24
|
export interface KeybindingEditResult {
|
|
@@ -93,20 +56,10 @@ export declare class SetupKeybindingsDraft {
|
|
|
93
56
|
discard(): void;
|
|
94
57
|
markSaved(overrides: SparseKeybindingOverrides<BindingId>, tmuxPassthrough?: readonly BindingId[]): void;
|
|
95
58
|
}
|
|
96
|
-
export declare function buildSetupManifest(resolveBuiltinPackageDir?: (name: string) => string): SetupPackageManifestEntry[];
|
|
97
|
-
/** One-line description of what installing an entry will actually run — the
|
|
98
|
-
* wizard's confirm step and the non-TTY dump both show it. */
|
|
99
|
-
export declare function packagePlanAction(entry: SetupPackageManifestEntry): string;
|
|
100
|
-
export declare function normalizePackageIdentity(source: string, settingsDir: string, homeDir: string): SetupPackageIdentity;
|
|
101
|
-
export declare function detectInstalledSetupPackageIds(settingsJson: unknown, manifest?: SetupPackageManifestEntry[], settingsPath?: string, homeDir?: string): Set<SetupPackageId>;
|
|
102
59
|
export declare function detectCommandOnPath(command: string): boolean;
|
|
103
60
|
export declare function detectPackageManager(platform?: NodeJS.Platform, commandExists?: (command: string) => boolean): PackageManager;
|
|
104
61
|
export declare function buildSystemInstallPlan(tool: SetupTool, packageManager: PackageManager, commandExists?: (command: string) => boolean): SetupSystemInstallPlan;
|
|
105
|
-
export declare function resolveSettingsPath(homeDir?: string): string;
|
|
106
62
|
export declare function buildSetupInitialState(opts?: {
|
|
107
|
-
manifest?: SetupPackageManifestEntry[];
|
|
108
|
-
settingsPath?: string;
|
|
109
|
-
homeDir?: string;
|
|
110
63
|
packageManager?: PackageManager;
|
|
111
64
|
commandExists?: (command: string) => boolean;
|
|
112
65
|
}): SetupInitialState;
|
|
@@ -114,8 +67,4 @@ export declare function renderSetupStaticInstructions(state: SetupInitialState):
|
|
|
114
67
|
/** Refresh crouter-owned tmux bindings. Setup must never fail because tmux is unavailable. */
|
|
115
68
|
export declare function reconcileInboxFrontDoor(): Promise<void>;
|
|
116
69
|
export declare function formatSetupExecutionSummary(summary: SetupExecutionSummary): string;
|
|
117
|
-
/** The non-interactive first command reconciles only crouter-owned packages.
|
|
118
|
-
* Individual failures are reported by the CLI but never prevent later work or
|
|
119
|
-
* writing the once-per-machine marker. */
|
|
120
|
-
export declare function reconcileFirstRun(onFailure: (item: string, error: unknown) => void, commandExists?: (command: string) => boolean): Promise<string>;
|
|
121
70
|
export declare function executeSetupSubmission(submission: SetupSubmission, commandExists?: (command: string) => boolean): Promise<SetupExecutionSummary>;
|