@north-light/cli 0.3.622 → 0.3.624

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.
@@ -0,0 +1,10 @@
1
+ -- 015-exposures-object-index.sql — an index on `exposures (object)`. One transaction, additions only: `schema_min_reader` is not
2
+ -- touched, so the previous release (version 14) still opens the result. It never names the index, and no statement it runs changes
3
+ -- meaning with it present.
4
+ --
5
+ -- `exposures.object REFERENCES objects(id) ON DELETE CASCADE` had no index leading with `object`: the primary key is
6
+ -- (node, object, channel), so every deleted object made Postgres skip-scan the whole primary key across every node to find the rows
7
+ -- the cascade removes. Measured on the cycle-6 rehearsal database (about 1M rows, 8,512 nodes): 135 ms and 12,174 index searches per
8
+ -- deleted object, growing with the node count; an import rollback deletes about 42.5k objects. `IF NOT EXISTS` because the gate
9
+ -- database already has this index, built by hand under this name.
10
+ CREATE INDEX IF NOT EXISTS exposures_object ON exposures (object);
@@ -1,7 +1,7 @@
1
1
  /** The canvas schema version this build supports: the number of the highest delta in `schema-pg/` (the baseline
2
2
  * `schema-pg.sql` is version 1). `scripts/install-runtime.mjs` reads this module from a candidate generation to refuse
3
3
  * one below the live database's `schema_min_reader`. */
4
- export declare const CANVAS_SCHEMA_VERSION = 14;
4
+ export declare const CANVAS_SCHEMA_VERSION = 15;
5
5
  /** The Postgres schema holding the canvas tables: `CRTR_DATABASE_SCHEMA` (`crtr` in the cloud deploy). Unset or empty
6
6
  * means the role's own search_path (`public` on a Mac and on a VM). A name that is not a plain identifier is an error:
7
7
  * it is put in a `search_path` connection option. */
