@north-light/cli 0.3.513 → 0.3.515

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.
@@ -5,7 +5,8 @@ import type { DatabaseSync } from 'node:sqlite';
5
5
  import type { ObjectRow } from './types.js';
6
6
  /** Whether an object of this kind is something a node waits on: one of its events ends a wait. */
7
7
  export declare function kindEndsWait(db: DatabaseSync, type: string): boolean;
8
- /** `watcher` (a node) started watching `object`: arm its wait when the object's kind has an ending event. */
8
+ /** `watcher` (a node) started watching `object`: arm its wait when the object's kind has an ending event.
9
+ * A node of another machine has no `nodes` row here; its home arms the wait when peer ingest records the watch there. */
9
10
  export declare function armObjectWaitForWatch(db: DatabaseSync, watcher: ObjectRow, object: ObjectRow): void;
10
11
  /** `watcher` stopped watching `object` entirely: its wait on it is over. */
11
12
  export declare function settleObjectWaitForUnwatch(db: DatabaseSync, watcher: ObjectRow, object: ObjectRow): void;
@@ -1 +1 @@
1
- var r=Object.defineProperty;var n=(e,t)=>r(e,"name",{value:t,configurable:!0});import{armObjectWait as o,settleObjectWaits as a}from"../canvas/waits.js";import{kindOf as d}from"./kinds/registry.js";function f(e,t){return Object.values(d(e,t).events).some(i=>i.endsWait===!0)}n(f,"kindEndsWait");function c(e,t,i){t.type!=="node"||!f(e,i.type)||o(e,t.id,i.id)}n(c,"armObjectWaitForWatch");function m(e,t,i){t.type==="node"&&a(e,i.id,t.id)}n(m,"settleObjectWaitForUnwatch");export{c as armObjectWaitForWatch,f as kindEndsWait,m as settleObjectWaitForUnwatch};
1
+ var r=Object.defineProperty;var n=(e,t)=>r(e,"name",{value:t,configurable:!0});import{armObjectWait as o,settleObjectWaits as f}from"../canvas/waits.js";import{kindOf as u}from"./kinds/registry.js";import{stubOf as m}from"../peer/stubs.js";function p(e,t){return Object.values(u(e,t).events).some(i=>i.endsWait===!0)}n(p,"kindEndsWait");function W(e,t,i){t.type!=="node"||m(e,t)!==null||!p(e,i.type)||o(e,t.id,i.id)}n(W,"armObjectWaitForWatch");function c(e,t,i){t.type==="node"&&f(e,i.id,t.id)}n(c,"settleObjectWaitForUnwatch");export{W as armObjectWaitForWatch,p as kindEndsWait,c as settleObjectWaitForUnwatch};
@@ -1 +1 @@
1
- var k=Object.defineProperty;var r=(e,n)=>k(e,"name",{value:n,configurable:!0});import{prepared as d}from"../sqlite-statements.js";import{CrtrError as R}from"../errors.js";import{getById as S,getByRowid as L}from"../graph/objects.js";import{publish as O}from"../graph/events.js";import{markLinkWatch as h,recordWatch as w}from"../graph/watches.js";import{ackRows as x,claimRows as A}from"./outbox-store.js";import{ensureStub as E,localOwnerActor as T,stubOf as f}from"./stubs.js";const v=100,K=r(e=>e==="unknown_event"||e==="unknown_kind","isCatalogLag"),y=r((e,n)=>`peer:${e}:${n}`,"ingestKey");function $(e,n){return d(e,"SELECT 1 FROM peer_ingested WHERE key = ?").get(n)!==void 0?!0:d(e,"SELECT 1 FROM deliveries WHERE idempotency_key >= ? AND idempotency_key < ? LIMIT 1").get(`${n}:`,`${n};`)!==void 0}r($,"applied");const m=r((e,n,t)=>{d(e,"INSERT OR IGNORE INTO peer_ingested_destinations (key, ingested_at) VALUES (?, ?)").run(`${n}:${t}`,Date.now())},"markDestination");function N(e,n,t){return d(e,"SELECT 1 FROM peer_ingested_destinations WHERE key = ?").get(`${n}:${t}`)!==void 0||d(e,"SELECT 1 FROM deliveries WHERE idempotency_key = ?").get(`${n}:${t}`)!==void 0}r(N,"destinationDone");function C(e,n,t){return T(e,n)??E(e,n.id,n.type,t,void 0,n)}r(C,"actorFor");function _(e,n,t,c,i){const s=t.actor===null?null:C(e,t.actor,n),u=t.body_text,o=t.body===void 0&&u===void 0?void 0:{...t.body??{},...u===void 0?{}:{body:u}};O(e,{event:t.event,object:c,actor:s,level:t.level,attrs:t.attrs,...o===void 0?{}:{messageBody:o},idempotencyKey:y(n,t.message_id),...i===void 0?{}:{onlyWatchers:i}})}r(_,"apply");function I(e,n){const t=`ev:${n.message_id}:`;if(!n.key.startsWith(t)||n.key.length===t.length)return null;const c=S(e,n.key.slice(t.length));return c!==null&&c.type==="node"&&c.deleted_at===null&&f(e,c)===null?c:null}r(I,"localDestination");function P(e,n,t){const c={accepted:[],rejected:[]};for(const i of t){const s=y(n,i.message_id),u=$(e,s);e.exec("SAVEPOINT peer_event");try{const o=I(e,i);if(u&&o===null){e.exec("RELEASE peer_event"),c.accepted.push(i.key);continue}const l=E(e,i.object.id,i.object.type,n,void 0,i.object),a=i.linked===!0&&o!==null&&l.owner!==null?L(e,l.owner):null,p=a!==null&&a.type==="app"?a:null;if(o!==null&&d(e,"SELECT 1 FROM watches WHERE watcher = ? AND object = ?").get(o.rowid,l.rowid)===void 0?w(e,o,l,"act",{patterns:[">"],...p===null?{}:{linkApp:p}}):o!==null&&p!==null&&h(e,o,l,p),u)N(e,s,o.id)||_(e,n,i,l,[o.id]);else{_(e,n,i,l),d(e,"INSERT OR IGNORE INTO peer_ingested (key, ingested_at) VALUES (?, ?)").run(s,Date.now());for(const g of d(e,"SELECT destination_id FROM deliveries WHERE idempotency_key >= ? AND idempotency_key < ?").all(`${s}:`,`${s};`))m(e,s,g.destination_id)}o!==null&&m(e,s,o.id),e.exec("RELEASE peer_event"),c.accepted.push(i.key)}catch(o){e.exec("ROLLBACK TO peer_event"),e.exec("RELEASE peer_event");const l=o instanceof R?o.code:"invalid_event";c.rejected.push({key:i.key,code:l,message:o instanceof Error?o.message:String(o)})}}return c}r(P,"ingestPeerEvents");const G=r((e,n,t)=>f(e,n)?.home_machine===t,"isStubOf"),U=r((e,n,t)=>A(e,n,t),"claimFor"),X=r((e,n,t)=>x(e,n,t),"ackFor");export{v as MAX_EVENTS_PER_CALL,X as ackFor,U as claimFor,y as ingestKey,P as ingestPeerEvents,K as isCatalogLag,G as isStubOf};
1
+ var k=Object.defineProperty;var r=(e,t)=>k(e,"name",{value:t,configurable:!0});import{prepared as d}from"../sqlite-statements.js";import{CrtrError as R}from"../errors.js";import{getById as O,getByRowid as S}from"../graph/objects.js";import{publish as L}from"../graph/events.js";import{markLinkWatch as h,recordWatch as w}from"../graph/watches.js";import{armObjectWaitForWatch as x}from"../graph/object-waits.js";import{ackRows as A,claimRows as T}from"./outbox-store.js";import{ensureStub as E,localOwnerActor as $,stubOf as f}from"./stubs.js";const P=100,G=r(e=>e==="unknown_event"||e==="unknown_kind","isCatalogLag"),m=r((e,t)=>`peer:${e}:${t}`,"ingestKey");function N(e,t){return d(e,"SELECT 1 FROM peer_ingested WHERE key = ?").get(t)!==void 0?!0:d(e,"SELECT 1 FROM deliveries WHERE idempotency_key >= ? AND idempotency_key < ? LIMIT 1").get(`${t}:`,`${t};`)!==void 0}r(N,"applied");const y=r((e,t,n)=>{d(e,"INSERT OR IGNORE INTO peer_ingested_destinations (key, ingested_at) VALUES (?, ?)").run(`${t}:${n}`,Date.now())},"markDestination");function C(e,t,n){return d(e,"SELECT 1 FROM peer_ingested_destinations WHERE key = ?").get(`${t}:${n}`)!==void 0||d(e,"SELECT 1 FROM deliveries WHERE idempotency_key = ?").get(`${t}:${n}`)!==void 0}r(C,"destinationDone");function F(e,t,n){return $(e,t)??E(e,t.id,t.type,n,void 0,t)}r(F,"actorFor");function _(e,t,n,c,i){const l=n.actor===null?null:F(e,n.actor,t),u=n.body_text,o=n.body===void 0&&u===void 0?void 0:{...n.body??{},...u===void 0?{}:{body:u}};L(e,{event:n.event,object:c,actor:l,level:n.level,attrs:n.attrs,...o===void 0?{}:{messageBody:o},idempotencyKey:m(t,n.message_id),...i===void 0?{}:{onlyWatchers:i}})}r(_,"apply");function I(e,t){const n=`ev:${t.message_id}:`;if(!t.key.startsWith(n)||t.key.length===n.length)return null;const c=O(e,t.key.slice(n.length));return c!==null&&c.type==="node"&&c.deleted_at===null&&f(e,c)===null?c:null}r(I,"localDestination");function U(e,t,n){const c={accepted:[],rejected:[]};for(const i of n){const l=m(t,i.message_id),u=N(e,l);e.exec("SAVEPOINT peer_event");try{const o=I(e,i);if(u&&o===null){e.exec("RELEASE peer_event"),c.accepted.push(i.key);continue}const s=E(e,i.object.id,i.object.type,t,void 0,i.object),p=i.linked===!0&&o!==null&&s.owner!==null?S(e,s.owner):null,a=p!==null&&p.type==="app"?p:null;if(o!==null&&d(e,"SELECT 1 FROM watches WHERE watcher = ? AND object = ?").get(o.rowid,s.rowid)===void 0?(w(e,o,s,"act",{patterns:[">"],...a===null?{}:{linkApp:a}}),x(e,o,s)):o!==null&&a!==null&&h(e,o,s,a),u)C(e,l,o.id)||_(e,t,i,s,[o.id]);else{_(e,t,i,s),d(e,"INSERT OR IGNORE INTO peer_ingested (key, ingested_at) VALUES (?, ?)").run(l,Date.now());for(const g of d(e,"SELECT destination_id FROM deliveries WHERE idempotency_key >= ? AND idempotency_key < ?").all(`${l}:`,`${l};`))y(e,l,g.destination_id)}o!==null&&y(e,l,o.id),e.exec("RELEASE peer_event"),c.accepted.push(i.key)}catch(o){e.exec("ROLLBACK TO peer_event"),e.exec("RELEASE peer_event");const s=o instanceof R?o.code:"invalid_event";c.rejected.push({key:i.key,code:s,message:o instanceof Error?o.message:String(o)})}}return c}r(U,"ingestPeerEvents");const X=r((e,t,n)=>f(e,t)?.home_machine===n,"isStubOf"),q=r((e,t,n)=>T(e,t,n),"claimFor"),z=r((e,t,n)=>A(e,t,n),"ackFor");export{P as MAX_EVENTS_PER_CALL,z as ackFor,q as claimFor,m as ingestKey,U as ingestPeerEvents,G as isCatalogLag,X as isStubOf};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.513",
3
+ "version": "0.3.515",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -139,7 +139,7 @@
139
139
  },
