@bongos/core 1.20.49 → 1.20.50

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 (33) hide show
  1. package/.bongos-core.json +55 -35
  2. package/.claude/skills/new-project/SKILL.md +5 -0
  3. package/clients/bongos-client/index.d.ts +1 -1
  4. package/docs/api/openapi.json +3 -0
  5. package/docs/api-reference.md +1 -1
  6. package/docs/copy-inventory.md +314 -294
  7. package/docs/copy-registry.json +560 -378
  8. package/docs/module-api-changelog.md +2 -0
  9. package/docs/page-inventory.json +5 -1
  10. package/docs/page-readings.json +538 -521
  11. package/modules/platform-identity/routes/sso.js +5 -0
  12. package/modules/provisioning/migrations/provisioning_033_terms_ack.sql +33 -0
  13. package/modules/provisioning/onboard-plan.js +5 -0
  14. package/modules/provisioning/provisioning.js +7 -4
  15. package/modules/provisioning/routes/provisioning.js +3 -3
  16. package/modules/provisioning/terms-ack.js +36 -0
  17. package/modules/public-landing/public/projects.html +226 -77
  18. package/modules/public-landing/public/projects.probes.json +8 -2
  19. package/modules/public-landing/public/projects.states.json +16 -12
  20. package/modules/ui-design/kit/serve.js +6 -0
  21. package/package-lock.json +2 -2
  22. package/package.json +1 -1
  23. package/release-notes.json +6 -0
  24. package/src/module-api.js +1 -1
  25. package/tests/projects_hub.mjs +4 -2
  26. package/tests/projects_hub_app_status.mjs +1 -1
  27. package/tests/projects_hub_app_step.mjs +9 -9
  28. package/tests/projects_hub_module_picker.mjs +7 -7
  29. package/tests/projects_hub_pre_uat.mjs +4 -1
  30. package/tests/provisioning_terms_ack.mjs +216 -0
  31. package/tests/wizard_draft_resume.mjs +4 -4
  32. package/tests/wizard_front_door.mjs +271 -0
  33. package/tests/wizard_intent_resume.mjs +31 -19
@@ -25,6 +25,7 @@ const hubKeys = require('../hub-keys');
25
25
  const hubDevice = require('../hub-device');
26
26
  // The D7 applicant-profile read (task 1002972) and the echo that gates it.
27
27
  const applicantProfile = require('../applicant-profile');
28
+ const terms = require('../terms-acceptance');
28
29
  const applicationEcho = require('../application-echo');
29
30
  const instanceFeedback = require('../instance-feedback');
30
31
 
@@ -204,6 +205,10 @@ function registerSeams() {
204
205
  // Floors on the EXISTENCE predicate, not the rollup one: hide_stats
205
206
  // suppresses numbers, never addressability.
206
207
  getPublicHandle: (githubId) => canonicalProfile.getPublicHandle(githubId, { pool }),
208
+ // task 1004417 (BV2.PS05): the terms version /terms states, read by provisioning
209
+ // when a founder ticks the create wizard's terms box. A READ of the constant only —
210
+ // it stamps nothing on any account (that stays terms-acceptance.js's alone).
211
+ termsVersion: () => terms.TERMS_VERSION,
207
212
  });
208
213
  }
209
214
  }
