@north-light/cli 0.3.515 → 0.3.518

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 (48) hide show
  1. package/dist/api/contract.d.ts +1 -1
  2. package/dist/api/contract.js +1 -1
  3. package/dist/builtin-memory/crouter-plugin/bundles-and-memory.md +7 -1
  4. package/dist/builtin-memory/crouter-plugin/commands.md +18 -1
  5. package/dist/builtin-memory/crouter-sdk/release-notes.md +7 -0
  6. package/dist/clients/attach/render/doc-links.d.ts +5 -0
  7. package/dist/clients/attach/render/doc-links.js +1 -1
  8. package/dist/clients/attach/render/markdown-source.d.ts +5 -0
  9. package/dist/clients/attach/render/markdown-source.js +5 -5
  10. package/dist/clients/attach/session/document-links.js +1 -1
  11. package/dist/clients/attach/viewer.js +544 -535
  12. package/dist/clients/inbox/controller.js +1 -1
  13. package/dist/clients/inbox/tui/page-body.js +1 -1
  14. package/dist/clients/inbox/tui/render.js +2 -2
  15. package/dist/commands/sys/env.js +1 -1
  16. package/dist/core/command-plugins/bundle.js +1 -1
  17. package/dist/core/human/component-docs.js +5 -5
  18. package/dist/core/human/page-schema.d.ts +2 -0
  19. package/dist/core/human/page-schema.js +4 -1
  20. package/dist/core/human/page.js +6 -1
  21. package/dist/core/human/requests.d.ts +4 -1
  22. package/dist/core/human/requests.js +18 -18
  23. package/dist/core/profiles/app-env-store.js +1 -1
  24. package/dist/core/profiles/env-store.d.ts +3 -0
  25. package/dist/core/profiles/env-store.js +2 -2
  26. package/dist/core/runs/operations.js +4 -4
  27. package/dist/core/runs/questions.d.ts +6 -1
  28. package/dist/core/runs/questions.js +3 -3
  29. package/dist/core/termrender/version.d.ts +1 -1
  30. package/dist/core/termrender/version.js +1 -1
  31. package/dist/core/usage/ledger.js +4 -4
  32. package/dist/daemon/api/handlers/questions.d.ts +1 -1
  33. package/dist/daemon/api/handlers/questions.js +1 -1
  34. package/dist/daemon/api/operations.js +1 -1
  35. package/dist/daemon/crtrd.js +8 -8
  36. package/dist/launcher/main.d.ts +1 -1
  37. package/dist/launcher/main.js +1 -3
  38. package/dist/launcher/run.d.ts +5 -0
  39. package/dist/launcher/run.js +3 -0
  40. package/dist/shared/env.d.ts +5 -0
  41. package/dist/shared/env.js +2 -2
  42. package/docs/ci-runner.md +4 -4
  43. package/docs/plugin/bundles-and-memory.md +7 -1
  44. package/docs/plugin/commands.md +18 -1
  45. package/docs/sdk/release-notes.md +7 -0
  46. package/package.json +2 -2
  47. package/packages/crouter-identity/package.json +1 -1
  48. package/runtime.lock.json +12 -12
