@north-light/cli 0.3.658 → 0.3.660

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.
Files changed (48) hide show
  1. package/dist/api/client.d.ts +3 -0
  2. package/dist/api/client.js +1 -1
  3. package/dist/api/contract.d.ts +1 -1
  4. package/dist/api/contract.js +1 -1
  5. package/dist/api/dto/files.d.ts +20 -0
  6. package/dist/api/dto/run-events.d.ts +9 -1
  7. package/dist/api/routes.d.ts +2 -0
  8. package/dist/api/routes.js +1 -1
  9. package/dist/builtin-memory/northlight-apps/guides/files-and-documents.md +12 -6
  10. package/dist/clients/attach/viewer.js +1 -1
  11. package/dist/commands/push.js +6 -4
  12. package/dist/core/canvas/export-sqlite.js +1 -1
  13. package/dist/core/canvas/migrations.js +1 -1
  14. package/dist/core/canvas/person.js +3 -3
  15. package/dist/core/canvas/schema-pg/018-transfer-person.sql +8 -0
  16. package/dist/core/canvas/schema-pg/019-outbound-files.sql +26 -0
  17. package/dist/core/canvas/schema-version.d.ts +1 -1
  18. package/dist/core/canvas/schema-version.js +1 -1
  19. package/dist/core/grants/remove.js +1 -1
  20. package/dist/core/import/bundle/layout.d.ts +1 -1
  21. package/dist/core/import/bundle/layout.js +3 -3
  22. package/dist/core/import/load/bind.js +8 -8
  23. package/dist/core/providers/files.js +1 -1
  24. package/dist/core/runs/operations.d.ts +1 -1
  25. package/dist/core/runs/operations.js +7 -7
  26. package/dist/core/storage/attachments.d.ts +3 -3
  27. package/dist/core/storage/attachments.js +1 -1
  28. package/dist/core/storage/client.d.ts +3 -1
  29. package/dist/core/storage/client.js +2 -2
  30. package/dist/core/storage/download.d.ts +0 -1
  31. package/dist/core/storage/download.js +1 -1
  32. package/dist/core/storage/media-types.d.ts +1 -0
  33. package/dist/core/storage/media-types.js +1 -0
  34. package/dist/core/storage/shares.d.ts +15 -6
  35. package/dist/core/storage/shares.js +1 -1
  36. package/dist/core/storage/tables.d.ts +36 -2
  37. package/dist/core/storage/tables.js +4 -3
  38. package/dist/daemon/api/handlers/node-files.d.ts +2 -0
  39. package/dist/daemon/api/handlers/node-files.js +1 -0
  40. package/dist/daemon/api/handlers/transfer.d.ts +2 -2
  41. package/dist/daemon/api/handlers/transfer.js +1 -1
  42. package/dist/daemon/api/operations.js +1 -1
  43. package/dist/daemon/api/server.js +1 -1
  44. package/dist/daemon/reconcilers/ledger-storage.js +3 -3
  45. package/docs/apps/guides/files-and-documents.md +11 -6
  46. package/package.json +2 -2
  47. package/packages/crouter-identity/package.json +1 -1
  48. package/runtime.lock.json +13 -13
