@bongos/core 1.19.1072 → 1.19.1074

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 (297) hide show
  1. package/.bongos-core.json +320 -465
  2. package/.claude/skills/feedback/SKILL.md +2 -2
  3. package/clients/bongos-client/README.md +1 -1
  4. package/clients/bongos-client/bongos-client.global.js +4 -60
  5. package/clients/bongos-client/index.cjs +4 -60
  6. package/clients/bongos-client/index.d.ts +5 -90
  7. package/clients/bongos-client/index.mjs +4 -60
  8. package/config/branding.neutral.json +1 -5
  9. package/config/modules.neutral.json +2 -3
  10. package/config/scheduled-routines.json +0 -2
  11. package/docs/adr/0145-free-hosted-project-tier-isolation-and-domain-separation.md +1 -0
  12. package/docs/adr/0285-a-shared-box-holds-about-twelve-projects-per-gb-and-memory-is-the-wall.md +1 -0
  13. package/docs/adr/0323-hosting-is-three-shapes-and-we-are-not-the-landlord.md +1 -1
  14. package/docs/adr/0327-a-cloud-host-runs-on-the-owners-account-and-the-key-is-borrowed.md +1 -1
  15. package/docs/adr/0341-the-page-is-the-unit-of-tweak-mode.md +6 -2
  16. package/docs/adr/0345-we-host-every-projects-hall-and-its-app-deploys-where-the-owner-chooses.md +94 -0
  17. package/docs/adr/README.md +2 -1
  18. package/docs/api/openapi.json +171 -1661
  19. package/docs/api-reference.md +9 -41
  20. package/docs/architecture.md +16 -1
  21. package/docs/branding-contract.md +0 -3
  22. package/docs/copy-inventory.md +454 -479
  23. package/docs/copy-registry.json +746 -978
  24. package/docs/file-map.md +5 -34
  25. package/docs/module-api-changelog.md +4 -0
  26. package/docs/modules-contract.md +13 -1
  27. package/docs/onboarding/diagrams/04-architecture.mmd +11 -22
  28. package/docs/onboarding/diagrams/README.md +3 -3
  29. package/docs/onboarding/diagrams/assertions.json +2 -22
  30. package/docs/onboarding/primer.md +9 -28
  31. package/docs/page-inventory.json +4 -1
  32. package/docs/page-readings.json +1032 -1077
  33. package/docs/recipes/render-pilot.md +29 -10
  34. package/migrations/core_257_module_store_registry.sql +87 -0
  35. package/migrations/core_258_drop_dev_box_tables.sql +55 -0
  36. package/modules/agents/module.json +1 -0
  37. package/modules/autonomy/module.json +1 -0
  38. package/modules/builder-settings/module.json +1 -0
  39. package/modules/builder-settings/render-prefs.js +4 -5
  40. package/modules/copy-desk/docx.js +78 -5
  41. package/modules/copy-desk/module.json +1 -0
  42. package/modules/copy-desk/routes/copy-desk.js +9 -9
  43. package/modules/copy-desk/tests/copy_docx.mjs +107 -1
  44. package/modules/copy-desk/tests/fixtures/word-docx.mjs +30 -0
  45. package/modules/discord/module.json +1 -0
  46. package/modules/economy/module.json +1 -0
  47. package/modules/economy/routes/credits.js +1 -2
  48. package/modules/government/catalog.js +13 -17
  49. package/modules/government/migrations/government_019_retire_box_permissions.sql +33 -0
  50. package/modules/government/module.json +1 -0
  51. package/modules/government/protected-surfaces.json +3 -11
  52. package/modules/government/resolver.js +3 -46
  53. package/modules/government/routes/government.js +0 -2
  54. package/modules/government/session-scopes.js +43 -83
  55. package/modules/government/session-scopes.json +8 -18
  56. package/modules/grading/module.json +1 -0
  57. package/modules/hall-ui/module.json +1 -0
  58. package/modules/hall-ui/public/board-lib.js +2 -2
  59. package/modules/hall-ui/public/builders.js +29 -40
  60. package/modules/hall-ui/public/collab.html +1 -1
  61. package/modules/hall-ui/public/collab.js +1 -1
  62. package/modules/hall-ui/public/diagrams.html +3 -3
  63. package/modules/hall-ui/public/dom-utils.js +1 -1
  64. package/modules/hall-ui/public/gate.js +2 -2
  65. package/modules/hall-ui/public/gate.states.json +1 -1
  66. package/modules/hall-ui/public/hall-render.js +43 -79
  67. package/modules/hall-ui/public/index.html +5 -1
  68. package/modules/hall-ui/public/modules.js +1 -0
  69. package/modules/hall-ui/public/oversight.css +5 -5
  70. package/modules/hall-ui/public/palette.js +0 -11
  71. package/modules/hall-ui/public/primer.js +1 -1
  72. package/modules/hall-ui/public/sessions.html +1 -1
  73. package/modules/hall-ui/public/settings-sessions.js +1 -1
  74. package/modules/hall-ui/public/settings.css +0 -1
  75. package/modules/hall-ui/public/settings.html +4 -33
  76. package/modules/hall-ui/public/settings.js +3 -33
  77. package/modules/hall-ui/public/settings.states.json +2 -2
  78. package/modules/hall-ui/public/studio.html +1 -1
  79. package/modules/hall-ui/public/style.css +10 -13
  80. package/modules/hall-ui/public/task.html +4 -1
  81. package/modules/hall-ui/public/task.js +36 -1
  82. package/modules/hall-ui/public/tweak-editor-lib.js +18 -1
  83. package/modules/hall-ui/public/tweak-editor.css +16 -0
  84. package/modules/hall-ui/public/tweak-editor.html +26 -3
  85. package/modules/hall-ui/public/tweak-editor.js +32 -1
  86. package/modules/hall-ui/public/work.js +1 -1
  87. package/modules/hall-ui/records/tweak-editor.md +1 -0
  88. package/modules/ideas/module.json +1 -0
  89. package/modules/lifecycle/db-claim-reads.js +1 -58
  90. package/modules/lifecycle/db-ship.js +0 -5
  91. package/modules/lifecycle/db.js +0 -4
  92. package/modules/lifecycle/kickoff-checklist.js +0 -4
  93. package/modules/lifecycle/lifecycle.js +0 -8
  94. package/modules/lifecycle/module.json +1 -0
  95. package/modules/lifecycle/routes/tasks.js +5 -7
  96. package/modules/memory/module.json +1 -0
  97. package/modules/npm-release/module.json +1 -0
  98. package/modules/onboarding/module.json +1 -0
  99. package/modules/onboarding/onboarding-state.js +17 -36
  100. package/modules/onboarding/routes/access-requests.js +3 -3
  101. package/modules/platform-identity/module.json +1 -0
  102. package/modules/platform-identity/platform-identity.js +13 -5
  103. package/modules/platform-identity/routes/sso.js +2 -2
  104. package/modules/platform-identity/tests/platform-identity.mjs +17 -3
  105. package/modules/provisioning/module.json +1 -0
  106. package/modules/provisioning/provisioning.js +2 -2
  107. package/modules/provisioning/starter-bundles.js +5 -25
  108. package/modules/public-landing/module.json +1 -0
  109. package/modules/public-landing/public/assets/cosmos.css +1 -1
  110. package/modules/public-landing/public/contact.html +1 -1
  111. package/modules/public-landing/public/privacy.html +1 -1
  112. package/modules/public-landing/public/projects.html +101 -32
  113. package/modules/public-landing/public/projects.probes.json +2 -2
  114. package/modules/public-landing/public/projects.states.json +4 -3
  115. package/modules/public-landing/public/terms.html +1 -1
  116. package/modules/security/module.json +1 -0
  117. package/modules/sessions/module.json +1 -0
  118. package/modules/specialities/module.json +1 -0
  119. package/modules/status-ui/module.json +1 -0
  120. package/modules/ui-design/module.json +1 -0
  121. package/package-lock.json +2 -2
  122. package/package.json +1 -1
  123. package/release-notes.json +84 -0
  124. package/scripts/gds/artifact-format.js +203 -0
  125. package/scripts/gds/audit-authorship.sh +1 -13
  126. package/scripts/gds/claim.js +0 -15
  127. package/scripts/gds/cli-lib.js +8 -8
  128. package/scripts/gds/diagram-facts.js +12 -23
  129. package/scripts/gds/do-api.js +13 -80
  130. package/scripts/gds/doc-cli-guard.js +2 -0
  131. package/scripts/gds/doctor.js +1 -1
  132. package/scripts/gds/feedback-latest.js +139 -9
  133. package/scripts/gds/fitness-checks-identity.js +2 -7
  134. package/scripts/gds/fitness-checks-write-validation.js +4 -0
  135. package/scripts/gds/fitness-ratchets.js +4 -4
  136. package/scripts/gds/fitness.js +10 -10
  137. package/scripts/gds/gen-diagrams.js +49 -71
  138. package/scripts/gds/http-api-client.js +12 -19
  139. package/scripts/gds/init.js +1 -1
  140. package/scripts/gds/lint-infra-exec.js +1 -1
  141. package/scripts/gds/local-preview-lib.js +8 -39
  142. package/scripts/gds/local-preview.js +2 -15
  143. package/scripts/gds/migration-namespace.js +3 -3
  144. package/scripts/gds/module-artifact.js +212 -0
  145. package/scripts/gds/module.js +95 -6
  146. package/scripts/gds/package-core.js +5 -116
  147. package/scripts/gds/provision-config.js +2 -2
  148. package/scripts/gds/provision-net.js +2 -3
  149. package/scripts/gds/provision.js +9 -9
  150. package/scripts/gds/publish-manifest.js +1 -2
  151. package/scripts/gds/regen-instance-docs.js +1 -1
  152. package/scripts/gds/run-unit-tests.js +2 -16
  153. package/scripts/gds/sandbox-stage.js +39 -341
  154. package/scripts/gds/ship-flow.js +6 -6
  155. package/scripts/gds/ship-land.js +3 -4
  156. package/scripts/gds/ship-regen.js +10 -41
  157. package/scripts/gds/ship.js +4 -24
  158. package/scripts/gds/start.js +0 -15
  159. package/scripts/hall-preview/README.md +5 -5
  160. package/scripts/hall-preview/server.js +6 -6
  161. package/scripts/render-diagrams.sh +1 -1
  162. package/src/bongos/api-errors.js +1 -1
  163. package/src/bongos/auth-github.js +2 -3
  164. package/src/bongos/auth.js +51 -126
  165. package/src/bongos/db-kernel.js +2 -3
  166. package/src/bongos/db.js +5 -28
  167. package/src/bongos/module-scope-map.js +14 -29
  168. package/src/bongos/module-store.js +141 -0
  169. package/src/bongos/route-rank-check.js +3 -16
  170. package/src/bongos/routes/auth.js +0 -116
  171. package/src/bongos/routes/builders.js +5 -15
  172. package/src/bongos/routes/instance.js +8 -14
  173. package/src/bongos/routes/me.js +6 -22
  174. package/src/bongos/routes/modules.js +83 -0
  175. package/src/bongos/routes.js +5 -0
  176. package/src/module-api.js +13 -6
  177. package/src/module-loader/catalog.js +3 -0
  178. package/src/module-loader/loader.js +4 -4
  179. package/src/module-loader/manifest-schema.js +15 -7
  180. package/src/module-seams.js +2 -3
  181. package/src/modules.js +42 -14
  182. package/tests/agents_spend_guard.mjs +1 -1
  183. package/tests/api_client.mjs +0 -15
  184. package/tests/auth_page_gate.mjs +10 -10
  185. package/tests/canonical_profile_url.mjs +1 -3
  186. package/tests/claim_action.mjs +4 -1
  187. package/tests/claim_from_task_and_home.mjs +127 -0
  188. package/tests/consumer_layout_boot.mjs +2 -0
  189. package/tests/copy_desk_page_docx.mjs +33 -2
  190. package/tests/core_upgrade_runner.mjs +6 -6
  191. package/tests/deploy_divergence_line.mjs +11 -11
  192. package/tests/diagram_facts_offset.mjs +1 -1
  193. package/tests/do_api.mjs +106 -0
  194. package/tests/feedback_latest.mjs +122 -0
  195. package/tests/fitness.mjs +44 -42
  196. package/tests/gate_approvals.mjs +0 -1
  197. package/tests/go_live.mjs +3 -3
  198. package/tests/government_abuse_matrix.mjs +20 -19
  199. package/tests/government_ownership_scope.mjs +33 -35
  200. package/tests/government_parity.mjs +2 -2
  201. package/tests/government_protected_surfaces.mjs +56 -37
  202. package/tests/government_require_permission.mjs +3 -3
  203. package/tests/government_seed.mjs +37 -4
  204. package/tests/government_session_scope.mjs +92 -366
  205. package/tests/hall_error_envelope.mjs +4 -0
  206. package/tests/hall_landing_boot.mjs +4 -1
  207. package/tests/hall_palette.mjs +1 -16
  208. package/tests/hall_record_world.mjs +6 -0
  209. package/tests/hall_tweak_editor.mjs +52 -1
  210. package/tests/host_topology_skips.mjs +1 -2
  211. package/tests/html_comment_nesting.mjs +137 -0
  212. package/tests/infra_exec_paths.mjs +9 -10
  213. package/tests/init.mjs +4 -5
  214. package/tests/instance_manifest.mjs +18 -25
  215. package/tests/kickoff_checklist.mjs +1 -1
  216. package/tests/lib_sh_resolution.mjs +0 -221
  217. package/tests/local_preview.mjs +0 -12
  218. package/tests/module-scope-map.mjs +9 -9
  219. package/tests/module_catalog.mjs +1 -1
  220. package/tests/module_cli.mjs +15 -15
  221. package/tests/module_contributions.mjs +6 -6
  222. package/tests/module_loader.mjs +6 -6
  223. package/tests/module_manifest.mjs +13 -4
  224. package/tests/module_store_publish.mjs +307 -0
  225. package/tests/module_store_publish_route.mjs +121 -0
  226. package/tests/module_store_registry_migration.mjs +70 -0
  227. package/tests/modules.mjs +56 -26
  228. package/tests/onboarding_route_signals.mjs +21 -31
  229. package/tests/onboarding_state.mjs +35 -49
  230. package/tests/permission_path.mjs +0 -3
  231. package/tests/platform_boot.mjs +1 -2
  232. package/tests/profile_route.mjs +1 -6
  233. package/tests/projects_hub.mjs +5 -5
  234. package/tests/projects_hub_app_step.mjs +138 -0
  235. package/tests/projects_hub_module_picker.mjs +2 -2
  236. package/tests/projects_hub_pre_uat.mjs +4 -5
  237. package/tests/provision.mjs +7 -7
  238. package/tests/provisioning_starter_bundles.mjs +0 -22
  239. package/tests/publish_branch_route.mjs +10 -18
  240. package/tests/publish_manifest.mjs +1 -2
  241. package/tests/rank_tier_single_source.mjs +1 -13
  242. package/tests/repo_map.mjs +3 -4
  243. package/tests/runner_drift.mjs +3 -21
  244. package/tests/sandbox_stage.mjs +57 -390
  245. package/tests/session_rename_fallback.mjs +0 -21
  246. package/tests/ship_error_shape.mjs +1 -1
  247. package/tests/task_visual_slots.mjs +31 -0
  248. package/tests/terms_acceptance.mjs +1 -1
  249. package/tests/upgrade.mjs +4 -4
  250. package/tests/watch_sealed_floor.mjs +0 -1
  251. package/tests/wizard_draft_resume.mjs +2 -2
  252. package/tests/wizard_intent_resume.mjs +21 -10
  253. package/tests/wizard_preselect_why.mjs +18 -18
  254. package/docs/onboarding/browser-terminal-guide.md +0 -73
  255. package/docs/recipes/managed-settings-remote-control.md +0 -416
  256. package/modules/dev-box/CLAUDE.md +0 -15
  257. package/modules/dev-box/box-access.js +0 -623
  258. package/modules/dev-box/box-credential.js +0 -94
  259. package/modules/dev-box/box-onboard.js +0 -486
  260. package/modules/dev-box/boxes.js +0 -1038
  261. package/modules/dev-box/db.js +0 -39
  262. package/modules/dev-box/module.json +0 -19
  263. package/modules/dev-box/routes/box.js +0 -1223
  264. package/scripts/gds/box-auth-check.js +0 -160
  265. package/scripts/gds/box-infra.js +0 -321
  266. package/scripts/gds/box-sync.js +0 -216
  267. package/scripts/gds/box.js +0 -1332
  268. package/scripts/gds/cf-tunnel.js +0 -558
  269. package/scripts/gds/smoke-box.sh +0 -150
  270. package/scripts/gds/tree-preflight.js +0 -241
  271. package/src/bongos/app-pair.js +0 -172
  272. package/tests/app_pair.mjs +0 -168
  273. package/tests/box_access.mjs +0 -578
  274. package/tests/box_auth_check.mjs +0 -114
  275. package/tests/box_code_staleness.mjs +0 -129
  276. package/tests/box_connect_e2e.mjs +0 -196
  277. package/tests/box_cost.mjs +0 -70
  278. package/tests/box_credential.mjs +0 -125
  279. package/tests/box_dns_repoint.mjs +0 -153
  280. package/tests/box_env.mjs +0 -64
  281. package/tests/box_host_keys.mjs +0 -126
  282. package/tests/box_infra_resolve.mjs +0 -246
  283. package/tests/box_onboard.mjs +0 -317
  284. package/tests/box_scope_session.mjs +0 -119
  285. package/tests/box_sweep_docs.mjs +0 -119
  286. package/tests/box_sync.mjs +0 -55
  287. package/tests/box_sync_scope_report.mjs +0 -126
  288. package/tests/box_task_scope.mjs +0 -169
  289. package/tests/box_task_scope_pause.mjs +0 -66
  290. package/tests/box_terminal_ssrf.mjs +0 -96
  291. package/tests/boxes.mjs +0 -1585
  292. package/tests/cf_ruleset_preflight.mjs +0 -142
  293. package/tests/cf_tunnel.mjs +0 -496
  294. package/tests/docs_scrubber_damage.mjs +0 -111
  295. package/tests/module_scope_active_claims.mjs +0 -94
  296. package/tests/ship_api_client_pathspec.mjs +0 -100
  297. package/tests/tree_preflight.mjs +0 -243