@@ -1,5 +1,5 @@
1
1
  /** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
2
- export declare const CONTRACT_LEVEL = "1.23";
2
+ export declare const CONTRACT_LEVEL = "1.24";
3
3
  /** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
4
4
  export declare const REQUIRED_CONTRACT_HEADER = "Crouter-Required-Contract";
5
5
  /** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
@@ -1 +1 @@
1
- var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.23",i="Crouter-Required-Contract",p="Crouter-Contract";function l(r){const t=/^(\d+)\.(\d+)$/.exec(r.trim());return t===null?null:{major:Number(t[1]),minor:Number(t[2])}}e(l,"parseContractLevel");function a(r){return r==null?[]:r.split(",").map(t=>l(t)).filter(t=>t!==null)}e(a,"parseServedContracts");function s(r,t){const n=l(r);return n===null?!1:(typeof t=="string"||t===null||t===void 0?a(t):t).some(u=>u.major===n.major&&u.minor>=n.minor)}e(s,"contractSatisfies");function C(r,t,n={}){if(r===void 0)return null;if(l(r)===null)return{status:400,code:"invalid_request",param:i,message:`${i} must be a contract level like 1.0.`};if(s(r,t))return null;const o=r.trim();return{status:426,code:"runtime_version_unsupported",message:t===null||a(t).length===0?`The runtime did not name its contract level; the caller requires contract ${o} or later. Roll the runtime forward.`:`The runtime serves contract ${t}; the caller requires contract ${o} or later within the same major. Roll the runtime forward, or pin an SDK whose crouterContract the runtime serves.`,details:{sdk_version:(n.legacyMinimum??"").trim(),runtime_version:n.runtimeVersion??null,required_contract:o,runtime_contract:t}}}e(C,"contractRefusal");export{p as CONTRACT_HEADER,f as CONTRACT_LEVEL,i as REQUIRED_CONTRACT_HEADER,C as contractRefusal,s as contractSatisfies,l as parseContractLevel,a as parseServedContracts};
1
+ var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.24",i="Crouter-Required-Contract",p="Crouter-Contract";function l(r){const t=/^(\d+)\.(\d+)$/.exec(r.trim());return t===null?null:{major:Number(t[1]),minor:Number(t[2])}}e(l,"parseContractLevel");function a(r){return r==null?[]:r.split(",").map(t=>l(t)).filter(t=>t!==null)}e(a,"parseServedContracts");function s(r,t){const n=l(r);return n===null?!1:(typeof t=="string"||t===null||t===void 0?a(t):t).some(u=>u.major===n.major&&u.minor>=n.minor)}e(s,"contractSatisfies");function C(r,t,n={}){if(r===void 0)return null;if(l(r)===null)return{status:400,code:"invalid_request",param:i,message:`${i} must be a contract level like 1.0.`};if(s(r,t))return null;const o=r.trim();return{status:426,code:"runtime_version_unsupported",message:t===null||a(t).length===0?`The runtime did not name its contract level; the caller requires contract ${o} or later. Roll the runtime forward.`:`The runtime serves contract ${t}; the caller requires contract ${o} or later within the same major. Roll the runtime forward, or pin an SDK whose crouterContract the runtime serves.`,details:{sdk_version:(n.legacyMinimum??"").trim(),runtime_version:n.runtimeVersion??null,required_contract:o,runtime_contract:t}}}e(C,"contractRefusal");export{p as CONTRACT_HEADER,f as CONTRACT_LEVEL,i as REQUIRED_CONTRACT_HEADER,C as contractRefusal,s as contractSatisfies,l as parseContractLevel,a as parseServedContracts};
@@ -21,7 +21,13 @@ await writeFile('acme.tar', bundle.tar);
21
21
 
22
22
  `buildBundle` returns `commandsJson`, `bundleJson`, generated `memory/` members, uncompressed tar bytes, and an ETag. It runs the manifest validator and throws `ManifestInvalidError` when the generated command manifest is invalid. `buildCommandManifest(plugin, { mountPath })` returns the manifest object when archive bytes are not needed.
23
23
 
24
- The tar has exactly `bundle.json`, `commands.json`, and `memory/<name>.md` members for the documents declared in the `memory` array of `definePlugin`. It does not contain `plugin.json`. For an endpoint install, crouter creates `.crouter-plugin/plugin.json` from the endpoint, `--name`, `--auth-env`, and archive hash.
24
+ The tar has exactly `bundle.json`, `commands.json`, and `memory/<name>.md` members for the documents declared in the `memory` array of `definePlugin`. `bundle.json` carries `bundleVersion`, plus `version` when the plugin declares one, `object_kinds` when it declares object kinds, and `groups` when a provider declares its tool groups. `groups` is keyed by group id, each value `{"consent_line": string, "who"?: "own" | "user" | "allowlist" | "any", "allowlist"?: string[]}`, with `who` and `allowlist` written only when declared:
25
+
26
+ ```json
27
+ {"bundleVersion":1,"version":1,"groups":{"read":{"consent_line":"Read your Acme apps and deployments."},"deploy":{"consent_line":"Start deployments on your Acme apps.","who":"allowlist","allowlist":["app:k3x9"]}}}
28
+ ```
29
+
30
+ When the directory serves a provider's bundle it writes the `provider` block from its own rows; `groups` in the archive you build is the declaration the directory reads from your endpoint. A local install ignores `groups`. The archive does not contain `plugin.json`. For an endpoint install, crouter creates `.crouter-plugin/plugin.json` from the endpoint, `--name`, `--auth-env`, and archive hash.
25
31
 
26
32
  ## Documents in the `memory` array
27
33
 
@@ -13,10 +13,27 @@ when-and-why-to-read: When you need Commands, this knowledge should be read
13
13
 
14
14
  Use `defineBranch` to group commands and give it `children`. Use `defineLeaf` for a request that returns one object. A leaf requires `params`, `output`, `effects`, and `handler`; `params` may be omitted when the command has no input. `effects` is a non-empty list shown to the agent. Say whether a command mutates an application, creates billable resources, or is read-only.
15
15
 
16
- A leaf may declare `group`, the capability-provider tool group it belongs to. A group matches `[A-Za-z0-9_-]{1,64}`, and `definePlugin` throws `PluginDefinitionError` naming the leaf for anything else. `buildCommandManifest` writes the group onto the leaf; a local install ignores it. The group's consent line and rate are set in the directory console, not in the plugin. `sideEffect: true` marks a leaf whose tool has a side effect, so a repeated request must not run it twice. It is never written into the manifest.
16
+ A leaf may declare `group`, the capability-provider tool group it belongs to. A group matches `[A-Za-z0-9_-]{1,64}`, and `definePlugin` throws `PluginDefinitionError` naming the leaf for anything else. `buildCommandManifest` writes the group onto the leaf; a local install ignores it. The group's consent line and who may be granted it are declared in `definePlugin({ groups })` (below); its rate is set in the directory console. `sideEffect: true` marks a leaf whose tool has a side effect, so a repeated request must not run it twice. It is never written into the manifest.
17
17
 
18
18
  `definePlugin` accepts `version`, the plugin's integer major (at least 1), written into both `commands.json` and `bundle.json`; a plugin without one is treated as major 1. `provider: true` marks a capability provider registered in the directory. It requires `version`, and it requires a `group` on every leaf: `definePlugin` throws naming the first leaf without one.
19
19
 
20
+ A provider declares its tool groups with `groups`, an object keyed by group id (the same `[A-Za-z0-9_-]{1,64}` as a leaf's `group`):
21
+
22
+ ```ts
23
+ definePlugin({
24
+ name: 'acme',
25
+ provider: true,
26
+ version: 1,
27
+ groups: {
28
+ read: { consentLine: 'Read your Acme apps and deployments.' },
29
+ deploy: { consentLine: 'Start deployments on your Acme apps.', who: 'allowlist', allowlist: ['app:k3x9'] },
30
+ },
31
+ // …
32
+ });
33
+ ```
34
+
35
+ Each group has `consentLine`, the line the directory's consent page shows, and optionally `who` (`own`, `user`, `allowlist` or `any`; the directory treats an omitted `who` as `user`) and `allowlist` (app principals `app:<id>`, required with `who: 'allowlist'` and refused otherwise). `buildBundle` writes the block into `bundle.json` as `groups`, and the directory applies it when it refreshes the provider's manifest. `groups` is optional while a provider migrates to it, but once declared every leaf's `group` must name a declared group and every declared group must be used by at least one leaf; `definePlugin` throws `PluginDefinitionError` otherwise. A plugin that is not `provider: true` must not declare `groups`.
36
+
20
37
  A branch or leaf may set `tier` to `common` or `important` to be promoted into its parent's `-h`. A command with more than 40 children lists only its promoted children in its own `-h`, followed by the count of the rest; the others still run and answer `-h` by name. Use this when a plugin mounts one command per entry of a large catalog. On such a command only promoted leaves reach the top-level `crtr -h`; a promoted branch shows in the command's own `-h`.
21
38
 
22
39
  `defineStreamingLeaf` has the same declaration shape, but its handler returns `AsyncIterable<object>`. It marks the generated REST mapping as streaming and is covered in [[crouter-plugin/errors]].
@@ -9,6 +9,13 @@ when-and-why-to-read: When you need Release notes, this knowledge should be read
9
9
 
10
10
  Changes to `@north-light/sdk` that can change what an existing app sees. Newest first.
11
11
 
12
+ ## 0.3.515
13
+
14
+ `questions.cancel` and notices. Additive: no request or response an existing app sends or reads changes.
15
+
16
+ - `questions.cancel(questionId)` (`POST /v1/questions/{question_id}/cancel`) cancels an open question of the app's own run, as the person dismissing it. The asking agent is told it was dismissed, and the run leaves `waiting_on_user` when no other decision is open. Another app's run is `other_app_run`; a question already answered or canceled is 409 `run_settled` with `details.state` and `details.result`. It returns the question as `questions.get` does, with `status: 'canceled'`.
17
+ - A run's agent can raise a notice: a page that takes no response. A notice does not make the run `waiting_on_user`, is not in `pending_question_ids`, and emits no `waiting_on_user` event. `RunObject.open_notice_ids` lists the open ones. `questions.get` returns `kind: 'decision' | 'notice'`; acknowledge a notice with `questions.answer(id, {})`, or cancel it.
18
+
12
19
  ## 0.3.512
13
20
 
14
21
  The runtime serves `GET /v1/ready` on its owner API and its app listener. Additive: no request or response an existing app sends or reads changes.
@@ -8,6 +8,11 @@ export interface DocLinkContext {
8
8
  /** The browser URL of a document ref, absent on remote attach. */
