@north-light/cli 0.3.669 → 0.3.670
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/core/runtime/broker/bash-job-launch.d.ts +4 -0
- package/dist/core/runtime/broker/bash-job-launch.js +1 -1
- package/dist/core/runtime/runner/blaxel/runner.js +2 -2
- package/dist/core/runtime/runner/types.d.ts +2 -1
- package/dist/daemon/api/handlers/messages.js +2 -2
- package/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +2 -1
- package/dist/pi-extensions/canvas-tool-guide.d.ts +3 -1
- package/dist/pi-extensions/canvas-tool-guide.js +4 -4
- package/package.json +3 -3
- package/packages/crouter-api/dist/core/runtime/broker/bash-job-launch.js +4 -5
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.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/scripts/sandbox-bootstrap.sh +4 -0
|
@@ -3,6 +3,10 @@ import { type BashJobPaths } from '../../bash-jobs.js';
|
|
|
3
3
|
* launcher. A sandbox broker (`CRTR_API_URL` set) runs on another machine, so it spawns its supervisor itself
|
|
4
4
|
* and reports the job through `report`. */
|
|
5
5
|
export declare function bashJobsUseLauncher(): boolean;
|
|
6
|
+
/** The supervisor's optional notify arguments: the machine daemon's socket, the node and the job, only where a machine daemon runs beside the broker — an
|
|
7
|
+
* install with `machine.json`, i.e. a Mac that is a machine environment. That Mac's brokers also have `CRTR_API_URL` set, so it says nothing about the
|
|
8
|
+
* machine daemon. A sandbox has no `machine.json`, so it passes none and the supervisor skips the notice. */
|
|
9
|
+
export declare function exitNotifyArgs(nodeId: string, jobId: string): string[];
|
|
6
10
|
/** Start the supervisor for a job whose `cmd.sh` and `job.log` are already written.
|
|
7
11
|
* Resolves with the supervisor's process group and its launch-time identity, which
|
|
8
12
|
* lets a later cancellation reject a stale pid; it is not a containment guarantee. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=Object.defineProperty;var n=(o,r)=>p(o,"name",{value:r,configurable:!0});import{spawn as h}from"node:child_process";import{writeFileSync as s}from"node:fs";import{BASH_JOB_SUPERVISOR_SCRIPT as l}from"../../bash-job-supervisor.js";import{readBashNiceness as j}from"../../bash-jobs.js";import{capturePidIdentities as g}from"../../canvas/pid.js";import{apiSocketPath as S}from"../../canvas/paths.js";import{readMachineConfig as y}from"../../../daemon/machine-link/config.js";import{freshChildNodeExecPath as P}from"../branded-host.js";import{resolveAdmittedHostCommand as I}from"../spawn-env.js";import{brokerApiUrl as w,startBrokerBashJob as x}from"./daemon-ops.js";function B(){return process.platform==="linux"&&w()===void 0}n(B,"bashJobsUseLauncher");function A(o,r){try{if(y()===void 0)return[]}catch{return[]}return[S(),o,r]}n(A,"exitNotifyArgs");async function $(o,r,a,d,c){const u=await P();if(B()){const{pid:e}=await x(o,{job_id:r.jobId,cwd:d,env:c});return{pgid:e,identity:`launcher:${e}`}}const m=I("bash",c,d),t=h(m,["-c",l,"--",r.cmdSh,r.jobLog,r.jobExit,r.jobRun,r.jobDone,m,String(j(a)),u,r.jobActivity,...A(o,r.jobId)],{cwd:d,detached:!0,stdio:"ignore",env:c}),i=await new Promise((e,b)=>{t.once("error",b),t.pid!==void 0&&e(t.pid)});t.unref();const f=g([i])?.get(i);if(f===void 0){try{process.kill(-i,"SIGKILL")}catch{}throw new Error(`bash job ${r.jobId} started without a process identity`)}return s(r.jobPgid,String(i)),s(r.jobPgidIdentity,f),{pgid:i,identity:f}}n($,"launchBashJobSupervisor");export{B as bashJobsUseLauncher,A as exitNotifyArgs,$ as launchBashJobSupervisor};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var $=Object.defineProperty;var i=(n,a)=>$(n,"name",{value:a,configurable:!0});import{openDb as k}from"../../../canvas/db.js";import{mintExecutionToken as S}from"../../../canvas/node-tokens.js";import{BlaxelApiError as
|
|
1
|
+
var $=Object.defineProperty;var i=(n,a)=>$(n,"name",{value:a,configurable:!0});import{openDb as k}from"../../../canvas/db.js";import{mintExecutionToken as S}from"../../../canvas/node-tokens.js";import{BlaxelApiError as T,isWorkloadUnavailable as m}from"./client.js";const f=4180,w="view",I="node /opt/crtr/current/scripts/sandbox-start.mjs --wake",y=3,C=/^crtr-sandbox-start: failed (\S+)/m,h=2e3,p=i(n=>`broker-${n}`,"brokerProcessName"),d=i(n=>n.sandboxName??`${n.nodeId}-${n.attempt}`,"sandboxNameFor");async function A(n){const a=await(await k()).prepare("SELECT execution_id, attempt, sandbox_name FROM executions WHERE node_id = ? AND runner = 'blaxel'").all(n);return[...new Set(a.map(c=>d({executionId:c.execution_id,nodeId:n,attempt:Number(c.attempt),sandboxName:c.sandbox_name})))]}i(A,"defaultSandboxNames");function N(n){const a=`${n.logs}
|
|
2
2
|
${n.stderr}
|
|
3
|
-
${n.stdout}
|
|
3
|
+
${n.stdout}`,c=(n.stderr||n.logs||n.stdout||"").trim().slice(-h);return{state:"failed",reason:C.exec(a)?.[1]??"start_failed",code:n.exitCode,...c===""?{}:{output:c}}}i(N,"failureOf");function L(n){const{client:a}=n,c=(n.stopGraceS??10)*1e3,E=new Map;async function u(t){return await a.getSandbox(d(t))}i(u,"sandboxOf");async function g(t,r){if(!/^[A-Za-z0-9_-]+$/.test(r))throw new Error(`execution id ${JSON.stringify(r)} is not safe to name in a command`);const e=Math.max(1,Math.ceil(c/1e3)),o=`p='[b]roker-cli\\.js .*--epoch ${r}( |$)'; pkill -TERM -f "$p"; i=0; while pgrep -f "$p" >/dev/null && [ $i -lt ${e*5} ]; do sleep 0.2; i=$((i+1)); done; pkill -KILL -f "$p"; sleep 0.3; ! pgrep -f "$p"`;return(await a.exec(t,`stop-${r}-${Date.now()}`,o,e+20)).exitCode===0}return i(g,"brokerGone"),{kind:"blaxel",async start(t){const r=await n.launchContext(t),e=d(t),o=await a.createSandbox({name:e,image:r.image,memoryMb:r.memoryMb,ports:[{name:w,target:f}]}),s=p(t.executionId);if((await a.getProcess(o,s))?.status==="running")return{pid:null,exited:null};await a.ensurePreview(e,w,f);const x=await(n.mintToken??(b=>S(b.executionId,b.nodeId)))(t),R={...r.secrets,CRTR_API_URL:r.apiUrl,CRTR_EXECUTION_ID:t.executionId,CRTR_NODE_TOKEN:x,CRTR_RELEASE:t.release,CRTR_RELEASE_URL:r.releaseUrl,CRTR_RELEASE_SHA256:r.releaseSha256};return await a.startProcess(o,{name:s,command:n.bootstrap(),env:R,waitForCompletion:!1}),{pid:null,exited:null}},async wake(t){const r=await u(t);if(r===null)return"no_broker";try{const e=await a.exec(r,`wake-${t.executionId}-${Date.now()}`,`${I} ${t.executionId}`,30);if(e.exitCode===0)return"signalled";if(e.exitCode===y)return"no_broker";throw new Error(`wake of ${t.executionId} failed (exit ${e.exitCode}): ${(e.stderr||e.logs).slice(0,300)}`)}catch(e){if(m(e))return"no_broker";throw e}},async stop(t,r){try{const e=await u(t);if(e===null)return{confirmed:!0};const o=p(t.executionId),s=i(async()=>(await a.getProcess(e,o))?.status==="running","running");if(await s()){await a.stopProcess(e,o);const l=Date.now()+c;for(;Date.now()<l&&await s();)await new Promise(x=>setTimeout(x,250));if(await s()&&await a.killProcess(e,o),await s())return{confirmed:!1}}return{confirmed:await g(e,t.executionId)}}catch(e){return m(e)?{confirmed:!0}:{confirmed:!1,error:e instanceof Error?e:new Error(String(e))}}},async status(t,r){try{const e=await u(t);if(e===null)return{state:"gone"};if(r?.idle===!0)return{state:"running",pid:null};const o=await a.getProcess(e,p(t.executionId));return o===null?{state:"gone"}:o.status==="running"?{state:"running",pid:null}:o.status==="failed"||o.status==="completed"&&o.exitCode!==0?N(o):{state:"gone"}}catch(e){return m(e)?{state:"gone"}:{state:"unknown",error:e instanceof Error?e.message:String(e)}}},async delete(t){for(const r of await(n.sandboxNamesForNode??A)(t))await a.deleteSandbox(r)},async deleteExecution(t){await a.deleteSandbox(d(t))},async viewerAddress(t){const r=d(t),e=E.get(r);if(e&&e.expiresAt-Date.now()>5*6e4)return _(e.url,e.token);const o=await a.ensurePreview(r,w,f),s=new Date(Date.now()+60*6e4),{token:l}=await a.createPreviewToken(r,w,s);return E.set(r,{url:o,token:l,expiresAt:s.getTime()}),_(o,l)},async sandboxState(t){return(await u(t))?.state??null}}}i(L,"createBlaxelRunner");function _(n,a){return{kind:"wss",url:`${n.replace(/^https:/,"wss:")}/view`,headers:{"x-blaxel-preview-token":a}}}i(_,"viewer");export{f as BROKER_VIEW_PORT,T as BlaxelApiError,y as EXIT_NO_BROKER,C as FAILURE_LINE,I as WAKE_COMMAND,p as brokerProcessName,L as createBlaxelRunner,d as sandboxNameFor};
|
|
@@ -43,7 +43,8 @@ export type RunnerStatus = {
|
|
|
43
43
|
| {
|
|
44
44
|
state: 'failed';
|
|
45
45
|
reason: string;
|
|
46
|
-
code: number | null;
|
|
46
|
+
code: number | null; /** The tail of the process's stderr (or its log), so a failure with no `crtr-sandbox-start: failed` line of its own still says why. */
|
|
47
|
+
output?: string;
|
|
47
48
|
}
|
|
48
49
|
/** The runner could not tell (a Blaxel API error). The caller leaves everything as it is and retries on the next claim. */
|
|
49
50
|
| {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ce=Object.defineProperty;var u=(t,e)=>ce(t,"name",{value:e,configurable:!0});import{randomBytes as ue}from"node:crypto";import{claimNodeMail as le,acknowledgeNodeMail as fe}from"../../../core/canvas/deliveries.js";import{nodeMailEntry as me}from"../../../core/feed/inbox.js";import{enqueueNodeMail as D,cancelPendingNodeMail as pe}from"../../../core/feed/messages.js";import{assertRecordedCwdExists as ye,reviveNode as L}from"../../../core/runtime/revive.js";import{BrokerUnreachableError as U}from"../../../core/runtime/broker-request.js";import{isBrokerLive as
|
|
2
|
-
`)[0].slice(0,120)}u(Ge,"label");function ie(t,e){return e===null?"":Y("reopen-final-report",{report:`${t}/${e}`},"This node previously completed work. Read this final report before acting on the new instruction.")}u(ie,"previousFinalReportCard");async function He(t,e,a){if(a!==null&&a!=="human"&&(await G(t,a))?.type==="node"){const o=await F(t,a);return{actor:o,senderNode:o}}if(a==="human")return{actor:await ve(t,
|
|
1
|
+
var ce=Object.defineProperty;var u=(t,e)=>ce(t,"name",{value:e,configurable:!0});import{randomBytes as ue}from"node:crypto";import{claimNodeMail as le,acknowledgeNodeMail as fe}from"../../../core/canvas/deliveries.js";import{nodeMailEntry as me}from"../../../core/feed/inbox.js";import{enqueueNodeMail as D,cancelPendingNodeMail as pe}from"../../../core/feed/messages.js";import{assertRecordedCwdExists as ye,reviveNode as L}from"../../../core/runtime/revive.js";import{BrokerUnreachableError as U}from"../../../core/runtime/broker-request.js";import{isBrokerLive as q}from"../../../core/runtime/model-swap.js";import{deliverLive as he,interruptLive as we}from"../../../core/runtime/interactive-deliver.js";import{isProfilePaused as be}from"../../../core/profiles/manifest.js";import{getNode as C,withFreshTerminalGuard as ge}from"../../../core/canvas/canvas.js";import{getById as G,nodeObject as F,ownerForGrantee as ve}from"../../../core/graph/objects.js";import{recordActedOn as _e}from"../../../core/graph/edges.js";import{recordWatch as H}from"../../../core/graph/watches.js";import{publish as V}from"../../../core/graph/events.js";import{readerFor as K}from"../reader.js";import{canRead as ke}from"../../../core/graph/access.js";import{withCanvasWrite as k}from"../../../core/canvas/db.js";import{getPendingStructuredRequestForNode as Q}from"../../../core/canvas/structured-requests.js";import{consumeDeadlineOnWake as X}from"../../../core/feed/messages.js";import{assertNotFinalized as M,assertFinalizedForReopen as Se,commitReopenResident as E}from"../../../core/runtime/reopen.js";import{admitLegacyStructuredOutput as $e}from"../../structured-requests/sidecar.js";import{assertOutputSchemaAccepted as Ne}from"../../../core/runtime/structured-output.js";import{appendSituationalContext as P,formatSituationalProse as je}from"../../../core/runtime/situational-context.js";import{formatDataCard as Y}from"../../../shared/generated-context.js";import{hasNoNaturalCycle as Ae}from"../../../core/runtime/revive-all.js";import{recordPendingParkActivity as Oe}from"../../park-pending.js";import{wantsExecution as qe}from"../../reconcilers/node-lifecycle/wants-execution.js";import{hasFreshGroundState as Ce}from"../../../core/runtime/revive.js";import{CrtrError as xe,notFound as x,usage as d}from"../../../core/errors.js";import{isStartRefusal as Re}from"../../../core/runtime/start-check.js";import{emitEvent as Fe}from"../../../core/events/emit.js";import{assertScope as Me}from"../../../core/scopes.js";import{InputError as I}from"../../../core/io.js";import{ApiError as Ee}from"../../../api/index.js";import{describeObject as Pe,stubOf as Ie}from"../../../core/peer/stubs.js";import{machineNameOf as Z}from"../../../core/peer/names.js";import{callerNode as Te,callerStub as Be,forwardVerb as ee,relayError as te,remoteStub as ze,unknownError as re,withMachine as ne}from"../../peer/forward.js";import{ownerOnly as Je}from"../router.js";import{personId as We}from"../../../core/canvas/person.js";const De=["critical","urgent","normal","deferred"];function oe(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw d(`${e} must be an object { kind, facts?, body? }`);const a=t,n=a.kind;if(typeof n!="string"||n.trim()==="")throw d(`${e}.kind is required`);if(!n.includes(":"))throw d(`${e}.kind must be namespaced (contain ':'): ${n}`);const r={kind:n},o=a.facts;if(o!==void 0){if(typeof o!="object"||o===null||Array.isArray(o))throw d(`${e}.facts must be an object of string or number values`);const c={};for(const[l,m]of Object.entries(o)){if(typeof m!="string"&&typeof m!="number")throw d(`${e}.facts.${l} must be a string or number`);c[l]=m}r.facts=c}const i=a.body;if(i!==void 0){if(typeof i!="string")throw d(`${e}.body must be a string`);r.body=i}return r}u(oe,"parseCardRequest");function ae(t,e){try{return Y(t.kind,t.facts??{},t.body??"")}catch(a){throw d(`${e}: ${a instanceof Error?a.message:String(a)}`)}}u(ae,"renderCard");function Le(t){if(typeof t!="object"||t===null)throw d("a message requires a JSON body { body, tier?, fresh? }");const e=t,a=e.body,n=e.fresh===!0,r=e.tier,o=e.situational_context,i=e.output_schema;if(i!=null&&typeof i!="string")throw d("output_schema must be a JSON schema string");const c=typeof a=="string"&&a.trim()!=="",l=typeof o=="string"&&o.trim()!=="",m=typeof i=="string"&&i.trim()!=="",v=e.situational_card,S=e.context_cards,b=v===void 0?void 0:oe(v,"situational_card");if(S!==void 0&&!Array.isArray(S))throw d("context_cards must be an array of { kind, facts?, body? }");const p=S?.map((N,$)=>oe(N,`context_cards[${$}]`));if(b!==void 0&&typeof o=="string"&&o!=="")throw d("situational_card and situational_context are mutually exclusive");const w=b!==void 0||p!==void 0&&p.length>0;if(!n&&!c&&!l&&!m&&!w)throw d("a message requires a non-empty body (or fresh: true, situational_context, a runtime card, or output_schema)");if(n&&p!==void 0&&p.length>0)throw d("context_cards cannot ride a fresh revive (no inbox entry carries them)");if(r!==void 0&&!De.includes(r))throw d(`invalid tier: ${String(r)} (expected critical|urgent|normal|deferred)`);const f={body:typeof a=="string"?a:""};r!==void 0&&(f.tier=r),n&&(f.fresh=!0),e.reopen===!0&&(f.reopen=!0),typeof o=="string"&&(f.situational_context=o),b!==void 0&&(f.situational_card=b),p!==void 0&&(f.context_cards=p),typeof i=="string"&&(f.output_schema=i),typeof e.from=="string"&&(f.from=e.from);const y=e.delivery;if(y!==void 0&&y!=="interactive")throw d(`invalid delivery: ${String(y)} (expected interactive)`);if(y==="interactive"){if(n||f.situational_context!==void 0||f.output_schema!==void 0)throw d("interactive delivery supports a body, runtime cards, and reopen only (no fresh, situational_context, or output_schema)");if(!c)throw d("interactive delivery requires a non-empty body");if(f.tier==="deferred")throw d("interactive delivery cannot be deferred");f.delivery="interactive"}return f}u(Le,"parseSendBody");function Ue(t){let e;try{e=JSON.parse(t)}catch{throw d("output_schema must be a JSON schema string")}if(typeof e!="object"||e===null||Array.isArray(e))throw d("output_schema must be a JSON schema object");return e}u(Ue,"parseSchema");function Ge(t){return t.split(`
|
|
2
|
+
`)[0].slice(0,120)}u(Ge,"label");function ie(t,e){return e===null?"":Y("reopen-final-report",{report:`${t}/${e}`},"This node previously completed work. Read this final report before acting on the new instruction.")}u(ie,"previousFinalReportCard");async function He(t,e,a){if(a!==null&&a!=="human"&&(await G(t,a))?.type==="node"){const o=await F(t,a);return{actor:o,senderNode:o}}if(a==="human")return{actor:await ve(t,We()),senderNode:null};const n=await K(t,e);return{actor:n.class==="person"?n.person:n.class==="app"?n.app:n.node,senderNode:n.class==="node"?n.node:null}}u(He,"messageActor");async function se(t,e,a,n,r,o){const i=await F(t,a),{actor:c,senderNode:l}=await He(t,e,n),m=r===null?{}:{pointer:r};await _e(t,c,i),l!==null&&l.id!==i.id&&await H(t,l,i,"message",{endsOn:o&&r!==null?`result:${r}`:"final"}),await V(t,{event:"messaged",object:i,actor:c,attrs:{},...m}),l!==null&&await V(t,{event:"sent",object:l,actor:l,attrs:{to:i.id},...m})}u(se,"recordMessage");function Ve(t,e){return new I({error:"deferred_no_natural_cycle",message:`${t} is ${e} with no natural next cycle ahead of it \u2014 a deferred message would never be delivered.`,next:"Use --tier normal, urgent, or critical to wake it now, or --reopen (with a body or --fresh) to re-task it first."})}u(Ve,"deferredNoNaturalCycle");async function Ke(t){if(!await Ce(t))throw new Ee(422,"unprocessable",`node ${t} has no goal/roadmap on disk \u2014 a fresh revive would resume amnesiac.`)}u(Ke,"assertRecoverableForFresh");function Qe(t,e){return t instanceof I?{error:t.payload.error,message:t.payload.message,next:t.payload.next,message_id:e}:t instanceof xe?{error:t.code,message:t.message,message_id:e}:Re(t)?{error:t.code,message:t.message,message_id:e}:{error:"wake_failed",message:"the target could not be woken; see the daemon log",message_id:e}}u(Qe,"wakeFailure");async function Xe(t,e){const a=typeof t.body=="object"&&t.body!==null&&!Array.isArray(t.body)?{...t.body}:t.body;typeof a=="object"&&a!==null&&delete a.from;const n=await ee(t,e,{method:"POST",path:`/v1/nodes/${encodeURIComponent(e)}/messages`,body:a});if(n.kind==="local")return null;if(n.kind==="unknown")throw re(e,n.unreachable);if(n.status>=400)throw te(n.status,n.body);return await k(async r=>{const o=await Te(r,t);if(o===null)return;const i=n.body?.object,c=await ze(r,e,"node",n.machine.id,i);await H(r,o,c,"message",{endsOn:"final"})}),{status:n.status,body:ne(n.body,n.machine)}}u(Xe,"forwardMessage");async function Ye(t){const e=await Ze(t);if(t.principal.class!=="forwarded"||typeof e.body!="object"||e.body===null)return e;const a=await k(async n=>{const r=await F(n,t.params.id);return await ke(n,await K(n,t),r)?await Pe(n,r):{id:r.id,type:r.type,kind:null,name:r.id,owner:null}});return{...e,body:{...e.body,object:a}}}u(Ye,"handleMessage");async function Ze(t){const e=t.params.id,a=await Xe(t,e);if(a!==null)return a;const n=await C(e);if(n===null)throw x(`unknown node: ${e}`,{received:e});const r=Le(t.body),o=r.tier??"normal",i=be(n.profile_id);r.reopen&&!i&&!q(n)&&await ye(e,n);const c=t.principal.class==="forwarded"?await k(async s=>(await Be(s,t))?.id??null):r.from??null;if(c!==null){const s=await C(c);s!==null&&Me(s,"crtr:act")}const l=c===null?null:await k(async s=>{const h=await G(s,c);return h===null?null:(await Ie(s,h))?.home_machine??null}),m=l===null?void 0:`${c} on ${Z(l)}`,v=t.principal.class==="broker"?t.principal.node:null,S=l===null?{}:{from_machine:Z(l)},b=r.body.trim()!=="",p=r.situational_card!==void 0?ae(r.situational_card,"situational_card"):r.situational_context!==void 0?je(r.situational_context.trim()):"",w=p!=="",f=(r.context_cards??[]).map((s,h)=>ae(s,`context_cards[${h}]`)),y=r.output_schema!==void 0&&r.output_schema.trim()!==""?Ue(r.output_schema):null;y!==null&&await Ne(y);let N=!1;const $=u(async s=>{if(!(y===null||N)){if(await Q(e)!==null)throw new I({error:"structured_request_conflict",message:`node ${e} already has a pending structured request`,next:"Wait for the current request to settle before requesting another structured result."});await $e(e,"oneoff",y,s),N=!0}},"ensureSchema");if(r.fresh){const s=r.reopen?await Se(e):null;r.reopen||await M(e),await Ke(e),await $(),w&&await P(e,p),r.reopen&&await E(e,s,v);const h=await L(e,{resume:!1,capacity:"refuse"});return{status:201,body:{node_id:e,delivered:!1,revived:h.launch!==void 0}}}r.delivery==="interactive"&&!r.reopen&&await M(e);let T=!1,_="";if(r.delivery==="interactive"&&r.reopen&&(_=ie(e,await E(e,void 0,v)),T=!0),r.delivery==="interactive"&&await $(),r.delivery==="interactive"&&!i&&!n.run_id&&q(n))try{return w&&await P(e,p),await he(e,r.body,{cards:[..._===""?[]:[_],...w?[p]:[],...f],origin:c==="human"?{type:"human"}:{type:"runtime",kind:"inbox",entries:[{...c===null?{}:{from:c},...m===void 0?{}:{fromName:m},kind:"message",tier:o}]}}),await k(async h=>await se(h,t,e,c,null,!1)),await X(e),{status:201,body:{node_id:e,delivered:!0,revived:!1,delivered_via:"engine"}}}catch(s){if(!(s instanceof U))throw s}const B=u(async()=>{r.reopen||await M(e);const s=ue(16).toString("hex"),h=u(async O=>await se(O,t,e,c,s,y!==null),"withinEnqueue");await $(s),w&&await P(e,p),r.reopen&&!T&&(_=ie(e,await E(e,void 0,v)));const R=[..._===""?[]:[_],...f],W=R.length>0?{cards:R}:{};if(b||y!==null){const O=b?r.body:`A one-off structured-output request has been granted. Submit a result matching the requested schema with the \`submit_result\` tool (\`request_id: "${(await Q(e))?.request_id??"<request-id>"}"\`) before you stop; after it is accepted, continue normally.`;return await D(e,{senderNodeId:c,...m===void 0?{}:{senderName:m},urgency:o,wake:1,kind:"message",messageId:s,withinEnqueue:h,label:Ge(O),bodyJson:{body:O,...S,...w?{situational:!0}:{},...W}})}return await D(e,{senderNodeId:c,...m===void 0?{}:{senderName:m},urgency:o,wake:1,kind:"message",messageId:s,withinEnqueue:h,label:w?"(ambient context updated)":"(context delivered)",bodyJson:{...w?{situational:!0}:{},situationalOnly:!0,...W}})},"deliverImmediate"),g=await u(async()=>{if(o==="deferred"){const s=await ge(e,Ae,B);if(s.kind==="missing")throw x(`unknown node: ${e}`,{received:e});if(s.kind==="terminal")throw Ve(e,s.status);return s.result}return await B()},"deliver")();g.urgency!=="deferred"&&await k(async()=>Oe(e));const j=await C(e);if(j===null)throw x(`unknown node: ${e}`,{received:e});n.frozen_at!==null&&await X(e);let z=!1,J=!1,A;if((r.reopen||j.lifecycle==="terminal"||!await qe(j))&&g.urgency!=="deferred"&&!i&&!q(j))try{const s=await L(e,{resume:!0,capacity:"freeze"});z=s.launch!==void 0,J=s.outcome==="frozen"}catch(s){A=Qe(s,g.messageId),Fe({level:"error",event:"message.wake_failed",node_id:e,error:s,fields:{message_id:g.messageId,error_code:A.error}})}return{status:201,body:{node_id:e,delivered:!0,revived:z,...J?{not_revived_reason:"capacity_frozen"}:{},...A===void 0?{}:{wake_failed:A},delivered_at:g.createdAt,...g.urgency===o?{}:{delivered_tier:g.urgency},...r.delivery==="interactive"?{delivered_via:"inbox"}:{}}}}u(Ze,"handleMessageHere");async function et(t){const e=t.params.id,a=await ee(t,e,{method:"POST",path:`/v1/nodes/${encodeURIComponent(e)}/interrupt`,body:t.body});if(a.kind==="unknown")throw re(e,a.unreachable);if(a.kind==="remote"){if(a.status>=400)throw te(a.status,a.body);return{status:a.status,body:ne(a.body,a.machine)}}const n=await C(e);if(n===null)throw x(`unknown node: ${e}`,{received:e});const r=await pe(e,{senderNodeId:"human",kind:"message"});let o=!1;if(q(n))try{o=await we(e)!=="idle"}catch(c){if(!(c instanceof U))throw c}return{status:200,body:{node_id:e,outcome:o?"aborted_turn":r.length>0?"canceled_pending":"idle",aborted_turn:o,canceled_pending:r.length}}}u(et,"handleInterrupt");function de(t){if(typeof t.body!="object"||t.body===null||Array.isArray(t.body))throw d("mail requires an object body");const e=t.body;if(typeof e.execution_id!="string"||e.execution_id.trim()==="")throw d("execution_id is required");return e}u(de,"mailBody");async function tt(t){const e=de(t),a=e.channel;if(a!=="wake"&&a!=="passive"&&a!=="deferred_run")throw d("channel must be wake, passive, or deferred_run");const n=await le(t.params.id,e.execution_id,a);return{status:200,body:{action:n.action,deliveries:n.deliveries.map(o=>({delivery_id:o.deliveryId,attempts:o.attempts,handoff:o.handoff,entry:{...me(o),seq:o.message.seq}}))}}}u(tt,"handleMailClaim");async function rt(t){const e=de(t);if(!Array.isArray(e.deliveries))throw d("deliveries must be an array");const a=e.deliveries.map(o=>{if(typeof o!="object"||o===null||Array.isArray(o))throw d("each delivery must be an object");const i=o;if(typeof i.delivery_id!="string"||i.delivery_id==="")throw d("delivery_id is required");if(!Number.isSafeInteger(i.attempts)||i.attempts<1)throw d("attempts must be a positive integer");if(i.disposition!=="acknowledged"&&i.disposition!=="released")throw d("disposition must be acknowledged or released");return{delivery_id:i.delivery_id,attempts:i.attempts,disposition:i.disposition}}),n=await fe(t.params.id,e.execution_id,a.map(o=>({deliveryId:o.delivery_id,attempts:o.attempts,disposition:o.disposition})));return{status:200,body:{action:n.action,results:n.results.map(o=>({delivery_id:o.deliveryId,outcome:o.outcome}))}}}u(rt,"handleMailAcknowledge");const Gt=Je([{method:"POST",pattern:"/v1/nodes/:id/mail/claim",handler:tt},{method:"POST",pattern:"/v1/nodes/:id/mail/acknowledge",handler:rt}]),Ht=[{method:"POST",pattern:"/v1/nodes/:id/messages",scope:"crtr:act",handler:Ye},{method:"POST",pattern:"/v1/nodes/:id/interrupt",scope:"crtr:act",handler:et}];export{Gt as brokerMailRoutes,Ye as handleMessage,Ht as messageRoutes};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
var h=Object.defineProperty;var a=(e,
|
|
1
|
+
var h=Object.defineProperty;var a=(e,n)=>h(e,"name",{value:n,configurable:!0});import{liveExecutionForNode as _,endExecution as p,recordExecutionAwake as x,endLaunchingExecution as d,requestExecutionStop as v}from"../../../core/canvas/executions.js";import{openDb as E}from"../../../core/canvas/db.js";import{isCloudRole as g}from"../../../core/canvas/person-state.js";import{getRow as b}from"../../../core/canvas/index.js";import{fullName as k}from"../../../core/canvas/labels.js";import{publishNotice as y}from"../../../core/runtime/close.js";import{emitEvent as s}from"../../../core/events/emit.js";import{findRefusal as $,refusalError as L,refusedMark as N,writeCharge as S}from"../../../core/ledger/index.js";import{transition as w}from"../../../core/runtime/lifecycle.js";import{runnerForExecution as f}from"../../../core/runtime/runner/index.js";import{machineEnvironmentOfProfile as A}from"../../../core/runtime/runner/machine/environment.js";import{startCandidateOf as R}from"../../../core/runtime/start-check.js";import{settleSandboxBeforeWake as D}from"../ledger-sandbox.js";import{crtrVersion as C}from"../../../shared/crtr-version.js";import{resolveEnvironmentImage as I}from"../recipe-image.js";import{recordRespawnPolicy as O}from"./respawn-policy.js";import{recordLaunchFailure as T}from"./launch-failure.js";const P=45*6e4,U=12e4,W=a(()=>C(),"acceptedRelease");async function re(e){return e===null||!g()?null:await A(e)}a(re,"remoteMachineEnvironmentOf");async function ae(e){const n=await R(e);if(n===null)return;const t={scope:"call",payer:n.payer,funding:"bill",sub:n.sub,grantee:n.grantee,provider:"blaxel"},r=await $(t),o=await E();if(r===null){await o.prepare("UPDATE nodes SET spend_refusal = NULL WHERE node_id = ? AND spend_refusal IS NOT NULL").run(e.node_id);return}throw await o.prepare("UPDATE nodes SET spend_refusal = ? WHERE node_id = ?").run(JSON.stringify({limit:r.limit.id,usd:r.usd,reset_at:r.reset_at,at:new Date().toISOString()}),e.node_id),await S({id:`refused:sandbox:${e.node_id}:${r.limit.id}:${r.month}`,kind:"sandbox",what:"wake",usd:null,payer:t.payer,funding:"bill",sub:t.sub,grantee:t.grantee,node:e.node_id,run:e.run_id??null,provider:"blaxel",refused:N(r)}),L(r)}a(ae,"checkBilledWake");class ie extends Error{static{a(this,"EnvironmentImagePending")}environmentId;imageError;constructor(n,t){super(`environment ${n} has no built image yet${t===null?"":` (${t})`}; the wake waits for the build.`),this.environmentId=n,this.imageError=t,this.name="EnvironmentImagePending"}}async function oe(e){return await I(e)}a(oe,"imageForWake");async function se(e){return e.release!==W()&&await v(e.nodeId,{afterTurn:!1,reason:"release"}),await f(e.runner).wake(e)==="no_broker"?(await p(e.executionId,{reason:"lost"}),"lost"):(await D(e.executionId,Date.now()),await x(e.executionId),"woken")}a(se,"wakeResident");async function ue(e){const n=await f(e.runner).status(e,{idle:e.idleAt!==null});if(n.state!=="gone"&&n.state!=="failed")return!1;const t=await p(e.executionId,{reason:"lost"});return t&&s({level:"warn",event:"execution.lost",node_id:e.nodeId}),t}a(ue,"endRemoteExecutionIfGone");async function le(e,n){const t=await _(e);if(t===null||t.state!=="launching"||t.runner==="process")return!1;const r=f(t.runner),o=n-Date.parse(t.startedAt),i=await r.status(t);if(i.state==="unknown")return!1;if(i.state==="running")return o<=P||!await d(t.executionId,{reason:"launch_timeout"})?!1:(await r.stop(t,{reason:"launch_timeout"}),await w(e,"crash",{reason:"launch_failed",outcome:{detail:{schema:"crtr.node-outcome-detail/v1",message:"the sandbox launch did not report within the launch deadline"}}}),s({level:"warn",event:"execution.launch_timeout",node_id:e}),!0);if(i.state==="failed"){if(!await d(t.executionId,{reason:"launch_failed"}))return!1;const l=`the sandbox start script failed: ${i.reason}`;await T(t.executionId,new Error(i.output===void 0?l:`${l}
|
|
2
|
+
${i.output}`));const c=await b(e);if(c!==null){const u=await O(c,n);if(!u.exhausted)s({level:"warn",event:"execution.launch_failed",node_id:e,fields:{reason:i.reason,consecutive_failures:u.failures}});else{const m=`Child crashed \u2014 ${k(c)} (${e}) failed ${u.failures} consecutive sandbox launches (${l}) and is now dead. It stays dead until you revive it \u2014 \`crtr node lifecycle revive ${e}\`.`;s({level:"error",event:"broker.respawn.exhausted",node_id:e}),await w(e,"crash",{reason:"crash_looped",outcome:{detail:{schema:"crtr.node-outcome-detail/v1",message:m,respawn_failures:u.failures}}}),await y(e,"notice.crash",m,{reason:"child-crashed",child:e})}}return await r.deleteExecution?.(t),!0}if(o>U){if(!await d(t.executionId,{reason:"launch_lost"}))return!1;s({level:"warn",event:"execution.launch_lost",node_id:e})}return!1}a(le,"recoverLaunching");export{ie as EnvironmentImagePending,P as LAUNCH_DEADLINE_MS,U as LAUNCH_LOST_GRACE_MS,W as acceptedRelease,ae as checkBilledWake,ue as endRemoteExecutionIfGone,oe as imageForWake,le as recoverLaunching,re as remoteMachineEnvironmentOf,se as wakeResident};
|
|
@@ -13,7 +13,9 @@ interface PiLike {
|
|
|
13
13
|
on(event: 'session_start', handler: (event: unknown, ctx: SessionStartCtxLike) => void | Promise<void>): void;
|
|
14
14
|
on(event: 'before_agent_start', handler: (event: BeforeAgentStartEventLike) => {
|
|
15
15
|
systemPrompt: string;
|
|
16
|
-
} | void
|
|
16
|
+
} | void | Promise<{
|
|
17
|
+
systemPrompt: string;
|
|
18
|
+
} | void>): void;
|
|
17
19
|
}
|
|
18
20
|
/** Register the root crtr tool-guide injection for a canvas node. */
|
|
19
21
|
export declare function registerCanvasToolGuide(pi: PiLike, release?: () => string): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
1
|
+
var v=Object.defineProperty;var i=(e,r)=>v(e,"name",{value:r,configurable:!0});import{envNodeId as g,envScopes as y}from"../shared/env.js";import{crtrVersion as x}from"../shared/crtr-version.js";import{effectiveCommandPlugins as _}from"../core/command-plugins/presence.js";import{emitEvent as $}from"../core/events/emit.js";import{execFile as S}from"node:child_process";import{createHash as O}from"node:crypto";import{mkdirSync as j,readFileSync as w,writeFileSync as N}from"node:fs";import{homedir as k}from"node:os";import{dirname as C,join as I}from"node:path";import{promisify as R}from"node:util";const T=R(S),F=`
|
|
2
2
|
|
|
3
|
-
Guidelines:`;function
|
|
3
|
+
Guidelines:`;function G(e){const r=process.env.CRTR_PLUGINS_REVISION;return r!==void 0&&r!==""?r:_(e).map(t=>`${t.scope}:${t.name}@${t.version??""}:${t.root}`).sort().join("|")}i(G,"pluginsRevision");function b(e,r){const t=[r,e,y()?.join(",")??"",G(e)].join("\0"),o=O("sha1").update(t).digest("hex").slice(0,16);return I(k(),".cache","crouter",`crtr-tool-guide-${o}.json`)}i(b,"helpCacheFile");function l(e,r){const t=`<crtr-tool-guide>
|
|
4
4
|
${r}
|
|
5
|
-
</crtr-tool-guide>`,o=e.indexOf(
|
|
5
|
+
</crtr-tool-guide>`,o=e.indexOf(F);return o===-1?`${e}
|
|
6
6
|
|
|
7
7
|
${t}`:`${e.slice(0,o)}
|
|
8
8
|
|
|
9
|
-
${t}${e.slice(o)}`}i(
|
|
9
|
+
${t}${e.slice(o)}`}i(l,"injectToolGuide");function E(e,r=x){const t=g();if(t===void 0||t.trim()==="")return;let o="",m;function u(n,s,c){$({level:n==="failed"?"warn":"info",event:"broker.startup.tool_guide",duration_ms:performance.now()-s,...n==="failed"?{outcome:"failed"}:{},fields:{source:n,resumed:c}})}i(u,"emitSource");function p(n,s){const c=performance.now(),a=s.sessionManager.getBranch().some(f=>f.type==="message"),d=b(process.cwd(),r());try{const f=JSON.parse(w(d,"utf8"));if(typeof f.text=="string"&&f.text!==""){o=f.text,u("disk_cache",c,a);return}}catch{}m=h(d,c,a)}i(p,"refresh");async function h(n,s,c){try{const{stdout:a}=await T("crtr",["-h"],{timeout:1e4});o=a.trim();try{j(C(n),{recursive:!0}),N(n,JSON.stringify({text:o}),"utf8")}catch{}u("captured",s,c)}catch(a){console.error("[canvas-tool-guide] crtr -h capture failed:",a),u("failed",s,c)}}i(h,"capture"),e.on("session_start",p),e.on("before_agent_start",async n=>{if(await m,o!=="")return{systemPrompt:l(n.systemPrompt,o)}})}i(E,"registerCanvasToolGuide");var D=E;export{D as default,l as injectToolGuide,E as registerCanvasToolGuide};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.670",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
},
|
|
157
157
|
"license": "UNLICENSED",
|
|
158
158
|
"dependencies": {
|
|
159
|
-
"@north-light/identity": "0.3.
|
|
160
|
-
"@north-light/plugin": "0.3.
|
|
159
|
+
"@north-light/identity": "0.3.670",
|
|
160
|
+
"@north-light/plugin": "0.3.670",
|
|
161
161
|
"@earendil-works/chord": "1.5.2",
|
|
162
162
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
163
163
|
"@earendil-works/pi-ai": "1.5.2",
|
|
@@ -19,11 +19,10 @@ import { brokerApiUrl, startBrokerBashJob } from './daemon-ops.js';
|
|
|
19
19
|
export function bashJobsUseLauncher() {
|
|
20
20
|
return process.platform === 'linux' && brokerApiUrl() === undefined;
|
|
21
21
|
}
|
|
22
|
-
/** The supervisor's optional notify arguments: the machine daemon's socket, the node and the job, only
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return [];
|
|
22
|
+
/** The supervisor's optional notify arguments: the machine daemon's socket, the node and the job, only where a machine daemon runs beside the broker — an
|
|
23
|
+
* install with `machine.json`, i.e. a Mac that is a machine environment. That Mac's brokers also have `CRTR_API_URL` set, so it says nothing about the
|
|
24
|
+
* machine daemon. A sandbox has no `machine.json`, so it passes none and the supervisor skips the notice. */
|
|
25
|
+
export function exitNotifyArgs(nodeId, jobId) {
|
|
27
26
|
try {
|
|
28
27
|
if (readMachineConfig() === undefined)
|
|
29
28
|
return [];
|
|
@@ -121,7 +121,7 @@ export async function recoverLaunching(nodeId, now) {
|
|
|
121
121
|
if (!await endLaunchingExecution(execution.executionId, { reason: 'launch_failed' }))
|
|
122
122
|
return false;
|
|
123
123
|
const message = `the sandbox start script failed: ${status.reason}`;
|
|
124
|
-
await recordLaunchFailure(execution.executionId, new Error(message));
|
|
124
|
+
await recordLaunchFailure(execution.executionId, new Error(status.output === undefined ? message : `${message}\n${status.output}`));
|
|
125
125
|
// The same bounded sequence a local broker that keeps dying runs (`recordRespawnPolicy`): each failed launch is a consecutive
|
|
126
126
|
// failure and the backoff holds the next launch. The last one ends the node dead `crash_looped`.
|
|
127
127
|
const row = await getRow(nodeId);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.670",
|
|
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.670",
|
|
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.670",
|
|
31
|
+
"@north-light/identity": "0.3.670"
|
|
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.670",
|
|
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.670",
|
|
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.670",
|
|
32
|
+
"@north-light/plugin": "0.3.670",
|
|
33
33
|
"cron-parser": "^5.6.0",
|
|
34
34
|
"esbuild": "0.28.2",
|
|
35
35
|
"jose": "^6.2.12",
|
|
@@ -10667,17 +10667,17 @@
|
|
|
10667
10667
|
},
|
|
10668
10668
|
"packages/crouter-api": {
|
|
10669
10669
|
"name": "@north-light/api",
|
|
10670
|
-
"version": "0.3.
|
|
10670
|
+
"version": "0.3.670",
|
|
10671
10671
|
"license": "UNLICENSED"
|
|
10672
10672
|
},
|
|
10673
10673
|
"packages/crouter-env-docker": {
|
|
10674
10674
|
"name": "@north-light/env-docker",
|
|
10675
|
-
"version": "0.3.
|
|
10675
|
+
"version": "0.3.670",
|
|
10676
10676
|
"license": "UNLICENSED"
|
|
10677
10677
|
},
|
|
10678
10678
|
"packages/crouter-identity": {
|
|
10679
10679
|
"name": "@north-light/identity",
|
|
10680
|
-
"version": "0.3.
|
|
10680
|
+
"version": "0.3.670",
|
|
10681
10681
|
"license": "UNLICENSED",
|
|
10682
10682
|
"dependencies": {
|
|
10683
10683
|
"jose": "^6.2.1"
|
|
@@ -10685,21 +10685,21 @@
|
|
|
10685
10685
|
},
|
|
10686
10686
|
"packages/crouter-plugin": {
|
|
10687
10687
|
"name": "@north-light/plugin",
|
|
10688
|
-
"version": "0.3.
|
|
10688
|
+
"version": "0.3.670",
|
|
10689
10689
|
"license": "UNLICENSED",
|
|
10690
10690
|
"dependencies": {
|
|
10691
|
-
"@north-light/api": "0.3.
|
|
10692
|
-
"@north-light/identity": "0.3.
|
|
10691
|
+
"@north-light/api": "0.3.670",
|
|
10692
|
+
"@north-light/identity": "0.3.670"
|
|
10693
10693
|
}
|
|
10694
10694
|
},
|
|
10695
10695
|
"packages/crouter-sdk": {
|
|
10696
10696
|
"name": "@north-light/sdk",
|
|
10697
|
-
"version": "0.3.
|
|
10697
|
+
"version": "0.3.670",
|
|
10698
10698
|
"license": "UNLICENSED",
|
|
10699
10699
|
"dependencies": {
|
|
10700
|
-
"@north-light/api": "0.3.
|
|
10701
|
-
"@north-light/identity": "0.3.
|
|
10702
|
-
"@north-light/plugin": "0.3.
|
|
10700
|
+
"@north-light/api": "0.3.670",
|
|
10701
|
+
"@north-light/identity": "0.3.670",
|
|
10702
|
+
"@north-light/plugin": "0.3.670",
|
|
10703
10703
|
"jose": "^6.2.1"
|
|
10704
10704
|
},
|
|
10705
10705
|
"bin": {
|
|
@@ -41,6 +41,10 @@ if ! id "$RUN_USER" >/dev/null 2>&1; then
|
|
|
41
41
|
fi
|
|
42
42
|
mkdir -p /run/crtr /var/lib/crtr /work "$RELEASES"
|
|
43
43
|
chown "$RUN_USER" /run/crtr /var/lib/crtr /work
|
|
44
|
+
# Blaxel unpacks an image into a read-only layer that does not keep file ownership: everything the release image chowned to `crtr` at build
|
|
45
|
+
# (`/work/.crtr`, the home) is root-owned in the sandbox, and the start script, running as `crtr`, could not write `/work/.crtr/plugins-revision`.
|
|
46
|
+
# These are the small trees the image creates; they are handed over here on every boot.
|
|
47
|
+
for dir in /work/.crtr "/home/$RUN_USER"; do [ ! -e "$dir" ] || chown -R "$RUN_USER" "$dir"; done
|
|
44
48
|
# pi's grep tool wants ripgrep; the release image has it, and installing it once per sandbox avoids a GitHub download at the first grep.
|
|
45
49
|
rg=present
|
|
46
50
|
if ! command -v rg >/dev/null 2>&1; then
|