Lines 406-455javascript
406 # Driving / repairing the lint/build/test run (BUILD phase).
408 # Drafting a new issue from the Quick-task panel.
410 # One-shot repository indexing at registration.
413# Concurrency is not a per-project setting: it is the operator-set per-account
414# sandbox quota (how many runners the account may occupy), enforced by the HUB
415# and sized on the farm. A solo 'codepipe up' runs one worker. (ADR-0030)
418# # How IMPLEMENTING is ordered across tasks. Default: parallel.
419# # parallel \u2014 tasks branch independently off the base; conflicts are
420# # resolved reactively via \`@codepipe rebase\`. No head-of-line
421# # blocking between tasks.
422# # sequential \u2014 one task at a time in creation order; each branch stacks on
423# # the previous task's branch (auto-merge without reworking the
424# # tail of the chain).
426`}function Up(t){return`codepipe/context-migration-v${t}`}function Lp(t){let e=ci(t.templateVersion),r=[`CodePipe context format migration: **v${t.templateVersion} \u2192 v${t.currentVersion}**.`,"","Additive only \u2014 this PR creates files your context is missing and updates",`the \`${je
427`)}async function ss(t,e,r,o){let n=sn(t);await n.pull(void 0,void 0,["--rebase"]).catch(()=>{});let i=eo(t,e);if(!i.outdated)return i;let s=Up(i.currentVersion),a=r?.branch??(await n.revparse(["--abbrev-ref","HEAD"]).catch(()=>"main")).trim();try{await n.fetch().catch(()=>{}),(await n.raw(["ls-remote","--heads","origin",s]).catch(()=>"")).trim().length===0?await Dp(t,e,r,i,s,a,o):o.info(`[ctx] migration branch ${s} already on origin \u2014 reusing`)}catch(l){return o.warn(`[ctx] context migration branch failed (will retry next start): ${l instanceof Error?l.message:String(l)}`),i}if(!r)return ...
428${l.trim()}`)}}let i=us(o);try{await i.fetch()}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`git fetch failed in ${o}
429${c.trim()}`)}let s=e.defaultBranch??"main";return await i.checkout(["-B",s,`origin/${s}`]).catch(()=>{}),i}async function yr(t,e){try{return await t.raw(["cat-file",
430${y.trim()}`)}}let h=(await t.revparse(["HEAD"])).trim(),C=f?["--force-with-lease","-u","origin",a]:["-u","origin",a];return await t.push(C),await t.push([o,"--delete",n]).catch(()=>{}),{commit:h}}async function ms(t,e,r){let{contextRepoCloneUrl:o,deliveryRef:n,deliverySha:i,baseSha:s,branchName:a,commitMessage:c,push:l}=r,u=await ds(t,i,()=>no(t,{contextRepoCloneUrl:o,deliveryRef:n,deliverySha:i,baseSha:s,commitMessage:c}));return await t.raw(["branch","-f",a,u]),l&&await t.push(["--force-with-lease","-u","origin",a]),{commit:u,pushed:l}}async function gs(t,e,r){let{branchName:o,baseBranch:n, ...
431`)){let o=r.match(/CA Issuers - URI:\s*(https?:\/\/\S+)/i);if(o?.[1])return o[1].trim()}return null}function id(t,e,r){return new Promise((o,n)=>{let i=Ze.connect({host:t,port:e,servername:t,rejectUnauthorized:!1},()=>{let s=i.getPeerCertificate(!0),a=new Set;for(;s?.issuerCertificate&&s.issuerCertificate!==s&&s.fingerprint256&&!a.has(s.fingerprint256);)a.add(s.fingerprint256),s=s.issuerCertificate;let c=s?.raw?new xs(s.raw):null;i.end(),o(c)});i.on("error",n),i.setTimeout(r,()=>{i.destroy(),n(new Error("tls connect timeout"))})})}function un(t,e,r){return new Promise(o=>{let n=Ze.connect({hos ...
432`)}function jd(t,e,r){let o=new Map,n=Je(t,`tasks/${e}/comments.jsonl`);if(ia(n))for(let i of Cd(n,"utf-8").split(`
433`)){let s=i.trim();if(s)try{let a=JSON.parse(s);a&&typeof a.id=="string"&&o.set(a.id,a)}catch{}}for(let i of r){let s={id:i.id,author:i.author,origin:"youtrack",body:i.body,createdAt:new Date(i.createdAt).toISOString()},a=Fr
435`:"")}function Ed(t,e,r){let o=[],n=Je(t,`tasks/${e}/attachments`);if(ia(n))for(let i of Rd(n))o.push(i);for(let i of r)o.includes(i.name)||o.push
436`,{mode:384})}function Gd(t){return aa()[t]}function yt(t,e){let r=aa();r[t]=e,Bd(r)}function Lt(t,e){let r=he(e),o=Gd(t);if(o&&o!==r)throw new Error(`farm ${t} key fingerprint changed (pinned ${o}, now ${r}) \u2014 refusing to seal. If the farm was re-registered intentionally, remove its entry from ${wn()}.`);return r}import Md from"ws";function fo(t,e){let r=t.replace(/^http/,"ws")+`/cli/connect?token=${encodeURIComponent(e)}`;return new Md(r)}var A=class extends Error{constructor(r,o,n){super(n);this.status=r;this.payload=o;this.name="HubHttpError"}};async function tt(t,e,r){return Se(t,e," ...
438`;return nf(t,r,{mode:384}),`ssh -i "${t}" -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new`}function cf(t,e,r="x-access-token"){let o=`${encodeURIComponent(r)}:${encodeURIComponent(e)}`,n=t.match(/^git@([^:]+):(
439[${p}] shutting down`),l.stop(),setTimeout(()=>process.exit(0),200))}process.on("SIGINT",()=>f("SIGINT")),process.on("SIGTERM",()=>f("SIGTERM")),await new Promise(()=>{})}import{hostname as bf}from"node:os";import{spawnSync as df}from"node:child_process";function ff(){try{return df("podman",["--version"],{stdio:"ignore",timeout:5e3}).status===0}catch{return!1}}function Va(t={}){let e=process.platform==="darwin"?"darwin":process.platform==="win32"?"windows":"linux",r=process.arch==="arm64"?"arm64":"x64";return{os:e,arch:r,containers:ff(),node:process.versions.node,browser:!1,projects:t.projects ...
440`,{mode:384})}import wf from"ws";var Gt=class{hubUrl;token;constructor(e,r){this.hubUrl=e,this.token=r}async register(e){let r=await fetch(`${this.hubUrl}/sandbox/register`,{method:"POST",headers:{"Content-Type":"application/json"
441`}async function tc(t,e){if(!e.interactive)throw new Error("runInteractiveClaude called without an interactive channel");if(e.signal?.aborted)throw new Ke;let r=["--input-format","stream-json","--output-format","stream-json","--verbose","--dangerously-skip-permissions"];e.model&&e.model.trim().length>0&&r.push("--model",e.model.trim());for(let c of e.addDirs??[])r.push("--add-dir",c);let o=e.onActivity,n=c=>{if(o)try{o(c)}catch{}},i=[],s=null,a=c=>{let l=Date.now(),u=c.type;if(u==="assistant"){let f=c.message;for(let p of f?.content??[]){let g=p.type;if(g==="text"){let d=String(p.text??"").tri ...
HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
dist/index.jsView on unpkg · L426 442`))!==-1;){let m=v.slice(0,x).trim();v=v.slice(x+1),m&&N(m)}}),u.stderr.on("data",P=>{i.push(P);for(let x of P.split(`
443`)){let m=x.trim();m&&console.warn(`[claude:chat:stderr] ${m}`)}}),u.on("error",P=>{k(),l(P)}),u.on("close",P=>{if(k(),f){l(new Ke);return}if(p){l(
444`))!==-1;){let m=N.slice(0,x).trim();if(N=N.slice(x+1),m){let T=rc(m);u(T),T&&g(T)}}}),C.stderr.on("data",P=>{o.push(P),n.push(P);for(let x of P.split(`
445`)){let m=x.trim();m&&console.warn(`[claude:stderr] ${m}`)}}),C.on("error",P=>{v(),h(P)}),C.on("close",P=>{if(v(),k){h(new Ke);return}if(N.trim()){let m=rc(N.trim());u(m),m&&g(m)}let x=i?.is_error===!0;if(P!==0||x){let m=typeof i?.api_error_status=="number"?i.api_error_status:void 0,T=typeof i?.subtype=="string"?i.subtype:void 0,b=typeof i?.result=="string"?i.result:void 0;h(new Mt(If(P,i,n.join("")),{code:P,apiErrorStatus:m,subtype:T,resultText:b,retryAfterMs:jf(i)}));return}console.log("[claude] exit code=0"),d({artifactPaths:[],log:o.join(""),usage:Af(i,s,a,c),...l?{rateLimit:l}:{}})})})}st ...
447`),500)),o.join(" \u2014 ")}function jf(t){if(!t)return;let e=t.retry_after;if(typeof e=="number"&&e>0)return Math.round(e*1e3);let r=typeof t.result=="string"
448`),s.push("NOTE.md"));return{artifactPaths:s,log:`mock runner produced ${s.length} artifact(s) for role=${e.role}`,usage:pt()}}async runInteractive(e){let r=e.onActivity,o=i=>{r?.({ts:Date.now(),kind:"text",author:"agent",text:i}),r?.({ts:Date.now(),kind:"result",author:"agent",text:"success"})};r?.({ts:Date.now(),kind:"start",author:"agent",text:"chat session started"}),o("\u041F\u0440\u0438\u0432\u0435\u0442! \u041E\u043F\u0438\u0448\u0438\u0442\u0435 \u0437\u0430\u0434\u0430\u0447\u0443, \u043A\u043E\u0442\u043E\u0440\u0443\u044E \u0445\u043E\u0442\u0438\u0442\u0435 \u0441\u0444\u043E\u0440 ...
450\u0421\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u0432 \u0438\u043D\u0442\u0435\u0440\u0430\u043A\u0442\u0438\u0432\u043D\u043E\u043C \u0447\u0430\u0442\u0435 (mock runner).
451`),{artifactPaths:["DRAFT.md"],log:"mock chat session finalized DRAFT.md",usage:pt()}}};function Lf(t,e,r){return`# ${t} \u2014 Estimate
Long lines were clipped for display.