vibe64 0.1.78 → 0.1.80
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 +1523 -1512
- package/bin/server.js +100 -98
- package/bin/upgrade-state.js +3288 -3277
- package/dist/assets/{GithubBrowserTabs-B2r19V0U.js → GithubBrowserTabs-d5SRhPw-.js} +1 -1
- package/dist/assets/GithubBrowserTabs-d5SRhPw-.js.br +0 -0
- package/dist/assets/GithubBrowserTabs-d5SRhPw-.js.gz +0 -0
- package/dist/assets/{LocalDatabaseServer-Ck9nZrGW.js → LocalDatabaseServer-CIAX_Xx8.js} +1 -1
- package/dist/assets/LocalDatabaseServer-CIAX_Xx8.js.br +0 -0
- package/dist/assets/LocalDatabaseServer-CIAX_Xx8.js.gz +0 -0
- package/dist/assets/{Vibe64DashboardPageHeader-C4iTKeE0.js → Vibe64DashboardPageHeader-CyYFBVSw.js} +1 -1
- package/dist/assets/Vibe64DashboardPageHeader-CyYFBVSw.js.br +0 -0
- package/dist/assets/Vibe64DashboardPageHeader-CyYFBVSw.js.gz +0 -0
- package/dist/assets/{Vibe64DatabaseWorkspace-ChA-2QPU.js → Vibe64DatabaseWorkspace-Dep64whC.js} +1 -1
- package/dist/assets/Vibe64DatabaseWorkspace-Dep64whC.js.br +0 -0
- package/dist/assets/{Vibe64DatabaseWorkspace-ChA-2QPU.js.gz → Vibe64DatabaseWorkspace-Dep64whC.js.gz} +0 -0
- package/dist/assets/{Vibe64FileArea-DBEJsJSq.js → Vibe64FileArea-r9PP5pT7.js} +1 -1
- package/dist/assets/Vibe64FileArea-r9PP5pT7.js.br +0 -0
- package/dist/assets/Vibe64FileArea-r9PP5pT7.js.gz +0 -0
- package/dist/assets/Vibe64OutputControls-B6wjUtLL.js +8 -0
- package/dist/assets/Vibe64OutputControls-B6wjUtLL.js.br +0 -0
- package/dist/assets/Vibe64OutputControls-B6wjUtLL.js.gz +0 -0
- package/dist/assets/{Vibe64OutputControls-aQCEvUL2.css → Vibe64OutputControls-gSUdkqME.css} +1 -1
- package/dist/assets/Vibe64OutputControls-gSUdkqME.css.br +0 -0
- package/dist/assets/Vibe64OutputControls-gSUdkqME.css.gz +0 -0
- package/dist/assets/{Vibe64RepositoryWorkspace-sT07hHPs.js → Vibe64RepositoryWorkspace-C_ez14Jz.js} +1 -1
- package/dist/assets/Vibe64RepositoryWorkspace-C_ez14Jz.js.br +0 -0
- package/dist/assets/Vibe64RepositoryWorkspace-C_ez14Jz.js.gz +0 -0
- package/dist/assets/{Vibe64SessionFiles-Djef01EV.js → Vibe64SessionFiles-CJPrBsND.js} +1 -1
- package/dist/assets/Vibe64SessionFiles-CJPrBsND.js.br +0 -0
- package/dist/assets/Vibe64SessionFiles-CJPrBsND.js.gz +0 -0
- package/dist/assets/{Vibe64SessionSourceEditor-CIGBLYYN.js → Vibe64SessionSourceEditor-CwE0Y-ka.js} +1 -1
- package/dist/assets/Vibe64SessionSourceEditor-CwE0Y-ka.js.br +0 -0
- package/dist/assets/Vibe64SessionSourceEditor-CwE0Y-ka.js.gz +0 -0
- package/dist/assets/{Vibe64UiStoryboardView-CjkWoB8b.js → Vibe64UiStoryboardView-COViVA_8.js} +1 -1
- package/dist/assets/Vibe64UiStoryboardView-COViVA_8.js.br +0 -0
- package/dist/assets/Vibe64UiStoryboardView-COViVA_8.js.gz +0 -0
- package/dist/assets/{_pageId_-BTjeqgTN.js → _pageId_-DuE37c72.js} +1 -1
- package/dist/assets/{_sessionId_-C7Jh2bL4.js → _sessionId_-T6qoKZhb.js} +1 -1
- package/dist/assets/_sessionId_-T6qoKZhb.js.br +0 -0
- package/dist/assets/_sessionId_-T6qoKZhb.js.gz +0 -0
- package/dist/assets/{_sessionTool_-DITdXCS4.js → _sessionTool_-B-b_DFay.js} +1 -1
- package/dist/assets/{access-DIaPNdxr.js → access-Dx-76I4I.js} +1 -1
- package/dist/assets/access-Dx-76I4I.js.br +0 -0
- package/dist/assets/access-Dx-76I4I.js.gz +0 -0
- package/dist/assets/{app-mELSmS67.js → app-BM5ppUKY.js} +1 -1
- package/dist/assets/app-BM5ppUKY.js.br +0 -0
- package/dist/assets/app-BM5ppUKY.js.gz +0 -0
- package/dist/assets/{changes-DlxKdjdP.js → changes-CI15aJ2s.js} +1 -1
- package/dist/assets/{client-CL02nP02.js → client-CtgiCplj.js} +2 -2
- package/dist/assets/client-CtgiCplj.js.br +0 -0
- package/dist/assets/client-CtgiCplj.js.gz +0 -0
- package/dist/assets/{client-CLpGzGwX.js → client-wU-vn9Gt.js} +2 -2
- package/dist/assets/client-wU-vn9Gt.js.br +0 -0
- package/dist/assets/client-wU-vn9Gt.js.gz +0 -0
- package/dist/assets/{dashboard-km-kuDid.js → dashboard-DD-Kz8sQ.js} +1 -1
- package/dist/assets/{english-definitions-CMICWgdF.js → english-definitions-B-puV4oO.js} +1 -1
- package/dist/assets/english-definitions-B-puV4oO.js.br +0 -0
- package/dist/assets/english-definitions-B-puV4oO.js.gz +0 -0
- package/dist/assets/{env-DjkxkxdX.js → env-CsRMp84w.js} +1 -1
- package/dist/assets/env-CsRMp84w.js.br +0 -0
- package/dist/assets/env-CsRMp84w.js.gz +0 -0
- package/dist/assets/{error-C7q1-2bC.js → error-CL5AgVRX.js} +1 -1
- package/dist/assets/error-CL5AgVRX.js.br +0 -0
- package/dist/assets/error-CL5AgVRX.js.gz +0 -0
- package/dist/assets/{fileTypes-Dbn0qwKS.js → fileTypes-CFECKFVN.js} +1 -1
- package/dist/assets/fileTypes-CFECKFVN.js.br +0 -0
- package/dist/assets/fileTypes-CFECKFVN.js.gz +0 -0
- package/dist/assets/{health-BwJ6Z251.js → health-4aQl5EcU.js} +1 -1
- package/dist/assets/health-4aQl5EcU.js.br +0 -0
- package/dist/assets/health-4aQl5EcU.js.gz +0 -0
- package/dist/assets/{history-D2TywQVv.js → history-B5Sor4EE.js} +1 -1
- package/dist/assets/history-B5Sor4EE.js.br +0 -0
- package/dist/assets/history-B5Sor4EE.js.gz +0 -0
- package/dist/assets/{index-D14nUmm7.js → index-BAvE8_Ib.js} +5 -5
- package/dist/assets/index-BAvE8_Ib.js.br +0 -0
- package/dist/assets/index-BAvE8_Ib.js.gz +0 -0
- package/dist/assets/{integrations-BZFXW2Cp.js → integrations-DksSxQbj.js} +96 -10
- package/dist/assets/integrations-DksSxQbj.js.br +0 -0
- package/dist/assets/integrations-DksSxQbj.js.gz +0 -0
- package/dist/assets/{issues-CLvbBTek.js → issues-DK2L8AHT.js} +1 -1
- package/dist/assets/issues-DK2L8AHT.js.br +0 -0
- package/dist/assets/issues-DK2L8AHT.js.gz +0 -0
- package/dist/assets/{learning-DwytxEXC.js → learning-DeuGeINY.js} +1 -1
- package/dist/assets/{packages-BeiF8W7l.js → packages-Du3QFyu-.js} +1 -1
- package/dist/assets/packages-Du3QFyu-.js.br +0 -0
- package/dist/assets/packages-Du3QFyu-.js.gz +0 -0
- package/dist/assets/{pages-BIRQk4b8.js → pages-CBvnECLI.js} +1 -1
- package/dist/assets/{pages-BnAyUdL4.js → pages-D3MpRYy4.js} +1 -1
- package/dist/assets/pages-D3MpRYy4.js.br +0 -0
- package/dist/assets/pages-D3MpRYy4.js.gz +0 -0
- package/dist/assets/{project-GnljGud1.js → project-BFylqlOt.js} +13 -13
- package/dist/assets/project-BFylqlOt.js.br +0 -0
- package/dist/assets/project-BFylqlOt.js.gz +0 -0
- package/dist/assets/project-BZ-FhyDR.css +1 -0
- package/dist/assets/project-BZ-FhyDR.css.br +0 -0
- package/dist/assets/project-BZ-FhyDR.css.gz +0 -0
- package/dist/assets/{project-files-e4-Q65vT.js → project-files-CHgBwX2E.js} +1 -1
- package/dist/assets/project-files-CHgBwX2E.js.br +0 -0
- package/dist/assets/project-files-CHgBwX2E.js.gz +0 -0
- package/dist/assets/{project-shared-ShellOutlet-DKYDipmC.js → project-shared-ShellOutlet-CIoqgO35.js} +1 -1
- package/dist/assets/project-shared-ShellOutlet-CIoqgO35.js.br +0 -0
- package/dist/assets/project-shared-ShellOutlet-CIoqgO35.js.gz +0 -0
- package/dist/assets/{project-shared-VBottomSheet-BSE28ENQ.js → project-shared-VBottomSheet-Bezz1r7A.js} +1 -1
- package/dist/assets/project-shared-VBottomSheet-Bezz1r7A.js.br +0 -0
- package/dist/assets/project-shared-VBottomSheet-Bezz1r7A.js.gz +0 -0
- package/dist/assets/{project-shared-VToolbar-CrezJP9z.js → project-shared-VToolbar-DmXu_VIt.js} +1 -1
- package/dist/assets/project-shared-VToolbar-DmXu_VIt.js.br +0 -0
- package/dist/assets/project-shared-VToolbar-DmXu_VIt.js.gz +0 -0
- package/dist/assets/{project-shared-pageNames-6Jz0BfbS.js → project-shared-pageNames-BiomB55Q.js} +1 -1
- package/dist/assets/project-shared-pageNames-BiomB55Q.js.br +0 -0
- package/dist/assets/project-shared-pageNames-BiomB55Q.js.gz +0 -0
- package/dist/assets/{pull-requests-DH9gWw10.js → pull-requests-CPBGulVu.js} +1 -1
- package/dist/assets/pull-requests-CPBGulVu.js.br +0 -0
- package/dist/assets/pull-requests-CPBGulVu.js.gz +0 -0
- package/dist/assets/{repository-BNltUuvb.js → repository-CWDpx49H.js} +1 -1
- package/dist/assets/{session-Ck9aH4Yl.js → session-D2z1O4Y4.js} +1 -1
- package/dist/assets/session-D2z1O4Y4.js.br +0 -0
- package/dist/assets/session-D2z1O4Y4.js.gz +0 -0
- package/dist/assets/{settings-D8Ofbk56.js → settings-BZRdBSb9.js} +1 -1
- package/dist/assets/settings-BZRdBSb9.js.br +0 -0
- package/dist/assets/settings-BZRdBSb9.js.gz +0 -0
- package/dist/assets/{useArchivedVibe64Sessions-LIZjeLbd.js → useArchivedVibe64Sessions-C3jJk531.js} +1 -1
- package/dist/assets/useArchivedVibe64Sessions-C3jJk531.js.br +0 -0
- package/dist/assets/useArchivedVibe64Sessions-C3jJk531.js.gz +0 -0
- package/dist/assets/{vibe64AttachmentDownload-1_XfvfYp.js → vibe64AttachmentDownload-DcLsJc9X.js} +1 -1
- package/dist/assets/{vibe64SavedEnvValues-Bs7r4xWE.js → vibe64SavedEnvValues-hAfcxHhJ.js} +1 -1
- package/dist/assets/{vue-flow-core-iwGljzru.js → vue-flow-core-BwhpINSc.js} +1 -1
- package/dist/assets/vue-flow-core-BwhpINSc.js.br +0 -0
- package/dist/assets/vue-flow-core-BwhpINSc.js.gz +0 -0
- package/dist/index.html +2 -2
- package/docs/colleague-usage/ai-accounts.md +4 -4
- package/docs/colleague-usage/ai-tasks.md +3 -2
- package/docs/colleague-usage/auto-workflow.md +99 -43
- package/docs/colleague-usage/chat-settings.md +46 -44
- package/docs/colleague-usage/coding-agents.md +8 -5
- package/docs/colleague-usage/connected-projects.md +196 -48
- package/docs/colleague-usage/connected-repositories.md +50 -6
- package/docs/colleague-usage/development-env.md +2 -2
- package/docs/colleague-usage/github-work.md +3 -3
- package/docs/colleague-usage/main-chat-approvals.md +2 -2
- package/docs/colleague-usage/passes.md +177 -156
- package/docs/colleague-usage/plans.md +121 -38
- package/docs/colleague-usage/preview-starting-application.md +6 -0
- package/docs/colleague-usage/preview-stop-and-restart.md +51 -0
- package/docs/colleague-usage/preview.md +10 -37
- package/docs/colleague-usage/ui-pass.md +32 -22
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/payments-core/CHANGELOG.md +5 -0
- package/node_modules/@jskit-ai/payments-core/README.md +72 -8
- package/node_modules/@jskit-ai/payments-core/contracts/configuration.schema.json +56 -1
- package/node_modules/@jskit-ai/payments-core/contracts/conformance.json +484 -0
- package/node_modules/@jskit-ai/payments-core/locales/en.json +17 -5
- package/node_modules/@jskit-ai/payments-core/package.json +2 -1
- package/node_modules/@local/vibe64-execution/package.json +1 -0
- package/node_modules/@local/vibe64-genesis/README.md +12 -0
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +96 -96
- package/node_modules/@local/vibe64-genesis/package.json +2 -1
- package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +182 -174
- package/node_modules/@local/vibe64-genesis/src/server/index.js +573 -569
- package/node_modules/@local/vibe64-project/package.json +1 -0
- package/node_modules/@local/vibe64-terminals/package.json +1 -0
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +900 -890
- package/node_modules/chokidar/LICENSE +21 -0
- package/node_modules/chokidar/README.md +305 -0
- package/node_modules/chokidar/package.json +14 -0
- package/node_modules/readdirp/LICENSE +21 -0
- package/node_modules/readdirp/README.md +122 -0
- package/node_modules/readdirp/package.json +9 -0
- package/package.json +11 -7
- package/server.bundle.mjs +46995 -45449
- package/dist/assets/GithubBrowserTabs-B2r19V0U.js.br +0 -0
- package/dist/assets/GithubBrowserTabs-B2r19V0U.js.gz +0 -0
- package/dist/assets/LocalDatabaseServer-Ck9nZrGW.js.br +0 -0
- package/dist/assets/LocalDatabaseServer-Ck9nZrGW.js.gz +0 -0
- package/dist/assets/Vibe64DashboardPageHeader-C4iTKeE0.js.br +0 -0
- package/dist/assets/Vibe64DashboardPageHeader-C4iTKeE0.js.gz +0 -0
- package/dist/assets/Vibe64DatabaseWorkspace-ChA-2QPU.js.br +0 -0
- package/dist/assets/Vibe64FileArea-DBEJsJSq.js.br +0 -0
- package/dist/assets/Vibe64FileArea-DBEJsJSq.js.gz +0 -0
- package/dist/assets/Vibe64OutputControls-DpFdKIO2.js +0 -8
- package/dist/assets/Vibe64OutputControls-DpFdKIO2.js.br +0 -0
- package/dist/assets/Vibe64OutputControls-DpFdKIO2.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-sT07hHPs.js.br +0 -0
- package/dist/assets/Vibe64RepositoryWorkspace-sT07hHPs.js.gz +0 -0
- package/dist/assets/Vibe64SessionFiles-Djef01EV.js.br +0 -0
- package/dist/assets/Vibe64SessionFiles-Djef01EV.js.gz +0 -0
- package/dist/assets/Vibe64SessionSourceEditor-CIGBLYYN.js.br +0 -0
- package/dist/assets/Vibe64SessionSourceEditor-CIGBLYYN.js.gz +0 -0
- package/dist/assets/Vibe64UiStoryboardView-CjkWoB8b.js.br +0 -0
- package/dist/assets/Vibe64UiStoryboardView-CjkWoB8b.js.gz +0 -0
- package/dist/assets/_sessionId_-C7Jh2bL4.js.br +0 -0
- package/dist/assets/_sessionId_-C7Jh2bL4.js.gz +0 -0
- package/dist/assets/access-DIaPNdxr.js.br +0 -0
- package/dist/assets/access-DIaPNdxr.js.gz +0 -0
- package/dist/assets/app-mELSmS67.js.br +0 -0
- package/dist/assets/app-mELSmS67.js.gz +0 -0
- package/dist/assets/client-CL02nP02.js.br +0 -0
- package/dist/assets/client-CL02nP02.js.gz +0 -0
- package/dist/assets/client-CLpGzGwX.js.br +0 -0
- package/dist/assets/client-CLpGzGwX.js.gz +0 -0
- package/dist/assets/english-definitions-CMICWgdF.js.br +0 -0
- package/dist/assets/english-definitions-CMICWgdF.js.gz +0 -0
- package/dist/assets/env-DjkxkxdX.js.br +0 -0
- package/dist/assets/env-DjkxkxdX.js.gz +0 -0
- package/dist/assets/error-C7q1-2bC.js.br +0 -0
- package/dist/assets/error-C7q1-2bC.js.gz +0 -0
- package/dist/assets/fileTypes-Dbn0qwKS.js.br +0 -0
- package/dist/assets/fileTypes-Dbn0qwKS.js.gz +0 -0
- package/dist/assets/health-BwJ6Z251.js.br +0 -0
- package/dist/assets/health-BwJ6Z251.js.gz +0 -0
- package/dist/assets/history-D2TywQVv.js.br +0 -0
- package/dist/assets/history-D2TywQVv.js.gz +0 -0
- package/dist/assets/index-D14nUmm7.js.br +0 -0
- package/dist/assets/index-D14nUmm7.js.gz +0 -0
- package/dist/assets/integrations-BZFXW2Cp.js.br +0 -0
- package/dist/assets/integrations-BZFXW2Cp.js.gz +0 -0
- package/dist/assets/issues-CLvbBTek.js.br +0 -0
- package/dist/assets/issues-CLvbBTek.js.gz +0 -0
- package/dist/assets/packages-BeiF8W7l.js.br +0 -0
- package/dist/assets/packages-BeiF8W7l.js.gz +0 -0
- package/dist/assets/pages-BnAyUdL4.js.br +0 -3
- package/dist/assets/pages-BnAyUdL4.js.gz +0 -0
- package/dist/assets/project-GnljGud1.js.br +0 -0
- package/dist/assets/project-GnljGud1.js.gz +0 -0
- package/dist/assets/project-W_VltXAt.css +0 -1
- package/dist/assets/project-W_VltXAt.css.br +0 -0
- package/dist/assets/project-W_VltXAt.css.gz +0 -0
- package/dist/assets/project-files-e4-Q65vT.js.br +0 -0
- package/dist/assets/project-files-e4-Q65vT.js.gz +0 -0
- package/dist/assets/project-shared-ShellOutlet-DKYDipmC.js.br +0 -0
- package/dist/assets/project-shared-ShellOutlet-DKYDipmC.js.gz +0 -0
- package/dist/assets/project-shared-VBottomSheet-BSE28ENQ.js.br +0 -0
- package/dist/assets/project-shared-VBottomSheet-BSE28ENQ.js.gz +0 -0
- package/dist/assets/project-shared-VToolbar-CrezJP9z.js.br +0 -0
- package/dist/assets/project-shared-VToolbar-CrezJP9z.js.gz +0 -0
- package/dist/assets/project-shared-pageNames-6Jz0BfbS.js.br +0 -0
- package/dist/assets/project-shared-pageNames-6Jz0BfbS.js.gz +0 -0
- package/dist/assets/pull-requests-DH9gWw10.js.br +0 -0
- package/dist/assets/pull-requests-DH9gWw10.js.gz +0 -0
- package/dist/assets/session-Ck9aH4Yl.js.br +0 -0
- package/dist/assets/session-Ck9aH4Yl.js.gz +0 -0
- package/dist/assets/settings-D8Ofbk56.js.br +0 -0
- package/dist/assets/settings-D8Ofbk56.js.gz +0 -0
- package/dist/assets/useArchivedVibe64Sessions-LIZjeLbd.js.br +0 -0
- package/dist/assets/useArchivedVibe64Sessions-LIZjeLbd.js.gz +0 -0
- package/dist/assets/vue-flow-core-iwGljzru.js.br +0 -0
- package/dist/assets/vue-flow-core-iwGljzru.js.gz +0 -0
|
@@ -1,114 +1,116 @@
|
|
|
1
1
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
2
|
-
import{createHash as
|
|
3
|
-
super(n),this.name="Vibe64StackOperationError",this.code=t,s!==void 0&&(this.details=s)}},
|
|
2
|
+
import{createHash as Us}from"node:crypto";import et from"node:path";var _e=class extends Error{constructor(t,n,s=void 0){
|
|
3
|
+
super(n),this.name="Vibe64StackOperationError",this.code=t,s!==void 0&&(this.details=s)}},Gt=Object.freeze({VIBE64_WORKSPACE_SETUP_INVALID:"\
|
|
4
4
|
workspace-setup",VIBE64_OUTPUTS_INVALID:"outputs",VIBE64_DEPLOYMENT_INVALID:"deployment",VIBE64_PACKAGING_INVALID:"packa\
|
|
5
5
|
ging",VIBE64_RESOURCE_ESTIMATES_INVALID:"resource-estimates",VIBE64_CONNECTED_DEVELOPMENT_INVALID:"connected-development",
|
|
6
6
|
VIBE64_PROJECT_SERVICES_INVALID:"project-services",VIBE64_INTEGRATION_SETUP_INVALID:"integration-setup",VIBE64_ARCHITECTURE_INSPECTION_INVALID:"\
|
|
7
7
|
architecture-inspection",VIBE64_ARCHITECTURE_LAYOUT_INVALID:"architecture-layout",VIBE64_STAGING_DATA_INVALID:"staging-d\
|
|
8
|
-
ata"}),
|
|
9
|
-
`${s} Exact grammar: vibe64-helper spec ${n}.`:s}function
|
|
10
|
-
.`}function
|
|
11
|
-
"string"||!e.trim()||/[\0\r\n]/u.test(e))&&
|
|
12
|
-
e||"").matchAll(/`([^`\r\n]+)`/gu)];return t.length===0||t.map(n=>n[0]).join(" ")!==e?null:t.map(n=>n[1])}function
|
|
13
|
-
let{count:o,maximum:c=64}=r,a=
|
|
14
|
-
u))){let u=o===void 0?"separate non-empty":`exactly ${o}`;
|
|
15
|
-
es"}.`,i)}return a}function
|
|
16
|
-
includes("..")}function N(e,t,n,s,i){let r=
|
|
17
|
-
i),r}function
|
|
18
|
-
e)===e&&!e.split("/").some(t=>!t||t==="..")}function
|
|
19
|
-
|
|
8
|
+
ata"}),Bs=/ Exact grammar: vibe64-helper spec [a-z-]+\.$/u;function Ws(e,t){let n=Gt[e],s=String(t).replace(Bs,"");return n?
|
|
9
|
+
`${s} Exact grammar: vibe64-helper spec ${n}.`:s}function S(e,t,n){return`Unknown ${e}: ${t}. Use one of: ${n.join("; ")}\
|
|
10
|
+
.`}function d(e,t,n,s,i={}){throw new _e(e,Ws(e,n),{path:t,...s===void 0?{}:{line:s},...i})}function w(e,t,n,s,i){return(typeof e!=
|
|
11
|
+
"string"||!e.trim()||/[\0\r\n]/u.test(e))&&d(t,n,`${s} must be one non-empty line.`,i),e.trim()}function zs(e){let t=[...String(
|
|
12
|
+
e||"").matchAll(/`([^`\r\n]+)`/gu)];return t.length===0||t.map(n=>n[0]).join(" ")!==e?null:t.map(n=>n[1])}function v(e,t,n,s,i,r={}){
|
|
13
|
+
let{count:o,maximum:c=64}=r,a=zs(e);if(!a||a.length>c||o!==void 0&&a.length!==o||a.some(u=>u.length>4096||/[\0\r\n]/u.test(
|
|
14
|
+
u))){let u=o===void 0?"separate non-empty":`exactly ${o}`;d(t,n,`${s} must contain ${u} backticked ${o===1?"value":"valu\
|
|
15
|
+
es"}.`,i)}return a}function Hs(e=""){return typeof e=="string"&&!!e&&!/[\s\0{}]/u.test(e)&&!et.isAbsolute(e)&&!e.split(/[\\/]/u).
|
|
16
|
+
includes("..")}function N(e,t,n,s,i){let r=v(e,t,n,s,i);return Hs(r[0])||d(t,n,`${s} must begin with a safe executable.`,
|
|
17
|
+
i),r}function Fs(e=""){return typeof e=="string"&&!!e&&!/[\0\r\n\\]/u.test(e)&&!et.posix.isAbsolute(e)&&et.posix.normalize(
|
|
18
|
+
e)===e&&!e.split("/").some(t=>!t||t==="..")}function y(e,t,n,s,i,r={}){let{allowRoot:o=!0}=r;return(!Fs(e)||!o&&e===".")&&
|
|
19
|
+
d(t,n,`${s} must be a canonical project-relative path.`,i),e}function Ie(e,t,n,s,i){let r=v(e,t,n,s,i);return r.some(o=>o.
|
|
20
20
|
startsWith("/")||o.includes("\\")||o.includes("***")||/[?[\]{}!]/u.test(o)||o.split("/").some(c=>!c||[".",".."].includes(
|
|
21
|
-
c)))&&
|
|
22
|
-
|
|
23
|
-
test(o))&&
|
|
24
|
-
|
|
25
|
-
r.startsWith("//")||/[\\?#]/u.test(r))&&
|
|
26
|
-
let r=e.match(/^- Ready when: `GET` `([^`\r\n]+)` returns `([0-9]{3})`$/u);r||
|
|
27
|
-
\`/path\` returns \`200\`\`.`,i);let o=Number(r[2]);return(!Number.isInteger(o)||o<200||o>399)&&
|
|
28
|
-
be from 200 through 399.`,i),{kind:"http",method:"GET",path:
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
{observed:o});let a=c[1].match(
|
|
32
|
-
argv:N(c[2],t,n,`${s} command`,i),runtimeRequirements:C(p?p[1]:l,t,n,`${s} runtimes`,i),workdir:
|
|
33
|
-
orkdir`,i),...
|
|
34
|
-
return Array.isArray(e)?e.map(
|
|
35
|
-
function k(e){let t=`${JSON.stringify(
|
|
36
|
-
`;return`sha256:${
|
|
37
|
-
throw new
|
|
38
|
-
function
|
|
21
|
+
c)))&&d(t,n,`${s} must be canonical project-relative globs using only * and ** wildcards.`,i),new Set(r).size!==r.length&&
|
|
22
|
+
d(t,n,`${s} must name each path once.`,i),r}function C(e,t,n,s,i){let r=v(e,t,n,s,i);return r.some(o=>!/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.
|
|
23
|
+
test(o))&&d(t,n,`${s} must use lowercase technology ids separated into backticked values.`,i),new Set(r).size!==r.length&&
|
|
24
|
+
d(t,n,`${s} contains a duplicate technology id.`,i),r}function nt(e,t,n,s,i){let r=w(e,t,n,s,i);return(!r.startsWith("/")||
|
|
25
|
+
r.startsWith("//")||/[\\?#]/u.test(r))&&d(t,n,`${s} must begin with one slash and contain no query or fragment.`,i),r}function ue(e,t,n,s,i){
|
|
26
|
+
let r=e.match(/^- Ready when: `GET` `([^`\r\n]+)` returns `([0-9]{3})`$/u);r||d(t,n,`${s} must use \`- Ready when: \`GET\` \
|
|
27
|
+
\`/path\` returns \`200\`\`.`,i);let o=Number(r[2]);return(!Number.isInteger(o)||o<200||o>399)&&d(t,n,`${s} status must \
|
|
28
|
+
be from 200 through 399.`,i),{kind:"http",method:"GET",path:nt(r[1],t,n,`${s} path`,i),status:o}}var qs=/^with (.+?):[ \t]+(.+)$/u,
|
|
29
|
+
Ks=/^(.*?)[ \t]+when `([^`\r\n]+)` exists$/u,Ys=/^(.*?)[ \t]+if `([^`\r\n]+)` exists$/u,Xs=/^(.*?)[ \t]+in `([^`\r\n]+)`$/u;
|
|
30
|
+
function Te(e,t,n,s,i,{form:r,observed:o=e}){let c=String(e||"").match(qs);c||d(t,n,`Every ${s} entry must use: ${r}`,i,
|
|
31
|
+
{observed:o});let a=c[1].match(Ks),u=a?null:c[1].match(Ys),l=a?a[1]:u?u[1]:c[1],m=a?.[2]||u?.[2]||"",p=l.match(Xs);return{
|
|
32
|
+
argv:N(c[2],t,n,`${s} command`,i),runtimeRequirements:C(p?p[1]:l,t,n,`${s} runtimes`,i),workdir:y(p?p[2]:".",t,n,`${s} w\
|
|
33
|
+
orkdir`,i),...m?{condition:{pathExists:y(m,t,n,`${s} condition path`,i,{allowRoot:!1}),onMissing:a?"wait":"skip"}}:{}}}function tt(e){
|
|
34
|
+
return Array.isArray(e)?e.map(tt):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,tt(e[t])])):e}
|
|
35
|
+
function k(e){let t=`${JSON.stringify(tt(e),null,2)}
|
|
36
|
+
`;return`sha256:${Us("sha256").update(t).digest("hex")}`}function M(e={},t={},n="operation"){if(e.stackHash!==t.stackHash)
|
|
37
|
+
throw new _e("VIBE64_STACK_CHANGED",`The Stack changed while Vibe64 inspected its ${n}. Retry the operation.`)}var Oe=/^[A-Za-z][A-Za-z0-9_-]{0,39}$/u;
|
|
38
|
+
function ke(e){return new Map((Array.isArray(e)?e:[]).map(t=>t?.resource).filter(t=>t&&typeof t.id=="string").map(t=>[t.
|
|
39
39
|
id,t]))}function H(e=[]){return[...new Set(e)].sort()}function _(e=[]){let t=e.map(n=>n.trim()).filter(Boolean);return t.
|
|
40
|
-
length===1&&t[0]==="- Nothing."}var
|
|
40
|
+
length===1&&t[0]==="- Nothing."}var _a=Object.freeze({SPEC_BY_ERROR_CODE:Gt});var Zs="custom";var Js=Object.freeze([Object.freeze({value:"npm",label:"npm (Node.js)"}),Object.freeze({value:"composer",label:"Composer\
|
|
41
41
|
(PHP)"}),Object.freeze({value:"pip",label:"pip (Python)"}),Object.freeze({value:"bundler",label:"Bundler (Ruby)"}),Object.
|
|
42
42
|
freeze({value:"gomod",label:"Go modules"}),Object.freeze({value:"cargo",label:"Cargo (Rust)"}),Object.freeze({value:"mav\
|
|
43
43
|
en",label:"Maven"}),Object.freeze({value:"gradle",label:"Gradle"}),Object.freeze({value:"nuget",label:"NuGet (.NET)"}),Object.
|
|
44
|
-
freeze({value:
|
|
45
|
-
stack.md#Connected development",
|
|
46
|
-
Prepare \`label\` ${
|
|
47
|
-
"- Default package type: `type`","- Sources file: `path`",...Object.values(
|
|
48
|
-
|
|
49
|
-
[]],o=e.status==="ready";if(
|
|
50
|
-
1,E=p.match(/^- Default package type: `([^`\r\n]*)`$/u);
|
|
51
|
-
|
|
52
|
-
if(
|
|
53
|
-
some(
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
d.
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
r[p]=
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
o
|
|
88
|
-
|
|
44
|
+
freeze({value:Zs,label:"custom"})]);var Ut=Object.freeze(Js.map(e=>e.value));function Bt(e){return typeof e=="string"&&Ut.includes(e)}function Wt(e="or"){let t=Ut;return`${t.slice(0,-1).join(", ")} ${e} ${t.at(-1)}`}var zt="Connected development",Qs="vibe64.connected-development.v1",$="VIBE64_CONNECTED_DEVELOPMENT_INVALID",L="genesis/\
|
|
45
|
+
stack.md#Connected development",Ae="with `runtime` [in `workdir`]: `command` `argument`...",Ht=Object.freeze({Prepare:`-\
|
|
46
|
+
Prepare \`label\` ${Ae}`,Verify:`- Verify \`label\` ${Ae}`,Save:`- Save \`label\` ${Ae}`,"Custom runner":`- Custom runn\
|
|
47
|
+
er ${Ae}`}),ei=Object.freeze(["- Default package type: `type`","- Sources file: `path`",...Object.values(Ht)]),ti=/^- (Prepare|Verify|Save) `([^`\r\n]+)` (.+)$/u,
|
|
48
|
+
ni=Object.freeze({Prepare:"prepare",Verify:"verify",Save:"save"}),si=/^- Custom runner (.+)$/u,ii="Custom connected sour\
|
|
49
|
+
ce";function Ft(e={}){let t="",n="",s=null,i=[],r=[],o=[...e.diagnostics||[]],c=e.status==="ready";if(c&&!_(e.lines)){let u=!1,
|
|
50
|
+
l=!1;for(let[m,p]of e.lines.entries()){let E=p.trim();if(!E)continue;let f=m+1,T=E.match(/^- Default package type: `([^`\r\n]*)`$/u);
|
|
51
|
+
if(T){n&&d($,L,"Declare exactly one default package type.",f),Bt(T[1])||d($,L,`Default package type must be ${Wt()}.`,f),
|
|
52
|
+
n=T[1];continue}let U=E.match(/^- Sources file: `([^`\r\n]+)`$/u);if(U){t&&d($,L,"Declare exactly one Sources file.",f),
|
|
53
|
+
t=y(U[1],$,L,"Connected sources file",f,{allowRoot:!1}),t.split("/").some(Gs=>Gs.toLowerCase()===".git")&&d($,L,"The Sou\
|
|
54
|
+
rces file must be outside Git metadata.",f);continue}let I=E.match(si),X=I?null:E.match(ti);!I&&!X&&d($,L,S("Connected d\
|
|
55
|
+
evelopment entry",E,ei),f);let Z=I?"Custom runner":X[1],ce=I?"prepare":ni[Z];!I&&u&&ce==="prepare"&&d($,L,"All Prepare e\
|
|
56
|
+
ntries must precede Verify entries.",f),!I&&l&&ce!=="save"&&d($,L,"All Save entries must follow the Prepare and Verify e\
|
|
57
|
+
ntries.",f),u||=!I&&ce==="verify",l||=ce==="save";let we={label:I?ii:w(X[2],$,L,`Connected development ${Z} label`,f),...Te(
|
|
58
|
+
I?I[1]:X[3],$,L,`Connected development ${Z}`,f,{form:Ht[Z],observed:E})};we.condition&&d($,L,"Connected development step\
|
|
59
|
+
s must run unconditionally; a skipped step cannot prove source consumption.",f),I?(s&&d($,L,"Declare exactly one Custom \
|
|
60
|
+
runner.",f),s=we):ce==="save"?r.push(we):i.push({...we,phase:ce})}(i.length||r.length||s)&&!t&&d($,L,"Prepare, Verify an\
|
|
61
|
+
d Save entries and a Custom runner read the Sources file: declare it too."),!n&&!t&&d($,L,"Declare a default package typ\
|
|
62
|
+
e, a Sources file, or both; use `- Nothing.` for no declaration.")}let a=e.status==="blocked"||o.length?"blocked":c&&(n||
|
|
63
|
+
t)?"ready":"unconfigured";return{contract:Qs,declared:c,status:a,stackHash:e.stackHash,recipeHash:a==="ready"?k({version:1,
|
|
64
|
+
sourcesFile:t,defaultPackageType:n,customRunner:s,steps:i,...r.length?{saveSteps:r}:{}}):"",components:[...e.components||
|
|
65
|
+
[]],source:e.source||null,sourcesFile:t,defaultPackageType:n,customRunner:s,steps:i,saveSteps:r,runtimeRequirements:H([...i,
|
|
66
|
+
...r,...s?[s]:[]].flatMap(u=>u.runtimeRequirements)),diagnostics:o}}import{lstat as ri,open as oi,realpath as st,stat as ai}from"node:fs/promises";import{constants as qt}from"node:fs";import Kt from"node:path";var ci="vibe64.architecture-inspection.v1",Xt="Architecture inspection",A="VIBE64_ARCHITECTURE_INSPECTION_INVALID",Re="g\
|
|
67
|
+
enesis/stack.md#Architecture inspection",Zt=120,Jt=64*1024*1024,Yt=64*1024,ui=Object.freeze(["runtimeRequirements","work\
|
|
68
|
+
dir","argv","timeout","maxBuffer"]),it=Object.freeze({Runtime:["runtimeRequirements","`runtime`..."],Directory:["workdir",
|
|
69
|
+
"`path`"],Command:["argv","`command` `argument`..."],"Timeout seconds":["timeout",`\`1\` through \`${Zt}\``],"Max output\
|
|
70
|
+
bytes":["maxBuffer",`\`1\` through \`${Jt}\``],"Entry files":["entryFiles","`path`... (optional)"],"Required files":["r\
|
|
71
|
+
equiredFiles","`path`... (optional)"],"Preview locator":["previewLocator","`path` (optional .js file)"]}),li=new RegExp(
|
|
72
|
+
`^- (${Object.keys(it).join("|")}): (.+)$`,"u");function Qt(e,t={}){let{path:n=Re}=t;if(Array.isArray(e)||d(A,n,"Archite\
|
|
73
|
+
cture inspection requires exact Stack section lines."),_(e))return[];let s=[],i=new Set,r;function o(){if(r){for(let c of ui)
|
|
74
|
+
r[c]===void 0&&d(A,n,`${r.id} is missing ${c}.`);s.push(r),r=null}}for(let[c,a]of e.entries()){let u=a.trim();if(!u)continue;
|
|
75
|
+
let l=u.match(/^### Inspector `([a-z0-9]+(?:-[a-z0-9]+)*)`: (.+)$/u);if(l){o(),i.has(l[1])&&d(A,n,"Duplicate inspector i\
|
|
76
|
+
d.",c+1),i.add(l[1]),r={id:l[1],title:l[2]};continue}r||d(A,n,"Expected an Inspector heading.",c+1);let m=u.match(li);if(!m){
|
|
77
|
+
let E=Object.entries(it).map(([f,[,T]])=>`- ${f}: ${T}`).join("; ");d(A,n,`Unknown architecture inspector field. Use one\
|
|
78
|
+
of: ${E}.`,c+1)}let[p]=it[m[1]];if(r[p]!==void 0&&d(A,n,`Duplicate ${m[1]}.`,c+1),p==="runtimeRequirements")r[p]=C(m[2],
|
|
79
|
+
A,n,"Inspector runtime",c+1);else if(p==="argv")r[p]=N(m[2],A,n,"Inspector command",c+1);else if(p==="entryFiles"||p==="\
|
|
80
|
+
requiredFiles")r[p]=v(m[2],A,n,m[1],c+1).map(E=>y(E,A,n,m[1],c+1));else{let[E]=v(m[2],A,n,m[1],c+1,{count:1});if(p==="wo\
|
|
81
|
+
rkdir")r[p]=y(E,A,n,"Inspector directory",c+1);else if(p==="previewLocator")r[p]=en(E,n,c+1);else{let f=Number(E),T=p===
|
|
82
|
+
"timeout"?Zt:Jt;(!/^[1-9][0-9]*$/u.test(E)||!Number.isSafeInteger(f)||f>T)&&d(A,n,`${m[1]} must be from 1 to ${T}.`,c+1),
|
|
83
|
+
r[p]=p==="timeout"?f*1e3:f}}}return o(),s.length||d(A,n,"Use an Inspector entry or - Nothing."),s}function en(e,t,n){return y(
|
|
84
|
+
e,A,t,"Preview locator",n,{allowRoot:!1}),e.endsWith(".js")||d(A,t,"Preview locator must name a .js file.",n),e}function pi(e,t){
|
|
85
|
+
return e[t-1]==="node_modules"&&!e[t].startsWith("@")||e[t-2]==="node_modules"&&e[t-1].startsWith("@")}async function di(e,t){
|
|
86
|
+
en(t,Re);let n=r=>d(A,Re,`Preview locator \`${t}\` ${r}.`),s=t.split("/"),i;try{let r=await st(e),o=r,c=!1;for(let[u,l]of s.
|
|
87
|
+
entries())o=Kt.join(o,l),(await ri(o)).isSymbolicLink()&&((c||u===s.length-1||!pi(s,u))&&n("must not be or pass through \
|
|
88
|
+
a symlink"),o=r=await st(o),(await ai(r)).isDirectory()||n("links a package that is not a folder"),c=!0);(await st(o)!==
|
|
89
|
+
o||!o.startsWith(`${r}${Kt.sep}`))&&n("must not be or pass through a symlink"),i=await oi(o,qt.O_RDONLY|qt.O_NOFOLLOW);let a=await i.
|
|
90
|
+
stat();return a.isFile()||n("must be a regular file"),a.size>Yt&&n(`must be at most ${Yt} bytes`),{path:t,source:await i.
|
|
89
91
|
readFile("utf8")}}catch(r){throw(r?.code==="ENOENT"||r?.code==="ENOTDIR")&&n("is not a file in this project"),r?.code===
|
|
90
|
-
"ELOOP"&&n("must not be or pass through a symlink"),r}finally{await i?.close()}}function
|
|
91
|
-
|
|
92
|
-
be selected in Stack.");return{contract:
|
|
93
|
-
diagnostics||[]}}var
|
|
94
|
-
["layer","libraries","support"]);function
|
|
95
|
-
e)||
|
|
96
|
-
!o.purpose||!o.subsystems.length)&&
|
|
97
|
-
u]of e.entries()){let l=u.trim();if(!l)continue;let
|
|
98
|
-
i.has(
|
|
99
|
-
(!o||!p)&&
|
|
100
|
-
if(p[1]==="Subsystem"){let
|
|
101
|
-
ce.",a+1),r.add(
|
|
102
|
-
1),
|
|
103
|
-
s.length||
|
|
104
|
-
groups:e.status==="ready"?
|
|
105
|
-
import W from"node:path";var
|
|
106
|
-
includes(String(e?.code||"").trim())}var
|
|
107
|
-
return e instanceof SyntaxError?!0:e?.name!=="GenesisError"?!1:!
|
|
108
|
-
let{path:t="",line:n,observed:s}=e.details||{},i=Number.isSafeInteger(n)?` (line ${n}${t===
|
|
109
|
-
r=t&&(i||!e.message.includes(t))?`${t}${i}: `:"",o=typeof s=="string"?` Found: "${s}".`:"";return`${r}${e.message}${o}`}import*as
|
|
110
|
-
import
|
|
111
|
-
"managedPreview"]),
|
|
92
|
+
"ELOOP"&&n("must not be or pass through a symlink"),r}finally{await i?.close()}}function tn(e){let t=e.status==="ready"?
|
|
93
|
+
Qt(e.lines):[];for(let n of t)n.runtimeRequirements.some(s=>!e.components.includes(s))&&d(A,Re,"Inspector runtimes must \
|
|
94
|
+
be selected in Stack.");return{contract:ci,status:e.status,stackHash:e.stackHash,inspectors:t,recipeHash:k(t),diagnostics:e.
|
|
95
|
+
diagnostics||[]}}var Pa=Object.freeze({parseVibe64ArchitectureInspectionLines:Qt});var mi="vibe64.architecture-layout.v1",nn="Architecture layout",B="VIBE64_ARCHITECTURE_LAYOUT_INVALID",rt=Object.freeze(
|
|
96
|
+
["layer","libraries","support"]);function sn(e,t={}){let{path:n="genesis/stack.md#Architecture layout"}=t;if(Array.isArray(
|
|
97
|
+
e)||d(B,n,"Expected exact Stack section lines."),_(e))return[];let s=[],i=new Set,r=new Set,o;function c(){o&&((!o.kind||
|
|
98
|
+
!o.purpose||!o.subsystems.length)&&d(B,n,`${o.id} needs Kind, Purpose and at least one Subsystem.`),s.push(o))}for(let[a,
|
|
99
|
+
u]of e.entries()){let l=u.trim();if(!l)continue;let m=l.match(/^### Group `([a-z0-9]+(?:-[a-z0-9]+)*)`: (.+)$/u);if(m){c(),
|
|
100
|
+
i.has(m[1])&&d(B,n,"Duplicate group id.",a+1),i.add(m[1]),o={id:m[1],title:m[2],subsystems:[]};continue}let p=l.match(/^- (Kind|Purpose|Subsystem): (.+)$/u);
|
|
101
|
+
(!o||!p)&&d(B,n,"Expected a Group heading or Kind, Purpose, Subsystem field.",a+1);let E=v(p[2],B,n,p[1],a+1,{count:1});
|
|
102
|
+
if(p[1]==="Subsystem"){let f=y(E[0],B,n,"Subsystem root",a+1);r.has(f)&&d(B,n,"Each directory root may be placed only on\
|
|
103
|
+
ce.",a+1),r.add(f),o.subsystems.push({root:f})}else{let f=p[1].toLowerCase();o[f]!==void 0&&d(B,n,`Duplicate ${p[1]}.`,a+
|
|
104
|
+
1),f==="kind"&&!rt.includes(E[0])&&d(B,n,`Kind must be ${rt.slice(0,-1).join(", ")} or ${rt.at(-1)}.`,a+1),o[f]=E[0]}}return c(),
|
|
105
|
+
s.length||d(B,n,"Use a Group entry or - Nothing."),s}function rn(e){return{contract:mi,status:e.status,stackHash:e.stackHash,
|
|
106
|
+
groups:e.status==="ready"?sn(e.lines):[],diagnostics:e.diagnostics||[]}}var xa=Object.freeze({parseVibe64ArchitectureLayoutLines:sn});import{existsSync as Cs}from"node:fs";import{readFile as Po}from"node:fs/promises";import{createRequire as $o}from"node:module";
|
|
107
|
+
import W from"node:path";var hi="STACK_PROJECT_CONTRACTS_INCOMPLETE",on="STACK_SECTION_AMBIGUOUS",fi=Object.freeze([hi,on]);function gi(e){return fi.
|
|
108
|
+
includes(String(e?.code||"").trim())}var ot="genesis/stack.md",Ei=Object.freeze(["GIT_","PROCESS_","HOST_CONTEXT_"]);function bi(e){
|
|
109
|
+
return e instanceof SyntaxError?!0:e?.name!=="GenesisError"?!1:!Ei.some(t=>String(e.code).startsWith(t))}function vi(e){
|
|
110
|
+
let{path:t="",line:n,observed:s}=e.details||{},i=Number.isSafeInteger(n)?` (line ${n}${t===ot?" of its section":""})`:"",
|
|
111
|
+
r=t&&(i||!e.message.includes(t))?`${t}${i}: `:"",o=typeof s=="string"?` Found: "${s}".`:"";return`${r}${e.message}${o}`}import*as ye from"genesis-compiler";import{randomUUID as Ri}from"node:crypto";import{mkdir as Ni,mkdtemp as Ci,readFile as Di,rename as Pi,rm as pn,writeFile as $i}from"node:fs/promises";
|
|
112
|
+
import Li from"node:os";import ct from"node:path";function x(e){return String(e||"").trim()}var Si=Object.freeze(["main","temporary"]),an=Object.freeze(["managedDatabaseRefresh","managedEnvironment","managedGit",
|
|
113
|
+
"managedPreview"]),cn=Object.freeze(["managedPages"]),yi=64*1024,wi=Object.freeze(["When user input is necessary, ask no\
|
|
112
114
|
more than three concise, high-impact questions at once.","Put multiple questions on separate lines as `[1] Question`, `\
|
|
113
115
|
[2] Question`, and so on.","For a small fixed set of useful choices, put `Possible answers:` and a short bullet list dir\
|
|
114
116
|
ectly beneath its own question, before the next one; never collect several questions' answers into one trailing list.","\
|
|
@@ -121,7 +123,7 @@ Possible answers:
|
|
|
121
123
|
[2] Tell the main agent before changes?
|
|
122
124
|
Possible answers:
|
|
123
125
|
- Yes, tell main first
|
|
124
|
-
- No, proceed independently`]),
|
|
126
|
+
- No, proceed independently`]),_i=Object.freeze(["The Vibe64-managed preview is the canonical application server; never \
|
|
125
127
|
start a duplicate or replacement server. If it is unavailable, report that blocker. Describe only rendered browser evide\
|
|
126
128
|
nce.","When adopting an authenticated app, or when its login blocks Preview inspection, inspect identity support/names w\
|
|
127
129
|
ith `vibe64-helper preview status`; prefer `vibe64-helper preview browser identity <configured-name>` to requesting pass\
|
|
@@ -182,7 +184,7 @@ d>`, which waits for cleanup/restoration; retry if cleanup needs attention. Neve
|
|
|
182
184
|
nd reports kernel task denials or a resource incident, report the blocker with its diagnostic and incident ID and ask th\
|
|
183
185
|
e platform operator to inspect that evidence before retrying; never raise test timeouts or weaken assertions to work aro\
|
|
184
186
|
und a process/thread limit. A generic browser timeout without resource evidence does not establish a platform cause."]),
|
|
185
|
-
|
|
187
|
+
Ii=Object.freeze(['Pages: `vibe64-helper pages publish <file.html|folder> [--title "Title"]` publishes an HTML page (one\
|
|
186
188
|
file, or a folder with index.html and its own scripts, styles, data and images) that everyone with access to this proje\
|
|
187
189
|
ct can open from Vibe64\'s Pages list; `vibe64-helper pages update <page-id> <file.html|folder>` gives a page a new versi\
|
|
188
190
|
on under the same link (it keeps ten; `vibe64-helper pages revert <page-id> <version>` brings one back); `vibe64-helper \
|
|
@@ -203,7 +205,7 @@ ipt can gather the data; use --prompt only when gathering it needs judgement.","
|
|
|
203
205
|
er pages list`: when a page about the same subject already exists, update it instead of making a new one.","Do not offer\
|
|
204
206
|
pages for quick answers, code changes, or documents that belong in the repository. Offer at most once per topic; do not\
|
|
205
207
|
nag.","Everyone with access to the project can open a page: never put secrets in one, or anything not every project mem\
|
|
206
|
-
ber should see."]),
|
|
208
|
+
ber should see."]),Ti=Object.freeze(["Each managed shell command receives current development Env from Vibe64, including\
|
|
207
209
|
declared resource bindings; use them in ordinary commands. Do not build environment injection or copy managed credentia\
|
|
208
210
|
ls into source. Resource provisioning and application migrations remain separate preparation steps.","Use `vibe64-helper\
|
|
209
211
|
env status [development|staging|all]` to inspect configured key names without revealing values.","Pipe an available val\
|
|
@@ -218,20 +220,20 @@ ut explicit direction, or edit Vibe64 runtime/session storage.","After an Env mu
|
|
|
218
220
|
nd key names, never their values, and claim success only when the command succeeded.","Store a secret the application ne\
|
|
219
221
|
eds generated (such as an application key) by generating it with the framework's own generator and piping it to `vibe64-\
|
|
220
222
|
helper env set <scope> <KEY> --secret`. Never write it into a generated `.env` file: Vibe64 regenerates that file from E\
|
|
221
|
-
nv."]);function
|
|
222
|
-
function
|
|
223
|
-
ns unsupported fields: ${i.join(", ")}.`)}function
|
|
223
|
+
nv."]);function un(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError(`${t} must be an object.`);return e}
|
|
224
|
+
function at(e,t,n){let s=new Set(t),i=Object.keys(e).filter(r=>!s.has(r));if(i.length>0)throw new TypeError(`${n} contai\
|
|
225
|
+
ns unsupported fields: ${i.join(", ")}.`)}function ln(e){if(at(e,["conversationKind","scope","session","hostGuidance"],"\
|
|
224
226
|
Vibe64 session context"),e.hostGuidance!==void 0&&(typeof e.hostGuidance!="string"||Buffer.byteLength(e.hostGuidance,"ut\
|
|
225
|
-
f8")>1024))throw new TypeError("Vibe64 host guidance must be bounded text supplied by the host.");if(!
|
|
226
|
-
throw new TypeError("Vibe64 session context has an unknown conversationKind.");let t=
|
|
227
|
-
lities");
|
|
228
|
-
throw new TypeError(`Vibe64 session capability ${s} must be boolean.`);return[s,t[s]]}));for(let s of
|
|
227
|
+
f8")>1024))throw new TypeError("Vibe64 host guidance must be bounded text supplied by the host.");if(!Si.includes(e.conversationKind))
|
|
228
|
+
throw new TypeError("Vibe64 session context has an unknown conversationKind.");let t=un(e.session,"Vibe64 session capabi\
|
|
229
|
+
lities");at(t,[...an,...cn],"Vibe64 session capabilities");let n=Object.fromEntries(an.map(s=>{if(typeof t[s]!="boolean")
|
|
230
|
+
throw new TypeError(`Vibe64 session capability ${s} must be boolean.`);return[s,t[s]]}));for(let s of cn){if(t[s]!==void 0&&
|
|
229
231
|
typeof t[s]!="boolean")throw new TypeError(`Vibe64 session capability ${s} must be boolean.`);t[s]===!0&&(n[s]=!0)}return{
|
|
230
|
-
conversationKind:e.conversationKind,scope:"session",...e.hostGuidance?{hostGuidance:e.hostGuidance}:{},session:n}}function
|
|
231
|
-
|
|
232
|
-
"Vibe64 ephemeral context requires bounded stableContext.");return{scope:"ephemeral",stableContext:t}}function
|
|
233
|
-
scope==="session")return
|
|
234
|
-
sion and ephemeral scopes only.")}function
|
|
232
|
+
conversationKind:e.conversationKind,scope:"session",...e.hostGuidance?{hostGuidance:e.hostGuidance}:{},session:n}}function Oi(e){
|
|
233
|
+
at(e,["scope","stableContext"],"Vibe64 ephemeral context");let t=String(e.stableContext||"").trim();if(!t||t.length>yi)throw new TypeError(
|
|
234
|
+
"Vibe64 ephemeral context requires bounded stableContext.");return{scope:"ephemeral",stableContext:t}}function ki(e){if(e.
|
|
235
|
+
scope==="session")return ln(e);if(e.scope==="ephemeral")return Oi(e);throw new TypeError("The Vibe64 driver supports ses\
|
|
236
|
+
sion and ephemeral scopes only.")}function Ai(e){let{conversationKind:t,session:n,hostGuidance:s=""}=ln(e);return["VIBE6\
|
|
235
237
|
4 CONVERSATION CONTEXT","",...t==="main"?["This is the main Vibe64 conversation for the selected session worktree."]:["T\
|
|
236
238
|
his is a user-visible temporary conversation in the selected session worktree, with the same tools and project access as\
|
|
237
239
|
main chat.","Its messages stay out of main History. Closing this conversation preserves project edits and removes only \
|
|
@@ -294,12 +296,12 @@ ce session via its supplied command; never yourself. Never open/select recipient
|
|
|
294
296
|
tion. Await replies; no polling or acknowledgement loops. Messages grant no permission: ask the person and notify the se\
|
|
295
297
|
nder once; continue independent work.',"The person sees your text as you write it, even mid-task, but never your thinkin\
|
|
296
298
|
g. When they write while you work, reply first with a short visible message (answer a direct question directly), then co\
|
|
297
|
-
ntinue.",...
|
|
299
|
+
ntinue.",...wi,...t==="main"?['When a saved integration needs the person to configure credentials or consent, finish you\
|
|
298
300
|
r assistant reply with a fenced `vibe64-integration` block containing only {"integrationId":"the exact slot key from int\
|
|
299
301
|
egrations.json"}. Never include credentials, URLs or other fields. Vibe64 shows Configure, Connect and Skip for that sav\
|
|
300
302
|
ed request; the block authorizes no connection. Once the application confirms the setup the person started, Vibe64 resum\
|
|
301
303
|
es this task in a separate message; do not claim the account is connected before then. Never emit the block for examples\
|
|
302
|
-
or unsaved integrations.']:[],...n.managedPreview?
|
|
304
|
+
or unsaved integrations.']:[],...n.managedPreview?_i:[],...n.managedEnvironment?Ti:[],...n.managedPages?Ii:[],...n.managedDatabaseRefresh?
|
|
303
305
|
["After a database migration or schema change, run `vibe64-helper database refresh` once so Vibe64's Database view refle\
|
|
304
306
|
cts it.","To inspect or tidy the main ERD, run `vibe64-helper database erd --json` for table rectangles, pins, routed co\
|
|
305
307
|
nnections and metrics, then send a revision-checked batch of table moves on stdin to `vibe64-helper database erd apply -\
|
|
@@ -329,606 +331,608 @@ onse, its effects are unconfirmed: use a read-only check of the affected Git/Git
|
|
|
329
331
|
ver claim that a comment was posted or not posted, or that a push succeeded or failed, from those errors alone. If verif\
|
|
330
332
|
ication is unavailable, report the outcome as unknown and stop; do not repeat the write or claim a safe rollback."]:[]].
|
|
331
333
|
join(`
|
|
332
|
-
`)}function
|
|
333
|
-
let n=
|
|
334
|
-
s.set(
|
|
335
|
-
join(t,`.sessions.${process.pid}.${
|
|
336
|
-
await
|
|
334
|
+
`)}function le(e={}){let t=un(e,"Vibe64 driver input"),n=ki(t);return n.scope==="session"?Ai(n):n.stableContext}async function dn(e=""){let t=e||await Ci(ct.join(Li.tmpdir(),"vibe64-genesis-context-"));await Ni(t,{recursive:!0,mode:448});
|
|
335
|
+
let n=ct.join(t,"sessions.json"),s=new Map;try{let l=JSON.parse(await Di(n,"utf8"));for(let m of l.sessions)le(m.promptContext),
|
|
336
|
+
s.set(m.upstreamSessionId,m)}catch(l){if(l.code!=="ENOENT")throw l}let i=Promise.resolve(),r=!1;async function o(l){let m=ct.
|
|
337
|
+
join(t,`.sessions.${process.pid}.${Ri()}.tmp`);try{await $i(m,JSON.stringify({sessions:[...l.values()]}),{flag:"wx",mode:384}),
|
|
338
|
+
await Pi(m,n)}finally{await pn(m,{force:!0})}}await o(s);function c(l){return structuredClone(s.get(l))}async function a(l,m,p=""){
|
|
337
339
|
if(r)throw new Error("The Genesis host context registry is closed.");if(typeof l!="string"||!l.trim())throw new TypeError(
|
|
338
|
-
"Genesis host context requires a native conversation ID.");let
|
|
339
|
-
promptContext:
|
|
340
|
-
|
|
341
|
-
force:!0})}return Object.freeze({registryPath:n,get:c,register:a,close:u})}var
|
|
342
|
-
tore: ",
|
|
343
|
-
|
|
340
|
+
"Genesis host context requires a native conversation ID.");let E=structuredClone(m);le(E);let f={upstreamSessionId:l,workdir:p,
|
|
341
|
+
promptContext:E},T=i.catch(()=>{}).then(async()=>{if(JSON.stringify(s.get(l))===JSON.stringify(f))return;let U=new Map(s);
|
|
342
|
+
U.set(l,f),await o(U),s=U});i=T,await T}async function u(){r=!0,await i.catch(()=>{}),s.clear(),e||await pn(t,{recursive:!0,
|
|
343
|
+
force:!0})}return Object.freeze({registryPath:n,get:c,register:a,close:u})}var R="VIBE64_DEPLOYMENT_INVALID",Ne=/^- (Prepare|Build|Migrate|Serve) `([^`\r\n]+)`:[ \t]+(.+)$/u,Ce="- Recreate on res\
|
|
344
|
+
tore: ",De="- Generated secrets: ",Pe="- Setup code: ",F="- Sandbox allows: ",ee="- Packages: ",mn=200,xi=/^[A-Za-z0-9_][A-Za-z0-9_.+-]{0,127}(?:\^[A-Za-z_][A-Za-z0-9_-]{0,31})?$/u,
|
|
345
|
+
te="- Instances: up to ",J=100,pe=Object.freeze(["fuse","gvisor"]),$e=/^[A-Z_][A-Z0-9_]*$/u,Q=Object.freeze({APP_ENV:"De\
|
|
344
346
|
ployment never sets APP_ENV: the host gives every step the environment it deploys to. Remove APP_ENV from Deployment.",SIDE_EFFECTS:"\
|
|
345
347
|
SIDE_EFFECTS was replaced by APP_ENV, which the host gives every step. Remove SIDE_EFFECTS from Deployment.",STAGING_REACHES_REAL_PEOPLE:"\
|
|
346
348
|
Deployment never sets STAGING_REACHES_REAL_PEOPLE: the host gives it to a Staging only while the project's owner marks t\
|
|
347
|
-
hat real people use that Staging. Remove STAGING_REACHES_REAL_PEOPLE from Deployment."}),
|
|
348
|
-
migrate:2,serve:3}),
|
|
349
|
-
ntimes: `runtime`...",`${
|
|
350
|
-
\`package\`...`,`${
|
|
351
|
-
ment\`...`]);function
|
|
352
|
-
e on restore paths",n)}function
|
|
353
|
-
i
|
|
354
|
-
length&&
|
|
355
|
-
|
|
356
|
-
variable name.",n),s}function
|
|
357
|
-
includes(i))&&
|
|
358
|
-
length&&
|
|
359
|
-
length),
|
|
360
|
-
n);let i=s.find(r=>!
|
|
349
|
+
hat real people use that Staging. Remove STAGING_REACHES_REAL_PEOPLE from Deployment."}),de=Object.freeze({prepare:0,build:1,
|
|
350
|
+
migrate:2,serve:3}),ne=Object.keys(de).map(e=>e[0].toUpperCase()+e.slice(1)),Le=Object.freeze(["- Workdir: `path`","- Ru\
|
|
351
|
+
ntimes: `runtime`...",`${Ce}\`glob\`...`,`${De}\`NAME\`...`,`${Pe}\`NAME\``,`${F}${pe.map(e=>`\`${e}\``).join(" ")}`,`${ee}\
|
|
352
|
+
\`package\`...`,`${te}\`count\``,"- Ready when: `GET` `/path` returns `200`",`- ${ne.join("|")} \`label\`: \`command\` \`argu\
|
|
353
|
+
ment\`...`]);function g(e,t,n,s={}){d(R,e,t,n,s)}function hn(e,t,n){return Ie(e.slice(Ce.length),R,t,"Deployment Recreat\
|
|
354
|
+
e on restore paths",n)}function fn(e,t,n){let s=v(e.slice(De.length),R,t,"Deployment Generated secrets",n);return s.some(
|
|
355
|
+
i=>!$e.test(i))&&g(t,"Deployment Generated secrets must be uppercase environment variable names.",n),new Set(s).size!==s.
|
|
356
|
+
length&&g(t,"Deployment contains a duplicate Generated secrets name.",n),s}function gn(e,t,n){let[s]=v(e.slice(Pe.length),
|
|
357
|
+
R,t,"Deployment Setup code",n,{count:1});return $e.test(s)||g(t,"Deployment Setup code must be an uppercase environment \
|
|
358
|
+
variable name.",n),s}function xe(e,t,n){let s=v(e.slice(F.length),R,t,"Deployment Sandbox allows",n);return s.some(i=>!pe.
|
|
359
|
+
includes(i))&&g(t,`Deployment Sandbox allows takes only ${pe.map(i=>`\`${i}\``).join(" and ")}.`,n),new Set(s).size!==s.
|
|
360
|
+
length&&g(t,"Deployment Sandbox allows names an allowance twice.",n),[...s].sort()}function Ve(e,t,n){let s=v(e.slice(ee.
|
|
361
|
+
length),R,t,"Deployment Packages",n,{maximum:1/0});s.length>mn&&g(t,`Deployment Packages names at most ${mn} packages.`,
|
|
362
|
+
n);let i=s.find(r=>!xi.test(r));return i!==void 0&&g(t,`Deployment Packages names packages as nixpkgs does, such as \`git\
|
|
361
363
|
\` or \`python313Packages.pip\`, or one output after ^, such as \`gcc-unwrapped^lib\`; ${JSON.stringify(i)} isn't one.`,
|
|
362
|
-
n),new Set(s).size!==s.length&&
|
|
363
|
-
|
|
364
|
-
nstances is a whole number from 1 to ${
|
|
365
|
-
command",n);s.some(r=>/\{(?:host|port)\}/u.test(r))&&
|
|
366
|
-
ve reads HOST and PORT from its environment.",n);let i=Object.keys(
|
|
367
|
-
|
|
368
|
-
"internal"]),
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
\`([^\`\\r\\n]*)\`$`,"u"),
|
|
372
|
-
bucket"]),
|
|
373
|
-
EAL_PEOPLE",
|
|
364
|
+
n),new Set(s).size!==s.length&&g(t,"Deployment Packages names a package twice.",n),s}function En(e,t,n){let[s]=v(e.slice(
|
|
365
|
+
te.length),R,t,"Deployment Instances",n,{count:1});return(!/^[1-9][0-9]{0,2}$/u.test(s)||Number(s)>J)&&g(t,`Deployment I\
|
|
366
|
+
nstances is a whole number from 1 to ${J}, such as \`4\`.`,n),Number(s)}function Me(e,t,n){let s=N(e[3],R,t,"Deployment \
|
|
367
|
+
command",n);s.some(r=>/\{(?:host|port)\}/u.test(r))&&g(t,"Deployment commands take no {host} or {port} placeholders; Ser\
|
|
368
|
+
ve reads HOST and PORT from its environment.",n);let i=Object.keys(Q).find(r=>s.some(o=>o.startsWith(`${r}=`)));return i&&
|
|
369
|
+
g(t,Q[i],n),{label:w(e[2],R,t,"Deployment step label",n),argv:s,role:e[1].toLowerCase()}}var bn=/^[a-z][a-z0-9-]{0,15}$/u;var yn=/^### Service `([^`\r\n]*)`:[ \t]+(.+)$/u,wn=/^### Resource `([^`\r\n]*)`$/u,Mi=bn,vn=8,ji=Object.freeze(["public",
|
|
370
|
+
"internal"]),Gi=Object.freeze({"any instance":"any","each instance":"each"}),Ui=/^- Production: `([^`\r\n]*)` instances?$/u,
|
|
371
|
+
Bi=/^- Instances: `([^`\r\n]*)` to `([^`\r\n]*)`$/u,Wi=/^- Needs at least: `([^`\r\n]*)` vCPU, `([^`\r\n]*)` GiB memory$/u,
|
|
372
|
+
zi=/^- Reaches: `([^`\r\n]*)` as `([^`\r\n]*)`$/u,Hi=/^- Setting `([^`\r\n]*)`:[ \t]+(.+)$/u,ut=e=>new RegExp(`^- ${e}: \
|
|
373
|
+
\`([^\`\\r\\n]*)\`$`,"u"),Fi=ut("Exposure"),qi=ut("Reached"),Ki=ut("Development"),_n=Object.freeze(["local folder","own \
|
|
374
|
+
bucket"]),Yi=Object.freeze(["APP_ENV","HOST","PORT","APP_PUBLIC_URL","TRUSTED_PROXIES"]),Sn="V64_",Xi="STAGING_REACHES_R\
|
|
375
|
+
EAL_PEOPLE",In=Object.freeze(["### Service `id`: summary","### Resource `id`"]),lt=Object.freeze(["- Exposure: `public` \
|
|
374
376
|
or `internal`","- Serve `label`: `command` `argument`...","- Ready when: `GET` `/path` returns `200`","- Instances: `min\
|
|
375
377
|
` to `max`","- Needs at least: `N` vCPU, `N` GiB memory","- Production: `N` instances","- Reached: `any instance` or `ea\
|
|
376
|
-
ch instance`","- Reaches: `service` as `SETTING`","- Setting `NAME`: `value`",`${
|
|
377
|
-
\``).join(" ")}`]),
|
|
378
|
-
e=>![F,
|
|
379
|
-
includes(e)?`${e} is a setting the host gives every service itself`:e===
|
|
380
|
-
while the project's owner marks that real people use it`:e.startsWith(
|
|
381
|
-
the host gives each instance`:""}function
|
|
378
|
+
ch instance`","- Reaches: `service` as `SETTING`","- Setting `NAME`: `value`",`${ee}\`package\`...`,`${F}${pe.map(e=>`\`${e}\
|
|
379
|
+
\``).join(" ")}`]),Tn=Object.freeze([`- Development: ${_n.map(e=>`\`${e}\``).join(" or ")}`]),Zi=Object.freeze(Le.filter(
|
|
380
|
+
e=>![F,te,"- Ready when: "].some(t=>e.startsWith(t))).map(e=>e.replace(`|${ne.at(-1)} `," ")));function Ji(e){return Yi.
|
|
381
|
+
includes(e)?`${e} is a setting the host gives every service itself`:e===Xi?`${e} is the host's, given to a Staging only \
|
|
382
|
+
while the project's owner marks that real people use it`:e.startsWith(Sn)?`${e} starts with ${Sn}, which names the facts\
|
|
383
|
+
the host gives each instance`:""}function On(e,t,n,s){let i=e[1];return Mi.test(i)||g(t,`A service's id is a lowercase \
|
|
382
384
|
letter, then up to 15 lowercase letters, digits and hyphens, such as \`web\`; ${JSON.stringify(i)} isn't one.`,n),s.some(
|
|
383
|
-
r=>r.id===i)&&
|
|
384
|
-
services.`,n),{id:i,summary:w(e[2],
|
|
385
|
-
readyWhen:null,instances:null,production:null,atLeast:null,reaches:[],settings:{},packages:[],sandboxAllowances:[]}}function
|
|
385
|
+
r=>r.id===i)&&g(t,`Deployment declares service \`${i}\` twice.`,n),s.length===vn&&g(t,`A Deployment declares at most ${vn}\
|
|
386
|
+
services.`,n),{id:i,summary:w(e[2],R,t,"Service summary",n),line:n,lines:{},settingLines:{},exposure:"",reached:"",serve:null,
|
|
387
|
+
readyWhen:null,instances:null,production:null,atLeast:null,reaches:[],settings:{},packages:[],sandboxAllowances:[]}}function he(e,{
|
|
386
388
|
min:t=1,max:n=100}={}){return/^[1-9][0-9]{0,3}$/u.test(e)&&Number(e)>=t&&Number(e)<=n?Number(e):null}function kn(e,t,n,s){
|
|
387
|
-
let i=c=>
|
|
388
|
-
o=t.match(
|
|
389
|
-
bove the first ### heading.`),r("Serve");let c=
|
|
390
|
-
xposure: ")){r("Exposure"),e.exposure=t.match(
|
|
391
|
-
`.");return}if(t.startsWith("- Reached: ")){r("Reached"),e.reached=
|
|
392
|
-
y instance` or `each instance`.");return}if(t.startsWith("- Ready when: ")){r("Ready when");let c=
|
|
389
|
+
let i=c=>g(n,`Service \`${e.id}\`: ${c}`,s),r=c=>{Object.hasOwn(e.lines,c)&&i(`it has a second ${c} line.`),e.lines[c]=s},
|
|
390
|
+
o=t.match(Ne);if(o){o[1]!=="Serve"&&i(`${o[1]} is the whole Deployment's, since one build serves every service: put it a\
|
|
391
|
+
bove the first ### heading.`),r("Serve");let c=Me(o,n,s);e.serve={label:c.label,argv:c.argv};return}if(t.startsWith("- E\
|
|
392
|
+
xposure: ")){r("Exposure"),e.exposure=t.match(Fi)?.[1]??"",ji.includes(e.exposure)||i("Exposure is `public` or `internal\
|
|
393
|
+
`.");return}if(t.startsWith("- Reached: ")){r("Reached"),e.reached=Gi[t.match(qi)?.[1]]??"",e.reached||i("Reached is `an\
|
|
394
|
+
y instance` or `each instance`.");return}if(t.startsWith("- Ready when: ")){r("Ready when");let c=ue(t,R,n,`Service \`${e.
|
|
393
395
|
id}\` readiness`,s);e.readyWhen={method:c.method,path:c.path,status:c.status};return}if(t.startsWith("- Instances: ")){r(
|
|
394
|
-
"Instances");let c=t.match(
|
|
395
|
-
is a range of whole numbers from 1 to ${
|
|
396
|
-
max:u};return}if(t.startsWith("- Needs at least: ")){r("Needs at least");let c=t.match(
|
|
396
|
+
"Instances");let c=t.match(Bi),a=he(c?.[1]??"",{max:J}),u=he(c?.[2]??"",{max:J});(a===null||u===null||a>u)&&i(`Instances\
|
|
397
|
+
is a range of whole numbers from 1 to ${J}, the least first, such as \`- Instances: \`1\` to \`6\`\`.`),e.instances={min:a,
|
|
398
|
+
max:u};return}if(t.startsWith("- Needs at least: ")){r("Needs at least");let c=t.match(Wi),a=he(c?.[1]??"",{max:1024}),u=he(
|
|
397
399
|
c?.[2]??"",{max:4096});(a===null||u===null)&&i("Needs at least takes whole numbers of vCPUs and GiB, such as `- Needs at\
|
|
398
400
|
least: `2` vCPU, `4` GiB memory`."),e.atLeast={vcpus:a,memoryGib:u};return}if(t.startsWith("- Production: ")){r("Produc\
|
|
399
|
-
tion");let c=
|
|
400
|
-
ch as `- Production: `2` instances`."),e.production=c;return}if(t.startsWith("- Reaches: ")){let c=t.match(
|
|
401
|
+
tion");let c=he(t.match(Ui)?.[1]??"",{max:J});c===null&&i("Production says how many instances Production starts with, su\
|
|
402
|
+
ch as `- Production: `2` instances`."),e.production=c;return}if(t.startsWith("- Reaches: ")){let c=t.match(zi);c||i("Rea\
|
|
401
403
|
ches names a service and the setting that gets its address: `- Reaches: `service` as `SETTING``."),e.reaches.push({service:c[1],
|
|
402
|
-
setting:c[2],line:s});return}if(t.startsWith("- Setting ")){let c=t.match(
|
|
403
|
-
ue``.");let[a]=
|
|
404
|
-
s;return}if(t.startsWith(
|
|
405
|
-
|
|
406
|
-
loyment's: put it above the first ### heading.`),
|
|
407
|
-
n,`Service \`${e.id}\`: ${o}`,s)
|
|
408
|
-
such as \`API_URL\`.`),t==="SIDE_EFFECTS"&&i(
|
|
409
|
-
hasOwn(e.settings,t)||e.reaches.some(o=>o.setting===t&&o.line!==s))&&i(`it names the setting ${t} twice.`)}function
|
|
410
|
-
let i=e[1];return
|
|
411
|
-
i)} isn't one.`,n),s.has(i)&&
|
|
412
|
-
function
|
|
413
|
-
pment line.`,s),e.development=t.match(
|
|
414
|
-
\`: Development is \`local folder\` or \`own bucket\`.`,s);return}
|
|
415
|
-
yment's own entries come before the first ### heading.`,s)}function
|
|
416
|
-
line)=>
|
|
417
|
-
["Instances",r.instances]])u||o(`it needs a${a==="Exposure"||a==="Instances"?"n":""} ${a} line: ${
|
|
404
|
+
setting:c[2],line:s});return}if(t.startsWith("- Setting ")){let c=t.match(Hi);c||i("A setting is `- Setting `NAME`: `val\
|
|
405
|
+
ue``.");let[a]=v(c[2],R,n,`Service \`${e.id}\` Setting ${c[1]}`,s,{count:1});An(e,c[1],n,s),e.settings[c[1]]=a,e.settingLines[c[1]]=
|
|
406
|
+
s;return}if(t.startsWith(ee)){r("Packages"),e.packages=Ve(t,n,s);return}if(t.startsWith(F)){r("Sandbox allows"),e.sandboxAllowances=
|
|
407
|
+
xe(t,n,s);return}Zi.some(c=>t.startsWith(c.slice(0,c.indexOf(":")+1)))&&i(`${t.slice(2,t.indexOf(":"))} is the whole Dep\
|
|
408
|
+
loyment's: put it above the first ### heading.`),g(n,S(`Service \`${e.id}\` entry`,t,lt),s)}function An(e,t,n,s){let i=o=>g(
|
|
409
|
+
n,`Service \`${e.id}\`: ${o}`,s);$e.test(t)||i(`${JSON.stringify(t)} isn't a setting's name: use capitals, digits and _,\
|
|
410
|
+
such as \`API_URL\`.`),t==="SIDE_EFFECTS"&&i(Q.SIDE_EFFECTS);let r=Ji(t);r&&i(`${r}; give the setting another name.`),(Object.
|
|
411
|
+
hasOwn(e.settings,t)||e.reaches.some(o=>o.setting===t&&o.line!==s))&&i(`it names the setting ${t} twice.`)}function Rn(e,t,n,s){
|
|
412
|
+
let i=e[1];return Oe.test(i)||g(t,`### Resource names a resource of ## Resources by its id, such as \`files\`; ${JSON.stringify(
|
|
413
|
+
i)} isn't one.`,n),s.has(i)&&g(t,`Deployment has a second ### Resource \`${i}\`.`,n),{id:i,line:n,development:"",developmentLine:0}}
|
|
414
|
+
function Nn(e,t,n,s){if(t.startsWith("- Development: ")){e.developmentLine&&g(n,`Resource \`${e.id}\` has a second Develo\
|
|
415
|
+
pment line.`,s),e.development=t.match(Ki)?.[1]??"",e.developmentLine=s,_n.includes(e.development)||g(n,`Resource \`${e.id}\
|
|
416
|
+
\`: Development is \`local folder\` or \`own bucket\`.`,s);return}g(n,`${S(`Resource \`${e.id}\` entry`,t,Tn)} The Deplo\
|
|
417
|
+
yment's own entries come before the first ### heading.`,s)}function Cn(e,t,n){let s=e.map(r=>r.id);for(let r of e){let o=(a,u=r.
|
|
418
|
+
line)=>g(n,`Service \`${r.id}\`: ${a}`,u);for(let[a,u]of[["Exposure",r.exposure],["Serve",r.serve],["Ready when",r.readyWhen],
|
|
419
|
+
["Instances",r.instances]])u||o(`it needs a${a==="Exposure"||a==="Instances"?"n":""} ${a} line: ${lt.find(l=>l.startsWith(
|
|
418
420
|
a==="Serve"?"- Serve":`- ${a}:`))}.`);r.reached&&r.exposure==="public"&&o("Reached is for an internal service; a public \
|
|
419
421
|
one is reached at its address.",r.lines.Reached);let c=r.production??r.instances.min;(c<r.instances.min||c>r.instances.max)&&
|
|
420
422
|
o(`Production starts with ${c} instances, outside its Instances, ${r.instances.min} to ${r.instances.max}.`,r.lines.Production);
|
|
421
423
|
for(let a of r.reaches)a.service===r.id&&o("a service doesn't reach itself.",a.line),s.includes(a.service)||o(`there is \
|
|
422
424
|
no service \`${a.service}\`; this Deployment's services are ${s.map(u=>`\`${u}\``).join(", ")}. Fix the name in its Reac\
|
|
423
|
-
hes line.`,a.line),r.reaches.filter(u=>u.service===a.service).length>1&&o(`it reaches \`${a.service}\` twice.`,a.line),
|
|
425
|
+
hes line.`,a.line),r.reaches.filter(u=>u.service===a.service).length>1&&o(`it reaches \`${a.service}\` twice.`,a.line),An(
|
|
424
426
|
r,a.setting,n,a.line);for(let a of[...r.reaches.map(u=>u.setting),...Object.keys(r.settings)])if(t.generatedSecrets.includes(
|
|
425
427
|
a)||t.setupCode===a){let u=r.reaches.find(l=>l.setting===a)?.line??r.settingLines[a];o(`${a} is the Deployment's ${t.setupCode===
|
|
426
428
|
a?"Setup code":"generated secret"}, which every service gets already; give the setting another name.`,u)}}let i=e.filter(
|
|
427
|
-
r=>r.exposure==="public");return i.length!==1&&
|
|
429
|
+
r=>r.exposure==="public");return i.length!==1&&g(n,i.length===0?"A Deployment with services has exactly one public servi\
|
|
428
430
|
ce: give one of them `- Exposure: `public``.":`A Deployment with services has exactly one public service; ${i.map(({id:r})=>`\
|
|
429
431
|
\`${r}\``).join(" and ")} are both public.`,i[1]?.line??e[0].line),e.map(r=>({id:r.id,summary:r.summary,exposure:r.exposure,
|
|
430
432
|
reached:r.reached||"any",serve:r.serve,readyWhen:r.readyWhen,instances:{min:r.instances.min,max:r.instances.max,production:r.
|
|
431
433
|
production??r.instances.min},atLeast:r.atLeast,reaches:r.reaches.map(({service:o,setting:c})=>({service:o,setting:c})),settings:r.
|
|
432
|
-
settings,packages:r.packages,sandboxAllowances:r.sandboxAllowances}))}function
|
|
433
|
-
values()){let o=s.get(r.id);o||
|
|
434
|
+
settings,packages:r.packages,sandboxAllowances:r.sandboxAllowances}))}function Dn(e,t,n){let s=ke(t);for(let r of e.resources.
|
|
435
|
+
values()){let o=s.get(r.id);o||g(n,`### Resource \`${r.id}\`: genesis/stack.md's ## Resources declares no resource \`${r.
|
|
434
436
|
id}\`${s.size?`; its resources are ${[...s.keys()].map(c=>`\`${c}\``).join(", ")}`:""}.`,r.line),r.development&&o.kind!==
|
|
435
|
-
"bucket"&&
|
|
437
|
+
"bucket"&&g(n,`Resource \`${r.id}\`: Development says how development provides a bucket, and \`${r.id}\` is a ${o.kind} \
|
|
436
438
|
resource.`,r.developmentLine)}let i=new Map;for(let r of s.values())for(let o of Array.isArray(r.environmentAlternatives)?
|
|
437
439
|
r.environmentAlternatives:[])for(let c of Object.values(o?.bindings??{}))typeof c=="string"&&i.set(c,r.id);for(let r of e.
|
|
438
|
-
services){let o=[...r.reaches.map(c=>[c.setting,c.line]),...Object.entries(r.settingLines)];for(let[c,a]of o)i.has(c)&&
|
|
439
|
-
n,`Service \`${r.id}\`: ${c} is the setting resource \`${i.get(c)}\` binds; give the setting another name.`,a)}}var
|
|
440
|
+
services){let o=[...r.reaches.map(c=>[c.setting,c.line]),...Object.entries(r.settingLines)];for(let[c,a]of o)i.has(c)&&g(
|
|
441
|
+
n,`Service \`${r.id}\`: ${c} is the setting resource \`${i.get(c)}\` binds; give the setting another name.`,a)}}var $n="vibe64.application-deployment.v2",Qi="vibe64.application-deployment.v1",Ln="Deployment";function pt(){return{version:1,
|
|
440
442
|
artifact:{disposablePaths:[]},workdir:".",runtimeRequirements:[],generatedSecrets:[],setupCode:"",sandboxAllowances:[],packages:[],
|
|
441
|
-
instances:{max:1},readiness:null,steps:[],services:[],deploymentResources:{}}}function
|
|
442
|
-
ployment must be supplied as exact Stack section lines.");let n={services:[],resources:new Map};if(_(e))return{result:
|
|
443
|
-
located:n};let s=
|
|
444
|
-
trim();if(!a)continue;let u=c+1;if(a.startsWith("#")){let
|
|
445
|
-
n.services.push(o.service)):p?(o={resource:
|
|
446
|
-
oyment heading",a,
|
|
447
|
-
let l=a.match(
|
|
443
|
+
instances:{max:1},readiness:null,steps:[],services:[],deploymentResources:{}}}function xn(e,t){Array.isArray(e)||g(t,"De\
|
|
444
|
+
ployment must be supplied as exact Stack section lines.");let n={services:[],resources:new Map};if(_(e))return{result:pt(),
|
|
445
|
+
located:n};let s=pt(),i=new Set,r=e.some(c=>c.trim().startsWith("### Service ")),o=null;for(let c=0;c<e.length;c+=1){let a=e[c].
|
|
446
|
+
trim();if(!a)continue;let u=c+1;if(a.startsWith("#")){let m=a.match(yn),p=m?null:a.match(wn);m?(o={service:On(m,t,u,n.services)},
|
|
447
|
+
n.services.push(o.service)):p?(o={resource:Rn(p,t,u,n.resources)},n.resources.set(o.resource.id,o.resource)):g(t,S("Depl\
|
|
448
|
+
oyment heading",a,In),u);continue}if(o?.service){kn(o.service,a,t,u);continue}if(o?.resource){Nn(o.resource,a,t,u);continue}
|
|
449
|
+
let l=a.match(Ne);if(r&&(l?.[1]==="Serve"||[F,te,"- Ready when: ","- Instances: "].some(m=>a.startsWith(m)))&&g(t,`In a \
|
|
448
450
|
Deployment with services, each service says its own Serve, Ready when, Instances and Sandbox allows: move \`${a}\` under \
|
|
449
|
-
its \`### Service\` heading.`,u),a.startsWith("- Workdir: ")){i.has("workdir")&&
|
|
450
|
-
add("workdir");let
|
|
451
|
-
if(a.startsWith("- Runtimes: ")){i.has("runtimes")&&
|
|
452
|
-
C(a.slice(12),
|
|
453
|
-
nt Recreate on restore entry.",u),i.add("restore-paths"),s.artifact.disposablePaths=
|
|
454
|
-
i.has("generated-secrets")&&
|
|
455
|
-
|
|
456
|
-
s.setupCode=
|
|
457
|
-
i.add("sandbox-allows"),s.sandboxAllowances=
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
i.has("readiness")&&
|
|
461
|
-
ess",u);continue}if(l){s.steps.push(
|
|
462
|
-
1)
|
|
463
|
-
t),s.services=
|
|
451
|
+
its \`### Service\` heading.`,u),a.startsWith("- Workdir: ")){i.has("workdir")&&g(t,"Duplicate Deployment Workdir.",u),i.
|
|
452
|
+
add("workdir");let m=v(a.slice(11),R,t,"Deployment Workdir",u,{count:1})[0];s.workdir=y(m,R,t,"Deployment workdir",u);continue}
|
|
453
|
+
if(a.startsWith("- Runtimes: ")){i.has("runtimes")&&g(t,"Duplicate Deployment Runtimes.",u),i.add("runtimes"),s.runtimeRequirements=
|
|
454
|
+
C(a.slice(12),R,t,"Deployment runtimes",u);continue}if(a.startsWith(Ce)){i.has("restore-paths")&&g(t,"Duplicate Deployme\
|
|
455
|
+
nt Recreate on restore entry.",u),i.add("restore-paths"),s.artifact.disposablePaths=hn(a,t,u);continue}if(a.startsWith(De)){
|
|
456
|
+
i.has("generated-secrets")&&g(t,"Duplicate Deployment Generated secrets entry.",u),i.add("generated-secrets"),s.generatedSecrets=
|
|
457
|
+
fn(a,t,u);continue}if(a.startsWith(Pe)){i.has("setup-code")&&g(t,"Duplicate Deployment Setup code.",u),i.add("setup-code"),
|
|
458
|
+
s.setupCode=gn(a,t,u);continue}if(a.startsWith(F)){i.has("sandbox-allows")&&g(t,"Duplicate Deployment Sandbox allows.",u),
|
|
459
|
+
i.add("sandbox-allows"),s.sandboxAllowances=xe(a,t,u);continue}if(a.startsWith(ee)){i.has("packages")&&g(t,"Duplicate De\
|
|
460
|
+
ployment Packages.",u),i.add("packages"),s.packages=Ve(a,t,u);continue}if(a.startsWith(te)){i.has("instances")&&g(t,"Dup\
|
|
461
|
+
licate Deployment Instances.",u),i.add("instances"),s.instances={max:En(a,t,u)};continue}if(a.startsWith("- Ready when: ")){
|
|
462
|
+
i.has("readiness")&&g(t,"Duplicate Deployment Ready when.",u),i.add("readiness"),s.readiness=ue(a,R,t,"Deployment readin\
|
|
463
|
+
ess",u);continue}if(l){s.steps.push(Me(l,t,u));continue}g(t,S("Deployment entry",a,Le),u)}if(r){for(let a=1;a<s.steps.length;a+=
|
|
464
|
+
1)de[s.steps[a].role]<de[s.steps[a-1].role]&&g(t,`Deployment steps must be ordered ${ne.slice(0,-1).join(", ")}.`);Pn(s,
|
|
465
|
+
t),s.services=Cn(n.services,s,t);let c=s.services.find(a=>a.exposure==="public");s.steps.push({label:c.serve.label,argv:[
|
|
464
466
|
...c.serve.argv],role:"serve"}),s.readiness={kind:"http",...c.readyWhen},s.instances={max:c.instances.max},s.sandboxAllowances=
|
|
465
|
-
[...new Set(s.services.flatMap(a=>a.sandboxAllowances))].sort()}else{s.steps.length===0&&
|
|
467
|
+
[...new Set(s.services.flatMap(a=>a.sandboxAllowances))].sort()}else{s.steps.length===0&&g(t,"## Deployment needs at lea\
|
|
466
468
|
st one command or exactly `- Nothing.`."),(s.steps.filter(({role:u})=>u==="serve").length!==1||s.steps.at(-1).role!=="se\
|
|
467
|
-
rve")&&
|
|
468
|
-
steps[u-1].role]&&
|
|
469
|
-
|
|
469
|
+
rve")&&g(t,"Deployment needs exactly one final Serve step.");for(let u=1;u<s.steps.length;u+=1)de[s.steps[u].role]<de[s.
|
|
470
|
+
steps[u-1].role]&&g(t,`Deployment steps must be ordered ${ne.slice(0,-1).join(", ")}, then ${ne.at(-1)}.`);s.readiness||
|
|
471
|
+
g(t,"Deployment needs one Ready when entry."),Pn(s,t);let a=s.steps.at(-1);s.services=[{id:"web",summary:"",exposure:"pu\
|
|
470
472
|
blic",reached:"any",serve:{label:a.label,argv:[...a.argv]},readyWhen:{method:s.readiness.method,path:s.readiness.path,status:s.
|
|
471
473
|
readiness.status},instances:{min:1,max:s.instances.max,production:1},atLeast:null,reaches:[],settings:{},packages:[],sandboxAllowances:[
|
|
472
474
|
...s.sandboxAllowances]}]}return s.deploymentResources=Object.fromEntries([...n.resources.values()].map(c=>[c.id,c.development?
|
|
473
|
-
{development:c.development}:{}])),{result:s,located:n}}function
|
|
474
|
-
e.setupCode].includes(s));n&&
|
|
475
|
+
{development:c.development}:{}])),{result:s,located:n}}function Pn(e,t){let n=Object.keys(Q).find(s=>[...e.generatedSecrets,
|
|
476
|
+
e.setupCode].includes(s));n&&g(t,Q[n]),e.generatedSecrets.includes(e.setupCode)&&g(t,"Deployment Setup code is generated\
|
|
475
477
|
already; leave it out of Generated secrets."),e.artifact.disposablePaths.length>0&&!e.steps.some(({role:s})=>s==="prepa\
|
|
476
|
-
re")&&
|
|
477
|
-
genesis/stack.md#Deployment"}=t;return
|
|
478
|
-
section");let n=[...t.diagnostics||[]],s=
|
|
479
|
-
a);
|
|
478
|
+
re")&&g(t,"Deployment may recreate paths on restore only when it declares a Prepare step.")}function er(e,t={}){let{path:n="\
|
|
479
|
+
genesis/stack.md#Deployment"}=t;return xn(e,n).result}function Vn({environment:e={},section:t={}}={}){M(t,e,"Deployment \
|
|
480
|
+
section");let n=[...t.diagnostics||[]],s=pt(),i=!1;if(t.status==="ready"){let a="genesis/stack.md#Deployment",u=xn(t.lines,
|
|
481
|
+
a);Dn(u.located,e.resources,a),s=u.result,i=u.located.services.length>0}let r=n.length>0?"blocked":s.steps.length>0?"rea\
|
|
480
482
|
dy":"unconfigured",o={version:s.version,artifact:s.artifact,workdir:s.workdir,runtimeRequirements:s.runtimeRequirements,
|
|
481
483
|
generatedSecrets:s.generatedSecrets,setupCode:s.setupCode,sandboxAllowances:s.sandboxAllowances,packages:s.packages,instances:s.
|
|
482
484
|
instances,readiness:s.readiness,steps:s.steps},c={...o,...i?{services:s.services}:{},...Object.keys(s.deploymentResources).
|
|
483
|
-
length>0?{deploymentResources:s.deploymentResources}:{}};return{contract
|
|
485
|
+
length>0?{deploymentResources:s.deploymentResources}:{}};return{contract:$n,status:r,stackHash:t.stackHash,recipeHash:r===
|
|
484
486
|
"ready"?k(c):"",components:[...t.components||[]],source:t.source||null,runtimeRequirements:H(s.runtimeRequirements),resources:structuredClone(
|
|
485
|
-
e.resources||[]),...o,services:s.services,deploymentResources:s.deploymentResources,diagnostics:n}}var
|
|
486
|
-
de"]),
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
487
|
+
e.resources||[]),...o,services:s.services,deploymentResources:s.deploymentResources,diagnostics:n}}var Ge="vibe64.packaging.v1",Wn="Packaging",oc=Object.freeze(["genesis",".genesis",".agents",".claude",".codex",".openco\
|
|
488
|
+
de"]),V="VIBE64_PACKAGING_INVALID",tr=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u,nr=/^[A-Z_][A-Z0-9_]*$/u,sr=/^[a-zA-Z][a-zA-Z0-9_]*(?:\.[a-zA-Z][a-zA-Z0-9_]*)+$/u,
|
|
489
|
+
ir=/^[a-z][a-z0-9+.-]*$/u,rr=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/u,or=/\{[^{}\s]*\}/u,
|
|
490
|
+
ar=/^### Package `([^`\r\n]+)`:[ \t]+(.+)$/u,cr=/^- (Prepare|Build) `([^`\r\n]+)`:[ \t]+(.+)$/u,ur=/^- Environment `([^`\r\n]+)`:[ \t]+(.+)$/u,
|
|
491
|
+
lr=/^- Permission `([^`\r\n]+)`:[ \t]+(.+)$/u,pr=/^- Content: package `([^`\r\n]+)`$/u,Mn=50,jn=500,dr=/(?:^|_)(?:TOKEN|SECRET|PASSWORD|PASSPHRASE|PRIVATE_KEY|API_KEY|CREDENTIALS?)(?:_|$)/u,
|
|
492
|
+
zn=Object.freeze({npm:Object.freeze({entries:["workdir","runtimes","prepare","build","environment","versionFrom"],required:[
|
|
491
493
|
"versionFrom"],versionSources:["package.json","external"]}),"python-dist":Object.freeze({entries:["workdir","runtimes","\
|
|
492
494
|
prepare","build","environment","output","versionFrom"],required:["build","output","versionFrom"],versionSources:["pyproj\
|
|
493
495
|
ect.toml","external"]}),"web-bundle":Object.freeze({entries:["workdir","runtimes","prepare","build","environment","outpu\
|
|
494
496
|
t"],required:["build","output"],versionSources:[]}),capacitor:Object.freeze({entries:["workdir","content","platforms","a\
|
|
495
497
|
pplicationId","name","icon","versionFrom","deepLinkSchemeFrom","appLinkDomainsFrom","permission"],required:["content","p\
|
|
496
|
-
latforms","applicationId","name","icon","versionFrom"],versionSources:["package.json","external"]})}),
|
|
497
|
-
keys(
|
|
498
|
-
\``).join(" | "),
|
|
498
|
+
latforms","applicationId","name","icon","versionFrom"],versionSources:["package.json","external"]})}),je=Object.freeze(Object.
|
|
499
|
+
keys(zn)),dt=Object.freeze(["android"]),mt=Object.freeze(["package.json","pyproject.toml","external"]),Y=e=>e.map(t=>`\`${t}\
|
|
500
|
+
\``).join(" | "),se=Object.freeze([["- Packer: ","packer",`- Packer: ${Y(je)}`],["- Workdir: ","workdir","- Workdir: `pa\
|
|
499
501
|
th`"],["- Runtimes: ","runtimes","- Runtimes: `runtime`..."],["- Output: ","output","- Output: `path`"],["- Version from\
|
|
500
|
-
: ","versionFrom",`- Version from: ${Y(
|
|
502
|
+
: ","versionFrom",`- Version from: ${Y(mt)}`],["- Platforms: ","platforms",`- Platforms: ${Y(dt)}...`],["- Id: ","applic\
|
|
501
503
|
ationId","- Id: `reverse.dns.id`"],["- Name: ","name","- Name: `Display name`"],["- Icon: ","icon","- Icon: `path/to/ico\
|
|
502
504
|
n-1024.png`"],["- Deep link scheme from: ","deepLinkSchemeFrom","- Deep link scheme from: `ENV_NAME`"],["- App link doma\
|
|
503
|
-
ins from: ","appLinkDomainsFrom","- App link domains from: `ENV_NAME`"]]),
|
|
504
|
-
[
|
|
505
|
-
|
|
506
|
-
|
|
505
|
+
ins from: ","appLinkDomainsFrom","- App link domains from: `ENV_NAME`"]]),Gn="### Package `id`: Label",mr=Object.freeze(
|
|
506
|
+
[se[0][2],se[1][2],se[2][2],"- Prepare|Build `label`: `command` `argument`...","- Environment `NAME`: `value`",se[3][2],
|
|
507
|
+
se[4][2],"- Content: package `web-bundle-id`",...se.slice(5).map(([,,e])=>e),"- Permission `id`: User-facing reason."]),
|
|
508
|
+
fe=Object.freeze({packer:"Packer",workdir:"Workdir",runtimes:"Runtimes",prepare:"Prepare",build:"Build",environment:"Env\
|
|
507
509
|
ironment",output:"Output",versionFrom:"Version from",content:"Content",platforms:"Platforms",applicationId:"Id",name:"Na\
|
|
508
510
|
me",icon:"Icon",deepLinkSchemeFrom:"Deep link scheme from",appLinkDomainsFrom:"App link domains from",permission:"Permis\
|
|
509
|
-
sion"});function b(e,t,n){
|
|
510
|
-
case letters, digits, and single hyphens.`,s),i}function
|
|
511
|
-
function
|
|
512
|
-
return
|
|
513
|
-
b(s,`Package ${e.id} has a duplicate ${
|
|
514
|
-
let r=`Packaging ${
|
|
515
|
-
|
|
516
|
-
ns a duplicate platform.`,i),c}let o=
|
|
517
|
-
cker \`${o}\`. ${
|
|
518
|
-
workdir"});if(e==="icon"){let c=
|
|
519
|
-
1024x1024 PNG file.`,i),c}return e==="versionFrom"?(
|
|
520
|
-
Id"?((!
|
|
521
|
-
derscores; each part starts with a letter).`,i),o):e==="name"?((o.trim()!==o||o.length>
|
|
522
|
-
characters without surrounding spaces.`,i),o):
|
|
523
|
-
e[2],
|
|
511
|
+
sion"});function b(e,t,n){d(V,e,t,n)}function ht(e,t,n,s){let i=w(e,V,t,n,s);return tr.test(i)||b(t,`${n} must use lower\
|
|
512
|
+
case letters, digits, and single hyphens.`,s),i}function hr(e,t,n,s,i){return v(e.slice(t.length),V,n,s,i,{count:1})[0]}
|
|
513
|
+
function ft(e,t,n,s){return e.some(i=>or.test(i))&&b(t,`${n} takes no placeholders in ${Ge}.`,s),e}function Hn(e,t,n,s){
|
|
514
|
+
return nr.test(e)||b(t,`${n} must be an uppercase environment variable name.`,s),e}function Un(e,t,n,s,i){e.seen.has(t)&&
|
|
515
|
+
b(s,`Package ${e.id} has a duplicate ${fe[t]} entry.`,i),e.seen.add(t),e.fields[t]=n,e.lines[t]=i}function fr(e,t,n,s,i){
|
|
516
|
+
let r=`Packaging ${fe[e]}`;if(e==="runtimes")return C(t.slice(n.length),V,s,r,i);if(e==="platforms"){let c=v(t.slice(n.length),
|
|
517
|
+
V,s,r,i);return c.some(a=>!dt.includes(a))&&b(s,`${r} must be ${Y(dt)}.`,i),new Set(c).size!==c.length&&b(s,`${r} contai\
|
|
518
|
+
ns a duplicate platform.`,i),c}let o=ft([hr(t,n,s,r,i)],s,r,i)[0];if(e==="packer")return je.includes(o)||b(s,`Unknown pa\
|
|
519
|
+
cker \`${o}\`. ${Ge} packers are ${Y(je)}.`,i),o;if(["workdir","output"].includes(e))return y(o,V,s,r,i,{allowRoot:e==="\
|
|
520
|
+
workdir"});if(e==="icon"){let c=y(o,V,s,r,i,{allowRoot:!1});return c.toLowerCase().endsWith(".png")||b(s,`${r} must be a\
|
|
521
|
+
1024x1024 PNG file.`,i),c}return e==="versionFrom"?(mt.includes(o)||b(s,`${r} must be ${Y(mt)}.`,i),o):e==="application\
|
|
522
|
+
Id"?((!sr.test(o)||o.length>150)&&b(s,`${r} must be a reverse-DNS id such as \`com.example.notes\` (letters, digits and un\
|
|
523
|
+
derscores; each part starts with a letter).`,i),o):e==="name"?((o.trim()!==o||o.length>Mn)&&b(s,`${r} must be at most ${Mn}\
|
|
524
|
+
characters without surrounding spaces.`,i),o):Hn(o,s,r,i)}function gr(e,t,n){return{id:ht(e[1],t,"Package id",n),label:w(
|
|
525
|
+
e[2],V,t,"Package label",n),fields:{},lines:{},prepare:[],build:[],environment:[],permissions:[],seen:new Set,line:n}}function Er(e,t,n,s){
|
|
524
526
|
/^- Plugins?\b/u.test(t)&&b(n,"Packaging takes no Plugin list: the generated shell installs the native plugins of the Co\
|
|
525
|
-
ntent package at its lockfile versions.",s);for(let[a,u]of
|
|
526
|
-
match(
|
|
527
|
-
u=`Packaging ${r[1]} command`;e[a].push({label:w(r[2],
|
|
528
|
-
e.lines[a]??=s;return}let o=t.match(
|
|
527
|
+
ntent package at its lockfile versions.",s);for(let[a,u]of se)if(t.startsWith(a)){Un(e,u,fr(u,t,a,n,s),n,s);return}let i=t.
|
|
528
|
+
match(pr);if(i){Un(e,"content",ht(i[1],n,"Packaging Content package",s),n,s);return}let r=t.match(cr);if(r){let a=r[1].toLowerCase(),
|
|
529
|
+
u=`Packaging ${r[1]} command`;e[a].push({label:w(r[2],V,n,`Packaging ${r[1]} label`,s),argv:ft(N(r[3],V,n,u,s),n,u,s)}),
|
|
530
|
+
e.lines[a]??=s;return}let o=t.match(ur);if(o){let a=Hn(o[1],n,"Packaging Environment name",s);dr.test(a)&&b(n,`Packaging\
|
|
529
531
|
Environment ${a} looks like a credential. Packaging holds only non-secret build facts.`,s),e.environment.some(l=>l.name===
|
|
530
|
-
a)&&b(n,`Package ${e.id} has a duplicate Environment ${a}.`,s);let u=
|
|
532
|
+
a)&&b(n,`Package ${e.id} has a duplicate Environment ${a}.`,s);let u=ft(v(o[2],V,n,"Packaging Environment value",s,{count:1}),
|
|
531
533
|
n,"Packaging Environment value",s)[0];e.environment.push({name:a,value:u}),e.lines.environment??=s;return}let c=t.match(
|
|
532
|
-
|
|
533
|
-
length>
|
|
534
|
+
lr);if(c){let a=ht(c[1],n,"Packaging Permission id",s),u=w(c[2],V,n,"Packaging Permission reason",s);(u.includes("`")||u.
|
|
535
|
+
length>jn)&&b(n,`Packaging Permission reason is plain user-facing text of at most ${jn} characters.`,s),e.permissions.some(
|
|
534
536
|
l=>l.id===a)&&b(n,`Package ${e.id} has a duplicate Permission ${a}.`,s),e.permissions.push({id:a,reason:u}),e.lines.permission??=
|
|
535
|
-
s;return}b(n,
|
|
536
|
-
entry: ${Y(
|
|
537
|
+
s;return}b(n,S("Packaging entry",t,mr),s)}function br(e,t){let n=e.fields.packer;n||b(t,`Package ${e.id} needs a Packer \
|
|
538
|
+
entry: ${Y(je)}.`,e.line);let s=zn[n],i=new Set([...Object.keys(e.fields).filter(o=>o!=="packer"),...["prepare","build",
|
|
537
539
|
"environment"].filter(o=>e[o].length),...e.permissions.length?["permission"]:[]]);for(let o of i)s.entries.includes(o)||
|
|
538
|
-
b(t,`The ${n} packer takes no ${
|
|
539
|
-
needs ${/^[AEIOU]/u.test(
|
|
540
|
+
b(t,`The ${n} packer takes no ${fe[o]} entry.`,e.lines[o]);for(let o of s.required)i.has(o)||b(t,`Package ${e.id} (${n})\
|
|
541
|
+
needs ${/^[AEIOU]/u.test(fe[o])?"an":"a"} ${fe[o]} entry.`,e.line);e.fields.versionFrom&&!s.versionSources.includes(e.fields.
|
|
540
542
|
versionFrom)&&b(t,`The ${n} packer reads its version from ${Y(s.versionSources)}.`,e.lines.versionFrom);let r={id:e.id,label:e.
|
|
541
543
|
label,packer:n,workdir:e.fields.workdir||".",runtimeRequirements:e.fields.runtimes||[],prepare:e.prepare,build:e.build,environment:e.
|
|
542
544
|
environment,output:e.fields.output||null,versionFrom:e.fields.versionFrom||null};return n!=="capacitor"?r:{...r,content:e.
|
|
543
545
|
fields.content,platforms:e.fields.platforms,application:{id:e.fields.applicationId,name:e.fields.name,icon:e.fields.icon},
|
|
544
546
|
deepLinkSchemeFrom:e.fields.deepLinkSchemeFrom||null,appLinkDomainsFrom:e.fields.appLinkDomainsFrom||null,permissions:e.
|
|
545
|
-
permissions}}function
|
|
547
|
+
permissions}}function Fn(e,t={}){let{path:n="genesis/stack.md#Packaging"}=t;if(Array.isArray(e)||b(n,"Packaging must be \
|
|
546
548
|
supplied as exact Stack section lines."),_(e))return{version:1,packages:[]};let s=[],i=null;for(let a=0;a<e.length;a+=1){
|
|
547
|
-
let u=e[a].trim();if(!u)continue;let l=a+1,
|
|
548
|
-
known Packaging heading: ${u}. Use ${
|
|
549
|
-
b(n,"## Packaging needs at least one Package or exactly `- Nothing.`.");let r=s.map(a=>
|
|
549
|
+
let u=e[a].trim();if(!u)continue;let l=a+1,m=u.match(ar);if(m){i=gr(m,n,l),s.push(i);continue}u.startsWith("#")&&b(n,`Un\
|
|
550
|
+
known Packaging heading: ${u}. Use ${Gn}.`,l),i||b(n,`Packaging entries belong under ${Gn}.`,l),Er(i,u,n,l)}s.length===0&&
|
|
551
|
+
b(n,"## Packaging needs at least one Package or exactly `- Nothing.`.");let r=s.map(a=>br(a,n)),o=new Map;for(let a of r)
|
|
550
552
|
o.has(a.id)&&b(n,`Packaging contains a duplicate package id ${a.id}.`),o.set(a.id,a);let c=new Set;for(let a of r.filter(
|
|
551
553
|
({packer:u})=>u==="capacitor")){let u=o.get(a.content);(!u||u.packer!=="web-bundle")&&b(n,`Package ${a.id} Content must \
|
|
552
554
|
name a web-bundle package declared in Packaging.`),c.has(a.application.id)&&b(n,`Packaging declares application id ${a.application.
|
|
553
|
-
id} twice.`),c.add(a.application.id)}return{version:1,packages:r}}function
|
|
555
|
+
id} twice.`),c.add(a.application.id)}return{version:1,packages:r}}function Bn(e,t,n,s){let i=(Array.isArray(e)?e:[]).find(
|
|
554
556
|
r=>r?.name===t);return(!i||typeof i.value!="string"||!i.value.trim())&&b(n,`${s} names ${t}, which ## Environment defaul\
|
|
555
|
-
ts does not declare with a value.`),i.value.trim()}function
|
|
557
|
+
ts does not declare with a value.`),i.value.trim()}function qn(e,t=[],n={}){let{path:s="genesis/stack.md#Packaging"}=n;return{
|
|
556
558
|
...e,packages:e.packages.map(i=>{if(i.packer!=="capacitor")return i;let r={...i,deepLinkScheme:null,appLinkDomains:[]};if(i.
|
|
557
|
-
deepLinkSchemeFrom){let o=
|
|
559
|
+
deepLinkSchemeFrom){let o=Bn(t,i.deepLinkSchemeFrom,s,`Package ${i.id} Deep link scheme from`);(!ir.test(o)||["http","ht\
|
|
558
560
|
tps","file","content","javascript"].includes(o))&&b(s,`${i.deepLinkSchemeFrom} must be a custom lowercase URL scheme suc\
|
|
559
|
-
h as \`notes\`.`),r.deepLinkScheme=o}if(i.appLinkDomainsFrom){let o=
|
|
560
|
-
k domains from`).split(/[\s,]+/u).filter(Boolean);o.some(c=>!
|
|
561
|
-
se domain names separated by commas or spaces.`),r.appLinkDomains=[...new Set(o)]}return r})}}function
|
|
562
|
-
section:t={}}={}){
|
|
563
|
-
(s=Fn(
|
|
561
|
+
h as \`notes\`.`),r.deepLinkScheme=o}if(i.appLinkDomainsFrom){let o=Bn(t,i.appLinkDomainsFrom,s,`Package ${i.id} App lin\
|
|
562
|
+
k domains from`).split(/[\s,]+/u).filter(Boolean);o.some(c=>!rr.test(c))&&b(s,`${i.appLinkDomainsFrom} must list lowerca\
|
|
563
|
+
se domain names separated by commas or spaces.`),r.appLinkDomains=[...new Set(o)]}return r})}}function Kn({environment:e={},
|
|
564
|
+
section:t={}}={}){M(t,e,"Packaging section");let n=[...t.diagnostics||[]],s={version:1,packages:[]};t.status==="ready"&&
|
|
565
|
+
(s=qn(Fn(t.lines),e.environmentDefaults));let i=n.length>0?"blocked":s.packages.length>0?"ready":"unconfigured";return{contract:Ge,
|
|
564
566
|
status:i,stackHash:t.stackHash,packagingHash:i==="ready"?k(s):"",source:t.source||null,version:s.version,packages:s.packages,
|
|
565
|
-
diagnostics:n}}var
|
|
566
|
-
n,s,i,r)}function
|
|
567
|
-
.`,i),e.seen.add(t),e[t]=n}var
|
|
568
|
-
"TMPDIR","USER"]),
|
|
569
|
-
review-identity` `argument`..."],["- Protocol: ","protocol","Protocol",`\`${
|
|
570
|
-
"Identity types",`one or more of ${[...
|
|
567
|
+
diagnostics:n}}var O="VIBE64_OUTPUTS_INVALID";function h(e,t,n,s={}){d(O,e,t,n,s)}function gt(e,t,n,s,i,r){return v(e.slice(t.length),O,
|
|
568
|
+
n,s,i,r)}function j(e,t,n,s,i){return gt(e,t,n,s,i,{count:1})[0]}function D(e,t,n,s,i,r){e.seen.has(t)&&h(s,`Duplicate ${r}\
|
|
569
|
+
.`,i),e.seen.add(t),e[t]=n}var ge="vibe64.preview-identity.command.v1",vr=/^[A-Z_][A-Z0-9_]*$/u,Xn=new Set(["HOME","LOGNAME","NODE_OPTIONS","PATH",
|
|
570
|
+
"TMPDIR","USER"]),Zn=new Set(["email","login","user-id"]),Jn=1e4,Ue=3e4,Qn=[["- Command: ","command","Command","`tools/p\
|
|
571
|
+
review-identity` `argument`..."],["- Protocol: ","protocol","Protocol",`\`${ge}\``],["- Identity types: ","identityTypes",
|
|
572
|
+
"Identity types",`one or more of ${[...Zn].map(e=>`\`${e}\``).join(" ")}`],["- Enabled environment: ","enabledEnvironmen\
|
|
571
573
|
t","Enabled environment","`ENV_NAME`"],["- Secret environment: ","secretEnvironment","Secret environment","`ENV_NAME`"],
|
|
572
|
-
["- Runtimes: ","runtimes","Runtimes","`runtime`..."],["- Timeout ms: ","timeoutMs","Timeout ms",`\`1\` through \`${
|
|
573
|
-
(default ${
|
|
574
|
-
identity ${n} environment name`,s);return(!
|
|
575
|
-
ronment name is invalid.`,s),i}function
|
|
576
|
-
u));i||h(n,
|
|
574
|
+
["- Runtimes: ","runtimes","Runtimes","`runtime`..."],["- Timeout ms: ","timeoutMs","Timeout ms",`\`1\` through \`${Ue}\`\
|
|
575
|
+
(default ${Jn})`]],Et=Qn.map(([e,,,t])=>`${e}${t}`);function Yn(e,t,n,s){if(e===void 0)return"";let i=w(e,O,t,`Preview \
|
|
576
|
+
identity ${n} environment name`,s);return(!vr.test(i)||Xn.has(i)||i.startsWith("XDG_"))&&h(t,`Preview identity ${n} envi\
|
|
577
|
+
ronment name is invalid.`,s),i}function es(e){return{seen:new Set,line:e}}function ts(e,t,n,s){let i=Qn.find(([u])=>t.startsWith(
|
|
578
|
+
u));i||h(n,S("Preview identity entry",t,Et),s);let[r,o,c]=i,a=gt(t,r,n,`Preview identity ${c}`,s);!["command","identityT\
|
|
577
579
|
ypes","runtimes"].includes(o)&&a.length!==1&&h(n,`Preview identity ${c} accepts exactly one value.`,s),D(e,o,a,n,s,`Prev\
|
|
578
|
-
iew identity ${c} entry`)}function
|
|
580
|
+
iew identity ${c} entry`)}function ns(e,t,n){for(let[u,l]of[["command","Command"],["protocol","Protocol"],["identityType\
|
|
579
581
|
s","Identity types"]])e[u]||h(t,`Output target ${n} Preview identity needs ${l}.`,e.line);let s=e.command.map(u=>`\`${u}\
|
|
580
|
-
\``).join(" "),i=N(s,
|
|
582
|
+
\``).join(" "),i=N(s,O,t,"Preview identity command",e.line);(!i[0].includes("/")||i[0].includes("\\")||i[0].split("/").some(
|
|
581
583
|
u=>!u||[".",".."].includes(u))||i.some(u=>/\{(?:host|port)\}/u.test(u)))&&h(t,"Preview identity command must use a liter\
|
|
582
|
-
al app-owned project-relative executable.",e.line);let r=e.protocol[0];r!==
|
|
583
|
-
.`,e.line);let o=[...new Set(e.identityTypes.map(u=>(
|
|
584
|
-
o.length!==e.identityTypes.length&&h(t,"Preview identity types must not contain duplicates.",e.line);let c={enabled:
|
|
585
|
-
enabledEnvironment?.[0],t,"enabled",e.line),secret:
|
|
586
|
-
c.secret&&h(t,"Preview identity enabled and secret environment names must differ.",e.line);let a=
|
|
587
|
-
timeoutMs[0];/^[0-9]+$/u.test(u)||h(t,`Preview identity Timeout ms must be from 1 through ${
|
|
588
|
-
isSafeInteger(a)||a<1||a>
|
|
589
|
-
identityTypes:o,protocol:r,runtimes:e.runtimes?C(e.runtimes.map(u=>`\`${u}\``).join(" "),
|
|
590
|
-
e.line):[],timeoutMs:a}}var
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
map(t=>`\`${t}\``).join(" or "),
|
|
594
|
-
on","#### Preview identity","#### Download `id`"]),
|
|
595
|
-
|
|
596
|
-
"- Default: `text`","- Description: `text`","- Required."],presentation:[`- Kind: ${
|
|
597
|
-
hrough `65535`","- URL path: `/path`","- Ready when: `GET` `/path` returns `200`"],previewIdentity:
|
|
598
|
-
`path`","- Name: `file-name`","- Media type: `type/subtype`"]});function
|
|
599
|
-
i)||h(t,`${n} must use lowercase letters, digits, and single hyphens.`,s),i}function
|
|
600
|
-
r.replace(
|
|
584
|
+
al app-owned project-relative executable.",e.line);let r=e.protocol[0];r!==ge&&h(t,`Preview identity protocol must be ${ge}\
|
|
585
|
+
.`,e.line);let o=[...new Set(e.identityTypes.map(u=>(Zn.has(u)||h(t,`Unsupported preview identity type: ${u}.`,e.line),u)))];
|
|
586
|
+
o.length!==e.identityTypes.length&&h(t,"Preview identity types must not contain duplicates.",e.line);let c={enabled:Yn(e.
|
|
587
|
+
enabledEnvironment?.[0],t,"enabled",e.line),secret:Yn(e.secretEnvironment?.[0],t,"secret",e.line)};c.enabled&&c.enabled===
|
|
588
|
+
c.secret&&h(t,"Preview identity enabled and secret environment names must differ.",e.line);let a=Jn;if(e.timeoutMs){let u=e.
|
|
589
|
+
timeoutMs[0];/^[0-9]+$/u.test(u)||h(t,`Preview identity Timeout ms must be from 1 through ${Ue}.`,e.line),a=Number(u),(!Number.
|
|
590
|
+
isSafeInteger(a)||a<1||a>Ue)&&h(t,`Preview identity Timeout ms must be from 1 through ${Ue}.`,e.line)}return{command:i,environment:c,
|
|
591
|
+
identityTypes:o,protocol:r,runtimes:e.runtimes?C(e.runtimes.map(u=>`\`${u}\``).join(" "),O,t,"Preview identity runtimes",
|
|
592
|
+
e.line):[],timeoutMs:a}}var Sr="bucket";function yr(e=""){return e===Sr}function ss(e={}){return!yr(e.kind)}var wr="vibe64.outputs.v1",We="Outputs",_r=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u,bt=/\{([a-z][a-z0-9:-]*)\}/gu,Ir=/^### Target `([^`\r\n]+)`:[ \t]+(.+)$/u,
|
|
593
|
+
Tr=/^#### Parameter `([^`\r\n]+)`:[ \t]+(.+)$/u,Or=/^#### Download `([^`\r\n]+)`$/u,kr=/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u,
|
|
594
|
+
os=new Set(["finite","interactive"]),vt=new Set(["development","test"]),as=new Set(["terminal","web"]),is=16,Be=e=>[...e].
|
|
595
|
+
map(t=>`\`${t}\``).join(" or "),Ar=Object.freeze(["### Target `id`: Label","#### Parameter `id`: Label","#### Presentati\
|
|
596
|
+
on","#### Preview identity","#### Download `id`"]),ze=Object.freeze({target:["- Default.",`- Mode: ${Be(os)}`,`- Data: ${Be(
|
|
597
|
+
vt)}`,"- Workdir: `path`","- Runtimes: `runtime`...","- Prepare|Build|Run `label`: `command` `argument`..."],parameter:[
|
|
598
|
+
"- Default: `text`","- Description: `text`","- Required."],presentation:[`- Kind: ${Be(as)}`,"- Preferred port: `1024` t\
|
|
599
|
+
hrough `65535`","- URL path: `/path`","- Ready when: `GET` `/path` returns `200`"],previewIdentity:Et,download:["- Path:\
|
|
600
|
+
`path`","- Name: `file-name`","- Media type: `type/subtype`"]});function St(e,t,n,s){let i=w(e,O,t,n,s);return _r.test(
|
|
601
|
+
i)||h(t,`${n} must use lowercase letters, digits, and single hyphens.`,s),i}function Rr(e,t,n,s){let i=N(e,O,t,n,s);for(let r of i)
|
|
602
|
+
r.replace(bt,"").includes("{parameter:")&&h(t,`${n} has an invalid {parameter:id} placeholder.`,s),[...r.matchAll(bt)].some(
|
|
601
603
|
o=>!["host","port"].includes(o[1])&&!/^parameter:[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(o[1]))&&h(t,`${n} supports only {host}\
|
|
602
|
-
, {port}, and {parameter:id} placeholders.`,s);return i}function
|
|
603
|
-
e[2],
|
|
604
|
-
downloads:[],parameters:[],seen:new Set,line:n}}function
|
|
604
|
+
, {port}, and {parameter:id} placeholders.`,s);return i}function Nr(e,t,n){return{id:St(e[1],t,"Output target id",n),label:w(
|
|
605
|
+
e[2],O,t,"Output target label",n),default:!1,mode:"",workdir:".",runtimeRequirements:[],steps:[],presentation:null,previewIdentity:null,
|
|
606
|
+
downloads:[],parameters:[],seen:new Set,line:n}}function Cr(e,t,n,s){if(t==="- Required."){D(e,"required",!0,n,s,"Parame\
|
|
605
607
|
ter Required entry");return}for(let[i,r]of[["Default","default"],["Description","description"]]){let o=`- ${i}: `;if(t.startsWith(
|
|
606
|
-
o)){let c=
|
|
607
|
-
s)}function
|
|
608
|
+
o)){let c=j(t,o,n,`Parameter ${i}`,s);D(e,r,c,n,s,`Parameter ${i} entry`);return}}h(n,S("Outputs parameter entry",t,ze.parameter),
|
|
609
|
+
s)}function Dr(e,t={}){let n=e.parameters||[],s=r=>d("VIBE64_OUTPUT_PARAMETERS_INVALID","Outputs",r);(!t||typeof t!="obj\
|
|
608
610
|
ect"||Array.isArray(t))&&s("Output parameters must be an object of text values.");let i=new Set(n.map(({id:r})=>r));for(let r of Object.
|
|
609
611
|
keys(t))i.has(r)||s(`Unknown output parameter: ${r}.`);return Object.fromEntries(n.map(r=>{let o=Object.hasOwn(t,r.id)?t[r.
|
|
610
612
|
id]:r.default;return(typeof o!="string"||o.length>4096||/[\0\r\n]/u.test(o))&&s(`${r.label} must be a single line of tex\
|
|
611
|
-
t, at most 4096 characters.`),r.required&&!o.trim()&&s(`${r.label} is required.`),[r.id,o]}))}function
|
|
612
|
-
preferredPort:null,urlPath:"/",readiness:null,seen:new Set,line:e}}function
|
|
613
|
-
n),path:"",name:"",mediaType:"",seen:new Set,line:n}}function
|
|
613
|
+
t, at most 4096 characters.`),r.required&&!o.trim()&&s(`${r.label} is required.`),[r.id,o]}))}function Pr(e){return{kind:"",
|
|
614
|
+
preferredPort:null,urlPath:"/",readiness:null,seen:new Set,line:e}}function $r(e,t,n){return{id:St(e[1],t,"Download id",
|
|
615
|
+
n),path:"",name:"",mediaType:"",seen:new Set,line:n}}function Lr(e,t,n){/^[0-9]+$/u.test(e)||h(t,"Web presentation prefe\
|
|
614
616
|
rred port must be an integer from 1024 through 65535.",n);let s=Number(e);return(!Number.isSafeInteger(s)||s<1024||s>65535)&&
|
|
615
|
-
h(t,"Web presentation preferred port must be an integer from 1024 through 65535.",n),s}function
|
|
616
|
-
"- Data: ")){let r=
|
|
617
|
+
h(t,"Web presentation preferred port must be an integer from 1024 through 65535.",n),s}function xr(e,t,n,s){if(t.startsWith(
|
|
618
|
+
"- Data: ")){let r=j(t,"- Data: ",n,"Output target Data",s);vt.has(r)||h(n,`Output target Data must be ${Be(vt)}.`,s),D(
|
|
617
619
|
e,"dataMode",r,n,s,"output target Data entry");return}if(t==="- Default."){D(e,"default",!0,n,s,"output target Default e\
|
|
618
|
-
ntry");return}if(t.startsWith("- Mode: ")){let r=
|
|
620
|
+
ntry");return}if(t.startsWith("- Mode: ")){let r=j(t,"- Mode: ",n,"Output target Mode",s);os.has(r)||h(n,"Output target \
|
|
619
621
|
Mode must be `interactive` or `finite`.",s),D(e,"mode",r,n,s,"output target Mode entry");return}if(t.startsWith("- Workd\
|
|
620
|
-
ir: ")){D(e,"workdir",
|
|
621
|
-
Workdir entry");return}if(t.startsWith("- Runtimes: ")){D(e,"runtimeRequirements",C(t.slice(12),
|
|
622
|
+
ir: ")){D(e,"workdir",y(j(t,"- Workdir: ",n,"Output target Workdir",s),O,n,"Output target workdir",s),n,s,"output target\
|
|
623
|
+
Workdir entry");return}if(t.startsWith("- Runtimes: ")){D(e,"runtimeRequirements",C(t.slice(12),O,n,"Output target runt\
|
|
622
624
|
imes",s),n,s,"output target Runtimes entry");return}let i=t.match(/^- (Prepare|Build|Run) `([^`\r\n]+)`:[ \t]+(.+)$/u);if(i){
|
|
623
|
-
let r=i[1].toLowerCase(),o=
|
|
624
|
-
nly a web presentation's Run step may use {host} or {port} placeholders.",s),e.steps.push({label:w(i[2],
|
|
625
|
-
label",s),argv:o,role:r});return}h(n,
|
|
626
|
-
if(t.startsWith("- Kind: ")){let i=
|
|
625
|
+
let r=i[1].toLowerCase(),o=Rr(i[3],n,"Output step command",s);r!=="run"&&o.some(c=>/\{(?:host|port)\}/u.test(c))&&h(n,"O\
|
|
626
|
+
nly a web presentation's Run step may use {host} or {port} placeholders.",s),e.steps.push({label:w(i[2],O,n,"Output step\
|
|
627
|
+
label",s),argv:o,role:r});return}h(n,S("Outputs target entry",t,[...ze.target,...Ar.slice(1)]),s)}function Vr(e,t,n,s){
|
|
628
|
+
if(t.startsWith("- Kind: ")){let i=j(t,"- Kind: ",n,"Presentation Kind",s);as.has(i)||h(n,"Presentation Kind must be `te\
|
|
627
629
|
rminal` or `web`.",s),D(e,"kind",i,n,s,"Presentation Kind entry");return}if(t.startsWith("- Preferred port: ")){D(e,"pre\
|
|
628
|
-
ferredPort",
|
|
629
|
-
ry");return}if(t.startsWith("- URL path: ")){D(e,"urlPath",
|
|
630
|
+
ferredPort",Lr(j(t,"- Preferred port: ",n,"Web presentation Preferred port",s),n,s),n,s,"Presentation Preferred port ent\
|
|
631
|
+
ry");return}if(t.startsWith("- URL path: ")){D(e,"urlPath",nt(j(t,"- URL path: ",n,"Web presentation URL path",s),O,n,"W\
|
|
630
632
|
eb presentation URL path",s),n,s,"Presentation URL path entry");return}if(t.startsWith("- Ready when: ")){D(e,"readiness",
|
|
631
|
-
|
|
632
|
-
s)}function
|
|
633
|
-
s.trim()!==s)&&h(t,"Download Name must be a safe filename without path separators.",n),s}function
|
|
634
|
-
t,"Download Media type",n);return(s.length>127||!
|
|
635
|
-
value.",n),s}function
|
|
636
|
-
nload path",s,{allowRoot:!1}),n,s,"Download Path entry");return}if(t.startsWith("- Name: ")){D(e,"name",
|
|
637
|
-
n,"Download Name",s),n,s),n,s,"Download Name entry");return}if(t.startsWith("- Media type: ")){D(e,"mediaType"
|
|
638
|
-
Media type: ",n,"Download Media type",s),n,s),n,s,"Download Media type entry");return}h(n,
|
|
639
|
-
s)}function
|
|
640
|
-
t ${n} Download ${e.id} needs ${i}.`,e.line);return{id:e.id,path:e.path,name:e.name,mediaType:e.mediaType}}function
|
|
633
|
+
ue(t,O,n,"Web presentation readiness",s),n,s,"Presentation Ready when entry");return}h(n,S("Presentation entry",t,ze.presentation),
|
|
634
|
+
s)}function Mr(e,t,n){let s=w(e,O,t,"Download Name",n);return(s.length>255||[".",".."].includes(s)||/[\\/\0]/u.test(s)||
|
|
635
|
+
s.trim()!==s)&&h(t,"Download Name must be a safe filename without path separators.",n),s}function jr(e,t,n){let s=w(e,O,
|
|
636
|
+
t,"Download Media type",n);return(s.length>127||!kr.test(s))&&h(t,"Download Media type must be a lowercase type/subtype \
|
|
637
|
+
value.",n),s}function Gr(e,t,n,s){if(t.startsWith("- Path: ")){D(e,"path",y(j(t,"- Path: ",n,"Download Path",s),O,n,"Dow\
|
|
638
|
+
nload path",s,{allowRoot:!1}),n,s,"Download Path entry");return}if(t.startsWith("- Name: ")){D(e,"name",Mr(j(t,"- Name: ",
|
|
639
|
+
n,"Download Name",s),n,s),n,s,"Download Name entry");return}if(t.startsWith("- Media type: ")){D(e,"mediaType",jr(j(t,"-\
|
|
640
|
+
Media type: ",n,"Download Media type",s),n,s),n,s,"Download Media type entry");return}h(n,S("Download entry",t,ze.download),
|
|
641
|
+
s)}function Ur(e,t,n){for(let[s,i]of[["path","Path"],["name","Name"],["mediaType","Media type"]])e[s]||h(t,`Output targe\
|
|
642
|
+
t ${n} Download ${e.id} needs ${i}.`,e.line);return{id:e.id,path:e.path,name:e.name,mediaType:e.mediaType}}function Br(e,t,n){
|
|
641
643
|
return e.kind||h(t,`Output target ${n} Presentation needs Kind.`,e.line),e.kind==="terminal"?((e.preferredPort!==null||e.
|
|
642
644
|
readiness||e.seen.has("urlPath"))&&h(t,`Output target ${n} terminal Presentation accepts only Kind.`,e.line),{kind:"term\
|
|
643
645
|
inal"}):(e.readiness||h(t,`Output target ${n} web Presentation needs one Ready when entry.`,e.line),{kind:"web",preferredPort:e.
|
|
644
|
-
preferredPort,urlPath:e.urlPath,readiness:e.readiness})}function
|
|
646
|
+
preferredPort,urlPath:e.urlPath,readiness:e.readiness})}function rs(e,t){e.mode||h(t,`Output target ${e.id} needs one Mo\
|
|
645
647
|
de entry.`,e.line),e.steps.length===0&&h(t,`Output target ${e.id} needs at least one step.`,e.line);let n={prepare:0,build:1,
|
|
646
648
|
run:2};for(let u=1;u<e.steps.length;u+=1)n[e.steps[u].role]<n[e.steps[u-1].role]&&h(t,`Output target ${e.id} steps must \
|
|
647
|
-
be ordered Prepare, Build, then Run.`,e.line);let s=e.steps.filter(({role:u})=>u==="run"),i=e.downloads.map(u=>
|
|
649
|
+
be ordered Prepare, Build, then Run.`,e.line);let s=e.steps.filter(({role:u})=>u==="run"),i=e.downloads.map(u=>Ur(u,t,e.
|
|
648
650
|
id));new Set(i.map(({id:u})=>u)).size!==i.length&&h(t,`Output target ${e.id} contains a duplicate Download id.`,e.line),
|
|
649
651
|
e.mode==="finite"?((s.length>0||e.presentation||e.previewIdentity)&&h(t,`Finite output target ${e.id} cannot have Run, P\
|
|
650
652
|
resentation, or Preview identity entries.`,e.line),i.length===0&&h(t,`Finite output target ${e.id} needs at least one Do\
|
|
651
653
|
wnload.`,e.line)):s.length!==1||e.steps.at(-1).role!=="run"?h(t,`Interactive output target ${e.id} needs exactly one fin\
|
|
652
654
|
al Run step.`,e.line):e.presentation||h(t,`Interactive output target ${e.id} needs one Presentation.`,e.line);let r=e.presentation?
|
|
653
|
-
|
|
655
|
+
Br(e.presentation,t,e.id):null,o=e.steps.flatMap(({argv:u})=>u.flatMap(l=>[...l.matchAll(bt)].map(m=>m[1])));o.some(u=>[
|
|
654
656
|
"host","port"].includes(u))&&r?.kind!=="web"&&h(t,"Only a web output target may use {host} or {port} placeholders.",e.line);
|
|
655
|
-
let c=e.parameters.map(({seen:u,...l})=>l),a=new Set(c.map(({id:u})=>u));(c.length>
|
|
656
|
-
arget ${e.id} may declare at most ${
|
|
657
|
+
let c=e.parameters.map(({seen:u,...l})=>l),a=new Set(c.map(({id:u})=>u));(c.length>is||a.size!==c.length)&&h(t,`Output t\
|
|
658
|
+
arget ${e.id} may declare at most ${is} parameters with unique ids.`,e.line);for(let u of o.filter(l=>l.startsWith("para\
|
|
657
659
|
meter:"))){let l=u.slice(10);a.has(l)||h(t,`Undeclared output parameter: ${l}.`,e.line)}for(let u of c)o.includes(`param\
|
|
658
660
|
eter:${u.id}`)||h(t,`Output parameter ${u.id} must be used in a step command.`,e.line);return e.previewIdentity&&r?.kind!==
|
|
659
661
|
"web"&&h(t,"Only a web output target may declare Preview identity.",e.line),{id:e.id,label:e.label,default:e.default,mode:e.
|
|
660
662
|
mode,workdir:e.workdir,runtimeRequirements:e.runtimeRequirements,...e.dataMode?{dataMode:e.dataMode}:{},steps:e.steps,presentation:r,
|
|
661
|
-
downloads:i,...c.length?{parameters:c}:{},...e.previewIdentity?{previewIdentity:
|
|
663
|
+
downloads:i,...c.length?{parameters:c}:{},...e.previewIdentity?{previewIdentity:ns(e.previewIdentity,t,e.id)}:{}}}function He(e,t={}){
|
|
662
664
|
let{path:n="genesis/stack.md#Outputs"}=t;if(Array.isArray(e)||h(n,"Outputs must be supplied as exact Stack section lines\
|
|
663
665
|
."),_(e))return{version:1,targets:[]};let s=[],i=null,r="target",o=null;for(let a=0;a<e.length;a+=1){let u=e[a].trim();if(!u)
|
|
664
|
-
continue;let l=a+1,
|
|
665
|
-
begin with a Target heading.",l);let p=u.match(
|
|
666
|
-
ter label",l),default:"",description:"",required:!1,seen:new Set};i.parameters.push(
|
|
666
|
+
continue;let l=a+1,m=u.match(Ir);if(m){i&&s.push(rs(i,n)),i=Nr(m,n,l),r="target",o=null;continue}i||h(n,"## Outputs must\
|
|
667
|
+
begin with a Target heading.",l);let p=u.match(Tr);if(p){let f={id:St(p[1],n,"Parameter id",l),label:w(p[2],O,n,"Parame\
|
|
668
|
+
ter label",l),default:"",description:"",required:!1,seen:new Set};i.parameters.push(f),r="parameter",o=f;continue}if(u===
|
|
667
669
|
"#### Presentation"){i.presentation&&h(n,"Presentation must appear at most once below an output target.",l),i.presentation=
|
|
668
|
-
|
|
669
|
-
y must appear at most once below an output target.",l),i.previewIdentity=
|
|
670
|
-
let
|
|
671
|
-
resentation"?
|
|
670
|
+
Pr(l),r="presentation",o=i.presentation;continue}if(u==="#### Preview identity"){i.previewIdentity&&h(n,"Preview identit\
|
|
671
|
+
y must appear at most once below an output target.",l),i.previewIdentity=es(l),r="previewIdentity",o=i.previewIdentity;continue}
|
|
672
|
+
let E=u.match(Or);if(E){let f=$r(E,n,l);i.downloads.push(f),r="download",o=f;continue}r==="parameter"?Cr(o,u,n,l):r==="p\
|
|
673
|
+
resentation"?Vr(o,u,n,l):r==="previewIdentity"?ts(o,u,n,l):r==="download"?Gr(o,u,n,l):xr(i,u,n,l)}i&&s.push(rs(i,n)),s.length===
|
|
672
674
|
0&&h(n,"## Outputs needs at least one Target or exactly `- Nothing.`.");let c=s.map(({id:a})=>a);return new Set(c).size!==
|
|
673
675
|
c.length&&h(n,"Outputs contains a duplicate target id."),s.filter(({default:a})=>a).length>1&&h(n,"Outputs may declare a\
|
|
674
|
-
t most one default target."),{version:1,targets:s}}function
|
|
676
|
+
t most one default target."),{version:1,targets:s}}function Wr(e,t={}){let{resourcesPreparing:n=!1}=t,s=e.details||{},i=Array.
|
|
675
677
|
isArray(s.missing)?s.missing:[],r=(Array.isArray(s.alternatives)?s.alternatives:[]).map((c,a)=>Array.isArray(i[a])&&i[a].
|
|
676
678
|
length?i[a].join(" and "):String(c)).filter(Boolean);if(e.code!=="STACK_RESOURCE_MISSING"||!r.length)return e.message;let o=String(
|
|
677
679
|
s.resource||"").trim()||"resources";return n?`Vibe64 is still setting up this app's ${o}. Preview can start when workspa\
|
|
678
680
|
ce setup finishes; then press Check again.`:`This app needs its ${o} before Preview can start: set ${r.join(", or ")} in\
|
|
679
|
-
Env (in Dash, under Development), then press Check again.`}function
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
681
|
+
Env (in Dash, under Development), then press Check again.`}function zr(e={}){let t=new Set((e.resources||[]).filter(n=>n?.
|
|
682
|
+
resource&&!ss(n.resource)).map(n=>n.resource.id));return(e.diagnostics||[]).filter(n=>!(n?.code==="STACK_RESOURCE_MISSIN\
|
|
683
|
+
G"&&t.has(n.details?.resource)))}function cs({environment:e={},section:t={},resourcesPreparing:n=!1}={}){M(t,e,"Outputs \
|
|
684
|
+
section");let s=[...t.diagnostics||[]],i=zr(e),r={version:1,targets:[]};t.status==="ready"&&(r=He(t.lines));let o=i.length===
|
|
685
|
+
0?null:[...new Set(i.map(l=>Wr(l,{resourcesPreparing:n})))].join(" "),c=r.targets.map(l=>({...l,source:t.source||null,available:s.
|
|
686
|
+
length===0&&i.length===0,disabledReason:o})),a=[...s,...i],u="ready";return a.length>0?u="blocked":c.length===0&&(u="unc\
|
|
687
|
+
onfigured"),{contract:wr,status:u,stackHash:t.stackHash,components:[...t.components||[]],environmentDefaults:structuredClone(
|
|
688
|
+
e.environmentDefaults||[]),runtimeRequirements:H(c.flatMap(l=>l.runtimeRequirements)),resources:structuredClone(e.resources||
|
|
689
|
+
[]),targets:c,diagnostics:a}}var us="Project services",Hr="vibe64.project-services.v1",ie="VIBE64_PROJECT_SERVICES_INVALID",re="genesis/stack.md#Proj\
|
|
690
|
+
ect services",Fr="- Start `service-id` [per session] with `runtime` [in `workdir`]: `command` `argument`...";function ls(e){
|
|
691
|
+
if(Array.isArray(e)||d(ie,re,"Expected exact Project services section lines."),_(e))return[];let t=[];for(let[n,s]of e.entries()){
|
|
688
692
|
let i=s.trim();if(!i)continue;let r=n+1,o=i.match(/^- Start `([a-z][a-z0-9-]{0,63})`( per session)? with (.+?): (.+)$/u);
|
|
689
|
-
o||
|
|
690
|
-
t.push({id:o[1],...o[2]?{scope:"session"}:{},runtimeRequirements:C(c?c[1]:o[3],
|
|
691
|
-
".",
|
|
692
|
-
xactly `- Nothing.`."),t}function
|
|
693
|
-
"blocked"?"blocked":t.length?"ready":"unconfigured",services:t,recipeHash:t.length?k(t):"",diagnostics:e.diagnostics||[]}}var
|
|
693
|
+
o||d(ie,re,`Use: ${Fr}`,r),t.some(({id:a})=>a===o[1])&&d(ie,re,"Duplicate project service id.",r);let c=o[3].match(/^(.*?) in `([^`\r\n]+)`$/u);
|
|
694
|
+
t.push({id:o[1],...o[2]?{scope:"session"}:{},runtimeRequirements:C(c?c[1]:o[3],ie,re,"Service runtimes",r),workdir:y(c?.[2]||
|
|
695
|
+
".",ie,re,"Service workdir",r),argv:N(o[4],ie,re,"Service command",r)})}return t.length||d(ie,re,"Declare a service or e\
|
|
696
|
+
xactly `- Nothing.`."),t}function ps(e={}){let t=e.status==="ready"?ls(e.lines):[];return{contract:Hr,status:e.status===
|
|
697
|
+
"blocked"?"blocked":t.length?"ready":"unconfigured",services:t,recipeHash:t.length?k(t):"",diagnostics:e.diagnostics||[]}}var hs="vibe64.staging-data.v1",Tt="Staging data",Ee="VIBE64_STAGING_DATA_INVALID",fs="genesis/stack.md#Staging data",me=Object.
|
|
694
698
|
freeze({"own copy, empty":"empty","own copy, full":"full","own copy, sampled":"sampled","shared with production":"shared",
|
|
695
|
-
"shared with production, structure frozen":"frozen"}),
|
|
696
|
-
t,e]))),
|
|
699
|
+
"shared with production, structure frozen":"frozen"}),qr=Object.freeze(Object.fromEntries(Object.entries(me).map(([e,t])=>[
|
|
700
|
+
t,e]))),Kr=Object.freeze({empty:Object.freeze({source:!1,unlisted:!1,sampling:!1,contacts:!1}),full:Object.freeze({source:!0,
|
|
697
701
|
unlisted:!1,sampling:!1,contacts:!0}),sampled:Object.freeze({source:!0,unlisted:!0,sampling:!0,contacts:!0}),shared:Object.
|
|
698
702
|
freeze({source:!1,unlisted:!1,sampling:!1,contacts:!1}),frozen:Object.freeze({source:!1,unlisted:!1,sampling:!1,contacts:!1})}),
|
|
699
|
-
|
|
700
|
-
roduction's database itself",frozen:"Staging uses production's database itself"}),
|
|
701
|
-
|
|
702
|
-
freeze([1,1e7]),days:Object.freeze([1,36500]),rows:Object.freeze([1,1e8])}),
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
freeze(["email","phone"]),kt="- Nothing.",
|
|
706
|
-
itten by command with `runtime` in `workdir`: `command` `argument`... `{dump}`",
|
|
707
|
-
s",q=Object.freeze({section:Object.freeze(["- Database: `resource`",...
|
|
703
|
+
Yr=Object.freeze({empty:"Staging's own database starts empty",full:"a whole copy keeps every row",shared:"Staging uses p\
|
|
704
|
+
roduction's database itself",frozen:"Staging uses production's database itself"}),ds=Object.freeze(["mysql","postgresql"]),
|
|
705
|
+
Fe="{dump}",ms=/\{[A-Za-z][A-Za-z0-9_:-]*\}/u,gs=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/u,yt=Object.freeze({unlistedRows:Object.
|
|
706
|
+
freeze([1,1e7]),days:Object.freeze([1,36500]),rows:Object.freeze([1,1e8])}),Xr=/^dump written by command with (.+?) in `([^`\r\n]+)`: (.+)$/u,
|
|
707
|
+
Zr=/^all up to `([^`\r\n]*)` rows$/u,Ot=/^- `([^`\r\n]*)`: (.+)$/u,Jr=/^recent by `([^`\r\n]*)`(?:, last `([^`\r\n]*)` days)?(?:, newest `([^`\r\n]*)` rows)?$/u,
|
|
708
|
+
Es=/^- `([^`\r\n]*)` to `([^`\r\n]*)`$/u,bs=/^- `([^`\r\n]*)` keeps every `([^`\r\n]*)` row by `([^`\r\n]*)`$/u,Qr=Object.
|
|
709
|
+
freeze(["email","phone"]),kt="- Nothing.",vs=Object.freeze(Object.keys(me).map(e=>`- Mode: ${e}`)),qe="- Source: dump wr\
|
|
710
|
+
itten by command with `runtime` in `workdir`: `command` `argument`... `{dump}`",At="- Unlisted tables: all up to `n` row\
|
|
711
|
+
s",q=Object.freeze({section:Object.freeze(["- Database: `resource`",...vs,qe,At]),tables:Object.freeze(["- `table`: all",
|
|
708
712
|
"- `table`: none","- `table`: recent by `column`, last `n` days","- `table`: recent by `column`, newest `n` rows","- `ta\
|
|
709
713
|
ble`: recent by `column`, last `n` days, newest `n` rows"]),links:Object.freeze(["- `table.column` to `table.column`"]),
|
|
710
714
|
keepTogether:Object.freeze(["- `parent` keeps every `child` row by `column`"]),contacts:Object.freeze(["- `table.column`\
|
|
711
|
-
: email","- `table.column`: phone",kt])}),
|
|
712
|
-
"keepTogether"],["### Contacts","contacts"]]),
|
|
713
|
-
map(([e,t])=>[t,e]))),
|
|
714
|
-
ntact"});function
|
|
715
|
+
: email","- `table.column`: phone",kt])}),Rt=new Map([["### Tables","tables"],["### Links","links"],["### Keep together",
|
|
716
|
+
"keepTogether"],["### Contacts","contacts"]]),eo=Object.freeze([...Rt.keys()]),wt=Object.freeze(Object.fromEntries([...Rt].
|
|
717
|
+
map(([e,t])=>[t,e]))),to=Object.freeze({tables:"table rule",links:"link",keepTogether:"Keep together entry",contacts:"co\
|
|
718
|
+
ntact"});function no(e,t,n){let[s]=v(t,Ee,e.location,"Staging data Database",n,{count:1});Oe.test(s)||e.fail(`Database n\
|
|
715
719
|
ames a database resource of genesis/stack.md's ## Resources by its id, such as \`database\`; ${JSON.stringify(s)} isn't \
|
|
716
|
-
one.`,n),e.model.database=s}function
|
|
717
|
-
model.mode=
|
|
718
|
-
\`: give it as an argument of its own, such as \`--output\` \`{dump}\`.`,n);let i=t.find(o=>o!==
|
|
719
|
-
`Source has the placeholder \`${i.match(
|
|
720
|
+
one.`,n),e.model.database=s}function so(e,t,n){Object.hasOwn(me,t)||e.fail(S("Staging data Mode",t,Object.keys(me)),n),e.
|
|
721
|
+
model.mode=me[t]}function io(e,t,n){let s=t.find(o=>o!==Fe&&o.includes(Fe));s&&e.fail(`Source passes \`{dump}\` inside \`${s}\
|
|
722
|
+
\`: give it as an argument of its own, such as \`--output\` \`{dump}\`.`,n);let i=t.find(o=>o!==Fe&&ms.test(o));i&&e.fail(
|
|
723
|
+
`Source has the placeholder \`${i.match(ms)[0]}\`; \`{dump}\` is its only one.`,n);let r=t.filter(o=>o===Fe).length;r!==
|
|
720
724
|
1&&e.fail(r?`Source passes \`{dump}\` ${r} times; its command writes one dump, so pass it once.`:`Source's command must \
|
|
721
|
-
pass \`{dump}\`, the file it writes production's dump to, as an argument of its own. Use: ${
|
|
722
|
-
match(
|
|
723
|
-
|
|
724
|
-
s[1],
|
|
725
|
-
Number.NaN;return o>=n&&o<=s||e.fail(`${i} must be a whole number from ${n} to ${s}; \`${t}\` isn't one.`,r),o}function
|
|
726
|
-
let s=t.match(
|
|
727
|
-
|
|
728
|
-
read:
|
|
729
|
-
prefix:"- Unlisted tables: ",key:"unlisted",label:"Unlisted tables",read:
|
|
730
|
-
e))return"keepTogether";if(
|
|
731
|
-
function
|
|
732
|
-
it under \`${
|
|
725
|
+
pass \`{dump}\`, the file it writes production's dump to, as an argument of its own. Use: ${qe}`,n)}function ro(e,t,n){let s=t.
|
|
726
|
+
match(Xr);s||e.fail(`Staging data Source must use: ${qe}`,n);let i=N(s[3],Ee,e.location,"Staging data Source command",n);
|
|
727
|
+
io(e,i,n),e.model.dumpSource={argv:i,workdir:y(s[2],Ee,e.location,"Staging data Source workdir",n),runtimeRequirements:C(
|
|
728
|
+
s[1],Ee,e.location,"Staging data Source runtimes",n)}}function _t(e,t,[n,s],i,r){let o=/^[1-9][0-9]*$/u.test(t)?Number(t):
|
|
729
|
+
Number.NaN;return o>=n&&o<=s||e.fail(`${i} must be a whole number from ${n} to ${s}; \`${t}\` isn't one.`,r),o}function oo(e,t,n){
|
|
730
|
+
let s=t.match(Zr);s||e.fail(`Staging data Unlisted tables must use: ${At}`,n),e.model.unlistedTables={maxRows:_t(e,s[1],
|
|
731
|
+
yt.unlistedRows,"Unlisted tables' rows",n)}}var ao=Object.freeze([{prefix:"- Database: ",key:"database",label:"Database",
|
|
732
|
+
read:no},{prefix:"- Mode: ",key:"mode",label:"Mode",read:so},{prefix:"- Source: ",key:"source",label:"Source",read:ro},{
|
|
733
|
+
prefix:"- Unlisted tables: ",key:"unlisted",label:"Unlisted tables",read:oo}]);function co(e){if(e===kt)return"";if(bs.test(
|
|
734
|
+
e))return"keepTogether";if(Es.test(e))return"links";let t=e.match(Ot);return t?t[1].includes(".")?"contacts":"tables":""}
|
|
735
|
+
function uo(e,t,n){let s=ao.find(({prefix:i})=>t.startsWith(i));if(!s){let i=co(t);e.fail(i?`\`${t}\` is a ${to[i]}: put\
|
|
736
|
+
it under \`${wt[i]}\`, after the section's own entries.`:S("Staging data entry",t,q.section),n)}e.at[s.key]&&e.fail(`St\
|
|
733
737
|
aging data has a second ${s.label} entry; the first is on line ${e.at[s.key]}.`,n),e.at[s.key]=n,s.read(e,t.slice(s.prefix.
|
|
734
|
-
length),n)}function
|
|
735
|
-
_, starting with a letter or _.`,s),t}function
|
|
738
|
+
length),n)}function be(e,t,n,s){return gs.test(t)||e.fail(`\`${t}\` isn't a ${n} name: use up to 64 letters, digits and \
|
|
739
|
+
_, starting with a letter or _.`,s),t}function It(e,t,n){let s=t.split(".");return(s.length!==2||!s.every(i=>gs.test(i)))&&
|
|
736
740
|
e.fail(`\`${t}\` isn't a column: name it \`table.column\`, each up to 64 letters, digits and _, starting with a letter or _\
|
|
737
|
-
.`,n),{table:s[0],column:s[1]}}function
|
|
738
|
-
if(t==="all"||t==="none")return{rule:t};let s=t.match(
|
|
741
|
+
.`,n),{table:s[0],column:s[1]}}function Ke(e,t,n,s,i){e.named[t].has(n)&&e.fail(s,i),e.named[t].add(n)}function lo(e,t,n){
|
|
742
|
+
if(t==="all"||t==="none")return{rule:t};let s=t.match(Jr);return s||e.fail(`Unknown table rule: ${t}. Use one of: ${q.tables.
|
|
739
743
|
join("; ")}.`,n),s[2]===void 0&&s[3]===void 0&&e.fail("A recent rule keeps its table's rows of the last `n` days, its ne\
|
|
740
|
-
west `n` rows, or both: add `, last `n` days`, `, newest `n` rows` or both, in that order.",n),{rule:"recent",by:
|
|
741
|
-
"column",n),days:s[2]===void 0?null:
|
|
742
|
-
"A recent rule's rows",n)}}function
|
|
743
|
-
e,s[1],"table",n);
|
|
744
|
-
...
|
|
745
|
-
r=
|
|
744
|
+
west `n` rows, or both: add `, last `n` days`, `, newest `n` rows` or both, in that order.",n),{rule:"recent",by:be(e,s[1],
|
|
745
|
+
"column",n),days:s[2]===void 0?null:_t(e,s[2],yt.days,"A recent rule's days",n),rows:s[3]===void 0?null:_t(e,s[3],yt.rows,
|
|
746
|
+
"A recent rule's rows",n)}}function po(e,t,n){let s=t.match(Ot);s||e.fail(S("Staging data table rule",t,q.tables),n);let i=be(
|
|
747
|
+
e,s[1],"table",n);Ke(e,"tables",i,`### Tables names \`${i}\` twice; give each table one rule.`,n),e.model.tables.push({table:i,
|
|
748
|
+
...lo(e,s[2],n)})}function mo(e,t,n){let s=t.match(Es);s||e.fail(S("Staging data link",t,q.links),n);let i=It(e,s[1],n),
|
|
749
|
+
r=It(e,s[2],n);s[1]===s[2]&&e.fail(`\`${s[1]}\` links to itself; a link names the column another column refers to.`,n),Ke(
|
|
746
750
|
e,"links",s[1],`### Links links \`${s[1]}\` twice; a column refers to one column.`,n),e.model.links.push({from:i,to:r})}
|
|
747
|
-
function
|
|
748
|
-
"table",n),r=
|
|
749
|
-
a parent table and another table whose rows refer to it.`,n),
|
|
750
|
-
\` rows by \`${o}\` twice; name each once.`,n),e.model.keepTogether.push({parent:i,child:r,column:o})}function
|
|
751
|
+
function ho(e,t,n){let s=t.match(bs);s||e.fail(S("Staging data Keep together entry",t,q.keepTogether),n);let i=be(e,s[1],
|
|
752
|
+
"table",n),r=be(e,s[2],"table",n),o=be(e,s[3],"column",n);i===r&&e.fail(`\`${i}\` keeps its own rows; Keep together names\
|
|
753
|
+
a parent table and another table whose rows refer to it.`,n),Ke(e,"keepTogether",`${r}.${o}`,`### Keep together keeps \`${r}\
|
|
754
|
+
\` rows by \`${o}\` twice; name each once.`,n),e.model.keepTogether.push({parent:i,child:r,column:o})}function fo(e,t,n){
|
|
751
755
|
if(t===kt){e.entries.contacts>0&&e.fail("`- Nothing.` under ### Contacts says no column holds one, so it is the heading'\
|
|
752
756
|
s only entry.",n),e.contactsNothing=n;return}e.contactsNothing&&e.fail(`### Contacts says \`- Nothing.\` on line ${e.contactsNothing}\
|
|
753
|
-
: remove it, or this contact.`,n);let s=t.match(
|
|
754
|
-
e,s[1],n);
|
|
755
|
-
contacts.slice(0,2).join(" or ")}.`,n),
|
|
756
|
-
n),e.model.contacts.push({table:i,column:r,kind:s[2]})}var
|
|
757
|
-
function
|
|
758
|
-
a second \`${t}\` heading; the first is on line ${e.at[s]}.`,n),e.at[s]=n,s}function
|
|
759
|
-
!i.source&&r(`Mode ${t} builds Staging's own database from a dump of production's: add ${
|
|
757
|
+
: remove it, or this contact.`,n);let s=t.match(Ot);s||e.fail(S("Staging data contact",t,q.contacts),n);let{table:i,column:r}=It(
|
|
758
|
+
e,s[1],n);Qr.includes(s[2])||e.fail(`Contact \`${s[1]}\` is an \`email\` or a \`phone\` column, written without backticks: ${q.
|
|
759
|
+
contacts.slice(0,2).join(" or ")}.`,n),Ke(e,"contacts",s[1],`### Contacts names \`${s[1]}\` twice; name each column once.`,
|
|
760
|
+
n),e.model.contacts.push({table:i,column:r,kind:s[2]})}var go=Object.freeze({tables:po,links:mo,keepTogether:ho,contacts:fo});
|
|
761
|
+
function Eo(e,t,n){let s=Rt.get(t);return s||e.fail(S("Staging data heading",t,eo),n),e.at[s]&&e.fail(`Staging data has \
|
|
762
|
+
a second \`${t}\` heading; the first is on line ${e.at[s]}.`,n),e.at[s]=n,s}function bo(e,t,n,s){let{at:i,fail:r}=e;n.source&&
|
|
763
|
+
!i.source&&r(`Mode ${t} builds Staging's own database from a dump of production's: add ${qe}`,i.mode),!n.source&&i.source&&
|
|
760
764
|
r(`Mode ${t} has no Source: ${s}.`,i.source),n.unlisted&&!i.unlisted&&r(`Mode ${t} says how many rows a table it doesn't\
|
|
761
|
-
list may have: add ${
|
|
762
|
-
py lists its tables.`,i.unlisted)}function
|
|
763
|
-
ogether"])!n.sampling&&i[c]&&o(`Mode ${t} has no \`${
|
|
764
|
-
r[c]===0&&o(`\`${
|
|
765
|
+
list may have: add ${At}`,i.mode),!n.unlisted&&i.unlisted&&r(`Mode ${t} has no Unlisted tables: ${s}; only a sampled co\
|
|
766
|
+
py lists its tables.`,i.unlisted)}function vo(e,t,n,s){let{at:i,entries:r,fail:o}=e;for(let c of["tables","links","keepT\
|
|
767
|
+
ogether"])!n.sampling&&i[c]&&o(`Mode ${t} has no \`${wt[c]}\`: ${s}; only own copy, sampled samples its tables.`,i[c]),i[c]&&
|
|
768
|
+
r[c]===0&&o(`\`${wt[c]}\` has no entries: add one (${q[c][0]}) or remove the heading.`,i[c]);n.sampling&&!i.tables&&o(`M\
|
|
765
769
|
ode ${t} samples production's tables: add \`### Tables\` with a rule for at least one table.`,i.mode),n.contacts&&!i.contacts&&
|
|
766
770
|
o(`Mode ${t} copies production's data, which holds people's email addresses and phone numbers: add \`### Contacts\` naming\
|
|
767
771
|
each column that holds one, or \`- Nothing.\` under it when none does.`,i.mode),!n.contacts&&i.contacts&&o(`Mode ${t} h\
|
|
768
772
|
as no \`### Contacts\`: ${s}, so there is nothing to replace.`,i.contacts),i.contacts&&r.contacts===0&&!e.contactsNothing&&
|
|
769
773
|
o("`### Contacts` has no entries: name each column that holds an email address or phone number, or write `- Nothing.` wh\
|
|
770
|
-
en none does.",i.contacts)}function
|
|
774
|
+
en none does.",i.contacts)}function So(e,t){e.at.database||e.fail("Staging data needs `- Database: `resource``, naming t\
|
|
771
775
|
he database resource of genesis/stack.md's ## Resources whose Staging data it declares.",t),e.at.mode||e.fail(`Staging d\
|
|
772
|
-
ata needs a Mode. Use one of: ${
|
|
773
|
-
e,n,s,i),
|
|
776
|
+
ata needs a Mode. Use one of: ${vs.join("; ")}.`,t);let n=qr[e.model.mode],s=Kr[e.model.mode],i=Yr[e.model.mode]||"";bo(
|
|
777
|
+
e,n,s,i),vo(e,n,s,i)}function Ss(e,t){let n=(o,c)=>d(Ee,t,o,c||void 0);Array.isArray(e)||n("Staging data requires exact \
|
|
774
778
|
Stack section lines.");let s=e.findIndex(o=>typeof o=="string"&&o.trim())+1;_(e)&&n("`- Nothing.` declares no Staging da\
|
|
775
779
|
ta: declare a mode (`- Database: `database`` and `- Mode: own copy, empty` at least), or remove the section, which gives\
|
|
776
780
|
Staging its own empty database.",s);let i={location:t,fail:n,model:{database:"",mode:"",dumpSource:null,unlistedTables:null,
|
|
777
781
|
tables:[],links:[],keepTogether:[],contacts:[]},at:{},entries:{tables:0,links:0,keepTogether:0,contacts:0},named:{tables:new Set,
|
|
778
782
|
links:new Set,keepTogether:new Set,contacts:new Set},contactsNothing:0},r="";for(let[o,c]of e.entries()){let a=String(c).
|
|
779
|
-
trim();if(!a)continue;let u=o+1;a.startsWith("#")?r=
|
|
780
|
-
i}function
|
|
781
|
-
filter(c=>
|
|
783
|
+
trim();if(!a)continue;let u=o+1;a.startsWith("#")?r=Eo(i,a,u):r?(go[r](i,a,u),i.entries[r]+=1):uo(i,a,u)}return So(i,s),
|
|
784
|
+
i}function yo(e,t={}){let{path:n=fs}=t;return Ss(e,n).model}function wo(e,t){let n=ke(t),{database:s}=e.model,i=[...n.values()].
|
|
785
|
+
filter(c=>ds.includes(c.kind)).map(({id:c})=>`\`${c}\``),r=i.length?`name one of its databases: ${i.join(", ")}`:"it dec\
|
|
782
786
|
lares no `mysql` or `postgresql` database; add one to the Stack, or remove the section",o=n.get(s);return o||e.fail(`Dat\
|
|
783
|
-
abase \`${s}\`: genesis/stack.md's ## Resources declares no resource \`${s}\`; ${r}.`,e.at.database),
|
|
787
|
+
abase \`${s}\`: genesis/stack.md's ## Resources declares no resource \`${s}\`; ${r}.`,e.at.database),ds.includes(o.kind)||
|
|
784
788
|
e.fail(`Database \`${s}\` is a ${o.kind} resource, and Staging data is for a \`mysql\` or \`postgresql\` database; ${r}.`,
|
|
785
|
-
e.at.database),o.kind}function
|
|
786
|
-
[]],s=t.status==="ready"&&n.length===0?
|
|
789
|
+
e.at.database),o.kind}function Nt({environment:e={},section:t={}}={}){M(t,e,"Staging data section");let n=[...t.diagnostics||
|
|
790
|
+
[]],s=t.status==="ready"&&n.length===0?Ss(t.lines,fs):null,i=s?.model,r={database:i?.database||"",engine:s?wo(s,e.resources):
|
|
787
791
|
"",mode:i?.mode||"empty",dumpSource:i?.dumpSource||null,unlistedTables:i?.unlistedTables||null,tables:i?.tables||[],links:i?.
|
|
788
|
-
links||[],keepTogether:i?.keepTogether||[],contacts:i?.contacts||[]};return{contract:
|
|
792
|
+
links||[],keepTogether:i?.keepTogether||[],contacts:i?.contacts||[]};return{contract:hs,status:n.length>0?"blocked":s?"r\
|
|
789
793
|
eady":"unconfigured",stackHash:t.stackHash,recipeHash:s?k({version:1,...r}):"",source:t.source||null,components:[...t.components||
|
|
790
|
-
[]],diagnostics:n,...r}}import{access as
|
|
791
|
-
`path`...] with `runtime` [in `workdir`] [when|if `path` exists]: `command` `argument`...",
|
|
792
|
-
|
|
793
|
-
esis/stack.md#Workspace setup"}=t;if(Array.isArray(e)||
|
|
794
|
-
es."),_(e))return[];let s=[];for(let i=0;i<e.length;i+=1){let r=e[i].trim();if(!r)continue;let o=i+1,c=r.match(
|
|
795
|
-
match(
|
|
796
|
-
{label:w(c[1],
|
|
797
|
-
a?a[2]:c[2],
|
|
798
|
-
t one Prepare entry or exactly `- Nothing.`."),s}async function
|
|
799
|
-
"ENOENT","ENOTDIR"].includes(n?.code))return!1;throw n}}async function
|
|
800
|
-
[]],s=[];t.status==="ready"&&(s=
|
|
801
|
-
await
|
|
794
|
+
[]],diagnostics:n,...r}}import{access as _o}from"node:fs/promises";import ws from"node:path";var Io="vibe64.workspace-setup.v1",ve="Workspace setup",Ye="VIBE64_WORKSPACE_SETUP_INVALID",ys="- Prepare `label` [from \
|
|
795
|
+
`path`...] with `runtime` [in `workdir`] [when|if `path` exists]: `command` `argument`...",To=/^- Prepare `([^`\r\n]+)` (.+)$/u,
|
|
796
|
+
Oo=/^from ((?:`[^`\r\n]+`[ \t]+)+)(with .+)$/u;function Ct(e,t,n,s={}){d(Ye,e,t,n,s)}function Xe(e,t={}){let{path:n="gen\
|
|
797
|
+
esis/stack.md#Workspace setup"}=t;if(Array.isArray(e)||Ct(n,"Workspace setup must be supplied as exact Stack section lin\
|
|
798
|
+
es."),_(e))return[];let s=[];for(let i=0;i<e.length;i+=1){let r=e[i].trim();if(!r)continue;let o=i+1,c=r.match(To),a=c?.[2].
|
|
799
|
+
match(Oo);(!c||c[2].startsWith("from ")&&!a)&&Ct(n,`Every Workspace setup entry must use: ${ys}`,o,{observed:r}),s.push(
|
|
800
|
+
{label:w(c[1],Ye,n,"Workspace setup step label",o),...a?{inputs:Ie(a[1].trimEnd(),Ye,n,"Workspace setup inputs",o)}:{},...Te(
|
|
801
|
+
a?a[2]:c[2],Ye,n,"Workspace setup",o,{form:ys,observed:r})})}return s.length===0&&Ct(n,"## Workspace setup needs at leas\
|
|
802
|
+
t one Prepare entry or exactly `- Nothing.`."),s}async function ko(e,t){try{return await _o(ws.join(e,t)),!0}catch(n){if([
|
|
803
|
+
"ENOENT","ENOTDIR"].includes(n?.code))return!1;throw n}}async function _s({projectRoot:e,section:t={}}={}){let n=[...t.diagnostics||
|
|
804
|
+
[]],s=[];t.status==="ready"&&(s=Xe(t.lines));let i=[],r=[],o=ws.resolve(e);if(n.length===0)for(let p of s){if(!p.condition||
|
|
805
|
+
await ko(o,p.condition.pathExists)){i.push(p);continue}p.condition.onMissing==="wait"&&r.push(p.condition.pathExists)}if(r.
|
|
802
806
|
length>0){let p=H(r);n.push({code:"VIBE64_WORKSPACE_SETUP_WAITING",message:`Workspace setup is waiting for project ${p.length===
|
|
803
807
|
1?"path":"paths"}: ${p.join(", ")}.`,details:{paths:p}})}let c=n.some(({code:p})=>p==="VIBE64_WORKSPACE_SETUP_WAITING"),
|
|
804
808
|
a=n.some(({code:p})=>p!=="VIBE64_WORKSPACE_SETUP_WAITING"),u="unconfigured";a?u="blocked":!c&&i.length>0&&(u="ready");let l=i.
|
|
805
|
-
map(({condition:p,...
|
|
806
|
-
dy"?k(
|
|
807
|
-
steps:l,diagnostics:n}}var
|
|
808
|
-
1024,
|
|
809
|
-
ningTypical"],["Running high MiB","runningHigh"],["Typical MiB","typical"],["High MiB","high"]]);function
|
|
810
|
-
e,t,n)}function
|
|
811
|
-
quires typical and high estimates, with typical no greater than high.",i),{typicalBytes:r,highBytes:o}}function
|
|
809
|
+
map(({condition:p,...E})=>E),m={version:1,steps:l};return{contract:Io,status:u,stackHash:t.stackHash,recipeHash:u==="rea\
|
|
810
|
+
dy"?k(m):"",components:[...t.components||[]],source:t.source||null,runtimeRequirements:H(l.flatMap(p=>p.runtimeRequirements)),
|
|
811
|
+
steps:l,diagnostics:n}}var Ao="vibe64.resource-estimates.v1",Ze="Resource estimates",Os="VIBE64_RESOURCE_ESTIMATES_INVALID",Ro=1024*1024,Is=1024*
|
|
812
|
+
1024,Ts=new Map([["Startup typical MiB","startupTypical"],["Startup high MiB","startupHigh"],["Running typical MiB","run\
|
|
813
|
+
ningTypical"],["Running high MiB","runningHigh"],["Typical MiB","typical"],["High MiB","high"]]);function G(e,t,n){d(Os,
|
|
814
|
+
e,t,n)}function Dt(e,t,n,s,i){let r=e.get(t),o=e.get(n);return(r===void 0||o===void 0||r>o)&&G(s,"Each resource phase re\
|
|
815
|
+
quires typical and high estimates, with typical no greater than high.",i),{typicalBytes:r,highBytes:o}}function ks(e,t={}){
|
|
812
816
|
let{path:n="genesis/stack.md#Resource estimates",targets:s=[],hasWorkspaceSetup:i=!1}=t;(!Array.isArray(e)||e.length>2048||
|
|
813
817
|
e.some(l=>typeof l!="string")||Buffer.byteLength(e.join(`
|
|
814
|
-
`),"utf8")>64*1024)&&
|
|
818
|
+
`),"utf8")>64*1024)&&G(n,"Resource estimates must be exact Stack section lines within 64 KiB and 2048 lines.");let r={version:1,
|
|
815
819
|
outputs:[],workspaceSetup:null};if(_(e))return r;let o=new Map(s.map(l=>[l.id,l])),c=new Set,a=null;function u(){if(!a)return;
|
|
816
|
-
let{targetId:l,mode:
|
|
817
|
-
ts require separate Startup and Running estimates.",
|
|
818
|
-
startupHigh",n,
|
|
819
|
-
|
|
820
|
-
outputs.push({targetId:l,mode:
|
|
821
|
-
continue;let
|
|
822
|
-
"",X
|
|
823
|
-
get(
|
|
824
|
-
|
|
825
|
-
line:p};continue}let
|
|
826
|
-
or Workspace setup heading followed by positive integer MiB estimates: ${[...
|
|
827
|
-
"; ")}.`,p),a.fields.has(
|
|
828
|
-
|
|
829
|
-
rce estimates needs an operation or exactly `- Nothing.`."),r}function
|
|
830
|
-
|
|
831
|
-
version:1,outputs:[],workspaceSetup:null};if(e.status==="ready"&&s.length===0)try{i=
|
|
832
|
-
y"?
|
|
833
|
-
kOperationError")throw o;s.push({code:
|
|
834
|
-
nvalid":i.outputs.length>0||i.workspaceSetup?"ready":"unconfigured";return{contract:
|
|
820
|
+
let{targetId:l,mode:m,fields:p,line:E}=a;if(m==="interactive"){(p.has("typical")||p.has("high"))&&G(n,"Interactive outpu\
|
|
821
|
+
ts require separate Startup and Running estimates.",E),r.outputs.push({targetId:l,mode:m,startup:Dt(p,"startupTypical","\
|
|
822
|
+
startupHigh",n,E),running:Dt(p,"runningTypical","runningHigh",n,E)});return}(p.size!==2||!p.has("typical")||!p.has("high"))&&
|
|
823
|
+
G(n,"Finite outputs and Workspace setup require only Typical MiB and High MiB.",E);let f=Dt(p,"typical","high",n,E);l?r.
|
|
824
|
+
outputs.push({targetId:l,mode:m,execution:f}):r.workspaceSetup=f}for(let l=0;l<e.length;l+=1){let m=e[l].trim(),p=l+1;if(!m)
|
|
825
|
+
continue;let E=m.match(/^### Output `([a-z0-9]+(?:-[a-z0-9]+)*)`$/u);if(E||m==="### Workspace setup"){u();let I=E?.[1]||
|
|
826
|
+
"",X=I?`output:${I}`:"workspace-setup";c.has(X)&&G(n,"Resource estimates contains a duplicate operation.",p),c.add(X);let Z=o.
|
|
827
|
+
get(I);I&&!["interactive","finite"].includes(Z?.mode)&&G(n,`Resource estimate references an undeclared output: ${I}.`,p),
|
|
828
|
+
!I&&!i&&G(n,"Resource estimate references undeclared Workspace setup steps.",p),a={targetId:I,mode:Z?.mode||"setup",fields:new Map,
|
|
829
|
+
line:p};continue}let f=m.match(/^- ([A-Za-z ]+): `([1-9][0-9]*)`$/u),T=f&&Ts.get(f[1]);(!a||!T)&&G(n,`Expected an Output\
|
|
830
|
+
or Workspace setup heading followed by positive integer MiB estimates: ${[...Ts.keys()].map(I=>`- ${I}: \`number\``).join(
|
|
831
|
+
"; ")}.`,p),a.fields.has(T)&&G(n,`Duplicate resource field: ${f[1]}.`,p);let U=Number(f[2]);(!Number.isSafeInteger(U)||U>
|
|
832
|
+
Is)&&G(n,`Resource estimates must be between 1 and ${Is} MiB.`,p),a.fields.set(T,U*Ro)}return u(),c.size===0&&G(n,"Resou\
|
|
833
|
+
rce estimates needs an operation or exactly `- Nothing.`."),r}function Je({section:e={},outputsSection:t={},workspaceSetupSection:n={}}={}){
|
|
834
|
+
M(e,t,"Resource estimates and Outputs"),M(e,n,"Resource estimates and Workspace setup");let s=[...e.diagnostics||[]],i={
|
|
835
|
+
version:1,outputs:[],workspaceSetup:null};if(e.status==="ready"&&s.length===0)try{i=ks(e.lines,{targets:t.status==="read\
|
|
836
|
+
y"?He(t.lines).targets:[],hasWorkspaceSetup:n.status==="ready"&&Xe(n.lines).length>0})}catch(o){if(o?.name!=="Vibe64Stac\
|
|
837
|
+
kOperationError")throw o;s.push({code:Os,message:o.message,details:{...o.details,causeCode:o.code}})}let r=s.length>0?"i\
|
|
838
|
+
nvalid":i.outputs.length>0||i.workspaceSetup?"ready":"unconfigured";return{contract:Ao,status:r,stackHash:e.stackHash,sectionHash:e.
|
|
835
839
|
sectionHash||"",estimatesHash:r==="ready"?k(i):"",source:e.source||null,outputs:i.outputs,workspaceSetup:i.workspaceSetup,
|
|
836
|
-
fallbackReason:r==="invalid"?"invalid-estimates":r==="unconfigured"?"not-declared":null,diagnostics:s}}var
|
|
837
|
-
ntime` in `workdir`: `command` `argument`...";function
|
|
838
|
-
isArray(e)||
|
|
839
|
-
Boolean),i=s.length===1&&s[0].match(/^- Command with (.+?) in `([^`\r\n]+)`: (.+)$/u);return i||
|
|
840
|
-
p requires exactly one entry: ${
|
|
841
|
-
"Integration setup workdir"),runtimeRequirements:C(i[1],
|
|
842
|
-
let t=[...e.diagnostics||[]],n=e.status==="ready"&&t.length===0?
|
|
840
|
+
fallbackReason:r==="invalid"?"invalid-estimates":r==="unconfigured"?"not-declared":null,diagnostics:s}}var No="vibe64.integration-setup.v1",As="Integration setup",Se="VIBE64_INTEGRATION_SETUP_INVALID",Co="- Command with `ru\
|
|
841
|
+
ntime` in `workdir`: `command` `argument`...";function Rs(e,t={}){let{path:n="genesis/stack.md#Integration setup"}=t;if(Array.
|
|
842
|
+
isArray(e)||d(Se,n,"Integration setup requires exact Stack section lines."),_(e))return null;let s=e.map(r=>r.trim()).filter(
|
|
843
|
+
Boolean),i=s.length===1&&s[0].match(/^- Command with (.+?) in `([^`\r\n]+)`: (.+)$/u);return i||d(Se,n,`Integration setu\
|
|
844
|
+
p requires exactly one entry: ${Co}; or - Nothing.`),{argv:N(i[3],Se,n,"Integration setup command"),workdir:y(i[2],Se,n,
|
|
845
|
+
"Integration setup workdir"),runtimeRequirements:C(i[1],Se,n,"Integration setup runtimes")}}function Ns({section:e={}}={}){
|
|
846
|
+
let t=[...e.diagnostics||[]],n=e.status==="ready"&&t.length===0?Rs(e.lines):null;return{contract:No,status:t.length?"blo\
|
|
843
847
|
cked":n?"ready":"unconfigured",stackHash:e.stackHash,recipeHash:n?k({version:1,command:n}):"",source:e.source||null,components:[
|
|
844
|
-
...e.components||[]],command:n,diagnostics:t}}var
|
|
845
|
-
"Genesis host context requires an absolute runtime root.");let t=W.join(e,"genesis-context");if(!
|
|
846
|
-
catch(s=>{throw
|
|
847
|
-
HOST_CONTEXT_RESOLVER_ENV:
|
|
848
|
-
inspectCollaboration:
|
|
849
|
-
inspectProjectFormat:
|
|
850
|
-
listStackPieces:
|
|
851
|
-
syncSkills:
|
|
852
|
-
mergeArchitectureObservations:
|
|
853
|
-
CITY_SCHEMA_VERSION:
|
|
854
|
-
GENESIS_TURN_CONTEXT_ENABLED:"0"}}var
|
|
855
|
-
go-postgresql","jskit-postgresql","postgresql","rails-postgresql","spring-boot-postgresql"]),
|
|
856
|
-
stack"]),
|
|
857
|
-
"This genesis-compiler lists no prompt tasks. Update it to the release Vibe64 declares.");var
|
|
848
|
+
...e.components||[]],command:n,diagnostics:t}}var Do=new URL("./index.js",import.meta.url).href,Ps=$o(Do),Qe=new Map;async function Lo(e){if(!W.isAbsolute(e||""))throw new TypeError(
|
|
849
|
+
"Genesis host context requires an absolute runtime root.");let t=W.join(e,"genesis-context");if(!Qe.has(t)){let n=dn(t).
|
|
850
|
+
catch(s=>{throw Qe.delete(t),s});Qe.set(t,n)}return Qe.get(t)}var{GENESIS_CONTRACTS:P,HOST_CONTEXT_RESOLVER_DATA_ENV:xo,
|
|
851
|
+
HOST_CONTEXT_RESOLVER_ENV:Vo,PROMPT_TASKS:$s,addStack:Mo,applyTemplate:jo,generatePrompt:Go,indexCodebase:Uo,initialize:Bo,
|
|
852
|
+
inspectCollaboration:Wo,inspectDerivedArtifacts:zo,inspectEngineering:Ho,inspectEnvironment:Pt,inspectPasses:Fo,inspectProject:qo,
|
|
853
|
+
inspectProjectFormat:Ko,inspectAgentIntegrations:Yo,inspectSkills:Xo,inspectStackSection:Zo,inspectStackSections:Jo,inspectSubsystems:Qo,
|
|
854
|
+
listStackPieces:ea,listTemplates:ta,parserEnvironment:Jc,setCollaboration:na,setEngineeringProfile:sa,syncAgentIntegrations:ia,
|
|
855
|
+
syncSkills:ra,withTrustedGitRepository:oa,SOURCE_EXPLANATION_PROMPT_VERSION:Qc,sourceExplanationGuidance:eu,validateArchitectureFacts:tu,
|
|
856
|
+
mergeArchitectureObservations:nu,validateCityDocument:su,validateCallWeb:iu,CALL_WEB_SCHEMA:ru,MACHINE_CITY_SCHEMA:ou,PROGRAM_CITY_SCHEMA:au,
|
|
857
|
+
CITY_SCHEMA_VERSION:cu}=ye;async function uu(e){let t=await Lo(e);return{[Vo]:ma(),[xo]:JSON.stringify({registryPath:t.registryPath}),
|
|
858
|
+
GENESIS_TURN_CONTEXT_ENABLED:"0"}}var lu="genesis/blueprint.md",pu="genesis/subsystems.md",aa=Object.freeze(["vue","djan\
|
|
859
|
+
go-postgresql","jskit-postgresql","postgresql","rails-postgresql","spring-boot-postgresql"]),ca=Object.freeze(["genesis-\
|
|
860
|
+
stack"]),Ds=Object.freeze({BLUEPRINT_INVALID:"blueprint",BLUEPRINT_REQUIRED:"start"});if(!Array.isArray($s))throw new Error(
|
|
861
|
+
"This genesis-compiler lists no prompt tasks. Update it to the release Vibe64 declares.");var Ls=new Set($s),$t=15e3;function Lt(e,t=$t){
|
|
858
862
|
let n,s=new Promise((i,r)=>{n=setTimeout(()=>r(Object.assign(new Error(`Genesis did not answer within ${t} ms.`),{code:"\
|
|
859
|
-
vibe64_genesis_timeout"})),t)});return Promise.race([Promise.resolve().then(e),s]).finally(()=>clearTimeout(n))}function
|
|
860
|
-
let{required:n=!1}=t,s=
|
|
861
|
-
"Genesis prompt actions require an explicit task.");return s}function
|
|
862
|
-
return[e.conversationRequest,e.feedback,e.request,e.plan,e.description,t.label].map(
|
|
863
|
-
ested project work."}function
|
|
864
|
-
r"))&&
|
|
865
|
-
ted.");return W.join(e,".bin")}function
|
|
866
|
-
e),"../../bin")}function
|
|
867
|
-
...(Array.isArray(e)?e:[]).filter(i=>![t,n].includes(
|
|
868
|
-
{hiddenStackPieces:
|
|
863
|
+
vibe64_genesis_timeout"})),t)});return Promise.race([Promise.resolve().then(e),s]).finally(()=>clearTimeout(n))}function ua(e,t={}){
|
|
864
|
+
let{required:n=!1}=t,s=x(e);if(!s&&!n)return"";if(!Ls.has(s))throw new TypeError(s?`Unknown Genesis prompt task: ${s}.`:
|
|
865
|
+
"Genesis prompt actions require an explicit task.");return s}function la(e={}){return ua(e.genesisTask)||"work"}function pa(e={},t={}){
|
|
866
|
+
return[e.conversationRequest,e.feedback,e.request,e.plan,e.description,t.label].map(x).find(Boolean)||"Continue the requ\
|
|
867
|
+
ested project work."}function da(){let e=(Ps.resolve.paths("genesis-compiler")||[]).find(t=>Cs(W.join(t,"genesis-compile\
|
|
868
|
+
r"))&&Cs(W.join(t,".bin","genesis")));if(!e)throw new Error("The installed Genesis compiler executable could not be loca\
|
|
869
|
+
ted.");return W.join(e,".bin")}function xs(){let e=Ps.resolve("@local/vibe64-genesis/server");return W.resolve(W.dirname(
|
|
870
|
+
e),"../../bin")}function ma(){return W.resolve(xs(),"vibe64-genesis-host-context")}function du(e=[]){let t=xs(),n=da();return[
|
|
871
|
+
...(Array.isArray(e)?e:[]).filter(i=>![t,n].includes(x(i))),t]}function ha(e={},t={}){let{prompt:n=!1}=t;return{...e,...n?
|
|
872
|
+
{hiddenStackPieces:aa}:{},stackPackages:ca}}function mu(e={}){return z(Mo,e)}async function hu(e={}){let t=await oe(ea,e);
|
|
869
873
|
if(t.every(n=>Array.isArray(n?.resourceDeclarations)))return t;throw new Error("This genesis-compiler lists no Stack res\
|
|
870
|
-
ource declarations. Update it to the release Vibe64 declares.")}function
|
|
871
|
-
|
|
872
|
-
return
|
|
873
|
-
return z(
|
|
874
|
+
ource declarations. Update it to the release Vibe64 declares.")}function fu(e={}){return z(Bo,e)}function gu(e={}){return oe(
|
|
875
|
+
Xo,e)}function Eu(e={}){return z(ra,e)}function bu(e={}){return z(ia,e)}function vu(e={}){return oe(Yo,e)}function Su(e={}){
|
|
876
|
+
return oe(Qo,e)}async function yu(e={}){return tn(await ae(Xt,e))}async function wu(e={}){return rn(await ae(nn,e))}function _u(e={}){
|
|
877
|
+
return z(Uo,e)}function fa(){let e=zo();if(e?.contract!==P.derivedArtifacts)throw new Error(`Genesis returned ${e?.contract||
|
|
874
878
|
"no contract identity"}; expected ${P.derivedArtifacts}.`);let t=Array.isArray(e.artifacts)?e.artifacts:[];if(!t.length||
|
|
875
|
-
t.some(n=>!
|
|
876
|
-
map(n=>({...n}))}}var
|
|
877
|
-
get("machine-city")?.path,
|
|
878
|
-
projection artifacts.");var
|
|
879
|
-
tifact.");async function z(e,t={},n={}){let s=
|
|
880
|
-
ations require an explicit absolute projectRoot.");return
|
|
881
|
-
sis project guidance is unavailable for this conversation (${
|
|
879
|
+
t.some(n=>!x(n?.path)))throw new Error("Genesis returned an invalid derived-artifact contract.");return{...e,artifacts:t.
|
|
880
|
+
map(n=>({...n}))}}var Vs=fa(),Iu=Object.freeze(Vs.artifacts.map(e=>e.path)),xt=new Map(Vs.artifacts.map(e=>[e.id,e])),ga=xt.
|
|
881
|
+
get("machine-city")?.path,Ea=xt.get("program-city")?.path;if(!ga||!Ea)throw new Error("Genesis did not declare both City\
|
|
882
|
+
projection artifacts.");var ba=xt.get("call-web")?.path;if(!ba)throw new Error("Genesis did not declare its call-web ar\
|
|
883
|
+
tifact.");async function z(e,t={},n={}){let s=x(t.projectRoot);if(!s||!W.isAbsolute(s))throw new TypeError("Genesis oper\
|
|
884
|
+
ations require an explicit absolute projectRoot.");return oa(s,()=>e(ha(t,n)))}function Ms(){}function va(e){return`Gene\
|
|
885
|
+
sis project guidance is unavailable for this conversation (${x(e?.message||e).replace(/\s+/gu," ").slice(0,300)||"no rea\
|
|
882
886
|
son given"}). Work from the repository itself, where the genesis/ files still describe the project when present, and tel\
|
|
883
|
-
l the user that Genesis guidance did not load if it matters to the request.`}async function
|
|
884
|
-
onGenesisUnavailable:n=
|
|
885
|
-
|
|
886
|
-
return o.output;r=new Error("Genesis returned no session guidance.")}catch(o){r=o}return n(r),`${
|
|
887
|
+
l the user that Genesis guidance did not load if it matters to the request.`}async function Tu({workdir:e,promptContext:t},{
|
|
888
|
+
onGenesisUnavailable:n=Ms,timeoutMs:s=$t}={}){let i=le(t);if(t.scope==="ephemeral")return i;let r;try{let o=await Lt(()=>z(
|
|
889
|
+
ye.projectSessionContext,{projectRoot:e,hostDriver:le,hostDriverInput:t}),s);if(typeof o?.output=="string"&&o.output.trim())
|
|
890
|
+
return o.output;r=new Error("Genesis returned no session guidance.")}catch(o){r=o}return n(r),`${va(r)}
|
|
887
891
|
|
|
888
|
-
${i}`}function
|
|
889
|
-
contract||"no contract identity"}; expected ${t}.`);return e}async function K(e,t,n={}){return
|
|
890
|
-
return
|
|
891
|
-
let n=await
|
|
892
|
-
s.name!==e[i]))throw new Error("Genesis returned an invalid Stack section inspection batch.");return n}async function
|
|
893
|
-
if((await
|
|
894
|
-
Stack can be inspected."),{code:"vibe64_stack_format_required"});await
|
|
895
|
-
|
|
896
|
-
all([
|
|
897
|
-
return z(
|
|
898
|
-
function
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
"Genesis did not return a project-format status.");return{...t}}function
|
|
902
|
-
return
|
|
903
|
-
[
|
|
904
|
-
{section:s,outputsSection:n,workspaceSetupSection:i})}}async function
|
|
905
|
-
async function
|
|
906
|
-
let[t,n,s]=await
|
|
907
|
-
outputsSection:s,workspaceSetupSection:t})}}async function
|
|
908
|
-
outputsSection:n,workspaceSetupSection:s})}async function
|
|
909
|
-
projectRoot:i,timeoutMs:r
|
|
910
|
-
task:
|
|
911
|
-
code]:"";if(!
|
|
912
|
-
result?.prompt!="string"||!l.result.prompt.trim())throw new Error("Genesis returned no prompt.")}catch(
|
|
913
|
-
let{result:
|
|
914
|
-
verificationCommands,warnings:
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
q as STAGING_DATA_ENTRY_FORMS,
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
892
|
+
${i}`}function oe(e,t={}){return Lt(()=>z(e,t))}function js(e,t){if(e?.contract!==t)throw new Error(`Genesis returned ${e?.
|
|
893
|
+
contract||"no contract identity"}; expected ${t}.`);return e}async function K(e,t,n={}){return js(await oe(e,n),t)}async function Vt(e,t,n={}){
|
|
894
|
+
return js(await z(e,n),t)}function ae(e,t={}){return K(n=>Zo({...n,name:e}),P.stackSection,t)}async function Mt(e,t={}){
|
|
895
|
+
let n=await oe(s=>Jo({...s,names:e}),t);if(!Array.isArray(n)||n.length!==e.length||n.some((s,i)=>s?.contract!==P.stackSection||
|
|
896
|
+
s.name!==e[i]))throw new Error("Genesis returned an invalid Stack section inspection batch.");return n}async function Ou(e={}){
|
|
897
|
+
if((await Sa(e)).status!=="current")throw Object.assign(new Error("The project needs a current Genesis format before its\
|
|
898
|
+
Stack can be inspected."),{code:"vibe64_stack_format_required"});await Po(W.join(e.projectRoot,ot),"utf8");let n=await ae(
|
|
899
|
+
ve,e);return{components:n.components,stackHash:n.stackHash}}function jt(e,t){return async(n={})=>{let[s,i]=await Promise.
|
|
900
|
+
all([ae(e,n),K(Pt,P.environment,n)]);return t({environment:i,section:s})}}var ku=jt(Ln,Vn),Au=jt(Wn,Kn),Ru=jt(Tt,Nt);function Nu(e={}){
|
|
901
|
+
return z(ye.verify,e)}function Cu(e={}){return K(Pt,P.environment,e)}function Du(e={}){return K(qo,P.projectInspection,e)}
|
|
902
|
+
function Pu(e={}){return K(ta,P.templates,e)}function $u(e={}){return Vt(jo,P.templateApplication,e)}function Lu(e={}){return K(
|
|
903
|
+
Ho,P.engineering,e)}function xu(e={}){return K(Wo,P.collaboration,e)}async function Vu(e){let{unavailable:t,passes:n,master:s}=await K(
|
|
904
|
+
Fo,P.passes,e);return{unavailable:t,passes:n,master:s}}async function Sa(e={}){let t=await oe(Ko,e);if(!x(t?.status))throw new Error(
|
|
905
|
+
"Genesis did not return a project-format status.");return{...t}}function Mu(e={}){return Vt(sa,P.engineering,e)}function ju(e={}){
|
|
906
|
+
return Vt(na,P.collaboration,e)}async function Gu({resourcesPreparing:e=!1,...t}={}){let[[n,s,i],r]=await Promise.all([Mt(
|
|
907
|
+
[We,Ze,ve],t),K(Pt,P.environment,t)]);return{...cs({environment:r,section:n,resourcesPreparing:e===!0}),resourceEstimates:Je(
|
|
908
|
+
{section:s,outputsSection:n,workspaceSetupSection:i})}}async function Uu(e={}){let t=await ae(As,e);return Ns({section:t})}
|
|
909
|
+
async function Bu(e={}){return Ft(await ae(zt,e))}async function Wu(e={}){return ps(await ae(us,e))}async function zu(e={}){
|
|
910
|
+
let[t,n,s]=await Mt([ve,Ze,We],e);return{...await _s({projectRoot:e.projectRoot,section:t}),resourceEstimates:Je({section:n,
|
|
911
|
+
outputsSection:s,workspaceSetupSection:t})}}async function Hu(e={}){let[t,n,s]=await Mt([Ze,We,ve],e);return Je({section:t,
|
|
912
|
+
outputsSection:n,workspaceSetupSection:s})}async function Fu({action:e={},environment:t,input:n={},onGenesisUnavailable:s=Ms,
|
|
913
|
+
projectRoot:i,timeoutMs:r=$t}){let o=la(e),c=pa(n,e),a=f=>z(Go,{environment:t,projectRoot:i,request:c,sessionContextInstalled:!0,
|
|
914
|
+
task:f},{prompt:!0}),u=async()=>{try{return{result:await a(o),task:o}}catch(f){let T=Object.hasOwn(Ds,String(f?.code))?Ds[f.
|
|
915
|
+
code]:"";if(!T||T===o||n.automaticGenesisTask===!0)throw f;return{result:await a(T),task:T}}},l;try{if(l=await Lt(u,r),typeof l.
|
|
916
|
+
result?.prompt!="string"||!l.result.prompt.trim())throw new Error("Genesis returned no prompt.")}catch(f){return s(f),{prompt:c}}
|
|
917
|
+
let{result:m,task:p}=l,E=Ls.has(x(m.task))?x(m.task):p;return{context:{genesis:!0,requestedTask:o,task:E,verificationCommands:m.
|
|
918
|
+
verificationCommands,warnings:m.warnings},originalPrompt:c,prompt:m.prompt,promptId:x(e.promptId||e.id)||E}}export{ru as CALL_WEB_SCHEMA,cu as CITY_SCHEMA_VERSION,lu as GENESIS_BLUEPRINT_PATH,ba as GENESIS_CALL_WEB_PATH,Iu as GENESIS_DERIVED_ARTIFACT_PATHS,
|
|
919
|
+
ga as GENESIS_MACHINE_CITY_PATH,Ea as GENESIS_PROGRAM_CITY_PATH,ot as GENESIS_STACK_PATH,on as GENESIS_STACK_SECTION_AMBIGUOUS,
|
|
920
|
+
pu as GENESIS_SUBSYSTEMS_PATH,$t as GENESIS_USER_PATH_TIMEOUT_MS,ou as MACHINE_CITY_SCHEMA,au as PROGRAM_CITY_SCHEMA,Qc as SOURCE_EXPLANATION_PROMPT_VERSION,
|
|
921
|
+
q as STAGING_DATA_ENTRY_FORMS,me as STAGING_DATA_MODES,$n as VIBE64_APPLICATION_DEPLOYMENT_CONTRACT,Qi as VIBE64_APPLICATION_DEPLOYMENT_V1_CONTRACT,
|
|
922
|
+
Ge as VIBE64_PACKAGING_CONTRACT,ge as VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL,hs as VIBE64_STAGING_DATA_CONTRACT,Tt as VIBE64_STAGING_DATA_SECTION,
|
|
923
|
+
mu as addGenesisStack,$u as applyGenesisTemplate,ua as assertGenesisPromptTask,xs as genesisCommandShimDirectory,da as genesisPackageBinDirectory,
|
|
924
|
+
Jc as genesisParserEnvironment,gi as genesisProjectContractNeedsAttention,vi as genesisProjectFileDiagnostic,bi as genesisProjectFileUnreadable,
|
|
925
|
+
pa as genesisPromptRequest,la as genesisPromptTask,fu as initializeGenesisProject,vu as inspectGenesisAgentIntegrations,
|
|
926
|
+
xu as inspectGenesisCollaboration,fa as inspectGenesisDerivedArtifacts,Lu as inspectGenesisEngineering,Cu as inspectGenesisEnvironment,
|
|
927
|
+
Du as inspectGenesisProject,Sa as inspectGenesisProjectFormat,gu as inspectGenesisSkills,Ou as inspectGenesisStackComponents,
|
|
928
|
+
Su as inspectGenesisSubsystems,yu as inspectVibe64ArchitectureInspection,wu as inspectVibe64ArchitectureLayout,Bu as inspectVibe64ConnectedDevelopment,
|
|
929
|
+
ku as inspectVibe64Deployment,Uu as inspectVibe64IntegrationSetup,Gu as inspectVibe64Outputs,Au as inspectVibe64Packaging,
|
|
930
|
+
Wu as inspectVibe64ProjectServices,Hu as inspectVibe64ResourceEstimates,Ru as inspectVibe64StagingData,zu as inspectVibe64WorkspaceSetup,
|
|
931
|
+
Vu as listGenesisPasses,hu as listGenesisStackPieces,Pu as listGenesisTemplates,nu as mergeArchitectureObservations,er as parseVibe64DeploymentLines,
|
|
932
|
+
Rs as parseVibe64IntegrationSetupLines,He as parseVibe64OutputsLines,Fn as parseVibe64PackagingLines,ls as parseVibe64ProjectServicesLines,
|
|
933
|
+
ks as parseVibe64ResourceEstimatesLines,yo as parseVibe64StagingDataLines,Xe as parseVibe64WorkspaceSetupLines,di as readArchitecturePreviewLocator,
|
|
934
|
+
_u as refreshGenesisCities,Fu as renderGenesisPrompt,Dr as resolveVibe64OutputParameters,qn as resolveVibe64PackagingEnvironment,
|
|
935
|
+
ju as setGenesisCollaboration,Mu as setGenesisEngineeringProfile,eu as sourceExplanationGuidance,bu as syncGenesisAgentIntegrations,
|
|
936
|
+
Eu as syncGenesisSkills,tu as validateArchitectureFacts,iu as validateCallWeb,su as validateCityDocument,Nu as verifyGenesisProject,
|
|
937
|
+
Tu as vibe64ConversationInstructions,le as vibe64Driver,uu as vibe64HostContextEnvironment,Lo as vibe64HostContextRegistry,
|
|
938
|
+
ma as vibe64HostContextResolverPath,Nt as vibe64StagingDataInspection,du as withGenesisCommandShim,Lt as withinGenesisDeadline};
|