@bongos/core 1.21.146 → 1.21.147

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 (63) hide show
  1. package/.bongos-core.json +85 -65
  2. package/clients/bongos-client/README.md +1 -1
  3. package/clients/bongos-client/bongos-client.global.js +2 -0
  4. package/clients/bongos-client/index.cjs +2 -0
  5. package/clients/bongos-client/index.d.ts +6 -2
  6. package/clients/bongos-client/index.mjs +2 -0
  7. package/docs/api/openapi.json +86 -7
  8. package/docs/api-reference.md +3 -2
  9. package/docs/copy-inventory.md +17 -15
  10. package/docs/copy-registry.json +37 -19
  11. package/docs/module-api-changelog.md +2 -0
  12. package/docs/page-readings.json +70 -70
  13. package/modules/builder-settings/core-move-seen.js +41 -0
  14. package/modules/builder-settings/routes/settings.js +22 -0
  15. package/modules/builder-settings/settings.js +5 -0
  16. package/modules/hall-ui/public/atlas.html +1 -1
  17. package/modules/hall-ui/public/blockers.html +1 -1
  18. package/modules/hall-ui/public/board-room.html +1 -1
  19. package/modules/hall-ui/public/city.html +1 -1
  20. package/modules/hall-ui/public/collab.html +1 -1
  21. package/modules/hall-ui/public/commands.html +1 -1
  22. package/modules/hall-ui/public/copy-desk.html +1 -1
  23. package/modules/hall-ui/public/core-move-notice.js +70 -0
  24. package/modules/hall-ui/public/deploy.html +1 -1
  25. package/modules/hall-ui/public/diagrams.html +1 -1
  26. package/modules/hall-ui/public/drachmae.html +1 -1
  27. package/modules/hall-ui/public/fleet.html +1 -1
  28. package/modules/hall-ui/public/gate.html +1 -1
  29. package/modules/hall-ui/public/goal-map.html +1 -1
  30. package/modules/hall-ui/public/goals.html +1 -1
  31. package/modules/hall-ui/public/government.html +1 -1
  32. package/modules/hall-ui/public/idea.html +1 -1
  33. package/modules/hall-ui/public/ideas.html +1 -1
  34. package/modules/hall-ui/public/index.html +1 -1
  35. package/modules/hall-ui/public/modules.html +1 -1
  36. package/modules/hall-ui/public/my-agents.html +1 -1
  37. package/modules/hall-ui/public/primer.html +1 -1
  38. package/modules/hall-ui/public/profile.html +1 -1
  39. package/modules/hall-ui/public/project-settings.html +1 -1
  40. package/modules/hall-ui/public/ranks.html +1 -1
  41. package/modules/hall-ui/public/roadmap.html +1 -1
  42. package/modules/hall-ui/public/roster.html +1 -1
  43. package/modules/hall-ui/public/sessions.html +1 -1
  44. package/modules/hall-ui/public/settings-software-update.js +24 -2
  45. package/modules/hall-ui/public/settings.html +2 -2
  46. package/modules/hall-ui/public/shell.js +8 -0
  47. package/modules/hall-ui/public/street.html +1 -1
  48. package/modules/hall-ui/public/studio.html +1 -1
  49. package/modules/hall-ui/public/style.css +11 -0
  50. package/modules/hall-ui/public/task.html +1 -1
  51. package/modules/hall-ui/public/thinking.html +1 -1
  52. package/modules/hall-ui/public/tweak-editor.html +1 -1
  53. package/modules/hall-ui/public/watch.html +1 -1
  54. package/modules/hall-ui/public/work.html +1 -1
  55. package/package-lock.json +2 -2
  56. package/package.json +1 -1
  57. package/release-notes.json +6 -0
  58. package/scripts/gds/provision-core-upgrade.js +9 -3
  59. package/src/bongos/core-moves.js +155 -0
  60. package/src/bongos/routes/core-update.js +43 -3
  61. package/src/module-api.js +1 -1
  62. package/tests/core_move_notice.mjs +356 -0
  63. package/tests/nav_permission_atoms.mjs +3 -2
