vibe64 0.1.68 → 0.1.70
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 +1131 -1130
- package/bin/server.js +50 -50
- package/bin/upgrade-state.js +2777 -2784
- package/dist/assets/GithubBrowserTabs-D8twaXtF.js +1 -0
- package/dist/assets/GithubBrowserTabs-D8twaXtF.js.br +0 -0
- package/dist/assets/GithubBrowserTabs-D8twaXtF.js.gz +0 -0
- package/dist/assets/LocalDatabaseServer-BQM5W9GA.css.br +0 -0
- package/dist/assets/LocalDatabaseServer-BQM5W9GA.css.gz +0 -0
- package/dist/assets/{LocalDatabaseServer-DYh3UF9q.js → LocalDatabaseServer-BjJgeNye.js} +1 -1
- package/dist/assets/LocalDatabaseServer-BjJgeNye.js.br +0 -0
- package/dist/assets/LocalDatabaseServer-BjJgeNye.js.gz +0 -0
- package/dist/assets/Vibe64DashboardPageHeader-2JX76yfq.css.br +0 -0
- package/dist/assets/Vibe64DashboardPageHeader-2JX76yfq.css.gz +0 -0
- package/dist/assets/Vibe64DashboardPageHeader-Bd4WMiDV.js +1 -0
- package/dist/assets/Vibe64DashboardPageHeader-Bd4WMiDV.js.br +0 -0
- package/dist/assets/Vibe64DashboardPageHeader-Bd4WMiDV.js.gz +0 -0
- package/dist/assets/{Vibe64DatabaseWorkspace-8i-RDc9y.js → Vibe64DatabaseWorkspace-CprnbQkL.js} +1 -1
- package/dist/assets/Vibe64DatabaseWorkspace-CprnbQkL.js.br +0 -0
- package/dist/assets/Vibe64DatabaseWorkspace-CprnbQkL.js.gz +0 -0
- package/dist/assets/Vibe64DatabaseWorkspace-De4sbXAN.css.br +0 -0
- package/dist/assets/Vibe64DatabaseWorkspace-De4sbXAN.css.gz +0 -0
- package/dist/assets/Vibe64FileArea-CcKMG84N.js +1 -0
- package/dist/assets/Vibe64FileArea-CcKMG84N.js.br +0 -0
- package/dist/assets/Vibe64FileArea-CcKMG84N.js.gz +0 -0
- package/dist/assets/Vibe64FileArea-ZEzsvLt2.css.br +0 -0
- package/dist/assets/Vibe64FileArea-ZEzsvLt2.css.gz +0 -0
- package/dist/assets/Vibe64OutputControls-D0l0i_kq.js +8 -0
- package/dist/assets/Vibe64OutputControls-D0l0i_kq.js.br +0 -0
- package/dist/assets/Vibe64OutputControls-D0l0i_kq.js.gz +0 -0
- package/dist/assets/Vibe64OutputControls-aQCEvUL2.css.br +0 -0
- package/dist/assets/Vibe64OutputControls-aQCEvUL2.css.gz +0 -0
- package/dist/assets/Vibe64RepositoryWorkspace-BWu6OV32.css.br +0 -0
- package/dist/assets/Vibe64RepositoryWorkspace-BWu6OV32.css.gz +0 -0
- package/dist/assets/{Vibe64RepositoryWorkspace-D6uJCype.js → Vibe64RepositoryWorkspace-EkT8pmMV.js} +1 -1
- package/dist/assets/Vibe64RepositoryWorkspace-EkT8pmMV.js.br +0 -0
- package/dist/assets/Vibe64RepositoryWorkspace-EkT8pmMV.js.gz +0 -0
- package/dist/assets/Vibe64SessionFiles-Qk_kv1Q8.js +1 -0
- package/dist/assets/Vibe64SessionFiles-Qk_kv1Q8.js.br +0 -0
- package/dist/assets/Vibe64SessionFiles-Qk_kv1Q8.js.gz +0 -0
- package/dist/assets/Vibe64SessionSourceEditor-l0R5uY2U.css.br +0 -0
- package/dist/assets/Vibe64SessionSourceEditor-l0R5uY2U.css.gz +0 -0
- package/dist/assets/{Vibe64SessionSourceEditor-Bws5ihr-.js → Vibe64SessionSourceEditor-oYTMnob5.js} +1 -1
- package/dist/assets/Vibe64SessionSourceEditor-oYTMnob5.js.br +0 -0
- package/dist/assets/Vibe64SessionSourceEditor-oYTMnob5.js.gz +0 -0
- package/dist/assets/Vibe64UiStoryboardView-BZh1b5Xt.js +8 -0
- package/dist/assets/Vibe64UiStoryboardView-BZh1b5Xt.js.br +0 -0
- package/dist/assets/Vibe64UiStoryboardView-BZh1b5Xt.js.gz +0 -0
- package/dist/assets/Vibe64UiStoryboardView-DqLN6ofL.css.br +0 -0
- package/dist/assets/Vibe64UiStoryboardView-DqLN6ofL.css.gz +0 -0
- package/dist/assets/_pageId_-xB2NWBqF.js +1 -0
- package/dist/assets/_sessionId_-7PyIUeUr.css.br +0 -0
- package/dist/assets/_sessionId_-7PyIUeUr.css.gz +0 -0
- package/dist/assets/_sessionId_-g78evnUW.js +1 -0
- package/dist/assets/_sessionId_-g78evnUW.js.br +0 -0
- package/dist/assets/_sessionId_-g78evnUW.js.gz +0 -0
- package/dist/assets/_sessionTool_-cw3WaYPb.js +1 -0
- package/dist/assets/access-BH1OsqPS.css.br +3 -0
- package/dist/assets/access-BH1OsqPS.css.gz +0 -0
- package/dist/assets/access-oIeDSza-.js +1 -0
- package/dist/assets/access-oIeDSza-.js.br +0 -0
- package/dist/assets/access-oIeDSza-.js.gz +0 -0
- package/dist/assets/addon-fit-Bw0lQv9_.js.br +0 -0
- package/dist/assets/addon-fit-Bw0lQv9_.js.gz +0 -0
- package/dist/assets/apollo-io-DSa-SGjz.svg.br +0 -0
- package/dist/assets/apollo-io-DSa-SGjz.svg.gz +0 -0
- package/dist/assets/app-0jq6SFSn.js +1 -0
- package/dist/assets/app-0jq6SFSn.js.br +0 -0
- package/dist/assets/app-0jq6SFSn.js.gz +0 -0
- package/dist/assets/asana--NYpVJKi.ico.br +0 -0
- package/dist/assets/asana--NYpVJKi.ico.gz +0 -0
- package/dist/assets/atlassian-DlYQurNH.ico.br +0 -0
- package/dist/assets/atlassian-DlYQurNH.ico.gz +0 -0
- package/dist/assets/aws-athena-iyRsleas.svg.br +0 -0
- package/dist/assets/aws-athena-iyRsleas.svg.gz +0 -0
- package/dist/assets/changes-Db1dzMsx.js +1 -0
- package/dist/assets/client-DW9uggbF.js +2 -0
- package/dist/assets/client-DW9uggbF.js.br +0 -0
- package/dist/assets/client-DW9uggbF.js.gz +0 -0
- package/dist/assets/client-Lmbw-Ygm.js +2 -0
- package/dist/assets/client-Lmbw-Ygm.js.br +0 -0
- package/dist/assets/client-Lmbw-Ygm.js.gz +0 -0
- package/dist/assets/dashboard-CUnY0-1W.js +1 -0
- package/dist/assets/dist-CDa9Iec1.js.br +0 -0
- package/dist/assets/dist-CDa9Iec1.js.gz +0 -0
- package/dist/assets/elk-worker.min-CBpdZsm8.js.br +0 -0
- package/dist/assets/elk-worker.min-CBpdZsm8.js.gz +0 -0
- package/dist/assets/english-definitions-DovEdEkp.js +1 -0
- package/dist/assets/english-definitions-DovEdEkp.js.br +0 -0
- package/dist/assets/english-definitions-DovEdEkp.js.gz +0 -0
- package/dist/assets/env-CZritO-9.js +1 -0
- package/dist/assets/env-CZritO-9.js.br +0 -0
- package/dist/assets/env-CZritO-9.js.gz +0 -0
- package/dist/assets/env-i_R_LXlE.css.br +0 -0
- package/dist/assets/env-i_R_LXlE.css.gz +0 -0
- package/dist/assets/erdLayout.worker-B_1U21gv.js.br +0 -0
- package/dist/assets/erdLayout.worker-B_1U21gv.js.gz +0 -0
- package/dist/assets/error-o4gXqrKI.js +1 -0
- package/dist/assets/error-o4gXqrKI.js.br +0 -0
- package/dist/assets/error-o4gXqrKI.js.gz +0 -0
- package/dist/assets/favicon-DXB1SVqU.svg +20 -0
- package/dist/assets/favicon-DXB1SVqU.svg.br +0 -0
- package/dist/assets/favicon-DXB1SVqU.svg.gz +0 -0
- package/dist/assets/fileTypes-Bqlch7JV.js +1 -0
- package/dist/assets/fileTypes-Bqlch7JV.js.br +0 -0
- package/dist/assets/fileTypes-Bqlch7JV.js.gz +0 -0
- package/dist/assets/fileTypes-c-LysNzr.css.br +0 -0
- package/dist/assets/fileTypes-c-LysNzr.css.gz +0 -0
- package/dist/assets/firecrawl-C0P1e2_8.ico.br +0 -0
- package/dist/assets/firecrawl-C0P1e2_8.ico.gz +0 -0
- package/dist/assets/granola-7dR8tPQ_.svg.br +0 -0
- package/dist/assets/granola-7dR8tPQ_.svg.gz +0 -0
- package/dist/assets/health-LP0Mz2qB.js +1 -0
- package/dist/assets/health-LP0Mz2qB.js.br +0 -0
- package/dist/assets/health-LP0Mz2qB.js.gz +0 -0
- package/dist/assets/health-xnU0lci9.css.br +0 -0
- package/dist/assets/health-xnU0lci9.css.gz +0 -0
- package/dist/assets/heygen-CeXJ1Sy4.ico.br +0 -0
- package/dist/assets/heygen-CeXJ1Sy4.ico.gz +0 -0
- package/dist/assets/history-BSIuLgnI.css.br +0 -0
- package/dist/assets/history-BSIuLgnI.css.gz +0 -0
- package/dist/assets/history-DkjaInmh.js +1 -0
- package/dist/assets/history-DkjaInmh.js.br +0 -0
- package/dist/assets/history-DkjaInmh.js.gz +0 -0
- package/dist/assets/index-C_LlHM8w.js +174 -0
- package/dist/assets/index-C_LlHM8w.js.br +0 -0
- package/dist/assets/index-C_LlHM8w.js.gz +0 -0
- package/dist/assets/index-aW7ceIaR.css +1 -0
- package/dist/assets/index-aW7ceIaR.css.br +0 -0
- package/dist/assets/index-aW7ceIaR.css.gz +0 -0
- package/dist/assets/{integrations-Ccb8EOEO.js → integrations-C6_N7WwF.js} +2 -3
- package/dist/assets/integrations-C6_N7WwF.js.br +0 -0
- package/dist/assets/integrations-C6_N7WwF.js.gz +0 -0
- package/dist/assets/integrations-sQuGZtOl.css +1 -0
- package/dist/assets/integrations-sQuGZtOl.css.br +0 -0
- package/dist/assets/integrations-sQuGZtOl.css.gz +0 -0
- package/dist/assets/issues-D46llNv-.css.br +0 -0
- package/dist/assets/issues-D46llNv-.css.gz +0 -0
- package/dist/assets/issues-DAJzymvp.js +1 -0
- package/dist/assets/issues-DAJzymvp.js.br +0 -0
- package/dist/assets/issues-DAJzymvp.js.gz +0 -0
- package/dist/assets/klipy-DId2OM2v.ico.br +0 -0
- package/dist/assets/klipy-DId2OM2v.ico.gz +0 -0
- package/dist/assets/learning-6W-aGxBH.js +1 -0
- package/dist/assets/libesm-CR-iGldz.js.br +0 -0
- package/dist/assets/libesm-CR-iGldz.js.gz +0 -0
- package/dist/assets/mailgun-jMUCQaNg.ico.br +0 -0
- package/dist/assets/mailgun-jMUCQaNg.ico.gz +0 -0
- package/dist/assets/microsoft-fabric-CkTccQJB.svg.br +0 -0
- package/dist/assets/microsoft-fabric-CkTccQJB.svg.gz +0 -0
- package/dist/assets/n8n-CViEi-uo.ico.br +0 -0
- package/dist/assets/n8n-CViEi-uo.ico.gz +0 -0
- package/dist/assets/paddle-PTFXjZtt.ico.br +0 -0
- package/dist/assets/paddle-PTFXjZtt.ico.gz +0 -0
- package/dist/assets/pages-BePUPkVf.js +1 -0
- package/dist/assets/pages-C31UYhFG.js +1 -0
- package/dist/assets/pages-C31UYhFG.js.br +0 -0
- package/dist/assets/pages-C31UYhFG.js.gz +0 -0
- package/dist/assets/perplexity-CwIseVmg.ico.br +0 -0
- package/dist/assets/perplexity-CwIseVmg.ico.gz +0 -0
- package/dist/assets/placementTopology-CDhUIK6L.js.br +0 -0
- package/dist/assets/placementTopology-CDhUIK6L.js.gz +0 -0
- package/dist/assets/prestashop-BQtyl3tL.ico.br +0 -0
- package/dist/assets/prestashop-BQtyl3tL.ico.gz +0 -0
- package/dist/assets/project-Bw_8Bd8D.js +21 -0
- package/dist/assets/project-Bw_8Bd8D.js.br +0 -0
- package/dist/assets/project-Bw_8Bd8D.js.gz +0 -0
- package/dist/assets/project-DTGwAgqm.css +1 -0
- package/dist/assets/project-DTGwAgqm.css.br +0 -0
- package/dist/assets/project-DTGwAgqm.css.gz +0 -0
- package/dist/assets/project-files-CdcCb8jL.js +1 -0
- package/dist/assets/project-files-CdcCb8jL.js.br +0 -0
- package/dist/assets/project-files-CdcCb8jL.js.gz +0 -0
- package/dist/assets/project-shared-ShellOutlet-CVomMDvt.js +5 -0
- package/dist/assets/project-shared-ShellOutlet-CVomMDvt.js.br +0 -0
- package/dist/assets/project-shared-ShellOutlet-CVomMDvt.js.gz +0 -0
- package/dist/assets/project-shared-ShellOutlet-DfKYI6ZS.css.br +0 -0
- package/dist/assets/project-shared-ShellOutlet-DfKYI6ZS.css.gz +0 -0
- package/dist/assets/project-shared-VBottomSheet-BEV2Ihna.css.br +0 -0
- package/dist/assets/project-shared-VBottomSheet-BEV2Ihna.css.gz +0 -0
- package/dist/assets/project-shared-VBottomSheet-Bu53ETe9.js +1 -0
- package/dist/assets/project-shared-VBottomSheet-Bu53ETe9.js.br +0 -0
- package/dist/assets/project-shared-VBottomSheet-Bu53ETe9.js.gz +0 -0
- package/dist/assets/project-shared-VToolbar-Bd4xlEK-.js +1 -0
- package/dist/assets/project-shared-VToolbar-Bd4xlEK-.js.br +0 -0
- package/dist/assets/project-shared-VToolbar-Bd4xlEK-.js.gz +0 -0
- package/dist/assets/project-shared-VToolbar-CY3-1Sb0.css.br +0 -0
- package/dist/assets/project-shared-VToolbar-CY3-1Sb0.css.gz +0 -0
- package/dist/assets/project-shared-pageNames-BVgvVg71.js +1 -0
- package/dist/assets/project-shared-pageNames-BVgvVg71.js.br +0 -0
- package/dist/assets/project-shared-pageNames-BVgvVg71.js.gz +0 -0
- package/dist/assets/publish-BIY5aZgD.css +1 -0
- package/dist/assets/publish-BIY5aZgD.css.br +0 -0
- package/dist/assets/publish-BIY5aZgD.css.gz +0 -0
- package/dist/assets/publish-a6jL_LlB.js +3 -0
- package/dist/assets/publish-a6jL_LlB.js.br +0 -0
- package/dist/assets/publish-a6jL_LlB.js.gz +0 -0
- package/dist/assets/pull-requests-DoyqPC5b.js +1 -0
- package/dist/assets/pull-requests-DoyqPC5b.js.br +0 -0
- package/dist/assets/pull-requests-DoyqPC5b.js.gz +0 -0
- package/dist/assets/repository-MUZOzMUA.js +1 -0
- package/dist/assets/salesforce-aAWnuvNz.ico.br +3 -0
- package/dist/assets/salesforce-aAWnuvNz.ico.gz +0 -0
- package/dist/assets/sentry-Y4ADGpgF.ico.br +0 -0
- package/dist/assets/sentry-Y4ADGpgF.ico.gz +0 -0
- package/dist/assets/session-BJhq3K2n.css.br +0 -0
- package/dist/assets/session-BJhq3K2n.css.gz +0 -0
- package/dist/assets/session-CtbSoHK-.js +1 -0
- package/dist/assets/session-CtbSoHK-.js.br +0 -0
- package/dist/assets/session-CtbSoHK-.js.gz +0 -0
- package/dist/assets/settings-BKZcbISO.css.br +0 -0
- package/dist/assets/settings-BKZcbISO.css.gz +0 -0
- package/dist/assets/settings-BdbR3bEK.js +1 -0
- package/dist/assets/settings-BdbR3bEK.js.br +0 -0
- package/dist/assets/settings-BdbR3bEK.js.gz +0 -0
- package/dist/assets/snowflake-CP8ObIkg.svg.br +0 -0
- package/dist/assets/snowflake-CP8ObIkg.svg.gz +0 -0
- package/dist/assets/useArchivedVibe64Sessions-DXTj9b9K.js +1 -0
- package/dist/assets/useArchivedVibe64Sessions-DXTj9b9K.js.br +0 -0
- package/dist/assets/useArchivedVibe64Sessions-DXTj9b9K.js.gz +0 -0
- package/dist/assets/vibe64AttachmentDownload-BODXLh6N.js +1 -0
- package/dist/assets/vibe64SavedEnvValues-BbuzhsJf.js +1 -0
- package/dist/assets/{vue-flow-core-jvy5apgY.js → vue-flow-core-6H3SH19E.js} +1 -1
- package/dist/assets/vue-flow-core-6H3SH19E.js.br +0 -0
- package/dist/assets/vue-flow-core-6H3SH19E.js.gz +0 -0
- package/dist/assets/workday-Ds_SFYKi.ico.br +0 -0
- package/dist/assets/workday-Ds_SFYKi.ico.gz +0 -0
- package/dist/assets/xterm-BrP-ENHg.css.br +0 -0
- package/dist/assets/xterm-BrP-ENHg.css.gz +0 -0
- package/dist/assets/xterm-CXJQiF67.js.br +0 -0
- package/dist/assets/xterm-CXJQiF67.js.gz +0 -0
- package/dist/assets/zoho-crm-BRYEeDgr.ico.br +0 -0
- package/dist/assets/zoho-crm-BRYEeDgr.ico.gz +0 -0
- package/dist/index.html +59 -130
- package/docs/colleague-usage/account-profile-and-appearance.md +5 -3
- package/docs/colleague-usage/add-a-service.md +137 -0
- package/docs/colleague-usage/ai-tasks.md +3 -1
- package/docs/colleague-usage/chat-settings.md +36 -9
- package/docs/colleague-usage/colleague-watches.md +1 -1
- package/docs/colleague-usage/connected-repositories.md +4 -0
- package/docs/colleague-usage/dashboard-navigation.md +4 -4
- package/docs/colleague-usage/development-env.md +8 -1
- package/docs/colleague-usage/github-work.md +39 -5
- package/docs/colleague-usage/health-checks.md +5 -2
- package/docs/colleague-usage/publishing.md +7 -6
- package/docs/colleague-usage/running-vibe64-on-your-computer.md +9 -0
- package/docs/colleague-usage/vibe64-updates.md +10 -0
- package/node_modules/@local/vibe64-core/package.json +1 -0
- package/node_modules/@local/vibe64-execution/package.json +1 -0
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +615 -608
- package/node_modules/@local/vibe64-execution/src/server/gitTurnCheckpointCommand.js +8 -8
- package/node_modules/@local/vibe64-execution/src/server/hostProfile.js +10 -10
- package/node_modules/@local/vibe64-genesis/package.json +2 -1
- package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +148 -120
- package/node_modules/@local/vibe64-genesis/src/server/index.js +676 -579
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +74 -67
- package/node_modules/@local/vibe64-project/package.json +1 -0
- package/node_modules/@local/vibe64-source-editor/src/server/searchIndexWorker.js +50 -46
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +392 -390
- package/package.json +3 -3
- package/server.bundle.mjs +39478 -39283
- package/dist/assets/GithubBrowserTabs-CW3GBeJu.js +0 -1
- package/dist/assets/SelectField-Df50ZFLj.js +0 -1
- package/dist/assets/ShellOutlet-DkLdtzJW.js +0 -1
- package/dist/assets/StudioErrorNotice-CQfeUEOD.css +0 -1
- package/dist/assets/StudioErrorNotice-vDR4qneB.js +0 -1
- package/dist/assets/VAutocomplete-D48FgPMA.css +0 -1
- package/dist/assets/VAutocomplete-NpBcbYkR.js +0 -1
- package/dist/assets/VBtn-C1plz3b1.css +0 -1
- package/dist/assets/VBtn-Com1gNEe.js +0 -1
- package/dist/assets/VCard-DY_DdI8Z.js +0 -1
- package/dist/assets/VCard-dv-Dc592.css +0 -1
- package/dist/assets/VCheckbox-ChRKi1kj.css +0 -1
- package/dist/assets/VCheckbox-CkezAf4Z.js +0 -1
- package/dist/assets/VCheckboxBtn-8g4R-c2w.js +0 -1
- package/dist/assets/VCheckboxBtn-o1O5Bixh.css +0 -1
- package/dist/assets/VChip-4Nj-0ztL.css +0 -1
- package/dist/assets/VChip-tORFnf7z.js +0 -11
- package/dist/assets/VDialog-CapFiCqp.js +0 -1
- package/dist/assets/VDialog-DP-kc9Gx.css +0 -1
- package/dist/assets/VExpansionPanels-B6U2XdWH.js +0 -1
- package/dist/assets/VExpansionPanels-cvCWEkWz.css +0 -1
- package/dist/assets/VMenu-CO6B6LWk.js +0 -1
- package/dist/assets/VMenu-DCU7zd0B.css +0 -1
- package/dist/assets/VOverlay-CrfaXCOL.js +0 -1
- package/dist/assets/VOverlay-DG-PukqI.css +0 -1
- package/dist/assets/VRadioGroup-BrPW6foD.js +0 -1
- package/dist/assets/VRadioGroup-C9f4tbih.css +0 -1
- package/dist/assets/VRow-BdVn5u8X.css +0 -1
- package/dist/assets/VRow-DHETsEMn.js +0 -1
- package/dist/assets/VSelect-gYJ6qrBP.js +0 -1
- package/dist/assets/VSelect-yFA6_y4G.css +0 -1
- package/dist/assets/VSheet-BbLSwuzR.css +0 -1
- package/dist/assets/VSheet-_Grtwpfz.js +0 -1
- package/dist/assets/VSkeletonLoader-CQXCEJsR.js +0 -1
- package/dist/assets/VSkeletonLoader-DXZarZ9m.css +0 -1
- package/dist/assets/VSpacer-DfbUir7X.css +0 -1
- package/dist/assets/VSpacer-VLYDmg7o.js +0 -1
- package/dist/assets/VSwitch-DAlld-JI.css +0 -1
- package/dist/assets/VSwitch-ffi-Y2TU.js +0 -1
- package/dist/assets/VTable-Cver5Vl3.js +0 -1
- package/dist/assets/VTable-LbK8_KkU.css +0 -1
- package/dist/assets/VTextField-DP6b7Qaf.js +0 -1
- package/dist/assets/VTextField-F6unyhrS.css +0 -1
- package/dist/assets/VTextarea--uW4w6nq.css +0 -1
- package/dist/assets/VTextarea-7mdIF4I0.js +0 -1
- package/dist/assets/VToolbar-CYz3lneF.js +0 -1
- package/dist/assets/Vibe64AsyncModuleState-B68r3Cm5.css +0 -1
- package/dist/assets/Vibe64AsyncModuleState-CO1rMrtD.js +0 -1
- package/dist/assets/Vibe64AuthSettingsButton-Cksj7FS6.js +0 -5
- package/dist/assets/Vibe64ConversationLog-BC0eDtUP.js +0 -9
- package/dist/assets/Vibe64ConversationLog-ksf1U6PP.css +0 -1
- package/dist/assets/Vibe64DashboardPageHeader-CobvMlFm.js +0 -1
- package/dist/assets/Vibe64DashboardShell-D0GNI4V8.css +0 -1
- package/dist/assets/Vibe64DashboardShell-DX5dOXAB.js +0 -1
- package/dist/assets/Vibe64DestinationButton-B4Zz4a7J.js +0 -1
- package/dist/assets/Vibe64DestinationButton-ZxY1Lwie.css +0 -1
- package/dist/assets/Vibe64FileArea-EK5yUio3.js +0 -1
- package/dist/assets/Vibe64OutputControls--LB4G83q.js +0 -8
- package/dist/assets/Vibe64SessionFiles-DVHGc7hd.js +0 -1
- package/dist/assets/Vibe64UiStoryboardView-BmABkyG4.js +0 -8
- package/dist/assets/Vibe64UnavailableSessions-C6Bkwsqk.js +0 -1
- package/dist/assets/Vibe64UnavailableSessions-DQdNuGSD.css +0 -1
- package/dist/assets/_pageId_-FjW-3sqF.js +0 -1
- package/dist/assets/_plugin-vue_export-helper-DNW4j-dv.js +0 -1
- package/dist/assets/_sessionId_-4cH83Bfi.js +0 -1
- package/dist/assets/_sessionTool_-CBf51mfK.js +0 -1
- package/dist/assets/_slug_-Cazfy5ui.js +0 -14
- package/dist/assets/_slug_-DQDycgFK.css +0 -1
- package/dist/assets/access-mxcxtn7b.js +0 -1
- package/dist/assets/app-8zP_FAuO.js +0 -1
- package/dist/assets/assistantRouting-Bbxguvre.js +0 -3
- package/dist/assets/asyncModuleRecovery-BALhPqsY.js +0 -1
- package/dist/assets/browser-D8z6v6Ge.js +0 -1
- package/dist/assets/browserLocalStorage-B4C7rHrs.js +0 -1
- package/dist/assets/changes-cmlEyHug.js +0 -1
- package/dist/assets/client-BBJzQIWS.css +0 -1
- package/dist/assets/client-BJBzomgt.js +0 -1
- package/dist/assets/client-C1i-bIgL.js +0 -1
- package/dist/assets/client-C7yZ1hEm.js +0 -2
- package/dist/assets/client-CM6TGZc9.css +0 -1
- package/dist/assets/client-CQ49uWhR.js +0 -2
- package/dist/assets/client-D46Uu-YO.js +0 -2
- package/dist/assets/client-DKNTl1to.js +0 -2
- package/dist/assets/clipboard-CZs9aH3L.js +0 -1
- package/dist/assets/conversation-CFJRkeTj.js +0 -12
- package/dist/assets/conversation-COcuIkcD.css +0 -1
- package/dist/assets/conversation-CexAK3Qk.js +0 -1
- package/dist/assets/dashboard-CMtWKazq.js +0 -1
- package/dist/assets/deepFreeze-BgoYkoTa.js +0 -1
- package/dist/assets/devtools-CN5uWJaH-_xug6686.js +0 -1
- package/dist/assets/english-definitions-DiyU9O9D.js +0 -1
- package/dist/assets/env-LUc22Wgd.js +0 -1
- package/dist/assets/error-BccdQn04.js +0 -1
- package/dist/assets/error-DPDAz9Td.js +0 -1
- package/dist/assets/errorMessageHelpers-G32Hjqfm.js +0 -1
- package/dist/assets/errors-D17nJYne.js +0 -1
- package/dist/assets/favicon-B93tlu1U.svg +0 -7
- package/dist/assets/fileTypes-iPZyrJA1.js +0 -1
- package/dist/assets/health-CfMjMJFf.js +0 -1
- package/dist/assets/history-hX_kNskf.js +0 -1
- package/dist/assets/httpClient-C71X5grL.js +0 -1
- package/dist/assets/i18n-5EHeMSvt.js +0 -1
- package/dist/assets/i18n-BSfPKqM3.js +0 -1
- package/dist/assets/i18n-DpzQwXg6.js +0 -1
- package/dist/assets/i18n-Dq-ep9n7.js +0 -1
- package/dist/assets/index-BJWiPV6i.css +0 -1
- package/dist/assets/index-FVeEbKiO.js +0 -134
- package/dist/assets/integrations-CtnIjM1Y.css +0 -1
- package/dist/assets/issues-Bxtt7oqi.js +0 -1
- package/dist/assets/layout-DMZV-nbg.js +0 -1
- package/dist/assets/lazy-mtFmsnct.js +0 -1
- package/dist/assets/learning-BUx9jo91.js +0 -1
- package/dist/assets/linkPath-BsiibCNd.js +0 -1
- package/dist/assets/normalize-BD25VwNK.js +0 -1
- package/dist/assets/pages-5jaEclQo.js +0 -1
- package/dist/assets/pages-D43zM2UW.js +0 -1
- package/dist/assets/pathname-JHQIKk21.js +0 -1
- package/dist/assets/placement-1lT0lW3-.js +0 -1
- package/dist/assets/placement-B2V88UDJ.js +0 -1
- package/dist/assets/preload-helper-BvdcsxN9.js +0 -1
- package/dist/assets/project-files-BX3zZCcl.js +0 -1
- package/dist/assets/publish-C9O0tDPB.css +0 -1
- package/dist/assets/publish-DatierL2.js +0 -3
- package/dist/assets/pull-requests-DNkOjcuy.js +0 -1
- package/dist/assets/queryPath-yKLyWw8V.js +0 -1
- package/dist/assets/repository-0EKOcyTL.js +0 -1
- package/dist/assets/returnToPath-CILshEkc.js +0 -1
- package/dist/assets/runtime-core.esm-bundler-Bi1P1jMa.js +0 -1
- package/dist/assets/session-FRkCCzYt.js +0 -1
- package/dist/assets/settings-DbR9JIc3.js +0 -1
- package/dist/assets/shared-B6plZPQ_.js +0 -2
- package/dist/assets/shared-DjZEYqzW.js +0 -1
- package/dist/assets/studioGateApi-B9EUTtMx.js +0 -1
- package/dist/assets/studioUrls-BR4ZL-TN.js +0 -1
- package/dist/assets/surface-CBlx7sF_.js +0 -1
- package/dist/assets/thinkingText-mMYz6e03.js +0 -8
- package/dist/assets/useApi-BPuI6ZR9-rsYWyW6m.js +0 -1
- package/dist/assets/useArchivedVibe64Sessions-B8VDhA9F.js +0 -1
- package/dist/assets/useAssistantAttachments-C9kAnWqw.js +0 -2
- package/dist/assets/useCommand-CfqxMb4C.js +0 -1
- package/dist/assets/useEndpointResource-BwGXpV2u.js +0 -1
- package/dist/assets/usePaths-CvUbx5-V.js +0 -1
- package/dist/assets/useRealtimeEvent-B4oRg9Dt.js +0 -1
- package/dist/assets/useUiFeedback-8Wvg7A_S.js +0 -1
- package/dist/assets/useVibe64ConversationLog-7wgLlKG5.js +0 -2
- package/dist/assets/useVibe64Learning-B9b7aUr-.css +0 -1
- package/dist/assets/useVibe64Learning-DkneotqS.js +0 -5
- package/dist/assets/useVibe64SessionData-DuJ-dHR8.js +0 -1
- package/dist/assets/useVibe64SessionSelection-BwjtqeIR.js +0 -1
- package/dist/assets/validators-HqYRjxEO.js +0 -1
- package/dist/assets/vibe64ApiResponses-DuJ9mfus.js +0 -1
- package/dist/assets/vibe64AssistantHost-CyWUOG-F.js +0 -1
- package/dist/assets/vibe64AttachmentDownload-BWRCIKUr.js +0 -1
- package/dist/assets/vibe64BrowserTabOrigin-vIN_87mi.js +0 -1
- package/dist/assets/vibe64FileUpload-D_rOa1R8.js +0 -1
- package/dist/assets/vibe64GithubProject-CJneIo5O.js +0 -1
- package/dist/assets/vibe64ProjectScope.local-B9ZpdYlf.js +0 -1
- package/dist/assets/vibe64RepositoryRealtime-CRAyGyRD.css +0 -1
- package/dist/assets/vibe64RepositoryRealtime-CVGNqwxz.js +0 -1
- package/dist/assets/vibe64SavedEnvValues-CCZew0j7.js +0 -1
- package/dist/assets/vibe64SessionDebugLog-BfO7tG1A.js +0 -1
- package/dist/assets/vibe64SessionFocus-B4diopOJ.js +0 -1
- package/dist/assets/vibe64SessionFocus-BCojr4E-.css +0 -1
- package/dist/assets/vibe64SessionInfo-D68p7LdH.js +0 -2
- package/dist/assets/vibe64SessionPanelModel-B-WkXnPu.js +0 -1
- package/dist/assets/vibe64SessionRequestConfig-DVRCRAex.js +0 -1
- package/dist/assets/vibe64SessionToolDefinitions-BijEEwqu.js +0 -1
- package/dist/assets/vibe64SessionViewModel-CQCds_jb.js +0 -1
- package/dist/assets/visibility-Cq31Xy7I.js +0 -1
- package/dist/assets/vueRefOrGetterValue-y-4f_In7.js +0 -1
- package/dist/assets/windowSizeClass-DQekxFgV.js +0 -1
- /package/dist/assets/{Vibe64AuthSettingsButton-DfKYI6ZS.css → project-shared-ShellOutlet-DfKYI6ZS.css} +0 -0
- /package/dist/assets/{client-BEV2Ihna.css → project-shared-VBottomSheet-BEV2Ihna.css} +0 -0
- /package/dist/assets/{VToolbar-CY3-1Sb0.css → project-shared-VToolbar-CY3-1Sb0.css} +0 -0
- /package/dist/assets/{route-block-DbL-SuOj.js → project-shared-route-block-DbL-SuOj.js} +0 -0
package/bin/run.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
3
|
-
var
|
|
3
|
+
var lg=Object.create;var Bo=Object.defineProperty;var dg=Object.getOwnPropertyDescriptor;var fg=Object.getOwnPropertyNames;var pg=Object.getPrototypeOf,mg=Object.prototype.hasOwnProperty;var X=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){
|
|
4
4
|
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var b=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var z=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},zo=(e,t)=>{for(var r in t)
|
|
5
|
-
Bo(e,r,{get:t[r],enumerable:!0})},
|
|
6
|
-
e,o)&&o!==r&&Bo(e,o,{get:()=>t[o],enumerable:!(n=
|
|
7
|
-
ditor/src/server/agentSpecs.js",import.meta.url).href,
|
|
8
|
-
[{name:"integration-setup-command",title:"Integration setup command protocol and integrations.json",text:
|
|
5
|
+
Bo(e,r,{get:t[r],enumerable:!0})},hg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fg(t))!mg.call(
|
|
6
|
+
e,o)&&o!==r&&Bo(e,o,{get:()=>t[o],enumerable:!(n=dg(t,o))||n.enumerable});return e};var gg=(e,t,r)=>(r=e!=null?lg(pg(e)):{},hg(t||!e||!e.__esModule?Bo(r,"default",{value:e,enumerable:!0}):r,e));import{readFile as Eg}from"node:fs/promises";var bg,tc,rc,nc=b(()=>{bg=new URL("./../node_modules/@local/vibe64-source-e\
|
|
7
|
+
ditor/src/server/agentSpecs.js",import.meta.url).href,tc=e=>()=>Eg(new URL(`../../docs/${e}`,bg),"utf8"),rc=Object.freeze(
|
|
8
|
+
[{name:"integration-setup-command",title:"Integration setup command protocol and integrations.json",text:tc("application\
|
|
9
9
|
-integration-setup.md")},{name:"integration-payments-laravel",title:"Implementing the integration setup payment operatio\
|
|
10
|
-
ns in Laravel",text:
|
|
11
|
-
fallback:t={}}={}){return H(e)?e:{...t}}function H(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}var
|
|
12
|
-
|
|
10
|
+
ns in Laravel",text:tc("application-payments-laravel.md")}])});var tr,Yr,Sg,Jr,oc=b(()=>{tr="email",Yr="login",Sg="user-id",Jr=Object.freeze([tr,Yr,Sg])});function F(e,{fallback:t=""}={}){return String(e||"").trim()||t}function St(e){return String(e??"").trim()}function ue(e,{
|
|
11
|
+
fallback:t={}}={}){return H(e)?e:{...t}}function H(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}var ZA,U=b(()=>{
|
|
12
|
+
ZA=Object.freeze(["none","pending","committed","rolledBack","unknown"])});function Kr(e){return H(e)?{...e}:{}}var Go=b(()=>{U()});var ie,Xr=b(()=>{Go();ie=class extends Error{constructor(t,r,n={}){super(r,n.cause===void 0?void 0:{cause:n.cause}),this.
|
|
13
13
|
name="AppError",this.status=Number(t)||500,this.statusCode=this.status,this.code=n.code||"APP_ERROR",this.params=Kr(n.params),
|
|
14
14
|
n.messageCode&&(this.messageCode=String(n.messageCode),this.messageParams=Kr(n.messageParams)),this.details=n.details,this.
|
|
15
|
-
headers=n.headers||{}}}});var
|
|
16
|
-
|
|
15
|
+
headers=n.headers||{}}}});var ic=b(()=>{U()});var sc=b(()=>{U()});function Q(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||
|
|
16
|
+
Tg(t)}function Tg(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===null&&Reflect.ownKeys(e).length===0}
|
|
17
17
|
var vt=b(()=>{});function Fo(e){return e!==null&&typeof e=="object"&&Q(e.structure)&&Q(e.operations)&&typeof e.validateWith=="function"&&
|
|
18
18
|
typeof e.toJsonSchema=="function"&&typeof e.cleanup=="function"}function Zr(e,t){if(!Object.hasOwn(t,"items"))return null;
|
|
19
19
|
let{items:r}=t;if(Fo(r))return{kind:"schema",schema:r};if(!Q(r)||typeof r.type!="string")throw new Error(`Array field "${e}\
|
|
@@ -31,87 +31,87 @@ if(Q(e))for(let[r,n]of Object.entries(e)){if(!Q(n))continue;let o=t?`${t}.${r}`:
|
|
|
31
31
|
hasOwn(n,i))continue;let s=n[i];if(n.type!=="array"||!Number.isInteger(s)||s<0)throw new Error(`Field "${o}" ${i} must b\
|
|
32
32
|
e a non-negative integer on an array field.`)}if(n.minItems>n.maxItems)throw new Error(`Field "${o}" minItems (${n.minItems}\
|
|
33
33
|
) is above its maxItems (${n.maxItems}).`);n.type==="array"&&Q(n.items)&&typeof n.items.type=="string"&&qo({"[]":n.items},
|
|
34
|
-
o)}}var en=b(()=>{vt()});function
|
|
35
|
-
let n=Number(e),o=Number(t),i=Number(r);return o>=1&&o<=12&&i>=1&&i<=
|
|
34
|
+
o)}}var en=b(()=>{vt()});function Cg(e){return e%4===0&&(e%100!==0||e%400===0)}function Ng(e,t){return t===2?Cg(e)?29:28:Pg[t-1]}function hc(e,t,r){
|
|
35
|
+
let n=Number(e),o=Number(t),i=Number(r);return o>=1&&o<=12&&i>=1&&i<=Ng(n,o)}function nr(e,t){let r=e.temporalPrecision;
|
|
36
36
|
if(r!==void 0){if(!Number.isInteger(r)||r<0)throw new Error(`temporalPrecision for "${t}" must be a non-negative integer\
|
|
37
|
-
.`);return r}}function
|
|
38
|
-
let t=
|
|
39
|
-
null&&
|
|
40
|
-
|
|
41
|
-
return`^${tn}(?::${It}${
|
|
42
|
-
let r;if(typeof e=="number")r=e;else if(typeof e=="string"&&
|
|
43
|
-
r)||r<-t||r>t?null:r===0?0:r}var Wo,
|
|
44
|
-
\\d{4}",
|
|
45
|
-
](?:${
|
|
46
|
-
new RegExp(`^${tn}(?::${It}(?:\\.(\\d+))?)?$`),
|
|
47
|
-
|
|
48
|
-
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function
|
|
37
|
+
.`);return r}}function gc(e,t){return e===void 0?!0:t===void 0||e.length<=t}function yc(e){if(typeof e!="string")return!1;
|
|
38
|
+
let t=Ig.exec(e);return t!==null&&hc(t[1],t[2],t[3])}function wc(e,t){if(typeof e!="string")return!1;let r=Og.exec(e);return r!==
|
|
39
|
+
null&&gc(r[1],t)}function _c(e,t){if(typeof e!="string")return!1;let r=Rg.exec(e);return r===null?!1:hc(r[1],r[2],r[3])&&
|
|
40
|
+
gc(r[4],t)}function bc(e){return e===void 0?"(?:\\.\\d+)?":e===0?"":`(?:\\.\\d{1,${e}})?`}function Ec(e,t){let r=nr(e,t);
|
|
41
|
+
return`^${tn}(?::${It}${bc(r)})?$`}function Sc(e,t){let r=nr(e,t);return`^${pc}T${tn}:${It}${bc(r)}${dc}$`}function Yo(e,t){
|
|
42
|
+
let r;if(typeof e=="number")r=e;else if(typeof e=="string"&&Ag.test(e))r=Number(e);else return null;return!Number.isSafeInteger(
|
|
43
|
+
r)||r<-t||r>t?null:r===0?0:r}var Wo,ac,cc,uc,lc,It,tn,dc,fc,pc,mc,Ig,Og,Rg,Ag,Pg,Jo=b(()=>{Wo="^(?:0|-?[1-9]\\d*)$",ac="\
|
|
44
|
+
\\d{4}",cc="0[1-9]|1[0-2]",uc="0[1-9]|[12]\\d|3[01]",lc="[01]\\d|2[0-3]",It="[0-5]\\d",tn=`(?:${lc}):${It}`,dc=`(?:Z|[+-\
|
|
45
|
+
](?:${lc}):${It})`,fc=`(${ac})-(${cc})-(${uc})`,pc=`${ac}-(?:${cc})-(?:${uc})`,mc=`^${pc}$`,Ig=new RegExp(`^${fc}$`),Og=
|
|
46
|
+
new RegExp(`^${tn}(?::${It}(?:\\.(\\d+))?)?$`),Rg=new RegExp(`^${fc}T${tn}:${It}(?:\\.(\\d+))?${dc}$`),Ag=new RegExp(Wo),
|
|
47
|
+
Pg=[31,28,31,30,31,30,31,31,30,31,30,31]});function N(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function xg(e,t){if(jg.
|
|
48
|
+
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function kg(e){return typeof e!="string"?e:e.replace(
|
|
49
49
|
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function Ko(e,t,{normalize:r=!1,allowEmpty:n=!1}={}){
|
|
50
|
-
let o=r?
|
|
50
|
+
let o=r?kg(e):e;if(typeof o!="string"||o.trim()===""){if(n&&o==="")return[];throw new Error(`${t}() expects a non-empty \
|
|
51
51
|
dotted path string.`)}let i=o.split(".");if(i.some(s=>s===""))throw new Error(`${t}() received an invalid path "${o}".`);
|
|
52
|
-
for(let s of i)
|
|
52
|
+
for(let s of i)xg(s,t);return i}var jg,or=b(()=>{jg=new Set(["__proto__","prototype","constructor"])});function vc(e){return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:Wo}]}}function et(e,t){return{
|
|
53
53
|
[De]:{[e]:t}}}function ri(e,t){for(let r of Object.keys(t)){let n=t[r],o=e[r];if(n&&o&&typeof n=="object"&&typeof o=="ob\
|
|
54
|
-
ject"&&!Array.isArray(n)&&!Array.isArray(o)){ri(o,n);continue}e[r]=n}}function
|
|
54
|
+
ject"&&!Array.isArray(n)&&!Array.isArray(o)){ri(o,n);continue}e[r]=n}}function Ug(e,t){if(!t||typeof t!="object"||Array.
|
|
55
55
|
isArray(t))throw new Error("JSON Schema export hooks must return an object or null.");for(let r of Object.keys(t)){if(r===
|
|
56
56
|
De&&e[r]&&typeof e[r]=="object"&&typeof t[r]=="object"&&!Array.isArray(e[r])&&!Array.isArray(t[r])){ri(e[r],t[r]);continue}
|
|
57
|
-
e[r]=t[r]}}function
|
|
58
|
-
1?e:{anyOf:n}}function
|
|
59
|
-
let r=e.types[t.type];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n
|
|
60
|
-
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return n}function
|
|
61
|
-
hasOwn(e.validators,t))return null;let n=e.validators[t];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=
|
|
57
|
+
e[r]=t[r]}}function Bg(e,t){let n=[...Array.isArray(e.anyOf)&&Object.keys(e).length===1?e.anyOf:[e],...t];return n.length===
|
|
58
|
+
1?e:{anyOf:n}}function zg(e,t){if(!Object.hasOwn(e.types,t.type))throw new Error(`No casting function for type: ${t.type}`);
|
|
59
|
+
let r=e.types[t.type];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n=Dg[t.type];if(!n)throw new Error(
|
|
60
|
+
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return n}function Gg(e,t,r){if(!Object.
|
|
61
|
+
hasOwn(e.validators,t))return null;let n=e.validators[t];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=Vg[t];
|
|
62
62
|
if(o)return o;throw new Error(`Validator '${t}' on field '${r}' cannot be exported to JSON Schema without a toJsonSchema\
|
|
63
|
-
hook.`)}function
|
|
64
|
-
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function
|
|
65
|
-
void 0&&t.operation!==void 0){let r=
|
|
63
|
+
hook.`)}function Tc(e){if(e===void 0)return"create";if(["create","replace","patch"].includes(e))return e;throw new Error(
|
|
64
|
+
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function Fg(e,t={}){if(t.mode!==
|
|
65
|
+
void 0&&t.operation!==void 0){let r=Tc(t.mode);if(r!==t.operation)throw new Error(`Conflicting JSON Schema export option\
|
|
66
66
|
s: mode '${r}' does not match operation '${t.operation}'.`)}if(t.operation!==void 0){if(!Object.hasOwn(e.operations,t.operation))
|
|
67
|
-
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return
|
|
67
|
+
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return Tc(t.mode)}function Hg(e,t={}){
|
|
68
68
|
if(t.operationName!==void 0&&t.operationDescriptor!==void 0)return{operationName:t.operationName,operation:t.operationDescriptor};
|
|
69
|
-
let r=
|
|
69
|
+
let r=Fg(e,t);return{operationName:r,operation:e.operations[r]}}function qg(e={}){let t={...e};return Object.defineProperty(
|
|
70
70
|
t,Zo,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),t}function nn(e={}){return e[Zo]?
|
|
71
|
-
e[Zo]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function
|
|
71
|
+
e[Zo]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function Wg(e){return String(e).replace(/[^a-zA-Z0-9]+/g,
|
|
72
72
|
"_").replace(/^_+|_+$/g,"")||"operation"}function Qo(e){return Q(e)&&Object.keys(e).length===1&&typeof e.$ref=="string"}
|
|
73
|
-
function rn(e){return Qo(e)?{allOf:[e]}:e}function
|
|
74
|
-
r&&i.operation===n&&i.additionalProperties===o)||null}function
|
|
75
|
-
return e.nextDefinitionId+=1,n}function
|
|
73
|
+
function rn(e){return Qo(e)?{allOf:[e]}:e}function Yg(e,t,r,n,o){return e.nodes.find(i=>i.schema===t&&i.operationName===
|
|
74
|
+
r&&i.operation===n&&i.additionalProperties===o)||null}function Jg(e,t){let r=Wg(t),n=`SchemaNode_${e.nextDefinitionId}_${r}`;
|
|
75
|
+
return e.nextDefinitionId+=1,n}function Ic(e,t,r,n,o,{root:i=!1}={}){let s=nn(t),a=Yg(s,e,r,n,o);if(a)return i&&(a.pointer=
|
|
76
76
|
"#",s.rootNode=a),a;let c={schema:e,operationName:r,operation:n,additionalProperties:o,status:"new",definitionName:i?null:
|
|
77
|
-
|
|
77
|
+
Jg(s,r),pointer:i?"#":null};return i?s.rootNode=c:c.pointer=`#/definitions/${c.definitionName}`,s.nodes.push(c),c}function Oc(e,t){
|
|
78
78
|
if(e.status==="built")return{$ref:e.pointer};if(e.status==="building")return{$ref:e.pointer};let r=nn(t);e.status="build\
|
|
79
|
-
ing",e.pointer!=="#"&&(r.definitions[e.definitionName]={});let n=
|
|
79
|
+
ing",e.pointer!=="#"&&(r.definitions[e.definitionName]={});let n=Kg(e.schema,t,e.operationName,e.operation,e.additionalProperties);
|
|
80
80
|
return e.status="built",e.pointer==="#"?n:(r.definitions[e.definitionName]=n,{$ref:e.pointer})}function ni(e,t,r,n,o=!1){
|
|
81
|
-
let i=nn(t),s=
|
|
82
|
-
referenceBacked:t}}function
|
|
81
|
+
let i=nn(t),s=Ic(e,t,r,n,o);return i.rootNode===s?{$ref:"#"}:Oc(s,t)}function ir(e,{referenceBacked:t=!1}={}){return{schema:e,
|
|
82
|
+
referenceBacked:t}}function Kg(e,t,r,n,o=!1){let i={},s=[];for(let[c,u]of Object.entries(e.structure))N(i,c,oi(e,c,u,t,r,
|
|
83
83
|
n)),n.enforceRequired&&u.required===!0&&s.push(c);let a={type:"object",properties:i,additionalProperties:o};return s.length>
|
|
84
|
-
0&&(a.required=s),a}function
|
|
84
|
+
0&&(a.required=s),a}function Xg(e,t,r,n,o,i){let s=Zr(t,r);if(!s)return null;if(s.kind==="schema")return{...rn(ni(s.schema,
|
|
85
85
|
n,"replace",s.schema.operations.replace,!1)),[De]:{castType:"object"}};let a=r.items.type==="object"&&Object.hasOwn(r.items,
|
|
86
|
-
"schema")?"replace":o,c=a==="replace"?e.operations.replace:i;return oi(e,`${t}[]`,r.items,n,a,c)}function
|
|
86
|
+
"schema")?"replace":o,c=a==="replace"?e.operations.replace:i;return oi(e,`${t}[]`,r.items,n,a,c)}function Zg(e,t,r,n,o,i){
|
|
87
87
|
let s=rr(t,r);if(!s)return null;if(s.kind==="schema")return{...rn(ni(s.schema,n,"replace",s.schema.operations.replace,!1)),
|
|
88
88
|
[De]:{castType:"object"}};let a=s.definition.type==="object"&&Object.hasOwn(s.definition,"schema")?"replace":o,c=a==="re\
|
|
89
|
-
place"?e.operations.replace:i;return oi(e,`${t}.*`,s.definition,n,a,c)}function
|
|
89
|
+
place"?e.operations.replace:i;return oi(e,`${t}.*`,s.definition,n,a,c)}function Qg(e,t,r,n,o,i){if(r.type==="object"){let a=Qr(
|
|
90
90
|
t,r);if(a.kind==="nested")return ir(ni(a.schema,n,o,i,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind===
|
|
91
|
-
"opaque")return ir({type:"object",additionalProperties:!0});if(a.kind==="map")return ir({type:"object",additionalProperties:
|
|
92
|
-
e,t,r,n,o,i)})}let s=
|
|
91
|
+
"opaque")return ir({type:"object",additionalProperties:!0});if(a.kind==="map")return ir({type:"object",additionalProperties:Zg(
|
|
92
|
+
e,t,r,n,o,i)})}let s=zg(e,r)({schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n});if(!s||typeof s!="object"||
|
|
93
93
|
Array.isArray(s))throw new Error(`Type '${r.type}' on field '${t}' returned an invalid JSON Schema fragment.`);if(r.type===
|
|
94
|
-
"array"){let a=
|
|
95
|
-
function oi(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n},a=
|
|
94
|
+
"array"){let a=Xg(e,t,r,n,o,i);if(a)return ir({...s,items:a},{referenceBacked:Qo(s)})}return ir(s,{referenceBacked:Qo(s)})}
|
|
95
|
+
function oi(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n},a=Qg(e,t,r,n,o,i),c=a.referenceBacked?
|
|
96
96
|
rn(a.schema):{...a.schema},u={castType:r.type};for(let g of Object.keys(r)){if(g==="type"||!Object.hasOwn(e.validators,g))
|
|
97
|
-
continue;let h=
|
|
97
|
+
continue;let h=Gg(e,g,t);if(!h)continue;let l=h({...s,parameterName:g,parameterValue:r[g],fieldSchema:{...c}});l&&Ug(c,l)}
|
|
98
98
|
c[De]&&(ri(u,c[De]),delete c[De]);let d=[];r.nullable===!0&&d.push({type:"null"}),r.nullOnEmpty===!0&&d.push({const:""});
|
|
99
|
-
let p=rn(
|
|
99
|
+
let p=rn(Bg(c,d));if(r.defaultTo!==void 0&&i.applyDefaults)if(typeof r.defaultTo!="function"){let g=e._normalizeDefault(
|
|
100
100
|
r,r.defaultTo,{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},options:{},settings:e._buildOperationSettings(
|
|
101
101
|
o,i,{})});if(Object.keys(g.errors).length>0){let h=Object.values(g.errors)[0];throw new Error(`defaultTo for "${t}" is i\
|
|
102
|
-
nvalid (${h.code}).`)}p.default=g.value}else u.defaults={providedByFunction:!0};return p[De]=u,p}function
|
|
103
|
-
t),{operationName:n,operation:o}=
|
|
104
|
-
o,i,{root:!0}),c={$schema
|
|
105
|
-
De,Xo,Zo,
|
|
106
|
-
ema",Xo=["object","array","string","number","boolean"],Zo=Symbol("json-rest-schema.exportContext"),
|
|
107
|
-
"y","on"],
|
|
102
|
+
nvalid (${h.code}).`)}p.default=g.value}else u.defaults={providedByFunction:!0};return p[De]=u,p}function Rc(e,t={}){let r=qg(
|
|
103
|
+
t),{operationName:n,operation:o}=Hg(e,r),i=r.additionalProperties===void 0?!1:r.additionalProperties,s=nn(r),a=Ic(e,r,n,
|
|
104
|
+
o,i,{root:!0}),c={$schema:$g,...Oc(a,r)};return Object.keys(s.definitions).length>0&&(c.definitions=s.definitions),c}var $g,
|
|
105
|
+
De,Xo,Zo,Lg,Mg,Dg,Vg,Ac=b(()=>{Ho();en();Jo();vt();or();$g="http://json-schema.org/draft-07/schema#",De="x-json-rest-sch\
|
|
106
|
+
ema",Xo=["object","array","string","number","boolean"],Zo=Symbol("json-rest-schema.exportContext"),Lg=["true","1","yes",
|
|
107
|
+
"y","on"],Mg=["false","0","no","n","off"];Dg={none:()=>({type:Xo}),blob:()=>({type:Xo}),serialize:()=>({type:Xo}),object:()=>({
|
|
108
108
|
type:"object"}),array:()=>({type:"array"}),file:()=>({type:"string"}),string:()=>({type:"string"}),number:()=>({type:["n\
|
|
109
|
-
umber","string"]}),integer:()=>({type:["integer","string"]}),epochMilliseconds:()=>
|
|
110
|
-
dateTime:({definition:e,fieldName:t})=>({type:"string",format:"date-time",pattern:
|
|
111
|
-
date",pattern:
|
|
112
|
-
strictBoolean===!0)return{type:"boolean"};let t=new Set([...
|
|
113
|
-
[...
|
|
114
|
-
{type:"string",enum:[...r,...t]}]}},id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},
|
|
109
|
+
umber","string"]}),integer:()=>({type:["integer","string"]}),epochMilliseconds:()=>vc(864e13),epochSeconds:()=>vc(864e10),
|
|
110
|
+
dateTime:({definition:e,fieldName:t})=>({type:"string",format:"date-time",pattern:Sc(e,t)}),date:()=>({type:"string",format:"\
|
|
111
|
+
date",pattern:mc}),time:({definition:e,fieldName:t})=>({type:"string",pattern:Ec(e,t)}),boolean:({definition:e})=>{if(e.
|
|
112
|
+
strictBoolean===!0)return{type:"boolean"};let t=new Set([...Lg,String(e.stringTrueWhen||"true").trim().toLowerCase()]),r=new Set(
|
|
113
|
+
[...Mg,String(e.stringFalseWhen||"false").trim().toLowerCase()]);return{anyOf:[{type:"boolean"},{type:"number",enum:[0,1]},
|
|
114
|
+
{type:"string",enum:[...r,...t]}]}},id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},Vg={minLength:({
|
|
115
115
|
definition:e,parameterValue:t})=>e.type==="string"?{minLength:t}:null,maxLength:({definition:e,parameterValue:t})=>e.type===
|
|
116
116
|
"string"?{maxLength:t}:null,min:({definition:e,parameterValue:t})=>Tt(e)?{minimum:t}:null,max:({definition:e,parameterValue:t})=>Tt(
|
|
117
117
|
e)?{maximum:t}:null,pattern:({definition:e,parameterValue:t})=>e.type==="string"?{pattern:t instanceof RegExp?t.source:t}:
|
|
@@ -121,46 +121,46 @@ t.type==="array"?null:{minLength:1},uppercase:({parameterValue:e})=>e?et("transf
|
|
|
121
121
|
et("transforms",{lowercase:!0}):null,length:({parameterValue:e})=>et("transforms",{length:e}),unsigned:({parameterValue:e})=>e?
|
|
122
122
|
et("metadata",{unsigned:!0}):null,precision:({parameterValue:e})=>et("metadata",{precision:e}),scale:({parameterValue:e})=>et(
|
|
123
123
|
"metadata",{scale:e}),temporalPrecision:({parameterValue:e})=>et("metadata",{temporalPrecision:e}),strictBoolean:()=>null,
|
|
124
|
-
required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null}});function
|
|
125
|
-
At}function
|
|
126
|
-
.${String(t)}`}function
|
|
124
|
+
required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null}});function Pc(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function li(e){return e instanceof
|
|
125
|
+
At}function ey(){return{self:!1,children:{}}}function Cc(e){return Object.keys(e.children).length>0}function tt(e,t){return`${e}\
|
|
126
|
+
.${String(t)}`}function Lc(e,t){return e===""?String(t):tt(e,t)}function Nc(e,t){if(e===t)return"";let r=`${t}.`;return e.
|
|
127
127
|
startsWith(r)?e.slice(r.length):null}function Ot(e,t){let r={};for(let n of Object.values(e)){let o=tt(t,n.field);N(r,o,
|
|
128
|
-
{...n,field:o})}return r}function ci(e){return Ko(e,"validatePath")}function
|
|
129
|
-
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||N(o,s,
|
|
130
|
-
return t}function
|
|
131
|
-
function on(e){return e===null?!0:Array.isArray(e)||Q(e)?Object.keys(e).length>0:e!==void 0}function
|
|
128
|
+
{...n,field:o})}return r}function ci(e){return Ko(e,"validatePath")}function jc(e){let t={};for(let r of e){let n=ci(r),
|
|
129
|
+
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||N(o,s,ey()),i===n.length-1&&(o[s].self=!0),o=o[s].children}}
|
|
130
|
+
return t}function ty(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||!Object.hasOwn(r,n))return;r=r[n]}return r}
|
|
131
|
+
function on(e){return e===null?!0:Array.isArray(e)||Q(e)?Object.keys(e).length>0:e!==void 0}function xc(e){return[...e].
|
|
132
132
|
sort((t,r)=>{let n=/^[0-9]+$/.test(t),o=/^[0-9]+$/.test(r);return n&&o?Number(t)-Number(r):n?-1:o?1:t.localeCompare(r)})}
|
|
133
|
-
function
|
|
133
|
+
function ry(e){return/^[0-9]+$/.test(e)}function ny(e,t=new WeakMap){if(t.has(e))return t.get(e);let r=Object.create(At.
|
|
134
134
|
prototype);return t.set(e,r),r.structure=null,r.types=e.types,r.validators=e.validators,r.operations=e.operations,r.structure=
|
|
135
135
|
an(sn(e.structure,t)),r._installOperationMethods(),Object.freeze(r)}function sn(e,t=new WeakMap){if(e===null||typeof e!=
|
|
136
|
-
"object")return e;if(li(e))return
|
|
136
|
+
"object")return e;if(li(e))return ny(e,t);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let n=new RegExp(
|
|
137
137
|
e.source,e.flags);return n.lastIndex=e.lastIndex,n}if(t.has(e))return t.get(e);if(Array.isArray(e)){let n=[];t.set(e,n);
|
|
138
138
|
for(let o of e)n.push(sn(o,t));return n}if(!Q(e))return e;let r={};t.set(e,r);for(let[n,o]of Object.entries(e))N(r,n,sn(
|
|
139
139
|
o,t));return r}function an(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e)||li(e))return e;if(t.add(e),Array.
|
|
140
140
|
isArray(e))for(let r of e)an(r,t);else for(let r of Reflect.ownKeys(e))an(e[r],t);return Object.freeze(e)}function ii(e){
|
|
141
141
|
return an(sn(e))}function ui(e,t,r=""){if(!li(e)||!Array.isArray(t)||t.length<1)return null;let[n,...o]=t;if(!Object.hasOwn(
|
|
142
|
-
e.structure,n))return null;let i=e.structure[n];if(o.length<1)return i;let s=
|
|
142
|
+
e.structure,n))return null;let i=e.structure[n];if(o.length<1)return i;let s=Lc(r,n);return Mc(e,i,o,s)}function Mc(e,t,r,n){
|
|
143
143
|
if(t?.type==="object"){let o=e._resolveObjectFieldMode(n,t);return o.kind!=="nested"?null:ui(o.schema,r,n)}if(t?.type===
|
|
144
|
-
"array"){let o=e._resolveArrayItemsConfig(n,t);if(!o||r.length<1)return null;let[i,...s]=r;if(!
|
|
145
|
-
n,i);return o.kind==="schema"?s.length<1?null:ui(o.schema,s,a):s.length<1?o.definition
|
|
146
|
-
function Rt(e,t){let r={...e};if(Array.isArray(e.skipFields)){let n=e.skipFields.map(o=>
|
|
144
|
+
"array"){let o=e._resolveArrayItemsConfig(n,t);if(!o||r.length<1)return null;let[i,...s]=r;if(!ry(i))return null;let a=tt(
|
|
145
|
+
n,i);return o.kind==="schema"?s.length<1?null:ui(o.schema,s,a):s.length<1?o.definition:Mc(e,o.definition,s,a)}return null}
|
|
146
|
+
function Rt(e,t){let r={...e};if(Array.isArray(e.skipFields)){let n=e.skipFields.map(o=>Nc(o,t)).filter(o=>o!==null&&o!==
|
|
147
147
|
"");n.length>0?r.skipFields=n:delete r.skipFields}if(Q(e.skipParams)){let n={};for(let[o,i]of Object.entries(e.skipParams)){
|
|
148
|
-
let s=
|
|
148
|
+
let s=Nc(o,t);s===null||s===""||N(n,s,i)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}function kc(e,t,r,n){
|
|
149
149
|
let o=t[r];if(!n.includes(o))throw new Error(`Operation "${e}" must define ${r} as one of: ${n.join(", ")}.`)}function ai(e,t,r,n=!0){
|
|
150
150
|
let o=t[r];if(!(o===void 0&&!n)&&typeof o!="boolean")throw new Error(`Operation "${e}" must define ${r} as a boolean.`)}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
151
|
+
function iy(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Operation "${e}" must be an object.`);
|
|
152
|
+
return kc(e,t,"targetFields",["schema","input"]),ai(e,t,"enforceRequired"),ai(e,t,"applyDefaults"),kc(e,t,"outputFields",
|
|
153
153
|
["validated","input"]),ai(e,t,"rejectExplicitUndefined",!1),Object.freeze({targetFields:t.targetFields,enforceRequired:t.
|
|
154
154
|
enforceRequired,applyDefaults:t.applyDefaults,outputFields:t.outputFields,rejectExplicitUndefined:t.rejectExplicitUndefined===
|
|
155
|
-
void 0?!0:t.rejectExplicitUndefined})}function
|
|
156
|
-
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
157
|
-
entries(e))N(t,r,
|
|
158
|
-
e))N(t,r,n);return Object.freeze(t)}function
|
|
159
|
-
()=>{
|
|
155
|
+
void 0?!0:t.rejectExplicitUndefined})}function sy(e={}){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(
|
|
156
|
+
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(oy))N(t,r,n);for(let[r,n]of Object.
|
|
157
|
+
entries(e))N(t,r,iy(r,n));return Object.freeze(t)}function $c(e){let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
158
|
+
e))N(t,r,n);return Object.freeze(t)}function ay(e){let t={...e};return delete t.operation,delete t.mode,t}var si,oy,At,Dc=b(
|
|
159
|
+
()=>{Ac();Ho();or();vt();en();si=new WeakMap;oy=Object.freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,
|
|
160
160
|
applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),replace:Object.freeze({targetFields:"schema",enforceRequired:!0,
|
|
161
161
|
applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),patch:Object.freeze({targetFields:"input",enforceRequired:!1,
|
|
162
162
|
applyDefaults:!1,outputFields:"input",rejectExplicitUndefined:!0})});At=class{constructor(t,r,n,o={}){qo(t),this.structure=
|
|
163
|
-
t,this.types
|
|
163
|
+
t,this.types=$c(r),this.validators=$c(n),this.operations=sy(o),this._installOperationMethods()}_typeError(t){return this.
|
|
164
164
|
_paramError(t,"TYPE_CAST_FAILED","Value could not be cast to the required type.")}_paramError(t,r,n,o={}){let i=new Error(
|
|
165
165
|
n);return i.errorObject={field:t,code:r,message:n,params:o},i}_paramToBeSkipped(t,r,n){return typeof r!="object"||r===null?
|
|
166
166
|
!1:!!(Array.isArray(r[n])&&r[n].includes(t))}_fieldToBeSkipped(t,r){return Array.isArray(r.skipFields)&&r.skipFields.includes(
|
|
@@ -175,7 +175,7 @@ rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:o=>Object.hasOwn(
|
|
|
175
175
|
r))throw new Error(`${t}() expects a plain object input.`)}_resolvePathValidationRequest(t={}){let r=t.operation??t.mode??
|
|
176
176
|
"patch";if(Object.hasOwn(t,"operation")&&Object.hasOwn(t,"mode")&&t.operation!==t.mode)throw new Error("Path validation \
|
|
177
177
|
options `operation` and `mode` must match when both are provided.");if(!Object.hasOwn(this.operations,r))throw new Error(
|
|
178
|
-
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:
|
|
178
|
+
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:ay(t)}}_buildOperationResult(t,r,n){
|
|
179
179
|
let o={};for(let i of n.outputFieldNames){if(!Object.hasOwn(this.structure,i))continue;let s=n.isFieldPresent(i);(r[i]!==
|
|
180
180
|
void 0||s&&t[i]===null||n.defaultedFields.has(i))&&(!s&&!n.defaultedFields.has(i)||N(o,i,r[i]))}return o}_resolveObjectFieldMode(t,r){
|
|
181
181
|
return Qr(t,r)}_resolveArrayItemsConfig(t,r){return Zr(t,r)}_resolveObjectValuesConfig(t,r){return rr(t,r)}_buildArrayItemSettings(t,r){
|
|
@@ -186,11 +186,11 @@ let u=t.nullable===!0||a.nullable===!0,d=t.nullOnEmpty===!0||a.nullOnEmpty===!0;
|
|
|
186
186
|
if(r===""&&d)return N(o,i,null),{errors:{},shouldContinue:!1};let g={schema:this,definition:t,value:r,fieldName:n,object:o,
|
|
187
187
|
objectBeforeCast:s,valueBeforeCast:r,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
|
|
188
188
|
nullable:u||d,nullOnEmpty:d},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(h,l,w)=>{throw this._paramError(
|
|
189
|
-
n,h,l,w)}};try{let h=p(g);if(
|
|
189
|
+
n,h,l,w)}};try{let h=p(g);if(Pc(h))throw new Error(`Type handler for "${t.type}" must be synchronous.`);h!==void 0&&(N(o,
|
|
190
190
|
i,h),g.value=h)}catch(h){if(h.errorObject)return{errors:this._singleErrorMap(h.errorObject),shouldContinue:!1};throw h}return{
|
|
191
191
|
errors:{},context:g,shouldContinue:!0}}_runFieldValidators(t,r,n,o,i,s){for(let a of Object.keys(t)){if(a==="type"||this.
|
|
192
192
|
_paramToBeSkipped(a,s.skipParams,r)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{i.parameterName=
|
|
193
|
-
a,i.parameterValue=t[a];let u=c(i);if(
|
|
193
|
+
a,i.parameterValue=t[a];let u=c(i);if(Pc(u))throw new Error(`Validator handler for "${a}" must be synchronous.`);u!==void 0&&
|
|
194
194
|
(N(n,o,u),i.value=u)}catch(u){if(u.errorObject)return this._singleErrorMap(u.errorObject);throw u}}return{}}_normalizeAndValidateValue(t,r,n,o,i,s,a,c){
|
|
195
195
|
let u=this._castValue(t,r,n,o,i,s,a,c);if(Object.keys(u.errors).length>0)return u.errors;if(!u.shouldContinue)return{};let{
|
|
196
196
|
context:d}=u,p=this._validateNestedValue(t,n,o,i,a,c);return Object.keys(p).length>0?p:(d.value=o[i],this._runFieldValidators(
|
|
@@ -225,10 +225,10 @@ c,n,s,o,a);this._mergeErrors(i,u)}if(a.applyDefaults){for(let c of Object.keys(t
|
|
|
225
225
|
this.structure[c].defaultTo!==void 0){let u=this.structure[c],d=typeof u.defaultTo=="function"?u.defaultTo():u.defaultTo,
|
|
226
226
|
p=this._normalizeDefault(u,d,{fieldPath:c,currentObject:s,containerKey:c,objectBeforeCast:n,options:o,settings:a});if(this.
|
|
227
227
|
_mergeErrors(i,p.errors),Object.keys(p.errors).length>0)continue;N(s,c,p.value),a.defaultedFields.add(c)}}return{validatedObject:this.
|
|
228
|
-
_buildOperationResult(n,s,a),errors:i}}_validateSelectedTree(t,r,n,o,i=""){let s={},a={};for(let c of
|
|
229
|
-
let u=
|
|
228
|
+
_buildOperationResult(n,s,a),errors:i}}_validateSelectedTree(t,r,n,o,i=""){let s={},a={};for(let c of xc(Object.keys(t))){
|
|
229
|
+
let u=Lc(i,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema path "${u}".`);let d=this._validateSelectedField(
|
|
230
230
|
c,t[c],r,a,n,o,u);this._mergeErrors(s,d)}return{validatedObject:a,errors:s}}_validateSelectedField(t,r,n,o,i,s,a){if(!Object.
|
|
231
|
-
hasOwn(this.structure,t))return{};let c=this.structure[t],u=r.self===!0,d=
|
|
231
|
+
hasOwn(this.structure,t))return{};let c=this.structure[t],u=r.self===!0,d=Cc(r);if(this._fieldToBeSkipped(a,i))return{};
|
|
232
232
|
let p=Object.hasOwn(n,t),g=n[t],h={};if(!p){if(u&&s.enforceRequired&&c.required&&!this._paramToBeSkipped("required",i.skipParams,
|
|
233
233
|
a)&&this._mergeErrors(h,this._singleErrorMap({field:a,code:"REQUIRED",message:"Field is required",params:{}})),u&&s.applyDefaults&&
|
|
234
234
|
c.defaultTo!==void 0){let f=typeof c.defaultTo=="function"?c.defaultTo():c.defaultTo,m=this._normalizeDefault(c,f,{fieldPath:a,
|
|
@@ -243,8 +243,8 @@ u))return{};let d=c.schema._validateSelectedTree(r,u,Rt(s,n),{...a,defaultedFiel
|
|
|
243
243
|
Ot(d.errors,n)}if(t.type==="array"){let c=this._resolveArrayItemsConfig(n,t);if(!c)throw new Error(`Schema path "${n}" d\
|
|
244
244
|
oes not define array items for nested selection.`);return this._validateSelectedArrayItems(n,o,i,c,r,s,a)}throw new Error(
|
|
245
245
|
`Schema path "${n}" does not support nested field selection.`)}_validateSelectedArrayItems(t,r,n,o,i,s,a){let c=[],u=r[n],
|
|
246
|
-
d={};N(r,n,c);for(let p of
|
|
247
|
-
id because array segments must use numeric indexes.`);let g=Number(p),h=tt(t,g),l=i[p],w=l.self===!0,_=
|
|
246
|
+
d={};N(r,n,c);for(let p of xc(Object.keys(i))){if(!/^[0-9]+$/.test(p))throw new Error(`Schema path "${tt(t,p)}" is inval\
|
|
247
|
+
id because array segments must use numeric indexes.`);let g=Number(p),h=tt(t,g),l=i[p],w=l.self===!0,_=Cc(l);if(this._fieldToBeSkipped(
|
|
248
248
|
h,s))continue;if(!Object.hasOwn(u,g)){w&&a.rejectExplicitUndefined&&N(d,h,this._typeError(h).errorObject);continue}let f=u[g];
|
|
249
249
|
if(f===void 0){w&&a.rejectExplicitUndefined&&N(d,h,this._typeError(h).errorObject);continue}if(o.kind==="schema"){if(w){
|
|
250
250
|
let v=o.schema._validateWithOperation("replace",o.schema.operations.replace,f,Rt(s,h));on(v.validatedObject)&&N(c,g,v.validatedObject),
|
|
@@ -257,21 +257,21 @@ d,E.errors);continue}if(!E.shouldContinue)continue;let T=this._validateSelectedD
|
|
|
257
257
|
s,m);on(y[0])&&N(c,g,y[0]),this._mergeErrors(d,T)}return d}validateWith(t,r,n={}){if(!Object.hasOwn(this.operations,t))throw new Error(
|
|
258
258
|
`Unknown operation "${t}".`);let o=this.operations[t];return this._assertPlainObjectInput(t,r),this._validateWithOperation(
|
|
259
259
|
t,o,r,n)}validateAt(t,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=ci(t),{operationName:i,operation:s,validationOptions:a}=this.
|
|
260
|
-
_resolvePathValidationRequest(n),c=this._validateSelectedTree(
|
|
260
|
+
_resolvePathValidationRequest(n),c=this._validateSelectedTree(jc([t]),r,a,this._buildOperationSettings(i,s,r));return{validatedValue:ty(
|
|
261
261
|
c.validatedObject,o),errors:c.errors}}validatePaths(t,r,n={}){if(this._assertPlainObjectInput("validatePaths",r),!Array.
|
|
262
262
|
isArray(t)||t.length===0)throw new Error("validatePaths() expects a non-empty array of schema paths.");let{operationName:o,
|
|
263
|
-
operation:i,validationOptions:s}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(
|
|
263
|
+
operation:i,validationOptions:s}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(jc(t),r,s,this.
|
|
264
264
|
_buildOperationSettings(o,i,r))}_installOperationMethods(){for(let t of Object.keys(this.operations)){if(t in this)throw new Error(
|
|
265
265
|
`Operation name "${t}" is reserved and cannot be used as a schema method.`);this[t]=(r,n={})=>this.validateWith(t,r,n)}}toJsonSchema(t={}){
|
|
266
|
-
return
|
|
266
|
+
return Rc(this,t)}getFieldDefinitions(){return si.has(this)||si.set(this,ii(this.structure)),si.get(this)}getFieldDefinition(t){
|
|
267
267
|
if(typeof t!="string"||t.trim()==="")throw new Error("Field path must be a non-empty string.");let r=ui(this,ci(t.trim()));
|
|
268
268
|
return r===null?null:ii(r)}getFieldMessages(t){let r=this.getFieldDefinition(t);return!r||typeof r.messages!="object"||r.
|
|
269
269
|
messages===null?Object.freeze({}):ii(r.messages)}cleanup(t,r){let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,
|
|
270
|
-
o)&&this.structure[o][r]&&N(n,o,t[o]);return n}}});var
|
|
271
|
-
t",
|
|
272
|
-
-1<t.indexOf(d)?p:void 0:t||
|
|
273
|
-
u,r);return"["+s.join(",")+"]";function u(d,p){if(c)return c=!c,p;let g=n.call(this,d,p);switch(typeof g){case
|
|
274
|
-
null)return g;case
|
|
270
|
+
o)&&this.structure[o][r]&&N(n,o,t[o]);return n}}});var RP,cy,AP,uy,ly,Vc,dy,Uc,Bc,zc=b(()=>{({parse:RP,stringify:cy}=JSON),{keys:AP}=Object,uy=String,ly="string",Vc="objec\
|
|
271
|
+
t",dy=(e,t)=>t,Uc=(e,t,r)=>{let n=uy(t.push(r)-1);return e.set(r,n),n},Bc=(e,t,r)=>{let n=t&&typeof t===Vc?(d,p)=>d===""||
|
|
272
|
+
-1<t.indexOf(d)?p:void 0:t||dy,o=new Map,i=[],s=[],a=+Uc(o,i,n.call({"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=cy(i[a++],
|
|
273
|
+
u,r);return"["+s.join(",")+"]";function u(d,p){if(c)return c=!c,p;let g=n.call(this,d,p);switch(typeof g){case Vc:if(g===
|
|
274
|
+
null)return g;case ly:return o.get(g)||Uc(o,i,g)}return g}}});function hy(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Gc(e){if(typeof e==
|
|
275
275
|
"number")return Number.isFinite(e)?e:null;if(typeof e=="bigint"){let t=Number(e);return Number.isSafeInteger(t)?t:null}if(typeof e==
|
|
276
276
|
"string"){let t=e.trim();if(t==="")return null;let r=Number(t);return Number.isFinite(r)?r:null}return null}function di(e,t){
|
|
277
277
|
if(Object.is(e,t))return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&
|
|
@@ -279,22 +279,22 @@ t instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(Array.isArr
|
|
|
279
279
|
e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!di(e[o],t[o]))return!1;return!0}if(e===
|
|
280
280
|
null||t===null||typeof e!="object"||typeof t!="object"||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let r=Object.
|
|
281
281
|
keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!Object.hasOwn(t,o)||!di(e[o],t[o]))return!1;
|
|
282
|
-
return!0}var
|
|
283
|
-
no","n","off"]);
|
|
282
|
+
return!0}var py,my,gy,Fc,Hc=b(()=>{zc();en();Jo();vt();py=new Set(["true","1","yes","y","on"]),my=new Set(["false","0","\
|
|
283
|
+
no","n","off"]);gy={install(e){let{addType:t,addValidator:r}=e;t("none",n=>n.value),t("file",n=>{let o=n.value;o==null&&
|
|
284
284
|
n.throwTypeError();let i=typeof o;if(i==="string"||i==="number"||i==="boolean"){let s=o.toString();return n.definition.noTrim?
|
|
285
285
|
s:s.trim()}n.throwTypeError()}),t("string",n=>{let o=n.value;if(o==null)return"";let i=typeof o;if(i==="string"||i==="nu\
|
|
286
286
|
mber"||i==="boolean"){let s=o.toString();return n.definition.noTrim?s:s.trim()}n.throwTypeError()}),t("blob",n=>n.value),
|
|
287
|
-
t("number",n=>{let o=
|
|
287
|
+
t("number",n=>{let o=Gc(n.value);return o===null&&n.throwTypeError(),o}),t("integer",n=>{let o=Gc(n.value);return(o===null||
|
|
288
288
|
!Number.isInteger(o))&&n.throwTypeError(),o}),t("epochMilliseconds",n=>{let o=Yo(n.value,864e13);return o===null&&n.throwTypeError(),
|
|
289
289
|
o}),t("epochSeconds",n=>{let o=Yo(n.value,864e10);return o===null&&n.throwTypeError(),o}),t("dateTime",n=>{let o=nr(n.definition,
|
|
290
|
-
n.fieldName);return
|
|
291
|
-
"time",n=>{let o=nr(n.definition,n.fieldName);return
|
|
290
|
+
n.fieldName);return _c(n.value,o)||n.throwTypeError(),n.value}),t("date",n=>(yc(n.value)||n.throwTypeError(),n.value)),t(
|
|
291
|
+
"time",n=>{let o=nr(n.definition,n.fieldName);return wc(n.value,o)||n.throwTypeError(),n.value}),t("array",n=>n.definition.
|
|
292
292
|
type==="array"&&!Array.isArray(n.value)?[n.value]:n.value),t("object",n=>(Q(n.value)||n.throwTypeError(),n.value)),t("se\
|
|
293
|
-
rialize",n=>{try{return JSON.stringify(n.value)}catch{try{return
|
|
293
|
+
rialize",n=>{try{return JSON.stringify(n.value)}catch{try{return Bc(n.value)}catch{n.throwTypeError()}}}),t("boolean",n=>{
|
|
294
294
|
if(typeof n.value=="boolean")return n.value;if(typeof n.value=="number"){if(n.value===1)return!0;if(n.value===0)return!1;
|
|
295
295
|
n.throwTypeError()}if(typeof n.value=="bigint"){if(n.value===1n)return!0;if(n.value===0n)return!1;n.throwTypeError()}if(typeof n.
|
|
296
296
|
value=="string"){let o=String(n.definition.stringFalseWhen||"false").trim().toLowerCase(),i=String(n.definition.stringTrueWhen||
|
|
297
|
-
"true").trim().toLowerCase(),s=n.value.trim().toLowerCase(),a=new Set([...
|
|
297
|
+
"true").trim().toLowerCase(),s=n.value.trim().toLowerCase(),a=new Set([...my,o]),c=new Set([...py,i]);if(a.has(s))return!1;
|
|
298
298
|
if(c.has(s))return!0}n.throwTypeError()}),t("id",n=>{if(typeof n.value=="number"){if(Number.isSafeInteger(n.value)&&n.value>
|
|
299
299
|
0)return n.value;n.throwTypeError()}if(typeof n.value=="bigint"){if(n.value>0n&&n.value<=BigInt(Number.MAX_SAFE_INTEGER))
|
|
300
300
|
return Number(n.value);n.throwTypeError()}if(typeof n.value=="string"){let o=n.value.trim();/^[1-9][0-9]*$/.test(o)||n.throwTypeError();
|
|
@@ -315,7 +315,7 @@ RegExp?new RegExp(o.source,o.flags):typeof o=="string"?new RegExp(o):null;if(!i)
|
|
|
315
315
|
{pattern:i.source})}),r("strictBoolean",n=>{if(n.parameterValue){if(n.definition.type!=="boolean")throw new Error(`stric\
|
|
316
316
|
tBoolean can only be used on boolean fields (${n.fieldName}).`);typeof n.valueBeforeCast!="boolean"&&n.throwParamError("\
|
|
317
317
|
STRICT_BOOLEAN","Value must be a boolean.")}}),r("validator",n=>{if(typeof n.parameterValue!="function")throw new Error(
|
|
318
|
-
`Validator for ${n.fieldName} must be a function.`);let o=n.parameterValue(n.value,n.object,n);if(
|
|
318
|
+
`Validator for ${n.fieldName} must be a function.`);let o=n.parameterValue(n.value,n.object,n);if(hy(o))throw new Error(
|
|
319
319
|
`Custom validator for "${n.fieldName}" must be synchronous.`);typeof o=="string"&&n.throwParamError("CUSTOM_VALIDATOR_FA\
|
|
320
320
|
ILED",o)}),r("uppercase",n=>{if(typeof n.value=="string")return n.value.toUpperCase()}),r("lowercase",n=>{if(typeof n.value==
|
|
321
321
|
"string")return n.value.toLowerCase()}),r("length",n=>{if(typeof n.value=="string")return n.value.substr(0,n.parameterValue);
|
|
@@ -328,45 +328,45 @@ ms.`,{max:n.parameterValue,actual:n.value.length})}),r("notEmpty",n=>{n.paramete
|
|
|
328
328
|
""&&n.throwParamError("NOT_EMPTY","Field cannot be empty.")}),r("required",()=>{}),r("unsigned",()=>{}),r("precision",()=>{}),
|
|
329
329
|
r("scale",()=>{}),r("temporalPrecision",n=>{if(n.definition.type!=="time"&&n.definition.type!=="dateTime")throw new Error(
|
|
330
330
|
`temporalPrecision can only be used on time or dateTime fields (${n.fieldName}).`)}),r("nullable",()=>{}),r("nullOnEmpty",
|
|
331
|
-
()=>{}),r("defaultTo",()=>{})}},
|
|
331
|
+
()=>{}),r("defaultTo",()=>{})}},Fc=gy});var qc=b(()=>{or()});function yy(e,t,r){if(typeof r!="function")throw new Error(`Type handler for '${t}' must be a function.`);N(e,t,r)}function wy(e,t,r){
|
|
332
332
|
if(typeof r!="function")throw new Error(`Validator handler for '${t}' must be a function.`);N(e,t,r)}function un(e={}){let t=Object.
|
|
333
|
-
create(null);for(let[r,n]of Object.entries(e))N(t,r,n);return t}function
|
|
334
|
-
"Plugin must have an install method.");e.install(t)}function
|
|
335
|
-
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function
|
|
336
|
-
typeof e!="object"&&typeof e!="function")return null;let t=
|
|
333
|
+
create(null);for(let[r,n]of Object.entries(e))N(t,r,n);return t}function Wc(e,t){if(typeof e.install!="function")throw new Error(
|
|
334
|
+
"Plugin must have an install method.");e.install(t)}function Yc(e,t,r){Kc.set(e,t),Xc.set(e,r),Object.defineProperty(e,Zc,
|
|
335
|
+
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function _y(e){if(!e||
|
|
336
|
+
typeof e!="object"&&typeof e!="function")return null;let t=Kc.get(e),r=Xc.get(e);if(t&&r)return{types:t,validators:r};let n=e[Zc];
|
|
337
337
|
return n&&typeof n.getTypes=="function"&&typeof n.getValidators=="function"?{types:n.getTypes(),validators:n.getValidators()}:
|
|
338
338
|
typeof e=="object"&&e.types&&typeof e.types=="object"&&e.validators&&typeof e.validators=="object"&&typeof e.create=="fu\
|
|
339
339
|
nction"&&typeof e.replace=="function"&&typeof e.patch=="function"&&typeof e.toJsonSchema=="function"?{types:e.types,validators:e.
|
|
340
|
-
validators}:null}function
|
|
340
|
+
validators}:null}function by(e){return e.length===1&&Array.isArray(e[0])?e[0]:e}function Jc(e,t,r){for(let[n,o]of Object.
|
|
341
341
|
entries(t)){if(Object.hasOwn(e,n)&&e[n]!==o){if(cn.has(o))continue;if(!cn.has(e[n]))throw new Error(`Cannot merge schema\
|
|
342
|
-
factories with conflicting ${r} "${n}".`)}N(e,n,o)}}function
|
|
343
|
-
types:un(e),validators:un(t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=
|
|
344
|
-
"Factory sources must be schema instances or schema factories created by json-rest-schema.");
|
|
345
|
-
validators,"validator")}return{types:o,validators:i}}function
|
|
346
|
-
e),o=un(t),i=(s,a={})=>{let c=new At(s,n,o,a.operations);return
|
|
347
|
-
i.addValidator=(s,a)=>{
|
|
348
|
-
let a=
|
|
349
|
-
addType(s,a)},addValidator:(s,a)=>{cn.add(a),i.addValidator(s,a)}}),i}var
|
|
350
|
-
new WeakMap,
|
|
351
|
-
`${t} must match ${
|
|
342
|
+
factories with conflicting ${r} "${n}".`)}N(e,n,o)}}function Ey(e,t,r){let n=by(r).filter(Boolean);if(n.length<1)return{
|
|
343
|
+
types:un(e),validators:un(t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=_y(s);if(!a)throw new Error(
|
|
344
|
+
"Factory sources must be schema instances or schema factories created by json-rest-schema.");Jc(o,a.types,"type"),Jc(i,a.
|
|
345
|
+
validators,"validator")}return{types:o,validators:i}}function Qc({types:e={},validators:t={},installCore:r=!0}={}){let n=un(
|
|
346
|
+
e),o=un(t),i=(s,a={})=>{let c=new At(s,n,o,a.operations);return Yc(c,n,o),c};return Yc(i,n,o),i.addType=(s,a)=>{yy(n,s,a)},
|
|
347
|
+
i.addValidator=(s,a)=>{wy(o,s,a)},i.use=s=>{Wc(s,{addType:i.addType,addValidator:i.addValidator})},i.createFactory=(...s)=>{
|
|
348
|
+
let a=Ey(n,o,s);return Qc({types:a.types,validators:a.validators,installCore:!1})},r&&Wc(Fc,{addType:(s,a)=>{cn.add(a),i.
|
|
349
|
+
addType(s,a)},addValidator:(s,a)=>{cn.add(a),i.addValidator(s,a)}}),i}var Kc,Xc,Zc,cn,L,rt=b(()=>{Dc();Hc();qc();or();Kc=
|
|
350
|
+
new WeakMap,Xc=new WeakMap,Zc=Symbol.for("json-rest-schema.registry-metadata"),cn=new WeakSet;L=Qc({installCore:!0})});var JP,eu=b(()=>{rt();U();JP=Object.freeze({schema:L({}),mode:"replace"})});var tu=b(()=>{U();sc();Xr();eu()});function Ty(e){return String(e||"").trim().toLowerCase()}function pi(e,t){let r=Ty(e);if(!ru.test(r))throw new TypeError(
|
|
351
|
+
`${t} must match ${ru.toString()}.`);return r}function ln(e,t){if(e==null)return Object.freeze({});if(!H(e))throw new TypeError(
|
|
352
352
|
`${t} must be an object mapping local names to capability ids.`);let r={},n=new Set;for(let[o,i]of Object.entries(e)){let s=String(
|
|
353
|
-
o||"").trim();if(!
|
|
353
|
+
o||"").trim();if(!vy.test(s))throw new TypeError(`${t} local name "${s}" must be a JavaScript identifier.`);let a=pi(i,`${t}\
|
|
354
354
|
.${s}`);if(n.has(a))throw new TypeError(`${t} declares capability "${a}" more than once.`);n.add(a),r[s]=a}return Object.
|
|
355
|
-
freeze(r)}function
|
|
355
|
+
freeze(r)}function Iy(e,t,r){if(e==null)return Object.freeze({});if(!H(e))throw new TypeError(`${r}.hints must be an obj\
|
|
356
356
|
ect mapping required capability ids to what to register.`);let n=new Set(Object.values(t)),o={};for(let[i,s]of Object.entries(
|
|
357
357
|
e)){let a=pi(i,`${r}.hints key`);if(!n.has(a))throw new TypeError(`${r}.hints names "${a}", which the provider does not \
|
|
358
358
|
require.`);if(typeof s!="string"||!s.trim())throw new TypeError(`${r}.hints["${a}"] must be the text that says what to r\
|
|
359
|
-
egister.`);o[a]=s.trim()}return Object.freeze(o)}function
|
|
359
|
+
egister.`);o[a]=s.trim()}return Object.freeze(o)}function Oy(e){let t=new Map;for(let[r,n]of Object.entries(e))for(let o of Object.
|
|
360
360
|
keys(n)){if(t.has(o))throw new TypeError(`Provider local name "${o}" is declared by both ${t.get(o)} and ${r}.`);t.set(o,
|
|
361
|
-
r)}}function
|
|
361
|
+
r)}}function Ry(e,t,r){for(let n of Object.values(t))for(let[o,i]of Object.entries(r))if(Object.values(i).includes(n))throw new TypeError(
|
|
362
362
|
o==="provides"?`Provider "${e}" cannot late-require capability "${n}" that it provides.`:`Provider "${e}" names capabili\
|
|
363
363
|
ty "${n}" under both late and ${o}.`)}function fi(e,t){if(e==null)return null;if(typeof e!="function")throw new TypeError(
|
|
364
364
|
`${t} must be a function when provided.`);return e}function dn({id:e,requires:t={},optional:r={},late:n={},provides:o={},
|
|
365
365
|
hints:i={},setup:s,boot:a=null,shutdown:c=null}={}){let u=pi(e,"Provider id"),d=ln(t,`${u}.requires`),p=ln(r,`${u}.optio\
|
|
366
|
-
nal`),g=ln(n,`${u}.late`),h=ln(o,`${u}.provides`);
|
|
366
|
+
nal`),g=ln(n,`${u}.late`),h=ln(o,`${u}.provides`);Oy({requires:d,optional:p,late:g,provides:h}),Ry(u,g,{provides:h,requires:d,
|
|
367
367
|
optional:p});let l=fi(s,`${u}.setup`);if(!l)throw new TypeError(`${u}.setup is required.`);return Object.freeze({id:u,requires:d,
|
|
368
|
-
optional:p,late:g,provides:h,hints:
|
|
369
|
-
|
|
368
|
+
optional:p,late:g,provides:h,hints:Iy(i,{...d,...g},u),setup:l,boot:fi(a,`${u}.boot`),shutdown:fi(c,`${u}.shutdown`)})}var ru,
|
|
369
|
+
vy,mi=b(()=>{U();ru=/^[a-z][a-z0-9_.-]*$/u,vy=/^[A-Za-z_$][A-Za-z0-9_$]*$/u});var nu,ou=b(()=>{nu="public"});var iu=b(()=>{});var au=b(()=>{U()});var Ay,cu,uu=b(()=>{iu();au();Ay="/api",cu=`${Ay}/bootstrap`});function hi(){let e=[],t=new Set,r=!1;function n({id:a,order:c=0,contribute:u}={}){if(r)throw new Error("Bootstrap regis\
|
|
370
370
|
tration is closed after the first payload is resolved.");let d=F(a);if(!d)throw new TypeError("Bootstrap contributor id \
|
|
371
371
|
is required.");if(typeof u!="function")throw new TypeError(`Bootstrap contributor "${d}" requires contribute().`);if(t.has(
|
|
372
372
|
d))throw new Error(`Bootstrap contributor "${d}" is duplicated.`);return t.add(d),e.push(Object.freeze({id:d,order:Number.
|
|
@@ -374,91 +374,91 @@ isFinite(c)?Number(c):0,contribute:u})),s}async function o(a={}){r=!0;let c={},u
|
|
|
374
374
|
(d,p)=>d.entry.order-p.entry.order||d.index-p.index).map(({entry:d})=>d);for(let d of u){let p=await d.contribute(Object.
|
|
375
375
|
freeze({...H(a)?a:{},payload:Object.freeze({...c})}));c={...c,...H(p)?p:{}}}return Object.freeze(c)}function i(){return Object.
|
|
376
376
|
freeze({sealed:r,contributorIds:Object.freeze(e.map(a=>a.id).sort())})}let s=Object.freeze({register:n,resolve:o,diagnostics:i});
|
|
377
|
-
return s}var gi=b(()=>{U()});var
|
|
378
|
-
untime.bootstrap"},setup({http:e}){let t=hi();return e.router.register("GET",
|
|
377
|
+
return s}var gi=b(()=>{U()});var Py,lu=b(()=>{mi();ou();uu();gi();Py=dn({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"r\
|
|
378
|
+
untime.bootstrap"},setup({http:e}){let t=hi();return e.router.register("GET",cu,{auth:nu,meta:{tags:["bootstrap"],summary:"\
|
|
379
379
|
Resolve app bootstrap payload"}},async(r,n)=>{n.code(200).send(await t.resolve({request:r,reply:n,query:r.query||{}}))}),
|
|
380
|
-
{bootstrap:t}}})});function
|
|
380
|
+
{bootstrap:t}}})});function Cy(e){if(!H(e))throw new TypeError("Event listener must be an object.");let t=String(e.id||"").trim();if(!t)throw new TypeError(
|
|
381
381
|
"Event listener id is required.");if(typeof e.handle!="function")throw new TypeError(`Event listener "${t}" requires han\
|
|
382
382
|
dle().`);if(e.matches!=null&&typeof e.matches!="function")throw new TypeError(`Event listener "${t}" matches must be a f\
|
|
383
|
-
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function
|
|
383
|
+
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function Ny(e){if(!H(e))throw new TypeError(
|
|
384
384
|
"Published event must be an object.");let t=String(e.type||"").trim();if(!t)throw new TypeError("Published event type is\
|
|
385
|
-
required.");return Object.freeze({...e,type:t})}function yi(){let e=[],t=new Set;function r(s){let a=
|
|
386
|
-
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function n(s){let a=
|
|
385
|
+
required.");return Object.freeze({...e,type:t})}function yi(){let e=[],t=new Set;function r(s){let a=Cy(s);if(t.has(a.id))
|
|
386
|
+
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function n(s){let a=Ny(s);
|
|
387
387
|
for(let c of e)c.matches&&c.matches(a)!==!0||await c.handle(a);return a}function o(){return Object.freeze({listenerIds:Object.
|
|
388
|
-
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:r,publish:n,diagnostics:o});return i}var wi=b(()=>{U()});var
|
|
388
|
+
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:r,publish:n,diagnostics:o});return i}var wi=b(()=>{U()});var jy,du=b(()=>{mi();wi();jy=dn({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:yi()}}})});var Ve=b(()=>{Xr();ic();tu();lu();gi();du();wi()});var fu=b(()=>{});function pu(e,t={}){let{missingStatus:r=404}=t,n=e?.errors?.[0]?.code||e?.code||"";return n==="vibe64_session_not_found"?
|
|
389
389
|
r:n.startsWith("vibe64_invalid")?400:n==="vibe64_command_requires_terminal"||n==="vibe64_agent_write_mode_busy"||n==="vi\
|
|
390
390
|
be64_agent_attachment_session_unavailable"||n==="vibe64_project_not_selected"||n==="vibe64_project_not_ready"||n==="vibe\
|
|
391
391
|
64_project_source_lock_timeout"||n==="vibe64_development_database_scope_busy"||n==="vibe64_project_session_policy_lock_t\
|
|
392
392
|
imeout"||n==="vibe64_session_creation_limit"||n==="vibe64_workspace_setup_retry_not_available"||n==="vibe64_workspace_se\
|
|
393
|
-
tup_running"?409:e?.ok===!1?400:200}var
|
|
394
|
-
|
|
395
|
-
if(!Jr.includes(r))throw
|
|
396
|
-
let n=String(t.value||"").trim(),o=r===tr?n.toLowerCase():n;if(!o)throw
|
|
397
|
-
64_preview_identity_selector_missing");if(r===tr&&(!o.includes("@")||o.length>320))throw
|
|
398
|
-
nvalid.","vibe64_preview_identity_email_invalid");if(r!==tr&&o.length>256)throw
|
|
393
|
+
tup_running"?409:e?.ok===!1?400:200}var mu=b(()=>{});function Te(e,t,r={}){let{status:n=pu({ok:!1,code:t}),...o}=r;return new ie(n,e,{...o,code:t})}var le=b(()=>{Ve();U();fu();
|
|
394
|
+
mu()});import xy from"node:crypto";function ky(e={}){let t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=String(t.type||"").trim();
|
|
395
|
+
if(!Jr.includes(r))throw Te("Preview identity selector type is invalid.","vibe64_preview_identity_selector_type_invalid");
|
|
396
|
+
let n=String(t.value||"").trim(),o=r===tr?n.toLowerCase():n;if(!o)throw Te("Preview identity selector is missing.","vibe\
|
|
397
|
+
64_preview_identity_selector_missing");if(r===tr&&(!o.includes("@")||o.length>320))throw Te("Preview identity email is i\
|
|
398
|
+
nvalid.","vibe64_preview_identity_email_invalid");if(r!==tr&&o.length>256)throw Te(r===Yr?"Preview identity login is inv\
|
|
399
399
|
alid.":"Preview identity user id is invalid.",r===Yr?"vibe64_preview_identity_login_invalid":"vibe64_preview_identity_us\
|
|
400
|
-
er_id_invalid");return{type:r,value:o}}function
|
|
401
|
-
t,"subject"))throw
|
|
402
|
-
ct_unsupported");let r=String(t.operation||
|
|
403
|
-
valid.","vibe64_preview_identity_operation_invalid");return{operation:r,...r===
|
|
404
|
-
Pt,
|
|
405
|
-
guest","you"]),
|
|
400
|
+
er_id_invalid");return{type:r,value:o}}function wu(e={}){let t=e&&typeof e=="object"&&!Array.isArray(e)?e:{};if(Object.hasOwn(
|
|
401
|
+
t,"subject"))throw Te("Preview identity login requires an explicit application selector.","vibe64_preview_identity_subje\
|
|
402
|
+
ct_unsupported");let r=String(t.operation||be).trim();if(![be,Pt].includes(r))throw Te("Preview identity operation is in\
|
|
403
|
+
valid.","vibe64_preview_identity_operation_invalid");return{operation:r,...r===be?{selector:ky(t.selector)}:{}}}var JC,be,
|
|
404
|
+
Pt,hu,gu,yu,KC,_i=b(()=>{oc();le();JC=xy.randomBytes(32),be="login-as",Pt="logout",hu="selector",gu=new Set(["default","\
|
|
405
|
+
guest","you"]),yu=32,KC=Object.freeze(["projectScope","sessionSourceRoot","sessionId","targetHref","terminalSessionId"])});var ar,bi=b(()=>{ar="vibe64_preview_token"});import{randomUUID as $y}from"node:crypto";import{VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL as _u}from"@local/vibe64-genesis/server";
|
|
406
406
|
function Ct(e="",t="vibe64_preview_identity_command_failed",r=502,n={}){return new ie(r,e||"Application preview identity\
|
|
407
|
-
command failed.",{code:t,params:n})}function
|
|
408
|
-
targetHref:n=""}=t,o=
|
|
409
|
-
"Application preview identity target must use HTTP.");return{operation:o.operation,protocol:
|
|
410
|
-
operation===
|
|
407
|
+
command failed.",{code:t,params:n})}function My(e={}){return{kind:hu,selector:e.selector}}function Eu(e={},t={}){let{requestId:r=$y(),
|
|
408
|
+
targetHref:n=""}=t,o=wu(e),i=String(n||"").trim(),s=new URL(i);if(!["http:","https:"].includes(s.protocol))throw new Error(
|
|
409
|
+
"Application preview identity target must use HTTP.");return{operation:o.operation,protocol:_u,requestId:String(r),...o.
|
|
410
|
+
operation===be?{subject:My(o)}:{},target:{href:s.toString(),origin:s.origin}}}function Dy(e=[]){if(!Array.isArray(e))throw Ct(
|
|
411
411
|
"Application preview identity command returned invalid cookies.","vibe64_preview_identity_command_cookies_invalid");let t=e;
|
|
412
412
|
if(t.length>Ei)throw Ct("Application preview identity command returned too many cookies.","vibe64_preview_identity_comma\
|
|
413
413
|
nd_cookies_too_many");return t.map((r,n)=>{let o=String(r||""),i=o.split(";",1)[0]||"",s=i.indexOf("="),a=(s<0?i:i.slice(
|
|
414
|
-
0,s)).trim();if(!o||Buffer.byteLength(o)>Si||/[\r\n]/u.test(o)||s<1||!
|
|
414
|
+
0,s)).trim();if(!o||Buffer.byteLength(o)>Si||/[\r\n]/u.test(o)||s<1||!Ly.test(a)||a===cr||a.startsWith(`${cr}_`)||/(?:^|;)\s*domain\s*=/iu.
|
|
415
415
|
test(o))throw Ct(`Application preview identity command returned invalid cookie ${n+1}.`,"vibe64_preview_identity_command\
|
|
416
|
-
_cookie_invalid",502,{cookie:n+1});return o})}function
|
|
416
|
+
_cookie_invalid",502,{cookie:n+1});return o})}function Vy(e=null){if(!e||typeof e!="object"||Array.isArray(e))return null;
|
|
417
417
|
let t={displayName:String(e.displayName||e.name||"").trim().slice(0,256),email:String(e.email||"").trim().toLowerCase().
|
|
418
418
|
slice(0,320),login:String(e.login||"").trim().slice(0,256),userId:String(e.userId||e.id||"").trim().slice(0,256),username:String(
|
|
419
|
-
e.username||"").trim().slice(0,256)};return Object.values(t).some(Boolean)?t:null}function
|
|
419
|
+
e.username||"").trim().slice(0,256)};return Object.values(t).some(Boolean)?t:null}function Uy(e={},t={}){let{operation:r=be,
|
|
420
420
|
requestId:n=""}=t;if(!e||typeof e!="object"||Array.isArray(e))throw Ct("Application preview identity command returned in\
|
|
421
|
-
valid JSON.","vibe64_preview_identity_command_json_invalid");if(e.protocol!==
|
|
421
|
+
valid JSON.","vibe64_preview_identity_command_json_invalid");if(e.protocol!==_u||String(e.requestId||"")!==String(n||"")||
|
|
422
422
|
typeof e.ok!="boolean")throw Ct("Application preview identity command returned an invalid protocol response.","vibe64_pr\
|
|
423
|
-
eview_identity_command_response_invalid");let o
|
|
423
|
+
eview_identity_command_response_invalid");let o=Dy(e.setCookie);if(e.ok===!1){let a=Number(e.statusCode);return{code:String(
|
|
424
424
|
e.code||"vibe64_preview_identity_application_rejected").trim().slice(0,128),error:String(e.error||"Application preview i\
|
|
425
425
|
dentity was rejected.").trim().slice(0,2e3),ok:!1,setCookie:o,signedOut:e.signedOut===!0,statusCode:Number.isInteger(a)&&
|
|
426
|
-
a>=400&&a<600?a:400}}let i=r===Pt||e.signedOut===!0,s=i?null:
|
|
426
|
+
a>=400&&a<600?a:400}}let i=r===Pt||e.signedOut===!0,s=i?null:Vy(e.identity);if(o.length<1||!i&&!s)throw Ct("Application \
|
|
427
427
|
preview identity command did not return an authenticated browser session.","vibe64_preview_identity_command_session_miss\
|
|
428
|
-
ing");return{identity:s,ok:!0,setCookie:o,signedOut:i,statusCode:200}}var
|
|
429
|
-
512*1024,Ei=64,Si=16*1024,cr=ar,
|
|
428
|
+
ing");return{identity:s,ok:!0,setCookie:o,signedOut:i,statusCode:200}}var bu,Ei,Si,cr,Ly,oN,Su=b(()=>{Ve();_i();bi();bu=
|
|
429
|
+
512*1024,Ei=64,Si=16*1024,cr=ar,Ly=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u;oN=Object.freeze({normalizePreviewIdentityCommandResponse:Uy})});var vu=b(()=>{});function Tu(e=""){return Fy.find(t=>t.pattern.test(String(e)))?.kind||""}function Wy(e){if(!xe(e)||e.startsWith("/")||e.
|
|
430
430
|
includes("\\")||e.includes("\0"))return!1;let t=e.split("/");return t.every(r=>r&&r!=="."&&r!=="..")&&!t.includes("node_\
|
|
431
|
-
modules")}var
|
|
432
|
-
directory:"VIBE64_USAGE_RECORDING_DIR",sourceRoot:"VIBE64_USAGE_SOURCE_ROOT",targetKind:"VIBE64_USAGE_TARGET_KIND"}),
|
|
433
|
-
Object.freeze(["starting","recording","stopping","stopped","failed","unavailable"]),
|
|
434
|
-
it","request-limit","size-limit","target-exited","session-ended","error"]),
|
|
435
|
-
1024*1024,
|
|
431
|
+
modules")}var By,aN,zy,Gy,Ou,ur,cN,uN,lN,Fy,Hy,qy,fn,xe,Iu,dN,fN,Ru=b(()=>{By="vibe64.usage-trace.v1",aN=Object.freeze({
|
|
432
|
+
directory:"VIBE64_USAGE_RECORDING_DIR",sourceRoot:"VIBE64_USAGE_SOURCE_ROOT",targetKind:"VIBE64_USAGE_TARGET_KIND"}),zy=
|
|
433
|
+
Object.freeze(["starting","recording","stopping","stopped","failed","unavailable"]),Gy=Object.freeze(["person","time-lim\
|
|
434
|
+
it","request-limit","size-limit","target-exited","session-ended","error"]),Ou=Object.freeze(["nodejs","python","php"]),ur=
|
|
435
|
+
1024*1024,cN=Object.freeze({durationMs:600*1e3,capturedRequests:2e3,hitsBytesPerProcess:16*ur,hitsBytesPerRecording:32*ur,
|
|
436
436
|
proxyRequestLines:2e4,interactions:500,bufferedBytesPerProcess:64*ur,flushIntervalMs:1e3,flushEntries:2e3,traceLineBytes:64*
|
|
437
|
-
1024,indexBytes:4*ur,plumbingShare:.8,plumbingMinimumRequests:3}),
|
|
438
|
-
60*1e3}),
|
|
437
|
+
1024,indexBytes:4*ur,plumbingShare:.8,plumbingMinimumRequests:3}),uN=Object.freeze({maxRecordings:10,maxBytes:64*ur,maxAgeMs:10080*
|
|
438
|
+
60*1e3}),lN=Object.freeze(["click","enter","submit"]),Fy=Object.freeze([Object.freeze({kind:"request",pattern:/^r_[0-9]{6}$/u}),
|
|
439
439
|
Object.freeze({kind:"local-request",pattern:/^l_[0-9]+_[0-9]+$/u}),Object.freeze({kind:"run",pattern:/^run_[0-9]+$/u}),Object.
|
|
440
|
-
freeze({kind:"background",pattern:/^bg_[0-9]+$/u})]),
|
|
441
|
-
isSafeInteger(e)&&e>=0,
|
|
442
|
-
e.column)&&e.column>0;
|
|
443
|
-
e.pid)&&e.pid>0&&
|
|
444
|
-
function:e=>fn(e.functionIndex)&&fn(e.fileIndex)&&typeof e.name=="string"&&
|
|
445
|
-
e.kind&&
|
|
446
|
-
e.kind)),hits:e=>
|
|
447
|
-
(t[1]===null||Number.isSafeInteger(t[1])&&t[1]>0)),diagnostic:e=>
|
|
448
|
-
e.reason)}),
|
|
449
|
-
return
|
|
440
|
+
freeze({kind:"background",pattern:/^bg_[0-9]+$/u})]),Hy=/^sha256:[0-9a-f]{64}$/u,qy=Object.freeze(["ready","idle"]);fn=e=>Number.
|
|
441
|
+
isSafeInteger(e)&&e>=0,xe=e=>typeof e=="string"&&e.length>0,Iu=e=>!!e&&Number.isSafeInteger(e.line)&&e.line>0&&Number.isSafeInteger(
|
|
442
|
+
e.column)&&e.column>0;dN=Object.freeze({header:e=>e.schema===By&&Ou.includes(e.runtime)&&xe(e.runtimeVersion)&&Number.isSafeInteger(
|
|
443
|
+
e.pid)&&e.pid>0&&xe(e.startedAt),tracer:e=>qy.includes(e.state),file:e=>fn(e.fileIndex)&&Wy(e.path)&&Hy.test(e.hash||""),
|
|
444
|
+
function:e=>fn(e.functionIndex)&&fn(e.fileIndex)&&typeof e.name=="string"&&Iu(e.start)&&Iu(e.end),scope:e=>Tu(e.scope)===
|
|
445
|
+
e.kind&&xe(e.startedAt)&&(e.endedAt===void 0||xe(e.endedAt))&&(e.label===void 0||xe(e.label)&&["local-request","run"].includes(
|
|
446
|
+
e.kind)),hits:e=>Tu(e.scope)!==""&&Array.isArray(e.counts)&&e.counts.every(t=>Array.isArray(t)&&t.length===2&&fn(t[0])&&
|
|
447
|
+
(t[1]===null||Number.isSafeInteger(t[1])&&t[1]>0)),diagnostic:e=>xe(e.code)&&(e.path===void 0||xe(e.path)),truncated:e=>xe(
|
|
448
|
+
e.reason)}),fN=Object.freeze({USAGE_RECORDING_STATES:zy,USAGE_RECORDING_STOP_REASONS:Gy,USAGE_TRACER_RUNTIMES:Ou})});function Yy(e=""){try{let t=new URL(e),r=t.protocol==="https:",n=t.port||(r?"443":"80");return`${r?"__Host-":""}${Au}_${n}`}catch{
|
|
449
|
+
return Au}}function Jy(e="",t={}){let{proxyOrigin:r="",targetOrigin:n=""}=t,o=String(e||"").trim();if(!o||!r||!n)return o;
|
|
450
450
|
try{let i=new URL(o,n),s=new URL(r),a=new URL(n);return a.protocol=s.protocol,i.origin!==n&&i.origin!==a.origin?o:(s.pathname=
|
|
451
|
-
i.pathname,s.search=
|
|
451
|
+
i.pathname,s.search=Ky(i.search),s.hash=i.hash,s.toString())}catch{return o}}function Ky(e=""){let t=String(e||"");if(!t||
|
|
452
452
|
t==="?")return"";let r=t.startsWith("?")?t.slice(1):t;if(!r)return"";let n=r.split("&").filter(o=>{let i=o.indexOf("="),
|
|
453
|
-
s=i<0?o:o.slice(0,i);return
|
|
454
|
-
String(e||"").replace(/\+/gu," "))}catch{return String(e||"")}}var
|
|
455
|
-
|
|
456
|
-
_i();
|
|
457
|
-
11",
|
|
458
|
-
73/"}),
|
|
459
|
-
identity:{displayName:"Admin",email:"admin@example.com",userId:"1"}}),
|
|
460
|
-
user_not_found",error:"No active user has that email.",statusCode:404,setCookie:[]})
|
|
461
|
-
entity-command",title:"Preview identity command protocol",exampleRequest:
|
|
453
|
+
s=i<0?o:o.slice(0,i);return Xy(s)!==ar});return n.length>0?`?${n.join("&")}`:""}function Xy(e=""){try{return decodeURIComponent(
|
|
454
|
+
String(e||"").replace(/\+/gu," "))}catch{return String(e||"")}}var Au,Pu,bN,Cu=b(()=>{vu();Ru();bi();Au=ar,Pu=/^vibe64-launch-[a-f0-9]{12}$/u;
|
|
455
|
+
bN=Object.freeze({previewTokenCookieName:Yy,proxiedLocation:Jy})});import{VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL as pn}from"@local/vibe64-genesis/server";var vi,Nu,Ti,ju,xu,ku,$u,Lu=b(()=>{
|
|
456
|
+
_i();Su();Cu();vi=e=>JSON.stringify(e,null,2),Nu=Jr.map(e=>`\`${e}\``).join(", "),Ti="6f1c2a7e-3d4b-4c55-9a10-2b7d8e9f0a\
|
|
457
|
+
11",ju=Eu({operation:be,selector:{type:"email",value:"admin@example.com"}},{requestId:Ti,targetHref:"http://127.0.0.1:51\
|
|
458
|
+
73/"}),xu=Object.freeze({protocol:pn,requestId:Ti,ok:!0,setCookie:["app_session=abc123; Path=/; HttpOnly; SameSite=Lax"],
|
|
459
|
+
identity:{displayName:"Admin",email:"admin@example.com",userId:"1"}}),ku=Object.freeze({protocol:pn,requestId:Ti,ok:!1,code:"\
|
|
460
|
+
user_not_found",error:"No active user has that email.",statusCode:404,setCookie:[]}),$u=Object.freeze([{name:"preview-id\
|
|
461
|
+
entity-command",title:"Preview identity command protocol",exampleRequest:ju,exampleResponses:[xu,ku],text:()=>`# Preview\
|
|
462
462
|
identity command protocol (\`${pn}\`)
|
|
463
463
|
|
|
464
464
|
An application-owned executable, declared under an Outputs web target's \`#### Preview identity\` block (grammar: \`vibe64-\
|
|
@@ -473,24 +473,24 @@ adds only the Enabled and Secret names, not the project's Env values, so the com
|
|
|
473
473
|
ration itself (for example its generated environment file). For an enabled run the declared Enabled environment name is \
|
|
474
474
|
\`true\` and the Secret environment name holds a fresh per-run secret. Keep the exchange disabled unless both are present;\
|
|
475
475
|
it is a development-preview control, never a sign-in API of a published application.
|
|
476
|
-
- stdin: one JSON request line. stdout: one JSON response (at most ${
|
|
476
|
+
- stdin: one JSON request line. stdout: one JSON response (at most ${bu} bytes). Exit 0 after writing the response; a no\
|
|
477
477
|
n-zero exit or timeout fails the exchange. Write diagnostics to stderr.
|
|
478
478
|
- Use the same database and configuration as the server behind \`target.origin\` (for a test target, its test database).
|
|
479
479
|
- A JSKIT application's executable can call \`runManagedPreviewIdentityCommand\` from \`@jskit-ai/auth-web/server/managedPr\
|
|
480
480
|
eviewIdentity\`. Pass it the application's environment, this protocol and the Preview's launch hostnames, since it reads \
|
|
481
481
|
no environment on its own and its defaults are JSKIT's neutral protocol and loopback only: \`runManagedPreviewIdentityCom\
|
|
482
|
-
mand({ env: process.env, protocol: "${pn}", localHostnames: [${
|
|
482
|
+
mand({ env: process.env, protocol: "${pn}", localHostnames: [${Pu}] })\`.
|
|
483
483
|
|
|
484
484
|
## Request
|
|
485
485
|
|
|
486
|
-
- \`operation\`: \`${
|
|
486
|
+
- \`operation\`: \`${be}\` or \`${Pt}\`.
|
|
487
487
|
- \`protocol\`, \`requestId\`: echo both in the response.
|
|
488
|
-
- \`subject\` (${
|
|
488
|
+
- \`subject\` (${be} only): \`{"kind":"selector","selector":{"type":\u2026,"value":\u2026}}\` with type ${Nu}. Email val\
|
|
489
489
|
ues arrive lowercased.
|
|
490
490
|
- \`target\`: \`{"href","origin"}\` of the application page the cookies are for.
|
|
491
491
|
|
|
492
492
|
\`\`\`json
|
|
493
|
-
${vi(
|
|
493
|
+
${vi(ju)}
|
|
494
494
|
\`\`\`
|
|
495
495
|
|
|
496
496
|
## Response
|
|
@@ -498,26 +498,26 @@ ${vi(Cu)}
|
|
|
498
498
|
- Always: \`protocol\`, the same \`requestId\`, boolean \`ok\`, and \`setCookie\`: an array of complete Set-Cookie header values\
|
|
499
499
|
(at most ${Ei}, each at most ${Si} bytes, no line breaks, no \`Domain\` attribute, never named \`${cr}\` or \`${cr}_*\`)\
|
|
500
500
|
.
|
|
501
|
-
- \`ok: true\`: at least one cookie. For ${
|
|
501
|
+
- \`ok: true\`: at least one cookie. For ${be}, \`identity\` with at least one of \`displayName\`, \`email\`, \`login\`, \`userId\
|
|
502
502
|
\`, \`username\`. For ${Pt} (or \`"signedOut": true\`), the cookies that clear the session.
|
|
503
503
|
- \`ok: false\`: \`code\` (at most 128 characters), \`error\` (a person-readable reason, at most 2000), \`statusCode\` 400 throu\
|
|
504
504
|
gh 599 (default 400), optional \`signedOut\`, and \`setCookie\` (may be empty).
|
|
505
505
|
|
|
506
506
|
\`\`\`json
|
|
507
|
-
${vi(
|
|
507
|
+
${vi(xu)}
|
|
508
508
|
\`\`\`
|
|
509
509
|
|
|
510
510
|
\`\`\`json
|
|
511
|
-
${vi(
|
|
511
|
+
${vi(ku)}
|
|
512
512
|
\`\`\`
|
|
513
513
|
`},{name:"preview-identities",title:"Managed app identities",text:()=>`# Managed app identities
|
|
514
514
|
|
|
515
515
|
The ordered list of named existing application accounts that Preview and managed Playwright can sign in as through the a\
|
|
516
516
|
pplication's Preview identity command (\`vibe64-helper spec preview-identity-command\`).
|
|
517
517
|
|
|
518
|
-
- Each entry has a \`name\`, a selector \`type\` (${
|
|
519
|
-
e, start with a lowercase letter and use at most 64 lowercase letters, digits, \`_\` or \`-\`; ${[...
|
|
520
|
-
join(", ")} are reserved. At most ${
|
|
518
|
+
- Each entry has a \`name\`, a selector \`type\` (${Nu}) and the application's \`value\` for that account. Names are uniqu\
|
|
519
|
+
e, start with a lowercase letter and use at most 64 lowercase letters, digits, \`_\` or \`-\`; ${[...gu].map(e=>`\`${e}\``).
|
|
520
|
+
join(", ")} are reserved. At most ${yu} entries; the first is the default.
|
|
521
521
|
- Entries are selectors only, never passwords. A saved entry does not prove that the account exists or can reach a page:\
|
|
522
522
|
verify the selected account's actual Preview access.
|
|
523
523
|
- Read the list and the Stack's declared types with \`vibe64-helper preview identities\`; \`vibe64-helper preview status\` s\
|
|
@@ -536,157 +536,157 @@ Entry shape:
|
|
|
536
536
|
\`\`\`json
|
|
537
537
|
{"name":"admin","type":"email","value":"admin@example.com"}
|
|
538
538
|
\`\`\`
|
|
539
|
-
`}])});var
|
|
540
|
-
function
|
|
539
|
+
`}])});var Du={};zo(Du,{__testables:()=>rw,runAgentSpecCli:()=>tw});import{readFile as Qy}from"node:fs/promises";import{VIBE64_GENESIS_AGENT_SPECS as ew}from"@local/vibe64-genesis/server/agentSpecs";
|
|
540
|
+
function Mu(){let e=Math.max(...mn.map(({name:t})=>t.length));return["Usage: vibe64 spec <name>","","Vibe64-owned contra\
|
|
541
541
|
cts:",...mn.map(({name:t,title:r})=>` ${t.padEnd(e)} ${r}`)].join(`
|
|
542
|
-
`)}async function
|
|
542
|
+
`)}async function tw(e=[],{write:t=n=>process.stdout.write(`${n.trimEnd()}
|
|
543
543
|
`),writeError:r=n=>process.stderr.write(`${n.trimEnd()}
|
|
544
|
-
`)}={}){let[n]=e;if(!n||n==="--help"||n==="-h")return t(
|
|
544
|
+
`)}={}){let[n]=e;if(!n||n==="--help"||n==="-h")return t(Mu()),0;let o=e.length===1&&mn.find(i=>i.name===n);return o?(t(await o.
|
|
545
545
|
text()),0):(r(`Unknown Vibe64 spec: ${e.join(" ")}.
|
|
546
546
|
|
|
547
|
-
${
|
|
548
|
-
freeze([...
|
|
549
|
-
e",text:()=>
|
|
547
|
+
${Mu()}`),2)}var Zy,mn,rw,Vu=b(()=>{nc();Lu();Zy=new URL("./../server/lib/agentSpecCli.js",import.meta.url).href,mn=Object.
|
|
548
|
+
freeze([...ew,...$u,...rc,{name:"training-content",title:"Teaching content format for vibe64 training validate and bundl\
|
|
549
|
+
e",text:()=>Qy(new URL("../../docs/training-content.md",Zy),"utf8")}]);rw=Object.freeze({VIBE64_AGENT_SPECS:mn})});var Uu=b(()=>{});import{lstat as nw,readdir as ow}from"node:fs/promises";import lr from"node:path";async function Ii(e){if(!lr.isAbsolute(
|
|
550
550
|
e||"")||lr.resolve(e)===lr.parse(e).root)throw new Error("Project state inventory requires an absolute, non-root system \
|
|
551
|
-
directory.");let t=lr.join(e,hn),r;try{if(!(await
|
|
552
|
-
a regular projects directory.");r=await
|
|
551
|
+
directory.");let t=lr.join(e,hn),r;try{if(!(await nw(t)).isDirectory())throw new Error("Project state inventory requires\
|
|
552
|
+
a regular projects directory.");r=await ow(t,{withFileTypes:!0})}catch(n){if(n.code==="ENOENT")return[];throw n}if(r.some(
|
|
553
553
|
n=>n.isSymbolicLink()))throw new Error("Project state inventory contains a symbolic link. Inspect it before upgrading.");
|
|
554
|
-
return r.filter(n=>n.isDirectory()).map(n=>lr.join(t,n.name)).sort()}var hn,Ue=b(()=>{le();
|
|
555
|
-
function"){let r=e.cause();return dr(r)?r:void 0}else return dr(t)?t:void 0},
|
|
554
|
+
return r.filter(n=>n.isDirectory()).map(n=>lr.join(t,n.name)).sort()}var hn,Ue=b(()=>{le();Uu();U();hn="projects"});var Ri=z((BN,Gu)=>{"use strict";var dr=e=>e&&typeof e.message=="string",Oi=e=>{if(!e)return;let t=e.cause;if(typeof t=="\
|
|
555
|
+
function"){let r=e.cause();return dr(r)?r:void 0}else return dr(t)?t:void 0},Bu=(e,t)=>{if(!dr(e))return"";let r=e.stack||
|
|
556
556
|
"";if(t.has(e))return r+`
|
|
557
557
|
causes have become circular...`;let n=Oi(e);return n?(t.add(e),r+`
|
|
558
|
-
caused by: `+
|
|
559
|
-
": ...";let o=Oi(e);if(o){t.add(e);let i=typeof e.cause=="function";return n+(i?"":": ")+
|
|
560
|
-
e,new Set);
|
|
558
|
+
caused by: `+Bu(n,t)):r},iw=e=>Bu(e,new Set),zu=(e,t,r)=>{if(!dr(e))return"";let n=r?"":e.message||"";if(t.has(e))return n+
|
|
559
|
+
": ...";let o=Oi(e);if(o){t.add(e);let i=typeof e.cause=="function";return n+(i?"":": ")+zu(o,t,i)}else return n},sw=e=>zu(
|
|
560
|
+
e,new Set);Gu.exports={isErrorLike:dr,getErrorCause:Oi,stackWithCauses:iw,messageWithCauses:sw}});var Ai=z((zN,Hu)=>{"use strict";var aw=Symbol("circular-ref-tag"),gn=Symbol("pino-raw-err-ref"),Fu=Object.create({},{type:{
|
|
561
561
|
enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,
|
|
562
562
|
value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[gn]},
|
|
563
|
-
set:function(e){this[gn]=e}}});Object.defineProperty(
|
|
564
|
-
seen:
|
|
565
|
-
pinoErrorSymbols:
|
|
566
|
-
create(
|
|
567
|
-
isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>Ci(r)));for(let r in e)if(t[r]===void 0){let n=e[r];
|
|
568
|
-
se"&&!Object.prototype.hasOwnProperty.call(n,Pi)&&(t[r]=Ci(n)):t[r]=n}return delete e[Pi],t.raw=e,t}});var
|
|
569
|
-
{toString:
|
|
563
|
+
set:function(e){this[gn]=e}}});Object.defineProperty(Fu,gn,{writable:!0,value:{}});Hu.exports={pinoErrProto:Fu,pinoErrorSymbols:{
|
|
564
|
+
seen:aw,rawSymbol:gn}}});var Yu=z((GN,Wu)=>{"use strict";Wu.exports=Ci;var{messageWithCauses:cw,stackWithCauses:uw,isErrorLike:qu}=Ri(),{pinoErrProto:lw,
|
|
565
|
+
pinoErrorSymbols:dw}=Ai(),{seen:Pi}=dw,{toString:fw}=Object.prototype;function Ci(e){if(!qu(e))return e;e[Pi]=void 0;let t=Object.
|
|
566
|
+
create(lw);t.type=fw.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=cw(e),t.stack=uw(e),Array.
|
|
567
|
+
isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>Ci(r)));for(let r in e)if(t[r]===void 0){let n=e[r];qu(n)?r!=="cau\
|
|
568
|
+
se"&&!Object.prototype.hasOwnProperty.call(n,Pi)&&(t[r]=Ci(n)):t[r]=n}return delete e[Pi],t.raw=e,t}});var Ku=z((FN,Ju)=>{"use strict";Ju.exports=wn;var{isErrorLike:Ni}=Ri(),{pinoErrProto:pw,pinoErrorSymbols:mw}=Ai(),{seen:yn}=mw,
|
|
569
|
+
{toString:hw}=Object.prototype;function wn(e){if(!Ni(e))return e;e[yn]=void 0;let t=Object.create(pw);t.type=hw.call(e.constructor)===
|
|
570
570
|
"[object Function]"?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=
|
|
571
571
|
e.errors.map(r=>wn(r))),Ni(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,yn)&&(t.cause=wn(e.cause));for(let r in e)
|
|
572
572
|
if(t[r]===void 0){let n=e[r];Ni(n)?Object.prototype.hasOwnProperty.call(n,yn)||(t[r]=wn(n)):t[r]=n}return delete e[yn],t.
|
|
573
|
-
raw=e,t}});var
|
|
573
|
+
raw=e,t}});var el=z((HN,Qu)=>{"use strict";Qu.exports={mapHttpRequest:gw,reqSerializer:Zu};var ji=Symbol("pino-raw-req-ref"),Xu=Object.
|
|
574
574
|
create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,
|
|
575
575
|
value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,
|
|
576
576
|
writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},
|
|
577
|
-
raw:{enumerable:!1,get:function(){return this[ji]},set:function(e){this[ji]=e}}});Object.defineProperty(
|
|
578
|
-
value:{}});function
|
|
577
|
+
raw:{enumerable:!1,get:function(){return this[ji]},set:function(e){this[ji]=e}}});Object.defineProperty(Xu,ji,{writable:!0,
|
|
578
|
+
value:{}});function Zu(e){let t=e.info||e.socket,r=Object.create(Xu);if(r.id=typeof e.id=="function"?e.id():e.id||(e.info?
|
|
579
579
|
e.info.id:void 0),r.method=e.method,e.originalUrl)r.url=e.originalUrl;else{let n=e.path;r.url=typeof n=="string"?n:e.url?
|
|
580
580
|
e.url.path||e.url:void 0}return e.query&&(r.query=e.query),e.params&&(r.params=e.params),r.headers=e.headers,r.remoteAddress=
|
|
581
|
-
t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}function
|
|
581
|
+
t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}function gw(e){return{req:Zu(e)}}});var ol=z((qN,nl)=>{"use strict";nl.exports={mapHttpResponse:yw,resSerializer:rl};var xi=Symbol("pino-raw-res-ref"),tl=Object.
|
|
582
582
|
create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,
|
|
583
|
-
get:function(){return this[xi]},set:function(e){this[xi]=e}}});Object.defineProperty(
|
|
584
|
-
let t=Object.create(
|
|
585
|
-
t.raw=e,t}function
|
|
583
|
+
get:function(){return this[xi]},set:function(e){this[xi]=e}}});Object.defineProperty(tl,xi,{writable:!0,value:{}});function rl(e){
|
|
584
|
+
let t=Object.create(tl);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,
|
|
585
|
+
t.raw=e,t}function yw(e){return{res:rl(e)}}});var $i=z((WN,il)=>{"use strict";var ki=Yu(),ww=Ku(),_n=el(),bn=ol();il.exports={err:ki,errWithCause:ww,mapHttpRequest:_n.
|
|
586
586
|
mapHttpRequest,mapHttpResponse:bn.mapHttpResponse,req:_n.reqSerializer,res:bn.resSerializer,wrapErrorSerializer:function(t){
|
|
587
587
|
return t===ki?t:function(n){return t(ki(n))}},wrapRequestSerializer:function(t){return t===_n.reqSerializer?t:function(n){
|
|
588
588
|
return t(_n.reqSerializer(n))}},wrapResponseSerializer:function(t){return t===bn.resSerializer?t:function(n){return t(bn.
|
|
589
|
-
resSerializer(n))}}}});var Li=z((
|
|
590
|
-
|
|
591
|
-
o.push(i.getFileName());return o}});var
|
|
589
|
+
resSerializer(n))}}}});var Li=z((YN,sl)=>{"use strict";function _w(e,t){return t}sl.exports=function(){let t=Error.prepareStackTrace;Error.prepareStackTrace=
|
|
590
|
+
_w;let r=new Error().stack;if(Error.prepareStackTrace=t,!Array.isArray(r))return;let n=r.slice(2),o=[];for(let i of n)i&&
|
|
591
|
+
o.push(i.getFileName());return o}});var fl=z((JN,dl)=>{"use strict";function Mi(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(
|
|
592
592
|
e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=Mi(e[r]);return t}if(typeof e=="object"){let t=Object.
|
|
593
593
|
create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=Mi(e[r]));return t}return e}
|
|
594
|
-
function
|
|
594
|
+
function al(e){let t=[],r="",n=!1,o=!1,i="";for(let s=0;s<e.length;s++){let a=e[s];!n&&a==="."?r&&(t.push(r),r=""):a==="\
|
|
595
595
|
["?(r&&(t.push(r),r=""),n=!0):a==="]"&&n?(t.push(r),r="",n=!1,o=!1):(a==='"'||a==="'")&&n?o?a===i?(o=!1,i=""):r+=a:(o=!0,
|
|
596
|
-
i=a):r+=a}return r&&t.push(r),t}function
|
|
596
|
+
i=a):r+=a}return r&&t.push(r),t}function cl(e,t,r){let n=e;for(let i=0;i<t.length-1;i++){let s=t[i];if(typeof n!="object"||
|
|
597
597
|
n===null||!(s in n)||typeof n[s]!="object"||n[s]===null)return!1;n=n[s]}let o=t[t.length-1];if(o==="*"){if(Array.isArray(
|
|
598
598
|
n))for(let i=0;i<n.length;i++)n[i]=r;else if(typeof n=="object"&&n!==null)for(let i in n)Object.prototype.hasOwnProperty.
|
|
599
599
|
call(n,i)&&(n[i]=r)}else typeof n=="object"&&n!==null&&o in n&&Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=r);return!0}
|
|
600
|
-
function
|
|
600
|
+
function ul(e,t){let r=e;for(let o=0;o<t.length-1;o++){let i=t[o];if(typeof r!="object"||r===null||!(i in r)||typeof r[i]!=
|
|
601
601
|
"object"||r[i]===null)return!1;r=r[i]}let n=t[t.length-1];if(n==="*"){if(Array.isArray(r))for(let o=0;o<r.length;o++)r[o]=
|
|
602
602
|
void 0;else if(typeof r=="object"&&r!==null)for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&delete r[o]}else typeof r==
|
|
603
603
|
"object"&&r!==null&&n in r&&Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];return!0}var En=Symbol("PATH_NOT_FOUN\
|
|
604
|
-
D");function
|
|
605
|
-
function
|
|
606
|
-
for(let o of t){let i=
|
|
607
|
-
"function"?r(s,i):r;
|
|
604
|
+
D");function bw(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null||!(n in r))return En;r=r[n]}return r}
|
|
605
|
+
function Ew(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null)return;r=r[n]}return r}function Sw(e,t,r,n=!1){
|
|
606
|
+
for(let o of t){let i=al(o);if(i.includes("*"))ll(e,i,r,o,n);else if(n)ul(e,i);else{let s=bw(e,i);if(s===En)continue;let a=typeof r==
|
|
607
|
+
"function"?r(s,i):r;cl(e,i,a)}}}function ll(e,t,r,n,o=!1){let i=t.indexOf("*");if(i===t.length-1){let s=t.slice(0,-1),a=e;
|
|
608
608
|
for(let c of s){if(a==null||typeof a!="object"||a===null)return;a=a[c]}if(Array.isArray(a))if(o)for(let c=0;c<a.length;c++)
|
|
609
609
|
a[c]=void 0;else for(let c=0;c<a.length;c++){let u=[...s,c.toString()],d=typeof r=="function"?r(a[c],u):r;a[c]=d}else if(typeof a==
|
|
610
610
|
"object"&&a!==null)if(o){let c=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&c.push(u);for(let u of c)delete a[u]}else
|
|
611
|
-
for(let c in a){let u=[...s,c],d=typeof r=="function"?r(a[c],u):r;a[c]=d}}else
|
|
611
|
+
for(let c in a){let u=[...s,c],d=typeof r=="function"?r(a[c],u):r;a[c]=d}}else vw(e,t,r,i,n,o)}function vw(e,t,r,n,o,i=!1){
|
|
612
612
|
let s=t.slice(0,n),a=t.slice(n+1),c=[];function u(d,p){if(p===s.length){if(Array.isArray(d))for(let g=0;g<d.length;g++)c[p]=
|
|
613
613
|
g.toString(),u(d[g],p+1);else if(typeof d=="object"&&d!==null)for(let g in d)c[p]=g,u(d[g],p+1)}else if(p<s.length){let g=s[p];
|
|
614
|
-
d&&typeof d=="object"&&d!==null&&g in d&&(c[p]=g,u(d[g],p+1))}else if(a.includes("*"))
|
|
615
|
-
let w=[...c.slice(0,p),...l];return r(h,w)}:r,o,i);else if(i)
|
|
616
|
-
0,p),...a]):r;
|
|
617
|
-
"object"||d===null)return;d=d[g],c[p]=g}d!=null&&u(d,s.length)}}function
|
|
618
|
-
for(let r of e){let n=
|
|
614
|
+
d&&typeof d=="object"&&d!==null&&g in d&&(c[p]=g,u(d[g],p+1))}else if(a.includes("*"))ll(d,a,typeof r=="function"?(h,l)=>{
|
|
615
|
+
let w=[...c.slice(0,p),...l];return r(h,w)}:r,o,i);else if(i)ul(d,a);else{let g=typeof r=="function"?r(Ew(d,a),[...c.slice(
|
|
616
|
+
0,p),...a]):r;cl(d,a,g)}}if(s.length===0)u(e,0);else{let d=e;for(let p=0;p<s.length;p++){let g=s[p];if(d==null||typeof d!=
|
|
617
|
+
"object"||d===null)return;d=d[g],c[p]=g}d!=null&&u(d,s.length)}}function Tw(e){if(e.length===0)return null;let t=new Map;
|
|
618
|
+
for(let r of e){let n=al(r),o=t;for(let i=0;i<n.length;i++){let s=n[i];o.has(s)||o.set(s,new Map),o=o.get(s)}}return t}function Iw(e,t){
|
|
619
619
|
if(!t)return e;function r(n,o,i=0){if(!o||o.size===0||n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(
|
|
620
620
|
n.getTime());if(Array.isArray(n)){let a=[];for(let c=0;c<n.length;c++){let u=c.toString();o.has(u)||o.has("*")?a[c]=r(n[c],
|
|
621
621
|
o.get(u)||o.get("*")):a[c]=n[c]}return a}let s=Object.create(Object.getPrototypeOf(n));for(let a in n)Object.prototype.hasOwnProperty.
|
|
622
|
-
call(n,a)&&(o.has(a)||o.has("*")?s[a]=r(n[a],o.get(a)||o.get("*")):s[a]=n[a]);return s}return r(e,t)}function
|
|
622
|
+
call(n,a)&&(o.has(a)||o.has("*")?s[a]=r(n[a],o.get(a)||o.get("*")):s[a]=n[a]);return s}return r(e,t)}function Ow(e){if(typeof e!=
|
|
623
623
|
"string")throw new Error("Paths must be (non-empty) strings");if(e==="")throw new Error("Invalid redaction path ()");if(e.
|
|
624
624
|
includes(".."))throw new Error(`Invalid redaction path (${e})`);if(e.includes(","))throw new Error(`Invalid redaction pa\
|
|
625
625
|
th (${e})`);let t=0,r=!1,n="";for(let o=0;o<e.length;o++){let i=e[o];if((i==='"'||i==="'")&&t>0)r?i===n&&(r=!1,n=""):(r=
|
|
626
626
|
!0,n=i);else if(i==="["&&!r)t++;else if(i==="]"&&!r&&(t--,t<0))throw new Error(`Invalid redaction path (${e})`)}if(t!==0)
|
|
627
|
-
throw new Error(`Invalid redaction path (${e})`)}function
|
|
628
|
-
an array");for(let t of e)
|
|
629
|
-
remove:i=!1}=e;
|
|
630
|
-
return n?n(c):c;let u=
|
|
631
|
-
d)},u):typeof n=="function"?n(u):JSON.stringify(u)}}
|
|
632
|
-
"pino.levelComp"),
|
|
633
|
-
"pino.lsCache"),
|
|
634
|
-
|
|
635
|
-
pino.stringifySafe"),
|
|
636
|
-
essageKey"),
|
|
637
|
-
ergeStrategy"),
|
|
638
|
-
"pino.formatters"),
|
|
639
|
-
levelValSym:
|
|
640
|
-
redactFmtSym:
|
|
641
|
-
formatOptsSym:
|
|
642
|
-
formattersSym:
|
|
643
|
-
[Redacted]",
|
|
627
|
+
throw new Error(`Invalid redaction path (${e})`)}function Rw(e){if(!Array.isArray(e))throw new TypeError("paths must be \
|
|
628
|
+
an array");for(let t of e)Ow(t)}function Aw(e={}){let{paths:t=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:o=!0,
|
|
629
|
+
remove:i=!1}=e;Rw(t);let s=Tw(t);return function(c){if(o&&(c===null||typeof c!="object")&&(c==null||typeof c!="object"))
|
|
630
|
+
return n?n(c):c;let u=Iw(c,s),d=c,p=r;return typeof r=="function"&&(p=r),Sw(u,t,p,i),n===!1?(u.restore=function(){return Mi(
|
|
631
|
+
d)},u):typeof n=="function"?n(u):JSON.stringify(u)}}dl.exports=Aw});var Nt=z((KN,pl)=>{"use strict";var Pw=Symbol("pino.setLevel"),Cw=Symbol("pino.getLevel"),Nw=Symbol("pino.levelVal"),jw=Symbol(
|
|
632
|
+
"pino.levelComp"),xw=Symbol("pino.useLevelLabels"),kw=Symbol("pino.useOnlyCustomLevels"),$w=Symbol("pino.mixin"),Lw=Symbol(
|
|
633
|
+
"pino.lsCache"),Mw=Symbol("pino.chindings"),Dw=Symbol("pino.asJson"),Vw=Symbol("pino.write"),Uw=Symbol("pino.redactFmt"),
|
|
634
|
+
Bw=Symbol("pino.time"),zw=Symbol("pino.timeSliceIndex"),Gw=Symbol("pino.stream"),Fw=Symbol("pino.stringify"),Hw=Symbol("\
|
|
635
|
+
pino.stringifySafe"),qw=Symbol("pino.stringifiers"),Ww=Symbol("pino.end"),Yw=Symbol("pino.formatOpts"),Jw=Symbol("pino.m\
|
|
636
|
+
essageKey"),Kw=Symbol("pino.errorKey"),Xw=Symbol("pino.nestedKey"),Zw=Symbol("pino.nestedKeyStr"),Qw=Symbol("pino.mixinM\
|
|
637
|
+
ergeStrategy"),e_=Symbol("pino.msgPrefix"),t_=Symbol("pino.wildcardFirst"),r_=Symbol.for("pino.serializers"),n_=Symbol.for(
|
|
638
|
+
"pino.formatters"),o_=Symbol.for("pino.hooks"),i_=Symbol.for("pino.metadata");pl.exports={setLevelSym:Pw,getLevelSym:Cw,
|
|
639
|
+
levelValSym:Nw,levelCompSym:jw,useLevelLabelsSym:xw,mixinSym:$w,lsCacheSym:Lw,chindingsSym:Mw,asJsonSym:Dw,writeSym:Vw,serializersSym:r_,
|
|
640
|
+
redactFmtSym:Uw,timeSym:Bw,timeSliceIndexSym:zw,streamSym:Gw,stringifySym:Fw,stringifySafeSym:Hw,stringifiersSym:qw,endSym:Ww,
|
|
641
|
+
formatOptsSym:Yw,messageKeySym:Jw,errorKeySym:Kw,nestedKeySym:Xw,wildcardFirstSym:t_,needsMetadataGsym:i_,useOnlyCustomLevelsSym:kw,
|
|
642
|
+
formattersSym:n_,hooksSym:o_,nestedKeyStrSym:Zw,mixinMergeStrategySym:Qw,msgPrefixSym:e_}});var Vi=z((XN,yl)=>{"use strict";var ml=fl(),{redactFmtSym:s_,wildcardFirstSym:Sn}=Nt(),Di=/[^.[\]]+|\[([^[\]]*?)\]/g,hl="\
|
|
643
|
+
[Redacted]",gl=!1;function a_(e,t){let{paths:r,censor:n,remove:o}=c_(e),i=r.reduce((c,u)=>{Di.lastIndex=0;let d=Di.exec(
|
|
644
644
|
u),p=Di.exec(u),g=d[1]!==void 0?d[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):d[0];if(g==="*"&&(g=Sn),p===null)return c[g]=
|
|
645
645
|
null,c;if(c[g]===null)return c;let{index:h}=p,l=`${u.substr(h,u.length-1)}`;return c[g]=c[g]||[],g!==Sn&&c[g].length===0&&
|
|
646
|
-
c[g].push(...c[Sn]||[]),g===Sn&&Object.keys(c).forEach(function(w){c[w]&&c[w].push(l)}),c[g].push(l),c},{}),s={[
|
|
647
|
-
paths:r,censor:n,serialize:t,strict:
|
|
646
|
+
c[g].push(...c[Sn]||[]),g===Sn&&Object.keys(c).forEach(function(w){c[w]&&c[w].push(l)}),c[g].push(l),c},{}),s={[s_]:ml({
|
|
647
|
+
paths:r,censor:n,serialize:t,strict:gl,remove:o})},a=(...c)=>t(typeof n=="function"?n(...c):n);return[...Object.keys(i),
|
|
648
648
|
...Object.getOwnPropertySymbols(i)].reduce((c,u)=>{if(i[u]===null)c[u]=d=>a(d,[u]);else{let d=typeof n=="function"?(p,g)=>n(
|
|
649
|
-
p,[u,...g]):n;c[u]=
|
|
650
|
-
e))return e={paths:e,censor:
|
|
651
|
-
t must contain an array of strings");return n===!0&&(r=void 0),{paths:t,censor:r,remove:n}}
|
|
652
|
-
|
|
653
|
-
hrtime.bigint(),
|
|
649
|
+
p,[u,...g]):n;c[u]=ml({paths:i[u],censor:d,serialize:t,strict:gl,remove:o})}return c},s)}function c_(e){if(Array.isArray(
|
|
650
|
+
e))return e={paths:e,censor:hl},e;let{paths:t,censor:r=hl,remove:n}=e;if(Array.isArray(t)===!1)throw Error("pino \u2013 redac\
|
|
651
|
+
t must contain an array of strings");return n===!0&&(r=void 0),{paths:t,censor:r,remove:n}}yl.exports=a_});var bl=z((ZN,_l)=>{"use strict";var u_=()=>"",l_=()=>`,"time":${Date.now()}`,d_=()=>`,"time":${Math.round(Date.now()/1e3)}`,
|
|
652
|
+
f_=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,p_=1000000n,wl=1000000000n,m_=BigInt(Date.now())*p_,h_=process.
|
|
653
|
+
hrtime.bigint(),g_=()=>{let e=process.hrtime.bigint()-h_,t=m_+e,r=t/wl,n=t%wl,o=Number(r*1000n+n/1000000n),i=new Date(o),
|
|
654
654
|
s=i.getUTCFullYear(),a=(i.getUTCMonth()+1).toString().padStart(2,"0"),c=i.getUTCDate().toString().padStart(2,"0"),u=i.getUTCHours().
|
|
655
655
|
toString().padStart(2,"0"),d=i.getUTCMinutes().toString().padStart(2,"0"),p=i.getUTCSeconds().toString().padStart(2,"0");
|
|
656
|
-
return`,"time":"${s}-${a}-${c}T${u}:${d}:${p}.${n.toString().padStart(9,"0")}Z"`};
|
|
657
|
-
isoTime:
|
|
658
|
-
var n=r&&r.stringify||
|
|
656
|
+
return`,"time":"${s}-${a}-${c}T${u}:${d}:${p}.${n.toString().padStart(9,"0")}Z"`};_l.exports={nullTime:u_,epochTime:l_,unixTime:d_,
|
|
657
|
+
isoTime:f_,isoTimeNano:g_}});var Sl=z((QN,El)=>{"use strict";function y_(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}El.exports=w_;function w_(e,t,r){
|
|
658
|
+
var n=r&&r.stringify||y_,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var s=new Array(i);s[0]=
|
|
659
659
|
n(e);for(var a=1;a<i;a++)s[a]=n(t[a]);return s.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;
|
|
660
660
|
for(var u="",d=1-o,p=-1,g=e&&e.length||0,h=0;h<g;){if(e.charCodeAt(h)===37&&h+1<g){switch(p=p>-1?p:0,e.charCodeAt(h+1)){case 100:case 102:
|
|
661
661
|
if(d>=c||t[d]==null)break;p<h&&(u+=e.slice(p,h)),u+=Number(t[d]),p=h+2,h++;break;case 105:if(d>=c||t[d]==null)break;p<h&&
|
|
662
662
|
(u+=e.slice(p,h)),u+=Math.floor(Number(t[d])),p=h+2,h++;break;case 79:case 111:case 106:if(d>=c||t[d]===void 0)break;p<h&&
|
|
663
663
|
(u+=e.slice(p,h));var l=typeof t[d];if(l==="string"){u+="'"+t[d]+"'",p=h+2,h++;break}if(l==="function"){u+=t[d].name||"<\
|
|
664
664
|
anonymous>",p=h+2,h++;break}u+=n(t[d]),p=h+2,h++;break;case 115:if(d>=c)break;p<h&&(u+=e.slice(p,h)),u+=String(t[d]),p=h+
|
|
665
|
-
2,h++;break;case 37:p<h&&(u+=e.slice(p,h)),u+="%",p=h+2,h++,d--;break}++d}++h}return p===-1?e:(p<g&&(u+=e.slice(p)),u)}});var Bi=z((
|
|
665
|
+
2,h++;break;case 37:p<h&&(u+=e.slice(p,h)),u+="%",p=h+2,h++,d--;break}++d}++h}return p===-1?e:(p<g&&(u+=e.slice(p)),u)}});var Bi=z((ej,Ui)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let t=function(r){if((r>0&&r<1/0)===
|
|
666
666
|
!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a \
|
|
667
667
|
number that is greater than 0 but less than Infinity");Atomics.wait(e,0,0,Number(r))},e=new Int32Array(new SharedArrayBuffer(
|
|
668
668
|
4));Ui.exports=t}else{let e=function(t){if((t>0&&t<1/0)===!1)throw typeof t!="number"&&typeof t!="bigint"?TypeError("sle\
|
|
669
669
|
ep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.
|
|
670
|
-
now()+Number(t);for(;n>Date.now(););};Ui.exports=e}});var
|
|
671
|
-
Tn=Buffer.allocUnsafe(0),
|
|
672
|
-
|
|
670
|
+
now()+Number(t);for(;n>Date.now(););};Ui.exports=e}});var Cl=z((tj,Pl)=>{"use strict";var q=X("fs"),__=X("events"),b_=X("util").inherits,vl=X("path"),Gi=Bi(),E_=X("assert"),vn=100,
|
|
671
|
+
Tn=Buffer.allocUnsafe(0),S_=16*1024,Tl="buffer",Il="utf8",[v_,T_]=(process.versions.node||"0.0").split(".").map(Number),
|
|
672
|
+
I_=v_>=22&&T_>=7;function Ol(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(i,s){if(i){t._reopening=
|
|
673
673
|
!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount("error")>0&&t.emit("error",i)}):t.emit("erro\
|
|
674
674
|
r",i);return}let a=t._reopening;t.fd=s,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.
|
|
675
675
|
emit("ready")):t.emit("ready"),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():a&&process.
|
|
676
|
-
nextTick(()=>t.emit("drain")))}let n=t.append?"a":"w",o=t.mode;if(t.sync)try{t.mkdir&&q.mkdirSync(
|
|
677
|
-
let i=q.openSync(e,n,o);r(null,i)}catch(i){throw r(i),i}else t.mkdir?q.mkdir(
|
|
678
|
-
i);q.open(e,n,o,r)}):q.open(e,n,o,r)}function
|
|
676
|
+
nextTick(()=>t.emit("drain")))}let n=t.append?"a":"w",o=t.mode;if(t.sync)try{t.mkdir&&q.mkdirSync(vl.dirname(e),{recursive:!0});
|
|
677
|
+
let i=q.openSync(e,n,o);r(null,i)}catch(i){throw r(i),i}else t.mkdir?q.mkdir(vl.dirname(e),{recursive:!0},i=>{if(i)return r(
|
|
678
|
+
i);q.open(e,n,o,r)}):q.open(e,n,o,r)}function Ee(e){if(!(this instanceof Ee))return new Ee(e);let{fd:t,dest:r,minLength:n,
|
|
679
679
|
maxLength:o,maxWrite:i,periodicFlush:s,sync:a,append:c=!0,mkdir:u,retryEAGAIN:d,fsync:p,contentMode:g,mode:h}=e||{};t=t||
|
|
680
680
|
r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=
|
|
681
681
|
!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=
|
|
682
|
-
o||0,this.maxWrite=i||
|
|
683
|
-
_fsync=p||!1,this.append=c||!1,this.mode=h,this.retryEAGAIN=d||(()=>!0),this.mkdir=u||!1;let l,w;if(g===
|
|
684
|
-
Tn,this.write=
|
|
685
|
-
write(this.fd,this._writingBuf,this.release);else if(g===void 0||g===
|
|
686
|
-
this.flushSync=
|
|
682
|
+
o||0,this.maxWrite=i||S_,this._periodicFlush=s||0,this._periodicFlushTimer=void 0,this.sync=a||!1,this.writable=!0,this.
|
|
683
|
+
_fsync=p||!1,this.append=c||!1,this.mode=h,this.retryEAGAIN=d||(()=>!0),this.mkdir=u||!1;let l,w;if(g===Tl)this._writingBuf=
|
|
684
|
+
Tn,this.write=A_,this.flush=C_,this.flushSync=j_,this._actualWrite=k_,l=()=>q.writeSync(this.fd,this._writingBuf),w=()=>q.
|
|
685
|
+
write(this.fd,this._writingBuf,this.release);else if(g===void 0||g===Il)this._writingBuf="",this.write=R_,this.flush=P_,
|
|
686
|
+
this.flushSync=N_,this._actualWrite=x_,l=()=>Buffer.isBuffer(this._writingBuf)?q.writeSync(this.fd,this._writingBuf):q.writeSync(
|
|
687
687
|
this.fd,this._writingBuf,"utf8"),w=()=>Buffer.isBuffer(this._writingBuf)?q.write(this.fd,this._writingBuf,this.release):
|
|
688
|
-
q.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${
|
|
689
|
-
passed ${g}`);if(typeof t=="number")this.fd=t,process.nextTick(()=>this.emit("ready"));else if(typeof t=="string")
|
|
688
|
+
q.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${Il}" and "${Tl}", but \
|
|
689
|
+
passed ${g}`);if(typeof t=="number")this.fd=t,process.nextTick(()=>this.emit("ready"));else if(typeof t=="string")Ol(t,this);else
|
|
690
690
|
throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`\
|
|
691
691
|
minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(_,f)=>{if(_){if((_.code==="EAGAIN"||_.code===
|
|
692
692
|
"EBUSY")&&this.retryEAGAIN(_,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{Gi(vn),this.release(
|
|
@@ -696,59 +696,59 @@ if(!this.sync){w();return}try{do{let E=l(),T=zi(this._writingBuf,this._len,E);th
|
|
|
696
696
|
_writingBuf.length)}catch(E){this.release(E);return}}this._fsync&&q.fsyncSync(this.fd);let y=this._len;this._reopening?(this.
|
|
697
697
|
_writing=!1,this._reopening=!1,this.reopen()):y>this.minLength?this._actualWrite():this._ending?y>0?this._actualWrite():
|
|
698
698
|
(this._writing=!1,In(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.
|
|
699
|
-
nextTick(
|
|
699
|
+
nextTick(O_,this)):this.emit("drain"))},this.on("newListener",function(_){_==="drain"&&(this._asyncDrainScheduled=!1)}),
|
|
700
700
|
this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.
|
|
701
701
|
unref())}function zi(e,t,r){return typeof e=="string"&&(e=Buffer.from(e)),t=Math.max(t-r,0),e=e.subarray(r),{writingBuf:e,
|
|
702
|
-
len:t}}function
|
|
703
|
-
return e.length===0?Tn:e.length===1?e[0]:Buffer.concat(e,t)}function
|
|
702
|
+
len:t}}function O_(e){e.listenerCount("drain")>0&&(e._asyncDrainScheduled=!1,e.emit("drain"))}b_(Ee,__);function Rl(e,t){
|
|
703
|
+
return e.length===0?Tn:e.length===1?e[0]:Buffer.concat(e,t)}function R_(e){if(this.destroyed)throw new Error("SonicBoom \
|
|
704
704
|
destroyed");e=""+e;let t=Buffer.byteLength(e),r=this._len+t,n=this._bufs;return this.maxLength&&r>this.maxLength?(this.emit(
|
|
705
705
|
"drop",e),this._len<this._hwm):(n.length===0||Buffer.byteLength(n[n.length-1])+t>this.maxWrite?n.push(e):n[n.length-1]+=
|
|
706
|
-
e,this._len=r,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function
|
|
706
|
+
e,this._len=r,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function A_(e){if(this.
|
|
707
707
|
destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,r=this._bufs,n=this._lens;return this.maxLength&&
|
|
708
708
|
t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||n[n.length-1]+e.length>this.maxWrite?(r.push([
|
|
709
709
|
e]),n.push(e.length)):(r[r.length-1].push(e),n[n.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&
|
|
710
|
-
this._actualWrite(),this._len<this._hwm)}function
|
|
710
|
+
this._actualWrite(),this._len<this._hwm)}function Al(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=
|
|
711
711
|
!1,e();else try{q.fsync(this.fd,n=>{this._flushPending=!1,e(n)})}catch(n){e(n)}this.off("error",r)},r=n=>{this._flushPending=
|
|
712
|
-
!1,e(n),this.off("drain",t)};this.once("drain",t),this.once("error",r)}function
|
|
712
|
+
!1,e(n),this.off("drain",t)};this.once("drain",t),this.once("error",r)}function P_(e){if(e!=null&&typeof e!="function")throw new Error(
|
|
713
713
|
"flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.
|
|
714
|
-
minLength<=0){e?.();return}e&&
|
|
715
|
-
function
|
|
716
|
-
"SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&
|
|
717
|
-
_bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}
|
|
714
|
+
minLength<=0){e?.();return}e&&Al.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}
|
|
715
|
+
function C_(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error(
|
|
716
|
+
"SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&Al.call(this,e),!this._writing&&(this.
|
|
717
|
+
_bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}Ee.prototype.reopen=function(e){if(this.
|
|
718
718
|
destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(e)});return}if(this.
|
|
719
719
|
_ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(e&&
|
|
720
720
|
(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once("ready",()=>{t!==this.fd&&q.close(t,r=>{if(r)
|
|
721
|
-
return this.emit("error",r)})}),
|
|
721
|
+
return this.emit("error",r)})}),Ol(this.file,this)};Ee.prototype.end=function(){if(this.destroyed)throw new Error("Sonic\
|
|
722
722
|
Boom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&
|
|
723
|
-
(this._len>0&&this.fd>=0?this._actualWrite():In(this)))};function
|
|
723
|
+
(this._len>0&&this.fd>=0?this._actualWrite():In(this)))};function N_(){if(this.destroyed)throw new Error("SonicBoom dest\
|
|
724
724
|
royed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.
|
|
725
725
|
unshift(this._writingBuf),this._writingBuf="");let e="";for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);
|
|
726
726
|
try{let t=Buffer.isBuffer(e)?q.writeSync(this.fd,e):q.writeSync(this.fd,e,"utf8"),r=zi(e,this._len,t);e=r.writingBuf,this.
|
|
727
727
|
_len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,
|
|
728
|
-
this._len-e.length))throw t;Gi(vn)}}try{q.fsyncSync(this.fd)}catch{}}function
|
|
728
|
+
this._len-e.length))throw t;Gi(vn)}}try{q.fsyncSync(this.fd)}catch{}}function j_(){if(this.destroyed)throw new Error("So\
|
|
729
729
|
nicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>
|
|
730
730
|
0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=Tn);let e=Tn;for(;this._bufs.length||e.length;){e.length<=0&&
|
|
731
|
-
(e=
|
|
731
|
+
(e=Rl(this._bufs[0],this._lens[0]));try{let t=q.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.
|
|
732
732
|
length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(
|
|
733
|
-
t,e.length,this._len-e.length))throw t;Gi(vn)}}}
|
|
733
|
+
t,e.length,this._len-e.length))throw t;Gi(vn)}}}Ee.prototype.destroy=function(){this.destroyed||In(this)};function x_(){
|
|
734
734
|
let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||"",
|
|
735
735
|
this.sync)try{let t=Buffer.isBuffer(this._writingBuf)?q.writeSync(this.fd,this._writingBuf):q.writeSync(this.fd,this._writingBuf,
|
|
736
|
-
"utf8");e(null,t)}catch(t){e(t)}else q.write(this.fd,this._writingBuf,e)}function
|
|
737
|
-
!0,this._writingBuf=this._writingBuf.length?this._writingBuf:
|
|
738
|
-
writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else
|
|
736
|
+
"utf8");e(null,t)}catch(t){e(t)}else q.write(this.fd,this._writingBuf,e)}function k_(){let e=this.release;if(this._writing=
|
|
737
|
+
!0,this._writingBuf=this._writingBuf.length?this._writingBuf:Rl(this._bufs.shift(),this._lens.shift()),this.sync)try{let t=q.
|
|
738
|
+
writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else I_&&(this._writingBuf=Buffer.from(this._writingBuf)),q.
|
|
739
739
|
write(this.fd,this._writingBuf,e)}function In(e){if(e.fd===-1){e.once("ready",In.bind(null,e));return}e._periodicFlushTimer!==
|
|
740
|
-
void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],
|
|
740
|
+
void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],E_(typeof e.fd=="number",`sonic.fd mus\
|
|
741
741
|
t be a number, got ${typeof e.fd}`);try{q.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?q.close(e.fd,r):r()}function r(n){
|
|
742
|
-
if(n){e.emit("error",n);return}e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}
|
|
743
|
-
exports=
|
|
744
|
-
(jt=new FinalizationRegistry(
|
|
745
|
-
removeListener(e,
|
|
746
|
-
|
|
747
|
-
"exit","beforeExit"]){let r=
|
|
748
|
-
"the object can't be undefined");
|
|
749
|
-
|
|
750
|
-
"beforeExit"])
|
|
751
|
-
unregister:
|
|
742
|
+
if(n){e.emit("error",n);return}e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}Ee.SonicBoom=Ee;Ee.default=Ee;Pl.
|
|
743
|
+
exports=Ee});var Fi=z((rj,$l)=>{"use strict";var Se={exit:[],beforeExit:[]},Nl={exit:M_,beforeExit:D_},jt;function $_(){jt===void 0&&
|
|
744
|
+
(jt=new FinalizationRegistry(V_))}function L_(e){Se[e].length>0||process.on(e,Nl[e])}function jl(e){Se[e].length>0||(process.
|
|
745
|
+
removeListener(e,Nl[e]),Se.exit.length===0&&Se.beforeExit.length===0&&(jt=void 0))}function M_(){xl("exit")}function D_(){
|
|
746
|
+
xl("beforeExit")}function xl(e){for(let t of Se[e]){let r=t.deref(),n=t.fn;r!==void 0&&n(r,e)}Se[e]=[]}function V_(e){for(let t of[
|
|
747
|
+
"exit","beforeExit"]){let r=Se[t].indexOf(e);Se[t].splice(r,r+1),jl(t)}}function kl(e,t,r){if(t===void 0)throw new Error(
|
|
748
|
+
"the object can't be undefined");L_(e);let n=new WeakRef(t);n.fn=r,$_(),jt.register(t,n),Se[e].push(n)}function U_(e,t){
|
|
749
|
+
kl("exit",e,t)}function B_(e,t){kl("beforeExit",e,t)}function z_(e){if(jt!==void 0){jt.unregister(e);for(let t of["exit",
|
|
750
|
+
"beforeExit"])Se[t]=Se[t].filter(r=>{let n=r.deref();return n&&n!==e}),jl(t)}}$l.exports={register:U_,registerBeforeExit:B_,
|
|
751
|
+
unregister:z_}});var Ll=z((nj,G_)=>{G_.exports={name:"thread-stream",version:"4.2.0",description:"A streaming way to send data to a Node.\
|
|
752
752
|
js Worker Thread",main:"index.js",types:"index.d.ts",engines:{node:">=20"},dependencies:{"real-require":"^1.0.0"},devDependencies:{
|
|
753
753
|
"@types/node":"^25.0.2","@yao-pkg/pkg":"^6.0.0",borp:"^1.0.0",desm:"^1.3.0",eslint:"^9.39.1",fastbench:"^1.0.1",neostandard:"\
|
|
754
754
|
^0.13.0","pino-elasticsearch":"^9.0.0","sonic-boom":"^5.0.0","ts-node":"^10.8.0",typescript:"~5.7.3"},scripts:{build:"ts\
|
|
@@ -757,201 +757,201 @@ s}"',"test:ci":'npm run lint && npm run transpile && borp --pattern "test/*.test
|
|
|
757
757
|
le && borp --pattern "test/*.test.js"',transpile:"sh ./test/ts/transpile.sh"},repository:{type:"git",url:"git+https://gi\
|
|
758
758
|
thub.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matt\
|
|
759
759
|
eocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com\
|
|
760
|
-
/mcollina/thread-stream#readme"}});var
|
|
760
|
+
/mcollina/thread-stream#readme"}});var Dl=z((oj,Ml)=>{"use strict";function F_(e,t,r,n,o){let i=n===1/0?1/0:Date.now()+n,s=()=>{let a=Atomics.load(e,t);if(a===
|
|
761
761
|
r){o(null,"ok");return}if(i!==1/0&&Date.now()>i){o(null,"timed-out");return}let c=i===1/0?1e4:Math.min(1e4,Math.max(1,i-
|
|
762
|
-
Date.now())),u=Atomics.waitAsync(e,t,a,c);u.async?u.value.then(s):setImmediate(s)};s()}function
|
|
762
|
+
Date.now())),u=Atomics.waitAsync(e,t,a,c);u.async?u.value.then(s):setImmediate(s)};s()}function H_(e,t,r,n,o){let i=n===
|
|
763
763
|
1/0?1/0:Date.now()+n,s=()=>{if(Atomics.load(e,t)!==r){o(null,"ok");return}if(i!==1/0&&Date.now()>i){o(null,"timed-out");
|
|
764
764
|
return}let c=i===1/0?1e4:Math.min(1e4,Math.max(1,i-Date.now())),u=Atomics.waitAsync(e,t,r,c);u.async?u.value.then(d=>{if(d===
|
|
765
|
-
"ok"){o(null,"ok");return}s()}):setImmediate(s)};s()}
|
|
766
|
-
{pathToFileURL:
|
|
767
|
-
I=Symbol("kImpl"),
|
|
768
|
-
add(e[I].state,Hi,1),Atomics.notify(e[I].state,Hi)}function
|
|
769
|
-
e[I].state,
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||
|
|
773
|
-
name:t.workerOpts?.name||"thread-stream",trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:
|
|
774
|
-
dataBuf:e[I].dataBuf,stateBuf:e[I].stateBuf,workerData:{$context:{threadStreamVersion:
|
|
775
|
-
e),s.on("message",
|
|
776
|
-
e.emit("drain"))}function
|
|
777
|
-
0){e[I].flushing=!1,e[I].ending?Ki(e):e[I].needDrain&&process.nextTick(
|
|
778
|
-
0&&e[I].bufLen===0)return;Rn(e,()=>{e.destroyed||(
|
|
765
|
+
"ok"){o(null,"ok");return}s()}):setImmediate(s)};s()}Ml.exports={wait:F_,waitDiff:H_}});var Ul=z((ij,Vl)=>{"use strict";Vl.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}});var Zl=z((sj,Xl)=>{"use strict";var{version:q_}=Ll(),{EventEmitter:W_}=X("events"),{Worker:Y_}=X("worker_threads"),{join:J_}=X("path"),
|
|
766
|
+
{pathToFileURL:K_}=X("url"),{wait:X_}=Dl(),{WRITE_INDEX:ke,READ_INDEX:nt,SEQ_INDEX:Hi}=Ul(),Z_=X("buffer"),Q_=X("assert"),
|
|
767
|
+
I=Symbol("kImpl"),eb=Z_.constants.MAX_STRING_LENGTH;function Bl(){}function Ji(e,t){Atomics.add(e[I].state,Hi,1),t(),Atomics.
|
|
768
|
+
add(e[I].state,Hi,1),Atomics.notify(e[I].state,Hi)}function zl(e){Ji(e,()=>{Atomics.store(e[I].state,nt,0),Atomics.store(
|
|
769
|
+
e[I].state,ke,0)})}var fr=class{constructor(t){this._value=t}deref(){return this._value}},On=class{register(){}unregister(){}},
|
|
770
|
+
tb=process.env.NODE_V8_COVERAGE?On:global.FinalizationRegistry||On,rb=process.env.NODE_V8_COVERAGE?fr:global.WeakRef||fr,
|
|
771
|
+
Gl=new tb(e=>{e.exited||e.terminate()});function nb(e,t){let{filename:r,workerData:n}=t,i=("__bundlerPathsOverrides"in globalThis?
|
|
772
|
+
globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||J_(__dirname,"lib","worker.js"),s=new Y_(i,{...t.workerOpts,
|
|
773
|
+
name:t.workerOpts?.name||"thread-stream",trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:K_(r).href,
|
|
774
|
+
dataBuf:e[I].dataBuf,stateBuf:e[I].stateBuf,workerData:{$context:{threadStreamVersion:q_},...n}}});return s.stream=new fr(
|
|
775
|
+
e),s.on("message",ob),s.on("exit",ql),Gl.register(e,s),s}function Fl(e){Q_(!e[I].sync),e[I].needDrain&&(e[I].needDrain=!1,
|
|
776
|
+
e.emit("drain"))}function Hl(e){for(;;){let t=Atomics.load(e[I].state,ke),r=e[I].data.length-t;if(r>0){if(e[I].bufLen===
|
|
777
|
+
0){e[I].flushing=!1,e[I].ending?Ki(e):e[I].needDrain&&process.nextTick(Fl,e);return}Jl(e,r,Bl);continue}if(r===0){if(t===
|
|
778
|
+
0&&e[I].bufLen===0)return;Rn(e,()=>{e.destroyed||(zl(e),Hl(e))});return}he(e,new Error("overwritten"));return}}function ob(e){
|
|
779
779
|
let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case"REA\
|
|
780
|
-
DY":this.stream=new
|
|
780
|
+
DY":this.stream=new rb(t),Rn(t,()=>{t[I].ready=!0,t.emit("ready")});break;case"ERROR":he(t,e.err);break;case"EVENT":Array.
|
|
781
781
|
isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case"FLUSHED":{if(e.context!=="thread-stream"){he(t,
|
|
782
782
|
new Error("this should not happen: "+e.code));break}let r=t[I].flushCallbacks.get(e.id);r&&(t[I].flushCallbacks.delete(e.
|
|
783
783
|
id),process.nextTick(r));break}case"WARNING":process.emitWarning(e.err);break;default:he(t,new Error("this should not ha\
|
|
784
|
-
ppen: "+e.code))}}function
|
|
785
|
-
"exit",
|
|
784
|
+
ppen: "+e.code))}}function ql(e){let t=this.stream.deref();t!==void 0&&(Gl.unregister(t),t.worker.exited=!0,t.worker.off(
|
|
785
|
+
"exit",ql),he(t,e!==0?new Error("the worker thread exited"):null))}var Wi=class extends W_{constructor(t={}){if(super(),
|
|
786
786
|
t.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[I]={},this[I].stateBuf=new SharedArrayBuffer(
|
|
787
787
|
128),this[I].state=new Int32Array(this[I].stateBuf),this[I].dataBuf=new SharedArrayBuffer(t.bufferSize||4*1024*1024),this[I].
|
|
788
788
|
data=Buffer.from(this[I].dataBuf),this[I].sync=t.sync||!1,this[I].ending=!1,this[I].ended=!1,this[I].needDrain=!1,this[I].
|
|
789
789
|
destroyed=!1,this[I].flushing=!1,this[I].ready=!1,this[I].finished=!1,this[I].errored=null,this[I].closed=!1,this[I].buf=
|
|
790
|
-
[],this[I].bufHead=0,this[I].bufLen=0,this[I].flushCallbacks=new Map,this[I].nextFlushId=0,this.worker=
|
|
790
|
+
[],this[I].bufHead=0,this[I].bufLen=0,this[I].flushCallbacks=new Map,this[I].nextFlushId=0,this.worker=nb(this,t),this.on(
|
|
791
791
|
"message",(r,n)=>{this.worker.postMessage(r,n)})}write(t){let r=Buffer.isBuffer(t)?t:Buffer.from(t);if(this[I].destroyed)
|
|
792
792
|
return Yi(this,new Error("the worker has exited")),!1;if(this[I].ending)return Yi(this,new Error("the worker is ending")),
|
|
793
|
-
!1;if(this[I].flushing&&this[I].bufLen+r.length>=
|
|
793
|
+
!1;if(this[I].flushing&&this[I].bufLen+r.length>=eb)try{qi(this),this[I].flushing=!0}catch(n){return he(this,n),!1}if(this[I].
|
|
794
794
|
buf.push(r),this[I].bufLen+=r.length,this[I].sync)try{return qi(this),!0}catch(n){return he(this,n),!1}return this[I].flushing||
|
|
795
|
-
(this[I].flushing=!0,setImmediate(
|
|
796
|
-
|
|
797
|
-
this,r=>{if(r){process.nextTick(t,r);return}
|
|
795
|
+
(this[I].flushing=!0,setImmediate(Hl,this)),this[I].needDrain=this[I].data.length-this[I].bufLen-Atomics.load(this[I].state,
|
|
796
|
+
ke)<=0,!this[I].needDrain}end(){this[I].destroyed||(this[I].ending=!0,Ki(this))}flush(t){t=typeof t=="function"?t:Bl,Wl(
|
|
797
|
+
this,r=>{if(r){process.nextTick(t,r);return}Yl(this,t)})}flushSync(){this[I].destroyed||(qi(this),Kl(this))}unref(){this.
|
|
798
798
|
worker.unref()}ref(){this.worker.ref()}get ready(){return this[I].ready}get destroyed(){return this[I].destroyed}get closed(){
|
|
799
799
|
return this[I].closed}get writable(){return!this[I].destroyed&&!this[I].ending}get writableEnded(){return this[I].ending}get writableFinished(){
|
|
800
800
|
return this[I].finished}get writableNeedDrain(){return this[I].needDrain}get writableObjectMode(){return!1}get writableErrored(){
|
|
801
|
-
return this[I].errored}};function
|
|
802
|
-
if(!e[I].sync&&(e[I].flushing||e[I].bufLen>0)){setImmediate(
|
|
803
|
-
state,
|
|
804
|
-
destroyed){process.nextTick(t,new Error("the worker has exited"));return}if(!e[I].ready){let n=()=>{i(),
|
|
801
|
+
return this[I].errored}};function Wl(e,t){if(e[I].destroyed){process.nextTick(t,new Error("the worker has exited"));return}
|
|
802
|
+
if(!e[I].sync&&(e[I].flushing||e[I].bufLen>0)){setImmediate(Wl,e,t);return}Rn(e,t)}function Rn(e,t){let r=Atomics.load(e[I].
|
|
803
|
+
state,ke);X_(e[I].state,nt,r,1/0,(n,o)=>{if(n){he(e,n),t(n);return}if(o!=="ok"){Rn(e,t);return}t()})}function Yl(e,t){if(e[I].
|
|
804
|
+
destroyed){process.nextTick(t,new Error("the worker has exited"));return}if(!e[I].ready){let n=()=>{i(),Yl(e,t)},o=()=>{
|
|
805
805
|
i(),process.nextTick(t,new Error("the worker has exited"))},i=()=>{e.off("ready",n),e.off("close",o)};e.once("ready",n),
|
|
806
806
|
e.once("close",o);return}let r=++e[I].nextFlushId;e[I].flushCallbacks.set(r,t);try{e.worker.postMessage({code:"FLUSH",context:"\
|
|
807
|
-
thread-stream",id:r})}catch(n){e[I].flushCallbacks.delete(r),he(e,n),process.nextTick(t,n)}}function
|
|
807
|
+
thread-stream",id:r})}catch(n){e[I].flushCallbacks.delete(r),he(e,n),process.nextTick(t,n)}}function ib(e,t){let r=e[I].
|
|
808
808
|
flushCallbacks;if(r.size===0)return;let n=t||new Error("the worker has exited");for(let o of r.values())process.nextTick(
|
|
809
809
|
o,n);r.clear()}function Yi(e,t){setImmediate(()=>{e.emit("error",t)})}function he(e,t){e[I].destroyed||(e[I].destroyed=!0,
|
|
810
|
-
|
|
811
|
-
catch(()=>{}).then(()=>{e[I].closed=!0,e.emit("close")}))}function
|
|
810
|
+
ib(e,t),t&&(e[I].errored=t,Yi(e,t)),e.worker.exited?setImmediate(()=>{e[I].closed=!0,e.emit("close")}):e.worker.terminate().
|
|
811
|
+
catch(()=>{}).then(()=>{e[I].closed=!0,e.emit("close")}))}function Jl(e,t,r){let o=Atomics.load(e[I].state,ke),i=t;for(;i>
|
|
812
812
|
0&&e[I].bufLen!==0;){let s=e[I].bufHead,a=e[I].buf[s];if(a.length<=i){a.copy(e[I].data,o),o+=a.length,i-=a.length,e[I].bufLen-=
|
|
813
813
|
a.length,e[I].bufHead=s+1,e[I].bufHead===e[I].buf.length?(e[I].buf.length=0,e[I].bufHead=0):e[I].bufHead>=1024&&e[I].bufHead*
|
|
814
814
|
2>=e[I].buf.length&&(e[I].buf.splice(0,e[I].bufHead),e[I].bufHead=0);continue}a.copy(e[I].data,o,0,i),e[I].buf[s]=a.subarray(
|
|
815
|
-
i),e[I].bufLen-=i,o+=i,i=0}return Ji(e,()=>{Atomics.store(e[I].state,
|
|
815
|
+
i),e[I].bufLen-=i,o+=i,i=0}return Ji(e,()=>{Atomics.store(e[I].state,ke,o)}),r(),!0}function Ki(e){if(!(e[I].ended||!e[I].
|
|
816
816
|
ending||e[I].flushing)){e[I].ended=!0;try{e.flushSync();let t=Atomics.load(e[I].state,nt);Ji(e,()=>{Atomics.store(e[I].state,
|
|
817
|
-
|
|
817
|
+
ke,-1)});let r=0;for(;t!==-1;){if(Atomics.wait(e[I].state,nt,t,1e3),t=Atomics.load(e[I].state,nt),t===-2){he(e,new Error(
|
|
818
818
|
"end() failed"));return}if(++r===10){he(e,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{e[I].finished=
|
|
819
|
-
!0,e.emit("finish")})}catch(t){he(e,t)}}}function qi(e){let t=()=>{e[I].ending?Ki(e):e[I].needDrain&&process.nextTick(
|
|
820
|
-
e)};for(e[I].flushing=!1;e[I].bufLen!==0;){let r=Atomics.load(e[I].state,
|
|
821
|
-
continue}else if(n<0)throw new Error("overwritten");
|
|
822
|
-
o flush while flushing");let t=Atomics.load(e[I].state,
|
|
819
|
+
!0,e.emit("finish")})}catch(t){he(e,t)}}}function qi(e){let t=()=>{e[I].ending?Ki(e):e[I].needDrain&&process.nextTick(Fl,
|
|
820
|
+
e)};for(e[I].flushing=!1;e[I].bufLen!==0;){let r=Atomics.load(e[I].state,ke),n=e[I].data.length-r;if(n===0){Kl(e),zl(e);
|
|
821
|
+
continue}else if(n<0)throw new Error("overwritten");Jl(e,n,t)}}function Kl(e){if(e[I].flushing)throw new Error("unable t\
|
|
822
|
+
o flush while flushing");let t=Atomics.load(e[I].state,ke),r=0;for(;;){let n=Atomics.load(e[I].state,nt);if(n===-2)throw Error(
|
|
823
823
|
"_flushSync failed");if(n!==t)Atomics.wait(e[I].state,nt,n,1e3);else break;if(++r===10)throw new Error("_flushSync took \
|
|
824
|
-
too long (10s)")}}
|
|
825
|
-
sep:
|
|
826
|
-
e,
|
|
824
|
+
too long (10s)")}}Xl.exports=Wi});var Qi=z((aj,td)=>{"use strict";var{createRequire:sb}=X("module"),{existsSync:ab}=X("node:fs"),cb=Li(),{join:Xi,isAbsolute:ed,
|
|
825
|
+
sep:ub}=X("node:path"),{fileURLToPath:lb}=X("node:url"),db=Bi(),Zi=Fi(),fb=Zl();function pb(e){Zi.register(e,wb),Zi.registerBeforeExit(
|
|
826
|
+
e,_b),e.on("close",function(){Zi.unregister(e)})}function mb(){let e=process.execArgv;for(let t=0;t<e.length;t++){let r=e[t];
|
|
827
827
|
if(r==="--import"||r==="--require"||r==="-r"||r.startsWith("--import=")||r.startsWith("--require=")||r.startsWith("-r="))
|
|
828
|
-
return!0}return!1}function
|
|
829
|
-
t.length;o++){let i=t[o];if(i==="--require"||i==="-r"||i==="--import"){let s=t[o+1];if(s&&
|
|
828
|
+
return!0}return!1}function hb(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let r=[],n=!1;for(let o=0;o<
|
|
829
|
+
t.length;o++){let i=t[o];if(i==="--require"||i==="-r"||i==="--import"){let s=t[o+1];if(s&&Ql(s)){n=!0,o++;continue}r.push(
|
|
830
830
|
i),s&&(r.push(s),o++);continue}if(i.startsWith("--require=")||i.startsWith("-r=")||i.startsWith("--import=")){let s=i.slice(
|
|
831
|
-
i.indexOf("=")+1);if(
|
|
832
|
-
if(r.startsWith("file://"))try{r=
|
|
833
|
-
'"'&&r==='"'||t==="'"&&r==="'"?e.slice(1,-1):e}function
|
|
834
|
-
!r.env&&process.env.NODE_OPTIONS){let c=
|
|
835
|
-
env,NODE_OPTIONS:c}})}r={...r,name:o};let i=new
|
|
831
|
+
i.indexOf("=")+1);if(Ql(s)){n=!0;continue}}r.push(i)}return n?r.join(" "):e}function Ql(e){let t=gb(e);if(!t)return!1;let r=t;
|
|
832
|
+
if(r.startsWith("file://"))try{r=lb(r)}catch{return!1}return ed(r)&&!ab(r)}function gb(e){let t=e[0],r=e[e.length-1];return t===
|
|
833
|
+
'"'&&r==='"'||t==="'"&&r==="'"?e.slice(1,-1):e}function yb(e,t,r,n,o){if(!r.execArgv&&mb()&&X.main===void 0&&(r={...r,execArgv:[]}),
|
|
834
|
+
!r.env&&process.env.NODE_OPTIONS){let c=hb(process.env.NODE_OPTIONS);c!==process.env.NODE_OPTIONS&&(r={...r,env:{...process.
|
|
835
|
+
env,NODE_OPTIONS:c}})}r={...r,name:o};let i=new fb({filename:e,workerData:t,workerOpts:r,sync:n});i.on("ready",s),i.on("\
|
|
836
836
|
close",function(){process.removeListener("exit",a)}),process.on("exit",a);function s(){process.removeListener("exit",a),
|
|
837
|
-
i.unref(),r.autoEnd!==!1&&
|
|
838
|
-
flushSync(),e.end(),e.once("close",function(){e.unref()})}function
|
|
839
|
-
levels:n,dedupe:o,worker:i={},caller:s=
|
|
837
|
+
i.unref(),r.autoEnd!==!1&&pb(i)}function a(){i.closed||(i.flushSync(),db(100),i.end())}return i}function wb(e){e.ref(),e.
|
|
838
|
+
flushSync(),e.end(),e.once("close",function(){e.unref()})}function _b(e){e.flushSync()}function bb(e){let{pipeline:t,targets:r,
|
|
839
|
+
levels:n,dedupe:o,worker:i={},caller:s=cb(),sync:a=!1}=e,c={...e.options},u=typeof s=="string"?[s]:s,d=typeof globalThis==
|
|
840
840
|
"object"&&Object.prototype.hasOwnProperty.call(globalThis,"__bundlerPathsOverrides")&&globalThis.__bundlerPathsOverrides&&
|
|
841
841
|
typeof globalThis.__bundlerPathsOverrides=="object"?globalThis.__bundlerPathsOverrides:Object.create(null),p=e.target;if(p&&
|
|
842
842
|
r)throw new Error("only one of target or targets can be specified");r?(p=d["pino-worker"]||Xi(__dirname,"worker.js"),c.targets=
|
|
843
843
|
r.filter(l=>l.target).map(l=>({...l,target:h(l.target)})),c.pipelines=r.filter(l=>l.pipeline).map(l=>l.pipeline.map(w=>({
|
|
844
844
|
...w,level:l.level,target:h(w.target)})))):t&&(p=d["pino-worker"]||Xi(__dirname,"worker.js"),c.pipelines=[t.map(l=>({...l,
|
|
845
|
-
target:h(l.target)}))]),n&&(c.levels=n),o&&(c.dedupe=o),c.pinoWillSendConfig=!0;let g=r||t?"pino.transport":p;return
|
|
846
|
-
h(p),c,i,a,g);function h(l){if(l=d[l]||l,
|
|
847
|
-
"..","file.js");let w;for(let _ of u)try{let f=_==="node:repl"?process.cwd()+
|
|
848
|
-
if(!w)throw new Error(`unable to determine transport target for "${l}"`);return w}}
|
|
849
|
-
ts=
|
|
850
|
-
stringifySym:
|
|
851
|
-
nestedKeyStrSym:
|
|
852
|
-
".").map(e=>Number(e)),
|
|
845
|
+
target:h(l.target)}))]),n&&(c.levels=n),o&&(c.dedupe=o),c.pinoWillSendConfig=!0;let g=r||t?"pino.transport":p;return yb(
|
|
846
|
+
h(p),c,i,a,g);function h(l){if(l=d[l]||l,ed(l)||l.indexOf("file://")===0)return l;if(l==="pino/file")return Xi(__dirname,
|
|
847
|
+
"..","file.js");let w;for(let _ of u)try{let f=_==="node:repl"?process.cwd()+ub:_;w=sb(f).resolve(l);break}catch{continue}
|
|
848
|
+
if(!w)throw new Error(`unable to determine transport target for "${l}"`);return w}}td.exports=bb});var Cn=z((uj,md)=>{"use strict";var Eb=X("node:diagnostics_channel"),rd=Sl(),{mapHttpRequest:Sb,mapHttpResponse:vb}=$i(),
|
|
849
|
+
ts=Cl(),nd=Fi(),{lsCacheSym:Tb,chindingsSym:cd,writeSym:od,serializersSym:ud,formatOptsSym:id,endSym:Ib,stringifiersSym:ld,
|
|
850
|
+
stringifySym:dd,stringifySafeSym:rs,wildcardFirstSym:fd,nestedKeySym:Ob,formattersSym:pd,messageKeySym:Rb,errorKeySym:Ab,
|
|
851
|
+
nestedKeyStrSym:Pb,msgPrefixSym:An}=Nt(),{isMainThread:Cb}=X("worker_threads"),Nb=Qi(),[jb]=process.versions.node.split(
|
|
852
|
+
".").map(e=>Number(e)),sd=Eb.tracingChannel("pino_asJson"),es=jb>=25?e=>JSON.stringify(e):kb;function xt(){}function xb(e,t){
|
|
853
853
|
if(!t)return r;return function(...o){t.call(this,o,r,e)};function r(n,...o){if(typeof n=="object"){let i=n;n!==null&&(n.
|
|
854
|
-
method&&n.headers&&n.socket?n=
|
|
855
|
-
o.shift(),s=o),typeof this[An]=="string"&&i!==void 0&&i!==null&&(i=this[An]+i),this[
|
|
856
|
-
void 0?o.shift():n;typeof this[An]=="string"&&i!==void 0&&i!==null&&(i=this[An]+i),this[
|
|
854
|
+
method&&n.headers&&n.socket?n=Sb(n):typeof n.setHeader=="function"&&(n=vb(n)));let s;i===null&&o.length===0?s=[null]:(i=
|
|
855
|
+
o.shift(),s=o),typeof this[An]=="string"&&i!==void 0&&i!==null&&(i=this[An]+i),this[od](n,rd(i,s,this[id]),e)}else{let i=n===
|
|
856
|
+
void 0?o.shift():n;typeof this[An]=="string"&&i!==void 0&&i!==null&&(i=this[An]+i),this[od](null,rd(i,o,this[id]),e)}}}function kb(e){
|
|
857
857
|
let t="",r=0,n=!1,o=255,i=e.length;if(i>100)return JSON.stringify(e);for(var s=0;s<i&&o>=32;s++)o=e.charCodeAt(s),(o===34||
|
|
858
|
-
o===92)&&(t+=e.slice(r,s)+"\\",r=s,n=!0);return n?t+=e.slice(r):t=e,o<32?JSON.stringify(e):'"'+t+'"'}function
|
|
859
|
-
if(
|
|
860
|
-
r,n)}function
|
|
861
|
-
h=this[
|
|
858
|
+
o===92)&&(t+=e.slice(r,s)+"\\",r=s,n=!0);return n?t+=e.slice(r):t=e,o<32?JSON.stringify(e):'"'+t+'"'}function $b(e,t,r,n){
|
|
859
|
+
if(sd.hasSubscribers===!1)return ad.call(this,e,t,r,n);let o={instance:this,arguments};return sd.traceSync(ad,o,this,e,t,
|
|
860
|
+
r,n)}function ad(e,t,r,n){let o=this[dd],i=this[rs],s=this[ld],a=this[Ib],c=this[cd],u=this[ud],d=this[pd],p=this[Rb],g=this[Ab],
|
|
861
|
+
h=this[Tb][r]+n;h=h+c;let l;d.log&&(e=d.log(e));let w=s[fd],_="";for(let m in e)if(l=e[m],Object.prototype.hasOwnProperty.
|
|
862
862
|
call(e,m)&&l!==void 0){u[m]?l=u[m](l):m===g&&u.err&&(l=u.err(l));let y=s[m]||w;switch(typeof l){case"undefined":case"fun\
|
|
863
863
|
ction":continue;case"number":Number.isFinite(l)===!1&&(l=null);case"boolean":y&&(l=y(l));break;case"string":l=(y||es)(l);
|
|
864
864
|
break;default:l=(y||o)(l,i)}if(l===void 0)continue;let E=es(m);_+=","+E+":"+l}let f="";if(t!==void 0){l=u[p]?u[p](t):t;let m=s[p]||
|
|
865
865
|
w;switch(typeof l){case"function":break;case"number":Number.isFinite(l)===!1&&(l=null);case"boolean":m&&(l=m(l)),f=',"'+
|
|
866
|
-
p+'":'+l;break;case"string":l=(m||es)(l),f=',"'+p+'":'+l;break;default:l=(m||o)(l,i),f=',"'+p+'":'+l}}return this[
|
|
867
|
-
h+this[
|
|
866
|
+
p+'":'+l;break;case"string":l=(m||es)(l),f=',"'+p+'":'+l;break;default:l=(m||o)(l,i),f=',"'+p+'":'+l}}return this[Ob]&&_?
|
|
867
|
+
h+this[Pb]+_.slice(1)+"}"+f+a:h+_+f+a}function Lb(e,t){let r,n=e[cd],o=e[dd],i=e[rs],s=e[ld],a=s[fd],c=e[ud],u=e[pd].bindings;
|
|
868
868
|
t=u(t);for(let d in t)if(r=t[d],((d.length<5||d!=="level"&&d!=="serializers"&&d!=="formatters"&&d!=="customLevels")&&t.hasOwnProperty(
|
|
869
|
-
d)&&r!==void 0)===!0){if(r=c[d]?c[d](r):r,r=(s[d]||a||o)(r,i),r===void 0)continue;n+=',"'+d+'":'+r}return n}function
|
|
870
|
-
return e.write!==e.constructor.prototype.write}function Pn(e){let t=new ts(e);return t.on("error",r),!e.sync&&
|
|
871
|
-
t
|
|
872
|
-
t.destroy=xt;return}t.removeListener("error",r),t.emit("error",n)}}function
|
|
873
|
-
e.on("drain",function(){e.end()})):e.flushSync())}function
|
|
869
|
+
d)&&r!==void 0)===!0){if(r=c[d]?c[d](r):r,r=(s[d]||a||o)(r,i),r===void 0)continue;n+=',"'+d+'":'+r}return n}function Mb(e){
|
|
870
|
+
return e.write!==e.constructor.prototype.write}function Pn(e){let t=new ts(e);return t.on("error",r),!e.sync&&Cb&&(nd.register(
|
|
871
|
+
t,Db),t.on("close",function(){nd.unregister(t)})),t;function r(n){if(n.code==="EPIPE"){t.write=xt,t.end=xt,t.flushSync=xt,
|
|
872
|
+
t.destroy=xt;return}t.removeListener("error",r),t.emit("error",n)}}function Db(e,t){e.destroyed||(t==="beforeExit"?(e.flush(),
|
|
873
|
+
e.on("drain",function(){e.end()})):e.flushSync())}function Vb(e){return function(r,n,o={},i){if(typeof o=="string")i=Pn(
|
|
874
874
|
{dest:o}),o={};else if(typeof i=="string"){if(o&&o.transport)throw Error("only one of option.transport or stream can be \
|
|
875
875
|
specified");i=Pn({dest:i})}else if(o instanceof ts||o.writable||o._writableState)i=o,o={};else if(o.transport){if(o.transport instanceof
|
|
876
876
|
ts||o.transport.writable||o.transport._writableState)throw Error("option.transport do not allow stream, please pass to o\
|
|
877
877
|
ption directly. e.g. pino(transport)");if(o.transport.targets&&o.transport.targets.length&&o.formatters&&typeof o.formatters.
|
|
878
878
|
level=="function")throw Error("option.transport.targets do not allow custom level formatters");let c;o.customLevels&&(c=
|
|
879
|
-
o.useOnlyCustomLevels?o.customLevels:Object.assign({},o.levels,o.customLevels)),i=
|
|
879
|
+
o.useOnlyCustomLevels?o.customLevels:Object.assign({},o.levels,o.customLevels)),i=Nb({caller:n,...o.transport,levels:c})}
|
|
880
880
|
if(o=Object.assign({},e,o),o.serializers=Object.assign({},e.serializers,o.serializers),o.formatters=Object.assign({},e.formatters,
|
|
881
881
|
o.formatters),o.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (htt\
|
|
882
882
|
ps://github.com/pinojs/pino-pretty)");let{enabled:s,onChild:a}=o;return s===!1&&(o.level="silent"),a||(o.onChild=xt),i||
|
|
883
|
-
(
|
|
883
|
+
(Mb(process.stdout)?i=process.stdout:i=Pn({fd:process.stdout.fd||1})),{opts:o,stream:i}}}function Ub(e,t){try{return JSON.
|
|
884
884
|
stringify(e)}catch{try{return(t||this[rs])(e)}catch{return'"[unable to serialize, circular reference is too complex to a\
|
|
885
|
-
nalyze]"'}}}function
|
|
886
|
-
Number.isFinite(t)?t:e===void 0?1:e}
|
|
887
|
-
stringify:
|
|
888
|
-
SORTING_ORDER:
|
|
889
|
-
hooksSym:
|
|
890
|
-
|
|
891
|
-
error:e=>ot(
|
|
892
|
-
keys(
|
|
893
|
-
let t=e[
|
|
894
|
-
n,e}function
|
|
895
|
-
return!1}}function
|
|
896
|
-
level value"+e);e=t[e]}if(r[e]===void 0)throw Error("unknown level "+e);let n=this[ns],o=this[ns]=r[e],i=this[
|
|
897
|
-
a=this[
|
|
898
|
-
"level-change",e,o,t[n],n,this)}function
|
|
899
|
-
let{values:t}=this.levels,r=t[e];return r!==void 0&&this[
|
|
900
|
-
function
|
|
885
|
+
nalyze]"'}}}function Bb(e,t,r){return{level:e,bindings:t,log:r}}function zb(e){let t=Number(e);return typeof e=="string"&&
|
|
886
|
+
Number.isFinite(t)?t:e===void 0?1:e}md.exports={noop:xt,buildSafeSonicBoom:Pn,asChindings:Lb,asJson:$b,genLog:xb,createArgsNormalizer:Vb,
|
|
887
|
+
stringify:Ub,buildFormatters:Bb,normalizeDestFileDescriptor:zb}});var Nn=z((lj,hd)=>{var Gb={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Fb={ASC:"ASC",DESC:"DESC"};hd.exports={DEFAULT_LEVELS:Gb,
|
|
888
|
+
SORTING_ORDER:Fb}});var is=z((dj,_d)=>{"use strict";var{lsCacheSym:Hb,levelValSym:ns,useOnlyCustomLevelsSym:qb,streamSym:Wb,formattersSym:Yb,
|
|
889
|
+
hooksSym:Jb,levelCompSym:gd}=Nt(),{noop:Kb,genLog:ot}=Cn(),{DEFAULT_LEVELS:Ie,SORTING_ORDER:yd}=Nn(),wd={fatal:e=>{let t=ot(
|
|
890
|
+
Ie.fatal,e);return function(...r){let n=this[Wb];if(t.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},
|
|
891
|
+
error:e=>ot(Ie.error,e),warn:e=>ot(Ie.warn,e),info:e=>ot(Ie.info,e),debug:e=>ot(Ie.debug,e),trace:e=>ot(Ie.trace,e)},os=Object.
|
|
892
|
+
keys(Ie).reduce((e,t)=>(e[Ie[t]]=t,e),{}),Xb=Object.keys(os).reduce((e,t)=>(e[t]='{"level":'+Number(t),e),{});function Zb(e){
|
|
893
|
+
let t=e[Yb].level,{labels:r}=e.levels,n={};for(let o in r){let i=t(r[o],Number(o));n[o]=JSON.stringify(i).slice(0,-1)}return e[Hb]=
|
|
894
|
+
n,e}function Qb(e,t){if(t)return!1;switch(e){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:
|
|
895
|
+
return!1}}function eE(e){let{labels:t,values:r}=this.levels;if(typeof e=="number"){if(t[e]===void 0)throw Error("unknown\
|
|
896
|
+
level value"+e);e=t[e]}if(r[e]===void 0)throw Error("unknown level "+e);let n=this[ns],o=this[ns]=r[e],i=this[qb],s=this[gd],
|
|
897
|
+
a=this[Jb].logMethod;for(let c in r){if(s(r[c],o)===!1){this[c]=Kb;continue}this[c]=Qb(c,i)?wd[c](a):ot(r[c],a)}this.emit(
|
|
898
|
+
"level-change",e,o,t[n],n,this)}function tE(e){let{levels:t,levelVal:r}=this;return t&&t.labels?t.labels[r]:""}function rE(e){
|
|
899
|
+
let{values:t}=this.levels,r=t[e];return r!==void 0&&this[gd](r,this[ns])}function nE(e,t,r){return e===yd.DESC?t<=r:t>=r}
|
|
900
|
+
function oE(e){return typeof e=="string"?nE.bind(null,e):e}function iE(e=null,t=!1){let r=e?Object.keys(e).reduce((i,s)=>(i[e[s]]=
|
|
901
901
|
s,i),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),t?null:os,r),o=Object.assign(Object.
|
|
902
|
-
create(Object.prototype,{silent:{value:1/0}}),t?null:
|
|
902
|
+
create(Object.prototype,{silent:{value:1/0}}),t?null:Ie,e);return{labels:n,values:o}}function sE(e,t,r){if(typeof e=="nu\
|
|
903
903
|
mber"){if(![].concat(Object.keys(t||{}).map(i=>t[i]),r?[]:Object.keys(os).map(i=>+i),1/0).includes(e))throw Error(`defau\
|
|
904
904
|
lt level:${e} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),
|
|
905
|
-
r?null:
|
|
905
|
+
r?null:Ie,t);if(!(e in n))throw Error(`default level:${e} must be included in custom levels`)}function aE(e,t){let{labels:r,
|
|
906
906
|
values:n}=e;for(let o in t){if(o in n)throw Error("levels cannot be overridden");if(t[o]in r)throw Error("pre-existing l\
|
|
907
|
-
evel values cannot be used for new levels")}}function
|
|
908
|
-
|
|
909
|
-
genLsCache:
|
|
910
|
-
genLevelComparison:
|
|
911
|
-
chindingsSym:xn,mixinSym:
|
|
912
|
-
serializersSym:it,formattersSym:pr,errorKeySym:
|
|
913
|
-
stringifySym:
|
|
914
|
-
mappings:
|
|
915
|
-
stringify:
|
|
916
|
-
isLevelEnabled:
|
|
917
|
-
throw Error("levelVal is read-only")},get msgPrefix(){return this[us]},get[Symbol.toStringTag](){return"Pino"},[
|
|
918
|
-
[
|
|
919
|
-
function
|
|
920
|
-
null)return o[pr].bindings!==jn&&(o[pr]=as(n.level,jn,n.log)),o[xn]=ls(o,e),this.onChild!==
|
|
907
|
+
evel values cannot be used for new levels")}}function cE(e){if(typeof e!="function"&&!(typeof e=="string"&&Object.values(
|
|
908
|
+
yd).includes(e)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}_d.exports={initialLsCache:Xb,
|
|
909
|
+
genLsCache:Zb,levelMethods:wd,getLevel:tE,setLevel:eE,isLevelEnabled:rE,mappings:iE,assertNoLevelCollisions:aE,assertDefaultLevelFound:sE,
|
|
910
|
+
genLevelComparison:oE,assertLevelComparison:cE}});var ss=z((fj,bd)=>{"use strict";bd.exports={version:"10.3.1"}});var Ad=z((mj,Rd)=>{"use strict";var{EventEmitter:uE}=X("node:events"),{lsCacheSym:lE,levelValSym:dE,setLevelSym:cs,getLevelSym:Ed,
|
|
911
|
+
chindingsSym:xn,mixinSym:fE,asJsonSym:vd,writeSym:pE,mixinMergeStrategySym:mE,timeSym:hE,timeSliceIndexSym:gE,streamSym:Td,
|
|
912
|
+
serializersSym:it,formattersSym:pr,errorKeySym:yE,messageKeySym:wE,useOnlyCustomLevelsSym:_E,needsMetadataGsym:bE,redactFmtSym:EE,
|
|
913
|
+
stringifySym:SE,formatOptsSym:vE,stringifiersSym:TE,msgPrefixSym:us,hooksSym:IE}=Nt(),{getLevel:OE,setLevel:RE,isLevelEnabled:AE,
|
|
914
|
+
mappings:PE,initialLsCache:CE,genLsCache:NE,assertNoLevelCollisions:jE}=is(),{asChindings:ls,asJson:xE,buildFormatters:as,
|
|
915
|
+
stringify:Sd,noop:Id}=Cn(),{version:kE}=ss(),$E=Vi(),LE=class{},Od={constructor:LE,child:ME,bindings:DE,setBindings:VE,flush:zE,
|
|
916
|
+
isLevelEnabled:AE,version:kE,get level(){return this[Ed]()},set level(e){this[cs](e)},get levelVal(){return this[dE]},set levelVal(e){
|
|
917
|
+
throw Error("levelVal is read-only")},get msgPrefix(){return this[us]},get[Symbol.toStringTag](){return"Pino"},[lE]:CE,[pE]:BE,
|
|
918
|
+
[vd]:xE,[Ed]:OE,[cs]:RE};Object.setPrototypeOf(Od,uE.prototype);Rd.exports=function(){return Object.create(Od)};var jn=e=>e;
|
|
919
|
+
function ME(e,t){if(!e)throw Error("missing bindings for child Pino");let r=this[it],n=this[pr],o=Object.create(this);if(t==
|
|
920
|
+
null)return o[pr].bindings!==jn&&(o[pr]=as(n.level,jn,n.log)),o[xn]=ls(o,e),this.onChild!==Id&&this.onChild(o),o;if(t.hasOwnProperty(
|
|
921
921
|
"serializers")===!0){o[it]=Object.create(null);for(let u in r)o[it][u]=r[u];let a=Object.getOwnPropertySymbols(r);for(var i=0;i<
|
|
922
922
|
a.length;i++){let u=a[i];o[it][u]=r[u]}for(let u in t.serializers)o[it][u]=t.serializers[u];let c=Object.getOwnPropertySymbols(
|
|
923
923
|
t.serializers);for(var s=0;s<c.length;s++){let u=c[s];o[it][u]=t.serializers[u]}}else o[it]=r;if(t.hasOwnProperty("forma\
|
|
924
924
|
tters")){let{level:a,bindings:c,log:u}=t.formatters;o[pr]=as(a||n.level,c||jn,u||n.log)}else o[pr]=as(n.level,jn,n.log);
|
|
925
|
-
if(t.hasOwnProperty("customLevels")===!0&&(
|
|
926
|
-
redact=="object"&&t.redact!==null||Array.isArray(t.redact)){o.redact=t.redact;let a
|
|
927
|
-
o[
|
|
928
|
-
t.level!==this.level||t.hasOwnProperty("customLevels")){let a=t.level||this.level;o[cs](a)}return this.onChild(o),o}function
|
|
929
|
-
let t=`{${this[xn].substr(1)}}`,r=JSON.parse(t);return delete r.pid,delete r.hostname,r}function
|
|
930
|
-
this[xn]=t}function
|
|
931
|
-
a=this[
|
|
932
|
-
e[s]===void 0&&e[i]&&(t=e[i].message)),o&&(c=a(c,o(c,r,this)));let d=this[
|
|
933
|
-
r,p.lastObj=c,p.lastMsg=t,p.lastTime=n.slice(this[
|
|
934
|
-
"function")throw Error("callback must be a function");let t=this[
|
|
935
|
-
at;ms.stringify=at;ms.configure=ps;
|
|
936
|
-
length<5e3&&!
|
|
937
|
-
length;r++){let n=e[r],o=r;for(;o!==0&&e[o-1]>n;)e[o]=e[o-1],o--;e[o]=n}return e}var
|
|
938
|
-
Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function fs(e){return
|
|
939
|
-
e.length!==0}function
|
|
940
|
-
`${t}"${i}":${n}${e[i]}`;return o}function
|
|
925
|
+
if(t.hasOwnProperty("customLevels")===!0&&(jE(this.levels,t.customLevels),o.levels=PE(t.customLevels,o[_E]),NE(o)),typeof t.
|
|
926
|
+
redact=="object"&&t.redact!==null||Array.isArray(t.redact)){o.redact=t.redact;let a=$E(o.redact,Sd),c={stringify:a[EE]};
|
|
927
|
+
o[SE]=Sd,o[TE]=a,o[vE]=c}if(typeof t.msgPrefix=="string"&&(o[us]=(this[us]||"")+t.msgPrefix),o[xn]=ls(o,e),t.level!==void 0&&
|
|
928
|
+
t.level!==this.level||t.hasOwnProperty("customLevels")){let a=t.level||this.level;o[cs](a)}return this.onChild(o),o}function DE(){
|
|
929
|
+
let t=`{${this[xn].substr(1)}}`,r=JSON.parse(t);return delete r.pid,delete r.hostname,r}function VE(e){let t=ls(this,e);
|
|
930
|
+
this[xn]=t}function UE(e,t){return Object.assign(t,e)}function BE(e,t,r){let n=this[hE](),o=this[fE],i=this[yE],s=this[wE],
|
|
931
|
+
a=this[mE]||UE,c,u=this[IE].streamWrite;e==null?c={}:e instanceof Error?(c={[i]:e},t===void 0&&(t=e.message)):(c=e,t===void 0&&
|
|
932
|
+
e[s]===void 0&&e[i]&&(t=e[i].message)),o&&(c=a(c,o(c,r,this)));let d=this[vd](c,t,r,n),p=this[Td];p[bE]===!0&&(p.lastLevel=
|
|
933
|
+
r,p.lastObj=c,p.lastMsg=t,p.lastTime=n.slice(this[gE]),p.lastLogger=this),p.write(u?u(d):d)}function zE(e){if(e!=null&&typeof e!=
|
|
934
|
+
"function")throw Error("callback must be a function");let t=this[Td];typeof t.flush=="function"?t.flush(e||Id):e&&e()}});var jd=z((ms,Nd)=>{"use strict";var{hasOwnProperty:mr}=Object.prototype,at=ps();at.configure=ps;at.stringify=at;at.default=
|
|
935
|
+
at;ms.stringify=at;ms.configure=ps;Nd.exports=at;var GE=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Be(e){return e.
|
|
936
|
+
length<5e3&&!GE.test(e)?`"${e}"`:JSON.stringify(e)}function ds(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.
|
|
937
|
+
length;r++){let n=e[r],o=r;for(;o!==0&&e[o-1]>n;)e[o]=e[o-1],o--;e[o]=n}return e}var FE=Object.getOwnPropertyDescriptor(
|
|
938
|
+
Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function fs(e){return FE.call(e)!==void 0&&
|
|
939
|
+
e.length!==0}function Pd(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",o=`"0":${n}${e[0]}`;for(let i=1;i<r;i++)o+=
|
|
940
|
+
`${t}"${i}":${n}${e[i]}`;return o}function HE(e){if(mr.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="stri\
|
|
941
941
|
ng")return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting cir\
|
|
942
942
|
cular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null o\
|
|
943
|
-
r undefined')}return'"[Circular]"'}function
|
|
943
|
+
r undefined')}return'"[Circular]"'}function qE(e){let t;if(mr.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boo\
|
|
944
944
|
lean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator fun\
|
|
945
|
-
ction');return t===void 0?!0:t}function
|
|
946
|
-
`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function
|
|
945
|
+
ction');return t===void 0?!0:t}function WE(e,t){let r;if(mr.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(
|
|
946
|
+
`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function Cd(e,t){let r;if(mr.call(e,t)){if(r=e[t],
|
|
947
947
|
typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(
|
|
948
948
|
`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?
|
|
949
|
-
1/0:r}function st(e){return e===1?"1 item":`${e} items`}function
|
|
950
|
-
typeof r=="number")&&t.add(String(r));return t}function
|
|
949
|
+
1/0:r}function st(e){return e===1?"1 item":`${e} items`}function YE(e){let t=new Set;for(let r of e)(typeof r=="string"||
|
|
950
|
+
typeof r=="number")&&t.add(String(r));return t}function JE(e){if(mr.call(e,"strict")){let t=e.strict;if(typeof t!="boole\
|
|
951
951
|
an")throw new TypeError('The "strict" argument must be of type boolean');if(t)return r=>{let n=`Object can not safely be\
|
|
952
952
|
stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function ps(e){
|
|
953
|
-
e={...e};let t=
|
|
954
|
-
e,"bigint"),o=
|
|
953
|
+
e={...e};let t=JE(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=HE(e),n=WE(
|
|
954
|
+
e,"bigint"),o=qE(e),i=typeof o=="function"?o:void 0,s=Cd(e,"maximumDepth"),a=Cd(e,"maximumBreadth");function c(h,l,w,_,f,m){
|
|
955
955
|
let y=l[h];switch(typeof y=="object"&&y!==null&&typeof y.toJSON=="function"&&(y=y.toJSON(h)),y=_.call(l,h,y),typeof y){case"\
|
|
956
956
|
string":return Be(y);case"object":{if(y===null)return"null";if(w.indexOf(y)!==-1)return r;let E="",T=",",S=m;if(Array.isArray(
|
|
957
957
|
y)){if(y.length===0)return"[]";if(s<w.length+1)return'"[Array]"';w.push(y),f!==""&&(m+=f,E+=`
|
|
@@ -989,7 +989,7 @@ P),l[P],w,_,f);if(O+=C!==void 0?C:"null",l.length-1>a){let D=l.length-a-1;O+=`${
|
|
|
989
989
|
`
|
|
990
990
|
${m}`,w.pop(),`[${O}]`}let y=Object.keys(l),E=y.length;if(E===0)return"{}";if(s<w.length+1)return'"[Object]"';f+=_;let T=`\
|
|
991
991
|
,
|
|
992
|
-
${f}`,S="",v="",R=Math.min(E,a);fs(l)&&(S+=
|
|
992
|
+
${f}`,S="",v="",R=Math.min(E,a);fs(l)&&(S+=Pd(l,T,a),y=y.slice(l.length),R-=l.length,v=T),o&&(y=ds(y,i)),w.push(l);for(let O=0;O<
|
|
993
993
|
R;O++){let A=y[O],$=d(A,l[A],w,_,f);$!==void 0&&(S+=`${v}${Be(A)}: ${$}`,v=T)}if(E>a){let O=E-a;S+=`${v}"...": "${st(O)}\
|
|
994
994
|
not stringified"`,v=T}return v!==""&&(S=`
|
|
995
995
|
${f}${S}
|
|
@@ -1000,200 +1000,200 @@ object")return p(h,l,w);if(l===null)return"null"}if(w.indexOf(l)!==-1)return r;l
|
|
|
1000
1000
|
isArray(l)){if(l.length===0)return"[]";if(s<w.length+1)return'"[Array]"';w.push(l);let S=Math.min(l.length,a),v=0;for(;v<
|
|
1001
1001
|
S-1;v++){let O=p(String(v),l[v],w);_+=O!==void 0?O:"null",_+=","}let R=p(String(v),l[v],w);if(_+=R!==void 0?R:"null",l.length-
|
|
1002
1002
|
1>a){let O=l.length-a-1;_+=`,"... ${st(O)} not stringified"`}return w.pop(),`[${_}]`}let m=Object.keys(l),y=m.length;if(y===
|
|
1003
|
-
0)return"{}";if(s<w.length+1)return'"[Object]"';let E="",T=Math.min(y,a);f&&fs(l)&&(_+=
|
|
1003
|
+
0)return"{}";if(s<w.length+1)return'"[Object]"';let E="",T=Math.min(y,a);f&&fs(l)&&(_+=Pd(l,",",a),m=m.slice(l.length),T-=
|
|
1004
1004
|
l.length,E=","),o&&(m=ds(m,i)),w.push(l);for(let S=0;S<T;S++){let v=m[S],R=p(v,l[v],w);R!==void 0&&(_+=`${E}${Be(v)}:${R}`,
|
|
1005
1005
|
E=",")}if(y>a){let S=y-a;_+=`${E}"...":"${st(S)} not stringified"`}return w.pop(),`{${_}}`}case"number":return isFinite(
|
|
1006
1006
|
l)?String(l):t?t(l):"null";case"boolean":return l===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(
|
|
1007
1007
|
l);default:return t?t(l):void 0}}function g(h,l,w){if(arguments.length>1){let _="";if(typeof w=="number"?_=" ".repeat(Math.
|
|
1008
1008
|
min(w,10)):typeof w=="string"&&(_=w.slice(0,10)),l!=null){if(typeof l=="function")return c("",{"":h},[],l,_,"");if(Array.
|
|
1009
|
-
isArray(l))return u("",h,[],
|
|
1010
|
-
e=e||[],t=t||{dedupe:!1};let r=Object.create(
|
|
1009
|
+
isArray(l))return u("",h,[],YE(l),_,"")}if(_.length!==0)return d("",h,[],_,"")}return p("",h,[])}return g}});var Ld=z((hj,$d)=>{"use strict";var hs=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:kd}=Nn(),KE=kd.info;function XE(e,t){
|
|
1010
|
+
e=e||[],t=t||{dedupe:!1};let r=Object.create(kd);r.silent=1/0,t.levels&&typeof t.levels=="object"&&Object.keys(t.levels).
|
|
1011
1011
|
forEach(p=>{r[p]=t.levels[p]});let n={write:o,add:a,remove:c,emit:i,flushSync:s,end:u,minLevel:0,lastId:0,streams:[],clone:d,
|
|
1012
1012
|
[hs]:!0,streamLevels:r};return Array.isArray(e)?e.forEach(a,n):a.call(n,e),e=null,n;function o(p){let g,h=this.lastLevel,
|
|
1013
|
-
{streams:l}=this,w=0,_;for(let f=
|
|
1013
|
+
{streams:l}=this,w=0,_;for(let f=ZE(l.length,t.dedupe);eS(f,l.length,t.dedupe);f=QE(f,t.dedupe))if(g=l[f],g.level<=h){if(w!==
|
|
1014
1014
|
0&&w!==g.level)break;if(_=g.stream,_[hs]){let{lastTime:m,lastMsg:y,lastObj:E,lastLogger:T}=this;_.lastLevel=h,_.lastTime=
|
|
1015
1015
|
m,_.lastMsg=y,_.lastObj=E,_.lastLogger=T}_.write(p),t.dedupe&&(w=g.level)}else if(!t.dedupe)break}function i(...p){for(let{
|
|
1016
1016
|
stream:g}of this.streams)typeof g.emit=="function"&&g.emit(...p)}function s(){for(let{stream:p}of this.streams)typeof p.
|
|
1017
1017
|
flushSync=="function"&&p.flushSync()}function a(p){if(!p)return n;let g=typeof p.write=="function"||p.stream,h=p.write?p:
|
|
1018
1018
|
p.stream;if(!g)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:l,
|
|
1019
1019
|
streamLevels:w}=this,_;typeof p.levelVal=="number"?_=p.levelVal:typeof p.level=="string"?_=w[p.level]:typeof p.level=="n\
|
|
1020
|
-
umber"?_=p.level:_=
|
|
1021
|
-
l[0].level,n}function c(p){let{streams:g}=this,h=g.findIndex(l=>l.id===p);return h>=0&&(g.splice(h,1),g.sort(
|
|
1020
|
+
umber"?_=p.level:_=KE;let f={stream:h,level:_,levelVal:void 0,id:++n.lastId};return l.unshift(f),l.sort(xd),this.minLevel=
|
|
1021
|
+
l[0].level,n}function c(p){let{streams:g}=this,h=g.findIndex(l=>l.id===p);return h>=0&&(g.splice(h,1),g.sort(xd),this.minLevel=
|
|
1022
1022
|
g.length>0?g[0].level:-1),n}function u(){for(let{stream:p}of this.streams)typeof p.flushSync=="function"&&p.flushSync(),
|
|
1023
1023
|
p.end()}function d(p){let g=new Array(this.streams.length);for(let h=0;h<g.length;h++)g[h]={level:p,stream:this.streams[h].
|
|
1024
|
-
stream};return{write:o,add:a,remove:c,minLevel:p,streams:g,clone:d,emit:i,flushSync:s,[hs]:!0}}}function
|
|
1025
|
-
level-t.level}function
|
|
1026
|
-
exports=
|
|
1027
|
-
{assertDefaultLevelFound:
|
|
1028
|
-
SORTING_ORDER:
|
|
1029
|
-
noop:
|
|
1030
|
-
stringifySym:
|
|
1031
|
-
nestedKeySym:
|
|
1032
|
-
msgPrefixSym:
|
|
1033
|
-
ASC,levels:
|
|
1034
|
-
Object.create(null),{err:
|
|
1035
|
-
hooks:{logMethod:void 0,streamWrite:void 0},timestamp:
|
|
1036
|
-
depthLimit:5,edgeLimit:100}
|
|
1037
|
-
t,
|
|
1024
|
+
stream};return{write:o,add:a,remove:c,minLevel:p,streams:g,clone:d,emit:i,flushSync:s,[hs]:!0}}}function xd(e,t){return e.
|
|
1025
|
+
level-t.level}function ZE(e,t){return t?e-1:0}function QE(e,t){return t?e-1:e+1}function eS(e,t,r){return r?e>=0:e<t}$d.
|
|
1026
|
+
exports=XE});var Kd=z((gj,ge)=>{"use strict";var tS=X("node:os"),Fd=$i(),rS=Li(),nS=Vi(),Hd=bl(),oS=Ad(),qd=Nt(),{configure:iS}=jd(),
|
|
1027
|
+
{assertDefaultLevelFound:sS,mappings:Wd,genLsCache:aS,genLevelComparison:cS,assertLevelComparison:uS}=is(),{DEFAULT_LEVELS:Yd,
|
|
1028
|
+
SORTING_ORDER:lS}=Nn(),{createArgsNormalizer:dS,asChindings:fS,buildSafeSonicBoom:Md,buildFormatters:pS,stringify:gs,normalizeDestFileDescriptor:Dd,
|
|
1029
|
+
noop:mS}=Cn(),{version:hS}=ss(),{chindingsSym:Vd,redactFmtSym:gS,serializersSym:Ud,timeSym:yS,timeSliceIndexSym:wS,streamSym:_S,
|
|
1030
|
+
stringifySym:Bd,stringifySafeSym:ys,stringifiersSym:zd,setLevelSym:bS,endSym:ES,formatOptsSym:SS,messageKeySym:vS,errorKeySym:TS,
|
|
1031
|
+
nestedKeySym:IS,mixinSym:OS,levelCompSym:RS,useOnlyCustomLevelsSym:AS,formattersSym:Gd,hooksSym:PS,nestedKeyStrSym:CS,mixinMergeStrategySym:NS,
|
|
1032
|
+
msgPrefixSym:jS}=qd,{epochTime:Jd,nullTime:xS}=Hd,{pid:kS}=process,$S=tS.hostname(),LS=Fd.err,MS={level:"info",levelComparison:lS.
|
|
1033
|
+
ASC,levels:Yd,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:kS,hostname:$S},serializers:Object.assign(
|
|
1034
|
+
Object.create(null),{err:LS}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),
|
|
1035
|
+
hooks:{logMethod:void 0,streamWrite:void 0},timestamp:Jd,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,
|
|
1036
|
+
depthLimit:5,edgeLimit:100},DS=dS(MS),VS=Object.assign(Object.create(null),Fd);function ws(...e){let t={},{opts:r,stream:n}=DS(
|
|
1037
|
+
t,rS(),...e);r.level&&typeof r.level=="string"&&Yd[r.level.toLowerCase()]!==void 0&&(r.level=r.level.toLowerCase());let{
|
|
1038
1038
|
redact:o,crlf:i,serializers:s,timestamp:a,messageKey:c,errorKey:u,nestedKey:d,base:p,name:g,level:h,customLevels:l,levelComparison:w,
|
|
1039
1039
|
mixin:_,mixinMergeStrategy:f,useOnlyCustomLevels:m,formatters:y,hooks:E,depthLimit:T,edgeLimit:S,onChild:v,msgPrefix:R}=r,
|
|
1040
|
-
O=
|
|
1040
|
+
O=iS({maximumDepth:T,maximumBreadth:S}),A=pS(y.level,y.bindings,y.log),$=gs.bind({[ys]:O}),P=o?nS(o,$):{},C=o?{stringify:P[gS]}:
|
|
1041
1041
|
{stringify:$},D="}"+(i?`\r
|
|
1042
1042
|
`:`
|
|
1043
|
-
`),Y=
|
|
1044
|
-
{},p,{name:g})));let Qe=a instanceof Function?a:a?
|
|
1043
|
+
`),Y=fS.bind(null,{[Vd]:"",[Ud]:s,[zd]:P,[Bd]:gs,[ys]:O,[Gd]:A}),ae="";p!==null&&(g===void 0?ae=Y(p):ae=Y(Object.assign(
|
|
1044
|
+
{},p,{name:g})));let Qe=a instanceof Function?a:a?Jd:xS,ce=Qe().indexOf(":")+1;if(m&&!l)throw Error("customLevels is req\
|
|
1045
1045
|
uired if useOnlyCustomLevels is set true");if(_&&typeof _!="function")throw Error(`Unknown mixin type "${typeof _}" - ex\
|
|
1046
|
-
pected "function"`);if(R&&typeof R!="string")throw Error(`Unknown msgPrefix type "${typeof R}" - expected "string"`);
|
|
1047
|
-
h,l,m);let me=
|
|
1048
|
-
|
|
1049
|
-
[
|
|
1050
|
-
[
|
|
1051
|
-
"object"?(e.dest=
|
|
1052
|
-
multistream=
|
|
1053
|
-
exports.symbols=
|
|
1054
|
-
e,""),n=
|
|
1055
|
-
rror","warn","info","debug","trace","silent"]),
|
|
1056
|
-
|
|
1057
|
-
"")||t}function
|
|
1058
|
-
|
|
1046
|
+
pected "function"`);if(R&&typeof R!="string")throw Error(`Unknown msgPrefix type "${typeof R}" - expected "string"`);sS(
|
|
1047
|
+
h,l,m);let me=Wd(l,m);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:me,messageKey:c,errorKey:u}}),
|
|
1048
|
+
uS(w);let Uo=cS(w);return Object.assign(t,{levels:me,[RS]:Uo,[AS]:m,[_S]:n,[yS]:Qe,[wS]:ce,[Bd]:gs,[ys]:O,[zd]:P,[ES]:D,
|
|
1049
|
+
[SS]:C,[vS]:c,[TS]:u,[IS]:d,[CS]:d?`,${JSON.stringify(d)}:{`:"",[Ud]:s,[OS]:_,[NS]:f,[Vd]:ae,[Gd]:A,[PS]:E,silent:mS,onChild:v,
|
|
1050
|
+
[jS]:R}),Object.setPrototypeOf(t,oS()),aS(t),t[bS](h),t}ge.exports=ws;ge.exports.destination=(e=process.stdout.fd)=>typeof e==
|
|
1051
|
+
"object"?(e.dest=Dd(e.dest||process.stdout.fd),Md(e)):Md({dest:Dd(e),minLength:0});ge.exports.transport=Qi();ge.exports.
|
|
1052
|
+
multistream=Ld();ge.exports.levels=Wd();ge.exports.stdSerializers=VS;ge.exports.stdTimeFunctions=Object.assign({},Hd);ge.
|
|
1053
|
+
exports.symbols=qd;ge.exports.version=hS;ge.exports.default=ws;ge.exports.pino=ws});function Zd(e="",t=kn){let r=String(e||"").trim().toLowerCase();return US.includes(r)?r:t}function BS(e="info",t=kn){let r=Zd(
|
|
1054
|
+
e,""),n=Zd(t,kn);return!r||n==="silent"?!1:Xd[r]>=Xd[n]}var kn,US,Xd,yj,Qd=b(()=>{kn="warn",US=Object.freeze(["fatal","e\
|
|
1055
|
+
rror","warn","info","debug","trace","silent"]),Xd=Object.freeze({trace:10,debug:20,info:30,warn:40,error:50,fatal:60,silent:1/0});
|
|
1056
|
+
yj=Object.freeze({isVibe64LogLevelEnabled:BS})});function ef(e="",t="vibe64.operational_event"){return String(e||"").trim().replace(/[^a-zA-Z0-9_.:-]+/gu,"_").replace(/^_+|_+$/gu,
|
|
1057
|
+
"")||t}function YS(e=""){return GS.test(String(e||""))}function $n(e=""){return String(e||"").replace(HS,`$1$2${hr}`).replace(
|
|
1058
|
+
qS,`$1 ${hr}`).replace(FS,`$1$2${hr}`).replace(WS,`$1${hr}@`)}function gr(e,t={}){let{field:r="",seen:n=new WeakSet}=t;return YS(
|
|
1059
1059
|
r)?hr:typeof e=="string"?$n(e):!e||typeof e!="object"?e:n.has(e)?"[circular]":(n.add(e),e instanceof Error?{code:String(
|
|
1060
1060
|
e.code||""),message:$n(e.message),name:String(e.name||"Error"),...Array.isArray(e.errors)?{errors:e.errors.map(o=>gr(o,{
|
|
1061
1061
|
seen:n}))}:{},...e.cause!==void 0?{cause:gr(e.cause,{seen:n})}:{}}:Array.isArray(e)?e.map(o=>gr(o,{seen:n})):Object.fromEntries(
|
|
1062
|
-
Object.entries(e).map(([o,i])=>[o,gr(i,{field:o,seen:n})])))}function
|
|
1063
|
-
e)?e:{};return gr({...t,component:
|
|
1064
|
-
|
|
1062
|
+
Object.entries(e).map(([o,i])=>[o,gr(i,{field:o,seen:n})])))}function JS(e={}){let t=e&&typeof e=="object"&&!Array.isArray(
|
|
1063
|
+
e)?e:{};return gr({...t,component:ef(t.component,"vibe64"),event:ef(t.event,"vibe64.operational_event")})}var zS,Ej,hr,GS,
|
|
1064
|
+
FS,HS,qS,WS,Sj,tf=b(()=>{zS=gg(Kd(),1);Qd();Ej=Object.freeze(["req.headers.authorization","req.headers.cookie","req.head\
|
|
1065
1065
|
ers['set-cookie']","res.headers['set-cookie']","*.authorization","*.cookie","*.credential","*.credentials","*.databaseUr\
|
|
1066
1066
|
l","*.database_url","*.dsn","*.password","*.secret","*.token","*.apiToken","*.api_token","*.apiKey","*.api_key","*.acces\
|
|
1067
|
-
sToken","*.access_token","*.refreshToken","*.refresh_token"]),hr="[redacted]",
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1067
|
+
sToken","*.access_token","*.refreshToken","*.refresh_token"]),hr="[redacted]",GS=/(?:authorization|password|passphrase|token|secret|credential|api[_-]?key|api[_-]?token|access[_-]?token|refresh[_-]?token|database[_-]?url|dsn)/iu,
|
|
1068
|
+
FS=/\b((?:DATABASE[_-]?URL|DSN)|(?:[A-Za-z_][A-Za-z0-9_-]*?)?(?:PASSWORD|PASS|PASSPHRASE|TOKEN|SECRET|CREDENTIAL|API[_-]?KEY|API[_-]?TOKEN|ACCESS[_-]?TOKEN|REFRESH[_-]?TOKEN|DSN)[A-Za-z0-9_-]*)\b(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;]+)/giu,
|
|
1069
|
+
HS=/\b(authorization|proxy-authorization)\b(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|(?:Bearer|Basic)\s+[^\s,;]+|[^\s,;]+)/giu,qS=/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/giu,
|
|
1070
|
+
WS=/\b([a-z][a-z0-9+.-]*:\/\/)([^/@\s:]+):([^/@\s]+)@/giu;Sj=Object.freeze({operationalLogFields:JS})});import{AsyncLocalStorage as KS}from"node:async_hooks";function nf(){let e=rf.getStore()||null;if(e?.[_s]&&!e[_s].active())
|
|
1071
1071
|
throw Object.assign(new Error("Practice access ended with its owning callback. Read the saved lesson again."),{code:"vib\
|
|
1072
|
-
e64_practice_scope_expired"});return e}var
|
|
1073
|
-
return Ln.resolve(r||t||bs.cwd())}function
|
|
1074
|
-
"darwin")return
|
|
1075
|
-
Ln.join(o||Ln.join(n,".local","state"),"vibe64"))}var Es,Mn=b(()=>{Es="VIBE64_SYSTEM_ROOT"});var
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
t,null,2)}
|
|
1080
|
-
`,r)}var yr=b(()=>{});var Vn=b(()=>{yr();le();U()});function
|
|
1081
|
-
sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1})});var
|
|
1082
|
-
import{promisify as
|
|
1083
|
-
":")){let r=new Error("A valid OS username is required.");throw r.code="vibe64_invalid_os_username",r}return t}function
|
|
1072
|
+
e64_practice_scope_expired"});return e}var rf,_s,kt=b(()=>{Ve();rf=new KS,_s=Symbol("Vibe64 server practice scope")});import Ln from"node:path";import bs from"node:process";import XS from"node:os";function of(e,t){let r=String(e||"").trim();
|
|
1073
|
+
return Ln.resolve(r||t||bs.cwd())}function sf({env:e,home:t=XS.homedir(),platform:r=bs.platform}){let n=t||bs.cwd();if(r===
|
|
1074
|
+
"darwin")return of(Ln.join(n,"Library","Application Support","Vibe64"));let o=String(e.XDG_STATE_HOME||"").trim();return of(
|
|
1075
|
+
Ln.join(o||Ln.join(n,".local","state"),"vibe64"))}var Es,Mn=b(()=>{Es="VIBE64_SYSTEM_ROOT"});var af,$t=b(()=>{le();Ve();af="vibe64_practice_project_deleted"});import{randomUUID as ZS}from"node:crypto";import{mkdir as QS,open as cf,rename as ev,rm as tv}from"node:fs/promises";import Ss from"node:path";
|
|
1076
|
+
async function uf(e,t,r={}){let{directoryMode:n,fileMode:o}=r,i=Ss.dirname(e);await QS(i,{recursive:!0,mode:n});let s=Ss.
|
|
1077
|
+
join(i,`.${Ss.basename(e)}.${process.pid}.${ZS()}.tmp`),a;try{let c=await cf(s,"wx",o);try{await c.writeFile(t,"utf8"),o!==
|
|
1078
|
+
void 0&&await c.chmod(o),await c.sync(),a=await c.stat({bigint:!0})}finally{await c.close()}await ev(s,e)}finally{await tv(
|
|
1079
|
+
s,{force:!0})}return await rv(i),a}async function Dn(e,t,r={}){return uf(e,`${JSON.stringify(t,null,2)}
|
|
1080
|
+
`,r)}async function rv(e){let t=await cf(e,"r");try{await t.sync()}finally{await t.close()}}var yr=b(()=>{});var Vn=b(()=>{yr();le();U()});function ye(){return globalThis[nv]||ov}var nv,ov,Oe=b(()=>{nv=Symbol.for("vibe64.hostProfile"),ov=Object.freeze({runtimePackRoot:"",
|
|
1081
|
+
sharedCacheRoot:"",npmPrefixRoot:"",execHelperPath:"",sharedGroupAccess:!1})});var Qj,Un=b(()=>{yr();le();Ue();Oe();U();Qj=Object.freeze(["repository","branch","path","baseCommit","canonicalCommit"])});import{execFile as sv}from"node:child_process";import{readFile as av}from"node:fs/promises";import vs from"node:os";import cv from"node:path";
|
|
1082
|
+
import{promisify as uv}from"node:util";function df(e=""){let t=F(e);if(!t||t.includes("/")||t.includes("\\")||t.includes(
|
|
1083
|
+
":")){let r=new Error("A valid OS username is required.");throw r.code="vibe64_invalid_os_username",r}return t}function ff([
|
|
1084
1084
|
e,t,r,n,o,i]=[]){if(!/^\d+$/u.test(t)||!/^\d+$/u.test(r))return null;let s=Number(t),a=Number(r);return!Number.isSafeInteger(
|
|
1085
1085
|
s)||!Number.isSafeInteger(a)?null:{displayName:String(n||"").split(",")[0],gid:a,home:String(o||""),shell:String(i||""),
|
|
1086
|
-
uid:s,username:String(e||"")}}function Ts(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:
|
|
1087
|
-
t[3],t[4],t[5],t[6]])}function
|
|
1088
|
-
split(/\r?\n/u)){let o=/^\s*([a-z]+):\s?(.*)$/u.exec(n);o&&(r[o[1]]=o[2].trim())}return
|
|
1089
|
-
dir,r.shell])}).filter(Boolean)}async function
|
|
1086
|
+
uid:s,username:String(e||"")}}function Ts(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:ff([t[0],t[2],
|
|
1087
|
+
t[3],t[4],t[5],t[6]])}function dv(e=""){return String(e||"").split(/\r?\n[\t ]*\r?\n/u).map(t=>{let r={};for(let n of t.
|
|
1088
|
+
split(/\r?\n/u)){let o=/^\s*([a-z]+):\s?(.*)$/u.exec(n);o&&(r[o[1]]=o[2].trim())}return ff([r.name,r.uid,r.gid,r.gecos,r.
|
|
1089
|
+
dir,r.shell])}).filter(Boolean)}async function lf(e,t,r){let n=await e(t,r,{encoding:"utf8"});return String((typeof n=="\
|
|
1090
1090
|
string"?n:n?.stdout)||"")}function wr({homedir:e=vs.homedir,userInfo:t=vs.userInfo}={}){let r=t(),n=F(r?.username||process.
|
|
1091
|
-
env.USER||process.env.LOGNAME),o=
|
|
1091
|
+
env.USER||process.env.LOGNAME),o=cv.resolve(String(r?.homedir||e()||""));return{displayName:String(r?.username||n),gid:Number.
|
|
1092
1092
|
isSafeInteger(r?.gid)?r.gid:null,home:o,shell:String(r?.shell||""),uid:Number.isSafeInteger(r?.uid)?r.uid:null,username:n}}
|
|
1093
|
-
async function Bn(e="",{execFileFn:t=
|
|
1093
|
+
async function Bn(e="",{execFileFn:t=lv,platform:r=process.platform,readFileFn:n=av,userInfo:o=vs.userInfo}={}){let i=df(
|
|
1094
1094
|
e);if(r==="linux"&&!/^\d+$/u.test(i)){let c=[...(await n("/etc/nsswitch.conf","utf8").catch(()=>"")).matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*)/gmu)],
|
|
1095
1095
|
u=c.length===1?c[0][1].trim().split(/\s+/u):[];if(u[0]==="files"&&(u.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(u[1]))){let p=(await n(
|
|
1096
1096
|
"/etc/passwd","utf8").catch(()=>"")).split(/\r?\n/u).map(Ts).find(g=>g?.username===i);if(p)return p}}let s;if(r==="darwi\
|
|
1097
|
-
n"){let a=wr({userInfo:o});if(a.username===i)return a;[s]=
|
|
1098
|
-
s=Ts((await
|
|
1099
|
-
nd: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}var
|
|
1097
|
+
n"){let a=wr({userInfo:o});if(a.username===i)return a;[s]=dv(await lf(t,"dscacheutil",["-q","user","-a","name",i]))}else
|
|
1098
|
+
s=Ts((await lf(t,"getent",["passwd",i])).split(/\r?\n/u)[0]);if(!s||s.username!==i){let a=new Error(`OS user was not fou\
|
|
1099
|
+
nd: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}var lv,ax,zn=b(()=>{U();lv=uv(sv);ax=Object.freeze({parsePasswdLine:Ts})});var pf=b(()=>{zn();U()});import Gn from"node:path";function j(e=""){return String(e??"").trim()}function Is(e=null){let t=Number(e);return Number.
|
|
1100
1100
|
isSafeInteger(t)&&t>=0?t:null}function x(e=""){let t=j(e);return t?Gn.resolve(t):""}function ze(e="",t=""){let r=x(e),n=x(
|
|
1101
1101
|
t);if(!r||!n)return!1;let o=Gn.relative(r,n);return o!==".."&&!o.startsWith(`..${Gn.sep}`)&&!Gn.isAbsolute(o)}function ee(e={}){
|
|
1102
|
-
return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function
|
|
1102
|
+
return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function we(e={}){return Object.fromEntries(Object.entries(ee(e)).map(
|
|
1103
1103
|
([t,r])=>[j(t),String(r??"")]).filter(([t])=>!!t))}function ct(e=[]){let t=[],r=new Set;for(let n of Array.isArray(e)?e:
|
|
1104
1104
|
[e]){let o=j(n);!o||r.has(o)||(r.add(o),t.push(o))}return t}function Lt(e){let t=Date.parse(String(e||"").trim());return Number.
|
|
1105
|
-
isFinite(t)?t:0}function $e(...e){for(let t of e){let r=j(t);if(r)return r}return""}var K=b(()=>{});import
|
|
1105
|
+
isFinite(t)?t:0}function $e(...e){for(let t of e){let r=j(t);if(r)return r}return""}var K=b(()=>{});import fv from"node:os";import Os from"node:path";function Rs(e={}){let t=j(e.username),r=x(e.home||(t?`/home/${t}`:fv.homedir()));
|
|
1106
1106
|
return{displayName:j(e.displayName||t),gid:Is(e.gid),home:r,shell:j(e.shell),uid:Is(e.uid),username:t}}function As(){return Rs(
|
|
1107
1107
|
wr())}async function Ps(e="",t={}){return Rs(await Bn(e,t))}function _r(e={},t={}){let r=Rs(e);return{...t,HOME:r.home,LOGNAME:r.
|
|
1108
1108
|
username,USER:r.username,XDG_CACHE_HOME:Os.join(r.home,".cache"),XDG_CONFIG_HOME:Os.join(r.home,".config"),XDG_DATA_HOME:Os.
|
|
1109
|
-
join(r.home,".local","share")}}function
|
|
1110
|
-
getuid=="function"?process.getuid():null}}var Mt=b(()=>{zn();K()});function
|
|
1109
|
+
join(r.home,".local","share")}}function mf(){return{gid:typeof process.getgid=="function"?process.getgid():null,uid:typeof process.
|
|
1110
|
+
getuid=="function"?process.getuid():null}}var Mt=b(()=>{zn();K()});function pv(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function br({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
1111
1111
|
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:u="",timedOut:d=!1,execution:p=null,retryable:g=null}={}){
|
|
1112
|
-
let h=
|
|
1112
|
+
let h=pv(r),l=String(u||""),w=String(c||""),_=String(o||[l,w].filter(Boolean).join(`
|
|
1113
1113
|
`)).trim();return{code:j(e),error:j(t),exitCode:h,ok:n===null?h===0:n===!0,output:_,pid:Number.isSafeInteger(Number(s))?
|
|
1114
1114
|
Number(s):null,signal:j(a),stderr:w,stdout:l,...i==="base64"?{outputEncoding:i}:{},timedOut:d===!0,...p&&typeof p=="obje\
|
|
1115
1115
|
ct"&&!Array.isArray(p)?{execution:p}:{},...typeof g=="boolean"?{retryable:g}:{}}}function te(e="",t="vibe64_command_fail\
|
|
1116
1116
|
ed",r={}){let n=j(e)||"Vibe64 command failed.";return br({...r,code:t,error:n,exitCode:1,ok:!1,output:j(r.output)||n,stderr:r.
|
|
1117
|
-
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}var ut=b(()=>{K()});import{spawn as
|
|
1118
|
-
import{stripVTControlCharacters as
|
|
1119
|
-
let r=t.codePointAt(0);return r<=65535?`\\u${r.toString(16).padStart(4,"0")}`:`\\U${r.toString(16)}`})}function
|
|
1117
|
+
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}var ut=b(()=>{K()});import{spawn as mv}from"node:child_process";import{statSync as hv}from"node:fs";import gv from"node:path";import{StringDecoder as yv}from"node:string_decoder";
|
|
1118
|
+
import{stripVTControlCharacters as wv}from"node:util";function wf(e){return e.replaceAll(Ev,t=>{if(gf[t]!==void 0)return gf[t];
|
|
1119
|
+
let r=t.codePointAt(0);return r<=65535?`\\u${r.toString(16).padStart(4,"0")}`:`\\U${r.toString(16)}`})}function Sv(e){return wv(
|
|
1120
1120
|
e).split(`
|
|
1121
|
-
`).map(
|
|
1122
|
-
`)}function
|
|
1123
|
-
'"','""')}"`:`'${n.replaceAll("'","'\\''")}'`}).join(" ")}function
|
|
1124
|
-
return r;try{if(!
|
|
1121
|
+
`).map(wf).join(`
|
|
1122
|
+
`)}function vv(e,t){return[e,...t].map(r=>{let n=wf(String(r));return bv.test(n)?n:process.platform==="win32"?`"${n.replaceAll(
|
|
1123
|
+
'"','""')}"`:`'${n.replaceAll("'","'\\''")}'`}).join(" ")}function Tv(e,t){let r=String(e?.message??e);if(t===process.cwd())
|
|
1124
|
+
return r;try{if(!hv(t).isDirectory())return`The "cwd" option is not a directory: ${t}.
|
|
1125
1125
|
${r}`}catch(n){return`The "cwd" option is invalid: ${t}.
|
|
1126
1126
|
${n.message}
|
|
1127
|
-
${r}`}return r}function
|
|
1127
|
+
${r}`}return r}function Iv(e){let t=e.forcefullyTerminated?` and was forcefully terminated after ${yf} milliseconds`:"";
|
|
1128
1128
|
if(e.timedOut)return`Command timed out after ${e.timeout} milliseconds${t}`;if(e.maxBuffer)return`Command's ${e.maxBuffer.
|
|
1129
1129
|
stream} was larger than ${e.maxBuffer.limit} ${e.maxBuffer.unit}${t}`;if(e.spawnError?.code!==void 0)return`Command fail\
|
|
1130
|
-
ed with ${e.spawnError.code}${t}`;if(e.signal){let r=
|
|
1131
|
-
""}`}return e.exitCode!==void 0?`Command failed with exit code ${e.exitCode}`:"Command failed"}function
|
|
1132
|
-
|
|
1133
|
-
${t}`:""}`}function Cs(e,t){let r=new
|
|
1130
|
+
ed with ${e.spawnError.code}${t}`;if(e.signal){let r=_v[e.signal];return`Command was killed with ${e.signal}${r?` (${r})`:
|
|
1131
|
+
""}`}return e.exitCode!==void 0?`Command failed with exit code ${e.exitCode}`:"Command failed"}function Ov(e){let t=e.spawnError?
|
|
1132
|
+
Sv(Tv(e.spawnError,e.cwd)):e.maxBuffer?"maxBuffer exceeded":"";return`${Iv(e)}: ${e.commandLine}${t?`
|
|
1133
|
+
${t}`:""}`}function Cs(e,t){let r=new yv(e),n=[],o=0,i=!1;return{write(s){if(i)return!1;let a=r.write(s);return o+a.length>
|
|
1134
1134
|
t?(n.push(a.slice(0,t-o)),o=t,i=!0,!1):(n.push(a),o+=a.length,!0)},text(){if(!i){let s=r.end();s&&n.push(s.slice(0,t-o)),
|
|
1135
|
-
i=!0}return n.join("")}}}function
|
|
1136
|
-
utf8",timeout:c=0}={}){let u=Number.isSafeInteger(i)&&i>0?i:
|
|
1137
|
-
g=
|
|
1138
|
-
h={commandLine:
|
|
1135
|
+
i=!0}return n.join("")}}}function _f(e,t,{cwd:r="",env:n={},input:o=void 0,maxBuffer:i=hf,onOutput:s=null,outputEncoding:a="\
|
|
1136
|
+
utf8",timeout:c=0}={}){let u=Number.isSafeInteger(i)&&i>0?i:hf,d={all:Cs(a,u*2),stderr:Cs(a,u),stdout:Cs(a,u)},p=o!=null,
|
|
1137
|
+
g=mv(e,t,{cwd:r||void 0,detached:process.platform!=="win32",env:n,stdio:[p?"pipe":"ignore","pipe","pipe"],windowsHide:!0}),
|
|
1138
|
+
h={commandLine:vv(e,t),cwd:gv.resolve(r||"."),forcefullyTerminated:!1,maxBuffer:null,spawnError:null,timedOut:!1,timeout:c},
|
|
1139
1139
|
l=!1,w=null,_=()=>{};g.on("error",T=>{h.spawnError||=T,g.pid===void 0&&_()});let f=()=>{l||!g.kill("SIGTERM")||w||(w=setTimeout(
|
|
1140
|
-
()=>{!l&&g.kill("SIGKILL")&&(h.forcefullyTerminated=!0)},
|
|
1140
|
+
()=>{!l&&g.kill("SIGKILL")&&(h.forcefullyTerminated=!0)},yf))},m=(T,S)=>v=>{if(d.all.write(v),d[T].write(v)||(h.maxBuffer||=
|
|
1141
1141
|
{limit:u,stream:T,unit:"characters"},S.destroy()),typeof s=="function")try{s(String(v||""))}catch{}};g.stdout&&g.stdout.
|
|
1142
1142
|
on("data",m("stdout",g.stdout)),g.stderr&&g.stderr.on("data",m("stderr",g.stderr)),p&&g.stdin&&(g.stdin.on("error",()=>{}),
|
|
1143
1143
|
g.stdin.end(o));let y=c>0?setTimeout(()=>{h.timedOut=!0,f()},c):null;return{completion:new Promise(T=>{_=(S,v)=>{if(l)return;
|
|
1144
1144
|
l=!0,clearTimeout(y),clearTimeout(w);let R=h.spawnError?{}:{exitCode:typeof S=="number"&&S>=0?S:void 0,signal:v||void 0},
|
|
1145
1145
|
O=h.spawnError||h.timedOut||h.maxBuffer||R.exitCode!==0;T({all:d.all.text(),code:h.spawnError?.code,exitCode:R.exitCode,
|
|
1146
|
-
shortMessage:O?
|
|
1147
|
-
once("close",_)}),kill:T=>g.kill(T),pid:g.pid}}var
|
|
1146
|
+
shortMessage:O?Ov({...h,...R}):"",signal:R.signal,stderr:d.stderr.text(),stdout:d.stdout.text(),timedOut:h.timedOut})},g.
|
|
1147
|
+
once("close",_)}),kill:T=>g.kill(T),pid:g.pid}}var hf,yf,_v,bv,Ev,gf,bf=b(()=>{hf=1e8,yf=5e3,_v=Object.freeze({SIGABRT:"\
|
|
1148
1148
|
Aborted",SIGALRM:"Timeout or timer",SIGHUP:"Terminal closed",SIGINT:"User interruption with CTRL-C",SIGKILL:"Forced term\
|
|
1149
1149
|
ination",SIGPIPE:"Broken pipe or socket",SIGQUIT:"User interruption with CTRL-\\",SIGSEGV:"Segmentation fault",SIGTERM:"\
|
|
1150
|
-
Termination",SIGUSR1:"Application-specific signal",SIGUSR2:"Application-specific signal"}),
|
|
1151
|
-
"\\p{Separator}|\\p{Other}","gu"),
|
|
1152
|
-
import
|
|
1153
|
-
let t=
|
|
1154
|
-
t.once("exit",()=>{
|
|
1150
|
+
Termination",SIGUSR1:"Application-specific signal",SIGUSR2:"Application-specific signal"}),bv=/^[\w./-]+$/u,Ev=new RegExp(
|
|
1151
|
+
"\\p{Separator}|\\p{Other}","gu"),gf=Object.freeze({" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"})});import{spawn as vf}from"node:child_process";import{mkdir as Av,open as Pv,readdir as Cv,readFile as Nv}from"node:fs/promises";
|
|
1152
|
+
import jv from"node:path";import{fileURLToPath as xv}from"node:url";function Mv(e){if(process.platform!=="win32"){if(!ve){
|
|
1153
|
+
let t=vf(process.execPath,[Lv],{cwd:"/",detached:!0,stdio:["pipe","ignore","ignore"]});t.once("error",()=>{ve===t&&(ve=null)}),
|
|
1154
|
+
t.once("exit",()=>{ve===t&&(ve=null)}),t.stdin.on("error",()=>{}),t.unref(),t.stdin.unref(),ve=t;for(let r of lt.values())
|
|
1155
1155
|
r.scopeEmpty!==!0&&r.pid!==e&&t.stdin.write(`+${r.pid}
|
|
1156
|
-
`)}
|
|
1157
|
-
`)}}function
|
|
1158
|
-
`),![...lt.values()].some(t=>t.scopeEmpty!==!0)&&(
|
|
1159
|
-
dirname(e),{recursive:!0}),
|
|
1160
|
-
!0,i(s))};e.once("spawn",()=>o(t)),e.once("error",i=>o(r,i))})}async function
|
|
1161
|
-
try{o=await
|
|
1162
|
-
detached:!0,env:n,stdio:i});await
|
|
1163
|
-
s.pid)),s.once("exit",()=>{!Fn(s.pid)&<.has(a)&&(lt.set(a,{child:s,pid:Number(s.pid),scopeEmpty:!0}),
|
|
1156
|
+
`)}ve.stdin.write(`+${e}
|
|
1157
|
+
`)}}function Dv(e){ve&&(ve.stdin.write(`-${e}
|
|
1158
|
+
`),![...lt.values()].some(t=>t.scopeEmpty!==!0)&&(ve.stdin.end(),ve=null))}async function Vv(e=""){return e?(await Av(jv.
|
|
1159
|
+
dirname(e),{recursive:!0}),Pv(e,"w",384)):null}async function Uv(e){return new Promise((t,r)=>{let n=!1,o=(i,s)=>{n||(n=
|
|
1160
|
+
!0,i(s))};e.once("spawn",()=>o(t)),e.once("error",i=>o(r,i))})}async function Tf(e={},t={}){let{cwd:r="",env:n={}}=t,o=null;
|
|
1161
|
+
try{o=await Vv(e.logPath);let i=o?["ignore",o.fd,o.fd]:["ignore","ignore","ignore"],s=vf(e.command,e.args,{cwd:r||void 0,
|
|
1162
|
+
detached:!0,env:n,stdio:i});await Uv(s);let a=e.execution?.id||"";return a&&(lt.set(a,{child:s,pid:Number(s.pid)}),Mv(Number(
|
|
1163
|
+
s.pid)),s.once("exit",()=>{!Fn(s.pid)&<.has(a)&&(lt.set(a,{child:s,pid:Number(s.pid),scopeEmpty:!0}),Dv(Number(s.pid)))})),
|
|
1164
1164
|
s.unref(),br({execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:s.pid})}catch(i){return te(i?.
|
|
1165
1165
|
message||"Detached command failed to start.",i?.code||"vibe64_command_detached_failed",{execution:e.execution})}finally{
|
|
1166
1166
|
await o?.close().catch(()=>null)}}function Fn(e=null){let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)return!1;if(process.
|
|
1167
1167
|
platform==="win32"){let r=[...lt.values()].find(n=>n.pid===t);return r?.child?.exitCode===null&&r?.child?.signalCode===null}
|
|
1168
|
-
try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function
|
|
1168
|
+
try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function Ef(e=null,t="SIGTERM"){if(!Fn(e))return!1;try{
|
|
1169
1169
|
return process.platform==="win32"?[...lt.values()].find(n=>n.pid===Number(e))?.child?.kill(t):process.kill(-Number(e),t),
|
|
1170
|
-
!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function
|
|
1171
|
-
"linux"||!Number.isSafeInteger(r)||r<=0)return[];let n=[];for(let o of await
|
|
1172
|
-
if(!/^\d+$/u.test(o))continue;let i=await
|
|
1173
|
-
s+2).split(" ");Number(a[2])!==r||a[0]==="Z"||n.push({command:i.slice(i.indexOf("(")+1,s),pid:Number(o)})}return n}async function
|
|
1170
|
+
!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function If(e=null,t=10){let r=Number(e);if(process.platform!==
|
|
1171
|
+
"linux"||!Number.isSafeInteger(r)||r<=0)return[];let n=[];for(let o of await Cv("/proc").catch(()=>[])){if(n.length>=t)break;
|
|
1172
|
+
if(!/^\d+$/u.test(o))continue;let i=await Nv(`/proc/${o}/stat`,"utf8").catch(()=>""),s=i.lastIndexOf(")"),a=s<0?[]:i.slice(
|
|
1173
|
+
s+2).split(" ");Number(a[2])!==r||a[0]==="Z"||n.push({command:i.slice(i.indexOf("(")+1,s),pid:Number(o)})}return n}async function Sf(e=null,t=0){
|
|
1174
1174
|
let r=Date.now()+Math.max(0,Number(t)||0);for(;Fn(e)&&Date.now()<r;)await new Promise(n=>setTimeout(n,25));return!Fn(e)}
|
|
1175
|
-
async function Hn(e=null,t={}){let{killTimeoutMs:r
|
|
1176
|
-
(
|
|
1177
|
-
cution/src/server/engines/detached.js",import.meta.url).href,lt=new Map,
|
|
1178
|
-
|
|
1175
|
+
async function Hn(e=null,t={}){let{killTimeoutMs:r=$v,termTimeoutMs:n=kv}=t;Ef(e,"SIGTERM");let o=await Sf(e,n);return o||
|
|
1176
|
+
(Ef(e,"SIGKILL"),o=await Sf(e,r)),o}var Rv,lt,kv,$v,Lv,ve,Er=b(()=>{ut();Rv=new URL("./../node_modules/@local/vibe64-exe\
|
|
1177
|
+
cution/src/server/engines/detached.js",import.meta.url).href,lt=new Map,kv=3e3,$v=1e3,Lv=xv(new URL("./detachedReaper.js",
|
|
1178
|
+
Rv)),ve=null});async function Sr(e="",t=[],r={}){let{cwd:n="",env:o={},execution:i=null,input:s=void 0,maxBuffer:a=void 0,onOutput:c=null,
|
|
1179
1179
|
outputEncoding:u="utf8",signal:d=null,timeout:p=15e3}=r,g,h,l,w=null,_=Promise.withResolvers(),f=()=>{l||=h(),l.then(_.resolve)};
|
|
1180
|
-
if(d?.aborted)return te("Command cancelled.","vibe64_command_cancelled",{execution:i});try{let E=
|
|
1180
|
+
if(d?.aborted)return te("Command cancelled.","vibe64_command_cancelled",{execution:i});try{let E=_f(e,t,{cwd:n,env:o,input:s,
|
|
1181
1181
|
maxBuffer:a,onOutput:c,outputEncoding:u,timeout:p});w=Number(E.pid);let T;h=()=>{if(!T){let R;process.platform!=="win32"?
|
|
1182
|
-
R=Hn(w).catch(()=>!1):(E.kill("SIGKILL"),R=E.completion.then(()=>!0)),T=R.then(O=>(O||(T=null),O))}return T},i?.id&&
|
|
1182
|
+
R=Hn(w).catch(()=>!1):(E.kill("SIGKILL"),R=E.completion.then(()=>!0)),T=R.then(O=>(O||(T=null),O))}return T},i?.id&&Of.set(
|
|
1183
1183
|
i.id,h),d?.addEventListener("abort",f,{once:!0}),d?.aborted&&f();let S=await Promise.race([E.completion,_.promise.then(R=>R?
|
|
1184
1184
|
E.completion:{exitCode:1})]),v=typeof S.exitCode=="number"?S.exitCode:1;g=br({code:S.timedOut===!0?"vibe64_command_captu\
|
|
1185
1185
|
re_timed_out":S.code?"vibe64_command_capture_failed":"",error:v===0?"":S.shortMessage,exitCode:v,output:S.all||(v===0?"":
|
|
1186
1186
|
S.shortMessage),outputEncoding:u,signal:S.signal,stderr:S.stderr,stdout:S.stdout,timedOut:S.timedOut===!0,execution:i})}catch(E){
|
|
1187
1187
|
g=te(E.message,"vibe64_command_capture_failed",{execution:i,outputEncoding:u})}finally{d?.removeEventListener("abort",f)}
|
|
1188
|
-
if(!await(l||h?.()||!0)){let E=await
|
|
1188
|
+
if(!await(l||h?.()||!0)){let E=await If(w),T=g?.timedOut?"The command timed out":d?.aborted?"The command was cancelled":
|
|
1189
1189
|
"The command finished",S=E.length?`: ${E.map(v=>`${v.command} (pid ${v.pid})`).join(", ")} still running`:"";return{...te(
|
|
1190
1190
|
`${T}, and its execution scope did not become empty${S}.`,"vibe64_execution_drain_failed",{execution:i,output:g?.output,
|
|
1191
1191
|
outputEncoding:u,signal:g?.signal,stderr:g?.stderr,stdout:g?.stdout,timedOut:g?.timedOut}),remainingProcesses:E}}i?.id&&
|
|
1192
|
-
|
|
1193
|
-
execution:y,outputEncoding:u}):y?{...g,execution:y}:g}var
|
|
1194
|
-
r running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}function
|
|
1195
|
-
...e,schema:
|
|
1196
|
-
and",args:s=[]}={}){return
|
|
1192
|
+
Of.delete(i.id);let y=i&&{...i,state:"finished"};return d?.aborted?te("Command cancelled.","vibe64_command_cancelled",{...g,
|
|
1193
|
+
execution:y,outputEncoding:u}):y?{...g,execution:y}:g}var Of,vr=b(()=>{ut();bf();Er();Of=new Map});function Ns(e=""){let t=String(e||"").trim()||ye().execHelperPath;if(!t){let r=new Error("This computer has no helper fo\
|
|
1194
|
+
r running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}function Rf(e={}){return{
|
|
1195
|
+
...e,schema:Bv,schemaVersion:zv}}function qn({actor:e={},command:t="",cwd:r="",env:n={},input:o,operation:i="vibe64-comm\
|
|
1196
|
+
and",args:s=[]}={}){return Rf({args:Array.isArray(s)?s.map(a=>String(a)):[],command:t,cwd:r,env:n,gid:e.user?.gid,home:e.
|
|
1197
1197
|
user?.home,inputBase64:o==null?"":Buffer.isBuffer(o)?o.toString("base64"):Buffer.from(String(o)).toString("base64"),operation:i,
|
|
1198
1198
|
uid:e.user?.uid,username:e.user?.username})}function Tr(e={}){return e.mode==="pty"&&e.envPolicy==="auth"&&!["assistant",
|
|
1199
1199
|
"codex"].includes(e.purpose)?"account-auth-terminal":e.purpose==="codex"&&e.mode==="capture"&&e.envPolicy==="auth"||e.purpose===
|
|
@@ -1205,85 +1205,85 @@ d":e.purpose==="github-api"?"github-api-command":e.purpose==="workspace-cache"?"
|
|
|
1205
1205
|
alth"?"health-status":"vibe64-command"}async function js(e={},{env:t,helperPath:r="",maxBuffer:n=void 0,outputEncoding:o="\
|
|
1206
1206
|
utf8",runCapture:i=Sr,signal:s=null,timeout:a=15e3}){let c={env:t,input:`${JSON.stringify(e)}
|
|
1207
1207
|
`,outputEncoding:o,signal:s,timeout:a};return Number.isSafeInteger(Number(n))&&Number(n)>0&&(c.maxBuffer=Number(n)),i("s\
|
|
1208
|
-
udo",["-n",Ns(r),"execute"],c)}var
|
|
1209
|
-
upport/symlinkSafeRequire.js",import.meta.url).href,
|
|
1210
|
-
{callbackPath:"/auth/login",customScheme:"",appLinkDomains:Object.freeze([])}),
|
|
1211
|
-
targetSdk:35,versionCode:1,versionName:"1.0.0"})});var
|
|
1212
|
-
e))Ge(e[r],t);return Object.freeze(e)}var Ir=b(()=>{});var
|
|
1213
|
-
freeze(["capabilities","kind","metadata","migrations","runtime","vite"])});var $s=b(()=>{U()});import
|
|
1214
|
-
function Ds(e="",t=Vs){let r=new Error(e||"Exclusive file lock failed.");return r.code=t,r}function
|
|
1208
|
+
udo",["-n",Ns(r),"execute"],c)}var Bv,zv,Wn=b(()=>{vr();Oe();Bv="vibe64.exec-helper.payload",zv=1});import{createRequire as Fv}from"node:module";var Gv,Bx,Af=b(()=>{Gv=new URL("./../node_modules/@jskit-ai/kernel/server/s\
|
|
1209
|
+
upport/symlinkSafeRequire.js",import.meta.url).href,Bx=Fv(Gv)});var Wx,Yx,Jx,Kx,Pf=b(()=>{U();Wx=Object.freeze(["bundled","dev_server"]),Yx=Object.freeze(["capacitor"]),Jx=Object.freeze(
|
|
1210
|
+
{callbackPath:"/auth/login",customScheme:"",appLinkDomains:Object.freeze([])}),Kx=Object.freeze({packageName:"",minSdk:26,
|
|
1211
|
+
targetSdk:35,versionCode:1,versionName:"1.0.0"})});var Cf=b(()=>{U();Pf()});var xs=b(()=>{});var ks=b(()=>{});var Nf=b(()=>{xs();U();ks()});function Ge(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e);for(let r of Object.getOwnPropertyNames(
|
|
1212
|
+
e))Ge(e[r],t);return Object.freeze(e)}var Ir=b(()=>{});var jf=b(()=>{});var gk,yk,xf=b(()=>{Ir();U();jf();xs();gk=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),yk=Object.
|
|
1213
|
+
freeze(["capabilities","kind","metadata","migrations","runtime","vite"])});var $s=b(()=>{U()});import Wv from"node:child_process";import{constants as Ls}from"node:fs";import{open as Yv}from"node:fs/promises";import Ms from"node:path";
|
|
1214
|
+
function Ds(e="",t=Vs){let r=new Error(e||"Exclusive file lock failed.");return r.code=t,r}function kf(e="",t="path",r=Vs){
|
|
1215
1215
|
let n=String(e||"").trim();if(!n||!Ms.isAbsolute(n)||Ms.normalize(n)!==n)throw Ds(`${t} must be a normalized absolute pa\
|
|
1216
|
-
th.`,r);return n}function
|
|
1216
|
+
th.`,r);return n}function Kv(e,t){return new Promise((r,n)=>{let o=Wv.spawn("/usr/bin/flock",["--exclusive","--nonblock",
|
|
1217
1217
|
"3"],{cwd:t,env:{PATH:"/usr/bin:/bin"},stdio:["ignore","ignore","pipe",e]}),i="";o.stderr.on("data",s=>{i=`${i}${String(
|
|
1218
1218
|
s||"")}`.slice(-4096)}),o.once("error",n),o.once("close",s=>r({status:s,stderr:i.trim()}))})}async function Dt(e="",{cwd:t="",
|
|
1219
|
-
errorCode:r=Vs}={}){let n=
|
|
1220
|
-
432),s;try{s=await
|
|
1221
|
-
ck failed."),r)}if(s.status!==0){if(await i.close(),s.status===
|
|
1222
|
-
ed${s.stderr?`: ${s.stderr}`:"."}`,r)}let a=!1;return async()=>{a||(a=!0,await i.close())}}var Vs,
|
|
1223
|
-
lock_failed",
|
|
1224
|
-
session?.metadata?.session_git_command_actor_user_key)}async function
|
|
1219
|
+
errorCode:r=Vs}={}){let n=kf(e,"lockPath",r),o=t?kf(t,"cwd",r):Ms.dirname(n),i=await Yv(n,Ls.O_CREAT|Ls.O_NOFOLLOW|Ls.O_RDWR,
|
|
1220
|
+
432),s;try{s=await Kv(i.fd,o)}catch(c){throw await i.close().catch(()=>null),Ds(c?.message||String(c||"Exclusive file lo\
|
|
1221
|
+
ck failed."),r)}if(s.status!==0){if(await i.close(),s.status===Jv)return null;throw Ds(`Exclusive file lock process fail\
|
|
1222
|
+
ed${s.stderr?`: ${s.stderr}`:"."}`,r)}let a=!1;return async()=>{a||(a=!0,await i.close())}}var Vs,Jv,$f=b(()=>{Vs="file_\
|
|
1223
|
+
lock_failed",Jv=1});var Xv,Ok,Lf=b(()=>{Xv="jskit-client-build",Ok=new RegExp(`<meta name="${Xv}" content="([0-9a-f]+)"`,"u")});import Qv from"node:path";var jk,Mf=b(()=>{Lf();$s();jk=Qv.join("dist","index.html")});var Yn=b(()=>{Af();Cf();Nf();ks();xf();$s();$f();Mf()});var Df=b(()=>{Yn()});function eT(e={}){return $e(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
1224
|
+
session?.metadata?.session_git_command_actor_user_key)}async function Vf(e={}){let t=j(e.actor)||"daemon";if(t==="app"&&
|
|
1225
1225
|
e.applicationAccount)return{actor:t,applicationAccount:!0,credentialScope:t,requiresRealUser:!1,user:await Ps(e.applicationAccount)};
|
|
1226
|
-
if(t==="daemon"||t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:As()};let r=
|
|
1226
|
+
if(t==="daemon"||t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:As()};let r=eT(e);if(!r){let n=new Error(
|
|
1227
1227
|
"A user key is required for real-user command execution.");throw n.code="vibe64_command_actor_user_required",n}return{actor:t,
|
|
1228
|
-
credentialScope:"user",requiresRealUser:!0,user:await Ps(r)}}var
|
|
1229
|
-
user?.gid}function Us(){return!!
|
|
1228
|
+
credentialScope:"user",requiresRealUser:!0,user:await Ps(r)}}var Uf=b(()=>{K();Mt()});import Bf from"node:path";function Vt(e={}){let t=mf();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.
|
|
1229
|
+
user?.gid}function Us(){return!!ye().execHelperPath}function Jn(e={}){return e.requiresRealUser?Us()||!Vt(e):!1}function zf(e={},t={},r=""){
|
|
1230
1230
|
if(!e.requiresRealUser)return;let n=x(t.session?.sourceRoot||t.session?.sourcePath),o=x(r);if(!n||!o||!ze(n,o))return;let i=new Error(
|
|
1231
1231
|
"Commands in a session's source must run as the editor's own user, not as a person's account.");throw i.code="vibe64_com\
|
|
1232
|
-
mand_managed_source_real_user_forbidden",i}function
|
|
1233
|
-
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&
|
|
1234
|
-
he resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",i}}var Kn=b(()=>{Mt();
|
|
1232
|
+
mand_managed_source_real_user_forbidden",i}function Gf(e={},t={}){let r=x(e.user?.home),n=x(t.HOME),o=x(t.VIBE64_CREDENTIAL_HOME);
|
|
1233
|
+
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&Bf.resolve(r)!==Bf.resolve(n)){let i=new Error("Command HOME does not match t\
|
|
1234
|
+
he resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",i}}var Kn=b(()=>{Mt();Oe();K()});function Xn(...e){let t={};for(let r of e){let n=we(r);for(let o of Or)n[o]!==void 0&&(t[o]=n[o])}return t}var Or,Zn=b(()=>{
|
|
1235
1235
|
K();Or=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
1236
1236
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
1237
|
-
R","VIBE64_MYSQL_USER"])});import{spawn as
|
|
1238
|
-
import{stat as
|
|
1239
|
-
replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||t}function
|
|
1237
|
+
R","VIBE64_MYSQL_USER"])});import{spawn as tT,spawnSync as rT}from"node:child_process";import{createHash as nT}from"node:crypto";import{statSync as Kf}from"node:fs";
|
|
1238
|
+
import{stat as Xf}from"node:fs/promises";import Qn from"node:path";function Hf(e="",t="vibe64"){return j(e).toLowerCase().
|
|
1239
|
+
replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||t}function sT(...e){for(let t of e){let r=ee(t),n=ee(r.
|
|
1240
1240
|
user),o=$e(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,n.name,n.userName,n.user_name),i=$e(r.email,r.userEmail,
|
|
1241
1241
|
r.user_email,r.gitUserEmail,r.git_user_email,n.email,n.userEmail,n.user_email);if(o&&i)return{authorEmail:i,authorName:o,
|
|
1242
|
-
committerEmail:i,committerName:o,source:"configured"}}return null}function
|
|
1242
|
+
committerEmail:i,committerName:o,source:"configured"}}return null}function aT(e={}){let t=ee(e),r=$e(t.name,t.displayName,
|
|
1243
1243
|
t.login,t.username),n=$e(t.email,t.publicEmail,t.verifiedEmail);return!r||!n?null:{authorEmail:n,authorName:r,committerEmail:n,
|
|
1244
|
-
committerName:r,source:"github"}}function
|
|
1245
|
-
authorEmail:`${r}@${n}${
|
|
1246
|
-
fallback"}}function Bs(e=""){let t=j(e);return t&&Qn.isAbsolute(t)?t:""}function
|
|
1247
|
-
isDirectory()?t:""}catch{return""}}async function
|
|
1248
|
-
t:""}function
|
|
1249
|
-
`)){let n=/^user\.(name|email)(?: (.*))?$/iu.exec(r);n&&(t[n[1].toLowerCase()]=j(n[2]))}return t}function
|
|
1250
|
-
...e?{cwd:e}:{},env:t,stdio:["ignore","pipe","ignore"],timeout:
|
|
1251
|
-
utf8"});return r.error||r.signal?{transient:!0,values:null}:{transient:!1,values:r.status===0||r.status===1?
|
|
1252
|
-
null}}function
|
|
1244
|
+
committerName:r,source:"github"}}function cT({workspace:e="",userKey:t=""}={}){let r=Hf(t,"user"),n=Hf(e,"local");return{
|
|
1245
|
+
authorEmail:`${r}@${n}${Ff}`,authorName:`${r} via Vibe64`,committerEmail:`vibe64@${n}${Ff}`,committerName:"Vibe64",source:"\
|
|
1246
|
+
fallback"}}function Bs(e=""){let t=j(e);return t&&Qn.isAbsolute(t)?t:""}function qf(e=""){let t=Bs(e);try{return t&&Kf(t).
|
|
1247
|
+
isDirectory()?t:""}catch{return""}}async function Wf(e=""){let t=Bs(e);return t&&await Xf(t).then(r=>r.isDirectory(),()=>!1)?
|
|
1248
|
+
t:""}function ep(e=""){let t={};for(let r of String(e||"").split(`
|
|
1249
|
+
`)){let n=/^user\.(name|email)(?: (.*))?$/iu.exec(r);n&&(t[n[1].toLowerCase()]=j(n[2]))}return t}function tp(e,t){return{
|
|
1250
|
+
...e?{cwd:e}:{},env:t,stdio:["ignore","pipe","ignore"],timeout:oT}}function Yf(e,t){let r=rT("git",Zf,{...tp(e,t),encoding:"\
|
|
1251
|
+
utf8"});return r.error||r.signal?{transient:!0,values:null}:{transient:!1,values:r.status===0||r.status===1?ep(r.stdout):
|
|
1252
|
+
null}}function Jf(e,t){return new Promise(r=>{let n="",o=!1,i=a=>{o||(o=!0,r(a))},s=tT("git",Zf,tp(e,t));s.stdout.setEncoding(
|
|
1253
1253
|
"utf8"),s.stdout.on("data",a=>{n+=a}),s.once("error",()=>i({transient:!0,values:null})),s.once("close",(a,c)=>i(c?{transient:!0,
|
|
1254
|
-
values:null}:{transient:!1,values:a===0||a===1?
|
|
1255
|
-
email,authorName:e.name,committerEmail:e.email,committerName:e.name,source:"git-config"}}function
|
|
1256
|
-
env.PATH||e.PATH}}function
|
|
1254
|
+
values:null}:{transient:!1,values:a===0||a===1?ep(n):null}))})}function rp(e=null){return!e?.name||!e?.email?null:{authorEmail:e.
|
|
1255
|
+
email,authorName:e.name,committerEmail:e.email,committerName:e.name,source:"git-config"}}function np(e={}){return{...e,PATH:process.
|
|
1256
|
+
env.PATH||e.PATH}}function op(e={}){if(Object.hasOwn(e,"GIT_CONFIG_GLOBAL"))return[String(e.GIT_CONFIG_GLOBAL)];let t=Bs(
|
|
1257
1257
|
e.HOME),r=j(e.XDG_CONFIG_HOME)||(t?Qn.join(t,".config"):"");return[r?Qn.join(r,"git","config"):"",t?Qn.join(t,".gitconfi\
|
|
1258
|
-
g"):""].filter(Boolean)}async function
|
|
1259
|
-
mtimeMs}:${n.ctimeMs}`,()=>"missing")))).join("|")}function
|
|
1260
|
-
:${r.size}:${r.mtimeMs}:${r.ctimeMs}`}catch{return"missing"}}).join("|")}function
|
|
1261
|
-
([o],[i])=>o<i?-1:o>i?1:0);return
|
|
1262
|
-
await
|
|
1263
|
-
function
|
|
1264
|
-
values:o.values}}function
|
|
1265
|
-
r&&dt.delete(o);return null}async function
|
|
1266
|
-
read).values;let a={expiresAt:i+
|
|
1267
|
-
a&&dt.delete(n):a.values=c.values,c.values}function
|
|
1268
|
-
hasOwn(s,"values"))return s.values;let a=
|
|
1269
|
-
revision:o,values:a.values}),a.values}async function
|
|
1270
|
-
let[r,n]=await Promise.all([
|
|
1271
|
-
typeof t!="object"?null:
|
|
1272
|
-
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"git-config"}}function
|
|
1273
|
-
project:r={},session:n={}}){let o=ee(n.metadata);return
|
|
1274
|
-
VIBE64_GIT_USER_NAME,email:e.VIBE64_GIT_USER_EMAIL})||
|
|
1275
|
-
let i=ee(n.metadata);return
|
|
1258
|
+
g"):""].filter(Boolean)}async function uT(e={}){return(await Promise.all(op(e).map(r=>Xf(r).then(n=>`${n.ino}:${n.size}:${n.
|
|
1259
|
+
mtimeMs}:${n.ctimeMs}`,()=>"missing")))).join("|")}function lT(e={}){return op(e).map(t=>{try{let r=Kf(t);return`${r.ino}\
|
|
1260
|
+
:${r.size}:${r.mtimeMs}:${r.ctimeMs}`}catch{return"missing"}}).join("|")}function ip(e,t,r){let n=Object.entries(r).sort(
|
|
1261
|
+
([o],[i])=>o<i?-1:o>i?1:0);return nT("sha256").update(JSON.stringify([e,t,n])).digest("hex")}async function dT(e,t,r){let n=e?
|
|
1262
|
+
await Jf(e,r):null;if(n?.values)return n;let o=await Jf(t,r);return{transient:!!(n?.transient||o.transient),values:o.values}}
|
|
1263
|
+
function fT(e,t,r){let n=e?Yf(e,r):null;if(n?.values)return n;let o=Yf(t,r);return{transient:!!(n?.transient||o.transient),
|
|
1264
|
+
values:o.values}}function sp(e,t,r){let n=dt.get(e);if(n&&n.revision===t&&n.expiresAt>r)return n;for(let[o,i]of dt)i.expiresAt<=
|
|
1265
|
+
r&&dt.delete(o);return null}async function pT(e,t,r){let n=ip(e,t,r),o=await uT(r),i=Date.now(),s=sp(n,o,i);if(s)return(await s.
|
|
1266
|
+
read).values;let a={expiresAt:i+Qf,read:dT(e,t,r),revision:o};dt.set(n,a);let c=await a.read;return c.transient?dt.get(n)===
|
|
1267
|
+
a&&dt.delete(n):a.values=c.values,c.values}function mT(e,t,r){let n=ip(e,t,r),o=lT(r),i=Date.now(),s=sp(n,o,i);if(s&&Object.
|
|
1268
|
+
hasOwn(s,"values"))return s.values;let a=fT(e,t,r);return a.transient||dt.set(n,{expiresAt:i+Qf,read:Promise.resolve(a),
|
|
1269
|
+
revision:o,values:a.values}),a.values}async function hT({cwd:e="",env:t=null}={}){if(!t||typeof t!="object")return null;
|
|
1270
|
+
let[r,n]=await Promise.all([Wf(e),Wf(t.HOME)]);return rp(await pT(r,n,np(t)))}function gT({cwd:e="",env:t=null}={}){return!t||
|
|
1271
|
+
typeof t!="object"?null:rp(mT(qf(e),qf(t.HOME),np(t)))}function yT(e={}){let t=ee(e),r=j(t.name),n=j(t.email);return!r||
|
|
1272
|
+
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"git-config"}}function ap({env:e,personGitIdentity:t=null,
|
|
1273
|
+
project:r={},session:n={}}){let o=ee(n.metadata);return sT(r.gitIdentity,r.config?.git,n.gitIdentity,o.git_identity,{name:e.
|
|
1274
|
+
VIBE64_GIT_USER_NAME,email:e.VIBE64_GIT_USER_EMAIL})||yT(t)}function cp({actor:e={},env:t,project:r={},session:n={},userKey:o=""}){
|
|
1275
|
+
let i=ee(n.metadata);return aT(r.githubUser||n.githubUser||i.github_user)||cT({workspace:$e(r.workspace,t.VIBE64_WORKSPACE,
|
|
1276
1276
|
t.VIBE64_RUNTIME_NAMESPACE),userKey:$e(o,e.user?.username,t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.
|
|
1277
|
-
LOGNAME)})}async function
|
|
1278
|
-
{})||
|
|
1279
|
-
return
|
|
1280
|
-
ME",pt="GIT_AUTHOR_EMAIL",mt="GIT_COMMITTER_NAME",ht="GIT_COMMITTER_EMAIL",
|
|
1281
|
-
"--get-regexp","^user\\.(name|email)$"],
|
|
1277
|
+
LOGNAME)})}async function wT(e){return ap(e)||await hT(e.gitConfig||{})||cp(e)}function _T(e){return ap(e)||gT(e.gitConfig||
|
|
1278
|
+
{})||cp(e)}function up(e){return{[pt]:e.authorEmail,[ft]:e.authorName,[ht]:e.committerEmail,[mt]:e.committerName}}async function lp(e){
|
|
1279
|
+
return up(await wT(e))}function dp(e){return up(_T(e))}var ft,pt,mt,ht,Ff,oT,Zf,Qf,iT,dt,Ut=b(()=>{K();ft="GIT_AUTHOR_NA\
|
|
1280
|
+
ME",pt="GIT_AUTHOR_EMAIL",mt="GIT_COMMITTER_NAME",ht="GIT_COMMITTER_EMAIL",Ff=".users.vibe64.invalid",oT=2e3,Zf=["config",
|
|
1281
|
+
"--get-regexp","^user\\.(name|email)$"],Qf=3e4,iT=['git config --global user.name "Your Name"','git config --global user\
|
|
1282
1282
|
.email "you@example.com"'].join(`
|
|
1283
|
-
`);dt=new Map});import zs from"node:path";function re({root:e=""}={}){return x(e||
|
|
1284
|
-
Bt[j(e)]?.binDirs||[]:[]).map(n=>zs.join(t,n))}function
|
|
1285
|
-
let e=re();return e?[zs.join(e,"policy-bin")]:[]}function
|
|
1286
|
-
Gs,
|
|
1283
|
+
`);dt=new Map});import zs from"node:path";function re({root:e=""}={}){return x(e||ye().runtimePackRoot)}function Fs(e=""){let t=re();return(t?
|
|
1284
|
+
Bt[j(e)]?.binDirs||[]:[]).map(n=>zs.join(t,n))}function fp(){let e=re();return e?[zs.join(e,"guard-bin")]:[]}function Hs(){
|
|
1285
|
+
let e=re();return e?[zs.join(e,"policy-bin")]:[]}function bT(e=""){let t=j(e);return[...Bt[t]?.managedCommands||[]]}var Bt,
|
|
1286
|
+
Gs,S0,Re=b(()=>{K();Oe();Bt=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:[
|
|
1287
1287
|
"bubblewrap/bin"],managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","p\
|
|
1288
1288
|
ackage-lock.json"],managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:["composer.json","compose\
|
|
1289
1289
|
r.lock"],managedCommands:["composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-co\
|
|
@@ -1313,276 +1313,277 @@ in"],managedCommands:["php"]},playwright:{binDirs:["playwright/bin"],identityPat
|
|
|
1313
1313
|
/browsers"],managedCommands:["playwright"]},postgresql:{binDirs:["postgresql/bin"],managedCommands:["initdb","pg_ctl","p\
|
|
1314
1314
|
g_isready","postgres","psql"]},ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:[
|
|
1315
1315
|
"sqlite3"]}}),Gs=Object.freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","b\
|
|
1316
|
-
ubblewrap","bun","php","composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);
|
|
1317
|
-
Object.freeze({runtimePackManagedCommands:
|
|
1318
|
-
if(!t)return"";let r=
|
|
1319
|
-
/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!
|
|
1320
|
-
`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function
|
|
1321
|
-
r=x(
|
|
1322
|
-
{[Ws]:n}:{}}}var eo,Rr,qs,Ws,
|
|
1323
|
-
ATH",qs="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",Ws="VIBE64_PLAYWRIGHT_VERSION",
|
|
1324
|
-
|
|
1316
|
+
ubblewrap","bun","php","composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);S0=
|
|
1317
|
+
Object.freeze({runtimePackManagedCommands:bT})});import{readFileSync as ET}from"node:fs";import pp from"node:path";function IT({runtimePackRoot:e=""}={}){let t=re({root:e});
|
|
1318
|
+
if(!t)return"";let r=pp.join(t,mp,vT),n;try{n=ET(r,"utf8")}catch(i){if(i?.code==="ENOENT")return"";throw i}let o=n.split(
|
|
1319
|
+
/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!TT.test(o[0]))throw new Error(
|
|
1320
|
+
`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function hp({runtimePackRoot:e=""}={}){let t=re({root:e}),
|
|
1321
|
+
r=x(ye().sharedCacheRoot),n=IT({runtimePackRoot:t});return{...r?{[eo]:r}:{},...t?{[Rr]:pp.join(t,mp,ST),[qs]:"1"}:{},...n?
|
|
1322
|
+
{[Ws]:n}:{}}}var eo,Rr,qs,Ws,mp,ST,vT,TT,Ar=b(()=>{K();Oe();Re();eo="VIBE64_SHARED_CACHE_ROOT",Rr="PLAYWRIGHT_BROWSERS_P\
|
|
1323
|
+
ATH",qs="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",Ws="VIBE64_PLAYWRIGHT_VERSION",mp="playwright",ST="browsers",vT="runtime.env",
|
|
1324
|
+
TT=/^\d+\.\d+\.\d+$/u});function zt(e={}){for(let t of Object.keys(we(e)))if(OT.has(t)||t.startsWith("XDG_")){let r=new Error(`Vibe64 command ca\
|
|
1325
1325
|
llers cannot provide execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function to(e={},t={}){
|
|
1326
|
-
let{envPolicy:r="session"}=t,n=
|
|
1327
|
-
"deployment"?o:{...o,...Xn(n)}}var
|
|
1326
|
+
let{envPolicy:r="session"}=t,n=we(e);zt(n);let o=Object.fromEntries(Object.entries(n).filter(([i])=>!RT.has(i)));return r===
|
|
1327
|
+
"deployment"?o:{...o,...Xn(n)}}var OT,RT,ro=b(()=>{K();Zn();Ut();Ar();OT=new Set(["HOME","LOGNAME","PATH","TMPDIR","USER",
|
|
1328
1328
|
"VIBE64_EXECUTION_ID","VIBE64_MANAGED_EXECUTION_REQUIRED","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIM\
|
|
1329
|
-
E_DIR"]),
|
|
1329
|
+
E_DIR"]),RT=new Set([...Or,pt,ft,ht,mt,Rr,qs,Ws,eo])});function AT(e=""){let t=x(e);return t==="/home"||t.startsWith("/home/")}function gp({actor:e={},request:t={}}={}){let r=t.
|
|
1330
1330
|
credentialHome||{},n=x(r.home);if(!n)return{};let o=x(e.user?.home);if(e.requiresRealUser&&o&&n!==o){let a=new Error("Co\
|
|
1331
1331
|
mmand credential home must match the resolved real-user actor home.");throw a.code="vibe64_command_credential_home_actor\
|
|
1332
|
-
_mismatch",a}if(!e.requiresRealUser&&
|
|
1332
|
+
_mismatch",a}if(!e.requiresRealUser&&AT(n)&&o&&!ze(o,n)){let a=new Error("A /home credential directory requires a matchi\
|
|
1333
1333
|
ng real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=j(r.username||e.user?.username);
|
|
1334
1334
|
return{..._r({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...x(r.cacheRoot)?{XDG_CACHE_HOME:x(r.cacheRoot)}:{},...x(r.
|
|
1335
1335
|
configRoot)?{XDG_CONFIG_HOME:x(r.configRoot)}:{},...x(r.dataRoot)?{XDG_DATA_HOME:x(r.dataRoot)}:{},...x(r.stateRoot)?{XDG_STATE_HOME:x(
|
|
1336
|
-
r.stateRoot)}:{}}}var
|
|
1337
|
-
isAbsolute(o))continue;let i=
|
|
1336
|
+
r.stateRoot)}:{}}}var yp=b(()=>{Mt();K()});import wp from"node:path";function jT(e=[]){let t=new Set,r=[];for(let n of Array.isArray(e)?e:[e]){let o=j(n);if(!o||!wp.
|
|
1337
|
+
isAbsolute(o))continue;let i=wp.resolve(o);t.has(i)||(t.add(i),r.push(i))}return r}function Pr(e={},t=[]){let r={...e&&typeof e==
|
|
1338
1338
|
"object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(String(r.GIT_CONFIG_COUNT||"0"),10),o=Number.isSafeInteger(n)&&n>=0?
|
|
1339
1339
|
n:0;for(let i of Array.isArray(t)?t:[]){let s=j(i?.key);s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(
|
|
1340
|
-
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function
|
|
1341
|
-
function
|
|
1342
|
-
return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"0",PAGER:"cat"}}function Js(e={}){return Pr(e,
|
|
1343
|
-
return Pr(e,
|
|
1344
|
-
var
|
|
1345
|
-
url.https://github.com/.insteadOf",value:"ssh://git@github.com/"}]),
|
|
1346
|
-
m.helper",value:"!/usr/bin/env gh auth git-credential"}]),
|
|
1340
|
+
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function _p(e=[]){return jT(e).map(t=>({key:"safe.directory",value:t}))}
|
|
1341
|
+
function bp(e={},t=[]){return Pr(e,_p(t))}function xT(e=[]){return _p(e).flatMap(t=>["-c",`${t.key}=${t.value}`])}function Ys(){
|
|
1342
|
+
return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"0",PAGER:"cat"}}function Js(e={}){return Pr(e,PT)}function kT(e={}){
|
|
1343
|
+
return Pr(e,CT)}function $T(e={}){return Pr(e,NT)}function Ep(e={}){return kT(Js(e))}function Sp(e={}){return $T(Js(e))}
|
|
1344
|
+
var PT,CT,NT,U0,vp=b(()=>{K();PT=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"\
|
|
1345
|
+
url.https://github.com/.insteadOf",value:"ssh://git@github.com/"}]),CT=Object.freeze([{key:"credential.https://github.co\
|
|
1346
|
+
m.helper",value:"!/usr/bin/env gh auth git-credential"}]),NT=Object.freeze([{key:"credential.https://github.com.helper",
|
|
1347
1347
|
value:`!f() { case "$1" in get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);
|
|
1348
|
-
|
|
1349
|
-
code="vibe64_command_git_auth_token_required",t}return
|
|
1350
|
-
request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github-token"?r
|
|
1351
|
-
github-https"||e.purpose==="github")&&(r=
|
|
1352
|
-
BE64_GIT_AUTH_TOKEN"});import
|
|
1353
|
-
|
|
1354
|
-
()
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1348
|
+
U0=Object.freeze({applyGitConfigEntriesToEnv:Pr,githubSshToHttpsGitEnv:Js,gitSafeDirectoryArgs:xT})});function MT(e={}){if(!e.gitAuthToken){let t=new Error("Token-backed GitHub transport requires a gitAuthToken.");throw t.
|
|
1349
|
+
code="vibe64_command_git_auth_token_required",t}return Sp({...Ys(),GIT_TERMINAL_PROMPT:"0",[LT]:e.gitAuthToken})}function Tp({
|
|
1350
|
+
request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github-token"?r=MT(e):(e.gitTransport==="\
|
|
1351
|
+
github-https"||e.purpose==="github")&&(r=Ep({...t,...Ys()})),bp(r,e.gitSafeDirectories||[])}var LT,Ip=b(()=>{vp();LT="VI\
|
|
1352
|
+
BE64_GIT_AUTH_TOKEN"});import Ks from"node:path";function Op({env:e={},prefixRoot:t=""}={}){if(!re())return"";let r=x(t),n=String(e.USER||"").trim();
|
|
1353
|
+
return x(e[Xs])||(r&&/^[a-z_][a-z0-9_-]*$/u.test(n)?Ks.join(r,n):"")||(x(e.HOME)?Ks.join(x(e.HOME),".local"):"")}function Rp(e={}){
|
|
1354
|
+
let t=Op(e);return t?{[Xs]:t}:{}}function Ap(e={}){let t=Op(e);return t?[Ks.join(t,"bin")]:[]}var Xs,Zs=b(()=>{K();Re();
|
|
1355
|
+
Xs="NPM_CONFIG_PREFIX"});import{existsSync as DT,readdirSync as VT}from"node:fs";import UT from"node:os";import Fe from"node:path";import no from"node:process";
|
|
1356
|
+
function Cr(e=""){return String(e||"").split(":").map(j).filter(Boolean)}function Cp(e=[]){return e.filter(t=>{try{return DT(
|
|
1357
|
+
t)}catch{return!1}})}function Pp(e="",t=/^$/u){try{return VT(e).filter(r=>t.test(r)).sort((r,n)=>Number(/\d+/u.exec(n)?.[0]||
|
|
1358
|
+
0)-Number(/\d+/u.exec(r)?.[0]||0))}catch{return[]}}function BT(e){if(re())return[];let t=String(e.HOME||UT.homedir()||"");
|
|
1358
1359
|
if(!Fe.isAbsolute(t))return[];let r=Fe.isAbsolute(String(e.XDG_DATA_HOME||""))?e.XDG_DATA_HOME:Fe.join(t,".local/share"),
|
|
1359
|
-
n=Fe.isAbsolute(String(e.MISE_DATA_DIR||""))?e.MISE_DATA_DIR:Fe.join(r,"mise");return
|
|
1360
|
-
n,"shims"),...[".claude/local",".opencode/bin",".cargo/bin",".bun/bin"].map(o=>Fe.join(t,o))])}function
|
|
1361
|
-
let e=["/opt/homebrew","/usr/local"];return[...Cr(no.env.PATH),...no.platform==="darwin"?["/opt/homebrew/bin"]:[],...
|
|
1362
|
-
[...
|
|
1363
|
-
t=>[...
|
|
1360
|
+
n=Fe.isAbsolute(String(e.MISE_DATA_DIR||""))?e.MISE_DATA_DIR:Fe.join(r,"mise");return Cp([Fe.join(t,".local/bin"),Fe.join(
|
|
1361
|
+
n,"shims"),...[".claude/local",".opencode/bin",".cargo/bin",".bun/bin"].map(o=>Fe.join(t,o))])}function zT(){if(re())return[];
|
|
1362
|
+
let e=["/opt/homebrew","/usr/local"];return[...Cr(no.env.PATH),...no.platform==="darwin"?["/opt/homebrew/bin"]:[],...Cp(
|
|
1363
|
+
[...Pp("/usr/lib/postgresql",/^\d+$/u).slice(0,1).map(t=>`/usr/lib/postgresql/${t}/bin`),...no.platform==="darwin"?e.flatMap(
|
|
1364
|
+
t=>[...Pp(`${t}/opt`,/^postgresql@\d+$/u).slice(0,1).map(r=>`${t}/opt/${r}/bin`),`${t}/opt/mariadb/bin`]):[]])]}function Np({
|
|
1364
1365
|
env:e,existingPath:t="",inheritedPath:r="",runtimes:n=[],shimDirs:o=[]}){return ct([...Cr(o.join(":")),...Hs(),...n.flatMap(
|
|
1365
|
-
i=>Fs(i)),...
|
|
1366
|
-
Nr="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"});import
|
|
1367
|
-
{}:{APP_ENV:"development"}}function
|
|
1366
|
+
i=>Fs(i)),...fp(),...Cr(t||(r?"":e.PATH)),...BT(no.env),...Cr(r),...zT(),...Cr(Nr)]).join(":")}var Nr,oo=b(()=>{K();Re();
|
|
1367
|
+
Nr="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"});import GT from"node:path";function qT(e={}){return e.envPolicy==="deployment"||e.purpose==="deployment"||e.applicationAccount?
|
|
1368
|
+
{}:{APP_ENV:"development"}}function WT(e={}){return e.purpose==="preview"?{NODE_ENV:"development"}:{}}function YT(e={}){
|
|
1368
1369
|
return Object.fromEntries(Object.entries(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).map(([t,r])=>[String(t||"").trim(),
|
|
1369
|
-
String(r??"")]).filter(([t])=>t&&!
|
|
1370
|
-
_")))}function
|
|
1371
|
-
runtimeConfigEnv,e.project?.databaseEnv]}function
|
|
1372
|
-
{...t,...
|
|
1373
|
-
t"?
|
|
1374
|
-
let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=
|
|
1375
|
-
e.user,
|
|
1376
|
-
...s,...
|
|
1377
|
-
...
|
|
1378
|
-
PATH:
|
|
1379
|
-
cwd:r.cwd,env:n},personGitIdentity:r.personGitIdentity,project:r.
|
|
1380
|
-
let t=
|
|
1381
|
-
e,t))}}var
|
|
1382
|
-
ht,mt,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","
|
|
1383
|
-
"APP_ENV","NODE_ENV"])});import{Buffer as
|
|
1370
|
+
String(r??"")]).filter(([t])=>t&&!FT.has(t)&&!HT.has(t)&&!t.startsWith("GIT_")&&!t.startsWith("GH_")&&!t.startsWith("XDG\
|
|
1371
|
+
_")))}function Qs(e={}){return e.envPolicy==="deployment"?[e.project?.deploymentEnv,e.project?.deployment?.env]:[e.project?.
|
|
1372
|
+
runtimeConfigEnv,e.project?.databaseEnv]}function JT(e={}){return Qs(e).reduce((t,r)=>e.envPolicy==="deployment"?(zt(r),
|
|
1373
|
+
{...t,...we(r)}):{...t,...to(r,e)},{})}function KT(e={},t={}){return t.envPolicy==="deployment"?[]:t.envPolicy==="projec\
|
|
1374
|
+
t"?Qs(t):[e,...Qs(t),t.project?.databaseEnv,t.session?.databaseEnv]}function jp({actor:e={},baseEnv:t,localPath:r="",request:n={}}){
|
|
1375
|
+
let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=hp(),s=to(n.env,n),a=String(t.XDG_RUNTIME_DIR||"").trim(),c={..._r(
|
|
1376
|
+
e.user,YT(t)),...Vt(e)&>.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...WT(n),...Xn(...KT(t,n)),...JT(n),...Tp({actor:e,request:n}),
|
|
1377
|
+
...s,...gp({actor:e,request:n}),...i,...qT(n)},u=e.applicationAccount?"":ye().npmPrefixRoot,d={...c,...Rp({env:c,prefixRoot:u}),
|
|
1378
|
+
VIBE64_DECLARED_RUNTIMES:o},p=Np({env:d,existingPath:[...Ap({env:d,prefixRoot:u}),d.PATH].filter(Boolean).join(":"),inheritedPath:r,
|
|
1379
|
+
runtimes:n.runtimes,shimDirs:n.shimDirs||[]});return{...d,PATH:p,...re()?{}:{VIBE64_TOOL_PATH:p}}}function xp({actor:e={},
|
|
1380
|
+
baseEnv:t,request:r={}},n){return{actor:e,env:t,gitConfig:{cwd:r.cwd,env:n},personGitIdentity:r.personGitIdentity,project:r.
|
|
1381
|
+
project,session:r.session,userKey:r.userKey}}async function kp(e){let t=jp(e);return{...t,...await lp(xp(e,t))}}function ea(e){
|
|
1382
|
+
let t=jp(e);return{...t,...e.resolvedGitIdentityEnv||dp(xp(e,t))}}var FT,HT,ta=b(()=>{Kn();Mt();Zn();ro();Zn();yp();Ip();
|
|
1383
|
+
Ut();Ut();Ar();Zs();oo();Re();Oe();K();FT=new Set([...Or,pt,ft,ht,mt,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XD\
|
|
1384
|
+
G_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"]),HT=new Set(["APP_ENV","NODE_ENV"])});import{Buffer as XT}from"node:buffer";function Lp(){return{code:"terminal_session_not_found",error:"Terminal session not\
|
|
1384
1385
|
found.",ok:!1}}function He(e=""){return String(e||"default").trim()||"default"}function ao(e){let t=String(e||""),r=t.length;
|
|
1385
|
-
for(let n=0;n<
|
|
1386
|
-
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length
|
|
1387
|
-
"running"||e.status==="closing"}function
|
|
1388
|
-
!0}catch{return!1}}function
|
|
1389
|
-
let{outputLimit:r=0}=t,n=String(e||""),o=
|
|
1390
|
-
o),outputTruncated:!0}}function qe(e,t={}){let r=
|
|
1386
|
+
for(let n=0;n<ZT&&(r=t.lastIndexOf(`
|
|
1387
|
+
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>$p&&(t=t.slice(t.length-$p)),t}function jr(e={}){return e.status===
|
|
1388
|
+
"running"||e.status==="closing"}function ra(e={}){return jr(e)||e.status==="exited"}function Dp(e,t){try{return t(qe(e))===
|
|
1389
|
+
!0}catch{return!1}}function eI(e=0){let t=Math.floor(Number(e||0));return Number.isFinite(t)&&t>0?t:0}function tI(e="",t={}){
|
|
1390
|
+
let{outputLimit:r=0}=t,n=String(e||""),o=eI(r);return!o||n.length<=o?{output:n,outputTruncated:!1}:{output:n.slice(n.length-
|
|
1391
|
+
o),outputTruncated:!0}}function qe(e,t={}){let r=tI(e.output,t);return{ok:!0,closeError:e.closeError||"",cols:e.cols||io,
|
|
1391
1392
|
createdAt:e.createdAt||"",id:e.id,commandPreview:e.commandPreview,exitCode:e.exitCode,inputVersion:e.inputVersion||0,lastInputAt:e.
|
|
1392
1393
|
lastInputAt||"",lastInputBytes:e.lastInputBytes||0,lastOutputAt:e.lastOutputAt||"",lastOutputBytes:e.lastOutputBytes||0,
|
|
1393
1394
|
metadata:e.metadata||{},output:r.output,outputTruncated:r.outputTruncated,outputVersion:e.outputVersion||0,rows:e.rows||
|
|
1394
|
-
so,status:e.status}}function
|
|
1395
|
-
e));return!Number.isFinite(t)||t<0?0:Math.min(t,
|
|
1396
|
-
e.lastInputAt),Lt(e.lastOutputAt),Lt(e.createdAt))}function
|
|
1395
|
+
so,status:e.status}}function Vp(e=""){return XT.byteLength(String(e||""),"utf8")}function xr(e=0){let t=Math.floor(Number(
|
|
1396
|
+
e));return!Number.isFinite(t)||t<0?0:Math.min(t,QT)}function rI(e={}){return Math.max(Lt(e.lastSubscriberDetachedAt),Lt(
|
|
1397
|
+
e.lastInputAt),Lt(e.lastOutputAt),Lt(e.createdAt))}function na(e={},t=Date.now()){if(e.subscribers?.size)return 0;let r=rI(
|
|
1397
1398
|
e);return r>0?Math.max(0,Number(t)-r):0}function co(e={}){e.detachedCleanupTimer&&(clearTimeout(e.detachedCleanupTimer),
|
|
1398
|
-
e.detachedCleanupTimer=null)}var
|
|
1399
|
-
60*1e3,
|
|
1400
|
-
metadata:e.metadata,type:"metadata"}),qe(e))}function
|
|
1401
|
-
0)+1,e.lastOutputAt=new Date().toISOString(),e.lastOutputBytes=r)}function
|
|
1402
|
-
...e.subscribers])try{r(t)}catch{e.subscribers.delete(r)}}function
|
|
1403
|
-
e||"Terminal PTY error.");return{code:t,message:r}}function
|
|
1399
|
+
e.detachedCleanupTimer=null)}var $p,ZT,io,so,b$,QT,E$,Mp,Gt=b(()=>{K();$p=256*1024,ZT=300,io=100,so=28,b$=600*1e3,QT=1440*
|
|
1400
|
+
60*1e3,E$=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "});Mp=new Map});function Up(e,t={}){return!e||!t||typeof t!="object"||Array.isArray(t)?qe(e):(e.metadata={...e.metadata||{},...t},Ae(e,{
|
|
1401
|
+
metadata:e.metadata,type:"metadata"}),qe(e))}function Bp(e,t=""){let r=Vp(t);r<1||(e.outputVersion=Number(e.outputVersion||
|
|
1402
|
+
0)+1,e.lastOutputAt=new Date().toISOString(),e.lastOutputBytes=r)}function Ae(e,t){if(e?.subscribers?.size)for(let r of[
|
|
1403
|
+
...e.subscribers])try{r(t)}catch{e.subscribers.delete(r)}}function nI(e){let t=String(e?.code||""),r=String(e?.message||
|
|
1404
|
+
e||"Terminal PTY error.");return{code:t,message:r}}function zp(e,t){if(!e)return;let r=nI(t);e.lastWriteErrorAt=new Date().
|
|
1404
1405
|
toISOString(),e.lastWriteErrorCode=r.code,e.lastWriteError=r.message,console.warn("Vibe64 terminal PTY write error.",{code:r.
|
|
1405
|
-
code,id:e.id,metadata:e.metadata||{},message:r.message,namespace:e.namespace||""}),
|
|
1406
|
-
error"})}function
|
|
1406
|
+
code,id:e.id,metadata:e.metadata||{},message:r.message,namespace:e.namespace||""}),Ae(e,{code:r.code,error:r.message,type:"\
|
|
1407
|
+
error"})}function Gp(e){let t=e?.terminal?._writeStream;!t||typeof t.on!="function"||t.on("error",r=>{zp(e,r)})}function Fp(e,t,r=t){
|
|
1407
1408
|
let n=`\r
|
|
1408
1409
|
[studio] ${r}\r
|
|
1409
|
-
`;e.closeError=t,e.output=ao(`${e.output}${n}`),
|
|
1410
|
+
`;e.closeError=t,e.output=ao(`${e.output}${n}`),Ae(e,{chunk:n,type:"output"}),Ae(e,{error:t,type:"error"})}async function Hp(e,{
|
|
1410
1411
|
code:t,flag:r,hook:n,label:o,payload:i}){if(e[r])return null;e[r]=!0;try{return await e[n](i),null}catch(s){let a=String(
|
|
1411
|
-
s?.message||s||`${o}.`),c=s instanceof Error?s:new Error(a);return c.code||=t,
|
|
1412
|
+
s?.message||s||`${o}.`),c=s instanceof Error?s:new Error(a);return c.code||=t,Fp(e,a,`${o}: ${a}`),c}}function gt(e,t){let r=`${String(
|
|
1412
1413
|
t?.code||"terminal_cleanup_failed")}:${String(t?.message||"")}`;return e.reportedLifecycleFailures||=new Set,e.reportedLifecycleFailures.
|
|
1413
|
-
has(r)||(e.reportedLifecycleFailures.add(r),
|
|
1414
|
+
has(r)||(e.reportedLifecycleFailures.add(r),Fp(e,String(t?.message||t||"Terminal cleanup failed."))),t}function uo(e,t=[]){
|
|
1414
1415
|
let r=new AggregateError(t,`Terminal session could not close cleanly: ${e.id}`);return r.code=t.some(n=>String(n?.code||
|
|
1415
|
-
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function
|
|
1416
|
-
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>
|
|
1416
|
+
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function oI(e,t){
|
|
1417
|
+
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>Hp(e,{code:"terminal_stop_hook_failed",flag:"\
|
|
1417
1418
|
stopHookStarted",hook:"onStop",label:"Terminal stop failed",payload:{id:e.id,output:e.output,reason:t,status:e.status}}))),
|
|
1418
|
-
e.stopHookCompletion}function
|
|
1419
|
+
e.stopHookCompletion}function oa(e,t){return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>Hp(
|
|
1419
1420
|
e,{code:"terminal_close_hook_failed",flag:"closeHookStarted",hook:"onClose",label:"Terminal finalization failed",payload:{
|
|
1420
|
-
exitCode:e.exitCode,id:e.id,output:e.output,reason:t,status:e.status}}))),e.closeHookCompletion}function
|
|
1421
|
-
"exited"&&(e.status="exited",
|
|
1421
|
+
exitCode:e.exitCode,id:e.id,output:e.output,reason:t,status:e.status}}))),e.closeHookCompletion}function ia(e){e.status!==
|
|
1422
|
+
"exited"&&(e.status="exited",Ae(e,{closeError:e.closeError||"",exitCode:e.exitCode,status:e.status,type:"status"}))}function sa(e){
|
|
1422
1423
|
return e.scopeDrainCompletion||(e.scopeDrainCompletion=(async()=>{if(process.platform!=="win32"&&!await Hn(e.terminal.pid)){
|
|
1423
1424
|
let t=new Error(`Terminal execution scope did not become empty: ${e.id}`);throw t.code="terminal_execution_drain_failed",
|
|
1424
|
-
t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function
|
|
1425
|
-
gt(e,t)}try{await Promise.all([
|
|
1425
|
+
t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function qp(e){try{await e.scopeDrainCompletion}catch(t){
|
|
1426
|
+
gt(e,t)}try{await Promise.all([oa(e,e.stopReason||"exit"),e.stopHookCompletion])}catch(t){gt(e,t)}ia(e)}async function aa(e,t="\
|
|
1426
1427
|
stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=String(t||"stop"),e.status==="running"&&(e.status="clos\
|
|
1427
|
-
ing",
|
|
1428
|
+
ing",Ae(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];if(oI(e,e.stopReason),!e.processExited&&!e.killStarted){
|
|
1428
1429
|
e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;let o=n instanceof Error?n:new Error(String(n||"Termina\
|
|
1429
|
-
l process could not be killed."));o.code||="terminal_kill_failed",r.push(gt(e,o))}}try{await
|
|
1430
|
-
n))}return{failures:r}}var
|
|
1431
|
-
ok:!1}:null}var
|
|
1432
|
-
e.delete(r);let n=He(t);e.size<1&&yt.get(n)===e&&yt.delete(n)}function
|
|
1433
|
-
filter(r=>r.startsWith(t))}function lo({namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){let n=e?[He(e)]:
|
|
1434
|
-
o=[];for(let i of n){let s=Ft(i);for(let a of s.values())r&&!jr(a)||o.push({namespace:i,session:a})}return o}var yt,
|
|
1435
|
-
()=>{Gt();yt=new Map});function fo(e={},t="default"){if(co(e),!
|
|
1436
|
-
let n=Math.max(0,r-
|
|
1430
|
+
l process could not be killed."));o.code||="terminal_kill_failed",r.push(gt(e,o))}}try{await sa(e)}catch(n){r.push(gt(e,
|
|
1431
|
+
n))}return{failures:r}}var ca=b(()=>{Er();Gt()});function sI(e="default"){return iI.get(He(e))||null}function Wp(e="default"){let t=sI(e);return t?{code:t.code,error:t.error,
|
|
1432
|
+
ok:!1}:null}var iI,Yp=b(()=>{Gt();iI=new Map});function Ft(e){return yt.get(He(e))||Mp}function Jp(e){let t=He(e);return yt.has(t)||yt.set(t,new Map),yt.get(t)}function Kp(e,t,r){
|
|
1433
|
+
e.delete(r);let n=He(t);e.size<1&&yt.get(n)===e&&yt.delete(n)}function aI(e=""){let t=String(e||"");return[...yt.keys()].
|
|
1434
|
+
filter(r=>r.startsWith(t))}function lo({namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){let n=e?[He(e)]:aI(t),
|
|
1435
|
+
o=[];for(let i of n){let s=Ft(i);for(let a of s.values())r&&!jr(a)||o.push({namespace:i,session:a})}return o}var yt,ua=b(
|
|
1436
|
+
()=>{Gt();yt=new Map});function fo(e={},t="default"){if(co(e),!ra(e)||e.subscribers?.size)return;let r=xr(e.detachedIdleTimeoutMs);if(r<1)return;
|
|
1437
|
+
let n=Math.max(0,r-na(e));e.detachedCleanupTimer=setTimeout(()=>{e.detachedCleanupTimer=null,cI({namespace:t})},n)}async function la(e,t={}){
|
|
1437
1438
|
let{namespace:r="default"}=t,n=Ft(r),o=n.get(e);if(!o)return{ok:!0,closed:!1};if(o.closePromise)return o.closePromise;let i=(async()=>{
|
|
1438
|
-
let s=[];if(co(o),!o.processExited){let u=await
|
|
1439
|
+
let s=[];if(co(o),!o.processExited){let u=await aa(o,"close");if(u.failures.length)throw uo(o,u.failures)}try{await o.exitCompletion}catch(u){
|
|
1439
1440
|
s.push(gt(o,u))}try{await o.scopeDrainCompletion}catch(u){s.push(gt(o,u))}let c=(await Promise.all([o.stopHookCompletion,
|
|
1440
|
-
o.closeHookCompletion])).filter(Boolean);if(o.processExited&&
|
|
1441
|
+
o.closeHookCompletion])).filter(Boolean);if(o.processExited&&ia(o),s.length>0)throw uo(o,[...s,...c]);return Kp(n,r,e),{
|
|
1441
1442
|
ok:!0,closed:!0,...c.length>0?{cleanupErrors:c.map(u=>String(u?.message||u))}:{}}})();o.closePromise=i;try{return await i}finally{
|
|
1442
|
-
o.closePromise===i&&(o.closePromise=null)}}async function
|
|
1443
|
-
if(!
|
|
1444
|
-
r.id,{namespace:t})}}}var
|
|
1445
|
-
filter:e,namespacePrefix:t}){return lo({namespacePrefix:t,runningOnly:!0}).filter(r=>
|
|
1443
|
+
o.closePromise===i&&(o.closePromise=null)}}async function cI({namespace:e}){for(let{namespace:t,session:r}of lo({namespace:e})){
|
|
1444
|
+
if(!ra(r)||r.subscribers?.size)continue;let n=xr(r.detachedIdleTimeoutMs);if(!(n<1)){if(na(r)<n){fo(r,t);continue}await la(
|
|
1445
|
+
r.id,{namespace:t})}}}var da=b(()=>{K();ca();ua();Gt()});import lI from"node:crypto";import{createRequire as dI}from"node:module";function fa(){}function fI(){return!0}function mI({
|
|
1446
|
+
filter:e,namespacePrefix:t}){return lo({namespacePrefix:t,runningOnly:!0}).filter(r=>Dp(r.session,e)).length}function Xp({
|
|
1446
1447
|
args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},maxRunning:i=0,metadata:s={},namespace:a="default",namespaceLimitPrefix:c="",
|
|
1447
|
-
runningLimitFilter:u=
|
|
1448
|
-
if(w)return w;let _=Ft(a),f=
|
|
1449
|
-
if(y)return qe(y);let E=Number(i||0),T=c||a;if(E>0&&
|
|
1448
|
+
runningLimitFilter:u=fI,onClose:d=fa,onOutput:p=fa,onStop:g=fa,reuseRunning:h=!1,detachedIdleTimeoutMs:l=0}){let w=Wp(a);
|
|
1449
|
+
if(w)return w;let _=Ft(a),f=lI.randomUUID(),m=typeof h=="function"?h:()=>!!h,y=h?[..._.values()].find(D=>jr(D)&&m(D)):null;
|
|
1450
|
+
if(y)return qe(y);let E=Number(i||0),T=c||a;if(E>0&&mI({filter:u,namespacePrefix:T})>=E)return{ok:!1,code:"terminal_limi\
|
|
1450
1451
|
t",error:`Terminal limit reached (${E}).`};let S=typeof o=="function"?o({id:f,namespace:a}):o,v=typeof e=="function"?e({
|
|
1451
1452
|
env:S,id:f,namespace:a}):e,R=typeof r=="function"?r({args:v,env:S,id:f,namespace:a}):r,O=typeof s=="function"?s({args:v,
|
|
1452
|
-
env:S,id:f,namespace:a}):s,A=
|
|
1453
|
+
env:S,id:f,namespace:a}):s,A=pI("node-pty").spawn(t,v,{cols:io,cwd:n,env:ee(S),name:"xterm-color",rows:so}),$,P=new Promise(
|
|
1453
1454
|
D=>{$=D}),C={id:f,closeHookCompletion:null,closePromise:null,commandPreview:R,cols:io,createdAt:new Date().toISOString(),
|
|
1454
1455
|
cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:xr(l),exitCompletion:P,exitCode:null,lastSubscriberAttachedAt:"",lastSubscriberDetachedAt:new Date().
|
|
1455
1456
|
toISOString(),metadata:O&&typeof O=="object"&&!Array.isArray(O)?O:{},onClose:d,onStop:g,inputVersion:0,lastInputAt:"",lastInputBytes:0,
|
|
1456
1457
|
lastOutputAt:"",lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",output:"",outputVersion:0,
|
|
1457
1458
|
processExited:!1,killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:$,rows:so,status:"running",stopHookCompletion:null,
|
|
1458
|
-
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:A};return
|
|
1459
|
-
D),
|
|
1460
|
-
session:qe(C),updateMetadata(Y){return
|
|
1461
|
-
|
|
1462
|
-
C),
|
|
1463
|
-
f,C),fo(C,a),
|
|
1464
|
-
qe(i,{outputLimit:n}):
|
|
1465
|
-
execution/src/server/engines/terminalSessions.js",import.meta.url).href;dI
|
|
1466
|
-
function
|
|
1467
|
-
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=
|
|
1468
|
-
"exec-helper-payloads");return
|
|
1469
|
-
let{actor:r,cwd:n,env:o,resolveEnv:i}=t,s=e.terminal||{},a=e.envFactory?i:o;return Jn(r)?{args:(c={})=>{let u=
|
|
1459
|
+
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:A};return Gp(C),A.onData(D=>{Bp(C,D),C.output=ao(C.output+
|
|
1460
|
+
D),Ae(C,{chunk:D,lastOutputAt:C.lastOutputAt,outputVersion:C.outputVersion,type:"output"});try{p({chunk:D,output:C.output,
|
|
1461
|
+
session:qe(C),updateMetadata(Y){return Up(C,Y)}})}catch(Y){let ae=String(Y?.message||Y||"Terminal output hook failed.");
|
|
1462
|
+
Ae(C,{error:ae,type:"error"})}fo(C,a)}),A.onExit(({exitCode:D})=>{C.processExited=!0,C.exitCode=D,C.status="closing",sa(
|
|
1463
|
+
C),Ae(C,{exitCode:D,status:C.status,type:"status"}),oa(C,C.stopReason||"exit"),C.resolveExitCompletion(),qp(C)}),Jp(a).set(
|
|
1464
|
+
f,C),fo(C,a),hI(f,{namespace:a})}function hI(e,t={}){let{namespace:r="default",outputLimit:n=0}=t,i=Ft(r).get(e);return i?
|
|
1465
|
+
qe(i,{outputLimit:n}):Lp()}var uI,pI,Zp=b(()=>{K();Gt();ca();Yp();da();ua();uI=new URL("./../node_modules/@local/vibe64-\
|
|
1466
|
+
execution/src/server/engines/terminalSessions.js",import.meta.url).href;pI=dI(uI)});import{randomUUID as gI}from"node:crypto";import{mkdirSync as yI,writeFileSync as wI}from"node:fs";import pa from"node:path";
|
|
1467
|
+
function _I(){}function bI(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper payload root is required fo\
|
|
1468
|
+
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=pa.join(pa.resolve(t),
|
|
1469
|
+
"exec-helper-payloads");return yI(r,{mode:448,recursive:!0}),pa.join(r,`${process.pid}-${Date.now()}-${gI()}.json`)}function EI(e,t){
|
|
1470
|
+
let{actor:r,cwd:n,env:o,resolveEnv:i}=t,s=e.terminal||{},a=e.envFactory?i:o;return Jn(r)?{args:(c={})=>{let u=bI(s.helperPayloadRoot),
|
|
1470
1471
|
d=typeof e.args=="function"?e.args(c):e.args,p=qn({actor:r,args:d,command:e.command,cwd:n,env:typeof a=="function"?a(c):
|
|
1471
|
-
a,input:e.input,operation:Tr(e)});return
|
|
1472
|
+
a,input:e.input,operation:Tr(e)});return wI(u,`${JSON.stringify(p)}
|
|
1472
1473
|
`,{mode:384}),["-n",Ns(),"execute",u]},command:"sudo",cwd:s.helperPayloadRoot,env:{PATH:process.env.PATH||Nr}}:{args:e.args,
|
|
1473
|
-
command:e.command,cwd:n,env:a}}async function
|
|
1474
|
-
{},{onClose:a=
|
|
1474
|
+
command:e.command,cwd:n,env:a}}async function em(e={},t={}){let{actor:r,cwd:n,env:o,resolveEnv:i}=t;try{let s=e.terminal||
|
|
1475
|
+
{},{onClose:a=_I}=s,c=e.execution?.id||"",u=EI(e,{actor:r,cwd:n,env:o,resolveEnv:i}),d=Xp({args:u.args,command:u.command,
|
|
1475
1476
|
commandPreview:s.commandPreview,cwd:u.cwd,detachedIdleTimeoutMs:s.detachedIdleTimeoutMs,env:u.env,maxRunning:s.maxRunning,
|
|
1476
1477
|
metadata:s.metadata,namespace:s.namespace,namespaceLimitPrefix:s.namespaceLimitPrefix,onClose:async p=>{try{await a(p)}finally{
|
|
1477
|
-
c&&
|
|
1478
|
-
runningLimitFilter:s.runningLimitFilter});return d?.ok===!0&&c&&
|
|
1478
|
+
c&&Qp.set(c,{id:p.id,namespace:s.namespace,scopeEmpty:!0})}},onOutput:s.onOutput,onStop:s.onStop,reuseRunning:s.reuseRunning,
|
|
1479
|
+
runningLimitFilter:s.runningLimitFilter});return d?.ok===!0&&c&&Qp.set(c,{id:d.id,namespace:s.namespace}),d?.ok===!0?{...d,
|
|
1479
1480
|
execution:e.execution}:d}catch(s){return te(s?.message||"Vibe64 PTY command failed.",s?.code||"vibe64_command_pty_failed",
|
|
1480
|
-
{execution:e.execution})}}var
|
|
1481
|
-
resolveLinks:n=!0}=t,o=
|
|
1482
|
-
c,o));if(s.length>0){if(!n)return o;let c=
|
|
1483
|
-
s outside the allowed roots.");throw a.code="vibe64_command_cwd_outside_allowed_roots",a}var
|
|
1481
|
+
{execution:e.execution})}}var Qp,ma=b(()=>{ut();oo();Zp();da();Wn();Kn();Qp=new Map});import{realpathSync as tm}from"node:fs";function SI(e=""){return x(e||process.cwd())}function rm(e="",t={}){let{allowedRoots:r=[],
|
|
1482
|
+
resolveLinks:n=!0}=t,o=SI(e),i=(Array.isArray(r)?r:[r]).map(x).filter(Boolean);if(i.length===0)return o;let s=i.filter(c=>ze(
|
|
1483
|
+
c,o));if(s.length>0){if(!n)return o;let c=tm(o);if(s.some(u=>ze(tm(u),c)))return c}let a=new Error("Vibe64 command cwd i\
|
|
1484
|
+
s outside the allowed roots.");throw a.code="vibe64_command_cwd_outside_allowed_roots",a}var nm=b(()=>{K()});import{randomUUID as vI}from"node:crypto";function se(e="",t="vibe64_command_request_invalid"){let r=new Error(e||"Inval\
|
|
1484
1485
|
id Vibe64 command request.");return r.code=t,r}function We(e="",t=[],r="",n="value"){let o=j(e)||r;if(!t.includes(o))throw se(
|
|
1485
|
-
`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function
|
|
1486
|
+
`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function $I(e=[],t={}){let{
|
|
1486
1487
|
mode:r="capture"}=t;if(typeof e=="function"){if(r!=="pty")throw se("Function-valued command args are only supported for \
|
|
1487
1488
|
PTY commands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(n=>String(n??""))}
|
|
1488
|
-
function
|
|
1489
|
-
nv is only supported for PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},envFactory:e}}let n=
|
|
1490
|
-
e);return zt(n),{env:n,envFactory:null}}function
|
|
1489
|
+
function LI(e={},t={}){let{mode:r="capture"}=t;if(typeof e=="function"){if(r!=="pty")throw se("Function-valued command e\
|
|
1490
|
+
nv is only supported for PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},envFactory:e}}let n=we(
|
|
1491
|
+
e);return zt(n),{env:n,envFactory:null}}function ha(e=[]){return(Array.isArray(e)?e:[e]).map(x).filter(Boolean)}function MI(e={}){
|
|
1491
1492
|
let t=ee(e);return{commandPreview:t.commandPreview,detachedIdleTimeoutMs:t.detachedIdleTimeoutMs,helperPayloadRoot:x(t.helperPayloadRoot),
|
|
1492
1493
|
maxRunning:t.maxRunning,metadata:t.metadata,namespace:j(t.namespace),namespaceLimitPrefix:j(t.namespaceLimitPrefix),onClose:t.
|
|
1493
|
-
onClose,onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.runningLimitFilter}}function
|
|
1494
|
+
onClose,onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.runningLimitFilter}}function DI(e={}){
|
|
1494
1495
|
let t=ee(e),r=x(t.home||t.toolHomeSource);return r?{cacheRoot:x(t.cacheRoot),configRoot:x(t.configRoot),dataRoot:x(t.dataRoot),
|
|
1495
1496
|
gid:Number.isSafeInteger(Number(t.gid??t.hostGid))?Number(t.gid??t.hostGid):null,home:r,scope:j(t.scope),stateRoot:x(t.stateRoot),
|
|
1496
1497
|
uid:Number.isSafeInteger(Number(t.uid??t.hostUid))?Number(t.uid??t.hostUid):null,username:j(t.username||t.ownerUserKey||
|
|
1497
|
-
t.userKey)}:{}}function
|
|
1498
|
+
t.userKey)}:{}}function VI(e="capture"){return e==="detached"?"service":e==="pty"?"interactive":"finite"}function UI({mode:e="\
|
|
1498
1499
|
capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function Ht(e=""){let t=j(e);
|
|
1499
1500
|
if(!t)return"";if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw se(`Invalid Vibe64 execution ide\
|
|
1500
|
-
ntifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function
|
|
1501
|
-
purpose:o="terminal",session:i={}}=t,s=ee(e),a=We(s.kind,
|
|
1502
|
-
|
|
1501
|
+
ntifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function im(e={},t={}){let{mode:r="capture",project:n={},
|
|
1502
|
+
purpose:o="terminal",session:i={}}=t,s=ee(e),a=We(s.kind,NI,UI({mode:r,purpose:o}),"execution_kind"),c=We(s.lifecycle,jI,
|
|
1503
|
+
VI(r),"execution_lifecycle");if(r==="detached"&&c!=="service"||r==="pty"&&c!=="interactive"||r==="capture"&&c!=="finite")
|
|
1503
1504
|
throw se(`Execution lifecycle ${c} is incompatible with command mode ${r}.`,"vibe64_execution_lifecycle_incompatible");let u=Ht(
|
|
1504
1505
|
s.ownerId||i.sessionId);if(c==="service"&&!u)throw se("Service execution requires a durable owner id.","vibe64_execution\
|
|
1505
1506
|
_owner_required");let d=s.resourceProfile;if(d!=null&&(!d||typeof d!="object"||Object.keys(d).some(p=>!["key","compatibi\
|
|
1506
1507
|
lityKey","environment"].includes(p))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.test(d.key||"")||!/^[a-f0-9]{64}$/u.test(d.compatibilityKey||
|
|
1507
1508
|
"")||!["development","test","staging"].includes(d.environment)))throw se("Invalid activity resource profile identity.","\
|
|
1508
1509
|
vibe64_resource_profile_invalid");return Object.freeze({...d?{resourceProfile:Object.freeze({...d})}:{},controlGenerationId:Ht(
|
|
1509
|
-
s.controlGenerationId),...s.workflowId===void 0||s.workflowId===null||s.workflowId===""?{}:{workflowId:
|
|
1510
|
-
id:
|
|
1511
|
-
projectSlug:Ht(s.projectSlug||n.slug||n.projectSlug),sessionId:Ht(s.sessionId||i.sessionId)})}function
|
|
1510
|
+
s.controlGenerationId),...s.workflowId===void 0||s.workflowId===null||s.workflowId===""?{}:{workflowId:BI(s.workflowId)},
|
|
1511
|
+
id:vI(),kind:a,label:j(s.label),lifecycle:c,operationId:Ht(s.operationId),ownerId:u,parentExecutionId:Ht(s.parentExecutionId),
|
|
1512
|
+
projectSlug:Ht(s.projectSlug||n.slug||n.projectSlug),sessionId:Ht(s.sessionId||i.sessionId)})}function BI(e){if(typeof e!=
|
|
1512
1513
|
"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.test(e))throw se("Execution req\
|
|
1513
|
-
uires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}function
|
|
1514
|
-
e)?Gs:[]}function
|
|
1515
|
-
imes"),n=
|
|
1516
|
-
j).filter(Boolean))}function
|
|
1517
|
-
_required");let n=We(t.mode,
|
|
1518
|
-
throw se("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=
|
|
1519
|
-
t.env,{mode:n}),s=We(t.purpose,
|
|
1514
|
+
uires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}function zI(e=""){return kI.has(
|
|
1515
|
+
e)?Gs:[]}function om(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function GI(e={},t=""){let r=om(e,"runt\
|
|
1516
|
+
imes"),n=om(e,"runtime");if(!r&&!n)return ct(zI(t));let o=r?e.runtimes:e.runtime;return ct((Array.isArray(o)?o:[o]).map(
|
|
1517
|
+
j).filter(Boolean))}function sm(e={}){let t=ee(e),r=j(t.command);if(!r)throw se("A command is required.","vibe64_command\
|
|
1518
|
+
_required");let n=We(t.mode,RI,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!=="capture"))
|
|
1519
|
+
throw se("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=we(t.baseEnv),i=LI(
|
|
1520
|
+
t.env,{mode:n}),s=We(t.purpose,OI,"terminal","purpose"),a=GI(t,s);for(let l of a)if(!Object.hasOwn(Bt,l))throw se(`Unsup\
|
|
1520
1521
|
ported Vibe64 runtime: ${l}.`,"vibe64_command_runtime_unsupported");let c=ee(t.project),u=ee(t.session),d=t.releaseEnvironmentFile??
|
|
1521
1522
|
"";if(typeof d!="string"||d&&(!d.startsWith("/")||/[\r\n\0]/u.test(d)||n!=="capture"||t.actor!=="app"||t.envPolicy!=="de\
|
|
1522
1523
|
ployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw se("Release environment files require a\
|
|
1523
1524
|
finite application deployment command without caller Env.","vibe64_command_release_environment_invalid");let p=t.usageRecordingPreload??
|
|
1524
1525
|
"";if(typeof p!="string"||p&&(!p.startsWith("/")||/[\s"'\\\0]/u.test(p)||!["preview","output"].includes(s)||t.actor==="a\
|
|
1525
1526
|
pp"))throw se("A usage recording preload belongs only to a Preview or Output target launch.","vibe64_command_usage_recor\
|
|
1526
|
-
ding_preload_invalid");let g=t.applicationAccount??"";if(typeof g!="string"||g&&(!
|
|
1527
|
+
ding_preload_invalid");let g=t.applicationAccount??"";if(typeof g!="string"||g&&(!II.test(g)||t.actor!=="app"||n!=="capt\
|
|
1527
1528
|
ure"))throw se("Application accounts run only finite application commands.","vibe64_command_application_account_invalid");
|
|
1528
1529
|
let h=t.sandboxAllowances??[];if(!Array.isArray(h)||h.some(l=>typeof l!="string"||!/^[a-z][a-z0-9-]*$/u.test(l))||new Set(
|
|
1529
1530
|
h).size!==h.length||h.length>0&&!g)throw se("Sandbox allowances belong only to an application account's own commands.","\
|
|
1530
|
-
vibe64_command_sandbox_allowances_invalid");return{actor:We(t.actor,
|
|
1531
|
-
t.allowedRoots),args
|
|
1532
|
-
envPolicy:We(t.envPolicy,
|
|
1533
|
-
{mode:n,project:c,purpose:s,session:u}),credentialHome:
|
|
1531
|
+
vibe64_command_sandbox_allowances_invalid");return{actor:We(t.actor,TI,"daemon","actor"),applicationAccount:g,allowedRoots:ha(
|
|
1532
|
+
t.allowedRoots),args:$I(t.args,{mode:n}),baseEnv:o,command:r,cwd:x(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,
|
|
1533
|
+
envPolicy:We(t.envPolicy,PI,"session","env_policy"),releaseEnvironmentFile:d,sandboxAllowances:[...h],execution:im(t.execution,
|
|
1534
|
+
{mode:n,project:c,purpose:s,session:u}),credentialHome:DI(t.credentialHome),gitAuthToken:j(t.gitAuthToken),gitSafeDirectories:ha(
|
|
1534
1535
|
t.gitSafeDirectories),personGitIdentity:{email:j(t.personGitIdentity?.email),name:j(t.personGitIdentity?.name)},gitTransport:We(
|
|
1535
|
-
t.gitTransport,
|
|
1536
|
-
maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&Number(t.maxBuffer)>0?Number(t.maxBuffer):
|
|
1537
|
-
onOutput=="function"?t.onOutput:null,outputEncoding:We(t.outputEncoding,
|
|
1538
|
-
runtimes:a,session:u,signal:t.signal??null,shimDirs:
|
|
1539
|
-
Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,usageRecordingPreload:p,userKey:j(t.userKey)}}var
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
loyment","health","workspace-cache","source"]),
|
|
1543
|
-
base64"]),
|
|
1544
|
-
"github-token"]),
|
|
1545
|
-
["finite","interactive","service"]),
|
|
1546
|
-
ce","terminal"]);
|
|
1547
|
-
()=>{vr();Er();
|
|
1548
|
-
function
|
|
1536
|
+
t.gitTransport,CI,"none","git_transport"),inheritProcessEnv:!d&&t.inheritProcessEnv!==!1,input:t.input,logPath:x(t.logPath),
|
|
1537
|
+
maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&Number(t.maxBuffer)>0?Number(t.maxBuffer):xI,mode:n,onOutput:typeof t.
|
|
1538
|
+
onOutput=="function"?t.onOutput:null,outputEncoding:We(t.outputEncoding,AI,"utf8","output_encoding"),project:c,purpose:s,
|
|
1539
|
+
runtimes:a,session:u,signal:t.signal??null,shimDirs:ha(t.shimDirs),terminal:MI(t.terminal),timeout:Number.isSafeInteger(
|
|
1540
|
+
Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,usageRecordingPreload:p,userKey:j(t.userKey)}}var TI,II,OI,
|
|
1541
|
+
RI,AI,PI,CI,NI,jI,xI,kI,bL,am=b(()=>{K();ro();Re();TI=Object.freeze(["daemon","owner-user","named-user","app"]),II=/^[a-z_][a-z0-9_-]{0,31}$/u,
|
|
1542
|
+
OI=Object.freeze(["account","assistant","terminal","codex","github","github-api","source-editor","preview","output","dep\
|
|
1543
|
+
loyment","health","workspace-cache","source"]),RI=Object.freeze(["capture","pty","detached"]),AI=Object.freeze(["utf8","\
|
|
1544
|
+
base64"]),PI=Object.freeze(["session","project","preview","auth","deployment"]),CI=Object.freeze(["none","github-https",
|
|
1545
|
+
"github-token"]),NI=Object.freeze(["assistant","browser","control","job","preview","service","terminal"]),jI=Object.freeze(
|
|
1546
|
+
["finite","interactive","service"]),xI=1e3*1e3*100,kI=new Set(["assistant","codex","deployment","output","preview","sour\
|
|
1547
|
+
ce","terminal"]);bL=Object.freeze({normalizeExecutionDescriptor:im})});function ga(){return FI}function po(e){return["1","true"].includes(String(e[cm]||"").trim().toLowerCase())}var FI,cm,mo=b(
|
|
1548
|
+
()=>{vr();Er();ma();ut();FI=null,cm="VIBE64_MANAGED_EXECUTION_REQUIRED"});import{realpathSync as um,statSync as qI}from"node:fs";import Ye from"node:path";import{fileURLToPath as WI}from"node:url";
|
|
1549
|
+
function YI(e){let t=[Ye.resolve(Ye.dirname(e),"../../../vibe64-usage-recording/runtime/node")];for(let r=Ye.dirname(e);t.
|
|
1549
1550
|
push(Ye.join(r,"node_modules/@local/vibe64-usage-recording/runtime/node")),Ye.dirname(r)!==r;r=Ye.dirname(r));return t.flatMap(
|
|
1550
|
-
r=>{try{return[
|
|
1551
|
-
|
|
1552
|
-
der is not part of this Vibe64 installation."),{code:"vibe64_usage_recording_preload_invalid"})}var
|
|
1553
|
-
"./../node_modules/@local/vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href});function
|
|
1551
|
+
r=>{try{return[um(r)]}catch{return[]}})}function lm(e="",t=WI(HI)){try{if(Ye.resolve(e)===e&&um(e)===e&&qI(e).isFile()&&
|
|
1552
|
+
YI(t).some(r=>e.startsWith(`${r}${Ye.sep}`)))return`--import=${e}`}catch{}throw Object.assign(new Error("The usage recor\
|
|
1553
|
+
der is not part of this Vibe64 installation."),{code:"vibe64_usage_recording_preload_invalid"})}var HI,dm=b(()=>{HI=new URL(
|
|
1554
|
+
"./../node_modules/@local/vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href});function fm(e){return e.releaseEnvironmentFile?te("Release environment execution requires a managed host.","vibe64_relea\
|
|
1554
1555
|
se_environment_unavailable",{execution:e.execution}):e.applicationAccount?te("Application account execution requires a m\
|
|
1555
|
-
anaged host.","vibe64_application_account_unavailable",{execution:e.execution}):null}async function
|
|
1556
|
-
cwd:n,env:o,requiresHelper:i,resolveEnv:s}=t,a=
|
|
1557
|
-
u=s;o={...o,NODE_OPTIONS:c},s=d=>({...u(d),NODE_OPTIONS:c})}return e.mode==="pty"?
|
|
1556
|
+
anaged host.","vibe64_application_account_unavailable",{execution:e.execution}):null}async function JI(e,t={}){let{actor:r,
|
|
1557
|
+
cwd:n,env:o,requiresHelper:i,resolveEnv:s}=t,a=fm(e);if(a)return a;if(e.usageRecordingPreload){let c=lm(e.usageRecordingPreload),
|
|
1558
|
+
u=s;o={...o,NODE_OPTIONS:c},s=d=>({...u(d),NODE_OPTIONS:c})}return e.mode==="pty"?em(e,{actor:r,cwd:n,env:o,resolveEnv:s}):
|
|
1558
1559
|
e.mode==="detached"?r.requiresRealUser&&(!Vt(r)||i)?te("Detached real-user command execution is unsupported when the hel\
|
|
1559
|
-
per is required.","vibe64_command_detached_real_user_unsupported",{execution:e.execution}):
|
|
1560
|
+
per is required.","vibe64_command_detached_real_user_unsupported",{execution:e.execution}):Tf(e,{actor:r,cwd:n,env:o}):i?
|
|
1560
1561
|
{...await js(qn({actor:r,args:e.args,command:e.command,cwd:n,env:o,input:e.input,operation:Tr(e)}),{env:process.env,maxBuffer:e.
|
|
1561
1562
|
maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout}),execution:e.execution}:Sr(e.command,e.args,
|
|
1562
1563
|
{cwd:n,env:o,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,onOutput:e.onOutput,outputEncoding:e.outputEncoding,
|
|
1563
|
-
signal:e.signal,timeout:e.timeout})}async function qt(e={}){let t=null;try{if(t=
|
|
1564
|
-
nd cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await
|
|
1565
|
-
...t.baseEnv}:{...t.baseEnv},o=(f={})=>({...f,VIBE64_EXECUTION_ID:t.execution.id}),i=
|
|
1566
|
-
r),u=!(!!i||s||Us())&&Vt(r)?[n.PATH,process.env.PATH].filter(Boolean).join(":"):"",d=o(await
|
|
1564
|
+
signal:e.signal,timeout:e.timeout})}async function qt(e={}){let t=null;try{if(t=sm(e),t.signal?.aborted)return te("Comma\
|
|
1565
|
+
nd cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await Vf(t),n=t.inheritProcessEnv?{...process.env,
|
|
1566
|
+
...t.baseEnv}:{...t.baseEnv},o=(f={})=>({...f,VIBE64_EXECUTION_ID:t.execution.id}),i=ga(),s=po(n)||po(process.env),a=Jn(
|
|
1567
|
+
r),u=!(!!i||s||Us())&&Vt(r)?[n.PATH,process.env.PATH].filter(Boolean).join(":"):"",d=o(await kp({actor:r,baseEnv:n,localPath:u,
|
|
1567
1568
|
request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t})),p=Object.fromEntries([pt,ft,ht,mt].map(f=>[f,d[f]]));
|
|
1568
|
-
|
|
1569
|
-
args=="function"?t.args(f):t.args,l=(f={})=>o(t.envFactory?
|
|
1570
|
-
...t,env:t.envFactory(f),envFactory:null}}):d),w=(f=t,m={})=>
|
|
1571
|
-
if(i)return await i.runCommand(t,{actor:r,baseEnv:n,cwd:g,env:d,resolveArgs:h,resolveEnv:l,runLocal:w});let _=
|
|
1569
|
+
Gf(r,d);let g=rm(t.cwd,{allowedRoots:t.allowedRoots,resolveLinks:!t.applicationAccount});zf(r,t,g);let h=(f={})=>typeof t.
|
|
1570
|
+
args=="function"?t.args(f):t.args,l=(f={})=>o(t.envFactory?ea({actor:r,baseEnv:n,localPath:u,resolvedGitIdentityEnv:p,request:{
|
|
1571
|
+
...t,env:t.envFactory(f),envFactory:null}}):d),w=(f=t,m={})=>JI(f,{actor:r,cwd:g,env:d,requiresHelper:a,resolveEnv:l,...m});
|
|
1572
|
+
if(i)return await i.runCommand(t,{actor:r,baseEnv:n,cwd:g,env:d,resolveArgs:h,resolveEnv:l,runLocal:w});let _=fm(t);return _||
|
|
1572
1573
|
(s?te("Managed execution safety is unavailable. Vibe64 did not start this work.","vibe64_managed_execution_provider_unav\
|
|
1573
1574
|
ailable",{execution:t.execution,retryable:!1}):w())}catch(r){return te(r?.message||"Vibe64 command failed.",r?.code||"vi\
|
|
1574
|
-
be64_command_failed",{execution:t?.execution})}}var ho=b(()=>{
|
|
1575
|
-
|
|
1576
|
-
execution/src/server/gitTurnCheckpoint.js",import.meta.url).href,
|
|
1577
|
-
6e4,
|
|
1578
|
-
e||"").trim();return
|
|
1579
|
-
function
|
|
1580
|
-
r)&&
|
|
1581
|
-
"darwin"&&
|
|
1582
|
-
"brew"&&!o&&["git","cpp"].includes(
|
|
1583
|
-
if(!s&&i.mise&&(s=n?`mise use -g ${i.mise}`:`${
|
|
1584
|
-
"sudo ")||r==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?
|
|
1585
|
-
|
|
1575
|
+
be64_command_failed",{execution:t?.execution})}}var ho=b(()=>{Uf();ta();Ut();vr();Wn();Er();ma();nm();Kn();am();ut();mo();
|
|
1576
|
+
dm()});import{fileURLToPath as XI}from"node:url";var KI,XL,ZL,QL,eM,pm=b(()=>{Oe();KI=new URL("./../node_modules/@local/vibe64-\
|
|
1577
|
+
execution/src/server/gitTurnCheckpoint.js",import.meta.url).href,XL=XI(new URL("./gitTurnCheckpointCommand.js",KI)),ZL=15*
|
|
1578
|
+
6e4,QL=512*1024*1024,eM=1024*1024*1024});var nM,mm=b(()=>{K();nM=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"])});var hm=b(()=>{});import{existsSync as ZI}from"node:fs";import go from"node:path";import gm from"node:process";function ya(e=""){let t=String(
|
|
1579
|
+
e||"").trim();return eO[t]||t}function wm({platform:e=gm.platform,aptGet:t=!1}={}){return e==="darwin"?"brew":t?"apt":""}
|
|
1580
|
+
function tO(e,t=Nr){return[...String(e.PATH||"").split(go.delimiter),...String(t||"").split(go.delimiter)].some(r=>go.isAbsolute(
|
|
1581
|
+
r)&&ZI(go.join(r,"apt-get")))}function wo({env:e,platform:t=gm.platform,systemPath:r}){return wm({platform:t,aptGet:t!==
|
|
1582
|
+
"darwin"&&tO(e,r)})}function _o(e="",t={}){let{family:r="",mise:n=!1,xcode:o=!0}=t,i=yo[ya(e)];if(!i)return null;if(r===
|
|
1583
|
+
"brew"&&!o&&["git","cpp"].includes(ya(e)))return{command:"xcode-select --install",sudo:!1,note:""};let s=i.any||i[r]||"";
|
|
1584
|
+
if(!s&&i.mise&&(s=n?`mise use -g ${i.mise}`:`${QI} && ~/.local/bin/mise use -g ${i.mise}`),!s)return null;let a=s.startsWith(
|
|
1585
|
+
"sudo ")||r==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?ym:""}}var ym,QI,lM,yo,eO,dM,kr=b(()=>{oo();
|
|
1586
|
+
ym="You'll be asked for your computer password. Nothing shows while you type.",QI="curl -fsSL https://mise.run | sh",lM=
|
|
1586
1587
|
Object.freeze({linux:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-linux.md",darwin:"\
|
|
1587
1588
|
https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),yo=Object.freeze({claude:{
|
|
1588
1589
|
name:"Claude Code",run:[["claude"]],guideUrl:"https://code.claude.com/docs/en/setup",any:"curl -fsSL https://claude.ai/i\
|
|
@@ -1608,17 +1609,17 @@ rl -fsSL https://php.new/install/linux)"',brew:'/bin/bash -c "$(curl -fsSL https
|
|
|
1608
1609
|
ild tools",setup:"build-tools",run:[["cc","gcc","clang"],["make"]],guideUrl:"https://guides.rubyonrails.org/install_ruby\
|
|
1609
1610
|
_on_rails.html",detail:"Some packages compile native code, so they need a compiler and a few libraries.",apt:"sudo apt i\
|
|
1610
1611
|
nstall build-essential pkg-config libyaml-dev libssl-dev zlib1g-dev libpq-dev default-libmysqlclient-dev libgmp-dev",brew:"\
|
|
1611
|
-
brew install pkg-config libyaml openssl@3 gmp"}}),
|
|
1612
|
-
function
|
|
1613
|
-
`)}function
|
|
1612
|
+
brew install pkg-config libyaml openssl@3 gmp"}}),eO=Object.freeze({composer:"php"});dM=Object.freeze({SUDO_NOTE:ym,localToolFamily:wm})});function _m({env:e,platform:t,systemPath:r}){return _o("git",{family:wo({env:e,platform:t,systemPath:r})})?.command||""}
|
|
1613
|
+
function rO(e={}){return[e.error,e.stderr,e.output].filter(Boolean).join(`
|
|
1614
|
+
`)}function nO(e,t){let r=rO(e);if(/spawn(?:Sync)? git ENOENT|(?:^|\s)git: (?:command )?not found/mu.test(r)){let n=_m(t);
|
|
1614
1615
|
return{code:"vibe64_git_missing",installCommand:n,message:n?`Git isn't installed on this computer. Install it with: ${n}`:
|
|
1615
1616
|
"Git isn't installed on this computer. Install Git, then try again."}}return/unknown option [`']initial-branch/u.test(r)?
|
|
1616
|
-
{code:"vibe64_git_too_old",installCommand:
|
|
1617
|
+
{code:"vibe64_git_too_old",installCommand:_m(t),message:"This Git is too old for Vibe64. Update Git to version 2.28 or n\
|
|
1617
1618
|
ewer, then try again."}:/gpg failed to sign|failed to sign the data|signing failed|couldn't (?:load|find) (?:public )?key|incorrect passphrase/iu.
|
|
1618
1619
|
test(r)?{code:"vibe64_git_signing_failed",installCommand:"",message:"Your Git is set to sign every commit, and signing d\
|
|
1619
1620
|
idn't work here. Vibe64 can't type a key passphrase for you. Make one signed commit in a terminal to check your key work\
|
|
1620
|
-
s and is unlocked, then try again."}:null}var
|
|
1621
|
-
backups.git",
|
|
1621
|
+
s and is unlocked, then try again."}:null}var mM,bm=b(()=>{kr();mM=Object.freeze({describeGitFailure:nO})});var wa=b(()=>{});import Em from"node:path";function sO(e=""){return e?Em.join(Em.dirname(e),Sm):""}var Sm,vm,iO,_M,bM,Tm=b(()=>{wa();Sm="\
|
|
1622
|
+
backups.git",vm="vibe64-atomic",iO=`backup_canonical_ref() {
|
|
1622
1623
|
vibe64_backup_repository="$1"
|
|
1623
1624
|
vibe64_source_repository="$2"
|
|
1624
1625
|
vibe64_source_ref="$3"
|
|
@@ -1636,13 +1637,13 @@ r "$vibe64_backup_repository" rev-parse --verify "$vibe64_backup_ref"
|
|
|
1636
1637
|
' "$vibe64_source_ref" >&2
|
|
1637
1638
|
return 1
|
|
1638
1639
|
fi
|
|
1639
|
-
}`,
|
|
1640
|
+
}`,_M=`#!/bin/sh
|
|
1640
1641
|
set -eu
|
|
1641
1642
|
|
|
1642
1643
|
zero_object=0000000000000000000000000000000000000000
|
|
1643
1644
|
git_dir="$(git rev-parse --absolute-git-dir)"
|
|
1644
1645
|
repository_root="$(dirname "$git_dir")"
|
|
1645
|
-
backup_repository="$repository_root/${
|
|
1646
|
+
backup_repository="$repository_root/${Sm}"
|
|
1646
1647
|
if [ -L "$repository_root" ] || [ -L "$backup_repository" ] || [ -L "$repository_root/mutation.lock" ]; then
|
|
1647
1648
|
printf '[vibe64] Canonical repository storage must not use symlinked role paths.
|
|
1648
1649
|
' >&2
|
|
@@ -1651,7 +1652,7 @@ fi
|
|
|
1651
1652
|
exec 8>"$repository_root/mutation.lock"
|
|
1652
1653
|
flock -x 8
|
|
1653
1654
|
|
|
1654
|
-
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${
|
|
1655
|
+
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${vm}" ]; then
|
|
1655
1656
|
printf '[vibe64] Canonical repository pushes must use the Vibe64 atomic mutation path.
|
|
1656
1657
|
' >&2
|
|
1657
1658
|
exit 1
|
|
@@ -1662,7 +1663,7 @@ if [ "$(git --git-dir "$backup_repository" rev-parse --is-bare-repository 2>/dev
|
|
|
1662
1663
|
exit 1
|
|
1663
1664
|
fi
|
|
1664
1665
|
|
|
1665
|
-
${
|
|
1666
|
+
${iO}
|
|
1666
1667
|
|
|
1667
1668
|
updates_file="$(mktemp "$repository_root/.pre-receive.XXXXXX")"
|
|
1668
1669
|
cleanup_updates_file() {
|
|
@@ -1710,8 +1711,8 @@ while read -r old_object _new_object ref_name; do
|
|
|
1710
1711
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
1711
1712
|
fi
|
|
1712
1713
|
done <"$updates_file"
|
|
1713
|
-
`;
|
|
1714
|
-
wserWorkerSource.js",import.meta.url).href});var
|
|
1714
|
+
`;bM=Object.freeze({CANONICAL_REPOSITORY_PUSH_OPTION:vm,canonicalRepositoryBackupPath:sO})});var Im=b(()=>{Ar();Re()});var _a=b(()=>{});var Om=b(()=>{});var Rm=b(()=>{});var ba=b(()=>{});var NM,Am=b(()=>{Om();Rm();ba();NM=new URL("./../node_modules/@local/vibe64-execution/src/server/runtime/agentPreviewBro\
|
|
1715
|
+
wserWorkerSource.js",import.meta.url).href});var cO,Pm=b(()=>{cO=["Usage:"," vibe64-helper preview ensure [--target <target-id>] [--wait] [--json] [--timeout-ms <ms\
|
|
1715
1716
|
>]"," vibe64-helper preview targets [--json]"," vibe64-helper preview status [--json]"," vibe64-helper preview stop [\
|
|
1716
1717
|
--json]"," vibe64-helper preview open <path> [--json]"," vibe64-helper preview inspect-url"," vibe64-helper preview s\
|
|
1717
1718
|
creenshot [--output <path>]"," vibe64-helper preview browser ensure"," vibe64-helper preview browser eval < playwright\
|
|
@@ -1754,84 +1755,84 @@ ical preview server for the configured primary application.","Do not start a dup
|
|
|
1754
1755
|
er port.","A distinct secondary application explicitly requested by the user, such as a reference app, may run separatel\
|
|
1755
1756
|
y without replacing this preview."].join(`
|
|
1756
1757
|
`)+`
|
|
1757
|
-
`});var
|
|
1758
|
-
-execution/src/server/conversationExecution.js",import.meta.url).href,
|
|
1758
|
+
`});var Cm=b(()=>{});import{fileURLToPath as pO}from"node:url";var fO,zM,Nm=b(()=>{ho();mo();Oe();fO=new URL("./../node_modules/@local/vibe64\
|
|
1759
|
+
-execution/src/server/conversationExecution.js",import.meta.url).href,zM=pO(new URL("./engines/stdioBridge.js",fO))});var YM,jm=b(()=>{ho();kr();Re();YM=["skip=$1; version=$2; shift 2",'for name in "$@"; do',' found=$(command -v -- "$nam\
|
|
1759
1760
|
e" 2>/dev/null) || continue'," case $found in /*) ;; *) continue ;; esac",' if [ -n "$skip" ]; then case $found in /us\
|
|
1760
1761
|
r/bin/*) continue ;; esac; fi',` printf '%s\\n' "$found"`,' exec "$found" $version 2>&1',"done","exit 127"].join(`
|
|
1761
|
-
`)});var
|
|
1762
|
-
any:n}=yo[e];return[e,Object.freeze({name:t,guideUrl:r,install:n})]})))});import{execFile as
|
|
1763
|
-
|
|
1764
|
-
yr();le();U();
|
|
1765
|
-
projects.",
|
|
1766
|
-
practiceSlug:""}),
|
|
1767
|
-
freeze({vibe64_invalid_project_slug:422,vibe64_project_route_unavailable:404,[
|
|
1768
|
-
[
|
|
1769
|
-
function
|
|
1770
|
-
r,`${t}.1.jsonl`)})}function
|
|
1771
|
-
if(typeof e!="string")return;let t=$n(e).replace(/\s+/gu," ").trim();if(t)return t.length>
|
|
1772
|
-
t}function
|
|
1773
|
-
event:n},i=0;for(let[s,a]of Object.entries(e)){if(s==="kind"||s==="event"||s==="at"||!
|
|
1774
|
-
void 0&&(o[s]=c,++i>=
|
|
1775
|
-
`}function
|
|
1762
|
+
`)});var mO,xm=b(()=>{kr();Re();mO=Object.freeze(Object.fromEntries(["claude","codex","opencode"].map(e=>{let{name:t,guideUrl:r,
|
|
1763
|
+
any:n}=yo[e];return[e,Object.freeze({name:t,guideUrl:r,install:n})]})))});import{execFile as hO}from"node:child_process";import{promisify as gO}from"node:util";var tD,km=b(()=>{tD=gO(hO)});var Ea=b(()=>{zn();pf();Mt();Wn();Df();ho();vr();ut();mo();pm();ta();mm();hm();ro();Zs();Ut();bm();wa();Tm();K();Ar();Oe();
|
|
1764
|
+
Re();Im();_a();Am();ba();Pm();Cm();Nm();kr();jm();xm();km();_a()});var Sa=b(()=>{le()});import $m from"node:path";function _O(e=""){let t=St(e);return t?$m.join($m.resolve(t),yO,wO):""}var yO,wO,J4,Lm=b(()=>{
|
|
1765
|
+
yr();le();U();yO="runtime",wO="open.json";J4=Object.freeze({projectRuntimeOpenStatePath:_O})});var $r=b(()=>{Ea();le();$t();Sa();Vn();Un();Lm();Ue();Mn();Ve()});var Bm=b(()=>{le();$t();kt();Vn();Un();Ue();$r()});var Gm=b(()=>{le();kt();Ue();$r()});var qm=b(()=>{le();$t();kt();Sa();Vn();Un();Ue();$r()});var Wm=b(()=>{le();kt();Mn();Ue();$t();Bm();Gm();qm();$r()});var Ym=b(()=>{});var Jm,xO,kO,LV,MV,Km=b(()=>{Ym();Jm="vibe64_learning_mode_project",xO="You're in Learn mode. Press L to go back to your\
|
|
1766
|
+
projects.",kO="This is a practice project. Press L to switch to Learn.",LV=Object.freeze({on:!1,currentAttemptId:"",lessonCode:"",
|
|
1767
|
+
practiceSlug:""}),MV=Object.freeze({LEARNING_MODE_PROJECT_MESSAGE:xO,PRACTICE_PROJECT_MODE_MESSAGE:kO})});var Xm=b(()=>{});var Zm,Qm=b(()=>{Ve();Xm();Zm="vibe64_team_ai_required"});function eh(){return String(nf()?.projectRuntimeRoot||"").trim()}var nU,th=b(()=>{Wm();le();$t();Km();Qm();kt();nU=Object.
|
|
1768
|
+
freeze({vibe64_invalid_project_slug:422,vibe64_project_route_unavailable:404,[Jm]:403,[Zm]:403,vibe64_project_path_not_accessible:404,
|
|
1769
|
+
[af]:404,vibe64_project_path_not_directory:409,vibe64_project_path_symlink:409})});import{appendFile as $O,mkdir as LO,readdir as MO,rename as DO,stat as rh,unlink as VO}from"node:fs/promises";import Lr from"node:path";
|
|
1770
|
+
function Ia(e,t){let r=Lr.join(e,Ta);return Object.freeze({current:Lr.join(r,`${t}.jsonl`),directory:r,previous:Lr.join(
|
|
1771
|
+
r,`${t}.1.jsonl`)})}function va(e){if(typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;
|
|
1772
|
+
if(typeof e!="string")return;let t=$n(e).replace(/\s+/gu," ").trim();if(t)return t.length>nh?`${t.slice(0,nh-1)}\u2026`:
|
|
1773
|
+
t}function qO(e,t){let r=va(e?.kind),n=va(e?.event);if(!Mr.includes(r)||!n)return null;let o={at:t.toISOString(),kind:r,
|
|
1774
|
+
event:n},i=0;for(let[s,a]of Object.entries(e)){if(s==="kind"||s==="event"||s==="at"||!HO.test(s))continue;let c=va(a);if(c!==
|
|
1775
|
+
void 0&&(o[s]=c,++i>=GO))break}return`${JSON.stringify(o)}
|
|
1776
|
+
`}function WO({fileBytes:e=UO,retentionMs:t=BO,now:r=Date.now}={}){let n=new Map,o=new Map,i=new Set;function s(l,w){let _=`${l}\
|
|
1776
1777
|
|
|
1777
|
-
${w}`,f=n.get(_);if(f?n.delete(_):f={paths:
|
|
1778
|
-
n.set(_,f),n.size>
|
|
1779
|
-
t,_=await
|
|
1780
|
-
if(!m.endsWith(".jsonl"))continue;let y=Lr.join(l,m),E=f.get(y),T=await
|
|
1781
|
-
E?.pending||(await
|
|
1778
|
+
${w}`,f=n.get(_);if(f?n.delete(_):f={paths:Ia(l,w),projectRuntimeRoot:l,sessionId:w,lines:[],queuedLength:0,size:null,pending:null},
|
|
1779
|
+
n.set(_,f),n.size>oh)for(let[m,y]of n){if(n.size<=oh)break;y.pending||n.delete(m)}return f}async function a(l){let w=r()-
|
|
1780
|
+
t,_=await MO(l).catch(()=>[]),f=new Map;for(let m of n.values())f.set(m.paths.current,m),f.set(m.paths.previous,m);for(let m of _){
|
|
1781
|
+
if(!m.endsWith(".jsonl"))continue;let y=Lr.join(l,m),E=f.get(y),T=await rh(y).catch(()=>null);!T?.isFile()||T.mtimeMs>=w||
|
|
1782
|
+
E?.pending||(await VO(y).catch(()=>{}),E&&(E.size=null))}}function c(l){let w=o.get(l)||0;if(r()-w<zO)return;o.set(l,r());
|
|
1782
1783
|
let _=a(l).finally(()=>i.delete(_));i.add(_)}async function u(l){let{lines:w}=l;if(l.lines=[],l.queuedLength=0,!w.length)
|
|
1783
1784
|
return;let _=w.join(""),f=Buffer.byteLength(_);if(f>e){let m=w.length-1,y=Buffer.byteLength(w[m]);for(;m>0&&y+Buffer.byteLength(
|
|
1784
|
-
w[m-1])<=e;)y+=Buffer.byteLength(w[--m]);_=w.slice(m).join(""),f=y}try{l.size===null&&(await
|
|
1785
|
-
mode:448}),l.size=(await
|
|
1786
|
-
l.paths.current,l.paths.previous).catch(m=>{if(m?.code!=="ENOENT")throw m}),l.size=0),await
|
|
1785
|
+
w[m-1])<=e;)y+=Buffer.byteLength(w[--m]);_=w.slice(m).join(""),f=y}try{l.size===null&&(await LO(l.paths.directory,{recursive:!0,
|
|
1786
|
+
mode:448}),l.size=(await rh(l.paths.current).catch(()=>null))?.size||0),c(l.paths.directory),l.size>0&&l.size+f>e&&(await DO(
|
|
1787
|
+
l.paths.current,l.paths.previous).catch(m=>{if(m?.code!=="ENOENT")throw m}),l.size=0),await $O(l.paths.current,_,{encoding:"\
|
|
1787
1788
|
utf8",mode:384}),l.size+=f}catch{l.size=null}}function d(l){l.pending||(l.pending=new Promise(w=>{setImmediate(()=>{u(l).
|
|
1788
1789
|
finally(()=>{l.pending=null,l.lines.length&&d(l),w()})})}))}function p(l,w,_={}){try{let f=String(_.projectRuntimeRoot??
|
|
1789
|
-
|
|
1790
|
+
eh()??"").trim(),m=String(l||"").trim();if(!Lr.isAbsolute(f)||!FO.test(m))return!1;let y=qO(w,new Date(r()));if(!y)return!1;
|
|
1790
1791
|
let E=s(f,m);if(E.lines.push(y),E.queuedLength+=y.length,E.queuedLength>2*e){let T=0;for(;E.queuedLength>e&&T<E.lines.length-
|
|
1791
1792
|
1;)E.queuedLength-=E.lines[T++].length;E.lines.splice(0,T)}return d(E),!0}catch{return!1}}function g(l){let w=0;for(let _ of[
|
|
1792
1793
|
...n.values()])p(_.sessionId,l,{projectRuntimeRoot:_.projectRuntimeRoot})&&(w+=1);return w}async function h(){for(;i.size||
|
|
1793
1794
|
[...n.values()].some(l=>l.pending);)await Promise.all([...i,...[...n.values()].map(l=>l.pending)])}return Object.freeze(
|
|
1794
|
-
{flush:h,record:p,recordForActiveSessions:g})}var
|
|
1795
|
-
1024*1024,
|
|
1796
|
-
1e3,
|
|
1797
|
-
import{readdir as
|
|
1798
|
-
import{parseArgs as
|
|
1799
|
-
round(t/60);return r<120?`${r} min`:`${Math.round(r/60)} h`}function
|
|
1800
|
-
method||""} ${e.route||""}`.trim()),e.chat||e.conversation){let n=
|
|
1801
|
-
`${n} ${e.conversation}`:n)}for(let[n,o]of
|
|
1802
|
-
entries(e))
|
|
1803
|
-
length?` (${t.join("; ")})`:""}`}function Dr(e){return Object.assign(new Error(e),{usage:!0})}function
|
|
1804
|
-
void 0)return null;let n=
|
|
1805
|
-
isNaN(o))throw Dr(`${r} needs an ISO time or a time back from now such as 30m: ${e}`);return o}function
|
|
1795
|
+
{flush:h,record:p,recordForActiveSessions:g})}var Ta,UO,BO,Mr,zO,nh,GO,oh,FO,HO,uU,ih=b(()=>{tf();th();Ta="timeline",UO=
|
|
1796
|
+
1024*1024,BO=336*60*60*1e3,Mr=Object.freeze(["turn","conversation","process","connection","request","server"]),zO=1440*60*
|
|
1797
|
+
1e3,nh=200,GO=24,oh=256,FO=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u,HO=/^[a-z][A-Za-z0-9]{0,39}$/u;uU=WO()});var ph={};zo(ph,{describeTimelineEvent:()=>dh,listSessionTimelines:()=>Oa,readSessionTimeline:()=>fh,runSessionTimelineCli:()=>cR});
|
|
1798
|
+
import{readdir as YO,readFile as JO,stat as KO}from"node:fs/promises";import Eo from"node:path";import sh from"node:process";
|
|
1799
|
+
import{parseArgs as XO}from"node:util";function rR(e){let t=Math.round(Number(e)/1e3);if(t<120)return`${t} s`;let r=Math.
|
|
1800
|
+
round(t/60);return r<120?`${r} min`:`${Math.round(r/60)} h`}function dh(e){let t=[];if((e.method||e.route)&&t.push(`${e.
|
|
1801
|
+
method||""} ${e.route||""}`.trim()),e.chat||e.conversation){let n=tR[e.chat]||e.chat||"conversation";t.push(e.conversation?
|
|
1802
|
+
`${n} ${e.conversation}`:n)}for(let[n,o]of lh){let i=e[n]===void 0||e[n]===""?"":o(e[n]);i&&t.push(i)}for(let[n,o]of Object.
|
|
1803
|
+
entries(e))nR.has(n)||t.push(`${n}=${o}`);let r=eR[`${e.kind}.${e.event}`]||`${e.kind} ${e.event}`;return`${e.at} ${r}${t.
|
|
1804
|
+
length?` (${t.join("; ")})`:""}`}function Dr(e){return Object.assign(new Error(e),{usage:!0})}function ch(e,t,r){if(e===
|
|
1805
|
+
void 0)return null;let n=ZO.exec(String(e).trim());if(n)return t-Number(n[1])*QO[n[2]];let o=Date.parse(String(e));if(Number.
|
|
1806
|
+
isNaN(o))throw Dr(`${r} needs an ISO time or a time back from now such as 30m: ${e}`);return o}function oR(e){if(e===void 0)
|
|
1806
1807
|
return null;let t=String(e).split(",").map(n=>n.trim()).filter(Boolean),r=t.filter(n=>!Mr.includes(n));if(!t.length||r.length)
|
|
1807
|
-
throw Dr(`--kind takes ${Mr.join(", ")}; not ${r.join(", ")||"nothing"}.`);return new Set(t)}function
|
|
1808
|
-
let n;try{n=
|
|
1808
|
+
throw Dr(`--kind takes ${Mr.join(", ")}; not ${r.join(", ")||"nothing"}.`);return new Set(t)}function iR(e,{env:t,now:r}){
|
|
1809
|
+
let n;try{n=XO({args:e,allowPositionals:!0,options:{help:{type:"boolean"},json:{type:"boolean"},kind:{type:"string"},project:{
|
|
1809
1810
|
type:"string"},since:{type:"string"},"state-root":{type:"string"},until:{type:"string"}}})}catch(c){throw Dr(c.message)}
|
|
1810
|
-
let{positionals:o,values:i}=n;if(o.length>1)throw Dr("Name one session at most.");let s=o[0]||"";if(s&&!
|
|
1811
|
-
`Not a session id: ${s}`);let a=String(i["state-root"]||t[Es]||"").trim()||
|
|
1812
|
-
!0,json:i.json===!0,kinds:
|
|
1813
|
-
resolve(a),until:
|
|
1814
|
-
|
|
1811
|
+
let{positionals:o,values:i}=n;if(o.length>1)throw Dr("Name one session at most.");let s=o[0]||"";if(s&&!uh.test(s))throw Dr(
|
|
1812
|
+
`Not a session id: ${s}`);let a=String(i["state-root"]||t[Es]||"").trim()||sf({env:t});return Object.freeze({help:i.help===
|
|
1813
|
+
!0,json:i.json===!0,kinds:oR(i.kind),project:String(i.project||"").trim(),sessionId:s,since:ch(i.since,r,"--since"),stateRoot:Eo.
|
|
1814
|
+
resolve(a),until:ch(i.until,r,"--until")})}async function Oa(e){let t=new Map;for(let r of await Ii(e)){let n=Eo.join(r,
|
|
1815
|
+
Ta);for(let o of await YO(n).catch(()=>[])){let i=o.replace(/(\.1)?\.jsonl$/u,"");if(i===o||!uh.test(i))continue;let s=await KO(
|
|
1815
1816
|
Eo.join(n,o)).catch(()=>null);if(!s?.isFile())continue;let a=`${r}
|
|
1816
1817
|
${i}`,c=t.get(a)||{project:Eo.basename(r),projectRuntimeRoot:r,sessionId:i,bytes:0,updatedMs:0};c.bytes+=s.size,c.updatedMs=
|
|
1817
|
-
Math.max(c.updatedMs,s.mtimeMs),t.set(a,c)}}return[...t.values()].sort((r,n)=>n.updatedMs-r.updatedMs)}async function
|
|
1818
|
-
since:r=null,until:n=null,kinds:o=null}={}){let i=
|
|
1818
|
+
Math.max(c.updatedMs,s.mtimeMs),t.set(a,c)}}return[...t.values()].sort((r,n)=>n.updatedMs-r.updatedMs)}async function fh(e,t,{
|
|
1819
|
+
since:r=null,until:n=null,kinds:o=null}={}){let i=Ia(e,t),s=[];for(let a of[i.previous,i.current]){let c=await JO(a,"utf\
|
|
1819
1820
|
8").catch(u=>{if(u?.code==="ENOENT")return"";throw u});for(let u of c.split(`
|
|
1820
1821
|
`)){if(!u.trim())continue;let d;try{d=JSON.parse(u)}catch{continue}let p=Date.parse(d?.at);Number.isNaN(p)||r!==null&&p<
|
|
1821
1822
|
r||n!==null&&p>=n||o&&!o.has(d.kind)||s.push(d)}}return s}function Je(e,t){e.write(`${t}
|
|
1822
|
-
`)}async function
|
|
1823
|
+
`)}async function sR(e,t){let n=(await Oa(e.stateRoot)).filter(o=>!e.project||o.project===e.project);for(let o of n){let i=new Date(
|
|
1823
1824
|
o.updatedMs).toISOString();e.json?Je(t,JSON.stringify({project:o.project,session:o.sessionId,bytes:o.bytes,updatedAt:i})):
|
|
1824
1825
|
Je(t,`${i} ${o.project} ${o.sessionId} ${Math.ceil(o.bytes/1024)} KB`)}return!n.length&&!e.json&&Je(t,`No session time\
|
|
1825
|
-
lines under ${e.stateRoot}.`),0}async function
|
|
1826
|
+
lines under ${e.stateRoot}.`),0}async function aR(e,t,r){let n=(await Oa(e.stateRoot)).filter(a=>a.sessionId===e.sessionId&&
|
|
1826
1827
|
(!e.project||a.project===e.project));if(n.length!==1)return Je(r,n.length?`Session ${e.sessionId} is in several projects\
|
|
1827
1828
|
(${n.map(({project:a})=>a).join(", ")}); add --project NAME.`:`No timeline for session ${e.sessionId} under ${e.stateRoot}\
|
|
1828
|
-
. Run vibe64 timeline to list them.`),1;let[{project:o,projectRuntimeRoot:i}]=n,s=await
|
|
1829
|
-
Je(t,e.json?JSON.stringify({project:o,session:e.sessionId,...a}):
|
|
1830
|
-
t window."),0}async function
|
|
1829
|
+
. Run vibe64 timeline to list them.`),1;let[{project:o,projectRuntimeRoot:i}]=n,s=await fh(i,e.sessionId,e);for(let a of s)
|
|
1830
|
+
Je(t,e.json?JSON.stringify({project:o,session:e.sessionId,...a}):dh(a));return!s.length&&!e.json&&Je(t,"No events in tha\
|
|
1831
|
+
t window."),0}async function cR(e,{env:t,stdout:r=sh.stdout,stderr:n=sh.stderr,now:o=Date.now()}){let i;try{i=iR(e,{env:t,
|
|
1831
1832
|
now:o})}catch(s){return Je(n,`${s.message}
|
|
1832
1833
|
|
|
1833
|
-
${
|
|
1834
|
-
64 timeline could not read ${i.stateRoot}: ${s.message}`),1}}var
|
|
1834
|
+
${ah}`),2}if(i.help)return r.write(ah),0;try{return i.sessionId?await aR(i,r,n):await sR(i,r)}catch(s){return Je(n,`vibe\
|
|
1835
|
+
64 timeline could not read ${i.stateRoot}: ${s.message}`),1}}var ah,uh,ZO,QO,eR,tR,lh,nR,mh=b(()=>{Ue();ih();Mn();ah=`Us\
|
|
1835
1836
|
age: vibe64 timeline [SESSION] [options]
|
|
1836
1837
|
|
|
1837
1838
|
Without SESSION, lists the sessions that have a timeline, most recent first.
|
|
@@ -1848,8 +1849,8 @@ Options:
|
|
|
1848
1849
|
this user's own, such as ~/.local/state/vibe64)
|
|
1849
1850
|
--json one JSON object per line, for tools
|
|
1850
1851
|
--help show this help
|
|
1851
|
-
`,
|
|
1852
|
-
|
|
1852
|
+
`,uh=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u,ZO=/^(\d+(?:\.\d+)?)(s|m|h|d)$/u,QO=Object.freeze({s:1e3,m:6e4,h:36e5,d:864e5}),
|
|
1853
|
+
eR=Object.freeze({"turn.started":"Turn started","turn.steered":"Message added to the running turn","turn.refused":"Messa\
|
|
1853
1854
|
ge not sent","turn.running":"Turn running","turn.finished":"Turn finished","turn.failed":"Turn failed","turn.interrupted":"\
|
|
1854
1855
|
Turn interrupted","turn.cancelled":"Turn cancelled","turn.timed-out":"Turn stopped at its deadline","turn.observation-lo\
|
|
1855
1856
|
st":"Vibe64 lost sight of the turn","turn.ended":"Turn ended","turn.cancel-requested":"Cancel requested","turn.stop-requ\
|
|
@@ -1859,27 +1860,27 @@ sk-started":"AI task started","conversation.task-closed":"AI task closed","proce
|
|
|
1859
1860
|
"process.start-failed":"AI engine process could not start","process.exited":"AI engine process exited","process.stopped":"\
|
|
1860
1861
|
AI engine process stopped by Vibe64","connection.connected":"Browser tab connected","connection.reconnected":"Browser ta\
|
|
1861
1862
|
b reconnected","connection.disconnected":"Browser tab disconnected","connection.left":"Browser tab left the session","re\
|
|
1862
|
-
quest.failed":"Request failed","server.stopping":"Vibe64 server stopping"}),
|
|
1863
|
-
colleague:"Colleague",main:"Main chat",temporary:"temporary chat"});
|
|
1863
|
+
quest.failed":"Request failed","server.stopping":"Vibe64 server stopping"}),tR=Object.freeze({"ai-task":"AI task window",
|
|
1864
|
+
colleague:"Colleague",main:"Main chat",temporary:"temporary chat"});lh=Object.freeze([["engine",e=>`engine ${e}`],["turn",
|
|
1864
1865
|
e=>`turn ${e}`],["thread",e=>`thread ${e}`],["message",e=>`message ${e}`],["operation",e=>`${e}`],["execution",e=>`proce\
|
|
1865
1866
|
ss ${e}`],["pid",e=>`pid ${e}`],["exitCode",e=>`exit code ${e}`],["signal",e=>`signal ${e}`],["taskLimit",e=>e?"it reach\
|
|
1866
|
-
ed its task limit":""],["tab",e=>`tab ${e}`],["user",e=>`user ${e}`],["by",e=>`asked by ${e}`],["offlineMs",e=>`after ${
|
|
1867
|
+
ed its task limit":""],["tab",e=>`tab ${e}`],["user",e=>`user ${e}`],["by",e=>`asked by ${e}`],["offlineMs",e=>`after ${rR(
|
|
1867
1868
|
e)} offline`],["reason",e=>`reason: ${e}`],["status",e=>`status ${e}`],["state",e=>`state ${e}`],["ok",e=>e===!1?"it did\
|
|
1868
|
-
not succeed":""],["code",e=>`code ${e}`],["error",e=>`error: ${e}`],["trigger",e=>`via ${e}`]]),
|
|
1869
|
-
"event","chat","conversation","method","route","project","session",...
|
|
1869
|
+
not succeed":""],["code",e=>`code ${e}`],["error",e=>`error: ${e}`],["trigger",e=>`via ${e}`]]),nR=new Set(["at","kind",
|
|
1870
|
+
"event","chat","conversation","method","route","project","session",...lh.map(([e])=>e)])});function So(e){return!!e&&typeof e=="object"&&fR.every(t=>typeof e[t]=="function")}function gh(e=null,{defaultMode:t="cr\
|
|
1870
1871
|
eate",context:r="schema definition.mode"}={}){let n=ue(e),o=F(t).toLowerCase()||"create",i=Object.prototype.hasOwnProperty.
|
|
1871
|
-
call(n,"mode")?F(n.mode).toLowerCase():"";if(!i)return o;if(!
|
|
1872
|
-
replace, patch.`);return i}function
|
|
1873
|
-
getFieldMessages(r)):{}}function
|
|
1874
|
-
e,r.join(".")))}function
|
|
1872
|
+
call(n,"mode")?F(n.mode).toLowerCase():"";if(!i)return o;if(!uR.has(i))throw new TypeError(`${r} must be one of: create,\
|
|
1873
|
+
replace, patch.`);return i}function yh(e=null,t=""){let r=F(t);if(!r)return{};let n=ue(e);return So(n.schema)?ue(n.schema.
|
|
1874
|
+
getFieldMessages(r)):{}}function pR(e=null,t=""){let r=F(t).split(".").filter(Boolean);return r.length<2?{}:(r.pop(),yh(
|
|
1875
|
+
e,r.join(".")))}function hh(e,t){let r=t?e[t]:void 0;if(typeof r=="string"){let i=F(r);return i?{message:i}:null}if(!H(r))
|
|
1875
1876
|
return null;let n=F(r.message);if(!n)return null;let o=F(r.code);return o?{message:n,code:o,params:ue(r.params)}:{message:n}}
|
|
1876
|
-
function
|
|
1877
|
-
Object.keys(s).length<1?
|
|
1877
|
+
function mR(e,t,r=null){let n=F(t?.code).toUpperCase(),o=lR[n]||{},i=ue(t?.params),s=yh(r,e),a=n==="FIELD_NOT_ALLOWED"&&
|
|
1878
|
+
Object.keys(s).length<1?pR(r,e):s,c=hh(a,o.messageKey)||hh(a,"default");if(c)return c.code?{message:c.message,code:c.code,
|
|
1878
1879
|
params:{...i,...c.params}}:{message:c.message};let u=F(t?.message);if(u)return o.code?{message:u,code:o.code,params:i}:{
|
|
1879
|
-
message:u};let d=F(t?.code);return d?{message:d}:{...
|
|
1880
|
-
i,s]of Object.entries(r)){let a=F(i);if(!a)continue;if(typeof s=="string"){n[a]=s;continue}let{message:c,code:u,params:d}=
|
|
1881
|
-
a,s,t);n[a]=c,u&&(o[a]={code:u,params:d})}return{fieldErrors:n,fieldErrorCodes:o}}var
|
|
1882
|
-
["create","replace","patch"]),
|
|
1880
|
+
message:u};let d=F(t?.code);return d?{message:d}:{...dR,params:{}}}function Ra(e={},t=null){let r=ue(e),n={},o={};for(let[
|
|
1881
|
+
i,s]of Object.entries(r)){let a=F(i);if(!a)continue;if(typeof s=="string"){n[a]=s;continue}let{message:c,code:u,params:d}=mR(
|
|
1882
|
+
a,s,t);n[a]=c,u&&(o[a]={code:u,params:d})}return{fieldErrors:n,fieldErrorCodes:o}}var uR,lR,dR,fR,Aa=b(()=>{U();uR=new Set(
|
|
1883
|
+
["create","replace","patch"]),lR=Object.freeze({REQUIRED:{messageKey:"required",code:"kernel.validation.field.required"},
|
|
1883
1884
|
TYPE_CAST_FAILED:{messageKey:"default",code:"kernel.validation.field.typeCastFailed"},NOT_NULLABLE:{messageKey:"default",
|
|
1884
1885
|
code:"kernel.validation.field.notNullable"},MIN_LENGTH:{messageKey:"minLength",code:"kernel.validation.field.minLength"},
|
|
1885
1886
|
MAX_LENGTH:{messageKey:"maxLength",code:"kernel.validation.field.maxLength"},MIN_ITEMS:{messageKey:"minItems",code:"kern\
|
|
@@ -1889,23 +1890,23 @@ messageKey:"pattern",code:"kernel.validation.field.pattern"},ENUM_VALUE:{message
|
|
|
1889
1890
|
.enumValue"},FIELD_NOT_ALLOWED:{messageKey:"additionalProperties",code:"kernel.validation.field.notAllowed"},CUSTOM_VALIDATOR_FAILED:{
|
|
1890
1891
|
messageKey:"validator",code:""},STRICT_BOOLEAN:{messageKey:"default",code:"kernel.validation.field.strictBoolean"},RANGE_EXCEEDED:{
|
|
1891
1892
|
messageKey:"default",code:"kernel.validation.field.rangeExceeded"},NOT_EMPTY:{messageKey:"default",code:"kernel.validati\
|
|
1892
|
-
on.field.notEmpty"}}),
|
|
1893
|
-
reate","replace","patch","toJsonSchema"])});function
|
|
1893
|
+
on.field.notEmpty"}}),dR=Object.freeze({code:"kernel.validation.invalid",message:"Invalid value."}),fR=Object.freeze(["c\
|
|
1894
|
+
reate","replace","patch","toJsonSchema"])});function hR(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&(Object.prototype.hasOwnProperty.call(e,"schema")||Object.
|
|
1894
1895
|
prototype.hasOwnProperty.call(e,"mode"))}function vo(e,{context:t="schema definition",defaultMode:r=""}={}){if(e==null)return null;
|
|
1895
|
-
if(!
|
|
1896
|
+
if(!hR(e))throw new TypeError(`${t} must be a schema definition object.`);let n=ue(e);if(!Object.prototype.hasOwnProperty.
|
|
1896
1897
|
call(n,"schema"))throw new TypeError(`${t}.schema is required.`);if(!So(n.schema))throw new TypeError(`${t}.schema must \
|
|
1897
|
-
be a json-rest-schema schema instance.`);let o={schema:n.schema},i=F(r).toLowerCase();return o.mode=
|
|
1898
|
-
"patch",context:`${t}.mode`}),Object.freeze(o)}function
|
|
1899
|
-
e,{context:r,defaultMode:n});return o?o.schema[o.mode](t):null}var Vr=b(()=>{U();
|
|
1900
|
-
freeze({schema:
|
|
1901
|
-
|
|
1902
|
-
e,o?{cause:o}:void 0);if(e===
|
|
1898
|
+
be a json-rest-schema schema instance.`);let o={schema:n.schema},i=F(r).toLowerCase();return o.mode=gh(n,{defaultMode:i||
|
|
1899
|
+
"patch",context:`${t}.mode`}),Object.freeze(o)}function Pa(e,t,{context:r="schema definition",defaultMode:n=""}={}){let o=vo(
|
|
1900
|
+
e,{context:r,defaultMode:n});return o?o.schema[o.mode](t):null}var Vr=b(()=>{U();Aa()});var wh=b(()=>{rt();U();Ir();Vr()});var _h=b(()=>{rt();Ir();Vr()});var gR,yR,bh=b(()=>{rt();gR=L({cursor:{type:"id",required:!1},limit:{type:"number",required:!1,min:1,unsigned:!0}}),yR=Object.
|
|
1901
|
+
freeze({schema:gR,mode:"patch"})});var Eh,wR,Sh=b(()=>{Eh=Object.freeze({type:"string",pattern:"^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$",minLength:5}),
|
|
1902
|
+
wR=Object.freeze({...Eh,nullable:!0})});var vh=b(()=>{U()});function Ih({message:e=Th,fieldErrors:t=null,fieldErrorCodes:r=null,errors:n=null,cause:o,statusCode:i=null}={}){let s=new Error(
|
|
1903
|
+
e,o?{cause:o}:void 0);if(e===Th&&(s.messageCode="kernel.validation.schemaFailed",s.messageParams={}),Number.isInteger(i)&&
|
|
1903
1904
|
i>=400&&i<=599&&(s.statusCode=i),H(t)){let a=H(r)&&Object.keys(r).length>0?r:null;s.fieldErrors=t,a&&(s.fieldErrorCodes=
|
|
1904
1905
|
a),s.details={...s.details||{},fieldErrors:t,...a?{fieldErrorCodes:a}:{}}}else n!=null&&(s.details={...s.details||{},errors:n});
|
|
1905
|
-
return s}function
|
|
1906
|
-
e,t,{defaultMode:r==="output"?"replace":"patch",context:n}),{fieldErrors:s,fieldErrorCodes:a}=
|
|
1907
|
-
s).length>0)throw
|
|
1908
|
-
|
|
1906
|
+
return s}function Ca(e,t,{phase:r="input",context:n="schema definition",statusCode:o=null}={}){if(e==null)return t;let i=Pa(
|
|
1907
|
+
e,t,{defaultMode:r==="output"?"replace":"patch",context:n}),{fieldErrors:s,fieldErrorCodes:a}=Ra(i.errors,e);if(Object.keys(
|
|
1908
|
+
s).length>0)throw Ih({fieldErrors:s,fieldErrorCodes:a,statusCode:o});return i.validatedObject??t}var Th,Oh=b(()=>{U();Vr();
|
|
1909
|
+
Th="Schema validation failed."});var zU,Rh=b(()=>{U();zU=new Map([{keyword:"required",code:"kernel.validation.required"},{keyword:"type",code:"kernel.val\
|
|
1909
1910
|
idation.type"},{keyword:"minLength",code:"kernel.validation.minLength"},{keyword:"maxLength",code:"kernel.validation.max\
|
|
1910
1911
|
Length"},{keyword:"minimum",code:"kernel.validation.minimum"},{keyword:"maximum",code:"kernel.validation.maximum"},{keyword:"\
|
|
1911
1912
|
exclusiveMinimum",code:"kernel.validation.exclusiveMinimum"},{keyword:"exclusiveMaximum",code:"kernel.validation.exclusi\
|
|
@@ -1917,146 +1918,146 @@ tion.maxItems"},{keyword:"additionalItems",code:"kernel.validation.additionalIte
|
|
|
1917
1918
|
kernel.validation.maxProperties"},{keyword:"additionalProperties",code:"kernel.validation.additionalProperties"},{keyword:"\
|
|
1918
1919
|
propertyNames",code:"kernel.validation.propertyNames"},{keyword:"oneOf",code:"kernel.validation.oneOf"},{keyword:"anyOf",
|
|
1919
1920
|
code:"kernel.validation.anyOf"},{keyword:"not",code:"kernel.validation.not"},{keyword:"if",code:"kernel.validation.if"}].
|
|
1920
|
-
map(({keyword:e,code:t})=>[e,t]))});var
|
|
1921
|
-
|
|
1922
|
-
id must be a canonical positive integer string."}}}}),mode:"patch"})});var
|
|
1923
|
-
let n=
|
|
1924
|
-
s.`);return n}var k,B,W,Io,
|
|
1921
|
+
map(({keyword:e,code:t})=>[e,t]))});var Ah,Na,_R,bR,Ph=b(()=>{rt();Ir();Ah="^[1-9][0-9]*$",Na=Ge({type:"string",minLength:1,pattern:Ah}),_R=Ge({...Na,nullable:!0}),
|
|
1922
|
+
bR=Ge({schema:L({recordId:{...Na,required:!0,messages:{pattern:{code:"kernel.validation.recordIdInvalid",message:"Record\
|
|
1923
|
+
id must be a canonical positive integer string."}}}}),mode:"patch"})});var Ch=b(()=>{U()});var To=b(()=>{rt();Go();wh();_h();bh();Sh();vh();Aa();Vr();Oh();Rh();Ph();Ch()});import{isDeepStrictEqual as ER}from"node:util";function Oo(e,t){let r=RR.get(e?.schemaVersion)||jh;return _e(r,e,t)}function _e(e,t,r){
|
|
1924
|
+
let n=Ca({schema:e,mode:"create"},t,{context:r});if(!ER(t,n))throw new Error(`${r}: unknown fields or noncanonical value\
|
|
1925
|
+
s.`);return n}var k,B,W,Io,SR,vR,Nh,jh,TR,xh,IR,OR,RR,Pe,Ro,Ao,kh,Wt=b(()=>{To();k={type:"string",required:!0,noTrim:!0,
|
|
1925
1926
|
minLength:1,maxLength:256},B={...k,maxLength:64},W=(e,t=100)=>({type:"array",required:!0,maxLength:t,items:e,validator:r=>Array.
|
|
1926
|
-
isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),Io={type:"integer",required:!0,enum:[1]},
|
|
1927
|
-
24),
|
|
1927
|
+
isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),Io={type:"integer",required:!0,enum:[1]},SR=W(L({code:B}),
|
|
1928
|
+
24),vR=L({id:B,kind:{...k,enum:["answer","practical"]},required:{type:"boolean",required:!0},rubric:k,evidence:{type:"ob\
|
|
1928
1929
|
ject",required:!1,schema:L({producer:{...k,enum:["workspace","colleague","exercise","code"]},operation:B,check:{...B,required:!1},
|
|
1929
|
-
explanationRequired:{type:"boolean",required:!1},files:{...W(k,8),required:!1,minLength:1}})}}),
|
|
1930
|
+
explanationRequired:{type:"boolean",required:!1},files:{...W(k,8),required:!1,minLength:1}})}}),Nh={code:B,title:k,prerequisites:SR,
|
|
1930
1931
|
estimatedMinutes:{type:"integer",required:!0,min:1,max:180},visuals:W(L({id:B,descriptor:k}),12),exercise:{type:"object",
|
|
1931
1932
|
required:!1,schema:L({kind:{...k,enum:["bundled"]},source:k,reuse:{...k,enum:["attempt","sequence"]},sequenceId:{...B,required:!1},
|
|
1932
1933
|
sequenceMode:{...k,required:!1,enum:["create","continue"]}})},checks:{...W(L({id:B,file:k,assets:{...W(k,32),required:!1},
|
|
1933
1934
|
kind:{...k,required:!1,enum:["response","code"]},timeoutSeconds:{type:"integer",required:!1,min:1,max:60}}),12),required:!1},
|
|
1934
1935
|
appRoutes:{...W(L({method:{...k,enum:["POST","PUT","PATCH","DELETE"]},path:{...k,maxLength:128,pattern:"^/[A-Za-z0-9._~:\
|
|
1935
|
-
/-]*$"}}),16),required:!1}},
|
|
1936
|
+
/-]*$"}}),16),required:!1}},jh=L({schemaVersion:Io,...Nh,document:k,assessments:W(vR,32)}),TR=L({id:B,title:k,body:k,required:{
|
|
1936
1937
|
type:"boolean",required:!0},visual:{type:"object",required:!1,schema:L({id:B,play:{...W(L({name:B,parameters:{type:"obje\
|
|
1937
1938
|
ct",required:!0}}),16),required:!1}})},guide:{type:"object",required:!1,schema:L({target:B,navigate:{type:"boolean",required:!1},
|
|
1938
1939
|
filePath:{...k,required:!1,maxLength:512},caption:{...k,required:!1}})},check:{type:"object",required:!0,schema:L({kind:{
|
|
1939
1940
|
...k,enum:["auto","choice","review","self","fact","none"]},check:{...B,required:!1},fact:{...B,required:!1},files:{...W(
|
|
1940
1941
|
k,8),required:!1},question:{...k,required:!1,maxLength:2e3},options:{...W(k,8),required:!1},answer:{...W({type:"integer",
|
|
1941
1942
|
required:!0,min:0,max:7},8),required:!1},rubric:{...k,required:!1,maxLength:600},evidence:{...W({...k,enum:["changes","c\
|
|
1942
|
-
onversation"]},2),required:!1}})}}),
|
|
1943
|
-
r",required:!0,enum:[2]},...
|
|
1944
|
-
io","project"]}}),
|
|
1943
|
+
onversation"]},2),required:!1}})}}),xh={...Nh,notes:{...k,required:!1},steps:W(TR,32)},IR=L({schemaVersion:{type:"intege\
|
|
1944
|
+
r",required:!0,enum:[2]},...xh}),OR=L({schemaVersion:{type:"integer",required:!0,enum:[3]},...xh,stage:{...k,enum:["stud\
|
|
1945
|
+
io","project"]}}),RR=new Map([[1,jh],[2,IR],[3,OR]]),Pe=e=>e?.schemaVersion===2||e?.schemaVersion===3;Ro=L({schemaVersion:Io,
|
|
1945
1946
|
topicId:B,domainId:B,title:k,status:{...k,enum:["preview","released"]},outline:k,prerequisites:W(L({topicId:B}),24),lessons:W(
|
|
1946
1947
|
L({code:B,descriptor:k,status:{...k,enum:["draft","published"]},required:{type:"boolean",required:!0}}),64),places:{...W(
|
|
1947
1948
|
B,64),required:!1},activities:{...W(B,64),required:!1},facts:{...W(B,64),required:!1}}),Ao=L({schemaVersion:Io,courseId:B,
|
|
1948
1949
|
title:k,release:k,status:{...k,enum:["preview","released"]},topics:W(L({topicId:B,release:k}),32),orientation:{...B,required:!1}}),
|
|
1949
|
-
|
|
1950
|
+
kh=L({schemaVersion:Io,id:B,title:k,svg:k,controller:k,assets:{...W(k,32),required:!1},initialState:B,states:W(B,32),description:{
|
|
1950
1951
|
...k,maxLength:2e3},commands:W(L({name:B,parameters:W(L({name:B,required:{type:"boolean",required:!0},maxLength:{type:"i\
|
|
1951
|
-
nteger",required:!0,min:1,max:256}}),8),completionState:B,description:{...k,maxLength:2e3}}),32)})});function de(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_VOCABULARY_INVALID"})}function
|
|
1952
|
-
test(e.id||""))throw de("A place needs a lowercase id.");let t=`Place ${e.id}`;if(
|
|
1953
|
-
bel.`);if(!
|
|
1952
|
+
nteger",required:!0,min:1,max:256}}),8),completionState:B,description:{...k,maxLength:2e3}}),32)})});var ja,$h=b(()=>{ja="Packages"});function de(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_VOCABULARY_INVALID"})}function xR(e){if(!H(e)||!Me.
|
|
1953
|
+
test(e.id||""))throw de("A place needs a lowercase id.");let t=`Place ${e.id}`;if(!Dh(e.label))throw de(`${t} needs a la\
|
|
1954
|
+
bel.`);if(!AR.has(e.scope))throw de(`${t} scope is studio or project.`);let r=e.who??"everyone";if(!PR.has(r))throw de(`${t}\
|
|
1954
1955
|
who is everyone or owner.`);let n=e.open??null;if(n!==null){let i=Object.keys(n||{}).sort().join(",");if(!(i==="pane"||
|
|
1955
1956
|
i==="databaseView,pane"?e.scope==="project"&&Me.test(n.pane):i==="route"?e.scope==="studio"&&typeof n.route=="string"&&/^\/app(?:\/[a-z0-9-]+)*$/u.
|
|
1956
1957
|
test(n.route):i==="learning"&&n.learning===!0))throw de(`${t} opens a project pane, a studio /app route, Courses, or not\
|
|
1957
|
-
hing.`)}if(!Array.isArray(e.steps)||!e.steps.length||e.steps.length>6||e.steps.some(i=>!Me.test(i?.id||"")
|
|
1958
|
+
hing.`)}if(!Array.isArray(e.steps)||!e.steps.length||e.steps.length>6||e.steps.some(i=>!Me.test(i?.id||"")||!Dh(i.label))||
|
|
1958
1959
|
e.steps.at(-1).id!==e.id)throw de(`${t} needs 1 to 6 labelled steps ending with itself.`);let o=e.shown??(n?.pane?[{pane:n.
|
|
1959
1960
|
pane,...n.databaseView?{databaseView:n.databaseView}:{}}]:n?.route?[{route:n.route}]:[]);if(!Array.isArray(o)||o.some(i=>!H(
|
|
1960
1961
|
i)||!Object.keys(i).length))throw de(`${t} shown is a list of page focus matchers.`);if(e.event!==void 0&&!Me.test(e.event))
|
|
1961
1962
|
throw de(`${t} event is a lowercase activity name.`);return Object.freeze({id:e.id,label:e.label,scope:e.scope,who:r,open:n&&
|
|
1962
1963
|
Object.freeze({...n}),steps:Object.freeze(e.steps.map(i=>J(i.id,i.label))),shown:Object.freeze(o.map(i=>Object.freeze({...i}))),
|
|
1963
|
-
...e.event?{event:e.event}:{}})}function
|
|
1964
|
+
...e.event?{event:e.event}:{}})}function kR(e){if(!H(e)||!Me.test(e.id||""))throw de("An activity needs a lowercase id.");
|
|
1964
1965
|
if(!Me.test(e.event||""))throw de(`Activity ${e.id} needs its page activity event.`);if(e.place!==void 0&&!Me.test(e.place))
|
|
1965
1966
|
throw de(`Activity ${e.id} place is a place id.`);return Object.freeze({id:e.id,event:e.event,...e.place?{place:e.place}:
|
|
1966
|
-
{}})}function
|
|
1967
|
-
stringify(h)===JSON.stringify(l);function a({places:h=[],activities:l=[],facts:w=[]}={}){let _=h.map(
|
|
1967
|
+
{}})}function ka(){return!1}function La({places:e=CR,activities:t=NR,facts:r=jR}={}){let n=new Map,o=new Map,i=new Set,s=(h,l)=>JSON.
|
|
1968
|
+
stringify(h)===JSON.stringify(l);function a({places:h=[],activities:l=[],facts:w=[]}={}){let _=h.map(xR),f=l.map(kR);for(let m of[
|
|
1968
1969
|
..._,...f])if(n.has(m.id)&&!s(n.get(m.id),m)||o.has(m.id)&&!s(o.get(m.id),m)||_.includes(m)&&o.has(m.id)||f.includes(m)&&
|
|
1969
1970
|
n.has(m.id))throw de(`${m.id} is already registered with another meaning.`);for(let m of w)if(!Me.test(m||""))throw de("\
|
|
1970
1971
|
A fact needs a lowercase id.");for(let m of _)n.set(m.id,m);for(let m of f)o.set(m.id,m);for(let m of w)i.add(m)}a({places:e,
|
|
1971
1972
|
activities:t,facts:r});function c(h){return n.get(h)||null}function u(h){return o.get(h)||null}function d(h){return i.has(
|
|
1972
1973
|
h)}function p(){return[...n.values()]}function g(){return new Set([...[...o.values()].map(h=>h.event),...[...n.values()].
|
|
1973
|
-
filter(h=>h.event).map(h=>h.event)])}return Object.freeze({register:a,place:c,activity:u,hasFact:d,places:p,events:g,declared:
|
|
1974
|
-
declaredPlace:
|
|
1974
|
+
filter(h=>h.event).map(h=>h.event)])}return Object.freeze({register:a,place:c,activity:u,hasFact:d,places:p,events:g,declared:ka,
|
|
1975
|
+
declaredPlace:ka,declaredActivity:ka})}function Po({places:e=[],activities:t=[],facts:r=[]}={}){let n=La(),o=new Set(n.places().
|
|
1975
1976
|
map(p=>p.id));for(let p of[...e,...t,...r])if(!Me.test(p||""))throw de(`Declared name ${p} is not a lowercase id.`);let i=new Set(
|
|
1976
1977
|
e.filter(p=>!o.has(p))),s=new Set(t.filter(p=>!n.activity(p)));function a(p){return i.has(p)}function c(p){return s.has(
|
|
1977
1978
|
p)}function u(p){return a(p)||c(p)}function d(p){return n.hasFact(p)||r.includes(p)}return Object.freeze({register:n.register,
|
|
1978
1979
|
place:n.place,activity:n.activity,hasFact:d,places:n.places,events:n.events,declared:u,declaredPlace:a,declaredActivity:c})}
|
|
1979
|
-
function Ke(e,t,r){return new ie(422,e,{code:t,params:r})}function
|
|
1980
|
+
function Ke(e,t,r){return new ie(422,e,{code:t,params:r})}function Vh(e={},t=wt){let r=typeof e.target=="string"?t.place(
|
|
1980
1981
|
e.target):null,n=!r&&t.declaredPlace(e.target);if(!r&&!n){let c=t.places().map(u=>u.id).join(", ");throw Ke(`Use one of \
|
|
1981
1982
|
this installation's guide places: ${c}.`,"VIBE64_TRAINING_GUIDE_INVALID",{places:c})}let o=e.target,i=e.navigate??!1,s=e.
|
|
1982
1983
|
highlight??!0;if(typeof i!="boolean"||typeof s!="boolean")throw Ke("navigate and highlight are booleans.","VIBE64_TRAINI\
|
|
1983
1984
|
NG_GUIDE_FLAGS_INVALID");if(!i&&!s)throw Ke("Point at the place (highlight) or open it (navigate); this request does nei\
|
|
1984
1985
|
ther.","VIBE64_TRAINING_GUIDE_ACTION_MISSING");if(i&&o==="dashboard")throw Ke("Dashboard has no single view to open. Poi\
|
|
1985
1986
|
nt at it, or open one Dashboard section such as files or database-erd.","VIBE64_TRAINING_GUIDE_DASHBOARD_UNOPENABLE");if(i&&
|
|
1986
|
-
r
|
|
1987
|
+
r&&!$R(r))throw Ke(`${r.label} has no view to open; point at it instead.`,"VIBE64_TRAINING_GUIDE_PLACE_UNOPENABLE",{place:r.
|
|
1987
1988
|
label});let a={target:o,navigate:i,highlight:s};if(e.filePath!==void 0){if(o!=="files")throw Ke("filePath is only for th\
|
|
1988
|
-
e files place.","VIBE64_TRAINING_GUIDE_FILE_PATH_MISPLACED");if(typeof e.filePath!="string"
|
|
1989
|
+
e files place.","VIBE64_TRAINING_GUIDE_FILE_PATH_MISPLACED");if(typeof e.filePath!="string"||!Ma.test(e.filePath))throw Ke(
|
|
1989
1990
|
"Use a relative practice project file path without '..'.","VIBE64_TRAINING_GUIDE_FILE_PATH_INVALID");a.filePath=e.filePath}
|
|
1990
|
-
if(e.caption!==void 0){if(typeof e.caption!="string"||!e.caption.trim()||e.caption.length
|
|
1991
|
-
1 to ${
|
|
1991
|
+
if(e.caption!==void 0){if(typeof e.caption!="string"||!e.caption.trim()||e.caption.length>$a)throw Ke(`Use a caption of \
|
|
1992
|
+
1 to ${$a} characters.`,"VIBE64_TRAINING_GUIDE_CAPTION_INVALID",{limit:$a});a.caption=e.caption.trim()}return a}function Uh(e,t={},r=wt){
|
|
1992
1993
|
let n=r.place(e);return n?.shown.length?n.shown.some(o=>Object.entries(o).every(([i,s])=>i==="route"?typeof t.route=="st\
|
|
1993
|
-
ring"&&(t.route===s||t.route.startsWith(`${s}/`)):t[i]===s)):null}function
|
|
1994
|
+
ring"&&(t.route===s||t.route.startsWith(`${s}/`)):t[i]===s)):null}function LR(e,t=wt){let r=new Set,n=new Set,o=new Set;
|
|
1994
1995
|
for(let i of Array.isArray(e?.beats)?e.beats:[]){if(i.kind==="check")continue;let s=t.activity(i.target);s||t.declaredActivity(
|
|
1995
1996
|
i.target)?(n.add(i.target),s?.place&&r.add(s.place)):r.add(i.target)}return e?.guide?.target&&r.add(e.guide.target),e?.check?.
|
|
1996
|
-
kind==="fact"&&o.add(e.check.fact),{places:[...r],activities:[...n],facts:[...o]}}var Me,
|
|
1997
|
-
wt,$a,
|
|
1998
|
-
owner"]),J=(e,t)=>Object.freeze({id:e,label:t}),
|
|
1999
|
-
"Database"),
|
|
2000
|
-
steps:[
|
|
2001
|
-
project",open:{pane:"database",databaseView:"erd"},steps:[Le,
|
|
2002
|
-
|
|
1997
|
+
kind==="fact"&&o.add(e.check.fact),{places:[...r],activities:[...n],facts:[...o]}}var Me,AR,PR,J,Lh,Le,Mh,xa,CR,NR,jR,Dh,
|
|
1998
|
+
wt,Ma,$a,$R,RB,Co=b(()=>{Xr();U();$h();Me=/^[a-z][a-z0-9-]{0,63}$/u,AR=new Set(["studio","project"]),PR=new Set(["everyo\
|
|
1999
|
+
ne","owner"]),J=(e,t)=>Object.freeze({id:e,label:t}),Lh=J("preview","Preview"),Le=J("dashboard","Dashboard"),Mh=J("datab\
|
|
2000
|
+
ase","Database"),xa=J("account-menu","Account menu"),CR=[{id:"preview",label:"Preview",scope:"project",open:{pane:"previ\
|
|
2001
|
+
ew"},steps:[Lh]},{id:"dashboard",label:"Dashboard",scope:"project",open:null,steps:[Le]},{id:"database-erd",label:"ERD",
|
|
2002
|
+
scope:"project",open:{pane:"database",databaseView:"erd"},steps:[Le,Mh,J("database-erd","ERD")]},{id:"database-data",label:"\
|
|
2003
|
+
Data",scope:"project",open:{pane:"database",databaseView:"data"},steps:[Le,Mh,J("database-data","Data")]},{id:"files",label:"\
|
|
2003
2004
|
Files",scope:"project",open:{pane:"files"},steps:[Le,J("files","Files")]},{id:"changes",label:"Current changes",scope:"p\
|
|
2004
2005
|
roject",open:{pane:"changes"},steps:[Le,J("changes","Current changes")]},{id:"git-log",label:"Git log",scope:"project",open:{
|
|
2005
2006
|
pane:"repository"},steps:[Le,J("git-log","Git log")]},{id:"session-info",label:"Session info",scope:"project",open:{pane:"\
|
|
2006
2007
|
session"},steps:[Le,J("session-info","Session info")]},{id:"architecture",label:"Architecture",scope:"project",open:{pane:"\
|
|
2007
|
-
system"},steps:[Le,J("architecture","Architecture")]},{id:"publish",label:
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
"
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
e
|
|
2022
|
-
|
|
2008
|
+
system"},steps:[Le,J("architecture","Architecture")]},{id:"publish",label:ja,scope:"project",open:{pane:"publish"},steps:[
|
|
2009
|
+
Le,J("publish",ja)]},{id:"chat",label:"Coding chat",scope:"project",open:null,shown:[{pane:"chat"},{chatVisible:!0}],steps:[
|
|
2010
|
+
J("chat","Coding chat")]},{id:"save",label:"Save",scope:"project",open:null,event:"saved",steps:[J("save","Save")]},{id:"\
|
|
2011
|
+
reload-preview",label:"Reload preview",scope:"project",open:null,event:"preview-reloaded",steps:[Lh,J("reload-preview","\
|
|
2012
|
+
Reload preview")]},{id:"learning",label:"Learning",scope:"studio",open:{learning:!0},shown:[],event:"learn-toggled",steps:[
|
|
2013
|
+
J("learning","Learning")]},{id:"lesson",label:"Lesson",scope:"studio",open:null,shown:[{pane:"lesson"}],steps:[J("lesson",
|
|
2014
|
+
"Lesson")]},{id:"lesson-bar",label:"Lesson step bar",scope:"studio",open:null,steps:[J("lesson-bar","Lesson step bar")]},
|
|
2015
|
+
{id:"courses",label:"Courses",scope:"studio",open:null,shown:[{learningOpen:!0}],steps:[J("courses","Courses")]},{id:"co\
|
|
2016
|
+
lleague",label:"Colleague",scope:"studio",open:null,event:"colleague-opened",steps:[J("colleague","Colleague")]},{id:"ac\
|
|
2017
|
+
count-menu",label:"Account menu",scope:"studio",open:null,steps:[xa]},{id:"account-settings",label:"Account settings",scope:"\
|
|
2018
|
+
studio",open:null,steps:[xa,J("account-settings","Account settings")]},{id:"ai-setup",label:"AI setup",scope:"studio",open:null,
|
|
2019
|
+
steps:[xa,J("ai-setup","AI setup")]}],NR=[{id:"send-message",event:"message-sent",place:"chat"},{id:"agent-finished",event:"\
|
|
2020
|
+
agent-finished"},{id:"file-opened",event:"file-opened",place:"files"},{id:"app-pressed",event:"app-pressed",place:"previ\
|
|
2021
|
+
ew"},{id:"colleague-minimised",event:"colleague-minimised",place:"colleague"}],jR=["ai-ready"];Dh=e=>typeof e=="string"&&
|
|
2022
|
+
e.trim().length>0&&e.length<=64;wt=La({facts:[]});Ma=/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[^\u0000-\u001f\\]{1,512}$/u,$a=256;
|
|
2023
|
+
$R=e=>!!e?.open;RB=Object.freeze({createLearningVocabulary:La,lessonStepNeeds:LR})});function fe(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_BEATS_INVALID"})}function FR(e,t,r){let n=UR.exec(
|
|
2023
2024
|
e);if(!n)throw fe(`beat ${t} must read "<show|do|check> <target>: <text>".`);let[,o,i,s,a=""]=n,c=`beat ${t} (${o} ${i})`;
|
|
2024
2025
|
if(o==="check"&&i==="review"){if(a.trim()||s!==void 0)throw fe(`${c} takes no text: the bar shows the step's check.rubri\
|
|
2025
2026
|
c.`);return{kind:o,target:i,text:""}}if(!a.trim())throw fe(`${c} needs its text after the colon.`);let u={kind:o,target:i,
|
|
2026
2027
|
text:a.trim()};if(s!==void 0&&!(o==="do"&&i==="file-opened"))throw fe(`${c} takes no argument; only do file-opened names\
|
|
2027
|
-
a path.`);if(o==="show"&&!
|
|
2028
|
-
othing the learner can do or be at.`);if(o==="check"&&!
|
|
2029
|
-
if(s!==void 0){if(
|
|
2030
|
-
"send-message"?
|
|
2031
|
-
...u.text.matchAll(
|
|
2032
|
-
ed prompt of at most ${
|
|
2028
|
+
a path.`);if(o==="show"&&!GR(i,r))throw fe(`${c} names an unknown place.`);if(o==="do"&&!zR(i,r))throw fe(`${c} names n\
|
|
2029
|
+
othing the learner can do or be at.`);if(o==="check"&&!Da[i])throw fe(`${c} must be check auto, review, done or fact.`);
|
|
2030
|
+
if(s!==void 0){if(!Ma.test(s))throw fe(`${c} needs a relative practice project file path without '..'.`);u.path=s}let d=i===
|
|
2031
|
+
"send-message"?DR:MR;if(u.text.length>d)throw fe(`${c} text is longer than ${d} characters.`);if(i==="send-message"){let p=[
|
|
2032
|
+
...u.text.matchAll(BR)].map(g=>g[1].trim());if(p.length!==1||!p[0]||p[0].length>zh)throw fe(`${c} needs exactly one quot\
|
|
2033
|
+
ed prompt of at most ${zh} characters.`);u.prompt=p[0]}return u}function No(e,t=wt){let r=String(e??""),n=VR.exec(r);if(!n)
|
|
2033
2034
|
return{body:r,beats:null};let o=r.slice(n.index+n[0].length),i=/^```[ \t]*$/mu.exec(o);if(!i)throw fe("the beats block i\
|
|
2034
2035
|
s not closed with ```.");if(o.slice(i.index+i[0].length).trim())throw fe("the beats block must end the step text.");let s=o.
|
|
2035
2036
|
slice(0,i.index).split(`
|
|
2036
|
-
`).map(u=>u.trim()).filter(Boolean);if(!s.length||s.length>
|
|
2037
|
-
map((u,d)=>
|
|
2037
|
+
`).map(u=>u.trim()).filter(Boolean);if(!s.length||s.length>Bh)throw fe(`a beats block holds 1 to ${Bh} beats.`);let a=s.
|
|
2038
|
+
map((u,d)=>FR(u,d+1,t)),c=a.filter(u=>u.kind==="check");if(c.length>1||c.length&&a.at(-1).kind!=="check")throw fe("a ste\
|
|
2038
2039
|
p has at most one check beat, and it is the last.");return{body:r.slice(0,n.index).replace(/\s+$/u,`
|
|
2039
|
-
`),beats:a}}function
|
|
2040
|
-
function
|
|
2041
|
-
scope==="project":!t.declared(e.target)}var
|
|
2042
|
-
freeze({auto:"auto",review:"review",done:"self",fact:"fact"}),
|
|
2043
|
-
|
|
2044
|
-
place(e)||t.declaredPlace(e))});import{createHash as
|
|
2040
|
+
`),beats:a}}function HR(e,t=wt){if(!e||e.kind==="check")return"";let r=t.activity(e.target);return r?r.place||"":e.target}
|
|
2041
|
+
function Gh(e,t=wt){if(e.kind==="check")return e.target==="auto"||e.target==="review";let r=t.place(HR(e,t));return r?r.
|
|
2042
|
+
scope==="project":!t.declared(e.target)}var Bh,MR,zh,DR,Da,VR,UR,BR,zR,GR,Va=b(()=>{Co();Bh=8,MR=160,zh=500,DR=600,Da=Object.
|
|
2043
|
+
freeze({auto:"auto",review:"review",done:"self",fact:"fact"}),VR=/^```beats[ \t]*$/mu,UR=/^(show|do|check)[ \t]+([a-z][a-z-]*)(?:[ \t]+([^:]+?))?[ \t]*(?::[ \t]*(.*))?$/u,
|
|
2044
|
+
BR=/["“]([^"“”]+)["”]/gu;zR=(e,t)=>!!(t.activity(e)||t.place(e)?.event||Uh(e,{},t)!==null||t.declared(e)),GR=(e,t)=>!!(t.
|
|
2045
|
+
place(e)||t.declaredPlace(e))});import{createHash as qR}from"node:crypto";function ne(e){return qR("sha256").update(e).digest("hex")}var Yt=b(()=>{});import{lstat as WR,readFile as YR,readdir as JR,realpath as Fh}from"node:fs/promises";import pe from"node:path";function Ce(e,t,r){
|
|
2045
2046
|
let n=new Set;for(let o of e){let i=t?o[t]:o;if(!jo(i)||n.has(i))throw new Error(`${r}: invalid or duplicate ID ${i}.`);
|
|
2046
2047
|
n.add(i)}return n}function V(e){return Array.isArray(e)?`[${e.map(V).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(
|
|
2047
|
-
e).sort().map(t=>`${JSON.stringify(t)}:${V(e[t])}`).join(",")}}`:JSON.stringify(e)}function
|
|
2048
|
+
e).sort().map(t=>`${JSON.stringify(t)}:${V(e[t])}`).join(",")}}`:JSON.stringify(e)}function qh(e,t){let r=e.get(t.path);
|
|
2048
2049
|
if(r&&(r.sha256!==t.sha256||r.bytes!==t.bytes))throw new Error(`Source changed between lesson snapshots: ${t.path}. Vali\
|
|
2049
|
-
date and retry.`);e.set(t.path,t)}function _t(e){let t=new Map;for(let r of e)for(let n of r.files)
|
|
2050
|
-
async function
|
|
2050
|
+
date and retry.`);e.set(t.path,t)}function _t(e){let t=new Map;for(let r of e)for(let n of r.files)qh(t,n);return[...t.values()]}
|
|
2051
|
+
async function KR(e){let t=await Fh(e);async function r(i,s=t){if(typeof i!="string"||!i||i.includes("\\")||pe.isAbsolute(
|
|
2051
2052
|
i))throw new Error(`Invalid topic-relative path: ${i}.`);let a=pe.resolve(s,i),c=pe.relative(t,a);if(c===".."||c.startsWith(
|
|
2052
|
-
`..${pe.sep}`)||pe.isAbsolute(c))throw new Error(`Path escapes topic: ${i}.`);if(await
|
|
2053
|
+
`..${pe.sep}`)||pe.isAbsolute(c))throw new Error(`Path escapes topic: ${i}.`);if(await Fh(a)!==a)throw new Error(`Symlin\
|
|
2053
2054
|
k content is not supported: ${i}.`);return{filename:a,relative:c.split(pe.sep).join("/")}}async function n(i,s=t){let a=await r(
|
|
2054
|
-
i,s),c=await
|
|
2055
|
-
relative}.`);return{...a,bytes:await
|
|
2056
|
-
a.bytes.toString("utf8"))}}return Object.freeze({root:t,resolve:r,read:n,json:o})}function
|
|
2055
|
+
i,s),c=await WR(a.filename);if(!c.isFile()||c.size>1024*1024)throw new Error(`Expected a regular file of at most 1 MiB: ${a.
|
|
2056
|
+
relative}.`);return{...a,bytes:await YR(a.filename)}}async function o(i,s=t){let a=await n(i,s);return{...a,value:JSON.parse(
|
|
2057
|
+
a.bytes.toString("utf8"))}}return Object.freeze({root:t,resolve:r,read:n,json:o})}function XR(e){let t=new Map(e.map(i=>[
|
|
2057
2058
|
i.code,i])),r=new Set,n=new Set;function o(i){if(n.has(i))throw new Error(`Prerequisite cycle at ${i}.`);if(r.has(i))return;
|
|
2058
2059
|
let s=t.get(i);if(!s)throw new Error(`Unknown prerequisite ${i}.`);n.add(i);for(let a of s.prerequisites)o(a.code);n.delete(
|
|
2059
|
-
i),r.add(i)}for(let i of e)o(i.code)}function
|
|
2060
|
+
i),r.add(i)}for(let i of e)o(i.code)}function ZR(e,t,r,n){r(t);let o=t.bytes.toString("utf8");Ce(e.assessments,"id","Ass\
|
|
2060
2061
|
essments");for(let i of e.assessments){let[s,a,c]=i.rubric.split("#");if(s!==e.document||!a||c||!new RegExp(`^<a id="${i.
|
|
2061
2062
|
id}"></a>$`,"mu").test(o)||a!==i.id)throw new Error(`Missing explicit rubric anchor for ${i.id}.`);if(i.kind==="practica\
|
|
2062
2063
|
l"&&!i.evidence)throw new Error(`Practical assessment ${i.id} needs an evidence producer.`);if(i.kind==="answer"&&i.evidence)
|
|
@@ -2067,21 +2068,21 @@ check&&!["exercise","code"].includes(i.evidence.producer))throw new Error(`Only
|
|
|
2067
2068
|
d check: ${i.id}.`);let u=(e.checks||[]).find(d=>d.id===i.evidence?.check)?.kind||"response";if(i.evidence?.producer==="\
|
|
2068
2069
|
code"){if(!e.exercise||!i.evidence.check||u!=="code"||!i.evidence.files?.length)throw new Error(`Code assessment ${i.id}\
|
|
2069
2070
|
needs its declared exercise, files and a code check.`)}else if(i.evidence?.files||i.evidence?.check&&u==="code")throw new Error(
|
|
2070
|
-
`Only code evidence names edited files or runs a code check: ${i.id}.`)}}function
|
|
2071
|
+
`Only code evidence names edited files or runs a code check: ${i.id}.`)}}function QR(e,t,r,n,o,i){let s=a=>{throw new Error(
|
|
2071
2072
|
`Lesson ${n}: ${a}`)};e.schemaVersion===3&&e.stage==="project"&&!e.exercise&&s("a project lesson needs its exercise (a p\
|
|
2072
|
-
ractice project)."),e.steps.length||s("needs at least one step."),
|
|
2073
|
+
ractice project)."),e.steps.length||s("needs at least one step."),Ce(e.steps,"id","Steps"),e.steps.some(a=>a.required)||
|
|
2073
2074
|
s("needs a required step.");for(let a of e.steps){let c=`step ${a.id}`;if(a.visual){let h=t.get(a.visual.id);h||s(`${c} \
|
|
2074
2075
|
shows undeclared visual ${a.visual.id}.`);for(let l of a.visual.play||[]){let w=h.commands.find(f=>f.name===l.name);w||s(
|
|
2075
2076
|
`${c} plays undeclared command ${l.name}.`);let _=l.parameters;(!_||typeof _!="object"||Array.isArray(_))&&s(`${c} comma\
|
|
2076
2077
|
nd ${l.name} needs a parameters object.`);for(let[f,m]of Object.entries(_)){let y=w.parameters.find(E=>E.name===f);y||s(
|
|
2077
2078
|
`${c} command ${l.name} has undeclared parameter ${f}.`),(typeof m!="string"||m.length>y.maxLength)&&s(`${c} command ${l.
|
|
2078
2079
|
name} parameter ${f} must be a string of at most ${y.maxLength} characters.`)}for(let f of w.parameters)f.required&&!Object.
|
|
2079
|
-
hasOwn(_,f.name)&&s(`${c} command ${l.name} needs parameter ${f.name}.`)}}if(a.guide){let{caption:h,...l}=a.guide;try{
|
|
2080
|
+
hasOwn(_,f.name)&&s(`${c} command ${l.name} needs parameter ${f.name}.`)}}if(a.guide){let{caption:h,...l}=a.guide;try{Vh(
|
|
2080
2081
|
l,i)}catch(w){s(`${c} guide: ${w.message}`)}i.place(a.guide.target)?.scope==="project"&&!e.exercise&&s(`${c} guide ${a.guide.
|
|
2081
2082
|
target} needs the lesson's exercise (a practice project).`)}let u=null;try{({beats:u}=No(o.get(a.body),i))}catch(h){s(`${c}\
|
|
2082
2083
|
beats: ${h.message}`)}if(u){a.guide&&s(`${c} has both beats and a guide; its beats replace the guide.`);let h=u.find(w=>w.
|
|
2083
|
-
kind==="check");h&&
|
|
2084
|
-
let l=u.find(w=>
|
|
2084
|
+
kind==="check");h&&Da[h.target]!==a.check.kind&&s(`${c} beat check ${h.target} does not match its ${a.check.kind} check.`);
|
|
2085
|
+
let l=u.find(w=>Gh(w,i));l&&!e.exercise&&s(`${c} beat ${l.kind} ${l.target} needs the lesson's exercise (a practice proj\
|
|
2085
2086
|
ect).`)}let d=a.check,p={auto:["check","files"],choice:["question","options","answer"],review:["rubric","evidence"],fact:[
|
|
2086
2087
|
"fact"],self:[],none:[]}[d.kind],g=Object.keys(d).filter(h=>h!=="kind"&&!p.includes(h));if(g.length&&s(`${c} ${d.kind} c\
|
|
2087
2088
|
heck cannot declare ${g.join(", ")}.`),d.kind==="none"&&a.required&&s(`${c} has no check and cannot be required.`),d.kind===
|
|
@@ -2095,47 +2096,47 @@ evidence||["changes"];(h[0]!=="changes"||h.length>2||h.length===2&&h[1]!=="conve
|
|
|
2095
2096
|
changes"] or ["changes", "conversation"].`)}if(d.kind==="choice"){let{question:h,options:l,answer:w}=d;(!h||!l||!w)&&s(`${c}\
|
|
2096
2097
|
choice needs question, options and answer.`),(l.length<2||l.length>8)&&s(`${c} choice needs 2-8 options.`),(!w.length||
|
|
2097
2098
|
new Set(w).size!==w.length||w.some(_=>_>=l.length))&&s(`${c} choice answer must list unique option indexes within its op\
|
|
2098
|
-
tions.`)}}}async function
|
|
2099
|
+
tions.`)}}}async function eA(e,t,{authoring:r,installed:n,vocabulary:o}){let i=await e.json(t.descriptor),s=Oo(i.value,t.
|
|
2099
2100
|
code);if(s.code!==t.code)throw new Error(`Lesson code mismatch: ${t.code}.`);if(r&&s.schemaVersion!==3)throw new Error(`\
|
|
2100
2101
|
Lesson ${t.code} uses retired lesson format ${s.schemaVersion}. Author it in format 3 with steps and its stage.`);let a=pe.
|
|
2101
|
-
dirname(i.filename),c=new Map;function u(f){if(
|
|
2102
|
+
dirname(i.filename),c=new Map;function u(f){if(qh(c,{path:f.relative,sha256:ne(f.bytes),bytes:f.bytes.length}),c.size>512||
|
|
2102
2103
|
[...c.values()].reduce((m,y)=>m+y.bytes,0)>32*1024*1024)throw new Error(`Lesson ${t.code} exceeds bundle limits.`)}u(i);
|
|
2103
|
-
let d=new Set,p=new Map;
|
|
2104
|
-
checks||[]){u(await e.read(f.file,a));for(let m of f.assets||[])u(await e.read(m,a))}if(s.schemaVersion===1&&
|
|
2105
|
-
read(s.document,a),u,g),
|
|
2104
|
+
let d=new Set,p=new Map;Ce(s.prerequisites,"code","Lesson prerequisites");let g=Ce(s.checks||[],"id","Checks");for(let f of s.
|
|
2105
|
+
checks||[]){u(await e.read(f.file,a));for(let m of f.assets||[])u(await e.read(m,a))}if(s.schemaVersion===1&&ZR(s,await e.
|
|
2106
|
+
read(s.document,a),u,g),Pe(s))for(let f of[s.notes,...new Set(s.steps.map(m=>m.body))]){if(f===void 0)continue;let m=await e.
|
|
2106
2107
|
read(f,a);u(m),d.add(m.relative),p.set(f,m.bytes.toString("utf8"))}if(s.appRoutes&&!s.exercise)throw new Error(`Lesson ${t.
|
|
2107
2108
|
code} can declare app routes only with its exercise.`);let h=new Set;for(let f of s.appRoutes||[]){if(f.path!=="/"&&!f.path.
|
|
2108
2109
|
slice(1).split("/").every(y=>y===":id"||/^[A-Za-z0-9._~-]+$/u.test(y)))throw new Error(`Invalid app route path for ${t.code}\
|
|
2109
2110
|
: ${f.path}.`);let m=`${f.method} ${f.path}`;if(h.has(m))throw new Error(`Lesson ${t.code} has a duplicate app route: ${m}\
|
|
2110
2111
|
.`);h.add(m)}for(let f of s.checks||[])if(f.timeoutSeconds!==void 0&&f.kind!=="code")throw new Error(`Only a code check \
|
|
2111
2112
|
declares a timeout: ${f.id}.`);if(s.schemaVersion===1&&!s.assessments.some(f=>f.required))throw new Error(`Lesson ${t.code}\
|
|
2112
|
-
needs a required assessment.`);
|
|
2113
|
-
descriptor,a),y=
|
|
2114
|
-
"Visual states");if(!E.has(y.initialState))throw new Error(`Unknown initial visual state: ${y.initialState}.`);
|
|
2115
|
-
"name","Visual commands");for(let S of y.commands)if(
|
|
2113
|
+
needs a required assessment.`);Ce(s.visuals,"id","Visuals");let l=new Map;for(let f of s.visuals){let m=await e.json(f.
|
|
2114
|
+
descriptor,a),y=_e(kh,m.value,f.id);if(y.id!==f.id)throw new Error(`Visual ID mismatch: ${f.id}.`);let E=Ce(y.states,null,
|
|
2115
|
+
"Visual states");if(!E.has(y.initialState))throw new Error(`Unknown initial visual state: ${y.initialState}.`);Ce(y.commands,
|
|
2116
|
+
"name","Visual commands");for(let S of y.commands)if(Ce(S.parameters,"name","Command parameters"),S.completionState!=="u\
|
|
2116
2117
|
nchanged"&&!E.has(S.completionState))throw new Error(`Unknown completion state: ${S.name}.`);u(m),l.set(y.id,y);let T=pe.
|
|
2117
2118
|
dirname(m.filename);for(let S of[y.svg,y.controller,...y.assets||[]]){let v=await e.read(S,T);u(v),d.add(v.relative)}}if(s.
|
|
2118
2119
|
exercise){let f=s.exercise;if(f.reuse==="sequence"){if(!f.sequenceId||!f.sequenceMode)throw new Error(`Invalid exercise \
|
|
2119
2120
|
sequence for ${t.code}.`)}else if(f.sequenceId||f.sequenceMode)throw new Error(`Invalid exercise sequence for ${t.code}.`);
|
|
2120
2121
|
if(f.sequenceId&&!jo(f.sequenceId))throw new Error("Invalid exercise sequence ID.");let m=await e.resolve(f.source,a);async function y(T){
|
|
2121
|
-
for(let S of(await
|
|
2122
|
+
for(let S of(await JR(T,{withFileTypes:!0})).sort((v,R)=>v.name<R.name?-1:v.name>R.name?1:0)){if(Hh.has(S.name))continue;
|
|
2122
2123
|
let v=pe.relative(e.root,pe.join(T,S.name)),R=await e.resolve(v);if(S.isDirectory())await y(R.filename);else{let O=await e.
|
|
2123
2124
|
read(v);u(O),d.add(O.relative)}}}await y(m.filename);let E=s.schemaVersion===1?s.assessments.map(T=>[`Code assessment ${T.
|
|
2124
2125
|
id}`,T.evidence?.files||[]]):s.steps.map(T=>[`Code step ${T.id}`,T.check.files||[]]);for(let[T,S]of E){for(let v of S){let R=v.
|
|
2125
|
-
split("/");if(v.includes("\\")||pe.posix.isAbsolute(v)||R.some(O=>!O||O==="."||O===".."||
|
|
2126
|
+
split("/");if(v.includes("\\")||pe.posix.isAbsolute(v)||R.some(O=>!O||O==="."||O===".."||Hh.has(O))||!c.has(m.relative?`${m.
|
|
2126
2127
|
relative}/${v}`:v))throw new Error(`${T} names a file outside its bundled exercise: ${v}.`)}if(new Set(S).size!==S.length)
|
|
2127
|
-
throw new Error(`${T} repeats a declared file.`)}}let w="";if(
|
|
2128
|
+
throw new Error(`${T} repeats a declared file.`)}}let w="";if(Pe(s))try{QR(s,l,g,t.code,p,o)}catch(f){if(!n)throw f;w=f.
|
|
2128
2129
|
message}let _={schemaVersion:1,code:s.code,files:[...c.values()].sort((f,m)=>f.path<m.path?-1:f.path>m.path?1:0)};return{
|
|
2129
2130
|
lesson:s,manifest:_,hash:ne(V(_)),descriptorPath:i.relative,served:d,...w?{problem:w}:{}}}async function bt(e,t={}){let{
|
|
2130
|
-
authoring:r=!1,installed:n=!1}=t,o=await
|
|
2131
|
+
authoring:r=!1,installed:n=!1}=t,o=await KR(e),i=await o.json("package.json");if(!/^learn-[a-z0-9-]+$/u.test(i.value.name||
|
|
2131
2132
|
"")||!/^\d+\.\d+\.\d+$/u.test(i.value.version||""))throw new Error("Topic package needs a learn- name and an exact relea\
|
|
2132
|
-
se version.");let s=
|
|
2133
|
-
pic or domain ID.");let a=await o.read(s.outline);if(
|
|
2133
|
+
se version.");let s=_e(Ro,i.value.vibe64Training,"Topic");if(!jo(s.topicId)||!jo(s.domainId))throw new Error("Invalid to\
|
|
2134
|
+
pic or domain ID.");let a=await o.read(s.outline);if(Ce(s.lessons,"code","Lessons"),Ce(s.prerequisites,"topicId","Topic \
|
|
2134
2135
|
prerequisites"),!s.lessons.length)throw new Error("A topic needs lessons.");if(s.status==="released"&&s.lessons.some(l=>l.
|
|
2135
2136
|
required&&l.status!=="published"))throw new Error("A released topic contains required draft lessons.");let c=Po(s),u=[],
|
|
2136
|
-
d=new Set;for(let l of s.lessons){let{served:w,..._}=await
|
|
2137
|
-
d.add(f);u.push({..._,status:l.status,required:l.required})}for(let{descriptorPath:l,lesson:w}of u)if(
|
|
2138
|
-
`Lesson ${w.code} descriptor cannot also be a step body, notes, visual or exercise file.`);
|
|
2137
|
+
d=new Set;for(let l of s.lessons){let{served:w,..._}=await eA(o,l,{authoring:r,installed:n,vocabulary:c});for(let f of w)
|
|
2138
|
+
d.add(f);u.push({..._,status:l.status,required:l.required})}for(let{descriptorPath:l,lesson:w}of u)if(Pe(w)&&d.has(l))throw new Error(
|
|
2139
|
+
`Lesson ${w.code} descriptor cannot also be a step body, notes, visual or exercise file.`);XR(u.map(l=>l.lesson));for(let[
|
|
2139
2140
|
l,w]of u.entries())for(let{code:_}of w.lesson.prerequisites){let f=u.findIndex(m=>m.lesson.code===_);if(f>=l)throw new Error(
|
|
2140
2141
|
`Prerequisite ${_} must precede ${w.lesson.code}.`);if(w.status==="published"&&u[f].status!=="published")throw new Error(
|
|
2141
2142
|
`Published lesson ${w.lesson.code} requires draft ${_}.`)}let p=new Map;for(let{lesson:l,descriptorPath:w,status:_}of u){
|
|
@@ -2145,12 +2146,12 @@ ence: ${l.code}.`);p.set(l.exercise.sequenceId,{source:f,status:_})}else if(!m||
|
|
|
2145
2146
|
"published")throw new Error(`Invalid create/continue sequence: ${l.code}.`)}let g=[i,a].map(l=>({path:l.relative,sha256:ne(
|
|
2146
2147
|
l.bytes),bytes:l.bytes.length})),h={schemaVersion:1,topic:s,release:i.value.version,files:g,lessons:u.map(({lesson:l,hash:w,
|
|
2147
2148
|
status:_,required:f})=>({code:l.code,hash:w,status:_,required:f}))};return _t([h,...u.map(l=>l.manifest)]),{topic:s,release:i.
|
|
2148
|
-
value.version,bundles:u,topicManifest:h,topicHash:ne(V(h))}}var
|
|
2149
|
-
node_modules",".genesis"]),jo=e=>/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u.test(e)});import{realpath as
|
|
2149
|
+
value.version,bundles:u,topicManifest:h,topicHash:ne(V(h))}}var Hh,jo,Jt=b(()=>{Wt();Co();Va();Yt();Hh=new Set([".git","\
|
|
2150
|
+
node_modules",".genesis"]),jo=e=>/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u.test(e)});import{realpath as Wh}from"node:fs/promises";async function Ur(e){let t=await Wh(e),r=async(c,u="utf8",d={})=>{let{input:p,
|
|
2150
2151
|
maxBuffer:g=1024*1024}=d,h=await qt({actor:"daemon",allowedRoots:[t],args:["-C",t,...c],command:"git",cwd:t,envPolicy:"p\
|
|
2151
2152
|
roject",gitSafeDirectories:[t],input:p,maxBuffer:g,mode:"capture",outputEncoding:u,purpose:"source",runtimes:["git"],timeout:6e4});
|
|
2152
2153
|
if(h.ok!==!0)throw Object.assign(new Error(h.error||"Git could not read the pinned topic."),{code:h.code});return u==="b\
|
|
2153
|
-
ase64"?Buffer.from(h.stdout,"base64"):h.stdout.trim()};if(await
|
|
2154
|
+
ase64"?Buffer.from(h.stdout,"base64"):h.stdout.trim()};if(await Wh(await r(["rev-parse","--show-toplevel"]))!==t)throw new Error(
|
|
2154
2155
|
"Choose the topic repository root.");let n=await r(["rev-parse","HEAD"]);if(await r(["status","--porcelain","--untracked\
|
|
2155
2156
|
-files=all"]))throw new Error("Commit the topic content before generating a pinned course manifest.");let o=await bt(t),
|
|
2156
2157
|
i=JSON.parse(await r(["show",`${n}:package.json`])),s=String(i.repository?.url||"").match(/^https:\/\/github\.com\/([a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+)\.git$/u)?.[1];
|
|
@@ -2163,7 +2164,7 @@ h,w).toString("ascii")),f=_?Number(_[1]):-1,m=w+1+f;if(f!==l.bytes||g[m]!==0||ne
|
|
|
2163
2164
|
`Topic input differs from its pinned commit: ${l.path}.`);h=m+1}if(h!==g.length)throw new Error("Unexpected trailing dat\
|
|
2164
2165
|
a while reading the pinned topic.");c=u}if(await r(["rev-parse","HEAD"])!==n||await r(["status","--porcelain","--untrack\
|
|
2165
2166
|
ed-files=all"]))throw new Error("Topic changed during manifest generation. Commit and retry.");return{topicId:o.topic.topicId,
|
|
2166
|
-
release:o.release,repository:s,commit:n,topicManifest:o.topicManifest,topicHash:o.topicHash}}function Br(e,t){let r=
|
|
2167
|
+
release:o.release,repository:s,commit:n,topicManifest:o.topicManifest,topicHash:o.topicHash}}function Br(e,t){let r=_e(Ao,
|
|
2167
2168
|
e,"Course");if(!/^[a-z][a-z0-9-]{0,63}$/u.test(r.courseId)||!/^\d+\.\d+\.\d+$/u.test(r.release)||!r.topics.length)throw new Error(
|
|
2168
2169
|
"Course needs an ID, exact release and at least one whole topic.");let n=new Set,o=r.topics.map(i=>{if(n.has(i.topicId))
|
|
2169
2170
|
throw new Error(`Duplicate course topic: ${i.topicId}.`);n.add(i.topicId);let s=t.filter(d=>d.topicId===i.topicId&&d.release===
|
|
@@ -2171,7 +2172,7 @@ i.release);if(s.length!==1)throw new Error(`Resolve exactly one pinned topic rel
|
|
|
2171
2172
|
if(!/^[a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+$/u.test(a.repository||"")||!/^[a-f0-9]{40}$/u.test(a.commit||""))throw new Error(
|
|
2172
2173
|
`Topic requires a repository and immutable commit: ${i.topicId}.`);let c=a.topicManifest;if(!c||c.schemaVersion!==1||c.topic?.
|
|
2173
2174
|
topicId!==i.topicId||c.release!==i.release||ne(V(c))!==a.topicHash)throw new Error(`Topic manifest identity mismatch: ${i.
|
|
2174
|
-
topicId}.`);if(
|
|
2175
|
+
topicId}.`);if(_e(Ro,c.topic,i.topicId),r.status==="released"&&c.topic.status!=="released")throw new Error(`Released cou\
|
|
2175
2176
|
rse requires a released topic: ${i.topicId}.`);let u=c.topic.lessons;if(!Array.isArray(u)||!u.length||!Array.isArray(c.lessons)||
|
|
2176
2177
|
u.length!==c.lessons.length)throw new Error(`Incomplete whole-topic inventory: ${i.topicId}.`);for(let[d,p]of u.entries()){
|
|
2177
2178
|
let g=c.lessons[d];if(g.code!==p.code||g.status!==p.status||g.required!==p.required||!/^[a-f0-9]{64}$/u.test(g.hash||""))
|
|
@@ -2180,36 +2181,36 @@ throw new Error(`Changed whole-topic order or lesson identity: ${i.topicId}.`);i
|
|
|
2180
2181
|
repository:a.repository,commit:a.commit,manifestHash:a.topicHash,lessons:c.lessons.map(d=>({...d}))}});if(r.orientation!==
|
|
2181
2182
|
void 0&&!o.some(i=>i.lessons.some(s=>s.code===r.orientation&&s.status==="published")))throw new Error(`Course orientatio\
|
|
2182
2183
|
n ${r.orientation} must be a published lesson of the course.`);return{schemaVersion:1,courseId:r.courseId,release:r.release,
|
|
2183
|
-
status:r.status,topics:o}}var xo=b(()=>{
|
|
2184
|
-
return Kt(e,t,{...n,statusCode:r})}function
|
|
2185
|
-
assign(new Error(e,r?{cause:r}:void 0),{code:t})}var
|
|
2186
|
-
return
|
|
2187
|
-
e}function Et(e,t={}){let r=
|
|
2188
|
-
r.topicId)||r.commit!==(t.commit??r.commit)||!/^\d+\.\d+\.\d+$/u.test(r.release)||!
|
|
2184
|
+
status:r.status,topics:o}}var xo=b(()=>{Ea();Jt();Wt();Yt()});function Kt(e,t,r){let{statusCode:n,cause:o,...i}=r,s=new ie(n,e,{...i,code:t});return o&&(s.cause=o),s}function ko(e,t,r=409,n={}){
|
|
2185
|
+
return Kt(e,t,{...n,statusCode:r})}function Ne(e,t,r,n){return Kt(e,t,{statusCode:r,cause:n})}function Ua(e,t,r){return Object.
|
|
2186
|
+
assign(new Error(e,r?{cause:r}:void 0),{code:t})}var WB,$o=b(()=>{Ve();WB=128*1024});var Yh=b(()=>{});import{lstat as tA,readFile as rA,readdir as nA,realpath as oA}from"node:fs/promises";import G from"node:path";function Ba(e){
|
|
2187
|
+
return Pe(e)?{...e,steps:e.steps.map(t=>{if(t.check.kind!=="choice")return t;let{answer:r,...n}=t.check;return{...t,check:n}})}:
|
|
2188
|
+
e}function Et(e,t={}){let r=_e(sA,e,"Installed topic pin");if(!Xe.test(r.topicId)||!za.test(r.commit)||r.topicId!==(t.topicId??
|
|
2189
|
+
r.topicId)||r.commit!==(t.commit??r.commit)||!/^\d+\.\d+\.\d+$/u.test(r.release)||!iA.test(r.repository)||!Gr.test(r.topicHash))
|
|
2189
2190
|
throw new Error("Installed pin does not match the requested topic, commit or canonical source identity.");if(r.topicHash!==
|
|
2190
2191
|
(t.topicHash??r.topicHash))throw new Error("Installed topic differs from the trusted course or attempt pin.");return r}async function Fr(e,t){
|
|
2191
|
-
let r=await
|
|
2192
|
+
let r=await tA(e);if(r.isSymbolicLink()||await oA(e)!==e)throw new Error("Installed content cannot use symlink or direct\
|
|
2192
2193
|
ory aliases.");if(t?!r.isDirectory():!r.isFile())throw new Error(`Installed content needs a regular ${t?"directory":"fil\
|
|
2193
2194
|
e"}.`);return r}async function Xt(e,t){if((await Fr(e,!1)).size>t)throw new Error(`Installed file exceeds its ${t}-byte \
|
|
2194
|
-
limit.`);let n=await
|
|
2195
|
-
let t=[],r=0;async function n(o){await Fr(o,!0);for(let i of await
|
|
2195
|
+
limit.`);let n=await rA(e);if(n.length>t)throw new Error(`Installed file exceeds its ${t}-byte limit.`);return n}async function aA(e){
|
|
2196
|
+
let t=[],r=0;async function n(o){await Fr(o,!0);for(let i of await nA(o,{withFileTypes:!0})){if(++r>65536)throw new Error(
|
|
2196
2197
|
"Installed snapshot exceeds 65536 directory entries.");let s=G.join(o,i.name);i.isDirectory()?await n(s):(await Fr(s,!1),
|
|
2197
|
-
t.push(G.relative(e,s).split(G.sep).join("/")))}}return await n(e),t.sort()}function Hr({systemRoot:e}){return
|
|
2198
|
-
function
|
|
2198
|
+
t.push(G.relative(e,s).split(G.sep).join("/")))}}return await n(e),t.sort()}function Hr({systemRoot:e}){return uA(e,cA)}
|
|
2199
|
+
function uA(e,t){if(typeof e!="string"||!e||!G.isAbsolute(e))throw new Error("Installed teaching content needs an absolu\
|
|
2199
2200
|
te server-owned system root.");let r=G.resolve(e),n=new Map;function o(f){return ko(`Lesson ${f.lesson.code} ("${f.lesson.
|
|
2200
2201
|
title}") cannot be taught by this version of Vibe64: ${f.problem} Update the course in Courses, or ask its authors for a\
|
|
2201
2202
|
fixed release.`,"VIBE64_TRAINING_LESSON_UNUSABLE",422,{params:{lessonCode:f.lesson.code,lessonTitle:f.lesson.title,problem:f.
|
|
2202
|
-
problem}})}async function i(f={}){let m=await s(f);return{...m,bundles:m.bundles.map(y=>({...y,lesson:
|
|
2203
|
-
topicId:f,commit:m,topicHash:y}={}){if(typeof f!="string"||typeof m!="string"||!Xe.test(f)||!
|
|
2203
|
+
problem}})}async function i(f={}){let m=await s(f);return{...m,bundles:m.bundles.map(y=>({...y,lesson:Ba(y.lesson)}))}}async function s({
|
|
2204
|
+
topicId:f,commit:m,topicHash:y}={}){if(typeof f!="string"||typeof m!="string"||!Xe.test(f)||!za.test(m))throw new Error(
|
|
2204
2205
|
"Choose a valid topic ID and its exact 40-character lowercase Git commit.");if(typeof y!="string"||!Gr.test(y))throw new Error(
|
|
2205
2206
|
"Provide the trusted 64-character topic hash from the course or saved attempt.");let E=JSON.stringify([f,m,y]),T=n.get(E);
|
|
2206
2207
|
return T||(T=a({topicId:f,commit:m,topicHash:y}).finally(()=>n.delete(E)),n.set(E,T)),structuredClone(await T)}async function a({
|
|
2207
2208
|
topicId:f,commit:m,topicHash:y}){try{let E=G.join(r,"training"),T=G.join(E,"content"),S=G.join(T,f),v=G.join(S,m);for(let ce of[
|
|
2208
2209
|
r,E,T,S,v])await Fr(ce,!0);let R=Et(JSON.parse((await Xt(G.join(v,"pin.json"),4096)).toString("utf8")),{topicId:f,commit:m,
|
|
2209
|
-
topicHash:y}),O=JSON.parse((await Xt(G.join(v,"bundle.json"),32*1024*1024)).toString("utf8")),A=G.join(v,"files"),$=await
|
|
2210
|
+
topicHash:y}),O=JSON.parse((await Xt(G.join(v,"bundle.json"),32*1024*1024)).toString("utf8")),A=G.join(v,"files"),$=await aA(
|
|
2210
2211
|
A),P=await bt(A,{installed:!0}),C={schemaVersion:1,topic:P.topic,release:P.release,topicHash:P.topicHash,topicManifest:P.
|
|
2211
|
-
topicManifest,lessons:P.bundles.map(({lesson:ce,hash:me,status:Uo,required:
|
|
2212
|
-
required:
|
|
2212
|
+
topicManifest,lessons:P.bundles.map(({lesson:ce,hash:me,status:Uo,required:cg,manifest:ug})=>({code:ce.code,hash:me,status:Uo,
|
|
2213
|
+
required:cg,manifest:ug}))};if(V(O)!==V(C))throw new Error("Installed bundle is incomplete, reordered, unsupported or ch\
|
|
2213
2214
|
anged from its source files.");if(P.topic.topicId!==R.topicId||P.release!==R.release||P.topicHash!==R.topicHash)throw new Error(
|
|
2214
2215
|
"Installed topic identity differs from its pin.");let D=_t([P.topicManifest,...P.bundles.map(ce=>ce.manifest)]);if(V($)!==
|
|
2215
2216
|
V(D.map(ce=>ce.path).sort()))throw new Error("Installed snapshot has missing or unrecorded files.");let Y=await Xt(G.join(
|
|
@@ -2223,7 +2224,7 @@ async function c({pin:f,manifest:m},y,E){let T=G.join(r,"training","content",f.t
|
|
|
2223
2224
|
E),v=G.relative(T,S).split(G.sep).join("/"),R=m.files.find(A=>A.path===v);if(!R)throw new Error("Lesson requested an unr\
|
|
2224
2225
|
ecorded installed file.");let O=await Xt(S,1024*1024);if(O.length!==R.bytes||ne(O)!==R.sha256)throw new Error("Installed\
|
|
2225
2226
|
lesson changed while reading. Ask the owner to reinstall the verified snapshot.");return{path:v,bytes:O}}async function u({
|
|
2226
|
-
topicId:f,commit:m,topicHash:y,lessonCode:E,lessonHash:T}={}){if(typeof f!="string"||!Xe.test(f)||typeof m!="string"||!
|
|
2227
|
+
topicId:f,commit:m,topicHash:y,lessonCode:E,lessonHash:T}={}){if(typeof f!="string"||!Xe.test(f)||typeof m!="string"||!za.
|
|
2227
2228
|
test(m)||typeof y!="string"||!Gr.test(y)||typeof E!="string"||!Xe.test(E)||typeof T!="string"||!Gr.test(T))throw new Error(
|
|
2228
2229
|
"Choose an exact pinned topic and lesson identity.");try{let S=G.join(r,"training"),v=G.join(S,"content"),R=G.join(v,f),
|
|
2229
2230
|
O=G.join(R,m);for(let me of[r,S,v,R,O])await Fr(me,!0);let A=Et(JSON.parse((await Xt(G.join(O,"pin.json"),4096)).toString(
|
|
@@ -2234,9 +2235,9 @@ lessons.find(me=>me.code===E);if(!C||!D||!Y||C.hash!==T||ne(V(Y.manifest))!==T)t
|
|
|
2234
2235
|
t differs from the trusted content hash.");if(!t(C.status))throw new Error(`Lesson ${E} is draft and cannot be taught. C\
|
|
2235
2236
|
hoose a published lesson.`);let ae={pin:A,manifest:Y.manifest,hash:T,descriptorPath:D.descriptor},Qe=await c(ae,".",D.descriptor),
|
|
2236
2237
|
ce=Oo(JSON.parse(Qe.bytes.toString("utf8")),E);if(ce.code!==E)throw new Error("Installed lesson descriptor identity chan\
|
|
2237
|
-
ged.");return{...ae,lesson:
|
|
2238
|
+
ged.");return{...ae,lesson:Ba(ce)}}catch(S){let v=new Error(`Pinned teaching identity ${f}@${m} is invalid: ${S.message}\
|
|
2238
2239
|
Ask the owner to restore the exact snapshot.`,{cause:S});throw v.code=["ENOENT","ENOTDIR"].includes(S.code)?"VIBE64_TRA\
|
|
2239
|
-
INING_CONTENT_MISSING":"VIBE64_TRAINING_CONTENT_INVALID",v}}async function d(f={}){let m=await p(f);return{...m,lesson:
|
|
2240
|
+
INING_CONTENT_MISSING":"VIBE64_TRAINING_CONTENT_INVALID",v}}async function d(f={}){let m=await p(f);return{...m,lesson:Ba(
|
|
2240
2241
|
m.lesson)}}async function p({topicId:f,commit:m,topicHash:y,lessonCode:E,lessonHash:T}={}){if(typeof E!="string"||typeof T!=
|
|
2241
2242
|
"string"||!Xe.test(E)||!Gr.test(T))throw new Error("Choose a declared lesson code and its exact 64-character lowercase c\
|
|
2242
2243
|
ontent hash.");let S=await s({topicId:f,commit:m,topicHash:y}),v=S.bundles.find(O=>O.lesson.code===E);if(!v)throw new Error(
|
|
@@ -2246,14 +2247,14 @@ pinned revision or explicitly start a new attempt.`);if(v.problem)throw o(v);let
|
|
|
2246
2247
|
ies","facts"].map(O=>[O,[...S.topic[O]||[]]]));return{pin:S.pin,lesson:v.lesson,manifest:v.manifest,hash:v.hash,descriptorPath:v.
|
|
2247
2248
|
descriptorPath,declarations:R}}async function g(f={}){let m=await d(f),y=G.dirname(m.descriptorPath);async function E(O){
|
|
2248
2249
|
let A=await c(m,y,O);return{path:A.path,text:A.bytes.toString("utf8")}}let T=[];for(let O of m.lesson.visuals){let A=await E(
|
|
2249
|
-
O.descriptor);T.push({id:O.id,descriptorPath:A.path,visual:JSON.parse(A.text)})}if(
|
|
2250
|
+
O.descriptor);T.push({id:O.id,descriptorPath:A.path,visual:JSON.parse(A.text)})}if(Pe(m.lesson)){let O=Po(m.declarations),
|
|
2250
2251
|
A=[];for(let $ of m.lesson.steps){let{body:P,beats:C}=No((await E($.body)).text,O);A.push({...$,bodyText:P,...C?{beats:C}:
|
|
2251
2252
|
{}})}return{...m,steps:A,...m.lesson.notes===void 0?{}:{notesText:(await E(m.lesson.notes)).text},visuals:T}}if(m.lesson.
|
|
2252
2253
|
schemaVersion!==1)throw new Error(`Lesson ${m.lesson.code} uses an unsupported format.`);let S=await E(m.lesson.document),
|
|
2253
2254
|
v=m.lesson.assessments.map(O=>({id:O.id,reference:O.rubric,position:new RegExp(`^<a id="${O.id}"></a>$`,"mu").exec(S.text).
|
|
2254
2255
|
index})).sort((O,A)=>O.position-A.position),R=v.map((O,A)=>({id:O.id,reference:O.reference,text:S.text.slice(O.position,
|
|
2255
2256
|
v[A+1]?.position??S.text.length)}));return{...m,document:S,rubrics:R,visuals:T}}async function h({stepId:f,...m}={}){if(typeof f!=
|
|
2256
|
-
"string"||!Xe.test(f))throw new Error("Choose a declared step ID.");let{pin:y,lesson:E,hash:T}=await p(m);if(!
|
|
2257
|
+
"string"||!Xe.test(f))throw new Error("Choose a declared step ID.");let{pin:y,lesson:E,hash:T}=await p(m);if(!Pe(E))throw new Error(
|
|
2257
2258
|
`Lesson ${E.code} has no steps.`);let S=E.steps.find(v=>v.id===f);if(!S)throw new Error(`Step ${f} is not declared in th\
|
|
2258
2259
|
is pinned lesson.`);if(S.check.kind!=="choice")throw new Error(`Step ${f} is not a choice step.`);return{pin:y,lessonCode:E.
|
|
2259
2260
|
code,lessonHash:T,stepId:f,answer:[...S.check.answer]}}async function l({topicId:f,commit:m,topicHash:y,lessonCode:E,lessonHash:T,
|
|
@@ -2273,44 +2274,44 @@ new Error(`Lesson ${E} has no declared bundled exercise.`),{code:"VIBE64_TRAININ
|
|
|
2273
2274
|
G.posix.dirname(O.descriptorPath),A.source),P={pin:O.pin,lessonCode:O.lesson.code,lessonHash:O.hash,exercise:A,sourcePath:$};
|
|
2274
2275
|
if(S===!0)return P;let C=$==="."?"":`${$}/`,D=[];for(let Y of O.manifest.files){if(!Y.path.startsWith(C))continue;let ae=Y.
|
|
2275
2276
|
path.slice(C.length),Qe=await c(O,$,ae);D.push({path:ae,bytes:Qe.bytes})}return{...P,files:D}}return Object.freeze({readTopic:i,
|
|
2276
|
-
readLesson:g,readAdmissionIdentity:u,readVisual:l,readCheck:w,readExercise:_,readChoiceAnswer:h})}var Xe,
|
|
2277
|
-
|
|
2278
|
-
|
|
2277
|
+
readLesson:g,readAdmissionIdentity:u,readVisual:l,readCheck:w,readExercise:_,readChoiceAnswer:h})}var Xe,za,Gr,iA,zr,sA,
|
|
2278
|
+
cA,Ga=b(()=>{To();Jt();Wt();Va();Co();Yh();Yt();$o();Xe=/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u,za=/^[a-f0-9]{40}$/u,Gr=/^[a-f0-9]{64}$/u,
|
|
2279
|
+
iA=/^[a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+$/u,zr={type:"string",required:!0,noTrim:!0,minLength:1,maxLength:256},sA=L({
|
|
2279
2280
|
schemaVersion:{type:"integer",required:!0,enum:[1]},topicId:{...zr,maxLength:64},release:zr,repository:zr,commit:{...zr,
|
|
2280
|
-
maxLength:40},topicHash:{...zr,maxLength:64}});
|
|
2281
|
-
import oe from"node:path";function
|
|
2282
|
-
root)throw new Error(`${t} must be a normalized absolute, non-root server-owned directory.`);return e}function
|
|
2283
|
-
relative(e,t);return!r||r!==".."&&!r.startsWith(`..${oe.sep}`)&&!oe.isAbsolute(r)}async function
|
|
2284
|
-
n=await
|
|
2281
|
+
maxLength:40},topicHash:{...zr,maxLength:64}});cA=e=>e==="published"});import{randomUUID as lA}from"node:crypto";import{lstat as dA,mkdir as Ha,realpath as fA,rename as pA,rm as mA,writeFile as hA}from"node:fs/promises";
|
|
2282
|
+
import oe from"node:path";function Jh(e,t){if(typeof e!="string"||!oe.isAbsolute(e)||oe.resolve(e)!==e||e===oe.parse(e).
|
|
2283
|
+
root)throw new Error(`${t} must be a normalized absolute, non-root server-owned directory.`);return e}function Kh(e,t){let r=oe.
|
|
2284
|
+
relative(e,t);return!r||r!==".."&&!r.startsWith(`..${oe.sep}`)&&!oe.isAbsolute(r)}async function je(e,t,r=!0){let n;try{
|
|
2285
|
+
n=await dA(e)}catch(o){if(r&&o.code==="ENOENT")return null;throw o}if(n.isSymbolicLink()||await fA(e)!==e)throw new Error(
|
|
2285
2286
|
"Training installation cannot use symlink or directory aliases.");if(t?!n.isDirectory():!n.isFile())throw new Error(`Tra\
|
|
2286
2287
|
ining installation needs a regular ${t?"directory":"file"}: ${e}.`);if(!t&&(n.nlink!==1||n.size!==0))throw new Error("Tr\
|
|
2287
2288
|
aining installation lock must be an unaliased empty regular file; inspect it before retrying.");return n}async function Lo(e,t=!1){
|
|
2288
|
-
let r=oe.dirname(e);return r!==e&&await Lo(r,t),
|
|
2289
|
-
code!=="EEXIST")throw t}await
|
|
2290
|
-
pshot conflicts with the approved owner pin. Keep existing content and check the exact source revision.")}async function
|
|
2289
|
+
let r=oe.dirname(e);return r!==e&&await Lo(r,t),je(e,!0,t)}async function gA(e){try{await Ha(e,{mode:448})}catch(t){if(t.
|
|
2290
|
+
code!=="EEXIST")throw t}await je(e,!0,!1)}function Mo(e,t){if(V(e)!==V(t))throw new Error("Topic source or installed sna\
|
|
2291
|
+
pshot conflicts with the approved owner pin. Keep existing content and check the exact source revision.")}async function Fa(e,t){
|
|
2291
2292
|
let{topicId:r,release:n,repository:o,commit:i,topicHash:s}=await Ur(e);Mo({schemaVersion:1,topicId:r,release:n,repository:o,
|
|
2292
|
-
commit:i,topicHash:s},t)}function
|
|
2293
|
-
sourceRoot:o,pin:i}={}){let s={...Et(i)};
|
|
2293
|
+
commit:i,topicHash:s},t)}function Xh({systemRoot:e}){let t=Jh(e,"Training system root"),r=Hr({systemRoot:t});async function n({
|
|
2294
|
+
sourceRoot:o,pin:i}={}){let s={...Et(i)};Jh(o,"Trusted topic source root");let a=oe.join(t,"training");if(Kh(o,a)||Kh(a,
|
|
2294
2295
|
o))throw new Error("Trusted topic source must be separate from the training installation namespace.");let c=oe.join(a,"c\
|
|
2295
2296
|
ontent"),u=oe.join(c,s.topicId),d=oe.join(u,s.commit),p=oe.join(a,".install-locks"),g=oe.join(p,`${s.topicId}-${s.commit}\
|
|
2296
|
-
.lock`);await Lo(t);let h=await Lo(o,!0);for(let f of[a,c,u,p])await
|
|
2297
|
+
.lock`);await Lo(t);let h=await Lo(o,!0);for(let f of[a,c,u,p])await je(f,!0);if(await je(g,!1),await je(d,!0))Mo((await r.
|
|
2297
2298
|
readTopic(s)).pin,s);else{if(!h)throw new Error("Trusted topic source is missing. Prepare the approved local repository \
|
|
2298
|
-
before installing its pin.");await
|
|
2299
|
+
before installing its pin.");await Fa(o,s)}for(let f of[a,c,u,p])await gA(f);let w=await Dt(g);if(!w)throw ko("This topi\
|
|
2299
2300
|
c revision is being installed. Retry after the current owner operation finishes.","VIBE64_TRAINING_INSTALL_BUSY");let _;
|
|
2300
|
-
try{await
|
|
2301
|
-
T.pin,s),{installed:!1,...T}}await Lo(o),await
|
|
2302
|
-
join(_,"training","content",s.topicId);await
|
|
2303
|
-
e",o,y],{write(){}}),await
|
|
2304
|
-
`,{flag:"wx",mode:384}),await Hr({systemRoot:_}).readTopic(s),await
|
|
2305
|
-
ination appeared during installation. Keep it unchanged and retry the verified pin.");await
|
|
2306
|
-
s);return Mo(E.pin,s),{installed:!0,...E}}finally{try{_&&await
|
|
2307
|
-
freeze({installTopic:n})}var
|
|
2301
|
+
try{await je(g,!1,!1);for(let T of[t,a,c,u,p])await je(T,!0,!1);if(await je(d,!0)){let T=await r.readTopic(s);return Mo(
|
|
2302
|
+
T.pin,s),{installed:!1,...T}}await Lo(o),await Fa(o,s);let f=oe.join(a,`.install-${lA()}`);await Ha(f,{mode:448}),_=f;let m=oe.
|
|
2303
|
+
join(_,"training","content",s.topicId);await Ha(m,{recursive:!0,mode:448});let y=oe.join(m,s.commit);if(await qa(["bundl\
|
|
2304
|
+
e",o,y],{write(){}}),await Fa(o,s),await hA(oe.join(y,"pin.json"),`${V(s)}
|
|
2305
|
+
`,{flag:"wx",mode:384}),await Hr({systemRoot:_}).readTopic(s),await je(u,!0,!1),await je(d,!0))throw new Error("The dest\
|
|
2306
|
+
ination appeared during installation. Keep it unchanged and retry the verified pin.");await pA(y,d);let E=await r.readTopic(
|
|
2307
|
+
s);return Mo(E.pin,s),{installed:!0,...E}}finally{try{_&&await mA(_,{recursive:!0,force:!0})}finally{await w()}}}return Object.
|
|
2308
|
+
freeze({installTopic:n})}var Zh=b(()=>{Yn();xo();Wa();Jt();$o();Ga()});import{lstat as yA,mkdir as wA,readFile as _A,realpath as bA}from"node:fs/promises";import Ze from"node:path";function Ja(e){
|
|
2308
2309
|
if(!Number.isSafeInteger(e)||e<0)throw new Error("Supply the expected revision from a fresh installed catalogue read.")}
|
|
2309
|
-
function
|
|
2310
|
+
function Ka({systemRoot:e}){if(typeof e!="string"||!Ze.isAbsolute(e)||Ze.resolve(e)!==e||e===Ze.parse(e).root)throw new Error(
|
|
2310
2311
|
"Installed catalogue needs a canonical absolute, non-root server-owned system root.");let t=Ze.join(e,"training"),r=Ze.join(
|
|
2311
2312
|
t,"catalogue.json"),n=Ze.join(t,"catalogue.lock"),o=Hr({systemRoot:e});async function i(){let _=[t];for(let y=e;_.unshift(
|
|
2312
|
-
y),y!==Ze.dirname(y);y=Ze.dirname(y));let f=!1,m=null;for(let y of[..._,r,n]){let E;try{E=await
|
|
2313
|
-
"ENOENT")continue;throw S}let T=y!==r&&y!==n;if(E.isSymbolicLink()||await
|
|
2313
|
+
y),y!==Ze.dirname(y);y=Ze.dirname(y));let f=!1,m=null;for(let y of[..._,r,n]){let E;try{E=await yA(y)}catch(S){if(S.code===
|
|
2314
|
+
"ENOENT")continue;throw S}let T=y!==r&&y!==n;if(E.isSymbolicLink()||await bA(y)!==y||(T?!E.isDirectory():!E.isFile()||E.
|
|
2314
2315
|
nlink!==1))throw new Error("Installed catalogue paths must be canonical directories and unaliased regular files.");if(y===
|
|
2315
2316
|
e&&(f=!0),y===r&&(m=E),y===n&&E.size!==0)throw new Error("Installed catalogue lock contains unexplained data. Inspect it\
|
|
2316
2317
|
; do not unlink it.")}return{rootExists:f,catalogueStat:m}}async function s(_){let f=_.lock.topics;if(!Array.isArray(f)||
|
|
@@ -2324,69 +2325,69 @@ topicManifest,topicHash:R.topicHash})}let T=Br(_.course,m);if(V(_.lock)!==V(T))t
|
|
|
2324
2325
|
differs from the complete installed topic inventory. Regenerate and review its exact release.");return{lessonTitles:y,topicTitles:E}}
|
|
2325
2326
|
async function a({includeLessonTitles:_=!1}={}){if(typeof _!="boolean")throw new TypeError("Lesson title projection requ\
|
|
2326
2327
|
ires an explicit Boolean read option.");try{let{catalogueStat:f}=await i();if(!f)return{schemaVersion:1,revision:0,courses:[]};
|
|
2327
|
-
if(f.size>
|
|
2328
|
-
"Installed catalogue exceeds its 1 MiB limit.");let y=
|
|
2328
|
+
if(f.size>Ya)throw new Error("Installed catalogue exceeds its 1 MiB limit.");let m=await _A(r);if(m.length>Ya)throw new Error(
|
|
2329
|
+
"Installed catalogue exceeds its 1 MiB limit.");let y=_e(EA,JSON.parse(m.toString("utf8")),"Installed catalogue");if(y.courses.
|
|
2329
2330
|
length&&y.revision<1)throw new Error("Installed catalogue revision conflicts with its course inventory.");let E=new Set;
|
|
2330
2331
|
for(let T of y.courses){let S=`${T.course.courseId}@${T.course.release}`;if(E.has(S))throw new Error("Installed catalogu\
|
|
2331
2332
|
e contains duplicate course releases.");E.add(S);let{lessonTitles:v,topicTitles:R}=await s(T);_&&Object.assign(T,{lessonTitles:v,
|
|
2332
|
-
topicTitles:R})}return y}catch(f){throw
|
|
2333
|
+
topicTitles:R})}return y}catch(f){throw Ua(`Installed catalogue is invalid: ${f.message} Keep existing state and ask the\
|
|
2333
2334
|
owner to restore the exact approved catalogue or pinned content. No automatic repair was performed.`,"VIBE64_TRAINING_C\
|
|
2334
2335
|
ATALOGUE_INVALID",f)}}async function c(){let{rootExists:_}=await i();if(!_)throw new Error("Prepare the server-owned sys\
|
|
2335
|
-
tem root before changing the catalogue.");try{await
|
|
2336
|
-
n);if(!f)throw
|
|
2337
|
-
NING_CATALOGUE_BUSY",409);return f}function u(_,f){if(_.revision!==f)throw
|
|
2336
|
+
tem root before changing the catalogue.");try{await wA(t,{mode:448})}catch(m){if(m.code!=="EEXIST")throw m}await i();let f=await Dt(
|
|
2337
|
+
n);if(!f)throw Ne("Installed catalogue is being updated. Retry after the current owner operation finishes.","VIBE64_TRAI\
|
|
2338
|
+
NING_CATALOGUE_BUSY",409);return f}function u(_,f){if(_.revision!==f)throw Ne("Installed catalogue changed. Read its cur\
|
|
2338
2339
|
rent revision before deliberately retrying this enablement change.","VIBE64_TRAINING_CATALOGUE_REVISION_CONFLICT",409)}async function d(_,f){
|
|
2339
2340
|
if(_.revision===Number.MAX_SAFE_INTEGER)throw new Error("Installed catalogue reached its revision limit. No change was w\
|
|
2340
2341
|
ritten.");let m={..._,revision:_.revision+1};if(Buffer.byteLength(`${JSON.stringify(m,null,2)}
|
|
2341
|
-
`)>
|
|
2342
|
-
fileMode:384})}catch(y){throw
|
|
2342
|
+
`)>Ya)throw new Error("Installed catalogue exceeds its 1 MiB limit. No change was written.");try{await Dn(r,m,{directoryMode:448,
|
|
2343
|
+
fileMode:384})}catch(y){throw Ua("Catalogue save was not confirmed; atomic rename may already have succeeded. Read the c\
|
|
2343
2344
|
urrent catalogue before deliberately retrying. Do not assume the course changed or remained unchanged.","VIBE64_TRAINING\
|
|
2344
2345
|
_CATALOGUE_SAVE_UNCONFIRMED",y)}return{revision:m.revision,entry:f,changed:!0}}async function p({course:_,lock:f,expectedRevision:m}={}){
|
|
2345
|
-
|
|
2346
|
+
Ja(m);let y=structuredClone(_e(Qh,{course:_,lock:f,enabled:!0},"Approved installed course"));await a(),await s(y);let E=await c();
|
|
2346
2347
|
try{let T=await a();u(T,m),await s(y);let S=T.courses.find(v=>v.course.courseId===y.course.courseId&&v.course.release===
|
|
2347
|
-
y.course.release);if(S){if(V(S.course)!==V(y.course)||V(S.lock)!==V(y.lock))throw
|
|
2348
|
+
y.course.release);if(S){if(V(S.course)!==V(y.course)||V(S.lock)!==V(y.lock))throw Ne("This installed course release is i\
|
|
2348
2349
|
mmutable. Resume its approved pin or publish and approve a different course release.","VIBE64_TRAINING_COURSE_RELEASE_CO\
|
|
2349
2350
|
NFLICT",409);return S.enabled?{revision:T.revision,entry:S,changed:!1}:(S.enabled=!0,await d(T,S))}if(T.courses.length>=
|
|
2350
2351
|
qr)throw new Error("Installed catalogue reached its 16 course-release limit. Remove a release with vibe64 training remov\
|
|
2351
2352
|
e-course to free a place; no release was removed.");return T.courses.push(y),await d(T,y)}finally{await E()}}async function g({
|
|
2352
|
-
courseId:_,release:f,expectedRevision:m},y){if(
|
|
2353
|
+
courseId:_,release:f,expectedRevision:m},y){if(Ja(m),typeof _!="string"||!/^[a-z][a-z0-9-]{0,63}$/u.test(_)||typeof f!="\
|
|
2353
2354
|
string"||!/^\d+\.\d+\.\d+$/u.test(f))throw new Error(`${y?"Remove":"Disable"} an exact installed course ID and three-par\
|
|
2354
|
-
t release.`);if(!(await a()).courses.some(S=>S.course.courseId===_&&S.course.release===f))throw
|
|
2355
|
+
t release.`);if(!(await a()).courses.some(S=>S.course.courseId===_&&S.course.release===f))throw Ne("This course release \
|
|
2355
2356
|
is not installed in the catalogue. Read the current catalogue before retrying.","VIBE64_TRAINING_COURSE_MISSING",404);let T=await c();
|
|
2356
|
-
try{let S=await a();u(S,m);let v=S.courses.find(R=>R.course.courseId===_&&R.course.release===f);if(!v)throw
|
|
2357
|
+
try{let S=await a();u(S,m);let v=S.courses.find(R=>R.course.courseId===_&&R.course.release===f);if(!v)throw Ne("This cou\
|
|
2357
2358
|
rse release is no longer in the catalogue. Read the current catalogue before retrying.","VIBE64_TRAINING_COURSE_REMOVED",
|
|
2358
2359
|
404);return y?(S.courses=S.courses.filter(R=>R!==v),await d(S,v)):v.enabled?(v.enabled=!1,await d(S,v)):{revision:S.revision,
|
|
2359
2360
|
entry:v,changed:!1}}finally{await T()}}let h=_=>g(_,!1),l=_=>g(_,!0);async function w({title:_,topics:f,expectedRevision:m}){
|
|
2360
|
-
|
|
2361
|
+
Ja(m);let y=typeof _=="string"?_.trim():"";if(!y||y.length>120)throw Ne("Name the course with 1 to 120 characters.","VIB\
|
|
2361
2362
|
E64_TRAINING_COURSE_NAME_INVALID",400);if(!Array.isArray(f)||!f.length||f.length>32||new Set(f.map(A=>`${A?.topicId}@${A?.
|
|
2362
|
-
release}`)).size!==f.length||new Set(f.map(A=>A?.topicId)).size!==f.length)throw
|
|
2363
|
+
release}`)).size!==f.length||new Set(f.map(A=>A?.topicId)).size!==f.length)throw Ne("Choose 1 to 32 different whole topi\
|
|
2363
2364
|
cs for the course.","VIBE64_TRAINING_COURSE_TOPICS_INVALID",400);let E=await a(),T=E.courses.filter(A=>A.enabled&&A.course.
|
|
2364
2365
|
status==="released").flatMap(A=>A.lock.topics),S=[];for(let A of f){let $=T.find(C=>C.topicId===A.topicId&&C.release===A.
|
|
2365
|
-
release);if(!$)throw
|
|
2366
|
+
release);if(!$)throw Ne(`Topic ${A.topicId}@${A.release} is not part of an enabled released course. Refresh courses and \
|
|
2366
2367
|
choose an installed topic.`,"VIBE64_TRAINING_COURSE_TOPIC_UNAVAILABLE",404);let P=await o.readTopic(Et({schemaVersion:1,
|
|
2367
2368
|
topicId:$.topicId,release:$.release,repository:$.repository,commit:$.commit,topicHash:$.manifestHash}));S.push({topicId:P.
|
|
2368
2369
|
pin.topicId,release:P.release,repository:P.pin.repository,commit:P.pin.commit,topicManifest:P.topicManifest,topicHash:P.
|
|
2369
2370
|
topicHash})}let R={schemaVersion:1,courseId:`custom-${y.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"").
|
|
2370
2371
|
slice(0,48).replace(/-+$/u,"")||ne(y).slice(0,12)}`,title:y,release:"1.0.0",status:"released",topics:f.map(A=>({topicId:A.
|
|
2371
|
-
topicId,release:A.release}))},O=E.courses.find(A=>A.course.courseId===R.courseId);if(O&&V(O.course)!==V(R))throw
|
|
2372
|
+
topicId,release:A.release}))},O=E.courses.find(A=>A.course.courseId===R.courseId);if(O&&V(O.course)!==V(R))throw Ne("A c\
|
|
2372
2373
|
ourse with this name already exists. Choose another name.","VIBE64_TRAINING_COURSE_EXISTS",409);if(!O&&E.courses.length>=
|
|
2373
2374
|
qr)throw Kt(`This installation already has ${qr} course releases. No course was created.`,"VIBE64_TRAINING_COURSE_CREATE\
|
|
2374
2375
|
_LIMIT",{statusCode:409,params:{limit:qr}});return p({course:R,lock:Br(R,S),expectedRevision:m})}return Object.freeze({readCatalogue:a,
|
|
2375
|
-
enableCourse:p,disableCourse:h,removeCourse:l,createCourse:w})}var qr,
|
|
2376
|
-
$o();Yt();qr=16,
|
|
2377
|
-
type:"boolean",required:!0}}),
|
|
2378
|
-
min:0,max:Number.MAX_SAFE_INTEGER},courses:W(
|
|
2379
|
-
import Z from"node:path";import{randomUUID as
|
|
2376
|
+
enableCourse:p,disableCourse:h,removeCourse:l,createCourse:w})}var qr,Ya,Qh,EA,eg=b(()=>{To();Yn();yr();xo();Jt();Wt();Ga();
|
|
2377
|
+
$o();Yt();qr=16,Ya=1024*1024,Qh=L({course:{type:"object",required:!0,schema:Ao},lock:{type:"object",required:!0},enabled:{
|
|
2378
|
+
type:"boolean",required:!0}}),EA=L({schemaVersion:{type:"integer",required:!0,enum:[1]},revision:{type:"integer",required:!0,
|
|
2379
|
+
min:0,max:Number.MAX_SAFE_INTEGER},courses:W(Qh,qr)})});var ng={};zo(ng,{runTrainingCli:()=>qa});import{mkdir as tg,readFile as Do,realpath as Zt,rename as SA,rm as rg,writeFile as Xa}from"node:fs/promises";
|
|
2380
|
+
import Z from"node:path";import{randomUUID as vA}from"node:crypto";async function qa(e,{write:t=r=>console.log(r)}={}){if(e[0]===
|
|
2380
2381
|
"install-topic"){let[,c,u]=e;if(e.length!==3||!c||!u)throw new Error("Usage: vibe64 training install-topic <committed-to\
|
|
2381
2382
|
pic-directory> <system-root>");let d=await Zt(c),{topicId:p,release:g,repository:h,commit:l,topicHash:w}=await Ur(d),_={
|
|
2382
|
-
schemaVersion:1,topicId:p,release:g,repository:h,commit:l,topicHash:w},f=await
|
|
2383
|
+
schemaVersion:1,topicId:p,release:g,repository:h,commit:l,topicHash:w},f=await Xh({systemRoot:Z.resolve(u)}).installTopic(
|
|
2383
2384
|
{sourceRoot:d,pin:_});return t(JSON.stringify({ok:!0,installed:f.installed,pin:f.pin},null,2)),0}if(e[0]==="installed-co\
|
|
2384
|
-
urses"){if(e.length!==2||!e[1])throw new Error("Usage: vibe64 training installed-courses <system-root>");let c=await
|
|
2385
|
+
urses"){if(e.length!==2||!e[1])throw new Error("Usage: vibe64 training installed-courses <system-root>");let c=await Ka(
|
|
2385
2386
|
{systemRoot:Z.resolve(e[1])}).readCatalogue();return t(JSON.stringify({ok:!0,...c},null,2)),0}if(["enable-course","disab\
|
|
2386
2387
|
le-course","remove-course"].includes(e[0])){let[c,u,d,p,g]=e;if(e.length!==5||!u||!d||!p||!/^(0|[1-9][0-9]*)$/u.test(g||
|
|
2387
2388
|
"")||!Number.isSafeInteger(Number(g)))throw new Error(c==="enable-course"?"Usage: vibe64 training enable-course <course.\
|
|
2388
2389
|
json> <course.lock.json> <system-root> <expected-revision>":`Usage: vibe64 training ${c} <courseId> <release> <system-ro\
|
|
2389
|
-
ot> <expected-revision>`);let h=
|
|
2390
|
+
ot> <expected-revision>`);let h=Ka({systemRoot:Z.resolve(p)}),l=Number(g),w=c==="enable-course"?await h.enableCourse({course:JSON.
|
|
2390
2391
|
parse(await Do(u,"utf8")),lock:JSON.parse(await Do(d,"utf8")),expectedRevision:l}):await h[c==="remove-course"?"removeCo\
|
|
2391
2392
|
urse":"disableCourse"]({courseId:u,release:d,expectedRevision:l});return t(JSON.stringify({ok:!0,...w},null,2)),0}if(e[0]===
|
|
2392
2393
|
"publish-manifest"){let[,c,...u]=e;if(!c||!u.length)throw new Error("Usage: vibe64 training publish-manifest <course.jso\
|
|
@@ -2394,70 +2395,70 @@ n> <committed-topic-directory...>");let d=await Zt(c),p=Z.join(await Zt(Z.dirnam
|
|
|
2394
2395
|
d||Z.basename(c)==="course.lock.json")throw new Error("Course lock output must not replace its input course descriptor.");
|
|
2395
2396
|
let g=JSON.parse(await Do(d,"utf8")),h=[];for(let _ of u){let f=await Zt(_),m=Z.relative(f,p);if(!m||!m.startsWith(`..${Z.
|
|
2396
2397
|
sep}`)&&m!==".."&&!Z.isAbsolute(m))throw new Error("Course lock output must be outside every pinned source topic.");await bt(
|
|
2397
|
-
f,{authoring:!0}),h.push(await Ur(f))}let l=Br(g,h),w=`${p}.tmp-${
|
|
2398
|
-
`,{flag:"wx"}),await
|
|
2398
|
+
f,{authoring:!0}),h.push(await Ur(f))}let l=Br(g,h),w=`${p}.tmp-${vA()}`;try{await Xa(w,`${V(l)}
|
|
2399
|
+
`,{flag:"wx"}),await SA(w,p)}finally{await rg(w,{force:!0})}return t(JSON.stringify({ok:!0,courseId:l.courseId,status:l.
|
|
2399
2400
|
status,lockPath:p,topics:l.topics.length},null,2)),0}let[r,n,o]=e;if(!["validate","bundle"].includes(r)||!n||r==="bundle"&&
|
|
2400
2401
|
!o||e.length!==(r==="bundle"?3:2))throw new Error("Usage: vibe64 training validate <topic-directory> | bundle <topic-dir\
|
|
2401
2402
|
ectory> <new-output-directory>");let i=await Zt(n),s=await bt(i,{authoring:r==="validate"}),a={schemaVersion:1,topic:s.topic,
|
|
2402
2403
|
release:s.release,topicHash:s.topicHash,topicManifest:s.topicManifest,lessons:s.bundles.map(({lesson:c,hash:u,status:d,required:p,
|
|
2403
2404
|
manifest:g})=>({code:c.code,hash:u,status:d,required:p,manifest:g}))};if(r==="bundle"){let c=Z.resolve(o),u=Z.join(await Zt(
|
|
2404
2405
|
Z.dirname(c)),Z.basename(c)),d=Z.relative(i,u);if(!d||!d.startsWith(`..${Z.sep}`)&&d!==".."&&!Z.isAbsolute(d))throw new Error(
|
|
2405
|
-
"Bundle output must be outside the source topic.");await
|
|
2406
|
+
"Bundle output must be outside the source topic.");await tg(u);try{let p=_t([s.topicManifest,...s.bundles.map(g=>g.manifest)]);
|
|
2406
2407
|
for(let g of p){let h=await Do(Z.join(i,g.path));if(ne(h)!==g.sha256)throw new Error(`Source changed during bundling: ${g.
|
|
2407
|
-
path}. Validate and retry.`);let l=Z.join(u,"files",g.path);await
|
|
2408
|
-
await
|
|
2409
|
-
`,{flag:"wx"})}catch(p){throw await
|
|
2408
|
+
path}. Validate and retry.`);let l=Z.join(u,"files",g.path);await tg(Z.dirname(l),{recursive:!0}),await Xa(l,h,{flag:"wx"})}
|
|
2409
|
+
await Xa(Z.join(u,"bundle.json"),`${V(a)}
|
|
2410
|
+
`,{flag:"wx"})}catch(p){throw await rg(u,{recursive:!0,force:!0}),p}}return t(JSON.stringify({ok:!0,topicId:s.topic.topicId,
|
|
2410
2411
|
status:s.topic.status,lessons:s.bundles.map(({lesson:c,hash:u,status:d})=>({code:c.code,hash:u,status:d,schemaVersion:c.
|
|
2411
|
-
schemaVersion,...c.stage?{stage:c.stage}:{},...
|
|
2412
|
-
|
|
2413
|
-
import Wr from"node:path";import{fileURLToPath as
|
|
2414
|
-
resolve(String(e||""));try{return t(r)}catch{return r}}function
|
|
2415
|
-
return n?
|
|
2416
|
-
return`'${String(e).replaceAll("'","'\\''")}'`}function
|
|
2417
|
-
"${String(e).replaceAll('"','\\"')}"`}function
|
|
2418
|
-
...t}={}){return
|
|
2412
|
+
schemaVersion,...c.stage?{stage:c.stage}:{},...Pe(c)?{steps:c.steps.length}:{}}))},null,2)),0}var Wa=b(()=>{Jt();Wt();xo();
|
|
2413
|
+
Zh();eg();Yt()});import{spawn as og}from"node:child_process";import{readFileSync as IA}from"node:fs";import{release as Vo}from"node:os";import M from"node:process";
|
|
2414
|
+
import Wr from"node:path";import{fileURLToPath as OA}from"node:url";import{realpathSync as yg}from"node:fs";import wg from"node:path";import _g from"node:process";function Qa(e,t){let r=wg.
|
|
2415
|
+
resolve(String(e||""));try{return t(r)}catch{return r}}function ec({entrypointPath:e,argv:t=_g.argv,realpath:r=yg}){let n=t[1];
|
|
2416
|
+
return n?Qa(n,r)===Qa(e,r):!1}var TA=new URL("./run.js",import.meta.url).href,ig=OA(TA),sg=Wr.dirname(ig),er=Wr.join(sg,"server.js");function Qt(e=""){
|
|
2417
|
+
return`'${String(e).replaceAll("'","'\\''")}'`}function RA(e=""){return JSON.stringify(String(e))}function Za(e=""){return`\
|
|
2418
|
+
"${String(e).replaceAll('"','\\"')}"`}function AA(e="",t=[]){return[Za(e),...t.map(r=>Za(r))].join(" ")}function PA({entrypointPath:e=ig,
|
|
2419
|
+
...t}={}){return ec({entrypointPath:e,...t})}function ag(e=M.cwd()){return Wr.basename(e)||"target"}function CA({env:e=M.
|
|
2419
2420
|
env,osReleaseText:t=Vo(),platform:r=M.platform}={}){return r!=="linux"?!1:String(e.WSL_DISTRO_NAME||e.WSL_INTEROP||"").trim()?
|
|
2420
|
-
!0:/\bmicrosoft\b|\bwsl\b/iu.test(String(t||""))}function
|
|
2421
|
-
return[Qt(e),Qt(t),...r.map(n=>Qt(n))].join(" ")}function
|
|
2421
|
+
!0:/\bmicrosoft\b|\bwsl\b/iu.test(String(t||""))}function NA({nodePath:e=M.execPath,serverPath:t=er,serverArgs:r=[]}={}){
|
|
2422
|
+
return[Qt(e),Qt(t),...r.map(n=>Qt(n))].join(" ")}function jA({cwd:e=M.cwd(),nodePath:t=M.execPath,serverArgs:r=[],serverPath:n=er,
|
|
2422
2423
|
title:o=`Vibe64 - ${Wr.basename(M.cwd())||"target"}`}={}){return["finish_vibe64_terminal() {",' status="$1"',' message\
|
|
2423
2424
|
="$2"',' if [ "$status" -ne 0 ]; then',` printf '\\n%s Exit status %s. Press Enter to close this terminal...' "$messa\
|
|
2424
2425
|
ge" "$status"`," IFS= read -r _"," fi",' exit "$status"',"}",`cd ${Qt(e)}`,"status=$?",'if [ "$status" -ne 0 ]; the\
|
|
2425
2426
|
n',' finish_vibe64_terminal "$status" "Vibe64 could not enter the target directory."',"fi",`printf '\\033]0;%s\\007' ${Qt(
|
|
2426
|
-
o)}`,
|
|
2427
|
-
`)}function
|
|
2428
|
-
distroName:e="",shellScript:t=""}={}){let r=String(e||"").trim();return[...r?["-d",r]:[],"--","bash","-lc",
|
|
2429
|
-
cwd:e=M.cwd(),env:t=M.env,shellScript:r="",title:n=`Vibe64 - ${
|
|
2430
|
-
return[{command:"wt.exe",args:["new-window","--title",n,"wsl.exe",...o]},{command:"cmd.exe",args:["/d","/c",`start ${
|
|
2431
|
-
n)} ${
|
|
2432
|
-
platform,serverArgs:i=[],serverPath:s=er}={}){let a=`Vibe64 - ${
|
|
2433
|
-
title:a});if(o==="darwin")return[{command:"osascript",args:["-e",['tell application "Terminal"',"activate",`do script ${
|
|
2427
|
+
o)}`,NA({nodePath:t,serverArgs:r,serverPath:n}),'finish_vibe64_terminal "$?" "Vibe64 server exited."'].join(`
|
|
2428
|
+
`)}function xA(e=""){return`printf %s ${Buffer.from(String(e||""),"utf8").toString("base64")} | base64 -d | bash`}function kA({
|
|
2429
|
+
distroName:e="",shellScript:t=""}={}){let r=String(e||"").trim();return[...r?["-d",r]:[],"--","bash","-lc",xA(t)]}function $A({
|
|
2430
|
+
cwd:e=M.cwd(),env:t=M.env,shellScript:r="",title:n=`Vibe64 - ${ag(e)}`}={}){let o=kA({distroName:t.WSL_DISTRO_NAME,shellScript:r});
|
|
2431
|
+
return[{command:"wt.exe",args:["new-window","--title",n,"wsl.exe",...o]},{command:"cmd.exe",args:["/d","/c",`start ${Za(
|
|
2432
|
+
n)} ${AA("wsl.exe",o)}`]}]}function LA({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,osReleaseText:n=Vo(),platform:o=M.
|
|
2433
|
+
platform,serverArgs:i=[],serverPath:s=er}={}){let a=`Vibe64 - ${ag(e)}`,c=jA({cwd:e,nodePath:r,serverArgs:i,serverPath:s,
|
|
2434
|
+
title:a});if(o==="darwin")return[{command:"osascript",args:["-e",['tell application "Terminal"',"activate",`do script ${RA(
|
|
2434
2435
|
c)}`,"end tell"].join(`
|
|
2435
2436
|
`)]}];let u=[t.TERMINAL?{command:t.TERMINAL,args:["-e","bash","-lc",c]}:null,{command:"x-terminal-emulator",args:["-e","\
|
|
2436
2437
|
bash","-lc",c]},{command:"gnome-terminal",args:["--","bash","-lc",c]},{command:"konsole",args:["-e","bash","-lc",c]},{command:"\
|
|
2437
|
-
xfce4-terminal",args:["--command",`bash -lc ${Qt(c)}`]},{command:"xterm",args:["-e","bash","-lc",c]}].filter(Boolean);return
|
|
2438
|
-
{env:t,osReleaseText:n,platform:o})?[
|
|
2439
|
-
(n,o)=>{let i=
|
|
2438
|
+
xfce4-terminal",args:["--command",`bash -lc ${Qt(c)}`]},{command:"xterm",args:["-e","bash","-lc",c]}].filter(Boolean);return CA(
|
|
2439
|
+
{env:t,osReleaseText:n,platform:o})?[...$A({cwd:e,env:t,shellScript:c,title:a}),...u]:u}function MA(e,t=[],r={}){return new Promise(
|
|
2440
|
+
(n,o)=>{let i=og(e,t,{...r,detached:!0,stdio:"ignore"});i.once("error",o),i.once("spawn",()=>{i.unref(),n(i)})})}async function DA({
|
|
2440
2441
|
cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,osReleaseText:n=Vo(),platform:o=M.platform,serverArgs:i=[],serverPath:s=er}={}){
|
|
2441
|
-
let a=
|
|
2442
|
+
let a=LA({cwd:e,env:t,nodePath:r,osReleaseText:n,platform:o,serverArgs:i,serverPath:s}),c=[];for(let u of a)try{return await MA(
|
|
2442
2443
|
u.command,u.args,{cwd:e,env:t}),u}catch(d){c.push(d)}throw new AggregateError(c,"No supported terminal emulator could be\
|
|
2443
|
-
started.")}async function
|
|
2444
|
+
started.")}async function VA({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,serverArgs:n=[],serverPath:o=er}={}){let i=og(
|
|
2444
2445
|
r,[o,...n],{cwd:e,env:t,stdio:"inherit"});return new Promise((s,a)=>{i.once("error",a),i.once("exit",(c,u)=>{if(u){s(1);
|
|
2445
|
-
return}s(Number(c||0))})})}function
|
|
2446
|
-
|
|
2447
|
-
terprises/vibe64/blob/main/docs/colleague-usage/${e==="darwin"?"set-up-macos":"set-up-linux"}.md`}function
|
|
2448
|
-
platform,nodeVersion:t=M.versions.node,requiredMajor:r=
|
|
2446
|
+
return}s(Number(c||0))})})}function UA(e=Wr.join(sg,"..","package.json")){try{return/^\D*(\d+)/u.exec(String(JSON.parse(
|
|
2447
|
+
IA(e,"utf8")).engines?.node||""))?.[1]||""}catch{return""}}function BA(e=M.platform){return`https://github.com/mobily-en\
|
|
2448
|
+
terprises/vibe64/blob/main/docs/colleague-usage/${e==="darwin"?"set-up-macos":"set-up-linux"}.md`}function zA({platform:e=M.
|
|
2449
|
+
platform,nodeVersion:t=M.versions.node,requiredMajor:r=UA()}={}){if(e==="win32")return["Vibe64 runs on Windows inside WS\
|
|
2449
2450
|
L2 (Ubuntu), not in PowerShell or Command Prompt.","Step by step: https://github.com/mobily-enterprises/vibe64/blob/main\
|
|
2450
2451
|
/docs/colleague-usage/set-up-windows.md"].join(`
|
|
2451
2452
|
`);let n=String(t||"").split(".")[0];return r&&n!==r?[`Vibe64 needs Node.js ${r}; this is Node.js ${t}.`,`To install it \
|
|
2452
2453
|
with mise, run: curl -fsSL https://mise.run | sh && ~/.local/bin/mise use -g node@${r}`,"Then add mise to your shell, op\
|
|
2453
|
-
en a new terminal and run npx vibe64 again:",`${
|
|
2454
|
-
`):""}async function
|
|
2455
|
-
argv.slice(2),serverPath:s=er}={}){try{return await
|
|
2454
|
+
en a new terminal and run npx vibe64 again:",`${BA(e)}#nodejs-and-mise`].join(`
|
|
2455
|
+
`):""}async function GA({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,osReleaseText:n=Vo(),platform:o=M.platform,serverArgs:i=M.
|
|
2456
|
+
argv.slice(2),serverPath:s=er}={}){try{return await DA({cwd:e,env:t,nodePath:r,osReleaseText:n,platform:o,serverArgs:i,serverPath:s}),
|
|
2456
2457
|
console.log("Vibe64 is starting in a new terminal window."),0}catch(a){return console.warn(`${a.message} Starting Vibe64\
|
|
2457
|
-
in this terminal instead.`),
|
|
2458
|
-
then(({runAgentSpecCli:n})=>n(M.argv.slice(3))),timeline:()=>Promise.resolve().then(()=>(
|
|
2459
|
-
M.argv.slice(3),{env:M.env})),training:()=>Promise.resolve().then(()=>(
|
|
2460
|
-
3)))},t=
|
|
2461
|
-
n=>{console.error("Failed to run Vibe64:",n),M.exitCode=1})}export{er as SERVER_ENTRYPOINT,
|
|
2462
|
-
Qt as quoteShellArg,
|
|
2463
|
-
|
|
2458
|
+
in this terminal instead.`),VA({cwd:e,env:t,nodePath:r,serverArgs:i,serverPath:s})}}if(PA()){let e={spec:()=>Promise.resolve().then(()=>(Vu(),Du)).
|
|
2459
|
+
then(({runAgentSpecCli:n})=>n(M.argv.slice(3))),timeline:()=>Promise.resolve().then(()=>(mh(),ph)).then(({runSessionTimelineCli:n})=>n(
|
|
2460
|
+
M.argv.slice(3),{env:M.env})),training:()=>Promise.resolve().then(()=>(Wa(),ng)).then(({runTrainingCli:n})=>n(M.argv.slice(
|
|
2461
|
+
3)))},t=zA();t&&(console.error(t),M.exit(1)),(Object.hasOwn(e,M.argv[2])?e[M.argv[2]]():GA()).then(n=>{M.exitCode=n}).catch(
|
|
2462
|
+
n=>{console.error("Failed to run Vibe64:",n),M.exitCode=1})}export{er as SERVER_ENTRYPOINT,PA as isDirectCliExecution,CA as isWslEnvironment,DA as launchInNewTerminal,zA as launcherProblem,
|
|
2463
|
+
Qt as quoteShellArg,GA as runLauncher,NA as serverShellCommand,ag as targetNameFromCwd,LA as terminalLaunchCandidates,jA as terminalShellScript,
|
|
2464
|
+
kA as wslServerCommandArgs,$A as wslTerminalLaunchCandidates};
|