@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
|
@@ -63,61 +63,61 @@ export async function preWaitForViewSocket(nodeId) {
|
|
|
63
63
|
await new Promise((r) => setTimeout(r, 100));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
/**
|
|
67
|
-
* a plain `InputError` for an unknown node
|
|
68
|
-
export
|
|
66
|
+
/** Build the not-yet-connected socket and canvas source. No node is resolved or dialed until `bind` names one: a viewer whose root is
|
|
67
|
+
* still being created paints first and binds when the create returns. `bind` rejects with a plain `InputError` for an unknown node. */
|
|
68
|
+
export function connectToNode(canvasName, wakeParked = true) {
|
|
69
69
|
// An imported Mac has no local canvas API: its canvas and its brokers' viewer channels are reached through the cloud control plane,
|
|
70
70
|
// so attach without `--canvas` dials the cloud with the person's sign-in. It is still the person's own attach, not a `--canvas` view:
|
|
71
71
|
// `remote` stays false, so the viewer claims the controller role like any local attach.
|
|
72
72
|
const remote = canvasName !== undefined;
|
|
73
73
|
const machine = remote ? undefined : readMachineConfig();
|
|
74
|
-
// Attach must NOT silently honor a durable `crtr canvas use` selection:
|
|
75
|
-
//
|
|
76
|
-
// not-found and reconnect-give-up handling, so an implicit remote redirect
|
|
77
|
-
// (from a `canvas use cloud` some other command left active) would be
|
|
78
|
-
// surprising for a command whose whole meaning is "attach to a node on THIS
|
|
79
|
-
// canvas". Go remote ONLY when `--canvas` was passed on THIS invocation —
|
|
80
|
-
// never fall through to resolveCanvasSource's activeCanvas precedence, which
|
|
81
|
-
// is right for `node inspect`/`canvas browse` but not here.
|
|
74
|
+
// Attach must NOT silently honor a durable `crtr canvas use` selection: go remote ONLY when `--canvas` was passed on THIS invocation —
|
|
75
|
+
// never fall through to resolveCanvasSource's activeCanvas precedence, which is right for `node inspect`/`canvas browse` but not here.
|
|
82
76
|
const canvasSource = canvasName !== undefined ? cliCanvasSource({ canvasName }) : new ApiCanvasSource();
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (localMeta === null) {
|
|
101
|
-
throw new InputError({
|
|
102
|
-
error: 'not_found',
|
|
103
|
-
message: `no node: ${nodeId}`,
|
|
104
|
-
received: nodeId,
|
|
105
|
-
next: 'List nodes with `crtr node inspect list`.',
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
meta = localMeta;
|
|
109
|
-
nodeIdentity = localMeta;
|
|
110
|
-
if (machine !== undefined) {
|
|
111
|
-
// On a Mac the viewer's WebSocket upgrade alone admits the attach: it authorizes, revives and waits for the broker once, and its channel
|
|
112
|
-
// is the viewer's. A focus of a parked node dials without waking it; the upgrade's `node_dormant` refusal says the node is parked.
|
|
113
|
-
transport = new RelayTransport(nodeId, await machineRelayTarget(machine.apiUrl, machine.directoryUrl), wakeParked);
|
|
77
|
+
const socket = new BrokerClient(undefined);
|
|
78
|
+
let boundId;
|
|
79
|
+
const nodeId = () => {
|
|
80
|
+
if (boundId === undefined)
|
|
81
|
+
throw new Error('attach has no node yet');
|
|
82
|
+
return boundId;
|
|
83
|
+
};
|
|
84
|
+
/** Build the transport for `id` and give it to the socket. A remote node id never exists in THIS machine's canvas.db, so `--canvas`
|
|
85
|
+
* skips the local lookup and uses the CLI's own cwd as `meta` (theming and this pane's git status are viewer-local concerns). */
|
|
86
|
+
const bind = async (id, known) => {
|
|
87
|
+
boundId = id;
|
|
88
|
+
let transport;
|
|
89
|
+
let meta;
|
|
90
|
+
let nodeIdentity;
|
|
91
|
+
if (canvasName !== undefined) {
|
|
92
|
+
meta = { cwd: process.cwd() };
|
|
93
|
+
transport = new RelayTransport(id, resolveRemoteCanvasTarget(canvasName));
|
|
114
94
|
}
|
|
115
95
|
else {
|
|
116
|
-
//
|
|
117
|
-
|
|
96
|
+
// A caller that just created the node already holds its detail: no second read.
|
|
97
|
+
const localMeta = known ?? await canvasSource.getNode(id);
|
|
98
|
+
if (localMeta === null) {
|
|
99
|
+
throw new InputError({
|
|
100
|
+
error: 'not_found',
|
|
101
|
+
message: `no node: ${id}`,
|
|
102
|
+
received: id,
|
|
103
|
+
next: 'List nodes with `crtr node inspect list`.',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
meta = localMeta;
|
|
107
|
+
nodeIdentity = localMeta;
|
|
108
|
+
if (machine !== undefined) {
|
|
109
|
+
// On a Mac the viewer's WebSocket upgrade alone admits the attach: it authorizes, revives and waits for the broker once, and its channel
|
|
110
|
+
// is the viewer's. A focus of a parked node dials without waking it; the upgrade's `node_dormant` refusal says the node is parked.
|
|
111
|
+
transport = new RelayTransport(id, await machineRelayTarget(machine.apiUrl, machine.directoryUrl), wakeParked);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// The attach ensure runs in `dial()`; the viewer connects through crtrd's Unix-socket WebSocket bridge.
|
|
115
|
+
transport = new RelayTransport(id, { socketPath: apiSocketPath() });
|
|
116
|
+
}
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
socket.bindTransport(transport);
|
|
119
|
+
return { meta, nodeIdentity };
|
|
120
|
+
};
|
|
121
121
|
const local = canvasName === undefined && machine === undefined;
|
|
122
122
|
/** One error shape for a connect-time failure. */
|
|
123
123
|
const toAttachError = (err) => {
|
|
@@ -129,19 +129,19 @@ export async function connectToNode(nodeId, canvasName, wakeParked = true, known
|
|
|
129
129
|
return new InputError({
|
|
130
130
|
error: 'no_broker',
|
|
131
131
|
message: err.message,
|
|
132
|
-
received: nodeId,
|
|
132
|
+
received: nodeId(),
|
|
133
133
|
next: 'Focus or revive the node first — attach needs a running headless broker.',
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
return new InputError({
|
|
137
137
|
error: 'socket_error',
|
|
138
|
-
message: `could not attach to node ${nodeId}: ${String(err?.message ?? err)}`,
|
|
139
|
-
received: nodeId,
|
|
138
|
+
message: `could not attach to node ${nodeId()}: ${String(err?.message ?? err)}`,
|
|
139
|
+
received: nodeId(),
|
|
140
140
|
next: 'Check the node has a running headless broker.',
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
143
|
const parkedSnapshot = async () => {
|
|
144
|
-
const saved = await cliClient().getSnapshot(nodeId);
|
|
144
|
+
const saved = await cliClient().getSnapshot(nodeId());
|
|
145
145
|
// The API DTO stays dependency-light and structural; this viewer is the
|
|
146
146
|
// consumer that knows the complete broker snapshot contract.
|
|
147
147
|
return { snapshot: saved.snapshot, commands: saved.commands };
|
|
@@ -151,7 +151,7 @@ export async function connectToNode(nodeId, canvasName, wakeParked = true, known
|
|
|
151
151
|
// Attach revives a dormant node (B2 acceptance): the server-side ensureAttach runs reviveNode (the ONE sanctioned launcher)
|
|
152
152
|
// and waits for the broker's view socket. The daemon, not the broker, owns attending viewer presence.
|
|
153
153
|
try {
|
|
154
|
-
const attach = await cliClient().ensureAttach(nodeId, { resume: true, revive: true, wakeParked });
|
|
154
|
+
const attach = await cliClient().ensureAttach(nodeId(), { resume: true, revive: true, wakeParked });
|
|
155
155
|
// A parked node focused without waking has deliberately no socket to wait for.
|
|
156
156
|
if (attach.parked)
|
|
157
157
|
return await parkedSnapshot();
|
|
@@ -159,7 +159,7 @@ export async function connectToNode(nodeId, canvasName, wakeParked = true, known
|
|
|
159
159
|
catch (err) {
|
|
160
160
|
rethrowAsCliError(err, 'The node may be finalized or otherwise not attachable.');
|
|
161
161
|
}
|
|
162
|
-
await preWaitForViewSocket(nodeId);
|
|
162
|
+
await preWaitForViewSocket(nodeId());
|
|
163
163
|
}
|
|
164
164
|
try {
|
|
165
165
|
await new Promise((resolve, reject) => {
|
|
@@ -181,5 +181,5 @@ export async function connectToNode(nodeId, canvasName, wakeParked = true, known
|
|
|
181
181
|
mark('viewer.transport_open');
|
|
182
182
|
return undefined;
|
|
183
183
|
};
|
|
184
|
-
return { remote, canvasSource,
|
|
184
|
+
return { remote, canvasSource, socket, bind, dial };
|
|
185
185
|
}
|
|
@@ -29,7 +29,7 @@ export function createDocumentLinks(opts) {
|
|
|
29
29
|
}, () => { rosterLoaded = false; });
|
|
30
30
|
};
|
|
31
31
|
const context = {
|
|
32
|
-
selfNodeId
|
|
32
|
+
get selfNodeId() { return opts.selfNodeId(); },
|
|
33
33
|
nodeName: (nodeId) => {
|
|
34
34
|
const name = names.get(nodeId);
|
|
35
35
|
if (name === undefined)
|
|
@@ -21,7 +21,7 @@ import { defaultAgentDir } from '../config.js';
|
|
|
21
21
|
/** Construct the viewer's one capability authority. */
|
|
22
22
|
export function createViewerCapabilitiesForInput(ctx, isBrokerOffline) {
|
|
23
23
|
return createViewerCapabilities({
|
|
24
|
-
nodeId
|
|
24
|
+
get nodeId() { return ctx.nodeId; },
|
|
25
25
|
profileId: ctx.meta.profile_id ?? undefined,
|
|
26
26
|
remote: ctx.remote,
|
|
27
27
|
role: ctx.role,
|
|
@@ -45,7 +45,7 @@ export function lessDetailNotice(change) {
|
|
|
45
45
|
}
|
|
46
46
|
/** Build the viewer's InputController with every hook answered. */
|
|
47
47
|
export function createInputController(ctx, km, capabilities, hooks) {
|
|
48
|
-
const {
|
|
48
|
+
const { socket, tui, editor, containers } = ctx;
|
|
49
49
|
const { setNotice } = hooks;
|
|
50
50
|
// Auth pickers — viewer-local OAuth/API-key flows against the SAME auth.json
|
|
51
51
|
// the broker uses (broker + viewer share a filesystem in the tmux-local attach
|
|
@@ -129,6 +129,7 @@ export function createInputController(ctx, km, capabilities, hooks) {
|
|
|
129
129
|
// broker (it goes to crtrd via `cliClient`), so leaving it wired for an
|
|
130
130
|
// observer would let a read-only viewer wake and message the node.
|
|
131
131
|
isDormant: hooks.isDormant,
|
|
132
|
+
isStarting: hooks.isStarting,
|
|
132
133
|
onDormantSubmit: !capabilities.permits('wake-dormant') ? undefined : (msgText) => {
|
|
133
134
|
void (async () => {
|
|
134
135
|
try {
|
|
@@ -137,7 +138,7 @@ export function createInputController(ctx, km, capabilities, hooks) {
|
|
|
137
138
|
// (verbatim, no "From … — N updates" digest; see coalesce()), exactly
|
|
138
139
|
// like the live path. NOT `CRTR_NODE_ID`: direct keyboard input is
|
|
139
140
|
// the human, not whatever node owns the shell that launched us.
|
|
140
|
-
const res = await cliClient().sendMessage(nodeId, { body: msgText, from: 'human' });
|
|
141
|
+
const res = await cliClient().sendMessage(ctx.nodeId, { body: msgText, from: 'human' });
|
|
141
142
|
setNotice(res.revived ? '↻ waking node…' : '✉ delivered — node reads on next wake');
|
|
142
143
|
}
|
|
143
144
|
catch (err) {
|
|
@@ -16,6 +16,13 @@ const CLEAR_OR_DETACH_MS = 1000;
|
|
|
16
16
|
export function installGlobalKeys(ctx, hooks) {
|
|
17
17
|
const { tui, editor } = ctx;
|
|
18
18
|
let lastClearOrDetachAt = 0;
|
|
19
|
+
// The one starting check for every node-relative action; detach, clear, help, search, the inbox and the request strip work without a node.
|
|
20
|
+
const needsNode = (run) => () => {
|
|
21
|
+
if (hooks.isStarting())
|
|
22
|
+
hooks.setNotice('The node is starting — try again in a moment');
|
|
23
|
+
else
|
|
24
|
+
run();
|
|
25
|
+
};
|
|
19
26
|
const actions = {
|
|
20
27
|
'crtr.attach.detach': hooks.detach,
|
|
21
28
|
'crtr.attach.clear-or-detach': () => {
|
|
@@ -30,18 +37,17 @@ export function installGlobalKeys(ctx, hooks) {
|
|
|
30
37
|
hooks.setNotice(`Editor cleared — press ${hooks.detachHint()} again to cancel the agent`);
|
|
31
38
|
tui.requestRender();
|
|
32
39
|
},
|
|
33
|
-
'crtr.attach.graph.toggle': hooks.toggleGraph,
|
|
40
|
+
'crtr.attach.graph.toggle': needsNode(hooks.toggleGraph),
|
|
34
41
|
'crtr.attach.help.toggle': hooks.toggleHelp,
|
|
35
42
|
'crtr.attach.inbox.toggle': hooks.toggleInbox,
|
|
36
43
|
'crtr.attach.inbox-strip': hooks.toggleInboxStrip,
|
|
37
44
|
// A plain broker frame, so this works locally and remotely alike; the broker gates observers on controller role.
|
|
38
45
|
'crtr.attach.model-ladder.next': () => hooks.cycleModelLadder('forward'),
|
|
39
46
|
'crtr.attach.model-ladder.previous': () => hooks.cycleModelLadder('backward'),
|
|
40
|
-
'crtr.attach.command.inspect': hooks.inspectLoadedCommand,
|
|
41
|
-
'crtr.attach.
|
|
42
|
-
'crtr.attach.profile-files': hooks.openProfileFiles,
|
|
47
|
+
'crtr.attach.command.inspect': needsNode(hooks.inspectLoadedCommand),
|
|
48
|
+
'crtr.attach.profile-files': needsNode(hooks.openProfileFiles),
|
|
43
49
|
'crtr.attach.search': hooks.openSearch,
|
|
44
|
-
'crtr.attach.whip': hooks.whip,
|
|
50
|
+
'crtr.attach.whip': needsNode(hooks.whip),
|
|
45
51
|
'crtr.attach.reload-viewer': hooks.reloadViewer,
|
|
46
52
|
};
|
|
47
53
|
return tui.addInputListener((data) => {
|
|
@@ -31,10 +31,16 @@ export function createPaneTag(remote, nodeId, io = realPaneTagIo) {
|
|
|
31
31
|
set: () => {
|
|
32
32
|
pane = io.currentPane();
|
|
33
33
|
claimAttachPane(pane, ownerPid, io.writeOption);
|
|
34
|
-
|
|
34
|
+
if (nodeId !== undefined)
|
|
35
|
+
tagAttachPane(remote, pane, nodeId, io.writeOption);
|
|
35
36
|
tagAttachViewerPane(pane, io.writeOption);
|
|
36
37
|
stampAttachPane(remote, pane, io.writeOption);
|
|
37
38
|
},
|
|
39
|
+
bindNode: (id) => {
|
|
40
|
+
nodeId = id;
|
|
41
|
+
if (pane !== undefined)
|
|
42
|
+
tagAttachPane(remote, pane, id, io.writeOption);
|
|
43
|
+
},
|
|
38
44
|
stamp: () => {
|
|
39
45
|
if (remote || pane === undefined || pane === '')
|
|
40
46
|
return;
|
|
@@ -13,7 +13,7 @@ const RECONNECT_ACTIVE_DELAY_CAP_MS = 1_000;
|
|
|
13
13
|
/** Dormant by choice — low-rate patience. */
|
|
14
14
|
const RECONNECT_DORMANT_DELAY_MS = 3_000;
|
|
15
15
|
export function createReconnect(ctx, hooks) {
|
|
16
|
-
const {
|
|
16
|
+
const { socket, canvasSource } = ctx;
|
|
17
17
|
let lastSocketError;
|
|
18
18
|
let reconnecting = false;
|
|
19
19
|
let viewerDormant = false;
|
|
@@ -86,7 +86,7 @@ export function createReconnect(ctx, hooks) {
|
|
|
86
86
|
// `--canvas`, so `getRow` works for both cases — always attempt it.
|
|
87
87
|
let row;
|
|
88
88
|
try {
|
|
89
|
-
row = await canvasSource.getRow(nodeId);
|
|
89
|
+
row = await canvasSource.getRow(ctx.nodeId);
|
|
90
90
|
}
|
|
91
91
|
catch {
|
|
92
92
|
row = undefined;
|
|
@@ -168,7 +168,7 @@ export function createReconnect(ctx, hooks) {
|
|
|
168
168
|
// attach closed that way before the session's first welcome is a refusal,
|
|
169
169
|
// not a broker to redial; a plain drop or a 1011 "no running broker" is redialed.
|
|
170
170
|
if (hooks.remote && hooks.role === 'controller' && refusedByRelay && !welcomed) {
|
|
171
|
-
lastSocketError = `the remote canvas refused the attach to ${nodeId}. A writable attach needs message permission on the node; with read permission only, attach with --observer.`;
|
|
171
|
+
lastSocketError = `the remote canvas refused the attach to ${ctx.nodeId}. A writable attach needs message permission on the node; with read permission only, attach with --observer.`;
|
|
172
172
|
hooks.teardown('broker-gone');
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
@@ -2,7 +2,6 @@ import { truncateToWidth, } from '@earendil-works/pi-tui';
|
|
|
2
2
|
import { cliClient } from '../../../commands/api-client.js';
|
|
3
3
|
import { focusViewer } from '../../../core/runtime/focus-viewer.js';
|
|
4
4
|
import { daemonErrorMessage } from '../../inbox/resolve.js';
|
|
5
|
-
import { buildFileReviewPicker } from '../overlays/file-review.js';
|
|
6
5
|
import { reportInvariant as report } from './invariant.js';
|
|
7
6
|
import { SurfaceFrame } from './surface-frame.js';
|
|
8
7
|
const SURFACE_OVERLAY_OPTIONS = {
|
|
@@ -120,22 +119,6 @@ export class ViewerSurfaceHost {
|
|
|
120
119
|
return false;
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
|
-
pickReviewFile(spec) {
|
|
124
|
-
return new Promise((resolve) => {
|
|
125
|
-
let handle;
|
|
126
|
-
let settled = false;
|
|
127
|
-
const settle = (value) => {
|
|
128
|
-
if (settled)
|
|
129
|
-
return;
|
|
130
|
-
settled = true;
|
|
131
|
-
resolve(value);
|
|
132
|
-
handle.close();
|
|
133
|
-
};
|
|
134
|
-
const picker = buildFileReviewPicker(spec.candidates, spec.cwd, (file) => settle(file), () => settle(null), (message) => this.notice(message));
|
|
135
|
-
handle = this.mount(titled(picker.component, spec.title), { focus: picker.focus });
|
|
136
|
-
handle.onClose(() => settle(null));
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
122
|
/** Offer wheel input to the topmost surface only. */
|
|
140
123
|
handleWheel(direction, lines) {
|
|
141
124
|
return this.stack[this.stack.length - 1]?.component.handleWheel?.(direction, lines) ?? false;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { closePane, currentTmux, inTmux } from '../../../core/runtime/placement-tmux.js';
|
|
26
26
|
import { FOCUS_REPORTING_OFF } from './focus-events.js';
|
|
27
27
|
export function createTeardown(s, hooks) {
|
|
28
|
-
const { tui, socket,
|
|
28
|
+
const { tui, socket, remote } = s;
|
|
29
29
|
let restored = false;
|
|
30
30
|
const restore = () => {
|
|
31
31
|
if (restored)
|
|
@@ -69,9 +69,12 @@ export function createTeardown(s, hooks) {
|
|
|
69
69
|
// buy immediate cleanup (future work).
|
|
70
70
|
if (reason === 'broker-gone') {
|
|
71
71
|
const msg = hooks.lastSocketError() ??
|
|
72
|
-
`broker gone — node ${nodeId} is no longer running its engine.`;
|
|
73
|
-
process.stderr.write(`\n${msg}\nReattach with: ${hooks.reattachCommand}\n`);
|
|
72
|
+
`broker gone — node ${s.nodeId} is no longer running its engine.`;
|
|
73
|
+
process.stderr.write(`\n${msg}\nReattach with: ${hooks.reattachCommand()}\n`);
|
|
74
74
|
}
|
|
75
|
+
// No node id exists, so there is nothing to reattach to and nothing to claim about the server's state: print the error alone.
|
|
76
|
+
if (reason === 'create-failed')
|
|
77
|
+
process.stderr.write(`\n${hooks.lastSocketError() ?? 'creating the node failed'}\n`);
|
|
75
78
|
const unsent = hooks.undelivered();
|
|
76
79
|
if (unsent.length > 0)
|
|
77
80
|
process.stderr.write(`\nNot delivered:\n${unsent.join('\n---\n')}\n`);
|
|
@@ -80,7 +83,7 @@ export function createTeardown(s, hooks) {
|
|
|
80
83
|
// (siblings in a swap-pane window survive); the daemon reconciles the
|
|
81
84
|
// now-gone viewer row.
|
|
82
85
|
if (reason === 'node-done') {
|
|
83
|
-
process.stderr.write(`\n✓ node ${nodeId} finished — final report submitted.\n`);
|
|
86
|
+
process.stderr.write(`\n✓ node ${s.nodeId} finished — final report submitted.\n`);
|
|
84
87
|
const pane = hooks.tagPane() ?? process.env['TMUX_PANE'] ?? currentTmux()?.pane;
|
|
85
88
|
if (!remote && pane !== undefined && inTmux())
|
|
86
89
|
closePane(pane);
|