@bongos/core 1.19.573 → 1.19.574

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.bongos-core.json CHANGED
@@ -2,22 +2,22 @@
2
2
  "artifact": "bongos-core",
3
3
  "manifest_schema": 1,
4
4
  "generator": "scripts/gds/package-core.js",
5
- "core_version": "1.19.573",
6
- "core_contract": "1.19.573",
7
- "source_commit": "4dac3d1041574ffba78b27c7586c270a75f23d2a",
5
+ "core_version": "1.19.574",
6
+ "core_contract": "1.19.574",
7
+ "source_commit": "cb6c20fba8bc93877d7917986195294b3d7d2d42",
8
8
  "source_ref": "HEAD",
9
- "built_at": "2026-09-07T01:25:15.478Z",
9
+ "built_at": "2026-09-07T02:14:28.259Z",
10
10
  "redaction": {
11
11
  "model": "docs-redacted+functional-verbatim",
12
12
  "docs_redacted": 450,
13
13
  "agent_docs_stubbed": 24,
14
- "functional_verbatim": 2042,
14
+ "functional_verbatim": 2043,
15
15
  "rules": 3,
16
16
  "gate_literals": 3,
17
17
  "gate": "passed"
18
18
  },
19
- "file_count": 2516,
20
- "tree_sha256": "3b3601c11e3adbff7e0520361632f5bebe355f1da99cdbc8f67b773da63a87d0",
19
+ "file_count": 2517,
20
+ "tree_sha256": "9160b243d293a7be2f13cb02991462b82a800e4e9948486d898f30a7598a0141",
21
21
  "files": [
22
22
  {
23
23
  "path": ".claude/skills/blocker-review/SKILL.md",
@@ -2692,7 +2692,7 @@
2692
2692
  {
2693
2693
  "path": "docs/module-api-changelog.md",
2694
2694
  "mode": "0000644",
2695
- "sha256": "0b6c38bb0ded3d36a7024229c993f6d3271772f582af4b2b9aa2633805e55329"
2695
+ "sha256": "34f3a97a9b2396e37b6b8739a008aa3c79fffa0f7e02df8b8586b755d6cd0206"
2696
2696
  },
2697
2697
  {
2698
2698
  "path": "docs/modules-contract.md",
@@ -4267,7 +4267,7 @@
4267
4267
  {
4268
4268
  "path": "modules/economy/credits.js",
4269
4269
  "mode": "0000644",
4270
- "sha256": "08890c50f8c8b2551a495e8a54e0e4fb2925b928ece5dc9aaf2090ea1c37adb3"
4270
+ "sha256": "ce98912ffa428298ad4fe1a2dbf1d6e1121fb9f966cb3c41092ac40fb1428a43"
4271
4271
  },
4272
4272
  {
4273
4273
  "path": "modules/economy/migrations/economy_001_fix_gds_shipper_description.sql",
@@ -4284,6 +4284,11 @@
4284
4284
  "mode": "0000644",
4285
4285
  "sha256": "cc953acd69f844d158c3a79ea4de3b12d652ea0247c878c6a6c33d5abf68eab3"
4286
4286
  },
4287
+ {
4288
+ "path": "modules/economy/reward-policy.js",
4289
+ "mode": "0000644",
4290
+ "sha256": "e1f432cc9871bcb992face1f8ecd9f63fea17b3b67c121d59e8e28a89ba8d7d5"
4291
+ },
4287
4292
  {
4288
4293
  "path": "modules/economy/reward.js",
4289
4294
  "mode": "0000644",
@@ -7547,12 +7552,12 @@
7547
7552
  {
7548
7553
  "path": "package-lock.json",
7549
7554
  "mode": "0000644",
7550
- "sha256": "18bdddc767294c810ce9ee48f2e3dd0f56b4e4ac796762654ec092e1ca6a3d4d"
7555
+ "sha256": "267cb45a286e4a22e781d2c5ff28f5c609683bc79b5d8c327d2b3606aa0795a2"
7551
7556
  },
7552
7557
  {
7553
7558
  "path": "package.json",
7554
7559
  "mode": "0000644",
7555
- "sha256": "8b5e28c08069f6c10abad7791bac3829918e1fd7a2b8d5a126e6bcbb9348591b"
7560
+ "sha256": "aca40a127da79a5a8217c05ab5c074072dc0840d4b2baf89159d68412cfd6a08"
7556
7561
  },
7557
7562
  {
7558
7563
  "path": "public-docs/index.html",
@@ -7807,7 +7812,7 @@
7807
7812
  {
7808
7813
  "path": "scripts/gds/cli-lib.js",
7809
7814
  "mode": "0000644",
7810
- "sha256": "5aa658b099b2acda06cdb3aecfe905da7de79f2b12c844faca091ff061454017"
7815
+ "sha256": "b08ad47b79417816a9f132e8149f78743eefb47b8824edf3380cdea23447e07f"
7811
7816
  },
7812
7817
  {
7813
7818
  "path": "scripts/gds/client-baseurl-guard.js",
@@ -9252,7 +9257,7 @@
9252
9257
  {
9253
9258
  "path": "src/module-api.js",
9254
9259
  "mode": "0000644",
9255
- "sha256": "6f2d2cf5cb0bbe6626a121ee87675ed9596875e644221aa0c4e21b14cdc0bbfc"
9260
+ "sha256": "8b068b3a2cefb919013cdcc7cf35ec4a84859fe16d6e5cf7723d3434370bfcd5"
9256
9261
  },
9257
9262
  {
9258
9263
  "path": "src/module-loader/catalog.js",
@@ -1595,5 +1595,7 @@ is load-bearing: the script throws rather than guess if it is missing, and
1595
1595
  landed since 1.19.571 with no explicit bump. run 34071078624. (task 1002620)
1596
1596
  1.19.573 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
1597
1597
  landed since 1.19.572 with no explicit bump. run 34072921884. (task 1002620)
1598
+ 1.19.574 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
1599
+ landed since 1.19.573 with no explicit bump. run 34075598213. (task 1002620)
1598
1600
  ---------------------------------------------------------------------------
1599
1601
  ```
@@ -151,7 +151,24 @@ const IDEA_GOVERNANCE_PASS_FLOOR = 30; // owner: floor ~30 — see the note on
151
151
  // these defaults; the pure helper keeps its code defaults so tests stay
152
152
  // deterministic and the call site passes the resolved config. The currency LABEL
153
153
  // is `branding.currency.label`.
154
- const REWARD_MARGIN_PCT = 20; // cost-plus margin, percent DEFAULT (task 1005)
154
+ // task 1003676: the reward POLICY (these constants + rewardPolicy/rewardConfig)
155
+ // moved to ./reward-policy so a CLIENT can resolve it without importing this file,
156
+ // which pulls { pool, branding } from src/module-api and with it the whole server.
157
+ // Re-exported below, so this module is still the one place reward resolution lives
158
+ // (ADR 0146) and every existing caller is unchanged.
159
+ const {
160
+ REWARD_MARGIN_PCT, REWARD_MODE_DEFAULT, REWARD_MODE_COST_PLUS_ONLY, rewardPolicy,
161
+ } = require('./reward-policy');
162
+
163
+ // Per-instance reward policy, resolved over the code defaults. Stays HERE, not in
164
+ // reward-policy.js: the branding read must go through the module port (ADR 0083),
165
+ // and a file the CLI can share may not import the port. Best-effort — a branding
166
+ // hiccup falls back to the defaults so reward accrual never crashes.
167
+ function rewardConfig() {
168
+ let r = {};
169
+ try { r = (branding().reward) || {}; } catch { r = {}; }
170
+ return rewardPolicy(r);
171
+ }
155
172
 
156
173
  // Reward MODE — which reward streams an instance pays (task 1002270, ADR 0146).
157
174
  // The two streams (ADR 0054 "two drachma conventions, one ledger") are:
@@ -170,8 +187,6 @@ const REWARD_MARGIN_PCT = 20; // cost-plus margin, percent — DEFAULT (task 100
170
187
  // else. Cloud Bongos's choice (owner decision, 2026-07-16).
171
188
  // Unknown/garbage mode → treated as the default (pay both): a config typo must
172
189
  // never silently zero out every builder's per-task reward.
173
- const REWARD_MODE_DEFAULT = 'cost-plus-and-estimate';
174
- const REWARD_MODE_COST_PLUS_ONLY = 'cost-plus-only';
175
190
 
176
191
  // Pure policy resolver — maps a raw branding.reward object to the effective reward
177
192
  // policy. Exported so a test can assert the mapping without touching the memoized
@@ -185,24 +200,6 @@ const REWARD_MODE_COST_PLUS_ONLY = 'cost-plus-only';
185
200
  // credit writers (IC2/IC4/IC5) gate on `ideatorCredit`, never on `perTaskCredit`.
186
201
  // An instance opts the ideator lane out with `reward.ideatorCredit: false`;
187
202
  // absent/any-non-false → the default TRUE (a pre-ADR-0172 config keeps paying).
188
- function rewardPolicy(rawReward) {
189
- const r = rawReward || {};
190
- const marginPct = Number.isFinite(Number(r.marginPct)) ? Number(r.marginPct) : REWARD_MARGIN_PCT;
191
- const usdPeg = Number.isFinite(Number(r.usdPeg)) && Number(r.usdPeg) > 0 ? Number(r.usdPeg) : 1;
192
- const mode = r.mode === REWARD_MODE_COST_PLUS_ONLY ? REWARD_MODE_COST_PLUS_ONLY : REWARD_MODE_DEFAULT;
193
- const perTaskCredit = mode !== REWARD_MODE_COST_PLUS_ONLY;
194
- // Default-on, opt-out-only: only an explicit `false` withholds the ideator lane.
195
- const ideatorCredit = r.ideatorCredit !== false;
196
- return { marginPct, usdPeg, mode, perTaskCredit, ideatorCredit };
197
- }
198
-
199
- // Per-instance reward policy, resolved over the code defaults. Best-effort: a
200
- // branding hiccup falls back to the defaults so reward accrual never crashes.
201
- function rewardConfig() {
202
- let r = {};
203
- try { r = (branding().reward) || {}; } catch { r = {}; }
204
- return rewardPolicy(r);
205
- }
206
203
 
207
204
  // Pure helper — exported for tests. Returns { trueCostUsd, marginPct, drachmae,
208
205
  // description }. drachmae = round(cost × (1+margin) × usdPeg); at the 1:1 peg a
@@ -0,0 +1,50 @@
1
+ // modules/economy/reward-policy.js — the reward POLICY shape, and nothing else
2
+ // (task 1003676).
3
+ //
4
+ // What it is: the reward defaults and the PURE function that resolves a branding
5
+ // pack's `reward` block over them — margin, USD peg, mode, whether the per-task
6
+ // credit and the ideator lane are on.
7
+ //
8
+ // Why it is its own file, and why it imports NOTHING: this is the one piece of
9
+ // economy a CLIENT needs. `bongos start` prints a task's credit reward and the
10
+ // wording depends on the mode, so the CLI must resolve the policy. It used to get
11
+ // that by requiring credits.js, which imports { pool, branding } from
12
+ // src/module-api at module scope — so one lazy require of one config reader pulled
13
+ // Postgres, auth and db-kernel into the closure of every CLI subcommand, and that
14
+ // is what made the CLI impossible to publish as a client-only package (goal
15
+ // 1000054) and left a new builder with no private-registry credential unable to
16
+ // claim anything.
17
+ //
18
+ // It takes the raw `reward` block as an ARGUMENT rather than reading branding
19
+ // itself: a module may import only src/module-api (ADR 0083, enforced by
20
+ // fitness.js), so a file that both a module and a client can share has to be free
21
+ // of host reads. Each caller supplies its own — credits.js through the module port,
22
+ // the CLI straight from src/branding. One resolver, two readers; ADR 0146's rule
23
+ // that reward resolution is always economy's still holds, because this file is
24
+ // economy's.
25
+
26
+ // Cost-plus margin, percent — the DEFAULT (task 1005).
27
+ const REWARD_MARGIN_PCT = 20;
28
+ const REWARD_MODE_DEFAULT = 'cost-plus-and-estimate';
29
+ const REWARD_MODE_COST_PLUS_ONLY = 'cost-plus-only';
30
+
31
+ // PURE. Resolves a raw branding `reward` block over the code defaults. Every field
32
+ // is validated rather than trusted: a malformed pack degrades to the defaults
33
+ // instead of poisoning an award.
34
+ function rewardPolicy(rawReward) {
35
+ const r = rawReward || {};
36
+ const marginPct = Number.isFinite(Number(r.marginPct)) ? Number(r.marginPct) : REWARD_MARGIN_PCT;
37
+ const usdPeg = Number.isFinite(Number(r.usdPeg)) && Number(r.usdPeg) > 0 ? Number(r.usdPeg) : 1;
38
+ const mode = r.mode === REWARD_MODE_COST_PLUS_ONLY ? REWARD_MODE_COST_PLUS_ONLY : REWARD_MODE_DEFAULT;
39
+ const perTaskCredit = mode !== REWARD_MODE_COST_PLUS_ONLY;
40
+ // Default-on, opt-out-only: only an explicit `false` withholds the ideator lane.
41
+ const ideatorCredit = r.ideatorCredit !== false;
42
+ return { marginPct, usdPeg, mode, perTaskCredit, ideatorCredit };
43
+ }
44
+
45
+ module.exports = {
46
+ REWARD_MARGIN_PCT,
47
+ REWARD_MODE_DEFAULT,
48
+ REWARD_MODE_COST_PLUS_ONLY,
49
+ rewardPolicy,
50
+ };
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.19.573",
3
+ "version": "1.19.574",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bongos/core",
9
- "version": "1.19.573",
9
+ "version": "1.19.574",
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.19.573",
3
+ "version": "1.19.574",
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",
@@ -82,7 +82,17 @@ function rewardPolicy(fromServer) {
82
82
  return { mode: fromServer.mode, perTaskCredit: fromServer.perTaskCredit !== false };
83
83
  }
84
84
  try {
85
- const p = require('../../modules/economy/credits').rewardConfig();
85
+ // economy's PURE resolver + our own branding read, NOT ./credits (task
86
+ // 1003676): credits.js imports { pool, branding } from src/module-api at
87
+ // module scope, so this one fallback require used to drag Postgres + auth +
88
+ // db-kernel into EVERY CLI subcommand's closure — which is what stopped the
89
+ // CLI shipping as a public, client-only package. Same resolver, same answer,
90
+ // no server. The CLI is not a module, so reading src/branding directly here
91
+ // is allowed where it would not be inside modules/ (ADR 0083).
92
+ const { rewardPolicy: resolve } = require('../../modules/economy/reward-policy');
93
+ let raw = {};
94
+ try { raw = (require('../../src/branding').branding().reward) || {}; } catch (_) { raw = {}; }
95
+ const p = resolve(raw);
86
96
  if (p && typeof p.mode === 'string') return p;
87
97
  } catch (_) { /* fall through */ }
88
98
  return { mode: 'cost-plus-and-estimate', perTaskCredit: true };
package/src/module-api.js CHANGED
@@ -49,7 +49,7 @@ const { validateOrRespond, LIMITS, parseId, asyncHandler, corsPublicGet, parsePa
49
49
  // there. scripts/gds/bump-version.js still rewrites the literal below; it appends
50
50
  // the entry to that file. Look for a version's history there, not here.
51
51
  // ---------------------------------------------------------------------------
52
- const CORE_VERSION = '1.19.573'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
52
+ const CORE_VERSION = '1.19.574'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
53
53
 
54
54
  // A namespaced logger so a module's log lines are attributable + consistent.
55
55
  // Usage: const log = api.logger('dev-box'); log.info('mounted');