@north-light/cli 0.3.725 → 0.3.727

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.
@@ -1,4 +1,4 @@
1
1
  var N=Object.defineProperty;var o=(e,t)=>N(e,"name",{value:t,configurable:!0});import{AsyncLocalStorage as k}from"node:async_hooks";import{randomBytes as B}from"node:crypto";import{appendFileSync as I,mkdirSync as U,readFileSync as q}from"node:fs";import{join as G}from"node:path";import y from"pg";import{resolveDatabaseUrl as K}from"../../daemon/postgres/supervisor.js";import{publishFileExclusive as X}from"../fs-utils.js";import{initializeEmptyLayout as F,runtimeRoot as d}from"../layout.js";import{translatePlaceholders as H,translateOnce as J}from"../statements.js";import{ensureHome as V}from"./paths.js";import{addStepTiming as w,isCollectingStepTimings as W,statementLabel as Z}from"../step-timings.js";import{emitEvent as z}from"../events/emit.js";import{ensureSchema as j}from"./schema-chain.js";import{canvasDatabaseSchema as Y,canvasSchemaDatabaseUrl as Q,canvasSearchPathOptions as O}from"./schema-version.js";const tt="crtr_test_template";class et extends Error{static{o(this,"CanvasConstraintError")}constraint;code="23505";constructor(t,n,a){super(t,a),this.name="CanvasConstraintError",this.constraint=n}}function L(e){const t=process.env.CRTR_DB_OPEN_LEDGER;if(t)try{const n=`${new Date().toISOString()} ${process.pid} ${process.argv[1]??"<unknown>"} ${e.replace(/\/\/([^:@/]*):[^@/]*@/,"//$1@")}
2
- `;I(t,n)}catch{}}o(L,"recordOpenLedger");const nt=6,rt=12,R=2;function x(e=process.env){const t=e.CRTR_DATABASE_POOL_MAX?.trim();if(t){const n=Number(t);if(!Number.isInteger(n)||n<R)throw new Error(`CRTR_DATABASE_POOL_MAX must be an integer of at least ${R}; got ${JSON.stringify(t)}`);return n}return e.CRTR_DATABASE_URL?rt:nt}o(x,"canvasPoolSize");const C=3e4,ot=1e3,E=new k,at=new Set([114,3802]),st={getTypeParser:o(((e,t)=>at.has(e)?n=>n:e===20||e===1700?n=>{const a=Number(n);if(e===20&&!Number.isSafeInteger(a))throw new Error(`canvas db: bigint ${n} does not fit a JS number`);return a}:y.types.getTypeParser(e,t)),"getTypeParser")};class ct{static{o(this,"Handle")}url;db;pool=null;schema=null;constructor(t){this.url=t;const n=this;this.db={prepare:o(a=>this.statement(a,!0),"prepare"),prepareUncached:o(a=>this.statement(a,!1),"prepareUncached"),exec:o(a=>this.run({text:a}).then(()=>{}),"exec"),get inTransaction(){return M(n)}}}ready(){return this.schema??=ut(this.url).catch(t=>{throw this.schema=null,t}),this.schema}connections(){if(this.pool!==null)return this.pool;const t=new y.Pool({connectionString:this.url,types:st,application_name:`crtr-${process.pid}`,connectionTimeoutMillis:C,options:O(),max:x(),idleTimeoutMillis:1e4,allowExitOnIdle:!0});return t.on("connect",()=>L(this.url)),t.on("error",n=>console.warn(`[canvas db] pooled connection error: ${n.message}`)),this.pool=t}async checkout(){try{return await this.connections().connect()}catch(t){throw this.mapError(t)}}async run(t){const n=E.getStore();try{if(n!==void 0&&n.open&&n.handle===this){const a=performance.now();try{return await n.client.query(t)}finally{const s=performance.now()-a;n.statementMs+=s,n.statements?.push({text:t.text,ms:s})}}return await this.connections().query(t)}catch(a){throw this.mapError(a)}}mapError(t){const n=t;return n.code==="23505"?new et(n.message??"unique constraint violation",n.constraint,{cause:t}):/timeout exceeded when trying to connect/i.test(n.message??"")?new Error(`canvas db: no pooled connection became free within ${C} ms (pool of ${x()}); a transaction body is holding connections across a slow await`,{cause:t}):t}statement(t,n){const a=n?(()=>{const r=H(t);return{text:r.text,name:r.name}})():{text:J(t).text},s=o(r=>this.run({...a,values:r.map(it)}),"query");return{get:o(async(...r)=>(await s(r)).rows[0],"get"),all:o(async(...r)=>(await s(r)).rows,"all"),run:o(async(...r)=>({changes:(await s(r)).rowCount??0}),"run")}}async close(){const t=this.pool;this.pool=null,await t?.end().catch(()=>{})}}function it(e){return ArrayBuffer.isView(e)&&!Buffer.isBuffer(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength):e}o(it,"bindable");function M(e){const t=E.getStore();return t!==void 0&&t.open&&t.handle===e}o(M,"ownsTransaction");async function ut(e){const t=o((f,l,h)=>{z({level:f,event:l,fields:h})},"emit"),n=Y(),a=Q(),s=a??e;L(s);const r=new y.Client({connectionString:s,application_name:`crtr-schema-${process.pid}`,connectionTimeoutMillis:1e4,...a===void 0?{options:O()}:{}});r.on("error",()=>{}),await r.connect();try{await j(r,{schema:n,emit:t})}finally{await r.end().catch(()=>{})}}o(ut,"applySchema");function lt(){return process.env.NODE_TEST_CONTEXT!==void 0||process.execArgv.includes("--test")}o(lt,"runningUnderNodeTest");function S(e,t){const n=/^(postgres(?:ql)?:\/\/[^/?#]*)(\/[^?#]*)?(.*)$/s.exec(e);if(n===null)throw new Error(`not a postgres URL: ${e.replace(/\/\/[^@/]*@/,"//")}`);return`${n[1]}/${t}${n[3]}`}o(S,"withDatabase");async function mt(e){const t=G(d(),"test-db"),n=o(()=>{try{return q(t,"utf8").trim()||void 0}catch(f){if(f.code==="ENOENT")return;throw f}},"recorded"),a=n();if(a!==void 0)return S(e,a);U(d(),{recursive:!0});const s=`t_${B(8).toString("hex")}`,r=new y.Client({connectionString:S(e,"postgres")});r.on("error",()=>{}),await r.connect();try{if(await r.query(`CREATE DATABASE ${s} TEMPLATE ${tt} STRATEGY file_copy`),!X(t,`${s}
2
+ `;I(t,n)}catch{}}o(L,"recordOpenLedger");const nt=6,rt=12,R=2;function x(e=process.env){const t=e.CRTR_DATABASE_POOL_MAX?.trim();if(t){const n=Number(t);if(!Number.isInteger(n)||n<R)throw new Error(`CRTR_DATABASE_POOL_MAX must be an integer of at least ${R}; got ${JSON.stringify(t)}`);return n}return e.CRTR_DATABASE_URL?rt:nt}o(x,"canvasPoolSize");const C=3e4,ot=1e3,E=new k,at=new Set([114,3802]),st={getTypeParser:o(((e,t)=>at.has(e)?n=>n:e===20||e===1700?n=>{const a=Number(n);if(e===20&&!Number.isSafeInteger(a))throw new Error(`canvas db: bigint ${n} does not fit a JS number`);return a}:y.types.getTypeParser(e,t)),"getTypeParser")};class ct{static{o(this,"Handle")}url;db;pool=null;schema=null;constructor(t){this.url=t;const n=this;this.db={prepare:o(a=>this.statement(a,!0),"prepare"),prepareUncached:o(a=>this.statement(a,!1),"prepareUncached"),exec:o(a=>this.run({text:a}).then(()=>{}),"exec"),get inTransaction(){return M(n)}}}ready(){return this.schema??=ut(this.url).catch(t=>{throw this.schema=null,t}),this.schema}connections(){if(this.pool!==null)return this.pool;const t=new y.Pool({connectionString:this.url,types:st,application_name:`crtr-${process.pid}`,connectionTimeoutMillis:C,options:O(),max:x(),idleTimeoutMillis:1e4,allowExitOnIdle:!0});return t.on("connect",()=>L(this.url)),t.on("error",n=>console.warn(`[canvas db] pooled connection error: ${n.message}`)),this.pool=t}async checkout(){try{return await this.connections().connect()}catch(t){throw this.mapError(t)}}async run(t){const n=E.getStore();try{if(n!==void 0&&n.open&&n.handle.url===this.url){const a=performance.now();try{return await n.client.query(t)}finally{const s=performance.now()-a;n.statementMs+=s,n.statements?.push({text:t.text,ms:s})}}return await this.connections().query(t)}catch(a){throw this.mapError(a)}}mapError(t){const n=t;return n.code==="23505"?new et(n.message??"unique constraint violation",n.constraint,{cause:t}):/timeout exceeded when trying to connect/i.test(n.message??"")?new Error(`canvas db: no pooled connection became free within ${C} ms (pool of ${x()}); a transaction body is holding connections across a slow await`,{cause:t}):t}statement(t,n){const a=n?(()=>{const r=H(t);return{text:r.text,name:r.name}})():{text:J(t).text},s=o(r=>this.run({...a,values:r.map(it)}),"query");return{get:o(async(...r)=>(await s(r)).rows[0],"get"),all:o(async(...r)=>(await s(r)).rows,"all"),run:o(async(...r)=>({changes:(await s(r)).rowCount??0}),"run")}}async close(){const t=this.pool;this.pool=null,await t?.end().catch(()=>{})}}function it(e){return ArrayBuffer.isView(e)&&!Buffer.isBuffer(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength):e}o(it,"bindable");function M(e){const t=E.getStore();return t!==void 0&&t.open&&t.handle.url===e.url}o(M,"ownsTransaction");async function ut(e){const t=o((f,l,h)=>{z({level:f,event:l,fields:h})},"emit"),n=Y(),a=Q(),s=a??e;L(s);const r=new y.Client({connectionString:s,application_name:`crtr-schema-${process.pid}`,connectionTimeoutMillis:1e4,...a===void 0?{options:O()}:{}});r.on("error",()=>{}),await r.connect();try{await j(r,{schema:n,emit:t})}finally{await r.end().catch(()=>{})}}o(ut,"applySchema");function lt(){return process.env.NODE_TEST_CONTEXT!==void 0||process.execArgv.includes("--test")}o(lt,"runningUnderNodeTest");function S(e,t){const n=/^(postgres(?:ql)?:\/\/[^/?#]*)(\/[^?#]*)?(.*)$/s.exec(e);if(n===null)throw new Error(`not a postgres URL: ${e.replace(/\/\/[^@/]*@/,"//")}`);return`${n[1]}/${t}${n[3]}`}o(S,"withDatabase");async function mt(e){const t=G(d(),"test-db"),n=o(()=>{try{return q(t,"utf8").trim()||void 0}catch(f){if(f.code==="ENOENT")return;throw f}},"recorded"),a=n();if(a!==void 0)return S(e,a);U(d(),{recursive:!0});const s=`t_${B(8).toString("hex")}`,r=new y.Client({connectionString:S(e,"postgres")});r.on("error",()=>{}),await r.connect();try{if(await r.query(`CREATE DATABASE ${s} TEMPLATE ${tt} STRATEGY file_copy`),!X(t,`${s}
3
3
  `,384))return await r.query(`DROP DATABASE ${s}`),S(e,n())}finally{await r.end()}return S(e,s)}o(mt,"testDatabaseUrl");async function ft(){const e=process.env.CRTR_TEST_PG_URL;if(e)return mt(e);if(lt())throw new Error("CRTR_TEST_PG_URL is not set: a test must reach its own Postgres (run the suite through the lane runner); refusing to open a real canvas database");return K(d())}o(ft,"canvasDatabaseUrl");const p=new Map,_=new Map;async function v(){F(),V();const e=await ft();_.set(d(),e);let t=p.get(e);return t===void 0&&p.set(e,t=new ct(e)),await t.ready(),t}o(v,"openHandle");async function xt(){return(await v()).db}o(xt,"openDb");async function Ct(){const e=_.get(d());if(e===void 0)return;_.delete(d());const t=p.get(e);t!==void 0&&(p.delete(e),await t.close())}o(Ct,"closeDb");async function Mt(){const e=[...p.values()];p.clear(),_.clear(),await Promise.all(e.map(t=>t.close()))}o(Mt,"closeAllDbs");function vt(e){const t=E.getStore();if(t===void 0||!t.open){queueMicrotask(e);return}t.afterCommit.push(e)}o(vt,"afterCommit");let dt=0;async function Pt(e,t={}){const n=await v(),a=n.db;if(M(n)){if(!t.savepoint&&!t.rollback)return e(a);const i=E.getStore(),c=`canvas_write_${++dt}`;await n.run({text:`SAVEPOINT ${c}`});const m=i.afterCommit,A=m.length;let $;try{$=await e(a)}catch(D){throw await n.run({text:`ROLLBACK TO ${c}; RELEASE ${c}`}),m.splice(A),D}return await n.run({text:t.rollback?`ROLLBACK TO ${c}; RELEASE ${c}`:`RELEASE ${c}`}),t.rollback&&m.splice(A),$}const s=new Error("canvas write transaction entered here"),r=W()?t.timingName:void 0,f=performance.now(),l=await n.checkout();r!==void 0&&w(`${r}_checkout_wait`,performance.now()-f);let h;const g=o(i=>{h??=i},"onConnectionError");l.on("error",g);const P=performance.now();let T=!1,b=!1;const u={handle:n,client:l,open:!0,afterCommit:[],statementMs:0,...r===void 0?{}:{statements:[]}};try{await l.query("BEGIN");try{const i=await E.run(u,()=>e(a));return await l.query(t.rollback?"ROLLBACK":"COMMIT"),T=!t.rollback,i}catch(i){b=!0;try{await l.query("ROLLBACK")}catch(c){h??=c}throw n.mapError(i)}}finally{u.open=!1;const i=performance.now()-P;if(r!==void 0&&u.statements!==void 0&&(w(`${r}_statements_count`,u.statements.length),w(`${r}_statements_ms`,u.statementMs),w(`${r}_other_ms`,i-u.statementMs),[...u.statements].sort((c,m)=>m.ms-c.ms).slice(0,3).forEach((c,m)=>w(`${r}_slow${m+1}_${Z(c.text)}`,c.ms))),!b&&i-u.statementMs>ot&&console.warn(`[canvas db] write transaction held its connection ${Math.round(i)}ms (${Math.round(u.statementMs)}ms in its statements); its body did non-db work while holding a pooled connection and its row locks
4
4
  ${s.stack}`),l.removeListener("error",g),l.release(h),T)for(const c of u.afterCommit)queueMicrotask(c)}}o(Pt,"withCanvasWrite");export{et as CanvasConstraintError,vt as afterCommit,ft as canvasDatabaseUrl,x as canvasPoolSize,Mt as closeAllDbs,Ct as closeDb,xt as openDb,Pt as withCanvasWrite};
@@ -1,8 +1,8 @@
1
- var j=Object.defineProperty;var l=(t,r)=>j(t,"name",{value:r,configurable:!0});import{spawn as q}from"node:child_process";import{constants as D,lstatSync as z,mkdirSync as W,readFileSync as J,readdirSync as X,readlinkSync as V,rmSync as Z,writeFileSync as b}from"node:fs";import{join as g,relative as Q}from"node:path";import{crc32 as tt,deflateRawSync as et}from"node:zlib";import{BlaxelApiError as rt}from"./client.js";const nt="public.ecr.aws/docker/library/node:24-alpine",ot="ghcr.io/blaxel-ai/sandbox:latest",c="crtr",B="/var/lib/crtr/recipe-pi-agent",st="blaxel.toml",it=`[build]
1
+ var j=Object.defineProperty;var c=(t,r)=>j(t,"name",{value:r,configurable:!0});import{spawn as q}from"node:child_process";import{constants as D,lstatSync as z,mkdirSync as W,readFileSync as J,readdirSync as X,readlinkSync as V,rmSync as Z,writeFileSync as b}from"node:fs";import{join as g,relative as Q}from"node:path";import{crc32 as tt,deflateRawSync as et}from"node:zlib";import{BlaxelApiError as rt}from"./client.js";const nt="public.ecr.aws/docker/library/node:24-alpine",ot="ghcr.io/blaxel-ai/sandbox:latest",p="crtr",B="/var/lib/crtr/recipe-pi-agent",st="blaxel.toml",it=`[build]
2
2
  slim = false
3
- `,at="1.1.0",_="recipe-setup.sh",ct=["@northlight-systems:registry=https://npm.pkg.github.com","//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}",`store-dir=/home/${c}/.local/share/pnpm/store`],G=l(()=>`printf '%s\\n' ${ct.map(t=>`'${t}'`).join(" ")} > /home/${c}/.npmrc`,"writeRunUserNpmrc"),R="repos",U="/work/.crtr/setup.log",M="/work/.crtr/setup-failed",C="/usr/local/bin/gh",lt=["#!/bin/sh",'token=$(printf "protocol=https\\nhost=github.com\\n\\n" | git credential fill 2>/dev/null | sed -n "s/^password=//p")','[ -n "$token" ] && export GH_TOKEN="$token"','exec /usr/bin/gh "$@"'],N=l(t=>`'${t.replace(/'/g,"'\\''")}'`,"shellQuote"),pt=l(t=>(t??"").split(`
4
- `).map(r=>r.trim()).filter(r=>r!==""),"lines"),E=l((t,r)=>`RUN { ${r}; } >> ${U} 2>&1 || echo ${N(t)} "exited $?" >> ${M}`,"guarded");function ut(t,r,i=!1){const s=pt(t.pi_packages),a=t.setup_script!==null&&t.setup_script.trim()!=="",n=[`FROM ${nt}`,"RUN apk add --no-cache bash git curl ripgrep github-cli",`RUN printf '%s\\n' ${lt.map(N).join(" ")} > ${C} && chmod 755 ${C}`,`COPY --from=${ot} /sandbox-api /usr/local/bin/sandbox-api`,`RUN adduser -D -h /home/${c} -s /bin/sh ${c} && mkdir -p /work/.crtr ${B} && chown -R ${c} /work /var/lib/crtr`],e=[`${n[0]} AS build`,...i?["ARG NODE_AUTH_TOKEN"]:[],...n.slice(1),`RUN rm -f ${M} ${U}`,E("npm install -g pnpm","npm install -g pnpm && mkdir -p /var/lib/postgresql")];t.repositories.length>0&&e.push(`COPY --chown=${c} ${R}/ /work/`),s.length>0&&e.push(E("npm install pi",`npm install -g @earendil-works/pi-coding-agent@${at}`)),a&&e.push(`COPY ${_} /tmp/${_}`),e.push("WORKDIR /work"),e.push(`RUN ${G()}`);for(const o of t.repositories)e.push(`RUN if [ -f /work/${o.name}/pnpm-lock.yaml ]; then cd /work/${o.name} && HOME=/home/${c} pnpm fetch >> ${U} 2>&1 || echo 'pnpm fetch ${o.name} failed' >> ${U}; chown -R ${c}:${c} /work/${o.name} /home/${c}; fi`);for(const o of s)e.push(E(`pi install ${o}`,`HOME=/var/lib/crtr PI_CODING_AGENT_DIR=${B} pi install ${N(o)}`));a&&e.push(E("setup script",`bash /tmp/${_}`)),e.push(E("finalize",`echo ${Math.trunc(r)} > /work/.crtr/recipe-revision && chown -R ${c} /work /home/${c} /var/lib/crtr`)),e.push("",...n);for(const o of["/work",`/home/${c}`,"/var/lib/crtr"])e.push(`COPY --from=build --chown=${c}:${c} ${o} ${o}`);for(const o of["/usr/local","/usr","/etc","/lib"])e.push(`COPY --from=build ${o} ${o}`);return e.push("COPY --from=build /var/lib/postgresql /var/lib/postgresql"),e.push("RUN if getent passwd postgres >/dev/null; then chown -R postgres:postgres /var/lib/postgresql; fi"),i&&e.push("RUN rm -f /work/.npmrc",`RUN ${G()} && chown ${c}:${c} /home/${c}/.npmrc`),e.push(`USER ${c}`,"WORKDIR /work",'ENTRYPOINT ["/usr/local/bin/sandbox-api"]',""),e.join(`
5
- `)}l(ut,"recipeDockerfile");const dt=l((t,r,i)=>new Promise((s,a)=>{const n=q("git",t,{cwd:i,env:{...process.env,...r,GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","ignore","pipe"]});let e="";n.stderr.on("data",o=>{e+=o.toString()}),n.on("error",a),n.on("close",o=>{o===0?s():a(new Error(`git ${t[0]} failed (${o}): ${e.slice(0,300)}`))})}),"runGit");async function _t(t){const r=t.git??dt,i=t.packagesToken??null,s=t.cloneUrl??(n=>`https://github.com/${n}.git`);W(g(t.dir,R),{recursive:!0});const a=t.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:${t.token}`).toString("base64")}`};for(const n of t.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 r(["clone","--quiet","--branch",n.default_branch,s(n.github_full_name),g(R,n.name)],a,t.dir)}b(g(t.dir,st),it),b(g(t.dir,"Dockerfile"),ut(t.recipe,t.revision,i!==null)),i!==null&&b(g(t.dir,".env.build"),`NODE_AUTH_TOKEN=${i}
3
+ `,at="1.1.0",_="recipe-setup.sh",ct=["@northlight-systems:registry=https://npm.pkg.github.com","//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}",`store-dir=/home/${p}/.local/share/pnpm/store`],G=c(()=>`printf '%s\\n' ${ct.map(t=>`'${t}'`).join(" ")} > /home/${p}/.npmrc`,"writeRunUserNpmrc"),R="repos",U="/work/.crtr/setup.log",M="/work/.crtr/setup-failed",C="/usr/local/bin/gh",lt=["#!/bin/sh",'token=$(printf "protocol=https\\nhost=github.com\\n\\n" | git credential fill 2>/dev/null | sed -n "s/^password=//p")','[ -n "$token" ] && export GH_TOKEN="$token"','exec /usr/bin/gh "$@"'],N=c(t=>`'${t.replace(/'/g,"'\\''")}'`,"shellQuote"),pt=c(t=>(t??"").split(`
4
+ `).map(r=>r.trim()).filter(r=>r!==""),"lines"),E=c((t,r)=>`RUN { ${r}; } >> ${U} 2>&1 || echo ${N(t)} "exited $?" >> ${M}`,"guarded");function ut(t,r,i=!1){const s=pt(t.pi_packages),a=t.setup_script!==null&&t.setup_script.trim()!=="",n=[`FROM ${nt}`,"RUN apk add --no-cache bash git curl ripgrep github-cli",`RUN printf '%s\\n' ${lt.map(N).join(" ")} > ${C} && chmod 755 ${C}`,`COPY --from=${ot} /sandbox-api /usr/local/bin/sandbox-api`,`RUN adduser -D -h /home/${p} -s /bin/sh ${p} && mkdir -p /work/.crtr ${B} && chown -R ${p} /work /var/lib/crtr`],e=[`${n[0]} AS build`,...i?["ARG NODE_AUTH_TOKEN"]:[],...n.slice(1),`RUN rm -f ${M} ${U}`,E("npm install -g pnpm","npm install -g pnpm && mkdir -p /var/lib/postgresql")];t.repositories.length>0&&e.push(`COPY --chown=${p} ${R}/ /work/`),s.length>0&&e.push(E("npm install pi",`npm install -g @earendil-works/pi-coding-agent@${at}`)),a&&e.push(`COPY ${_} /tmp/${_}`),e.push("WORKDIR /work"),e.push(`RUN ${G()}`);for(const o of t.repositories)e.push(`RUN if [ -f /work/${o.name}/pnpm-lock.yaml ]; then su ${p} -c 'cd /work/${o.name} && HOME=/home/${p} pnpm fetch' >> ${U} 2>&1 || echo 'pnpm fetch ${o.name} failed' >> ${U}; fi`);for(const o of s)e.push(E(`pi install ${o}`,`HOME=/var/lib/crtr PI_CODING_AGENT_DIR=${B} pi install ${N(o)}`));a&&e.push(E("setup script",`bash /tmp/${_}`)),e.push(E("finalize",`echo ${Math.trunc(r)} > /work/.crtr/recipe-revision`)),e.push("",...n);for(const o of["/work",`/home/${p}`,"/var/lib/crtr"])e.push(`COPY --from=build --chown=${p}:${p} ${o} ${o}`);for(const o of["/usr/local","/usr","/etc","/lib"])e.push(`COPY --from=build ${o} ${o}`);return e.push("COPY --from=build /var/lib/postgresql /var/lib/postgresql"),e.push("RUN if getent passwd postgres >/dev/null; then chown -R postgres:postgres /var/lib/postgresql; fi"),i&&e.push("RUN rm -f /work/.npmrc",`RUN ${G()} && chown ${p}:${p} /home/${p}/.npmrc`),e.push(`USER ${p}`,"WORKDIR /work",'ENTRYPOINT ["/usr/local/bin/sandbox-api"]',""),e.join(`
5
+ `)}c(ut,"recipeDockerfile");const dt=c((t,r,i)=>new Promise((s,a)=>{const n=q("git",t,{cwd:i,env:{...process.env,...r,GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","ignore","pipe"]});let e="";n.stderr.on("data",o=>{e+=o.toString()}),n.on("error",a),n.on("close",o=>{o===0?s():a(new Error(`git ${t[0]} failed (${o}): ${e.slice(0,300)}`))})}),"runGit");async function _t(t){const r=t.git??dt,i=t.packagesToken??null,s=t.cloneUrl??(n=>`https://github.com/${n}.git`);W(g(t.dir,R),{recursive:!0});const a=t.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:${t.token}`).toString("base64")}`};for(const n of t.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 r(["clone","--quiet","--branch",n.default_branch,s(n.github_full_name),g(R,n.name)],a,t.dir)}b(g(t.dir,st),it),b(g(t.dir,"Dockerfile"),ut(t.recipe,t.revision,i!==null)),i!==null&&b(g(t.dir,".env.build"),`NODE_AUTH_TOKEN=${i}
6
6
  `,{mode:384}),t.recipe.setup_script!==null&&t.recipe.setup_script.trim()!==""&&b(g(t.dir,_),t.recipe.setup_script.endsWith(`
7
7
  `)?t.recipe.setup_script:`${t.recipe.setup_script}
8
- `)}l(_t,"prepareBuildDir");function F(t,r,i){for(const s of X(r).sort()){const a=g(r,s),n=z(a),e=Q(t,a).split("\\").join("/");n.isDirectory()?F(t,a,i):n.isSymbolicLink()?i.push({name:e,data:Buffer.from(V(a)),mode:D.S_IFLNK|511}):n.isFile()&&i.push({name:e,data:J(a),mode:D.S_IFREG|n.mode&511})}}l(F,"walk");function ht(t){const r=[];F(t,t,r);const i=[],s=[];let a=0;for(const o of r){const d=Buffer.from(o.name),$=et(o.data),I=tt(o.data),u=Buffer.alloc(30);u.writeUInt32LE(67324752,0),u.writeUInt16LE(20,4),u.writeUInt16LE(2048,6),u.writeUInt16LE(8,8),u.writeUInt32LE(33,12),u.writeUInt32LE(I,14),u.writeUInt32LE($.length,18),u.writeUInt32LE(o.data.length,22),u.writeUInt16LE(d.length,26),i.push(u,d,$);const p=Buffer.alloc(46);p.writeUInt32LE(33639248,0),p.writeUInt16LE(788,4),p.writeUInt16LE(20,6),p.writeUInt16LE(2048,8),p.writeUInt16LE(8,10),p.writeUInt32LE(33,14),p.writeUInt32LE(I,16),p.writeUInt32LE($.length,20),p.writeUInt32LE(o.data.length,24),p.writeUInt16LE(d.length,28),p.writeUInt32LE(o.mode<<16>>>0,38),p.writeUInt32LE(a,42),s.push(p,d),a+=u.length+d.length+$.length}const n=Buffer.concat(s),e=Buffer.alloc(22);return e.writeUInt32LE(101010256,0),e.writeUInt16LE(r.length,8),e.writeUInt16LE(r.length,10),e.writeUInt32LE(n.length,12),e.writeUInt32LE(a,16),Buffer.concat([...i,n,e])}l(ht,"zipDirectory");async function k(t,r,i,s,a=[]){const n=`${t.controlUrl??"https://api.blaxel.ai/v0"}${i}`,e=await(t.fetch??fetch)(n,{method:r,headers:{authorization:`Bearer ${t.apiKey}`,"x-blaxel-workspace":t.workspace,"content-type":"application/json"},...s===void 0?{}:{body:JSON.stringify(s)}}),o=await e.text();let d=null;if(o!=="")try{d=JSON.parse(o)}catch{d={raw:o}}if(!e.ok&&!a.includes(e.status))throw new rt(e.status,null,`Blaxel ${r} ${n} failed (${e.status}): ${o.slice(0,300)}`);return{status:e.status,headers:e.headers,json:d}}l(k,"api");async function H(t,r){const{status:i,json:s}=await k(t,"GET",`/images/sandbox/${encodeURIComponent(r)}`,void 0,[404]);return i===404?null:s}l(H,"getImage");async function Ut(t,r){await k(t,"DELETE",`/images/sandbox/${encodeURIComponent(r)}`,void 0,[404])}l(Ut,"deleteImage");const ft=60*6e4;async function xt(t,r,i,s={}){const a=s.sleep??(f=>new Promise(h=>setTimeout(h,f))),n=s.now??Date.now,e=n(),o=await H(t,r),d=new Set((o?.spec?.tags??[]).map(f=>f.name)),$=l(f=>(f?.metadata?.events??[]).map(h=>Date.parse(h.time??"")).filter(h=>!Number.isNaN(h)),"eventTimes"),I=Math.max(-1/0,...$(o)),p=(await k(t,"POST","/images",{resourceType:"sandbox",name:r})).headers.get("x-blaxel-upload-url");if(p===null)throw new Error(`Blaxel gave no upload URL for image ${r}`);const x=await(t.fetch??fetch)(p,{method:"PUT",headers:{"content-type":"application/zip"},body:new Uint8Array(ht(i))});if(!x.ok)throw new Error(`uploading the build context of image ${r} failed (${x.status}): ${(await x.text()).slice(0,300)}`);const T=s.timeoutMs??ft,K=e+T;let O=null;for(;;){const f=await H(t,r),h=f?.metadata?.status,y=$(f).filter(m=>m>I).sort((m,L)=>m-L);if(h==="BUILT"&&y.length>=2){O??=n();const m=(f?.spec?.tags??[]).filter(w=>w.name!==void 0),L=y[0],S=l(w=>Date.parse(w??"")>=L,"touchedSince"),A=m.filter(w=>!d.has(w.name)||S(w.createdAt)||S(w.updatedAt)),v=n()-O>=(s.tagGraceMs??6e4),P=(A.length>0?A:v?m:[]).sort((w,Y)=>(Y.updatedAt??"").localeCompare(w.updatedAt??""))[0]?.name;if(P!==void 0)return{ref:`sandbox/${r}:${P}`,buildMs:n()-e};if(v)throw new Error(`Blaxel built image ${r} but no tag appeared`)}if(h==="FAILED"||h==="TERMINATED"){const m=f?.metadata?.events??[];throw new Error(`building image ${r} ${h.toLowerCase()}: ${m[m.length-1]?.message??"no message"}`)}if(n()>K)throw new Error(`building image ${r} did not finish within ${T} ms (last status ${h??"none"})`);await a(s.pollMs??3e3)}}l(xt,"buildImage");const Lt=l(t=>`env-${t}`,"environmentImageName");function Rt(t){Z(t,{recursive:!0,force:!0})}l(Rt,"removeBuildDir");export{it as BLAXEL_TOML,st as BLAXEL_TOML_FILE,ft as BUILD_TIMEOUT_MS,C as GH_WRAPPER_PATH,nt as NODE_BASE_IMAGE,B as RECIPE_PI_AGENT_DIR,R as REPOS_DIR,c as RUN_USER,ct as RUN_USER_NPMRC,ot as SANDBOX_API_IMAGE,M as SETUP_FAILED_FILE,U as SETUP_LOG_FILE,_ as SETUP_SCRIPT_FILE,xt as buildImage,Ut as deleteImage,Lt as environmentImageName,H as getImage,_t as prepareBuildDir,ut as recipeDockerfile,Rt as removeBuildDir,ht as zipDirectory};
8
+ `)}c(_t,"prepareBuildDir");function F(t,r,i){for(const s of X(r).sort()){const a=g(r,s),n=z(a),e=Q(t,a).split("\\").join("/");n.isDirectory()?F(t,a,i):n.isSymbolicLink()?i.push({name:e,data:Buffer.from(V(a)),mode:D.S_IFLNK|511}):n.isFile()&&i.push({name:e,data:J(a),mode:D.S_IFREG|n.mode&511})}}c(F,"walk");function ft(t){const r=[];F(t,t,r);const i=[],s=[];let a=0;for(const o of r){const d=Buffer.from(o.name),$=et(o.data),I=tt(o.data),u=Buffer.alloc(30);u.writeUInt32LE(67324752,0),u.writeUInt16LE(20,4),u.writeUInt16LE(2048,6),u.writeUInt16LE(8,8),u.writeUInt32LE(33,12),u.writeUInt32LE(I,14),u.writeUInt32LE($.length,18),u.writeUInt32LE(o.data.length,22),u.writeUInt16LE(d.length,26),i.push(u,d,$);const l=Buffer.alloc(46);l.writeUInt32LE(33639248,0),l.writeUInt16LE(788,4),l.writeUInt16LE(20,6),l.writeUInt16LE(2048,8),l.writeUInt16LE(8,10),l.writeUInt32LE(33,14),l.writeUInt32LE(I,16),l.writeUInt32LE($.length,20),l.writeUInt32LE(o.data.length,24),l.writeUInt16LE(d.length,28),l.writeUInt32LE(o.mode<<16>>>0,38),l.writeUInt32LE(a,42),s.push(l,d),a+=u.length+d.length+$.length}const n=Buffer.concat(s),e=Buffer.alloc(22);return e.writeUInt32LE(101010256,0),e.writeUInt16LE(r.length,8),e.writeUInt16LE(r.length,10),e.writeUInt32LE(n.length,12),e.writeUInt32LE(a,16),Buffer.concat([...i,n,e])}c(ft,"zipDirectory");async function k(t,r,i,s,a=[]){const n=`${t.controlUrl??"https://api.blaxel.ai/v0"}${i}`,e=await(t.fetch??fetch)(n,{method:r,headers:{authorization:`Bearer ${t.apiKey}`,"x-blaxel-workspace":t.workspace,"content-type":"application/json"},...s===void 0?{}:{body:JSON.stringify(s)}}),o=await e.text();let d=null;if(o!=="")try{d=JSON.parse(o)}catch{d={raw:o}}if(!e.ok&&!a.includes(e.status))throw new rt(e.status,null,`Blaxel ${r} ${n} failed (${e.status}): ${o.slice(0,300)}`);return{status:e.status,headers:e.headers,json:d}}c(k,"api");async function H(t,r){const{status:i,json:s}=await k(t,"GET",`/images/sandbox/${encodeURIComponent(r)}`,void 0,[404]);return i===404?null:s}c(H,"getImage");async function Ut(t,r){await k(t,"DELETE",`/images/sandbox/${encodeURIComponent(r)}`,void 0,[404])}c(Ut,"deleteImage");const ht=60*6e4;async function xt(t,r,i,s={}){const a=s.sleep??(h=>new Promise(f=>setTimeout(f,h))),n=s.now??Date.now,e=n(),o=await H(t,r),d=new Set((o?.spec?.tags??[]).map(h=>h.name)),$=c(h=>(h?.metadata?.events??[]).map(f=>Date.parse(f.time??"")).filter(f=>!Number.isNaN(f)),"eventTimes"),I=Math.max(-1/0,...$(o)),l=(await k(t,"POST","/images",{resourceType:"sandbox",name:r})).headers.get("x-blaxel-upload-url");if(l===null)throw new Error(`Blaxel gave no upload URL for image ${r}`);const x=await(t.fetch??fetch)(l,{method:"PUT",headers:{"content-type":"application/zip"},body:new Uint8Array(ft(i))});if(!x.ok)throw new Error(`uploading the build context of image ${r} failed (${x.status}): ${(await x.text()).slice(0,300)}`);const T=s.timeoutMs??ht,K=e+T;let O=null;for(;;){const h=await H(t,r),f=h?.metadata?.status,y=$(h).filter(m=>m>I).sort((m,L)=>m-L);if(f==="BUILT"&&y.length>=2){O??=n();const m=(h?.spec?.tags??[]).filter(w=>w.name!==void 0),L=y[0],S=c(w=>Date.parse(w??"")>=L,"touchedSince"),A=m.filter(w=>!d.has(w.name)||S(w.createdAt)||S(w.updatedAt)),v=n()-O>=(s.tagGraceMs??6e4),P=(A.length>0?A:v?m:[]).sort((w,Y)=>(Y.updatedAt??"").localeCompare(w.updatedAt??""))[0]?.name;if(P!==void 0)return{ref:`sandbox/${r}:${P}`,buildMs:n()-e};if(v)throw new Error(`Blaxel built image ${r} but no tag appeared`)}if(f==="FAILED"||f==="TERMINATED"){const m=h?.metadata?.events??[];throw new Error(`building image ${r} ${f.toLowerCase()}: ${m[m.length-1]?.message??"no message"}`)}if(n()>K)throw new Error(`building image ${r} did not finish within ${T} ms (last status ${f??"none"})`);await a(s.pollMs??3e3)}}c(xt,"buildImage");const Lt=c(t=>`env-${t}`,"environmentImageName");function Rt(t){Z(t,{recursive:!0,force:!0})}c(Rt,"removeBuildDir");export{it as BLAXEL_TOML,st as BLAXEL_TOML_FILE,ht as BUILD_TIMEOUT_MS,C as GH_WRAPPER_PATH,nt as NODE_BASE_IMAGE,B as RECIPE_PI_AGENT_DIR,R as REPOS_DIR,p as RUN_USER,ct as RUN_USER_NPMRC,ot as SANDBOX_API_IMAGE,M as SETUP_FAILED_FILE,U as SETUP_LOG_FILE,_ as SETUP_SCRIPT_FILE,xt as buildImage,Ut as deleteImage,Lt as environmentImageName,H as getImage,_t as prepareBuildDir,ut as recipeDockerfile,Rt as removeBuildDir,ft as zipDirectory};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.725",
3
+ "version": "0.3.727",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -158,8 +158,8 @@
158
158
  },
159
159
  "license": "UNLICENSED",
160
160
  "dependencies": {
161
- "@north-light/identity": "0.3.725",
162
- "@north-light/plugin": "0.3.725",
161
+ "@north-light/identity": "0.3.727",
162
+ "@north-light/plugin": "0.3.727",
163
163
  "@earendil-works/chord": "1.5.2",
164
164
  "@earendil-works/pi-agent-core": "1.5.2",
165
165
  "@earendil-works/pi-ai": "1.5.2",
@@ -160,7 +160,7 @@ class Handle {
160
160
  async run(config) {
161
161
  const transaction = transactionContext.getStore();
162
162
  try {
163
- if (transaction !== undefined && transaction.open && transaction.handle === this) {
163
+ if (transaction !== undefined && transaction.open && transaction.handle.url === this.url) {
164
164
  const began = performance.now();
165
165
  try {
166
166
  return await transaction.client.query(config);
@@ -212,7 +212,7 @@ function bindable(value) {
212
212
  }
213
213
  function ownsTransaction(handle) {
214
214
  const owned = transactionContext.getStore();
215
- return owned !== undefined && owned.open && owned.handle === handle;
215
+ return owned !== undefined && owned.open && owned.handle.url === handle.url;
216
216
  }
217
217
  // ---------------------------------------------------------------------------
218
218
  // Schema
@@ -73,10 +73,11 @@ export function recipeDockerfile(recipe, revision, packagesToken = false) {
73
73
  out.push('WORKDIR /work');
74
74
  out.push(`RUN ${writeRunUserNpmrc()}`);
75
75
  // Warm the image's pnpm store from each repository's lockfile, so `pnpm install` in the sandbox links instead of downloading. A failed fetch only costs that
76
- // warmth, so it is logged and never refuses the sandbox start. The fetch runs as root, so the repository and the store go back to the run user after it:
77
- // a setup script's `su crtr -c 'pnpm install'` cannot replace a root-owned `node_modules/.modules.yaml`.
76
+ // warmth, so it is logged and never refuses the sandbox start. The fetch runs as the run user, so the repository and the store are already its own and a
77
+ // setup script's `su crtr -c 'pnpm install'` can write them. No step here may `chown -R` the trees: each one rewrites every file into a new layer, and the
78
+ // doubled multi-GB image kept Blaxel's build at BUILDING past the timeout. The final stage's `COPY --chown` sets ownership once.
78
79
  for (const repo of recipe.repositories) {
79
- out.push(`RUN if [ -f /work/${repo.name}/pnpm-lock.yaml ]; then cd /work/${repo.name} && HOME=/home/${RUN_USER} pnpm fetch >> ${SETUP_LOG_FILE} 2>&1 || echo 'pnpm fetch ${repo.name} failed' >> ${SETUP_LOG_FILE}; chown -R ${RUN_USER}:${RUN_USER} /work/${repo.name} /home/${RUN_USER}; fi`);
80
+ out.push(`RUN if [ -f /work/${repo.name}/pnpm-lock.yaml ]; then su ${RUN_USER} -c 'cd /work/${repo.name} && HOME=/home/${RUN_USER} pnpm fetch' >> ${SETUP_LOG_FILE} 2>&1 || echo 'pnpm fetch ${repo.name} failed' >> ${SETUP_LOG_FILE}; fi`);
80
81
  }
81
82
  for (const source of packages)
82
83
  out.push(guarded(`pi install ${source}`, `HOME=/var/lib/crtr PI_CODING_AGENT_DIR=${RECIPE_PI_AGENT_DIR} pi install ${shellQuote(source)}`));
@@ -84,7 +85,7 @@ export function recipeDockerfile(recipe, revision, packagesToken = false) {
84
85
  // 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.
85
86
  if (hasScript)
86
87
  out.push(guarded('setup script', `bash /tmp/${SETUP_SCRIPT_FILE}`));
87
- out.push(guarded('finalize', `echo ${Math.trunc(revision)} > /work/.crtr/recipe-revision && chown -R ${RUN_USER} /work /home/${RUN_USER} /var/lib/crtr`));
88
+ out.push(guarded('finalize', `echo ${Math.trunc(revision)} > /work/.crtr/recipe-revision`));
88
89
  out.push('', ...base);
89
90
  // Blaxel keeps the ownership set in the Dockerfile only for an image that declares a final USER (an image without one is built all root-owned); the final USER is below.
90
91
  for (const dir of ['/work', `/home/${RUN_USER}`, '/var/lib/crtr'])
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/api",
3
- "version": "0.3.725",
3
+ "version": "0.3.727",
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/identity",
3
- "version": "0.3.725",
3
+ "version": "0.3.727",
4
4
  "description": "Northlight access-token verification and scope rules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/plugin",
3
- "version": "0.3.725",
3
+ "version": "0.3.727",
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.725",
31
- "@north-light/identity": "0.3.725"
30
+ "@north-light/api": "0.3.727",
31
+ "@north-light/identity": "0.3.727"
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.725",
3
+ "version": "0.3.727",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/cli",
9
- "version": "0.3.725",
9
+ "version": "0.3.727",
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.725",
32
- "@north-light/plugin": "0.3.725",
31
+ "@north-light/identity": "0.3.727",
32
+ "@north-light/plugin": "0.3.727",
33
33
  "cron-parser": "^5.6.0",
34
34
  "esbuild": "0.28.2",
35
35
  "jose": "^6.2.12",
@@ -11902,17 +11902,17 @@
11902
11902
  },
11903
11903
  "packages/crouter-api": {
11904
11904
  "name": "@north-light/api",
11905
- "version": "0.3.725",
11905
+ "version": "0.3.727",
11906
11906
  "license": "UNLICENSED"
11907
11907
  },
11908
11908
  "packages/crouter-env-docker": {
11909
11909
  "name": "@north-light/env-docker",
11910
- "version": "0.3.725",
11910
+ "version": "0.3.727",
11911
11911
  "license": "UNLICENSED"
11912
11912
  },
11913
11913
  "packages/crouter-identity": {
11914
11914
  "name": "@north-light/identity",
11915
- "version": "0.3.725",
11915
+ "version": "0.3.727",
11916
11916
  "license": "UNLICENSED",
11917
11917
  "dependencies": {
11918
11918
  "jose": "^6.2.1"
@@ -11920,21 +11920,21 @@
11920
11920
  },
11921
11921
  "packages/crouter-plugin": {
11922
11922
  "name": "@north-light/plugin",
11923
- "version": "0.3.725",
11923
+ "version": "0.3.727",
11924
11924
  "license": "UNLICENSED",
11925
11925
  "dependencies": {
11926
- "@north-light/api": "0.3.725",
11927
- "@north-light/identity": "0.3.725"
11926
+ "@north-light/api": "0.3.727",
11927
+ "@north-light/identity": "0.3.727"
11928
11928
  }
11929
11929
  },
11930
11930
  "packages/crouter-sdk": {
11931
11931
  "name": "@north-light/sdk",
11932
- "version": "0.3.725",
11932
+ "version": "0.3.727",
11933
11933
  "license": "UNLICENSED",
11934
11934
  "dependencies": {
11935
- "@north-light/api": "0.3.725",
11936
- "@north-light/identity": "0.3.725",
11937
- "@north-light/plugin": "0.3.725",
11935
+ "@north-light/api": "0.3.727",
11936
+ "@north-light/identity": "0.3.727",
11937
+ "@north-light/plugin": "0.3.727",
11938
11938
  "jose": "^6.2.1"
11939
11939
  },
11940
11940
  "bin": {