@@ -1 +1 @@
1
- var ze=Object.defineProperty;var o=(e,r)=>ze(e,"name",{value:r,configurable:!0});import{IMPORT_TOKEN_PREFIX as He,importPrincipalFor as Le}from"./import-auth.js";import{createServer as ie}from"node:http";import{createServer as Be}from"node:https";import{chmodSync as xe,existsSync as G,readFileSync as se,unlinkSync as ae}from"node:fs";import{MINIMUM_RUNTIME_VERSION_HEADER as le,RUNTIME_VERSION_HEADER as Y,minimumRuntimeRefusal as De}from"../../api/runtime-version.js";import{CONTRACT_HEADER as K,CONTRACT_LEVEL as ce,REQUIRED_CONTRACT_HEADER as ue,contractRefusal as Me}from"../../api/contract.js";import{crtrVersion as X}from"../../shared/crtr-version.js";import{apiSocketPath as Fe}from"../../core/canvas/paths.js";import{resolveNodeToken as $e}from"../../core/canvas/node-tokens.js";import{isCloudRole as H,runAsPerson as J}from"../../core/canvas/person.js";import{isCanvasRequest as Je,serveCanvas as We}from"./canvas-host.js";import{personBearerVerifier as pe}from"./auth/person-bearer.js";import{personHasSnapshot as Z}from"../../core/scoped-state/person-store.js";import{loadPersonSettings as Q}from"../../core/scoped-state/person-rows.js";import{AppPrincipalResolver as je}from"./principal.js";import{createAppRequestHandler as Ve}from"./app-listener.js";import{decodeJwt as Ge}from"jose";import{handleRuntimeSignIn as Ye,isRuntimeSignInPath as Ke}from"./key-signin.js";import{RunError as S}from"../../core/runs/operations.js";import{removeVendorAccount as Xe,vendorStatus as Ze}from"./handlers/vendor-status.js";import{toErrorBody as Qe}from"./map.js";import{CONTROL_BODY_MAX_BYTES as qe}from"../../core/llm/body-limits.js";import{grantFor as er,hasSyncedGrants as rr}from"../../core/grants/mirror.js";import{readConfig as de}from"../../core/config.js";import{directoryIssuer as tr}from"../../core/directory/issuer.js";import{peerUid as nr}from"../../native/linux.js";import{findScopedApiToken as or,getApiToken as ir,listScopedApiTokens as sr}from"../../core/secrets.js";import{emitEvent as A}from"../../core/events/emit.js";import{envCrtrdTcp as ar,envCrtrdToken as lr}from"../../shared/env.js";import{Router as fe,actsAsPerson as me}from"./router.js";import{handleAttachUpgrade as cr,refuseUpgrade as y}from"./bridge.js";import{handleMachineLinkUpgrade as ur,machineLinkEnvironment as pr,setApiAddress as dr}from"../machine-link/holder.js";import{handleMachineViewUpgrade as fr,machineViewEnvironment as mr}from"../machine-link/forward.js";import{boundDaemonControl as gr}from"../control.js";import{attachRoutes as hr,mayAttachNode as ge}from"./handlers/attach.js";import{peerRoutes as Rr}from"../peer/handlers.js";import{bashJobRoutes as Ar}from"./handlers/bash-jobs.js";import{bashRoutes as yr}from"./handlers/bash.js";import{hookExecRoutes as vr}from"./handlers/hook-exec.js";import{brokerOperationRoutes as he}from"./handlers/broker-ops.js";import{brokerSignalRoutes as _r,brokerSignalStreams as wr}from"./handlers/broker-signals.js";import{brokerRecoveryRoutes as Re,nodeFaultRoutes as Er}from"./handlers/broker-recovery.js";import{canvasRoutes as Sr}from"./handlers/canvas.js";import{conversationRoutes as br}from"./handlers/conversations.js";import{chatInventoryRoutes as Tr}from"./handlers/chat-inventory.js";import{daemonRoutes as Cr}from"./handlers/daemon.js";import{fileRoutes as kr}from"./handlers/files.js";import{focusRoutes as Ur}from"./handlers/focus.js";import{analyticsRoutes as Or}from"./handlers/analytics.js";import{memoryReadsRoutes as Pr}from"./handlers/memory-reads.js";import{memoryRoutes as Nr}from"./handlers/memory.js";import{healthRoutes as Ir}from"./handlers/health.js";import{humanRequestRoutes as zr}from"./handlers/human-requests.js";import{inboxRoutes as Hr}from"./handlers/inbox.js";import{feedbackCommentRoutes as Lr}from"./handlers/feedback-comments.js";import{objectRoutes as Br}from"./handlers/objects.js";import{shareRoutes as xr}from"./handlers/shares.js";import{customObjectRoutes as Dr}from"./handlers/custom-objects.js";import{docRoutes as Mr}from"./handlers/docs.js";import{deliveryRoutes as Ae}from"./handlers/delivery.js";import{deliveryRetryRoutes as Fr}from"./handlers/delivery-retry.js";import{packageDocRoutes as $r}from"./handlers/package-docs.js";import{documentAccessRoutes as Jr}from"./handlers/document-access.js";import{pluginAppRoutes as Wr}from"./handlers/plugin-app-token.js";import{brokerMailRoutes as ye,messageRoutes as jr}from"./handlers/messages.js";import{modelAuthRoutes as Vr}from"./handlers/modelauth.js";import{llmRoutes as Gr}from"./handlers/llm.js";import{providerRoutes as Yr}from"./handlers/providers.js";import{modelConfigRoutes as Kr}from"./handlers/model-config.js";import{settingsRoutes as Xr}from"./handlers/settings.js";import{nodeRoutes as Zr}from"./handlers/nodes.js";import{nodeRecordRoutes as Qr}from"./handlers/node-records.js";import{nodeOutcomeRoutes as qr}from"./handlers/node-outcomes.js";import{nodeEventRoutes as et}from"./handlers/node-events.js";import{profileRoutes as rt}from"./handlers/profiles.js";import{prospectiveChatInventoryRoutes as tt}from"./handlers/prospective-chat-inventory.js";import{reportRoutes as nt}from"./handlers/reports.js";import{runRoutes as ot}from"./handlers/run-routes.js";import{reviewCommentRoutes as it}from"./handlers/review-comments.js";import{reviewRoutes as st}from"./handlers/reviews.js";import{subscriptionRoutes as at}from"./handlers/subscriptions.js";import{structuredRequestRoutes as lt}from"./handlers/structured-requests.js";import{cronRoutes as ct}from"./handlers/crons.js";import{setCronRequestHandler as ve}from"../cron/run-socket.js";import{RUN_TOKEN_PREFIX as ut,cronPrincipalForRunToken as pt}from"../cron/run-token.js";import{worktreeRoutes as dt}from"./handlers/worktree.js";import{limitsRoutes as ft}from"./handlers/limits.js";import{chargeRoutes as mt,spendLimitRoutes as gt}from"./handlers/charges.js";import{executionStartRoutes as ht}from"./handlers/execution-start.js";import{machineCredentialRoutes as Rt}from"./handlers/machine-credential.js";import{importRoutes as At}from"./handlers/imports.js";import{gitCredentialRoutes as yt}from"./handlers/git-credential.js";function vt(e){return new fe().registerAll(Ir(e)).registerAll(Cr).registerAll(xr).registerAll(Zr).registerAll(Qr).registerAll(qr).registerAll(Fr).registerAll(et).registerAll(Ar).registerAll(yr).registerAll(vr).registerAll(he).registerAll(_r).registerAll(Ae).registerAll(Re).registerAll(Er).registerAll(dt).registerAll(ft).registerAll(mt).registerAll(ht).registerAll(Rt).registerAll(At).registerAll(yt).registerAll(gt).registerAll(ye).registerAll(jr).registerAll(nt).registerAll(ot).registerAll(lt).registerAll(hr).registerAll(Sr).registerAll(br).registerAll(Or).registerAll(Pr).registerAll(Nr).registerAll(kr).registerAll(Br).registerAll(Dr).registerAll(Mr).registerAll($r).registerAll(Jr).registerAll(Wr).registerAll(Ur).registerAll(at).registerAll(ct).registerAll(rt).registerAll(Vr).registerAll(Gr).registerAll(Yr).registerAll(Kr).registerAll(Xr).registerAll(st).registerAll(it).registerAll(Hr).registerAll(zr).registerAll(Tr).registerAll(tt).registerAll(Lr).registerAll(Rr)}o(vt,"buildRouter");function _t(e,r){if(e.toUpperCase()!=="GET")return null;const i=r.split("/").filter(u=>u.length>0);if(i.length!==4||i[0]!=="v1"||i[1]!=="nodes"||i[3]!=="attach")return null;const a=i[2];return a===void 0||a===""?null:decodeURIComponent(a)}o(_t,"attachNodeId");function wt(e){const r=e.trim();if(r==="")return null;const i=r.lastIndexOf(":");if(i<0)return null;const a=r.slice(0,i),u=r.slice(i+1),d=Number(u);return!Number.isInteger(d)||d<0||d>65535?null:{host:a===""?"0.0.0.0":a,port:d}}o(wt,"parseTcp");function Et(e,r){return`${e.includes(":")?`[${e}]`:e}:${r}`}o(Et,"formatTcpAddress");const P={code:"unauthorized",message:"missing or invalid bearer token"},L={code:"owner_only",message:"attach is owner-only; a scoped token does not reach it"},M={code:"person_bearer_not_supported",message:"this listener accepts a person bearer only on a cloud role with CRTR_DIRECTORY_URL and CRTR_PUBLIC_API_URL set; call with a node, app or public token"},q={class:"anonymous",app:"",node:"",run:null,uid:-1,sub:"",grant:null,client_id:null,scopes:[]},B=new WeakMap;function F(e){return B.get(e)}o(F,"socketPrincipal");async function _e(e,r){const i=process.platform==="linux"?nr(e.socket):null,a=e.headers.authorization;if(a===void 0)return i===null||r.has(i)?{class:"person"}:"unauthorized";if(typeof a!="string"||!a.startsWith("Bearer "))return"unauthorized";if(a.slice(7).startsWith("crtr_pub_"))return q;if(a.slice(7).startsWith(ee)){const u=be(a.slice(7));return u!==void 0&&(i===null||r.has(i))?u.principal:"unauthorized"}return we(a.slice(7),i)}o(_e,"resolveSocketPrincipal");async function we(e,r){const i=await $e(e);if(!i||r!==null&&r!==i.uid)return"unauthorized";const a=tr();if(a&&!H()&&!await rr(a))return"runtime_starting";const u=i.grant??(await er("app:terminal",i.sub))?.id??null;return{class:"broker",...i,grant:u}}o(we,"brokerPrincipal");function Ee(e){if(!(e.class==="anonymous"||e.class==="import"))return e.sub!==void 0&&e.sub!==""?e.sub:void 0}o(Ee,"requestPerson");function Se(e,r){r.class==="broker"&&A({event:"api.request.principal",level:r.app==="app:terminal"?"debug":"info",node_id:r.node,fields:{principal:`${r.app} node:${r.node}`,method:e.method,path:e.url}})}o(Se,"noteBrokerRequest");const ee="crtr_app_";function be(e){const r=e.startsWith(ee)?or(e):void 0;return r===void 0?void 0:{principal:{class:"app",app:r.grantee,scopes:r.scopes},ceiling:r.scopes}}o(be,"appBearer");function St(e){const r=new Map;for(const i of sr("user"))r.set(i.token,{principal:{class:"app",app:i.grantee,scopes:i.scopes},ceiling:i.scopes});return e!==void 0&&r.set(e,{principal:{class:"person"},ceiling:null}),r}o(St,"resolveBearers");function bt(e){try{return Ge(e).act!==void 0}catch{return!1}}o(bt,"carriesAct");const Tt=/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$/;function k(e,r){return e!==void 0&&(e.reason=r),"unauthorized"}o(k,"deny");async function Te(e,r,i){const a=e.headers.authorization;if(a===void 0&&(e.method??"GET").toUpperCase()==="GET"&&(e.url??"").split("?")[0]==="/healthz")return{principal:q,ceiling:null};if(typeof a!="string"||!a.startsWith("Bearer "))return k(i,a===void 0?"no_authorization_header":"not_a_bearer");const u=a.slice(7);if(u.startsWith("crtr_pub_"))return{principal:q,ceiling:null};if(u.startsWith(ee))return be(u)??k(i,"app_token_unknown");if(u.startsWith(ut)){const w=await pt(u);return w===null?k(i,"run_token_invalid_or_settled"):{principal:w,ceiling:null}}const d=r.get(u);if(d!==void 0)return d;const R=Le(u);if(R!==null)return{principal:R,ceiling:null};if(u.startsWith(He))return k(i,"import_token_invalid");if(Tt.test(u)){if(H()&&bt(u)){const x=j();if(x===null)return"person_bearer";try{const _=await x.verifyCall(a);return _.chain[0]?.sub.startsWith("app:")?{call:_}:k(i,"call_token_presenter_not_an_app")}catch(_){return _ instanceof S&&_.status===503?"runtime_starting":k(i,`call_token_${_ instanceof S?_.code:"invalid"}`)}}const w=H()?pe():null;if(w===null)return"person_bearer";const U=await w.verify(u);return U===null?k(i,"person_bearer_not_verified"):{principal:{class:"person",sub:U},ceiling:null}}const m=await we(u,null);return m==="unauthorized"?k(i,"node_token_unknown"):typeof m=="string"?m:{principal:m,ceiling:null}}o(Te,"authorizeTcp");let W;function j(){if(W!==void 0)return W;const e=process.env.CRTR_DIRECTORY_URL||void 0,r=process.env.CRTR_PUBLIC_API_URL||void 0;return W=e===void 0||r===void 0?null:new je(e,r,async()=>{}),W}o(j,"cloudCallResolver");let Ce;function Ct(){const e=j();if(e===null)throw new S(503,"runtime_starting","app calls are not configured on this listener");return Ce??=Ve(e,async()=>!0,async()=>{}),Ce}o(Ct,"cloudAppCalls");async function kt(e,r){N(r),I(r);const i=j();try{if(i===null)throw new S(503,"runtime_starting","sign-in is not configured on this listener");await Ye(e,r,new URL(e.url??"/","http://runtime.local"),i)}catch(a){if(!(a instanceof S))throw a;if(r.headersSent){r.destroy();return}r.writeHead(a.status,{"content-type":"application/json; charset=utf-8","cache-control":"no-store"}),r.end(JSON.stringify({error:{code:a.code,message:a.message,...a.param?{param:a.param}:{},origin:"runtime"}}))}}o(kt,"serveRuntimeSignIn");function Ut(){const e=process.env.CRTRD_TLS_CERT||void 0,r=process.env.CRTRD_TLS_KEY||void 0;if(e===void 0&&r===void 0)return null;if(e===void 0||r===void 0)throw new Error("CRTRD_TLS_CERT and CRTRD_TLS_KEY must be set together");return{cert:se(e),key:se(r)}}o(Ut,"tcpTls");function N(e){e.setHeader(Y,X()),e.setHeader(K,ce)}o(N,"advertiseRuntime");function I(e){e.setHeader("Access-Control-Allow-Origin","*"),e.setHeader("Access-Control-Expose-Headers",`${Y}, ${K}`)}o(I,"exposeRuntimeHeaders");function Ot(e,r){return(e.method??"GET").toUpperCase()!=="OPTIONS"?!1:(N(r),r.writeHead(204,{"Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":`${Y}, ${K}`,"Access-Control-Allow-Headers":`authorization, content-type, ${le.toLowerCase()}, ${ue.toLowerCase()}`,"Access-Control-Allow-Methods":"GET, POST, PATCH, PUT, DELETE, OPTIONS","Access-Control-Max-Age":"600"}),r.end(),!0)}o(Ot,"answerPreflight");function V(e,r=!1){N(e),r&&I(e),e.writeHead(401,{"content-type":"application/json; charset=utf-8"}),e.end(JSON.stringify({error:{...P,origin:"runtime"}}))}o(V,"writeUnauthorized");function Pt(e){N(e),I(e),e.writeHead(401,{"content-type":"application/json; charset=utf-8"}),e.end(JSON.stringify({error:{...M,origin:"runtime"}}))}o(Pt,"writePersonBearerRefused");const Nt={"/v1/runtime/vendor-status":{method:"GET",purpose:"vendor_status"},"/v1/runtime/vendor-account-remove":{method:"POST",purpose:"vendor_account_remove"}};async function It(e,r){if(!H())return!1;const i=new URL(e.url??"/","http://runtime.local").pathname,a=Nt[i];if(a===void 0||e.method!==a.method)return!1;const u=o((d,R)=>{N(r),I(r),r.writeHead(d,{"content-type":"application/json; charset=utf-8"}),r.end(JSON.stringify(R))},"answer");try{const d=pe();if(d===null)throw new S(401,M.code,M.message);const R=e.headers.authorization,m=R?.startsWith("Bearer ")?await d.verifyPurpose(R.slice(7),a.purpose):null;if(m===null)throw new S(401,"unauthorized","invalid directory token");const w=a.purpose==="vendor_status"?void 0:await zt(e);u(200,await J(m,async()=>a.purpose==="vendor_status"?Ze():await Xe(w)))}catch(d){const{status:R,body:m}=Qe(d);u(R,m)}return!0}o(It,"serveCloudVendorRoute");async function zt(e){const r=[];let i=0;for await(const a of e){if(i+=a.length,i>qe)throw new S(400,"invalid_request","request body too large");r.push(a)}if(i!==0)try{return JSON.parse(Buffer.concat(r).toString("utf8"))}catch{throw new S(400,"invalid_request","invalid JSON body")}}o(zt,"readVendorBody");function ke(e){N(e),e.writeHead(503,{"content-type":"application/json; charset=utf-8"}),e.end(JSON.stringify({error:{code:"runtime_starting",message:"grant sync is not ready",type:"server_error",origin:"runtime",retryable:!0}}))}o(ke,"writeRuntimeStarting");function Ht(e,r){e.writeHead(503,{"content-type":"application/json; charset=utf-8"}),e.end(JSON.stringify({error:{code:"startup_blocked",message:r,origin:"runtime"}}))}o(Ht,"writeStartupBlocked");function Ue(e,r,i){return new Promise(a=>{for(const m of r)m.destroy();if(i===void 0){try{e.closeAllConnections()}catch{}e.close(()=>a());return}const u=[];e.close(()=>{for(const m of u)clearTimeout(m);a()});const d=setInterval(()=>e.closeIdleConnections(),250),R=setTimeout(()=>e.closeAllConnections(),i);u.push(d,R),e.closeIdleConnections()})}o(Ue,"closeServer");function So(e={}){let r=null;const i=vt(()=>r),a=new fe().registerAll(he).registerAll(Ae).registerAll(Re).registerAll(ye),u=o((t,s)=>{const c=gr()?.startupBlock()??null;return c===null||t==="GET"&&(s==="/healthz"||s==="/v1/status"||s==="/v1/ready")||t==="POST"&&(s==="/v1/daemon/migrate"||s==="/v1/daemon/admit")||c.phase==="recovering"&&a.match(t,s)!==null?null:c},"startupBlockFor"),d=e.socketPath??Fe(),R=new Set([process.getuid?.()??0,...de("user").runtime?.person_uids??[]]),m=o((t,s,c)=>{N(s);const p=o(n=>Array.isArray(n)?n[0]:n,"first"),O=p(t.headers[le.toLowerCase()]),h=De(O,X())??Me(p(t.headers[ue.toLowerCase()]),ce,{legacyMinimum:O,runtimeVersion:X()});if(h!==null){s.writeHead(h.status,{"content-type":"application/json; charset=utf-8"}),s.end(JSON.stringify({error:{code:h.code,message:h.message,type:"invalid_request_error",origin:"runtime",retryable:!1,..."param"in h?{param:h.param}:{details:h.details}}}));return}const E=o(n=>{const l=F(t);A({event:"api.request.failed",level:"error",...l?.class==="broker"?{node_id:l.node}:{},error:n instanceof Error?n:new Error(String(n))});try{s.headersSent||s.writeHead(500,{"content-type":"application/json; charset=utf-8"}),s.end(JSON.stringify({error:{code:"internal",message:"internal error",origin:"runtime"}}))}catch{}},"internalFailure");let T;try{T=new URL(t.url??"/","http://127.0.0.1")}catch{try{s.writeHead(400,{"content-type":"application/json; charset=utf-8"}),s.end(JSON.stringify({error:{code:"invalid_request",message:"request URL is invalid",origin:"runtime"}}))}catch{}return}try{const n=u((t.method??"GET").toUpperCase(),T.pathname);if(n!==null){Ht(s,n.message);return}const l=F(t)??{class:"person"},f=Ee(l),g=o(()=>i.handle(t,s,c,l),"handled");(f===void 0?g():J(f,o(async()=>{Z()||await Q(f),await g()},"handledAsPerson"))).catch(E)}catch(n){E(n)}},"onRequest"),w=o(async(t,s,c)=>{const p=F(t);return p===void 0||me(p)||await ge(p,"either",c)?!0:(y(s,404,"Not Found","node_not_found",`no node ${c}`),!1)},"authorizeAttachUpgrade"),U=new Set,x=o(t=>{U.add(t),t.once("close",()=>U.delete(t)),t.on("error",()=>{})},"trackUpgrade"),_=o((t,s,c)=>{try{const p=new URL(t.url??"/","http://127.0.0.1"),O=u((t.method??"GET").toUpperCase(),p.pathname);if(O!==null){y(s,503,"Service Unavailable","startup_blocked",O.message);return}const h=_t(t.method??"GET",p.pathname);if(h===null){s.destroy();return}const E=(()=>{const n=F(t);return n===void 0?void 0:Ee(n)})(),T=o(()=>w(t,s,h).then(n=>n?cr(t,s,c,h,async l=>{const f=F(t);return f===void 0||me(f)||await ge(f,l,h)}):void 0),"attach");(E===void 0?T():J(E,async()=>{Z()||await Q(E),await T()})).catch(()=>{try{s.destroy()}catch{}})}catch{try{s.destroy()}catch{}}},"onUpgrade"),Oe=o(t=>{t.on("error",s=>{A({event:"api.server.failed",level:"error",error:s})})},"bindErrorHandler"),Pe=o(async(t,s)=>{try{const c=await _e(t,R);if(c==="unauthorized"){A({event:"api.principal.denied",level:"warn",fields:{method:t.method}}),V(s);return}if(c==="runtime_starting"){ke(s);return}B.set(t,c),Se(t,c),m(t,s,c.class==="app"?c.scopes:null)}catch(c){A({event:"api.principal.failed",level:"error",error:c instanceof Error?c:new Error(String(c))}),V(s)}},"onSocketRequest"),D=ie((t,s)=>{Pe(t,s).catch(c=>A({event:"api.principal.failed",level:"error",error:c instanceof Error?c:new Error(String(c))}))}),Ne=o(async(t,s,c)=>{try{const p=await _e(t,R);if(p==="unauthorized"||p==="runtime_starting"){p==="unauthorized"&&A({event:"api.principal.denied",level:"warn",fields:{method:t.method}}),y(s,p==="unauthorized"?401:503,"Unauthorized",p,"socket principal unavailable");return}if(p.class!=="person"&&p.class!=="broker"){y(s,403,"Forbidden",L.code,L.message);return}B.set(t,p),_(t,s,c)}catch(p){A({event:"api.principal.failed",level:"error",error:p instanceof Error?p:new Error(String(p))}),y(s,401,"Unauthorized",P.code,P.message)}},"onSocketUpgrade");D.on("upgrade",(t,s,c)=>{x(s),Ne(t,s,c).catch(p=>A({event:"api.principal.failed",level:"error",error:p instanceof Error?p:new Error(String(p))}))}),ve((t,s,c)=>{B.set(t,c),m(t,s,null)});let re=!1,te,ne;const Ie=new Promise((t,s)=>{te=t,ne=s});D.once("listening",()=>{re=!0,te()}),D.on("error",t=>{A({event:"api.server.failed",level:"error",error:t}),re||ne(t)});try{G(d)&&ae(d)}catch{}D.listen(d,()=>{try{xe(d,process.platform==="linux"&&G("/run/crtr/launcher.sock")?438:384)}catch(t){A({event:"api.socket.chmod_failed",level:"error",error:t instanceof Error?t:new Error(String(t))})}});let b;const $=e.tcp??ar()??de("user").api.tcp;if($!==void 0&&$!==""){const t=wt($);if(t===null)A({event:"api.tcp.invalid",level:"error",error:new Error(`invalid CRTRD_TCP/--tcp spec: ${$}`)});else{H()&&j();const s=e.token??lr()??ir("user"),c=St(s),p=o(async(n,l)=>{if(Je(n)){await We(n,l);return}if(Ot(n,l))return;if(H()&&Ke(new URL(n.url??"/","http://runtime.local").pathname)){await kt(n,l);return}if(await It(n,l))return;const f={},g=await Te(n,c,f);if(g==="runtime_starting"){I(l),ke(l);return}if(g==="person_bearer"){Pt(l);return}if(g==="unauthorized"){A({event:"api.principal.denied",level:"warn",fields:{method:n.method,listener:"tcp",path:new URL(n.url??"/","http://runtime.local").pathname,reason:f.reason??"unknown"}}),V(l,!0);return}if("call"in g){I(l);const z=g.call.sub;await J(z,async()=>{Z()||await Q(z),await Ct()(n,l,g.call)});return}B.set(n,g.principal),Se(n,g.principal),I(l),m(n,l,g.ceiling)},"tcpOnRequest"),O=o(async(n,l,f)=>{const g=pr(n);if(g!==null){const v=await ur(n,l,f,g);v!==null&&y(l,v.status,v.text,v.code,v.message);return}const z=mr(n);if(z!==null){const v=fr(n,l,f,z);v!==null&&y(l,v.status,v.text,v.code,v.message);return}const C=await Te(n,c);if(C==="runtime_starting"){y(l,503,"Service Unavailable","runtime_starting","grant sync is not ready");return}if(C==="person_bearer"){y(l,401,"Unauthorized",M.code,M.message);return}if(C==="unauthorized"){y(l,401,"Unauthorized",P.code,P.message);return}if("call"in C){y(l,403,"Forbidden",L.code,L.message);return}if(C.ceiling!==null||C.principal.class==="anonymous"||C.principal.class==="import"){y(l,403,"Forbidden",L.code,L.message);return}B.set(n,C.principal),_(n,l,f)},"tcpOnUpgrade"),h=o(n=>{A({event:"api.principal.failed",level:"error",error:n instanceof Error?n:new Error(String(n))})},"failed"),E=o((n,l)=>{p(n,l).catch(f=>{h(f),l.headersSent?l.destroy():V(l,!0)})},"listener"),T=Ut();b=T===null?ie(E):Be(T,E),b.on("upgrade",(n,l,f)=>{x(l),O(n,l,f).catch(g=>{h(g),y(l,401,"Unauthorized",P.code,P.message)})}),Oe(b),b.once("listening",()=>{const n=b?.address();if(n!==null&&typeof n=="object"){const{address:l,port:f}=n;r=Et(l,f),l!=="0.0.0.0"&&l!=="::"&&dr(r)}}),b.listen(t.port,t.host)}}let oe=!1;return{ready:Ie,tcpAddress:o(()=>r,"tcpAddress"),close:o(async(t={})=>{if(!oe){oe=!0,ve(null),wr.close(),await Promise.all([Ue(D,U,t.graceMs),b!==void 0?Ue(b,U,t.graceMs):Promise.resolve()]);try{G(d)&&ae(d)}catch{}}},"close")}}o(So,"createApiServer");export{vt as buildRouter,Ue as closeServer,So as createApiServer,F as socketPrincipal};
1
+ var ze=Object.defineProperty;var o=(e,r)=>ze(e,"name",{value:r,configurable:!0});import{IMPORT_TOKEN_PREFIX as He,importPrincipalFor as Le}from"./import-auth.js";import{createServer as ie}from"node:http";import{createServer as Be}from"node:https";import{chmodSync as xe,existsSync as G,readFileSync as se,unlinkSync as ae}from"node:fs";import{MINIMUM_RUNTIME_VERSION_HEADER as le,RUNTIME_VERSION_HEADER as Y,minimumRuntimeRefusal as De}from"../../api/runtime-version.js";import{CONTRACT_HEADER as K,CONTRACT_LEVEL as ce,REQUIRED_CONTRACT_HEADER as ue,contractRefusal as Fe}from"../../api/contract.js";import{crtrVersion as X}from"../../shared/crtr-version.js";import{apiSocketPath as Me}from"../../core/canvas/paths.js";import{resolveNodeToken as $e}from"../../core/canvas/node-tokens.js";import{isCloudRole as H,runAsPerson as J}from"../../core/canvas/person.js";import{isCanvasRequest as Je,serveCanvas as We}from"./canvas-host.js";import{personBearerVerifier as pe}from"./auth/person-bearer.js";import{personHasSnapshot as Z}from"../../core/scoped-state/person-store.js";import{loadPersonSettings as Q}from"../../core/scoped-state/person-rows.js";import{AppPrincipalResolver as je}from"./principal.js";import{createAppRequestHandler as Ve}from"./app-listener.js";import{decodeJwt as Ge}from"jose";import{handleRuntimeSignIn as Ye,isRuntimeSignInPath as Ke}from"./key-signin.js";import{RunError as S}from"../../core/runs/operations.js";import{removeVendorAccount as Xe,vendorStatus as Ze}from"./handlers/vendor-status.js";import{toErrorBody as Qe}from"./map.js";import{CONTROL_BODY_MAX_BYTES as qe}from"../../core/llm/body-limits.js";import{grantFor as er,hasSyncedGrants as rr}from"../../core/grants/mirror.js";import{readConfig as de}from"../../core/config.js";import{directoryIssuer as tr}from"../../core/directory/issuer.js";import{peerUid as nr}from"../../native/linux.js";import{findScopedApiToken as or,getApiToken as ir,listScopedApiTokens as sr}from"../../core/secrets.js";import{emitEvent as A}from"../../core/events/emit.js";import{envCrtrdTcp as ar,envCrtrdToken as lr}from"../../shared/env.js";import{Router as fe,actsAsPerson as me}from"./router.js";import{handleAttachUpgrade as cr,refuseUpgrade as y}from"./bridge.js";import{handleMachineLinkUpgrade as ur,machineLinkEnvironment as pr,setApiAddress as dr}from"../machine-link/holder.js";import{handleMachineViewUpgrade as fr,machineViewEnvironment as mr}from"../machine-link/forward.js";import{boundDaemonControl as gr}from"../control.js";import{attachRoutes as hr,mayAttachNode as ge}from"./handlers/attach.js";import{peerRoutes as Rr}from"../peer/handlers.js";import{bashJobRoutes as Ar}from"./handlers/bash-jobs.js";import{nodeFileRoutes as yr}from"./handlers/node-files.js";import{bashRoutes as vr}from"./handlers/bash.js";import{hookExecRoutes as _r}from"./handlers/hook-exec.js";import{brokerOperationRoutes as he}from"./handlers/broker-ops.js";import{brokerSignalRoutes as wr,brokerSignalStreams as Er}from"./handlers/broker-signals.js";import{brokerRecoveryRoutes as Re,nodeFaultRoutes as Sr}from"./handlers/broker-recovery.js";import{canvasRoutes as br}from"./handlers/canvas.js";import{conversationRoutes as Tr}from"./handlers/conversations.js";import{chatInventoryRoutes as Cr}from"./handlers/chat-inventory.js";import{daemonRoutes as kr}from"./handlers/daemon.js";import{fileRoutes as Ur}from"./handlers/files.js";import{focusRoutes as Or}from"./handlers/focus.js";import{analyticsRoutes as Pr}from"./handlers/analytics.js";import{memoryReadsRoutes as Nr}from"./handlers/memory-reads.js";import{memoryRoutes as Ir}from"./handlers/memory.js";import{healthRoutes as zr}from"./handlers/health.js";import{humanRequestRoutes as Hr}from"./handlers/human-requests.js";import{inboxRoutes as Lr}from"./handlers/inbox.js";import{feedbackCommentRoutes as Br}from"./handlers/feedback-comments.js";import{objectRoutes as xr}from"./handlers/objects.js";import{shareRoutes as Dr}from"./handlers/shares.js";import{customObjectRoutes as Fr}from"./handlers/custom-objects.js";import{docRoutes as Mr}from"./handlers/docs.js";import{deliveryRoutes as Ae}from"./handlers/delivery.js";import{deliveryRetryRoutes as $r}from"./handlers/delivery-retry.js";import{packageDocRoutes as Jr}from"./handlers/package-docs.js";import{documentAccessRoutes as Wr}from"./handlers/document-access.js";import{pluginAppRoutes as jr}from"./handlers/plugin-app-token.js";import{brokerMailRoutes as ye,messageRoutes as Vr}from"./handlers/messages.js";import{modelAuthRoutes as Gr}from"./handlers/modelauth.js";import{llmRoutes as Yr}from"./handlers/llm.js";import{providerRoutes as Kr}from"./handlers/providers.js";import{modelConfigRoutes as Xr}from"./handlers/model-config.js";import{settingsRoutes as Zr}from"./handlers/settings.js";import{nodeRoutes as Qr}from"./handlers/nodes.js";import{nodeRecordRoutes as qr}from"./handlers/node-records.js";import{nodeOutcomeRoutes as et}from"./handlers/node-outcomes.js";import{nodeEventRoutes as rt}from"./handlers/node-events.js";import{profileRoutes as tt}from"./handlers/profiles.js";import{prospectiveChatInventoryRoutes as nt}from"./handlers/prospective-chat-inventory.js";import{reportRoutes as ot}from"./handlers/reports.js";import{runRoutes as it}from"./handlers/run-routes.js";import{reviewCommentRoutes as st}from"./handlers/review-comments.js";import{reviewRoutes as at}from"./handlers/reviews.js";import{subscriptionRoutes as lt}from"./handlers/subscriptions.js";import{structuredRequestRoutes as ct}from"./handlers/structured-requests.js";import{cronRoutes as ut}from"./handlers/crons.js";import{setCronRequestHandler as ve}from"../cron/run-socket.js";import{RUN_TOKEN_PREFIX as pt,cronPrincipalForRunToken as dt}from"../cron/run-token.js";import{worktreeRoutes as ft}from"./handlers/worktree.js";import{limitsRoutes as mt}from"./handlers/limits.js";import{chargeRoutes as gt,spendLimitRoutes as ht}from"./handlers/charges.js";import{executionStartRoutes as Rt}from"./handlers/execution-start.js";import{machineCredentialRoutes as At}from"./handlers/machine-credential.js";import{importRoutes as yt}from"./handlers/imports.js";import{gitCredentialRoutes as vt}from"./handlers/git-credential.js";function _t(e){return new fe().registerAll(zr(e)).registerAll(kr).registerAll(Dr).registerAll(Qr).registerAll(qr).registerAll(et).registerAll($r).registerAll(rt).registerAll(Ar).registerAll(yr).registerAll(vr).registerAll(_r).registerAll(he).registerAll(wr).registerAll(Ae).registerAll(Re).registerAll(Sr).registerAll(ft).registerAll(mt).registerAll(gt).registerAll(Rt).registerAll(At).registerAll(yt).registerAll(vt).registerAll(ht).registerAll(ye).registerAll(Vr).registerAll(ot).registerAll(it).registerAll(ct).registerAll(hr).registerAll(br).registerAll(Tr).registerAll(Pr).registerAll(Nr).registerAll(Ir).registerAll(Ur).registerAll(xr).registerAll(Fr).registerAll(Mr).registerAll(Jr).registerAll(Wr).registerAll(jr).registerAll(Or).registerAll(lt).registerAll(ut).registerAll(tt).registerAll(Gr).registerAll(Yr).registerAll(Kr).registerAll(Xr).registerAll(Zr).registerAll(at).registerAll(st).registerAll(Lr).registerAll(Hr).registerAll(Cr).registerAll(nt).registerAll(Br).registerAll(Rr)}o(_t,"buildRouter");function wt(e,r){if(e.toUpperCase()!=="GET")return null;const i=r.split("/").filter(u=>u.length>0);if(i.length!==4||i[0]!=="v1"||i[1]!=="nodes"||i[3]!=="attach")return null;const a=i[2];return a===void 0||a===""?null:decodeURIComponent(a)}o(wt,"attachNodeId");function Et(e){const r=e.trim();if(r==="")return null;const i=r.lastIndexOf(":");if(i<0)return null;const a=r.slice(0,i),u=r.slice(i+1),d=Number(u);return!Number.isInteger(d)||d<0||d>65535?null:{host:a===""?"0.0.0.0":a,port:d}}o(Et,"parseTcp");function St(e,r){return`${e.includes(":")?`[${e}]`:e}:${r}`}o(St,"formatTcpAddress");const P={code:"unauthorized",message:"missing or invalid bearer token"},L={code:"owner_only",message:"attach is owner-only; a scoped token does not reach it"},F={code:"person_bearer_not_supported",message:"this listener accepts a person bearer only on a cloud role with CRTR_DIRECTORY_URL and CRTR_PUBLIC_API_URL set; call with a node, app or public token"},q={class:"anonymous",app:"",node:"",run:null,uid:-1,sub:"",grant:null,client_id:null,scopes:[]},B=new WeakMap;function M(e){return B.get(e)}o(M,"socketPrincipal");async function _e(e,r){const i=process.platform==="linux"?nr(e.socket):null,a=e.headers.authorization;if(a===void 0)return i===null||r.has(i)?{class:"person"}:"unauthorized";if(typeof a!="string"||!a.startsWith("Bearer "))return"unauthorized";if(a.slice(7).startsWith("crtr_pub_"))return q;if(a.slice(7).startsWith(ee)){const u=be(a.slice(7));return u!==void 0&&(i===null||r.has(i))?u.principal:"unauthorized"}return we(a.slice(7),i)}o(_e,"resolveSocketPrincipal");async function we(e,r){const i=await $e(e);if(!i||r!==null&&r!==i.uid)return"unauthorized";const a=tr();if(a&&!H()&&!await rr(a))return"runtime_starting";const u=i.grant??(await er("app:terminal",i.sub))?.id??null;return{class:"broker",...i,grant:u}}o(we,"brokerPrincipal");function Ee(e){if(!(e.class==="anonymous"||e.class==="import"))return e.sub!==void 0&&e.sub!==""?e.sub:void 0}o(Ee,"requestPerson");function Se(e,r){r.class==="broker"&&A({event:"api.request.principal",level:r.app==="app:terminal"?"debug":"info",node_id:r.node,fields:{principal:`${r.app} node:${r.node}`,method:e.method,path:e.url}})}o(Se,"noteBrokerRequest");const ee="crtr_app_";function be(e){const r=e.startsWith(ee)?or(e):void 0;return r===void 0?void 0:{principal:{class:"app",app:r.grantee,scopes:r.scopes},ceiling:r.scopes}}o(be,"appBearer");function bt(e){const r=new Map;for(const i of sr("user"))r.set(i.token,{principal:{class:"app",app:i.grantee,scopes:i.scopes},ceiling:i.scopes});return e!==void 0&&r.set(e,{principal:{class:"person"},ceiling:null}),r}o(bt,"resolveBearers");function Tt(e){try{return Ge(e).act!==void 0}catch{return!1}}o(Tt,"carriesAct");const Ct=/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$/;function k(e,r){return e!==void 0&&(e.reason=r),"unauthorized"}o(k,"deny");async function Te(e,r,i){const a=e.headers.authorization;if(a===void 0&&(e.method??"GET").toUpperCase()==="GET"&&(e.url??"").split("?")[0]==="/healthz")return{principal:q,ceiling:null};if(typeof a!="string"||!a.startsWith("Bearer "))return k(i,a===void 0?"no_authorization_header":"not_a_bearer");const u=a.slice(7);if(u.startsWith("crtr_pub_"))return{principal:q,ceiling:null};if(u.startsWith(ee))return be(u)??k(i,"app_token_unknown");if(u.startsWith(pt)){const w=await dt(u);return w===null?k(i,"run_token_invalid_or_settled"):{principal:w,ceiling:null}}const d=r.get(u);if(d!==void 0)return d;const R=Le(u);if(R!==null)return{principal:R,ceiling:null};if(u.startsWith(He))return k(i,"import_token_invalid");if(Ct.test(u)){if(H()&&Tt(u)){const x=j();if(x===null)return"person_bearer";try{const _=await x.verifyCall(a);return _.chain[0]?.sub.startsWith("app:")?{call:_}:k(i,"call_token_presenter_not_an_app")}catch(_){return _ instanceof S&&_.status===503?"runtime_starting":k(i,`call_token_${_ instanceof S?_.code:"invalid"}`)}}const w=H()?pe():null;if(w===null)return"person_bearer";const U=await w.verify(u);return U===null?k(i,"person_bearer_not_verified"):{principal:{class:"person",sub:U},ceiling:null}}const m=await we(u,null);return m==="unauthorized"?k(i,"node_token_unknown"):typeof m=="string"?m:{principal:m,ceiling:null}}o(Te,"authorizeTcp");let W;function j(){if(W!==void 0)return W;const e=process.env.CRTR_DIRECTORY_URL||void 0,r=process.env.CRTR_PUBLIC_API_URL||void 0;return W=e===void 0||r===void 0?null:new je(e,r,async()=>{}),W}o(j,"cloudCallResolver");let Ce;function kt(){const e=j();if(e===null)throw new S(503,"runtime_starting","app calls are not configured on this listener");return Ce??=Ve(e,async()=>!0,async()=>{}),Ce}o(kt,"cloudAppCalls");async function Ut(e,r){N(r),I(r);const i=j();try{if(i===null)throw new S(503,"runtime_starting","sign-in is not configured on this listener");await Ye(e,r,new URL(e.url??"/","http://runtime.local"),i)}catch(a){if(!(a instanceof S))throw a;if(r.headersSent){r.destroy();return}r.writeHead(a.status,{"content-type":"application/json; charset=utf-8","cache-control":"no-store"}),r.end(JSON.stringify({error:{code:a.code,message:a.message,...a.param?{param:a.param}:{},origin:"runtime"}}))}}o(Ut,"serveRuntimeSignIn");function Ot(){const e=process.env.CRTRD_TLS_CERT||void 0,r=process.env.CRTRD_TLS_KEY||void 0;if(e===void 0&&r===void 0)return null;if(e===void 0||r===void 0)throw new Error("CRTRD_TLS_CERT and CRTRD_TLS_KEY must be set together");return{cert:se(e),key:se(r)}}o(Ot,"tcpTls");function N(e){e.setHeader(Y,X()),e.setHeader(K,ce)}o(N,"advertiseRuntime");function I(e){e.setHeader("Access-Control-Allow-Origin","*"),e.setHeader("Access-Control-Expose-Headers",`${Y}, ${K}`)}o(I,"exposeRuntimeHeaders");function Pt(e,r){return(e.method??"GET").toUpperCase()!=="OPTIONS"?!1:(N(r),r.writeHead(204,{"Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":`${Y}, ${K}`,"Access-Control-Allow-Headers":`authorization, content-type, ${le.toLowerCase()}, ${ue.toLowerCase()}`,"Access-Control-Allow-Methods":"GET, POST, PATCH, PUT, DELETE, OPTIONS","Access-Control-Max-Age":"600"}),r.end(),!0)}o(Pt,"answerPreflight");function V(e,r=!1){N(e),r&&I(e),e.writeHead(401,{"content-type":"application/json; charset=utf-8"}),e.end(JSON.stringify({error:{...P,origin:"runtime"}}))}o(V,"writeUnauthorized");function Nt(e){N(e),I(e),e.writeHead(401,{"content-type":"application/json; charset=utf-8"}),e.end(JSON.stringify({error:{...F,origin:"runtime"}}))}o(Nt,"writePersonBearerRefused");const It={"/v1/runtime/vendor-status":{method:"GET",purpose:"vendor_status"},"/v1/runtime/vendor-account-remove":{method:"POST",purpose:"vendor_account_remove"}};async function zt(e,r){if(!H())return!1;const i=new URL(e.url??"/","http://runtime.local").pathname,a=It[i];if(a===void 0||e.method!==a.method)return!1;const u=o((d,R)=>{N(r),I(r),r.writeHead(d,{"content-type":"application/json; charset=utf-8"}),r.end(JSON.stringify(R))},"answer");try{const d=pe();if(d===null)throw new S(401,F.code,F.message);const R=e.headers.authorization,m=R?.startsWith("Bearer ")?await d.verifyPurpose(R.slice(7),a.purpose):null;if(m===null)throw new S(401,"unauthorized","invalid directory token");const w=a.purpose==="vendor_status"?void 0:await Ht(e);u(200,await J(m,async()=>a.purpose==="vendor_status"?Ze():await Xe(w)))}catch(d){const{status:R,body:m}=Qe(d);u(R,m)}return!0}o(zt,"serveCloudVendorRoute");async function Ht(e){const r=[];let i=0;for await(const a of e){if(i+=a.length,i>qe)throw new S(400,"invalid_request","request body too large");r.push(a)}if(i!==0)try{return JSON.parse(Buffer.concat(r).toString("utf8"))}catch{throw new S(400,"invalid_request","invalid JSON body")}}o(Ht,"readVendorBody");function ke(e){N(e),e.writeHead(503,{"content-type":"application/json; charset=utf-8"}),e.end(JSON.stringify({error:{code:"runtime_starting",message:"grant sync is not ready",type:"server_error",origin:"runtime",retryable:!0}}))}o(ke,"writeRuntimeStarting");function Lt(e,r){e.writeHead(503,{"content-type":"application/json; charset=utf-8"}),e.end(JSON.stringify({error:{code:"startup_blocked",message:r,origin:"runtime"}}))}o(Lt,"writeStartupBlocked");function Ue(e,r,i){return new Promise(a=>{for(const m of r)m.destroy();if(i===void 0){try{e.closeAllConnections()}catch{}e.close(()=>a());return}const u=[];e.close(()=>{for(const m of u)clearTimeout(m);a()});const d=setInterval(()=>e.closeIdleConnections(),250),R=setTimeout(()=>e.closeAllConnections(),i);u.push(d,R),e.closeIdleConnections()})}o(Ue,"closeServer");function To(e={}){let r=null;const i=_t(()=>r),a=new fe().registerAll(he).registerAll(Ae).registerAll(Re).registerAll(ye),u=o((t,s)=>{const c=gr()?.startupBlock()??null;return c===null||t==="GET"&&(s==="/healthz"||s==="/v1/status"||s==="/v1/ready")||t==="POST"&&(s==="/v1/daemon/migrate"||s==="/v1/daemon/admit")||c.phase==="recovering"&&a.match(t,s)!==null?null:c},"startupBlockFor"),d=e.socketPath??Me(),R=new Set([process.getuid?.()??0,...de("user").runtime?.person_uids??[]]),m=o((t,s,c)=>{N(s);const p=o(n=>Array.isArray(n)?n[0]:n,"first"),O=p(t.headers[le.toLowerCase()]),h=De(O,X())??Fe(p(t.headers[ue.toLowerCase()]),ce,{legacyMinimum:O,runtimeVersion:X()});if(h!==null){s.writeHead(h.status,{"content-type":"application/json; charset=utf-8"}),s.end(JSON.stringify({error:{code:h.code,message:h.message,type:"invalid_request_error",origin:"runtime",retryable:!1,..."param"in h?{param:h.param}:{details:h.details}}}));return}const E=o(n=>{const l=M(t);A({event:"api.request.failed",level:"error",...l?.class==="broker"?{node_id:l.node}:{},error:n instanceof Error?n:new Error(String(n))});try{s.headersSent||s.writeHead(500,{"content-type":"application/json; charset=utf-8"}),s.end(JSON.stringify({error:{code:"internal",message:"internal error",origin:"runtime"}}))}catch{}},"internalFailure");let T;try{T=new URL(t.url??"/","http://127.0.0.1")}catch{try{s.writeHead(400,{"content-type":"application/json; charset=utf-8"}),s.end(JSON.stringify({error:{code:"invalid_request",message:"request URL is invalid",origin:"runtime"}}))}catch{}return}try{const n=u((t.method??"GET").toUpperCase(),T.pathname);if(n!==null){Lt(s,n.message);return}const l=M(t)??{class:"person"},f=Ee(l),g=o(()=>i.handle(t,s,c,l),"handled");(f===void 0?g():J(f,o(async()=>{Z()||await Q(f),await g()},"handledAsPerson"))).catch(E)}catch(n){E(n)}},"onRequest"),w=o(async(t,s,c)=>{const p=M(t);return p===void 0||me(p)||await ge(p,"either",c)?!0:(y(s,404,"Not Found","node_not_found",`no node ${c}`),!1)},"authorizeAttachUpgrade"),U=new Set,x=o(t=>{U.add(t),t.once("close",()=>U.delete(t)),t.on("error",()=>{})},"trackUpgrade"),_=o((t,s,c)=>{try{const p=new URL(t.url??"/","http://127.0.0.1"),O=u((t.method??"GET").toUpperCase(),p.pathname);if(O!==null){y(s,503,"Service Unavailable","startup_blocked",O.message);return}const h=wt(t.method??"GET",p.pathname);if(h===null){s.destroy();return}const E=(()=>{const n=M(t);return n===void 0?void 0:Ee(n)})(),T=o(()=>w(t,s,h).then(n=>n?cr(t,s,c,h,async l=>{const f=M(t);return f===void 0||me(f)||await ge(f,l,h)}):void 0),"attach");(E===void 0?T():J(E,async()=>{Z()||await Q(E),await T()})).catch(()=>{try{s.destroy()}catch{}})}catch{try{s.destroy()}catch{}}},"onUpgrade"),Oe=o(t=>{t.on("error",s=>{A({event:"api.server.failed",level:"error",error:s})})},"bindErrorHandler"),Pe=o(async(t,s)=>{try{const c=await _e(t,R);if(c==="unauthorized"){A({event:"api.principal.denied",level:"warn",fields:{method:t.method}}),V(s);return}if(c==="runtime_starting"){ke(s);return}B.set(t,c),Se(t,c),m(t,s,c.class==="app"?c.scopes:null)}catch(c){A({event:"api.principal.failed",level:"error",error:c instanceof Error?c:new Error(String(c))}),V(s)}},"onSocketRequest"),D=ie((t,s)=>{Pe(t,s).catch(c=>A({event:"api.principal.failed",level:"error",error:c instanceof Error?c:new Error(String(c))}))}),Ne=o(async(t,s,c)=>{try{const p=await _e(t,R);if(p==="unauthorized"||p==="runtime_starting"){p==="unauthorized"&&A({event:"api.principal.denied",level:"warn",fields:{method:t.method}}),y(s,p==="unauthorized"?401:503,"Unauthorized",p,"socket principal unavailable");return}if(p.class!=="person"&&p.class!=="broker"){y(s,403,"Forbidden",L.code,L.message);return}B.set(t,p),_(t,s,c)}catch(p){A({event:"api.principal.failed",level:"error",error:p instanceof Error?p:new Error(String(p))}),y(s,401,"Unauthorized",P.code,P.message)}},"onSocketUpgrade");D.on("upgrade",(t,s,c)=>{x(s),Ne(t,s,c).catch(p=>A({event:"api.principal.failed",level:"error",error:p instanceof Error?p:new Error(String(p))}))}),ve((t,s,c)=>{B.set(t,c),m(t,s,null)});let re=!1,te,ne;const Ie=new Promise((t,s)=>{te=t,ne=s});D.once("listening",()=>{re=!0,te()}),D.on("error",t=>{A({event:"api.server.failed",level:"error",error:t}),re||ne(t)});try{G(d)&&ae(d)}catch{}D.listen(d,()=>{try{xe(d,process.platform==="linux"&&G("/run/crtr/launcher.sock")?438:384)}catch(t){A({event:"api.socket.chmod_failed",level:"error",error:t instanceof Error?t:new Error(String(t))})}});let b;const $=e.tcp??ar()??de("user").api.tcp;if($!==void 0&&$!==""){const t=Et($);if(t===null)A({event:"api.tcp.invalid",level:"error",error:new Error(`invalid CRTRD_TCP/--tcp spec: ${$}`)});else{H()&&j();const s=e.token??lr()??ir("user"),c=bt(s),p=o(async(n,l)=>{if(Je(n)){await We(n,l);return}if(Pt(n,l))return;if(H()&&Ke(new URL(n.url??"/","http://runtime.local").pathname)){await Ut(n,l);return}if(await zt(n,l))return;const f={},g=await Te(n,c,f);if(g==="runtime_starting"){I(l),ke(l);return}if(g==="person_bearer"){Nt(l);return}if(g==="unauthorized"){A({event:"api.principal.denied",level:"warn",fields:{method:n.method,listener:"tcp",path:new URL(n.url??"/","http://runtime.local").pathname,reason:f.reason??"unknown"}}),V(l,!0);return}if("call"in g){I(l);const z=g.call.sub;await J(z,async()=>{Z()||await Q(z),await kt()(n,l,g.call)});return}B.set(n,g.principal),Se(n,g.principal),I(l),m(n,l,g.ceiling)},"tcpOnRequest"),O=o(async(n,l,f)=>{const g=pr(n);if(g!==null){const v=await ur(n,l,f,g);v!==null&&y(l,v.status,v.text,v.code,v.message);return}const z=mr(n);if(z!==null){const v=fr(n,l,f,z);v!==null&&y(l,v.status,v.text,v.code,v.message);return}const C=await Te(n,c);if(C==="runtime_starting"){y(l,503,"Service Unavailable","runtime_starting","grant sync is not ready");return}if(C==="person_bearer"){y(l,401,"Unauthorized",F.code,F.message);return}if(C==="unauthorized"){y(l,401,"Unauthorized",P.code,P.message);return}if("call"in C){y(l,403,"Forbidden",L.code,L.message);return}if(C.ceiling!==null||C.principal.class==="anonymous"||C.principal.class==="import"){y(l,403,"Forbidden",L.code,L.message);return}B.set(n,C.principal),_(n,l,f)},"tcpOnUpgrade"),h=o(n=>{A({event:"api.principal.failed",level:"error",error:n instanceof Error?n:new Error(String(n))})},"failed"),E=o((n,l)=>{p(n,l).catch(f=>{h(f),l.headersSent?l.destroy():V(l,!0)})},"listener"),T=Ot();b=T===null?ie(E):Be(T,E),b.on("upgrade",(n,l,f)=>{x(l),O(n,l,f).catch(g=>{h(g),y(l,401,"Unauthorized",P.code,P.message)})}),Oe(b),b.once("listening",()=>{const n=b?.address();if(n!==null&&typeof n=="object"){const{address:l,port:f}=n;r=St(l,f),l!=="0.0.0.0"&&l!=="::"&&dr(r)}}),b.listen(t.port,t.host)}}let oe=!1;return{ready:Ie,tcpAddress:o(()=>r,"tcpAddress"),close:o(async(t={})=>{if(!oe){oe=!0,ve(null),Er.close(),await Promise.all([Ue(D,U,t.graceMs),b!==void 0?Ue(b,U,t.graceMs):Promise.resolve()]);try{G(d)&&ae(d)}catch{}}},"close")}}o(To,"createApiServer");export{_t as buildRouter,Ue as closeServer,To as createApiServer,M as socketPrincipal};
@@ -1,5 +1,5 @@
1
- var v=Object.defineProperty;var b=(s,e)=>v(s,"name",{value:e,configurable:!0});import{openDb as N}from"../../core/canvas/db.js";import{getNode as G}from"../../core/canvas/canvas.js";import{LEDGER_ENV as O,sandboxDiskUsdPerGbMonth as S,storageUsdPerGbMonth as M,warnRateUnset as R}from"../../core/ledger/rates.js";import{emitEvent as y}from"../../core/events/emit.js";import{operationIdContext as D}from"../../core/events/operation-id.js";import{billingAccountOf as I}from"../../core/ledger/account.js";import{writeInfraCharge as L}from"../../core/ledger/infra-allowance.js";import{usageMonth as w}from"../../core/ledger/months.js";import{startCandidateOf as A}from"../../core/runtime/start-check.js";import{runThrottledLane as C}from"./throttled-lane.js";const U=60*6e4,P=10*6e4,F=1024**3;async function ee(){if(M()===null&&S()===null)return;const s=await(await N()).prepare("SELECT cursor FROM reconciler_leases WHERE lane = 'ledger-storage' AND key = ''").get(),e=s?.cursor==null?null:JSON.parse(s.cursor).state;return e===null?null:e.slice(0,7)}b(ee,"storageSettledThrough");function J(s){const[e,r]=s.split("-").map(Number);return w(new Date(Date.UTC(e,r-2,1)))}b(J,"previousMonth");const k=b(s=>{const[e,r]=s.split("-").map(Number);return w(new Date(Date.UTC(e,r,1)))},"nextMonth"),W=b(s=>{const[e,r]=s.split("-").map(Number);return new Date(Date.UTC(e,r,1)).toISOString()},"endOf");class te{static{b(this,"LedgerStorageReconciler")}run(e,r){if(!r.lifecycle.acceptsDetachedWork())return;const d=D.fresh(()=>C("ledger-storage","",e,U,P,async o=>{await this.pass(e,o)})).then(()=>{}).catch(o=>{D.fresh(()=>y({level:"error",event:"ledger.storage.failed",error:o}))});r.lifecycle.registerDetached(d)}async pass(e,r){const d=J(w(new Date(e))),o={month:null,rows:0,failed:0},c={r2:M(),disk:S()};if(c.r2===null&&R("ledger-storage",O.storageUsdPerGbMonth),c.disk===null&&R("ledger-storage",O.sandboxDiskUsdPerGbMonth),c.r2===null&&c.disk===null)return o;const m=r?.state?.slice(0,7)??null,i=[];if(m===null)i.push(d);else for(let n=k(m);n<=d;n=k(n))i.push(n);for(const n of i){if(o.month=n,!await this.settleMonth(n,c,r,o))break;await r?.save(n)}return(o.rows>0||o.failed>0)&&y({level:"info",event:"ledger.storage.settled",outcome:"succeeded",fields:{...o}}),o}async settleMonth(e,r,d,o){const{r2:c,disk:m}=r,i=W(e),n=await N(),g=new Map,h=b(t=>{let a=g.get(t);return a||g.set(t,a={bytes:0,diskGb:0}),a},"entry");for(const t of await n.prepare("SELECT split_part(blob_key, '/', 2) AS node, sum(bytes) AS bytes FROM conversation_parts WHERE created < ? GROUP BY 1").all(i))h(t.node).bytes+=Number(t.bytes);for(const t of await n.prepare(`SELECT x.node, sum(u.size) AS bytes FROM (
1
+ var T=Object.defineProperty;var b=(s,t)=>T(s,"name",{value:t,configurable:!0});import{openDb as N}from"../../core/canvas/db.js";import{getNode as A}from"../../core/canvas/canvas.js";import{LEDGER_ENV as S,sandboxDiskUsdPerGbMonth as O,storageUsdPerGbMonth as R,warnRateUnset as M}from"../../core/ledger/rates.js";import{emitEvent as E}from"../../core/events/emit.js";import{operationIdContext as D}from"../../core/events/operation-id.js";import{billingAccountOf as G}from"../../core/ledger/account.js";import{writeInfraCharge as I}from"../../core/ledger/infra-allowance.js";import{usageMonth as h}from"../../core/ledger/months.js";import{startCandidateOf as v}from"../../core/runtime/start-check.js";import{runThrottledLane as C}from"./throttled-lane.js";const U=60*6e4,P=10*6e4,F=1024**3;async function ee(){if(R()===null&&O()===null)return;const s=await(await N()).prepare("SELECT cursor FROM reconciler_leases WHERE lane = 'ledger-storage' AND key = ''").get(),t=s?.cursor==null?null:JSON.parse(s.cursor).state;return t===null?null:t.slice(0,7)}b(ee,"storageSettledThrough");function W(s){const[t,o]=s.split("-").map(Number);return h(new Date(Date.UTC(t,o-2,1)))}b(W,"previousMonth");const k=b(s=>{const[t,o]=s.split("-").map(Number);return h(new Date(Date.UTC(t,o,1)))},"nextMonth"),B=b(s=>{const[t,o]=s.split("-").map(Number);return new Date(Date.UTC(t,o,1)).toISOString()},"endOf");class te{static{b(this,"LedgerStorageReconciler")}run(t,o){if(!o.lifecycle.acceptsDetachedWork())return;const d=D.fresh(()=>C("ledger-storage","",t,U,P,async r=>{await this.pass(t,r)})).then(()=>{}).catch(r=>{D.fresh(()=>E({level:"error",event:"ledger.storage.failed",error:r}))});o.lifecycle.registerDetached(d)}async pass(t,o){const d=W(h(new Date(t))),r={month:null,rows:0,failed:0},c={r2:R(),disk:O()};if(c.r2===null&&M("ledger-storage",S.storageUsdPerGbMonth),c.disk===null&&M("ledger-storage",S.sandboxDiskUsdPerGbMonth),c.r2===null&&c.disk===null)return r;const m=o?.state?.slice(0,7)??null,i=[];if(m===null)i.push(d);else for(let n=k(m);n<=d;n=k(n))i.push(n);for(const n of i){if(r.month=n,!await this.settleMonth(n,c,o,r))break;await o?.save(n)}return(r.rows>0||r.failed>0)&&E({level:"info",event:"ledger.storage.settled",outcome:"succeeded",fields:{...r}}),r}async settleMonth(t,o,d,r){const{r2:c,disk:m}=o,i=B(t),n=await N(),_=new Map,g=b(e=>{let a=_.get(e);return a||_.set(e,a={bytes:0,diskGb:0}),a},"entry");for(const e of await n.prepare("SELECT split_part(blob_key, '/', 2) AS node, sum(bytes) AS bytes FROM conversation_parts WHERE created < ? GROUP BY 1").all(i))g(e.node).bytes+=Number(e.bytes);for(const e of await n.prepare(`SELECT x.node, sum(u.size) AS bytes FROM (
2
2
  SELECT DISTINCT upload_id, split_part(blob_key, '/', 2) AS node FROM upload_uses WHERE blob_key LIKE 'attachments/%') x
3
- JOIN uploads u ON u.upload_id = x.upload_id WHERE u.created_at < ? GROUP BY x.node`).all(i))h(t.node).bytes+=Number(t.bytes);for(const t of await n.prepare(`SELECT x.node_id AS node, sum(e.memory_mb) AS mb FROM (
3
+ JOIN uploads u ON u.upload_id = x.upload_id WHERE u.created_at < ? GROUP BY x.node`).all(i))g(e.node).bytes+=Number(e.bytes);for(const e of await n.prepare("SELECT node_id AS node, sum(size) AS bytes FROM files WHERE completed_at IS NOT NULL AND completed_at < ? GROUP BY node_id").all(i))g(e.node).bytes+=Number(e.bytes);for(const e of await n.prepare(`SELECT x.node_id AS node, sum(e.memory_mb) AS mb FROM (
4
4
  SELECT DISTINCT node_id, sandbox_name FROM executions WHERE runner = 'blaxel' AND sandbox_name IS NOT NULL AND started_at < ?) x
5
- JOIN nodes n ON n.node_id = x.node_id JOIN objects o ON o.id = n.node_id AND (o.deleted_at IS NULL OR o.deleted_at >= ?) JOIN profiles p ON p.id = n.profile_id JOIN environments e ON e.object = p.environment_id GROUP BY x.node_id`).all(i,i))h(t.node).diskGb+=Number(t.mb)/2/1024;const _=new Map;for(const[t,a]of g){const p=await G(t),u=p===null?null:await A(p);if(u===null)continue;const f=_.get(u.payer)??{sub:u.sub,grantee:u.grantee,bytes:0,diskGb:0,node:t};f.bytes+=a.bytes,f.diskGb+=a.diskGb,_.set(u.payer,f)}const x=new Date(Date.parse(i)-1);let E=0;for(const[t,a]of _){if(d&&!await d.holds())return!1;try{const{account:p,billable:u}=await I(n,t),f=[{id:`storage:${t}:${e}:r2`,provider:"r2",gbMonths:a.bytes/F,rate:c},{id:`storage:${t}:${e}:blaxel`,provider:"blaxel",gbMonths:a.diskGb,rate:m}];for(const l of f){if(l.rate===null||l.gbMonths<=0)continue;const T=l.gbMonths*l.rate;(await L({id:l.id,at:x,kind:"storage",what:l.provider==="r2"?"object storage":"sandbox disk",units:{gb_months:l.gbMonths},usd:T,payer:t,funding:"bill",sub:a.sub,grantee:a.grantee,provider:l.provider,causedBy:null,account:p},u)).written&&(o.rows+=1)}}catch(p){o.failed+=1,E+=1,y({level:"warn",event:"ledger.storage.payer_failed",error:p,fields:{payer:t,month:e}})}}return E===0}}export{U as LEDGER_STORAGE_INTERVAL_MS,te as LedgerStorageReconciler,ee as storageSettledThrough};
5
+ JOIN nodes n ON n.node_id = x.node_id JOIN objects o ON o.id = n.node_id AND (o.deleted_at IS NULL OR o.deleted_at >= ?) JOIN profiles p ON p.id = n.profile_id JOIN environments e ON e.object = p.environment_id GROUP BY x.node_id`).all(i,i))g(e.node).diskGb+=Number(e.mb)/2/1024;const y=new Map;for(const[e,a]of _){const p=await A(e),u=p===null?null:await v(p);if(u===null)continue;const f=y.get(u.payer)??{sub:u.sub,grantee:u.grantee,bytes:0,diskGb:0,node:e};f.bytes+=a.bytes,f.diskGb+=a.diskGb,y.set(u.payer,f)}const x=new Date(Date.parse(i)-1);let w=0;for(const[e,a]of y){if(d&&!await d.holds())return!1;try{const{account:p,billable:u}=await G(n,e),f=[{id:`storage:${e}:${t}:r2`,provider:"r2",gbMonths:a.bytes/F,rate:c},{id:`storage:${e}:${t}:blaxel`,provider:"blaxel",gbMonths:a.diskGb,rate:m}];for(const l of f){if(l.rate===null||l.gbMonths<=0)continue;const L=l.gbMonths*l.rate;(await I({id:l.id,at:x,kind:"storage",what:l.provider==="r2"?"object storage":"sandbox disk",units:{gb_months:l.gbMonths},usd:L,payer:e,funding:"bill",sub:a.sub,grantee:a.grantee,provider:l.provider,causedBy:null,account:p},u)).written&&(r.rows+=1)}}catch(p){r.failed+=1,w+=1,E({level:"warn",event:"ledger.storage.payer_failed",error:p,fields:{payer:e,month:t}})}}return w===0}}export{U as LEDGER_STORAGE_INTERVAL_MS,te as LedgerStorageReconciler,ee as storageSettledThrough};
@@ -1,21 +1,26 @@
1
1
  ---
2
2
  title: Files and documents
3
- description: Download a file from a person's runtime with files.download, and read the person's public documents with memory.list and memory.get.
3
+ description: Download a file from a person's runtime with files.download, serve a file an agent handed to the person with files.link, and read the person's public documents with memory.list and memory.get.
4
4
  ---
5
5
 
6
6
  # Files and documents
7
7
 
8
8
  ## Download a file
9
9
 
10
- `runtime.files.download(path, options?)` returns the file's raw bytes as a Fetch `Response` (200, or 206 for a `range`) with `Content-Type`, `Content-Length` and `Content-Range`, so you can pipe its body on. `path` is an absolute path on the person's runtime that your app's grant lets it read. Options: `range` (one `Range` header value such as `bytes=0-0` or `bytes=-500`) and `signal`.
10
+ `runtime.files.download(path, options?)` returns the file's raw bytes as a Fetch `Response` (200, or 206 for a `range`) with `Content-Type`, `Content-Length` and `Content-Range`, so you can pipe its body on. `path` is an absolute path on the person's runtime that your app's grant lets it read. Options: `range` (one `Range` header value such as `bytes=0-0` or `bytes=-500`) and `signal`. A non-2xx answer is thrown as an `APIError`, never returned as bytes; a bad `range` is `416`. A cloud role refuses it with `permission_error`: use `files.link` there. What a path may reach depends on the grant: see [Scopes and grants](/docs/concepts/scopes-and-grants).
11
+
12
+ ## Receive a file an agent made
13
+
14
+ An agent gives the person a file with `crtr push file <path>`. The file is copied to storage and a `file.sent` event (`{file_id, name, media_type, size}`) appears in the run's event stream. Your app then serves it by `file_id`; the agent's own paths are never exposed, and only the app and person that own the run can reach the file.
15
+
16
+ `runtime.files.link(fileId, options?)` returns `{url, expires_at, name, media_type, size}`: a short-lived signed download URL. Redirect the person to it or fetch it from your server; call `link` again for a fresh one. A file of another app, another person, or a run your app may not read is `not_found`.
11
17
 
12
18
  ```ts
13
- const response = await runtime.files.download('/apps/<your client id>/files/report.pdf');
14
- res.setHeader('content-type', response.headers.get('content-type') ?? 'application/octet-stream');
15
- await pipeline(Readable.fromWeb(response.body!), res);
19
+ const {url, name} = await runtime.files.link(event.file_id);
20
+ res.redirect(url);
16
21
  ```
17
22
 
18
- A non-2xx answer is thrown as an `APIError`, never returned as bytes. A bad `range` is `416`, `invalid_request` with `param: 'range'`. A body cut short mid-stream means the file could not be read to the end. What a path may reach depends on the grant: see [Scopes and grants](/docs/concepts/scopes-and-grants). The client your app gets from `oauth.client(userId)` exposes only `download` from `files`; reading, writing and listing are not available to apps.
23
+ `runtime.shares.create({file_id, expires_at?})` makes a public share link from the same file instead. `shares.create({path, expires_at?})` shares a file by path (refused on a cloud role); pass exactly one of `path` or `file_id`. The client your app gets from `oauth.client(userId)` exposes only `download` and `link` from `files`; reading, writing and listing are not available to apps.
19
24
 
20
25
  ## Read the person's public documents
21
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.658",
3
+ "version": "0.3.660",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -149,7 +149,7 @@
149
149
  },