@@ -1 +1 @@
1
- var m=Object.defineProperty;var r=(n,e)=>m(n,"name",{value:e,configurable:!0});const A=14;function _(n=process.env){const e=n.CRTR_DATABASE_SCHEMA?.trim();if(e){if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e))throw new Error(`CRTR_DATABASE_SCHEMA must be a plain identifier (letters, digits, underscore); got ${JSON.stringify(e)}`);return e}}r(_,"canvasDatabaseSchema");function h(n=process.env){return n.CRTR_SCHEMA_DATABASE_URL?.trim()||void 0}r(h,"canvasSchemaDatabaseUrl");function E(n=process.env){const e=_(n);return e===void 0?void 0:`-c search_path=${e}`}r(E,"canvasSearchPathOptions");async function v(n,e){const t=e===void 0?"canvas_meta":`"${e.replace(/"/g,'""')}".canvas_meta`;if((await n.query(`SELECT to_regclass('${t.replace(/'/g,"''")}') IS NOT NULL AS found`)).rows[0].found!==!0)return;const u=(await n.query(`SELECT key, value FROM ${t} WHERE key IN ('schema_version', 'schema_min_reader')`)).rows,o=r(c=>{const i=u.find(f=>f.key===c);if(i===void 0)return;const d=Number(i.value);if(!Number.isSafeInteger(d))throw new Error(`canvas_meta.${c} is not an integer: ${String(i.value)}`);return d},"value"),s=o("schema_version");return s===void 0?void 0:{version:s,minReader:o("schema_min_reader")??s}}r(v,"readStoredVersions");async function l(n,e,t){const a=await v(n,t);if(a!==void 0&&a.minReader>e)throw new Error(`refusing to select runtime with canvas schema ${e}: the live database requires readers at version ${a.minReader} or above (it is at ${a.version}); install a descendant build instead`)}r(l,"assertCandidateMayOpen");export{A as CANVAS_SCHEMA_VERSION,l as assertCandidateMayOpen,_ as canvasDatabaseSchema,h as canvasSchemaDatabaseUrl,E as canvasSearchPathOptions,v as readStoredVersions};
1
+ var m=Object.defineProperty;var r=(n,e)=>m(n,"name",{value:e,configurable:!0});const A=15;function _(n=process.env){const e=n.CRTR_DATABASE_SCHEMA?.trim();if(e){if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e))throw new Error(`CRTR_DATABASE_SCHEMA must be a plain identifier (letters, digits, underscore); got ${JSON.stringify(e)}`);return e}}r(_,"canvasDatabaseSchema");function h(n=process.env){return n.CRTR_SCHEMA_DATABASE_URL?.trim()||void 0}r(h,"canvasSchemaDatabaseUrl");function E(n=process.env){const e=_(n);return e===void 0?void 0:`-c search_path=${e}`}r(E,"canvasSearchPathOptions");async function v(n,e){const t=e===void 0?"canvas_meta":`"${e.replace(/"/g,'""')}".canvas_meta`;if((await n.query(`SELECT to_regclass('${t.replace(/'/g,"''")}') IS NOT NULL AS found`)).rows[0].found!==!0)return;const u=(await n.query(`SELECT key, value FROM ${t} WHERE key IN ('schema_version', 'schema_min_reader')`)).rows,o=r(c=>{const i=u.find(f=>f.key===c);if(i===void 0)return;const d=Number(i.value);if(!Number.isSafeInteger(d))throw new Error(`canvas_meta.${c} is not an integer: ${String(i.value)}`);return d},"value"),s=o("schema_version");return s===void 0?void 0:{version:s,minReader:o("schema_min_reader")??s}}r(v,"readStoredVersions");async function l(n,e,t){const a=await v(n,t);if(a!==void 0&&a.minReader>e)throw new Error(`refusing to select runtime with canvas schema ${e}: the live database requires readers at version ${a.minReader} or above (it is at ${a.version}); install a descendant build instead`)}r(l,"assertCandidateMayOpen");export{A as CANVAS_SCHEMA_VERSION,l as assertCandidateMayOpen,_ as canvasDatabaseSchema,h as canvasSchemaDatabaseUrl,E as canvasSearchPathOptions,v as readStoredVersions};
@@ -6,8 +6,9 @@ export declare class ImportCloud {
6
6
  private readonly apiUrl;
7
7
  private readonly token;
8
8
  private readonly retryBaseMs;
9
+ private readonly putIdleMs;
9
10
  /** `token` is a fixed import token, or a getter for a person bearer (5-minute tokens, so a long import asks per call). */
10
- constructor(apiUrl: string, token: string | (() => Promise<string>), retryBaseMs?: number);
11
+ constructor(apiUrl: string, token: string | (() => Promise<string>), retryBaseMs?: number, putIdleMs?: number);
11
12
  private call;
12
13
  start(request: ImportStartRequest): Promise<ImportStartedDTO>;
13
14
  uploadUrls(run: string, keys: string[]): Promise<ImportUploadUrlsDTO>;
@@ -1 +1 @@
1
- var f=Object.defineProperty;var d=(p,t)=>f(p,"name",{value:t,configurable:!0});import{general as u}from"../../errors.js";const g="stores.json",y=["auth","credentials","env","settings","plugins"],$=8,m=15e3,T=6e4;class O{static{d(this,"ImportCloud")}apiUrl;token;retryBaseMs;constructor(t,e,r=500){this.apiUrl=t,this.token=e,this.retryBaseMs=r}async call(t,e,r){const o=await fetch(new URL(e,this.apiUrl),{method:t,headers:{authorization:`Bearer ${typeof this.token=="string"?this.token:await this.token()}`,...r===void 0?{}:{"content-type":"application/json"}},...r===void 0?{}:{body:JSON.stringify(r)}}),n=await o.text();if(!o.ok){let a;try{a=JSON.parse(n).error?.code}catch{a=void 0}throw u(`${t} ${e} answered ${o.status}: ${n.slice(0,500)}`,{status:o.status,...typeof a=="string"?{code:a}:{}})}return n===""?void 0:JSON.parse(n)}start(t){return this.call("POST","/v1/imports",t)}uploadUrls(t,e){return this.call("POST",`/v1/imports/${t}/upload-urls`,{keys:e})}putStore(t,e,r){return this.call("PUT",`/v1/imports/${t}/stores/${e}`,r)}load(t){return this.call("POST",`/v1/imports/${t}/load`,{})}get(t){return this.call("GET",`/v1/imports/${t}`)}machineCredential(t,e=!1){return this.call("POST",`/v1/imports/${t}/machine-credential${e?"?rotate=1":""}`,{})}async put(t,e,r,o){let n=!1;for(let a=1;;a+=1){let c,l;try{const s=await fetch(t,{method:"PUT",body:e,signal:AbortSignal.timeout(T+Math.ceil(e.length/50))});if(s.ok){await s.arrayBuffer();return}const i=s.status;let h="";try{h=(await s.text()).slice(0,300)}catch{}if(c=`answered ${i}: ${h}`,i===403&&o!==void 0&&!n){n=!0,t=await o();continue}l=i===408||i===429||i>=500}catch(s){const i=s.cause;c=`failed: ${s instanceof Error?s.message:String(s)}${typeof i?.code=="string"?` (${i.code})`:""}`,l=!0}if(!l)throw u(`upload of ${r} ${c}`,{key:r});if(a>=$)throw u(`upload of ${r} ${c} after ${a} tries`,{key:r});await new Promise(s=>setTimeout(s,Math.min(this.retryBaseMs*2**(a-1),m)*(.5+Math.random()/2)))}}}export{O as ImportCloud,g as STORE_FILE,y as STORE_ORDER};
1
+ var S=Object.defineProperty;var d=(m,t)=>S(m,"name",{value:t,configurable:!0});import{general as f}from"../../errors.js";const U="stores.json",E=["auth","credentials","env","settings","plugins"],y=8,M=15e3,P=6e4,g=64*1024;class x{static{d(this,"ImportCloud")}apiUrl;token;retryBaseMs;putIdleMs;constructor(t,e,s=500,a=P){this.apiUrl=t,this.token=e,this.retryBaseMs=s,this.putIdleMs=a}async call(t,e,s){const a=await fetch(new URL(e,this.apiUrl),{method:t,headers:{authorization:`Bearer ${typeof this.token=="string"?this.token:await this.token()}`,...s===void 0?{}:{"content-type":"application/json"}},...s===void 0?{}:{body:JSON.stringify(s)}}),i=await a.text();if(!a.ok){let o;try{o=JSON.parse(i).error?.code}catch{o=void 0}throw f(`${t} ${e} answered ${a.status}: ${i.slice(0,500)}`,{status:a.status,...typeof o=="string"?{code:o}:{}})}return i===""?void 0:JSON.parse(i)}start(t){return this.call("POST","/v1/imports",t)}uploadUrls(t,e){return this.call("POST",`/v1/imports/${t}/upload-urls`,{keys:e})}putStore(t,e,s){return this.call("PUT",`/v1/imports/${t}/stores/${e}`,s)}load(t){return this.call("POST",`/v1/imports/${t}/load`,{})}get(t){return this.call("GET",`/v1/imports/${t}`)}machineCredential(t,e=!1){return this.call("POST",`/v1/imports/${t}/machine-credential${e?"?rotate=1":""}`,{})}async put(t,e,s,a){let i=!1;for(let o=1;;o+=1){let l,u;const $=new AbortController;let h;const p=d(()=>{clearTimeout(h),h=setTimeout(()=>$.abort(new Error(`no progress for ${Math.round(this.putIdleMs/1e3)}s`)),this.putIdleMs)},"arm");let c=0;const w=new ReadableStream({pull(r){if(p(),c>=e.length){r.close();return}r.enqueue(e.subarray(c,c+g)),c+=g}},{highWaterMark:0});try{p();const r=await fetch(t,{method:"PUT",headers:{"content-length":String(e.length)},body:w,duplex:"half",signal:$.signal});if(p(),r.ok){await r.arrayBuffer();return}const n=r.status;let T="";try{T=(await r.text()).slice(0,300)}catch{}if(l=`answered ${n}: ${T}`,n===403&&a!==void 0&&!i){i=!0,t=await a();continue}u=n===408||n===429||n>=500}catch(r){const n=r.cause;l=`failed: ${r instanceof Error?r.message:String(r)}${typeof n?.code=="string"?` (${n.code})`:""}`,u=!0}finally{clearTimeout(h)}if(!u)throw f(`upload of ${s} ${l}`,{key:s});if(o>=y)throw f(`upload of ${s} ${l} after ${o} tries`,{key:s});await new Promise(r=>setTimeout(r,Math.min(this.retryBaseMs*2**(o-1),M)*(.5+Math.random()/2)))}}}export{x as ImportCloud,U as STORE_FILE,E as STORE_ORDER};
@@ -7,6 +7,10 @@ description: Behavior changes in @north-light/sdk that an app must act on, newes
7
7
 
8
8
  Changes to `@north-light/sdk` that can change what an existing app sees. Newest first.
9
9
 
10
+ ## 0.3.622
11
+
12
+ `oauth.authorizeUrl` takes an optional `loginHint`: a phone number your app already collected, sent as the standard `login_hint`. A signed-out person's sign-in page then shows the number with one "Text me a link" button instead of asking for it (US and Canadian numbers in any format they type; a number the directory cannot text only prefills its form). Nothing is texted until the person presses the button. No existing call changes.
13
+
10
14
  ## 0.3.613
11
15
 
12
16
  `oauth.appMember('user:<id>')` asks the directory whether that person is on the team that holds your app, for your app's own staff pages. It answers `{member: true, role: 'admin' | 'member'}` or `{member: false}` (an unknown user is `member: false`) by calling `GET /v1/apps/self/members/:user_id` as the app itself, and caches nothing, so someone removed from the team is refused at their next call. A 401 re-mints the directory token once. Nothing existing changes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.622",
3
+ "version": "0.3.624",
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.622",
148
+ "@north-light/identity": "0.3.624",
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.622",
3
+ "version": "0.3.624",
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.622",
3
+ "version": "0.3.624",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/cli",
9
- "version": "0.3.622",
9
+ "version": "0.3.624",
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.622",
31
+ "@north-light/identity": "0.3.624",
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.622",
11959
+ "version": "0.3.624",
11960
11960
  "license": "UNLICENSED"
11961
11961
  },
