@codions/portta 0.1.0 → 0.2.0
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 +41 -88
- package/dist/assets/agents/hook.sh.tmpl +21 -0
- package/dist/assets/agents/instruction.md +8 -0
- package/dist/assets/agents/portta-context.ts.tmpl +24 -0
- package/dist/assets/skills/portta-adopt-compose/SKILL.md +220 -0
- package/dist/assets/skills/portta-dockerize/SKILL.md +118 -0
- package/dist/assets/skills/portta-host-context/SKILL.md +142 -0
- package/dist/cli.js +1542 -1017
- package/dist/documentation.json.gz +0 -0
- package/dist/runtime/.env.example +6 -42
- package/dist/runtime/VERSION +1 -1
- package/dist/runtime/docker/compose/features/web-dev.yaml +0 -2
- package/dist/runtime/docker/compose/features/web.yaml +0 -8
- package/dist/runtime/templates/README.md +3 -3
- package/dist/runtime/templates/overlays/06-monorepo.yaml +0 -7
- package/dist/runtime/templates/overlays/07-worktree.env +0 -1
- package/dist/runtime/templates/project/PORTTA.md +8 -7
- package/package.json +4 -15
- package/dist/acp-providers-M3DUUBYJ.js +0 -3
- package/dist/arktype-aI7TBD0R-SOJGD3SZ.js +0 -3
- package/dist/assets/skills/portta-workflows/SKILL.md +0 -285
- package/dist/assets/workflows/bake-off.workflow.js +0 -172
- package/dist/assets/workflows/code-review.workflow.js +0 -179
- package/dist/assets/workflows/deep-research.workflow.js +0 -223
- package/dist/assets/workflows/multi-provider-review.workflow.js +0 -169
- package/dist/assets/workflows/provider-debate.workflow.js +0 -141
- package/dist/assets/workflows/second-opinion.workflow.js +0 -176
- package/dist/chunk-3EZNE4MC.js +0 -6
- package/dist/chunk-4TGTGGMK.js +0 -4
- package/dist/chunk-4YGEG6YX.js +0 -1878
- package/dist/chunk-5SBYE3YH.js +0 -26
- package/dist/chunk-6J5HN4ZN.js +0 -3
- package/dist/chunk-6TV2V7RR.js +0 -3
- package/dist/chunk-CFWGQ7VJ.js +0 -19
- package/dist/chunk-EFZZFIRZ.js +0 -3
- package/dist/chunk-EH7H7D7J.js +0 -15
- package/dist/chunk-EYT7VTYA.js +0 -4
- package/dist/chunk-FRQCKCCK.js +0 -332
- package/dist/chunk-GI2EUNAK.js +0 -16
- package/dist/chunk-HB5T7XDN.js +0 -5
- package/dist/chunk-IILMQFWO.js +0 -14
- package/dist/chunk-LAYNTFDR.js +0 -70
- package/dist/chunk-MH5YJA5O.js +0 -2
- package/dist/chunk-O6U47HHQ.js +0 -341
- package/dist/chunk-OPVZAG2C.js +0 -10
- package/dist/chunk-PTKKSRMI.js +0 -223
- package/dist/chunk-Q3VNQ3LU.js +0 -3
- package/dist/chunk-QBKADN76.js +0 -4
- package/dist/chunk-QS5PHDYT.js +0 -240
- package/dist/chunk-SBVO6RXF.js +0 -87
- package/dist/chunk-T3TSZO4I.js +0 -7
- package/dist/chunk-TA2XHP5D.js +0 -4
- package/dist/chunk-UUSUJUAD.js +0 -7
- package/dist/chunk-UX7P3YHF.js +0 -3
- package/dist/chunk-VDSWNWUY.js +0 -168
- package/dist/chunk-WNZR7VOO.js +0 -145
- package/dist/chunk-YYSFNLBX.js +0 -5
- package/dist/cli-O2MMC25H.js +0 -98
- package/dist/completions-F4476JAU.js +0 -12
- package/dist/config-E5XLLPKE.js +0 -3
- package/dist/core-FSKGFGJO.js +0 -18
- package/dist/default-u_dwuiYb-OWTONHM6.js +0 -3
- package/dist/dispatch-ZCNGHCNP.js +0 -8
- package/dist/doctor-7F6ZXPZE.js +0 -5
- package/dist/effect-QlVUlMFu-4UNP2EGS.js +0 -3
- package/dist/esm-575VQW4T.js +0 -4
- package/dist/host.js +0 -8
- package/dist/init-HGEXUJP3.js +0 -245
- package/dist/linear-commands-XGHGICI7.js +0 -5
- package/dist/oneshot-DL57ZA55.js +0 -36
- package/dist/opencode-YDUTVKTG.js +0 -3
- package/dist/pi-L73UX3S5.js +0 -3
- package/dist/project-commands-2N44CRGM.js +0 -7
- package/dist/project-env-NWBVITHM.js +0 -4
- package/dist/run-commands-TCBNFJOT.js +0 -13
- package/dist/runtime/docker/compose/features/panel-host.yaml +0 -42
- package/dist/shell-ZWXPCUMD.js +0 -3
- package/dist/subprocess-jsonl-FQKDRENI.js +0 -3
- package/dist/supervisor.js +0 -179
- package/dist/sury-CWZTCd75-XQOYZHNU.js +0 -3
- package/dist/typebox-Dei93FPO-RCGWIHUQ.js +0 -3
- package/dist/valibot--1zFm7rT-DKLMYF44.js +0 -3
- package/dist/valibot-D_HTw1Gn-QTR63R64.js +0 -4
- package/dist/worktree-commands-F7REOKFJ.js +0 -50
- package/dist/zod-Bwrt9trS-6RSVELLV.js +0 -3
- package/dist/zod-DSgpEGAE-5JBFOUHY.js +0 -3
package/dist/chunk-5SBYE3YH.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{c as _,h as I}from"./chunk-QS5PHDYT.js";import{a as p,b as T,c as D,e as C,f as N,g as $,i as M}from"./chunk-IILMQFWO.js";import{c as S,d as E}from"./chunk-EFZZFIRZ.js";import{a as O}from"./chunk-T3TSZO4I.js";import{a as u}from"./chunk-6J5HN4ZN.js";var i="opencode",U="1.16.2",L=class{static{u(this,"OpencodeWorker")}id=i;bin;spawnProcess;stallTimeoutMs;versionCheck=null;constructor(e={}){this.bin=e.bin??"opencode",this.spawnProcess=e.spawnProcess,this.stallTimeoutMs=e.stallTimeoutMs??D}async runAgent(e,f){if(f.signal.aborted)throw new T;if(e.schema)try{_(e.schema)}catch(k){throw new p({provider:i,code:"invalid_schema",message:`output schema does not compile: ${k.message}`})}if(e.maxTurns!==void 0)throw new p({provider:i,code:"unsupported_op\
|
|
4
|
-
tion",message:"opencode has no enforceable turn cap (its `steps` config is advisory); omit maxTurns or use the claude-code provider"});if(e.sandbox!=="danger-full-access")throw new p({provider:i,code:"unsupported_option",message:`opencode cannot enforce a "${e.sandbox}" sandbox (no OS-level confinement; bash is unrestricted) \u2014 set sandbox: "danger-full-access" to use provider "opencode"`});if(e.approval!=="never")throw new p({provider:i,code:"unsupported_option",message:`opencode runs as a \
|
|
5
|
-
one-shot subprocess and cannot surface approval requests to ${O} \u2014 use approval: "never" with provider "opencode"`});await this.ensureVersion();let d=["run","--format","json","--thinking",...e.effort?["--variant",e.effort]:[],...e.model?["--model",e.model]:[],"--dangerously-skip-permissions"],s=await this.runTurn(e,d,R(e,e.prompt),f,!0);if(!e.schema)return{text:s.text,status:"completed",usage:s.usage};let y=s.sessionID?[...d,"--session",s.sessionID]:d,m=await this.runTurn(e,y,R(e,V(e,s)),f,
|
|
6
|
-
!1),a;try{a=I(m.text)}catch{a=void 0}return{text:m.text,structured:a,status:"completed",usage:E(s.usage,m.usage)}}async shutdown(){}ensureVersion(){return this.versionCheck||(this.versionCheck=this.checkVersion().catch(e=>{throw this.versionCheck=null,e})),this.versionCheck}async checkVersion(){let e=await $({provider:i,bin:this.bin,args:["--version"],env:this.env(),spawnProcess:this.spawnProcess});if(!M(e,U))throw new p({provider:i,code:"provider_outdated",message:`opencode ${e||"(unknown versi\
|
|
7
|
-
on)"} is below the minimum supported ${U} \u2014 upgrade the opencode CLI`,retryable:!1})}env(){return{...process.env,OPENCODE_DISABLE_AUTOUPDATE:"1"}}async runTurn(e,f,d,s,y){let m="",a=S(),k,x,v=u(r=>{y&&s.onProgress(r)},"forward"),b=await C({provider:i,bin:this.bin,args:f,cwd:e.launcherCwd??e.cwd,env:{...this.env(),...e.launcherEnv},stdin:d,signal:s.signal,stallTimeoutMs:this.stallTimeoutMs,spawnProcess:this.spawnProcess,onValue:u(r=>{if(!g(r))return;k===void 0&&typeof r.sessionID=="string"&&
|
|
8
|
-
(k=r.sessionID);let l=g(r.part)?r.part:void 0;switch(r.type){case"text":{let t=o(l?.text)??o(r.text);if(t!==void 0){let c=m.length>0?`
|
|
9
|
-
|
|
10
|
-
${t}`:t;m+=c,v({kind:"text",text:c})}return}case"reasoning":{let t=o(l?.text)??o(r.text);t!==void 0&&v({kind:"reasoning",text:t});return}case"tool_use":{let t=l??r,c=g(t.state)?t.state:void 0,w=o(c?.status);if(w!=="completed"&&w!=="error")return;let P=o(t.callID),A=o(t.tool)??"tool";v({kind:"tool",id:P,name:A,input:c?.input}),v({kind:"tool-result",id:P,name:A,output:o(c?.output)??o(c?.error),isError:w==="error"});return}case"step_finish":{let t=g(l?.tokens)?l.tokens:g(r.tokens)?r.tokens:void 0,c=h(
|
|
11
|
-
l?.cost)??h(r.cost)??0;if(t){let w=g(t.cache)?t.cache:void 0;a={inputTokens:a.inputTokens+(h(t.input)??0)+(h(w?.read)??0)+(h(w?.write)??0),outputTokens:a.outputTokens+(h(t.output)??0)+(h(t.reasoning)??0),costUsd:a.costUsd+c},v({kind:"usage",usage:{inputTokens:a.inputTokens,outputTokens:a.outputTokens}})}return}case"error":{x||(x=W(r));return}default:return}},"onValue")});if(x)throw x;if(s.signal.aborted)throw new T;if(b.code!==0)throw/database is locked/i.test(b.stderrTail)?new p({provider:i,code:"\
|
|
12
|
-
provider_busy",message:`opencode exited with transient database contention \u2014 retrying
|
|
13
|
-
--- stderr (tail) ---
|
|
14
|
-
${b.stderrTail}`,retryable:!0}):N(i,this.bin,b);if(m.length===0)throw new p({provider:i,code:"no_result",message:"opencode exited 0 without producing any assistant text"});return{text:m,usage:a,sessionID:k}}};function R(n,e){return n.instructions?`<instructions>
|
|
15
|
-
${n.instructions}
|
|
16
|
-
</instructions>
|
|
17
|
-
|
|
18
|
-
${e}`:e}u(R,"withInstructions");function V(n,e){return(e.sessionID?"":`Earlier you produced this answer:
|
|
19
|
-
|
|
20
|
-
${e.text}
|
|
21
|
-
|
|
22
|
-
`)+`Return your final answer as a single JSON value that conforms to the following JSON Schema. Output ONLY the JSON \u2014 no prose, no explanation, no code fences.
|
|
23
|
-
|
|
24
|
-
Schema:
|
|
25
|
-
`+JSON.stringify(n.schema)}u(V,"extractionPrompt");function W(n){let e=g(n.error)?n.error:void 0,f=e&&g(e.data)?e.data:void 0,d=o(e?.name)??o(n.name),s=o(f?.message)??o(e?.message)??o(n.message)??"opencode reported an error";return new p({provider:i,code:d==="ProviderAuthError"?"provider_auth":"provider_error",message:d?`${d}: ${s}`:s,retryable:!1})}u(W,"toStreamError");function g(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}u(g,"isObject");function o(n){return typeof n=="string"?n:
|
|
26
|
-
void 0}u(o,"strOf");function h(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}u(h,"numOf");export{U as a,L as b};
|
package/dist/chunk-6J5HN4ZN.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a,b)=>e(a,"name",{value:b,configurable:!0}),n=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var o=(a,b)=>()=>{try{return b||a((b={exports:{}}).exports,b),b.exports}catch(c){throw b=0,c}},p=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})},l=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=h(b,d))||f.enumerable});return a};var q=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c,p as d,q as e};
|
package/dist/chunk-6TV2V7RR.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{j as o}from"./chunk-T3TSZO4I.js";import{a as n}from"./chunk-6J5HN4ZN.js";var s="PORTTA_HOST_PORT";function m(r,t=process.env){if(r!==void 0)return r;let e=Number.parseInt(t[s]??"",10);return Number.isNaN(e)?o.port:e}n(m,"resolveServerPort");export{s as a,m as b};
|
package/dist/chunk-CFWGQ7VJ.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{c as N,h as R}from"./chunk-QS5PHDYT.js";import{a as u,b as x,c as I,e as M,f as C,g as U,i as W}from"./chunk-IILMQFWO.js";import{c as O,d as E}from"./chunk-EFZZFIRZ.js";import{a as _,b as S}from"./chunk-T3TSZO4I.js";import{a as i}from"./chunk-6J5HN4ZN.js";import{mkdtempSync as j,rmSync as D}from"node:fs";import{tmpdir as V}from"node:os";import{join as F}from"node:path";var s="pi",J="0.79.1",G={none:"off",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"xhigh"},L=class{static{i(this,"PiWorker")}id=s;bin;spawnProcess;stallTimeoutMs;versionCheck=null;constructor(e={}){this.bin=e.bin??"pi",this.spawnProcess=e.spawnProcess,this.stallTimeoutMs=e.stallTimeoutMs??I}async runAgent(e,r){if(r.signal.aborted)throw new x;if(e.schema)try{N(e.schema)}catch(a){throw new u({provider:s,code:"invalid_schema",message:`output schema does not compile: ${a.
|
|
4
|
-
message}`})}if(e.maxTurns!==void 0)throw new u({provider:s,code:"unsupported_option",message:"pi has no native turn cap (the agent loop runs until no tool calls remain); omit maxTurns or use the claude-code provider"});if(e.sandbox!=="danger-full-access")throw new u({provider:s,code:"unsupported_option",message:`pi cannot enforce a "${e.sandbox}" sandbox (tool allowlists are not OS confinement; bash is unrestricted) \u2014 set sandbox: "danger-full-access" to use provider "pi"`});if(e.approval!==
|
|
5
|
-
"never")throw new u({provider:s,code:"unsupported_option",message:`pi runs as a one-shot subprocess and cannot surface approval requests to ${_} \u2014 use approval: "never" with provider "pi"`});await this.ensureVersion();let y=this.baseArgs(e),c=await this.runTurn(e,y,e.prompt,r,!0);if(!e.schema)return{text:c.text,status:"completed",usage:c.usage};let k=["--mode","json","--no-session","--no-tools",...e.model?["--model",e.model]:[],"--thinking","off",...e.instructions?["--append-system-prompt",
|
|
6
|
-
e.instructions]:[]],l=await this.runTurn(e,k,q(e,c.text),r,!1),m;try{m=R(l.text)}catch{m=void 0}return{text:l.text,structured:m,status:"completed",usage:E(c.usage,l.usage)}}async shutdown(){}baseArgs(e){return["--mode","json","--no-session",...e.model?["--model",e.model]:[],...e.effort?["--thinking",G[e.effort]]:[],...e.instructions?["--append-system-prompt",e.instructions]:[]]}ensureVersion(){return this.versionCheck||(this.versionCheck=this.checkVersion().catch(e=>{throw this.versionCheck=null,
|
|
7
|
-
e})),this.versionCheck}async checkVersion(){let e=j(F(V(),`${S}-pi-version-`)),r;try{r=await U({provider:s,bin:this.bin,args:["--version"],cwd:V(),env:{...process.env,PI_CODING_AGENT_DIR:e},spawnProcess:this.spawnProcess})}finally{D(e,{recursive:!0,force:!0})}if(!W(r,J))throw new u({provider:s,code:"provider_outdated",message:`pi ${r||"(unknown version)"} is below the minimum supported ${J} \u2014 upgrade with: npm i -g @earendil-works/pi-coding-agent (the renamed @mariozechner/pi-coding-agent packag\
|
|
8
|
-
e is outdated)`,retryable:!1})}async runTurn(e,r,y,c,k){let l="",m,a=O(),w,v=!1,f=i(o=>{k&&c.onProgress(o)},"forward"),b=i(o=>{let n=g(o.stopReason);n==="error"&&!w?w=new u({provider:s,code:"provider_error",message:g(o.errorMessage)??'pi assistant message ended with stopReason "error"',retryable:!1}):n==="aborted"&&(v=!0)},"readAssistantTerminal"),T=await M({provider:s,bin:this.bin,args:r,cwd:e.launcherCwd??e.cwd,env:{...process.env,...e.launcherEnv},stdin:y,signal:c.signal,stallTimeoutMs:this.stallTimeoutMs,
|
|
9
|
-
spawnProcess:this.spawnProcess,onValue:i(o=>{if(d(o))switch(o.type){case"message_update":{let n=d(o.assistantMessageEvent)?o.assistantMessageEvent:void 0;if(!n)return;n.type==="text_delta"&&typeof n.delta=="string"?(l+=n.delta,f({kind:"text",text:n.delta})):n.type==="thinking_delta"&&typeof n.delta=="string"?f({kind:"reasoning",text:n.delta}):n.type==="error"&&d(n.error)&&b(n.error);return}case"message_end":{let n=d(o.message)?o.message:void 0;if(n?.role!=="assistant")return;let P=z(n);P.length>
|
|
10
|
-
0&&(m=P);let p=d(n.usage)?n.usage:void 0;if(p){let $=d(p.cost)?p.cost:void 0;a={inputTokens:a.inputTokens+(h(p.input)??0)+(h(p.cacheRead)??0)+(h(p.cacheWrite)??0),outputTokens:a.outputTokens+(h(p.output)??0),costUsd:a.costUsd+(h($?.total)??0)},f({kind:"usage",usage:{inputTokens:a.inputTokens,outputTokens:a.outputTokens}})}b(n);return}case"tool_execution_start":{f({kind:"tool",id:g(o.toolCallId),name:g(o.toolName)??"tool",input:o.args});return}case"tool_execution_end":{f({kind:"tool-result",id:g(
|
|
11
|
-
o.toolCallId),name:g(o.toolName),output:H(o.result),isError:o.isError===!0});return}default:return}},"onValue")});if(w)throw w;if(c.signal.aborted)throw new x;if(v)throw new u({provider:s,code:"aborted",message:"pi aborted the request",retryable:!1});if(T.code!==0)throw C(s,this.bin,T);let A=m??l;if(A.length===0)throw new u({provider:s,code:"no_result",message:"pi exited 0 without producing any assistant text"});return{text:A,usage:a}}};function q(t,e){return`Earlier you produced this answer:
|
|
12
|
-
|
|
13
|
-
${e}
|
|
14
|
-
|
|
15
|
-
Return that answer as a single JSON value that conforms to the following JSON Schema. Output ONLY the JSON \u2014 no prose, no explanation, no code fences.
|
|
16
|
-
|
|
17
|
-
Schema:
|
|
18
|
-
`+JSON.stringify(t.schema)}i(q,"extractionPrompt");function z(t){if(!Array.isArray(t.content))return"";let e="";for(let r of t.content)d(r)&&r.type==="text"&&typeof r.text=="string"&&(e+=r.text);return e}i(z,"assistantText");function H(t){if(t!=null){if(typeof t=="string")return t;if(d(t)&&Array.isArray(t.content)){let e=t.content.map(r=>d(r)&&typeof r.text=="string"?r.text:"").join("");if(e.length>0)return e}try{return JSON.stringify(t)}catch{return String(t)}}}i(H,"stringifyResult");function d(t){
|
|
19
|
-
return t!==null&&typeof t=="object"&&!Array.isArray(t)}i(d,"isObject");function g(t){return typeof t=="string"?t:void 0}i(g,"strOf");function h(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}i(h,"numOf");export{J as a,L as b};
|
package/dist/chunk-EFZZFIRZ.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as t}from"./chunk-6J5HN4ZN.js";var n=["codex","claude-code","opencode","pi"];function o(e){return n.includes(e)}t(o,"isBuiltinProvider");function s(){return{inputTokens:0,outputTokens:0,costUsd:0}}t(s,"emptyUsage");function a(e,r){return{inputTokens:e.inputTokens+r.inputTokens,outputTokens:e.outputTokens+r.outputTokens,costUsd:e.costUsd+r.costUsd}}t(a,"addUsage");var i={provider:"codex",sandbox:"read-only",approval:"never",concurrency:100,maxAgents:1e3,maxFanout:4096,budget:null};export{n as a,o as b,s as c,a as d,i as e};
|
package/dist/chunk-EH7H7D7J.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as l}from"./chunk-6J5HN4ZN.js";import{spawn as W}from"node:child_process";import{basename as D,delimiter as E}from"node:path";var H="__PORTTA_FLOW_SHELL_ENV_START__",O="__PORTTA_FLOW_SHELL_ENV_END__",G=[`printf '%s\\n' ${H}`,"env",`printf '%s\\n' ${O}`].join("; "),J=3e3,F=1e3,k=1e4,b=64*1024;function P(e,n){if(n==="win32")return null;let t=e.SHELL?.trim();return t||(n==="darwin"?"/bin/zsh":"/bin/sh")}l(P,"resolveUserShellCommand");function _(e,n){let t=D(e);return t==="sh"||t==="dash"?[["-lc",n]]:t==="fish"?[["-lc",n],["-c",n]]:[["-ilc",n],["-lc",n]]}l(_,"userShellArgSets");function K(e){let n=e.split(/\r?\n/u),t=n.findIndex(
|
|
4
|
-
r=>r.trim()===H);if(t===-1)return null;let o=n.findIndex((r,s)=>s>t&&r.trim()===O);if(o===-1)return null;for(let r of n.slice(t+1,o)){if(!r.startsWith("PATH="))continue;return r.slice(5).trim()||null}return null}l(K,"pathFromShellOutput");function $(e,n){let t=[...e.split(E),...n.split(E)],o=new Set;for(let r of t)r&&o.add(r);return[...o].join(E)}l($,"mergePaths");function V(e){return new Promise(n=>{let t=null,o="",r="",s=!1,c,i,h=l((u=!1)=>{c&&clearTimeout(c),!u&&i&&clearTimeout(i),c=void 0,u||
|
|
5
|
-
(i=void 0)},"clearTimers"),a=l((u,p=!1)=>{s||(s=!0,h(p),n(u))},"settle"),d=l(()=>{s||(t?.kill("SIGTERM"),i=setTimeout(()=>{t?.kill("SIGKILL")},F),i.unref())},"terminate"),m=l(()=>{s||(d(),a({error:new Error("Shell environment probe produced too much output"),signal:null,status:null,stderr:r,stdout:o},!0))},"rejectOversizedOutput");try{t=W(e.command,e.args,{env:e.env,stdio:["ignore","pipe","pipe"]})}catch(u){a({error:u instanceof Error?u:new Error(String(u)),signal:null,status:null,stderr:r,stdout:o});
|
|
6
|
-
return}c=setTimeout(()=>{d(),a({error:new Error(`Shell environment probe timed out after ${e.timeoutMs}ms`),signal:"SIGTERM",status:null,stderr:r,stdout:o},!0)},e.timeoutMs),c.unref(),t.stdout?.setEncoding("utf8"),t.stdout?.on("data",u=>{o+=u,Buffer.byteLength(o)+Buffer.byteLength(r)>b&&m()}),t.stderr?.setEncoding("utf8"),t.stderr?.on("data",u=>{r+=u,Buffer.byteLength(o)+Buffer.byteLength(r)>b&&m()}),t.on("error",u=>{a({error:u,signal:null,status:null,stderr:r,stdout:o})}),t.on("close",(u,p)=>{a(
|
|
7
|
-
{signal:p,status:u,stderr:r,stdout:o})})})}l(V,"defaultSpawnUserShellEnv");async function j(e,n){let t=e.env??process.env,o=P(t,e.platform??process.platform);if(!o)return null;let r=e.spawnUserShellEnv??V;for(let[s,c]of _(o,G).entries()){let i=await r({command:o,args:c,env:t,timeoutMs:e.timeoutMs??J});if(i.error||i.signal!==null||i.status!==0){if(s===0&&n)return n;continue}let h=K(i.stdout);if(h)return h;if(s===0&&n)return n}return null}l(j,"resolveWithPrevious");function X(e={}){let n=null;return async()=>{let t=await j(e,n);return t&&(n=t),t}}l(X,"createUserShellPathResolver");function z(e={}){let n=e.env??process.env,t=X(e),o=e.now??Date.now,r=e.refreshTtlMs??k,s=n.PATH??"",c=0,i=null;return{refresh(){return i||(c>o()?Promise.resolve({changed:!1,path:s}):(i=(async()=>{let h=await t(),a=h?$(s,h):s,d=a!==s;return s=a,s&&(n.PATH=s),c=o()+r,{changed:d,path:s}})(),i.finally(()=>{i=null})))}}}l(z,"createHostShellPathRefresher");var Y=z();function me(){return Y.
|
|
8
|
-
refresh()}l(me,"refreshHostShellPath");import{spawnSync as A}from"node:child_process";import{accessSync as q,constants as Z,statSync as Q}from"node:fs";import{delimiter as ee,dirname as ne,isAbsolute as C,join as f}from"node:path";var I="__PORTTA_FLOW_WHICH_START__",M="__PORTTA_FLOW_WHICH_END__",te=3e3,re=3e3,oe=/^[A-Za-z0-9._+-]+$/,le={codex:"CODEX_BIN",opencode:"OPENCODE_BIN",pi:"PI_BIN"};function se(e){try{return q(e,Z.X_OK),Q(e).isFile()}catch{return!1}}l(se,"defaultIsExecutableFile");function S(e,n){return e.find(t=>t.length>0&&n(t))??null}l(S,"firstExecutable");function U(e,n){return n?n.split(ee).filter(Boolean).map(t=>f(t,e)):[]}l(U,"pathCandidates");function B(e){let n=[],t=e.env.HOME?.trim();return t&&n.push(f(t,
|
|
9
|
-
".local","bin"),f(t,".cargo","bin"),f(t,".bun","bin"),f(t,".volta","bin"),f(t,".asdf","shims"),f(t,".local","share","mise","shims"),f(t,".npm-global","bin")),n.push(ne(e.execPath)),e.npmGlobalBin&&n.push(e.npmGlobalBin),n.push("/opt/homebrew/bin","/usr/local/bin"),e.platform==="linux"&&n.push("/home/linuxbrew/.linuxbrew/bin"),n}l(B,"wellKnownBinDirectories");function ie(e,n){let t=n.HOME?.trim();return e==="claude"&&t?[f(t,".claude","local","claude")]:[]}l(ie,"wellKnownToolPaths");function ue(e){
|
|
10
|
-
return[`printf '%s\\n' ${I}`,`command -v -- ${e}`,`printf '%s\\n' ${M}`].join("; ")}l(ue,"loginWhichCommand");function ae(e){let n=e.split(/\r?\n/u),t=n.findIndex(r=>r.trim()===I);if(t===-1)return null;let o=n.findIndex((r,s)=>s>t&&r.trim()===M);if(o===-1)return null;for(let r of n.slice(t+1,o)){let s=r.trim();if(s)return s}return null}l(ae,"pathFromWhichOutput");function y(e,n={}){if(!oe.test(e))return null;let t=n.env??process.env,o=n.platform??process.platform,r=P(t,o);if(!r)return null;for(let s of _(
|
|
11
|
-
r,ue(e))){let c=A(r,s,{env:t,encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:te});if(c.error||c.status!==0)continue;let i=ae(c.stdout??"");if(i&&(C(i)||i.includes("/")))return i}return null}l(y,"probeLoginShellWhich");function ce(e){let n=S(U("npm",e.env.PATH),e.isExecutable)??S(B({env:e.env,execPath:e.execPath,platform:e.platform}).map(r=>f(r,"npm")),e.isExecutable);if(!n)return null;let t=A(n,["prefix","-g"],{env:e.env,encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:re});if(t.error||
|
|
12
|
-
t.status!==0)return null;let o=(t.stdout??"").trim().split(/\r?\n/u)[0]?.trim();return o?f(o,"bin"):null}l(ce,"resolveNpmGlobalBin");function T(e={}){let n=e.env??process.env,t=e.platform??process.platform,o=e.execPath??process.execPath,r=e.isExecutable??se,s=e.lookupLoginShellCommand,c=e.npmGlobalBin!==void 0,i=e.npmGlobalBin;return h=>{let a=h.trim();if(!a)return null;if(C(a)||a.includes("/"))return r(a)?a:null;let d=le[a];if(d){let g=n[d]?.trim();if(g)return r(g)?g:null}let m=S(U(a,n.PATH),r);
|
|
13
|
-
if(m)return m;let u=s?.(a);if(u&&r(u))return u;!c&&i===void 0&&(i=ce({env:n,execPath:o,isExecutable:r,platform:t}));let p=B({env:n,execPath:o,npmGlobalBin:i,platform:t}).map(g=>f(g,a)),x=S(p,r);return x||S(ie(a,n),r)}}l(T,"createHostToolResolver");var R=new Map,L=null,w=null;function N(e){if(R.has(e))return R.get(e)??null;let n=y(e);return R.set(e,n),n}l(N,"defaultLookupLoginShellCommand");function fe(){return L??=T(),L}l(fe,"defaultHostToolResolver");function _e(e,n){return n?v(e,{...n,lookupLoginShellCommand:n.
|
|
14
|
-
lookupLoginShellCommand??N}):(w??=T({lookupLoginShellCommand:N}),w(e))}l(_e,"resolveHostToolThoroughly");function v(e,n){return n?T({...n,lookupLoginShellCommand:n.lookupLoginShellCommand??(t=>y(t,n))})(e):fe()(e)}l(v,"resolveHostTool");function Re(e,n){let t=v(e,n)??e;return/[\s'"\\]/.test(t)?`'${t.replaceAll("'","'\\''")}'`:t}l(Re,"hostToolInvocation");function Te(e=process.env){let n=l((t,o)=>{let r=o?.trim();return r?v(r,{env:e})??r:v(t,{env:e})??void 0},"resolve");return{codexBin:n("codex",
|
|
15
|
-
e.CODEX_BIN),opencodeBin:n("opencode",e.OPENCODE_BIN),pathToClaudeCodeExecutable:n("claude"),piBin:n("pi",e.PI_BIN)}}l(Te,"resolveWorkerBins");export{me as a,_e as b,v as c,Re as d,Te as e};
|
package/dist/chunk-EYT7VTYA.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as n}from"./chunk-6J5HN4ZN.js";var i=n(t=>`standard-openapi: ${t}`,"errorMessageWrapper"),s=new Map,r=n(async t=>{let e=s.get(t);if(e)return e;let a;switch(t){case"valibot":a=(await import("./valibot-D_HTw1Gn-QTR63R64.js")).default();break;case"zod":a=(await import("./zod-DSgpEGAE-5JBFOUHY.js")).default();break;default:a=(await import("./default-u_dwuiYb-OWTONHM6.js")).default()}return s.set(t,a),a},"getToOpenAPISchemaFn"),d=n(async(t,e={})=>{let a=await r(t["~standard"].vendor),{components:o={},options:c}=e;return{schema:await a(t,{components:o,
|
|
4
|
-
options:c}),components:Object.keys(o).length>0?o:void 0}},"toOpenAPISchema");export{i as a,d as b};
|