vibe64 0.1.35 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/bin/run.js +1919 -1660
  2. package/bin/server.js +158 -111
  3. package/bin/upgrade-state.js +5783 -5605
  4. package/dist/assets/GithubBrowserTabs-BzJF4k9Y.js +1 -0
  5. package/dist/assets/{StudioErrorNotice-sQfmeR-z.js → StudioErrorNotice-BdllGqRy.js} +1 -1
  6. package/dist/assets/{Vibe64AsyncModuleState-Dx7YKRPp.js → Vibe64AsyncModuleState-Bi0TqlIu.js} +1 -1
  7. package/dist/assets/Vibe64AuthSettingsButton-BuvmwGiT.js +5 -0
  8. package/dist/assets/Vibe64AuthSettingsButton-M44SSmZ9.css +1 -0
  9. package/dist/assets/{Vibe64DashboardBackButton-yE6cyYg2.js → Vibe64DashboardBackButton-Ccd4hpD6.js} +1 -1
  10. package/dist/assets/Vibe64DashboardShell-D67m4aWz.js +1 -0
  11. package/dist/assets/{Vibe64DashboardShell-MBkUHjs-.css → Vibe64DashboardShell-De2mbdpI.css} +1 -1
  12. package/dist/assets/{Vibe64DatabaseWorkspace-BONJdxBS.js → Vibe64DatabaseWorkspace-D3uK1gDm.js} +3 -3
  13. package/dist/assets/{Vibe64DatabaseWorkspace-CR4pzzcf.css → Vibe64DatabaseWorkspace-DPDMxhAW.css} +1 -1
  14. package/dist/assets/Vibe64OutputControls-BfESn5kJ.js +8 -0
  15. package/dist/assets/Vibe64OutputControls-D2CCECo5.css +1 -0
  16. package/dist/assets/{Vibe64RepositoryWorkspace-ByQlZbyO.js → Vibe64RepositoryWorkspace-0jAxvdA8.js} +2 -2
  17. package/dist/assets/{Vibe64RepositoryWorkspace-CVHcT93M.css → Vibe64RepositoryWorkspace-Agyt4O-V.css} +1 -1
  18. package/dist/assets/Vibe64SessionFiles-B3ONZrBL.css +1 -0
  19. package/dist/assets/Vibe64SessionFiles-BCOJ4QmR.js +41 -0
  20. package/dist/assets/{Vibe64TemporaryAiFixAction-BGlcrq4d.js → Vibe64TemporaryAiFixAction-DM2jpPbQ.js} +1 -1
  21. package/dist/assets/{Vibe64UiStoryboardView-Brlwdvqi.js → Vibe64UiStoryboardView-DP5af46a.js} +1 -1
  22. package/dist/assets/{Vibe64UnavailableSessions-zwlWlcZD.js → Vibe64UnavailableSessions-C7XwH1SS.js} +1 -1
  23. package/dist/assets/{_sessionId_-CvOkQbVy.js → _sessionId_-B1Ymr7c_.js} +1 -1
  24. package/dist/assets/{_sessionTool_-Dwod5ns9.js → _sessionTool_-DVYdREoI.js} +1 -1
  25. package/dist/assets/_slug_-CQseA9pt.css +1 -0
  26. package/dist/assets/_slug_-CYO2vjCd.js +24 -0
  27. package/dist/assets/{access-BVu5XYm2.js → access-Cb7dkN53.js} +1 -1
  28. package/dist/assets/app-BvgY7oVf.js +1 -0
  29. package/dist/assets/app-CZu7oxUO.css +1 -0
  30. package/dist/assets/{assistantRouting-CwbwfkwB.js → assistantRouting-B38ujQ7x.js} +1 -1
  31. package/dist/assets/{changes-olY8cnFK.js → changes-lsBcuikn.js} +1 -1
  32. package/dist/assets/client-CRI5CNKl.js +2 -0
  33. package/dist/assets/client-TGaWwOhc.css +1 -0
  34. package/dist/assets/conversation-CDEt9jBx.js +17 -0
  35. package/dist/assets/conversation-vxJGwmtW.css +1 -0
  36. package/dist/assets/{dashboard-BnXD-H4R.js → dashboard-D8HOAw46.js} +1 -1
  37. package/dist/assets/definitions-DLTX17nI.js +1 -0
  38. package/dist/assets/{env-DJhnLOH7.css → env-BzRtyO0w.css} +1 -1
  39. package/dist/assets/env-DJezQixO.js +1 -0
  40. package/dist/assets/health-BJvooRnJ.css +1 -0
  41. package/dist/assets/health-CtKdN_Nf.js +1 -0
  42. package/dist/assets/{history-BxlpB-YH.js → history-BdZFOtz4.js} +1 -1
  43. package/dist/assets/{incoming-BOxRVlOM.js → incoming-VsQNnL9m.js} +1 -1
  44. package/dist/assets/index-C-osVUKw.css +1 -0
  45. package/dist/assets/index-C4K3ntms.js +138 -0
  46. package/dist/assets/{integrations-BFltGDVI.js → integrations-CMQ9EDmt.js} +2 -2
  47. package/dist/assets/issues-DHpY5hSr.js +1 -0
  48. package/dist/assets/learning-DXlMuwzh.js +1 -0
  49. package/dist/assets/mdi-yXT-CQ6u.js +1 -0
  50. package/dist/assets/placement-NpX2s7u8.js +1 -0
  51. package/dist/assets/pull-requests-BcKNEUYH.js +1 -0
  52. package/dist/assets/{repository-JWLVST3D.js → repository-ClEgntHW.js} +1 -1
  53. package/dist/assets/roboto-latin-wght-normal-ccAYIvAh.woff2 +0 -0
  54. package/dist/assets/{session-C5Nj8Dlq.js → session-BlD46q-d.js} +1 -1
  55. package/dist/assets/settings-BwukeIKe.js +1 -0
  56. package/dist/assets/shared-BM2SV6fi.js +2 -0
  57. package/dist/assets/studioGateApi-DcCqiD9V.js +1 -0
  58. package/dist/assets/studioUrls-DmMMIScP.js +1 -0
  59. package/dist/assets/useArchivedVibe64Sessions-D5zUA-BC.js +1 -0
  60. package/dist/assets/useCommand-Bqxb-naz.js +1 -0
  61. package/dist/assets/useEndpointResource-DWoQ2keu.js +1 -0
  62. package/dist/assets/useRealtimeEvent-Bwapstla.js +1 -0
  63. package/dist/assets/{useUiFeedback-0FqKuZRP.js → useUiFeedback-BPBF_0bp.js} +1 -1
  64. package/dist/assets/useVibe64ConversationLog-Dy6YTPQn.js +1 -0
  65. package/dist/assets/useVibe64DatabaseTools-d6L09ugW.js +1 -0
  66. package/dist/assets/useVibe64Learning-cNKTv64W.js +1 -0
  67. package/dist/assets/useVibe64ProjectScope-Bp1ImZlz.js +1 -0
  68. package/dist/assets/useVibe64SessionData-C_jqncih.js +1 -0
  69. package/dist/assets/useVibe64SessionSelection-uCEIWd3b.js +1 -0
  70. package/dist/assets/useVibe64SystemGraph-B4RmsC9Y.js +1 -0
  71. package/dist/assets/{useVibe64Terminal-BPnN25WH.js → useVibe64Terminal-BbghGR4x.js} +1 -1
  72. package/dist/assets/vibe64AssistantHost-BL1bnKm8.js +1 -0
  73. package/dist/assets/{vibe64SessionFocus-kqPOPaOH.js → vibe64SessionFocus-DSJKVuRN.js} +1 -1
  74. package/dist/assets/{vibe64SessionInfo-BHxtTrLX.js → vibe64SessionInfo-B_r1OMN0.js} +1 -1
  75. package/dist/assets/{vibe64SessionPanelModel-BMf64fv7.js → vibe64SessionPanelModel-DDorOuiL.js} +1 -1
  76. package/dist/assets/{vibe64SessionToolDefinitions-NfLd1HZI.js → vibe64SessionToolDefinitions-BualCK_5.js} +1 -1
  77. package/dist/index.html +21 -20
  78. package/docs/colleague-usage/account-profile-and-appearance.md +8 -2
  79. package/docs/colleague-usage/ai-accounts-and-routing.md +123 -15
  80. package/docs/colleague-usage/ai-onboarding.md +230 -0
  81. package/docs/colleague-usage/coding-agent-goal-pause.md +5 -5
  82. package/docs/colleague-usage/coding-agents.md +17 -0
  83. package/docs/colleague-usage/colleague-watches.md +4 -23
  84. package/docs/colleague-usage/colleague.md +10 -2
  85. package/docs/colleague-usage/connected-projects.md +2 -2
  86. package/docs/colleague-usage/conversation-context.md +2 -0
  87. package/docs/colleague-usage/dashboard-navigation.md +19 -27
  88. package/docs/colleague-usage/database.md +6 -11
  89. package/docs/colleague-usage/development-copies.md +2 -1
  90. package/docs/colleague-usage/development-env.md +6 -0
  91. package/docs/colleague-usage/github-work.md +9 -0
  92. package/docs/colleague-usage/health-checks.md +11 -5
  93. package/docs/colleague-usage/integrations.md +3 -1
  94. package/docs/colleague-usage/learning-code-questions.md +23 -51
  95. package/docs/colleague-usage/learning-course-catalogue.md +8 -6
  96. package/docs/colleague-usage/learning-environment.md +345 -0
  97. package/docs/colleague-usage/learning-history.md +70 -101
  98. package/docs/colleague-usage/learning-mode-ui.md +122 -214
  99. package/docs/colleague-usage/learning-practice-projects.md +168 -78
  100. package/docs/colleague-usage/learning-teacher-guide.md +48 -26
  101. package/docs/colleague-usage/learning-with-colleague.md +171 -216
  102. package/docs/colleague-usage/lesson-authoring.md +32 -24
  103. package/docs/colleague-usage/managed-app-access.md +7 -0
  104. package/docs/colleague-usage/message-delivery-recovery.md +7 -6
  105. package/docs/colleague-usage/preview-browser-checks.md +9 -1
  106. package/docs/colleague-usage/preview-starting-application.md +0 -1
  107. package/docs/colleague-usage/preview.md +9 -1
  108. package/docs/colleague-usage/project-messages.md +2 -2
  109. package/docs/colleague-usage/project-setup.md +9 -2
  110. package/docs/colleague-usage/running-vibe64-on-your-computer.md +61 -0
  111. package/docs/colleague-usage/sessions.md +25 -33
  112. package/docs/colleague-usage/teaching-content.md +11 -40
  113. package/docs/colleague-usage/temporary-chats.md +23 -2
  114. package/docs/colleague-usage/voice-chat.md +5 -10
  115. package/docs/colleague-usage/voice-face-and-speaking-voice.md +6 -8
  116. package/docs/colleague-usage/voice-recovery.md +3 -2
  117. package/docs/templates/learn-topic/README.md +6 -6
  118. package/docs/templates/learn-topic/training/lessons/TOPIC-01/lesson.json +28 -7
  119. package/docs/templates/learn-topic/training/lessons/TOPIC-01/notes.md +19 -0
  120. package/docs/templates/learn-topic/training/lessons/TOPIC-01/steps/check-understanding.md +3 -0
  121. package/docs/templates/learn-topic/training/lessons/TOPIC-01/steps/explain-idea.md +3 -0
  122. package/docs/templates/learn-topic/training/lessons/TOPIC-01/steps/try-it.md +3 -0
  123. package/docs/templates/learn-topic/training/outline.md +1 -1
  124. package/docs/training-content.md +179 -65
  125. package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
  126. package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
  127. package/node_modules/@jskit-ai/assistant-runtime/patterns/assistant-surface/PATTERN.md +3 -2
  128. package/node_modules/@jskit-ai/assistant-runtime/patterns/assistant-surface/example/integrations.json +3 -2
  129. package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
  130. package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
  131. package/node_modules/@jskit-ai/connectors-catalog/patterns/ai-connections/PATTERN.md +4 -3
  132. package/node_modules/@jskit-ai/connectors-catalog/src/shared/ai-models.json +0 -1
  133. package/node_modules/@local/vibe64-accounts/package.json +1 -0
  134. package/node_modules/@local/vibe64-colleague/package.json +2 -1
  135. package/node_modules/@local/vibe64-core/package.json +3 -0
  136. package/node_modules/@local/vibe64-execution/package.json +1 -0
  137. package/node_modules/@local/vibe64-execution/src/host/execHelper.js +171 -174
  138. package/node_modules/@local/vibe64-execution/src/server/engines/stdioBridge.js +9 -9
  139. package/node_modules/@local/vibe64-genesis/README.md +10 -37
  140. package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +790 -779
  141. package/node_modules/@local/vibe64-genesis/package.json +1 -0
  142. package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +255 -0
  143. package/node_modules/@local/vibe64-genesis/src/server/index.js +473 -450
  144. package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +148 -148
  145. package/node_modules/@local/vibe64-project/package.json +2 -1
  146. package/node_modules/@local/vibe64-runtime/package.json +1 -2
  147. package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +526 -512
  148. package/node_modules/@local/vibe64-runtime/src/shared/assistantRoutingScores.json +0 -1
  149. package/node_modules/@local/vibe64-source-editor/package.json +1 -0
  150. package/node_modules/@local/vibe64-terminals/package.json +1 -0
  151. package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +129 -131
  152. package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1508 -1456
  153. package/node_modules/@local/vibe64-training/package.json +13 -27
  154. package/package.json +7 -7
  155. package/server.bundle.mjs +40946 -41456
  156. package/dist/assets/GithubBrowserTabs-DO5PHon-.js +0 -1
  157. package/dist/assets/GithubMarkdown-BQ6MfCDJ.js +0 -3
  158. package/dist/assets/GithubMarkdown-U7-j-qNI.css +0 -1
  159. package/dist/assets/Vibe64DashboardShell-CuCVMhOc.js +0 -1
  160. package/dist/assets/Vibe64OutputControls-DAAmA09l.js +0 -8
  161. package/dist/assets/Vibe64OutputControls-DPBsyDZM.css +0 -1
  162. package/dist/assets/Vibe64SessionFiles-B0u9HKdF.js +0 -107
  163. package/dist/assets/Vibe64SessionFiles-NjOMVwPR.css +0 -1
  164. package/dist/assets/_slug_-B31c15cc.css +0 -1
  165. package/dist/assets/_slug_-Dy35qLo1.js +0 -1
  166. package/dist/assets/app-DRXCcv05.css +0 -1
  167. package/dist/assets/app-zt7HwQKT.js +0 -1
  168. package/dist/assets/client-BrV4QPwG.js +0 -2
  169. package/dist/assets/client-C1bwIlu6.css +0 -1
  170. package/dist/assets/definitions-DaOPIkyB.js +0 -1
  171. package/dist/assets/env-DN0vW4EI.js +0 -1
  172. package/dist/assets/health-7oIQODer.css +0 -1
  173. package/dist/assets/health-Z6m96GDr.js +0 -1
  174. package/dist/assets/index-BUq-MczL.js +0 -86
  175. package/dist/assets/index-DtmBqE3h.css +0 -1
  176. package/dist/assets/issues-1iS5zoed.js +0 -1
  177. package/dist/assets/layout-BkWVNT37.js +0 -1
  178. package/dist/assets/mdi-C54lQ0i_.js +0 -1
  179. package/dist/assets/placement-DLsU3pCW.js +0 -1
  180. package/dist/assets/pull-requests-BJOwNL4k.js +0 -1
  181. package/dist/assets/settings-c273Ikrm.js +0 -1
  182. package/dist/assets/shared-YZb7ocaK.js +0 -2
  183. package/dist/assets/studioGateApi-DhA9IJGZ.js +0 -1
  184. package/dist/assets/studioUrls-Dj8rXeXO.js +0 -1
  185. package/dist/assets/useArchivedVibe64Sessions-CVZx2Rtm.js +0 -1
  186. package/dist/assets/useCommand-DWuxfAV0.js +0 -1
  187. package/dist/assets/useEndpointResource-MWVNfmMa.js +0 -1
  188. package/dist/assets/useVibe64ConversationLog-8cKh1eDm.js +0 -1
  189. package/dist/assets/useVibe64DatabaseTools-BcRG1s3i.js +0 -1
  190. package/dist/assets/useVibe64LearningMode-Bl0dGdCh.js +0 -28
  191. package/dist/assets/useVibe64LearningMode-C3PcXdVg.css +0 -1
  192. package/dist/assets/useVibe64ProjectScope-DOEVkBqX.js +0 -1
  193. package/dist/assets/useVibe64SessionData-DFTyLzci.js +0 -1
  194. package/dist/assets/useVibe64SessionSelection-j9lsllx4.js +0 -1
  195. package/dist/assets/useVibe64SystemGraph-tNkIwSBQ.js +0 -1
  196. package/dist/assets/vibe64AssistantHost-DdE_-lZF.js +0 -1
  197. package/dist/assets/vibe64LessonDashboard-DlKYjisq.js +0 -1
  198. package/dist/assets/vibe64ProjectScope.local-DqT6e5un.js +0 -1
  199. package/docs/colleague-usage/learning-chat-retention.md +0 -74
  200. package/docs/colleague-usage/learning-diagrams-and-voice.md +0 -97
  201. package/docs/colleague-usage/learning-lesson-watch.md +0 -95
  202. package/docs/colleague-usage/learning-native-session.md +0 -206
  203. package/docs/colleague-usage/learning-practical-exercises.md +0 -71
  204. package/docs/colleague-usage/learning-practical-gestures.md +0 -48
  205. package/docs/colleague-usage/learning-session-creation.md +0 -95
  206. package/docs/colleague-usage/lesson-practical-assessment.md +0 -54
  207. package/docs/colleague-usage/preview-lesson-presentation.md +0 -56
  208. package/docs/templates/learn-topic/training/lessons/TOPIC-01/lesson.md +0 -44
@@ -1,101 +1,109 @@
1
1
  import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