9
9
  urlFor(ref: string): string | undefined;
10
10
  }
11
+ /** Bumped whenever a document name or path lands, so a surface that holds
12
+ * rendered Markdown (the inbox preview) knows to render it again. */
13
+ export declare function docLinksRevision(): number;
14
+ /** Record that a name or path landed; see `docLinksRevision`. */
15
+ export declare function noteDocLinksChanged(): void;
11
16
  /** Install (or clear) the viewer's document-link context. */
12
17
  export declare function setDocLinkContext(context: DocLinkContext | undefined): void;
13
18
  /** The node-id owner and remaining name of a ref, when its first segment is a node id. */
@@ -1 +1 @@
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
+ var p=Object.defineProperty;var o=(n,e)=>p(n,"name",{value:e,configurable:!0});const l=/\[\[([^[\]\n]+?)\]\]/g,$=/^[a-z0-9]+-[a-z0-9]+-[a-z0-9]+$/,D=o(n=>`\x1B[2m${n}\x1B[22m`,"DIM"),L=o(n=>`\x1B[4m${n}\x1B[24m`,"UNDERLINE");let c,f=0;function I(){return f}o(I,"docLinksRevision");function k(){f++}o(k,"noteDocLinksChanged");function w(n){c=n}o(w,"setDocLinkContext");function N(n,e){const t=n.indexOf("/");if(t<=0)return{name:n};const r=n.slice(0,t);return r===e?.selfNodeId||e?.nodeName(r)!==void 0||$.test(r)?{nodeId:r,name:n.slice(t+1)}:{name:n}}o(N,"splitDocRef");function m(n,e=c){const{nodeId:t,name:r}=N(n,e);return t===void 0?{name:r}:t===e?.selfNodeId?{name:r}:{name:r,owner:e?.nodeName(t)??t.slice(t.lastIndexOf("-")+1)}}o(m,"docLinkLabel");function E(n,e=c){const t=m(n,e);return t.owner===void 0?t.name:`${t.name} \xB7 ${t.owner}`}o(E,"docLinkText");function R(n){return[...n.matchAll(l)].map(e=>e[1].trim()).filter(e=>e!=="")}o(R,"extractDocRefs");function h(n,e=c){return e===void 0||!n.includes("[[")?n:n.replace(l,(t,r)=>{const i=r.trim();if(i==="")return t;const s=m(i,e),d=e.urlFor(i),u=x(s.name),a=d===void 0?L(u):`[${u}](${d})`;return s.owner===void 0?a:`${a}${D(` \xB7 ${x(s.owner)}`)}`})}o(h,"rewriteProseDocLinks");function x(n){return n.replace(/([\\[\]*_`<>])/g,"\\$1")}o(x,"escapeLabel");export{m as docLinkLabel,E as docLinkText,I as docLinksRevision,R as extractDocRefs,k as noteDocLinksChanged,h as rewriteProseDocLinks,w as setDocLinkContext,N as splitDocRef};
@@ -7,6 +7,11 @@ export declare function styleAttachMarkdownSource(markdown: string): string;
7
7
  * message keeps `styleAttachMarkdownSource` alone — the `U+XXXX` escape hatch
8
8
  * exists for agents that cannot type a Nerd Font character. */
9
9
  export declare function styleAttachAgentMarkdown(markdown: string): string;
10
+ /** Name `[[owner/name]]` document links readably and link them to their
11
+ * materialized page (render/doc-links.ts), leaving code spans and fences
12
+ * literal. For Markdown the viewer renders outside the transcript — inbox
13
+ * pages and inline page blocks. */
14
+ export declare function rewriteMarkdownDocLinks(markdown: string): string;
10
15
  /** Copy a pi message for terminal rendering and decorate only Markdown-bearing
11
16
  * text/thinking blocks. The broker's source event is never mutated. */
12
17
  export declare function styleAttachMessageMarkdown<T>(message: T): T;
@@ -1,5 +1,5 @@
1
- var m=Object.defineProperty;var c=(t,i)=>m(t,"name",{value:i,configurable:!0});import{pathToFileURL as x}from"node:url";import{expandGlyphCodepoints as y}from"./glyph-codepoints.js";import{rewriteProseDocLinks as $}from"./doc-links.js";const A=/^(\s{0,3})(#{3,6})(?:[ \t]+|$)(.*?)([ \t]+#+[ \t]*)?$/,h=/^\s{0,3}(`{3,}|~{3,})/,L=/^([ \t]{0,3})(<\/?)([A-Za-z][\w.:-]*)((?:[ \t]+[^<>]*?)?)(\/?)>[ \t]*$/,b=/([^\s=]+)(?:=("[^"]*"|'[^']*'|[^\s]*))?/g,k=[[232,194,104],[207,194,145],[181,184,174],[157,170,180],[135,153,164],[116,135,147]],d=[104,112,124],M=[138,166,196],a=[124,146,164],E=[168,142,118];function f(t,i){return`\x1B[38;2;${t[0]};${t[1]};${t[2]}m${i}\x1B[39m`}c(f,"paint");function w(t){const[i,n,e]=k[t-1];return o=>`\x1B[1;38;2;${i};${n};${e}m${o}\x1B[22;39m`}c(w,"headingColor");function T(t){const i=A.exec(t);if(!i)return;const[,n,e,o]=i;if(o!=="")return`${n}${w(e.length)(o)}`}c(T,"styleHeadingLine");function _(t){return t.replace(b,(i,n,e)=>e===void 0?f(a,i):`${f(a,n)}${f(d,"=")}${f(E,e)}`)}c(_,"styleAttributes");function N(t){const i=L.exec(t);if(!i)return;const[,n,e,o,r,u]=i;return n+f(d,e)+f(M,o)+_(r)+f(d,`${u}>`)}c(N,"styleXmlTagLine");function I(t){const i=t.split(`
2
- `),n=[];let e;for(let o=0;o<i.length;o++){const r=i[o],u=h.exec(r);if(e!==void 0){u?.[1][0]===e&&(e=void 0),n.push(r);continue}if(u){e=u[1][0],n.push(r);continue}const l=N(r);if(l!==void 0){n.length>0&&n[n.length-1].trim()!==""&&n.push(""),n.push(l),i[o+1]!==void 0&&i[o+1].trim()!==""&&n.push("");continue}n.push(T(r)??r)}return n.join(`
3
- `)}c(I,"styleAttachMarkdownSource");function s(t){return y(I(X(t)))}c(s,"styleAttachAgentMarkdown");function X(t){let i;return t.split(`
4
- `).map(n=>{const e=h.exec(n);return i!==void 0?(e?.[1][0]===i&&(i=void 0),n):e?(i=e[1][0],n):C(n)}).join(`
5
- `)}c(X,"rewriteAbsoluteFileLinks");function C(t){let i="",n=t;for(;n!=="";){const e=n.match(/`+/),o=e===null?n:n.slice(0,e.index);if(i+=U($(o)),e===null)break;const r=e[0],u=n.indexOf(r,o.length+r.length);if(u===-1)return i+n.slice(o.length);i+=n.slice(o.length,u+r.length),n=n.slice(u+r.length)}return i}c(C,"rewriteInlineFileLinks");function U(t){let i="",n=0;for(;n<t.length;){const e=t.indexOf("[",n);if(e===-1)return i+t.slice(n);const o=F(t,e);if(o===void 0){i+=t.slice(n,e+1),n=e+1;continue}i+=t.slice(n,e)+`[${o.label}](${x(o.path).href}#crtr-file-open)`,n=o.end}return i}c(U,"rewriteProseFileLinks");function F(t,i){const n=p(t,i+1,"]");if(n===void 0||t[n+1]!=="(")return;const e=n+2;if(t[e]==="<"){const r=p(t,e+1,">");if(r===void 0||t[r+1]!==")")return;const u=g(t.slice(e+1,r));return u===void 0?void 0:{label:t.slice(i+1,n),path:u,end:r+2}}let o=0;for(let r=e;r<t.length;r++){if(t[r]==="\\"){r++;continue}if(t[r]==="("){o++;continue}if(t[r]!==")"||o-- >0)continue;const u=g(t.slice(e,r));return u===void 0?void 0:{label:t.slice(i+1,n),path:u,end:r+1}}}c(F,"parseLocalMarkdownLink");function p(t,i,n){for(let e=i;e<t.length;e++){if(t[e]==="\\"){e++;continue}if(t[e]===n)return e}}c(p,"closingDelimiter");function g(t){const i=t.replace(/\\([!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~-])/g,"$1");let n=i;try{n=decodeURIComponent(i)}catch{}return n.startsWith("/")?n:void 0}c(g,"localPathFromDestination");function j(t){if(typeof t!="object"||t===null||!("content"in t))return t;const i=t;return typeof i.content=="string"?{...i,content:s(i.content)}:Array.isArray(i.content)?{...i,content:i.content.map(n=>{if(typeof n!="object"||n===null)return n;const e=n;return e.type==="text"&&typeof e.text=="string"?{...e,text:s(e.text)}:e.type==="thinking"&&typeof e.thinking=="string"?{...e,thinking:s(e.thinking)}:n})}:t}c(j,"styleAttachMessageMarkdown");function G(t){return{...t,summary:s(t.summary)}}c(G,"styleAttachSummaryMarkdown");export{s as styleAttachAgentMarkdown,I as styleAttachMarkdownSource,j as styleAttachMessageMarkdown,G as styleAttachSummaryMarkdown};
1
+ var m=Object.defineProperty;var c=(n,i)=>m(n,"name",{value:i,configurable:!0});import{pathToFileURL as $}from"node:url";import{expandGlyphCodepoints as A}from"./glyph-codepoints.js";import{rewriteProseDocLinks as h}from"./doc-links.js";const L=/^(\s{0,3})(#{3,6})(?:[ \t]+|$)(.*?)([ \t]+#+[ \t]*)?$/,a=/^\s{0,3}(`{3,}|~{3,})/,b=/^([ \t]{0,3})(<\/?)([A-Za-z][\w.:-]*)((?:[ \t]+[^<>]*?)?)(\/?)>[ \t]*$/,M=/([^\s=]+)(?:=("[^"]*"|'[^']*'|[^\s]*))?/g,k=[[232,194,104],[207,194,145],[181,184,174],[157,170,180],[135,153,164],[116,135,147]],l=[104,112,124],w=[138,166,196],p=[124,146,164],E=[168,142,118];function f(n,i){return`\x1B[38;2;${n[0]};${n[1]};${n[2]}m${i}\x1B[39m`}c(f,"paint");function T(n){const[i,e,t]=k[n-1];return r=>`\x1B[1;38;2;${i};${e};${t}m${r}\x1B[22;39m`}c(T,"headingColor");function _(n){const i=L.exec(n);if(!i)return;const[,e,t,r]=i;if(r!=="")return`${e}${T(t.length)(r)}`}c(_,"styleHeadingLine");function N(n){return n.replace(M,(i,e,t)=>t===void 0?f(p,i):`${f(p,e)}${f(l,"=")}${f(E,t)}`)}c(N,"styleAttributes");function I(n){const i=b.exec(n);if(!i)return;const[,e,t,r,o,u]=i;return e+f(l,t)+f(w,r)+N(o)+f(l,`${u}>`)}c(I,"styleXmlTagLine");function X(n){const i=n.split(`
2
+ `),e=[];let t;for(let r=0;r<i.length;r++){const o=i[r],u=a.exec(o);if(t!==void 0){u?.[1][0]===t&&(t=void 0),e.push(o);continue}if(u){t=u[1][0],e.push(o);continue}const s=I(o);if(s!==void 0){e.length>0&&e[e.length-1].trim()!==""&&e.push(""),e.push(s),i[r+1]!==void 0&&i[r+1].trim()!==""&&e.push("");continue}e.push(_(o)??o)}return e.join(`
3
+ `)}c(X,"styleAttachMarkdownSource");function d(n){return A(X(C(n)))}c(d,"styleAttachAgentMarkdown");function C(n){return g(n,i=>U(h(i)))}c(C,"rewriteAbsoluteFileLinks");function G(n){return n.includes("[[")?g(n,i=>h(i)):n}c(G,"rewriteMarkdownDocLinks");function g(n,i){let e;return n.split(`
4
+ `).map(t=>{const r=a.exec(t);return e!==void 0?(r?.[1][0]===e&&(e=void 0),t):r?(e=r[1][0],t):P(t,i)}).join(`
5
+ `)}c(g,"rewriteProse");function P(n,i){let e="",t=n;for(;t!=="";){const r=t.match(/`+/),o=r===null?t:t.slice(0,r.index);if(e+=i(o),r===null)break;const u=r[0],s=t.indexOf(u,o.length+u.length);if(s===-1)return e+t.slice(o.length);e+=t.slice(o.length,s+u.length),t=t.slice(s+u.length)}return e}c(P,"rewriteInlineProse");function U(n){let i="",e=0;for(;e<n.length;){const t=n.indexOf("[",e);if(t===-1)return i+n.slice(e);const r=D(n,t);if(r===void 0){i+=n.slice(e,t+1),e=t+1;continue}i+=n.slice(e,t)+`[${r.label}](${$(r.path).href}#crtr-file-open)`,e=r.end}return i}c(U,"rewriteProseFileLinks");function D(n,i){const e=x(n,i+1,"]");if(e===void 0||n[e+1]!=="(")return;const t=e+2;if(n[t]==="<"){const o=x(n,t+1,">");if(o===void 0||n[o+1]!==")")return;const u=y(n.slice(t+1,o));return u===void 0?void 0:{label:n.slice(i+1,e),path:u,end:o+2}}let r=0;for(let o=t;o<n.length;o++){if(n[o]==="\\"){o++;continue}if(n[o]==="("){r++;continue}if(n[o]!==")"||r-- >0)continue;const u=y(n.slice(t,o));return u===void 0?void 0:{label:n.slice(i+1,e),path:u,end:o+1}}}c(D,"parseLocalMarkdownLink");function x(n,i,e){for(let t=i;t<n.length;t++){if(n[t]==="\\"){t++;continue}if(n[t]===e)return t}}c(x,"closingDelimiter");function y(n){const i=n.replace(/\\([!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~-])/g,"$1");let e=i;try{e=decodeURIComponent(i)}catch{}return e.startsWith("/")?e:void 0}c(y,"localPathFromDestination");function S(n){if(typeof n!="object"||n===null||!("content"in n))return n;const i=n;return typeof i.content=="string"?{...i,content:d(i.content)}:Array.isArray(i.content)?{...i,content:i.content.map(e=>{if(typeof e!="object"||e===null)return e;const t=e;return t.type==="text"&&typeof t.text=="string"?{...t,text:d(t.text)}:t.type==="thinking"&&typeof t.thinking=="string"?{...t,thinking:d(t.thinking)}:e})}:n}c(S,"styleAttachMessageMarkdown");function H(n){return{...n,summary:d(n.summary)}}c(H,"styleAttachSummaryMarkdown");export{G as rewriteMarkdownDocLinks,d as styleAttachAgentMarkdown,X as styleAttachMarkdownSource,S as styleAttachMessageMarkdown,H as styleAttachSummaryMarkdown};
@@ -1 +1 @@
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};
1
+ var l=Object.defineProperty;var o=(e,r)=>l(e,"name",{value:r,configurable:!0});import{noteDocLinksChanged as s,setDocLinkContext as c}from"../render/doc-links.js";function L(e){const r=new Map;let d=!1,i=!1,f;e.remote||e.fetchSecret().then(n=>{f=n,s(),i||e.refresh()},e.onSecretError);const a=o(()=>{d||(d=!0,e.canvasSource.listNodes().then(n=>{for(const t of n)r.set(t.node_id,t.name);s(),i||e.refresh()},()=>{d=!1}))},"loadRoster"),u={selfNodeId:e.selfNodeId,nodeName:o(n=>{const t=r.get(n);return t===void 0&&a(),t},"nodeName"),urlFor:o(n=>e.remote||f===void 0?void 0:`http://127.0.0.1:${e.port}/r/${n.split("/").map(encodeURIComponent).join("/")}?t=${f}`,"urlFor")};return c(u),{dispose(){i=!0,c(void 0)}}}o(L,"createDocumentLinks");export{L as createDocumentLinks};