@@ -167,7 +167,7 @@
167
167
  chrome exists before the page script runs. -->
168
168
  <script src="/builders/shell-trail.js?v=2026-10-08-city-tab"></script>
169
169
  <script src="/builders/craft-mode.js?v=2026-10-09-living3"></script>
170
- <script src="/builders/shell.js?v=2026-10-17-upgrade-hold1"></script>
170
+ <script src="/builders/shell.js?v=2026-10-18-core-move1"></script>
171
171
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
172
172
  <script src="/builders/palette.js" defer></script>
173
173
  <!-- shared frontend toolkit (window.OTB) — loaded before watch.js, which pulls from it. -->
@@ -173,7 +173,7 @@
173
173
  time so the chrome exists before the deferred page scripts execute. -->
174
174
  <script src="/builders/shell-trail.js?v=2026-10-08-city-tab"></script>
175
175
  <script src="/builders/craft-mode.js?v=2026-10-09-living3"></script>
176
- <script src="/builders/shell.js?v=2026-10-17-upgrade-hold1"></script>
176
+ <script src="/builders/shell.js?v=2026-10-18-core-move1"></script>
177
177
  <!-- jump palette (Ctrl/Cmd-K). Optional by design: without it the shell's slot stays hidden. -->
178
178
  <script src="/builders/palette.js" defer></script>
179
179
  <!-- shared frontend toolkit (window.OTB) — loaded FIRST so work.js can pull from it. -->
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.21.146",
3
+ "version": "1.21.147",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bongos/core",
9
- "version": "1.21.146",
9
+ "version": "1.21.147",
10
10
  "license": "AGPL-3.0-or-later",
11
11
  "dependencies": {
12
12
  "express": "^4.21.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.21.146",
3
+ "version": "1.21.147",
4
4
  "description": "Cloud Bongos — the AI-first build platform core (GDS + platform surfaces + module system), installed as a versioned dependency (ADR 0108).",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "main": "src/platform-server.js",
@@ -9890,5 +9890,11 @@
9890
9890
  "id": "1004730",
9891
9891
  "text": "When an automatic core update fails on a hosted project and is rolled back, that version is not retried over and over, and the project's owner now sees in their own Settings and update banner which version was tried, that it w"
9892
9892
  }
9893
+ ],
9894
+ "1.21.147": [
9895
+ {
9896
+ "id": "1004731",
9897
+ "text": "After a project's software is updated, its owner now sees a one-time note saying which version it moved to, when, and what changed, and the Software update page lists the recent updates, including any that failed and were undo"
9898
+ }
9893
9899
  ]
9894
9900
  }