@@ -0,0 +1,33 @@
1
+ -- provisioning_033_terms_ack.sql — the founder's terms acknowledgement, kept on the project
2
+ -- (task 1004417, BV2.PS05; goal 1000121, spec docs/specs/bongos-v2-project-startup.md).
3
+ --
4
+ -- WHY THIS EXISTS. The create wizard now opens on a terms screen: the founder ticks "I can
5
+ -- sign legally, or can get a signature, for the use of this platform, and I acknowledge the
6
+ -- terms and conditions" before anything else is asked. The owner chose (2026-09-30) to keep
7
+ -- that record ON THE PROJECT, not on the person's platform account: the account-level stamp
8
+ -- is ADR 0213's, written only at a witnessed sign-in (and task 1003361 adds the hub's own
9
+ -- sign-in as its second capture point). This one says who founded WHICH project under WHICH
10
+ -- text, which a later terms revision needs to know per project.
11
+ --
12
+ -- WHAT IT ADDS.
13
+ -- provisioning_instances.terms_ack_at — when the create that ticked the box was filed.
14
+ -- provisioning_instances.terms_ack_version — the terms version the SERVER stamped: read from
15
+ -- platform-identity's TERMS_VERSION through the platform-identity.hub port, never from the
16
+ -- request body, so a caller cannot record agreement to a text it names itself. NULL on an
17
+ -- instance with no hub to ask (the acknowledgement time is still kept).
18
+ --
19
+ -- The names are deliberately NOT terms_accepted_at / terms_version: those are the account's
20
+ -- acceptance columns, and tests/terms_acceptance.mjs fails any second server file that writes
21
+ -- them. This is a different record with a different owner.
22
+ --
23
+ -- Nullable, no backfill: a project created before this shipped never saw the screen, and a
24
+ -- NULL says exactly that. Written once, at create; an idempotent re-request never rewrites it.
25
+ --
26
+ -- Additive and namespaced (ADR 0083): no down-migration, idempotent — safe to re-run.
27
+
28
+ BEGIN;
29
+
30
+ ALTER TABLE provisioning_instances ADD COLUMN IF NOT EXISTS terms_ack_at timestamptz;
31
+ ALTER TABLE provisioning_instances ADD COLUMN IF NOT EXISTS terms_ack_version text;
32
+
33
+ COMMIT;
@@ -26,6 +26,11 @@
26
26
  // an existing repo; ADR 0121 §Decision 1 / task 2046). Every other leg is identical, so
27
27
  // `mode` only relabels the github-repo / init / scaffold steps.
28
28
  //
29
+ // The hub wizard's FRONT DOOR (task 1004417 — the terms tick, then demo or create) is
30
+ // deliberately NOT a step here: it comes before the rail, sets up nothing, and its record
31
+ // is the project's own terms columns (./terms-ack.js), not a plan key. The /new-project
32
+ // skill's "step 0" says the same for the other forms.
33
+ //
29
34
  // `opts.domain` (task 1002703): the terminal enter-hall step names the instance's own
30
35
  // hall address when the renderer knows the domain, and falls back to the `bongos dev`
31
36
  // local-hall one-liner when it doesn't — the hall is the point of creating a project,
