vibe64 0.1.52 → 0.1.53
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/upgrade-state.js +975 -974
- package/dist/assets/{GithubBrowserTabs-D7DveB8M.js → GithubBrowserTabs-DG2nCSNW.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-DDArM5uw.js → Vibe64AuthSettingsButton-9OLqOZao.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-Ab65VYSS.js → Vibe64DashboardShell-hWNziCur.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-DHLt5bST.js → Vibe64DatabaseWorkspace-TqXOZJpI.js} +1 -1
- package/dist/assets/{Vibe64FileArea-DCqpclYH.js → Vibe64FileArea-BljhpApn.js} +1 -1
- package/dist/assets/{Vibe64OutputControls-BPDF1XfG.js → Vibe64OutputControls-Dk_DWuFb.js} +1 -1
- package/dist/assets/{Vibe64RepositoryWorkspace-C107tX19.js → Vibe64RepositoryWorkspace-CDnsAlIz.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-BKJ1Qem_.js → Vibe64SessionFiles-DjeEvtpc.js} +1 -1
- package/dist/assets/{Vibe64UiStoryboardView-CJajdYSt.js → Vibe64UiStoryboardView-idZz86bx.js} +1 -1
- package/dist/assets/{_sessionId_-BaNhTTVN.js → _sessionId_-DLLJsju9.js} +1 -1
- package/dist/assets/{_slug_-D7mzZsk3.css → _slug_-BRPxP_Yn.css} +1 -1
- package/dist/assets/{_slug_-nHO3Bg-f.js → _slug_-JgF_FQ6F.js} +7 -7
- package/dist/assets/{app-DbGzTUVN.js → app-Cuw9E-ru.js} +1 -1
- package/dist/assets/{changes-D7NjgKWf.js → changes-CoR0-8EL.js} +1 -1
- package/dist/assets/{conversation-DV8qCsqw.js → conversation-B1UoWMaA.js} +1 -1
- package/dist/assets/{dashboard-DL95BPsz.js → dashboard-DnuIxR1s.js} +1 -1
- package/dist/assets/{english-definitions-ChTTs3cC.js → english-definitions-By4b_Yl2.js} +1 -1
- package/dist/assets/{env-BdJvhqF-.js → env-KUPen-sS.js} +1 -1
- package/dist/assets/{history-DmGNxMVh.js → history-S_cJLehJ.js} +1 -1
- package/dist/assets/{index-BXZp5ztx.js → index-CNkd6O5t.js} +3 -3
- package/dist/assets/{integrations-DAYe7RkJ.js → integrations-Dmbbbs_A.js} +1 -1
- package/dist/assets/{issues-D_zOo2IW.js → issues-EeBajY3I.js} +1 -1
- package/dist/assets/{learning-ilyEoffw.js → learning-DDRM-FoP.js} +1 -1
- package/dist/assets/{project-files-CJWdFXh4.js → project-files-CQ1BLaaP.js} +1 -1
- package/dist/assets/{publish-D728amkk.js → publish-bvwc-KoQ.js} +1 -1
- package/dist/assets/{pull-requests-BsbM-5MA.js → pull-requests-Ce1ECyuL.js} +1 -1
- package/dist/assets/{repository-C8NwO4bj.js → repository-CK3osHmp.js} +1 -1
- package/dist/assets/{settings-DTLY7ZT5.js → settings-PQGw4vfn.js} +1 -1
- package/dist/assets/{useArchivedVibe64Sessions-Cc9GdKlD.js → useArchivedVibe64Sessions-BAQjW01a.js} +1 -1
- package/dist/assets/{useAssistantAttachments-DJKqt1hL.js → useAssistantAttachments-DJWb1KdF.js} +1 -1
- package/dist/assets/{useVibe64ConversationLog-Co0DhC3R.js → useVibe64ConversationLog-CjUZuvV7.js} +1 -1
- package/dist/assets/{useVibe64SessionData-D7fBm9xf.js → useVibe64SessionData-CbY_B5mC.js} +1 -1
- package/dist/assets/{vibe64SessionFocus-8fHAeoyU.js → vibe64SessionFocus-Bd3JuuZe.js} +1 -1
- package/dist/index.html +4 -4
- package/docs/colleague-usage/conversation-context.md +3 -1
- package/docs/colleague-usage/temporary-chats.md +26 -1
- package/docs/colleague-usage/workspace-preparation.md +17 -0
- package/node_modules/@jskit-ai/assistant-core/locales/en.json +1 -0
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-core/locales/en.json +1 -0
- package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +43 -43
- package/node_modules/@local/vibe64-genesis/src/server/index.js +189 -182
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +68 -61
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +532 -532
- package/package.json +7 -7
- package/server.bundle.mjs +28835 -28791
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
2
2
|
var Lg=Object.create;var tc=Object.defineProperty;var Ug=Object.getOwnPropertyDescriptor;var Bg=Object.getOwnPropertyNames;var jg=Object.getPrototypeOf,Gg=Object.prototype.hasOwnProperty;var ke=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){
|
|
3
3
|
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Z=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Fg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bg(t))!Gg.call(e,o)&&o!==r&&tc(e,o,{get:()=>t[o],
|
|
4
|
-
enumerable:!(n=Ug(t,o))||n.enumerable});return e};var Hg=(e,t,r)=>(r=e!=null?Lg(jg(e)):{},Fg(t||!e||!e.__esModule?tc(r,"default",{value:e,enumerable:!0}):r,e));var Cl=Z((
|
|
4
|
+
enumerable:!(n=Ug(t,o))||n.enumerable});return e};var Hg=(e,t,r)=>(r=e!=null?Lg(jg(e)):{},Fg(t||!e||!e.__esModule?tc(r,"default",{value:e,enumerable:!0}):r,e));var Cl=Z((IN,Pl)=>{Pl.exports=Rl;Rl.sync=sw;var Il=ke("fs");function iw(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
6
|
e.substr(-o.length).toLowerCase()===o)return!0}return!1}function Al(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:iw(
|
|
7
|
-
t,r)}function Rl(e,t,r){Il.stat(e,function(n,o){r(n,n?!1:Al(o,e,t))})}function sw(e,t){return Al(Il.statSync(e),e,t)}});var Ml=Z((
|
|
7
|
+
t,r)}function Rl(e,t,r){Il.stat(e,function(n,o){r(n,n?!1:Al(o,e,t))})}function sw(e,t){return Al(Il.statSync(e),e,t)}});var Ml=Z((AN,$l)=>{$l.exports=kl;kl.sync=aw;var xl=ke("fs");function kl(e,t,r){xl.stat(e,function(n,o){r(n,n?!1:Nl(o,t))})}
|
|
8
8
|
function aw(e,t){return Nl(xl.statSync(e),t)}function Nl(e,t){return e.isFile()&&cw(e,t)}function cw(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),l=parseInt("001",8),u=a|c,d=r&l||r&c&&o===s||r&a&&n===i||r&u&&i===0;return d}});var Ll=Z((
|
|
10
|
+
a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&o===s||r&a&&n===i||r&u&&i===0;return d}});var Ll=Z((PN,Dl)=>{var RN=ke("fs"),yn;process.platform==="win32"||global.TESTING_WINDOWS?yn=Cl():yn=Ml();Dl.exports=Ui;Ui.
|
|
11
11
|
sync=lw;function Ui(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("ca\
|
|
12
12
|
llback not provided");return new Promise(function(n,o){Ui(e,t||{},function(i,s){i?o(i):n(s)})})}yn(e,t||{},function(n,o){
|
|
13
13
|
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function lw(e,t){try{return yn.sync(e,t||{})}catch(r){
|
|
14
|
-
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Vl=Z((
|
|
14
|
+
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Vl=Z((CN,Hl)=>{var Tt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Ul=ke("path"),
|
|
15
15
|
uw=Tt?";":":",Bl=Ll(),jl=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Gl=(e,t)=>{let r=t.colon||uw,n=e.
|
|
16
16
|
match(/\//)||Tt&&e.match(/\\/)?[""]:[...Tt?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=Tt?t.pathExt||
|
|
17
17
|
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=Tt?o.split(r):[""];return Tt&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(
|
|
18
18
|
""),{pathEnv:n,pathExt:i,pathExtExe:o}},Fl=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,
|
|
19
|
-
pathExtExe:i}=Gl(e,t),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return t.all&&s.length?u(s):d(jl(e));let p=n[l],
|
|
20
|
-
test(p)?p.slice(1,-1):p,
|
|
21
|
-
if(d===o.length)return p(a(u+1));let
|
|
19
|
+
pathExtExe:i}=Gl(e,t),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return t.all&&s.length?u(s):d(jl(e));let p=n[l],m=/^".*"$/.
|
|
20
|
+
test(p)?p.slice(1,-1):p,f=Ul.join(m,e),h=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;u(c(h,l,0))}),c=(l,u,d)=>new Promise((p,m)=>{
|
|
21
|
+
if(d===o.length)return p(a(u+1));let f=o[d];Bl(l+f,{pathExt:i},(h,_)=>{if(!h&&_)if(t.all)s.push(l+f);else return p(l+f);
|
|
22
22
|
return p(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},dw=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Gl(
|
|
23
23
|
e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=Ul.join(c,e),u=!c&&/^\.[\\\/]/.test(
|
|
24
24
|
e)?e.slice(0,2)+l:l;for(let d=0;d<n.length;d++){let p=u+n[d];try{if(Bl.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 jl(e)};Hl.exports=Fl;Fl.sync=dw});var Wl=Z((
|
|
26
|
-
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Bi.exports=zl;Bi.exports.default=zl});var Kl=Z((
|
|
25
|
+
if(t.all&&i.length)return i;if(t.nothrow)return null;throw jl(e)};Hl.exports=Fl;Fl.sync=dw});var Wl=Z((xN,Bi)=>{"use strict";var zl=(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"};Bi.exports=zl;Bi.exports.default=zl});var Kl=Z((kN,Jl)=>{"use strict";var ql=ke("path"),pw=Vl(),mw=Wl();function Yl(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=pw.sync(e.command,{path:r[
|
|
29
|
-
(s=ql.resolve(o?e.options.cwd:"",s)),s}function
|
|
28
|
+
let s;try{s=pw.sync(e.command,{path:r[mw({env:r})],pathExt:t?ql.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&
|
|
29
|
+
(s=ql.resolve(o?e.options.cwd:"",s)),s}function fw(e){return Yl(e)||Yl(e,!0)}Jl.exports=fw});var Xl=Z((NN,Gi)=>{"use strict";var ji=/([()\][%!^"`<>&|;, *?])/g;function hw(e){return e=e.replace(ji,"^$1"),e}function gw(e,t){
|
|
30
30
|
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(ji,
|
|
31
|
-
"^$1"),t&&(e=e.replace(ji,"^$1")),e}Gi.exports.command=hw;Gi.exports.argument=gw});var Zl=Z((
|
|
32
|
-
/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var nu=Z((
|
|
33
|
-
Fi.readSync(n,r,0,150,0),Fi.closeSync(n)}catch{}return yw(r.toString())}ru.exports=ww});var au=Z((
|
|
31
|
+
"^$1"),t&&(e=e.replace(ji,"^$1")),e}Gi.exports.command=hw;Gi.exports.argument=gw});var Zl=Z(($N,Ql)=>{"use strict";Ql.exports=/^#!(.*)/});var tu=Z((MN,eu)=>{"use strict";var bw=Zl();eu.exports=(e="")=>{let t=e.match(bw);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 nu=Z((DN,ru)=>{"use strict";var Fi=ke("fs"),yw=tu();function ww(e){let r=Buffer.alloc(150),n;try{n=Fi.openSync(e,"r"),
|
|
33
|
+
Fi.readSync(n,r,0,150,0),Fi.closeSync(n)}catch{}return yw(r.toString())}ru.exports=ww});var au=Z((LN,su)=>{"use strict";var _w=ke("path"),ou=Kl(),iu=Xl(),Sw=nu(),Ew=process.platform==="win32",vw=/\.(?:com|exe)$/i,
|
|
34
34
|
Tw=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ow(e){e.file=ou(e);let t=e.file&&Sw(e.file);return t?(e.args.unshift(
|
|
35
35
|
e.file),e.command=t,ou(e)):e.file}function Iw(e){if(!Ew)return e;let t=Ow(e),r=!vw.test(t);if(e.options.forceShell||r){let n=Tw.
|
|
36
36
|
test(t);e.command=_w.normalize(e.command),e.command=iu.command(e.command),e.args=e.args.map(i=>iu.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
38
|
windowsVerbatimArguments=!0}return e}function Aw(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:Iw(n)}su.exports=Aw});var uu=Z((
|
|
39
|
+
{},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:Iw(n)}su.exports=Aw});var uu=Z((UN,lu)=>{"use strict";var Hi=process.platform==="win32";function Vi(e,t){return Object.assign(new Error(`${t} ${e.
|
|
40
40
|
command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Rw(e,t){
|
|
41
41
|
if(!Hi)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=cu(o,t);if(i)return r.call(e,"error",i)}return r.apply(
|
|
42
42
|
e,arguments)}}function cu(e,t){return Hi&&e===1&&!t.file?Vi(t.original,"spawn"):null}function Pw(e,t){return Hi&&e===1&&
|
|
43
|
-
!t.file?Vi(t.original,"spawnSync"):null}lu.exports={hookChildProcess:Rw,verifyENOENT:cu,verifyENOENTSync:Pw,notFoundError:Vi}});var
|
|
43
|
+
!t.file?Vi(t.original,"spawnSync"):null}lu.exports={hookChildProcess:Rw,verifyENOENT:cu,verifyENOENTSync:Pw,notFoundError:Vi}});var mu=Z((BN,Ot)=>{"use strict";var du=ke("child_process"),zi=au(),Wi=uu();function pu(e,t,r){let n=zi(e,t,r),o=du.spawn(
|
|
44
44
|
n.command,n.args,n.options);return Wi.hookChildProcess(o,n),o}function Cw(e,t,r){let n=zi(e,t,r),o=du.spawnSync(n.command,
|
|
45
45
|
n.args,n.options);return o.error=o.error||Wi.verifyENOENTSync(o.status,n),o}Ot.exports=pu;Ot.exports.spawn=pu;Ot.exports.
|
|
46
|
-
sync=Cw;Ot.exports._parse=zi;Ot.exports._enoent=Wi});import{existsSync as
|
|
46
|
+
sync=Cw;Ot.exports._parse=zi;Ot.exports._enoent=Wi});import{existsSync as fP}from"node:fs";import hP from"node:path";var EP=Object.freeze(["none","pending","committed","rolledBack","unknown"]);function y(e,{fallback:t=""}={}){return String(e||"").trim()||t}function Te(e){return String(e??"").trim()}function ae(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function Qo(e){return ae(e)?{...e}:{}}var he=class extends Error{constructor(t,r,n={}){super(r,n.cause===void 0?void 0:{cause:n.cause}),this.name="AppError",this.
|
|
47
47
|
status=Number(t)||500,this.statusCode=this.status,this.code=n.code||"APP_ERROR",this.params=Qo(n.params),n.messageCode&&
|
|
48
48
|
(this.messageCode=String(n.messageCode),this.messageParams=Qo(n.messageParams)),this.details=n.details,this.headers=n.headers||
|
|
49
49
|
{}}};function X(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||
|
|
@@ -66,8 +66,8 @@ $`,Wg=new RegExp(`^${ac}$`),qg=new RegExp(`^${Yr}(?::${gt}(?:\\.(\\d+))?)?$`),Yg
|
|
|
66
66
|
0)}function Qg(e,t){return t===2?Xg(e)?29:28:Kg[t-1]}function uc(e,t,r){let n=Number(e),o=Number(t),i=Number(r);return o>=
|
|
67
67
|
1&&o<=12&&i>=1&&i<=Qg(n,o)}function sr(e,t){let r=e.temporalPrecision;if(r!==void 0){if(!Number.isInteger(r)||r<0)throw new Error(
|
|
68
68
|
`temporalPrecision for "${t}" must be a non-negative integer.`);return r}}function dc(e,t){return e===void 0?!0:t===void 0||
|
|
69
|
-
e.length<=t}function pc(e){if(typeof e!="string")return!1;let t=Wg.exec(e);return t!==null&&uc(t[1],t[2],t[3])}function
|
|
70
|
-
if(typeof e!="string")return!1;let r=qg.exec(e);return r!==null&&dc(r[1],t)}function
|
|
69
|
+
e.length<=t}function pc(e){if(typeof e!="string")return!1;let t=Wg.exec(e);return t!==null&&uc(t[1],t[2],t[3])}function mc(e,t){
|
|
70
|
+
if(typeof e!="string")return!1;let r=qg.exec(e);return r!==null&&dc(r[1],t)}function fc(e,t){if(typeof e!="string")return!1;
|
|
71
71
|
let r=Yg.exec(e);return r===null?!1:uc(r[1],r[2],r[3])&&dc(r[4],t)}function hc(e){return e===void 0?"(?:\\.\\d+)?":e===0?
|
|
72
72
|
"":`(?:\\.\\d{1,${e}})?`}function gc(e,t){let r=sr(e,t);return`^${Yr}(?::${gt}${hc(r)})?$`}function bc(e,t){let r=sr(e,t);
|
|
73
73
|
return`^${cc}T${Yr}:${gt}${hc(r)}${sc}$`}function ti(e,t){let r;if(typeof e=="number")r=e;else if(typeof e=="string"&&Jg.
|
|
@@ -111,12 +111,12 @@ let r=wc(t.mode);if(r!==t.operation)throw new Error(`Conflicting JSON Schema exp
|
|
|
111
111
|
operation '${t.operation}'.`)}if(t.operation!==void 0){if(!Object.hasOwn(e.operations,t.operation))throw new Error(`Unkn\
|
|
112
112
|
own JSON Schema export operation '${t.operation}'.`);return t.operation}return wc(t.mode)}function pb(e,t={}){if(t.operationName!==
|
|
113
113
|
void 0&&t.operationDescriptor!==void 0)return{operationName:t.operationName,operation:t.operationDescriptor};let r=db(e,
|
|
114
|
-
t);return{operationName:r,operation:e.operations[r]}}function
|
|
114
|
+
t);return{operationName:r,operation:e.operations[r]}}function mb(e={}){let t={...e};return Object.defineProperty(t,oi,{value:{
|
|
115
115
|
definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),t}function Kr(e={}){return e[oi]?e[oi]:{definitions:{},
|
|
116
|
-
nodes:[],nextDefinitionId:1,rootNode:null}}function
|
|
116
|
+
nodes:[],nextDefinitionId:1,rootNode:null}}function fb(e){return String(e).replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,
|
|
117
117
|
"")||"operation"}function ii(e){return X(e)&&Object.keys(e).length===1&&typeof e.$ref=="string"}function Jr(e){return ii(
|
|
118
118
|
e)?{allOf:[e]}:e}function hb(e,t,r,n,o){return e.nodes.find(i=>i.schema===t&&i.operationName===r&&i.operation===n&&i.additionalProperties===
|
|
119
|
-
o)||null}function gb(e,t){let r=
|
|
119
|
+
o)||null}function gb(e,t){let r=fb(t),n=`SchemaNode_${e.nextDefinitionId}_${r}`;return e.nextDefinitionId+=1,n}function _c(e,t,r,n,o,{
|
|
120
120
|
root:i=!1}={}){let s=Kr(t),a=hb(s,e,r,n,o);if(a)return i&&(a.pointer="#",s.rootNode=a),a;let c={schema:e,operationName:r,
|
|
121
121
|
operation:n,additionalProperties:o,status:"new",definitionName:i?null:gb(s,r),pointer:i?"#":null};return i?s.rootNode=c:
|
|
122
122
|
c.pointer=`#/definitions/${c.definitionName}`,s.nodes.push(c),c}function Sc(e,t){if(e.status==="built")return{$ref:e.pointer};
|
|
@@ -138,19 +138,19 @@ operation:o,mode:o,options:n});if(!s||typeof s!="object"||Array.isArray(s))throw
|
|
|
138
138
|
' returned an invalid JSON Schema fragment.`);if(r.type==="array"){let a=yb(e,t,r,n,o,i);if(a)return ar({...s,items:a},{
|
|
139
139
|
referenceBacked:ii(s)})}return ar(s,{referenceBacked:ii(s)})}function ui(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,
|
|
140
140
|
operation:o,mode:o,options:n},a=_b(e,t,r,n,o,i),c=a.referenceBacked?Jr(a.schema):{...a.schema},l={castType:r.type};for(let p of Object.
|
|
141
|
-
keys(r)){if(p==="type"||!Object.hasOwn(e.validators,p))continue;let
|
|
142
|
-
parameterValue:r[p],fieldSchema:{...c}});
|
|
141
|
+
keys(r)){if(p==="type"||!Object.hasOwn(e.validators,p))continue;let m=ub(e,p,t);if(!m)continue;let f=m({...s,parameterName:p,
|
|
142
|
+
parameterValue:r[p],fieldSchema:{...c}});f&&ab(c,f)}c[Ne]&&(ci(l,c[Ne]),delete c[Ne]);let u=[];r.nullable===!0&&u.push({
|
|
143
143
|
type:"null"}),r.nullOnEmpty===!0&&u.push({const:""});let d=Jr(cb(c,u));if(r.defaultTo!==void 0&&i.applyDefaults)if(typeof r.
|
|
144
144
|
defaultTo!="function"){let p=e._normalizeDefault(r,r.defaultTo,{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},
|
|
145
|
-
options:{},settings:e._buildOperationSettings(o,i,{})});if(Object.keys(p.errors).length>0){let
|
|
146
|
-
throw new Error(`defaultTo for "${t}" is invalid (${
|
|
147
|
-
return d[Ne]=l,d}function Ec(e,t={}){let r=
|
|
145
|
+
options:{},settings:e._buildOperationSettings(o,i,{})});if(Object.keys(p.errors).length>0){let m=Object.values(p.errors)[0];
|
|
146
|
+
throw new Error(`defaultTo for "${t}" is invalid (${m.code}).`)}d.default=p.value}else l.defaults={providedByFunction:!0};
|
|
147
|
+
return d[Ne]=l,d}function Ec(e,t={}){let r=mb(t),{operationName:n,operation:o}=pb(e,r),i=r.additionalProperties===void 0?
|
|
148
148
|
!1:r.additionalProperties,s=Kr(r),a=_c(e,r,n,o,i,{root:!0}),c={$schema:rb,...Sc(a,r)};return Object.keys(s.definitions).
|
|
149
149
|
length>0&&(c.definitions=s.definitions),c}function vc(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function hi(e){return e instanceof
|
|
150
150
|
wt}function Sb(){return{self:!1,children:{}}}function Tc(e){return Object.keys(e.children).length>0}function We(e,t){return`${e}\
|
|
151
151
|
.${String(t)}`}function Cc(e,t){return e===""?String(t):We(e,t)}function Oc(e,t){if(e===t)return"";let r=`${t}.`;return e.
|
|
152
152
|
startsWith(r)?e.slice(r.length):null}function bt(e,t){let r={};for(let n of Object.values(e)){let o=We(t,n.field);P(r,o,
|
|
153
|
-
{...n,field:o})}return r}function
|
|
153
|
+
{...n,field:o})}return r}function mi(e){return ri(e,"validatePath")}function Ic(e){let t={};for(let r of e){let n=mi(r),
|
|
154
154
|
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||P(o,s,Sb()),i===n.length-1&&(o[s].self=!0),o=o[s].children}}
|
|
155
155
|
return t}function Eb(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||!Object.hasOwn(r,n))return;r=r[n]}return r}
|
|
156
156
|
function Xr(e){return e===null?!0:Array.isArray(e)||X(e)?Object.keys(e).length>0:e!==void 0}function Ac(e){return[...e].
|
|
@@ -163,11 +163,11 @@ e.source,e.flags);return n.lastIndex=e.lastIndex,n}if(t.has(e))return t.get(e);i
|
|
|
163
163
|
for(let o of e)n.push(Qr(o,t));return n}if(!X(e))return e;let r={};t.set(e,r);for(let[n,o]of Object.entries(e))P(r,n,Qr(
|
|
164
164
|
o,t));return r}function Zr(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e)||hi(e))return e;if(t.add(e),Array.
|
|
165
165
|
isArray(e))for(let r of e)Zr(r,t);else for(let r of Reflect.ownKeys(e))Zr(e[r],t);return Object.freeze(e)}function di(e){
|
|
166
|
-
return Zr(Qr(e))}function
|
|
166
|
+
return Zr(Qr(e))}function fi(e,t,r=""){if(!hi(e)||!Array.isArray(t)||t.length<1)return null;let[n,...o]=t;if(!Object.hasOwn(
|
|
167
167
|
e.structure,n))return null;let i=e.structure[n];if(o.length<1)return i;let s=Cc(r,n);return xc(e,i,o,s)}function xc(e,t,r,n){
|
|
168
|
-
if(t?.type==="object"){let o=e._resolveObjectFieldMode(n,t);return o.kind!=="nested"?null:
|
|
168
|
+
if(t?.type==="object"){let o=e._resolveObjectFieldMode(n,t);return o.kind!=="nested"?null:fi(o.schema,r,n)}if(t?.type===
|
|
169
169
|
"array"){let o=e._resolveArrayItemsConfig(n,t);if(!o||r.length<1)return null;let[i,...s]=r;if(!vb(i))return null;let a=We(
|
|
170
|
-
n,i);return o.kind==="schema"?s.length<1?null:
|
|
170
|
+
n,i);return o.kind==="schema"?s.length<1?null:fi(o.schema,s,a):s.length<1?o.definition:xc(e,o.definition,s,a)}return null}
|
|
171
171
|
function yt(e,t){let r={...e};if(Array.isArray(e.skipFields)){let n=e.skipFields.map(o=>Oc(o,t)).filter(o=>o!==null&&o!==
|
|
172
172
|
"");n.length>0?r.skipFields=n:delete r.skipFields}if(X(e.skipParams)){let n={};for(let[o,i]of Object.entries(e.skipParams)){
|
|
173
173
|
let s=Oc(o,t);s===null||s===""||P(n,s,i)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}var Ob=Object.
|
|
@@ -210,9 +210,9 @@ nullable===!0||a.nullable===!0,u=t.nullOnEmpty===!0||a.nullOnEmpty===!0;if(!Obje
|
|
|
210
210
|
{errors:this._singleErrorMap({field:n,code:"NOT_NULLABLE",message:"Field cannot be null",params:{}}),shouldContinue:!1};
|
|
211
211
|
if(r===""&&u)return P(o,i,null),{errors:{},shouldContinue:!1};let p={schema:this,definition:t,value:r,fieldName:n,object:o,
|
|
212
212
|
objectBeforeCast:s,valueBeforeCast:r,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
|
|
213
|
-
nullable:l||u,nullOnEmpty:u},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(f,
|
|
214
|
-
n,f,
|
|
215
|
-
i,
|
|
213
|
+
nullable:l||u,nullOnEmpty:u},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(m,f,h)=>{throw this._paramError(
|
|
214
|
+
n,m,f,h)}};try{let m=d(p);if(vc(m))throw new Error(`Type handler for "${t.type}" must be synchronous.`);m!==void 0&&(P(o,
|
|
215
|
+
i,m),p.value=m)}catch(m){if(m.errorObject)return{errors:this._singleErrorMap(m.errorObject),shouldContinue:!1};throw m}return{
|
|
216
216
|
errors:{},context:p,shouldContinue:!0}}_runFieldValidators(t,r,n,o,i,s){for(let a of Object.keys(t)){if(a==="type"||this.
|
|
217
217
|
_paramToBeSkipped(a,s.skipParams,r)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{i.parameterName=
|
|
218
218
|
a,i.parameterValue=t[a];let l=c(i);if(vc(l))throw new Error(`Validator handler for "${a}" must be synchronous.`);l!==void 0&&
|
|
@@ -231,14 +231,14 @@ entries(t))Object.hasOwn(r.structure,o)&&P(n,o,i);return n}_mergeKnownAndPassthr
|
|
|
231
231
|
keys(t)){if(!Object.hasOwn(r.structure,i)){P(o,i,t[i]);continue}Object.hasOwn(n,i)&&P(o,i,n[i])}for(let[i,s]of Object.entries(
|
|
232
232
|
n))Object.hasOwn(o,i)||P(o,i,s);return o}_validateObjectValues(t,r,n,o,i,s){let a=r[n],c={...a},l={};P(r,n,c);for(let u of Object.
|
|
233
233
|
keys(a)){let d=We(t,u);if(this._fieldToBeSkipped(d,i))continue;let p=c[u];if(p===void 0){s.rejectExplicitUndefined?this.
|
|
234
|
-
_mergeErrors(l,this._singleErrorMap(this._typeError(d).errorObject)):delete c[u];continue}if(o.kind==="schema"){let
|
|
235
|
-
schema._validateWithOperation("replace",o.schema.operations.replace,p,yt(i,d));P(c,u,
|
|
236
|
-
l,bt(
|
|
237
|
-
definition,s));this._mergeErrors(l,
|
|
234
|
+
_mergeErrors(l,this._singleErrorMap(this._typeError(d).errorObject)):delete c[u];continue}if(o.kind==="schema"){let f=o.
|
|
235
|
+
schema._validateWithOperation("replace",o.schema.operations.replace,p,yt(i,d));P(c,u,f.validatedObject),this._mergeErrors(
|
|
236
|
+
l,bt(f.errors,d));continue}let m=this._normalizeAndValidateValue(o.definition,p,d,c,u,a,i,this._buildArrayItemSettings(o.
|
|
237
|
+
definition,s));this._mergeErrors(l,m)}return l}_validateArrayItems(t,r,n,o,i,s){let a=r[n],c=a.slice(),l={};P(r,n,c);for(let u=0;u<
|
|
238
238
|
c.length;u++){let d=We(t,u);if(this._fieldToBeSkipped(d,i))continue;if(!Object.hasOwn(a,u)||c[u]===void 0){s.rejectExplicitUndefined?
|
|
239
|
-
this._mergeErrors(l,this._singleErrorMap(this._typeError(d).errorObject)):delete c[u];continue}if(o.kind==="schema"){let
|
|
240
|
-
schema._validateWithOperation("replace",o.schema.operations.replace,c[u],yt(i,d));P(c,u,
|
|
241
|
-
l,bt(
|
|
239
|
+
this._mergeErrors(l,this._singleErrorMap(this._typeError(d).errorObject)):delete c[u];continue}if(o.kind==="schema"){let m=o.
|
|
240
|
+
schema._validateWithOperation("replace",o.schema.operations.replace,c[u],yt(i,d));P(c,u,m.validatedObject),this._mergeErrors(
|
|
241
|
+
l,bt(m.errors,d));continue}let p=this._normalizeAndValidateValue(o.definition,c[u],d,c,u,a,i,this._buildArrayItemSettings(
|
|
242
242
|
o.definition,s));this._mergeErrors(l,p)}return l}_validateField(t,r,n,o,i){if(!Object.hasOwn(this.structure,t))return{};
|
|
243
243
|
let s=this.structure[t];if(this._fieldToBeSkipped(t,o))return{};let a=i.isFieldPresent(t),c=r[t],l=c===void 0;return i.enforceRequired&&
|
|
244
244
|
s.required&&(!a||l)&&!this._paramToBeSkipped("required",o.skipParams,t)?this._singleErrorMap({field:t,code:"REQUIRED",message:"\
|
|
@@ -254,34 +254,34 @@ _buildOperationResult(n,s,a),errors:i}}_validateSelectedTree(t,r,n,o,i=""){let s
|
|
|
254
254
|
let l=Cc(i,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema path "${l}".`);let u=this._validateSelectedField(
|
|
255
255
|
c,t[c],r,a,n,o,l);this._mergeErrors(s,u)}return{validatedObject:a,errors:s}}_validateSelectedField(t,r,n,o,i,s,a){if(!Object.
|
|
256
256
|
hasOwn(this.structure,t))return{};let c=this.structure[t],l=r.self===!0,u=Tc(r);if(this._fieldToBeSkipped(a,i))return{};
|
|
257
|
-
let d=Object.hasOwn(n,t),p=n[t],
|
|
258
|
-
a)&&this._mergeErrors(
|
|
257
|
+
let d=Object.hasOwn(n,t),p=n[t],m={};if(!d){if(l&&s.enforceRequired&&c.required&&!this._paramToBeSkipped("required",i.skipParams,
|
|
258
|
+
a)&&this._mergeErrors(m,this._singleErrorMap({field:a,code:"REQUIRED",message:"Field is required",params:{}})),l&&s.applyDefaults&&
|
|
259
259
|
c.defaultTo!==void 0){let g=typeof c.defaultTo=="function"?c.defaultTo():c.defaultTo,S=this._normalizeDefault(c,g,{fieldPath:a,
|
|
260
|
-
currentObject:o,containerKey:t,objectBeforeCast:n,options:i,settings:s});this._mergeErrors(
|
|
261
|
-
length===0&&P(o,t,S.value)}return
|
|
262
|
-
a).errorObject):{};let
|
|
263
|
-
|
|
260
|
+
currentObject:o,containerKey:t,objectBeforeCast:n,options:i,settings:s});this._mergeErrors(m,S.errors),Object.keys(S.errors).
|
|
261
|
+
length===0&&P(o,t,S.value)}return m}if(p===void 0)return l&&s.rejectExplicitUndefined?this._singleErrorMap(this._typeError(
|
|
262
|
+
a).errorObject):{};let f={[t]:p};if(l){let g=this._normalizeAndValidateValue(c,p,a,f,t,n,i,s);return Object.hasOwn(f,t)&&
|
|
263
|
+
f[t]!==void 0?P(o,t,f[t]):f[t]===null&&P(o,t,null),g}if(!u)return{};let h=this._castValue(c,p,a,f,t,n,i,s);if(Object.keys(
|
|
264
264
|
h.errors).length>0)return h.errors;if(!h.shouldContinue)return{};let _=this._validateSelectedDescendants(c,r.children,a,
|
|
265
|
-
|
|
265
|
+
f,t,i,s);return Xr(f[t])&&P(o,t,f[t]),_}_validateSelectedDescendants(t,r,n,o,i,s,a){if(t.type==="object"){let c=this._resolveObjectFieldMode(
|
|
266
266
|
n,t);if(c.kind!=="nested")throw new Error(`Schema path "${n}" does not support nested field selection.`);let l=o[i];if(!X(
|
|
267
267
|
l))return{};let u=c.schema._validateSelectedTree(r,l,yt(s,n),{...a,defaultedFields:new Set});return P(o,i,u.validatedObject),
|
|
268
268
|
bt(u.errors,n)}if(t.type==="array"){let c=this._resolveArrayItemsConfig(n,t);if(!c)throw new Error(`Schema path "${n}" d\
|
|
269
269
|
oes not define array items for nested selection.`);return this._validateSelectedArrayItems(n,o,i,c,r,s,a)}throw new Error(
|
|
270
270
|
`Schema path "${n}" does not support nested field selection.`)}_validateSelectedArrayItems(t,r,n,o,i,s,a){let c=[],l=r[n],
|
|
271
271
|
u={};P(r,n,c);for(let d of Ac(Object.keys(i))){if(!/^[0-9]+$/.test(d))throw new Error(`Schema path "${We(t,d)}" is inval\
|
|
272
|
-
id because array segments must use numeric indexes.`);let p=Number(d),
|
|
273
|
-
|
|
274
|
-
if(g===void 0){h&&a.rejectExplicitUndefined&&P(u,
|
|
275
|
-
let E=o.schema._validateWithOperation("replace",o.schema.operations.replace,g,yt(s,
|
|
276
|
-
this._mergeErrors(u,bt(E.errors,
|
|
272
|
+
id because array segments must use numeric indexes.`);let p=Number(d),m=We(t,p),f=i[d],h=f.self===!0,_=Tc(f);if(this._fieldToBeSkipped(
|
|
273
|
+
m,s))continue;if(!Object.hasOwn(l,p)){h&&a.rejectExplicitUndefined&&P(u,m,this._typeError(m).errorObject);continue}let g=l[p];
|
|
274
|
+
if(g===void 0){h&&a.rejectExplicitUndefined&&P(u,m,this._typeError(m).errorObject);continue}if(o.kind==="schema"){if(h){
|
|
275
|
+
let E=o.schema._validateWithOperation("replace",o.schema.operations.replace,g,yt(s,m));Xr(E.validatedObject)&&P(c,p,E.validatedObject),
|
|
276
|
+
this._mergeErrors(u,bt(E.errors,m));continue}if(!_)continue;let T=o.schema._validateSelectedTree(f.children,g,yt(s,m),{...a,
|
|
277
277
|
operationName:"replace",operation:o.schema.operations.replace,defaultedFields:new Set});Xr(T.validatedObject)&&P(c,p,T.validatedObject),
|
|
278
|
-
this._mergeErrors(u,bt(T.errors,
|
|
279
|
-
o.definition,g,
|
|
280
|
-
continue}if(!_)continue;let b=this._castValue(o.definition,g,
|
|
281
|
-
u,b.errors);continue}if(!b.shouldContinue)continue;let R=this._validateSelectedDescendants(o.definition,
|
|
278
|
+
this._mergeErrors(u,bt(T.errors,m));continue}let S=this._buildArrayItemSettings(o.definition,a),v=[g];if(h){let T=this._normalizeAndValidateValue(
|
|
279
|
+
o.definition,g,m,v,0,l,s,S);Object.hasOwn(v,0)&&v[0]!==void 0?P(c,p,v[0]):v[0]===null&&P(c,p,null),this._mergeErrors(u,T);
|
|
280
|
+
continue}if(!_)continue;let b=this._castValue(o.definition,g,m,v,0,l,s,S);if(Object.keys(b.errors).length>0){this._mergeErrors(
|
|
281
|
+
u,b.errors);continue}if(!b.shouldContinue)continue;let R=this._validateSelectedDescendants(o.definition,f.children,m,v,0,
|
|
282
282
|
s,S);Xr(v[0])&&P(c,p,v[0]),this._mergeErrors(u,R)}return u}validateWith(t,r,n={}){if(!Object.hasOwn(this.operations,t))throw new Error(
|
|
283
283
|
`Unknown operation "${t}".`);let o=this.operations[t];return this._assertPlainObjectInput(t,r),this._validateWithOperation(
|
|
284
|
-
t,o,r,n)}validateAt(t,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=
|
|
284
|
+
t,o,r,n)}validateAt(t,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=mi(t),{operationName:i,operation:s,validationOptions:a}=this.
|
|
285
285
|
_resolvePathValidationRequest(n),c=this._validateSelectedTree(Ic([t]),r,a,this._buildOperationSettings(i,s,r));return{validatedValue:Eb(
|
|
286
286
|
c.validatedObject,o),errors:c.errors}}validatePaths(t,r,n={}){if(this._assertPlainObjectInput("validatePaths",r),!Array.
|
|
287
287
|
isArray(t)||t.length===0)throw new Error("validatePaths() expects a non-empty array of schema paths.");let{operationName:o,
|
|
@@ -289,9 +289,9 @@ operation:i,validationOptions:s}=this._resolvePathValidationRequest(n);return th
|
|
|
289
289
|
_buildOperationSettings(o,i,r))}_installOperationMethods(){for(let t of Object.keys(this.operations)){if(t in this)throw new Error(
|
|
290
290
|
`Operation name "${t}" is reserved and cannot be used as a schema method.`);this[t]=(r,n={})=>this.validateWith(t,r,n)}}toJsonSchema(t={}){
|
|
291
291
|
return Ec(this,t)}getFieldDefinitions(){return di(this.structure)}getFieldDefinition(t){if(typeof t!="string"||t.trim()===
|
|
292
|
-
"")throw new Error("Field path must be a non-empty string.");let r=
|
|
292
|
+
"")throw new Error("Field path must be a non-empty string.");let r=fi(this,mi(t.trim()));return r===null?null:di(r)}getFieldMessages(t){
|
|
293
293
|
let r=this.getFieldDefinition(t);return!r||typeof r.messages!="object"||r.messages===null?Object.freeze({}):di(r.messages)}cleanup(t,r){
|
|
294
|
-
let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&P(n,o,t[o]);return n}};var{parse:
|
|
294
|
+
let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&P(n,o,t[o]);return n}};var{parse:JP,stringify:Pb}=JSON,{keys:KP}=Object,Cb=String,xb="string";var kc="object",kb=(e,t)=>t;var Nc=(e,t,r)=>{let n=Cb(t.push(r)-1);return e.set(r,n),n};var $c=(e,t,r)=>{let n=t&&typeof t===kc?(u,d)=>u===""||-1<t.indexOf(u)?d:void 0:t||kb,o=new Map,i=[],s=[],a=+Nc(o,i,n.call(
|
|
295
295
|
{"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=Pb(i[a++],l,r);return"["+s.join(",")+"]";function l(u,d){if(c)return c=!c,
|
|
296
296
|
d;let p=n.call(this,u,d);switch(typeof p){case kc:if(p===null)return p;case xb:return o.get(p)||Nc(o,i,p)}return p}};var $b=new Set(["true","1","yes","y","on"]),Mb=new Set(["false","0","no","n","off"]);function Db(e){return e!==null&&(typeof e==
|
|
297
297
|
"object"||typeof e=="function")&&typeof e.then=="function"}function Mc(e){if(typeof e=="number")return Number.isFinite(e)?
|
|
@@ -308,9 +308,9 @@ t("string",n=>{let o=n.value;if(o==null)return"";let i=typeof o;if(i==="string"|
|
|
|
308
308
|
return n.definition.noTrim?s:s.trim()}n.throwTypeError()}),t("blob",n=>n.value),t("number",n=>{let o=Mc(n.value);return o===
|
|
309
309
|
null&&n.throwTypeError(),o}),t("integer",n=>{let o=Mc(n.value);return(o===null||!Number.isInteger(o))&&n.throwTypeError(),
|
|
310
310
|
o}),t("epochMilliseconds",n=>{let o=ti(n.value,864e13);return o===null&&n.throwTypeError(),o}),t("epochSeconds",n=>{let o=ti(
|
|
311
|
-
n.value,864e10);return o===null&&n.throwTypeError(),o}),t("dateTime",n=>{let o=sr(n.definition,n.fieldName);return
|
|
311
|
+
n.value,864e10);return o===null&&n.throwTypeError(),o}),t("dateTime",n=>{let o=sr(n.definition,n.fieldName);return fc(n.
|
|
312
312
|
value,o)||n.throwTypeError(),n.value}),t("date",n=>(pc(n.value)||n.throwTypeError(),n.value)),t("time",n=>{let o=sr(n.definition,
|
|
313
|
-
n.fieldName);return
|
|
313
|
+
n.fieldName);return mc(n.value,o)||n.throwTypeError(),n.value}),t("array",n=>n.definition.type==="array"&&!Array.isArray(
|
|
314
314
|
n.value)?[n.value]:n.value),t("object",n=>(X(n.value)||n.throwTypeError(),n.value)),t("serialize",n=>{try{return JSON.stringify(
|
|
315
315
|
n.value)}catch{try{return $c(n.value)}catch{n.throwTypeError()}}}),t("boolean",n=>{if(typeof n.value=="boolean")return n.
|
|
316
316
|
value;if(typeof n.value=="number"){if(n.value===1)return!0;if(n.value===0)return!1;n.throwTypeError()}if(typeof n.value==
|
|
@@ -364,7 +364,7 @@ ust be schema instances or schema factories created by json-rest-schema.");Uc(o,
|
|
|
364
364
|
ator")}return{types:o,validators:i}}function Fc({types:e={},validators:t={},installCore:r=!0}={}){let n=en(e),o=en(t),i=(s,a={})=>{
|
|
365
365
|
let c=new wt(s,n,o,a.operations);return Lc(c,n,o),c};return Lc(i,n,o),i.addType=(s,a)=>{Ub(n,s,a)},i.addValidator=(s,a)=>{
|
|
366
366
|
Bb(o,s,a)},i.use=s=>{jb(s,{addType:i.addType,addValidator:i.addValidator})},i.createFactory=(...s)=>{let a=Vb(n,o,s);return Fc(
|
|
367
|
-
{types:a.types,validators:a.validators,installCore:!1})},r&&i.use(Dc),i}var Hc=Fc({installCore:!0});var
|
|
367
|
+
{types:a.types,validators:a.validators,installCore:!1})},r&&i.use(Dc),i}var Hc=Fc({installCore:!0});var bC=Object.freeze({schema:Hc({}),mode:"replace"});var Vc=/^[a-z][a-z0-9_.-]*$/u,Wb=/^[A-Za-z_$][A-Za-z0-9_$]*$/u;function zc(e,t){let r=String(e||"").trim().toLowerCase();
|
|
368
368
|
if(!Vc.test(r))throw new TypeError(`${t} must match ${Vc.toString()}.`);return r}function bi(e,t){if(e==null)return Object.
|
|
369
369
|
freeze({});if(!ae(e))throw new TypeError(`${t} must be an object mapping local names to capability ids.`);let r={},n=new Set;
|
|
370
370
|
for(let[o,i]of Object.entries(e)){let s=String(o||"").trim();if(!Wb.test(s))throw new TypeError(`${t} local name "${s}" \
|
|
@@ -411,7 +411,7 @@ itch.conf","utf8").catch(()=>"")).matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*
|
|
|
411
411
|
()=>"")).split(/\r?\n/u).map(Ei).find(p=>p?.username===i);if(d)return d}}let s;if(r==="darwin"){let a=cr({userInfo:o});if(a.
|
|
412
412
|
username===i)return a;[s]=oy(await Jc(t,"dscacheutil",["-q","user","-a","name",i]))}else s=Ei((await Jc(t,"getent",["pas\
|
|
413
413
|
swd",i])).split(/\r?\n/u)[0]);if(!s||s.username!==i){let a=new Error(`OS user was not found: ${i}`);throw a.code="vibe64\
|
|
414
|
-
_os_user_not_found",a}return s}var
|
|
414
|
+
_os_user_not_found",a}return s}var px=Object.freeze({parsePasswdLine:Ei});import iy from"node:os";import Ti from"node:path";import on from"node:path";function C(e=""){return String(e??"").trim()}function vi(e=null){let t=Number(e);return Number.
|
|
415
415
|
isSafeInteger(t)&&t>=0?t:null}function x(e=""){let t=C(e);return t?on.resolve(t):""}function $e(e="",t=""){let r=x(e),n=x(
|
|
416
416
|
t);if(!r||!n)return!1;let o=on.relative(r,n);return o!==".."&&!o.startsWith(`..${on.sep}`)&&!on.isAbsolute(o)}function F(e={}){
|
|
417
417
|
return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function re(e={}){return Object.fromEntries(Object.entries(F(e)).map(
|
|
@@ -429,12 +429,12 @@ e)===String.prototype,Pi=e=>e instanceof URL?sy(e):e;var sn=(e,t=[],r={})=>{let
|
|
|
429
429
|
cond argument must be either an array of arguments or an options object: ${o}`);if(o.some(c=>typeof c=="object"&&c!==null))
|
|
430
430
|
throw new TypeError(`Second argument must be an array of strings: ${o}`);let s=o.map(String),a=s.find(c=>c.includes("\0"));
|
|
431
431
|
if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!L(i))throw new TypeError(`Las\
|
|
432
|
-
t argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as
|
|
432
|
+
t argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as fy}from"node:child_process";import{StringDecoder as cy}from"node:string_decoder";var{toString:Zc}=Object.prototype,el=e=>Zc.call(e)==="[object Array\
|
|
433
433
|
Buffer]",j=e=>Zc.call(e)==="[object Uint8Array]",Ie=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),ly=new TextEncoder,
|
|
434
434
|
tl=e=>ly.encode(e),uy=new TextDecoder,an=e=>uy.decode(e),rl=(e,t)=>dy(e,t).join(""),dy=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i==
|
|
435
435
|
"string"))return e;let r=new cy(t),n=e.map(i=>typeof i=="string"?tl(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[
|
|
436
436
|
...n,o]},ur=e=>e.length===1&&j(e[0])?e[0]:Ci(py(e)),py=e=>e.map(t=>typeof t=="string"?tl(t):t),Ci=e=>{let t=new Uint8Array(
|
|
437
|
-
|
|
437
|
+
my(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},my=e=>{let t=0;for(let r of e)t+=r.length;return t};var sl=e=>Array.isArray(e)&&Array.isArray(e.raw),al=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=hy({templates:e,expressions:t,
|
|
438
438
|
tokens:r,index:i,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[
|
|
439
439
|
n,o,{}]},hy=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backs\
|
|
440
440
|
lash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=gy(o,e.raw[n]),c=ol(r,i,s);if(n===
|
|
@@ -445,7 +445,7 @@ a+=1){let c=t[a];if(nl.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"
|
|
|
445
445
|
leadingWhitespaces:o,trailingWhitespaces:i}},nl=new Set([" "," ","\r",`
|
|
446
446
|
`]),by={x:3,u:5},ol=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(
|
|
447
447
|
1)],il=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(L(e)&&("stdout"in e||"isMaxBuffer"in
|
|
448
|
-
e))return yy(e);throw e instanceof
|
|
448
|
+
e))return yy(e);throw e instanceof fy||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected \
|
|
449
449
|
subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected \
|
|
450
450
|
"${t}" in template expression`)},yy=({stdout:e})=>{if(typeof e=="string")return e;if(j(e))return an(e);throw e===void 0?
|
|
451
451
|
new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" o\
|
|
@@ -468,9 +468,9 @@ n=r.join(" "),o=r.map(i=>Ly(pl(i))).join(" ");return{command:n,escapedCommand:o}
|
|
|
468
468
|
`),pl=e=>e.replaceAll($y,t=>ky(t)),ky=e=>{let t=My[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=
|
|
469
469
|
Dy?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Ny=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},
|
|
470
470
|
$y=Ny(),My={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Dy=65535,Ly=e=>Uy.test(e)?e:Cy==="win32"?`"${e.
|
|
471
|
-
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,Uy=/^[\w./-]+$/;import
|
|
471
|
+
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,Uy=/^[\w./-]+$/;import ml from"node:process";function Di(){let{env:e}=ml,{TERM:t,TERM_PROGRAM:r}=e;return ml.platform!=="win32"?t!=="lin\
|
|
472
472
|
ux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xter\
|
|
473
|
-
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var
|
|
473
|
+
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var fl={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",
|
|
474
474
|
squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\
|
|
475
475
|
\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",
|
|
476
476
|
triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\
|
|
@@ -521,20 +521,20 @@ oneNinth:"\u2151",oneTenth:"\u2152"},By={tick:"\u221A",info:"i",warning:"\u203C"
|
|
|
521
521
|
circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"\
|
|
522
522
|
( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\
|
|
523
523
|
\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"\
|
|
524
|
-
1/7",oneNinth:"1/9",oneTenth:"1/10"},jy={...
|
|
524
|
+
1/7",oneNinth:"1/9",oneTenth:"1/10"},jy={...fl,...hl},Gy={...fl,...By},Fy=Di(),Hy=Fy?jy:Gy,pn=Hy,Kx=Object.entries(hl);import Vy from"node:tty";var zy=Vy?.WriteStream?.prototype?.hasColors?.()??!1,I=(e,t)=>{if(!zy)return o=>o;let r=`\x1B[${e}\
|
|
525
525
|
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,u=(t===22?n:"")+r;for(;s!==-1;)
|
|
526
|
-
a+=i.slice(c,s)+u,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},
|
|
527
|
-
4,24),
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
49),
|
|
532
|
-
59),
|
|
533
|
-
58;5;12",59),
|
|
534
|
-
c=qy[e]({failed:i,reject:s,piped:n}),l=Yy[e]({reject:s});return`${
|
|
535
|
-
e.getHours(),2)}:${
|
|
526
|
+
a+=i.slice(c,s)+u,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},Zx=I(0,0),gl=I(1,22),ek=I(2,22),tk=I(3,23),rk=I(
|
|
527
|
+
4,24),nk=I("4:2",24),ok=I("4:3",24),ik=I("4:4",24),sk=I("4:5",24),ak=I(53,55),ck=I(7,27),lk=I(8,28),uk=I(9,29),dk=I(30,39),
|
|
528
|
+
pk=I(31,39),mk=I(32,39),fk=I(33,39),hk=I(34,39),gk=I(35,39),bk=I(36,39),yk=I(37,39),mn=I(90,39),wk=I(40,49),_k=I(41,49),
|
|
529
|
+
Sk=I(42,49),Ek=I(43,49),vk=I(44,49),Tk=I(45,49),Ok=I(46,49),Ik=I(47,49),Ak=I(100,49),bl=I(91,39),Rk=I(92,39),yl=I(93,39),
|
|
530
|
+
Pk=I(94,39),Ck=I(95,39),xk=I(96,39),kk=I(97,39),Nk=I(101,49),$k=I(102,49),Mk=I(103,49),Dk=I(104,49),Lk=I(105,49),Uk=I(106,
|
|
531
|
+
49),Bk=I(107,49),jk=I("58;5;0",59),Gk=I("58;5;1",59),Fk=I("58;5;2",59),Hk=I("58;5;3",59),Vk=I("58;5;4",59),zk=I("58;5;5",
|
|
532
|
+
59),Wk=I("58;5;6",59),qk=I("58;5;7",59),Yk=I("58;5;8",59),Jk=I("58;5;9",59),Kk=I("58;5;10",59),Xk=I("58;5;11",59),Qk=I("\
|
|
533
|
+
58;5;12",59),Zk=I("58;5;13",59),eN=I("58;5;14",59),tN=I("58;5;15",59);var Sl=({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},options:{reject:s=!0}})=>{let a=Wy(r),
|
|
534
|
+
c=qy[e]({failed:i,reject:s,piped:n}),l=Yy[e]({reject:s});return`${mn(`[${a}]`)} ${mn(`[${o}]`)} ${l(c)} ${l(t)}`},Wy=e=>`${fn(
|
|
535
|
+
e.getHours(),2)}:${fn(e.getMinutes(),2)}:${fn(e.getSeconds(),2)}.${fn(e.getMilliseconds(),3)}`,fn=(e,t)=>String(e).padStart(
|
|
536
536
|
t,"0"),wl=({failed:e,reject:t})=>e?t?pn.cross:pn.warning:pn.tick,qy={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"\
|
|
537
|
-
*",error:wl,duration:wl},_l=e=>e,Yy={command:()=>gl,output:()=>_l,ipc:()=>_l,error:({reject:e})=>e?bl:yl,duration:()=>
|
|
537
|
+
*",error:wl,duration:wl},_l=e=>e,Yy={command:()=>gl,output:()=>_l,ipc:()=>_l,error:({reject:e})=>e?bl:yl,duration:()=>mn};var El=(e,t,r)=>{let n=ul(t,r);return e.map(({verboseLine:o,verboseObject:i})=>Jy(o,i,n)).filter(o=>o!==void 0).map(o=>Ky(
|
|
538
538
|
o)).join("")},Jy=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},Ky=e=>e.endsWith(`
|
|
539
539
|
`)?e:`${e}
|
|
540
540
|
`;var ge=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:n,result:o})=>{let i=Qy({type:e,result:o,verboseInfo:n}),s=Zy(t,
|
|
@@ -547,17 +547,17 @@ void 0,nw=0n,ow=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose:
|
|
|
547
547
|
'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!dn.includes(
|
|
548
548
|
t)&&!un(t)){let r=dn.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed val\
|
|
549
549
|
ues are: ${r} or a function.`)}}};import{hrtime as Ol}from"node:process";var gn=()=>Ol.bigint(),Li=e=>Number(Ol.bigint()-e)/1e6;var bn=(e,t,r)=>{let n=gn(),{command:o,escapedCommand:i}=dl(e,t),s=ki(r,"verbose"),a=Tl(s,i,{...r});return vl(i,a),{command:o,
|
|
550
|
-
escapedCommand:i,startTime:n,verboseInfo:a}};var Td=Hg(
|
|
551
|
-
find(n=>n.toUpperCase()==="PATH")||"Path"}import{promisify as xw}from"node:util";import{execFile as kw,execFileSync as
|
|
552
|
-
import{fileURLToPath as Nw}from"node:url";var
|
|
550
|
+
escapedCommand:i,startTime:n,verboseInfo:a}};var Td=Hg(mu(),1);import G_ from"node:path";import vd from"node:process";import Sn from"node:process";import Ye from"node:path";function wn(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().
|
|
551
|
+
find(n=>n.toUpperCase()==="PATH")||"Path"}import{promisify as xw}from"node:util";import{execFile as kw,execFileSync as HN}from"node:child_process";import fu from"node:path";
|
|
552
|
+
import{fileURLToPath as Nw}from"node:url";var WN=xw(kw);function _n(e){return e instanceof URL?Nw(e):e}function hu(e){return{*[Symbol.iterator](){let t=fu.resolve(_n(e)),r;for(;r!==t;)yield t,r=t,t=fu.resolve(t,"..")}}}var qN=10*
|
|
553
553
|
1024*1024;var $w=({cwd:e=Sn.cwd(),path:t=Sn.env[wn()],preferLocal:r=!0,execPath:n=Sn.execPath,addExecPath:o=!0}={})=>{let i=Ye.resolve(
|
|
554
554
|
_n(e)),s=[],a=t.split(Ye.delimiter);return r&&Mw(s,a,i),o&&Dw(s,a,n,i),t===""||t===Ye.delimiter?`${s.join(Ye.delimiter)}${t}`:
|
|
555
555
|
[...s,t].join(Ye.delimiter)},Mw=(e,t,r)=>{for(let n of hu(r)){let o=Ye.join(n,"node_modules/.bin");t.includes(o)||e.push(
|
|
556
556
|
o)}},Dw=(e,t,r,n)=>{let o=Ye.resolve(n,_n(r),"..");t.includes(o)||e.push(o)},gu=({env:e=Sn.env,...t}={})=>{e={...e};let r=wn(
|
|
557
|
-
{env:e});return t.path=e[r],e[r]=$w(t),e};import{setTimeout as Xw}from"node:timers/promises";var bu=(e,t,r)=>{let n=r?
|
|
557
|
+
{env:e});return t.path=e[r],e[r]=$w(t),e};import{setTimeout as Xw}from"node:timers/promises";var bu=(e,t,r)=>{let n=r?mr:pr,o=e instanceof le?{}:{cause:e};return new n(t,o)},le=class extends Error{},yu=(e,t)=>{Object.
|
|
558
558
|
defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,
|
|
559
559
|
_u,{value:!0,writable:!1,enumerable:!1,configurable:!1})},wu=e=>En(e)&&_u in e,_u=Symbol("isExecaError"),En=e=>Object.prototype.
|
|
560
|
-
toString.call(e)==="[object Error]",pr=class extends Error{};yu(pr,pr.name);var
|
|
560
|
+
toString.call(e)==="[object Error]",pr=class extends Error{};yu(pr,pr.name);var mr=class extends Error{};yu(mr,mr.name);import{constants as fr}from"node:os";import{constants as jw}from"node:os";var Su=()=>{let e=vu-Eu+1;return Array.from({length:e},Lw)},Lw=(e,t)=>({name:`SIGRT${t+1}`,number:Eu+t,action:"terminate",
|
|
561
561
|
description:"Application-specific signal (realtime)",standard:"posix"}),Eu=34,vu=64;import{constants as Uw}from"node:os";var Tu=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,
|
|
562
562
|
action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"\
|
|
563
563
|
User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine ins\
|
|
@@ -595,17 +595,17 @@ standard:s})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,st
|
|
|
595
595
|
r=Array.from({length:t},(n,o)=>Vw(o,e));return Object.assign({},...r)},Vw=(e,t)=>{let r=zw(e,t);if(r===void 0)return{};let{
|
|
596
596
|
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,
|
|
597
597
|
forced:a,standard:c}}},zw=(e,t)=>{let r=t.find(({name:n})=>jw.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},
|
|
598
|
-
|
|
598
|
+
u$=Hw();var Au=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return Pu(e,t)},Ru=e=>e===
|
|
599
599
|
0?e:Pu(e,"`subprocess.kill()`'s argument"),Pu=(e,t)=>{if(Number.isInteger(e))return Ww(e,t);if(typeof e=="string")return Yw(
|
|
600
600
|
e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
601
601
|
${Yi()}`)},Ww=(e,t)=>{if(Iu.has(e))return Iu.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not\
|
|
602
602
|
exist.
|
|
603
|
-
${Yi()}`)},qw=()=>new Map(Object.entries(
|
|
604
|
-
return e;throw e.toUpperCase()in
|
|
603
|
+
${Yi()}`)},qw=()=>new Map(Object.entries(fr.signals).reverse().map(([e,t])=>[t,e])),Iu=qw(),Yw=(e,t)=>{if(e in fr.signals)
|
|
604
|
+
return e;throw e.toUpperCase()in fr.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'\
|
|
605
605
|
.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
|
|
606
606
|
${Yi()}`)},Yi=()=>`Available signal names: ${Jw()}.
|
|
607
|
-
Available signal numbers: ${Kw()}.`,Jw=()=>Object.keys(
|
|
608
|
-
Object.values(
|
|
607
|
+
Available signal numbers: ${Kw()}.`,Jw=()=>Object.keys(fr.signals).sort().map(e=>`'${e}'`).join(", "),Kw=()=>[...new Set(
|
|
608
|
+
Object.values(fr.signals).sort((e,t)=>e-t))].join(", "),vn=e=>Ou[e].description;var Cu=e=>{if(e===!1)return e;if(e===!0)return Qw;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKi\
|
|
609
609
|
llAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Qw=1e3*5,xu=({kill:e,options:{
|
|
610
610
|
forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:l}=Zw(s,a,r);e_(
|
|
611
611
|
l,n);let u=e(c);return t_({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:u,context:o,controller:i}),u},Zw=(e,t,r)=>{
|
|
@@ -655,11 +655,11 @@ Please set this option with "pipe" instead.`},d_=(e,{stdin:t,stdout:r,stderr:n,s
|
|
|
655
655
|
void 0?{optionName:"stdin",optionValue:t}:i===1&&r!==void 0?{optionName:"stdout",optionValue:r}:i===2&&n!==void 0?{optionName:"\
|
|
656
656
|
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},Vu=e=>e==="all"?1:e,hr=e=>e?"to":"from",In=e=>typeof e==
|
|
657
657
|
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as b_}from"node:events";import{addAbortListener as p_}from"node:events";var Je=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||
|
|
658
|
-
(e.setMaxListeners(n+t),p_(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as h_}from"node:events";import{once as
|
|
658
|
+
(e.setMaxListeners(n+t),p_(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as h_}from"node:events";import{once as m_}from"node:events";import{scheduler as f_}from"node:timers/promises";var Rn=(e,t)=>{t&&Xi(e)},Xi=e=>{e.refCounted()},Pn=(e,t)=>{t&&Qi(e)},Qi=e=>{e.unrefCounted()},zu=(e,t)=>{t&&(Qi(e),Qi(e))},
|
|
659
659
|
Wu=(e,t)=>{t&&(Xi(e),Xi(e))};var qu=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(Ku(o)||Qu(o))return;Cn.has(e)||Cn.set(e,[]);let i=Cn.
|
|
660
|
-
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await Xu(e,n,o),await
|
|
660
|
+
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await Xu(e,n,o),await f_.yield();let s=await Ju({wrappedMessage:i[0],
|
|
661
661
|
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},Yu=async({anyProcess:e,
|
|
662
|
-
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{Zi();let i=Cn.get(e);for(;i?.length>0;)await
|
|
662
|
+
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{Zi();let i=Cn.get(e);for(;i?.length>0;)await m_(n,"message:do\
|
|
663
663
|
ne");e.removeListener("message",o),Wu(t,r),n.connected=!1,n.emit("disconnect")},Cn=new WeakMap;var De=(e,t,r)=>{if(xn.has(e))return xn.get(e);let n=new h_;return n.connected=!0,xn.set(e,n),g_({ipcEmitter:n,anyProcess:e,
|
|
664
664
|
channel:t,isSubprocess:r}),n},xn=new WeakMap,g_=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=qu.bind(void 0,
|
|
665
665
|
{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",Yu.bind(void 0,{anyProcess:t,
|
|
@@ -695,10 +695,10 @@ e,i),Ji({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.term
|
|
|
695
695
|
A_=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"st\
|
|
696
696
|
ack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as R_}from"node:timers/promises";var dd=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to b\
|
|
697
697
|
e a non-negative integer, got \`${e}\` (${typeof e})`)},pd=(e,t,r,n)=>t===0||t===void 0?[]:[P_(e,t,r,n)],P_=async(e,t,r,{
|
|
698
|
-
signal:n})=>{throw await R_(t,void 0,{signal:n}),r.terminationReason??="timeout",e.kill(),new le};import{execPath as C_,execArgv as x_}from"node:process";import
|
|
698
|
+
signal:n})=>{throw await R_(t,void 0,{signal:n}),r.terminationReason??="timeout",e.kill(),new le};import{execPath as C_,execArgv as x_}from"node:process";import md from"node:path";var fd=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{
|
|
699
699
|
options:{...e,node:!0}}},hd=(e,t,{node:r=!1,nodePath:n=C_,nodeOptions:o=x_.filter(c=>!c.startsWith("--inspect")),cwd:i,execPath:s,
|
|
700
700
|
...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option ins\
|
|
701
|
-
tead.');let c=St(n,'The "nodePath" option'),l=
|
|
701
|
+
tead.');let c=St(n,'The "nodePath" option'),l=md.resolve(i,c),u={...a,nodePath:l,node:r,cwd:i};if(!r)return[e,t,u];if(md.
|
|
702
702
|
basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be \
|
|
703
703
|
"node".');return[l,[...o,e,...t],{ipc:!0,...u,shell:!1}]};import{serialize as k_}from"node:v8";var gd=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error(
|
|
704
704
|
"The `ipcInput` option cannot be set unless the `ipc` option is `true`.");M_[r](e)}},N_=e=>{try{k_(e)}catch(t){throw new Error(
|
|
@@ -721,8 +721,8 @@ l);return dd(u),wd(u),gd(u),ku(u),ld(u),u.shell=Pi(u.shell),u.env=H_(u),u.killSi
|
|
|
721
721
|
Cu(u.forceKillAfterDelay),u.lines=u.lines.map((d,p)=>d&&!ee.has(u.encoding)&&u.buffer[p]),vd.platform==="win32"&&G_.basename(
|
|
722
722
|
s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},F_=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:n=r,
|
|
723
723
|
encoding:o="utf8",reject:i=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,
|
|
724
|
-
ipcInput:p,ipc:
|
|
725
|
-
encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:p,ipc:
|
|
724
|
+
ipcInput:p,ipc:m=p!==void 0||d,serialization:f="advanced",...h})=>({...h,extendEnv:e,preferLocal:t,cwd:r,localDirectory:n,
|
|
725
|
+
encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:p,ipc:m,serialization:f}),
|
|
726
726
|
H_=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...vd.env,...e}:e;return r||n?gu({env:s,
|
|
727
727
|
cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s};var Bn=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as vS}from"node:util";function Pt(e){if(typeof e=="string")return V_(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("\
|
|
728
728
|
Input must be a string or a Uint8Array");return z_(e)}var V_=e=>e.at(-1)===Od?e.slice(0,e.at(-2)===Id?-2:-1):e,z_=e=>e.at(
|
|
@@ -747,7 +747,7 @@ a ReadableStream, or an async iterable.")},{toString:K_}=Object.prototype,X_=asy
|
|
|
747
747
|
r={};Q_(e,t,r);try{for await(let[n]of br.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;
|
|
748
748
|
if(!t.signal.aborted)throw n}finally{e.destroy()}},Q_=async(e,t,r)=>{try{await br.finished(e,{cleanup:!0,readable:!0,writable:!1,
|
|
749
749
|
error:!1})}catch(n){r.error=n}finally{t.abort()}},br={};var Ct=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.
|
|
750
|
-
POSITIVE_INFINITY}={})=>{let l=Pd(e),u=t();u.length=0;try{for await(let d of l){let p=eS(d),
|
|
750
|
+
POSITIVE_INFINITY}={})=>{let l=Pd(e),u=t();u.length=0;try{for await(let d of l){let p=eS(d),m=r[p](d,u);kd({convertedChunk:m,
|
|
751
751
|
state:u,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return Z_({state:u,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,
|
|
752
752
|
getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let p=typeof d=="object"&&d!==null?d:new Error(d);throw p.bufferedData=a(u),
|
|
753
753
|
p}},Z_=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let s=o(e);s!==void 0&&kd({convertedChunk:s,
|
|
@@ -760,15 +760,15 @@ xd.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:xd}=
|
|
|
760
760
|
MaxBufferError";constructor(){super("maxBuffer exceeded")}};var Re=e=>e,yr=()=>{},jn=({contents:e})=>e,Gn=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},
|
|
761
761
|
Fn=e=>e.length;async function Hn(e,t){return Ct(e,oS,t)}var tS=()=>({contents:[]}),rS=()=>1,nS=(e,{contents:t})=>(t.push(e),t),oS={init:tS,
|
|
762
762
|
convertChunk:{string:Re,buffer:Re,arrayBuffer:Re,dataView:Re,typedArray:Re,others:Re},getSize:rS,truncateChunk:yr,addChunk:nS,
|
|
763
|
-
getFinalChunk:yr,finalize:jn};async function Vn(e,t){return Ct(e,
|
|
763
|
+
getFinalChunk:yr,finalize:jn};async function Vn(e,t){return Ct(e,mS,t)}var iS=()=>({contents:new ArrayBuffer(0)}),sS=e=>aS.encode(e),aS=new TextEncoder,
|
|
764
764
|
Nd=e=>new Uint8Array(e),$d=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),cS=(e,t)=>e.slice(0,t),lS=(e,{contents:t,
|
|
765
765
|
length:r},n)=>{let o=Ld()?dS(t,n):uS(t,n);return new Uint8Array(o).set(e,r),o},uS=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(
|
|
766
766
|
Dd(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},dS=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(
|
|
767
767
|
t,{maxByteLength:Dd(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},Dd=e=>Md**Math.ceil(Math.log(e)/Math.log(Md)),
|
|
768
|
-
Md=2,pS=({contents:e,length:t})=>Ld()?e:e.slice(0,t),Ld=()=>"resize"in ArrayBuffer.prototype,
|
|
769
|
-
buffer:Nd,arrayBuffer:Nd,dataView:$d,typedArray:$d,others:Gn},getSize:Fn,truncateChunk:cS,addChunk:lS,getFinalChunk:yr,finalize:pS};async function Wn(e,t){return Ct(e,yS,t)}var
|
|
768
|
+
Md=2,pS=({contents:e,length:t})=>Ld()?e:e.slice(0,t),Ld=()=>"resize"in ArrayBuffer.prototype,mS={init:iS,convertChunk:{string:sS,
|
|
769
|
+
buffer:Nd,arrayBuffer:Nd,dataView:$d,typedArray:$d,others:Gn},getSize:Fn,truncateChunk:cS,addChunk:lS,getFinalChunk:yr,finalize:pS};async function Wn(e,t){return Ct(e,yS,t)}var fS=()=>({contents:"",textDecoder:new TextDecoder}),zn=(e,{textDecoder:t})=>t.
|
|
770
770
|
decode(e,{stream:!0}),hS=(e,{contents:t})=>t+e,gS=(e,t)=>e.slice(0,t),bS=({textDecoder:e})=>{let t=e.decode();return t===
|
|
771
|
-
""?void 0:t},yS={init:
|
|
771
|
+
""?void 0:t},yS={init:fS,convertChunk:{string:Re,buffer:zn,arrayBuffer:zn,dataView:zn,typedArray:zn,others:Gn},getSize:Fn,
|
|
772
772
|
truncateChunk:gS,addChunk:hS,getFinalChunk:bS,finalize:jn};Object.assign(br,{on:wS,finished:_S});var Ud=({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{if(!(e instanceof we))throw e;if(i==="a\
|
|
773
773
|
ll")return e;let s=SS(r,n,o);throw e.maxBufferInfo={fdNumber:i,unit:s},t.destroy(),e},SS=(e,t,r)=>e?"objects":t?"lines":
|
|
774
774
|
r==="buffer"?"bytes":"characters",Bd=(e,t,r)=>{if(t.length!==r)return;let n=new we;throw n.maxBufferInfo={fdNumber:"ipc"},
|
|
@@ -777,19 +777,19 @@ if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"byt
|
|
|
777
777
|
delete e.maxBufferInfo;let o=Ae(t,r);return r==="ipc"?{streamName:"IPC output",threshold:o,unit:"messages"}:{streamName:ln(
|
|
778
778
|
r),threshold:o,unit:n}},Gd=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(n=>n!==null&&n.length>qn(r)),Fd=(e,t,r)=>{if(!t)
|
|
779
779
|
return e;let n=qn(r);return e.length>n?e.slice(0,n):e},qn=([,e])=>e;var Vd=({stdio:e,all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,
|
|
780
|
-
isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:p,forceKillAfterDelay:
|
|
780
|
+
isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:p,forceKillAfterDelay:m,killSignal:f,maxBuffer:h,timeout:_,cwd:g})=>{
|
|
781
781
|
let S=n?.code,v=TS({originalError:n,timedOut:c,timeout:_,isMaxBuffer:d,maxBuffer:h,errorCode:S,signal:o,signalDescription:i,
|
|
782
|
-
exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:p,forceKillAfterDelay:
|
|
782
|
+
exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:p,forceKillAfterDelay:m,killSignal:f}),b=IS(n,g),R=b===
|
|
783
783
|
void 0?"":`
|
|
784
784
|
${b}`,T=`${v}: ${a}${R}`,E=t===void 0?[e[2],e[1]]:[t],k=[T,...E,...e.slice(3),r.map(N=>AS(N)).join(`
|
|
785
785
|
`)].map(N=>dr(Pt(RS(N)))).filter(Boolean).join(`
|
|
786
786
|
|
|
787
787
|
`);return{originalMessage:b,shortMessage:T,message:k}},TS=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,
|
|
788
788
|
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:p,
|
|
789
|
-
killSignal:
|
|
790
|
-
ully canceled with exit code ${c}`:d?`Command was gracefully canceled${
|
|
791
|
-
)`:l?`Command was canceled${
|
|
792
|
-
(${vn(
|
|
789
|
+
killSignal:m})=>{let f=OS(d,p);return t?`Command timed out after ${r} milliseconds${f}`:u?s===void 0?`Command was gracef\
|
|
790
|
+
ully canceled with exit code ${c}`:d?`Command was gracefully canceled${f}`:`Command was gracefully canceled with ${s} (${a}\
|
|
791
|
+
)`:l?`Command was canceled${f}`:n?`${jd(e,o)}${f}`:i!==void 0?`Command failed with ${i}${f}`:d?`Command was killed with ${m}\
|
|
792
|
+
(${vn(m)})${f}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Comma\
|
|
793
793
|
nd failed"},OS=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",IS=(e,t)=>{if(e instanceof le)return;
|
|
794
794
|
let r=wu(e)?e.originalMessage:String(e?.message??e),n=dr(Ed(r,t));return n===""?void 0:n},AS=e=>typeof e=="string"?e:vS(
|
|
795
795
|
e),RS=e=>Array.isArray(e)?e.map(t=>Pt(Hd(t))).filter(Boolean).join(`
|
|
@@ -799,17 +799,17 @@ exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),xt=(
|
|
|
799
799
|
options:o,startTime:i,isSync:s})=>wr({error:e,command:t,escapedCommand:r,startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,
|
|
800
800
|
isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:s}),wr=({error:e,
|
|
801
801
|
command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,
|
|
802
|
-
exitCode:l,signal:u,stdio:d,all:p,ipcOutput:
|
|
802
|
+
exitCode:l,signal:u,stdio:d,all:p,ipcOutput:m,options:{timeoutDuration:f,timeout:h=f,forceKillAfterDelay:_,killSignal:g,
|
|
803
803
|
cwd:S,maxBuffer:v},isSync:b})=>{let{exitCode:R,signal:T,signalDescription:E}=CS(l,u),{originalMessage:k,shortMessage:N,message:D}=Vd(
|
|
804
|
-
{stdio:d,all:p,ipcOutput:
|
|
804
|
+
{stdio:d,all:p,ipcOutput:m,originalError:e,signal:T,signalDescription:E,exitCode:R,escapedCommand:r,timedOut:o,isCanceled:i,
|
|
805
805
|
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:_,killSignal:g,maxBuffer:v,timeout:h,cwd:S}),
|
|
806
806
|
G=bu(e,D,b);return Object.assign(G,PS({error:G,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,
|
|
807
|
-
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:R,signal:T,signalDescription:E,stdio:d,all:p,ipcOutput:
|
|
807
|
+
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:R,signal:T,signalDescription:E,stdio:d,all:p,ipcOutput:m,cwd:S,originalMessage:k,
|
|
808
808
|
shortMessage:N})),G},PS=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,
|
|
809
|
-
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:p,all:
|
|
809
|
+
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:p,all:m,ipcOutput:f,cwd:h,originalMessage:_,
|
|
810
810
|
shortMessage:g})=>zd({shortMessage:g,originalMessage:_,command:t,escapedCommand:r,cwd:h,durationMs:Li(n),failed:!0,timedOut:o,
|
|
811
811
|
isCanceled:i,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,
|
|
812
|
-
code:e.cause?.code,stdout:p[1],stderr:p[2],all:
|
|
812
|
+
code:e.cause?.code,stdout:p[1],stderr:p[2],all:m,stdio:p,ipcOutput:f,pipedFrom:[]}),zd=e=>Object.fromEntries(Object.entries(
|
|
813
813
|
e).filter(([,t])=>t!==void 0)),CS=(e,t)=>{let r=e===null?void 0:e,n=t===null?void 0:t,o=n===void 0?void 0:vn(t);return{exitCode:r,
|
|
814
814
|
signal:n,signalDescription:o}};var Wd=e=>Number.isFinite(e)?e:0;function xS(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.
|
|
815
815
|
trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(Wd(e*1e3)%1e3),nanoseconds:Math.
|
|
@@ -819,27 +819,27 @@ return xS(e);break}case"bigint":return kS(e)}throw new TypeError("Expected a fin
|
|
|
819
819
|
"bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let n=e<0?"-":"";
|
|
820
820
|
e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&
|
|
821
821
|
(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,d)=>{let p=Math.floor(u*10**d+MS);return(Math.
|
|
822
|
-
round(p)/10**d).toFixed(d)},s=(u,d,p,
|
|
823
|
-
String(u),t.colonNotation){let m
|
|
824
|
-
0,h-
|
|
822
|
+
round(p)/10**d).toFixed(d)},s=(u,d,p,m)=>{if(!((o.length===0||!t.colonNotation)&&NS(u)&&!(t.colonNotation&&p==="m"))){if(m??=
|
|
823
|
+
String(u),t.colonNotation){let f=m.includes(".")?m.split(".")[0].length:m.length,h=o.length>0?2:1;m="0".repeat(Math.max(
|
|
824
|
+
0,h-f))+m}else m+=t.verbose?" "+$S(d,u):p;o.push(m)}},a=ls(e),c=BigInt(a.days);if(t.hideYearAndDays?s(BigInt(c)*24n+BigInt(
|
|
825
825
|
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")),
|
|
826
826
|
s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<
|
|
827
|
-
1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),p=Number(a.microseconds),
|
|
828
|
-
if(s(u,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(p,"microsecond","\xB5s"),s(
|
|
829
|
-
let
|
|
830
|
-
ceil(
|
|
831
|
-
Number(e%DS):e)/1e3%60,d=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,p=i(u,d),
|
|
832
|
-
p:p.replace(/\.0+$/,"");s(Number.parseFloat(
|
|
827
|
+
1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),p=Number(a.microseconds),m=Number(a.nanoseconds);
|
|
828
|
+
if(s(u,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(p,"microsecond","\xB5s"),s(m,"nanosecond","ns");else{
|
|
829
|
+
let f=d+p/1e3+m/1e6,h=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,_=f>=1?Math.round(f):Math.
|
|
830
|
+
ceil(f),g=1e3-10**-h,S=h?Math.min(f,g).toFixed(h):Math.min(_,g);s(Number.parseFloat(S),"millisecond","ms",S)}}else{let u=(r?
|
|
831
|
+
Number(e%DS):e)/1e3%60,d=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,p=i(u,d),m=t.keepDecimalsOnWholeSeconds?
|
|
832
|
+
p:p.replace(/\.0+$/,"");s(Number.parseFloat(m),"second","s",m)}if(o.length===0)return n+"0"+(t.verbose?" milliseconds":"\
|
|
833
833
|
ms");let l=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(o=o.slice(0,Math.max(t.unitCount,1))),n+o.join(
|
|
834
834
|
l)}var qd=(e,t)=>{e.failed&&ge({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var Yd=(e,t)=>{Et(t)&&(qd(e,t),LS(e,t))},LS=(e,t)=>{let r=`(done in ${us(e.durationMs)})`;ge({type:"duration",verboseMessage:r,
|
|
835
835
|
verboseInfo:t,result:e})};var kt=(e,t,{reject:r})=>{if(Yd(e,t),e.failed&&r)throw e;return e};import{readFileSync as Sp}from"node:fs";var Xd=(e,t)=>Xe(e)?"asyncGenerator":ep(e)?"generator":Jn(e)?"fileUrl":FS(e)?"filePath":zS(e)?"webStream":de(e,{checkOpen:!1})?
|
|
836
|
-
"native":j(e)?"uint8Array":WS(e)?"asyncIterable":qS(e)?"iterable":
|
|
837
|
-
e.transform,{checkOpen:!1})?BS(e,t):
|
|
836
|
+
"native":j(e)?"uint8Array":WS(e)?"asyncIterable":qS(e)?"iterable":ms(e)?Qd({transform:e},t):GS(e)?US(e,t):"native",US=(e,t)=>is(
|
|
837
|
+
e.transform,{checkOpen:!1})?BS(e,t):ms(e.transform)?Qd(e,t):jS(e,t),BS=(e,t)=>(Zd(e,t,"Duplex stream"),"duplex"),Qd=(e,t)=>(Zd(
|
|
838
838
|
e,t,"web TransformStream"),"webTransform"),Zd=({final:e,binary:t,objectMode:r},n,o)=>{Jd(e,`${n}.final`,o),Jd(t,`${n}.bi\
|
|
839
839
|
nary`,o),ds(r,`${n}.objectMode`)},Jd=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined\
|
|
840
840
|
when using a generator, not a ${r}.`)},jS=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(e!==void 0&&!Kd(e))throw new TypeError(
|
|
841
841
|
`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(is(t,{checkOpen:!1}))
|
|
842
|
-
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(
|
|
842
|
+
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(ms(t))throw new TypeError(`The \`${o}.f\
|
|
843
843
|
inal\` option must not be a web TransformStream.`);if(t!==void 0&&!Kd(t))throw new TypeError(`The \`${o}.final\` option m\
|
|
844
844
|
ust be a generator.`);return ds(r,`${o}.binary`),ds(n,`${o}.objectMode`),Xe(e)||Xe(t)?"asyncGenerator":"generator"},ds=(e,t)=>{
|
|
845
845
|
if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},Kd=e=>Xe(e)||ep(e),Xe=e=>Object.
|
|
@@ -848,10 +848,10 @@ torFunction]",GS=e=>L(e)&&(e.transform!==void 0||e.final!==void 0),Jn=e=>Object.
|
|
|
848
848
|
L]",tp=e=>Jn(e)&&e.protocol!=="file:",FS=e=>L(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>HS.has(t))&&ps(e.file),
|
|
849
849
|
HS=new Set(["file","append"]),ps=e=>typeof e=="string",rp=(e,t)=>e==="native"&&typeof t=="string"&&!VS.has(t),VS=new Set(
|
|
850
850
|
["ipc","ignore","inherit","overlapped","pipe"]),np=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",Kn=e=>Object.
|
|
851
|
-
prototype.toString.call(e)==="[object WritableStream]",zS=e=>np(e)||Kn(e),
|
|
851
|
+
prototype.toString.call(e)==="[object WritableStream]",zS=e=>np(e)||Kn(e),ms=e=>np(e?.readable)&&Kn(e?.writable),WS=e=>op(
|
|
852
852
|
e)&&typeof e[Symbol.asyncIterator]=="function",qS=e=>op(e)&&typeof e[Symbol.iterator]=="function",op=e=>typeof e=="objec\
|
|
853
853
|
t"&&e!==null,oe=new Set(["generator","asyncGenerator","duplex","webTransform"]),Xn=new Set(["fileUrl","filePath","fileNu\
|
|
854
|
-
mber"]),
|
|
854
|
+
mber"]),fs=new Set(["fileUrl","filePath"]),ip=new Set([...fs,"webStream","nodeStream"]),sp=new Set(["webTransform","dupl\
|
|
855
855
|
ex"]),Le={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",
|
|
856
856
|
fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web Transfo\
|
|
857
857
|
rmStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a\
|
|
@@ -870,29 +870,29 @@ transform:t,writableObjectMode:r,readableObjectMode:n}}},ZS=({stdioItem:e,stdioI
|
|
|
870
870
|
let{transform:i,objectMode:s}=L(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=hs(s,r,n,o);return{...e,value:{
|
|
871
871
|
transform:i,writableObjectMode:a,readableObjectMode:c}}},eE=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o,
|
|
872
872
|
encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=L(t)?t:{transform:t},d=c||ee.has(
|
|
873
|
-
i),{writableObjectMode:p,readableObjectMode:
|
|
874
|
-
writableObjectMode:p,readableObjectMode:
|
|
873
|
+
i),{writableObjectMode:p,readableObjectMode:m}=hs(u,r,n,o);return{...e,value:{transform:s,final:a,binary:d,preserveNewlines:l,
|
|
874
|
+
writableObjectMode:p,readableObjectMode:m}}},tE=(e,t)=>t==="input"?e.reverse():e;import gs from"node:process";var lp=(e,t,r)=>{let n=e.map(o=>rE(o,t));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` o\
|
|
875
875
|
ption must not be an array of both readable and writable values.`);return n.find(Boolean)??iE},rE=({type:e,value:t},r)=>nE[r]??
|
|
876
876
|
up[e](t),nE=["input","output","output"],Nt=()=>{},bs=()=>"input",up={generator:Nt,asyncGenerator:Nt,fileUrl:Nt,filePath:Nt,
|
|
877
877
|
iterable:bs,asyncIterable:bs,uint8Array:bs,webStream:e=>Kn(e)?"output":"input",nodeStream(e){return Ke(e,{checkOpen:!1})?
|
|
878
878
|
os(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:Nt,duplex:Nt,native(e){let t=oE(e);if(t!==void 0)return t;if(de(
|
|
879
879
|
e,{checkOpen:!1}))return up.nodeStream(e)}},oE=e=>{if([0,gs.stdin].includes(e))return"input";if([1,2,gs.stdout,gs.stderr].
|
|
880
|
-
includes(e))return"output"},iE="output";var dp=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var pp=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=sE(e,n).map((a,c)=>
|
|
880
|
+
includes(e))return"output"},iE="output";var dp=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var pp=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=sE(e,n).map((a,c)=>mp(a,c));return i?cE(s,r,o):dp(s,t)},sE=(e,t)=>{if(e===
|
|
881
881
|
void 0)return ne.map(n=>t[n]);if(aE(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${ne.
|
|
882
882
|
map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \
|
|
883
883
|
\`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,ne.length);return Array.from(
|
|
884
|
-
{length:r},(n,o)=>e[o])},aE=e=>ne.some(t=>e[t]!==void 0),
|
|
884
|
+
{length:r},(n,o)=>e[o])},aE=e=>ne.some(t=>e[t]!==void 0),mp=(e,t)=>Array.isArray(e)?e.map(r=>mp(r,t)):e??(t>=ne.length?"\
|
|
885
885
|
ignore":"pipe"),cE=(e,t,r)=>e.map((n,o)=>!t[o]&&o!==0&&!vt(r,o)&&lE(n)?"ignore":n),lE=e=>e==="pipe"||Array.isArray(e)&&e.
|
|
886
886
|
every(t=>t==="pipe");import{readFileSync as uE}from"node:fs";import dE from"node:tty";var hp=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?pE({stdioItem:e,
|
|
887
887
|
fdNumber:n,direction:o}):hE({stdioItem:e,fdNumber:n}),pE=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{
|
|
888
|
-
let i=
|
|
889
|
-
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},
|
|
890
|
-
optionName:t,fdNumber:r,direction:n})=>{let o=
|
|
888
|
+
let i=mE({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(de(t,{checkOpen:!1}))throw new TypeError(
|
|
889
|
+
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},mE=({value:e,
|
|
890
|
+
optionName:t,fdNumber:r,direction:n})=>{let o=fE(e,r);if(o!==void 0){if(n==="output")return{type:"fileNumber",value:o,optionName:t};
|
|
891
891
|
if(dE.isatty(o))throw new TypeError(`The \`${t}: ${In(e)}\` option is invalid: it cannot be a TTY with synchronous method\
|
|
892
|
-
s.`);return{type:"uint8Array",value:Ie(uE(o)),optionName:t}}},
|
|
892
|
+
s.`);return{type:"uint8Array",value:Ie(uE(o)),optionName:t}}},fE=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")
|
|
893
893
|
return e;let r=cn.indexOf(e);if(r!==-1)return r},hE=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>t==="in\
|
|
894
|
-
herit"?{type:"nodeStream",value:
|
|
895
|
-
de(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,
|
|
894
|
+
herit"?{type:"nodeStream",value:fp(n,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:fp(t,t,r),optionName:r}:
|
|
895
|
+
de(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,fp=(e,t,r)=>{let n=cn[e];if(n===void 0)throw new TypeError(
|
|
896
896
|
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n};var gp=({input:e,inputFile:t},r)=>r===0?[...gE(e),...yE(t)]:[],gE=e=>e===void 0?[]:[{type:bE(e),value:e,optionName:"inpu\
|
|
897
897
|
t"}],bE=e=>{if(Ke(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(j(e))return"uint8Array";throw new Error(
|
|
898
898
|
"The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},yE=e=>e===void 0?[]:[{...wE(e),optionName:"\
|
|
@@ -902,7 +902,7 @@ stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})
|
|
|
902
902
|
SE({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});return}if(ip.has(e))return wp({otherStdioItems:s,type:e,
|
|
903
903
|
value:t,optionName:r,direction:n});sp.has(e)&&vE({otherStdioItems:s,type:e,value:t,optionName:r})}},_E=(e,t)=>e.flatMap(
|
|
904
904
|
({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),SE=({otherStdioItems:e,type:t,value:r,
|
|
905
|
-
optionName:n,direction:o})=>{
|
|
905
|
+
optionName:n,direction:o})=>{fs.has(t)&&wp({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})},wp=({otherStdioItems:e,
|
|
906
906
|
type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>EE(a,r));if(i.length===0)return;let s=i.find(a=>a.direction!==
|
|
907
907
|
o);return _p(s,n,t),o==="output"?i[0].stream:void 0},EE=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUr\
|
|
908
908
|
l"?t.href===r.href:t===r,vE=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{transform:i}})=>i===
|
|
@@ -960,9 +960,9 @@ if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),tv=function*
|
|
|
960
960
|
e)],Qe=function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=nv}=t[r];for(let o of n(e))yield*Qe(o,t,r+1)},_r=function*(e){
|
|
961
961
|
for(let[t,{final:r}]of Object.entries(e))yield*rv(r,Number(t),e)},rv=function*(e,t,r){if(e!==void 0)for(let n of e())yield*Qe(
|
|
962
962
|
n,r,t+1)},nv=function*(e){yield e};var Ts=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},
|
|
963
|
-
c=Dp(e,s,i),l=Xe(t),u=Xe(r),d=l?Es.bind(void 0,to,a):vs.bind(void 0,Qe),p=l||u?Es.bind(void 0,kp,a):vs.bind(void 0,_r),
|
|
963
|
+
c=Dp(e,s,i),l=Xe(t),u=Xe(r),d=l?Es.bind(void 0,to,a):vs.bind(void 0,Qe),p=l||u?Es.bind(void 0,kp,a):vs.bind(void 0,_r),m=l||
|
|
964
964
|
u?Np.bind(void 0,a):void 0;return{stream:new ov({writableObjectMode:n,writableHighWaterMark:Mp(n),readableObjectMode:o,readableHighWaterMark:Mp(
|
|
965
|
-
o),transform(h,_,g){d([h,c,0],this,g)},flush(h){p([c],this,h)},destroy:
|
|
965
|
+
o),transform(h,_,g){d([h,c,0],this,g)},flush(h){p([c],this,h)},destroy:m})}},ro=(e,t,r,n)=>{let o=t.filter(({type:s})=>s===
|
|
966
966
|
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=Dp(s,r,a);e=$p(c,e)}return e},Dp=({transform:e,final:t,
|
|
967
967
|
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:Rp(n,a)},eo(r,s,
|
|
968
968
|
n),Zn(r,i,n,c),{transform:e,final:t},{transform:Pp(o,a)},Ap({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].
|
|
@@ -971,22 +971,22 @@ filter(Boolean)};var Lp=(e,t)=>{for(let r of iv(e))sv(e,r,t)},iv=e=>new Set(Obje
|
|
|
971
971
|
0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Le[a]} with synch\
|
|
972
972
|
ronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>av(a,n));r.input=ur(s)},av=(e,t)=>{let r=ro(e,t,"utf8",!0);return cv(
|
|
973
973
|
r),ur(r)},cv=e=>{let t=e.find(r=>typeof r!="string"&&!j(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is inv\
|
|
974
|
-
alid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as pv,appendFileSync as
|
|
974
|
+
alid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as pv,appendFileSync as mv}from"node:fs";var no=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&vt(r,n)&&!ee.has(t)&&lv(n)&&(e.some(({type:o,value:i})=>o===
|
|
975
975
|
"native"&&uv.has(i))||e.every(({type:o})=>oe.has(o))),lv=e=>e===1||e===2,uv=new Set(["pipe","overlapped"]),Up=async(e,t,r,n)=>{
|
|
976
976
|
for await(let o of e)dv(t)||jp(o,r,n)},Bp=(e,t,r)=>{for(let n of e)jp(n,t,r)},dv=e=>e._readableState.pipes.length>0,jp=(e,t,r)=>{
|
|
977
977
|
let n=hn(e);ge({type:"output",verboseMessage:n,fdNumber:t,verboseInfo:r})};var Gp=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.
|
|
978
|
-
from({length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>
|
|
979
|
-
isMaxBuffer:n,verboseInfo:o},r)),...i}},
|
|
980
|
-
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(e===null)return;let p=Fd(e,i,d),
|
|
981
|
-
objectMode:h}=t[r],_=hv([
|
|
982
|
-
fdNumber:r});bv({serializedResult:g,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:
|
|
983
|
-
void 0;try{return n.error===void 0&&yv(g,
|
|
978
|
+
from({length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>fv({result:c,fileDescriptors:e,fdNumber:l,state:i,outputFiles:s,
|
|
979
|
+
isMaxBuffer:n,verboseInfo:o},r)),...i}},fv=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{
|
|
980
|
+
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(e===null)return;let p=Fd(e,i,d),m=Ie(p),{stdioItems:f,
|
|
981
|
+
objectMode:h}=t[r],_=hv([m],f,c,n),{serializedResult:g,finalResult:S=g}=gv({chunks:_,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,
|
|
982
|
+
fdNumber:r});bv({serializedResult:g,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:f,objectMode:h});let v=a[r]?S:
|
|
983
|
+
void 0;try{return n.error===void 0&&yv(g,f,o),v}catch(b){return n.error=b,v}},hv=(e,t,r,n)=>{try{return ro(e,t,r,!1)}catch(o){
|
|
984
984
|
return n.error=o,e}},gv=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};
|
|
985
985
|
if(r==="buffer")return{serializedResult:ur(e)};let s=rl(e,r);return n[i]?{serializedResult:s,finalResult:Ss(s,!o[i],t)}:
|
|
986
986
|
{serializedResult:s}},bv=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{
|
|
987
987
|
if(!no({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=Ss(e,!1,s);try{Bp(a,t,n)}catch(c){r.error??=c}},
|
|
988
988
|
yv=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:i})=>Xn.has(i))){let i=typeof n=="string"?n:n.toString();o||r.has(
|
|
989
|
-
i)?
|
|
989
|
+
i)?mv(n,e):(r.add(i),pv(n,e))}};var Fp=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,Pe(t,r,
|
|
990
990
|
"all")]:Array.isArray(t)?[Pe(e,r,"all"),...t]:j(e)&&j(t)?Ci([e,t]):`${e}${t}`};import{once as Os}from"node:events";var Hp=async(e,t)=>{let[r,n]=await wv(e);return t.isForcefullyTerminated??=!1,[r,n]},wv=async e=>{let[t,r]=await Promise.
|
|
991
991
|
allSettled([Os(e,"spawn"),Os(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?Vp(e):r.value},Vp=async e=>{
|
|
992
992
|
try{return await Os(e,"exit")}catch{return Vp(e)}},zp=async e=>{let[t,r]=await e;if(!_v(t,r)&&Is(t,r))throw new le;return[
|
|
@@ -999,9 +999,9 @@ options:u,fileDescriptors:d}},Tv=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,Ov=({ipc:e,ip
|
|
|
999
999
|
oo("ipcInput"),e&&oo("ipc: true"),r&&oo("detached: true"),n&&oo("cancelSignal")},oo=e=>{throw new TypeError(`The "${e}" \
|
|
1000
1000
|
option cannot be used with synchronous methods.`)},Iv=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:i,
|
|
1001
1001
|
fileDescriptors:s,startTime:a})=>{let c=Av({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:s,
|
|
1002
|
-
startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:p,isMaxBuffer:
|
|
1003
|
-
{fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:
|
|
1004
|
-
return Pv({error:h,exitCode:u,signal:d,timedOut:p,isMaxBuffer:
|
|
1002
|
+
startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:p,isMaxBuffer:m}=Wp(c,r),{output:f,error:h=l}=Gp(
|
|
1003
|
+
{fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:m,verboseInfo:i}),_=f.map((S,v)=>Pe(S,r,v)),g=Pe(Fp(f,r),r,"all");
|
|
1004
|
+
return Pv({error:h,exitCode:u,signal:d,timedOut:p,isMaxBuffer:m,stdio:_,all:g,options:r,command:n,escapedCommand:o,startTime:a})},
|
|
1005
1005
|
Av=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:i,startTime:s})=>{try{Lp(i,r);let a=Rv(
|
|
1006
1006
|
r);return Ev(...Bn(e,t,a))}catch(a){return xt({error:a,command:n,escapedCommand:o,fileDescriptors:i,options:r,startTime:s,
|
|
1007
1007
|
isSync:!0})}},Rv=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:qn(t)}),Pv=({error:e,exitCode:t,signal:r,
|
|
@@ -1021,24 +1021,24 @@ controller:a,state:c,reference:i})},Dv=async(e,t,r)=>{try{await Kp(t,"disconnect
|
|
|
1021
1021
|
Lv=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await Kp(e,"strict:error",{signal:r.signal});n.
|
|
1022
1022
|
error=On(o,t),r.abort()}catch{}},Uv=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,
|
|
1023
1023
|
state:s,reference:a}){try{for await(let[c]of Mv(r,"message",{signal:i.signal}))Jp(s),yield c}catch{Jp(s)}finally{i.abort(),
|
|
1024
|
-
Pn(t,a),n||At(e),o&&await e}},Jp=({error:e})=>{if(e)throw e};var Zp=(e,{ipc:t})=>{Object.assign(e,
|
|
1025
|
-
bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},
|
|
1024
|
+
Pn(t,a),n||At(e),o&&await e}},Jp=({error:e})=>{if(e)throw e};var Zp=(e,{ipc:t})=>{Object.assign(e,tm(e,!1,t))},em=()=>{let e=Qp,t=!0,r=Qp.channel!==void 0;return{...tm(e,t,r),getCancelSignal:ad.
|
|
1025
|
+
bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},tm=(e,t,r)=>({sendMessage:Dn.bind(void 0,{anyProcess:e,
|
|
1026
1026
|
channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:Yp.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),
|
|
1027
|
-
getEachMessage:Xp.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as Bv}from"node:child_process";import{PassThrough as jv,Readable as Gv,Writable as Fv,Duplex as Hv}from"node:stream";var
|
|
1027
|
+
getEachMessage:Xp.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as Bv}from"node:child_process";import{PassThrough as jv,Readable as Gv,Writable as Fv,Duplex as Hv}from"node:stream";var rm=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,verboseInfo:s})=>{ys(n);let a=new Bv;
|
|
1028
1028
|
Vv(a,n),Object.assign(a,{readable:zv,writable:Wv,duplex:qv});let c=xt({error:e,command:t,escapedCommand:r,fileDescriptors:n,
|
|
1029
1029
|
options:o,startTime:i,isSync:!1}),l=Yv(c,s,o);return{subprocess:a,promise:l}},Vv=(e,t)=>{let r=Sr(),n=Sr(),o=Sr(),i=Array.
|
|
1030
1030
|
from({length:t.length-3},Sr),s=Sr(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,all:s,stdio:a})},Sr=()=>{let e=new jv;
|
|
1031
1031
|
return e.end(),e},zv=()=>new Gv({read(){}}),Wv=()=>new Fv({write(){}}),qv=()=>new Hv({read(){},write(){}}),Yv=async(e,t,r)=>kt(
|
|
1032
|
-
e,t,r);import{createReadStream as
|
|
1033
|
-
Writable as Kv,Duplex as Xv}from"node:stream";var
|
|
1034
|
-
|
|
1032
|
+
e,t,r);import{createReadStream as nm,createWriteStream as om}from"node:fs";import{Buffer as Jv}from"node:buffer";import{Readable as Er,
|
|
1033
|
+
Writable as Kv,Duplex as Xv}from"node:stream";var sm=(e,t)=>Qn(Qv,e,t,!1),vr=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${Le[e]}.`)},
|
|
1034
|
+
im={fileNumber:vr,generator:Ts,asyncGenerator:Ts,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,
|
|
1035
1035
|
readableObjectMode:r}}){let n=t||r;return{stream:Xv.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),
|
|
1036
|
-
native(){}},Qv={input:{...
|
|
1036
|
+
native(){}},Qv={input:{...im,fileUrl:({value:e})=>({stream:nm(e)}),filePath:({value:{file:e}})=>({stream:nm(e)}),webStream:({
|
|
1037
1037
|
value:e})=>({stream:Er.fromWeb(e)}),iterable:({value:e})=>({stream:Er.from(e)}),asyncIterable:({value:e})=>({stream:Er.from(
|
|
1038
|
-
e)}),string:({value:e})=>({stream:Er.from(e)}),uint8Array:({value:e})=>({stream:Er.from(Jv.from(e))})},output:{...
|
|
1039
|
-
value:e})=>({stream:
|
|
1040
|
-
stream:Kv.fromWeb(e)}),iterable:vr,asyncIterable:vr,string:vr,uint8Array:vr}};import{on as Zv,once as
|
|
1041
|
-
finished as
|
|
1038
|
+
e)}),string:({value:e})=>({stream:Er.from(e)}),uint8Array:({value:e})=>({stream:Er.from(Jv.from(e))})},output:{...im,fileUrl:({
|
|
1039
|
+
value:e})=>({stream:om(e)}),filePath:({value:{file:e,append:t}})=>({stream:om(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({
|
|
1040
|
+
stream:Kv.fromWeb(e)}),iterable:vr,asyncIterable:vr,string:vr,uint8Array:vr}};import{on as Zv,once as am}from"node:events";import{PassThrough as eT,getDefaultHighWaterMark as tT}from"node:stream";import{
|
|
1041
|
+
finished as um}from"node:stream/promises";function Ze(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, go\
|
|
1042
1042
|
t \`${typeof e}\`.`);for(let o of e)Cs(o);let t=e.some(({readableObjectMode:o})=>o),r=rT(e,t),n=new Ps({objectMode:t,writableHighWaterMark:r,
|
|
1043
1043
|
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var rT=(e,t)=>{if(e.length===0)return tT(t);let r=e.filter(({
|
|
1044
1044
|
readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},Ps=class extends eT{#t=new Set(
|
|
@@ -1046,24 +1046,24 @@ readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.m
|
|
|
1046
1046
|
t),this.#n??=nT(this,this.#t,this.#i);let r=sT({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,
|
|
1047
1047
|
onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(Cs(t),!this.#t.has(t))
|
|
1048
1048
|
return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},nT=async(e,t,r)=>{io(
|
|
1049
|
-
e,
|
|
1050
|
-
signal:t})=>{try{await
|
|
1049
|
+
e,cm);let n=new AbortController;try{await Promise.race([oT(e,n),iT(e,t,r,n)])}finally{n.abort(),io(e,-cm)}},oT=async(e,{
|
|
1050
|
+
signal:t})=>{try{await um(e,{signal:t,cleanup:!0})}catch(r){throw dm(e,r),r}},iT=async(e,t,r,{signal:n})=>{for await(let[
|
|
1051
1051
|
o]of Zv(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},Cs=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a\
|
|
1052
1052
|
readable stream, got: \`${typeof e}\`.`)},sT=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:i,
|
|
1053
|
-
unpipeEvent:s})=>{io(e,
|
|
1053
|
+
unpipeEvent:s})=>{io(e,lm);let a=new AbortController;try{await Promise.race([aT(i,t,a),cT({passThroughStream:e,stream:t,
|
|
1054
1054
|
streams:r,ended:n,aborted:o,controller:a}),lT({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{
|
|
1055
|
-
a.abort(),io(e,-
|
|
1056
|
-
await e,r.aborted||xs(t)}catch(n){r.aborted||
|
|
1057
|
-
controller:{signal:i}})=>{try{await
|
|
1058
|
-
aborted||!r.has(t))return;
|
|
1059
|
-
signal:i}})=>{if(await
|
|
1060
|
-
uT=e=>{e.writable&&e.end()},
|
|
1061
|
-
e.writable)&&e.destroy()},
|
|
1062
|
-
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},
|
|
1063
|
-
ks(t)}},ks=e=>{e.writable&&e.end()},
|
|
1064
|
-
Ns(e)}},Ns=e=>{e.readable&&e.destroy()};var
|
|
1065
|
-
type:c})=>oe.has(c)))
|
|
1066
|
-
fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]:Ze(i);$t(s,o)}},
|
|
1055
|
+
a.abort(),io(e,-lm)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?xs(e):uT(e))},aT=async(e,t,{signal:r})=>{try{
|
|
1056
|
+
await e,r.aborted||xs(t)}catch(n){r.aborted||dm(t,n)}},cT=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,
|
|
1057
|
+
controller:{signal:i}})=>{try{await um(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.
|
|
1058
|
+
aborted||!r.has(t))return;pm(s)?o.add(t):mm(e,s)}},lT=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{
|
|
1059
|
+
signal:i}})=>{if(await am(e,o,{signal:i}),!e.readable)return am(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},
|
|
1060
|
+
uT=e=>{e.writable&&e.end()},dm=(e,t)=>{pm(t)?xs(e):mm(e,t)},pm=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",xs=e=>{(e.readable||
|
|
1061
|
+
e.writable)&&e.destroy()},mm=(e,t)=>{e.destroyed||(e.once("error",dT),e.destroy(t))},dT=()=>{},io=(e,t)=>{let r=e.getMaxListeners();
|
|
1062
|
+
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},cm=2,lm=1;import{finished as fm}from"node:stream/promises";var $t=(e,t)=>{e.pipe(t),pT(e,t),mT(e,t)},pT=async(e,t)=>{if(!(ce(e)||ce(t))){try{await fm(e,{cleanup:!0,readable:!0,writable:!1})}catch{}
|
|
1063
|
+
ks(t)}},ks=e=>{e.writable&&e.end()},mT=async(e,t)=>{if(!(ce(e)||ce(t))){try{await fm(t,{cleanup:!0,readable:!1,writable:!0})}catch{}
|
|
1064
|
+
Ns(e)}},Ns=e=>{e.readable&&e.destroy()};var hm=(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(({
|
|
1065
|
+
type:c})=>oe.has(c)))fT(e,a,s,o);for(let{stream:a}of i.filter(({type:c})=>!oe.has(c)))gT({subprocess:e,stream:a,direction:s,
|
|
1066
|
+
fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]:Ze(i);$t(s,o)}},fT=(e,t,r,n)=>{
|
|
1067
1067
|
r==="output"?$t(e.stdio[n],t):$t(t,e.stdio[n]);let o=hT[n];o!==void 0&&(e[o]=t),e.stdio[n]=t},hT=["stdin","stdout","stde\
|
|
1068
1068
|
rr"],gT=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{if(t===void 0)return;bT(t,i);let[s,
|
|
1069
1069
|
a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},bT=(e,{signal:t})=>{ce(e)&&Je(e,yT,t)},yT=2;import{addAbortListener as ST}from"node:events";var et=[];et.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&et.push("SIGALRM","SIGABRT","SIGVTALRM","SIGX\
|
|
@@ -1088,134 +1088,134 @@ t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,et.forEa
|
|
|
1088
1088
|
this.#i,this.#r.count-=1)}#a(t){return so(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#i.
|
|
1089
1089
|
call(this.#e,this.#e.exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&so(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=
|
|
1090
1090
|
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)}},
|
|
1091
|
-
Bs=globalThis.process,{onExit:
|
|
1092
|
-
from:l,unpipeSignal:u}=ET(r,n,o),{sourceStream:d,sourceError:p}=TT(e,l),{options:
|
|
1093
|
-
sourceStream:d,sourceOptions:
|
|
1091
|
+
Bs=globalThis.process,{onExit:gm,load:qU,unload:YU}=_T(so(Bs)?new Us(Bs):new Ls);var bm=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=gm(()=>{e.kill()});ST(n,()=>{o()})};var wm=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=gn(),{destination:s,destinationStream:a,destinationError:c,
|
|
1092
|
+
from:l,unpipeSignal:u}=ET(r,n,o),{sourceStream:d,sourceError:p}=TT(e,l),{options:m,fileDescriptors:f}=ye.get(e);return{sourcePromise:t,
|
|
1093
|
+
sourceStream:d,sourceOptions:m,sourceError:p,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:f,
|
|
1094
1094
|
startTime:i}},ET=(e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=vT(e,t,...r),a=An(n,i);return{
|
|
1095
1095
|
destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},vT=(e,t,r,...n)=>{if(Array.
|
|
1096
|
-
isArray(r))return{destination:t(
|
|
1096
|
+
isArray(r))return{destination:t(ym,e)(r,...n),pipeOptions:e};if(typeof r=="string"||r instanceof URL||Ri(r)){if(Object.keys(
|
|
1097
1097
|
e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of\
|
|
1098
|
-
.pipe(options)("file", ...).');let[o,i,s]=sn(r,...n);return{destination:t(
|
|
1098
|
+
.pipe(options)("file", ...).');let[o,i,s]=sn(r,...n);return{destination:t(ym)(o,i,s),pipeOptions:s}}if(ye.has(r)){if(Object.
|
|
1099
1099
|
keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(\
|
|
1100
1100
|
options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a templat\
|
|
1101
|
-
e string, an options object, or an Execa subprocess: ${r}`)},
|
|
1102
|
-
TT=(e,t)=>{try{return{sourceStream:Rt(e,t)}}catch(r){return{sourceError:r}}};var
|
|
1101
|
+
e string, an options object, or an Execa subprocess: ${r}`)},ym=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),
|
|
1102
|
+
TT=(e,t)=>{try{return{sourceStream:Rt(e,t)}}catch(r){return{sourceError:r}}};var Sm=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:i,startTime:s})=>{
|
|
1103
1103
|
let a=OT({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(a!==void 0)throw js({error:a,fileDescriptors:o,
|
|
1104
1104
|
sourceOptions:i,startTime:s})},OT=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>{if(t!==void 0&&
|
|
1105
1105
|
n!==void 0)return n;if(n!==void 0)return Ns(e),n;if(t!==void 0)return ks(r),t},js=({error:e,fileDescriptors:t,sourceOptions:r,
|
|
1106
|
-
startTime:n})=>xt({error:e,command:
|
|
1107
|
-
ipe(destination)";var
|
|
1108
|
-
pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as IT}from"node:stream/promises";var
|
|
1106
|
+
startTime:n})=>xt({error:e,command:_m,escapedCommand:_m,fileDescriptors:t,options:r,startTime:n,isSync:!1}),_m="source.p\
|
|
1107
|
+
ipe(destination)";var Em=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.
|
|
1108
|
+
pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as IT}from"node:stream/promises";var vm=(e,t,r)=>{let n=co.has(t)?RT(e,t):AT(e,t);return Je(e,CT,r.signal),Je(t,xT,r.signal),PT(t),n},AT=(e,t)=>{let r=Ze(
|
|
1109
1109
|
[e]);return $t(r,t),co.set(t,r),r},RT=(e,t)=>{let r=co.get(t);return r.add(e),r},PT=async e=>{try{await IT(e,{cleanup:!0,
|
|
1110
|
-
readable:!1,writable:!0})}catch{}co.delete(e)},co=new WeakMap,CT=2,xT=1;import{aborted as kT}from"node:util";var
|
|
1110
|
+
readable:!1,writable:!0})}catch{}co.delete(e)},co=new WeakMap,CT=2,xT=1;import{aborted as kT}from"node:util";var Tm=(e,t)=>e===void 0?[]:[NT(e,t)],NT=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{
|
|
1111
1111
|
await kT(e,t),await r.remove(t);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw js({error:s,fileDescriptors:n,
|
|
1112
|
-
sourceOptions:o,startTime:i})};var lo=(e,...t)=>{if(L(t[0]))return lo.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=
|
|
1112
|
+
sourceOptions:o,startTime:i})};var lo=(e,...t)=>{if(L(t[0]))return lo.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=wm(
|
|
1113
1113
|
e,...t),o=$T({...n,destination:r});return o.pipe=lo.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},$T=async({
|
|
1114
1114
|
sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,
|
|
1115
|
-
fileDescriptors:c,startTime:l})=>{let u=MT(e,o);
|
|
1116
|
-
fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let p=
|
|
1117
|
-
[
|
|
1115
|
+
fileDescriptors:c,startTime:l})=>{let u=MT(e,o);Sm({sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,
|
|
1116
|
+
fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let p=vm(t,i,d);return await Promise.race(
|
|
1117
|
+
[Em(u),...Tm(a,{sourceStream:t,mergedStream:p,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},MT=(e,t)=>Promise.
|
|
1118
1118
|
allSettled([e,t]);import{setImmediate as FT}from"node:timers/promises";import{on as DT}from"node:events";import{getDefaultHighWaterMark as LT}from"node:stream";var uo=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{let s=new AbortController;
|
|
1119
|
-
return UT(t,s),
|
|
1119
|
+
return UT(t,s),Im({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,
|
|
1120
1120
|
preserveNewlines:i})},UT=async(e,t)=>{try{await e}catch{}finally{t.abort()}},Gs=({stream:e,onStreamEnd:t,lines:r,encoding:n,
|
|
1121
|
-
stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;BT(t,s,e);let a=e.readableObjectMode&&!i;return
|
|
1121
|
+
stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;BT(t,s,e);let a=e.readableObjectMode&&!i;return Im({stream:e,
|
|
1122
1122
|
controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},BT=async(e,t,r)=>{try{
|
|
1123
|
-
await e}catch{r.destroy()}finally{t.abort()}},
|
|
1124
|
-
preserveNewlines:s})=>{let a=DT(e,"data",{signal:t.signal,highWaterMark:
|
|
1125
|
-
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},Fs=LT(!0),
|
|
1123
|
+
await e}catch{r.destroy()}finally{t.abort()}},Im=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,
|
|
1124
|
+
preserveNewlines:s})=>{let a=DT(e,"data",{signal:t.signal,highWaterMark:Om,highWatermark:Om});return jT({onStdoutChunk:a,
|
|
1125
|
+
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},Fs=LT(!0),Om=Fs,jT=async function*({
|
|
1126
1126
|
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=GT({binary:r,shouldEncode:n,
|
|
1127
1127
|
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{
|
|
1128
1128
|
yield*_r(a)}},GT=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[eo(e,r,!t),Zn(e,o,!n,{})].filter(
|
|
1129
|
-
Boolean);var
|
|
1129
|
+
Boolean);var Am=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,
|
|
1130
1130
|
streamInfo:u})=>{let d=HT({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!o){await Promise.
|
|
1131
|
-
all([VT(e),d]);return}let p=ws(c,r),
|
|
1132
|
-
all([zT({stream:e,iterable:
|
|
1131
|
+
all([VT(e),d]);return}let p=ws(c,r),m=Gs({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:p,allMixed:a}),[f]=await Promise.
|
|
1132
|
+
all([zT({stream:e,iterable:m,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),d]);return f},HT=async({stream:e,onStreamEnd:t,
|
|
1133
1133
|
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!no({stdioItems:s[r]?.stdioItems,encoding:n,
|
|
1134
1134
|
verboseInfo:i,fdNumber:r}))return;let a=Gs({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});
|
|
1135
1135
|
await Up(a,e,r,i)},VT=async e=>{await FT(),e.readableFlowing===null&&e.resume()},zT=async({stream:e,stream:{readableObjectMode:t},
|
|
1136
1136
|
iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await Hn(r,{maxBuffer:i}):o==="buffer"?new Uint8Array(
|
|
1137
|
-
await Vn(r,{maxBuffer:i})):await Wn(r,{maxBuffer:i})}catch(a){return
|
|
1138
|
-
encoding:o,fdNumber:n}))}},Hs=async e=>{try{return await e}catch(t){return
|
|
1137
|
+
await Vn(r,{maxBuffer:i})):await Wn(r,{maxBuffer:i})}catch(a){return Rm(Ud({error:a,stream:e,readableObjectMode:t,lines:s,
|
|
1138
|
+
encoding:o,fdNumber:n}))}},Hs=async e=>{try{return await e}catch(t){return Rm(t)}},Rm=({bufferedData:e})=>el(e)?new Uint8Array(
|
|
1139
1139
|
e):e;import{finished as WT}from"node:stream/promises";var Tr=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let i=qT(e,
|
|
1140
1140
|
r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],WT(e,{cleanup:!0,signal:s.signal})])}catch(a){i.
|
|
1141
1141
|
stdinCleanedUp||KT(a,t,r,n)}finally{s.abort()}},qT=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===
|
|
1142
1142
|
t&&YT(e,r,n),n},YT=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{JT(t,r),n.call(e,...o)}},JT=({exitCode:e,signalCode:t},r)=>{
|
|
1143
|
-
(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},KT=(e,t,r,n)=>{if(!XT(e,t,r,n))throw e},XT=(e,t,r,n=!0)=>r.propagating?
|
|
1144
|
-
po(e):(r.propagating=!0,Vs(r,t)===n?
|
|
1145
|
-
code==="ERR_STREAM_PREMATURE_CLOSE",
|
|
1143
|
+
(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},KT=(e,t,r,n)=>{if(!XT(e,t,r,n))throw e},XT=(e,t,r,n=!0)=>r.propagating?Pm(e)||
|
|
1144
|
+
po(e):(r.propagating=!0,Vs(r,t)===n?Pm(e):po(e)),Vs=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",po=e=>e?.
|
|
1145
|
+
code==="ERR_STREAM_PREMATURE_CLOSE",Pm=e=>e?.code==="EPIPE";var Cm=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>e.stdio.
|
|
1146
1146
|
map((c,l)=>zs({stream:c,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,stripFinalNewline:i,verboseInfo:s,
|
|
1147
1147
|
streamInfo:a})),zs=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,
|
|
1148
|
-
streamInfo:l})=>{if(!e)return;let u=Tr(e,t,l);if(Vs(l,t)){await u;return}let[d]=await Promise.all([
|
|
1149
|
-
fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var
|
|
1148
|
+
streamInfo:l})=>{if(!e)return;let u=Tr(e,t,l);if(Vs(l,t)){await u;return}let[d]=await Promise.all([Am({stream:e,onStreamEnd:u,
|
|
1149
|
+
fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var xm=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?Ze([e,t].filter(Boolean)):void 0,km=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,
|
|
1150
1150
|
lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>zs({...QT(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||
|
|
1151
1151
|
o[2],allMixed:ZT(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),QT=({stdout:e,stderr:t,all:r},[,n,o])=>{let i=n||o;
|
|
1152
1152
|
return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}},ZT=({all:e,stdout:t,stderr:r})=>e&&
|
|
1153
|
-
t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as eO}from"node:events";var
|
|
1153
|
+
t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as eO}from"node:events";var Nm=e=>vt(e,"ipc"),$m=(e,t)=>{let r=hn(e);ge({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var Mm=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{if(!n)return o;let s=Nm(i),a=Ae(t,"i\
|
|
1154
1154
|
pc"),c=Ae(r,"ipc");for await(let l of Rs({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))
|
|
1155
|
-
a&&(Bd(e,o,c),o.push(l)),s
|
|
1156
|
-
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:p,verboseInfo:
|
|
1157
|
-
onInternalError:_,controller:g})=>{let S=Hp(e,p),v={originalStreams:h,fileDescriptors:
|
|
1158
|
-
b=
|
|
1159
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:
|
|
1160
|
-
maxBuffer:n,ipc:u,ipcOutput:T,verboseInfo:
|
|
1155
|
+
a&&(Bd(e,o,c),o.push(l)),s&&$m(l,i);return o},Dm=async(e,t)=>(await Promise.allSettled([e]),t);var Lm=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,
|
|
1156
|
+
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:p,verboseInfo:m,fileDescriptors:f,originalStreams:h,
|
|
1157
|
+
onInternalError:_,controller:g})=>{let S=Hp(e,p),v={originalStreams:h,fileDescriptors:f,subprocess:e,exitPromise:S,propagating:!1},
|
|
1158
|
+
b=Cm({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:m,streamInfo:v}),R=km({subprocess:e,
|
|
1159
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:m,streamInfo:v}),T=[],E=Mm({subprocess:e,buffer:r,
|
|
1160
|
+
maxBuffer:n,ipc:u,ipcOutput:T,verboseInfo:m}),k=tO(h,e,v),N=rO(f,v);try{return await Promise.race([Promise.all([{},zp(S),
|
|
1161
1161
|
Promise.all(b),R,E,bd(e,d),...k,...N]),_,nO(e,g),...pd(e,i,p,g),...Nu({subprocess:e,cancelSignal:s,gracefulCancel:a,context:p,
|
|
1162
1162
|
controller:g}),...ud({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:p,controller:g})])}catch(D){
|
|
1163
|
-
return p.terminationReason??="other",Promise.all([{error:D},S,Promise.all(b.map(G=>Hs(G))),Hs(R),
|
|
1163
|
+
return p.terminationReason??="other",Promise.all([{error:D},S,Promise.all(b.map(G=>Hs(G))),Hs(R),Dm(E,T),Promise.allSettled(
|
|
1164
1164
|
k),Promise.allSettled(N)])}},tO=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:Tr(n,o,r)),rO=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.
|
|
1165
1165
|
filter(({value:o,stream:i=o})=>de(i,{checkOpen:!1})&&!ce(i)).map(({type:o,value:i,stream:s=i})=>Tr(s,n,t,{isSameDirection:oe.
|
|
1166
|
-
has(o),stopOnExit:o==="native"}))),nO=async(e,{signal:t})=>{let[r]=await eO(e,"error",{signal:t});throw r};var
|
|
1166
|
+
has(o),stopOnExit:o==="native"}))),nO=async(e,{signal:t})=>{let[r]=await eO(e,"error",{signal:t});throw r};var Um=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Or=(e,t,r)=>{let n=e[r];
|
|
1167
1167
|
n.has(t)||n.set(t,[]);let o=n.get(t),i=be();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},Mt=async({resolve:e,
|
|
1168
|
-
promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as oO}from"node:stream";import{callbackify as iO}from"node:util";import{finished as
|
|
1169
|
-
await
|
|
1170
|
-
if(await e,t)throw t},
|
|
1168
|
+
promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as oO}from"node:stream";import{callbackify as iO}from"node:util";import{finished as Bm}from"node:stream/promises";var Ws=async e=>{if(e!==void 0)try{await qs(e)}catch{}},jm=async e=>{if(e!==void 0)try{await Ys(e)}catch{}},qs=async e=>{
|
|
1169
|
+
await Bm(e,{cleanup:!0,readable:!1,writable:!0})},Ys=async e=>{await Bm(e,{cleanup:!0,readable:!0,writable:!1})},mo=async(e,t)=>{
|
|
1170
|
+
if(await e,t)throw t},fo=(e,t,r)=>{r&&!po(r)?e.destroy(r):t&&e.destroy()};var Gm=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{let s=o||ee.has(r),
|
|
1171
1171
|
{subprocessStdout:a,waitReadableDestroy:c}=Js(e,n,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=Ks(
|
|
1172
|
-
a,s),{read:p,onStdoutDataDone:
|
|
1172
|
+
a,s),{read:p,onStdoutDataDone:m}=Xs({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),f=new oO({
|
|
1173
1173
|
read:p,destroy:iO(Zs.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,
|
|
1174
|
-
encoding:l});return Qs({subprocessStdout:a,onStdoutDataDone:
|
|
1174
|
+
encoding:l});return Qs({subprocessStdout:a,onStdoutDataDone:m,readable:f,subprocess:e}),f},Js=(e,t,r)=>{let n=Rt(e,t),o=Or(
|
|
1175
1175
|
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},Ks=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?
|
|
1176
1176
|
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Fs},
|
|
1177
1177
|
Xs=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=be(),s=uo({subprocessStdout:e,subprocess:t,
|
|
1178
1178
|
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){sO(this,s,i)},onStdoutDataDone:i}},sO=async(e,t,r)=>{
|
|
1179
1179
|
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},Qs=async({subprocessStdout:e,onStdoutDataDone:t,
|
|
1180
1180
|
readable:r,subprocess:n,subprocessStdin:o})=>{try{await Ys(e),await n,await Ws(o),await t,r.readable&&r.push(null)}catch(i){
|
|
1181
|
-
await Ws(o),
|
|
1182
|
-
t,n))},
|
|
1183
|
-
e,r,t),s=new aO({...ta(n,e,o),destroy:
|
|
1181
|
+
await Ws(o),Fm(r,i)}},Zs=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await Mt(r,t)&&(Fm(e,n),await mo(
|
|
1182
|
+
t,n))},Fm=(e,t)=>{fo(e,e.readable,t)};import{Writable as aO}from"node:stream";import{callbackify as Hm}from"node:util";var Vm=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=ea(
|
|
1183
|
+
e,r,t),s=new aO({...ta(n,e,o),destroy:Hm(na.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),
|
|
1184
1184
|
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return ra(n,s),s},ea=(e,t,r)=>{let n=An(e,t),o=Or(
|
|
1185
1185
|
r,n,"writableFinal"),i=Or(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},ta=(e,t,r)=>({
|
|
1186
|
-
write:cO.bind(void 0,e),final:
|
|
1187
|
-
await Mt(r,t)&&(e.writable&&e.end(),await t)},ra=async(e,t,r)=>{try{await qs(e),t.writable&&t.end()}catch(n){await
|
|
1188
|
-
|
|
1189
|
-
n,t)&&(
|
|
1186
|
+
write:cO.bind(void 0,e),final:Hm(lO.bind(void 0,e,t,r))}),cO=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},lO=async(e,t,r)=>{
|
|
1187
|
+
await Mt(r,t)&&(e.writable&&e.end(),await t)},ra=async(e,t,r)=>{try{await qs(e),t.writable&&t.end()}catch(n){await jm(r),
|
|
1188
|
+
zm(t,n)}},na=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await Mt(r,t),await Mt(
|
|
1189
|
+
n,t)&&(zm(e,o),await mo(t,o))},zm=(e,t)=>{fo(e,e.writable,t)};import{Duplex as uO}from"node:stream";import{callbackify as dO}from"node:util";var Wm=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||ee.
|
|
1190
1190
|
has(r),{subprocessStdout:c,waitReadableDestroy:l}=Js(e,n,t),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:p}=ea(
|
|
1191
|
-
e,o,t),{readableEncoding:
|
|
1191
|
+
e,o,t),{readableEncoding:m,readableObjectMode:f,readableHighWaterMark:h}=Ks(c,a),{read:_,onStdoutDataDone:g}=Xs({subprocessStdout:c,
|
|
1192
1192
|
subprocess:e,binary:a,encoding:r,preserveNewlines:s}),S=new uO({read:_,...ta(u,e,d),destroy:dO(pO.bind(void 0,{subprocessStdout:c,
|
|
1193
1193
|
subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:h,
|
|
1194
|
-
writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:
|
|
1194
|
+
writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:f,writableObjectMode:u.writableObjectMode,encoding:m});
|
|
1195
1195
|
return Qs({subprocessStdout:c,onStdoutDataDone:g,readable:S,subprocess:e,subprocessStdin:u}),ra(u,S,c),S},pO=async({subprocessStdout:e,
|
|
1196
1196
|
subprocessStdin:t,subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([
|
|
1197
1197
|
Zs({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},s),na({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},
|
|
1198
1198
|
s)])};var oa=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||ee.has(t),s=Rt(e,r),a=uo({subprocessStdout:s,subprocess:e,
|
|
1199
|
-
binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return
|
|
1200
|
-
t.readable&&t.destroy(),await r}};var
|
|
1201
|
-
|
|
1202
|
-
e.iterable=oa.bind(void 0,e,t),e[Symbol.asyncIterator]=oa.bind(void 0,e,t,{})};var
|
|
1203
|
-
constructor.prototype,hO=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(
|
|
1204
|
-
e,t,r),{subprocess:p,promise:
|
|
1205
|
-
fileDescriptors:d});return p.pipe=lo.bind(void 0,{source:p,sourcePromise:
|
|
1199
|
+
binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return mO(a,s,e)},mO=async function*(e,t,r){try{yield*e}finally{
|
|
1200
|
+
t.readable&&t.destroy(),await r}};var qm=(e,{encoding:t})=>{let r=Um();e.readable=Gm.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=
|
|
1201
|
+
Vm.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=Wm.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),
|
|
1202
|
+
e.iterable=oa.bind(void 0,e,t),e[Symbol.asyncIterator]=oa.bind(void 0,e,t,{})};var Ym=(e,t)=>{for(let[r,n]of hO){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},fO=(async()=>{})().
|
|
1203
|
+
constructor.prototype,hO=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(fO,e)]);var Jm=(e,t,r,n)=>{let{file:o,commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=yO(
|
|
1204
|
+
e,t,r),{subprocess:p,promise:m}=_O({file:o,commandArguments:i,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,
|
|
1205
|
+
fileDescriptors:d});return p.pipe=lo.bind(void 0,{source:p,sourcePromise:m,boundOptions:{},createNested:n}),Ym(p,m),ye.set(
|
|
1206
1206
|
p,{options:u,fileDescriptors:d}),p},yO=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=bn(e,t,r),{file:a,
|
|
1207
|
-
commandArguments:c,options:l}=Un(e,t,r),u=wO(l),d=
|
|
1207
|
+
commandArguments:c,options:l}=Un(e,t,r),u=wO(l),d=sm(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,
|
|
1208
1208
|
verboseInfo:s,options:u,fileDescriptors:d}},wO=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "sig\
|
|
1209
1209
|
nal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},_O=({file:e,commandArguments:t,
|
|
1210
|
-
options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=bO(...Bn(e,t,r))}catch(
|
|
1211
|
-
return
|
|
1212
|
-
gO(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];
|
|
1213
|
-
kill.bind(c),options:r,onInternalError:p,context:d,controller:l}),c.all=
|
|
1210
|
+
options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=bO(...Bn(e,t,r))}catch(f){
|
|
1211
|
+
return rm({error:f,command:i,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let l=new AbortController;
|
|
1212
|
+
gO(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];hm(c,a,l),bm(c,r,l);let d={},p=be();c.kill=xu.bind(void 0,{kill:c.
|
|
1213
|
+
kill.bind(c),options:r,onInternalError:p,context:d,controller:l}),c.all=xm(c,r),qm(c,r),Zp(c,r);let m=SO({subprocess:c,options:r,
|
|
1214
1214
|
startTime:n,verboseInfo:o,fileDescriptors:a,originalStreams:u,command:i,escapedCommand:s,context:d,onInternalError:p,controller:l});
|
|
1215
|
-
return{subprocess:c,promise:
|
|
1216
|
-
command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[p,
|
|
1217
|
-
context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let g=
|
|
1218
|
-
map((b,R)=>Pe(b,t,R)),S=Pe(h,t,"all"),v=EO({errorInfo:d,exitCode:p,signal:
|
|
1215
|
+
return{subprocess:c,promise:m}},SO=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,
|
|
1216
|
+
command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[p,m],f,h,_]=await Lm({subprocess:e,options:t,
|
|
1217
|
+
context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let g=f.
|
|
1218
|
+
map((b,R)=>Pe(b,t,R)),S=Pe(h,t,"all"),v=EO({errorInfo:d,exitCode:p,signal:m,stdio:g,all:S,ipcOutput:_,context:c,options:t,
|
|
1219
1219
|
command:s,escapedCommand:a,startTime:r});return kt(v,n,t)},EO=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,
|
|
1220
1220
|
context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in e?wr({error:e.error,command:c,escapedCommand:l,timedOut:s.
|
|
1221
1221
|
terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.
|
|
@@ -1225,25 +1225,25 @@ options:a,startTime:u});var ho=(e,t)=>{let r=Object.fromEntries(Object.entries(t
|
|
|
1225
1225
|
has(e)&&L(t)&&L(r)?{...t,...r}:r,TO=new Set(["env",...$i]);var Ue=(e,t,r,n)=>{let o=(s,a,c)=>Ue(s,a,r,c),i=(...s)=>OO({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,
|
|
1226
1226
|
createNested:o},...s);return n!==void 0&&n(i,o,t),i},OO=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,
|
|
1227
1227
|
createNested:o},i,...s)=>{if(L(i))return o(e,ho(r,i),n);let{file:a,commandArguments:c,options:l,isSync:u}=IO({mapArguments:e,
|
|
1228
|
-
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?qp(a,c,l):
|
|
1228
|
+
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?qp(a,c,l):Jm(a,c,l,o)},IO=({mapArguments:e,firstArgument:t,
|
|
1229
1229
|
nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=sl(t)?al(t,r):[t,...r],[s,a,c]=sn(...i),l=ho(ho(n,o),c),{file:u=s,
|
|
1230
|
-
commandArguments:d=a,options:p=l,isSync:
|
|
1231
|
-
options:p,isSync:
|
|
1230
|
+
commandArguments:d=a,options:p=l,isSync:m=!1}=e({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,
|
|
1231
|
+
options:p,isSync:m}};var Km=({file:e,commandArguments:t})=>Qm(e,t),Xm=({file:e,commandArguments:t})=>({...Qm(e,t),isSync:!0}),Qm=(e,t)=>{if(t.
|
|
1232
1232
|
length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=AO(
|
|
1233
1233
|
e);return{file:r,commandArguments:n}},AO=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(
|
|
1234
1234
|
e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(RO)){let o=r.at(-1);o&&o.endsWith("\\")?r[r.length-
|
|
1235
|
-
1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},RO=/ +/g;var
|
|
1236
|
-
...CO(e),...e}}),CO=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},
|
|
1237
|
-
getEachMessage:
|
|
1235
|
+
1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},RO=/ +/g;var Zm=(e,t,r)=>{e.sync=t(PO,r),e.s=e.sync},ef=({options:e})=>tf(e),PO=({options:e})=>({...tf(e),isSync:!0}),tf=e=>({options:{
|
|
1236
|
+
...CO(e),...e}}),CO=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},rf={preferLocal:!0};var nf=Ue(()=>({})),L4=Ue(()=>({isSync:!0})),U4=Ue(Km),B4=Ue(Xm),j4=Ue(fd),G4=Ue(ef,{},rf,Zm),{sendMessage:F4,getOneMessage:H4,
|
|
1237
|
+
getEachMessage:V4,getCancelSignal:z4}=em();function xO(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function Ir({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
1238
1238
|
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:d=null,retryable:p=null}={}){
|
|
1239
|
-
let
|
|
1240
|
-
`)).trim();return{code:C(e),error:C(t),exitCode:
|
|
1241
|
-
Number(s):null,signal:C(a),stderr:h,stdout:
|
|
1239
|
+
let m=xO(r),f=String(l||""),h=String(c||""),_=String(o||[f,h].filter(Boolean).join(`
|
|
1240
|
+
`)).trim();return{code:C(e),error:C(t),exitCode:m,ok:n===null?m===0:n===!0,output:_,pid:Number.isSafeInteger(Number(s))?
|
|
1241
|
+
Number(s):null,signal:C(a),stderr:h,stdout:f,...i==="base64"?{outputEncoding:i}:{},timedOut:u===!0,...d&&typeof d=="obje\
|
|
1242
1242
|
ct"&&!Array.isArray(d)?{execution:d}:{},...typeof p=="boolean"?{retryable:p}:{}}}function V(e="",t="vibe64_command_faile\
|
|
1243
1243
|
d",r={}){let n=C(e)||"Vibe64 command failed.";return Ir({...r,code:t,error:n,exitCode:1,ok:!1,output:C(r.output)||n,stderr:r.
|
|
1244
|
-
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}import{spawn as
|
|
1244
|
+
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}import{spawn as af}from"node:child_process";import{mkdir as NO,open as $O,readdir as MO,readFile as DO}from"node:fs/promises";
|
|
1245
1245
|
import LO from"node:path";import{fileURLToPath as UO}from"node:url";var kO=new URL("./../../../vibe64-execution/src/server/engines/detached.js",import.meta.url).href,tt=new Map,BO=3e3,jO=1e3,
|
|
1246
|
-
GO=UO(new URL("./detachedReaper.js",kO)),pe=null;function FO(e){if(process.platform!=="win32"){if(!pe){let t=
|
|
1246
|
+
GO=UO(new URL("./detachedReaper.js",kO)),pe=null;function FO(e){if(process.platform!=="win32"){if(!pe){let t=af(process.
|
|
1247
1247
|
execPath,[GO],{cwd:"/",detached:!0,stdio:["pipe","ignore","ignore"]});t.once("error",()=>{pe===t&&(pe=null)}),t.once("ex\
|
|
1248
1248
|
it",()=>{pe===t&&(pe=null)}),t.stdin.on("error",()=>{}),t.unref(),t.stdin.unref(),pe=t;for(let r of tt.values())r.scopeEmpty!==
|
|
1249
1249
|
!0&&r.pid!==e&&t.stdin.write(`+${r.pid}
|
|
@@ -1251,51 +1251,51 @@ it",()=>{pe===t&&(pe=null)}),t.stdin.on("error",()=>{}),t.unref(),t.stdin.unref(
|
|
|
1251
1251
|
`)}}function HO(e){pe&&(pe.stdin.write(`-${e}
|
|
1252
1252
|
`),![...tt.values()].some(t=>t.scopeEmpty!==!0)&&(pe.stdin.end(),pe=null))}async function VO(e=""){return e?(await NO(LO.
|
|
1253
1253
|
dirname(e),{recursive:!0}),$O(e,"w",384)):null}async function zO(e){return new Promise((t,r)=>{let n=!1,o=(i,s)=>{n||(n=
|
|
1254
|
-
!0,i(s))};e.once("spawn",()=>o(t)),e.once("error",i=>o(r,i))})}async function
|
|
1255
|
-
try{o=await VO(e.logPath);let i=o?["ignore",o.fd,o.fd]:["ignore","ignore","ignore"],s=
|
|
1254
|
+
!0,i(s))};e.once("spawn",()=>o(t)),e.once("error",i=>o(r,i))})}async function cf(e={},t={}){let{cwd:r="",env:n={}}=t,o=null;
|
|
1255
|
+
try{o=await VO(e.logPath);let i=o?["ignore",o.fd,o.fd]:["ignore","ignore","ignore"],s=af(e.command,e.args,{cwd:r||void 0,
|
|
1256
1256
|
detached:!0,env:n,stdio:i});await zO(s);let a=e.execution?.id||"";return a&&(tt.set(a,{child:s,pid:Number(s.pid)}),FO(Number(
|
|
1257
1257
|
s.pid)),s.once("exit",()=>{!go(s.pid)&&tt.has(a)&&(tt.set(a,{child:s,pid:Number(s.pid),scopeEmpty:!0}),HO(Number(s.pid)))})),
|
|
1258
1258
|
s.unref(),Ir({execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:s.pid})}catch(i){return V(i?.
|
|
1259
1259
|
message||"Detached command failed to start.",i?.code||"vibe64_command_detached_failed",{execution:e.execution})}finally{
|
|
1260
1260
|
await o?.close().catch(()=>null)}}function go(e=null){let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)return!1;if(process.
|
|
1261
1261
|
platform==="win32"){let r=[...tt.values()].find(n=>n.pid===t);return r?.child?.exitCode===null&&r?.child?.signalCode===null}
|
|
1262
|
-
try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function
|
|
1262
|
+
try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function of(e=null,t="SIGTERM"){if(!go(e))return!1;try{
|
|
1263
1263
|
return process.platform==="win32"?[...tt.values()].find(n=>n.pid===Number(e))?.child?.kill(t):process.kill(-Number(e),t),
|
|
1264
|
-
!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function
|
|
1264
|
+
!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function lf(e=null,t=10){let r=Number(e);if(process.platform!==
|
|
1265
1265
|
"linux"||!Number.isSafeInteger(r)||r<=0)return[];let n=[];for(let o of await MO("/proc").catch(()=>[])){if(n.length>=t)break;
|
|
1266
1266
|
if(!/^\d+$/u.test(o))continue;let i=await DO(`/proc/${o}/stat`,"utf8").catch(()=>""),s=i.lastIndexOf(")"),a=s<0?[]:i.slice(
|
|
1267
|
-
s+2).split(" ");Number(a[2])!==r||a[0]==="Z"||n.push({command:i.slice(i.indexOf("(")+1,s),pid:Number(o)})}return n}async function
|
|
1267
|
+
s+2).split(" ");Number(a[2])!==r||a[0]==="Z"||n.push({command:i.slice(i.indexOf("(")+1,s),pid:Number(o)})}return n}async function sf(e=null,t=0){
|
|
1268
1268
|
let r=Date.now()+Math.max(0,Number(t)||0);for(;go(e)&&Date.now()<r;)await new Promise(n=>setTimeout(n,25));return!go(e)}
|
|
1269
|
-
async function bo(e=null,t={}){let{killTimeoutMs:r=jO,termTimeoutMs:n=BO}=t;
|
|
1270
|
-
(
|
|
1271
|
-
outputEncoding:l="utf8",signal:u=null,timeout:d=15e3}=r,p,f,
|
|
1272
|
-
if(u?.aborted)return V("Command cancelled.","vibe64_command_cancelled",{execution:i});try{let b=
|
|
1269
|
+
async function bo(e=null,t={}){let{killTimeoutMs:r=jO,termTimeoutMs:n=BO}=t;of(e,"SIGTERM");let o=await sf(e,n);return o||
|
|
1270
|
+
(of(e,"SIGKILL"),o=await sf(e,r)),o}var uf=new Map;async function rt(e="",t=[],r={}){let{cwd:n="",env:o={},execution:i=null,input:s=void 0,maxBuffer:a=void 0,onOutput:c=null,
|
|
1271
|
+
outputEncoding:l="utf8",signal:u=null,timeout:d=15e3}=r,p,m,f,h=null,_=Promise.withResolvers(),g=()=>{f||=m(),f.then(_.resolve)};
|
|
1272
|
+
if(u?.aborted)return V("Command cancelled.","vibe64_command_cancelled",{execution:i});try{let b=nf(e,t,{all:!0,cwd:n,detached:process.
|
|
1273
1273
|
platform!=="win32",encoding:l,env:o,extendEnv:!1,input:s,maxBuffer:a,reject:!1,stdin:s==null?"ignore":"pipe",stripFinalNewline:!1,
|
|
1274
|
-
timeout:d});h=Number(b.pid);let R;
|
|
1275
|
-
k=b.then(()=>!0,()=>!0)),R=k.then(N=>(N||(R=null),N))}return R},i?.id&&
|
|
1274
|
+
timeout:d});h=Number(b.pid);let R;m=()=>{if(!R){let k;process.platform!=="win32"?k=bo(h).catch(()=>!1):(b.kill("SIGKILL"),
|
|
1275
|
+
k=b.then(()=>!0,()=>!0)),R=k.then(N=>(N||(R=null),N))}return R},i?.id&&uf.set(i.id,m),u?.addEventListener("abort",g,{once:!0}),
|
|
1276
1276
|
u?.aborted&&g(),typeof c=="function"&&b.all&&b.all.on("data",k=>{try{c(String(k||""))}catch{}});let T=await Promise.race(
|
|
1277
1277
|
[b,_.promise.then(k=>k?b:{exitCode:1})]),E=typeof T.exitCode=="number"?T.exitCode:1;p=Ir({code:T.timedOut===!0?"vibe64_c\
|
|
1278
1278
|
ommand_capture_timed_out":T.code?"vibe64_command_capture_failed":"",error:E===0?"":T.shortMessage,exitCode:E,output:T.all||
|
|
1279
1279
|
(E===0?"":T.shortMessage),outputEncoding:l,signal:T.signal,stderr:T.stderr,stdout:T.stdout,timedOut:T.timedOut===!0,execution:i})}catch(b){
|
|
1280
1280
|
p=V(b.message,"vibe64_command_capture_failed",{execution:i,exitCode:typeof b.exitCode=="number"?b.exitCode:1,output:b.all,
|
|
1281
1281
|
outputEncoding:l,signal:b.signal,stderr:b.stderr,stdout:b.stdout,timedOut:b.timedOut===!0})}finally{u?.removeEventListener(
|
|
1282
|
-
"abort",g)}if(!await(m
|
|
1282
|
+
"abort",g)}if(!await(f||m?.()||!0)){let b=await lf(h),R=p?.timedOut?"The command timed out":u?.aborted?"The command was \
|
|
1283
1283
|
cancelled":"The command finished",T=b.length?`: ${b.map(E=>`${E.command} (pid ${E.pid})`).join(", ")} still running`:"";
|
|
1284
1284
|
return{...V(`${R}, and its execution scope did not become empty${T}.`,"vibe64_execution_drain_failed",{execution:i,output:p?.
|
|
1285
1285
|
output,outputEncoding:l,signal:p?.signal,stderr:p?.stderr,stdout:p?.stdout,timedOut:p?.timedOut}),remainingProcesses:b}}
|
|
1286
|
-
i?.id&&
|
|
1287
|
-
ed",{...p,execution:v,outputEncoding:l}):v?{...p,execution:v}:p}import WO from"node:path";import
|
|
1286
|
+
i?.id&&uf.delete(i.id);let v=i&&{...i,state:"finished"};return u?.aborted?V("Command cancelled.","vibe64_command_cancell\
|
|
1287
|
+
ed",{...p,execution:v,outputEncoding:l}):v?{...p,execution:v}:p}import WO from"node:path";import df from"node:process";import{isMainThread as qO}from"node:worker_threads";var ia=Symbol.
|
|
1288
1288
|
for("vibe64.hostProfile"),Ar=Symbol.for("vibe64.hostProfile.previousUmask"),YO=["runtimePackRoot","sharedCacheRoot","exe\
|
|
1289
|
-
cHelperPath"],yo=Object.freeze({runtimePackRoot:"",sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1});function
|
|
1290
|
-
qO&&(e&&!(Ar in globalThis)?globalThis[Ar]=
|
|
1291
|
-
function sa(e=null){if(e===null)return delete globalThis[ia],
|
|
1289
|
+
cHelperPath"],yo=Object.freeze({runtimePackRoot:"",sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1});function pf(e){
|
|
1290
|
+
qO&&(e&&!(Ar in globalThis)?globalThis[Ar]=df.umask(7):!e&&Ar in globalThis&&(df.umask(globalThis[Ar]),delete globalThis[Ar]))}
|
|
1291
|
+
function sa(e=null){if(e===null)return delete globalThis[ia],pf(!1),yo;let t=Object.keys(e).filter(o=>!(o in yo));if(t.length)
|
|
1292
1292
|
throw new TypeError(`Unknown host profile setting: ${t.join(", ")}.`);let r={...yo,...e};for(let o of YO)if(typeof r[o]!=
|
|
1293
1293
|
"string"||r[o]&&!WO.isAbsolute(r[o]))throw new TypeError(`Host profile ${o} must be an absolute path or empty.`);if(typeof r.
|
|
1294
1294
|
sharedGroupAccess!="boolean")throw new TypeError("Host profile sharedGroupAccess must be true or false.");let n=Object.freeze(
|
|
1295
|
-
r);return globalThis[ia]=n,
|
|
1295
|
+
r);return globalThis[ia]=n,pf(n.sharedGroupAccess),n}function me(){return globalThis[ia]||yo}var JO="vibe64.exec-helper.payload",KO=1;function aa(e=""){let t=String(e||"").trim()||me().execHelperPath;if(!t){let r=new Error(
|
|
1296
1296
|
"This computer has no helper for running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}
|
|
1297
|
-
function
|
|
1298
|
-
operation:i="vibe64-command",args:s=[]}={}){return
|
|
1297
|
+
function mf(e={}){return{...e,schema:JO,schemaVersion:KO}}function wo({actor:e={},command:t="",cwd:r="",env:n={},input:o,
|
|
1298
|
+
operation:i="vibe64-command",args:s=[]}={}){return mf({args:Array.isArray(s)?s.map(a=>String(a)):[],command:t,cwd:r,env:n,
|
|
1299
1299
|
gid:e.user?.gid,home:e.user?.home,inputBase64:o==null?"":Buffer.isBuffer(o)?o.toString("base64"):Buffer.from(String(o)).
|
|
1300
1300
|
toString("base64"),operation:i,uid:e.user?.uid,username:e.user?.username})}function Rr(e={}){return e.mode==="pty"&&e.envPolicy===
|
|
1301
1301
|
"auth"&&!["assistant","codex"].includes(e.purpose)?"account-auth-terminal":e.purpose==="codex"&&e.mode==="capture"&&e.envPolicy===
|
|
@@ -1307,64 +1307,64 @@ ub-workflow-command":e.purpose==="github-api"?"github-api-command":e.purpose==="
|
|
|
1307
1307
|
d":e.purpose==="health"?"health-status":"vibe64-command"}async function ca(e={},{env:t,helperPath:r="",maxBuffer:n=void 0,
|
|
1308
1308
|
outputEncoding:o="utf8",runCapture:i=rt,signal:s=null,timeout:a=15e3}){let c={env:t,input:`${JSON.stringify(e)}
|
|
1309
1309
|
`,outputEncoding:o,signal:s,timeout:a};return Number.isSafeInteger(Number(n))&&Number(n)>0&&(c.maxBuffer=Number(n)),i("s\
|
|
1310
|
-
udo",["-n",aa(r),"execute"],c)}import{createRequire as QO}from"node:module";var XO=new URL("./../../../../@jskit-ai/kernel/server/support/symlinkSafeRequire.js",import.meta.url).href;var
|
|
1311
|
-
in",customScheme:"",appLinkDomains:Object.freeze([])}),
|
|
1312
|
-
versionName:"1.0.0"});var
|
|
1313
|
-
"metadata","migrations","runtime","vite"]);import nI from"node:path";var tI="jskit-client-build",
|
|
1314
|
-
session?.metadata?.session_git_command_actor_user_key)}async function
|
|
1310
|
+
udo",["-n",aa(r),"execute"],c)}import{createRequire as QO}from"node:module";var XO=new URL("./../../../../@jskit-ai/kernel/server/support/symlinkSafeRequire.js",import.meta.url).href;var m6=QO(XO);var w6=Object.freeze(["bundled","dev_server"]),_6=Object.freeze(["capacitor"]),S6=Object.freeze({callbackPath:"/auth/log\
|
|
1311
|
+
in",customScheme:"",appLinkDomains:Object.freeze([])}),E6=Object.freeze({packageName:"",minSdk:26,targetSdk:35,versionCode:1,
|
|
1312
|
+
versionName:"1.0.0"});var j6=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),G6=Object.freeze(["capabilities","kind",
|
|
1313
|
+
"metadata","migrations","runtime","vite"]);import nI from"node:path";var tI="jskit-client-build",W6=new RegExp(`<meta name="${tI}" content="([0-9a-f]+)"`,"u");var Q6=nI.join("dist","index.html");function iI(e={}){return Oe(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
1314
|
+
session?.metadata?.session_git_command_actor_user_key)}async function ff(e={}){let t=C(e.actor)||"daemon";if(t==="app"&&
|
|
1315
1315
|
e.applicationAccount)return{actor:t,applicationAccount:!0,credentialScope:t,requiresRealUser:!1,user:await Ai(e.applicationAccount)};
|
|
1316
1316
|
if(t==="daemon"||t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:Ii()};let r=iI(e);if(!r){let n=new Error(
|
|
1317
1317
|
"A user key is required for real-user command execution.");throw n.code="vibe64_command_actor_user_required",n}return{actor:t,
|
|
1318
|
-
credentialScope:"user",requiresRealUser:!0,user:await Ai(r)}}import JI from"node:path";import
|
|
1319
|
-
execHelperPath}function _o(e={}){return e.requiresRealUser?la()||!Dt(e):!1}function
|
|
1318
|
+
credentialScope:"user",requiresRealUser:!0,user:await Ai(r)}}import JI from"node:path";import hf from"node:path";function Dt(e={}){let t=Qc();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.user?.gid}function la(){return!!me().
|
|
1319
|
+
execHelperPath}function _o(e={}){return e.requiresRealUser?la()||!Dt(e):!1}function gf(e={},t={},r=""){if(!e.requiresRealUser)
|
|
1320
1320
|
return;let n=x(t.session?.sourceRoot||t.session?.sourcePath),o=x(r);if(!n||!o||!$e(n,o))return;let i=new Error("Commands\
|
|
1321
1321
|
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\
|
|
1322
|
-
ged_source_real_user_forbidden",i}function
|
|
1323
|
-
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&
|
|
1322
|
+
ged_source_real_user_forbidden",i}function bf(e={},t={}){let r=x(e.user?.home),n=x(t.HOME),o=x(t.VIBE64_CREDENTIAL_HOME);
|
|
1323
|
+
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&hf.resolve(r)!==hf.resolve(n)){let i=new Error("Command HOME does not match t\
|
|
1324
1324
|
he resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",i}}var Pr=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
1325
1325
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
1326
1326
|
R","VIBE64_MYSQL_USER"]);function So(...e){let t={};for(let r of e){let n=re(r);for(let o of Pr)n[o]!==void 0&&(t[o]=n[o])}
|
|
1327
1327
|
return t}import{spawn as sI,spawnSync as aI}from"node:child_process";import{createHash as cI}from"node:crypto";import{statSync as lI}from"node:fs";
|
|
1328
|
-
import{stat as
|
|
1329
|
-
d",uI=2e3,
|
|
1328
|
+
import{stat as vf}from"node:fs/promises";import Eo from"node:path";var nt="GIT_AUTHOR_NAME",ot="GIT_AUTHOR_EMAIL",it="GIT_COMMITTER_NAME",st="GIT_COMMITTER_EMAIL",ua=".users.vibe64.invali\
|
|
1329
|
+
d",uI=2e3,Tf=["config","--get-regexp","^user\\.(name|email)$"],dI=3e4,pI=['git config --global user.name "Your Name"','g\
|
|
1330
1330
|
it config --global user.email "you@example.com"'].join(`
|
|
1331
|
-
`);function
|
|
1332
|
-
t}function
|
|
1331
|
+
`);function yf(e="",t="vibe64"){return C(e).toLowerCase().replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||
|
|
1332
|
+
t}function mI(...e){for(let t of e){let r=F(t),n=F(r.user),o=Oe(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,
|
|
1333
1333
|
n.name,n.userName,n.user_name),i=Oe(r.email,r.userEmail,r.user_email,r.gitUserEmail,r.git_user_email,n.email,n.userEmail,
|
|
1334
1334
|
n.user_email);if(o&&i)return{authorEmail:i,authorName:o,committerEmail:i,committerName:o,source:"configured"}}return null}
|
|
1335
|
-
function
|
|
1335
|
+
function fI(e={}){let t=F(e),r=Oe(t.name,t.displayName,t.login,t.username),n=Oe(t.email,t.publicEmail,t.verifiedEmail);return!r||
|
|
1336
1336
|
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"github"}}function hI({workspace:e="",userKey:t=""}={}){
|
|
1337
|
-
let r=
|
|
1338
|
-
64@${n}${ua}`,committerName:"Vibe64",source:"fallback"}}function da(e=""){let t=C(e);return t&&Eo.isAbsolute(t)?t:""}function
|
|
1339
|
-
let t=da(e);try{return t&&lI(t).isDirectory()?t:""}catch{return""}}async function
|
|
1340
|
-
t).then(r=>r.isDirectory(),()=>!1)?t:""}function
|
|
1341
|
-
`)){let n=/^user\.(name|email)(?: (.*))?$/iu.exec(r);n&&(t[n[1].toLowerCase()]=C(n[2]))}return t}function
|
|
1342
|
-
...e?{cwd:e}:{},env:t,stdio:["ignore","pipe","ignore"],timeout:uI}}function
|
|
1343
|
-
utf8"});return r.error||r.status!==0&&r.status!==1?null:
|
|
1344
|
-
i=a=>{o||(o=!0,r(a))},s=sI("git",
|
|
1345
|
-
{transient:!0,values:null})),s.once("close",(a,c)=>i(c?{transient:!0,values:null}:{transient:!1,values:a===0||a===1?
|
|
1346
|
-
null}))})}function
|
|
1347
|
-
committerName:e.name,source:"git-config"}}function
|
|
1337
|
+
let r=yf(t,"user"),n=yf(e,"local");return{authorEmail:`${r}@${n}${ua}`,authorName:`${r} via Vibe64`,committerEmail:`vibe\
|
|
1338
|
+
64@${n}${ua}`,committerName:"Vibe64",source:"fallback"}}function da(e=""){let t=C(e);return t&&Eo.isAbsolute(t)?t:""}function wf(e=""){
|
|
1339
|
+
let t=da(e);try{return t&&lI(t).isDirectory()?t:""}catch{return""}}async function _f(e=""){let t=da(e);return t&&await vf(
|
|
1340
|
+
t).then(r=>r.isDirectory(),()=>!1)?t:""}function Of(e=""){let t={};for(let r of String(e||"").split(`
|
|
1341
|
+
`)){let n=/^user\.(name|email)(?: (.*))?$/iu.exec(r);n&&(t[n[1].toLowerCase()]=C(n[2]))}return t}function If(e,t){return{
|
|
1342
|
+
...e?{cwd:e}:{},env:t,stdio:["ignore","pipe","ignore"],timeout:uI}}function Sf(e,t){let r=aI("git",Tf,{...If(e,t),encoding:"\
|
|
1343
|
+
utf8"});return r.error||r.status!==0&&r.status!==1?null:Of(r.stdout)}function Ef(e,t){return new Promise(r=>{let n="",o=!1,
|
|
1344
|
+
i=a=>{o||(o=!0,r(a))},s=sI("git",Tf,If(e,t));s.stdout.setEncoding("utf8"),s.stdout.on("data",a=>{n+=a}),s.once("error",()=>i(
|
|
1345
|
+
{transient:!0,values:null})),s.once("close",(a,c)=>i(c?{transient:!0,values:null}:{transient:!1,values:a===0||a===1?Of(n):
|
|
1346
|
+
null}))})}function Af(e=null){return!e?.name||!e?.email?null:{authorEmail:e.email,authorName:e.name,committerEmail:e.email,
|
|
1347
|
+
committerName:e.name,source:"git-config"}}function Rf(e={}){return{...e,PATH:process.env.PATH||e.PATH}}function gI(e={}){
|
|
1348
1348
|
if(Object.hasOwn(e,"GIT_CONFIG_GLOBAL"))return[String(e.GIT_CONFIG_GLOBAL)];let t=da(e.HOME),r=C(e.XDG_CONFIG_HOME)||(t?
|
|
1349
1349
|
Eo.join(t,".config"):"");return[r?Eo.join(r,"git","config"):"",t?Eo.join(t,".gitconfig"):""].filter(Boolean)}async function bI(e={}){
|
|
1350
|
-
return(await Promise.all(gI(e).map(r=>
|
|
1350
|
+
return(await Promise.all(gI(e).map(r=>vf(r).then(n=>`${n.ino}:${n.size}:${n.mtimeMs}:${n.ctimeMs}`,()=>"missing")))).join(
|
|
1351
1351
|
"|")}var Lt=new Map;function yI(e,t,r){let n=Object.entries(r).sort(([o],[i])=>o<i?-1:o>i?1:0);return cI("sha256").update(
|
|
1352
|
-
JSON.stringify([e,t,n])).digest("hex")}async function wI(e,t,r){let n=e?await
|
|
1352
|
+
JSON.stringify([e,t,n])).digest("hex")}async function wI(e,t,r){let n=e?await Ef(e,r):null;if(n?.values)return n;let o=await Ef(
|
|
1353
1353
|
t,r);return{transient:!!(n?.transient||o.transient),values:o.values}}async function _I(e,t,r){let n=yI(e,t,r),o=await bI(
|
|
1354
1354
|
r),i=Date.now(),s=Lt.get(n);if(s&&s.revision===o&&s.expiresAt>i)return(await s.read).values;for(let[l,u]of Lt)u.expiresAt<=
|
|
1355
1355
|
i&&Lt.delete(l);let a={expiresAt:i+dI,read:wI(e,t,r),revision:o};Lt.set(n,a);let c=await a.read;return c.transient&&Lt.get(
|
|
1356
1356
|
n)===a&&Lt.delete(n),c.values}async function SI({cwd:e="",env:t=null}={}){if(!t||typeof t!="object")return null;let[r,n]=await Promise.
|
|
1357
|
-
all([
|
|
1358
|
-
let r=
|
|
1357
|
+
all([_f(e),_f(t.HOME)]);return Af(await _I(r,n,Rf(t)))}function EI({cwd:e="",env:t=null}={}){if(!t||typeof t!="object")return null;
|
|
1358
|
+
let r=Rf(t),n=wf(e);return Af(n&&Sf(n,r)||Sf(wf(t.HOME),r))}function vI(e={}){let t=F(e),r=C(t.name),n=C(t.email);return!r||
|
|
1359
1359
|
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"git-config"}}function pa(e=""){return C(e).
|
|
1360
|
-
toLowerCase().endsWith(ua)}function
|
|
1360
|
+
toLowerCase().endsWith(ua)}function Pf({env:e,personGitIdentity:t=null,project:r={},session:n={}}){let o=F(n.metadata);return mI(
|
|
1361
1361
|
r.gitIdentity,r.config?.git,n.gitIdentity,o.git_identity,{name:e.VIBE64_GIT_USER_NAME,email:e.VIBE64_GIT_USER_EMAIL})||vI(
|
|
1362
|
-
t)}function
|
|
1362
|
+
t)}function Cf({actor:e={},env:t,project:r={},session:n={},userKey:o=""}){let i=F(n.metadata);return fI(r.githubUser||n.
|
|
1363
1363
|
githubUser||i.github_user)||hI({workspace:Oe(r.workspace,t.VIBE64_WORKSPACE,t.VIBE64_RUNTIME_NAMESPACE),userKey:Oe(o,e.user?.
|
|
1364
|
-
username,t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.LOGNAME)})}async function TI(e){return
|
|
1365
|
-
e.gitConfig||{})||
|
|
1366
|
-
[nt]:e.authorName,[st]:e.committerEmail,[it]:e.committerName}}async function
|
|
1367
|
-
return
|
|
1364
|
+
username,t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.LOGNAME)})}async function TI(e){return Pf(e)||await SI(
|
|
1365
|
+
e.gitConfig||{})||Cf(e)}function OI(e){return Pf(e)||EI(e.gitConfig||{})||Cf(e)}function xf(e){return{[ot]:e.authorEmail,
|
|
1366
|
+
[nt]:e.authorName,[st]:e.committerEmail,[it]:e.committerName}}async function kf(e){return xf(await TI(e))}function Nf(e){
|
|
1367
|
+
return xf(OI(e))}import{readFileSync as AI}from"node:fs";import Mf from"node:path";import ma from"node:path";var Ut=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:["bubblewrap/bin"],
|
|
1368
1368
|
managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","package-lock.json"],
|
|
1369
1369
|
managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:["composer.json","composer.lock"],managedCommands:[
|
|
1370
1370
|
"composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-configuration.json","conanfi\
|
|
@@ -1392,72 +1392,72 @@ i/claude-code/package.json","operator-clis/lib/node_modules/@openai/codex/packag
|
|
|
1392
1392
|
opencode-ai/package.json"],managedCommands:["claude","codex","opencode"]},php:{binDirs:["php/bin"],managedCommands:["php"]},
|
|
1393
1393
|
playwright:{binDirs:["playwright/bin"],identityPaths:["playwright/runtime.env","playwright/browsers"],managedCommands:["\
|
|
1394
1394
|
playwright"]},postgresql:{binDirs:["postgresql/bin"],managedCommands:["initdb","pg_ctl","pg_isready","postgres","psql"]},
|
|
1395
|
-
ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:["sqlite3"]}}),
|
|
1395
|
+
ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:["sqlite3"]}}),fa=Object.
|
|
1396
1396
|
freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","bubblewrap","bun","php","\
|
|
1397
1397
|
composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);function z({root:e=""}={}){
|
|
1398
|
-
return x(e||
|
|
1399
|
-
let e=z();return e?[
|
|
1400
|
-
let t=C(e);return[...Ut[t]?.managedCommands||[]]}var
|
|
1401
|
-
GHT_VERSION",
|
|
1402
|
-
let t=z({root:e});if(!t)return"";let r=
|
|
1398
|
+
return x(e||me().runtimePackRoot)}function ha(e=""){let t=z();return(t?Ut[C(e)]?.binDirs||[]:[]).map(n=>ma.join(t,n))}function $f(){
|
|
1399
|
+
let e=z();return e?[ma.join(e,"guard-bin")]:[]}function ga(){let e=z();return e?[ma.join(e,"policy-bin")]:[]}function II(e=""){
|
|
1400
|
+
let t=C(e);return[...Ut[t]?.managedCommands||[]]}var FG=Object.freeze({runtimePackManagedCommands:II});var vo="VIBE64_SHARED_CACHE_ROOT",Cr="PLAYWRIGHT_BROWSERS_PATH",ba="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",ya="VIBE64_PLAYWRI\
|
|
1401
|
+
GHT_VERSION",Df="playwright",RI="browsers",PI="runtime.env",CI=/^\d+\.\d+\.\d+$/u;function xI({runtimePackRoot:e=""}={}){
|
|
1402
|
+
let t=z({root:e});if(!t)return"";let r=Mf.join(t,Df,PI),n;try{n=AI(r,"utf8")}catch(i){if(i?.code==="ENOENT")return"";throw i}
|
|
1403
1403
|
let o=n.split(/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!CI.test(
|
|
1404
|
-
o[0]))throw new Error(`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function
|
|
1405
|
-
let t=z({root:e}),r=x(
|
|
1404
|
+
o[0]))throw new Error(`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function Lf({runtimePackRoot:e=""}={}){
|
|
1405
|
+
let t=z({root:e}),r=x(me().sharedCacheRoot),n=xI({runtimePackRoot:t});return{...r?{[vo]:r}:{},...t?{[Cr]:Mf.join(t,Df,RI),
|
|
1406
1406
|
[ba]:"1"}:{},...n?{[ya]:n}:{}}}var kI=new Set(["HOME","LOGNAME","PATH","TMPDIR","USER","VIBE64_EXECUTION_ID","VIBE64_MANAGED_EXECUTION_REQUIRED","XDG_C\
|
|
1407
1407
|
ACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"]),NI=new Set([...Pr,ot,nt,st,it,Cr,ba,ya,vo]);function Bt(e={}){
|
|
1408
1408
|
for(let t of Object.keys(re(e)))if(kI.has(t)||t.startsWith("XDG_")){let r=new Error(`Vibe64 command callers cannot provi\
|
|
1409
1409
|
de execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function To(e={},t={}){let{envPolicy:r="\
|
|
1410
1410
|
session"}=t,n=re(e);Bt(n);let o=Object.fromEntries(Object.entries(n).filter(([i])=>!NI.has(i)));return r==="deployment"?
|
|
1411
|
-
o:{...o,...So(n)}}function $I(e=""){let t=x(e);return t==="/home"||t.startsWith("/home/")}function
|
|
1411
|
+
o:{...o,...So(n)}}function $I(e=""){let t=x(e);return t==="/home"||t.startsWith("/home/")}function Uf({actor:e={},request:t={}}={}){let r=t.
|
|
1412
1412
|
credentialHome||{},n=x(r.home);if(!n)return{};let o=x(e.user?.home);if(e.requiresRealUser&&o&&n!==o){let a=new Error("Co\
|
|
1413
1413
|
mmand credential home must match the resolved real-user actor home.");throw a.code="vibe64_command_credential_home_actor\
|
|
1414
1414
|
_mismatch",a}if(!e.requiresRealUser&&$I(n)&&o&&!$e(o,n)){let a=new Error("A /home credential directory requires a matchi\
|
|
1415
1415
|
ng real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=C(r.username||e.user?.username);
|
|
1416
1416
|
return{...lr({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...x(r.cacheRoot)?{XDG_CACHE_HOME:x(r.cacheRoot)}:{},...x(r.
|
|
1417
1417
|
configRoot)?{XDG_CONFIG_HOME:x(r.configRoot)}:{},...x(r.dataRoot)?{XDG_DATA_HOME:x(r.dataRoot)}:{},...x(r.stateRoot)?{XDG_STATE_HOME:x(
|
|
1418
|
-
r.stateRoot)}:{}}}import
|
|
1418
|
+
r.stateRoot)}:{}}}import Bf from"node:path";var MI=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"url.https://github.com/.in\
|
|
1419
1419
|
steadOf",value:"ssh://git@github.com/"}]),DI=Object.freeze([{key:"credential.https://github.com.helper",value:"!/usr/bin\
|
|
1420
1420
|
/env gh auth git-credential"}]),LI=Object.freeze([{key:"credential.https://github.com.helper",value:`!f() { case "$1" in\
|
|
1421
1421
|
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function UI(e=[]){let t=new Set,
|
|
1422
|
-
r=[];for(let n of Array.isArray(e)?e:[e]){let o=C(n);if(!o||!
|
|
1422
|
+
r=[];for(let n of Array.isArray(e)?e:[e]){let o=C(n);if(!o||!Bf.isAbsolute(o))continue;let i=Bf.resolve(o);t.has(i)||(t.
|
|
1423
1423
|
add(i),r.push(i))}return r}function xr(e={},t=[]){let r={...e&&typeof e=="object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(
|
|
1424
1424
|
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);
|
|
1425
1425
|
s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),
|
|
1426
|
-
r}function
|
|
1427
|
-
return
|
|
1428
|
-
0",PAGER:"cat"}}function _a(e={}){return xr(e,MI)}function jI(e={}){return xr(e,DI)}function GI(e={}){return xr(e,LI)}function
|
|
1429
|
-
return jI(_a(e))}function
|
|
1426
|
+
r}function jf(e=[]){return UI(e).map(t=>({key:"safe.directory",value:t}))}function Gf(e={},t=[]){return xr(e,jf(t))}function BI(e=[]){
|
|
1427
|
+
return jf(e).flatMap(t=>["-c",`${t.key}=${t.value}`])}function wa(){return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"\
|
|
1428
|
+
0",PAGER:"cat"}}function _a(e={}){return xr(e,MI)}function jI(e={}){return xr(e,DI)}function GI(e={}){return xr(e,LI)}function Ff(e={}){
|
|
1429
|
+
return jI(_a(e))}function Hf(e={}){return GI(_a(e))}var sF=Object.freeze({applyGitConfigEntriesToEnv:xr,githubSshToHttpsGitEnv:_a,
|
|
1430
1430
|
gitSafeDirectoryArgs:BI});var FI="VIBE64_GIT_AUTH_TOKEN";function HI(e={}){if(!e.gitAuthToken){let t=new Error("Token-backed GitHub transport requ\
|
|
1431
|
-
ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}return
|
|
1432
|
-
[FI]:e.gitAuthToken})}function
|
|
1433
|
-
-token"?r=HI(e):(e.gitTransport==="github-https"||e.purpose==="github")&&(r=
|
|
1434
|
-
[])}import
|
|
1435
|
-
function
|
|
1436
|
-
map(C).filter(Boolean)}function
|
|
1431
|
+
ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}return Hf({...wa(),GIT_TERMINAL_PROMPT:"0",
|
|
1432
|
+
[FI]:e.gitAuthToken})}function Vf({request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github\
|
|
1433
|
+
-token"?r=HI(e):(e.gitTransport==="github-https"||e.purpose==="github")&&(r=Ff({...t,...wa()})),Gf(r,e.gitSafeDirectories||
|
|
1434
|
+
[])}import zf from"node:path";var Sa="NPM_CONFIG_PREFIX";function Wf({env:e={}}={}){return z()?x(e[Sa])||(x(e.HOME)?zf.join(x(e.HOME),".local"):""):""}
|
|
1435
|
+
function qf(e={}){let t=Wf(e);return t?{[Sa]:t}:{}}function Yf(e={}){let t=Wf(e);return t?[zf.join(t,"bin")]:[]}import{existsSync as VI,readdirSync as zI}from"node:fs";import WI from"node:os";import Be from"node:path";import Oo from"node:process";var Nr="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";function kr(e=""){return String(e||"").split(":").
|
|
1436
|
+
map(C).filter(Boolean)}function Kf(e=[]){return e.filter(t=>{try{return VI(t)}catch{return!1}})}function Jf(e="",t=/^$/u){
|
|
1437
1437
|
try{return zI(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[]}}
|
|
1438
1438
|
function qI(e){if(z())return[];let t=String(e.HOME||WI.homedir()||"");if(!Be.isAbsolute(t))return[];let r=Be.isAbsolute(
|
|
1439
1439
|
String(e.XDG_DATA_HOME||""))?e.XDG_DATA_HOME:Be.join(t,".local/share"),n=Be.isAbsolute(String(e.MISE_DATA_DIR||""))?e.MISE_DATA_DIR:
|
|
1440
|
-
Be.join(r,"mise");return
|
|
1440
|
+
Be.join(r,"mise");return Kf([Be.join(t,".local/bin"),Be.join(n,"shims"),...[".claude/local",".opencode/bin",".cargo/bin",
|
|
1441
1441
|
".bun/bin"].map(o=>Be.join(t,o))])}function YI(){if(z())return[];let e=["/opt/homebrew","/usr/local"];return[...kr(Oo.env.
|
|
1442
|
-
PATH),...Oo.platform==="darwin"?["/opt/homebrew/bin"]:[],...
|
|
1443
|
-
/usr/lib/postgresql/${t}/bin`),...Oo.platform==="darwin"?e.flatMap(t=>[...
|
|
1444
|
-
map(r=>`${t}/opt/${r}/bin`),`${t}/opt/mariadb/bin`]):[]])]}function
|
|
1445
|
-
shimDirs:o=[]}){return qe([...kr(o.join(":")),...ga(),...n.flatMap(i=>ha(i)),...$
|
|
1442
|
+
PATH),...Oo.platform==="darwin"?["/opt/homebrew/bin"]:[],...Kf([...Jf("/usr/lib/postgresql",/^\d+$/u).slice(0,1).map(t=>`\
|
|
1443
|
+
/usr/lib/postgresql/${t}/bin`),...Oo.platform==="darwin"?e.flatMap(t=>[...Jf(`${t}/opt`,/^postgresql@\d+$/u).slice(0,1).
|
|
1444
|
+
map(r=>`${t}/opt/${r}/bin`),`${t}/opt/mariadb/bin`]):[]])]}function Xf({env:e,existingPath:t="",inheritedPath:r="",runtimes:n=[],
|
|
1445
|
+
shimDirs:o=[]}){return qe([...kr(o.join(":")),...ga(),...n.flatMap(i=>ha(i)),...$f(),...kr(t||(r?"":e.PATH)),...qI(Oo.env),
|
|
1446
1446
|
...kr(r),...YI(),...kr(Nr)]).join(":")}var KI=new Set([...Pr,ot,nt,st,it,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG\
|
|
1447
1447
|
_RUNTIME_DIR"]);function XI(e={}){return Object.fromEntries(Object.entries(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).
|
|
1448
1448
|
map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!KI.has(t)&&!t.startsWith("GIT_")&&!t.startsWith("GH\
|
|
1449
1449
|
_")&&!t.startsWith("XDG_")))}function Ea(e={}){return e.envPolicy==="deployment"?[e.project?.deploymentEnv,e.project?.deployment?.
|
|
1450
1450
|
env]:[e.project?.runtimeConfigEnv,e.project?.databaseEnv]}function QI(e={}){return Ea(e).reduce((t,r)=>e.envPolicy==="de\
|
|
1451
1451
|
ployment"?(Bt(r),{...t,...re(r)}):{...t,...To(r,e)},{})}function ZI(e={},t={}){return t.envPolicy==="deployment"?[]:t.envPolicy===
|
|
1452
|
-
"project"?Ea(t):[e,...Ea(t),t.project?.databaseEnv,t.session?.databaseEnv]}function
|
|
1453
|
-
request:n={}}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=
|
|
1454
|
-
"").trim(),c={...lr(e.user,XI(t)),...Dt(e)&&JI.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...So(...ZI(t,n)),...QI(n),...
|
|
1455
|
-
request:n}),...s,...
|
|
1456
|
-
...
|
|
1457
|
-
PATH:u,...z()?{}:{VIBE64_TOOL_PATH:u}}}function
|
|
1452
|
+
"project"?Ea(t):[e,...Ea(t),t.project?.databaseEnv,t.session?.databaseEnv]}function Qf({actor:e={},baseEnv:t,localPath:r="",
|
|
1453
|
+
request:n={}}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=Lf(),s=To(n.env,n),a=String(t.XDG_RUNTIME_DIR||
|
|
1454
|
+
"").trim(),c={...lr(e.user,XI(t)),...Dt(e)&&JI.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...So(...ZI(t,n)),...QI(n),...Vf({actor:e,
|
|
1455
|
+
request:n}),...s,...Uf({actor:e,request:n}),...i},l={...c,...qf({env:c}),VIBE64_DECLARED_RUNTIMES:o},u=Xf({env:l,existingPath:[
|
|
1456
|
+
...Yf({env:l}),l.PATH].filter(Boolean).join(":"),inheritedPath:r,runtimes:n.runtimes,shimDirs:n.shimDirs||[]});return{...l,
|
|
1457
|
+
PATH:u,...z()?{}:{VIBE64_TOOL_PATH:u}}}function Zf({actor:e={},baseEnv:t,request:r={}},n){return{actor:e,env:t,gitConfig:{
|
|
1458
1458
|
cwd:r.cwd,env:n},personGitIdentity:r.personGitIdentity,project:r.project,session:r.session,userKey:r.userKey}}async function eh(e){
|
|
1459
|
-
let t=
|
|
1460
|
-
e,t))}}import{randomUUID as wA}from"node:crypto";import{mkdirSync as _A,writeFileSync as SA}from"node:fs";import ka from"node:path";import
|
|
1459
|
+
let t=Qf(e);return{...t,...await kf(Zf(e,t))}}function va(e){let t=Qf(e);return{...t,...e.resolvedGitIdentityEnv||Nf(Zf(
|
|
1460
|
+
e,t))}}import{randomUUID as wA}from"node:crypto";import{mkdirSync as _A,writeFileSync as SA}from"node:fs";import ka from"node:path";import mA from"node:crypto";import{createRequire as fA}from"node:module";import{Buffer as eA}from"node:buffer";var th=256*1024,tA=300,Io=100,Ao=28;var BF=600*1e3,rA=1440*60*1e3,jF=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "});function rh(){return{code:"\
|
|
1461
1461
|
terminal_session_not_found",error:"Terminal session not found.",ok:!1}}function je(e=""){return String(e||"default").trim()||
|
|
1462
1462
|
"default"}var nh=new Map;function Ro(e){let t=String(e||""),r=t.length;for(let n=0;n<tA&&(r=t.lastIndexOf(`
|
|
1463
1463
|
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>th&&(t=t.slice(t.length-th)),t}function $r(e={}){return e.status===
|
|
@@ -1501,8 +1501,8 @@ stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=String(t||"stop
|
|
|
1501
1501
|
ing",Se(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];if(aA(e,e.stopReason),!e.processExited&&!e.killStarted){
|
|
1502
1502
|
e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;let o=n instanceof Error?n:new Error(String(n||"Termina\
|
|
1503
1503
|
l process could not be killed."));o.code||="terminal_kill_failed",r.push(at(e,o))}}try{await Ra(e)}catch(n){r.push(at(e,
|
|
1504
|
-
n))}return{failures:r}}var cA=new Map;function lA(e="default"){return cA.get(je(e))||null}function
|
|
1505
|
-
ok:!1}:null}var ct=new Map;function jt(e){return ct.get(je(e))||nh}function
|
|
1504
|
+
n))}return{failures:r}}var cA=new Map;function lA(e="default"){return cA.get(je(e))||null}function mh(e="default"){let t=lA(e);return t?{code:t.code,error:t.error,
|
|
1505
|
+
ok:!1}:null}var ct=new Map;function jt(e){return ct.get(je(e))||nh}function fh(e){let t=je(e);return ct.has(t)||ct.set(t,new Map),ct.
|
|
1506
1506
|
get(t)}function hh(e,t,r){e.delete(r);let n=je(t);e.size<1&&ct.get(n)===e&&ct.delete(n)}function uA(e=""){let t=String(e||
|
|
1507
1507
|
"");return[...ct.keys()].filter(r=>r.startsWith(t))}function xo({namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){
|
|
1508
1508
|
let n=e?[je(e)]:uA(t),o=[];for(let i of n){let s=jt(i);for(let a of s.values())r&&!$r(a)||o.push({namespace:i,session:a})}
|
|
@@ -1515,24 +1515,24 @@ o.closeHookCompletion])).filter(Boolean);if(o.processExited&&Aa(o),s.length>0)th
|
|
|
1515
1515
|
ok:!0,closed:!0,...c.length>0?{cleanupErrors:c.map(l=>String(l?.message||l))}:{}}})();o.closePromise=i;try{return await i}finally{
|
|
1516
1516
|
o.closePromise===i&&(o.closePromise=null)}}async function dA({namespace:e}){for(let{namespace:t,session:r}of xo({namespace:e})){if(!Ta(r)||r.subscribers?.size)continue;
|
|
1517
1517
|
let n=Mr(r.detachedIdleTimeoutMs);if(!(n<1)){if(Oa(r)<n){ko(r,t);continue}await Ca(r.id,{namespace:t})}}}var pA=new URL("./../../../vibe64-execution/src/server/engines/terminalSessions.js",import.meta.url).href;function xa(){}
|
|
1518
|
-
function hA(){return!0}var gA=
|
|
1519
|
-
fault",namespaceLimitPrefix:c="",runningLimitFilter:l=hA,onClose:u=xa,onOutput:d=xa,onStop:p=xa,reuseRunning:
|
|
1520
|
-
let h=
|
|
1518
|
+
function hA(){return!0}var gA=fA(pA);function bA({filter:e,namespacePrefix:t}){return xo({namespacePrefix:t,runningOnly:!0}).filter(r=>oh(r.session,e)).length}function gh({args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},maxRunning:i=0,metadata:s={},namespace:a="de\
|
|
1519
|
+
fault",namespaceLimitPrefix:c="",runningLimitFilter:l=hA,onClose:u=xa,onOutput:d=xa,onStop:p=xa,reuseRunning:m=!1,detachedIdleTimeoutMs:f=0}){
|
|
1520
|
+
let h=mh(a);if(h)return h;let _=jt(a),g=mA.randomUUID(),S=typeof m=="function"?m:()=>!!m,v=m?[..._.values()].find(K=>$r(
|
|
1521
1521
|
K)&&S(K)):null;if(v)return Ge(v);let b=Number(i||0),R=c||a;if(b>0&&bA({filter:l,namespacePrefix:R})>=b)return{ok:!1,code:"\
|
|
1522
1522
|
terminal_limit",error:`Terminal limit reached (${b}).`};let T=typeof o=="function"?o({id:g,namespace:a}):o,E=typeof e=="\
|
|
1523
1523
|
function"?e({env:T,id:g,namespace:a}):e,k=typeof r=="function"?r({args:E,env:T,id:g,namespace:a}):r,N=typeof s=="functio\
|
|
1524
1524
|
n"?s({args:E,env:T,id:g,namespace:a}):s,D=gA("node-pty").spawn(t,E,{cols:Io,cwd:n,env:F(T),name:"xterm-color",rows:Ao}),
|
|
1525
|
-
G,
|
|
1526
|
-
toISOString(),cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:Mr(
|
|
1525
|
+
G,fe=new Promise(K=>{G=K}),$={id:g,closeHookCompletion:null,closePromise:null,commandPreview:k,cols:Io,createdAt:new Date().
|
|
1526
|
+
toISOString(),cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:Mr(f),exitCompletion:fe,exitCode:null,lastSubscriberAttachedAt:"",
|
|
1527
1527
|
lastSubscriberDetachedAt:new Date().toISOString(),metadata:N&&typeof N=="object"&&!Array.isArray(N)?N:{},onClose:u,onStop:p,
|
|
1528
1528
|
inputVersion:0,lastInputAt:"",lastInputBytes:0,lastOutputAt:"",lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",
|
|
1529
1529
|
output:"",outputVersion:0,processExited:!1,killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:G,rows:Ao,
|
|
1530
1530
|
status:"running",stopHookCompletion:null,scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:D};return lh(
|
|
1531
1531
|
$),D.onData(K=>{ah($,K),$.output=Ro($.output+K),Se($,{chunk:K,lastOutputAt:$.lastOutputAt,outputVersion:$.outputVersion,
|
|
1532
|
-
type:"output"});try{d({chunk:K,output:$.output,session:Ge($),updateMetadata(ve){return sh($,ve)}})}catch(ve){let
|
|
1533
|
-
ve?.message||ve||"Terminal output hook failed.");Se($,{error:
|
|
1532
|
+
type:"output"});try{d({chunk:K,output:$.output,session:Ge($),updateMetadata(ve){return sh($,ve)}})}catch(ve){let mt=String(
|
|
1533
|
+
ve?.message||ve||"Terminal output hook failed.");Se($,{error:mt,type:"error"})}ko($,a)}),D.onExit(({exitCode:K})=>{$.processExited=
|
|
1534
1534
|
!0,$.exitCode=K,$.status="closing",Ra($),Se($,{exitCode:K,status:$.status,type:"status"}),Ia($,$.stopReason||"exit"),$.resolveExitCompletion(),
|
|
1535
|
-
ph($)}),
|
|
1535
|
+
ph($)}),fh(a).set(g,$),ko($,a),yA(g,{namespace:a})}function yA(e,t={}){let{namespace:r="default",outputLimit:n=0}=t,i=jt(
|
|
1536
1536
|
r).get(e);return i?Ge(i,{outputLimit:n}):rh()}function EA(){}var bh=new Map;function vA(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper payload root\
|
|
1537
1537
|
is required for real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=ka.join(
|
|
1538
1538
|
ka.resolve(t),"exec-helper-payloads");return _A(r,{mode:448,recursive:!0}),ka.join(r,`${process.pid}-${Date.now()}-${wA()}\
|
|
@@ -1586,13 +1586,13 @@ freeze({...u})}:{},controlGenerationId:Gt(s.controlGenerationId),...s.workflowId
|
|
|
1586
1586
|
parentExecutionId:Gt(s.parentExecutionId),projectSlug:Gt(s.projectSlug||n.slug||n.projectSlug),sessionId:Gt(s.sessionId||
|
|
1587
1587
|
i.sessionId)})}function VA(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.
|
|
1588
1588
|
test(e))throw Q("Execution requires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}function zA(e=""){
|
|
1589
|
-
return LA.has(e)?
|
|
1589
|
+
return LA.has(e)?fa:[]}function Sh(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function WA(e={},t=""){let r=Sh(
|
|
1590
1590
|
e,"runtimes"),n=Sh(e,"runtime");if(!r&&!n)return qe(zA(t));let o=r?e.runtimes:e.runtime;return qe((Array.isArray(o)?o:[o]).
|
|
1591
1591
|
map(C).filter(Boolean))}function vh(e={}){let t=F(e),r=C(t.command);if(!r)throw Q("A command is required.","vibe64_comma\
|
|
1592
1592
|
nd_required");let n=Fe(t.mode,CA,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!=="capture"))
|
|
1593
1593
|
throw Q("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=re(t.baseEnv),i=BA(
|
|
1594
|
-
t.env,{mode:n}),s=Fe(t.purpose,PA,"terminal","purpose"),a=WA(t,s);for(let
|
|
1595
|
-
orted Vibe64 runtime: ${
|
|
1594
|
+
t.env,{mode:n}),s=Fe(t.purpose,PA,"terminal","purpose"),a=WA(t,s);for(let m of a)if(!Object.hasOwn(Ut,m))throw Q(`Unsupp\
|
|
1595
|
+
orted Vibe64 runtime: ${m}.`,"vibe64_command_runtime_unsupported");let c=F(t.project),l=F(t.session),u=t.releaseEnvironmentFile??
|
|
1596
1596
|
"";if(typeof u!="string"||u&&(!u.startsWith("/")||/[\r\n\0]/u.test(u)||n!=="capture"||t.actor!=="app"||t.envPolicy!=="de\
|
|
1597
1597
|
ployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw Q("Release environment files require a \
|
|
1598
1598
|
finite application deployment command without caller Env.","vibe64_command_release_environment_invalid");let d=t.usageRecordingPreload??
|
|
@@ -1609,7 +1609,7 @@ inheritProcessEnv:!u&&t.inheritProcessEnv!==!1,input:t.input,logPath:x(t.logPath
|
|
|
1609
1609
|
t.maxBuffer))&&Number(t.maxBuffer)>0?Number(t.maxBuffer):DA,mode:n,onOutput:typeof t.onOutput=="function"?t.onOutput:null,
|
|
1610
1610
|
outputEncoding:Fe(t.outputEncoding,xA,"utf8","output_encoding"),project:c,purpose:s,runtimes:a,session:l,signal:t.signal??
|
|
1611
1611
|
null,shimDirs:Na(t.shimDirs),terminal:jA(t.terminal),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>
|
|
1612
|
-
0?Number(t.timeout):15e3,usageRecordingPreload:d,userKey:C(t.userKey)}}var
|
|
1612
|
+
0?Number(t.timeout):15e3,usageRecordingPreload:d,userKey:C(t.userKey)}}var BH=Object.freeze({normalizeExecutionDescriptor:Eh});var qA=null,Th="VIBE64_MANAGED_EXECUTION_REQUIRED";function $a(){return qA}function No(e){return["1","true"].includes(String(e[Th]||"").trim().toLowerCase())}import{realpathSync as Oh,statSync as JA}from"node:fs";import He from"node:path";import{fileURLToPath as KA}from"node:url";
|
|
1613
1613
|
var YA=new URL("./../../../vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href;function XA(e){let t=[
|
|
1614
1614
|
He.resolve(He.dirname(e),"../../../vibe64-usage-recording/runtime/node")];for(let r=He.dirname(e);t.push(He.join(r,"node\
|
|
1615
1615
|
_modules/@local/vibe64-usage-recording/runtime/node")),He.dirname(r)!==r;r=He.dirname(r));return t.flatMap(r=>{try{return[
|
|
@@ -1621,23 +1621,23 @@ aged host.","vibe64_application_account_unavailable",{execution:e.execution}):nu
|
|
|
1621
1621
|
cwd:n,env:o,requiresHelper:i,resolveEnv:s}=t,a=Ah(e);if(a)return a;if(e.usageRecordingPreload){let c=Ih(e.usageRecordingPreload),
|
|
1622
1622
|
l=s;o={...o,NODE_OPTIONS:c},s=u=>({...l(u),NODE_OPTIONS:c})}return e.mode==="pty"?yh(e,{actor:r,cwd:n,env:o,resolveEnv:s}):
|
|
1623
1623
|
e.mode==="detached"?r.requiresRealUser&&(!Dt(r)||i)?V("Detached real-user command execution is unsupported when the help\
|
|
1624
|
-
er is required.","vibe64_command_detached_real_user_unsupported",{execution:e.execution}):
|
|
1624
|
+
er is required.","vibe64_command_detached_real_user_unsupported",{execution:e.execution}):cf(e,{actor:r,cwd:n,env:o}):i?
|
|
1625
1625
|
{...await ca(wo({actor:r,args:e.args,command:e.command,cwd:n,env:o,input:e.input,operation:Rr(e)}),{env:process.env,maxBuffer:e.
|
|
1626
1626
|
maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout}),execution:e.execution}:rt(e.command,e.args,
|
|
1627
1627
|
{cwd:n,env:o,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,onOutput:e.onOutput,outputEncoding:e.outputEncoding,
|
|
1628
1628
|
signal:e.signal,timeout:e.timeout})}async function M(e={}){let t=null;try{if(t=vh(e),t.signal?.aborted)return V("Command\
|
|
1629
|
-
cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await
|
|
1629
|
+
cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await ff(t),n=t.inheritProcessEnv?{...process.env,
|
|
1630
1630
|
...t.baseEnv}:{...t.baseEnv},o=(g={})=>({...g,VIBE64_EXECUTION_ID:t.execution.id}),i=$a(),s=No(n)||No(process.env),a=_o(
|
|
1631
1631
|
r),l=!(!!i||s||la())&&Dt(r)?[n.PATH,process.env.PATH].filter(Boolean).join(":"):"",u=o(await eh({actor:r,baseEnv:n,localPath:l,
|
|
1632
1632
|
request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t})),d=Object.fromEntries([ot,nt,st,it].map(g=>[g,u[g]]));
|
|
1633
|
-
|
|
1634
|
-
args=="function"?t.args(g):t.args,
|
|
1635
|
-
...t,env:t.envFactory(g),envFactory:null}}):u),h=(g=t,S={})=>QA(g,{actor:r,cwd:p,env:u,requiresHelper:a,resolveEnv:
|
|
1636
|
-
if(i)return await i.runCommand(t,{actor:r,baseEnv:n,cwd:p,env:u,resolveArgs:
|
|
1633
|
+
bf(r,u);let p=_h(t.cwd,{allowedRoots:t.allowedRoots,resolveLinks:!t.applicationAccount});gf(r,t,p);let m=(g={})=>typeof t.
|
|
1634
|
+
args=="function"?t.args(g):t.args,f=(g={})=>o(t.envFactory?va({actor:r,baseEnv:n,localPath:l,resolvedGitIdentityEnv:d,request:{
|
|
1635
|
+
...t,env:t.envFactory(g),envFactory:null}}):u),h=(g=t,S={})=>QA(g,{actor:r,cwd:p,env:u,requiresHelper:a,resolveEnv:f,...S});
|
|
1636
|
+
if(i)return await i.runCommand(t,{actor:r,baseEnv:n,cwd:p,env:u,resolveArgs:m,resolveEnv:f,runLocal:h});let _=Ah(t);return _||
|
|
1637
1637
|
(s?V("Managed execution safety is unavailable. Vibe64 did not start this work.","vibe64_managed_execution_provider_unava\
|
|
1638
1638
|
ilable",{execution:t.execution,retryable:!1}):h())}catch(r){return V(r?.message||"Vibe64 command failed.",r?.code||"vibe\
|
|
1639
1639
|
64_command_failed",{execution:t?.execution})}}import{createHash as eR}from"node:crypto";import{lstat as Ch,mkdir as tR,mkdtemp as rR,readdir as nR,rm as xh,statfs as oR}from"node:fs/promises";
|
|
1640
|
-
import ie from"node:path";import{fileURLToPath as iR}from"node:url";var ZA=new URL("./../../../vibe64-execution/src/server/gitTurnCheckpoint.js",import.meta.url).href,sR=3e4;var
|
|
1640
|
+
import ie from"node:path";import{fileURLToPath as iR}from"node:url";var ZA=new URL("./../../../vibe64-execution/src/server/gitTurnCheckpoint.js",import.meta.url).href,sR=3e4;var _V=iR(new URL("./gitTurnCheckpointCommand.js",ZA)),aR=15*6e4,cR=512*1024*1024,lR=1024*1024*1024,kh=new Set(["cancell\
|
|
1641
1641
|
ed","completed","failed","interrupted"]),$o=new Map;async function Dr({outerTurnId:e="",outcome:t="completed",project:r={},
|
|
1642
1642
|
runCommand:n=M,sessionId:o="",temporaryDiskBudgetBytes:i,temporaryDiskReserveBytes:s,timestamp:a="",worktreePath:c=""}={}){
|
|
1643
1643
|
let l=hR({outerTurnId:e,outcome:t,sessionId:o,timestamp:a,worktreePath:c}),u=Ma(l);return $h(l.worktreePath,()=>uR({identity:l,
|
|
@@ -1646,15 +1646,15 @@ let s=await Ft(n,e.worktreePath,["rev-parse","--verify",r.turnRef],{project:t});
|
|
|
1646
1646
|
refs:r,runCommand:n});let a=await te(n,e.worktreePath,["rev-parse","--verify","HEAD"],{project:t}),c=await Nh({baseCommit:a,
|
|
1647
1647
|
project:t,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:e.worktreePath}),l=await Bh(n,
|
|
1648
1648
|
e.worktreePath,{project:t});for(let u=0;;u+=1){let d=await Ft(n,e.worktreePath,["rev-parse","--verify",r.latestRef],{project:t}),
|
|
1649
|
-
p=d||a,
|
|
1649
|
+
p=d||a,m=await te(n,e.worktreePath,["commit-tree",c,"-p",p],{env:gR(e.timestamp),input:Uh(e),project:t});try{await te(n,
|
|
1650
1650
|
e.worktreePath,["update-ref","--stdin"],{input:`start
|
|
1651
|
-
create ${r.turnRef} ${
|
|
1652
|
-
update ${r.latestRef} ${
|
|
1651
|
+
create ${r.turnRef} ${m}
|
|
1652
|
+
update ${r.latestRef} ${m} ${d||l}
|
|
1653
1653
|
prepare
|
|
1654
1654
|
commit
|
|
1655
|
-
`,project:t})}catch(
|
|
1655
|
+
`,project:t})}catch(f){let h=await Ft(n,e.worktreePath,["rev-parse","--verify",r.turnRef],{project:t});if(h)return Ph({commit:h,
|
|
1656
1656
|
identity:e,project:t,refs:r,runCommand:n});let _=await Ft(n,e.worktreePath,["rev-parse","--verify",r.latestRef],{project:t});
|
|
1657
|
-
if(u>=2||_===d)throw
|
|
1657
|
+
if(u>=2||_===d)throw f;continue}return{baseCommit:p,commit:m,created:!0,latestRef:r.latestRef,ok:!0,outerTurnId:e.outerTurnId,
|
|
1658
1658
|
outcome:e.outcome,sessionId:e.sessionId,tree:c,turnRef:r.turnRef}}}async function W({baseCommit:e="HEAD",paths:t=[],project:r={},
|
|
1659
1659
|
runCommand:n=M,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=ie.resolve(lt(s,"work\
|
|
1660
1660
|
treePath"));return $h(a,()=>Nh({baseCommit:e,paths:t,project:r,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,
|
|
@@ -1662,8 +1662,8 @@ worktreePath:a}))}async function Nh({baseCommit:e="HEAD",paths:t=[],project:r={}
|
|
|
1662
1662
|
temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=ie.resolve(lt(s,"worktreePath")),c=await te(n,a,["rev-parse","-\
|
|
1663
1663
|
-absolute-git-dir"],{project:r}),l=ie.join(c,"vibe64-checkpoints");await tR(l,{recursive:!0}),await dR(l);let u=await rR(
|
|
1664
1664
|
ie.join(l,".tree-")),d=ie.join(u,"index");try{let p={GIT_INDEX_FILE:d};await te(n,a,["read-tree",e||"HEAD"],{env:p,project:r});
|
|
1665
|
-
let
|
|
1666
|
-
temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:a}),await te(n,a,["add","-A","--",...
|
|
1665
|
+
let m=Array.isArray(t)?t.map(f=>String(f||"")).filter(Boolean):[];return await pR({gitDirectory:c,paths:m,project:r,runCommand:n,
|
|
1666
|
+
temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:a}),await te(n,a,["add","-A","--",...m.length>0?m:["\
|
|
1667
1667
|
."]],{env:{...p,GIT_LITERAL_PATHSPECS:"1"},project:r}),await te(n,a,["write-tree"],{env:p,project:r})}finally{await xh(u,
|
|
1668
1668
|
{force:!0,recursive:!0})}}async function dR(e=""){let t=Date.now(),r=await nR(e,{withFileTypes:!0});await Promise.all(r.
|
|
1669
1669
|
filter(n=>n.isDirectory()&&n.name.startsWith(".tree-")).map(async n=>{let o=ie.join(e,n.name),i=await Ch(o).catch(()=>null);
|
|
@@ -1675,14 +1675,14 @@ temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=t.length>0?t:["."],[c,l
|
|
|
1675
1675
|
oR(e)]),d=[...new Set([...Rh(c),...Rh(l)])],p=[];for(let b of d){let R=ie.resolve(s,b),T=ie.relative(s,R);if(T===".."||T.
|
|
1676
1676
|
startsWith(`..${ie.sep}`)||ie.isAbsolute(T))throw ut("Git returned a checkpoint candidate outside the session source.","\
|
|
1677
1677
|
vibe64_checkpoint_candidate_invalid");let E=await Ch(R).catch(k=>k?.code==="ENOENT"?null:Promise.reject(k));E?.isFile()&&
|
|
1678
|
-
p.push({bytes:Number(E.size||0),path:T})}let
|
|
1679
|
-
o),_=
|
|
1678
|
+
p.push({bytes:Number(E.size||0),path:T})}let m=p.reduce((b,R)=>b+R.bytes,0),f=Math.min(Number.MAX_SAFE_INTEGER,m*2),h=mR(
|
|
1679
|
+
o),_=fR(i),g=Math.max(0,Number(u.bavail)*Number(u.bsize)),S=Math.min(h,Math.max(0,g-_));if(f<=S)return;let v=p.sort((b,R)=>R.
|
|
1680
1680
|
bytes-b.bytes||b.path.localeCompare(R.path)).slice(0,5).map(b=>`${b.path} (${b.bytes} bytes)`).join(", ");throw ut([`Vib\
|
|
1681
|
-
e64 refused this checkpoint because changed, unignored files may need about ${
|
|
1681
|
+
e64 refused this checkpoint because changed, unignored files may need about ${f} temporary bytes; the safe budget is ${S}\
|
|
1682
1682
|
bytes.`,v?`Largest candidates: ${v}.`:"","Keep needed files in place and add generated or local-only artifacts to .giti\
|
|
1683
1683
|
gnore, or ask an operator to review the checkpoint disk budget."].filter(Boolean).join(" "),"vibe64_checkpoint_disk_budg\
|
|
1684
|
-
et_exceeded")}function Rh(e=""){return String(e||"").split("\0").filter(Boolean)}function
|
|
1685
|
-
VIBE64_CHECKPOINT_TEMPORARY_DISK_BUDGET_BYTES,cR,1)}function
|
|
1684
|
+
et_exceeded")}function Rh(e=""){return String(e||"").split("\0").filter(Boolean)}function mR(e){return Mh(e,process.env.
|
|
1685
|
+
VIBE64_CHECKPOINT_TEMPORARY_DISK_BUDGET_BYTES,cR,1)}function fR(e){return Mh(e,process.env.VIBE64_CHECKPOINT_DISK_RESERVE_BYTES,
|
|
1686
1686
|
lR,0)}function Mh(e,t,r,n){let o=e==null||e===""?t:e,i=Number(o===void 0||o===""?r:o);return Number.isSafeInteger(i)&&i>=
|
|
1687
1687
|
n?i:r}async function Ph({commit:e="",identity:t={},project:r={},refs:n={},runCommand:o=M}={}){let i=await te(o,t.worktreePath,
|
|
1688
1688
|
["show","-s","--format=%B",e],{project:r}),s=[...kh].find(l=>i===Uh({...t,outcome:l}).trim());if(!s)throw ut("Existing V\
|
|
@@ -1709,8 +1709,8 @@ return e({actor:"daemon",allowedRoots:[t],args:r,command:"git",cwd:t,env:o,envPo
|
|
|
1709
1709
|
mode:"capture",project:s,purpose:"source",runtimes:["git"],timeout:sR})}function lt(e="",t="value"){let r=String(e||"").
|
|
1710
1710
|
trim(),n=Array.from(r).some(o=>{let i=o.codePointAt(0);return i<=31||i===127});if(!r||r.length>512||n)throw ut(`Vibe64 t\
|
|
1711
1711
|
urn checkpoint ${t} is invalid.`,`vibe64_checkpoint_${t.replaceAll(/[^A-Za-z0-9]+/gu,"_").toLowerCase()}_invalid`);return r}
|
|
1712
|
-
function ut(e="",t="vibe64_checkpoint_failed"){let r=new Error(e||"Vibe64 turn checkpoint failed.");return r.code=t,r}var
|
|
1713
|
-
|
|
1712
|
+
function ut(e="",t="vibe64_checkpoint_failed"){let r=new Error(e||"Vibe64 turn checkpoint failed.");return r.code=t,r}var vV=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"]);import{existsSync as bR}from"node:fs";import Mo from"node:path";import Gh from"node:process";var Fh="You'll be asked for your computer password. Nothing shows while you type.",yR="curl -fsSL https://mise.run | sh",
|
|
1713
|
+
CV=Object.freeze({linux:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-linux.md",darwin:"\
|
|
1714
1714
|
https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),Do=Object.freeze({claude:{
|
|
1715
1715
|
name:"Claude Code",run:[["claude"]],guideUrl:"https://code.claude.com/docs/en/setup",any:"curl -fsSL https://claude.ai/i\
|
|
1716
1716
|
nstall.sh | bash"},codex:{name:"Codex",run:[["codex"]],guideUrl:"https://github.com/openai/codex",any:"curl -fsSL https:\
|
|
@@ -1742,7 +1742,7 @@ r,"apt-get")))}function Lo({env:e,platform:t=Gh.platform,systemPath:r}){return H
|
|
|
1742
1742
|
r)})}function Uo(e="",t={}){let{family:r="",mise:n=!1,xcode:o=!0}=t,i=Do[Da(e)];if(!i)return null;if(r==="brew"&&!o&&["g\
|
|
1743
1743
|
it","cpp"].includes(Da(e)))return{command:"xcode-select --install",sudo:!1,note:""};let s=i.any||i[r]||"";if(!s&&i.mise&&
|
|
1744
1744
|
(s=n?`mise use -g ${i.mise}`:`${yR} && ~/.local/bin/mise use -g ${i.mise}`),!s)return null;let a=s.startsWith("sudo ")||
|
|
1745
|
-
r==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?Fh:""}}var
|
|
1745
|
+
r==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?Fh:""}}var xV=Object.freeze({SUDO_NOTE:Fh,localToolFamily:Hh});function Vh({env:e,platform:t,systemPath:r}){return Uo("git",{family:Lo({env:e,platform:t,systemPath:r})})?.command||""}
|
|
1746
1746
|
function SR(e={}){return[e.error,e.stderr,e.output].filter(Boolean).join(`
|
|
1747
1747
|
`)}function ER(e,t){let r=SR(e);if(/spawn(?:Sync)? git ENOENT|(?:^|\s)git: (?:command )?not found/mu.test(r)){let n=Vh(t);
|
|
1748
1748
|
return{code:"vibe64_git_missing",installCommand:n,message:n?`Git isn't installed on this computer. Install it with: ${n}`:
|
|
@@ -1751,7 +1751,7 @@ return{code:"vibe64_git_missing",installCommand:n,message:n?`Git isn't installed
|
|
|
1751
1751
|
ewer, then try again."}:/gpg failed to sign|failed to sign the data|signing failed|couldn't (?:load|find) (?:public )?key|incorrect passphrase/iu.
|
|
1752
1752
|
test(r)?{code:"vibe64_git_signing_failed",installCommand:"",message:"Your Git is set to sign every commit, and signing d\
|
|
1753
1753
|
idn't work here. Vibe64 can't type a key passphrase for you. Make one signed commit in a terminal to check your key work\
|
|
1754
|
-
s and is unlocked, then try again."}:null}var
|
|
1754
|
+
s and is unlocked, then try again."}:null}var $V=Object.freeze({describeGitFailure:ER});import zh from"node:path";var Wh="backups.git",qh="vibe64-atomic",TR=`backup_canonical_ref() {
|
|
1755
1755
|
vibe64_backup_repository="$1"
|
|
1756
1756
|
vibe64_source_repository="$2"
|
|
1757
1757
|
vibe64_source_ref="$3"
|
|
@@ -1769,7 +1769,7 @@ r "$vibe64_backup_repository" rev-parse --verify "$vibe64_backup_ref"
|
|
|
1769
1769
|
' "$vibe64_source_ref" >&2
|
|
1770
1770
|
return 1
|
|
1771
1771
|
fi
|
|
1772
|
-
}`,
|
|
1772
|
+
}`,BV=`#!/bin/sh
|
|
1773
1773
|
set -eu
|
|
1774
1774
|
|
|
1775
1775
|
zero_object=0000000000000000000000000000000000000000
|
|
@@ -1931,8 +1931,8 @@ case "$remote_head_ref" in
|
|
|
1931
1931
|
esac
|
|
1932
1932
|
printf '[studio] Refreshed GitHub mirror for %s.
|
|
1933
1933
|
' "$remote_url"
|
|
1934
|
-
`;function OR(e=""){return e?zh.join(zh.dirname(e),Wh):""}function La({mirrorPath:e="",remoteUrl:t=""}={}){return["bash","-c",Yh,"vibe64-github-mirror-refresh",e,t]}var
|
|
1935
|
-
freeze({CANONICAL_REPOSITORY_PUSH_OPTION:qh,canonicalRepositoryBackupPath:OR});var
|
|
1934
|
+
`;function OR(e=""){return e?zh.join(zh.dirname(e),Wh):""}function La({mirrorPath:e="",remoteUrl:t=""}={}){return["bash","-c",Yh,"vibe64-github-mirror-refresh",e,t]}var jV=Object.
|
|
1935
|
+
freeze({CANONICAL_REPOSITORY_PUSH_OPTION:qh,canonicalRepositoryBackupPath:OR});var XV=new URL("./../../../vibe64-execution/src/server/runtime/agentPreviewBrowserWorkerSource.js",import.meta.url).href;var AR=["Usage:"," vibe64-helper preview ensure [--target <target-id>] [--wait] [--json] [--timeout-ms <ms>]"," vibe64\
|
|
1936
1936
|
-helper preview targets [--json]"," vibe64-helper preview status [--json]"," vibe64-helper preview stop [--json]"," v\
|
|
1937
1937
|
ibe64-helper preview inspect-url"," vibe64-helper preview screenshot [--output <path>]"," vibe64-helper preview browse\
|
|
1938
1938
|
r ensure"," vibe64-helper preview browser eval < playwright-code.js"," vibe64-helper preview browser identity <default\
|
|
@@ -1969,12 +1969,12 @@ empty or unchanged logs between brief waits.","This is the canonical preview ser
|
|
|
1969
1969
|
on.","Do not start a duplicate copy of that application on another port.","A distinct secondary application explicitly r\
|
|
1970
1970
|
equested by the user, such as a reference app, may run separately without replacing this preview."].join(`
|
|
1971
1971
|
`)+`
|
|
1972
|
-
`;import{fileURLToPath as kR}from"node:url";var xR=new URL("./../../../vibe64-execution/src/server/conversationExecution.js",import.meta.url).href,
|
|
1973
|
-
engines/stdioBridge.js",xR));var
|
|
1972
|
+
`;import{fileURLToPath as kR}from"node:url";var xR=new URL("./../../../vibe64-execution/src/server/conversationExecution.js",import.meta.url).href,cz=kR(new URL("./\
|
|
1973
|
+
engines/stdioBridge.js",xR));var fz=["skip=$1; version=$2; shift 2",'for name in "$@"; do',' found=$(command -v -- "$name" 2>/dev/null) || continue',
|
|
1974
1974
|
" case $found in /*) ;; *) continue ;; esac",' if [ -n "$skip" ]; then case $found in /usr/bin/*) continue ;; esac; fi',
|
|
1975
1975
|
` printf '%s\\n' "$found"`,' exec "$found" $version 2>&1',"done","exit 127"].join(`
|
|
1976
1976
|
`);var NR=Object.freeze(Object.fromEntries(["claude","codex","opencode"].map(e=>{let{name:t,guideUrl:r,any:n}=Do[e];return[
|
|
1977
|
-
e,Object.freeze({name:t,guideUrl:r,install:n})]})));import{execFile as $R}from"node:child_process";import{promisify as MR}from"node:util";var
|
|
1977
|
+
e,Object.freeze({name:t,guideUrl:r,install:n})]})));import{execFile as $R}from"node:child_process";import{promisify as MR}from"node:util";var Sz=MR($R);import vg from"node:crypto";function Lr(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Jh(e,t={}){let{missingStatus:r=404}=t,n=e?.errors?.[0]?.code||e?.code||"";return n==="vibe64_session_not_found"?
|
|
1978
1978
|
r:n.startsWith("vibe64_invalid")?400:n==="vibe64_command_requires_terminal"||n==="vibe64_agent_write_mode_busy"||n==="vi\
|
|
1979
1979
|
be64_agent_attachment_session_unavailable"||n==="vibe64_project_not_selected"||n==="vibe64_project_not_ready"||n==="vibe\
|
|
1980
1980
|
64_project_source_lock_timeout"||n==="vibe64_development_database_scope_busy"||n==="vibe64_project_session_policy_lock_t\
|
|
@@ -2012,7 +2012,7 @@ includes(e)&&!e.startsWith("-")&&!e.endsWith(".")&&!/[\s~^:?*[\\]/u.test(e)&&!e.
|
|
|
2012
2012
|
some(t=>t.charCodeAt(0)<32||t.charCodeAt(0)===127)&&e.split("/").every(t=>t&&!t.startsWith(".")&&!t.endsWith(".lock"))}function Qh(e={},t={}){
|
|
2013
2013
|
let r=Ba(e,t),n=Br(r.repositoryMode||r.repository?.mode),o=r.slug||r.projectSlug,i=r.repository?.defaultBranch;return n===
|
|
2014
2014
|
q?o=r.githubRepository?.fullName||r.repository?.github?.fullName:n===Y&&(o=r.sourceRoot,i=t.metadata?.local_source_branch||
|
|
2015
|
-
i),{sessionId:Te(t.sessionId),mode:n,repository:Te(o),branch:Te(i)}}import dg from"node:crypto";import{mkdtemp as pg,rm as
|
|
2015
|
+
i),{sessionId:Te(t.sessionId),mode:n,repository:Te(o),branch:Te(i)}}import dg from"node:crypto";import{mkdtemp as pg,rm as mg}from"node:fs/promises";import qt from"node:path";import{fileURLToPath as FR}from"node:url";import Zh from"node:path";var tg="%H%x00%P%x00%an%x00%ae%x00%aI%x00%s",ja=200,rg=500,Bo=800,UR=5e3;function ng(e=""){let t=String(e||"").split("\0"),
|
|
2016
2016
|
r=[];for(let n=0;n+5<t.length;n+=6){let o=y(t[n]);if(!o)continue;let i=y(t[n+1]).split(/\s+/u).filter(Boolean);r.push({author:y(
|
|
2017
2017
|
t[n+2]),authorEmail:y(t[n+3]),committedAt:y(t[n+4]),commit:o,isMerge:i.length>1,message:y(t[n+5]),parents:i,shortCommit:o.
|
|
2018
2018
|
slice(0,8)})}return r}function og(e,t,r){let n=Number.parseInt(String(e??""),10);return Number.isSafeInteger(n)&&n>0?Math.
|
|
@@ -2041,13 +2041,13 @@ sessionId},project:{...l.project||{},...s?{slug:s}:{}},session:{...l.session||{}
|
|
|
2041
2041
|
()=>{},()=>{}),u};return Object.defineProperty(c,lg,{value:!0}),c}async function jo(e,t,r,n,o={}){let{additionalAllowedRoots:i=[],
|
|
2042
2042
|
commandOptions:s={},cwd:a=t.worktreePath,env:c={},input:l,project:u={}}=o,d=[t.worktreePath,jr.dirname(t.worktreePath),...t.
|
|
2043
2043
|
mode===Y?[t.standaloneSourceRoot,jr.dirname(t.standaloneSourceRoot)]:[],...jr.isAbsolute(t.remoteUrl)?[t.remoteUrl,jr.dirname(
|
|
2044
|
-
t.remoteUrl)]:[],...i.flatMap(p=>{let
|
|
2044
|
+
t.remoteUrl)]:[],...i.flatMap(p=>{let m=y(p);return m?[m,jr.dirname(m)]:[]})];return e({actor:"daemon",allowedRoots:d,args:n,
|
|
2045
2045
|
command:r,cwd:a,env:c,envPolicy:"session",gitSafeDirectories:d,input:l,mode:"capture",project:B(t,u),purpose:s.gitTransport?.
|
|
2046
2046
|
startsWith("github")?"github":"source",runtimes:s.gitTransport==="github-https"?["git","gh"]:["git"],timeout:Ha,...s})}async function A(e,t,r,n={}){
|
|
2047
2047
|
let{required:o=!0,...i}=n,s=await jo(e,t,"git",r,i);if(o&&s?.ok!==!0)throw w(y(s?.stderr||s?.stdout||s?.output||s?.error)||
|
|
2048
2048
|
"Git Save command failed.",y(s?.code)||"vibe64_session_save_git_failed",{gitArgs:r},{status:500});return s}function zt(e={}){
|
|
2049
2049
|
return y(e.stdout||e.output)}async function O(e,t,r,n={}){return zt(await A(e,t,r,n))}async function Wt(e,t,r,n={}){let o=await A(
|
|
2050
|
-
e,t,r,{...n,required:!1});return o?.ok===!0?zt(o):""}var GR=new URL("./sessionWorkGit.js",import.meta.url).href,
|
|
2050
|
+
e,t,r,{...n,required:!1});return o?.ok===!0?zt(o):""}var GR=new URL("./sessionWorkGit.js",import.meta.url).href,VW=FR(new URL("./sessionWorkOperationCommand.js",GR)),HR=/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u,
|
|
2051
2051
|
ug=1e5;function se(e=""){return HR.test(String(e??""))}function Va(e=""){return{content:e.slice(0,ug),truncated:e.length>
|
|
2052
2052
|
ug}}function Yt(e=[]){return[...new Set((Array.isArray(e)?e:[]).map(y).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}
|
|
2053
2053
|
function VR(e={}){return e.metadata&&typeof e.metadata=="object"?e.metadata:{}}function U(e={},t={}){t=Ba(t,e);let r=VR(
|
|
@@ -2081,9 +2081,9 @@ checkpointTree:o,commandOptions:i,project:s,virtualCommit:a="",explicitBase:c=!1
|
|
|
2081
2081
|
message:"Vibe64 session rebase input",project:s,tree:o}),u=await A(e,t,["merge-tree","--write-tree",...c?[`--merge-base=${r}`]:
|
|
2082
2082
|
[],"--messages","--name-only","-z",n,l],{commandOptions:i,project:s,required:!1}),d=String(u?.stdout||u?.output||"").split(
|
|
2083
2083
|
"\0"),p=y(d.shift());if(!se(p))throw w(u?.ok===!0?"Git did not produce a valid rebased tree.":"Vibe64 could not prepare \
|
|
2084
|
-
the conflicting files for review.","vibe64_session_update_merge_invalid");if(u?.ok!==!0){let
|
|
2085
|
-
shift();if(!
|
|
2086
|
-
version.","vibe64_session_update_merge_invalid");return{conflictPaths:[...new Set(
|
|
2084
|
+
the conflicting files for review.","vibe64_session_update_merge_invalid");if(u?.ok!==!0){let m=[];for(;d.length>0;){let f=d.
|
|
2085
|
+
shift();if(!f)break;m.push(f)}if(!m.length)throw w("Vibe64 could not identify which files conflict with the latest saved\
|
|
2086
|
+
version.","vibe64_session_update_merge_invalid");return{conflictPaths:[...new Set(m)].sort((f,h)=>f.localeCompare(h)),conflictTree:p,
|
|
2087
2087
|
mergedTree:"",virtualCommit:l}}return{conflictPaths:[],conflictTree:"",mergedTree:p,virtualCommit:l}}function Vo(e,t,{conflictTree:r,
|
|
2088
2088
|
conflictPaths:n,project:o}){return W({baseCommit:r,paths:n,project:B(t,o),runCommand:e,worktreePath:t.worktreePath})}async function Zt(e,t,{
|
|
2089
2089
|
baseCommit:r,commandOptions:n,message:o,project:i,tree:s}){return O(e,t,["commit-tree",s,"-p",r],{commandOptions:n,input:`${y(
|
|
@@ -2091,18 +2091,18 @@ o)||"Vibe64 virtual commit"}
|
|
|
2091
2091
|
`,project:i})}async function er(e,t,{commandOptions:r,derivedArtifactPaths:n=[],project:o,sourceCommit:i,tree:s}){let a=Yt(
|
|
2092
2092
|
n);if(!a.length)return s;let c=await pg(qt.join(qt.dirname(t.worktreePath),".vibe64-derived-index-")),u={GIT_INDEX_FILE:qt.
|
|
2093
2093
|
join(c,"index")},d={additionalAllowedRoots:[c],commandOptions:r,env:u,project:o};try{await A(e,t,["read-tree",s],d);for(let p of a){
|
|
2094
|
-
let
|
|
2095
|
-
exec(String(
|
|
2096
|
-
pdate-index","--force-remove","--",p],{...d,required:!1})}return await O(e,t,["write-tree"],d)}finally{await
|
|
2094
|
+
let m=await A(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.
|
|
2095
|
+
exec(String(m.stdout||""));f&&f[3]===p?await A(e,t,["update-index","--add","--cacheinfo",f[1],f[2],p],d):await A(e,t,["u\
|
|
2096
|
+
pdate-index","--force-remove","--",p],{...d,required:!1})}return await O(e,t,["write-tree"],d)}finally{await mg(c,{force:!0,
|
|
2097
2097
|
recursive:!0})}}async function pt(e,t,{baseCommit:r,commandOptions:n,derivedArtifactPaths:o=[],project:i,refreshDerivedArtifacts:s,
|
|
2098
2098
|
tree:a}){if(!Yt(o).length)return a;let l=await Zt(e,t,{baseCommit:r,commandOptions:n,message:"Vibe64 derived artifact in\
|
|
2099
2099
|
put",project:i,tree:a}),u=await pg(qt.join(qt.dirname(t.worktreePath),".vibe64-derived-worktree-")),d=qt.join(u,"source"),
|
|
2100
|
-
p={additionalAllowedRoots:[u,d],commandOptions:n,project:i},
|
|
2101
|
-
p),
|
|
2102
|
-
e,t,["worktree","remove","--force",d],{...p,required:!1}),await
|
|
2103
|
-
rune"],{commandOptions:n,project:i,required:!1})}}import yg from"node:crypto";var Wa="warn";var zR=Object.freeze(["fatal","error","warn","info","debug","trace","silent"]),
|
|
2104
|
-
warn:40,error:50,fatal:60,silent:1/0});function hg(e="",t=Wa){let r=String(e||"").trim().toLowerCase();return zR.includes(r)?r:t}function WR(e="info",t=Wa){let r=hg(e,""),n=hg(t,Wa);return!r||n==="silent"?!1:
|
|
2105
|
-
return e==="behind"||e==="diverged"?"rebase":"none"}import
|
|
2100
|
+
p={additionalAllowedRoots:[u,d],commandOptions:n,project:i},m=!1;try{return await A(e,t,["worktree","add","--detach",d,l],
|
|
2101
|
+
p),m=!0,await s({projectRoot:d}),await W({baseCommit:"HEAD",project:B(t,i),runCommand:e,worktreePath:d})}finally{m&&await A(
|
|
2102
|
+
e,t,["worktree","remove","--force",d],{...p,required:!1}),await mg(u,{force:!0,recursive:!0}),await A(e,t,["worktree","p\
|
|
2103
|
+
rune"],{commandOptions:n,project:i,required:!1})}}import yg from"node:crypto";var Wa="warn";var zR=Object.freeze(["fatal","error","warn","info","debug","trace","silent"]),fg=Object.freeze({trace:10,debug:20,info:30,
|
|
2104
|
+
warn:40,error:50,fatal:60,silent:1/0});function hg(e="",t=Wa){let r=String(e||"").trim().toLowerCase();return zR.includes(r)?r:t}function WR(e="info",t=Wa){let r=hg(e,""),n=hg(t,Wa);return!r||n==="silent"?!1:fg[r]>=fg[n]}var qW=Object.freeze({isVibe64LogLevelEnabled:WR});function gg(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=0?t:0}function Gr(e=0,t=0){let r=gg(e),n=gg(t);return r>0&&n>0?"diverged":n>0?"behind":r>0?"ahead":"current"}function Fr(e=""){
|
|
2105
|
+
return e==="behind"||e==="diverged"?"rebase":"none"}import JR from"node:crypto";import KR from"node:path";async function XR(e,t,r,n){await A(e,t,["remote","set-url","origin",t.remoteUrl],n);let o=null,i="";if(t.contribution){let c=await tr(
|
|
2106
2106
|
e,t,n,!0);if(o={discarded:c.discarded,missingPublished:!1,publishedCommit:c.head,remoteAbsent:!c.head},o.remoteAbsent){let l=await Wt(
|
|
2107
2107
|
e,t,["rev-parse","--verify",`${Fo(t)}^{commit}`],n);if((await O(e,t,["for-each-ref","--format=%(refname)","refs/vibe64/s\
|
|
2108
2108
|
ave/"],n)).split(`
|
|
@@ -2132,7 +2132,7 @@ _mismatch");if(await O(e,t,["status","--porcelain","--untracked-files=all"],{...
|
|
|
2132
2132
|
The local project baseline has unsaved work. Save cannot overwrite it.","vibe64_session_save_local_authority_dirty");for(let i of[
|
|
2133
2133
|
"MERGE_HEAD","CHERRY_PICK_HEAD","REVERT_HEAD","REBASE_HEAD"])if((await A(e,t,["rev-parse","--verify","-q",i],{...r,cwd:t.
|
|
2134
2134
|
standaloneSourceRoot,required:!1}))?.ok===!0)throw w("The local project baseline has an unfinished Git operation.","vibe\
|
|
2135
|
-
64_session_save_local_operation_in_progress");return O(e,t,["rev-parse","--verify","HEAD"],{...r,cwd:t.standaloneSourceRoot})}async function rr(e,t,r,n){if(t.mode!==Y)return
|
|
2135
|
+
64_session_save_local_operation_in_progress");return O(e,t,["rev-parse","--verify","HEAD"],{...r,cwd:t.standaloneSourceRoot})}async function rr(e,t,r,n){if(t.mode!==Y)return XR(e,t,r,n);let o=await qa(e,t,n),i=Ve(t,r,"canonical");try{await A(e,t,
|
|
2136
2136
|
["fetch","--no-tags",t.standaloneSourceRoot,`+refs/heads/${t.branch}:${i}`],n);let s=await O(e,t,["rev-parse","--verify",
|
|
2137
2137
|
i],n);if(s!==o)throw w("The local project baseline changed while Vibe64 was reading it.","vibe64_session_save_authority_\
|
|
2138
2138
|
changed_during_read");return xe(e,t,s,n).then(a=>({canonicalBranch:"",commit:a,contribution:null}))}finally{await Ce(e,t,
|
|
@@ -2140,16 +2140,16 @@ i,n)}}async function Hr(e,t,r){if(t.connectedSubmissions.length){if(await O(e,t,
|
|
|
2140
2140
|
r)!=="false")throw w("Connected integration requires complete Git history. Prepare a full checkout before saving.","vibe\
|
|
2141
2141
|
64_connected_integration_history_incomplete");for(let{contribution:n,submittedCommit:o}of t.connectedSubmissions){let{repository:i,
|
|
2142
2142
|
integrationBranch:s,id:a}=n,c=`https://github.com/${i}.git`,l=`refs/heads/${s}`,u=`refs/heads/vibe64-incoming/${a}`,d=`${u}\
|
|
2143
|
-
_discarded`,p={repository:i,integrationBranch:s,id:a,submittedCommit:o},
|
|
2144
|
-
c,l,u,d],r),h=new Map;for(let S of
|
|
2143
|
+
_discarded`,p={repository:i,integrationBranch:s,id:a,submittedCommit:o},m=[];try{let f=await O(e,t,["ls-remote","--heads",
|
|
2144
|
+
c,l,u,d],r),h=new Map;for(let S of f.split(`
|
|
2145
2145
|
`).filter(Boolean)){let[v,b]=S.split(/\s+/u);if(![l,u,d].includes(b)||h.has(b)||!se(v))throw w("The receiving repository\
|
|
2146
2146
|
returned invalid ref evidence.","vibe64_session_save_receiving_refs_invalid");h.set(b,v)}if(!h.has(l))throw w("The rece\
|
|
2147
2147
|
iving integration branch is unavailable.","vibe64_session_save_receiving_target_missing");if(h.has(u)&&h.has(d))throw w(
|
|
2148
2148
|
`${i} has an interrupted discard. Resolve it in Incoming changes before saving this project.`,"vibe64_connected_integrat\
|
|
2149
|
-
ion_unresolved",p);for(let[S,v]of h)
|
|
2150
|
-
e,t,["fetch","--no-tags","--no-write-fetch-head",c,...
|
|
2149
|
+
ion_unresolved",p);for(let[S,v]of h)m.push({remote:S,head:v,local:Ve(t,JR.randomUUID(),"connected-integration")});if(await A(
|
|
2150
|
+
e,t,["fetch","--no-tags","--no-write-fetch-head",c,...m.map(S=>`+${S.remote}:${S.local}`)],r),await O(e,t,["rev-parse","\
|
|
2151
2151
|
--is-shallow-repository"],r)!=="false")throw w("The receiving history is incomplete.","vibe64_session_save_receiving_his\
|
|
2152
|
-
tory_incomplete");for(let S of
|
|
2152
|
+
tory_incomplete");for(let S of m)if(await O(e,t,["rev-parse","--verify",`${S.local}^{commit}`],r)!==S.head)throw w("The \
|
|
2153
2153
|
receiving branches changed during the integration check. Retry Save.","vibe64_session_save_receiving_refs_changed");let _=await O(
|
|
2154
2154
|
e,t,["rev-list","--count",`${h.get(l)}..${o}`],r);if(!/^\d+$/u.test(_))throw w("The required revision's ancestry is unkn\
|
|
2155
2155
|
own.","vibe64_session_save_revision_ancestry_unknown");if(_!=="0"){let S=h.has(d);throw w(`${i} has ${S?"discarded":"not\
|
|
@@ -2157,12 +2157,12 @@ own.","vibe64_session_save_revision_ancestry_unknown");if(_!=="0"){let S=h.has(d
|
|
|
2157
2157
|
4_connected_integration_discarded":"vibe64_connected_integration_pending",p)}let g=(r.connectedWorkSnapshots||[]).find(S=>S.
|
|
2158
2158
|
contribution.repository===i&&S.contribution.integrationBranch===s);if(!g||!await H(e,t,h.get(l),g.sessionHead,r))throw w(
|
|
2159
2159
|
`Update the connected session for ${i} to incorporate its accepted ${s} source before saving this project.`,"vibe64_conn\
|
|
2160
|
-
ected_integration_source_update_required",p)}catch(
|
|
2160
|
+
ected_integration_source_update_required",p)}catch(f){throw f.code?.startsWith("vibe64_connected_integration_")?f:w(`Cou\
|
|
2161
2161
|
ld not verify contribution ${a} in ${i}/${s}. Check repository access and complete history, then retry Save.`,"vibe64_co\
|
|
2162
|
-
nnected_integration_unknown",p)}finally{for(let
|
|
2162
|
+
nnected_integration_unknown",p)}finally{for(let f of m)await Ce(e,t,f.local,r)}}}}function Ya(e=[]){if(!Array.isArray(e))
|
|
2163
2163
|
throw w("Connected source snapshots are unavailable.","vibe64_connected_source_snapshots_invalid");return e.map(t=>{let r=Vt(
|
|
2164
2164
|
{metadata:{connected_contribution:JSON.stringify(t?.contribution)}});if(!r||typeof t.sessionId!="string"||!y(t.sessionId)||
|
|
2165
|
-
!
|
|
2165
|
+
!KR.isAbsolute(y(t.worktreePath))||[t.baseCommit,t.canonicalCommit,t.sessionHead,t.worktreeTree].some(n=>!se(y(n))))throw w(
|
|
2166
2166
|
"The connected source could not be captured. Inspect connected work before saving.","vibe64_connected_source_unavailable");
|
|
2167
2167
|
return{contribution:r,sessionId:t.sessionId,worktreePath:y(t.worktreePath),baseCommit:t.baseCommit,canonicalCommit:t.canonicalCommit,
|
|
2168
2168
|
sessionHead:t.sessionHead,worktreeTree:t.worktreeTree}})}async function zo(e,t,r){for(let n of t){let{contribution:o}=n,
|
|
@@ -2174,17 +2174,17 @@ mmit}"],r),Kt(e,i,r)]);if(s!==n.worktreeTree||a!==n.sessionHead||c!==n.canonical
|
|
|
2174
2174
|
changed during Save. Inspect and save it before retrying Main Save.`,"vibe64_connected_save_required",{repository:o.repository,
|
|
2175
2175
|
sessionId:o.id})}catch(s){throw s.code==="vibe64_connected_save_required"?s:w(`Connected work in ${o.repository} could n\
|
|
2176
2176
|
ot be rechecked. Restore source access and retry Save.`,"vibe64_connected_source_recheck_failed",{repository:o.repository,
|
|
2177
|
-
sessionId:o.id})}}}function nr(){}var Ja=5;async function
|
|
2177
|
+
sessionId:o.id})}}}function nr(){}var Ja=5;async function QR(e,t,r,n,o={}){let i=await A(e,t,["log","--topo-order",`--max-count=${Ja+1}`,"-z",`--format=${tg}`,
|
|
2178
2178
|
`${r}..${n}`],o),s=ng(String(i.stdout||i.output||""));return{incomingVersions:s.slice(0,Ja),incomingVersionsTruncated:s.
|
|
2179
|
-
length>Ja}}function
|
|
2179
|
+
length>Ja}}function ZR(e={}){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=Array.isArray(e.conflictPaths)?
|
|
2180
2180
|
[...new Set(e.conflictPaths.map(String).filter(Boolean))].sort((n,o)=>n.localeCompare(o)):[],r={baseCommit:y(e.baseCommit),
|
|
2181
2181
|
canonicalCommit:y(e.canonicalCommit),checkpointTree:y(e.checkpointTree),conflictPaths:t,conflictTree:y(e.conflictTree),reviewId:y(
|
|
2182
2182
|
e.reviewId),oldHead:y(e.oldHead),oldIndexTree:y(e.oldIndexTree)};return Object.values(r).some(n=>Array.isArray(n)?n.length===
|
|
2183
|
-
0:!n)?null:r}function
|
|
2183
|
+
0:!n)?null:r}function eP(e=[]){let t=e.length,r=e.slice(0,3).join(", "),n=t>3?` and ${t-3} more`:"";return`${t} ${t===1?
|
|
2184
2184
|
"file needs":"files need"} review before this session can update: ${r}${n}. Resolve ${t===1?"it":"them"} manually or wit\
|
|
2185
2185
|
h AI, then use Review resolved conflicts to apply Update. Fix it with AI can help with the repair.`}function bg(e){return w(
|
|
2186
|
-
|
|
2187
|
-
currentRecovery:r,previousRecovery:n,reviewedConflictId:o,project:i}){let s=o?
|
|
2186
|
+
eP(e.conflictPaths),"vibe64_session_update_conflict",{conflictPaths:e.conflictPaths,conflictRecovery:e})}async function tP(e,t,{
|
|
2187
|
+
currentRecovery:r,previousRecovery:n,reviewedConflictId:o,project:i}){let s=o?ZR(n):null;if(!s)throw bg(r);let a=new Set(
|
|
2188
2188
|
s.conflictPaths);if(!(["baseCommit","canonicalCommit","oldHead","oldIndexTree"].every(l=>s[l]===r[l])&&r.conflictPaths.every(
|
|
2189
2189
|
l=>a.has(l)))||o!==s.reviewId)throw bg(r);return Vo(e,t,{...r,project:i})}async function wg({commandOptions:e={},operationId:t=yg.
|
|
2190
2190
|
randomUUID(),project:r={},runCommand:n=M,session:o={}}={}){let i=U(o,r);n=J(n,i,r,{label:"Checking repository for update\
|
|
@@ -2193,43 +2193,43 @@ s",operationId:t}),await Qt(n,i,{commandOptions:e,project:r});let s=await rr(n,i
|
|
|
2193
2193
|
D",project:B(i,r),runCommand:n,worktreePath:i.worktreePath})]),u=await dt(n,i,a,c,{commandOptions:e,project:r});if(u&&i.
|
|
2194
2194
|
mode!==Y)throw w("The saved project history no longer descends from this session's starting version.","vibe64_session_up\
|
|
2195
2195
|
date_history_diverged");let d=u?{baseCommit:i.baseCommit,canonicalCommit:a,sessionHead:c,worktreeTree:l,changedPaths:(await za(
|
|
2196
|
-
n,i,i.baseCommit,l,{commandOptions:e,project:r})).slice(0,100)}:null,[p,f,
|
|
2196
|
+
n,i,i.baseCommit,l,{commandOptions:e,project:r})).slice(0,100)}:null,[p,m,f,h]=await Promise.all([Jt(n,i,a,c,{commandOptions:e,
|
|
2197
2197
|
project:r}),Jt(n,i,c,a,{commandOptions:e,project:r}),H(n,i,a,c,{commandOptions:e,project:r}),Ee(n,i,a,{commandOptions:e,
|
|
2198
|
-
project:r})]),_=Gr(p,
|
|
2199
|
-
return{ahead:p,baseCommit:i.baseCommit,behind:
|
|
2198
|
+
project:r})]),_=Gr(p,m),g=m>0?await QR(n,i,c,a,{commandOptions:e,project:r}):{incomingVersions:[],incomingVersionsTruncated:!1};
|
|
2199
|
+
return{ahead:p,baseCommit:i.baseCommit,behind:m,canonicalCommit:a,canonicalSource:{authority:i.mode,commit:a,ref:`refs/h\
|
|
2200
2200
|
eads/${s.canonicalBranch||i.branch}`,...i.mode===Y?{}:{repository:i.remoteUrl}},...g,ok:!0,operationId:t,reconciled:!u&&
|
|
2201
|
-
|
|
2202
|
-
h,updateAvailable:u||!
|
|
2201
|
+
f,...d?{historyReview:d}:{},repositoryMode:i.mode,relationship:_,sessionCurrent:f,sessionHead:c,sessionMatchesCanonical:l===
|
|
2202
|
+
h,updateAvailable:u||!f,updateStrategy:Fr(_)}}async function rP(e,t,{canonicalCommit:r,checkpointCommit:n,checkpointTree:o,commandOptions:i,mergedCommit:s,mergedTree:a,
|
|
2203
2203
|
oldHead:c,oldIndexTree:l,project:u}){if(await W({baseCommit:"HEAD",project:B(t,u),runCommand:e,worktreePath:t.worktreePath})!==
|
|
2204
2204
|
o)throw w("This session changed while its update was being prepared. Retry when the assistant is idle.","vibe64_session_\
|
|
2205
2205
|
update_worktree_changed");try{await A(e,t,["read-tree","--reset","-u",s],{commandOptions:i,project:u}),await A(e,t,["upd\
|
|
2206
2206
|
ate-ref","HEAD",r,c],{commandOptions:i,project:u}),await A(e,t,["read-tree",r],{commandOptions:i,project:u});let p=await W(
|
|
2207
2207
|
{baseCommit:"HEAD",project:B(t,u),runCommand:e,worktreePath:t.worktreePath});if(p!==a)throw w("The updated session did n\
|
|
2208
2208
|
ot match the prepared merged work.","vibe64_session_update_verification_failed");return await xe(e,t,r,{commandOptions:i,
|
|
2209
|
-
project:u}),{currentTree:p,reconciled:!0,status:"updated"}}catch(p){let
|
|
2210
|
-
project:u}).catch(()=>"");throw await A(e,t,["read-tree","--reset","-u",n],{commandOptions:i,project:u,required:!1}),
|
|
2211
|
-
|
|
2209
|
+
project:u}),{currentTree:p,reconciled:!0,status:"updated"}}catch(p){let m=await O(e,t,["rev-parse","HEAD"],{commandOptions:i,
|
|
2210
|
+
project:u}).catch(()=>"");throw await A(e,t,["read-tree","--reset","-u",n],{commandOptions:i,project:u,required:!1}),m&&
|
|
2211
|
+
m!==c&&await A(e,t,["update-ref","HEAD",c,m],{commandOptions:i,project:u,required:!1}),await A(e,t,["read-tree",l],{commandOptions:i,
|
|
2212
2212
|
project:u,required:!1}),p}}async function qo({commandOptions:e={},operationId:t,project:r={},runCommand:n=M,session:o={}}={}){
|
|
2213
2213
|
let i=U(o,r);await Qt(n,i,{commandOptions:e,project:r});let s=await Dr({outerTurnId:`update:${t}`,outcome:"completed",project:B(
|
|
2214
2214
|
i,r),runCommand:n,sessionId:i.sessionId,timestamp:new Date().toISOString(),worktreePath:i.worktreePath}),[a,c]=await Promise.
|
|
2215
2215
|
all([O(n,i,["rev-parse","HEAD"],{commandOptions:e,project:r}),O(n,i,["write-tree"],{commandOptions:e,project:r})]);return{
|
|
2216
2216
|
checkpointCommit:s.commit,checkpointTree:s.tree,oldHead:a,oldIndexTree:c}}async function _g({checkpoint:e={},commandOptions:t={},
|
|
2217
2217
|
conflictRecovery:r=null,derivedArtifactPaths:n=[],historyReview:o=null,operationId:i,project:s={},reviewedConflictId:a="",
|
|
2218
|
-
runCommand:c=M,session:l={}}={}){let u=U(l,s),{checkpointCommit:d,checkpointTree:p,oldHead:
|
|
2219
|
-
c,u,i,{commandOptions:t,project:s}),_=await dt(c,u,h,
|
|
2218
|
+
runCommand:c=M,session:l={}}={}){let u=U(l,s),{checkpointCommit:d,checkpointTree:p,oldHead:m,oldIndexTree:f}=e,{commit:h}=await rr(
|
|
2219
|
+
c,u,i,{commandOptions:t,project:s}),_=await dt(c,u,h,m,{commandOptions:t,project:s});if(_||o){if(u.mode!==Y)throw w("The\
|
|
2220
2220
|
saved project history no longer descends from this session's starting version.","vibe64_session_update_history_diverged");
|
|
2221
|
-
let T={baseCommit:u.baseCommit,canonicalCommit:h,sessionHead:
|
|
2222
|
-
baseCommit&&r.canonicalCommit===h&&r.oldHead===
|
|
2221
|
+
let T={baseCommit:u.baseCommit,canonicalCommit:h,sessionHead:m,worktreeTree:p};if(!(a&&r?.reviewId===a&&r.baseCommit===u.
|
|
2222
|
+
baseCommit&&r.canonicalCommit===h&&r.oldHead===m&&r.oldIndexTree===f)&&(!o||Object.entries(T).some(([k,N])=>o[k]!==N)))throw w(
|
|
2223
2223
|
"The project history was rewritten. Open Repository, check for updates, then review and reconcile this session.","vibe64\
|
|
2224
|
-
_session_history_review_required")}let g=await Xt(c,u,{baseCommit:u.baseCommit,canonicalCommit:h,sessionHead:
|
|
2224
|
+
_session_history_review_required")}let g=await Xt(c,u,{baseCommit:u.baseCommit,canonicalCommit:h,sessionHead:m,worktreeTree:p,
|
|
2225
2225
|
reconcileHistory:_},{commandOptions:t,project:s}),S=new Set(Yt(n)),v=g.changedPaths.filter(T=>!S.has(T)),b=await H(c,u,h,
|
|
2226
|
-
|
|
2226
|
+
m,{commandOptions:t,project:s});if(b&&!_)return{baseCommit:u.baseCommit,canonicalCommit:h,canonicalTree:g.canonicalTree,
|
|
2227
2227
|
changeBaseCommit:g.changeBaseCommit,checkpointCommit:d,checkpointTree:p,currentTree:p,ok:!0,operationId:i,mode:u.mode,reconciled:!0,
|
|
2228
2228
|
repositoryMode:u.mode,sessionCurrent:b,sessionMatchesCanonical:g.sessionMatchesCanonical,status:"already_current"};let R=g.
|
|
2229
2229
|
canonicalTree;if(v.length){let T=await er(c,u,{commandOptions:t,derivedArtifactPaths:n,project:s,sourceCommit:h,tree:p}),
|
|
2230
2230
|
E=await Ho(c,u,{baseCommit:g.changeBaseCommit,explicitBase:_,canonicalCommit:h,checkpointTree:T,commandOptions:t,project:s}),
|
|
2231
2231
|
k=E.conflictPaths.length>0?{baseCommit:g.changeBaseCommit,canonicalCommit:h,checkpointTree:p,conflictPaths:E.conflictPaths,
|
|
2232
|
-
conflictTree:E.conflictTree,oldHead:
|
|
2232
|
+
conflictTree:E.conflictTree,oldHead:m,oldIndexTree:f,reviewId:yg.randomUUID()}:null;R=k?await tP(c,u,{currentRecovery:k,
|
|
2233
2233
|
previousRecovery:r,reviewedConflictId:a,project:s}):E.mergedTree}return{...e,baseCommit:u.baseCommit,canonicalCommit:h,canonicalTree:g.
|
|
2234
2234
|
canonicalTree,changeBaseCommit:g.changeBaseCommit,mergedSourceTree:R,mode:u.mode,operationId:i,repositoryMode:u.mode,sessionCurrent:!0,
|
|
2235
2235
|
...v.length?{}:{sessionMatchesCanonical:!0},status:"prepared"}}async function Sg({commandOptions:e={},derivedArtifactPaths:t=[],
|
|
@@ -2237,7 +2237,7 @@ prepared:r={},project:n={},refreshDerivedArtifacts:o,runCommand:i=M,session:s={}
|
|
|
2237
2237
|
canonicalCommit,commandOptions:e,derivedArtifactPaths:t,project:n,refreshDerivedArtifacts:o,tree:r.mergedSourceTree}),l=c===
|
|
2238
2238
|
r.canonicalTree?r.canonicalCommit:await Zt(i,a,{baseCommit:r.canonicalCommit,commandOptions:e,message:"Vibe64 session up\
|
|
2239
2239
|
date result",project:n,tree:c});return{...r,mergedCommit:l,mergedTree:c}}async function Eg({commandOptions:e={},prepared:t={},
|
|
2240
|
-
project:r={},runCommand:n=M,session:o={}}={}){let i=U(o,r),s=await
|
|
2240
|
+
project:r={},runCommand:n=M,session:o={}}={}){let i=U(o,r),s=await rP(n,i,{...t,commandOptions:e,project:r});return{...t,
|
|
2241
2241
|
ok:!0,...s}}function Tg(e,t){let r=U({sessionId:t.sessionId,sourcePath:t.sourcePath||t.metadata?.source_path,metadata:{base_commit:t.
|
|
2242
2242
|
metadata?.base_commit}},e);if(r.mode!==q||r.branch.startsWith("vibe64-incoming/"))throw w("Incoming changes require the \
|
|
2243
2243
|
receiving GitHub repository's authority.","vibe64_incoming_repository_authority_required");return r}async function Yo({project:e={},
|
|
@@ -2247,15 +2247,15 @@ project:e},p=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{1
|
|
|
2247
2247
|
r)||r<0||!Number.isSafeInteger(n)||n<1||n>50||s&&!o||!["all","pending","merged","discarded","unresolved"].includes(i))throw w(
|
|
2248
2248
|
"Choose an exact incoming contribution or a valid page.","vibe64_incoming_input_invalid",{},{status:400});if(await O(l,u,
|
|
2249
2249
|
["rev-parse","--is-shallow-repository"],d)!=="false")throw w("Incoming changes require complete Git history. Prepare a f\
|
|
2250
|
-
ull receiving checkout before retrying.","vibe64_incoming_history_incomplete");let
|
|
2251
|
-
l,u,["ls-remote","--heads",u.remoteUrl,
|
|
2250
|
+
ull receiving checkout before retrying.","vibe64_incoming_history_incomplete");let m=`refs/heads/${u.branch}`,f=await O(
|
|
2251
|
+
l,u,["ls-remote","--heads",u.remoteUrl,m,"refs/heads/vibe64-incoming/*"],d),h=new Map,_="";for(let b of f.split(`
|
|
2252
2252
|
`).filter(Boolean)){let[R,T]=b.split(/\s+/u);if(!se(R))throw w("The receiving repository returned invalid ref evidence.",
|
|
2253
|
-
"vibe64_incoming_refs_invalid");if(T===
|
|
2253
|
+
"vibe64_incoming_refs_invalid");if(T===m){_=R;continue}let E=/^refs\/heads\/vibe64-incoming\/(.+?)(_discarded)?$/u.exec(
|
|
2254
2254
|
T);if(!E||!p.test(E[1]))continue;let k=h.get(E[1])||{id:E[1],activeHead:"",discardedHead:""};k[E[2]?"discardedHead":"act\
|
|
2255
2255
|
iveHead"]=R,h.set(k.id,k)}if(!_)throw w("The receiving integration branch is unavailable.","vibe64_incoming_target_missi\
|
|
2256
2256
|
ng");let g=[...h.values()].sort((b,R)=>b.id.localeCompare(R.id)),S=o?g.filter(b=>b.id===o):g;if(o&&!S.length)throw w("Th\
|
|
2257
2257
|
is incoming contribution is no longer present. Refresh the list and inspect its history.","vibe64_incoming_missing",{},{
|
|
2258
|
-
status:404});let v=[{remote:
|
|
2258
|
+
status:404});let v=[{remote:m,head:_}];for(let b of S)b.activeHead&&v.push({remote:`refs/heads/vibe64-incoming/${b.id}`,
|
|
2259
2259
|
head:b.activeHead}),b.discardedHead&&v.push({remote:`refs/heads/vibe64-incoming/${b.id}_discarded`,head:b.discardedHead});
|
|
2260
2260
|
v.forEach((b,R)=>{b.local=Ve(u,c,`incoming-${R}`)});try{await A(l,u,["fetch","--no-tags","--no-write-fetch-head",u.remoteUrl,
|
|
2261
2261
|
...v.map(E=>`+${E.remote}:${E.local}`)],d);for(let E of v)if(await O(l,u,["rev-parse","--verify",`${E.local}^{commit}`],
|
|
@@ -2265,69 +2265,69 @@ test(N))throw w("Contribution ancestry could not be established.","vibe64_incomi
|
|
|
2265
2265
|
E.discardedHead?"unresolved":N==="0"?"merged":E.activeHead?"pending":"discarded"}let b=S.filter(E=>o||i==="all"||E.status===
|
|
2266
2266
|
i),R=o?b:b.slice(r,r+n),T=[];for(let E of R){let k=E.activeHead||E.discardedHead,N=await O(l,u,["log","-1","--format=%s",
|
|
2267
2267
|
k],d),D=await A(l,u,["diff","--name-only","-z",`${_}...${k}`],d),G=String(D.stdout||D.output||"").split("\0").filter(Boolean),
|
|
2268
|
-
|
|
2269
|
-
$.stdout||$.output||"");
|
|
2268
|
+
fe;if(s){let $=await A(l,u,["diff","--no-ext-diff","--no-textconv","--no-color","--unified=3",`${_}...${k}`],d),K=String(
|
|
2269
|
+
$.stdout||$.output||"");fe=Va(K)}T.push({...E,branch:`vibe64-incoming/${E.id}`,head:k,title:N,review:{repository:u.repositoryFullName,
|
|
2270
2270
|
targetBranch:u.branch,targetHead:_,id:E.id,activeHead:E.activeHead,discardedHead:E.discardedHead},files:G.slice(0,50),fileCount:G.
|
|
2271
|
-
length,filesTruncated:G.length>50,...
|
|
2271
|
+
length,filesTruncated:G.length>50,...fe?{diff:fe}:{}})}return{ok:!0,repository:u.repositoryFullName,targetBranch:u.branch,
|
|
2272
2272
|
targetHead:_,contributions:T,pendingCount:S.filter(E=>E.status==="pending").length,unresolvedCount:S.filter(E=>E.status===
|
|
2273
2273
|
"unresolved").length,totalCount:b.length,offset:o?0:r,nextOffset:!o&&r+n<b.length?r+n:null}}finally{for(let b of v)await Ce(
|
|
2274
2274
|
l,u,b.local,d)}}async function Og({project:e={},session:t={},action:r="",id:n="",review:o,repairReview:i=null,derivedArtifactPaths:s=[],
|
|
2275
2275
|
refreshDerivedArtifacts:a,commandOptions:c={},operationId:l=vg.randomUUID(),runCommand:u=M}={}){if(!["merge","discard","\
|
|
2276
2276
|
review-repair"].includes(r)||!n)throw w("Choose Merge or Discard for an exact contribution.","vibe64_incoming_action_inv\
|
|
2277
2277
|
alid",{},{status:400});let d=Tg(e,t);u=J(u,d,e,{label:"Updating incoming contribution",operationId:l});let p={commandOptions:c,
|
|
2278
|
-
project:e},
|
|
2279
|
-
repository,targetBranch:
|
|
2278
|
+
project:e},m=await Yo({project:e,session:t,id:n,commandOptions:c,operationId:l,runCommand:u}),f=m.contributions[0],h={repository:m.
|
|
2279
|
+
repository,targetBranch:m.targetBranch,targetHead:m.targetHead,id:n,activeHead:f.activeHead,discardedHead:f.discardedHead};
|
|
2280
2280
|
if(Object.entries(h).some(([N,D])=>o?.[N]!==D))throw w("This contribution or its target changed. Review the current head\
|
|
2281
|
-
s before acting.","vibe64_incoming_heads_changed");let _=`refs/heads/${
|
|
2282
|
-
if(r==="merge"||r==="review-repair"){if(
|
|
2283
|
-
if(
|
|
2284
|
-
coming_not_pending");let N=
|
|
2281
|
+
s before acting.","vibe64_incoming_heads_changed");let _=`refs/heads/${f.branch}`,g=`${_}_discarded`,S=`refs/heads/${d.branch}`;
|
|
2282
|
+
if(r==="merge"||r==="review-repair"){if(f.status==="merged")return{ok:!0,status:"merged",head:f.head,targetHead:m.targetHead};
|
|
2283
|
+
if(f.status!=="pending")throw w("Only a pending contribution can be merged. Resolve its discard state first.","vibe64_in\
|
|
2284
|
+
coming_not_pending");let N=f.head,D="",G=await O(u,d,["rev-list","--count",`${f.head}..${m.targetHead}`],p);if(!/^\d+$/u.
|
|
2285
2285
|
test(G))throw w("Integration ancestry is unavailable.","vibe64_incoming_integration_ancestry_unknown");if(G==="0"&&(i||r===
|
|
2286
2286
|
"review-repair"))throw w("These heads do not need conflict repair. Refresh and review the contribution normally.","vibe6\
|
|
2287
|
-
4_incoming_repair_not_needed");if(G!=="0"){let ve=await O(u,d,["rev-parse",`${
|
|
2288
|
-
derivedArtifactPaths:s,project:e,sourceCommit:
|
|
2289
|
-
message:"Vibe64 incoming authored source",project:e,tree:
|
|
2290
|
-
commandOptions:c,project:e});if(
|
|
2287
|
+
4_incoming_repair_not_needed");if(G!=="0"){let ve=await O(u,d,["rev-parse",`${f.head}^{tree}`],p),mt=await er(u,d,{commandOptions:c,
|
|
2288
|
+
derivedArtifactPaths:s,project:e,sourceCommit:m.targetHead,tree:ve}),Ko=mt===ve?f.head:await Zt(u,d,{baseCommit:f.head,commandOptions:c,
|
|
2289
|
+
message:"Vibe64 incoming authored source",project:e,tree:mt}),ft=await Ho(u,d,{canonicalCommit:m.targetHead,virtualCommit:Ko,
|
|
2290
|
+
commandOptions:c,project:e});if(ft.conflictPaths.length){let zr=await qo({project:e,session:t,commandOptions:c,operationId:`\
|
|
2291
2291
|
incoming:${l}`,runCommand:u});if(r==="merge"&&!i)throw w("This contribution conflicts with the integration branch. Use F\
|
|
2292
2292
|
ix it with AI or repair the listed files in this receiving session, then Review resolved conflicts before merging.","vib\
|
|
2293
|
-
e64_incoming_merge_conflict",{conflictPaths:
|
|
2294
|
-
u,d,{conflictTree:
|
|
2293
|
+
e64_incoming_merge_conflict",{conflictPaths:ft.conflictPaths,checkpointCommit:zr.checkpointCommit,review:h});D=await Vo(
|
|
2294
|
+
u,d,{conflictTree:ft.conflictTree,conflictPaths:ft.conflictPaths,project:e}),D=await pt(u,d,{baseCommit:m.targetHead,commandOptions:c,
|
|
2295
2295
|
derivedArtifactPaths:s,project:e,refreshDerivedArtifacts:a,tree:D});let Xo={tree:D,worktreeTree:zr.checkpointTree,head:zr.
|
|
2296
2296
|
oldHead,indexTree:zr.oldIndexTree};if(r==="review-repair"){let or=await A(u,d,["diff","--no-ext-diff","--no-textconv","-\
|
|
2297
|
-
-no-color","--unified=3",
|
|
2298
|
-
repairReview:Xo,conflictPaths:
|
|
2297
|
+
-no-color","--unified=3",m.targetHead,D],p),Dg=String(or.stdout||or.output||"");return{ok:!0,status:"repair-review",review:h,
|
|
2298
|
+
repairReview:Xo,conflictPaths:ft.conflictPaths,diff:Va(Dg)}}if(Object.keys(Xo).some(or=>i?.[or]!==Xo[or]))throw w("The r\
|
|
2299
2299
|
eceiving source changed after repair review. Review resolved conflicts again before merging.","vibe64_incoming_repair_ch\
|
|
2300
2300
|
anged")}else if(i||r==="review-repair")throw w("These heads no longer need conflict repair. Refresh and review the contr\
|
|
2301
|
-
ibution normally.","vibe64_incoming_repair_no_longer_needed");let Mg=D||await pt(u,d,{baseCommit:
|
|
2302
|
-
derivedArtifactPaths:s,project:e,refreshDerivedArtifacts:a,tree:
|
|
2303
|
-
"-p",
|
|
2304
|
-
`})}let
|
|
2305
|
-
targetHead!==
|
|
2301
|
+
ibution normally.","vibe64_incoming_repair_no_longer_needed");let Mg=D||await pt(u,d,{baseCommit:m.targetHead,commandOptions:c,
|
|
2302
|
+
derivedArtifactPaths:s,project:e,refreshDerivedArtifacts:a,tree:ft.mergedTree});N=await O(u,d,["commit-tree",Mg,"-p",m.targetHead,
|
|
2303
|
+
"-p",f.head],{...p,input:`Merge contribution ${n}
|
|
2304
|
+
`})}let fe=await Yo({project:e,session:t,id:n,commandOptions:c,operationId:l,runCommand:u}),$=fe.contributions[0];if(fe.
|
|
2305
|
+
targetHead!==m.targetHead||$.activeHead!==f.activeHead||$.discardedHead)throw w("The contribution changed while its merg\
|
|
2306
2306
|
e was prepared. Review it again.","vibe64_incoming_merge_contribution_changed");if(D){let ve=await O(u,d,["rev-parse","H\
|
|
2307
|
-
EAD"],p),
|
|
2308
|
-
i.head||
|
|
2309
|
-
resolved conflicts again.","vibe64_incoming_merge_source_changed")}if(await A(u,d,["push",`--force-with-lease=${S}:${
|
|
2307
|
+
EAD"],p),mt=await O(u,d,["write-tree"],p),Ko=await W({worktreePath:d.worktreePath,project:B(d,e),runCommand:u});if(ve!==
|
|
2308
|
+
i.head||mt!==i.indexTree||Ko!==i.worktreeTree)throw w("The receiving source changed while the merge was prepared. Review\
|
|
2309
|
+
resolved conflicts again.","vibe64_incoming_merge_source_changed")}if(await A(u,d,["push",`--force-with-lease=${S}:${m.
|
|
2310
2310
|
targetHead}`,d.remoteUrl,`${N}:${S}`],p),(await O(u,d,["ls-remote","--heads",d.remoteUrl,S],p)).split(/\s+/u)[0]!==N)throw w(
|
|
2311
2311
|
"The merge result is uncertain. Refresh Incoming changes before retrying.","vibe64_incoming_verification_failed");return{
|
|
2312
|
-
ok:!0,status:"merged",head:
|
|
2312
|
+
ok:!0,status:"merged",head:f.head,targetHead:N}}if(!f.activeHead||f.discardedHead&&f.discardedHead!==f.activeHead)throw w(
|
|
2313
2313
|
"This discard cannot replace a different or missing contribution head. Inspect the current branches.","vibe64_incoming_d\
|
|
2314
|
-
iscard_head_mismatch");let v=`${
|
|
2315
|
-
e=${g}:${
|
|
2314
|
+
iscard_head_mismatch");let v=`${f.head}:${g}`,b=`:${_}`,R=`--force-with-lease=${_}:${f.activeHead}`,T=`--force-with-leas\
|
|
2315
|
+
e=${g}:${f.discardedHead}`,E=await A(u,d,["push","--atomic",R,T,d.remoteUrl,v,b],{...p,required:!1});if(!E.ok){let N=y(E.
|
|
2316
2316
|
stderr||E.output||E.error);if(!/does not support --atomic push/iu.test(N))throw w(N||"Discard was not confirmed. Refresh\
|
|
2317
|
-
Incoming changes before retrying.","vibe64_incoming_discard_unconfirmed");if(
|
|
2318
|
-
v],p),(await O(u,d,["ls-remote","--heads",d.remoteUrl,g],p)).split(/\s+/u)[0]!==
|
|
2317
|
+
Incoming changes before retrying.","vibe64_incoming_discard_unconfirmed");if(f.discardedHead||await A(u,d,["push",T,d.remoteUrl,
|
|
2318
|
+
v],p),(await O(u,d,["ls-remote","--heads",d.remoteUrl,g],p)).split(/\s+/u)[0]!==f.head)throw w("The discarded branch was\
|
|
2319
2319
|
not verified; the active branch was retained.","vibe64_incoming_discard_unverified");await A(u,d,["push",R,d.remoteUrl,
|
|
2320
|
-
b],p)}if(await O(u,d,["ls-remote","--heads",d.remoteUrl,_,g],p)!==`${
|
|
2321
|
-
ed. Refresh Incoming changes to inspect both branches.","vibe64_incoming_discard_unconfirmed");return{ok:!0,status:
|
|
2322
|
-
"merged"?"merged":"discarded",head:
|
|
2320
|
+
b],p)}if(await O(u,d,["ls-remote","--heads",d.remoteUrl,_,g],p)!==`${f.head} ${g}`)throw w("Discard is not fully confirm\
|
|
2321
|
+
ed. Refresh Incoming changes to inspect both branches.","vibe64_incoming_discard_unconfirmed");return{ok:!0,status:f.status===
|
|
2322
|
+
"merged"?"merged":"discarded",head:f.head}}import{access as nP}from"node:fs/promises";import oP from"node:path";var Ka=[["merge","MERGE_HEAD"],["cherry-pick","CHERRY_PICK_HEAD"],["revert","REVERT_HEAD"],["rebase","rebase-merge"],["r\
|
|
2323
2323
|
ebase","rebase-apply"],["cherry-pick or revert","sequencer"]];async function Ig({commandOptions:e={},project:t={},runCommand:r=M,
|
|
2324
2324
|
session:n={},targetCommit:o=""}={}){let i=U(n,t);r=J(r,i,t,{label:"Checking a failed session update"});let s={commandOptions:e,
|
|
2325
2325
|
project:t},[a,c,l,u]=await Promise.all([O(r,i,["rev-parse","--verify","HEAD^{commit}"],s),Kt(r,i,s),O(r,i,["rev-parse",...Ka.
|
|
2326
|
-
flatMap(([,S])=>["--git-path",S])],s),O(r,i,["ls-files","--unmerged","-z"],s)]),d=y(o),[p,f
|
|
2326
|
+
flatMap(([,S])=>["--git-path",S])],s),O(r,i,["ls-files","--unmerged","-z"],s)]),d=y(o),[p,m,f]=await Promise.all([H(r,i,
|
|
2327
2327
|
c,a,s),dt(r,i,c,a,s),se(d)?H(r,i,d,a,s):!1]),h=l.split(`
|
|
2328
|
-
`),_=await Promise.all(Ka.map((S,v)=>!h[v]||
|
|
2329
|
-
find((S,v)=>_[v]);return{canonicalCommit:c,gitOperation:g?.[0]||"",sessionHead:a,targetInHead:
|
|
2330
|
-
u.split("\0").filter(Boolean).map(S=>S.slice(S.indexOf(" ")+1)))].sort(),updateNeeded:
|
|
2328
|
+
`),_=await Promise.all(Ka.map((S,v)=>!h[v]||nP(oP.resolve(i.worktreePath,h[v])).then(()=>!0,b=>b?.code!=="ENOENT"))),g=Ka.
|
|
2329
|
+
find((S,v)=>_[v]);return{canonicalCommit:c,gitOperation:g?.[0]||"",sessionHead:a,targetInHead:f,unmergedPaths:[...new Set(
|
|
2330
|
+
u.split("\0").filter(Boolean).map(S=>S.slice(S.indexOf(" ")+1)))].sort(),updateNeeded:m||!p}}import xg from"node:crypto";async function iP(e,t,r,n,o={}){let[i,s]=await Promise.all([A(e,t,["diff-tree","--no-commit-id","-r","-M","--name-status",
|
|
2331
2331
|
"-z",r,n],o),A(e,t,["diff-tree","--no-commit-id","-r","-M","--numstat","-z",r,n],o)]);return ig(i.stdout||i.output,s.stdout||
|
|
2332
2332
|
s.output)}async function Ag(e,t,r,n,o={}){let{commandOptions:i={},lineLimit:s=Bo,project:a={}}=o,c=Fa(n);if(!r.changedPaths.
|
|
2333
2333
|
includes(c))throw w("That file is not part of the current saved-work difference.","vibe64_session_change_not_found",{},{
|
|
@@ -2336,26 +2336,26 @@ r.worktreeTree,"--",...cg(c)],{commandOptions:i,project:a});return{canonicalComm
|
|
|
2336
2336
|
changeBaseCommit,...ag(l.stdout||l.output,s),ok:!0,path:c,worktreeTree:r.worktreeTree}}async function Jo({commandOptions:e={},
|
|
2337
2337
|
derivedArtifactPaths:t=[],includeInitialDiff:r=!0,limit:n=ja,offset:o=0,project:i={},runCommand:s=M,session:a={},worktreeTree:c=""}={}){
|
|
2338
2338
|
let l=U(a,i);s=J(s,l,i,{label:"Inspecting session changes"});let u=await Vr({commandOptions:e,derivedArtifactPaths:t,project:i,
|
|
2339
|
-
runCommand:s,session:a,worktreeTree:c}),d=new Set(u.changedPaths),p=u.unsaved?await
|
|
2340
|
-
{commandOptions:e,project:i}).then(_=>_.filter(g=>d.has(g.path))):[],{items:f
|
|
2341
|
-
offset:o}),h=r&&
|
|
2342
|
-
initialDiff:h,...
|
|
2339
|
+
runCommand:s,session:a,worktreeTree:c}),d=new Set(u.changedPaths),p=u.unsaved?await iP(s,l,u.changeBaseCommit,u.worktreeTree,
|
|
2340
|
+
{commandOptions:e,project:i}).then(_=>_.filter(g=>d.has(g.path))):[],{items:m,...f}=sg(p,{defaultLimit:ja,limit:n,maxLimit:rg,
|
|
2341
|
+
offset:o}),h=r&&f.offset===0&&m.length>0?await Ag(s,l,u,m[0].path,{commandOptions:e,project:i}):null;return{...u,files:m,
|
|
2342
|
+
initialDiff:h,...f}}async function Xa({commandOptions:e={},derivedArtifactPaths:t=[],lineLimit:r=Bo,path:n="",project:o={},
|
|
2343
2343
|
runCommand:i=M,session:s={}}={}){let a=Fa(n),c=U(s,o);i=J(i,c,o,{label:"Inspecting a session change"});let l=await Vr({commandOptions:e,
|
|
2344
2344
|
derivedArtifactPaths:t,project:o,runCommand:i,session:s});return Ag(i,c,l,a,{commandOptions:e,lineLimit:r,project:o})}async function Vr({
|
|
2345
2345
|
commandOptions:e={},derivedArtifactPaths:t=[],inspectContributionPublication:r=!1,knownSubmittedCommit:n="",project:o={},
|
|
2346
2346
|
runCommand:i=M,session:s={},worktreeTree:a=""}={}){let c=U(s,o);i=J(i,c,o,{label:"Inspecting session work"});let l=y(a)||
|
|
2347
|
-
await W({baseCommit:"HEAD",project:B(c,o),runCommand:i,worktreePath:c.worktreePath}),[u,d,p,
|
|
2347
|
+
await W({baseCommit:"HEAD",project:B(c,o),runCommand:i,worktreePath:c.worktreePath}),[u,d,p,m]=await Promise.all([Kt(i,c,
|
|
2348
2348
|
{commandOptions:e,project:o}),O(i,c,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:e,project:o}),O(i,c,["statu\
|
|
2349
2349
|
s","--porcelain=v1","--untracked-files=all","--ignore-submodules=none","-z"],{commandOptions:e,project:o}),O(i,c,["rev-p\
|
|
2350
|
-
arse","--show-toplevel"],{commandOptions:e,project:o})]),[
|
|
2350
|
+
arse","--show-toplevel"],{commandOptions:e,project:o})]),[f,h,_,g]=await Promise.all([O(i,c,["rev-parse",`${d}^{tree}`],
|
|
2351
2351
|
{commandOptions:e,project:o}),Jt(i,c,u,d,{commandOptions:e,project:o}),Jt(i,c,d,u,{commandOptions:e,project:o}),Xt(i,c,{
|
|
2352
2352
|
baseCommit:c.baseCommit,canonicalCommit:u,sessionHead:d,worktreeTree:l},{commandOptions:e,project:o})]),S=new Set((Array.
|
|
2353
2353
|
isArray(t)?t:[]).map(y).filter(Boolean)),v=g.changedPaths.filter(E=>!S.has(E)),b=Gr(h,_),R=p.length===0,T;if(r){if(!c.contribution)
|
|
2354
2354
|
throw w("Publication inspection requires a bound contribution.","vibe64_contribution_binding_required");let E=await tr(i,
|
|
2355
2355
|
c,{commandOptions:e,project:o},!0);if(T=E.head,!T&&n){if(!se(n))throw w("The saved contribution evidence is invalid.","v\
|
|
2356
2356
|
ibe64_connected_integration_evidence_invalid");T=n}if(E.discarded||T&&E.remoteAbsent){let k=`refs/heads/${c.contribution.
|
|
2357
|
-
integrationBranch}`,N=await O(i,c,["ls-remote","--heads",c.remoteUrl,k],{commandOptions:e,project:o}),[D,G,
|
|
2358
|
-
if(G!==k||
|
|
2357
|
+
integrationBranch}`,N=await O(i,c,["ls-remote","--heads",c.remoteUrl,k],{commandOptions:e,project:o}),[D,G,fe]=N.split(/\s+/u);
|
|
2358
|
+
if(G!==k||fe||!se(D)||!await H(i,c,T,D,{commandOptions:e,project:o}))throw w("The removed contribution has not been prov\
|
|
2359
2359
|
ed integrated in this source. Check its receiving target and explicitly Update the connected session.",E.discarded?"vibe\
|
|
2360
2360
|
64_contribution_discarded":"vibe64_contribution_branch_missing")}if(!T&&c.baseCommit!==c.contribution.baseCommit)throw w(
|
|
2361
2361
|
"The pushed contribution branch is missing and no exact submitted revision is retained. Preserve the source and inspect \
|
|
@@ -2363,10 +2363,10 @@ its Save recovery evidence.","vibe64_contribution_revision_unretained");if(T&&!a
|
|
|
2363
2363
|
throw w("The contribution branch contains work this source has not incorporated. Update its receiving session before sav\
|
|
2364
2364
|
ing the main project.","vibe64_connected_source_update_required",{repository:c.contribution.repository,sessionId:c.sessionId})}
|
|
2365
2365
|
return{ahead:h,baseCommit:c.baseCommit,behind:_,branch:c.branch,canonicalCommit:u,canonicalTree:g.canonicalTree,changeBaseCommit:g.
|
|
2366
|
-
changeBaseCommit,changeBaseTree:g.changeBaseTree,changedPaths:v,destination:Qh(o,s),dirty:l!==
|
|
2366
|
+
changeBaseCommit,changeBaseTree:g.changeBaseTree,changedPaths:v,destination:Qh(o,s),dirty:l!==f||!R,mode:c.mode,ok:!0,...r?
|
|
2367
2367
|
{publishedCommit:T}:{},repositoryMode:c.mode,relationship:b,sessionMatchesCanonical:v.length===0,sessionHead:d,sessionId:c.
|
|
2368
|
-
sessionId,tree:l,updateAvailable:_>0,updateStrategy:Fr(b),unsaved:v.length>0,worktreeClean:R,worktreeTree:l,worktreeTopLevel:
|
|
2369
|
-
worktreePath:c.worktreePath}}import
|
|
2368
|
+
sessionId,tree:l,updateAvailable:_>0,updateStrategy:Fr(b),unsaved:v.length>0,worktreeClean:R,worktreeTree:l,worktreeTopLevel:m,
|
|
2369
|
+
worktreePath:c.worktreePath}}import sP from"node:path";async function Rg(e,t,{canonicalCommit:r,commandOptions:n,mergedTree:o,message:i,project:s}){let a=y(i);if(!a)throw w("S\
|
|
2370
2370
|
ave requires an assistant-generated commit subject.","vibe64_session_save_message_required",{},{status:400});return O(e,
|
|
2371
2371
|
t,["commit-tree",o,"-p",r],{commandOptions:n,input:`${a}
|
|
2372
2372
|
`,project:s})}async function Pg(e,t,{canonicalCommit:r,contributionAuthority:n,saveCommit:o},i){let{onPublicationAttempt:s=nr}=i;
|
|
@@ -2397,13 +2397,13 @@ return{attempted:o,branch:e.branch,code:r,kind:"github_mirror",message:"Your wor
|
|
|
2397
2397
|
h its local clone cache. A later session or Save will retry it.",reason:n,retryable:!0,status:"retryable",verifiedCommit:t}}
|
|
2398
2398
|
async function Qa(e,t,r,n={}){let{commandOptions:o={},project:i={}}=n;if(t.mode!==q)return{attempted:!1,kind:"none",retryable:!1,
|
|
2399
2399
|
status:"not_applicable"};let s=t.githubMirrorPath,a=(c,l)=>Cg(t,r,c,l,!!s);if(!s&&t.githubMirrorOptional)return{attempted:!1,
|
|
2400
|
-
kind:"none",retryable:!1,status:"not_applicable"};if(!s||!
|
|
2400
|
+
kind:"none",retryable:!1,status:"not_applicable"};if(!s||!sP.isAbsolute(s))return a("vibe64_session_save_github_mirror_m\
|
|
2401
2401
|
issing","configuration_missing");try{let[c,...l]=La({mirrorPath:s,remoteUrl:t.remoteUrl}),u=await jo(e,t,c,l,{additionalAllowedRoots:[
|
|
2402
2402
|
s],commandOptions:o,project:i});if(u?.ok!==!0)return a(y(u?.code)||"vibe64_session_save_github_mirror_refresh_failed","r\
|
|
2403
|
-
efresh_failed");let d={additionalAllowedRoots:[s],commandOptions:o,project:i,required:!1},[p,
|
|
2403
|
+
efresh_failed");let d={additionalAllowedRoots:[s],commandOptions:o,project:i,required:!1},[p,m]=await Promise.all([A(e,t,
|
|
2404
2404
|
["--git-dir",s,"rev-parse","--verify",`refs/heads/${t.branch}^{commit}`],d),A(e,t,["--git-dir",s,"remote","get-url","ori\
|
|
2405
|
-
gin"],d)]),
|
|
2406
|
-
irror_verification_failed","verification_failed"),mirrorCommit:
|
|
2405
|
+
gin"],d)]),f=p?.ok===!0?zt(p):"",h=m?.ok===!0?zt(m):"";return f!==r||h!==t.remoteUrl?{...a("vibe64_session_save_github_m\
|
|
2406
|
+
irror_verification_failed","verification_failed"),mirrorCommit:f}:{attempted:!0,branch:t.branch,kind:"github_mirror",mirrorCommit:f,
|
|
2407
2407
|
retryable:!1,status:"current",verifiedCommit:r}}catch{return a("vibe64_session_save_github_mirror_refresh_failed","refre\
|
|
2408
2408
|
sh_interrupted")}}async function Za(e,t,{checkpointCommit:r,checkpointTree:n,commandOptions:o,project:i,saveCommit:s,sessionHead:a=""}){
|
|
2409
2409
|
let[c,l,u]=await Promise.all([W({baseCommit:"HEAD",project:B(t,i),runCommand:e,worktreePath:t.worktreePath}),O(e,t,["rev\
|
|
@@ -2412,9 +2412,9 @@ status:"saved"};if(a&&l!==a)return{currentTree:c,reconciled:!1,status:"published
|
|
|
2412
2412
|
e,t,["write-tree"],{commandOptions:o,project:i});try{return d?(await A(e,t,["read-tree",r],{commandOptions:o,project:i}),
|
|
2413
2413
|
await A(e,t,["read-tree","-m","-u",r,s],{commandOptions:o,project:i})):await A(e,t,["read-tree","--reset","-u",s],{commandOptions:o,
|
|
2414
2414
|
project:i}),await A(e,t,["update-ref","HEAD",s,l],{commandOptions:o,project:i}),{currentTree:c,reconciled:!0,status:"sav\
|
|
2415
|
-
ed"}}catch(
|
|
2416
|
-
["read-tree",p],{commandOptions:o,project:i,required:!1}),{currentTree:c,error:y(
|
|
2417
|
-
blished_needs_reconcile"}}}async function
|
|
2415
|
+
ed"}}catch(m){return d||await A(e,t,["read-tree","--reset","-u",r],{commandOptions:o,project:i,required:!1}),await A(e,t,
|
|
2416
|
+
["read-tree",p],{commandOptions:o,project:i,required:!1}),{currentTree:c,error:y(m?.message||m),reconciled:!1,status:"pu\
|
|
2417
|
+
blished_needs_reconcile"}}}async function aP(e,t,r,n,o={}){let i=Go(t,r);return await A(e,t,["update-ref",i,n],o),i}async function kg(e,t,r={}){let{
|
|
2418
2418
|
commandOptions:n={},operationId:o,project:i={}}=r;await Qt(e,t,{commandOptions:n,project:i});let s=await Dr({outerTurnId:`\
|
|
2419
2419
|
save:${o}`,outcome:"completed",project:B(t,i),runCommand:e,sessionId:t.sessionId,timestamp:new Date().toISOString(),worktreePath:t.
|
|
2420
2420
|
worktreePath}),a=await O(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:n,project:i});return{baseCommit:t.
|
|
@@ -2424,71 +2424,71 @@ runCommand:s=M,session:a={}}={}){let c=U(a,i);s=J(s,c,i,{label:"Capturing work f
|
|
|
2424
2424
|
s,c,{commandOptions:e,operationId:o,project:i}),u=await Jo({commandOptions:e,derivedArtifactPaths:r,includeInitialDiff:!1,
|
|
2425
2425
|
limit:n,project:i,runCommand:s,session:a,worktreeTree:l.checkpointTree});if(!u.totalCount)throw await Hr(s,c,{commandOptions:e,
|
|
2426
2426
|
connectedWorkSnapshots:Ya(t),project:i}),w("This session has no work to save.","vibe64_session_save_no_changes");return{
|
|
2427
|
-
changes:u,checkpoint:l}}async function
|
|
2427
|
+
changes:u,checkpoint:l}}async function cP(e,t,r,n={}){let{commandOptions:o={},operationId:i,project:s={}}=n,a=y(r?.checkpointCommit),
|
|
2428
2428
|
c=y(r?.checkpointTree);if(!a||!c||y(r?.operationId)!==y(i)||y(r?.baseCommit)!==t.baseCommit||y(r?.branch)!==t.branch||y(
|
|
2429
2429
|
r?.mode)!==t.mode)throw w("Save cannot verify the captured worktree. Capture and name the work again.","vibe64_session_s\
|
|
2430
2430
|
ave_checkpoint_invalid");if(await Ee(e,t,a,{commandOptions:o,project:s})!==c)throw w("Save cannot verify the captured wo\
|
|
2431
2431
|
rktree. Capture and name the work again.","vibe64_session_save_checkpoint_invalid");let u=y(r?.sessionHead),d=u?await O(
|
|
2432
2432
|
e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:o,project:s}):"";if(u&&d!==u)throw w("The session history c\
|
|
2433
2433
|
hanged while Vibe64 was naming this work. Save was not started; try again.","vibe64_session_save_message_stale");return r}
|
|
2434
|
-
async function
|
|
2435
|
-
message:a="",operationId:c,project:l={},refreshDerivedArtifacts:u}=r,d=y(n.checkpointTree),[p,
|
|
2436
|
-
t,c,{commandOptions:o,project:l}),O(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:o,project:l})]),
|
|
2437
|
-
if(await dt(e,t,m,
|
|
2438
|
-
d base.","vibe64_session_save_history_diverged");let h=await H(e,t,m,
|
|
2434
|
+
async function lP(e,t,r={}){let{checkpoint:n={},commandOptions:o={},connectedWorkSnapshots:i=[],derivedArtifactPaths:s=[],
|
|
2435
|
+
message:a="",operationId:c,project:l={},refreshDerivedArtifacts:u}=r,d=y(n.checkpointTree),[p,m]=await Promise.all([rr(e,
|
|
2436
|
+
t,c,{commandOptions:o,project:l}),O(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:o,project:l})]),f=p.commit;
|
|
2437
|
+
if(await dt(e,t,f,m,{commandOptions:o,project:l}))throw w("Canonical history no longer descends from this session's save\
|
|
2438
|
+
d base.","vibe64_session_save_history_diverged");let h=await H(e,t,f,m,{commandOptions:o,project:l});if(f!==t.baseCommit&&
|
|
2439
2439
|
!h)throw w("The saved branch has changed. Update this session before saving its work.","vibe64_session_save_update_requi\
|
|
2440
|
-
red",{canonicalCommit:
|
|
2441
|
-
d"});let _=await Xt(e,t,{baseCommit:t.baseCommit,canonicalCommit:
|
|
2440
|
+
red",{canonicalCommit:f,reconciledCommit:t.baseCommit,updateRequired:!0},{messageCode:"vibe64_session_save_branch_change\
|
|
2441
|
+
d"});let _=await Xt(e,t,{baseCommit:t.baseCommit,canonicalCommit:f,sessionHead:m,worktreeTree:d},{commandOptions:o,project:l}),
|
|
2442
2442
|
g=new Set(Yt(s)),S=_.changedPaths.filter(k=>!g.has(k));if(!S.length)throw await Hr(e,t,{commandOptions:o,connectedWorkSnapshots:i,
|
|
2443
2443
|
project:l}),w("This session has no work to save.","vibe64_session_save_no_changes");let v=await er(e,t,{commandOptions:o,
|
|
2444
|
-
derivedArtifactPaths:s,project:l,sourceCommit:
|
|
2445
|
-
project:l,refreshDerivedArtifacts:u,tree:v}),R=await Rg(e,t,{canonicalCommit:
|
|
2446
|
-
T=await
|
|
2447
|
-
return{canonicalCommit:
|
|
2448
|
-
preparedRef:T,saveCommit:R,standInIdentity:pa(E)}}async function
|
|
2444
|
+
derivedArtifactPaths:s,project:l,sourceCommit:f,tree:d}),b=await pt(e,t,{baseCommit:f,commandOptions:o,derivedArtifactPaths:s,
|
|
2445
|
+
project:l,refreshDerivedArtifacts:u,tree:v}),R=await Rg(e,t,{canonicalCommit:f,commandOptions:o,mergedTree:b,message:a,project:l}),
|
|
2446
|
+
T=await aP(e,t,c,R,{commandOptions:o,project:l}),E=await O(e,t,["show","-s","--format=%ae",R],{commandOptions:o,project:l});
|
|
2447
|
+
return{canonicalCommit:f,changeBaseCommit:_.changeBaseCommit,changedPaths:S,contributionAuthority:p.contribution,mergedTree:b,
|
|
2448
|
+
preparedRef:T,saveCommit:R,standInIdentity:pa(E)}}async function uP(e,t,r={}){let{commandOptions:n={},connectedWorkSnapshots:o=[],
|
|
2449
2449
|
onPublicationAttempt:i,prepared:s={},project:a={}}=r;return Pg(e,t,{canonicalCommit:y(s.canonicalCommit),contributionAuthority:s.
|
|
2450
2450
|
contributionAuthority,saveCommit:y(s.saveCommit)},{commandOptions:n,connectedWorkSnapshots:o,onPublicationAttempt:i,project:a})}
|
|
2451
|
-
function
|
|
2451
|
+
function dP(e,t,r,n,o){return{baseCommit:e.baseCommit,cacheMaintenance:o.cacheMaintenance,canonicalCommit:r.canonicalCommit,
|
|
2452
2452
|
changeBaseCommit:r.changeBaseCommit,changedPaths:r.changedPaths,checkpointCommit:t.checkpointCommit,checkpointTree:t.checkpointTree,
|
|
2453
2453
|
mergedTree:r.mergedTree,mode:e.mode,ok:!0,operationId:t.operationId,preparedRef:r.preparedRef,saveCommit:r.saveCommit,sessionHead:t.
|
|
2454
|
-
sessionHead,standInIdentity:r.standInIdentity===!0,status:o.status,verifiedCommit:n,...o}}function
|
|
2454
|
+
sessionHead,standInIdentity:r.standInIdentity===!0,status:o.status,verifiedCommit:n,...o}}function pP(e,t){return e.mode!==
|
|
2455
2455
|
q?{attempted:!1,kind:"none",retryable:!1,status:"not_applicable"}:{attempted:!1,branch:e.branch,kind:"github_mirror",retryable:!1,
|
|
2456
2456
|
status:"deferred",verifiedCommit:t}}async function ec({commandOptions:e={},operationId:t="",project:r={},runCommand:n=M,session:o={},verifiedCommit:i=""}={}){
|
|
2457
2457
|
let s=U(o,r);return n=J(n,s,r,{label:"Maintaining saved repository cache",operationId:t}),Qa(n,s,y(i),{commandOptions:e,
|
|
2458
|
-
project:r})}async function
|
|
2459
|
-
message:i="",operationId:s=xg.randomUUID(),project:a={},refreshDerivedArtifacts:c,runCommand:l=M,runProjectSourceExclusive:u=async
|
|
2460
|
-
onProgress:d=nr,session:p={}}={}){let
|
|
2461
|
-
{kind:"lock",message:"Waiting for exclusive repository access.",stage:"repository-lock"}),u(async()=>{await d({baseCommit:
|
|
2462
|
-
baseCommit,branch:
|
|
2463
|
-
stage:"checkpointing"});let h;e?(await Qt(l,
|
|
2464
|
-
project:a})):h=await kg(l,
|
|
2458
|
+
project:r})}async function mP(e,t,r,n={}){y(r)&&await Ce(e,t,Go(t,r),n)}async function $g({checkpoint:e=null,commandOptions:t={},connectedWorkSnapshots:r=[],deferCacheMaintenance:n=!1,derivedArtifactPaths:o=[],
|
|
2459
|
+
message:i="",operationId:s=xg.randomUUID(),project:a={},refreshDerivedArtifacts:c,runCommand:l=M,runProjectSourceExclusive:u=async m=>m(),
|
|
2460
|
+
onProgress:d=nr,session:p={}}={}){let m=U(p,a),f=Ya(r);return l=J(l,m,a,{label:"Saving session work",operationId:s}),await d(
|
|
2461
|
+
{kind:"lock",message:"Waiting for exclusive repository access.",stage:"repository-lock"}),u(async()=>{await d({baseCommit:m.
|
|
2462
|
+
baseCommit,branch:m.branch,kind:"checkpoint",message:"Capturing the complete session worktree.",mode:m.mode,operationId:s,
|
|
2463
|
+
stage:"checkpointing"});let h;e?(await Qt(l,m,{commandOptions:t,project:a}),h=await cP(l,m,e,{commandOptions:t,operationId:s,
|
|
2464
|
+
project:a})):h=await kg(l,m,{commandOptions:t,operationId:s,project:a}),await d({checkpointCommit:h.checkpointCommit,checkpointTree:h.
|
|
2465
2465
|
checkpointTree,kind:"checkpoint",message:"Session checkpoint captured.",stage:"checkpointed"}),await d({kind:"canonical",
|
|
2466
|
-
message:"Reading the current canonical branch.",stage:"canonical-reading"});let _=await
|
|
2467
|
-
connectedWorkSnapshots:
|
|
2466
|
+
message:"Reading the current canonical branch.",stage:"canonical-reading"});let _=await lP(l,m,{checkpoint:h,commandOptions:t,
|
|
2467
|
+
connectedWorkSnapshots:f,derivedArtifactPaths:o,message:i,operationId:s,project:a,refreshDerivedArtifacts:c}),g=!1,S;try{
|
|
2468
2468
|
await d({expectedCanonicalCommit:_.canonicalCommit,kind:"canonical",message:"Canonical branch read.",stage:"canonical-re\
|
|
2469
2469
|
ad"}),await d({expectedCanonicalCommit:_.canonicalCommit,kind:"publish",mergedTree:_.mergedTree,message:"Save commit pre\
|
|
2470
2470
|
pared.",proposedCommit:_.saveCommit,stage:"prepared"}),await d({kind:"publish",message:"Pushing the Save commit.",stage:"\
|
|
2471
|
-
publishing"}),S=await
|
|
2472
|
-
throw g||await A(l,
|
|
2471
|
+
publishing"}),S=await uP(l,m,{commandOptions:t,connectedWorkSnapshots:f,onPublicationAttempt(){g=!0},prepared:_,project:a})}catch(R){
|
|
2472
|
+
throw g||await A(l,m,["update-ref","-d",_.preparedRef,_.saveCommit],{commandOptions:t,project:a}),R}await d({kind:"publi\
|
|
2473
2473
|
sh",message:"Canonical Save commit verified.",stage:"published",verifiedCommit:S}),await d({kind:"reconcile",message:"Re\
|
|
2474
|
-
conciling the session onto the saved commit.",stage:"reconciling"});let v=await Za(l,
|
|
2475
|
-
checkpointTree:h.checkpointTree,commandOptions:t,project:a,saveCommit:_.saveCommit,sessionHead:h.sessionHead}),b=n?
|
|
2474
|
+
conciling the session onto the saved commit.",stage:"reconciling"});let v=await Za(l,m,{checkpointCommit:h.checkpointCommit,
|
|
2475
|
+
checkpointTree:h.checkpointTree,commandOptions:t,project:a,saveCommit:_.saveCommit,sessionHead:h.sessionHead}),b=n?pP(m,
|
|
2476
2476
|
S):await ec({commandOptions:t,operationId:s,project:a,runCommand:l,session:p,verifiedCommit:S});return b.retryable===!0&&
|
|
2477
|
-
await d({cacheMaintenance:b,kind:"cache-warning",message:b.message,stage:"cache-maintenance-warning"}),n||await
|
|
2478
|
-
{commandOptions:t,project:a}),
|
|
2477
|
+
await d({cacheMaintenance:b,kind:"cache-warning",message:b.message,stage:"cache-maintenance-warning"}),n||await mP(l,m,s,
|
|
2478
|
+
{commandOptions:t,project:a}),dP(m,h,_,S,{cacheMaintenance:b,...v})},{operation:`save-session:${m.sessionId}`})}var gP=1024*1024,bP={incoming:Yo,"incoming-change":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");
|
|
2479
2479
|
return Og({...e,refreshDerivedArtifacts:t})},"change-diff":Xa,changes:Jo,"check-updates":wg,save:async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");
|
|
2480
2480
|
return $g({...e,deferCacheMaintenance:!0,refreshDerivedArtifacts:t})},"save-maintenance":ec,"save-message":async e=>{if(e.
|
|
2481
|
-
derivedArtifactPaths?.length&&
|
|
2481
|
+
derivedArtifactPaths?.length&&fP(hP.join(e.session.sourcePath,"genesis/blueprint.md"))){let{inspectGenesisStackComponents:t}=await import("@local/vibe64-genesis/server");
|
|
2482
2482
|
await t({projectRoot:e.session.sourcePath})}return Ng(e)},work:Vr,"update-failure":Ig,"update-checkpoint":qo,"update-pre\
|
|
2483
2483
|
pare":_g,"update-derived":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");return Sg({
|
|
2484
|
-
...e,refreshDerivedArtifacts:t})},"update-apply":Eg};function
|
|
2484
|
+
...e,refreshDerivedArtifacts:t})},"update-apply":Eg};function yP(e={}){return rt(e.command,e.args,{cwd:e.cwd,env:{...process.
|
|
2485
2485
|
env,...e.env||{}},execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,timeout:e.timeout})}
|
|
2486
|
-
async function
|
|
2487
|
-
"Session repository operation input is too large.");return JSON.parse(e||"{}")}function
|
|
2486
|
+
async function wP(){let e="";for await(let t of process.stdin)if(e+=String(t||""),Buffer.byteLength(e)>gP)throw new Error(
|
|
2487
|
+
"Session repository operation input is too large.");return JSON.parse(e||"{}")}function _P(e){return{error:{code:String(
|
|
2488
2488
|
e?.code||"vibe64_session_work_operation_failed"),details:e?.details&&typeof e.details=="object"&&!Array.isArray(e.details)?
|
|
2489
2489
|
e.details:{},message:String(e?.message||"Session repository operation failed."),...e?.messageCode?{messageCode:e.messageCode,
|
|
2490
|
-
messageParams:e.messageParams}:{},status:e instanceof he?e.status:500},ok:!1}}try{let e=await
|
|
2491
|
-
let t=
|
|
2492
|
-
e64_session_work_operation_unsupported",n}let r=await t({...e.input&&typeof e.input=="object"?e.input:{},runCommand:
|
|
2493
|
-
process.stdout.write(JSON.stringify({ok:!0,value:r}))}catch(e){process.stdout.write(JSON.stringify(
|
|
2490
|
+
messageParams:e.messageParams}:{},status:e instanceof he?e.status:500},ok:!1}}try{let e=await wP();sa(e?.hostProfile||null);
|
|
2491
|
+
let t=bP[String(e?.operation||"")];if(!t){let n=new Error("Unsupported session repository operation.");throw n.code="vib\
|
|
2492
|
+
e64_session_work_operation_unsupported",n}let r=await t({...e.input&&typeof e.input=="object"?e.input:{},runCommand:yP});
|
|
2493
|
+
process.stdout.write(JSON.stringify({ok:!0,value:r}))}catch(e){process.stdout.write(JSON.stringify(_P(e))),process.exitCode=
|
|
2494
2494
|
1}
|