2
- import{createHash as ft}from"node:crypto";import ae from"node:path";var ee=class extends Error{constructor(t,n,s=void 0){
3
- super(n),this.name="Vibe64StackOperationError",this.code=t,s!==void 0&&(this.details=s)}};function p(e,t,n,s,r={}){throw new ee(
4
- e,n,{path:t,...s===void 0?{}:{line:s},...r})}function O(e,t,n,s,r){return(typeof e!="string"||!e.trim()||/[\0\r\n]/u.test(
5
- e))&&p(t,n,`${s} must be one non-empty line.`,r),e.trim()}function ht(e){let t=[...String(e||"").matchAll(/`([^`\r\n]+)`/gu)];
6
- return t.length===0||t.map(n=>n[0]).join(" ")!==e?null:t.map(n=>n[1])}function C(e,t,n,s,r,{count:i,maximum:o=64}={}){let c=ht(
7
- e);if(!c||c.length>o||i!==void 0&&c.length!==i||c.some(u=>u.length>4096||/[\0\r\n]/u.test(u))){let u=i===void 0?"separat\
8
- e non-empty":`exactly ${i}`;p(t,n,`${s} must contain ${u} backticked ${i===1?"value":"values"}.`,r)}return c}function gt(e=""){
9
- return typeof e=="string"&&!!e&&!/[\s\0{}]/u.test(e)&&!ae.isAbsolute(e)&&!e.split(/[\\/]/u).includes("..")}function _(e,t,n,s,r){
10
- let i=C(e,t,n,s,r);return gt(i[0])||p(t,n,`${s} must begin with a safe executable.`,r),i}function yt(e=""){return typeof e==
11
- "string"&&!!e&&!/[\0\r\n\\]/u.test(e)&&!ae.posix.isAbsolute(e)&&ae.posix.normalize(e)===e&&!e.split("/").some(t=>!t||t===
12
- "..")}function g(e,t,n,s,r,{allowRoot:i=!0}={}){return(!yt(e)||!i&&e===".")&&p(t,n,`${s} must be a canonical project-rel\
13
- ative path.`,r),e}function R(e,t,n,s,r){let i=C(e,t,n,s,r);return i.some(o=>!/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(o))&&p(t,
14
- n,`${s} must use lowercase technology ids separated into backticked values.`,r),new Set(i).size!==i.length&&p(t,n,`${s} \
15
- contains a duplicate technology id.`,r),i}function ue(e,t,n,s,r){let i=O(e,t,n,s,r);return(!i.startsWith("/")||i.startsWith(
16
- "//")||/[\\?#]/u.test(i))&&p(t,n,`${s} must begin with one slash and contain no query or fragment.`,r),i}function te(e,t,n,s,r){
17
- let i=e.match(/^- Ready when: `GET` `([^`\r\n]+)` returns `([0-9]{3})`$/u);i||p(t,n,`${s} must use \`- Ready when: \`GET\` \
18
- \`/path\` returns \`200\`\`.`,r);let o=Number(i[2]);return(!Number.isInteger(o)||o<200||o>399)&&p(t,n,`${s} status must \
19
- be from 200 through 399.`,r),{kind:"http",method:"GET",path:ue(i[1],t,n,`${s} path`,r),status:o}}function ce(e){return Array.
20
- isArray(e)?e.map(ce):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,ce(e[t])])):e}function T(e){
21
- let t=`${JSON.stringify(ce(e),null,2)}
22
- `;return`sha256:${ft("sha256").update(t).digest("hex")}`}function G(e={},t={},n="operation"){if(e.stackHash!==t.stackHash)
23
- throw new ee("VIBE64_STACK_CHANGED",`The Stack changed while Vibe64 inspected its ${n}. Retry the operation.`)}function B(e=[]){
24
- return[...new Set(e)].sort()}function b(e=[]){let t=e.map(n=>n.trim()).filter(Boolean);return t.length===1&&t[0]==="- No\
25
- thing."}import{access as bt}from"node:fs/promises";import Se from"node:path";var Te="vibe64.workspace-setup.v1",X="Workspace setup",K="VIBE64_WORKSPACE_SETUP_INVALID",wt=/^- Prepare `([^`\r\n]+)` with (.+?):[ \t]+(.+)$/u,
26
- Et=/^(.*?)[ \t]+when `([^`\r\n]+)` exists$/u,vt=/^(.*?)[ \t]+if `([^`\r\n]+)` exists$/u,St=/^(.*?)[ \t]+in `([^`\r\n]+)`$/u;
27
- function pe(e,t,n,s={}){p(K,e,t,n,s)}function F(e,{path:t="genesis/stack.md#Workspace setup"}={}){if(Array.isArray(e)||pe(
28
- t,"Workspace setup must be supplied as exact Stack section lines."),b(e))return[];let n=[];for(let s=0;s<e.length;s+=1){
29
- let r=e[s].trim();if(!r)continue;let i=s+1,o=r.match(wt);o||pe(t,"Every Workspace setup entry must use: - Prepare `label\
30
- ` with `runtime` [in `workdir`] [when|if `path` exists]: `command` `argument`...",i,{observed:r});let c=o[2].match(Et),u=c?
31
- null:o[2].match(vt),a=c?c[1]:u?u[1]:o[2],m=c?.[2]||u?.[2]||"",l=a.match(St),d=l?l[1]:a,h=l?l[2]:".";n.push({label:O(o[1],
32
- K,t,"Workspace setup step label",i),argv:_(o[3],K,t,"Workspace setup command",i),runtimeRequirements:R(d,K,t,"Workspace \
33
- setup runtimes",i),workdir:g(h,K,t,"Workspace setup workdir",i),...m?{condition:{pathExists:g(m,K,t,"Workspace setup con\
34
- dition path",i,{allowRoot:!1}),onMissing:c?"wait":"skip"}}:{}})}return n.length===0&&pe(t,"## Workspace setup needs at l\
35
- east one Prepare entry or exactly `- Nothing.`."),n}async function Tt(e,t){try{return await bt(Se.join(e,t)),!0}catch(n){
36
- if(["ENOENT","ENOTDIR"].includes(n?.code))return!1;throw n}}async function Ie({projectRoot:e,section:t={}}={}){let n=[...t.
37
- diagnostics||[]],s=[];t.status==="ready"&&(s=F(t.lines));let r=[],i=[],o=Se.resolve(e);if(n.length===0)for(let d of s){if(!d.
38
- condition||await Tt(o,d.condition.pathExists)){r.push(d);continue}d.condition.onMissing==="wait"&&i.push(d.condition.pathExists)}
39
- if(i.length>0){let d=B(i);n.push({code:"VIBE64_WORKSPACE_SETUP_WAITING",message:`Workspace setup is waiting for project ${d.
40
- length===1?"path":"paths"}: ${d.join(", ")}.`,details:{paths:d}})}let c=n.some(({code:d})=>d==="VIBE64_WORKSPACE_SETUP_W\
41
- AITING"),u=n.some(({code:d})=>d!=="VIBE64_WORKSPACE_SETUP_WAITING"),a="unconfigured";u?a="blocked":!c&&r.length>0&&(a="r\
42
- eady");let m=r.map(({condition:d,...h})=>h),l={version:1,steps:m};return{contract:Te,status:a,stackHash:t.stackHash,recipeHash:a===
43
- "ready"?T(l):"",components:[...t.components||[]],source:t.source||null,runtimeRequirements:B(m.flatMap(d=>d.runtimeRequirements)),
44
- steps:m,diagnostics:n}}var It="custom",kt=Object.freeze([Object.freeze({value:"npm",label:"npm (Node.js)"}),Object.freeze({value:"composer",label:"\
45
- Composer (PHP)"}),Object.freeze({value:"pip",label:"pip (Python)"}),Object.freeze({value:"bundler",label:"Bundler (Ruby)"}),
46
- Object.freeze({value:"gomod",label:"Go modules"}),Object.freeze({value:"cargo",label:"Cargo (Rust)"}),Object.freeze({value:"\
47
- maven",label:"Maven"}),Object.freeze({value:"gradle",label:"Gradle"}),Object.freeze({value:"nuget",label:"NuGet (.NET)"}),
48
- Object.freeze({value:It,label:"custom"})]),ke=Object.freeze(kt.map(e=>e.value));function Oe(e){return typeof e=="string"&&
49
- ke.includes(e)}function _e(e="or"){let t=ke;return`${t.slice(0,-1).join(", ")} ${e} ${t.at(-1)}`}var Re="Connected development",Ot="vibe64.connected-development.v1",D="VIBE64_CONNECTED_DEVELOPMENT_INVALID",N="genesis/\
50
- stack.md#Connected development";function Ae(e={}){let t="",n="",s=null,r=[],i=[...e.diagnostics||[]],o=e.status==="ready";
51
- if(o&&!b(e.lines)){let u=!1;for(let[m,l]of e.lines.entries()){let d=l.trim();if(!d)continue;let h=m+1,y=d.match(/^- Default package type: `([^`\r\n]*)`$/u);
52
- if(y){n&&p(D,N,"Declare exactly one default package type.",h),Oe(y[1])||p(D,N,`Default package type must be ${_e()}.`,h),
53
- n=y[1];continue}let q=d.match(/^- Sources file: `([^`\r\n]+)`$/u);if(q){t&&p(D,N,"Declare exactly one Sources file.",h),
54
- t=g(q[1],D,N,"Connected sources file",h,{allowRoot:!1}),t.split("/").some($=>$.toLowerCase()===".git")&&p(D,N,"The Sourc\
55
- es file must be outside Git metadata.",h);continue}let k=d.startsWith("- Custom runner "),J=d.match(/^- (Prepare|Verify) /u);
56
- !k&&!J&&p(D,N,"Declare a Sources file and Prepare/Verify entries using the Workspace setup command grammar.",h);let z=J?.[1]===
57
- "Verify"?"verify":"prepare";!k&&u&&z==="prepare"&&p(D,N,"All Prepare entries must precede Verify entries.",h),u||=!k&&z===
58
- "verify";let Z;try{let $=k?d.replace("- Custom runner ","- Prepare `Custom connected source` "):d.replace(/^- Verify /u,
59
- "- Prepare ");[Z]=F([$],{path:N})}catch($){if($.code!=="VIBE64_WORKSPACE_SETUP_INVALID")throw $;p(D,N,$.message,h)}Z.condition&&
60
- p(D,N,"Connected development steps must run unconditionally; a skipped step cannot prove source consumption.",h),k?(s&&p(
61
- D,N,"Declare exactly one Custom runner.",h),s=Z):r.push({...Z,phase:z})}!(n&&!t&&!r.length&&!s)&&(!t||!r.some(m=>m.phase===
62
- "verify")&&!s)&&p(D,N,"Declare a default package type alone, or a Sources file with Verify entries or a Custom runner; u\
63
- se `- Nothing.` for no declaration.")}let c=e.status==="blocked"||i.length?"blocked":r.length||s?"ready":"unconfigured";
64
- return{contract:Ot,declared:o,status:c,stackHash:e.stackHash,recipeHash:c==="ready"?T({version:1,sourcesFile:t,defaultPackageType:n,
65
- customRunner:s,steps:r}):"",components:[...e.components||[]],source:e.source||null,sourcesFile:t,defaultPackageType:n,customRunner:s,
66
- steps:r,runtimeRequirements:B([...r,...s?[s]:[]].flatMap(u=>u.runtimeRequirements)),diagnostics:i}}var Ce="Architecture inspection",E="VIBE64_ARCHITECTURE_INSPECTION_INVALID";function _t(e,{path:t="genesis/stack.md#Arch\
67
- itecture inspection"}={}){if(Array.isArray(e)||p(E,t,"Architecture inspection requires exact Stack section lines."),b(e))
68
- return[];let n=[],s=new Set,r;function i(){if(r){for(let o of["runtimeRequirements","workdir","argv","timeout","maxBuffe\
69
- r"])r[o]===void 0&&p(E,t,`${r.id} is missing ${o}.`);n.push(r),r=null}}for(let[o,c]of e.entries()){let u=c.trim();if(!u)
70
- continue;let a=u.match(/^### Inspector `([a-z0-9]+(?:-[a-z0-9]+)*)`: (.+)$/u);if(a){i(),s.has(a[1])&&p(E,t,"Duplicate in\
71
- spector id.",o+1),s.add(a[1]),r={id:a[1],title:a[2]};continue}r||p(E,t,"Expected an Inspector heading.",o+1);let m=u.match(
72
- /^- (Runtime|Directory|Command|Timeout seconds|Max output bytes|Entry files|Required files): (.+)$/u);m||p(E,t,"Unknown \
73
- architecture inspector field.",o+1);let l={Runtime:"runtimeRequirements",Directory:"workdir",Command:"argv","Timeout sec\
74
- onds":"timeout","Max output bytes":"maxBuffer","Entry files":"entryFiles","Required files":"requiredFiles"}[m[1]];if(r[l]!==
75
- void 0&&p(E,t,`Duplicate ${m[1]}.`,o+1),l==="runtimeRequirements")r[l]=R(m[2],E,t,"Inspector runtime",o+1);else if(l==="\
76
- argv")r[l]=_(m[2],E,t,"Inspector command",o+1);else if(l==="entryFiles"||l==="requiredFiles")r[l]=C(m[2],E,t,m[1],o+1).map(
77
- d=>g(d,E,t,m[1],o+1));else{let[d]=C(m[2],E,t,m[1],o+1,{count:1});if(l==="workdir")r[l]=g(d,E,t,"Inspector directory",o+1);else{
78
- let h=Number(d),y=l==="timeout"?60:4*1024*1024;(!/^[1-9][0-9]*$/u.test(d)||!Number.isSafeInteger(h)||h>y)&&p(E,t,`${m[1]}\
79
- must be from 1 to ${y}.`,o+1),r[l]=l==="timeout"?h*1e3:h}}}return i(),n.length||p(E,t,"Use an Inspector entry or - Noth\
80
- ing."),n}function Ne(e){let t=e.status==="ready"?_t(e.lines):[];for(let n of t)n.runtimeRequirements.some(s=>!e.components.
81
- includes(s))&&p(E,"genesis/stack.md#Architecture inspection","Inspector runtimes must be selected in Stack.");return{contract:"\
82
- vibe64.architecture-inspection.v1",status:e.status,stackHash:e.stackHash,inspectors:t,recipeHash:T(t),diagnostics:e.diagnostics||
83
- []}}var De="Architecture layout";function Rt(e,{path:t="genesis/stack.md#Architecture layout"}={}){let n="VIBE64_ARCHITECTUR\
84
- E_LAYOUT_INVALID";if(Array.isArray(e)||p(n,t,"Expected exact Stack section lines."),b(e))return[];let s=[],r=new Set,i=new Set,
85
- o;function c(){o&&((!o.kind||!o.purpose||!o.subsystems.length)&&p(n,t,`${o.id} needs Kind, Purpose and at least one Subs\
86
- ystem.`),s.push(o))}for(let[u,a]of e.entries()){let m=a.trim();if(!m)continue;let l=m.match(/^### Group `([a-z0-9]+(?:-[a-z0-9]+)*)`: (.+)$/u);
87
- if(l){c(),r.has(l[1])&&p(n,t,"Duplicate group id.",u+1),r.add(l[1]),o={id:l[1],title:l[2],subsystems:[]};continue}let d=m.
88
- match(/^- (Kind|Purpose|Subsystem): (.+)$/u);(!o||!d)&&p(n,t,"Expected a Group heading or Kind, Purpose, Subsystem field\
89
- .",u+1);let h=C(d[2],n,t,d[1],u+1,{count:1});if(d[1]==="Subsystem"){let y=g(h[0],n,t,"Subsystem root",u+1);i.has(y)&&p(n,
90
- t,"Each directory root may be placed only once.",u+1),i.add(y),o.subsystems.push({root:y})}else{let y=d[1].toLowerCase();
91
- o[y]!==void 0&&p(n,t,`Duplicate ${d[1]}.`,u+1),y==="kind"&&!["layer","libraries","support"].includes(h[0])&&p(n,t,"Kind \
92
- must be layer, libraries or support.",u+1),o[y]=h[0]}}return c(),s.length||p(n,t,"Use a Group entry or - Nothing."),s}function xe(e){
93
- return{contract:"vibe64.architecture-layout.v1",status:e.status,stackHash:e.stackHash,groups:e.status==="ready"?Rt(e.lines):
94
- [],diagnostics:e.diagnostics||[]}}import{existsSync as ct}from"node:fs";import{readFile as Rn}from"node:fs/promises";import{createRequire as An}from"node:module";
95
- import j from"node:path";var Ve="STACK_PROJECT_CONTRACTS_INCOMPLETE",Pe="STACK_SECTION_AMBIGUOUS",At=Object.freeze([Ve,Pe]);function Ct(e){return At.
96
- includes(String(e?.code||"").trim())}import*as we from"genesis-compiler";import{mkdir as $t,mkdtemp as Gt,readFile as Lt,rename as Ut,rm as Wt,writeFile as Ht}from"node:fs/promises";import qt from"node:os";
97
- import de from"node:path";var Nt=Object.freeze(["main","temporary"]),je=Object.freeze(["managedDatabaseRefresh","managedEnvironment","managedGit",
98
- "managedPreview"]),Dt=64*1024,xt=Object.freeze(["When user input is necessary, ask no more than three concise, high-impa\
2
+ import{createHash as Nt}from"node:crypto";import de from"node:path";var ne=class extends Error{constructor(t,n,s=void 0){
3
+ super(n),this.name="Vibe64StackOperationError",this.code=t,s!==void 0&&(this.details=s)}},Ct=Object.freeze({VIBE64_WORKSPACE_SETUP_INVALID:"\
4
+ workspace-setup",VIBE64_OUTPUTS_INVALID:"outputs",VIBE64_DEPLOYMENT_INVALID:"deployment",VIBE64_RESOURCE_ESTIMATES_INVALID:"\
5
+ resource-estimates",VIBE64_CONNECTED_DEVELOPMENT_INVALID:"connected-development",VIBE64_PROJECT_SERVICES_INVALID:"projec\
6
+ t-services",VIBE64_INTEGRATION_SETUP_INVALID:"integration-setup",VIBE64_ARCHITECTURE_INSPECTION_INVALID:"architecture-in\
7
+ spection",VIBE64_ARCHITECTURE_LAYOUT_INVALID:"architecture-layout"}),Dt=/ Exact grammar: vibe64-helper spec [a-z-]+\.$/u;
8
+ function Vt(e,t){let n=Ct[e],s=String(t).replace(Dt,"");return n?`${s} Exact grammar: vibe64-helper spec ${n}.`:s}function P(e,t,n){
9
+ return`Unknown ${e}: ${t}. Use one of: ${n.join("; ")}.`}function l(e,t,n,s,r={}){throw new ne(e,Vt(e,n),{path:t,...s===
10
+ void 0?{}:{line:s},...r})}function R(e,t,n,s,r){return(typeof e!="string"||!e.trim()||/[\0\r\n]/u.test(e))&&l(t,n,`${s} \
11
+ must be one non-empty line.`,r),e.trim()}function xt(e){let t=[...String(e||"").matchAll(/`([^`\r\n]+)`/gu)];return t.length===
12
+ 0||t.map(n=>n[0]).join(" ")!==e?null:t.map(n=>n[1])}function N(e,t,n,s,r,{count:i,maximum:o=64}={}){let c=xt(e);if(!c||c.
13
+ length>o||i!==void 0&&c.length!==i||c.some(u=>u.length>4096||/[\0\r\n]/u.test(u))){let u=i===void 0?"separate non-empty":
14
+ `exactly ${i}`;l(t,n,`${s} must contain ${u} backticked ${i===1?"value":"values"}.`,r)}return c}function Pt(e=""){return typeof e==
15
+ "string"&&!!e&&!/[\s\0{}]/u.test(e)&&!de.isAbsolute(e)&&!e.split(/[\\/]/u).includes("..")}function k(e,t,n,s,r){let i=N(
16
+ e,t,n,s,r);return Pt(i[0])||l(t,n,`${s} must begin with a safe executable.`,r),i}function $t(e=""){return typeof e=="str\
17
+ ing"&&!!e&&!/[\0\r\n\\]/u.test(e)&&!de.posix.isAbsolute(e)&&de.posix.normalize(e)===e&&!e.split("/").some(t=>!t||t==="..")}
18
+ function g(e,t,n,s,r,{allowRoot:i=!0}={}){return(!$t(e)||!i&&e===".")&&l(t,n,`${s} must be a canonical project-relative \
19
+ path.`,r),e}function A(e,t,n,s,r){let i=N(e,t,n,s,r);return i.some(o=>!/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(o))&&l(t,n,`${s}\
20
+ must use lowercase technology ids separated into backticked values.`,r),new Set(i).size!==i.length&&l(t,n,`${s} contain\
21
+ s a duplicate technology id.`,r),i}function fe(e,t,n,s,r){let i=R(e,t,n,s,r);return(!i.startsWith("/")||i.startsWith("//")||
22
+ /[\\?#]/u.test(i))&&l(t,n,`${s} must begin with one slash and contain no query or fragment.`,r),i}function se(e,t,n,s,r){
23
+ let i=e.match(/^- Ready when: `GET` `([^`\r\n]+)` returns `([0-9]{3})`$/u);i||l(t,n,`${s} must use \`- Ready when: \`GET\` \
24
+ \`/path\` returns \`200\`\`.`,r);let o=Number(i[2]);return(!Number.isInteger(o)||o<200||o>399)&&l(t,n,`${s} status must \
25
+ be from 200 through 399.`,r),{kind:"http",method:"GET",path:fe(i[1],t,n,`${s} path`,r),status:o}}function me(e){return Array.
26
+ isArray(e)?e.map(me):e&&typeof e=="object"?Object.fromEntries(Object.keys(e).sort().map(t=>[t,me(e[t])])):e}function I(e){
27
+ let t=`${JSON.stringify(me(e),null,2)}
28
+ `;return`sha256:${Nt("sha256").update(t).digest("hex")}`}function B(e={},t={},n="operation"){if(e.stackHash!==t.stackHash)
29
+ throw new ne("VIBE64_STACK_CHANGED",`The Stack changed while Vibe64 inspected its ${n}. Retry the operation.`)}function j(e=[]){
30
+ return[...new Set(e)].sort()}function y(e=[]){let t=e.map(n=>n.trim()).filter(Boolean);return t.length===1&&t[0]==="- No\
31
+ thing."}import{access as Mt}from"node:fs/promises";import Ve from"node:path";var xe="vibe64.workspace-setup.v1",Q="Workspace setup",F="VIBE64_WORKSPACE_SETUP_INVALID",jt="- Prepare `label` with `ru\
32
+ ntime` [in `workdir`] [when|if `path` exists]: `command` `argument`...",Lt=/^- Prepare `([^`\r\n]+)` with (.+?):[ \t]+(.+)$/u,
33
+ Ut=/^(.*?)[ \t]+when `([^`\r\n]+)` exists$/u,Bt=/^(.*?)[ \t]+if `([^`\r\n]+)` exists$/u,Gt=/^(.*?)[ \t]+in `([^`\r\n]+)`$/u;
34
+ function he(e,t,n,s={}){l(F,e,t,n,s)}function Y(e,{path:t="genesis/stack.md#Workspace setup"}={}){if(Array.isArray(e)||he(
35
+ t,"Workspace setup must be supplied as exact Stack section lines."),y(e))return[];let n=[];for(let s=0;s<e.length;s+=1){
36
+ let r=e[s].trim();if(!r)continue;let i=s+1,o=r.match(Lt);o||he(t,`Every Workspace setup entry must use: ${jt}`,i,{observed:r});
37
+ let c=o[2].match(Ut),u=c?null:o[2].match(Bt),a=c?c[1]:u?u[1]:o[2],m=c?.[2]||u?.[2]||"",d=a.match(Gt),p=d?d[1]:a,h=d?d[2]:
38
+ ".";n.push({label:R(o[1],F,t,"Workspace setup step label",i),argv:k(o[3],F,t,"Workspace setup command",i),runtimeRequirements:A(
39
+ p,F,t,"Workspace setup runtimes",i),workdir:g(h,F,t,"Workspace setup workdir",i),...m?{condition:{pathExists:g(m,F,t,"Wo\
40
+ rkspace setup condition path",i,{allowRoot:!1}),onMissing:c?"wait":"skip"}}:{}})}return n.length===0&&he(t,"## Workspace\
41
+ setup needs at least one Prepare entry or exactly `- Nothing.`."),n}async function Wt(e,t){try{return await Mt(Ve.join(
42
+ e,t)),!0}catch(n){if(["ENOENT","ENOTDIR"].includes(n?.code))return!1;throw n}}async function Pe({projectRoot:e,section:t={}}={}){
43
+ let n=[...t.diagnostics||[]],s=[];t.status==="ready"&&(s=Y(t.lines));let r=[],i=[],o=Ve.resolve(e);if(n.length===0)for(let p of s){
44
+ if(!p.condition||await Wt(o,p.condition.pathExists)){r.push(p);continue}p.condition.onMissing==="wait"&&i.push(p.condition.
45
+ pathExists)}if(i.length>0){let p=j(i);n.push({code:"VIBE64_WORKSPACE_SETUP_WAITING",message:`Workspace setup is waiting \
46
+ for project ${p.length===1?"path":"paths"}: ${p.join(", ")}.`,details:{paths:p}})}let c=n.some(({code:p})=>p==="VIBE64_W\
47
+ ORKSPACE_SETUP_WAITING"),u=n.some(({code:p})=>p!=="VIBE64_WORKSPACE_SETUP_WAITING"),a="unconfigured";u?a="blocked":!c&&r.
48
+ length>0&&(a="ready");let m=r.map(({condition:p,...h})=>h),d={version:1,steps:m};return{contract:xe,status:a,stackHash:t.
49
+ stackHash,recipeHash:a==="ready"?I(d):"",components:[...t.components||[]],source:t.source||null,runtimeRequirements:j(m.
50
+ flatMap(p=>p.runtimeRequirements)),steps:m,diagnostics:n}}var Ht="custom";var qt=Object.freeze([Object.freeze({value:"npm",label:"npm (Node.js)"}),Object.freeze({value:"composer",label:"Composer\
51
+ (PHP)"}),Object.freeze({value:"pip",label:"pip (Python)"}),Object.freeze({value:"bundler",label:"Bundler (Ruby)"}),Object.
52
+ freeze({value:"gomod",label:"Go modules"}),Object.freeze({value:"cargo",label:"Cargo (Rust)"}),Object.freeze({value:"mav\
53
+ en",label:"Maven"}),Object.freeze({value:"gradle",label:"Gradle"}),Object.freeze({value:"nuget",label:"NuGet (.NET)"}),Object.
54
+ freeze({value:Ht,label:"custom"})]);var $e=Object.freeze(qt.map(e=>e.value));function Me(e){return typeof e=="string"&&$e.includes(e)}function je(e="or"){let t=$e;return`${t.slice(0,-1).join(", ")} ${e} ${t.at(-1)}`}var Le="Connected development",zt="vibe64.connected-development.v1",D="VIBE64_CONNECTED_DEVELOPMENT_INVALID",C="genesis/\
55
+ stack.md#Connected development",ge="with `runtime` [in `workdir`]: `command` `argument`...",Kt=Object.freeze(["- Default\
56
+ package type: `type`","- Sources file: `path`",`- Prepare \`label\` ${ge}`,`- Verify \`label\` ${ge}`,`- Custom runner ${ge}`]);
57
+ function Ue(e={}){let t="",n="",s=null,r=[],i=[...e.diagnostics||[]],o=e.status==="ready";if(o&&!y(e.lines)){let u=!1;for(let[
58
+ m,d]of e.lines.entries()){let p=d.trim();if(!p)continue;let h=m+1,E=p.match(/^- Default package type: `([^`\r\n]*)`$/u);
59
+ if(E){n&&l(D,C,"Declare exactly one default package type.",h),Me(E[1])||l(D,C,`Default package type must be ${je()}.`,h),
60
+ n=E[1];continue}let z=p.match(/^- Sources file: `([^`\r\n]+)`$/u);if(z){t&&l(D,C,"Declare exactly one Sources file.",h),
61
+ t=g(z[1],D,C,"Connected sources file",h,{allowRoot:!1}),t.split("/").some(U=>U.toLowerCase()===".git")&&l(D,C,"The Sourc\
62
+ es file must be outside Git metadata.",h);continue}let w=p.startsWith("- Custom runner "),X=p.match(/^- (Prepare|Verify) /u);
63
+ !w&&!X&&l(D,C,P("Connected development entry",p,Kt),h);let K=X?.[1]==="Verify"?"verify":"prepare";!w&&u&&K==="prepare"&&
64
+ l(D,C,"All Prepare entries must precede Verify entries.",h),u||=!w&&K==="verify";let te;try{let U=w?p.replace("- Custom \
65
+ runner ","- Prepare `Custom connected source` "):p.replace(/^- Verify /u,"- Prepare ");[te]=Y([U],{path:C})}catch(U){if(U.
66
+ code!=="VIBE64_WORKSPACE_SETUP_INVALID")throw U;l(D,C,U.message,h)}te.condition&&l(D,C,"Connected development steps must\
67
+ run unconditionally; a skipped step cannot prove source consumption.",h),w?(s&&l(D,C,"Declare exactly one Custom runner\
68
+ .",h),s=te):r.push({...te,phase:K})}!(n&&!t&&!r.length&&!s)&&(!t||!r.some(m=>m.phase==="verify")&&!s)&&l(D,C,"Declare a \
69
+ default package type alone, or a Sources file with Verify entries or a Custom runner; use `- Nothing.` for no declaratio\
70
+ n.")}let c=e.status==="blocked"||i.length?"blocked":r.length||s?"ready":"unconfigured";return{contract:zt,declared:o,status:c,
71
+ stackHash:e.stackHash,recipeHash:c==="ready"?I({version:1,sourcesFile:t,defaultPackageType:n,customRunner:s,steps:r}):"",
72
+ components:[...e.components||[]],source:e.source||null,sourcesFile:t,defaultPackageType:n,customRunner:s,steps:r,runtimeRequirements:j(
73
+ [...r,...s?[s]:[]].flatMap(u=>u.runtimeRequirements)),diagnostics:i}}var Be="Architecture inspection",v="VIBE64_ARCHITECTURE_INSPECTION_INVALID",Ee=Object.freeze({Runtime:["runtimeRequireme\
74
+ nts","`runtime`..."],Directory:["workdir","`path`"],Command:["argv","`command` `argument`..."],"Timeout seconds":["timeo\
75
+ ut","`1` through `60`"],"Max output bytes":["maxBuffer",`\`1\` through \`${4*1024*1024}\``],"Entry files":["entryFiles",
76
+ "`path`... (optional)"],"Required files":["requiredFiles","`path`... (optional)"]}),Ft=new RegExp(`^- (${Object.keys(Ee).
77
+ join("|")}): (.+)$`,"u");function Yt(e,{path:t="genesis/stack.md#Architecture inspection"}={}){if(Array.isArray(e)||l(v,
78
+ t,"Architecture inspection requires exact Stack section lines."),y(e))return[];let n=[],s=new Set,r;function i(){if(r){for(let o of[
79
+ "runtimeRequirements","workdir","argv","timeout","maxBuffer"])r[o]===void 0&&l(v,t,`${r.id} is missing ${o}.`);n.push(r),
80
+ r=null}}for(let[o,c]of e.entries()){let u=c.trim();if(!u)continue;let a=u.match(/^### Inspector `([a-z0-9]+(?:-[a-z0-9]+)*)`: (.+)$/u);
81
+ if(a){i(),s.has(a[1])&&l(v,t,"Duplicate inspector id.",o+1),s.add(a[1]),r={id:a[1],title:a[2]};continue}r||l(v,t,"Expect\
82
+ ed an Inspector heading.",o+1);let m=u.match(Ft);m||l(v,t,`Unknown architecture inspector field. Use one of: ${Object.entries(
83
+ Ee).map(([p,[,h]])=>`- ${p}: ${h}`).join("; ")}.`,o+1);let[d]=Ee[m[1]];if(r[d]!==void 0&&l(v,t,`Duplicate ${m[1]}.`,o+1),
84
+ d==="runtimeRequirements")r[d]=A(m[2],v,t,"Inspector runtime",o+1);else if(d==="argv")r[d]=k(m[2],v,t,"Inspector command",
85
+ o+1);else if(d==="entryFiles"||d==="requiredFiles")r[d]=N(m[2],v,t,m[1],o+1).map(p=>g(p,v,t,m[1],o+1));else{let[p]=N(m[2],
86
+ v,t,m[1],o+1,{count:1});if(d==="workdir")r[d]=g(p,v,t,"Inspector directory",o+1);else{let h=Number(p),E=d==="timeout"?60:
87
+ 4*1024*1024;(!/^[1-9][0-9]*$/u.test(p)||!Number.isSafeInteger(h)||h>E)&&l(v,t,`${m[1]} must be from 1 to ${E}.`,o+1),r[d]=
88
+ d==="timeout"?h*1e3:h}}}return i(),n.length||l(v,t,"Use an Inspector entry or - Nothing."),n}function Ge(e){let t=e.status===
89
+ "ready"?Yt(e.lines):[];for(let n of t)n.runtimeRequirements.some(s=>!e.components.includes(s))&&l(v,"genesis/stack.md#Ar\
90
+ chitecture inspection","Inspector runtimes must be selected in Stack.");return{contract:"vibe64.architecture-inspection.\
91
+ v1",status:e.status,stackHash:e.stackHash,inspectors:t,recipeHash:I(t),diagnostics:e.diagnostics||[]}}var We="Architecture layout",ye=Object.freeze(["layer","libraries","support"]);function Jt(e,{path:t="genesis/stack.md#A\
92
+ rchitecture layout"}={}){let n="VIBE64_ARCHITECTURE_LAYOUT_INVALID";if(Array.isArray(e)||l(n,t,"Expected exact Stack sec\
93
+ tion lines."),y(e))return[];let s=[],r=new Set,i=new Set,o;function c(){o&&((!o.kind||!o.purpose||!o.subsystems.length)&&
94
+ l(n,t,`${o.id} needs Kind, Purpose and at least one Subsystem.`),s.push(o))}for(let[u,a]of e.entries()){let m=a.trim();if(!m)
95
+ continue;let d=m.match(/^### Group `([a-z0-9]+(?:-[a-z0-9]+)*)`: (.+)$/u);if(d){c(),r.has(d[1])&&l(n,t,"Duplicate group \
96
+ id.",u+1),r.add(d[1]),o={id:d[1],title:d[2],subsystems:[]};continue}let p=m.match(/^- (Kind|Purpose|Subsystem): (.+)$/u);
97
+ (!o||!p)&&l(n,t,"Expected a Group heading or Kind, Purpose, Subsystem field.",u+1);let h=N(p[2],n,t,p[1],u+1,{count:1});
98
+ if(p[1]==="Subsystem"){let E=g(h[0],n,t,"Subsystem root",u+1);i.has(E)&&l(n,t,"Each directory root may be placed only on\
99
+ ce.",u+1),i.add(E),o.subsystems.push({root:E})}else{let E=p[1].toLowerCase();o[E]!==void 0&&l(n,t,`Duplicate ${p[1]}.`,u+
100
+ 1),E==="kind"&&!ye.includes(h[0])&&l(n,t,`Kind must be ${ye.slice(0,-1).join(", ")} or ${ye.at(-1)}.`,u+1),o[E]=h[0]}}return c(),
101
+ s.length||l(n,t,"Use a Group entry or - Nothing."),s}function He(e){return{contract:"vibe64.architecture-layout.v1",status:e.
102
+ status,stackHash:e.stackHash,groups:e.status==="ready"?Jt(e.lines):[],diagnostics:e.diagnostics||[]}}import{existsSync as It}from"node:fs";import{readFile as Yn}from"node:fs/promises";import{createRequire as Jn}from"node:module";
103
+ import M from"node:path";var qe="STACK_PROJECT_CONTRACTS_INCOMPLETE",ze="STACK_SECTION_AMBIGUOUS",Xt=Object.freeze([qe,ze]);function Qt(e){return Xt.
104
+ includes(String(e?.code||"").trim())}import*as Ne from"genesis-compiler";import{mkdir as cn,mkdtemp as un,readFile as pn,rename as ln,rm as dn,writeFile as mn}from"node:fs/promises";import fn from"node:os";
105
+ import we from"node:path";var Zt=Object.freeze(["main","temporary"]),Ke=Object.freeze(["managedDatabaseRefresh","managedEnvironment","managedGit",
106
+ "managedPreview"]),en=64*1024,tn=Object.freeze(["When user input is necessary, ask no more than three concise, high-impa\
99
107
  ct questions at once.","Put multiple questions on separate lines as `[1] Question`, `[2] Question`, and so on.","For a s\
100
108
  mall fixed set of useful choices, put `Possible answers:` and a short bullet list directly beneath its own question, bef\
101
109
  ore the next one; never collect several questions' answers into one trailing list.","Each bullet is one distinct, comple\
@@ -108,86 +116,86 @@ Possible answers:
108
116
  [2] Tell the main agent before changes?
109
117
  Possible answers:
110
118
  - Yes, tell main first
111
- - No, proceed independently`]),Vt=Object.freeze(["The Vibe64-managed preview is the canonical application server; never \
119
+ - No, proceed independently`]),nn=Object.freeze(["The Vibe64-managed preview is the canonical application server; never \
112
120
  start a duplicate or replacement server. If it is unavailable, report that blocker. Describe only rendered browser evide\
113
121
  nce.","When adopting an authenticated app, or when its login blocks Preview inspection, inspect identity support/names w\
114
122
  ith `vibe64-helper preview status`; prefer `vibe64-helper preview browser identity <configured-name>` to requesting pass\
115
123
  words. If unconfigured, ask which existing accounts (email/login/user ID) represent admin and other required roles, and \
116
124
  the default. Reuse prior answers; wait for their choices before configuring access. Never infer admin rights from names \
117
- or the Vibe64 viewer.","Offer the application-owned `vibe64.preview-identity.command.v1` adapter in Outputs Preview iden\
118
- tity, and guide named selectors through Dashboard > App access > Managed app access. Use existing sessions/permissions, \
119
- reject missing/disabled accounts, and disable the adapter without Vibe64\u2019s per-run enable flag and secret. Do not create\
120
- users, change roles, reset passwords or weaken production auth for import. Verify the selected account\u2019s actual Preview\
121
- access; a saved selector is insufficient. If deferred/declined, explain access remains unconfigured and continue indepe\
122
- ndent setup work without repeated credential requests. Public/non-web apps need no adapter.","Use `vibe64-helper preview\
123
- status`, `screenshot`, `logs`, and `browser eval` (Playwright code on stdin) for rendered inspection.","The top Preview\
124
- toolbar Stop and `vibe64-helper preview stop` stop this session's application and managed browser, not chat or source. \
125
- Status reports the saved stopped choice. A status read, screenshot, browser inspection, source edit or session reopening\
126
- is not permission to restart it; use `vibe64-helper preview ensure --wait` only for a deliberate Start. Scoped browser \
127
- tests restore the prior stopped choice.","For interactive navigation, use the proxy URL from `vibe64-helper preview insp\
128
- ect-url` or status `currentPage.url` / `endpoints.browser.url`. Inside browser eval, use `await page.goto(new URL('/your\
129
- -path', preview.url).href)`. The direct application endpoint under diagnostics bypasses Preview identity and is not a br\
130
- owser-navigation URL.","Use the managed preview browser for interactive browsing and `vibe64-helper playwright` only for\
131
- an existing configured project suite; report a platform or project-test blocker rather than installing another browser \
132
- or changing its dependencies.","For browser evidence, batch related actions and assertions, return only needed values an\
133
- d inspect relevant locators or regions; screenshot at meaningful visual checkpoints or failures, not after every click. \
134
- Reuse the managed browser when test isolation permits. Preserve required viewport, identity and security checks; use exi\
135
- sting automated cases for repeat verification.","For browser tests that write or reset data, inspect `vibe64-helper prev\
136
- iew targets --json` and the project's `genesis/stack.md` Outputs. Run `vibe64-helper playwright --target <declared-test-\
137
- target> test <suite arguments>` or `vibe64-helper playwright --target <declared-test-target> npm-run <script>`. Vibe64 s\
138
- tarts that web target, waits for readiness, uses its declared application identity, and restores the previous Preview wh\
139
- en the command finishes or is cancelled; report restoration failures.","A target name is not proof of test isolation. Be\
140
- fore running a destructive suite, the application must verify the server's actual test database and suppress real email,\
141
- invoices, payments, and other external effects. Keep managed Env unchanged. The test launcher and its preview-identity \
142
- command must use the same database. Use a declared BROWSER_TEST_DB_NAME for reusable browser fixtures, separate from dis\
143
- posable TEST_DB_NAME. Never spoof safety checks by changing DB_NAME only in the test runner.","If no suitable test targe\
144
- t exists, add one through the project's existing Outputs contract and application-owned test scripts within authorized s\
145
- cope, keeping normal Preview as default. Validate the exact disposable database before resetting it, prepare fixtures be\
146
- fore reporting readiness, and make Playwright use PLAYWRIGHT_BASE_URL without starting another server. If the required t\
147
- est resources or external-effect controls are missing, report that specific blocker. Use `vibe64-helper preview ensure -\
148
- -target <id> --wait --json` only to deliberately select an interactive target; it stays selected until changed.","Keep r\
149
- outine browser startup incremental: reuse the isolated test schema, apply only pending migrations, and reset fixture dat\
150
- a deterministically. Do not drop and rebuild the database or run a production frontend build for every focused browser c\
151
- heck. Keep fresh-schema migration checks separate. If startup is slow, measure migrations, fixtures, and server startup \
152
- before retrying or extending deadlines.","Keep test output small: run relevant files/cases, save stdout/stderr to local \
153
- artifacts and preserve exit status. Report counts, duration, failed cases, actionable errors and artifact paths. Read on\
154
- ly needed failure excerpts, not full passing/JSON/TAP/request/trace/image output. Retain startup, resource and Preview-r\
155
- estoration errors even if tests pass, and trailing wrapper diagnostics separately from JSON. Do not rerun for output or \
156
- reread unchanged logs; inspect on new output, changed state or a concrete blocker.","Batch related browser tests in one \
157
- managed suite (one Preview switch and restore). Suites and live Preview actions are sequential: no browser actions, ensu\
158
- re/restart or target changes during a suite or restoration. Wait on the original execution, including background runs, t\
159
- hrough cleanup/restoration (empty polls: yield_time_ms: 30000 where supported; shorter only for interactive input or an \
160
- immediate check); read-only status/logs stay available. Before live inspection, confirm `vibe64-helper playwright status\
161
- ` has no active run and `vibe64-helper preview status` is ready on the restored target. To stop, read suite status then \
162
- run `vibe64-helper playwright cancel <run-id>`, which waits for cleanup/restoration; retry it if cleanup needs attention\
163
- . Never kill individual test/Preview PIDs or change locks. Launcher exit alone does not prove tests stopped. Recheck cur\
164
- rent status before reporting a busy blocker.","If a managed command reports kernel task denials or a resource incident, \
165
- retain its diagnostic and incident ID when reporting the blocker. Ask the platform operator to inspect that resource evi\
166
- dence before retrying; do not increase test timeouts or weaken assertions to work around a process/thread limit. A gener\
167
- ic browser timeout without resource evidence does not establish a platform cause."]),Pt=Object.freeze(["Each managed she\
168
- ll command receives current development Env from Vibe64, including declared resource bindings; use them in ordinary comm\
169
- ands. Do not build environment injection or copy managed credentials into source. Resource provisioning and application \
170
- migrations remain separate preparation steps.","Use `vibe64-helper env status [development|production|all]` to inspect c\
171
- onfigured key names without revealing values.","Pipe an available value to `vibe64-helper env set <development|productio\
172
- n> <KEY> [--secret]`; never put values in arguments, logs, or repository files. Use empty stdin only when the user reque\
173
- sted an empty value.","Keep development and production values separate. Never invent credentials, copy a value between s\
174
- copes without explicit direction, or edit Vibe64 runtime/session storage.","After an Env mutation, report only the affec\
175
- ted scope and key names, never their values, and claim success only when the command succeeded.","When declared, TEST_DB\
176
- _NAME is the exact disposable integration database and BROWSER_TEST_DB_NAME is a separate reusable browser-fixture datab\
177
- ase whose migration ledger survives routine runs. Follow the application\u2019s declared test resources; never reset DB_NAME,\
178
- share these test identities, or invent a database name."]);function Be(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError(`${t} must be an object.`);return e}function le(e,t,n){
125
+ or the Vibe64 viewer.","Offer an application-owned adapter declared in the Outputs `#### Preview identity` block (`vibe6\
126
+ 4-helper spec outputs` and `vibe64-helper spec preview-identity-command`), and save the named selectors the person gives\
127
+ or confirms with `vibe64-helper preview identities save` (`vibe64-helper spec preview-identities`); you may propose the\
128
+ m from existing app accounts, then verify each with `vibe64-helper preview browser identity <name>`. Use existing sessio\
129
+ ns/permissions, reject missing/disabled accounts, and disable the adapter without Vibe64\u2019s per-run enable flag and secre\
130
+ t. Do not create users, change roles, reset passwords or weaken production auth for import. Verify the selected account\u2019\
131
+ s actual Preview access; a saved selector is insufficient. If deferred/declined, explain access remains unconfigured and\
132
+ continue independent setup work without repeated credential requests. Public/non-web apps need no adapter.","Use `vibe6\
133
+ 4-helper preview status`, `screenshot`, `logs`, and `browser eval` (Playwright code on stdin) for rendered inspection.",
134
+ "The top Preview toolbar Stop and `vibe64-helper preview stop` stop this session's application and managed browser, not \
135
+ chat or source. Status reports the saved stopped choice. A status read, screenshot, browser inspection, source edit or s\
136
+ ession reopening is not permission to restart it; use `vibe64-helper preview ensure --wait` only for a deliberate Start.\
137
+ Scoped browser tests restore the prior stopped choice.","For interactive navigation, use the proxy URL from `vibe64-hel\
138
+ per preview inspect-url` or status `currentPage.url` / `endpoints.browser.url`. Inside browser eval, use `await page.got\
139
+ o(new URL('/your-path', preview.url).href)`. The direct application endpoint under diagnostics bypasses Preview identity\
140
+ and is not a browser-navigation URL.","Use the managed preview browser for interactive browsing and `vibe64-helper play\
141
+ wright` only for an existing configured project suite; report a platform or project-test blocker rather than installing \
142
+ another browser or changing its dependencies.","For browser evidence, batch related actions and assertions, return only \
143
+ needed values and inspect relevant locators or regions; screenshot at meaningful visual checkpoints or failures, not aft\
144
+ er every click. Reuse the managed browser when test isolation permits. Preserve required viewport, identity and security\
145
+ checks; use existing automated cases for repeat verification.","For browser tests that write or reset data, inspect `vi\
146
+ be64-helper preview targets --json` and the project's `genesis/stack.md` Outputs. Run `vibe64-helper playwright --target\
147
+ <declared-test-target> test <suite arguments>` or `vibe64-helper playwright --target <declared-test-target> npm-run <sc\
148
+ ript>`. Vibe64 starts that web target, waits for readiness, uses its declared application identity, and restores the pre\
149
+ vious Preview when the command finishes or is cancelled; report restoration failures.","A target name is not proof of te\
150
+ st isolation. Before running a destructive suite, the application must verify the server's actual test database and supp\
151
+ ress real email, invoices, payments, and other external effects. Keep managed Env unchanged. The test launcher and its p\
152
+ review-identity command must use the same database. Follow the application's declared test resources and never invent a \
153
+ database name. Never spoof safety checks by changing only the test runner's environment.","If no suitable test target ex\
154
+ ists, add one through the project's existing Outputs contract and application-owned test scripts within authorized scope\
155
+ , keeping normal Preview as default. Validate the exact disposable database before resetting it, prepare fixtures before\
156
+ reporting readiness, and make Playwright use the started target's URL, which Vibe64 supplies as PLAYWRIGHT_BASE_URL, wi\
157
+ thout starting another server. If the required test resources or external-effect controls are missing, report that speci\
158
+ fic blocker. Use `vibe64-helper preview ensure --target <id> --wait --json` only to deliberately select an interactive t\
159
+ arget; it stays selected until changed. If browser startup is slow, measure migrations, fixtures and server startup befo\
160
+ re retrying or extending deadlines.","Keep test output small: run relevant files/cases, save stdout/stderr to local arti\
161
+ facts and preserve exit status. Report counts, duration, failed cases, actionable errors and artifact paths. Read only n\
162
+ eeded failure excerpts, not full passing/JSON/TAP/request/trace/image output. Retain startup, resource and Preview-resto\
163
+ ration errors even if tests pass, and trailing wrapper diagnostics separately from JSON. Do not rerun for output or rere\
164
+ ad unchanged logs; inspect on new output, changed state or a concrete blocker.","Batch related browser tests in one mana\
165
+ ged suite (one Preview switch and restore). Suites and live Preview actions are sequential: no browser actions, ensure/r\
166
+ estart or target changes during a suite or restoration. Wait on the original execution, including background runs, throu\
167
+ gh cleanup/restoration (empty polls: yield_time_ms: 30000 where supported; shorter only for interactive input or an imme\
168
+ diate check); read-only status/logs stay available. Before live inspection, confirm `vibe64-helper playwright status` ha\
169
+ s no active run and `vibe64-helper preview status` is ready on the restored target. To stop, read suite status then run \
170
+ `vibe64-helper playwright cancel <run-id>`, which waits for cleanup/restoration; retry it if cleanup needs attention. Ne\
171
+ ver kill individual test/Preview PIDs or change locks. Launcher exit alone does not prove tests stopped. Recheck current\
172
+ status before reporting a busy blocker.","If a managed command reports kernel task denials or a resource incident, reta\
173
+ in its diagnostic and incident ID when reporting the blocker. Ask the platform operator to inspect that resource evidenc\
174
+ e before retrying; do not increase test timeouts or weaken assertions to work around a process/thread limit. A generic b\
175
+ rowser timeout without resource evidence does not establish a platform cause."]),sn=Object.freeze(["Each managed shell c\
176
+ ommand receives current development Env from Vibe64, including declared resource bindings; use them in ordinary commands\
177
+ . Do not build environment injection or copy managed credentials into source. Resource provisioning and application migr\
178
+ ations remain separate preparation steps.","Use `vibe64-helper env status [development|production|all]` to inspect confi\
179
+ gured key names without revealing values.","Pipe an available value to `vibe64-helper env set <development|production> <\
180
+ KEY> [--secret]`; never put values in arguments, logs, or repository files. Use empty stdin only when the user requested\
181
+ an empty value.","Keep development and production values separate. Never invent credentials, copy a value between scope\
182
+ s without explicit direction, or edit Vibe64 runtime/session storage.","After an Env mutation, report only the affected \
183
+ scope and key names, never their values, and claim success only when the command succeeded.","Store a secret the applica\
184
+ tion needs generated (such as an application key) by generating it with the framework's own generator and piping it to `\
185
+ vibe64-helper env set <scope> <KEY> --secret`. Never write it into a generated `.env` file: Vibe64 regenerates that file\
186
+ from Env."]);function Fe(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError(`${t} must be an object.`);return e}function be(e,t,n){
179
187
  let s=new Set(t),r=Object.keys(e).filter(i=>!s.has(i));if(r.length>0)throw new TypeError(`${n} contains unsupported fiel\
180
- ds: ${r.join(", ")}.`)}function Me(e){if(le(e,["conversationKind","scope","session","hostGuidance"],"Vibe64 session cont\
188
+ ds: ${r.join(", ")}.`)}function Ye(e){if(be(e,["conversationKind","scope","session","hostGuidance"],"Vibe64 session cont\
181
189
  ext"),e.hostGuidance!==void 0&&(typeof e.hostGuidance!="string"||Buffer.byteLength(e.hostGuidance,"utf8")>1024))throw new TypeError(
182
- "Vibe64 host guidance must be bounded text supplied by the host.");if(!Nt.includes(e.conversationKind))throw new TypeError(
183
- "Vibe64 session context has an unknown conversationKind.");let t=Be(e.session,"Vibe64 session capabilities");le(t,je,"Vi\
184
- be64 session capabilities");let n=Object.fromEntries(je.map(s=>{if(typeof t[s]!="boolean")throw new TypeError(`Vibe64 se\
190
+ "Vibe64 host guidance must be bounded text supplied by the host.");if(!Zt.includes(e.conversationKind))throw new TypeError(
191
+ "Vibe64 session context has an unknown conversationKind.");let t=Fe(e.session,"Vibe64 session capabilities");be(t,Ke,"Vi\
192
+ be64 session capabilities");let n=Object.fromEntries(Ke.map(s=>{if(typeof t[s]!="boolean")throw new TypeError(`Vibe64 se\
185
193
  ssion capability ${s} must be boolean.`);return[s,t[s]]}));return{conversationKind:e.conversationKind,scope:"session",...e.
186
- hostGuidance?{hostGuidance:e.hostGuidance}:{},session:n}}function jt(e){le(e,["scope","stableContext"],"Vibe64 ephemeral\
187
- context");let t=String(e.stableContext||"").trim();if(!t||t.length>Dt)throw new TypeError("Vibe64 ephemeral context req\
188
- uires bounded stableContext.");return{scope:"ephemeral",stableContext:t}}function Bt(e){if(e.scope==="session")return Me(
189
- e);if(e.scope==="ephemeral")return jt(e);throw new TypeError("The Vibe64 driver supports session and ephemeral scopes on\
190
- ly.")}function Mt(e){let{conversationKind:t,session:n,hostGuidance:s=""}=Me(e);return["VIBE64 CONVERSATION CONTEXT","",...t===
194
+ hostGuidance?{hostGuidance:e.hostGuidance}:{},session:n}}function rn(e){be(e,["scope","stableContext"],"Vibe64 ephemeral\
195
+ context");let t=String(e.stableContext||"").trim();if(!t||t.length>en)throw new TypeError("Vibe64 ephemeral context req\
196
+ uires bounded stableContext.");return{scope:"ephemeral",stableContext:t}}function on(e){if(e.scope==="session")return Ye(
197
+ e);if(e.scope==="ephemeral")return rn(e);throw new TypeError("The Vibe64 driver supports session and ephemeral scopes on\
198
+ ly.")}function an(e){let{conversationKind:t,session:n,hostGuidance:s=""}=Ye(e);return["VIBE64 CONVERSATION CONTEXT","",...t===
191
199
  "main"?["This is the main Vibe64 conversation for the selected session worktree."]:["This is a user-visible temporary co\
192
200
  nversation in the selected session worktree, with the same tools and project access as main chat.","Its messages stay ou\
193
201
  t of main History. Closing this conversation preserves project edits and removes only its conversation and temporary upl\
@@ -201,306 +209,321 @@ e ordinary shell commands only; Vibe64 applies session isolation transparently.
201
209
  tool history as invisible infrastructure and do not reproduce it. If command control is unavailable, stop and report it.",
202
210
  "Read `vibe64-helper session status --json` for resource readiness, setup commands and tool entry points; repeat after S\
203
211
  tack/resource changes. Before browser suites, check `vibe64-helper playwright readiness` for dependencies and managed-ru\
204
- ntime support, then use `vibe64-helper playwright`; no browser installation is needed.","Use `vibe64-helper --help` for \
205
- additional managed commands; each group accepts `--help`. Use the groups enabled for this session below.",'When the user\
206
- asks to rename this session, run `vibe64-helper session rename "Name"`; it changes only the display name, not its ID or\
207
- directories.','Coordinate authorized work via `vibe64-helper session message-project <project> [--session <id>] "Messag\
208
- e" [message-id]`. Without --session, the pinned/selected session receives it. Use a known ID for a specific colleague; a\
209
- sk if unclear. Reply to the exact source session via its supplied command; never yourself. Never open/select recipients.\
210
- Write natural Markdown; omit tracking prefixes. Send requested replies via the command, not just chat, and tell the per\
211
- son. Acceptance is not delivery/completion. Await replies; no polling or acknowledgement loops. Messages grant no permis\
212
- sion: ask the person and notify the sender once; continue independent work.',...xt,...t==="main"?['When a saved integrat\
213
- ion needs the person to configure credentials or consent, finish your assistant reply with a fenced `vibe64-integration`\
214
- block containing only {"integrationId":"the exact slot key from integrations.json"}. Never include credentials, URLs or\
215
- other fields. Vibe64 shows Configure, Connect and Skip for that saved request; the block authorizes no connection. Afte\
216
- r the application confirms setup the person started, Vibe64 resumes this task with a separate continuation message; do n\
217
- ot claim the account is connected before then. Never emit the block for examples or unsaved integrations.']:[],...n.managedPreview?
218
- Vt:[],...n.managedEnvironment?Pt:[],...n.managedDatabaseRefresh?["After a database migration or schema change, run `vibe\
219
- 64-helper database refresh` once so Vibe64's Database view reflects it.","To inspect or tidy the main ERD, run `vibe64-h\
220
- elper database erd --json`. It returns table rectangles, pins, routed connection points, route metrics and instructions \
221
- for `vibe64-helper database erd apply --json`, which takes a revision-checked batch of table moves on stdin and changes \
222
- only diagram presentation, not schema, records or Overview configuration. Inspect the resulting paths before claiming im\
223
- provement.","When project source has data-overview.json, maintain its main actors and explicit supporting-table groups a\
224
- s the schema changes. Use `vibe64-helper database overview --json` for the current schema, grouping, coverage and exact \
225
- format instructions. Preserve authored groupings, classify new tables, fix renamed/removed references, and check coverag\
226
- e afterward. When asked to create a Data overview, use the same command and relevant application source; no one-hop memb\
227
- ership rule applies. Never invent foreign keys or cardinalities."]:[],...n.managedGit?["Use the managed `git` and `gh` c\
228
- ommands on PATH. Do not bypass them with host binaries, a stripped PATH, or alternate credentials.","For GitHub-hosted a\
229
- ttachments and inline images in issues (tickets), pull requests or comments, always use authenticated managed `gh api` w\
230
- ith the original attachment URL. Save the response to a local file and inspect it before reporting what it contains. Do \
231
- not use unauthenticated curl/wget, User-Agent experiments, or extract credentials for a separate HTTP client. An unauthe\
232
- nticated 404 does not prove a private attachment is missing.","After changing GitHub issues, comments, labels or pull re\
233
- quests, run `vibe64-helper github refresh` once so Vibe64's Issues/PR view reflects it.","When linking an issue in this \
234
- project's repository, run `vibe64-helper github issue-link <number>` and use its returned Vibe64 path exactly as the pri\
235
- mary Markdown link destination, including the /app prefix. Root-relative or same-origin Vibe64 links navigate in-app wit\
236
- hout reloading. You may include the GitHub URL as a secondary link. Do not guess the project slug or host; issues in oth\
237
- er repositories keep their GitHub links.","Report authentication or transport failures directly; do not inspect credenti\
238
- als or invent another login path.","When a managed Git/GitHub command fails, tell the user which requested action failed\
239
- , which earlier work is confirmed complete, what remains undone or unconfirmed, and the next safe action. Retain the rep\
240
- orted failure stage, execution budget and execution reference when provided; do not expose credentials or dump raw outpu\
241
- t unnecessarily.","A timeout or transport failure does not establish invalid authentication, exhausted AI quota, a GitHu\
242
- b outage or a suspension problem. Separate recorded facts from hypotheses; say the cause is unknown when it is unproven.\
243
- Recommend reconnection only when the reported error explicitly calls for it.","If the diagnostic says commandSubmitted=\
244
- false, the requested Git/GitHub action was not attempted. After an execution timeout, lost response or unreadable respon\
245
- se, its effects remain unconfirmed: use a read-only check of the affected Git/GitHub state before repeating any write. N\
246
- ever claim that a comment was posted or not posted, or that a push succeeded or failed, solely from those errors. If ver\
247
- ification is unavailable, report the outcome as unknown and stop; do not repeat the write or claim it was safely rolled \
248
- back."]:[]].join(`
249
- `)}function Y(e={}){let t=Be(e,"Vibe64 driver input"),n=Bt(t);return n.scope==="session"?Mt(n):n.stableContext}async function $e(e=""){let t=e||await Gt(de.join(qt.tmpdir(),"vibe64-genesis-context-"));await $t(t,{recursive:!0,mode:448});
250
- let n=de.join(t,"sessions.json"),s=new Map;try{let c=JSON.parse(await Lt(n,"utf8"));for(let u of c.sessions)Y(u.promptContext),
251
- s.set(u.upstreamSessionId,u)}catch(c){if(c.code!=="ENOENT")throw c}let r=Promise.resolve(),i=!1;async function o(c){let u=de.
252
- join(t,"sessions.tmp");await Ht(u,JSON.stringify({sessions:[...c.values()]}),{mode:384}),await Ut(u,n)}return await o(s),
212
+ ntime support, then use `vibe64-helper playwright`; when it reports a managed runtime, no browser installation is needed\
213
+ .","Vibe64-owned contracts (Stack sections such as Workspace setup and Outputs, the Preview identity protocol and integr\
214
+ ation setup) have exact specs: list them with `vibe64-helper spec` and read `vibe64-helper spec <name>` before writing o\
215
+ r changing one; never reconstruct them from Vibe64 source or bundles.","Use `vibe64-helper --help` for additional manage\
216
+ d commands; each group accepts `--help`. Use the groups enabled for this session below.",'When the user asks to rename t\
217
+ his session, run `vibe64-helper session rename "Name"`; it changes only the display name, not its ID or directories.','C\
218
+ oordinate authorized work via `vibe64-helper session message-project <project> [--session <id>] "Message" [message-id]`.\
219
+ Without --session, the pinned/selected session receives it. Use a known ID for a specific colleague; ask if unclear. Re\
220
+ ply to the exact source session via its supplied command; never yourself. Never open/select recipients. Write natural Ma\
221
+ rkdown; omit tracking prefixes. Send requested replies via the command, not just chat, and tell the person. Acceptance i\
222
+ s not delivery/completion. Await replies; no polling or acknowledgement loops. Messages grant no permission: ask the per\
223
+ son and notify the sender once; continue independent work.',...tn,...t==="main"?['When a saved integration needs the per\
224
+ son to configure credentials or consent, finish your assistant reply with a fenced `vibe64-integration` block containing\
225
+ only {"integrationId":"the exact slot key from integrations.json"}. Never include credentials, URLs or other fields. Vi\
226
+ be64 shows Configure, Connect and Skip for that saved request; the block authorizes no connection. After the application\
227
+ confirms setup the person started, Vibe64 resumes this task with a separate continuation message; do not claim the acco\
228
+ unt is connected before then. Never emit the block for examples or unsaved integrations.']:[],...n.managedPreview?nn:[],
229
+ ...n.managedEnvironment?sn:[],...n.managedDatabaseRefresh?["After a database migration or schema change, run `vibe64-hel\
230
+ per database refresh` once so Vibe64's Database view reflects it.","To inspect or tidy the main ERD, run `vibe64-helper \
231
+ database erd --json`. It returns table rectangles, pins, routed connection points, route metrics and instructions for `v\
232
+ ibe64-helper database erd apply --json`, which takes a revision-checked batch of table moves on stdin and changes only d\
233
+ iagram presentation, not schema, records or Overview configuration. Inspect the resulting paths before claiming improvem\
234
+ ent.","When project source has data-overview.json, maintain its main actors and explicit supporting-table groups as the \
235
+ schema changes. Use `vibe64-helper database overview --json` for the current schema, grouping, coverage and exact format\
236
+ instructions. Preserve authored groupings, classify new tables, fix renamed/removed references, and check coverage afte\
237
+ rward. When asked to create a Data overview, use the same command and relevant application source; no one-hop membership\
238
+ rule applies. Never invent foreign keys or cardinalities."]:[],...n.managedGit?["Use the managed `git` and `gh` command\
239
+ s on PATH. Do not bypass them with host binaries, a stripped PATH, or alternate credentials.","For GitHub-hosted attachm\
240
+ ents and inline images in issues (tickets), pull requests or comments, always use authenticated managed `gh api` with th\
241
+ e original attachment URL. Save the response to a local file and inspect it before reporting what it contains. Do not us\
242
+ e unauthenticated curl/wget, User-Agent experiments, or extract credentials for a separate HTTP client. An unauthenticat\
243
+ ed 404 does not prove a private attachment is missing.","After changing GitHub issues, comments, labels or pull requests\
244
+ , run `vibe64-helper github refresh` once so Vibe64's Issues/PR view reflects it.","When linking an issue in this projec\
245
+ t's repository, run `vibe64-helper github issue-link <number>` and use its returned Vibe64 path exactly as the primary M\
246
+ arkdown link destination, including the /app prefix. Root-relative or same-origin Vibe64 links navigate in-app without r\
247
+ eloading. You may include the GitHub URL as a secondary link. Do not guess the project slug or host; issues in other rep\
248
+ ositories keep their GitHub links.","Report authentication or transport failures directly; do not inspect credentials or\
249
+ invent another login path.","When a managed Git/GitHub command fails, tell the user which requested action failed, whic\
250
+ h earlier work is confirmed complete, what remains undone or unconfirmed, and the next safe action. Retain the reported \
251
+ failure stage, execution budget and execution reference when provided; do not expose credentials or dump raw output unne\
252
+ cessarily.","A timeout or transport failure does not establish invalid authentication, exhausted AI quota, a GitHub outa\
253
+ ge or a suspension problem. Separate recorded facts from hypotheses; say the cause is unknown when it is unproven. Recom\
254
+ mend reconnection only when the reported error explicitly calls for it.","If the diagnostic says commandSubmitted=false,\
255
+ the requested Git/GitHub action was not attempted. After an execution timeout, lost response or unreadable response, it\
256
+ s effects remain unconfirmed: use a read-only check of the affected Git/GitHub state before repeating any write. Never c\
257
+ laim that a comment was posted or not posted, or that a push succeeded or failed, solely from those errors. If verificat\
258
+ ion is unavailable, report the outcome as unknown and stop; do not repeat the write or claim it was safely rolled back."]:
259
+ []].join(`
260
+ `)}function J(e={}){let t=Fe(e,"Vibe64 driver input"),n=on(t);return n.scope==="session"?an(n):n.stableContext}async function Je(e=""){let t=e||await un(we.join(fn.tmpdir(),"vibe64-genesis-context-"));await cn(t,{recursive:!0,mode:448});
261
+ let n=we.join(t,"sessions.json"),s=new Map;try{let c=JSON.parse(await pn(n,"utf8"));for(let u of c.sessions)J(u.promptContext),
262
+ s.set(u.upstreamSessionId,u)}catch(c){if(c.code!=="ENOENT")throw c}let r=Promise.resolve(),i=!1;async function o(c){let u=we.
263
+ join(t,"sessions.tmp");await mn(u,JSON.stringify({sessions:[...c.values()]}),{mode:384}),await ln(u,n)}return await o(s),
253
264
  {registryPath:n,get(c){return structuredClone(s.get(c))},async register(c,u,a=""){if(i)throw new Error("The Genesis host\
254
265
  context registry is closed.");if(typeof c!="string"||!c.trim())throw new TypeError("Genesis host context requires a nat\
255
- ive conversation ID.");let m=structuredClone(u);Y(m);let l={upstreamSessionId:c,workdir:a,promptContext:m},d=r.catch(()=>{}).
256
- then(async()=>{if(JSON.stringify(s.get(c))===JSON.stringify(l))return;let h=new Map(s);h.set(c,l),await o(h),s=h});r=d,await d},
257
- async close(){i=!0,await r.catch(()=>{}),s.clear(),e||await Wt(t,{recursive:!0,force:!0})}}}var Le="vibe64.application-deployment.v1",Ue="Deployment",M="VIBE64_DEPLOYMENT_INVALID",zt=/^- (Prepare|Build|Migrate|Serve) `([^`\r\n]+)`:[ \t]+(.+)$/u,
258
- We="- Recreate on restore: ",Ge=Object.freeze({prepare:0,build:1,migrate:2,serve:3});function A(e,t,n,s={}){p(M,e,t,n,s)}
259
- function Kt(e,t,n){let s=C(e.slice(We.length),M,t,"Deployment Recreate on restore paths",n);return s.some(r=>r.startsWith(
260
- "/")||r.includes("\\")||r.includes("***")||/[?[\]{}!]/u.test(r)||r.split("/").some(i=>!i||[".",".."].includes(i)))&&A(t,
261
- "Deployment Recreate on restore paths must be canonical project-relative globs using only * and ** wildcards.",n),new Set(
262
- s).size!==s.length&&A(t,"Deployment contains a duplicate Recreate on restore path.",n),s}function Ft(e,t,n){return{label:O(
263
- e[2],M,t,"Deployment step label",n),argv:_(e[3],M,t,"Deployment command",n),role:e[1].toLowerCase()}}function me(){return{
264
- version:1,artifact:{disposablePaths:[]},workdir:".",runtimeRequirements:[],readiness:null,steps:[]}}function He(e,{path:t="\
265
- genesis/stack.md#Deployment"}={}){if(Array.isArray(e)||A(t,"Deployment must be supplied as exact Stack section lines."),
266
- b(e))return me();let n=me(),s=new Set;for(let i=0;i<e.length;i+=1){let o=e[i].trim();if(!o)continue;let c=i+1;if(o.startsWith(
267
- "- Workdir: ")){s.has("workdir")&&A(t,"Duplicate Deployment Workdir.",c),s.add("workdir");let a=C(o.slice(11),M,t,"Deplo\
268
- yment Workdir",c,{count:1})[0];n.workdir=g(a,M,t,"Deployment workdir",c);continue}if(o.startsWith("- Runtimes: ")){s.has(
269
- "runtimes")&&A(t,"Duplicate Deployment Runtimes.",c),s.add("runtimes"),n.runtimeRequirements=R(o.slice(12),M,t,"Deployme\
270
- nt runtimes",c);continue}if(o.startsWith(We)){s.has("restore-paths")&&A(t,"Duplicate Deployment Recreate on restore entr\
271
- y.",c),s.add("restore-paths"),n.artifact.disposablePaths=Kt(o,t,c);continue}if(o.startsWith("- Ready when: ")){s.has("re\
272
- adiness")&&A(t,"Duplicate Deployment Ready when.",c),s.add("readiness"),n.readiness=te(o,M,t,"Deployment readiness",c);continue}
273
- let u=o.match(zt);if(u){n.steps.push(Ft(u,t,c));continue}A(t,`Unknown Deployment entry: ${o}.`,c)}n.steps.length===0&&A(
274
- t,"## Deployment needs at least one command or exactly `- Nothing.`."),(n.steps.filter(({role:i})=>i==="serve").length!==
275
- 1||n.steps.at(-1).role!=="serve")&&A(t,"Deployment needs exactly one final Serve step.");for(let i=1;i<n.steps.length;i+=
276
- 1)Ge[n.steps[i].role]<Ge[n.steps[i-1].role]&&A(t,"Deployment steps must be ordered Prepare, Build, Migrate, then Serve.");
277
- return n.readiness||A(t,"Deployment needs one Ready when entry."),n.artifact.disposablePaths.length>0&&!n.steps.some(({role:i})=>i===
278
- "prepare")&&A(t,"Deployment may recreate paths on restore only when it declares a Prepare step."),n}function qe({environment:e={},
279
- section:t={}}={}){G(t,e,"Deployment section");let n=[...t.diagnostics||[]],s=me();t.status==="ready"&&(s=He(t.lines));let r=n.
280
- length>0?"blocked":s.steps.length>0?"ready":"unconfigured",i={version:s.version,artifact:s.artifact,workdir:s.workdir,runtimeRequirements:s.
281
- runtimeRequirements,readiness:s.readiness,steps:s.steps};return{contract:Le,status:r,stackHash:t.stackHash,recipeHash:r===
282
- "ready"?T(i):"",components:[...t.components||[]],source:t.source||null,runtimeRequirements:B(s.runtimeRequirements),resources:structuredClone(
283
- e.resources||[]),...i,diagnostics:n}}var Fe="vibe64.outputs.v1",ne="Outputs",fe="vibe64.preview-identity.command.v1",w="VIBE64_OUTPUTS_INVALID",Yt=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u,
284
- he=/\{([a-z][a-z0-9:-]*)\}/gu,Jt=/^### Target `([^`\r\n]+)`:[ \t]+(.+)$/u,Xt=/^#### Parameter `([^`\r\n]+)`:[ \t]+(.+)$/u,
285
- Qt=/^#### Download `([^`\r\n]+)`$/u,Zt=/^[A-Z_][A-Z0-9_]*$/u,en=/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u,tn=new Set([
286
- "HOME","LOGNAME","NODE_OPTIONS","PATH","TMPDIR","USER"]),nn=new Set(["email","login","user-id"]),sn=new Set(["finite","i\
287
- nteractive"]),rn=new Set(["terminal","web"]),on=[["- Command: ","command","Command"],["- Protocol: ","protocol","Protoco\
288
- l"],["- Identity types: ","identityTypes","Identity types"],["- Enabled environment: ","enabledEnvironment","Enabled env\
289
- ironment"],["- Secret environment: ","secretEnvironment","Secret environment"],["- Runtimes: ","runtimes","Runtimes"],["\
290
- - Timeout ms: ","timeoutMs","Timeout ms"]];function f(e,t,n,s={}){p(w,e,t,n,s)}function ge(e,t,n,s){let r=O(e,w,t,n,s);return Yt.
291
- test(r)||f(t,`${n} must use lowercase letters, digits, and single hyphens.`,s),r}function Ye(e,t,n,s,r,i){return C(e.slice(
292
- t.length),w,n,s,r,i)}function P(e,t,n,s,r){return Ye(e,t,n,s,r,{count:1})[0]}function an(e,t,n,s){let r=_(e,w,t,n,s);for(let i of r)
293
- i.replace(he,"").includes("{parameter:")&&f(t,`${n} has an invalid {parameter:id} placeholder.`,s),[...i.matchAll(he)].some(
266
+ ive conversation ID.");let m=structuredClone(u);J(m);let d={upstreamSessionId:c,workdir:a,promptContext:m},p=r.catch(()=>{}).
267
+ then(async()=>{if(JSON.stringify(s.get(c))===JSON.stringify(d))return;let h=new Map(s);h.set(c,d),await o(h),s=h});r=p,await p},
268
+ async close(){i=!0,await r.catch(()=>{}),s.clear(),e||await dn(t,{recursive:!0,force:!0})}}}var Xe="vibe64.application-deployment.v1",Qe="Deployment",L="VIBE64_DEPLOYMENT_INVALID",hn=/^- (Prepare|Build|Migrate|Serve) `([^`\r\n]+)`:[ \t]+(.+)$/u,
269
+ Ie="- Recreate on restore: ",ve=Object.freeze({prepare:0,build:1,migrate:2,serve:3}),Te=Object.keys(ve).map(e=>e[0].toUpperCase()+
270
+ e.slice(1)),gn=Object.freeze(["- Workdir: `path`","- Runtimes: `runtime`...",`${Ie}\`glob\`...`,"- Ready when: `GET` `/p\
271
+ ath` returns `200`",`- ${Te.join("|")} \`label\`: \`command\` \`argument\`...`]);function O(e,t,n,s={}){l(L,e,t,n,s)}function En(e,t,n){
272
+ let s=N(e.slice(Ie.length),L,t,"Deployment Recreate on restore paths",n);return s.some(r=>r.startsWith("/")||r.includes(
273
+ "\\")||r.includes("***")||/[?[\]{}!]/u.test(r)||r.split("/").some(i=>!i||[".",".."].includes(i)))&&O(t,"Deployment Recre\
274
+ ate on restore paths must be canonical project-relative globs using only * and ** wildcards.",n),new Set(s).size!==s.length&&
275
+ O(t,"Deployment contains a duplicate Recreate on restore path.",n),s}function yn(e,t,n){let s=k(e[3],L,t,"Deployment com\
276
+ mand",n);return s.some(r=>/\{(?:host|port)\}/u.test(r))&&O(t,"Deployment commands take no {host} or {port} placeholders;\
277
+ Serve reads HOST and PORT from its environment.",n),{label:R(e[2],L,t,"Deployment step label",n),argv:s,role:e[1].toLowerCase()}}
278
+ function Se(){return{version:1,artifact:{disposablePaths:[]},workdir:".",runtimeRequirements:[],readiness:null,steps:[]}}
279
+ function Ze(e,{path:t="genesis/stack.md#Deployment"}={}){if(Array.isArray(e)||O(t,"Deployment must be supplied as exact \
280
+ Stack section lines."),y(e))return Se();let n=Se(),s=new Set;for(let i=0;i<e.length;i+=1){let o=e[i].trim();if(!o)continue;
281
+ let c=i+1;if(o.startsWith("- Workdir: ")){s.has("workdir")&&O(t,"Duplicate Deployment Workdir.",c),s.add("workdir");let a=N(
282
+ o.slice(11),L,t,"Deployment Workdir",c,{count:1})[0];n.workdir=g(a,L,t,"Deployment workdir",c);continue}if(o.startsWith(
283
+ "- Runtimes: ")){s.has("runtimes")&&O(t,"Duplicate Deployment Runtimes.",c),s.add("runtimes"),n.runtimeRequirements=A(o.
284
+ slice(12),L,t,"Deployment runtimes",c);continue}if(o.startsWith(Ie)){s.has("restore-paths")&&O(t,"Duplicate Deployment R\
285
+ ecreate on restore entry.",c),s.add("restore-paths"),n.artifact.disposablePaths=En(o,t,c);continue}if(o.startsWith("- Re\
286
+ ady when: ")){s.has("readiness")&&O(t,"Duplicate Deployment Ready when.",c),s.add("readiness"),n.readiness=se(o,L,t,"Dep\
287
+ loyment readiness",c);continue}let u=o.match(hn);if(u){n.steps.push(yn(u,t,c));continue}O(t,P("Deployment entry",o,gn),c)}
288
+ n.steps.length===0&&O(t,"## Deployment needs at least one command or exactly `- Nothing.`."),(n.steps.filter(({role:i})=>i===
289
+ "serve").length!==1||n.steps.at(-1).role!=="serve")&&O(t,"Deployment needs exactly one final Serve step.");for(let i=1;i<
290
+ n.steps.length;i+=1)ve[n.steps[i].role]<ve[n.steps[i-1].role]&&O(t,`Deployment steps must be ordered ${Te.slice(0,-1).join(
291
+ ", ")}, then ${Te.at(-1)}.`);return n.readiness||O(t,"Deployment needs one Ready when entry."),n.artifact.disposablePaths.
292
+ length>0&&!n.steps.some(({role:i})=>i==="prepare")&&O(t,"Deployment may recreate paths on restore only when it declares \
293
+ a Prepare step."),n}function et({environment:e={},section:t={}}={}){B(t,e,"Deployment section");let n=[...t.diagnostics||
294
+ []],s=Se();t.status==="ready"&&(s=Ze(t.lines));let r=n.length>0?"blocked":s.steps.length>0?"ready":"unconfigured",i={version:s.
295
+ version,artifact:s.artifact,workdir:s.workdir,runtimeRequirements:s.runtimeRequirements,readiness:s.readiness,steps:s.steps};
296
+ return{contract:Xe,status:r,stackHash:t.stackHash,recipeHash:r==="ready"?I(i):"",components:[...t.components||[]],source:t.
297
+ source||null,runtimeRequirements:j(s.runtimeRequirements),resources:structuredClone(e.resources||[]),...i,diagnostics:n}}var rt="vibe64.outputs.v1",ae="Outputs",oe="vibe64.preview-identity.command.v1",b="VIBE64_OUTPUTS_INVALID",bn=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u,
298
+ Oe=/\{([a-z][a-z0-9:-]*)\}/gu,wn=/^### Target `([^`\r\n]+)`:[ \t]+(.+)$/u,vn=/^#### Parameter `([^`\r\n]+)`:[ \t]+(.+)$/u,
299
+ Tn=/^#### Download `([^`\r\n]+)`$/u,Sn=/^[A-Z_][A-Z0-9_]*$/u,In=/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u,On=new Set([
300
+ "HOME","LOGNAME","NODE_OPTIONS","PATH","TMPDIR","USER"]),it=new Set(["email","login","user-id"]),ot=new Set(["finite","i\
301
+ nteractive"]),_e=new Set(["development","test"]),at=new Set(["terminal","web"]),tt=16,ct=1e4,re=3e4,ie=e=>[...e].map(t=>`\
302
+ \`${t}\``).join(" or "),ut=[["- Command: ","command","Command","`tools/preview-identity` `argument`..."],["- Protocol: ",
303
+ "protocol","Protocol",`\`${oe}\``],["- Identity types: ","identityTypes","Identity types",`one or more of ${[...it].map(
304
+ e=>`\`${e}\``).join(" ")}`],["- Enabled environment: ","enabledEnvironment","Enabled environment","`ENV_NAME`"],["- Secr\
305
+ et environment: ","secretEnvironment","Secret environment","`ENV_NAME`"],["- Runtimes: ","runtimes","Runtimes","`runtime\
306
+ `..."],["- Timeout ms: ","timeoutMs","Timeout ms",`\`1\` through \`${re}\` (default ${ct})`]],_n=Object.freeze(["### Tar\
307
+ get `id`: Label","#### Parameter `id`: Label","#### Presentation","#### Preview identity","#### Download `id`"]),Z=Object.
308
+ freeze({target:["- Default.",`- Mode: ${ie(ot)}`,`- Data: ${ie(_e)}`,"- Workdir: `path`","- Runtimes: `runtime`...","- P\
309
+ repare|Build|Run `label`: `command` `argument`..."],parameter:["- Default: `text`","- Description: `text`","- Required."],
310
+ presentation:[`- Kind: ${ie(at)}`,"- Preferred port: `1024` through `65535`","- URL path: `/path`","- Ready when: `GET` \
311
+ `/path` returns `200`"],previewIdentity:ut.map(([e,,,t])=>`${e}${t}`),download:["- Path: `path`","- Name: `file-name`","\
312
+ - Media type: `type/subtype`"]});function f(e,t,n,s={}){l(b,e,t,n,s)}function Re(e,t,n,s){let r=R(e,b,t,n,s);return bn.test(
313
+ r)||f(t,`${n} must use lowercase letters, digits, and single hyphens.`,s),r}function pt(e,t,n,s,r,i){return N(e.slice(t.
314
+ length),b,n,s,r,i)}function $(e,t,n,s,r){return pt(e,t,n,s,r,{count:1})[0]}function Rn(e,t,n,s){let r=k(e,b,t,n,s);for(let i of r)
315
+ i.replace(Oe,"").includes("{parameter:")&&f(t,`${n} has an invalid {parameter:id} placeholder.`,s),[...i.matchAll(Oe)].some(
294
316
  o=>!["host","port"].includes(o[1])&&!/^parameter:[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(o[1]))&&f(t,`${n} supports only {host}\
295
- , {port}, and {parameter:id} placeholders.`,s);return r}function v(e,t,n,s,r,i){e.seen.has(t)&&f(s,`Duplicate ${i}.`,r),
296
- e.seen.add(t),e[t]=n}function cn(e,t,n){return{id:ge(e[1],t,"Output target id",n),label:O(e[2],w,t,"Output target label",
317
+ , {port}, and {parameter:id} placeholders.`,s);return r}function T(e,t,n,s,r,i){e.seen.has(t)&&f(s,`Duplicate ${i}.`,r),
318
+ e.seen.add(t),e[t]=n}function kn(e,t,n){return{id:Re(e[1],t,"Output target id",n),label:R(e[2],b,t,"Output target label",
297
319
  n),default:!1,mode:"",workdir:".",runtimeRequirements:[],steps:[],presentation:null,previewIdentity:null,downloads:[],parameters:[],
298
- seen:new Set,line:n}}function un(e,t,n,s){if(t==="- Required."){v(e,"required",!0,n,s,"Parameter Required entry");return}
299
- for(let[r,i]of[["Default","default"],["Description","description"]]){let o=`- ${r}: `;if(t.startsWith(o)){let c=P(t,o,n,
300
- `Parameter ${r}`,s);v(e,i,c,n,s,`Parameter ${r} entry`);return}}f(n,`Unknown Outputs parameter entry: ${t}.`,s)}function pn(e,t={}){
301
- let n=e.parameters||[],s=i=>p("VIBE64_OUTPUT_PARAMETERS_INVALID","Outputs",i);(!t||typeof t!="object"||Array.isArray(t))&&
320
+ seen:new Set,line:n}}function An(e,t,n,s){if(t==="- Required."){T(e,"required",!0,n,s,"Parameter Required entry");return}
321
+ for(let[r,i]of[["Default","default"],["Description","description"]]){let o=`- ${r}: `;if(t.startsWith(o)){let c=$(t,o,n,
322
+ `Parameter ${r}`,s);T(e,i,c,n,s,`Parameter ${r} entry`);return}}f(n,P("Outputs parameter entry",t,Z.parameter),s)}function Nn(e,t={}){
323
+ let n=e.parameters||[],s=i=>l("VIBE64_OUTPUT_PARAMETERS_INVALID","Outputs",i);(!t||typeof t!="object"||Array.isArray(t))&&
302
324
  s("Output parameters must be an object of text values.");let r=new Set(n.map(({id:i})=>i));for(let i of Object.keys(t))r.
303
325
  has(i)||s(`Unknown output parameter: ${i}.`);return Object.fromEntries(n.map(i=>{let o=Object.hasOwn(t,i.id)?t[i.id]:i.default;
304
326
  return(typeof o!="string"||o.length>4096||/[\0\r\n]/u.test(o))&&s(`${i.label} must be a single line of text, at most 409\
305
- 6 characters.`),i.required&&!o.trim()&&s(`${i.label} is required.`),[i.id,o]}))}function ln(e){return{kind:"",preferredPort:null,
306
- urlPath:"/",readiness:null,seen:new Set,line:e}}function dn(e,t,n){return{id:ge(e[1],t,"Download id",n),path:"",name:"",
307
- mediaType:"",seen:new Set,line:n}}function mn(e,t,n){/^[0-9]+$/u.test(e)||f(t,"Web presentation preferred port must be a\
327
+ 6 characters.`),i.required&&!o.trim()&&s(`${i.label} is required.`),[i.id,o]}))}function Cn(e){return{kind:"",preferredPort:null,
328
+ urlPath:"/",readiness:null,seen:new Set,line:e}}function Dn(e,t,n){return{id:Re(e[1],t,"Download id",n),path:"",name:"",
329
+ mediaType:"",seen:new Set,line:n}}function Vn(e,t,n){/^[0-9]+$/u.test(e)||f(t,"Web presentation preferred port must be a\
308
330
  n integer from 1024 through 65535.",n);let s=Number(e);return(!Number.isSafeInteger(s)||s<1024||s>65535)&&f(t,"Web prese\
309
- ntation preferred port must be an integer from 1024 through 65535.",n),s}function fn(e,t,n,s){if(t.startsWith("- Data: ")){
310
- let i=P(t,"- Data: ",n,"Output target Data",s);["development","test"].includes(i)||f(n,"Output target Data must be `deve\
311
- lopment` or `test`.",s),v(e,"dataMode",i,n,s,"output target Data entry");return}if(t==="- Default."){v(e,"default",!0,n,
312
- s,"output target Default entry");return}if(t.startsWith("- Mode: ")){let i=P(t,"- Mode: ",n,"Output target Mode",s);sn.has(
313
- i)||f(n,"Output target Mode must be `interactive` or `finite`.",s),v(e,"mode",i,n,s,"output target Mode entry");return}if(t.
314
- startsWith("- Workdir: ")){v(e,"workdir",g(P(t,"- Workdir: ",n,"Output target Workdir",s),w,n,"Output target workdir",s),
315
- n,s,"output target Workdir entry");return}if(t.startsWith("- Runtimes: ")){v(e,"runtimeRequirements",R(t.slice(12),w,n,"\
316
- Output target runtimes",s),n,s,"output target Runtimes entry");return}let r=t.match(/^- (Prepare|Build|Run) `([^`\r\n]+)`:[ \t]+(.+)$/u);
317
- if(r){let i=r[1].toLowerCase(),o=an(r[3],n,"Output step command",s);i!=="run"&&o.some(c=>/\{(?:host|port)\}/u.test(c))&&
318
- f(n,"Only a web presentation's Run step may use {host} or {port} placeholders.",s),e.steps.push({label:O(r[2],w,n,"Outpu\
319
- t step label",s),argv:o,role:i});return}f(n,`Unknown Outputs target entry: ${t}.`,s)}function hn(e,t,n,s){if(t.startsWith(
320
- "- Kind: ")){let r=P(t,"- Kind: ",n,"Presentation Kind",s);rn.has(r)||f(n,"Presentation Kind must be `terminal` or `web`\
321
- .",s),v(e,"kind",r,n,s,"Presentation Kind entry");return}if(t.startsWith("- Preferred port: ")){v(e,"preferredPort",mn(P(
322
- t,"- Preferred port: ",n,"Web presentation Preferred port",s),n,s),n,s,"Presentation Preferred port entry");return}if(t.
323
- startsWith("- URL path: ")){v(e,"urlPath",ue(P(t,"- URL path: ",n,"Web presentation URL path",s),w,n,"Web presentation U\
324
- RL path",s),n,s,"Presentation URL path entry");return}if(t.startsWith("- Ready when: ")){v(e,"readiness",te(t,w,n,"Web p\
325
- resentation readiness",s),n,s,"Presentation Ready when entry");return}f(n,`Unknown Presentation entry: ${t}.`,s)}function gn(e,t,n){
326
- let s=O(e,w,t,"Download Name",n);return(s.length>255||[".",".."].includes(s)||/[\\/\0]/u.test(s)||s.trim()!==s)&&f(t,"Do\
327
- wnload Name must be a safe filename without path separators.",n),s}function yn(e,t,n){let s=O(e,w,t,"Download Media type",
328
- n);return(s.length>127||!en.test(s))&&f(t,"Download Media type must be a lowercase type/subtype value.",n),s}function bn(e,t,n,s){
329
- if(t.startsWith("- Path: ")){v(e,"path",g(P(t,"- Path: ",n,"Download Path",s),w,n,"Download path",s,{allowRoot:!1}),n,s,
330
- "Download Path entry");return}if(t.startsWith("- Name: ")){v(e,"name",gn(P(t,"- Name: ",n,"Download Name",s),n,s),n,s,"D\
331
- ownload Name entry");return}if(t.startsWith("- Media type: ")){v(e,"mediaType",yn(P(t,"- Media type: ",n,"Download Media\
332
- type",s),n,s),n,s,"Download Media type entry");return}f(n,`Unknown Download entry: ${t}.`,s)}function wn(e,t,n){for(let[
331
+ ntation preferred port must be an integer from 1024 through 65535.",n),s}function xn(e,t,n,s){if(t.startsWith("- Data: ")){
332
+ let i=$(t,"- Data: ",n,"Output target Data",s);_e.has(i)||f(n,`Output target Data must be ${ie(_e)}.`,s),T(e,"dataMode",
333
+ i,n,s,"output target Data entry");return}if(t==="- Default."){T(e,"default",!0,n,s,"output target Default entry");return}
334
+ if(t.startsWith("- Mode: ")){let i=$(t,"- Mode: ",n,"Output target Mode",s);ot.has(i)||f(n,"Output target Mode must be `\
335
+ interactive` or `finite`.",s),T(e,"mode",i,n,s,"output target Mode entry");return}if(t.startsWith("- Workdir: ")){T(e,"w\
336
+ orkdir",g($(t,"- Workdir: ",n,"Output target Workdir",s),b,n,"Output target workdir",s),n,s,"output target Workdir entry");
337
+ return}if(t.startsWith("- Runtimes: ")){T(e,"runtimeRequirements",A(t.slice(12),b,n,"Output target runtimes",s),n,s,"out\
338
+ put target Runtimes entry");return}let r=t.match(/^- (Prepare|Build|Run) `([^`\r\n]+)`:[ \t]+(.+)$/u);if(r){let i=r[1].toLowerCase(),
339
+ o=Rn(r[3],n,"Output step command",s);i!=="run"&&o.some(c=>/\{(?:host|port)\}/u.test(c))&&f(n,"Only a web presentation's \
340
+ Run step may use {host} or {port} placeholders.",s),e.steps.push({label:R(r[2],b,n,"Output step label",s),argv:o,role:i});
341
+ return}f(n,P("Outputs target entry",t,[...Z.target,..._n.slice(1)]),s)}function Pn(e,t,n,s){if(t.startsWith("- Kind: ")){
342
+ let r=$(t,"- Kind: ",n,"Presentation Kind",s);at.has(r)||f(n,"Presentation Kind must be `terminal` or `web`.",s),T(e,"ki\
343
+ nd",r,n,s,"Presentation Kind entry");return}if(t.startsWith("- Preferred port: ")){T(e,"preferredPort",Vn($(t,"- Preferr\
344
+ ed port: ",n,"Web presentation Preferred port",s),n,s),n,s,"Presentation Preferred port entry");return}if(t.startsWith("\
345
+ - URL path: ")){T(e,"urlPath",fe($(t,"- URL path: ",n,"Web presentation URL path",s),b,n,"Web presentation URL path",s),
346
+ n,s,"Presentation URL path entry");return}if(t.startsWith("- Ready when: ")){T(e,"readiness",se(t,b,n,"Web presentation \
347
+ readiness",s),n,s,"Presentation Ready when entry");return}f(n,P("Presentation entry",t,Z.presentation),s)}function $n(e,t,n){
348
+ let s=R(e,b,t,"Download Name",n);return(s.length>255||[".",".."].includes(s)||/[\\/\0]/u.test(s)||s.trim()!==s)&&f(t,"Do\
349
+ wnload Name must be a safe filename without path separators.",n),s}function Mn(e,t,n){let s=R(e,b,t,"Download Media type",
350
+ n);return(s.length>127||!In.test(s))&&f(t,"Download Media type must be a lowercase type/subtype value.",n),s}function jn(e,t,n,s){
351
+ if(t.startsWith("- Path: ")){T(e,"path",g($(t,"- Path: ",n,"Download Path",s),b,n,"Download path",s,{allowRoot:!1}),n,s,
352
+ "Download Path entry");return}if(t.startsWith("- Name: ")){T(e,"name",$n($(t,"- Name: ",n,"Download Name",s),n,s),n,s,"D\
353
+ ownload Name entry");return}if(t.startsWith("- Media type: ")){T(e,"mediaType",Mn($(t,"- Media type: ",n,"Download Media\
354
+ type",s),n,s),n,s,"Download Media type entry");return}f(n,P("Download entry",t,Z.download),s)}function Ln(e,t,n){for(let[
333
355
  s,r]of[["path","Path"],["name","Name"],["mediaType","Media type"]])e[s]||f(t,`Output target ${n} Download ${e.id} needs ${r}\
334
- .`,e.line);return{id:e.id,path:e.path,name:e.name,mediaType:e.mediaType}}function ze(e,t,n,s){if(e===void 0)return"";let r=O(
335
- e,w,t,`Preview identity ${n} environment name`,s);return(!Zt.test(r)||tn.has(r)||r.startsWith("XDG_"))&&f(t,`Preview ide\
336
- ntity ${n} environment name is invalid.`,s),r}function En(e){return{seen:new Set,line:e}}function vn(e,t,n,s){let r=on.find(
337
- ([a])=>t.startsWith(a));r||f(n,`Unknown Preview identity entry: ${t}.`,s);let[i,o,c]=r,u=Ye(t,i,n,`Preview identity ${c}`,
338
- s);!["command","identityTypes","runtimes"].includes(o)&&u.length!==1&&f(n,`Preview identity ${c} accepts exactly one val\
339
- ue.`,s),v(e,o,u,n,s,`Preview identity ${c} entry`)}function Sn(e,t,n){for(let[a,m]of[["command","Command"],["protocol","\
340
- Protocol"],["identityTypes","Identity types"]])e[a]||f(t,`Output target ${n} Preview identity needs ${m}.`,e.line);let s=e.
341
- command.map(a=>`\`${a}\``).join(" "),r=_(s,w,t,"Preview identity command",e.line);(!r[0].includes("/")||r[0].includes("\\")||
342
- r[0].split("/").some(a=>!a||[".",".."].includes(a))||r.some(a=>/\{(?:host|port)\}/u.test(a)))&&f(t,"Preview identity com\
343
- mand must use a literal app-owned project-relative executable.",e.line);let i=e.protocol[0];i!==fe&&f(t,`Preview identit\
344
- y protocol must be ${fe}.`,e.line);let o=[...new Set(e.identityTypes.map(a=>(nn.has(a)||f(t,`Unsupported preview identit\
345
- y type: ${a}.`,e.line),a)))];o.length!==e.identityTypes.length&&f(t,"Preview identity types must not contain duplicates.",
346
- e.line);let c={enabled:ze(e.enabledEnvironment?.[0],t,"enabled",e.line),secret:ze(e.secretEnvironment?.[0],t,"secret",e.
347
- line)};c.enabled&&c.enabled===c.secret&&f(t,"Preview identity enabled and secret environment names must differ.",e.line);
348
- let u=1e4;if(e.timeoutMs){let a=e.timeoutMs[0];/^[0-9]+$/u.test(a)||f(t,"Preview identity Timeout ms must be from 1 thro\
349
- ugh 30000.",e.line),u=Number(a),(!Number.isSafeInteger(u)||u<1||u>3e4)&&f(t,"Preview identity Timeout ms must be from 1 \
350
- through 30000.",e.line)}return{command:r,environment:c,identityTypes:o,protocol:i,runtimes:e.runtimes?R(e.runtimes.map(a=>`\
351
- \`${a}\``).join(" "),w,t,"Preview identity runtimes",e.line):[],timeoutMs:u}}function Tn(e,t,n){return e.kind||f(t,`Outp\
352
- ut target ${n} Presentation needs Kind.`,e.line),e.kind==="terminal"?((e.preferredPort!==null||e.readiness||e.seen.has("\
353
- urlPath"))&&f(t,`Output target ${n} terminal Presentation accepts only Kind.`,e.line),{kind:"terminal"}):(e.readiness||f(
354
- t,`Output target ${n} web Presentation needs one Ready when entry.`,e.line),{kind:"web",preferredPort:e.preferredPort,urlPath:e.
355
- urlPath,readiness:e.readiness})}function Ke(e,t){e.mode||f(t,`Output target ${e.id} needs one Mode entry.`,e.line),e.steps.
356
- length===0&&f(t,`Output target ${e.id} needs at least one step.`,e.line);let n={prepare:0,build:1,run:2};for(let a=1;a<e.
357
- steps.length;a+=1)n[e.steps[a].role]<n[e.steps[a-1].role]&&f(t,`Output target ${e.id} steps must be ordered Prepare, Bui\
358
- ld, then Run.`,e.line);let s=e.steps.filter(({role:a})=>a==="run"),r=e.downloads.map(a=>wn(a,t,e.id));new Set(r.map(({id:a})=>a)).
359
- size!==r.length&&f(t,`Output target ${e.id} contains a duplicate Download id.`,e.line),e.mode==="finite"?((s.length>0||e.
360
- presentation||e.previewIdentity)&&f(t,`Finite output target ${e.id} cannot have Run, Presentation, or Preview identity e\
361
- ntries.`,e.line),r.length===0&&f(t,`Finite output target ${e.id} needs at least one Download.`,e.line)):s.length!==1||e.
362
- steps.at(-1).role!=="run"?f(t,`Interactive output target ${e.id} needs exactly one final Run step.`,e.line):e.presentation||
363
- f(t,`Interactive output target ${e.id} needs one Presentation.`,e.line);let i=e.presentation?Tn(e.presentation,t,e.id):null,
364
- o=e.steps.flatMap(({argv:a})=>a.flatMap(m=>[...m.matchAll(he)].map(l=>l[1])));o.some(a=>["host","port"].includes(a))&&i?.
356
+ .`,e.line);return{id:e.id,path:e.path,name:e.name,mediaType:e.mediaType}}function nt(e,t,n,s){if(e===void 0)return"";let r=R(
357
+ e,b,t,`Preview identity ${n} environment name`,s);return(!Sn.test(r)||On.has(r)||r.startsWith("XDG_"))&&f(t,`Preview ide\
358
+ ntity ${n} environment name is invalid.`,s),r}function Un(e){return{seen:new Set,line:e}}function Bn(e,t,n,s){let r=ut.find(
359
+ ([a])=>t.startsWith(a));r||f(n,P("Preview identity entry",t,Z.previewIdentity),s);let[i,o,c]=r,u=pt(t,i,n,`Preview ident\
360
+ ity ${c}`,s);!["command","identityTypes","runtimes"].includes(o)&&u.length!==1&&f(n,`Preview identity ${c} accepts exact\
361
+ ly one value.`,s),T(e,o,u,n,s,`Preview identity ${c} entry`)}function Gn(e,t,n){for(let[a,m]of[["command","Command"],["p\
362
+ rotocol","Protocol"],["identityTypes","Identity types"]])e[a]||f(t,`Output target ${n} Preview identity needs ${m}.`,e.line);
363
+ let s=e.command.map(a=>`\`${a}\``).join(" "),r=k(s,b,t,"Preview identity command",e.line);(!r[0].includes("/")||r[0].includes(
364
+ "\\")||r[0].split("/").some(a=>!a||[".",".."].includes(a))||r.some(a=>/\{(?:host|port)\}/u.test(a)))&&f(t,"Preview ident\
365
+ ity command must use a literal app-owned project-relative executable.",e.line);let i=e.protocol[0];i!==oe&&f(t,`Preview \
366
+ identity protocol must be ${oe}.`,e.line);let o=[...new Set(e.identityTypes.map(a=>(it.has(a)||f(t,`Unsupported preview \
367
+ identity type: ${a}.`,e.line),a)))];o.length!==e.identityTypes.length&&f(t,"Preview identity types must not contain dupl\
368
+ icates.",e.line);let c={enabled:nt(e.enabledEnvironment?.[0],t,"enabled",e.line),secret:nt(e.secretEnvironment?.[0],t,"s\
369
+ ecret",e.line)};c.enabled&&c.enabled===c.secret&&f(t,"Preview identity enabled and secret environment names must differ.",
370
+ e.line);let u=ct;if(e.timeoutMs){let a=e.timeoutMs[0];/^[0-9]+$/u.test(a)||f(t,`Preview identity Timeout ms must be from\
371
+ 1 through ${re}.`,e.line),u=Number(a),(!Number.isSafeInteger(u)||u<1||u>re)&&f(t,`Preview identity Timeout ms must be f\
372
+ rom 1 through ${re}.`,e.line)}return{command:r,environment:c,identityTypes:o,protocol:i,runtimes:e.runtimes?A(e.runtimes.
373
+ map(a=>`\`${a}\``).join(" "),b,t,"Preview identity runtimes",e.line):[],timeoutMs:u}}function Wn(e,t,n){return e.kind||f(
374
+ t,`Output target ${n} Presentation needs Kind.`,e.line),e.kind==="terminal"?((e.preferredPort!==null||e.readiness||e.seen.
375
+ has("urlPath"))&&f(t,`Output target ${n} terminal Presentation accepts only Kind.`,e.line),{kind:"terminal"}):(e.readiness||
376
+ f(t,`Output target ${n} web Presentation needs one Ready when entry.`,e.line),{kind:"web",preferredPort:e.preferredPort,
377
+ urlPath:e.urlPath,readiness:e.readiness})}function st(e,t){e.mode||f(t,`Output target ${e.id} needs one Mode entry.`,e.line),
378
+ e.steps.length===0&&f(t,`Output target ${e.id} needs at least one step.`,e.line);let n={prepare:0,build:1,run:2};for(let a=1;a<
379
+ e.steps.length;a+=1)n[e.steps[a].role]<n[e.steps[a-1].role]&&f(t,`Output target ${e.id} steps must be ordered Prepare, B\
380
+ uild, then Run.`,e.line);let s=e.steps.filter(({role:a})=>a==="run"),r=e.downloads.map(a=>Ln(a,t,e.id));new Set(r.map(({
381
+ id:a})=>a)).size!==r.length&&f(t,`Output target ${e.id} contains a duplicate Download id.`,e.line),e.mode==="finite"?((s.
382
+ length>0||e.presentation||e.previewIdentity)&&f(t,`Finite output target ${e.id} cannot have Run, Presentation, or Previe\
383
+ w identity entries.`,e.line),r.length===0&&f(t,`Finite output target ${e.id} needs at least one Download.`,e.line)):s.length!==
384
+ 1||e.steps.at(-1).role!=="run"?f(t,`Interactive output target ${e.id} needs exactly one final Run step.`,e.line):e.presentation||
385
+ f(t,`Interactive output target ${e.id} needs one Presentation.`,e.line);let i=e.presentation?Wn(e.presentation,t,e.id):null,
386
+ o=e.steps.flatMap(({argv:a})=>a.flatMap(m=>[...m.matchAll(Oe)].map(d=>d[1])));o.some(a=>["host","port"].includes(a))&&i?.
365
387
  kind!=="web"&&f(t,"Only a web output target may use {host} or {port} placeholders.",e.line);let c=e.parameters.map(({seen:a,
366
- ...m})=>m),u=new Set(c.map(({id:a})=>a));(c.length>16||u.size!==c.length)&&f(t,`Output target ${e.id} may declare at mos\
367
- t 16 parameters with unique ids.`,e.line);for(let a of o.filter(m=>m.startsWith("parameter:"))){let m=a.slice(10);u.has(
388
+ ...m})=>m),u=new Set(c.map(({id:a})=>a));(c.length>tt||u.size!==c.length)&&f(t,`Output target ${e.id} may declare at mos\
389
+ t ${tt} parameters with unique ids.`,e.line);for(let a of o.filter(m=>m.startsWith("parameter:"))){let m=a.slice(10);u.has(
368
390
  m)||f(t,`Undeclared output parameter: ${m}.`,e.line)}for(let a of c)o.includes(`parameter:${a.id}`)||f(t,`Output paramet\
369
391
  er ${a.id} must be used in a step command.`,e.line);return e.previewIdentity&&i?.kind!=="web"&&f(t,"Only a web output ta\
370
392
  rget may declare Preview identity.",e.line),{id:e.id,label:e.label,default:e.default,mode:e.mode,workdir:e.workdir,runtimeRequirements:e.
371
393
  runtimeRequirements,...e.dataMode?{dataMode:e.dataMode}:{},steps:e.steps,presentation:i,downloads:r,...c.length?{parameters:c}:
372
- {},...e.previewIdentity?{previewIdentity:Sn(e.previewIdentity,t,e.id)}:{}}}function se(e,{path:t="genesis/stack.md#Outpu\
373
- ts"}={}){if(Array.isArray(e)||f(t,"Outputs must be supplied as exact Stack section lines."),b(e))return{version:1,targets:[]};
374
- let n=[],s=null,r="target",i=null;for(let c=0;c<e.length;c+=1){let u=e[c].trim();if(!u)continue;let a=c+1,m=u.match(Jt);
375
- if(m){s&&n.push(Ke(s,t)),s=cn(m,t,a),r="target",i=null;continue}s||f(t,"## Outputs must begin with a Target heading.",a);
376
- let l=u.match(Xt);if(l){let h={id:ge(l[1],t,"Parameter id",a),label:O(l[2],w,t,"Parameter label",a),default:"",description:"",
394
+ {},...e.previewIdentity?{previewIdentity:Gn(e.previewIdentity,t,e.id)}:{}}}function ce(e,{path:t="genesis/stack.md#Outpu\
395
+ ts"}={}){if(Array.isArray(e)||f(t,"Outputs must be supplied as exact Stack section lines."),y(e))return{version:1,targets:[]};
396
+ let n=[],s=null,r="target",i=null;for(let c=0;c<e.length;c+=1){let u=e[c].trim();if(!u)continue;let a=c+1,m=u.match(wn);
397
+ if(m){s&&n.push(st(s,t)),s=kn(m,t,a),r="target",i=null;continue}s||f(t,"## Outputs must begin with a Target heading.",a);
398
+ let d=u.match(vn);if(d){let h={id:Re(d[1],t,"Parameter id",a),label:R(d[2],b,t,"Parameter label",a),default:"",description:"",
377
399
  required:!1,seen:new Set};s.parameters.push(h),r="parameter",i=h;continue}if(u==="#### Presentation"){s.presentation&&f(
378
- t,"Presentation must appear at most once below an output target.",a),s.presentation=ln(a),r="presentation",i=s.presentation;
400
+ t,"Presentation must appear at most once below an output target.",a),s.presentation=Cn(a),r="presentation",i=s.presentation;
379
401
  continue}if(u==="#### Preview identity"){s.previewIdentity&&f(t,"Preview identity must appear at most once below an outp\
380
- ut target.",a),s.previewIdentity=En(a),r="previewIdentity",i=s.previewIdentity;continue}let d=u.match(Qt);if(d){let h=dn(
381
- d,t,a);s.downloads.push(h),r="download",i=h;continue}r==="parameter"?un(i,u,t,a):r==="presentation"?hn(i,u,t,a):r==="pre\
382
- viewIdentity"?vn(i,u,t,a):r==="download"?bn(i,u,t,a):fn(s,u,t,a)}s&&n.push(Ke(s,t)),n.length===0&&f(t,"## Outputs needs \
402
+ ut target.",a),s.previewIdentity=Un(a),r="previewIdentity",i=s.previewIdentity;continue}let p=u.match(Tn);if(p){let h=Dn(
403
+ p,t,a);s.downloads.push(h),r="download",i=h;continue}r==="parameter"?An(i,u,t,a):r==="presentation"?Pn(i,u,t,a):r==="pre\
404
+ viewIdentity"?Bn(i,u,t,a):r==="download"?jn(i,u,t,a):xn(s,u,t,a)}s&&n.push(st(s,t)),n.length===0&&f(t,"## Outputs needs \
383
405
  at least one Target or exactly `- Nothing.`.");let o=n.map(({id:c})=>c);return new Set(o).size!==o.length&&f(t,"Outputs \
384
406
  contains a duplicate target id."),n.filter(({default:c})=>c).length>1&&f(t,"Outputs may declare at most one default targ\
385
- et."),{version:1,targets:n}}function Je({environment:e={},section:t={}}={}){G(t,e,"Outputs section");let n=[...t.diagnostics||
386
- []],s=[...e.diagnostics||[]],r={version:1,targets:[]};t.status==="ready"&&(r=se(t.lines));let i=s.length===0?null:s.map(
407
+ et."),{version:1,targets:n}}function lt({environment:e={},section:t={}}={}){B(t,e,"Outputs section");let n=[...t.diagnostics||
408
+ []],s=[...e.diagnostics||[]],r={version:1,targets:[]};t.status==="ready"&&(r=ce(t.lines));let i=s.length===0?null:s.map(
387
409
  ({message:a})=>a).join(" "),o=r.targets.map(a=>({...a,source:t.source||null,available:n.length===0&&s.length===0,disabledReason:i})),
388
- c=[...n,...s],u="ready";return c.length>0?u="blocked":o.length===0&&(u="unconfigured"),{contract:Fe,status:u,stackHash:t.
389
- stackHash,components:[...t.components||[]],environmentDefaults:structuredClone(e.environmentDefaults||[]),runtimeRequirements:B(
390
- o.flatMap(a=>a.runtimeRequirements)),resources:structuredClone(e.resources||[]),targets:o,diagnostics:c}}var Xe="Project services",In="vibe64.project-services.v1",L="VIBE64_PROJECT_SERVICES_INVALID",U="genesis/stack.md#Projec\
391
- t services";function Qe(e){if(Array.isArray(e)||p(L,U,"Expected exact Project services section lines."),b(e))return[];let t=[];
392
- for(let[n,s]of e.entries()){let r=s.trim();if(!r)continue;let i=n+1,o=r.match(/^- Start `([a-z][a-z0-9-]{0,63})`( per session)? with (.+?): (.+)$/u);
393
- o||p(L,U,"Use: - Start `service-id` [per session] with `runtime` [in `workdir`]: `command` `argument`...",i),t.some(({id:u})=>u===
394
- o[1])&&p(L,U,"Duplicate project service id.",i);let c=o[3].match(/^(.*?) in `([^`\r\n]+)`$/u);t.push({id:o[1],...o[2]?{scope:"\
395
- session"}:{},runtimeRequirements:R(c?c[1]:o[3],L,U,"Service runtimes",i),workdir:g(c?.[2]||".",L,U,"Service workdir",i),
396
- argv:_(o[4],L,U,"Service command",i)})}return t.length||p(L,U,"Declare a service or exactly `- Nothing.`."),t}function Ze(e={}){
397
- let t=e.status==="ready"?Qe(e.lines):[];return{contract:In,status:e.status==="blocked"?"blocked":t.length?"ready":"uncon\
398
- figured",services:t,recipeHash:t.length?T(t):"",diagnostics:e.diagnostics||[]}}var tt="vibe64.resource-estimates.v1",re="Resource estimates",nt="VIBE64_RESOURCE_ESTIMATES_INVALID",kn=1024*1024,et=1024*
399
- 1024,On=new Map([["Startup typical MiB","startupTypical"],["Startup high MiB","startupHigh"],["Running typical MiB","run\
400
- ningTypical"],["Running high MiB","runningHigh"],["Typical MiB","typical"],["High MiB","high"]]);function x(e,t,n){p(nt,
401
- e,t,n)}function ye(e,t,n,s,r){let i=e.get(t),o=e.get(n);return(i===void 0||o===void 0||i>o)&&x(s,"Each resource phase re\
402
- quires typical and high estimates, with typical no greater than high.",r),{typicalBytes:i,highBytes:o}}function st(e,{path:t="\
410
+ c=[...n,...s],u="ready";return c.length>0?u="blocked":o.length===0&&(u="unconfigured"),{contract:rt,status:u,stackHash:t.
411
+ stackHash,components:[...t.components||[]],environmentDefaults:structuredClone(e.environmentDefaults||[]),runtimeRequirements:j(
412
+ o.flatMap(a=>a.runtimeRequirements)),resources:structuredClone(e.resources||[]),targets:o,diagnostics:c}}var dt="Project services",Hn="vibe64.project-services.v1",G="VIBE64_PROJECT_SERVICES_INVALID",W="genesis/stack.md#Projec\
413
+ t services",qn="- Start `service-id` [per session] with `runtime` [in `workdir`]: `command` `argument`...";function mt(e){
414
+ if(Array.isArray(e)||l(G,W,"Expected exact Project services section lines."),y(e))return[];let t=[];for(let[n,s]of e.entries()){
415
+ let r=s.trim();if(!r)continue;let i=n+1,o=r.match(/^- Start `([a-z][a-z0-9-]{0,63})`( per session)? with (.+?): (.+)$/u);
416
+ o||l(G,W,`Use: ${qn}`,i),t.some(({id:u})=>u===o[1])&&l(G,W,"Duplicate project service id.",i);let c=o[3].match(/^(.*?) in `([^`\r\n]+)`$/u);
417
+ t.push({id:o[1],...o[2]?{scope:"session"}:{},runtimeRequirements:A(c?c[1]:o[3],G,W,"Service runtimes",i),workdir:g(c?.[2]||
418
+ ".",G,W,"Service workdir",i),argv:k(o[4],G,W,"Service command",i)})}return t.length||l(G,W,"Declare a service or exactly\
419
+ `- Nothing.`."),t}function ft(e={}){let t=e.status==="ready"?mt(e.lines):[];return{contract:Hn,status:e.status==="block\
420
+ ed"?"blocked":t.length?"ready":"unconfigured",services:t,recipeHash:t.length?I(t):"",diagnostics:e.diagnostics||[]}}var Et="vibe64.resource-estimates.v1",ue="Resource estimates",yt="VIBE64_RESOURCE_ESTIMATES_INVALID",zn=1024*1024,ht=1024*
421
+ 1024,gt=new Map([["Startup typical MiB","startupTypical"],["Startup high MiB","startupHigh"],["Running typical MiB","run\
422
+ ningTypical"],["Running high MiB","runningHigh"],["Typical MiB","typical"],["High MiB","high"]]);function V(e,t,n){l(yt,
423
+ e,t,n)}function ke(e,t,n,s,r){let i=e.get(t),o=e.get(n);return(i===void 0||o===void 0||i>o)&&V(s,"Each resource phase re\
424
+ quires typical and high estimates, with typical no greater than high.",r),{typicalBytes:i,highBytes:o}}function bt(e,{path:t="\
403
425
  genesis/stack.md#Resource estimates",targets:n=[],hasWorkspaceSetup:s=!1}={}){(!Array.isArray(e)||e.length>2048||e.some(
404
426
  a=>typeof a!="string")||Buffer.byteLength(e.join(`
405
- `),"utf8")>64*1024)&&x(t,"Resource estimates must be exact Stack section lines within 64 KiB and 2048 lines.");let r={version:1,
406
- outputs:[],workspaceSetup:null};if(b(e))return r;let i=new Map(n.map(a=>[a.id,a])),o=new Set,c=null;function u(){if(!c)return;
407
- let{targetId:a,mode:m,fields:l,line:d}=c;if(m==="interactive"){(l.has("typical")||l.has("high"))&&x(t,"Interactive outpu\
408
- ts require separate Startup and Running estimates.",d),r.outputs.push({targetId:a,mode:m,startup:ye(l,"startupTypical","\
409
- startupHigh",t,d),running:ye(l,"runningTypical","runningHigh",t,d)});return}(l.size!==2||!l.has("typical")||!l.has("high"))&&
410
- x(t,"Finite outputs and Workspace setup require only Typical MiB and High MiB.",d);let h=ye(l,"typical","high",t,d);a?r.
411
- outputs.push({targetId:a,mode:m,execution:h}):r.workspaceSetup=h}for(let a=0;a<e.length;a+=1){let m=e[a].trim(),l=a+1;if(!m)
412
- continue;let d=m.match(/^### Output `([a-z0-9]+(?:-[a-z0-9]+)*)`$/u);if(d||m==="### Workspace setup"){u();let k=d?.[1]||
413
- "",J=k?`output:${k}`:"workspace-setup";o.has(J)&&x(t,"Resource estimates contains a duplicate operation.",l),o.add(J);let z=i.
414
- get(k);k&&!["interactive","finite"].includes(z?.mode)&&x(t,`Resource estimate references an undeclared output: ${k}.`,l),
415
- !k&&!s&&x(t,"Resource estimate references undeclared Workspace setup steps.",l),c={targetId:k,mode:z?.mode||"setup",fields:new Map,
416
- line:l};continue}let h=m.match(/^- ([A-Za-z ]+): `([1-9][0-9]*)`$/u),y=h&&On.get(h[1]);(!c||!y)&&x(t,"Expected an Output\
417
- or Workspace setup heading followed by positive integer MiB estimates.",l),c.fields.has(y)&&x(t,`Duplicate resource fie\
418
- ld: ${h[1]}.`,l);let q=Number(h[2]);(!Number.isSafeInteger(q)||q>et)&&x(t,`Resource estimates must be between 1 and ${et}\
419
- MiB.`,l),c.fields.set(y,q*kn)}return u(),o.size===0&&x(t,"Resource estimates needs an operation or exactly `- Nothing.`\
420
- ."),r}function ie({section:e={},outputsSection:t={},workspaceSetupSection:n={}}={}){G(e,t,"Resource estimates and Output\
421
- s"),G(e,n,"Resource estimates and Workspace setup");let s=[...e.diagnostics||[]],r={version:1,outputs:[],workspaceSetup:null};
422
- if(e.status==="ready"&&s.length===0)try{r=st(e.lines,{targets:t.status==="ready"?se(t.lines).targets:[],hasWorkspaceSetup:n.
423
- status==="ready"&&F(n.lines).length>0})}catch(o){if(o?.name!=="Vibe64StackOperationError")throw o;s.push({code:nt,message:o.
424
- message,details:{...o.details,causeCode:o.code}})}let i=s.length>0?"invalid":r.outputs.length>0||r.workspaceSetup?"ready":
425
- "unconfigured";return{contract:tt,status:i,stackHash:e.stackHash,sectionHash:e.sectionHash||"",estimatesHash:i==="ready"?
426
- T(r):"",source:e.source||null,outputs:r.outputs,workspaceSetup:r.workspaceSetup,fallbackReason:i==="invalid"?"invalid-es\
427
- timates":i==="unconfigured"?"not-declared":null,diagnostics:s}}var rt="vibe64.integration-setup.v1",it="Integration setup",Q="VIBE64_INTEGRATION_SETUP_INVALID";function ot(e,{path:t="\
428
- genesis/stack.md#Integration setup"}={}){if(Array.isArray(e)||p(Q,t,"Integration setup requires exact Stack section line\
429
- s."),b(e))return null;let n=e.map(r=>r.trim()).filter(Boolean),s=n.length===1&&n[0].match(/^- Command with (.+?) in `([^`\r\n]+)`: (.+)$/u);
430
- return s||p(Q,t,"Integration setup requires exactly one entry: - Command with `runtime` in `workdir`: `command` `argumen\
431
- t`...; or - Nothing."),{argv:_(s[3],Q,t,"Integration setup command"),workdir:g(s[2],Q,t,"Integration setup workdir"),runtimeRequirements:R(
432
- s[1],Q,t,"Integration setup runtimes")}}function at({section:e={}}={}){let t=[...e.diagnostics||[]],n=e.status==="ready"&&
433
- t.length===0?ot(e.lines):null;return{contract:rt,status:t.length?"blocked":n?"ready":"unconfigured",stackHash:e.stackHash,
434
- recipeHash:n?T({version:1,command:n}):"",source:e.source||null,components:[...e.components||[]],command:n,diagnostics:t}}var _n=new URL("./index.js",import.meta.url).href,ut=An(_n),oe=new Map;async function Cn(e){if(!j.isAbsolute(e||""))throw new TypeError(
435
- "Genesis host context requires an absolute runtime root.");let t=j.join(e,"genesis-context");if(!oe.has(t)){let n=$e(t).
436
- catch(s=>{throw oe.delete(t),s});oe.set(t,n)}return oe.get(t)}async function pr(e){let t=await Cn(e);return{[Dn]:as(),[Nn]:JSON.
437
- stringify({registryPath:t.registryPath}),GENESIS_TURN_CONTEXT_ENABLED:"0"}}var{GENESIS_CONTRACTS:I,HOST_CONTEXT_RESOLVER_DATA_ENV:Nn,
438
- HOST_CONTEXT_RESOLVER_ENV:Dn,addStack:xn,applyTemplate:Vn,generatePrompt:be,indexCodebase:Pn,initialize:jn,inspectCollaboration:Bn,
439
- inspectDerivedArtifacts:Mn,inspectEngineering:$n,inspectEnvironment:Ee,inspectProject:Gn,inspectProjectFormat:Ln,inspectAgentIntegrations:Un,
440
- inspectSkills:Wn,inspectStackSection:Hn,inspectStackSections:qn,inspectSubsystems:zn,listTemplates:Kn,parserEnvironment:Fn,
441
- setCollaboration:Yn,setEngineeringProfile:Jn,syncAgentIntegrations:Xn,syncSkills:Qn,withTrustedGitRepository:Zn,SOURCE_EXPLANATION_PROMPT_VERSION:lr,
442
- sourceExplanationGuidance:dr,sourceExplanationReviewGuidance:mr,validateArchitectureFacts:fr,validateArchitectureObservations:hr,
443
- mergeArchitectureObservations:gr}=we,yr="genesis/blueprint.md",es=!1,ts=Object.freeze(["vue",...es?[]:["jskit-postgresql",
444
- "postgresql"]]),ns=Object.freeze(["genesis-stack"]),ss=new Set(["adopt","blueprint","describe","deslop","program","revie\
445
- w","start","work"]);function W(e=""){return String(e||"").trim()}function pt(e,{required:t=!1}={}){let n=W(e);if(!n&&!t)
446
- return"";if(!ss.has(n))throw new TypeError(n?`Unknown Genesis prompt task: ${n}.`:"Genesis prompt actions require an exp\
447
- licit task.");return n}function rs(e={}){return pt(e.genesisTask)||"work"}function is(e={},t={}){return[e.conversationRequest,
448
- e.feedback,e.request,e.plan,e.description,t.label].map(W).find(Boolean)||"Continue the requested project work."}function br(e={}){
449
- return Fn(e)}function os(){let e=(ut.resolve.paths("genesis-compiler")||[]).find(t=>ct(j.join(t,"genesis-compiler"))&&ct(
450
- j.join(t,".bin","genesis")));if(!e)throw new Error("The installed Genesis compiler executable could not be located.");return j.
451
- join(e,".bin")}function lt(){let e=ut.resolve("@local/vibe64-genesis/server");return j.resolve(j.dirname(e),"../../bin")}
452
- function as(){return j.resolve(lt(),"vibe64-genesis-host-context")}function wr(e=[]){let t=lt(),n=os();return[...(Array.
453
- isArray(e)?e:[]).filter(r=>![t,n].includes(W(r))),t]}function cs(e={},{prompt:t=!1}={}){return{...e,...t?{hiddenStackPieces:ts}:
454
- {},stackPackages:ns}}function Er(e={}){return S(xn,e)}function vr(e={}){return S(jn,e)}function Sr(e={}){return S(Wn,e)}
455
- function Tr(e={}){return S(Qn,e)}function Ir(e={}){return S(Xn,e)}function kr(e={}){return S(Un,e)}function Or(e={}){return S(
456
- zn,e)}async function _r(e={}){return Ne(await H(Ce,e))}async function Rr(e={}){return xe(await H(De,e))}function Ar(e={}){
457
- return S(Pn,e)}function us(){let e=Mn();if(e?.contract!==I.derivedArtifacts)throw new Error(`Genesis returned ${e?.contract||
458
- "no contract identity"}; expected ${I.derivedArtifacts}.`);let t=Array.isArray(e.artifacts)?e.artifacts:[];if(!t.length||
459
- t.some(n=>!W(n?.path)))throw new Error("Genesis returned an invalid derived-artifact contract.");return{...e,artifacts:t.
460
- map(n=>({...n}))}}var dt=us(),Cr=Object.freeze(dt.artifacts.map(e=>e.path)),mt=new Map(dt.artifacts.map(e=>[e.id,e])),ps=mt.
461
- get("machine-city")?.path,ls=mt.get("program-city")?.path;if(!ps||!ls)throw new Error("Genesis did not declare both City\
462
- projection artifacts.");async function S(e,t={},n={}){let s=W(t.projectRoot);if(!s||!j.isAbsolute(s))throw new TypeError(
463
- "Genesis operations require an explicit absolute projectRoot.");return Zn(s,()=>e(cs(t,n)))}async function Nr({workdir:e,
464
- promptContext:t}){let n=Y(t);return t.scope==="ephemeral"?n:(await S(we.projectSessionContext,{projectRoot:e,hostDriver:Y,
465
- hostDriverInput:t})).output}async function V(e,t,n={}){let s=await S(e,n);if(s?.contract!==t)throw new Error(`Genesis re\
466
- turned ${s?.contract||"no contract identity"}; expected ${t}.`);return s}function H(e,t={}){return V(n=>Hn({...n,name:e}),
467
- I.stackSection,t)}async function ve(e,t={}){let n=await S(s=>qn({...s,names:e}),t);if(!Array.isArray(n)||n.length!==e.length||
468
- n.some((s,r)=>s?.contract!==I.stackSection||s.name!==e[r]))throw new Error("Genesis returned an invalid Stack section in\
469
- spection batch.");return n}async function Dr(e={}){if((await ds(e)).status!=="current")throw Object.assign(new Error("Th\
470
- e project needs a current Genesis format before its Stack can be inspected."),{code:"vibe64_stack_format_required"});await Rn(
471
- j.join(e.projectRoot,"genesis/stack.md"),"utf8");let n=await H(X,e);return{components:n.components,stackHash:n.stackHash}}
472
- async function xr(e={}){let[t,n]=await Promise.all([H(Ue,e),V(Ee,I.environment,e)]);return qe({environment:n,section:t})}
473
- function Vr(e={}){return V(Ee,I.environment,e)}function Pr(e={}){return V(Gn,I.projectInspection,e)}function jr(e={}){return V(
474
- Kn,I.templates,e)}function Br(e={}){return V(Vn,I.templateApplication,e)}function Mr(e={}){return V($n,I.engineering,e)}
475
- function $r(e={}){return V(Bn,I.collaboration,e)}async function ds(e={}){let t=await S(Ln,e);if(!W(t?.status))throw new Error(
476
- "Genesis did not return a project-format status.");return{...t}}function Gr(e={}){return V(Jn,I.engineering,e)}function Lr(e={}){
477
- return V(Yn,I.collaboration,e)}async function Ur(e={}){let[[t,n,s],r]=await Promise.all([ve([ne,re,X],e),V(Ee,I.environment,
478
- e)]);return{...Je({environment:r,section:t}),resourceEstimates:ie({section:n,outputsSection:t,workspaceSetupSection:s})}}
479
- async function Wr(e={}){let t=await H(it,e);return at({section:t})}async function Hr(e={}){return Ae(await H(Re,e))}async function qr(e={}){
480
- return Ze(await H(Xe,e))}async function zr(e={}){let[t,n,s]=await ve([X,re,ne],e);return{...await Ie({projectRoot:e.projectRoot,
481
- section:t}),resourceEstimates:ie({section:n,outputsSection:s,workspaceSetupSection:t})}}async function Kr(e={}){let[t,n,
482
- s]=await ve([re,ne,X],e);return ie({section:t,outputsSection:n,workspaceSetupSection:s})}async function Fr({action:e={},
483
- environment:t=process.env,input:n={},projectRoot:s}={}){let r=rs(e),i=is(n,e),o=r,c;try{c=await S(be,{environment:t,projectRoot:s,
427
+ `),"utf8")>64*1024)&&V(t,"Resource estimates must be exact Stack section lines within 64 KiB and 2048 lines.");let r={version:1,
428
+ outputs:[],workspaceSetup:null};if(y(e))return r;let i=new Map(n.map(a=>[a.id,a])),o=new Set,c=null;function u(){if(!c)return;
429
+ let{targetId:a,mode:m,fields:d,line:p}=c;if(m==="interactive"){(d.has("typical")||d.has("high"))&&V(t,"Interactive outpu\
430
+ ts require separate Startup and Running estimates.",p),r.outputs.push({targetId:a,mode:m,startup:ke(d,"startupTypical","\
431
+ startupHigh",t,p),running:ke(d,"runningTypical","runningHigh",t,p)});return}(d.size!==2||!d.has("typical")||!d.has("high"))&&
432
+ V(t,"Finite outputs and Workspace setup require only Typical MiB and High MiB.",p);let h=ke(d,"typical","high",t,p);a?r.
433
+ outputs.push({targetId:a,mode:m,execution:h}):r.workspaceSetup=h}for(let a=0;a<e.length;a+=1){let m=e[a].trim(),d=a+1;if(!m)
434
+ continue;let p=m.match(/^### Output `([a-z0-9]+(?:-[a-z0-9]+)*)`$/u);if(p||m==="### Workspace setup"){u();let w=p?.[1]||
435
+ "",X=w?`output:${w}`:"workspace-setup";o.has(X)&&V(t,"Resource estimates contains a duplicate operation.",d),o.add(X);let K=i.
436
+ get(w);w&&!["interactive","finite"].includes(K?.mode)&&V(t,`Resource estimate references an undeclared output: ${w}.`,d),
437
+ !w&&!s&&V(t,"Resource estimate references undeclared Workspace setup steps.",d),c={targetId:w,mode:K?.mode||"setup",fields:new Map,
438
+ line:d};continue}let h=m.match(/^- ([A-Za-z ]+): `([1-9][0-9]*)`$/u),E=h&&gt.get(h[1]);(!c||!E)&&V(t,`Expected an Output\
439
+ or Workspace setup heading followed by positive integer MiB estimates: ${[...gt.keys()].map(w=>`- ${w}: \`number\``).join(
440
+ "; ")}.`,d),c.fields.has(E)&&V(t,`Duplicate resource field: ${h[1]}.`,d);let z=Number(h[2]);(!Number.isSafeInteger(z)||z>
441
+ ht)&&V(t,`Resource estimates must be between 1 and ${ht} MiB.`,d),c.fields.set(E,z*zn)}return u(),o.size===0&&V(t,"Resou\
442
+ rce estimates needs an operation or exactly `- Nothing.`."),r}function pe({section:e={},outputsSection:t={},workspaceSetupSection:n={}}={}){
443
+ B(e,t,"Resource estimates and Outputs"),B(e,n,"Resource estimates and Workspace setup");let s=[...e.diagnostics||[]],r={
444
+ version:1,outputs:[],workspaceSetup:null};if(e.status==="ready"&&s.length===0)try{r=bt(e.lines,{targets:t.status==="read\
445
+ y"?ce(t.lines).targets:[],hasWorkspaceSetup:n.status==="ready"&&Y(n.lines).length>0})}catch(o){if(o?.name!=="Vibe64Stack\
446
+ OperationError")throw o;s.push({code:yt,message:o.message,details:{...o.details,causeCode:o.code}})}let i=s.length>0?"in\
447
+ valid":r.outputs.length>0||r.workspaceSetup?"ready":"unconfigured";return{contract:Et,status:i,stackHash:e.stackHash,sectionHash:e.
448
+ sectionHash||"",estimatesHash:i==="ready"?I(r):"",source:e.source||null,outputs:r.outputs,workspaceSetup:r.workspaceSetup,
449
+ fallbackReason:i==="invalid"?"invalid-estimates":i==="unconfigured"?"not-declared":null,diagnostics:s}}var wt="vibe64.integration-setup.v1",vt="Integration setup",ee="VIBE64_INTEGRATION_SETUP_INVALID",Kn="- Command with `ru\
450
+ ntime` in `workdir`: `command` `argument`...";function Tt(e,{path:t="genesis/stack.md#Integration setup"}={}){if(Array.isArray(
451
+ e)||l(ee,t,"Integration setup requires exact Stack section lines."),y(e))return null;let n=e.map(r=>r.trim()).filter(Boolean),
452
+ s=n.length===1&&n[0].match(/^- Command with (.+?) in `([^`\r\n]+)`: (.+)$/u);return s||l(ee,t,`Integration setup require\
453
+ s exactly one entry: ${Kn}; or - Nothing.`),{argv:k(s[3],ee,t,"Integration setup command"),workdir:g(s[2],ee,t,"Integrat\
454
+ ion setup workdir"),runtimeRequirements:A(s[1],ee,t,"Integration setup runtimes")}}function St({section:e={}}={}){let t=[
455
+ ...e.diagnostics||[]],n=e.status==="ready"&&t.length===0?Tt(e.lines):null;return{contract:wt,status:t.length?"blocked":n?
456
+ "ready":"unconfigured",stackHash:e.stackHash,recipeHash:n?I({version:1,command:n}):"",source:e.source||null,components:[
457
+ ...e.components||[]],command:n,diagnostics:t}}var Fn=new URL("./index.js",import.meta.url).href,Ot=Jn(Fn),le=new Map;async function Xn(e){if(!M.isAbsolute(e||""))throw new TypeError(
458
+ "Genesis host context requires an absolute runtime root.");let t=M.join(e,"genesis-context");if(!le.has(t)){let n=Je(t).
459
+ catch(s=>{throw le.delete(t),s});le.set(t,n)}return le.get(t)}async function Cr(e){let t=await Xn(e);return{[Zn]:ks(),[Qn]:JSON.
460
+ stringify({registryPath:t.registryPath}),GENESIS_TURN_CONTEXT_ENABLED:"0"}}var{GENESIS_CONTRACTS:_,HOST_CONTEXT_RESOLVER_DATA_ENV:Qn,
461
+ HOST_CONTEXT_RESOLVER_ENV:Zn,addStack:es,applyTemplate:ts,generatePrompt:Ae,indexCodebase:ns,initialize:ss,inspectCollaboration:rs,
462
+ inspectDerivedArtifacts:is,inspectEngineering:os,inspectEnvironment:Ce,inspectProject:as,inspectProjectFormat:cs,inspectAgentIntegrations:us,
463
+ inspectSkills:ps,inspectStackSection:ls,inspectStackSections:ds,inspectSubsystems:ms,listTemplates:fs,parserEnvironment:hs,
464
+ setCollaboration:gs,setEngineeringProfile:Es,syncAgentIntegrations:ys,syncSkills:bs,withTrustedGitRepository:ws,SOURCE_EXPLANATION_PROMPT_VERSION:Dr,
465
+ sourceExplanationGuidance:Vr,sourceExplanationReviewGuidance:xr,validateArchitectureFacts:Pr,validateArchitectureObservations:$r,
466
+ mergeArchitectureObservations:Mr}=Ne,jr="genesis/blueprint.md",vs=!1,Ts=Object.freeze(["vue",...vs?[]:["jskit-postgresql",
467
+ "postgresql"]]),Ss=Object.freeze(["genesis-stack"]),Is=new Set(["adopt","blueprint","describe","deslop","program","revie\
468
+ w","start","work"]);function H(e=""){return String(e||"").trim()}function _t(e,{required:t=!1}={}){let n=H(e);if(!n&&!t)
469
+ return"";if(!Is.has(n))throw new TypeError(n?`Unknown Genesis prompt task: ${n}.`:"Genesis prompt actions require an exp\
470
+ licit task.");return n}function Os(e={}){return _t(e.genesisTask)||"work"}function _s(e={},t={}){return[e.conversationRequest,
471
+ e.feedback,e.request,e.plan,e.description,t.label].map(H).find(Boolean)||"Continue the requested project work."}function Lr(e={}){
472
+ return hs(e)}function Rs(){let e=(Ot.resolve.paths("genesis-compiler")||[]).find(t=>It(M.join(t,"genesis-compiler"))&&It(
473
+ M.join(t,".bin","genesis")));if(!e)throw new Error("The installed Genesis compiler executable could not be located.");return M.
474
+ join(e,".bin")}function Rt(){let e=Ot.resolve("@local/vibe64-genesis/server");return M.resolve(M.dirname(e),"../../bin")}
475
+ function ks(){return M.resolve(Rt(),"vibe64-genesis-host-context")}function Ur(e=[]){let t=Rt(),n=Rs();return[...(Array.
476
+ isArray(e)?e:[]).filter(r=>![t,n].includes(H(r))),t]}function As(e={},{prompt:t=!1}={}){return{...e,...t?{hiddenStackPieces:Ts}:
477
+ {},stackPackages:Ss}}function Br(e={}){return S(es,e)}function Gr(e={}){return S(ss,e)}function Wr(e={}){return S(ps,e)}
478
+ function Hr(e={}){return S(bs,e)}function qr(e={}){return S(ys,e)}function zr(e={}){return S(us,e)}function Kr(e={}){return S(
479
+ ms,e)}async function Fr(e={}){return Ge(await q(Be,e))}async function Yr(e={}){return He(await q(We,e))}function Jr(e={}){
480
+ return S(ns,e)}function Ns(){let e=is();if(e?.contract!==_.derivedArtifacts)throw new Error(`Genesis returned ${e?.contract||
481
+ "no contract identity"}; expected ${_.derivedArtifacts}.`);let t=Array.isArray(e.artifacts)?e.artifacts:[];if(!t.length||
482
+ t.some(n=>!H(n?.path)))throw new Error("Genesis returned an invalid derived-artifact contract.");return{...e,artifacts:t.
483
+ map(n=>({...n}))}}var kt=Ns(),Xr=Object.freeze(kt.artifacts.map(e=>e.path)),At=new Map(kt.artifacts.map(e=>[e.id,e])),Cs=At.
484
+ get("machine-city")?.path,Ds=At.get("program-city")?.path;if(!Cs||!Ds)throw new Error("Genesis did not declare both City\
485
+ projection artifacts.");async function S(e,t={},n={}){let s=H(t.projectRoot);if(!s||!M.isAbsolute(s))throw new TypeError(
486
+ "Genesis operations require an explicit absolute projectRoot.");return ws(s,()=>e(As(t,n)))}async function Qr({workdir:e,
487
+ promptContext:t}){let n=J(t);return t.scope==="ephemeral"?n:(await S(Ne.projectSessionContext,{projectRoot:e,hostDriver:J,
488
+ hostDriverInput:t})).output}async function x(e,t,n={}){let s=await S(e,n);if(s?.contract!==t)throw new Error(`Genesis re\
489
+ turned ${s?.contract||"no contract identity"}; expected ${t}.`);return s}function q(e,t={}){return x(n=>ls({...n,name:e}),
490
+ _.stackSection,t)}async function De(e,t={}){let n=await S(s=>ds({...s,names:e}),t);if(!Array.isArray(n)||n.length!==e.length||
491
+ n.some((s,r)=>s?.contract!==_.stackSection||s.name!==e[r]))throw new Error("Genesis returned an invalid Stack section in\
492
+ spection batch.");return n}async function Zr(e={}){if((await Vs(e)).status!=="current")throw Object.assign(new Error("Th\
493
+ e project needs a current Genesis format before its Stack can be inspected."),{code:"vibe64_stack_format_required"});await Yn(
494
+ M.join(e.projectRoot,"genesis/stack.md"),"utf8");let n=await q(Q,e);return{components:n.components,stackHash:n.stackHash}}
495
+ async function ei(e={}){let[t,n]=await Promise.all([q(Qe,e),x(Ce,_.environment,e)]);return et({environment:n,section:t})}
496
+ function ti(e={}){return x(Ce,_.environment,e)}function ni(e={}){return x(as,_.projectInspection,e)}function si(e={}){return x(
497
+ fs,_.templates,e)}function ri(e={}){return x(ts,_.templateApplication,e)}function ii(e={}){return x(os,_.engineering,e)}
498
+ function oi(e={}){return x(rs,_.collaboration,e)}async function Vs(e={}){let t=await S(cs,e);if(!H(t?.status))throw new Error(
499
+ "Genesis did not return a project-format status.");return{...t}}function ai(e={}){return x(Es,_.engineering,e)}function ci(e={}){
500
+ return x(gs,_.collaboration,e)}async function ui(e={}){let[[t,n,s],r]=await Promise.all([De([ae,ue,Q],e),x(Ce,_.environment,
501
+ e)]);return{...lt({environment:r,section:t}),resourceEstimates:pe({section:n,outputsSection:t,workspaceSetupSection:s})}}
502
+ async function pi(e={}){let t=await q(vt,e);return St({section:t})}async function li(e={}){return Ue(await q(Le,e))}async function di(e={}){
503
+ return ft(await q(dt,e))}async function mi(e={}){let[t,n,s]=await De([Q,ue,ae],e);return{...await Pe({projectRoot:e.projectRoot,
504
+ section:t}),resourceEstimates:pe({section:n,outputsSection:s,workspaceSetupSection:t})}}async function fi(e={}){let[t,n,
505
+ s]=await De([ue,ae,Q],e);return pe({section:t,outputsSection:n,workspaceSetupSection:s})}async function hi({action:e={},
506
+ environment:t=process.env,input:n={},projectRoot:s}={}){let r=Os(e),i=_s(n,e),o=r,c;try{c=await S(Ae,{environment:t,projectRoot:s,
484
507
  request:i,sessionContextInstalled:!0,task:o},{prompt:!0})}catch(a){if(a?.code==="BLUEPRINT_INVALID"&&r!=="blueprint")o="\
485
- blueprint",c=await S(be,{environment:t,projectRoot:s,request:i,sessionContextInstalled:!0,task:o},{prompt:!0});else if(a?.
486
- code==="BLUEPRINT_REQUIRED"&&r!=="start")o="start",c=await S(be,{environment:t,projectRoot:s,request:i,sessionContextInstalled:!0,
487
- task:o},{prompt:!0});else throw a}let u=pt(c.task)||o;return{context:{genesis:!0,requestedTask:r,task:u,verificationCommands:c.
488
- verificationCommands,warnings:c.warnings},originalPrompt:i,prompt:c.prompt,promptId:W(e.promptId||e.id)||u}}export{yr as GENESIS_BLUEPRINT_PATH,Cr as GENESIS_DERIVED_ARTIFACT_PATHS,ps as GENESIS_MACHINE_CITY_PATH,ls as GENESIS_PROGRAM_CITY_PATH,
489
- Ve as GENESIS_STACK_CONTRACTS_INCOMPLETE,Pe as GENESIS_STACK_SECTION_AMBIGUOUS,Nn as HOST_CONTEXT_RESOLVER_DATA_ENV,Dn as HOST_CONTEXT_RESOLVER_ENV,
490
- lr as SOURCE_EXPLANATION_PROMPT_VERSION,Le as VIBE64_APPLICATION_DEPLOYMENT_CONTRACT,Ue as VIBE64_APPLICATION_DEPLOYMENT_SECTION,
491
- rt as VIBE64_INTEGRATION_SETUP_CONTRACT,it as VIBE64_INTEGRATION_SETUP_SECTION,Fe as VIBE64_OUTPUTS_CONTRACT,ne as VIBE64_OUTPUTS_SECTION,
492
- fe as VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL,tt as VIBE64_RESOURCE_ESTIMATES_CONTRACT,re as VIBE64_RESOURCE_ESTIMATES_SECTION,
493
- Te as VIBE64_WORKSPACE_SETUP_CONTRACT,X as VIBE64_WORKSPACE_SETUP_SECTION,Er as addGenesisStack,Br as applyGenesisTemplate,
494
- pt as assertGenesisPromptTask,lt as genesisCommandShimDirectory,os as genesisPackageBinDirectory,br as genesisParserEnvironment,
495
- Ct as genesisProjectContractNeedsAttention,is as genesisPromptRequest,rs as genesisPromptTask,vr as initializeGenesisProject,
496
- kr as inspectGenesisAgentIntegrations,$r as inspectGenesisCollaboration,us as inspectGenesisDerivedArtifacts,Mr as inspectGenesisEngineering,
497
- Vr as inspectGenesisEnvironment,Pr as inspectGenesisProject,ds as inspectGenesisProjectFormat,Sr as inspectGenesisSkills,
498
- Dr as inspectGenesisStackComponents,H as inspectGenesisStackSection,Or as inspectGenesisSubsystems,_r as inspectVibe64ArchitectureInspection,
499
- Rr as inspectVibe64ArchitectureLayout,Hr as inspectVibe64ConnectedDevelopment,xr as inspectVibe64Deployment,Wr as inspectVibe64IntegrationSetup,
500
- Ur as inspectVibe64Outputs,qr as inspectVibe64ProjectServices,Kr as inspectVibe64ResourceEstimates,zr as inspectVibe64WorkspaceSetup,
501
- jr as listGenesisTemplates,gr as mergeArchitectureObservations,He as parseVibe64DeploymentLines,ot as parseVibe64IntegrationSetupLines,
502
- se as parseVibe64OutputsLines,Qe as parseVibe64ProjectServicesLines,st as parseVibe64ResourceEstimatesLines,F as parseVibe64WorkspaceSetupLines,
503
- Ar as refreshGenesisCities,Fr as renderGenesisPrompt,pn as resolveVibe64OutputParameters,Lr as setGenesisCollaboration,Gr as setGenesisEngineeringProfile,
504
- dr as sourceExplanationGuidance,mr as sourceExplanationReviewGuidance,Ir as syncGenesisAgentIntegrations,Tr as syncGenesisSkills,
505
- fr as validateArchitectureFacts,hr as validateArchitectureObservations,Nr as vibe64ConversationInstructions,Y as vibe64Driver,
506
- pr as vibe64HostContextEnvironment,Cn as vibe64HostContextRegistry,as as vibe64HostContextResolverPath,wr as withGenesisCommandShim};
508
+ blueprint",c=await S(Ae,{environment:t,projectRoot:s,request:i,sessionContextInstalled:!0,task:o},{prompt:!0});else if(a?.
509
+ code==="BLUEPRINT_REQUIRED"&&r!=="start")o="start",c=await S(Ae,{environment:t,projectRoot:s,request:i,sessionContextInstalled:!0,
510
+ task:o},{prompt:!0});else throw a}let u=_t(c.task)||o;return{context:{genesis:!0,requestedTask:r,task:u,verificationCommands:c.
511
+ verificationCommands,warnings:c.warnings},originalPrompt:i,prompt:c.prompt,promptId:H(e.promptId||e.id)||u}}export{jr as GENESIS_BLUEPRINT_PATH,Xr as GENESIS_DERIVED_ARTIFACT_PATHS,Cs as GENESIS_MACHINE_CITY_PATH,Ds as GENESIS_PROGRAM_CITY_PATH,
512
+ qe as GENESIS_STACK_CONTRACTS_INCOMPLETE,ze as GENESIS_STACK_SECTION_AMBIGUOUS,Qn as HOST_CONTEXT_RESOLVER_DATA_ENV,Zn as HOST_CONTEXT_RESOLVER_ENV,
513
+ Dr as SOURCE_EXPLANATION_PROMPT_VERSION,Xe as VIBE64_APPLICATION_DEPLOYMENT_CONTRACT,Qe as VIBE64_APPLICATION_DEPLOYMENT_SECTION,
514
+ wt as VIBE64_INTEGRATION_SETUP_CONTRACT,vt as VIBE64_INTEGRATION_SETUP_SECTION,rt as VIBE64_OUTPUTS_CONTRACT,ae as VIBE64_OUTPUTS_SECTION,
515
+ oe as VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL,Et as VIBE64_RESOURCE_ESTIMATES_CONTRACT,ue as VIBE64_RESOURCE_ESTIMATES_SECTION,
516
+ xe as VIBE64_WORKSPACE_SETUP_CONTRACT,Q as VIBE64_WORKSPACE_SETUP_SECTION,Br as addGenesisStack,ri as applyGenesisTemplate,
517
+ _t as assertGenesisPromptTask,Rt as genesisCommandShimDirectory,Rs as genesisPackageBinDirectory,Lr as genesisParserEnvironment,
518
+ Qt as genesisProjectContractNeedsAttention,_s as genesisPromptRequest,Os as genesisPromptTask,Gr as initializeGenesisProject,
519
+ zr as inspectGenesisAgentIntegrations,oi as inspectGenesisCollaboration,Ns as inspectGenesisDerivedArtifacts,ii as inspectGenesisEngineering,
520
+ ti as inspectGenesisEnvironment,ni as inspectGenesisProject,Vs as inspectGenesisProjectFormat,Wr as inspectGenesisSkills,
521
+ Zr as inspectGenesisStackComponents,q as inspectGenesisStackSection,Kr as inspectGenesisSubsystems,Fr as inspectVibe64ArchitectureInspection,
522
+ Yr as inspectVibe64ArchitectureLayout,li as inspectVibe64ConnectedDevelopment,ei as inspectVibe64Deployment,pi as inspectVibe64IntegrationSetup,
523
+ ui as inspectVibe64Outputs,di as inspectVibe64ProjectServices,fi as inspectVibe64ResourceEstimates,mi as inspectVibe64WorkspaceSetup,
524
+ si as listGenesisTemplates,Mr as mergeArchitectureObservations,Ze as parseVibe64DeploymentLines,Tt as parseVibe64IntegrationSetupLines,
525
+ ce as parseVibe64OutputsLines,mt as parseVibe64ProjectServicesLines,bt as parseVibe64ResourceEstimatesLines,Y as parseVibe64WorkspaceSetupLines,
526
+ Jr as refreshGenesisCities,hi as renderGenesisPrompt,Nn as resolveVibe64OutputParameters,ci as setGenesisCollaboration,ai as setGenesisEngineeringProfile,
527
+ Vr as sourceExplanationGuidance,xr as sourceExplanationReviewGuidance,qr as syncGenesisAgentIntegrations,Hr as syncGenesisSkills,
528
+ Pr as validateArchitectureFacts,$r as validateArchitectureObservations,Qr as vibe64ConversationInstructions,J as vibe64Driver,
529
+ Cr as vibe64HostContextEnvironment,Xn as vibe64HostContextRegistry,ks as vibe64HostContextResolverPath,Ur as withGenesisCommandShim};