@north-light/cli 0.3.508 → 0.3.510

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 (50) hide show
  1. package/dist/api/client.d.ts +2 -1
  2. package/dist/api/client.js +3 -3
  3. package/dist/api/contract.d.ts +1 -1
  4. package/dist/api/contract.js +1 -1
  5. package/dist/api/dto/docs.d.ts +4 -0
  6. package/dist/api/routes.d.ts +1 -0
  7. package/dist/api/routes.js +1 -1
  8. package/dist/builtin-memory/crouter-sdk/release-notes.md +6 -0
  9. package/dist/builtin-memory/northlight-apps/providers/device.md +1 -1
  10. package/dist/clients/attach/assets/mermaid.min.js +3631 -0
  11. package/dist/clients/attach/render/doc-links.d.ts +2 -5
  12. package/dist/clients/attach/render/doc-links.js +1 -1
  13. package/dist/clients/attach/session/document-links.d.ts +6 -18
  14. package/dist/clients/attach/session/document-links.js +1 -1
  15. package/dist/clients/attach/session/file-links.d.ts +0 -2
  16. package/dist/clients/attach/session/file-links.js +1 -1
  17. package/dist/clients/attach/viewer.js +558 -625
  18. package/dist/core/config.js +1 -1
  19. package/dist/core/graph/events.d.ts +1 -0
  20. package/dist/core/graph/events.js +6 -6
  21. package/dist/core/user-settings.d.ts +4 -4
  22. package/dist/core/user-settings.js +1 -1
  23. package/dist/daemon/api/document-listener.d.ts +7 -0
  24. package/dist/daemon/api/document-listener.js +11 -0
  25. package/dist/daemon/api/document-merge.d.ts +2 -0
  26. package/dist/daemon/api/document-merge.js +1 -0
  27. package/dist/daemon/api/document-secret.d.ts +2 -0
  28. package/dist/daemon/api/document-secret.js +1 -0
  29. package/dist/daemon/api/handlers/docs.d.ts +14 -0
  30. package/dist/daemon/api/handlers/docs.js +1 -1
  31. package/dist/daemon/api/handlers/document-access.d.ts +2 -0
  32. package/dist/daemon/api/handlers/document-access.js +1 -0
  33. package/dist/daemon/api/operations.js +1 -1
  34. package/dist/daemon/api/server.js +1 -1
  35. package/dist/daemon/api/vendor-signin.d.ts +1 -0
  36. package/dist/daemon/api/vendor-signin.js +1 -1
  37. package/dist/daemon/crtrd.js +9 -9
  38. package/dist/doc-editor/editor.css +1 -0
  39. package/dist/doc-editor/editor.js +53 -0
  40. package/dist/types.d.ts +2 -9
  41. package/dist/types.js +1 -1
  42. package/docs/apps/providers/device.md +1 -1
  43. package/docs/sdk/release-notes.md +6 -0
  44. package/package.json +13 -2
  45. package/packages/crouter-identity/package.json +1 -1
  46. package/runtime.lock.json +364 -12
  47. package/dist/clients/attach/session/doc-html.d.ts +0 -8
  48. package/dist/clients/attach/session/doc-html.js +0 -66
  49. package/dist/clients/attach/session/doc-materialize.d.ts +0 -57
  50. package/dist/clients/attach/session/doc-materialize.js +0 -3
@@ -1,6 +1,3 @@
1
- /** The fragment a rendered document link carries. iTerm strips it before
2
- * invoking Semantic History; the viewer recognizes a document by its path. */
3
- export declare const DOC_OPEN_FRAGMENT = "crtr-doc-open";
4
1
  /** What the renderer needs from the viewer. Every call is synchronous and reads
5
2
  * live viewer state; a miss may schedule a fetch that re-renders later. */
