@north-light/cli 0.3.643 → 0.3.644

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.
@@ -15,8 +15,8 @@ export declare function typedLimitKey(owner: ObjectRow): string;
15
15
  export declare function deliveryLimitFor(manifest: ProfileManifest | null, owner: ObjectRow, reader?: Reader): Rung;
16
16
  /** Fetch the bodies of every document in `docs` that has not read its own, in one query, so each `body()` call after it answers from memory. */
17
17
  export declare function primeBodies(db: CanvasDb, docs: readonly DeliveryDoc[]): Promise<void>;
18
- /** Documents with a rule on one of `on` that the reader may read, in view order. At `boot` a node's own documents come in even without a
19
- * boot rule. */
18
+ /** Documents with a rule on one of `on` whose owner is in the reader's view and that the reader may read, in view order. At `boot` a node's
19
+ * own documents come in even without a boot rule. */
20
20
  export declare function loadCorpus(db: CanvasDb, reader: Reader, on: RuleOn[]): Promise<DeliveryDoc[]>;
21
21
  /** One document as a delivery document for `reader`, with all its rules (an explicit read). */
22
22
  export declare function deliveryDocOf(db: CanvasDb, reader: Reader, doc: ObjectRow): Promise<DeliveryDoc>;
@@ -1,3 +1,3 @@
1
- var H=Object.defineProperty;var a=(t,e)=>H(t,"name",{value:e,configurable:!0});import{permits as D,resolveReader as L}from"../../permissions/evaluator.js";import{get as A,getMany as C}from"../../graph/bodies.js";import{resolveName as I,viewOf as g,viewResolutions as $}from"../../graph/names.js";import{rulesOn as T,rulesOf as k}from"../../graph/rules.js";import{loadExactProfileManifest as B}from"../../profiles/manifest.js";import{assembleNodeSubject as q}from"../subject.js";import{mapAsync as _}from"../../async-array.js";function N(t){return t.type==="node"?t.id:t.name}a(N,"ownerHandle");function F(t){return`${t.type}:${N(t)}`}a(F,"typedLimitKey");function W(t,e,o){if(o?.class==="node"&&o.profile!==null&&o.profile.id===e.id)return"content";const i=t?.delivery_limits;return i?i[F(e)]??i[N(e)]??"content":"content"}a(W,"deliveryLimitFor");async function j(t,e){if(e.class!=="node"||e.profile===null)return null;const o=await t.prepare("SELECT external_id FROM identities WHERE object = ? AND scheme = 'profile'").get(e.profile.id);if(!o)throw new Error(`profile object ${e.profile.id} has no profile identity`);return B(o.external_id).manifest}a(j,"readerManifest");async function h(t,e,o,i){const n=await D(t,e,"read","o");return await t.prepareUncached(`SELECT o.*, d.heads_key, d.unlisted, d.source_path FROM objects o JOIN documents d ON d.object = o.id
2
- WHERE o.type = 'document' AND o.deleted_at IS NULL AND ${o} AND ${n.sql} ORDER BY o.seq`).all(...i,...n.params)}a(h,"documentRows");async function b(t,e){const o=e.heads_key.split(","),i=await t.prepareUncached(`SELECT body_hash FROM revisions WHERE document = ? AND rev_id IN (${o.map(()=>"?").join(",")})
3
- ORDER BY number DESC LIMIT 1`).get(e.id,...o);if(!i)throw new Error(`document ${e.id} has no head revision ${e.heads_key}`);return i.body_hash}a(b,"headBodyHash");async function O(t,e,o){return{view:o,ev:await L(t,e)}}a(O,"resolveContext");async function x(t,e,o,i,n,l,c){const{view:r}=o,w=r.findIndex(M=>M.id===n.owner),m=w>=0?r[w]:await t.prepare("SELECT * FROM objects WHERE id = ?").get(n.owner),p=N(m),u=c?.get(n.name),y=u===void 0?await I(t,e,n.name,o):u===null?{missing:!0}:{object:{id:u}},f=await b(t,n),{heads_key:v,unlisted:s,source_path:d,...S}=n,R={object:S,owner:m,ownerHandle:p,viewRank:w>=0?w:r.length,ownNode:e.class==="node"&&n.owner===e.node.id,shipped:d!==null,kind:n.kind==="preference"?"preference":"knowledge",name:n.name,displayName:"object"in y&&y.object.id===n.id?n.name:`${p}/${n.name}`,preview:n.preview,unlisted:s!==0,headsKey:v,bodyHash:f,body:a(async()=>E.get(R)??U(R,await A(t,f)),"body"),rules:l,limit:W(i,m,e)};return R}a(x,"toDeliveryDoc");const E=new WeakMap;function U(t,e){return E.set(t,e),e}a(U,"remember");async function V(t,e){const o=e.filter(n=>!E.has(n)),i=await C(t,o.map(n=>n.bodyHash));for(const n of o)E.set(n,i.get(n.bodyHash))}a(V,"primeBodies");async function Z(t,e,o){const i=await g(t,e),n=await O(t,e,i),l=await j(t,e),c=new Map,r=await D(t,n.ev,"read","o"),w={sql:`${r.sql} AND (NOT EXISTS (SELECT 1 FROM objects own WHERE own.id = o.owner AND own.type = 'node') OR o.owner = ?)`,params:[...r.params,e.class==="node"?e.node.id:""]};for(const s of await T(t,o,w))c.set(s.object,[...c.get(s.object)??[],s]);const m=e.class==="node"&&o.includes("boot")?await h(t,n.ev,"o.owner = ?",[e.node.id]):[],p=[...new Set([...c.keys(),...m.map(s=>s.id)])],u=p.length===0?[]:await h(t,n.ev,`o.id IN (${p.map(()=>"?").join(",")})`,p),y=new Map(i.map((s,d)=>[s.id,d])),f=a(s=>y.get(s.owner)??i.length,"rankOf"),v=await $(t,n,u.map(s=>s.name));return await _(u.sort((s,d)=>f(s)-f(d)||s.seq-d.seq),async s=>await x(t,e,n,l,s,c.get(s.id)??[],v))}a(Z,"loadCorpus");async function ee(t,e,o){const i=await O(t,e,await g(t,e)),n=(await h(t,i.ev,"o.id = ?",[o.id]))[0];if(!n)throw new Error(`document ${o.id} has no documents row or is not readable`);return await x(t,e,i,await j(t,e),n,await k(t,n))}a(ee,"deliveryDocOf");async function te(t,e,o){const i=await O(t,e,await g(t,e)),n=await j(t,e),l=await h(t,i.ev,"o.owner = ? AND d.unlisted = 0",[o.id]),c=await $(t,i,l.map(r=>r.name));return await _(l,async r=>await x(t,e,i,n,r,await k(t,r),c))}a(te,"listingCorpus");async function ne(t,e){if(e.class!=="node")throw new Error(`nodeSubject needs a node reader, got ${e.class}`);const o=await q(e.node.id,[...e.repos,...e.projectRepos]);if(o===null)throw new Error(`no node ${e.node.id}`);return o}a(ne,"nodeSubject");export{ee as deliveryDocOf,W as deliveryLimitFor,te as listingCorpus,Z as loadCorpus,ne as nodeSubject,N as ownerHandle,V as primeBodies,F as typedLimitKey};
1
+ var S=Object.defineProperty;var s=(e,t)=>S(e,"name",{value:t,configurable:!0});import{permits as k,resolveReader as L}from"../../permissions/evaluator.js";import{get as A,getMany as C}from"../../graph/bodies.js";import{resolveName as I,viewOf as j,viewResolutions as D}from"../../graph/names.js";import{rulesOn as B,rulesOf as _}from"../../graph/rules.js";import{loadExactProfileManifest as q}from"../../profiles/manifest.js";import{assembleNodeSubject as F}from"../subject.js";import{mapAsync as O}from"../../async-array.js";function N(e){return e.type==="node"?e.id:e.name}s(N,"ownerHandle");function T(e){return`${e.type}:${N(e)}`}s(T,"typedLimitKey");function W(e,t,o){if(o?.class==="node"&&o.profile!==null&&o.profile.id===t.id)return"content";const i=e?.delivery_limits;return i?i[T(t)]??i[N(t)]??"content":"content"}s(W,"deliveryLimitFor");async function R(e,t){if(t.class!=="node"||t.profile===null)return null;const o=await e.prepare("SELECT external_id FROM identities WHERE object = ? AND scheme = 'profile'").get(t.profile.id);if(!o)throw new Error(`profile object ${t.profile.id} has no profile identity`);return q(o.external_id).manifest}s(R,"readerManifest");async function h(e,t,o,i){const n=await k(e,t,"read","o");return await e.prepareUncached(`SELECT o.*, d.heads_key, d.unlisted, d.source_path FROM objects o JOIN documents d ON d.object = o.id
2
+ WHERE o.type = 'document' AND o.deleted_at IS NULL AND ${o} AND ${n.sql} ORDER BY o.seq`).all(...i,...n.params)}s(h,"documentRows");async function b(e,t){const o=t.heads_key.split(","),i=await e.prepareUncached(`SELECT body_hash FROM revisions WHERE document = ? AND rev_id IN (${o.map(()=>"?").join(",")})
3
+ ORDER BY number DESC LIMIT 1`).get(t.id,...o);if(!i)throw new Error(`document ${t.id} has no head revision ${t.heads_key}`);return i.body_hash}s(b,"headBodyHash");async function $(e,t,o){return{view:o,ev:await L(e,t)}}s($,"resolveContext");async function x(e,t,o,i,n,l,c){const{view:r}=o,w=r.findIndex(H=>H.id===n.owner),d=w>=0?r[w]:await e.prepare("SELECT * FROM objects WHERE id = ?").get(n.owner),p=N(d),u=c?.get(n.name),y=u===void 0?await I(e,t,n.name,o):u===null?{missing:!0}:{object:{id:u}},f=await b(e,n),{heads_key:E,unlisted:a,source_path:m,...M}=n,g={object:M,owner:d,ownerHandle:p,viewRank:w>=0?w:r.length,ownNode:t.class==="node"&&n.owner===t.node.id,shipped:m!==null,kind:n.kind==="preference"?"preference":"knowledge",name:n.name,displayName:"object"in y&&y.object.id===n.id?n.name:`${p}/${n.name}`,preview:n.preview,unlisted:a!==0,headsKey:E,bodyHash:f,body:s(async()=>v.get(g)??U(g,await A(e,f)),"body"),rules:l,limit:W(i,d,t)};return g}s(x,"toDeliveryDoc");const v=new WeakMap;function U(e,t){return v.set(e,t),t}s(U,"remember");async function X(e,t){const o=t.filter(n=>!v.has(n)),i=await C(e,o.map(n=>n.bodyHash));for(const n of o)v.set(n,i.get(n.bodyHash))}s(X,"primeBodies");async function Z(e,t,o){const i=await j(e,t),n=await $(e,t,i),l=await R(e,t),c=new Map;if(i.length===0)return[];const r=await k(e,n.ev,"read","o"),w={sql:`${r.sql} AND o.owner IN (${i.map(()=>"?").join(",")})`,params:[...r.params,...i.map(a=>a.id)]};for(const a of await B(e,o,w))c.set(a.object,[...c.get(a.object)??[],a]);const d=t.class==="node"&&o.includes("boot")?await h(e,n.ev,"o.owner = ?",[t.node.id]):[],p=[...new Set([...c.keys(),...d.map(a=>a.id)])],u=p.length===0?[]:await h(e,n.ev,`o.id IN (${p.map(()=>"?").join(",")})`,p),y=new Map(i.map((a,m)=>[a.id,m])),f=s(a=>y.get(a.owner)??i.length,"rankOf"),E=await D(e,n,u.map(a=>a.name));return await O(u.sort((a,m)=>f(a)-f(m)||a.seq-m.seq),async a=>await x(e,t,n,l,a,c.get(a.id)??[],E))}s(Z,"loadCorpus");async function ee(e,t,o){const i=await $(e,t,await j(e,t)),n=(await h(e,i.ev,"o.id = ?",[o.id]))[0];if(!n)throw new Error(`document ${o.id} has no documents row or is not readable`);return await x(e,t,i,await R(e,t),n,await _(e,n))}s(ee,"deliveryDocOf");async function te(e,t,o){const i=await $(e,t,await j(e,t)),n=await R(e,t),l=await h(e,i.ev,"o.owner = ? AND d.unlisted = 0",[o.id]),c=await D(e,i,l.map(r=>r.name));return await O(l,async r=>await x(e,t,i,n,r,await _(e,r),c))}s(te,"listingCorpus");async function ne(e,t){if(t.class!=="node")throw new Error(`nodeSubject needs a node reader, got ${t.class}`);const o=await F(t.node.id,[...t.repos,...t.projectRepos]);if(o===null)throw new Error(`no node ${t.node.id}`);return o}s(ne,"nodeSubject");export{ee as deliveryDocOf,W as deliveryLimitFor,te as listingCorpus,Z as loadCorpus,ne as nodeSubject,N as ownerHandle,X as primeBodies,T as typedLimitKey};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.643",
3
+ "version": "0.3.644",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -145,7 +145,7 @@
145
145
  },
