vibe64 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.js +1919 -1660
- package/bin/server.js +158 -111
- package/bin/upgrade-state.js +5783 -5605
- package/dist/assets/GithubBrowserTabs-BzJF4k9Y.js +1 -0
- package/dist/assets/{StudioErrorNotice-sQfmeR-z.js → StudioErrorNotice-BdllGqRy.js} +1 -1
- package/dist/assets/{Vibe64AsyncModuleState-Dx7YKRPp.js → Vibe64AsyncModuleState-Bi0TqlIu.js} +1 -1
- package/dist/assets/Vibe64AuthSettingsButton-BuvmwGiT.js +5 -0
- package/dist/assets/Vibe64AuthSettingsButton-M44SSmZ9.css +1 -0
- package/dist/assets/{Vibe64DashboardBackButton-yE6cyYg2.js → Vibe64DashboardBackButton-Ccd4hpD6.js} +1 -1
- package/dist/assets/Vibe64DashboardShell-D67m4aWz.js +1 -0
- package/dist/assets/{Vibe64DashboardShell-MBkUHjs-.css → Vibe64DashboardShell-De2mbdpI.css} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-BONJdxBS.js → Vibe64DatabaseWorkspace-D3uK1gDm.js} +3 -3
- package/dist/assets/{Vibe64DatabaseWorkspace-CR4pzzcf.css → Vibe64DatabaseWorkspace-DPDMxhAW.css} +1 -1
- package/dist/assets/Vibe64OutputControls-BfESn5kJ.js +8 -0
- package/dist/assets/Vibe64OutputControls-D2CCECo5.css +1 -0
- package/dist/assets/{Vibe64RepositoryWorkspace-ByQlZbyO.js → Vibe64RepositoryWorkspace-0jAxvdA8.js} +2 -2
- package/dist/assets/{Vibe64RepositoryWorkspace-CVHcT93M.css → Vibe64RepositoryWorkspace-Agyt4O-V.css} +1 -1
- package/dist/assets/Vibe64SessionFiles-B3ONZrBL.css +1 -0
- package/dist/assets/Vibe64SessionFiles-BCOJ4QmR.js +41 -0
- package/dist/assets/{Vibe64TemporaryAiFixAction-BGlcrq4d.js → Vibe64TemporaryAiFixAction-DM2jpPbQ.js} +1 -1
- package/dist/assets/{Vibe64UiStoryboardView-Brlwdvqi.js → Vibe64UiStoryboardView-DP5af46a.js} +1 -1
- package/dist/assets/{Vibe64UnavailableSessions-zwlWlcZD.js → Vibe64UnavailableSessions-C7XwH1SS.js} +1 -1
- package/dist/assets/{_sessionId_-CvOkQbVy.js → _sessionId_-B1Ymr7c_.js} +1 -1
- package/dist/assets/{_sessionTool_-Dwod5ns9.js → _sessionTool_-DVYdREoI.js} +1 -1
- package/dist/assets/_slug_-CQseA9pt.css +1 -0
- package/dist/assets/_slug_-CYO2vjCd.js +24 -0
- package/dist/assets/{access-BVu5XYm2.js → access-Cb7dkN53.js} +1 -1
- package/dist/assets/app-BvgY7oVf.js +1 -0
- package/dist/assets/app-CZu7oxUO.css +1 -0
- package/dist/assets/{assistantRouting-CwbwfkwB.js → assistantRouting-B38ujQ7x.js} +1 -1
- package/dist/assets/{changes-olY8cnFK.js → changes-lsBcuikn.js} +1 -1
- package/dist/assets/client-CRI5CNKl.js +2 -0
- package/dist/assets/client-TGaWwOhc.css +1 -0
- package/dist/assets/conversation-CDEt9jBx.js +17 -0
- package/dist/assets/conversation-vxJGwmtW.css +1 -0
- package/dist/assets/{dashboard-BnXD-H4R.js → dashboard-D8HOAw46.js} +1 -1
- package/dist/assets/definitions-DLTX17nI.js +1 -0
- package/dist/assets/{env-DJhnLOH7.css → env-BzRtyO0w.css} +1 -1
- package/dist/assets/env-DJezQixO.js +1 -0
- package/dist/assets/health-BJvooRnJ.css +1 -0
- package/dist/assets/health-CtKdN_Nf.js +1 -0
- package/dist/assets/{history-BxlpB-YH.js → history-BdZFOtz4.js} +1 -1
- package/dist/assets/{incoming-BOxRVlOM.js → incoming-VsQNnL9m.js} +1 -1
- package/dist/assets/index-C-osVUKw.css +1 -0
- package/dist/assets/index-C4K3ntms.js +138 -0
- package/dist/assets/{integrations-BFltGDVI.js → integrations-CMQ9EDmt.js} +2 -2
- package/dist/assets/issues-DHpY5hSr.js +1 -0
- package/dist/assets/learning-DXlMuwzh.js +1 -0
- package/dist/assets/mdi-yXT-CQ6u.js +1 -0
- package/dist/assets/placement-NpX2s7u8.js +1 -0
- package/dist/assets/pull-requests-BcKNEUYH.js +1 -0
- package/dist/assets/{repository-JWLVST3D.js → repository-ClEgntHW.js} +1 -1
- package/dist/assets/roboto-latin-wght-normal-ccAYIvAh.woff2 +0 -0
- package/dist/assets/{session-C5Nj8Dlq.js → session-BlD46q-d.js} +1 -1
- package/dist/assets/settings-BwukeIKe.js +1 -0
- package/dist/assets/shared-BM2SV6fi.js +2 -0
- package/dist/assets/studioGateApi-DcCqiD9V.js +1 -0
- package/dist/assets/studioUrls-DmMMIScP.js +1 -0
- package/dist/assets/useArchivedVibe64Sessions-D5zUA-BC.js +1 -0
- package/dist/assets/useCommand-Bqxb-naz.js +1 -0
- package/dist/assets/useEndpointResource-DWoQ2keu.js +1 -0
- package/dist/assets/useRealtimeEvent-Bwapstla.js +1 -0
- package/dist/assets/{useUiFeedback-0FqKuZRP.js → useUiFeedback-BPBF_0bp.js} +1 -1
- package/dist/assets/useVibe64ConversationLog-Dy6YTPQn.js +1 -0
- package/dist/assets/useVibe64DatabaseTools-d6L09ugW.js +1 -0
- package/dist/assets/useVibe64Learning-cNKTv64W.js +1 -0
- package/dist/assets/useVibe64ProjectScope-Bp1ImZlz.js +1 -0
- package/dist/assets/useVibe64SessionData-C_jqncih.js +1 -0
- package/dist/assets/useVibe64SessionSelection-uCEIWd3b.js +1 -0
- package/dist/assets/useVibe64SystemGraph-B4RmsC9Y.js +1 -0
- package/dist/assets/{useVibe64Terminal-BPnN25WH.js → useVibe64Terminal-BbghGR4x.js} +1 -1
- package/dist/assets/vibe64AssistantHost-BL1bnKm8.js +1 -0
- package/dist/assets/{vibe64SessionFocus-kqPOPaOH.js → vibe64SessionFocus-DSJKVuRN.js} +1 -1
- package/dist/assets/{vibe64SessionInfo-BHxtTrLX.js → vibe64SessionInfo-B_r1OMN0.js} +1 -1
- package/dist/assets/{vibe64SessionPanelModel-BMf64fv7.js → vibe64SessionPanelModel-DDorOuiL.js} +1 -1
- package/dist/assets/{vibe64SessionToolDefinitions-NfLd1HZI.js → vibe64SessionToolDefinitions-BualCK_5.js} +1 -1
- package/dist/index.html +21 -20
- package/docs/colleague-usage/account-profile-and-appearance.md +8 -2
- package/docs/colleague-usage/ai-accounts-and-routing.md +123 -15
- package/docs/colleague-usage/ai-onboarding.md +230 -0
- package/docs/colleague-usage/coding-agent-goal-pause.md +5 -5
- package/docs/colleague-usage/coding-agents.md +17 -0
- package/docs/colleague-usage/colleague-watches.md +4 -23
- package/docs/colleague-usage/colleague.md +10 -2
- package/docs/colleague-usage/connected-projects.md +2 -2
- package/docs/colleague-usage/conversation-context.md +2 -0
- package/docs/colleague-usage/dashboard-navigation.md +19 -27
- package/docs/colleague-usage/database.md +6 -11
- package/docs/colleague-usage/development-copies.md +2 -1
- package/docs/colleague-usage/development-env.md +6 -0
- package/docs/colleague-usage/github-work.md +9 -0
- package/docs/colleague-usage/health-checks.md +11 -5
- package/docs/colleague-usage/integrations.md +3 -1
- package/docs/colleague-usage/learning-code-questions.md +23 -51
- package/docs/colleague-usage/learning-course-catalogue.md +8 -6
- package/docs/colleague-usage/learning-environment.md +345 -0
- package/docs/colleague-usage/learning-history.md +70 -101
- package/docs/colleague-usage/learning-mode-ui.md +122 -214
- package/docs/colleague-usage/learning-practice-projects.md +168 -78
- package/docs/colleague-usage/learning-teacher-guide.md +48 -26
- package/docs/colleague-usage/learning-with-colleague.md +171 -216
- package/docs/colleague-usage/lesson-authoring.md +32 -24
- package/docs/colleague-usage/managed-app-access.md +7 -0
- package/docs/colleague-usage/message-delivery-recovery.md +7 -6
- package/docs/colleague-usage/preview-browser-checks.md +9 -1
- package/docs/colleague-usage/preview-starting-application.md +0 -1
- package/docs/colleague-usage/preview.md +9 -1
- package/docs/colleague-usage/project-messages.md +2 -2
- package/docs/colleague-usage/project-setup.md +9 -2
- package/docs/colleague-usage/running-vibe64-on-your-computer.md +61 -0
- package/docs/colleague-usage/sessions.md +25 -33
- package/docs/colleague-usage/teaching-content.md +11 -40
- package/docs/colleague-usage/temporary-chats.md +23 -2
- package/docs/colleague-usage/voice-chat.md +5 -10
- package/docs/colleague-usage/voice-face-and-speaking-voice.md +6 -8
- package/docs/colleague-usage/voice-recovery.md +3 -2
- package/docs/templates/learn-topic/README.md +6 -6
- package/docs/templates/learn-topic/training/lessons/TOPIC-01/lesson.json +28 -7
- package/docs/templates/learn-topic/training/lessons/TOPIC-01/notes.md +19 -0
- package/docs/templates/learn-topic/training/lessons/TOPIC-01/steps/check-understanding.md +3 -0
- package/docs/templates/learn-topic/training/lessons/TOPIC-01/steps/explain-idea.md +3 -0
- package/docs/templates/learn-topic/training/lessons/TOPIC-01/steps/try-it.md +3 -0
- package/docs/templates/learn-topic/training/outline.md +1 -1
- package/docs/training-content.md +179 -65
- 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-runtime/patterns/assistant-surface/PATTERN.md +3 -2
- package/node_modules/@jskit-ai/assistant-runtime/patterns/assistant-surface/example/integrations.json +3 -2
- package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/patterns/ai-connections/PATTERN.md +4 -3
- package/node_modules/@jskit-ai/connectors-catalog/src/shared/ai-models.json +0 -1
- package/node_modules/@local/vibe64-accounts/package.json +1 -0
- package/node_modules/@local/vibe64-colleague/package.json +2 -1
- package/node_modules/@local/vibe64-core/package.json +3 -0
- package/node_modules/@local/vibe64-execution/package.json +1 -0
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +171 -174
- package/node_modules/@local/vibe64-execution/src/server/engines/stdioBridge.js +9 -9
- package/node_modules/@local/vibe64-genesis/README.md +10 -37
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +790 -779
- package/node_modules/@local/vibe64-genesis/package.json +1 -0
- package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +255 -0
- package/node_modules/@local/vibe64-genesis/src/server/index.js +473 -450
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +148 -148
- package/node_modules/@local/vibe64-project/package.json +2 -1
- package/node_modules/@local/vibe64-runtime/package.json +1 -2
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +526 -512
- package/node_modules/@local/vibe64-runtime/src/shared/assistantRoutingScores.json +0 -1
- package/node_modules/@local/vibe64-source-editor/package.json +1 -0
- package/node_modules/@local/vibe64-terminals/package.json +1 -0
- package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +129 -131
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1508 -1456
- package/node_modules/@local/vibe64-training/package.json +13 -27
- package/package.json +7 -7
- package/server.bundle.mjs +40946 -41456
- package/dist/assets/GithubBrowserTabs-DO5PHon-.js +0 -1
- package/dist/assets/GithubMarkdown-BQ6MfCDJ.js +0 -3
- package/dist/assets/GithubMarkdown-U7-j-qNI.css +0 -1
- package/dist/assets/Vibe64DashboardShell-CuCVMhOc.js +0 -1
- package/dist/assets/Vibe64OutputControls-DAAmA09l.js +0 -8
- package/dist/assets/Vibe64OutputControls-DPBsyDZM.css +0 -1
- package/dist/assets/Vibe64SessionFiles-B0u9HKdF.js +0 -107
- package/dist/assets/Vibe64SessionFiles-NjOMVwPR.css +0 -1
- package/dist/assets/_slug_-B31c15cc.css +0 -1
- package/dist/assets/_slug_-Dy35qLo1.js +0 -1
- package/dist/assets/app-DRXCcv05.css +0 -1
- package/dist/assets/app-zt7HwQKT.js +0 -1
- package/dist/assets/client-BrV4QPwG.js +0 -2
- package/dist/assets/client-C1bwIlu6.css +0 -1
- package/dist/assets/definitions-DaOPIkyB.js +0 -1
- package/dist/assets/env-DN0vW4EI.js +0 -1
- package/dist/assets/health-7oIQODer.css +0 -1
- package/dist/assets/health-Z6m96GDr.js +0 -1
- package/dist/assets/index-BUq-MczL.js +0 -86
- package/dist/assets/index-DtmBqE3h.css +0 -1
- package/dist/assets/issues-1iS5zoed.js +0 -1
- package/dist/assets/layout-BkWVNT37.js +0 -1
- package/dist/assets/mdi-C54lQ0i_.js +0 -1
- package/dist/assets/placement-DLsU3pCW.js +0 -1
- package/dist/assets/pull-requests-BJOwNL4k.js +0 -1
- package/dist/assets/settings-c273Ikrm.js +0 -1
- package/dist/assets/shared-YZb7ocaK.js +0 -2
- package/dist/assets/studioGateApi-DhA9IJGZ.js +0 -1
- package/dist/assets/studioUrls-Dj8rXeXO.js +0 -1
- package/dist/assets/useArchivedVibe64Sessions-CVZx2Rtm.js +0 -1
- package/dist/assets/useCommand-DWuxfAV0.js +0 -1
- package/dist/assets/useEndpointResource-MWVNfmMa.js +0 -1
- package/dist/assets/useVibe64ConversationLog-8cKh1eDm.js +0 -1
- package/dist/assets/useVibe64DatabaseTools-BcRG1s3i.js +0 -1
- package/dist/assets/useVibe64LearningMode-Bl0dGdCh.js +0 -28
- package/dist/assets/useVibe64LearningMode-C3PcXdVg.css +0 -1
- package/dist/assets/useVibe64ProjectScope-DOEVkBqX.js +0 -1
- package/dist/assets/useVibe64SessionData-DFTyLzci.js +0 -1
- package/dist/assets/useVibe64SessionSelection-j9lsllx4.js +0 -1
- package/dist/assets/useVibe64SystemGraph-tNkIwSBQ.js +0 -1
- package/dist/assets/vibe64AssistantHost-DdE_-lZF.js +0 -1
- package/dist/assets/vibe64LessonDashboard-DlKYjisq.js +0 -1
- package/dist/assets/vibe64ProjectScope.local-DqT6e5un.js +0 -1
- package/docs/colleague-usage/learning-chat-retention.md +0 -74
- package/docs/colleague-usage/learning-diagrams-and-voice.md +0 -97
- package/docs/colleague-usage/learning-lesson-watch.md +0 -95
- package/docs/colleague-usage/learning-native-session.md +0 -206
- package/docs/colleague-usage/learning-practical-exercises.md +0 -71
- package/docs/colleague-usage/learning-practical-gestures.md +0 -48
- package/docs/colleague-usage/learning-session-creation.md +0 -95
- package/docs/colleague-usage/lesson-practical-assessment.md +0 -54
- package/docs/colleague-usage/preview-lesson-presentation.md +0 -56
- package/docs/templates/learn-topic/training/lessons/TOPIC-01/lesson.md +0 -44
|
@@ -1,120 +1,124 @@
|
|
|
1
1
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
2
|
-
var
|
|
3
|
-
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var V=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var
|
|
4
|
-
enumerable:!(n=
|
|
2
|
+
var zf=Object.create;var Os=Object.defineProperty;var Gf=Object.getOwnPropertyDescriptor;var Hf=Object.getOwnPropertyNames;var Ff=Object.getPrototypeOf,jf=Object.prototype.hasOwnProperty;var Ee=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){
|
|
3
|
+
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var V=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var Vf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hf(t))!jf.call(e,o)&&o!==r&&Os(e,o,{get:()=>t[o],
|
|
4
|
+
enumerable:!(n=Gf(t,o))||n.enumerable});return e};var Wf=(e,t,r)=>(r=e!=null?zf(Ff(e)):{},Vf(t||!e||!e.__esModule?Os(r,"default",{value:e,enumerable:!0}):r,e));var ua=V((VI,la)=>{la.exports=ca;ca.sync=th;var sa=Ee("fs");function eh(e,t){var r=t.pathExt!==void 0?t.pathExt:process.
|
|
5
5
|
env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&
|
|
6
|
-
e.substr(-o.length).toLowerCase()===o)return!0}return!1}function
|
|
7
|
-
t,r)}function
|
|
8
|
-
function
|
|
6
|
+
e.substr(-o.length).toLowerCase()===o)return!0}return!1}function aa(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:eh(
|
|
7
|
+
t,r)}function ca(e,t,r){sa.stat(e,function(n,o){r(n,n?!1:aa(o,e,t))})}function th(e,t){return aa(sa.statSync(e),e,t)}});var ha=V((WI,ma)=>{ma.exports=pa;pa.sync=rh;var da=Ee("fs");function pa(e,t,r){da.stat(e,function(n,o){r(n,n?!1:fa(o,t))})}
|
|
8
|
+
function rh(e,t){return fa(da.statSync(e),t)}function fa(e,t){return e.isFile()&&nh(e,t)}function nh(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
|
|
11
|
-
sync=
|
|
12
|
-
llback not provided");return new Promise(function(n,o){
|
|
13
|
-
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function
|
|
14
|
-
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var
|
|
15
|
-
|
|
16
|
-
match(/\//)||
|
|
17
|
-
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=
|
|
18
|
-
""),{pathEnv:n,pathExt:i,pathExtExe:o}},
|
|
19
|
-
pathExtExe:i}=
|
|
20
|
-
test(
|
|
21
|
-
if(d===o.length)return
|
|
22
|
-
return
|
|
23
|
-
e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=
|
|
24
|
-
e)?e.slice(0,2)+l:l;for(let d=0;d<n.length;d++){let
|
|
25
|
-
if(t.all&&i.length)return i;if(t.nothrow)return null;throw
|
|
26
|
-
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};
|
|
10
|
+
a=parseInt("100",8),c=parseInt("010",8),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 ba=V((YI,ga)=>{var qI=Ee("fs"),hr;process.platform==="win32"||global.TESTING_WINDOWS?hr=ua():hr=ha();ga.exports=fo;fo.
|
|
11
|
+
sync=oh;function fo(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("ca\
|
|
12
|
+
llback not provided");return new Promise(function(n,o){fo(e,t||{},function(i,s){i?o(i):n(s)})})}hr(e,t||{},function(n,o){
|
|
13
|
+
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function oh(e,t){try{return hr.sync(e,t||{})}catch(r){
|
|
14
|
+
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Ta=V((KI,va)=>{var We=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",wa=Ee("path"),
|
|
15
|
+
ih=We?";":":",ya=ba(),_a=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Sa=(e,t)=>{let r=t.colon||ih,n=e.
|
|
16
|
+
match(/\//)||We&&e.match(/\\/)?[""]:[...We?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=We?t.pathExt||
|
|
17
|
+
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=We?o.split(r):[""];return We&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(
|
|
18
|
+
""),{pathEnv:n,pathExt:i,pathExtExe:o}},Ea=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,
|
|
19
|
+
pathExtExe:i}=Sa(e,t),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return t.all&&s.length?u(s):d(_a(e));let p=n[l],f=/^".*"$/.
|
|
20
|
+
test(p)?p.slice(1,-1):p,m=wa.join(f,e),h=!f&&/^\.[\\\/]/.test(e)?e.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((p,f)=>{
|
|
21
|
+
if(d===o.length)return p(a(u+1));let m=o[d];ya(l+m,{pathExt:i},(h,y)=>{if(!h&&y)if(t.all)s.push(l+m);else return p(l+m);
|
|
22
|
+
return p(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},sh=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Sa(
|
|
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=wa.join(c,e),u=!c&&/^\.[\\\/]/.test(
|
|
24
|
+
e)?e.slice(0,2)+l:l;for(let d=0;d<n.length;d++){let p=u+n[d];try{if(ya.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 _a(e)};va.exports=Ea;Ea.sync=sh});var Ia=V((JI,mo)=>{"use strict";var Aa=(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"};mo.exports=Aa;mo.exports.default=Aa});var Ca=V((XI,Oa)=>{"use strict";var Ra=Ee("path"),ah=Ta(),ch=Ia();function Pa(e,t){let r=e.options.env||process.env,n=process.
|
|
27
27
|
cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}
|
|
28
|
-
let s;try{s=
|
|
29
|
-
(s=
|
|
30
|
-
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(
|
|
31
|
-
"^$1"),t&&(e=e.replace(
|
|
32
|
-
/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
e.file),e.command=t,
|
|
36
|
-
test(t);e.command=
|
|
28
|
+
let s;try{s=ah.sync(e.command,{path:r[ch({env:r})],pathExt:t?Ra.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&
|
|
29
|
+
(s=Ra.resolve(o?e.options.cwd:"",s)),s}function lh(e){return Pa(e)||Pa(e,!0)}Oa.exports=lh});var xa=V((ZI,go)=>{"use strict";var ho=/([()\][%!^"`<>&|;, *?])/g;function uh(e){return e=e.replace(ho,"^$1"),e}function dh(e,t){
|
|
30
|
+
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(ho,
|
|
31
|
+
"^$1"),t&&(e=e.replace(ho,"^$1")),e}go.exports.command=uh;go.exports.argument=dh});var Na=V((QI,ka)=>{"use strict";ka.exports=/^#!(.*)/});var Ma=V((eR,$a)=>{"use strict";var ph=Na();$a.exports=(e="")=>{let t=e.match(ph);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 La=V((tR,Da)=>{"use strict";var bo=Ee("fs"),fh=Ma();function mh(e){let r=Buffer.alloc(150),n;try{n=bo.openSync(e,"r"),
|
|
33
|
+
bo.readSync(n,r,0,150,0),bo.closeSync(n)}catch{}return fh(r.toString())}Da.exports=mh});var Ga=V((rR,za)=>{"use strict";var hh=Ee("path"),Ba=Ca(),Ua=xa(),gh=La(),bh=process.platform==="win32",wh=/\.(?:com|exe)$/i,
|
|
34
|
+
yh=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function _h(e){e.file=Ba(e);let t=e.file&&gh(e.file);return t?(e.args.unshift(
|
|
35
|
+
e.file),e.command=t,Ba(e)):e.file}function Sh(e){if(!bh)return e;let t=_h(e),r=!wh.test(t);if(e.options.forceShell||r){let n=yh.
|
|
36
|
+
test(t);e.command=hh.normalize(e.command),e.command=Ua.command(e.command),e.args=e.args.map(i=>Ua.argument(i,n));let o=[
|
|
37
37
|
e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.
|
|
38
|
-
windowsVerbatimArguments=!0}return e}function
|
|
39
|
-
{},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:
|
|
40
|
-
command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function
|
|
41
|
-
if(!
|
|
42
|
-
e,arguments)}}function
|
|
43
|
-
!t.file?
|
|
44
|
-
n.command,n.args,n.options);return
|
|
45
|
-
n.args,n.options);return o.error=o.error||
|
|
46
|
-
sync=
|
|
47
|
-
import{promisify as
|
|
38
|
+
windowsVerbatimArguments=!0}return e}function Eh(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:Sh(n)}za.exports=Eh});var ja=V((nR,Fa)=>{"use strict";var wo=process.platform==="win32";function yo(e,t){return Object.assign(new Error(`${t} ${e.
|
|
40
|
+
command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function vh(e,t){
|
|
41
|
+
if(!wo)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=Ha(o,t);if(i)return r.call(e,"error",i)}return r.apply(
|
|
42
|
+
e,arguments)}}function Ha(e,t){return wo&&e===1&&!t.file?yo(t.original,"spawn"):null}function Th(e,t){return wo&&e===1&&
|
|
43
|
+
!t.file?yo(t.original,"spawnSync"):null}Fa.exports={hookChildProcess:vh,verifyENOENT:Ha,verifyENOENTSync:Th,notFoundError:yo}});var qa=V((oR,qe)=>{"use strict";var Va=Ee("child_process"),_o=Ga(),So=ja();function Wa(e,t,r){let n=_o(e,t,r),o=Va.spawn(
|
|
44
|
+
n.command,n.args,n.options);return So.hookChildProcess(o,n),o}function Ah(e,t,r){let n=_o(e,t,r),o=Va.spawnSync(n.command,
|
|
45
|
+
n.args,n.options);return o.error=o.error||So.verifyENOENTSync(o.status,n),o}qe.exports=Wa;qe.exports.spawn=Wa;qe.exports.
|
|
46
|
+
sync=Ah;qe.exports._parse=_o;qe.exports._enoent=So});import{existsSync as _T}from"node:fs";import ST from"node:path";import{execFile as qf}from"node:child_process";import{readFile as Yf}from"node:fs/promises";import qn from"node:os";import Kf from"node:path";
|
|
47
|
+
import{promisify as Jf}from"node:util";var Xf=Jf(qf);function er(e=""){return String(e||"").trim()}function xs(e=""){let t=er(e);if(!t||t.includes("/")||t.includes("\\")||t.
|
|
48
48
|
includes(":")){let r=new Error("A valid OS username is required.");throw r.code="vibe64_invalid_os_username",r}return t}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
r
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
function ks([e,t,r,n,o,i]=[]){if(!/^\d+$/u.test(t)||!/^\d+$/u.test(r))return null;let s=Number(t),a=Number(r);return!Number.
|
|
50
|
+
isSafeInteger(s)||!Number.isSafeInteger(a)?null:{displayName:String(n||"").split(",")[0],gid:a,home:String(o||""),shell:String(
|
|
51
|
+
i||""),uid:s,username:String(e||"")}}function Yn(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:ks([
|
|
52
|
+
t[0],t[2],t[3],t[4],t[5],t[6]])}function Zf(e=""){return String(e||"").split(/\r?\n[\t ]*\r?\n/u).map(t=>{let r={};for(let n of t.
|
|
53
|
+
split(/\r?\n/u)){let o=/^\s*([a-z]+):\s?(.*)$/u.exec(n);o&&(r[o[1]]=o[2].trim())}return ks([r.name,r.uid,r.gid,r.gecos,r.
|
|
54
|
+
dir,r.shell])}).filter(Boolean)}async function Cs(e,t,r){let n=await e(t,r,{encoding:"utf8"});return String((typeof n=="\
|
|
55
|
+
string"?n:n?.stdout)||"")}function vt({homedir:e=qn.homedir,userInfo:t=qn.userInfo}={}){let r=typeof t=="function"?t():{},
|
|
56
|
+
n=er(r?.username||process.env.USER||process.env.LOGNAME),o=Kf.resolve(String(r?.homedir||e()||""));return{displayName:String(
|
|
57
|
+
r?.username||n),gid:Number.isSafeInteger(r?.gid)?r.gid:null,home:o,shell:String(r?.shell||""),uid:Number.isSafeInteger(r?.
|
|
58
|
+
uid)?r.uid:null,username:n}}async function tr(e="",{execFileFn:t=Xf,platform:r=process.platform,readFileFn:n=Yf,userInfo:o=qn.
|
|
59
|
+
userInfo}={}){let i=xs(e);if(r==="linux"&&!/^\d+$/u.test(i)){let c=[...(await n("/etc/nsswitch.conf","utf8").catch(()=>"")).
|
|
60
|
+
matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*)/gmu)],l=c.length===1?c[0][1].trim().split(/\s+/u):[];if(l[0]==="files"&&
|
|
61
|
+
(l.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(l[1]))){let d=(await n("/etc/passwd","utf8").catch(()=>"")).split(/\r?\n/u).
|
|
62
|
+
map(Yn).find(p=>p?.username===i);if(d)return d}}let s;if(r==="darwin"){let a=vt({userInfo:o});if(a.username===i)return a;
|
|
63
|
+
[s]=Zf(await Cs(t,"dscacheutil",["-q","user","-a","name",i]))}else s=Yn((await Cs(t,"getent",["passwd",i])).split(/\r?\n/u)[0]);
|
|
64
|
+
if(!s||s.username!==i){let a=new Error(`OS user was not found: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}import em from"node:os";import Jn from"node:path";import Qf from"node:path";function C(e=""){return String(e??"").trim()}function Kn(e=null){let t=Number(e);return Number.
|
|
65
|
+
isSafeInteger(t)&&t>=0?t:null}function O(e=""){let t=C(e);return t?Qf.resolve(t):""}function F(e={}){return e&&typeof e==
|
|
66
|
+
"object"&&!Array.isArray(e)?e:{}}function G(e={}){return Object.fromEntries(Object.entries(F(e)).map(([t,r])=>[C(t),String(
|
|
67
|
+
r??"")]).filter(([t])=>!!t))}function Ce(e=[]){let t=[],r=new Set;for(let n of Array.isArray(e)?e:[e]){let o=C(n);!o||r.
|
|
68
|
+
has(o)||(r.add(o),t.push(o))}return t}function ge(...e){for(let t of e){let r=C(t);if(r)return r}return""}function rr(e={}){let t=C(e.username),r=O(e.home||(t?`/home/${t}`:em.homedir()));return{displayName:C(e.displayName||t),
|
|
69
|
+
gid:Kn(e.gid),home:r,shell:C(e.shell),uid:Kn(e.uid),username:t}}function Xn(){return rr(vt())}async function Zn(e="",t={}){
|
|
70
|
+
return rr(await tr(e,t))}function Qn(e={},t={}){let r=rr(e);return{...t,HOME:r.home,LOGNAME:r.username,USER:r.username,XDG_CACHE_HOME:Jn.
|
|
71
|
+
join(r.home,".cache"),XDG_CONFIG_HOME:Jn.join(r.home,".config"),XDG_DATA_HOME:Jn.join(r.home,".local","share")}}function eo(e={},t={}){
|
|
72
|
+
return Qn(e,t)}function to(){return{gid:typeof process.getgid=="function"?process.getgid():null,uid:typeof process.getuid==
|
|
69
73
|
"function"?process.getuid():null}}function L(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||
|
|
70
|
-
Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}import{fileURLToPath as
|
|
71
|
-
must be a string or a file URL: ${r}.`);return r},
|
|
72
|
-
e)===String.prototype,
|
|
74
|
+
Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}import{fileURLToPath as tm}from"node:url";var Fe=(e,t)=>{let r=no(rm(e));if(typeof r!="string")throw new TypeError(`${t}\
|
|
75
|
+
must be a string or a file URL: ${r}.`);return r},rm=e=>ro(e)?e.toString():e,ro=e=>typeof e!="string"&&e&&Object.getPrototypeOf(
|
|
76
|
+
e)===String.prototype,no=e=>e instanceof URL?tm(e):e;var nr=(e,t=[],r={})=>{let n=Fe(e,"First argument"),[o,i]=L(t)?[[],t]:[t,r];if(!Array.isArray(o))throw new TypeError(`Se\
|
|
73
77
|
cond argument must be either an array of arguments or an options object: ${o}`);if(o.some(c=>typeof c=="object"&&c!==null))
|
|
74
78
|
throw new TypeError(`Second argument must be an array of strings: ${o}`);let s=o.map(String),a=s.find(c=>c.includes("\0"));
|
|
75
79
|
if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!L(i))throw new TypeError(`Las\
|
|
76
|
-
t argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as
|
|
77
|
-
Buffer]",B=e=>
|
|
78
|
-
|
|
79
|
-
"string"))return e;let r=new
|
|
80
|
-
...n,o]},
|
|
81
|
-
|
|
80
|
+
t argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as lm}from"node:child_process";import{StringDecoder as nm}from"node:string_decoder";var{toString:Ns}=Object.prototype,$s=e=>Ns.call(e)==="[object Array\
|
|
81
|
+
Buffer]",B=e=>Ns.call(e)==="[object Uint8Array]",be=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),om=new TextEncoder,
|
|
82
|
+
Ms=e=>om.encode(e),im=new TextDecoder,or=e=>im.decode(e),Ds=(e,t)=>sm(e,t).join(""),sm=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i==
|
|
83
|
+
"string"))return e;let r=new nm(t),n=e.map(i=>typeof i=="string"?Ms(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[
|
|
84
|
+
...n,o]},Tt=e=>e.length===1&&B(e[0])?e[0]:oo(am(e)),am=e=>e.map(t=>typeof t=="string"?Ms(t):t),oo=e=>{let t=new Uint8Array(
|
|
85
|
+
cm(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},cm=e=>{let t=0;for(let r of e)t+=r.length;return t};var zs=e=>Array.isArray(e)&&Array.isArray(e.raw),Gs=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=um({templates:e,expressions:t,
|
|
82
86
|
tokens:r,index:i,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[
|
|
83
|
-
n,o,{}]},
|
|
84
|
-
lash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=
|
|
85
|
-
t.length)return c;let l=t[n],u=Array.isArray(l)?l.map(d
|
|
86
|
-
nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=
|
|
87
|
-
a+=1){let c=t[a];if(
|
|
88
|
-
`?(s-=1,a+=1):l==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=
|
|
89
|
-
leadingWhitespaces:o,trailingWhitespaces:i}},
|
|
90
|
-
`]),
|
|
91
|
-
1)]
|
|
92
|
-
e))return
|
|
87
|
+
n,o,{}]},um=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backs\
|
|
88
|
+
lash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=dm(o,e.raw[n]),c=Bs(r,i,s);if(n===
|
|
89
|
+
t.length)return c;let l=t[n],u=Array.isArray(l)?l.map(d=>Us(d)):[Us(l)];return Bs(c,u,a)},dm=(e,t)=>{if(t.length===0)return{
|
|
90
|
+
nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=Ls.has(t[0]);for(let s=0,a=0;s<e.length;s+=1,
|
|
91
|
+
a+=1){let c=t[a];if(Ls.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"){let l=t[a+1];l===`
|
|
92
|
+
`?(s-=1,a+=1):l==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=pm[l]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,
|
|
93
|
+
leadingWhitespaces:o,trailingWhitespaces:i}},Ls=new Set([" "," ","\r",`
|
|
94
|
+
`]),pm={x:3,u:5},Bs=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(
|
|
95
|
+
1)],Us=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(L(e)&&("stdout"in e||"isMaxBuffer"in
|
|
96
|
+
e))return fm(e);throw e instanceof lm||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected \
|
|
93
97
|
subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected \
|
|
94
|
-
"${t}" in template expression`)},
|
|
98
|
+
"${t}" in template expression`)},fm=({stdout:e})=>{if(typeof e=="string")return e;if(B(e))return or(e);throw e===void 0?
|
|
95
99
|
new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" o\
|
|
96
|
-
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as
|
|
97
|
-
`stdio[${e}]`;var
|
|
98
|
-
t);return
|
|
99
|
-
e),
|
|
100
|
-
-1,
|
|
100
|
+
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as by}from"node:child_process";import{debuglog as mm}from"node:util";import io from"node:process";var re=e=>ir.includes(e),ir=[io.stdin,io.stdout,io.stderr],Z=["stdin","stdout","stderr"],sr=e=>Z[e]??
|
|
101
|
+
`stdio[${e}]`;var Fs=e=>{let t={...e};for(let r of co)t[r]=so(e,r);return t},so=(e,t)=>{let r=Array.from({length:hm(e)+1}),n=gm(e[t],r,
|
|
102
|
+
t);return Sm(n,t)},hm=({stdio:e})=>Array.isArray(e)?Math.max(e.length,Z.length):Z.length,gm=(e,t,r)=>L(e)?bm(e,t,r):t.fill(
|
|
103
|
+
e),bm=(e,t,r)=>{for(let n of Object.keys(e).sort(wm))for(let o of ym(n,r,t))t[o]=e[n];return t},wm=(e,t)=>Hs(e)<Hs(t)?1:
|
|
104
|
+
-1,Hs=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,ym=(e,t,r)=>{if(e==="ipc")return[r.length-1];let n=ao(e);if(n===void 0||
|
|
101
105
|
n===0)throw new TypeError(`"${t}.${e}" is invalid.
|
|
102
106
|
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(n>=r.length)
|
|
103
107
|
throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
104
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},
|
|
105
|
-
if(
|
|
106
|
-
void 0?
|
|
107
|
-
|
|
108
|
-
e,t);return ar(r)?r:void 0},
|
|
109
|
-
"function",cr=["none","short","full"];import{inspect as
|
|
110
|
-
n=r.join(" "),o=r.map(i=>
|
|
111
|
-
`).map(t=>
|
|
112
|
-
`),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,
|
|
108
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},ao=e=>{if(e==="all")return e;
|
|
109
|
+
if(Z.includes(e))return Z.indexOf(e);let t=_m.exec(e);if(t!==null)return Number(t[1])},_m=/^fd(\d+)$/,Sm=(e,t)=>e.map(r=>r===
|
|
110
|
+
void 0?vm[t]:r),Em=mm("execa").enabled?"full":"none",vm={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Em,stripFinalNewline:!0},
|
|
111
|
+
co=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],we=(e,t)=>t==="ipc"?e.at(-1):e[t];var je=({verbose:e},t)=>lo(e,t)!=="none",Ve=({verbose:e},t)=>!["none","short"].includes(lo(e,t)),js=({verbose:e},t)=>{let r=lo(
|
|
112
|
+
e,t);return ar(r)?r:void 0},lo=(e,t)=>t===void 0?Tm(e):we(e,t),Tm=e=>e.find(t=>ar(t))??cr.findLast(t=>e.includes(t)),ar=e=>typeof e==
|
|
113
|
+
"function",cr=["none","short","full"];import{inspect as Wm}from"node:util";import{platform as Am}from"node:process";import{stripVTControlCharacters as Im}from"node:util";var Vs=(e,t)=>{let r=[e,...t],
|
|
114
|
+
n=r.join(" "),o=r.map(i=>km(Ws(i))).join(" ");return{command:n,escapedCommand:o}},At=e=>Im(e).split(`
|
|
115
|
+
`).map(t=>Ws(t)).join(`
|
|
116
|
+
`),Ws=e=>e.replaceAll(Om,t=>Rm(t)),Rm=e=>{let t=Cm[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=
|
|
117
|
+
xm?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Pm=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},
|
|
118
|
+
Om=Pm(),Cm={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},xm=65535,km=e=>Nm.test(e)?e:Am==="win32"?`"${e.
|
|
119
|
+
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,Nm=/^[\w./-]+$/;import qs from"node:process";function uo(){let{env:e}=qs,{TERM:t,TERM_PROGRAM:r}=e;return qs.platform!=="win32"?t!=="lin\
|
|
116
120
|
ux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xter\
|
|
117
|
-
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var
|
|
121
|
+
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ys={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",
|
|
118
122
|
squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\
|
|
119
123
|
\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",
|
|
120
124
|
triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\
|
|
@@ -154,55 +158,55 @@ lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUp
|
|
|
154
158
|
lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\
|
|
155
159
|
\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\
|
|
156
160
|
\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\
|
|
157
|
-
\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},
|
|
161
|
+
\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},Ks={tick:"\
|
|
158
162
|
\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\
|
|
159
163
|
\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\
|
|
160
164
|
\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",
|
|
161
165
|
pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\
|
|
162
166
|
\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",
|
|
163
|
-
oneNinth:"\u2151",oneTenth:"\u2152"}
|
|
167
|
+
oneNinth:"\u2151",oneTenth:"\u2152"},$m={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\
|
|
164
168
|
\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",
|
|
165
169
|
circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"\
|
|
166
170
|
( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\
|
|
167
171
|
\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"\
|
|
168
|
-
1/7",oneNinth:"1/9",oneTenth:"1/10"},
|
|
172
|
+
1/7",oneNinth:"1/9",oneTenth:"1/10"},Mm={...Ys,...Ks},Dm={...Ys,...$m},Lm=uo(),Bm=Lm?Mm:Dm,lr=Bm,hA=Object.entries(Ks);import Um from"node:tty";var zm=Um?.WriteStream?.prototype?.hasColors?.()??!1,T=(e,t)=>{if(!zm)return o=>o;let r=`\x1B[${e}\
|
|
169
173
|
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;)
|
|
170
|
-
a+=i.slice(c,s)+u,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},
|
|
171
|
-
4,24),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
49),
|
|
176
|
-
59),
|
|
177
|
-
58;5;12",59),
|
|
178
|
-
c=
|
|
174
|
+
a+=i.slice(c,s)+u,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},wA=T(0,0),Js=T(1,22),yA=T(2,22),_A=T(3,23),SA=T(
|
|
175
|
+
4,24),EA=T("4:2",24),vA=T("4:3",24),TA=T("4:4",24),AA=T("4:5",24),IA=T(53,55),RA=T(7,27),PA=T(8,28),OA=T(9,29),CA=T(30,39),
|
|
176
|
+
xA=T(31,39),kA=T(32,39),NA=T(33,39),$A=T(34,39),MA=T(35,39),DA=T(36,39),LA=T(37,39),ur=T(90,39),BA=T(40,49),UA=T(41,49),
|
|
177
|
+
zA=T(42,49),GA=T(43,49),HA=T(44,49),FA=T(45,49),jA=T(46,49),VA=T(47,49),WA=T(100,49),Xs=T(91,39),qA=T(92,39),Zs=T(93,39),
|
|
178
|
+
YA=T(94,39),KA=T(95,39),JA=T(96,39),XA=T(97,39),ZA=T(101,49),QA=T(102,49),eI=T(103,49),tI=T(104,49),rI=T(105,49),nI=T(106,
|
|
179
|
+
49),oI=T(107,49),iI=T("58;5;0",59),sI=T("58;5;1",59),aI=T("58;5;2",59),cI=T("58;5;3",59),lI=T("58;5;4",59),uI=T("58;5;5",
|
|
180
|
+
59),dI=T("58;5;6",59),pI=T("58;5;7",59),fI=T("58;5;8",59),mI=T("58;5;9",59),hI=T("58;5;10",59),gI=T("58;5;11",59),bI=T("\
|
|
181
|
+
58;5;12",59),wI=T("58;5;13",59),yI=T("58;5;14",59),_I=T("58;5;15",59);var ta=({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},options:{reject:s=!0}})=>{let a=Gm(r),
|
|
182
|
+
c=Hm[e]({failed:i,reject:s,piped:n}),l=Fm[e]({reject:s});return`${ur(`[${a}]`)} ${ur(`[${o}]`)} ${l(c)} ${l(t)}`},Gm=e=>`${dr(
|
|
179
183
|
e.getHours(),2)}:${dr(e.getMinutes(),2)}:${dr(e.getSeconds(),2)}.${dr(e.getMilliseconds(),3)}`,dr=(e,t)=>String(e).padStart(
|
|
180
|
-
t,"0"),
|
|
181
|
-
*",error:
|
|
182
|
-
o)).join("")},
|
|
184
|
+
t,"0"),Qs=({failed:e,reject:t})=>e?t?lr.cross:lr.warning:lr.tick,Hm={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"\
|
|
185
|
+
*",error:Qs,duration:Qs},ea=e=>e,Fm={command:()=>Js,output:()=>ea,ipc:()=>ea,error:({reject:e})=>e?Xs:Zs,duration:()=>ur};var ra=(e,t,r)=>{let n=js(t,r);return e.map(({verboseLine:o,verboseObject:i})=>jm(o,i,n)).filter(o=>o!==void 0).map(o=>Vm(
|
|
186
|
+
o)).join("")},jm=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},Vm=e=>e.endsWith(`
|
|
183
187
|
`)?e:`${e}
|
|
184
|
-
`;var
|
|
185
|
-
i),a=
|
|
186
|
-
piped:o=!1,...i}}})=>({type:e,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),
|
|
188
|
+
`;var le=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:n,result:o})=>{let i=qm({type:e,result:o,verboseInfo:n}),s=Ym(t,
|
|
189
|
+
i),a=ra(s,n,r);a!==""&&console.warn(a.slice(0,-1))},qm=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{
|
|
190
|
+
piped:o=!1,...i}}})=>({type:e,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),Ym=(e,t)=>e.
|
|
187
191
|
split(`
|
|
188
|
-
`).map(r=>
|
|
189
|
-
t).replaceAll(" "," ".repeat(
|
|
190
|
-
void 0,
|
|
192
|
+
`).map(r=>Km({...t,message:r})),Km=e=>({verboseLine:ta(e),verboseObject:e}),pr=e=>{let t=typeof e=="string"?e:Wm(e);return At(
|
|
193
|
+
t).replaceAll(" "," ".repeat(Jm))},Jm=2;var na=(e,t)=>{je(t)&&le({type:"command",verboseMessage:e,verboseInfo:t})};var oa=(e,t,r)=>{Qm(e);let n=Xm(e);return{verbose:e,escapedCommand:t,commandId:n,rawOptions:r}},Xm=e=>je({verbose:e})?Zm++:
|
|
194
|
+
void 0,Zm=0n,Qm=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: \
|
|
191
195
|
'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!cr.includes(
|
|
192
196
|
t)&&!ar(t)){let r=cr.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed val\
|
|
193
|
-
ues are: ${r} or a function.`)}}};import{hrtime as
|
|
194
|
-
escapedCommand:i,startTime:n,verboseInfo:a}};var
|
|
195
|
-
find(n=>n.toUpperCase()==="PATH")||"Path"}import{promisify as
|
|
196
|
-
import{fileURLToPath as
|
|
197
|
-
1024*1024;var
|
|
198
|
-
br(e)),s=[],a=t.split(
|
|
199
|
-
[...s,t].join(
|
|
200
|
-
o)}},
|
|
201
|
-
{env:e});return t.path=e[r],e[r]=
|
|
197
|
+
ues are: ${r} or a function.`)}}};import{hrtime as ia}from"node:process";var fr=()=>ia.bigint(),po=e=>Number(ia.bigint()-e)/1e6;var mr=(e,t,r)=>{let n=fr(),{command:o,escapedCommand:i}=Vs(e,t),s=so(r,"verbose"),a=oa(s,i,{...r});return na(i,a),{command:o,
|
|
198
|
+
escapedCommand:i,startTime:n,verboseInfo:a}};var ol=Wf(qa(),1);import Dg from"node:path";import nl from"node:process";import wr from"node:process";import xe from"node:path";function gr(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().
|
|
199
|
+
find(n=>n.toUpperCase()==="PATH")||"Path"}import{promisify as Ih}from"node:util";import{execFile as Rh,execFileSync as cR}from"node:child_process";import Ya from"node:path";
|
|
200
|
+
import{fileURLToPath as Ph}from"node:url";var dR=Ih(Rh);function br(e){return e instanceof URL?Ph(e):e}function Ka(e){return{*[Symbol.iterator](){let t=Ya.resolve(br(e)),r;for(;r!==t;)yield t,r=t,t=Ya.resolve(t,"..")}}}var pR=10*
|
|
201
|
+
1024*1024;var Oh=({cwd:e=wr.cwd(),path:t=wr.env[gr()],preferLocal:r=!0,execPath:n=wr.execPath,addExecPath:o=!0}={})=>{let i=xe.resolve(
|
|
202
|
+
br(e)),s=[],a=t.split(xe.delimiter);return r&&Ch(s,a,i),o&&xh(s,a,n,i),t===""||t===xe.delimiter?`${s.join(xe.delimiter)}${t}`:
|
|
203
|
+
[...s,t].join(xe.delimiter)},Ch=(e,t,r)=>{for(let n of Ka(r)){let o=xe.join(n,"node_modules/.bin");t.includes(o)||e.push(
|
|
204
|
+
o)}},xh=(e,t,r,n)=>{let o=xe.resolve(n,br(r),"..");t.includes(o)||e.push(o)},Ja=({env:e=wr.env,...t}={})=>{e={...e};let r=gr(
|
|
205
|
+
{env:e});return t.path=e[r],e[r]=Oh(t),e};import{setTimeout as Wh}from"node:timers/promises";var Xa=(e,t,r)=>{let n=r?Rt:It,o=e instanceof ne?{}:{cause:e};return new n(t,o)},ne=class extends Error{},Za=(e,t)=>{Object.
|
|
202
206
|
defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,
|
|
203
|
-
|
|
204
|
-
toString.call(e)==="[object Error]",
|
|
205
|
-
description:"Application-specific signal (realtime)",standard:"posix"}),
|
|
207
|
+
ec,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Qa=e=>yr(e)&&ec in e,ec=Symbol("isExecaError"),yr=e=>Object.prototype.
|
|
208
|
+
toString.call(e)==="[object Error]",It=class extends Error{};Za(It,It.name);var Rt=class extends Error{};Za(Rt,Rt.name);import{constants as Pt}from"node:os";import{constants as Mh}from"node:os";var tc=()=>{let e=nc-rc+1;return Array.from({length:e},kh)},kh=(e,t)=>({name:`SIGRT${t+1}`,number:rc+t,action:"terminate",
|
|
209
|
+
description:"Application-specific signal (realtime)",standard:"posix"}),rc=34,nc=64;import{constants as Nh}from"node:os";var oc=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,
|
|
206
210
|
action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"\
|
|
207
211
|
User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine ins\
|
|
208
212
|
truction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"\
|
|
@@ -233,1059 +237,1068 @@ other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event"
|
|
|
233
237
|
action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"termina\
|
|
234
238
|
te",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"In\
|
|
235
239
|
valid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"\
|
|
236
|
-
other"}];var
|
|
237
|
-
let{signals:{[e]:s}}=
|
|
238
|
-
standard:s})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s}],
|
|
239
|
-
r=Array.from({length:t},(n,o)
|
|
240
|
+
other"}];var Eo=()=>{let e=tc();return[...oc,...e].map($h)},$h=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{
|
|
241
|
+
let{signals:{[e]:s}}=Nh,a=s!==void 0;return{name:e,number:a?s:t,description:r,supported:a,action:n,forced:o,standard:i}};var Dh=()=>{let e=Eo();return Object.fromEntries(e.map(Lh))},Lh=({name:e,number:t,description:r,supported:n,action:o,forced:i,
|
|
242
|
+
standard:s})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s}],ic=Dh(),Bh=()=>{let e=Eo(),t=65,
|
|
243
|
+
r=Array.from({length:t},(n,o)=>Uh(o,e));return Object.assign({},...r)},Uh=(e,t)=>{let r=zh(e,t);if(r===void 0)return{};let{
|
|
240
244
|
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,
|
|
241
|
-
forced:a,standard:c}}},
|
|
242
|
-
|
|
243
|
-
0?e:
|
|
245
|
+
forced:a,standard:c}}},zh=(e,t)=>{let r=t.find(({name:n})=>Mh.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},
|
|
246
|
+
OR=Bh();var ac=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return lc(e,t)},cc=e=>e===
|
|
247
|
+
0?e:lc(e,"`subprocess.kill()`'s argument"),lc=(e,t)=>{if(Number.isInteger(e))return Gh(e,t);if(typeof e=="string")return Fh(
|
|
244
248
|
e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
245
|
-
${
|
|
249
|
+
${vo()}`)},Gh=(e,t)=>{if(sc.has(e))return sc.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not\
|
|
246
250
|
exist.
|
|
247
|
-
${
|
|
248
|
-
return e;throw e.toUpperCase()in
|
|
251
|
+
${vo()}`)},Hh=()=>new Map(Object.entries(Pt.signals).reverse().map(([e,t])=>[t,e])),sc=Hh(),Fh=(e,t)=>{if(e in Pt.signals)
|
|
252
|
+
return e;throw e.toUpperCase()in Pt.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'\
|
|
249
253
|
.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
|
|
250
|
-
${
|
|
251
|
-
Available signal numbers: ${
|
|
252
|
-
Object.values(
|
|
253
|
-
llAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},
|
|
254
|
-
forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:l}=
|
|
255
|
-
l,n);let u=e(c);return
|
|
254
|
+
${vo()}`)},vo=()=>`Available signal names: ${jh()}.
|
|
255
|
+
Available signal numbers: ${Vh()}.`,jh=()=>Object.keys(Pt.signals).sort().map(e=>`'${e}'`).join(", "),Vh=()=>[...new Set(
|
|
256
|
+
Object.values(Pt.signals).sort((e,t)=>e-t))].join(", "),_r=e=>ic[e].description;var uc=e=>{if(e===!1)return e;if(e===!0)return qh;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKi\
|
|
257
|
+
llAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},qh=1e3*5,dc=({kill:e,options:{
|
|
258
|
+
forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:l}=Yh(s,a,r);Kh(
|
|
259
|
+
l,n);let u=e(c);return Jh({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:u,context:o,controller:i}),u},Yh=(e,t,r)=>{
|
|
256
260
|
let[n=r,o]=yr(e)?[void 0,e]:[e,t];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument mu\
|
|
257
261
|
st be an error instance or a signal name string/integer: ${String(n)}`);if(o!==void 0&&!yr(o))throw new TypeError(`The s\
|
|
258
|
-
econd argument is optional. If specified, it must be an error instance: ${o}`);return{signal:
|
|
259
|
-
e!==void 0&&t.reject(e)},
|
|
260
|
-
t===n&&o&&
|
|
261
|
-
context:r,controllerSignal:n})=>{if(t!==!1)try{await
|
|
262
|
-
he \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},
|
|
263
|
-
controller:o})=>t===void 0||r?[]:[
|
|
264
|
-
ancel",e.kill(),t.reason};import{scheduler as
|
|
265
|
-
e,t)} can only be used if the \`ipc\` option is \`true\`.`)},
|
|
266
|
-
ed: the ${
|
|
267
|
-
ete: the ${
|
|
262
|
+
econd argument is optional. If specified, it must be an error instance: ${o}`);return{signal:cc(n),error:o}},Kh=(e,t)=>{
|
|
263
|
+
e!==void 0&&t.reject(e)},Jh=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:s})=>{
|
|
264
|
+
t===n&&o&&To({kill:e,forceKillAfterDelay:r,context:i,controllerSignal:s.signal})},To=async({kill:e,forceKillAfterDelay:t,
|
|
265
|
+
context:r,controllerSignal:n})=>{if(t!==!1)try{await Wh(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};import{once as Xh}from"node:events";var Sr=async(e,t)=>{e.aborted||await Xh(e,"abort",{signal:t})};var pc=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`T\
|
|
266
|
+
he \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},fc=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,
|
|
267
|
+
controller:o})=>t===void 0||r?[]:[Zh(e,t,n,o)],Zh=async(e,t,r,{signal:n})=>{throw await Sr(t,n),r.terminationReason??="c\
|
|
268
|
+
ancel",e.kill(),t.reason};import{scheduler as yg}from"node:timers/promises";import{promisify as gg}from"node:util";var Ye=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{Qh(e,t,r),Ao(e,t,n)},Qh=(e,t,r)=>{if(!r)throw new Error(`${oe(
|
|
269
|
+
e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Ao=(e,t,r)=>{if(!r)throw new Error(`${oe(e,t)} cannot be us\
|
|
270
|
+
ed: the ${ve(t)} has already exited or disconnected.`)},mc=e=>{throw new Error(`${oe("getOneMessage",e)} could not compl\
|
|
271
|
+
ete: the ${ve(e)} exited or disconnected.`)},hc=e=>{throw new Error(`${oe("sendMessage",e)} failed: the ${ve(e)} is send\
|
|
268
272
|
ing a message too, instead of listening to incoming messages.
|
|
269
273
|
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
270
274
|
|
|
271
275
|
const [receivedMessage] = await Promise.all([
|
|
272
276
|
${oe("getOneMessage",e)},
|
|
273
277
|
${oe("sendMessage",e,"message, {strict: true}")},
|
|
274
|
-
]);`)},Er=(e,t)=>new Error(`${oe("sendMessage",t)} failed when sending an acknowledgment response to the ${
|
|
275
|
-
|
|
276
|
-
`${oe("sendMessage",e)} failed: the ${
|
|
277
|
-
Signal\` aborted: the ${
|
|
278
|
-
ing the `cancelSignal` subprocess option.")},
|
|
279
|
-
`${oe(t,r)} cannot be used: the ${
|
|
280
|
-
if(
|
|
281
|
-
|
|
278
|
+
]);`)},Er=(e,t)=>new Error(`${oe("sendMessage",t)} failed when sending an acknowledgment response to the ${ve(t)}.`,{cause:e}),
|
|
279
|
+
gc=e=>{throw new Error(`${oe("sendMessage",e)} failed: the ${ve(e)} is not listening to incoming messages.`)},bc=e=>{throw new Error(
|
|
280
|
+
`${oe("sendMessage",e)} failed: the ${ve(e)} exited without listening to incoming messages.`)},wc=()=>new Error(`\`cancel\
|
|
281
|
+
Signal\` aborted: the ${ve(!0)} disconnected.`),yc=()=>{throw new Error("`getCancelSignal()` cannot be used without sett\
|
|
282
|
+
ing the `cancelSignal` subprocess option.")},_c=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(
|
|
283
|
+
`${oe(t,r)} cannot be used: the ${ve(r)} is disconnecting.`,{cause:e})},Sc=({error:e,methodName:t,isSubprocess:r,message:n})=>{
|
|
284
|
+
if(eg(e))throw new Error(`${oe(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},
|
|
285
|
+
eg=({code:e,message:t})=>tg.has(e)||rg.some(r=>t.includes(r)),tg=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),rg=[
|
|
282
286
|
"could not be cloned","circular structure","call stack size exceeded"],oe=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`\
|
|
283
|
-
's `controller.abort()`":`${
|
|
284
|
-
e.disconnect()};var
|
|
285
|
-
|
|
286
|
-
stdio[i];if(s==null)throw new TypeError(
|
|
287
|
-
r,e),n},
|
|
288
|
-
stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${
|
|
287
|
+
's `controller.abort()`":`${ng(t)}${e}(${r})`,ng=e=>e?"":"subprocess.",ve=e=>e?"parent process":"subprocess",Ke=e=>{e.connected&&
|
|
288
|
+
e.disconnect()};var ue=()=>{let e={},t=new Promise((r,n)=>{Object.assign(e,{resolve:r,reject:n})});return Object.assign(t,e)};var Tr=(e,t="stdin")=>{let{options:n,fileDescriptors:o}=de.get(e),i=Ec(o,t,!0),s=e.stdio[i];if(s===null)throw new TypeError(
|
|
289
|
+
vc(i,t,n,!0));return s},Je=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=de.get(e),i=Ec(o,t,!1),s=i==="all"?e.all:e.
|
|
290
|
+
stdio[i];if(s==null)throw new TypeError(vc(i,t,n,!1));return s},de=new WeakMap,Ec=(e,t,r)=>{let n=og(t,r);return ig(n,t,
|
|
291
|
+
r,e),n},og=(e,t)=>{let r=ao(e);if(r!==void 0)return r;let{validOptions:n,defaultValue:o}=t?{validOptions:'"stdin"',defaultValue:"\
|
|
292
|
+
stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Ot(t)}" must not be "${e}\
|
|
289
293
|
".
|
|
290
294
|
It must be ${n} or "fd3", "fd4" (and so on).
|
|
291
|
-
It is optional and defaults to "${o}".`)},
|
|
295
|
+
It is optional and defaults to "${o}".`)},ig=(e,t,r,n)=>{let o=n[Tc(e)];if(o===void 0)throw new TypeError(`"${Ot(r)}" mu\
|
|
292
296
|
st not be ${t}. That file descriptor does not exist.
|
|
293
297
|
Please set the "stdio" option to ensure that file descriptor exists.`);if(o.direction==="input"&&!r)throw new TypeError(
|
|
294
|
-
`"${
|
|
295
|
-
`"${
|
|
296
|
-
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=
|
|
297
|
-
option is incompatible with using "${
|
|
298
|
-
Please set this option with "pipe" instead.`},
|
|
298
|
+
`"${Ot(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(o.direction!=="input"&&r)throw new TypeError(
|
|
299
|
+
`"${Ot(r)}" must not be ${t}. It must be a writable stream, not readable.`)},vc=(e,t,r,n)=>{if(e==="all"&&!r.all)return`\
|
|
300
|
+
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=sg(e,r);return`The "${o}: ${vr(i)}"\
|
|
301
|
+
option is incompatible with using "${Ot(n)}: ${vr(t)}".
|
|
302
|
+
Please set this option with "pipe" instead.`},sg=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=Tc(e);return i===0&&t!==
|
|
299
303
|
void 0?{optionName:"stdin",optionValue:t}:i===1&&r!==void 0?{optionName:"stdout",optionValue:r}:i===2&&n!==void 0?{optionName:"\
|
|
300
|
-
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},
|
|
301
|
-
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as
|
|
302
|
-
(e.setMaxListeners(n+t),
|
|
303
|
-
|
|
304
|
-
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await
|
|
305
|
-
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},
|
|
306
|
-
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{
|
|
307
|
-
ne");e.removeListener("message",o),
|
|
308
|
-
channel:t,isSubprocess:r}),n},Pr=new WeakMap,
|
|
309
|
-
{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",
|
|
310
|
-
channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),
|
|
311
|
-
null:t.connected};var
|
|
312
|
-
type:xr,message:n,hasListeners:s}},
|
|
313
|
-
resolve({isDeadlock:!0,hasListeners:!1})},
|
|
314
|
-
if(e?.type!==xr||!t.connected)return e;let{id:i,message:s}=e,a={id:i,type:
|
|
315
|
-
channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},
|
|
316
|
-
message:r}=e;return Cr[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},
|
|
317
|
-
Cr[e.id]=n;let o=new AbortController;try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
s),{outgoingMessages:n,outgoingMessage:s}},
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
isSubprocess:r,ipc:n,isConnected:e.connected}),
|
|
324
|
-
|
|
325
|
-
message:o,strict:i}),a=
|
|
326
|
-
throw
|
|
327
|
-
e);try{await Promise.all([
|
|
328
|
-
isSubprocess:r,message:o}),s}},
|
|
329
|
-
type:
|
|
330
|
-
isSubprocess:r,ipc:n}),
|
|
331
|
-
if(t===null){
|
|
332
|
-
:cancel",
|
|
304
|
+
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},Tc=e=>e==="all"?1:e,Ot=e=>e?"to":"from",vr=e=>typeof e==
|
|
305
|
+
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as pg}from"node:events";import{addAbortListener as ag}from"node:events";var ke=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||
|
|
306
|
+
(e.setMaxListeners(n+t),ag(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as ug}from"node:events";import{once as cg}from"node:events";import{scheduler as lg}from"node:timers/promises";var Ar=(e,t)=>{t&&Io(e)},Io=e=>{e.refCounted()},Ir=(e,t)=>{t&&Ro(e)},Ro=e=>{e.unrefCounted()},Ac=(e,t)=>{t&&(Ro(e),Ro(e))},
|
|
307
|
+
Ic=(e,t)=>{t&&(Io(e),Io(e))};var Rc=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(Cc(o)||kc(o))return;Rr.has(e)||Rr.set(e,[]);let i=Rr.
|
|
308
|
+
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await xc(e,n,o),await lg.yield();let s=await Oc({wrappedMessage:i[0],
|
|
309
|
+
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},Pc=async({anyProcess:e,
|
|
310
|
+
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{Po();let i=Rr.get(e);for(;i?.length>0;)await cg(n,"message:do\
|
|
311
|
+
ne");e.removeListener("message",o),Ic(t,r),n.connected=!1,n.emit("disconnect")},Rr=new WeakMap;var Te=(e,t,r)=>{if(Pr.has(e))return Pr.get(e);let n=new ug;return n.connected=!0,Pr.set(e,n),dg({ipcEmitter:n,anyProcess:e,
|
|
312
|
+
channel:t,isSubprocess:r}),n},Pr=new WeakMap,dg=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=Rc.bind(void 0,
|
|
313
|
+
{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",Pc.bind(void 0,{anyProcess:t,
|
|
314
|
+
channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),Ac(r,n)},Or=e=>{let t=Pr.get(e);return t===void 0?e.channel!==
|
|
315
|
+
null:t.connected};var Nc=({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=Te(e,t,r),s=kr(e,i);return{id:fg++,
|
|
316
|
+
type:xr,message:n,hasListeners:s}},fg=0n,$c=(e,t)=>{if(!(t?.type!==xr||t.hasListeners))for(let{id:r}of e)r!==void 0&&Cr[r].
|
|
317
|
+
resolve({isDeadlock:!0,hasListeners:!1})},Oc=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{
|
|
318
|
+
if(e?.type!==xr||!t.connected)return e;let{id:i,message:s}=e,a={id:i,type:Dc,message:kr(t,o)};try{await Nr({anyProcess:t,
|
|
319
|
+
channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},Cc=e=>{if(e?.type!==Dc)return!1;let{id:t,
|
|
320
|
+
message:r}=e;return Cr[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Mc=async(e,t,r)=>{if(e?.type!==xr)return;let n=ue();
|
|
321
|
+
Cr[e.id]=n;let o=new AbortController;try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,mg(t,r,o)]);i&&hc(r),s||
|
|
322
|
+
gc(r)}finally{o.abort(),delete Cr[e.id]}},Cr={},mg=async(e,t,{signal:r})=>{ke(e,1,r),await pg(e,"disconnect",{signal:r}),
|
|
323
|
+
bc(t)},xr="execa:ipc:request",Dc="execa:ipc:response";var Lc=(e,t,r)=>{Ct.has(e)||Ct.set(e,new Set);let n=Ct.get(e),o=ue(),i=r?t.id:void 0,s={onMessageSent:o,id:i};return n.add(
|
|
324
|
+
s),{outgoingMessages:n,outgoingMessage:s}},Bc=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},
|
|
325
|
+
xc=async(e,t,r)=>{for(;!kr(e,t)&&Ct.get(e)?.size>0;){let n=[...Ct.get(e)];$c(n,r),await Promise.all(n.map(({onMessageSent:o})=>o))}},
|
|
326
|
+
Ct=new WeakMap,kr=(e,t)=>t.listenerCount("message")>hg(e),hg=e=>de.has(e)&&!we(de.get(e).options.buffer,"ipc")?1:0;var Nr=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return Ye({methodName:s,
|
|
327
|
+
isSubprocess:r,ipc:n,isConnected:e.connected}),bg({anyProcess:e,channel:t,methodName:s,isSubprocess:r,message:o,strict:i})},
|
|
328
|
+
bg=async({anyProcess:e,channel:t,methodName:r,isSubprocess:n,message:o,strict:i})=>{let s=Nc({anyProcess:e,channel:t,isSubprocess:n,
|
|
329
|
+
message:o,strict:i}),a=Lc(e,s,i);try{await Co({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){
|
|
330
|
+
throw Ke(e),c}finally{Bc(a)}},Co=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=wg(
|
|
331
|
+
e);try{await Promise.all([Mc(n,e,r),i(n)])}catch(s){throw _c({error:s,methodName:t,isSubprocess:r}),Sc({error:s,methodName:t,
|
|
332
|
+
isSubprocess:r,message:o}),s}},wg=e=>{if(Oo.has(e))return Oo.get(e);let t=gg(e.send.bind(e));return Oo.set(e,t),t},Oo=new WeakMap;var zc=(e,t)=>{let r="cancelSignal";return Ao(r,!1,e.connected),Co({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{
|
|
333
|
+
type:Hc,message:t},message:t})},Gc=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await _g({anyProcess:e,channel:t,
|
|
334
|
+
isSubprocess:r,ipc:n}),xo.signal),_g=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!Uc){if(Uc=!0,!n){yc();return}
|
|
335
|
+
if(t===null){Po();return}Te(e,t,r),await yg.yield()}},Uc=!1,kc=e=>e?.type!==Hc?!1:(xo.abort(e.message),!0),Hc="execa:ipc\
|
|
336
|
+
:cancel",Po=()=>{xo.abort(wc())},xo=new AbortController;var Fc=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(t===void 0)throw new Error("The `cancelSigna\
|
|
333
337
|
l` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be \
|
|
334
338
|
false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'j\
|
|
335
|
-
son' when setting the `gracefulCancel` option.")}},
|
|
336
|
-
context:o,controller:i})=>r?[
|
|
337
|
-
subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await Sr(t,o);let i=
|
|
338
|
-
e,i),
|
|
339
|
-
|
|
340
|
-
ack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as
|
|
341
|
-
e a non-negative integer, got \`${e}\` (${typeof e})`)},
|
|
342
|
-
signal:n})=>{throw await
|
|
343
|
-
options:{...e,node:!0}}},
|
|
339
|
+
son' when setting the `gracefulCancel` option.")}},jc=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,
|
|
340
|
+
context:o,controller:i})=>r?[Sg({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:i})]:[],Sg=async({
|
|
341
|
+
subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await Sr(t,o);let i=Eg(t);throw await zc(
|
|
342
|
+
e,i),To({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.terminationReason??="gracefulCancel",t.reason},
|
|
343
|
+
Eg=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"st\
|
|
344
|
+
ack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as vg}from"node:timers/promises";var Vc=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to b\
|
|
345
|
+
e a non-negative integer, got \`${e}\` (${typeof e})`)},Wc=(e,t,r,n)=>t===0||t===void 0?[]:[Tg(e,t,r,n)],Tg=async(e,t,r,{
|
|
346
|
+
signal:n})=>{throw await vg(t,void 0,{signal:n}),r.terminationReason??="timeout",e.kill(),new ne};import{execPath as Ag,execArgv as Ig}from"node:process";import qc from"node:path";var Yc=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{
|
|
347
|
+
options:{...e,node:!0}}},Kc=(e,t,{node:r=!1,nodePath:n=Ag,nodeOptions:o=Ig.filter(c=>!c.startsWith("--inspect")),cwd:i,execPath:s,
|
|
344
348
|
...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option ins\
|
|
345
|
-
tead.');let c=Fe(n,'The "nodePath" option'),l=
|
|
349
|
+
tead.');let c=Fe(n,'The "nodePath" option'),l=qc.resolve(i,c),u={...a,nodePath:l,node:r,cwd:i};if(!r)return[e,t,u];if(qc.
|
|
346
350
|
basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be \
|
|
347
|
-
"node".');return[l,[...o,e,...t],{ipc:!0,...u,shell:!1}]};import{serialize as
|
|
348
|
-
"The `ipcInput` option cannot be set unless the `ipc` option is `true`.");
|
|
349
|
-
"The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},
|
|
350
|
-
throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},
|
|
351
|
-
t!==void 0&&await e.sendMessage(t)};var
|
|
351
|
+
"node".');return[l,[...o,e,...t],{ipc:!0,...u,shell:!1}]};import{serialize as Rg}from"node:v8";var Jc=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error(
|
|
352
|
+
"The `ipcInput` option cannot be set unless the `ipc` option is `true`.");Cg[r](e)}},Pg=e=>{try{Rg(e)}catch(t){throw new Error(
|
|
353
|
+
"The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},Og=e=>{try{JSON.stringify(e)}catch(t){
|
|
354
|
+
throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},Cg={advanced:Pg,json:Og},Xc=async(e,t)=>{
|
|
355
|
+
t!==void 0&&await e.sendMessage(t)};var Qc=({encoding:e})=>{if(ko.has(e))return;let t=kg(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${$r(
|
|
352
356
|
e)}\`.
|
|
353
|
-
Please rename it to ${$r(t)}.`);let r=[...
|
|
357
|
+
Please rename it to ${$r(t)}.`);let r=[...ko].map(n=>$r(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${$r(
|
|
354
358
|
e)}\`.
|
|
355
|
-
Please rename it to one of: ${r}.`)},
|
|
356
|
-
n1","ascii"]),
|
|
357
|
-
if(t in
|
|
358
|
-
binary:"latin1"},$r=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as
|
|
359
|
+
Please rename it to one of: ${r}.`)},xg=new Set(["utf8","utf16le"]),W=new Set(["buffer","hex","base64","base64url","lati\
|
|
360
|
+
n1","ascii"]),ko=new Set([...xg,...W]),kg=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();
|
|
361
|
+
if(t in Zc)return Zc[t];if(ko.has(t))return t},Zc={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",
|
|
362
|
+
binary:"latin1"},$r=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as Ng}from"node:fs";import $g from"node:path";import Mg from"node:process";var el=(e=tl())=>{let t=Fe(e,'The "cwd" option');return $g.resolve(t)},tl=()=>{try{return Mg.cwd()}catch(e){throw e.message=
|
|
359
363
|
`The current directory does not exist.
|
|
360
|
-
${e.message}`,e}},
|
|
364
|
+
${e.message}`,e}},rl=(e,t)=>{if(t===tl())return e;let r;try{r=Ng(t)}catch(n){return`The "cwd" option is invalid: ${t}.
|
|
361
365
|
${n.message}
|
|
362
366
|
${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
363
|
-
${e}`};var Mr=(e,t,r)=>{r.cwd=
|
|
364
|
-
l);return
|
|
365
|
-
|
|
366
|
-
s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},
|
|
367
|
+
${e}`};var Mr=(e,t,r)=>{r.cwd=el(r.cwd);let[n,o,i]=Kc(e,t,r),{command:s,args:a,options:c}=ol.default._parse(n,o,i),l=Fs(c),u=Lg(
|
|
368
|
+
l);return Vc(u),Qc(u),Jc(u),pc(u),Fc(u),u.shell=no(u.shell),u.env=Bg(u),u.killSignal=ac(u.killSignal),u.forceKillAfterDelay=
|
|
369
|
+
uc(u.forceKillAfterDelay),u.lines=u.lines.map((d,p)=>d&&!W.has(u.encoding)&&u.buffer[p]),nl.platform==="win32"&&Dg.basename(
|
|
370
|
+
s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},Lg=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:n=r,
|
|
367
371
|
encoding:o="utf8",reject:i=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,
|
|
368
|
-
ipcInput:
|
|
369
|
-
encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:
|
|
370
|
-
|
|
371
|
-
cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s};var Dr=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as
|
|
372
|
-
Input must be a string or a Uint8Array");return
|
|
373
|
-
-1)===
|
|
374
|
-
`,
|
|
375
|
-
e.readable===void 0)&&typeof e.pipe=="function"}function
|
|
372
|
+
ipcInput:p,ipc:f=p!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:e,preferLocal:t,cwd:r,localDirectory:n,
|
|
373
|
+
encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:p,ipc:f,serialization:m}),
|
|
374
|
+
Bg=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...nl.env,...e}:e;return r||n?Ja({env:s,
|
|
375
|
+
cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s};var Dr=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as wb}from"node:util";function Xe(e){if(typeof e=="string")return Ug(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("\
|
|
376
|
+
Input must be a string or a Uint8Array");return zg(e)}var Ug=e=>e.at(-1)===il?e.slice(0,e.at(-2)===sl?-2:-1):e,zg=e=>e.at(
|
|
377
|
+
-1)===Gg?e.subarray(0,e.at(-2)===Hg?-2:-1):e,il=`
|
|
378
|
+
`,Gg=il.codePointAt(0),sl="\r",Hg=sl.codePointAt(0);import{on as mb}from"node:events";import{finished as hb}from"node:stream/promises";function ie(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&
|
|
379
|
+
e.readable===void 0)&&typeof e.pipe=="function"}function No(e,{checkOpen:t=!0}={}){return ie(e,{checkOpen:t})&&(e.writable||
|
|
376
380
|
!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="b\
|
|
377
|
-
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function
|
|
381
|
+
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function Ne(e,{checkOpen:t=!0}={}){return ie(e,{checkOpen:t})&&
|
|
378
382
|
(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.
|
|
379
|
-
destroy=="function"&&typeof e.destroyed=="boolean"}function
|
|
383
|
+
destroy=="function"&&typeof e.destroyed=="boolean"}function $o(e,t){return No(e,t)&&Ne(e,t)}var Fg=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),Mo=class{#t;#r;#e=!1;#n=void 0;constructor(t,r){
|
|
380
384
|
this.#t=t,this.#r=r}next(){let t=()=>this.#i();return this.#n=this.#n?this.#n.then(t,t):t(),this.#n}return(t){let r=()=>this.#o(
|
|
381
385
|
t);return this.#n?this.#n.then(r,r):r()}async#i(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){
|
|
382
386
|
throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),
|
|
383
387
|
t}async#o(t){if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),
|
|
384
|
-
await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},
|
|
385
|
-
Object.defineProperty(
|
|
386
|
-
{value:"return"});var
|
|
387
|
-
configurable:!0,writable:!0,value:
|
|
388
|
-
create(
|
|
389
|
-
if(
|
|
390
|
-
a ReadableStream, or an async iterable.")},{toString:
|
|
391
|
-
r={};
|
|
392
|
-
if(!t.signal.aborted)throw n}finally{e.destroy()}},
|
|
393
|
-
error:!1})}catch(n){r.error=n}finally{t.abort()}},
|
|
394
|
-
POSITIVE_INFINITY}={})=>{let l=
|
|
395
|
-
state:u,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return
|
|
396
|
-
getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let
|
|
397
|
-
|
|
398
|
-
state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},
|
|
399
|
-
maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){
|
|
400
|
-
new
|
|
401
|
-
ct"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=
|
|
388
|
+
await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},Do=Symbol();function al(){return this[Do].next()}
|
|
389
|
+
Object.defineProperty(al,"name",{value:"next"});function cl(e){return this[Do].return(e)}Object.defineProperty(cl,"name",
|
|
390
|
+
{value:"return"});var jg=Object.create(Fg,{next:{enumerable:!0,configurable:!0,writable:!0,value:al},return:{enumerable:!0,
|
|
391
|
+
configurable:!0,writable:!0,value:cl}});function Lo({preventCancel:e=!1}={}){let t=this.getReader(),r=new Mo(t,e),n=Object.
|
|
392
|
+
create(jg);return n[Do]=r,n}var ll=e=>{if(Ne(e,{checkOpen:!1})&&xt.on!==void 0)return Wg(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;
|
|
393
|
+
if(Vg.call(e)==="[object ReadableStream]")return Lo.call(e);throw new TypeError("The first argument must be a Readable, \
|
|
394
|
+
a ReadableStream, or an async iterable.")},{toString:Vg}=Object.prototype,Wg=async function*(e){let t=new AbortController,
|
|
395
|
+
r={};qg(e,t,r);try{for await(let[n]of xt.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;
|
|
396
|
+
if(!t.signal.aborted)throw n}finally{e.destroy()}},qg=async(e,t,r)=>{try{await xt.finished(e,{cleanup:!0,readable:!0,writable:!1,
|
|
397
|
+
error:!1})}catch(n){r.error=n}finally{t.abort()}},xt={};var Ze=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.
|
|
398
|
+
POSITIVE_INFINITY}={})=>{let l=ll(e),u=t();u.length=0;try{for await(let d of l){let p=Kg(d),f=r[p](d,u);pl({convertedChunk:f,
|
|
399
|
+
state:u,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return Yg({state:u,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,
|
|
400
|
+
getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let p=typeof d=="object"&&d!==null?d:new Error(d);throw p.bufferedData=a(u),
|
|
401
|
+
p}},Yg=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let s=o(e);s!==void 0&&pl({convertedChunk:s,
|
|
402
|
+
state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},pl=({convertedChunk:e,state:t,getSize:r,truncateChunk:n,addChunk:o,
|
|
403
|
+
maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){ul(e,t,o,a);return}let c=n(e,i-t.length);throw c!==void 0&&ul(c,t,o,i),
|
|
404
|
+
new pe},ul=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},Kg=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="obje\
|
|
405
|
+
ct"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=dl.call(e);return r==="[object Array\
|
|
402
406
|
Buffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&
|
|
403
|
-
|
|
404
|
-
MaxBufferError";constructor(){super("maxBuffer exceeded")}};var
|
|
405
|
-
Ur=e=>e.length;async function zr(e,t){return
|
|
406
|
-
convertChunk:{string:
|
|
407
|
-
getFinalChunk:
|
|
408
|
-
|
|
409
|
-
length:r},n)=>{let o=
|
|
410
|
-
|
|
411
|
-
t,{maxByteLength:
|
|
412
|
-
|
|
413
|
-
buffer:
|
|
414
|
-
decode(e,{stream:!0}),
|
|
415
|
-
""?void 0:t},
|
|
416
|
-
truncateChunk:
|
|
417
|
-
ll")return e;let s=
|
|
418
|
-
r==="buffer"?"bytes":"characters",
|
|
419
|
-
n},
|
|
407
|
+
dl.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:dl}=Object.prototype,pe=class extends Error{name="\
|
|
408
|
+
MaxBufferError";constructor(){super("maxBuffer exceeded")}};var ye=e=>e,kt=()=>{},Lr=({contents:e})=>e,Br=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},
|
|
409
|
+
Ur=e=>e.length;async function zr(e,t){return Ze(e,Qg,t)}var Jg=()=>({contents:[]}),Xg=()=>1,Zg=(e,{contents:t})=>(t.push(e),t),Qg={init:Jg,
|
|
410
|
+
convertChunk:{string:ye,buffer:ye,arrayBuffer:ye,dataView:ye,typedArray:ye,others:ye},getSize:Xg,truncateChunk:kt,addChunk:Zg,
|
|
411
|
+
getFinalChunk:kt,finalize:Lr};async function Gr(e,t){return Ze(e,cb,t)}var eb=()=>({contents:new ArrayBuffer(0)}),tb=e=>rb.encode(e),rb=new TextEncoder,
|
|
412
|
+
fl=e=>new Uint8Array(e),ml=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),nb=(e,t)=>e.slice(0,t),ob=(e,{contents:t,
|
|
413
|
+
length:r},n)=>{let o=bl()?sb(t,n):ib(t,n);return new Uint8Array(o).set(e,r),o},ib=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(
|
|
414
|
+
gl(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},sb=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(
|
|
415
|
+
t,{maxByteLength:gl(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},gl=e=>hl**Math.ceil(Math.log(e)/Math.log(hl)),
|
|
416
|
+
hl=2,ab=({contents:e,length:t})=>bl()?e:e.slice(0,t),bl=()=>"resize"in ArrayBuffer.prototype,cb={init:eb,convertChunk:{string:tb,
|
|
417
|
+
buffer:fl,arrayBuffer:fl,dataView:ml,typedArray:ml,others:Br},getSize:Ur,truncateChunk:nb,addChunk:ob,getFinalChunk:kt,finalize:ab};async function Fr(e,t){return Ze(e,fb,t)}var lb=()=>({contents:"",textDecoder:new TextDecoder}),Hr=(e,{textDecoder:t})=>t.
|
|
418
|
+
decode(e,{stream:!0}),ub=(e,{contents:t})=>t+e,db=(e,t)=>e.slice(0,t),pb=({textDecoder:e})=>{let t=e.decode();return t===
|
|
419
|
+
""?void 0:t},fb={init:lb,convertChunk:{string:ye,buffer:Hr,arrayBuffer:Hr,dataView:Hr,typedArray:Hr,others:Br},getSize:Ur,
|
|
420
|
+
truncateChunk:db,addChunk:ub,getFinalChunk:pb,finalize:Lr};Object.assign(xt,{on:mb,finished:hb});var wl=({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{if(!(e instanceof pe))throw e;if(i==="a\
|
|
421
|
+
ll")return e;let s=gb(r,n,o);throw e.maxBufferInfo={fdNumber:i,unit:s},t.destroy(),e},gb=(e,t,r)=>e?"objects":t?"lines":
|
|
422
|
+
r==="buffer"?"bytes":"characters",yl=(e,t,r)=>{if(t.length!==r)return;let n=new pe;throw n.maxBufferInfo={fdNumber:"ipc"},
|
|
423
|
+
n},_l=(e,t)=>{let{streamName:r,threshold:n,unit:o}=bb(e,t);return`Command's ${r} was larger than ${n} ${o}`},bb=(e,t)=>{
|
|
420
424
|
if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;
|
|
421
|
-
delete e.maxBufferInfo;let o=
|
|
422
|
-
r),threshold:o,unit:n}},
|
|
423
|
-
return e;let n=jr(r);return e.length>n?e.slice(0,n):e},jr=([,e])=>e;var
|
|
424
|
-
isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:
|
|
425
|
-
let g=n?.code,
|
|
426
|
-
exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:
|
|
425
|
+
delete e.maxBufferInfo;let o=we(t,r);return r==="ipc"?{streamName:"IPC output",threshold:o,unit:"messages"}:{streamName:sr(
|
|
426
|
+
r),threshold:o,unit:n}},Sl=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(n=>n!==null&&n.length>jr(r)),El=(e,t,r)=>{if(!t)
|
|
427
|
+
return e;let n=jr(r);return e.length>n?e.slice(0,n):e},jr=([,e])=>e;var Tl=({stdio:e,all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,
|
|
428
|
+
isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:p,forceKillAfterDelay:f,killSignal:m,maxBuffer:h,timeout:y,cwd:w})=>{
|
|
429
|
+
let g=n?.code,v=yb({originalError:n,timedOut:c,timeout:y,isMaxBuffer:d,maxBuffer:h,errorCode:g,signal:o,signalDescription:i,
|
|
430
|
+
exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:p,forceKillAfterDelay:f,killSignal:m}),_=Sb(n,w),A=_===
|
|
427
431
|
void 0?"":`
|
|
428
|
-
${
|
|
429
|
-
`)].map(
|
|
432
|
+
${_}`,I=`${v}: ${a}${A}`,S=t===void 0?[e[2],e[1]]:[t],x=[I,...S,...e.slice(3),r.map(N=>Eb(N)).join(`
|
|
433
|
+
`)].map(N=>At(Xe(vb(N)))).filter(Boolean).join(`
|
|
430
434
|
|
|
431
|
-
`);return{originalMessage:
|
|
432
|
-
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:
|
|
433
|
-
killSignal:
|
|
435
|
+
`);return{originalMessage:_,shortMessage:I,message:x}},yb=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,
|
|
436
|
+
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:p,
|
|
437
|
+
killSignal:f})=>{let m=_b(d,p);return t?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracef\
|
|
434
438
|
ully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a}\
|
|
435
|
-
)`:l?`Command was canceled${m}`:n?`${
|
|
436
|
-
(${_r(
|
|
437
|
-
nd failed"},
|
|
438
|
-
let r=
|
|
439
|
-
e),
|
|
440
|
-
`):
|
|
441
|
-
cwd:i,durationMs:
|
|
442
|
-
exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),
|
|
443
|
-
options:o,startTime:i,isSync:s})=>
|
|
444
|
-
isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:s}),
|
|
439
|
+
)`:l?`Command was canceled${m}`:n?`${_l(e,o)}${m}`:i!==void 0?`Command failed with ${i}${m}`:d?`Command was killed with ${f}\
|
|
440
|
+
(${_r(f)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Comma\
|
|
441
|
+
nd failed"},_b=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",Sb=(e,t)=>{if(e instanceof ne)return;
|
|
442
|
+
let r=Qa(e)?e.originalMessage:String(e?.message??e),n=At(rl(r,t));return n===""?void 0:n},Eb=e=>typeof e=="string"?e:wb(
|
|
443
|
+
e),vb=e=>Array.isArray(e)?e.map(t=>Xe(vl(t))).filter(Boolean).join(`
|
|
444
|
+
`):vl(e),vl=e=>typeof e=="string"?e:B(e)?or(e):"";var Vr=({command:e,escapedCommand:t,stdio:r,all:n,ipcOutput:o,options:{cwd:i},startTime:s})=>Al({command:e,escapedCommand:t,
|
|
445
|
+
cwd:i,durationMs:po(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,
|
|
446
|
+
exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),Qe=({error:e,command:t,escapedCommand:r,fileDescriptors:n,
|
|
447
|
+
options:o,startTime:i,isSync:s})=>Nt({error:e,command:t,escapedCommand:r,startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,
|
|
448
|
+
isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:s}),Nt=({error:e,
|
|
445
449
|
command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,
|
|
446
|
-
exitCode:l,signal:u,stdio:d,all:
|
|
447
|
-
cwd:g,maxBuffer:
|
|
448
|
-
{stdio:d,all:
|
|
449
|
-
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:
|
|
450
|
-
|
|
451
|
-
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:A,signal:
|
|
452
|
-
shortMessage
|
|
453
|
-
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:
|
|
454
|
-
shortMessage:
|
|
450
|
+
exitCode:l,signal:u,stdio:d,all:p,ipcOutput:f,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:y,killSignal:w,
|
|
451
|
+
cwd:g,maxBuffer:v},isSync:_})=>{let{exitCode:A,signal:I,signalDescription:S}=Ab(l,u),{originalMessage:x,shortMessage:N,message:$}=Tl(
|
|
452
|
+
{stdio:d,all:p,ipcOutput:f,originalError:e,signal:I,signalDescription:S,exitCode:A,escapedCommand:r,timedOut:o,isCanceled:i,
|
|
453
|
+
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:y,killSignal:w,maxBuffer:v,timeout:h,cwd:g}),
|
|
454
|
+
M=Xa(e,$,_);return Object.assign(M,Tb({error:M,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,
|
|
455
|
+
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:A,signal:I,signalDescription:S,stdio:d,all:p,ipcOutput:f,cwd:g,originalMessage:x,
|
|
456
|
+
shortMessage:N})),M},Tb=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,
|
|
457
|
+
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:p,all:f,ipcOutput:m,cwd:h,originalMessage:y,
|
|
458
|
+
shortMessage:w})=>Al({shortMessage:w,originalMessage:y,command:t,escapedCommand:r,cwd:h,durationMs:po(n),failed:!0,timedOut:o,
|
|
455
459
|
isCanceled:i,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,
|
|
456
|
-
code:e.cause?.code,stdout:
|
|
457
|
-
e).filter(([,t])=>t!==void 0)),
|
|
458
|
-
signal:n,signalDescription:o}};var
|
|
459
|
-
trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(
|
|
460
|
-
trunc(
|
|
461
|
-
milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function
|
|
462
|
-
return
|
|
460
|
+
code:e.cause?.code,stdout:p[1],stderr:p[2],all:f,stdio:p,ipcOutput:m,pipedFrom:[]}),Al=e=>Object.fromEntries(Object.entries(
|
|
461
|
+
e).filter(([,t])=>t!==void 0)),Ab=(e,t)=>{let r=e===null?void 0:e,n=t===null?void 0:t,o=n===void 0?void 0:_r(t);return{exitCode:r,
|
|
462
|
+
signal:n,signalDescription:o}};var Il=e=>Number.isFinite(e)?e:0;function Ib(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.
|
|
463
|
+
trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(Il(e*1e3)%1e3),nanoseconds:Math.
|
|
464
|
+
trunc(Il(e*1e6)%1e3)}}function Rb(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,
|
|
465
|
+
milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function Bo(e){switch(typeof e){case"number":{if(Number.isFinite(e))
|
|
466
|
+
return Ib(e);break}case"bigint":return Rb(e)}throw new TypeError("Expected a finite number or bigint")}var Pb=e=>e===0||e===0n,Ob=(e,t)=>t===1||t===1n?e:`${e}s`,Cb=1e-7,xb=24n*60n*60n*1000n;function Uo(e,t){let r=typeof e==
|
|
463
467
|
"bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let n=e<0?"-":"";
|
|
464
468
|
e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&
|
|
465
|
-
(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,d)=>{let
|
|
466
|
-
round(
|
|
467
|
-
String(u),t.colonNotation){let m=
|
|
468
|
-
0,h-m))+
|
|
469
|
+
(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,d)=>{let p=Math.floor(u*10**d+Cb);return(Math.
|
|
470
|
+
round(p)/10**d).toFixed(d)},s=(u,d,p,f)=>{if(!((o.length===0||!t.colonNotation)&&Pb(u)&&!(t.colonNotation&&p==="m"))){if(f??=
|
|
471
|
+
String(u),t.colonNotation){let m=f.includes(".")?f.split(".")[0].length:f.length,h=o.length>0?2:1;f="0".repeat(Math.max(
|
|
472
|
+
0,h-m))+f}else f+=t.verbose?" "+Ob(d,u):p;o.push(f)}},a=Bo(e),c=BigInt(a.days);if(t.hideYearAndDays?s(BigInt(c)*24n+BigInt(
|
|
469
473
|
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")),
|
|
470
474
|
s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<
|
|
471
|
-
1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),
|
|
472
|
-
if(s(u,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(
|
|
473
|
-
let m=d+
|
|
474
|
-
ceil(m),
|
|
475
|
-
Number(e%
|
|
476
|
-
|
|
475
|
+
1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),p=Number(a.microseconds),f=Number(a.nanoseconds);
|
|
476
|
+
if(s(u,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(p,"microsecond","\xB5s"),s(f,"nanosecond","ns");else{
|
|
477
|
+
let m=d+p/1e3+f/1e6,h=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,y=m>=1?Math.round(m):Math.
|
|
478
|
+
ceil(m),w=1e3-10**-h,g=h?Math.min(m,w).toFixed(h):Math.min(y,w);s(Number.parseFloat(g),"millisecond","ms",g)}}else{let u=(r?
|
|
479
|
+
Number(e%xb):e)/1e3%60,d=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,p=i(u,d),f=t.keepDecimalsOnWholeSeconds?
|
|
480
|
+
p:p.replace(/\.0+$/,"");s(Number.parseFloat(f),"second","s",f)}if(o.length===0)return n+"0"+(t.verbose?" milliseconds":"\
|
|
477
481
|
ms");let l=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(o=o.slice(0,Math.max(t.unitCount,1))),n+o.join(
|
|
478
|
-
l)}var
|
|
479
|
-
verboseInfo:t,result:e})};var
|
|
480
|
-
"native":B(e)?"uint8Array":
|
|
481
|
-
e.transform,{checkOpen:!1})
|
|
482
|
-
e,t,"web TransformStream"),"webTransform"),
|
|
483
|
-
nary`,o),
|
|
484
|
-
when using a generator, not a ${r}.`)},
|
|
485
|
-
`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(
|
|
486
|
-
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(
|
|
487
|
-
inal\` option must not be a web TransformStream.`);if(t!==void 0&&!
|
|
488
|
-
ust be a generator.`);return
|
|
489
|
-
if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},
|
|
490
|
-
prototype.toString.call(e)==="[object AsyncGeneratorFunction]"
|
|
491
|
-
torFunction]",
|
|
492
|
-
L]",
|
|
493
|
-
|
|
494
|
-
["ipc","ignore","inherit","overlapped","pipe"]),
|
|
495
|
-
prototype.toString.call(e)==="[object WritableStream]",
|
|
496
|
-
e)&&typeof e[Symbol.asyncIterator]=="function",
|
|
497
|
-
t"&&e!==null,
|
|
498
|
-
ber"]),
|
|
499
|
-
x"]),
|
|
482
|
+
l)}var Rl=(e,t)=>{e.failed&&le({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var Pl=(e,t)=>{je(t)&&(Rl(e,t),kb(e,t))},kb=(e,t)=>{let r=`(done in ${Uo(e.durationMs)})`;le({type:"duration",verboseMessage:r,
|
|
483
|
+
verboseInfo:t,result:e})};var et=(e,t,{reject:r})=>{if(Pl(e,t),e.failed&&r)throw e;return e};import{readFileSync as tu}from"node:fs";var xl=(e,t)=>$e(e)?"asyncGenerator":$l(e)?"generator":Wr(e)?"fileUrl":Lb(e)?"filePath":zb(e)?"webStream":ie(e,{checkOpen:!1})?
|
|
484
|
+
"native":B(e)?"uint8Array":Gb(e)?"asyncIterable":Hb(e)?"iterable":Ho(e)?kl({transform:e},t):Db(e)?Nb(e,t):"native",Nb=(e,t)=>$o(
|
|
485
|
+
e.transform,{checkOpen:!1})?$b(e,t):Ho(e.transform)?kl(e,t):Mb(e,t),$b=(e,t)=>(Nl(e,t,"Duplex stream"),"duplex"),kl=(e,t)=>(Nl(
|
|
486
|
+
e,t,"web TransformStream"),"webTransform"),Nl=({final:e,binary:t,objectMode:r},n,o)=>{Ol(e,`${n}.final`,o),Ol(t,`${n}.bi\
|
|
487
|
+
nary`,o),zo(r,`${n}.objectMode`)},Ol=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined\
|
|
488
|
+
when using a generator, not a ${r}.`)},Mb=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(e!==void 0&&!Cl(e))throw new TypeError(
|
|
489
|
+
`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if($o(t,{checkOpen:!1}))
|
|
490
|
+
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(Ho(t))throw new TypeError(`The \`${o}.f\
|
|
491
|
+
inal\` option must not be a web TransformStream.`);if(t!==void 0&&!Cl(t))throw new TypeError(`The \`${o}.final\` option m\
|
|
492
|
+
ust be a generator.`);return zo(r,`${o}.binary`),zo(n,`${o}.objectMode`),$e(e)||$e(t)?"asyncGenerator":"generator"},zo=(e,t)=>{
|
|
493
|
+
if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},Cl=e=>$e(e)||$l(e),$e=e=>Object.
|
|
494
|
+
prototype.toString.call(e)==="[object AsyncGeneratorFunction]",$l=e=>Object.prototype.toString.call(e)==="[object Genera\
|
|
495
|
+
torFunction]",Db=e=>L(e)&&(e.transform!==void 0||e.final!==void 0),Wr=e=>Object.prototype.toString.call(e)==="[object UR\
|
|
496
|
+
L]",Ml=e=>Wr(e)&&e.protocol!=="file:",Lb=e=>L(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>Bb.has(t))&&Go(e.file),
|
|
497
|
+
Bb=new Set(["file","append"]),Go=e=>typeof e=="string",Dl=(e,t)=>e==="native"&&typeof t=="string"&&!Ub.has(t),Ub=new Set(
|
|
498
|
+
["ipc","ignore","inherit","overlapped","pipe"]),Ll=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",qr=e=>Object.
|
|
499
|
+
prototype.toString.call(e)==="[object WritableStream]",zb=e=>Ll(e)||qr(e),Ho=e=>Ll(e?.readable)&&qr(e?.writable),Gb=e=>Bl(
|
|
500
|
+
e)&&typeof e[Symbol.asyncIterator]=="function",Hb=e=>Bl(e)&&typeof e[Symbol.iterator]=="function",Bl=e=>typeof e=="objec\
|
|
501
|
+
t"&&e!==null,Q=new Set(["generator","asyncGenerator","duplex","webTransform"]),Yr=new Set(["fileUrl","filePath","fileNum\
|
|
502
|
+
ber"]),Fo=new Set(["fileUrl","filePath"]),Ul=new Set([...Fo,"webStream","nodeStream"]),zl=new Set(["webTransform","duple\
|
|
503
|
+
x"]),Ae={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",
|
|
500
504
|
fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web Transfo\
|
|
501
505
|
rmStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a\
|
|
502
|
-
string",uint8Array:"a Uint8Array"};var
|
|
503
|
-
readableObjectMode:e??n}},
|
|
504
|
-
writableObjectMode:n,readableObjectMode:o}},
|
|
505
|
-
input"?r.value.writableObjectMode:r.value.readableObjectMode};var
|
|
506
|
-
has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(o))i[s]=
|
|
507
|
-
optionName:t,direction:r,encoding:n});return
|
|
508
|
-
direction:i,encoding:s})=>t==="duplex"?
|
|
509
|
-
direction:i}):
|
|
506
|
+
string",uint8Array:"a Uint8Array"};var jo=(e,t,r,n)=>n==="output"?Fb(e,t,r):jb(e,t,r),Fb=(e,t,r)=>{let n=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:n,
|
|
507
|
+
readableObjectMode:e??n}},jb=(e,t,r)=>{let n=t===0?e===!0:r[t-1].value.readableObjectMode,o=t!==r.length-1&&(e??n);return{
|
|
508
|
+
writableObjectMode:n,readableObjectMode:o}},Gl=(e,t)=>{let r=e.findLast(({type:n})=>Q.has(n));return r===void 0?!1:t==="\
|
|
509
|
+
input"?r.value.writableObjectMode:r.value.readableObjectMode};var Hl=(e,t,r,n)=>[...e.filter(({type:o})=>!Q.has(o)),...Vb(e,t,r,n)],Vb=(e,t,r,{encoding:n})=>{let o=e.filter(({type:s})=>Q.
|
|
510
|
+
has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(o))i[s]=Wb({stdioItem:a,index:Number(s),newTransforms:i,
|
|
511
|
+
optionName:t,direction:r,encoding:n});return Jb(i,r)},Wb=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:n,optionName:o,
|
|
512
|
+
direction:i,encoding:s})=>t==="duplex"?qb({stdioItem:e,optionName:o}):t==="webTransform"?Yb({stdioItem:e,index:r,newTransforms:n,
|
|
513
|
+
direction:i}):Kb({stdioItem:e,index:r,newTransforms:n,direction:i,encoding:s}),qb=({stdioItem:e,stdioItem:{value:{transform:t,
|
|
510
514
|
transform:{writableObjectMode:r,readableObjectMode:n},objectMode:o=n}},optionName:i})=>{if(o&&!n)throw new TypeError(`Th\
|
|
511
515
|
e \`${i}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!o&&n)throw new TypeError(
|
|
512
516
|
`The \`${i}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{
|
|
513
|
-
transform:t,writableObjectMode:r,readableObjectMode:n}}},
|
|
514
|
-
let{transform:i,objectMode:s}=L(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=
|
|
515
|
-
transform:i,writableObjectMode:a,readableObjectMode:c}}},
|
|
517
|
+
transform:t,writableObjectMode:r,readableObjectMode:n}}},Yb=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{
|
|
518
|
+
let{transform:i,objectMode:s}=L(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=jo(s,r,n,o);return{...e,value:{
|
|
519
|
+
transform:i,writableObjectMode:a,readableObjectMode:c}}},Kb=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o,
|
|
516
520
|
encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=L(t)?t:{transform:t},d=c||W.has(i),
|
|
517
|
-
{writableObjectMode:
|
|
518
|
-
writableObjectMode:
|
|
519
|
-
ption must not be an array of both readable and writable values.`);return n.find(Boolean)??
|
|
520
|
-
|
|
521
|
-
iterable:
|
|
522
|
-
|
|
523
|
-
e,{checkOpen:!1}))return
|
|
524
|
-
includes(e))return"output"},
|
|
525
|
-
void 0)return
|
|
521
|
+
{writableObjectMode:p,readableObjectMode:f}=jo(u,r,n,o);return{...e,value:{transform:s,final:a,binary:d,preserveNewlines:l,
|
|
522
|
+
writableObjectMode:p,readableObjectMode:f}}},Jb=(e,t)=>t==="input"?e.reverse():e;import Vo from"node:process";var Fl=(e,t,r)=>{let n=e.map(o=>Xb(o,t));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` o\
|
|
523
|
+
ption must not be an array of both readable and writable values.`);return n.find(Boolean)??ew},Xb=({type:e,value:t},r)=>Zb[r]??
|
|
524
|
+
jl[e](t),Zb=["input","output","output"],tt=()=>{},Wo=()=>"input",jl={generator:tt,asyncGenerator:tt,fileUrl:tt,filePath:tt,
|
|
525
|
+
iterable:Wo,asyncIterable:Wo,uint8Array:Wo,webStream:e=>qr(e)?"output":"input",nodeStream(e){return Ne(e,{checkOpen:!1})?
|
|
526
|
+
No(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:tt,duplex:tt,native(e){let t=Qb(e);if(t!==void 0)return t;if(ie(
|
|
527
|
+
e,{checkOpen:!1}))return jl.nodeStream(e)}},Qb=e=>{if([0,Vo.stdin].includes(e))return"input";if([1,2,Vo.stdout,Vo.stderr].
|
|
528
|
+
includes(e))return"output"},ew="output";var Vl=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var Wl=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=tw(e,n).map((a,c)=>ql(a,c));return i?nw(s,r,o):Vl(s,t)},tw=(e,t)=>{if(e===
|
|
529
|
+
void 0)return Z.map(n=>t[n]);if(rw(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Z.
|
|
526
530
|
map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \
|
|
527
|
-
\`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,
|
|
528
|
-
{length:r},(n,o)=>e[o])},
|
|
529
|
-
nore":"pipe"),
|
|
530
|
-
t=>t==="pipe");import{readFileSync as
|
|
531
|
-
fdNumber:n,direction:o}):
|
|
532
|
-
let i=
|
|
533
|
-
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},
|
|
534
|
-
optionName:t,fdNumber:r,direction:n})=>{let o=
|
|
535
|
-
if(
|
|
536
|
-
s.`);return{type:"uint8Array",value:
|
|
537
|
-
return e;let r=ir.indexOf(e);if(r!==-1)return r},
|
|
538
|
-
herit"?{type:"nodeStream",value:
|
|
539
|
-
ie(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,
|
|
540
|
-
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n};var
|
|
541
|
-
t"}],
|
|
542
|
-
"The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},
|
|
543
|
-
inputFile"}],
|
|
544
|
-
"The `inputFile` option must be a file path string or a file URL.")};var
|
|
545
|
-
stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{let s=
|
|
546
|
-
|
|
547
|
-
value:t,optionName:r,direction:n});
|
|
548
|
-
({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),
|
|
549
|
-
optionName:n,direction:o})=>{
|
|
550
|
-
type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>
|
|
551
|
-
o);return
|
|
552
|
-
l"?t.href===r.href:t===r,
|
|
553
|
-
r.transform);
|
|
554
|
-
not target ${
|
|
555
|
-
addProperties:e,options:t,isSync:n});return t.stdio=s.map(({stdioItems:a})=>
|
|
556
|
-
isSync:n})=>{let o=sr(t),{stdioItems:i,isStdioArray:s}=
|
|
557
|
-
c=i.map(d=>
|
|
558
|
-
objectMode:u,stdioItems:l}},
|
|
559
|
-
map(c=>
|
|
560
|
-
e,t),value:e,optionName:t}),
|
|
561
|
-
ray.`);if(t){for(let{value:n,optionName:o}of e)if(
|
|
562
|
-
\`.`)}},
|
|
531
|
+
\`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,Z.length);return Array.from(
|
|
532
|
+
{length:r},(n,o)=>e[o])},rw=e=>Z.some(t=>e[t]!==void 0),ql=(e,t)=>Array.isArray(e)?e.map(r=>ql(r,t)):e??(t>=Z.length?"ig\
|
|
533
|
+
nore":"pipe"),nw=(e,t,r)=>e.map((n,o)=>!t[o]&&o!==0&&!Ve(r,o)&&ow(n)?"ignore":n),ow=e=>e==="pipe"||Array.isArray(e)&&e.every(
|
|
534
|
+
t=>t==="pipe");import{readFileSync as iw}from"node:fs";import sw from"node:tty";var Kl=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?aw({stdioItem:e,
|
|
535
|
+
fdNumber:n,direction:o}):uw({stdioItem:e,fdNumber:n}),aw=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{
|
|
536
|
+
let i=cw({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(ie(t,{checkOpen:!1}))throw new TypeError(
|
|
537
|
+
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},cw=({value:e,
|
|
538
|
+
optionName:t,fdNumber:r,direction:n})=>{let o=lw(e,r);if(o!==void 0){if(n==="output")return{type:"fileNumber",value:o,optionName:t};
|
|
539
|
+
if(sw.isatty(o))throw new TypeError(`The \`${t}: ${vr(e)}\` option is invalid: it cannot be a TTY with synchronous method\
|
|
540
|
+
s.`);return{type:"uint8Array",value:be(iw(o)),optionName:t}}},lw=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")
|
|
541
|
+
return e;let r=ir.indexOf(e);if(r!==-1)return r},uw=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>t==="in\
|
|
542
|
+
herit"?{type:"nodeStream",value:Yl(n,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:Yl(t,t,r),optionName:r}:
|
|
543
|
+
ie(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,Yl=(e,t,r)=>{let n=ir[e];if(n===void 0)throw new TypeError(
|
|
544
|
+
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n};var Jl=({input:e,inputFile:t},r)=>r===0?[...dw(e),...fw(t)]:[],dw=e=>e===void 0?[]:[{type:pw(e),value:e,optionName:"inpu\
|
|
545
|
+
t"}],pw=e=>{if(Ne(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(B(e))return"uint8Array";throw new Error(
|
|
546
|
+
"The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},fw=e=>e===void 0?[]:[{...mw(e),optionName:"\
|
|
547
|
+
inputFile"}],mw=e=>{if(Wr(e))return{type:"fileUrl",value:e};if(Go(e))return{type:"filePath",value:{file:e}};throw new Error(
|
|
548
|
+
"The `inputFile` option must be a file path string or a file URL.")};var Xl=e=>e.filter((t,r)=>e.every((n,o)=>t.value!==n.value||r>=o||t.type==="generator"||t.type==="asyncGenerator")),Zl=({
|
|
549
|
+
stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{let s=hw(o,e);if(s.length!==0){if(i){
|
|
550
|
+
gw({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});return}if(Ul.has(e))return Ql({otherStdioItems:s,type:e,
|
|
551
|
+
value:t,optionName:r,direction:n});zl.has(e)&&ww({otherStdioItems:s,type:e,value:t,optionName:r})}},hw=(e,t)=>e.flatMap(
|
|
552
|
+
({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),gw=({otherStdioItems:e,type:t,value:r,
|
|
553
|
+
optionName:n,direction:o})=>{Fo.has(t)&&Ql({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})},Ql=({otherStdioItems:e,
|
|
554
|
+
type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>bw(a,r));if(i.length===0)return;let s=i.find(a=>a.direction!==
|
|
555
|
+
o);return eu(s,n,t),o==="output"?i[0].stream:void 0},bw=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUr\
|
|
556
|
+
l"?t.href===r.href:t===r,ww=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{transform:i}})=>i===
|
|
557
|
+
r.transform);eu(o,n,t)},eu=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must\
|
|
558
|
+
not target ${Ae[r]} that is the same.`)};var Kr=(e,t,r,n)=>{let i=Wl(t,r,n).map((a,c)=>yw({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=Rw({initialFileDescriptors:i,
|
|
559
|
+
addProperties:e,options:t,isSync:n});return t.stdio=s.map(({stdioItems:a})=>Cw(a)),s},yw=({stdioOption:e,fdNumber:t,options:r,
|
|
560
|
+
isSync:n})=>{let o=sr(t),{stdioItems:i,isStdioArray:s}=_w({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=Fl(i,t,o),
|
|
561
|
+
c=i.map(d=>Kl({stdioItem:d,isStdioArray:s,fdNumber:t,direction:a,isSync:n})),l=Hl(c,o,a,r),u=Gl(l,a);return Iw(l,u),{direction:a,
|
|
562
|
+
objectMode:u,stdioItems:l}},_w=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let i=[...(Array.isArray(e)?e:[e]).
|
|
563
|
+
map(c=>Sw(c,n)),...Jl(r,t)],s=Xl(i),a=s.length>1;return Ew(s,a,n),Tw(s),{stdioItems:s,isStdioArray:a}},Sw=(e,t)=>({type:xl(
|
|
564
|
+
e,t),value:e,optionName:t}),Ew=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty ar\
|
|
565
|
+
ray.`);if(t){for(let{value:n,optionName:o}of e)if(vw.has(n))throw new Error(`The \`${o}\` option must not include \`${n}\
|
|
566
|
+
\`.`)}},vw=new Set(["ignore","ipc"]),Tw=e=>{for(let t of e)Aw(t)},Aw=({type:e,value:t,optionName:r})=>{if(Ml(t))throw new TypeError(
|
|
563
567
|
`The \`${r}: URL\` option must use the \`file:\` scheme.
|
|
564
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(
|
|
565
|
-
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},
|
|
568
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Dl(e,t))throw new TypeError(`Th\
|
|
569
|
+
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Iw=(e,t)=>{if(!t)return;let r=e.find(({type:n})=>Yr.
|
|
566
570
|
has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectM\
|
|
567
|
-
ode.`)},
|
|
568
|
-
fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw
|
|
569
|
-
objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>
|
|
570
|
-
direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},
|
|
571
|
-
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=
|
|
572
|
-
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},
|
|
573
|
-
r)&&r.destroy()},
|
|
574
|
-
return t==="native"?r:"pipe"};var
|
|
575
|
-
rlapped")&&
|
|
576
|
-
s.`)},
|
|
577
|
-
|
|
571
|
+
ode.`)},Rw=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let i of e)o.push(Pw({fileDescriptor:i,
|
|
572
|
+
fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw qo(o),i}},Pw=({fileDescriptor:{direction:e,
|
|
573
|
+
objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>Ow({stdioItem:c,addProperties:o,
|
|
574
|
+
direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},Ow=({stdioItem:e,addProperties:t,
|
|
575
|
+
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=Zl({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return s!==
|
|
576
|
+
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},qo=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!re(
|
|
577
|
+
r)&&r.destroy()},Cw=e=>{if(e.length>1)return e.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;
|
|
578
|
+
return t==="native"?r:"pipe"};var nu=(e,t)=>Kr(kw,e,t,!0),fe=({type:e,optionName:t})=>{ou(t,Ae[e])},xw=({optionName:e,value:t})=>((t==="ipc"||t==="ove\
|
|
579
|
+
rlapped")&&ou(e,`"${t}"`),{}),ou=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous method\
|
|
580
|
+
s.`)},ru={generator(){},asyncGenerator:fe,webStream:fe,nodeStream:fe,webTransform:fe,duplex:fe,asyncIterable:fe,native:xw},
|
|
581
|
+
kw={input:{...ru,fileUrl:({value:e})=>({contents:[be(tu(e))]}),filePath:({value:{file:e}})=>({contents:[be(tu(e))]}),fileNumber:fe,
|
|
578
582
|
iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},
|
|
579
|
-
output:{...
|
|
580
|
-
path:e}),iterable:fe,string:fe,uint8Array:fe}};var
|
|
581
|
-
t,{});return[...r(e),...n()]},
|
|
583
|
+
output:{...ru,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({
|
|
584
|
+
path:e}),iterable:fe,string:fe,uint8Array:fe}};var _e=(e,{stripFinalNewline:t},r)=>Yo(t,r)&&e!==void 0&&!Array.isArray(e)?Xe(e):e,Yo=(e,t)=>t==="all"?e[1]||e[2]:e[t];import{Transform as Qw,getDefaultHighWaterMark as hu}from"node:stream";var Jr=(e,t,r,n)=>e||r?void 0:su(t,n),Jo=(e,t,r)=>r?e.flatMap(n=>iu(n,t)):iu(e,t),iu=(e,t)=>{let{transform:r,final:n}=su(
|
|
585
|
+
t,{});return[...r(e),...n()]},su=(e,t)=>(t.previousChunks="",{transform:Nw.bind(void 0,t,e),final:Mw.bind(void 0,t)}),Nw=function*(e,t,r){
|
|
582
586
|
if(typeof r!="string"){yield r;return}let{previousChunks:n}=e,o=-1;for(let i=0;i<r.length;i+=1)if(r[i]===`
|
|
583
|
-
`){let s
|
|
584
|
-
e.previousChunks=n}
|
|
585
|
-
e.length>0&&(yield e)},
|
|
586
|
-
void 0,n)},
|
|
587
|
-
ing"?
|
|
587
|
+
`){let s=$w(r,i,t,e),a=r.slice(o+1,i+1-s);n.length>0&&(a=Ko(n,a),n=""),yield a,o=i}o!==r.length-1&&(n=Ko(n,r.slice(o+1))),
|
|
588
|
+
e.previousChunks=n},$w=(e,t,r,n)=>r?0:(n.isWindowsNewline=t!==0&&e[t-1]==="\r",n.isWindowsNewline?2:1),Mw=function*({previousChunks:e}){
|
|
589
|
+
e.length>0&&(yield e)},au=({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:Dw.bind(
|
|
590
|
+
void 0,n)},Dw=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:i}=typeof t=="str\
|
|
591
|
+
ing"?Lw:Uw;if(t.at(-1)===o){yield t;return}yield i(t,e?n:r)},Ko=(e,t)=>`${e}${t}`,Lw={windowsNewline:`\r
|
|
588
592
|
`,unixNewline:`
|
|
589
593
|
`,LF:`
|
|
590
|
-
`,concatBytes:
|
|
591
|
-
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:
|
|
592
|
-
`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},
|
|
593
|
-
bind(void 0,t):
|
|
594
|
+
`,concatBytes:Ko},Bw=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},Uw={windowsNewline:new Uint8Array(
|
|
595
|
+
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Bw};import{Buffer as zw}from"node:buffer";var cu=(e,t)=>e?void 0:Gw.bind(void 0,t),Gw=function*(e,t){if(typeof t!="string"&&!B(t)&&!zw.isBuffer(t))throw new TypeError(
|
|
596
|
+
`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},lu=(e,t)=>e?Hw.
|
|
597
|
+
bind(void 0,t):Fw.bind(void 0,t),Hw=function*(e,t){uu(e,t),yield t},Fw=function*(e,t){if(uu(e,t),typeof t!="string"&&!B(
|
|
594
598
|
t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},
|
|
595
|
-
|
|
599
|
+
uu=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
596
600
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
597
|
-
if (condition) { yield value; }`)};import{Buffer as
|
|
598
|
-
bind(void 0,n),final:
|
|
599
|
-
t):yield t},
|
|
600
|
-
n.push(o)}finally{delete t.currentIterable}}),Zr=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=
|
|
601
|
-
for await(let o of n(e))yield*Zr(o,t,r+1)},
|
|
602
|
-
t),e)},
|
|
603
|
-
if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),
|
|
604
|
-
e)],
|
|
605
|
-
for(let[t,{final:r}]of Object.entries(e))yield*
|
|
606
|
-
n,r,t+1)},
|
|
607
|
-
c=
|
|
608
|
-
u?
|
|
609
|
-
o),transform(h,
|
|
610
|
-
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=
|
|
611
|
-
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:
|
|
612
|
-
n),
|
|
613
|
-
filter(Boolean)};var
|
|
614
|
-
([t])=>Number(t))),
|
|
615
|
-
0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${
|
|
616
|
-
ronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>
|
|
617
|
-
r),
|
|
618
|
-
alid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as
|
|
619
|
-
"native"&&
|
|
620
|
-
for await(let o of e)
|
|
621
|
-
let n=
|
|
622
|
-
from({length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>
|
|
623
|
-
isMaxBuffer:n,verboseInfo:o},r)),...i}},
|
|
624
|
-
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(e===null)return;let
|
|
625
|
-
objectMode:h}=t[r],
|
|
626
|
-
fdNumber:r});
|
|
627
|
-
void 0;try{return n.error===void 0&&
|
|
628
|
-
return n.error=o,e}},
|
|
629
|
-
if(r==="buffer")return{serializedResult:
|
|
630
|
-
{serializedResult:s}},
|
|
631
|
-
if(!en({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=
|
|
632
|
-
|
|
633
|
-
i)?
|
|
634
|
-
"all")]:Array.isArray(t)?[
|
|
635
|
-
allSettled([
|
|
636
|
-
try{return await
|
|
637
|
-
t,r]},
|
|
638
|
-
resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},
|
|
639
|
-
e,t,r),d=
|
|
640
|
-
return
|
|
641
|
-
options:u}=Mr(e,t,a);
|
|
642
|
-
options:u,fileDescriptors:d}},
|
|
601
|
+
if (condition) { yield value; }`)};import{Buffer as jw}from"node:buffer";import{StringDecoder as Vw}from"node:string_decoder";var Xr=(e,t,r)=>{if(r)return;if(e)return{transform:Ww.bind(void 0,new TextEncoder)};let n=new Vw(t);return{transform:qw.
|
|
602
|
+
bind(void 0,n),final:Yw.bind(void 0,n)}},Ww=function*(e,t){jw.isBuffer(t)?yield be(t):typeof t=="string"?yield e.encode(
|
|
603
|
+
t):yield t},qw=function*(e,t){yield B(t)?e.write(t):t},Yw=function*(e){let t=e.end();t!==""&&(yield t)};import{callbackify as du}from"node:util";var Xo=du(async(e,t,r,n)=>{t.currentIterable=e(...r);try{for await(let o of t.currentIterable)
|
|
604
|
+
n.push(o)}finally{delete t.currentIterable}}),Zr=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=Jw}=t[r];
|
|
605
|
+
for await(let o of n(e))yield*Zr(o,t,r+1)},pu=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Kw(r,Number(
|
|
606
|
+
t),e)},Kw=async function*(e,t,r){if(e!==void 0)for await(let n of e())yield*Zr(n,r,t+1)},fu=du(async({currentIterable:e},t)=>{
|
|
607
|
+
if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Jw=function*(e){yield e};var Zo=(e,t,r,n)=>{try{for(let o of e(...t))r.push(o);n()}catch(o){n(o)}},mu=(e,t)=>[...t.flatMap(r=>[...Me(r,e,0)]),...$t(
|
|
608
|
+
e)],Me=function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=Zw}=t[r];for(let o of n(e))yield*Me(o,t,r+1)},$t=function*(e){
|
|
609
|
+
for(let[t,{final:r}]of Object.entries(e))yield*Xw(r,Number(t),e)},Xw=function*(e,t,r){if(e!==void 0)for(let n of e())yield*Me(
|
|
610
|
+
n,r,t+1)},Zw=function*(e){yield e};var Qo=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},
|
|
611
|
+
c=gu(e,s,i),l=$e(t),u=$e(r),d=l?Xo.bind(void 0,Zr,a):Zo.bind(void 0,Me),p=l||u?Xo.bind(void 0,pu,a):Zo.bind(void 0,$t),f=l||
|
|
612
|
+
u?fu.bind(void 0,a):void 0;return{stream:new Qw({writableObjectMode:n,writableHighWaterMark:hu(n),readableObjectMode:o,readableHighWaterMark:hu(
|
|
613
|
+
o),transform(h,y,w){d([h,c,0],this,w)},flush(h){p([c],this,h)},destroy:f})}},Qr=(e,t,r,n)=>{let o=t.filter(({type:s})=>s===
|
|
614
|
+
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=gu(s,r,a);e=mu(c,e)}return e},gu=({transform:e,final:t,
|
|
615
|
+
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:cu(n,a)},Xr(r,s,
|
|
616
|
+
n),Jr(r,i,n,c),{transform:e,final:t},{transform:lu(o,a)},au({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].
|
|
617
|
+
filter(Boolean)};var bu=(e,t)=>{for(let r of ey(e))ty(e,r,t)},ey=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(
|
|
618
|
+
([t])=>Number(t))),ty=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:a})=>a!==void 0);if(o.length===0)return;if(t!==
|
|
619
|
+
0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ae[a]} with synch\
|
|
620
|
+
ronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>ry(a,n));r.input=Tt(s)},ry=(e,t)=>{let r=Qr(e,t,"utf8",!0);return ny(
|
|
621
|
+
r),Tt(r)},ny=e=>{let t=e.find(r=>typeof r!="string"&&!B(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is inv\
|
|
622
|
+
alid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as ay,appendFileSync as cy}from"node:fs";var en=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ve(r,n)&&!W.has(t)&&oy(n)&&(e.some(({type:o,value:i})=>o===
|
|
623
|
+
"native"&&iy.has(i))||e.every(({type:o})=>Q.has(o))),oy=e=>e===1||e===2,iy=new Set(["pipe","overlapped"]),wu=async(e,t,r,n)=>{
|
|
624
|
+
for await(let o of e)sy(t)||_u(o,r,n)},yu=(e,t,r)=>{for(let n of e)_u(n,t,r)},sy=e=>e._readableState.pipes.length>0,_u=(e,t,r)=>{
|
|
625
|
+
let n=pr(e);le({type:"output",verboseMessage:n,fdNumber:t,verboseInfo:r})};var Su=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.
|
|
626
|
+
from({length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>ly({result:c,fileDescriptors:e,fdNumber:l,state:i,outputFiles:s,
|
|
627
|
+
isMaxBuffer:n,verboseInfo:o},r)),...i}},ly=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{
|
|
628
|
+
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(e===null)return;let p=El(e,i,d),f=be(p),{stdioItems:m,
|
|
629
|
+
objectMode:h}=t[r],y=uy([f],m,c,n),{serializedResult:w,finalResult:g=w}=dy({chunks:y,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,
|
|
630
|
+
fdNumber:r});py({serializedResult:w,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let v=a[r]?g:
|
|
631
|
+
void 0;try{return n.error===void 0&&fy(w,m,o),v}catch(_){return n.error=_,v}},uy=(e,t,r,n)=>{try{return Qr(e,t,r,!1)}catch(o){
|
|
632
|
+
return n.error=o,e}},dy=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};
|
|
633
|
+
if(r==="buffer")return{serializedResult:Tt(e)};let s=Ds(e,r);return n[i]?{serializedResult:s,finalResult:Jo(s,!o[i],t)}:
|
|
634
|
+
{serializedResult:s}},py=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{
|
|
635
|
+
if(!en({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=Jo(e,!1,s);try{yu(a,t,n)}catch(c){r.error??=c}},
|
|
636
|
+
fy=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:i})=>Yr.has(i))){let i=typeof n=="string"?n:n.toString();o||r.has(
|
|
637
|
+
i)?cy(n,e):(r.add(i),ay(n,e))}};var Eu=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,_e(t,r,
|
|
638
|
+
"all")]:Array.isArray(t)?[_e(e,r,"all"),...t]:B(e)&&B(t)?oo([e,t]):`${e}${t}`};import{once as ei}from"node:events";var vu=async(e,t)=>{let[r,n]=await my(e);return t.isForcefullyTerminated??=!1,[r,n]},my=async e=>{let[t,r]=await Promise.
|
|
639
|
+
allSettled([ei(e,"spawn"),ei(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?Tu(e):r.value},Tu=async e=>{
|
|
640
|
+
try{return await ei(e,"exit")}catch{return Tu(e)}},Au=async e=>{let[t,r]=await e;if(!hy(t,r)&&ti(t,r))throw new ne;return[
|
|
641
|
+
t,r]},hy=(e,t)=>e===void 0&&t===void 0,ti=(e,t)=>e!==0||t!==null;var Iu=({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let i=gy(e,t,r),s=i?.code==="ETIMEDOUT",a=Sl(i,n,o);return{
|
|
642
|
+
resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},gy=(e,t,r)=>e!==void 0?e:ti(t,r)?new ne:void 0;var Ru=(e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=wy(
|
|
643
|
+
e,t,r),d=Sy({file:n,commandArguments:o,options:l,command:i,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});
|
|
644
|
+
return et(d,c,l)},wy=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=mr(e,t,r),a=yy(r),{file:c,commandArguments:l,
|
|
645
|
+
options:u}=Mr(e,t,a);_y(u);let d=nu(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:o,startTime:i,verboseInfo:s,
|
|
646
|
+
options:u,fileDescriptors:d}},yy=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,_y=({ipc:e,ipcInput:t,detached:r,cancelSignal:n})=>{t&&
|
|
643
647
|
tn("ipcInput"),e&&tn("ipc: true"),r&&tn("detached: true"),n&&tn("cancelSignal")},tn=e=>{throw new TypeError(`The "${e}" \
|
|
644
|
-
option cannot be used with synchronous methods.`)},
|
|
645
|
-
fileDescriptors:s,startTime:a})=>{let c=
|
|
646
|
-
startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:
|
|
647
|
-
{fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:
|
|
648
|
-
return
|
|
649
|
-
|
|
650
|
-
r);return
|
|
651
|
-
isSync:!0})}},
|
|
648
|
+
option cannot be used with synchronous methods.`)},Sy=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:i,
|
|
649
|
+
fileDescriptors:s,startTime:a})=>{let c=Ey({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:s,
|
|
650
|
+
startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:p,isMaxBuffer:f}=Iu(c,r),{output:m,error:h=l}=Su(
|
|
651
|
+
{fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:f,verboseInfo:i}),y=m.map((g,v)=>_e(g,r,v)),w=_e(Eu(m,r),r,"all");
|
|
652
|
+
return Ty({error:h,exitCode:u,signal:d,timedOut:p,isMaxBuffer:f,stdio:y,all:w,options:r,command:n,escapedCommand:o,startTime:a})},
|
|
653
|
+
Ey=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:i,startTime:s})=>{try{bu(i,r);let a=vy(
|
|
654
|
+
r);return by(...Dr(e,t,a))}catch(a){return Qe({error:a,command:n,escapedCommand:o,fileDescriptors:i,options:r,startTime:s,
|
|
655
|
+
isSync:!0})}},vy=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:jr(t)}),Ty=({error:e,exitCode:t,signal:r,
|
|
652
656
|
timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>e===void 0?Vr({command:c,escapedCommand:l,
|
|
653
|
-
stdio:i,all:s,ipcOutput:[],options:a,startTime:u}):
|
|
654
|
-
isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as
|
|
655
|
-
ipc:n,isConnected:Or(e)}),
|
|
656
|
-
isSubprocess:r,filter:n,reference:o})=>{Ar(t,o);let i=
|
|
657
|
-
i,n,s),
|
|
658
|
-
let[n]=await
|
|
659
|
-
signal:r})=>{await
|
|
660
|
-
throw Er(n,t)};import{once as
|
|
661
|
-
shouldAwait:!r,reference:o}),
|
|
662
|
-
getEachMessage",isSubprocess:r,ipc:n,isConnected:Or(e)}),Ar(t,i);let s=
|
|
663
|
-
s,a),
|
|
664
|
-
controller:a,state:c,reference:i})},
|
|
665
|
-
|
|
666
|
-
error=Er(o,t),r.abort()}catch{}},
|
|
667
|
-
state:s,reference:a}){try{for await(let[c]of
|
|
668
|
-
Ir(t,a),n||
|
|
669
|
-
bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},
|
|
670
|
-
channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:
|
|
671
|
-
getEachMessage:
|
|
672
|
-
|
|
673
|
-
options:o,startTime:i,isSync:!1}),l=
|
|
674
|
-
from({length:t.length-3},
|
|
675
|
-
return e.end(),e},
|
|
676
|
-
e,t,r);import{createReadStream as
|
|
677
|
-
Writable as
|
|
678
|
-
|
|
679
|
-
readableObjectMode:r}}){let n=t||r;return{stream:
|
|
680
|
-
native(){}},
|
|
681
|
-
value:e})=>({stream
|
|
682
|
-
e)}),string:({value:e})=>({stream
|
|
683
|
-
value:e})=>({stream:
|
|
684
|
-
stream:
|
|
685
|
-
finished as
|
|
686
|
-
t \`${typeof e}\`.`);for(let o of e)
|
|
687
|
-
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var
|
|
688
|
-
readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},
|
|
689
|
-
[]);#r=new Set([]);#e=new Set([]);#n;#i=Symbol("unpipe");#o=new WeakMap;add(t){if(
|
|
690
|
-
t),this.#n??=
|
|
691
|
-
onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(
|
|
692
|
-
return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},
|
|
693
|
-
e,
|
|
694
|
-
signal:t})=>{try{await
|
|
695
|
-
o]of
|
|
696
|
-
readable stream, got: \`${typeof e}\`.`)},
|
|
697
|
-
unpipeEvent:s})=>{rn(e,
|
|
698
|
-
streams:r,ended:n,aborted:o,controller:a}),
|
|
699
|
-
a.abort(),rn(e,-
|
|
700
|
-
await e,r.aborted||
|
|
701
|
-
controller:{signal:i}})=>{try{await
|
|
702
|
-
aborted||!r.has(t))return;
|
|
703
|
-
signal:i}})=>{if(await
|
|
704
|
-
|
|
705
|
-
e.writable)&&e.destroy()},
|
|
706
|
-
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
type:c})=>
|
|
710
|
-
fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]
|
|
711
|
-
r==="output"?
|
|
712
|
-
rr"],
|
|
713
|
-
a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},
|
|
714
|
-
CPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&
|
|
657
|
+
stdio:i,all:s,ipcOutput:[],options:a,startTime:u}):Nt({error:e,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,
|
|
658
|
+
isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as dS}from"node:events";import{spawn as pS}from"node:child_process";import ku from"node:process";import{once as ri,on as Ay}from"node:events";var Pu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:i}={})=>(Ye({methodName:"getOneMessage",isSubprocess:r,
|
|
659
|
+
ipc:n,isConnected:Or(e)}),Iy({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:o})),Iy=async({anyProcess:e,channel:t,
|
|
660
|
+
isSubprocess:r,filter:n,reference:o})=>{Ar(t,o);let i=Te(e,t,r),s=new AbortController;try{return await Promise.race([Ry(
|
|
661
|
+
i,n,s),Py(i,r,s),Oy(i,r,s)])}catch(a){throw Ke(e),a}finally{s.abort(),Ir(t,o)}},Ry=async(e,t,{signal:r})=>{if(t===void 0){
|
|
662
|
+
let[n]=await ri(e,"message",{signal:r});return n}for await(let[n]of Ay(e,"message",{signal:r}))if(t(n))return n},Py=async(e,t,{
|
|
663
|
+
signal:r})=>{await ri(e,"disconnect",{signal:r}),mc(t)},Oy=async(e,t,{signal:r})=>{let[n]=await ri(e,"strict:error",{signal:r});
|
|
664
|
+
throw Er(n,t)};import{once as Cu,on as Cy}from"node:events";var xu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>ni({anyProcess:e,channel:t,isSubprocess:r,ipc:n,
|
|
665
|
+
shouldAwait:!r,reference:o}),ni=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{Ye({methodName:"\
|
|
666
|
+
getEachMessage",isSubprocess:r,ipc:n,isConnected:Or(e)}),Ar(t,i);let s=Te(e,t,r),a=new AbortController,c={};return xy(e,
|
|
667
|
+
s,a),ky({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Ny({anyProcess:e,channel:t,ipcEmitter:s,isSubprocess:r,shouldAwait:o,
|
|
668
|
+
controller:a,state:c,reference:i})},xy=async(e,t,r)=>{try{await Cu(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},
|
|
669
|
+
ky=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await Cu(e,"strict:error",{signal:r.signal});n.
|
|
670
|
+
error=Er(o,t),r.abort()}catch{}},Ny=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,
|
|
671
|
+
state:s,reference:a}){try{for await(let[c]of Cy(r,"message",{signal:i.signal}))Ou(s),yield c}catch{Ou(s)}finally{i.abort(),
|
|
672
|
+
Ir(t,a),n||Ke(e),o&&await e}},Ou=({error:e})=>{if(e)throw e};var Nu=(e,{ipc:t})=>{Object.assign(e,Mu(e,!1,t))},$u=()=>{let e=ku,t=!0,r=ku.channel!==void 0;return{...Mu(e,t,r),getCancelSignal:Gc.
|
|
673
|
+
bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},Mu=(e,t,r)=>({sendMessage:Nr.bind(void 0,{anyProcess:e,
|
|
674
|
+
channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:Pu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),
|
|
675
|
+
getEachMessage:xu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as $y}from"node:child_process";import{PassThrough as My,Readable as Dy,Writable as Ly,Duplex as By}from"node:stream";var Du=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,verboseInfo:s})=>{qo(n);let a=new $y;
|
|
676
|
+
Uy(a,n),Object.assign(a,{readable:zy,writable:Gy,duplex:Hy});let c=Qe({error:e,command:t,escapedCommand:r,fileDescriptors:n,
|
|
677
|
+
options:o,startTime:i,isSync:!1}),l=Fy(c,s,o);return{subprocess:a,promise:l}},Uy=(e,t)=>{let r=Mt(),n=Mt(),o=Mt(),i=Array.
|
|
678
|
+
from({length:t.length-3},Mt),s=Mt(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,all:s,stdio:a})},Mt=()=>{let e=new My;
|
|
679
|
+
return e.end(),e},zy=()=>new Dy({read(){}}),Gy=()=>new Ly({write(){}}),Hy=()=>new By({read(){},write(){}}),Fy=async(e,t,r)=>et(
|
|
680
|
+
e,t,r);import{createReadStream as Lu,createWriteStream as Bu}from"node:fs";import{Buffer as jy}from"node:buffer";import{Readable as Dt,
|
|
681
|
+
Writable as Vy,Duplex as Wy}from"node:stream";var zu=(e,t)=>Kr(qy,e,t,!1),Lt=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${Ae[e]}.`)},
|
|
682
|
+
Uu={fileNumber:Lt,generator:Qo,asyncGenerator:Qo,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,
|
|
683
|
+
readableObjectMode:r}}){let n=t||r;return{stream:Wy.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),
|
|
684
|
+
native(){}},qy={input:{...Uu,fileUrl:({value:e})=>({stream:Lu(e)}),filePath:({value:{file:e}})=>({stream:Lu(e)}),webStream:({
|
|
685
|
+
value:e})=>({stream:Dt.fromWeb(e)}),iterable:({value:e})=>({stream:Dt.from(e)}),asyncIterable:({value:e})=>({stream:Dt.from(
|
|
686
|
+
e)}),string:({value:e})=>({stream:Dt.from(e)}),uint8Array:({value:e})=>({stream:Dt.from(jy.from(e))})},output:{...Uu,fileUrl:({
|
|
687
|
+
value:e})=>({stream:Bu(e)}),filePath:({value:{file:e,append:t}})=>({stream:Bu(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({
|
|
688
|
+
stream:Vy.fromWeb(e)}),iterable:Lt,asyncIterable:Lt,string:Lt,uint8Array:Lt}};import{on as Yy,once as Gu}from"node:events";import{PassThrough as Ky,getDefaultHighWaterMark as Jy}from"node:stream";import{
|
|
689
|
+
finished as ju}from"node:stream/promises";function De(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, go\
|
|
690
|
+
t \`${typeof e}\`.`);for(let o of e)ii(o);let t=e.some(({readableObjectMode:o})=>o),r=Xy(e,t),n=new oi({objectMode:t,writableHighWaterMark:r,
|
|
691
|
+
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var Xy=(e,t)=>{if(e.length===0)return Jy(t);let r=e.filter(({
|
|
692
|
+
readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},oi=class extends Ky{#t=new Set(
|
|
693
|
+
[]);#r=new Set([]);#e=new Set([]);#n;#i=Symbol("unpipe");#o=new WeakMap;add(t){if(ii(t),this.#t.has(t))return;this.#t.add(
|
|
694
|
+
t),this.#n??=Zy(this,this.#t,this.#i);let r=t_({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,
|
|
695
|
+
onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(ii(t),!this.#t.has(t))
|
|
696
|
+
return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},Zy=async(e,t,r)=>{rn(
|
|
697
|
+
e,Hu);let n=new AbortController;try{await Promise.race([Qy(e,n),e_(e,t,r,n)])}finally{n.abort(),rn(e,-Hu)}},Qy=async(e,{
|
|
698
|
+
signal:t})=>{try{await ju(e,{signal:t,cleanup:!0})}catch(r){throw Vu(e,r),r}},e_=async(e,t,r,{signal:n})=>{for await(let[
|
|
699
|
+
o]of Yy(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},ii=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a\
|
|
700
|
+
readable stream, got: \`${typeof e}\`.`)},t_=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:i,
|
|
701
|
+
unpipeEvent:s})=>{rn(e,Fu);let a=new AbortController;try{await Promise.race([r_(i,t,a),n_({passThroughStream:e,stream:t,
|
|
702
|
+
streams:r,ended:n,aborted:o,controller:a}),o_({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{
|
|
703
|
+
a.abort(),rn(e,-Fu)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?si(e):i_(e))},r_=async(e,t,{signal:r})=>{try{
|
|
704
|
+
await e,r.aborted||si(t)}catch(n){r.aborted||Vu(t,n)}},n_=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,
|
|
705
|
+
controller:{signal:i}})=>{try{await ju(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.
|
|
706
|
+
aborted||!r.has(t))return;Wu(s)?o.add(t):qu(e,s)}},o_=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{
|
|
707
|
+
signal:i}})=>{if(await Gu(e,o,{signal:i}),!e.readable)return Gu(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},
|
|
708
|
+
i_=e=>{e.writable&&e.end()},Vu=(e,t)=>{Wu(t)?si(e):qu(e,t)},Wu=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",si=e=>{(e.readable||
|
|
709
|
+
e.writable)&&e.destroy()},qu=(e,t)=>{e.destroyed||(e.once("error",s_),e.destroy(t))},s_=()=>{},rn=(e,t)=>{let r=e.getMaxListeners();
|
|
710
|
+
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},Hu=2,Fu=1;import{finished as Yu}from"node:stream/promises";var rt=(e,t)=>{e.pipe(t),a_(e,t),c_(e,t)},a_=async(e,t)=>{if(!(re(e)||re(t))){try{await Yu(e,{cleanup:!0,readable:!0,writable:!1})}catch{}
|
|
711
|
+
ai(t)}},ai=e=>{e.writable&&e.end()},c_=async(e,t)=>{if(!(re(e)||re(t))){try{await Yu(t,{cleanup:!0,readable:!1,writable:!0})}catch{}
|
|
712
|
+
ci(e)}},ci=e=>{e.readable&&e.destroy()};var Ku=(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(({
|
|
713
|
+
type:c})=>Q.has(c)))l_(e,a,s,o);for(let{stream:a}of i.filter(({type:c})=>!Q.has(c)))d_({subprocess:e,stream:a,direction:s,
|
|
714
|
+
fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]:De(i);rt(s,o)}},l_=(e,t,r,n)=>{
|
|
715
|
+
r==="output"?rt(e.stdio[n],t):rt(t,e.stdio[n]);let o=u_[n];o!==void 0&&(e[o]=t),e.stdio[n]=t},u_=["stdin","stdout","stde\
|
|
716
|
+
rr"],d_=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{if(t===void 0)return;p_(t,i);let[s,
|
|
717
|
+
a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},p_=(e,{signal:t})=>{re(e)&&ke(e,f_,t)},f_=2;import{addAbortListener as g_}from"node:events";var Le=[];Le.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Le.push("SIGALRM","SIGABRT","SIGVTALRM","SIGX\
|
|
718
|
+
CPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Le.push("SIGIO","SIGPOLL","S\
|
|
715
719
|
IGPWR","SIGSTKFLT");var nn=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit==
|
|
716
|
-
"function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",
|
|
717
|
-
for("signal-exit emitter"),
|
|
718
|
-
afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(
|
|
720
|
+
"function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",li=Symbol.
|
|
721
|
+
for("signal-exit emitter"),ui=globalThis,m_=Object.defineProperty.bind(Object),di=class{emitted={afterExit:!1,exit:!1};listeners={
|
|
722
|
+
afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(ui[li])return ui[li];m_(ui,li,{value:this,writable:!1,enumerable:!1,
|
|
719
723
|
configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===
|
|
720
724
|
0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.
|
|
721
|
-
listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},on=class{},
|
|
722
|
-
onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),
|
|
723
|
-
|
|
724
|
-
t,this.#o={};for(let r of
|
|
725
|
+
listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},on=class{},h_=e=>({onExit(t,r){return e.
|
|
726
|
+
onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),pi=class extends on{onExit(){return()=>{}}load(){}unload(){}},
|
|
727
|
+
fi=class extends on{#t=mi.platform==="win32"?"SIGINT":"SIGHUP";#r=new di;#e;#n;#i;#o={};#s=!1;constructor(t){super(),this.#e=
|
|
728
|
+
t,this.#o={};for(let r of Le)this.#o[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__==
|
|
725
729
|
"object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();
|
|
726
730
|
let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||t.kill(t.pid,a)}};this.#i=t.reallyExit,this.#n=t.emit}onExit(t,r){
|
|
727
731
|
if(!nn(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{
|
|
728
732
|
this.#r.removeListener(n,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){
|
|
729
|
-
if(!this.#s){this.#s=!0,this.#r.count+=1;for(let t of
|
|
730
|
-
t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,
|
|
733
|
+
if(!this.#s){this.#s=!0,this.#r.count+=1;for(let t of Le)try{let r=this.#o[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#c(
|
|
734
|
+
t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,Le.forEach(t=>{let r=this.#o[t];if(!r)throw new Error(
|
|
731
735
|
"Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=
|
|
732
736
|
this.#i,this.#r.count-=1)}#a(t){return nn(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#i.
|
|
733
737
|
call(this.#e,this.#e.exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&nn(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=
|
|
734
738
|
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)}},
|
|
735
|
-
|
|
736
|
-
from:l,unpipeSignal:u}=
|
|
737
|
-
sourceStream:d,sourceOptions:
|
|
738
|
-
startTime:i}},
|
|
739
|
-
destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},
|
|
740
|
-
isArray(r))return{destination:t(
|
|
739
|
+
mi=globalThis.process,{onExit:Ju,load:pN,unload:fN}=h_(nn(mi)?new fi(mi):new pi);var Xu=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=Ju(()=>{e.kill()});g_(n,()=>{o()})};var Qu=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=fr(),{destination:s,destinationStream:a,destinationError:c,
|
|
740
|
+
from:l,unpipeSignal:u}=b_(r,n,o),{sourceStream:d,sourceError:p}=y_(e,l),{options:f,fileDescriptors:m}=de.get(e);return{sourcePromise:t,
|
|
741
|
+
sourceStream:d,sourceOptions:f,sourceError:p,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,
|
|
742
|
+
startTime:i}},b_=(e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=w_(e,t,...r),a=Tr(n,i);return{
|
|
743
|
+
destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},w_=(e,t,r,...n)=>{if(Array.
|
|
744
|
+
isArray(r))return{destination:t(Zu,e)(r,...n),pipeOptions:e};if(typeof r=="string"||r instanceof URL||ro(r)){if(Object.keys(
|
|
741
745
|
e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of\
|
|
742
|
-
.pipe(options)("file", ...).');let[o,i,s]=nr(r,...n);return{destination:t(
|
|
746
|
+
.pipe(options)("file", ...).');let[o,i,s]=nr(r,...n);return{destination:t(Zu)(o,i,s),pipeOptions:s}}if(de.has(r)){if(Object.
|
|
743
747
|
keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(\
|
|
744
748
|
options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a templat\
|
|
745
|
-
e string, an options object, or an Execa subprocess: ${r}`)},
|
|
746
|
-
|
|
747
|
-
let a=
|
|
748
|
-
sourceOptions:i,startTime:s})},
|
|
749
|
-
n!==void 0)return n;if(n!==void 0)return
|
|
750
|
-
startTime:n})=>
|
|
751
|
-
ipe(destination)";var
|
|
752
|
-
pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as
|
|
753
|
-
[e]);return
|
|
754
|
-
readable:!1,writable:!0})}catch{}sn.delete(e)},sn=new WeakMap,
|
|
755
|
-
await
|
|
756
|
-
sourceOptions:o,startTime:i})};var an=(e,...t)=>{if(L(t[0]))return an.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=
|
|
757
|
-
e,...t),o=
|
|
749
|
+
e string, an options object, or an Execa subprocess: ${r}`)},Zu=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),
|
|
750
|
+
y_=(e,t)=>{try{return{sourceStream:Je(e,t)}}catch(r){return{sourceError:r}}};var td=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:i,startTime:s})=>{
|
|
751
|
+
let a=__({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(a!==void 0)throw hi({error:a,fileDescriptors:o,
|
|
752
|
+
sourceOptions:i,startTime:s})},__=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>{if(t!==void 0&&
|
|
753
|
+
n!==void 0)return n;if(n!==void 0)return ci(e),n;if(t!==void 0)return ai(r),t},hi=({error:e,fileDescriptors:t,sourceOptions:r,
|
|
754
|
+
startTime:n})=>Qe({error:e,command:ed,escapedCommand:ed,fileDescriptors:t,options:r,startTime:n,isSync:!1}),ed="source.p\
|
|
755
|
+
ipe(destination)";var rd=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.
|
|
756
|
+
pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as S_}from"node:stream/promises";var nd=(e,t,r)=>{let n=sn.has(t)?v_(e,t):E_(e,t);return ke(e,A_,r.signal),ke(t,I_,r.signal),T_(t),n},E_=(e,t)=>{let r=De(
|
|
757
|
+
[e]);return rt(r,t),sn.set(t,r),r},v_=(e,t)=>{let r=sn.get(t);return r.add(e),r},T_=async e=>{try{await S_(e,{cleanup:!0,
|
|
758
|
+
readable:!1,writable:!0})}catch{}sn.delete(e)},sn=new WeakMap,A_=2,I_=1;import{aborted as R_}from"node:util";var od=(e,t)=>e===void 0?[]:[P_(e,t)],P_=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{
|
|
759
|
+
await R_(e,t),await r.remove(t);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw hi({error:s,fileDescriptors:n,
|
|
760
|
+
sourceOptions:o,startTime:i})};var an=(e,...t)=>{if(L(t[0]))return an.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=Qu(
|
|
761
|
+
e,...t),o=O_({...n,destination:r});return o.pipe=an.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},O_=async({
|
|
758
762
|
sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,
|
|
759
|
-
fileDescriptors:c,startTime:l})=>{let u=
|
|
760
|
-
fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let
|
|
761
|
-
[
|
|
762
|
-
allSettled([e,t]);import{setImmediate as
|
|
763
|
-
return
|
|
764
|
-
preserveNewlines:i})},
|
|
765
|
-
stripFinalNewline:o,allMixed:i})=>{let s=new AbortController
|
|
766
|
-
controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})}
|
|
767
|
-
await e}catch{r.destroy()}finally{t.abort()}},
|
|
768
|
-
preserveNewlines:s})=>{let a=
|
|
769
|
-
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},
|
|
770
|
-
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=
|
|
771
|
-
encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*
|
|
772
|
-
yield
|
|
773
|
-
Boolean);var
|
|
774
|
-
streamInfo:u})=>{let d=
|
|
775
|
-
all([
|
|
776
|
-
all([
|
|
763
|
+
fileDescriptors:c,startTime:l})=>{let u=C_(e,o);td({sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,
|
|
764
|
+
fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let p=nd(t,i,d);return await Promise.race(
|
|
765
|
+
[rd(u),...od(a,{sourceStream:t,mergedStream:p,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},C_=(e,t)=>Promise.
|
|
766
|
+
allSettled([e,t]);import{setImmediate as L_}from"node:timers/promises";import{on as x_}from"node:events";import{getDefaultHighWaterMark as k_}from"node:stream";var cn=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{let s=new AbortController;
|
|
767
|
+
return N_(t,s),sd({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,
|
|
768
|
+
preserveNewlines:i})},N_=async(e,t)=>{try{await e}catch{}finally{t.abort()}},gi=({stream:e,onStreamEnd:t,lines:r,encoding:n,
|
|
769
|
+
stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;$_(t,s,e);let a=e.readableObjectMode&&!i;return sd({stream:e,
|
|
770
|
+
controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},$_=async(e,t,r)=>{try{
|
|
771
|
+
await e}catch{r.destroy()}finally{t.abort()}},sd=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,
|
|
772
|
+
preserveNewlines:s})=>{let a=x_(e,"data",{signal:t.signal,highWaterMark:id,highWatermark:id});return M_({onStdoutChunk:a,
|
|
773
|
+
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},bi=k_(!0),id=bi,M_=async function*({
|
|
774
|
+
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=D_({binary:r,shouldEncode:n,
|
|
775
|
+
encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*Me(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{
|
|
776
|
+
yield*$t(a)}},D_=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[Xr(e,r,!t),Jr(e,o,!n,{})].filter(
|
|
777
|
+
Boolean);var ad=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,
|
|
778
|
+
streamInfo:u})=>{let d=B_({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!o){await Promise.
|
|
779
|
+
all([U_(e),d]);return}let p=Yo(c,r),f=gi({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:p,allMixed:a}),[m]=await Promise.
|
|
780
|
+
all([z_({stream:e,iterable:f,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),d]);return m},B_=async({stream:e,onStreamEnd:t,
|
|
777
781
|
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!en({stdioItems:s[r]?.stdioItems,encoding:n,
|
|
778
|
-
verboseInfo:i,fdNumber:r}))return;let a=
|
|
779
|
-
await
|
|
782
|
+
verboseInfo:i,fdNumber:r}))return;let a=gi({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});
|
|
783
|
+
await wu(a,e,r,i)},U_=async e=>{await L_(),e.readableFlowing===null&&e.resume()},z_=async({stream:e,stream:{readableObjectMode:t},
|
|
780
784
|
iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await zr(r,{maxBuffer:i}):o==="buffer"?new Uint8Array(
|
|
781
|
-
await Gr(r,{maxBuffer:i})):await
|
|
782
|
-
encoding:o,fdNumber:n}))}},
|
|
783
|
-
e):e;import{finished as
|
|
784
|
-
r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],
|
|
785
|
-
stdinCleanedUp||
|
|
786
|
-
t&&
|
|
787
|
-
(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},
|
|
788
|
-
ln(e):(r.propagating=!0,
|
|
789
|
-
code==="ERR_STREAM_PREMATURE_CLOSE",
|
|
790
|
-
map((c,l)=>
|
|
791
|
-
streamInfo:a})),
|
|
792
|
-
streamInfo:l})=>{if(!e)return;let u=
|
|
793
|
-
fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var
|
|
794
|
-
lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>
|
|
795
|
-
o[2],allMixed:
|
|
796
|
-
return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}},
|
|
797
|
-
t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as
|
|
798
|
-
pc"),c=
|
|
799
|
-
a&&(
|
|
800
|
-
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:
|
|
801
|
-
onInternalError:
|
|
802
|
-
|
|
803
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:
|
|
804
|
-
maxBuffer:n,ipc:u,ipcOutput:
|
|
805
|
-
Promise.all(
|
|
806
|
-
controller:
|
|
807
|
-
return
|
|
808
|
-
x),Promise.allSettled(
|
|
809
|
-
filter(({value:o,stream:i=o})=>ie(i,{checkOpen:!1})&&!re(i)).map(({type:o,value:i,stream:s=i})=>
|
|
810
|
-
has(o),stopOnExit:o==="native"}))),
|
|
811
|
-
n.has(t)||n.set(t,[]);let o=n.get(t),i=
|
|
812
|
-
promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as
|
|
813
|
-
await
|
|
814
|
-
if(await e,t)throw t},dn=(e,t,r)=>{r&&!ln(r)?e.destroy(r):t&&e.destroy()};var
|
|
815
|
-
{subprocessStdout:a,waitReadableDestroy:c}=
|
|
816
|
-
a,s),{read:
|
|
817
|
-
read:
|
|
818
|
-
encoding:l});return
|
|
819
|
-
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},
|
|
820
|
-
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:
|
|
821
|
-
|
|
822
|
-
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){
|
|
823
|
-
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},
|
|
824
|
-
readable:r,subprocess:n,subprocessStdin:o})=>{try{await
|
|
825
|
-
await
|
|
826
|
-
t,n))},
|
|
827
|
-
e,r,t),s=new
|
|
828
|
-
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return
|
|
829
|
-
r,n,"writableFinal"),i=
|
|
830
|
-
write:
|
|
831
|
-
await
|
|
832
|
-
|
|
833
|
-
n,t)&&(
|
|
834
|
-
r),{subprocessStdout:c,waitReadableDestroy:l}=
|
|
835
|
-
e,o,t),{readableEncoding:
|
|
836
|
-
subprocess:e,binary:a,encoding:r,preserveNewlines:s}),g=new
|
|
837
|
-
subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:
|
|
838
|
-
writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:
|
|
839
|
-
return
|
|
785
|
+
await Gr(r,{maxBuffer:i})):await Fr(r,{maxBuffer:i})}catch(a){return cd(wl({error:a,stream:e,readableObjectMode:t,lines:s,
|
|
786
|
+
encoding:o,fdNumber:n}))}},wi=async e=>{try{return await e}catch(t){return cd(t)}},cd=({bufferedData:e})=>$s(e)?new Uint8Array(
|
|
787
|
+
e):e;import{finished as G_}from"node:stream/promises";var Bt=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let i=H_(e,
|
|
788
|
+
r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],G_(e,{cleanup:!0,signal:s.signal})])}catch(a){i.
|
|
789
|
+
stdinCleanedUp||V_(a,t,r,n)}finally{s.abort()}},H_=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===
|
|
790
|
+
t&&F_(e,r,n),n},F_=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{j_(t,r),n.call(e,...o)}},j_=({exitCode:e,signalCode:t},r)=>{
|
|
791
|
+
(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},V_=(e,t,r,n)=>{if(!W_(e,t,r,n))throw e},W_=(e,t,r,n=!0)=>r.propagating?ld(e)||
|
|
792
|
+
ln(e):(r.propagating=!0,yi(r,t)===n?ld(e):ln(e)),yi=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",ln=e=>e?.
|
|
793
|
+
code==="ERR_STREAM_PREMATURE_CLOSE",ld=e=>e?.code==="EPIPE";var ud=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>e.stdio.
|
|
794
|
+
map((c,l)=>_i({stream:c,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,stripFinalNewline:i,verboseInfo:s,
|
|
795
|
+
streamInfo:a})),_i=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,
|
|
796
|
+
streamInfo:l})=>{if(!e)return;let u=Bt(e,t,l);if(yi(l,t)){await u;return}let[d]=await Promise.all([ad({stream:e,onStreamEnd:u,
|
|
797
|
+
fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var dd=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?De([e,t].filter(Boolean)):void 0,pd=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,
|
|
798
|
+
lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>_i({...q_(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||
|
|
799
|
+
o[2],allMixed:Y_(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),q_=({stdout:e,stderr:t,all:r},[,n,o])=>{let i=n||o;
|
|
800
|
+
return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}},Y_=({all:e,stdout:t,stderr:r})=>e&&
|
|
801
|
+
t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as K_}from"node:events";var fd=e=>Ve(e,"ipc"),md=(e,t)=>{let r=pr(e);le({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var hd=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{if(!n)return o;let s=fd(i),a=we(t,"i\
|
|
802
|
+
pc"),c=we(r,"ipc");for await(let l of ni({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))
|
|
803
|
+
a&&(yl(e,o,c),o.push(l)),s&&md(l,i);return o},gd=async(e,t)=>(await Promise.allSettled([e]),t);var bd=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,
|
|
804
|
+
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:p,verboseInfo:f,fileDescriptors:m,originalStreams:h,
|
|
805
|
+
onInternalError:y,controller:w})=>{let g=vu(e,p),v={originalStreams:h,fileDescriptors:m,subprocess:e,exitPromise:g,propagating:!1},
|
|
806
|
+
_=ud({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:f,streamInfo:v}),A=pd({subprocess:e,
|
|
807
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:f,streamInfo:v}),I=[],S=hd({subprocess:e,buffer:r,
|
|
808
|
+
maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:f}),x=J_(h,e,v),N=X_(m,v);try{return await Promise.race([Promise.all([{},Au(g),
|
|
809
|
+
Promise.all(_),A,S,Xc(e,d),...x,...N]),y,Z_(e,w),...Wc(e,i,p,w),...fc({subprocess:e,cancelSignal:s,gracefulCancel:a,context:p,
|
|
810
|
+
controller:w}),...jc({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:p,controller:w})])}catch($){
|
|
811
|
+
return p.terminationReason??="other",Promise.all([{error:$},g,Promise.all(_.map(M=>wi(M))),wi(A),gd(S,I),Promise.allSettled(
|
|
812
|
+
x),Promise.allSettled(N)])}},J_=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:Bt(n,o,r)),X_=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.
|
|
813
|
+
filter(({value:o,stream:i=o})=>ie(i,{checkOpen:!1})&&!re(i)).map(({type:o,value:i,stream:s=i})=>Bt(s,n,t,{isSameDirection:Q.
|
|
814
|
+
has(o),stopOnExit:o==="native"}))),Z_=async(e,{signal:t})=>{let[r]=await K_(e,"error",{signal:t});throw r};var wd=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Ut=(e,t,r)=>{let n=e[r];
|
|
815
|
+
n.has(t)||n.set(t,[]);let o=n.get(t),i=ue();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},nt=async({resolve:e,
|
|
816
|
+
promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as Q_}from"node:stream";import{callbackify as eS}from"node:util";import{finished as yd}from"node:stream/promises";var Si=async e=>{if(e!==void 0)try{await Ei(e)}catch{}},_d=async e=>{if(e!==void 0)try{await vi(e)}catch{}},Ei=async e=>{
|
|
817
|
+
await yd(e,{cleanup:!0,readable:!1,writable:!0})},vi=async e=>{await yd(e,{cleanup:!0,readable:!0,writable:!1})},un=async(e,t)=>{
|
|
818
|
+
if(await e,t)throw t},dn=(e,t,r)=>{r&&!ln(r)?e.destroy(r):t&&e.destroy()};var Sd=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{let s=o||W.has(r),
|
|
819
|
+
{subprocessStdout:a,waitReadableDestroy:c}=Ti(e,n,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=Ai(
|
|
820
|
+
a,s),{read:p,onStdoutDataDone:f}=Ii({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),m=new Q_({
|
|
821
|
+
read:p,destroy:eS(Pi.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,
|
|
822
|
+
encoding:l});return Ri({subprocessStdout:a,onStdoutDataDone:f,readable:m,subprocess:e}),m},Ti=(e,t,r)=>{let n=Je(e,t),o=Ut(
|
|
823
|
+
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},Ai=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?
|
|
824
|
+
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:bi},
|
|
825
|
+
Ii=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=ue(),s=cn({subprocessStdout:e,subprocess:t,
|
|
826
|
+
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){tS(this,s,i)},onStdoutDataDone:i}},tS=async(e,t,r)=>{
|
|
827
|
+
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},Ri=async({subprocessStdout:e,onStdoutDataDone:t,
|
|
828
|
+
readable:r,subprocess:n,subprocessStdin:o})=>{try{await vi(e),await n,await Si(o),await t,r.readable&&r.push(null)}catch(i){
|
|
829
|
+
await Si(o),Ed(r,i)}},Pi=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await nt(r,t)&&(Ed(e,n),await un(
|
|
830
|
+
t,n))},Ed=(e,t)=>{dn(e,e.readable,t)};import{Writable as rS}from"node:stream";import{callbackify as vd}from"node:util";var Td=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=Oi(
|
|
831
|
+
e,r,t),s=new rS({...Ci(n,e,o),destroy:vd(ki.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),
|
|
832
|
+
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return xi(n,s),s},Oi=(e,t,r)=>{let n=Tr(e,t),o=Ut(
|
|
833
|
+
r,n,"writableFinal"),i=Ut(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},Ci=(e,t,r)=>({
|
|
834
|
+
write:nS.bind(void 0,e),final:vd(oS.bind(void 0,e,t,r))}),nS=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},oS=async(e,t,r)=>{
|
|
835
|
+
await nt(r,t)&&(e.writable&&e.end(),await t)},xi=async(e,t,r)=>{try{await Ei(e),t.writable&&t.end()}catch(n){await _d(r),
|
|
836
|
+
Ad(t,n)}},ki=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await nt(r,t),await nt(
|
|
837
|
+
n,t)&&(Ad(e,o),await un(t,o))},Ad=(e,t)=>{dn(e,e.writable,t)};import{Duplex as iS}from"node:stream";import{callbackify as sS}from"node:util";var Id=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||W.has(
|
|
838
|
+
r),{subprocessStdout:c,waitReadableDestroy:l}=Ti(e,n,t),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:p}=Oi(
|
|
839
|
+
e,o,t),{readableEncoding:f,readableObjectMode:m,readableHighWaterMark:h}=Ai(c,a),{read:y,onStdoutDataDone:w}=Ii({subprocessStdout:c,
|
|
840
|
+
subprocess:e,binary:a,encoding:r,preserveNewlines:s}),g=new iS({read:y,...Ci(u,e,d),destroy:sS(aS.bind(void 0,{subprocessStdout:c,
|
|
841
|
+
subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:h,
|
|
842
|
+
writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:f});
|
|
843
|
+
return Ri({subprocessStdout:c,onStdoutDataDone:w,readable:g,subprocess:e,subprocessStdin:u}),xi(u,g,c),g},aS=async({subprocessStdout:e,
|
|
840
844
|
subprocessStdin:t,subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([
|
|
841
|
-
|
|
842
|
-
s)])};var
|
|
843
|
-
binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return
|
|
844
|
-
t.readable&&t.destroy(),await r}};var
|
|
845
|
-
|
|
846
|
-
e.iterable=
|
|
847
|
-
constructor.prototype,
|
|
848
|
-
e,t,r),{subprocess:
|
|
849
|
-
fileDescriptors:d});return
|
|
850
|
-
|
|
851
|
-
commandArguments:c,options:l}=Mr(e,t,r),u=
|
|
852
|
-
verboseInfo:s,options:u,fileDescriptors:d}},
|
|
853
|
-
nal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},
|
|
854
|
-
options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=
|
|
855
|
-
return
|
|
856
|
-
|
|
857
|
-
kill.bind(c),options:r,onInternalError:
|
|
858
|
-
startTime:n,verboseInfo:o,fileDescriptors:a,originalStreams:u,command:i,escapedCommand:s,context:d,onInternalError:
|
|
859
|
-
return{subprocess:c,promise:
|
|
860
|
-
command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f
|
|
861
|
-
context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let
|
|
862
|
-
map((
|
|
863
|
-
command:s,escapedCommand:a,startTime:r});return
|
|
864
|
-
context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in e?
|
|
845
|
+
Pi({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},s),ki({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},
|
|
846
|
+
s)])};var Ni=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||W.has(t),s=Je(e,r),a=cn({subprocessStdout:s,subprocess:e,
|
|
847
|
+
binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return cS(a,s,e)},cS=async function*(e,t,r){try{yield*e}finally{
|
|
848
|
+
t.readable&&t.destroy(),await r}};var Rd=(e,{encoding:t})=>{let r=wd();e.readable=Sd.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=
|
|
849
|
+
Td.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=Id.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),
|
|
850
|
+
e.iterable=Ni.bind(void 0,e,t),e[Symbol.asyncIterator]=Ni.bind(void 0,e,t,{})};var Pd=(e,t)=>{for(let[r,n]of uS){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},lS=(async()=>{})().
|
|
851
|
+
constructor.prototype,uS=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(lS,e)]);var Od=(e,t,r,n)=>{let{file:o,commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=fS(
|
|
852
|
+
e,t,r),{subprocess:p,promise:f}=hS({file:o,commandArguments:i,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,
|
|
853
|
+
fileDescriptors:d});return p.pipe=an.bind(void 0,{source:p,sourcePromise:f,boundOptions:{},createNested:n}),Pd(p,f),de.set(
|
|
854
|
+
p,{options:u,fileDescriptors:d}),p},fS=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=mr(e,t,r),{file:a,
|
|
855
|
+
commandArguments:c,options:l}=Mr(e,t,r),u=mS(l),d=zu(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,
|
|
856
|
+
verboseInfo:s,options:u,fileDescriptors:d}},mS=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "sig\
|
|
857
|
+
nal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},hS=({file:e,commandArguments:t,
|
|
858
|
+
options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=pS(...Dr(e,t,r))}catch(m){
|
|
859
|
+
return Du({error:m,command:i,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let l=new AbortController;
|
|
860
|
+
dS(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Ku(c,a,l),Xu(c,r,l);let d={},p=ue();c.kill=dc.bind(void 0,{kill:c.
|
|
861
|
+
kill.bind(c),options:r,onInternalError:p,context:d,controller:l}),c.all=dd(c,r),Rd(c,r),Nu(c,r);let f=gS({subprocess:c,options:r,
|
|
862
|
+
startTime:n,verboseInfo:o,fileDescriptors:a,originalStreams:u,command:i,escapedCommand:s,context:d,onInternalError:p,controller:l});
|
|
863
|
+
return{subprocess:c,promise:f}},gS=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,
|
|
864
|
+
command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[p,f],m,h,y]=await bd({subprocess:e,options:t,
|
|
865
|
+
context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let w=m.
|
|
866
|
+
map((_,A)=>_e(_,t,A)),g=_e(h,t,"all"),v=bS({errorInfo:d,exitCode:p,signal:f,stdio:w,all:g,ipcOutput:y,context:c,options:t,
|
|
867
|
+
command:s,escapedCommand:a,startTime:r});return et(v,n,t)},bS=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,
|
|
868
|
+
context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in e?Nt({error:e.error,command:c,escapedCommand:l,timedOut:s.
|
|
865
869
|
terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.
|
|
866
|
-
terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof
|
|
870
|
+
terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof pe,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,
|
|
867
871
|
signal:r,stdio:n,all:o,ipcOutput:i,options:a,startTime:u,isSync:!1}):Vr({command:c,escapedCommand:l,stdio:n,all:o,ipcOutput:i,
|
|
868
|
-
options:a,startTime:u});var
|
|
869
|
-
has(e)&&L(t)&&L(r)?{...t,...r}:r,
|
|
870
|
-
createNested:o},...s);return n!==void 0&&n(i,o,t),i},
|
|
871
|
-
createNested:o},i,...s)=>{if(L(i))return o(e,
|
|
872
|
-
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?
|
|
873
|
-
nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=
|
|
874
|
-
commandArguments:d=a,options:
|
|
875
|
-
options:
|
|
876
|
-
length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=
|
|
877
|
-
e);return{file:r,commandArguments:n}},
|
|
878
|
-
e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(
|
|
879
|
-
1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},
|
|
880
|
-
...
|
|
881
|
-
getEachMessage:
|
|
882
|
-
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:d=null,retryable:
|
|
883
|
-
let
|
|
884
|
-
`)).trim();return{code:C(e),error:C(t),exitCode:
|
|
872
|
+
options:a,startTime:u});var pn=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([n,o])=>[n,wS(n,e[n],o)]));return{...e,...r}},wS=(e,t,r)=>yS.
|
|
873
|
+
has(e)&&L(t)&&L(r)?{...t,...r}:r,yS=new Set(["env",...co]);var Ie=(e,t,r,n)=>{let o=(s,a,c)=>Ie(s,a,r,c),i=(...s)=>_S({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,
|
|
874
|
+
createNested:o},...s);return n!==void 0&&n(i,o,t),i},_S=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,
|
|
875
|
+
createNested:o},i,...s)=>{if(L(i))return o(e,pn(r,i),n);let{file:a,commandArguments:c,options:l,isSync:u}=SS({mapArguments:e,
|
|
876
|
+
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?Ru(a,c,l):Od(a,c,l,o)},SS=({mapArguments:e,firstArgument:t,
|
|
877
|
+
nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=zs(t)?Gs(t,r):[t,...r],[s,a,c]=nr(...i),l=pn(pn(n,o),c),{file:u=s,
|
|
878
|
+
commandArguments:d=a,options:p=l,isSync:f=!1}=e({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,
|
|
879
|
+
options:p,isSync:f}};var Cd=({file:e,commandArguments:t})=>kd(e,t),xd=({file:e,commandArguments:t})=>({...kd(e,t),isSync:!0}),kd=(e,t)=>{if(t.
|
|
880
|
+
length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=ES(
|
|
881
|
+
e);return{file:r,commandArguments:n}},ES=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(
|
|
882
|
+
e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(vS)){let o=r.at(-1);o&&o.endsWith("\\")?r[r.length-
|
|
883
|
+
1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},vS=/ +/g;var Nd=(e,t,r)=>{e.sync=t(TS,r),e.s=e.sync},$d=({options:e})=>Md(e),TS=({options:e})=>({...Md(e),isSync:!0}),Md=e=>({options:{
|
|
884
|
+
...AS(e),...e}}),AS=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Dd={preferLocal:!0};var Ld=Ie(()=>({})),rD=Ie(()=>({isSync:!0})),nD=Ie(Cd),oD=Ie(xd),iD=Ie(Yc),sD=Ie($d,{},Dd,Nd),{sendMessage:aD,getOneMessage:cD,
|
|
885
|
+
getEachMessage:lD,getCancelSignal:uD}=$u();function IS(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function zt({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
886
|
+
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:d=null,retryable:p=null}={}){
|
|
887
|
+
let f=IS(r),m=String(l||""),h=String(c||""),y=String(o||[m,h].filter(Boolean).join(`
|
|
888
|
+
`)).trim();return{code:C(e),error:C(t),exitCode:f,ok:n===null?f===0:n===!0,output:y,pid:Number.isSafeInteger(Number(s))?
|
|
885
889
|
Number(s):null,signal:C(a),stderr:h,stdout:m,...i==="base64"?{outputEncoding:i}:{},timedOut:u===!0,...d&&typeof d=="obje\
|
|
886
|
-
ct"&&!Array.isArray(d)?{execution:d}:{},...typeof
|
|
887
|
-
d",r={}){let n=C(e)||"Vibe64 command failed.";return
|
|
888
|
-
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}import{spawn as
|
|
889
|
-
async function
|
|
890
|
-
error",i=>o(r,i))})}async function
|
|
891
|
-
n.fd,n.fd]:["ignore","ignore","ignore"],i=
|
|
892
|
-
execution?.id||"";return s&&(
|
|
893
|
-
i.pid),scopeEmpty:!0})})),i.unref?.(),
|
|
890
|
+
ct"&&!Array.isArray(d)?{execution:d}:{},...typeof p=="boolean"?{retryable:p}:{}}}function z(e="",t="vibe64_command_faile\
|
|
891
|
+
d",r={}){let n=C(e)||"Vibe64 command failed.";return zt({...r,code:t,error:n,exitCode:1,ok:!1,output:C(r.output)||n,stderr:r.
|
|
892
|
+
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}import{spawn as RS}from"node:child_process";import{mkdir as PS,open as OS}from"node:fs/promises";import CS from"node:path";var fn=new Map,xS=3e3,kS=1e3;async function NS(e=""){return e?(await PS(CS.dirname(e),{recursive:!0}),OS(e,"w",384)):null}
|
|
893
|
+
async function $S(e){return new Promise((t,r)=>{let n=!1,o=(i,s)=>{n||(n=!0,i(s))};e.once?.("spawn",()=>o(t)),e.once?.("\
|
|
894
|
+
error",i=>o(r,i))})}async function zd(e={},{cwd:t="",env:r={}}={}){let n=null;try{n=await NS(e.logPath);let o=n?["ignore",
|
|
895
|
+
n.fd,n.fd]:["ignore","ignore","ignore"],i=RS(e.command,e.args,{cwd:t||void 0,detached:!0,env:r,stdio:o});await $S(i);let s=e.
|
|
896
|
+
execution?.id||"";return s&&(fn.set(s,{child:i,pid:Number(i.pid)}),i.once?.("exit",()=>{mn(i.pid)||fn.set(s,{child:i,pid:Number(
|
|
897
|
+
i.pid),scopeEmpty:!0})})),i.unref?.(),zt({execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:i.
|
|
894
898
|
pid})}catch(o){return z(o?.message||"Detached command failed to start.",o?.code||"vibe64_command_detached_failed",{execution:e.
|
|
895
899
|
execution})}finally{await n?.close?.().catch(()=>null)}}function mn(e=null){let t=Number(e);if(!Number.isSafeInteger(t)||
|
|
896
|
-
t<=0)return!1;if(process.platform==="win32"){let r=[...
|
|
897
|
-
r?.child?.signalCode===null}try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function
|
|
898
|
-
GTERM"){if(!mn(e))return!1;try{return process.platform==="win32"?[...
|
|
899
|
-
t):process.kill(-Number(e),t),!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function
|
|
900
|
+
t<=0)return!1;if(process.platform==="win32"){let r=[...fn.values()].find(n=>n.pid===t);return r?.child?.exitCode===null&&
|
|
901
|
+
r?.child?.signalCode===null}try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function Bd(e=null,t="SI\
|
|
902
|
+
GTERM"){if(!mn(e))return!1;try{return process.platform==="win32"?[...fn.values()].find(n=>n.pid===Number(e))?.child?.kill?.(
|
|
903
|
+
t):process.kill(-Number(e),t),!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function Ud(e=null,t=0){let r=Date.
|
|
900
904
|
now()+Math.max(0,Number(t)||0);for(;mn(e)&&Date.now()<r;)await new Promise(n=>setTimeout(n,25));return!mn(e)}async function hn(e=null,{
|
|
901
|
-
killTimeoutMs:t=
|
|
902
|
-
n}var
|
|
903
|
-
utf8",signal:l=null,timeout:u=15e3}={}){let d,f,
|
|
904
|
-
return z("Command cancelled.","vibe64_command_cancelled",{execution:o});try{let g=
|
|
905
|
+
killTimeoutMs:t=kS,termTimeoutMs:r=xS}={}){Bd(e,"SIGTERM");let n=await Ud(e,r);return n||(Bd(e,"SIGKILL"),n=await Ud(e,t)),
|
|
906
|
+
n}var Gd=new Map;async function Be(e="",t=[],{cwd:r="",env:n={},execution:o=null,input:i=void 0,maxBuffer:s=void 0,onOutput:a=null,outputEncoding:c="\
|
|
907
|
+
utf8",signal:l=null,timeout:u=15e3}={}){let d,p,f,m=Promise.withResolvers(),h=()=>{f||=p(),f.then(m.resolve)};if(l?.aborted)
|
|
908
|
+
return z("Command cancelled.","vibe64_command_cancelled",{execution:o});try{let g=Ld(e,t,{all:!0,cwd:r,detached:process.
|
|
905
909
|
platform!=="win32",encoding:c,env:n,extendEnv:!1,input:i,maxBuffer:s,reject:!1,stdin:i==null?"ignore":"pipe",stripFinalNewline:!1,
|
|
906
|
-
timeout:u}),
|
|
907
|
-
g.then(()=>!0,()=>!0)),
|
|
910
|
+
timeout:u}),v=Number(g.pid),_;p=()=>{if(!_){let S;process.platform!=="win32"?S=hn(v).catch(()=>!1):(g.kill("SIGKILL"),S=
|
|
911
|
+
g.then(()=>!0,()=>!0)),_=S.then(x=>(x||(_=null),x))}return _},o?.id&&Gd.set(o.id,p),l?.addEventListener("abort",h,{once:!0}),
|
|
908
912
|
l?.aborted&&h(),typeof a=="function"&&g.all&&g.all.on("data",S=>{try{a(String(S||""))}catch{}});let A=await Promise.race(
|
|
909
|
-
[g,m.promise.then(S=>S?g:{exitCode:1})]),
|
|
910
|
-
ommand_capture_timed_out":A.code?"vibe64_command_capture_failed":"",error:
|
|
911
|
-
(
|
|
913
|
+
[g,m.promise.then(S=>S?g:{exitCode:1})]),I=typeof A.exitCode=="number"?A.exitCode:1;d=zt({code:A.timedOut===!0?"vibe64_c\
|
|
914
|
+
ommand_capture_timed_out":A.code?"vibe64_command_capture_failed":"",error:I===0?"":A.shortMessage,exitCode:I,output:A.all||
|
|
915
|
+
(I===0?"":A.shortMessage),outputEncoding:c,signal:A.signal,stderr:A.stderr,stdout:A.stdout,timedOut:A.timedOut===!0,execution:o})}catch(g){
|
|
912
916
|
d=z(g.message,"vibe64_command_capture_failed",{execution:o,exitCode:typeof g.exitCode=="number"?g.exitCode:1,output:g.all,
|
|
913
917
|
outputEncoding:c,signal:g.signal,stderr:g.stderr,stdout:g.stdout,timedOut:g.timedOut===!0})}finally{l?.removeEventListener(
|
|
914
|
-
"abort",h)}if(!await(p
|
|
915
|
-
4_execution_drain_failed",{execution:o,output:d?.output,outputEncoding:c,stderr:d?.stderr,stdout:d?.stdout});o?.id&&
|
|
916
|
-
o.id);let
|
|
917
|
-
outputEncoding:c}):
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
918
|
+
"abort",h)}if(!await(f||p?.()||!0))return z("The command finished, but its execution scope did not become empty.","vibe6\
|
|
919
|
+
4_execution_drain_failed",{execution:o,output:d?.output,outputEncoding:c,stderr:d?.stderr,stdout:d?.stdout});o?.id&&Gd.delete(
|
|
920
|
+
o.id);let w=o&&{...o,state:"finished"};return l?.aborted?z("Command cancelled.","vibe64_command_cancelled",{...d,execution:w,
|
|
921
|
+
outputEncoding:c}):w?{...d,execution:w}:d}import MS from"node:path";import Hd from"node:process";import{isMainThread as DS}from"node:worker_threads";var $i=Symbol.
|
|
922
|
+
for("vibe64.hostProfile"),Gt=Symbol.for("vibe64.hostProfile.previousUmask"),LS=["runtimePackRoot","sharedCacheRoot","exe\
|
|
923
|
+
cHelperPath"],gn=Object.freeze({runtimePackRoot:"",sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1});function Fd(e){
|
|
924
|
+
DS&&(e&&!(Gt in globalThis)?globalThis[Gt]=Hd.umask(7):!e&&Gt in globalThis&&(Hd.umask(globalThis[Gt]),delete globalThis[Gt]))}
|
|
925
|
+
function Mi(e=null){if(e===null)return delete globalThis[$i],Fd(!1),gn;let t=Object.keys(e).filter(o=>!(o in gn));if(t.length)
|
|
926
|
+
throw new TypeError(`Unknown host profile setting: ${t.join(", ")}.`);let r={...gn,...e};for(let o of LS)if(typeof r[o]!=
|
|
927
|
+
"string"||r[o]&&!MS.isAbsolute(r[o]))throw new TypeError(`Host profile ${o} must be an absolute path or empty.`);if(typeof r.
|
|
928
|
+
sharedGroupAccess!="boolean")throw new TypeError("Host profile sharedGroupAccess must be true or false.");let n=Object.freeze(
|
|
929
|
+
r);return globalThis[$i]=n,Fd(n.sharedGroupAccess),n}function Re(){return globalThis[$i]||gn}var jd="vibe64.exec-helper.payload",Vd=1;function Di(e=""){let t=String(e||"").trim()||Re().execHelperPath;if(!t){let r=new Error(
|
|
930
|
+
"This computer has no helper for running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}
|
|
931
|
+
function Wd(e={}){return{...e,schema:jd,schemaVersion:Vd}}function Ht({actor:e={},command:t="",cwd:r="",env:n={},input:o=void 0,
|
|
932
|
+
operation:i="vibe64-command",args:s=[]}={}){return Wd({args:Array.isArray(s)?s.map(a=>String(a)):[],command:t,cwd:r,env:n,
|
|
933
|
+
gid:e.user?.gid,home:e.user?.home,inputBase64:o==null?"":Buffer.isBuffer(o)?o.toString("base64"):Buffer.from(String(o)).
|
|
934
|
+
toString("base64"),operation:i,uid:e.user?.uid,username:e.user?.username})}function Ft(e={}){return e.mode==="pty"&&e.envPolicy===
|
|
935
|
+
"auth"&&!["assistant","codex"].includes(e.purpose)?"account-auth-terminal":e.purpose==="codex"&&e.mode==="capture"&&e.envPolicy===
|
|
923
936
|
"auth"||e.purpose==="codex"&&e.mode==="detached"&&e.execution?.kind==="assistant"&&e.execution?.lifecycle==="service"?"c\
|
|
924
937
|
odex-app-server":e.mode==="detached"&&e.execution?.kind==="assistant"&&e.execution?.lifecycle==="service"&&["opencode-ca\
|
|
925
938
|
talog","opencode-server"].includes(e.execution?.operationId)||e.mode==="capture"&&e.execution?.kind==="assistant"&&e.execution?.
|
|
926
939
|
operationId==="opencode-catalog"?"opencode-app-server":e.purpose==="account"?"account-status":e.purpose==="github"?"gith\
|
|
927
940
|
ub-workflow-command":e.purpose==="github-api"?"github-api-command":e.purpose==="workspace-cache"?"workspace-cache-comman\
|
|
928
|
-
d":e.purpose==="health"?"health-status":"vibe64-command"}async function
|
|
929
|
-
outputEncoding:o="utf8",runCapture:i=
|
|
941
|
+
d":e.purpose==="health"?"health-status":"vibe64-command"}async function Li(e={},{env:t=process.env,helperPath:r="",maxBuffer:n=void 0,
|
|
942
|
+
outputEncoding:o="utf8",runCapture:i=Be,signal:s=null,timeout:a=15e3}={}){let c={env:t,input:`${JSON.stringify(e)}
|
|
930
943
|
`,outputEncoding:o,signal:s,timeout:a};return Number.isSafeInteger(Number(n))&&Number(n)>0&&(c.maxBuffer=Number(n)),i("s\
|
|
931
|
-
udo",["-n",r
|
|
932
|
-
in",customScheme:"",appLinkDomains:Object.freeze([])}),
|
|
933
|
-
versionName:"1.0.0"});var
|
|
934
|
-
"metadata","migrations","runtime","vite"]);var
|
|
935
|
-
session?.metadata?.session_git_command_actor_user_key)}async function
|
|
936
|
-
t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:
|
|
944
|
+
udo",["-n",Di(r),"execute"],c)}import{createRequire as US}from"node:module";var BS=new URL("./../../../../@jskit-ai/kernel/server/support/symlinkSafeRequire.js",import.meta.url).href;var xD=US(BS);var ND=Object.freeze(["none","pending","committed","rolledBack","unknown"]);var $D=Object.freeze(["bundled","dev_server"]),MD=Object.freeze(["capacitor"]),DD=Object.freeze({callbackPath:"/auth/log\
|
|
945
|
+
in",customScheme:"",appLinkDomains:Object.freeze([])}),LD=Object.freeze({packageName:"",minSdk:26,targetSdk:35,versionCode:1,
|
|
946
|
+
versionName:"1.0.0"});var qD=new URL("./../../../../@jskit-ai/kernel/server/support/appConfigFiles.js",import.meta.url).href;var r0=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),n0=Object.freeze(["capabilities","kind",
|
|
947
|
+
"metadata","migrations","runtime","vite"]);var Bi="/api",m0=`${Bi}/`,h0=`${Bi}/docs`,g0=`${Bi}/realtime`;var R0=Object.freeze(["compact","medium","expanded"]);function XS(e={}){return ge(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
948
|
+
session?.metadata?.session_git_command_actor_user_key)}async function Jd(e={}){let t=C(e.actor)||"daemon";if(t==="daemon"||
|
|
949
|
+
t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:Xn()};let r=XS(e);if(!r){let n=new Error("A user key\
|
|
937
950
|
is required for real-user command execution.");throw n.code="vibe64_command_actor_user_required",n}return{actor:t,credentialScope:"\
|
|
938
|
-
user",requiresRealUser:!0,user:await
|
|
939
|
-
env){return!!(String(e?.VIBE64_WORKSPACE||"").trim()||String(e?.VIBE64_WORKSPACE_DAEMON_USER||"").trim())}function
|
|
940
|
-
env:t=process.env}={}){return e.requiresRealUser?
|
|
941
|
-
let n=O(t.session?.sourceRoot||t.session?.sourcePath),o=O(r);if(!n||!o)return;let i=
|
|
942
|
-
"..")||
|
|
943
|
-
stem identity.");throw s.code="vibe64_command_managed_source_real_user_forbidden",s}function
|
|
944
|
-
home),n=O(t.HOME),o=O(t.VIBE64_CREDENTIAL_HOME);if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&
|
|
951
|
+
user",requiresRealUser:!0,user:await Zn(r)}}import pE from"node:path";import wn from"node:path";function ot(e={}){let t=to();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.user?.gid}function yn(e=process.
|
|
952
|
+
env){return!!(String(e?.VIBE64_WORKSPACE||"").trim()||String(e?.VIBE64_WORKSPACE_DAEMON_USER||"").trim())}function _n(e={},{
|
|
953
|
+
env:t=process.env}={}){return e.requiresRealUser?yn(t)||!ot(e):!1}function Xd(e={},t={},r=""){if(!e.requiresRealUser)return;
|
|
954
|
+
let n=O(t.session?.sourceRoot||t.session?.sourcePath),o=O(r);if(!n||!o)return;let i=wn.relative(n,o);if(i&&(i.startsWith(
|
|
955
|
+
"..")||wn.isAbsolute(i)))return;let s=new Error("Managed session source commands must retain the workspace daemon filesy\
|
|
956
|
+
stem identity.");throw s.code="vibe64_command_managed_source_real_user_forbidden",s}function Zd(e={},t={}){let r=O(e.user?.
|
|
957
|
+
home),n=O(t.HOME),o=O(t.VIBE64_CREDENTIAL_HOME);if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&wn.resolve(r)!==wn.resolve(n)){
|
|
945
958
|
let i=new Error("Command HOME does not match the resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",
|
|
946
|
-
i}}var
|
|
959
|
+
i}}var it=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
947
960
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
948
|
-
R","VIBE64_MYSQL_USER"]);function
|
|
949
|
-
return t}var
|
|
950
|
-
64"){return C(e).toLowerCase().replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||t}function
|
|
951
|
-
let r=
|
|
961
|
+
R","VIBE64_MYSQL_USER"]);function Vt(...e){let t={};for(let r of e){let n=G(r);for(let o of it)n[o]!==void 0&&(t[o]=n[o])}
|
|
962
|
+
return t}var st="GIT_AUTHOR_NAME",at="GIT_AUTHOR_EMAIL",ct="GIT_COMMITTER_NAME",lt="GIT_COMMITTER_EMAIL";function Ui(e="",t="vibe\
|
|
963
|
+
64"){return C(e).toLowerCase().replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||t}function ZS(...e){for(let t of e){
|
|
964
|
+
let r=F(t),n=F(r.user),o=ge(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,n.name,n.userName,n.user_name),i=ge(
|
|
952
965
|
r.email,r.userEmail,r.user_email,r.gitUserEmail,r.git_user_email,n.email,n.userEmail,n.user_email);if(o&&i)return{authorEmail:i,
|
|
953
|
-
authorName:o,committerEmail:i,committerName:o,source:"configured"}}return null}function
|
|
954
|
-
t.displayName,t.login,t.username),n=
|
|
955
|
-
committerEmail:n,committerName:r,source:"github"}}function
|
|
956
|
-
local");return{authorEmail:`${r}@${n}.users.vibe64.invalid`,authorName:`${r} via Vibe64`,committerEmail:`vibe64@${n}
|
|
957
|
-
|
|
958
|
-
userKey:o=""}={}){let i=
|
|
959
|
-
email:t.VIBE64_GIT_USER_EMAIL})||
|
|
960
|
-
t.VIBE64_RUNTIME_NAMESPACE),userKey:
|
|
961
|
-
LOGNAME)})}function
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
"composer
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
"
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
"
|
|
975
|
-
"
|
|
976
|
-
|
|
977
|
-
"
|
|
978
|
-
|
|
979
|
-
"
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
/
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
"
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
n
|
|
1006
|
-
!n)return!1;let o=rf.relative(n,r);return!o||!o.startsWith("..")&&!rf.isAbsolute(o)}function nf({actor:e={},request:t={}}={}){
|
|
966
|
+
authorName:o,committerEmail:i,committerName:o,source:"configured"}}return null}function QS(e={}){let t=F(e),r=ge(t.name,
|
|
967
|
+
t.displayName,t.login,t.username),n=ge(t.email,t.publicEmail,t.verifiedEmail);return!r||!n?null:{authorEmail:n,authorName:r,
|
|
968
|
+
committerEmail:n,committerName:r,source:"github"}}function Qd({workspace:e="",userKey:t=""}={}){let r=Ui(t,"user"),n=Ui(
|
|
969
|
+
e,"local");return{authorEmail:`${r}@${n}.users.vibe64.invalid`,authorName:`${r} via Vibe64`,committerEmail:`vibe64@${n}.\
|
|
970
|
+
users.vibe64.invalid`,committerName:"Vibe64",source:"fallback"}}function ep({actor:e={},env:t=process.env,project:r={},session:n={},
|
|
971
|
+
userKey:o=""}={}){let i=F(n.metadata);return ZS(r.gitIdentity,r.config?.git,n.gitIdentity,i.git_identity,{name:t.VIBE64_GIT_USER_NAME,
|
|
972
|
+
email:t.VIBE64_GIT_USER_EMAIL})||QS(r.githubUser||n.githubUser||i.github_user)||Qd({workspace:ge(r.workspace,t.VIBE64_WORKSPACE,
|
|
973
|
+
t.VIBE64_RUNTIME_NAMESPACE),userKey:ge(o,e.user?.username,t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.
|
|
974
|
+
LOGNAME)})}function zi(e={}){let t=ep(e);return{[at]:t.authorEmail,[st]:t.authorName,[lt]:t.committerEmail,[ct]:t.committerName}}import{readFileSync as eE}from"node:fs";import rp from"node:path";import Gi from"node:path";var tp=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:["bubblewrap/bin"],
|
|
975
|
+
managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","package-lock.json"],
|
|
976
|
+
managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:["composer.json","composer.lock"],managedCommands:[
|
|
977
|
+
"composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-configuration.json","conanfi\
|
|
978
|
+
le.py","conan.lock"],managedCommands:["addr2line","ar","as","c++","c++filt","cc","clang","clang++","cmake","cpack","cpp",
|
|
979
|
+
"ctest","g++","gcc","gcore","gdb","gdb-add-index","gdbserver","gprof","gstack","ld","ld.bfd","ld.gold","ld.lld","ld64.ll\
|
|
980
|
+
d","lld","lld-link","lldb","lldb-dap","lldb-server","make","ninja","nm","objcopy","objdump","pkg-config","ranlib","reade\
|
|
981
|
+
lf","size","strings","strip","wasm-ld"]},python:{binDirs:["python/bin"],dependencyFiles:["pyproject.toml","requirements.\
|
|
982
|
+
txt","requirements.lock","uv.lock","poetry.lock","Pipfile","Pipfile.lock"],managedCommands:["python","python3","pip","pi\
|
|
983
|
+
p3","virtualenv"]},ruby:{binDirs:["ruby/bin"],dependencyFiles:["Gemfile","Gemfile.lock"],managedCommands:["ruby","gem","\
|
|
984
|
+
rake","irb","erb","ri","rdoc","bundle","bundler"]},go:{binDirs:["go/bin"],dependencyFiles:["go.mod","go.sum","go.work","\
|
|
985
|
+
go.work.sum"],managedCommands:["go","gofmt"]},java:{binDirs:["java/bin"],dependencyFiles:["pom.xml","build.gradle","buil\
|
|
986
|
+
d.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties"],managedCommands:["java","javac","jar","javap",
|
|
987
|
+
"javadoc","jshell","jlink","jmod","jdeps","jpackage","jcmd","jconsole","jdb","jfr","jhsdb","jinfo","jmap","jps","jrunscr\
|
|
988
|
+
ipt","jstack","jstat","jstatd","keytool","rmiregistry","serialver","mvn","mvnDebug","gradle"]},kotlin:{binDirs:["kotlin/\
|
|
989
|
+
bin"],dependencyFiles:["build.gradle.kts","settings.gradle.kts","gradle.properties"],managedCommands:["kotlin","kotlinc",
|
|
990
|
+
"kotlinc-jvm","kotlinc-js","kapt"]},csharp:{binDirs:["csharp/bin"],dependencyFiles:["global.json","Directory.Build.props",
|
|
991
|
+
"Directory.Packages.props","packages.lock.json","NuGet.Config"],managedCommands:["dotnet"]},rust:{binDirs:["rust/bin"],dependencyFiles:[
|
|
992
|
+
"Cargo.toml","Cargo.lock","rust-toolchain.toml",".cargo/config.toml"],managedCommands:["rustc","rustdoc","cargo","rustfm\
|
|
993
|
+
t","cargo-fmt","clippy-driver","cargo-clippy"]},gh:{binDirs:["gh/bin"],managedCommands:["gh"]},git:{binDirs:["git/bin"],
|
|
994
|
+
managedCommands:["git"]},mariadb:{binDirs:["mariadb/bin"],managedCommands:["mariadb","mysql"]},mysql:{binDirs:["mariadb/\
|
|
995
|
+
bin"],managedCommands:["mariadb","mysql"]},node26:{binDirs:["node26/bin"],dependencyFiles:["package.json","package-lock.\
|
|
996
|
+
json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock"],managedCommands:["node","npm","npx","corepack","pnpm","yarn"]},
|
|
997
|
+
"operator-clis":{binDirs:["managed-bin","operator-clis/bin"],identityPaths:["operator-clis/lib/node_modules/@anthropic-a\
|
|
998
|
+
i/claude-code/package.json","operator-clis/lib/node_modules/@openai/codex/package.json","operator-clis/lib/node_modules/\
|
|
999
|
+
opencode-ai/package.json"],managedCommands:["claude","codex","opencode"]},php:{binDirs:["php/bin"],managedCommands:["php"]},
|
|
1000
|
+
playwright:{binDirs:["playwright/bin"],identityPaths:["playwright/runtime.env","playwright/browsers"],managedCommands:["\
|
|
1001
|
+
playwright"]},postgresql:{binDirs:["postgresql/bin"],managedCommands:["initdb","pg_ctl","pg_isready","postgres","psql"]},
|
|
1002
|
+
ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:["sqlite3"]}}),Hi=Object.
|
|
1003
|
+
freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","bubblewrap","bun","php","\
|
|
1004
|
+
composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);function q({root:e=""}={}){
|
|
1005
|
+
return O(e||Re().runtimePackRoot)}function Fi(e=""){let t=q();return(t?tp[C(e)]?.binDirs||[]:[]).map(n=>Gi.join(t,n))}function ji(){
|
|
1006
|
+
let e=q();return e?[Gi.join(e,"guard-bin")]:[]}function Vi(){let e=q();return e?[Gi.join(e,"policy-bin")]:[]}var Sn="VIBE64_SHARED_CACHE_ROOT",Wt="PLAYWRIGHT_BROWSERS_PATH",En="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",vn="VIBE64_PLAYWRI\
|
|
1007
|
+
GHT_VERSION",np="playwright",tE="browsers",rE="runtime.env",nE=/^\d+\.\d+\.\d+$/u;function op({runtimePackRoot:e=""}={}){
|
|
1008
|
+
let t=q({root:e});if(!t)return"";let r=rp.join(t,np,rE),n;try{n=eE(r,"utf8")}catch(i){if(i?.code==="ENOENT")return"";throw i}
|
|
1009
|
+
let o=n.split(/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!nE.test(
|
|
1010
|
+
o[0]))throw new Error(`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function Wi({runtimePackRoot:e=""}={}){
|
|
1011
|
+
let t=q({root:e}),r=O(Re().sharedCacheRoot),n=op({runtimePackRoot:t});return{...r?{[Sn]:r}:{},...t?{[Wt]:rp.join(t,np,tE),
|
|
1012
|
+
[En]:"1"}:{},...n?{[vn]:n}:{}}}var qi=new Set(["HOME","LOGNAME","PATH","TMPDIR","USER","VIBE64_EXECUTION_ID","VIBE64_MANAGED_EXECUTION_REQUIRED","XDG_C\
|
|
1013
|
+
ACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"]),ip=new Set([...it,at,st,lt,ct,Wt,En,vn,Sn]);function ut(e={}){
|
|
1014
|
+
for(let t of Object.keys(G(e)))if(qi.has(t)||t.startsWith("XDG_")){let r=new Error(`Vibe64 command callers cannot provid\
|
|
1015
|
+
e execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function Tn(e={},{envPolicy:t="sess\
|
|
1016
|
+
ion"}={}){let r=G(e);ut(r);let n=Object.fromEntries(Object.entries(r).filter(([o])=>!ip.has(o)));return t==="deployment"?
|
|
1017
|
+
n:{...n,...Vt(r)}}import sp from"node:path";function oE(e=""){let t=O(e);return t==="/home"||t.startsWith("/home/")}function iE(e="",t=""){let r=O(e),n=O(t);if(!r||
|
|
1018
|
+
!n)return!1;let o=sp.relative(n,r);return!o||!o.startsWith("..")&&!sp.isAbsolute(o)}function ap({actor:e={},request:t={}}={}){
|
|
1007
1019
|
let r=t.credentialHome||{},n=O(r.home);if(!n)return{};let o=O(e.user?.home);if(e.requiresRealUser&&o&&n!==o){let a=new Error(
|
|
1008
1020
|
"Command credential home must match the resolved real-user actor home.");throw a.code="vibe64_command_credential_home_ac\
|
|
1009
|
-
tor_mismatch",a}if(!e.requiresRealUser&&
|
|
1021
|
+
tor_mismatch",a}if(!e.requiresRealUser&&oE(n)&&o&&!iE(n,o)){let a=new Error("A /home credential directory requires a mat\
|
|
1010
1022
|
ching real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=C(r.username||e.user?.
|
|
1011
|
-
username);return{...
|
|
1023
|
+
username);return{...Qn({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...O(r.cacheRoot)?{XDG_CACHE_HOME:O(r.cacheRoot)}:
|
|
1012
1024
|
{},...O(r.configRoot)?{XDG_CONFIG_HOME:O(r.configRoot)}:{},...O(r.dataRoot)?{XDG_DATA_HOME:O(r.dataRoot)}:{},...O(r.stateRoot)?
|
|
1013
|
-
{XDG_STATE_HOME:O(r.stateRoot)}:{}}}import
|
|
1014
|
-
steadOf",value:"ssh://git@github.com/"}]),
|
|
1015
|
-
/env gh auth git-credential"}]),
|
|
1016
|
-
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function
|
|
1017
|
-
r=[];for(let n of Array.isArray(e)?e:[e]){let o=C(n);if(!o||!
|
|
1018
|
-
add(i),r.push(i))}return r}function
|
|
1025
|
+
{XDG_STATE_HOME:O(r.stateRoot)}:{}}}import cp from"node:path";var lp=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"url.https://github.com/.in\
|
|
1026
|
+
steadOf",value:"ssh://git@github.com/"}]),sE=Object.freeze([{key:"credential.https://github.com.helper",value:"!/usr/bin\
|
|
1027
|
+
/env gh auth git-credential"}]),aE=Object.freeze([{key:"credential.https://github.com.helper",value:`!f() { case "$1" in\
|
|
1028
|
+
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function up(e=[]){let t=new Set,
|
|
1029
|
+
r=[];for(let n of Array.isArray(e)?e:[e]){let o=C(n);if(!o||!cp.isAbsolute(o))continue;let i=cp.resolve(o);t.has(i)||(t.
|
|
1030
|
+
add(i),r.push(i))}return r}function qt(e={},t=[]){let r={...e&&typeof e=="object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(
|
|
1019
1031
|
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);
|
|
1020
1032
|
s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),
|
|
1021
|
-
r}function
|
|
1022
|
-
e,
|
|
1023
|
-
return
|
|
1024
|
-
ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}return
|
|
1025
|
-
[
|
|
1026
|
-
-token"?r=
|
|
1027
|
-
[])}import
|
|
1028
|
-
let t=
|
|
1029
|
-
map(C).filter(Boolean)}function
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
"
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
...
|
|
1040
|
-
{actor:e,request:n}),...
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
default")
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
"function
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1033
|
+
r}function dp(e=[]){return up(e).map(t=>({key:"safe.directory",value:t}))}function Yi(e={},t=[]){return qt(e,dp(t))}function An(){return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"0",PAGER:"cat"}}function Ki(e={}){return qt(
|
|
1034
|
+
e,lp)}function pp(e={}){return qt(e,sE)}function cE(e={}){return qt(e,aE)}function Ji(e={}){return pp(Ki(e))}function fp(e={}){
|
|
1035
|
+
return cE(Ki(e))}var mp="VIBE64_GIT_AUTH_TOKEN";function lE(e={}){if(!e.gitAuthToken){let t=new Error("Token-backed GitHub transport requ\
|
|
1036
|
+
ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}return fp({...An(),GIT_TERMINAL_PROMPT:"0",
|
|
1037
|
+
[mp]:e.gitAuthToken})}function hp({request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github\
|
|
1038
|
+
-token"?r=lE(e):(e.gitTransport==="github-https"||e.purpose==="github")&&(r=Ji({...t,...An()})),Yi(r,e.gitSafeDirectories||
|
|
1039
|
+
[])}import gp from"node:path";var Xi="NPM_CONFIG_PREFIX";function Zi({env:e={}}={}){return q()?O(e?.[Xi])||(O(e?.HOME)?gp.join(O(e.HOME),".local"):""):
|
|
1040
|
+
""}function Qi(e={}){let t=Zi(e);return t?{[Xi]:t}:{}}function es(e={}){let t=Zi(e);return t?[gp.join(t,"bin")]:[]}import ts from"node:process";var uE="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";function In(e=""){return String(e||"").split(":").
|
|
1041
|
+
map(C).filter(Boolean)}function dE(){return q()?[]:[...In(ts.env.PATH),...ts.platform==="darwin"?["/opt/homebrew/bin"]:[]]}
|
|
1042
|
+
function bp({env:e=ts.env,existingPath:t="",runtimes:r=[],shimDirs:n=[]}={}){return Ce([...In(n.join(":")),...Vi(),...r.
|
|
1043
|
+
flatMap(o=>Fi(o)),...ji(),...In(t||e.PATH),...dE(),...In(uE)]).join(":")}var fE=new Set([...it,at,st,lt,ct,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG\
|
|
1044
|
+
_RUNTIME_DIR"]);function mE(e={}){return Object.fromEntries(Object.entries(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).
|
|
1045
|
+
map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!fE.has(t)&&!t.startsWith("GIT_")&&!t.startsWith("GH\
|
|
1046
|
+
_")&&!t.startsWith("XDG_")))}function rs(e={}){return e.envPolicy==="deployment"?[e.project?.deploymentEnv,e.project?.deployment?.
|
|
1047
|
+
env]:[e.project?.runtimeConfigEnv,e.project?.databaseEnv]}function hE(e={}){return rs(e).reduce((t,r)=>e.envPolicy==="de\
|
|
1048
|
+
ployment"?(ut(r),{...t,...G(r)}):{...t,...Tn(r,e)},{})}function gE(e={},t={}){return t.envPolicy==="deployment"?[]:t.envPolicy===
|
|
1049
|
+
"project"?rs(t):[e,...rs(t),t.project?.databaseEnv,t.session?.databaseEnv]}function dt({actor:e={},baseEnv:t=process.env,
|
|
1050
|
+
localPath:r="",request:n={}}={}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=Wi(),s=Tn(n.env,n),a=String(t.
|
|
1051
|
+
XDG_RUNTIME_DIR||"").trim(),c={...eo(e.user,mE(t)),...ot(e)&&pE.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...Vt(...gE(t,n)),...hE(
|
|
1052
|
+
n),...hp({actor:e,request:n}),...zi({actor:e,env:t,project:n.project,session:n.session,userKey:n.userKey}),...s,...ap({actor:e,
|
|
1053
|
+
request:n}),...i},l={...c,...Qi({env:c}),VIBE64_DECLARED_RUNTIMES:o};return{...l,PATH:bp({env:l,existingPath:[...es({env:l}),
|
|
1054
|
+
l.PATH,r].filter(Boolean).join(":"),runtimes:n.runtimes,shimDirs:n.shimDirs||[]})}}import{randomUUID as qE}from"node:crypto";import{mkdirSync as YE,writeFileSync as KE}from"node:fs";import cs from"node:path";import{Buffer as wE}from"node:buffer";import yE from"node:crypto";import{createRequire as _E}from"node:module";var bE=new URL("./../../../vibe64-execution/src/server/engines/terminalSessions.js",import.meta.url).href,wp=256*1024,SE=300,
|
|
1055
|
+
ns=100,os=28;var $B=600*1e3,EE=1440*60*1e3,MB=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "}),Pn=new Map,vE=_E(bE),TE=new Map;function AE(){return{code:"terminal_session_not_found",error:"Terminal session not found.",ok:!1}}function ss(e=""){return String(
|
|
1056
|
+
e||"default").trim()||"default"}function Cn(e){let t=ss(e);return Pn.has(t)||Pn.set(t,new Map),Pn.get(t)}function IE(e="\
|
|
1057
|
+
default"){return TE.get(ss(e))||null}function RE(e="default"){let t=IE(e);return t?{code:t.code,error:t.error,ok:!1}:null}function PE(e=""){let t=String(e||"");return[...Pn.keys()].filter(r=>r.startsWith(t))}function xn(e){let t=String(e||""),
|
|
1058
|
+
r=t.length;for(let n=0;n<SE&&(r=t.lastIndexOf(`
|
|
1059
|
+
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>wp&&(t=t.slice(t.length-wp)),t}function as(e={}){return e.status===
|
|
1060
|
+
"running"||e.status==="closing"}function _p(e={}){return as(e)||e.status==="exited"}function OE(e={},t=null){if(typeof t!=
|
|
1061
|
+
"function")return!0;try{return t(pt(e))===!0}catch{return!1}}function CE(e=0){let t=Math.floor(Number(e||0));return Number.
|
|
1062
|
+
isFinite(t)&&t>0?t:0}function xE(e="",{outputLimit:t=0}={}){let r=String(e||""),n=CE(t);return!n||r.length<=n?{output:r,
|
|
1063
|
+
outputTruncated:!1}:{output:r.slice(r.length-n),outputTruncated:!0}}function pt(e,t={}){let r=xE(e.output,t);return{ok:!0,
|
|
1064
|
+
closeError:e.closeError||"",cols:e.cols||ns,createdAt:e.createdAt||"",id:e.id,commandPreview:e.commandPreview,exitCode:e.
|
|
1052
1065
|
exitCode,inputVersion:e.inputVersion||0,lastInputAt:e.lastInputAt||"",lastInputBytes:e.lastInputBytes||0,lastOutputAt:e.
|
|
1053
1066
|
lastOutputAt||"",lastOutputBytes:e.lastOutputBytes||0,metadata:e.metadata||{},output:r.output,outputTruncated:r.outputTruncated,
|
|
1054
|
-
outputVersion:e.outputVersion||0,rows:e.rows||
|
|
1055
|
-
metadata,type:"metadata"})),
|
|
1056
|
-
e));return!Number.isFinite(t)||t<0?0:Math.min(t,
|
|
1057
|
-
e.lastInputAt),
|
|
1058
|
-
e);return r>0?Math.max(0,Number(t)-r):0}function
|
|
1059
|
-
e.detachedCleanupTimer=null)}function
|
|
1060
|
-
if(r<1)return;let n=Math.max(0,r-
|
|
1061
|
-
n)}function
|
|
1062
|
-
e.lastOutputBytes=r)}function
|
|
1063
|
-
delete(r)}}function
|
|
1064
|
-
function
|
|
1067
|
+
outputVersion:e.outputVersion||0,rows:e.rows||os,status:e.status}}function kE(e,t={}){return!e||!t||typeof t!="object"||Array.isArray(t)||(e.metadata={...e.metadata||{},...t},Y(e,{metadata:e.
|
|
1068
|
+
metadata,type:"metadata"})),pt(e)}function NE(e=""){return wE.byteLength(String(e||""),"utf8")}function Rn(e=""){let t=Date.parse(String(e||""));return Number.isFinite(t)?t:0}function On(e=0){let t=Math.floor(Number(
|
|
1069
|
+
e));return!Number.isFinite(t)||t<0?0:Math.min(t,EE)}function $E(e={}){return Math.max(Rn(e.lastSubscriberDetachedAt),Rn(
|
|
1070
|
+
e.lastInputAt),Rn(e.lastOutputAt),Rn(e.createdAt))}function Sp(e={},t=Date.now()){if(e?.subscribers?.size)return 0;let r=$E(
|
|
1071
|
+
e);return r>0?Math.max(0,Number(t)-r):0}function Ep(e={}){e?.detachedCleanupTimer&&(clearTimeout(e.detachedCleanupTimer),
|
|
1072
|
+
e.detachedCleanupTimer=null)}function is(e={},t="default"){if(Ep(e),!_p(e)||e?.subscribers?.size)return;let r=On(e.detachedIdleTimeoutMs);
|
|
1073
|
+
if(r<1)return;let n=Math.max(0,r-Sp(e));e.detachedCleanupTimer=setTimeout(()=>{e.detachedCleanupTimer=null,WE({namespace:t})},
|
|
1074
|
+
n)}function ME(e,t=""){let r=NE(t);r<1||(e.outputVersion=Number(e.outputVersion||0)+1,e.lastOutputAt=new Date().toISOString(),
|
|
1075
|
+
e.lastOutputBytes=r)}function Y(e,t){if(e?.subscribers?.size)for(let r of[...e.subscribers])try{r(t)}catch{e.subscribers.
|
|
1076
|
+
delete(r)}}function DE(e){let t=String(e?.code||""),r=String(e?.message||e||"Terminal PTY error.");return{code:t,message:r}}
|
|
1077
|
+
function LE(e,t){if(!e)return;let r=DE(t);e.lastWriteErrorAt=new Date().toISOString(),e.lastWriteErrorCode=r.code,e.lastWriteError=
|
|
1065
1078
|
r.message,console.warn("Vibe64 terminal PTY write error.",{code:r.code,id:e.id,metadata:e.metadata||{},message:r.message,
|
|
1066
|
-
namespace:e.namespace||""}),
|
|
1067
|
-
!t||typeof t.on!="function"||t.on("error",r=>{
|
|
1068
|
-
let n=e?[
|
|
1069
|
-
return o}function
|
|
1070
|
-
r.session,e)).length}async function
|
|
1079
|
+
namespace:e.namespace||""}),Y(e,{code:r.code,error:r.message,type:"error"})}function BE(e){let t=e?.terminal?._writeStream;
|
|
1080
|
+
!t||typeof t.on!="function"||t.on("error",r=>{LE(e,r)})}function vp({namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){
|
|
1081
|
+
let n=e?[ss(e)]:PE(t),o=[];for(let i of n){let s=Cn(i);for(let a of s.values())r&&!as(a)||o.push({namespace:i,session:a})}
|
|
1082
|
+
return o}function UE({filter:e=null,namespacePrefix:t=""}={}){return vp({namespacePrefix:t,runningOnly:!0}).filter(r=>OE(
|
|
1083
|
+
r.session,e)).length}async function zE(e,t){if(!(!e||e.closeHookStarted)){if(e.closeHookStarted=!0,typeof e.onClose!="function")return null;try{
|
|
1071
1084
|
return await e.onClose({exitCode:e.exitCode,id:e.id,output:e.output,reason:t,status:e.status}),null}catch(r){let n=String(
|
|
1072
1085
|
r?.message||r||"Terminal finalization failed."),o=r instanceof Error?r:new Error(n);o.code||="terminal_close_hook_failed";
|
|
1073
1086
|
let i=`\r
|
|
1074
1087
|
[studio] Terminal finalization failed: ${n}\r
|
|
1075
|
-
`;return e.closeError=n,e.output=
|
|
1088
|
+
`;return e.closeError=n,e.output=xn(`${e.output}${i}`),Y(e,{chunk:i,type:"output"}),Y(e,{error:n,type:"error"}),o}}}async function GE(e,t){
|
|
1076
1089
|
if(!(!e||e.stopHookStarted)){if(e.stopHookStarted=!0,typeof e.onStop!="function")return null;try{return await e.onStop({
|
|
1077
1090
|
id:e.id,output:e.output,reason:t,status:e.status}),null}catch(r){let n=String(r?.message||r||"Terminal stop failed."),o=r instanceof
|
|
1078
1091
|
Error?r:new Error(n);o.code||="terminal_stop_hook_failed";let i=`\r
|
|
1079
1092
|
[studio] Terminal stop failed: ${n}\r
|
|
1080
|
-
`;return e.closeError=n,e.output=
|
|
1093
|
+
`;return e.closeError=n,e.output=xn(`${e.output}${i}`),Y(e,{chunk:i,type:"output"}),Y(e,{error:n,type:"error"}),o}}}function ft(e,t){
|
|
1081
1094
|
let r=`${String(t?.code||"terminal_cleanup_failed")}:${String(t?.message||"")}`;if(e.reportedLifecycleFailures||=new Set,
|
|
1082
1095
|
e.reportedLifecycleFailures.has(r))return t;e.reportedLifecycleFailures.add(r);let n=String(t?.message||t||"Terminal cle\
|
|
1083
1096
|
anup failed."),o=`\r
|
|
1084
1097
|
[studio] ${n}\r
|
|
1085
|
-
`;return e.closeError=n,e.output=
|
|
1098
|
+
`;return e.closeError=n,e.output=xn(`${e.output}${o}`),Y(e,{chunk:o,type:"output"}),Y(e,{error:n,type:"error"}),t}function yp(e,t=[]){
|
|
1086
1099
|
let r=new AggregateError(t,`Terminal session could not close cleanly: ${e.id}`);return r.code=t.some(n=>String(n?.code||
|
|
1087
|
-
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function
|
|
1088
|
-
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>
|
|
1089
|
-
return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>
|
|
1090
|
-
e.status!=="exited"&&(e.status="exited",
|
|
1091
|
-
s"}))}function
|
|
1100
|
+
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function HE(e,t){
|
|
1101
|
+
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>GE(e,t))),e.stopHookCompletion}function Tp(e,t){
|
|
1102
|
+
return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>zE(e,t))),e.closeHookCompletion}function Ap(e){
|
|
1103
|
+
e.status!=="exited"&&(e.status="exited",Y(e,{closeError:e.closeError||"",exitCode:e.exitCode,status:e.status,type:"statu\
|
|
1104
|
+
s"}))}function Ip(e){return e.scopeDrainCompletion||(e.scopeDrainCompletion=(async()=>{if(process.platform!=="win32"&&!await hn(
|
|
1092
1105
|
e.terminal.pid)){let t=new Error(`Terminal execution scope did not become empty: ${e.id}`);throw t.code="terminal_execut\
|
|
1093
|
-
ion_drain_failed",t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function
|
|
1094
|
-
scopeDrainCompletion}catch(t){ft(e,t)}try{await Promise.all([
|
|
1095
|
-
ft(e,t)}
|
|
1096
|
-
namespace:a="default",namespaceLimitPrefix:c="",runningLimitFilter:l=null,onClose:u=null,onOutput:d=null,onStop:
|
|
1097
|
-
detachedIdleTimeoutMs:m=0}){let h=
|
|
1098
|
-
[...
|
|
1099
|
-
|
|
1100
|
-
o,S=typeof e=="function"?e({env:
|
|
1101
|
-
"function"?s({args:S,env:
|
|
1102
|
-
"object"&&!Array.isArray(
|
|
1103
|
-
closePromise:null,commandPreview:x,cols:
|
|
1104
|
-
m),exitCompletion:
|
|
1105
|
-
typeof
|
|
1106
|
+
ion_drain_failed",t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function FE(e){try{await e.
|
|
1107
|
+
scopeDrainCompletion}catch(t){ft(e,t)}try{await Promise.all([Tp(e,e.stopReason||"exit"),e.stopHookCompletion])}catch(t){
|
|
1108
|
+
ft(e,t)}Ap(e)}function Rp({args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},maxRunning:i=0,metadata:s=null,
|
|
1109
|
+
namespace:a="default",namespaceLimitPrefix:c="",runningLimitFilter:l=null,onClose:u=null,onOutput:d=null,onStop:p=null,reuseRunning:f=!1,
|
|
1110
|
+
detachedIdleTimeoutMs:m=0}){let h=RE(a);if(h)return h;let y=Cn(a),w=yE.randomUUID(),g=typeof f=="function"?f:()=>!!f,v=f?
|
|
1111
|
+
[...y.values()].find(U=>as(U)&&g(U)):null;if(v)return pt(v);let _=Number(i||0),A=c||a;if(_>0&&UE({filter:l,namespacePrefix:A})>=
|
|
1112
|
+
_)return{ok:!1,code:"terminal_limit",error:`Terminal limit reached (${_}).`};let I=typeof o=="function"?o({id:w,namespace:a}):
|
|
1113
|
+
o,S=typeof e=="function"?e({env:I,id:w,namespace:a}):e,x=typeof r=="function"?r({args:S,env:I,id:w,namespace:a}):r,N=typeof s==
|
|
1114
|
+
"function"?s({args:S,env:I,id:w,namespace:a}):s,$=vE("node-pty").spawn(t,S,{cols:ns,cwd:n,env:{...process.env,...I&&typeof I==
|
|
1115
|
+
"object"&&!Array.isArray(I)?I:{}},name:"xterm-color",rows:os}),M,he=new Promise(U=>{M=U}),k={id:w,closeHookCompletion:null,
|
|
1116
|
+
closePromise:null,commandPreview:x,cols:ns,createdAt:new Date().toISOString(),cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:On(
|
|
1117
|
+
m),exitCompletion:he,exitCode:null,lastSubscriberAttachedAt:"",lastSubscriberDetachedAt:new Date().toISOString(),metadata:N&&
|
|
1118
|
+
typeof N=="object"&&!Array.isArray(N)?N:{},onClose:u,onStop:p,inputVersion:0,lastInputAt:"",lastInputBytes:0,lastOutputAt:"",
|
|
1106
1119
|
lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",output:"",outputVersion:0,processExited:!1,
|
|
1107
|
-
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:
|
|
1108
|
-
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal
|
|
1109
|
-
output+U),
|
|
1110
|
-
d({chunk:U,output:
|
|
1111
|
-
"Terminal output hook failed.");
|
|
1112
|
-
U,
|
|
1113
|
-
|
|
1114
|
-
e);return o?
|
|
1115
|
-
nning"&&(e.status="closing",
|
|
1120
|
+
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:M,rows:os,status:"running",stopHookCompletion:null,
|
|
1121
|
+
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:$};return BE(k),$.onData(U=>{if(ME(k,U),k.output=xn(k.
|
|
1122
|
+
output+U),Y(k,{chunk:U,lastOutputAt:k.lastOutputAt,outputVersion:k.outputVersion,type:"output"}),typeof d=="function")try{
|
|
1123
|
+
d({chunk:U,output:k.output,session:pt(k),updateMetadata(St){return kE(k,St)}})}catch(St){let Ge=String(St?.message||St||
|
|
1124
|
+
"Terminal output hook failed.");Y(k,{error:Ge,type:"error"})}is(k,a)}),$.onExit(({exitCode:U})=>{k.processExited=!0,k.exitCode=
|
|
1125
|
+
U,k.status="closing",Ip(k),Y(k,{exitCode:U,status:k.status,type:"status"}),Tp(k,k.stopReason||"exit"),k.resolveExitCompletion(),
|
|
1126
|
+
FE(k)}),y.set(w,k),is(k,a),jE(w,{namespace:a})}function jE(e,{namespace:t="default",outputLimit:r=0}={}){let o=Cn(t).get(
|
|
1127
|
+
e);return o?pt(o,{outputLimit:r}):AE()}async function VE(e,t="stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=String(t||"stop"),e.status==="ru\
|
|
1128
|
+
nning"&&(e.status="closing",Y(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];if(HE(e,e.stopReason),!e.
|
|
1116
1129
|
processExited&&!e.killStarted){e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;let o=n instanceof Error?
|
|
1117
|
-
n:new Error(String(n||"Terminal process could not be killed."));o.code||="terminal_kill_failed",r.push(ft(e,o))}}try{await
|
|
1118
|
-
e)}catch(n){r.push(ft(e,n))}return{failures:r}}async function
|
|
1119
|
-
closePromise;let o=(async()=>{let i=[];if(
|
|
1130
|
+
n:new Error(String(n||"Terminal process could not be killed."));o.code||="terminal_kill_failed",r.push(ft(e,o))}}try{await Ip(
|
|
1131
|
+
e)}catch(n){r.push(ft(e,n))}return{failures:r}}async function Pp(e,{namespace:t="default"}={}){let r=Cn(t),n=r.get(e);if(!n)return{ok:!0,closed:!1};if(n.closePromise)return n.
|
|
1132
|
+
closePromise;let o=(async()=>{let i=[];if(Ep(n),!n.processExited){let c=await VE(n,"close");if(c.failures.length)throw yp(
|
|
1120
1133
|
n,c.failures)}try{await n.exitCompletion}catch(c){i.push(ft(n,c))}try{await n.scopeDrainCompletion}catch(c){i.push(ft(n,
|
|
1121
|
-
c))}let a=(await Promise.all([n.stopHookCompletion,n.closeHookCompletion])).filter(Boolean);if(n.processExited&&
|
|
1122
|
-
length>0)throw
|
|
1123
|
-
c))}:{}}})();n.closePromise=o;try{return await o}finally{n.closePromise===o&&(n.closePromise=null)}}async function
|
|
1124
|
-
{namespace:t,namespacePrefix:r})){if(!
|
|
1125
|
-
if(a<1&&e==null)continue;if(
|
|
1126
|
-
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=
|
|
1127
|
-
"exec-helper-payloads");return
|
|
1128
|
-
actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){let s=e.terminal||{};return
|
|
1129
|
-
l=
|
|
1130
|
-
cwd:o,env:typeof l=="function"?l(a):l,input:e.input,operation:
|
|
1131
|
-
`,{mode:384}),["-n",
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
namespace
|
|
1138
|
-
|
|
1139
|
-
reuseRunning,runningLimitFilter:s.runningLimitFilter});return l?.ok===!0&&a&&
|
|
1134
|
+
c))}let a=(await Promise.all([n.stopHookCompletion,n.closeHookCompletion])).filter(Boolean);if(n.processExited&&Ap(n),i.
|
|
1135
|
+
length>0)throw yp(n,[...i,...a]);return r.delete(e),{ok:!0,closed:!0,...a.length>0?{cleanupErrors:a.map(c=>String(c?.message||
|
|
1136
|
+
c))}:{}}})();n.closePromise=o;try{return await o}finally{n.closePromise===o&&(n.closePromise=null)}}async function WE({idleMs:e=null,namespace:t="",namespacePrefix:r="",now:n=Date.now()}={}){let o=0;for(let{namespace:i,session:s}of vp(
|
|
1137
|
+
{namespace:t,namespacePrefix:r})){if(!_p(s)||s.subscribers?.size)continue;let a=e==null?On(s.detachedIdleTimeoutMs):On(e);
|
|
1138
|
+
if(a<1&&e==null)continue;if(Sp(s,n)<a){is(s,i);continue}(await Pp(s.id,{namespace:i})).closed&&(o+=1)}return{ok:!0,closed:o}}var Op=new Map;function JE(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper payload root is required fo\
|
|
1139
|
+
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=cs.join(cs.resolve(t),
|
|
1140
|
+
"exec-helper-payloads");return YE(r,{mode:448,recursive:!0}),cs.join(r,`${process.pid}-${Date.now()}-${qE()}.json`)}function XE(e={},{
|
|
1141
|
+
actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){let s=e.terminal||{};return _n(t)?{args:(a={})=>{let c=JE(s.helperPayloadRoot),
|
|
1142
|
+
l=Cp(e,{actor:t,baseEnv:r,policyEnv:i}),u=typeof e.args=="function"?e.args(a):e.args,d=Ht({actor:t,args:u,command:e.command,
|
|
1143
|
+
cwd:o,env:typeof l=="function"?l(a):l,input:e.input,operation:Ft(e)});return KE(c,`${JSON.stringify(d)}
|
|
1144
|
+
`,{mode:384}),["-n",Di(),"execute",c]},command:"sudo",cwd:s.helperPayloadRoot,env:{}}:{args:e.args,command:e.command,cwd:o,
|
|
1145
|
+
env:Cp(e,{actor:t,baseEnv:r,localPath:n,policyEnv:i})}}function Cp(e={},{actor:t={},baseEnv:r={},localPath:n="",policyEnv:o={}}={}){
|
|
1146
|
+
return typeof e.envFactory!="function"?o:(i={})=>dt({actor:t,baseEnv:r,localPath:n,request:{...e,env:G(e.envFactory(i)),
|
|
1147
|
+
envFactory:null}})}async function xp(e={},{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){try{let s=e.terminal||{},a=e.execution?.
|
|
1148
|
+
id||"",c=XE(e,{actor:t,baseEnv:r||i,localPath:n,cwd:o,env:i}),l=Rp({args:c.args,command:c.command,commandPreview:s.commandPreview,
|
|
1149
|
+
cwd:c.cwd,detachedIdleTimeoutMs:s.detachedIdleTimeoutMs,env:c.env,maxRunning:s.maxRunning,metadata:s.metadata,namespace:s.
|
|
1150
|
+
namespace,namespaceLimitPrefix:s.namespaceLimitPrefix,onClose:async u=>{try{typeof s.onClose=="function"&&await s.onClose(
|
|
1151
|
+
u)}finally{a&&Op.set(a,{id:u.id,namespace:s.namespace,scopeEmpty:!0})}},onOutput:s.onOutput,onStop:s.onStop,reuseRunning:s.
|
|
1152
|
+
reuseRunning,runningLimitFilter:s.runningLimitFilter});return l?.ok===!0&&a&&Op.set(a,{id:l.id,namespace:s.namespace}),l?.
|
|
1140
1153
|
ok===!0?{...l,execution:e.execution}:l}catch(s){return z(s?.message||"Vibe64 PTY command failed.",s?.code||"vibe64_comma\
|
|
1141
|
-
nd_pty_failed",{execution:e.execution})}}import{realpathSync as
|
|
1142
|
-
"..")&&!
|
|
1143
|
-
if(n.length===0)return r;let o=n.filter(s
|
|
1144
|
-
"Vibe64 command cwd is outside the allowed roots.");throw i.code="vibe64_command_cwd_outside_allowed_roots",i}import{randomUUID as
|
|
1145
|
-
ex","github","github-api","source-editor","preview","output","deployment","health","workspace-cache","source"]),
|
|
1146
|
-
freeze(["capture","pty","detached"]),
|
|
1147
|
-
"auth","deployment"]),
|
|
1148
|
-
control","job","preview","service","terminal"]),
|
|
1154
|
+
nd_pty_failed",{execution:e.execution})}}import{realpathSync as kp}from"node:fs";import Np from"node:path";function ZE(e=""){return O(e||process.cwd())}function $p(e="",t=""){let r=Np.relative(e,t);return r===""||!r.startsWith(
|
|
1155
|
+
"..")&&!Np.isAbsolute(r)}function Mp(e="",{allowedRoots:t=[]}={}){let r=ZE(e),n=(Array.isArray(t)?t:[t]).map(O).filter(Boolean);
|
|
1156
|
+
if(n.length===0)return r;let o=n.filter(s=>$p(s,r));if(o.length>0){let s=kp(r);if(o.some(a=>$p(kp(a),s)))return s}let i=new Error(
|
|
1157
|
+
"Vibe64 command cwd is outside the allowed roots.");throw i.code="vibe64_command_cwd_outside_allowed_roots",i}import{randomUUID as QE}from"node:crypto";var ev=Object.freeze(["daemon","owner-user","named-user","app"]),tv=Object.freeze(["account","assistant","terminal","cod\
|
|
1158
|
+
ex","github","github-api","source-editor","preview","output","deployment","health","workspace-cache","source"]),rv=Object.
|
|
1159
|
+
freeze(["capture","pty","detached"]),nv=Object.freeze(["utf8","base64"]),ov=Object.freeze(["session","project","preview",
|
|
1160
|
+
"auth","deployment"]),iv=Object.freeze(["none","github-https","github-token"]),Lp=Object.freeze(["assistant","browser","\
|
|
1161
|
+
control","job","preview","service","terminal"]),Bp=Object.freeze(["finite","interactive","service"]),sv=Object.freeze(["\
|
|
1149
1162
|
node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","bubblewrap","bun","php","composer","awsebcli","cpp",
|
|
1150
|
-
"python","ruby","go","java","kotlin","csharp","rust","playwright","operator-clis"]),
|
|
1151
|
-
t","codex","deployment","output","preview","source","terminal"]);function
|
|
1152
|
-
e||"Invalid Vibe64 command request.");return r.code=t,r}function
|
|
1153
|
-
o))throw
|
|
1154
|
-
mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw
|
|
1155
|
-
PTY commands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(r=>String(r??""))}
|
|
1156
|
-
function
|
|
1157
|
-
|
|
1158
|
-
r),{env:r,envFactory:null}}function
|
|
1163
|
+
"python","ruby","go","java","kotlin","csharp","rust","playwright","operator-clis"]),av=1e3*1e3*100,cv=new Set(["assistan\
|
|
1164
|
+
t","codex","deployment","output","preview","source","terminal"]);function ee(e="",t="vibe64_command_request_invalid"){let r=new Error(
|
|
1165
|
+
e||"Invalid Vibe64 command request.");return r.code=t,r}function Pe(e="",t=[],r="",n="value"){let o=C(e)||r;if(!t.includes(
|
|
1166
|
+
o))throw ee(`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function lv(e=[],{
|
|
1167
|
+
mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw ee("Function-valued command args are only supported fo\
|
|
1168
|
+
r PTY commands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(r=>String(r??""))}
|
|
1169
|
+
function uv(e={},{mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw ee("Function-valued command env is o\
|
|
1170
|
+
nly supported for PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},envFactory:e}}let r=G(e);return ut(
|
|
1171
|
+
r),{env:r,envFactory:null}}function ls(e=[]){return(Array.isArray(e)?e:[e]).map(O).filter(Boolean)}function dv(e={}){let t=F(
|
|
1159
1172
|
e);return{commandPreview:t.commandPreview,detachedIdleTimeoutMs:t.detachedIdleTimeoutMs,helperPayloadRoot:O(t.helperPayloadRoot||
|
|
1160
1173
|
t.payloadRoot),maxRunning:t.maxRunning,metadata:t.metadata,namespace:C(t.namespace),namespaceLimitPrefix:C(t.namespaceLimitPrefix),
|
|
1161
1174
|
onClose:t.onClose,onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.runningLimitFilter}}
|
|
1162
|
-
function
|
|
1175
|
+
function pv(e={}){let t=F(e),r=O(t.home||t.toolHomeSource);return r?{cacheRoot:O(t.cacheRoot),configRoot:O(t.configRoot),
|
|
1163
1176
|
dataRoot:O(t.dataRoot),gid:Number.isSafeInteger(Number(t.gid??t.hostGid))?Number(t.gid??t.hostGid):null,home:r,scope:C(t.
|
|
1164
1177
|
scope),stateRoot:O(t.stateRoot),uid:Number.isSafeInteger(Number(t.uid??t.hostUid))?Number(t.uid??t.hostUid):null,username:C(
|
|
1165
|
-
t.username||t.ownerUserKey||t.userKey)}:{}}function
|
|
1166
|
-
ve":"finite"}function
|
|
1167
|
-
"job"}function
|
|
1168
|
-
`Invalid Vibe64 execution identifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function
|
|
1169
|
-
apture",project:r={},purpose:n="terminal",session:o={}}={}){let i=
|
|
1170
|
-
kind"),a=
|
|
1171
|
-
t==="capture"&&a!=="finite")throw
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
keys(l).some(u=>!["key","compatibilityKey","environment"].includes(u))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.test(l.key||
|
|
1175
|
-
|
|
1176
|
-
Invalid activity resource profile identity.","vibe64_resource_profile_invalid");return Object.freeze({...l?{resourceProfile:Object.
|
|
1177
|
-
freeze({...l})}:{},controlGenerationId:
|
|
1178
|
-
""?{}:{workflowId:
|
|
1179
|
-
parentExecutionId:
|
|
1180
|
-
o.sessionId||o.id)})}function
|
|
1181
|
-
test(e))throw
|
|
1182
|
-
return
|
|
1183
|
-
e,"runtimes"),n=
|
|
1184
|
-
map(C).filter(Boolean))}function
|
|
1185
|
-
|
|
1186
|
-
throw
|
|
1187
|
-
t.env!==void 0?t.env:t.extraEnv,{mode:n}),s=
|
|
1188
|
-
d))throw
|
|
1189
|
-
releaseEnvironmentFile??"";if(typeof u!="string"||u&&(!u.startsWith("/")||/[\r\n\0]/u.test(u)||n!=="
|
|
1190
|
-
"app"||t.envPolicy!=="deployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
command:r,cwd:O(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,envPolicy:
|
|
1194
|
-
|
|
1195
|
-
gitAuthToken:C(t.gitAuthToken||t.gitCredentials?.token),gitSafeDirectories:
|
|
1196
|
-
t.gitTransport,
|
|
1197
|
-
input:t.stdin??t.input,logPath:O(t.logPath),maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&
|
|
1198
|
-
t.maxBuffer):
|
|
1199
|
-
|
|
1200
|
-
t.terminal||t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.
|
|
1201
|
-
t.userKey)}}var
|
|
1178
|
+
t.username||t.ownerUserKey||t.userKey)}:{}}function fv(e="capture"){return e==="detached"?"service":e==="pty"?"interacti\
|
|
1179
|
+
ve":"finite"}function mv({mode:e="capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":
|
|
1180
|
+
"job"}function mt(e=""){let t=C(e);if(!t)return"";if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw ee(
|
|
1181
|
+
`Invalid Vibe64 execution identifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function Up(e={},{mode:t="c\
|
|
1182
|
+
apture",project:r={},purpose:n="terminal",session:o={}}={}){let i=F(e),s=Pe(i.kind,Lp,mv({mode:t,purpose:n}),"execution_\
|
|
1183
|
+
kind"),a=Pe(i.lifecycle,Bp,fv(t),"execution_lifecycle");if(t==="detached"&&a!=="service"||t==="pty"&&a!=="interactive"||
|
|
1184
|
+
t==="capture"&&a!=="finite")throw ee(`Execution lifecycle ${a} is incompatible with command mode ${t}.`,"vibe64_executio\
|
|
1185
|
+
n_lifecycle_incompatible");let c=mt(i.ownerId||o.sessionId||o.id);if(a==="service"&&!c)throw ee("Service execution requi\
|
|
1186
|
+
res a durable owner id.","vibe64_execution_owner_required");let l=i.resourceProfile;if(l!=null&&(!l||typeof l!="object"||
|
|
1187
|
+
Object.keys(l).some(u=>!["key","compatibilityKey","environment"].includes(u))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.test(l.key||
|
|
1188
|
+
"")||!/^[a-f0-9]{64}$/u.test(l.compatibilityKey||"")||!["development","test","production"].includes(l.environment)))throw ee(
|
|
1189
|
+
"Invalid activity resource profile identity.","vibe64_resource_profile_invalid");return Object.freeze({...l?{resourceProfile:Object.
|
|
1190
|
+
freeze({...l})}:{},controlGenerationId:mt(i.controlGenerationId),...i.workflowId===void 0||i.workflowId===null||i.workflowId===
|
|
1191
|
+
""?{}:{workflowId:hv(i.workflowId)},id:QE(),kind:s,label:C(i.label),lifecycle:a,operationId:mt(i.operationId),ownerId:c,
|
|
1192
|
+
parentExecutionId:mt(i.parentExecutionId),projectSlug:mt(i.projectSlug||r.slug||r.projectSlug),sessionId:mt(i.sessionId||
|
|
1193
|
+
o.sessionId||o.id)})}function hv(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.
|
|
1194
|
+
test(e))throw ee("Execution requires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}
|
|
1195
|
+
function gv(e=""){return cv.has(e)?Hi:[]}function Dp(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function bv(e={},t=""){
|
|
1196
|
+
let r=Dp(e,"runtimes"),n=Dp(e,"runtime");if(!r&&!n)return Ce(gv(t));let o=r?e.runtimes:e.runtime;return Ce((Array.isArray(
|
|
1197
|
+
o)?o:[o]).map(C).filter(Boolean))}function zp(e={}){let t=F(e),r=C(t.command);if(!r)throw ee("A command is required.","v\
|
|
1198
|
+
ibe64_command_required");let n=Pe(t.mode,rv,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!==
|
|
1199
|
+
"capture"))throw ee("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=G(t.
|
|
1200
|
+
baseEnv),i=uv(t.env!==void 0?t.env:t.extraEnv,{mode:n}),s=Pe(t.purpose,tv,"terminal","purpose"),a=bv(t,s);for(let d of a)
|
|
1201
|
+
if(!sv.includes(d))throw ee(`Unsupported Vibe64 runtime: ${d}.`,"vibe64_command_runtime_unsupported");let c=F(t.project),
|
|
1202
|
+
l=F(t.session),u=t.releaseEnvironmentFile??"";if(typeof u!="string"||u&&(!u.startsWith("/")||/[\r\n\0]/u.test(u)||n!=="c\
|
|
1203
|
+
apture"||t.actor!=="app"||t.envPolicy!=="deployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw ee(
|
|
1204
|
+
"Release environment files require a finite application deployment command without caller Env.","vibe64_command_release_\
|
|
1205
|
+
environment_invalid");return{actor:Pe(t.actor,ev,"daemon","actor"),allowedRoots:ls(t.allowedRoots),args:lv(t.args,{mode:n}),
|
|
1206
|
+
baseEnv:o,command:r,cwd:O(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,envPolicy:Pe(t.envPolicy,ov,"session",
|
|
1207
|
+
"env_policy"),releaseEnvironmentFile:u,execution:Up(t.execution,{mode:n,project:c,purpose:s,session:l}),credentialHome:pv(
|
|
1208
|
+
t.credentialHome),gitAuthToken:C(t.gitAuthToken||t.gitCredentials?.token),gitSafeDirectories:ls(t.gitSafeDirectories||t.
|
|
1209
|
+
safeDirectories),gitTransport:Pe(t.gitTransport,iv,t.githubTransport?"github-https":"none","git_transport"),inheritProcessEnv:!u&&
|
|
1210
|
+
t.inheritProcessEnv!==!1,input:t.stdin??t.input,logPath:O(t.logPath),maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&
|
|
1211
|
+
Number(t.maxBuffer)>0?Number(t.maxBuffer):av,mode:n,onOutput:typeof t.onOutput=="function"?t.onOutput:null,outputEncoding:Pe(
|
|
1212
|
+
t.outputEncoding,nv,"utf8","output_encoding"),project:c,purpose:s,runtimes:a,session:l,signal:t.signal??null,shimDirs:ls(
|
|
1213
|
+
t.shimDirs),terminal:dv(t.terminal||t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.
|
|
1214
|
+
timeout):15e3,userKey:C(t.userKey)}}var wv=null,Gp="VIBE64_MANAGED_EXECUTION_REQUIRED";function us(){return wv}function kn(e=process.env){return["1","true"].includes(String(e?.[Gp]||"").trim().toLowerCase())}async function yv(e,{actor:t,baseEnv:r,localPath:n,cwd:o,env:i,requiresHelper:s}={}){return e.releaseEnvironmentFile?z("\
|
|
1202
1215
|
Release environment execution requires a managed host.","vibe64_release_environment_unavailable",{execution:e.execution}):
|
|
1203
|
-
e.mode==="pty"?
|
|
1216
|
+
e.mode==="pty"?xp(e,{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}):e.mode==="detached"?t.requiresRealUser&&(!ot(t)||s)?z("\
|
|
1204
1217
|
Detached real-user command execution is unsupported when the helper is required.","vibe64_command_detached_real_user_uns\
|
|
1205
|
-
upported",{execution:e.execution}):
|
|
1206
|
-
cwd:o,env:i,input:e.input,operation:
|
|
1207
|
-
timeout}),execution:e.execution}:
|
|
1218
|
+
upported",{execution:e.execution}):zd(e,{actor:t,cwd:o,env:i}):s?{...await Li(Ht({actor:t,args:e.args,command:e.command,
|
|
1219
|
+
cwd:o,env:i,input:e.input,operation:Ft(e)}),{maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.
|
|
1220
|
+
timeout}),execution:e.execution}:Be(e.command,e.args,{cwd:o,env:i,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,
|
|
1208
1221
|
onOutput:e.onOutput,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function D(e={}){let t=null;
|
|
1209
|
-
try{if(t=
|
|
1222
|
+
try{if(t=zp(e),t.signal?.aborted)return z("Command cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await Jd(
|
|
1210
1223
|
t),n=t.inheritProcessEnv?{...process.env,...t.baseEnv}:{...t.baseEnv},o=(m={})=>({...m,VIBE64_EXECUTION_ID:t.execution.id}),
|
|
1211
|
-
i=
|
|
1212
|
-
join(":"):"",l=o(
|
|
1213
|
-
r,l);let u=
|
|
1214
|
-
t.envFactory?
|
|
1224
|
+
i=us(),s=kn(n)||kn(process.env),a=_n(r),c=!i&&!s&&!a&&!yn(n)&&!yn(process.env)&&ot(r)?[n.PATH,process.env.PATH].filter(Boolean).
|
|
1225
|
+
join(":"):"",l=o(dt({actor:r,baseEnv:n,localPath:c,request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t}));Zd(
|
|
1226
|
+
r,l);let u=Mp(t.cwd,{allowedRoots:t.allowedRoots});Xd(r,t,u);let d=(m={})=>typeof t.args=="function"?t.args(m):t.args,p=(m={})=>o(
|
|
1227
|
+
t.envFactory?dt({actor:r,baseEnv:n,localPath:c,request:{...t,env:t.envFactory(m),envFactory:null}}):l),f=(m=t,h={})=>yv(
|
|
1215
1228
|
m,{actor:r,baseEnv:n,localPath:c,cwd:u,env:l,requiresHelper:a,...h});return i?await i.runCommand(t,{actor:r,baseEnv:n,cwd:u,
|
|
1216
|
-
env:l,resolveArgs:d,resolveEnv:
|
|
1229
|
+
env:l,resolveArgs:d,resolveEnv:p,runLocal:f}):t.releaseEnvironmentFile?z("Release environment execution requires a manag\
|
|
1217
1230
|
ed host.","vibe64_release_environment_unavailable",{execution:t.execution}):s?z("Managed execution safety is unavailable\
|
|
1218
1231
|
. Vibe64 did not start this work.","vibe64_managed_execution_provider_unavailable",{execution:t.execution,retryable:!1}):
|
|
1219
|
-
|
|
1220
|
-
import se from"node:path";var
|
|
1232
|
+
f()}catch(r){return z(r?.message||"Vibe64 command failed.",r?.code||"vibe64_command_failed",{execution:t?.execution})}}import{createHash as _v}from"node:crypto";import{lstat as Sv,mkdir as Ev,mkdtemp as vv,rm as Tv,statfs as Av}from"node:fs/promises";
|
|
1233
|
+
import se from"node:path";var Iv=3e4,Rv=512*1024*1024,Pv=1024*1024*1024,Vp=new Set(["cancelled","completed","failed","interrupted"]),Nn=new Map;async function $n({
|
|
1221
1234
|
outerTurnId:e="",outcome:t="completed",project:r={},runCommand:n=D,sessionId:o="",temporaryDiskBudgetBytes:i,temporaryDiskReserveBytes:s,
|
|
1222
|
-
timestamp:a="",worktreePath:c=""}={}){let l=
|
|
1223
|
-
return
|
|
1224
|
-
async function
|
|
1225
|
-
let s=await
|
|
1226
|
-
refs:r,runCommand:n});let a=await
|
|
1227
|
-
project:t,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:e.worktreePath}),l=await
|
|
1228
|
-
e.worktreePath,{project:t});for(let u=0;;u+=1){let d=await
|
|
1229
|
-
|
|
1235
|
+
timestamp:a="",worktreePath:c=""}={}){let l=xv({outerTurnId:e,outcome:t,sessionId:o,timestamp:a,worktreePath:c}),u=ds(l);
|
|
1236
|
+
return qp(l.worktreePath,()=>Ov({identity:l,project:r,refs:u,runCommand:n,temporaryDiskBudgetBytes:i,temporaryDiskReserveBytes:s}))}
|
|
1237
|
+
async function Ov({identity:e={},project:t={},refs:r={},runCommand:n=D,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i}={}){
|
|
1238
|
+
let s=await ht(n,e.worktreePath,["rev-parse","--verify",r.turnRef],{project:t});if(s)return jp({commit:s,identity:e,project:t,
|
|
1239
|
+
refs:r,runCommand:n});let a=await K(n,e.worktreePath,["rev-parse","--verify","HEAD"],{project:t}),c=await Wp({baseCommit:a,
|
|
1240
|
+
project:t,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:e.worktreePath}),l=await Xp(n,
|
|
1241
|
+
e.worktreePath,{project:t});for(let u=0;;u+=1){let d=await ht(n,e.worktreePath,["rev-parse","--verify",r.latestRef],{project:t}),
|
|
1242
|
+
p=d||a,f=await K(n,e.worktreePath,["commit-tree",c,"-p",p],{env:kv(e.timestamp),input:Jp(e),project:t});try{await K(n,e.
|
|
1230
1243
|
worktreePath,["update-ref","--stdin"],{input:`start
|
|
1231
|
-
create ${r.turnRef} ${
|
|
1232
|
-
update ${r.latestRef} ${
|
|
1244
|
+
create ${r.turnRef} ${f}
|
|
1245
|
+
update ${r.latestRef} ${f} ${d||l}
|
|
1233
1246
|
prepare
|
|
1234
1247
|
commit
|
|
1235
|
-
`,project:t})}catch(m){let h=await
|
|
1236
|
-
identity:e,project:t,refs:r,runCommand:n});let
|
|
1237
|
-
if(u>=2||
|
|
1248
|
+
`,project:t})}catch(m){let h=await ht(n,e.worktreePath,["rev-parse","--verify",r.turnRef],{project:t});if(h)return jp({commit:h,
|
|
1249
|
+
identity:e,project:t,refs:r,runCommand:n});let y=await ht(n,e.worktreePath,["rev-parse","--verify",r.latestRef],{project:t});
|
|
1250
|
+
if(u>=2||y===d)throw m;continue}return{baseCommit:p,commit:f,created:!0,latestRef:r.latestRef,ok:!0,outerTurnId:e.outerTurnId,
|
|
1238
1251
|
outcome:e.outcome,sessionId:e.sessionId,tree:c,turnRef:r.turnRef}}}async function ae({baseCommit:e="HEAD",paths:t=[],project:r={},
|
|
1239
|
-
runCommand:n=D,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=se.resolve(
|
|
1240
|
-
treePath"));return
|
|
1241
|
-
worktreePath:a}))}async function
|
|
1242
|
-
temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=se.resolve(
|
|
1243
|
-
absolute-git-dir"],{project:r}),l=se.join(c,"vibe64-checkpoints");await
|
|
1244
|
-
tree-")),d=se.join(u,"index");try{let
|
|
1245
|
-
isArray(t)?t.map(m=>String(m||"")).filter(Boolean):[];return await
|
|
1246
|
-
temporaryDiskReserveBytes:i,worktreePath:a}),await
|
|
1247
|
-
1"},project:r}),await
|
|
1248
|
-
let r=se.resolve(e),o=(
|
|
1249
|
-
get(r)===i&&
|
|
1252
|
+
runCommand:n=D,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=se.resolve(Ue(s,"work\
|
|
1253
|
+
treePath"));return qp(a,()=>Wp({baseCommit:e,paths:t,project:r,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,
|
|
1254
|
+
worktreePath:a}))}async function Wp({baseCommit:e="HEAD",paths:t=[],project:r={},runCommand:n=D,temporaryDiskBudgetBytes:o,
|
|
1255
|
+
temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=se.resolve(Ue(s,"worktreePath")),c=await K(n,a,["rev-parse","--\
|
|
1256
|
+
absolute-git-dir"],{project:r}),l=se.join(c,"vibe64-checkpoints");await Ev(l,{recursive:!0});let u=await vv(se.join(l,".\
|
|
1257
|
+
tree-")),d=se.join(u,"index");try{let p={GIT_INDEX_FILE:d};await K(n,a,["read-tree",e||"HEAD"],{env:p,project:r});let f=Array.
|
|
1258
|
+
isArray(t)?t.map(m=>String(m||"")).filter(Boolean):[];return await Cv({gitDirectory:c,paths:f,project:r,runCommand:n,temporaryDiskBudgetBytes:o,
|
|
1259
|
+
temporaryDiskReserveBytes:i,worktreePath:a}),await K(n,a,["add","-A","--",...f.length>0?f:["."]],{env:{...p,GIT_LITERAL_PATHSPECS:"\
|
|
1260
|
+
1"},project:r}),await K(n,a,["write-tree"],{env:p,project:r})}finally{await Tv(u,{force:!0,recursive:!0})}}function qp(e="",t=async()=>null){
|
|
1261
|
+
let r=se.resolve(e),o=(Nn.get(r)||Promise.resolve()).catch(()=>null).then(t),i=o.then(()=>null,()=>null).finally(()=>{Nn.
|
|
1262
|
+
get(r)===i&&Nn.delete(r)});return Nn.set(r,i),o}async function Cv({gitDirectory:e="",paths:t=[],project:r={},runCommand:n=D,
|
|
1250
1263
|
temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=t.length>0?t:["."],[c,l,u]=await Promise.
|
|
1251
|
-
all([
|
|
1252
|
-
-z","--",...a],{project:r}),
|
|
1253
|
-
relative(s,A);if(
|
|
1254
|
-
utside the session source.","vibe64_checkpoint_candidate_invalid");let S=await
|
|
1255
|
-
reject(x));S?.isFile()&&
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
bytes-
|
|
1264
|
+
all([K(n,s,["diff","--name-only","-z","HEAD","--",...a],{project:r}),K(n,s,["ls-files","--others","--exclude-standard","\
|
|
1265
|
+
-z","--",...a],{project:r}),Av(e)]),d=[...new Set([...Hp(c),...Hp(l)])],p=[];for(let _ of d){let A=se.resolve(s,_),I=se.
|
|
1266
|
+
relative(s,A);if(I===".."||I.startsWith(`..${se.sep}`)||se.isAbsolute(I))throw ze("Git returned a checkpoint candidate o\
|
|
1267
|
+
utside the session source.","vibe64_checkpoint_candidate_invalid");let S=await Sv(A).catch(x=>x?.code==="ENOENT"?null:Promise.
|
|
1268
|
+
reject(x));S?.isFile()&&p.push({bytes:Number(S.size||0),path:I})}let f=p.reduce((_,A)=>_+A.bytes,0),m=Math.min(Number.MAX_SAFE_INTEGER,
|
|
1269
|
+
f*2),h=Fp(o,process.env.VIBE64_CHECKPOINT_TEMPORARY_DISK_BUDGET_BYTES,Rv,1),y=Fp(i,process.env.VIBE64_CHECKPOINT_DISK_RESERVE_BYTES,
|
|
1270
|
+
Pv,0),w=Math.max(0,Number(u.bavail)*Number(u.bsize)),g=Math.min(h,Math.max(0,w-y));if(m<=g)return;let v=p.sort((_,A)=>A.
|
|
1271
|
+
bytes-_.bytes||_.path.localeCompare(A.path)).slice(0,5).map(_=>`${_.path} (${_.bytes} bytes)`).join(", ");throw ze([`Vib\
|
|
1259
1272
|
e64 refused this checkpoint because changed, unignored files may need about ${m} temporary bytes; the safe budget is ${g}\
|
|
1260
|
-
bytes.`,
|
|
1273
|
+
bytes.`,v?`Largest candidates: ${v}.`:"","Keep needed files in place and add generated or local-only artifacts to .giti\
|
|
1261
1274
|
gnore, or ask an operator to review the checkpoint disk budget."].filter(Boolean).join(" "),"vibe64_checkpoint_disk_budg\
|
|
1262
|
-
et_exceeded")}function
|
|
1263
|
-
""?t:e,i=Number(o===void 0||o===""?r:o);return Number.isSafeInteger(i)&&i>=n?i:r}async function
|
|
1264
|
-
project:r={},refs:n={},runCommand:o=D}={}){let i=await
|
|
1265
|
-
...
|
|
1266
|
-
le turn identity.","vibe64_checkpoint_identity_mismatch");let a=await
|
|
1267
|
-
if(!await
|
|
1268
|
-
await
|
|
1275
|
+
et_exceeded")}function Hp(e=""){return String(e||"").split("\0").filter(Boolean)}function Fp(e,t,r,n){let o=e==null||e===
|
|
1276
|
+
""?t:e,i=Number(o===void 0||o===""?r:o);return Number.isSafeInteger(i)&&i>=n?i:r}async function jp({commit:e="",identity:t={},
|
|
1277
|
+
project:r={},refs:n={},runCommand:o=D}={}){let i=await K(o,t.worktreePath,["show","-s","--format=%B",e],{project:r}),s=[
|
|
1278
|
+
...Vp].find(l=>i===Jp({...t,outcome:l}).trim());if(!s)throw ze("Existing Vibe64 turn checkpoint does not match its durab\
|
|
1279
|
+
le turn identity.","vibe64_checkpoint_identity_mismatch");let a=await K(o,t.worktreePath,["rev-parse",`${e}^{tree}`],{project:r});
|
|
1280
|
+
if(!await ht(o,t.worktreePath,["rev-parse","--verify",n.latestRef],{project:r})){let l=await Xp(o,t.worktreePath,{project:r});
|
|
1281
|
+
await K(o,t.worktreePath,["update-ref",n.latestRef,e,l],{project:r})}return{baseCommit:await K(o,t.worktreePath,["rev-pa\
|
|
1269
1282
|
rse",`${e}^`],{project:r}),commit:e,created:!1,latestRef:n.latestRef,ok:!0,outerTurnId:t.outerTurnId,outcome:s,sessionId:t.
|
|
1270
|
-
sessionId,tree:a,turnRef:n.turnRef}}function
|
|
1271
|
-
let i=
|
|
1272
|
-
"vibe64_checkpoint_outcome_invalid");let s=
|
|
1273
|
-
eckpoint timestamp must be an ISO date.","vibe64_checkpoint_timestamp_invalid");let a=se.resolve(
|
|
1274
|
-
outerTurnId:
|
|
1275
|
-
function
|
|
1276
|
-
return`refs/vibe64/checkpoints/${
|
|
1277
|
-
function
|
|
1283
|
+
sessionId,tree:a,turnRef:n.turnRef}}function xv({outerTurnId:e="",outcome:t="completed",sessionId:r="",timestamp:n="",worktreePath:o=""}={}){
|
|
1284
|
+
let i=Ue(t,"outcome").toLowerCase();if(!Vp.has(i))throw ze(`Unsupported Vibe64 turn checkpoint outcome: ${i||"(empty)"}.`,
|
|
1285
|
+
"vibe64_checkpoint_outcome_invalid");let s=Ue(n,"timestamp");if(!Number.isFinite(Date.parse(s)))throw ze("Vibe64 turn ch\
|
|
1286
|
+
eckpoint timestamp must be an ISO date.","vibe64_checkpoint_timestamp_invalid");let a=se.resolve(Ue(o,"worktreePath"));return{
|
|
1287
|
+
outerTurnId:Ue(e,"outerTurnId"),outcome:i,sessionId:Ue(r,"sessionId"),timestamp:new Date(s).toISOString(),worktreePath:a}}
|
|
1288
|
+
function ds(e={}){let t=Yp(e.sessionId),r=Kp(e.outerTurnId);return{latestRef:`${t}/latest`,turnRef:`${t}/${r}`}}function Yp(e=""){
|
|
1289
|
+
return`refs/vibe64/checkpoints/${Kp(e)}`}function Kp(e=""){return _v("sha256").update(String(e)).digest("hex").slice(0,32)}
|
|
1290
|
+
function Jp(e={}){return[`vibe64 checkpoint: session ${e.sessionId} turn ${e.outerTurnId}`,"","Vibe64-Checkpoint: true",
|
|
1278
1291
|
`Vibe64-Session: ${e.sessionId}`,`Vibe64-Outer-Turn: ${e.outerTurnId}`,`Vibe64-Turn-Outcome: ${e.outcome}`,""].join(`
|
|
1279
|
-
`)}function
|
|
1280
|
-
e,t,["rev-parse","--show-object-format"],{project:r});return"0".repeat(n==="sha256"?64:40)}async function
|
|
1281
|
-
let o=await
|
|
1282
|
-
r,n);if(o.ok!==!0)throw
|
|
1283
|
-
"vibe64_checkpoint_git_failed");return String(o.stdout||"").trim()}function
|
|
1292
|
+
`)}function kv(e=""){return{GIT_AUTHOR_DATE:e,GIT_COMMITTER_DATE:e}}async function Xp(e,t,{project:r={}}={}){let n=await ht(
|
|
1293
|
+
e,t,["rev-parse","--show-object-format"],{project:r});return"0".repeat(n==="sha256"?64:40)}async function ht(e,t,r,n={}){
|
|
1294
|
+
let o=await Zp(e,t,r,n);return o.ok===!0?String(o.stdout||"").trim():""}async function K(e,t,r,n={}){let o=await Zp(e,t,
|
|
1295
|
+
r,n);if(o.ok!==!0)throw ze(String(o.stderr||o.stdout||o.output||o.error||"Git checkpoint command failed.").trim(),o.code||
|
|
1296
|
+
"vibe64_checkpoint_git_failed");return String(o.stdout||"").trim()}function Zp(e,t,r,{env:n={},input:o,project:i={}}={}){
|
|
1284
1297
|
return e({actor:"daemon",allowedRoots:[t],args:r,command:"git",cwd:t,env:n,envPolicy:"session",gitSafeDirectories:[t],input:o,
|
|
1285
|
-
mode:"capture",project:i,purpose:"source",runtimes:["git"],timeout:
|
|
1286
|
-
trim(),n=Array.from(r).some(o=>{let i=o.codePointAt(0);return i<=31||i===127});if(!r||r.length>512||n)throw
|
|
1298
|
+
mode:"capture",project:i,purpose:"source",runtimes:["git"],timeout:Iv})}function Ue(e="",t="value"){let r=String(e||"").
|
|
1299
|
+
trim(),n=Array.from(r).some(o=>{let i=o.codePointAt(0);return i<=31||i===127});if(!r||r.length>512||n)throw ze(`Vibe64 t\
|
|
1287
1300
|
urn checkpoint ${t} is invalid.`,`vibe64_checkpoint_${t.replaceAll(/[^A-Za-z0-9]+/gu,"_").toLowerCase()}_invalid`);return r}
|
|
1288
|
-
function
|
|
1301
|
+
function ze(e="",t="vibe64_checkpoint_failed"){let r=new Error(e||"Vibe64 turn checkpoint failed.");return r.code=t,r}var Nv=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"]);var $v=64*1024;var Qp="backups.git",ef="vibe64-atomic",Dv=`backup_canonical_ref() {
|
|
1289
1302
|
vibe64_backup_repository="$1"
|
|
1290
1303
|
vibe64_source_repository="$2"
|
|
1291
1304
|
vibe64_source_ref="$3"
|
|
@@ -1303,13 +1316,13 @@ r "$vibe64_backup_repository" rev-parse --verify "$vibe64_backup_ref"
|
|
|
1303
1316
|
' "$vibe64_source_ref" >&2
|
|
1304
1317
|
return 1
|
|
1305
1318
|
fi
|
|
1306
|
-
}`,
|
|
1319
|
+
}`,Lv=`#!/bin/sh
|
|
1307
1320
|
set -eu
|
|
1308
1321
|
|
|
1309
1322
|
zero_object=0000000000000000000000000000000000000000
|
|
1310
1323
|
git_dir="$(git rev-parse --absolute-git-dir)"
|
|
1311
1324
|
repository_root="$(dirname "$git_dir")"
|
|
1312
|
-
backup_repository="$repository_root/${
|
|
1325
|
+
backup_repository="$repository_root/${Qp}"
|
|
1313
1326
|
if [ -L "$repository_root" ] || [ -L "$backup_repository" ] || [ -L "$repository_root/mutation.lock" ]; then
|
|
1314
1327
|
printf '[vibe64] Canonical repository storage must not use symlinked role paths.
|
|
1315
1328
|
' >&2
|
|
@@ -1318,7 +1331,7 @@ fi
|
|
|
1318
1331
|
exec 8>"$repository_root/mutation.lock"
|
|
1319
1332
|
flock -x 8
|
|
1320
1333
|
|
|
1321
|
-
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${
|
|
1334
|
+
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${ef}" ]; then
|
|
1322
1335
|
printf '[vibe64] Canonical repository pushes must use the Vibe64 atomic mutation path.
|
|
1323
1336
|
' >&2
|
|
1324
1337
|
exit 1
|
|
@@ -1329,7 +1342,7 @@ if [ "$(git --git-dir "$backup_repository" rev-parse --is-bare-repository 2>/dev
|
|
|
1329
1342
|
exit 1
|
|
1330
1343
|
fi
|
|
1331
1344
|
|
|
1332
|
-
${
|
|
1345
|
+
${Dv}
|
|
1333
1346
|
|
|
1334
1347
|
updates_file="$(mktemp "$repository_root/.pre-receive.XXXXXX")"
|
|
1335
1348
|
cleanup_updates_file() {
|
|
@@ -1377,7 +1390,7 @@ while read -r old_object _new_object ref_name; do
|
|
|
1377
1390
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
1378
1391
|
fi
|
|
1379
1392
|
done <"$updates_file"
|
|
1380
|
-
`,
|
|
1393
|
+
`,tf=`set -euo pipefail
|
|
1381
1394
|
mirror_path="$1"
|
|
1382
1395
|
remote_url="$2"
|
|
1383
1396
|
|
|
@@ -1465,505 +1478,544 @@ case "$remote_head_ref" in
|
|
|
1465
1478
|
esac
|
|
1466
1479
|
printf '[studio] Refreshed GitHub mirror for %s.
|
|
1467
1480
|
' "$remote_url"
|
|
1468
|
-
`;function
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1481
|
+
`;function ps({mirrorPath:e="",remoteUrl:t=""}={}){return["bash","-c",tf,"vibe64-github-mirror-refresh",e,t]}var zU=new URL("./../../../vibe64-execution/src/server/runtime/agentPreviewBrowserWorkerSource.js",import.meta.url).href;var Bv=["Usage:"," vibe64-helper preview ensure [--target <target-id>] [--wait] [--json] [--timeout-ms <ms>]"," vibe64\
|
|
1482
|
+
-helper preview targets [--json]"," vibe64-helper preview status [--json]"," vibe64-helper preview stop [--json]"," v\
|
|
1483
|
+
ibe64-helper preview inspect-url"," vibe64-helper preview screenshot [--output <path>]"," vibe64-helper preview browse\
|
|
1484
|
+
r ensure"," vibe64-helper preview browser eval < playwright-code.js"," vibe64-helper preview browser identity <default\
|
|
1485
|
+
|guest|configured-name>"," vibe64-helper preview browser storage-state <default|guest|configured-name> --output <new-pa\
|
|
1486
|
+
th>"," vibe64-helper preview browser screenshot [--output <path>]"," vibe64-helper preview browser status"," vibe64-h\
|
|
1487
|
+
elper preview browser reset"," vibe64-helper preview browser close"," vibe64-helper preview identities"," vibe64-help\
|
|
1488
|
+
er preview identities save < identities.json"," vibe64-helper preview logs [--lines <count>] [--json]"," vibe64-helper\
|
|
1489
|
+
preview restart [--wait] [--json] [--timeout-ms <ms>]"," vibe64-helper playwright [--target <target-id>] [--identity <\
|
|
1490
|
+
default|guest|configured-name>] test [playwright test arguments]"," vibe64-helper playwright [--target <target-id>] [--\
|
|
1491
|
+
identity <default|guest|configured-name>] npm-run <package-script> [-- script arguments]","","JSON output:"," status/en\
|
|
1492
|
+
sure/restart/stop --json: ready, stoppedIntent, stale, outputTargetId, endpoints.browser {url, hostname, port}, currentP\
|
|
1493
|
+
age {url, route, title, observedAt}, terminal {id, status, running, exitCode, command, createdAt}, defaultIdentity, iden\
|
|
1494
|
+
tities [{name, type}], identityTypes, diagnostics {latest, log, directApplicationEndpoint}."," screenshot: outputPath, \
|
|
1495
|
+
byteLength, sha256, capturedAt, url, title, width, height, luminance, darkPixelPercentage, domTextLength, domTextSummary\
|
|
1496
|
+
."," browser eval: result (the code's JSON-safe return value), logs [{level, values}] from console, url (the page after\
|
|
1497
|
+
wards)."," identities: the project's Managed app identities [{name, type, value}] (first is the default) and the Stack'\
|
|
1498
|
+
s declared Preview identity types.",' identities save: replaces the whole ordered list with the JSON array on stdin (or\
|
|
1499
|
+
{"identities": [...]}); each type must be declared. Save only names and accounts the person asked for or confirmed; nev\
|
|
1500
|
+
er create app accounts or change roles for this. Then verify each with preview browser identity <name>.'," browser stor\
|
|
1501
|
+
age-state: writes the identity's Playwright storage state to a new file at --output; the interactive browser keeps its i\
|
|
1502
|
+
dentity.","","Screenshot commands emit JSON metadata for a uniquely named, immutable PNG.","For browser navigation, use \
|
|
1503
|
+
preview inspect-url or the status Browser URL; these use the managed Preview proxy.","Inside browser eval, navigate with\
|
|
1504
|
+
await page.goto(new URL('/your-path', preview.url).href).","The direct application endpoint in diagnostics bypasses Pre\
|
|
1505
|
+
view identity; do not use it for interactive browsing.","Managed Playwright suites and live preview browser actions are \
|
|
1506
|
+
sequential. Wait on the suite through cleanup and restoration before browser actions or Preview ensure/restart/target ch\
|
|
1507
|
+
anges; confirm playwright status has no active run and preview status is ready. Read-only status and logs are safe durin\
|
|
1508
|
+
g a suite.","For background commands, wait on the existing execution/session with about a 30-second window where support\
|
|
1509
|
+
ed: set yield_time_ms: 30000 for an empty command poll. Reserve shorter waits for interactive input or a specific immedi\
|
|
1510
|
+
ate check; do not repeatedly reread empty or unchanged logs between brief waits.","This is the canonical preview server \
|
|
1511
|
+
for the configured primary application.","Do not start a duplicate copy of that application on another port.","A distinc\
|
|
1512
|
+
t secondary application explicitly requested by the user, such as a reference app, may run separately without replacing \
|
|
1513
|
+
this preview."].join(`
|
|
1514
|
+
`)+`
|
|
1515
|
+
`;import{fileURLToPath as Fv}from"node:url";var Hv=new URL("./../../../vibe64-execution/src/server/conversationExecution.js",import.meta.url).href,YU=Fv(new URL("./\
|
|
1516
|
+
engines/stdioBridge.js",Hv));var jv=Object.freeze({claude:Object.freeze({name:"Claude Code",provider:"Claude",guideUrl:"https://code.claude.com/docs/\
|
|
1517
|
+
en/setup",install:Object.freeze({unix:"curl -fsSL https://claude.ai/install.sh | bash",win32:"irm https://claude.ai/inst\
|
|
1518
|
+
all.ps1 | iex"})}),codex:Object.freeze({name:"Codex",provider:"ChatGPT",guideUrl:"https://github.com/openai/codex",install:Object.
|
|
1519
|
+
freeze({unix:"curl -fsSL https://chatgpt.com/codex/install.sh | sh",win32:'powershell -ExecutionPolicy ByPass -c "irm ht\
|
|
1520
|
+
tps://chatgpt.com/codex/install.ps1 | iex"'})}),opencode:Object.freeze({name:"opencode",provider:"your API-key providers",
|
|
1521
|
+
guideUrl:"https://opencode.ai/docs/",install:Object.freeze({unix:"curl -fsSL https://opencode.ai/install | bash",win32:"\
|
|
1522
|
+
npm install -g opencode-ai"})})});import{execFile as Vv}from"node:child_process";import{promisify as Wv}from"node:util";var e4=Wv(Vv);import me from"node:crypto";import{mkdtemp as ff,rm as mf}from"node:fs/promises";import H from"node:path";import{fileURLToPath as Kv}from"node:url";function Oe(e){return String(e??"").trim()}function Mn(e){return e&&typeof e=="object"&&!Array.isArray(e)}var J="github",gt="managed_git",j="local_source";var rz=Object.freeze({GITHUB:J,MANAGED_GIT:gt,LOCAL_SOURCE:j});function Kt(e=""){let t=Oe(e).toLowerCase().replace(/[-\s]+/gu,"_");return t===J||t===gt||t===j?t:""}function Yt(e="",t=""){let r=new Error(t);return r.code=e,r}function Jt(e={}){let t=e?.metadata?.connected_contribution;
|
|
1523
|
+
if(t===void 0)return null;let r;try{r=JSON.parse(t)}catch{}if(!Mn(r)||r.schemaVersion!==1||Object.keys(r).some(n=>!["sch\
|
|
1524
|
+
emaVersion","id","repository","integrationBranch","baseCommit","replaces"].includes(n))||!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u.
|
|
1472
1525
|
test(r.id||"")||Object.hasOwn(r,"replaces")&&(typeof r.replaces!="string"||r.replaces===r.id||!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u.
|
|
1473
|
-
test(r.replaces||""))||typeof r.repository!="string"||!/^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+$/u.test(r.repository)||!
|
|
1526
|
+
test(r.replaces||""))||typeof r.repository!="string"||!/^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+$/u.test(r.repository)||!fs(r.integrationBranch)||
|
|
1474
1527
|
r.integrationBranch.startsWith("vibe64-incoming/")||typeof r.baseCommit!="string"||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/iu.
|
|
1475
|
-
test(r.baseCommit))throw
|
|
1528
|
+
test(r.baseCommit))throw Yt("vibe64_contribution_authority_invalid","This contribution's saved source is invalid. Preser\
|
|
1476
1529
|
ve its checkout and inspect its binding before publishing.");return{...r,repository:r.repository.toLowerCase(),baseCommit:r.
|
|
1477
|
-
baseCommit.toLowerCase()}}function
|
|
1478
|
-
parse(t)}catch{}let n=()=>
|
|
1479
|
-
nvalid. Preserve the session and inspect its bindings before saving.");if(!
|
|
1530
|
+
baseCommit.toLowerCase()}}function rf(e={}){let t=e.metadata?.connected_submissions;if(t===void 0)return[];let r;try{r=JSON.
|
|
1531
|
+
parse(t)}catch{}let n=()=>Yt("vibe64_connected_submissions_invalid","This session's connected publication bindings are i\
|
|
1532
|
+
nvalid. Preserve the session and inspect its bindings before saving.");if(!Mn(r)||r.schemaVersion!==1||!Array.isArray(r.
|
|
1480
1533
|
submissions)||Object.keys(r).some(i=>!["schemaVersion","submissions"].includes(i)))throw n();let o=new Set;return r.submissions.
|
|
1481
|
-
map(i=>{if(!
|
|
1482
|
-
tring"||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/iu.test(i.submittedCommit))throw n();let s=
|
|
1534
|
+
map(i=>{if(!Mn(i)||Object.keys(i).some(a=>!["contribution","submittedCommit"].includes(a))||typeof i.submittedCommit!="s\
|
|
1535
|
+
tring"||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/iu.test(i.submittedCommit))throw n();let s=Jt({metadata:{connected_contribution:JSON.
|
|
1483
1536
|
stringify(i.contribution)}});if(!s||o.has(s.id))throw n();return o.add(s.id),{contribution:s,submittedCommit:i.submittedCommit.
|
|
1484
|
-
toLowerCase()}})}function
|
|
1485
|
-
github?.fullName).toLowerCase();if(t.metadata.github_pull_request||t.metadata.repository_branch||
|
|
1486
|
-
repository?.mode)!==
|
|
1537
|
+
toLowerCase()}})}function ms(e={},t={},{sourcePreparation:r=!1}={}){let n=Jt(t);if(n){let c=Oe(e.githubRepository?.fullName||e.repository?.
|
|
1538
|
+
github?.fullName).toLowerCase();if(t.metadata.github_pull_request||t.metadata.repository_branch||Kt(e.repositoryMode||e.
|
|
1539
|
+
repository?.mode)!==J||c!==n.repository||e.repository?.defaultBranch!==n.integrationBranch)throw Yt("vibe64_contribution\
|
|
1487
1540
|
_authority_changed","This contribution's repository or integration branch changed. Review its source binding before publ\
|
|
1488
1541
|
ishing.");return{...e,githubMirrorOptional:!0,repository:{...e.repository,defaultBranch:r?n.replaces&&!t.metadata.renewed_from?
|
|
1489
1542
|
`vibe64-incoming/${n.replaces}_discarded`:n.integrationBranch:`vibe64-incoming/${n.id}`}}}let o=t?.metadata?.github_pull_request;
|
|
1490
|
-
if(!o){let c=t?.metadata?.repository_branch;if(c&&
|
|
1543
|
+
if(!o){let c=t?.metadata?.repository_branch;if(c&&Kt(e.repositoryMode||e.repository?.mode)!==j){if(!fs(c))throw Yt("vibe\
|
|
1491
1544
|
64_session_branch_invalid","This session's repository branch is invalid.");return{...e,repository:{...e.repository,defaultBranch:c}}}
|
|
1492
|
-
return e}let i;try{i=JSON.parse(o)}catch{}let s=
|
|
1493
|
-
i.baseRepository!==s||!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u.test(i.headRepository||"")||!
|
|
1494
|
-
|
|
1545
|
+
return e}let i;try{i=JSON.parse(o)}catch{}let s=Oe(e.githubRepository?.fullName||e.repository?.github?.fullName);if(!i||
|
|
1546
|
+
i.baseRepository!==s||!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u.test(i.headRepository||"")||!fs(i.headBranch)||e.repositoryMode===
|
|
1547
|
+
gt)throw Yt("vibe64_pull_request_authority_invalid","This session's pull request source is invalid. Its Save destination\
|
|
1495
1548
|
could not be verified.");let a={fullName:i.headRepository,cloneUrl:`https://github.com/${i.headRepository}.git`};return{
|
|
1496
|
-
...e,githubMirrorPath:i.headRepository===s?e.githubMirrorPath:"",githubRepository:a,repositoryMode:
|
|
1497
|
-
defaultBranch:i.headBranch,github:a}}}function
|
|
1549
|
+
...e,githubMirrorPath:i.headRepository===s?e.githubMirrorPath:"",githubRepository:a,repositoryMode:J,repository:{mode:J,
|
|
1550
|
+
defaultBranch:i.headBranch,github:a}}}function fs(e){return typeof e=="string"&&e.length>0&&e.length<=255&&!["@","HEAD"].
|
|
1498
1551
|
includes(e)&&!e.startsWith("-")&&!e.endsWith(".")&&!/[\s~^:?*[\\]/u.test(e)&&!e.includes("..")&&!e.includes("@{")&&![...e].
|
|
1499
|
-
some(t=>t.charCodeAt(0)<32||t.charCodeAt(0)===127)&&e.split("/").every(t=>t&&!t.startsWith(".")&&!t.endsWith(".lock"))}function
|
|
1500
|
-
let r=
|
|
1501
|
-
|
|
1502
|
-
i),{sessionId:
|
|
1503
|
-
warn:40,error:50,fatal:60,silent:1/0});function
|
|
1504
|
-
return e==="behind"||e==="diverged"?"rebase":"none"}var
|
|
1505
|
-
e||"").split("\0"),r=[];for(let n=0;n+5<t.length;n+=6){let o=
|
|
1506
|
-
Boolean);r.push({author:
|
|
1507
|
-
t[n+5]),parents:i,shortCommit:o.slice(0,8)})}return r}var
|
|
1508
|
-
ession-work-command-scope"),
|
|
1509
|
-
trim()}function
|
|
1510
|
-
r))}function
|
|
1552
|
+
some(t=>t.charCodeAt(0)<32||t.charCodeAt(0)===127)&&e.split("/").every(t=>t&&!t.startsWith(".")&&!t.endsWith(".lock"))}function nf(e={},t={}){
|
|
1553
|
+
let r=ms(e,t),n=Kt(r.repositoryMode||r.repository?.mode),o=r.slug||r.projectSlug,i=r.repository?.defaultBranch;return n===
|
|
1554
|
+
J?o=r.githubRepository?.fullName||r.repository?.github?.fullName:n===j&&(o=r.sourceRoot,i=t?.metadata?.local_source_branch||
|
|
1555
|
+
i),{sessionId:Oe(t.sessionId||t.id),mode:n,repository:Oe(o),branch:Oe(i)}}var iz=Object.freeze(["fatal","error","warn","info","debug","trace","silent"]),sz=Object.freeze({trace:10,debug:20,info:30,
|
|
1556
|
+
warn:40,error:50,fatal:60,silent:1/0});function of(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=0?t:0}function hs(e=0,t=0){let r=of(e),n=of(t);return r>0&&n>0?"diverged":n>0?"behind":r>0?"ahead":"current"}function gs(e=""){
|
|
1557
|
+
return e==="behind"||e==="diverged"?"rebase":"none"}var sf="%H%x00%P%x00%an%x00%ae%x00%aI%x00%s";function bt(e=""){return String(e||"").trim()}function af(e=""){let t=String(
|
|
1558
|
+
e||"").split("\0"),r=[];for(let n=0;n+5<t.length;n+=6){let o=bt(t[n]);if(!o)continue;let i=bt(t[n+1]).split(/\s+/u).filter(
|
|
1559
|
+
Boolean);r.push({author:bt(t[n+2]),authorEmail:bt(t[n+3]),committedAt:bt(t[n+4]),commit:o,isMerge:i.length>1,message:bt(
|
|
1560
|
+
t[n+5]),parents:i,shortCommit:o.slice(0,8)})}return r}var Yv=new URL("./sessionWorkSave.js",import.meta.url).href,Jv=12e4,cf=200,Xv=500,ws=800,Zv=5e3,bs=5,lf=Symbol("vibe64-s\
|
|
1561
|
+
ession-work-command-scope"),Tz=Kv(new URL("./sessionWorkOperationCommand.js",Yv));function E(e=""){return String(e||"").
|
|
1562
|
+
trim()}function Gn(e=[]){return[...new Set((Array.isArray(e)?e:[]).map(E).filter(Boolean))].sort((t,r)=>t.localeCompare(
|
|
1563
|
+
r))}function Qv(e={}){return e?.metadata&&typeof e.metadata=="object"?e.metadata:{}}function b(e,t="vibe64_session_save_\
|
|
1511
1564
|
failed",r={}){let n=new Error(e||"Vibe64 could not save this session.");return n.code=t,n.details=r&&typeof r=="object"&&
|
|
1512
|
-
!Array.isArray(r)?{...r}:{},Object.assign(n,r),n}function X(e={},t={}){t=
|
|
1513
|
-
mode),o=E(t.repository?.defaultBranch);if(n===j&&r.local_source_branch&&E(r.local_source_branch)!==o)throw
|
|
1565
|
+
!Array.isArray(r)?{...r}:{},Object.assign(n,r),n}function X(e={},t={}){t=ms(t,e);let r=Qv(e),n=Kt(t.repositoryMode||t.repository?.
|
|
1566
|
+
mode),o=E(t.repository?.defaultBranch);if(n===j&&r.local_source_branch&&E(r.local_source_branch)!==o)throw b(`This sessi\
|
|
1514
1567
|
on belongs to ${E(r.local_source_branch)}. Switch the project folder back to that branch before saving or updating it.`,
|
|
1515
1568
|
"vibe64_session_local_branch_changed");let i=E(e.sourcePath||r.source_path),s=E(e.sessionId||e.id),a=E(r.base_commit),c=E(
|
|
1516
|
-
r.canonical_commit)||a,l=n===j?E(t.sourceRoot):"";if(!n||!o||!i||!s||!a||n===j&&!l)throw
|
|
1569
|
+
r.canonical_commit)||a,l=n===j?E(t.sourceRoot):"";if(!n||!o||!i||!s||!a||n===j&&!l)throw b("Session Save requires a comp\
|
|
1517
1570
|
lete repository mode, branch, session source, base commit, and authority.","vibe64_session_save_context_incomplete");let u=n===
|
|
1518
|
-
|
|
1571
|
+
J?E(t.githubRepository?.cloneUrl||t.repository?.github?.cloneUrl):n===gt?E(t.canonicalRepositoryPath):l;if(!u)throw b("S\
|
|
1519
1572
|
ession Save cannot find the canonical repository authority.","vibe64_session_save_authority_missing");return{baseCommit:a,
|
|
1520
|
-
branch:o,contribution:
|
|
1573
|
+
branch:o,contribution:Jt(e),connectedSubmissions:rf(e),lastCanonicalCommit:c,mode:n,githubMirrorPath:E(t.githubMirrorPath),
|
|
1521
1574
|
repositoryFullName:E(t.githubRepository?.fullName||t.repository?.github?.fullName),githubMirrorOptional:!!r.github_pull_request||
|
|
1522
|
-
t.githubMirrorOptional===!0,remoteUrl:u,sessionId:s,standaloneSourceRoot:l,worktreePath:i}}function
|
|
1575
|
+
t.githubMirrorOptional===!0,remoteUrl:u,sessionId:s,standaloneSourceRoot:l,worktreePath:i}}function te(e={},t={}){return{
|
|
1523
1576
|
ownerUserKey:E(t.ownerUserKey||t.githubRepository?.owner),projectRoot:e.worktreePath,repositoryMode:e.mode,sessionId:e.sessionId}}
|
|
1524
|
-
function
|
|
1577
|
+
function Se(e,t={},r={},{label:n="Session repository work",operationId:o=me.randomUUID()}={}){if(e?.[lf])return e;let i=E(
|
|
1525
1578
|
r.slug||r.projectSlug),s=Promise.resolve(),a=(c={})=>{let l=s.then(()=>e({...c,execution:{...c.execution||{},kind:"job",
|
|
1526
1579
|
label:n,lifecycle:"finite",operationId:E(o),ownerId:t.sessionId,projectSlug:i,sessionId:t.sessionId},project:{...c.project||
|
|
1527
1580
|
{},...i?{slug:i}:{}},session:{...c.session||{},sessionId:t.sessionId}}));return s=l.then(()=>{},()=>{}),l};return Object.
|
|
1528
|
-
defineProperty(a,
|
|
1529
|
-
env:a={},input:c,project:l={}}={}){let u=[t.worktreePath,
|
|
1530
|
-
|
|
1531
|
-
d=>{let
|
|
1532
|
-
session",gitSafeDirectories:u,input:c,mode:"capture",project:
|
|
1533
|
-
b":"source",runtimes:i.gitTransport==="github-https"?["git","gh"]:["git"],timeout
|
|
1534
|
-
i?.output||i?.error)||"Git Save command failed.",E(i?.code)||"vibe64_session_save_git_failed",{gitArgs:r});return i}function
|
|
1535
|
-
return E(e.stdout||e.output)}async function
|
|
1536
|
-
e,t,["diff-tree","--no-commit-id","--name-status","-r","-z",r,n],o);return[...
|
|
1537
|
-
localeCompare(a))}async function
|
|
1538
|
-
isSafeInteger(i)&&i>=0?i:0}async function
|
|
1539
|
-
"-z",`--format=${
|
|
1540
|
-
length>
|
|
1541
|
-
metadata?.base_commit}},e);if(r.mode!==
|
|
1542
|
-
receiving GitHub repository's authority.","vibe64_incoming_repository_required");return r}async function
|
|
1543
|
-
session:t={},offset:r=0,limit:n=25,id:o="",state:i="all",includeDiff:s=!1,commandOptions:a={},operationId:c=
|
|
1544
|
-
runCommand:l=D}={}){let u=
|
|
1545
|
-
project:e},
|
|
1546
|
-
r)||r<0||!Number.isSafeInteger(n)||n<1||n>50||s&&!o||!["all","pending","merged","discarded","unresolved"].includes(i))throw
|
|
1547
|
-
"Choose an exact incoming contribution or a valid page.","vibe64_incoming_input_invalid");if(await
|
|
1548
|
-
-is-shallow-repository"],d)!=="false")throw
|
|
1549
|
-
heckout before retrying.","vibe64_incoming_history_incomplete");let
|
|
1550
|
-
"--heads",u.remoteUrl,
|
|
1551
|
-
`).filter(Boolean)){let[A,
|
|
1552
|
-
itory returned invalid ref evidence.","vibe64_incoming_refs_invalid");if(
|
|
1553
|
-
exec(
|
|
1554
|
-
"activeHead"]=A,h.set(x.id,x)}if(!
|
|
1555
|
-
issing");let
|
|
1581
|
+
defineProperty(a,lf,{value:!0}),a}async function hf(e,t,r,n,{additionalAllowedRoots:o=[],commandOptions:i={},cwd:s=t.worktreePath,
|
|
1582
|
+
env:a={},input:c,project:l={}}={}){let u=[t.worktreePath,H.dirname(t.worktreePath),...t.mode===j?[t.standaloneSourceRoot,
|
|
1583
|
+
H.dirname(t.standaloneSourceRoot)]:[],...H.isAbsolute(t.remoteUrl)?[t.remoteUrl,H.dirname(t.remoteUrl)]:[],...o.flatMap(
|
|
1584
|
+
d=>{let p=E(d);return p?[p,H.dirname(p)]:[]})];return e({actor:"daemon",allowedRoots:u,args:n,command:r,cwd:s,env:a,envPolicy:"\
|
|
1585
|
+
session",gitSafeDirectories:u,input:c,mode:"capture",project:te(t,l),purpose:i.gitTransport?.startsWith("github")?"githu\
|
|
1586
|
+
b":"source",runtimes:i.gitTransport==="github-https"?["git","gh"]:["git"],timeout:Jv,...i})}async function P(e,t,r,{required:n=!0,...o}={}){let i=await hf(e,t,"git",r,o);if(n&&i?.ok!==!0)throw b(E(i?.stderr||i?.stdout||
|
|
1587
|
+
i?.output||i?.error)||"Git Save command failed.",E(i?.code)||"vibe64_session_save_git_failed",{gitArgs:r});return i}function Dn(e={}){
|
|
1588
|
+
return E(e.stdout||e.output)}async function R(e,t,r,n={}){return Dn(await P(e,t,r,n))}async function gf(e,t,r,n,o={}){let i=await P(
|
|
1589
|
+
e,t,["diff-tree","--no-commit-id","--name-status","-r","-z",r,n],o);return[...Sf(i.stdout||i.output).keys()].sort((s,a)=>s.
|
|
1590
|
+
localeCompare(a))}async function Ln(e,t,r,n,o={}){let i=Number(await R(e,t,["rev-list","--count",`${r}..${n}`],o));return Number.
|
|
1591
|
+
isSafeInteger(i)&&i>=0?i:0}async function eT(e,t,r,n,o={}){let i=await P(e,t,["log","--topo-order",`--max-count=${bs+1}`,
|
|
1592
|
+
"-z",`--format=${sf}`,`${r}..${n}`],o),s=af(String(i.stdout||i.output||""));return{incomingVersions:s.slice(0,bs),incomingVersionsTruncated:s.
|
|
1593
|
+
length>bs}}function bf(e,t){let r=X({sessionId:t.sessionId,sourcePath:t.sourcePath||t.metadata?.source_path,metadata:{base_commit:t.
|
|
1594
|
+
metadata?.base_commit}},e);if(r.mode!==J||r.branch.startsWith("vibe64-incoming/"))throw b("Incoming changes require the \
|
|
1595
|
+
receiving GitHub repository's authority.","vibe64_incoming_repository_required");return r}async function Bn({project:e={},
|
|
1596
|
+
session:t={},offset:r=0,limit:n=25,id:o="",state:i="all",includeDiff:s=!1,commandOptions:a={},operationId:c=me.randomUUID(),
|
|
1597
|
+
runCommand:l=D}={}){let u=bf(e,t);l=Se(l,u,e,{label:"Reading incoming contributions",operationId:c});let d={commandOptions:a,
|
|
1598
|
+
project:e},p=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;if(o&&!p.test(o)||!Number.isSafeInteger(
|
|
1599
|
+
r)||r<0||!Number.isSafeInteger(n)||n<1||n>50||s&&!o||!["all","pending","merged","discarded","unresolved"].includes(i))throw b(
|
|
1600
|
+
"Choose an exact incoming contribution or a valid page.","vibe64_incoming_input_invalid");if(await R(l,u,["rev-parse","-\
|
|
1601
|
+
-is-shallow-repository"],d)!=="false")throw b("Incoming changes require complete Git history. Prepare a full receiving c\
|
|
1602
|
+
heckout before retrying.","vibe64_incoming_history_incomplete");let f=`refs/heads/${u.branch}`,m=await R(l,u,["ls-remote",
|
|
1603
|
+
"--heads",u.remoteUrl,f,"refs/heads/vibe64-incoming/*"],d),h=new Map,y="";for(let _ of m.split(`
|
|
1604
|
+
`).filter(Boolean)){let[A,I]=_.split(/\s+/u);if(!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(A))throw b("The receiving repos\
|
|
1605
|
+
itory returned invalid ref evidence.","vibe64_incoming_refs_invalid");if(I===f){y=A;continue}let S=/^refs\/heads\/vibe64-incoming\/(.+?)(_discarded)?$/u.
|
|
1606
|
+
exec(I);if(!S||!p.test(S[1]))continue;let x=h.get(S[1])||{id:S[1],activeHead:"",discardedHead:""};x[S[2]?"discardedHead":
|
|
1607
|
+
"activeHead"]=A,h.set(x.id,x)}if(!y)throw b("The receiving integration branch is unavailable.","vibe64_incoming_target_m\
|
|
1608
|
+
issing");let w=[...h.values()].sort((_,A)=>_.id.localeCompare(A.id)),g=o?w.filter(_=>_.id===o):w;if(o&&!g.length)throw b(
|
|
1556
1609
|
"This incoming contribution is no longer present. Refresh the list and inspect its history.","vibe64_incoming_missing");
|
|
1557
|
-
let
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
+${S.remote}:${S.local}`)],d);for(let S of
|
|
1610
|
+
let v=[{remote:f,head:y}];for(let _ of g)_.activeHead&&v.push({remote:`refs/heads/vibe64-incoming/${_.id}`,head:_.activeHead}),
|
|
1611
|
+
_.discardedHead&&v.push({remote:`refs/heads/vibe64-incoming/${_.id}_discarded`,head:_.discardedHead});v.forEach((_,A)=>{
|
|
1612
|
+
_.local=yt(u,c,`incoming-${A}`)});try{await P(l,u,["fetch","--no-tags","--no-write-fetch-head",u.remoteUrl,...v.map(S=>`\
|
|
1613
|
+
+${S.remote}:${S.local}`)],d);for(let S of v)if(await R(l,u,["rev-parse","--verify",`${S.local}^{commit}`],d)!==S.head)throw b(
|
|
1561
1614
|
"Incoming branches changed while being read. Refresh before reviewing them.","vibe64_incoming_review_changed");for(let S of g){
|
|
1562
|
-
let x=S.activeHead||S.discardedHead
|
|
1615
|
+
let x=S.activeHead||S.discardedHead,N=await R(l,u,["rev-list","--count",`${y}..${x}`],d);if(!/^\d+$/u.test(N))throw b("C\
|
|
1563
1616
|
ontribution ancestry could not be established.","vibe64_incoming_history_incomplete");S.status=S.activeHead&&S.discardedHead?
|
|
1564
|
-
"unresolved"
|
|
1565
|
-
r,r+n),
|
|
1566
|
-
l,u,["diff","--name-only","-z",`${
|
|
1567
|
-
l,u,["diff","--no-ext-diff","--no-textconv","--no-color","--unified=3",`${
|
|
1568
|
-
|
|
1569
|
-
repository:u.repositoryFullName,targetBranch:u.branch,targetHead:
|
|
1570
|
-
files:
|
|
1571
|
-
targetBranch:u.branch,targetHead:
|
|
1572
|
-
filter(S=>S.status==="unresolved").length,totalCount:
|
|
1573
|
-
for(let
|
|
1574
|
-
refreshDerivedArtifacts:c,commandOptions:l={},operationId:u=
|
|
1575
|
-
review-repair"].includes(r)||!n)throw
|
|
1576
|
-
lid");let
|
|
1577
|
-
m=await
|
|
1617
|
+
"unresolved":N==="0"?"merged":S.activeHead?"pending":"discarded"}let _=g.filter(S=>o||i==="all"||S.status===i),A=o?_:_.slice(
|
|
1618
|
+
r,r+n),I=[];for(let S of A){let x=S.activeHead||S.discardedHead,N=await R(l,u,["log","-1","--format=%s",x],d),$=await P(
|
|
1619
|
+
l,u,["diff","--name-only","-z",`${y}...${x}`],d),M=String($.stdout||$.output||"").split("\0").filter(Boolean),he;if(s){let k=await P(
|
|
1620
|
+
l,u,["diff","--no-ext-diff","--no-textconv","--no-color","--unified=3",`${y}...${x}`],d),U=String(k.stdout||k.output||"");
|
|
1621
|
+
he={content:U.slice(0,1e5),truncated:U.length>1e5}}I.push({...S,branch:`vibe64-incoming/${S.id}`,head:x,title:N,review:{
|
|
1622
|
+
repository:u.repositoryFullName,targetBranch:u.branch,targetHead:y,id:S.id,activeHead:S.activeHead,discardedHead:S.discardedHead},
|
|
1623
|
+
files:M.slice(0,50),fileCount:M.length,filesTruncated:M.length>50,...he?{diff:he}:{}})}return{ok:!0,repository:u.repositoryFullName,
|
|
1624
|
+
targetBranch:u.branch,targetHead:y,contributions:I,pendingCount:g.filter(S=>S.status==="pending").length,unresolvedCount:g.
|
|
1625
|
+
filter(S=>S.status==="unresolved").length,totalCount:_.length,offset:o?0:r,nextOffset:!o&&r+n<_.length?r+n:null}}finally{
|
|
1626
|
+
for(let _ of v)await _t(l,u,_.local,d)}}async function wf({project:e={},session:t={},action:r="",id:n="",review:o={},repairReview:i=null,identity:s={},derivedArtifactPaths:a=[],
|
|
1627
|
+
refreshDerivedArtifacts:c,commandOptions:l={},operationId:u=me.randomUUID(),runCommand:d=D}={}){if(!["merge","discard","\
|
|
1628
|
+
review-repair"].includes(r)||!n)throw b("Choose Merge or Discard for an exact contribution.","vibe64_incoming_input_inva\
|
|
1629
|
+
lid");let p=bf(e,t);d=Se(d,p,e,{label:"Updating incoming contribution",operationId:u});let f={commandOptions:l,project:e},
|
|
1630
|
+
m=await Bn({project:e,session:t,id:n,commandOptions:l,operationId:u,runCommand:d}),h=m.contributions[0],y={repository:m.
|
|
1578
1631
|
repository,targetBranch:m.targetBranch,targetHead:m.targetHead,id:n,activeHead:h.activeHead,discardedHead:h.discardedHead};
|
|
1579
|
-
if(Object.entries(
|
|
1580
|
-
s before acting.","vibe64_incoming_review_changed");let
|
|
1632
|
+
if(Object.entries(y).some(([$,M])=>o?.[$]!==M))throw b("This contribution or its target changed. Review the current head\
|
|
1633
|
+
s before acting.","vibe64_incoming_review_changed");let w=`refs/heads/${h.branch}`,g=`${w}_discarded`,v=`refs/heads/${p.
|
|
1581
1634
|
branch}`;if(r==="merge"||r==="review-repair"){if(h.status==="merged")return{ok:!0,status:"merged",head:h.head,targetHead:m.
|
|
1582
|
-
targetHead};if(h.status!=="pending")throw
|
|
1583
|
-
"vibe64_incoming_not_pending");let
|
|
1584
|
-
test(
|
|
1585
|
-
ew-repair"))throw
|
|
1586
|
-
oming_review_changed");if(
|
|
1587
|
-
derivedArtifactPaths:a,project:e,sourceCommit:m.targetHead,tree:
|
|
1588
|
-
identity:s,message:"Vibe64 incoming authored source",project:e,tree:
|
|
1589
|
-
commandOptions:l,project:e});if(
|
|
1590
|
-
incoming:${u}`,runCommand:d});if(r==="merge"&&!i)throw
|
|
1635
|
+
targetHead};if(h.status!=="pending")throw b("Only a pending contribution can be merged. Resolve its discard state first.",
|
|
1636
|
+
"vibe64_incoming_not_pending");let $=h.head,M="",he=await R(d,p,["rev-list","--count",`${h.head}..${m.targetHead}`],f);if(!/^\d+$/u.
|
|
1637
|
+
test(he))throw b("Integration ancestry is unavailable.","vibe64_incoming_history_incomplete");if(he==="0"&&(i||r==="revi\
|
|
1638
|
+
ew-repair"))throw b("These heads do not need conflict repair. Refresh and review the contribution normally.","vibe64_inc\
|
|
1639
|
+
oming_review_changed");if(he!=="0"){let Ge=await R(d,p,["rev-parse",`${h.head}^{tree}`],f),Zt=await Ts(d,p,{commandOptions:l,
|
|
1640
|
+
derivedArtifactPaths:a,project:e,sourceCommit:m.targetHead,tree:Ge}),Vn=Zt===Ge?h.head:await jn(d,p,{baseCommit:h.head,commandOptions:l,
|
|
1641
|
+
identity:s,message:"Vibe64 incoming authored source",project:e,tree:Zt}),He=await Pf(d,p,{canonicalCommit:m.targetHead,virtualCommit:Vn,
|
|
1642
|
+
commandOptions:l,project:e});if(He.conflictPaths.length){let Qt=await Is({project:e,session:t,commandOptions:l,operationId:`\
|
|
1643
|
+
incoming:${u}`,runCommand:d});if(r==="merge"&&!i)throw b("This contribution conflicts with the integration branch. Use F\
|
|
1591
1644
|
ix it with AI or repair the listed files in this receiving session, then Review resolved conflicts before merging.","vib\
|
|
1592
|
-
e64_incoming_merge_conflict",{conflictPaths:
|
|
1593
|
-
d,
|
|
1594
|
-
derivedArtifactPaths:a,identity:s,project:e,refreshDerivedArtifacts:c,tree:
|
|
1595
|
-
head:
|
|
1596
|
-
conv","--no-color","--unified=3",m.targetHead,
|
|
1597
|
-
ew",review:
|
|
1598
|
-
keys(
|
|
1599
|
-
again before merging.","vibe64_incoming_repair_changed")}else if(i||r==="review-repair")throw
|
|
1600
|
-
need conflict repair. Refresh and review the contribution normally.","vibe64_incoming_review_changed");let
|
|
1601
|
-
d,
|
|
1602
|
-
mergedTree})
|
|
1603
|
-
st"}`,"commit-tree",
|
|
1604
|
-
`})}let
|
|
1605
|
-
m.targetHead||U.activeHead!==h.activeHead||U.discardedHead)throw
|
|
1606
|
-
d. Review it again.","vibe64_incoming_review_changed");if(
|
|
1607
|
-
"write-tree"],
|
|
1608
|
-
|
|
1609
|
-
"vibe64_incoming_repair_changed")}if(await
|
|
1610
|
-
|
|
1645
|
+
e64_incoming_merge_conflict",{conflictPaths:He.conflictPaths,checkpointCommit:Qt.checkpointCommit,review:y});M=await Of(
|
|
1646
|
+
d,p,{conflictTree:He.conflictTree,conflictPaths:He.conflictPaths,project:e}),M=await zn(d,p,{baseCommit:m.targetHead,commandOptions:l,
|
|
1647
|
+
derivedArtifactPaths:a,identity:s,project:e,refreshDerivedArtifacts:c,tree:M});let Wn={tree:M,worktreeTree:Qt.checkpointTree,
|
|
1648
|
+
head:Qt.oldHead,indexTree:Qt.oldIndexTree};if(r==="review-repair"){let Et=await P(d,p,["diff","--no-ext-diff","--no-text\
|
|
1649
|
+
conv","--no-color","--unified=3",m.targetHead,M],f),Ps=String(Et.stdout||Et.output||"");return{ok:!0,status:"repair-revi\
|
|
1650
|
+
ew",review:y,repairReview:Wn,conflictPaths:He.conflictPaths,diff:{content:Ps.slice(0,1e5),truncated:Ps.length>1e5}}}if(Object.
|
|
1651
|
+
keys(Wn).some(Et=>i?.[Et]!==Wn[Et]))throw b("The receiving source changed after repair review. Review resolved conflicts\
|
|
1652
|
+
again before merging.","vibe64_incoming_repair_changed")}else if(i||r==="review-repair")throw b("These heads no longer \
|
|
1653
|
+
need conflict repair. Refresh and review the contribution normally.","vibe64_incoming_review_changed");let Uf=M||await zn(
|
|
1654
|
+
d,p,{baseCommit:m.targetHead,commandOptions:l,derivedArtifactPaths:a,identity:s,project:e,refreshDerivedArtifacts:c,tree:He.
|
|
1655
|
+
mergedTree});$=await R(d,p,["-c",`user.name=${E(s.name)||"Vibe64 Merge"}`,"-c",`user.email=${E(s.email)||"vibe64@localho\
|
|
1656
|
+
st"}`,"commit-tree",Uf,"-p",m.targetHead,"-p",h.head],{...f,input:`Merge contribution ${n}
|
|
1657
|
+
`})}let k=await Bn({project:e,session:t,id:n,commandOptions:l,operationId:u,runCommand:d}),U=k.contributions[0];if(k.targetHead!==
|
|
1658
|
+
m.targetHead||U.activeHead!==h.activeHead||U.discardedHead)throw b("The contribution changed while its merge was prepare\
|
|
1659
|
+
d. Review it again.","vibe64_incoming_review_changed");if(M){let Ge=await R(d,p,["rev-parse","HEAD"],f),Zt=await R(d,p,[
|
|
1660
|
+
"write-tree"],f),Vn=await ae({worktreePath:p.worktreePath,project:te(p,e),runCommand:d});if(Ge!==i.head||Zt!==i.indexTree||
|
|
1661
|
+
Vn!==i.worktreeTree)throw b("The receiving source changed while the merge was prepared. Review resolved conflicts again.",
|
|
1662
|
+
"vibe64_incoming_repair_changed")}if(await P(d,p,["push",`--force-with-lease=${v}:${m.targetHead}`,p.remoteUrl,`${$}:${v}`],
|
|
1663
|
+
f),(await R(d,p,["ls-remote","--heads",p.remoteUrl,v],f)).split(/\s+/u)[0]!==$)throw b("The merge result is uncertain. R\
|
|
1611
1664
|
efresh Incoming changes before retrying.","vibe64_incoming_verification_failed");return{ok:!0,status:"merged",head:h.head,
|
|
1612
|
-
targetHead
|
|
1613
|
-
ifferent or missing contribution head. Inspect the current branches.","vibe64_incoming_review_changed");let
|
|
1614
|
-
:${g}`,A=`:${
|
|
1615
|
-
|
|
1616
|
-
test(
|
|
1617
|
-
firmed");if(h.discardedHead||await
|
|
1618
|
-
|
|
1619
|
-
ncoming_verification_failed");await
|
|
1620
|
-
|
|
1621
|
-
"vibe64_incoming_discard_unconfirmed");return{ok:!0,status:h.status==="merged"?"merged":"discarded",head:h.head}}async function
|
|
1622
|
-
return
|
|
1623
|
-
rge-base","--is-ancestor",r,n],{...o,required:!1}))?.ok===!0}async function
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
i)
|
|
1637
|
-
|
|
1638
|
-
n],o)
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1665
|
+
targetHead:$}}if(!h.activeHead||h.discardedHead&&h.discardedHead!==h.activeHead)throw b("This discard cannot replace a d\
|
|
1666
|
+
ifferent or missing contribution head. Inspect the current branches.","vibe64_incoming_review_changed");let _=`${h.head}\
|
|
1667
|
+
:${g}`,A=`:${w}`,I=`--force-with-lease=${w}:${h.activeHead}`,S=`--force-with-lease=${g}:${h.discardedHead}`,x=await P(d,
|
|
1668
|
+
p,["push","--atomic",I,S,p.remoteUrl,_,A],{...f,required:!1});if(!x.ok){let $=E(x.stderr||x.output||x.error);if(!/does not support --atomic push/iu.
|
|
1669
|
+
test($))throw b($||"Discard was not confirmed. Refresh Incoming changes before retrying.","vibe64_incoming_discard_uncon\
|
|
1670
|
+
firmed");if(h.discardedHead||await P(d,p,["push",S,p.remoteUrl,_],f),(await R(d,p,["ls-remote","--heads",p.remoteUrl,g],
|
|
1671
|
+
f)).split(/\s+/u)[0]!==h.head)throw b("The discarded branch was not verified; the active branch was retained.","vibe64_i\
|
|
1672
|
+
ncoming_verification_failed");await P(d,p,["push",I,p.remoteUrl,A],f)}if(await R(d,p,["ls-remote","--heads",p.remoteUrl,
|
|
1673
|
+
w,g],f)!==`${h.head} ${g}`)throw b("Discard is not fully confirmed. Refresh Incoming changes to inspect both branches.",
|
|
1674
|
+
"vibe64_incoming_discard_unconfirmed");return{ok:!0,status:h.status==="merged"?"merged":"discarded",head:h.head}}async function ys(e,t,r,n={}){let o=await P(e,t,r,{...n,required:!1});return o?.ok===!0?Dn(o):""}async function wt(e,t,r,n={}){
|
|
1675
|
+
return R(e,t,["rev-parse","--verify",`${r}^{tree}`],n)}async function ce(e,t,r,n,o={}){return r===n?!0:(await P(e,t,["me\
|
|
1676
|
+
rge-base","--is-ancestor",r,n],{...o,required:!1}))?.ok===!0}async function _s(e,t,r,n,o={}){if(await ce(e,t,t.baseCommit,
|
|
1677
|
+
r,o))return!1;let[i,s]=await Promise.all([ce(e,t,r,n,o),ce(e,t,t.baseCommit,n,o)]);return!i||s}async function yf(e,t,r={}){
|
|
1678
|
+
let[n,o,i]=await Promise.all([ys(e,t,["rev-parse","--verify",`${vs(t)}^{commit}`],r),t.lastCanonicalCommit?await ys(e,t,
|
|
1679
|
+
["rev-parse","--verify",`${t.lastCanonicalCommit}^{commit}`],r):"",R(e,t,["rev-parse","--verify",`${t.baseCommit}^{commi\
|
|
1680
|
+
t}`],r)]),s=n||o||i;for(let a of[o,i].filter(Boolean))a!==s&&await ce(e,t,s,a,r)&&(s=a);return s}async function Ss(e,t,{
|
|
1681
|
+
baseCommit:r,canonicalCommit:n,sessionHead:o,worktreeTree:i,reconcileHistory:s=!1},a={}){let[c,l]=await Promise.all([wt(
|
|
1682
|
+
e,t,r,a),wt(e,t,n,a)]);if(i===l)return{baseTree:c,canonicalTree:l,changeBaseCommit:n,changeBaseTree:l,changedPaths:[],sessionMatchesCanonical:!0};
|
|
1683
|
+
let u=s?r:await R(e,t,["merge-base",n,o],a),d=u===n?l:await wt(e,t,u,a),p=i===d?[]:await gf(e,t,u,i,a);return{baseTree:c,
|
|
1684
|
+
canonicalTree:l,changeBaseCommit:u,changeBaseTree:d,changedPaths:p,sessionMatchesCanonical:i===l}}function _f(e,t,r){let n=Number.
|
|
1685
|
+
parseInt(String(e??""),10);return Number.isSafeInteger(n)&&n>0?Math.min(n,r):t}function Sf(e=""){let t=String(e||"").split(
|
|
1686
|
+
"\0"),r=new Map;for(let n=0;n<t.length;){let o=E(t[n++]);if(!o)continue;let i=/^[CR]/u.test(o)?t[n++]:"",s=t[n++];s&&r.set(
|
|
1687
|
+
s,{path:s,...i?{previousPath:i}:{},status:o.slice(0,1)})}return r}function uf(e=""){let t=E(e);if(t==="-")return null;let r=Number.
|
|
1688
|
+
parseInt(t,10);return Number.isSafeInteger(r)&&r>=0?r:0}function tT(e=""){let t=String(e||"").split("\0"),r=new Map;for(let n=0;n<
|
|
1689
|
+
t.length;){let o=t[n++];if(!o)continue;let i=o.indexOf(" "),s=o.indexOf(" ",i+1),a=o.slice(s+1),c=!a;c&&(n+=1);let l=c?t[n++]:
|
|
1690
|
+
a;l&&r.set(l,{added:uf(o.slice(0,i)),deleted:uf(o.slice(i+1,s))})}return r}async function rT(e,t,r,n,o={}){let[i,s]=await Promise.
|
|
1691
|
+
all([P(e,t,["diff-tree","--no-commit-id","-r","-M","--name-status","-z",r,n],o),P(e,t,["diff-tree","--no-commit-id","-r",
|
|
1692
|
+
"-M","--numstat","-z",r,n],o)]),a=Sf(i.stdout||i.output),c=tT(s.stdout||s.output);return[...a.values()].map(l=>({...l,...c.
|
|
1693
|
+
get(l.path)||{added:0,deleted:0}})).sort((l,u)=>l.path.localeCompare(u.path))}function Ef(e=""){let t=String(e||"");if(!t||
|
|
1694
|
+
t.includes("\0")||H.posix.isAbsolute(t)||H.posix.normalize(t)!==t||t===".."||t.startsWith("../"))throw b("Choose a chang\
|
|
1695
|
+
ed project file.","vibe64_session_change_path_invalid");return t}function nT(e){let t=e.replace(/[*?[\]\\]/gu,"\\$&");return[
|
|
1696
|
+
`:(literal)${e}`,`:(glob,exclude)${t}/**`]}async function vf(e,t,r,n,{commandOptions:o={},lineLimit:i=ws,project:s={}}={}){
|
|
1697
|
+
let a=Ef(n);if(!r.changedPaths.includes(a))throw b("That file is not part of the current saved-work difference.","vibe64\
|
|
1698
|
+
_session_change_not_found");let c=await P(e,t,["--no-literal-pathspecs","diff","--no-ext-diff","--find-renames","--unifi\
|
|
1699
|
+
ed=3",r.changeBaseCommit,r.worktreeTree,"--",...nT(a)],{commandOptions:o,project:s}),l=String(c.stdout||c.output||"").replaceAll(
|
|
1700
|
+
`\r
|
|
1646
1701
|
`,`
|
|
1647
1702
|
`).split(`
|
|
1648
|
-
`),u=
|
|
1703
|
+
`),u=_f(i,ws,Zv);return{canonicalCommit:r.canonicalCommit,changeBaseCommit:r.changeBaseCommit,diff:l.slice(0,u).join(`
|
|
1649
1704
|
`),lineLimit:u,ok:!0,path:a,shownLines:Math.min(l.length,u),totalLines:l.length,truncated:l.length>u,worktreeTree:r.worktreeTree}}
|
|
1650
|
-
async function
|
|
1651
|
-
runCommand:s=D,session:a={},worktreeTree:c=""}={}){let l=X(a,i);s=
|
|
1652
|
-
{commandOptions:e,derivedArtifactPaths:t,project:i,runCommand:s,session:a,worktreeTree:c}),d=new Set(u.changedPaths),
|
|
1653
|
-
unsaved?await
|
|
1654
|
-
[],
|
|
1655
|
-
u,h[0].path,{commandOptions:e,project:i}):null;return{...u,files:h,initialDiff:
|
|
1656
|
-
p
|
|
1657
|
-
session:s={}}={}){let a=
|
|
1658
|
-
derivedArtifactPaths:t,project:o,runCommand:i,session:s});return
|
|
1705
|
+
async function Es({commandOptions:e={},derivedArtifactPaths:t=[],includeInitialDiff:r=!0,limit:n=cf,offset:o=0,project:i={},
|
|
1706
|
+
runCommand:s=D,session:a={},worktreeTree:c=""}={}){let l=X(a,i);s=Se(s,l,i,{label:"Inspecting session changes"});let u=await Hn(
|
|
1707
|
+
{commandOptions:e,derivedArtifactPaths:t,project:i,runCommand:s,session:a,worktreeTree:c}),d=new Set(u.changedPaths),p=u.
|
|
1708
|
+
unsaved?await rT(s,l,u.changeBaseCommit,u.worktreeTree,{commandOptions:e,project:i}).then(w=>w.filter(g=>d.has(g.path))):
|
|
1709
|
+
[],f=_f(n,cf,Xv),m=Math.max(0,Number.parseInt(String(o??""),10)||0),h=p.slice(m,m+f),y=r&&m===0&&h.length>0?await vf(s,l,
|
|
1710
|
+
u,h[0].path,{commandOptions:e,project:i}):null;return{...u,files:h,initialDiff:y,limit:f,offset:m,totalCount:p.length,truncated:m+
|
|
1711
|
+
f<p.length}}async function Tf({commandOptions:e={},derivedArtifactPaths:t=[],lineLimit:r=ws,path:n="",project:o={},runCommand:i=D,
|
|
1712
|
+
session:s={}}={}){let a=Ef(n),c=X(s,o);i=Se(i,c,o,{label:"Inspecting a session change"});let l=await Hn({commandOptions:e,
|
|
1713
|
+
derivedArtifactPaths:t,project:o,runCommand:i,session:s});return vf(i,c,l,a,{commandOptions:e,lineLimit:r,project:o})}async function Hn({
|
|
1659
1714
|
commandOptions:e={},derivedArtifactPaths:t=[],inspectContributionPublication:r=!1,knownSubmittedCommit:n="",project:o={},
|
|
1660
|
-
runCommand:i=D,session:s={},worktreeTree:a=""}={}){let c=X(s,o);i=
|
|
1661
|
-
await ae({baseCommit:"HEAD",project:
|
|
1662
|
-
c,{commandOptions:e,project:o}),
|
|
1663
|
-
tus","--porcelain=v1","--untracked-files=all","--ignore-submodules=none","-z"],{commandOptions:e,project:o}),
|
|
1664
|
-
-parse","--show-toplevel"],{commandOptions:e,project:o})]),[m,h,
|
|
1665
|
-
{commandOptions:e,project:o}),
|
|
1715
|
+
runCommand:i=D,session:s={},worktreeTree:a=""}={}){let c=X(s,o);i=Se(i,c,o,{label:"Inspecting session work"});let l=E(a)||
|
|
1716
|
+
await ae({baseCommit:"HEAD",project:te(c,o),runCommand:i,worktreePath:c.worktreePath}),[u,d,p,f]=await Promise.all([yf(i,
|
|
1717
|
+
c,{commandOptions:e,project:o}),R(i,c,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:e,project:o}),R(i,c,["sta\
|
|
1718
|
+
tus","--porcelain=v1","--untracked-files=all","--ignore-submodules=none","-z"],{commandOptions:e,project:o}),R(i,c,["rev\
|
|
1719
|
+
-parse","--show-toplevel"],{commandOptions:e,project:o})]),[m,h,y,w]=await Promise.all([R(i,c,["rev-parse",`${d}^{tree}`],
|
|
1720
|
+
{commandOptions:e,project:o}),Ln(i,c,u,d,{commandOptions:e,project:o}),Ln(i,c,d,u,{commandOptions:e,project:o}),Ss(i,c,{
|
|
1666
1721
|
baseCommit:c.baseCommit,canonicalCommit:u,sessionHead:d,worktreeTree:l},{commandOptions:e,project:o})]),g=new Set((Array.
|
|
1667
|
-
isArray(t)?t:[]).map(E).filter(Boolean)),
|
|
1668
|
-
throw
|
|
1669
|
-
c,{commandOptions:e,project:o},!0),!
|
|
1670
|
-
evidence is invalid.","vibe64_connected_integration_unknown");
|
|
1671
|
-
let S=`refs/heads/${c.contribution.integrationBranch}`,x=await
|
|
1672
|
-
project:o}),[
|
|
1673
|
-
project:o}))throw
|
|
1722
|
+
isArray(t)?t:[]).map(E).filter(Boolean)),v=w.changedPaths.filter(S=>!g.has(S)),_=hs(h,y),A=p.length===0,I;if(r){if(!c.contribution)
|
|
1723
|
+
throw b("Publication inspection requires a bound contribution.","vibe64_contribution_authority_changed");if(I=await Un(i,
|
|
1724
|
+
c,{commandOptions:e,project:o},!0),!I&&n){if(!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(n))throw b("The saved contribution\
|
|
1725
|
+
evidence is invalid.","vibe64_connected_integration_unknown");I=n}if(c.contributionDiscarded||I&&c.contributionRemoteAbsent){
|
|
1726
|
+
let S=`refs/heads/${c.contribution.integrationBranch}`,x=await R(i,c,["ls-remote","--heads",c.remoteUrl,S],{commandOptions:e,
|
|
1727
|
+
project:o}),[N,$,M]=x.split(/\s+/u);if($!==S||M||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(N)||!await ce(i,c,I,N,{commandOptions:e,
|
|
1728
|
+
project:o}))throw b("The removed contribution has not been proved integrated in this source. Check its receiving target \
|
|
1674
1729
|
and explicitly Update the connected session.",c.contributionDiscarded?"vibe64_contribution_discarded":"vibe64_contributi\
|
|
1675
|
-
on_branch_missing")}if(!
|
|
1730
|
+
on_branch_missing")}if(!I&&c.baseCommit!==c.contribution.baseCommit)throw b("The published contribution branch is missin\
|
|
1676
1731
|
g and no exact submitted revision is retained. Preserve the source and inspect its Save recovery evidence.","vibe64_cont\
|
|
1677
|
-
ribution_branch_missing");if(
|
|
1732
|
+
ribution_branch_missing");if(I&&!await ce(i,c,I,d,{commandOptions:e,project:o}))throw b("The contribution branch contain\
|
|
1678
1733
|
s work this source has not incorporated. Update its receiving session before saving the main project.","vibe64_connected\
|
|
1679
1734
|
_source_update_required",{repository:c.contribution.repository,sessionId:c.sessionId})}return{ahead:h,baseCommit:c.baseCommit,
|
|
1680
|
-
behind:
|
|
1681
|
-
changeBaseTree,changedPaths:
|
|
1682
|
-
mode,relationship:
|
|
1683
|
-
updateStrategy:
|
|
1684
|
-
ave/${
|
|
1685
|
-
e,t,"prepared")}function
|
|
1686
|
-
E(r)&&await
|
|
1687
|
-
e,t,["update-ref",i,n],o),i}async function Xt(e,t,r,n={}){let o=await
|
|
1688
|
-
return await
|
|
1689
|
-
remoteUrl],n),t.contribution&&(t.contributionPublishedCommit=await
|
|
1690
|
-
t.contributionRemoteAbsent)){let s=await
|
|
1735
|
+
behind:y,branch:c.branch,canonicalCommit:u,canonicalTree:w.canonicalTree,changeBaseCommit:w.changeBaseCommit,changeBaseTree:w.
|
|
1736
|
+
changeBaseTree,changedPaths:v,destination:nf(o,s),dirty:l!==m||!A,mode:c.mode,ok:!0,...r?{publishedCommit:I}:{},repositoryMode:c.
|
|
1737
|
+
mode,relationship:_,sessionMatchesCanonical:v.length===0,sessionHead:d,sessionId:c.sessionId,tree:l,updateAvailable:y>0,
|
|
1738
|
+
updateStrategy:gs(_),unsaved:v.length>0,worktreeClean:A,worktreeTree:l,worktreeTopLevel:f,worktreePath:c.worktreePath}}async function Fn(e,t,r){await P(e,t,["check-ref-format","--branch",t.branch],r)}function yt(e,t,r){return`refs/vibe64/s\
|
|
1739
|
+
ave/${me.createHash("sha256").update(`${e.sessionId}\0${t}`).digest("hex").slice(0,32)}/${r}`}function Af(e,t){return yt(
|
|
1740
|
+
e,t,"prepared")}function vs(e){return`refs/vibe64/canonical/${me.createHash("sha256").update(e.branch).digest("hex").slice(0,32)}`}async function _t(e,t,r,n={}){
|
|
1741
|
+
E(r)&&await P(e,t,["update-ref","-d",r],{...n,required:!1})}async function oT(e,t,r,n,o={}){let i=Af(t,r);return await P(
|
|
1742
|
+
e,t,["update-ref",i,n],o),i}async function Xt(e,t,r,n={}){let o=await R(e,t,["rev-parse","--verify",`${r}^{commit}`],n);
|
|
1743
|
+
return await P(e,t,["update-ref",vs(t),o],n),o}async function iT(e,t,r,n){if(await P(e,t,["remote","set-url","origin",t.
|
|
1744
|
+
remoteUrl],n),t.contribution&&(t.contributionPublishedCommit=await Un(e,t,n,!0),t.contributionRemoteAbsent=!t.contributionPublishedCommit,
|
|
1745
|
+
t.contributionRemoteAbsent)){let s=await ys(e,t,["rev-parse","--verify",`${vs(t)}^{commit}`],n);if((await R(e,t,["for-ea\
|
|
1691
1746
|
ch-ref","--format=%(refname)","refs/vibe64/save/"],n)).split(`
|
|
1692
|
-
`).some(c=>c.endsWith("/prepared")))throw
|
|
1747
|
+
`).some(c=>c.endsWith("/prepared")))throw b("This contribution branch is missing after a publication attempt. Inspect it\
|
|
1693
1748
|
s saved work and integration history before resubmitting it.","vibe64_contribution_branch_missing");if(t.lastCanonicalCommit===
|
|
1694
1749
|
t.contribution.baseCommit&&(!s||s===t.contribution.baseCommit))return t.canonicalBranch=t.contribution.replaces?`vibe64-\
|
|
1695
1750
|
incoming/${t.contribution.replaces}_discarded`:t.contribution.integrationBranch,t.contribution.baseCommit;t.contributionMissingPublished=
|
|
1696
|
-
!0}let o=
|
|
1751
|
+
!0}let o=yt(t,r,"canonical"),i=t.contribution?yt(t,r,"integration"):"";try{await P(e,t,["fetch","--no-tags","origin",`+r\
|
|
1697
1752
|
efs/heads/${t.contributionMissingPublished?t.contribution.integrationBranch:t.contributionDiscarded?`${t.branch}_discard\
|
|
1698
|
-
ed`:t.branch}:${o}`,...i?[`+refs/heads/${t.contribution.integrationBranch}:${i}`]:[]],n);let s=await
|
|
1699
|
-
"--verify",o],n);if(i){if(!t.contributionMissingPublished&&s!==t.contributionPublishedCommit)throw
|
|
1700
|
-
ranch changed during its authority check. Retry Update or Save.","vibe64_session_save_update_required");let a=await
|
|
1701
|
-
t,["rev-parse","--verify",i],n),c=await
|
|
1702
|
-
t.contributionMissingPublished)&&(!c||t.baseCommit===t.contribution.baseCommit&&t.contributionMissingPublished))throw
|
|
1753
|
+
ed`:t.branch}:${o}`,...i?[`+refs/heads/${t.contribution.integrationBranch}:${i}`]:[]],n);let s=await R(e,t,["rev-parse",
|
|
1754
|
+
"--verify",o],n);if(i){if(!t.contributionMissingPublished&&s!==t.contributionPublishedCommit)throw b("The contribution b\
|
|
1755
|
+
ranch changed during its authority check. Retry Update or Save.","vibe64_session_save_update_required");let a=await R(e,
|
|
1756
|
+
t,["rev-parse","--verify",i],n),c=await ce(e,t,t.contributionMissingPublished?t.baseCommit:s,a,n);if((t.contributionDiscarded||
|
|
1757
|
+
t.contributionMissingPublished)&&(!c||t.baseCommit===t.contribution.baseCommit&&t.contributionMissingPublished))throw b(
|
|
1703
1758
|
"This removed contribution has not been integrated. Preserve its source and inspect its saved work.",t.contributionDiscarded?
|
|
1704
1759
|
"vibe64_contribution_discarded":"vibe64_contribution_branch_missing");c&&(s=a,t.canonicalBranch=t.contribution.integrationBranch)}
|
|
1705
|
-
return Xt(e,t,s,n)}finally{await
|
|
1706
|
-
i=`${o}_discarded`,s=await
|
|
1707
|
-
`).filter(Boolean).map(c=>{let[l,u]=c.split(/\s+/u);if(![o,i].includes(u)||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(l))throw
|
|
1760
|
+
return Xt(e,t,s,n)}finally{await _t(e,t,o,n),await _t(e,t,i,n)}}async function Un(e,t,r,n=!1){let o=`refs/heads/${t.branch}`,
|
|
1761
|
+
i=`${o}_discarded`,s=await R(e,t,["ls-remote","--heads",t.remoteUrl,o,i],r),a=new Map(s.split(`
|
|
1762
|
+
`).filter(Boolean).map(c=>{let[l,u]=c.split(/\s+/u);if(![o,i].includes(u)||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(l))throw b(
|
|
1708
1763
|
"The contribution's remote branches could not be verified.","vibe64_contribution_refs_invalid");return[u,l]}));if(t.contributionDiscarded=
|
|
1709
|
-
a.has(i)&&!a.has(o),t.contributionRemoteAbsent=!a.has(o)&&!a.has(i),a.has(i)&&(!n||a.has(o)))throw
|
|
1764
|
+
a.has(i)&&!a.has(o),t.contributionRemoteAbsent=!a.has(o)&&!a.has(i),a.has(i)&&(!n||a.has(o)))throw b(a.has(o)?"Both cont\
|
|
1710
1765
|
ribution branches exist after an interrupted discard. Resolve that operation before publishing.":"This contribution was \
|
|
1711
1766
|
discarded. Preserve its source and submit further work as a new contribution.",a.has(o)?"vibe64_contribution_discard_inc\
|
|
1712
|
-
omplete":"vibe64_contribution_discarded");return a.get(o)||(n?a.get(i):"")||""}async function
|
|
1713
|
-
"branch","--show-current"],{...r,cwd:t.standaloneSourceRoot})!==t.branch)throw
|
|
1714
|
-
checked out before Save.`,"vibe64_session_save_local_branch_mismatch");if(await
|
|
1715
|
-
ked-files=all"],{...r,cwd:t.standaloneSourceRoot}))throw
|
|
1767
|
+
omplete":"vibe64_contribution_discarded");return a.get(o)||(n?a.get(i):"")||""}async function If(e,t,r){if(await R(e,t,[
|
|
1768
|
+
"branch","--show-current"],{...r,cwd:t.standaloneSourceRoot})!==t.branch)throw b(`The project baseline must have ${t.branch}\
|
|
1769
|
+
checked out before Save.`,"vibe64_session_save_local_branch_mismatch");if(await R(e,t,["status","--porcelain","--untrac\
|
|
1770
|
+
ked-files=all"],{...r,cwd:t.standaloneSourceRoot}))throw b("The local project baseline has unsaved work. Save cannot ove\
|
|
1716
1771
|
rwrite it.","vibe64_session_save_local_authority_dirty");for(let i of["MERGE_HEAD","CHERRY_PICK_HEAD","REVERT_HEAD","REB\
|
|
1717
|
-
ASE_HEAD"])if((await
|
|
1718
|
-
"The local project baseline has an unfinished Git operation.","vibe64_session_save_local_operation_in_progress");return
|
|
1719
|
-
e,t,["rev-parse","--verify","HEAD"],{...r,cwd:t.standaloneSourceRoot})}async function
|
|
1720
|
-
e,t,r,n);let o=await
|
|
1721
|
-
heads/${t.branch}:${i}`],n);let s=await
|
|
1722
|
-
changed while Vibe64 was reading it.","vibe64_session_save_authority_advanced");return Xt(e,t,s,n)}finally{await
|
|
1723
|
-
i,n)}}async function
|
|
1724
|
-
explicitBase:l=!1}){let u=c||await
|
|
1725
|
-
project:a,tree:o}),d=await
|
|
1726
|
-
-z",n,u],{commandOptions:i,project:a,required:!1}),
|
|
1727
|
-
test(
|
|
1728
|
-
or review.","vibe64_session_update_merge_invalid");if(d?.ok!==!0){let m=[];for(;
|
|
1729
|
-
m.push(h)}if(!m.length)throw
|
|
1730
|
-
ession_update_merge_invalid");return{conflictPaths:[...new Set(m)].sort((h,
|
|
1731
|
-
virtualCommit:u}}return{conflictPaths:[],conflictTree:"",mergedTree:
|
|
1772
|
+
ASE_HEAD"])if((await P(e,t,["rev-parse","--verify","-q",i],{...r,cwd:t.standaloneSourceRoot,required:!1}))?.ok===!0)throw b(
|
|
1773
|
+
"The local project baseline has an unfinished Git operation.","vibe64_session_save_local_operation_in_progress");return R(
|
|
1774
|
+
e,t,["rev-parse","--verify","HEAD"],{...r,cwd:t.standaloneSourceRoot})}async function Rf(e,t,r,n){if(t.mode!==j)return iT(
|
|
1775
|
+
e,t,r,n);let o=await If(e,t,n),i=yt(t,r,"canonical");try{await P(e,t,["fetch","--no-tags",t.standaloneSourceRoot,`+refs/\
|
|
1776
|
+
heads/${t.branch}:${i}`],n);let s=await R(e,t,["rev-parse","--verify",i],n);if(s!==o)throw b("The local project baseline\
|
|
1777
|
+
changed while Vibe64 was reading it.","vibe64_session_save_authority_advanced");return Xt(e,t,s,n)}finally{await _t(e,t,
|
|
1778
|
+
i,n)}}async function Pf(e,t,{baseCommit:r,canonicalCommit:n,checkpointTree:o,commandOptions:i,identity:s,project:a,virtualCommit:c="",
|
|
1779
|
+
explicitBase:l=!1}){let u=c||await jn(e,t,{baseCommit:r,commandOptions:i,identity:s,message:"Vibe64 session rebase input",
|
|
1780
|
+
project:a,tree:o}),d=await P(e,t,["merge-tree","--write-tree",...l?[`--merge-base=${r}`]:[],"--messages","--name-only","\
|
|
1781
|
+
-z",n,u],{commandOptions:i,project:a,required:!1}),p=String(d?.stdout||d?.output||"").split("\0"),f=E(p.shift());if(!/^[0-9a-f]{40,64}$/u.
|
|
1782
|
+
test(f))throw b(d?.ok===!0?"Git did not produce a valid rebased tree.":"Vibe64 could not prepare the conflicting files f\
|
|
1783
|
+
or review.","vibe64_session_update_merge_invalid");if(d?.ok!==!0){let m=[];for(;p.length>0;){let h=p.shift();if(!h)break;
|
|
1784
|
+
m.push(h)}if(!m.length)throw b("Vibe64 could not identify which files conflict with the latest saved version.","vibe64_s\
|
|
1785
|
+
ession_update_merge_invalid");return{conflictPaths:[...new Set(m)].sort((h,y)=>h.localeCompare(y)),conflictTree:f,mergedTree:"",
|
|
1786
|
+
virtualCommit:u}}return{conflictPaths:[],conflictTree:"",mergedTree:f,virtualCommit:u}}function sT(e={}){if(!e||typeof e!=
|
|
1732
1787
|
"object"||Array.isArray(e))return null;let t=Array.isArray(e.conflictPaths)?[...new Set(e.conflictPaths.map(String).filter(
|
|
1733
1788
|
Boolean))].sort((n,o)=>n.localeCompare(o)):[],r={baseCommit:E(e.baseCommit),canonicalCommit:E(e.canonicalCommit),checkpointTree:E(
|
|
1734
1789
|
e.checkpointTree),conflictPaths:t,conflictTree:E(e.conflictTree),reviewId:E(e.reviewId),oldHead:E(e.oldHead),oldIndexTree:E(
|
|
1735
|
-
e.oldIndexTree)};return Object.values(r).some(n=>Array.isArray(n)?n.length===0:!n)?null:r}function
|
|
1790
|
+
e.oldIndexTree)};return Object.values(r).some(n=>Array.isArray(n)?n.length===0:!n)?null:r}function aT(e=[]){let t=e.length,
|
|
1736
1791
|
r=e.slice(0,3).join(", "),n=t>3?` and ${t-3} more`:"";return`${t} ${t===1?"file needs":"files need"} review before this \
|
|
1737
1792
|
session can update: ${r}${n}. Resolve ${t===1?"it":"them"} manually or with AI, then use Review resolved conflicts to ap\
|
|
1738
|
-
ply Update. Fix it with AI can help with the repair.`}function
|
|
1739
|
-
_conflict",{conflictPaths:e.conflictPaths,conflictRecovery:e})}async function
|
|
1740
|
-
reviewedConflictId:o,project:i}){let s=o?
|
|
1741
|
-
"canonicalCommit","oldHead","oldIndexTree"].every(l=>s[l]===r[l])&&r.conflictPaths.every(l=>a.has(l)))||o!==s.reviewId)throw
|
|
1742
|
-
r);return
|
|
1743
|
-
project:
|
|
1744
|
-
message:i,project:s,tree:a}){return
|
|
1793
|
+
ply Update. Fix it with AI can help with the repair.`}function df(e){return b(aT(e.conflictPaths),"vibe64_session_update\
|
|
1794
|
+
_conflict",{conflictPaths:e.conflictPaths,conflictRecovery:e})}async function cT(e,t,{currentRecovery:r,previousRecovery:n,
|
|
1795
|
+
reviewedConflictId:o,project:i}){let s=o?sT(n):null;if(!s)throw df(r);let a=new Set(s.conflictPaths);if(!(["baseCommit",
|
|
1796
|
+
"canonicalCommit","oldHead","oldIndexTree"].every(l=>s[l]===r[l])&&r.conflictPaths.every(l=>a.has(l)))||o!==s.reviewId)throw df(
|
|
1797
|
+
r);return Of(e,t,{...r,project:i})}function Of(e,t,{conflictTree:r,conflictPaths:n,project:o}){return ae({baseCommit:r,paths:n,
|
|
1798
|
+
project:te(t,o),runCommand:e,worktreePath:t.worktreePath})}async function jn(e,t,{baseCommit:r,commandOptions:n,identity:o,
|
|
1799
|
+
message:i,project:s,tree:a}){return R(e,t,["-c",`user.name=${o.name}`,"-c",`user.email=${o.email}`,"commit-tree",a,"-p",
|
|
1745
1800
|
r],{commandOptions:n,input:`${E(i)||"Vibe64 virtual commit"}
|
|
1746
|
-
`,project:s})}async function
|
|
1747
|
-
n);if(!a.length)return s;let c=await
|
|
1748
|
-
join(c,"index")},d={additionalAllowedRoots:[c],commandOptions:r,env:u,project:o};try{await
|
|
1749
|
-
let
|
|
1750
|
-
exec(String(
|
|
1751
|
-
pdate-index","--force-remove","--",
|
|
1752
|
-
recursive:!0})}}async function
|
|
1753
|
-
tree:c}){if(!
|
|
1754
|
-
wning tool is unavailable.","vibe64_session_derived_artifact_refresh_unavailable");let u=await
|
|
1755
|
-
identity:i,message:"Vibe64 derived artifact input",project:s,tree:c}),d=await
|
|
1756
|
-
64-derived-worktree-")),
|
|
1757
|
-
e,t,["worktree","add","--detach",
|
|
1758
|
-
worktreePath:
|
|
1759
|
-
await
|
|
1760
|
-
identity:o,mergedTree:i,message:s,project:a}){let c=E(s);if(!c)throw
|
|
1761
|
-
ect.","vibe64_session_save_message_required");return
|
|
1801
|
+
`,project:s})}async function Ts(e,t,{commandOptions:r,derivedArtifactPaths:n=[],project:o,sourceCommit:i,tree:s}){let a=Gn(
|
|
1802
|
+
n);if(!a.length)return s;let c=await ff(H.join(H.dirname(t.worktreePath),".vibe64-derived-index-")),u={GIT_INDEX_FILE:H.
|
|
1803
|
+
join(c,"index")},d={additionalAllowedRoots:[c],commandOptions:r,env:u,project:o};try{await P(e,t,["read-tree",s],d);for(let p of a){
|
|
1804
|
+
let f=await P(e,t,["ls-tree","-z",i,"--",p],{commandOptions:r,project:o}),m=/^(\d+)\s+\S+\s+([0-9a-f]{40,64})\t([^\0]+)\0$/u.
|
|
1805
|
+
exec(String(f.stdout||""));m&&m[3]===p?await P(e,t,["update-index","--add","--cacheinfo",m[1],m[2],p],d):await P(e,t,["u\
|
|
1806
|
+
pdate-index","--force-remove","--",p],{...d,required:!1})}return await R(e,t,["write-tree"],d)}finally{await mf(c,{force:!0,
|
|
1807
|
+
recursive:!0})}}async function zn(e,t,{baseCommit:r,commandOptions:n,derivedArtifactPaths:o=[],identity:i,project:s,refreshDerivedArtifacts:a,
|
|
1808
|
+
tree:c}){if(!Gn(o).length)return c;if(typeof a!="function")throw b("The project declares generated artifacts but their o\
|
|
1809
|
+
wning tool is unavailable.","vibe64_session_derived_artifact_refresh_unavailable");let u=await jn(e,t,{baseCommit:r,commandOptions:n,
|
|
1810
|
+
identity:i,message:"Vibe64 derived artifact input",project:s,tree:c}),d=await ff(H.join(H.dirname(t.worktreePath),".vibe\
|
|
1811
|
+
64-derived-worktree-")),p=H.join(d,"source"),f={additionalAllowedRoots:[d,p],commandOptions:n,project:s},m=!1;try{return await P(
|
|
1812
|
+
e,t,["worktree","add","--detach",p,u],f),m=!0,await a({projectRoot:p}),await ae({baseCommit:"HEAD",project:te(t,s),runCommand:e,
|
|
1813
|
+
worktreePath:p})}finally{m&&await P(e,t,["worktree","remove","--force",p],{...f,required:!1}),await mf(d,{force:!0,recursive:!0}),
|
|
1814
|
+
await P(e,t,["worktree","prune"],{commandOptions:n,project:s,required:!1})}}async function lT(e,t,{canonicalCommit:r,commandOptions:n,
|
|
1815
|
+
identity:o,mergedTree:i,message:s,project:a}){let c=E(s);if(!c)throw b("Save requires an assistant-generated commit subj\
|
|
1816
|
+
ect.","vibe64_session_save_message_required");return R(e,t,["-c",`user.name=${o.name}`,"-c",`user.email=${o.email}`,"com\
|
|
1762
1817
|
mit-tree",i,"-p",r],{commandOptions:n,input:`${c}
|
|
1763
|
-
`,project:a})}async function
|
|
1764
|
-
itory"],r)!=="false")throw
|
|
1818
|
+
`,project:a})}async function As(e,t,r){if(t.connectedSubmissions.length){if(await R(e,t,["rev-parse","--is-shallow-repos\
|
|
1819
|
+
itory"],r)!=="false")throw b("Connected integration requires complete Git history. Prepare a full checkout before saving\
|
|
1765
1820
|
.","vibe64_connected_integration_unknown");for(let{contribution:n,submittedCommit:o}of t.connectedSubmissions){let{repository:i,
|
|
1766
1821
|
integrationBranch:s,id:a}=n,c=`https://github.com/${i}.git`,l=`refs/heads/${s}`,u=`refs/heads/vibe64-incoming/${a}`,d=`${u}\
|
|
1767
|
-
_discarded`,
|
|
1822
|
+
_discarded`,p={repository:i,integrationBranch:s,id:a,submittedCommit:o},f=[];try{let m=await R(e,t,["ls-remote","--heads",
|
|
1768
1823
|
c,l,u,d],r),h=new Map;for(let g of m.split(`
|
|
1769
|
-
`).filter(Boolean)){let[
|
|
1770
|
-
|
|
1771
|
-
egration branch is unavailable.");if(h.has(u)&&h.has(d))throw
|
|
1772
|
-
changes before saving this project.`,"vibe64_connected_integration_unresolved",
|
|
1773
|
-
local:
|
|
1774
|
-
map(g=>`+${g.remote}:${g.local}`)],r),await
|
|
1775
|
-
iving history is incomplete.");for(let g of
|
|
1776
|
-
throw
|
|
1777
|
-
nt",`${h.get(l)}..${o}`],r);if(!/^\d+$/u.test(
|
|
1778
|
-
has(d);throw
|
|
1779
|
-
to ${s} before saving this project.`,g?"vibe64_connected_integration_discarded":"vibe64_connected_integration_pending",
|
|
1780
|
-
let
|
|
1781
|
-
!await
|
|
1782
|
-
source before saving this project.`,"vibe64_connected_integration_source_update_required",
|
|
1783
|
-
"vibe64_connected_integration_")?m:
|
|
1784
|
-
ete history, then retry Save.`,"vibe64_connected_integration_unknown",
|
|
1785
|
-
function
|
|
1786
|
-
available");return e.map(t=>{let r=
|
|
1787
|
-
sessionId!="string"||!E(t.sessionId)||!
|
|
1788
|
-
worktreeTree].some(n=>!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(E(n))))throw
|
|
1824
|
+
`).filter(Boolean)){let[v,_]=g.split(/\s+/u);if(![l,u,d].includes(_)||h.has(_)||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(
|
|
1825
|
+
v))throw b("The receiving repository returned invalid ref evidence.");h.set(_,v)}if(!h.has(l))throw b("The receiving int\
|
|
1826
|
+
egration branch is unavailable.");if(h.has(u)&&h.has(d))throw b(`${i} has an interrupted discard. Resolve it in Incoming\
|
|
1827
|
+
changes before saving this project.`,"vibe64_connected_integration_unresolved",p);for(let[g,v]of h)f.push({remote:g,head:v,
|
|
1828
|
+
local:yt(t,me.randomUUID(),"connected-integration")});if(await P(e,t,["fetch","--no-tags","--no-write-fetch-head",c,...f.
|
|
1829
|
+
map(g=>`+${g.remote}:${g.local}`)],r),await R(e,t,["rev-parse","--is-shallow-repository"],r)!=="false")throw b("The rece\
|
|
1830
|
+
iving history is incomplete.");for(let g of f)if(await R(e,t,["rev-parse","--verify",`${g.local}^{commit}`],r)!==g.head)
|
|
1831
|
+
throw b("The receiving branches changed during the integration check. Retry Save.");let y=await R(e,t,["rev-list","--cou\
|
|
1832
|
+
nt",`${h.get(l)}..${o}`],r);if(!/^\d+$/u.test(y))throw b("The required revision's ancestry is unknown.");if(y!=="0"){let g=h.
|
|
1833
|
+
has(d);throw b(`${i} has ${g?"discarded":"not merged"} contribution ${a} at ${o.slice(0,12)}. Integrate that revision in\
|
|
1834
|
+
to ${s} before saving this project.`,g?"vibe64_connected_integration_discarded":"vibe64_connected_integration_pending",p)}
|
|
1835
|
+
let w=(r.connectedWorkSnapshots||[]).find(g=>g.contribution.repository===i&&g.contribution.integrationBranch===s);if(!w||
|
|
1836
|
+
!await ce(e,t,h.get(l),w.sessionHead,r))throw b(`Update the connected session for ${i} to incorporate its accepted ${s} \
|
|
1837
|
+
source before saving this project.`,"vibe64_connected_integration_source_update_required",p)}catch(m){throw m.code?.startsWith(
|
|
1838
|
+
"vibe64_connected_integration_")?m:b(`Could not verify contribution ${a} in ${i}/${s}. Check repository access and compl\
|
|
1839
|
+
ete history, then retry Save.`,"vibe64_connected_integration_unknown",p)}finally{for(let m of f)await _t(e,t,m.local,r)}}}}
|
|
1840
|
+
function Cf(e=[]){if(!Array.isArray(e))throw b("Connected source snapshots are unavailable.","vibe64_connected_source_un\
|
|
1841
|
+
available");return e.map(t=>{let r=Jt({metadata:{connected_contribution:JSON.stringify(t?.contribution)}});if(!r||typeof t.
|
|
1842
|
+
sessionId!="string"||!E(t.sessionId)||!H.isAbsolute(E(t.worktreePath))||[t.baseCommit,t.canonicalCommit,t.sessionHead,t.
|
|
1843
|
+
worktreeTree].some(n=>!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(E(n))))throw b("The connected source could not be capture\
|
|
1789
1844
|
d. Inspect connected work before saving.","vibe64_connected_source_unavailable");return{contribution:r,sessionId:t.sessionId,
|
|
1790
1845
|
worktreePath:E(t.worktreePath),baseCommit:t.baseCommit,canonicalCommit:t.canonicalCommit,sessionHead:t.sessionHead,worktreeTree:t.
|
|
1791
|
-
worktreeTree}})}async function
|
|
1792
|
-
metadata:{base_commit:n.baseCommit,canonical_commit:n.canonicalCommit,connected_contribution:JSON.stringify(o)}},{repositoryMode:
|
|
1846
|
+
worktreeTree}})}async function pf(e,t,r){for(let n of t){let{contribution:o}=n,i=X({sessionId:n.sessionId,sourcePath:n.worktreePath,
|
|
1847
|
+
metadata:{base_commit:n.baseCommit,canonical_commit:n.canonicalCommit,connected_contribution:JSON.stringify(o)}},{repositoryMode:J,
|
|
1793
1848
|
repository:{defaultBranch:o.integrationBranch},githubRepository:{fullName:o.repository,cloneUrl:`https://github.com/${o.
|
|
1794
|
-
repository}.git`}});try{let s=await ae({baseCommit:"HEAD",project:
|
|
1795
|
-
[a,c]=await Promise.all([
|
|
1796
|
-
c!==n.canonicalCommit)throw
|
|
1849
|
+
repository}.git`}});try{let s=await ae({baseCommit:"HEAD",project:te(i,r.project),runCommand:e,worktreePath:i.worktreePath}),
|
|
1850
|
+
[a,c]=await Promise.all([R(e,i,["rev-parse","--verify","HEAD^{commit}"],r),yf(e,i,r)]);if(s!==n.worktreeTree||a!==n.sessionHead||
|
|
1851
|
+
c!==n.canonicalCommit)throw b(`Connected work in ${o.repository} changed during Save. Inspect and save it before retryin\
|
|
1797
1852
|
g Main Save.`,"vibe64_connected_save_required",{repository:o.repository,sessionId:o.id})}catch(s){throw s.code==="vibe64\
|
|
1798
|
-
_connected_save_required"?s:
|
|
1799
|
-
Save.`,"vibe64_connected_source_unavailable",{repository:o.repository,sessionId:o.id})}}}async function
|
|
1800
|
-
e,t,o),t.mode===j){if(await
|
|
1801
|
-
e_authority_advanced");await
|
|
1802
|
-
[],o),o.onPublicationAttempt?.(),await
|
|
1853
|
+
_connected_save_required"?s:b(`Connected work in ${o.repository} could not be rechecked. Restore source access and retry\
|
|
1854
|
+
Save.`,"vibe64_connected_source_unavailable",{repository:o.repository,sessionId:o.id})}}}async function uT(e,t,r,n,o){if(await As(
|
|
1855
|
+
e,t,o),t.mode===j){if(await If(e,t,o)!==n)throw b("The local project baseline advanced during Save.","vibe64_session_sav\
|
|
1856
|
+
e_authority_advanced");await P(e,t,["fetch",t.worktreePath,r],{...o,cwd:t.standaloneSourceRoot}),await pf(e,o.connectedWorkSnapshots||
|
|
1857
|
+
[],o),o.onPublicationAttempt?.(),await P(e,t,["merge","--ff-only",r],{...o,cwd:t.standaloneSourceRoot});let u=await R(e,
|
|
1803
1858
|
t,["rev-parse","HEAD"],{...o,cwd:t.standaloneSourceRoot});return await Xt(e,t,u,o),u}let i=["push"],s=t.contribution?t.contributionPublishedCommit:
|
|
1804
|
-
n;if(t.contribution){if(t.contributionMissingPublished)throw
|
|
1859
|
+
n;if(t.contribution){if(t.contributionMissingPublished)throw b("This contribution branch was removed after publication. \
|
|
1805
1860
|
Preserve its source and submit further work as a new contribution.","vibe64_contribution_branch_missing");let l=t.contributionRemoteAbsent?
|
|
1806
|
-
"":t.contributionPublishedCommit;if(await
|
|
1861
|
+
"":t.contributionPublishedCommit;if(await Un(e,t,o)!==l)throw b("The contribution branch changed while Save was preparin\
|
|
1807
1862
|
g. Inspect it before trying again.","vibe64_session_save_update_required");i.push(`--force-with-lease=refs/heads/${t.branch}\
|
|
1808
|
-
:${l}`)}t.mode===
|
|
1809
|
-
e,o.connectedWorkSnapshots||[],o),o.onPublicationAttempt?.();try{a=await
|
|
1810
|
-
code,error:l.message}}let c;try{c=(t.contribution?await
|
|
1863
|
+
:${l}`)}t.mode===gt&&i.push("--push-option=vibe64-atomic"),i.push("origin",`${r}:refs/heads/${t.branch}`);let a;await pf(
|
|
1864
|
+
e,o.connectedWorkSnapshots||[],o),o.onPublicationAttempt?.();try{a=await P(e,t,i,{...o,required:!1})}catch(l){a={ok:!1,code:l.
|
|
1865
|
+
code,error:l.message}}let c;try{c=(t.contribution?await Un(e,t,o):await R(e,t,["ls-remote","--heads","origin",`refs/head\
|
|
1811
1866
|
s/${t.branch}`],o)).split(/\s+/u)[0]||""}catch(l){throw["vibe64_contribution_discarded","vibe64_contribution_discard_inc\
|
|
1812
|
-
omplete"].includes(l.code)?l:
|
|
1867
|
+
omplete"].includes(l.code)?l:b(`Save publication could not be confirmed. Inspect work to recover the prepared commit bef\
|
|
1813
1868
|
ore retrying. ${E(l.message)}`,"vibe64_session_save_publication_unknown")}if(c===r)return await Xt(e,t,c,o),c;if(a?.ok!==
|
|
1814
|
-
!0){if(c&&c!==s)throw
|
|
1869
|
+
!0){if(c&&c!==s)throw b("The saved branch changed while Save was publishing. Update this session, then save again.","vib\
|
|
1815
1870
|
e64_session_save_update_required",{canonicalCommit:c,reconciledCommit:n,updateRequired:!0});let l=E(a?.stderr||a?.stdout||
|
|
1816
|
-
a?.output||a?.error)||"Git Save publication failed.";throw t.mode===
|
|
1817
|
-
l)?
|
|
1871
|
+
a?.output||a?.error)||"Git Save publication failed.";throw t.mode===J&&/changes must be made through a pull request/iu.test(
|
|
1872
|
+
l)?b(`GitHub requires a pull request to update ${t.branch}. Your work remains in this session.
|
|
1818
1873
|
|
|
1819
|
-
${l}`,"vibe64_pull_request_required"):
|
|
1820
|
-
rification did not return the commit Vibe64 published.","vibe64_session_save_verification_failed")}async function
|
|
1821
|
-
commandOptions:n={},project:o={}}={}){if(t.mode!==
|
|
1874
|
+
${l}`,"vibe64_pull_request_required"):b(l,E(a?.code)||"vibe64_session_save_git_failed")}throw b("Canonical repository ve\
|
|
1875
|
+
rification did not return the commit Vibe64 published.","vibe64_session_save_verification_failed")}async function dT(e,t,r,{
|
|
1876
|
+
commandOptions:n={},project:o={}}={}){if(t.mode!==J)return{attempted:!1,kind:"none",retryable:!1,status:"not_applicable"};
|
|
1822
1877
|
let i=t.githubMirrorPath,s=(a,c)=>({attempted:!!i,branch:t.branch,code:a,kind:"github_mirror",message:"Your work was sav\
|
|
1823
1878
|
ed, but Vibe64 could not refresh its local clone cache. A later session or Save will retry it.",reason:c,retryable:!0,status:"\
|
|
1824
1879
|
retryable",verifiedCommit:r});if(!i&&t.githubMirrorOptional)return{attempted:!1,kind:"none",retryable:!1,status:"not_app\
|
|
1825
|
-
licable"};if(!i||!
|
|
1826
|
-
a,...c]=
|
|
1880
|
+
licable"};if(!i||!H.isAbsolute(i))return s("vibe64_session_save_github_mirror_missing","configuration_missing");try{let[
|
|
1881
|
+
a,...c]=ps({mirrorPath:i,remoteUrl:t.remoteUrl}),l=await hf(e,t,a,c,{additionalAllowedRoots:[i],commandOptions:n,project:o});
|
|
1827
1882
|
if(l?.ok!==!0)return s(E(l?.code)||"vibe64_session_save_github_mirror_refresh_failed","refresh_failed");let u={additionalAllowedRoots:[
|
|
1828
|
-
i],commandOptions:n,project:o,required:!1},[d,
|
|
1829
|
-
ads/${t.branch}^{commit}`],u),
|
|
1830
|
-
|
|
1831
|
-
d"),mirrorCommit:
|
|
1832
|
-
return s("vibe64_session_save_github_mirror_refresh_failed","refresh_interrupted")}}async function
|
|
1833
|
-
e,t,r,n)}async function
|
|
1834
|
-
let i=X(o,r);n=
|
|
1835
|
-
let s=await
|
|
1836
|
-
{commandOptions:e,project:r}),ae({baseCommit:"HEAD",project:
|
|
1837
|
-
n,i,
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
{baseCommit:"HEAD",project:ee(t,u),runCommand:e,worktreePath:t.worktreePath});if(f!==a)throw w("The updated session did \
|
|
1883
|
+
i],commandOptions:n,project:o,required:!1},[d,p]=await Promise.all([P(e,t,["--git-dir",i,"rev-parse","--verify",`refs/he\
|
|
1884
|
+
ads/${t.branch}^{commit}`],u),P(e,t,["--git-dir",i,"remote","get-url","origin"],u)]),f=d?.ok===!0?Dn(d):"",m=p?.ok===!0?
|
|
1885
|
+
Dn(p):"";return f!==r||m!==t.remoteUrl?{...s("vibe64_session_save_github_mirror_verification_failed","verification_faile\
|
|
1886
|
+
d"),mirrorCommit:f}:{attempted:!0,branch:t.branch,kind:"github_mirror",mirrorCommit:f,retryable:!1,status:"current",verifiedCommit:r}}catch{
|
|
1887
|
+
return s("vibe64_session_save_github_mirror_refresh_failed","refresh_interrupted")}}async function xf(e,t,r,n){return Rf(
|
|
1888
|
+
e,t,r,n)}async function kf({commandOptions:e={},operationId:t=me.randomUUID(),project:r={},runCommand:n=D,session:o={}}={}){
|
|
1889
|
+
let i=X(o,r);n=Se(n,i,r,{label:"Checking repository for updates",operationId:t}),await Fn(n,i,{commandOptions:e,project:r});
|
|
1890
|
+
let s=await xf(n,i,t,{commandOptions:e,project:r}),[a,c]=await Promise.all([R(n,i,["rev-parse","--verify","HEAD^{commit}"],
|
|
1891
|
+
{commandOptions:e,project:r}),ae({baseCommit:"HEAD",project:te(i,r),runCommand:n,worktreePath:i.worktreePath})]),l=await _s(
|
|
1892
|
+
n,i,s,a,{commandOptions:e,project:r});if(l&&i.mode!==j)throw b("The saved project history no longer descends from this s\
|
|
1893
|
+
ession's starting version.","vibe64_session_update_history_diverged");let u=l?{baseCommit:i.baseCommit,canonicalCommit:s,
|
|
1894
|
+
sessionHead:a,worktreeTree:c,changedPaths:(await gf(n,i,i.baseCommit,c,{commandOptions:e,project:r})).slice(0,100)}:null,
|
|
1895
|
+
[d,p,f,m]=await Promise.all([Ln(n,i,s,a,{commandOptions:e,project:r}),Ln(n,i,a,s,{commandOptions:e,project:r}),ce(n,i,s,
|
|
1896
|
+
a,{commandOptions:e,project:r}),wt(n,i,s,{commandOptions:e,project:r})]),h=hs(d,p),y=p>0?await eT(n,i,a,s,{commandOptions:e,
|
|
1897
|
+
project:r}):{incomingVersions:[],incomingVersionsTruncated:!1};return{ahead:d,baseCommit:i.baseCommit,behind:p,canonicalCommit:s,
|
|
1898
|
+
canonicalSource:{authority:i.mode,commit:s,ref:`refs/heads/${i.canonicalBranch||i.branch}`,...i.mode===j?{}:{repository:i.
|
|
1899
|
+
remoteUrl}},...y,ok:!0,operationId:t,reconciled:!l&&f,...u?{historyReview:u}:{},repositoryMode:i.mode,relationship:h,sessionCurrent:f,
|
|
1900
|
+
sessionHead:a,sessionMatchesCanonical:c===m,updateAvailable:l||!f,updateStrategy:gs(h)}}async function pT(e,t,{canonicalCommit:r,checkpointCommit:n,checkpointTree:o,commandOptions:i,mergedCommit:s,mergedTree:a,
|
|
1901
|
+
oldHead:c,oldIndexTree:l,project:u}){if(await ae({baseCommit:"HEAD",project:te(t,u),runCommand:e,worktreePath:t.worktreePath})!==
|
|
1902
|
+
o)throw b("This session changed while its update was being prepared. Retry when the assistant is idle.","vibe64_session_\
|
|
1903
|
+
update_worktree_changed");try{await P(e,t,["read-tree","--reset","-u",s],{commandOptions:i,project:u}),await P(e,t,["upd\
|
|
1904
|
+
ate-ref","HEAD",r,c],{commandOptions:i,project:u}),await P(e,t,["read-tree",r],{commandOptions:i,project:u});let p=await ae(
|
|
1905
|
+
{baseCommit:"HEAD",project:te(t,u),runCommand:e,worktreePath:t.worktreePath});if(p!==a)throw b("The updated session did \
|
|
1852
1906
|
not match the prepared merged work.","vibe64_session_update_verification_failed");return await Xt(e,t,r,{commandOptions:i,
|
|
1853
|
-
project:u}),{currentTree:
|
|
1854
|
-
project:u}).catch(()=>"");throw await
|
|
1855
|
-
|
|
1856
|
-
project:u,required:!1}),
|
|
1857
|
-
let i=X(o,r);await
|
|
1907
|
+
project:u}),{currentTree:p,reconciled:!0,status:"updated"}}catch(p){let f=await R(e,t,["rev-parse","HEAD"],{commandOptions:i,
|
|
1908
|
+
project:u}).catch(()=>"");throw await P(e,t,["read-tree","--reset","-u",n],{commandOptions:i,project:u,required:!1}),f&&
|
|
1909
|
+
f!==c&&await P(e,t,["update-ref","HEAD",c,f],{commandOptions:i,project:u,required:!1}),await P(e,t,["read-tree",l],{commandOptions:i,
|
|
1910
|
+
project:u,required:!1}),p}}async function Is({commandOptions:e={},operationId:t,project:r={},runCommand:n=D,session:o={}}={}){
|
|
1911
|
+
let i=X(o,r);await Fn(n,i,{commandOptions:e,project:r});let s=await $n({outerTurnId:`update:${t}`,outcome:"completed",project:te(
|
|
1858
1912
|
i,r),runCommand:n,sessionId:i.sessionId,timestamp:new Date().toISOString(),worktreePath:i.worktreePath}),[a,c]=await Promise.
|
|
1859
|
-
all([
|
|
1860
|
-
checkpointCommit:s.commit,checkpointTree:s.tree,oldHead:a,oldIndexTree:c}}async function
|
|
1913
|
+
all([R(n,i,["rev-parse","HEAD"],{commandOptions:e,project:r}),R(n,i,["write-tree"],{commandOptions:e,project:r})]);return{
|
|
1914
|
+
checkpointCommit:s.commit,checkpointTree:s.tree,oldHead:a,oldIndexTree:c}}async function Nf({checkpoint:e={},commandOptions:t={},
|
|
1861
1915
|
conflictRecovery:r=null,derivedArtifactPaths:n=[],historyReview:o=null,identity:i={},operationId:s,project:a={},reviewedConflictId:c="",
|
|
1862
|
-
runCommand:l=D,session:u={}}={}){let d=X(u,a),{checkpointCommit:
|
|
1863
|
-
i.email)||"vibe64@localhost",name:E(i.name)||"Vibe64 Update"},
|
|
1864
|
-
l,d,
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
r.
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
e,t,["
|
|
1892
|
-
await
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
timestamp:new Date().toISOString(),worktreePath:t.worktreePath}),s=await P(e,t,["rev-parse","--verify","HEAD^{commit}"],
|
|
1916
|
+
runCommand:l=D,session:u={}}={}){let d=X(u,a),{checkpointCommit:p,checkpointTree:f,oldHead:m,oldIndexTree:h}=e,y={email:E(
|
|
1917
|
+
i.email)||"vibe64@localhost",name:E(i.name)||"Vibe64 Update"},w=await xf(l,d,s,{commandOptions:t,project:a}),g=await _s(
|
|
1918
|
+
l,d,w,m,{commandOptions:t,project:a});if(g||o){if(d.mode!==j)throw b("The saved project history no longer descends from \
|
|
1919
|
+
this session's starting version.","vibe64_session_update_history_diverged");let x={baseCommit:d.baseCommit,canonicalCommit:w,
|
|
1920
|
+
sessionHead:m,worktreeTree:f};if(!(c&&r?.reviewId===c&&r.baseCommit===d.baseCommit&&r.canonicalCommit===w&&r.oldHead===m&&
|
|
1921
|
+
r.oldIndexTree===h)&&(!o||Object.entries(x).some(([$,M])=>o[$]!==M)))throw b("The project history was rewritten. Open Re\
|
|
1922
|
+
pository, check for updates, then review and reconcile this session.","vibe64_session_history_review_required")}let v=await Ss(
|
|
1923
|
+
l,d,{baseCommit:d.baseCommit,canonicalCommit:w,sessionHead:m,worktreeTree:f,reconcileHistory:g},{commandOptions:t,project:a}),
|
|
1924
|
+
_=new Set(Gn(n)),A=v.changedPaths.filter(x=>!_.has(x)),I=await ce(l,d,w,m,{commandOptions:t,project:a});if(I&&!g)return{
|
|
1925
|
+
baseCommit:d.baseCommit,canonicalCommit:w,canonicalTree:v.canonicalTree,changeBaseCommit:v.changeBaseCommit,checkpointCommit:p,
|
|
1926
|
+
checkpointTree:f,currentTree:f,ok:!0,operationId:s,mode:d.mode,reconciled:!0,repositoryMode:d.mode,sessionCurrent:I,sessionMatchesCanonical:v.
|
|
1927
|
+
sessionMatchesCanonical,status:"already_current"};let S=v.canonicalTree;if(A.length){let x=await Ts(l,d,{commandOptions:t,
|
|
1928
|
+
derivedArtifactPaths:n,project:a,sourceCommit:w,tree:f}),N=await Pf(l,d,{baseCommit:v.changeBaseCommit,explicitBase:g,canonicalCommit:w,
|
|
1929
|
+
checkpointTree:x,commandOptions:t,identity:y,project:a}),$=N.conflictPaths.length>0?{baseCommit:v.changeBaseCommit,canonicalCommit:w,
|
|
1930
|
+
checkpointTree:f,conflictPaths:N.conflictPaths,conflictTree:N.conflictTree,oldHead:m,oldIndexTree:h,reviewId:me.randomUUID()}:
|
|
1931
|
+
null;S=$?await cT(l,d,{currentRecovery:$,previousRecovery:r,reviewedConflictId:c,project:a}):N.mergedTree}return{...e,baseCommit:d.
|
|
1932
|
+
baseCommit,canonicalCommit:w,canonicalTree:v.canonicalTree,changeBaseCommit:v.changeBaseCommit,mergedSourceTree:S,mode:d.
|
|
1933
|
+
mode,operationId:s,repositoryMode:d.mode,sessionCurrent:!0,...A.length?{}:{sessionMatchesCanonical:!0},status:"prepared"}}
|
|
1934
|
+
async function $f({commandOptions:e={},derivedArtifactPaths:t=[],identity:r={},prepared:n={},project:o={},refreshDerivedArtifacts:i=null,
|
|
1935
|
+
runCommand:s=D,session:a={}}={}){let c=X(a,o),l={email:E(r.email)||"vibe64@localhost",name:E(r.name)||"Vibe64 Update"},u=await zn(
|
|
1936
|
+
s,c,{baseCommit:n.canonicalCommit,commandOptions:e,derivedArtifactPaths:t,identity:l,project:o,refreshDerivedArtifacts:i,
|
|
1937
|
+
tree:n.mergedSourceTree}),d=u===n.canonicalTree?n.canonicalCommit:await jn(s,c,{baseCommit:n.canonicalCommit,commandOptions:e,
|
|
1938
|
+
identity:l,message:"Vibe64 session update result",project:o,tree:u});return{...n,mergedCommit:d,mergedTree:u}}async function Mf({
|
|
1939
|
+
commandOptions:e={},prepared:t={},project:r={},runCommand:n=D,session:o={}}={}){let i=X(o,r),s=await pT(n,i,{...t,commandOptions:e,
|
|
1940
|
+
project:r});return{...t,ok:!0,...s}}async function fT(e,t,{checkpointCommit:r,checkpointTree:n,commandOptions:o,project:i,saveCommit:s,sessionHead:a=""}){let[
|
|
1941
|
+
c,l,u]=await Promise.all([ae({baseCommit:"HEAD",project:te(t,i),runCommand:e,worktreePath:t.worktreePath}),R(e,t,["rev-p\
|
|
1942
|
+
arse","HEAD"],{commandOptions:o,project:i}),wt(e,t,s,{commandOptions:o,project:i})]);if(l===s)return{currentTree:c,reconciled:!0,
|
|
1943
|
+
status:"saved"};if(a&&l!==a)return{currentTree:c,reconciled:!1,status:"published_needs_reconcile"};let d=c!==n&&c!==u,p=await R(
|
|
1944
|
+
e,t,["write-tree"],{commandOptions:o,project:i});try{return d?(await P(e,t,["read-tree",r],{commandOptions:o,project:i}),
|
|
1945
|
+
await P(e,t,["read-tree","-m","-u",r,s],{commandOptions:o,project:i})):await P(e,t,["read-tree","--reset","-u",s],{commandOptions:o,
|
|
1946
|
+
project:i}),await P(e,t,["update-ref","HEAD",s,l],{commandOptions:o,project:i}),{currentTree:c,reconciled:!0,status:"sav\
|
|
1947
|
+
ed"}}catch(f){return d||await P(e,t,["read-tree","--reset","-u",r],{commandOptions:o,project:i,required:!1}),await P(e,t,
|
|
1948
|
+
["read-tree",p],{commandOptions:o,project:i,required:!1}),{currentTree:c,error:E(f?.message||f),reconciled:!1,status:"pu\
|
|
1949
|
+
blished_needs_reconcile"}}}async function Df(e,t,{commandOptions:r={},operationId:n,project:o={}}={}){await Fn(e,t,{commandOptions:r,
|
|
1950
|
+
project:o});let i=await $n({outerTurnId:`save:${n}`,outcome:"completed",project:te(t,o),runCommand:e,sessionId:t.sessionId,
|
|
1951
|
+
timestamp:new Date().toISOString(),worktreePath:t.worktreePath}),s=await R(e,t,["rev-parse","--verify","HEAD^{commit}"],
|
|
1899
1952
|
{commandOptions:r,project:o});return{baseCommit:t.baseCommit,branch:t.branch,checkpointCommit:i.commit,checkpointTree:i.
|
|
1900
|
-
tree,mode:t.mode,operationId:n,sessionHead:s}}async function
|
|
1901
|
-
limit:n=40,operationId:o=
|
|
1902
|
-
apturing work for Save",operationId:o});let l=await
|
|
1953
|
+
tree,mode:t.mode,operationId:n,sessionHead:s}}async function Lf({commandOptions:e={},connectedWorkSnapshots:t=[],derivedArtifactPaths:r=[],
|
|
1954
|
+
limit:n=40,operationId:o=me.randomUUID(),project:i={},runCommand:s=D,session:a={}}={}){let c=X(a,i);s=Se(s,c,i,{label:"C\
|
|
1955
|
+
apturing work for Save",operationId:o});let l=await Df(s,c,{commandOptions:e,operationId:o,project:i}),u=await Es({commandOptions:e,
|
|
1903
1956
|
derivedArtifactPaths:r,includeInitialDiff:!1,limit:n,project:i,runCommand:s,session:a,worktreeTree:l.checkpointTree});if(!u.
|
|
1904
|
-
totalCount)throw await
|
|
1905
|
-
save.","vibe64_session_save_no_changes");return{changes:u,checkpoint:l}}async function
|
|
1957
|
+
totalCount)throw await As(s,c,{commandOptions:e,connectedWorkSnapshots:Cf(t),project:i}),b("This session has no work to \
|
|
1958
|
+
save.","vibe64_session_save_no_changes");return{changes:u,checkpoint:l}}async function mT(e,t,r,{commandOptions:n={},operationId:o,
|
|
1906
1959
|
project:i={}}={}){let s=E(r?.checkpointCommit),a=E(r?.checkpointTree);if(!s||!a||E(r?.operationId)!==E(o)||E(r?.baseCommit)!==
|
|
1907
|
-
t.baseCommit||E(r?.branch)!==t.branch||E(r?.mode)!==t.mode||await
|
|
1960
|
+
t.baseCommit||E(r?.branch)!==t.branch||E(r?.mode)!==t.mode||await wt(e,t,s,{commandOptions:n,project:i})!==a)throw b("Sa\
|
|
1908
1961
|
ve cannot verify the captured worktree. Capture and name the work again.","vibe64_session_save_checkpoint_invalid");let l=E(
|
|
1909
|
-
r?.sessionHead),u=l?await
|
|
1962
|
+
r?.sessionHead),u=l?await R(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:n,project:i}):"";if(l&&u!==l)throw b(
|
|
1910
1963
|
"The session history changed while Vibe64 was naming this work. Save was not started; try again.","vibe64_session_save_m\
|
|
1911
|
-
essage_stale");return r}async function
|
|
1912
|
-
identity:s={},message:a="",operationId:c,project:l={},refreshDerivedArtifacts:u=null}={}){let d=E(r.checkpointTree),[f
|
|
1913
|
-
all([
|
|
1914
|
-
if(
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
tree:
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
k",message:"Waiting for exclusive repository access.",stage:"repository-lock"}),d(async()=>{await f({baseCommit:m.baseCommit,
|
|
1964
|
+
essage_stale");return r}async function hT(e,t,{checkpoint:r={},commandOptions:n={},connectedWorkSnapshots:o=[],derivedArtifactPaths:i=[],
|
|
1965
|
+
identity:s={},message:a="",operationId:c,project:l={},refreshDerivedArtifacts:u=null}={}){let d=E(r.checkpointTree),[p,f]=await Promise.
|
|
1966
|
+
all([Rf(e,t,c,{commandOptions:n,project:l}),R(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:n,project:l})]);
|
|
1967
|
+
if(await _s(e,t,p,f,{commandOptions:n,project:l}))throw b("Canonical history no longer descends from this session's save\
|
|
1968
|
+
d base.","vibe64_session_save_history_diverged");let m=await ce(e,t,p,f,{commandOptions:n,project:l});if(p!==t.baseCommit&&
|
|
1969
|
+
!m)throw b("The saved branch has changed. Update this session before saving its work.","vibe64_session_save_update_requi\
|
|
1970
|
+
red",{canonicalCommit:p,reconciledCommit:t.baseCommit,updateRequired:!0});let h=await Ss(e,t,{baseCommit:t.baseCommit,canonicalCommit:p,
|
|
1971
|
+
sessionHead:f,worktreeTree:d},{commandOptions:n,project:l}),y=new Set(Gn(i)),w=h.changedPaths.filter(S=>!y.has(S));if(!w.
|
|
1972
|
+
length)throw await As(e,t,{commandOptions:n,connectedWorkSnapshots:o,project:l}),b("This session has no work to save.","\
|
|
1973
|
+
vibe64_session_save_no_changes");let g={email:E(s.email)||"vibe64@localhost",name:E(s.name)||"Vibe64 Save"},v=await Ts(e,
|
|
1974
|
+
t,{commandOptions:n,derivedArtifactPaths:i,project:l,sourceCommit:p,tree:d}),_=await zn(e,t,{baseCommit:p,commandOptions:n,
|
|
1975
|
+
derivedArtifactPaths:i,identity:g,project:l,refreshDerivedArtifacts:u,tree:v}),A=await lT(e,t,{canonicalCommit:p,commandOptions:n,
|
|
1976
|
+
identity:g,mergedTree:_,message:a,project:l}),I=await oT(e,t,c,A,{commandOptions:n,project:l});return{canonicalCommit:p,
|
|
1977
|
+
changeBaseCommit:h.changeBaseCommit,changedPaths:w,mergedTree:_,preparedRef:I,saveCommit:A}}async function gT(e,t,{commandOptions:r={},
|
|
1978
|
+
connectedWorkSnapshots:n=[],onPublicationAttempt:o,prepared:i={},project:s={}}={}){return uT(e,t,E(i.saveCommit),E(i.canonicalCommit),
|
|
1979
|
+
{commandOptions:r,connectedWorkSnapshots:n,onPublicationAttempt:o,project:s})}function bT(e,t,r,n,o){return{baseCommit:e.
|
|
1980
|
+
baseCommit,cacheMaintenance:o.cacheMaintenance,canonicalCommit:r.canonicalCommit,changeBaseCommit:r.changeBaseCommit,changedPaths:r.
|
|
1981
|
+
changedPaths,checkpointCommit:t.checkpointCommit,checkpointTree:t.checkpointTree,mergedTree:r.mergedTree,mode:e.mode,ok:!0,
|
|
1982
|
+
operationId:t.operationId,preparedRef:r.preparedRef,saveCommit:r.saveCommit,sessionHead:t.sessionHead,status:o.status,verifiedCommit:n,
|
|
1983
|
+
...o}}function wT(e,t){return e.mode!==J?{attempted:!1,kind:"none",retryable:!1,status:"not_applicable"}:{attempted:!1,branch:e.
|
|
1984
|
+
branch,kind:"github_mirror",retryable:!1,status:"deferred",verifiedCommit:t}}async function Rs({commandOptions:e={},operationId:t="",project:r={},runCommand:n=D,session:o={},verifiedCommit:i=""}={}){
|
|
1985
|
+
let s=X(o,r);return n=Se(n,s,r,{label:"Maintaining saved repository cache",operationId:t}),dT(n,s,E(i),{commandOptions:e,
|
|
1986
|
+
project:r})}async function yT(e,t,r,n={}){E(r)&&await _t(e,t,Af(t,r),n)}async function Bf({checkpoint:e=null,commandOptions:t={},
|
|
1987
|
+
connectedWorkSnapshots:r=[],deferCacheMaintenance:n=!1,derivedArtifactPaths:o=[],identity:i={},message:s="",operationId:a=me.
|
|
1988
|
+
randomUUID(),project:c={},refreshDerivedArtifacts:l=null,runCommand:u=D,runProjectSourceExclusive:d=async m=>m(),onProgress:p=async()=>null,
|
|
1989
|
+
session:f={}}={}){let m=X(f,c),h=Cf(r);return u=Se(u,m,c,{label:"Saving session work",operationId:a}),await p({kind:"loc\
|
|
1990
|
+
k",message:"Waiting for exclusive repository access.",stage:"repository-lock"}),d(async()=>{await p({baseCommit:m.baseCommit,
|
|
1939
1991
|
branch:m.branch,kind:"checkpoint",message:"Capturing the complete session worktree.",mode:m.mode,operationId:a,stage:"ch\
|
|
1940
|
-
eckpointing"});let
|
|
1941
|
-
|
|
1942
|
-
checkpointTree,kind:"checkpoint",message:"Session checkpoint captured.",stage:"checkpointed"}),await
|
|
1943
|
-
message:"Reading the current canonical branch.",stage:"canonical-reading"});let
|
|
1992
|
+
eckpointing"});let y;e?(await Fn(u,m,{commandOptions:t,project:c}),y=await mT(u,m,e,{commandOptions:t,operationId:a,project:c})):
|
|
1993
|
+
y=await Df(u,m,{commandOptions:t,operationId:a,project:c}),await p({checkpointCommit:y.checkpointCommit,checkpointTree:y.
|
|
1994
|
+
checkpointTree,kind:"checkpoint",message:"Session checkpoint captured.",stage:"checkpointed"}),await p({kind:"canonical",
|
|
1995
|
+
message:"Reading the current canonical branch.",stage:"canonical-reading"});let w=await hT(u,m,{checkpoint:y,commandOptions:t,
|
|
1944
1996
|
connectedWorkSnapshots:h,derivedArtifactPaths:o,identity:i,message:s,operationId:a,project:c,refreshDerivedArtifacts:l}),
|
|
1945
|
-
g=!1,
|
|
1946
|
-
anonical-read"}),await
|
|
1947
|
-
commit prepared.",proposedCommit:
|
|
1948
|
-
ry Save commit.",stage:"publishing"}),
|
|
1949
|
-
!0},prepared:
|
|
1950
|
-
project:c}),
|
|
1951
|
-
{kind:"reconcile",message:"Reconciling the session onto the saved commit.",stage:"reconciling"});let
|
|
1952
|
-
checkpointCommit,checkpointTree:
|
|
1953
|
-
A=n?
|
|
1954
|
-
!0&&await
|
|
1955
|
-
m,a,{commandOptions:t,project:c}),
|
|
1956
|
-
return
|
|
1957
|
-
return
|
|
1958
|
-
derivedArtifactPaths?.length&&
|
|
1959
|
-
await t({projectRoot:e.session.sourcePath})}return
|
|
1960
|
-
ived":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");return
|
|
1961
|
-
"update-apply":
|
|
1962
|
-
execution,input:e.input,maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,timeout:e.timeout})}async function
|
|
1963
|
-
for await(let t of process.stdin)if(e+=String(t||""),Buffer.byteLength(e)>
|
|
1964
|
-
on input is too large.");return JSON.parse(e||"{}")}function
|
|
1997
|
+
g=!1,v;try{await p({expectedCanonicalCommit:w.canonicalCommit,kind:"canonical",message:"Canonical branch read.",stage:"c\
|
|
1998
|
+
anonical-read"}),await p({expectedCanonicalCommit:w.canonicalCommit,kind:"publish",mergedTree:w.mergedTree,message:"Save\
|
|
1999
|
+
commit prepared.",proposedCommit:w.saveCommit,stage:"prepared"}),await p({kind:"publish",message:"Publishing one ordina\
|
|
2000
|
+
ry Save commit.",stage:"publishing"}),v=await gT(u,m,{commandOptions:t,connectedWorkSnapshots:h,onPublicationAttempt(){g=
|
|
2001
|
+
!0},prepared:w,project:c})}catch(I){throw g||await P(u,m,["update-ref","-d",w.preparedRef,w.saveCommit],{commandOptions:t,
|
|
2002
|
+
project:c}),I}await p({kind:"publish",message:"Canonical Save commit verified.",stage:"published",verifiedCommit:v}),await p(
|
|
2003
|
+
{kind:"reconcile",message:"Reconciling the session onto the saved commit.",stage:"reconciling"});let _=await fT(u,m,{checkpointCommit:y.
|
|
2004
|
+
checkpointCommit,checkpointTree:y.checkpointTree,commandOptions:t,project:c,saveCommit:w.saveCommit,sessionHead:y.sessionHead}),
|
|
2005
|
+
A=n?wT(m,v):await Rs({commandOptions:t,operationId:a,project:c,runCommand:u,session:f,verifiedCommit:v});return A.retryable===
|
|
2006
|
+
!0&&await p({cacheMaintenance:A,kind:"cache-warning",message:A.message,stage:"cache-maintenance-warning"}),n||await yT(u,
|
|
2007
|
+
m,a,{commandOptions:t,project:c}),bT(m,y,w,v,{cacheMaintenance:A,..._})},{operation:`save-session:${m.sessionId}`})}var ET=1024*1024,vT={incoming:Bn,"incoming-change":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");
|
|
2008
|
+
return wf({...e,refreshDerivedArtifacts:t})},"change-diff":Tf,changes:Es,"check-updates":kf,save:async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");
|
|
2009
|
+
return Bf({...e,deferCacheMaintenance:!0,refreshDerivedArtifacts:t})},"save-maintenance":Rs,"save-message":async e=>{if(e.
|
|
2010
|
+
derivedArtifactPaths?.length&&_T(ST.join(e.session.sourcePath,"genesis/blueprint.md"))){let{inspectGenesisStackComponents:t}=await import("@local/vibe64-genesis/server");
|
|
2011
|
+
await t({projectRoot:e.session.sourcePath})}return Lf(e)},work:Hn,"update-checkpoint":Is,"update-prepare":Nf,"update-der\
|
|
2012
|
+
ived":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");return $f({...e,refreshDerivedArtifacts:t})},
|
|
2013
|
+
"update-apply":Mf};function TT(e={}){return Be(e.command,e.args,{cwd:e.cwd,env:{...process.env,...e.env||{}},execution:e.
|
|
2014
|
+
execution,input:e.input,maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,timeout:e.timeout})}async function AT(){let e="";
|
|
2015
|
+
for await(let t of process.stdin)if(e+=String(t||""),Buffer.byteLength(e)>ET)throw new Error("Session repository operati\
|
|
2016
|
+
on input is too large.");return JSON.parse(e||"{}")}function IT(e){return{error:{code:String(e?.code||"vibe64_session_wo\
|
|
1965
2017
|
rk_operation_failed"),details:e?.details&&typeof e.details=="object"&&!Array.isArray(e.details)?e.details:{},message:String(
|
|
1966
|
-
e?.message||"Session repository operation failed.")},ok:!1}}try{let e=await
|
|
1967
|
-
"Unsupported session repository operation.");throw n.code="
|
|
1968
|
-
input&&typeof e.input=="object"?e.input:{},runCommand:
|
|
1969
|
-
process.stdout.write(JSON.stringify(
|
|
2018
|
+
e?.message||"Session repository operation failed.")},ok:!1}}try{let e=await AT();Mi(e?.hostProfile||null);let t=vT[String(
|
|
2019
|
+
e?.operation||"")];if(!t){let n=new Error("Unsupported session repository operation.");throw n.code="vibe64_session_work\
|
|
2020
|
+
_operation_unsupported",n}let r=await t({...e.input&&typeof e.input=="object"?e.input:{},runCommand:TT});process.stdout.
|
|
2021
|
+
write(JSON.stringify({ok:!0,value:r}))}catch(e){process.stdout.write(JSON.stringify(IT(e))),process.exitCode=1}
|