@north-light/cli 0.3.524 → 0.3.526
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/command-manifest/result.d.ts +4 -2
- package/dist/api/command-manifest/result.js +1 -1
- package/dist/api/command-manifest/schema.js +1 -1
- package/dist/api/plugin-manifest-schema.d.ts +3 -0
- package/dist/builtin-memory/crouter-plugin/deploying.md +2 -2
- package/dist/builtin-memory/crouter-plugin/output.md +3 -1
- package/dist/clients/attach/chrome/roster.d.ts +1 -1
- package/dist/clients/attach/chrome/roster.js +4 -4
- package/dist/clients/attach/render/chat-view.d.ts +9 -0
- package/dist/clients/attach/render/chat-view.js +3 -3
- package/dist/clients/attach/render/page-block.d.ts +2 -0
- package/dist/clients/attach/render/page-block.js +1 -1
- package/dist/clients/attach/session/connection.d.ts +1 -1
- package/dist/clients/attach/session/context.d.ts +1 -1
- package/dist/clients/attach/session/profile-files.d.ts +3 -3
- package/dist/clients/attach/session/profile-files.js +1 -1
- package/dist/clients/attach/viewer.js +633 -756
- package/dist/commands/pkg/browse/command-view.js +1 -1
- package/dist/core/canvas/db.d.ts +28 -2
- package/dist/core/canvas/db.js +2 -2
- package/dist/core/canvas/migrations.js +53 -53
- package/dist/core/canvas/nav-model.js +1 -1
- package/dist/core/canvas/recovery.d.ts +13 -0
- package/dist/core/canvas/recovery.js +2 -2
- package/dist/core/conversation-store/client.d.ts +2 -2
- package/dist/core/conversation-store/index.d.ts +30 -2
- package/dist/core/conversation-store/index.js +1 -1
- package/dist/core/conversation-store/patch.js +1 -1
- package/dist/core/graph/watches.d.ts +2 -0
- package/dist/core/graph/watches.js +9 -9
- package/dist/core/help.js +7 -7
- package/dist/core/llm/run.js +2 -2
- package/dist/core/runtime/broker/fault-retry.d.ts +9 -3
- package/dist/core/runtime/broker/fault-retry.js +1 -1
- package/dist/core/runtime/broker/rebind.d.ts +4 -0
- package/dist/core/runtime/broker/rebind.js +1 -1
- package/dist/core/runtime/broker/run-turn-queue.d.ts +2 -0
- package/dist/core/runtime/broker/run-turn-queue.js +1 -1
- package/dist/core/runtime/broker-persona-guidance.d.ts +1 -1
- package/dist/core/runtime/broker-persona-guidance.js +3 -3
- package/dist/core/runtime/broker.js +1 -1
- package/dist/core/runtime/close.d.ts +2 -2
- package/dist/core/runtime/close.js +1 -1
- package/dist/daemon/crtrd.js +8 -8
- package/dist/daemon/reconcilers/broker-supervision.d.ts +6 -2
- package/dist/daemon/reconcilers/broker-supervision.js +4 -4
- package/dist/daemon/runs/observer.js +2 -2
- package/docs/plugin/deploying.md +2 -2
- package/docs/plugin/output.md +3 -1
- package/package.json +2 -2
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x=Object.defineProperty;var u=(e,s)=>x(e,"name",{value:s,configurable:!0});import{visibleWidth as h,wrapTextWithAnsi as N}from"@earendil-works/pi-tui";import{theme as c,wrapText as b}from"../../../core/tui/panel.js";import{commandLabel as $}from"./model.js";function k(e,s,t){const n=[];return n.push(...a($(e),t).map(r=>c.fg("accent",c.bold(r)))),n.push(...a(`${e.kind.toUpperCase()} COMMAND \xB7 ${(e.tier??"normal").toUpperCase()} TIER`,t).map(r=>c.fg("dim",r))),n.push(""),n.push(...p(e.description,t)),f(n,"WHEN TO USE",t),n.push(...p(e.whenToUse,t)),f(n,"SUMMARY",t),n.push(...p(e.summary,t)),e.kind==="leaf"?v(n,e,s,t):S(n,e,t),n}u(k,"renderCommandView");function v(e,s,t,n){if(f(e,"PARAMS",n),s.params.length===0)e.push(...p("No input parameters.",n));else for(const o of s.params)e.push(...M(o,n));if(f(e,"OUTPUT",n),s.output.length===0)e.push(...p("No output fields declared.",n));else for(const o of s.output)e.push(...m(o,n));if(f(e,"EFFECTS",n),s.effects.length===0)e.push(...p("No effects declared.",n));else for(const o of s.effects)e.push(...i(" \u2022 ",o,n));if(f(e,"INVOKED VIA",n),t.transport===null){e.push(...a("This plugin declares no command transport.",n).map(o=>c.fg("warning",o)));return}const r=t.transportTarget??"No target declared.";e.push(...i(` ${t.transport} `,r,n)),t.transport==="http"&&s.rest!==void 0&&e.push(...i(" REST ",`${s.rest.method} ${s.rest.path} \xB7 ${s.rest.streaming?"streaming response":"single response"}`,n))}u(v,"renderLeaf");function S(e,s,t){if(s.rootEntry!==void 0&&(f(e,"ROOT ENTRY",t),e.push(...i(" Concept ",s.rootEntry.concept,t)),e.push(...i(" Description ",s.rootEntry.description,t)),e.push(...i(" When to use ",s.rootEntry.whenToUse,t))),s.passthrough!==void 0&&(f(e,"PASSES THROUGH",t),e.push(...i(" Binary ",s.passthrough.bin,t)),e.push(...i(" Install ",s.passthrough.installHint,t))),f(e,"CHILDREN",t),s.children.length===0){e.push(...p(s.passthrough===void 0?"No subcommands.":"No subcommands \u2014 every argument is forwarded to the binary.",t));return}for(const n of s.children)e.push(...i(` ${$(n)} `,n.description,t))}u(S,"renderBranch");function M(e,s){const t=C(e),n=i(` ${t} `,D(e),s),r=O;return e.kind==="positional"?(e.repeatable===!0&&n.push(...i(r,"Repeatable; supply multiple values in argv order.",s)),e.encoding!==void 0&&n.push(...i(r,d(e.encoding),s)),e.defaultFromEnv!==void 0&&n.push(...i(r,E(e.defaultFromEnv),s))):e.kind==="flag"?(e.choices!==void 0&&n.push(...i(r,`Choices: ${e.choices.join(", ")}.`,s)),e.default!==void 0&&n.push(...i(r,`Default: ${R(e.default)}.`,s)),e.repeatable===!0&&n.push(...i(r,"Repeatable; supply the flag multiple times to accumulate values.",s)),e.encoding!==void 0&&n.push(...i(r,d(e.encoding),s)),e.defaultFromEnv!==void 0&&n.push(...i(r,E(e.defaultFromEnv),s)),e.hidden===!0&&n.push(...i(r,"Hidden from the command's ordinary -h output.",s,"warning"))):e.kind==="context-file"&&(n.push(...i(r,`Mapped input: ${e.name}.`,s)),e.shape!==void 0&&n.push(...i(r,`Expected JSON: ${e.shape}`,s))),n.push(...i(r,`Constraint: ${e.constraint}`,s)),n}u(M,"renderParam");function m(e,s,t=" "){const n=`${t} `,r=[...i(`${t}${e.name} `,`${e.type} \xB7 ${e.required?"required":"optional"}`,s),...i(n,`Constraint: ${e.constraint}`,s)];return r.push(...g(e,s,n)),r}u(m,"renderField");function g(e,s,t){const n=[];e.values!==void 0&&n.push(...i(t,`Values: ${e.values.join(", ")}.`,s));for(const r of e.children??[])n.push(...m(r,s,t));if(e.extra!==void 0){const r=e.extra,o=r.constraint.length>0?` \xB7 ${r.constraint}`:"";n.push(...i(t,`Other members: ${r.type}${o}`,s)),n.push(...g(r,s,`${t} `))}if(e.items!==void 0){const r=e.items,o=r.constraint.length>0?` \xB7 ${r.constraint}`:"";n.push(...i(t,`Each element: ${r.type}${o}`,s)),n.push(...g(r,s,`${t} `))}return n}u(g,"renderShapeBody");const O=" ";function C(e){switch(e.kind){case"positional":return`${e.name}${e.repeatable===!0?"\u2026":""}`;case"flag":return`--${e.name}`;case"stdin":return e.name;case"context-file":return"--context-file PATH"}}u(C,"paramLabel");function D(e){const s=e.required?"required":"optional";switch(e.kind){case"positional":return`positional \xB7 ${e.type??"string"} \xB7 ${s}`;case"flag":return`flag \xB7 ${e.type} \xB7 ${s}`;case"stdin":return`stdin \xB7 raw text \xB7 ${s}`;case"context-file":return`context file \xB7 JSON file \xB7 ${s}`}}u(D,"paramMeta");function d(e){return e==="base64"?"Encoding: reads the local file's raw bytes and sends base64; the path itself is never sent.":"Encoding: reads the local file as UTF-8 text and sends its content; the path itself is never sent."}u(d,"encodingDetail");function R(e){return typeof e=="string"?JSON.stringify(e):String(e)}u(R,"formatValue");function E(e){return`When $${e} is set and non-empty, it supplies the value and counts as supplied.`}u(E,"envDefaultDetail");function f(e,s,t){e.push(""),e.push(...a(s,t).map(n=>c.fg("dim",n)))}u(f,"section");function p(e,s){return a(e,Math.max(1,s-2)).map(n=>` ${c.fg("dim",n)}`)}u(p,"paragraph");function i(e,s,t,n="dim"){const r=h(e);if(r>=t)return[...a(e.trimEnd(),t).map(l=>c.fg("accent",l)),...a(s,Math.max(1,t-2)).map(l=>` ${c.fg(n,l)}`)];const o=Math.max(1,t-r),T=" ".repeat(r);return a(s,o).map((l,y)=>y===0?`${c.fg("accent",e)}${c.fg(n,l)}`:`${T}${c.fg(n,l)}`)}u(i,"hanging");function a(e,s){const t=e.trim(),n=Math.max(1,s);return t.split(/\s+/).some(r=>h(r)>n)?N(t,n):b(t,n)}u(a,"wrapped");export{k as renderCommandView};
|
package/dist/core/canvas/db.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DatabaseSync } from 'node:sqlite';
|
|
1
|
+
import { DatabaseSync, type SQLInputValue } from 'node:sqlite';
|
|
2
|
+
import { prepared } from '../sqlite-statements.js';
|
|
2
3
|
export { MIGRATIONS } from './migrations.js';
|
|
3
|
-
export { prepared }
|
|
4
|
+
export { prepared };
|
|
4
5
|
/** A schema change invalidates statements compiled against the old schema. */
|
|
5
6
|
export declare function migrate(db: DatabaseSync): void;
|
|
6
7
|
/** Only the daemon (and its API-server test host) registers this process-local hook.
|
|
@@ -31,3 +32,28 @@ export declare function openDb(): DatabaseSync;
|
|
|
31
32
|
export declare function withCanvasWrite<T>(body: (db: DatabaseSync) => T): T;
|
|
32
33
|
/** Close and forget the handle for the current home. Mainly for tests. */
|
|
33
34
|
export declare function closeDb(): void;
|
|
35
|
+
export type CanvasParams = [Record<string, SQLInputValue>, ...SQLInputValue[]] | SQLInputValue[];
|
|
36
|
+
export interface CanvasRunResult {
|
|
37
|
+
changes: number | bigint;
|
|
38
|
+
lastInsertRowid: number | bigint;
|
|
39
|
+
}
|
|
40
|
+
export interface CanvasStatement {
|
|
41
|
+
get<T = Record<string, unknown>>(...params: CanvasParams): Promise<T | undefined>;
|
|
42
|
+
all<T = Record<string, unknown>>(...params: CanvasParams): Promise<T[]>;
|
|
43
|
+
run(...params: CanvasParams): Promise<CanvasRunResult>;
|
|
44
|
+
}
|
|
45
|
+
export interface CanvasDb {
|
|
46
|
+
/** A statement compiled once per connection; for fixed SQL only. */
|
|
47
|
+
prepare(sql: string): CanvasStatement;
|
|
48
|
+
/** A statement compiled per call; for generated SQL (IN lists, schema-dependent text). */
|
|
49
|
+
prepareUncached(sql: string): CanvasStatement;
|
|
50
|
+
exec(sql: string): Promise<void>;
|
|
51
|
+
/** The SQLite connection, for the synchronous migration chain only. Deleted with the Postgres swap. */
|
|
52
|
+
readonly raw: DatabaseSync;
|
|
53
|
+
}
|
|
54
|
+
/** The async handle over the same cached connection `openDb()` returns. */
|
|
55
|
+
export declare function openCanvasDb(): Promise<CanvasDb>;
|
|
56
|
+
/** Run `body` in one `BEGIN IMMEDIATE` transaction. A call from inside the
|
|
57
|
+
* body's own async context joins it and only the outermost call commits; a call
|
|
58
|
+
* from any other context waits its turn. A throwing body rolls back. */
|
|
59
|
+
export declare function withCanvasWriteAsync<T>(body: (db: CanvasDb) => Promise<T> | T): Promise<T>;
|
package/dist/core/canvas/db.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`;
|
|
1
|
+
var M=Object.defineProperty;var r=(e,t)=>M(e,"name",{value:t,configurable:!0});import{DatabaseSync as D}from"node:sqlite";import{AsyncLocalStorage as v}from"node:async_hooks";import{forgetPrepared as l,prepared as f}from"../sqlite-statements.js";import{appendFileSync as O}from"node:fs";import{canvasDbPath as w,ensureHome as k}from"./paths.js";import{initializeEmptyLayout as C}from"../layout.js";import{migrate as I}from"./migrations.js";import{MIGRATIONS as Q}from"./migrations.js";function H(e){try{I(e)}finally{l(e)}}r(H,"migrate");const c=new Map;let i;function $(e){const t=p();e(t),i=e}r($,"bindDaemonCanvasOpenHook");function q(){i=void 0}r(q,"clearDaemonCanvasOpenHook");function S(){const e=process.env.CRTR_DB_OPEN_LEDGER;if(e)try{const t=`${new Date().toISOString()} ${process.pid} ${process.argv[1]??"<unknown>"}
|
|
2
|
+
`;O(e,t)}catch{}}r(S,"recordOpenLedger");function p(){const e=w(),t=c.get(e);if(t)return t;C(),k(),S();const n=new D(e);n.exec("PRAGMA busy_timeout = 5000;"),n.exec("PRAGMA journal_mode = WAL;"),n.exec("PRAGMA foreign_keys = ON;");try{i?.(n)}catch(o){throw n.close(),o}return c.set(e,n),n}r(p,"openDb");function K(e){const t=p();if(t.isTransaction)return e(t);t.exec("BEGIN IMMEDIATE");try{const n=e(t);return t.exec("COMMIT"),n}catch(n){try{t.exec("ROLLBACK")}catch{}throw n}}r(K,"withCanvasWrite");function j(){const e=w(),t=c.get(e);t&&(l(t),t.close(),c.delete(e))}r(j,"closeDb");const L=1e3,m=new v;class E{static{r(this,"FifoLock")}tail=Promise.resolve();pending=0;get busy(){return this.pending>0}async acquire(){this.pending++;const t=this.tail;let n;return this.tail=new Promise(o=>{n=o}),await t,()=>{this.pending--,n()}}}const y=new WeakMap,g=new WeakMap;function h(e){let t=y.get(e);return t||y.set(e,t=new E),t}r(h,"lockFor");function d(e){const t=m.getStore();return t!==void 0&&t.open&&t.db===e}r(d,"ownsTransaction");async function s(e,t){const n=h(e);if(d(e)||!n.busy)return t();const o=await n.acquire();try{return t()}finally{o()}}r(s,"gated");function x(e,t){const n=r(o=>o,"args");return{get:r((...o)=>s(e,()=>t().get(...n(o))),"get"),all:r((...o)=>s(e,()=>t().all(...n(o))),"all"),run:r((...o)=>s(e,()=>t().run(...n(o))),"run")}}r(x,"wrapStatement");function R(e){let t=g.get(e);return t||(t={prepare:r(n=>x(e,()=>f(e,n)),"prepare"),prepareUncached:r(n=>x(e,()=>e.prepare(n)),"prepareUncached"),exec:r(n=>s(e,()=>{e.exec(n)}),"exec"),raw:e},g.set(e,t)),t}r(R,"canvasDbFor");async function T(){return R(p())}r(T,"openCanvasDb");async function z(e){const t=await T(),n=t.raw;if(d(n))return e(t);const o=await h(n).acquire(),A=Date.now(),u={db:n,open:!0};try{n.exec("BEGIN IMMEDIATE");try{const a=await m.run(u,()=>e(t));return n.exec("COMMIT"),a}catch(a){try{n.exec("ROLLBACK")}catch{}throw a}}finally{u.open=!1;const a=Date.now()-A;a>L&&console.warn(`[canvas db] write transaction held ${a}ms; its body awaited non-db work while every other db caller waited`),o()}}r(z,"withCanvasWriteAsync");export{Q as MIGRATIONS,$ as bindDaemonCanvasOpenHook,q as clearDaemonCanvasOpenHook,j as closeDb,H as migrate,T as openCanvasDb,p as openDb,f as prepared,K as withCanvasWrite,z as withCanvasWriteAsync};
|