146
146
  "license": "UNLICENSED",
147
147
  "dependencies": {
148
- "@north-light/identity": "0.3.643",
148
+ "@north-light/identity": "0.3.644",
149
149
  "@earendil-works/chord": "1.1.0",
150
150
  "@earendil-works/pi-agent-core": "1.1.0",
151
151
  "@earendil-works/pi-ai": "1.1.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/identity",
3
- "version": "0.3.643",
3
+ "version": "0.3.644",
4
4
  "description": "Northlight access-token verification and scope rules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/runtime.lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.643",
3
+ "version": "0.3.644",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/cli",
9
- "version": "0.3.643",
9
+ "version": "0.3.644",
10
10
  "hasInstallScript": true,
11
11
  "license": "UNLICENSED",
12
12
  "workspaces": [
@@ -28,7 +28,7 @@
28
28
  "@milkdown/preset-gfm": "^7.22.3",
29
29
  "@milkdown/prose": "^7.22.3",
30
30
  "@milkdown/utils": "^7.22.3",
31
- "@north-light/identity": "0.3.643",
31
+ "@north-light/identity": "0.3.644",
32
32
  "cron-parser": "^5.6.0",
33
33
  "esbuild": "^0.27.7",
34
34
  "jose": "^6.2.12",
@@ -11956,17 +11956,17 @@
11956
11956
  },
11957
11957
  "packages/crouter-api": {
11958
11958
  "name": "@north-light/api",
11959
- "version": "0.3.643",
11959
+ "version": "0.3.644",
11960
11960
  "license": "UNLICENSED"
11961
11961
  },
11962
11962
  "packages/crouter-env-docker": {
11963
11963
  "name": "@north-light/env-docker",
11964
- "version": "0.3.643",
11964
+ "version": "0.3.644",
11965
11965
  "license": "UNLICENSED"
11966
11966
  },
11967
11967
  "packages/crouter-identity": {
11968
11968
  "name": "@north-light/identity",
11969
- "version": "0.3.643",
11969
+ "version": "0.3.644",
11970
11970
  "license": "UNLICENSED",
11971
11971
  "dependencies": {
11972
11972
  "jose": "^6.2.1"
@@ -11974,21 +11974,21 @@
11974
11974
  },
11975
11975
  "packages/crouter-plugin": {
11976
11976
  "name": "@north-light/plugin",
11977
- "version": "0.3.643",
11977
+ "version": "0.3.644",
11978
11978
  "license": "UNLICENSED",
11979
11979
  "dependencies": {
11980
- "@north-light/api": "0.3.643",
11981
- "@north-light/identity": "0.3.643"
11980
+ "@north-light/api": "0.3.644",
11981
+ "@north-light/identity": "0.3.644"
11982
11982
  }
11983
11983
  },
11984
11984
  "packages/crouter-sdk": {
11985
11985
  "name": "@north-light/sdk",
11986
- "version": "0.3.643",
11986
+ "version": "0.3.644",
11987
11987
  "license": "UNLICENSED",
11988
11988
  "dependencies": {
11989
- "@north-light/api": "0.3.643",
11990
- "@north-light/identity": "0.3.643",
11991
- "@north-light/plugin": "0.3.643",
11989
+ "@north-light/api": "0.3.644",
11990
+ "@north-light/identity": "0.3.644",
11991
+ "@north-light/plugin": "0.3.644",
11992
11992
  "jose": "^6.2.1"
11993
11993
  },
11994
11994
  "bin": {