@north-light/cli 0.3.674 → 0.3.675

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/clients/attach/session/connection.d.ts +2 -1
  2. package/dist/clients/attach/session/connection.js +1 -1
  3. package/dist/clients/attach/viewer.d.ts +11 -1
  4. package/dist/clients/attach/viewer.js +524 -524
  5. package/dist/commands/person-settings.d.ts +5 -0
  6. package/dist/commands/person-settings.js +1 -1
  7. package/dist/core/graph/reader.d.ts +2 -1
  8. package/dist/core/graph/reader.js +3 -3
  9. package/dist/core/graph/repo-sync/repos.d.ts +24 -3
  10. package/dist/core/graph/repo-sync/repos.js +4 -4
  11. package/dist/core/profiles/select.d.ts +3 -1
  12. package/dist/core/profiles/select.js +25 -25
  13. package/dist/core/runtime/bearings.d.ts +3 -3
  14. package/dist/core/runtime/bearings.js +6 -6
  15. package/dist/core/runtime/boot-root.d.ts +3 -3
  16. package/dist/core/runtime/boot-root.js +6 -4
  17. package/dist/core/runtime/deliver-live.js +1 -1
  18. package/dist/core/runtime/front-door.js +1 -1
  19. package/dist/core/runtime/starting-screen.d.ts +12 -0
  20. package/dist/core/runtime/starting-screen.js +9 -0
  21. package/dist/core/substrate/delivery/deliver.d.ts +1 -1
  22. package/dist/core/substrate/delivery/deliver.js +3 -3
  23. package/dist/core/substrate/subject.d.ts +3 -1
  24. package/dist/core/substrate/subject.js +1 -1
  25. package/dist/daemon/api/handlers/broker-ops.js +1 -1
  26. package/dist/daemon/api/handlers/delivery.js +1 -1
  27. package/package.json +3 -3
  28. package/packages/crouter-api/dist/clients/attach/session/connection.js +3 -2
  29. package/packages/crouter-api/dist/clients/attach/viewer.js +16 -7
  30. package/packages/crouter-api/dist/commands/person-settings.js +10 -3
  31. package/packages/crouter-api/dist/core/graph/reader.js +9 -4
  32. package/packages/crouter-api/dist/core/graph/repo-sync/repos.js +56 -13
  33. package/packages/crouter-api/dist/core/profiles/select.js +17 -7
  34. package/packages/crouter-api/dist/core/runtime/bearings.js +11 -12
  35. package/packages/crouter-api/dist/core/runtime/deliver-live.js +1 -1
  36. package/packages/crouter-api/dist/core/substrate/delivery/deliver.js +3 -3
  37. package/packages/crouter-api/dist/core/substrate/subject.js +4 -4
  38. package/packages/crouter-api/dist/daemon/api/handlers/broker-ops.js +6 -4
  39. package/packages/crouter-api/package.json +1 -1
  40. package/packages/crouter-identity/package.json +1 -1
  41. package/packages/crouter-plugin/package.json +3 -3
  42. package/runtime.lock.json +14 -14
@@ -1,5 +1,6 @@
1
1
  import type { BrokerSnapshot, ClientRole } from '../../../core/runtime/broker-protocol.js';
2
2
  import type { CanvasSource } from '../../../core/canvas/source.js';
3
+ import type { NodeDetailDTO } from '../../../api/dto/nodes.js';
3
4
  import type { NodeMeta } from '../../../core/canvas/types.js';
4
5
  import { BrokerClient, type RelayTarget } from '../../../core/broker-client/index.js';
5
6
  /** A relay target for an imported Mac: the cloud control plane, with the signed-in person's bearer. `relayToken` is read at each dial. */
