@north-light/cli 0.3.707 → 0.3.709
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +1 -2
- package/dist/api/client.js +3 -3
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/crons.d.ts +3 -0
- package/dist/api/dto/human.d.ts +9 -6
- package/dist/api/dto/inbox.d.ts +2 -0
- package/dist/api/dto/review-comments.d.ts +12 -35
- package/dist/api/dto/reviews.d.ts +3 -10
- package/dist/api/routes.d.ts +0 -1
- package/dist/api/routes.js +1 -1
- package/dist/builtin-memory/05-kinds/review/companion/00-base.md +2 -2
- package/dist/builtin-memory/crouter-sdk/release-notes.md +6 -0
- package/dist/clients/attach/chrome/canvas-panels.d.ts +1 -1
- package/dist/clients/attach/chrome/canvas-panels.js +1 -1
- package/dist/clients/attach/chrome/inbox-strip.js +1 -1
- package/dist/clients/attach/chrome/roster.js +6 -6
- package/dist/clients/attach/chrome/status-line.d.ts +1 -1
- package/dist/clients/attach/chrome/status-line.js +1 -1
- package/dist/clients/attach/chrome/ticket-panel.js +1 -1
- package/dist/clients/attach/input/capabilities.js +1 -1
- package/dist/clients/attach/input/controller.d.ts +4 -1
- package/dist/clients/attach/input/controller.js +3 -3
- package/dist/clients/attach/input/overlay-owner.d.ts +0 -1
- package/dist/clients/attach/input/overlay-owner.js +1 -1
- package/dist/clients/attach/overlays/graph.d.ts +3 -2
- package/dist/clients/attach/overlays/graph.js +1 -1
- package/dist/clients/attach/render/chat-view.d.ts +2 -0
- package/dist/clients/attach/render/chat-view.js +1 -1
- package/dist/clients/attach/render/doc-links.d.ts +1 -1
- package/dist/clients/attach/session/chrome-refresh.js +1 -1
- package/dist/clients/attach/session/connection.d.ts +10 -9
- package/dist/clients/attach/session/connection.js +1 -1
- package/dist/clients/attach/session/context.d.ts +1 -1
- package/dist/clients/attach/session/document-links.d.ts +1 -1
- package/dist/clients/attach/session/document-links.js +1 -1
- package/dist/clients/attach/session/identity.d.ts +2 -0
- package/dist/clients/attach/session/identity.js +1 -1
- package/dist/clients/attach/session/input-wiring.d.ts +2 -0
- package/dist/clients/attach/session/input-wiring.js +1 -1
- package/dist/clients/attach/session/keys.d.ts +2 -2
- package/dist/clients/attach/session/keys.js +1 -1
- package/dist/clients/attach/session/pane-tag.d.ts +3 -1
- package/dist/clients/attach/session/pane-tag.js +1 -1
- package/dist/clients/attach/session/reconnect.js +1 -1
- package/dist/clients/attach/session/surface-host.d.ts +0 -5
- package/dist/clients/attach/session/surface-host.js +1 -1
- package/dist/clients/attach/session/teardown.d.ts +2 -2
- package/dist/clients/attach/session/teardown.js +9 -7
- package/dist/clients/attach/viewer.d.ts +7 -5
- package/dist/clients/attach/viewer.js +571 -584
- package/dist/clients/editor-roundtrip.js +3 -0
- package/dist/clients/inbox/controller.d.ts +1 -6
- package/dist/clients/inbox/controller.js +1 -1
- package/dist/clients/inbox/dto-adapt.js +1 -1
- package/dist/clients/inbox/tui/page-body.js +1 -1
- package/dist/clients/inbox/tui/render.js +2 -2
- package/dist/clients/open-browser.d.ts +2 -0
- package/dist/clients/open-browser.js +1 -0
- package/dist/clients/surfaces/host.d.ts +0 -6
- package/dist/commands/human/review.js +1 -1
- package/dist/commands/node/wait.js +2 -6
- package/dist/commands/sys/context/admin/shell.js +1 -1
- package/dist/core/broker-client/client.d.ts +6 -3
- package/dist/core/broker-client/client.js +1 -1
- package/dist/core/canvas/crons.d.ts +11 -1
- package/dist/core/canvas/crons.js +14 -14
- package/dist/core/canvas/executions.js +1 -1
- package/dist/core/canvas/schema-pg/025-review-anchors.sql +19 -0
- package/dist/core/canvas/schema-pg/026-cron-deadline-body.sql +9 -0
- package/dist/core/canvas/schema-pg/027-cron-fires.sql +4 -0
- package/dist/core/canvas/schema-version.d.ts +1 -1
- package/dist/core/canvas/schema-version.js +1 -1
- package/dist/core/command.js +5 -5
- package/dist/core/feed/messages.d.ts +5 -0
- package/dist/core/feed/messages.js +5 -5
- package/dist/core/human/page-markdown.js +10 -12
- package/dist/core/human/tickets.js +1 -1
- package/dist/core/human/types.d.ts +4 -6
- package/dist/core/keybindings/attach-control.d.ts +0 -3
- package/dist/core/keybindings/attach-control.js +1 -1
- package/dist/core/keybindings/catalog.d.ts +1 -1
- package/dist/core/keybindings/catalog.js +1 -1
- package/dist/core/review/anchors.d.ts +28 -0
- package/dist/core/review/anchors.js +6 -0
- package/dist/core/review/comments.d.ts +2 -2
- package/dist/core/review/comments.js +7 -8
- package/dist/core/review/companion.d.ts +2 -1
- package/dist/core/review/companion.js +1 -1
- package/dist/core/review/document.d.ts +4 -17
- package/dist/core/review/document.js +1 -2
- package/dist/core/review/fork.js +2 -4
- package/dist/core/review/project.d.ts +1 -1
- package/dist/core/review/project.js +2 -2
- package/dist/core/review/realize.js +1 -1
- package/dist/core/review/stage.d.ts +2 -9
- package/dist/core/review/stage.js +1 -1
- package/dist/core/review/types.d.ts +16 -12
- package/dist/core/review/types.js +1 -1
- package/dist/core/runtime/bearings.js +4 -4
- package/dist/core/runtime/boot-root.js +4 -4
- package/dist/core/runtime/broker-cli.js +3 -3
- package/dist/core/runtime/broker-extension-render.js +1 -1
- package/dist/core/runtime/lifecycle.js +2 -2
- package/dist/core/runtime/revive.js +2 -2
- package/dist/core/runtime/runner/blaxel/client.d.ts +4 -0
- package/dist/core/runtime/runner/blaxel/client.js +1 -1
- package/dist/core/runtime/runner/blaxel/runner.d.ts +2 -3
- package/dist/core/runtime/runner/blaxel/runner.js +3 -3
- package/dist/core/runtime/runner/delete-sandboxes.d.ts +5 -0
- package/dist/core/runtime/runner/delete-sandboxes.js +6 -1
- package/dist/core/runtime/runner/types.d.ts +19 -3
- package/dist/core/runtime/tmux-bindings.js +3 -3
- package/dist/daemon/api/bridge.d.ts +5 -0
- package/dist/daemon/api/bridge.js +3 -3
- package/dist/daemon/api/canvas-host.js +1 -1
- package/dist/daemon/api/document-page.d.ts +12 -1
- package/dist/daemon/api/document-page.js +6 -6
- package/dist/daemon/api/handlers/crons.d.ts +2 -0
- package/dist/daemon/api/handlers/crons.js +1 -1
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/review-comments.js +1 -1
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/map.js +2 -2
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/api/review-page.d.ts +3 -0
- package/dist/daemon/api/review-page.js +13 -0
- package/dist/daemon/broker-memory-cap.d.ts +9 -0
- package/dist/daemon/broker-memory-cap.js +2 -0
- package/dist/daemon/broker-signals/bus.d.ts +1 -1
- package/dist/daemon/broker-signals/bus.js +1 -1
- package/dist/daemon/cron/ended.d.ts +3 -0
- package/dist/daemon/cron/ended.js +2 -2
- package/dist/daemon/cron/lease-recovery.js +1 -1
- package/dist/daemon/cron/machine-fire.d.ts +9 -2
- package/dist/daemon/cron/machine-fire.js +1 -1
- package/dist/daemon/cron/passes.js +1 -1
- package/dist/daemon/cron-run.js +2 -2
- package/dist/daemon/crtrd.js +14 -14
- package/dist/daemon/machine-daemon.js +1 -1
- package/dist/daemon/machine-link/client.js +1 -1
- package/dist/daemon/reconcilers/fault-retry-backstop.js +1 -1
- package/dist/daemon/reconcilers/idle-sandbox.d.ts +1 -1
- package/dist/daemon/reconcilers/idle-sandbox.js +2 -2
- package/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +2 -2
- package/dist/daemon/review/comment-notify.js +2 -2
- package/dist/daemon/review/deliver.d.ts +2 -2
- package/dist/daemon/review/deliver.js +6 -2
- package/dist/daemon/review/finish.js +1 -1
- package/dist/doc-editor/Geist-Variable.woff2 +0 -0
- package/dist/doc-editor/GeistMono-Variable.woff2 +0 -0
- package/dist/doc-editor/editor.css +1 -1
- package/dist/doc-editor/review.css +2 -0
- package/dist/doc-editor/review.js +149 -0
- package/dist/pi-extensions/canvas-review-boundary.js +3 -3
- package/docs/sdk/release-notes.md +6 -0
- package/package.json +13 -4
- package/packages/crouter-api/dist/api/client.js +0 -3
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/dist/api/routes.js +0 -1
- package/packages/crouter-api/dist/clients/attach/chrome/canvas-panels.js +3 -3
- package/packages/crouter-api/dist/clients/attach/chrome/inbox-strip.js +5 -5
- package/packages/crouter-api/dist/clients/attach/chrome/roster.js +17 -28
- package/packages/crouter-api/dist/clients/attach/chrome/status-line.js +2 -7
- package/packages/crouter-api/dist/clients/attach/chrome/ticket-panel.js +1 -1
- package/packages/crouter-api/dist/clients/attach/input/capabilities.js +2 -1
- package/packages/crouter-api/dist/clients/attach/input/controller.js +17 -3
- package/packages/crouter-api/dist/clients/attach/input/overlay-owner.js +0 -7
- package/packages/crouter-api/dist/clients/attach/overlays/graph.js +4 -3
- package/packages/crouter-api/dist/clients/attach/render/chat-view.js +9 -0
- package/packages/crouter-api/dist/clients/attach/session/chrome-refresh.js +6 -3
- package/packages/crouter-api/dist/clients/attach/session/connection.js +53 -53
- package/packages/crouter-api/dist/clients/attach/session/document-links.js +1 -1
- package/packages/crouter-api/dist/clients/attach/session/identity.js +1 -0
- package/packages/crouter-api/dist/clients/attach/session/input-wiring.js +4 -3
- package/packages/crouter-api/dist/clients/attach/session/keys.js +11 -5
- package/packages/crouter-api/dist/clients/attach/session/pane-tag.js +7 -1
- package/packages/crouter-api/dist/clients/attach/session/reconnect.js +3 -3
- package/packages/crouter-api/dist/clients/attach/session/surface-host.js +0 -17
- package/packages/crouter-api/dist/clients/attach/session/teardown.js +7 -4
- package/packages/crouter-api/dist/clients/attach/viewer.js +77 -67
- package/packages/crouter-api/dist/clients/{inbox/review/roundtrip.js → editor-roundtrip.js} +1 -1
- package/packages/crouter-api/dist/clients/inbox/controller.js +12 -31
- package/packages/crouter-api/dist/clients/inbox/dto-adapt.js +1 -0
- package/packages/crouter-api/dist/clients/inbox/tui/page-body.js +0 -7
- package/packages/crouter-api/dist/clients/inbox/tui/render.js +0 -7
- package/packages/crouter-api/dist/clients/open-browser.js +6 -0
- package/packages/crouter-api/dist/commands/human/review.js +17 -18
- package/packages/crouter-api/dist/commands/node/wait.js +2 -10
- package/packages/crouter-api/dist/commands/sys/context/admin/shell.js +1 -1
- package/packages/crouter-api/dist/core/broker-client/client.js +20 -10
- package/packages/crouter-api/dist/core/canvas/crons.js +26 -10
- package/packages/crouter-api/dist/core/canvas/executions.js +7 -2
- package/packages/crouter-api/dist/core/canvas/schema-version.js +1 -1
- package/packages/crouter-api/dist/core/command.js +3 -0
- package/packages/crouter-api/dist/core/feed/messages.js +15 -0
- package/packages/crouter-api/dist/core/human/page-markdown.js +2 -6
- package/packages/crouter-api/dist/core/human/tickets.js +2 -11
- package/packages/crouter-api/dist/core/keybindings/attach-control.js +0 -1
- package/packages/crouter-api/dist/core/keybindings/catalog.js +1 -3
- package/packages/crouter-api/dist/core/review/anchors.js +91 -0
- package/packages/crouter-api/dist/core/review/comments.js +27 -46
- package/packages/crouter-api/dist/core/review/companion.js +5 -9
- package/packages/crouter-api/dist/core/review/document.js +17 -89
- package/packages/crouter-api/dist/core/review/project.js +2 -1
- package/packages/crouter-api/dist/core/review/types.js +2 -2
- package/packages/crouter-api/dist/core/runtime/bearings.js +2 -2
- package/packages/crouter-api/dist/core/runtime/lifecycle.js +3 -0
- package/packages/crouter-api/dist/core/runtime/revive.js +5 -25
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/client.js +15 -8
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/runner.js +60 -19
- package/packages/crouter-api/dist/core/runtime/runner/delete-sandboxes.js +18 -2
- package/packages/crouter-api/dist/core/runtime/tmux-bindings.js +0 -5
- package/packages/crouter-api/dist/daemon/api/map.js +2 -6
- package/packages/crouter-api/dist/daemon/api/operations.js +2 -2
- package/packages/crouter-api/dist/daemon/broker-signals/bus.js +1 -1
- package/packages/crouter-api/dist/daemon/cron/ended.js +22 -11
- package/packages/crouter-api/dist/daemon/cron/machine-fire.js +69 -6
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +2 -2
- package/packages/crouter-api/dist/daemon/review/deliver.js +4 -3
- package/packages/crouter-api/dist/daemon/review/finish.js +26 -47
- 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 +1740 -505
- package/dist/clients/attach/overlays/file-review.d.ts +0 -10
- package/dist/clients/attach/overlays/file-review.js +0 -2
- package/dist/clients/inbox/review/anchors.d.ts +0 -41
- package/dist/clients/inbox/review/anchors.js +0 -1
- package/dist/clients/inbox/review/comments-client.d.ts +0 -74
- package/dist/clients/inbox/review/comments-client.js +0 -1
- package/dist/clients/inbox/review/companion-pane.d.ts +0 -47
- package/dist/clients/inbox/review/companion-pane.js +0 -1
- package/dist/clients/inbox/review/document-surface.d.ts +0 -212
- package/dist/clients/inbox/review/document-surface.js +0 -2
- package/dist/clients/inbox/review/frame.d.ts +0 -57
- package/dist/clients/inbox/review/frame.js +0 -1
- package/dist/clients/inbox/review/keys.d.ts +0 -69
- package/dist/clients/inbox/review/keys.js +0 -1
- package/dist/clients/inbox/review/launch.d.ts +0 -16
- package/dist/clients/inbox/review/launch.js +0 -1
- package/dist/clients/inbox/review/live-source.d.ts +0 -24
- package/dist/clients/inbox/review/live-source.js +0 -1
- package/dist/clients/inbox/review/nvim.d.ts +0 -15
- package/dist/clients/inbox/review/nvim.js +0 -1
- package/dist/clients/inbox/review/remap.d.ts +0 -51
- package/dist/clients/inbox/review/remap.js +0 -1
- package/dist/clients/inbox/review/review-client.d.ts +0 -43
- package/dist/clients/inbox/review/review-client.js +0 -1
- package/dist/clients/inbox/review/roundtrip.js +0 -3
- package/dist/clients/inbox/review/state.d.ts +0 -153
- package/dist/clients/inbox/review/state.js +0 -4
- package/dist/clients/inbox/review-adapter.d.ts +0 -17
- package/dist/clients/inbox/review-adapter.js +0 -1
- package/dist/core/review/remap.d.ts +0 -24
- package/dist/core/review/remap.js +0 -19
- package/dist/core/review/signal.d.ts +0 -5
- package/dist/core/review/signal.js +0 -1
- package/dist/core/runtime/starting-screen.d.ts +0 -12
- package/dist/core/runtime/starting-screen.js +0 -9
- package/packages/crouter-api/dist/clients/attach/overlays/file-review.js +0 -146
- package/packages/crouter-api/dist/clients/inbox/review/anchors.js +0 -89
- package/packages/crouter-api/dist/clients/inbox/review/comments-client.js +0 -103
- package/packages/crouter-api/dist/clients/inbox/review/companion-pane.js +0 -109
- package/packages/crouter-api/dist/clients/inbox/review/document-surface.js +0 -1268
- package/packages/crouter-api/dist/clients/inbox/review/frame.js +0 -309
- package/packages/crouter-api/dist/clients/inbox/review/keys.js +0 -133
- package/packages/crouter-api/dist/clients/inbox/review/launch.js +0 -170
- package/packages/crouter-api/dist/clients/inbox/review/live-source.js +0 -160
- package/packages/crouter-api/dist/clients/inbox/review/nvim.js +0 -43
- package/packages/crouter-api/dist/clients/inbox/review/remap.js +0 -157
- package/packages/crouter-api/dist/clients/inbox/review/review-client.js +0 -125
- package/packages/crouter-api/dist/clients/inbox/review/state.js +0 -315
- package/packages/crouter-api/dist/clients/inbox/review-adapter.js +0 -43
- package/packages/crouter-api/dist/core/review/signal.js +0 -12
- package/packages/crouter-api/dist/core/termrender/code-doc.js +0 -92
- /package/dist/clients/{inbox/review/roundtrip.d.ts → editor-roundtrip.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C=Object.defineProperty;var n=(t,r)=>C(t,"name",{value:r,configurable:!0});import{createConnection as S}from"node:net";import{apiSocketPath as _,viewSocketPath as R}from"../../../core/canvas/paths.js";import{BrokerClient as A,BrokerUnavailableError as x,RelayTransport as w}from"../../../core/broker-client/index.js";import{resolveRemoteCanvasTarget as I}from"../../../core/remote-canvas-target.js";import{ApiCanvasSource as M,cliCanvasSource as P,cliClient as v,rethrowAsCliError as y}from"../../../commands/api-client.js";import{InputError as b,apiErrorToCliError as B}from"../../../core/io.js";import{ApiError as F}from"../../../api/index.js";import{readMachineConfig as z}from"../../../daemon/machine-link/config.js";import{personBearer as k}from"../../../core/directory/person-credential.js";import{mark as H}from"../../../core/timing.js";const $=15e3;async function D(t,r){let c=await k(r);return setInterval(()=>{k(r).then(f=>{c=f},()=>{})},$).unref(),{previewEndpoint:t,get relayToken(){return c}}}n(D,"machineRelayTarget");function Z(t){return t?"observer":"controller"}n(Z,"resolveHelloRole");async function U(t){const r=Number(process.env.CRTR_ATTACH_WAIT_MS??"");if(!Number.isFinite(r)||r<=0)return;const c=R(t),s=Date.now()+r;for(;Date.now()<s;){if(await new Promise(o=>{const d=S(c),i=n(p=>{d.destroy(),o(p)},"settle");d.once("connect",()=>i(!0)),d.once("error",()=>i(!1))}))return;await new Promise(o=>setTimeout(o,100))}}n(U,"preWaitForViewSocket");function N(t,r=!0){const c=t!==void 0,s=c?void 0:z(),f=t!==void 0?P({canvasName:t}):new M,o=new A(void 0);let d;const i=n(()=>{if(d===void 0)throw new Error("attach has no node yet");return d},"nodeId"),p=n(async(e,a)=>{d=e;let u,l,m;if(t!==void 0)l={cwd:process.cwd()},u=new w(e,I(t));else{const h=a??await f.getNode(e);if(h===null)throw new b({error:"not_found",message:`no node: ${e}`,received:e,next:"List nodes with `crtr node inspect list`."});l=h,m=h,s!==void 0?u=new w(e,await D(s.apiUrl,s.directoryUrl),r):u=new w(e,{socketPath:_()})}return o.bindTransport(u),{meta:l,nodeIdentity:m}},"bind"),T=t===void 0&&s===void 0,E=n(e=>{const a=e?.refusal;return a!==void 0?B(new F(a.status,a.code,a.message),"The node may be finalized or otherwise not attachable."):e instanceof x?new b({error:"no_broker",message:e.message,received:i(),next:"Focus or revive the node first \u2014 attach needs a running headless broker."}):new b({error:"socket_error",message:`could not attach to node ${i()}: ${String(e?.message??e)}`,received:i(),next:"Check the node has a running headless broker."})},"toAttachError"),g=n(async()=>{const e=await v().getSnapshot(i());return{snapshot:e.snapshot,commands:e.commands}},"parkedSnapshot");return{remote:c,canvasSource:f,socket:o,bind:p,dial:n(async()=>{if(T){try{if((await v().ensureAttach(i(),{resume:!0,revive:!0,wakeParked:r})).parked)return await g()}catch(e){y(e,"The node may be finalized or otherwise not attachable.")}await U(i())}try{await new Promise((e,a)=>{const u=n(()=>{m(),e()},"onConnect"),l=n(h=>{m(),a(h)},"onErr"),m=n(()=>{o.off("connect",u),o.off("error",l)},"cleanup");o.on("connect",u),o.on("error",l),o.connect()})}catch(e){if(s!==void 0&&!r&&String(e?.message).includes("node_dormant"))return await g().catch(a=>y(a,"The node may be finalized or otherwise not attachable."));throw E(e)}H("viewer.transport_open")},"dial")}}n(N,"connectToNode");export{N as connectToNode,D as machineRelayTarget,U as preWaitForViewSocket,Z as resolveHelloRole};
|
|
@@ -33,7 +33,7 @@ export interface AttachContainers {
|
|
|
33
33
|
export interface AttachSession {
|
|
34
34
|
/** The node this viewer drives. On a remote attach this id is meaningful only
|
|
35
35
|
* to the remote canvas — never to local disk. */
|
|
36
|
-
|
|
36
|
+
nodeId: string;
|
|
37
37
|
/** THE single remote fact (not a read-only fact: `role` decides driving), derived once in `runAttach` from
|
|
38
38
|
* `--canvas` and threaded from here. No collaborator may re-derive it. */
|
|
39
39
|
readonly remote: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocumentAccessDTO } from '../../../api/dto/docs.js';
|
|
2
2
|
import type { CanvasSource } from '../../../core/canvas/source.js';
|
|
3
3
|
export declare function createDocumentLinks(opts: {
|
|
4
|
-
selfNodeId: string;
|
|
4
|
+
selfNodeId: () => string | undefined;
|
|
5
5
|
remote: boolean;
|
|
6
6
|
canvasSource: CanvasSource;
|
|
7
7
|
port: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var m=Object.defineProperty;var o=(e,s)=>m(e,"name",{value:s,configurable:!0});import{noteDocLinksChanged as f,setDocLinkContext as u}from"../render/doc-links.js";function v(e){const s=new Map;let c=!1,d=!1,r;e.remote||e.fetchAccess().then(n=>{r=n,f(),d||e.refresh()},e.onAccessError);const l=o(()=>{if(c)return;c=!0;const n=e.canvasSource;(n.panelRoster?n.panelRoster().then(i=>i.nodes):n.listNodes()).then(i=>{for(const a of i)s.set(a.node_id,a.name);f(),d||e.refresh()},()=>{c=!1})},"loadRoster");return u({get selfNodeId(){return e.selfNodeId()},nodeName:o(n=>{const t=s.get(n);return t===void 0&&l(),t},"nodeName"),urlFor:o(n=>{if(e.remote||r===void 0)return;const t=`/r/${n.split("/").map(encodeURIComponent).join("/")}`;return"canvas_url"in r?`${r.canvas_url}${t}`:`http://127.0.0.1:${e.port}${t}?t=${r.secret}`},"urlFor")}),{dispose(){d=!0,u(void 0)}}}o(v,"createDocumentLinks");export{v as createDocumentLinks};
|
|
@@ -12,5 +12,7 @@ export interface NodeIdentityOwner {
|
|
|
12
12
|
/** Re-read from the canvas source. Fire-and-forget; failures are ignored
|
|
13
13
|
* (the badge simply keeps its last known value). */
|
|
14
14
|
refresh: () => void;
|
|
15
|
+
/** Seed the identity once a node that was still being created has returned. */
|
|
16
|
+
set: (identity: NodeIdentity) => void;
|
|
15
17
|
}
|
|
16
18
|
export declare function createNodeIdentity(ctx: Pick<AttachSession, 'nodeId' | 'canvasSource'>, initial: NodeIdentity, hooks: IdentityHooks): NodeIdentityOwner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var u=Object.defineProperty;var e=(n,r)=>u(n,"name",{value:r,configurable:!0});function c(n,r,d){let i=r;return{current:e(()=>i,"current"),set:e(t=>{i=t,d.onChanged()},"set"),refresh:e(()=>{n.canvasSource.getNode(n.nodeId).then(t=>{d.isTornDown()||t===null||(i=t,d.onChanged())}).catch(()=>{})},"refresh")}}e(c,"createNodeIdentity");export{c as createNodeIdentity};
|
|
@@ -45,6 +45,8 @@ export interface InputWiringHooks {
|
|
|
45
45
|
onMessageSent: (text: string) => void;
|
|
46
46
|
/** Send a frame to the broker; before the broker's first welcome the viewer holds it. */
|
|
47
47
|
send: (frame: ClientToBroker) => void;
|
|
48
|
+
/** True while the node is still being created: only plain messages, `!` commands and follow-ups are accepted (held until the welcome). */
|
|
49
|
+
isStarting: () => boolean;
|
|
48
50
|
/** Per-user completion frecency store, shared with the editor inventory. */
|
|
49
51
|
frecency: FrecencyStore;
|
|
50
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=Object.defineProperty;var t=(n,a)=>P(n,"name",{value:a,configurable:!0});import{InputController as D}from"../input/controller.js";import{createViewerCapabilities as S}from"../input/capabilities.js";import{VERBOSITY_LABELS as f}from"../../../core/user-settings.js";import{VERBOSITY_LEVELS as c}from"../../../types.js";import{cliClient as b}from"../../../commands/api-client.js";import{buildLoginPicker as I,buildLogoutPicker as M}from"../overlays/auth.js";import{defaultAgentDir as C}from"../config.js";function x(n,a){return S({get nodeId(){return n.nodeId},profileId:n.meta.profile_id??void 0,remote:n.remote,role:n.role,isBrokerOffline:a})}t(x,"createViewerCapabilitiesForInput");function s({level:n}){return`Verbosity: ${f[n]} (${c.indexOf(n)+1}/${c.length})`}t(s,"verbosityName");function T(n){return n.atEnd?`${s(n)} \u2014 Ctrl+O again goes back to ${f[c[0]]}`:`${s(n)} \u2014 Ctrl+O shows more`}t(T,"moreDetailNotice");function v(n){return n.atEnd?`${s(n)}, the most collapsed level \u2014 Ctrl+O shows more`:`${s(n)} \u2014 Ctrl+O shows more`}t(v,"lessDetailNotice");function A(n,a,d,e){const{socket:w,tui:l,editor:m,containers:g}=n,{setNotice:i}=e,p=t(()=>e.send({type:"reload_auth"}),"reloadAuth"),y=d.permits("auth")?{openLoginPicker:t(()=>{const r=e.agentDir()??C();u.openAuthPicker(()=>I(l,r,p,o=>i(o)))},"openLoginPicker"),openLogoutPicker:t(()=>{const r=e.agentDir()??C();u.openAuthPicker(()=>M(r,p,o=>i(o)))},"openLogoutPicker")}:{},u=new D(l,m,a,{onCommand:e.send,onDialogResponse:e.send,onNotice:t(r=>i(r),"onNotice"),onGraph:e.toggleGraph,onInbox:e.toggleInbox,onHelp:e.toggleHelp,onNodeMetadata:e.openNodeMetadata,onQuit:e.quit,onCopy:t(()=>e.copyTarget("last-assistant"),"onCopy"),onCopyTarget:e.copyTarget,onToggleMouse:t(()=>{const r=e.toggleMouse();i(r?"Mouse: wheel scrolling on, drag to select and copy":"Mouse: off \u2014 tmux drag-select and copy-mode restored")},"onToggleMouse"),onColor:e.setChipColor,onPromptSent:e.onPromptSent,onMessageSent:e.onMessageSent,frecency:e.frecency,knownRefNames:t(()=>m.getResolvedRefNames(),"knownRefNames"),onMoreDetail:t(()=>i(T(e.moreDetail())),"onMoreDetail"),onLessDetail:t(()=>i(v(e.lessDetail())),"onLessDetail"),onToggleThinking:t(()=>i(e.toggleThinking()?"Thinking blocks: hidden":"Thinking blocks: visible"),"onToggleThinking"),onRequest:t(r=>{const o=d.refusal("engine-drive");return o===void 0?w.request(r):Promise.reject(new Error(o))},"onRequest"),onMountPicker:t(r=>{g.pickerPanel.addChild(r),l.requestRender()},"onMountPicker"),onUnmountPicker:t(()=>{g.pickerPanel.clear(),l.requestRender()},"onUnmountPicker"),isDormant:e.isDormant,isStarting:e.isStarting,onDormantSubmit:d.permits("wake-dormant")?r=>{(async()=>{try{const o=await b().sendMessage(n.nodeId,{body:r,from:"human"});i(o.revived?"\u21BB waking node\u2026":"\u2709 delivered \u2014 node reads on next wake")}catch(o){i(`Couldn't wake node: ${o instanceof Error?o.message:String(o)}`)}})()}:void 0,...y},d);return u}t(A,"createInputController");export{A as createInputController,x as createViewerCapabilitiesForInput,v as lessDetailNotice,T as moreDetailNotice};
|
|
@@ -33,8 +33,6 @@ export interface KeyHooks {
|
|
|
33
33
|
toggleInboxStrip: () => void;
|
|
34
34
|
cycleModelLadder: (direction: 'forward' | 'backward') => void;
|
|
35
35
|
inspectLoadedCommand: () => void;
|
|
36
|
-
/** The file-review chord — pick a transcript file and open its review window. */
|
|
37
|
-
openFileReview: () => void;
|
|
38
36
|
/** Search the current node's local profile project files. */
|
|
39
37
|
openProfileFiles: () => void;
|
|
40
38
|
/** Open incremental search over the displayed transcript. */
|
|
@@ -43,6 +41,8 @@ export interface KeyHooks {
|
|
|
43
41
|
whip: () => void;
|
|
44
42
|
/** Restart this viewer process in place (the Alt+C "reload viewer" entry). */
|
|
45
43
|
reloadViewer: () => void;
|
|
44
|
+
/** True while the root's create request is still in flight: no node id exists yet. */
|
|
45
|
+
isStarting: () => boolean;
|
|
46
46
|
}
|
|
47
47
|
/** Install the listener; returns the remover, which teardown MUST call. */
|
|
48
48
|
export declare function installGlobalKeys(ctx: Pick<AttachSession, 'tui' | 'editor'>, hooks: KeyHooks): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var r=(
|
|
1
|
+
var f=Object.defineProperty;var r=(a,e)=>f(a,"name",{value:e,configurable:!0});import{extractAttachControlInput as m}from"../../../core/keybindings/index.js";import{dispatchAttachAction as o,dispatchAttachBinding as h,dispatchAttachViewportBinding as x}from"./bindings.js";import{FOCUS_IN as d,FOCUS_OUT as u}from"./focus-events.js";const A=1e3;function C(a,e){const{tui:i,editor:s}=a;let l=0;const n=r(t=>()=>{e.isStarting()?e.setNotice("The node is starting \u2014 try again in a moment"):t()},"needsNode"),p={"crtr.attach.detach":e.detach,"crtr.attach.clear-or-detach":r(()=>{const t=Date.now();if(t-l<A){l=0,e.cancelTurn();return}l=t,s.setText(""),e.setNotice(`Editor cleared \u2014 press ${e.detachHint()} again to cancel the agent`),i.requestRender()},"crtr.attach.clear-or-detach"),"crtr.attach.graph.toggle":n(e.toggleGraph),"crtr.attach.help.toggle":e.toggleHelp,"crtr.attach.inbox.toggle":e.toggleInbox,"crtr.attach.inbox-strip":e.toggleInboxStrip,"crtr.attach.model-ladder.next":r(()=>e.cycleModelLadder("forward"),"crtr.attach.model-ladder.next"),"crtr.attach.model-ladder.previous":r(()=>e.cycleModelLadder("backward"),"crtr.attach.model-ladder.previous"),"crtr.attach.command.inspect":n(e.inspectLoadedCommand),"crtr.attach.profile-files":n(e.openProfileFiles),"crtr.attach.search":e.openSearch,"crtr.attach.whip":n(e.whip),"crtr.attach.reload-viewer":e.reloadViewer};return i.addInputListener(t=>{if(t.includes(d)||t.includes(u)){e.setPaneFocused(t.lastIndexOf(d)>t.lastIndexOf(u)),i.requestRender();const g=t.replaceAll(d,"").replaceAll(u,"");return g.length>0?{data:g}:{consume:!0}}const c=m(t);if(c!==void 0)return o(c.actionId,p),c.remaining.length>0?{data:c.remaining}:{consume:!0};if(!e.hasExclusiveSurface())return e.panelHandleKey(t)?{consume:!0}:e.searchHandleKey(t)?{consume:!0}:s.focused&&x(e.bindings(),t,e.viewportActions())?{consume:!0}:e.stripHandleKey(t)?{consume:!0}:e.rosterHandleKey(t)?{consume:!0}:h(e.bindings(),t,p)?{consume:!0}:void 0})}r(C,"installGlobalKeys");export{C as installGlobalKeys};
|
|
@@ -29,9 +29,11 @@ export interface PaneTagIo {
|
|
|
29
29
|
/** This viewer process's identity — the pid, unique per viewer by construction. */
|
|
30
30
|
ownerId: () => string;
|
|
31
31
|
}
|
|
32
|
-
export declare function createPaneTag(remote: boolean, nodeId: string, io?: PaneTagIo): {
|
|
32
|
+
export declare function createPaneTag(remote: boolean, nodeId: string | undefined, io?: PaneTagIo): {
|
|
33
33
|
set: () => void;
|
|
34
34
|
stamp: () => void;
|
|
35
|
+
/** Tag the pane with the node id once a node that was still being created has returned. */
|
|
36
|
+
bindNode: (id: string) => void;
|
|
35
37
|
clear: () => void;
|
|
36
38
|
pane: () => string | undefined;
|
|
37
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var O=Object.defineProperty;var i=(t,n)=>O(t,"name",{value:n,configurable:!0});import{currentTmux as P,getPaneOption as w,setPaneOption as a,stampViewerPaneAsync as h,VIEWER_STAMP_OPTION as f}from"../../../core/runtime/placement-tmux.js";const A={readOption:w,writeOption:i((t,n,r)=>{a(t,n,r)},"writeOption"),stampAsync:h,currentPane:i(()=>process.env.TMUX_PANE??P()?.pane,"currentPane"),ownerId:i(()=>String(process.pid),"ownerId")};function E(t,n,r=A){let e;const u=r.ownerId(),p=i(()=>{if(e===void 0||e==="")return!0;const c=r.readOption(e,d);return c===void 0||c===""?!0:c===u},"stillOwnsPane");return{set:i(()=>{e=r.currentPane(),o(e,u,r.writeOption),n!==void 0&&s(t,e,n,r.writeOption),l(e,r.writeOption),_(t,e,r.writeOption)},"set"),bindNode:i(c=>{n=c,e!==void 0&&s(t,e,c,r.writeOption)},"bindNode"),stamp:i(()=>{t||e===void 0||e===""||r.stampAsync(e)},"stamp"),clear:i(()=>{p()&&(g(t,e,r.writeOption),x(e,r.writeOption),y(t,e,r.writeOption),o(e,"",r.writeOption))},"clear"),pane:i(()=>e,"pane")}}i(E,"createPaneTag");const d="@crtr_viewer_pid";function o(t,n,r){if(!(t===void 0||t===""))try{r(t,d,n)}catch{}}i(o,"claimAttachPane");function _(t,n,r){if(!(t||n===void 0||n===""))try{r(n,f,String(Date.now()))}catch{}}i(_,"stampAttachPane");function y(t,n,r=a){if(!(t||n===void 0||n===""))try{r(n,f,"")}catch{}}i(y,"unstampAttachPane");function s(t,n,r,e=a){if(!(t||n===void 0||n===""))try{e(n,"@crtr_node",r)}catch{}}i(s,"tagAttachPane");function g(t,n,r=a){if(!(t||n===void 0||n===""))try{r(n,"@crtr_node","")}catch{}}i(g,"untagAttachPane");function l(t,n=a){if(!(t===void 0||t===""))try{n(t,"@crtr_attach","1")}catch{}}i(l,"tagAttachViewerPane");function x(t,n=a){if(!(t===void 0||t===""))try{n(t,"@crtr_attach","")}catch{}}i(x,"untagAttachViewerPane");export{d as VIEWER_OWNER_OPTION,E as createPaneTag,s as tagAttachPane,l as tagAttachViewerPane,g as untagAttachPane,x as untagAttachViewerPane};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var A=Object.defineProperty;var n=(s,e)=>A(s,"name",{value:e,configurable:!0});import{AttachRefusedError as C,reconnectShouldGiveUp as I}from"../../../core/broker-client/index.js";const P=1e3,M=3e3;function L(s,e){const{socket:i,canvasSource:R}=s;let m,f=!1,l=!1,D=!1,a=!1,E=n(()=>{},"resolveStopped"),u,w;const _=new Promise(r=>{E=r}),N=n(r=>a?Promise.resolve(!1):new Promise(c=>{const d=n(t=>{u=void 0,w=void 0,c(t)},"settle");u=setTimeout(()=>d(!0),r),w=n(()=>{u!==void 0&&clearTimeout(u),d(!1)},"cancelRetry")}),"waitForRetry");let g=!1,p=!1;const v=n(()=>{p=!1,i.send({type:"hello",role:e.role,client_id:e.clientId,term:{cols:process.stdout.columns??80,rows:process.stdout.rows??24}})},"sendHello"),T=n(async(r=!1)=>{f=!0;let c=!r;c&&e.setNotice("\u21BB node refreshing \u2014 reconnecting\u2026",{sticky:!0});let d=200;try{for(;!a&&!e.isTornDown();){let t;try{t=await R.getRow(s.nodeId)}catch{t=void 0}if(t!==void 0&&I(t)){D=t!==null;break}const y=t?.status==="dead"||t?.status==="canceled",o=t?.status==="idle"||t?.intent==="idle-release"||t?.status==="done",S=o&&!l;l=o,S&&e.onEnterDormancy(),(c||!o)&&(e.setNotice(y?`node is ${t?.status} \u2014 waiting for a revive`:o?"":"\u21BB node refreshing \u2014 reconnecting\u2026",{sticky:!o}),c=!o);try{if(!await Promise.race([i.redial({brokerUnavailableIsExpected:o||y}).then(()=>!0),_.then(()=>!1)])||a||e.isTornDown())return;v(),l=!1,e.setNotice("");return}catch{if(!await N(o||y?M:Math.min(d,P)))return;d*=2}}}finally{f=!1}!a&&!e.isTornDown()&&e.teardown(D?"node-done":"broker-gone")},"attemptReconnect");return{sendHello:v,startDormant:n(()=>{f||a||e.isTornDown()||(l=!0,e.onEnterDormancy(),T(!0))},"startDormant"),isDormant:n(()=>l,"isDormant"),lastSocketError:n(()=>m,"lastSocketError"),install:n(async()=>{i.on("frame",r=>{r.type==="welcome"&&(g=!0),e.onFrame(r)}),i.on("error",r=>{m=r.message,r instanceof C&&(p=!0)}),i.on("close",()=>{if(!e.isTornDown()&&!f){if(e.remote&&e.role==="controller"&&p&&!g){m=`the remote canvas refused the attach to ${s.nodeId}. A writable attach needs message permission on the node; with read permission only, attach with --observer.`,e.teardown("broker-gone");return}T()}})},"install"),stop:n(()=>{a||(a=!0,w?.(),E())},"stop")}}n(L,"createReconnect");export{L as createReconnect};
|
|
@@ -48,11 +48,6 @@ export declare class ViewerSurfaceHost implements SurfaceHost {
|
|
|
48
48
|
notice(text: string, opts?: NoticeOptions): void;
|
|
49
49
|
suspendForChild(): () => void;
|
|
50
50
|
focusNode(nodeId: string): Promise<boolean>;
|
|
51
|
-
pickReviewFile(spec: {
|
|
52
|
-
candidates: readonly string[];
|
|
53
|
-
cwd: string;
|
|
54
|
-
title?: string;
|
|
55
|
-
}): Promise<string | null>;
|
|
56
51
|
/** Offer wheel input to the topmost surface only. */
|
|
57
52
|
handleWheel(direction: 'up' | 'down', lines: number): boolean;
|
|
58
53
|
/** Whether a full-pane surface currently owns input. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var
|
|
1
|
+
var f=Object.defineProperty;var r=(c,e)=>f(c,"name",{value:e,configurable:!0});import{truncateToWidth as u}from"@earendil-works/pi-tui";import{cliClient as d}from"../../../commands/api-client.js";import{focusViewer as m}from"../../../core/runtime/focus-viewer.js";import{daemonErrorMessage as p}from"../../inbox/resolve.js";import{reportInvariant as g}from"./invariant.js";import{SurfaceFrame as v}from"./surface-frame.js";const N={anchor:"top-left",width:"100%",maxHeight:"100%",margin:0},k={anchor:"top-left",width:"100%",margin:0,nonCapturing:!0};class R{static{r(this,"ViewerSurfaceHost")}capabilities;tui;mouse;getRows;statusNotice;formatNotice;noticeMs;selfPane;stack=[];noticeOverlay;noticeTimer;constructor(e){this.tui=e.tui,this.mouse=e.mouse,this.getRows=e.rows,this.statusNotice=e.statusNotice,this.formatNotice=e.formatNotice,this.noticeMs=e.noticeMs,this.selfPane=e.selfPane,this.capabilities={...e.capabilities,selfPane:e.selfPane}}mount(e,t){this.disposeNotice();const o=new v(e,t?.focus??e,this.getRows),n=this.tui.showOverlay(o,N),s={component:e,frame:o,overlay:n,cleanup:[],closed:!1,closing:!1},i=this.stack[this.stack.length-1];return i&&i.overlay.setHidden(!0),this.stack.push(s),{close:r(()=>this.closeEntry(s,!0),"close"),invalidate:r(()=>{!s.closed&&this.stack[this.stack.length-1]===s&&this.tui.requestRender()},"invalidate"),onClose:r(l=>{if(s.closed||s.closing){a("onClose registered after surface close");return}s.cleanup.push(l)},"onClose")}}notice(e,t){if(this.disposeNotice(),this.stack.length===0){this.statusNotice(e,t);return}if(e==="")return;const o=new w(()=>this.formatNotice(e));this.noticeOverlay=this.tui.showOverlay(o,k),t?.sticky!==!0&&this.noticeMs>0&&(this.noticeTimer=setTimeout(()=>{this.noticeTimer=void 0,this.disposeNoticeOverlay()},this.noticeMs))}suspendForChild(){return this.tui.stop(),()=>{this.tui.start(),this.mouse.reassert(),this.tui.invalidate(),this.tui.requestRender(!0)}}async focusNode(e){if(!this.capabilities.canFocusNode||this.selfPane===void 0||this.selfPane==="")return this.notice("Focusing a node needs a local viewer in tmux"),!1;try{const t=d(),o=await t.getNode(e),n=await m(t,e,{pane:this.selfPane,cwd:o.cwd,name:o.name});return n.focused||this.notice("Could not open that node\u2019s viewer"),n.focused}catch(t){return this.notice(p(t)),!1}}handleWheel(e,t){return this.stack[this.stack.length-1]?.component.handleWheel?.(e,t)??!1}hasFullPaneSurface(){return this.stack.length>0}closeAll(){const e=this.stack[0];e&&this.closeEntry(e,!1),this.disposeNotice()}closeEntry(e,t){if(e.closed||e.closing)return;if(this.stack.indexOf(e)===-1){e.closed=!0;return}for(e.closing=!0;this.stack.indexOf(e)!==-1;){const s=this.stack.indexOf(e),i=this.stack[s+1];if(!i)break;this.closeEntry(i,!1)}try{e.overlay.hide()}catch(s){a(`surface overlay hide failed: ${h(s)}`)}for(const s of e.cleanup)try{const i=s();i&&typeof i.then=="function"&&i.catch(l=>a(`surface cleanup failed: ${h(l)}`))}catch(i){a(`surface cleanup failed: ${h(i)}`)}e.cleanup.length=0,e.closed=!0,e.closing=!1;const n=this.stack.indexOf(e);if(n!==-1&&this.stack.splice(n,1),t){this.disposeNotice();const s=this.stack[this.stack.length-1];s&&s.overlay.setHidden(!1)}}disposeNotice(){this.disposeNoticeOverlay(),this.noticeTimer!==void 0&&(clearTimeout(this.noticeTimer),this.noticeTimer=void 0)}disposeNoticeOverlay(){this.noticeOverlay?.hide(),this.noticeOverlay=void 0}}class w{static{r(this,"NoticeOverlay")}text;constructor(e){this.text=e}render(e){return[u(this.text(),Math.max(0,e),"",!0)]}invalidate(){}}function b(c,e){let t=0;return{setRows:r(o=>{t=Math.max(0,Math.floor(o))},"setRows"),render:r(o=>{const n=c.render(o),i=(e===void 0?n:[u(e,Math.max(0,o),"",!0),...n.slice(1)]).slice(0,t);for(;i.length<t;)i.push("");return i},"render"),invalidate:r(()=>c.invalidate(),"invalidate")}}r(b,"titled");function a(c){g("surface-host",c)}r(a,"reportInvariant");function h(c){return c instanceof Error?c.message:String(c)}r(h,"errorMessage");export{R as ViewerSurfaceHost};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AttachSession } from './context.js';
|
|
2
|
-
export type TeardownReason = 'detach' | 'broker-gone' | 'signal' | 'node-done';
|
|
2
|
+
export type TeardownReason = 'detach' | 'broker-gone' | 'signal' | 'node-done' | 'create-failed';
|
|
3
3
|
export type TeardownSession = Pick<AttachSession, 'nodeId' | 'remote' | 'tui' | 'socket'>;
|
|
4
4
|
export interface TeardownHooks {
|
|
5
5
|
/** Stop everything this viewer runs locally — timers, the graph overlay, the
|
|
@@ -13,7 +13,7 @@ export interface TeardownHooks {
|
|
|
13
13
|
/** The exact `crtr surface attach to …` command that reopens this viewer
|
|
14
14
|
* (same node, same --observer / --canvas), printed under the broker-gone
|
|
15
15
|
* message so the user can reattach by hand. */
|
|
16
|
-
reattachCommand: string;
|
|
16
|
+
reattachCommand: () => string;
|
|
17
17
|
/** This viewer's tmux pane, as self-tagged at startup. Used only by the
|
|
18
18
|
* node-done path to close our own pane. */
|
|
19
19
|
tagPane: () => string | undefined;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
${
|
|
3
|
-
Reattach with: ${n.reattachCommand}
|
|
4
|
-
`)}
|
|
1
|
+
var m=Object.defineProperty;var t=(r,n)=>m(r,"name",{value:n,configurable:!0});import{closePane as w,currentTmux as S,inTmux as T}from"../../../core/runtime/placement-tmux.js";import{FOCUS_REPORTING_OFF as I}from"./focus-events.js";function v(r,n){const{tui:f,socket:i,remote:u}=r;let c=!1;const d=t(()=>{if(!c){c=!0;try{process.stdout.write(I),f.stop()}catch{}}},"restore");process.once("exit",d);let s=!1,a;const g=new Promise(e=>{a=e}),l=t(e=>{if(s)return;if(s=!0,n.stopLocal(),e==="detach"&&i.send({type:"bye"}),i.close(),d(),e==="broker-gone"){const o=n.lastSocketError()??`broker gone \u2014 node ${r.nodeId} is no longer running its engine.`;process.stderr.write(`
|
|
2
|
+
${o}
|
|
3
|
+
Reattach with: ${n.reattachCommand()}
|
|
4
|
+
`)}e==="create-failed"&&process.stderr.write(`
|
|
5
|
+
${n.lastSocketError()??"creating the node failed"}
|
|
6
|
+
`);const p=n.undelivered();if(p.length>0&&process.stderr.write(`
|
|
5
7
|
Not delivered:
|
|
6
|
-
${
|
|
8
|
+
${p.join(`
|
|
7
9
|
---
|
|
8
10
|
`)}
|
|
9
11
|
`),e==="node-done"){process.stderr.write(`
|
|
10
|
-
\u2713 node ${
|
|
11
|
-
`);const
|
|
12
|
+
\u2713 node ${r.nodeId} finished \u2014 final report submitted.
|
|
13
|
+
`);const o=n.tagPane()??process.env.TMUX_PANE??S()?.pane;!u&&o!==void 0&&T()&&w(o)}a()},"teardown");return{done:g,teardown:l,isTornDown:t(()=>s,"isTornDown"),installSignalHandlers:t(()=>{const e=t(()=>l("signal"),"onSignal");process.once("SIGTERM",e),process.once("SIGHUP",e),process.once("SIGINT",e)},"installSignalHandlers")}}t(v,"createTeardown");export{v as createTeardown};
|
|
@@ -7,12 +7,14 @@ import type { PersonSettingsDTO } from '../../api/index.js';
|
|
|
7
7
|
* always restoring the terminal first. `canvasName`, when set, attaches over
|
|
8
8
|
* a relayed WebSocket to that `remoteCanvas.targets.<name>` instead of the
|
|
9
9
|
* local unix socket — see the `--canvas` flag on `attachToLeaf`. */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/** A root whose create request is still in flight: the viewer paints and takes input at once, and binds to the node when `created` resolves. */
|
|
11
|
+
export interface PendingRoot {
|
|
12
|
+
cwd: string;
|
|
13
|
+
profile_id: string;
|
|
14
|
+
created: Promise<NodeDetailDTO>;
|
|
14
15
|
settings: PersonSettingsDTO;
|
|
15
16
|
initialWhip: boolean;
|
|
16
|
-
}
|
|
17
|
+
}
|
|
18
|
+
export declare function runAttach(target: string | PendingRoot, observer: boolean, canvasName?: string, wakeParked?: boolean,
|
|
17
19
|
/** Called synchronously just before the viewer takes the terminal. */
|
|
18
20
|
onConnected?: () => void): Promise<void>;
|