@hermenics/deepseek-code 0.13.2 → 0.13.3
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/README.md +5 -5
- package/dist/cli.mjs +804 -774
- package/dist/shell-supervisor.mjs +9 -9
- package/package.json +6 -6
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{createHash as
|
|
3
|
-
`,"utf8")}finally{await V.close()}}).catch((V)=>{this.writeError=V instanceof Error?V:Error(String(V))});return K}subscribe($){return this.listeners.add($),()=>this.listeners.delete($)}list($){return this.memory.filter((Z)=>!$||Z.taskId===$).map((Z)=>structuredClone(Z))}async flush(){if(await this.writeChain,this.writeError)throw this.writeError}}import{createHash as
|
|
4
|
-
`,{encoding:"utf8",mode:384})}catch(W){throw await W0(J,"incomplete").catch(()=>!1),W}let Y=!1,U,H=async()=>{if(Y)return;let W;try{W=JSON.parse(await p0(t(J,"owner.json"),"utf8"))}catch(X){if(X.code!=="ENOENT")throw X;try{await H0(J)}catch(G){if(G.code!=="ENOENT")throw G;Y=!0;return}throw X}if(W.token!==K){Y=!0;return}try{if(await W0(J,"released")){Y=!0;return}}catch(X){try{await H0(J)}catch(G){if(G.code!=="ENOENT")throw G;Y=!0;return}throw X}try{await H0(J)}catch(X){if(X.code!=="ENOENT")throw X;Y=!0;return}throw Error("Lease directory could not be moved aside")};return{token:K,path:J,release(){if(Y)return Promise.resolve();if(U)return U;let W;return W=H().finally(()=>{if(U===W)U=void 0}),U=W,W}}}catch(Y){if(Y.code!=="EEXIST")throw Y;if(await p2(J))continue;await y2(25,Q)}}var u0=new Intl.Segmenter(void 0,{granularity:"grapheme"});function l0($,Z){return Math.max(0,Math.min($.length,Number.isNaN(Z)?0:Math.trunc(Z)))}function h($,Z){let Q=l0($,Z);if(Q===0||Q===$.length)return Q;let z=0;for(let J of u0.segment($)){let K=J.index+J.segment.length;if(K>Q)return J.index;z=K}return z}function s($,Z){let Q=l0($,Z);if(Q===0||Q===$.length)return Q;for(let z of u0.segment($)){let J=z.index+z.segment.length;if(z.index>=Q)return z.index;if(J>Q)return J}return $.length}var n0=2000000,i=20971520,$0=10,a2=16777216,r2=33554432,t2=256;var e2=60000,F0=n0,L0=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,v=new Map;function z0($,Z){let Q=Z0("sha256").update($).digest("hex");return A(Z??process.env.HOME??R0(),".deepseek-code","shell-output",Q)}function a0($,Z,Q){let z=Z0("sha256").update($).digest("hex"),J=Q??(Z?A(d0(Z),`${c2(Z)||"shell-output"}-recovery`):A(process.env.HOME??R0(),".deepseek","shell-output-recovery"));return A(J,z)}function $3($){let Z=typeof process.getuid==="function"?String(process.getuid()):Z0("sha256").update(R0()).digest("hex").slice(0,16);return $??A(l2(),`deepseek-code-shell-output-${Z}`)}function r0($,Z){let Q=Z0("sha256").update($).digest("hex");return A($3(Z),Q)}async function t0($){try{let Z=await e($);if(!Z.isDirectory()||Z.isSymbolicLink()||typeof process.getuid==="function"&&Z.uid!==process.getuid())return;let Q=A($,"supervisors"),z=await e(Q).catch((U)=>{if(U.code==="ENOENT")return;throw U});if(!z)return new Set;if(!z.isDirectory()||z.isSymbolicLink()||typeof process.getuid==="function"&&z.uid!==process.getuid())return;let J=new Set,K=0,V=0,Y=await o2(Q);for await(let U of Y){if(!/^[a-f0-9]{64}\.json$/i.test(U.name))continue;if(++V>t2)return;let H=A(Q,U.name),W=await e(H);if(!W.isFile()||W.isSymbolicLink()||typeof process.getuid==="function"&&W.uid!==process.getuid()||W.size>a2)return;if(K+=W.size,K>r2)return;let X=JSON.parse(await j0(H,"utf8"));if(X.schema!=="shell_supervisor_v1")return;for(let G of[X.outputId,X.reservedOutputId]){if(G===void 0)continue;if(typeof G!=="string"||!L0.test(G))return;J.add(G)}}return J}catch(Z){if(["ENOENT","ENOTDIR"].includes(Z.code??""))return new Set;return}}async function Z3($,Z,Q){let J=(await Promise.all((await s2($)).filter((U)=>L0.test(U)).map(async(U)=>({id:U,path:A($,U),info:await i2(A($,U)).catch(()=>null)})))).filter((U)=>U.info!==null).sort((U,H)=>U.info.mtimeMs-H.info.mtimeMs),K=J.reduce((U,H)=>U+H.info.size,0),V=J.length,Y=[];for(let U of J){if(V<=$0&&K<=i)break;if(U.id===Z||Q===void 0||Q.has(U.id))continue;try{await i0(U.path)}catch(H){if(H.code!=="ENOENT"){Y.push(H);continue}}V--,K-=U.info.size}if(Y.length>0){let U=Error(`Failed to remove ${Y.length} shell output artifact(s) during cleanup`);throw Object.assign(U,{code:Y[0]?.code}),U}return V<=$0&&K<=i}async function B0($,Z,Q,z){try{await z3($,Z,Q)}catch(J){return{stored:!1,error:J}}try{if(await Z3($,Z,z))return{stored:!0};try{await i0(A($,Z))}catch(J){if(J.code!=="ENOENT")return{stored:!0,cleanupWarning:`retention cleanup ${J.code??"failed"}`}}return{stored:!1,error:Object.assign(Error("Shell output retention quota is occupied by referenced artifacts"),{code:"ENOSPC"})}}catch(J){return{stored:!0,cleanupWarning:`cleanup ${J.code??"failed"}`}}}function b0($,Z){return`${$}\x00${Z}`}function M0($){return Z0("sha256").update(JSON.stringify({totalChars:$.totalChars,storedChars:$.storedChars,truncated:$.truncated,redacted:$.redacted===!0,content:$.content,provenance:$.provenance??null})).digest("hex")}function G0($){try{let Z=JSON.parse($);if(typeof Z.content!=="string")return!1;if(Z.contentHash===void 0)return Z.schemaVersion!==2;if(!Number.isSafeInteger(Z.totalChars)||!Number.isSafeInteger(Z.storedChars)||typeof Z.truncated!=="boolean")return!1;return Z.contentHash===M0(Z)}catch{return!1}}async function c0($,Z,Q,z,J,K){let V=JSON.stringify({...Q,schemaVersion:2,storage:"memory",contentHash:M0({...Q,content:z,provenance:J}),content:z,...J?{provenance:J}:{}}),Y=Buffer.byteLength(V,"utf8");if(Y>i)return!1;let U=b0($,Z),H=new Map([[$,K]]);for(let B of v.values())if(!H.has(B.directory))H.set(B.directory,await t0(B.directory));let W=[...v.values()].filter((B)=>{let N=H.get(B.directory);return N===void 0||N.has(B.id)});if(W.length+1>$0||W.reduce((B,N)=>B+N.bytes,Y)>i)return!1;v.set(U,{directory:$,id:Z,raw:V,bytes:Y,createdAt:Date.now()});let X=[...v.entries()].sort((B,N)=>B[1].createdAt-N[1].createdAt),G=X.reduce((B,[,N])=>B+N.bytes,0),k=X.length;for(let[B,N]of X){if(k<=$0&&G<=i)break;let M=H.get(N.directory);if(B===U||M===void 0||M.has(N.id))continue;v.delete(B),k--,G-=N.bytes}if(k>$0||G>i)v.delete(U);return v.has(U)}async function z3($,Z,Q){if(await s0($,{recursive:!0,mode:448}),!(await e($)).isDirectory())throw Error("shell output storage path is not a directory");await o0($,448),await n2(A($,Z),Q,{encoding:"utf8",mode:384,flag:"wx"})}async function Q3($){await s0($,{mode:448}).catch((Q)=>{if(Q.code!=="EEXIST")throw Q});let Z=await e($);if(!Z.isDirectory()||Z.isSymbolicLink()||typeof process.getuid==="function"&&Z.uid!==process.getuid())throw Error("Shell emergency output root is not an owned directory");await o0($,448)}async function N0($,Z,Q,z,J,K,V){let Y=M0({...Q,content:z,provenance:J}),U=JSON.stringify({...Q,schemaVersion:2,storage:"emergency-disk",contentHash:Y,retentionWarning:K,content:z,...J?{provenance:J}:{}});try{await Q3(d0($))}catch(W){return{retained:!1,warning:`${K}; emergency storage failed (${W.code??"failed"})`}}let H=await B0($,Z,U,V);if(!H.stored)return{retained:!1,warning:`${K}; emergency storage failed (${H.error?.code??"failed"})`};if(H.cleanupWarning)K+=`; emergency ${H.cleanupWarning}`;return{retained:!0,warning:K}}async function J3($,Z,Q,z){let J=v.get(b0($,z));if(J){if(G0(J.raw))return J.raw;v.delete(b0($,z))}let K;try{let V=await j0(A($,z),"utf8");if(G0(V))return V;K=Error("Shell output artifact integrity check failed")}catch(V){K=V}try{let V=await j0(A(Z,z),"utf8");if(G0(V))return V;throw Error("Shell output artifact integrity check failed")}catch{}try{let V=await j0(A(Q,z),"utf8");if(G0(V))return V;throw Error("Shell output artifact integrity check failed")}catch{throw K}}async function e0($,Z,Q){let z=z0($,Z),J=new AbortController,K=setTimeout(()=>J.abort(Error("Timed out waiting for the shell output artifact lease")),e2),V;try{if(V=await X0(`shell-output-artifacts:${d2(z)}`,{},J.signal),J.signal.aborted)throw await V.release(),J.signal.reason}finally{clearTimeout(K)}try{return await Q((Y,U,H,W,X,G)=>K3($,Y,U,Z,H,W,X,G))}finally{await V.release()}}async function K3($,Z,Q=Z.length,z,J,K,V,Y=u2()){if(!L0.test(Y))throw Error("Invalid shell output ID");let U=z0($,z),H=a0($,z,K),W=r0($,V),X=await t0(U),G=Y,k=c(Z),B=h(k,n0),N={totalChars:Q,storedChars:B,truncated:B<Q,redacted:k!==Z},M=k.slice(0,B),D=M0({...N,content:M,provenance:J}),q=JSON.stringify({...N,schemaVersion:2,storage:"disk",contentHash:D,content:M,...J?{provenance:J}:{}}),E=await B0(U,G,q,X);if(!E.stored){let C=E.error,O=`primary storage failed (${C?.code??"failed"})`;if(H!==U){let l=JSON.stringify({...N,schemaVersion:2,storage:"recovery-disk",contentHash:D,retentionWarning:O,content:M,...J?{provenance:J}:{}}),b=await B0(H,G,l,X);if(b.stored){let S=O;if(b.cleanupWarning)S+=`; recovery ${b.cleanupWarning}`;if(W!==U&&W!==H){let f=await N0(W,G,N,M,J,`${O}; emergency mirror`,X);S+=f.retained?"; emergency copy retained":`; ${f.warning}`}return{id:G,metadata:{...N,storage:"recovery-disk",retentionWarning:S}}}let y=`recovery storage failed (${b.error?.code??"failed"})`;if(W!==U&&W!==H){let S=await N0(W,G,N,M,J,`${O}; ${y}`,X);if(S.retained)return{id:G,metadata:{...N,storage:"emergency-disk",retentionWarning:S.warning}};let f={...N,storage:"memory",retentionWarning:S.warning};if(await c0(U,G,N,M,J,X))return{id:G,metadata:f};throw C}}let x=W!==U&&W!==H?await N0(W,G,N,M,J,O,X):null;if(x?.retained)return{id:G,metadata:{...N,storage:"emergency-disk",retentionWarning:x.warning}};let g={...N,storage:"memory",retentionWarning:x?.warning??O};if(await c0(U,G,N,M,J,X))return{id:G,metadata:g};throw C}let w;if(H!==U){let C=JSON.stringify({...N,schemaVersion:2,storage:"recovery-disk",contentHash:D,content:M,...J?{provenance:J}:{}}),O=await B0(H,G,C,X);if(O.stored){if(O.cleanupWarning)w=`recovery ${O.cleanupWarning}`}else{let x=`recovery copy failed (${O.error?.code??"failed"})`;if(W!==U&&W!==H){let g=await N0(W,G,N,M,J,x,X);w=g.retained?`${x}; emergency copy retained`:g.warning}else w=x}}if(E.cleanupWarning)w=[w,`primary ${E.cleanupWarning}`].filter(Boolean).join("; ");return{id:G,metadata:{...N,storage:"disk",...w?{retentionWarning:w}:{}}}}async function $2($,Z,Q,z,J){if(!L0.test(Z))throw Error("Invalid shell output ID");let K=await J3(z0($,Q),a0($,Q,z),r0($,J),Z),V=JSON.parse(K);if(typeof V.content!=="string"||!Number.isSafeInteger(V.totalChars)||!Number.isSafeInteger(V.storedChars)||typeof V.truncated!=="boolean"||!["disk","recovery-disk","emergency-disk","memory"].includes(V.storage??""))throw Error("Shell output artifact is malformed");let Y={totalChars:V.totalChars,storedChars:V.storedChars,truncated:V.truncated,redacted:V.redacted===!0,storage:V.storage,...typeof V.retentionWarning==="string"?{retentionWarning:V.retentionWarning}:{}};return{content:c(V.content),metadata:Y,...V.provenance?{provenance:V.provenance}:{}}}import{execFileSync as V3}from"child_process";function Y3($,Z){if(process.platform==="win32"||!Number.isSafeInteger($)||$<2)return!1;try{return process.kill(-$,Z),!0}catch(Q){if(Q.code==="ESRCH")return!1;throw Q}}function Z2($,Z){if($.pid&&process.platform!=="win32"){if(!Y3($.pid,Z))$.kill(Z)}else if($.pid&&process.platform==="win32")try{V3("taskkill",["/PID",String($.pid),"/T",...Z==="SIGKILL"?["/F"]:[]],{stdio:"ignore",timeout:1000})}catch{$.kill(Z)}else $.kill(Z)}class Q2{state="text";push($,Z=!1){let Q="";for(let z of $){let J=z.codePointAt(0);switch(this.state){case"text":if(J===27)this.state="escape";else if(J===155)this.state="csi";else if(J===157)this.state="osc";else if(J===144||J===152||J===158||J===159)this.state="string";else Q+=z;break;case"escape":if(z==="[")this.state="csi";else if(z==="]")this.state="osc";else if(z==="P"||z==="X"||z==="^"||z==="_")this.state="string";else this.state="text";break;case"csi":if(J>=64&&J<=126)this.state="text";break;case"osc":if(J===7)this.state="text";else if(J===156)this.state="text";else if(J===27)this.state="oscEscape";break;case"oscEscape":this.state=z==="\\"?"text":z==="\x1B"?"oscEscape":"osc";break;case"string":if(J===156)this.state="text";else if(J===27)this.state="stringEscape";break;case"stringEscape":this.state=z==="\\"?"text":z==="\x1B"?"stringEscape":"string";break}}if(Z&&this.state!=="text")this.state="text";return Q}}var H3=4096,Q0=8000,D0=8000,W3=/\b(?:error(?:\b|_[A-Z0-9_]+)|fatal|exception|traceback|fail(?:ed|ure)?|panic(?:ked)?|module not found|no module named|modulenotfounderror|cannot find symbol|unresolved (?:reference|import)|undefined reference|caused by)\b|\b[A-Za-z][A-Za-z0-9_.]*(?:Error|Exception)\b|\bundefined:|\b(?:command not found|no such file or directory)\b|\bTS\d{4,5}\b|\bERR_[A-Z0-9_]+\b|\b(?:npm|pnpm|yarn)\s+ERR!|^\s*(?:make(?:\[\d+\])?:\s+\*\*\*|ninja:\s+build stopped)/i;function z2(){return{schema:"shell_channel_provenance_v1",ordering:"observed-arrival",stdoutChars:0,stderrChars:0,retainedChars:0,segments:[],segmentsOmitted:0,contentOmitted:0,drainTimedOut:!1}}class J2{full="";head="";middle="";tail="";total=0;append($){if(!$)return;if(this.full!==null&&this.total+$.length<=Q0*3){this.full+=$,this.total+=$.length;return}if(this.full!==null){let Z=this.full;this.full=null,this.total=0,this.appendSample(Z)}this.appendSample($)}appendSample($){if(!$)return;if(this.head.length<Q0)this.head+=$.slice(0,h($,Q0-this.head.length));if(!this.middle&&this.total+$.length>1e6){let Q=Math.max(0,1e6-this.total);this.middle=$.slice(s($,Q),h($,Q+Q0))}let Z=this.tail+$;this.tail=Z.slice(s(Z,Z.length-Q0)),this.total+=$.length}render(){if(this.full!==null)return this.full;let $=Math.max(0,this.total-this.head.length-this.middle.length-this.tail.length);return`${this.head}
|
|
2
|
+
import{createHash as _3,randomUUID as b3}from"crypto";import{spawn as R3}from"child_process";import{chmod as q3,lstat as B2,mkdir as E3,open as C3,readdir as A3,rename as I3,unlink as N2,writeFile as x3}from"fs/promises";import{existsSync as v5,lstatSync as S3,readFileSync as F2}from"fs";import{dirname as g3,join as n,resolve as f3}from"path";import{closeSync as P2,openSync as O2,readSync as _2,readlinkSync as b2,readdirSync as R2}from"fs";function Y0($){let Z=O2($,"r");try{let Q=Buffer.alloc(4097),z=0;while(z<Q.length){let J=_2(Z,Q,z,Q.length-z,null);if(!J)break;z+=J}if(z>4096)throw Error("Process identity exceeds its byte limit");return Q.subarray(0,z).toString("utf8").trim()}finally{P2(Z)}}function P0($,Z){let Q=$.lastIndexOf(")"),z=$.indexOf("("),J=$.slice(Q+1).trim().split(/\s+/);if(!Number.isSafeInteger(Z)||Z<1||z<1||Q<=z||$.slice(0,z).trim()!==String(Z)||!/^[A-Za-z]$/.test(J[0]??"")||!/^\d+$/.test(J[2]??"")||!/^\d+$/.test(J[3]??"")||!/^\d+$/.test(J[19]??""))throw Error("Invalid process identity");return{state:J[0],processGroupId:Number(J[2]),sessionId:Number(J[3]),startTimeTicks:J[19]}}function I0(){let $=b2("/proc/self/ns/pid");if(!/^pid:\[[0-9]+\]$/.test($))throw Error("Invalid PID namespace identity");return $}function x0(){let $=Y0("/proc/sys/kernel/random/boot_id");if(!/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test($))throw Error("Invalid boot identity");return $}function O0($){let Z={...$,observedAt:new Date().toISOString(),status:"unknown",provenance:"unavailable"},Q=$.identity;if(!Q&&$.provenance==="child-event")return structuredClone($);if(process.platform!=="linux"||!Q||Q.platform!=="linux"||!Number.isSafeInteger(Q.pid)||Q.pid<1)return{...Z,reason:"identity-unavailable"};let z=Q.processGroupId===Q.pid?Q.processGroupId:void 0,J={...Z,scope:z?"process-group":"leader-only"};try{if(x0()!==Q.bootId){let Y=z?{id:z,status:"exited",observedAt:Z.observedAt,memberCount:0,reason:"different-boot"}:void 0;return $.provenance==="child-event"?{...$,scope:J.scope,processGroup:Y,observedAt:Z.observedAt}:{...J,status:"identity-mismatch",provenance:"kernel",reason:"different-boot",processGroup:Y}}if(I0()!==Q.pidNamespace){let Y=z?{id:z,status:"unknown",observedAt:Z.observedAt,reason:"different-pid-namespace"}:void 0;return $.provenance==="child-event"?{...$,scope:J.scope,processGroup:Y,observedAt:Z.observedAt}:{...J,reason:"different-pid-namespace",processGroup:Y}}}catch{let Y=z?{id:z,status:"unknown",observedAt:Z.observedAt,reason:"observation-unavailable"}:void 0;return $.provenance==="child-event"?{...$,scope:J.scope,processGroup:Y,observedAt:Z.observedAt}:{...J,reason:"observation-unavailable",processGroup:Y}}let K=$.provenance==="child-event"?{...$,scope:J.scope,observedAt:Z.observedAt}:J,V=!1;if($.provenance!=="child-event")try{let Y=P0(Y0(`/proc/${Q.pid}/stat`),Q.pid);if(Y.startTimeTicks!==Q.startTimeTicks||Q.sessionId!==void 0&&Y.sessionId!==Q.sessionId)K={...K,status:"identity-mismatch",provenance:"kernel",reason:"different-process"};else K={...K,status:/^[ZXx]$/.test(Y.state)?"exited":"alive",provenance:"kernel",reason:void 0},V=!!z&&Y.processGroupId===z&&!/^[ZXx]$/.test(Y.state)}catch(Y){if(Y.code==="ENOENT"||Y.code==="ESRCH")K={...K,status:"exited",provenance:"kernel",reason:"leader-absent"};else K={...K,reason:"observation-unavailable"}}if(!z)return K;return{...K,processGroup:q2(z,Q.sessionId,V)}}function q2($,Z,Q){let z=new Date().toISOString();if(Q)return{id:$,status:"alive",observedAt:z};try{let J=R2("/proc").filter((V)=>/^\d+$/.test(V));if(J.length>1e5)return{id:$,status:"unknown",observedAt:z,reason:"proc-entry-limit"};let K=0;for(let V of J){let Y=Number(V);try{let U=P0(Y0(`/proc/${Y}/stat`),Y);if(U.processGroupId===$&&(Z===void 0||U.sessionId===Z)&&!/^[ZXx]$/.test(U.state))K++}catch(U){let H=U.code;if(H!=="ENOENT"&&H!=="ESRCH")return{id:$,status:"unknown",observedAt:z,reason:"member-observation-unavailable"}}}return{id:$,status:K?"alive":"exited",observedAt:z,memberCount:K}}catch{return{id:$,status:"unknown",observedAt:z,reason:"proc-scan-unavailable"}}}function E2($){let Z={status:"unknown",observedAt:new Date().toISOString(),provenance:"unavailable",scope:"leader-only",progress:"not-measured",reason:"identity-unavailable"};if(process.platform!=="linux"||!Number.isSafeInteger($)||$<1)return Z;try{let Q=P0(Y0(`/proc/${$}/stat`),$),z={platform:"linux",pid:$,bootId:x0(),pidNamespace:I0(),startTimeTicks:Q.startTimeTicks,sessionId:Q.sessionId,processGroupId:Q.processGroupId};return O0({...Z,scope:z.processGroupId===z.pid?"process-group":"leader-only",identity:z})}catch{return Z}}function S0(){return E2(process.pid)}import{StringDecoder as X3}from"string_decoder";import{createHash as Z0,randomUUID as c2}from"crypto";import{homedir as R0,tmpdir as d2}from"os";import{basename as o2,dirname as o0,join as A,resolve as s2}from"path";import{chmod as s0,lstat as e,mkdir as i0,opendir as i2,readdir as n2,readFile as j0,stat as a2,unlink as n0,writeFile as r2}from"fs/promises";import{randomUUID as g0}from"crypto";import{mkdir as C2,open as A2}from"fs/promises";import{dirname as I2}from"path";function f0($){let Z=$.toLowerCase().replace(/[^a-z0-9]/g,"");return/(?:apikey|authorization|cookie|credentials?|password|passwd|privatekey|secret)/.test(Z)||/(?:access|auth|refresh|session)?token$/.test(Z)}function x2($,Z){let Q="",z=0,J=0;while(J<$.length){let K=$[J]==='"'||$[J]==="'",V=K?J+1:J;if(!/[A-Za-z_]/.test($[V]??"")||J>0&&/[A-Za-z0-9_.-]/.test($[J-1])){J++;continue}let Y=V+1;while(Y<$.length&&/[A-Za-z0-9_.-]/.test($[Y]))Y++;let U=K?$[J]:"";if(U&&$[Y]!==U){J++;continue}let H=U?Y+1:Y;while(/\s/.test($[H]??""))H++;if($[H]!==":"&&$[H]!=="="){J=Y;continue}H++;while(/\s/.test($[H]??""))H++;if(!f0($.slice(V,Y))){J=Y;continue}let X=$[H]==='"'||$[H]==="'"?$[H]:"",W=H;if(X){W++;while(W<$.length){if($[W]==="\\"){W+=2;continue}if($[W]===X){W++;break}W++}}else while(W<$.length&&!/[\s,;}"']/.test($[W]))W++;Q+=$.slice(z,H),W=Math.min(W,$.length);let G=X&&W>H+1&&$[W-1]===X?X:"";Q+=X+Z($.slice(H+(X?1:0),W-(G?1:0)))+G,z=W,J=W}return z?Q+$.slice(z):$}function h0($,Z){let Q=$.replace(/(bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,(z,J)=>J+Z(z.slice(J.length))).replace(/-----BEGIN [^-\n]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-\n]*PRIVATE KEY-----|$)/g,(z)=>Z(z,"[REDACTED PRIVATE KEY]")).replace(/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|AKIA[A-Z0-9]{16})\b/g,(z)=>Z(z)).replace(/\b(sk-[A-Za-z0-9_-]{12,})\b/g,(z)=>Z(z)).replace(/(:\/\/)[^/\s?#@:]*:[^/\s?#]*@/g,(z,J)=>J+Z(z.slice(J.length,-1))+"@").replace(/((?:api[_-]?key|password|secret|token|credential)\s*[=:]\s*)[^\s,;"']+/gi,(z,J)=>J+Z(z.slice(J.length)));return x2(Q,Z)}function c($){return h0($,(Z)=>Z.replace(/[^\r\n]/g,"*"))}function U0($,Z=""){if(f0(Z))return"[REDACTED]";if(Array.isArray($))return $.map((Q)=>U0(Q));if($&&typeof $==="object")return Object.fromEntries(Object.entries($).map(([Q,z])=>[Q,U0(z,Q)]));if(typeof $==="string"){if(/^\s*[\[{]/.test($)){let Q;try{Q=JSON.parse($)}catch{}if(Q&&typeof Q==="object"){let z=JSON.stringify(U0(Q));return z===JSON.stringify(Q)?$:z}}return h0($,(Q,z="[REDACTED]")=>z)}return $}class S2{sessionId;logFile;listeners=new Set;memory=[];writeChain=Promise.resolve();writeError;constructor($,Z){this.sessionId=$;this.logFile=Z}emit($,Z,Q,z,J=g0()){let K={schemaVersion:1,eventId:g0(),sessionId:this.sessionId,taskId:Q,parentTaskId:z,correlationId:J,type:$,timestamp:new Date().toISOString(),payload:U0(Z)};this.memory.push(K);for(let V of this.listeners)try{V(structuredClone(K))}catch{}if(this.logFile)this.writeChain=this.writeChain.then(async()=>{await C2(I2(this.logFile),{recursive:!0});let V=await A2(this.logFile,"a",384);try{await V.chmod(384),await V.writeFile(`${JSON.stringify(K)}
|
|
3
|
+
`,"utf8")}finally{await V.close()}}).catch((V)=>{this.writeError=V instanceof Error?V:Error(String(V))});return K}subscribe($){return this.listeners.add($),()=>this.listeners.delete($)}list($){return this.memory.filter((Z)=>!$||Z.taskId===$).map((Z)=>structuredClone(Z))}async flush(){if(await this.writeChain,this.writeError)throw this.writeError}}import{createHash as h2,randomUUID as p0}from"crypto";import{mkdir as y0,readFile as u0,rm as v2,stat as H0,writeFile as y2}from"fs/promises";import{tmpdir as m2}from"os";import{join as t}from"path";import{chmod as $5,readFile as Z5,writeFile as z5,readdir as Q5,rename as g2}from"fs/promises";var f2=new Set(["EPERM","EACCES","EBUSY"]);async function v0($,Z,{platform:Q=process.platform,renameFile:z=g2,attempts:J=10}={}){for(let K=1;;K++)try{return await z($,Z)}catch(V){let Y=V.code??"";if(Q!=="win32"||!f2.has(Y)||K>=J)throw V;await new Promise((U)=>setTimeout(U,K*10))}}var m0=t(m2(),"deepseek-code-leases-v1");function _0($){return $.reason??Error("Lease acquisition cancelled")}async function p2($,Z){if(Z?.aborted)throw _0(Z);await new Promise((Q,z)=>{let J=setTimeout(()=>{V(),Q()},$),K=()=>{clearTimeout(J),V(),z(_0(Z))},V=()=>Z?.removeEventListener("abort",K);Z?.addEventListener("abort",K,{once:!0})})}function u2($){if(!Number.isInteger($)||$<=0)return!1;try{return process.kill($,0),!0}catch(Z){return Z.code!=="ESRCH"}}async function X0($,Z){let Q=`${$}.${Z}-${p0()}`;try{await v0($,Q)}catch(z){if(["ENOENT","EEXIST"].includes(z.code??""))return!1;throw z}return await v2(Q,{recursive:!0,force:!0}),!0}async function l2($){try{let Z=JSON.parse(await u0(t($,"owner.json"),"utf8"));if(typeof Z.pid==="number"&&u2(Z.pid))return!1;return X0($,"stale")}catch(Z){let Q=await H0($).catch(()=>{return});if(!Q||Date.now()-Q.mtimeMs<30000)return!1;return X0($,Z.code==="ENOENT"?"incomplete":"invalid")}}async function W0($,Z={},Q){if(Q?.aborted)throw _0(Q);await y0(m0,{recursive:!0,mode:448});let z=h2("sha256").update($).digest("hex"),J=t(m0,z),K=p0(),V={token:K,pid:process.pid,createdAt:new Date().toISOString(),resource:$,metadata:Z};while(!0)try{await y0(J,{mode:448});try{await y2(t(J,"owner.json"),`${JSON.stringify(V)}
|
|
4
|
+
`,{encoding:"utf8",mode:384})}catch(X){throw await X0(J,"incomplete").catch(()=>!1),X}let Y=!1,U,H=async()=>{if(Y)return;let X;try{X=JSON.parse(await u0(t(J,"owner.json"),"utf8"))}catch(W){if(W.code!=="ENOENT")throw W;try{await H0(J)}catch(G){if(G.code!=="ENOENT")throw G;Y=!0;return}throw W}if(X.token!==K){Y=!0;return}try{if(await X0(J,"released")){Y=!0;return}}catch(W){try{await H0(J)}catch(G){if(G.code!=="ENOENT")throw G;Y=!0;return}throw W}try{await H0(J)}catch(W){if(W.code!=="ENOENT")throw W;Y=!0;return}throw Error("Lease directory could not be moved aside")};return{token:K,path:J,release(){if(Y)return Promise.resolve();if(U)return U;let X;return X=H().finally(()=>{if(U===X)U=void 0}),U=X,X}}}catch(Y){if(Y.code!=="EEXIST")throw Y;if(await l2(J))continue;await p2(25,Q)}}var l0=new Intl.Segmenter(void 0,{granularity:"grapheme"});function c0($,Z){return Math.max(0,Math.min($.length,Number.isNaN(Z)?0:Math.trunc(Z)))}function h($,Z){let Q=c0($,Z);if(Q===0||Q===$.length)return Q;let z=0;for(let J of l0.segment($)){let K=J.index+J.segment.length;if(K>Q)return J.index;z=K}return z}function s($,Z){let Q=c0($,Z);if(Q===0||Q===$.length)return Q;for(let z of l0.segment($)){let J=z.index+z.segment.length;if(z.index>=Q)return z.index;if(J>Q)return J}return $.length}var a0=2000000,i=20971520,$0=10,t2=16777216,e2=33554432,$3=256;var Z3=60000,F0=a0,L0=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,v=new Map;function z0($,Z){let Q=Z0("sha256").update($).digest("hex");return A(Z??process.env.HOME??R0(),".deepseek-code","shell-output",Q)}function r0($,Z,Q){let z=Z0("sha256").update($).digest("hex"),J=Q??(Z?A(o0(Z),`${o2(Z)||"shell-output"}-recovery`):A(process.env.HOME??R0(),".deepseek","shell-output-recovery"));return A(J,z)}function z3($){let Z=typeof process.getuid==="function"?String(process.getuid()):Z0("sha256").update(R0()).digest("hex").slice(0,16);return $??A(d2(),`deepseek-code-shell-output-${Z}`)}function t0($,Z){let Q=Z0("sha256").update($).digest("hex");return A(z3(Z),Q)}async function e0($){try{let Z=await e($);if(!Z.isDirectory()||Z.isSymbolicLink()||typeof process.getuid==="function"&&Z.uid!==process.getuid())return;let Q=A($,"supervisors"),z=await e(Q).catch((U)=>{if(U.code==="ENOENT")return;throw U});if(!z)return new Set;if(!z.isDirectory()||z.isSymbolicLink()||typeof process.getuid==="function"&&z.uid!==process.getuid())return;let J=new Set,K=0,V=0,Y=await i2(Q);for await(let U of Y){if(!/^[a-f0-9]{64}\.json$/i.test(U.name))continue;if(++V>$3)return;let H=A(Q,U.name),X=await e(H);if(!X.isFile()||X.isSymbolicLink()||typeof process.getuid==="function"&&X.uid!==process.getuid()||X.size>t2)return;if(K+=X.size,K>e2)return;let W=JSON.parse(await j0(H,"utf8"));if(W.schema!=="shell_supervisor_v1")return;for(let G of[W.outputId,W.reservedOutputId]){if(G===void 0)continue;if(typeof G!=="string"||!L0.test(G))return;J.add(G)}}return J}catch(Z){if(["ENOENT","ENOTDIR"].includes(Z.code??""))return new Set;return}}async function Q3($,Z,Q){let J=(await Promise.all((await n2($)).filter((U)=>L0.test(U)).map(async(U)=>({id:U,path:A($,U),info:await a2(A($,U)).catch(()=>null)})))).filter((U)=>U.info!==null).sort((U,H)=>U.info.mtimeMs-H.info.mtimeMs),K=J.reduce((U,H)=>U+H.info.size,0),V=J.length,Y=[];for(let U of J){if(V<=$0&&K<=i)break;if(U.id===Z||Q===void 0||Q.has(U.id))continue;try{await n0(U.path)}catch(H){if(H.code!=="ENOENT"){Y.push(H);continue}}V--,K-=U.info.size}if(Y.length>0){let U=Error(`Failed to remove ${Y.length} shell output artifact(s) during cleanup`);throw Object.assign(U,{code:Y[0]?.code}),U}return V<=$0&&K<=i}async function B0($,Z,Q,z){try{await J3($,Z,Q)}catch(J){return{stored:!1,error:J}}try{if(await Q3($,Z,z))return{stored:!0};try{await n0(A($,Z))}catch(J){if(J.code!=="ENOENT")return{stored:!0,cleanupWarning:`retention cleanup ${J.code??"failed"}`}}return{stored:!1,error:Object.assign(Error("Shell output retention quota is occupied by referenced artifacts"),{code:"ENOSPC"})}}catch(J){return{stored:!0,cleanupWarning:`cleanup ${J.code??"failed"}`}}}function b0($,Z){return`${$}\x00${Z}`}function M0($){return Z0("sha256").update(JSON.stringify({totalChars:$.totalChars,storedChars:$.storedChars,truncated:$.truncated,redacted:$.redacted===!0,content:$.content,provenance:$.provenance??null})).digest("hex")}function G0($){try{let Z=JSON.parse($);if(typeof Z.content!=="string")return!1;if(Z.contentHash===void 0)return Z.schemaVersion!==2;if(!Number.isSafeInteger(Z.totalChars)||!Number.isSafeInteger(Z.storedChars)||typeof Z.truncated!=="boolean")return!1;return Z.contentHash===M0(Z)}catch{return!1}}async function d0($,Z,Q,z,J,K){let V=JSON.stringify({...Q,schemaVersion:2,storage:"memory",contentHash:M0({...Q,content:z,provenance:J}),content:z,...J?{provenance:J}:{}}),Y=Buffer.byteLength(V,"utf8");if(Y>i)return!1;let U=b0($,Z),H=new Map([[$,K]]);for(let B of v.values())if(!H.has(B.directory))H.set(B.directory,await e0(B.directory));let X=[...v.values()].filter((B)=>{let N=H.get(B.directory);return N===void 0||N.has(B.id)});if(X.length+1>$0||X.reduce((B,N)=>B+N.bytes,Y)>i)return!1;v.set(U,{directory:$,id:Z,raw:V,bytes:Y,createdAt:Date.now()});let W=[...v.entries()].sort((B,N)=>B[1].createdAt-N[1].createdAt),G=W.reduce((B,[,N])=>B+N.bytes,0),k=W.length;for(let[B,N]of W){if(k<=$0&&G<=i)break;let M=H.get(N.directory);if(B===U||M===void 0||M.has(N.id))continue;v.delete(B),k--,G-=N.bytes}if(k>$0||G>i)v.delete(U);return v.has(U)}async function J3($,Z,Q){if(await i0($,{recursive:!0,mode:448}),!(await e($)).isDirectory())throw Error("shell output storage path is not a directory");await s0($,448),await r2(A($,Z),Q,{encoding:"utf8",mode:384,flag:"wx"})}async function K3($){await i0($,{mode:448}).catch((Q)=>{if(Q.code!=="EEXIST")throw Q});let Z=await e($);if(!Z.isDirectory()||Z.isSymbolicLink()||typeof process.getuid==="function"&&Z.uid!==process.getuid())throw Error("Shell emergency output root is not an owned directory");await s0($,448)}async function N0($,Z,Q,z,J,K,V){let Y=M0({...Q,content:z,provenance:J}),U=JSON.stringify({...Q,schemaVersion:2,storage:"emergency-disk",contentHash:Y,retentionWarning:K,content:z,...J?{provenance:J}:{}});try{await K3(o0($))}catch(X){return{retained:!1,warning:`${K}; emergency storage failed (${X.code??"failed"})`}}let H=await B0($,Z,U,V);if(!H.stored)return{retained:!1,warning:`${K}; emergency storage failed (${H.error?.code??"failed"})`};if(H.cleanupWarning)K+=`; emergency ${H.cleanupWarning}`;return{retained:!0,warning:K}}async function V3($,Z,Q,z){let J=v.get(b0($,z));if(J){if(G0(J.raw))return J.raw;v.delete(b0($,z))}let K;try{let V=await j0(A($,z),"utf8");if(G0(V))return V;K=Error("Shell output artifact integrity check failed")}catch(V){K=V}try{let V=await j0(A(Z,z),"utf8");if(G0(V))return V;throw Error("Shell output artifact integrity check failed")}catch{}try{let V=await j0(A(Q,z),"utf8");if(G0(V))return V;throw Error("Shell output artifact integrity check failed")}catch{throw K}}async function $2($,Z,Q){let z=z0($,Z),J=new AbortController,K=setTimeout(()=>J.abort(Error("Timed out waiting for the shell output artifact lease")),Z3),V;try{if(V=await W0(`shell-output-artifacts:${s2(z)}`,{},J.signal),J.signal.aborted)throw await V.release(),J.signal.reason}finally{clearTimeout(K)}try{return await Q((Y,U,H,X,W,G)=>Y3($,Y,U,Z,H,X,W,G))}finally{await V.release()}}async function Y3($,Z,Q=Z.length,z,J,K,V,Y=c2()){if(!L0.test(Y))throw Error("Invalid shell output ID");let U=z0($,z),H=r0($,z,K),X=t0($,V),W=await e0(U),G=Y,k=c(Z),B=h(k,a0),N={totalChars:Q,storedChars:B,truncated:B<Q,redacted:k!==Z},M=k.slice(0,B),D=M0({...N,content:M,provenance:J}),q=JSON.stringify({...N,schemaVersion:2,storage:"disk",contentHash:D,content:M,...J?{provenance:J}:{}}),E=await B0(U,G,q,W);if(!E.stored){let C=E.error,O=`primary storage failed (${C?.code??"failed"})`;if(H!==U){let l=JSON.stringify({...N,schemaVersion:2,storage:"recovery-disk",contentHash:D,retentionWarning:O,content:M,...J?{provenance:J}:{}}),b=await B0(H,G,l,W);if(b.stored){let S=O;if(b.cleanupWarning)S+=`; recovery ${b.cleanupWarning}`;if(X!==U&&X!==H){let f=await N0(X,G,N,M,J,`${O}; emergency mirror`,W);S+=f.retained?"; emergency copy retained":`; ${f.warning}`}return{id:G,metadata:{...N,storage:"recovery-disk",retentionWarning:S}}}let y=`recovery storage failed (${b.error?.code??"failed"})`;if(X!==U&&X!==H){let S=await N0(X,G,N,M,J,`${O}; ${y}`,W);if(S.retained)return{id:G,metadata:{...N,storage:"emergency-disk",retentionWarning:S.warning}};let f={...N,storage:"memory",retentionWarning:S.warning};if(await d0(U,G,N,M,J,W))return{id:G,metadata:f};throw C}}let x=X!==U&&X!==H?await N0(X,G,N,M,J,O,W):null;if(x?.retained)return{id:G,metadata:{...N,storage:"emergency-disk",retentionWarning:x.warning}};let g={...N,storage:"memory",retentionWarning:x?.warning??O};if(await d0(U,G,N,M,J,W))return{id:G,metadata:g};throw C}let w;if(H!==U){let C=JSON.stringify({...N,schemaVersion:2,storage:"recovery-disk",contentHash:D,content:M,...J?{provenance:J}:{}}),O=await B0(H,G,C,W);if(O.stored){if(O.cleanupWarning)w=`recovery ${O.cleanupWarning}`}else{let x=`recovery copy failed (${O.error?.code??"failed"})`;if(X!==U&&X!==H){let g=await N0(X,G,N,M,J,x,W);w=g.retained?`${x}; emergency copy retained`:g.warning}else w=x}}if(E.cleanupWarning)w=[w,`primary ${E.cleanupWarning}`].filter(Boolean).join("; ");return{id:G,metadata:{...N,storage:"disk",...w?{retentionWarning:w}:{}}}}async function Z2($,Z,Q,z,J){if(!L0.test(Z))throw Error("Invalid shell output ID");let K=await V3(z0($,Q),r0($,Q,z),t0($,J),Z),V=JSON.parse(K);if(typeof V.content!=="string"||!Number.isSafeInteger(V.totalChars)||!Number.isSafeInteger(V.storedChars)||typeof V.truncated!=="boolean"||!["disk","recovery-disk","emergency-disk","memory"].includes(V.storage??""))throw Error("Shell output artifact is malformed");let Y={totalChars:V.totalChars,storedChars:V.storedChars,truncated:V.truncated,redacted:V.redacted===!0,storage:V.storage,...typeof V.retentionWarning==="string"?{retentionWarning:V.retentionWarning}:{}};return{content:c(V.content),metadata:Y,...V.provenance?{provenance:V.provenance}:{}}}import{execFileSync as U3}from"child_process";function H3($,Z){if(process.platform==="win32"||!Number.isSafeInteger($)||$<2)return!1;try{return process.kill(-$,Z),!0}catch(Q){if(["ESRCH","EPERM"].includes(Q.code??""))return!1;throw Q}}function z2($,Z){if($.pid&&process.platform!=="win32"){if(H3($.pid,Z))return!0;return $.kill(Z)}else if($.pid&&process.platform==="win32")try{return U3("taskkill",["/PID",String($.pid),"/T","/F"],{stdio:"ignore",timeout:5000}),!0}catch(Q){return $.kill(Z)}return $.kill(Z)}class J2{state="text";push($,Z=!1){let Q="";for(let z of $){let J=z.codePointAt(0);switch(this.state){case"text":if(J===27)this.state="escape";else if(J===155)this.state="csi";else if(J===157)this.state="osc";else if(J===144||J===152||J===158||J===159)this.state="string";else Q+=z;break;case"escape":if(z==="[")this.state="csi";else if(z==="]")this.state="osc";else if(z==="P"||z==="X"||z==="^"||z==="_")this.state="string";else this.state="text";break;case"csi":if(J>=64&&J<=126)this.state="text";break;case"osc":if(J===7)this.state="text";else if(J===156)this.state="text";else if(J===27)this.state="oscEscape";break;case"oscEscape":this.state=z==="\\"?"text":z==="\x1B"?"oscEscape":"osc";break;case"string":if(J===156)this.state="text";else if(J===27)this.state="stringEscape";break;case"stringEscape":this.state=z==="\\"?"text":z==="\x1B"?"stringEscape":"string";break}}if(Z&&this.state!=="text")this.state="text";return Q}}var W3=4096,Q0=8000,D0=8000,G3=/\b(?:error(?:\b|_[A-Z0-9_]+)|fatal|exception|traceback|fail(?:ed|ure)?|panic(?:ked)?|module not found|no module named|modulenotfounderror|cannot find symbol|unresolved (?:reference|import)|undefined reference|caused by)\b|\b[A-Za-z][A-Za-z0-9_.]*(?:Error|Exception)\b|\bundefined:|\b(?:command not found|no such file or directory)\b|\bTS\d{4,5}\b|\bERR_[A-Z0-9_]+\b|\b(?:npm|pnpm|yarn)\s+ERR!|^\s*(?:make(?:\[\d+\])?:\s+\*\*\*|ninja:\s+build stopped)/i;function Q2(){return{schema:"shell_channel_provenance_v1",ordering:"observed-arrival",stdoutChars:0,stderrChars:0,retainedChars:0,segments:[],segmentsOmitted:0,contentOmitted:0,drainTimedOut:!1}}class K2{full="";head="";middle="";tail="";total=0;append($){if(!$)return;if(this.full!==null&&this.total+$.length<=Q0*3){this.full+=$,this.total+=$.length;return}if(this.full!==null){let Z=this.full;this.full=null,this.total=0,this.appendSample(Z)}this.appendSample($)}appendSample($){if(!$)return;if(this.head.length<Q0)this.head+=$.slice(0,h($,Q0-this.head.length));if(!this.middle&&this.total+$.length>1e6){let Q=Math.max(0,1e6-this.total);this.middle=$.slice(s($,Q),h($,Q+Q0))}let Z=this.tail+$;this.tail=Z.slice(s(Z,Z.length-Q0)),this.total+=$.length}render(){if(this.full!==null)return this.full;let $=Math.max(0,this.total-this.head.length-this.middle.length-this.tail.length);return`${this.head}
|
|
5
5
|
\u2026[${$} characters omitted from this stream preview]\u2026${this.middle?`
|
|
6
6
|
${this.middle}
|
|
7
7
|
\u2026[continued at final stream output]\u2026`:""}
|
|
8
|
-
${this.tail}`}}class q0{sampler=new
|
|
8
|
+
${this.tail}`}}class q0{sampler=new K2;previousLine="";diagnosticLines;diagnosticFollow=0;current="";head="";tail="";currentLength=0;currentOverflow=!1;hasCurrent=!1;pendingCR=!1;push($){let Z=0;while(Z<$.length){if(this.pendingCR){if(this.pendingCR=!1,$[Z]===`
|
|
9
9
|
`){this.commit(`
|
|
10
10
|
`),Z++;continue}this.resetLine()}let Q=$.indexOf("\r",Z),z=$.indexOf(`
|
|
11
11
|
`,Z),J=Q<0?z:z<0?Q:Math.min(Q,z);if(J<0){this.appendLine($.slice(Z));return}if(J>Z)this.appendLine($.slice(Z,J));if($[J]==="\r")this.pendingCR=!0;else this.commit(`
|
|
@@ -16,16 +16,16 @@ ${Z}`}renderLive(){let $=this.sampler.render(),Z=this.hasCurrent?this.lineText()
|
|
|
16
16
|
`:""}${Z}`:$;if(!this.diagnosticLines?.length)return Q;let z=this.diagnosticLines.join(`
|
|
17
17
|
`);return Q.includes(z)?Q:`${Q}
|
|
18
18
|
[diagnostic excerpt (heuristic)]
|
|
19
|
-
${z}`}appendLine($){if(!$)return;if(this.hasCurrent=!0,this.currentLength+=$.length,!this.currentOverflow&&this.current.length+$.length<=D0){this.current+=$;return}if(!this.currentOverflow){let z=D0/2;this.head=this.current.slice(0,h(this.current,z)),this.tail=this.current.slice(s(this.current,this.current.length-z)),this.current="",this.currentOverflow=!0}let Z=this.tail+$,Q=Math.max(0,Z.length-D0/2);this.tail=Z.slice(s(Z,Q))}commit($){let Z=this.hasCurrent?this.lineText():"";if(this.hasCurrent||$)this.sampler.append(`${Z}${$}`);if(this.diagnosticLines&&this.diagnosticFollow>0){if(Z)this.diagnosticLines.push(Z);this.diagnosticFollow--}else if(
|
|
20
|
-
[preview omitted after an oversized grapheme cluster]`:""}`,F=`${U.stderr.renderLive()}${
|
|
19
|
+
${z}`}appendLine($){if(!$)return;if(this.hasCurrent=!0,this.currentLength+=$.length,!this.currentOverflow&&this.current.length+$.length<=D0){this.current+=$;return}if(!this.currentOverflow){let z=D0/2;this.head=this.current.slice(0,h(this.current,z)),this.tail=this.current.slice(s(this.current,this.current.length-z)),this.current="",this.currentOverflow=!0}let Z=this.tail+$,Q=Math.max(0,Z.length-D0/2);this.tail=Z.slice(s(Z,Q))}commit($){let Z=this.hasCurrent?this.lineText():"";if(this.hasCurrent||$)this.sampler.append(`${Z}${$}`);if(this.diagnosticLines&&this.diagnosticFollow>0){if(Z)this.diagnosticLines.push(Z);this.diagnosticFollow--}else if(G3.test(Z))this.diagnosticLines=[...this.previousLine?[this.previousLine]:[],Z],this.diagnosticFollow=1;if(Z)this.previousLine=Z;this.resetLine()}lineText(){if(!this.currentOverflow)return this.current;let $=Math.max(0,this.currentLength-this.head.length-this.tail.length);return`${this.head}\u2026[${$} characters omitted from progress line]\u2026${this.tail}`}resetLine(){this.current="",this.head="",this.tail="",this.currentLength=0,this.currentOverflow=!1,this.hasCurrent=!1}}function V2($,Z,Q){return new Promise((z,J)=>{let K=!1,V=!1,Y=!1,U,H=(N)=>z2($,N),X=()=>{if(clearTimeout(B),U)clearTimeout(U);Q?.removeEventListener("abort",k)},W=(N)=>{if(K)return;K=!0,X(),J(N)},G=(N)=>{if(Y||K)return;V=N,Y=!0,H("SIGTERM"),U=setTimeout(()=>H("SIGKILL"),1000)},k=()=>G(!1),B=setTimeout(()=>G(!0),Z);if(Q?.addEventListener("abort",k,{once:!0}),Q?.aborted)k();$.once("spawn",()=>{if(Y)H("SIGTERM")}),$.once("error",(N)=>W(N)),$.once("close",(N,M)=>{if(K)return;if(K=!0,X(),V)return J(Object.assign(Error(`Command timed out after ${Math.round(Z/1000)}s and was killed.`),{timedOut:!0,signal:M}));if(Q?.aborted)return J(Object.assign(Error("Command was cancelled."),{cancelled:!0,signal:M}));if(N!==0)return J(Object.assign(Error(`Command exited with code ${N??"unknown"}.`),{exitCode:N??void 0,signal:M}));z({exitCode:0,signal:M})})})}async function Y2($,Z,Q,z,J,K){let V=[{channel:"stdout",stream:$},{channel:"stderr",stream:Z}].filter((j)=>Boolean(j.stream));if(!V.length)return{content:"",preview:"",totalChars:0,totalBytes:0,truncated:!1,drainTimedOut:!1,provenance:Q2()};let Y=[],U={stdout:new q0,stderr:new q0},H={stdout:"",stderr:""},X={stdout:!1,stderr:!1},W=[],G=0,k=0,B=0,N=0,M=!1,D=[],q=0,E=0,w=Q2(),C=()=>{let j=`${U.stdout.renderLive()}${X.stdout?`
|
|
20
|
+
[preview omitted after an oversized grapheme cluster]`:""}`,F=`${U.stderr.renderLive()}${X.stderr?`
|
|
21
21
|
[preview omitted after an oversized grapheme cluster]`:""}`;return{preview:j&&F?`[stdout channel preview]
|
|
22
22
|
${j}${j.endsWith(`
|
|
23
23
|
`)?`
|
|
24
24
|
`:`
|
|
25
25
|
|
|
26
26
|
`}[stderr channel preview]
|
|
27
|
-
${F}`:j||F,totalChars:B,totalBytes:N,truncated:B>k+(M?0:q)}},O=(j,F,T,P)=>{if(!P)return;let _=w.segments[w.segments.length-1];if(_&&_.channel===j&&_.offset+_.length===F&&_.channelOffset+_.length===T){_.length+=P,w.retainedChars+=P;return}if(w.segments.length>=
|
|
27
|
+
${F}`:j||F,totalChars:B,totalBytes:N,truncated:B>k+(M?0:q)}},O=(j,F,T,P)=>{if(!P)return;let _=w.segments[w.segments.length-1];if(_&&_.channel===j&&_.offset+_.length===F&&_.channelOffset+_.length===T){_.length+=P,w.retainedChars+=P;return}if(w.segments.length>=W3){w.segmentsOmitted++;return}w.segments.push({sequence:w.segments.length+1,channel:j,offset:F,channelOffset:T,length:P}),w.retainedChars+=P},x=()=>{if(!G)return;Y.push(W.join("")),W=[],G=0},g=(j,F)=>{if(X[F])return;let T=H[F]+j,P=T.length?h(T,T.length-1):0;if(P)U[F].push(T.slice(0,P));if(H[F]=T.slice(P),H[F].length>D0)H[F]="",X[F]=!0},l=(j)=>{for(let F of j)if(O(F.channel,F.globalOffset,F.channelOffset,F.text.length),W.push(F.text),G+=F.text.length,k+=F.text.length,G>=65536)x()},b=(j,F)=>{let T=[],P=[],_=F;for(let R of j)if(_>=R.text.length)T.push(R),_-=R.text.length;else if(_>0)T.push({...R,text:R.text.slice(0,_)}),P.push({...R,text:R.text.slice(_),globalOffset:R.globalOffset+_,channelOffset:R.channelOffset+_}),_=0;else P.push(R);return[T,P]},y=(j)=>{if(M)return;let F=[...D,j],T=F.map((T0)=>T0.text).join(""),P=T.length?h(T,T.length-1):0,_=F0-k,R=h(T,Math.min(P,_)),[u,r]=b(F,R);if(l(u),D=r,q=r.reduce((T0,T2)=>T0+T2.text.length,0),R<P||k+q>F0)M=!0,D=[],q=0},S=(j,F)=>{if(!j)return;g(j,F);let T=w[`${F}Chars`],P=B;B+=j.length,w[`${F}Chars`]+=j.length,y({text:j,channel:F,globalOffset:P,channelOffset:T});try{J?.({text:j,channel:F,globalOffset:P,channelOffset:T})}catch{}if(z&&Date.now()-E>=200)E=Date.now(),z(C())},f=V.map(async({stream:j,channel:F})=>{let T=new X3("utf8"),P=new J2;j.on("data",(R)=>{let u=Buffer.isBuffer(R)?R:Buffer.from(R);N+=u.length;try{K?.(u.length)}catch{}S(P.push(T.write(u)),F)}),j.on("end",()=>S(P.push(T.end(),!0),F));let _=new Promise((R,u)=>{let r=()=>{j.removeListener("error",u),R()};j.once("end",r),j.once("close",r),j.once("error",u)});j.resume(),await _}),m=!1,d=Promise.all(f).then(()=>!0,()=>!1),o,K0=async()=>{if(Q)await Q;return Promise.race([d,new Promise((j)=>{o=setTimeout(()=>j(!1),3000)})])},L=await Promise.race([d,K0()]);if(o)clearTimeout(o);if(!L){m=!0;for(let{stream:j}of V)j.destroy()}if(!M&&D.length)if(k+q<=F0)l(D);else M=!0;D=[],q=0;for(let j of["stdout","stderr"]){if(!X[j]&&H[j])U[j].push(H[j]);H[j]=""}w.contentOmitted=Math.max(0,B-k),w.drainTimedOut=m,x(),U.stdout.finish(),U.stderr.finish();let p=B>k||m,V0=C().preview;return{content:Y.join(""),preview:V0,totalChars:B,totalBytes:N,truncated:p,drainTimedOut:m,provenance:w}}var U2=process.platform==="win32",R5=process.platform==="darwin",q5=process.platform==="linux";var N3=["PATH","HOME","LANG","LC_ALL","TZ","TERM","TMPDIR","USER","SHELL"],j3=["PATH","SystemRoot","windir","COMSPEC","PATHEXT","TEMP","TMP","USERPROFILE","HOMEDRIVE","HOMEPATH","APPDATA","LOCALAPPDATA","NUMBER_OF_PROCESSORS","OS","PROCESSOR_ARCHITECTURE"];function H2(){let $=U2?j3:N3,Z={};for(let Q of $){let z=process.env[Q]??(U2?Object.entries(process.env).find(([J])=>J.toLowerCase()===Q.toLowerCase())?.[1]:void 0);if(z!==void 0)Z[Q]=z}return Z}import{open as B3,lstat as F3}from"fs/promises";var J0=2000000,L3=256000;var M3=64000,X2=512;function I($){return $.replace(/[^\r\n]/g,"*")}function W2($){let Z=$.toLowerCase().replace(/[^a-z0-9]/g,"");return/(?:apikey|authorization|cookie|credentials?|password|passwd|privatekey|secret)/.test(Z)||/(?:access|auth|refresh|session)?token$/.test(Z)}function E0($,Z){let Q=0;for(let z=Z-1;z>=0&&$[z]==="\\";z--)Q++;return Q%2===1}function D3($){let Z=/(?:^|[^A-Za-z0-9_.-])(["']?)([A-Za-z_][A-Za-z0-9_.-]{0,127})\1\s*[=:]\s*(["'])/g;for(let Q=Z.exec($);Q;Q=Z.exec($)){if(!W2(Q[2]))continue;let z=Q[3],K=Q.index+Q[0].length;while(K<$.length&&($[K]!==z||E0($,K)))K++;if(K===$.length)return z}return null}function w3($,Z){let Q=/-----BEGIN ([^-\r\n]*PRIVATE KEY)-----|-----END ([^-\r\n]*PRIVATE KEY)-----/g,z="",J=0;for(let K=Q.exec($);K;K=Q.exec($)){if(z+=Z.pem.length?I($.slice(J,K.index)):$.slice(J,K.index),K[1])Z.pem.push(K[1]),z+=I(K[0]);else if(Z.pem.at(-1)===K[2])Z.pem.pop(),z+=I(K[0]);else if(Z.pem.length)z+=I(K[0]);else z+=K[0];J=K.index+K[0].length}return z+(Z.pem.length?I($.slice(J)):$.slice(J))}function k3($){let Z=$.replace(/[\r\n]+$/,""),Q=/(?:^|[^A-Za-z0-9_.-])(["']?)([A-Za-z_][A-Za-z0-9_.-]{0,127})\1\s*([=:])?\s*$/.exec(Z);if(!Q||!W2(Q[2]))return null;return Q[3]?"value":"delimiter"}function T3($,Z){let Q="",z=0,J=$.search(/[\r\n]/),K=J<0?$.length:J;if(Z.assignment==="delimiter"){let V=$.slice(z,K).search(/[=:]/);if(V<0)return $;Q+=$.slice(0,V+1),z=V+1,Z.assignment="value"}if(Z.assignment==="value"){while(z<K&&/\s/.test($[z]))Q+=$[z++];if(z<K&&($[z]==='"'||$[z]==="'")){let V=$[z];Q+=V,z++;let Y=z;while(Y<K&&($[Y]!==V||E0($,Y)))Y++;if(Y===K)return Q+=I($.slice(z)),Z.quote=V,Z.assignment=null,Q+$.slice(K);Q+=I($.slice(z,Y))+V,z=Y+1,Z.assignment=null}else if(z<K){let V=$.slice(z,K).search(/[\s,;}"']/),Y=V<0?K:z+V;Q+=I($.slice(z,Y)),z=Y,Z.assignment=null}else return Q+$.slice(z)}return Q+c($.slice(z))}function P3($,Z){if(Z.maskRest)return I($);let Q=w3($,Z);if(Z.quote){let J=0;while(J<Q.length&&(Q[J]!==Z.quote||E0(Q,J)))J++;if(J===Q.length)return I(Q);return Z.quote=null,I(Q.slice(0,J))+Q[J]+c(Q.slice(J+1))}if(Z.assignment)return T3(Q,Z);let z=c(Q);return Z.quote=D3(Q),Z.assignment=k3(Q),z}class G2{emit;maxLineChars;channels={stdout:{pending:[],pendingChars:0,state:{pem:[],quote:null,assignment:null,maskRest:!1}},stderr:{pending:[],pendingChars:0,state:{pem:[],quote:null,assignment:null,maskRest:!1}}};ordered=[];orderedChars=0;maskRest=!1;conservative=!1;constructor($,Z=M3){this.emit=$;this.maxLineChars=Z}get redactionConservative(){return this.conservative}push($){if(!$.text)return;let Z=0;while(Z<$.text.length){let Q=$.text.slice(Z).search(/[\r\n]/),z=Q<0?$.text.length:Z+Q+1,J=$.text.slice(Z,z),K={...$,text:J,globalOffset:$.globalOffset+Z,channelOffset:$.channelOffset+Z},V=Q>=0,Y=this.channels[$.channel];if(this.maskRest)this.emitMasked($,Z,z);else if(J.length>this.maxLineChars||Y.pendingChars+J.length>this.maxLineChars||Y.pending.length>=4096||this.orderedChars+J.length>this.maxLineChars||this.ordered.length>=4096)this.maskPendingRemainder(),this.emitMasked($,Z,z);else{if(this.ordered.push(K),this.orderedChars+=J.length,Y.pending.push(K),Y.pendingChars+=J.length,V)this.flushChannel($.channel,!1);this.drainReady()}Z=z}}finish(){this.flushChannel("stdout",!1),this.flushChannel("stderr",!1),this.drainReady()}flushChannel($,Z){let Q=this.channels[$];if(!Q.pendingChars)return;let z=Q.pending.map((V)=>V.text).join(""),J=Z?I(z):P3(z,Q.state),K=0;for(let V of Q.pending)V.redactedText=J.slice(K,K+V.text.length),K+=V.text.length;Q.pending=[],Q.pendingChars=0}appendMasked($){this.ordered.push({...$,redactedText:I($.text)}),this.orderedChars+=$.text.length,this.drainReady()}emitMasked($,Z,Q){for(let z=Z;z<Q;){let J=Math.min(Q,z+X2);if(J<Q&&/[\uD800-\uDBFF]/.test($.text[J-1])&&/[\uDC00-\uDFFF]/.test($.text[J]))J--;if(J===z)J=Math.min(Q,z+2);let K=$.text.slice(z,J);this.appendMasked({...$,text:I(K),globalOffset:$.globalOffset+z,channelOffset:$.channelOffset+z}),z=J}}maskPendingRemainder(){this.conservative=!0,this.maskRest=!0;for(let $ of["stdout","stderr"])this.channels[$].state.maskRest=!0,this.flushChannel($,!0);for(let $ of this.ordered)if($.redactedText===void 0)$.redactedText=I($.text);this.drainReady()}drainReady(){while(this.ordered.length&&this.ordered[0].redactedText!==void 0){let $=this.ordered.shift();this.orderedChars-=$.text.length,this.emit({...$,text:$.redactedText})}}}class w0{path;options;file;queue=[];queuedBytes=0;inFlightBytes=0;committedBytes=0;sequence=0;settledSequence=0;droppedRecords=0;truncated=!1;accepting=!0;available=!1;writing=!1;writerError=!1;gapUnknown=!1;previewFull="";previewHead="";previewTail="";previewChars=0;writeRecord;redactor;constructor($,Z={}){this.path=$;this.options=Z;this.writeRecord=Z.writeRecord??(async(Q,z)=>{await Q.write(z,void 0,"utf8")}),this.redactor=new G2((Q)=>this.enqueue(Q),Z.maxLineChars)}async open(){try{try{let Z=await F3(this.path);if(!Z.isFile()||Z.isSymbolicLink()||typeof process.getuid==="function"&&Z.uid!==process.getuid())throw Error("Shell stream journal is not a privately owned file")}catch(Z){if(Z.code!=="ENOENT")throw Z}this.file=await B3(this.path,"a",384);let $=await this.file.stat();if(!$.isFile()||typeof process.getuid==="function"&&$.uid!==process.getuid())throw Error("Shell stream journal is not a privately owned file");if(this.committedBytes=$.size,this.committedBytes>(this.options.maxBytes??J0))throw Error("Shell stream journal exceeds its retention limit");this.available=!0}catch{this.available=!1,await this.file?.close().catch(()=>{}),this.file=void 0}}disable(){this.available=!1,this.accepting=!1,this.truncated=!0,this.gapUnknown=!0}preview(){if(this.previewFull!==null)return this.previewFull;let $=Math.max(0,this.previewChars-this.previewHead.length-this.previewTail.length);return $?`${this.previewHead}
|
|
28
28
|
\u2026[${$} characters omitted]\u2026
|
|
29
|
-
${this.previewTail}`:this.previewHead||this.previewTail}push($){this.redactor.push($)}async finish($=1000){if(this.redactor.finish(),!await this.flush($)){this.accepting=!1,this.truncated=!0,this.gapUnknown=!0,this.droppedRecords+=this.queue.length,this.queue.length=0,this.queuedBytes=0,this.settleDroppedTail();let Z=this.file;this.file=void 0,Z?.close().catch(()=>{});return}await this.file?.close().catch(()=>{}),this.file=void 0}async flush($=250){let Z=this.startWriter(),Q;try{return await Promise.race([Z.then(()=>!0),new Promise((z)=>{Q=setTimeout(()=>z(!1),$)})])}finally{if(Q)clearTimeout(Q)}}stats(){return{available:this.available,latestSequence:this.settledSequence,assignedSequence:this.sequence,droppedRecords:this.droppedRecords,bytes:this.committedBytes+this.queuedBytes+this.inFlightBytes,truncated:this.truncated||this.writerError,redactionConservative:this.redactor.redactionConservative,gapUnknown:this.gapUnknown}}enqueue($){let Z=$.text;if(Z){if(this.previewFull!==null&&this.previewFull.length+Z.length<=60000)this.previewFull+=Z;else{if(this.previewFull!==null)this.previewHead=this.previewFull.slice(0,20000),this.previewTail=this.previewFull.slice(-40000),this.previewFull=null;if(this.previewHead.length<20000)this.previewHead+=Z.slice(0,20000-this.previewHead.length);this.previewTail=`${this.previewTail}${Z}`.slice(-40000)}this.previewChars+=Z.length}if(!this.available||this.writerError||!this.accepting){this.truncated=!0,this.gapUnknown=!0,this.settleDroppedTail();return}for(let Q=0;Q<Z.length;){let z=Math.min(Z.length,Q+
|
|
30
|
-
`,V=Buffer.byteLength(K,"utf8");if(!this.available||this.writerError||!this.accepting||this.committedBytes+this.queuedBytes+this.inFlightBytes+V>(this.options.maxBytes??J0)||this.queuedBytes+V>(this.options.maxQueueBytes??B3)){this.droppedRecords++,this.truncated=!0,this.accepting=!1,this.gapUnknown=!0,this.settleDroppedTail();return}else this.queue.push({value:K,bytes:V}),this.queuedBytes+=V,this.startWriter();Q=z}}startWriter(){if(this.writing||!this.queue.length||!this.file||!this.available)return this.writerPromise??Promise.resolve();return this.writing=!0,this.writerPromise=(async()=>{try{while(this.queue.length){let $=this.queue.shift();this.queuedBytes-=$.bytes,this.inFlightBytes=$.bytes;try{await this.writeRecord(this.file,$.value),this.committedBytes+=$.bytes,this.inFlightBytes=0,this.settledSequence=T3($.value)}catch{this.inFlightBytes=0,this.writerError=!0,this.accepting=!1,this.truncated=!0,this.gapUnknown=!0,this.droppedRecords+=1+this.queue.length,this.queue.length=0,this.queuedBytes=0,this.settleDroppedTail();break}}}finally{this.writing=!1,this.settleDroppedTail()}})(),this.writerPromise}settleDroppedTail(){if(!this.writing&&this.queue.length===0&&(!this.accepting||!this.available||this.writerError))this.settledSequence=this.sequence}writerPromise}function T3($){try{return JSON.parse($).sequence}catch{return 0}}var A0="shell_supervisor_v1",g3=131072,f3=16777216,h3=65536;var v3=500,y3=20971520,m3=10;function F2($){return P3("sha256").update($).digest("hex")}function k0($){let Z=z0($.sessionId,$.storageRoot),Q=n(Z,"supervisors"),z=F2($.taskId);return{outputDirectory:Z,directory:Q,state:n(Q,`${z}.json`),lock:n(Q,`${z}.lock`),journal:n(Q,`${z}.stream.jsonl`)}}function L2($){let Z=Array.isArray($.args)?$.args.reduce((Q,z)=>Q+Buffer.byteLength(z,"utf8"),0):1/0;if(!$.sessionId||$.sessionId.length>256||!$.taskId||$.taskId.length>256||!/^[a-f0-9]{64}$/.test($.fingerprint)||!$.executable||$.executable.includes("/")&&!$.executable.startsWith("/")||!Array.isArray($.args)||$.args.some((Q)=>typeof Q!=="string")||Z>h3||!$.cwd.startsWith("/")||!Number.isSafeInteger($.timeoutMs)||$.timeoutMs<1||$.timeoutMs>86400000)throw Error("Invalid shell supervisor request")}async function C0($){await R3($,{recursive:!0,mode:448});let Z=await j2($);if(!Z.isDirectory()||Z.isSymbolicLink()||typeof process.getuid==="function"&&Z.uid!==process.getuid())throw Error("Shell supervisor state directory is not privately owned");await b3($,448)}async function p3($,Z){let{directory:Q,state:z,journal:J}=k0($),K;try{K=await X0(`shell-stream-journal-retention:${S3(Q)}`);let V=await E3(Q,{withFileTypes:!0}),Y=[];for(let D of V){if(!/^[a-f0-9]{64}\.stream\.jsonl$/i.test(D.name))continue;let q=n(Q,D.name),E=await j2(q);if(!E.isFile()||E.isSymbolicLink()||typeof process.getuid==="function"&&E.uid!==process.getuid())return;let w=n(Q,D.name.replace(/\.stream\.jsonl$/,".json")),C=!1;try{let O=JSON.parse(B2(w,"utf8"));if(O.state==="running")if(!M2(O.identity))C=!0;else C=c3(O0(l3(O.identity)),O.identity)}catch{C=!0}Y.push({name:D.name,path:q,bytes:E.size,modifiedAt:E.mtimeMs,active:C})}let U=`${F2($.taskId)}.stream.jsonl`,H=Y.find((D)=>D.name===U);if(H?.active)return;if(H)await G2(H.path).catch(()=>{}),Y.splice(Y.indexOf(H),1);let W=Y.filter((D)=>D.active).length,X=Y.filter((D)=>!D.active).sort((D,q)=>D.modifiedAt-q.modifiedAt),G=X.reduce((D,q)=>D+q.bytes,0),k=X.length;while(W+k+1>m3||W*J0+G+J0>y3){let D=X.shift();if(!D)return;await G2(D.path).catch(()=>{}),G-=D.bytes,k--}await(await q3(J,"wx",384)).close();let N=new w0(J);await N.open();let M=N.stats();return await a(z,{...Z,streamAvailable:M.available,...!M.available?{streamUnavailableReason:"storage-unavailable"}:{},streamLatestSequence:0,streamDroppedRecords:0,streamTruncated:!1,streamRedactionConservative:!1,streamGapUnknown:!M.available}),M.available?N:void 0}catch{await a(z,{...Z,streamAvailable:!1,streamUnavailableReason:"storage-unavailable",streamLatestSequence:0,streamDroppedRecords:0,streamTruncated:!0,streamRedactionConservative:!1,streamGapUnknown:!0}).catch(()=>{});return}finally{await K?.release().catch(()=>{})}}async function a($,Z){let Q=`${$}.${process.pid}.${Date.now()}.tmp`;await A3(Q,JSON.stringify(Z),{encoding:"utf8",mode:384,flag:"wx"}),await C3(Q,$)}function N2($){let{state:Z}=k0($);try{let Q=I3(Z);if(!Q.isFile()||Q.isSymbolicLink()||Q.size>f3||typeof process.getuid==="function"&&Q.uid!==process.getuid())return;let z=JSON.parse(B2(Z,"utf8"));if(z.schema!==A0||z.sessionId!==$.sessionId||z.taskId!==$.taskId||z.fingerprint!==$.fingerprint||!["running","done","failed","cancelled","timed_out"].includes(z.state??"")||!M2(z.identity)||!["settled","unknown"].includes(z.processGroupSettled??"")||z.outputPreview!==void 0&&(typeof z.outputPreview!=="string"||z.outputPreview.length>1e5)||z.totalChars!==void 0&&(!Number.isSafeInteger(z.totalChars)||z.totalChars<0)||z.outputBytes!==void 0&&(!Number.isSafeInteger(z.outputBytes)||z.outputBytes<0)||z.outputTruncated!==void 0&&typeof z.outputTruncated!=="boolean"||z.streamAvailable!==void 0&&typeof z.streamAvailable!=="boolean"||z.streamLatestSequence!==void 0&&(!Number.isSafeInteger(z.streamLatestSequence)||z.streamLatestSequence<0)||z.streamDroppedRecords!==void 0&&(!Number.isSafeInteger(z.streamDroppedRecords)||z.streamDroppedRecords<0)||z.streamTruncated!==void 0&&typeof z.streamTruncated!=="boolean"||z.streamRedactionConservative!==void 0&&typeof z.streamRedactionConservative!=="boolean"||z.streamGapUnknown!==void 0&&typeof z.streamGapUnknown!=="boolean")return;if(z.memoryContent!==void 0&&(typeof z.memoryContent!=="string"||z.memoryContent.length>2000000))return;return z}catch{return}}function M2($){let Z=$;return!!Z&&Z.platform==="linux"&&Number.isSafeInteger(Z.pid)&&Z.pid>1&&typeof Z.bootId==="string"&&typeof Z.pidNamespace==="string"&&typeof Z.startTimeTicks==="string"&&Number.isSafeInteger(Z.sessionId)&&Number.isSafeInteger(Z.processGroupId)&&Z.sessionId>0&&Z.processGroupId===Z.pid}function u3($,Z){return $.pid===Z.pid&&$.bootId===Z.bootId&&$.pidNamespace===Z.pidNamespace&&$.startTimeTicks===Z.startTimeTicks&&$.sessionId===Z.sessionId&&$.processGroupId===Z.processGroupId}function l3($){return{identity:$,status:"alive",observedAt:new Date().toISOString(),provenance:"kernel",scope:"process-group",progress:"not-measured"}}function c3($,Z){return!!$.identity&&u3($.identity,Z)&&$.scope==="process-group"&&$.status==="alive"&&$.processGroup?.status==="alive"}async function D2($){L2($);let Z=S0();if(!Z.identity||Z.scope!=="process-group")throw Error("Shell supervisor could not capture its Linux process-group identity");let Q=Z.identity,{outputDirectory:z,directory:J,state:K}=k0($);await C0(x3(z)),await C0(z),await C0(J);let V=new Date().toISOString(),Y={schema:A0,sessionId:$.sessionId,taskId:$.taskId,fingerprint:$.fingerprint,state:"running",identity:Q,startedAt:V,processGroupSettled:"unknown"},U=await p3($,Y),H=N2($);if(!H||H.streamAvailable===void 0)await a(K,{...Y,streamAvailable:!1,streamUnavailableReason:"retention-capacity",streamLatestSequence:0,streamDroppedRecords:0,streamTruncated:!0,streamRedactionConservative:!1,streamGapUnknown:!0});if(!U)U=new w0(k0($).journal),U.disable();let W=N2($)??{...Y,streamAvailable:!1,streamTruncated:!0},X=()=>{let L=U?.stats();return{streamAvailable:L?.available??W.streamAvailable??!1,...!L?.available&&W.streamUnavailableReason?{streamUnavailableReason:W.streamUnavailableReason}:{},streamLatestSequence:L?.latestSequence??W.streamLatestSequence??0,streamDroppedRecords:L?.droppedRecords??W.streamDroppedRecords??0,streamTruncated:L?.truncated??W.streamTruncated??!0,streamRedactionConservative:L?.redactionConservative??W.streamRedactionConservative??!1,streamGapUnknown:L?.gapUnknown??W.streamGapUnknown??!1}},G=new AbortController,k=()=>{if(!G.signal.aborted)G.abort(Error("Shell supervisor was asked to stop"))};process.on("SIGTERM",k);let B=_3($.executable,$.args,{cwd:$.cwd,env:U2(),detached:!0,stdio:["ignore","pipe","pipe"],windowsHide:!0}),N=new Promise((L)=>{B.once("exit",()=>L()),B.once("error",()=>L())}),M,D=0,q=0,E=Promise.resolve(),w=()=>{let L=M;if(!L||L.totalChars===D&&L.totalBytes===q)return;D=L.totalChars,q=L.totalBytes,E=E.then(async()=>{await U?.flush(200);let p={...W,totalChars:L.totalChars,outputBytes:L.totalBytes,outputPreview:U.preview(),outputTruncated:L.truncated,...X()};await a(K,p)}).catch(()=>{})},C=setInterval(w,v3);C.unref?.();let O=V2(B.stdout,B.stderr,N,(L)=>{M=L},(L)=>U?.push(L)),[x,g]=await Promise.allSettled([O,K2(B,$.timeoutMs,G.signal)]);clearInterval(C),w(),await E,await U?.finish(1000);let l=X(),b=x.status==="fulfilled"?x.value:{content:"",preview:"",totalChars:0,totalBytes:0,truncated:!1,drainTimedOut:!0,provenance:{schema:"shell_channel_provenance_v1",ordering:"observed-arrival",stdoutChars:0,stderrChars:0,retainedChars:0,segments:[],segmentsOmitted:0,contentOmitted:0,drainTimedOut:!0}},y="done",S=0,f=null,m=!1,d=!1;if(g.status==="rejected"){let L=g.reason;S=typeof L.exitCode==="number"?L.exitCode:B.exitCode,f=L.signal??B.signalCode,m=L.timedOut===!0,d=L.cancelled===!0||G.signal.aborted,y=m?"timed_out":d?"cancelled":"failed"}if(x.status==="rejected"&&y==="done")y="failed";let o=(B.exitCode!==null||B.signalCode!==null)&&!b.drainTimedOut?"settled":"unknown",K0=O3();await e0($.sessionId,$.storageRoot,async(L)=>{await a(K,{...W,processGroupSettled:o,reservedOutputId:K0,outputPreview:U.preview(),totalChars:b.totalChars,outputBytes:b.totalBytes,outputTruncated:b.truncated,...l});let p=await L(b.content,b.totalChars,b.provenance,$.recoveryRoot,void 0,K0),V0=p.metadata.storage==="memory"?(await $2($.sessionId,p.id,$.storageRoot,$.recoveryRoot)).content:void 0,j={schema:A0,sessionId:$.sessionId,taskId:$.taskId,fingerprint:$.fingerprint,state:y,identity:Q,startedAt:V,finishedAt:new Date().toISOString(),exitCode:S,signal:f,timedOut:m,cancelled:d,processGroupSettled:o,outputId:p.id,outputMetadata:p.metadata,outputPreview:U.preview(),totalChars:b.totalChars,outputBytes:b.totalBytes,outputTruncated:b.truncated,drainTimedOut:b.drainTimedOut,provenance:b.provenance,...l,...V0!==void 0?{memoryContent:V0}:{}};await a(K,j)}),process.off("SIGTERM",k)}async function w2($){let Z=[],Q=0;for await(let J of $){let K=Buffer.from(J);if(Q+=K.length,Q>g3)throw Error("Shell supervisor configuration exceeds its limit");Z.push(K)}let z=JSON.parse(Buffer.concat(Z).toString("utf8"));return L2(z),z}if(import.meta.main)try{let $=await w2(process.stdin);await D2($),process.exit(0)}catch($){process.stderr.write(`Shell supervisor failed: ${$ instanceof Error?$.message:String($)}
|
|
29
|
+
${this.previewTail}`:this.previewHead||this.previewTail}push($){this.redactor.push($)}async finish($=1000){if(this.redactor.finish(),!await this.flush($)){this.accepting=!1,this.truncated=!0,this.gapUnknown=!0,this.droppedRecords+=this.queue.length,this.queue.length=0,this.queuedBytes=0,this.settleDroppedTail();let Z=this.file;this.file=void 0,Z?.close().catch(()=>{});return}await this.file?.close().catch(()=>{}),this.file=void 0}async flush($=250){let Z=this.startWriter(),Q;try{return await Promise.race([Z.then(()=>!0),new Promise((z)=>{Q=setTimeout(()=>z(!1),$)})])}finally{if(Q)clearTimeout(Q)}}stats(){return{available:this.available,latestSequence:this.settledSequence,assignedSequence:this.sequence,droppedRecords:this.droppedRecords,bytes:this.committedBytes+this.queuedBytes+this.inFlightBytes,truncated:this.truncated||this.writerError,redactionConservative:this.redactor.redactionConservative,gapUnknown:this.gapUnknown}}enqueue($){let Z=$.text;if(Z){if(this.previewFull!==null&&this.previewFull.length+Z.length<=60000)this.previewFull+=Z;else{if(this.previewFull!==null)this.previewHead=this.previewFull.slice(0,20000),this.previewTail=this.previewFull.slice(-40000),this.previewFull=null;if(this.previewHead.length<20000)this.previewHead+=Z.slice(0,20000-this.previewHead.length);this.previewTail=`${this.previewTail}${Z}`.slice(-40000)}this.previewChars+=Z.length}if(!this.available||this.writerError||!this.accepting){this.truncated=!0,this.gapUnknown=!0,this.settleDroppedTail();return}for(let Q=0;Q<Z.length;){let z=Math.min(Z.length,Q+X2);if(z<Z.length&&/[\uD800-\uDBFF]/.test(Z[z-1])&&/[\uDC00-\uDFFF]/.test(Z[z]))z--;if(z===Q)z=Math.min(Z.length,Q+2);let J={sequence:++this.sequence,channel:$.channel,globalOffset:$.globalOffset+Q,channelOffset:$.channelOffset+Q,text:Z.slice(Q,z)},K=`${JSON.stringify(J)}
|
|
30
|
+
`,V=Buffer.byteLength(K,"utf8");if(!this.available||this.writerError||!this.accepting||this.committedBytes+this.queuedBytes+this.inFlightBytes+V>(this.options.maxBytes??J0)||this.queuedBytes+V>(this.options.maxQueueBytes??L3)){this.droppedRecords++,this.truncated=!0,this.accepting=!1,this.gapUnknown=!0,this.settleDroppedTail();return}else this.queue.push({value:K,bytes:V}),this.queuedBytes+=V,this.startWriter();Q=z}}startWriter(){if(this.writing||!this.queue.length||!this.file||!this.available)return this.writerPromise??Promise.resolve();return this.writing=!0,this.writerPromise=(async()=>{try{while(this.queue.length){let $=this.queue.shift();this.queuedBytes-=$.bytes,this.inFlightBytes=$.bytes;try{await this.writeRecord(this.file,$.value),this.committedBytes+=$.bytes,this.inFlightBytes=0,this.settledSequence=O3($.value)}catch{this.inFlightBytes=0,this.writerError=!0,this.accepting=!1,this.truncated=!0,this.gapUnknown=!0,this.droppedRecords+=1+this.queue.length,this.queue.length=0,this.queuedBytes=0,this.settleDroppedTail();break}}}finally{this.writing=!1,this.settleDroppedTail()}})(),this.writerPromise}settleDroppedTail(){if(!this.writing&&this.queue.length===0&&(!this.accepting||!this.available||this.writerError))this.settledSequence=this.sequence}writerPromise}function O3($){try{return JSON.parse($).sequence}catch{return 0}}var A0="shell_supervisor_v1",h3=131072,v3=16777216,y3=65536;var m3=500,p3=20971520,u3=10;function L2($){return _3("sha256").update($).digest("hex")}function k0($){let Z=z0($.sessionId,$.storageRoot),Q=n(Z,"supervisors"),z=L2($.taskId);return{outputDirectory:Z,directory:Q,state:n(Q,`${z}.json`),lock:n(Q,`${z}.lock`),journal:n(Q,`${z}.stream.jsonl`)}}function M2($){let Z=Array.isArray($.args)?$.args.reduce((Q,z)=>Q+Buffer.byteLength(z,"utf8"),0):1/0;if(!$.sessionId||$.sessionId.length>256||!$.taskId||$.taskId.length>256||!/^[a-f0-9]{64}$/.test($.fingerprint)||!$.executable||$.executable.includes("/")&&!$.executable.startsWith("/")||!Array.isArray($.args)||$.args.some((Q)=>typeof Q!=="string")||Z>y3||!$.cwd.startsWith("/")||!Number.isSafeInteger($.timeoutMs)||$.timeoutMs<1||$.timeoutMs>86400000)throw Error("Invalid shell supervisor request")}async function C0($){await E3($,{recursive:!0,mode:448});let Z=await B2($);if(!Z.isDirectory()||Z.isSymbolicLink()||typeof process.getuid==="function"&&Z.uid!==process.getuid())throw Error("Shell supervisor state directory is not privately owned");await q3($,448)}async function l3($,Z){let{directory:Q,state:z,journal:J}=k0($),K;try{K=await W0(`shell-stream-journal-retention:${f3(Q)}`);let V=await A3(Q,{withFileTypes:!0}),Y=[];for(let D of V){if(!/^[a-f0-9]{64}\.stream\.jsonl$/i.test(D.name))continue;let q=n(Q,D.name),E=await B2(q);if(!E.isFile()||E.isSymbolicLink()||typeof process.getuid==="function"&&E.uid!==process.getuid())return;let w=n(Q,D.name.replace(/\.stream\.jsonl$/,".json")),C=!1;try{let O=JSON.parse(F2(w,"utf8"));if(O.state==="running")if(!D2(O.identity))C=!0;else C=o3(O0(d3(O.identity)),O.identity)}catch{C=!0}Y.push({name:D.name,path:q,bytes:E.size,modifiedAt:E.mtimeMs,active:C})}let U=`${L2($.taskId)}.stream.jsonl`,H=Y.find((D)=>D.name===U);if(H?.active)return;if(H)await N2(H.path).catch(()=>{}),Y.splice(Y.indexOf(H),1);let X=Y.filter((D)=>D.active).length,W=Y.filter((D)=>!D.active).sort((D,q)=>D.modifiedAt-q.modifiedAt),G=W.reduce((D,q)=>D+q.bytes,0),k=W.length;while(X+k+1>u3||X*J0+G+J0>p3){let D=W.shift();if(!D)return;await N2(D.path).catch(()=>{}),G-=D.bytes,k--}await(await C3(J,"wx",384)).close();let N=new w0(J);await N.open();let M=N.stats();return await a(z,{...Z,streamAvailable:M.available,...!M.available?{streamUnavailableReason:"storage-unavailable"}:{},streamLatestSequence:0,streamDroppedRecords:0,streamTruncated:!1,streamRedactionConservative:!1,streamGapUnknown:!M.available}),M.available?N:void 0}catch{await a(z,{...Z,streamAvailable:!1,streamUnavailableReason:"storage-unavailable",streamLatestSequence:0,streamDroppedRecords:0,streamTruncated:!0,streamRedactionConservative:!1,streamGapUnknown:!0}).catch(()=>{});return}finally{await K?.release().catch(()=>{})}}async function a($,Z){let Q=`${$}.${process.pid}.${Date.now()}.tmp`;await x3(Q,JSON.stringify(Z),{encoding:"utf8",mode:384,flag:"wx"}),await I3(Q,$)}function j2($){let{state:Z}=k0($);try{let Q=S3(Z);if(!Q.isFile()||Q.isSymbolicLink()||Q.size>v3||typeof process.getuid==="function"&&Q.uid!==process.getuid())return;let z=JSON.parse(F2(Z,"utf8"));if(z.schema!==A0||z.sessionId!==$.sessionId||z.taskId!==$.taskId||z.fingerprint!==$.fingerprint||!["running","done","failed","cancelled","timed_out"].includes(z.state??"")||!D2(z.identity)||!["settled","unknown"].includes(z.processGroupSettled??"")||z.outputPreview!==void 0&&(typeof z.outputPreview!=="string"||z.outputPreview.length>1e5)||z.totalChars!==void 0&&(!Number.isSafeInteger(z.totalChars)||z.totalChars<0)||z.outputBytes!==void 0&&(!Number.isSafeInteger(z.outputBytes)||z.outputBytes<0)||z.outputTruncated!==void 0&&typeof z.outputTruncated!=="boolean"||z.streamAvailable!==void 0&&typeof z.streamAvailable!=="boolean"||z.streamLatestSequence!==void 0&&(!Number.isSafeInteger(z.streamLatestSequence)||z.streamLatestSequence<0)||z.streamDroppedRecords!==void 0&&(!Number.isSafeInteger(z.streamDroppedRecords)||z.streamDroppedRecords<0)||z.streamTruncated!==void 0&&typeof z.streamTruncated!=="boolean"||z.streamRedactionConservative!==void 0&&typeof z.streamRedactionConservative!=="boolean"||z.streamGapUnknown!==void 0&&typeof z.streamGapUnknown!=="boolean")return;if(z.memoryContent!==void 0&&(typeof z.memoryContent!=="string"||z.memoryContent.length>2000000))return;return z}catch{return}}function D2($){let Z=$;return!!Z&&Z.platform==="linux"&&Number.isSafeInteger(Z.pid)&&Z.pid>1&&typeof Z.bootId==="string"&&typeof Z.pidNamespace==="string"&&typeof Z.startTimeTicks==="string"&&Number.isSafeInteger(Z.sessionId)&&Number.isSafeInteger(Z.processGroupId)&&Z.sessionId>0&&Z.processGroupId===Z.pid}function c3($,Z){return $.pid===Z.pid&&$.bootId===Z.bootId&&$.pidNamespace===Z.pidNamespace&&$.startTimeTicks===Z.startTimeTicks&&$.sessionId===Z.sessionId&&$.processGroupId===Z.processGroupId}function d3($){return{identity:$,status:"alive",observedAt:new Date().toISOString(),provenance:"kernel",scope:"process-group",progress:"not-measured"}}function o3($,Z){return!!$.identity&&c3($.identity,Z)&&$.scope==="process-group"&&$.status==="alive"&&$.processGroup?.status==="alive"}async function w2($){M2($);let Z=S0();if(!Z.identity||Z.scope!=="process-group")throw Error("Shell supervisor could not capture its Linux process-group identity");let Q=Z.identity,{outputDirectory:z,directory:J,state:K}=k0($);await C0(g3(z)),await C0(z),await C0(J);let V=new Date().toISOString(),Y={schema:A0,sessionId:$.sessionId,taskId:$.taskId,fingerprint:$.fingerprint,state:"running",identity:Q,startedAt:V,processGroupSettled:"unknown"},U=await l3($,Y),H=j2($);if(!H||H.streamAvailable===void 0)await a(K,{...Y,streamAvailable:!1,streamUnavailableReason:"retention-capacity",streamLatestSequence:0,streamDroppedRecords:0,streamTruncated:!0,streamRedactionConservative:!1,streamGapUnknown:!0});if(!U)U=new w0(k0($).journal),U.disable();let X=j2($)??{...Y,streamAvailable:!1,streamTruncated:!0},W=()=>{let L=U?.stats();return{streamAvailable:L?.available??X.streamAvailable??!1,...!L?.available&&X.streamUnavailableReason?{streamUnavailableReason:X.streamUnavailableReason}:{},streamLatestSequence:L?.latestSequence??X.streamLatestSequence??0,streamDroppedRecords:L?.droppedRecords??X.streamDroppedRecords??0,streamTruncated:L?.truncated??X.streamTruncated??!0,streamRedactionConservative:L?.redactionConservative??X.streamRedactionConservative??!1,streamGapUnknown:L?.gapUnknown??X.streamGapUnknown??!1}},G=new AbortController,k=()=>{if(!G.signal.aborted)G.abort(Error("Shell supervisor was asked to stop"))};process.on("SIGTERM",k);let B=R3($.executable,$.args,{cwd:$.cwd,env:H2(),detached:!0,stdio:["ignore","pipe","pipe"],windowsHide:!0}),N=new Promise((L)=>{B.once("exit",()=>L()),B.once("error",()=>L())}),M,D=0,q=0,E=Promise.resolve(),w=()=>{let L=M;if(!L||L.totalChars===D&&L.totalBytes===q)return;D=L.totalChars,q=L.totalBytes,E=E.then(async()=>{await U?.flush(200);let p={...X,totalChars:L.totalChars,outputBytes:L.totalBytes,outputPreview:U.preview(),outputTruncated:L.truncated,...W()};await a(K,p)}).catch(()=>{})},C=setInterval(w,m3);C.unref?.();let O=Y2(B.stdout,B.stderr,N,(L)=>{M=L},(L)=>U?.push(L)),[x,g]=await Promise.allSettled([O,V2(B,$.timeoutMs,G.signal)]);clearInterval(C),w(),await E,await U?.finish(1000);let l=W(),b=x.status==="fulfilled"?x.value:{content:"",preview:"",totalChars:0,totalBytes:0,truncated:!1,drainTimedOut:!0,provenance:{schema:"shell_channel_provenance_v1",ordering:"observed-arrival",stdoutChars:0,stderrChars:0,retainedChars:0,segments:[],segmentsOmitted:0,contentOmitted:0,drainTimedOut:!0}},y="done",S=0,f=null,m=!1,d=!1;if(g.status==="rejected"){let L=g.reason;S=typeof L.exitCode==="number"?L.exitCode:B.exitCode,f=L.signal??B.signalCode,m=L.timedOut===!0,d=L.cancelled===!0||G.signal.aborted,y=m?"timed_out":d?"cancelled":"failed"}if(x.status==="rejected"&&y==="done")y="failed";let o=(B.exitCode!==null||B.signalCode!==null)&&!b.drainTimedOut?"settled":"unknown",K0=b3();await $2($.sessionId,$.storageRoot,async(L)=>{await a(K,{...X,processGroupSettled:o,reservedOutputId:K0,outputPreview:U.preview(),totalChars:b.totalChars,outputBytes:b.totalBytes,outputTruncated:b.truncated,...l});let p=await L(b.content,b.totalChars,b.provenance,$.recoveryRoot,void 0,K0),V0=p.metadata.storage==="memory"?(await Z2($.sessionId,p.id,$.storageRoot,$.recoveryRoot)).content:void 0,j={schema:A0,sessionId:$.sessionId,taskId:$.taskId,fingerprint:$.fingerprint,state:y,identity:Q,startedAt:V,finishedAt:new Date().toISOString(),exitCode:S,signal:f,timedOut:m,cancelled:d,processGroupSettled:o,outputId:p.id,outputMetadata:p.metadata,outputPreview:U.preview(),totalChars:b.totalChars,outputBytes:b.totalBytes,outputTruncated:b.truncated,drainTimedOut:b.drainTimedOut,provenance:b.provenance,...l,...V0!==void 0?{memoryContent:V0}:{}};await a(K,j)}),process.off("SIGTERM",k)}async function k2($){let Z=[],Q=0;for await(let J of $){let K=Buffer.from(J);if(Q+=K.length,Q>h3)throw Error("Shell supervisor configuration exceeds its limit");Z.push(K)}let z=JSON.parse(Buffer.concat(Z).toString("utf8"));return M2(z),z}if(import.meta.main)try{let $=await k2(process.stdin);await w2($),process.exit(0)}catch($){process.stderr.write(`Shell supervisor failed: ${$ instanceof Error?$.message:String($)}
|
|
31
31
|
`),process.exit(1)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hermenics/deepseek-code",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "A DeepSeek-powered coding assistant that lives in your terminal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
|
-
"bun": ">=1.
|
|
35
|
+
"bun": ">=1.4.0",
|
|
36
36
|
"node": ">=18"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"build": "bun run build.ts",
|
|
42
42
|
"build:pods-avatar": "bun scripts/build-pod-avatar.ts",
|
|
43
43
|
"typecheck": "bunx tsc --noEmit",
|
|
44
|
-
"test": "bun test tests",
|
|
45
|
-
"test:coverage": "bun test tests --coverage --coverage-reporter=lcov --coverage-dir=coverage
|
|
46
|
-
"test:ink": "bun test tests/ink",
|
|
47
|
-
"test:plugins": "bun test tests/plugins",
|
|
44
|
+
"test": "bun test tests --parallel=1 --max-concurrency=1 --timeout=15000",
|
|
45
|
+
"test:coverage": "bun test tests --parallel=1 --max-concurrency=1 --timeout=15000 --coverage --coverage-reporter=lcov --coverage-dir=coverage",
|
|
46
|
+
"test:ink": "bun test tests/ink --parallel=1 --max-concurrency=1 --timeout=15000",
|
|
47
|
+
"test:plugins": "bun test tests/plugins --parallel=1 --max-concurrency=1 --timeout=15000",
|
|
48
48
|
"pack:check": "./scripts/verify-package.sh"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|