vibe64 0.1.32 → 0.1.34
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 +1717 -1648
- package/bin/server.js +81 -68
- package/bin/upgrade-state.js +5438 -5189
- package/dist/assets/{GithubBrowserTabs-2bEGbRAs.js → GithubBrowserTabs-DO5PHon-.js} +1 -1
- package/dist/assets/GithubMarkdown-BQ6MfCDJ.js +3 -0
- package/dist/assets/GithubMarkdown-U7-j-qNI.css +1 -0
- package/dist/assets/StudioErrorNotice-sQfmeR-z.js +1 -0
- package/dist/assets/VAlert-P256xaE0.js +1 -0
- package/dist/assets/VAutocomplete-BDb95qJX.js +1 -0
- package/dist/assets/VAvatar-9ilDR2r2.css +1 -0
- package/dist/assets/VAvatar-DPzqDH4r.js +1 -0
- package/dist/assets/VBtn-B2MBK2DL.js +1 -0
- package/dist/assets/VCard-mXy0k4aS.js +1 -0
- package/dist/assets/VCheckbox-C7A1ZW4D.js +1 -0
- package/dist/assets/VChip-CcI-Oo2J.js +1 -0
- package/dist/assets/VDialog-Bu3EfKb1.js +1 -0
- package/dist/assets/VDivider-BMEqUoAB.js +1 -0
- package/dist/assets/VExpansionPanels-Dgjrop0V.js +1 -0
- package/dist/assets/VMenu-C_x18lwb.js +1 -0
- package/dist/assets/VOverlay-CeMZurIN.js +1 -0
- package/dist/assets/VRadioGroup-CUu2-KIP.js +1 -0
- package/dist/assets/VRow-Cpw7OHQV.js +1 -0
- package/dist/assets/{VSelect-DY-ZuBJJ.js → VSelect-DL3HaA5m.js} +1 -1
- package/dist/assets/VSheet-DZWsu0kL.js +1 -0
- package/dist/assets/VSkeletonLoader-CttxM1tw.js +1 -0
- package/dist/assets/VSpacer-Dhmsvk4t.js +1 -0
- package/dist/assets/{VSwitch-Bm1bwl2V.js → VSwitch-BRHeDJkH.js} +1 -1
- package/dist/assets/VTextField-BR2eZeFT.js +1 -0
- package/dist/assets/VTextarea-DbqamXJd.js +1 -0
- package/dist/assets/Vibe64AsyncModuleState-Dx7YKRPp.js +1 -0
- package/dist/assets/Vibe64DashboardBackButton-DD9UR77P.css +1 -0
- package/dist/assets/Vibe64DashboardBackButton-yE6cyYg2.js +1 -0
- package/dist/assets/Vibe64DashboardPageHeader-BXQR00HK.js +1 -0
- package/dist/assets/Vibe64DashboardPageHeader-Gm1IvlHx.css +1 -0
- package/dist/assets/Vibe64DashboardShell-CuCVMhOc.js +1 -0
- package/dist/assets/Vibe64DashboardShell-MBkUHjs-.css +1 -0
- package/dist/assets/Vibe64DatabaseWorkspace-BONJdxBS.js +18 -0
- package/dist/assets/{Vibe64DatabaseWorkspace-C39Jvver.css → Vibe64DatabaseWorkspace-CR4pzzcf.css} +1 -1
- package/dist/assets/Vibe64OutputControls-DAAmA09l.js +8 -0
- package/dist/assets/{Vibe64OutputControls-CsZFv12r.css → Vibe64OutputControls-DPBsyDZM.css} +1 -1
- package/dist/assets/{Vibe64RepositoryWorkspace-ebUaYOU4.js → Vibe64RepositoryWorkspace-ByQlZbyO.js} +2 -2
- package/dist/assets/{Vibe64RepositoryWorkspace-Cqm6TOFk.css → Vibe64RepositoryWorkspace-CVHcT93M.css} +1 -1
- package/dist/assets/Vibe64SessionFiles-B0u9HKdF.js +107 -0
- package/dist/assets/Vibe64SessionFiles-NjOMVwPR.css +1 -0
- package/dist/assets/Vibe64TemporaryAiFixAction-BGlcrq4d.js +1 -0
- package/dist/assets/Vibe64UiStoryboardView-3WXph5bz.css +1 -0
- package/dist/assets/Vibe64UiStoryboardView-Brlwdvqi.js +7 -0
- package/dist/assets/Vibe64UnavailableSessions-zwlWlcZD.js +1 -0
- package/dist/assets/_sessionId_-CvOkQbVy.js +1 -0
- package/dist/assets/{_sessionTool_-B39BIzzZ.js → _sessionTool_-Dwod5ns9.js} +1 -1
- package/dist/assets/_slug_-B31c15cc.css +1 -0
- package/dist/assets/_slug_-Dy35qLo1.js +1 -0
- package/dist/assets/access-BVu5XYm2.js +1 -0
- package/dist/assets/app-DRXCcv05.css +1 -0
- package/dist/assets/app-zt7HwQKT.js +1 -0
- package/dist/assets/assistantRouting-CwbwfkwB.js +3 -0
- package/dist/assets/{changes-ByjS7QGx.js → changes-olY8cnFK.js} +1 -1
- package/dist/assets/{client-C-tpoG6F.js → client-BrV4QPwG.js} +1 -1
- package/dist/assets/createSimpleFunctional-CZTGuNuR.js +1 -0
- package/dist/assets/dashboard-BnXD-H4R.js +1 -0
- package/dist/assets/definitions-DaOPIkyB.js +1 -0
- package/dist/assets/env-DJhnLOH7.css +1 -0
- package/dist/assets/env-DN0vW4EI.js +1 -0
- package/dist/assets/{error-DFKtZBJ8.js → error-DgrgRbJJ.js} +1 -1
- package/dist/assets/{error-DE4zo8Lk.js → error-Dug56can.js} +1 -1
- package/dist/assets/health-7oIQODer.css +1 -0
- package/dist/assets/health-Z6m96GDr.js +1 -0
- package/dist/assets/history-BOwbCRQP.css +1 -0
- package/dist/assets/history-BxlpB-YH.js +1 -0
- package/dist/assets/incoming-BOxRVlOM.js +2 -0
- package/dist/assets/incoming-DWDrmxyH.css +1 -0
- package/dist/assets/index-BUq-MczL.js +86 -0
- package/dist/assets/{index-D4MsP3dq.css → index-DtmBqE3h.css} +1 -1
- package/dist/assets/{integrations-B4txOZfY.js → integrations-BFltGDVI.js} +1 -1
- package/dist/assets/issues-1iS5zoed.js +1 -0
- package/dist/assets/issues-XnpGgdmn.css +1 -0
- package/dist/assets/layout-BkWVNT37.js +1 -0
- package/dist/assets/lazy-NHSwD9FS.js +1 -0
- package/dist/assets/mdi-C54lQ0i_.js +1 -0
- package/dist/assets/{pages-BW2l8fNe.js → pages-DuMgH61T.js} +1 -1
- package/dist/assets/{placement-JxzrmUR3.js → placement-CwTqWLQH.js} +1 -1
- package/dist/assets/placement-DLsU3pCW.js +1 -0
- package/dist/assets/pull-requests-BJOwNL4k.js +1 -0
- package/dist/assets/pull-requests-CdbhyFOv.css +1 -0
- package/dist/assets/{repository-BTC3lkrh.js → repository-JWLVST3D.js} +1 -1
- package/dist/assets/{VAvatar-CAFvgSUo.js → ripple-BVltMmyV.js} +2 -2
- package/dist/assets/ripple-DqhAt1Ze.css +1 -0
- package/dist/assets/runtime-core.esm-bundler-DGXg_mpN.js +3 -0
- package/dist/assets/{session-CG-TUCJt.css → session-5qADMzDP.css} +1 -1
- package/dist/assets/session-C5Nj8Dlq.js +1 -0
- package/dist/assets/settings-BopLnpB0.css +1 -0
- package/dist/assets/settings-c273Ikrm.js +1 -0
- package/dist/assets/ssrBoot-Rlh6kLbD.js +1 -0
- package/dist/assets/{studioGateApi-C0GvzVlt.js → studioGateApi-DhA9IJGZ.js} +1 -1
- package/dist/assets/{studioUrls-CIab-Axb.js → studioUrls-Dj8rXeXO.js} +1 -1
- package/dist/assets/{useApi-BPuI6ZR9-Dr8wK_Co.js → useApi-BPuI6ZR9-CFWU1m37.js} +1 -1
- package/dist/assets/useArchivedVibe64Sessions-CVZx2Rtm.js +1 -0
- package/dist/assets/useCommand-DWuxfAV0.js +1 -0
- package/dist/assets/useEndpointResource-MWVNfmMa.js +1 -0
- package/dist/assets/{usePaths-DVTieF_G.js → usePaths-Db88-HOm.js} +1 -1
- package/dist/assets/{useUiFeedback-Tzi-PRlX.js → useUiFeedback-0FqKuZRP.js} +1 -1
- package/dist/assets/useVibe64ConversationLog-8cKh1eDm.js +1 -0
- package/dist/assets/useVibe64DatabaseTools-BcRG1s3i.js +1 -0
- package/dist/assets/useVibe64LearningMode-Bl0dGdCh.js +28 -0
- package/dist/assets/useVibe64LearningMode-C3PcXdVg.css +1 -0
- package/dist/assets/useVibe64ProjectScope-DOEVkBqX.js +1 -0
- package/dist/assets/useVibe64SessionData-DFTyLzci.js +1 -0
- package/dist/assets/useVibe64SessionSelection-j9lsllx4.js +1 -0
- package/dist/assets/useVibe64SystemGraph-tNkIwSBQ.js +1 -0
- package/dist/assets/{useVibe64Terminal-C2XJ9Y1K.js → useVibe64Terminal-BPnN25WH.js} +1 -1
- package/dist/assets/vibe64AssistantHost-DdE_-lZF.js +1 -0
- package/dist/assets/vibe64LessonDashboard-DlKYjisq.js +1 -0
- package/dist/assets/vibe64ProjectScope.local-DqT6e5un.js +1 -0
- package/dist/assets/vibe64RepositoryRealtime-DXk0Jai3.js +1 -0
- package/dist/assets/vibe64SessionFocus-OJ2toBd9.css +1 -0
- package/dist/assets/vibe64SessionFocus-kqPOPaOH.js +1 -0
- package/dist/assets/{vibe64SessionInfo-D8l22MFm.js → vibe64SessionInfo-BHxtTrLX.js} +1 -1
- package/dist/assets/vibe64SessionToolDefinitions-NfLd1HZI.js +1 -0
- package/dist/assets/vue-flow-core-BlVEnES8.js +26 -0
- package/dist/index.html +51 -48
- package/docs/colleague-usage/account-profile-and-appearance.md +29 -0
- package/docs/colleague-usage/ai-accounts-and-routing.md +23 -4
- package/docs/colleague-usage/ai-balance-and-allowance.md +4 -0
- package/docs/colleague-usage/architecture-explanations.md +99 -0
- package/docs/colleague-usage/auto-workflow.md +49 -11
- package/docs/colleague-usage/coding-agent-failures.md +94 -0
- package/docs/colleague-usage/coding-agent-goal-pause.md +110 -0
- package/docs/colleague-usage/coding-agent-goals.md +140 -38
- package/docs/colleague-usage/coding-agent-history.md +20 -2
- package/docs/colleague-usage/coding-agent-recovery.md +136 -0
- package/docs/colleague-usage/coding-agents.md +138 -150
- package/docs/colleague-usage/colleague-recovery.md +28 -5
- package/docs/colleague-usage/colleague-upgrade-recovery.md +4 -0
- package/docs/colleague-usage/colleague-watches.md +84 -0
- package/docs/colleague-usage/colleague.md +18 -34
- package/docs/colleague-usage/connected-contributions.md +196 -0
- package/docs/colleague-usage/connected-projects.md +196 -0
- package/docs/colleague-usage/conversation-context.md +67 -1
- package/docs/colleague-usage/dashboard-navigation.md +79 -5
- package/docs/colleague-usage/database.md +11 -0
- package/docs/colleague-usage/developing-vibe64.md +137 -0
- package/docs/colleague-usage/development-copies.md +20 -0
- package/docs/colleague-usage/development-env.md +34 -0
- package/docs/colleague-usage/file-interfaces.md +156 -0
- package/docs/colleague-usage/github-work.md +88 -1
- package/docs/colleague-usage/health-checks.md +32 -0
- package/docs/colleague-usage/incoming-changes.md +94 -0
- package/docs/colleague-usage/learning-chat-retention.md +11 -2
- package/docs/colleague-usage/learning-code-questions.md +55 -0
- package/docs/colleague-usage/learning-course-catalogue.md +118 -0
- package/docs/colleague-usage/learning-diagrams-and-voice.md +97 -0
- package/docs/colleague-usage/learning-history.md +17 -9
- package/docs/colleague-usage/learning-lesson-watch.md +95 -0
- package/docs/colleague-usage/learning-mode-ui.md +187 -85
- package/docs/colleague-usage/learning-native-session.md +12 -10
- package/docs/colleague-usage/learning-practical-exercises.md +71 -0
- package/docs/colleague-usage/learning-practical-gestures.md +18 -1
- package/docs/colleague-usage/learning-practice-projects.md +55 -4
- package/docs/colleague-usage/learning-session-creation.md +7 -7
- package/docs/colleague-usage/learning-teacher-guide.md +52 -0
- package/docs/colleague-usage/learning-with-colleague.md +59 -80
- package/docs/colleague-usage/lesson-authoring.md +12 -4
- package/docs/colleague-usage/lesson-practical-assessment.md +3 -1
- package/docs/colleague-usage/managed-app-access.md +6 -0
- package/docs/colleague-usage/message-delivery-recovery.md +56 -0
- package/docs/colleague-usage/plans.md +14 -7
- package/docs/colleague-usage/preview-browser-checks.md +61 -0
- package/docs/colleague-usage/preview-lesson-presentation.md +56 -0
- package/docs/colleague-usage/preview-starting-application.md +92 -0
- package/docs/colleague-usage/preview.md +70 -96
- package/docs/colleague-usage/project-architecture.md +229 -0
- package/docs/colleague-usage/project-language-tools.md +31 -0
- package/docs/colleague-usage/project-messages.md +106 -0
- package/docs/colleague-usage/project-settings.md +22 -0
- package/docs/colleague-usage/project-setup.md +29 -2
- package/docs/colleague-usage/session-terminal.md +42 -0
- package/docs/colleague-usage/sessions.md +122 -52
- package/docs/colleague-usage/teaching-content.md +12 -6
- package/docs/colleague-usage/temporary-chat-context.md +29 -0
- package/docs/colleague-usage/temporary-chats.md +95 -2
- package/docs/colleague-usage/voice-chat.md +10 -43
- package/docs/colleague-usage/voice-face-and-speaking-voice.md +73 -0
- package/docs/colleague-usage/workspace-preparation.md +89 -0
- package/docs/training-content.md +208 -7
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/README.md +29 -0
- package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
- package/node_modules/@jskit-ai/http-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/kernel/package.json +1 -1
- package/node_modules/@jskit-ai/payments-core/package.json +1 -1
- package/node_modules/@jskit-ai/realtime/package.json +1 -1
- package/node_modules/@jskit-ai/resource-core/package.json +1 -1
- package/node_modules/@jskit-ai/resource-crud-core/package.json +1 -1
- package/node_modules/@jskit-ai/uploads-runtime/package.json +1 -1
- package/node_modules/@local/vibe64-core/package.json +1 -0
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +280 -272
- package/node_modules/@local/vibe64-genesis/README.md +15 -0
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +879 -1225
- package/node_modules/@local/vibe64-genesis/package.json +2 -1
- package/node_modules/@local/vibe64-genesis/src/server/index.js +496 -418
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +165 -146
- package/node_modules/@local/vibe64-runtime/src/server/agentSessionCommandHook.js +8 -8
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +128 -129
- package/node_modules/@local/vibe64-system-graph/README.md +136 -6
- package/node_modules/@local/vibe64-terminals/package.json +3 -0
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1527 -1326
- package/node_modules/@local/vibe64-training/package.json +6 -1
- package/node_modules/@local/vibe64-voice/package.json +1 -0
- package/package.json +16 -16
- package/server.bundle.mjs +42853 -40268
- package/dist/assets/StudioErrorNotice-Ccjvcn9C.js +0 -1
- package/dist/assets/VAlert-B7ciJKQL.js +0 -1
- package/dist/assets/VAutocomplete-QjMk5d_j.js +0 -1
- package/dist/assets/VAvatar-nHaK192T.css +0 -1
- package/dist/assets/VBtn-Kl_qcBsy.js +0 -1
- package/dist/assets/VCard-nrJPeo91.js +0 -1
- package/dist/assets/VCheckbox-DTRAWOIf.js +0 -1
- package/dist/assets/VChip-Dfs5jX0f.js +0 -1
- package/dist/assets/VDialog-Dt1VjJg1.js +0 -1
- package/dist/assets/VDivider-DFsS0OTx.js +0 -1
- package/dist/assets/VExpansionPanels-CYKU0cAr.js +0 -1
- package/dist/assets/VMenu-BLxobsuU.js +0 -1
- package/dist/assets/VOverlay-BvFVZKNS.js +0 -1
- package/dist/assets/VRadioGroup-DzQzpCfg.js +0 -1
- package/dist/assets/VRow-BR2RMCM1.js +0 -1
- package/dist/assets/VSheet-BA95RNmA.js +0 -1
- package/dist/assets/VSkeletonLoader-hpJqr0HL.js +0 -1
- package/dist/assets/VSpacer-B1l1hVvU.js +0 -1
- package/dist/assets/VTextField-CA_p3N4d.js +0 -1
- package/dist/assets/VTextarea-NyCqY4h5.js +0 -1
- package/dist/assets/Vibe64AsyncModuleState-DEFlqJ97.js +0 -1
- package/dist/assets/Vibe64DashboardShell-BNv2I-P8.js +0 -1
- package/dist/assets/Vibe64DashboardShell-w20wNTGW.css +0 -1
- package/dist/assets/Vibe64DatabaseWorkspace-CuY5lN1o.js +0 -43
- package/dist/assets/Vibe64OutputControls-D2JuYlYU.js +0 -8
- package/dist/assets/Vibe64SessionFiles-C-rWehq_.js +0 -34
- package/dist/assets/Vibe64SessionFiles-Dsr6KQNP.css +0 -1
- package/dist/assets/Vibe64SubsystemsView-BvdU_o6H.css +0 -1
- package/dist/assets/Vibe64SubsystemsView-DJCjSzQM.js +0 -1
- package/dist/assets/Vibe64SystemWorldView-B91ioQaO.js +0 -4312
- package/dist/assets/Vibe64SystemWorldView-BXiQ7_Qb.css +0 -1
- package/dist/assets/Vibe64UnavailableSessions-OvnoD3ZB.js +0 -1
- package/dist/assets/_sessionId_-JTvMh54L.js +0 -1
- package/dist/assets/_slug_-DP_heCDa.js +0 -1
- package/dist/assets/_slug_-DmBZGb0q.css +0 -1
- package/dist/assets/access-C8GQIS19.js +0 -1
- package/dist/assets/app-B83lF61Y.js +0 -1
- package/dist/assets/app-ByLIQ3SB.css +0 -1
- package/dist/assets/assistantRouting-TDtryU6o.js +0 -1
- package/dist/assets/createSimpleFunctional-DPIT6zsT.js +0 -1
- package/dist/assets/dashboard-CWGFPojJ.js +0 -1
- package/dist/assets/definitions-BeLcvOW3.js +0 -1
- package/dist/assets/display-BLmcO-5p.js +0 -1
- package/dist/assets/env-7bqFyF_E.css +0 -1
- package/dist/assets/env-BVwxNL8M.js +0 -1
- package/dist/assets/health-BzNhp7r8.js +0 -1
- package/dist/assets/health-DoHTXTGx.css +0 -1
- package/dist/assets/history-BPeZGofK.js +0 -1
- package/dist/assets/history-iMQxp5AR.css +0 -1
- package/dist/assets/httpClient-BaaZuFvF.js +0 -1
- package/dist/assets/index-5sKwLHOH.js +0 -86
- package/dist/assets/issues-DCEhGlfn.css +0 -1
- package/dist/assets/issues-wby50y9b.js +0 -3
- package/dist/assets/layout-YCn17mK1.js +0 -1
- package/dist/assets/lazy-CvQfXeLg.js +0 -1
- package/dist/assets/mdi-C31_SZp-.js +0 -1
- package/dist/assets/placement-C4R2t6rl.js +0 -1
- package/dist/assets/pull-requests-BNK6mq2u.css +0 -1
- package/dist/assets/pull-requests-lNQAigaC.js +0 -1
- package/dist/assets/runtime-core.esm-bundler-DMrccYS5.js +0 -3
- package/dist/assets/session-D38nzG41.js +0 -1
- package/dist/assets/settings-CFyUJ_kR.js +0 -1
- package/dist/assets/settings-vWsAEoE9.css +0 -1
- package/dist/assets/useArchivedVibe64Sessions-C2DSq2Z4.js +0 -1
- package/dist/assets/useCommand-BzThFLYP.js +0 -1
- package/dist/assets/useEndpointResource-C2KD4Ub_.js +0 -1
- package/dist/assets/useVibe64ConversationLog-CMUlXJtU.js +0 -1
- package/dist/assets/useVibe64DatabaseTools-DBcKhm6B.js +0 -1
- package/dist/assets/useVibe64LearningMode-BPRWM5Rp.js +0 -28
- package/dist/assets/useVibe64LearningMode-PJUv0O25.css +0 -1
- package/dist/assets/useVibe64SessionData-CdtJbAIx.js +0 -1
- package/dist/assets/useVibe64SessionSelection-aR0f6xVT.js +0 -1
- package/dist/assets/useVibe64SystemGraph-DeTPBn0e.js +0 -1
- package/dist/assets/vibe64AssistantHost-Dgyz4TrT.js +0 -1
- package/dist/assets/vibe64ProjectScope.local-GOSMVDRi.js +0 -1
- package/dist/assets/vibe64RepositoryRealtime-t5Al8BlU.js +0 -1
- package/dist/assets/vibe64SessionFocus-CcN6Grgw.js +0 -1
- package/dist/assets/vibe64SessionFocus-ChabllPA.css +0 -1
- package/dist/assets/vibe64SessionToolDefinitions-BaO1DEup.js +0 -1
- /package/dist/assets/{vibe64RepositoryRealtime-D_mq1dFE.css → Vibe64TemporaryAiFixAction-D_mq1dFE.css} +0 -0
|
@@ -1,120 +1,120 @@
|
|
|
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
|
|
4
|
-
enumerable:!(n=
|
|
2
|
+
var Dp=Object.create;var As=Object.defineProperty;var Lp=Object.getOwnPropertyDescriptor;var Bp=Object.getOwnPropertyNames;var Up=Object.getPrototypeOf,zp=Object.prototype.hasOwnProperty;var _e=(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 Gp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bp(t))!zp.call(e,o)&&o!==r&&As(e,o,{get:()=>t[o],
|
|
4
|
+
enumerable:!(n=Lp(t,o))||n.enumerable});return e};var Fp=(e,t,r)=>(r=e!=null?Dp(Up(e)):{},Gp(t||!e||!e.__esModule?As(r,"default",{value:e,enumerable:!0}):r,e));var ia=V((OI,oa)=>{oa.exports=na;na.sync=Xm;var ta=_e("fs");function Km(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 ra(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Km(
|
|
7
|
+
t,r)}function na(e,t,r){ta.stat(e,function(n,o){r(n,n?!1:ra(o,e,t))})}function Xm(e,t){return ra(ta.statSync(e),e,t)}});var ua=V((CI,la)=>{la.exports=aa;aa.sync=Jm;var sa=_e("fs");function aa(e,t,r){sa.stat(e,function(n,o){r(n,n?!1:ca(o,t))})}
|
|
8
|
+
function Jm(e,t){return ca(sa.statSync(e),t)}function ca(e,t){return e.isFile()&&Zm(e,t)}function Zm(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(f)?f.slice(1,-1):f,m=
|
|
21
|
-
if(d===o.length)return f(a(u+1));let m=o[d];
|
|
22
|
-
return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},
|
|
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 f=u+n[d];try{if(
|
|
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 fa=V((kI,da)=>{var xI=_e("fs"),hr;process.platform==="win32"||global.TESTING_WINDOWS?hr=ia():hr=ua();da.exports=lo;lo.
|
|
11
|
+
sync=Qm;function lo(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){lo(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 Qm(e,t){try{return hr.sync(e,t||{})}catch(r){
|
|
14
|
+
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var ya=V((NI,wa)=>{var Ve=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",pa=_e("path"),
|
|
15
|
+
eh=Ve?";":":",ma=fa(),ha=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),ga=(e,t)=>{let r=t.colon||eh,n=e.
|
|
16
|
+
match(/\//)||Ve&&e.match(/\\/)?[""]:[...Ve?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=Ve?t.pathExt||
|
|
17
|
+
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=Ve?o.split(r):[""];return Ve&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(
|
|
18
|
+
""),{pathEnv:n,pathExt:i,pathExtExe:o}},ba=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,
|
|
19
|
+
pathExtExe:i}=ga(e,t),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return t.all&&s.length?u(s):d(ha(e));let f=n[l],p=/^".*"$/.
|
|
20
|
+
test(f)?f.slice(1,-1):f,m=pa.join(p,e),h=!p&&/^\.[\\\/]/.test(e)?e.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{
|
|
21
|
+
if(d===o.length)return f(a(u+1));let m=o[d];ma(l+m,{pathExt:i},(h,_)=>{if(!h&&_)if(t.all)s.push(l+m);else return f(l+m);
|
|
22
|
+
return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},th=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=ga(
|
|
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=pa.join(c,e),u=!c&&/^\.[\\\/]/.test(
|
|
24
|
+
e)?e.slice(0,2)+l:l;for(let d=0;d<n.length;d++){let f=u+n[d];try{if(ma.sync(f,{pathExt:o}))if(t.all)i.push(f);else return f}catch{}}}
|
|
25
|
+
if(t.all&&i.length)return i;if(t.nothrow)return null;throw ha(e)};wa.exports=ba;ba.sync=th});var Sa=V(($I,uo)=>{"use strict";var _a=(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"};uo.exports=_a;uo.exports.default=_a});var Aa=V((MI,Ta)=>{"use strict";var Ea=_e("path"),rh=ya(),nh=Sa();function va(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=rh.sync(e.command,{path:r[nh({env:r})],pathExt:t?Ea.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&
|
|
29
|
+
(s=Ea.resolve(o?e.options.cwd:"",s)),s}function oh(e){return va(e)||va(e,!0)}Ta.exports=oh});var Ia=V((DI,po)=>{"use strict";var fo=/([()\][%!^"`<>&|;, *?])/g;function ih(e){return e=e.replace(fo,"^$1"),e}function sh(e,t){
|
|
30
|
+
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(fo,
|
|
31
|
+
"^$1"),t&&(e=e.replace(fo,"^$1")),e}po.exports.command=ih;po.exports.argument=sh});var Pa=V((LI,Ra)=>{"use strict";Ra.exports=/^#!(.*)/});var Ca=V((BI,Oa)=>{"use strict";var ah=Pa();Oa.exports=(e="")=>{let t=e.match(ah);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 ka=V((UI,xa)=>{"use strict";var mo=_e("fs"),ch=Ca();function lh(e){let r=Buffer.alloc(150),n;try{n=mo.openSync(e,"r"),
|
|
33
|
+
mo.readSync(n,r,0,150,0),mo.closeSync(n)}catch{}return ch(r.toString())}xa.exports=lh});var Da=V((zI,Ma)=>{"use strict";var uh=_e("path"),Na=Aa(),$a=Ia(),dh=ka(),fh=process.platform==="win32",ph=/\.(?:com|exe)$/i,
|
|
34
|
+
mh=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function hh(e){e.file=Na(e);let t=e.file&&dh(e.file);return t?(e.args.unshift(
|
|
35
|
+
e.file),e.command=t,Na(e)):e.file}function gh(e){if(!fh)return e;let t=hh(e),r=!ph.test(t);if(e.options.forceShell||r){let n=mh.
|
|
36
|
+
test(t);e.command=uh.normalize(e.command),e.command=$a.command(e.command),e.args=e.args.map(i=>$a.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 bh(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:gh(n)}Ma.exports=bh});var Ua=V((GI,Ba)=>{"use strict";var ho=process.platform==="win32";function go(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 wh(e,t){
|
|
41
|
+
if(!ho)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=La(o,t);if(i)return r.call(e,"error",i)}return r.apply(
|
|
42
|
+
e,arguments)}}function La(e,t){return ho&&e===1&&!t.file?go(t.original,"spawn"):null}function yh(e,t){return ho&&e===1&&
|
|
43
|
+
!t.file?go(t.original,"spawnSync"):null}Ba.exports={hookChildProcess:wh,verifyENOENT:La,verifyENOENTSync:yh,notFoundError:go}});var Fa=V((FI,We)=>{"use strict";var za=_e("child_process"),bo=Da(),wo=Ua();function Ga(e,t,r){let n=bo(e,t,r),o=za.spawn(
|
|
44
|
+
n.command,n.args,n.options);return wo.hookChildProcess(o,n),o}function _h(e,t,r){let n=bo(e,t,r),o=za.spawnSync(n.command,
|
|
45
|
+
n.args,n.options);return o.error=o.error||wo.verifyENOENTSync(o.status,n),o}We.exports=Ga;We.exports.spawn=Ga;We.exports.
|
|
46
|
+
sync=_h;We.exports._parse=bo;We.exports._enoent=wo});import{existsSync as oT}from"node:fs";import iT from"node:path";import{execFile as Hp}from"node:child_process";import{readFile as jp}from"node:fs/promises";import Is from"node:os";import Vp from"node:path";
|
|
47
|
+
import{promisify as Wp}from"node:util";var qp=Wp(Hp);function Qt(e=""){return String(e||"").trim()}function Rs(e=""){let t=Qt(e);if(!t||t.includes("/")||t.includes("\\")||t.
|
|
48
48
|
includes(":")){let r=new Error("A valid OS username is required.");throw r.code="vibe64_invalid_os_username",r}return t}
|
|
49
|
-
function
|
|
49
|
+
function Vn(e=""){let t=String(e||"").trim().split(":");if(t.length<7||!/^\d+$/u.test(t[2])||!/^\d+$/u.test(t[3]))return null;
|
|
50
50
|
let r=Number(t[2]),n=Number(t[3]);return!Number.isSafeInteger(r)||r<0||!Number.isSafeInteger(n)||n<0?null:{displayName:String(
|
|
51
|
-
t[4]||"").split(",")[0],gid:n,home:String(t[5]||""),shell:String(t[6]||""),uid:r,username:String(t[0]||"")}}function
|
|
52
|
-
homedir:e=
|
|
53
|
-
env.LOGNAME),o=
|
|
54
|
-
r?.gid)?r.gid:null,home:o,shell:String(r?.shell||""),uid:Number.isSafeInteger(r?.uid)?r.uid:null,username:n}}async function
|
|
55
|
-
execFileFn:t=
|
|
51
|
+
t[4]||"").split(",")[0],gid:n,home:String(t[5]||""),shell:String(t[6]||""),uid:r,username:String(t[0]||"")}}function er({
|
|
52
|
+
homedir:e=Is.homedir,userInfo:t=Is.userInfo}={}){let r=typeof t=="function"?t():{},n=Qt(r?.username||process.env.USER||process.
|
|
53
|
+
env.LOGNAME),o=Vp.resolve(String(r?.homedir||e()||""));return{displayName:String(r?.username||n),gid:Number.isSafeInteger(
|
|
54
|
+
r?.gid)?r.gid:null,home:o,shell:String(r?.shell||""),uid:Number.isSafeInteger(r?.uid)?r.uid:null,username:n}}async function tr(e="",{
|
|
55
|
+
execFileFn:t=qp,platform:r=process.platform,readFileFn:n=jp}={}){let o=Rs(e);if(r==="linux"&&!/^\d+$/u.test(o)){let l=[...(await n(
|
|
56
56
|
"/etc/nsswitch.conf","utf8").catch(()=>"")).matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*)/gmu)],u=l.length===1?l[0][1].
|
|
57
57
|
trim().split(/\s+/u):[];if(u[0]==="files"&&(u.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(u[1]))){let f=(await n("/etc/pass\
|
|
58
|
-
wd","utf8").catch(()=>"")).split(/\r?\n/u).map(
|
|
59
|
-
wd",o],{encoding:"utf8"}),s=typeof i=="string"?i:i?.stdout,a=
|
|
60
|
-
let c=new Error(`OS user was not found: ${o}`);throw c.code="vibe64_os_user_not_found",c}return a}import
|
|
61
|
-
isSafeInteger(t)&&t>=0?t:null}function
|
|
62
|
-
"object"&&!Array.isArray(e)?e:{}}function
|
|
63
|
-
r??"")]).filter(([t])=>!!t))}function
|
|
64
|
-
has(o)||(r.add(o),t.push(o))}return t}function
|
|
65
|
-
gid:
|
|
66
|
-
return
|
|
67
|
-
join(r.home,".cache"),XDG_CONFIG_HOME:
|
|
68
|
-
return
|
|
69
|
-
"function"?process.getuid():null}}function
|
|
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,
|
|
58
|
+
wd","utf8").catch(()=>"")).split(/\r?\n/u).map(Vn).find(p=>p?.username===o);if(f)return f}}let i=await t("getent",["pass\
|
|
59
|
+
wd",o],{encoding:"utf8"}),s=typeof i=="string"?i:i?.stdout,a=Vn(String(s||"").split(/\r?\n/u)[0]);if(!a||a.username!==o){
|
|
60
|
+
let c=new Error(`OS user was not found: ${o}`);throw c.code="vibe64_os_user_not_found",c}return a}import Kp from"node:os";import qn from"node:path";import Yp from"node:path";function C(e=""){return String(e??"").trim()}function Wn(e=null){let t=Number(e);return Number.
|
|
61
|
+
isSafeInteger(t)&&t>=0?t:null}function O(e=""){let t=C(e);return t?Yp.resolve(t):""}function H(e={}){return e&&typeof e==
|
|
62
|
+
"object"&&!Array.isArray(e)?e:{}}function G(e={}){return Object.fromEntries(Object.entries(H(e)).map(([t,r])=>[C(t),String(
|
|
63
|
+
r??"")]).filter(([t])=>!!t))}function Pe(e=[]){let t=[],r=new Set;for(let n of Array.isArray(e)?e:[e]){let o=C(n);!o||r.
|
|
64
|
+
has(o)||(r.add(o),t.push(o))}return t}function me(...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}`:Kp.homedir()));return{displayName:C(e.displayName||t),
|
|
65
|
+
gid:Wn(e.gid),home:r,shell:C(e.shell),uid:Wn(e.uid),username:t}}function Yn(){return rr(er())}async function Kn(e="",t={}){
|
|
66
|
+
return rr(await tr(e,t))}function Xn(e={},t={}){let r=rr(e);return{...t,HOME:r.home,LOGNAME:r.username,USER:r.username,XDG_CACHE_HOME:qn.
|
|
67
|
+
join(r.home,".cache"),XDG_CONFIG_HOME:qn.join(r.home,".config"),XDG_DATA_HOME:qn.join(r.home,".local","share")}}function Jn(e={},t={}){
|
|
68
|
+
return Xn(e,t)}function Zn(){return{gid:typeof process.getgid=="function"?process.getgid():null,uid:typeof process.getuid==
|
|
69
|
+
"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 Xp}from"node:url";var Fe=(e,t)=>{let r=eo(Jp(e));if(typeof r!="string")throw new TypeError(`${t}\
|
|
71
|
+
must be a string or a file URL: ${r}.`);return r},Jp=e=>Qn(e)?e.toString():e,Qn=e=>typeof e!="string"&&e&&Object.getPrototypeOf(
|
|
72
|
+
e)===String.prototype,eo=e=>e instanceof URL?Xp(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
73
|
cond argument must be either an array of arguments or an options object: ${o}`);if(o.some(c=>typeof c=="object"&&c!==null))
|
|
74
74
|
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
|
-
if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!
|
|
76
|
-
t argument must be an options object: ${i}`);return[n,s,i]};import{ChildProcess as
|
|
77
|
-
Buffer]"
|
|
78
|
-
|
|
79
|
-
"string"))return e;let r=new
|
|
80
|
-
...n,o]},
|
|
81
|
-
|
|
75
|
+
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 om}from"node:child_process";import{StringDecoder as Zp}from"node:string_decoder";var{toString:Ps}=Object.prototype,Os=e=>Ps.call(e)==="[object Array\
|
|
77
|
+
Buffer]",B=e=>Ps.call(e)==="[object Uint8Array]",he=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Qp=new TextEncoder,
|
|
78
|
+
Cs=e=>Qp.encode(e),em=new TextDecoder,or=e=>em.decode(e),xs=(e,t)=>tm(e,t).join(""),tm=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i==
|
|
79
|
+
"string"))return e;let r=new Zp(t),n=e.map(i=>typeof i=="string"?Cs(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[
|
|
80
|
+
...n,o]},Et=e=>e.length===1&&B(e[0])?e[0]:to(rm(e)),rm=e=>e.map(t=>typeof t=="string"?Cs(t):t),to=e=>{let t=new Uint8Array(
|
|
81
|
+
nm(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},nm=e=>{let t=0;for(let r of e)t+=r.length;return t};var Ms=e=>Array.isArray(e)&&Array.isArray(e.raw),Ds=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=im({templates:e,expressions:t,
|
|
82
82
|
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
|
|
83
|
+
n,o,{}]},im=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backs\
|
|
84
|
+
lash sequence: ${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=sm(o,e.raw[n]),c=Ns(r,i,s);if(n===
|
|
85
|
+
t.length)return c;let l=t[n],u=Array.isArray(l)?l.map(d=>$s(d)):[$s(l)];return Ns(c,u,a)},sm=(e,t)=>{if(t.length===0)return{
|
|
86
|
+
nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=ks.has(t[0]);for(let s=0,a=0;s<e.length;s+=1,
|
|
87
|
+
a+=1){let c=t[a];if(ks.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"){let l=t[a+1];l===`
|
|
88
|
+
`?(s-=1,a+=1):l==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=am[l]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,
|
|
89
|
+
leadingWhitespaces:o,trailingWhitespaces:i}},ks=new Set([" "," ","\r",`
|
|
90
|
+
`]),am={x:3,u:5},Ns=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(
|
|
91
|
+
1)],$s=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(L(e)&&("stdout"in e||"isMaxBuffer"in
|
|
92
|
+
e))return cm(e);throw e instanceof om||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected \
|
|
93
93
|
subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected \
|
|
94
|
-
"${t}" in template expression`)},
|
|
94
|
+
"${t}" in template expression`)},cm=({stdout:e})=>{if(typeof e=="string")return e;if(B(e))return or(e);throw e===void 0?
|
|
95
95
|
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,
|
|
96
|
+
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as fy}from"node:child_process";import{debuglog as lm}from"node:util";import ro from"node:process";var re=e=>ir.includes(e),ir=[ro.stdin,ro.stdout,ro.stderr],J=["stdin","stdout","stderr"],sr=e=>J[e]??
|
|
97
|
+
`stdio[${e}]`;var Bs=e=>{let t={...e};for(let r of io)t[r]=no(e,r);return t},no=(e,t)=>{let r=Array.from({length:um(e)+1}),n=dm(e[t],r,
|
|
98
|
+
t);return gm(n,t)},um=({stdio:e})=>Array.isArray(e)?Math.max(e.length,J.length):J.length,dm=(e,t,r)=>L(e)?fm(e,t,r):t.fill(
|
|
99
|
+
e),fm=(e,t,r)=>{for(let n of Object.keys(e).sort(pm))for(let o of mm(n,r,t))t[o]=e[n];return t},pm=(e,t)=>Ls(e)<Ls(t)?1:
|
|
100
|
+
-1,Ls=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,mm=(e,t,r)=>{if(e==="ipc")return[r.length-1];let n=oo(e);if(n===void 0||
|
|
101
101
|
n===0)throw new TypeError(`"${t}.${e}" is invalid.
|
|
102
102
|
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(n>=r.length)
|
|
103
103
|
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
|
|
109
|
-
"function",
|
|
110
|
-
n=r.join(" "),o=r.map(i=>
|
|
111
|
-
`).map(t=>
|
|
112
|
-
`),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,
|
|
104
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},oo=e=>{if(e==="all")return e;
|
|
105
|
+
if(J.includes(e))return J.indexOf(e);let t=hm.exec(e);if(t!==null)return Number(t[1])},hm=/^fd(\d+)$/,gm=(e,t)=>e.map(r=>r===
|
|
106
|
+
void 0?wm[t]:r),bm=lm("execa").enabled?"full":"none",wm={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:bm,stripFinalNewline:!0},
|
|
107
|
+
io=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],ge=(e,t)=>t==="ipc"?e.at(-1):e[t];var He=({verbose:e},t)=>so(e,t)!=="none",je=({verbose:e},t)=>!["none","short"].includes(so(e,t)),Us=({verbose:e},t)=>{let r=so(
|
|
108
|
+
e,t);return ar(r)?r:void 0},so=(e,t)=>t===void 0?ym(e):ge(e,t),ym=e=>e.find(t=>ar(t))??cr.findLast(t=>e.includes(t)),ar=e=>typeof e==
|
|
109
|
+
"function",cr=["none","short","full"];import{inspect as Gm}from"node:util";import{platform as _m}from"node:process";import{stripVTControlCharacters as Sm}from"node:util";var zs=(e,t)=>{let r=[e,...t],
|
|
110
|
+
n=r.join(" "),o=r.map(i=>Rm(Gs(i))).join(" ");return{command:n,escapedCommand:o}},vt=e=>Sm(e).split(`
|
|
111
|
+
`).map(t=>Gs(t)).join(`
|
|
112
|
+
`),Gs=e=>e.replaceAll(Tm,t=>Em(t)),Em=e=>{let t=Am[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=
|
|
113
|
+
Im?`\\u${n.padStart(4,"0")}`:`\\U${n}`},vm=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},
|
|
114
|
+
Tm=vm(),Am={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Im=65535,Rm=e=>Pm.test(e)?e:_m==="win32"?`"${e.
|
|
115
|
+
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,Pm=/^[\w./-]+$/;import Fs from"node:process";function ao(){let{env:e}=Fs,{TERM:t,TERM_PROGRAM:r}=e;return Fs.platform!=="win32"?t!=="lin\
|
|
116
116
|
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
|
|
117
|
+
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Hs={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",
|
|
118
118
|
squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\
|
|
119
119
|
\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",
|
|
120
120
|
triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\
|
|
@@ -154,55 +154,55 @@ lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUp
|
|
|
154
154
|
lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\
|
|
155
155
|
\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\
|
|
156
156
|
\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\
|
|
157
|
-
\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},
|
|
157
|
+
\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},js={tick:"\
|
|
158
158
|
\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\
|
|
159
159
|
\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\
|
|
160
160
|
\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",
|
|
161
161
|
pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\
|
|
162
162
|
\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",
|
|
163
|
-
oneNinth:"\u2151",oneTenth:"\u2152"},
|
|
163
|
+
oneNinth:"\u2151",oneTenth:"\u2152"},Om={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\
|
|
164
164
|
\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",
|
|
165
165
|
circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"\
|
|
166
166
|
( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\
|
|
167
167
|
\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"},
|
|
168
|
+
1/7",oneNinth:"1/9",oneTenth:"1/10"},Cm={...Hs,...js},xm={...Hs,...Om},km=ao(),Nm=km?Cm:xm,lr=Nm,QT=Object.entries(js);import $m from"node:tty";var Mm=$m?.WriteStream?.prototype?.hasColors?.()??!1,v=(e,t)=>{if(!Mm)return o=>o;let r=`\x1B[${e}\
|
|
169
169
|
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=
|
|
179
|
-
e.getHours(),2)}:${
|
|
180
|
-
t,"0"),
|
|
181
|
-
*",error:
|
|
182
|
-
o)).join("")},
|
|
170
|
+
a+=i.slice(c,s)+u,c=s+n.length,s=i.indexOf(n,c);return a+=i.slice(c)+n,a}},rA=v(0,0),Vs=v(1,22),nA=v(2,22),oA=v(3,23),iA=v(
|
|
171
|
+
4,24),sA=v("4:2",24),aA=v("4:3",24),cA=v("4:4",24),lA=v("4:5",24),uA=v(53,55),dA=v(7,27),fA=v(8,28),pA=v(9,29),mA=v(30,39),
|
|
172
|
+
hA=v(31,39),gA=v(32,39),bA=v(33,39),wA=v(34,39),yA=v(35,39),_A=v(36,39),SA=v(37,39),ur=v(90,39),EA=v(40,49),vA=v(41,49),
|
|
173
|
+
TA=v(42,49),AA=v(43,49),IA=v(44,49),RA=v(45,49),PA=v(46,49),OA=v(47,49),CA=v(100,49),Ws=v(91,39),xA=v(92,39),qs=v(93,39),
|
|
174
|
+
kA=v(94,39),NA=v(95,39),$A=v(96,39),MA=v(97,39),DA=v(101,49),LA=v(102,49),BA=v(103,49),UA=v(104,49),zA=v(105,49),GA=v(106,
|
|
175
|
+
49),FA=v(107,49),HA=v("58;5;0",59),jA=v("58;5;1",59),VA=v("58;5;2",59),WA=v("58;5;3",59),qA=v("58;5;4",59),YA=v("58;5;5",
|
|
176
|
+
59),KA=v("58;5;6",59),XA=v("58;5;7",59),JA=v("58;5;8",59),ZA=v("58;5;9",59),QA=v("58;5;10",59),eI=v("58;5;11",59),tI=v("\
|
|
177
|
+
58;5;12",59),rI=v("58;5;13",59),nI=v("58;5;14",59),oI=v("58;5;15",59);var Xs=({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},options:{reject:s=!0}})=>{let a=Dm(r),
|
|
178
|
+
c=Lm[e]({failed:i,reject:s,piped:n}),l=Bm[e]({reject:s});return`${ur(`[${a}]`)} ${ur(`[${o}]`)} ${l(c)} ${l(t)}`},Dm=e=>`${dr(
|
|
179
|
+
e.getHours(),2)}:${dr(e.getMinutes(),2)}:${dr(e.getSeconds(),2)}.${dr(e.getMilliseconds(),3)}`,dr=(e,t)=>String(e).padStart(
|
|
180
|
+
t,"0"),Ys=({failed:e,reject:t})=>e?t?lr.cross:lr.warning:lr.tick,Lm={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"\
|
|
181
|
+
*",error:Ys,duration:Ys},Ks=e=>e,Bm={command:()=>Vs,output:()=>Ks,ipc:()=>Ks,error:({reject:e})=>e?Ws:qs,duration:()=>ur};var Js=(e,t,r)=>{let n=Us(t,r);return e.map(({verboseLine:o,verboseObject:i})=>Um(o,i,n)).filter(o=>o!==void 0).map(o=>zm(
|
|
182
|
+
o)).join("")},Um=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},zm=e=>e.endsWith(`
|
|
183
183
|
`)?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}),
|
|
184
|
+
`;var ce=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:n,result:o})=>{let i=Fm({type:e,result:o,verboseInfo:n}),s=Hm(t,
|
|
185
|
+
i),a=Js(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Fm=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{
|
|
186
|
+
piped:o=!1,...i}}})=>({type:e,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),Hm=(e,t)=>e.
|
|
187
187
|
split(`
|
|
188
|
-
`).map(r=>
|
|
189
|
-
t).replaceAll(" "," ".repeat(
|
|
190
|
-
void 0,
|
|
191
|
-
'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!
|
|
192
|
-
t)&&!
|
|
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
|
-
|
|
199
|
-
[...s,t].join(
|
|
200
|
-
o)}},
|
|
201
|
-
{env:e});return t.path=e[r],e[r]=
|
|
188
|
+
`).map(r=>jm({...t,message:r})),jm=e=>({verboseLine:Xs(e),verboseObject:e}),fr=e=>{let t=typeof e=="string"?e:Gm(e);return vt(
|
|
189
|
+
t).replaceAll(" "," ".repeat(Vm))},Vm=2;var Zs=(e,t)=>{He(t)&&ce({type:"command",verboseMessage:e,verboseInfo:t})};var Qs=(e,t,r)=>{Ym(e);let n=Wm(e);return{verbose:e,escapedCommand:t,commandId:n,rawOptions:r}},Wm=e=>He({verbose:e})?qm++:
|
|
190
|
+
void 0,qm=0n,Ym=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: \
|
|
191
|
+
'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!cr.includes(
|
|
192
|
+
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 ea}from"node:process";var pr=()=>ea.bigint(),co=e=>Number(ea.bigint()-e)/1e6;var mr=(e,t,r)=>{let n=pr(),{command:o,escapedCommand:i}=zs(e,t),s=no(r,"verbose"),a=Qs(s,i,{...r});return Zs(i,a),{command:o,
|
|
194
|
+
escapedCommand:i,startTime:n,verboseInfo:a}};var Qc=Fp(Fa(),1);import xg from"node:path";import Zc from"node:process";import wr from"node:process";import Oe from"node:path";function gr(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().
|
|
195
|
+
find(n=>n.toUpperCase()==="PATH")||"Path"}import{promisify as Sh}from"node:util";import{execFile as Eh,execFileSync as WI}from"node:child_process";import Ha from"node:path";
|
|
196
|
+
import{fileURLToPath as vh}from"node:url";var KI=Sh(Eh);function br(e){return e instanceof URL?vh(e):e}function ja(e){return{*[Symbol.iterator](){let t=Ha.resolve(br(e)),r;for(;r!==t;)yield t,r=t,t=Ha.resolve(t,"..")}}}var XI=10*
|
|
197
|
+
1024*1024;var Th=({cwd:e=wr.cwd(),path:t=wr.env[gr()],preferLocal:r=!0,execPath:n=wr.execPath,addExecPath:o=!0}={})=>{let i=Oe.resolve(
|
|
198
|
+
br(e)),s=[],a=t.split(Oe.delimiter);return r&&Ah(s,a,i),o&&Ih(s,a,n,i),t===""||t===Oe.delimiter?`${s.join(Oe.delimiter)}${t}`:
|
|
199
|
+
[...s,t].join(Oe.delimiter)},Ah=(e,t,r)=>{for(let n of ja(r)){let o=Oe.join(n,"node_modules/.bin");t.includes(o)||e.push(
|
|
200
|
+
o)}},Ih=(e,t,r,n)=>{let o=Oe.resolve(n,br(r),"..");t.includes(o)||e.push(o)},Va=({env:e=wr.env,...t}={})=>{e={...e};let r=gr(
|
|
201
|
+
{env:e});return t.path=e[r],e[r]=Th(t),e};import{setTimeout as Gh}from"node:timers/promises";var Wa=(e,t,r)=>{let n=r?At:Tt,o=e instanceof ne?{}:{cause:e};return new n(t,o)},ne=class extends Error{},qa=(e,t)=>{Object.
|
|
202
202
|
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"}),
|
|
203
|
+
Ka,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Ya=e=>yr(e)&&Ka in e,Ka=Symbol("isExecaError"),yr=e=>Object.prototype.
|
|
204
|
+
toString.call(e)==="[object Error]",Tt=class extends Error{};qa(Tt,Tt.name);var At=class extends Error{};qa(At,At.name);import{constants as It}from"node:os";import{constants as Ch}from"node:os";var Xa=()=>{let e=Za-Ja+1;return Array.from({length:e},Rh)},Rh=(e,t)=>({name:`SIGRT${t+1}`,number:Ja+t,action:"terminate",
|
|
205
|
+
description:"Application-specific signal (realtime)",standard:"posix"}),Ja=34,Za=64;import{constants as Ph}from"node:os";var Qa=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,
|
|
206
206
|
action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"\
|
|
207
207
|
User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine ins\
|
|
208
208
|
truction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"\
|
|
@@ -233,1044 +233,1059 @@ other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event"
|
|
|
233
233
|
action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"termina\
|
|
234
234
|
te",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"In\
|
|
235
235
|
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)
|
|
236
|
+
other"}];var yo=()=>{let e=Xa();return[...Qa,...e].map(Oh)},Oh=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{
|
|
237
|
+
let{signals:{[e]:s}}=Ph,a=s!==void 0;return{name:e,number:a?s:t,description:r,supported:a,action:n,forced:o,standard:i}};var xh=()=>{let e=yo();return Object.fromEntries(e.map(kh))},kh=({name:e,number:t,description:r,supported:n,action:o,forced:i,
|
|
238
|
+
standard:s})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s}],ec=xh(),Nh=()=>{let e=yo(),t=65,
|
|
239
|
+
r=Array.from({length:t},(n,o)=>$h(o,e));return Object.assign({},...r)},$h=(e,t)=>{let r=Mh(e,t);if(r===void 0)return{};let{
|
|
240
240
|
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:
|
|
241
|
+
forced:a,standard:c}}},Mh=(e,t)=>{let r=t.find(({name:n})=>Ch.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},
|
|
242
|
+
pR=Nh();var rc=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return oc(e,t)},nc=e=>e===
|
|
243
|
+
0?e:oc(e,"`subprocess.kill()`'s argument"),oc=(e,t)=>{if(Number.isInteger(e))return Dh(e,t);if(typeof e=="string")return Bh(
|
|
244
244
|
e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
245
|
-
${
|
|
245
|
+
${_o()}`)},Dh=(e,t)=>{if(tc.has(e))return tc.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not\
|
|
246
246
|
exist.
|
|
247
|
-
${
|
|
248
|
-
return e;throw e.toUpperCase()in
|
|
247
|
+
${_o()}`)},Lh=()=>new Map(Object.entries(It.signals).reverse().map(([e,t])=>[t,e])),tc=Lh(),Bh=(e,t)=>{if(e in It.signals)
|
|
248
|
+
return e;throw e.toUpperCase()in It.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'\
|
|
249
249
|
.`):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
|
|
256
|
-
let[n=r,o]=
|
|
257
|
-
st be an error instance or a signal name string/integer: ${String(n)}`);if(o!==void 0&&!
|
|
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 ${
|
|
250
|
+
${_o()}`)},_o=()=>`Available signal names: ${Uh()}.
|
|
251
|
+
Available signal numbers: ${zh()}.`,Uh=()=>Object.keys(It.signals).sort().map(e=>`'${e}'`).join(", "),zh=()=>[...new Set(
|
|
252
|
+
Object.values(It.signals).sort((e,t)=>e-t))].join(", "),_r=e=>ec[e].description;var ic=e=>{if(e===!1)return e;if(e===!0)return Fh;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKi\
|
|
253
|
+
llAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Fh=1e3*5,sc=({kill:e,options:{
|
|
254
|
+
forceKillAfterDelay:t,killSignal:r},onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:l}=Hh(s,a,r);jh(
|
|
255
|
+
l,n);let u=e(c);return Vh({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:u,context:o,controller:i}),u},Hh=(e,t,r)=>{
|
|
256
|
+
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
|
+
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:nc(n),error:o}},jh=(e,t)=>{
|
|
259
|
+
e!==void 0&&t.reject(e)},Vh=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:s})=>{
|
|
260
|
+
t===n&&o&&So({kill:e,forceKillAfterDelay:r,context:i,controllerSignal:s.signal})},So=async({kill:e,forceKillAfterDelay:t,
|
|
261
|
+
context:r,controllerSignal:n})=>{if(t!==!1)try{await Gh(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};import{once as Wh}from"node:events";var Sr=async(e,t)=>{e.aborted||await Wh(e,"abort",{signal:t})};var ac=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`T\
|
|
262
|
+
he \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},cc=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,
|
|
263
|
+
controller:o})=>t===void 0||r?[]:[qh(e,t,n,o)],qh=async(e,t,r,{signal:n})=>{throw await Sr(t,n),r.terminationReason??="c\
|
|
264
|
+
ancel",e.kill(),t.reason};import{scheduler as mg}from"node:timers/promises";import{promisify as dg}from"node:util";var qe=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{Yh(e,t,r),Eo(e,t,n)},Yh=(e,t,r)=>{if(!r)throw new Error(`${oe(
|
|
265
|
+
e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Eo=(e,t,r)=>{if(!r)throw new Error(`${oe(e,t)} cannot be us\
|
|
266
|
+
ed: the ${Se(t)} has already exited or disconnected.`)},lc=e=>{throw new Error(`${oe("getOneMessage",e)} could not compl\
|
|
267
|
+
ete: the ${Se(e)} exited or disconnected.`)},uc=e=>{throw new Error(`${oe("sendMessage",e)} failed: the ${Se(e)} is send\
|
|
268
268
|
ing a message too, instead of listening to incoming messages.
|
|
269
269
|
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
270
270
|
|
|
271
271
|
const [receivedMessage] = await Promise.all([
|
|
272
|
-
${
|
|
273
|
-
${
|
|
274
|
-
]);`)},
|
|
275
|
-
|
|
276
|
-
`${
|
|
277
|
-
Signal\` aborted: the ${
|
|
278
|
-
ing the `cancelSignal` subprocess option.")},
|
|
279
|
-
`${
|
|
280
|
-
if(
|
|
281
|
-
|
|
282
|
-
"could not be cloned","circular structure","call stack size exceeded"],
|
|
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(`"${
|
|
272
|
+
${oe("getOneMessage",e)},
|
|
273
|
+
${oe("sendMessage",e,"message, {strict: true}")},
|
|
274
|
+
]);`)},Er=(e,t)=>new Error(`${oe("sendMessage",t)} failed when sending an acknowledgment response to the ${Se(t)}.`,{cause:e}),
|
|
275
|
+
dc=e=>{throw new Error(`${oe("sendMessage",e)} failed: the ${Se(e)} is not listening to incoming messages.`)},fc=e=>{throw new Error(
|
|
276
|
+
`${oe("sendMessage",e)} failed: the ${Se(e)} exited without listening to incoming messages.`)},pc=()=>new Error(`\`cancel\
|
|
277
|
+
Signal\` aborted: the ${Se(!0)} disconnected.`),mc=()=>{throw new Error("`getCancelSignal()` cannot be used without sett\
|
|
278
|
+
ing the `cancelSignal` subprocess option.")},hc=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(
|
|
279
|
+
`${oe(t,r)} cannot be used: the ${Se(r)} is disconnecting.`,{cause:e})},gc=({error:e,methodName:t,isSubprocess:r,message:n})=>{
|
|
280
|
+
if(Kh(e))throw new Error(`${oe(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},
|
|
281
|
+
Kh=({code:e,message:t})=>Xh.has(e)||Jh.some(r=>t.includes(r)),Xh=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Jh=[
|
|
282
|
+
"could not be cloned","circular structure","call stack size exceeded"],oe=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`\
|
|
283
|
+
's `controller.abort()`":`${Zh(t)}${e}(${r})`,Zh=e=>e?"":"subprocess.",Se=e=>e?"parent process":"subprocess",Ye=e=>{e.connected&&
|
|
284
|
+
e.disconnect()};var le=()=>{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}=ue.get(e),i=bc(o,t,!0),s=e.stdio[i];if(s===null)throw new TypeError(
|
|
285
|
+
wc(i,t,n,!0));return s},Ke=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=ue.get(e),i=bc(o,t,!1),s=i==="all"?e.all:e.
|
|
286
|
+
stdio[i];if(s==null)throw new TypeError(wc(i,t,n,!1));return s},ue=new WeakMap,bc=(e,t,r)=>{let n=Qh(t,r);return eg(n,t,
|
|
287
|
+
r,e),n},Qh=(e,t)=>{let r=oo(e);if(r!==void 0)return r;let{validOptions:n,defaultValue:o}=t?{validOptions:'"stdin"',defaultValue:"\
|
|
288
|
+
stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Rt(t)}" must not be "${e}\
|
|
289
289
|
".
|
|
290
290
|
It must be ${n} or "fd3", "fd4" (and so on).
|
|
291
|
-
It is optional and defaults to "${o}".`)},
|
|
291
|
+
It is optional and defaults to "${o}".`)},eg=(e,t,r,n)=>{let o=n[yc(e)];if(o===void 0)throw new TypeError(`"${Rt(r)}" mu\
|
|
292
292
|
st not be ${t}. That file descriptor does not exist.
|
|
293
293
|
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.`},
|
|
294
|
+
`"${Rt(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(o.direction!=="input"&&r)throw new TypeError(
|
|
295
|
+
`"${Rt(r)}" must not be ${t}. It must be a writable stream, not readable.`)},wc=(e,t,r,n)=>{if(e==="all"&&!r.all)return`\
|
|
296
|
+
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=tg(e,r);return`The "${o}: ${vr(i)}"\
|
|
297
|
+
option is incompatible with using "${Rt(n)}: ${vr(t)}".
|
|
298
|
+
Please set this option with "pipe" instead.`},tg=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=yc(e);return i===0&&t!==
|
|
299
299
|
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},
|
|
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:
|
|
313
|
-
resolve({isDeadlock:!0,hasListeners:!1})},
|
|
314
|
-
if(e?.type!==
|
|
315
|
-
channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},
|
|
316
|
-
message:r}=e;return
|
|
317
|
-
|
|
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",
|
|
300
|
+
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},yc=e=>e==="all"?1:e,Rt=e=>e?"to":"from",vr=e=>typeof e==
|
|
301
|
+
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as ag}from"node:events";import{addAbortListener as rg}from"node:events";var Ce=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||
|
|
302
|
+
(e.setMaxListeners(n+t),rg(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as ig}from"node:events";import{once as ng}from"node:events";import{scheduler as og}from"node:timers/promises";var Ar=(e,t)=>{t&&vo(e)},vo=e=>{e.refCounted()},Ir=(e,t)=>{t&&To(e)},To=e=>{e.unrefCounted()},_c=(e,t)=>{t&&(To(e),To(e))},
|
|
303
|
+
Sc=(e,t)=>{t&&(vo(e),vo(e))};var Ec=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(Ac(o)||Rc(o))return;Rr.has(e)||Rr.set(e,[]);let i=Rr.
|
|
304
|
+
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await Ic(e,n,o),await og.yield();let s=await Tc({wrappedMessage:i[0],
|
|
305
|
+
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},vc=async({anyProcess:e,
|
|
306
|
+
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{Ao();let i=Rr.get(e);for(;i?.length>0;)await ng(n,"message:do\
|
|
307
|
+
ne");e.removeListener("message",o),Sc(t,r),n.connected=!1,n.emit("disconnect")},Rr=new WeakMap;var Ee=(e,t,r)=>{if(Pr.has(e))return Pr.get(e);let n=new ig;return n.connected=!0,Pr.set(e,n),sg({ipcEmitter:n,anyProcess:e,
|
|
308
|
+
channel:t,isSubprocess:r}),n},Pr=new WeakMap,sg=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=Ec.bind(void 0,
|
|
309
|
+
{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",vc.bind(void 0,{anyProcess:t,
|
|
310
|
+
channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),_c(r,n)},Or=e=>{let t=Pr.get(e);return t===void 0?e.channel!==
|
|
311
|
+
null:t.connected};var Pc=({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=Ee(e,t,r),s=kr(e,i);return{id:cg++,
|
|
312
|
+
type:xr,message:n,hasListeners:s}},cg=0n,Oc=(e,t)=>{if(!(t?.type!==xr||t.hasListeners))for(let{id:r}of e)r!==void 0&&Cr[r].
|
|
313
|
+
resolve({isDeadlock:!0,hasListeners:!1})},Tc=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{
|
|
314
|
+
if(e?.type!==xr||!t.connected)return e;let{id:i,message:s}=e,a={id:i,type:xc,message:kr(t,o)};try{await Nr({anyProcess:t,
|
|
315
|
+
channel:r,isSubprocess:n,ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},Ac=e=>{if(e?.type!==xc)return!1;let{id:t,
|
|
316
|
+
message:r}=e;return Cr[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Cc=async(e,t,r)=>{if(e?.type!==xr)return;let n=le();
|
|
317
|
+
Cr[e.id]=n;let o=new AbortController;try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,lg(t,r,o)]);i&&uc(r),s||
|
|
318
|
+
dc(r)}finally{o.abort(),delete Cr[e.id]}},Cr={},lg=async(e,t,{signal:r})=>{Ce(e,1,r),await ag(e,"disconnect",{signal:r}),
|
|
319
|
+
fc(t)},xr="execa:ipc:request",xc="execa:ipc:response";var kc=(e,t,r)=>{Pt.has(e)||Pt.set(e,new Set);let n=Pt.get(e),o=le(),i=r?t.id:void 0,s={onMessageSent:o,id:i};return n.add(
|
|
320
|
+
s),{outgoingMessages:n,outgoingMessage:s}},Nc=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},
|
|
321
|
+
Ic=async(e,t,r)=>{for(;!kr(e,t)&&Pt.get(e)?.size>0;){let n=[...Pt.get(e)];Oc(n,r),await Promise.all(n.map(({onMessageSent:o})=>o))}},
|
|
322
|
+
Pt=new WeakMap,kr=(e,t)=>t.listenerCount("message")>ug(e),ug=e=>ue.has(e)&&!ge(ue.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 qe({methodName:s,
|
|
323
|
+
isSubprocess:r,ipc:n,isConnected:e.connected}),fg({anyProcess:e,channel:t,methodName:s,isSubprocess:r,message:o,strict:i})},
|
|
324
|
+
fg=async({anyProcess:e,channel:t,methodName:r,isSubprocess:n,message:o,strict:i})=>{let s=Pc({anyProcess:e,channel:t,isSubprocess:n,
|
|
325
|
+
message:o,strict:i}),a=kc(e,s,i);try{await Ro({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){
|
|
326
|
+
throw Ye(e),c}finally{Nc(a)}},Ro=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=pg(
|
|
327
|
+
e);try{await Promise.all([Cc(n,e,r),i(n)])}catch(s){throw hc({error:s,methodName:t,isSubprocess:r}),gc({error:s,methodName:t,
|
|
328
|
+
isSubprocess:r,message:o}),s}},pg=e=>{if(Io.has(e))return Io.get(e);let t=dg(e.send.bind(e));return Io.set(e,t),t},Io=new WeakMap;var Mc=(e,t)=>{let r="cancelSignal";return Eo(r,!1,e.connected),Ro({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{
|
|
329
|
+
type:Lc,message:t},message:t})},Dc=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await hg({anyProcess:e,channel:t,
|
|
330
|
+
isSubprocess:r,ipc:n}),Po.signal),hg=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!$c){if($c=!0,!n){mc();return}
|
|
331
|
+
if(t===null){Ao();return}Ee(e,t,r),await mg.yield()}},$c=!1,Rc=e=>e?.type!==Lc?!1:(Po.abort(e.message),!0),Lc="execa:ipc\
|
|
332
|
+
:cancel",Ao=()=>{Po.abort(pc())},Po=new AbortController;var Bc=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(t===void 0)throw new Error("The `cancelSigna\
|
|
333
333
|
l` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be \
|
|
334
334
|
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
|
|
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}}},
|
|
335
|
+
son' when setting the `gracefulCancel` option.")}},Uc=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,
|
|
336
|
+
context:o,controller:i})=>r?[gg({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:i})]:[],gg=async({
|
|
337
|
+
subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await Sr(t,o);let i=bg(t);throw await Mc(
|
|
338
|
+
e,i),So({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.terminationReason??="gracefulCancel",t.reason},
|
|
339
|
+
bg=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"st\
|
|
340
|
+
ack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as wg}from"node:timers/promises";var zc=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to b\
|
|
341
|
+
e a non-negative integer, got \`${e}\` (${typeof e})`)},Gc=(e,t,r,n)=>t===0||t===void 0?[]:[yg(e,t,r,n)],yg=async(e,t,r,{
|
|
342
|
+
signal:n})=>{throw await wg(t,void 0,{signal:n}),r.terminationReason??="timeout",e.kill(),new ne};import{execPath as _g,execArgv as Sg}from"node:process";import Fc from"node:path";var Hc=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{
|
|
343
|
+
options:{...e,node:!0}}},jc=(e,t,{node:r=!1,nodePath:n=_g,nodeOptions:o=Sg.filter(c=>!c.startsWith("--inspect")),cwd:i,execPath:s,
|
|
344
344
|
...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option ins\
|
|
345
|
-
tead.');let c=
|
|
345
|
+
tead.');let c=Fe(n,'The "nodePath" option'),l=Fc.resolve(i,c),u={...a,nodePath:l,node:r,cwd:i};if(!r)return[e,t,u];if(Fc.
|
|
346
346
|
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
|
|
347
|
+
"node".');return[l,[...o,e,...t],{ipc:!0,...u,shell:!1}]};import{serialize as Eg}from"node:v8";var Vc=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error(
|
|
348
|
+
"The `ipcInput` option cannot be set unless the `ipc` option is `true`.");Ag[r](e)}},vg=e=>{try{Eg(e)}catch(t){throw new Error(
|
|
349
|
+
"The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},Tg=e=>{try{JSON.stringify(e)}catch(t){
|
|
350
|
+
throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},Ag={advanced:vg,json:Tg},Wc=async(e,t)=>{
|
|
351
|
+
t!==void 0&&await e.sendMessage(t)};var Yc=({encoding:e})=>{if(Oo.has(e))return;let t=Rg(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${$r(
|
|
352
352
|
e)}\`.
|
|
353
|
-
Please rename it to ${
|
|
353
|
+
Please rename it to ${$r(t)}.`);let r=[...Oo].map(n=>$r(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${$r(
|
|
354
354
|
e)}\`.
|
|
355
|
-
Please rename it to one of: ${r}.`)},
|
|
356
|
-
n1","ascii"]),
|
|
357
|
-
if(t in
|
|
358
|
-
binary:"latin1"}
|
|
355
|
+
Please rename it to one of: ${r}.`)},Ig=new Set(["utf8","utf16le"]),W=new Set(["buffer","hex","base64","base64url","lati\
|
|
356
|
+
n1","ascii"]),Oo=new Set([...Ig,...W]),Rg=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();
|
|
357
|
+
if(t in qc)return qc[t];if(Oo.has(t))return t},qc={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",
|
|
358
|
+
binary:"latin1"},$r=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as Pg}from"node:fs";import Og from"node:path";import Cg from"node:process";var Kc=(e=Xc())=>{let t=Fe(e,'The "cwd" option');return Og.resolve(t)},Xc=()=>{try{return Cg.cwd()}catch(e){throw e.message=
|
|
359
359
|
`The current directory does not exist.
|
|
360
|
-
${e.message}`,e}},
|
|
360
|
+
${e.message}`,e}},Jc=(e,t)=>{if(t===Xc())return e;let r;try{r=Pg(t)}catch(n){return`The "cwd" option is invalid: ${t}.
|
|
361
361
|
${n.message}
|
|
362
362
|
${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
363
|
-
${e}`};var
|
|
364
|
-
l);return
|
|
365
|
-
|
|
366
|
-
s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},
|
|
363
|
+
${e}`};var Mr=(e,t,r)=>{r.cwd=Kc(r.cwd);let[n,o,i]=jc(e,t,r),{command:s,args:a,options:c}=Qc.default._parse(n,o,i),l=Bs(c),u=kg(
|
|
364
|
+
l);return zc(u),Yc(u),Vc(u),ac(u),Bc(u),u.shell=eo(u.shell),u.env=Ng(u),u.killSignal=rc(u.killSignal),u.forceKillAfterDelay=
|
|
365
|
+
ic(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!W.has(u.encoding)&&u.buffer[f]),Zc.platform==="win32"&&xg.basename(
|
|
366
|
+
s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kg=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:n=r,
|
|
367
367
|
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
368
|
ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:e,preferLocal:t,cwd:r,localDirectory:n,
|
|
369
369
|
encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),
|
|
370
|
-
|
|
371
|
-
cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s};var
|
|
372
|
-
Input must be a string or a Uint8Array");return
|
|
373
|
-
-1)===
|
|
374
|
-
`,
|
|
375
|
-
e.readable===void 0)&&typeof e.pipe=="function"}function
|
|
370
|
+
Ng=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...Zc.env,...e}:e;return r||n?Va({env:s,
|
|
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 pb}from"node:util";function Xe(e){if(typeof e=="string")return $g(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("\
|
|
372
|
+
Input must be a string or a Uint8Array");return Mg(e)}var $g=e=>e.at(-1)===el?e.slice(0,e.at(-2)===tl?-2:-1):e,Mg=e=>e.at(
|
|
373
|
+
-1)===Dg?e.subarray(0,e.at(-2)===Lg?-2:-1):e,el=`
|
|
374
|
+
`,Dg=el.codePointAt(0),tl="\r",Lg=tl.codePointAt(0);import{on as lb}from"node:events";import{finished as ub}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&&
|
|
375
|
+
e.readable===void 0)&&typeof e.pipe=="function"}function Co(e,{checkOpen:t=!0}={}){return ie(e,{checkOpen:t})&&(e.writable||
|
|
376
376
|
!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
|
|
377
|
+
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function xe(e,{checkOpen:t=!0}={}){return ie(e,{checkOpen:t})&&
|
|
378
378
|
(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
|
|
379
|
+
destroy=="function"&&typeof e.destroyed=="boolean"}function xo(e,t){return Co(e,t)&&xe(e,t)}var Bg=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),ko=class{#t;#r;#e=!1;#n=void 0;constructor(t,r){
|
|
380
380
|
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
381
|
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
382
|
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
383
|
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
|
|
384
|
+
await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},No=Symbol();function rl(){return this[No].next()}
|
|
385
|
+
Object.defineProperty(rl,"name",{value:"next"});function nl(e){return this[No].return(e)}Object.defineProperty(nl,"name",
|
|
386
|
+
{value:"return"});var Ug=Object.create(Bg,{next:{enumerable:!0,configurable:!0,writable:!0,value:rl},return:{enumerable:!0,
|
|
387
|
+
configurable:!0,writable:!0,value:nl}});function $o({preventCancel:e=!1}={}){let t=this.getReader(),r=new ko(t,e),n=Object.
|
|
388
|
+
create(Ug);return n[No]=r,n}var ol=e=>{if(xe(e,{checkOpen:!1})&&Ot.on!==void 0)return Gg(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;
|
|
389
|
+
if(zg.call(e)==="[object ReadableStream]")return $o.call(e);throw new TypeError("The first argument must be a Readable, \
|
|
390
|
+
a ReadableStream, or an async iterable.")},{toString:zg}=Object.prototype,Gg=async function*(e){let t=new AbortController,
|
|
391
|
+
r={};Fg(e,t,r);try{for await(let[n]of Ot.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;
|
|
392
|
+
if(!t.signal.aborted)throw n}finally{e.destroy()}},Fg=async(e,t,r)=>{try{await Ot.finished(e,{cleanup:!0,readable:!0,writable:!1,
|
|
393
|
+
error:!1})}catch(n){r.error=n}finally{t.abort()}},Ot={};var Je=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.
|
|
394
|
+
POSITIVE_INFINITY}={})=>{let l=ol(e),u=t();u.length=0;try{for await(let d of l){let f=jg(d),p=r[f](d,u);al({convertedChunk:p,
|
|
395
|
+
state:u,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return Hg({state:u,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,
|
|
396
396
|
getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),
|
|
397
|
-
f}},
|
|
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=
|
|
397
|
+
f}},Hg=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let s=o(e);s!==void 0&&al({convertedChunk:s,
|
|
398
|
+
state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},al=({convertedChunk:e,state:t,getSize:r,truncateChunk:n,addChunk:o,
|
|
399
|
+
maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){il(e,t,o,a);return}let c=n(e,i-t.length);throw c!==void 0&&il(c,t,o,i),
|
|
400
|
+
new de},il=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},jg=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="obje\
|
|
401
|
+
ct"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=sl.call(e);return r==="[object Array\
|
|
402
402
|
Buffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&
|
|
403
|
-
|
|
404
|
-
MaxBufferError";constructor(){super("maxBuffer exceeded")}};var
|
|
405
|
-
|
|
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},
|
|
403
|
+
sl.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:sl}=Object.prototype,de=class extends Error{name="\
|
|
404
|
+
MaxBufferError";constructor(){super("maxBuffer exceeded")}};var be=e=>e,Ct=()=>{},Lr=({contents:e})=>e,Br=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},
|
|
405
|
+
Ur=e=>e.length;async function zr(e,t){return Je(e,Yg,t)}var Vg=()=>({contents:[]}),Wg=()=>1,qg=(e,{contents:t})=>(t.push(e),t),Yg={init:Vg,
|
|
406
|
+
convertChunk:{string:be,buffer:be,arrayBuffer:be,dataView:be,typedArray:be,others:be},getSize:Wg,truncateChunk:Ct,addChunk:qg,
|
|
407
|
+
getFinalChunk:Ct,finalize:Lr};async function Gr(e,t){return Je(e,nb,t)}var Kg=()=>({contents:new ArrayBuffer(0)}),Xg=e=>Jg.encode(e),Jg=new TextEncoder,
|
|
408
|
+
cl=e=>new Uint8Array(e),ll=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Zg=(e,t)=>e.slice(0,t),Qg=(e,{contents:t,
|
|
409
|
+
length:r},n)=>{let o=fl()?tb(t,n):eb(t,n);return new Uint8Array(o).set(e,r),o},eb=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(
|
|
410
|
+
dl(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},tb=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(
|
|
411
|
+
t,{maxByteLength:dl(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},dl=e=>ul**Math.ceil(Math.log(e)/Math.log(ul)),
|
|
412
|
+
ul=2,rb=({contents:e,length:t})=>fl()?e:e.slice(0,t),fl=()=>"resize"in ArrayBuffer.prototype,nb={init:Kg,convertChunk:{string:Xg,
|
|
413
|
+
buffer:cl,arrayBuffer:cl,dataView:ll,typedArray:ll,others:Br},getSize:Ur,truncateChunk:Zg,addChunk:Qg,getFinalChunk:Ct,finalize:rb};async function Hr(e,t){return Je(e,cb,t)}var ob=()=>({contents:"",textDecoder:new TextDecoder}),Fr=(e,{textDecoder:t})=>t.
|
|
414
|
+
decode(e,{stream:!0}),ib=(e,{contents:t})=>t+e,sb=(e,t)=>e.slice(0,t),ab=({textDecoder:e})=>{let t=e.decode();return t===
|
|
415
|
+
""?void 0:t},cb={init:ob,convertChunk:{string:be,buffer:Fr,arrayBuffer:Fr,dataView:Fr,typedArray:Fr,others:Br},getSize:Ur,
|
|
416
|
+
truncateChunk:sb,addChunk:ib,getFinalChunk:ab,finalize:Lr};Object.assign(Ot,{on:lb,finished:ub});var pl=({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{if(!(e instanceof de))throw e;if(i==="a\
|
|
417
|
+
ll")return e;let s=db(r,n,o);throw e.maxBufferInfo={fdNumber:i,unit:s},t.destroy(),e},db=(e,t,r)=>e?"objects":t?"lines":
|
|
418
|
+
r==="buffer"?"bytes":"characters",ml=(e,t,r)=>{if(t.length!==r)return;let n=new de;throw n.maxBufferInfo={fdNumber:"ipc"},
|
|
419
|
+
n},hl=(e,t)=>{let{streamName:r,threshold:n,unit:o}=fb(e,t);return`Command's ${r} was larger than ${n} ${o}`},fb=(e,t)=>{
|
|
420
420
|
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=
|
|
424
|
-
isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:_,cwd:
|
|
425
|
-
let
|
|
426
|
-
exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),
|
|
421
|
+
delete e.maxBufferInfo;let o=ge(t,r);return r==="ipc"?{streamName:"IPC output",threshold:o,unit:"messages"}:{streamName:sr(
|
|
422
|
+
r),threshold:o,unit:n}},gl=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(n=>n!==null&&n.length>jr(r)),bl=(e,t,r)=>{if(!t)
|
|
423
|
+
return e;let n=jr(r);return e.length>n?e.slice(0,n):e},jr=([,e])=>e;var yl=({stdio:e,all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,
|
|
424
|
+
isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:_,cwd:b})=>{
|
|
425
|
+
let g=n?.code,T=mb({originalError:n,timedOut:c,timeout:_,isMaxBuffer:d,maxBuffer:h,errorCode:g,signal:o,signalDescription:i,
|
|
426
|
+
exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),y=gb(n,b),A=y===
|
|
427
427
|
void 0?"":`
|
|
428
|
-
${
|
|
429
|
-
`)].map(
|
|
428
|
+
${y}`,R=`${T}: ${a}${A}`,S=t===void 0?[e[2],e[1]]:[t],x=[R,...S,...e.slice(3),r.map($=>bb($)).join(`
|
|
429
|
+
`)].map($=>vt(Xe(wb($)))).filter(Boolean).join(`
|
|
430
430
|
|
|
431
|
-
`);return{originalMessage:
|
|
431
|
+
`);return{originalMessage:y,shortMessage:R,message:x}},mb=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,
|
|
432
432
|
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,
|
|
433
|
-
killSignal:p})=>{let m=
|
|
433
|
+
killSignal:p})=>{let m=hb(d,f);return t?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracef\
|
|
434
434
|
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
|
-
(${
|
|
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}),
|
|
435
|
+
)`:l?`Command was canceled${m}`:n?`${hl(e,o)}${m}`:i!==void 0?`Command failed with ${i}${m}`:d?`Command was killed with ${p}\
|
|
436
|
+
(${_r(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Comma\
|
|
437
|
+
nd failed"},hb=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",gb=(e,t)=>{if(e instanceof ne)return;
|
|
438
|
+
let r=Ya(e)?e.originalMessage:String(e?.message??e),n=vt(Jc(r,t));return n===""?void 0:n},bb=e=>typeof e=="string"?e:pb(
|
|
439
|
+
e),wb=e=>Array.isArray(e)?e.map(t=>Xe(wl(t))).filter(Boolean).join(`
|
|
440
|
+
`):wl(e),wl=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})=>_l({command:e,escapedCommand:t,
|
|
441
|
+
cwd:i,durationMs:co(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,
|
|
442
|
+
exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),Ze=({error:e,command:t,escapedCommand:r,fileDescriptors:n,
|
|
443
|
+
options:o,startTime:i,isSync:s})=>xt({error:e,command:t,escapedCommand:r,startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,
|
|
444
|
+
isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:o,isSync:s}),xt=({error:e,
|
|
445
445
|
command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,
|
|
446
|
-
exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:_,killSignal:
|
|
447
|
-
cwd:
|
|
448
|
-
{stdio:d,all:f,ipcOutput:p,originalError:e,signal:
|
|
449
|
-
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:_,killSignal:
|
|
450
|
-
|
|
451
|
-
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:A,signal:
|
|
452
|
-
shortMessage
|
|
446
|
+
exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:_,killSignal:b,
|
|
447
|
+
cwd:g,maxBuffer:T},isSync:y})=>{let{exitCode:A,signal:R,signalDescription:S}=_b(l,u),{originalMessage:x,shortMessage:$,message:M}=yl(
|
|
448
|
+
{stdio:d,all:f,ipcOutput:p,originalError:e,signal:R,signalDescription:S,exitCode:A,escapedCommand:r,timedOut:o,isCanceled:i,
|
|
449
|
+
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:_,killSignal:b,maxBuffer:T,timeout:h,cwd:g}),
|
|
450
|
+
k=Wa(e,M,y);return Object.assign(k,yb({error:k,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,
|
|
451
|
+
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:A,signal:R,signalDescription:S,stdio:d,all:f,ipcOutput:p,cwd:g,originalMessage:x,
|
|
452
|
+
shortMessage:$})),k},yb=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,isGracefullyCanceled:s,
|
|
453
453
|
isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:_,
|
|
454
|
-
shortMessage:
|
|
454
|
+
shortMessage:b})=>_l({shortMessage:b,originalMessage:_,command:t,escapedCommand:r,cwd:h,durationMs:co(n),failed:!0,timedOut:o,
|
|
455
455
|
isCanceled:i,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,
|
|
456
|
-
code:e.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),
|
|
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
|
|
456
|
+
code:e.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),_l=e=>Object.fromEntries(Object.entries(
|
|
457
|
+
e).filter(([,t])=>t!==void 0)),_b=(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,
|
|
458
|
+
signal:n,signalDescription:o}};var Sl=e=>Number.isFinite(e)?e:0;function Sb(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.
|
|
459
|
+
trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(Sl(e*1e3)%1e3),nanoseconds:Math.
|
|
460
|
+
trunc(Sl(e*1e6)%1e3)}}function Eb(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,
|
|
461
|
+
milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function Mo(e){switch(typeof e){case"number":{if(Number.isFinite(e))
|
|
462
|
+
return Sb(e);break}case"bigint":return Eb(e)}throw new TypeError("Expected a finite number or bigint")}var vb=e=>e===0||e===0n,Tb=(e,t)=>t===1||t===1n?e:`${e}s`,Ab=1e-7,Ib=24n*60n*60n*1000n;function Do(e,t){let r=typeof e==
|
|
463
463
|
"bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let n=e<0?"-":"";
|
|
464
464
|
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 f=Math.floor(u*10**d+
|
|
466
|
-
round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((o.length===0||!t.colonNotation)&&
|
|
465
|
+
(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,d)=>{let f=Math.floor(u*10**d+Ab);return(Math.
|
|
466
|
+
round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((o.length===0||!t.colonNotation)&&vb(u)&&!(t.colonNotation&&f==="m"))){if(p??=
|
|
467
467
|
String(u),t.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=o.length>0?2:1;p="0".repeat(Math.max(
|
|
468
|
-
0,h-m))+p}else p+=t.verbose?" "+
|
|
468
|
+
0,h-m))+p}else p+=t.verbose?" "+Tb(d,u):f;o.push(p)}},a=Mo(e),c=BigInt(a.days);if(t.hideYearAndDays?s(BigInt(c)*24n+BigInt(
|
|
469
469
|
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
470
|
s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<
|
|
471
471
|
1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);
|
|
472
472
|
if(s(u,"second","s"),t.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{
|
|
473
473
|
let m=d+f/1e3+p/1e6,h=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,_=m>=1?Math.round(m):Math.
|
|
474
|
-
ceil(m),
|
|
475
|
-
Number(e%
|
|
474
|
+
ceil(m),b=1e3-10**-h,g=h?Math.min(m,b).toFixed(h):Math.min(_,b);s(Number.parseFloat(g),"millisecond","ms",g)}}else{let u=(r?
|
|
475
|
+
Number(e%Ib):e)/1e3%60,d=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,f=i(u,d),p=t.keepDecimalsOnWholeSeconds?
|
|
476
476
|
f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(o.length===0)return n+"0"+(t.verbose?" milliseconds":"\
|
|
477
477
|
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"
|
|
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"]),
|
|
478
|
+
l)}var El=(e,t)=>{e.failed&&ce({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var vl=(e,t)=>{He(t)&&(El(e,t),Rb(e,t))},Rb=(e,t)=>{let r=`(done in ${Do(e.durationMs)})`;ce({type:"duration",verboseMessage:r,
|
|
479
|
+
verboseInfo:t,result:e})};var Qe=(e,t,{reject:r})=>{if(vl(e,t),e.failed&&r)throw e;return e};import{readFileSync as Xl}from"node:fs";var Il=(e,t)=>ke(e)?"asyncGenerator":Ol(e)?"generator":Wr(e)?"fileUrl":kb(e)?"filePath":Mb(e)?"webStream":ie(e,{checkOpen:!1})?
|
|
480
|
+
"native":B(e)?"uint8Array":Db(e)?"asyncIterable":Lb(e)?"iterable":Uo(e)?Rl({transform:e},t):xb(e)?Pb(e,t):"native",Pb=(e,t)=>xo(
|
|
481
|
+
e.transform,{checkOpen:!1})?Ob(e,t):Uo(e.transform)?Rl(e,t):Cb(e,t),Ob=(e,t)=>(Pl(e,t,"Duplex stream"),"duplex"),Rl=(e,t)=>(Pl(
|
|
482
|
+
e,t,"web TransformStream"),"webTransform"),Pl=({final:e,binary:t,objectMode:r},n,o)=>{Tl(e,`${n}.final`,o),Tl(t,`${n}.bi\
|
|
483
|
+
nary`,o),Lo(r,`${n}.objectMode`)},Tl=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined\
|
|
484
|
+
when using a generator, not a ${r}.`)},Cb=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(e!==void 0&&!Al(e))throw new TypeError(
|
|
485
|
+
`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(xo(t,{checkOpen:!1}))
|
|
486
|
+
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(Uo(t))throw new TypeError(`The \`${o}.f\
|
|
487
|
+
inal\` option must not be a web TransformStream.`);if(t!==void 0&&!Al(t))throw new TypeError(`The \`${o}.final\` option m\
|
|
488
|
+
ust be a generator.`);return Lo(r,`${o}.binary`),Lo(n,`${o}.objectMode`),ke(e)||ke(t)?"asyncGenerator":"generator"},Lo=(e,t)=>{
|
|
489
|
+
if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},Al=e=>ke(e)||Ol(e),ke=e=>Object.
|
|
490
|
+
prototype.toString.call(e)==="[object AsyncGeneratorFunction]",Ol=e=>Object.prototype.toString.call(e)==="[object Genera\
|
|
491
|
+
torFunction]",xb=e=>L(e)&&(e.transform!==void 0||e.final!==void 0),Wr=e=>Object.prototype.toString.call(e)==="[object UR\
|
|
492
|
+
L]",Cl=e=>Wr(e)&&e.protocol!=="file:",kb=e=>L(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>Nb.has(t))&&Bo(e.file),
|
|
493
|
+
Nb=new Set(["file","append"]),Bo=e=>typeof e=="string",xl=(e,t)=>e==="native"&&typeof t=="string"&&!$b.has(t),$b=new Set(
|
|
494
|
+
["ipc","ignore","inherit","overlapped","pipe"]),kl=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",qr=e=>Object.
|
|
495
|
+
prototype.toString.call(e)==="[object WritableStream]",Mb=e=>kl(e)||qr(e),Uo=e=>kl(e?.readable)&&qr(e?.writable),Db=e=>Nl(
|
|
496
|
+
e)&&typeof e[Symbol.asyncIterator]=="function",Lb=e=>Nl(e)&&typeof e[Symbol.iterator]=="function",Nl=e=>typeof e=="objec\
|
|
497
|
+
t"&&e!==null,Z=new Set(["generator","asyncGenerator","duplex","webTransform"]),Yr=new Set(["fileUrl","filePath","fileNum\
|
|
498
|
+
ber"]),zo=new Set(["fileUrl","filePath"]),$l=new Set([...zo,"webStream","nodeStream"]),Ml=new Set(["webTransform","duple\
|
|
499
|
+
x"]),ve={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",
|
|
500
500
|
fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web Transfo\
|
|
501
501
|
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}):
|
|
502
|
+
string",uint8Array:"a Uint8Array"};var Go=(e,t,r,n)=>n==="output"?Bb(e,t,r):Ub(e,t,r),Bb=(e,t,r)=>{let n=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:n,
|
|
503
|
+
readableObjectMode:e??n}},Ub=(e,t,r)=>{let n=t===0?e===!0:r[t-1].value.readableObjectMode,o=t!==r.length-1&&(e??n);return{
|
|
504
|
+
writableObjectMode:n,readableObjectMode:o}},Dl=(e,t)=>{let r=e.findLast(({type:n})=>Z.has(n));return r===void 0?!1:t==="\
|
|
505
|
+
input"?r.value.writableObjectMode:r.value.readableObjectMode};var Ll=(e,t,r,n)=>[...e.filter(({type:o})=>!Z.has(o)),...zb(e,t,r,n)],zb=(e,t,r,{encoding:n})=>{let o=e.filter(({type:s})=>Z.
|
|
506
|
+
has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(o))i[s]=Gb({stdioItem:a,index:Number(s),newTransforms:i,
|
|
507
|
+
optionName:t,direction:r,encoding:n});return Vb(i,r)},Gb=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:n,optionName:o,
|
|
508
|
+
direction:i,encoding:s})=>t==="duplex"?Fb({stdioItem:e,optionName:o}):t==="webTransform"?Hb({stdioItem:e,index:r,newTransforms:n,
|
|
509
|
+
direction:i}):jb({stdioItem:e,index:r,newTransforms:n,direction:i,encoding:s}),Fb=({stdioItem:e,stdioItem:{value:{transform:t,
|
|
510
510
|
transform:{writableObjectMode:r,readableObjectMode:n},objectMode:o=n}},optionName:i})=>{if(o&&!n)throw new TypeError(`Th\
|
|
511
511
|
e \`${i}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!o&&n)throw new TypeError(
|
|
512
512
|
`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}=
|
|
515
|
-
transform:i,writableObjectMode:a,readableObjectMode:c}}},
|
|
516
|
-
encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=
|
|
517
|
-
{writableObjectMode:f,readableObjectMode:p}=
|
|
518
|
-
writableObjectMode:f,readableObjectMode:p}}},
|
|
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
|
|
513
|
+
transform:t,writableObjectMode:r,readableObjectMode:n}}},Hb=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{
|
|
514
|
+
let{transform:i,objectMode:s}=L(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=Go(s,r,n,o);return{...e,value:{
|
|
515
|
+
transform:i,writableObjectMode:a,readableObjectMode:c}}},jb=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o,
|
|
516
|
+
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:f,readableObjectMode:p}=Go(u,r,n,o);return{...e,value:{transform:s,final:a,binary:d,preserveNewlines:l,
|
|
518
|
+
writableObjectMode:f,readableObjectMode:p}}},Vb=(e,t)=>t==="input"?e.reverse():e;import Fo from"node:process";var Bl=(e,t,r)=>{let n=e.map(o=>Wb(o,t));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` o\
|
|
519
|
+
ption must not be an array of both readable and writable values.`);return n.find(Boolean)??Kb},Wb=({type:e,value:t},r)=>qb[r]??
|
|
520
|
+
Ul[e](t),qb=["input","output","output"],et=()=>{},Ho=()=>"input",Ul={generator:et,asyncGenerator:et,fileUrl:et,filePath:et,
|
|
521
|
+
iterable:Ho,asyncIterable:Ho,uint8Array:Ho,webStream:e=>qr(e)?"output":"input",nodeStream(e){return xe(e,{checkOpen:!1})?
|
|
522
|
+
Co(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:et,duplex:et,native(e){let t=Yb(e);if(t!==void 0)return t;if(ie(
|
|
523
|
+
e,{checkOpen:!1}))return Ul.nodeStream(e)}},Yb=e=>{if([0,Fo.stdin].includes(e))return"input";if([1,2,Fo.stdout,Fo.stderr].
|
|
524
|
+
includes(e))return"output"},Kb="output";var zl=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var Gl=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=Xb(e,n).map((a,c)=>Fl(a,c));return i?Zb(s,r,o):zl(s,t)},Xb=(e,t)=>{if(e===
|
|
525
|
+
void 0)return J.map(n=>t[n]);if(Jb(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${J.
|
|
526
526
|
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=
|
|
538
|
-
herit"?{type:"nodeStream",value:
|
|
539
|
-
|
|
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=
|
|
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
|
-
\`.`)}},
|
|
527
|
+
\`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,J.length);return Array.from(
|
|
528
|
+
{length:r},(n,o)=>e[o])},Jb=e=>J.some(t=>e[t]!==void 0),Fl=(e,t)=>Array.isArray(e)?e.map(r=>Fl(r,t)):e??(t>=J.length?"ig\
|
|
529
|
+
nore":"pipe"),Zb=(e,t,r)=>e.map((n,o)=>!t[o]&&o!==0&&!je(r,o)&&Qb(n)?"ignore":n),Qb=e=>e==="pipe"||Array.isArray(e)&&e.every(
|
|
530
|
+
t=>t==="pipe");import{readFileSync as ew}from"node:fs";import tw from"node:tty";var jl=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?rw({stdioItem:e,
|
|
531
|
+
fdNumber:n,direction:o}):iw({stdioItem:e,fdNumber:n}),rw=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{
|
|
532
|
+
let i=nw({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(ie(t,{checkOpen:!1}))throw new TypeError(
|
|
533
|
+
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},nw=({value:e,
|
|
534
|
+
optionName:t,fdNumber:r,direction:n})=>{let o=ow(e,r);if(o!==void 0){if(n==="output")return{type:"fileNumber",value:o,optionName:t};
|
|
535
|
+
if(tw.isatty(o))throw new TypeError(`The \`${t}: ${vr(e)}\` option is invalid: it cannot be a TTY with synchronous method\
|
|
536
|
+
s.`);return{type:"uint8Array",value:he(ew(o)),optionName:t}}},ow=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")
|
|
537
|
+
return e;let r=ir.indexOf(e);if(r!==-1)return r},iw=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>t==="in\
|
|
538
|
+
herit"?{type:"nodeStream",value:Hl(n,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:Hl(t,t,r),optionName:r}:
|
|
539
|
+
ie(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,Hl=(e,t,r)=>{let n=ir[e];if(n===void 0)throw new TypeError(
|
|
540
|
+
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n};var Vl=({input:e,inputFile:t},r)=>r===0?[...sw(e),...cw(t)]:[],sw=e=>e===void 0?[]:[{type:aw(e),value:e,optionName:"inpu\
|
|
541
|
+
t"}],aw=e=>{if(xe(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(B(e))return"uint8Array";throw new Error(
|
|
542
|
+
"The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},cw=e=>e===void 0?[]:[{...lw(e),optionName:"\
|
|
543
|
+
inputFile"}],lw=e=>{if(Wr(e))return{type:"fileUrl",value:e};if(Bo(e))return{type:"filePath",value:{file:e}};throw new Error(
|
|
544
|
+
"The `inputFile` option must be a file path string or a file URL.")};var Wl=e=>e.filter((t,r)=>e.every((n,o)=>t.value!==n.value||r>=o||t.type==="generator"||t.type==="asyncGenerator")),ql=({
|
|
545
|
+
stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{let s=uw(o,e);if(s.length!==0){if(i){
|
|
546
|
+
dw({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});return}if($l.has(e))return Yl({otherStdioItems:s,type:e,
|
|
547
|
+
value:t,optionName:r,direction:n});Ml.has(e)&&pw({otherStdioItems:s,type:e,value:t,optionName:r})}},uw=(e,t)=>e.flatMap(
|
|
548
|
+
({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),dw=({otherStdioItems:e,type:t,value:r,
|
|
549
|
+
optionName:n,direction:o})=>{zo.has(t)&&Yl({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})},Yl=({otherStdioItems:e,
|
|
550
|
+
type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>fw(a,r));if(i.length===0)return;let s=i.find(a=>a.direction!==
|
|
551
|
+
o);return Kl(s,n,t),o==="output"?i[0].stream:void 0},fw=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUr\
|
|
552
|
+
l"?t.href===r.href:t===r,pw=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{transform:i}})=>i===
|
|
553
|
+
r.transform);Kl(o,n,t)},Kl=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must\
|
|
554
|
+
not target ${ve[r]} that is the same.`)};var Kr=(e,t,r,n)=>{let i=Gl(t,r,n).map((a,c)=>mw({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=Ew({initialFileDescriptors:i,
|
|
555
|
+
addProperties:e,options:t,isSync:n});return t.stdio=s.map(({stdioItems:a})=>Aw(a)),s},mw=({stdioOption:e,fdNumber:t,options:r,
|
|
556
|
+
isSync:n})=>{let o=sr(t),{stdioItems:i,isStdioArray:s}=hw({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=Bl(i,t,o),
|
|
557
|
+
c=i.map(d=>jl({stdioItem:d,isStdioArray:s,fdNumber:t,direction:a,isSync:n})),l=Ll(c,o,a,r),u=Dl(l,a);return Sw(l,u),{direction:a,
|
|
558
|
+
objectMode:u,stdioItems:l}},hw=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let i=[...(Array.isArray(e)?e:[e]).
|
|
559
|
+
map(c=>gw(c,n)),...Vl(r,t)],s=Wl(i),a=s.length>1;return bw(s,a,n),yw(s),{stdioItems:s,isStdioArray:a}},gw=(e,t)=>({type:Il(
|
|
560
|
+
e,t),value:e,optionName:t}),bw=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty ar\
|
|
561
|
+
ray.`);if(t){for(let{value:n,optionName:o}of e)if(ww.has(n))throw new Error(`The \`${o}\` option must not include \`${n}\
|
|
562
|
+
\`.`)}},ww=new Set(["ignore","ipc"]),yw=e=>{for(let t of e)_w(t)},_w=({type:e,value:t,optionName:r})=>{if(Cl(t))throw new TypeError(
|
|
563
563
|
`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}: '...'\`.`)},
|
|
564
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(xl(e,t))throw new TypeError(`Th\
|
|
565
|
+
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Sw=(e,t)=>{if(!t)return;let r=e.find(({type:n})=>Yr.
|
|
566
566
|
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
|
-
|
|
567
|
+
ode.`)},Ew=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let i of e)o.push(vw({fileDescriptor:i,
|
|
568
|
+
fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw jo(o),i}},vw=({fileDescriptor:{direction:e,
|
|
569
|
+
objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>Tw({stdioItem:c,addProperties:o,
|
|
570
|
+
direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},Tw=({stdioItem:e,addProperties:t,
|
|
571
|
+
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=ql({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return s!==
|
|
572
|
+
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},jo=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!re(
|
|
573
|
+
r)&&r.destroy()},Aw=e=>{if(e.length>1)return e.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;
|
|
574
|
+
return t==="native"?r:"pipe"};var Zl=(e,t)=>Kr(Rw,e,t,!0),fe=({type:e,optionName:t})=>{Ql(t,ve[e])},Iw=({optionName:e,value:t})=>((t==="ipc"||t==="ove\
|
|
575
|
+
rlapped")&&Ql(e,`"${t}"`),{}),Ql=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous method\
|
|
576
|
+
s.`)},Jl={generator(){},asyncGenerator:fe,webStream:fe,nodeStream:fe,webTransform:fe,duplex:fe,asyncIterable:fe,native:Iw},
|
|
577
|
+
Rw={input:{...Jl,fileUrl:({value:e})=>({contents:[he(Xl(e))]}),filePath:({value:{file:e}})=>({contents:[he(Xl(e))]}),fileNumber:fe,
|
|
578
578
|
iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},
|
|
579
|
-
output:{...
|
|
580
|
-
path:e}),iterable:
|
|
581
|
-
t,{});return[...r(e),...n()]}
|
|
579
|
+
output:{...Jl,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({
|
|
580
|
+
path:e}),iterable:fe,string:fe,uint8Array:fe}};var we=(e,{stripFinalNewline:t},r)=>Vo(t,r)&&e!==void 0&&!Array.isArray(e)?Xe(e):e,Vo=(e,t)=>t==="all"?e[1]||e[2]:e[t];import{Transform as Yw,getDefaultHighWaterMark as uu}from"node:stream";var Xr=(e,t,r,n)=>e||r?void 0:tu(t,n),qo=(e,t,r)=>r?e.flatMap(n=>eu(n,t)):eu(e,t),eu=(e,t)=>{let{transform:r,final:n}=tu(
|
|
581
|
+
t,{});return[...r(e),...n()]},tu=(e,t)=>(t.previousChunks="",{transform:Pw.bind(void 0,t,e),final:Cw.bind(void 0,t)}),Pw=function*(e,t,r){
|
|
582
582
|
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"?
|
|
583
|
+
`){let s=Ow(r,i,t,e),a=r.slice(o+1,i+1-s);n.length>0&&(a=Wo(n,a),n=""),yield a,o=i}o!==r.length-1&&(n=Wo(n,r.slice(o+1))),
|
|
584
|
+
e.previousChunks=n},Ow=(e,t,r,n)=>r?0:(n.isWindowsNewline=t!==0&&e[t-1]==="\r",n.isWindowsNewline?2:1),Cw=function*({previousChunks:e}){
|
|
585
|
+
e.length>0&&(yield e)},ru=({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:xw.bind(
|
|
586
|
+
void 0,n)},xw=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:i}=typeof t=="str\
|
|
587
|
+
ing"?kw:$w;if(t.at(-1)===o){yield t;return}yield i(t,e?n:r)},Wo=(e,t)=>`${e}${t}`,kw={windowsNewline:`\r
|
|
588
588
|
`,unixNewline:`
|
|
589
589
|
`,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):
|
|
590
|
+
`,concatBytes:Wo},Nw=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},$w={windowsNewline:new Uint8Array(
|
|
591
|
+
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Nw};import{Buffer as Mw}from"node:buffer";var nu=(e,t)=>e?void 0:Dw.bind(void 0,t),Dw=function*(e,t){if(typeof t!="string"&&!B(t)&&!Mw.isBuffer(t))throw new TypeError(
|
|
592
|
+
`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},ou=(e,t)=>e?Lw.
|
|
593
|
+
bind(void 0,t):Bw.bind(void 0,t),Lw=function*(e,t){iu(e,t),yield t},Bw=function*(e,t){if(iu(e,t),typeof t!="string"&&!B(
|
|
594
594
|
t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},
|
|
595
|
-
|
|
595
|
+
iu=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
596
596
|
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}}),
|
|
601
|
-
for await(let o of n(e))yield*
|
|
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 f=
|
|
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(!
|
|
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}=
|
|
642
|
-
options:u,fileDescriptors:d}},
|
|
643
|
-
|
|
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:f,isMaxBuffer:p}=
|
|
647
|
-
{fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:i}),_=m.map((
|
|
648
|
-
return
|
|
649
|
-
|
|
650
|
-
r);return
|
|
651
|
-
isSync:!0})}},
|
|
652
|
-
timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>e===void 0?
|
|
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:
|
|
656
|
-
isSubprocess:r,filter:n,reference:o})=>{
|
|
657
|
-
i,n,s),
|
|
658
|
-
let[n]=await
|
|
659
|
-
signal:r})=>{await
|
|
660
|
-
throw
|
|
661
|
-
shouldAwait:!r,reference:o}),
|
|
662
|
-
getEachMessage",isSubprocess:r,ipc:n,isConnected:
|
|
663
|
-
s,a),
|
|
664
|
-
controller:a,state:c,reference:i})},
|
|
665
|
-
|
|
666
|
-
error=
|
|
667
|
-
state:s,reference:a}){try{for await(let[c]of
|
|
668
|
-
|
|
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})=>{
|
|
698
|
-
streams:r,ended:n,aborted:o,controller:a}),
|
|
699
|
-
a.abort(),
|
|
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"&&
|
|
715
|
-
IGPWR","SIGSTKFLT");var
|
|
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(
|
|
597
|
+
if (condition) { yield value; }`)};import{Buffer as Uw}from"node:buffer";import{StringDecoder as zw}from"node:string_decoder";var Jr=(e,t,r)=>{if(r)return;if(e)return{transform:Gw.bind(void 0,new TextEncoder)};let n=new zw(t);return{transform:Fw.
|
|
598
|
+
bind(void 0,n),final:Hw.bind(void 0,n)}},Gw=function*(e,t){Uw.isBuffer(t)?yield he(t):typeof t=="string"?yield e.encode(
|
|
599
|
+
t):yield t},Fw=function*(e,t){yield B(t)?e.write(t):t},Hw=function*(e){let t=e.end();t!==""&&(yield t)};import{callbackify as su}from"node:util";var Yo=su(async(e,t,r,n)=>{t.currentIterable=e(...r);try{for await(let o of t.currentIterable)
|
|
600
|
+
n.push(o)}finally{delete t.currentIterable}}),Zr=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=Vw}=t[r];
|
|
601
|
+
for await(let o of n(e))yield*Zr(o,t,r+1)},au=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*jw(r,Number(
|
|
602
|
+
t),e)},jw=async function*(e,t,r){if(e!==void 0)for await(let n of e())yield*Zr(n,r,t+1)},cu=su(async({currentIterable:e},t)=>{
|
|
603
|
+
if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Vw=function*(e){yield e};var Ko=(e,t,r,n)=>{try{for(let o of e(...t))r.push(o);n()}catch(o){n(o)}},lu=(e,t)=>[...t.flatMap(r=>[...Ne(r,e,0)]),...kt(
|
|
604
|
+
e)],Ne=function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=qw}=t[r];for(let o of n(e))yield*Ne(o,t,r+1)},kt=function*(e){
|
|
605
|
+
for(let[t,{final:r}]of Object.entries(e))yield*Ww(r,Number(t),e)},Ww=function*(e,t,r){if(e!==void 0)for(let n of e())yield*Ne(
|
|
606
|
+
n,r,t+1)},qw=function*(e){yield e};var Xo=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},
|
|
607
|
+
c=du(e,s,i),l=ke(t),u=ke(r),d=l?Yo.bind(void 0,Zr,a):Ko.bind(void 0,Ne),f=l||u?Yo.bind(void 0,au,a):Ko.bind(void 0,kt),p=l||
|
|
608
|
+
u?cu.bind(void 0,a):void 0;return{stream:new Yw({writableObjectMode:n,writableHighWaterMark:uu(n),readableObjectMode:o,readableHighWaterMark:uu(
|
|
609
|
+
o),transform(h,_,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Qr=(e,t,r,n)=>{let o=t.filter(({type:s})=>s===
|
|
610
|
+
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=du(s,r,a);e=lu(c,e)}return e},du=({transform:e,final:t,
|
|
611
|
+
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:nu(n,a)},Jr(r,s,
|
|
612
|
+
n),Xr(r,i,n,c),{transform:e,final:t},{transform:ou(o,a)},ru({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].
|
|
613
|
+
filter(Boolean)};var fu=(e,t)=>{for(let r of Kw(e))Xw(e,r,t)},Kw=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(
|
|
614
|
+
([t])=>Number(t))),Xw=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:a})=>a!==void 0);if(o.length===0)return;if(t!==
|
|
615
|
+
0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${ve[a]} with synch\
|
|
616
|
+
ronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>Jw(a,n));r.input=Et(s)},Jw=(e,t)=>{let r=Qr(e,t,"utf8",!0);return Zw(
|
|
617
|
+
r),Et(r)},Zw=e=>{let t=e.find(r=>typeof r!="string"&&!B(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is inv\
|
|
618
|
+
alid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as ry,appendFileSync as ny}from"node:fs";var en=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&je(r,n)&&!W.has(t)&&Qw(n)&&(e.some(({type:o,value:i})=>o===
|
|
619
|
+
"native"&&ey.has(i))||e.every(({type:o})=>Z.has(o))),Qw=e=>e===1||e===2,ey=new Set(["pipe","overlapped"]),pu=async(e,t,r,n)=>{
|
|
620
|
+
for await(let o of e)ty(t)||hu(o,r,n)},mu=(e,t,r)=>{for(let n of e)hu(n,t,r)},ty=e=>e._readableState.pipes.length>0,hu=(e,t,r)=>{
|
|
621
|
+
let n=fr(e);ce({type:"output",verboseMessage:n,fdNumber:t,verboseInfo:r})};var gu=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.
|
|
622
|
+
from({length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>oy({result:c,fileDescriptors:e,fdNumber:l,state:i,outputFiles:s,
|
|
623
|
+
isMaxBuffer:n,verboseInfo:o},r)),...i}},oy=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{
|
|
624
|
+
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(e===null)return;let f=bl(e,i,d),p=he(f),{stdioItems:m,
|
|
625
|
+
objectMode:h}=t[r],_=iy([p],m,c,n),{serializedResult:b,finalResult:g=b}=sy({chunks:_,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,
|
|
626
|
+
fdNumber:r});ay({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let T=a[r]?g:
|
|
627
|
+
void 0;try{return n.error===void 0&&cy(b,m,o),T}catch(y){return n.error=y,T}},iy=(e,t,r,n)=>{try{return Qr(e,t,r,!1)}catch(o){
|
|
628
|
+
return n.error=o,e}},sy=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};
|
|
629
|
+
if(r==="buffer")return{serializedResult:Et(e)};let s=xs(e,r);return n[i]?{serializedResult:s,finalResult:qo(s,!o[i],t)}:
|
|
630
|
+
{serializedResult:s}},ay=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{
|
|
631
|
+
if(!en({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=qo(e,!1,s);try{mu(a,t,n)}catch(c){r.error??=c}},
|
|
632
|
+
cy=(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(
|
|
633
|
+
i)?ny(n,e):(r.add(i),ry(n,e))}};var bu=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,we(t,r,
|
|
634
|
+
"all")]:Array.isArray(t)?[we(e,r,"all"),...t]:B(e)&&B(t)?to([e,t]):`${e}${t}`};import{once as Jo}from"node:events";var wu=async(e,t)=>{let[r,n]=await ly(e);return t.isForcefullyTerminated??=!1,[r,n]},ly=async e=>{let[t,r]=await Promise.
|
|
635
|
+
allSettled([Jo(e,"spawn"),Jo(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?yu(e):r.value},yu=async e=>{
|
|
636
|
+
try{return await Jo(e,"exit")}catch{return yu(e)}},_u=async e=>{let[t,r]=await e;if(!uy(t,r)&&Zo(t,r))throw new ne;return[
|
|
637
|
+
t,r]},uy=(e,t)=>e===void 0&&t===void 0,Zo=(e,t)=>e!==0||t!==null;var Su=({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let i=dy(e,t,r),s=i?.code==="ETIMEDOUT",a=gl(i,n,o);return{
|
|
638
|
+
resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},dy=(e,t,r)=>e!==void 0?e:Zo(t,r)?new ne:void 0;var Eu=(e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=py(
|
|
639
|
+
e,t,r),d=gy({file:n,commandArguments:o,options:l,command:i,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});
|
|
640
|
+
return Qe(d,c,l)},py=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=mr(e,t,r),a=my(r),{file:c,commandArguments:l,
|
|
641
|
+
options:u}=Mr(e,t,a);hy(u);let d=Zl(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:o,startTime:i,verboseInfo:s,
|
|
642
|
+
options:u,fileDescriptors:d}},my=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,hy=({ipc:e,ipcInput:t,detached:r,cancelSignal:n})=>{t&&
|
|
643
|
+
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.`)},gy=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:i,
|
|
645
|
+
fileDescriptors:s,startTime:a})=>{let c=by({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:s,
|
|
646
|
+
startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Su(c,r),{output:m,error:h=l}=gu(
|
|
647
|
+
{fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:i}),_=m.map((g,T)=>we(g,r,T)),b=we(bu(m,r),r,"all");
|
|
648
|
+
return yy({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:b,options:r,command:n,escapedCommand:o,startTime:a})},
|
|
649
|
+
by=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:i,startTime:s})=>{try{fu(i,r);let a=wy(
|
|
650
|
+
r);return fy(...Dr(e,t,a))}catch(a){return Ze({error:a,command:n,escapedCommand:o,fileDescriptors:i,options:r,startTime:s,
|
|
651
|
+
isSync:!0})}},wy=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:jr(t)}),yy=({error:e,exitCode:t,signal:r,
|
|
652
|
+
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}):xt({error:e,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,
|
|
654
|
+
isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as sS}from"node:events";import{spawn as aS}from"node:child_process";import Ru from"node:process";import{once as Qo,on as _y}from"node:events";var vu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:i}={})=>(qe({methodName:"getOneMessage",isSubprocess:r,
|
|
655
|
+
ipc:n,isConnected:Or(e)}),Sy({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:o})),Sy=async({anyProcess:e,channel:t,
|
|
656
|
+
isSubprocess:r,filter:n,reference:o})=>{Ar(t,o);let i=Ee(e,t,r),s=new AbortController;try{return await Promise.race([Ey(
|
|
657
|
+
i,n,s),vy(i,r,s),Ty(i,r,s)])}catch(a){throw Ye(e),a}finally{s.abort(),Ir(t,o)}},Ey=async(e,t,{signal:r})=>{if(t===void 0){
|
|
658
|
+
let[n]=await Qo(e,"message",{signal:r});return n}for await(let[n]of _y(e,"message",{signal:r}))if(t(n))return n},vy=async(e,t,{
|
|
659
|
+
signal:r})=>{await Qo(e,"disconnect",{signal:r}),lc(t)},Ty=async(e,t,{signal:r})=>{let[n]=await Qo(e,"strict:error",{signal:r});
|
|
660
|
+
throw Er(n,t)};import{once as Au,on as Ay}from"node:events";var Iu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>ei({anyProcess:e,channel:t,isSubprocess:r,ipc:n,
|
|
661
|
+
shouldAwait:!r,reference:o}),ei=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{qe({methodName:"\
|
|
662
|
+
getEachMessage",isSubprocess:r,ipc:n,isConnected:Or(e)}),Ar(t,i);let s=Ee(e,t,r),a=new AbortController,c={};return Iy(e,
|
|
663
|
+
s,a),Ry({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Py({anyProcess:e,channel:t,ipcEmitter:s,isSubprocess:r,shouldAwait:o,
|
|
664
|
+
controller:a,state:c,reference:i})},Iy=async(e,t,r)=>{try{await Au(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},
|
|
665
|
+
Ry=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await Au(e,"strict:error",{signal:r.signal});n.
|
|
666
|
+
error=Er(o,t),r.abort()}catch{}},Py=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,
|
|
667
|
+
state:s,reference:a}){try{for await(let[c]of Ay(r,"message",{signal:i.signal}))Tu(s),yield c}catch{Tu(s)}finally{i.abort(),
|
|
668
|
+
Ir(t,a),n||Ye(e),o&&await e}},Tu=({error:e})=>{if(e)throw e};var Pu=(e,{ipc:t})=>{Object.assign(e,Cu(e,!1,t))},Ou=()=>{let e=Ru,t=!0,r=Ru.channel!==void 0;return{...Cu(e,t,r),getCancelSignal:Dc.
|
|
669
|
+
bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},Cu=(e,t,r)=>({sendMessage:Nr.bind(void 0,{anyProcess:e,
|
|
670
|
+
channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:vu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),
|
|
671
|
+
getEachMessage:Iu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as Oy}from"node:child_process";import{PassThrough as Cy,Readable as xy,Writable as ky,Duplex as Ny}from"node:stream";var xu=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,verboseInfo:s})=>{jo(n);let a=new Oy;
|
|
672
|
+
$y(a,n),Object.assign(a,{readable:My,writable:Dy,duplex:Ly});let c=Ze({error:e,command:t,escapedCommand:r,fileDescriptors:n,
|
|
673
|
+
options:o,startTime:i,isSync:!1}),l=By(c,s,o);return{subprocess:a,promise:l}},$y=(e,t)=>{let r=Nt(),n=Nt(),o=Nt(),i=Array.
|
|
674
|
+
from({length:t.length-3},Nt),s=Nt(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,all:s,stdio:a})},Nt=()=>{let e=new Cy;
|
|
675
|
+
return e.end(),e},My=()=>new xy({read(){}}),Dy=()=>new ky({write(){}}),Ly=()=>new Ny({read(){},write(){}}),By=async(e,t,r)=>Qe(
|
|
676
|
+
e,t,r);import{createReadStream as ku,createWriteStream as Nu}from"node:fs";import{Buffer as Uy}from"node:buffer";import{Readable as $t,
|
|
677
|
+
Writable as zy,Duplex as Gy}from"node:stream";var Mu=(e,t)=>Kr(Fy,e,t,!1),Mt=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${ve[e]}.`)},
|
|
678
|
+
$u={fileNumber:Mt,generator:Xo,asyncGenerator:Xo,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,
|
|
679
|
+
readableObjectMode:r}}){let n=t||r;return{stream:Gy.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),
|
|
680
|
+
native(){}},Fy={input:{...$u,fileUrl:({value:e})=>({stream:ku(e)}),filePath:({value:{file:e}})=>({stream:ku(e)}),webStream:({
|
|
681
|
+
value:e})=>({stream:$t.fromWeb(e)}),iterable:({value:e})=>({stream:$t.from(e)}),asyncIterable:({value:e})=>({stream:$t.from(
|
|
682
|
+
e)}),string:({value:e})=>({stream:$t.from(e)}),uint8Array:({value:e})=>({stream:$t.from(Uy.from(e))})},output:{...$u,fileUrl:({
|
|
683
|
+
value:e})=>({stream:Nu(e)}),filePath:({value:{file:e,append:t}})=>({stream:Nu(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({
|
|
684
|
+
stream:zy.fromWeb(e)}),iterable:Mt,asyncIterable:Mt,string:Mt,uint8Array:Mt}};import{on as Hy,once as Du}from"node:events";import{PassThrough as jy,getDefaultHighWaterMark as Vy}from"node:stream";import{
|
|
685
|
+
finished as Uu}from"node:stream/promises";function $e(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, go\
|
|
686
|
+
t \`${typeof e}\`.`);for(let o of e)ri(o);let t=e.some(({readableObjectMode:o})=>o),r=Wy(e,t),n=new ti({objectMode:t,writableHighWaterMark:r,
|
|
687
|
+
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var Wy=(e,t)=>{if(e.length===0)return Vy(t);let r=e.filter(({
|
|
688
|
+
readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},ti=class extends jy{#t=new Set(
|
|
689
|
+
[]);#r=new Set([]);#e=new Set([]);#n;#i=Symbol("unpipe");#o=new WeakMap;add(t){if(ri(t),this.#t.has(t))return;this.#t.add(
|
|
690
|
+
t),this.#n??=qy(this,this.#t,this.#i);let r=Xy({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,
|
|
691
|
+
onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(ri(t),!this.#t.has(t))
|
|
692
|
+
return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},qy=async(e,t,r)=>{rn(
|
|
693
|
+
e,Lu);let n=new AbortController;try{await Promise.race([Yy(e,n),Ky(e,t,r,n)])}finally{n.abort(),rn(e,-Lu)}},Yy=async(e,{
|
|
694
|
+
signal:t})=>{try{await Uu(e,{signal:t,cleanup:!0})}catch(r){throw zu(e,r),r}},Ky=async(e,t,r,{signal:n})=>{for await(let[
|
|
695
|
+
o]of Hy(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},ri=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a\
|
|
696
|
+
readable stream, got: \`${typeof e}\`.`)},Xy=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:i,
|
|
697
|
+
unpipeEvent:s})=>{rn(e,Bu);let a=new AbortController;try{await Promise.race([Jy(i,t,a),Zy({passThroughStream:e,stream:t,
|
|
698
|
+
streams:r,ended:n,aborted:o,controller:a}),Qy({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{
|
|
699
|
+
a.abort(),rn(e,-Bu)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?ni(e):e_(e))},Jy=async(e,t,{signal:r})=>{try{
|
|
700
|
+
await e,r.aborted||ni(t)}catch(n){r.aborted||zu(t,n)}},Zy=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,
|
|
701
|
+
controller:{signal:i}})=>{try{await Uu(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.
|
|
702
|
+
aborted||!r.has(t))return;Gu(s)?o.add(t):Fu(e,s)}},Qy=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{
|
|
703
|
+
signal:i}})=>{if(await Du(e,o,{signal:i}),!e.readable)return Du(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},
|
|
704
|
+
e_=e=>{e.writable&&e.end()},zu=(e,t)=>{Gu(t)?ni(e):Fu(e,t)},Gu=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",ni=e=>{(e.readable||
|
|
705
|
+
e.writable)&&e.destroy()},Fu=(e,t)=>{e.destroyed||(e.once("error",t_),e.destroy(t))},t_=()=>{},rn=(e,t)=>{let r=e.getMaxListeners();
|
|
706
|
+
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},Lu=2,Bu=1;import{finished as Hu}from"node:stream/promises";var tt=(e,t)=>{e.pipe(t),r_(e,t),n_(e,t)},r_=async(e,t)=>{if(!(re(e)||re(t))){try{await Hu(e,{cleanup:!0,readable:!0,writable:!1})}catch{}
|
|
707
|
+
oi(t)}},oi=e=>{e.writable&&e.end()},n_=async(e,t)=>{if(!(re(e)||re(t))){try{await Hu(t,{cleanup:!0,readable:!1,writable:!0})}catch{}
|
|
708
|
+
ii(e)}},ii=e=>{e.readable&&e.destroy()};var ju=(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(({
|
|
709
|
+
type:c})=>Z.has(c)))o_(e,a,s,o);for(let{stream:a}of i.filter(({type:c})=>!Z.has(c)))s_({subprocess:e,stream:a,direction:s,
|
|
710
|
+
fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.length===1?i[0]:$e(i);tt(s,o)}},o_=(e,t,r,n)=>{
|
|
711
|
+
r==="output"?tt(e.stdio[n],t):tt(t,e.stdio[n]);let o=i_[n];o!==void 0&&(e[o]=t),e.stdio[n]=t},i_=["stdin","stdout","stde\
|
|
712
|
+
rr"],s_=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{if(t===void 0)return;a_(t,i);let[s,
|
|
713
|
+
a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},a_=(e,{signal:t})=>{re(e)&&Ce(e,c_,t)},c_=2;import{addAbortListener as d_}from"node:events";var Me=[];Me.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Me.push("SIGALRM","SIGABRT","SIGVTALRM","SIGX\
|
|
714
|
+
CPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Me.push("SIGIO","SIGPOLL","S\
|
|
715
|
+
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",si=Symbol.
|
|
717
|
+
for("signal-exit emitter"),ai=globalThis,l_=Object.defineProperty.bind(Object),ci=class{emitted={afterExit:!1,exit:!1};listeners={
|
|
718
|
+
afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(ai[si])return ai[si];l_(ai,si,{value:this,writable:!1,enumerable:!1,
|
|
719
719
|
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
720
|
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}},
|
|
722
|
-
onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),
|
|
723
|
-
|
|
724
|
-
t,this.#o={};for(let r of
|
|
721
|
+
listeners[t])o=i(r,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",r,n)||o),o}},on=class{},u_=e=>({onExit(t,r){return e.
|
|
722
|
+
onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),li=class extends on{onExit(){return()=>{}}load(){}unload(){}},
|
|
723
|
+
ui=class extends on{#t=di.platform==="win32"?"SIGINT":"SIGHUP";#r=new ci;#e;#n;#i;#o={};#s=!1;constructor(t){super(),this.#e=
|
|
724
|
+
t,this.#o={};for(let r of Me)this.#o[r]=()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__==
|
|
725
725
|
"object"&&typeof i.__signal_exit_emitter__.count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();
|
|
726
726
|
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
|
-
if(!
|
|
727
|
+
if(!nn(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{
|
|
728
728
|
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,
|
|
729
|
+
if(!this.#s){this.#s=!0,this.#r.count+=1;for(let t of Me)try{let r=this.#o[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#c(
|
|
730
|
+
t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,Me.forEach(t=>{let r=this.#o[t];if(!r)throw new Error(
|
|
731
731
|
"Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=
|
|
732
|
-
this.#i,this.#r.count-=1)}#a(t){return
|
|
733
|
-
call(this.#e,this.#e.exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&
|
|
732
|
+
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
|
+
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
734
|
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}=
|
|
735
|
+
di=globalThis.process,{onExit:Vu,load:Xk,unload:Jk}=u_(nn(di)?new ui(di):new li);var Wu=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=Vu(()=>{e.kill()});d_(n,()=>{o()})};var Yu=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=pr(),{destination:s,destinationStream:a,destinationError:c,
|
|
736
|
+
from:l,unpipeSignal:u}=f_(r,n,o),{sourceStream:d,sourceError:f}=m_(e,l),{options:p,fileDescriptors:m}=ue.get(e);return{sourcePromise:t,
|
|
737
737
|
sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,
|
|
738
|
-
startTime:i}},
|
|
739
|
-
destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},
|
|
740
|
-
isArray(r))return{destination:t(
|
|
738
|
+
startTime:i}},f_=(e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=p_(e,t,...r),a=Tr(n,i);return{
|
|
739
|
+
destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){return{destinationError:n}}},p_=(e,t,r,...n)=>{if(Array.
|
|
740
|
+
isArray(r))return{destination:t(qu,e)(r,...n),pipeOptions:e};if(typeof r=="string"||r instanceof URL||Qn(r)){if(Object.keys(
|
|
741
741
|
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]=
|
|
742
|
+
.pipe(options)("file", ...).');let[o,i,s]=nr(r,...n);return{destination:t(qu)(o,i,s),pipeOptions:s}}if(ue.has(r)){if(Object.
|
|
743
743
|
keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(\
|
|
744
744
|
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{}
|
|
755
|
-
await
|
|
756
|
-
sourceOptions:o,startTime:i})};var
|
|
757
|
-
e,...t),o=
|
|
745
|
+
e string, an options object, or an Execa subprocess: ${r}`)},qu=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),
|
|
746
|
+
m_=(e,t)=>{try{return{sourceStream:Ke(e,t)}}catch(r){return{sourceError:r}}};var Xu=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:i,startTime:s})=>{
|
|
747
|
+
let a=h_({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(a!==void 0)throw fi({error:a,fileDescriptors:o,
|
|
748
|
+
sourceOptions:i,startTime:s})},h_=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>{if(t!==void 0&&
|
|
749
|
+
n!==void 0)return n;if(n!==void 0)return ii(e),n;if(t!==void 0)return oi(r),t},fi=({error:e,fileDescriptors:t,sourceOptions:r,
|
|
750
|
+
startTime:n})=>Ze({error:e,command:Ku,escapedCommand:Ku,fileDescriptors:t,options:r,startTime:n,isSync:!1}),Ku="source.p\
|
|
751
|
+
ipe(destination)";var Ju=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.
|
|
752
|
+
pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s};import{finished as g_}from"node:stream/promises";var Zu=(e,t,r)=>{let n=sn.has(t)?w_(e,t):b_(e,t);return Ce(e,__,r.signal),Ce(t,S_,r.signal),y_(t),n},b_=(e,t)=>{let r=$e(
|
|
753
|
+
[e]);return tt(r,t),sn.set(t,r),r},w_=(e,t)=>{let r=sn.get(t);return r.add(e),r},y_=async e=>{try{await g_(e,{cleanup:!0,
|
|
754
|
+
readable:!1,writable:!0})}catch{}sn.delete(e)},sn=new WeakMap,__=2,S_=1;import{aborted as E_}from"node:util";var Qu=(e,t)=>e===void 0?[]:[v_(e,t)],v_=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{
|
|
755
|
+
await E_(e,t),await r.remove(t);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw fi({error:s,fileDescriptors:n,
|
|
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}=Yu(
|
|
757
|
+
e,...t),o=T_({...n,destination:r});return o.pipe=an.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},T_=async({
|
|
758
758
|
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 f=
|
|
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([
|
|
777
|
-
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!
|
|
778
|
-
verboseInfo:i,fdNumber:r}))return;let a=
|
|
779
|
-
await
|
|
780
|
-
iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await
|
|
781
|
-
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
|
-
|
|
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&&(
|
|
759
|
+
fileDescriptors:c,startTime:l})=>{let u=A_(e,o);Xu({sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,
|
|
760
|
+
fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Zu(t,i,d);return await Promise.race(
|
|
761
|
+
[Ju(u),...Qu(a,{sourceStream:t,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},A_=(e,t)=>Promise.
|
|
762
|
+
allSettled([e,t]);import{setImmediate as k_}from"node:timers/promises";import{on as I_}from"node:events";import{getDefaultHighWaterMark as R_}from"node:stream";var cn=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{let s=new AbortController;
|
|
763
|
+
return P_(t,s),td({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,
|
|
764
|
+
preserveNewlines:i})},P_=async(e,t)=>{try{await e}catch{}finally{t.abort()}},pi=({stream:e,onStreamEnd:t,lines:r,encoding:n,
|
|
765
|
+
stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;O_(t,s,e);let a=e.readableObjectMode&&!i;return td({stream:e,
|
|
766
|
+
controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},O_=async(e,t,r)=>{try{
|
|
767
|
+
await e}catch{r.destroy()}finally{t.abort()}},td=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,
|
|
768
|
+
preserveNewlines:s})=>{let a=I_(e,"data",{signal:t.signal,highWaterMark:ed,highWatermark:ed});return C_({onStdoutChunk:a,
|
|
769
|
+
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},mi=R_(!0),ed=mi,C_=async function*({
|
|
770
|
+
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=x_({binary:r,shouldEncode:n,
|
|
771
|
+
encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*Ne(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{
|
|
772
|
+
yield*kt(a)}},x_=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[Jr(e,r,!t),Xr(e,o,!n,{})].filter(
|
|
773
|
+
Boolean);var rd=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,
|
|
774
|
+
streamInfo:u})=>{let d=N_({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!o){await Promise.
|
|
775
|
+
all([$_(e),d]);return}let f=Vo(c,r),p=pi({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.
|
|
776
|
+
all([M_({stream:e,iterable:p,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),d]);return m},N_=async({stream:e,onStreamEnd:t,
|
|
777
|
+
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=pi({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});
|
|
779
|
+
await pu(a,e,r,i)},$_=async e=>{await k_(),e.readableFlowing===null&&e.resume()},M_=async({stream:e,stream:{readableObjectMode:t},
|
|
780
|
+
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 Hr(r,{maxBuffer:i})}catch(a){return nd(pl({error:a,stream:e,readableObjectMode:t,lines:s,
|
|
782
|
+
encoding:o,fdNumber:n}))}},hi=async e=>{try{return await e}catch(t){return nd(t)}},nd=({bufferedData:e})=>Os(e)?new Uint8Array(
|
|
783
|
+
e):e;import{finished as D_}from"node:stream/promises";var Dt=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let i=L_(e,
|
|
784
|
+
r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],D_(e,{cleanup:!0,signal:s.signal})])}catch(a){i.
|
|
785
|
+
stdinCleanedUp||z_(a,t,r,n)}finally{s.abort()}},L_=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===
|
|
786
|
+
t&&B_(e,r,n),n},B_=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{U_(t,r),n.call(e,...o)}},U_=({exitCode:e,signalCode:t},r)=>{
|
|
787
|
+
(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},z_=(e,t,r,n)=>{if(!G_(e,t,r,n))throw e},G_=(e,t,r,n=!0)=>r.propagating?od(e)||
|
|
788
|
+
ln(e):(r.propagating=!0,gi(r,t)===n?od(e):ln(e)),gi=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",ln=e=>e?.
|
|
789
|
+
code==="ERR_STREAM_PREMATURE_CLOSE",od=e=>e?.code==="EPIPE";var id=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>e.stdio.
|
|
790
|
+
map((c,l)=>bi({stream:c,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,stripFinalNewline:i,verboseInfo:s,
|
|
791
|
+
streamInfo:a})),bi=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,
|
|
792
|
+
streamInfo:l})=>{if(!e)return;let u=Dt(e,t,l);if(gi(l,t)){await u;return}let[d]=await Promise.all([rd({stream:e,onStreamEnd:u,
|
|
793
|
+
fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var sd=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?$e([e,t].filter(Boolean)):void 0,ad=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,
|
|
794
|
+
lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>bi({...F_(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||
|
|
795
|
+
o[2],allMixed:H_(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),F_=({stdout:e,stderr:t,all:r},[,n,o])=>{let i=n||o;
|
|
796
|
+
return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,buffer:i}},H_=({all:e,stdout:t,stderr:r})=>e&&
|
|
797
|
+
t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as j_}from"node:events";var cd=e=>je(e,"ipc"),ld=(e,t)=>{let r=fr(e);ce({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var ud=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{if(!n)return o;let s=cd(i),a=ge(t,"i\
|
|
798
|
+
pc"),c=ge(r,"ipc");for await(let l of ei({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))
|
|
799
|
+
a&&(ml(e,o,c),o.push(l)),s&&ld(l,i);return o},dd=async(e,t)=>(await Promise.allSettled([e]),t);var fd=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,
|
|
800
800
|
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,
|
|
801
|
-
onInternalError:_,controller:
|
|
802
|
-
|
|
803
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:p,streamInfo:
|
|
804
|
-
maxBuffer:n,ipc:u,ipcOutput:
|
|
805
|
-
Promise.all(
|
|
806
|
-
controller:
|
|
807
|
-
return f.terminationReason??="other",Promise.all([{error:
|
|
808
|
-
|
|
809
|
-
filter(({value:o,stream:i=o})=>
|
|
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},
|
|
815
|
-
{subprocessStdout:a,waitReadableDestroy:c}=
|
|
816
|
-
a,s),{read:f,onStdoutDataDone:p}=
|
|
817
|
-
read:f,destroy:
|
|
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:p,readableObjectMode:m,readableHighWaterMark:h}=
|
|
836
|
-
subprocess:e,binary:a,encoding:r,preserveNewlines:s}),
|
|
801
|
+
onInternalError:_,controller:b})=>{let g=wu(e,f),T={originalStreams:h,fileDescriptors:m,subprocess:e,exitPromise:g,propagating:!1},
|
|
802
|
+
y=id({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:p,streamInfo:T}),A=ad({subprocess:e,
|
|
803
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:p,streamInfo:T}),R=[],S=ud({subprocess:e,buffer:r,
|
|
804
|
+
maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),x=V_(h,e,T),$=W_(m,T);try{return await Promise.race([Promise.all([{},_u(g),
|
|
805
|
+
Promise.all(y),A,S,Wc(e,d),...x,...$]),_,q_(e,b),...Gc(e,i,f,b),...cc({subprocess:e,cancelSignal:s,gracefulCancel:a,context:f,
|
|
806
|
+
controller:b}),...Uc({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(M){
|
|
807
|
+
return f.terminationReason??="other",Promise.all([{error:M},g,Promise.all(y.map(k=>hi(k))),hi(A),dd(S,R),Promise.allSettled(
|
|
808
|
+
x),Promise.allSettled($)])}},V_=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:Dt(n,o,r)),W_=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.
|
|
809
|
+
filter(({value:o,stream:i=o})=>ie(i,{checkOpen:!1})&&!re(i)).map(({type:o,value:i,stream:s=i})=>Dt(s,n,t,{isSameDirection:Z.
|
|
810
|
+
has(o),stopOnExit:o==="native"}))),q_=async(e,{signal:t})=>{let[r]=await j_(e,"error",{signal:t});throw r};var pd=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Lt=(e,t,r)=>{let n=e[r];
|
|
811
|
+
n.has(t)||n.set(t,[]);let o=n.get(t),i=le();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},rt=async({resolve:e,
|
|
812
|
+
promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n};import{Readable as Y_}from"node:stream";import{callbackify as K_}from"node:util";import{finished as md}from"node:stream/promises";var wi=async e=>{if(e!==void 0)try{await yi(e)}catch{}},hd=async e=>{if(e!==void 0)try{await _i(e)}catch{}},yi=async e=>{
|
|
813
|
+
await md(e,{cleanup:!0,readable:!1,writable:!0})},_i=async e=>{await md(e,{cleanup:!0,readable:!0,writable:!1})},un=async(e,t)=>{
|
|
814
|
+
if(await e,t)throw t},dn=(e,t,r)=>{r&&!ln(r)?e.destroy(r):t&&e.destroy()};var gd=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{let s=o||W.has(r),
|
|
815
|
+
{subprocessStdout:a,waitReadableDestroy:c}=Si(e,n,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=Ei(
|
|
816
|
+
a,s),{read:f,onStdoutDataDone:p}=vi({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),m=new Y_({
|
|
817
|
+
read:f,destroy:K_(Ai.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,
|
|
818
|
+
encoding:l});return Ti({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:e}),m},Si=(e,t,r)=>{let n=Ke(e,t),o=Lt(
|
|
819
|
+
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},Ei=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?
|
|
820
|
+
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:mi},
|
|
821
|
+
vi=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=le(),s=cn({subprocessStdout:e,subprocess:t,
|
|
822
|
+
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){X_(this,s,i)},onStdoutDataDone:i}},X_=async(e,t,r)=>{
|
|
823
|
+
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},Ti=async({subprocessStdout:e,onStdoutDataDone:t,
|
|
824
|
+
readable:r,subprocess:n,subprocessStdin:o})=>{try{await _i(e),await n,await wi(o),await t,r.readable&&r.push(null)}catch(i){
|
|
825
|
+
await wi(o),bd(r,i)}},Ai=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await rt(r,t)&&(bd(e,n),await un(
|
|
826
|
+
t,n))},bd=(e,t)=>{dn(e,e.readable,t)};import{Writable as J_}from"node:stream";import{callbackify as wd}from"node:util";var yd=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=Ii(
|
|
827
|
+
e,r,t),s=new J_({...Ri(n,e,o),destroy:wd(Oi.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),
|
|
828
|
+
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return Pi(n,s),s},Ii=(e,t,r)=>{let n=Tr(e,t),o=Lt(
|
|
829
|
+
r,n,"writableFinal"),i=Lt(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},Ri=(e,t,r)=>({
|
|
830
|
+
write:Z_.bind(void 0,e),final:wd(Q_.bind(void 0,e,t,r))}),Z_=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},Q_=async(e,t,r)=>{
|
|
831
|
+
await rt(r,t)&&(e.writable&&e.end(),await t)},Pi=async(e,t,r)=>{try{await yi(e),t.writable&&t.end()}catch(n){await hd(r),
|
|
832
|
+
_d(t,n)}},Oi=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await rt(r,t),await rt(
|
|
833
|
+
n,t)&&(_d(e,o),await un(t,o))},_d=(e,t)=>{dn(e,e.writable,t)};import{Duplex as eS}from"node:stream";import{callbackify as tS}from"node:util";var Sd=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||W.has(
|
|
834
|
+
r),{subprocessStdout:c,waitReadableDestroy:l}=Si(e,n,t),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=Ii(
|
|
835
|
+
e,o,t),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=Ei(c,a),{read:_,onStdoutDataDone:b}=vi({subprocessStdout:c,
|
|
836
|
+
subprocess:e,binary:a,encoding:r,preserveNewlines:s}),g=new eS({read:_,...Ri(u,e,d),destroy:tS(rS.bind(void 0,{subprocessStdout:c,
|
|
837
837
|
subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,
|
|
838
838
|
writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});
|
|
839
|
-
return
|
|
839
|
+
return Ti({subprocessStdout:c,onStdoutDataDone:b,readable:g,subprocess:e,subprocessStdin:u}),Pi(u,g,c),g},rS=async({subprocessStdout:e,
|
|
840
840
|
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:f,promise:p}=
|
|
849
|
-
fileDescriptors:d});return f.pipe=
|
|
850
|
-
f,{options:u,fileDescriptors:d}),f},
|
|
851
|
-
commandArguments:c,options:l}=
|
|
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:f,context:d,controller:l}),c.all=
|
|
841
|
+
Ai({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},s),Oi({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},
|
|
842
|
+
s)])};var Ci=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||W.has(t),s=Ke(e,r),a=cn({subprocessStdout:s,subprocess:e,
|
|
843
|
+
binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return nS(a,s,e)},nS=async function*(e,t,r){try{yield*e}finally{
|
|
844
|
+
t.readable&&t.destroy(),await r}};var Ed=(e,{encoding:t})=>{let r=pd();e.readable=gd.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=
|
|
845
|
+
yd.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=Sd.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),
|
|
846
|
+
e.iterable=Ci.bind(void 0,e,t),e[Symbol.asyncIterator]=Ci.bind(void 0,e,t,{})};var vd=(e,t)=>{for(let[r,n]of iS){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},oS=(async()=>{})().
|
|
847
|
+
constructor.prototype,iS=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(oS,e)]);var Td=(e,t,r,n)=>{let{file:o,commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=cS(
|
|
848
|
+
e,t,r),{subprocess:f,promise:p}=uS({file:o,commandArguments:i,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,
|
|
849
|
+
fileDescriptors:d});return f.pipe=an.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),vd(f,p),ue.set(
|
|
850
|
+
f,{options:u,fileDescriptors:d}),f},cS=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=mr(e,t,r),{file:a,
|
|
851
|
+
commandArguments:c,options:l}=Mr(e,t,r),u=lS(l),d=Mu(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,
|
|
852
|
+
verboseInfo:s,options:u,fileDescriptors:d}},lS=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "sig\
|
|
853
|
+
nal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},uS=({file:e,commandArguments:t,
|
|
854
|
+
options:r,startTime:n,verboseInfo:o,command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=aS(...Dr(e,t,r))}catch(m){
|
|
855
|
+
return xu({error:m,command:i,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let l=new AbortController;
|
|
856
|
+
sS(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];ju(c,a,l),Wu(c,r,l);let d={},f=le();c.kill=sc.bind(void 0,{kill:c.
|
|
857
|
+
kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=sd(c,r),Ed(c,r),Pu(c,r);let p=dS({subprocess:c,options:r,
|
|
858
858
|
startTime:n,verboseInfo:o,fileDescriptors:a,originalStreams:u,command:i,escapedCommand:s,context:d,onInternalError:f,controller:l});
|
|
859
|
-
return{subprocess:c,promise:p}},
|
|
860
|
-
command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,_]=await
|
|
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?
|
|
859
|
+
return{subprocess:c,promise:p}},dS=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,
|
|
860
|
+
command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,_]=await fd({subprocess:e,options:t,
|
|
861
|
+
context:c,verboseInfo:n,fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.
|
|
862
|
+
map((y,A)=>we(y,t,A)),g=we(h,t,"all"),T=fS({errorInfo:d,exitCode:f,signal:p,stdio:b,all:g,ipcOutput:_,context:c,options:t,
|
|
863
|
+
command:s,escapedCommand:a,startTime:r});return Qe(T,n,t)},fS=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,
|
|
864
|
+
context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in e?xt({error:e.error,command:c,escapedCommand:l,timedOut:s.
|
|
865
865
|
terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.
|
|
866
|
-
terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof
|
|
867
|
-
signal:r,stdio:n,all:o,ipcOutput:i,options:a,startTime:u,isSync:!1}):
|
|
868
|
-
options:a,startTime:u});var
|
|
869
|
-
has(e)&&
|
|
870
|
-
createNested:o},...s);return n!==void 0&&n(i,o,t),i},
|
|
871
|
-
createNested:o},i,...s)=>{if(
|
|
872
|
-
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?
|
|
873
|
-
nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=
|
|
866
|
+
terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof de,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,
|
|
867
|
+
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 fn=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([n,o])=>[n,pS(n,e[n],o)]));return{...e,...r}},pS=(e,t,r)=>mS.
|
|
869
|
+
has(e)&&L(t)&&L(r)?{...t,...r}:r,mS=new Set(["env",...io]);var Te=(e,t,r,n)=>{let o=(s,a,c)=>Te(s,a,r,c),i=(...s)=>hS({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,
|
|
870
|
+
createNested:o},...s);return n!==void 0&&n(i,o,t),i},hS=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,
|
|
871
|
+
createNested:o},i,...s)=>{if(L(i))return o(e,fn(r,i),n);let{file:a,commandArguments:c,options:l,isSync:u}=gS({mapArguments:e,
|
|
872
|
+
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?Eu(a,c,l):Td(a,c,l,o)},gS=({mapArguments:e,firstArgument:t,
|
|
873
|
+
nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=Ms(t)?Ds(t,r):[t,...r],[s,a,c]=nr(...i),l=fn(fn(n,o),c),{file:u=s,
|
|
874
874
|
commandArguments:d=a,options:f=l,isSync:p=!1}=e({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,
|
|
875
|
-
options:f,isSync:p}};var
|
|
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:
|
|
875
|
+
options:f,isSync:p}};var Ad=({file:e,commandArguments:t})=>Rd(e,t),Id=({file:e,commandArguments:t})=>({...Rd(e,t),isSync:!0}),Rd=(e,t)=>{if(t.
|
|
876
|
+
length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=bS(
|
|
877
|
+
e);return{file:r,commandArguments:n}},bS=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(
|
|
878
|
+
e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(wS)){let o=r.at(-1);o&&o.endsWith("\\")?r[r.length-
|
|
879
|
+
1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},wS=/ +/g;var Pd=(e,t,r)=>{e.sync=t(yS,r),e.s=e.sync},Od=({options:e})=>Cd(e),yS=({options:e})=>({...Cd(e),isSync:!0}),Cd=e=>({options:{
|
|
880
|
+
..._S(e),...e}}),_S=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},xd={preferLocal:!0};var kd=Te(()=>({})),zM=Te(()=>({isSync:!0})),GM=Te(Ad),FM=Te(Id),HM=Te(Hc),jM=Te(Od,{},xd,Pd),{sendMessage:VM,getOneMessage:WM,
|
|
881
|
+
getEachMessage:qM,getCancelSignal:YM}=Ou();function SS(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function Bt({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
882
882
|
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:d=null,retryable:f=null}={}){
|
|
883
|
-
let p=
|
|
884
|
-
`)).trim();return{code:
|
|
885
|
-
Number(s):null,signal:
|
|
886
|
-
ct"&&!Array.isArray(d)?{execution:d}:{},...typeof f=="boolean"?{retryable:f}:{}}}function
|
|
887
|
-
d",r={}){let n=
|
|
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?.(),
|
|
894
|
-
pid})}catch(o){return
|
|
895
|
-
execution})}finally{await n?.close?.().catch(()=>null)}}function
|
|
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(!
|
|
899
|
-
t):process.kill(-Number(e),t),!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function
|
|
900
|
-
now()+Math.max(0,Number(t)||0);for(;
|
|
901
|
-
killTimeoutMs:t=
|
|
902
|
-
n}var
|
|
883
|
+
let p=SS(r),m=String(l||""),h=String(c||""),_=String(o||[m,h].filter(Boolean).join(`
|
|
884
|
+
`)).trim();return{code:C(e),error:C(t),exitCode:p,ok:n===null?p===0:n===!0,output:_,pid:Number.isSafeInteger(Number(s))?
|
|
885
|
+
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 f=="boolean"?{retryable:f}:{}}}function z(e="",t="vibe64_command_faile\
|
|
887
|
+
d",r={}){let n=C(e)||"Vibe64 command failed.";return Bt({...r,code:t,error:n,exitCode:1,ok:!1,output:C(r.output)||n,stderr:r.
|
|
888
|
+
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}import{spawn as ES}from"node:child_process";import{mkdir as vS,open as TS}from"node:fs/promises";import AS from"node:path";var pn=new Map,IS=3e3,RS=1e3;async function PS(e=""){return e?(await vS(AS.dirname(e),{recursive:!0}),TS(e,"w",384)):null}
|
|
889
|
+
async function OS(e){return new Promise((t,r)=>{let n=!1,o=(i,s)=>{n||(n=!0,i(s))};e.once?.("spawn",()=>o(t)),e.once?.("\
|
|
890
|
+
error",i=>o(r,i))})}async function Md(e={},{cwd:t="",env:r={}}={}){let n=null;try{n=await PS(e.logPath);let o=n?["ignore",
|
|
891
|
+
n.fd,n.fd]:["ignore","ignore","ignore"],i=ES(e.command,e.args,{cwd:t||void 0,detached:!0,env:r,stdio:o});await OS(i);let s=e.
|
|
892
|
+
execution?.id||"";return s&&(pn.set(s,{child:i,pid:Number(i.pid)}),i.once?.("exit",()=>{mn(i.pid)||pn.set(s,{child:i,pid:Number(
|
|
893
|
+
i.pid),scopeEmpty:!0})})),i.unref?.(),Bt({execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:i.
|
|
894
|
+
pid})}catch(o){return z(o?.message||"Detached command failed to start.",o?.code||"vibe64_command_detached_failed",{execution:e.
|
|
895
|
+
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=[...pn.values()].find(n=>n.pid===t);return r?.child?.exitCode===null&&
|
|
897
|
+
r?.child?.signalCode===null}try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function Nd(e=null,t="SI\
|
|
898
|
+
GTERM"){if(!mn(e))return!1;try{return process.platform==="win32"?[...pn.values()].find(n=>n.pid===Number(e))?.child?.kill?.(
|
|
899
|
+
t):process.kill(-Number(e),t),!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function $d(e=null,t=0){let r=Date.
|
|
900
|
+
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=RS,termTimeoutMs:r=IS}={}){Nd(e,"SIGTERM");let n=await $d(e,r);return n||(Nd(e,"SIGKILL"),n=await $d(e,t)),
|
|
902
|
+
n}var Dd=new Map;async function De(e="",t=[],{cwd:r="",env:n={},execution:o=null,input:i=void 0,maxBuffer:s=void 0,onOutput:a=null,outputEncoding:c="\
|
|
903
903
|
utf8",signal:l=null,timeout:u=15e3}={}){let d,f,p,m=Promise.withResolvers(),h=()=>{p||=f(),p.then(m.resolve)};if(l?.aborted)
|
|
904
|
-
return
|
|
904
|
+
return z("Command cancelled.","vibe64_command_cancelled",{execution:o});try{let g=kd(e,t,{all:!0,cwd:r,detached:process.
|
|
905
905
|
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
|
-
|
|
908
|
-
l?.aborted&&h(),typeof a=="function"&&
|
|
909
|
-
[
|
|
910
|
-
ommand_capture_timed_out":A.code?"vibe64_command_capture_failed":"",error:
|
|
911
|
-
(
|
|
912
|
-
d=
|
|
913
|
-
outputEncoding:c,signal:
|
|
914
|
-
"abort",h)}if(!await(p||f?.()||!0))return
|
|
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
|
-
return{...e,schema:
|
|
919
|
-
vibe64-command",args:s=[]}={}){return
|
|
906
|
+
timeout:u}),T=Number(g.pid),y;f=()=>{if(!y){let S;process.platform!=="win32"?S=hn(T).catch(()=>!1):(g.kill("SIGKILL"),S=
|
|
907
|
+
g.then(()=>!0,()=>!0)),y=S.then(x=>(x||(y=null),x))}return y},o?.id&&Dd.set(o.id,f),l?.addEventListener("abort",h,{once:!0}),
|
|
908
|
+
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})]),R=typeof A.exitCode=="number"?A.exitCode:1;d=Bt({code:A.timedOut===!0?"vibe64_c\
|
|
910
|
+
ommand_capture_timed_out":A.code?"vibe64_command_capture_failed":"",error:R===0?"":A.shortMessage,exitCode:R,output:A.all||
|
|
911
|
+
(R===0?"":A.shortMessage),outputEncoding:c,signal:A.signal,stderr:A.stderr,stdout:A.stdout,timedOut:A.timedOut===!0,execution:o})}catch(g){
|
|
912
|
+
d=z(g.message,"vibe64_command_capture_failed",{execution:o,exitCode:typeof g.exitCode=="number"?g.exitCode:1,output:g.all,
|
|
913
|
+
outputEncoding:c,signal:g.signal,stderr:g.stderr,stdout:g.stdout,timedOut:g.timedOut===!0})}finally{l?.removeEventListener(
|
|
914
|
+
"abort",h)}if(!await(p||f?.()||!0))return z("The command finished, but its execution scope did not become empty.","vibe6\
|
|
915
|
+
4_execution_drain_failed",{execution:o,output:d?.output,outputEncoding:c,stderr:d?.stderr,stdout:d?.stdout});o?.id&&Dd.delete(
|
|
916
|
+
o.id);let b=o&&{...o,state:"finished"};return l?.aborted?z("Command cancelled.","vibe64_command_cancelled",{...d,execution:b,
|
|
917
|
+
outputEncoding:c}):b?{...d,execution:b}:d}var gn="/usr/lib/vibe64/vibe64-exec-helper",Ld="vibe64.exec-helper.payload",Bd=1,bn="VIBE64_EXEC_HELPER_PATH";function Ud(e={}){
|
|
918
|
+
return{...e,schema:Ld,schemaVersion:Bd}}function Ut({actor:e={},command:t="",cwd:r="",env:n={},input:o=void 0,operation:i="\
|
|
919
|
+
vibe64-command",args:s=[]}={}){return Ud({args:Array.isArray(s)?s.map(a=>String(a)):[],command:t,cwd:r,env:n,gid:e.user?.
|
|
920
920
|
gid,home:e.user?.home,inputBase64:o==null?"":Buffer.isBuffer(o)?o.toString("base64"):Buffer.from(String(o)).toString("ba\
|
|
921
|
-
se64"),operation:i,uid:e.user?.uid,username:e.user?.username})}function
|
|
921
|
+
se64"),operation:i,uid:e.user?.uid,username:e.user?.username})}function zt(e={}){return e.mode==="pty"&&e.envPolicy==="a\
|
|
922
922
|
uth"&&!["assistant","codex"].includes(e.purpose)?"account-auth-terminal":e.purpose==="codex"&&e.mode==="capture"&&e.envPolicy===
|
|
923
923
|
"auth"||e.purpose==="codex"&&e.mode==="detached"&&e.execution?.kind==="assistant"&&e.execution?.lifecycle==="service"?"c\
|
|
924
924
|
odex-app-server":e.mode==="detached"&&e.execution?.kind==="assistant"&&e.execution?.lifecycle==="service"&&["opencode-ca\
|
|
925
925
|
talog","opencode-server"].includes(e.execution?.operationId)||e.mode==="capture"&&e.execution?.kind==="assistant"&&e.execution?.
|
|
926
926
|
operationId==="opencode-catalog"?"opencode-app-server":e.purpose==="account"?"account-status":e.purpose==="github"?"gith\
|
|
927
|
-
ub-workflow-command":e.purpose==="github-api"?"github-api-command":e.purpose==="
|
|
928
|
-
async function
|
|
929
|
-
timeout:a=15e3}={}){let c={env:t,input:`${JSON.stringify(e)}
|
|
927
|
+
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 xi(e={},{env:t=process.env,helperPath:r="",maxBuffer:n=void 0,
|
|
929
|
+
outputEncoding:o="utf8",runCapture:i=De,signal:s=null,timeout:a=15e3}={}){let c={env:t,input:`${JSON.stringify(e)}
|
|
930
930
|
`,outputEncoding:o,signal:s,timeout:a};return Number.isSafeInteger(Number(n))&&Number(n)>0&&(c.maxBuffer=Number(n)),i("s\
|
|
931
|
-
udo",["-n",r||t[
|
|
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:
|
|
931
|
+
udo",["-n",r||t[bn]||gn,"execute"],c)}import{createRequire as xS}from"node:module";var CS=new URL("./../../../../@jskit-ai/kernel/server/support/symlinkSafeRequire.js",import.meta.url).href;var uD=xS(CS);var fD=Object.freeze(["none","pending","committed","rolledBack","unknown"]);var pD=Object.freeze(["bundled","dev_server"]),mD=Object.freeze(["capacitor"]),hD=Object.freeze({callbackPath:"/auth/log\
|
|
932
|
+
in",customScheme:"",appLinkDomains:Object.freeze([])}),gD=Object.freeze({packageName:"",minSdk:26,targetSdk:35,versionCode:1,
|
|
933
|
+
versionName:"1.0.0"});var ID=new URL("./../../../../@jskit-ai/kernel/server/support/appConfigFiles.js",import.meta.url).href;var MD=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),DD=Object.freeze(["capabilities","kind",
|
|
934
|
+
"metadata","migrations","runtime","vite"]);var ki="/api",qD=`${ki}/`,YD=`${ki}/docs`,KD=`${ki}/realtime`;var sL=Object.freeze(["compact","medium","expanded"]);function HS(e={}){return me(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
935
|
+
session?.metadata?.session_git_command_actor_user_key)}async function Hd(e={}){let t=C(e.actor)||"daemon";if(t==="daemon"||
|
|
936
|
+
t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:Yn()};let r=HS(e);if(!r){let n=new Error("A user key\
|
|
937
937
|
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
|
|
938
|
+
user",requiresRealUser:!0,user:await Kn(r)}}import rE from"node:path";import yn from"node:path";function nt(e={}){let t=Zn();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.user?.gid}function _n(e=process.
|
|
939
|
+
env){return!!(String(e?.VIBE64_WORKSPACE||"").trim()||String(e?.VIBE64_WORKSPACE_DAEMON_USER||"").trim())}function Sn(e={},{
|
|
940
|
+
env:t=process.env}={}){return e.requiresRealUser?_n(t)||!nt(e):!1}function jd(e={},t={},r=""){if(!e.requiresRealUser)return;
|
|
941
|
+
let n=O(t.session?.sourceRoot||t.session?.sourcePath),o=O(r);if(!n||!o)return;let i=yn.relative(n,o);if(i&&(i.startsWith(
|
|
942
|
+
"..")||yn.isAbsolute(i)))return;let s=new Error("Managed session source commands must retain the workspace daemon filesy\
|
|
943
|
+
stem identity.");throw s.code="vibe64_command_managed_source_real_user_forbidden",s}function Vd(e={},t={}){let r=O(e.user?.
|
|
944
|
+
home),n=O(t.HOME),o=O(t.VIBE64_CREDENTIAL_HOME);if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&yn.resolve(r)!==yn.resolve(n)){
|
|
945
|
+
let i=new Error("Command HOME does not match the resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",
|
|
946
|
+
i}}var ot=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
939
947
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
940
|
-
R","VIBE64_MYSQL_USER"]);function
|
|
941
|
-
return t}var
|
|
942
|
-
64"){return
|
|
943
|
-
let r=
|
|
948
|
+
R","VIBE64_MYSQL_USER"]);function Ft(...e){let t={};for(let r of e){let n=G(r);for(let o of ot)n[o]!==void 0&&(t[o]=n[o])}
|
|
949
|
+
return t}var it="GIT_AUTHOR_NAME",st="GIT_AUTHOR_EMAIL",at="GIT_COMMITTER_NAME",ct="GIT_COMMITTER_EMAIL";function Ni(e="",t="vibe\
|
|
950
|
+
64"){return C(e).toLowerCase().replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||t}function jS(...e){for(let t of e){
|
|
951
|
+
let r=H(t),n=H(r.user),o=me(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,n.name,n.userName,n.user_name),i=me(
|
|
944
952
|
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,
|
|
945
|
-
authorName:o,committerEmail:i,committerName:o,source:"configured"}}return null}function
|
|
946
|
-
t.displayName,t.login,t.username),n=
|
|
947
|
-
committerEmail:n,committerName:r,source:"github"}}function
|
|
953
|
+
authorName:o,committerEmail:i,committerName:o,source:"configured"}}return null}function VS(e={}){let t=H(e),r=me(t.name,
|
|
954
|
+
t.displayName,t.login,t.username),n=me(t.email,t.publicEmail,t.verifiedEmail);return!r||!n?null:{authorEmail:n,authorName:r,
|
|
955
|
+
committerEmail:n,committerName:r,source:"github"}}function Wd({tenant:e="",userKey:t=""}={}){let r=Ni(t,"user"),n=Ni(e,"\
|
|
948
956
|
local");return{authorEmail:`${r}@${n}.users.vibe64.invalid`,authorName:`${r} via Vibe64`,committerEmail:`vibe64@${n}.use\
|
|
949
|
-
rs.vibe64.invalid`,committerName:"Vibe64",source:"fallback"}}function
|
|
950
|
-
userKey:o=""}={}){let i=
|
|
951
|
-
email:t.VIBE64_GIT_USER_EMAIL})||
|
|
952
|
-
t.VIBE64_RUNTIME_NAMESPACE),userKey:
|
|
953
|
-
LOGNAME)})}function
|
|
954
|
-
managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.
|
|
955
|
-
managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:[
|
|
956
|
-
"composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt",
|
|
957
|
-
|
|
958
|
-
"
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
"
|
|
962
|
-
"
|
|
963
|
-
|
|
964
|
-
"
|
|
965
|
-
"
|
|
966
|
-
"
|
|
967
|
-
"
|
|
968
|
-
|
|
969
|
-
"
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
957
|
+
rs.vibe64.invalid`,committerName:"Vibe64",source:"fallback"}}function qd({actor:e={},env:t=process.env,project:r={},session:n={},
|
|
958
|
+
userKey:o=""}={}){let i=H(n.metadata);return jS(r.gitIdentity,r.config?.git,n.gitIdentity,i.git_identity,{name:t.VIBE64_GIT_USER_NAME,
|
|
959
|
+
email:t.VIBE64_GIT_USER_EMAIL})||VS(r.githubUser||n.githubUser||i.github_user)||Wd({tenant:me(r.tenant,r.workspace,t.VIBE64_WORKSPACE,
|
|
960
|
+
t.VIBE64_RUNTIME_NAMESPACE),userKey:me(o,e.user?.username,t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.
|
|
961
|
+
LOGNAME)})}function $i(e={}){let t=qd(e);return{[st]:t.authorEmail,[it]:t.authorName,[ct]:t.committerEmail,[at]:t.committerName}}import{readFileSync as WS}from"node:fs";import Xd from"node:path";import Mi from"node:path";var Di="VIBE64_RUNTIME_PACK_ROOT",Yd="/opt/vibe64/runtime-packs",Kd=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:[
|
|
962
|
+
"eb"]},bubblewrap:{binDirs:["bubblewrap/bin"],managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.jso\
|
|
963
|
+
n","bun.lock","bun.lockb","package-lock.json"],managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:[
|
|
964
|
+
"composer.json","composer.lock"],managedCommands:["composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt",
|
|
965
|
+
"vcpkg.json","vcpkg-configuration.json","conanfile.py","conan.lock"],managedCommands:["addr2line","ar","as","c++","c++fi\
|
|
966
|
+
lt","cc","clang","clang++","cmake","cpack","cpp","ctest","g++","gcc","gcore","gdb","gdb-add-index","gdbserver","gprof","\
|
|
967
|
+
gstack","ld","ld.bfd","ld.gold","ld.lld","ld64.lld","lld","lld-link","lldb","lldb-dap","lldb-server","make","ninja","nm",
|
|
968
|
+
"objcopy","objdump","pkg-config","ranlib","readelf","size","strings","strip","wasm-ld"]},python:{binDirs:["python/bin"],
|
|
969
|
+
dependencyFiles:["pyproject.toml","requirements.txt","requirements.lock","uv.lock","poetry.lock","Pipfile","Pipfile.lock"],
|
|
970
|
+
managedCommands:["python","python3","pip","pip3","virtualenv"]},ruby:{binDirs:["ruby/bin"],dependencyFiles:["Gemfile","G\
|
|
971
|
+
emfile.lock"],managedCommands:["ruby","gem","rake","irb","erb","ri","rdoc","bundle","bundler"]},go:{binDirs:["go/bin"],dependencyFiles:[
|
|
972
|
+
"go.mod","go.sum","go.work","go.work.sum"],managedCommands:["go","gofmt"]},java:{binDirs:["java/bin"],dependencyFiles:["\
|
|
973
|
+
pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties"],managedCommands:[
|
|
974
|
+
"java","javac","jar","javap","javadoc","jshell","jlink","jmod","jdeps","jpackage","jcmd","jconsole","jdb","jfr","jhsdb",
|
|
975
|
+
"jinfo","jmap","jps","jrunscript","jstack","jstat","jstatd","keytool","rmiregistry","serialver","mvn","mvnDebug","gradle"]},
|
|
976
|
+
kotlin:{binDirs:["kotlin/bin"],dependencyFiles:["build.gradle.kts","settings.gradle.kts","gradle.properties"],managedCommands:[
|
|
977
|
+
"kotlin","kotlinc","kotlinc-jvm","kotlinc-js","kapt"]},csharp:{binDirs:["csharp/bin"],dependencyFiles:["global.json","Di\
|
|
978
|
+
rectory.Build.props","Directory.Packages.props","packages.lock.json","NuGet.Config"],managedCommands:["dotnet"]},rust:{binDirs:[
|
|
979
|
+
"rust/bin"],dependencyFiles:["Cargo.toml","Cargo.lock","rust-toolchain.toml",".cargo/config.toml"],managedCommands:["rus\
|
|
980
|
+
tc","rustdoc","cargo","rustfmt","cargo-fmt","clippy-driver","cargo-clippy"]},gh:{binDirs:["gh/bin"],managedCommands:["gh"]},
|
|
981
|
+
git:{binDirs:["git/bin"],managedCommands:["git"]},mariadb:{binDirs:["mariadb/bin"],managedCommands:["mariadb","mysql"]},
|
|
982
|
+
mysql:{binDirs:["mariadb/bin"],managedCommands:["mariadb","mysql"]},node26:{binDirs:["node26/bin"],dependencyFiles:["pac\
|
|
983
|
+
kage.json","package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock"],managedCommands:["node","npm","npx","\
|
|
984
|
+
corepack","pnpm","yarn"]},"operator-clis":{binDirs:["managed-bin","operator-clis/bin"],identityPaths:["operator-clis/lib\
|
|
985
|
+
/node_modules/@anthropic-ai/claude-code/package.json","operator-clis/lib/node_modules/@openai/codex/package.json","opera\
|
|
986
|
+
tor-clis/lib/node_modules/opencode-ai/package.json"],managedCommands:["claude","codex","opencode"]},php:{binDirs:["php/b\
|
|
987
|
+
in"],managedCommands:["php"]},playwright:{binDirs:["playwright/bin"],identityPaths:["playwright/runtime.env","playwright\
|
|
988
|
+
/browsers"],managedCommands:["playwright"]},postgresql:{binDirs:["postgresql/bin"],managedCommands:["initdb","pg_ctl","p\
|
|
989
|
+
g_isready","postgres","psql"]},ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:[
|
|
990
|
+
"sqlite3"]}}),Li=Object.freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","b\
|
|
991
|
+
ubblewrap","bun","php","composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);function Le({
|
|
992
|
+
env:e=process.env,root:t=""}={}){return O(t||e?.[Di]||Yd)}function Bi(e="",t={}){let r=C(e),n=Kd[r]?.binDirs||[],o=Le(t);
|
|
993
|
+
return n.map(i=>Mi.join(o,i))}function Ui(e={}){return Mi.join(Le(e),"guard-bin")}function zi(e={}){return Mi.join(Le(e),
|
|
994
|
+
"policy-bin")}var Ht="VIBE64_SHARED_CACHE_ROOT",jt="PLAYWRIGHT_BROWSERS_PATH",Vt="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",En="VIBE64_PLAYWRI\
|
|
995
|
+
GHT_VERSION",Jd="/var/cache/vibe64",Gi="playwright",Zd="browsers",qS="runtime.env",YS=/^\d+\.\d+\.\d+$/u;function Qd({env:e=process.
|
|
996
|
+
env,explicitRoot:t=""}={}){return O(t||e?.[Ht]||Jd)}function Fi(e={}){return Xd.join(Le(e),Gi,Zd)}function ef(e={}){let t=Xd.
|
|
997
|
+
join(Le(e),Gi,qS),r;try{r=WS(t,"utf8")}catch(o){if(o?.code==="ENOENT")return"";throw o}let n=r.split(/\r?\n/u).filter(o=>o.
|
|
998
|
+
startsWith("playwright_version=")).map(o=>o.slice(19).trim());if(n.length!==1||!YS.test(n[0]))throw new Error(`Invalid m\
|
|
999
|
+
anaged Playwright runtime manifest: ${t}.`);return n[0]}function Hi(e={}){let t=Qd(e),r=ef(e);return{[Ht]:t,[jt]:Fi(e),[Vt]:"\
|
|
1000
|
+
1",...r?{[En]:r}:{}}}var ji=new Set(["HOME","LOGNAME","PATH","TMPDIR","USER","VIBE64_EXECUTION_ID","VIBE64_MANAGED_EXECUTION_REQUIRED","XDG_C\
|
|
1001
|
+
ACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"]),tf=new Set([...ot,st,it,ct,at,jt,Vt,En,Ht]);function lt(e={}){
|
|
1002
|
+
for(let t of Object.keys(G(e)))if(ji.has(t)||t.startsWith("XDG_")){let r=new Error(`Vibe64 command callers cannot provid\
|
|
1003
|
+
e execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function vn(e={},{envPolicy:t="sess\
|
|
1004
|
+
ion"}={}){let r=G(e);lt(r);let n=Object.fromEntries(Object.entries(r).filter(([o])=>!tf.has(o)));return t==="deployment"?
|
|
1005
|
+
n:{...n,...Ft(r)}}import rf from"node:path";function KS(e=""){let t=O(e);return t==="/home"||t.startsWith("/home/")}function XS(e="",t=""){let r=O(e),n=O(t);if(!r||
|
|
1006
|
+
!n)return!1;let o=rf.relative(n,r);return!o||!o.startsWith("..")&&!rf.isAbsolute(o)}function nf({actor:e={},request:t={}}={}){
|
|
1007
|
+
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(
|
|
986
1008
|
"Command credential home must match the resolved real-user actor home.");throw a.code="vibe64_command_credential_home_ac\
|
|
987
|
-
tor_mismatch",a}if(!e.requiresRealUser&&
|
|
988
|
-
ching real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=
|
|
989
|
-
username);return{...
|
|
990
|
-
{},...
|
|
991
|
-
{XDG_STATE_HOME:
|
|
992
|
-
steadOf",value:"ssh://git@github.com/"}]),
|
|
993
|
-
/env gh auth git-credential"}]),
|
|
994
|
-
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function
|
|
995
|
-
r=[];for(let n of Array.isArray(e)?e:[e]){let o=
|
|
996
|
-
add(i),r.push(i))}return r}function
|
|
997
|
-
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=
|
|
1009
|
+
tor_mismatch",a}if(!e.requiresRealUser&&KS(n)&&o&&!XS(n,o)){let a=new Error("A /home credential directory requires a mat\
|
|
1010
|
+
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{...Xn({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...O(r.cacheRoot)?{XDG_CACHE_HOME:O(r.cacheRoot)}:
|
|
1012
|
+
{},...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 of from"node:path";var sf=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"url.https://github.com/.in\
|
|
1014
|
+
steadOf",value:"ssh://git@github.com/"}]),JS=Object.freeze([{key:"credential.https://github.com.helper",value:"!/usr/bin\
|
|
1015
|
+
/env gh auth git-credential"}]),ZS=Object.freeze([{key:"credential.https://github.com.helper",value:`!f() { case "$1" in\
|
|
1016
|
+
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function af(e=[]){let t=new Set,
|
|
1017
|
+
r=[];for(let n of Array.isArray(e)?e:[e]){let o=C(n);if(!o||!of.isAbsolute(o))continue;let i=of.resolve(o);t.has(i)||(t.
|
|
1018
|
+
add(i),r.push(i))}return r}function Wt(e={},t=[]){let r={...e&&typeof e=="object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(
|
|
1019
|
+
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);
|
|
998
1020
|
s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),
|
|
999
|
-
r}function
|
|
1000
|
-
e,
|
|
1001
|
-
return
|
|
1002
|
-
ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}return
|
|
1003
|
-
[
|
|
1004
|
-
-token"?r=
|
|
1005
|
-
[])}import
|
|
1006
|
-
let t=
|
|
1007
|
-
map(
|
|
1008
|
-
n.join(":")),
|
|
1009
|
-
_RUNTIME_DIR"]);function
|
|
1010
|
-
map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t
|
|
1011
|
-
_")&&!t.startsWith("XDG_")))}function
|
|
1012
|
-
env]:[e.project?.runtimeConfigEnv,e.project?.databaseEnv]}function
|
|
1013
|
-
ployment"?(
|
|
1014
|
-
"project"?
|
|
1015
|
-
localPath:r="",request:n={}}={}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
[]})}}import{randomUUID as
|
|
1020
|
-
|
|
1021
|
-
e||"default").trim()||"default"}function
|
|
1022
|
-
default"){return
|
|
1023
|
-
r=t.length;for(let n=0;n<
|
|
1024
|
-
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>
|
|
1025
|
-
"running"||e.status==="closing"}function
|
|
1026
|
-
"function")return!0;try{return t(
|
|
1027
|
-
isFinite(t)&&t>0?t:0}function
|
|
1028
|
-
outputTruncated:!1}:{output:r.slice(r.length-n),outputTruncated:!0}}function
|
|
1029
|
-
closeError:e.closeError||"",cols:e.cols||
|
|
1021
|
+
r}function cf(e=[]){return af(e).map(t=>({key:"safe.directory",value:t}))}function Vi(e={},t=[]){return Wt(e,cf(t))}function Tn(){return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"0",PAGER:"cat"}}function Wi(e={}){return Wt(
|
|
1022
|
+
e,sf)}function lf(e={}){return Wt(e,JS)}function QS(e={}){return Wt(e,ZS)}function qi(e={}){return lf(Wi(e))}function uf(e={}){
|
|
1023
|
+
return QS(Wi(e))}var df="VIBE64_GIT_AUTH_TOKEN";function eE(e={}){if(!e.gitAuthToken){let t=new Error("Token-backed GitHub transport requ\
|
|
1024
|
+
ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}return uf({...Tn(),GIT_TERMINAL_PROMPT:"0",
|
|
1025
|
+
[df]:e.gitAuthToken})}function ff({request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github\
|
|
1026
|
+
-token"?r=eE(e):(e.gitTransport==="github-https"||e.purpose==="github")&&(r=qi({...t,...Tn()})),Vi(r,e.gitSafeDirectories||
|
|
1027
|
+
[])}import pf from"node:path";var Yi="NPM_CONFIG_PREFIX";function Ki({env:e={}}={}){return O(e?.[Yi])||(O(e?.HOME)?pf.join(O(e.HOME),".local"):"")}function Xi(e={}){
|
|
1028
|
+
let t=Ki(e);return t?{[Yi]:t}:{}}function Ji(e={}){let t=Ki(e);return t?[pf.join(t,"bin")]:[]}var tE="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";function Zi(e=""){return String(e||"").split(":").
|
|
1029
|
+
map(C).filter(Boolean)}function mf({env:e=process.env,existingPath:t="",runtimes:r=[],shimDirs:n=[]}={}){return Pe([...Zi(
|
|
1030
|
+
n.join(":")),zi({env:e}),...r.flatMap(o=>Bi(o,{env:e})),Ui({env:e}),...Zi(t||e.PATH),...Zi(tE)]).join(":")}var nE=new Set([...ot,st,it,ct,at,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG\
|
|
1031
|
+
_RUNTIME_DIR"]);function oE(e={}){return Object.fromEntries(Object.entries(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).
|
|
1032
|
+
map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!nE.has(t)&&!t.startsWith("GIT_")&&!t.startsWith("GH\
|
|
1033
|
+
_")&&!t.startsWith("XDG_")))}function Qi(e={}){return e.envPolicy==="deployment"?[e.project?.deploymentEnv,e.project?.deployment?.
|
|
1034
|
+
env]:[e.project?.runtimeConfigEnv,e.project?.databaseEnv]}function iE(e={}){return Qi(e).reduce((t,r)=>e.envPolicy==="de\
|
|
1035
|
+
ployment"?(lt(r),{...t,...G(r)}):{...t,...vn(r,e)},{})}function sE(e={},t={}){return t.envPolicy==="deployment"?[]:t.envPolicy===
|
|
1036
|
+
"project"?Qi(t):[e,...Qi(t),t.project?.databaseEnv,t.session?.databaseEnv]}function ut({actor:e={},baseEnv:t=process.env,
|
|
1037
|
+
localPath:r="",request:n={}}={}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=Hi({env:t}),s=vn(n.env,n),a=String(
|
|
1038
|
+
t.XDG_RUNTIME_DIR||"").trim(),c={...Jn(e.user,oE(t)),...nt(e)&&rE.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...Ft(...sE(t,n)),
|
|
1039
|
+
...iE(n),...ff({actor:e,request:n}),...$i({actor:e,env:t,project:n.project,session:n.session,userKey:n.userKey}),...s,...nf(
|
|
1040
|
+
{actor:e,request:n}),...i},l={...c,...Xi({env:c}),VIBE64_DECLARED_RUNTIMES:o};return{...l,PATH:mf({env:l,existingPath:[...Ji(
|
|
1041
|
+
{env:l}),l.PATH,r].filter(Boolean).join(":"),runtimes:n.runtimes,shimDirs:n.shimDirs||[]})}}import{randomUUID as LE}from"node:crypto";import{mkdirSync as BE,writeFileSync as UE}from"node:fs";import is from"node:path";import{Buffer as cE}from"node:buffer";import lE from"node:crypto";import{createRequire as uE}from"node:module";var aE=new URL("./../../../vibe64-execution/src/server/engines/terminalSessions.js",import.meta.url).href,hf=256*1024,dE=300,
|
|
1042
|
+
es=100,ts=28;var lB=600*1e3,fE=1440*60*1e3,uB=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "}),In=new Map,pE=uE(aE),mE=new Map;function hE(){return{code:"terminal_session_not_found",error:"Terminal session not found.",ok:!1}}function ns(e=""){return String(
|
|
1043
|
+
e||"default").trim()||"default"}function Pn(e){let t=ns(e);return In.has(t)||In.set(t,new Map),In.get(t)}function gE(e="\
|
|
1044
|
+
default"){return mE.get(ns(e))||null}function bE(e="default"){let t=gE(e);return t?{code:t.code,error:t.error,ok:!1}:null}function wE(e=""){let t=String(e||"");return[...In.keys()].filter(r=>r.startsWith(t))}function On(e){let t=String(e||""),
|
|
1045
|
+
r=t.length;for(let n=0;n<dE&&(r=t.lastIndexOf(`
|
|
1046
|
+
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>hf&&(t=t.slice(t.length-hf)),t}function os(e={}){return e.status===
|
|
1047
|
+
"running"||e.status==="closing"}function bf(e={}){return os(e)||e.status==="exited"}function yE(e={},t=null){if(typeof t!=
|
|
1048
|
+
"function")return!0;try{return t(dt(e))===!0}catch{return!1}}function _E(e=0){let t=Math.floor(Number(e||0));return Number.
|
|
1049
|
+
isFinite(t)&&t>0?t:0}function SE(e="",{outputLimit:t=0}={}){let r=String(e||""),n=_E(t);return!n||r.length<=n?{output:r,
|
|
1050
|
+
outputTruncated:!1}:{output:r.slice(r.length-n),outputTruncated:!0}}function dt(e,t={}){let r=SE(e.output,t);return{ok:!0,
|
|
1051
|
+
closeError:e.closeError||"",cols:e.cols||es,createdAt:e.createdAt||"",id:e.id,commandPreview:e.commandPreview,exitCode:e.
|
|
1030
1052
|
exitCode,inputVersion:e.inputVersion||0,lastInputAt:e.lastInputAt||"",lastInputBytes:e.lastInputBytes||0,lastOutputAt:e.
|
|
1031
1053
|
lastOutputAt||"",lastOutputBytes:e.lastOutputBytes||0,metadata:e.metadata||{},output:r.output,outputTruncated:r.outputTruncated,
|
|
1032
|
-
outputVersion:e.outputVersion||0,rows:e.rows||
|
|
1033
|
-
metadata,type:"metadata"})),
|
|
1034
|
-
e));return!Number.isFinite(t)||t<0?0:Math.min(t,
|
|
1035
|
-
e.lastInputAt),
|
|
1036
|
-
e);return r>0?Math.max(0,Number(t)-r):0}function
|
|
1037
|
-
e.detachedCleanupTimer=null)}function
|
|
1038
|
-
if(r<1)return;let n=Math.max(0,r-
|
|
1039
|
-
n)}function
|
|
1040
|
-
e.lastOutputBytes=r)}function
|
|
1041
|
-
delete(r)}}function
|
|
1042
|
-
function
|
|
1054
|
+
outputVersion:e.outputVersion||0,rows:e.rows||ts,status:e.status}}function EE(e,t={}){return!e||!t||typeof t!="object"||Array.isArray(t)||(e.metadata={...e.metadata||{},...t},q(e,{metadata:e.
|
|
1055
|
+
metadata,type:"metadata"})),dt(e)}function vE(e=""){return cE.byteLength(String(e||""),"utf8")}function An(e=""){let t=Date.parse(String(e||""));return Number.isFinite(t)?t:0}function Rn(e=0){let t=Math.floor(Number(
|
|
1056
|
+
e));return!Number.isFinite(t)||t<0?0:Math.min(t,fE)}function TE(e={}){return Math.max(An(e.lastSubscriberDetachedAt),An(
|
|
1057
|
+
e.lastInputAt),An(e.lastOutputAt),An(e.createdAt))}function wf(e={},t=Date.now()){if(e?.subscribers?.size)return 0;let r=TE(
|
|
1058
|
+
e);return r>0?Math.max(0,Number(t)-r):0}function yf(e={}){e?.detachedCleanupTimer&&(clearTimeout(e.detachedCleanupTimer),
|
|
1059
|
+
e.detachedCleanupTimer=null)}function rs(e={},t="default"){if(yf(e),!bf(e)||e?.subscribers?.size)return;let r=Rn(e.detachedIdleTimeoutMs);
|
|
1060
|
+
if(r<1)return;let n=Math.max(0,r-wf(e));e.detachedCleanupTimer=setTimeout(()=>{e.detachedCleanupTimer=null,DE({namespace:t})},
|
|
1061
|
+
n)}function AE(e,t=""){let r=vE(t);r<1||(e.outputVersion=Number(e.outputVersion||0)+1,e.lastOutputAt=new Date().toISOString(),
|
|
1062
|
+
e.lastOutputBytes=r)}function q(e,t){if(e?.subscribers?.size)for(let r of[...e.subscribers])try{r(t)}catch{e.subscribers.
|
|
1063
|
+
delete(r)}}function IE(e){let t=String(e?.code||""),r=String(e?.message||e||"Terminal PTY error.");return{code:t,message:r}}
|
|
1064
|
+
function RE(e,t){if(!e)return;let r=IE(t);e.lastWriteErrorAt=new Date().toISOString(),e.lastWriteErrorCode=r.code,e.lastWriteError=
|
|
1043
1065
|
r.message,console.warn("Vibe64 terminal PTY write error.",{code:r.code,id:e.id,metadata:e.metadata||{},message:r.message,
|
|
1044
|
-
namespace:e.namespace||""}),
|
|
1045
|
-
!t||typeof t.on!="function"||t.on("error",r=>{
|
|
1046
|
-
let n=e?[
|
|
1047
|
-
return o}function
|
|
1048
|
-
r.session,e)).length}async function
|
|
1066
|
+
namespace:e.namespace||""}),q(e,{code:r.code,error:r.message,type:"error"})}function PE(e){let t=e?.terminal?._writeStream;
|
|
1067
|
+
!t||typeof t.on!="function"||t.on("error",r=>{RE(e,r)})}function _f({namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){
|
|
1068
|
+
let n=e?[ns(e)]:wE(t),o=[];for(let i of n){let s=Pn(i);for(let a of s.values())r&&!os(a)||o.push({namespace:i,session:a})}
|
|
1069
|
+
return o}function OE({filter:e=null,namespacePrefix:t=""}={}){return _f({namespacePrefix:t,runningOnly:!0}).filter(r=>yE(
|
|
1070
|
+
r.session,e)).length}async function CE(e,t){if(!(!e||e.closeHookStarted)){if(e.closeHookStarted=!0,typeof e.onClose!="function")return null;try{
|
|
1049
1071
|
return await e.onClose({exitCode:e.exitCode,id:e.id,output:e.output,reason:t,status:e.status}),null}catch(r){let n=String(
|
|
1050
1072
|
r?.message||r||"Terminal finalization failed."),o=r instanceof Error?r:new Error(n);o.code||="terminal_close_hook_failed";
|
|
1051
1073
|
let i=`\r
|
|
1052
1074
|
[studio] Terminal finalization failed: ${n}\r
|
|
1053
|
-
`;return e.closeError=n,e.output=
|
|
1075
|
+
`;return e.closeError=n,e.output=On(`${e.output}${i}`),q(e,{chunk:i,type:"output"}),q(e,{error:n,type:"error"}),o}}}async function xE(e,t){
|
|
1054
1076
|
if(!(!e||e.stopHookStarted)){if(e.stopHookStarted=!0,typeof e.onStop!="function")return null;try{return await e.onStop({
|
|
1055
1077
|
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
|
|
1056
1078
|
Error?r:new Error(n);o.code||="terminal_stop_hook_failed";let i=`\r
|
|
1057
1079
|
[studio] Terminal stop failed: ${n}\r
|
|
1058
|
-
`;return e.closeError=n,e.output=
|
|
1080
|
+
`;return e.closeError=n,e.output=On(`${e.output}${i}`),q(e,{chunk:i,type:"output"}),q(e,{error:n,type:"error"}),o}}}function ft(e,t){
|
|
1059
1081
|
let r=`${String(t?.code||"terminal_cleanup_failed")}:${String(t?.message||"")}`;if(e.reportedLifecycleFailures||=new Set,
|
|
1060
1082
|
e.reportedLifecycleFailures.has(r))return t;e.reportedLifecycleFailures.add(r);let n=String(t?.message||t||"Terminal cle\
|
|
1061
1083
|
anup failed."),o=`\r
|
|
1062
1084
|
[studio] ${n}\r
|
|
1063
|
-
`;return e.closeError=n,e.output=
|
|
1085
|
+
`;return e.closeError=n,e.output=On(`${e.output}${o}`),q(e,{chunk:o,type:"output"}),q(e,{error:n,type:"error"}),t}function gf(e,t=[]){
|
|
1064
1086
|
let r=new AggregateError(t,`Terminal session could not close cleanly: ${e.id}`);return r.code=t.some(n=>String(n?.code||
|
|
1065
|
-
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function
|
|
1066
|
-
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>
|
|
1067
|
-
return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>
|
|
1068
|
-
e.status!=="exited"&&(e.status="exited",
|
|
1069
|
-
s"}))}function
|
|
1087
|
+
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function kE(e,t){
|
|
1088
|
+
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>xE(e,t))),e.stopHookCompletion}function Sf(e,t){
|
|
1089
|
+
return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>CE(e,t))),e.closeHookCompletion}function Ef(e){
|
|
1090
|
+
e.status!=="exited"&&(e.status="exited",q(e,{closeError:e.closeError||"",exitCode:e.exitCode,status:e.status,type:"statu\
|
|
1091
|
+
s"}))}function vf(e){return e.scopeDrainCompletion||(e.scopeDrainCompletion=(async()=>{if(process.platform!=="win32"&&!await hn(
|
|
1070
1092
|
e.terminal.pid)){let t=new Error(`Terminal execution scope did not become empty: ${e.id}`);throw t.code="terminal_execut\
|
|
1071
|
-
ion_drain_failed",t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function
|
|
1072
|
-
scopeDrainCompletion}catch(t){
|
|
1073
|
-
|
|
1093
|
+
ion_drain_failed",t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function NE(e){try{await e.
|
|
1094
|
+
scopeDrainCompletion}catch(t){ft(e,t)}try{await Promise.all([Sf(e,e.stopReason||"exit"),e.stopHookCompletion])}catch(t){
|
|
1095
|
+
ft(e,t)}Ef(e)}function Tf({args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},maxRunning:i=0,metadata:s=null,
|
|
1074
1096
|
namespace:a="default",namespaceLimitPrefix:c="",runningLimitFilter:l=null,onClose:u=null,onOutput:d=null,onStop:f=null,reuseRunning:p=!1,
|
|
1075
|
-
detachedIdleTimeoutMs:m=0}){let h=
|
|
1076
|
-
[..._.values()].find(
|
|
1077
|
-
|
|
1078
|
-
o,
|
|
1079
|
-
"function"?s({args:
|
|
1080
|
-
"object"&&!Array.isArray(
|
|
1081
|
-
closePromise:null,commandPreview:
|
|
1082
|
-
m),exitCompletion:
|
|
1083
|
-
typeof
|
|
1097
|
+
detachedIdleTimeoutMs:m=0}){let h=bE(a);if(h)return h;let _=Pn(a),b=lE.randomUUID(),g=typeof p=="function"?p:()=>!!p,T=p?
|
|
1098
|
+
[..._.values()].find(U=>os(U)&&g(U)):null;if(T)return dt(T);let y=Number(i||0),A=c||a;if(y>0&&OE({filter:l,namespacePrefix:A})>=
|
|
1099
|
+
y)return{ok:!1,code:"terminal_limit",error:`Terminal limit reached (${y}).`};let R=typeof o=="function"?o({id:b,namespace:a}):
|
|
1100
|
+
o,S=typeof e=="function"?e({env:R,id:b,namespace:a}):e,x=typeof r=="function"?r({args:S,env:R,id:b,namespace:a}):r,$=typeof s==
|
|
1101
|
+
"function"?s({args:S,env:R,id:b,namespace:a}):s,M=pE("node-pty").spawn(t,S,{cols:es,cwd:n,env:{...process.env,...R&&typeof R==
|
|
1102
|
+
"object"&&!Array.isArray(R)?R:{}},name:"xterm-color",rows:ts}),k,te=new Promise(U=>{k=U}),N={id:b,closeHookCompletion:null,
|
|
1103
|
+
closePromise:null,commandPreview:x,cols:es,createdAt:new Date().toISOString(),cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:Rn(
|
|
1104
|
+
m),exitCompletion:te,exitCode:null,lastSubscriberAttachedAt:"",lastSubscriberDetachedAt:new Date().toISOString(),metadata:$&&
|
|
1105
|
+
typeof $=="object"&&!Array.isArray($)?$:{},onClose:u,onStop:f,inputVersion:0,lastInputAt:"",lastInputBytes:0,lastOutputAt:"",
|
|
1084
1106
|
lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",output:"",outputVersion:0,processExited:!1,
|
|
1085
|
-
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:
|
|
1086
|
-
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:
|
|
1087
|
-
output+
|
|
1088
|
-
d({chunk:
|
|
1089
|
-
"Terminal output hook failed.");
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
e);return o?
|
|
1093
|
-
nning"&&(e.status="closing",
|
|
1107
|
+
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:k,rows:ts,status:"running",stopHookCompletion:null,
|
|
1108
|
+
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:M};return PE(N),M.onData(U=>{if(AE(N,U),N.output=On(N.
|
|
1109
|
+
output+U),q(N,{chunk:U,lastOutputAt:N.lastOutputAt,outputVersion:N.outputVersion,type:"output"}),typeof d=="function")try{
|
|
1110
|
+
d({chunk:U,output:N.output,session:dt(N),updateMetadata(_t){return EE(N,_t)}})}catch(_t){let ze=String(_t?.message||_t||
|
|
1111
|
+
"Terminal output hook failed.");q(N,{error:ze,type:"error"})}rs(N,a)}),M.onExit(({exitCode:U})=>{N.processExited=!0,N.exitCode=
|
|
1112
|
+
U,N.status="closing",vf(N),q(N,{exitCode:U,status:N.status,type:"status"}),Sf(N,N.stopReason||"exit"),N.resolveExitCompletion(),
|
|
1113
|
+
NE(N)}),_.set(b,N),rs(N,a),$E(b,{namespace:a})}function $E(e,{namespace:t="default",outputLimit:r=0}={}){let o=Pn(t).get(
|
|
1114
|
+
e);return o?dt(o,{outputLimit:r}):hE()}async function ME(e,t="stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=String(t||"stop"),e.status==="ru\
|
|
1115
|
+
nning"&&(e.status="closing",q(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];if(kE(e,e.stopReason),!e.
|
|
1094
1116
|
processExited&&!e.killStarted){e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;let o=n instanceof Error?
|
|
1095
|
-
n:new Error(String(n||"Terminal process could not be killed."));o.code||="terminal_kill_failed",r.push(
|
|
1096
|
-
e)}catch(n){r.push(
|
|
1097
|
-
closePromise;let o=(async()=>{let i=[];if(
|
|
1098
|
-
n,c.failures)}try{await n.exitCompletion}catch(c){i.push(
|
|
1099
|
-
c))}let a=(await Promise.all([n.stopHookCompletion,n.closeHookCompletion])).filter(Boolean);if(n.processExited&&
|
|
1100
|
-
length>0)throw
|
|
1101
|
-
c))}:{}}})();n.closePromise=o;try{return await o}finally{n.closePromise===o&&(n.closePromise=null)}}async function
|
|
1102
|
-
{namespace:t,namespacePrefix:r})){if(!
|
|
1103
|
-
if(a<1&&e==null)continue;if(
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
"
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
"
|
|
1114
|
-
actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){let s=e.terminal||{};return wn(t)?{args:(a={})=>{let c=wE(s.helperPayloadRoot),
|
|
1115
|
-
l=af(e,{actor:t,baseEnv:r,policyEnv:i}),u=typeof e.args=="function"?e.args(a):e.args,d=Ct({actor:t,args:u,command:e.command,
|
|
1116
|
-
cwd:o,env:typeof l=="function"?l(a):l,input:e.input,operation:xt(e)});return yE(c,`${JSON.stringify(d)}
|
|
1117
|
-
`,{mode:384}),["-n",process.env[on]||nn,"execute",c]},command:"sudo",cwd:s.helperPayloadRoot,env:{}}:{args:e.args,command:e.
|
|
1118
|
-
command,cwd:o,env:af(e,{actor:t,baseEnv:r,localPath:n,policyEnv:i})}}function af(e={},{actor:t={},baseEnv:r={},localPath:n="",
|
|
1119
|
-
policyEnv:o={}}={}){return typeof e.envFactory!="function"?o:(i={})=>it({actor:t,baseEnv:r,localPath:n,request:{...e,env:B(
|
|
1120
|
-
e.envFactory(i)),envFactory:null}})}async function cf(e={},{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){try{let s=e.terminal||
|
|
1121
|
-
{},a=e.execution?.id||"",c=bE(e,{actor:t,baseEnv:r||i,localPath:n,cwd:o,env:i}),l=tf({args:c.args,command:c.command,commandPreview:s.
|
|
1117
|
+
n:new Error(String(n||"Terminal process could not be killed."));o.code||="terminal_kill_failed",r.push(ft(e,o))}}try{await vf(
|
|
1118
|
+
e)}catch(n){r.push(ft(e,n))}return{failures:r}}async function Af(e,{namespace:t="default"}={}){let r=Pn(t),n=r.get(e);if(!n)return{ok:!0,closed:!1};if(n.closePromise)return n.
|
|
1119
|
+
closePromise;let o=(async()=>{let i=[];if(yf(n),!n.processExited){let c=await ME(n,"close");if(c.failures.length)throw gf(
|
|
1120
|
+
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&&Ef(n),i.
|
|
1122
|
+
length>0)throw gf(n,[...i,...a]);return r.delete(e),{ok:!0,closed:!0,...a.length>0?{cleanupErrors:a.map(c=>String(c?.message||
|
|
1123
|
+
c))}:{}}})();n.closePromise=o;try{return await o}finally{n.closePromise===o&&(n.closePromise=null)}}async function DE({idleMs:e=null,namespace:t="",namespacePrefix:r="",now:n=Date.now()}={}){let o=0;for(let{namespace:i,session:s}of _f(
|
|
1124
|
+
{namespace:t,namespacePrefix:r})){if(!bf(s)||s.subscribers?.size)continue;let a=e==null?Rn(s.detachedIdleTimeoutMs):Rn(e);
|
|
1125
|
+
if(a<1&&e==null)continue;if(wf(s,n)<a){rs(s,i);continue}(await Af(s.id,{namespace:i})).closed&&(o+=1)}return{ok:!0,closed:o}}var If=new Map;function zE(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper payload root is required fo\
|
|
1126
|
+
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=is.join(is.resolve(t),
|
|
1127
|
+
"exec-helper-payloads");return BE(r,{mode:448,recursive:!0}),is.join(r,`${process.pid}-${Date.now()}-${LE()}.json`)}function GE(e={},{
|
|
1128
|
+
actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){let s=e.terminal||{};return Sn(t)?{args:(a={})=>{let c=zE(s.helperPayloadRoot),
|
|
1129
|
+
l=Rf(e,{actor:t,baseEnv:r,policyEnv:i}),u=typeof e.args=="function"?e.args(a):e.args,d=Ut({actor:t,args:u,command:e.command,
|
|
1130
|
+
cwd:o,env:typeof l=="function"?l(a):l,input:e.input,operation:zt(e)});return UE(c,`${JSON.stringify(d)}
|
|
1131
|
+
`,{mode:384}),["-n",process.env[bn]||gn,"execute",c]},command:"sudo",cwd:s.helperPayloadRoot,env:{}}:{args:e.args,command:e.
|
|
1132
|
+
command,cwd:o,env:Rf(e,{actor:t,baseEnv:r,localPath:n,policyEnv:i})}}function Rf(e={},{actor:t={},baseEnv:r={},localPath:n="",
|
|
1133
|
+
policyEnv:o={}}={}){return typeof e.envFactory!="function"?o:(i={})=>ut({actor:t,baseEnv:r,localPath:n,request:{...e,env:G(
|
|
1134
|
+
e.envFactory(i)),envFactory:null}})}async function Pf(e={},{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){try{let s=e.terminal||
|
|
1135
|
+
{},a=e.execution?.id||"",c=GE(e,{actor:t,baseEnv:r||i,localPath:n,cwd:o,env:i}),l=Tf({args:c.args,command:c.command,commandPreview:s.
|
|
1122
1136
|
commandPreview,cwd:c.cwd,detachedIdleTimeoutMs:s.detachedIdleTimeoutMs,env:c.env,maxRunning:s.maxRunning,metadata:s.metadata,
|
|
1123
1137
|
namespace:s.namespace,namespaceLimitPrefix:s.namespaceLimitPrefix,onClose:async u=>{try{typeof s.onClose=="function"&&await s.
|
|
1124
|
-
onClose(u)}finally{a&&
|
|
1125
|
-
reuseRunning,runningLimitFilter:s.runningLimitFilter});return l?.ok===!0&&a&&
|
|
1126
|
-
ok===!0?{...l,execution:e.execution}:l}catch(s){return
|
|
1127
|
-
nd_pty_failed",{execution:e.execution})}}import{realpathSync as
|
|
1128
|
-
"..")&&!
|
|
1129
|
-
if(n.length===0)return r;let o=n.filter(s=>
|
|
1130
|
-
"Vibe64 command cwd is outside the allowed roots.");throw i.code="vibe64_command_cwd_outside_allowed_roots",i}import{randomUUID as
|
|
1131
|
-
ex","github","github-api","source-editor","preview","output","deployment","health","source"]),
|
|
1132
|
-
"pty","detached"]),
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
"mysql","mariadb","postgresql","sqlite","ripgrep","bubblewrap","bun","php","composer","
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
value"){let o=
|
|
1139
|
-
_unsupported`);return o}function
|
|
1140
|
-
valued command args are only supported for
|
|
1141
|
-
isArray(e)?e:[e]).map(r=>String(r??""))}
|
|
1142
|
-
"Function-valued command env is
|
|
1143
|
-
|
|
1144
|
-
Boolean)}function
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
t
|
|
1149
|
-
|
|
1150
|
-
Number(t.uid??t.hostUid)
|
|
1151
|
-
"detached"?"service":e==="pty"?"
|
|
1152
|
-
"
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
l.key
|
|
1161
|
-
|
|
1162
|
-
freeze({...l
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
e
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1138
|
+
onClose(u)}finally{a&&If.set(a,{id:u.id,namespace:s.namespace,scopeEmpty:!0})}},onOutput:s.onOutput,onStop:s.onStop,reuseRunning:s.
|
|
1139
|
+
reuseRunning,runningLimitFilter:s.runningLimitFilter});return l?.ok===!0&&a&&If.set(a,{id:l.id,namespace:s.namespace}),l?.
|
|
1140
|
+
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 Of}from"node:fs";import Cf from"node:path";function FE(e=""){return O(e||process.cwd())}function xf(e="",t=""){let r=Cf.relative(e,t);return r===""||!r.startsWith(
|
|
1142
|
+
"..")&&!Cf.isAbsolute(r)}function kf(e="",{allowedRoots:t=[]}={}){let r=FE(e),n=(Array.isArray(t)?t:[t]).map(O).filter(Boolean);
|
|
1143
|
+
if(n.length===0)return r;let o=n.filter(s=>xf(s,r));if(o.length>0){let s=Of(r);if(o.some(a=>xf(Of(a),s)))return s}let i=new Error(
|
|
1144
|
+
"Vibe64 command cwd is outside the allowed roots.");throw i.code="vibe64_command_cwd_outside_allowed_roots",i}import{randomUUID as HE}from"node:crypto";var jE=Object.freeze(["daemon","owner-user","named-user","app"]),VE=Object.freeze(["account","assistant","terminal","cod\
|
|
1145
|
+
ex","github","github-api","source-editor","preview","output","deployment","health","workspace-cache","source"]),WE=Object.
|
|
1146
|
+
freeze(["capture","pty","detached"]),qE=Object.freeze(["utf8","base64"]),YE=Object.freeze(["session","project","preview",
|
|
1147
|
+
"auth","deployment"]),KE=Object.freeze(["none","github-https","github-token"]),$f=Object.freeze(["assistant","browser","\
|
|
1148
|
+
control","job","preview","service","terminal"]),Mf=Object.freeze(["finite","interactive","service"]),XE=Object.freeze(["\
|
|
1149
|
+
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"]),JE=1e3*1e3*100,ZE=new Set(["assistan\
|
|
1151
|
+
t","codex","deployment","output","preview","source","terminal"]);function Q(e="",t="vibe64_command_request_invalid"){let r=new Error(
|
|
1152
|
+
e||"Invalid Vibe64 command request.");return r.code=t,r}function Ae(e="",t=[],r="",n="value"){let o=C(e)||r;if(!t.includes(
|
|
1153
|
+
o))throw Q(`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function QE(e=[],{
|
|
1154
|
+
mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw Q("Function-valued command args are only supported for\
|
|
1155
|
+
PTY commands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(r=>String(r??""))}
|
|
1156
|
+
function ev(e={},{mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw Q("Function-valued command env is on\
|
|
1157
|
+
ly supported for PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},envFactory:e}}let r=G(e);return lt(
|
|
1158
|
+
r),{env:r,envFactory:null}}function ss(e=[]){return(Array.isArray(e)?e:[e]).map(O).filter(Boolean)}function tv(e={}){let t=H(
|
|
1159
|
+
e);return{commandPreview:t.commandPreview,detachedIdleTimeoutMs:t.detachedIdleTimeoutMs,helperPayloadRoot:O(t.helperPayloadRoot||
|
|
1160
|
+
t.payloadRoot),maxRunning:t.maxRunning,metadata:t.metadata,namespace:C(t.namespace),namespaceLimitPrefix:C(t.namespaceLimitPrefix),
|
|
1161
|
+
onClose:t.onClose,onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.runningLimitFilter}}
|
|
1162
|
+
function rv(e={}){let t=H(e),r=O(t.home||t.toolHomeSource);return r?{cacheRoot:O(t.cacheRoot),configRoot:O(t.configRoot),
|
|
1163
|
+
dataRoot:O(t.dataRoot),gid:Number.isSafeInteger(Number(t.gid??t.hostGid))?Number(t.gid??t.hostGid):null,home:r,scope:C(t.
|
|
1164
|
+
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 nv(e="capture"){return e==="detached"?"service":e==="pty"?"interacti\
|
|
1166
|
+
ve":"finite"}function ov({mode:e="capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":
|
|
1167
|
+
"job"}function pt(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 Q(
|
|
1168
|
+
`Invalid Vibe64 execution identifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function Df(e={},{mode:t="c\
|
|
1169
|
+
apture",project:r={},purpose:n="terminal",session:o={}}={}){let i=H(e),s=Ae(i.kind,$f,ov({mode:t,purpose:n}),"execution_\
|
|
1170
|
+
kind"),a=Ae(i.lifecycle,Mf,nv(t),"execution_lifecycle");if(t==="detached"&&a!=="service"||t==="pty"&&a!=="interactive"||
|
|
1171
|
+
t==="capture"&&a!=="finite")throw Q(`Execution lifecycle ${a} is incompatible with command mode ${t}.`,"vibe64_execution\
|
|
1172
|
+
_lifecycle_incompatible");let c=pt(i.ownerId||o.sessionId||o.id);if(a==="service"&&!c)throw Q("Service execution require\
|
|
1173
|
+
s a durable owner id.","vibe64_execution_owner_required");let l=i.resourceProfile;if(l!=null&&(!l||typeof l!="object"||Object.
|
|
1174
|
+
keys(l).some(u=>!["key","compatibilityKey","environment"].includes(u))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.test(l.key||"")||
|
|
1175
|
+
!/^[a-f0-9]{64}$/u.test(l.compatibilityKey||"")||!["development","test","production"].includes(l.environment)))throw Q("\
|
|
1176
|
+
Invalid activity resource profile identity.","vibe64_resource_profile_invalid");return Object.freeze({...l?{resourceProfile:Object.
|
|
1177
|
+
freeze({...l})}:{},controlGenerationId:pt(i.controlGenerationId),...i.workflowId===void 0||i.workflowId===null||i.workflowId===
|
|
1178
|
+
""?{}:{workflowId:iv(i.workflowId)},id:HE(),kind:s,label:C(i.label),lifecycle:a,operationId:pt(i.operationId),ownerId:c,
|
|
1179
|
+
parentExecutionId:pt(i.parentExecutionId),projectSlug:pt(i.projectSlug||r.slug||r.projectSlug),sessionId:pt(i.sessionId||
|
|
1180
|
+
o.sessionId||o.id)})}function iv(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.
|
|
1181
|
+
test(e))throw Q("Execution requires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}function sv(e=""){
|
|
1182
|
+
return ZE.has(e)?Li:[]}function Nf(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function av(e={},t=""){let r=Nf(
|
|
1183
|
+
e,"runtimes"),n=Nf(e,"runtime");if(!r&&!n)return Pe(sv(t));let o=r?e.runtimes:e.runtime;return Pe((Array.isArray(o)?o:[o]).
|
|
1184
|
+
map(C).filter(Boolean))}function Lf(e={}){let t=H(e),r=C(t.command);if(!r)throw Q("A command is required.","vibe64_comma\
|
|
1185
|
+
nd_required");let n=Ae(t.mode,WE,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!=="capture"))
|
|
1186
|
+
throw Q("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=G(t.baseEnv),i=ev(
|
|
1187
|
+
t.env!==void 0?t.env:t.extraEnv,{mode:n}),s=Ae(t.purpose,VE,"terminal","purpose"),a=av(t,s);for(let d of a)if(!XE.includes(
|
|
1188
|
+
d))throw Q(`Unsupported Vibe64 runtime: ${d}.`,"vibe64_command_runtime_unsupported");let c=H(t.project),l=H(t.session),u=t.
|
|
1174
1189
|
releaseEnvironmentFile??"";if(typeof u!="string"||u&&(!u.startsWith("/")||/[\r\n\0]/u.test(u)||n!=="capture"||t.actor!==
|
|
1175
|
-
"app"||t.envPolicy!=="deployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw
|
|
1190
|
+
"app"||t.envPolicy!=="deployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw Q("Release envi\
|
|
1176
1191
|
ronment files require a finite application deployment command without caller Env.","vibe64_command_release_environment_i\
|
|
1177
|
-
nvalid");return{actor:
|
|
1178
|
-
command:r,cwd:
|
|
1179
|
-
y"),releaseEnvironmentFile:u,execution:
|
|
1180
|
-
gitAuthToken:
|
|
1181
|
-
t.gitTransport,
|
|
1182
|
-
input:t.stdin??t.input,logPath:
|
|
1183
|
-
t.maxBuffer):
|
|
1184
|
-
8","output_encoding"),project:c,purpose:s,runtimes:a,session:l,signal:t.signal??null,shimDirs:
|
|
1185
|
-
t.terminal||t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,userKey:
|
|
1186
|
-
t.userKey)}}var
|
|
1192
|
+
nvalid");return{actor:Ae(t.actor,jE,"daemon","actor"),allowedRoots:ss(t.allowedRoots),args:QE(t.args,{mode:n}),baseEnv:o,
|
|
1193
|
+
command:r,cwd:O(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,envPolicy:Ae(t.envPolicy,YE,"session","env_polic\
|
|
1194
|
+
y"),releaseEnvironmentFile:u,execution:Df(t.execution,{mode:n,project:c,purpose:s,session:l}),credentialHome:rv(t.credentialHome),
|
|
1195
|
+
gitAuthToken:C(t.gitAuthToken||t.gitCredentials?.token),gitSafeDirectories:ss(t.gitSafeDirectories||t.safeDirectories),gitTransport:Ae(
|
|
1196
|
+
t.gitTransport,KE,t.githubTransport?"github-https":"none","git_transport"),inheritProcessEnv:!u&&t.inheritProcessEnv!==!1,
|
|
1197
|
+
input:t.stdin??t.input,logPath:O(t.logPath),maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&Number(t.maxBuffer)>0?Number(
|
|
1198
|
+
t.maxBuffer):JE,mode:n,onOutput:typeof t.onOutput=="function"?t.onOutput:null,outputEncoding:Ae(t.outputEncoding,qE,"utf\
|
|
1199
|
+
8","output_encoding"),project:c,purpose:s,runtimes:a,session:l,signal:t.signal??null,shimDirs:ss(t.shimDirs),terminal:tv(
|
|
1200
|
+
t.terminal||t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,userKey:C(
|
|
1201
|
+
t.userKey)}}var cv=null,Bf="VIBE64_MANAGED_EXECUTION_REQUIRED";function as(){return cv}function Cn(e=process.env){return["1","true"].includes(String(e?.[Bf]||"").trim().toLowerCase())}async function lv(e,{actor:t,baseEnv:r,localPath:n,cwd:o,env:i,requiresHelper:s}={}){return e.releaseEnvironmentFile?z("\
|
|
1187
1202
|
Release environment execution requires a managed host.","vibe64_release_environment_unavailable",{execution:e.execution}):
|
|
1188
|
-
e.mode==="pty"?
|
|
1203
|
+
e.mode==="pty"?Pf(e,{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}):e.mode==="detached"?t.requiresRealUser&&(!nt(t)||s)?z("\
|
|
1189
1204
|
Detached real-user command execution is unsupported when the helper is required.","vibe64_command_detached_real_user_uns\
|
|
1190
|
-
upported",{execution:e.execution}):
|
|
1191
|
-
cwd:o,env:i,input:e.input,operation:
|
|
1192
|
-
timeout}),execution:e.execution}:
|
|
1193
|
-
onOutput:e.onOutput,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function
|
|
1194
|
-
try{if(t=
|
|
1205
|
+
upported",{execution:e.execution}):Md(e,{actor:t,cwd:o,env:i}):s?{...await xi(Ut({actor:t,args:e.args,command:e.command,
|
|
1206
|
+
cwd:o,env:i,input:e.input,operation:zt(e)}),{maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.
|
|
1207
|
+
timeout}),execution:e.execution}:De(e.command,e.args,{cwd:o,env:i,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,
|
|
1208
|
+
onOutput:e.onOutput,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function D(e={}){let t=null;
|
|
1209
|
+
try{if(t=Lf(e),t.signal?.aborted)return z("Command cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await Hd(
|
|
1195
1210
|
t),n=t.inheritProcessEnv?{...process.env,...t.baseEnv}:{...t.baseEnv},o=(m={})=>({...m,VIBE64_EXECUTION_ID:t.execution.id}),
|
|
1196
|
-
i=
|
|
1197
|
-
join(":"):"",l=o(
|
|
1198
|
-
r,l);let u=
|
|
1199
|
-
t.envFactory?
|
|
1211
|
+
i=as(),s=Cn(n)||Cn(process.env),a=Sn(r),c=!i&&!s&&!a&&!_n(n)&&!_n(process.env)&&nt(r)?[n.PATH,process.env.PATH].filter(Boolean).
|
|
1212
|
+
join(":"):"",l=o(ut({actor:r,baseEnv:n,localPath:c,request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t}));Vd(
|
|
1213
|
+
r,l);let u=kf(t.cwd,{allowedRoots:t.allowedRoots});jd(r,t,u);let d=(m={})=>typeof t.args=="function"?t.args(m):t.args,f=(m={})=>o(
|
|
1214
|
+
t.envFactory?ut({actor:r,baseEnv:n,localPath:c,request:{...t,env:t.envFactory(m),envFactory:null}}):l),p=(m=t,h={})=>lv(
|
|
1200
1215
|
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,
|
|
1201
|
-
env:l,resolveArgs:d,resolveEnv:f,runLocal:p}):t.releaseEnvironmentFile?
|
|
1202
|
-
ed host.","vibe64_release_environment_unavailable",{execution:t.execution}):s?
|
|
1216
|
+
env:l,resolveArgs:d,resolveEnv:f,runLocal:p}):t.releaseEnvironmentFile?z("Release environment execution requires a manag\
|
|
1217
|
+
ed host.","vibe64_release_environment_unavailable",{execution:t.execution}):s?z("Managed execution safety is unavailable\
|
|
1203
1218
|
. Vibe64 did not start this work.","vibe64_managed_execution_provider_unavailable",{execution:t.execution,retryable:!1}):
|
|
1204
|
-
p()}catch(r){return
|
|
1205
|
-
import
|
|
1206
|
-
outerTurnId:e="",outcome:t="completed",project:r={},runCommand:n=
|
|
1207
|
-
timestamp:a="",worktreePath:c=""}={}){let l=
|
|
1208
|
-
return
|
|
1209
|
-
async function
|
|
1210
|
-
let s=await
|
|
1211
|
-
refs:r,runCommand:n});let a=await
|
|
1212
|
-
project:t,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:e.worktreePath}),l=await
|
|
1213
|
-
e.worktreePath,{project:t});for(let u=0;;u+=1){let d=await
|
|
1214
|
-
f=d||a,p=await
|
|
1219
|
+
p()}catch(r){return z(r?.message||"Vibe64 command failed.",r?.code||"vibe64_command_failed",{execution:t?.execution})}}import{createHash as uv}from"node:crypto";import{lstat as dv,mkdir as fv,mkdtemp as pv,rm as mv,statfs as hv}from"node:fs/promises";
|
|
1220
|
+
import se from"node:path";var gv=3e4,bv=512*1024*1024,wv=1024*1024*1024,Ff=new Set(["cancelled","completed","failed","interrupted"]),xn=new Map;async function kn({
|
|
1221
|
+
outerTurnId:e="",outcome:t="completed",project:r={},runCommand:n=D,sessionId:o="",temporaryDiskBudgetBytes:i,temporaryDiskReserveBytes:s,
|
|
1222
|
+
timestamp:a="",worktreePath:c=""}={}){let l=Sv({outerTurnId:e,outcome:t,sessionId:o,timestamp:a,worktreePath:c}),u=cs(l);
|
|
1223
|
+
return jf(l.worktreePath,()=>yv({identity:l,project:r,refs:u,runCommand:n,temporaryDiskBudgetBytes:i,temporaryDiskReserveBytes:s}))}
|
|
1224
|
+
async function yv({identity:e={},project:t={},refs:r={},runCommand:n=D,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i}={}){
|
|
1225
|
+
let s=await mt(n,e.worktreePath,["rev-parse","--verify",r.turnRef],{project:t});if(s)return Gf({commit:s,identity:e,project:t,
|
|
1226
|
+
refs:r,runCommand:n});let a=await Y(n,e.worktreePath,["rev-parse","--verify","HEAD"],{project:t}),c=await Hf({baseCommit:a,
|
|
1227
|
+
project:t,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:e.worktreePath}),l=await Yf(n,
|
|
1228
|
+
e.worktreePath,{project:t});for(let u=0;;u+=1){let d=await mt(n,e.worktreePath,["rev-parse","--verify",r.latestRef],{project:t}),
|
|
1229
|
+
f=d||a,p=await Y(n,e.worktreePath,["commit-tree",c,"-p",f],{env:Ev(e.timestamp),input:qf(e),project:t});try{await Y(n,e.
|
|
1215
1230
|
worktreePath,["update-ref","--stdin"],{input:`start
|
|
1216
1231
|
create ${r.turnRef} ${p}
|
|
1217
1232
|
update ${r.latestRef} ${p} ${d||l}
|
|
1218
1233
|
prepare
|
|
1219
1234
|
commit
|
|
1220
|
-
`,project:t})}catch(m){let h=await
|
|
1221
|
-
identity:e,project:t,refs:r,runCommand:n});let _=await
|
|
1235
|
+
`,project:t})}catch(m){let h=await mt(n,e.worktreePath,["rev-parse","--verify",r.turnRef],{project:t});if(h)return Gf({commit:h,
|
|
1236
|
+
identity:e,project:t,refs:r,runCommand:n});let _=await mt(n,e.worktreePath,["rev-parse","--verify",r.latestRef],{project:t});
|
|
1222
1237
|
if(u>=2||_===d)throw m;continue}return{baseCommit:f,commit:p,created:!0,latestRef:r.latestRef,ok:!0,outerTurnId:e.outerTurnId,
|
|
1223
|
-
outcome:e.outcome,sessionId:e.sessionId,tree:c,turnRef:r.turnRef}}}async function
|
|
1224
|
-
runCommand:n=
|
|
1225
|
-
treePath"));return
|
|
1226
|
-
worktreePath:a}))}async function
|
|
1227
|
-
temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=
|
|
1228
|
-
absolute-git-dir"],{project:r}),l=
|
|
1229
|
-
tree-")),d=
|
|
1230
|
-
isArray(t)?t.map(m=>String(m||"")).filter(Boolean):[];return await
|
|
1231
|
-
temporaryDiskReserveBytes:i,worktreePath:a}),await
|
|
1232
|
-
n,a,["write-tree"],{env:f,project:r})}finally{await
|
|
1233
|
-
resolve(e),o=(
|
|
1234
|
-
i&&
|
|
1235
|
-
temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=t.length>0?t:["."],[c,l,u]=await Promise.
|
|
1236
|
-
name-only","-z","HEAD","--",...a],{project:r}),
|
|
1237
|
-
|
|
1238
|
-
startsWith(`..${
|
|
1239
|
-
vibe64_checkpoint_candidate_invalid");let
|
|
1240
|
-
f.push({bytes:Number(
|
|
1241
|
-
o,process.env.VIBE64_CHECKPOINT_TEMPORARY_DISK_BUDGET_BYTES,
|
|
1242
|
-
|
|
1243
|
-
bytes-
|
|
1244
|
-
e64 refused this checkpoint because changed, unignored files may need about ${m} temporary bytes; the safe budget is ${
|
|
1245
|
-
bytes.`,
|
|
1238
|
+
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(Be(s,"work\
|
|
1240
|
+
treePath"));return jf(a,()=>Hf({baseCommit:e,paths:t,project:r,runCommand:n,temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,
|
|
1241
|
+
worktreePath:a}))}async function Hf({baseCommit:e="HEAD",paths:t=[],project:r={},runCommand:n=D,temporaryDiskBudgetBytes:o,
|
|
1242
|
+
temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=se.resolve(Be(s,"worktreePath")),c=await Y(n,a,["rev-parse","--\
|
|
1243
|
+
absolute-git-dir"],{project:r}),l=se.join(c,"vibe64-checkpoints");await fv(l,{recursive:!0});let u=await pv(se.join(l,".\
|
|
1244
|
+
tree-")),d=se.join(u,"index");try{let f={GIT_INDEX_FILE:d};await Y(n,a,["read-tree",e||"HEAD"],{env:f,project:r});let p=Array.
|
|
1245
|
+
isArray(t)?t.map(m=>String(m||"")).filter(Boolean):[];return await _v({gitDirectory:c,paths:p,project:r,runCommand:n,temporaryDiskBudgetBytes:o,
|
|
1246
|
+
temporaryDiskReserveBytes:i,worktreePath:a}),await Y(n,a,["add","-A","--",...p.length>0?p:["."]],{env:{...f,GIT_LITERAL_PATHSPECS:"\
|
|
1247
|
+
1"},project:r}),await Y(n,a,["write-tree"],{env:f,project:r})}finally{await mv(u,{force:!0,recursive:!0})}}function jf(e="",t=async()=>null){
|
|
1248
|
+
let r=se.resolve(e),o=(xn.get(r)||Promise.resolve()).catch(()=>null).then(t),i=o.then(()=>null,()=>null).finally(()=>{xn.
|
|
1249
|
+
get(r)===i&&xn.delete(r)});return xn.set(r,i),o}async function _v({gitDirectory:e="",paths:t=[],project:r={},runCommand:n=D,
|
|
1250
|
+
temporaryDiskBudgetBytes:o,temporaryDiskReserveBytes:i,worktreePath:s=""}={}){let a=t.length>0?t:["."],[c,l,u]=await Promise.
|
|
1251
|
+
all([Y(n,s,["diff","--name-only","-z","HEAD","--",...a],{project:r}),Y(n,s,["ls-files","--others","--exclude-standard","\
|
|
1252
|
+
-z","--",...a],{project:r}),hv(e)]),d=[...new Set([...Uf(c),...Uf(l)])],f=[];for(let y of d){let A=se.resolve(s,y),R=se.
|
|
1253
|
+
relative(s,A);if(R===".."||R.startsWith(`..${se.sep}`)||se.isAbsolute(R))throw Ue("Git returned a checkpoint candidate o\
|
|
1254
|
+
utside the session source.","vibe64_checkpoint_candidate_invalid");let S=await dv(A).catch(x=>x?.code==="ENOENT"?null:Promise.
|
|
1255
|
+
reject(x));S?.isFile()&&f.push({bytes:Number(S.size||0),path:R})}let p=f.reduce((y,A)=>y+A.bytes,0),m=Math.min(Number.MAX_SAFE_INTEGER,
|
|
1256
|
+
p*2),h=zf(o,process.env.VIBE64_CHECKPOINT_TEMPORARY_DISK_BUDGET_BYTES,bv,1),_=zf(i,process.env.VIBE64_CHECKPOINT_DISK_RESERVE_BYTES,
|
|
1257
|
+
wv,0),b=Math.max(0,Number(u.bavail)*Number(u.bsize)),g=Math.min(h,Math.max(0,b-_));if(m<=g)return;let T=f.sort((y,A)=>A.
|
|
1258
|
+
bytes-y.bytes||y.path.localeCompare(A.path)).slice(0,5).map(y=>`${y.path} (${y.bytes} bytes)`).join(", ");throw Ue([`Vib\
|
|
1259
|
+
e64 refused this checkpoint because changed, unignored files may need about ${m} temporary bytes; the safe budget is ${g}\
|
|
1260
|
+
bytes.`,T?`Largest candidates: ${T}.`:"","Keep needed files in place and add generated or local-only artifacts to .giti\
|
|
1246
1261
|
gnore, or ask an operator to review the checkpoint disk budget."].filter(Boolean).join(" "),"vibe64_checkpoint_disk_budg\
|
|
1247
|
-
et_exceeded")}function
|
|
1248
|
-
""?t:e,i=Number(o===void 0||o===""?r:o);return Number.isSafeInteger(i)&&i>=n?i:r}async function
|
|
1249
|
-
project:r={},refs:n={},runCommand:o=
|
|
1250
|
-
...
|
|
1251
|
-
le turn identity.","vibe64_checkpoint_identity_mismatch");let a=await
|
|
1252
|
-
if(!await
|
|
1253
|
-
await
|
|
1262
|
+
et_exceeded")}function Uf(e=""){return String(e||"").split("\0").filter(Boolean)}function zf(e,t,r,n){let o=e==null||e===
|
|
1263
|
+
""?t:e,i=Number(o===void 0||o===""?r:o);return Number.isSafeInteger(i)&&i>=n?i:r}async function Gf({commit:e="",identity:t={},
|
|
1264
|
+
project:r={},refs:n={},runCommand:o=D}={}){let i=await Y(o,t.worktreePath,["show","-s","--format=%B",e],{project:r}),s=[
|
|
1265
|
+
...Ff].find(l=>i===qf({...t,outcome:l}).trim());if(!s)throw Ue("Existing Vibe64 turn checkpoint does not match its durab\
|
|
1266
|
+
le turn identity.","vibe64_checkpoint_identity_mismatch");let a=await Y(o,t.worktreePath,["rev-parse",`${e}^{tree}`],{project:r});
|
|
1267
|
+
if(!await mt(o,t.worktreePath,["rev-parse","--verify",n.latestRef],{project:r})){let l=await Yf(o,t.worktreePath,{project:r});
|
|
1268
|
+
await Y(o,t.worktreePath,["update-ref",n.latestRef,e,l],{project:r})}return{baseCommit:await Y(o,t.worktreePath,["rev-pa\
|
|
1254
1269
|
rse",`${e}^`],{project:r}),commit:e,created:!1,latestRef:n.latestRef,ok:!0,outerTurnId:t.outerTurnId,outcome:s,sessionId:t.
|
|
1255
|
-
sessionId,tree:a,turnRef:n.turnRef}}function
|
|
1256
|
-
let i=
|
|
1257
|
-
"vibe64_checkpoint_outcome_invalid");let s=
|
|
1258
|
-
eckpoint timestamp must be an ISO date.","vibe64_checkpoint_timestamp_invalid");let a=
|
|
1259
|
-
outerTurnId:
|
|
1260
|
-
function
|
|
1261
|
-
return`refs/vibe64/checkpoints/${
|
|
1262
|
-
function
|
|
1270
|
+
sessionId,tree:a,turnRef:n.turnRef}}function Sv({outerTurnId:e="",outcome:t="completed",sessionId:r="",timestamp:n="",worktreePath:o=""}={}){
|
|
1271
|
+
let i=Be(t,"outcome").toLowerCase();if(!Ff.has(i))throw Ue(`Unsupported Vibe64 turn checkpoint outcome: ${i||"(empty)"}.`,
|
|
1272
|
+
"vibe64_checkpoint_outcome_invalid");let s=Be(n,"timestamp");if(!Number.isFinite(Date.parse(s)))throw Ue("Vibe64 turn ch\
|
|
1273
|
+
eckpoint timestamp must be an ISO date.","vibe64_checkpoint_timestamp_invalid");let a=se.resolve(Be(o,"worktreePath"));return{
|
|
1274
|
+
outerTurnId:Be(e,"outerTurnId"),outcome:i,sessionId:Be(r,"sessionId"),timestamp:new Date(s).toISOString(),worktreePath:a}}
|
|
1275
|
+
function cs(e={}){let t=Vf(e.sessionId),r=Wf(e.outerTurnId);return{latestRef:`${t}/latest`,turnRef:`${t}/${r}`}}function Vf(e=""){
|
|
1276
|
+
return`refs/vibe64/checkpoints/${Wf(e)}`}function Wf(e=""){return uv("sha256").update(String(e)).digest("hex").slice(0,32)}
|
|
1277
|
+
function qf(e={}){return[`vibe64 checkpoint: session ${e.sessionId} turn ${e.outerTurnId}`,"","Vibe64-Checkpoint: true",
|
|
1263
1278
|
`Vibe64-Session: ${e.sessionId}`,`Vibe64-Outer-Turn: ${e.outerTurnId}`,`Vibe64-Turn-Outcome: ${e.outcome}`,""].join(`
|
|
1264
|
-
`)}function
|
|
1265
|
-
e,t,["rev-parse","--show-object-format"],{project:r});return"0".repeat(n==="sha256"?64:40)}async function
|
|
1266
|
-
let o=await
|
|
1267
|
-
r,n);if(o.ok!==!0)throw
|
|
1268
|
-
"vibe64_checkpoint_git_failed");return String(o.stdout||"").trim()}function
|
|
1279
|
+
`)}function Ev(e=""){return{GIT_AUTHOR_DATE:e,GIT_COMMITTER_DATE:e}}async function Yf(e,t,{project:r={}}={}){let n=await mt(
|
|
1280
|
+
e,t,["rev-parse","--show-object-format"],{project:r});return"0".repeat(n==="sha256"?64:40)}async function mt(e,t,r,n={}){
|
|
1281
|
+
let o=await Kf(e,t,r,n);return o.ok===!0?String(o.stdout||"").trim():""}async function Y(e,t,r,n={}){let o=await Kf(e,t,
|
|
1282
|
+
r,n);if(o.ok!==!0)throw Ue(String(o.stderr||o.stdout||o.output||o.error||"Git checkpoint command failed.").trim(),o.code||
|
|
1283
|
+
"vibe64_checkpoint_git_failed");return String(o.stdout||"").trim()}function Kf(e,t,r,{env:n={},input:o,project:i={}}={}){
|
|
1269
1284
|
return e({actor:"daemon",allowedRoots:[t],args:r,command:"git",cwd:t,env:n,envPolicy:"session",gitSafeDirectories:[t],input:o,
|
|
1270
|
-
mode:"capture",project:i,purpose:"source",runtimes:["git"],timeout:
|
|
1271
|
-
trim(),n=Array.from(r).some(o=>{let i=o.codePointAt(0);return i<=31||i===127});if(!r||r.length>512||n)throw
|
|
1285
|
+
mode:"capture",project:i,purpose:"source",runtimes:["git"],timeout:gv})}function Be(e="",t="value"){let r=String(e||"").
|
|
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 Ue(`Vibe64 t\
|
|
1272
1287
|
urn checkpoint ${t} is invalid.`,`vibe64_checkpoint_${t.replaceAll(/[^A-Za-z0-9]+/gu,"_").toLowerCase()}_invalid`);return r}
|
|
1273
|
-
function
|
|
1288
|
+
function Ue(e="",t="vibe64_checkpoint_failed"){let r=new Error(e||"Vibe64 turn checkpoint failed.");return r.code=t,r}var vv=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"]);var Tv=64*1024;var Xf="backups.git",Jf="vibe64-atomic",Iv=`backup_canonical_ref() {
|
|
1274
1289
|
vibe64_backup_repository="$1"
|
|
1275
1290
|
vibe64_source_repository="$2"
|
|
1276
1291
|
vibe64_source_ref="$3"
|
|
@@ -1288,13 +1303,13 @@ r "$vibe64_backup_repository" rev-parse --verify "$vibe64_backup_ref"
|
|
|
1288
1303
|
' "$vibe64_source_ref" >&2
|
|
1289
1304
|
return 1
|
|
1290
1305
|
fi
|
|
1291
|
-
}`,
|
|
1306
|
+
}`,Rv=`#!/bin/sh
|
|
1292
1307
|
set -eu
|
|
1293
1308
|
|
|
1294
1309
|
zero_object=0000000000000000000000000000000000000000
|
|
1295
1310
|
git_dir="$(git rev-parse --absolute-git-dir)"
|
|
1296
1311
|
repository_root="$(dirname "$git_dir")"
|
|
1297
|
-
backup_repository="$repository_root/${
|
|
1312
|
+
backup_repository="$repository_root/${Xf}"
|
|
1298
1313
|
if [ -L "$repository_root" ] || [ -L "$backup_repository" ] || [ -L "$repository_root/mutation.lock" ]; then
|
|
1299
1314
|
printf '[vibe64] Canonical repository storage must not use symlinked role paths.
|
|
1300
1315
|
' >&2
|
|
@@ -1303,7 +1318,7 @@ fi
|
|
|
1303
1318
|
exec 8>"$repository_root/mutation.lock"
|
|
1304
1319
|
flock -x 8
|
|
1305
1320
|
|
|
1306
|
-
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${
|
|
1321
|
+
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${Jf}" ]; then
|
|
1307
1322
|
printf '[vibe64] Canonical repository pushes must use the Vibe64 atomic mutation path.
|
|
1308
1323
|
' >&2
|
|
1309
1324
|
exit 1
|
|
@@ -1314,7 +1329,7 @@ if [ "$(git --git-dir "$backup_repository" rev-parse --is-bare-repository 2>/dev
|
|
|
1314
1329
|
exit 1
|
|
1315
1330
|
fi
|
|
1316
1331
|
|
|
1317
|
-
${
|
|
1332
|
+
${Iv}
|
|
1318
1333
|
|
|
1319
1334
|
updates_file="$(mktemp "$repository_root/.pre-receive.XXXXXX")"
|
|
1320
1335
|
cleanup_updates_file() {
|
|
@@ -1362,7 +1377,7 @@ while read -r old_object _new_object ref_name; do
|
|
|
1362
1377
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
1363
1378
|
fi
|
|
1364
1379
|
done <"$updates_file"
|
|
1365
|
-
`,
|
|
1380
|
+
`,Zf=`set -euo pipefail
|
|
1366
1381
|
mirror_path="$1"
|
|
1367
1382
|
remote_url="$2"
|
|
1368
1383
|
|
|
@@ -1450,319 +1465,505 @@ case "$remote_head_ref" in
|
|
|
1450
1465
|
esac
|
|
1451
1466
|
printf '[studio] Refreshed GitHub mirror for %s.
|
|
1452
1467
|
' "$remote_url"
|
|
1453
|
-
`;function
|
|
1454
|
-
engines/stdioBridge.js",
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
...
|
|
1462
|
-
|
|
1468
|
+
`;function ls({mirrorPath:e="",remoteUrl:t=""}={}){return["bash","-c",Zf,"vibe64-github-mirror-refresh",e,t]}var mU=new URL("./../../../vibe64-execution/src/server/runtime/agentPreviewBrowserWorkerSource.js",import.meta.url).href;import{fileURLToPath as xv}from"node:url";var Cv=new URL("./../../../vibe64-execution/src/server/conversationExecution.js",import.meta.url).href,SU=xv(new URL("./\
|
|
1469
|
+
engines/stdioBridge.js",Cv));import pe from"node:crypto";import{mkdtemp as lp,rm as up}from"node:fs/promises";import F from"node:path";import{fileURLToPath as Nv}from"node:url";function Ie(e){return String(e??"").trim()}function Nn(e){return e&&typeof e=="object"&&!Array.isArray(e)}var K="github",ht="managed_git",j="local_source";var d6=Object.freeze({GITHUB:K,MANAGED_GIT:ht,LOCAL_SOURCE:j});function Yt(e=""){let t=Ie(e).toLowerCase().replace(/[-\s]+/gu,"_");return t===K||t===ht||t===j?t:""}function qt(e="",t=""){let r=new Error(t);return r.code=e,r}function Kt(e={}){let t=e.metadata?.connected_contribution;if(t===
|
|
1470
|
+
void 0)return null;let r;try{r=JSON.parse(t)}catch{}if(!Nn(r)||r.schemaVersion!==1||Object.keys(r).some(n=>!["schemaVers\
|
|
1471
|
+
ion","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
|
+
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)||!us(r.integrationBranch)||
|
|
1474
|
+
r.integrationBranch.startsWith("vibe64-incoming/")||typeof r.baseCommit!="string"||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/iu.
|
|
1475
|
+
test(r.baseCommit))throw qt("vibe64_contribution_authority_invalid","This contribution's saved source is invalid. Preser\
|
|
1476
|
+
ve its checkout and inspect its binding before publishing.");return{...r,repository:r.repository.toLowerCase(),baseCommit:r.
|
|
1477
|
+
baseCommit.toLowerCase()}}function Qf(e={}){let t=e.metadata?.connected_submissions;if(t===void 0)return[];let r;try{r=JSON.
|
|
1478
|
+
parse(t)}catch{}let n=()=>qt("vibe64_connected_submissions_invalid","This session's connected publication bindings are i\
|
|
1479
|
+
nvalid. Preserve the session and inspect its bindings before saving.");if(!Nn(r)||r.schemaVersion!==1||!Array.isArray(r.
|
|
1480
|
+
submissions)||Object.keys(r).some(i=>!["schemaVersion","submissions"].includes(i)))throw n();let o=new Set;return r.submissions.
|
|
1481
|
+
map(i=>{if(!Nn(i)||Object.keys(i).some(a=>!["contribution","submittedCommit"].includes(a))||typeof i.submittedCommit!="s\
|
|
1482
|
+
tring"||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/iu.test(i.submittedCommit))throw n();let s=Kt({metadata:{connected_contribution:JSON.
|
|
1483
|
+
stringify(i.contribution)}});if(!s||o.has(s.id))throw n();return o.add(s.id),{contribution:s,submittedCommit:i.submittedCommit.
|
|
1484
|
+
toLowerCase()}})}function ds(e={},t={},{sourcePreparation:r=!1}={}){let n=Kt(t);if(n){let c=Ie(e.githubRepository?.fullName||e.repository?.
|
|
1485
|
+
github?.fullName).toLowerCase();if(t.metadata.github_pull_request||t.metadata.repository_branch||Yt(e.repositoryMode||e.
|
|
1486
|
+
repository?.mode)!==K||c!==n.repository||e.repository?.defaultBranch!==n.integrationBranch)throw qt("vibe64_contribution\
|
|
1487
|
+
_authority_changed","This contribution's repository or integration branch changed. Review its source binding before publ\
|
|
1488
|
+
ishing.");return{...e,githubMirrorOptional:!0,repository:{...e.repository,defaultBranch:r?n.replaces&&!t.metadata.renewed_from?
|
|
1489
|
+
`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&&Yt(e.repositoryMode||e.repository?.mode)!==j){if(!us(c))throw qt("vibe\
|
|
1491
|
+
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=Ie(e.githubRepository?.fullName||e.repository?.github?.fullName);if(!i||
|
|
1493
|
+
i.baseRepository!==s||!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u.test(i.headRepository||"")||!us(i.headBranch)||e.repositoryMode===
|
|
1494
|
+
ht)throw qt("vibe64_pull_request_authority_invalid","This session's pull request source is invalid. Its Save destination\
|
|
1495
|
+
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:K,repository:{mode:K,
|
|
1497
|
+
defaultBranch:i.headBranch,github:a}}}function us(e){return typeof e=="string"&&e.length>0&&e.length<=255&&!["@","HEAD"].
|
|
1463
1498
|
includes(e)&&!e.startsWith("-")&&!e.endsWith(".")&&!/[\s~^:?*[\\]/u.test(e)&&!e.includes("..")&&!e.includes("@{")&&![...e].
|
|
1464
|
-
some(t=>t.charCodeAt(0)<32||t.charCodeAt(0)===127)&&e.split("/").every(t=>t&&!t.startsWith(".")&&!t.endsWith(".lock"))}function
|
|
1465
|
-
let r=
|
|
1466
|
-
|
|
1467
|
-
i),{sessionId
|
|
1468
|
-
warn:40,error:50,fatal:60,silent:1/0});function
|
|
1469
|
-
return e==="behind"||e==="diverged"?"rebase":"none"}var
|
|
1470
|
-
e||"").split("\0"),r=[];for(let n=0;n+5<t.length;n+=6){let o=
|
|
1471
|
-
Boolean);r.push({author:
|
|
1472
|
-
t[n+5]),parents:i,shortCommit:o.slice(0,8)})}return r}var
|
|
1473
|
-
ession-work-command-scope"),
|
|
1474
|
-
trim()}function
|
|
1475
|
-
r))}function
|
|
1499
|
+
some(t=>t.charCodeAt(0)<32||t.charCodeAt(0)===127)&&e.split("/").every(t=>t&&!t.startsWith(".")&&!t.endsWith(".lock"))}function ep(e={},t={}){
|
|
1500
|
+
let r=ds(e,t),n=Yt(r.repositoryMode||r.repository?.mode),o=r.slug||r.projectSlug,i=r.repository?.defaultBranch;return n===
|
|
1501
|
+
K?o=r.githubRepository?.fullName||r.repository?.github?.fullName:n===j&&(o=r.sourceRoot,i=t?.metadata?.local_source_branch||
|
|
1502
|
+
i),{sessionId:Ie(t.sessionId||t.id),mode:n,repository:Ie(o),branch:Ie(i)}}var m6=Object.freeze(["fatal","error","warn","info","debug","trace","silent"]),h6=Object.freeze({trace:10,debug:20,info:30,
|
|
1503
|
+
warn:40,error:50,fatal:60,silent:1/0});function tp(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=0?t:0}function fs(e=0,t=0){let r=tp(e),n=tp(t);return r>0&&n>0?"diverged":n>0?"behind":r>0?"ahead":"current"}function ps(e=""){
|
|
1504
|
+
return e==="behind"||e==="diverged"?"rebase":"none"}var rp="%H%x00%P%x00%an%x00%ae%x00%aI%x00%s";function gt(e=""){return String(e||"").trim()}function np(e=""){let t=String(
|
|
1505
|
+
e||"").split("\0"),r=[];for(let n=0;n+5<t.length;n+=6){let o=gt(t[n]);if(!o)continue;let i=gt(t[n+1]).split(/\s+/u).filter(
|
|
1506
|
+
Boolean);r.push({author:gt(t[n+2]),authorEmail:gt(t[n+3]),committedAt:gt(t[n+4]),commit:o,isMerge:i.length>1,message:gt(
|
|
1507
|
+
t[n+5]),parents:i,shortCommit:o.slice(0,8)})}return r}var kv=new URL("./sessionWorkSave.js",import.meta.url).href,$v=12e4,op=200,Mv=500,hs=800,Dv=5e3,ms=5,ip=Symbol("vibe64-s\
|
|
1508
|
+
ession-work-command-scope"),N6=Nv(new URL("./sessionWorkOperationCommand.js",kv));function E(e=""){return String(e||"").
|
|
1509
|
+
trim()}function Un(e=[]){return[...new Set((Array.isArray(e)?e:[]).map(E).filter(Boolean))].sort((t,r)=>t.localeCompare(
|
|
1510
|
+
r))}function Lv(e={}){return e?.metadata&&typeof e.metadata=="object"?e.metadata:{}}function w(e,t="vibe64_session_save_\
|
|
1476
1511
|
failed",r={}){let n=new Error(e||"Vibe64 could not save this session.");return n.code=t,n.details=r&&typeof r=="object"&&
|
|
1477
|
-
!Array.isArray(r)?{...r}:{},Object.assign(n,r),n}function
|
|
1478
|
-
mode),o=
|
|
1479
|
-
on belongs to ${
|
|
1480
|
-
"vibe64_session_local_branch_changed");let i=
|
|
1481
|
-
r.canonical_commit)||a,l=n===
|
|
1512
|
+
!Array.isArray(r)?{...r}:{},Object.assign(n,r),n}function X(e={},t={}){t=ds(t,e);let r=Lv(e),n=Yt(t.repositoryMode||t.repository?.
|
|
1513
|
+
mode),o=E(t.repository?.defaultBranch);if(n===j&&r.local_source_branch&&E(r.local_source_branch)!==o)throw w(`This sessi\
|
|
1514
|
+
on belongs to ${E(r.local_source_branch)}. Switch the project folder back to that branch before saving or updating it.`,
|
|
1515
|
+
"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 w("Session Save requires a comp\
|
|
1482
1517
|
lete repository mode, branch, session source, base commit, and authority.","vibe64_session_save_context_incomplete");let u=n===
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
branch:o,lastCanonicalCommit:c,mode:n,githubMirrorPath:
|
|
1486
|
-
t.repository?.github?.fullName),githubMirrorOptional:!!r.github_pull_request||
|
|
1487
|
-
standaloneSourceRoot:l,worktreePath:i}}function
|
|
1488
|
-
owner),projectRoot:e.worktreePath,repositoryMode:e.mode,sessionId:e.sessionId}}
|
|
1489
|
-
repository work",operationId:o=
|
|
1490
|
-
a=(c={})=>{let l=s.then(()=>e({...c,execution:{...c.execution||{},kind:"job",
|
|
1491
|
-
ownerId:t.sessionId,projectSlug:i,sessionId:t.sessionId},project:{...c.project||
|
|
1492
|
-
{},sessionId:t.sessionId}}));return s=l.then(()=>{},()=>{}),l};return Object.
|
|
1493
|
-
additionalAllowedRoots:o=[],commandOptions:i={},cwd:s=t.worktreePath,
|
|
1494
|
-
F.dirname(t.worktreePath),...t.mode===
|
|
1495
|
-
|
|
1496
|
-
{actor:"daemon",allowedRoots:u,args:n,command:r,cwd:s,env:a,envPolicy:"
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
i?.output||i?.error)||"Git Save command failed.",
|
|
1500
|
-
return
|
|
1501
|
-
e,t,["diff-tree","--no-commit-id","--name-status","-r","-z",r,n],o);return[...
|
|
1502
|
-
localeCompare(a))}async function
|
|
1503
|
-
isSafeInteger(i)&&i>=0?i:0}async function
|
|
1504
|
-
"-z",`--format=${
|
|
1505
|
-
length>
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1518
|
+
K?E(t.githubRepository?.cloneUrl||t.repository?.github?.cloneUrl):n===ht?E(t.canonicalRepositoryPath):l;if(!u)throw w("S\
|
|
1519
|
+
ession Save cannot find the canonical repository authority.","vibe64_session_save_authority_missing");return{baseCommit:a,
|
|
1520
|
+
branch:o,contribution:Kt(e),connectedSubmissions:Qf(e),lastCanonicalCommit:c,mode:n,githubMirrorPath:E(t.githubMirrorPath),
|
|
1521
|
+
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 ee(e={},t={}){return{
|
|
1523
|
+
ownerUserKey:E(t.ownerUserKey||t.githubRepository?.owner),projectRoot:e.worktreePath,repositoryMode:e.mode,sessionId:e.sessionId}}
|
|
1524
|
+
function ye(e,t={},r={},{label:n="Session repository work",operationId:o=pe.randomUUID()}={}){if(e?.[ip])return e;let i=E(
|
|
1525
|
+
r.slug||r.projectSlug),s=Promise.resolve(),a=(c={})=>{let l=s.then(()=>e({...c,execution:{...c.execution||{},kind:"job",
|
|
1526
|
+
label:n,lifecycle:"finite",operationId:E(o),ownerId:t.sessionId,projectSlug:i,sessionId:t.sessionId},project:{...c.project||
|
|
1527
|
+
{},...i?{slug:i}:{}},session:{...c.session||{},sessionId:t.sessionId}}));return s=l.then(()=>{},()=>{}),l};return Object.
|
|
1528
|
+
defineProperty(a,ip,{value:!0}),a}async function dp(e,t,r,n,{additionalAllowedRoots:o=[],commandOptions:i={},cwd:s=t.worktreePath,
|
|
1529
|
+
env:a={},input:c,project:l={}}={}){let u=[t.worktreePath,F.dirname(t.worktreePath),...t.mode===j?[t.standaloneSourceRoot,
|
|
1530
|
+
F.dirname(t.standaloneSourceRoot)]:[],...F.isAbsolute(t.remoteUrl)?[t.remoteUrl,F.dirname(t.remoteUrl)]:[],...o.flatMap(
|
|
1531
|
+
d=>{let f=E(d);return f?[f,F.dirname(f)]:[]})];return e({actor:"daemon",allowedRoots:u,args:n,command:r,cwd:s,env:a,envPolicy:"\
|
|
1532
|
+
session",gitSafeDirectories:u,input:c,mode:"capture",project:ee(t,l),purpose:i.gitTransport?.startsWith("github")?"githu\
|
|
1533
|
+
b":"source",runtimes:i.gitTransport==="github-https"?["git","gh"]:["git"],timeout:$v,...i})}async function I(e,t,r,{required:n=!0,...o}={}){let i=await dp(e,t,"git",r,o);if(n&&i?.ok!==!0)throw w(E(i?.stderr||i?.stdout||
|
|
1534
|
+
i?.output||i?.error)||"Git Save command failed.",E(i?.code)||"vibe64_session_save_git_failed",{gitArgs:r});return i}function $n(e={}){
|
|
1535
|
+
return E(e.stdout||e.output)}async function P(e,t,r,n={}){return $n(await I(e,t,r,n))}async function fp(e,t,r,n,o={}){let i=await I(
|
|
1536
|
+
e,t,["diff-tree","--no-commit-id","--name-status","-r","-z",r,n],o);return[...bp(i.stdout||i.output).keys()].sort((s,a)=>s.
|
|
1537
|
+
localeCompare(a))}async function Mn(e,t,r,n,o={}){let i=Number(await P(e,t,["rev-list","--count",`${r}..${n}`],o));return Number.
|
|
1538
|
+
isSafeInteger(i)&&i>=0?i:0}async function Bv(e,t,r,n,o={}){let i=await I(e,t,["log","--topo-order",`--max-count=${ms+1}`,
|
|
1539
|
+
"-z",`--format=${rp}`,`${r}..${n}`],o),s=np(String(i.stdout||i.output||""));return{incomingVersions:s.slice(0,ms),incomingVersionsTruncated:s.
|
|
1540
|
+
length>ms}}function pp(e,t){let r=X({sessionId:t.sessionId,sourcePath:t.sourcePath||t.metadata?.source_path,metadata:{base_commit:t.
|
|
1541
|
+
metadata?.base_commit}},e);if(r.mode!==K||r.branch.startsWith("vibe64-incoming/"))throw w("Incoming changes require the \
|
|
1542
|
+
receiving GitHub repository's authority.","vibe64_incoming_repository_required");return r}async function Dn({project:e={},
|
|
1543
|
+
session:t={},offset:r=0,limit:n=25,id:o="",state:i="all",includeDiff:s=!1,commandOptions:a={},operationId:c=pe.randomUUID(),
|
|
1544
|
+
runCommand:l=D}={}){let u=pp(e,t);l=ye(l,u,e,{label:"Reading incoming contributions",operationId:c});let d={commandOptions:a,
|
|
1545
|
+
project:e},f=/^[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&&!f.test(o)||!Number.isSafeInteger(
|
|
1546
|
+
r)||r<0||!Number.isSafeInteger(n)||n<1||n>50||s&&!o||!["all","pending","merged","discarded","unresolved"].includes(i))throw w(
|
|
1547
|
+
"Choose an exact incoming contribution or a valid page.","vibe64_incoming_input_invalid");if(await P(l,u,["rev-parse","-\
|
|
1548
|
+
-is-shallow-repository"],d)!=="false")throw w("Incoming changes require complete Git history. Prepare a full receiving c\
|
|
1549
|
+
heckout before retrying.","vibe64_incoming_history_incomplete");let p=`refs/heads/${u.branch}`,m=await P(l,u,["ls-remote",
|
|
1550
|
+
"--heads",u.remoteUrl,p,"refs/heads/vibe64-incoming/*"],d),h=new Map,_="";for(let y of m.split(`
|
|
1551
|
+
`).filter(Boolean)){let[A,R]=y.split(/\s+/u);if(!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(A))throw w("The receiving repos\
|
|
1552
|
+
itory returned invalid ref evidence.","vibe64_incoming_refs_invalid");if(R===p){_=A;continue}let S=/^refs\/heads\/vibe64-incoming\/(.+?)(_discarded)?$/u.
|
|
1553
|
+
exec(R);if(!S||!f.test(S[1]))continue;let x=h.get(S[1])||{id:S[1],activeHead:"",discardedHead:""};x[S[2]?"discardedHead":
|
|
1554
|
+
"activeHead"]=A,h.set(x.id,x)}if(!_)throw w("The receiving integration branch is unavailable.","vibe64_incoming_target_m\
|
|
1555
|
+
issing");let b=[...h.values()].sort((y,A)=>y.id.localeCompare(A.id)),g=o?b.filter(y=>y.id===o):b;if(o&&!g.length)throw w(
|
|
1556
|
+
"This incoming contribution is no longer present. Refresh the list and inspect its history.","vibe64_incoming_missing");
|
|
1557
|
+
let T=[{remote:p,head:_}];for(let y of g)y.activeHead&&T.push({remote:`refs/heads/vibe64-incoming/${y.id}`,head:y.activeHead}),
|
|
1558
|
+
y.discardedHead&&T.push({remote:`refs/heads/vibe64-incoming/${y.id}_discarded`,head:y.discardedHead});T.forEach((y,A)=>{
|
|
1559
|
+
y.local=wt(u,c,`incoming-${A}`)});try{await I(l,u,["fetch","--no-tags","--no-write-fetch-head",u.remoteUrl,...T.map(S=>`\
|
|
1560
|
+
+${S.remote}:${S.local}`)],d);for(let S of T)if(await P(l,u,["rev-parse","--verify",`${S.local}^{commit}`],d)!==S.head)throw w(
|
|
1561
|
+
"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,$=await P(l,u,["rev-list","--count",`${_}..${x}`],d);if(!/^\d+$/u.test($))throw w("C\
|
|
1563
|
+
ontribution ancestry could not be established.","vibe64_incoming_history_incomplete");S.status=S.activeHead&&S.discardedHead?
|
|
1564
|
+
"unresolved":$==="0"?"merged":S.activeHead?"pending":"discarded"}let y=g.filter(S=>o||i==="all"||S.status===i),A=o?y:y.slice(
|
|
1565
|
+
r,r+n),R=[];for(let S of A){let x=S.activeHead||S.discardedHead,$=await P(l,u,["log","-1","--format=%s",x],d),M=await I(
|
|
1566
|
+
l,u,["diff","--name-only","-z",`${_}...${x}`],d),k=String(M.stdout||M.output||"").split("\0").filter(Boolean),te;if(s){let N=await I(
|
|
1567
|
+
l,u,["diff","--no-ext-diff","--no-textconv","--no-color","--unified=3",`${_}...${x}`],d),U=String(N.stdout||N.output||"");
|
|
1568
|
+
te={content:U.slice(0,1e5),truncated:U.length>1e5}}R.push({...S,branch:`vibe64-incoming/${S.id}`,head:x,title:$,review:{
|
|
1569
|
+
repository:u.repositoryFullName,targetBranch:u.branch,targetHead:_,id:S.id,activeHead:S.activeHead,discardedHead:S.discardedHead},
|
|
1570
|
+
files:k.slice(0,50),fileCount:k.length,filesTruncated:k.length>50,...te?{diff:te}:{}})}return{ok:!0,repository:u.repositoryFullName,
|
|
1571
|
+
targetBranch:u.branch,targetHead:_,contributions:R,pendingCount:g.filter(S=>S.status==="pending").length,unresolvedCount:g.
|
|
1572
|
+
filter(S=>S.status==="unresolved").length,totalCount:y.length,offset:o?0:r,nextOffset:!o&&r+n<y.length?r+n:null}}finally{
|
|
1573
|
+
for(let y of T)await yt(l,u,y.local,d)}}async function mp({project:e={},session:t={},action:r="",id:n="",review:o={},repairReview:i=null,identity:s={},derivedArtifactPaths:a=[],
|
|
1574
|
+
refreshDerivedArtifacts:c,commandOptions:l={},operationId:u=pe.randomUUID(),runCommand:d=D}={}){if(!["merge","discard","\
|
|
1575
|
+
review-repair"].includes(r)||!n)throw w("Choose Merge or Discard for an exact contribution.","vibe64_incoming_input_inva\
|
|
1576
|
+
lid");let f=pp(e,t);d=ye(d,f,e,{label:"Updating incoming contribution",operationId:u});let p={commandOptions:l,project:e},
|
|
1577
|
+
m=await Dn({project:e,session:t,id:n,commandOptions:l,operationId:u,runCommand:d}),h=m.contributions[0],_={repository:m.
|
|
1578
|
+
repository,targetBranch:m.targetBranch,targetHead:m.targetHead,id:n,activeHead:h.activeHead,discardedHead:h.discardedHead};
|
|
1579
|
+
if(Object.entries(_).some(([M,k])=>o?.[M]!==k))throw w("This contribution or its target changed. Review the current head\
|
|
1580
|
+
s before acting.","vibe64_incoming_review_changed");let b=`refs/heads/${h.branch}`,g=`${b}_discarded`,T=`refs/heads/${f.
|
|
1581
|
+
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 w("Only a pending contribution can be merged. Resolve its discard state first.",
|
|
1583
|
+
"vibe64_incoming_not_pending");let M=h.head,k="",te=await P(d,f,["rev-list","--count",`${h.head}..${m.targetHead}`],p);if(!/^\d+$/u.
|
|
1584
|
+
test(te))throw w("Integration ancestry is unavailable.","vibe64_incoming_history_incomplete");if(te==="0"&&(i||r==="revi\
|
|
1585
|
+
ew-repair"))throw w("These heads do not need conflict repair. Refresh and review the contribution normally.","vibe64_inc\
|
|
1586
|
+
oming_review_changed");if(te!=="0"){let ze=await P(d,f,["rev-parse",`${h.head}^{tree}`],p),Jt=await _s(d,f,{commandOptions:l,
|
|
1587
|
+
derivedArtifactPaths:a,project:e,sourceCommit:m.targetHead,tree:ze}),Hn=Jt===ze?h.head:await Fn(d,f,{baseCommit:h.head,commandOptions:l,
|
|
1588
|
+
identity:s,message:"Vibe64 incoming authored source",project:e,tree:Jt}),Ge=await Tp(d,f,{canonicalCommit:m.targetHead,virtualCommit:Hn,
|
|
1589
|
+
commandOptions:l,project:e});if(Ge.conflictPaths.length){let Zt=await Es({project:e,session:t,commandOptions:l,operationId:`\
|
|
1590
|
+
incoming:${u}`,runCommand:d});if(r==="merge"&&!i)throw w("This contribution conflicts with the integration branch. Use F\
|
|
1591
|
+
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:Ge.conflictPaths,checkpointCommit:Zt.checkpointCommit,review:_});k=await Ap(
|
|
1593
|
+
d,f,{conflictTree:Ge.conflictTree,conflictPaths:Ge.conflictPaths,project:e}),k=await Bn(d,f,{baseCommit:m.targetHead,commandOptions:l,
|
|
1594
|
+
derivedArtifactPaths:a,identity:s,project:e,refreshDerivedArtifacts:c,tree:k});let jn={tree:k,worktreeTree:Zt.checkpointTree,
|
|
1595
|
+
head:Zt.oldHead,indexTree:Zt.oldIndexTree};if(r==="review-repair"){let St=await I(d,f,["diff","--no-ext-diff","--no-text\
|
|
1596
|
+
conv","--no-color","--unified=3",m.targetHead,k],p),Ts=String(St.stdout||St.output||"");return{ok:!0,status:"repair-revi\
|
|
1597
|
+
ew",review:_,repairReview:jn,conflictPaths:Ge.conflictPaths,diff:{content:Ts.slice(0,1e5),truncated:Ts.length>1e5}}}if(Object.
|
|
1598
|
+
keys(jn).some(St=>i?.[St]!==jn[St]))throw w("The receiving source changed after repair review. Review resolved conflicts\
|
|
1599
|
+
again before merging.","vibe64_incoming_repair_changed")}else if(i||r==="review-repair")throw w("These heads no longer \
|
|
1600
|
+
need conflict repair. Refresh and review the contribution normally.","vibe64_incoming_review_changed");let Mp=k||await Bn(
|
|
1601
|
+
d,f,{baseCommit:m.targetHead,commandOptions:l,derivedArtifactPaths:a,identity:s,project:e,refreshDerivedArtifacts:c,tree:Ge.
|
|
1602
|
+
mergedTree});M=await P(d,f,["-c",`user.name=${E(s.name)||"Vibe64 Merge"}`,"-c",`user.email=${E(s.email)||"vibe64@localho\
|
|
1603
|
+
st"}`,"commit-tree",Mp,"-p",m.targetHead,"-p",h.head],{...p,input:`Merge contribution ${n}
|
|
1604
|
+
`})}let N=await Dn({project:e,session:t,id:n,commandOptions:l,operationId:u,runCommand:d}),U=N.contributions[0];if(N.targetHead!==
|
|
1605
|
+
m.targetHead||U.activeHead!==h.activeHead||U.discardedHead)throw w("The contribution changed while its merge was prepare\
|
|
1606
|
+
d. Review it again.","vibe64_incoming_review_changed");if(k){let ze=await P(d,f,["rev-parse","HEAD"],p),Jt=await P(d,f,[
|
|
1607
|
+
"write-tree"],p),Hn=await ae({worktreePath:f.worktreePath,project:ee(f,e),runCommand:d});if(ze!==i.head||Jt!==i.indexTree||
|
|
1608
|
+
Hn!==i.worktreeTree)throw w("The receiving source changed while the merge was prepared. Review resolved conflicts again.",
|
|
1609
|
+
"vibe64_incoming_repair_changed")}if(await I(d,f,["push",`--force-with-lease=${T}:${m.targetHead}`,f.remoteUrl,`${M}:${T}`],
|
|
1610
|
+
p),(await P(d,f,["ls-remote","--heads",f.remoteUrl,T],p)).split(/\s+/u)[0]!==M)throw w("The merge result is uncertain. R\
|
|
1611
|
+
efresh Incoming changes before retrying.","vibe64_incoming_verification_failed");return{ok:!0,status:"merged",head:h.head,
|
|
1612
|
+
targetHead:M}}if(!h.activeHead||h.discardedHead&&h.discardedHead!==h.activeHead)throw w("This discard cannot replace a d\
|
|
1613
|
+
ifferent or missing contribution head. Inspect the current branches.","vibe64_incoming_review_changed");let y=`${h.head}\
|
|
1614
|
+
:${g}`,A=`:${b}`,R=`--force-with-lease=${b}:${h.activeHead}`,S=`--force-with-lease=${g}:${h.discardedHead}`,x=await I(d,
|
|
1615
|
+
f,["push","--atomic",R,S,f.remoteUrl,y,A],{...p,required:!1});if(!x.ok){let M=E(x.stderr||x.output||x.error);if(!/does not support --atomic push/iu.
|
|
1616
|
+
test(M))throw w(M||"Discard was not confirmed. Refresh Incoming changes before retrying.","vibe64_incoming_discard_uncon\
|
|
1617
|
+
firmed");if(h.discardedHead||await I(d,f,["push",S,f.remoteUrl,y],p),(await P(d,f,["ls-remote","--heads",f.remoteUrl,g],
|
|
1618
|
+
p)).split(/\s+/u)[0]!==h.head)throw w("The discarded branch was not verified; the active branch was retained.","vibe64_i\
|
|
1619
|
+
ncoming_verification_failed");await I(d,f,["push",R,f.remoteUrl,A],p)}if(await P(d,f,["ls-remote","--heads",f.remoteUrl,
|
|
1620
|
+
b,g],p)!==`${h.head} ${g}`)throw w("Discard is not fully confirmed. Refresh Incoming changes to inspect both branches.",
|
|
1621
|
+
"vibe64_incoming_discard_unconfirmed");return{ok:!0,status:h.status==="merged"?"merged":"discarded",head:h.head}}async function gs(e,t,r,n={}){let o=await I(e,t,r,{...n,required:!1});return o?.ok===!0?$n(o):""}async function bt(e,t,r,n={}){
|
|
1622
|
+
return P(e,t,["rev-parse","--verify",`${r}^{tree}`],n)}async function Re(e,t,r,n,o={}){return r===n?!0:(await I(e,t,["me\
|
|
1623
|
+
rge-base","--is-ancestor",r,n],{...o,required:!1}))?.ok===!0}async function hp(e,t,r={}){let[n,o,i]=await Promise.all([gs(
|
|
1624
|
+
e,t,["rev-parse","--verify",`${ys(t)}^{commit}`],r),t.lastCanonicalCommit?await gs(e,t,["rev-parse","--verify",`${t.lastCanonicalCommit}\
|
|
1625
|
+
^{commit}`],r):"",P(e,t,["rev-parse","--verify",`${t.baseCommit}^{commit}`],r)]),s=n||o||i;for(let a of[o,i].filter(Boolean))
|
|
1626
|
+
a!==s&&await Re(e,t,s,a,r)&&(s=a);return s}async function bs(e,t,{baseCommit:r,canonicalCommit:n,sessionHead:o,worktreeTree:i,
|
|
1627
|
+
reconcileHistory:s=!1},a={}){let[c,l]=await Promise.all([bt(e,t,r,a),bt(e,t,n,a)]);if(i===l)return{baseTree:c,canonicalTree:l,
|
|
1628
|
+
changeBaseCommit:n,changeBaseTree:l,changedPaths:[],sessionMatchesCanonical:!0};let u=s?r:await P(e,t,["merge-base",n,o],
|
|
1629
|
+
a),d=u===n?l:await bt(e,t,u,a),f=i===d?[]:await fp(e,t,u,i,a);return{baseTree:c,canonicalTree:l,changeBaseCommit:u,changeBaseTree:d,
|
|
1630
|
+
changedPaths:f,sessionMatchesCanonical:i===l}}function gp(e,t,r){let n=Number.parseInt(String(e??""),10);return Number.isSafeInteger(
|
|
1631
|
+
n)&&n>0?Math.min(n,r):t}function bp(e=""){let t=String(e||"").split("\0"),r=new Map;for(let n=0;n<t.length;){let o=E(t[n++]);
|
|
1516
1632
|
if(!o)continue;let i=/^[CR]/u.test(o)?t[n++]:"",s=t[n++];s&&r.set(s,{path:s,...i?{previousPath:i}:{},status:o.slice(0,1)})}
|
|
1517
|
-
return r}function
|
|
1518
|
-
r>=0?r:0}function
|
|
1519
|
-
let i=o.indexOf(" "),s=o.indexOf(" ",i+1),a=o.slice(s+1),c=!a;c&&(n+=1);let l=c?t[n++]:a;l&&r.set(l,{added:
|
|
1520
|
-
i)),deleted:
|
|
1521
|
-
"--no-commit-id","-r","-M","--name-status","-z",r,n],o),
|
|
1522
|
-
n],o)]),a=
|
|
1523
|
-
deleted:0}})).sort((l,u)=>l.path.localeCompare(u.path))}function
|
|
1524
|
-
posix.isAbsolute(t)||F.posix.normalize(t)!==t||t===".."||t.startsWith("../"))throw
|
|
1525
|
-
ibe64_session_change_path_invalid");return t}function
|
|
1526
|
-
`:(glob,exclude)${t}/**`]}async function
|
|
1527
|
-
changedPaths.includes(a))throw
|
|
1528
|
-
t_found");let c=await
|
|
1529
|
-
r.worktreeTree,"--",...
|
|
1633
|
+
return r}function sp(e=""){let t=E(e);if(t==="-")return null;let r=Number.parseInt(t,10);return Number.isSafeInteger(r)&&
|
|
1634
|
+
r>=0?r:0}function Uv(e=""){let t=String(e||"").split("\0"),r=new Map;for(let n=0;n<t.length;){let o=t[n++];if(!o)continue;
|
|
1635
|
+
let i=o.indexOf(" "),s=o.indexOf(" ",i+1),a=o.slice(s+1),c=!a;c&&(n+=1);let l=c?t[n++]:a;l&&r.set(l,{added:sp(o.slice(0,
|
|
1636
|
+
i)),deleted:sp(o.slice(i+1,s))})}return r}async function zv(e,t,r,n,o={}){let[i,s]=await Promise.all([I(e,t,["diff-tree",
|
|
1637
|
+
"--no-commit-id","-r","-M","--name-status","-z",r,n],o),I(e,t,["diff-tree","--no-commit-id","-r","-M","--numstat","-z",r,
|
|
1638
|
+
n],o)]),a=bp(i.stdout||i.output),c=Uv(s.stdout||s.output);return[...a.values()].map(l=>({...l,...c.get(l.path)||{added:0,
|
|
1639
|
+
deleted:0}})).sort((l,u)=>l.path.localeCompare(u.path))}function wp(e=""){let t=String(e||"");if(!t||t.includes("\0")||F.
|
|
1640
|
+
posix.isAbsolute(t)||F.posix.normalize(t)!==t||t===".."||t.startsWith("../"))throw w("Choose a changed project file.","v\
|
|
1641
|
+
ibe64_session_change_path_invalid");return t}function Gv(e){let t=e.replace(/[*?[\]\\]/gu,"\\$&");return[`:(literal)${e}`,
|
|
1642
|
+
`:(glob,exclude)${t}/**`]}async function yp(e,t,r,n,{commandOptions:o={},lineLimit:i=hs,project:s={}}={}){let a=wp(n);if(!r.
|
|
1643
|
+
changedPaths.includes(a))throw w("That file is not part of the current saved-work difference.","vibe64_session_change_no\
|
|
1644
|
+
t_found");let c=await I(e,t,["--no-literal-pathspecs","diff","--no-ext-diff","--find-renames","--unified=3",r.changeBaseCommit,
|
|
1645
|
+
r.worktreeTree,"--",...Gv(a)],{commandOptions:o,project:s}),l=String(c.stdout||c.output||"").replaceAll(`\r
|
|
1530
1646
|
`,`
|
|
1531
1647
|
`).split(`
|
|
1532
|
-
`),u=
|
|
1648
|
+
`),u=gp(i,hs,Dv);return{canonicalCommit:r.canonicalCommit,changeBaseCommit:r.changeBaseCommit,diff:l.slice(0,u).join(`
|
|
1533
1649
|
`),lineLimit:u,ok:!0,path:a,shownLines:Math.min(l.length,u),totalLines:l.length,truncated:l.length>u,worktreeTree:r.worktreeTree}}
|
|
1534
|
-
async function
|
|
1535
|
-
runCommand:s=
|
|
1650
|
+
async function ws({commandOptions:e={},derivedArtifactPaths:t=[],includeInitialDiff:r=!0,limit:n=op,offset:o=0,project:i={},
|
|
1651
|
+
runCommand:s=D,session:a={},worktreeTree:c=""}={}){let l=X(a,i);s=ye(s,l,i,{label:"Inspecting session changes"});let u=await zn(
|
|
1536
1652
|
{commandOptions:e,derivedArtifactPaths:t,project:i,runCommand:s,session:a,worktreeTree:c}),d=new Set(u.changedPaths),f=u.
|
|
1537
|
-
unsaved?await
|
|
1538
|
-
[],p=
|
|
1653
|
+
unsaved?await zv(s,l,u.changeBaseCommit,u.worktreeTree,{commandOptions:e,project:i}).then(b=>b.filter(g=>d.has(g.path))):
|
|
1654
|
+
[],p=gp(n,op,Mv),m=Math.max(0,Number.parseInt(String(o??""),10)||0),h=f.slice(m,m+p),_=r&&m===0&&h.length>0?await yp(s,l,
|
|
1539
1655
|
u,h[0].path,{commandOptions:e,project:i}):null;return{...u,files:h,initialDiff:_,limit:p,offset:m,totalCount:f.length,truncated:m+
|
|
1540
|
-
p<f.length}}async function
|
|
1541
|
-
session:s={}}={}){let a=
|
|
1542
|
-
derivedArtifactPaths:t,project:o,runCommand:i,session:s});return
|
|
1543
|
-
commandOptions:e={},derivedArtifactPaths:t=[],
|
|
1544
|
-
|
|
1545
|
-
worktreePath}),[
|
|
1546
|
-
|
|
1547
|
-
"
|
|
1548
|
-
|
|
1549
|
-
{commandOptions:e,project:
|
|
1550
|
-
project:
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1656
|
+
p<f.length}}async function _p({commandOptions:e={},derivedArtifactPaths:t=[],lineLimit:r=hs,path:n="",project:o={},runCommand:i=D,
|
|
1657
|
+
session:s={}}={}){let a=wp(n),c=X(s,o);i=ye(i,c,o,{label:"Inspecting a session change"});let l=await zn({commandOptions:e,
|
|
1658
|
+
derivedArtifactPaths:t,project:o,runCommand:i,session:s});return yp(i,c,l,a,{commandOptions:e,lineLimit:r,project:o})}async function zn({
|
|
1659
|
+
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=ye(i,c,o,{label:"Inspecting session work"});let l=E(a)||
|
|
1661
|
+
await ae({baseCommit:"HEAD",project:ee(c,o),runCommand:i,worktreePath:c.worktreePath}),[u,d,f,p]=await Promise.all([hp(i,
|
|
1662
|
+
c,{commandOptions:e,project:o}),P(i,c,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:e,project:o}),P(i,c,["sta\
|
|
1663
|
+
tus","--porcelain=v1","--untracked-files=all","--ignore-submodules=none","-z"],{commandOptions:e,project:o}),P(i,c,["rev\
|
|
1664
|
+
-parse","--show-toplevel"],{commandOptions:e,project:o})]),[m,h,_,b]=await Promise.all([P(i,c,["rev-parse",`${d}^{tree}`],
|
|
1665
|
+
{commandOptions:e,project:o}),Mn(i,c,u,d,{commandOptions:e,project:o}),Mn(i,c,d,u,{commandOptions:e,project:o}),bs(i,c,{
|
|
1666
|
+
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)),T=b.changedPaths.filter(S=>!g.has(S)),y=fs(h,_),A=f.length===0,R;if(r){if(!c.contribution)
|
|
1668
|
+
throw w("Publication inspection requires a bound contribution.","vibe64_contribution_authority_changed");if(R=await Ln(i,
|
|
1669
|
+
c,{commandOptions:e,project:o},!0),!R&&n){if(!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(n))throw w("The saved contribution\
|
|
1670
|
+
evidence is invalid.","vibe64_connected_integration_unknown");R=n}if(c.contributionDiscarded||R&&c.contributionRemoteAbsent){
|
|
1671
|
+
let S=`refs/heads/${c.contribution.integrationBranch}`,x=await P(i,c,["ls-remote","--heads",c.remoteUrl,S],{commandOptions:e,
|
|
1672
|
+
project:o}),[$,M,k]=x.split(/\s+/u);if(M!==S||k||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test($)||!await Re(i,c,R,$,{commandOptions:e,
|
|
1673
|
+
project:o}))throw w("The removed contribution has not been proved integrated in this source. Check its receiving target \
|
|
1674
|
+
and explicitly Update the connected session.",c.contributionDiscarded?"vibe64_contribution_discarded":"vibe64_contributi\
|
|
1675
|
+
on_branch_missing")}if(!R&&c.baseCommit!==c.contribution.baseCommit)throw w("The published contribution branch is missin\
|
|
1676
|
+
g and no exact submitted revision is retained. Preserve the source and inspect its Save recovery evidence.","vibe64_cont\
|
|
1677
|
+
ribution_branch_missing");if(R&&!await Re(i,c,R,d,{commandOptions:e,project:o}))throw w("The contribution branch contain\
|
|
1678
|
+
s work this source has not incorporated. Update its receiving session before saving the main project.","vibe64_connected\
|
|
1679
|
+
_source_update_required",{repository:c.contribution.repository,sessionId:c.sessionId})}return{ahead:h,baseCommit:c.baseCommit,
|
|
1680
|
+
behind:_,branch:c.branch,canonicalCommit:u,canonicalTree:b.canonicalTree,changeBaseCommit:b.changeBaseCommit,changeBaseTree:b.
|
|
1681
|
+
changeBaseTree,changedPaths:T,destination:ep(o,s),dirty:l!==m||!A,mode:c.mode,ok:!0,...r?{publishedCommit:R}:{},repositoryMode:c.
|
|
1682
|
+
mode,relationship:y,sessionMatchesCanonical:T.length===0,sessionHead:d,sessionId:c.sessionId,tree:l,updateAvailable:_>0,
|
|
1683
|
+
updateStrategy:ps(y),unsaved:T.length>0,worktreeClean:A,worktreeTree:l,worktreeTopLevel:p,worktreePath:c.worktreePath}}async function Gn(e,t,r){await I(e,t,["check-ref-format","--branch",t.branch],r)}function wt(e,t,r){return`refs/vibe64/s\
|
|
1684
|
+
ave/${pe.createHash("sha256").update(`${e.sessionId}\0${t}`).digest("hex").slice(0,32)}/${r}`}function Sp(e,t){return wt(
|
|
1685
|
+
e,t,"prepared")}function ys(e){return`refs/vibe64/canonical/${pe.createHash("sha256").update(e.branch).digest("hex").slice(0,32)}`}async function yt(e,t,r,n={}){
|
|
1686
|
+
E(r)&&await I(e,t,["update-ref","-d",r],{...n,required:!1})}async function Fv(e,t,r,n,o={}){let i=Sp(t,r);return await I(
|
|
1687
|
+
e,t,["update-ref",i,n],o),i}async function Xt(e,t,r,n={}){let o=await P(e,t,["rev-parse","--verify",`${r}^{commit}`],n);
|
|
1688
|
+
return await I(e,t,["update-ref",ys(t),o],n),o}async function Hv(e,t,r,n){if(await I(e,t,["remote","set-url","origin",t.
|
|
1689
|
+
remoteUrl],n),t.contribution&&(t.contributionPublishedCommit=await Ln(e,t,n,!0),t.contributionRemoteAbsent=!t.contributionPublishedCommit,
|
|
1690
|
+
t.contributionRemoteAbsent)){let s=await gs(e,t,["rev-parse","--verify",`${ys(t)}^{commit}`],n);if((await P(e,t,["for-ea\
|
|
1691
|
+
ch-ref","--format=%(refname)","refs/vibe64/save/"],n)).split(`
|
|
1692
|
+
`).some(c=>c.endsWith("/prepared")))throw w("This contribution branch is missing after a publication attempt. Inspect it\
|
|
1693
|
+
s saved work and integration history before resubmitting it.","vibe64_contribution_branch_missing");if(t.lastCanonicalCommit===
|
|
1694
|
+
t.contribution.baseCommit&&(!s||s===t.contribution.baseCommit))return t.canonicalBranch=t.contribution.replaces?`vibe64-\
|
|
1695
|
+
incoming/${t.contribution.replaces}_discarded`:t.contribution.integrationBranch,t.contribution.baseCommit;t.contributionMissingPublished=
|
|
1696
|
+
!0}let o=wt(t,r,"canonical"),i=t.contribution?wt(t,r,"integration"):"";try{await I(e,t,["fetch","--no-tags","origin",`+r\
|
|
1697
|
+
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 P(e,t,["rev-parse",
|
|
1699
|
+
"--verify",o],n);if(i){if(!t.contributionMissingPublished&&s!==t.contributionPublishedCommit)throw w("The contribution b\
|
|
1700
|
+
ranch changed during its authority check. Retry Update or Save.","vibe64_session_save_update_required");let a=await P(e,
|
|
1701
|
+
t,["rev-parse","--verify",i],n),c=await Re(e,t,t.contributionMissingPublished?t.baseCommit:s,a,n);if((t.contributionDiscarded||
|
|
1702
|
+
t.contributionMissingPublished)&&(!c||t.baseCommit===t.contribution.baseCommit&&t.contributionMissingPublished))throw w(
|
|
1703
|
+
"This removed contribution has not been integrated. Preserve its source and inspect its saved work.",t.contributionDiscarded?
|
|
1704
|
+
"vibe64_contribution_discarded":"vibe64_contribution_branch_missing");c&&(s=a,t.canonicalBranch=t.contribution.integrationBranch)}
|
|
1705
|
+
return Xt(e,t,s,n)}finally{await yt(e,t,o,n),await yt(e,t,i,n)}}async function Ln(e,t,r,n=!1){let o=`refs/heads/${t.branch}`,
|
|
1706
|
+
i=`${o}_discarded`,s=await P(e,t,["ls-remote","--heads",t.remoteUrl,o,i],r),a=new Map(s.split(`
|
|
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 w(
|
|
1708
|
+
"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 w(a.has(o)?"Both cont\
|
|
1710
|
+
ribution branches exist after an interrupted discard. Resolve that operation before publishing.":"This contribution was \
|
|
1711
|
+
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 Ep(e,t,r){if(await P(e,t,[
|
|
1713
|
+
"branch","--show-current"],{...r,cwd:t.standaloneSourceRoot})!==t.branch)throw w(`The project baseline must have ${t.branch}\
|
|
1714
|
+
checked out before Save.`,"vibe64_session_save_local_branch_mismatch");if(await P(e,t,["status","--porcelain","--untrac\
|
|
1715
|
+
ked-files=all"],{...r,cwd:t.standaloneSourceRoot}))throw w("The local project baseline has unsaved work. Save cannot ove\
|
|
1566
1716
|
rwrite it.","vibe64_session_save_local_authority_dirty");for(let i of["MERGE_HEAD","CHERRY_PICK_HEAD","REVERT_HEAD","REB\
|
|
1567
|
-
ASE_HEAD"])if((await
|
|
1568
|
-
"The local project baseline has an unfinished Git operation.","vibe64_session_save_local_operation_in_progress");return
|
|
1569
|
-
e,t,["rev-parse","--verify","HEAD"],{...r,cwd:t.standaloneSourceRoot})}async function
|
|
1570
|
-
e,t,r,n);let o=await
|
|
1571
|
-
heads/${t.branch}:${i}`],n);let s=await
|
|
1572
|
-
changed while Vibe64 was reading it.","vibe64_session_save_authority_advanced");return
|
|
1573
|
-
i,n)}}async function
|
|
1574
|
-
explicitBase:l=!1}){let u=c||await
|
|
1575
|
-
project:a,tree:o}),d=await
|
|
1576
|
-
-z",n,u],{commandOptions:i,project:a,required:!1}),f=String(d?.stdout||d?.output||"").split("\0"),p=
|
|
1577
|
-
test(p))throw
|
|
1717
|
+
ASE_HEAD"])if((await I(e,t,["rev-parse","--verify","-q",i],{...r,cwd:t.standaloneSourceRoot,required:!1}))?.ok===!0)throw w(
|
|
1718
|
+
"The local project baseline has an unfinished Git operation.","vibe64_session_save_local_operation_in_progress");return P(
|
|
1719
|
+
e,t,["rev-parse","--verify","HEAD"],{...r,cwd:t.standaloneSourceRoot})}async function vp(e,t,r,n){if(t.mode!==j)return Hv(
|
|
1720
|
+
e,t,r,n);let o=await Ep(e,t,n),i=wt(t,r,"canonical");try{await I(e,t,["fetch","--no-tags",t.standaloneSourceRoot,`+refs/\
|
|
1721
|
+
heads/${t.branch}:${i}`],n);let s=await P(e,t,["rev-parse","--verify",i],n);if(s!==o)throw w("The local project baseline\
|
|
1722
|
+
changed while Vibe64 was reading it.","vibe64_session_save_authority_advanced");return Xt(e,t,s,n)}finally{await yt(e,t,
|
|
1723
|
+
i,n)}}async function Tp(e,t,{baseCommit:r,canonicalCommit:n,checkpointTree:o,commandOptions:i,identity:s,project:a,virtualCommit:c="",
|
|
1724
|
+
explicitBase:l=!1}){let u=c||await Fn(e,t,{baseCommit:r,commandOptions:i,identity:s,message:"Vibe64 session rebase input",
|
|
1725
|
+
project:a,tree:o}),d=await I(e,t,["merge-tree","--write-tree",...l?[`--merge-base=${r}`]:[],"--messages","--name-only","\
|
|
1726
|
+
-z",n,u],{commandOptions:i,project:a,required:!1}),f=String(d?.stdout||d?.output||"").split("\0"),p=E(f.shift());if(!/^[0-9a-f]{40,64}$/u.
|
|
1727
|
+
test(p))throw w(d?.ok===!0?"Git did not produce a valid rebased tree.":"Vibe64 could not prepare the conflicting files f\
|
|
1578
1728
|
or review.","vibe64_session_update_merge_invalid");if(d?.ok!==!0){let m=[];for(;f.length>0;){let h=f.shift();if(!h)break;
|
|
1579
|
-
m.push(h)}if(!m.length)throw
|
|
1729
|
+
m.push(h)}if(!m.length)throw w("Vibe64 could not identify which files conflict with the latest saved version.","vibe64_s\
|
|
1580
1730
|
ession_update_merge_invalid");return{conflictPaths:[...new Set(m)].sort((h,_)=>h.localeCompare(_)),conflictTree:p,mergedTree:"",
|
|
1581
|
-
virtualCommit:u}}return{conflictPaths:[],conflictTree:"",mergedTree:p,virtualCommit:u}}function
|
|
1731
|
+
virtualCommit:u}}return{conflictPaths:[],conflictTree:"",mergedTree:p,virtualCommit:u}}function jv(e={}){if(!e||typeof e!=
|
|
1582
1732
|
"object"||Array.isArray(e))return null;let t=Array.isArray(e.conflictPaths)?[...new Set(e.conflictPaths.map(String).filter(
|
|
1583
|
-
Boolean))].sort((n,o)=>n.localeCompare(o)):[],r={baseCommit:
|
|
1584
|
-
e.checkpointTree),conflictPaths:t,conflictTree:
|
|
1585
|
-
e.oldIndexTree)};return Object.values(r).some(n=>Array.isArray(n)?n.length===0:!n)?null:r}function
|
|
1733
|
+
Boolean))].sort((n,o)=>n.localeCompare(o)):[],r={baseCommit:E(e.baseCommit),canonicalCommit:E(e.canonicalCommit),checkpointTree:E(
|
|
1734
|
+
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 Vv(e=[]){let t=e.length,
|
|
1586
1736
|
r=e.slice(0,3).join(", "),n=t>3?` and ${t-3} more`:"";return`${t} ${t===1?"file needs":"files need"} review before this \
|
|
1587
|
-
session can update: ${r}${n}.
|
|
1588
|
-
function
|
|
1589
|
-
async function
|
|
1590
|
-
r);let a=new Set(s.conflictPaths);if(!(["baseCommit",
|
|
1591
|
-
r.conflictPaths.every(l=>a.has(l)))||o!==s.reviewId)throw
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
await
|
|
1609
|
-
|
|
1610
|
-
|
|
1737
|
+
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 ap(e){return w(Vv(e.conflictPaths),"vibe64_session_update\
|
|
1739
|
+
_conflict",{conflictPaths:e.conflictPaths,conflictRecovery:e})}async function Wv(e,t,{currentRecovery:r,previousRecovery:n,
|
|
1740
|
+
reviewedConflictId:o,project:i}){let s=o?jv(n):null;if(!s)throw ap(r);let a=new Set(s.conflictPaths);if(!(["baseCommit",
|
|
1741
|
+
"canonicalCommit","oldHead","oldIndexTree"].every(l=>s[l]===r[l])&&r.conflictPaths.every(l=>a.has(l)))||o!==s.reviewId)throw ap(
|
|
1742
|
+
r);return Ap(e,t,{...r,project:i})}function Ap(e,t,{conflictTree:r,conflictPaths:n,project:o}){return ae({baseCommit:r,paths:n,
|
|
1743
|
+
project:ee(t,o),runCommand:e,worktreePath:t.worktreePath})}async function Fn(e,t,{baseCommit:r,commandOptions:n,identity:o,
|
|
1744
|
+
message:i,project:s,tree:a}){return P(e,t,["-c",`user.name=${o.name}`,"-c",`user.email=${o.email}`,"commit-tree",a,"-p",
|
|
1745
|
+
r],{commandOptions:n,input:`${E(i)||"Vibe64 virtual commit"}
|
|
1746
|
+
`,project:s})}async function _s(e,t,{commandOptions:r,derivedArtifactPaths:n=[],project:o,sourceCommit:i,tree:s}){let a=Un(
|
|
1747
|
+
n);if(!a.length)return s;let c=await lp(F.join(F.dirname(t.worktreePath),".vibe64-derived-index-")),u={GIT_INDEX_FILE:F.
|
|
1748
|
+
join(c,"index")},d={additionalAllowedRoots:[c],commandOptions:r,env:u,project:o};try{await I(e,t,["read-tree",s],d);for(let f of a){
|
|
1749
|
+
let p=await I(e,t,["ls-tree","-z",i,"--",f],{commandOptions:r,project:o}),m=/^(\d+)\s+\S+\s+([0-9a-f]{40,64})\t([^\0]+)\0$/u.
|
|
1750
|
+
exec(String(p.stdout||""));m&&m[3]===f?await I(e,t,["update-index","--add","--cacheinfo",m[1],m[2],f],d):await I(e,t,["u\
|
|
1751
|
+
pdate-index","--force-remove","--",f],{...d,required:!1})}return await P(e,t,["write-tree"],d)}finally{await up(c,{force:!0,
|
|
1752
|
+
recursive:!0})}}async function Bn(e,t,{baseCommit:r,commandOptions:n,derivedArtifactPaths:o=[],identity:i,project:s,refreshDerivedArtifacts:a,
|
|
1753
|
+
tree:c}){if(!Un(o).length)return c;if(typeof a!="function")throw w("The project declares generated artifacts but their o\
|
|
1754
|
+
wning tool is unavailable.","vibe64_session_derived_artifact_refresh_unavailable");let u=await Fn(e,t,{baseCommit:r,commandOptions:n,
|
|
1755
|
+
identity:i,message:"Vibe64 derived artifact input",project:s,tree:c}),d=await lp(F.join(F.dirname(t.worktreePath),".vibe\
|
|
1756
|
+
64-derived-worktree-")),f=F.join(d,"source"),p={additionalAllowedRoots:[d,f],commandOptions:n,project:s},m=!1;try{return await I(
|
|
1757
|
+
e,t,["worktree","add","--detach",f,u],p),m=!0,await a({projectRoot:f}),await ae({baseCommit:"HEAD",project:ee(t,s),runCommand:e,
|
|
1758
|
+
worktreePath:f})}finally{m&&await I(e,t,["worktree","remove","--force",f],{...p,required:!1}),await up(d,{force:!0,recursive:!0}),
|
|
1759
|
+
await I(e,t,["worktree","prune"],{commandOptions:n,project:s,required:!1})}}async function qv(e,t,{canonicalCommit:r,commandOptions:n,
|
|
1760
|
+
identity:o,mergedTree:i,message:s,project:a}){let c=E(s);if(!c)throw w("Save requires an assistant-generated commit subj\
|
|
1761
|
+
ect.","vibe64_session_save_message_required");return P(e,t,["-c",`user.name=${o.name}`,"-c",`user.email=${o.email}`,"com\
|
|
1611
1762
|
mit-tree",i,"-p",r],{commandOptions:n,input:`${c}
|
|
1612
|
-
`,project:a})}async function
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1763
|
+
`,project:a})}async function Ss(e,t,r){if(t.connectedSubmissions.length){if(await P(e,t,["rev-parse","--is-shallow-repos\
|
|
1764
|
+
itory"],r)!=="false")throw w("Connected integration requires complete Git history. Prepare a full checkout before saving\
|
|
1765
|
+
.","vibe64_connected_integration_unknown");for(let{contribution:n,submittedCommit:o}of t.connectedSubmissions){let{repository:i,
|
|
1766
|
+
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`,f={repository:i,integrationBranch:s,id:a,submittedCommit:o},p=[];try{let m=await P(e,t,["ls-remote","--heads",
|
|
1768
|
+
c,l,u,d],r),h=new Map;for(let g of m.split(`
|
|
1769
|
+
`).filter(Boolean)){let[T,y]=g.split(/\s+/u);if(![l,u,d].includes(y)||h.has(y)||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(
|
|
1770
|
+
T))throw w("The receiving repository returned invalid ref evidence.");h.set(y,T)}if(!h.has(l))throw w("The receiving int\
|
|
1771
|
+
egration branch is unavailable.");if(h.has(u)&&h.has(d))throw w(`${i} has an interrupted discard. Resolve it in Incoming\
|
|
1772
|
+
changes before saving this project.`,"vibe64_connected_integration_unresolved",f);for(let[g,T]of h)p.push({remote:g,head:T,
|
|
1773
|
+
local:wt(t,pe.randomUUID(),"connected-integration")});if(await I(e,t,["fetch","--no-tags","--no-write-fetch-head",c,...p.
|
|
1774
|
+
map(g=>`+${g.remote}:${g.local}`)],r),await P(e,t,["rev-parse","--is-shallow-repository"],r)!=="false")throw w("The rece\
|
|
1775
|
+
iving history is incomplete.");for(let g of p)if(await P(e,t,["rev-parse","--verify",`${g.local}^{commit}`],r)!==g.head)
|
|
1776
|
+
throw w("The receiving branches changed during the integration check. Retry Save.");let _=await P(e,t,["rev-list","--cou\
|
|
1777
|
+
nt",`${h.get(l)}..${o}`],r);if(!/^\d+$/u.test(_))throw w("The required revision's ancestry is unknown.");if(_!=="0"){let g=h.
|
|
1778
|
+
has(d);throw w(`${i} has ${g?"discarded":"not merged"} contribution ${a} at ${o.slice(0,12)}. Integrate that revision in\
|
|
1779
|
+
to ${s} before saving this project.`,g?"vibe64_connected_integration_discarded":"vibe64_connected_integration_pending",f)}
|
|
1780
|
+
let b=(r.connectedWorkSnapshots||[]).find(g=>g.contribution.repository===i&&g.contribution.integrationBranch===s);if(!b||
|
|
1781
|
+
!await Re(e,t,h.get(l),b.sessionHead,r))throw w(`Update the connected session for ${i} to incorporate its accepted ${s} \
|
|
1782
|
+
source before saving this project.`,"vibe64_connected_integration_source_update_required",f)}catch(m){throw m.code?.startsWith(
|
|
1783
|
+
"vibe64_connected_integration_")?m:w(`Could not verify contribution ${a} in ${i}/${s}. Check repository access and compl\
|
|
1784
|
+
ete history, then retry Save.`,"vibe64_connected_integration_unknown",f)}finally{for(let m of p)await yt(e,t,m.local,r)}}}}
|
|
1785
|
+
function Ip(e=[]){if(!Array.isArray(e))throw w("Connected source snapshots are unavailable.","vibe64_connected_source_un\
|
|
1786
|
+
available");return e.map(t=>{let r=Kt({metadata:{connected_contribution:JSON.stringify(t?.contribution)}});if(!r||typeof t.
|
|
1787
|
+
sessionId!="string"||!E(t.sessionId)||!F.isAbsolute(E(t.worktreePath))||[t.baseCommit,t.canonicalCommit,t.sessionHead,t.
|
|
1788
|
+
worktreeTree].some(n=>!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(E(n))))throw w("The connected source could not be capture\
|
|
1789
|
+
d. Inspect connected work before saving.","vibe64_connected_source_unavailable");return{contribution:r,sessionId:t.sessionId,
|
|
1790
|
+
worktreePath:E(t.worktreePath),baseCommit:t.baseCommit,canonicalCommit:t.canonicalCommit,sessionHead:t.sessionHead,worktreeTree:t.
|
|
1791
|
+
worktreeTree}})}async function cp(e,t,r){for(let n of t){let{contribution:o}=n,i=X({sessionId:n.sessionId,sourcePath:n.worktreePath,
|
|
1792
|
+
metadata:{base_commit:n.baseCommit,canonical_commit:n.canonicalCommit,connected_contribution:JSON.stringify(o)}},{repositoryMode:K,
|
|
1793
|
+
repository:{defaultBranch:o.integrationBranch},githubRepository:{fullName:o.repository,cloneUrl:`https://github.com/${o.
|
|
1794
|
+
repository}.git`}});try{let s=await ae({baseCommit:"HEAD",project:ee(i,r.project),runCommand:e,worktreePath:i.worktreePath}),
|
|
1795
|
+
[a,c]=await Promise.all([P(e,i,["rev-parse","--verify","HEAD^{commit}"],r),hp(e,i,r)]);if(s!==n.worktreeTree||a!==n.sessionHead||
|
|
1796
|
+
c!==n.canonicalCommit)throw w(`Connected work in ${o.repository} changed during Save. Inspect and save it before retryin\
|
|
1797
|
+
g Main Save.`,"vibe64_connected_save_required",{repository:o.repository,sessionId:o.id})}catch(s){throw s.code==="vibe64\
|
|
1798
|
+
_connected_save_required"?s:w(`Connected work in ${o.repository} could not be rechecked. Restore source access and retry\
|
|
1799
|
+
Save.`,"vibe64_connected_source_unavailable",{repository:o.repository,sessionId:o.id})}}}async function Yv(e,t,r,n,o){if(await Ss(
|
|
1800
|
+
e,t,o),t.mode===j){if(await Ep(e,t,o)!==n)throw w("The local project baseline advanced during Save.","vibe64_session_sav\
|
|
1801
|
+
e_authority_advanced");await I(e,t,["fetch",t.worktreePath,r],{...o,cwd:t.standaloneSourceRoot}),await cp(e,o.connectedWorkSnapshots||
|
|
1802
|
+
[],o),o.onPublicationAttempt?.(),await I(e,t,["merge","--ff-only",r],{...o,cwd:t.standaloneSourceRoot});let u=await P(e,
|
|
1803
|
+
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 w("This contribution branch was removed after publication. \
|
|
1805
|
+
Preserve its source and submit further work as a new contribution.","vibe64_contribution_branch_missing");let l=t.contributionRemoteAbsent?
|
|
1806
|
+
"":t.contributionPublishedCommit;if(await Ln(e,t,o)!==l)throw w("The contribution branch changed while Save was preparin\
|
|
1807
|
+
g. Inspect it before trying again.","vibe64_session_save_update_required");i.push(`--force-with-lease=refs/heads/${t.branch}\
|
|
1808
|
+
:${l}`)}t.mode===ht&&i.push("--push-option=vibe64-atomic"),i.push("origin",`${r}:refs/heads/${t.branch}`);let a;await cp(
|
|
1809
|
+
e,o.connectedWorkSnapshots||[],o),o.onPublicationAttempt?.();try{a=await I(e,t,i,{...o,required:!1})}catch(l){a={ok:!1,code:l.
|
|
1810
|
+
code,error:l.message}}let c;try{c=(t.contribution?await Ln(e,t,o):await P(e,t,["ls-remote","--heads","origin",`refs/head\
|
|
1811
|
+
s/${t.branch}`],o)).split(/\s+/u)[0]||""}catch(l){throw["vibe64_contribution_discarded","vibe64_contribution_discard_inc\
|
|
1812
|
+
omplete"].includes(l.code)?l:w(`Save publication could not be confirmed. Inspect work to recover the prepared commit bef\
|
|
1813
|
+
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 w("The saved branch changed while Save was publishing. Update this session, then save again.","vib\
|
|
1815
|
+
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===K&&/changes must be made through a pull request/iu.test(
|
|
1817
|
+
l)?w(`GitHub requires a pull request to update ${t.branch}. Your work remains in this session.
|
|
1622
1818
|
|
|
1623
|
-
${
|
|
1624
|
-
"
|
|
1625
|
-
n
|
|
1626
|
-
commandOptions:n={},project:o={}}={}){if(t.mode!==le)return{attempted:!1,kind:"none",retryable:!1,status:"not_applicable"};
|
|
1819
|
+
${l}`,"vibe64_pull_request_required"):w(l,E(a?.code)||"vibe64_session_save_git_failed")}throw w("Canonical repository ve\
|
|
1820
|
+
rification did not return the commit Vibe64 published.","vibe64_session_save_verification_failed")}async function Kv(e,t,r,{
|
|
1821
|
+
commandOptions:n={},project:o={}}={}){if(t.mode!==K)return{attempted:!1,kind:"none",retryable:!1,status:"not_applicable"};
|
|
1627
1822
|
let i=t.githubMirrorPath,s=(a,c)=>({attempted:!!i,branch:t.branch,code:a,kind:"github_mirror",message:"Your work was sav\
|
|
1628
1823
|
ed, but Vibe64 could not refresh its local clone cache. A later session or Save will retry it.",reason:c,retryable:!0,status:"\
|
|
1629
1824
|
retryable",verifiedCommit:r});if(!i&&t.githubMirrorOptional)return{attempted:!1,kind:"none",retryable:!1,status:"not_app\
|
|
1630
1825
|
licable"};if(!i||!F.isAbsolute(i))return s("vibe64_session_save_github_mirror_missing","configuration_missing");try{let[
|
|
1631
|
-
a,...c]=
|
|
1632
|
-
if(l?.ok!==!0)return s(
|
|
1633
|
-
i],commandOptions:n,project:o,required:!1},[d,f]=await Promise.all([
|
|
1634
|
-
ads/${t.branch}^{commit}`],u),
|
|
1635
|
-
|
|
1826
|
+
a,...c]=ls({mirrorPath:i,remoteUrl:t.remoteUrl}),l=await dp(e,t,a,c,{additionalAllowedRoots:[i],commandOptions:n,project:o});
|
|
1827
|
+
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,f]=await Promise.all([I(e,t,["--git-dir",i,"rev-parse","--verify",`refs/he\
|
|
1829
|
+
ads/${t.branch}^{commit}`],u),I(e,t,["--git-dir",i,"remote","get-url","origin"],u)]),p=d?.ok===!0?$n(d):"",m=f?.ok===!0?
|
|
1830
|
+
$n(f):"";return p!==r||m!==t.remoteUrl?{...s("vibe64_session_save_github_mirror_verification_failed","verification_faile\
|
|
1636
1831
|
d"),mirrorCommit:p}:{attempted:!0,branch:t.branch,kind:"github_mirror",mirrorCommit:p,retryable:!1,status:"current",verifiedCommit:r}}catch{
|
|
1637
|
-
return s("vibe64_session_save_github_mirror_refresh_failed","refresh_interrupted")}}async function
|
|
1638
|
-
e,t,r,n)}async function
|
|
1639
|
-
let i=
|
|
1640
|
-
let s=await
|
|
1641
|
-
{commandOptions:e,project:r}),
|
|
1642
|
-
n,i,["merge-base","--is-ancestor",i.baseCommit,s],{commandOptions:e,project:r,required:!1}))?.ok!==!0;if(u&&i.mode!==
|
|
1832
|
+
return s("vibe64_session_save_github_mirror_refresh_failed","refresh_interrupted")}}async function Rp(e,t,r,n){return vp(
|
|
1833
|
+
e,t,r,n)}async function Pp({commandOptions:e={},operationId:t=pe.randomUUID(),project:r={},runCommand:n=D,session:o={}}={}){
|
|
1834
|
+
let i=X(o,r);n=ye(n,i,r,{label:"Checking repository for updates",operationId:t}),await Gn(n,i,{commandOptions:e,project:r});
|
|
1835
|
+
let s=await Rp(n,i,t,{commandOptions:e,project:r}),[a,c]=await Promise.all([P(n,i,["rev-parse","--verify","HEAD^{commit}"],
|
|
1836
|
+
{commandOptions:e,project:r}),ae({baseCommit:"HEAD",project:ee(i,r),runCommand:n,worktreePath:i.worktreePath})]),u=(await I(
|
|
1837
|
+
n,i,["merge-base","--is-ancestor",i.baseCommit,s],{commandOptions:e,project:r,required:!1}))?.ok!==!0;if(u&&i.mode!==j)throw w(
|
|
1643
1838
|
"The saved project history no longer descends from this session's starting version.","vibe64_session_update_history_dive\
|
|
1644
|
-
rged");let d=u?{baseCommit:i.baseCommit,canonicalCommit:s,sessionHead:a,worktreeTree:c,changedPaths:(await
|
|
1645
|
-
c,{commandOptions:e,project:r})).slice(0,100)}:null,[f,p,m,h]=await Promise.all([
|
|
1646
|
-
|
|
1647
|
-
_=
|
|
1839
|
+
rged");let d=u?{baseCommit:i.baseCommit,canonicalCommit:s,sessionHead:a,worktreeTree:c,changedPaths:(await fp(n,i,i.baseCommit,
|
|
1840
|
+
c,{commandOptions:e,project:r})).slice(0,100)}:null,[f,p,m,h]=await Promise.all([Mn(n,i,s,a,{commandOptions:e,project:r}),
|
|
1841
|
+
Mn(n,i,a,s,{commandOptions:e,project:r}),Re(n,i,s,a,{commandOptions:e,project:r}),bt(n,i,s,{commandOptions:e,project:r})]),
|
|
1842
|
+
_=fs(f,p),b=p>0?await Bv(n,i,a,s,{commandOptions:e,project:r}):{incomingVersions:[],incomingVersionsTruncated:!1};return{
|
|
1648
1843
|
ahead:f,baseCommit:i.baseCommit,behind:p,canonicalCommit:s,canonicalSource:{authority:i.mode,commit:s,ref:`refs/heads/${i.
|
|
1649
|
-
branch}`,...i.mode===
|
|
1650
|
-
repositoryMode:i.mode,relationship:_,sessionCurrent:m,sessionHead:a,sessionMatchesCanonical:c===h,updateAvailable:u
|
|
1651
|
-
updateStrategy:
|
|
1652
|
-
oldHead:c,oldIndexTree:l,project:u}){if(await
|
|
1653
|
-
o)throw
|
|
1654
|
-
update_worktree_changed");try{await
|
|
1655
|
-
ate-ref","HEAD",r,c],{commandOptions:i,project:u}),await
|
|
1656
|
-
{baseCommit:"HEAD",project:
|
|
1657
|
-
not match the prepared merged work.","vibe64_session_update_verification_failed");return await
|
|
1658
|
-
project:u}),{currentTree:f,reconciled:!0,status:"updated"}}catch(f){let p=await
|
|
1659
|
-
project:u}).catch(()=>"");throw await
|
|
1660
|
-
p!==c&&await
|
|
1661
|
-
project:u,required:!1}),f}}async function
|
|
1662
|
-
let i=
|
|
1844
|
+
canonicalBranch||i.branch}`,...i.mode===j?{}:{repository:i.remoteUrl}},...b,ok:!0,operationId:t,reconciled:!u&&m,...d?{historyReview:d}:
|
|
1845
|
+
{},repositoryMode:i.mode,relationship:_,sessionCurrent:m,sessionHead:a,sessionMatchesCanonical:c===h,updateAvailable:u||
|
|
1846
|
+
!m,updateStrategy:ps(_)}}async function Xv(e,t,{canonicalCommit:r,checkpointCommit:n,checkpointTree:o,commandOptions:i,mergedCommit:s,mergedTree:a,
|
|
1847
|
+
oldHead:c,oldIndexTree:l,project:u}){if(await ae({baseCommit:"HEAD",project:ee(t,u),runCommand:e,worktreePath:t.worktreePath})!==
|
|
1848
|
+
o)throw w("This session changed while its update was being prepared. Retry when the assistant is idle.","vibe64_session_\
|
|
1849
|
+
update_worktree_changed");try{await I(e,t,["read-tree","--reset","-u",s],{commandOptions:i,project:u}),await I(e,t,["upd\
|
|
1850
|
+
ate-ref","HEAD",r,c],{commandOptions:i,project:u}),await I(e,t,["read-tree",r],{commandOptions:i,project:u});let f=await ae(
|
|
1851
|
+
{baseCommit:"HEAD",project:ee(t,u),runCommand:e,worktreePath:t.worktreePath});if(f!==a)throw w("The updated session did \
|
|
1852
|
+
not match the prepared merged work.","vibe64_session_update_verification_failed");return await Xt(e,t,r,{commandOptions:i,
|
|
1853
|
+
project:u}),{currentTree:f,reconciled:!0,status:"updated"}}catch(f){let p=await P(e,t,["rev-parse","HEAD"],{commandOptions:i,
|
|
1854
|
+
project:u}).catch(()=>"");throw await I(e,t,["read-tree","--reset","-u",n],{commandOptions:i,project:u,required:!1}),p&&
|
|
1855
|
+
p!==c&&await I(e,t,["update-ref","HEAD",c,p],{commandOptions:i,project:u,required:!1}),await I(e,t,["read-tree",l],{commandOptions:i,
|
|
1856
|
+
project:u,required:!1}),f}}async function Es({commandOptions:e={},operationId:t,project:r={},runCommand:n=D,session:o={}}={}){
|
|
1857
|
+
let i=X(o,r);await Gn(n,i,{commandOptions:e,project:r});let s=await kn({outerTurnId:`update:${t}`,outcome:"completed",project:ee(
|
|
1663
1858
|
i,r),runCommand:n,sessionId:i.sessionId,timestamp:new Date().toISOString(),worktreePath:i.worktreePath}),[a,c]=await Promise.
|
|
1664
|
-
all([
|
|
1665
|
-
checkpointCommit:s.commit,checkpointTree:s.tree,oldHead:a,oldIndexTree:c}}async function
|
|
1859
|
+
all([P(n,i,["rev-parse","HEAD"],{commandOptions:e,project:r}),P(n,i,["write-tree"],{commandOptions:e,project:r})]);return{
|
|
1860
|
+
checkpointCommit:s.commit,checkpointTree:s.tree,oldHead:a,oldIndexTree:c}}async function Op({checkpoint:e={},commandOptions:t={},
|
|
1666
1861
|
conflictRecovery:r=null,derivedArtifactPaths:n=[],historyReview:o=null,identity:i={},operationId:s,project:a={},reviewedConflictId:c="",
|
|
1667
|
-
runCommand:l=
|
|
1668
|
-
i.email)||"vibe64@localhost",name:
|
|
1669
|
-
l,d,["merge-base","--is-ancestor",d.baseCommit,
|
|
1670
|
-
|
|
1671
|
-
story_diverged");let
|
|
1672
|
-
r.baseCommit===d.baseCommit&&r.canonicalCommit===
|
|
1673
|
-
|
|
1674
|
-
ile this session.","vibe64_session_history_review_required")}let
|
|
1675
|
-
sessionHead:m,worktreeTree:p,reconcileHistory:
|
|
1676
|
-
|
|
1677
|
-
canonicalTree:
|
|
1678
|
-
operationId:s,mode:d.mode,reconciled:!0,repositoryMode:d.mode,sessionCurrent:
|
|
1679
|
-
status:"already_current"};let
|
|
1680
|
-
project:a,sourceCommit:
|
|
1681
|
-
commandOptions:t,identity:_,project:a}),
|
|
1682
|
-
conflictPaths:
|
|
1683
|
-
l,d,{currentRecovery:
|
|
1684
|
-
canonicalCommit:
|
|
1685
|
-
repositoryMode:d.mode,sessionCurrent:!0,...
|
|
1686
|
-
commandOptions:e={},derivedArtifactPaths:t=[],identity:r={},prepared:n={},project:o={},refreshDerivedArtifacts:i=null,runCommand:s=
|
|
1687
|
-
session:a={}}={}){let c=
|
|
1688
|
-
|
|
1689
|
-
mergedSourceTree}),d=u===n.canonicalTree?n.canonicalCommit:await
|
|
1690
|
-
message:"Vibe64 session update result",project:o,tree:u});return{...n,mergedCommit:d,mergedTree:u}}async function
|
|
1691
|
-
prepared:t={},project:r={},runCommand:n=
|
|
1692
|
-
return{...t,ok:!0,...s}}async function
|
|
1693
|
-
c,l,u]=await Promise.all([
|
|
1694
|
-
arse","HEAD"],{commandOptions:o,project:i}),
|
|
1695
|
-
status:"saved"};if(a&&l!==a)return{currentTree:c,reconciled:!1,status:"published_needs_reconcile"};let d=c!==n&&c!==u,f=await
|
|
1696
|
-
e,t,["write-tree"],{commandOptions:o,project:i});try{return d?(await
|
|
1697
|
-
await
|
|
1698
|
-
project:i}),await
|
|
1699
|
-
ed"}}catch(p){return d||await
|
|
1700
|
-
["read-tree",f],{commandOptions:o,project:i,required:!1}),{currentTree:c,error:
|
|
1701
|
-
blished_needs_reconcile"}}}async function
|
|
1702
|
-
project:o});let i=await
|
|
1703
|
-
timestamp:new Date().toISOString(),worktreePath:t.worktreePath}),s=await
|
|
1862
|
+
runCommand:l=D,session:u={}}={}){let d=X(u,a),{checkpointCommit:f,checkpointTree:p,oldHead:m,oldIndexTree:h}=e,_={email:E(
|
|
1863
|
+
i.email)||"vibe64@localhost",name:E(i.name)||"Vibe64 Update"},b=await Rp(l,d,s,{commandOptions:t,project:a}),T=(await I(
|
|
1864
|
+
l,d,["merge-base","--is-ancestor",d.baseCommit,b],{commandOptions:t,project:a,required:!1}))?.ok!==!0;if(T||o){if(d.mode!==
|
|
1865
|
+
j)throw w("The saved project history no longer descends from this session's starting version.","vibe64_session_update_hi\
|
|
1866
|
+
story_diverged");let $={baseCommit:d.baseCommit,canonicalCommit:b,sessionHead:m,worktreeTree:p};if(!(c&&r?.reviewId===c&&
|
|
1867
|
+
r.baseCommit===d.baseCommit&&r.canonicalCommit===b&&r.oldHead===m&&r.oldIndexTree===h)&&(!o||Object.entries($).some(([k,
|
|
1868
|
+
te])=>o[k]!==te)))throw w("The project history was rewritten. Open Repository, check for updates, then review and reconc\
|
|
1869
|
+
ile this session.","vibe64_session_history_review_required")}let y=await bs(l,d,{baseCommit:d.baseCommit,canonicalCommit:b,
|
|
1870
|
+
sessionHead:m,worktreeTree:p,reconcileHistory:T},{commandOptions:t,project:a}),A=new Set(Un(n)),R=y.changedPaths.filter(
|
|
1871
|
+
$=>!A.has($)),S=await Re(l,d,b,m,{commandOptions:t,project:a});if(S&&!T)return{baseCommit:d.baseCommit,canonicalCommit:b,
|
|
1872
|
+
canonicalTree:y.canonicalTree,changeBaseCommit:y.changeBaseCommit,checkpointCommit:f,checkpointTree:p,currentTree:p,ok:!0,
|
|
1873
|
+
operationId:s,mode:d.mode,reconciled:!0,repositoryMode:d.mode,sessionCurrent:S,sessionMatchesCanonical:y.sessionMatchesCanonical,
|
|
1874
|
+
status:"already_current"};let x=y.canonicalTree;if(R.length){let $=await _s(l,d,{commandOptions:t,derivedArtifactPaths:n,
|
|
1875
|
+
project:a,sourceCommit:b,tree:p}),M=await Tp(l,d,{baseCommit:y.changeBaseCommit,explicitBase:T,canonicalCommit:b,checkpointTree:$,
|
|
1876
|
+
commandOptions:t,identity:_,project:a}),k=M.conflictPaths.length>0?{baseCommit:y.changeBaseCommit,canonicalCommit:b,checkpointTree:p,
|
|
1877
|
+
conflictPaths:M.conflictPaths,conflictTree:M.conflictTree,oldHead:m,oldIndexTree:h,reviewId:pe.randomUUID()}:null;x=k?await Wv(
|
|
1878
|
+
l,d,{currentRecovery:k,previousRecovery:r,reviewedConflictId:c,project:a}):M.mergedTree}return{...e,baseCommit:d.baseCommit,
|
|
1879
|
+
canonicalCommit:b,canonicalTree:y.canonicalTree,changeBaseCommit:y.changeBaseCommit,mergedSourceTree:x,mode:d.mode,operationId:s,
|
|
1880
|
+
repositoryMode:d.mode,sessionCurrent:!0,...R.length?{}:{sessionMatchesCanonical:!0},status:"prepared"}}async function Cp({
|
|
1881
|
+
commandOptions:e={},derivedArtifactPaths:t=[],identity:r={},prepared:n={},project:o={},refreshDerivedArtifacts:i=null,runCommand:s=D,
|
|
1882
|
+
session:a={}}={}){let c=X(a,o),l={email:E(r.email)||"vibe64@localhost",name:E(r.name)||"Vibe64 Update"},u=await Bn(s,c,{
|
|
1883
|
+
baseCommit:n.canonicalCommit,commandOptions:e,derivedArtifactPaths:t,identity:l,project:o,refreshDerivedArtifacts:i,tree:n.
|
|
1884
|
+
mergedSourceTree}),d=u===n.canonicalTree?n.canonicalCommit:await Fn(s,c,{baseCommit:n.canonicalCommit,commandOptions:e,identity:l,
|
|
1885
|
+
message:"Vibe64 session update result",project:o,tree:u});return{...n,mergedCommit:d,mergedTree:u}}async function xp({commandOptions:e={},
|
|
1886
|
+
prepared:t={},project:r={},runCommand:n=D,session:o={}}={}){let i=X(o,r),s=await Xv(n,i,{...t,commandOptions:e,project:r});
|
|
1887
|
+
return{...t,ok:!0,...s}}async function Jv(e,t,{checkpointCommit:r,checkpointTree:n,commandOptions:o,project:i,saveCommit:s,sessionHead:a=""}){let[
|
|
1888
|
+
c,l,u]=await Promise.all([ae({baseCommit:"HEAD",project:ee(t,i),runCommand:e,worktreePath:t.worktreePath}),P(e,t,["rev-p\
|
|
1889
|
+
arse","HEAD"],{commandOptions:o,project:i}),bt(e,t,s,{commandOptions:o,project:i})]);if(l===s)return{currentTree:c,reconciled:!0,
|
|
1890
|
+
status:"saved"};if(a&&l!==a)return{currentTree:c,reconciled:!1,status:"published_needs_reconcile"};let d=c!==n&&c!==u,f=await P(
|
|
1891
|
+
e,t,["write-tree"],{commandOptions:o,project:i});try{return d?(await I(e,t,["read-tree",r],{commandOptions:o,project:i}),
|
|
1892
|
+
await I(e,t,["read-tree","-m","-u",r,s],{commandOptions:o,project:i})):await I(e,t,["read-tree","--reset","-u",s],{commandOptions:o,
|
|
1893
|
+
project:i}),await I(e,t,["update-ref","HEAD",s,l],{commandOptions:o,project:i}),{currentTree:c,reconciled:!0,status:"sav\
|
|
1894
|
+
ed"}}catch(p){return d||await I(e,t,["read-tree","--reset","-u",r],{commandOptions:o,project:i,required:!1}),await I(e,t,
|
|
1895
|
+
["read-tree",f],{commandOptions:o,project:i,required:!1}),{currentTree:c,error:E(p?.message||p),reconciled:!1,status:"pu\
|
|
1896
|
+
blished_needs_reconcile"}}}async function kp(e,t,{commandOptions:r={},operationId:n,project:o={}}={}){await Gn(e,t,{commandOptions:r,
|
|
1897
|
+
project:o});let i=await kn({outerTurnId:`save:${n}`,outcome:"completed",project:ee(t,o),runCommand:e,sessionId:t.sessionId,
|
|
1898
|
+
timestamp:new Date().toISOString(),worktreePath:t.worktreePath}),s=await P(e,t,["rev-parse","--verify","HEAD^{commit}"],
|
|
1704
1899
|
{commandOptions:r,project:o});return{baseCommit:t.baseCommit,branch:t.branch,checkpointCommit:i.commit,checkpointTree:i.
|
|
1705
|
-
tree,mode:t.mode,operationId:n,sessionHead:s}}async function
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
derivedArtifactPaths:
|
|
1709
|
-
totalCount)throw
|
|
1710
|
-
async function
|
|
1711
|
-
if(!s||!a||
|
|
1712
|
-
e,t,s,{commandOptions:n,project:i})!==a)throw
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
commandOptions:n={},
|
|
1717
|
-
let
|
|
1718
|
-
|
|
1719
|
-
project:
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
reconciledCommit:t.baseCommit,updateRequired:!0});
|
|
1723
|
-
worktreeTree:
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
e,t,{
|
|
1727
|
-
e,t,{
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1900
|
+
tree,mode:t.mode,operationId:n,sessionHead:s}}async function Np({commandOptions:e={},connectedWorkSnapshots:t=[],derivedArtifactPaths:r=[],
|
|
1901
|
+
limit:n=40,operationId:o=pe.randomUUID(),project:i={},runCommand:s=D,session:a={}}={}){let c=X(a,i);s=ye(s,c,i,{label:"C\
|
|
1902
|
+
apturing work for Save",operationId:o});let l=await kp(s,c,{commandOptions:e,operationId:o,project:i}),u=await ws({commandOptions:e,
|
|
1903
|
+
derivedArtifactPaths:r,includeInitialDiff:!1,limit:n,project:i,runCommand:s,session:a,worktreeTree:l.checkpointTree});if(!u.
|
|
1904
|
+
totalCount)throw await Ss(s,c,{commandOptions:e,connectedWorkSnapshots:Ip(t),project:i}),w("This session has no work to \
|
|
1905
|
+
save.","vibe64_session_save_no_changes");return{changes:u,checkpoint:l}}async function Zv(e,t,r,{commandOptions:n={},operationId:o,
|
|
1906
|
+
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 bt(e,t,s,{commandOptions:n,project:i})!==a)throw w("Sa\
|
|
1908
|
+
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 P(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:n,project:i}):"";if(l&&u!==l)throw w(
|
|
1910
|
+
"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 Qv(e,t,{checkpoint:r={},commandOptions:n={},connectedWorkSnapshots:o=[],derivedArtifactPaths:i=[],
|
|
1912
|
+
identity:s={},message:a="",operationId:c,project:l={},refreshDerivedArtifacts:u=null}={}){let d=E(r.checkpointTree),[f,p]=await Promise.
|
|
1913
|
+
all([vp(e,t,c,{commandOptions:n,project:l}),P(e,t,["rev-parse","--verify","HEAD^{commit}"],{commandOptions:n,project:l})]);
|
|
1914
|
+
if((await I(e,t,["merge-base","--is-ancestor",t.baseCommit,f],{commandOptions:n,project:l,required:!1}))?.ok!==!0)throw w(
|
|
1915
|
+
"Canonical history no longer descends from this session's saved base.","vibe64_session_save_history_diverged");let h=await Re(
|
|
1916
|
+
e,t,f,p,{commandOptions:n,project:l});if(f!==t.baseCommit&&!h)throw w("The saved branch has changed. Update this session\
|
|
1917
|
+
before saving its work.","vibe64_session_save_update_required",{canonicalCommit:f,reconciledCommit:t.baseCommit,updateRequired:!0});
|
|
1918
|
+
let _=await bs(e,t,{baseCommit:t.baseCommit,canonicalCommit:f,sessionHead:p,worktreeTree:d},{commandOptions:n,project:l}),
|
|
1919
|
+
b=new Set(Un(i)),g=_.changedPaths.filter(x=>!b.has(x));if(!g.length)throw await Ss(e,t,{commandOptions:n,connectedWorkSnapshots:o,
|
|
1920
|
+
project:l}),w("This session has no work to save.","vibe64_session_save_no_changes");let T={email:E(s.email)||"vibe64@loc\
|
|
1921
|
+
alhost",name:E(s.name)||"Vibe64 Save"},y=await _s(e,t,{commandOptions:n,derivedArtifactPaths:i,project:l,sourceCommit:f,
|
|
1922
|
+
tree:d}),A=await Bn(e,t,{baseCommit:f,commandOptions:n,derivedArtifactPaths:i,identity:T,project:l,refreshDerivedArtifacts:u,
|
|
1923
|
+
tree:y}),R=await qv(e,t,{canonicalCommit:f,commandOptions:n,identity:T,mergedTree:A,message:a,project:l}),S=await Fv(e,t,
|
|
1924
|
+
c,R,{commandOptions:n,project:l});return{canonicalCommit:f,changeBaseCommit:_.changeBaseCommit,changedPaths:g,mergedTree:A,
|
|
1925
|
+
preparedRef:S,saveCommit:R}}async function eT(e,t,{commandOptions:r={},connectedWorkSnapshots:n=[],onPublicationAttempt:o,
|
|
1926
|
+
prepared:i={},project:s={}}={}){return Yv(e,t,E(i.saveCommit),E(i.canonicalCommit),{commandOptions:r,connectedWorkSnapshots:n,
|
|
1927
|
+
onPublicationAttempt:o,project:s})}function tT(e,t,r,n,o){return{baseCommit:e.baseCommit,cacheMaintenance:o.cacheMaintenance,
|
|
1731
1928
|
canonicalCommit:r.canonicalCommit,changeBaseCommit:r.changeBaseCommit,changedPaths:r.changedPaths,checkpointCommit:t.checkpointCommit,
|
|
1732
1929
|
checkpointTree:t.checkpointTree,mergedTree:r.mergedTree,mode:e.mode,ok:!0,operationId:t.operationId,preparedRef:r.preparedRef,
|
|
1733
|
-
saveCommit:r.saveCommit,sessionHead:t.sessionHead,status:o.status,verifiedCommit:n,...o}}function
|
|
1734
|
-
|
|
1735
|
-
status:"deferred",verifiedCommit:t}}async function
|
|
1736
|
-
let s=
|
|
1737
|
-
project:r})}async function
|
|
1738
|
-
deferCacheMaintenance:
|
|
1739
|
-
|
|
1740
|
-
let
|
|
1741
|
-
|
|
1742
|
-
checkpoint",message:"Capturing the complete session worktree.",mode:
|
|
1743
|
-
(await
|
|
1744
|
-
{commandOptions:t,operationId:
|
|
1745
|
-
kind:"checkpoint",message:"Session checkpoint captured.",stage:"checkpointed"}),await
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
kind:"canonical",message:"Canonical branch read.",stage:"
|
|
1749
|
-
kind:"publish",mergedTree:
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
return
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
e
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
t
|
|
1767
|
-
|
|
1768
|
-
|
|
1930
|
+
saveCommit:r.saveCommit,sessionHead:t.sessionHead,status:o.status,verifiedCommit:n,...o}}function rT(e,t){return e.mode!==
|
|
1931
|
+
K?{attempted:!1,kind:"none",retryable:!1,status:"not_applicable"}:{attempted:!1,branch:e.branch,kind:"github_mirror",retryable:!1,
|
|
1932
|
+
status:"deferred",verifiedCommit:t}}async function vs({commandOptions:e={},operationId:t="",project:r={},runCommand:n=D,session:o={},verifiedCommit:i=""}={}){
|
|
1933
|
+
let s=X(o,r);return n=ye(n,s,r,{label:"Maintaining saved repository cache",operationId:t}),Kv(n,s,E(i),{commandOptions:e,
|
|
1934
|
+
project:r})}async function nT(e,t,r,n={}){E(r)&&await yt(e,t,Sp(t,r),n)}async function $p({checkpoint:e=null,commandOptions:t={},
|
|
1935
|
+
connectedWorkSnapshots:r=[],deferCacheMaintenance:n=!1,derivedArtifactPaths:o=[],identity:i={},message:s="",operationId:a=pe.
|
|
1936
|
+
randomUUID(),project:c={},refreshDerivedArtifacts:l=null,runCommand:u=D,runProjectSourceExclusive:d=async m=>m(),onProgress:f=async()=>null,
|
|
1937
|
+
session:p={}}={}){let m=X(p,c),h=Ip(r);return u=ye(u,m,c,{label:"Saving session work",operationId:a}),await f({kind:"loc\
|
|
1938
|
+
k",message:"Waiting for exclusive repository access.",stage:"repository-lock"}),d(async()=>{await f({baseCommit:m.baseCommit,
|
|
1939
|
+
branch:m.branch,kind:"checkpoint",message:"Capturing the complete session worktree.",mode:m.mode,operationId:a,stage:"ch\
|
|
1940
|
+
eckpointing"});let _;e?(await Gn(u,m,{commandOptions:t,project:c}),_=await Zv(u,m,e,{commandOptions:t,operationId:a,project:c})):
|
|
1941
|
+
_=await kp(u,m,{commandOptions:t,operationId:a,project:c}),await f({checkpointCommit:_.checkpointCommit,checkpointTree:_.
|
|
1942
|
+
checkpointTree,kind:"checkpoint",message:"Session checkpoint captured.",stage:"checkpointed"}),await f({kind:"canonical",
|
|
1943
|
+
message:"Reading the current canonical branch.",stage:"canonical-reading"});let b=await Qv(u,m,{checkpoint:_,commandOptions:t,
|
|
1944
|
+
connectedWorkSnapshots:h,derivedArtifactPaths:o,identity:i,message:s,operationId:a,project:c,refreshDerivedArtifacts:l}),
|
|
1945
|
+
g=!1,T;try{await f({expectedCanonicalCommit:b.canonicalCommit,kind:"canonical",message:"Canonical branch read.",stage:"c\
|
|
1946
|
+
anonical-read"}),await f({expectedCanonicalCommit:b.canonicalCommit,kind:"publish",mergedTree:b.mergedTree,message:"Save\
|
|
1947
|
+
commit prepared.",proposedCommit:b.saveCommit,stage:"prepared"}),await f({kind:"publish",message:"Publishing one ordina\
|
|
1948
|
+
ry Save commit.",stage:"publishing"}),T=await eT(u,m,{commandOptions:t,connectedWorkSnapshots:h,onPublicationAttempt(){g=
|
|
1949
|
+
!0},prepared:b,project:c})}catch(R){throw g||await I(u,m,["update-ref","-d",b.preparedRef,b.saveCommit],{commandOptions:t,
|
|
1950
|
+
project:c}),R}await f({kind:"publish",message:"Canonical Save commit verified.",stage:"published",verifiedCommit:T}),await f(
|
|
1951
|
+
{kind:"reconcile",message:"Reconciling the session onto the saved commit.",stage:"reconciling"});let y=await Jv(u,m,{checkpointCommit:_.
|
|
1952
|
+
checkpointCommit,checkpointTree:_.checkpointTree,commandOptions:t,project:c,saveCommit:b.saveCommit,sessionHead:_.sessionHead}),
|
|
1953
|
+
A=n?rT(m,T):await vs({commandOptions:t,operationId:a,project:c,runCommand:u,session:p,verifiedCommit:T});return A.retryable===
|
|
1954
|
+
!0&&await f({cacheMaintenance:A,kind:"cache-warning",message:A.message,stage:"cache-maintenance-warning"}),n||await nT(u,
|
|
1955
|
+
m,a,{commandOptions:t,project:c}),tT(m,_,b,T,{cacheMaintenance:A,...y})},{operation:`save-session:${m.sessionId}`})}var sT=1024*1024,aT={incoming:Dn,"incoming-change":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");
|
|
1956
|
+
return mp({...e,refreshDerivedArtifacts:t})},"change-diff":_p,changes:ws,"check-updates":Pp,save:async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");
|
|
1957
|
+
return $p({...e,deferCacheMaintenance:!0,refreshDerivedArtifacts:t})},"save-maintenance":vs,"save-message":async e=>{if(e.
|
|
1958
|
+
derivedArtifactPaths?.length&&oT(iT.join(e.session.sourcePath,"genesis/blueprint.md"))){let{inspectGenesisStackComponents:t}=await import("@local/vibe64-genesis/server");
|
|
1959
|
+
await t({projectRoot:e.session.sourcePath})}return Np(e)},work:zn,"update-checkpoint":Es,"update-prepare":Op,"update-der\
|
|
1960
|
+
ived":async e=>{let{refreshGenesisCities:t}=await import("@local/vibe64-genesis/server");return Cp({...e,refreshDerivedArtifacts:t})},
|
|
1961
|
+
"update-apply":xp};function cT(e={}){return De(e.command,e.args,{cwd:e.cwd,env:{...process.env,...e.env||{}},execution:e.
|
|
1962
|
+
execution,input:e.input,maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,timeout:e.timeout})}async function lT(){let e="";
|
|
1963
|
+
for await(let t of process.stdin)if(e+=String(t||""),Buffer.byteLength(e)>sT)throw new Error("Session repository operati\
|
|
1964
|
+
on input is too large.");return JSON.parse(e||"{}")}function uT(e){return{error:{code:String(e?.code||"vibe64_session_wo\
|
|
1965
|
+
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 lT(),t=aT[String(e?.operation||"")];if(!t){let n=new Error(
|
|
1967
|
+
"Unsupported session repository operation.");throw n.code="vibe64_session_work_operation_unsupported",n}let r=await t({...e.
|
|
1968
|
+
input&&typeof e.input=="object"?e.input:{},runCommand:cT});process.stdout.write(JSON.stringify({ok:!0,value:r}))}catch(e){
|
|
1969
|
+
process.stdout.write(JSON.stringify(uT(e))),process.exitCode=1}
|