11962
11962
  "packages/crouter-env-docker": {
11963
11963
  "name": "@north-light/env-docker",
11964
- "version": "0.3.622",
11964
+ "version": "0.3.624",
11965
11965
  "license": "UNLICENSED"
11966
11966
  },
11967
11967
  "packages/crouter-identity": {
11968
11968
  "name": "@north-light/identity",
11969
- "version": "0.3.622",
11969
+ "version": "0.3.624",
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.622",
11977
+ "version": "0.3.624",
11978
11978
  "license": "UNLICENSED",
11979
11979
  "dependencies": {
11980
- "@north-light/api": "0.3.622",
11981
- "@north-light/identity": "0.3.622"
11980
+ "@north-light/api": "0.3.624",
11981
+ "@north-light/identity": "0.3.624"
11982
11982
  }
11983
11983
  },
11984
11984
  "packages/crouter-sdk": {
11985
11985
  "name": "@north-light/sdk",
11986
- "version": "0.3.622",
11986
+ "version": "0.3.624",
11987
11987
  "license": "UNLICENSED",
11988
11988
  "dependencies": {
11989
- "@north-light/api": "0.3.622",
11990
- "@north-light/identity": "0.3.622",
11991
- "@north-light/plugin": "0.3.622",
11989
+ "@north-light/api": "0.3.624",
11990
+ "@north-light/identity": "0.3.624",
11991
+ "@north-light/plugin": "0.3.624",
11992
11992
  "jose": "^6.2.1"
11993
11993
  },
11994
11994
  "bin": {