@@ -321,7 +321,10 @@ async function coreUpgradeInstance(inst, deps, intent) {
321
321
  // the one field task 1004121 exists to keep identical. Skipped when !apply, where the
322
322
  // command is printed and never run — a plan should not spend a subprocess per tick.
323
323
  const { runAs, migrateAs } = resolveRunAs(inst, deps, { probe: apply });
324
- const { cmd, runDir } = upgradeInvocation(inst, to, { privileged, requestedBy, selfRoot, runAs, migrateAs });
324
+ // A move the hub queued by itself (provision-auto-upgrade.js) says so in the project's
325
+ // own ledger, so its hall can tell its owner "upgraded automatically" (task 1004731).
326
+ const automatic = !!intent && intent.requested_by === 'runner:auto-upgrade';
327
+ const { cmd, runDir } = upgradeInvocation(inst, to, { privileged, requestedBy, automatic, selfRoot, runAs, migrateAs });
325
328
 
326
329
  if (!apply) {
327
330
  // A --dry-run runner tick used to only PRINT this command. It now runs the CLI's own
@@ -668,7 +671,7 @@ function resolveRunAs(inst, deps, { probe: allowProbe = true } = {}) {
668
671
  // HERE rather than left to instanceUser()'s own throw: that throw is correct today, but
669
672
  // a call site whose safety depends on a helper's internals is one refactor away from a
670
673
  // shell-injection path (and the apply leg's own guard sits at the route, not here).
671
- function upgradeInvocation(inst, to, { privileged = false, dryRun = false, requestedBy = '', selfRoot = selfInstanceRoot, runAs = null, migrateAs = null } = {}) {
674
+ function upgradeInvocation(inst, to, { privileged = false, dryRun = false, requestedBy = '', automatic = false, selfRoot = selfInstanceRoot, runAs = null, migrateAs = null } = {}) {
672
675
  if (!isValidSlug(inst && inst.slug)) {
673
676
  throw new Error(`upgradeInvocation: refusing to build a shell command from an invalid slug ${JSON.stringify(inst && inst.slug)}`);
674
677
  }
@@ -729,7 +732,10 @@ function upgradeInvocation(inst, to, { privileged = false, dryRun = false, reque
729
732
  // token; the upgrade process cannot (task 1004065, pushUpgradePin).
730
733
  hubPushesPin(inst) ? '--pin-no-push' : '',
731
734
  requestedBy ? `--requested-by ${requestedBy}` : '',
732
- requestedBy ? '--upgrade-source owner-control' : ''];
735
+ requestedBy ? '--upgrade-source owner-control' : '',
736
+ // The ledger's existing mark for an unattended move (the self-host sweep writes
737
+ // `auto-subscription (<rule>)`); one shell-safe word here (task 1004731).
738
+ automatic && !requestedBy ? '--note auto-subscription' : ''];
733
739
  return { cmd: [...shared, ...tail].filter(Boolean).join(' '), runDir: REPO_ROOT, instanceDir, runAs: account, migrateAs: dbAccount };
734
740
  }
735
741
 
@@ -0,0 +1,155 @@
1
+ 'use strict';
2
+
3
+ // src/bongos/core-moves.js — "you were upgraded, and this is what changed": what THIS
4
+ // project's own hall says after its core moved, and the short list of moves Settings →
5
+ // Software update keeps (task 1004731).
6
+ //
7
+ // WHY. Since task 1004729 the hub moves a hosted project's core on its own, by its update
8
+ // rule. The owner found out only by noticing a different number. The goal state is "a
9
+ // changelog is visible inside the update": the hall says once, after the move, which core
10
+ // it is on now, when it moved, and what the releases in between brought.
11
+ //
12
+ // NO NEW CHANNEL — the same reading task 1004730's hold makes (upgrade-hold.js). Every move,
13
+ // automatic or by hand, is `bongos upgrade` run against THIS project's database, and it
14
+ // writes one row to this project's own `core_upgrades` ledger: a landed move as from → to,
15
+ // a failed one as its `rolled_back:` row. And the release notes for every version up to
16
+ // the one now running ship INSIDE the running core (release-notes.json, task 1004218), so
17
+ // the entries between the old and the new version are read from this project's own disk.
18
+ // The hub is never asked.
19
+ //
20
+ // HOW IT WAS MOVED is only as precise as the ledger: `source = 'owner-control'` is the
21
+ // Update button (a person); a note carrying `auto-subscription` is an automatic move (the
22
+ // self-host sweep has always written it, and since this task the hub's automatic move
23
+ // passes it too, provision-core-upgrade.js); anything else was run on the server, and the
24
+ // ledger cannot say by whom, so it says "on the server" rather than guess. A failed
25
+ // automatic move keeps no note of its own (rollback() writes `rolled_back:` in the one note
26
+ // column), so it reads as "on the server" too.
27
+
28
+ const fs = require('fs');
29
+ const path = require('path');
30
+ const { notesBetween, RELEASE_NOTES_FILE } = require('../../scripts/gds/release-notes.js');
31
+
32
+ const VERSION_RE = /^\d{1,4}\.\d{1,5}\.\d{1,6}$/;
33
+ const ROLLED_BACK_RE = /^rolled_back:/;
34
+ const DOWNGRADE_RE = /^downgrade\b/;
35
+ const AUTO_RE = /auto-subscription/;
36
+
37
+ // A notice is about a move that just happened. A project whose last move was months ago
38
+ // (the ledger outlives this feature) is not told about it as news.
39
+ const NOTICE_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;
40
+ // The notice is a banner, not the changelog: a few lines, then "and N more" with the way
41
+ // to the full list.
42
+ const NOTICE_ENTRIES_MAX = 6;
43
+ // "A short history of moves."
44
+ const HISTORY_MAX = 8;
45
+
46
+ const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
47
+ 'September', 'October', 'November', 'December'];
48
+
49
+ function isoOrNull(v) {
50
+ const d = v ? new Date(v) : null;
51
+ return d && Number.isFinite(d.getTime()) ? d.toISOString() : null;
52
+ }
53
+
54
+ // "15 October 2026", in UTC so the same move reads the same date for every reader and test.
55
+ function longDate(iso) {
56
+ const d = new Date(iso);
57
+ return `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;
58
+ }
59
+
60
+ /** How a ledger row's move was started: 'automatic' | 'by_hand' | 'on_server'. PURE. */
61
+ function moveHow(row) {
62
+ if (row && row.source === 'owner-control') return 'by_hand';
63
+ if (row && typeof row.note === 'string' && AUTO_RE.test(row.note)) return 'automatic';
64
+ return 'on_server';
65
+ }
66
+
67
+ /** What a ledger row says happened: 'upgraded' | 'moved_back' | 'rolled_back'. PURE. */
68
+ function moveOutcome(row) {
69
+ const note = row && typeof row.note === 'string' ? row.note : '';
70
+ if (ROLLED_BACK_RE.test(note)) return 'rolled_back';
71
+ if (DOWNGRADE_RE.test(note)) return 'moved_back';
72
+ return 'upgraded';
73
+ }
74
+
75
+ /**
76
+ * The short history Settings → Software update shows, newest first, failed moves included.
77
+ * PURE over core_upgrades rows (newest first). `version` is the core the move went to, or
78
+ * for a rolled-back row the one it tried.
79
+ */
80
+ function moveHistory(rows) {
81
+ if (!Array.isArray(rows)) return [];
82
+ return rows
83
+ .filter((r) => r && VERSION_RE.test(String(r.to_version || '')))
84
+ .slice(0, HISTORY_MAX)
85
+ .map((r) => ({
86
+ id: r.id == null ? null : String(r.id),
87
+ version: String(r.to_version),
88
+ from: VERSION_RE.test(String(r.from_version || '')) ? String(r.from_version) : null,
89
+ at: isoOrNull(r.applied_at),
90
+ how: moveHow(r),
91
+ outcome: moveOutcome(r),
92
+ }));
93
+ }
94
+
95
+ /**
96
+ * The one-time notice after a move, or null. PURE.
97
+ *
98
+ * Shown only while it is true and new: the newest ledger row is a move that went in (not a
99
+ * rollback), this server runs the version it went to (so "upgraded to X" is a fact: this
100
+ * answer is served by X), it is recent, and this builder has not seen it (`seenId`, the
101
+ * ledger row id they last acknowledged).
102
+ *
103
+ * @param {object[]} rows core_upgrades rows, newest first
104
+ * @param {string} running the core this server runs
105
+ * @param {object?} notes the running core's release-notes.json (null if unreadable)
106
+ * @param {string?} seenId the ledger row id this builder has acknowledged
107
+ * @param {number} now ms clock
108
+ */
109
+ function moveNotice({ rows, running, notes = null, seenId = null, now = Date.now() }) {
110
+ const last = Array.isArray(rows) ? rows[0] : null;
111
+ if (!last || last.id == null) return null;
112
+ const id = String(last.id);
113
+ const to = String(last.to_version || '');
114
+ if (!VERSION_RE.test(to) || to !== String(running || '')) return null;
115
+ const outcome = moveOutcome(last);
116
+ if (outcome === 'rolled_back') return null;
117
+ if (seenId != null && String(seenId) === id) return null;
118
+ const at = isoOrNull(last.applied_at);
119
+ if (!at || now - Date.parse(at) > NOTICE_MAX_AGE_MS) return null;
120
+ const from = VERSION_RE.test(String(last.from_version || '')) ? String(last.from_version) : null;
121
+ const how = moveHow(last);
122
+
123
+ // The release-note entries between the old and the new version, from this core's own file.
124
+ let entries = null;
125
+ let more = 0;
126
+ if (outcome === 'upgraded' && from && notes) {
127
+ const r = notesBetween(notes, from, to);
128
+ if (r.entries) {
129
+ entries = r.entries.slice(0, NOTICE_ENTRIES_MAX);
130
+ more = r.entries.length - entries.length;
131
+ }
132
+ }
133
+ const verb = outcome === 'moved_back' ? 'Moved back' : 'Upgraded';
134
+ return {
135
+ id,
136
+ version: to,
137
+ from,
138
+ at,
139
+ how,
140
+ outcome,
141
+ message: `${verb}${how === 'automatic' ? ' automatically' : ''} to core ${to} on ${longDate(at)}.`,
142
+ entries,
143
+ more,
144
+ };
145
+ }
146
+
147
+ /**
148
+ * The running core's own release notes, or null. Never throws. The file sits at the package
149
+ * root beside package.json (release-notes.js); a core checkout run in place has none.
150
+ */
151
+ function readInstalledReleaseNotes({ fsImpl = fs, root = path.join(__dirname, '..', '..') } = {}) {
152
+ try { return JSON.parse(fsImpl.readFileSync(path.join(root, RELEASE_NOTES_FILE), 'utf8')); } catch { return null; }
153
+ }
154
+
155
+ module.exports = { moveHistory, moveNotice, readInstalledReleaseNotes };
@@ -35,6 +35,7 @@ const seams = require('../../module-seams');
35
35
  const { loadIdpConfig } = require('../auth-config');
36
36
  const upgradeRequest = require('../upgrade-request');
37
37
  const { readUpgradeHold } = require('../upgrade-hold');
38
+ const { moveNotice, moveHistory, readInstalledReleaseNotes } = require('../core-moves');
38
39
 
39
40
  // WHERE A HOSTED PROJECT'S OWNER TAKES THE UPGRADE (task 1004174, ADR 0339): the hub's
40
41
  // own deploy door, scoped to this project — `<hub>/deploy?project=<slug>`. The act stays
@@ -222,6 +223,37 @@ async function safeHold(read, args) {
222
223
  try { return (await read(args)) || null; } catch { return null; }
223
224
  }
224
225
 
226
+ // "Upgraded to core X on <date>, and this is what changed" (task 1004731,
227
+ // src/bongos/core-moves.js): the one-time notice after a move and the short history of
228
+ // moves, both read from this project's own core_upgrades ledger, the notes from the running
229
+ // core's own release-notes.json. Gated like the ledger read (GET /core-upgrades): when and to
230
+ // what this box moved is a vulnerability-window fact (ADR 0043).
231
+ //
232
+ // WHO HAS SEEN IT is per builder and server-side, in the builder-settings module's
233
+ // behavior_prefs (core-move-seen.js), reached through its port: core never requires a module.
234
+ // Without the module the hall remembers it in the browser instead ('browser').
235
+ async function defaultSeenMove(req) {
236
+ const port = seams.resolveOptional('builder-settings');
237
+ if (!port || typeof port.coreMoveSeen !== 'function' || typeof port.getBuilderBehaviorPrefs !== 'function') {
238
+ return { remember: 'browser', seen: null };
239
+ }
240
+ return { remember: 'server', seen: port.coreMoveSeen(await port.getBuilderBehaviorPrefs(req.builder && req.builder.id)) };
241
+ }
242
+
243
+ // The notice for this viewer, or null. Fail-soft: a ledger, notes file or seen state that
244
+ // cannot be read is no notice, never a failed banner read.
245
+ async function safeMoved({ req, running, upgrades, releaseNotes, seenMove }) {
246
+ try {
247
+ const [rows, seen] = await Promise.all([upgrades({ limit: 1 }), seenMove(req)]);
248
+ const notice = moveNotice({ rows, running, notes: releaseNotes(), seenId: seen && seen.seen });
249
+ return notice ? { ...notice, remember: seen && seen.remember === 'server' ? 'server' : 'browser' } : null;
250
+ } catch { return null; }
251
+ }
252
+
253
+ async function safeHistory(upgrades) {
254
+ try { return moveHistory(await upgrades({ limit: 8 })); } catch { return null; }
255
+ }
256
+
225
257
  function buildCoreUpdateRouter({
226
258
  coreUpdate = readCoreUpdate,
227
259
  selfChannel = storedSelfChannel,
@@ -231,6 +263,8 @@ function buildCoreUpdateRouter({
231
263
  doorInputs = () => ({ provisioning: provisioningEnabled(), idp: safeIdpConfig(), hubUpgradeUrl: safeHubUpgradeUrl() }),
232
264
  askDeps = defaultAskDeps,
233
265
  upgradeHold = readUpgradeHold,
266
+ releaseNotes = readInstalledReleaseNotes,
267
+ seenMove = defaultSeenMove,
234
268
  } = {}) {
235
269
  contributeCoreUpdateToDocket();
236
270
  const router = express.Router();
@@ -247,7 +281,7 @@ function buildCoreUpdateRouter({
247
281
  // grader caught here, and it is invisible to any test that does not drive a
248
282
  // real request through the assembled router; tests/core_update_banner.mjs now
249
283
  // does, and fails if this call is mis-shaped again.
250
- asyncHandler('GET /core-update', async (_req, res) => {
284
+ asyncHandler('GET /core-update', async (req, res) => {
251
285
  // Fail-soft on the version read, exactly as GET /version does: an instance
252
286
  // that cannot name its own core reports `no_answer` and renders no banner.
253
287
  let running = null;
@@ -256,7 +290,11 @@ function buildCoreUpdateRouter({
256
290
  // own links to Settings → Software update, and the hand-off lives on GET /software-update.
257
291
  const { channel, source } = await resolveChannel(selfChannel);
258
292
  const update = await coreUpdate({ running, channel });
259
- res.json({ ok: true, update: { ...update, channel_source: source }, held: await safeHold(upgradeHold, { running, offered: update && update.reading === 'ok' ? update.latest : null }) });
293
+ const [held, moved] = await Promise.all([
294
+ safeHold(upgradeHold, { running, offered: update && update.reading === 'ok' ? update.latest : null }),
295
+ safeMoved({ req, running, upgrades, releaseNotes, seenMove }),
296
+ ]);
297
+ res.json({ ok: true, update: { ...update, channel_source: source }, held, moved });
260
298
  }, { errorCode: 'core_update_failed', message: false }),
261
299
  );
262
300
 
@@ -295,7 +333,9 @@ function buildCoreUpdateRouter({
295
333
  const door = updateDoor(doorInputs());
296
334
  const ask = await readAsk({ update, door, deps: askDeps() });
297
335
  const held = await safeHold(upgradeHold, { running, offered: update && update.reading === 'ok' ? update.offered : null });
298
- res.json({ ok: true, update, door, can_update: can === true, ask, held });
336
+ // The history only for a viewer who holds core.pin.move (see safeMoved's gate note).
337
+ const history = can === true ? await safeHistory(upgrades) : null;
338
+ res.json({ ok: true, update, door, can_update: can === true, ask, held, history });
299
339
  }, { errorCode: 'software_update_failed', message: false }),
300
340
  );
301
341
 
package/src/module-api.js CHANGED
@@ -75,7 +75,7 @@ const { responsibilityFor, ROLE_RESPONSIBILITIES } = require('./role-responsibil
75
75
  // MAJOR (see allowBoxScope below): passes the request through untouched.
76
76
  function deprecatedNoopMiddleware(_req, _res, next) { next(); }
77
77
 
78
- const CORE_VERSION = '1.21.146'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
78
+ const CORE_VERSION = '1.21.147'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
79
79
 
80
80
  // A namespaced logger so a module's log lines are attributable + consistent.
81
81
  // Usage: const log = api.logger('discord'); log.info('mounted');