150
150
  "license": "UNLICENSED",
151
151
  "dependencies": {
152
- "@north-light/identity": "0.3.658",
152
+ "@north-light/identity": "0.3.660",
153
153
  "@earendil-works/chord": "1.5.2",
154
154
  "@earendil-works/pi-agent-core": "1.5.2",
155
155
  "@earendil-works/pi-ai": "1.5.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/identity",
3
- "version": "0.3.658",
3
+ "version": "0.3.660",
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.658",
3
+ "version": "0.3.660",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/cli",
9
- "version": "0.3.658",
9
+ "version": "0.3.660",
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.658",
31
+ "@north-light/identity": "0.3.660",
32
32
  "cron-parser": "^5.6.0",
33
33
  "esbuild": "0.28.2",
34
34
  "jose": "^6.2.12",
@@ -10666,17 +10666,17 @@
10666
10666
  },
10667
10667
  "packages/crouter-api": {
10668
10668
  "name": "@north-light/api",
10669
- "version": "0.3.658",
10669
+ "version": "0.3.660",
10670
10670
  "license": "UNLICENSED"
10671
10671
  },
10672
10672
  "packages/crouter-env-docker": {
10673
10673
  "name": "@north-light/env-docker",
10674
- "version": "0.3.658",
10674
+ "version": "0.3.660",
10675
10675
  "license": "UNLICENSED"
10676
10676
  },