6
3
  export interface DocLinkContext {
@@ -8,8 +5,8 @@ export interface DocLinkContext {
8
5
  selfNodeId: string;
9
6
  /** A node's display name, when known. */
10
7
  nodeName(nodeId: string): string | undefined;
11
- /** The local materialized file for a document ref, when one exists. */
12
- pathFor(ref: string): string | undefined;
8
+ /** The browser URL of a document ref, absent on remote attach. */
9
+ urlFor(ref: string): string | undefined;
13
10
  }
14
11
  /** Install (or clear) the viewer's document-link context. */
15
12
  export declare function setDocLinkContext(context: DocLinkContext | undefined): void;
@@ -1 +1 @@
1
- var $=Object.defineProperty;var r=(e,n)=>$(e,"name",{value:n,configurable:!0});import{pathToFileURL as f}from"node:url";const x="crtr-doc-open",l=/\[\[([^[\]\n]+?)\]\]/g,N=/^[a-z0-9]+-[a-z0-9]+-[a-z0-9]+$/,h=r(e=>`\x1B[2m${e}\x1B[22m`,"DIM"),D=r(e=>`\x1B[4m${e}\x1B[24m`,"UNDERLINE");let d;function E(e){d=e}r(E,"setDocLinkContext");function b(e,n){const t=e.indexOf("/");if(t<=0)return{name:e};const o=e.slice(0,t);return o===n?.selfNodeId||n?.nodeName(o)!==void 0||N.test(o)?{nodeId:o,name:e.slice(t+1)}:{name:e}}r(b,"splitDocRef");function m(e,n=d){const{nodeId:t,name:o}=b(e,n);return t===void 0?{name:o}:t===n?.selfNodeId?{name:o}:{name:o,owner:n?.nodeName(t)??t.slice(t.lastIndexOf("-")+1)}}r(m,"docLinkLabel");function w(e,n=d){const t=m(e,n);return t.owner===void 0?t.name:`${t.name} \xB7 ${t.owner}`}r(w,"docLinkText");function O(e){return[...e.matchAll(l)].map(n=>n[1].trim()).filter(n=>n!=="")}r(O,"extractDocRefs");function R(e,n=d){return n===void 0||!e.includes("[[")?e:e.replace(l,(t,o)=>{const i=o.trim();if(i==="")return t;const s=m(i,n),c=n.pathFor(i),a=p(s.name),u=c===void 0?D(a):c.endsWith(".html")?`[${a}](${f(c).href})`:`[${a}](${f(c).href}#${x})`;return s.owner===void 0?u:`${u}${h(` \xB7 ${p(s.owner)}`)}`})}r(R,"rewriteProseDocLinks");function p(e){return e.replace(/([\\[\]*_`<>])/g,"\\$1")}r(p,"escapeLabel");export{x as DOC_OPEN_FRAGMENT,m as docLinkLabel,w as docLinkText,O as extractDocRefs,R as rewriteProseDocLinks,E as setDocLinkContext,b as splitDocRef};
1
+ var $=Object.defineProperty;var o=(e,n)=>$(e,"name",{value:n,configurable:!0});const l=/\[\[([^[\]\n]+?)\]\]/g,x=/^[a-z0-9]+-[a-z0-9]+-[a-z0-9]+$/,p=o(e=>`\x1B[2m${e}\x1B[22m`,"DIM"),D=o(e=>`\x1B[4m${e}\x1B[24m`,"UNDERLINE");let c;function I(e){c=e}o(I,"setDocLinkContext");function N(e,n){const t=e.indexOf("/");if(t<=0)return{name:e};const r=e.slice(0,t);return r===n?.selfNodeId||n?.nodeName(r)!==void 0||x.test(r)?{nodeId:r,name:e.slice(t+1)}:{name:e}}o(N,"splitDocRef");function f(e,n=c){const{nodeId:t,name:r}=N(e,n);return t===void 0?{name:r}:t===n?.selfNodeId?{name:r}:{name:r,owner:n?.nodeName(t)??t.slice(t.lastIndexOf("-")+1)}}o(f,"docLinkLabel");function L(e,n=c){const t=f(e,n);return t.owner===void 0?t.name:`${t.name} \xB7 ${t.owner}`}o(L,"docLinkText");function w(e){return[...e.matchAll(l)].map(n=>n[1].trim()).filter(n=>n!=="")}o(w,"extractDocRefs");function k(e,n=c){return n===void 0||!e.includes("[[")?e:e.replace(l,(t,r)=>{const i=r.trim();if(i==="")return t;const d=f(i,n),s=n.urlFor(i),u=m(d.name),a=s===void 0?D(u):`[${u}](${s})`;return d.owner===void 0?a:`${a}${p(` \xB7 ${m(d.owner)}`)}`})}o(k,"rewriteProseDocLinks");function m(e){return e.replace(/([\\[\]*_`<>])/g,"\\$1")}o(m,"escapeLabel");export{f as docLinkLabel,L as docLinkText,w as extractDocRefs,k as rewriteProseDocLinks,I as setDocLinkContext,N as splitDocRef};
@@ -1,24 +1,12 @@
1
1
  import type { CanvasSource } from '../../../core/canvas/source.js';
2
- import type { DocLinkOpenMode } from '../../../types.js';
3
- export interface DocumentLinks {
4
- /** Whether a clicked local path is a materialized document. */
5
- isDocumentPath(path: string): boolean;
6
- /** Re-read a clicked document and return the path to open (its current revision). */
7
- prepareOpen(path: string): Promise<{
8
- path: string;
9
- } | {
10
- notice: string;
11
- }>;
12
- /** The save-back a reattaching viewer was handed, if any. */
13
- consumeSaveBack(notify: (message: string) => void): Promise<void>;
14
- dispose(): void;
15
- }
16
2
  export declare function createDocumentLinks(opts: {
17
3
  selfNodeId: string;
18
4
  remote: boolean;
19
5
  canvasSource: CanvasSource;
20
- /** Where a link points: the browser page or the editable Markdown copy. */
21
- openMode: DocLinkOpenMode;
22
- /** Re-render the transcript's Markdown after a name or path lands. */
6
+ port: number;
7
+ fetchSecret: () => Promise<string>;
8
+ onSecretError: (err: unknown) => void;
23
9
  refresh: () => void;
24
- }): DocumentLinks;
10
+ }): {
11
+ dispose(): void;
12
+ };
@@ -1 +1 @@
1
- var k=Object.defineProperty;var i=(n,o)=>k(n,"name",{value:o,configurable:!0});import{APIError as C}from"../../../api/errors.js";import{cliClient as v}from"../../../commands/api-client.js";import{setDocLinkContext as g}from"../render/doc-links.js";import{DOC_SAVEBACK_ENV as y,documentForPath as h,materializeDocument as b,materializeDocumentPage as E,saveDocumentEdit as L,saveOutcomeNotice as O}from"./doc-materialize.js";async function w(n){const o=await v().objects.read(n);if(o.state!=="object"||o.type!=="document")return`${n} is not a readable document`;const a=o.data;if(a.needs_merge||a.bodies.length!==1)return`${n} has ${a.heads.length} heads and needs a merge`;const s=o.object.owner?.handle;return{id:o.object.id,name:s===void 0?o.object.name:`${s}/${o.object.name}`,revision:a.revision,heads_key:a.heads.map(d=>d.rev_id).sort().join(","),body:a.bodies[0]}}i(w,"readSnapshot");function M(n){const o=new Map,a=new Map,s=new Set,d=new Set;let m=!1,f=!1,l=!1;const j=i(()=>{m||f||(f=!0,n.canvasSource.listNodes().then(t=>{for(const e of t)o.set(e.node_id,e.name);m=!0,l||n.refresh()}).catch(()=>{m=!0}).finally(()=>{f=!1}))},"loadRoster"),D=i(t=>{n.remote||s.has(t)||d.has(t)||(s.add(t),w(t).then(e=>{if(typeof e=="string"){d.add(t);return}a.set(t,n.openMode==="browser"?E(t,e):b(t,e)),l||n.refresh()}).catch(()=>{d.add(t)}).finally(()=>{s.delete(t)}))},"materialize"),N={selfNodeId:n.selfNodeId,nodeName:i(t=>{const e=o.get(t);return e===void 0&&j(),e},"nodeName"),pathFor:i(t=>{const e=a.get(t);return e===void 0&&D(t),e},"pathFor")};return g(N),{isDocumentPath:i(t=>h(t)!==void 0,"isDocumentPath"),async prepareOpen(t){if(n.remote)return{notice:"Opening a document is unavailable in a remote attach"};const e=h(t);if(e===void 0)return{notice:"Not a document link"};try{const r=await w(e.id);if(typeof r=="string")return{notice:r};const c=b(e.ref,r);return a.set(e.ref,c),{path:c}}catch(r){return{notice:`Could not read ${e.name}: ${r instanceof Error?r.message:String(r)}`}}},async consumeSaveBack(t){const e=process.env[y];if(e===void 0||e==="")return;delete process.env[y];const r=h(e),c=await L(e,async(S,_,$)=>{try{return{revision:(await v().docs.edit(S,{body:_,base:$,rationale:"edited by the person in the attach viewer"})).revision}}catch(u){if(u instanceof C&&u.code==="stale_revision")return"stale";throw u}}),p=O(r?.name??e,c);p!==void 0&&t(p)},dispose(){l=!0,g(void 0)}}}i(M,"createDocumentLinks");export{M as createDocumentLinks};
1
+ var u=Object.defineProperty;var t=(e,o)=>u(e,"name",{value:o,configurable:!0});import{setDocLinkContext as s}from"../render/doc-links.js";function h(e){const o=new Map;let d=!1,f=!1,i;e.remote||e.fetchSecret().then(n=>{i=n,f||e.refresh()},e.onSecretError);const c=t(()=>{d||(d=!0,e.canvasSource.listNodes().then(n=>{for(const r of n)o.set(r.node_id,r.name);f||e.refresh()},()=>{d=!1}))},"loadRoster"),a={selfNodeId:e.selfNodeId,nodeName:t(n=>{const r=o.get(n);return r===void 0&&c(),r},"nodeName"),urlFor:t(n=>e.remote||i===void 0?void 0:`http://127.0.0.1:${e.port}/r/${n.split("/").map(encodeURIComponent).join("/")}?t=${i}`,"urlFor")};return s(a),{dispose(){f=!0,s(void 0)}}}t(h,"createDocumentLinks");export{h as createDocumentLinks};
@@ -17,8 +17,6 @@ export declare function openLinkedFileInPane(opts: {
17
17
  cwd: string;
18
18
  nodeId: string;
19
19
  observer: boolean;
20
- /** A materialized canvas document: the reattaching viewer saves its edit back. */
21
- saveBackEnv?: string;
22
20
  /** Clear viewer-local pane identity immediately before the pane runs Neovim. */
23
21
  beforeRespawn: () => void;
24
22
  }): LinkedFileOpenResult;
@@ -1 +1 @@
1
- var o=Object.defineProperty;var r=(e,n)=>o(e,"name",{value:n,configurable:!0});import{existsSync as s}from"node:fs";import{nvimAvailable as l,nvimShellCommand as u}from"../../../core/nvim-launch.js";import{respawnPaneInBackground as a,shellQuote as c,viewerSplitEnv as h}from"../../../core/runtime/placement-tmux.js";const d="\x1B_crtr-file-open;",f="\x1B\\";function S(e){const n=e.indexOf(d);if(n===-1)return;const t=n+d.length,i=e.indexOf(f,t);return i===-1?void 0:{file:m(e.slice(t,i)),remaining:e.slice(0,n)+e.slice(i+f.length)}}r(S,"extractFileOpenInput");function m(e){const n=e.startsWith("'")?x(e):p(e);return n!==void 0&&n.startsWith("/")&&!/[\x00-\x1f\x7f]/.test(n)?n:void 0}r(m,"decodeShellEscapedPath");function x(e){let n="",t=1;for(;;){const i=e.indexOf("'",t);if(i===-1)return;if(n+=e.slice(t,i),t=i+1,t===e.length)return n;if(e.slice(t,t+3)!=="\\''")return;n+="'",t+=3}}r(x,"decodeSingleQuotedPath");function p(e){let n="";for(let t=0;t<e.length;t++){if(e[t]!=="\\"){n+=e[t];continue}const i=e[++t];if(i===void 0)return;n+=i}return n}r(p,"decodeBackslashPath");function $(e){if(!s(e.file))return"missing";if(!l())return"no_nvim";const n=`crtr surface attach to ${c(e.nodeId)}${e.observer?" --observer":""}`,t=e.saveBackEnv===void 0?"":`env ${e.saveBackEnv}=${c(e.file)} `,i=`${u("edit",[e.file])} || :; exec ${t}${n}`;return e.beforeRespawn(),a({pane:e.pane,cwd:e.cwd,env:h(),command:i})?"opened":"failed"}r($,"openLinkedFileInPane");export{S as extractFileOpenInput,$ as openLinkedFileInPane};
1
+ var f=Object.defineProperty;var r=(e,n)=>f(e,"name",{value:n,configurable:!0});import{existsSync as o}from"node:fs";import{nvimAvailable as s,nvimShellCommand as l}from"../../../core/nvim-launch.js";import{respawnPaneInBackground as u,shellQuote as h,viewerSplitEnv as a}from"../../../core/runtime/placement-tmux.js";const d="\x1B_crtr-file-open;",c="\x1B\\";function w(e){const n=e.indexOf(d);if(n===-1)return;const t=n+d.length,i=e.indexOf(c,t);return i===-1?void 0:{file:m(e.slice(t,i)),remaining:e.slice(0,n)+e.slice(i+c.length)}}r(w,"extractFileOpenInput");function m(e){const n=e.startsWith("'")?x(e):p(e);return n!==void 0&&n.startsWith("/")&&!/[\x00-\x1f\x7f]/.test(n)?n:void 0}r(m,"decodeShellEscapedPath");function x(e){let n="",t=1;for(;;){const i=e.indexOf("'",t);if(i===-1)return;if(n+=e.slice(t,i),t=i+1,t===e.length)return n;if(e.slice(t,t+3)!=="\\''")return;n+="'",t+=3}}r(x,"decodeSingleQuotedPath");function p(e){let n="";for(let t=0;t<e.length;t++){if(e[t]!=="\\"){n+=e[t];continue}const i=e[++t];if(i===void 0)return;n+=i}return n}r(p,"decodeBackslashPath");function E(e){if(!o(e.file))return"missing";if(!s())return"no_nvim";const n=`crtr surface attach to ${h(e.nodeId)}${e.observer?" --observer":""}`,t=`${l("edit",[e.file])} || :; exec ${n}`;return e.beforeRespawn(),u({pane:e.pane,cwd:e.cwd,env:a(),command:t})?"opened":"failed"}r(E,"openLinkedFileInPane");export{w as extractFileOpenInput,E as openLinkedFileInPane};