@@ -103,6 +103,7 @@ const REPO_ROOT = path.resolve(__dirname, '..', '..');
103
103
  // Reuse — never re-type. The core definition, the redaction, and the tree parser
104
104
  // all already exist and are unit-tested at their homes.
105
105
  const { isPublishable, PUBLISH_ALLOWLIST } = require(path.join(REPO_ROOT, 'scripts/gds/publish-manifest.js'));
106
+ const { sha256hex, canonicalTreeHash, normalizeMode, octal, tarChecksum, ustarHeader, splitUstarName, buildTar } = require('./artifact-format');
106
107
  const {
107
108
  buildRedactionRules, collectSensitiveLiterals, findLeaks,
108
109
  } = require(path.join(REPO_ROOT, 'scripts/gds/mirror-redact.js'));
@@ -144,9 +145,6 @@ function coreVersion() {
144
145
  // Pure helpers (exported for tests — no I/O, no git, no network)
145
146
  // ---------------------------------------------------------------------------
146
147
 
147
- function sha256hex(buf) {
148
- return crypto.createHash('sha256').update(buf).digest('hex');
149
- }
150
148
 
151
149
  // ---------------------------------------------------------------------------
152
150
  // CONSUMER-CORE extraction policy (task 1824) — the file-classification layer.
@@ -418,31 +416,8 @@ function prunePackageLock(sourceLock, { name, version, rootRanges, rootDepNames
418
416
  };
419
417
  }
420
418
 
421
- // The PIN. A canonical, compression-independent digest of the core tree: one
422
- // "path\0mode\0filesha256\n" line per file, byte-sorted by path. A consumer
423
- // recomputes this from the unpacked tree to prove an install matches the pin.
424
- // `files` = [{ path, mode, sha256 }]. Modes are normalized so the pin is stable
425
- // regardless of the checkout's umask.
426
- function canonicalTreeHash(files) {
427
- const lines = (files || [])
428
- .map((f) => `${f.path}\u0000${normalizeMode(f.mode)}\u0000${f.sha256}`)
429
- .sort();
430
- return sha256hex(Buffer.from(lines.join('\n') + '\n', 'utf8'));
431
- }
432
-
433
- // Collapse ANY mode form — git's 100644/100755, our canonical 0000644/0000755, or a
434
- // raw filesystem octal string like "755" — to two canonical tar modes, keyed only on
435
- // the executable bit. IDEMPOTENT (normalizeMode(normalizeMode(x)) === normalizeMode(x))
436
- // AND exec-aware, so the tree pin reproduces byte-identically whether a consumer
437
- // recomputes it from the manifest's files[] (already-canonical modes) or from the
438
- // unpacked tree's stat() modes. Expects a STRING (git mode / canonical mode / octal).
439
- function normalizeMode(mode) {
440
- const s = String(mode);
441
- if (s === '100755' || s === '0000755' || s === '755') return '0000755';
442
- const n = parseInt(s, 8);
443
- if (Number.isFinite(n) && (n & 0o111)) return '0000755';
444
- return '0000644';
445
- }
419
+ // The PIN (canonicalTreeHash) and normalizeMode live in scripts/gds/artifact-format.js
420
+ // (task 1004271) — the module store verifies with the same functions.
446
421
 
447
422
  // The pin manifest (WITHOUT tarball.* — added by withTarballInfo for the side-car).
448
423
  function buildCoreManifest({
@@ -478,94 +453,8 @@ function tarballName(version) { return `${ARTIFACT_NAME}-${version}.tgz`; }
478
453
  function manifestName(version) { return `${ARTIFACT_NAME}-${version}.manifest.json`; }
479
454
  function stageDirName(version) { return `${ARTIFACT_NAME}-${version}`; }
480
455
 
481
- // ---- a minimal, correct, DETERMINISTIC ustar+gzip writer (node-only, #686) ----
482
- // Deterministic (fixed mtime/uid/gid, normalized mode, sorted entries) so the same
483
- // source yields byte-identical bytes — a bonus over the tree_sha256 pin. Long paths
484
- // use the ustar name/prefix split, falling back to a GNU 'L' longname entry (read
485
- // by GNU tar, bsdtar/macOS, and node-tar) for the rare path that won't split.
486
-
487
- function octal(n, width) {
488
- // width-1 octal digits, zero-padded, then a NUL — the classic numeric field.
489
- return Buffer.from(n.toString(8).padStart(width - 1, '0').slice(-(width - 1)) + '\0', 'ascii');
490
- }
491
-
492
- function tarChecksum(block) {
493
- let sum = 0;
494
- for (let i = 0; i < 512; i++) sum += (i >= 148 && i < 156) ? 0x20 : block[i];
495
- return sum;
496
- }
497
-
498
- // Build one 512-byte ustar header. `name`/`prefix` must already fit (<=100 / <=155).
499
- function ustarHeader({ name, prefix = '', mode, size, typeflag }) {
500
- const h = Buffer.alloc(512, 0);
501
- h.write(name, 0, 100, 'utf8');
502
- octal(mode, 8).copy(h, 100);
503
- octal(0, 8).copy(h, 108); // uid
504
- octal(0, 8).copy(h, 116); // gid
505
- octal(size, 12).copy(h, 124);
506
- octal(0, 12).copy(h, 136); // mtime = 0 (determinism)
507
- h.write(typeflag, 156, 1, 'ascii');
508
- h.write('ustar\0', 257, 6, 'ascii');
509
- h.write('00', 263, 2, 'ascii');
510
- if (prefix) h.write(prefix, 345, 155, 'utf8');
511
- // checksum field: 6 octal digits + NUL + space, computed with the field = spaces.
512
- const cksum = tarChecksum(h);
513
- h.write(cksum.toString(8).padStart(6, '0').slice(-6) + '\0 ', 148, 8, 'ascii');
514
- return h;
515
- }
516
-
517
- // Split a >100-byte path into { name<=100, prefix<=155 } at a '/' boundary, or
518
- // return null if no split fits (→ caller uses the GNU longname fallback).
519
- function splitUstarName(fullPath) {
520
- const bytes = Buffer.byteLength(fullPath, 'utf8');
521
- if (bytes <= 100) return { name: fullPath, prefix: '' };
522
- // Find the LAST '/' such that the tail (after it) is <=100 and the head <=155.
523
- for (let i = fullPath.length - 1; i > 0; i--) {
524
- if (fullPath[i] !== '/') continue;
525
- const prefix = fullPath.slice(0, i);
526
- const name = fullPath.slice(i + 1);
527
- if (Buffer.byteLength(name, 'utf8') <= 100 && Buffer.byteLength(prefix, 'utf8') <= 155) {
528
- return { name, prefix };
529
- }
530
- }
531
- return null;
532
- }
533
-
534
- function padTo512(buf) {
535
- const rem = buf.length % 512;
536
- return rem === 0 ? buf : Buffer.concat([buf, Buffer.alloc(512 - rem, 0)]);
537
- }
538
-
539
- // GNU longname pseudo-entry: a header (typeflag 'L', name '././@LongLink') whose
540
- // BODY is the full path (incl. trailing NUL), immediately followed by the real
541
- // file entry. Read by GNU tar, bsdtar/macOS, and node-tar.
542
- function gnuLongName(fullPath) {
543
- const payload = Buffer.from(fullPath + '\0', 'utf8');
544
- const hdr = ustarHeader({ name: '././@LongLink', mode: 0o644, size: payload.length, typeflag: 'L' });
545
- return Buffer.concat([hdr, padTo512(payload)]);
546
- }
547
-
548
- // entries: [{ name, mode, buf }] — `name` includes the TAR_ROOT prefix. Returns a
549
- // gzip'd tar Buffer. Pure + deterministic given sorted entries.
550
- function buildTar(entries) {
551
- const sorted = [...entries].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
552
- const chunks = [];
553
- for (const e of sorted) {
554
- const mode = e.mode & 0o7777;
555
- const split = splitUstarName(e.name);
556
- if (split) {
557
- chunks.push(ustarHeader({ name: split.name, prefix: split.prefix, mode, size: e.buf.length, typeflag: '0' }));
558
- } else {
559
- chunks.push(gnuLongName(e.name));
560
- chunks.push(ustarHeader({ name: e.name.slice(0, 100), mode, size: e.buf.length, typeflag: '0' }));
561
- }
562
- chunks.push(padTo512(e.buf));
563
- }
564
- // two zero blocks terminate the archive
565
- chunks.push(Buffer.alloc(1024, 0));
566
- const tar = Buffer.concat(chunks);
567
- return zlib.gzipSync(tar, { level: 9 });
568
- }
456
+ // The ustar+gzip writer (buildTar and its header helpers) lives in
457
+ // scripts/gds/artifact-format.js (task 1004271), shared with the module store.
569
458
 
570
459
  // ---- the git-LESS source: enumerate the working tree (task 1003995) --------
571
460
  //
@@ -83,7 +83,7 @@ const CONFIG = {
83
83
  tag: process.env.PROVISION_TAG || 'cloudbongos-instance',
84
84
  doToken: process.env.DO_API_TOKEN || null,
85
85
  sshKeyIds: (process.env.BOX_SSH_KEY_IDS || '').split(',').map((s) => s.trim()).filter(Boolean),
86
- // The Cloudflare DNS hook (the SAME infra/box-dns-cloudflare.sh box.js uses).
86
+ // The Cloudflare DNS hook (the instance's infra/box-dns-cloudflare.sh).
87
87
  // P4 (#1945) formalizes the UPSERT: point the instance's domain at the target
88
88
  // public IP (below), in the domain's OWN Cloudflare zone, proxied=false (see
89
89
  // dnsUpsertEnv). No hook configured → DNS is skipped (a co-tenant instance is
@@ -179,7 +179,7 @@ const MANIFEST_VERIFY_TRIES = numEnv('PROVISION_MANIFEST_VERIFY_TRIES', 90);
179
179
  const MANIFEST_VERIFY_INTERVAL_MS = numEnv('PROVISION_MANIFEST_VERIFY_INTERVAL_MS', 2000);
180
180
 
181
181
  // ---------------------------------------------------------------------------
182
- // Lazy dep load (so --help / arg errors need no Postgres) — the box.js pattern.
182
+ // Lazy dep load (so --help / arg errors need no Postgres).
183
183
  // ---------------------------------------------------------------------------
184
184
  let _deps;
185
185
  function loadDeps() {
@@ -130,8 +130,7 @@ function dnsUpsertEnv(inst, { publicIp, zone, proxied = false } = {}) {
130
130
  }
131
131
 
132
132
  // The RFC 5737 TEST-NET-1 sentinel a released hostname is parked at (task
133
- // 1003237) — the shape scripts/gds/box-infra.js proved for a torn-down box
134
- // (idea 309 / task 1234). 192.0.2.1 is reserved for documentation and is
133
+ // 1003237, first proven in task 1234). 192.0.2.1 is reserved for documentation and is
135
134
  // GUARANTEED never routable, so a name parked here can never dial platform
136
135
  // infra or a recycled address.
137
136
  const DNS_BLACKHOLE_IP = '192.0.2.1';
@@ -141,7 +140,7 @@ const DNS_BLACKHOLE_IP = '192.0.2.1';
141
140
  // address UPSERTed at the platform's IP for a project that no longer answers
142
141
  // there — the ADR 0181 §2 leak — and this is how the runner lets it go.
143
142
  //
144
- // REPOINT, not delete, for the reason box-infra.js records: deleting a name
143
+ // REPOINT, not delete (task 1234): deleting a name
145
144
  // opens an NXDOMAIN window that resolvers negative-cache for the zone's SOA
146
145
  // neg-TTL (~30 min, not editable), so a client that queried mid-gap stays
147
146
  // broken long after. A name that always resolves — to a guaranteed-dead host —
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  // scripts/gds/provision.js — the INSTANCE-provisioning control-plane runner
4
- // (ADR 0111 §2/§3, BONGOS-V1 goal 32, task #1944). A sibling of box.js.
4
+ // (ADR 0111 §2/§3, BONGOS-V1 goal 32, task #1944).
5
5
  //
6
6
  // WHAT IT IS. The trust-boundary-safe executor for the `provisioning` module.
7
7
  // The internet-facing web tier can only ENQUEUE a provision/teardown intent into
@@ -20,7 +20,7 @@
20
20
  // → Caddy site block + reload
21
21
  // → /healthz
22
22
  //
23
- // DESIGN — inherited from box.js / do-api.js:
23
+ // DESIGN — shared with do-api.js:
24
24
  // • DRY-RUN by DEFAULT. Without --apply, every step only PRINTS the command it
25
25
  // WOULD run and mutates nothing (no DB writes, no shell, no cloud call). The
26
26
  // LIVE leg is an explicit operator/timer `--apply`.
@@ -37,8 +37,8 @@
37
37
  // • The step-command generators are PURE functions (exported) → the SAME command
38
38
  // strings drive local exec (co-tenant) AND the dedicated droplet's cloud-init.
39
39
  //
40
- // This is control-plane ops tooling (scripts/), so — like box.js — it may require
41
- // the core + a module's data slice directly (a module may not, but a CLI may). It
40
+ // This is control-plane ops tooling (scripts/), so it may require the core + a
41
+ // module's data slice directly (a module may not, but a CLI may). It
42
42
  // reuses modules/provisioning/provisioning.js (the intent queue + state) and
43
43
  // scripts/gds/do-api.js (the shared DO client extracted in task #1943).
44
44
 
@@ -336,7 +336,7 @@ async function provisionInstance(inst, deps) {
336
336
  if (inst.hosting_shape === 'dedicated') {
337
337
  // Dedicated droplet: create it + settle its public IP via the shared DO client
338
338
  // (do-api, dry-run-default). The on-droplet app standup rides cloud-init
339
- // user-data built from the SAME step commands below (mirrors box.js). For the
339
+ // user-data built from the SAME step commands below. For the
340
340
  // dry-run plan we surface the intent; --apply creates the droplet.
341
341
  const doApi = deps.doApi;
342
342
  log(' [server] dedicated droplet');
@@ -1249,8 +1249,8 @@ async function drainOAuthManifests(deps) {
1249
1249
  }
1250
1250
 
1251
1251
  // ---------------------------------------------------------------------------
1252
- // run-intents — drain provisioning_intents (the systemd-timer entry point). The
1253
- // box.js cmdRunIntents shape: dry-run lists the pending queue; --apply claims +
1252
+ // run-intents — drain provisioning_intents (the systemd-timer entry point).
1253
+ // Dry-run lists the pending queue; --apply claims +
1254
1254
  // executes each, with a poison-attempt cap. FOR UPDATE SKIP LOCKED (in
1255
1255
  // provisioning.claimNextIntent) makes overlapping ticks safe. It ALSO drains the
1256
1256
  // GitHub-App-Manifest conversion queue on the same tick (task 2080).
@@ -1324,8 +1324,8 @@ async function cmdRunIntents(deps) {
1324
1324
 
1325
1325
  // A light drift reconcile: surface instances stuck mid-flight (provisioning /
1326
1326
  // tearing_down) with no open intent — a runner died mid-op. Reports; --apply
1327
- // re-enqueues a fresh intent so the next tick retries. (Full droplet-vs-DB drift,
1328
- // the box.js reconcile-drift analogue, is a later hardening.)
1327
+ // re-enqueues a fresh intent so the next tick retries. (Full droplet-vs-DB drift
1328
+ // is a later hardening.)
1329
1329
  async function cmdReconcile(deps) {
1330
1330
  const { db, provisioning, log, apply } = deps;
1331
1331
  const { rows } = await db.query(
@@ -68,9 +68,8 @@ const PUBLISH_ALLOWLIST = [
68
68
  'modules/hall-ui/',
69
69
  'modules/status-ui/',
70
70
  'modules/public-landing/', // the front door (task 1003322, ADR 0218) — the repo-root public-landing/ entry this replaces was always here, and for the same reason: default:true, and it is the only thing an instance serves at its apex root. Omit it and a released core answers the game-less 404 tail on its own home page.
71
- 'modules/dev-box/',
72
71
  'modules/discord/',
73
- 'modules/provisioning/', // instance-hosting control plane — CORE like its sibling dev-box (same do-api/cf-tunnel toolchain, all core). Reclassified IN so the core CLI scripts/gds/provision.js resolves it from the core package post-split, not a MODULE_NOT_FOUND (task 2135). default:false — shipped ≠ enabled.
72
+ 'modules/provisioning/', // instance-hosting control plane — CORE (its do-api toolchain is core). Reclassified IN so the core CLI scripts/gds/provision.js resolves it from the core package post-split, not a MODULE_NOT_FOUND (task 2135). default:false — shipped ≠ enabled.
74
73
  'modules/agents/', // the declarative agent registry + spawn seam (goal 1000038) — CORE: its own manifest declares maintenance.status 'core-maintained', and it consumes the core `grade` port, so a released core without it cannot run the MAS machinery the methodology describes. default:false — shipped is not enabled (ADR 0083), exactly like provisioning + platform-identity below. Omitted at module-creation time (tasks 1002485/1002486): the omission was invisible until tests/agents_spawn.mjs became the first PUBLISHABLE file to import it and the R89 boundary guard caught it (task 1002489).
75
74
  'modules/npm-release/', // the deploy page's "where is the work" + version history (task 1002622). default:false — on only in the hall that publishes the core. MUST be here: modules/hall-ui/ ships as one subtree, so a released core without this carries deploy.js's loader and the #nr-work mounts with no routes behind them — the copy-desk asymmetry above.
76
75
  'modules/platform-identity/', // hub identity provider (ADR 0141) — ships in core, enabled ONLY on the hub (cloudbongos.com). MUST be here or the hub's enabledModules() throws "unknown module" and provision.js's federation load MODULE_NOT_FOUNDs (task 1002235, same rationale as provisioning above). default:false — shipped ≠ enabled; a vanilla/self-hosted instance never turns it on.
@@ -3,7 +3,7 @@
3
3
  // regen-instance-docs.js — regenerate a STANDALONE instance's live navigation docs (task 1002314).
4
4
  //
5
5
  // THE GAP. On the monorepo, the gitignored whole-file navigation docs are regenerated at deploy by
6
- // scripts/deploy/deploy-prod.sh + infra/box-source-fetch.sh (ADR 0110 §2/§3). STANDALONE instances
6
+ // scripts/deploy/deploy-prod.sh (ADR 0110 §2/§3). STANDALONE instances
7
7
  // (ADR 0108 — their own lean repo with @bongos/core vendored) never got that step: their bespoke
8
8
  // pull-deploy regenerated NOTHING, so a fresh instance shipped with an empty docs/ and nothing kept
9
9
  // the session-log index live. This script is the STANDALONE analogue of deploy-prod.sh's regen block
@@ -93,7 +93,7 @@ const INTEGRATION = new Set([
93
93
  // DB-free route test can only assert the shape of.
94
94
  'community_leaderboard_db',
95
95
  'asset_version', 'auth_flow_slice1', 'backfill_sessions', 'bfg', 'bfg_write',
96
- 'box_connect_e2e', 'box_onboard', 'boxes', 'cf_tunnel', 'cli_token_reissue',
96
+ 'cli_token_reissue',
97
97
  // consumer_layout_boot builds the core .tgz, `npm install`s it, and boots a live
98
98
  // platform-server (task 2142), then installs the package from its own shipped lockfile,
99
99
  // migrates brand-new EMPTY databases and serves a database-backed route from one (task
@@ -398,20 +398,6 @@ function discoverModuleTests({ modulesDir = MODULES_DIR, isEnabled = isModuleEna
398
398
  // above, the real repair is for the test to establish the state it needs instead of
399
399
  // inheriting whatever ran before it.
400
400
  //
401
- // THE THREE DEV-BOX TESTS ARE PARKED, NOT DELETED, and that reverses a first pass
402
- // of this task. The owner ruled that dev-box work can go, and boxes / box_onboard /
403
- // box_connect_e2e were duly deleted — but modules/dev-box/ is still present, still
404
- // mounted and unmodified by that change, and those files carry the only regression
405
- // coverage for LIVE guards: the setBoxState column allowlist (SQL injection), the
406
- // rank/authz floors, the spoofed X-Forwarded-Host that must never reach the served
407
- // connect.sh, and the authorized_keys command= / embedded-newline rejections.
408
- // Deleting a security regression test for code that still runs is not retirement,
409
- // it is removing the alarm and leaving the door. modules/dev-box/CLAUDE.md also
410
- // still names boxes + box_onboard as that module's required suite, and
411
- // scripts/gds/smoke-box.sh still invokes all three by path — deleting the files
412
- // turned that script into an immediate MODULE_NOT_FOUND. They come out when the
413
- // module does, in the change that removes it.
414
- //
415
401
  // consumer_layout_boot LEFT THIS LIST under task 1002863. Its "missing core tarball" was
416
402
  // package-core's fail-closed leak gate reading the lane's throwaway database password (the
417
403
  // word postgres, present in hundreds of core files) as a leaked credential and refusing to
@@ -421,7 +407,7 @@ function discoverModuleTests({ modulesDir = MODULES_DIR, isEnabled = isModuleEna
421
407
  // now says out loud.
422
408
  const INTEGRATION_PARKED = new Set([
423
409
  'acclaim_feed_evidence_db',
424
- 'bfg', 'bfg_write', 'box_connect_e2e', 'box_onboard', 'boxes',
410
+ 'bfg', 'bfg_write',
425
411
  'claim_gate_open_blocker', 'claim_gate_rebase',
426
412
  'clawback_confirmed_backlog', 'copy_desk_flags_db',
427
413
  'government_board_membership_db', 'handle_machinery', 'hub_profile_leak',