@north-light/cli 0.3.671 → 0.3.672
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/runner/blaxel/image-build.d.ts +3 -0
- package/dist/core/runtime/runner/blaxel/image-build.js +5 -5
- package/package.json +3 -3
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +13 -5
- 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-start.mjs +8 -1
|
@@ -19,6 +19,9 @@ export declare const RUN_USER = "crtr";
|
|
|
19
19
|
export declare const RECIPE_PI_AGENT_DIR = "/var/lib/crtr/recipe-pi-agent";
|
|
20
20
|
export declare const SETUP_SCRIPT_FILE = "recipe-setup.sh";
|
|
21
21
|
export declare const REPOS_DIR = "repos";
|
|
22
|
+
/** Where the image keeps the setup script's output, and its exit status when it failed. `sandbox-start.mjs` reads both (it derives them from `/work/.crtr`). */
|
|
23
|
+
export declare const SETUP_LOG_FILE = "/work/.crtr/setup.log";
|
|
24
|
+
export declare const SETUP_FAILED_FILE = "/work/.crtr/setup-failed";
|
|
22
25
|
/** The Dockerfile for a recipe revision. Pure. It clones and fetches nothing: the repositories arrive by `COPY`, so a git token cannot appear here.
|
|
23
26
|
* Two stages: `build` runs the setup script as root; the final image copies only the installed trees out of it, never `/root`. With `packagesToken`
|
|
24
27
|
* the build stage declares `ARG NODE_AUTH_TOKEN` (its value comes from `.env.build` in the upload), so the token is in no layer of the final image. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).map(
|
|
3
|
-
`)}l(
|
|
4
|
-
`,{mode:384}),e.recipe.setup_script!==null&&e.recipe.setup_script.trim()!==""&&
|
|
1
|
+
var F=Object.defineProperty;var l=(e,t)=>F(e,"name",{value:t,configurable:!0});import{spawn as M}from"node:child_process";import{constants as N,lstatSync as K,mkdirSync as Y,readFileSync as j,readdirSync as z,readlinkSync as q,rmSync as H,writeFileSync as U}from"node:fs";import{join as g,relative as J}from"node:path";import{crc32 as W,deflateRawSync as V}from"node:zlib";import{BlaxelApiError as Z}from"./client.js";const Q="public.ecr.aws/docker/library/node:24-alpine",X="ghcr.io/blaxel-ai/sandbox:latest",m="crtr",S="/var/lib/crtr/recipe-pi-agent",ee="1.1.0",$="recipe-setup.sh",_="repos",v="/work/.crtr/setup.log",A="/work/.crtr/setup-failed",D=l(e=>`'${e.replace(/'/g,"'\\''")}'`,"shellQuote"),te=l(e=>(e??"").split(`
|
|
2
|
+
`).map(t=>t.trim()).filter(t=>t!==""),"lines"),I=l((e,t)=>`RUN { ${t}; } >> ${v} 2>&1 || echo ${D(e)} "exited $?" >> ${A}`,"guarded");function re(e,t,a=!1){const o=te(e.pi_packages),i=e.setup_script!==null&&e.setup_script.trim()!=="",n=[`FROM ${Q}`,"RUN apk add --no-cache bash git curl ripgrep",`COPY --from=${X} /sandbox-api /usr/local/bin/sandbox-api`,`RUN adduser -D -h /home/${m} -s /bin/sh ${m} && mkdir -p /work/.crtr ${S} && chown -R ${m} /work /var/lib/crtr`],r=[`${n[0]} AS build`,...a?["ARG NODE_AUTH_TOKEN"]:[],...n.slice(1),`RUN rm -f ${A} ${v}`,I("npm install -g pnpm","npm install -g pnpm && mkdir -p /var/lib/postgresql")];e.repositories.length>0&&r.push(`COPY --chown=${m} ${_}/ /work/`),o.length>0&&r.push(I("npm install pi",`npm install -g @earendil-works/pi-coding-agent@${ee}`)),i&&r.push(`COPY ${$} /tmp/${$}`),r.push("WORKDIR /work");for(const s of o)r.push(I(`pi install ${s}`,`HOME=/var/lib/crtr PI_CODING_AGENT_DIR=${S} pi install ${D(s)}`));i&&r.push(I("setup script",`bash /tmp/${$}`)),r.push(I("finalize",`echo ${Math.trunc(t)} > /work/.crtr/recipe-revision && chown -R ${m} /work /home/${m} /var/lib/crtr`)),r.push("",...n);for(const s of["/work",`/home/${m}`,"/usr/local","/var/lib/crtr","/usr","/etc","/lib"])r.push(`COPY --from=build ${s} ${s}`);return r.push("COPY --from=build /var/lib/postgresql /var/lib/postgresql"),a&&r.push(`RUN rm -f /work/.npmrc /home/${m}/.npmrc`),r.push("WORKDIR /work",'ENTRYPOINT ["/usr/local/bin/sandbox-api"]',""),r.join(`
|
|
3
|
+
`)}l(re,"recipeDockerfile");const ne=l((e,t,a)=>new Promise((o,i)=>{const n=M("git",e,{cwd:a,env:{...process.env,...t,GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","ignore","pipe"]});let r="";n.stderr.on("data",s=>{r+=s.toString()}),n.on("error",i),n.on("close",s=>{s===0?o():i(new Error(`git ${e[0]} failed (${s}): ${r.slice(0,300)}`))})}),"runGit");async function ue(e){const t=e.git??ne,a=e.packagesToken??null,o=e.cloneUrl??(n=>`https://github.com/${n}.git`);Y(g(e.dir,_),{recursive:!0});const i=e.token===null?{}:{GIT_CONFIG_COUNT:"1",GIT_CONFIG_KEY_0:"http.https://github.com/.extraheader",GIT_CONFIG_VALUE_0:`AUTHORIZATION: basic ${Buffer.from(`x-access-token:${e.token}`).toString("base64")}`};for(const n of e.recipe.repositories){if(!/^[A-Za-z0-9._-]+$/.test(n.name)||n.name==="."||n.name==="..")throw new Error(`repository name ${JSON.stringify(n.name)} is not a plain directory name`);await t(["clone","--quiet","--branch",n.default_branch,o(n.github_full_name),g(_,n.name)],i,e.dir)}U(g(e.dir,"Dockerfile"),re(e.recipe,e.revision,a!==null)),a!==null&&U(g(e.dir,".env.build"),`NODE_AUTH_TOKEN=${a}
|
|
4
|
+
`,{mode:384}),e.recipe.setup_script!==null&&e.recipe.setup_script.trim()!==""&&U(g(e.dir,$),e.recipe.setup_script.endsWith(`
|
|
5
5
|
`)?e.recipe.setup_script:`${e.recipe.setup_script}
|
|
6
|
-
`)}l(
|
|
6
|
+
`)}l(ue,"prepareBuildDir");function P(e,t,a){for(const o of z(t).sort()){const i=g(t,o),n=K(i),r=J(e,i).split("\\").join("/");n.isDirectory()?P(e,i,a):n.isSymbolicLink()?a.push({name:r,data:Buffer.from(q(i)),mode:N.S_IFLNK|511}):n.isFile()&&a.push({name:r,data:j(i),mode:N.S_IFREG|n.mode&511})}}l(P,"walk");function se(e){const t=[];P(e,e,t);const a=[],o=[];let i=0;for(const s of t){const u=Buffer.from(s.name),h=V(s.data),b=W(s.data),p=Buffer.alloc(30);p.writeUInt32LE(67324752,0),p.writeUInt16LE(20,4),p.writeUInt16LE(2048,6),p.writeUInt16LE(8,8),p.writeUInt32LE(33,12),p.writeUInt32LE(b,14),p.writeUInt32LE(h.length,18),p.writeUInt32LE(s.data.length,22),p.writeUInt16LE(u.length,26),a.push(p,u,h);const c=Buffer.alloc(46);c.writeUInt32LE(33639248,0),c.writeUInt16LE(788,4),c.writeUInt16LE(20,6),c.writeUInt16LE(2048,8),c.writeUInt16LE(8,10),c.writeUInt32LE(33,14),c.writeUInt32LE(b,16),c.writeUInt32LE(h.length,20),c.writeUInt32LE(s.data.length,24),c.writeUInt16LE(u.length,28),c.writeUInt32LE(s.mode<<16>>>0,38),c.writeUInt32LE(i,42),o.push(c,u),i+=p.length+u.length+h.length}const n=Buffer.concat(o),r=Buffer.alloc(22);return r.writeUInt32LE(101010256,0),r.writeUInt16LE(t.length,8),r.writeUInt16LE(t.length,10),r.writeUInt32LE(n.length,12),r.writeUInt32LE(i,16),Buffer.concat([...a,n,r])}l(se,"zipDirectory");async function x(e,t,a,o,i=[]){const n=`${e.controlUrl??"https://api.blaxel.ai/v0"}${a}`,r=await(e.fetch??fetch)(n,{method:t,headers:{authorization:`Bearer ${e.apiKey}`,"x-blaxel-workspace":e.workspace,"content-type":"application/json"},...o===void 0?{}:{body:JSON.stringify(o)}}),s=await r.text();let u=null;if(s!=="")try{u=JSON.parse(s)}catch{u={raw:s}}if(!r.ok&&!i.includes(r.status))throw new Z(r.status,null,`Blaxel ${t} ${n} failed (${r.status}): ${s.slice(0,300)}`);return{status:r.status,headers:r.headers,json:u}}l(x,"api");async function B(e,t){const{status:a,json:o}=await x(e,"GET",`/images/sandbox/${encodeURIComponent(t)}`,void 0,[404]);return a===404?null:o}l(B,"getImage");async function fe(e,t){await x(e,"DELETE",`/images/sandbox/${encodeURIComponent(t)}`,void 0,[404])}l(fe,"deleteImage");async function me(e,t,a,o={}){const i=o.sleep??(f=>new Promise(w=>setTimeout(w,f))),n=o.now??Date.now,r=n(),s=await B(e,t),u=new Set((s?.spec?.tags??[]).map(f=>f.name)),h=s?.metadata?.events?.length??0,p=(await x(e,"POST","/images",{resourceType:"sandbox",name:t})).headers.get("x-blaxel-upload-url");if(p===null)throw new Error(`Blaxel gave no upload URL for image ${t}`);const c=await(e.fetch??fetch)(p,{method:"PUT",headers:{"content-type":"application/zip"},body:new Uint8Array(se(a))});if(!c.ok)throw new Error(`uploading the build context of image ${t} failed (${c.status}): ${(await c.text()).slice(0,300)}`);const G=r+(o.timeoutMs??20*6e4);let L=null;for(;;){const f=await B(e,t),w=f?.metadata?.status;if(w==="BUILT"&&(f?.metadata?.events?.length??0)>=h+2){L??=n();const E=(f?.spec?.tags??[]).filter(d=>d.name!==void 0),k=(f?.metadata?.events??[]).slice(h).map(d=>d.time??"").filter(d=>d!=="").sort()[0],O=l(d=>k!==void 0&&Date.parse(d??"")>=Date.parse(k),"touchedSince"),R=E.filter(d=>!u.has(d.name)||O(d.createdAt)||O(d.updatedAt)),T=n()-L>=(o.tagGraceMs??6e4),y=(R.length>0?R:T?E:[]).sort((d,C)=>(C.updatedAt??"").localeCompare(d.updatedAt??""))[0]?.name;if(y!==void 0)return{ref:`sandbox/${t}:${y}`,buildMs:n()-r};if(T)throw new Error(`Blaxel built image ${t} but no tag appeared`)}if(w==="FAILED"||w==="TERMINATED"){const E=f?.metadata?.events??[];throw new Error(`building image ${t} ${w.toLowerCase()}: ${E[E.length-1]?.message??"no message"}`)}if(n()>G)throw new Error(`building image ${t} did not finish within ${o.timeoutMs??20*6e4} ms (last status ${w??"none"})`);await i(o.pollMs??3e3)}}l(me,"buildImage");const he=l(e=>`env-${e}`,"environmentImageName");function we(e){H(e,{recursive:!0,force:!0})}l(we,"removeBuildDir");export{Q as NODE_BASE_IMAGE,S as RECIPE_PI_AGENT_DIR,_ as REPOS_DIR,m as RUN_USER,X as SANDBOX_API_IMAGE,A as SETUP_FAILED_FILE,v as SETUP_LOG_FILE,$ as SETUP_SCRIPT_FILE,me as buildImage,fe as deleteImage,he as environmentImageName,B as getImage,ue as prepareBuildDir,re as recipeDockerfile,we as removeBuildDir,se as zipDirectory};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.672",
|
|
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.672",
|
|
160
|
+
"@north-light/plugin": "0.3.672",
|
|
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",
|
|
@@ -20,8 +20,14 @@ export const RECIPE_PI_AGENT_DIR = '/var/lib/crtr/recipe-pi-agent';
|
|
|
20
20
|
const PI_VERSION = '1.1.0';
|
|
21
21
|
export const SETUP_SCRIPT_FILE = 'recipe-setup.sh';
|
|
22
22
|
export const REPOS_DIR = 'repos';
|
|
23
|
+
/** Where the image keeps the setup script's output, and its exit status when it failed. `sandbox-start.mjs` reads both (it derives them from `/work/.crtr`). */
|
|
24
|
+
export const SETUP_LOG_FILE = '/work/.crtr/setup.log';
|
|
25
|
+
export const SETUP_FAILED_FILE = '/work/.crtr/setup-failed';
|
|
23
26
|
const shellQuote = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
|
|
24
27
|
const lines = (text) => (text ?? '').split('\n').map((l) => l.trim()).filter((l) => l !== '');
|
|
28
|
+
/** A RUN step that cannot fail the build (Blaxel hangs on a failed step and its build log is unreadable): its output goes to `SETUP_LOG_FILE` and a
|
|
29
|
+
* failure appends `<label> exited <status>` to `SETUP_FAILED_FILE`, which the sandbox start script refuses to start on. */
|
|
30
|
+
const guarded = (label, command) => `RUN { ${command}; } >> ${SETUP_LOG_FILE} 2>&1 || echo ${shellQuote(label)} "exited $?" >> ${SETUP_FAILED_FILE}`;
|
|
25
31
|
/** The Dockerfile for a recipe revision. Pure. It clones and fetches nothing: the repositories arrive by `COPY`, so a git token cannot appear here.
|
|
26
32
|
* Two stages: `build` runs the setup script as root; the final image copies only the installed trees out of it, never `/root`. With `packagesToken`
|
|
27
33
|
* the build stage declares `ARG NODE_AUTH_TOKEN` (its value comes from `.env.build` in the upload), so the token is in no layer of the final image. */
|
|
@@ -34,20 +40,22 @@ export function recipeDockerfile(recipe, revision, packagesToken = false) {
|
|
|
34
40
|
`COPY --from=${SANDBOX_API_IMAGE} /sandbox-api /usr/local/bin/sandbox-api`,
|
|
35
41
|
`RUN adduser -D -h /home/${RUN_USER} -s /bin/sh ${RUN_USER} && mkdir -p /work/.crtr ${RECIPE_PI_AGENT_DIR} && chown -R ${RUN_USER} /work /var/lib/crtr`,
|
|
36
42
|
];
|
|
37
|
-
const out = [`${base[0]} AS build`, ...(packagesToken ? ['ARG NODE_AUTH_TOKEN'] : []), ...base.slice(1),
|
|
43
|
+
const out = [`${base[0]} AS build`, ...(packagesToken ? ['ARG NODE_AUTH_TOKEN'] : []), ...base.slice(1), `RUN rm -f ${SETUP_FAILED_FILE} ${SETUP_LOG_FILE}`, guarded('npm install -g pnpm', 'npm install -g pnpm && mkdir -p /var/lib/postgresql')];
|
|
38
44
|
// An empty `repos/` is not in the zip, and a COPY of a missing directory fails the build.
|
|
39
45
|
if (recipe.repositories.length > 0)
|
|
40
46
|
out.push(`COPY --chown=${RUN_USER} ${REPOS_DIR}/ /work/`);
|
|
41
47
|
if (packages.length > 0)
|
|
42
|
-
out.push(`
|
|
48
|
+
out.push(guarded('npm install pi', `npm install -g @earendil-works/pi-coding-agent@${PI_VERSION}`));
|
|
43
49
|
if (hasScript)
|
|
44
50
|
out.push(`COPY ${SETUP_SCRIPT_FILE} /tmp/${SETUP_SCRIPT_FILE}`);
|
|
45
51
|
out.push('WORKDIR /work');
|
|
46
52
|
for (const source of packages)
|
|
47
|
-
out.push(`
|
|
53
|
+
out.push(guarded(`pi install ${source}`, `HOME=/var/lib/crtr PI_CODING_AGENT_DIR=${RECIPE_PI_AGENT_DIR} pi install ${shellQuote(source)}`));
|
|
54
|
+
// Blaxel never reports a failed Docker step: the image stays BUILDING until the timeout, and its build log is not readable. So a failing script must not fail
|
|
55
|
+
// the step. Its output and exit status are kept in the image (`SETUP_LOG_FILE`, `SETUP_FAILED_FILE`) and the sandbox start script refuses to start with them.
|
|
48
56
|
if (hasScript)
|
|
49
|
-
out.push(`
|
|
50
|
-
out.push(`
|
|
57
|
+
out.push(guarded('setup script', `bash /tmp/${SETUP_SCRIPT_FILE}`));
|
|
58
|
+
out.push(guarded('finalize', `echo ${Math.trunc(revision)} > /work/.crtr/recipe-revision && chown -R ${RUN_USER} /work /home/${RUN_USER} /var/lib/crtr`));
|
|
51
59
|
out.push('', ...base);
|
|
52
60
|
for (const dir of ['/work', `/home/${RUN_USER}`, '/usr/local', '/var/lib/crtr', '/usr', '/etc', '/lib'])
|
|
53
61
|
out.push(`COPY --from=build ${dir} ${dir}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.672",
|
|
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.672",
|
|
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.672",
|
|
31
|
+
"@north-light/identity": "0.3.672"
|
|
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.672",
|
|
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.672",
|
|
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.672",
|
|
32
|
+
"@north-light/plugin": "0.3.672",
|
|
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.672",
|
|
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.672",
|
|
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.672",
|
|
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.672",
|
|
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.672",
|
|
10692
|
+
"@north-light/identity": "0.3.672"
|
|
10693
10693
|
}
|
|
10694
10694
|
},
|
|
10695
10695
|
"packages/crouter-sdk": {
|
|
10696
10696
|
"name": "@north-light/sdk",
|
|
10697
|
-
"version": "0.3.
|
|
10697
|
+
"version": "0.3.672",
|
|
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.672",
|
|
10701
|
+
"@north-light/identity": "0.3.672",
|
|
10702
|
+
"@north-light/plugin": "0.3.672",
|
|
10703
10703
|
"jose": "^6.2.1"
|
|
10704
10704
|
},
|
|
10705
10705
|
"bin": {
|
|
@@ -352,6 +352,12 @@ async function start(env) {
|
|
|
352
352
|
const home = join(root, 'apps', bundle.node.app.replace(/^app:/, ''), 'home');
|
|
353
353
|
const agentDir = join(home, '.pi', 'agent');
|
|
354
354
|
const work = env.CRTR_WORK_DIR ?? '/work';
|
|
355
|
+
// The recipe image keeps a failing setup script's exit status and output (image-build.ts); starting on such an image would run without its setup.
|
|
356
|
+
const setupFailed = join(work, '.crtr', 'setup-failed');
|
|
357
|
+
if (existsSync(setupFailed)) {
|
|
358
|
+
const log = existsSync(join(work, '.crtr', 'setup.log')) ? readFileSync(join(work, '.crtr', 'setup.log'), 'utf8').trim().slice(-1500) : '';
|
|
359
|
+
throw new StartFailure('recipe_setup_failed', `the recipe image build failed (${readFileSync(setupFailed, 'utf8').trim().replace(/\n/g, '; ')}):\n${log}`);
|
|
360
|
+
}
|
|
355
361
|
mkdirSync(agentDir, { recursive: true });
|
|
356
362
|
// The recipe image installs its pi packages into one agent dir of its own (RECIPE_PI_AGENT_DIR in image-build.ts); every app's agent dir links to
|
|
357
363
|
// that install, so the packages load whichever app the node runs in.
|
|
@@ -420,7 +426,8 @@ async function start(env) {
|
|
|
420
426
|
}
|
|
421
427
|
const { dest: marketplaceDir, manifest } = marketplaces.get(key);
|
|
422
428
|
const entry = manifest.plugins.find((candidate) => candidate?.name === plugin.name);
|
|
423
|
-
|
|
429
|
+
// The Mac warns about an enabled plugin its marketplace no longer carries and goes on; so does this.
|
|
430
|
+
if (!entry || typeof entry.source !== 'string') { console.error(`crtr-sandbox-start: warning: ${plugin.name}: not found in marketplace ${manifest.name}; skipped`); continue; }
|
|
424
431
|
const target = join(pluginsDir, plugin.name);
|
|
425
432
|
mkdirSync(pluginsDir, { recursive: true });
|
|
426
433
|
rmSync(target, { recursive: true, force: true });
|