10677
10677
  "packages/crouter-identity": {
10678
10678
  "name": "@north-light/identity",
10679
- "version": "0.3.658",
10679
+ "version": "0.3.660",
10680
10680
  "license": "UNLICENSED",
10681
10681
  "dependencies": {
10682
10682
  "jose": "^6.2.1"
@@ -10684,21 +10684,21 @@
10684
10684
  },
10685
10685
  "packages/crouter-plugin": {
10686
10686
  "name": "@north-light/plugin",
10687
- "version": "0.3.658",
10687
+ "version": "0.3.660",
10688
10688
  "license": "UNLICENSED",
10689
10689
  "dependencies": {
10690
- "@north-light/api": "0.3.658",
10691
- "@north-light/identity": "0.3.658"
10690
+ "@north-light/api": "0.3.660",
10691
+ "@north-light/identity": "0.3.660"
10692
10692
  }
10693
10693
  },
10694
10694
  "packages/crouter-sdk": {
10695
10695
  "name": "@north-light/sdk",
10696
- "version": "0.3.658",
10696
+ "version": "0.3.660",
10697
10697
  "license": "UNLICENSED",
10698
10698
  "dependencies": {
10699
- "@north-light/api": "0.3.658",
10700
- "@north-light/identity": "0.3.658",
10701
- "@north-light/plugin": "0.3.658",
10699
+ "@north-light/api": "0.3.660",
10700
+ "@north-light/identity": "0.3.660",
10701
+ "@north-light/plugin": "0.3.660",
10702
10702
  "jose": "^6.2.1"
10703
10703
  },
10704
10704
  "bin": {