@@ -51,4 +52,4 @@ export interface AttachConnection {
51
52
  /** Resolve the target, revive the node if it is dormant (server-side), and dial
52
53
  * the broker. Rejects with a plain `InputError` — no terminal has been taken
53
54
  * over at this point, so a failure here is an ordinary non-zero CLI exit. */
54
- export declare function connectToNode(nodeId: string, canvasName?: string, wakeParked?: boolean): Promise<AttachConnection>;
55
+ export declare function connectToNode(nodeId: string, canvasName?: string, wakeParked?: boolean, known?: NodeDetailDTO): Promise<AttachConnection>;
@@ -1 +1 @@
1
- var T=Object.defineProperty;var n=(e,t)=>T(e,"name",{value:t,configurable:!0});import{createConnection as R}from"node:net";import{apiSocketPath as _,viewSocketPath as A}from"../../../core/canvas/paths.js";import{BrokerClient as x,BrokerUnavailableError as P,RelayTransport as d}from"../../../core/broker-client/index.js";import{resolveRemoteCanvasTarget as M}from"../../../core/remote-canvas-target.js";import{ApiCanvasSource as B,cliCanvasSource as F,cliClient as b,rethrowAsCliError as H}from"../../../commands/api-client.js";import{InputError as k}from"../../../core/io.js";import{readMachineConfig as $}from"../../../daemon/machine-link/config.js";import{personBearer as y}from"../../../core/directory/person-credential.js";const D=15e3;async function U(e,t){let a=await y(t);return setInterval(()=>{y(t).then(s=>{a=s},()=>{})},D).unref(),{previewEndpoint:e,get relayToken(){return a}}}n(U,"machineRelayTarget");function O(e){return e?"observer":"controller"}n(O,"resolveHelloRole");async function W(e){const t=Number(process.env.CRTR_ATTACH_WAIT_MS??"");if(!Number.isFinite(t)||t<=0)return;const a=A(e),u=Date.now()+t;for(;Date.now()<u;){if(await new Promise(c=>{const o=R(a),m=n(l=>{o.destroy(),c(l)},"settle");o.once("connect",()=>m(!0)),o.once("error",()=>m(!1))}))return;await new Promise(c=>setTimeout(c,100))}}n(W,"preWaitForViewSocket");async function Q(e,t,a=!0){const u=t!==void 0,s=u?void 0:$(),c=t!==void 0?F({canvasName:t}):new B;let o,m,l,f,v;if(t!==void 0)o={cwd:process.cwd()},l=new d(e,M(t));else{const r=await c.getNode(e);if(r===null)throw new k({error:"not_found",message:`no node: ${e}`,received:e,next:"List nodes with `crtr node inspect list`."});o=r,m=r;try{if((await b().ensureAttach(e,{resume:!0,revive:!0,wakeParked:a})).parked){const w=await b().getSnapshot(e);f=w.snapshot,v=w.commands}}catch(p){H(p,"The node may be finalized or otherwise not attachable.")}s!==void 0?l=new d(e,await U(s.apiUrl,s.directoryUrl)):(f===void 0&&await W(e),l=new d(e,{socketPath:_()}))}const i=new x(e,{transport:l}),g=n(r=>r instanceof P?new k({error:"no_broker",message:r.message,received:e,next:"Focus or revive the node first \u2014 attach needs a running headless broker."}):new k({error:"socket_error",message:`could not attach to node ${e}: ${String(r?.message??r)}`,received:e,next:"Check the node has a running headless broker."}),"toAttachError");let h;return i.on("error",r=>{h===void 0&&(h=r)}),f===void 0&&await new Promise(async(r,p)=>{const w=n(()=>{S(),r()},"onConnect"),C=n(E=>{S(),p(E)},"onErr"),S=n(()=>{i.off("connect",w),i.off("error",C)},"cleanup");i.on("connect",w),i.on("error",C),i.connect()}).catch(r=>{throw g(r)}),{remote:u,canvasSource:c,meta:o,nodeIdentity:m,socket:i,...f===void 0?{}:{initialSnapshot:f,initialCommands:v},assertConnected:n(()=>{if(f===void 0&&h!==void 0)throw g(h)},"assertConnected")}}n(Q,"connectToNode");export{Q as connectToNode,U as machineRelayTarget,W as preWaitForViewSocket,O as resolveHelloRole};
1
+ var R=Object.defineProperty;var n=(e,t)=>R(e,"name",{value:t,configurable:!0});import{createConnection as _}from"node:net";import{apiSocketPath as A,viewSocketPath as x}from"../../../core/canvas/paths.js";import{BrokerClient as P,BrokerUnavailableError as M,RelayTransport as k}from"../../../core/broker-client/index.js";import{resolveRemoteCanvasTarget as B}from"../../../core/remote-canvas-target.js";import{ApiCanvasSource as F,cliCanvasSource as H,cliClient as y,rethrowAsCliError as $}from"../../../commands/api-client.js";import{InputError as v}from"../../../core/io.js";import{readMachineConfig as D}from"../../../daemon/machine-link/config.js";import{personBearer as E}from"../../../core/directory/person-credential.js";const U=15e3;async function W(e,t){let a=await E(t);return setInterval(()=>{E(t).then(f=>{a=f},()=>{})},U).unref(),{previewEndpoint:e,get relayToken(){return a}}}n(W,"machineRelayTarget");function Q(e){return e?"observer":"controller"}n(Q,"resolveHelloRole");async function z(e){const t=Number(process.env.CRTR_ATTACH_WAIT_MS??"");if(!Number.isFinite(t)||t<=0)return;const a=x(e),m=Date.now()+t;for(;Date.now()<m;){if(await new Promise(o=>{const s=_(a),c=n(w=>{s.destroy(),o(w)},"settle");s.once("connect",()=>c(!0)),s.once("error",()=>c(!1))}))return;await new Promise(o=>setTimeout(o,100))}}n(z,"preWaitForViewSocket");async function X(e,t,a=!0,m){const f=t!==void 0,o=f?void 0:D(),s=t!==void 0?H({canvasName:t}):new F;let c,w,h,l,g;if(t!==void 0)c={cwd:process.cwd()},h=new k(e,B(t));else{const r=m??await s.getNode(e);if(r===null)throw new v({error:"not_found",message:`no node: ${e}`,received:e,next:"List nodes with `crtr node inspect list`."});c=r,w=r;try{if((await y().ensureAttach(e,{resume:!0,revive:!0,wakeParked:a})).parked){const u=await y().getSnapshot(e);l=u.snapshot,g=u.commands}}catch(d){$(d,"The node may be finalized or otherwise not attachable.")}o!==void 0?h=new k(e,await W(o.apiUrl,o.directoryUrl)):(l===void 0&&await z(e),h=new k(e,{socketPath:A()}))}const i=new P(e,{transport:h}),C=n(r=>r instanceof M?new v({error:"no_broker",message:r.message,received:e,next:"Focus or revive the node first \u2014 attach needs a running headless broker."}):new v({error:"socket_error",message:`could not attach to node ${e}: ${String(r?.message??r)}`,received:e,next:"Check the node has a running headless broker."}),"toAttachError");let p;return i.on("error",r=>{p===void 0&&(p=r)}),l===void 0&&await new Promise(async(r,d)=>{const u=n(()=>{b(),r()},"onConnect"),S=n(T=>{b(),d(T)},"onErr"),b=n(()=>{i.off("connect",u),i.off("error",S)},"cleanup");i.on("connect",u),i.on("error",S),i.connect()}).catch(r=>{throw C(r)}),{remote:f,canvasSource:s,meta:c,nodeIdentity:w,socket:i,...l===void 0?{}:{initialSnapshot:l,initialCommands:g},assertConnected:n(()=>{if(l===void 0&&p!==void 0)throw C(p)},"assertConnected")}}n(X,"connectToNode");export{X as connectToNode,W as machineRelayTarget,z as preWaitForViewSocket,Q as resolveHelloRole};
@@ -1,8 +1,18 @@
1
1
  import './session/pi-assets.js';
2
2
  import './session/pi-oauth-flows.js';
3
+ import type { NodeDetailDTO } from '../../api/dto/nodes.js';
4
+ import type { PersonSettingsDTO } from '../../api/index.js';
3
5
  /** Run the interactive attach session against `nodeId`. Resolves when the
4
6
  * viewer detaches (ctrl+c/ctrl+d), the broker goes away, or a signal lands —
5
7
  * always restoring the terminal first. `canvasName`, when set, attaches over
6
8
  * a relayed WebSocket to that `remoteCanvas.targets.<name>` instead of the
7
9
  * local unix socket — see the `--canvas` flag on `attachToLeaf`. */
8
- export declare function runAttach(nodeId: string, observer: boolean, canvasName?: string, wakeParked?: boolean): Promise<void>;
10
+ export declare function runAttach(nodeId: string, observer: boolean, canvasName?: string, wakeParked?: boolean,
11
+ /** What a caller that just created the node already holds: the node's detail, the person's settings answer, and whether to play the first-prompt animation. */
12
+ held?: {
13
+ node: NodeDetailDTO;
14
+ settings: PersonSettingsDTO;
15
+ initialWhip: boolean;
16
+ },
17
+ /** Called synchronously just before the viewer takes the terminal. */
18
+ onConnected?: () => void): Promise<void>;