140
140
  "license": "UNLICENSED",
141
141
  "dependencies": {
142
- "@north-light/identity": "0.3.513",
142
+ "@north-light/identity": "0.3.515",
143
143
  "@earendil-works/pi-agent-core": "1.1.0",
144
144
  "@earendil-works/pi-ai": "1.1.0",
145
145
  "@earendil-works/pi-coding-agent": "1.1.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/identity",
3
- "version": "0.3.513",
3
+ "version": "0.3.515",
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.513",
3
+ "version": "0.3.515",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/cli",
9
- "version": "0.3.513",
9
+ "version": "0.3.515",
10
10
  "hasInstallScript": true,
11
11
  "license": "UNLICENSED",
12
12
  "workspaces": [
@@ -24,7 +24,7 @@
24
24
  "@milkdown/preset-gfm": "^7.22.3",
25
25
  "@milkdown/prose": "^7.22.3",
26
26
  "@milkdown/utils": "^7.22.3",
27
- "@north-light/identity": "0.3.513",
27
+ "@north-light/identity": "0.3.515",
28
28
  "cron-parser": "^5.6.0",
29
29
  "esbuild": "^0.27.7",
30
30
  "jose": "^6.2.12",
@@ -12468,17 +12468,17 @@
12468
12468
  },
12469
12469
  "packages/crouter-api": {
12470
12470
  "name": "@north-light/api",
12471
- "version": "0.3.513",
12471
+ "version": "0.3.515",
12472
12472
  "license": "UNLICENSED"
12473
12473
  },
12474
12474
  "packages/crouter-env-docker": {
12475
12475
  "name": "@north-light/env-docker",
12476
- "version": "0.3.513",
12476
+ "version": "0.3.515",
12477
12477
  "license": "UNLICENSED"
12478
12478
  },
12479
12479
  "packages/crouter-identity": {
12480
12480
  "name": "@north-light/identity",
12481
- "version": "0.3.513",
12481
+ "version": "0.3.515",
12482
12482
  "license": "UNLICENSED",
12483
12483
  "dependencies": {
12484
12484
  "jose": "^6.2.1"
@@ -12486,20 +12486,20 @@
12486
12486
  },
12487
12487
  "packages/crouter-plugin": {
12488
12488
  "name": "@north-light/plugin",
12489
- "version": "0.3.513",
12489
+ "version": "0.3.515",
12490
12490
  "license": "UNLICENSED",
12491
12491
  "dependencies": {
12492
- "@north-light/api": "0.3.513",
12493
- "@north-light/identity": "0.3.513"
12492
+ "@north-light/api": "0.3.515",
12493
+ "@north-light/identity": "0.3.515"
12494
12494
  }
12495
12495
  },
12496
12496
  "packages/crouter-sdk": {
12497
12497
  "name": "@north-light/sdk",
12498
- "version": "0.3.513",
12498
+ "version": "0.3.515",
12499
12499
  "license": "UNLICENSED",
12500
12500
  "dependencies": {
12501
- "@north-light/api": "0.3.513",
12502
- "@north-light/identity": "0.3.513",
12501
+ "@north-light/api": "0.3.515",
12502
+ "@north-light/identity": "0.3.515",
12503
12503
  "jose": "^6.2.1"
12504
12504
  },
12505
12505
  "bin": {