@@ -1076,7 +1076,7 @@ async function listAllInstances(db, { status } = {}) {
1076
1076
  // re-fetches the existing row and returns { created:false } so the ROUTE can
1077
1077
  // decide (same owner → idempotent re-request; different owner → 409). Never
1078
1078
  // silently reassigns ownership.
1079
- async function createInstance(db, { ownerBuilderId, slug, targetRef, hostingShape, domain, dbName, port, tier, onboardMode, type, description, detail, modules }) {
1079
+ async function createInstance(db, { ownerBuilderId, slug, targetRef, hostingShape, domain, dbName, port, tier, onboardMode, type, description, detail, modules, termsAck }) {
1080
1080
  // Unknown/absent coerces to the shape that costs nothing and trusts nothing. Was
1081
1081
  // 'co-tenant' (then the free front door); that shape is now retired + unrequestable,
1082
1082
  // so coercing to it would mint a row no caller is allowed to ask for.
@@ -1103,12 +1103,15 @@ async function createInstance(db, { ownerBuilderId, slug, targetRef, hostingShap
1103
1103
  try {
1104
1104
  const { rows } = await db.query(
1105
1105
  `INSERT INTO provisioning_instances
1106
- (owner_builder_id, slug, target_ref, hosting_shape, domain, db_name, port, tier, cost_estimate_usd, onboard_mode, type, description, detail, modules)
1107
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13::jsonb, $14::jsonb)
1106
+ (owner_builder_id, slug, target_ref, hosting_shape, domain, db_name, port, tier, cost_estimate_usd, onboard_mode, type, description, detail, modules, terms_ack_at, terms_ack_version)
1107
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13::jsonb, $14::jsonb, CASE WHEN $15::boolean THEN now() END, $16)
1108
1108
  RETURNING *`,
1109
1109
  [ownerBuilderId, slug, targetRef ?? null, shape, domain ?? null,
1110
1110
  dbName ?? null, port ?? null, tier ?? null, cost, mode, declaredType,
1111
- told, JSON.stringify(answers), picked === null ? null : JSON.stringify(picked)]
1111
+ told, JSON.stringify(answers), picked === null ? null : JSON.stringify(picked),
1112
+ // the wizard's terms screen (task 1004417, ./terms-ack.js): the route resolved the
1113
+ // version server-side; no acknowledgement leaves both columns NULL
1114
+ !!termsAck, (termsAck && termsAck.version) || null]
1112
1115
  );
1113
1116
  return { instance: rows[0], created: true };
1114
1117
  } catch (e) {
@@ -56,7 +56,7 @@ const { recommendationsForDetails } = require('../recommendations');
56
56
  const { makeAskRateLimiter, clientIp } = require('../rate-limit');
57
57
  const { requireAuthorityForShape } = require('../paid-shape-gate');
58
58
  const { requireRoomOnBox } = require('../capacity-gate'); // a full box refused up front (task 1003938)
59
- const { adoptCredentialFault } = require('../credential-preflight');
59
+ const { adoptCredentialFault } = require('../credential-preflight'); const { termsAcknowledgement } = require('../terms-ack');
60
60
  const catalogBridge = require('../catalog-bridge');
61
61
  const capacity = require('../capacity'); // the box's slot ceiling (ADR 0285, task 1003927)
62
62
  const { callbackPage } = require('./callback-page');
@@ -323,7 +323,7 @@ module.exports = function provisioningRoutes() {
323
323
  // exactly the set the panel preselected. An explicit [] is the different
324
324
  // answer "none of them". maxItems is a sanity ceiling well above a catalog
325
325
  // that is three modules wide today.
326
- modules: { type: 'array', itemsType: 'string', maxItems: 50 },
326
+ modules: { type: 'array', itemsType: 'string', maxItems: 50 }, terms_acknowledged: { type: 'boolean' }, // the latter: the wizard's terms tick (task 1004417, ../terms-ack.js)
327
327
  })) return;
328
328
  const body = req.body || {};
329
329
  const detailFault = badProjectDetail(body.detail);
@@ -426,7 +426,7 @@ module.exports = function provisioningRoutes() {
426
426
  description: body.description, detail: body.detail,
427
427
  // The picker's selection (task 1002339) — absent for the same reason and
428
428
  // with the same standing: skipped, and resolved from the bundle on read.
429
- modules: body.modules,
429
+ modules: body.modules, termsAck: termsAcknowledgement(body),
430
430
  });
431
431
  if (req.releaseFreePlace) await req.releaseFreePlace(); // the row exists: the one-free lock's work is done (../free-place-lock.js)
432
432
  // Slug already taken by ANOTHER builder — refuse (never reassign ownership).
@@ -0,0 +1,36 @@
1
+ // modules/provisioning/terms-ack.js — the founder's terms acknowledgement, as the create
2
+ // route records it (task 1004417, BV2.PS05; migration provisioning_033).
3
+ //
4
+ // The wizard's first screen asks the founder to tick one box before anything else. The
5
+ // request carries only that the box was ticked (`terms_acknowledged: true`). WHICH terms
6
+ // is the server's answer, never the caller's: the version is read from platform-identity's
7
+ // TERMS_VERSION — the same constant /terms states and ADR 0213 stamps on an account —
8
+ // through the platform-identity.hub port. A body cannot name the text it agreed to, so a
9
+ // forged version is not a thing this record can hold.
10
+ //
11
+ // resolveOptional, not a `consumes` entry: platform-identity is hub-only (`default:
12
+ // false`), so an instance running provisioning without it has no terms version to ask for.
13
+ // The acknowledgement is still kept there, with a NULL version, rather than dropped —
14
+ // the founder did tick the box.
15
+ //
16
+ // Its own file because routes/provisioning.js sits a few lines under the 1500-line
17
+ // fitness ratchet.
18
+ 'use strict';
19
+
20
+ const api = require('../../src/module-api');
21
+
22
+ function currentTermsVersion() {
23
+ const hub = api.resolveOptional('platform-identity.hub');
24
+ const v = hub && typeof hub.termsVersion === 'function' ? hub.termsVersion() : null;
25
+ return typeof v === 'string' && v ? v : null;
26
+ }
27
+
28
+ // The record createInstance writes, or null when the box was not ticked (an older client,
29
+ // the CLI, an adopt run from a script — none of them showed the screen, and a NULL row
30
+ // says exactly that). Strictly `true`: the validator already refuses a non-boolean.
31
+ function termsAcknowledgement(body) {
32
+ if (!body || body.terms_acknowledged !== true) return null;
33
+ return { version: currentTermsVersion() };
34
+ }
35
+
36
+ module.exports = { termsAcknowledgement };