vibe64 0.1.47 → 0.1.49
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/bin/run.js +1734 -1687
- package/bin/server.js +75 -75
- package/bin/upgrade-state.js +4539 -4471
- package/dist/assets/GithubBrowserTabs-BwpiRS2u.js +1 -0
- package/dist/assets/{LocalDatabaseServer-6VzPWZxG.js → LocalDatabaseServer-u_Ky7bNS.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-TLwqAxDo.js → Vibe64AuthSettingsButton-BCwswT1G.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-B4dQ-oHD.js → Vibe64DashboardShell-CWlgrR2B.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-Bh5WIPOj.js → Vibe64DatabaseWorkspace-Dhs8_H0P.js} +1 -1
- package/dist/assets/Vibe64OutputControls-Dn548CZa.js +8 -0
- package/dist/assets/{Vibe64RepositoryWorkspace-idDg94lc.js → Vibe64RepositoryWorkspace-C-8S4JUF.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-Z9zxosyl.js → Vibe64SessionFiles-Cx6J7DDN.js} +2 -3
- package/dist/assets/{Vibe64UiStoryboardView-CrCDWMdR.js → Vibe64UiStoryboardView-DHyhJiWS.js} +1 -1
- package/dist/assets/{Vibe64UnavailableSessions-TqsxvGSf.js → Vibe64UnavailableSessions-Da4RxIhA.js} +1 -1
- package/dist/assets/{_sessionId_-7F1VGOou.js → _sessionId_-DCpgDPSI.js} +1 -1
- package/dist/assets/_slug_-BbEWp01a.js +25 -0
- package/dist/assets/{_slug_-B16mTWjj.css → _slug_-DerKOisL.css} +1 -1
- package/dist/assets/{access-Cx9RH95J.js → access-D4di2sCr.js} +1 -1
- package/dist/assets/{app-DPx4KKOa.js → app-Adr9Iz8p.js} +1 -1
- package/dist/assets/asyncModuleRecovery-DJsn5NrL.js +1 -0
- package/dist/assets/{changes-DYsuQLFW.js → changes-3Dd1O8Lu.js} +1 -1
- package/dist/assets/client-BAXHGUOC.js +1 -0
- package/dist/assets/{client-BYsDPxR3.js → client-CCZIu6yc.js} +1 -1
- package/dist/assets/{conversation-3ln-WnbL.css → conversation-CSDHdGDb.css} +1 -1
- package/dist/assets/conversation-DG9lp25w.js +8 -0
- package/dist/assets/conversation-ErAO1CmH.js +13 -0
- package/dist/assets/{dashboard-CWswAbYP.js → dashboard-0tCzDYCX.js} +1 -1
- package/dist/assets/english-definitions-DeiQ-jTT.js +1 -0
- package/dist/assets/env-DsyQ2MFX.js +1 -0
- package/dist/assets/{health-C0f6s-G1.js → health-DyTXU-nb.js} +1 -1
- package/dist/assets/{history-BQjETNB9.js → history-BXGAdPMI.js} +1 -1
- package/dist/assets/{incoming-COpY201m.js → incoming-yajkdGBY.js} +1 -1
- package/dist/assets/{index-MWACm8Pp.css → index-B-dukXUB.css} +1 -1
- package/dist/assets/index-CGz4Yow6.js +136 -0
- package/dist/assets/{integrations-BBkvNRHu.js → integrations-BMrXET36.js} +10 -2
- package/dist/assets/issues-kc1XBZCK.js +1 -0
- package/dist/assets/{learning-B8_wHoe1.js → learning-CIE5ghYv.js} +1 -1
- package/dist/assets/linkPath-Ch9eft18.js +1 -0
- package/dist/assets/{placement-DXvgK433.js → placement-BNmlke_j.js} +1 -1
- package/dist/assets/placement-DYM3JJ-F.js +1 -0
- package/dist/assets/publish-DTh6amqi.js +3 -0
- package/dist/assets/pull-requests-CbfGSSIh.js +1 -0
- package/dist/assets/{repository-BNPt7UWc.js → repository-BstMh-bG.js} +1 -1
- package/dist/assets/settings-Bf8C6dls.js +1 -0
- package/dist/assets/{studioGateApi-BVdclhPL.js → studioGateApi-mkX1eOTX.js} +1 -1
- package/dist/assets/{studioUrls-CGKCbM_d.js → studioUrls-B0-GdWh8.js} +1 -1
- package/dist/assets/useArchivedVibe64Sessions-DIOpfUxD.js +1 -0
- package/dist/assets/useCommand-CVuya6vG.js +1 -0
- package/dist/assets/useEndpointResource-7-YDfAxX.js +1 -0
- package/dist/assets/usePaths-Y6UuQxmI.js +1 -0
- package/dist/assets/{useUiFeedback-B51xtCAK.js → useUiFeedback-Bd3rao6E.js} +1 -1
- package/dist/assets/useVibe64ConversationLog-ChJOU2SD.js +1 -0
- package/dist/assets/{useVibe64DatabaseTools-BE_yXZFn.js → useVibe64DatabaseTools-DKV-TeNJ.js} +1 -1
- package/dist/assets/{useVibe64ProjectScope-D7b8n1gx.js → useVibe64ProjectScope-DXjsKKhl.js} +1 -1
- package/dist/assets/useVibe64SessionData-BkIHUrP5.js +1 -0
- package/dist/assets/useVibe64SessionSelection-N8wX5oqo.js +1 -0
- package/dist/assets/{useVibe64SystemGraph-CDDcsye4.js → useVibe64SystemGraph-Db_eD-X8.js} +1 -1
- package/dist/assets/{useVibe64Terminal-Zr3Mig2L.js → useVibe64Terminal-B9EWJ9Ba.js} +2 -2
- package/dist/assets/vibe64ProjectScope.local-l5_-E6pq.js +1 -0
- package/dist/assets/vibe64RepositoryRealtime-CHT4-6VN.js +1 -0
- package/dist/assets/vibe64SessionFocus-CS6Ex53G.js +1 -0
- package/dist/assets/vibe64SessionFocus-CSm4YJQD.css +1 -0
- package/dist/assets/vibe64SessionRequestConfig-xIx-5jxQ.js +1 -0
- package/dist/index.html +26 -22
- package/docs/colleague-usage/ai-accounts.md +6 -2
- package/docs/colleague-usage/ai-balance-and-allowance.md +15 -2
- package/docs/colleague-usage/coding-agent-failures.md +2 -1
- package/docs/colleague-usage/coding-agent-goals.md +8 -3
- package/docs/colleague-usage/coding-agents.md +16 -0
- package/docs/colleague-usage/github-work.md +14 -0
- package/docs/colleague-usage/preview-browser-checks.md +5 -3
- package/docs/colleague-usage/project-setup.md +6 -3
- package/docs/colleague-usage/running-vibe64-on-your-computer.md +3 -1
- package/docs/colleague-usage/sessions.md +35 -7
- package/docs/colleague-usage/starter-apps.md +3 -0
- package/docs/colleague-usage/temporary-chat-context.md +2 -1
- package/docs/colleague-usage/temporary-chats.md +17 -5
- package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +539 -0
- package/node_modules/@jskit-ai/assistant-core/locales/en.json +383 -0
- package/node_modules/@jskit-ai/assistant-core/package.json +3 -2
- package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +138 -0
- package/node_modules/@jskit-ai/assistant-runtime/README.md +2 -1
- package/node_modules/@jskit-ai/assistant-runtime/locales/en.json +137 -0
- package/node_modules/@jskit-ai/assistant-runtime/package.json +3 -2
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/assistantConfigRepository.js +223 -203
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/conversationsRepository.js +286 -266
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/messagesRepository.js +270 -250
- package/node_modules/@jskit-ai/assistant-voice/locales/en.json +182 -0
- package/node_modules/@jskit-ai/assistant-voice/package.json +3 -2
- package/node_modules/@jskit-ai/connector-google-calendar/CHANGELOG.md +83 -0
- package/node_modules/@jskit-ai/connector-google-calendar/locales/en.json +91 -0
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +4 -3
- package/node_modules/@jskit-ai/connectors-catalog/CHANGELOG.md +1722 -0
- package/node_modules/@jskit-ai/connectors-catalog/README.md +11 -0
- package/node_modules/@jskit-ai/connectors-catalog/locales/en.json +3139 -0
- package/node_modules/@jskit-ai/connectors-catalog/package.json +5 -4
- package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +183 -0
- package/node_modules/@jskit-ai/connectors-core/locales/en.json +92 -0
- package/node_modules/@jskit-ai/connectors-core/package.json +3 -2
- package/node_modules/@jskit-ai/http-runtime/CHANGELOG.md +31 -0
- package/node_modules/@jskit-ai/http-runtime/locales/en.json +14 -0
- package/node_modules/@jskit-ai/http-runtime/package.json +3 -2
- package/node_modules/@jskit-ai/kernel/CHANGELOG.md +182 -0
- package/node_modules/@jskit-ai/kernel/locales/en.json +94 -0
- package/node_modules/@jskit-ai/kernel/package.json +6 -2
- package/node_modules/@jskit-ai/payments-core/CHANGELOG.md +128 -0
- package/node_modules/@jskit-ai/payments-core/locales/en.json +77 -0
- package/node_modules/@jskit-ai/payments-core/package.json +3 -2
- package/node_modules/@jskit-ai/realtime/CHANGELOG.md +20 -0
- package/node_modules/@jskit-ai/realtime/locales/en.json +14 -0
- package/node_modules/@jskit-ai/realtime/package.json +3 -2
- package/node_modules/@jskit-ai/resource-core/package.json +1 -1
- package/node_modules/@jskit-ai/resource-crud-core/package.json +1 -1
- package/node_modules/@jskit-ai/uploads-runtime/CHANGELOG.md +35 -0
- package/node_modules/@jskit-ai/uploads-runtime/locales/en.json +15 -0
- package/node_modules/@jskit-ai/uploads-runtime/package.json +3 -2
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +49 -48
- package/node_modules/@local/vibe64-execution/src/server/gitTurnCheckpointCommand.js +1327 -0
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +430 -390
- package/node_modules/@local/vibe64-genesis/src/server/index.js +45 -45
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +119 -119
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +57 -57
- package/node_modules/@local/vibe64-sessions/package.json +2 -1
- package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +195 -175
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1385 -1362
- package/package.json +15 -15
- package/server.bundle.mjs +44206 -42825
- package/dist/assets/GithubBrowserTabs-D-Z3TlA8.js +0 -1
- package/dist/assets/Vibe64OutputControls-DtybwgL3.js +0 -8
- package/dist/assets/_slug_-Bq84T_Iv.js +0 -24
- package/dist/assets/conversation-Bn7wpATa.js +0 -2
- package/dist/assets/conversation-CNcCrV-R.js +0 -16
- package/dist/assets/definitions-CEbi4qae.js +0 -1
- package/dist/assets/env-X7EOFLtl.js +0 -1
- package/dist/assets/index-CBo1BEk6.js +0 -138
- package/dist/assets/issues-BiSiUd5o.js +0 -1
- package/dist/assets/placement-B5T1LR7m.js +0 -1
- package/dist/assets/publish-CeLZE2AG.js +0 -3
- package/dist/assets/pull-requests-pTdQOT7i.js +0 -1
- package/dist/assets/settings-lecRzZ-r.js +0 -1
- package/dist/assets/useArchivedVibe64Sessions-DHYRnyJD.js +0 -1
- package/dist/assets/useCommand-Epd2yHhQ.js +0 -1
- package/dist/assets/useEndpointResource-DBRQISI_.js +0 -1
- package/dist/assets/usePaths-DdAnjVDj.js +0 -1
- package/dist/assets/useVibe64ConversationLog-DboM3tYN.js +0 -1
- package/dist/assets/useVibe64SessionData-CreWtQAO.js +0 -1
- package/dist/assets/useVibe64SessionSelection-CDaX4uwY.js +0 -1
- package/dist/assets/vibe64ProjectScope.local-BxTBYuRg.js +0 -1
- package/dist/assets/vibe64RepositoryRealtime-C-J0I5jY.js +0 -1
- package/dist/assets/vibe64SessionFocus-DSW5Irm6.css +0 -1
- package/dist/assets/vibe64SessionFocus-DzqbVq60.js +0 -1
|
@@ -1,125 +1,125 @@
|
|
|
1
1
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
2
|
-
var
|
|
3
|
-
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var K=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var
|
|
4
|
-
enumerable:!(n=
|
|
2
|
+
var Sf=Object.create;var Hs=Object.defineProperty;var Ef=Object.getOwnPropertyDescriptor;var vf=Object.getOwnPropertyNames;var Tf=Object.getPrototypeOf,If=Object.prototype.hasOwnProperty;var Ae=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){
|
|
3
|
+
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var K=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Af=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vf(t))!If.call(e,o)&&o!==r&&Hs(e,o,{get:()=>t[o],
|
|
4
|
+
enumerable:!(n=Ef(t,o))||n.enumerable});return e};var Rf=(e,t,r)=>(r=e!=null?Sf(Tf(e)):{},Af(t||!e||!e.__esModule?Hs(r,"default",{value:e,enumerable:!0}):r,e));var Ta=K((jR,va)=>{va.exports=Ea;Ea.sync=$h;var _a=Ae("fs");function Mh(e,t){var r=t.pathExt!==void 0?t.pathExt:process.
|
|
5
5
|
env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&
|
|
6
|
-
e.substr(-o.length).toLowerCase()===o)return!0}return!1}function
|
|
7
|
-
t,r)}function
|
|
8
|
-
function
|
|
6
|
+
e.substr(-o.length).toLowerCase()===o)return!0}return!1}function Sa(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Mh(
|
|
7
|
+
t,r)}function Ea(e,t,r){_a.stat(e,function(n,o){r(n,n?!1:Sa(o,e,t))})}function $h(e,t){return Sa(_a.statSync(e),e,t)}});var Ca=K((VR,Oa)=>{Oa.exports=Aa;Aa.sync=Dh;var Ia=Ae("fs");function Aa(e,t,r){Ia.stat(e,function(n,o){r(n,n?!1:Ra(o,t))})}
|
|
8
|
+
function Dh(e,t){return Ra(Ia.statSync(e),t)}function Ra(e,t){return e.isFile()&&Lh(e,t)}function Lh(e,t){var r=e.mode,n=e.
|
|
9
9
|
uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),
|
|
10
|
-
a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,d=r&u||r&c&&o===s||r&a&&n===i||r&l&&i===0;return d}});var
|
|
11
|
-
sync=
|
|
12
|
-
llback not provided");return new Promise(function(n,o){
|
|
13
|
-
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function
|
|
14
|
-
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var
|
|
15
|
-
|
|
16
|
-
match(/\//)||
|
|
17
|
-
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=
|
|
18
|
-
""),{pathEnv:n,pathExt:i,pathExtExe:o}},
|
|
19
|
-
pathExtExe:i}
|
|
20
|
-
test(
|
|
21
|
-
if(d===o.length)return
|
|
22
|
-
return
|
|
23
|
-
e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=
|
|
24
|
-
e)?e.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let
|
|
25
|
-
if(t.all&&i.length)return i;if(t.nothrow)return null;throw
|
|
26
|
-
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};
|
|
10
|
+
a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,d=r&u||r&c&&o===s||r&a&&n===i||r&l&&i===0;return d}});var xa=K((WR,Pa)=>{var zR=Ae("fs"),kr;process.platform==="win32"||global.TESTING_WINDOWS?kr=Ta():kr=Ca();Pa.exports=Ao;Ao.
|
|
11
|
+
sync=Uh;function Ao(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("ca\
|
|
12
|
+
llback not provided");return new Promise(function(n,o){Ao(e,t||{},function(i,s){i?o(i):n(s)})})}kr(e,t||{},function(n,o){
|
|
13
|
+
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function Uh(e,t){try{return kr.sync(e,t||{})}catch(r){
|
|
14
|
+
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Ua=K((qR,La)=>{var st=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ka=Ae("path"),
|
|
15
|
+
Bh=st?";":":",Na=xa(),Ma=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),$a=(e,t)=>{let r=t.colon||Bh,n=e.
|
|
16
|
+
match(/\//)||st&&e.match(/\\/)?[""]:[...st?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=st?t.pathExt||
|
|
17
|
+
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=st?o.split(r):[""];return st&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(
|
|
18
|
+
""),{pathEnv:n,pathExt:i,pathExtExe:o}},Da=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,
|
|
19
|
+
pathExtExe:i}=$a(e,t),s=[],a=u=>new Promise((l,d)=>{if(u===n.length)return t.all&&s.length?l(s):d(Ma(e));let p=n[u],m=/^".*"$/.
|
|
20
|
+
test(p)?p.slice(1,-1):p,f=ka.join(m,e),h=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;l(c(h,u,0))}),c=(u,l,d)=>new Promise((p,m)=>{
|
|
21
|
+
if(d===o.length)return p(a(l+1));let f=o[d];Na(u+f,{pathExt:i},(h,b)=>{if(!h&&b)if(t.all)s.push(u+f);else return p(u+f);
|
|
22
|
+
return p(c(u,l,d+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},Gh=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=$a(
|
|
23
|
+
e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=ka.join(c,e),l=!c&&/^\.[\\\/]/.test(
|
|
24
|
+
e)?e.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let p=l+n[d];try{if(Na.sync(p,{pathExt:o}))if(t.all)i.push(p);else return p}catch{}}}
|
|
25
|
+
if(t.all&&i.length)return i;if(t.nothrow)return null;throw Ma(e)};La.exports=Da;Da.sync=Gh});var Ga=K((YR,Ro)=>{"use strict";var Ba=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?
|
|
26
|
+
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Ro.exports=Ba;Ro.exports.default=Ba});var Va=K((KR,ja)=>{"use strict";var Ha=Ae("path"),Hh=Ua(),Fh=Ga();function Fa(e,t){let r=e.options.env||process.env,n=process.
|
|
27
27
|
cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}
|
|
28
|
-
let s;try{s=
|
|
29
|
-
(s=
|
|
30
|
-
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(
|
|
31
|
-
"^$1"),t&&(e=e.replace(
|
|
32
|
-
/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
e.file),e.command=t,
|
|
36
|
-
test(t);e.command=
|
|
28
|
+
let s;try{s=Hh.sync(e.command,{path:r[Fh({env:r})],pathExt:t?Ha.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&
|
|
29
|
+
(s=Ha.resolve(o?e.options.cwd:"",s)),s}function jh(e){return Fa(e)||Fa(e,!0)}ja.exports=jh});var za=K((JR,Co)=>{"use strict";var Oo=/([()\][%!^"`<>&|;, *?])/g;function Vh(e){return e=e.replace(Oo,"^$1"),e}function zh(e,t){
|
|
30
|
+
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Oo,
|
|
31
|
+
"^$1"),t&&(e=e.replace(Oo,"^$1")),e}Co.exports.command=Vh;Co.exports.argument=zh});var qa=K((XR,Wa)=>{"use strict";Wa.exports=/^#!(.*)/});var Ka=K((ZR,Ya)=>{"use strict";var Wh=qa();Ya.exports=(e="")=>{let t=e.match(Wh);if(!t)return null;let[r,n]=t[0].replace(
|
|
32
|
+
/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Xa=K((QR,Ja)=>{"use strict";var Po=Ae("fs"),qh=Ka();function Yh(e){let r=Buffer.alloc(150),n;try{n=Po.openSync(e,"r"),
|
|
33
|
+
Po.readSync(n,r,0,150,0),Po.closeSync(n)}catch{}return qh(r.toString())}Ja.exports=Yh});var tc=K((eO,ec)=>{"use strict";var Kh=Ae("path"),Za=Va(),Qa=za(),Jh=Xa(),Xh=process.platform==="win32",Zh=/\.(?:com|exe)$/i,
|
|
34
|
+
Qh=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function eg(e){e.file=Za(e);let t=e.file&&Jh(e.file);return t?(e.args.unshift(
|
|
35
|
+
e.file),e.command=t,Za(e)):e.file}function tg(e){if(!Xh)return e;let t=eg(e),r=!Zh.test(t);if(e.options.forceShell||r){let n=Qh.
|
|
36
|
+
test(t);e.command=Kh.normalize(e.command),e.command=Qa.command(e.command),e.args=e.args.map(i=>Qa.argument(i,n));let o=[
|
|
37
37
|
e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.
|
|
38
|
-
windowsVerbatimArguments=!0}return e}function
|
|
39
|
-
{},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n
|
|
40
|
-
command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function
|
|
41
|
-
if(!
|
|
42
|
-
e,arguments)}}function
|
|
43
|
-
!t.file?
|
|
44
|
-
n.command,n.args,n.options);return
|
|
45
|
-
n.args,n.options);return o.error=o.error||
|
|
46
|
-
sync=
|
|
47
|
-
import{promisify as
|
|
38
|
+
windowsVerbatimArguments=!0}return e}function rg(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign(
|
|
39
|
+
{},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:tg(n)}ec.exports=rg});var oc=K((tO,nc)=>{"use strict";var xo=process.platform==="win32";function ko(e,t){return Object.assign(new Error(`${t} ${e.
|
|
40
|
+
command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ng(e,t){
|
|
41
|
+
if(!xo)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=rc(o,t);if(i)return r.call(e,"error",i)}return r.apply(
|
|
42
|
+
e,arguments)}}function rc(e,t){return xo&&e===1&&!t.file?ko(t.original,"spawn"):null}function og(e,t){return xo&&e===1&&
|
|
43
|
+
!t.file?ko(t.original,"spawnSync"):null}nc.exports={hookChildProcess:ng,verifyENOENT:rc,verifyENOENTSync:og,notFoundError:ko}});var ac=K((rO,at)=>{"use strict";var ic=Ae("child_process"),No=tc(),Mo=oc();function sc(e,t,r){let n=No(e,t,r),o=ic.spawn(
|
|
44
|
+
n.command,n.args,n.options);return Mo.hookChildProcess(o,n),o}function ig(e,t,r){let n=No(e,t,r),o=ic.spawnSync(n.command,
|
|
45
|
+
n.args,n.options);return o.error=o.error||Mo.verifyENOENTSync(o.status,n),o}at.exports=sc;at.exports.spawn=sc;at.exports.
|
|
46
|
+
sync=ig;at.exports._parse=No;at.exports._enoent=Mo});import{existsSync as wI}from"node:fs";import yI from"node:path";import{execFile as Of}from"node:child_process";import{readFile as Cf}from"node:fs/promises";import lo from"node:os";import Pf from"node:path";
|
|
47
|
+
import{promisify as xf}from"node:util";var kf=xf(Of);function br(e=""){return String(e||"").trim()}function js(e=""){let t=br(e);if(!t||t.includes("/")||t.includes("\\")||t.
|
|
48
48
|
includes(":")){let r=new Error("A valid OS username is required.");throw r.code="vibe64_invalid_os_username",r}return t}
|
|
49
|
-
function
|
|
49
|
+
function Vs([e,t,r,n,o,i]=[]){if(!/^\d+$/u.test(t)||!/^\d+$/u.test(r))return null;let s=Number(t),a=Number(r);return!Number.
|
|
50
50
|
isSafeInteger(s)||!Number.isSafeInteger(a)?null:{displayName:String(n||"").split(",")[0],gid:a,home:String(o||""),shell:String(
|
|
51
|
-
i||""),uid:s,username:String(e||"")}}function
|
|
52
|
-
t[0],t[2],t[3],t[4],t[5],t[6]])}function
|
|
53
|
-
split(/\r?\n/u)){let o=/^\s*([a-z]+):\s?(.*)$/u.exec(n);o&&(r[o[1]]=o[2].trim())}return
|
|
54
|
-
dir,r.shell])}).filter(Boolean)}async function
|
|
55
|
-
string"?n:n?.stdout)||"")}function
|
|
56
|
-
n=
|
|
51
|
+
i||""),uid:s,username:String(e||"")}}function uo(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:Vs([
|
|
52
|
+
t[0],t[2],t[3],t[4],t[5],t[6]])}function Nf(e=""){return String(e||"").split(/\r?\n[\t ]*\r?\n/u).map(t=>{let r={};for(let n of t.
|
|
53
|
+
split(/\r?\n/u)){let o=/^\s*([a-z]+):\s?(.*)$/u.exec(n);o&&(r[o[1]]=o[2].trim())}return Vs([r.name,r.uid,r.gid,r.gecos,r.
|
|
54
|
+
dir,r.shell])}).filter(Boolean)}async function Fs(e,t,r){let n=await e(t,r,{encoding:"utf8"});return String((typeof n=="\
|
|
55
|
+
string"?n:n?.stdout)||"")}function Mt({homedir:e=lo.homedir,userInfo:t=lo.userInfo}={}){let r=typeof t=="function"?t():{},
|
|
56
|
+
n=br(r?.username||process.env.USER||process.env.LOGNAME),o=Pf.resolve(String(r?.homedir||e()||""));return{displayName:String(
|
|
57
57
|
r?.username||n),gid:Number.isSafeInteger(r?.gid)?r.gid:null,home:o,shell:String(r?.shell||""),uid:Number.isSafeInteger(r?.
|
|
58
|
-
uid)?r.uid:null,username:n}}async function
|
|
59
|
-
userInfo}={}){let i=
|
|
58
|
+
uid)?r.uid:null,username:n}}async function wr(e="",{execFileFn:t=kf,platform:r=process.platform,readFileFn:n=Cf,userInfo:o=lo.
|
|
59
|
+
userInfo}={}){let i=js(e);if(r==="linux"&&!/^\d+$/u.test(i)){let c=[...(await n("/etc/nsswitch.conf","utf8").catch(()=>"")).
|
|
60
60
|
matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*)/gmu)],u=c.length===1?c[0][1].trim().split(/\s+/u):[];if(u[0]==="files"&&
|
|
61
61
|
(u.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(u[1]))){let d=(await n("/etc/passwd","utf8").catch(()=>"")).split(/\r?\n/u).
|
|
62
|
-
map(
|
|
63
|
-
[s]=
|
|
64
|
-
if(!s||s.username!==i){let a=new Error(`OS user was not found: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}import
|
|
65
|
-
isSafeInteger(t)&&t>=0?t:null}function P(e=""){let t=C(e);return t?
|
|
66
|
-
t);if(!r||!n)return!1;let o=
|
|
62
|
+
map(uo).find(p=>p?.username===i);if(d)return d}}let s;if(r==="darwin"){let a=Mt({userInfo:o});if(a.username===i)return a;
|
|
63
|
+
[s]=Nf(await Fs(t,"dscacheutil",["-q","user","-a","name",i]))}else s=uo((await Fs(t,"getent",["passwd",i])).split(/\r?\n/u)[0]);
|
|
64
|
+
if(!s||s.username!==i){let a=new Error(`OS user was not found: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}import Mf from"node:os";import mo from"node:path";import yr from"node:path";function C(e=""){return String(e??"").trim()}function po(e=null){let t=Number(e);return Number.
|
|
65
|
+
isSafeInteger(t)&&t>=0?t:null}function P(e=""){let t=C(e);return t?yr.resolve(t):""}function Re(e="",t=""){let r=P(e),n=P(
|
|
66
|
+
t);if(!r||!n)return!1;let o=yr.relative(r,n);return o!==".."&&!o.startsWith(`..${yr.sep}`)&&!yr.isAbsolute(o)}function B(e={}){
|
|
67
67
|
return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Z(e={}){return Object.fromEntries(Object.entries(B(e)).map(
|
|
68
|
-
([t,r])=>[C(t),String(r??"")]).filter(([t])=>!!t))}function
|
|
69
|
-
[e]){let o=C(n);!o||r.has(o)||(r.add(o),t.push(o))}return t}function we(...e){for(let t of e){let r=C(t);if(r)return r}return""}function
|
|
70
|
-
gid:
|
|
71
|
-
return
|
|
72
|
-
join(r.home,".cache"),XDG_CONFIG_HOME:
|
|
68
|
+
([t,r])=>[C(t),String(r??"")]).filter(([t])=>!!t))}function Fe(e=[]){let t=[],r=new Set;for(let n of Array.isArray(e)?e:
|
|
69
|
+
[e]){let o=C(n);!o||r.has(o)||(r.add(o),t.push(o))}return t}function we(...e){for(let t of e){let r=C(t);if(r)return r}return""}function fo(e={}){let t=C(e.username),r=P(e.home||(t?`/home/${t}`:Mf.homedir()));return{displayName:C(e.displayName||t),
|
|
70
|
+
gid:po(e.gid),home:r,shell:C(e.shell),uid:po(e.uid),username:t}}function ho(){return fo(Mt())}async function zs(e="",t={}){
|
|
71
|
+
return fo(await wr(e,t))}function $t(e={},t={}){let r=fo(e);return{...t,HOME:r.home,LOGNAME:r.username,USER:r.username,XDG_CACHE_HOME:mo.
|
|
72
|
+
join(r.home,".cache"),XDG_CONFIG_HOME:mo.join(r.home,".config"),XDG_DATA_HOME:mo.join(r.home,".local","share")}}function Ws(){
|
|
73
73
|
return{gid:typeof process.getgid=="function"?process.getgid():null,uid:typeof process.getuid=="function"?process.getuid():
|
|
74
74
|
null}}function D(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||
|
|
75
|
-
Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}import{fileURLToPath as
|
|
76
|
-
must be a string or a file URL: ${r}.`);return r},
|
|
77
|
-
e)===String.prototype,
|
|
75
|
+
Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}import{fileURLToPath as $f}from"node:url";var nt=(e,t)=>{let r=bo(Df(e));if(typeof r!="string")throw new TypeError(`${t}\
|
|
76
|
+
must be a string or a file URL: ${r}.`);return r},Df=e=>go(e)?e.toString():e,go=e=>typeof e!="string"&&e&&Object.getPrototypeOf(
|
|
77
|
+
e)===String.prototype,bo=e=>e instanceof URL?$f(e):e;var _r=(e,t=[],r={})=>{let n=nt(e,"First argument"),[o,i]=D(t)?[[],t]:[t,r];if(!Array.isArray(o))throw new TypeError(`Se\
|
|
78
78
|
cond argument must be either an array of arguments or an options object: ${o}`);if(o.some(c=>typeof c=="object"&&c!==null))
|
|
79
79
|
throw new TypeError(`Second argument must be an array of strings: ${o}`);let s=o.map(String),a=s.find(c=>c.includes("\0"));
|
|
80
80
|
if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!D(i))throw new TypeError(`Las\
|
|
81
|
-
t argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as
|
|
82
|
-
Buffer]",L=e=>
|
|
83
|
-
|
|
84
|
-
"string"))return e;let r=new
|
|
85
|
-
...n,o]}
|
|
86
|
-
|
|
81
|
+
t argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as jf}from"node:child_process";import{StringDecoder as Lf}from"node:string_decoder";var{toString:qs}=Object.prototype,Ys=e=>qs.call(e)==="[object Array\
|
|
82
|
+
Buffer]",L=e=>qs.call(e)==="[object Uint8Array]",ye=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Uf=new TextEncoder,
|
|
83
|
+
Ks=e=>Uf.encode(e),Bf=new TextDecoder,Sr=e=>Bf.decode(e),Js=(e,t)=>Gf(e,t).join(""),Gf=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i==
|
|
84
|
+
"string"))return e;let r=new Lf(t),n=e.map(i=>typeof i=="string"?Ks(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[
|
|
85
|
+
...n,o]},Dt=e=>e.length===1&&L(e[0])?e[0]:wo(Hf(e)),Hf=e=>e.map(t=>typeof t=="string"?Ks(t):t),wo=e=>{let t=new Uint8Array(
|
|
86
|
+
Ff(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},Ff=e=>{let t=0;for(let r of e)t+=r.length;return t};var ea=e=>Array.isArray(e)&&Array.isArray(e.raw),ta=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=Vf({templates:e,expressions:t,
|
|
87
87
|
tokens:r,index:i,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[
|
|
88
|
-
n,o,{}]},
|
|
89
|
-
lash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=
|
|
90
|
-
t.length)return c;let u=t[n],l=Array.isArray(u)?u.map(d=>
|
|
91
|
-
nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=
|
|
92
|
-
a+=1){let c=t[a];if(
|
|
93
|
-
`?(s-=1,a+=1):u==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=
|
|
94
|
-
leadingWhitespaces:o,trailingWhitespaces:i}},
|
|
95
|
-
`]),
|
|
96
|
-
1)],
|
|
97
|
-
e))return
|
|
88
|
+
n,o,{}]},Vf=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backs\
|
|
89
|
+
lash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=zf(o,e.raw[n]),c=Zs(r,i,s);if(n===
|
|
90
|
+
t.length)return c;let u=t[n],l=Array.isArray(u)?u.map(d=>Qs(d)):[Qs(u)];return Zs(c,l,a)},zf=(e,t)=>{if(t.length===0)return{
|
|
91
|
+
nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=Xs.has(t[0]);for(let s=0,a=0;s<e.length;s+=1,
|
|
92
|
+
a+=1){let c=t[a];if(Xs.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"){let u=t[a+1];u===`
|
|
93
|
+
`?(s-=1,a+=1):u==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=Wf[u]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,
|
|
94
|
+
leadingWhitespaces:o,trailingWhitespaces:i}},Xs=new Set([" "," ","\r",`
|
|
95
|
+
`]),Wf={x:3,u:5},Zs=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(
|
|
96
|
+
1)],Qs=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(D(e)&&("stdout"in e||"isMaxBuffer"in
|
|
97
|
+
e))return qf(e);throw e instanceof jf||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected \
|
|
98
98
|
subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected \
|
|
99
|
-
"${t}" in template expression`)},
|
|
99
|
+
"${t}" in template expression`)},qf=({stdout:e})=>{if(typeof e=="string")return e;if(L(e))return Sr(e);throw e===void 0?
|
|
100
100
|
new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" o\
|
|
101
|
-
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as
|
|
102
|
-
`stdio[${e}]`;var
|
|
103
|
-
t);return
|
|
104
|
-
e),
|
|
105
|
-
-1,
|
|
101
|
+
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as Xy}from"node:child_process";import{debuglog as Yf}from"node:util";import yo from"node:process";var oe=e=>Er.includes(e),Er=[yo.stdin,yo.stdout,yo.stderr],Q=["stdin","stdout","stderr"],vr=e=>Q[e]??
|
|
102
|
+
`stdio[${e}]`;var na=e=>{let t={...e};for(let r of Eo)t[r]=_o(e,r);return t},_o=(e,t)=>{let r=Array.from({length:Kf(e)+1}),n=Jf(e[t],r,
|
|
103
|
+
t);return th(n,t)},Kf=({stdio:e})=>Array.isArray(e)?Math.max(e.length,Q.length):Q.length,Jf=(e,t,r)=>D(e)?Xf(e,t,r):t.fill(
|
|
104
|
+
e),Xf=(e,t,r)=>{for(let n of Object.keys(e).sort(Zf))for(let o of Qf(n,r,t))t[o]=e[n];return t},Zf=(e,t)=>ra(e)<ra(t)?1:
|
|
105
|
+
-1,ra=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,Qf=(e,t,r)=>{if(e==="ipc")return[r.length-1];let n=So(e);if(n===void 0||
|
|
106
106
|
n===0)throw new TypeError(`"${t}.${e}" is invalid.
|
|
107
107
|
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(n>=r.length)
|
|
108
108
|
throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
109
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},
|
|
110
|
-
if(Q.includes(e))return Q.indexOf(e);let t=
|
|
111
|
-
void 0?
|
|
112
|
-
|
|
113
|
-
e,t);return
|
|
114
|
-
"function",
|
|
115
|
-
n=r.join(" "),o=r.map(i=>
|
|
116
|
-
`).map(t=>
|
|
117
|
-
`),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,
|
|
109
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},So=e=>{if(e==="all")return e;
|
|
110
|
+
if(Q.includes(e))return Q.indexOf(e);let t=eh.exec(e);if(t!==null)return Number(t[1])},eh=/^fd(\d+)$/,th=(e,t)=>e.map(r=>r===
|
|
111
|
+
void 0?nh[t]:r),rh=Yf("execa").enabled?"full":"none",nh={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:rh,stripFinalNewline:!0},
|
|
112
|
+
Eo=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],_e=(e,t)=>t==="ipc"?e.at(-1):e[t];var ot=({verbose:e},t)=>vo(e,t)!=="none",it=({verbose:e},t)=>!["none","short"].includes(vo(e,t)),oa=({verbose:e},t)=>{let r=vo(
|
|
113
|
+
e,t);return Tr(r)?r:void 0},vo=(e,t)=>t===void 0?oh(e):_e(e,t),oh=e=>e.find(t=>Tr(t))??Ir.findLast(t=>e.includes(t)),Tr=e=>typeof e==
|
|
114
|
+
"function",Ir=["none","short","full"];import{inspect as Ah}from"node:util";import{platform as ih}from"node:process";import{stripVTControlCharacters as sh}from"node:util";var ia=(e,t)=>{let r=[e,...t],
|
|
115
|
+
n=r.join(" "),o=r.map(i=>ph(sa(i))).join(" ");return{command:n,escapedCommand:o}},Lt=e=>sh(e).split(`
|
|
116
|
+
`).map(t=>sa(t)).join(`
|
|
117
|
+
`),sa=e=>e.replaceAll(lh,t=>ah(t)),ah=e=>{let t=uh[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=
|
|
118
|
+
dh?`\\u${n.padStart(4,"0")}`:`\\U${n}`},ch=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},
|
|
119
|
+
lh=ch(),uh={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},dh=65535,ph=e=>mh.test(e)?e:ih==="win32"?`"${e.
|
|
120
|
+
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,mh=/^[\w./-]+$/;import aa from"node:process";function To(){let{env:e}=aa,{TERM:t,TERM_PROGRAM:r}=e;return aa.platform!=="win32"?t!=="lin\
|
|
121
121
|
ux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xter\
|
|
122
|
-
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var
|
|
122
|
+
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ca={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",
|
|
123
123
|
squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\
|
|
124
124
|
\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",
|
|
125
125
|
triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\
|
|
@@ -159,55 +159,55 @@ lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUp
|
|
|
159
159
|
lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\
|
|
160
160
|
\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\
|
|
161
161
|
\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\
|
|
162
|
-
\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},
|
|
162
|
+
\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},la={tick:"\
|
|
163
163
|
\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\
|
|
164
164
|
\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\
|
|
165
165
|
\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",
|
|
166
166
|
pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\
|
|
167
167
|
\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",
|
|
168
|
-
oneNinth:"\u2151",oneTenth:"\u2152"},
|
|
168
|
+
oneNinth:"\u2151",oneTenth:"\u2152"},fh={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\
|
|
169
169
|
\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",
|
|
170
170
|
circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"\
|
|
171
171
|
( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\
|
|
172
172
|
\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"\
|
|
173
|
-
1/7",oneNinth:"1/9",oneTenth:"1/10"},
|
|
173
|
+
1/7",oneNinth:"1/9",oneTenth:"1/10"},hh={...ca,...la},gh={...ca,...fh},bh=To(),wh=bh?hh:gh,Ar=wh,mA=Object.entries(la);import yh from"node:tty";var _h=yh?.WriteStream?.prototype?.hasColors?.()??!1,E=(e,t)=>{if(!_h)return o=>o;let r=`\x1B[${e}\
|
|
174
174
|
m`,n=`\x1B[${t}m`;return o=>{let i=o+"",s=i.indexOf(n);if(s===-1)return r+i+n;let a=r,c=0,l=(t===22?n:"")+r;for(;s!==-1;)
|
|
175
|
-
a+=i.slice(c,s)+l,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},
|
|
176
|
-
4,24),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
49),
|
|
181
|
-
59),
|
|
182
|
-
58;5;12",59),
|
|
183
|
-
c=
|
|
184
|
-
e.getHours(),2)}:${
|
|
185
|
-
t,"0"),
|
|
186
|
-
*",error:
|
|
187
|
-
o)).join("")},
|
|
175
|
+
a+=i.slice(c,s)+l,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},gA=E(0,0),ua=E(1,22),bA=E(2,22),wA=E(3,23),yA=E(
|
|
176
|
+
4,24),_A=E("4:2",24),SA=E("4:3",24),EA=E("4:4",24),vA=E("4:5",24),TA=E(53,55),IA=E(7,27),AA=E(8,28),RA=E(9,29),OA=E(30,39),
|
|
177
|
+
CA=E(31,39),PA=E(32,39),xA=E(33,39),kA=E(34,39),NA=E(35,39),MA=E(36,39),$A=E(37,39),Rr=E(90,39),DA=E(40,49),LA=E(41,49),
|
|
178
|
+
UA=E(42,49),BA=E(43,49),GA=E(44,49),HA=E(45,49),FA=E(46,49),jA=E(47,49),VA=E(100,49),da=E(91,39),zA=E(92,39),pa=E(93,39),
|
|
179
|
+
WA=E(94,39),qA=E(95,39),YA=E(96,39),KA=E(97,39),JA=E(101,49),XA=E(102,49),ZA=E(103,49),QA=E(104,49),eR=E(105,49),tR=E(106,
|
|
180
|
+
49),rR=E(107,49),nR=E("58;5;0",59),oR=E("58;5;1",59),iR=E("58;5;2",59),sR=E("58;5;3",59),aR=E("58;5;4",59),cR=E("58;5;5",
|
|
181
|
+
59),lR=E("58;5;6",59),uR=E("58;5;7",59),dR=E("58;5;8",59),pR=E("58;5;9",59),mR=E("58;5;10",59),fR=E("58;5;11",59),hR=E("\
|
|
182
|
+
58;5;12",59),gR=E("58;5;13",59),bR=E("58;5;14",59),wR=E("58;5;15",59);var ha=({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},options:{reject:s=!0}})=>{let a=Sh(r),
|
|
183
|
+
c=Eh[e]({failed:i,reject:s,piped:n}),u=vh[e]({reject:s});return`${Rr(`[${a}]`)} ${Rr(`[${o}]`)} ${u(c)} ${u(t)}`},Sh=e=>`${Or(
|
|
184
|
+
e.getHours(),2)}:${Or(e.getMinutes(),2)}:${Or(e.getSeconds(),2)}.${Or(e.getMilliseconds(),3)}`,Or=(e,t)=>String(e).padStart(
|
|
185
|
+
t,"0"),ma=({failed:e,reject:t})=>e?t?Ar.cross:Ar.warning:Ar.tick,Eh={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"\
|
|
186
|
+
*",error:ma,duration:ma},fa=e=>e,vh={command:()=>ua,output:()=>fa,ipc:()=>fa,error:({reject:e})=>e?da:pa,duration:()=>Rr};var ga=(e,t,r)=>{let n=oa(t,r);return e.map(({verboseLine:o,verboseObject:i})=>Th(o,i,n)).filter(o=>o!==void 0).map(o=>Ih(
|
|
187
|
+
o)).join("")},Th=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},Ih=e=>e.endsWith(`
|
|
188
188
|
`)?e:`${e}
|
|
189
|
-
`;var
|
|
190
|
-
i),a=
|
|
191
|
-
piped:o=!1,...i}}})=>({type:e,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),
|
|
189
|
+
`;var de=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:n,result:o})=>{let i=Rh({type:e,result:o,verboseInfo:n}),s=Oh(t,
|
|
190
|
+
i),a=ga(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Rh=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{
|
|
191
|
+
piped:o=!1,...i}}})=>({type:e,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),Oh=(e,t)=>e.
|
|
192
192
|
split(`
|
|
193
|
-
`).map(r=>
|
|
194
|
-
t).replaceAll(" "," ".repeat(
|
|
195
|
-
void 0,
|
|
196
|
-
'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!
|
|
197
|
-
t)&&!
|
|
198
|
-
ues are: ${r} or a function.`)}}};import{hrtime as
|
|
199
|
-
escapedCommand:i,startTime:n,verboseInfo:a}};var
|
|
200
|
-
find(n=>n.toUpperCase()==="PATH")||"Path"}import{promisify as
|
|
201
|
-
import{fileURLToPath as
|
|
202
|
-
1024*1024;var
|
|
203
|
-
|
|
204
|
-
[...s,t].join(
|
|
205
|
-
o)}},
|
|
206
|
-
{env:e});return t.path=e[r],e[r]=
|
|
193
|
+
`).map(r=>Ch({...t,message:r})),Ch=e=>({verboseLine:ha(e),verboseObject:e}),Cr=e=>{let t=typeof e=="string"?e:Ah(e);return Lt(
|
|
194
|
+
t).replaceAll(" "," ".repeat(Ph))},Ph=2;var ba=(e,t)=>{ot(t)&&de({type:"command",verboseMessage:e,verboseInfo:t})};var wa=(e,t,r)=>{Nh(e);let n=xh(e);return{verbose:e,escapedCommand:t,commandId:n,rawOptions:r}},xh=e=>ot({verbose:e})?kh++:
|
|
195
|
+
void 0,kh=0n,Nh=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: \
|
|
196
|
+
'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Ir.includes(
|
|
197
|
+
t)&&!Tr(t)){let r=Ir.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed val\
|
|
198
|
+
ues are: ${r} or a function.`)}}};import{hrtime as ya}from"node:process";var Pr=()=>ya.bigint(),Io=e=>Number(ya.bigint()-e)/1e6;var xr=(e,t,r)=>{let n=Pr(),{command:o,escapedCommand:i}=ia(e,t),s=_o(r,"verbose"),a=wa(s,i,{...r});return ba(i,a),{command:o,
|
|
199
|
+
escapedCommand:i,startTime:n,verboseInfo:a}};var wl=Rf(ac(),1);import gb from"node:path";import bl from"node:process";import $r from"node:process";import je from"node:path";function Nr(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().
|
|
200
|
+
find(n=>n.toUpperCase()==="PATH")||"Path"}import{promisify as sg}from"node:util";import{execFile as ag,execFileSync as sO}from"node:child_process";import cc from"node:path";
|
|
201
|
+
import{fileURLToPath as cg}from"node:url";var lO=sg(ag);function Mr(e){return e instanceof URL?cg(e):e}function lc(e){return{*[Symbol.iterator](){let t=cc.resolve(Mr(e)),r;for(;r!==t;)yield t,r=t,t=cc.resolve(t,"..")}}}var uO=10*
|
|
202
|
+
1024*1024;var lg=({cwd:e=$r.cwd(),path:t=$r.env[Nr()],preferLocal:r=!0,execPath:n=$r.execPath,addExecPath:o=!0}={})=>{let i=je.resolve(
|
|
203
|
+
Mr(e)),s=[],a=t.split(je.delimiter);return r&&ug(s,a,i),o&&dg(s,a,n,i),t===""||t===je.delimiter?`${s.join(je.delimiter)}${t}`:
|
|
204
|
+
[...s,t].join(je.delimiter)},ug=(e,t,r)=>{for(let n of lc(r)){let o=je.join(n,"node_modules/.bin");t.includes(o)||e.push(
|
|
205
|
+
o)}},dg=(e,t,r,n)=>{let o=je.resolve(n,Mr(r),"..");t.includes(o)||e.push(o)},uc=({env:e=$r.env,...t}={})=>{e={...e};let r=Nr(
|
|
206
|
+
{env:e});return t.path=e[r],e[r]=lg(t),e};import{setTimeout as Ag}from"node:timers/promises";var dc=(e,t,r)=>{let n=r?Bt:Ut,o=e instanceof ie?{}:{cause:e};return new n(t,o)},ie=class extends Error{},pc=(e,t)=>{Object.
|
|
207
207
|
defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,
|
|
208
|
-
|
|
209
|
-
toString.call(e)==="[object Error]",
|
|
210
|
-
description:"Application-specific signal (realtime)",standard:"posix"}),
|
|
208
|
+
fc,{value:!0,writable:!1,enumerable:!1,configurable:!1})},mc=e=>Dr(e)&&fc in e,fc=Symbol("isExecaError"),Dr=e=>Object.prototype.
|
|
209
|
+
toString.call(e)==="[object Error]",Ut=class extends Error{};pc(Ut,Ut.name);var Bt=class extends Error{};pc(Bt,Bt.name);import{constants as Gt}from"node:os";import{constants as hg}from"node:os";var hc=()=>{let e=bc-gc+1;return Array.from({length:e},pg)},pg=(e,t)=>({name:`SIGRT${t+1}`,number:gc+t,action:"terminate",
|
|
210
|
+
description:"Application-specific signal (realtime)",standard:"posix"}),gc=34,bc=64;import{constants as mg}from"node:os";var wc=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,
|
|
211
211
|
action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"\
|
|
212
212
|
User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine ins\
|
|
213
213
|
truction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"\
|
|
@@ -238,749 +238,767 @@ other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event"
|
|
|
238
238
|
action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"termina\
|
|
239
239
|
te",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"In\
|
|
240
240
|
valid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"\
|
|
241
|
-
other"}];var
|
|
242
|
-
let{signals:{[e]:s}}=
|
|
243
|
-
standard:s})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s}],
|
|
244
|
-
r=Array.from({length:t},(n,o)=>
|
|
241
|
+
other"}];var $o=()=>{let e=hc();return[...wc,...e].map(fg)},fg=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{
|
|
242
|
+
let{signals:{[e]:s}}=mg,a=s!==void 0;return{name:e,number:a?s:t,description:r,supported:a,action:n,forced:o,standard:i}};var gg=()=>{let e=$o();return Object.fromEntries(e.map(bg))},bg=({name:e,number:t,description:r,supported:n,action:o,forced:i,
|
|
243
|
+
standard:s})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s}],yc=gg(),wg=()=>{let e=$o(),t=65,
|
|
244
|
+
r=Array.from({length:t},(n,o)=>yg(o,e));return Object.assign({},...r)},yg=(e,t)=>{let r=_g(e,t);if(r===void 0)return{};let{
|
|
245
245
|
name:n,description:o,supported:i,action:s,forced:a,standard:c}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:s,
|
|
246
|
-
forced:a,standard:c}}},
|
|
247
|
-
|
|
248
|
-
0?e:
|
|
246
|
+
forced:a,standard:c}}},_g=(e,t)=>{let r=t.find(({name:n})=>hg.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},
|
|
247
|
+
RO=wg();var Sc=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return vc(e,t)},Ec=e=>e===
|
|
248
|
+
0?e:vc(e,"`subprocess.kill()`'s argument"),vc=(e,t)=>{if(Number.isInteger(e))return Sg(e,t);if(typeof e=="string")return vg(
|
|
249
249
|
e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
250
|
-
${
|
|
250
|
+
${Do()}`)},Sg=(e,t)=>{if(_c.has(e))return _c.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not\
|
|
251
251
|
exist.
|
|
252
|
-
${
|
|
253
|
-
return e;throw e.toUpperCase()in
|
|
252
|
+
${Do()}`)},Eg=()=>new Map(Object.entries(Gt.signals).reverse().map(([e,t])=>[t,e])),_c=Eg(),vg=(e,t)=>{if(e in Gt.signals)
|
|
253
|
+
return e;throw e.toUpperCase()in Gt.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'\
|
|
254
254
|
.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
|
|
255
|
-
${
|
|
256
|
-
Available signal numbers: ${
|
|
257
|
-
Object.values(
|
|
258
|
-
llAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},
|
|
259
|
-
forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:u}=
|
|
260
|
-
u,n);let l=e(c);return
|
|
261
|
-
let[n=r,o]
|
|
262
|
-
st be an error instance or a signal name string/integer: ${String(n)}`);if(o!==void 0
|
|
263
|
-
econd argument is optional. If specified, it must be an error instance: ${o}`);return{signal:
|
|
264
|
-
e!==void 0&&t.reject(e)},
|
|
265
|
-
t===n&&o&&
|
|
266
|
-
context:r,controllerSignal:n})=>{if(t!==!1)try{await
|
|
267
|
-
he \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},
|
|
268
|
-
controller:o})=>t===void 0||r?[]:[
|
|
269
|
-
ancel",e.kill(),t.reason};import{scheduler as
|
|
270
|
-
e,t)} can only be used if the \`ipc\` option is \`true\`.`)},
|
|
271
|
-
ed: the ${Oe(t)} has already exited or disconnected.`)},
|
|
272
|
-
ete: the ${Oe(e)} exited or disconnected.`)},
|
|
255
|
+
${Do()}`)},Do=()=>`Available signal names: ${Tg()}.
|
|
256
|
+
Available signal numbers: ${Ig()}.`,Tg=()=>Object.keys(Gt.signals).sort().map(e=>`'${e}'`).join(", "),Ig=()=>[...new Set(
|
|
257
|
+
Object.values(Gt.signals).sort((e,t)=>e-t))].join(", "),Lr=e=>yc[e].description;var Tc=e=>{if(e===!1)return e;if(e===!0)return Rg;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKi\
|
|
258
|
+
llAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Rg=1e3*5,Ic=({kill:e,options:{
|
|
259
|
+
forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:u}=Og(s,a,r);Cg(
|
|
260
|
+
u,n);let l=e(c);return Pg({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:l,context:o,controller:i}),l},Og=(e,t,r)=>{
|
|
261
|
+
let[n=r,o]=Dr(e)?[void 0,e]:[e,t];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument mu\
|
|
262
|
+
st be an error instance or a signal name string/integer: ${String(n)}`);if(o!==void 0&&!Dr(o))throw new TypeError(`The s\
|
|
263
|
+
econd argument is optional. If specified, it must be an error instance: ${o}`);return{signal:Ec(n),error:o}},Cg=(e,t)=>{
|
|
264
|
+
e!==void 0&&t.reject(e)},Pg=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:s})=>{
|
|
265
|
+
t===n&&o&&Lo({kill:e,forceKillAfterDelay:r,context:i,controllerSignal:s.signal})},Lo=async({kill:e,forceKillAfterDelay:t,
|
|
266
|
+
context:r,controllerSignal:n})=>{if(t!==!1)try{await Ag(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};import{once as xg}from"node:events";var Ur=async(e,t)=>{e.aborted||await xg(e,"abort",{signal:t})};var Ac=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`T\
|
|
267
|
+
he \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Rc=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,
|
|
268
|
+
controller:o})=>t===void 0||r?[]:[kg(e,t,n,o)],kg=async(e,t,r,{signal:n})=>{throw await Ur(t,n),r.terminationReason??="c\
|
|
269
|
+
ancel",e.kill(),t.reason};import{scheduler as Qg}from"node:timers/promises";import{promisify as Jg}from"node:util";var ct=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{Ng(e,t,r),Uo(e,t,n)},Ng=(e,t,r)=>{if(!r)throw new Error(`${se(
|
|
270
|
+
e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Uo=(e,t,r)=>{if(!r)throw new Error(`${se(e,t)} cannot be us\
|
|
271
|
+
ed: the ${Oe(t)} has already exited or disconnected.`)},Oc=e=>{throw new Error(`${se("getOneMessage",e)} could not compl\
|
|
272
|
+
ete: the ${Oe(e)} exited or disconnected.`)},Cc=e=>{throw new Error(`${se("sendMessage",e)} failed: the ${Oe(e)} is send\
|
|
273
273
|
ing a message too, instead of listening to incoming messages.
|
|
274
274
|
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
275
275
|
|
|
276
276
|
const [receivedMessage] = await Promise.all([
|
|
277
|
-
${
|
|
278
|
-
${
|
|
279
|
-
]);`)},
|
|
280
|
-
|
|
281
|
-
`${
|
|
282
|
-
Signal\` aborted: the ${Oe(!0)} disconnected.`),
|
|
283
|
-
ing the `cancelSignal` subprocess option.")},
|
|
284
|
-
`${
|
|
285
|
-
if(
|
|
286
|
-
|
|
287
|
-
"could not be cloned","circular structure","call stack size exceeded"],
|
|
288
|
-
's `controller.abort()`":`${
|
|
289
|
-
e.disconnect()};var
|
|
290
|
-
|
|
291
|
-
stdio[i];if(s==null)throw new TypeError(
|
|
292
|
-
r,e),n},
|
|
293
|
-
stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${
|
|
277
|
+
${se("getOneMessage",e)},
|
|
278
|
+
${se("sendMessage",e,"message, {strict: true}")},
|
|
279
|
+
]);`)},Br=(e,t)=>new Error(`${se("sendMessage",t)} failed when sending an acknowledgment response to the ${Oe(t)}.`,{cause:e}),
|
|
280
|
+
Pc=e=>{throw new Error(`${se("sendMessage",e)} failed: the ${Oe(e)} is not listening to incoming messages.`)},xc=e=>{throw new Error(
|
|
281
|
+
`${se("sendMessage",e)} failed: the ${Oe(e)} exited without listening to incoming messages.`)},kc=()=>new Error(`\`cancel\
|
|
282
|
+
Signal\` aborted: the ${Oe(!0)} disconnected.`),Nc=()=>{throw new Error("`getCancelSignal()` cannot be used without sett\
|
|
283
|
+
ing the `cancelSignal` subprocess option.")},Mc=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(
|
|
284
|
+
`${se(t,r)} cannot be used: the ${Oe(r)} is disconnecting.`,{cause:e})},$c=({error:e,methodName:t,isSubprocess:r,message:n})=>{
|
|
285
|
+
if(Mg(e))throw new Error(`${se(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},
|
|
286
|
+
Mg=({code:e,message:t})=>$g.has(e)||Dg.some(r=>t.includes(r)),$g=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Dg=[
|
|
287
|
+
"could not be cloned","circular structure","call stack size exceeded"],se=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`\
|
|
288
|
+
's `controller.abort()`":`${Lg(t)}${e}(${r})`,Lg=e=>e?"":"subprocess.",Oe=e=>e?"parent process":"subprocess",lt=e=>{e.connected&&
|
|
289
|
+
e.disconnect()};var pe=()=>{let e={},t=new Promise((r,n)=>{Object.assign(e,{resolve:r,reject:n})});return Object.assign(t,e)};var Hr=(e,t="stdin")=>{let{options:n,fileDescriptors:o}=me.get(e),i=Dc(o,t,!0),s=e.stdio[i];if(s===null)throw new TypeError(
|
|
290
|
+
Lc(i,t,n,!0));return s},ut=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=me.get(e),i=Dc(o,t,!1),s=i==="all"?e.all:e.
|
|
291
|
+
stdio[i];if(s==null)throw new TypeError(Lc(i,t,n,!1));return s},me=new WeakMap,Dc=(e,t,r)=>{let n=Ug(t,r);return Bg(n,t,
|
|
292
|
+
r,e),n},Ug=(e,t)=>{let r=So(e);if(r!==void 0)return r;let{validOptions:n,defaultValue:o}=t?{validOptions:'"stdin"',defaultValue:"\
|
|
293
|
+
stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Ht(t)}" must not be "${e}\
|
|
294
294
|
".
|
|
295
295
|
It must be ${n} or "fd3", "fd4" (and so on).
|
|
296
|
-
It is optional and defaults to "${o}".`)},
|
|
296
|
+
It is optional and defaults to "${o}".`)},Bg=(e,t,r,n)=>{let o=n[Uc(e)];if(o===void 0)throw new TypeError(`"${Ht(r)}" mu\
|
|
297
297
|
st not be ${t}. That file descriptor does not exist.
|
|
298
298
|
Please set the "stdio" option to ensure that file descriptor exists.`);if(o.direction==="input"&&!r)throw new TypeError(
|
|
299
|
-
`"${
|
|
300
|
-
`"${
|
|
301
|
-
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=
|
|
302
|
-
option is incompatible with using "${
|
|
303
|
-
Please set this option with "pipe" instead.`},
|
|
299
|
+
`"${Ht(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(o.direction!=="input"&&r)throw new TypeError(
|
|
300
|
+
`"${Ht(r)}" must not be ${t}. It must be a writable stream, not readable.`)},Lc=(e,t,r,n)=>{if(e==="all"&&!r.all)return`\
|
|
301
|
+
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=Gg(e,r);return`The "${o}: ${Gr(i)}"\
|
|
302
|
+
option is incompatible with using "${Ht(n)}: ${Gr(t)}".
|
|
303
|
+
Please set this option with "pipe" instead.`},Gg=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=Uc(e);return i===0&&t!==
|
|
304
304
|
void 0?{optionName:"stdin",optionValue:t}:i===1&&r!==void 0?{optionName:"stdout",optionValue:r}:i===2&&n!==void 0?{optionName:"\
|
|
305
|
-
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}}
|
|
306
|
-
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as
|
|
307
|
-
(e.setMaxListeners(n+t),
|
|
308
|
-
|
|
309
|
-
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await
|
|
310
|
-
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},
|
|
311
|
-
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{
|
|
312
|
-
ne");e.removeListener("message",o),
|
|
313
|
-
channel:t,isSubprocess:r}),n},
|
|
314
|
-
{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",
|
|
315
|
-
channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),
|
|
316
|
-
null:t.connected};var
|
|
317
|
-
type:
|
|
318
|
-
resolve({isDeadlock:!0,hasListeners:!1})},
|
|
319
|
-
if(e?.type!==
|
|
320
|
-
channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},
|
|
321
|
-
message:r}=e;return
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
s),{outgoingMessages:n,outgoingMessage:s}},
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
isSubprocess:r,ipc:n,isConnected:e.connected}),
|
|
329
|
-
|
|
330
|
-
message:o,strict:i}),a=
|
|
331
|
-
throw
|
|
332
|
-
e);try{await Promise.all([
|
|
333
|
-
isSubprocess:r,message:o}),s}},
|
|
334
|
-
type:
|
|
335
|
-
isSubprocess:r,ipc:n}),
|
|
336
|
-
if(t===null){
|
|
337
|
-
:cancel",
|
|
305
|
+
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},Uc=e=>e==="all"?1:e,Ht=e=>e?"to":"from",Gr=e=>typeof e==
|
|
306
|
+
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as Wg}from"node:events";import{addAbortListener as Hg}from"node:events";var Ve=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||
|
|
307
|
+
(e.setMaxListeners(n+t),Hg(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as Vg}from"node:events";import{once as Fg}from"node:events";import{scheduler as jg}from"node:timers/promises";var Fr=(e,t)=>{t&&Bo(e)},Bo=e=>{e.refCounted()},jr=(e,t)=>{t&&Go(e)},Go=e=>{e.unrefCounted()},Bc=(e,t)=>{t&&(Go(e),Go(e))},
|
|
308
|
+
Gc=(e,t)=>{t&&(Bo(e),Bo(e))};var Hc=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(Vc(o)||Wc(o))return;Vr.has(e)||Vr.set(e,[]);let i=Vr.
|
|
309
|
+
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await zc(e,n,o),await jg.yield();let s=await jc({wrappedMessage:i[0],
|
|
310
|
+
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},Fc=async({anyProcess:e,
|
|
311
|
+
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{Ho();let i=Vr.get(e);for(;i?.length>0;)await Fg(n,"message:do\
|
|
312
|
+
ne");e.removeListener("message",o),Gc(t,r),n.connected=!1,n.emit("disconnect")},Vr=new WeakMap;var Ce=(e,t,r)=>{if(zr.has(e))return zr.get(e);let n=new Vg;return n.connected=!0,zr.set(e,n),zg({ipcEmitter:n,anyProcess:e,
|
|
313
|
+
channel:t,isSubprocess:r}),n},zr=new WeakMap,zg=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=Hc.bind(void 0,
|
|
314
|
+
{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",Fc.bind(void 0,{anyProcess:t,
|
|
315
|
+
channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),Bc(r,n)},Wr=e=>{let t=zr.get(e);return t===void 0?e.channel!==
|
|
316
|
+
null:t.connected};var qc=({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=Ce(e,t,r),s=Kr(e,i);return{id:qg++,
|
|
317
|
+
type:Yr,message:n,hasListeners:s}},qg=0n,Yc=(e,t)=>{if(!(t?.type!==Yr||t.hasListeners))for(let{id:r}of e)r!==void 0&&qr[r].
|
|
318
|
+
resolve({isDeadlock:!0,hasListeners:!1})},jc=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{
|
|
319
|
+
if(e?.type!==Yr||!t.connected)return e;let{id:i,message:s}=e,a={id:i,type:Jc,message:Kr(t,o)};try{await Jr({anyProcess:t,
|
|
320
|
+
channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},Vc=e=>{if(e?.type!==Jc)return!1;let{id:t,
|
|
321
|
+
message:r}=e;return qr[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Kc=async(e,t,r)=>{if(e?.type!==Yr)return;let n=pe();
|
|
322
|
+
qr[e.id]=n;let o=new AbortController;try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,Yg(t,r,o)]);i&&Cc(r),s||
|
|
323
|
+
Pc(r)}finally{o.abort(),delete qr[e.id]}},qr={},Yg=async(e,t,{signal:r})=>{Ve(e,1,r),await Wg(e,"disconnect",{signal:r}),
|
|
324
|
+
xc(t)},Yr="execa:ipc:request",Jc="execa:ipc:response";var Xc=(e,t,r)=>{Ft.has(e)||Ft.set(e,new Set);let n=Ft.get(e),o=pe(),i=r?t.id:void 0,s={onMessageSent:o,id:i};return n.add(
|
|
325
|
+
s),{outgoingMessages:n,outgoingMessage:s}},Zc=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},
|
|
326
|
+
zc=async(e,t,r)=>{for(;!Kr(e,t)&&Ft.get(e)?.size>0;){let n=[...Ft.get(e)];Yc(n,r),await Promise.all(n.map(({onMessageSent:o})=>o))}},
|
|
327
|
+
Ft=new WeakMap,Kr=(e,t)=>t.listenerCount("message")>Kg(e),Kg=e=>me.has(e)&&!_e(me.get(e).options.buffer,"ipc")?1:0;var Jr=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return ct({methodName:s,
|
|
328
|
+
isSubprocess:r,ipc:n,isConnected:e.connected}),Xg({anyProcess:e,channel:t,methodName:s,isSubprocess:r,message:o,strict:i})},
|
|
329
|
+
Xg=async({anyProcess:e,channel:t,methodName:r,isSubprocess:n,message:o,strict:i})=>{let s=qc({anyProcess:e,channel:t,isSubprocess:n,
|
|
330
|
+
message:o,strict:i}),a=Xc(e,s,i);try{await jo({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){
|
|
331
|
+
throw lt(e),c}finally{Zc(a)}},jo=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=Zg(
|
|
332
|
+
e);try{await Promise.all([Kc(n,e,r),i(n)])}catch(s){throw Mc({error:s,methodName:t,isSubprocess:r}),$c({error:s,methodName:t,
|
|
333
|
+
isSubprocess:r,message:o}),s}},Zg=e=>{if(Fo.has(e))return Fo.get(e);let t=Jg(e.send.bind(e));return Fo.set(e,t),t},Fo=new WeakMap;var el=(e,t)=>{let r="cancelSignal";return Uo(r,!1,e.connected),jo({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{
|
|
334
|
+
type:rl,message:t},message:t})},tl=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await eb({anyProcess:e,channel:t,
|
|
335
|
+
isSubprocess:r,ipc:n}),Vo.signal),eb=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!Qc){if(Qc=!0,!n){Nc();return}
|
|
336
|
+
if(t===null){Ho();return}Ce(e,t,r),await Qg.yield()}},Qc=!1,Wc=e=>e?.type!==rl?!1:(Vo.abort(e.message),!0),rl="execa:ipc\
|
|
337
|
+
:cancel",Ho=()=>{Vo.abort(kc())},Vo=new AbortController;var nl=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(t===void 0)throw new Error("The `cancelSigna\
|
|
338
338
|
l` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be \
|
|
339
339
|
false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'j\
|
|
340
|
-
son' when setting the `gracefulCancel` option.")}},
|
|
341
|
-
context:o,controller:i})=>r?[
|
|
342
|
-
subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await
|
|
343
|
-
e,i),
|
|
344
|
-
|
|
345
|
-
ack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as
|
|
346
|
-
e a non-negative integer, got \`${e}\` (${typeof e})`)},
|
|
347
|
-
signal:n})=>{throw await
|
|
348
|
-
options:{...e,node:!0}}},
|
|
340
|
+
son' when setting the `gracefulCancel` option.")}},ol=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,
|
|
341
|
+
context:o,controller:i})=>r?[tb({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:i})]:[],tb=async({
|
|
342
|
+
subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await Ur(t,o);let i=rb(t);throw await el(
|
|
343
|
+
e,i),Lo({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.terminationReason??="gracefulCancel",t.reason},
|
|
344
|
+
rb=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"st\
|
|
345
|
+
ack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as nb}from"node:timers/promises";var il=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to b\
|
|
346
|
+
e a non-negative integer, got \`${e}\` (${typeof e})`)},sl=(e,t,r,n)=>t===0||t===void 0?[]:[ob(e,t,r,n)],ob=async(e,t,r,{
|
|
347
|
+
signal:n})=>{throw await nb(t,void 0,{signal:n}),r.terminationReason??="timeout",e.kill(),new ie};import{execPath as ib,execArgv as sb}from"node:process";import al from"node:path";var cl=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{
|
|
348
|
+
options:{...e,node:!0}}},ll=(e,t,{node:r=!1,nodePath:n=ib,nodeOptions:o=sb.filter(c=>!c.startsWith("--inspect")),cwd:i,execPath:s,
|
|
349
349
|
...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option ins\
|
|
350
|
-
tead.');let c=
|
|
350
|
+
tead.');let c=nt(n,'The "nodePath" option'),u=al.resolve(i,c),l={...a,nodePath:u,node:r,cwd:i};if(!r)return[e,t,l];if(al.
|
|
351
351
|
basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be \
|
|
352
|
-
"node".');return[u,[...o,e,...t],{ipc:!0,...l,shell:!1}]};import{serialize as
|
|
353
|
-
"The `ipcInput` option cannot be set unless the `ipc` option is `true`.");
|
|
354
|
-
"The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},
|
|
355
|
-
throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},
|
|
356
|
-
t!==void 0&&await e.sendMessage(t)};var
|
|
352
|
+
"node".');return[u,[...o,e,...t],{ipc:!0,...l,shell:!1}]};import{serialize as ab}from"node:v8";var ul=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error(
|
|
353
|
+
"The `ipcInput` option cannot be set unless the `ipc` option is `true`.");ub[r](e)}},cb=e=>{try{ab(e)}catch(t){throw new Error(
|
|
354
|
+
"The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},lb=e=>{try{JSON.stringify(e)}catch(t){
|
|
355
|
+
throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},ub={advanced:cb,json:lb},dl=async(e,t)=>{
|
|
356
|
+
t!==void 0&&await e.sendMessage(t)};var ml=({encoding:e})=>{if(zo.has(e))return;let t=pb(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${Xr(
|
|
357
357
|
e)}\`.
|
|
358
|
-
Please rename it to ${
|
|
358
|
+
Please rename it to ${Xr(t)}.`);let r=[...zo].map(n=>Xr(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Xr(
|
|
359
359
|
e)}\`.
|
|
360
|
-
Please rename it to one of: ${r}.`)},
|
|
361
|
-
n1","ascii"]),
|
|
362
|
-
if(t in
|
|
363
|
-
binary:"latin1"},
|
|
360
|
+
Please rename it to one of: ${r}.`)},db=new Set(["utf8","utf16le"]),J=new Set(["buffer","hex","base64","base64url","lati\
|
|
361
|
+
n1","ascii"]),zo=new Set([...db,...J]),pb=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();
|
|
362
|
+
if(t in pl)return pl[t];if(zo.has(t))return t},pl={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",
|
|
363
|
+
binary:"latin1"},Xr=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as mb}from"node:fs";import fb from"node:path";import hb from"node:process";var fl=(e=hl())=>{let t=nt(e,'The "cwd" option');return fb.resolve(t)},hl=()=>{try{return hb.cwd()}catch(e){throw e.message=
|
|
364
364
|
`The current directory does not exist.
|
|
365
|
-
${e.message}`,e}},
|
|
365
|
+
${e.message}`,e}},gl=(e,t)=>{if(t===hl())return e;let r;try{r=mb(t)}catch(n){return`The "cwd" option is invalid: ${t}.
|
|
366
366
|
${n.message}
|
|
367
367
|
${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
368
|
-
${e}`};var
|
|
369
|
-
u);return
|
|
370
|
-
|
|
371
|
-
s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:l}},
|
|
368
|
+
${e}`};var Zr=(e,t,r)=>{r.cwd=fl(r.cwd);let[n,o,i]=ll(e,t,r),{command:s,args:a,options:c}=wl.default._parse(n,o,i),u=na(c),l=bb(
|
|
369
|
+
u);return il(l),ml(l),ul(l),Ac(l),nl(l),l.shell=bo(l.shell),l.env=wb(l),l.killSignal=Sc(l.killSignal),l.forceKillAfterDelay=
|
|
370
|
+
Tc(l.forceKillAfterDelay),l.lines=l.lines.map((d,p)=>d&&!J.has(l.encoding)&&l.buffer[p]),bl.platform==="win32"&&gb.basename(
|
|
371
|
+
s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:l}},bb=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:n=r,
|
|
372
372
|
encoding:o="utf8",reject:i=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:u="SIGTERM",forceKillAfterDelay:l=!0,gracefulCancel:d=!1,
|
|
373
|
-
ipcInput:
|
|
374
|
-
encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:u,forceKillAfterDelay:l,gracefulCancel:d,ipcInput:
|
|
375
|
-
|
|
376
|
-
cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s};var
|
|
377
|
-
Input must be a string or a Uint8Array");return
|
|
378
|
-
-1)===
|
|
379
|
-
`,
|
|
380
|
-
e.readable===void 0)&&typeof e.pipe=="function"}function
|
|
373
|
+
ipcInput:p,ipc:m=p!==void 0||d,serialization:f="advanced",...h})=>({...h,extendEnv:e,preferLocal:t,cwd:r,localDirectory:n,
|
|
374
|
+
encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:u,forceKillAfterDelay:l,gracefulCancel:d,ipcInput:p,ipc:m,serialization:f}),
|
|
375
|
+
wb=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...bl.env,...e}:e;return r||n?uc({env:s,
|
|
376
|
+
cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s};var Qr=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as Zb}from"node:util";function dt(e){if(typeof e=="string")return yb(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("\
|
|
377
|
+
Input must be a string or a Uint8Array");return _b(e)}var yb=e=>e.at(-1)===yl?e.slice(0,e.at(-2)===_l?-2:-1):e,_b=e=>e.at(
|
|
378
|
+
-1)===Sb?e.subarray(0,e.at(-2)===Eb?-2:-1):e,yl=`
|
|
379
|
+
`,Sb=yl.codePointAt(0),_l="\r",Eb=_l.codePointAt(0);import{on as Yb}from"node:events";import{finished as Kb}from"node:stream/promises";function ae(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&
|
|
380
|
+
e.readable===void 0)&&typeof e.pipe=="function"}function Wo(e,{checkOpen:t=!0}={}){return ae(e,{checkOpen:t})&&(e.writable||
|
|
381
381
|
!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="b\
|
|
382
|
-
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function
|
|
382
|
+
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function ze(e,{checkOpen:t=!0}={}){return ae(e,{checkOpen:t})&&
|
|
383
383
|
(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.
|
|
384
|
-
destroy=="function"&&typeof e.destroyed=="boolean"}function
|
|
384
|
+
destroy=="function"&&typeof e.destroyed=="boolean"}function qo(e,t){return Wo(e,t)&&ze(e,t)}var vb=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),Yo=class{#t;#r;#e=!1;#n=void 0;constructor(t,r){
|
|
385
385
|
this.#t=t,this.#r=r}next(){let t=()=>this.#i();return this.#n=this.#n?this.#n.then(t,t):t(),this.#n}return(t){let r=()=>this.#o(
|
|
386
386
|
t);return this.#n?this.#n.then(r,r):r()}async#i(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){
|
|
387
387
|
throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),
|
|
388
388
|
t}async#o(t){if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),
|
|
389
|
-
await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},
|
|
390
|
-
Object.defineProperty(
|
|
391
|
-
{value:"return"});var
|
|
392
|
-
configurable:!0,writable:!0,value:
|
|
393
|
-
create(
|
|
394
|
-
if(
|
|
395
|
-
a ReadableStream, or an async iterable.")},{toString:
|
|
396
|
-
r={};
|
|
397
|
-
if(!t.signal.aborted)throw n}finally{e.destroy()}},
|
|
398
|
-
error:!1})}catch(n){r.error=n}finally{t.abort()}},
|
|
399
|
-
POSITIVE_INFINITY}={})=>{let u=
|
|
400
|
-
state:l,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return
|
|
401
|
-
getFinalChunk:s,maxBuffer:c}),a(l)}catch(d){let
|
|
402
|
-
|
|
403
|
-
state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},
|
|
404
|
-
maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){
|
|
405
|
-
new
|
|
406
|
-
ct"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=
|
|
389
|
+
await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},Ko=Symbol();function Sl(){return this[Ko].next()}
|
|
390
|
+
Object.defineProperty(Sl,"name",{value:"next"});function El(e){return this[Ko].return(e)}Object.defineProperty(El,"name",
|
|
391
|
+
{value:"return"});var Tb=Object.create(vb,{next:{enumerable:!0,configurable:!0,writable:!0,value:Sl},return:{enumerable:!0,
|
|
392
|
+
configurable:!0,writable:!0,value:El}});function Jo({preventCancel:e=!1}={}){let t=this.getReader(),r=new Yo(t,e),n=Object.
|
|
393
|
+
create(Tb);return n[Ko]=r,n}var vl=e=>{if(ze(e,{checkOpen:!1})&&jt.on!==void 0)return Ab(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;
|
|
394
|
+
if(Ib.call(e)==="[object ReadableStream]")return Jo.call(e);throw new TypeError("The first argument must be a Readable, \
|
|
395
|
+
a ReadableStream, or an async iterable.")},{toString:Ib}=Object.prototype,Ab=async function*(e){let t=new AbortController,
|
|
396
|
+
r={};Rb(e,t,r);try{for await(let[n]of jt.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;
|
|
397
|
+
if(!t.signal.aborted)throw n}finally{e.destroy()}},Rb=async(e,t,r)=>{try{await jt.finished(e,{cleanup:!0,readable:!0,writable:!1,
|
|
398
|
+
error:!1})}catch(n){r.error=n}finally{t.abort()}},jt={};var pt=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.
|
|
399
|
+
POSITIVE_INFINITY}={})=>{let u=vl(e),l=t();l.length=0;try{for await(let d of u){let p=Cb(d),m=r[p](d,l);Al({convertedChunk:m,
|
|
400
|
+
state:l,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return Ob({state:l,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,
|
|
401
|
+
getFinalChunk:s,maxBuffer:c}),a(l)}catch(d){let p=typeof d=="object"&&d!==null?d:new Error(d);throw p.bufferedData=a(l),
|
|
402
|
+
p}},Ob=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let s=o(e);s!==void 0&&Al({convertedChunk:s,
|
|
403
|
+
state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},Al=({convertedChunk:e,state:t,getSize:r,truncateChunk:n,addChunk:o,
|
|
404
|
+
maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){Tl(e,t,o,a);return}let c=n(e,i-t.length);throw c!==void 0&&Tl(c,t,o,i),
|
|
405
|
+
new fe},Tl=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},Cb=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="obje\
|
|
406
|
+
ct"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=Il.call(e);return r==="[object Array\
|
|
407
407
|
Buffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&
|
|
408
|
-
|
|
409
|
-
MaxBufferError";constructor(){super("maxBuffer exceeded")}};var Se=e=>e,
|
|
410
|
-
|
|
411
|
-
convertChunk:{string:Se,buffer:Se,arrayBuffer:Se,dataView:Se,typedArray:Se,others:Se},getSize:
|
|
412
|
-
getFinalChunk:
|
|
413
|
-
|
|
414
|
-
length:r},n)=>{let o=
|
|
415
|
-
|
|
416
|
-
t,{maxByteLength:
|
|
417
|
-
|
|
418
|
-
buffer:
|
|
419
|
-
decode(e,{stream:!0}),
|
|
420
|
-
""?void 0:t},
|
|
421
|
-
truncateChunk:
|
|
422
|
-
ll")return e;let s=
|
|
423
|
-
r==="buffer"?"bytes":"characters",
|
|
424
|
-
n},
|
|
408
|
+
Il.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Il}=Object.prototype,fe=class extends Error{name="\
|
|
409
|
+
MaxBufferError";constructor(){super("maxBuffer exceeded")}};var Se=e=>e,Vt=()=>{},en=({contents:e})=>e,tn=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},
|
|
410
|
+
rn=e=>e.length;async function nn(e,t){return pt(e,Nb,t)}var Pb=()=>({contents:[]}),xb=()=>1,kb=(e,{contents:t})=>(t.push(e),t),Nb={init:Pb,
|
|
411
|
+
convertChunk:{string:Se,buffer:Se,arrayBuffer:Se,dataView:Se,typedArray:Se,others:Se},getSize:xb,truncateChunk:Vt,addChunk:kb,
|
|
412
|
+
getFinalChunk:Vt,finalize:en};async function on(e,t){return pt(e,Fb,t)}var Mb=()=>({contents:new ArrayBuffer(0)}),$b=e=>Db.encode(e),Db=new TextEncoder,
|
|
413
|
+
Rl=e=>new Uint8Array(e),Ol=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Lb=(e,t)=>e.slice(0,t),Ub=(e,{contents:t,
|
|
414
|
+
length:r},n)=>{let o=xl()?Gb(t,n):Bb(t,n);return new Uint8Array(o).set(e,r),o},Bb=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(
|
|
415
|
+
Pl(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},Gb=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(
|
|
416
|
+
t,{maxByteLength:Pl(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},Pl=e=>Cl**Math.ceil(Math.log(e)/Math.log(Cl)),
|
|
417
|
+
Cl=2,Hb=({contents:e,length:t})=>xl()?e:e.slice(0,t),xl=()=>"resize"in ArrayBuffer.prototype,Fb={init:Mb,convertChunk:{string:$b,
|
|
418
|
+
buffer:Rl,arrayBuffer:Rl,dataView:Ol,typedArray:Ol,others:tn},getSize:rn,truncateChunk:Lb,addChunk:Ub,getFinalChunk:Vt,finalize:Hb};async function an(e,t){return pt(e,qb,t)}var jb=()=>({contents:"",textDecoder:new TextDecoder}),sn=(e,{textDecoder:t})=>t.
|
|
419
|
+
decode(e,{stream:!0}),Vb=(e,{contents:t})=>t+e,zb=(e,t)=>e.slice(0,t),Wb=({textDecoder:e})=>{let t=e.decode();return t===
|
|
420
|
+
""?void 0:t},qb={init:jb,convertChunk:{string:Se,buffer:sn,arrayBuffer:sn,dataView:sn,typedArray:sn,others:tn},getSize:rn,
|
|
421
|
+
truncateChunk:zb,addChunk:Vb,getFinalChunk:Wb,finalize:en};Object.assign(jt,{on:Yb,finished:Kb});var kl=({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{if(!(e instanceof fe))throw e;if(i==="a\
|
|
422
|
+
ll")return e;let s=Jb(r,n,o);throw e.maxBufferInfo={fdNumber:i,unit:s},t.destroy(),e},Jb=(e,t,r)=>e?"objects":t?"lines":
|
|
423
|
+
r==="buffer"?"bytes":"characters",Nl=(e,t,r)=>{if(t.length!==r)return;let n=new fe;throw n.maxBufferInfo={fdNumber:"ipc"},
|
|
424
|
+
n},Ml=(e,t)=>{let{streamName:r,threshold:n,unit:o}=Xb(e,t);return`Command's ${r} was larger than ${n} ${o}`},Xb=(e,t)=>{
|
|
425
425
|
if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;
|
|
426
|
-
delete e.maxBufferInfo;let o=_e(t,r);return r==="ipc"?{streamName:"IPC output",threshold:o,unit:"messages"}:{streamName:
|
|
427
|
-
r),threshold:o,unit:n}}
|
|
428
|
-
return e;let n=
|
|
429
|
-
isGracefullyCanceled:l,isMaxBuffer:d,isForcefullyTerminated:
|
|
430
|
-
let
|
|
431
|
-
exitCode:s,isCanceled:u,isGracefullyCanceled:l,isForcefullyTerminated:
|
|
426
|
+
delete e.maxBufferInfo;let o=_e(t,r);return r==="ipc"?{streamName:"IPC output",threshold:o,unit:"messages"}:{streamName:vr(
|
|
427
|
+
r),threshold:o,unit:n}},$l=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(n=>n!==null&&n.length>cn(r)),Dl=(e,t,r)=>{if(!t)
|
|
428
|
+
return e;let n=cn(r);return e.length>n?e.slice(0,n):e},cn=([,e])=>e;var Ul=({stdio:e,all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:u,
|
|
429
|
+
isGracefullyCanceled:l,isMaxBuffer:d,isForcefullyTerminated:p,forceKillAfterDelay:m,killSignal:f,maxBuffer:h,timeout:b,cwd:y})=>{
|
|
430
|
+
let w=n?.code,R=Qb({originalError:n,timedOut:c,timeout:b,isMaxBuffer:d,maxBuffer:h,errorCode:w,signal:o,signalDescription:i,
|
|
431
|
+
exitCode:s,isCanceled:u,isGracefullyCanceled:l,isForcefullyTerminated:p,forceKillAfterDelay:m,killSignal:f}),_=tw(n,y),A=_===
|
|
432
432
|
void 0?"":`
|
|
433
|
-
${_}`,O=`${R}: ${a}${A}`,S=t===void 0?[e[2],e[1]]:[t],x=[O,...S,...e.slice(3),r.map(k=>
|
|
434
|
-
`)].map(k=>
|
|
433
|
+
${_}`,O=`${R}: ${a}${A}`,S=t===void 0?[e[2],e[1]]:[t],x=[O,...S,...e.slice(3),r.map(k=>rw(k)).join(`
|
|
434
|
+
`)].map(k=>Lt(dt(nw(k)))).filter(Boolean).join(`
|
|
435
435
|
|
|
436
|
-
`);return{originalMessage:_,shortMessage:O,message:x}},
|
|
437
|
-
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:u,isGracefullyCanceled:l,isForcefullyTerminated:d,forceKillAfterDelay:
|
|
438
|
-
killSignal:
|
|
436
|
+
`);return{originalMessage:_,shortMessage:O,message:x}},Qb=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,
|
|
437
|
+
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:u,isGracefullyCanceled:l,isForcefullyTerminated:d,forceKillAfterDelay:p,
|
|
438
|
+
killSignal:m})=>{let f=ew(d,p);return t?`Command timed out after ${r} milliseconds${f}`:l?s===void 0?`Command was gracef\
|
|
439
439
|
ully canceled with exit code ${c}`:d?`Command was gracefully canceled${f}`:`Command was gracefully canceled with ${s} (${a}\
|
|
440
|
-
)`:u?`Command was canceled${f}`:n?`${
|
|
441
|
-
(${
|
|
442
|
-
nd failed"},
|
|
443
|
-
let r=
|
|
444
|
-
e),
|
|
445
|
-
`):
|
|
446
|
-
cwd:i,durationMs:
|
|
447
|
-
exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),
|
|
448
|
-
options:o,startTime:i,isSync:s})=>
|
|
449
|
-
isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:s}),
|
|
440
|
+
)`:u?`Command was canceled${f}`:n?`${Ml(e,o)}${f}`:i!==void 0?`Command failed with ${i}${f}`:d?`Command was killed with ${m}\
|
|
441
|
+
(${Lr(m)})${f}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Comma\
|
|
442
|
+
nd failed"},ew=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",tw=(e,t)=>{if(e instanceof ie)return;
|
|
443
|
+
let r=mc(e)?e.originalMessage:String(e?.message??e),n=Lt(gl(r,t));return n===""?void 0:n},rw=e=>typeof e=="string"?e:Zb(
|
|
444
|
+
e),nw=e=>Array.isArray(e)?e.map(t=>dt(Ll(t))).filter(Boolean).join(`
|
|
445
|
+
`):Ll(e),Ll=e=>typeof e=="string"?e:L(e)?Sr(e):"";var ln=({command:e,escapedCommand:t,stdio:r,all:n,ipcOutput:o,options:{cwd:i},startTime:s})=>Bl({command:e,escapedCommand:t,
|
|
446
|
+
cwd:i,durationMs:Io(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,
|
|
447
|
+
exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),mt=({error:e,command:t,escapedCommand:r,fileDescriptors:n,
|
|
448
|
+
options:o,startTime:i,isSync:s})=>zt({error:e,command:t,escapedCommand:r,startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,
|
|
449
|
+
isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:s}),zt=({error:e,
|
|
450
450
|
command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,
|
|
451
|
-
exitCode:u,signal:l,stdio:d,all:
|
|
452
|
-
cwd:
|
|
453
|
-
{stdio:d,all:
|
|
454
|
-
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:
|
|
455
|
-
U=
|
|
456
|
-
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:A,signal:O,signalDescription:S,stdio:d,all:
|
|
457
|
-
shortMessage:k})),U},
|
|
458
|
-
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:u,signal:l,signalDescription:d,stdio:
|
|
459
|
-
shortMessage:
|
|
451
|
+
exitCode:u,signal:l,stdio:d,all:p,ipcOutput:m,options:{timeoutDuration:f,timeout:h=f,forceKillAfterDelay:b,killSignal:y,
|
|
452
|
+
cwd:w,maxBuffer:R},isSync:_})=>{let{exitCode:A,signal:O,signalDescription:S}=iw(u,l),{originalMessage:x,shortMessage:k,message:$}=Ul(
|
|
453
|
+
{stdio:d,all:p,ipcOutput:m,originalError:e,signal:O,signalDescription:S,exitCode:A,escapedCommand:r,timedOut:o,isCanceled:i,
|
|
454
|
+
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:b,killSignal:y,maxBuffer:R,timeout:h,cwd:w}),
|
|
455
|
+
U=dc(e,$,_);return Object.assign(U,ow({error:U,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,
|
|
456
|
+
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:A,signal:O,signalDescription:S,stdio:d,all:p,ipcOutput:m,cwd:w,originalMessage:x,
|
|
457
|
+
shortMessage:k})),U},ow=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,
|
|
458
|
+
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:u,signal:l,signalDescription:d,stdio:p,all:m,ipcOutput:f,cwd:h,originalMessage:b,
|
|
459
|
+
shortMessage:y})=>Bl({shortMessage:y,originalMessage:b,command:t,escapedCommand:r,cwd:h,durationMs:Io(n),failed:!0,timedOut:o,
|
|
460
460
|
isCanceled:i,isGracefullyCanceled:s,isTerminated:l!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:u,signal:l,signalDescription:d,
|
|
461
|
-
code:e.cause?.code,stdout:
|
|
462
|
-
e).filter(([,t])=>t!==void 0)),
|
|
463
|
-
signal:n,signalDescription:o}};var
|
|
464
|
-
trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(
|
|
465
|
-
trunc(
|
|
466
|
-
milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function
|
|
467
|
-
return
|
|
461
|
+
code:e.cause?.code,stdout:p[1],stderr:p[2],all:m,stdio:p,ipcOutput:f,pipedFrom:[]}),Bl=e=>Object.fromEntries(Object.entries(
|
|
462
|
+
e).filter(([,t])=>t!==void 0)),iw=(e,t)=>{let r=e===null?void 0:e,n=t===null?void 0:t,o=n===void 0?void 0:Lr(t);return{exitCode:r,
|
|
463
|
+
signal:n,signalDescription:o}};var Gl=e=>Number.isFinite(e)?e:0;function sw(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.
|
|
464
|
+
trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(Gl(e*1e3)%1e3),nanoseconds:Math.
|
|
465
|
+
trunc(Gl(e*1e6)%1e3)}}function aw(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,
|
|
466
|
+
milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function Xo(e){switch(typeof e){case"number":{if(Number.isFinite(e))
|
|
467
|
+
return sw(e);break}case"bigint":return aw(e)}throw new TypeError("Expected a finite number or bigint")}var cw=e=>e===0||e===0n,lw=(e,t)=>t===1||t===1n?e:`${e}s`,uw=1e-7,dw=24n*60n*60n*1000n;function Zo(e,t){let r=typeof e==
|
|
468
468
|
"bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let n=e<0?"-":"";
|
|
469
469
|
e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&
|
|
470
|
-
(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(l,d)=>{let
|
|
471
|
-
round(
|
|
472
|
-
String(l),t.colonNotation){let f=
|
|
473
|
-
0,h-f))+
|
|
470
|
+
(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(l,d)=>{let p=Math.floor(l*10**d+uw);return(Math.
|
|
471
|
+
round(p)/10**d).toFixed(d)},s=(l,d,p,m)=>{if(!((o.length===0||!t.colonNotation)&&cw(l)&&!(t.colonNotation&&p==="m"))){if(m??=
|
|
472
|
+
String(l),t.colonNotation){let f=m.includes(".")?m.split(".")[0].length:m.length,h=o.length>0?2:1;m="0".repeat(Math.max(
|
|
473
|
+
0,h-f))+m}else m+=t.verbose?" "+lw(d,l):p;o.push(m)}},a=Xo(e),c=BigInt(a.days);if(t.hideYearAndDays?s(BigInt(c)*24n+BigInt(
|
|
474
474
|
a.hours),"hour","h"):(t.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),
|
|
475
475
|
s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<
|
|
476
|
-
1e3&&!t.subSecondsAsDecimals){let l=Number(a.seconds),d=Number(a.milliseconds),
|
|
477
|
-
if(s(l,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(
|
|
478
|
-
let f=d+
|
|
479
|
-
ceil(f),
|
|
480
|
-
Number(e%
|
|
481
|
-
|
|
476
|
+
1e3&&!t.subSecondsAsDecimals){let l=Number(a.seconds),d=Number(a.milliseconds),p=Number(a.microseconds),m=Number(a.nanoseconds);
|
|
477
|
+
if(s(l,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(p,"microsecond","\xB5s"),s(m,"nanosecond","ns");else{
|
|
478
|
+
let f=d+p/1e3+m/1e6,h=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,b=f>=1?Math.round(f):Math.
|
|
479
|
+
ceil(f),y=1e3-10**-h,w=h?Math.min(f,y).toFixed(h):Math.min(b,y);s(Number.parseFloat(w),"millisecond","ms",w)}}else{let l=(r?
|
|
480
|
+
Number(e%dw):e)/1e3%60,d=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,p=i(l,d),m=t.keepDecimalsOnWholeSeconds?
|
|
481
|
+
p:p.replace(/\.0+$/,"");s(Number.parseFloat(m),"second","s",m)}if(o.length===0)return n+"0"+(t.verbose?" milliseconds":"\
|
|
482
482
|
ms");let u=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(o=o.slice(0,Math.max(t.unitCount,1))),n+o.join(
|
|
483
|
-
u)}var
|
|
484
|
-
verboseInfo:t,result:e})};var
|
|
485
|
-
"native":L(e)?"uint8Array":
|
|
486
|
-
e.transform,{checkOpen:!1})?
|
|
487
|
-
e,t,"web TransformStream"),"webTransform"),
|
|
488
|
-
nary`,o),
|
|
489
|
-
when using a generator, not a ${r}.`)},
|
|
490
|
-
`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(
|
|
491
|
-
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(
|
|
492
|
-
inal\` option must not be a web TransformStream.`);if(t!==void 0&&!
|
|
493
|
-
ust be a generator.`);return
|
|
494
|
-
if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},
|
|
495
|
-
prototype.toString.call(e)==="[object AsyncGeneratorFunction]",
|
|
496
|
-
torFunction]",
|
|
497
|
-
L]",
|
|
498
|
-
|
|
499
|
-
["ipc","ignore","inherit","overlapped","pipe"]),
|
|
500
|
-
prototype.toString.call(e)==="[object WritableStream]",
|
|
501
|
-
e)&&typeof e[Symbol.asyncIterator]=="function",
|
|
502
|
-
t"&&e!==null,ee=new Set(["generator","asyncGenerator","duplex","webTransform"]),
|
|
503
|
-
mber"]),
|
|
483
|
+
u)}var Hl=(e,t)=>{e.failed&&de({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var Fl=(e,t)=>{ot(t)&&(Hl(e,t),pw(e,t))},pw=(e,t)=>{let r=`(done in ${Zo(e.durationMs)})`;de({type:"duration",verboseMessage:r,
|
|
484
|
+
verboseInfo:t,result:e})};var ft=(e,t,{reject:r})=>{if(Fl(e,t),e.failed&&r)throw e;return e};import{readFileSync as hu}from"node:fs";var zl=(e,t)=>We(e)?"asyncGenerator":Yl(e)?"generator":un(e)?"fileUrl":bw(e)?"filePath":_w(e)?"webStream":ae(e,{checkOpen:!1})?
|
|
485
|
+
"native":L(e)?"uint8Array":Sw(e)?"asyncIterable":Ew(e)?"iterable":ti(e)?Wl({transform:e},t):gw(e)?mw(e,t):"native",mw=(e,t)=>qo(
|
|
486
|
+
e.transform,{checkOpen:!1})?fw(e,t):ti(e.transform)?Wl(e,t):hw(e,t),fw=(e,t)=>(ql(e,t,"Duplex stream"),"duplex"),Wl=(e,t)=>(ql(
|
|
487
|
+
e,t,"web TransformStream"),"webTransform"),ql=({final:e,binary:t,objectMode:r},n,o)=>{jl(e,`${n}.final`,o),jl(t,`${n}.bi\
|
|
488
|
+
nary`,o),Qo(r,`${n}.objectMode`)},jl=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined\
|
|
489
|
+
when using a generator, not a ${r}.`)},hw=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(e!==void 0&&!Vl(e))throw new TypeError(
|
|
490
|
+
`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(qo(t,{checkOpen:!1}))
|
|
491
|
+
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(ti(t))throw new TypeError(`The \`${o}.f\
|
|
492
|
+
inal\` option must not be a web TransformStream.`);if(t!==void 0&&!Vl(t))throw new TypeError(`The \`${o}.final\` option m\
|
|
493
|
+
ust be a generator.`);return Qo(r,`${o}.binary`),Qo(n,`${o}.objectMode`),We(e)||We(t)?"asyncGenerator":"generator"},Qo=(e,t)=>{
|
|
494
|
+
if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},Vl=e=>We(e)||Yl(e),We=e=>Object.
|
|
495
|
+
prototype.toString.call(e)==="[object AsyncGeneratorFunction]",Yl=e=>Object.prototype.toString.call(e)==="[object Genera\
|
|
496
|
+
torFunction]",gw=e=>D(e)&&(e.transform!==void 0||e.final!==void 0),un=e=>Object.prototype.toString.call(e)==="[object UR\
|
|
497
|
+
L]",Kl=e=>un(e)&&e.protocol!=="file:",bw=e=>D(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>ww.has(t))&&ei(e.file),
|
|
498
|
+
ww=new Set(["file","append"]),ei=e=>typeof e=="string",Jl=(e,t)=>e==="native"&&typeof t=="string"&&!yw.has(t),yw=new Set(
|
|
499
|
+
["ipc","ignore","inherit","overlapped","pipe"]),Xl=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",dn=e=>Object.
|
|
500
|
+
prototype.toString.call(e)==="[object WritableStream]",_w=e=>Xl(e)||dn(e),ti=e=>Xl(e?.readable)&&dn(e?.writable),Sw=e=>Zl(
|
|
501
|
+
e)&&typeof e[Symbol.asyncIterator]=="function",Ew=e=>Zl(e)&&typeof e[Symbol.iterator]=="function",Zl=e=>typeof e=="objec\
|
|
502
|
+
t"&&e!==null,ee=new Set(["generator","asyncGenerator","duplex","webTransform"]),pn=new Set(["fileUrl","filePath","fileNu\
|
|
503
|
+
mber"]),ri=new Set(["fileUrl","filePath"]),Ql=new Set([...ri,"webStream","nodeStream"]),eu=new Set(["webTransform","dupl\
|
|
504
504
|
ex"]),Pe={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",
|
|
505
505
|
fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web Transfo\
|
|
506
506
|
rmStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a\
|
|
507
|
-
string",uint8Array:"a Uint8Array"};var
|
|
508
|
-
readableObjectMode:e??n}},
|
|
509
|
-
writableObjectMode:n,readableObjectMode:o}},
|
|
510
|
-
"input"?r.value.writableObjectMode:r.value.readableObjectMode};var
|
|
511
|
-
has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(o))i[s]=
|
|
512
|
-
optionName:t,direction:r,encoding:n});return
|
|
513
|
-
direction:i,encoding:s})=>t==="duplex"?
|
|
514
|
-
direction:i}):
|
|
507
|
+
string",uint8Array:"a Uint8Array"};var ni=(e,t,r,n)=>n==="output"?vw(e,t,r):Tw(e,t,r),vw=(e,t,r)=>{let n=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:n,
|
|
508
|
+
readableObjectMode:e??n}},Tw=(e,t,r)=>{let n=t===0?e===!0:r[t-1].value.readableObjectMode,o=t!==r.length-1&&(e??n);return{
|
|
509
|
+
writableObjectMode:n,readableObjectMode:o}},tu=(e,t)=>{let r=e.findLast(({type:n})=>ee.has(n));return r===void 0?!1:t===
|
|
510
|
+
"input"?r.value.writableObjectMode:r.value.readableObjectMode};var ru=(e,t,r,n)=>[...e.filter(({type:o})=>!ee.has(o)),...Iw(e,t,r,n)],Iw=(e,t,r,{encoding:n})=>{let o=e.filter(({type:s})=>ee.
|
|
511
|
+
has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(o))i[s]=Aw({stdioItem:a,index:Number(s),newTransforms:i,
|
|
512
|
+
optionName:t,direction:r,encoding:n});return Pw(i,r)},Aw=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:n,optionName:o,
|
|
513
|
+
direction:i,encoding:s})=>t==="duplex"?Rw({stdioItem:e,optionName:o}):t==="webTransform"?Ow({stdioItem:e,index:r,newTransforms:n,
|
|
514
|
+
direction:i}):Cw({stdioItem:e,index:r,newTransforms:n,direction:i,encoding:s}),Rw=({stdioItem:e,stdioItem:{value:{transform:t,
|
|
515
515
|
transform:{writableObjectMode:r,readableObjectMode:n},objectMode:o=n}},optionName:i})=>{if(o&&!n)throw new TypeError(`Th\
|
|
516
516
|
e \`${i}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!o&&n)throw new TypeError(
|
|
517
517
|
`The \`${i}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{
|
|
518
|
-
transform:t,writableObjectMode:r,readableObjectMode:n}}},
|
|
519
|
-
let{transform:i,objectMode:s}=D(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=
|
|
520
|
-
transform:i,writableObjectMode:a,readableObjectMode:c}}},
|
|
518
|
+
transform:t,writableObjectMode:r,readableObjectMode:n}}},Ow=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{
|
|
519
|
+
let{transform:i,objectMode:s}=D(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=ni(s,r,n,o);return{...e,value:{
|
|
520
|
+
transform:i,writableObjectMode:a,readableObjectMode:c}}},Cw=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o,
|
|
521
521
|
encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:u=!1,objectMode:l}=D(t)?t:{transform:t},d=c||J.has(i),
|
|
522
|
-
{writableObjectMode:
|
|
523
|
-
writableObjectMode:
|
|
524
|
-
ption must not be an array of both readable and writable values.`);return n.find(Boolean)??
|
|
525
|
-
|
|
526
|
-
iterable:
|
|
527
|
-
|
|
528
|
-
e,{checkOpen:!1}))return
|
|
529
|
-
includes(e))return"output"},
|
|
530
|
-
void 0)return Q.map(n=>t[n]);if(
|
|
522
|
+
{writableObjectMode:p,readableObjectMode:m}=ni(l,r,n,o);return{...e,value:{transform:s,final:a,binary:d,preserveNewlines:u,
|
|
523
|
+
writableObjectMode:p,readableObjectMode:m}}},Pw=(e,t)=>t==="input"?e.reverse():e;import oi from"node:process";var nu=(e,t,r)=>{let n=e.map(o=>xw(o,t));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` o\
|
|
524
|
+
ption must not be an array of both readable and writable values.`);return n.find(Boolean)??Mw},xw=({type:e,value:t},r)=>kw[r]??
|
|
525
|
+
ou[e](t),kw=["input","output","output"],ht=()=>{},ii=()=>"input",ou={generator:ht,asyncGenerator:ht,fileUrl:ht,filePath:ht,
|
|
526
|
+
iterable:ii,asyncIterable:ii,uint8Array:ii,webStream:e=>dn(e)?"output":"input",nodeStream(e){return ze(e,{checkOpen:!1})?
|
|
527
|
+
Wo(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:ht,duplex:ht,native(e){let t=Nw(e);if(t!==void 0)return t;if(ae(
|
|
528
|
+
e,{checkOpen:!1}))return ou.nodeStream(e)}},Nw=e=>{if([0,oi.stdin].includes(e))return"input";if([1,2,oi.stdout,oi.stderr].
|
|
529
|
+
includes(e))return"output"},Mw="output";var iu=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var su=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=$w(e,n).map((a,c)=>au(a,c));return i?Lw(s,r,o):iu(s,t)},$w=(e,t)=>{if(e===
|
|
530
|
+
void 0)return Q.map(n=>t[n]);if(Dw(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Q.
|
|
531
531
|
map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \
|
|
532
532
|
\`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,Q.length);return Array.from(
|
|
533
|
-
{length:r},(n,o)=>e[o])},
|
|
534
|
-
nore":"pipe"),
|
|
535
|
-
t=>t==="pipe");import{readFileSync as
|
|
536
|
-
fdNumber:n,direction:o}):
|
|
537
|
-
let i=
|
|
538
|
-
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},
|
|
539
|
-
optionName:t,fdNumber:r,direction:n})=>{let o=
|
|
540
|
-
if(
|
|
541
|
-
s.`);return{type:"uint8Array",value:ye(
|
|
542
|
-
return e;let r=
|
|
543
|
-
herit"?{type:"nodeStream",value:
|
|
544
|
-
|
|
545
|
-
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n};var
|
|
546
|
-
t"}],
|
|
547
|
-
"The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},
|
|
548
|
-
inputFile"}],
|
|
549
|
-
"The `inputFile` option must be a file path string or a file URL.")};var
|
|
550
|
-
stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{let s=
|
|
551
|
-
|
|
552
|
-
value:t,optionName:r,direction:n});
|
|
553
|
-
({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),
|
|
554
|
-
optionName:n,direction:o})=>{
|
|
555
|
-
type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>
|
|
556
|
-
o);return
|
|
557
|
-
l"?t.href===r.href:t===r,
|
|
558
|
-
r.transform);
|
|
559
|
-
not target ${Pe[r]} that is the same.`)};var
|
|
560
|
-
addProperties:e,options:t,isSync:n});return t.stdio=s.map(({stdioItems:a})=>
|
|
561
|
-
isSync:n})=>{let o=
|
|
562
|
-
c=i.map(d=>
|
|
563
|
-
objectMode:l,stdioItems:u}},
|
|
564
|
-
map(c
|
|
565
|
-
e,t),value:e,optionName:t}),
|
|
566
|
-
ray.`);if(t){for(let{value:n,optionName:o}of e)if(
|
|
567
|
-
\`.`)}},
|
|
533
|
+
{length:r},(n,o)=>e[o])},Dw=e=>Q.some(t=>e[t]!==void 0),au=(e,t)=>Array.isArray(e)?e.map(r=>au(r,t)):e??(t>=Q.length?"ig\
|
|
534
|
+
nore":"pipe"),Lw=(e,t,r)=>e.map((n,o)=>!t[o]&&o!==0&&!it(r,o)&&Uw(n)?"ignore":n),Uw=e=>e==="pipe"||Array.isArray(e)&&e.every(
|
|
535
|
+
t=>t==="pipe");import{readFileSync as Bw}from"node:fs";import Gw from"node:tty";var lu=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?Hw({stdioItem:e,
|
|
536
|
+
fdNumber:n,direction:o}):Vw({stdioItem:e,fdNumber:n}),Hw=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{
|
|
537
|
+
let i=Fw({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(ae(t,{checkOpen:!1}))throw new TypeError(
|
|
538
|
+
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},Fw=({value:e,
|
|
539
|
+
optionName:t,fdNumber:r,direction:n})=>{let o=jw(e,r);if(o!==void 0){if(n==="output")return{type:"fileNumber",value:o,optionName:t};
|
|
540
|
+
if(Gw.isatty(o))throw new TypeError(`The \`${t}: ${Gr(e)}\` option is invalid: it cannot be a TTY with synchronous method\
|
|
541
|
+
s.`);return{type:"uint8Array",value:ye(Bw(o)),optionName:t}}},jw=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")
|
|
542
|
+
return e;let r=Er.indexOf(e);if(r!==-1)return r},Vw=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>t==="in\
|
|
543
|
+
herit"?{type:"nodeStream",value:cu(n,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:cu(t,t,r),optionName:r}:
|
|
544
|
+
ae(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,cu=(e,t,r)=>{let n=Er[e];if(n===void 0)throw new TypeError(
|
|
545
|
+
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n};var uu=({input:e,inputFile:t},r)=>r===0?[...zw(e),...qw(t)]:[],zw=e=>e===void 0?[]:[{type:Ww(e),value:e,optionName:"inpu\
|
|
546
|
+
t"}],Ww=e=>{if(ze(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(L(e))return"uint8Array";throw new Error(
|
|
547
|
+
"The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},qw=e=>e===void 0?[]:[{...Yw(e),optionName:"\
|
|
548
|
+
inputFile"}],Yw=e=>{if(un(e))return{type:"fileUrl",value:e};if(ei(e))return{type:"filePath",value:{file:e}};throw new Error(
|
|
549
|
+
"The `inputFile` option must be a file path string or a file URL.")};var du=e=>e.filter((t,r)=>e.every((n,o)=>t.value!==n.value||r>=o||t.type==="generator"||t.type==="asyncGenerator")),pu=({
|
|
550
|
+
stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{let s=Kw(o,e);if(s.length!==0){if(i){
|
|
551
|
+
Jw({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});return}if(Ql.has(e))return mu({otherStdioItems:s,type:e,
|
|
552
|
+
value:t,optionName:r,direction:n});eu.has(e)&&Zw({otherStdioItems:s,type:e,value:t,optionName:r})}},Kw=(e,t)=>e.flatMap(
|
|
553
|
+
({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),Jw=({otherStdioItems:e,type:t,value:r,
|
|
554
|
+
optionName:n,direction:o})=>{ri.has(t)&&mu({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})},mu=({otherStdioItems:e,
|
|
555
|
+
type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>Xw(a,r));if(i.length===0)return;let s=i.find(a=>a.direction!==
|
|
556
|
+
o);return fu(s,n,t),o==="output"?i[0].stream:void 0},Xw=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUr\
|
|
557
|
+
l"?t.href===r.href:t===r,Zw=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{transform:i}})=>i===
|
|
558
|
+
r.transform);fu(o,n,t)},fu=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must\
|
|
559
|
+
not target ${Pe[r]} that is the same.`)};var mn=(e,t,r,n)=>{let i=su(t,r,n).map((a,c)=>Qw({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=ay({initialFileDescriptors:i,
|
|
560
|
+
addProperties:e,options:t,isSync:n});return t.stdio=s.map(({stdioItems:a})=>uy(a)),s},Qw=({stdioOption:e,fdNumber:t,options:r,
|
|
561
|
+
isSync:n})=>{let o=vr(t),{stdioItems:i,isStdioArray:s}=ey({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=nu(i,t,o),
|
|
562
|
+
c=i.map(d=>lu({stdioItem:d,isStdioArray:s,fdNumber:t,direction:a,isSync:n})),u=ru(c,o,a,r),l=tu(u,a);return sy(u,l),{direction:a,
|
|
563
|
+
objectMode:l,stdioItems:u}},ey=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let i=[...(Array.isArray(e)?e:[e]).
|
|
564
|
+
map(c=>ty(c,n)),...uu(r,t)],s=du(i),a=s.length>1;return ry(s,a,n),oy(s),{stdioItems:s,isStdioArray:a}},ty=(e,t)=>({type:zl(
|
|
565
|
+
e,t),value:e,optionName:t}),ry=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty ar\
|
|
566
|
+
ray.`);if(t){for(let{value:n,optionName:o}of e)if(ny.has(n))throw new Error(`The \`${o}\` option must not include \`${n}\
|
|
567
|
+
\`.`)}},ny=new Set(["ignore","ipc"]),oy=e=>{for(let t of e)iy(t)},iy=({type:e,value:t,optionName:r})=>{if(Kl(t))throw new TypeError(
|
|
568
568
|
`The \`${r}: URL\` option must use the \`file:\` scheme.
|
|
569
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(
|
|
570
|
-
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},
|
|
569
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Jl(e,t))throw new TypeError(`Th\
|
|
570
|
+
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},sy=(e,t)=>{if(!t)return;let r=e.find(({type:n})=>pn.
|
|
571
571
|
has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectM\
|
|
572
|
-
ode.`)},
|
|
573
|
-
fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw
|
|
574
|
-
objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>
|
|
575
|
-
direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},
|
|
576
|
-
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=
|
|
577
|
-
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},
|
|
578
|
-
r)&&r.destroy()},
|
|
579
|
-
return t==="native"?r:"pipe"};var
|
|
580
|
-
rlapped")&&
|
|
581
|
-
s.`)},
|
|
582
|
-
|
|
572
|
+
ode.`)},ay=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let i of e)o.push(cy({fileDescriptor:i,
|
|
573
|
+
fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw si(o),i}},cy=({fileDescriptor:{direction:e,
|
|
574
|
+
objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>ly({stdioItem:c,addProperties:o,
|
|
575
|
+
direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},ly=({stdioItem:e,addProperties:t,
|
|
576
|
+
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=pu({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return s!==
|
|
577
|
+
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},si=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!oe(
|
|
578
|
+
r)&&r.destroy()},uy=e=>{if(e.length>1)return e.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;
|
|
579
|
+
return t==="native"?r:"pipe"};var bu=(e,t)=>mn(py,e,t,!0),he=({type:e,optionName:t})=>{wu(t,Pe[e])},dy=({optionName:e,value:t})=>((t==="ipc"||t==="ove\
|
|
580
|
+
rlapped")&&wu(e,`"${t}"`),{}),wu=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous method\
|
|
581
|
+
s.`)},gu={generator(){},asyncGenerator:he,webStream:he,nodeStream:he,webTransform:he,duplex:he,asyncIterable:he,native:dy},
|
|
582
|
+
py={input:{...gu,fileUrl:({value:e})=>({contents:[ye(hu(e))]}),filePath:({value:{file:e}})=>({contents:[ye(hu(e))]}),fileNumber:he,
|
|
583
583
|
iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},
|
|
584
|
-
output:{...
|
|
585
|
-
path:e}),iterable:
|
|
586
|
-
t,{});return[...r(e),...n()]},
|
|
584
|
+
output:{...gu,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({
|
|
585
|
+
path:e}),iterable:he,string:he,uint8Array:he}};var Ee=(e,{stripFinalNewline:t},r)=>ai(t,r)&&e!==void 0&&!Array.isArray(e)?dt(e):e,ai=(e,t)=>t==="all"?e[1]||e[2]:e[t];import{Transform as Ny,getDefaultHighWaterMark as Cu}from"node:stream";var fn=(e,t,r,n)=>e||r?void 0:_u(t,n),li=(e,t,r)=>r?e.flatMap(n=>yu(n,t)):yu(e,t),yu=(e,t)=>{let{transform:r,final:n}=_u(
|
|
586
|
+
t,{});return[...r(e),...n()]},_u=(e,t)=>(t.previousChunks="",{transform:my.bind(void 0,t,e),final:hy.bind(void 0,t)}),my=function*(e,t,r){
|
|
587
587
|
if(typeof r!="string"){yield r;return}let{previousChunks:n}=e,o=-1;for(let i=0;i<r.length;i+=1)if(r[i]===`
|
|
588
|
-
`){let s=
|
|
589
|
-
e.previousChunks=n},
|
|
590
|
-
e.length>0&&(yield e)},
|
|
591
|
-
void 0,n)},
|
|
592
|
-
ing"?
|
|
588
|
+
`){let s=fy(r,i,t,e),a=r.slice(o+1,i+1-s);n.length>0&&(a=ci(n,a),n=""),yield a,o=i}o!==r.length-1&&(n=ci(n,r.slice(o+1))),
|
|
589
|
+
e.previousChunks=n},fy=(e,t,r,n)=>r?0:(n.isWindowsNewline=t!==0&&e[t-1]==="\r",n.isWindowsNewline?2:1),hy=function*({previousChunks:e}){
|
|
590
|
+
e.length>0&&(yield e)},Su=({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:gy.bind(
|
|
591
|
+
void 0,n)},gy=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:i}=typeof t=="str\
|
|
592
|
+
ing"?by:yy;if(t.at(-1)===o){yield t;return}yield i(t,e?n:r)},ci=(e,t)=>`${e}${t}`,by={windowsNewline:`\r
|
|
593
593
|
`,unixNewline:`
|
|
594
594
|
`,LF:`
|
|
595
|
-
`,concatBytes:
|
|
596
|
-
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:
|
|
597
|
-
`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},
|
|
598
|
-
bind(void 0,t):
|
|
595
|
+
`,concatBytes:ci},wy=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},yy={windowsNewline:new Uint8Array(
|
|
596
|
+
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:wy};import{Buffer as _y}from"node:buffer";var Eu=(e,t)=>e?void 0:Sy.bind(void 0,t),Sy=function*(e,t){if(typeof t!="string"&&!L(t)&&!_y.isBuffer(t))throw new TypeError(
|
|
597
|
+
`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},vu=(e,t)=>e?Ey.
|
|
598
|
+
bind(void 0,t):vy.bind(void 0,t),Ey=function*(e,t){Tu(e,t),yield t},vy=function*(e,t){if(Tu(e,t),typeof t!="string"&&!L(
|
|
599
599
|
t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},
|
|
600
|
-
|
|
600
|
+
Tu=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
601
601
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
602
|
-
if (condition) { yield value; }`)};import{Buffer as
|
|
603
|
-
bind(void 0,n),final:
|
|
604
|
-
t):yield t},
|
|
605
|
-
n.push(o)}finally{delete t.currentIterable}}),
|
|
606
|
-
for await(let o of n(e))yield*
|
|
607
|
-
t),e)},
|
|
608
|
-
if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),
|
|
609
|
-
e)],
|
|
610
|
-
for(let[t,{final:r}]of Object.entries(e))yield*
|
|
611
|
-
n,r,t+1)},
|
|
612
|
-
c=
|
|
613
|
-
l?
|
|
614
|
-
o),transform(h,y
|
|
615
|
-
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=
|
|
616
|
-
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:
|
|
617
|
-
n),
|
|
618
|
-
filter(Boolean)};var
|
|
619
|
-
([t])=>Number(t)))
|
|
602
|
+
if (condition) { yield value; }`)};import{Buffer as Ty}from"node:buffer";import{StringDecoder as Iy}from"node:string_decoder";var hn=(e,t,r)=>{if(r)return;if(e)return{transform:Ay.bind(void 0,new TextEncoder)};let n=new Iy(t);return{transform:Ry.
|
|
603
|
+
bind(void 0,n),final:Oy.bind(void 0,n)}},Ay=function*(e,t){Ty.isBuffer(t)?yield ye(t):typeof t=="string"?yield e.encode(
|
|
604
|
+
t):yield t},Ry=function*(e,t){yield L(t)?e.write(t):t},Oy=function*(e){let t=e.end();t!==""&&(yield t)};import{callbackify as Iu}from"node:util";var ui=Iu(async(e,t,r,n)=>{t.currentIterable=e(...r);try{for await(let o of t.currentIterable)
|
|
605
|
+
n.push(o)}finally{delete t.currentIterable}}),gn=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=Py}=t[r];
|
|
606
|
+
for await(let o of n(e))yield*gn(o,t,r+1)},Au=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Cy(r,Number(
|
|
607
|
+
t),e)},Cy=async function*(e,t,r){if(e!==void 0)for await(let n of e())yield*gn(n,r,t+1)},Ru=Iu(async({currentIterable:e},t)=>{
|
|
608
|
+
if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Py=function*(e){yield e};var di=(e,t,r,n)=>{try{for(let o of e(...t))r.push(o);n()}catch(o){n(o)}},Ou=(e,t)=>[...t.flatMap(r=>[...qe(r,e,0)]),...Wt(
|
|
609
|
+
e)],qe=function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=ky}=t[r];for(let o of n(e))yield*qe(o,t,r+1)},Wt=function*(e){
|
|
610
|
+
for(let[t,{final:r}]of Object.entries(e))yield*xy(r,Number(t),e)},xy=function*(e,t,r){if(e!==void 0)for(let n of e())yield*qe(
|
|
611
|
+
n,r,t+1)},ky=function*(e){yield e};var pi=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},
|
|
612
|
+
c=Pu(e,s,i),u=We(t),l=We(r),d=u?ui.bind(void 0,gn,a):di.bind(void 0,qe),p=u||l?ui.bind(void 0,Au,a):di.bind(void 0,Wt),m=u||
|
|
613
|
+
l?Ru.bind(void 0,a):void 0;return{stream:new Ny({writableObjectMode:n,writableHighWaterMark:Cu(n),readableObjectMode:o,readableHighWaterMark:Cu(
|
|
614
|
+
o),transform(h,b,y){d([h,c,0],this,y)},flush(h){p([c],this,h)},destroy:m})}},bn=(e,t,r,n)=>{let o=t.filter(({type:s})=>s===
|
|
615
|
+
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=Pu(s,r,a);e=Ou(c,e)}return e},Pu=({transform:e,final:t,
|
|
616
|
+
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:Eu(n,a)},hn(r,s,
|
|
617
|
+
n),fn(r,i,n,c),{transform:e,final:t},{transform:vu(o,a)},Su({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].
|
|
618
|
+
filter(Boolean)};var xu=(e,t)=>{for(let r of My(e))$y(e,r,t)},My=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(
|
|
619
|
+
([t])=>Number(t))),$y=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:a})=>a!==void 0);if(o.length===0)return;if(t!==
|
|
620
620
|
0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Pe[a]} with synch\
|
|
621
|
-
ronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>
|
|
622
|
-
r)
|
|
623
|
-
alid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as
|
|
624
|
-
"native"&&
|
|
625
|
-
for await(let o of e)
|
|
626
|
-
let n=
|
|
627
|
-
from({length:3})};let i={},s=new Set([]);return{output:t.map((c,u)=>
|
|
628
|
-
isMaxBuffer:n,verboseInfo:o},r)),...i}},
|
|
629
|
-
buffer:a,encoding:c,lines:u,stripFinalNewline:l,maxBuffer:d})=>{if(e===null)return;let
|
|
630
|
-
objectMode:h}=t[r],
|
|
631
|
-
fdNumber:r});
|
|
632
|
-
void 0;try{return n.error===void 0&&
|
|
633
|
-
return n.error=o,e}},
|
|
634
|
-
if(r==="buffer")return{serializedResult
|
|
635
|
-
{serializedResult:s}},
|
|
636
|
-
if(!
|
|
637
|
-
|
|
638
|
-
i)?
|
|
639
|
-
"all")]:Array.isArray(t)?[Ee(e,r,"all"),...t]:L(e)&&L(t)?
|
|
640
|
-
allSettled([
|
|
641
|
-
try{return await
|
|
642
|
-
t,r]},
|
|
643
|
-
resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},
|
|
644
|
-
e,t,r),d
|
|
645
|
-
return
|
|
646
|
-
options:l}=
|
|
647
|
-
options:l,fileDescriptors:d}},
|
|
648
|
-
|
|
649
|
-
option cannot be used with synchronous methods.`)}
|
|
650
|
-
fileDescriptors:s,startTime:a})=>{let c=
|
|
651
|
-
startTime:a});if(c.failed)return c;let{resultError:u,exitCode:l,signal:d,timedOut:
|
|
652
|
-
{fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:
|
|
653
|
-
return
|
|
654
|
-
|
|
655
|
-
r);return
|
|
656
|
-
isSync:!0})}},
|
|
657
|
-
timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:u,startTime:l})=>e===void 0?
|
|
658
|
-
stdio:i,all:s,ipcOutput:[],options:a,startTime:l}):
|
|
659
|
-
isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:l,isSync:!0});import{setMaxListeners as
|
|
660
|
-
ipc:n,isConnected:
|
|
661
|
-
isSubprocess:r,filter:n,reference:o})=>{
|
|
662
|
-
i,n,s),
|
|
663
|
-
let[n]=await
|
|
664
|
-
signal:r})=>{await
|
|
665
|
-
throw
|
|
666
|
-
shouldAwait:!r,reference:o}),
|
|
667
|
-
getEachMessage",isSubprocess:r,ipc:n,isConnected:
|
|
668
|
-
s,a),
|
|
669
|
-
controller:a,state:c,reference:i})},
|
|
670
|
-
|
|
671
|
-
error=
|
|
672
|
-
state:s,reference:a}){try{for await(let[c]of
|
|
673
|
-
|
|
674
|
-
bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},
|
|
675
|
-
channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:
|
|
676
|
-
getEachMessage:
|
|
677
|
-
|
|
678
|
-
options:o,startTime:i,isSync:!1}),u=
|
|
679
|
-
from({length:t.length-3},
|
|
680
|
-
return e.end(),e},
|
|
681
|
-
e,t,r);import{createReadStream as
|
|
682
|
-
Writable as
|
|
683
|
-
|
|
684
|
-
readableObjectMode:r}}){let n=t||r;return{stream:
|
|
685
|
-
native(){}},
|
|
686
|
-
value:e})=>({stream:
|
|
687
|
-
e)}),string:({value:e})=>({stream:
|
|
688
|
-
value:e})=>({stream:
|
|
689
|
-
stream:
|
|
690
|
-
finished as
|
|
691
|
-
t \`${typeof e}\`.`);for(let o of e)
|
|
692
|
-
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var
|
|
693
|
-
readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},
|
|
694
|
-
[]);#r=new Set([]);#e=new Set([]);#n;#i=Symbol("unpipe");#o=new WeakMap;add(t){if(
|
|
695
|
-
t),this.#n??=
|
|
696
|
-
onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(
|
|
697
|
-
return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},
|
|
698
|
-
e,
|
|
699
|
-
signal:t})=>{try{await
|
|
700
|
-
o]of
|
|
701
|
-
readable stream, got: \`${typeof e}\`.`)}
|
|
702
|
-
unpipeEvent:s})=>{
|
|
703
|
-
streams:r,ended:n,aborted:o,controller:a}),
|
|
704
|
-
a.abort(),
|
|
705
|
-
await e,r.aborted||
|
|
706
|
-
controller:{signal:i}})=>{try{await
|
|
707
|
-
aborted||!r.has(t))return;
|
|
708
|
-
signal:i}})=>{if(await
|
|
709
|
-
|
|
710
|
-
e.writable)&&e.destroy()},
|
|
711
|
-
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
type:c})=>ee.has(c)))
|
|
715
|
-
fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]:
|
|
716
|
-
r==="output"?
|
|
717
|
-
rr"],
|
|
718
|
-
a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},
|
|
719
|
-
CPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&
|
|
720
|
-
IGPWR","SIGSTKFLT");var
|
|
721
|
-
"function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",
|
|
722
|
-
for("signal-exit emitter"),
|
|
723
|
-
afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Ei
|
|
621
|
+
ronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>Dy(a,n));r.input=Dt(s)},Dy=(e,t)=>{let r=bn(e,t,"utf8",!0);return Ly(
|
|
622
|
+
r),Dt(r)},Ly=e=>{let t=e.find(r=>typeof r!="string"&&!L(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is inv\
|
|
623
|
+
alid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as Hy,appendFileSync as Fy}from"node:fs";var wn=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&it(r,n)&&!J.has(t)&&Uy(n)&&(e.some(({type:o,value:i})=>o===
|
|
624
|
+
"native"&&By.has(i))||e.every(({type:o})=>ee.has(o))),Uy=e=>e===1||e===2,By=new Set(["pipe","overlapped"]),ku=async(e,t,r,n)=>{
|
|
625
|
+
for await(let o of e)Gy(t)||Mu(o,r,n)},Nu=(e,t,r)=>{for(let n of e)Mu(n,t,r)},Gy=e=>e._readableState.pipes.length>0,Mu=(e,t,r)=>{
|
|
626
|
+
let n=Cr(e);de({type:"output",verboseMessage:n,fdNumber:t,verboseInfo:r})};var $u=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.
|
|
627
|
+
from({length:3})};let i={},s=new Set([]);return{output:t.map((c,u)=>jy({result:c,fileDescriptors:e,fdNumber:u,state:i,outputFiles:s,
|
|
628
|
+
isMaxBuffer:n,verboseInfo:o},r)),...i}},jy=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{
|
|
629
|
+
buffer:a,encoding:c,lines:u,stripFinalNewline:l,maxBuffer:d})=>{if(e===null)return;let p=Dl(e,i,d),m=ye(p),{stdioItems:f,
|
|
630
|
+
objectMode:h}=t[r],b=Vy([m],f,c,n),{serializedResult:y,finalResult:w=y}=zy({chunks:b,objectMode:h,encoding:c,lines:u,stripFinalNewline:l,
|
|
631
|
+
fdNumber:r});Wy({serializedResult:y,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:f,objectMode:h});let R=a[r]?w:
|
|
632
|
+
void 0;try{return n.error===void 0&&qy(y,f,o),R}catch(_){return n.error=_,R}},Vy=(e,t,r,n)=>{try{return bn(e,t,r,!1)}catch(o){
|
|
633
|
+
return n.error=o,e}},zy=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};
|
|
634
|
+
if(r==="buffer")return{serializedResult:Dt(e)};let s=Js(e,r);return n[i]?{serializedResult:s,finalResult:li(s,!o[i],t)}:
|
|
635
|
+
{serializedResult:s}},Wy=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{
|
|
636
|
+
if(!wn({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=li(e,!1,s);try{Nu(a,t,n)}catch(c){r.error??=c}},
|
|
637
|
+
qy=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:i})=>pn.has(i))){let i=typeof n=="string"?n:n.toString();o||r.has(
|
|
638
|
+
i)?Fy(n,e):(r.add(i),Hy(n,e))}};var Du=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,Ee(t,r,
|
|
639
|
+
"all")]:Array.isArray(t)?[Ee(e,r,"all"),...t]:L(e)&&L(t)?wo([e,t]):`${e}${t}`};import{once as mi}from"node:events";var Lu=async(e,t)=>{let[r,n]=await Yy(e);return t.isForcefullyTerminated??=!1,[r,n]},Yy=async e=>{let[t,r]=await Promise.
|
|
640
|
+
allSettled([mi(e,"spawn"),mi(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?Uu(e):r.value},Uu=async e=>{
|
|
641
|
+
try{return await mi(e,"exit")}catch{return Uu(e)}},Bu=async e=>{let[t,r]=await e;if(!Ky(t,r)&&fi(t,r))throw new ie;return[
|
|
642
|
+
t,r]},Ky=(e,t)=>e===void 0&&t===void 0,fi=(e,t)=>e!==0||t!==null;var Gu=({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let i=Jy(e,t,r),s=i?.code==="ETIMEDOUT",a=$l(i,n,o);return{
|
|
643
|
+
resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},Jy=(e,t,r)=>e!==void 0?e:fi(t,r)?new ie:void 0;var Hu=(e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:s,startTime:a,verboseInfo:c,options:u,fileDescriptors:l}=Zy(
|
|
644
|
+
e,t,r),d=t_({file:n,commandArguments:o,options:u,command:i,escapedCommand:s,verboseInfo:c,fileDescriptors:l,startTime:a});
|
|
645
|
+
return ft(d,c,u)},Zy=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=xr(e,t,r),a=Qy(r),{file:c,commandArguments:u,
|
|
646
|
+
options:l}=Zr(e,t,a);e_(l);let d=bu(l,s);return{file:c,commandArguments:u,command:n,escapedCommand:o,startTime:i,verboseInfo:s,
|
|
647
|
+
options:l,fileDescriptors:d}},Qy=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,e_=({ipc:e,ipcInput:t,detached:r,cancelSignal:n})=>{t&&
|
|
648
|
+
yn("ipcInput"),e&&yn("ipc: true"),r&&yn("detached: true"),n&&yn("cancelSignal")},yn=e=>{throw new TypeError(`The "${e}" \
|
|
649
|
+
option cannot be used with synchronous methods.`)},t_=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:i,
|
|
650
|
+
fileDescriptors:s,startTime:a})=>{let c=r_({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:s,
|
|
651
|
+
startTime:a});if(c.failed)return c;let{resultError:u,exitCode:l,signal:d,timedOut:p,isMaxBuffer:m}=Gu(c,r),{output:f,error:h=u}=$u(
|
|
652
|
+
{fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:m,verboseInfo:i}),b=f.map((w,R)=>Ee(w,r,R)),y=Ee(Du(f,r),r,"all");
|
|
653
|
+
return o_({error:h,exitCode:l,signal:d,timedOut:p,isMaxBuffer:m,stdio:b,all:y,options:r,command:n,escapedCommand:o,startTime:a})},
|
|
654
|
+
r_=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:i,startTime:s})=>{try{xu(i,r);let a=n_(
|
|
655
|
+
r);return Xy(...Qr(e,t,a))}catch(a){return mt({error:a,command:n,escapedCommand:o,fileDescriptors:i,options:r,startTime:s,
|
|
656
|
+
isSync:!0})}},n_=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:cn(t)}),o_=({error:e,exitCode:t,signal:r,
|
|
657
|
+
timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:u,startTime:l})=>e===void 0?ln({command:c,escapedCommand:u,
|
|
658
|
+
stdio:i,all:s,ipcOutput:[],options:a,startTime:l}):zt({error:e,command:c,escapedCommand:u,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,
|
|
659
|
+
isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:l,isSync:!0});import{setMaxListeners as zS}from"node:events";import{spawn as WS}from"node:child_process";import Wu from"node:process";import{once as hi,on as i_}from"node:events";var Fu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:i}={})=>(ct({methodName:"getOneMessage",isSubprocess:r,
|
|
660
|
+
ipc:n,isConnected:Wr(e)}),s_({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:o})),s_=async({anyProcess:e,channel:t,
|
|
661
|
+
isSubprocess:r,filter:n,reference:o})=>{Fr(t,o);let i=Ce(e,t,r),s=new AbortController;try{return await Promise.race([a_(
|
|
662
|
+
i,n,s),c_(i,r,s),l_(i,r,s)])}catch(a){throw lt(e),a}finally{s.abort(),jr(t,o)}},a_=async(e,t,{signal:r})=>{if(t===void 0){
|
|
663
|
+
let[n]=await hi(e,"message",{signal:r});return n}for await(let[n]of i_(e,"message",{signal:r}))if(t(n))return n},c_=async(e,t,{
|
|
664
|
+
signal:r})=>{await hi(e,"disconnect",{signal:r}),Oc(t)},l_=async(e,t,{signal:r})=>{let[n]=await hi(e,"strict:error",{signal:r});
|
|
665
|
+
throw Br(n,t)};import{once as Vu,on as u_}from"node:events";var zu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>gi({anyProcess:e,channel:t,isSubprocess:r,ipc:n,
|
|
666
|
+
shouldAwait:!r,reference:o}),gi=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{ct({methodName:"\
|
|
667
|
+
getEachMessage",isSubprocess:r,ipc:n,isConnected:Wr(e)}),Fr(t,i);let s=Ce(e,t,r),a=new AbortController,c={};return d_(e,
|
|
668
|
+
s,a),p_({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),m_({anyProcess:e,channel:t,ipcEmitter:s,isSubprocess:r,shouldAwait:o,
|
|
669
|
+
controller:a,state:c,reference:i})},d_=async(e,t,r)=>{try{await Vu(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},
|
|
670
|
+
p_=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await Vu(e,"strict:error",{signal:r.signal});n.
|
|
671
|
+
error=Br(o,t),r.abort()}catch{}},m_=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,
|
|
672
|
+
state:s,reference:a}){try{for await(let[c]of u_(r,"message",{signal:i.signal}))ju(s),yield c}catch{ju(s)}finally{i.abort(),
|
|
673
|
+
jr(t,a),n||lt(e),o&&await e}},ju=({error:e})=>{if(e)throw e};var qu=(e,{ipc:t})=>{Object.assign(e,Ku(e,!1,t))},Yu=()=>{let e=Wu,t=!0,r=Wu.channel!==void 0;return{...Ku(e,t,r),getCancelSignal:tl.
|
|
674
|
+
bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},Ku=(e,t,r)=>({sendMessage:Jr.bind(void 0,{anyProcess:e,
|
|
675
|
+
channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:Fu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),
|
|
676
|
+
getEachMessage:zu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as f_}from"node:child_process";import{PassThrough as h_,Readable as g_,Writable as b_,Duplex as w_}from"node:stream";var Ju=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,verboseInfo:s})=>{si(n);let a=new f_;
|
|
677
|
+
y_(a,n),Object.assign(a,{readable:__,writable:S_,duplex:E_});let c=mt({error:e,command:t,escapedCommand:r,fileDescriptors:n,
|
|
678
|
+
options:o,startTime:i,isSync:!1}),u=v_(c,s,o);return{subprocess:a,promise:u}},y_=(e,t)=>{let r=qt(),n=qt(),o=qt(),i=Array.
|
|
679
|
+
from({length:t.length-3},qt),s=qt(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,all:s,stdio:a})},qt=()=>{let e=new h_;
|
|
680
|
+
return e.end(),e},__=()=>new g_({read(){}}),S_=()=>new b_({write(){}}),E_=()=>new w_({read(){},write(){}}),v_=async(e,t,r)=>ft(
|
|
681
|
+
e,t,r);import{createReadStream as Xu,createWriteStream as Zu}from"node:fs";import{Buffer as T_}from"node:buffer";import{Readable as Yt,
|
|
682
|
+
Writable as I_,Duplex as A_}from"node:stream";var ed=(e,t)=>mn(R_,e,t,!1),Kt=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${Pe[e]}.`)},
|
|
683
|
+
Qu={fileNumber:Kt,generator:pi,asyncGenerator:pi,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,
|
|
684
|
+
readableObjectMode:r}}){let n=t||r;return{stream:A_.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),
|
|
685
|
+
native(){}},R_={input:{...Qu,fileUrl:({value:e})=>({stream:Xu(e)}),filePath:({value:{file:e}})=>({stream:Xu(e)}),webStream:({
|
|
686
|
+
value:e})=>({stream:Yt.fromWeb(e)}),iterable:({value:e})=>({stream:Yt.from(e)}),asyncIterable:({value:e})=>({stream:Yt.from(
|
|
687
|
+
e)}),string:({value:e})=>({stream:Yt.from(e)}),uint8Array:({value:e})=>({stream:Yt.from(T_.from(e))})},output:{...Qu,fileUrl:({
|
|
688
|
+
value:e})=>({stream:Zu(e)}),filePath:({value:{file:e,append:t}})=>({stream:Zu(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({
|
|
689
|
+
stream:I_.fromWeb(e)}),iterable:Kt,asyncIterable:Kt,string:Kt,uint8Array:Kt}};import{on as O_,once as td}from"node:events";import{PassThrough as C_,getDefaultHighWaterMark as P_}from"node:stream";import{
|
|
690
|
+
finished as od}from"node:stream/promises";function Ye(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, go\
|
|
691
|
+
t \`${typeof e}\`.`);for(let o of e)wi(o);let t=e.some(({readableObjectMode:o})=>o),r=x_(e,t),n=new bi({objectMode:t,writableHighWaterMark:r,
|
|
692
|
+
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var x_=(e,t)=>{if(e.length===0)return P_(t);let r=e.filter(({
|
|
693
|
+
readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},bi=class extends C_{#t=new Set(
|
|
694
|
+
[]);#r=new Set([]);#e=new Set([]);#n;#i=Symbol("unpipe");#o=new WeakMap;add(t){if(wi(t),this.#t.has(t))return;this.#t.add(
|
|
695
|
+
t),this.#n??=k_(this,this.#t,this.#i);let r=$_({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,
|
|
696
|
+
onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(wi(t),!this.#t.has(t))
|
|
697
|
+
return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},k_=async(e,t,r)=>{_n(
|
|
698
|
+
e,rd);let n=new AbortController;try{await Promise.race([N_(e,n),M_(e,t,r,n)])}finally{n.abort(),_n(e,-rd)}},N_=async(e,{
|
|
699
|
+
signal:t})=>{try{await od(e,{signal:t,cleanup:!0})}catch(r){throw id(e,r),r}},M_=async(e,t,r,{signal:n})=>{for await(let[
|
|
700
|
+
o]of O_(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},wi=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a\
|
|
701
|
+
readable stream, got: \`${typeof e}\`.`)},$_=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:i,
|
|
702
|
+
unpipeEvent:s})=>{_n(e,nd);let a=new AbortController;try{await Promise.race([D_(i,t,a),L_({passThroughStream:e,stream:t,
|
|
703
|
+
streams:r,ended:n,aborted:o,controller:a}),U_({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{
|
|
704
|
+
a.abort(),_n(e,-nd)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?yi(e):B_(e))},D_=async(e,t,{signal:r})=>{try{
|
|
705
|
+
await e,r.aborted||yi(t)}catch(n){r.aborted||id(t,n)}},L_=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,
|
|
706
|
+
controller:{signal:i}})=>{try{await od(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.
|
|
707
|
+
aborted||!r.has(t))return;sd(s)?o.add(t):ad(e,s)}},U_=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{
|
|
708
|
+
signal:i}})=>{if(await td(e,o,{signal:i}),!e.readable)return td(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},
|
|
709
|
+
B_=e=>{e.writable&&e.end()},id=(e,t)=>{sd(t)?yi(e):ad(e,t)},sd=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",yi=e=>{(e.readable||
|
|
710
|
+
e.writable)&&e.destroy()},ad=(e,t)=>{e.destroyed||(e.once("error",G_),e.destroy(t))},G_=()=>{},_n=(e,t)=>{let r=e.getMaxListeners();
|
|
711
|
+
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},rd=2,nd=1;import{finished as cd}from"node:stream/promises";var gt=(e,t)=>{e.pipe(t),H_(e,t),F_(e,t)},H_=async(e,t)=>{if(!(oe(e)||oe(t))){try{await cd(e,{cleanup:!0,readable:!0,writable:!1})}catch{}
|
|
712
|
+
_i(t)}},_i=e=>{e.writable&&e.end()},F_=async(e,t)=>{if(!(oe(e)||oe(t))){try{await cd(t,{cleanup:!0,readable:!1,writable:!0})}catch{}
|
|
713
|
+
Si(e)}},Si=e=>{e.readable&&e.destroy()};var ld=(e,t,r)=>{let n=new Map;for(let[o,{stdioItems:i,direction:s}]of Object.entries(t)){for(let{stream:a}of i.filter(({
|
|
714
|
+
type:c})=>ee.has(c)))j_(e,a,s,o);for(let{stream:a}of i.filter(({type:c})=>!ee.has(c)))z_({subprocess:e,stream:a,direction:s,
|
|
715
|
+
fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]:Ye(i);gt(s,o)}},j_=(e,t,r,n)=>{
|
|
716
|
+
r==="output"?gt(e.stdio[n],t):gt(t,e.stdio[n]);let o=V_[n];o!==void 0&&(e[o]=t),e.stdio[n]=t},V_=["stdin","stdout","stde\
|
|
717
|
+
rr"],z_=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{if(t===void 0)return;W_(t,i);let[s,
|
|
718
|
+
a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},W_=(e,{signal:t})=>{oe(e)&&Ve(e,q_,t)},q_=2;import{addAbortListener as J_}from"node:events";var Ke=[];Ke.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ke.push("SIGALRM","SIGABRT","SIGVTALRM","SIGX\
|
|
719
|
+
CPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ke.push("SIGIO","SIGPOLL","S\
|
|
720
|
+
IGPWR","SIGSTKFLT");var Sn=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit==
|
|
721
|
+
"function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Ei=Symbol.
|
|
722
|
+
for("signal-exit emitter"),vi=globalThis,Y_=Object.defineProperty.bind(Object),Ti=class{emitted={afterExit:!1,exit:!1};listeners={
|
|
723
|
+
afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(vi[Ei])return vi[Ei];Y_(vi,Ei,{value:this,writable:!1,enumerable:!1,
|
|
724
724
|
configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===
|
|
725
725
|
0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.
|
|
726
|
-
listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},
|
|
727
|
-
onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),
|
|
728
|
-
|
|
729
|
-
t,this.#o={};for(let r of
|
|
726
|
+
listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},En=class{},K_=e=>({onExit(t,r){return e.
|
|
727
|
+
onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Ii=class extends En{onExit(){return()=>{}}load(){}unload(){}},
|
|
728
|
+
Ai=class extends En{#t=Ri.platform==="win32"?"SIGINT":"SIGHUP";#r=new Ti;#e;#n;#i;#o={};#s=!1;constructor(t){super(),this.#e=
|
|
729
|
+
t,this.#o={};for(let r of Ke)this.#o[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__==
|
|
730
730
|
"object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();
|
|
731
731
|
let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||t.kill(t.pid,a)}};this.#i=t.reallyExit,this.#n=t.emit}onExit(t,r){
|
|
732
|
-
if(!
|
|
732
|
+
if(!Sn(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{
|
|
733
733
|
this.#r.removeListener(n,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){
|
|
734
|
-
if(!this.#s){this.#s=!0,this.#r.count+=1;for(let t of
|
|
735
|
-
t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,
|
|
734
|
+
if(!this.#s){this.#s=!0,this.#r.count+=1;for(let t of Ke)try{let r=this.#o[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#c(
|
|
735
|
+
t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,Ke.forEach(t=>{let r=this.#o[t];if(!r)throw new Error(
|
|
736
736
|
"Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=
|
|
737
|
-
this.#i,this.#r.count-=1)}#a(t){return
|
|
738
|
-
call(this.#e,this.#e.exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&
|
|
737
|
+
this.#i,this.#r.count-=1)}#a(t){return Sn(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#i.
|
|
738
|
+
call(this.#e,this.#e.exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&Sn(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=
|
|
739
739
|
r[0]);let o=n.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},
|
|
740
|
-
|
|
741
|
-
from:u,unpipeSignal:l}=
|
|
742
|
-
sourceStream:d,sourceOptions:
|
|
743
|
-
startTime:i}},
|
|
744
|
-
destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},
|
|
745
|
-
isArray(r))return{destination:t(
|
|
740
|
+
Ri=globalThis.process,{onExit:ud,load:uM,unload:dM}=K_(Sn(Ri)?new Ai(Ri):new Ii);var dd=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=ud(()=>{e.kill()});J_(n,()=>{o()})};var md=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=Pr(),{destination:s,destinationStream:a,destinationError:c,
|
|
741
|
+
from:u,unpipeSignal:l}=X_(r,n,o),{sourceStream:d,sourceError:p}=Q_(e,u),{options:m,fileDescriptors:f}=me.get(e);return{sourcePromise:t,
|
|
742
|
+
sourceStream:d,sourceOptions:m,sourceError:p,destination:s,destinationStream:a,destinationError:c,unpipeSignal:l,fileDescriptors:f,
|
|
743
|
+
startTime:i}},X_=(e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=Z_(e,t,...r),a=Hr(n,i);return{
|
|
744
|
+
destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},Z_=(e,t,r,...n)=>{if(Array.
|
|
745
|
+
isArray(r))return{destination:t(pd,e)(r,...n),pipeOptions:e};if(typeof r=="string"||r instanceof URL||go(r)){if(Object.keys(
|
|
746
746
|
e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of\
|
|
747
|
-
.pipe(options)("file", ...).');let[o,i,s]=
|
|
747
|
+
.pipe(options)("file", ...).');let[o,i,s]=_r(r,...n);return{destination:t(pd)(o,i,s),pipeOptions:s}}if(me.has(r)){if(Object.
|
|
748
748
|
keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(\
|
|
749
749
|
options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a templat\
|
|
750
|
-
e string, an options object, or an Execa subprocess: ${r}`)},
|
|
751
|
-
|
|
752
|
-
let a=
|
|
753
|
-
sourceOptions:i,startTime:s})},
|
|
754
|
-
n!==void 0)return n;if(n!==void 0)return
|
|
755
|
-
startTime:n})=>
|
|
756
|
-
ipe(destination)";var
|
|
757
|
-
pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as
|
|
758
|
-
[e]);return
|
|
759
|
-
readable:!1,writable:!0})}catch{}
|
|
760
|
-
await
|
|
761
|
-
sourceOptions:o,startTime:i})};var
|
|
762
|
-
e,...t),o=
|
|
750
|
+
e string, an options object, or an Execa subprocess: ${r}`)},pd=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),
|
|
751
|
+
Q_=(e,t)=>{try{return{sourceStream:ut(e,t)}}catch(r){return{sourceError:r}}};var hd=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:i,startTime:s})=>{
|
|
752
|
+
let a=eS({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(a!==void 0)throw Oi({error:a,fileDescriptors:o,
|
|
753
|
+
sourceOptions:i,startTime:s})},eS=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>{if(t!==void 0&&
|
|
754
|
+
n!==void 0)return n;if(n!==void 0)return Si(e),n;if(t!==void 0)return _i(r),t},Oi=({error:e,fileDescriptors:t,sourceOptions:r,
|
|
755
|
+
startTime:n})=>mt({error:e,command:fd,escapedCommand:fd,fileDescriptors:t,options:r,startTime:n,isSync:!1}),fd="source.p\
|
|
756
|
+
ipe(destination)";var gd=async e=>{let[{status:t,reason:r,value:n=r},{status:o,reason:i,value:s=i}]=await e;if(s.pipedFrom.includes(n)||s.
|
|
757
|
+
pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as tS}from"node:stream/promises";var bd=(e,t,r)=>{let n=vn.has(t)?nS(e,t):rS(e,t);return Ve(e,iS,r.signal),Ve(t,sS,r.signal),oS(t),n},rS=(e,t)=>{let r=Ye(
|
|
758
|
+
[e]);return gt(r,t),vn.set(t,r),r},nS=(e,t)=>{let r=vn.get(t);return r.add(e),r},oS=async e=>{try{await tS(e,{cleanup:!0,
|
|
759
|
+
readable:!1,writable:!0})}catch{}vn.delete(e)},vn=new WeakMap,iS=2,sS=1;import{aborted as aS}from"node:util";var wd=(e,t)=>e===void 0?[]:[cS(e,t)],cS=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{
|
|
760
|
+
await aS(e,t),await r.remove(t);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw Oi({error:s,fileDescriptors:n,
|
|
761
|
+
sourceOptions:o,startTime:i})};var Tn=(e,...t)=>{if(D(t[0]))return Tn.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=md(
|
|
762
|
+
e,...t),o=lS({...n,destination:r});return o.pipe=Tn.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},lS=async({
|
|
763
763
|
sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,
|
|
764
|
-
fileDescriptors:c,startTime:u})=>{let l=
|
|
765
|
-
fileDescriptors:c,sourceOptions:r,startTime:u});let d=new AbortController;try{let
|
|
766
|
-
[
|
|
767
|
-
allSettled([e,t]);import{setImmediate as
|
|
768
|
-
return
|
|
769
|
-
preserveNewlines:i})},
|
|
770
|
-
stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;
|
|
771
|
-
controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},
|
|
772
|
-
await e}catch{r.destroy()}finally{t.abort()}},
|
|
773
|
-
preserveNewlines:s})=>{let a=
|
|
774
|
-
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},
|
|
775
|
-
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=
|
|
776
|
-
encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*
|
|
777
|
-
yield*
|
|
778
|
-
Boolean);var
|
|
779
|
-
streamInfo:l})=>{let d=
|
|
780
|
-
all([
|
|
781
|
-
all([
|
|
782
|
-
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!
|
|
783
|
-
verboseInfo:i,fdNumber:r}))return;let a=
|
|
784
|
-
await
|
|
785
|
-
iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await
|
|
786
|
-
await
|
|
787
|
-
encoding:o,fdNumber:n}))}},
|
|
788
|
-
e):e;import{finished as
|
|
789
|
-
r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],
|
|
790
|
-
stdinCleanedUp||
|
|
791
|
-
t&&
|
|
792
|
-
(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},
|
|
793
|
-
|
|
794
|
-
code==="ERR_STREAM_PREMATURE_CLOSE",
|
|
795
|
-
map((c,u)=>
|
|
796
|
-
streamInfo:a})),
|
|
797
|
-
streamInfo:u})=>{if(!e)return;let l=
|
|
798
|
-
fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:u}),l]);return d};var
|
|
799
|
-
lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>
|
|
800
|
-
o[2],allMixed:
|
|
801
|
-
return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}},
|
|
802
|
-
t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as
|
|
803
|
-
pc"),c=_e(r,"ipc");for await(let u of
|
|
804
|
-
a&&(
|
|
805
|
-
forceKillAfterDelay:c,stripFinalNewline:u,ipc:l,ipcInput:d},context:
|
|
806
|
-
onInternalError:
|
|
807
|
-
_=
|
|
808
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:u,verboseInfo:
|
|
809
|
-
maxBuffer:n,ipc:l,ipcOutput:O,verboseInfo:
|
|
810
|
-
Promise.all(_),A,S,
|
|
811
|
-
controller:
|
|
812
|
-
return
|
|
813
|
-
x),Promise.allSettled(k)])}},
|
|
814
|
-
filter(({value:o,stream:i=o})=>
|
|
815
|
-
has(o),stopOnExit:o==="native"}))),
|
|
816
|
-
n.has(t)||n.set(t,[]);let o=n.get(t),i=
|
|
817
|
-
promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as
|
|
818
|
-
await
|
|
819
|
-
if(await e,t)throw t},
|
|
820
|
-
{subprocessStdout:a,waitReadableDestroy:c}=
|
|
821
|
-
a,s),{read:
|
|
822
|
-
read:
|
|
823
|
-
encoding:u});return
|
|
824
|
-
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},
|
|
825
|
-
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:
|
|
826
|
-
|
|
827
|
-
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){
|
|
828
|
-
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},
|
|
829
|
-
readable:r,subprocess:n,subprocessStdin:o})=>{try{await
|
|
830
|
-
await
|
|
831
|
-
t,n))},
|
|
832
|
-
e,r,t),s=new
|
|
833
|
-
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return
|
|
834
|
-
r,n,"writableFinal"),i=
|
|
835
|
-
write:
|
|
836
|
-
await
|
|
837
|
-
|
|
838
|
-
n,t)&&(
|
|
839
|
-
r),{subprocessStdout:c,waitReadableDestroy:u}=
|
|
840
|
-
e,o,t),{readableEncoding:
|
|
841
|
-
subprocess:e,binary:a,encoding:r,preserveNewlines:s}),
|
|
842
|
-
subprocessStdin:l,subprocess:e,waitReadableDestroy:u,waitWritableFinal:d,waitWritableDestroy:
|
|
843
|
-
writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:f,writableObjectMode:l.writableObjectMode,encoding:
|
|
844
|
-
return
|
|
764
|
+
fileDescriptors:c,startTime:u})=>{let l=uS(e,o);hd({sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,
|
|
765
|
+
fileDescriptors:c,sourceOptions:r,startTime:u});let d=new AbortController;try{let p=bd(t,i,d);return await Promise.race(
|
|
766
|
+
[gd(l),...wd(a,{sourceStream:t,mergedStream:p,sourceOptions:r,fileDescriptors:c,startTime:u})])}finally{d.abort()}},uS=(e,t)=>Promise.
|
|
767
|
+
allSettled([e,t]);import{setImmediate as bS}from"node:timers/promises";import{on as dS}from"node:events";import{getDefaultHighWaterMark as pS}from"node:stream";var In=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{let s=new AbortController;
|
|
768
|
+
return mS(t,s),_d({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,
|
|
769
|
+
preserveNewlines:i})},mS=async(e,t)=>{try{await e}catch{}finally{t.abort()}},Ci=({stream:e,onStreamEnd:t,lines:r,encoding:n,
|
|
770
|
+
stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;fS(t,s,e);let a=e.readableObjectMode&&!i;return _d({stream:e,
|
|
771
|
+
controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},fS=async(e,t,r)=>{try{
|
|
772
|
+
await e}catch{r.destroy()}finally{t.abort()}},_d=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,
|
|
773
|
+
preserveNewlines:s})=>{let a=dS(e,"data",{signal:t.signal,highWaterMark:yd,highWatermark:yd});return hS({onStdoutChunk:a,
|
|
774
|
+
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},Pi=pS(!0),yd=Pi,hS=async function*({
|
|
775
|
+
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=gS({binary:r,shouldEncode:n,
|
|
776
|
+
encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*qe(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{
|
|
777
|
+
yield*Wt(a)}},gS=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[hn(e,r,!t),fn(e,o,!n,{})].filter(
|
|
778
|
+
Boolean);var Sd=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:u,
|
|
779
|
+
streamInfo:l})=>{let d=wS({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:u,streamInfo:l});if(!o){await Promise.
|
|
780
|
+
all([yS(e),d]);return}let p=ai(c,r),m=Ci({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:p,allMixed:a}),[f]=await Promise.
|
|
781
|
+
all([_S({stream:e,iterable:m,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),d]);return f},wS=async({stream:e,onStreamEnd:t,
|
|
782
|
+
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!wn({stdioItems:s[r]?.stdioItems,encoding:n,
|
|
783
|
+
verboseInfo:i,fdNumber:r}))return;let a=Ci({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});
|
|
784
|
+
await ku(a,e,r,i)},yS=async e=>{await bS(),e.readableFlowing===null&&e.resume()},_S=async({stream:e,stream:{readableObjectMode:t},
|
|
785
|
+
iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await nn(r,{maxBuffer:i}):o==="buffer"?new Uint8Array(
|
|
786
|
+
await on(r,{maxBuffer:i})):await an(r,{maxBuffer:i})}catch(a){return Ed(kl({error:a,stream:e,readableObjectMode:t,lines:s,
|
|
787
|
+
encoding:o,fdNumber:n}))}},xi=async e=>{try{return await e}catch(t){return Ed(t)}},Ed=({bufferedData:e})=>Ys(e)?new Uint8Array(
|
|
788
|
+
e):e;import{finished as SS}from"node:stream/promises";var Jt=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let i=ES(e,
|
|
789
|
+
r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],SS(e,{cleanup:!0,signal:s.signal})])}catch(a){i.
|
|
790
|
+
stdinCleanedUp||IS(a,t,r,n)}finally{s.abort()}},ES=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===
|
|
791
|
+
t&&vS(e,r,n),n},vS=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{TS(t,r),n.call(e,...o)}},TS=({exitCode:e,signalCode:t},r)=>{
|
|
792
|
+
(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},IS=(e,t,r,n)=>{if(!AS(e,t,r,n))throw e},AS=(e,t,r,n=!0)=>r.propagating?vd(e)||
|
|
793
|
+
An(e):(r.propagating=!0,ki(r,t)===n?vd(e):An(e)),ki=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",An=e=>e?.
|
|
794
|
+
code==="ERR_STREAM_PREMATURE_CLOSE",vd=e=>e?.code==="EPIPE";var Td=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>e.stdio.
|
|
795
|
+
map((c,u)=>Ni({stream:c,fdNumber:u,encoding:t,buffer:r[u],maxBuffer:n[u],lines:o[u],allMixed:!1,stripFinalNewline:i,verboseInfo:s,
|
|
796
|
+
streamInfo:a})),Ni=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,
|
|
797
|
+
streamInfo:u})=>{if(!e)return;let l=Jt(e,t,u);if(ki(u,t)){await l;return}let[d]=await Promise.all([Sd({stream:e,onStreamEnd:l,
|
|
798
|
+
fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:u}),l]);return d};var Id=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?Ye([e,t].filter(Boolean)):void 0,Ad=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,
|
|
799
|
+
lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>Ni({...RS(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||
|
|
800
|
+
o[2],allMixed:OS(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),RS=({stdout:e,stderr:t,all:r},[,n,o])=>{let i=n||o;
|
|
801
|
+
return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}},OS=({all:e,stdout:t,stderr:r})=>e&&
|
|
802
|
+
t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as CS}from"node:events";var Rd=e=>it(e,"ipc"),Od=(e,t)=>{let r=Cr(e);de({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var Cd=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{if(!n)return o;let s=Rd(i),a=_e(t,"i\
|
|
803
|
+
pc"),c=_e(r,"ipc");for await(let u of gi({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))
|
|
804
|
+
a&&(Nl(e,o,c),o.push(u)),s&&Od(u,i);return o},Pd=async(e,t)=>(await Promise.allSettled([e]),t);var xd=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,
|
|
805
|
+
forceKillAfterDelay:c,stripFinalNewline:u,ipc:l,ipcInput:d},context:p,verboseInfo:m,fileDescriptors:f,originalStreams:h,
|
|
806
|
+
onInternalError:b,controller:y})=>{let w=Lu(e,p),R={originalStreams:h,fileDescriptors:f,subprocess:e,exitPromise:w,propagating:!1},
|
|
807
|
+
_=Td({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:u,verboseInfo:m,streamInfo:R}),A=Ad({subprocess:e,
|
|
808
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:u,verboseInfo:m,streamInfo:R}),O=[],S=Cd({subprocess:e,buffer:r,
|
|
809
|
+
maxBuffer:n,ipc:l,ipcOutput:O,verboseInfo:m}),x=PS(h,e,R),k=xS(f,R);try{return await Promise.race([Promise.all([{},Bu(w),
|
|
810
|
+
Promise.all(_),A,S,dl(e,d),...x,...k]),b,kS(e,y),...sl(e,i,p,y),...Rc({subprocess:e,cancelSignal:s,gracefulCancel:a,context:p,
|
|
811
|
+
controller:y}),...ol({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:p,controller:y})])}catch($){
|
|
812
|
+
return p.terminationReason??="other",Promise.all([{error:$},w,Promise.all(_.map(U=>xi(U))),xi(A),Pd(S,O),Promise.allSettled(
|
|
813
|
+
x),Promise.allSettled(k)])}},PS=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:Jt(n,o,r)),xS=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.
|
|
814
|
+
filter(({value:o,stream:i=o})=>ae(i,{checkOpen:!1})&&!oe(i)).map(({type:o,value:i,stream:s=i})=>Jt(s,n,t,{isSameDirection:ee.
|
|
815
|
+
has(o),stopOnExit:o==="native"}))),kS=async(e,{signal:t})=>{let[r]=await CS(e,"error",{signal:t});throw r};var kd=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Xt=(e,t,r)=>{let n=e[r];
|
|
816
|
+
n.has(t)||n.set(t,[]);let o=n.get(t),i=pe();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},bt=async({resolve:e,
|
|
817
|
+
promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as NS}from"node:stream";import{callbackify as MS}from"node:util";import{finished as Nd}from"node:stream/promises";var Mi=async e=>{if(e!==void 0)try{await $i(e)}catch{}},Md=async e=>{if(e!==void 0)try{await Di(e)}catch{}},$i=async e=>{
|
|
818
|
+
await Nd(e,{cleanup:!0,readable:!1,writable:!0})},Di=async e=>{await Nd(e,{cleanup:!0,readable:!0,writable:!1})},Rn=async(e,t)=>{
|
|
819
|
+
if(await e,t)throw t},On=(e,t,r)=>{r&&!An(r)?e.destroy(r):t&&e.destroy()};var $d=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{let s=o||J.has(r),
|
|
820
|
+
{subprocessStdout:a,waitReadableDestroy:c}=Li(e,n,t),{readableEncoding:u,readableObjectMode:l,readableHighWaterMark:d}=Ui(
|
|
821
|
+
a,s),{read:p,onStdoutDataDone:m}=Bi({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),f=new NS({
|
|
822
|
+
read:p,destroy:MS(Hi.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:l,
|
|
823
|
+
encoding:u});return Gi({subprocessStdout:a,onStdoutDataDone:m,readable:f,subprocess:e}),f},Li=(e,t,r)=>{let n=ut(e,t),o=Xt(
|
|
824
|
+
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},Ui=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?
|
|
825
|
+
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Pi},
|
|
826
|
+
Bi=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=pe(),s=In({subprocessStdout:e,subprocess:t,
|
|
827
|
+
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){$S(this,s,i)},onStdoutDataDone:i}},$S=async(e,t,r)=>{
|
|
828
|
+
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},Gi=async({subprocessStdout:e,onStdoutDataDone:t,
|
|
829
|
+
readable:r,subprocess:n,subprocessStdin:o})=>{try{await Di(e),await n,await Mi(o),await t,r.readable&&r.push(null)}catch(i){
|
|
830
|
+
await Mi(o),Dd(r,i)}},Hi=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await bt(r,t)&&(Dd(e,n),await Rn(
|
|
831
|
+
t,n))},Dd=(e,t)=>{On(e,e.readable,t)};import{Writable as DS}from"node:stream";import{callbackify as Ld}from"node:util";var Ud=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=Fi(
|
|
832
|
+
e,r,t),s=new DS({...ji(n,e,o),destroy:Ld(zi.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),
|
|
833
|
+
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return Vi(n,s),s},Fi=(e,t,r)=>{let n=Hr(e,t),o=Xt(
|
|
834
|
+
r,n,"writableFinal"),i=Xt(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},ji=(e,t,r)=>({
|
|
835
|
+
write:LS.bind(void 0,e),final:Ld(US.bind(void 0,e,t,r))}),LS=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},US=async(e,t,r)=>{
|
|
836
|
+
await bt(r,t)&&(e.writable&&e.end(),await t)},Vi=async(e,t,r)=>{try{await $i(e),t.writable&&t.end()}catch(n){await Md(r),
|
|
837
|
+
Bd(t,n)}},zi=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await bt(r,t),await bt(
|
|
838
|
+
n,t)&&(Bd(e,o),await Rn(t,o))},Bd=(e,t)=>{On(e,e.writable,t)};import{Duplex as BS}from"node:stream";import{callbackify as GS}from"node:util";var Gd=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||J.has(
|
|
839
|
+
r),{subprocessStdout:c,waitReadableDestroy:u}=Li(e,n,t),{subprocessStdin:l,waitWritableFinal:d,waitWritableDestroy:p}=Fi(
|
|
840
|
+
e,o,t),{readableEncoding:m,readableObjectMode:f,readableHighWaterMark:h}=Ui(c,a),{read:b,onStdoutDataDone:y}=Bi({subprocessStdout:c,
|
|
841
|
+
subprocess:e,binary:a,encoding:r,preserveNewlines:s}),w=new BS({read:b,...ji(l,e,d),destroy:GS(HS.bind(void 0,{subprocessStdout:c,
|
|
842
|
+
subprocessStdin:l,subprocess:e,waitReadableDestroy:u,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:h,
|
|
843
|
+
writableHighWaterMark:l.writableHighWaterMark,readableObjectMode:f,writableObjectMode:l.writableObjectMode,encoding:m});
|
|
844
|
+
return Gi({subprocessStdout:c,onStdoutDataDone:y,readable:w,subprocess:e,subprocessStdin:l}),Vi(l,w,c),w},HS=async({subprocessStdout:e,
|
|
845
845
|
subprocessStdin:t,subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([
|
|
846
|
-
|
|
847
|
-
s)])};var
|
|
848
|
-
binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return
|
|
849
|
-
t.readable&&t.destroy(),await r}};var
|
|
850
|
-
|
|
851
|
-
e.iterable=
|
|
852
|
-
constructor.prototype,
|
|
853
|
-
e,t,r),{subprocess:
|
|
854
|
-
fileDescriptors:d});return
|
|
855
|
-
|
|
856
|
-
commandArguments:c,options:u}=
|
|
857
|
-
verboseInfo:s,options:l,fileDescriptors:d}},
|
|
858
|
-
nal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},
|
|
859
|
-
options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=
|
|
860
|
-
return
|
|
861
|
-
|
|
862
|
-
kill.bind(c),options:r,onInternalError:
|
|
863
|
-
startTime:n,verboseInfo:o,fileDescriptors:a,originalStreams:l,command:i,escapedCommand:s,context:d,onInternalError:
|
|
864
|
-
return{subprocess:c,promise:
|
|
865
|
-
command:s,escapedCommand:a,context:c,onInternalError:u,controller:l})=>{let[d,[m
|
|
866
|
-
context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:u,controller:l});l.abort(),u.resolve();let
|
|
867
|
-
map((_,A)=>Ee(_,t,A)),
|
|
868
|
-
command:s,escapedCommand:a,startTime:r});return
|
|
869
|
-
context:s,options:a,command:c,escapedCommand:u,startTime:l})=>"error"in e?
|
|
846
|
+
Hi({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},s),zi({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},
|
|
847
|
+
s)])};var Wi=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||J.has(t),s=ut(e,r),a=In({subprocessStdout:s,subprocess:e,
|
|
848
|
+
binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return FS(a,s,e)},FS=async function*(e,t,r){try{yield*e}finally{
|
|
849
|
+
t.readable&&t.destroy(),await r}};var Hd=(e,{encoding:t})=>{let r=kd();e.readable=$d.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=
|
|
850
|
+
Ud.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=Gd.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),
|
|
851
|
+
e.iterable=Wi.bind(void 0,e,t),e[Symbol.asyncIterator]=Wi.bind(void 0,e,t,{})};var Fd=(e,t)=>{for(let[r,n]of VS){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},jS=(async()=>{})().
|
|
852
|
+
constructor.prototype,VS=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(jS,e)]);var jd=(e,t,r,n)=>{let{file:o,commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:u,options:l,fileDescriptors:d}=qS(
|
|
853
|
+
e,t,r),{subprocess:p,promise:m}=KS({file:o,commandArguments:i,options:l,startTime:c,verboseInfo:u,command:s,escapedCommand:a,
|
|
854
|
+
fileDescriptors:d});return p.pipe=Tn.bind(void 0,{source:p,sourcePromise:m,boundOptions:{},createNested:n}),Fd(p,m),me.set(
|
|
855
|
+
p,{options:l,fileDescriptors:d}),p},qS=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=xr(e,t,r),{file:a,
|
|
856
|
+
commandArguments:c,options:u}=Zr(e,t,r),l=YS(u),d=ed(l,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,
|
|
857
|
+
verboseInfo:s,options:l,fileDescriptors:d}},YS=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "sig\
|
|
858
|
+
nal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},KS=({file:e,commandArguments:t,
|
|
859
|
+
options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=WS(...Qr(e,t,r))}catch(f){
|
|
860
|
+
return Ju({error:f,command:i,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let u=new AbortController;
|
|
861
|
+
zS(Number.POSITIVE_INFINITY,u.signal);let l=[...c.stdio];ld(c,a,u),dd(c,r,u);let d={},p=pe();c.kill=Ic.bind(void 0,{kill:c.
|
|
862
|
+
kill.bind(c),options:r,onInternalError:p,context:d,controller:u}),c.all=Id(c,r),Hd(c,r),qu(c,r);let m=JS({subprocess:c,options:r,
|
|
863
|
+
startTime:n,verboseInfo:o,fileDescriptors:a,originalStreams:l,command:i,escapedCommand:s,context:d,onInternalError:p,controller:u});
|
|
864
|
+
return{subprocess:c,promise:m}},JS=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,
|
|
865
|
+
command:s,escapedCommand:a,context:c,onInternalError:u,controller:l})=>{let[d,[p,m],f,h,b]=await xd({subprocess:e,options:t,
|
|
866
|
+
context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:u,controller:l});l.abort(),u.resolve();let y=f.
|
|
867
|
+
map((_,A)=>Ee(_,t,A)),w=Ee(h,t,"all"),R=XS({errorInfo:d,exitCode:p,signal:m,stdio:y,all:w,ipcOutput:b,context:c,options:t,
|
|
868
|
+
command:s,escapedCommand:a,startTime:r});return ft(R,n,t)},XS=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,
|
|
869
|
+
context:s,options:a,command:c,escapedCommand:u,startTime:l})=>"error"in e?zt({error:e.error,command:c,escapedCommand:u,timedOut:s.
|
|
870
870
|
terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.
|
|
871
|
-
terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof
|
|
872
|
-
signal:r,stdio:n,all:o,ipcOutput:i,options:a,startTime:l,isSync:!1}):
|
|
873
|
-
options:a,startTime:l});var
|
|
874
|
-
has(e)&&D(t)&&D(r)?{...t,...r}:r,
|
|
875
|
-
createNested:o},...s);return n!==void 0&&n(i,o,t),i},
|
|
876
|
-
createNested:o},i,...s)=>{if(D(i))return o(e,
|
|
877
|
-
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return l?
|
|
878
|
-
nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=
|
|
879
|
-
commandArguments:d=a,options:
|
|
880
|
-
options:
|
|
881
|
-
length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=
|
|
882
|
-
e);return{file:r,commandArguments:n}},
|
|
883
|
-
e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(
|
|
884
|
-
1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},
|
|
885
|
-
...
|
|
886
|
-
getEachMessage:
|
|
887
|
-
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:u="",timedOut:l=!1,execution:d=null,retryable:
|
|
888
|
-
let
|
|
889
|
-
`)).trim();return{code:C(e),error:C(t),exitCode:
|
|
871
|
+
terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof fe,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,
|
|
872
|
+
signal:r,stdio:n,all:o,ipcOutput:i,options:a,startTime:l,isSync:!1}):ln({command:c,escapedCommand:u,stdio:n,all:o,ipcOutput:i,
|
|
873
|
+
options:a,startTime:l});var Cn=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([n,o])=>[n,ZS(n,e[n],o)]));return{...e,...r}},ZS=(e,t,r)=>QS.
|
|
874
|
+
has(e)&&D(t)&&D(r)?{...t,...r}:r,QS=new Set(["env",...Eo]);var xe=(e,t,r,n)=>{let o=(s,a,c)=>xe(s,a,r,c),i=(...s)=>eE({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,
|
|
875
|
+
createNested:o},...s);return n!==void 0&&n(i,o,t),i},eE=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,
|
|
876
|
+
createNested:o},i,...s)=>{if(D(i))return o(e,Cn(r,i),n);let{file:a,commandArguments:c,options:u,isSync:l}=tE({mapArguments:e,
|
|
877
|
+
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return l?Hu(a,c,u):jd(a,c,u,o)},tE=({mapArguments:e,firstArgument:t,
|
|
878
|
+
nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=ea(t)?ta(t,r):[t,...r],[s,a,c]=_r(...i),u=Cn(Cn(n,o),c),{file:l=s,
|
|
879
|
+
commandArguments:d=a,options:p=u,isSync:m=!1}=e({file:s,commandArguments:a,options:u});return{file:l,commandArguments:d,
|
|
880
|
+
options:p,isSync:m}};var Vd=({file:e,commandArguments:t})=>Wd(e,t),zd=({file:e,commandArguments:t})=>({...Wd(e,t),isSync:!0}),Wd=(e,t)=>{if(t.
|
|
881
|
+
length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=rE(
|
|
882
|
+
e);return{file:r,commandArguments:n}},rE=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(
|
|
883
|
+
e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(nE)){let o=r.at(-1);o&&o.endsWith("\\")?r[r.length-
|
|
884
|
+
1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},nE=/ +/g;var qd=(e,t,r)=>{e.sync=t(oE,r),e.s=e.sync},Yd=({options:e})=>Kd(e),oE=({options:e})=>({...Kd(e),isSync:!0}),Kd=e=>({options:{
|
|
885
|
+
...iE(e),...e}}),iE=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Jd={preferLocal:!0};var Xd=xe(()=>({})),eL=xe(()=>({isSync:!0})),tL=xe(Vd),rL=xe(zd),nL=xe(cl),oL=xe(Yd,{},Jd,qd),{sendMessage:iL,getOneMessage:sL,
|
|
886
|
+
getEachMessage:aL,getCancelSignal:cL}=Yu();function sE(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function Zt({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
887
|
+
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:u="",timedOut:l=!1,execution:d=null,retryable:p=null}={}){
|
|
888
|
+
let m=sE(r),f=String(u||""),h=String(c||""),b=String(o||[f,h].filter(Boolean).join(`
|
|
889
|
+
`)).trim();return{code:C(e),error:C(t),exitCode:m,ok:n===null?m===0:n===!0,output:b,pid:Number.isSafeInteger(Number(s))?
|
|
890
890
|
Number(s):null,signal:C(a),stderr:h,stdout:f,...i==="base64"?{outputEncoding:i}:{},timedOut:l===!0,...d&&typeof d=="obje\
|
|
891
|
-
ct"&&!Array.isArray(d)?{execution:d}:{},...typeof
|
|
892
|
-
d",r={}){let n=C(e)||"Vibe64 command failed.";return
|
|
893
|
-
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}import{spawn as
|
|
894
|
-
async function
|
|
895
|
-
error",i=>o(r,i))})}async function
|
|
896
|
-
n.fd,n.fd]:["ignore","ignore","ignore"],i=
|
|
897
|
-
execution?.id||"";return s&&(
|
|
898
|
-
i.pid),scopeEmpty:!0})})),i.unref?.(),
|
|
891
|
+
ct"&&!Array.isArray(d)?{execution:d}:{},...typeof p=="boolean"?{retryable:p}:{}}}function G(e="",t="vibe64_command_faile\
|
|
892
|
+
d",r={}){let n=C(e)||"Vibe64 command failed.";return Zt({...r,code:t,error:n,exitCode:1,ok:!1,output:C(r.output)||n,stderr:r.
|
|
893
|
+
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}import{spawn as aE}from"node:child_process";import{mkdir as cE,open as lE}from"node:fs/promises";import uE from"node:path";var Pn=new Map,dE=3e3,pE=1e3;async function mE(e=""){return e?(await cE(uE.dirname(e),{recursive:!0}),lE(e,"w",384)):null}
|
|
894
|
+
async function fE(e){return new Promise((t,r)=>{let n=!1,o=(i,s)=>{n||(n=!0,i(s))};e.once?.("spawn",()=>o(t)),e.once?.("\
|
|
895
|
+
error",i=>o(r,i))})}async function ep(e={},{cwd:t="",env:r={}}={}){let n=null;try{n=await mE(e.logPath);let o=n?["ignore",
|
|
896
|
+
n.fd,n.fd]:["ignore","ignore","ignore"],i=aE(e.command,e.args,{cwd:t||void 0,detached:!0,env:r,stdio:o});await fE(i);let s=e.
|
|
897
|
+
execution?.id||"";return s&&(Pn.set(s,{child:i,pid:Number(i.pid)}),i.once?.("exit",()=>{xn(i.pid)||Pn.set(s,{child:i,pid:Number(
|
|
898
|
+
i.pid),scopeEmpty:!0})})),i.unref?.(),Zt({execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:i.
|
|
899
899
|
pid})}catch(o){return G(o?.message||"Detached command failed to start.",o?.code||"vibe64_command_detached_failed",{execution:e.
|
|
900
|
-
execution})}finally{await n?.close?.().catch(()=>null)}}function
|
|
901
|
-
t<=0)return!1;if(process.platform==="win32"){let r=[...
|
|
902
|
-
r?.child?.signalCode===null}try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function
|
|
903
|
-
GTERM"){if(!
|
|
904
|
-
t):process.kill(-Number(e),t),!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function
|
|
905
|
-
now()+Math.max(0,Number(t)||0);for(;
|
|
906
|
-
killTimeoutMs:t=
|
|
907
|
-
n}var
|
|
908
|
-
utf8",signal:u=null,timeout:l=15e3}={}){let d,m,
|
|
909
|
-
return G("Command cancelled.","vibe64_command_cancelled",{execution:o});try{let
|
|
900
|
+
execution})}finally{await n?.close?.().catch(()=>null)}}function xn(e=null){let t=Number(e);if(!Number.isSafeInteger(t)||
|
|
901
|
+
t<=0)return!1;if(process.platform==="win32"){let r=[...Pn.values()].find(n=>n.pid===t);return r?.child?.exitCode===null&&
|
|
902
|
+
r?.child?.signalCode===null}try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function Zd(e=null,t="SI\
|
|
903
|
+
GTERM"){if(!xn(e))return!1;try{return process.platform==="win32"?[...Pn.values()].find(n=>n.pid===Number(e))?.child?.kill?.(
|
|
904
|
+
t):process.kill(-Number(e),t),!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function Qd(e=null,t=0){let r=Date.
|
|
905
|
+
now()+Math.max(0,Number(t)||0);for(;xn(e)&&Date.now()<r;)await new Promise(n=>setTimeout(n,25));return!xn(e)}async function kn(e=null,{
|
|
906
|
+
killTimeoutMs:t=pE,termTimeoutMs:r=dE}={}){Zd(e,"SIGTERM");let n=await Qd(e,r);return n||(Zd(e,"SIGKILL"),n=await Qd(e,t)),
|
|
907
|
+
n}var tp=new Map;async function Je(e="",t=[],{cwd:r="",env:n={},execution:o=null,input:i=void 0,maxBuffer:s=void 0,onOutput:a=null,outputEncoding:c="\
|
|
908
|
+
utf8",signal:u=null,timeout:l=15e3}={}){let d,p,m,f=Promise.withResolvers(),h=()=>{m||=p(),m.then(f.resolve)};if(u?.aborted)
|
|
909
|
+
return G("Command cancelled.","vibe64_command_cancelled",{execution:o});try{let w=Xd(e,t,{all:!0,cwd:r,detached:process.
|
|
910
910
|
platform!=="win32",encoding:c,env:n,extendEnv:!1,input:i,maxBuffer:s,reject:!1,stdin:i==null?"ignore":"pipe",stripFinalNewline:!1,
|
|
911
|
-
timeout:l}),R=Number(
|
|
912
|
-
|
|
913
|
-
u?.aborted&&h(),typeof a=="function"&&
|
|
914
|
-
[
|
|
911
|
+
timeout:l}),R=Number(w.pid),_;p=()=>{if(!_){let S;process.platform!=="win32"?S=kn(R).catch(()=>!1):(w.kill("SIGKILL"),S=
|
|
912
|
+
w.then(()=>!0,()=>!0)),_=S.then(x=>(x||(_=null),x))}return _},o?.id&&tp.set(o.id,p),u?.addEventListener("abort",h,{once:!0}),
|
|
913
|
+
u?.aborted&&h(),typeof a=="function"&&w.all&&w.all.on("data",S=>{try{a(String(S||""))}catch{}});let A=await Promise.race(
|
|
914
|
+
[w,f.promise.then(S=>S?w:{exitCode:1})]),O=typeof A.exitCode=="number"?A.exitCode:1;d=Zt({code:A.timedOut===!0?"vibe64_c\
|
|
915
915
|
ommand_capture_timed_out":A.code?"vibe64_command_capture_failed":"",error:O===0?"":A.shortMessage,exitCode:O,output:A.all||
|
|
916
|
-
(O===0?"":A.shortMessage),outputEncoding:c,signal:A.signal,stderr:A.stderr,stdout:A.stdout,timedOut:A.timedOut===!0,execution:o})}catch(
|
|
917
|
-
d=G(
|
|
918
|
-
outputEncoding:c,signal:
|
|
919
|
-
"abort",h)}if(!await(p
|
|
920
|
-
4_execution_drain_failed",{execution:o,output:d?.output,outputEncoding:c,stderr:d?.stderr,stdout:d?.stdout});o?.id&&
|
|
921
|
-
o.id);let
|
|
922
|
-
outputEncoding:c}):
|
|
923
|
-
for("vibe64.hostProfile"),
|
|
924
|
-
cHelperPath"],
|
|
925
|
-
|
|
926
|
-
function
|
|
927
|
-
throw new TypeError(`Unknown host profile setting: ${t.join(", ")}.`);let r={...
|
|
928
|
-
"string"||r[o]&&!
|
|
916
|
+
(O===0?"":A.shortMessage),outputEncoding:c,signal:A.signal,stderr:A.stderr,stdout:A.stdout,timedOut:A.timedOut===!0,execution:o})}catch(w){
|
|
917
|
+
d=G(w.message,"vibe64_command_capture_failed",{execution:o,exitCode:typeof w.exitCode=="number"?w.exitCode:1,output:w.all,
|
|
918
|
+
outputEncoding:c,signal:w.signal,stderr:w.stderr,stdout:w.stdout,timedOut:w.timedOut===!0})}finally{u?.removeEventListener(
|
|
919
|
+
"abort",h)}if(!await(m||p?.()||!0))return G("The command finished, but its execution scope did not become empty.","vibe6\
|
|
920
|
+
4_execution_drain_failed",{execution:o,output:d?.output,outputEncoding:c,stderr:d?.stderr,stdout:d?.stdout});o?.id&&tp.delete(
|
|
921
|
+
o.id);let y=o&&{...o,state:"finished"};return u?.aborted?G("Command cancelled.","vibe64_command_cancelled",{...d,execution:y,
|
|
922
|
+
outputEncoding:c}):y?{...d,execution:y}:d}import hE from"node:path";import rp from"node:process";import{isMainThread as gE}from"node:worker_threads";var qi=Symbol.
|
|
923
|
+
for("vibe64.hostProfile"),Qt=Symbol.for("vibe64.hostProfile.previousUmask"),bE=["runtimePackRoot","sharedCacheRoot","exe\
|
|
924
|
+
cHelperPath"],Nn=Object.freeze({runtimePackRoot:"",sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1});function np(e){
|
|
925
|
+
gE&&(e&&!(Qt in globalThis)?globalThis[Qt]=rp.umask(7):!e&&Qt in globalThis&&(rp.umask(globalThis[Qt]),delete globalThis[Qt]))}
|
|
926
|
+
function Yi(e=null){if(e===null)return delete globalThis[qi],np(!1),Nn;let t=Object.keys(e).filter(o=>!(o in Nn));if(t.length)
|
|
927
|
+
throw new TypeError(`Unknown host profile setting: ${t.join(", ")}.`);let r={...Nn,...e};for(let o of bE)if(typeof r[o]!=
|
|
928
|
+
"string"||r[o]&&!hE.isAbsolute(r[o]))throw new TypeError(`Host profile ${o} must be an absolute path or empty.`);if(typeof r.
|
|
929
929
|
sharedGroupAccess!="boolean")throw new TypeError("Host profile sharedGroupAccess must be true or false.");let n=Object.freeze(
|
|
930
|
-
r);return globalThis[
|
|
930
|
+
r);return globalThis[qi]=n,np(n.sharedGroupAccess),n}function ce(){return globalThis[qi]||Nn}var wE="vibe64.exec-helper.payload",op=1;function Ki(e=""){let t=String(e||"").trim()||ce().execHelperPath;if(!t){let r=new Error(
|
|
931
931
|
"This computer has no helper for running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}
|
|
932
|
-
function
|
|
933
|
-
operation:i="vibe64-command",args:s=[]}={}){return
|
|
932
|
+
function ip(e={}){return{...e,schema:wE,schemaVersion:op}}function er({actor:e={},command:t="",cwd:r="",env:n={},input:o=void 0,
|
|
933
|
+
operation:i="vibe64-command",args:s=[]}={}){return ip({args:Array.isArray(s)?s.map(a=>String(a)):[],command:t,cwd:r,env:n,
|
|
934
934
|
gid:e.user?.gid,home:e.user?.home,inputBase64:o==null?"":Buffer.isBuffer(o)?o.toString("base64"):Buffer.from(String(o)).
|
|
935
|
-
toString("base64"),operation:i,uid:e.user?.uid,username:e.user?.username})}function
|
|
935
|
+
toString("base64"),operation:i,uid:e.user?.uid,username:e.user?.username})}function tr(e={}){return e.mode==="pty"&&e.envPolicy===
|
|
936
936
|
"auth"&&!["assistant","codex"].includes(e.purpose)?"account-auth-terminal":e.purpose==="codex"&&e.mode==="capture"&&e.envPolicy===
|
|
937
937
|
"auth"||e.purpose==="codex"&&e.mode==="detached"&&e.execution?.kind==="assistant"&&e.execution?.lifecycle==="service"?"c\
|
|
938
938
|
odex-app-server":e.mode==="detached"&&e.execution?.kind==="assistant"&&e.execution?.lifecycle==="service"&&["opencode-ca\
|
|
939
939
|
talog","opencode-server"].includes(e.execution?.operationId)||e.mode==="capture"&&e.execution?.kind==="assistant"&&e.execution?.
|
|
940
940
|
operationId==="opencode-catalog"?"opencode-app-server":e.purpose==="account"?"account-status":e.purpose==="github"?"gith\
|
|
941
941
|
ub-workflow-command":e.purpose==="github-api"?"github-api-command":e.purpose==="workspace-cache"?"workspace-cache-comman\
|
|
942
|
-
d":e.purpose==="health"?"health-status":"vibe64-command"}async function
|
|
943
|
-
outputEncoding:o="utf8",runCapture:i=
|
|
942
|
+
d":e.purpose==="health"?"health-status":"vibe64-command"}async function Ji(e={},{env:t=process.env,helperPath:r="",maxBuffer:n=void 0,
|
|
943
|
+
outputEncoding:o="utf8",runCapture:i=Je,signal:s=null,timeout:a=15e3}={}){let c={env:t,input:`${JSON.stringify(e)}
|
|
944
944
|
`,outputEncoding:o,signal:s,timeout:a};return Number.isSafeInteger(Number(n))&&Number(n)>0&&(c.maxBuffer=Number(n)),i("s\
|
|
945
|
-
udo",["-n",
|
|
946
|
-
in",customScheme:"",appLinkDomains:Object.freeze([])}),
|
|
947
|
-
versionName:"1.0.0"});var
|
|
948
|
-
"metadata","migrations","runtime","vite"]);function
|
|
949
|
-
session?.metadata?.session_git_command_actor_user_key)}async function
|
|
950
|
-
t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:
|
|
945
|
+
udo",["-n",Ki(r),"execute"],c)}import{createRequire as _E}from"node:module";var yE=new URL("./../../../../@jskit-ai/kernel/server/support/symlinkSafeRequire.js",import.meta.url).href;var CL=_E(yE);var xL=Object.freeze(["none","pending","committed","rolledBack","unknown"]);var BL=Object.freeze(["bundled","dev_server"]),GL=Object.freeze(["capacitor"]),HL=Object.freeze({callbackPath:"/auth/log\
|
|
946
|
+
in",customScheme:"",appLinkDomains:Object.freeze([])}),FL=Object.freeze({packageName:"",minSdk:26,targetSdk:35,versionCode:1,
|
|
947
|
+
versionName:"1.0.0"});var l0=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),u0=Object.freeze(["capabilities","kind",
|
|
948
|
+
"metadata","migrations","runtime","vite"]);function TE(e={}){return we(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
949
|
+
session?.metadata?.session_git_command_actor_user_key)}async function ap(e={}){let t=C(e.actor)||"daemon";if(t==="daemon"||
|
|
950
|
+
t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:ho()};let r=TE(e);if(!r){let n=new Error("A user key\
|
|
951
951
|
is required for real-user command execution.");throw n.code="vibe64_command_actor_user_required",n}return{actor:t,credentialScope:"\
|
|
952
|
-
user",requiresRealUser:!0,user:await
|
|
953
|
-
execHelperPath}function
|
|
952
|
+
user",requiresRealUser:!0,user:await zs(r)}}import iv from"node:path";import cp from"node:path";function wt(e={}){let t=Ws();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.user?.gid}function Zi(){return!!ce().
|
|
953
|
+
execHelperPath}function Mn(e={}){return e.requiresRealUser?Zi()||!wt(e):!1}function lp(e={},t={},r=""){if(!e.requiresRealUser)
|
|
954
954
|
return;let n=P(t.session?.sourceRoot||t.session?.sourcePath),o=P(r);if(!n||!o||!Re(n,o))return;let i=new Error("Commands\
|
|
955
955
|
in a session's source must run as the editor's own user, not as a person's account.");throw i.code="vibe64_command_mana\
|
|
956
|
-
ged_source_real_user_forbidden",i}function
|
|
957
|
-
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&
|
|
958
|
-
he resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",i}}var
|
|
956
|
+
ged_source_real_user_forbidden",i}function up(e={},t={}){let r=P(e.user?.home),n=P(t.HOME),o=P(t.VIBE64_CREDENTIAL_HOME);
|
|
957
|
+
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&cp.resolve(r)!==cp.resolve(n)){let i=new Error("Command HOME does not match t\
|
|
958
|
+
he resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",i}}var yt=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
959
959
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
960
|
-
R","VIBE64_MYSQL_USER"]);function
|
|
961
|
-
return t}import{spawnSync as
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
960
|
+
R","VIBE64_MYSQL_USER"]);function rr(...e){let t={};for(let r of e){let n=Z(r);for(let o of yt)n[o]!==void 0&&(t[o]=n[o])}
|
|
961
|
+
return t}import{spawn as IE,spawnSync as AE}from"node:child_process";import{createHash as RE}from"node:crypto";import{statSync as OE}from"node:fs";
|
|
962
|
+
import{stat as gp}from"node:fs/promises";import $n from"node:path";var ke="GIT_AUTHOR_NAME",Ne="GIT_AUTHOR_EMAIL",Me="GIT_COMMITTER_NAME",$e="GIT_COMMITTER_EMAIL",Qi=".users.vibe64.invali\
|
|
963
|
+
d",CE=2e3,bp=["config","--get-regexp","^user\\.(name|email)$"],PE=3e4,xE=['git config --global user.name "Your Name"','g\
|
|
964
|
+
it config --global user.email "you@example.com"'].join(`
|
|
965
|
+
`);function dp(e="",t="vibe64"){return C(e).toLowerCase().replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||
|
|
966
|
+
t}function kE(...e){for(let t of e){let r=B(t),n=B(r.user),o=we(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,
|
|
965
967
|
n.name,n.userName,n.user_name),i=we(r.email,r.userEmail,r.user_email,r.gitUserEmail,r.git_user_email,n.email,n.userEmail,
|
|
966
968
|
n.user_email);if(o&&i)return{authorEmail:i,authorName:o,committerEmail:i,committerName:o,source:"configured"}}return null}
|
|
967
|
-
function
|
|
968
|
-
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"github"}}function
|
|
969
|
-
let r=
|
|
970
|
-
64@${n}${
|
|
971
|
-
return
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
{};
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
n
|
|
982
|
-
|
|
983
|
-
|
|
969
|
+
function NE(e={}){let t=B(e),r=we(t.name,t.displayName,t.login,t.username),n=we(t.email,t.publicEmail,t.verifiedEmail);return!r||
|
|
970
|
+
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"github"}}function ME({workspace:e="",userKey:t=""}={}){
|
|
971
|
+
let r=dp(t,"user"),n=dp(e,"local");return{authorEmail:`${r}@${n}${Qi}`,authorName:`${r} via Vibe64`,committerEmail:`vibe\
|
|
972
|
+
64@${n}${Qi}`,committerName:"Vibe64",source:"fallback"}}function es(e=""){let t=C(e);return t&&$n.isAbsolute(t)?t:""}function pp(e=""){
|
|
973
|
+
let t=es(e);try{return t&&OE(t).isDirectory()?t:""}catch{return""}}async function mp(e=""){let t=es(e);return t&&await gp(
|
|
974
|
+
t).then(r=>r.isDirectory(),()=>!1)?t:""}function wp(e=""){let t={};for(let r of String(e||"").split(`
|
|
975
|
+
`)){let n=/^user\.(name|email)(?: (.*))?$/iu.exec(r);n&&(t[n[1].toLowerCase()]=C(n[2]))}return t}function yp(e,t){return{
|
|
976
|
+
...e?{cwd:e}:{},env:t,stdio:["ignore","pipe","ignore"],timeout:CE}}function fp(e,t){let r=AE("git",bp,{...yp(e,t),encoding:"\
|
|
977
|
+
utf8"});return r.error||r.status!==0&&r.status!==1?null:wp(r.stdout)}function hp(e,t){return new Promise(r=>{let n="",o=!1,
|
|
978
|
+
i=a=>{o||(o=!0,r(a))},s=IE("git",bp,yp(e,t));s.stdout.setEncoding("utf8"),s.stdout.on("data",a=>{n+=a}),s.once("error",()=>i(
|
|
979
|
+
{transient:!0,values:null})),s.once("close",(a,c)=>i(c?{transient:!0,values:null}:{transient:!1,values:a===0||a===1?wp(n):
|
|
980
|
+
null}))})}function _p(e=null){return!e?.name||!e?.email?null:{authorEmail:e.email,authorName:e.name,committerEmail:e.email,
|
|
981
|
+
committerName:e.name,source:"git-config"}}function Sp(e={}){return{...e,PATH:process.env.PATH||e.PATH}}function $E(e={}){
|
|
982
|
+
if(Object.hasOwn(e,"GIT_CONFIG_GLOBAL"))return[String(e.GIT_CONFIG_GLOBAL)];let t=es(e.HOME),r=C(e.XDG_CONFIG_HOME)||(t?
|
|
983
|
+
$n.join(t,".config"):"");return[r?$n.join(r,"git","config"):"",t?$n.join(t,".gitconfig"):""].filter(Boolean)}async function DE(e={}){
|
|
984
|
+
return(await Promise.all($E(e).map(r=>gp(r).then(n=>`${n.ino}:${n.size}:${n.mtimeMs}:${n.ctimeMs}`,()=>"missing")))).join(
|
|
985
|
+
"|")}var _t=new Map;function LE(e,t,r){let n=Object.entries(r).sort(([o],[i])=>o<i?-1:o>i?1:0);return RE("sha256").update(
|
|
986
|
+
JSON.stringify([e,t,n])).digest("hex")}async function UE(e,t,r){let n=e?await hp(e,r):null;if(n?.values)return n;let o=await hp(
|
|
987
|
+
t,r);return{transient:!!(n?.transient||o.transient),values:o.values}}async function BE(e,t,r){let n=LE(e,t,r),o=await DE(
|
|
988
|
+
r),i=Date.now(),s=_t.get(n);if(s&&s.revision===o&&s.expiresAt>i)return(await s.read).values;for(let[u,l]of _t)l.expiresAt<=
|
|
989
|
+
i&&_t.delete(u);let a={expiresAt:i+PE,read:UE(e,t,r),revision:o};_t.set(n,a);let c=await a.read;return c.transient&&_t.get(
|
|
990
|
+
n)===a&&_t.delete(n),c.values}async function GE({cwd:e="",env:t=null}={}){if(!t||typeof t!="object")return null;let[r,n]=await Promise.
|
|
991
|
+
all([mp(e),mp(t.HOME)]);return _p(await BE(r,n,Sp(t)))}function HE({cwd:e="",env:t=null}={}){if(!t||typeof t!="object")return null;
|
|
992
|
+
let r=Sp(t),n=pp(e);return _p(n&&fp(n,r)||fp(pp(t.HOME),r))}function FE(e={}){let t=B(e),r=C(t.name),n=C(t.email);return!r||
|
|
993
|
+
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"git-config"}}function ts(e=""){return C(e).
|
|
994
|
+
toLowerCase().endsWith(Qi)}function Ep({env:e=process.env,personGitIdentity:t=null,project:r={},session:n={}}={}){let o=B(
|
|
995
|
+
n.metadata);return kE(r.gitIdentity,r.config?.git,n.gitIdentity,o.git_identity,{name:e.VIBE64_GIT_USER_NAME,email:e.VIBE64_GIT_USER_EMAIL})||
|
|
996
|
+
FE(t)}function vp({actor:e={},env:t=process.env,project:r={},session:n={},userKey:o=""}={}){let i=B(n.metadata);return NE(
|
|
997
|
+
r.githubUser||n.githubUser||i.github_user)||ME({workspace:we(r.workspace,t.VIBE64_WORKSPACE,t.VIBE64_RUNTIME_NAMESPACE),
|
|
998
|
+
userKey:we(o,e.user?.username,t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.LOGNAME)})}async function Tp(e={}){
|
|
999
|
+
return Ep(e)||await GE(e.gitConfig||{})||vp(e)}function jE(e={}){return Ep(e)||HE(e.gitConfig||{})||vp(e)}function Ip(e){
|
|
1000
|
+
return{[Ne]:e.authorEmail,[ke]:e.authorName,[$e]:e.committerEmail,[Me]:e.committerName}}async function rs(e={}){return Ip(
|
|
1001
|
+
await Tp(e))}function Ap(e={}){return Ip(jE(e))}import{readFileSync as VE}from"node:fs";import Rp from"node:path";import ns from"node:path";var nr=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:["bubblewrap/bin"],
|
|
984
1002
|
managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","package-lock.json"],
|
|
985
1003
|
managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:["composer.json","composer.lock"],managedCommands:[
|
|
986
1004
|
"composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-configuration.json","conanfi\
|
|
@@ -1008,304 +1026,310 @@ i/claude-code/package.json","operator-clis/lib/node_modules/@openai/codex/packag
|
|
|
1008
1026
|
opencode-ai/package.json"],managedCommands:["claude","codex","opencode"]},php:{binDirs:["php/bin"],managedCommands:["php"]},
|
|
1009
1027
|
playwright:{binDirs:["playwright/bin"],identityPaths:["playwright/runtime.env","playwright/browsers"],managedCommands:["\
|
|
1010
1028
|
playwright"]},postgresql:{binDirs:["postgresql/bin"],managedCommands:["initdb","pg_ctl","pg_isready","postgres","psql"]},
|
|
1011
|
-
ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:["sqlite3"]}}),
|
|
1029
|
+
ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:["sqlite3"]}}),os=Object.
|
|
1012
1030
|
freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","bubblewrap","bun","php","\
|
|
1013
1031
|
composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);function H({root:e=""}={}){
|
|
1014
|
-
return P(e||
|
|
1015
|
-
let e=H();return e?[
|
|
1016
|
-
GHT_VERSION",
|
|
1017
|
-
let t=H({root:e});if(!t)return"";let r=
|
|
1018
|
-
let o=n.split(/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!
|
|
1019
|
-
o[0]))throw new Error(`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function
|
|
1020
|
-
let t=H({root:e}),r=P(
|
|
1021
|
-
[
|
|
1022
|
-
ACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"]),
|
|
1023
|
-
for(let t of Object.keys(Z(e)))if(
|
|
1024
|
-
e execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function
|
|
1025
|
-
ion"}={}){let r=Z(e);
|
|
1026
|
-
n:{...n,...
|
|
1032
|
+
return P(e||ce().runtimePackRoot)}function is(e=""){let t=H();return(t?nr[C(e)]?.binDirs||[]:[]).map(n=>ns.join(t,n))}function ss(){
|
|
1033
|
+
let e=H();return e?[ns.join(e,"guard-bin")]:[]}function as(){let e=H();return e?[ns.join(e,"policy-bin")]:[]}var Dn="VIBE64_SHARED_CACHE_ROOT",or="PLAYWRIGHT_BROWSERS_PATH",Ln="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",Un="VIBE64_PLAYWRI\
|
|
1034
|
+
GHT_VERSION",Op="playwright",zE="browsers",WE="runtime.env",qE=/^\d+\.\d+\.\d+$/u;function Cp({runtimePackRoot:e=""}={}){
|
|
1035
|
+
let t=H({root:e});if(!t)return"";let r=Rp.join(t,Op,WE),n;try{n=VE(r,"utf8")}catch(i){if(i?.code==="ENOENT")return"";throw i}
|
|
1036
|
+
let o=n.split(/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!qE.test(
|
|
1037
|
+
o[0]))throw new Error(`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function cs({runtimePackRoot:e=""}={}){
|
|
1038
|
+
let t=H({root:e}),r=P(ce().sharedCacheRoot),n=Cp({runtimePackRoot:t});return{...r?{[Dn]:r}:{},...t?{[or]:Rp.join(t,Op,zE),
|
|
1039
|
+
[Ln]:"1"}:{},...n?{[Un]:n}:{}}}var Pp=new Set(["HOME","LOGNAME","PATH","TMPDIR","USER","VIBE64_EXECUTION_ID","VIBE64_MANAGED_EXECUTION_REQUIRED","XDG_C\
|
|
1040
|
+
ACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"]),YE=new Set([...yt,Ne,ke,$e,Me,or,Ln,Un,Dn]);function St(e={}){
|
|
1041
|
+
for(let t of Object.keys(Z(e)))if(Pp.has(t)||t.startsWith("XDG_")){let r=new Error(`Vibe64 command callers cannot provid\
|
|
1042
|
+
e execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function Bn(e={},{envPolicy:t="sess\
|
|
1043
|
+
ion"}={}){let r=Z(e);St(r);let n=Object.fromEntries(Object.entries(r).filter(([o])=>!YE.has(o)));return t==="deployment"?
|
|
1044
|
+
n:{...n,...rr(r)}}function KE(e=""){let t=P(e);return t==="/home"||t.startsWith("/home/")}function xp({actor:e={},request:t={}}={}){let r=t.
|
|
1027
1045
|
credentialHome||{},n=P(r.home);if(!n)return{};let o=P(e.user?.home);if(e.requiresRealUser&&o&&n!==o){let a=new Error("Co\
|
|
1028
1046
|
mmand credential home must match the resolved real-user actor home.");throw a.code="vibe64_command_credential_home_actor\
|
|
1029
|
-
_mismatch",a}if(!e.requiresRealUser&&
|
|
1047
|
+
_mismatch",a}if(!e.requiresRealUser&&KE(n)&&o&&!Re(o,n)){let a=new Error("A /home credential directory requires a matchi\
|
|
1030
1048
|
ng real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=C(r.username||e.user?.username);
|
|
1031
|
-
return{
|
|
1049
|
+
return{...$t({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...P(r.cacheRoot)?{XDG_CACHE_HOME:P(r.cacheRoot)}:{},...P(r.
|
|
1032
1050
|
configRoot)?{XDG_CONFIG_HOME:P(r.configRoot)}:{},...P(r.dataRoot)?{XDG_DATA_HOME:P(r.dataRoot)}:{},...P(r.stateRoot)?{XDG_STATE_HOME:P(
|
|
1033
|
-
r.stateRoot)}:{}}}import
|
|
1034
|
-
steadOf",value:"ssh://git@github.com/"}]),
|
|
1035
|
-
/env gh auth git-credential"}]),
|
|
1036
|
-
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function
|
|
1037
|
-
r=[];for(let n of Array.isArray(e)?e:[e]){let o=C(n);if(!o||!
|
|
1038
|
-
add(i),r.push(i))}return r}function
|
|
1051
|
+
r.stateRoot)}:{}}}import kp from"node:path";var Np=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"url.https://github.com/.in\
|
|
1052
|
+
steadOf",value:"ssh://git@github.com/"}]),JE=Object.freeze([{key:"credential.https://github.com.helper",value:"!/usr/bin\
|
|
1053
|
+
/env gh auth git-credential"}]),XE=Object.freeze([{key:"credential.https://github.com.helper",value:`!f() { case "$1" in\
|
|
1054
|
+
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function Mp(e=[]){let t=new Set,
|
|
1055
|
+
r=[];for(let n of Array.isArray(e)?e:[e]){let o=C(n);if(!o||!kp.isAbsolute(o))continue;let i=kp.resolve(o);t.has(i)||(t.
|
|
1056
|
+
add(i),r.push(i))}return r}function ir(e={},t=[]){let r={...e&&typeof e=="object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(
|
|
1039
1057
|
String(r.GIT_CONFIG_COUNT||"0"),10),o=Number.isSafeInteger(n)&&n>=0?n:0;for(let i of Array.isArray(t)?t:[]){let s=C(i?.key);
|
|
1040
1058
|
s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),
|
|
1041
|
-
r}function
|
|
1042
|
-
e,
|
|
1043
|
-
return
|
|
1044
|
-
ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}return
|
|
1045
|
-
[
|
|
1046
|
-
-token"?r=
|
|
1047
|
-
[])}import
|
|
1048
|
-
""}function
|
|
1049
|
-
map(C).filter(Boolean)}function
|
|
1050
|
-
try{return
|
|
1051
|
-
function
|
|
1052
|
-
String(e.XDG_DATA_HOME||""))?e.XDG_DATA_HOME:
|
|
1053
|
-
|
|
1054
|
-
".bun/bin"].map(o=>
|
|
1055
|
-
PATH),...
|
|
1056
|
-
/usr/lib/postgresql/${t}/bin`),...
|
|
1057
|
-
map(r=>`${t}/opt/${r}/bin`),`${t}/opt/mariadb/bin`]):[]])]}function
|
|
1058
|
-
runtimes:n=[],shimDirs:o=[]}={}){return
|
|
1059
|
-
...
|
|
1060
|
-
_RUNTIME_DIR"]);function
|
|
1061
|
-
map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!
|
|
1062
|
-
_")&&!t.startsWith("XDG_")))}function
|
|
1063
|
-
env]:[e.project?.runtimeConfigEnv,e.project?.databaseEnv]}function
|
|
1064
|
-
ployment"?(
|
|
1065
|
-
"project"?
|
|
1066
|
-
localPath:r="",request:n={}}={}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=
|
|
1067
|
-
XDG_RUNTIME_DIR||"").trim(),c={
|
|
1068
|
-
n),...
|
|
1069
|
-
{env:u,existingPath:[...
|
|
1070
|
-
[]})
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
e||
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1059
|
+
r}function $p(e=[]){return Mp(e).map(t=>({key:"safe.directory",value:t}))}function ls(e={},t=[]){return ir(e,$p(t))}function Gn(){return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"0",PAGER:"cat"}}function Dp(e={}){return ir(
|
|
1060
|
+
e,Np)}function Lp(e={}){return ir(e,JE)}function ZE(e={}){return ir(e,XE)}function us(e={}){return Lp(Dp(e))}function Up(e={}){
|
|
1061
|
+
return ZE(Dp(e))}var Bp="VIBE64_GIT_AUTH_TOKEN";function QE(e={}){if(!e.gitAuthToken){let t=new Error("Token-backed GitHub transport requ\
|
|
1062
|
+
ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}return Up({...Gn(),GIT_TERMINAL_PROMPT:"0",
|
|
1063
|
+
[Bp]:e.gitAuthToken})}function Gp({request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github\
|
|
1064
|
+
-token"?r=QE(e):(e.gitTransport==="github-https"||e.purpose==="github")&&(r=us({...t,...Gn()})),ls(r,e.gitSafeDirectories||
|
|
1065
|
+
[])}import Hp from"node:path";var ds="NPM_CONFIG_PREFIX";function Fp({env:e={}}={}){return H()?P(e?.[ds])||(P(e?.HOME)?Hp.join(P(e.HOME),".local"):""):
|
|
1066
|
+
""}function ps(e={}){let t=Fp(e);return t?{[ds]:t}:{}}function ms(e={}){let t=Fp(e);return t?[Hp.join(t,"bin")]:[]}import{existsSync as ev,readdirSync as tv}from"node:fs";import rv from"node:os";import De from"node:path";import Et from"node:process";var Hn="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";function sr(e=""){return String(e||"").split(":").
|
|
1067
|
+
map(C).filter(Boolean)}function Vp(e=[]){return e.filter(t=>{try{return ev(t)}catch{return!1}})}function jp(e="",t=/^$/u){
|
|
1068
|
+
try{return tv(e).filter(r=>t.test(r)).sort((r,n)=>Number(/\d+/u.exec(n)?.[0]||0)-Number(/\d+/u.exec(r)?.[0]||0))}catch{return[]}}
|
|
1069
|
+
function nv(e=Et.env){if(H())return[];let t=String(e.HOME||rv.homedir()||"");if(!De.isAbsolute(t))return[];let r=De.isAbsolute(
|
|
1070
|
+
String(e.XDG_DATA_HOME||""))?e.XDG_DATA_HOME:De.join(t,".local/share"),n=De.isAbsolute(String(e.MISE_DATA_DIR||""))?e.MISE_DATA_DIR:
|
|
1071
|
+
De.join(r,"mise");return Vp([De.join(t,".local/bin"),De.join(n,"shims"),...[".claude/local",".opencode/bin",".cargo/bin",
|
|
1072
|
+
".bun/bin"].map(o=>De.join(t,o))])}function ov(){if(H())return[];let e=["/opt/homebrew","/usr/local"];return[...sr(Et.env.
|
|
1073
|
+
PATH),...Et.platform==="darwin"?["/opt/homebrew/bin"]:[],...Vp([...jp("/usr/lib/postgresql",/^\d+$/u).slice(0,1).map(t=>`\
|
|
1074
|
+
/usr/lib/postgresql/${t}/bin`),...Et.platform==="darwin"?e.flatMap(t=>[...jp(`${t}/opt`,/^postgresql@\d+$/u).slice(0,1).
|
|
1075
|
+
map(r=>`${t}/opt/${r}/bin`),`${t}/opt/mariadb/bin`]):[]])]}function zp({env:e=Et.env,existingPath:t="",inheritedPath:r="",
|
|
1076
|
+
runtimes:n=[],shimDirs:o=[]}={}){return Fe([...sr(o.join(":")),...as(),...n.flatMap(i=>is(i)),...ss(),...sr(t||(r?"":e.PATH)),
|
|
1077
|
+
...nv(Et.env),...sr(r),...ov(),...sr(Hn)]).join(":")}var sv=new Set([...yt,Ne,ke,$e,Me,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG\
|
|
1078
|
+
_RUNTIME_DIR"]);function av(e={}){return Object.fromEntries(Object.entries(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).
|
|
1079
|
+
map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!sv.has(t)&&!t.startsWith("GIT_")&&!t.startsWith("GH\
|
|
1080
|
+
_")&&!t.startsWith("XDG_")))}function fs(e={}){return e.envPolicy==="deployment"?[e.project?.deploymentEnv,e.project?.deployment?.
|
|
1081
|
+
env]:[e.project?.runtimeConfigEnv,e.project?.databaseEnv]}function cv(e={}){return fs(e).reduce((t,r)=>e.envPolicy==="de\
|
|
1082
|
+
ployment"?(St(r),{...t,...Z(r)}):{...t,...Bn(r,e)},{})}function lv(e={},t={}){return t.envPolicy==="deployment"?[]:t.envPolicy===
|
|
1083
|
+
"project"?fs(t):[e,...fs(t),t.project?.databaseEnv,t.session?.databaseEnv]}function Wp({actor:e={},baseEnv:t=process.env,
|
|
1084
|
+
localPath:r="",request:n={}}={}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=cs(),s=Bn(n.env,n),a=String(t.
|
|
1085
|
+
XDG_RUNTIME_DIR||"").trim(),c={...$t(e.user,av(t)),...wt(e)&&iv.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...rr(...lv(t,n)),...cv(
|
|
1086
|
+
n),...Gp({actor:e,request:n}),...s,...xp({actor:e,request:n}),...i},u={...c,...ps({env:c}),VIBE64_DECLARED_RUNTIMES:o},l=zp(
|
|
1087
|
+
{env:u,existingPath:[...ms({env:u}),u.PATH].filter(Boolean).join(":"),inheritedPath:r,runtimes:n.runtimes,shimDirs:n.shimDirs||
|
|
1088
|
+
[]});return{...u,PATH:l,...H()?{}:{VIBE64_TOOL_PATH:l}}}function qp({actor:e={},baseEnv:t=process.env,request:r={}}={},n={}){
|
|
1089
|
+
return{actor:e,env:t,gitConfig:{cwd:r.cwd,env:n},personGitIdentity:r.personGitIdentity,project:r.project,session:r.session,
|
|
1090
|
+
userKey:r.userKey}}async function Yp(e={}){let t=Wp(e);return{...t,...await rs(qp(e,t))}}function hs(e={}){let t=Wp(e);return{
|
|
1091
|
+
...t,...e.resolvedGitIdentityEnv||Ap(qp(e,t))}}import{randomUUID as Uv}from"node:crypto";import{mkdirSync as Bv,writeFileSync as Gv}from"node:fs";import Ss from"node:path";import{Buffer as dv}from"node:buffer";import pv from"node:crypto";import{createRequire as mv}from"node:module";var uv=new URL("./../../../vibe64-execution/src/server/engines/terminalSessions.js",import.meta.url).href,Kp=256*1024,fv=300,
|
|
1092
|
+
gs=100,bs=28;var tB=600*1e3,hv=1440*60*1e3,rB=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "}),jn=new Map,gv=mv(uv),bv=new Map;function wv(){return{code:"terminal_session_not_found",error:"Terminal session not found.",ok:!1}}function ys(e=""){return String(
|
|
1093
|
+
e||"default").trim()||"default"}function zn(e){let t=ys(e);return jn.has(t)||jn.set(t,new Map),jn.get(t)}function yv(e="\
|
|
1094
|
+
default"){return bv.get(ys(e))||null}function _v(e="default"){let t=yv(e);return t?{code:t.code,error:t.error,ok:!1}:null}function Sv(e=""){let t=String(e||"");return[...jn.keys()].filter(r=>r.startsWith(t))}function Xp(e){let t=String(e||""),
|
|
1095
|
+
r=t.length;for(let n=0;n<fv&&(r=t.lastIndexOf(`
|
|
1096
|
+
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>Kp&&(t=t.slice(t.length-Kp)),t}function _s(e={}){return e.status===
|
|
1097
|
+
"running"||e.status==="closing"}function Zp(e={}){return _s(e)||e.status==="exited"}function Ev(e={},t=null){if(typeof t!=
|
|
1098
|
+
"function")return!0;try{return t(vt(e))===!0}catch{return!1}}function vv(e=0){let t=Math.floor(Number(e||0));return Number.
|
|
1099
|
+
isFinite(t)&&t>0?t:0}function Tv(e="",{outputLimit:t=0}={}){let r=String(e||""),n=vv(t);return!n||r.length<=n?{output:r,
|
|
1100
|
+
outputTruncated:!1}:{output:r.slice(r.length-n),outputTruncated:!0}}function vt(e,t={}){let r=Tv(e.output,t);return{ok:!0,
|
|
1101
|
+
closeError:e.closeError||"",cols:e.cols||gs,createdAt:e.createdAt||"",id:e.id,commandPreview:e.commandPreview,exitCode:e.
|
|
1082
1102
|
exitCode,inputVersion:e.inputVersion||0,lastInputAt:e.lastInputAt||"",lastInputBytes:e.lastInputBytes||0,lastOutputAt:e.
|
|
1083
1103
|
lastOutputAt||"",lastOutputBytes:e.lastOutputBytes||0,metadata:e.metadata||{},output:r.output,outputTruncated:r.outputTruncated,
|
|
1084
|
-
outputVersion:e.outputVersion||0,rows:e.rows||
|
|
1085
|
-
metadata,type:"metadata"})),
|
|
1086
|
-
e));return!Number.isFinite(t)||t<0?0:Math.min(t,
|
|
1087
|
-
e.lastInputAt),
|
|
1088
|
-
e);return r>0?Math.max(0,Number(t)-r):0}function
|
|
1089
|
-
e.detachedCleanupTimer=null)}function
|
|
1090
|
-
if(r<1)return;let n=Math.max(0,r
|
|
1091
|
-
n)}function
|
|
1104
|
+
outputVersion:e.outputVersion||0,rows:e.rows||bs,status:e.status}}function Iv(e,t={}){return!e||!t||typeof t!="object"||Array.isArray(t)||(e.metadata={...e.metadata||{},...t},ve(e,{metadata:e.
|
|
1105
|
+
metadata,type:"metadata"})),vt(e)}function Av(e=""){return dv.byteLength(String(e||""),"utf8")}function Fn(e=""){let t=Date.parse(String(e||""));return Number.isFinite(t)?t:0}function Vn(e=0){let t=Math.floor(Number(
|
|
1106
|
+
e));return!Number.isFinite(t)||t<0?0:Math.min(t,hv)}function Rv(e={}){return Math.max(Fn(e.lastSubscriberDetachedAt),Fn(
|
|
1107
|
+
e.lastInputAt),Fn(e.lastOutputAt),Fn(e.createdAt))}function Qp(e={},t=Date.now()){if(e?.subscribers?.size)return 0;let r=Rv(
|
|
1108
|
+
e);return r>0?Math.max(0,Number(t)-r):0}function em(e={}){e?.detachedCleanupTimer&&(clearTimeout(e.detachedCleanupTimer),
|
|
1109
|
+
e.detachedCleanupTimer=null)}function ws(e={},t="default"){if(em(e),!Zp(e)||e?.subscribers?.size)return;let r=Vn(e.detachedIdleTimeoutMs);
|
|
1110
|
+
if(r<1)return;let n=Math.max(0,r-Qp(e));e.detachedCleanupTimer=setTimeout(()=>{e.detachedCleanupTimer=null,Lv({namespace:t})},
|
|
1111
|
+
n)}function Ov(e,t=""){let r=Av(t);r<1||(e.outputVersion=Number(e.outputVersion||0)+1,e.lastOutputAt=new Date().toISOString(),
|
|
1092
1112
|
e.lastOutputBytes=r)}function ve(e,t){if(e?.subscribers?.size)for(let r of[...e.subscribers])try{r(t)}catch{e.subscribers.
|
|
1093
|
-
delete(r)}}function
|
|
1094
|
-
function
|
|
1113
|
+
delete(r)}}function Cv(e){let t=String(e?.code||""),r=String(e?.message||e||"Terminal PTY error.");return{code:t,message:r}}
|
|
1114
|
+
function Pv(e,t){if(!e)return;let r=Cv(t);e.lastWriteErrorAt=new Date().toISOString(),e.lastWriteErrorCode=r.code,e.lastWriteError=
|
|
1095
1115
|
r.message,console.warn("Vibe64 terminal PTY write error.",{code:r.code,id:e.id,metadata:e.metadata||{},message:r.message,
|
|
1096
|
-
namespace:e.namespace||""}),ve(e,{code:r.code,error:r.message,type:"error"})}function
|
|
1097
|
-
!t||typeof t.on!="function"||t.on("error",r=>{
|
|
1098
|
-
let n=e?[
|
|
1099
|
-
return o}function
|
|
1100
|
-
r.session,e)).length}function
|
|
1116
|
+
namespace:e.namespace||""}),ve(e,{code:r.code,error:r.message,type:"error"})}function xv(e){let t=e?.terminal?._writeStream;
|
|
1117
|
+
!t||typeof t.on!="function"||t.on("error",r=>{Pv(e,r)})}function tm({namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){
|
|
1118
|
+
let n=e?[ys(e)]:Sv(t),o=[];for(let i of n){let s=zn(i);for(let a of s.values())r&&!_s(a)||o.push({namespace:i,session:a})}
|
|
1119
|
+
return o}function kv({filter:e=null,namespacePrefix:t=""}={}){return tm({namespacePrefix:t,runningOnly:!0}).filter(r=>Ev(
|
|
1120
|
+
r.session,e)).length}function rm(e,t,r=t){let n=`\r
|
|
1101
1121
|
[studio] ${r}\r
|
|
1102
|
-
`;e.closeError=t,e.output=
|
|
1122
|
+
`;e.closeError=t,e.output=Xp(`${e.output}${n}`),ve(e,{chunk:n,type:"output"}),ve(e,{error:t,type:"error"})}async function nm(e,{
|
|
1103
1123
|
code:t,flag:r,hook:n,label:o,payload:i}){if(e[r])return null;e[r]=!0;let s=e[n];if(typeof s!="function")return null;try{
|
|
1104
1124
|
return await s(i),null}catch(a){let c=String(a?.message||a||`${o}.`),u=a instanceof Error?a:new Error(c);return u.code||=
|
|
1105
|
-
t,
|
|
1106
|
-
return e.reportedLifecycleFailures||=new Set,e.reportedLifecycleFailures.has(r)||(e.reportedLifecycleFailures.add(r),
|
|
1107
|
-
e,String(t?.message||t||"Terminal cleanup failed."))),t}function
|
|
1125
|
+
t,rm(e,c,`${o}: ${c}`),u}}function Tt(e,t){let r=`${String(t?.code||"terminal_cleanup_failed")}:${String(t?.message||"")}`;
|
|
1126
|
+
return e.reportedLifecycleFailures||=new Set,e.reportedLifecycleFailures.has(r)||(e.reportedLifecycleFailures.add(r),rm(
|
|
1127
|
+
e,String(t?.message||t||"Terminal cleanup failed."))),t}function Jp(e,t=[]){let r=new AggregateError(t,`Terminal session\
|
|
1108
1128
|
could not close cleanly: ${e.id}`);return r.code=t.some(n=>String(n?.code||"").startsWith("terminal_exit_"))?"terminal_\
|
|
1109
|
-
exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function
|
|
1110
|
-
Promise.resolve().then(()=>
|
|
1111
|
-
top failed",payload:{id:e.id,output:e.output,reason:t,status:e.status}}))),e.stopHookCompletion}function
|
|
1112
|
-
closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>
|
|
1129
|
+
exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function Nv(e,t){return e.stopHookCompletion||(e.stopHookCompletion=
|
|
1130
|
+
Promise.resolve().then(()=>nm(e,{code:"terminal_stop_hook_failed",flag:"stopHookStarted",hook:"onStop",label:"Terminal s\
|
|
1131
|
+
top failed",payload:{id:e.id,output:e.output,reason:t,status:e.status}}))),e.stopHookCompletion}function om(e,t){return e.
|
|
1132
|
+
closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>nm(e,{code:"terminal_close_hook_failed",flag:"clo\
|
|
1113
1133
|
seHookStarted",hook:"onClose",label:"Terminal finalization failed",payload:{exitCode:e.exitCode,id:e.id,output:e.output,
|
|
1114
|
-
reason:t,status:e.status}}))),e.closeHookCompletion}function
|
|
1115
|
-
closeError||"",exitCode:e.exitCode,status:e.status,type:"status"}))}function
|
|
1116
|
-
(async()=>{if(process.platform!=="win32"&&!await
|
|
1134
|
+
reason:t,status:e.status}}))),e.closeHookCompletion}function im(e){e.status!=="exited"&&(e.status="exited",ve(e,{closeError:e.
|
|
1135
|
+
closeError||"",exitCode:e.exitCode,status:e.status,type:"status"}))}function sm(e){return e.scopeDrainCompletion||(e.scopeDrainCompletion=
|
|
1136
|
+
(async()=>{if(process.platform!=="win32"&&!await kn(e.terminal.pid)){let t=new Error(`Terminal execution scope did not b\
|
|
1117
1137
|
ecome empty: ${e.id}`);throw t.code="terminal_execution_drain_failed",t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}
|
|
1118
|
-
async function
|
|
1119
|
-
e.stopHookCompletion])}catch(t){
|
|
1138
|
+
async function Mv(e){try{await e.scopeDrainCompletion}catch(t){Tt(e,t)}try{await Promise.all([om(e,e.stopReason||"exit"),
|
|
1139
|
+
e.stopHookCompletion])}catch(t){Tt(e,t)}im(e)}function am({args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},
|
|
1120
1140
|
maxRunning:i=0,metadata:s=null,namespace:a="default",namespaceLimitPrefix:c="",runningLimitFilter:u=null,onClose:l=null,
|
|
1121
|
-
onOutput:d=null,onStop:
|
|
1122
|
-
|
|
1123
|
-
a;if(_>0&&
|
|
1124
|
-
let O=typeof o=="function"?o({id:
|
|
1125
|
-
ction"?r({args:S,env:O,id:
|
|
1126
|
-
spawn(t,S,{cols:
|
|
1127
|
-
closePromise:null,commandPreview:x,cols:
|
|
1128
|
-
f),exitCompletion:
|
|
1129
|
-
typeof k=="object"&&!Array.isArray(k)?k:{},onClose:l,onStop:
|
|
1141
|
+
onOutput:d=null,onStop:p=null,reuseRunning:m=!1,detachedIdleTimeoutMs:f=0}){let h=_v(a);if(h)return h;let b=zn(a),y=pv.randomUUID(),
|
|
1142
|
+
w=typeof m=="function"?m:()=>!!m,R=m?[...b.values()].find(W=>_s(W)&&w(W)):null;if(R)return vt(R);let _=Number(i||0),A=c||
|
|
1143
|
+
a;if(_>0&&kv({filter:u,namespacePrefix:A})>=_)return{ok:!1,code:"terminal_limit",error:`Terminal limit reached (${_}).`};
|
|
1144
|
+
let O=typeof o=="function"?o({id:y,namespace:a}):o,S=typeof e=="function"?e({env:O,id:y,namespace:a}):e,x=typeof r=="fun\
|
|
1145
|
+
ction"?r({args:S,env:O,id:y,namespace:a}):r,k=typeof s=="function"?s({args:S,env:O,id:y,namespace:a}):s,$=gv("node-pty").
|
|
1146
|
+
spawn(t,S,{cols:gs,cwd:n,env:B(O),name:"xterm-color",rows:bs}),U,ue=new Promise(W=>{U=W}),N={id:y,closeHookCompletion:null,
|
|
1147
|
+
closePromise:null,commandPreview:x,cols:gs,createdAt:new Date().toISOString(),cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:Vn(
|
|
1148
|
+
f),exitCompletion:ue,exitCode:null,lastSubscriberAttachedAt:"",lastSubscriberDetachedAt:new Date().toISOString(),metadata:k&&
|
|
1149
|
+
typeof k=="object"&&!Array.isArray(k)?k:{},onClose:l,onStop:p,inputVersion:0,lastInputAt:"",lastInputBytes:0,lastOutputAt:"",
|
|
1130
1150
|
lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",output:"",outputVersion:0,processExited:!1,
|
|
1131
|
-
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:U,rows:
|
|
1132
|
-
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:$};return
|
|
1151
|
+
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:U,rows:bs,status:"running",stopHookCompletion:null,
|
|
1152
|
+
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:$};return xv(N),$.onData(W=>{if(Ov(N,W),N.output=Xp(N.
|
|
1133
1153
|
output+W),ve(N,{chunk:W,lastOutputAt:N.lastOutputAt,outputVersion:N.outputVersion,type:"output"}),typeof d=="function")try{
|
|
1134
|
-
d({chunk:W,output:N.output,session:
|
|
1135
|
-
"Terminal output hook failed.");ve(N,{error:
|
|
1136
|
-
W,N.status="closing",
|
|
1137
|
-
|
|
1138
|
-
e);return o?
|
|
1139
|
-
nning"&&(e.status="closing",ve(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];if(
|
|
1154
|
+
d({chunk:W,output:N.output,session:vt(N),updateMetadata(be){return Iv(N,be)}})}catch(be){let tt=String(be?.message||be||
|
|
1155
|
+
"Terminal output hook failed.");ve(N,{error:tt,type:"error"})}ws(N,a)}),$.onExit(({exitCode:W})=>{N.processExited=!0,N.exitCode=
|
|
1156
|
+
W,N.status="closing",sm(N),ve(N,{exitCode:W,status:N.status,type:"status"}),om(N,N.stopReason||"exit"),N.resolveExitCompletion(),
|
|
1157
|
+
Mv(N)}),b.set(y,N),ws(N,a),$v(y,{namespace:a})}function $v(e,{namespace:t="default",outputLimit:r=0}={}){let o=zn(t).get(
|
|
1158
|
+
e);return o?vt(o,{outputLimit:r}):wv()}async function Dv(e,t="stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=String(t||"stop"),e.status==="ru\
|
|
1159
|
+
nning"&&(e.status="closing",ve(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];if(Nv(e,e.stopReason),!e.
|
|
1140
1160
|
processExited&&!e.killStarted){e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;let o=n instanceof Error?
|
|
1141
|
-
n:new Error(String(n||"Terminal process could not be killed."));o.code||="terminal_kill_failed",r.push(
|
|
1142
|
-
e)}catch(n){r.push(
|
|
1143
|
-
closePromise;let o=(async()=>{let i=[];if(
|
|
1144
|
-
n,c.failures)}try{await n.exitCompletion}catch(c){i.push(
|
|
1145
|
-
c))}let a=(await Promise.all([n.stopHookCompletion,n.closeHookCompletion])).filter(Boolean);if(n.processExited&&
|
|
1146
|
-
length>0)throw
|
|
1147
|
-
c))}:{}}})();n.closePromise=o;try{return await o}finally{n.closePromise===o&&(n.closePromise=null)}}async function
|
|
1148
|
-
{namespace:t,namespacePrefix:r})){if(!
|
|
1149
|
-
if(a<1&&e==null)continue;if(
|
|
1150
|
-
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=
|
|
1151
|
-
"exec-helper-payloads");return
|
|
1152
|
-
actor:t,cwd:r,env:n,resolveEnv:o}={}){let i=e.terminal||{},s=e.envFactory?o:n;return
|
|
1153
|
-
u=typeof e.args=="function"?e.args(a):e.args,l=
|
|
1154
|
-
s,input:e.input,operation:
|
|
1155
|
-
`,{mode:384}),["-n",
|
|
1156
|
-
command:e.command,cwd:r,env:s}}async function
|
|
1157
|
-
execution?.id||"",a=
|
|
1161
|
+
n:new Error(String(n||"Terminal process could not be killed."));o.code||="terminal_kill_failed",r.push(Tt(e,o))}}try{await sm(
|
|
1162
|
+
e)}catch(n){r.push(Tt(e,n))}return{failures:r}}async function cm(e,{namespace:t="default"}={}){let r=zn(t),n=r.get(e);if(!n)return{ok:!0,closed:!1};if(n.closePromise)return n.
|
|
1163
|
+
closePromise;let o=(async()=>{let i=[];if(em(n),!n.processExited){let c=await Dv(n,"close");if(c.failures.length)throw Jp(
|
|
1164
|
+
n,c.failures)}try{await n.exitCompletion}catch(c){i.push(Tt(n,c))}try{await n.scopeDrainCompletion}catch(c){i.push(Tt(n,
|
|
1165
|
+
c))}let a=(await Promise.all([n.stopHookCompletion,n.closeHookCompletion])).filter(Boolean);if(n.processExited&&im(n),i.
|
|
1166
|
+
length>0)throw Jp(n,[...i,...a]);return r.delete(e),{ok:!0,closed:!0,...a.length>0?{cleanupErrors:a.map(c=>String(c?.message||
|
|
1167
|
+
c))}:{}}})();n.closePromise=o;try{return await o}finally{n.closePromise===o&&(n.closePromise=null)}}async function Lv({idleMs:e=null,namespace:t="",namespacePrefix:r="",now:n=Date.now()}={}){let o=0;for(let{namespace:i,session:s}of tm(
|
|
1168
|
+
{namespace:t,namespacePrefix:r})){if(!Zp(s)||s.subscribers?.size)continue;let a=e==null?Vn(s.detachedIdleTimeoutMs):Vn(e);
|
|
1169
|
+
if(a<1&&e==null)continue;if(Qp(s,n)<a){ws(s,i);continue}(await cm(s.id,{namespace:i})).closed&&(o+=1)}return{ok:!0,closed:o}}var lm=new Map;function Hv(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper payload root is required fo\
|
|
1170
|
+
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=Ss.join(Ss.resolve(t),
|
|
1171
|
+
"exec-helper-payloads");return Bv(r,{mode:448,recursive:!0}),Ss.join(r,`${process.pid}-${Date.now()}-${Uv()}.json`)}function Fv(e={},{
|
|
1172
|
+
actor:t,cwd:r,env:n,resolveEnv:o}={}){let i=e.terminal||{},s=e.envFactory?o:n;return Mn(t)?{args:(a={})=>{let c=Hv(i.helperPayloadRoot),
|
|
1173
|
+
u=typeof e.args=="function"?e.args(a):e.args,l=er({actor:t,args:u,command:e.command,cwd:r,env:typeof s=="function"?s(a):
|
|
1174
|
+
s,input:e.input,operation:tr(e)});return Gv(c,`${JSON.stringify(l)}
|
|
1175
|
+
`,{mode:384}),["-n",Ki(),"execute",c]},command:"sudo",cwd:i.helperPayloadRoot,env:{PATH:process.env.PATH||Hn}}:{args:e.args,
|
|
1176
|
+
command:e.command,cwd:r,env:s}}async function um(e={},{actor:t,cwd:r,env:n,resolveEnv:o}={}){try{let i=e.terminal||{},s=e.
|
|
1177
|
+
execution?.id||"",a=Fv(e,{actor:t,cwd:r,env:n,resolveEnv:o}),c=am({args:a.args,command:a.command,commandPreview:i.commandPreview,
|
|
1158
1178
|
cwd:a.cwd,detachedIdleTimeoutMs:i.detachedIdleTimeoutMs,env:a.env,maxRunning:i.maxRunning,metadata:i.metadata,namespace:i.
|
|
1159
1179
|
namespace,namespaceLimitPrefix:i.namespaceLimitPrefix,onClose:async u=>{try{typeof i.onClose=="function"&&await i.onClose(
|
|
1160
|
-
u)}finally{s&&
|
|
1161
|
-
reuseRunning,runningLimitFilter:i.runningLimitFilter});return c?.ok===!0&&s&&
|
|
1180
|
+
u)}finally{s&&lm.set(s,{id:u.id,namespace:i.namespace,scopeEmpty:!0})}},onOutput:i.onOutput,onStop:i.onStop,reuseRunning:i.
|
|
1181
|
+
reuseRunning,runningLimitFilter:i.runningLimitFilter});return c?.ok===!0&&s&&lm.set(s,{id:c.id,namespace:i.namespace}),c?.
|
|
1162
1182
|
ok===!0?{...c,execution:e.execution}:c}catch(i){return G(i?.message||"Vibe64 PTY command failed.",i?.code||"vibe64_comma\
|
|
1163
|
-
nd_pty_failed",{execution:e.execution})}}import{realpathSync as
|
|
1164
|
-
[t]).map(P).filter(Boolean);if(n.length===0)return r;let o=n.filter(s=>Re(s,r));if(o.length>0){let s=
|
|
1165
|
-
|
|
1166
|
-
outside_allowed_roots",i}import{randomUUID as
|
|
1167
|
-
ex","github","github-api","source-editor","preview","output","deployment","health","workspace-cache","source"]),
|
|
1168
|
-
freeze(["capture","pty","detached"]),
|
|
1169
|
-
"auth","deployment"]),
|
|
1170
|
-
control","job","preview","service","terminal"]),
|
|
1183
|
+
nd_pty_failed",{execution:e.execution})}}import{realpathSync as dm}from"node:fs";function jv(e=""){return P(e||process.cwd())}function pm(e="",{allowedRoots:t=[]}={}){let r=jv(e),n=(Array.isArray(t)?t:
|
|
1184
|
+
[t]).map(P).filter(Boolean);if(n.length===0)return r;let o=n.filter(s=>Re(s,r));if(o.length>0){let s=dm(r);if(o.some(a=>Re(
|
|
1185
|
+
dm(a),s)))return s}let i=new Error("Vibe64 command cwd is outside the allowed roots.");throw i.code="vibe64_command_cwd_\
|
|
1186
|
+
outside_allowed_roots",i}import{randomUUID as Vv}from"node:crypto";var zv=Object.freeze(["daemon","owner-user","named-user","app"]),Wv=Object.freeze(["account","assistant","terminal","cod\
|
|
1187
|
+
ex","github","github-api","source-editor","preview","output","deployment","health","workspace-cache","source"]),qv=Object.
|
|
1188
|
+
freeze(["capture","pty","detached"]),Yv=Object.freeze(["utf8","base64"]),Kv=Object.freeze(["session","project","preview",
|
|
1189
|
+
"auth","deployment"]),Jv=Object.freeze(["none","github-https","github-token"]),fm=Object.freeze(["assistant","browser","\
|
|
1190
|
+
control","job","preview","service","terminal"]),hm=Object.freeze(["finite","interactive","service"]),Xv=1e3*1e3*100,Zv=new Set(
|
|
1171
1191
|
["assistant","codex","deployment","output","preview","source","terminal"]);function te(e="",t="vibe64_command_request_in\
|
|
1172
|
-
valid"){let r=new Error(e||"Invalid Vibe64 command request.");return r.code=t,r}function
|
|
1192
|
+
valid"){let r=new Error(e||"Invalid Vibe64 command request.");return r.code=t,r}function Le(e="",t=[],r="",n="value"){let o=C(
|
|
1173
1193
|
e)||r;if(!t.includes(o))throw te(`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);
|
|
1174
|
-
return o}function
|
|
1194
|
+
return o}function Qv(e=[],{mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw te("Function-valued command\
|
|
1175
1195
|
args are only supported for PTY commands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?
|
|
1176
|
-
e:[e]).map(r=>String(r??""))}function
|
|
1196
|
+
e:[e]).map(r=>String(r??""))}function eT(e={},{mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw te("Fun\
|
|
1177
1197
|
ction-valued command env is only supported for PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},
|
|
1178
|
-
envFactory:e}}let r=Z(e);return
|
|
1179
|
-
Boolean)}function
|
|
1198
|
+
envFactory:e}}let r=Z(e);return St(r),{env:r,envFactory:null}}function Es(e=[]){return(Array.isArray(e)?e:[e]).map(P).filter(
|
|
1199
|
+
Boolean)}function tT(e={}){let t=B(e);return{commandPreview:t.commandPreview,detachedIdleTimeoutMs:t.detachedIdleTimeoutMs,
|
|
1180
1200
|
helperPayloadRoot:P(t.helperPayloadRoot),maxRunning:t.maxRunning,metadata:t.metadata,namespace:C(t.namespace),namespaceLimitPrefix:C(
|
|
1181
1201
|
t.namespaceLimitPrefix),onClose:t.onClose,onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.
|
|
1182
|
-
runningLimitFilter}}function
|
|
1202
|
+
runningLimitFilter}}function rT(e={}){let t=B(e),r=P(t.home||t.toolHomeSource);return r?{cacheRoot:P(t.cacheRoot),configRoot:P(
|
|
1183
1203
|
t.configRoot),dataRoot:P(t.dataRoot),gid:Number.isSafeInteger(Number(t.gid??t.hostGid))?Number(t.gid??t.hostGid):null,home:r,
|
|
1184
1204
|
scope:C(t.scope),stateRoot:P(t.stateRoot),uid:Number.isSafeInteger(Number(t.uid??t.hostUid))?Number(t.uid??t.hostUid):null,
|
|
1185
|
-
username:C(t.username||t.ownerUserKey||t.userKey)}:{}}function
|
|
1186
|
-
"interactive":"finite"}function
|
|
1187
|
-
"terminal":"job"}function
|
|
1188
|
-
test(t))throw te(`Invalid Vibe64 execution identifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function
|
|
1189
|
-
mode:t="capture",project:r={},purpose:n="terminal",session:o={}}={}){let i=B(e),s=
|
|
1190
|
-
xecution_kind"),a=
|
|
1205
|
+
username:C(t.username||t.ownerUserKey||t.userKey)}:{}}function nT(e="capture"){return e==="detached"?"service":e==="pty"?
|
|
1206
|
+
"interactive":"finite"}function oT({mode:e="capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?
|
|
1207
|
+
"terminal":"job"}function It(e=""){let t=C(e);if(!t)return"";if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.
|
|
1208
|
+
test(t))throw te(`Invalid Vibe64 execution identifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function gm(e={},{
|
|
1209
|
+
mode:t="capture",project:r={},purpose:n="terminal",session:o={}}={}){let i=B(e),s=Le(i.kind,fm,oT({mode:t,purpose:n}),"e\
|
|
1210
|
+
xecution_kind"),a=Le(i.lifecycle,hm,nT(t),"execution_lifecycle");if(t==="detached"&&a!=="service"||t==="pty"&&a!=="inter\
|
|
1191
1211
|
active"||t==="capture"&&a!=="finite")throw te(`Execution lifecycle ${a} is incompatible with command mode ${t}.`,"vibe64\
|
|
1192
|
-
_execution_lifecycle_incompatible");let c=
|
|
1212
|
+
_execution_lifecycle_incompatible");let c=It(i.ownerId||o.sessionId||o.id);if(a==="service"&&!c)throw te("Service execut\
|
|
1193
1213
|
ion requires a durable owner id.","vibe64_execution_owner_required");let u=i.resourceProfile;if(u!=null&&(!u||typeof u!=
|
|
1194
1214
|
"object"||Object.keys(u).some(l=>!["key","compatibilityKey","environment"].includes(l))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.
|
|
1195
1215
|
test(u.key||"")||!/^[a-f0-9]{64}$/u.test(u.compatibilityKey||"")||!["development","test","production"].includes(u.environment)))
|
|
1196
1216
|
throw te("Invalid activity resource profile identity.","vibe64_resource_profile_invalid");return Object.freeze({...u?{resourceProfile:Object.
|
|
1197
|
-
freeze({...u})}:{},controlGenerationId:
|
|
1198
|
-
""?{}:{workflowId:
|
|
1199
|
-
parentExecutionId:
|
|
1200
|
-
o.sessionId||o.id)})}function
|
|
1217
|
+
freeze({...u})}:{},controlGenerationId:It(i.controlGenerationId),...i.workflowId===void 0||i.workflowId===null||i.workflowId===
|
|
1218
|
+
""?{}:{workflowId:iT(i.workflowId)},id:Vv(),kind:s,label:C(i.label),lifecycle:a,operationId:It(i.operationId),ownerId:c,
|
|
1219
|
+
parentExecutionId:It(i.parentExecutionId),projectSlug:It(i.projectSlug||r.slug||r.projectSlug),sessionId:It(i.sessionId||
|
|
1220
|
+
o.sessionId||o.id)})}function iT(e){if(typeof e!="string"||!/^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/iu.
|
|
1201
1221
|
test(e))throw te("Execution requires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}
|
|
1202
|
-
function
|
|
1203
|
-
let r=
|
|
1204
|
-
o)?o:[o]).map(C).filter(Boolean))}function
|
|
1205
|
-
ibe64_command_required");let n=
|
|
1222
|
+
function sT(e=""){return Zv.has(e)?os:[]}function mm(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function aT(e={},t=""){
|
|
1223
|
+
let r=mm(e,"runtimes"),n=mm(e,"runtime");if(!r&&!n)return Fe(sT(t));let o=r?e.runtimes:e.runtime;return Fe((Array.isArray(
|
|
1224
|
+
o)?o:[o]).map(C).filter(Boolean))}function bm(e={}){let t=B(e),r=C(t.command);if(!r)throw te("A command is required.","v\
|
|
1225
|
+
ibe64_command_required");let n=Le(t.mode,qv,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!==
|
|
1206
1226
|
"capture"))throw te("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=Z(t.
|
|
1207
|
-
baseEnv),i=
|
|
1227
|
+
baseEnv),i=eT(t.env,{mode:n}),s=Le(t.purpose,Wv,"terminal","purpose"),a=aT(t,s);for(let d of a)if(!Object.hasOwn(nr,d))throw te(
|
|
1208
1228
|
`Unsupported Vibe64 runtime: ${d}.`,"vibe64_command_runtime_unsupported");let c=B(t.project),u=B(t.session),l=t.releaseEnvironmentFile??
|
|
1209
1229
|
"";if(typeof l!="string"||l&&(!l.startsWith("/")||/[\r\n\0]/u.test(l)||n!=="capture"||t.actor!=="app"||t.envPolicy!=="de\
|
|
1210
1230
|
ployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw te("Release environment files require a\
|
|
1211
|
-
finite application deployment command without caller Env.","vibe64_command_release_environment_invalid");return{actor:
|
|
1212
|
-
t.actor,
|
|
1213
|
-
cwd()),env:i.env,envFactory:i.envFactory,envPolicy:
|
|
1214
|
-
t.execution,{mode:n,project:c,purpose:s,session:u}),credentialHome:
|
|
1215
|
-
t.gitSafeDirectories),personGitIdentity:{email:C(t.personGitIdentity?.email),name:C(t.personGitIdentity?.name)},gitTransport:
|
|
1216
|
-
t.gitTransport,
|
|
1217
|
-
maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&Number(t.maxBuffer)>0?Number(t.maxBuffer):
|
|
1218
|
-
onOutput=="function"?t.onOutput:null,outputEncoding:
|
|
1219
|
-
runtimes:a,session:u,signal:t.signal??null,shimDirs:
|
|
1220
|
-
Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,userKey:C(t.userKey)}}var
|
|
1231
|
+
finite application deployment command without caller Env.","vibe64_command_release_environment_invalid");return{actor:Le(
|
|
1232
|
+
t.actor,zv,"daemon","actor"),allowedRoots:Es(t.allowedRoots),args:Qv(t.args,{mode:n}),baseEnv:o,command:r,cwd:P(t.cwd||process.
|
|
1233
|
+
cwd()),env:i.env,envFactory:i.envFactory,envPolicy:Le(t.envPolicy,Kv,"session","env_policy"),releaseEnvironmentFile:l,execution:gm(
|
|
1234
|
+
t.execution,{mode:n,project:c,purpose:s,session:u}),credentialHome:rT(t.credentialHome),gitAuthToken:C(t.gitAuthToken),gitSafeDirectories:Es(
|
|
1235
|
+
t.gitSafeDirectories),personGitIdentity:{email:C(t.personGitIdentity?.email),name:C(t.personGitIdentity?.name)},gitTransport:Le(
|
|
1236
|
+
t.gitTransport,Jv,"none","git_transport"),inheritProcessEnv:!l&&t.inheritProcessEnv!==!1,input:t.input,logPath:P(t.logPath),
|
|
1237
|
+
maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&Number(t.maxBuffer)>0?Number(t.maxBuffer):Xv,mode:n,onOutput:typeof t.
|
|
1238
|
+
onOutput=="function"?t.onOutput:null,outputEncoding:Le(t.outputEncoding,Yv,"utf8","output_encoding"),project:c,purpose:s,
|
|
1239
|
+
runtimes:a,session:u,signal:t.signal??null,shimDirs:Es(t.shimDirs),terminal:tT(t.terminal),timeout:Number.isSafeInteger(
|
|
1240
|
+
Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,userKey:C(t.userKey)}}var cT=null,wm="VIBE64_MANAGED_EXECUTION_REQUIRED";function vs(){return cT}function Wn(e=process.env){return["1","true"].includes(String(e?.[wm]||"").trim().toLowerCase())}async function lT(e,{actor:t,cwd:r,env:n,requiresHelper:o,resolveEnv:i}={}){return e.releaseEnvironmentFile?G("Release e\
|
|
1221
1241
|
nvironment execution requires a managed host.","vibe64_release_environment_unavailable",{execution:e.execution}):e.mode===
|
|
1222
|
-
"pty"?
|
|
1242
|
+
"pty"?um(e,{actor:t,cwd:r,env:n,resolveEnv:i}):e.mode==="detached"?t.requiresRealUser&&(!wt(t)||o)?G("Detached real-user\
|
|
1223
1243
|
command execution is unsupported when the helper is required.","vibe64_command_detached_real_user_unsupported",{execution:e.
|
|
1224
|
-
execution}):
|
|
1225
|
-
operation:
|
|
1226
|
-
execution}:
|
|
1227
|
-
outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function M(e={}){let t=null;try{if(t=
|
|
1228
|
-
aborted)return G("Command cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await
|
|
1229
|
-
{...process.env,...t.baseEnv}:{...t.baseEnv},o=(
|
|
1230
|
-
env),a=
|
|
1231
|
-
request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t}))
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
G("Release environment
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
import
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
e.worktreePath
|
|
1248
|
-
|
|
1244
|
+
execution}):ep(e,{actor:t,cwd:r,env:n}):o?{...await Ji(er({actor:t,args:e.args,command:e.command,cwd:r,env:n,input:e.input,
|
|
1245
|
+
operation:tr(e)}),{maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout}),execution:e.
|
|
1246
|
+
execution}:Je(e.command,e.args,{cwd:r,env:n,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,onOutput:e.onOutput,
|
|
1247
|
+
outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function M(e={}){let t=null;try{if(t=bm(e),t.signal?.
|
|
1248
|
+
aborted)return G("Command cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await ap(t),n=t.inheritProcessEnv?
|
|
1249
|
+
{...process.env,...t.baseEnv}:{...t.baseEnv},o=(b={})=>({...b,VIBE64_EXECUTION_ID:t.execution.id}),i=vs(),s=Wn(n)||Wn(process.
|
|
1250
|
+
env),a=Mn(r),u=!(!!i||s||Zi())&&wt(r)?[n.PATH,process.env.PATH].filter(Boolean).join(":"):"",l=o(await Yp({actor:r,baseEnv:n,
|
|
1251
|
+
localPath:u,request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t})),d=Object.fromEntries([Ne,ke,$e,Me].map(b=>[
|
|
1252
|
+
b,l[b]]));up(r,l);let p=pm(t.cwd,{allowedRoots:t.allowedRoots});lp(r,t,p);let m=(b={})=>typeof t.args=="function"?t.args(
|
|
1253
|
+
b):t.args,f=(b={})=>o(t.envFactory?hs({actor:r,baseEnv:n,localPath:u,resolvedGitIdentityEnv:d,request:{...t,env:t.envFactory(
|
|
1254
|
+
b),envFactory:null}}):l),h=(b=t,y={})=>lT(b,{actor:r,cwd:p,env:l,requiresHelper:a,resolveEnv:f,...y});return i?await i.runCommand(
|
|
1255
|
+
t,{actor:r,baseEnv:n,cwd:p,env:l,resolveArgs:m,resolveEnv:f,runLocal:h}):t.releaseEnvironmentFile?G("Release environment\
|
|
1256
|
+
execution requires a managed host.","vibe64_release_environment_unavailable",{execution:t.execution}):s?G("Managed exec\
|
|
1257
|
+
ution safety is unavailable. Vibe64 did not start this work.","vibe64_managed_execution_provider_unavailable",{execution:t.
|
|
1258
|
+
execution,retryable:!1}):h()}catch(r){return G(r?.message||"Vibe64 command failed.",r?.code||"vibe64_command_failed",{execution:t?.
|
|
1259
|
+
execution})}}import{createHash as dT}from"node:crypto";import{lstat as Sm,mkdir as pT,mkdtemp as mT,readdir as fT,rm as Em,statfs as hT}from"node:fs/promises";
|
|
1260
|
+
import re from"node:path";import{fileURLToPath as gT}from"node:url";var uT=new URL("./../../../vibe64-execution/src/server/gitTurnCheckpoint.js",import.meta.url).href,bT=3e4;var KB=gT(new URL("./gitTurnCheckpointCommand.js",uT)),wT=15*6e4,yT=512*1024*1024,_T=1024*1024*1024,vm=new Set(["cancell\
|
|
1261
|
+
ed","completed","failed","interrupted"]),qn=new Map;async function ar({outerTurnId:e="",outcome:t="completed",project:r={},
|
|
1262
|
+
runCommand:n=M,sessionId:o="",temporaryDiskBudgetBytes:i,temporaryDiskReserveBytes:s,timestamp:a="",worktreePath:c=""}={}){
|
|
1263
|
+
let u=AT({outerTurnId:e,outcome:t,sessionId:o,timestamp:a,worktreePath:c}),l=Ts(u);return Im(u.worktreePath,()=>ST({identity:u,
|
|
1264
|
+
project:r,refs:l,runCommand:n,temporaryDiskBudgetBytes:i,temporaryDiskReserveBytes:s}))}async function ST({identity:e={},project:t={},refs:r={},runCommand:n=M,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i}={}){
|
|
1265
|
+
let s=await At(n,e.worktreePath,["rev-parse","--verify",r.turnRef],{project:t});if(s)return _m({commit:s,identity:e,project:t,
|
|
1266
|
+
refs:r,runCommand:n});let a=await X(n,e.worktreePath,["rev-parse","--verify","HEAD"],{project:t}),c=await Tm({baseCommit:a,
|
|
1267
|
+
project:t,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:e.worktreePath}),u=await Pm(n,
|
|
1268
|
+
e.worktreePath,{project:t});for(let l=0;;l+=1){let d=await At(n,e.worktreePath,["rev-parse","--verify",r.latestRef],{project:t}),
|
|
1269
|
+
p=d||a,m=await X(n,e.worktreePath,["commit-tree",c,"-p",p],{env:RT(e.timestamp),input:Cm(e),project:t});try{await X(n,e.
|
|
1249
1270
|
worktreePath,["update-ref","--stdin"],{input:`start
|
|
1250
|
-
create ${r.turnRef} ${
|
|
1251
|
-
update ${r.latestRef} ${
|
|
1271
|
+
create ${r.turnRef} ${m}
|
|
1272
|
+
update ${r.latestRef} ${m} ${d||u}
|
|
1252
1273
|
prepare
|
|
1253
1274
|
commit
|
|
1254
|
-
`,project:t})}catch(f){let h=await
|
|
1255
|
-
identity:e,project:t,refs:r,runCommand:n});let
|
|
1256
|
-
if(l>=2||
|
|
1275
|
+
`,project:t})}catch(f){let h=await At(n,e.worktreePath,["rev-parse","--verify",r.turnRef],{project:t});if(h)return _m({commit:h,
|
|
1276
|
+
identity:e,project:t,refs:r,runCommand:n});let b=await At(n,e.worktreePath,["rev-parse","--verify",r.latestRef],{project:t});
|
|
1277
|
+
if(l>=2||b===d)throw f;continue}return{baseCommit:p,commit:m,created:!0,latestRef:r.latestRef,ok:!0,outerTurnId:e.outerTurnId,
|
|
1257
1278
|
outcome:e.outcome,sessionId:e.sessionId,tree:c,turnRef:r.turnRef}}}async function q({baseCommit:e="HEAD",paths:t=[],project:r={},
|
|
1258
|
-
runCommand:n=M,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=
|
|
1259
|
-
treePath"));return
|
|
1260
|
-
worktreePath:a}))}async function
|
|
1261
|
-
temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=
|
|
1262
|
-
absolute-git-dir"],{project:r}),u=
|
|
1263
|
-
tree-")),d=
|
|
1264
|
-
isArray(t)?t.map(f=>String(f||"")).filter(Boolean):[];return await
|
|
1265
|
-
temporaryDiskReserveBytes:i,worktreePath:a}),await X(n,a,["add","-A","--",...
|
|
1266
|
-
1"},project:r}),await X(n,a,["write-tree"],{env:
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
""
|
|
1279
|
+
runCommand:n=M,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=re.resolve(Xe(s,"work\
|
|
1280
|
+
treePath"));return Im(a,()=>Tm({baseCommit:e,paths:t,project:r,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,
|
|
1281
|
+
worktreePath:a}))}async function Tm({baseCommit:e="HEAD",paths:t=[],project:r={},runCommand:n=M,temporaryDiskBudgetBytes:o,
|
|
1282
|
+
temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=re.resolve(Xe(s,"worktreePath")),c=await X(n,a,["rev-parse","--\
|
|
1283
|
+
absolute-git-dir"],{project:r}),u=re.join(c,"vibe64-checkpoints");await pT(u,{recursive:!0}),await ET(u);let l=await mT(
|
|
1284
|
+
re.join(u,".tree-")),d=re.join(l,"index");try{let p={GIT_INDEX_FILE:d};await X(n,a,["read-tree",e||"HEAD"],{env:p,project:r});
|
|
1285
|
+
let m=Array.isArray(t)?t.map(f=>String(f||"")).filter(Boolean):[];return await vT({gitDirectory:c,paths:m,project:r,runCommand:n,
|
|
1286
|
+
temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:a}),await X(n,a,["add","-A","--",...m.length>0?m:["."]],
|
|
1287
|
+
{env:{...p,GIT_LITERAL_PATHSPECS:"1"},project:r}),await X(n,a,["write-tree"],{env:p,project:r})}finally{await Em(l,{force:!0,
|
|
1288
|
+
recursive:!0})}}async function ET(e=""){let t=Date.now(),r=await fT(e,{withFileTypes:!0});await Promise.all(r.filter(n=>n.
|
|
1289
|
+
isDirectory()&&n.name.startsWith(".tree-")).map(async n=>{let o=re.join(e,n.name),i=await Sm(o).catch(()=>null);i?.isDirectory()&&
|
|
1290
|
+
t-i.mtimeMs>wT&&await Em(o,{force:!0,recursive:!0})}))}function Im(e="",t=async()=>null){let r=re.resolve(e),o=(qn.get(r)||
|
|
1291
|
+
Promise.resolve()).catch(()=>null).then(t),i=o.then(()=>null,()=>null).finally(()=>{qn.get(r)===i&&qn.delete(r)});return qn.
|
|
1292
|
+
set(r,i),o}async function vT({gitDirectory:e="",paths:t=[],project:r={},runCommand:n=M,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,
|
|
1293
|
+
worktreePath:s=""}={}){let a=t.length>0?t:["."],[c,u,l]=await Promise.all([X(n,s,["diff","--name-only","-z","HEAD","--",
|
|
1294
|
+
...a],{project:r}),X(n,s,["ls-files","--others","--exclude-standard","-z","--",...a],{project:r}),hT(e)]),d=[...new Set(
|
|
1295
|
+
[...ym(c),...ym(u)])],p=[];for(let _ of d){let A=re.resolve(s,_),O=re.relative(s,A);if(O===".."||O.startsWith(`..${re.sep}`)||
|
|
1296
|
+
re.isAbsolute(O))throw Ze("Git returned a checkpoint candidate outside the session source.","vibe64_checkpoint_candidate\
|
|
1297
|
+
_invalid");let S=await Sm(A).catch(x=>x?.code==="ENOENT"?null:Promise.reject(x));S?.isFile()&&p.push({bytes:Number(S.size||
|
|
1298
|
+
0),path:O})}let m=p.reduce((_,A)=>_+A.bytes,0),f=Math.min(Number.MAX_SAFE_INTEGER,m*2),h=TT(o),b=IT(i),y=Math.max(0,Number(
|
|
1299
|
+
l.bavail)*Number(l.bsize)),w=Math.min(h,Math.max(0,y-b));if(f<=w)return;let R=p.sort((_,A)=>A.bytes-_.bytes||_.path.localeCompare(
|
|
1300
|
+
A.path)).slice(0,5).map(_=>`${_.path} (${_.bytes} bytes)`).join(", ");throw Ze([`Vibe64 refused this checkpoint because \
|
|
1301
|
+
changed, unignored files may need about ${f} temporary bytes; the safe budget is ${w} bytes.`,R?`Largest candidates: ${R}\
|
|
1302
|
+
.`:"","Keep needed files in place and add generated or local-only artifacts to .gitignore, or ask an operator to review \
|
|
1303
|
+
the checkpoint disk budget."].filter(Boolean).join(" "),"vibe64_checkpoint_disk_budget_exceeded")}function ym(e=""){return String(
|
|
1304
|
+
e||"").split("\0").filter(Boolean)}function TT(e){return Am(e,process.env.VIBE64_CHECKPOINT_TEMPORARY_DISK_BUDGET_BYTES,
|
|
1305
|
+
yT,1)}function IT(e){return Am(e,process.env.VIBE64_CHECKPOINT_DISK_RESERVE_BYTES,_T,0)}function Am(e,t,r,n){let o=e==null||
|
|
1306
|
+
e===""?t:e,i=Number(o===void 0||o===""?r:o);return Number.isSafeInteger(i)&&i>=n?i:r}async function _m({commit:e="",identity:t={},
|
|
1283
1307
|
project:r={},refs:n={},runCommand:o=M}={}){let i=await X(o,t.worktreePath,["show","-s","--format=%B",e],{project:r}),s=[
|
|
1284
|
-
...
|
|
1308
|
+
...vm].find(u=>i===Cm({...t,outcome:u}).trim());if(!s)throw Ze("Existing Vibe64 turn checkpoint does not match its durab\
|
|
1285
1309
|
le turn identity.","vibe64_checkpoint_identity_mismatch");let a=await X(o,t.worktreePath,["rev-parse",`${e}^{tree}`],{project:r});
|
|
1286
|
-
if(!await
|
|
1310
|
+
if(!await At(o,t.worktreePath,["rev-parse","--verify",n.latestRef],{project:r})){let u=await Pm(o,t.worktreePath,{project:r});
|
|
1287
1311
|
await X(o,t.worktreePath,["update-ref",n.latestRef,e,u],{project:r})}return{baseCommit:await X(o,t.worktreePath,["rev-pa\
|
|
1288
1312
|
rse",`${e}^`],{project:r}),commit:e,created:!1,latestRef:n.latestRef,ok:!0,outerTurnId:t.outerTurnId,outcome:s,sessionId:t.
|
|
1289
|
-
sessionId,tree:a,turnRef:n.turnRef}}function
|
|
1290
|
-
let i=
|
|
1291
|
-
"vibe64_checkpoint_outcome_invalid");let s=
|
|
1292
|
-
eckpoint timestamp must be an ISO date.","vibe64_checkpoint_timestamp_invalid");let a=
|
|
1293
|
-
outerTurnId:
|
|
1294
|
-
function
|
|
1295
|
-
return`refs/vibe64/checkpoints/${
|
|
1296
|
-
function
|
|
1313
|
+
sessionId,tree:a,turnRef:n.turnRef}}function AT({outerTurnId:e="",outcome:t="completed",sessionId:r="",timestamp:n="",worktreePath:o=""}={}){
|
|
1314
|
+
let i=Xe(t,"outcome").toLowerCase();if(!vm.has(i))throw Ze(`Unsupported Vibe64 turn checkpoint outcome: ${i||"(empty)"}.`,
|
|
1315
|
+
"vibe64_checkpoint_outcome_invalid");let s=Xe(n,"timestamp");if(!Number.isFinite(Date.parse(s)))throw Ze("Vibe64 turn ch\
|
|
1316
|
+
eckpoint timestamp must be an ISO date.","vibe64_checkpoint_timestamp_invalid");let a=re.resolve(Xe(o,"worktreePath"));return{
|
|
1317
|
+
outerTurnId:Xe(e,"outerTurnId"),outcome:i,sessionId:Xe(r,"sessionId"),timestamp:new Date(s).toISOString(),worktreePath:a}}
|
|
1318
|
+
function Ts(e={}){let t=Rm(e.sessionId),r=Om(e.outerTurnId);return{latestRef:`${t}/latest`,turnRef:`${t}/${r}`}}function Rm(e=""){
|
|
1319
|
+
return`refs/vibe64/checkpoints/${Om(e)}`}function Om(e=""){return dT("sha256").update(String(e)).digest("hex").slice(0,32)}
|
|
1320
|
+
function Cm(e={}){return[`vibe64 checkpoint: session ${e.sessionId} turn ${e.outerTurnId}`,"","Vibe64-Checkpoint: true",
|
|
1297
1321
|
`Vibe64-Session: ${e.sessionId}`,`Vibe64-Outer-Turn: ${e.outerTurnId}`,`Vibe64-Turn-Outcome: ${e.outcome}`,""].join(`
|
|
1298
|
-
`)}function
|
|
1299
|
-
e,t,["rev-parse","--show-object-format"],{project:r});return"0".repeat(n==="sha256"?64:40)}async function
|
|
1300
|
-
let o=await
|
|
1301
|
-
r,n);if(o.ok!==!0)throw
|
|
1302
|
-
"vibe64_checkpoint_git_failed");return String(o.stdout||"").trim()}function
|
|
1322
|
+
`)}function RT(e=""){return{GIT_AUTHOR_DATE:e,GIT_COMMITTER_DATE:e}}async function Pm(e,t,{project:r={}}={}){let n=await At(
|
|
1323
|
+
e,t,["rev-parse","--show-object-format"],{project:r});return"0".repeat(n==="sha256"?64:40)}async function At(e,t,r,n={}){
|
|
1324
|
+
let o=await xm(e,t,r,n);return o.ok===!0?String(o.stdout||"").trim():""}async function X(e,t,r,n={}){let o=await xm(e,t,
|
|
1325
|
+
r,n);if(o.ok!==!0)throw Ze(String(o.stderr||o.stdout||o.output||o.error||"Git checkpoint command failed.").trim(),o.code||
|
|
1326
|
+
"vibe64_checkpoint_git_failed");return String(o.stdout||"").trim()}function xm(e,t,r,{env:n={},input:o,project:i={}}={}){
|
|
1303
1327
|
return e({actor:"daemon",allowedRoots:[t],args:r,command:"git",cwd:t,env:n,envPolicy:"session",gitSafeDirectories:[t],input:o,
|
|
1304
|
-
mode:"capture",project:i,purpose:"source",runtimes:["git"],timeout:
|
|
1305
|
-
trim(),n=Array.from(r).some(o=>{let i=o.codePointAt(0);return i<=31||i===127});if(!r||r.length>512||n)throw
|
|
1328
|
+
mode:"capture",project:i,purpose:"source",runtimes:["git"],timeout:bT})}function Xe(e="",t="value"){let r=String(e||"").
|
|
1329
|
+
trim(),n=Array.from(r).some(o=>{let i=o.codePointAt(0);return i<=31||i===127});if(!r||r.length>512||n)throw Ze(`Vibe64 t\
|
|
1306
1330
|
urn checkpoint ${t} is invalid.`,`vibe64_checkpoint_${t.replaceAll(/[^A-Za-z0-9]+/gu,"_").toLowerCase()}_invalid`);return r}
|
|
1307
|
-
function
|
|
1308
|
-
darwin:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),
|
|
1331
|
+
function Ze(e="",t="vibe64_checkpoint_failed"){let r=new Error(e||"Vibe64 turn checkpoint failed.");return r.code=t,r}var OT=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"]);var t4=Object.freeze({linux:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-linux.md",
|
|
1332
|
+
darwin:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),Yn=Object.freeze(
|
|
1309
1333
|
{claude:{name:"Claude Code",run:[["claude"]],guideUrl:"https://code.claude.com/docs/en/setup",any:"curl -fsSL https://cl\
|
|
1310
1334
|
aude.ai/install.sh | bash"},codex:{name:"Codex",run:[["codex"]],guideUrl:"https://github.com/openai/codex",any:"curl -fs\
|
|
1311
1335
|
SL https://chatgpt.com/codex/install.sh | sh"},opencode:{name:"opencode",run:[["opencode"]],guideUrl:"https://opencode.a\
|
|
@@ -1329,7 +1353,7 @@ h -c "$(curl -fsSL https://php.new/install/linux)"',brew:'/bin/bash -c "$(curl -
|
|
|
1329
1353
|
name:"Build tools",setup:"build-tools",run:[["cc","gcc","clang"],["make"]],guideUrl:"https://guides.rubyonrails.org/inst\
|
|
1330
1354
|
all_ruby_on_rails.html",detail:"Some packages compile native code, so they need a compiler and a few libraries.",apt:"su\
|
|
1331
1355
|
do apt install build-essential pkg-config libyaml-dev libssl-dev zlib1g-dev libpq-dev default-libmysqlclient-dev libgmp-\
|
|
1332
|
-
dev",brew:"brew install pkg-config libyaml openssl@3 gmp"}}),
|
|
1356
|
+
dev",brew:"brew install pkg-config libyaml openssl@3 gmp"}}),r4=Object.freeze({composer:"php"});var Mm="backups.git",$m="vibe64-atomic",PT=`backup_canonical_ref() {
|
|
1333
1357
|
vibe64_backup_repository="$1"
|
|
1334
1358
|
vibe64_source_repository="$2"
|
|
1335
1359
|
vibe64_source_ref="$3"
|
|
@@ -1347,13 +1371,13 @@ r "$vibe64_backup_repository" rev-parse --verify "$vibe64_backup_ref"
|
|
|
1347
1371
|
' "$vibe64_source_ref" >&2
|
|
1348
1372
|
return 1
|
|
1349
1373
|
fi
|
|
1350
|
-
}`,
|
|
1374
|
+
}`,c4=`#!/bin/sh
|
|
1351
1375
|
set -eu
|
|
1352
1376
|
|
|
1353
1377
|
zero_object=0000000000000000000000000000000000000000
|
|
1354
1378
|
git_dir="$(git rev-parse --absolute-git-dir)"
|
|
1355
1379
|
repository_root="$(dirname "$git_dir")"
|
|
1356
|
-
backup_repository="$repository_root/${
|
|
1380
|
+
backup_repository="$repository_root/${Mm}"
|
|
1357
1381
|
if [ -L "$repository_root" ] || [ -L "$backup_repository" ] || [ -L "$repository_root/mutation.lock" ]; then
|
|
1358
1382
|
printf '[vibe64] Canonical repository storage must not use symlinked role paths.
|
|
1359
1383
|
' >&2
|
|
@@ -1362,7 +1386,7 @@ fi
|
|
|
1362
1386
|
exec 8>"$repository_root/mutation.lock"
|
|
1363
1387
|
flock -x 8
|
|
1364
1388
|
|
|
1365
|
-
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${
|
|
1389
|
+
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${$m}" ]; then
|
|
1366
1390
|
printf '[vibe64] Canonical repository pushes must use the Vibe64 atomic mutation path.
|
|
1367
1391
|
' >&2
|
|
1368
1392
|
exit 1
|
|
@@ -1373,7 +1397,7 @@ if [ "$(git --git-dir "$backup_repository" rev-parse --is-bare-repository 2>/dev
|
|
|
1373
1397
|
exit 1
|
|
1374
1398
|
fi
|
|
1375
1399
|
|
|
1376
|
-
${
|
|
1400
|
+
${PT}
|
|
1377
1401
|
|
|
1378
1402
|
updates_file="$(mktemp "$repository_root/.pre-receive.XXXXXX")"
|
|
1379
1403
|
cleanup_updates_file() {
|
|
@@ -1421,7 +1445,7 @@ while read -r old_object _new_object ref_name; do
|
|
|
1421
1445
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
1422
1446
|
fi
|
|
1423
1447
|
done <"$updates_file"
|
|
1424
|
-
`,
|
|
1448
|
+
`,Dm=`set -euo pipefail
|
|
1425
1449
|
mirror_path="$1"
|
|
1426
1450
|
remote_url="$2"
|
|
1427
1451
|
|
|
@@ -1509,7 +1533,7 @@ case "$remote_head_ref" in
|
|
|
1509
1533
|
esac
|
|
1510
1534
|
printf '[studio] Refreshed GitHub mirror for %s.
|
|
1511
1535
|
' "$remote_url"
|
|
1512
|
-
`;function
|
|
1536
|
+
`;function Is({mirrorPath:e="",remoteUrl:t=""}={}){return["bash","-c",Dm,"vibe64-github-mirror-refresh",e,t]}var h4=new URL("./../../../vibe64-execution/src/server/runtime/agentPreviewBrowserWorkerSource.js",import.meta.url).href;var kT=["Usage:"," vibe64-helper preview ensure [--target <target-id>] [--wait] [--json] [--timeout-ms <ms>]"," vibe64\
|
|
1513
1537
|
-helper preview targets [--json]"," vibe64-helper preview status [--json]"," vibe64-helper preview stop [--json]"," v\
|
|
1514
1538
|
ibe64-helper preview inspect-url"," vibe64-helper preview screenshot [--output <path>]"," vibe64-helper preview browse\
|
|
1515
1539
|
r ensure"," vibe64-helper preview browser eval < playwright-code.js"," vibe64-helper preview browser identity <default\
|
|
@@ -1543,141 +1567,141 @@ for the configured primary application.","Do not start a duplicate copy of that
|
|
|
1543
1567
|
t secondary application explicitly requested by the user, such as a reference app, may run separately without replacing \
|
|
1544
1568
|
this preview."].join(`
|
|
1545
1569
|
`)+`
|
|
1546
|
-
`;import{fileURLToPath as
|
|
1547
|
-
engines/stdioBridge.js",
|
|
1570
|
+
`;import{fileURLToPath as LT}from"node:url";var DT=new URL("./../../../vibe64-execution/src/server/conversationExecution.js",import.meta.url).href,T4=LT(new URL("./\
|
|
1571
|
+
engines/stdioBridge.js",DT));var P4=["skip=$1; version=$2; shift 2",'for name in "$@"; do',' found=$(command -v -- "$name" 2>/dev/null) || continue',
|
|
1548
1572
|
" case $found in /*) ;; *) continue ;; esac",' if [ -n "$skip" ]; then case $found in /usr/bin/*) continue ;; esac; fi',
|
|
1549
1573
|
` printf '%s\\n' "$found"`,' exec "$found" $version 2>&1',"done","exit 127"].join(`
|
|
1550
|
-
`);var
|
|
1551
|
-
e,Object.freeze({name:t,guideUrl:r,install:n})]})));import{execFile as
|
|
1552
|
-
if(t===void 0)return null;let r;try{r=JSON.parse(t)}catch{}if(!
|
|
1574
|
+
`);var BT=Object.freeze(Object.fromEntries(["claude","codex","opencode"].map(e=>{let{name:t,guideUrl:r,any:n}=Yn[e];return[
|
|
1575
|
+
e,Object.freeze({name:t,guideUrl:r,install:n})]})));import{execFile as GT}from"node:child_process";import{promisify as HT}from"node:util";var L4=HT(GT);import lf from"node:crypto";function Ue(e){return String(e??"").trim()}function Kn(e){return e&&typeof e=="object"&&!Array.isArray(e)}var V="github",Qe="managed_git",F="local_source";var KG=Object.freeze({GITHUB:V,MANAGED_GIT:Qe,LOCAL_SOURCE:F});function lr(e=""){let t=Ue(e).toLowerCase().replace(/[-\s]+/gu,"_");return t===V||t===Qe||t===F?t:""}function cr(e="",t=""){let r=new Error(t);return r.code=e,r}function Rt(e={}){let t=e?.metadata?.connected_contribution;
|
|
1576
|
+
if(t===void 0)return null;let r;try{r=JSON.parse(t)}catch{}if(!Kn(r)||r.schemaVersion!==1||Object.keys(r).some(n=>!["sch\
|
|
1553
1577
|
emaVersion","id","repository","integrationBranch","baseCommit","replaces"].includes(n))||!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u.
|
|
1554
1578
|
test(r.id||"")||Object.hasOwn(r,"replaces")&&(typeof r.replaces!="string"||r.replaces===r.id||!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u.
|
|
1555
|
-
test(r.replaces||""))||typeof r.repository!="string"||!/^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+$/u.test(r.repository)||!
|
|
1579
|
+
test(r.replaces||""))||typeof r.repository!="string"||!/^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+$/u.test(r.repository)||!As(r.integrationBranch)||
|
|
1556
1580
|
r.integrationBranch.startsWith("vibe64-incoming/")||typeof r.baseCommit!="string"||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/iu.
|
|
1557
|
-
test(r.baseCommit))throw
|
|
1581
|
+
test(r.baseCommit))throw cr("vibe64_contribution_authority_invalid","This contribution's saved source is invalid. Preser\
|
|
1558
1582
|
ve its checkout and inspect its binding before saving.");return{...r,repository:r.repository.toLowerCase(),baseCommit:r.
|
|
1559
|
-
baseCommit.toLowerCase()}}function
|
|
1560
|
-
let t=e.metadata?.connected_submissions;if(t===void 0)return[];let r;try{r=JSON.parse(t)}catch{}let n=()=>
|
|
1583
|
+
baseCommit.toLowerCase()}}function jT(e){return Rt({metadata:{connected_contribution:JSON.stringify(e)}})}function Lm(e={}){
|
|
1584
|
+
let t=e.metadata?.connected_submissions;if(t===void 0)return[];let r;try{r=JSON.parse(t)}catch{}let n=()=>cr("vibe64_con\
|
|
1561
1585
|
nected_submissions_invalid","This session's connected Save bindings are invalid. Preserve the session and inspect its bi\
|
|
1562
|
-
ndings before saving.");if(!
|
|
1563
|
-
ersion","submissions"].includes(i)))throw n();let o=new Set;return r.submissions.map(i=>{if(!
|
|
1586
|
+
ndings before saving.");if(!Kn(r)||r.schemaVersion!==1||!Array.isArray(r.submissions)||Object.keys(r).some(i=>!["schemaV\
|
|
1587
|
+
ersion","submissions"].includes(i)))throw n();let o=new Set;return r.submissions.map(i=>{if(!Kn(i)||Object.keys(i).some(
|
|
1564
1588
|
a=>!["contribution","submittedCommit"].includes(a))||typeof i.submittedCommit!="string"||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/iu.
|
|
1565
|
-
test(i.submittedCommit))throw n();let s=
|
|
1566
|
-
submittedCommit:i.submittedCommit.toLowerCase()}})}function
|
|
1567
|
-
github?.fullName).toLowerCase();if(t.metadata.github_pull_request||t.metadata.repository_branch||
|
|
1568
|
-
repository?.mode)!==V||c!==n.repository||e.repository?.defaultBranch!==n.integrationBranch)throw
|
|
1589
|
+
test(i.submittedCommit))throw n();let s=jT(i.contribution);if(!s||o.has(s.id))throw n();return o.add(s.id),{contribution:s,
|
|
1590
|
+
submittedCommit:i.submittedCommit.toLowerCase()}})}function Rs(e={},t={},{sourcePreparation:r=!1}={}){let n=Rt(t);if(n){let c=Ue(e.githubRepository?.fullName||e.repository?.
|
|
1591
|
+
github?.fullName).toLowerCase();if(t.metadata.github_pull_request||t.metadata.repository_branch||lr(e.repositoryMode||e.
|
|
1592
|
+
repository?.mode)!==V||c!==n.repository||e.repository?.defaultBranch!==n.integrationBranch)throw cr("vibe64_contribution\
|
|
1569
1593
|
_authority_changed","This contribution's repository or integration branch changed. Review its source binding before savi\
|
|
1570
1594
|
ng.");return{...e,githubMirrorOptional:!0,repository:{...e.repository,defaultBranch:r?n.replaces&&!t.metadata.renewed_from?
|
|
1571
1595
|
`vibe64-incoming/${n.replaces}_discarded`:n.integrationBranch:`vibe64-incoming/${n.id}`}}}let o=t?.metadata?.github_pull_request;
|
|
1572
|
-
if(!o){let c=t?.metadata?.repository_branch;if(c&&
|
|
1596
|
+
if(!o){let c=t?.metadata?.repository_branch;if(c&&lr(e.repositoryMode||e.repository?.mode)!==F){if(!As(c))throw cr("vibe\
|
|
1573
1597
|
64_session_branch_invalid","This session's repository branch is invalid.");return{...e,repository:{...e.repository,defaultBranch:c}}}
|
|
1574
|
-
return e}let i;try{i=JSON.parse(o)}catch{}let s=
|
|
1575
|
-
i.baseRepository!==s||!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u.test(i.headRepository||"")||!
|
|
1576
|
-
|
|
1598
|
+
return e}let i;try{i=JSON.parse(o)}catch{}let s=Ue(e.githubRepository?.fullName||e.repository?.github?.fullName);if(!i||
|
|
1599
|
+
i.baseRepository!==s||!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u.test(i.headRepository||"")||!As(i.headBranch)||e.repositoryMode===
|
|
1600
|
+
Qe)throw cr("vibe64_pull_request_authority_invalid","This session's pull request source is invalid. Its Save destination\
|
|
1577
1601
|
could not be verified.");let a={fullName:i.headRepository,cloneUrl:`https://github.com/${i.headRepository}.git`};return{
|
|
1578
1602
|
...e,githubMirrorPath:i.headRepository===s?e.githubMirrorPath:"",githubRepository:a,repositoryMode:V,repository:{mode:V,
|
|
1579
|
-
defaultBranch:i.headBranch,github:a}}}function
|
|
1603
|
+
defaultBranch:i.headBranch,github:a}}}function As(e){return typeof e=="string"&&e.length>0&&e.length<=255&&!["@","HEAD"].
|
|
1580
1604
|
includes(e)&&!e.startsWith("-")&&!e.endsWith(".")&&!/[\s~^:?*[\\]/u.test(e)&&!e.includes("..")&&!e.includes("@{")&&![...e].
|
|
1581
|
-
some(t=>t.charCodeAt(0)<32||t.charCodeAt(0)===127)&&e.split("/").every(t=>t&&!t.startsWith(".")&&!t.endsWith(".lock"))}function
|
|
1582
|
-
let r=
|
|
1605
|
+
some(t=>t.charCodeAt(0)<32||t.charCodeAt(0)===127)&&e.split("/").every(t=>t&&!t.startsWith(".")&&!t.endsWith(".lock"))}function Um(e={},t={}){
|
|
1606
|
+
let r=Rs(e,t),n=lr(r.repositoryMode||r.repository?.mode),o=r.slug||r.projectSlug,i=r.repository?.defaultBranch;return n===
|
|
1583
1607
|
V?o=r.githubRepository?.fullName||r.repository?.github?.fullName:n===F&&(o=r.sourceRoot,i=t?.metadata?.local_source_branch||
|
|
1584
|
-
i),{sessionId:
|
|
1585
|
-
e||"").trim()}function
|
|
1586
|
-
continue;let i
|
|
1587
|
-
t[n+4]),commit:o,isMerge:i.length>1,message
|
|
1588
|
-
let n=Number.parseInt(String(e??""),10);return Number.isSafeInteger(n)&&n>0?Math.min(n,r):t}function
|
|
1589
|
-
e||"").split("\0"),r=new Map;for(let n=0;n<t.length;){let o
|
|
1590
|
-
s&&r.set(s,{path:s,...i?{previousPath:i}:{},status:o.slice(0,1)})}return r}function
|
|
1591
|
-
let r=Number.parseInt(t,10);return Number.isSafeInteger(r)&&r>=0?r:0}function
|
|
1608
|
+
i),{sessionId:Ue(t.sessionId||t.id),mode:n,repository:Ue(o),branch:Ue(i)}}import xs from"node:crypto";import{mkdtemp as Xm,rm as Zm}from"node:fs/promises";import le from"node:path";import{fileURLToPath as qT}from"node:url";import Bm from"node:path";var Hm="%H%x00%P%x00%an%x00%ae%x00%aI%x00%s",Os=200,Fm=500,Jn=800,VT=5e3;function Be(e=""){return String(
|
|
1609
|
+
e||"").trim()}function jm(e=""){let t=String(e||"").split("\0"),r=[];for(let n=0;n+5<t.length;n+=6){let o=Be(t[n]);if(!o)
|
|
1610
|
+
continue;let i=Be(t[n+1]).split(/\s+/u).filter(Boolean);r.push({author:Be(t[n+2]),authorEmail:Be(t[n+3]),committedAt:Be(
|
|
1611
|
+
t[n+4]),commit:o,isMerge:i.length>1,message:Be(t[n+5]),parents:i,shortCommit:o.slice(0,8)})}return r}function Vm(e,t,r){
|
|
1612
|
+
let n=Number.parseInt(String(e??""),10);return Number.isSafeInteger(n)&&n>0?Math.min(n,r):t}function Cs(e=""){let t=String(
|
|
1613
|
+
e||"").split("\0"),r=new Map;for(let n=0;n<t.length;){let o=Be(t[n++]);if(!o)continue;let i=/^[CR]/u.test(o)?t[n++]:"",s=t[n++];
|
|
1614
|
+
s&&r.set(s,{path:s,...i?{previousPath:i}:{},status:o.slice(0,1)})}return r}function Gm(e=""){let t=Be(e);if(t==="-")return null;
|
|
1615
|
+
let r=Number.parseInt(t,10);return Number.isSafeInteger(r)&&r>=0?r:0}function zT(e=""){let t=String(e||"").split("\0"),r=new Map;
|
|
1592
1616
|
for(let n=0;n<t.length;){let o=t[n++];if(!o)continue;let i=o.indexOf(" "),s=o.indexOf(" ",i+1),a=o.slice(s+1),c=!a;c&&(n+=
|
|
1593
|
-
1);let u=c?t[n++]:a;u&&r.set(u,{added:
|
|
1594
|
-
t);return[...
|
|
1595
|
-
function
|
|
1596
|
-
10)||0);return{items:e.slice(s,s+i),limit:i,offset:s,totalCount:e.length,truncated:s+i<e.length}}function
|
|
1617
|
+
1);let u=c?t[n++]:a;u&&r.set(u,{added:Gm(o.slice(0,i)),deleted:Gm(o.slice(i+1,s))})}return r}function zm(e="",t=""){let r=zT(
|
|
1618
|
+
t);return[...Cs(e).values()].map(n=>({...n,...r.get(n.path)||{added:0,deleted:0}})).sort((n,o)=>n.path.localeCompare(o.path))}
|
|
1619
|
+
function Wm(e,{offset:t=0,limit:r,defaultLimit:n,maxLimit:o}){let i=Vm(r,n,o),s=Math.max(0,Number.parseInt(String(t??""),
|
|
1620
|
+
10)||0);return{items:e.slice(s,s+i),limit:i,offset:s,totalCount:e.length,truncated:s+i<e.length}}function qm(e="",t){let r=String(
|
|
1597
1621
|
e||"").replaceAll(`\r
|
|
1598
1622
|
`,`
|
|
1599
1623
|
`).split(`
|
|
1600
|
-
`),n=
|
|
1601
|
-
`),lineLimit:n,shownLines:Math.min(r.length,n),totalLines:r.length,truncated:r.length>n}}function
|
|
1602
|
-
e||"");if(!t||t.includes("\0")||
|
|
1603
|
-
assign(new Error("Choose a changed project file."),{code:"vibe64_session_change_path_invalid",details:{}});return t}function
|
|
1604
|
-
let t=e.replace(/[*?[\]\\]/gu,"\\$&");return[`:(literal)${e}`,`:(glob,exclude)${t}/**`]}var
|
|
1605
|
-
new URL("./sessionWorkOperationCommand.js",
|
|
1606
|
-
test(String(e??""))}function
|
|
1607
|
-
e||"").trim()}function
|
|
1608
|
-
r))}function
|
|
1624
|
+
`),n=Vm(t,Jn,VT);return{diff:r.slice(0,n).join(`
|
|
1625
|
+
`),lineLimit:n,shownLines:Math.min(r.length,n),totalLines:r.length,truncated:r.length>n}}function Ps(e=""){let t=String(
|
|
1626
|
+
e||"");if(!t||t.includes("\0")||Bm.posix.isAbsolute(t)||Bm.posix.normalize(t)!==t||t===".."||t.startsWith("../"))throw Object.
|
|
1627
|
+
assign(new Error("Choose a changed project file."),{code:"vibe64_session_change_path_invalid",details:{}});return t}function Ym(e){
|
|
1628
|
+
let t=e.replace(/[*?[\]\\]/gu,"\\$&");return[`:(literal)${e}`,`:(glob,exclude)${t}/**`]}var WT=new URL("./sessionWorkGit.js",import.meta.url).href,Qm=12e4,Km=Symbol("vibe64-session-work-command-scope"),sH=qT(
|
|
1629
|
+
new URL("./sessionWorkOperationCommand.js",WT)),YT=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,Jm=1e5;function ge(e=""){return YT.
|
|
1630
|
+
test(String(e??""))}function ks(e=""){return{content:e.slice(0,Jm),truncated:e.length>Jm}}function v(e=""){return String(
|
|
1631
|
+
e||"").trim()}function Ot(e=[]){return[...new Set((Array.isArray(e)?e:[]).map(v).filter(Boolean))].sort((t,r)=>t.localeCompare(
|
|
1632
|
+
r))}function KT(e={}){return e?.metadata&&typeof e.metadata=="object"?e.metadata:{}}function g(e,t="vibe64_session_save_\
|
|
1609
1633
|
failed",r={}){let n=new Error(e||"Vibe64 could not save this session.");return n.code=t,n.details=r&&typeof r=="object"&&
|
|
1610
|
-
!Array.isArray(r)?{...r}:{},Object.assign(n,r),n}function j(e={},t={}){t=
|
|
1634
|
+
!Array.isArray(r)?{...r}:{},Object.assign(n,r),n}function j(e={},t={}){t=Rs(t,e);let r=KT(e),n=lr(t.repositoryMode||t.repository?.
|
|
1611
1635
|
mode),o=v(t.repository?.defaultBranch);if(n===F&&r.local_source_branch&&v(r.local_source_branch)!==o)throw g(`This sessi\
|
|
1612
1636
|
on belongs to ${v(r.local_source_branch)}. Switch the project folder back to that branch before saving or updating it.`,
|
|
1613
1637
|
"vibe64_session_local_branch_changed");let i=v(e.sourcePath||r.source_path),s=v(e.sessionId||e.id),a=v(r.base_commit),c=v(
|
|
1614
1638
|
r.canonical_commit)||a,u=n===F?v(t.sourceRoot):"";if(!n||!o||!i||!s||!a||n===F&&!u)throw g("Session Save requires a comp\
|
|
1615
1639
|
lete repository mode, branch, session source, base commit, and authority.","vibe64_session_save_context_incomplete");let l=n===
|
|
1616
|
-
V?v(t.githubRepository?.cloneUrl||t.repository?.github?.cloneUrl):n===
|
|
1640
|
+
V?v(t.githubRepository?.cloneUrl||t.repository?.github?.cloneUrl):n===Qe?v(t.canonicalRepositoryPath):u;if(!l)throw g("S\
|
|
1617
1641
|
ession Save cannot find the canonical repository authority.","vibe64_session_save_authority_missing");return Object.freeze(
|
|
1618
|
-
{baseCommit:a,branch:o,contribution:
|
|
1642
|
+
{baseCommit:a,branch:o,contribution:Rt(e),connectedSubmissions:Lm(e),lastCanonicalCommit:c,mode:n,githubMirrorPath:v(t.githubMirrorPath),
|
|
1619
1643
|
repositoryFullName:v(t.githubRepository?.fullName||t.repository?.github?.fullName),githubMirrorOptional:!!r.github_pull_request||
|
|
1620
1644
|
t.githubMirrorOptional===!0,remoteUrl:l,sessionId:s,standaloneSourceRoot:u,worktreePath:i})}function z(e={},t={}){return{
|
|
1621
1645
|
ownerUserKey:v(t.ownerUserKey||t.githubRepository?.owner),projectRoot:e.worktreePath,repositoryMode:e.mode,sessionId:e.sessionId}}
|
|
1622
|
-
function
|
|
1646
|
+
function ne(e,t={},r={},{label:n="Session repository work",operationId:o=xs.randomUUID()}={}){if(e?.[Km])return e;let i=v(
|
|
1623
1647
|
r.slug||r.projectSlug),s=Promise.resolve(),a=(c={})=>{let u=s.then(()=>e({...c,execution:{...c.execution||{},kind:"job",
|
|
1624
1648
|
label:n,lifecycle:"finite",operationId:v(o),ownerId:t.sessionId,projectSlug:i,sessionId:t.sessionId},project:{...c.project||
|
|
1625
1649
|
{},...i?{slug:i}:{}},session:{...c.session||{},sessionId:t.sessionId}}));return s=u.then(()=>{},()=>{}),u};return Object.
|
|
1626
|
-
defineProperty(a,
|
|
1627
|
-
env:a={},input:c,project:u={}}={}){let l=[t.worktreePath,
|
|
1628
|
-
|
|
1629
|
-
d=>{let
|
|
1650
|
+
defineProperty(a,Km,{value:!0}),a}async function Ns(e,t,r,n,{additionalAllowedRoots:o=[],commandOptions:i={},cwd:s=t.worktreePath,
|
|
1651
|
+
env:a={},input:c,project:u={}}={}){let l=[t.worktreePath,le.dirname(t.worktreePath),...t.mode===F?[t.standaloneSourceRoot,
|
|
1652
|
+
le.dirname(t.standaloneSourceRoot)]:[],...le.isAbsolute(t.remoteUrl)?[t.remoteUrl,le.dirname(t.remoteUrl)]:[],...o.flatMap(
|
|
1653
|
+
d=>{let p=v(d);return p?[p,le.dirname(p)]:[]})];return e({actor:"daemon",allowedRoots:l,args:n,command:r,cwd:s,env:a,envPolicy:"\
|
|
1630
1654
|
session",gitSafeDirectories:l,input:c,mode:"capture",project:z(t,u),purpose:i.gitTransport?.startsWith("github")?"github":
|
|
1631
|
-
"source",runtimes:i.gitTransport==="github-https"?["git","gh"]:["git"],timeout:
|
|
1632
|
-
i?.output||i?.error)||"Git Save command failed.",v(i?.code)||"vibe64_session_save_git_failed",{gitArgs:r});return i}function
|
|
1633
|
-
return v(e.stdout||e.output)}async function T(e,t,r,n={}){return
|
|
1634
|
-
e,t,["diff-tree","--no-commit-id","--name-status","-r","-z",r,n],o);return[...
|
|
1635
|
-
localeCompare(a))}async function
|
|
1636
|
-
isSafeInteger(i)&&i>=0?i:0}async function
|
|
1637
|
-
""}async function
|
|
1638
|
-
n?!0:(await I(e,t,["merge-base","--is-ancestor",r,n],{...o,required:!1}))?.ok===!0}async function
|
|
1639
|
-
e,t,t.baseCommit,r,o))return!1;let[i,s]=await Promise.all([Y(e,t,r,n,o),Y(e,t,t.baseCommit,n,o)]);return!i||s}async function
|
|
1640
|
-
let[n,o,i]=await Promise.all([
|
|
1655
|
+
"source",runtimes:i.gitTransport==="github-https"?["git","gh"]:["git"],timeout:Qm,...i})}async function I(e,t,r,{required:n=!0,...o}={}){let i=await Ns(e,t,"git",r,o);if(n&&i?.ok!==!0)throw g(v(i?.stderr||i?.stdout||
|
|
1656
|
+
i?.output||i?.error)||"Git Save command failed.",v(i?.code)||"vibe64_session_save_git_failed",{gitArgs:r});return i}function dr(e={}){
|
|
1657
|
+
return v(e.stdout||e.output)}async function T(e,t,r,n={}){return dr(await I(e,t,r,n))}async function Ms(e,t,r,n,o={}){let i=await I(
|
|
1658
|
+
e,t,["diff-tree","--no-commit-id","--name-status","-r","-z",r,n],o);return[...Cs(i.stdout||i.output).keys()].sort((s,a)=>s.
|
|
1659
|
+
localeCompare(a))}async function Ct(e,t,r,n,o={}){let i=Number(await T(e,t,["rev-list","--count",`${r}..${n}`],o));return Number.
|
|
1660
|
+
isSafeInteger(i)&&i>=0?i:0}async function ur(e,t,r,n={}){let o=await I(e,t,r,{...n,required:!1});return o?.ok===!0?dr(o):
|
|
1661
|
+
""}async function Ge(e,t,r,n={}){return T(e,t,["rev-parse","--verify",`${r}^{tree}`],n)}async function Y(e,t,r,n,o={}){return r===
|
|
1662
|
+
n?!0:(await I(e,t,["merge-base","--is-ancestor",r,n],{...o,required:!1}))?.ok===!0}async function pr(e,t,r,n,o={}){if(await Y(
|
|
1663
|
+
e,t,t.baseCommit,r,o))return!1;let[i,s]=await Promise.all([Y(e,t,r,n,o),Y(e,t,t.baseCommit,n,o)]);return!i||s}async function Xn(e,t,r={}){
|
|
1664
|
+
let[n,o,i]=await Promise.all([ur(e,t,["rev-parse","--verify",`${Zn(t)}^{commit}`],r),t.lastCanonicalCommit?await ur(e,t,
|
|
1641
1665
|
["rev-parse","--verify",`${t.lastCanonicalCommit}^{commit}`],r):"",T(e,t,["rev-parse","--verify",`${t.baseCommit}^{commi\
|
|
1642
|
-
t}`],r)]),s=n||o||i;for(let a of[o,i].filter(Boolean))a!==s&&await Y(e,t,s,a,r)&&(s=a);return s}async function
|
|
1643
|
-
canonicalCommit:n,sessionHead:o,worktreeTree:i,reconcileHistory:s=!1},a={}){let[c,u]=await Promise.all([
|
|
1666
|
+
t}`],r)]),s=n||o||i;for(let a of[o,i].filter(Boolean))a!==s&&await Y(e,t,s,a,r)&&(s=a);return s}async function mr(e,t,{baseCommit:r,
|
|
1667
|
+
canonicalCommit:n,sessionHead:o,worktreeTree:i,reconcileHistory:s=!1},a={}){let[c,u]=await Promise.all([Ge(e,t,r,a),Ge(e,
|
|
1644
1668
|
t,n,a)]);if(i===u)return{baseTree:c,canonicalTree:u,changeBaseCommit:n,changeBaseTree:u,changedPaths:[],sessionMatchesCanonical:!0};
|
|
1645
|
-
let l=s?r:await T(e,t,["merge-base",n,o],a),d=l===n?u:await
|
|
1646
|
-
canonicalTree:u,changeBaseCommit:l,changeBaseTree:d,changedPaths:
|
|
1647
|
-
await I(e,t,["check-ref-format","--branch",t.branch],r)}function Te(e,t,r){return`refs/vibe64/save/${
|
|
1648
|
-
56").update(`${e.sessionId}\0${t}`).digest("hex").slice(0,32)}/${r}`}function
|
|
1669
|
+
let l=s?r:await T(e,t,["merge-base",n,o],a),d=l===n?u:await Ge(e,t,l,a),p=i===d?[]:await Ms(e,t,l,i,a);return{baseTree:c,
|
|
1670
|
+
canonicalTree:u,changeBaseCommit:l,changeBaseTree:d,changedPaths:p,sessionMatchesCanonical:i===u}}async function Pt(e,t,r){
|
|
1671
|
+
await I(e,t,["check-ref-format","--branch",t.branch],r)}function Te(e,t,r){return`refs/vibe64/save/${xs.createHash("sha2\
|
|
1672
|
+
56").update(`${e.sessionId}\0${t}`).digest("hex").slice(0,32)}/${r}`}function Zn(e){return`refs/vibe64/canonical/${xs.createHash(
|
|
1649
1673
|
"sha256").update(e.branch).digest("hex").slice(0,32)}`}async function Ie(e,t,r,n={}){v(r)&&await I(e,t,["update-ref","-d",
|
|
1650
|
-
r],{...n,required:!1})}async function
|
|
1651
|
-
e,t,["update-ref",
|
|
1652
|
-
project:s,virtualCommit:a="",explicitBase:c=!1}){let u=a||await
|
|
1674
|
+
r],{...n,required:!1})}async function He(e,t,r,n={}){let o=await T(e,t,["rev-parse","--verify",`${r}^{commit}`],n);return await I(
|
|
1675
|
+
e,t,["update-ref",Zn(t),o],n),o}async function Qn(e,t,{baseCommit:r,canonicalCommit:n,checkpointTree:o,commandOptions:i,
|
|
1676
|
+
project:s,virtualCommit:a="",explicitBase:c=!1}){let u=a||await xt(e,t,{baseCommit:r,commandOptions:i,message:"Vibe64 se\
|
|
1653
1677
|
ssion rebase input",project:s,tree:o}),l=await I(e,t,["merge-tree","--write-tree",...c?[`--merge-base=${r}`]:[],"--messa\
|
|
1654
|
-
ges","--name-only","-z",n,u],{commandOptions:i,project:s,required:!1}),d=String(l?.stdout||l?.output||"").split("\0"),
|
|
1655
|
-
d.shift());if(!ge(
|
|
1656
|
-
cting files for review.","vibe64_session_update_merge_invalid");if(l?.ok!==!0){let
|
|
1657
|
-
if(!f)break;
|
|
1658
|
-
.","vibe64_session_update_merge_invalid");return{conflictPaths:[...new Set(
|
|
1659
|
-
mergedTree:"",virtualCommit:u}}return{conflictPaths:[],conflictTree:"",mergedTree:
|
|
1660
|
-
conflictPaths:n,project:o}){return q({baseCommit:r,paths:n,project:z(t,o),runCommand:e,worktreePath:t.worktreePath})}async function
|
|
1678
|
+
ges","--name-only","-z",n,u],{commandOptions:i,project:s,required:!1}),d=String(l?.stdout||l?.output||"").split("\0"),p=v(
|
|
1679
|
+
d.shift());if(!ge(p))throw g(l?.ok===!0?"Git did not produce a valid rebased tree.":"Vibe64 could not prepare the confli\
|
|
1680
|
+
cting files for review.","vibe64_session_update_merge_invalid");if(l?.ok!==!0){let m=[];for(;d.length>0;){let f=d.shift();
|
|
1681
|
+
if(!f)break;m.push(f)}if(!m.length)throw g("Vibe64 could not identify which files conflict with the latest saved version\
|
|
1682
|
+
.","vibe64_session_update_merge_invalid");return{conflictPaths:[...new Set(m)].sort((f,h)=>f.localeCompare(h)),conflictTree:p,
|
|
1683
|
+
mergedTree:"",virtualCommit:u}}return{conflictPaths:[],conflictTree:"",mergedTree:p,virtualCommit:u}}function eo(e,t,{conflictTree:r,
|
|
1684
|
+
conflictPaths:n,project:o}){return q({baseCommit:r,paths:n,project:z(t,o),runCommand:e,worktreePath:t.worktreePath})}async function xt(e,t,{
|
|
1661
1685
|
baseCommit:r,commandOptions:n,message:o,project:i,tree:s}){return T(e,t,["commit-tree",s,"-p",r],{commandOptions:n,input:`${v(
|
|
1662
1686
|
o)||"Vibe64 virtual commit"}
|
|
1663
|
-
`,project:i})}async function
|
|
1664
|
-
n);if(!a.length)return s;let c=await
|
|
1665
|
-
join(c,"index")},d={additionalAllowedRoots:[c],commandOptions:r,env:l,project:o};try{await I(e,t,["read-tree",s],d);for(let
|
|
1666
|
-
let
|
|
1667
|
-
exec(String(
|
|
1668
|
-
pdate-index","--force-remove","--",
|
|
1669
|
-
recursive:!0})}}async function
|
|
1670
|
-
tree:a}){if(!
|
|
1671
|
-
wning tool is unavailable.","vibe64_session_derived_artifact_refresh_unavailable");let u=await
|
|
1672
|
-
message:"Vibe64 derived artifact input",project:i,tree:a}),l=await
|
|
1673
|
-
d-worktree-")),d=
|
|
1674
|
-
e,t,["worktree","add","--detach",d,u],
|
|
1675
|
-
worktreePath:d})}finally{
|
|
1676
|
-
await I(e,t,["worktree","prune"],{commandOptions:n,project:i,required:!1})}}import
|
|
1677
|
-
warn:40,error:50,fatal:60,silent:1/0});function
|
|
1678
|
-
return e==="behind"||e==="diverged"?"rebase":"none"}import
|
|
1679
|
-
e,t,n,!0);if(o={discarded:c.discarded,missingPublished:!1,publishedCommit:c.head,remoteAbsent:!c.head},o.remoteAbsent){let u=await
|
|
1680
|
-
e,t,["rev-parse","--verify",`${
|
|
1687
|
+
`,project:i})}async function kt(e,t,{commandOptions:r,derivedArtifactPaths:n=[],project:o,sourceCommit:i,tree:s}){let a=Ot(
|
|
1688
|
+
n);if(!a.length)return s;let c=await Xm(le.join(le.dirname(t.worktreePath),".vibe64-derived-index-")),l={GIT_INDEX_FILE:le.
|
|
1689
|
+
join(c,"index")},d={additionalAllowedRoots:[c],commandOptions:r,env:l,project:o};try{await I(e,t,["read-tree",s],d);for(let p of a){
|
|
1690
|
+
let m=await I(e,t,["ls-tree","-z",i,"--",p],{commandOptions:r,project:o}),f=/^(\d+)\s+\S+\s+([a-f0-9]{40}|[a-f0-9]{64})\t([^\0]+)\0$/u.
|
|
1691
|
+
exec(String(m.stdout||""));f&&f[3]===p?await I(e,t,["update-index","--add","--cacheinfo",f[1],f[2],p],d):await I(e,t,["u\
|
|
1692
|
+
pdate-index","--force-remove","--",p],{...d,required:!1})}return await T(e,t,["write-tree"],d)}finally{await Zm(c,{force:!0,
|
|
1693
|
+
recursive:!0})}}async function et(e,t,{baseCommit:r,commandOptions:n,derivedArtifactPaths:o=[],project:i,refreshDerivedArtifacts:s,
|
|
1694
|
+
tree:a}){if(!Ot(o).length)return a;if(typeof s!="function")throw g("The project declares generated artifacts but their o\
|
|
1695
|
+
wning tool is unavailable.","vibe64_session_derived_artifact_refresh_unavailable");let u=await xt(e,t,{baseCommit:r,commandOptions:n,
|
|
1696
|
+
message:"Vibe64 derived artifact input",project:i,tree:a}),l=await Xm(le.join(le.dirname(t.worktreePath),".vibe64-derive\
|
|
1697
|
+
d-worktree-")),d=le.join(l,"source"),p={additionalAllowedRoots:[l,d],commandOptions:n,project:i},m=!1;try{return await I(
|
|
1698
|
+
e,t,["worktree","add","--detach",d,u],p),m=!0,await s({projectRoot:d}),await q({baseCommit:"HEAD",project:z(t,i),runCommand:e,
|
|
1699
|
+
worktreePath:d})}finally{m&&await I(e,t,["worktree","remove","--force",d],{...p,required:!1}),await Zm(l,{force:!0,recursive:!0}),
|
|
1700
|
+
await I(e,t,["worktree","prune"],{commandOptions:n,project:i,required:!1})}}import nf from"node:crypto";var lH=Object.freeze(["fatal","error","warn","info","debug","trace","silent"]),uH=Object.freeze({trace:10,debug:20,info:30,
|
|
1701
|
+
warn:40,error:50,fatal:60,silent:1/0});function ef(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=0?t:0}function to(e=0,t=0){let r=ef(e),n=ef(t);return r>0&&n>0?"diverged":n>0?"behind":r>0?"ahead":"current"}function ro(e=""){
|
|
1702
|
+
return e==="behind"||e==="diverged"?"rebase":"none"}import JT from"node:crypto";import XT from"node:path";async function ZT(e,t,r,n){await I(e,t,["remote","set-url","origin",t.remoteUrl],n);let o=null,i="";if(t.contribution){let c=await fr(
|
|
1703
|
+
e,t,n,!0);if(o={discarded:c.discarded,missingPublished:!1,publishedCommit:c.head,remoteAbsent:!c.head},o.remoteAbsent){let u=await ur(
|
|
1704
|
+
e,t,["rev-parse","--verify",`${Zn(t)}^{commit}`],n);if((await T(e,t,["for-each-ref","--format=%(refname)","refs/vibe64/s\
|
|
1681
1705
|
ave/"],n)).split(`
|
|
1682
1706
|
`).some(d=>d.endsWith("/prepared")))throw g("This contribution branch is missing after a push attempt. Inspect its saved\
|
|
1683
1707
|
work and integration history before resubmitting it.","vibe64_contribution_branch_missing");if(t.lastCanonicalCommit===
|
|
@@ -1691,7 +1715,7 @@ if(!o.missingPublished&&c!==o.publishedCommit)throw g("The contribution branch c
|
|
|
1691
1715
|
missingPublished?t.baseCommit:c,u,n);if((o.discarded||o.missingPublished)&&(!l||t.baseCommit===t.contribution.baseCommit&&
|
|
1692
1716
|
o.missingPublished))throw g("This removed contribution has not been integrated. Preserve its source and inspect its save\
|
|
1693
1717
|
d work.",o.discarded?"vibe64_contribution_discarded":"vibe64_contribution_branch_missing");l&&(c=u,i=t.contribution.integrationBranch)}
|
|
1694
|
-
return
|
|
1718
|
+
return He(e,t,c,n).then(u=>({canonicalBranch:i,commit:u,contribution:o}))}finally{await Ie(e,t,s,n),await Ie(e,t,a,n)}}async function fr(e,t,r,n=!1){
|
|
1695
1719
|
let o=`refs/heads/${t.branch}`,i=`${o}_discarded`,s=await T(e,t,["ls-remote","--heads",t.remoteUrl,o,i],r),a=new Map(s.split(
|
|
1696
1720
|
`
|
|
1697
1721
|
`).filter(Boolean).map(c=>{let[u,l]=c.split(/\s+/u);if(![o,i].includes(l)||!ge(u))throw g("The contribution's remote bra\
|
|
@@ -1699,353 +1723,352 @@ nches could not be verified.","vibe64_contribution_refs_invalid");return[l,u]}))
|
|
|
1699
1723
|
o)?"Both contribution branches exist after an interrupted discard. Resolve that operation before saving.":"This contribu\
|
|
1700
1724
|
tion was discarded. Preserve its source and submit further work as a new contribution.",a.has(o)?"vibe64_contribution_di\
|
|
1701
1725
|
scard_incomplete":"vibe64_contribution_discarded");return{discarded:a.has(i)&&!a.has(o),head:a.get(o)||(n?a.get(i):"")||
|
|
1702
|
-
"",remoteAbsent:!a.has(o)&&!a.has(i)}}async function
|
|
1726
|
+
"",remoteAbsent:!a.has(o)&&!a.has(i)}}async function $s(e,t,r){if(await T(e,t,["branch","--show-current"],{...r,cwd:t.standaloneSourceRoot})!==
|
|
1703
1727
|
t.branch)throw g(`The project baseline must have ${t.branch} checked out before Save.`,"vibe64_session_save_local_branch\
|
|
1704
1728
|
_mismatch");if(await T(e,t,["status","--porcelain","--untracked-files=all"],{...r,cwd:t.standaloneSourceRoot}))throw g("\
|
|
1705
1729
|
The local project baseline has unsaved work. Save cannot overwrite it.","vibe64_session_save_local_authority_dirty");for(let i of[
|
|
1706
1730
|
"MERGE_HEAD","CHERRY_PICK_HEAD","REVERT_HEAD","REBASE_HEAD"])if((await I(e,t,["rev-parse","--verify","-q",i],{...r,cwd:t.
|
|
1707
1731
|
standaloneSourceRoot,required:!1}))?.ok===!0)throw g("The local project baseline has an unfinished Git operation.","vibe\
|
|
1708
|
-
64_session_save_local_operation_in_progress");return T(e,t,["rev-parse","--verify","HEAD"],{...r,cwd:t.standaloneSourceRoot})}
|
|
1709
|
-
async function fr(e,t,r,n){if(t.mode!==F)return yT(e,t,r,n);let o=await ks(e,t,n),i=Te(t,r,"canonical");try{await I(e,t,
|
|
1732
|
+
64_session_save_local_operation_in_progress");return T(e,t,["rev-parse","--verify","HEAD"],{...r,cwd:t.standaloneSourceRoot})}async function hr(e,t,r,n){if(t.mode!==F)return ZT(e,t,r,n);let o=await $s(e,t,n),i=Te(t,r,"canonical");try{await I(e,t,
|
|
1710
1733
|
["fetch","--no-tags",t.standaloneSourceRoot,`+refs/heads/${t.branch}:${i}`],n);let s=await T(e,t,["rev-parse","--verify",
|
|
1711
1734
|
i],n);if(s!==o)throw g("The local project baseline changed while Vibe64 was reading it.","vibe64_session_save_authority_\
|
|
1712
|
-
advanced");return
|
|
1735
|
+
advanced");return He(e,t,s,n).then(a=>({canonicalBranch:"",commit:a,contribution:null}))}finally{await Ie(e,t,i,n)}}async function no(e,t,r){
|
|
1713
1736
|
if(t.connectedSubmissions.length){if(await T(e,t,["rev-parse","--is-shallow-repository"],r)!=="false")throw g("Connected\
|
|
1714
1737
|
integration requires complete Git history. Prepare a full checkout before saving.","vibe64_connected_integration_unknow\
|
|
1715
1738
|
n");for(let{contribution:n,submittedCommit:o}of t.connectedSubmissions){let{repository:i,integrationBranch:s,id:a}=n,c=`\
|
|
1716
|
-
https://github.com/${i}.git`,u=`refs/heads/${s}`,l=`refs/heads/vibe64-incoming/${a}`,d=`${l}_discarded`,
|
|
1717
|
-
integrationBranch:s,id:a,submittedCommit:o},
|
|
1739
|
+
https://github.com/${i}.git`,u=`refs/heads/${s}`,l=`refs/heads/vibe64-incoming/${a}`,d=`${l}_discarded`,p={repository:i,
|
|
1740
|
+
integrationBranch:s,id:a,submittedCommit:o},m=[];try{let f=await T(e,t,["ls-remote","--heads",c,u,l,d],r),h=new Map;for(let w of f.
|
|
1718
1741
|
split(`
|
|
1719
|
-
`).filter(Boolean)){let[R,_]=
|
|
1742
|
+
`).filter(Boolean)){let[R,_]=w.split(/\s+/u);if(![u,l,d].includes(_)||h.has(_)||!ge(R))throw g("The receiving repository\
|
|
1720
1743
|
returned invalid ref evidence.");h.set(_,R)}if(!h.has(u))throw g("The receiving integration branch is unavailable.");if(h.
|
|
1721
1744
|
has(l)&&h.has(d))throw g(`${i} has an interrupted discard. Resolve it in Incoming changes before saving this project.`,"\
|
|
1722
|
-
vibe64_connected_integration_unresolved",
|
|
1723
|
-
ed-integration")});if(await I(e,t,["fetch","--no-tags","--no-write-fetch-head",c,...
|
|
1724
|
-
r),await T(e,t,["rev-parse","--is-shallow-repository"],r)!=="false")throw g("The receiving history is incomplete.");for(let
|
|
1725
|
-
if(await T(e,t,["rev-parse","--verify",`${
|
|
1726
|
-
the integration check. Retry Save.");let
|
|
1727
|
-
|
|
1728
|
-
"not merged"} contribution ${a} at ${o.slice(0,12)}. Integrate that revision into ${s} before saving this project.`,
|
|
1729
|
-
ibe64_connected_integration_discarded":"vibe64_connected_integration_pending",
|
|
1730
|
-
|
|
1745
|
+
vibe64_connected_integration_unresolved",p);for(let[w,R]of h)m.push({remote:w,head:R,local:Te(t,JT.randomUUID(),"connect\
|
|
1746
|
+
ed-integration")});if(await I(e,t,["fetch","--no-tags","--no-write-fetch-head",c,...m.map(w=>`+${w.remote}:${w.local}`)],
|
|
1747
|
+
r),await T(e,t,["rev-parse","--is-shallow-repository"],r)!=="false")throw g("The receiving history is incomplete.");for(let w of m)
|
|
1748
|
+
if(await T(e,t,["rev-parse","--verify",`${w.local}^{commit}`],r)!==w.head)throw g("The receiving branches changed during\
|
|
1749
|
+
the integration check. Retry Save.");let b=await T(e,t,["rev-list","--count",`${h.get(u)}..${o}`],r);if(!/^\d+$/u.test(
|
|
1750
|
+
b))throw g("The required revision's ancestry is unknown.");if(b!=="0"){let w=h.has(d);throw g(`${i} has ${w?"discarded":
|
|
1751
|
+
"not merged"} contribution ${a} at ${o.slice(0,12)}. Integrate that revision into ${s} before saving this project.`,w?"v\
|
|
1752
|
+
ibe64_connected_integration_discarded":"vibe64_connected_integration_pending",p)}let y=(r.connectedWorkSnapshots||[]).find(
|
|
1753
|
+
w=>w.contribution.repository===i&&w.contribution.integrationBranch===s);if(!y||!await Y(e,t,h.get(u),y.sessionHead,r))throw g(
|
|
1731
1754
|
`Update the connected session for ${i} to incorporate its accepted ${s} source before saving this project.`,"vibe64_conn\
|
|
1732
|
-
ected_integration_source_update_required",
|
|
1755
|
+
ected_integration_source_update_required",p)}catch(f){throw f.code?.startsWith("vibe64_connected_integration_")?f:g(`Cou\
|
|
1733
1756
|
ld not verify contribution ${a} in ${i}/${s}. Check repository access and complete history, then retry Save.`,"vibe64_co\
|
|
1734
|
-
nnected_integration_unknown",
|
|
1735
|
-
throw g("Connected source snapshots are unavailable.","vibe64_connected_source_unavailable");return e.map(t=>{let r=
|
|
1757
|
+
nnected_integration_unknown",p)}finally{for(let f of m)await Ie(e,t,f.local,r)}}}}function Ds(e=[]){if(!Array.isArray(e))
|
|
1758
|
+
throw g("Connected source snapshots are unavailable.","vibe64_connected_source_unavailable");return e.map(t=>{let r=Rt({
|
|
1736
1759
|
metadata:{connected_contribution:JSON.stringify(t?.contribution)}});if(!r||typeof t.sessionId!="string"||!v(t.sessionId)||
|
|
1737
|
-
!
|
|
1760
|
+
!XT.isAbsolute(v(t.worktreePath))||[t.baseCommit,t.canonicalCommit,t.sessionHead,t.worktreeTree].some(n=>!ge(v(n))))throw g(
|
|
1738
1761
|
"The connected source could not be captured. Inspect connected work before saving.","vibe64_connected_source_unavailable");
|
|
1739
1762
|
return{contribution:r,sessionId:t.sessionId,worktreePath:v(t.worktreePath),baseCommit:t.baseCommit,canonicalCommit:t.canonicalCommit,
|
|
1740
|
-
sessionHead:t.sessionHead,worktreeTree:t.worktreeTree}})}async function
|
|
1763
|
+
sessionHead:t.sessionHead,worktreeTree:t.worktreeTree}})}async function Ls(e,t,r){for(let n of t){let{contribution:o}=n,
|
|
1741
1764
|
i=j({sessionId:n.sessionId,sourcePath:n.worktreePath,metadata:{base_commit:n.baseCommit,canonical_commit:n.canonicalCommit,
|
|
1742
1765
|
connected_contribution:JSON.stringify(o)}},{repositoryMode:V,repository:{defaultBranch:o.integrationBranch},githubRepository:{
|
|
1743
1766
|
fullName:o.repository,cloneUrl:`https://github.com/${o.repository}.git`}});try{let s=await q({baseCommit:"HEAD",project:z(
|
|
1744
1767
|
i,r.project),runCommand:e,worktreePath:i.worktreePath}),[a,c]=await Promise.all([T(e,i,["rev-parse","--verify","HEAD^{co\
|
|
1745
|
-
mmit}"],r),
|
|
1768
|
+
mmit}"],r),Xn(e,i,r)]);if(s!==n.worktreeTree||a!==n.sessionHead||c!==n.canonicalCommit)throw g(`Connected work in ${o.repository}\
|
|
1746
1769
|
changed during Save. Inspect and save it before retrying Main Save.`,"vibe64_connected_save_required",{repository:o.repository,
|
|
1747
1770
|
sessionId:o.id})}catch(s){throw s.code==="vibe64_connected_save_required"?s:g(`Connected work in ${o.repository} could n\
|
|
1748
1771
|
ot be rechecked. Restore source access and retry Save.`,"vibe64_connected_source_unavailable",{repository:o.repository,sessionId:o.
|
|
1749
|
-
id})}}}var
|
|
1750
|
-
`${r}..${n}`],o),s=
|
|
1751
|
-
length
|
|
1772
|
+
id})}}}var Us=5;async function QT(e,t,r,n,o={}){let i=await I(e,t,["log","--topo-order",`--max-count=${Us+1}`,"-z",`--format=${Hm}`,
|
|
1773
|
+
`${r}..${n}`],o),s=jm(String(i.stdout||i.output||""));return{incomingVersions:s.slice(0,Us),incomingVersionsTruncated:s.
|
|
1774
|
+
length>Us}}function eI(e={}){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=Array.isArray(e.conflictPaths)?
|
|
1752
1775
|
[...new Set(e.conflictPaths.map(String).filter(Boolean))].sort((n,o)=>n.localeCompare(o)):[],r={baseCommit:v(e.baseCommit),
|
|
1753
1776
|
canonicalCommit:v(e.canonicalCommit),checkpointTree:v(e.checkpointTree),conflictPaths:t,conflictTree:v(e.conflictTree),reviewId:v(
|
|
1754
1777
|
e.reviewId),oldHead:v(e.oldHead),oldIndexTree:v(e.oldIndexTree)};return Object.values(r).some(n=>Array.isArray(n)?n.length===
|
|
1755
|
-
0:!n)?null:r}function
|
|
1778
|
+
0:!n)?null:r}function tI(e=[]){let t=e.length,r=e.slice(0,3).join(", "),n=t>3?` and ${t-3} more`:"";return`${t} ${t===1?
|
|
1756
1779
|
"file needs":"files need"} review before this session can update: ${r}${n}. Resolve ${t===1?"it":"them"} manually or wit\
|
|
1757
|
-
h AI, then use Review resolved conflicts to apply Update. Fix it with AI can help with the repair.`}function
|
|
1758
|
-
|
|
1759
|
-
currentRecovery:r,previousRecovery:n,reviewedConflictId:o,project:i}){let s=o?
|
|
1780
|
+
h AI, then use Review resolved conflicts to apply Update. Fix it with AI can help with the repair.`}function tf(e){return g(
|
|
1781
|
+
tI(e.conflictPaths),"vibe64_session_update_conflict",{conflictPaths:e.conflictPaths,conflictRecovery:e})}async function rI(e,t,{
|
|
1782
|
+
currentRecovery:r,previousRecovery:n,reviewedConflictId:o,project:i}){let s=o?eI(n):null;if(!s)throw tf(r);let a=new Set(
|
|
1760
1783
|
s.conflictPaths);if(!(["baseCommit","canonicalCommit","oldHead","oldIndexTree"].every(u=>s[u]===r[u])&&r.conflictPaths.every(
|
|
1761
|
-
u=>a.has(u)))||o!==s.reviewId)throw
|
|
1762
|
-
randomUUID(),project:r={},runCommand:n=M,session:o={}}={}){let i=j(o,r);n=
|
|
1763
|
-
es",operationId:t}),await
|
|
1784
|
+
u=>a.has(u)))||o!==s.reviewId)throw tf(r);return eo(e,t,{...r,project:i})}async function of({commandOptions:e={},operationId:t=nf.
|
|
1785
|
+
randomUUID(),project:r={},runCommand:n=M,session:o={}}={}){let i=j(o,r);n=ne(n,i,r,{label:"Checking repository for updat\
|
|
1786
|
+
es",operationId:t}),await Pt(n,i,{commandOptions:e,project:r});let s=await hr(n,i,t,{commandOptions:e,project:r}),a=s.commit,
|
|
1764
1787
|
[c,u]=await Promise.all([T(n,i,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:e,project:r}),q({baseCommit:"HEA\
|
|
1765
|
-
D",project:z(i,r),runCommand:n,worktreePath:i.worktreePath})]),l=await
|
|
1788
|
+
D",project:z(i,r),runCommand:n,worktreePath:i.worktreePath})]),l=await pr(n,i,a,c,{commandOptions:e,project:r});if(l&&i.
|
|
1766
1789
|
mode!==F)throw g("The saved project history no longer descends from this session's starting version.","vibe64_session_up\
|
|
1767
|
-
date_history_diverged");let d=l?{baseCommit:i.baseCommit,canonicalCommit:a,sessionHead:c,worktreeTree:u,changedPaths:(await
|
|
1768
|
-
n,i,i.baseCommit,u,{commandOptions:e,project:r})).slice(0,100)}:null,[m,
|
|
1769
|
-
project:r}),
|
|
1770
|
-
project:r})]),
|
|
1771
|
-
return{ahead:
|
|
1772
|
-
eads/${s.canonicalBranch||i.branch}`,...i.mode===F?{}:{repository:i.remoteUrl}},...
|
|
1773
|
-
f,...d?{historyReview:d}:{},repositoryMode:i.mode,relationship:
|
|
1774
|
-
h,updateAvailable:l||!f,updateStrategy:
|
|
1790
|
+
date_history_diverged");let d=l?{baseCommit:i.baseCommit,canonicalCommit:a,sessionHead:c,worktreeTree:u,changedPaths:(await Ms(
|
|
1791
|
+
n,i,i.baseCommit,u,{commandOptions:e,project:r})).slice(0,100)}:null,[p,m,f,h]=await Promise.all([Ct(n,i,a,c,{commandOptions:e,
|
|
1792
|
+
project:r}),Ct(n,i,c,a,{commandOptions:e,project:r}),Y(n,i,a,c,{commandOptions:e,project:r}),Ge(n,i,a,{commandOptions:e,
|
|
1793
|
+
project:r})]),b=to(p,m),y=m>0?await QT(n,i,c,a,{commandOptions:e,project:r}):{incomingVersions:[],incomingVersionsTruncated:!1};
|
|
1794
|
+
return{ahead:p,baseCommit:i.baseCommit,behind:m,canonicalCommit:a,canonicalSource:{authority:i.mode,commit:a,ref:`refs/h\
|
|
1795
|
+
eads/${s.canonicalBranch||i.branch}`,...i.mode===F?{}:{repository:i.remoteUrl}},...y,ok:!0,operationId:t,reconciled:!l&&
|
|
1796
|
+
f,...d?{historyReview:d}:{},repositoryMode:i.mode,relationship:b,sessionCurrent:f,sessionHead:c,sessionMatchesCanonical:u===
|
|
1797
|
+
h,updateAvailable:l||!f,updateStrategy:ro(b)}}async function nI(e,t,{canonicalCommit:r,checkpointCommit:n,checkpointTree:o,commandOptions:i,mergedCommit:s,mergedTree:a,
|
|
1775
1798
|
oldHead:c,oldIndexTree:u,project:l}){if(await q({baseCommit:"HEAD",project:z(t,l),runCommand:e,worktreePath:t.worktreePath})!==
|
|
1776
1799
|
o)throw g("This session changed while its update was being prepared. Retry when the assistant is idle.","vibe64_session_\
|
|
1777
1800
|
update_worktree_changed");try{await I(e,t,["read-tree","--reset","-u",s],{commandOptions:i,project:l}),await I(e,t,["upd\
|
|
1778
|
-
ate-ref","HEAD",r,c],{commandOptions:i,project:l}),await I(e,t,["read-tree",r],{commandOptions:i,project:l});let
|
|
1779
|
-
{baseCommit:"HEAD",project:z(t,l),runCommand:e,worktreePath:t.worktreePath});if(
|
|
1780
|
-
ot match the prepared merged work.","vibe64_session_update_verification_failed");return await
|
|
1781
|
-
project:l}),{currentTree:
|
|
1782
|
-
project:l}).catch(()=>"");throw await I(e,t,["read-tree","--reset","-u",n],{commandOptions:i,project:l,required:!1}),
|
|
1783
|
-
|
|
1784
|
-
project:l,required:!1}),
|
|
1785
|
-
let i=j(o,r);await
|
|
1801
|
+
ate-ref","HEAD",r,c],{commandOptions:i,project:l}),await I(e,t,["read-tree",r],{commandOptions:i,project:l});let p=await q(
|
|
1802
|
+
{baseCommit:"HEAD",project:z(t,l),runCommand:e,worktreePath:t.worktreePath});if(p!==a)throw g("The updated session did n\
|
|
1803
|
+
ot match the prepared merged work.","vibe64_session_update_verification_failed");return await He(e,t,r,{commandOptions:i,
|
|
1804
|
+
project:l}),{currentTree:p,reconciled:!0,status:"updated"}}catch(p){let m=await T(e,t,["rev-parse","HEAD"],{commandOptions:i,
|
|
1805
|
+
project:l}).catch(()=>"");throw await I(e,t,["read-tree","--reset","-u",n],{commandOptions:i,project:l,required:!1}),m&&
|
|
1806
|
+
m!==c&&await I(e,t,["update-ref","HEAD",c,m],{commandOptions:i,project:l,required:!1}),await I(e,t,["read-tree",u],{commandOptions:i,
|
|
1807
|
+
project:l,required:!1}),p}}async function oo({commandOptions:e={},operationId:t,project:r={},runCommand:n=M,session:o={}}={}){
|
|
1808
|
+
let i=j(o,r);await Pt(n,i,{commandOptions:e,project:r});let s=await ar({outerTurnId:`update:${t}`,outcome:"completed",project:z(
|
|
1786
1809
|
i,r),runCommand:n,sessionId:i.sessionId,timestamp:new Date().toISOString(),worktreePath:i.worktreePath}),[a,c]=await Promise.
|
|
1787
1810
|
all([T(n,i,["rev-parse","HEAD"],{commandOptions:e,project:r}),T(n,i,["write-tree"],{commandOptions:e,project:r})]);return{
|
|
1788
|
-
checkpointCommit:s.commit,checkpointTree:s.tree,oldHead:a,oldIndexTree:c}}async function
|
|
1811
|
+
checkpointCommit:s.commit,checkpointTree:s.tree,oldHead:a,oldIndexTree:c}}async function sf({checkpoint:e={},commandOptions:t={},
|
|
1789
1812
|
conflictRecovery:r=null,derivedArtifactPaths:n=[],historyReview:o=null,operationId:i,project:s={},reviewedConflictId:a="",
|
|
1790
|
-
runCommand:c=M,session:u={}}={}){let l=j(u,s),{checkpointCommit:d,checkpointTree:
|
|
1791
|
-
c,l,i,{commandOptions:t,project:s}),
|
|
1813
|
+
runCommand:c=M,session:u={}}={}){let l=j(u,s),{checkpointCommit:d,checkpointTree:p,oldHead:m,oldIndexTree:f}=e,{commit:h}=await hr(
|
|
1814
|
+
c,l,i,{commandOptions:t,project:s}),b=await pr(c,l,h,m,{commandOptions:t,project:s});if(b||o){if(l.mode!==F)throw g("The\
|
|
1792
1815
|
saved project history no longer descends from this session's starting version.","vibe64_session_update_history_diverged");
|
|
1793
|
-
let O={baseCommit:l.baseCommit,canonicalCommit:h,sessionHead:
|
|
1794
|
-
baseCommit&&r.canonicalCommit===h&&r.oldHead===
|
|
1816
|
+
let O={baseCommit:l.baseCommit,canonicalCommit:h,sessionHead:m,worktreeTree:p};if(!(a&&r?.reviewId===a&&r.baseCommit===l.
|
|
1817
|
+
baseCommit&&r.canonicalCommit===h&&r.oldHead===m&&r.oldIndexTree===f)&&(!o||Object.entries(O).some(([x,k])=>o[x]!==k)))throw g(
|
|
1795
1818
|
"The project history was rewritten. Open Repository, check for updates, then review and reconcile this session.","vibe64\
|
|
1796
|
-
_session_history_review_required")}let
|
|
1797
|
-
reconcileHistory:
|
|
1798
|
-
|
|
1799
|
-
changeBaseCommit:
|
|
1800
|
-
repositoryMode:l.mode,sessionCurrent:_,sessionMatchesCanonical:
|
|
1801
|
-
canonicalTree;if(R.length){let O=await
|
|
1802
|
-
S=await
|
|
1803
|
-
x=S.conflictPaths.length>0?{baseCommit:
|
|
1804
|
-
conflictTree:S.conflictTree,oldHead:
|
|
1805
|
-
previousRecovery:r,reviewedConflictId:a,project:s}):S.mergedTree}return{...e,baseCommit:l.baseCommit,canonicalCommit:h,canonicalTree:
|
|
1806
|
-
canonicalTree,changeBaseCommit:
|
|
1807
|
-
...R.length?{}:{sessionMatchesCanonical:!0},status:"prepared"}}async function
|
|
1808
|
-
prepared:r={},project:n={},refreshDerivedArtifacts:o=null,runCommand:i=M,session:s={}}={}){let a=j(s,n),c=await
|
|
1819
|
+
_session_history_review_required")}let y=await mr(c,l,{baseCommit:l.baseCommit,canonicalCommit:h,sessionHead:m,worktreeTree:p,
|
|
1820
|
+
reconcileHistory:b},{commandOptions:t,project:s}),w=new Set(Ot(n)),R=y.changedPaths.filter(O=>!w.has(O)),_=await Y(c,l,h,
|
|
1821
|
+
m,{commandOptions:t,project:s});if(_&&!b)return{baseCommit:l.baseCommit,canonicalCommit:h,canonicalTree:y.canonicalTree,
|
|
1822
|
+
changeBaseCommit:y.changeBaseCommit,checkpointCommit:d,checkpointTree:p,currentTree:p,ok:!0,operationId:i,mode:l.mode,reconciled:!0,
|
|
1823
|
+
repositoryMode:l.mode,sessionCurrent:_,sessionMatchesCanonical:y.sessionMatchesCanonical,status:"already_current"};let A=y.
|
|
1824
|
+
canonicalTree;if(R.length){let O=await kt(c,l,{commandOptions:t,derivedArtifactPaths:n,project:s,sourceCommit:h,tree:p}),
|
|
1825
|
+
S=await Qn(c,l,{baseCommit:y.changeBaseCommit,explicitBase:b,canonicalCommit:h,checkpointTree:O,commandOptions:t,project:s}),
|
|
1826
|
+
x=S.conflictPaths.length>0?{baseCommit:y.changeBaseCommit,canonicalCommit:h,checkpointTree:p,conflictPaths:S.conflictPaths,
|
|
1827
|
+
conflictTree:S.conflictTree,oldHead:m,oldIndexTree:f,reviewId:nf.randomUUID()}:null;A=x?await rI(c,l,{currentRecovery:x,
|
|
1828
|
+
previousRecovery:r,reviewedConflictId:a,project:s}):S.mergedTree}return{...e,baseCommit:l.baseCommit,canonicalCommit:h,canonicalTree:y.
|
|
1829
|
+
canonicalTree,changeBaseCommit:y.changeBaseCommit,mergedSourceTree:A,mode:l.mode,operationId:i,repositoryMode:l.mode,sessionCurrent:!0,
|
|
1830
|
+
...R.length?{}:{sessionMatchesCanonical:!0},status:"prepared"}}async function af({commandOptions:e={},derivedArtifactPaths:t=[],
|
|
1831
|
+
prepared:r={},project:n={},refreshDerivedArtifacts:o=null,runCommand:i=M,session:s={}}={}){let a=j(s,n),c=await et(i,a,{
|
|
1809
1832
|
baseCommit:r.canonicalCommit,commandOptions:e,derivedArtifactPaths:t,project:n,refreshDerivedArtifacts:o,tree:r.mergedSourceTree}),
|
|
1810
|
-
u=c===r.canonicalTree?r.canonicalCommit:await
|
|
1811
|
-
ion update result",project:n,tree:c});return{...r,mergedCommit:u,mergedTree:c}}async function
|
|
1812
|
-
project:r={},runCommand:n=M,session:o={}}={}){let i=j(o,r),s=await
|
|
1813
|
-
ok:!0,...s}}function
|
|
1833
|
+
u=c===r.canonicalTree?r.canonicalCommit:await xt(i,a,{baseCommit:r.canonicalCommit,commandOptions:e,message:"Vibe64 sess\
|
|
1834
|
+
ion update result",project:n,tree:c});return{...r,mergedCommit:u,mergedTree:c}}async function cf({commandOptions:e={},prepared:t={},
|
|
1835
|
+
project:r={},runCommand:n=M,session:o={}}={}){let i=j(o,r),s=await nI(n,i,{...t,commandOptions:e,project:r});return{...t,
|
|
1836
|
+
ok:!0,...s}}function uf(e,t){let r=j({sessionId:t.sessionId,sourcePath:t.sourcePath||t.metadata?.source_path,metadata:{base_commit:t.
|
|
1814
1837
|
metadata?.base_commit}},e);if(r.mode!==V||r.branch.startsWith("vibe64-incoming/"))throw g("Incoming changes require the \
|
|
1815
|
-
receiving GitHub repository's authority.","vibe64_incoming_repository_required");return r}async function
|
|
1816
|
-
session:t={},offset:r=0,limit:n=25,id:o="",state:i="all",includeDiff:s=!1,commandOptions:a={},operationId:c=
|
|
1817
|
-
runCommand:u=M}={}){let l=
|
|
1818
|
-
project:e},
|
|
1838
|
+
receiving GitHub repository's authority.","vibe64_incoming_repository_required");return r}async function io({project:e={},
|
|
1839
|
+
session:t={},offset:r=0,limit:n=25,id:o="",state:i="all",includeDiff:s=!1,commandOptions:a={},operationId:c=lf.randomUUID(),
|
|
1840
|
+
runCommand:u=M}={}){let l=uf(e,t);u=ne(u,l,e,{label:"Reading incoming contributions",operationId:c});let d={commandOptions:a,
|
|
1841
|
+
project:e},p=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;if(o&&!p.test(o)||!Number.isSafeInteger(
|
|
1819
1842
|
r)||r<0||!Number.isSafeInteger(n)||n<1||n>50||s&&!o||!["all","pending","merged","discarded","unresolved"].includes(i))throw g(
|
|
1820
1843
|
"Choose an exact incoming contribution or a valid page.","vibe64_incoming_input_invalid");if(await T(u,l,["rev-parse","-\
|
|
1821
1844
|
-is-shallow-repository"],d)!=="false")throw g("Incoming changes require complete Git history. Prepare a full receiving c\
|
|
1822
|
-
heckout before retrying.","vibe64_incoming_history_incomplete");let
|
|
1823
|
-
"--heads",l.remoteUrl,
|
|
1845
|
+
heckout before retrying.","vibe64_incoming_history_incomplete");let m=`refs/heads/${l.branch}`,f=await T(u,l,["ls-remote",
|
|
1846
|
+
"--heads",l.remoteUrl,m,"refs/heads/vibe64-incoming/*"],d),h=new Map,b="";for(let _ of f.split(`
|
|
1824
1847
|
`).filter(Boolean)){let[A,O]=_.split(/\s+/u);if(!ge(A))throw g("The receiving repository returned invalid ref evidence.",
|
|
1825
|
-
"vibe64_incoming_refs_invalid");if(O===
|
|
1826
|
-
O);if(!S||!
|
|
1827
|
-
iveHead"]=A,h.set(x.id,x)}if(!
|
|
1828
|
-
ng");let
|
|
1848
|
+
"vibe64_incoming_refs_invalid");if(O===m){b=A;continue}let S=/^refs\/heads\/vibe64-incoming\/(.+?)(_discarded)?$/u.exec(
|
|
1849
|
+
O);if(!S||!p.test(S[1]))continue;let x=h.get(S[1])||{id:S[1],activeHead:"",discardedHead:""};x[S[2]?"discardedHead":"act\
|
|
1850
|
+
iveHead"]=A,h.set(x.id,x)}if(!b)throw g("The receiving integration branch is unavailable.","vibe64_incoming_target_missi\
|
|
1851
|
+
ng");let y=[...h.values()].sort((_,A)=>_.id.localeCompare(A.id)),w=o?y.filter(_=>_.id===o):y;if(o&&!w.length)throw g("Th\
|
|
1829
1852
|
is incoming contribution is no longer present. Refresh the list and inspect its history.","vibe64_incoming_missing");let R=[
|
|
1830
|
-
{remote:
|
|
1853
|
+
{remote:m,head:b}];for(let _ of w)_.activeHead&&R.push({remote:`refs/heads/vibe64-incoming/${_.id}`,head:_.activeHead}),
|
|
1831
1854
|
_.discardedHead&&R.push({remote:`refs/heads/vibe64-incoming/${_.id}_discarded`,head:_.discardedHead});R.forEach((_,A)=>{
|
|
1832
1855
|
_.local=Te(l,c,`incoming-${A}`)});try{await I(u,l,["fetch","--no-tags","--no-write-fetch-head",l.remoteUrl,...R.map(S=>`\
|
|
1833
1856
|
+${S.remote}:${S.local}`)],d);for(let S of R)if(await T(u,l,["rev-parse","--verify",`${S.local}^{commit}`],d)!==S.head)throw g(
|
|
1834
|
-
"Incoming branches changed while being read. Refresh before reviewing them.","vibe64_incoming_review_changed");for(let S of
|
|
1835
|
-
let x=S.activeHead||S.discardedHead,k=await T(u,l,["rev-list","--count",`${
|
|
1857
|
+
"Incoming branches changed while being read. Refresh before reviewing them.","vibe64_incoming_review_changed");for(let S of w){
|
|
1858
|
+
let x=S.activeHead||S.discardedHead,k=await T(u,l,["rev-list","--count",`${b}..${x}`],d);if(!/^\d+$/u.test(k))throw g("C\
|
|
1836
1859
|
ontribution ancestry could not be established.","vibe64_incoming_history_incomplete");S.status=S.activeHead&&S.discardedHead?
|
|
1837
|
-
"unresolved":k==="0"?"merged":S.activeHead?"pending":"discarded"}let _=
|
|
1860
|
+
"unresolved":k==="0"?"merged":S.activeHead?"pending":"discarded"}let _=w.filter(S=>o||i==="all"||S.status===i),A=o?_:_.slice(
|
|
1838
1861
|
r,r+n),O=[];for(let S of A){let x=S.activeHead||S.discardedHead,k=await T(u,l,["log","-1","--format=%s",x],d),$=await I(
|
|
1839
|
-
u,l,["diff","--name-only","-z",`${
|
|
1840
|
-
u,l,["diff","--no-ext-diff","--no-textconv","--no-color","--unified=3",`${
|
|
1841
|
-
|
|
1842
|
-
branch,targetHead:
|
|
1843
|
-
filesTruncated:U.length>50,...
|
|
1844
|
-
contributions:O,pendingCount:
|
|
1862
|
+
u,l,["diff","--name-only","-z",`${b}...${x}`],d),U=String($.stdout||$.output||"").split("\0").filter(Boolean),ue;if(s){let N=await I(
|
|
1863
|
+
u,l,["diff","--no-ext-diff","--no-textconv","--no-color","--unified=3",`${b}...${x}`],d),W=String(N.stdout||N.output||"");
|
|
1864
|
+
ue=ks(W)}O.push({...S,branch:`vibe64-incoming/${S.id}`,head:x,title:k,review:{repository:l.repositoryFullName,targetBranch:l.
|
|
1865
|
+
branch,targetHead:b,id:S.id,activeHead:S.activeHead,discardedHead:S.discardedHead},files:U.slice(0,50),fileCount:U.length,
|
|
1866
|
+
filesTruncated:U.length>50,...ue?{diff:ue}:{}})}return{ok:!0,repository:l.repositoryFullName,targetBranch:l.branch,targetHead:b,
|
|
1867
|
+
contributions:O,pendingCount:w.filter(S=>S.status==="pending").length,unresolvedCount:w.filter(S=>S.status==="unresolved").
|
|
1845
1868
|
length,totalCount:_.length,offset:o?0:r,nextOffset:!o&&r+n<_.length?r+n:null}}finally{for(let _ of R)await Ie(u,l,_.local,
|
|
1846
|
-
d)}}async function
|
|
1847
|
-
refreshDerivedArtifacts:a,commandOptions:c={},operationId:u=
|
|
1869
|
+
d)}}async function df({project:e={},session:t={},action:r="",id:n="",review:o={},repairReview:i=null,derivedArtifactPaths:s=[],
|
|
1870
|
+
refreshDerivedArtifacts:a,commandOptions:c={},operationId:u=lf.randomUUID(),runCommand:l=M}={}){if(!["merge","discard","\
|
|
1848
1871
|
review-repair"].includes(r)||!n)throw g("Choose Merge or Discard for an exact contribution.","vibe64_incoming_input_inva\
|
|
1849
|
-
lid");let d=
|
|
1850
|
-
|
|
1851
|
-
repository,targetBranch:
|
|
1872
|
+
lid");let d=uf(e,t);l=ne(l,d,e,{label:"Updating incoming contribution",operationId:u});let p={commandOptions:c,project:e},
|
|
1873
|
+
m=await io({project:e,session:t,id:n,commandOptions:c,operationId:u,runCommand:l}),f=m.contributions[0],h={repository:m.
|
|
1874
|
+
repository,targetBranch:m.targetBranch,targetHead:m.targetHead,id:n,activeHead:f.activeHead,discardedHead:f.discardedHead};
|
|
1852
1875
|
if(Object.entries(h).some(([k,$])=>o?.[k]!==$))throw g("This contribution or its target changed. Review the current head\
|
|
1853
|
-
s before acting.","vibe64_incoming_review_changed");let
|
|
1854
|
-
branch}`;if(r==="merge"||r==="review-repair"){if(f.status==="merged")return{ok:!0,status:"merged",head:f.head,targetHead:
|
|
1876
|
+
s before acting.","vibe64_incoming_review_changed");let b=`refs/heads/${f.branch}`,y=`${b}_discarded`,w=`refs/heads/${d.
|
|
1877
|
+
branch}`;if(r==="merge"||r==="review-repair"){if(f.status==="merged")return{ok:!0,status:"merged",head:f.head,targetHead:m.
|
|
1855
1878
|
targetHead};if(f.status!=="pending")throw g("Only a pending contribution can be merged. Resolve its discard state first.",
|
|
1856
|
-
"vibe64_incoming_not_pending");let k=f.head,$="",U=await T(l,d,["rev-list","--count",`${f.head}..${
|
|
1879
|
+
"vibe64_incoming_not_pending");let k=f.head,$="",U=await T(l,d,["rev-list","--count",`${f.head}..${m.targetHead}`],p);if(!/^\d+$/u.
|
|
1857
1880
|
test(U))throw g("Integration ancestry is unavailable.","vibe64_incoming_history_incomplete");if(U==="0"&&(i||r==="review\
|
|
1858
1881
|
-repair"))throw g("These heads do not need conflict repair. Refresh and review the contribution normally.","vibe64_incom\
|
|
1859
|
-
ing_review_changed");if(U!=="0"){let be=await T(l,d,["rev-parse",`${f.head}^{tree}`],
|
|
1860
|
-
derivedArtifactPaths:s,project:e,sourceCommit:
|
|
1861
|
-
message:"Vibe64 incoming authored source",project:e,tree:
|
|
1862
|
-
commandOptions:c,project:e});if(
|
|
1882
|
+
ing_review_changed");if(U!=="0"){let be=await T(l,d,["rev-parse",`${f.head}^{tree}`],p),tt=await kt(l,d,{commandOptions:c,
|
|
1883
|
+
derivedArtifactPaths:s,project:e,sourceCommit:m.targetHead,tree:be}),ao=tt===be?f.head:await xt(l,d,{baseCommit:f.head,commandOptions:c,
|
|
1884
|
+
message:"Vibe64 incoming authored source",project:e,tree:tt}),rt=await Qn(l,d,{canonicalCommit:m.targetHead,virtualCommit:ao,
|
|
1885
|
+
commandOptions:c,project:e});if(rt.conflictPaths.length){let gr=await oo({project:e,session:t,commandOptions:c,operationId:`\
|
|
1863
1886
|
incoming:${u}`,runCommand:l});if(r==="merge"&&!i)throw g("This contribution conflicts with the integration branch. Use F\
|
|
1864
1887
|
ix it with AI or repair the listed files in this receiving session, then Review resolved conflicts before merging.","vib\
|
|
1865
|
-
e64_incoming_merge_conflict",{conflictPaths:
|
|
1866
|
-
l,d,{conflictTree:
|
|
1867
|
-
derivedArtifactPaths:s,project:e,refreshDerivedArtifacts:a,tree:$});let
|
|
1868
|
-
oldHead,indexTree:
|
|
1869
|
-
-no-color","--unified=3",
|
|
1870
|
-
repairReview:
|
|
1888
|
+
e64_incoming_merge_conflict",{conflictPaths:rt.conflictPaths,checkpointCommit:gr.checkpointCommit,review:h});$=await eo(
|
|
1889
|
+
l,d,{conflictTree:rt.conflictTree,conflictPaths:rt.conflictPaths,project:e}),$=await et(l,d,{baseCommit:m.targetHead,commandOptions:c,
|
|
1890
|
+
derivedArtifactPaths:s,project:e,refreshDerivedArtifacts:a,tree:$});let co={tree:$,worktreeTree:gr.checkpointTree,head:gr.
|
|
1891
|
+
oldHead,indexTree:gr.oldIndexTree};if(r==="review-repair"){let Nt=await I(l,d,["diff","--no-ext-diff","--no-textconv","-\
|
|
1892
|
+
-no-color","--unified=3",m.targetHead,$],p),_f=String(Nt.stdout||Nt.output||"");return{ok:!0,status:"repair-review",review:h,
|
|
1893
|
+
repairReview:co,conflictPaths:rt.conflictPaths,diff:ks(_f)}}if(Object.keys(co).some(Nt=>i?.[Nt]!==co[Nt]))throw g("The r\
|
|
1871
1894
|
eceiving source changed after repair review. Review resolved conflicts again before merging.","vibe64_incoming_repair_ch\
|
|
1872
1895
|
anged")}else if(i||r==="review-repair")throw g("These heads no longer need conflict repair. Refresh and review the contr\
|
|
1873
|
-
ibution normally.","vibe64_incoming_review_changed");let
|
|
1874
|
-
project:e,refreshDerivedArtifacts:a,tree:
|
|
1875
|
-
{...
|
|
1876
|
-
`})}let
|
|
1877
|
-
targetHead!==
|
|
1878
|
-
e was prepared. Review it again.","vibe64_incoming_review_changed");if($){let be=await T(l,d,["rev-parse","HEAD"],
|
|
1879
|
-
l,d,["write-tree"],
|
|
1880
|
-
|
|
1881
|
-
"vibe64_incoming_repair_changed")}if(await I(l,d,["push",`--force-with-lease=${
|
|
1882
|
-
|
|
1896
|
+
ibution normally.","vibe64_incoming_review_changed");let yf=$||await et(l,d,{baseCommit:m.targetHead,commandOptions:c,derivedArtifactPaths:s,
|
|
1897
|
+
project:e,refreshDerivedArtifacts:a,tree:rt.mergedTree});k=await T(l,d,["commit-tree",yf,"-p",m.targetHead,"-p",f.head],
|
|
1898
|
+
{...p,input:`Merge contribution ${n}
|
|
1899
|
+
`})}let ue=await io({project:e,session:t,id:n,commandOptions:c,operationId:u,runCommand:l}),N=ue.contributions[0];if(ue.
|
|
1900
|
+
targetHead!==m.targetHead||N.activeHead!==f.activeHead||N.discardedHead)throw g("The contribution changed while its merg\
|
|
1901
|
+
e was prepared. Review it again.","vibe64_incoming_review_changed");if($){let be=await T(l,d,["rev-parse","HEAD"],p),tt=await T(
|
|
1902
|
+
l,d,["write-tree"],p),ao=await q({worktreePath:d.worktreePath,project:z(d,e),runCommand:l});if(be!==i.head||tt!==i.indexTree||
|
|
1903
|
+
ao!==i.worktreeTree)throw g("The receiving source changed while the merge was prepared. Review resolved conflicts again.",
|
|
1904
|
+
"vibe64_incoming_repair_changed")}if(await I(l,d,["push",`--force-with-lease=${w}:${m.targetHead}`,d.remoteUrl,`${k}:${w}`],
|
|
1905
|
+
p),(await T(l,d,["ls-remote","--heads",d.remoteUrl,w],p)).split(/\s+/u)[0]!==k)throw g("The merge result is uncertain. R\
|
|
1883
1906
|
efresh Incoming changes before retrying.","vibe64_incoming_verification_failed");return{ok:!0,status:"merged",head:f.head,
|
|
1884
1907
|
targetHead:k}}if(!f.activeHead||f.discardedHead&&f.discardedHead!==f.activeHead)throw g("This discard cannot replace a d\
|
|
1885
1908
|
ifferent or missing contribution head. Inspect the current branches.","vibe64_incoming_review_changed");let R=`${f.head}\
|
|
1886
|
-
:${
|
|
1887
|
-
d,["push","--atomic",A,O,d.remoteUrl,R,_],{...
|
|
1909
|
+
:${y}`,_=`:${b}`,A=`--force-with-lease=${b}:${f.activeHead}`,O=`--force-with-lease=${y}:${f.discardedHead}`,S=await I(l,
|
|
1910
|
+
d,["push","--atomic",A,O,d.remoteUrl,R,_],{...p,required:!1});if(!S.ok){let k=v(S.stderr||S.output||S.error);if(!/does not support --atomic push/iu.
|
|
1888
1911
|
test(k))throw g(k||"Discard was not confirmed. Refresh Incoming changes before retrying.","vibe64_incoming_discard_uncon\
|
|
1889
|
-
firmed");if(f.discardedHead||await I(l,d,["push",O,d.remoteUrl,R],
|
|
1890
|
-
|
|
1891
|
-
ncoming_verification_failed");await I(l,d,["push",A,d.remoteUrl,_],
|
|
1892
|
-
y
|
|
1893
|
-
"vibe64_incoming_discard_unconfirmed");return{ok:!0,status:f.status==="merged"?"merged":"discarded",head:f.head}}import
|
|
1894
|
-
"-z",r,n],o),I(e,t,["diff-tree","--no-commit-id","-r","-M","--numstat","-z",r,n],o)]);return
|
|
1895
|
-
s.output)}async function
|
|
1912
|
+
firmed");if(f.discardedHead||await I(l,d,["push",O,d.remoteUrl,R],p),(await T(l,d,["ls-remote","--heads",d.remoteUrl,y],
|
|
1913
|
+
p)).split(/\s+/u)[0]!==f.head)throw g("The discarded branch was not verified; the active branch was retained.","vibe64_i\
|
|
1914
|
+
ncoming_verification_failed");await I(l,d,["push",A,d.remoteUrl,_],p)}if(await T(l,d,["ls-remote","--heads",d.remoteUrl,
|
|
1915
|
+
b,y],p)!==`${f.head} ${y}`)throw g("Discard is not fully confirmed. Refresh Incoming changes to inspect both branches.",
|
|
1916
|
+
"vibe64_incoming_discard_unconfirmed");return{ok:!0,status:f.status==="merged"?"merged":"discarded",head:f.head}}import pf from"node:crypto";import oI from"node:path";async function iI(e,t,r,n,o={}){let[i,s]=await Promise.all([I(e,t,["diff-tree","--no-commit-id","-r","-M","--name-status",
|
|
1917
|
+
"-z",r,n],o),I(e,t,["diff-tree","--no-commit-id","-r","-M","--numstat","-z",r,n],o)]);return zm(i.stdout||i.output,s.stdout||
|
|
1918
|
+
s.output)}async function mf(e,t,r,n,{commandOptions:o={},lineLimit:i=Jn,project:s={}}={}){let a=Ps(n);if(!r.changedPaths.
|
|
1896
1919
|
includes(a))throw g("That file is not part of the current saved-work difference.","vibe64_session_change_not_found");let c=await I(
|
|
1897
1920
|
e,t,["--no-literal-pathspecs","diff","--no-ext-diff","--find-renames","--unified=3",r.changeBaseCommit,r.worktreeTree,"-\
|
|
1898
|
-
-",...
|
|
1899
|
-
...
|
|
1900
|
-
includeInitialDiff:r=!0,limit:n=
|
|
1901
|
-
i);s=
|
|
1902
|
-
session:a,worktreeTree:c}),d=new Set(l.changedPaths),
|
|
1903
|
-
project:i}).then(
|
|
1904
|
-
f.offset===0&&
|
|
1905
|
-
async function
|
|
1906
|
-
let a=
|
|
1907
|
-
project:o,runCommand:i,session:s});return
|
|
1921
|
+
-",...Ym(a)],{commandOptions:o,project:s});return{canonicalCommit:r.canonicalCommit,changeBaseCommit:r.changeBaseCommit,
|
|
1922
|
+
...qm(c.stdout||c.output,i),ok:!0,path:a,worktreeTree:r.worktreeTree}}async function Bs({commandOptions:e={},derivedArtifactPaths:t=[],
|
|
1923
|
+
includeInitialDiff:r=!0,limit:n=Os,offset:o=0,project:i={},runCommand:s=M,session:a={},worktreeTree:c=""}={}){let u=j(a,
|
|
1924
|
+
i);s=ne(s,u,i,{label:"Inspecting session changes"});let l=await so({commandOptions:e,derivedArtifactPaths:t,project:i,runCommand:s,
|
|
1925
|
+
session:a,worktreeTree:c}),d=new Set(l.changedPaths),p=l.unsaved?await iI(s,u,l.changeBaseCommit,l.worktreeTree,{commandOptions:e,
|
|
1926
|
+
project:i}).then(b=>b.filter(y=>d.has(y.path))):[],{items:m,...f}=Wm(p,{defaultLimit:Os,limit:n,maxLimit:Fm,offset:o}),h=r&&
|
|
1927
|
+
f.offset===0&&m.length>0?await mf(s,u,l,m[0].path,{commandOptions:e,project:i}):null;return{...l,files:m,initialDiff:h,...f}}
|
|
1928
|
+
async function ff({commandOptions:e={},derivedArtifactPaths:t=[],lineLimit:r=Jn,path:n="",project:o={},runCommand:i=M,session:s={}}={}){
|
|
1929
|
+
let a=Ps(n),c=j(s,o);i=ne(i,c,o,{label:"Inspecting a session change"});let u=await so({commandOptions:e,derivedArtifactPaths:t,
|
|
1930
|
+
project:o,runCommand:i,session:s});return mf(i,c,u,a,{commandOptions:e,lineLimit:r,project:o})}async function so({commandOptions:e={},
|
|
1908
1931
|
derivedArtifactPaths:t=[],inspectContributionPublication:r=!1,knownSubmittedCommit:n="",project:o={},runCommand:i=M,session:s={},
|
|
1909
|
-
worktreeTree:a=""}={}){let c=j(s,o);i=
|
|
1910
|
-
project:z(c,o),runCommand:i,worktreePath:c.worktreePath}),[l,d,m
|
|
1932
|
+
worktreeTree:a=""}={}){let c=j(s,o);i=ne(i,c,o,{label:"Inspecting session work"});let u=v(a)||await q({baseCommit:"HEAD",
|
|
1933
|
+
project:z(c,o),runCommand:i,worktreePath:c.worktreePath}),[l,d,p,m]=await Promise.all([Xn(i,c,{commandOptions:e,project:o}),
|
|
1911
1934
|
T(i,c,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:e,project:o}),T(i,c,["status","--porcelain=v1","--untrack\
|
|
1912
1935
|
ed-files=all","--ignore-submodules=none","-z"],{commandOptions:e,project:o}),T(i,c,["rev-parse","--show-toplevel"],{commandOptions:e,
|
|
1913
|
-
project:o})]),[f,h,y
|
|
1914
|
-
project:o}),
|
|
1915
|
-
{commandOptions:e,project:o})]),
|
|
1916
|
-
has(S)),_=
|
|
1917
|
-
n.","vibe64_contribution_authority_changed");let S=await
|
|
1936
|
+
project:o})]),[f,h,b,y]=await Promise.all([T(i,c,["rev-parse",`${d}^{tree}`],{commandOptions:e,project:o}),Ct(i,c,l,d,{commandOptions:e,
|
|
1937
|
+
project:o}),Ct(i,c,d,l,{commandOptions:e,project:o}),mr(i,c,{baseCommit:c.baseCommit,canonicalCommit:l,sessionHead:d,worktreeTree:u},
|
|
1938
|
+
{commandOptions:e,project:o})]),w=new Set((Array.isArray(t)?t:[]).map(v).filter(Boolean)),R=y.changedPaths.filter(S=>!w.
|
|
1939
|
+
has(S)),_=to(h,b),A=p.length===0,O;if(r){if(!c.contribution)throw g("Publication inspection requires a bound contributio\
|
|
1940
|
+
n.","vibe64_contribution_authority_changed");let S=await fr(i,c,{commandOptions:e,project:o},!0);if(O=S.head,!O&&n){if(!ge(
|
|
1918
1941
|
n))throw g("The saved contribution evidence is invalid.","vibe64_connected_integration_unknown");O=n}if(S.discarded||O&&
|
|
1919
1942
|
S.remoteAbsent){let x=`refs/heads/${c.contribution.integrationBranch}`,k=await T(i,c,["ls-remote","--heads",c.remoteUrl,
|
|
1920
|
-
x],{commandOptions:e,project:o}),[$,U,
|
|
1943
|
+
x],{commandOptions:e,project:o}),[$,U,ue]=k.split(/\s+/u);if(U!==x||ue||!ge($)||!await Y(i,c,O,$,{commandOptions:e,project:o}))
|
|
1921
1944
|
throw g("The removed contribution has not been proved integrated in this source. Check its receiving target and explicit\
|
|
1922
1945
|
ly Update the connected session.",S.discarded?"vibe64_contribution_discarded":"vibe64_contribution_branch_missing")}if(!O&&
|
|
1923
1946
|
c.baseCommit!==c.contribution.baseCommit)throw g("The pushed contribution branch is missing and no exact submitted revis\
|
|
1924
1947
|
ion is retained. Preserve the source and inspect its Save recovery evidence.","vibe64_contribution_branch_missing");if(O&&
|
|
1925
1948
|
!await Y(i,c,O,d,{commandOptions:e,project:o}))throw g("The contribution branch contains work this source has not incorp\
|
|
1926
1949
|
orated. Update its receiving session before saving the main project.","vibe64_connected_source_update_required",{repository:c.
|
|
1927
|
-
contribution.repository,sessionId:c.sessionId})}return{ahead:h,baseCommit:c.baseCommit,behind:
|
|
1928
|
-
canonicalTree:
|
|
1950
|
+
contribution.repository,sessionId:c.sessionId})}return{ahead:h,baseCommit:c.baseCommit,behind:b,branch:c.branch,canonicalCommit:l,
|
|
1951
|
+
canonicalTree:y.canonicalTree,changeBaseCommit:y.changeBaseCommit,changeBaseTree:y.changeBaseTree,changedPaths:R,destination:Um(
|
|
1929
1952
|
o,s),dirty:u!==f||!A,mode:c.mode,ok:!0,...r?{publishedCommit:O}:{},repositoryMode:c.mode,relationship:_,sessionMatchesCanonical:R.
|
|
1930
|
-
length===0,sessionHead:d,sessionId:c.sessionId,tree:u,updateAvailable:
|
|
1931
|
-
worktreeTree:u,worktreeTopLevel:
|
|
1953
|
+
length===0,sessionHead:d,sessionId:c.sessionId,tree:u,updateAvailable:b>0,updateStrategy:ro(_),unsaved:R.length>0,worktreeClean:A,
|
|
1954
|
+
worktreeTree:u,worktreeTopLevel:m,worktreePath:c.worktreePath}}function hf(e,t){return Te(e,t,"prepared")}async function sI(e,t,r,n,o={}){let i=hf(t,r);return await I(e,t,["update-ref",i,n],o),i}async function aI(e,t,{canonicalCommit:r,
|
|
1932
1955
|
commandOptions:n,mergedTree:o,message:i,project:s}){let a=v(i);if(!a)throw g("Save requires an assistant-generated commi\
|
|
1933
1956
|
t subject.","vibe64_session_save_message_required");return T(e,t,["commit-tree",o,"-p",r],{commandOptions:n,input:`${a}
|
|
1934
|
-
`,project:s})}async function
|
|
1935
|
-
F){if(await
|
|
1936
|
-
nced");await I(e,t,["fetch",t.worktreePath,o],{...i,cwd:t.standaloneSourceRoot}),await
|
|
1957
|
+
`,project:s})}async function cI(e,t,{canonicalCommit:r,contributionAuthority:n,saveCommit:o},i){if(await no(e,t,i),t.mode===
|
|
1958
|
+
F){if(await $s(e,t,i)!==r)throw g("The local project baseline advanced during Save.","vibe64_session_save_authority_adva\
|
|
1959
|
+
nced");await I(e,t,["fetch",t.worktreePath,o],{...i,cwd:t.standaloneSourceRoot}),await Ls(e,i.connectedWorkSnapshots||[],
|
|
1937
1960
|
i),i.onPublicationAttempt?.(),await I(e,t,["merge","--ff-only",o],{...i,cwd:t.standaloneSourceRoot});let d=await T(e,t,[
|
|
1938
|
-
"rev-parse","HEAD"],{...i,cwd:t.standaloneSourceRoot});return await
|
|
1961
|
+
"rev-parse","HEAD"],{...i,cwd:t.standaloneSourceRoot});return await He(e,t,d,i),d}let s=["push"],a=t.contribution?n.publishedCommit:
|
|
1939
1962
|
r;if(t.contribution){if(n.missingPublished)throw g("This contribution branch was removed after it was pushed. Preserve i\
|
|
1940
1963
|
ts source and submit further work as a new contribution.","vibe64_contribution_branch_missing");let l=n.remoteAbsent?"":
|
|
1941
|
-
n.publishedCommit;if((await
|
|
1964
|
+
n.publishedCommit;if((await fr(e,t,i)).head!==l)throw g("The contribution branch changed while Save was preparing. Inspe\
|
|
1942
1965
|
ct it before trying again.","vibe64_session_save_update_required");s.push(`--force-with-lease=refs/heads/${t.branch}:${l}`)}
|
|
1943
|
-
t.mode===
|
|
1966
|
+
t.mode===Qe&&s.push("--push-option=vibe64-atomic"),s.push("origin",`${o}:refs/heads/${t.branch}`);let c;await Ls(e,i.connectedWorkSnapshots||
|
|
1944
1967
|
[],i),i.onPublicationAttempt?.();try{c=await I(e,t,s,{...i,required:!1})}catch(l){c={ok:!1,code:l.code,error:l.message}}
|
|
1945
|
-
let u;try{u=(t.contribution?(await
|
|
1968
|
+
let u;try{u=(t.contribution?(await fr(e,t,i)).head:await T(e,t,["ls-remote","--heads","origin",`refs/heads/${t.branch}`],
|
|
1946
1969
|
i)).split(/\s+/u)[0]||""}catch(l){throw["vibe64_contribution_discarded","vibe64_contribution_discard_incomplete"].includes(
|
|
1947
1970
|
l.code)?l:g(`Save publication could not be confirmed. Inspect work to recover the prepared commit before retrying. ${v(l.
|
|
1948
|
-
message)}`,"vibe64_session_save_publication_unknown")}if(u===o)return await
|
|
1971
|
+
message)}`,"vibe64_session_save_publication_unknown")}if(u===o)return await He(e,t,u,i),u;if(c?.ok!==!0){if(u&&u!==a)throw g(
|
|
1949
1972
|
"The saved branch changed while Save was pushing your changes. Update this session, then save again.","vibe64_session_sa\
|
|
1950
1973
|
ve_update_required",{canonicalCommit:u,reconciledCommit:r,updateRequired:!0});let l=v(c?.stderr||c?.stdout||c?.output||c?.
|
|
1951
1974
|
error)||"Git Save publication failed.";throw t.mode===V&&/changes must be made through a pull request/iu.test(l)?g(`GitH\
|
|
1952
1975
|
ub requires a pull request to update ${t.branch}. Your work remains in this session.
|
|
1953
1976
|
|
|
1954
1977
|
${l}`,"vibe64_pull_request_required"):g(l,v(c?.code)||"vibe64_session_save_git_failed")}throw g("Canonical repository ve\
|
|
1955
|
-
rification did not return the commit Vibe64 pushed.","vibe64_session_save_verification_failed")}function
|
|
1978
|
+
rification did not return the commit Vibe64 pushed.","vibe64_session_save_verification_failed")}function lI(e,t,r,n,o){return{
|
|
1956
1979
|
attempted:o,branch:e.branch,code:r,kind:"github_mirror",message:"Your work was saved, but Vibe64 could not refresh its l\
|
|
1957
|
-
ocal clone cache. A later session or Save will retry it.",reason:n,retryable:!0,status:"retryable",verifiedCommit:t}}async function
|
|
1980
|
+
ocal clone cache. A later session or Save will retry it.",reason:n,retryable:!0,status:"retryable",verifiedCommit:t}}async function uI(e,t,r,{
|
|
1958
1981
|
commandOptions:n={},project:o={}}={}){if(t.mode!==V)return{attempted:!1,kind:"none",retryable:!1,status:"not_applicable"};
|
|
1959
|
-
let i=t.githubMirrorPath,s=(a,c)=>
|
|
1960
|
-
status:"not_applicable"};if(!i||!
|
|
1961
|
-
ssing");try{let[a,...c]=
|
|
1982
|
+
let i=t.githubMirrorPath,s=(a,c)=>lI(t,r,a,c,!!i);if(!i&&t.githubMirrorOptional)return{attempted:!1,kind:"none",retryable:!1,
|
|
1983
|
+
status:"not_applicable"};if(!i||!oI.isAbsolute(i))return s("vibe64_session_save_github_mirror_missing","configuration_mi\
|
|
1984
|
+
ssing");try{let[a,...c]=Is({mirrorPath:i,remoteUrl:t.remoteUrl}),u=await Ns(e,t,a,c,{additionalAllowedRoots:[i],commandOptions:n,
|
|
1962
1985
|
project:o});if(u?.ok!==!0)return s(v(u?.code)||"vibe64_session_save_github_mirror_refresh_failed","refresh_failed");let l={
|
|
1963
|
-
additionalAllowedRoots:[i],commandOptions:n,project:o,required:!1},[d,
|
|
1964
|
-
rse","--verify",`refs/heads/${t.branch}^{commit}`],l),I(e,t,["--git-dir",i,"remote","get-url","origin"],l)]),
|
|
1965
|
-
|
|
1966
|
-
d","verification_failed"),mirrorCommit:
|
|
1986
|
+
additionalAllowedRoots:[i],commandOptions:n,project:o,required:!1},[d,p]=await Promise.all([I(e,t,["--git-dir",i,"rev-pa\
|
|
1987
|
+
rse","--verify",`refs/heads/${t.branch}^{commit}`],l),I(e,t,["--git-dir",i,"remote","get-url","origin"],l)]),m=d?.ok===!0?
|
|
1988
|
+
dr(d):"",f=p?.ok===!0?dr(p):"";return m!==r||f!==t.remoteUrl?{...s("vibe64_session_save_github_mirror_verification_faile\
|
|
1989
|
+
d","verification_failed"),mirrorCommit:m}:{attempted:!0,branch:t.branch,kind:"github_mirror",mirrorCommit:m,retryable:!1,
|
|
1967
1990
|
status:"current",verifiedCommit:r}}catch{return s("vibe64_session_save_github_mirror_refresh_failed","refresh_interrupte\
|
|
1968
|
-
d")}}async function
|
|
1991
|
+
d")}}async function dI(e,t,{checkpointCommit:r,checkpointTree:n,commandOptions:o,project:i,saveCommit:s,sessionHead:a=""}){
|
|
1969
1992
|
let[c,u,l]=await Promise.all([q({baseCommit:"HEAD",project:z(t,i),runCommand:e,worktreePath:t.worktreePath}),T(e,t,["rev\
|
|
1970
|
-
-parse","HEAD"],{commandOptions:o,project:i}),
|
|
1971
|
-
status:"saved"};if(a&&u!==a)return{currentTree:c,reconciled:!1,status:"published_needs_reconcile"};let d=c!==n&&c!==l,
|
|
1993
|
+
-parse","HEAD"],{commandOptions:o,project:i}),Ge(e,t,s,{commandOptions:o,project:i})]);if(u===s)return{currentTree:c,reconciled:!0,
|
|
1994
|
+
status:"saved"};if(a&&u!==a)return{currentTree:c,reconciled:!1,status:"published_needs_reconcile"};let d=c!==n&&c!==l,p=await T(
|
|
1972
1995
|
e,t,["write-tree"],{commandOptions:o,project:i});try{return d?(await I(e,t,["read-tree",r],{commandOptions:o,project:i}),
|
|
1973
1996
|
await I(e,t,["read-tree","-m","-u",r,s],{commandOptions:o,project:i})):await I(e,t,["read-tree","--reset","-u",s],{commandOptions:o,
|
|
1974
1997
|
project:i}),await I(e,t,["update-ref","HEAD",s,u],{commandOptions:o,project:i}),{currentTree:c,reconciled:!0,status:"sav\
|
|
1975
|
-
ed"}}catch(
|
|
1976
|
-
["read-tree",
|
|
1977
|
-
blished_needs_reconcile"}}}async function
|
|
1978
|
-
project:o});let i=await
|
|
1998
|
+
ed"}}catch(m){return d||await I(e,t,["read-tree","--reset","-u",r],{commandOptions:o,project:i,required:!1}),await I(e,t,
|
|
1999
|
+
["read-tree",p],{commandOptions:o,project:i,required:!1}),{currentTree:c,error:v(m?.message||m),reconciled:!1,status:"pu\
|
|
2000
|
+
blished_needs_reconcile"}}}async function gf(e,t,{commandOptions:r={},operationId:n,project:o={}}={}){await Pt(e,t,{commandOptions:r,
|
|
2001
|
+
project:o});let i=await ar({outerTurnId:`save:${n}`,outcome:"completed",project:z(t,o),runCommand:e,sessionId:t.sessionId,
|
|
1979
2002
|
timestamp:new Date().toISOString(),worktreePath:t.worktreePath}),s=await T(e,t,["rev-parse","--verify","HEAD^{commit}"],
|
|
1980
2003
|
{commandOptions:r,project:o});return{baseCommit:t.baseCommit,branch:t.branch,checkpointCommit:i.commit,checkpointTree:i.
|
|
1981
|
-
tree,mode:t.mode,operationId:n,sessionHead:s}}async function
|
|
1982
|
-
limit:n=40,operationId:o=
|
|
1983
|
-
apturing work for Save",operationId:o});let u=await
|
|
2004
|
+
tree,mode:t.mode,operationId:n,sessionHead:s}}async function bf({commandOptions:e={},connectedWorkSnapshots:t=[],derivedArtifactPaths:r=[],
|
|
2005
|
+
limit:n=40,operationId:o=pf.randomUUID(),project:i={},runCommand:s=M,session:a={}}={}){let c=j(a,i);s=ne(s,c,i,{label:"C\
|
|
2006
|
+
apturing work for Save",operationId:o});let u=await gf(s,c,{commandOptions:e,operationId:o,project:i}),l=await Bs({commandOptions:e,
|
|
1984
2007
|
derivedArtifactPaths:r,includeInitialDiff:!1,limit:n,project:i,runCommand:s,session:a,worktreeTree:u.checkpointTree});if(!l.
|
|
1985
|
-
totalCount)throw await
|
|
1986
|
-
save.","vibe64_session_save_no_changes");return{changes:l,checkpoint:u}}async function
|
|
2008
|
+
totalCount)throw await no(s,c,{commandOptions:e,connectedWorkSnapshots:Ds(t),project:i}),g("This session has no work to \
|
|
2009
|
+
save.","vibe64_session_save_no_changes");return{changes:l,checkpoint:u}}async function pI(e,t,r,{commandOptions:n={},operationId:o,
|
|
1987
2010
|
project:i={}}={}){let s=v(r?.checkpointCommit),a=v(r?.checkpointTree);if(!s||!a||v(r?.operationId)!==v(o)||v(r?.baseCommit)!==
|
|
1988
2011
|
t.baseCommit||v(r?.branch)!==t.branch||v(r?.mode)!==t.mode)throw g("Save cannot verify the captured worktree. Capture an\
|
|
1989
|
-
d name the work again.","vibe64_session_save_checkpoint_invalid");if(await
|
|
2012
|
+
d name the work again.","vibe64_session_save_checkpoint_invalid");if(await Ge(e,t,s,{commandOptions:n,project:i})!==a)throw g(
|
|
1990
2013
|
"Save cannot verify the captured worktree. Capture and name the work again.","vibe64_session_save_checkpoint_invalid");let u=v(
|
|
1991
2014
|
r?.sessionHead),l=u?await T(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:n,project:i}):"";if(u&&l!==u)throw g(
|
|
1992
2015
|
"The session history changed while Vibe64 was naming this work. Save was not started; try again.","vibe64_session_save_m\
|
|
1993
|
-
essage_stale");return r}async function
|
|
1994
|
-
message:s="",operationId:a,project:c={},refreshDerivedArtifacts:u=null}={}){let l=v(r.checkpointTree),[d,
|
|
1995
|
-
all([
|
|
1996
|
-
|
|
1997
|
-
sion's saved base.","vibe64_session_save_history_diverged");let f=await Y(e,t,p,
|
|
2016
|
+
essage_stale");return r}async function mI(e,t,{checkpoint:r={},commandOptions:n={},connectedWorkSnapshots:o=[],derivedArtifactPaths:i=[],
|
|
2017
|
+
message:s="",operationId:a,project:c={},refreshDerivedArtifacts:u=null}={}){let l=v(r.checkpointTree),[d,p]=await Promise.
|
|
2018
|
+
all([hr(e,t,a,{commandOptions:n,project:c}),T(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:n,project:c})]),
|
|
2019
|
+
m=d.commit;if(await pr(e,t,m,p,{commandOptions:n,project:c}))throw g("Canonical history no longer descends from this ses\
|
|
2020
|
+
sion's saved base.","vibe64_session_save_history_diverged");let f=await Y(e,t,m,p,{commandOptions:n,project:c});if(m!==t.
|
|
1998
2021
|
baseCommit&&!f)throw g("The saved branch has changed. Update this session before saving its work.","vibe64_session_save_\
|
|
1999
|
-
update_required",{canonicalCommit:
|
|
2000
|
-
canonicalCommit:
|
|
2001
|
-
has(S));if(!
|
|
2002
|
-
rk to save.","vibe64_session_save_no_changes");let
|
|
2003
|
-
tree:l}),R=await
|
|
2004
|
-
_=await
|
|
2005
|
-
project:c}),O=await T(e,t,["show","-s","--format=%ae",_],{commandOptions:n,project:c});return{canonicalCommit:
|
|
2006
|
-
changeBaseCommit,changedPaths:
|
|
2007
|
-
O)}}async function
|
|
2008
|
-
return
|
|
2009
|
-
{commandOptions:r,connectedWorkSnapshots:n,onPublicationAttempt:o,project:s})}function
|
|
2022
|
+
update_required",{canonicalCommit:m,reconciledCommit:t.baseCommit,updateRequired:!0});let h=await mr(e,t,{baseCommit:t.baseCommit,
|
|
2023
|
+
canonicalCommit:m,sessionHead:p,worktreeTree:l},{commandOptions:n,project:c}),b=new Set(Ot(i)),y=h.changedPaths.filter(S=>!b.
|
|
2024
|
+
has(S));if(!y.length)throw await no(e,t,{commandOptions:n,connectedWorkSnapshots:o,project:c}),g("This session has no wo\
|
|
2025
|
+
rk to save.","vibe64_session_save_no_changes");let w=await kt(e,t,{commandOptions:n,derivedArtifactPaths:i,project:c,sourceCommit:m,
|
|
2026
|
+
tree:l}),R=await et(e,t,{baseCommit:m,commandOptions:n,derivedArtifactPaths:i,project:c,refreshDerivedArtifacts:u,tree:w}),
|
|
2027
|
+
_=await aI(e,t,{canonicalCommit:m,commandOptions:n,mergedTree:R,message:s,project:c}),A=await sI(e,t,a,_,{commandOptions:n,
|
|
2028
|
+
project:c}),O=await T(e,t,["show","-s","--format=%ae",_],{commandOptions:n,project:c});return{canonicalCommit:m,changeBaseCommit:h.
|
|
2029
|
+
changeBaseCommit,changedPaths:y,contributionAuthority:d.contribution,mergedTree:R,preparedRef:A,saveCommit:_,standInIdentity:ts(
|
|
2030
|
+
O)}}async function fI(e,t,{commandOptions:r={},connectedWorkSnapshots:n=[],onPublicationAttempt:o,prepared:i={},project:s={}}={}){
|
|
2031
|
+
return cI(e,t,{canonicalCommit:v(i.canonicalCommit),contributionAuthority:i.contributionAuthority,saveCommit:v(i.saveCommit)},
|
|
2032
|
+
{commandOptions:r,connectedWorkSnapshots:n,onPublicationAttempt:o,project:s})}function hI(e,t,r,n,o){return{baseCommit:e.
|
|
2010
2033
|
baseCommit,cacheMaintenance:o.cacheMaintenance,canonicalCommit:r.canonicalCommit,changeBaseCommit:r.changeBaseCommit,changedPaths:r.
|
|
2011
2034
|
changedPaths,checkpointCommit:t.checkpointCommit,checkpointTree:t.checkpointTree,mergedTree:r.mergedTree,mode:e.mode,ok:!0,
|
|
2012
2035
|
operationId:t.operationId,preparedRef:r.preparedRef,saveCommit:r.saveCommit,sessionHead:t.sessionHead,standInIdentity:r.
|
|
2013
|
-
standInIdentity===!0,status:o.status,verifiedCommit:n,...o}}function
|
|
2036
|
+
standInIdentity===!0,status:o.status,verifiedCommit:n,...o}}function gI(e,t){return e.mode!==V?{attempted:!1,kind:"none",
|
|
2014
2037
|
retryable:!1,status:"not_applicable"}:{attempted:!1,branch:e.branch,kind:"github_mirror",retryable:!1,status:"deferred",
|
|
2015
|
-
verifiedCommit:t}}async function
|
|
2016
|
-
let s=j(o,r);return n=
|
|
2017
|
-
project:r})}async function
|
|
2018
|
-
message:i="",operationId:s=
|
|
2019
|
-
onProgress:d=async()=>null,session:
|
|
2020
|
-
await d({kind:"lock",message:"Waiting for exclusive repository access.",stage:"repository-lock"}),l(async()=>{await d({baseCommit:
|
|
2021
|
-
baseCommit,branch:
|
|
2022
|
-
stage:"checkpointing"});let h;e?(await
|
|
2023
|
-
project:a})):h=await
|
|
2038
|
+
verifiedCommit:t}}async function Gs({commandOptions:e={},operationId:t="",project:r={},runCommand:n=M,session:o={},verifiedCommit:i=""}={}){
|
|
2039
|
+
let s=j(o,r);return n=ne(n,s,r,{label:"Maintaining saved repository cache",operationId:t}),uI(n,s,v(i),{commandOptions:e,
|
|
2040
|
+
project:r})}async function bI(e,t,r,n={}){v(r)&&await Ie(e,t,hf(t,r),n)}async function wf({checkpoint:e=null,commandOptions:t={},connectedWorkSnapshots:r=[],deferCacheMaintenance:n=!1,derivedArtifactPaths:o=[],
|
|
2041
|
+
message:i="",operationId:s=pf.randomUUID(),project:a={},refreshDerivedArtifacts:c=null,runCommand:u=M,runProjectSourceExclusive:l=async m=>m(),
|
|
2042
|
+
onProgress:d=async()=>null,session:p={}}={}){let m=j(p,a),f=Ds(r);return u=ne(u,m,a,{label:"Saving session work",operationId:s}),
|
|
2043
|
+
await d({kind:"lock",message:"Waiting for exclusive repository access.",stage:"repository-lock"}),l(async()=>{await d({baseCommit:m.
|
|
2044
|
+
baseCommit,branch:m.branch,kind:"checkpoint",message:"Capturing the complete session worktree.",mode:m.mode,operationId:s,
|
|
2045
|
+
stage:"checkpointing"});let h;e?(await Pt(u,m,{commandOptions:t,project:a}),h=await pI(u,m,e,{commandOptions:t,operationId:s,
|
|
2046
|
+
project:a})):h=await gf(u,m,{commandOptions:t,operationId:s,project:a}),await d({checkpointCommit:h.checkpointCommit,checkpointTree:h.
|
|
2024
2047
|
checkpointTree,kind:"checkpoint",message:"Session checkpoint captured.",stage:"checkpointed"}),await d({kind:"canonical",
|
|
2025
|
-
message:"Reading the current canonical branch.",stage:"canonical-reading"});let
|
|
2026
|
-
connectedWorkSnapshots:f,derivedArtifactPaths:o,message:i,operationId:s,project:a,refreshDerivedArtifacts:c}),
|
|
2027
|
-
await d({expectedCanonicalCommit:
|
|
2028
|
-
ad"}),await d({expectedCanonicalCommit:
|
|
2029
|
-
pared.",proposedCommit:
|
|
2030
|
-
publishing"}),
|
|
2031
|
-
throw
|
|
2032
|
-
sh",message:"Canonical Save commit verified.",stage:"published",verifiedCommit:
|
|
2033
|
-
conciling the session onto the saved commit.",stage:"reconciling"});let R=await
|
|
2034
|
-
checkpointTree:h.checkpointTree,commandOptions:t,project:a,saveCommit:
|
|
2035
|
-
|
|
2036
|
-
await d({cacheMaintenance:_,kind:"cache-warning",message:_.message,stage:"cache-maintenance-warning"}),n||await
|
|
2037
|
-
{commandOptions:t,project:a}),
|
|
2038
|
-
return
|
|
2039
|
-
return
|
|
2040
|
-
derivedArtifactPaths?.length&&
|
|
2041
|
-
await t({projectRoot:e.session.sourcePath})}return
|
|
2042
|
-
ived":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");return
|
|
2043
|
-
"update-apply":
|
|
2044
|
-
execution,input:e.input,maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,timeout:e.timeout})}async function
|
|
2045
|
-
for await(let t of process.stdin)if(e+=String(t||""),Buffer.byteLength(e)>
|
|
2046
|
-
on input is too large.");return JSON.parse(e||"{}")}function
|
|
2048
|
+
message:"Reading the current canonical branch.",stage:"canonical-reading"});let b=await mI(u,m,{checkpoint:h,commandOptions:t,
|
|
2049
|
+
connectedWorkSnapshots:f,derivedArtifactPaths:o,message:i,operationId:s,project:a,refreshDerivedArtifacts:c}),y=!1,w;try{
|
|
2050
|
+
await d({expectedCanonicalCommit:b.canonicalCommit,kind:"canonical",message:"Canonical branch read.",stage:"canonical-re\
|
|
2051
|
+
ad"}),await d({expectedCanonicalCommit:b.canonicalCommit,kind:"publish",mergedTree:b.mergedTree,message:"Save commit pre\
|
|
2052
|
+
pared.",proposedCommit:b.saveCommit,stage:"prepared"}),await d({kind:"publish",message:"Pushing the Save commit.",stage:"\
|
|
2053
|
+
publishing"}),w=await fI(u,m,{commandOptions:t,connectedWorkSnapshots:f,onPublicationAttempt(){y=!0},prepared:b,project:a})}catch(A){
|
|
2054
|
+
throw y||await I(u,m,["update-ref","-d",b.preparedRef,b.saveCommit],{commandOptions:t,project:a}),A}await d({kind:"publi\
|
|
2055
|
+
sh",message:"Canonical Save commit verified.",stage:"published",verifiedCommit:w}),await d({kind:"reconcile",message:"Re\
|
|
2056
|
+
conciling the session onto the saved commit.",stage:"reconciling"});let R=await dI(u,m,{checkpointCommit:h.checkpointCommit,
|
|
2057
|
+
checkpointTree:h.checkpointTree,commandOptions:t,project:a,saveCommit:b.saveCommit,sessionHead:h.sessionHead}),_=n?gI(m,
|
|
2058
|
+
w):await Gs({commandOptions:t,operationId:s,project:a,runCommand:u,session:p,verifiedCommit:w});return _.retryable===!0&&
|
|
2059
|
+
await d({cacheMaintenance:_,kind:"cache-warning",message:_.message,stage:"cache-maintenance-warning"}),n||await bI(u,m,s,
|
|
2060
|
+
{commandOptions:t,project:a}),hI(m,h,b,w,{cacheMaintenance:_,...R})},{operation:`save-session:${m.sessionId}`})}var _I=1024*1024,SI={incoming:io,"incoming-change":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");
|
|
2061
|
+
return df({...e,refreshDerivedArtifacts:t})},"change-diff":ff,changes:Bs,"check-updates":of,save:async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");
|
|
2062
|
+
return wf({...e,deferCacheMaintenance:!0,refreshDerivedArtifacts:t})},"save-maintenance":Gs,"save-message":async e=>{if(e.
|
|
2063
|
+
derivedArtifactPaths?.length&&wI(yI.join(e.session.sourcePath,"genesis/blueprint.md"))){let{inspectGenesisStackComponents:t}=await import("@local/vibe64-genesis/server");
|
|
2064
|
+
await t({projectRoot:e.session.sourcePath})}return bf(e)},work:so,"update-checkpoint":oo,"update-prepare":sf,"update-der\
|
|
2065
|
+
ived":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");return af({...e,refreshDerivedArtifacts:t})},
|
|
2066
|
+
"update-apply":cf};function EI(e={}){return Je(e.command,e.args,{cwd:e.cwd,env:{...process.env,...e.env||{}},execution:e.
|
|
2067
|
+
execution,input:e.input,maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,timeout:e.timeout})}async function vI(){let e="";
|
|
2068
|
+
for await(let t of process.stdin)if(e+=String(t||""),Buffer.byteLength(e)>_I)throw new Error("Session repository operati\
|
|
2069
|
+
on input is too large.");return JSON.parse(e||"{}")}function TI(e){return{error:{code:String(e?.code||"vibe64_session_wo\
|
|
2047
2070
|
rk_operation_failed"),details:e?.details&&typeof e.details=="object"&&!Array.isArray(e.details)?e.details:{},message:String(
|
|
2048
|
-
e?.message||"Session repository operation failed.")},ok:!1}}try{let e=await
|
|
2071
|
+
e?.message||"Session repository operation failed.")},ok:!1}}try{let e=await vI();Yi(e?.hostProfile||null);let t=SI[String(
|
|
2049
2072
|
e?.operation||"")];if(!t){let n=new Error("Unsupported session repository operation.");throw n.code="vibe64_session_work\
|
|
2050
|
-
_operation_unsupported",n}let r=await t({...e.input&&typeof e.input=="object"?e.input:{},runCommand:
|
|
2051
|
-
write(JSON.stringify({ok:!0,value:r}))}catch(e){process.stdout.write(JSON.stringify(
|
|
2073
|
+
_operation_unsupported",n}let r=await t({...e.input&&typeof e.input=="object"?e.input:{},runCommand:EI});process.stdout.
|
|
2074
|
+
write(JSON.stringify({ok:!0,value:r}))}catch(e){process.stdout.write(JSON.stringify(TI(e))),process.exitCode=1}
|