@north-light/cli 0.3.786 → 0.3.788
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/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/builtin-memory/crouter-sdk/release-notes.md +6 -0
- package/dist/core/canvas/canvas.js +23 -22
- package/dist/core/runtime/runner/blaxel/client.js +1 -1
- package/dist/core/storage/shares.d.ts +12 -4
- package/dist/core/storage/shares.js +1 -1
- package/dist/daemon/api/handlers/transfer.js +1 -1
- package/docs/sdk/release-notes.md +6 -0
- package/package.json +3 -3
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
package/dist/api/contract.d.ts
CHANGED
|
@@ -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.
|
|
2
|
+
export declare const CONTRACT_LEVEL = "1.88";
|
|
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`. */
|
package/dist/api/contract.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.
|
|
1
|
+
var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.88",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};
|
|
@@ -9,6 +9,12 @@ 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.788
|
|
13
|
+
|
|
14
|
+
### `shares.create({ upload_id })` shares an upload your app made
|
|
15
|
+
|
|
16
|
+
`shares.create` takes exactly one of `file_id` or `upload_id`. `upload_id` is the id `uploads.create` returned, after you PUT the bytes. The share is a copy at a public URL; the upload itself stays private to your app. Another app's, another person's or an unknown upload id is `404 not_found`; both or neither id is `400 invalid_request`.
|
|
17
|
+
|
|
12
18
|
## 0.3.783
|
|
13
19
|
|
|
14
20
|
### Every limit refusal carries `details.payment`
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _e=Object.defineProperty;var r=(e,n)=>_e(e,"name",{value:n,configurable:!0});import{parsePrincipal as pe}from"@north-light/identity";import{loadExactProfileManifest as fe}from"../profiles/manifest.js";import{envNodeId as $}from"../../shared/env.js";import{lstatSync as Ee,realpathSync as P,rmdirSync as we,rmSync as ye,statSync as me}from"node:fs";import{basename as Ne,dirname as q,isAbsolute as Re,join as h,relative as Se,resolve as he,sep as Oe}from"node:path";import{removeTreeBeneath as z}from"../spaces/open-beneath.js";import{emitEvent as Le}from"../events/emit.js";import{deleteNodeSandboxes as B}from"../runtime/runner/delete-sandboxes.js";import{withCanvasWrite as p,openDb as d}from"./db.js";import{conversationStore as Te,ConversationNotFoundError as De}from"../conversation-store/index.js";import{hasUnseenWakeMail as Ae,UNSEEN_WAKE_MAIL_SQL as ke}from"./deliveries.js";import{isAppRun as J}from"./app-run.js";import{registerOutcomeAction as Y}from"./outcome-actions.js";import{publish as ge}from"../graph/events.js";import{nodeObject as ve}from"../graph/objects.js";import{findNodeBySessionFileSql as xe}from"./sessions.js";import{hydrateFault as Ue}from"./recovery.js";import{hasUnreconciledWorktree as je,openWorktree as be,readWorktree as We,worktreeFromRow as Ce}from"./worktrees.js";import{isPidAlive as Ie,isPidPresent as Q,recordedPidLiveness as Fe}from"./pid.js";import{isCloudRole as He}from"./person-state.js";import{ensureHome as Me,jobDir as $e,nodeDir as Pe,nodeRunDir as V}from"./paths.js";import{appForNode as qe,ensureNodeDirs as ze,nodeAgentDir as Be}from"./node-agent-paths.js";import{appSpace as D}from"../layout.js";import{createObject as Je,getById as A,ownerForGrantee as Ye,setObjectKind as Qe,setObjectName as Ve}from"../graph/objects.js";import{profileObject as Ke}from"../graph/reader.js";import{writeActsFor as K}from"../permissions/facts.js";import{CrtrError as Ge}from"../errors.js";import{deleteNodeWithOwned as Xe}from"../graph/deletion.js";import{SUBTREE_ALL_IDS_SQL as Ze,SUBTREE_IDS_SQL as en}from"./tree.js";import{filterAsync as m,mapAsync as O}from"../async-array.js";function w(e,n){if(e==null)return null;const t=JSON.stringify(e);if(t===void 0)throw new TypeError(`${n} must be JSON-serializable`);return t}r(w,"jsonValue");async function $n(e,n){if((await e.prepare("SELECT deleting_at FROM nodes WHERE node_id = ?").get(n))?.deleting_at)throw new Error("run is deleting")}r($n,"assertRunNotDeleting");async function G(e,n,t,a){try{return(fe(n).manifest.grantee??"app:terminal")!==a?null:await Ke(e,n,t)}catch(i){if(i instanceof Ge&&i.code==="not_found")return null;throw i}}r(G,"profileObjectFor");async function nn(e,n){const t=await Ye(n,e.grantee??"app:terminal"),a=e.profile_id?await G(n,e.profile_id,t,e.grantee??"app:terminal"):null;await Je(n,{id:e.node_id,type:"node",kind:e.kind,owner:(a??t).id,privacy:"public",name:e.name,preview:""}),a===null&&e.sub&&pe(e.sub)?.kind==="user"&&await K(n,e.node_id,e.sub),await n.prepare(`INSERT INTO nodes (node_id, description, title, icon, cycles, mode, lifecycle, cwd, host_kind, profile_id, parent, spawned_by, creator, fork_from, fork_source_file, created, passive_default, cycle_pending, model_override, persona_ack_json, review_binding_json, launch_config_json, scopes_json, isolated, status, intent, final_report, finalized_at, deadline_at, "window", tmux_session, pane, sub, grant_id, client_id, metadata_json, run_id, event_cursor, deleting_at, caused_by, app) VALUES (${Array(41).fill("?").join(", ")})`).run(e.node_id,e.description??null,e.title??null,e.icon??null,e.cycles??null,e.mode,e.lifecycle,e.cwd,e.host_kind??null,e.profile_id??null,e.parent??null,e.spawned_by??null,e.creator??null,e.fork_from??null,e.fork_source_file??null,e.created,e.passive_default===!0?1:0,e.cycle_pending===!0?1:0,e.model_override??null,w(e.persona_ack,"persona_ack"),w(e.review_binding,"review_binding"),w(e.launch,"launch"),w(e.scopes,"scopes"),e.isolated===!0?1:0,e.status??"active",e.intent??null,e.final_report??null,e.finalized_at??null,e.deadline_at??null,e.window??null,e.tmux_session??null,e.pane??null,e.sub??null,e.grant_id??null,e.client_id??null,e.metadata_json??null,e.run_id??null,e.event_cursor??null,e.deleting_at??null,e.caused_by??null,t.id)}r(nn,"seedRow");function X(e){if(e.fault_id==null)return null;const n=Object.entries(e).filter(([t])=>t.startsWith("fault_")).map(([t,a])=>[t==="fault_id"?t:t.slice(6),a]);return Ue(Object.fromEntries(n))}r(X,"faultFrom");const Z=r(e=>e.turn_open_at!=null&&e.turn_closed_at==null,"turnOpen"),ee=r(e=>e||He(),"engineLive"),E=`node_id, name, description, cycles, kind, mode, lifecycle, status, cwd, host_kind, profile_id, scopes_json, isolated,
|
|
2
2
|
grantee, sub, grant_id, client_id, metadata_json, run_id, event_cursor, last_activity_at, caused_by, last_turn_error_json, deleting_at,
|
|
3
3
|
parent, created, intent, cycle_pending, frozen_at, respawn_failures, respawn_not_before, launched_at, last_settled_at, terminal_reason,
|
|
4
4
|
final_report, finalized_at, outcome_kind, outcome_reason, outcome_at, outcome_revision, outcome_detail_json, deadline_at,
|
|
5
5
|
telemetry_tokens_in, telemetry_context_tokens, telemetry_last_activity, telemetry_updated_at, pi_pid, pi_pid_identity,
|
|
6
6
|
"window", tmux_session, pane, turn_open_at, turn_closed_at,
|
|
7
7
|
fault_id, fault_link, fault_op, fault_kind, fault_message, fault_since, fault_operation_id, fault_anchor_entry_id,
|
|
8
|
-
fault_retry_disposition, fault_retry_by, fault_retry_attempt, fault_retry_max, fault_retry_next_at, fault_provider_error_json
|
|
8
|
+
fault_retry_disposition, fault_retry_by, fault_retry_attempt, fault_retry_max, fault_retry_next_at, fault_provider_error_json`,k=`${E}, title, icon, spawned_by, creator, fork_from, fork_source_file, passive_default, model_override,
|
|
9
|
+
persona_ack_json, review_binding_json, launch_config_json, pi_session_id, pi_session_file`;function f(e){const n={node_id:e.node_id,name:e.name,description:e.description??void 0,cycles:e.cycles??void 0,kind:e.kind,mode:e.mode,lifecycle:e.lifecycle,status:e.status,cwd:e.cwd,host_kind:e.host_kind??null,profile_id:e.profile_id??null,scopes:e.scopes_json==null?null:JSON.parse(e.scopes_json),isolated:e.isolated===1,grantee:e.grantee,sub:e.sub??null,grant_id:e.grant_id??null,client_id:e.client_id??null,metadata_json:e.metadata_json??null,run_id:e.run_id??null,event_cursor:e.event_cursor??null,last_activity_at:e.last_activity_at??null,caused_by:e.caused_by??null,last_turn_error_json:e.last_turn_error_json??null,deleting_at:e.deleting_at??null,parent:e.parent??null,created:e.created,intent:e.intent??null,cycle_pending:e.cycle_pending===1,frozen_at:e.frozen_at??null,respawn_failures:e.respawn_failures??0,respawn_not_before:e.respawn_not_before??null,launched_at:e.launched_at??null,last_settled_at:e.last_settled_at??null,terminal_reason:e.terminal_reason??null,final_report:e.final_report??null,finalized_at:e.finalized_at??null,outcome_kind:e.outcome_kind??null,outcome_reason:e.outcome_reason??null,outcome_at:e.outcome_at??null,outcome_revision:e.outcome_revision??0,outcome_detail_json:e.outcome_detail_json??null,deadline_at:e.deadline_at??null,telemetry_tokens_in:e.telemetry_tokens_in??null,telemetry_context_tokens:e.telemetry_context_tokens??null,telemetry_last_activity:e.telemetry_last_activity??null,telemetry_updated_at:e.telemetry_updated_at??null,pi_pid:e.pi_pid??null,pi_pid_identity:e.pi_pid_identity??null,window:e.window??null,tmux_session:e.tmux_session??null,pane:e.pane??null,fault:null,streaming:!1},t=Q(n.pi_pid),a=X(e);return n.fault=a?.link==="pi\u2192provider"&&a.retry.by==="daemon"&&a.retry.disposition==="auto"&&!t?null:a,n.streaming=Z(e)&&ee(t),n}r(f,"rowFrom");async function g(e,n){return n??=await We(e.node_id),{...f(e),title:e.title??void 0,icon:e.icon??void 0,spawned_by:e.spawned_by??null,creator:e.creator??null,fork_from:e.fork_from??null,fork_source_file:e.fork_source_file??null,passive_default:e.passive_default===1,model_override:e.model_override??null,scopes:e.scopes_json==null?null:JSON.parse(e.scopes_json),persona_ack:e.persona_ack_json==null?void 0:JSON.parse(e.persona_ack_json),review_binding:e.review_binding_json==null?void 0:JSON.parse(e.review_binding_json),launch:e.launch_config_json==null?void 0:JSON.parse(e.launch_config_json),pi_session_id:e.pi_session_id??null,pi_session_file:e.pi_session_file??null,...n===null?{}:{managed_worktree:n}}}r(g,"metaFrom");async function Pn(e,n={}){return Me(),await p(async t=>{await nn(e,t),e.managed_worktree!==void 0&&e.managed_worktree!==null&&await be(e.node_id,e.managed_worktree,t),n.outcomeDelivery!==void 0&&await Y(t,e.node_id,n.outcomeDelivery),await n.withinCreate?.(t,e)}),await ze(e.node_id),await L(e.node_id)}r(Pn,"createNode");async function L(e){const n=await(await d()).prepare(`SELECT ${k} FROM node_rows WHERE node_id = ?`).get(e);return n===void 0?null:await g(n)}r(L,"getNode");async function qn(e){if(e.length===0)return[];const n=U.map(i=>`w.${i} AS worktree_${i}`).join(", "),t=await(await d()).prepareUncached(`SELECT ${k.split(",").map(i=>`n.${i.trim()}`).join(", ")}, ${n} FROM node_rows n LEFT JOIN worktrees w ON w.node_id = n.node_id WHERE n.node_id IN (${e.map(()=>"?").join(",")})`).all(...e),a=new Map(t.map(i=>[i.node_id,i]));return await O(e.map(i=>a.get(i)).filter(i=>i!==void 0),async i=>await g(i,te(i)))}r(qn,"getNodes");const tn=1440*60*1e3;function ne(e){return{requestKey:e.request_key,nodeId:e.node_id,state:e.state}}r(ne,"createRequestRecord");async function zn(e){const n=await(await d()).prepareUncached("SELECT request_key, node_id, state FROM create_requests WHERE request_key = ?").get(e);return n===void 0?null:ne(n)}r(zn,"findCreateRequest");async function Bn(e){return await p(async n=>{const t=Date.now();await n.prepareUncached("DELETE FROM create_requests WHERE expires_at <= ?").run(t),await n.prepareUncached("INSERT INTO create_requests (request_key, node_id, expires_at, state) VALUES (?, NULL, ?, 'reserved') ON CONFLICT (request_key) DO NOTHING").run(e,t+tn);const a=await n.prepareUncached("SELECT request_key, node_id, state FROM create_requests WHERE request_key = ?").get(e);return ne(a)})}r(Bn,"reserveCreateRequest");async function Jn(e=Date.now()){return Number((await(await d()).prepareUncached("DELETE FROM create_requests WHERE expires_at <= ?").run(e)).changes)}r(Jn,"pruneExpiredCreateRequests");async function Yn(e,n){await(await d()).prepareUncached("UPDATE create_requests SET node_id = ?, state = 'complete' WHERE request_key = ?").run(n,e)}r(Yn,"recordCreateRequestNode");async function Qn(e,n,t){const a=await d();return await a.prepareUncached("UPDATE create_requests SET node_id = ?, state = 'reserved', lease_owner = ?, lease_expires_at = ? WHERE request_key = ? AND node_id IS NULL").run(n,t,Date.now()+v,e),(await a.prepareUncached("SELECT node_id FROM create_requests WHERE request_key = ?").get(e))?.node_id??null}r(Qn,"reserveCreateRequestNode");const v=3e4,Vn=1e4;async function Kn(e,n,t){const a=Date.now(),i=await(await d()).prepareUncached("UPDATE create_requests SET lease_owner = ?, lease_expires_at = ? WHERE request_key = ? AND node_id = ? AND state = 'reserved' AND (lease_expires_at IS NULL OR lease_expires_at <= ?)").run(t,a+v,e,n,a);return Number(i.changes)>0}r(Kn,"claimCreateLease");async function Gn(e,n){await(await d()).prepareUncached("UPDATE create_requests SET lease_expires_at = ? WHERE request_key = ? AND lease_owner = ?").run(Date.now()+v,e,n)}r(Gn,"renewCreateLease");async function Xn(e){const n=await(await d()).prepareUncached("SELECT lease_expires_at FROM create_requests WHERE request_key = ?").get(e);return n?.lease_expires_at!=null&&Number(n.lease_expires_at)>Date.now()}r(Xn,"createLeaseLive");async function Zn(e,n){await(await d()).prepareUncached("UPDATE create_requests SET state = 'complete' WHERE request_key = ? AND node_id = ?").run(e,n)}r(Zn,"completeCreateRequest");async function et(e,n){await p(async t=>{if(n===null){await t.prepareUncached("DELETE FROM create_requests WHERE request_key = ? AND node_id IS NULL").run(e);return}await t.prepareUncached("DELETE FROM create_requests WHERE request_key = ? AND node_id = ?").run(e,n)})}r(et,"abandonCreateRequest");function nt(e){return he(e)}r(nt,"canonicalSessionFile");async function tt(e){const n=await xe(e);return n===null?null:await L(n)}r(tt,"findNodeBySessionFile");async function at(e){const n=await(await d()).prepare(`SELECT ${E} FROM node_rows WHERE node_id = ?`).get(e);return n?f(n):null}r(at,"getRow");async function it(e){const n=await(await d()).prepare(`SELECT ${E} FROM node_rows WHERE pane = ?`).get(e);return n?f(n):null}r(it,"getRowByPane");async function rt(e){return(await(await d()).prepare(`SELECT ${E} FROM node_rows
|
|
9
10
|
WHERE deadline_at IS NOT NULL AND outcome_at IS NULL
|
|
10
11
|
AND deadline_at <= ? AND status IN ('active','idle') AND kind != 'human'
|
|
11
|
-
ORDER BY deadline_at, created, node_id`).all(e)).map(f)}r(
|
|
12
|
-
WHERE profile_id = ? AND deadline_at IS NOT NULL AND status IN ('active', 'idle')`).all(e),i=t.prepare("UPDATE nodes SET deadline_at = ? WHERE node_id = ? AND deadline_at = ?");let o=0;for(const s of a){const
|
|
12
|
+
ORDER BY deadline_at, created, node_id`).all(e)).map(f)}r(rt,"dueNodeDeadlines");async function ot(e,n){return Number((await(await d()).prepare("UPDATE nodes SET deadline_at = ? WHERE node_id = ?").run(n,e)).changes)===1}r(ot,"setNodeDeadline");async function st(e,n){return!Number.isFinite(n)||n<=0?0:await p(async t=>{const a=await t.prepare(`SELECT node_id, deadline_at FROM nodes
|
|
13
|
+
WHERE profile_id = ? AND deadline_at IS NOT NULL AND status IN ('active', 'idle')`).all(e),i=t.prepare("UPDATE nodes SET deadline_at = ? WHERE node_id = ? AND deadline_at = ?");let o=0;for(const s of a){const u=Date.parse(s.deadline_at);Number.isNaN(u)||(o+=Number((await i.run(new Date(u+n).toISOString(),s.node_id,s.deadline_at)).changes))}return o})}r(st,"shiftProfileNodeDeadlines");function x(e,n){if(e==null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="bigint"||e instanceof Uint8Array)return e;throw new TypeError(`${n} must be a SQLite scalar`)}r(x,"sqlInput");async function dt(e,n){const t=[],a=r((o,s=o)=>{Object.prototype.hasOwnProperty.call(n,o)&&t.push([s,x(n[o],o)])},"add");if(a("description"),a("title"),a("icon"),a("cycles"),a("mode"),a("lifecycle"),a("cwd"),a("host_kind"),a("profile_id"),a("parent"),a("spawned_by"),a("creator"),a("fork_from"),a("fork_source_file"),a("model_override"),Object.prototype.hasOwnProperty.call(n,"passive_default")&&t.push(["passive_default",n.passive_default===!0?1:0]),Object.prototype.hasOwnProperty.call(n,"cycle_pending")&&t.push(["cycle_pending",n.cycle_pending===!0?1:0]),Object.prototype.hasOwnProperty.call(n,"persona_ack")&&t.push(["persona_ack_json",w(n.persona_ack,"persona_ack")]),Object.prototype.hasOwnProperty.call(n,"review_binding")&&t.push(["review_binding_json",w(n.review_binding,"review_binding")]),Object.prototype.hasOwnProperty.call(n,"isolated"))throw new TypeError("isolated cannot change after node creation");Object.prototype.hasOwnProperty.call(n,"scopes")&&t.push(["scopes_json",w(n.scopes,"scopes")]),Object.prototype.hasOwnProperty.call(n,"launch")&&t.push(["launch_config_json",w(n.launch,"launch")]);const i=r(o=>Object.prototype.hasOwnProperty.call(n,o),"has");return await p(async o=>{const s=await A(o,e);if(s===null||s.type!=="node")throw new Error(`unknown node: ${e}`);if(i("name")&&await Ve(o,s,x(n.name,"name")),i("kind")&&await Qe(o,s,x(n.kind,"kind")),t.length===0)return;if(i("profile_id")){const l=await o.prepare("SELECT app FROM nodes WHERE node_id = ?").get(e),_=l?.app?await A(o,l.app):null;if(_){const y=n.profile_id?await G(o,n.profile_id,_,`app:${_.name}`):null;await o.prepare("UPDATE objects SET owner = ? WHERE id = ?").run((y??_).id,e);const R=(await o.prepare("SELECT sub FROM nodes WHERE node_id = ?").get(e)).sub;y===null&&R&&await K(o,e,R)}}if((await o.prepareUncached(`UPDATE nodes SET ${t.map(([l])=>`${l} = ?`).join(", ")} WHERE node_id = ?`).run(...t.map(([,l])=>l),e)).changes!==1)throw new Error(`unknown node: ${e}`)}),await L(e)}r(dt,"updateNode");async function lt(e,n){await(await d()).prepare("UPDATE nodes SET status = ? WHERE node_id = ?").run(n,e)}r(lt,"setStatus");async function ut(e,n){await(await d()).prepare("UPDATE nodes SET intent = ? WHERE node_id = ?").run(n??null,e)}r(ut,"setIntent");async function ct(e,n,t={}){if(t.outcome===void 0){const i=[],o=[];Object.prototype.hasOwnProperty.call(n,"status")&&(i.push("status = ?"),o.push(n.status??null)),Object.prototype.hasOwnProperty.call(n,"intent")&&(i.push("intent = ?"),o.push(n.intent??null)),Object.prototype.hasOwnProperty.call(n,"terminal_reason")&&(i.push("terminal_reason = ?"),o.push(n.terminal_reason??null));const s=["node_id = ?"];o.push(e),t.fromStatuses!==void 0&&(s.push(`status IN (${t.fromStatuses.map(()=>"?").join(", ")})`),o.push(...t.fromStatuses)),t.requireNoFinalReport===!0&&s.push("final_report IS NULL");const u=await(await d()).prepareUncached(`UPDATE nodes SET ${i.join(", ")} WHERE ${s.join(" AND ")}`).run(...o);return Number(u.changes)}const a=t.outcome;return await p(async i=>{const o=[],s=[];Object.prototype.hasOwnProperty.call(n,"status")&&(o.push("status = ?"),s.push(n.status??null)),Object.prototype.hasOwnProperty.call(n,"intent")&&(o.push("intent = ?"),s.push(n.intent??null)),Object.prototype.hasOwnProperty.call(n,"terminal_reason")&&(o.push("terminal_reason = ?"),s.push(n.terminal_reason??null));const u=r((R,S)=>a.supersede===!0?"?":`CASE WHEN outcome_at IS NULL THEN ? ELSE ${S} END`,"outcomeValue");o.push(`outcome_kind = ${u(a.kind,"outcome_kind")}`,`outcome_reason = ${u(a.reason,"outcome_reason")}`,`outcome_detail_json = ${u(a.detailJson,"outcome_detail_json")}`,`outcome_revision = ${a.supersede===!0?"outcome_revision + 1":"CASE WHEN outcome_at IS NULL THEN outcome_revision + 1 ELSE outcome_revision END"}`,`outcome_at = ${u(a.at,"outcome_at")}`),s.push(a.kind,a.reason,a.detailJson,a.at);const l=["node_id = ?"];s.push(e),t.fromStatuses!==void 0&&(l.push(`status IN (${t.fromStatuses.map(()=>"?").join(", ")})`),s.push(...t.fromStatuses)),t.requireNoFinalReport===!0&&l.push("final_report IS NULL");const _=await i.prepareUncached(`UPDATE nodes SET ${o.join(", ")} WHERE ${l.join(" AND ")}`).run(...s);if(Number(_.changes)===0)return 0;const y=await i.prepare("SELECT outcome_at FROM nodes WHERE node_id = ?").get(e);return(a.supersede===!0||y.outcome_at===a.at)&&a.documentJson!==null&&a.documentJson!==void 0&&await ge(i,{event:"outcome",object:await ve(i,e),actor:null,attrs:{revision:Number((await i.prepare("SELECT outcome_revision FROM nodes WHERE node_id = ?").get(e)).outcome_revision)},messageBody:JSON.parse(a.documentJson)}),Number(_.changes)})}r(ct,"transitionStatusIntent");async function _t(e){return(await(await d()).prepare("SELECT final_report FROM nodes WHERE node_id = ?").get(e))?.final_report??null}r(_t,"getFinalReport");async function pt(e,n){return(await(await d()).prepare("UPDATE nodes SET final_report = NULL, finalized_at = NULL WHERE node_id = ? AND final_report = ?").run(e,n)).changes>0}r(pt,"clearFinalReportIfMatches");async function ft(e,n){await(await d()).prepare('UPDATE nodes SET tmux_session = ?, "window" = ?, pane = ? WHERE node_id = ?').run(n.tmux_session??null,n.window??null,n.pane??null,e)}r(ft,"setPresence");async function Et(e,n){await(await d()).prepare("UPDATE nodes SET launched_at = ?, frozen_at = NULL, respawn_not_before = NULL WHERE node_id = ?").run(n,e)}r(Et,"recordLaunch");async function wt(e,n){await(await d()).prepare("UPDATE nodes SET last_settled_at = ? WHERE node_id = ?").run(n,e)}r(wt,"recordSettledTurn");async function yt(e,n){await(await d()).prepare("UPDATE nodes SET frozen_at = ? WHERE node_id = ?").run(n,e)}r(yt,"setFrozen");async function mt(e){await(await d()).prepare("UPDATE nodes SET frozen_at = NULL WHERE node_id = ?").run(e)}r(mt,"clearFrozen");async function Nt(e,n){await(await d()).prepare("UPDATE nodes SET respawn_failures = ?, respawn_not_before = ? WHERE node_id = ?").run(n.failures,n.notBefore,e)}r(Nt,"recordRespawnAttempt");const N="node_id NOT IN (SELECT node_id FROM warm_pool)",U=["state","cleanup_state","path","branch","repo_root","base_ref","base_sha","created_at","closed_at","next_attempt_at","attempts","quarantined","sweep_reason","sweep_detail","sweep_last_at","sweep_observed_json","abandoned_json","land_intent_json","disposal_json"];function te(e){return e.worktree_state===null?null:Ce(Object.fromEntries(U.map(n=>[n,e[`worktree_${n}`]])))}r(te,"worktreeFromProjection");async function Rt(e){const n=U.map(a=>`w.${a} AS worktree_${a}`).join(", "),t=await(await d()).prepareUncached(`SELECT ${k.split(",").map(a=>`n.${a.trim()}`).join(", ")}, ${n} FROM node_rows n LEFT JOIN worktrees w ON w.node_id = n.node_id WHERE n.profile_id = ? ORDER BY n.created`).all(e);return await O(t,async a=>await g(a,te(a)))}r(Rt,"listNodesByProfile");async function St(){return(await(await d()).prepare(`SELECT
|
|
13
14
|
node_id, name, description, kind, mode, lifecycle, status, cwd, profile_id,
|
|
14
15
|
grantee, parent, created, frozen_at, terminal_reason, final_report,
|
|
15
16
|
telemetry_tokens_in, telemetry_updated_at, pi_pid, turn_open_at, turn_closed_at,
|
|
@@ -17,13 +18,13 @@ var ce=Object.defineProperty;var r=(e,n)=>ce(e,"name",{value:n,configurable:!0})
|
|
|
17
18
|
fault_operation_id, fault_anchor_entry_id, fault_retry_disposition,
|
|
18
19
|
fault_retry_by, fault_retry_attempt, fault_retry_max, fault_retry_next_at,
|
|
19
20
|
fault_provider_error_json
|
|
20
|
-
FROM node_rows WHERE ${
|
|
21
|
+
FROM node_rows WHERE ${N} ORDER BY created`).all()).map(f)}r(St,"browseNodes");async function ht(e,n){await(await d()).prepare(`UPDATE nodes
|
|
21
22
|
SET telemetry_tokens_in = ?,
|
|
22
23
|
telemetry_context_tokens = COALESCE(?, telemetry_context_tokens),
|
|
23
24
|
telemetry_last_activity = COALESCE(?, telemetry_last_activity),
|
|
24
25
|
telemetry_updated_at = ?
|
|
25
26
|
WHERE node_id = ?
|
|
26
|
-
AND (telemetry_updated_at IS NULL OR telemetry_updated_at < ?)`).run(n.tokensIn,n.contextTokens,n.lastActivity,n.updatedAt,e,n.updatedAt)}r(
|
|
27
|
+
AND (telemetry_updated_at IS NULL OR telemetry_updated_at < ?)`).run(n.tokensIn,n.contextTokens,n.lastActivity,n.updatedAt,e,n.updatedAt)}r(ht,"updateNodeTelemetry");async function Ot(e){const n=await d(),t=`SELECT
|
|
27
28
|
node_id, name, description, cycles, kind, status, frozen_at,
|
|
28
29
|
telemetry_context_tokens, telemetry_last_activity,
|
|
29
30
|
pi_pid, turn_open_at, turn_closed_at,
|
|
@@ -31,14 +32,14 @@ var ce=Object.defineProperty;var r=(e,n)=>ce(e,"name",{value:n,configurable:!0})
|
|
|
31
32
|
fault_operation_id, fault_anchor_entry_id, fault_retry_disposition,
|
|
32
33
|
fault_retry_by, fault_retry_attempt, fault_retry_max, fault_retry_next_at,
|
|
33
34
|
fault_provider_error_json
|
|
34
|
-
FROM node_rows WHERE ${
|
|
35
|
+
FROM node_rows WHERE ${N}${e===void 0?"":" AND node_id = ANY(?::text[])"} ORDER BY created`;return(e===void 0?await n.prepare(t).all():await n.prepareUncached(t).all([...e])).map(i=>{const o=i.pi_pid??null,s=Q(o),u=X(i);return{node_id:i.node_id,name:i.name,description:i.description??null,cycles:i.cycles??null,kind:i.kind,status:i.status,frozen_at:i.frozen_at??null,pi_pid:o,telemetry_context_tokens:i.telemetry_context_tokens??null,telemetry_last_activity:i.telemetry_last_activity??null,fault:u?.link==="pi\u2192provider"&&u.retry.by==="daemon"&&u.retry.disposition==="auto"&&!s?null:u,streaming:Z(i)&&ee(s)}})}r(Ot,"graphNodes");async function an(e){const n=[N],t=[];if(e?.under!==void 0&&(e.underInclusive===!0?(n.push(`(node_id IN (${Ze}) OR node_id = ?)`),t.push(e.under,e.under,e.under)):(n.push(`node_id IN (${en})`),t.push(e.under,e.under))),e?.lifecycle!==void 0&&(n.push("lifecycle = ?"),t.push(e.lifecycle)),e?.kind!==void 0&&(n.push("kind = ?"),t.push(e.kind)),e?.mode!==void 0&&(n.push("mode = ?"),t.push(e.mode)),e?.profileId!==void 0&&(n.push("profile_id = ?"),t.push(e.profileId)),e?.profilePrefix!==void 0&&(n.push("profile_id LIKE ? ESCAPE '\\'"),t.push(`${e.profilePrefix.replace(/[\\%_]/g,i=>`\\${i}`)}%`)),e?.parent!==void 0&&(n.push("parent = ?"),t.push(e.parent)),e?.topLevel===!0&&n.push("parent IS NULL"),e?.hanging===!0&&n.push("parent IS NOT NULL AND parent NOT IN (SELECT node_id FROM node_rows)"),e?.status!==void 0){const i=Array.isArray(e.status)?e.status:[e.status];n.push(`status IN (${i.map(()=>"?").join(",")})`),t.push(...i)}return e?.withRecordedPid===!0&&n.push("pi_pid IS NOT NULL"),e?.withRecordedPidOrFrozen===!0&&n.push("(pi_pid IS NOT NULL OR frozen_at IS NOT NULL)"),(await(await d()).prepareUncached(`SELECT ${E} FROM node_rows WHERE ${n.join(" AND ")} ORDER BY created`).all(...t)).map(f)}r(an,"listNodes");const rn=`SELECT
|
|
35
36
|
node_id, created, launched_at, last_settled_at, finalized_at,
|
|
36
37
|
outcome_at, last_activity_at, pane, "window", tmux_session
|
|
37
38
|
FROM nodes
|
|
38
|
-
WHERE ${
|
|
39
|
+
WHERE ${N}
|
|
39
40
|
AND status IN ('done', 'canceled', 'dead')
|
|
40
41
|
AND (pane IS NOT NULL OR "window" IS NOT NULL OR tmux_session IS NOT NULL)
|
|
41
|
-
ORDER BY created`;async function
|
|
42
|
+
ORDER BY created`;async function Lt(){return await(await d()).prepare(rn).all()}r(Lt,"listTerminalPlacementResidue");const on=`WITH candidates AS MATERIALIZED (
|
|
42
43
|
SELECT node_id FROM nodes WHERE status IN ('active', 'idle')
|
|
43
44
|
UNION
|
|
44
45
|
SELECT node_id FROM nodes
|
|
@@ -47,28 +48,28 @@ var ce=Object.defineProperty;var r=(e,n)=>ce(e,"name",{value:n,configurable:!0})
|
|
|
47
48
|
SELECT node_id FROM executions
|
|
48
49
|
WHERE state != 'exited' AND state = 'running' AND pid IS NOT NULL
|
|
49
50
|
)
|
|
50
|
-
SELECT ${
|
|
51
|
+
SELECT ${E.split(",").map(e=>`v.${e.trim()}`).join(", ")} FROM candidates c CROSS JOIN node_rows v
|
|
51
52
|
WHERE v.node_id = c.node_id
|
|
52
53
|
AND v.node_id NOT IN (SELECT node_id FROM warm_pool)
|
|
53
54
|
AND v.kind != 'human'
|
|
54
55
|
AND (v.status IN ('active', 'idle') OR (v.status IN ('done', 'canceled', 'dead') AND (v.pi_pid IS NOT NULL OR v.frozen_at IS NOT NULL)))
|
|
55
|
-
ORDER BY v.created`;async function
|
|
56
|
-
WHERE ${
|
|
57
|
-
AND EXISTS (SELECT 1 FROM deliveries d WHERE d.destination_id = v.node_id AND ${
|
|
58
|
-
ORDER BY v.created`).all()).map(f)}r(
|
|
56
|
+
ORDER BY v.created`;async function Tt(){return(await(await d()).prepare(on).all()).map(f)}r(Tt,"listNodesForSupervision");const ae=r(e=>`(${e}.status = 'done' AND ${e}.intent = 'parked' AND ${e}.lifecycle = 'resident' AND ${e}.final_report IS NULL AND ${e}.deleting_at IS NULL)`,"PARKED_RESIDENT_SQL"),sn=r(e=>`(${e}.status IN ('active', 'idle') OR ${ae(e)} OR (${e}.status IN ('done', 'canceled', 'dead') AND ${e}.frozen_at IS NOT NULL AND ${e}.final_report IS NULL))`,"RESUMABLE_NODE_SQL");async function Dt(e){return await(await d()).prepare(`SELECT node_id, cwd FROM nodes WHERE ${sn("nodes")} AND node_id != ?`).all(e)}r(Dt,"resumableNodeCwds");async function At(){return(await(await d()).prepare(`SELECT ${E.split(",").map(n=>`v.${n.trim()}`).join(", ")} FROM node_rows v
|
|
57
|
+
WHERE ${ae("v")}
|
|
58
|
+
AND EXISTS (SELECT 1 FROM deliveries d WHERE d.destination_id = v.node_id AND ${ke("d")}) AND v.kind != 'human' AND v.node_id NOT IN (SELECT node_id FROM warm_pool)
|
|
59
|
+
ORDER BY v.created`).all()).map(f)}r(At,"listParkedResidentsWithWakeMail");async function kt(e,n){await(await d()).prepare("INSERT INTO warm_pool (node_id, recipe_key, created) VALUES (?, ?, ?) ON CONFLICT (node_id) DO UPDATE SET recipe_key = excluded.recipe_key, created = excluded.created").run(e,n,new Date().toISOString())}r(kt,"registerWarmSpare");async function gt(e){return(await(await d()).prepare("DELETE FROM warm_pool WHERE node_id = ?").run(e)).changes>0}r(gt,"unregisterWarmSpare");async function j(e,n){const t=`SELECT w.node_id AS node_id, w.recipe_key AS recipe_key, w.created AS created,
|
|
59
60
|
n.status AS status, n.pi_pid AS pi_pid, n.pi_pid_identity AS pi_pid_identity
|
|
60
|
-
FROM warm_pool w JOIN node_rows n ON n.node_id = w.node_id`+(n===void 0?"":" WHERE w.recipe_key = ?")+" ORDER BY w.created";return(n===void 0?await e.prepareUncached(t).all():await e.prepareUncached(t).all(n)).map(i=>({node_id:i.node_id,recipe_key:i.recipe_key,created:i.created,status:i.status,pi_pid:i.pi_pid??null,pi_pid_identity:i.pi_pid_identity??null}))}r(
|
|
61
|
-
FROM node_rows WHERE ${
|
|
61
|
+
FROM warm_pool w JOIN node_rows n ON n.node_id = w.node_id`+(n===void 0?"":" WHERE w.recipe_key = ?")+" ORDER BY w.created";return(n===void 0?await e.prepareUncached(t).all():await e.prepareUncached(t).all(n)).map(i=>({node_id:i.node_id,recipe_key:i.recipe_key,created:i.created,status:i.status,pi_pid:i.pi_pid??null,pi_pid_identity:i.pi_pid_identity??null}))}r(j,"warmSpareRowsFor");async function vt(){return await j(await d())}r(vt,"listWarmSpares");async function xt(e){return await(await d()).prepare("SELECT 1 FROM warm_pool WHERE node_id = ?").get(e)!==void 0}r(xt,"isWarmSpare");function ie(e){return e.status!=="active"&&e.status!=="idle"?!1:Fe(e.pi_pid,e.pi_pid_identity)==="alive"}r(ie,"spareIsClaimable");async function Ut(e,n,t={}){return await p(async a=>{const i=(await j(a,e)).find(ie);return i===void 0||t.requestKey!==void 0&&(await a.prepareUncached("UPDATE create_requests SET node_id = ?, state = 'warm_claimed' WHERE request_key = ? AND node_id IS NULL").run(i.node_id,t.requestKey)).changes===0||(await a.prepare("DELETE FROM warm_pool WHERE node_id = ?").run(i.node_id)).changes===0?null:(await a.prepare("UPDATE nodes SET created = ?, deadline_at = ? WHERE node_id = ?").run(n,t.deadlineAt??null,i.node_id),t.outcomeDelivery!==void 0&&await Y(a,i.node_id,t.outcomeDelivery),i.node_id)})}r(Ut,"claimWarmSpare");async function jt(e){return(await j(await d(),e)).filter(ie).length}r(jt,"warmSpareCount");async function bt(e){return(await(await d()).prepare("SELECT node_id FROM nodes WHERE parent = ? ORDER BY created").all(e)).map(n=>n.node_id)}r(bt,"childrenOf");async function Wt(e){return(await(await d()).prepareUncached(`SELECT node_id, name, kind, mode, lifecycle, status, cwd, host_kind, parent, created, description
|
|
62
|
+
FROM node_rows WHERE ${N}${e===void 0?"":" AND node_id = ANY(?::text[])"} ORDER BY created`).all(...e===void 0?[]:[[...e]])).map(n=>({node_id:n.node_id,name:n.name,kind:n.kind,mode:n.mode,lifecycle:n.lifecycle,status:n.status,cwd:n.cwd,host_kind:n.host_kind??null,parent:n.parent??null,created:n.created,description:n.description??null}))}r(Wt,"rosterNodes");async function Ct(e){return(await(await d()).prepareUncached(`SELECT ${E} FROM node_rows
|
|
62
63
|
WHERE parent IS NULL AND kind != 'human'
|
|
63
64
|
AND status IN ('active','idle') AND cwd = ?
|
|
64
|
-
AND ${
|
|
65
|
-
ORDER BY created DESC`).all(e)).map(f)}r(
|
|
66
|
-
AND NOT EXISTS (SELECT 1 FROM sessions s WHERE s.node_id = n.node_id) LIMIT 1`);for(const{id:i,path:o,dir:s}of e){if(await t.get(i)!==void 0||await a.get(i)!==void 0)continue;const
|
|
65
|
+
AND ${N}
|
|
66
|
+
ORDER BY created DESC`).all(e)).map(f)}r(Ct,"listResumableRoots");export*from"./tree.js";async function It(e,n,t){return await p(async a=>{const i=await a.prepare("SELECT status, final_report, frozen_at FROM nodes WHERE node_id = ? FOR UPDATE").get(e);return i===void 0?{kind:"missing"}:n(i)?{kind:"terminal",status:i.status,final_report:i.final_report}:{kind:"ran",result:await t()}})}r(It,"withFreshTerminalGuard");async function T(e){return await je(e)}r(T,"hasUnreconciledManagedWorktree");async function re(e,n={}){return!["done","dead","canceled"].includes(e.status)||e.pi_pid!==null||e.frozen_at!==null||await T(e.node_id)||e.node_id===$()||J(e)?!1:n.pastTtl===!0||!["crashed","stranded",null].includes(e.terminal_reason??null)}r(re,"isCollectible");async function b(e){if(e.length===0)return[];const n=e.map(()=>"?").join(","),t=await(await d()).prepareUncached(`SELECT s.session_id, s.transcript_path, s.node_id, n.grantee FROM sessions s JOIN node_rows n ON n.node_id = s.node_id WHERE s.node_id IN (${n}) AND s.session_id IS NOT NULL ORDER BY s.created_at, s.seq`).all(...e);return[...new Map(t.map(a=>[a.session_id,{id:a.session_id,path:a.transcript_path,dir:h(D(a.grantee).conversations,a.node_id)}])).values()]}r(b,"nodeConversationIds");async function W(e){const n=await d(),t=n.prepare("SELECT 1 FROM sessions WHERE session_id = ? LIMIT 1"),a=n.prepare(`SELECT 1 FROM nodes n WHERE n.fork_source_file LIKE '%\\_' || ? || '.jsonl' ESCAPE '\\'
|
|
67
|
+
AND NOT EXISTS (SELECT 1 FROM sessions s WHERE s.node_id = n.node_id) LIMIT 1`);for(const{id:i,path:o,dir:s}of e){if(await t.get(i)!==void 0||await a.get(i)!==void 0)continue;const u=o!==null&&Ee(o,{throwIfNoEntry:!1})!==void 0&&dn(s,o)?o:void 0;try{await Te().delete(i,u)}catch(l){if(!(l instanceof De))throw l}}}r(W,"deleteNodeConversations");function dn(e,n){try{const t=Se(P(e),h(P(q(n)),Ne(n)));return t!==""&&t!==".."&&!t.startsWith(`..${Oe}`)&&!Re(t)}catch(t){if(t.code==="ENOENT")return!1;throw t}}r(dn,"isBeneath");async function C(e,n){const t=await A(e,n);return t===null||t.deleted_at!==null?!1:(await Xe(e,t),!0)}r(C,"deleteNodeObject");async function I(e){return{nodeId:e,app:await L(e)===null?null:await qe(e)}}r(I,"nodeFiles");async function oe({nodeId:e,app:n}){n!==null&&z(D(n).nodes,await Be(e,n)),z(q(V(e)),V(e))}r(oe,"removeNodeAppTrees");function se({nodeId:e}){return[Pe(e)]}r(se,"nodeOwnedDirs");function de({nodeId:e,app:n}){if(n!==null)try{we(h(D(n).conversations,e))}catch(t){if(!["ENOENT","ENOTEMPTY"].includes(t.code??""))throw t}}r(de,"removeNodeConversationDir");async function F(e){await oe(e);for(const n of se(e))ye(n,{recursive:!0,force:!0});de(e)}r(F,"removeNodeFiles");async function le(e){const n=await B(e);if(n.length>0)throw new Error(`the sandbox of node(s) ${n.join(", ")} could not be deleted; the node rows are kept`)}r(le,"requireSandboxesDeleted");async function Ft(e){if(await T(e))return{deleted:!1};await le([e]);const n=await I(e),t=await b([e]),a=await p(async i=>(await C(i,e),{deleted:!0}));return await W(t),await F(n),a}r(Ft,"deleteNode");async function Ht(e){const n=[...new Set(e)];if(n.length===0)return[];const t=await m(n,T);if(t.length>0)throw new Error(`refusing to delete nodes with unreconciled managed worktrees: ${t.join(", ")}`);await le(n);const a=await O(n,I),i=await b(n),o=n.map(()=>"?").join(","),s=(await(await d()).prepareUncached(`SELECT node_id FROM nodes WHERE node_id IN (${o}) ORDER BY created`).all(...n)).map(({node_id:l})=>l),u=await m(s,async l=>await p(async _=>await C(_,l)));await W(i);for(const l of u){const _=a[n.indexOf(l)];await M(_,async()=>await F(_))}return u}r(Ht,"deleteNodes");async function Mt(e){const n=e.dryRun??!1,t=e.includeStale??!1,a=Date.now()-e.ttlDays*864e5,i=new Date(a).toISOString(),o=$()??"",s=await d(),u=r(c=>ce(c)<a,"quiet"),l=r(c=>({node_id:c.node_id,status:c.status,created:c.created}),"toPruned"),_=await ln(),y=(await m((await s.prepare(`SELECT ${E} FROM node_rows
|
|
67
68
|
WHERE status IN ('dead', 'done', 'canceled') AND created < ?
|
|
68
|
-
ORDER BY created`).all(i)).map(f),async c=>await
|
|
69
|
+
ORDER BY created`).all(i)).map(f),async c=>await re(c,{pastTtl:!0})&&u(c)&&!_.has(c.node_id)&&!await e.held(c.node_id))).map(l),R=t?(await m((await s.prepare(`SELECT ${E} FROM node_rows
|
|
69
70
|
WHERE status IN ('active', 'idle') AND created < ?
|
|
70
|
-
ORDER BY created`).all(i)).map(f),async c=>c.node_id!==o&&!Ie(c.pi_pid??null)&&(c.frozen_at??null)===null&&(c.respawn_not_before??null)===null&&c.intent!=="idle-release"&&!
|
|
71
|
+
ORDER BY created`).all(i)).map(f),async c=>c.node_id!==o&&!Ie(c.pi_pid??null)&&(c.frozen_at??null)===null&&(c.respawn_not_before??null)===null&&c.intent!=="idle-release"&&!J(c)&&!await Ae(c.node_id)&&!await T(c.node_id)&&u(c)&&!await e.held(c.node_id))).map(l):[],S=await H([...y,...R]);return n||S.length===0?{pruned:S,dryRun:n}:{pruned:await ue(S,e.removeDirs),dryRun:n}}r(Mt,"pruneNodes");async function ln(){const e=await(await d()).prepare(`SELECT DISTINCT d.owner AS owner FROM watches w
|
|
71
72
|
JOIN objects d ON d.id = w.object AND d.type = 'document' AND d.deleted_at IS NULL
|
|
72
73
|
JOIN objects o ON o.id = w.watcher AND o.deleted_at IS NULL
|
|
73
74
|
LEFT JOIN nodes n ON n.node_id = w.watcher
|
|
74
|
-
WHERE w.watcher != d.owner AND d.owner IS NOT NULL AND (n.node_id IS NULL OR n.status IN ('active', 'idle'))`).all();return new Set(e.map(n=>n.owner))}r(
|
|
75
|
+
WHERE w.watcher != d.owner AND d.owner IS NOT NULL AND (n.node_id IS NULL OR n.status IN ('active', 'idle'))`).all();return new Set(e.map(n=>n.owner))}r(ln,"ownersOfWatchedDocuments");async function H(e){const t=(await d()).prepare("SELECT node_id FROM nodes WHERE run_id = ? AND node_id != ?"),a=new Set(e.map(i=>i.node_id));return await m(e,async i=>(await t.all(i.node_id,i.node_id)).every(o=>a.has(o.node_id)))}r(H,"retainRunRootsWithMembers");async function ue(e,n){const t=new Set(await B(e.map(s=>s.node_id))),a=t.size===0?e:await H(e.filter(s=>!t.has(s.node_id)));if(a.length===0)return[];const i=await O(a,async s=>await I(s.node_id)),o=await b(a.map(s=>s.node_id));for(const s of a)await p(async u=>await C(u,s.node_id));if(await W(o),n!==void 0){for(const s of i)await M(s,async()=>{await oe(s),de(s)});return n(i.flatMap(se)),a}for(const s of i)await M(s,async()=>await F(s));return a}r(ue,"deletePrunedNodes");async function M(e,n){try{await n()}catch(t){Le({level:"error",event:"canvas.node_files.remove_failed",error:t,fields:{node_id:e.nodeId}})}}r(M,"eachNodeBestEffort");function ce(e){let n=0;for(const t of[e.created,e.launched_at,e.last_settled_at,e.finalized_at,e.outcome_at,e.last_activity_at]){if(t==null)continue;const a=Date.parse(t);Number.isFinite(a)&&a>n&&(n=a)}try{const t=me(h($e(e.node_id),"telemetry.json"),{throwIfNoEntry:!1});t!==void 0&&t.mtimeMs>n&&(n=t.mtimeMs)}catch{}return n}r(ce,"lastActivityMs");async function $t(e){const n=e.dryRun??!1,t=await an(),a=await m(t,async l=>await re(l)&&!await e.held(l.node_id)),i=t.length-a.length,o=Math.max(0,e.maxNodes-i),s=a.map(l=>({row:l,recency:ce(l)})).sort((l,_)=>_.recency-l.recency).slice(o).map(({row:l})=>({node_id:l.node_id,status:l.status,created:l.created})),u=await H(s);return n||u.length===0?{pruned:u,dryRun:n}:{pruned:await ue(u),dryRun:n}}r($t,"pruneToLimit");export{v as CREATE_LEASE_MS,Vn as CREATE_LEASE_RENEW_MS,ae as PARKED_RESIDENT_SQL,sn as RESUMABLE_NODE_SQL,et as abandonCreateRequest,$n as assertRunNotDeleting,St as browseNodes,nt as canonicalSessionFile,bt as childrenOf,Kn as claimCreateLease,Ut as claimWarmSpare,pt as clearFinalReportIfMatches,mt as clearFrozen,Zn as completeCreateRequest,Xn as createLeaseLive,Pn as createNode,Ft as deleteNode,Ht as deleteNodes,rt as dueNodeDeadlines,zn as findCreateRequest,tt as findNodeBySessionFile,_t as getFinalReport,L as getNode,qn as getNodes,at as getRow,it as getRowByPane,Ot as graphNodes,re as isCollectible,xt as isWarmSpare,ce as lastActivityMs,an as listNodes,Rt as listNodesByProfile,Tt as listNodesForSupervision,At as listParkedResidentsWithWakeMail,Ct as listResumableRoots,Lt as listTerminalPlacementResidue,vt as listWarmSpares,I as nodeFiles,on as nodesForSupervisionSql,Jn as pruneExpiredCreateRequests,Mt as pruneNodes,$t as pruneToLimit,Yn as recordCreateRequestNode,Et as recordLaunch,Nt as recordRespawnAttempt,wt as recordSettledTurn,kt as registerWarmSpare,F as removeNodeFiles,Gn as renewCreateLease,Bn as reserveCreateRequest,Qn as reserveCreateRequestNode,Dt as resumableNodeCwds,Wt as rosterNodes,yt as setFrozen,ut as setIntent,ot as setNodeDeadline,ft as setPresence,lt as setStatus,st as shiftProfileNodeDeadlines,rn as terminalPlacementResidueSql,ct as transitionStatusIntent,gt as unregisterWarmSpare,dt as updateNode,ht as updateNodeTelemetry,jt as warmSpareCount,It as withFreshTerminalGuard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var $=Object.defineProperty;var p=(s,i)=>$(s,"name",{value:i,configurable:!0});function h(s=process.env){const i=p(a=>{const u=s[a];if(!u)throw new Error(`${a} is required for the Blaxel runner`);return u},"need");return{apiKey:i("BLAXEL_API_KEY"),workspace:i("BLAXEL_WORKSPACE"),region:i("BLAXEL_REGION")}}p(h,"blaxelConfigFromEnv");class m extends Error{static{p(this,"BlaxelApiError")}status;code;constructor(i,a,u){super(u),this.status=i,this.code=a,this.name="BlaxelApiError"}}const A=p(s=>s instanceof m&&s.status===404&&s.code==="WORKLOAD_UNAVAILABLE","isWorkloadUnavailable");function x(s){const i=s.metadata.url;if(!i)throw new Error(`Blaxel sandbox ${s.metadata.name} has no url`);return{name:s.metadata.name,url:i,state:s.state??null,status:s.status??null,image:s.spec?.runtime?.image??null}}p(x,"toInfo");function y(s,i){const a=s??{},u=typeof a.error=="object"&&a.error!==null?a.error:{},c=typeof u.code=="string"?u.code:typeof a.code=="string"?a.code:null,l=[u.message,a.message,a.error].find(e=>typeof e=="string")??i.slice(0,300);return{code:c,message:l}}p(y,"errorFields");function T(s){const i=s.fetch??fetch,a=s.controlUrl??"https://api.blaxel.ai/v0",u=p(()=>({authorization:`Bearer ${s.apiKey}`,"x-blaxel-workspace":s.workspace,"content-type":"application/json"}),"headers");async function c(e,t,o,r=[]){const n=await i(e,{method:t,headers:u(),...o===void 0?{}:{body:JSON.stringify(o)}}),f=await n.text();let d=null;if(f!=="")try{d=JSON.parse(f)}catch{d={raw:f}}if(!n.ok){const{code:w,message:E}=y(d,f);if(n.status===404&&w==="WORKLOAD_UNAVAILABLE"||!r.includes(n.status))throw new m(n.status,w,`Blaxel ${t} ${e} failed (${n.status}): ${E}`)}return{status:n.status,json:d}}p(c,"call");const l=encodeURIComponent;return{config:s,async createSandbox(e){const t=[...e.ports??[]].map(n=>({name:n.name,target:n.target,protocol:"HTTP"})),o={metadata:{name:e.name},spec:{runtime:{image:e.image,memory:e.memoryMb,...t.length>0?{ports:t}:{}},region:s.region,lifecycle:{expirationPolicies:[{type:"ttl-idle",value:"
|
|
1
|
+
var $=Object.defineProperty;var p=(s,i)=>$(s,"name",{value:i,configurable:!0});function h(s=process.env){const i=p(a=>{const u=s[a];if(!u)throw new Error(`${a} is required for the Blaxel runner`);return u},"need");return{apiKey:i("BLAXEL_API_KEY"),workspace:i("BLAXEL_WORKSPACE"),region:i("BLAXEL_REGION")}}p(h,"blaxelConfigFromEnv");class m extends Error{static{p(this,"BlaxelApiError")}status;code;constructor(i,a,u){super(u),this.status=i,this.code=a,this.name="BlaxelApiError"}}const A=p(s=>s instanceof m&&s.status===404&&s.code==="WORKLOAD_UNAVAILABLE","isWorkloadUnavailable");function x(s){const i=s.metadata.url;if(!i)throw new Error(`Blaxel sandbox ${s.metadata.name} has no url`);return{name:s.metadata.name,url:i,state:s.state??null,status:s.status??null,image:s.spec?.runtime?.image??null}}p(x,"toInfo");function y(s,i){const a=s??{},u=typeof a.error=="object"&&a.error!==null?a.error:{},c=typeof u.code=="string"?u.code:typeof a.code=="string"?a.code:null,l=[u.message,a.message,a.error].find(e=>typeof e=="string")??i.slice(0,300);return{code:c,message:l}}p(y,"errorFields");function T(s){const i=s.fetch??fetch,a=s.controlUrl??"https://api.blaxel.ai/v0",u=p(()=>({authorization:`Bearer ${s.apiKey}`,"x-blaxel-workspace":s.workspace,"content-type":"application/json"}),"headers");async function c(e,t,o,r=[]){const n=await i(e,{method:t,headers:u(),...o===void 0?{}:{body:JSON.stringify(o)}}),f=await n.text();let d=null;if(f!=="")try{d=JSON.parse(f)}catch{d={raw:f}}if(!n.ok){const{code:w,message:E}=y(d,f);if(n.status===404&&w==="WORKLOAD_UNAVAILABLE"||!r.includes(n.status))throw new m(n.status,w,`Blaxel ${t} ${e} failed (${n.status}): ${E}`)}return{status:n.status,json:d}}p(c,"call");const l=encodeURIComponent;return{config:s,async createSandbox(e){const t=[...e.ports??[]].map(n=>({name:n.name,target:n.target,protocol:"HTTP"})),o={metadata:{name:e.name},spec:{runtime:{image:e.image,memory:e.memoryMb,...t.length>0?{ports:t}:{}},region:s.region,lifecycle:{expirationPolicies:[{type:"ttl-idle",value:"1d",action:"delete"}]}}},r=Date.now()+(s.deletingWaitMs??6e4);for(;;){const{status:n,json:f}=await c(`${a}/sandboxes`,"POST",o,[409]);if(n!==409)return{...x(f),created:!0};const d=await this.getSandbox(e.name);if(d!==null)return{...d,created:!1};if(Date.now()>=r)throw new Error(`Blaxel sandbox ${e.name} is still being deleted; its name did not free in time`);await new Promise(w=>setTimeout(w,1e3))}},async getSandbox(e){const{status:t,json:o}=await c(`${a}/sandboxes/${l(e)}`,"GET",void 0,[404]);if(t===404)return null;const r=o;return r.status==="DELETING"||r.status==="TERMINATED"?null:x(r)},async deleteSandbox(e){await c(`${a}/sandboxes/${l(e)}`,"DELETE",void 0,[404])},async startProcess(e,t){const{json:o}=await c(`${e.url}/process`,"POST",t);return o},async getProcess(e,t){const{status:o,json:r}=await c(`${e.url}/process/${l(t)}`,"GET",void 0,[404]);return o===404?null:r},async stopProcess(e,t){await c(`${e.url}/process/${l(t)}`,"DELETE",void 0,[404])},async killProcess(e,t){await c(`${e.url}/process/${l(t)}/kill`,"DELETE",void 0,[404])},async exec(e,t,o,r,n){return await this.startProcess(e,{name:t,command:o,waitForCompletion:!0,timeout:r,...n?{env:n}:{}})},async putFile(e,t,o,r="0644"){await c(`${e.url}/filesystem/${t.replace(/^\/+/,"").split("/").map(l).join("/")}`,"PUT",{content:o,permissions:r})},async ensurePreview(e,t,o){const{json:r}=await c(`${a}/sandboxes/${l(e)}/previews`,"POST",{metadata:{name:t},spec:{port:o,public:!1}},[409]),n=r?.spec?.url;if(n)return n;const d=(await c(`${a}/sandboxes/${l(e)}/previews`,"GET")).json.find(w=>w.metadata.name===t);if(!d)throw new Error(`Blaxel preview ${t} of ${e} not found`);return d.spec.url},async createPreviewToken(e,t,o){const{json:r}=await c(`${a}/sandboxes/${l(e)}/previews/${l(t)}/tokens`,"POST",{spec:{expiresAt:o.toISOString()}}),n=r.spec;return{token:n.token,expiresAt:n.expiresAt}},async deletePreview(e,t){await c(`${a}/sandboxes/${l(e)}/previews/${l(t)}`,"DELETE",void 0,[404])}}}p(T,"createBlaxelClient");export{m as BlaxelApiError,h as blaxelConfigFromEnv,T as createBlaxelClient,A as isWorkloadUnavailable};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type FileRow } from './tables.js';
|
|
2
1
|
export interface ShareView {
|
|
3
2
|
share_id: string;
|
|
4
3
|
url: string;
|
|
@@ -8,9 +7,18 @@ export interface ShareView {
|
|
|
8
7
|
expires_at: string | null;
|
|
9
8
|
status: 'on' | 'off';
|
|
10
9
|
}
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/** A stored object a share copies: a handed-over file (`file_id`) or an app's own upload (`upload_id`); its bytes are the storage upload with the same id. */
|
|
11
|
+
export interface ShareSource {
|
|
12
|
+
kind: 'file' | 'upload';
|
|
13
|
+
id: string;
|
|
14
|
+
grantee: string;
|
|
15
|
+
name: string;
|
|
16
|
+
media_type: string;
|
|
17
|
+
size: number;
|
|
18
|
+
}
|
|
19
|
+
/** `share.create {file_id | upload_id}` for a handed-over file or an app's own upload: copy the stored object into a new share object, streaming it through this server without touching
|
|
20
|
+
* its disk. The caller has already checked the source is its own and complete. The row is inserted only once storage holds the bytes. */
|
|
21
|
+
export declare function createShareFromSource(file: ShareSource, person: string | undefined, input: {
|
|
14
22
|
expires_at?: unknown;
|
|
15
23
|
}): Promise<{
|
|
16
24
|
share_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var s=(e,t)=>h(e,"name",{value:t,configurable:!0});import{Readable as
|
|
1
|
+
var h=Object.defineProperty;var s=(e,t)=>h(e,"name",{value:t,configurable:!0});import{Readable as p}from"node:stream";import{RunError as o}from"../runs/operations.js";import{storageClient as c,StorageRefused as f}from"./client.js";import{getShare as l,insertShare as m,listShares as w,markShareObjectDeleted as S,turnShareOff as b}from"./tables.js";const _=s(e=>new o(503,"storage_unavailable",e,void 0,void 0,void 0,!0),"unavailable");async function y(e,t,i,n){let a;try{a=await fetch(e,{method:"PUT",signal:AbortSignal.timeout(11e4),headers:{"Content-Type":n,"Content-Length":String(i)},body:p.toWeb(t),duplex:"half"})}catch(r){throw _(`storage could not be reached: ${r instanceof Error?r.message:String(r)}`)}finally{t.destroy()}if(await a.body?.cancel().catch(()=>{}),!a.ok)throw _(`storage answered ${a.status} to the share upload`)}s(y,"putStream");const g=s(e=>{if(e==null)return;const t=typeof e=="string"?Date.parse(e):NaN;if(!Number.isFinite(t))throw new o(400,"invalid_request","expires_at must be an ISO 8601 time","expires_at");if(t<=Date.now())throw new o(400,"invalid_request","expires_at must be in the future","expires_at");return new Date(t).toISOString()},"parseExpiry");async function z(e,t,i){const n=g(i.expires_at),a=c(),r=await a.createShare({name:e.name,media_type:e.media_type,size:e.size,...n?{expires_at:n}:{}});try{const d=await a.fetchUpload(e.id,AbortSignal.timeout(11e4));await y(r.upload_link,d.body,e.size,e.media_type)}catch(d){throw await a.deleteShare(r.share_id).catch(()=>{}),d instanceof f?new o(404,"not_found","file not found"):d}const u=r.expires_at??n??null;return await m({share_id:r.share_id,source_space:`${e.kind}:${e.id}`,source_path:e.name,storage_key:`${a.runtimeId}/shares/${r.share_id}/${e.name}`,url:r.url,created_by:e.grantee,...t===void 0?{}:{sub:t},created_at:new Date().toISOString(),expires_at:u}),{share_id:r.share_id,url:r.url,expires_at:u}}s(z,"createShareFromSource");function x(e){return{share_id:e.share_id,url:e.url,source_path:e.source_path,created_by:e.created_by,created_at:e.created_at,expires_at:e.expires_at,status:e.status}}s(x,"view");async function A(e,t){return{shares:(await w(e)).filter(i=>t===void 0||i.sub===t).map(x)}}s(A,"listOwnShares");async function C(e,t,i){const n=await l(t);if(!n||n.created_by!==e||i!==void 0&&n.sub!==i)throw new o(404,"not_found","share not found");if(await b(t),!n.object_deleted_at)try{await c().deleteShare(t),await S(t)}catch(a){if(!(a instanceof o&&a.code==="storage_unavailable"))throw a}return{share_id:t,status:"off"}}s(C,"deleteOwnShare");export{z as createShareFromSource,C as deleteOwnShare,A as listOwnShares};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var q=Object.defineProperty;var d=(n,e)=>q(n,"name",{value:e,configurable:!0});import{isAbsolute as z,resolve as k}from"node:path";import{RunError as o,cloudPersonScope as _}from"../../../core/runs/operations.js";import{invalidStorageName as S,storageClient as c,StorageRefused as l,UPLOAD_MAX_BYTES as v}from"../../../core/storage/client.js";import{createShareFromSource as m,deleteOwnShare as A,listOwnShares as x}from"../../../core/storage/shares.js";import{getFile as O,getUpload as h,insertUpload as E,uploadUseAt as I}from"../../../core/storage/tables.js";import{requireRun as y}from"../router.js";const B=new Set(["upload.create","attachment.link","file.link","share.create","share.list","share.delete"]);function g(n){if(!n||typeof n!="object"||Array.isArray(n))throw new o(400,"invalid_request","a JSON object is required");return n}d(g,"object");const R=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}(?:\s*;.{0,200})?$/;async function T(n,e){const a=g(e);for(const u of Object.keys(a))if(!["name","media_type","size"].includes(u))throw new o(400,"invalid_request",`unknown field ${u}`,u);const{name:t,media_type:r,size:i}=a;if(typeof i!="number"||!Number.isSafeInteger(i)||i<0)throw new o(400,"invalid_request","size must be a non-negative integer","size");if(i>v)throw new o(400,"invalid_request","size exceeds 100 MiB","size");if(typeof t!="string")throw new o(400,"invalid_request","name is required","name");const p=S(t);if(p)throw new o(400,"invalid_request",p,"name");if(typeof r!="string"||!R.test(r))throw new o(400,"invalid_request","media_type must be a media type","media_type");const s=await c().createUpload({name:t,media_type:r,size:i}),w=_(n.sub);return await E({upload_id:s.upload_id,grantee:n.grantee,...w===void 0?{}:{sub:w},name:t,media_type:r,size:i,created_at:new Date().toISOString()}),{upload_id:s.upload_id,url:s.url,upload_link:s.upload_link,expires_at:s.expires_at}}d(T,"uploadCreate");async function U(n,e){if(!e)throw new o(400,"invalid_request","path is required","path");if(!z(e))throw new o(400,"invalid_request","path must be absolute","path");const a=await I(k(e)),t=d(()=>new o(404,"not_found","no upload is recorded at that path"),"missing");if(!a)throw t();try{await y(n,a.run_id)}catch(i){throw i instanceof o&&i.code==="not_found"?t():i}const r=await h(a.upload_id);if(!r||r.delete_pending_since)throw t();try{return await c().signDownload(a.upload_id)}catch(i){throw i instanceof l?t():i}}d(U,"attachmentLink");async function b(n,e){const a=d(()=>new o(404,"not_found","file not found"),"missing"),t=_(n.sub),r=await O(e);if(!r||r.grantee!==n.grantee||t!==void 0&&r.sub!==t||!r.completed_at)throw a();try{await y(n,r.run_id)}catch(i){throw i instanceof o&&i.code==="not_found"?a():i}return r}d(b,"ownFile");async function j(n,e){const a=_(n.sub),t=await h(e);if(!t||t.delete_pending_since||t.grantee!==n.grantee||a!==void 0&&t.sub!==a)throw new o(404,"not_found","upload not found");return t}d(j,"ownUpload");async function D(n,e){const a=await b(n,e);try{return{...await c().signDownload(a.file_id),name:a.name,media_type:a.media_type,size:a.size}}catch(t){throw t instanceof l?new o(404,"not_found","file not found"):t}}d(D,"fileLink");async function C(n,e,a,t,r){switch(n.name){case"upload.create":return{status:201,body:await T(e,r)};case"attachment.link":return{status:200,body:await U(e,t.get("path"))};case"file.link":return{status:200,body:await D(e,a.file_id)};case"share.create":{const i=g(r);for(const f of Object.keys(i))if(!["file_id","upload_id","expires_at"].includes(f))throw new o(400,"invalid_request",`unknown field ${f}`,f);const{file_id:p,upload_id:s}=i;if(p===void 0==(s===void 0))throw new o(400,"invalid_request","exactly one of file_id or upload_id is required");const w=_(e.sub);if(p!==void 0){if(typeof p!="string"||!p)throw new o(400,"invalid_request","file_id must be a non-empty string","file_id");const f=await b(e,p);return{status:201,body:await m({kind:"file",id:f.file_id,grantee:f.grantee,name:f.name,media_type:f.media_type,size:f.size},w,{expires_at:i.expires_at})}}if(typeof s!="string"||!s)throw new o(400,"invalid_request","upload_id must be a non-empty string","upload_id");const u=await j(e,s);return{status:201,body:await m({kind:"upload",id:u.upload_id,grantee:u.grantee,name:u.name,media_type:u.media_type,size:u.size},w,{expires_at:i.expires_at})}}case"share.list":return{status:200,body:await x(e.grantee,_(e.sub))};case"share.delete":return{status:200,body:await A(e.grantee,a.share_id,_(e.sub))};default:throw new o(404,"not_found","unknown operation")}}d(C,"handleTransferOperation");export{B as TRANSFER_OPERATIONS,C as handleTransferOperation};
|
|
@@ -7,6 +7,12 @@ 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.788
|
|
11
|
+
|
|
12
|
+
### `shares.create({ upload_id })` shares an upload your app made
|
|
13
|
+
|
|
14
|
+
`shares.create` takes exactly one of `file_id` or `upload_id`. `upload_id` is the id `uploads.create` returned, after you PUT the bytes. The share is a copy at a public URL; the upload itself stays private to your app. Another app's, another person's or an unknown upload id is `404 not_found`; both or neither id is `400 invalid_request`.
|
|
15
|
+
|
|
10
16
|
## 0.3.783
|
|
11
17
|
|
|
12
18
|
### Every limit refusal carries `details.payment`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.788",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -157,8 +157,8 @@
|
|
|
157
157
|
},
|
|
158
158
|
"license": "UNLICENSED",
|
|
159
159
|
"dependencies": {
|
|
160
|
-
"@north-light/identity": "0.3.
|
|
161
|
-
"@north-light/plugin": "0.3.
|
|
160
|
+
"@north-light/identity": "0.3.788",
|
|
161
|
+
"@north-light/plugin": "0.3.788",
|
|
162
162
|
"@earendil-works/chord": "1.5.2",
|
|
163
163
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
164
164
|
"@earendil-works/pi-ai": "1.5.2",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//
|
|
13
13
|
// PURITY (spec §3.1): Node built-ins + `src/api/*` only.
|
|
14
14
|
/** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
|
|
15
|
-
export const CONTRACT_LEVEL = '1.
|
|
15
|
+
export const CONTRACT_LEVEL = '1.88';
|
|
16
16
|
/** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
|
|
17
17
|
export const REQUIRED_CONTRACT_HEADER = 'Crouter-Required-Contract';
|
|
18
18
|
/** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.788",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.788",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"postpack": "node ../../scripts/pack-minify.mjs postpack packages/crouter-plugin"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@north-light/api": "0.3.
|
|
31
|
-
"@north-light/identity": "0.3.
|
|
30
|
+
"@north-light/api": "0.3.788",
|
|
31
|
+
"@north-light/identity": "0.3.788"
|
|
32
32
|
},
|
|
33
33
|
"license": "UNLICENSED",
|
|
34
34
|
"publishConfig": {
|
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.788",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/cli",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.788",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"workspaces": [
|
|
@@ -28,8 +28,8 @@
|
|
|
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.
|
|
32
|
-
"@north-light/plugin": "0.3.
|
|
31
|
+
"@north-light/identity": "0.3.788",
|
|
32
|
+
"@north-light/plugin": "0.3.788",
|
|
33
33
|
"cron-parser": "^5.6.0",
|
|
34
34
|
"esbuild": "0.28.2",
|
|
35
35
|
"jose": "^6.2.12",
|
|
@@ -11902,17 +11902,17 @@
|
|
|
11902
11902
|
},
|
|
11903
11903
|
"packages/crouter-api": {
|
|
11904
11904
|
"name": "@north-light/api",
|
|
11905
|
-
"version": "0.3.
|
|
11905
|
+
"version": "0.3.788",
|
|
11906
11906
|
"license": "UNLICENSED"
|
|
11907
11907
|
},
|
|
11908
11908
|
"packages/crouter-env-docker": {
|
|
11909
11909
|
"name": "@north-light/env-docker",
|
|
11910
|
-
"version": "0.3.
|
|
11910
|
+
"version": "0.3.788",
|
|
11911
11911
|
"license": "UNLICENSED"
|
|
11912
11912
|
},
|
|
11913
11913
|
"packages/crouter-identity": {
|
|
11914
11914
|
"name": "@north-light/identity",
|
|
11915
|
-
"version": "0.3.
|
|
11915
|
+
"version": "0.3.788",
|
|
11916
11916
|
"license": "UNLICENSED",
|
|
11917
11917
|
"dependencies": {
|
|
11918
11918
|
"jose": "^6.2.1"
|
|
@@ -11920,21 +11920,21 @@
|
|
|
11920
11920
|
},
|
|
11921
11921
|
"packages/crouter-plugin": {
|
|
11922
11922
|
"name": "@north-light/plugin",
|
|
11923
|
-
"version": "0.3.
|
|
11923
|
+
"version": "0.3.788",
|
|
11924
11924
|
"license": "UNLICENSED",
|
|
11925
11925
|
"dependencies": {
|
|
11926
|
-
"@north-light/api": "0.3.
|
|
11927
|
-
"@north-light/identity": "0.3.
|
|
11926
|
+
"@north-light/api": "0.3.788",
|
|
11927
|
+
"@north-light/identity": "0.3.788"
|
|
11928
11928
|
}
|
|
11929
11929
|
},
|
|
11930
11930
|
"packages/crouter-sdk": {
|
|
11931
11931
|
"name": "@north-light/sdk",
|
|
11932
|
-
"version": "0.3.
|
|
11932
|
+
"version": "0.3.788",
|
|
11933
11933
|
"license": "UNLICENSED",
|
|
11934
11934
|
"dependencies": {
|
|
11935
|
-
"@north-light/api": "0.3.
|
|
11936
|
-
"@north-light/identity": "0.3.
|
|
11937
|
-
"@north-light/plugin": "0.3.
|
|
11935
|
+
"@north-light/api": "0.3.788",
|
|
11936
|
+
"@north-light/identity": "0.3.788",
|
|
11937
|
+
"@north-light/plugin": "0.3.788",
|
|
11938
11938
|
"jose": "^6.2.1"
|
|
11939
11939
|
},
|
|
11940
11940
|
"bin": {
|