@bongos/core 1.24.6 → 1.24.8

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 (52) hide show
  1. package/.bongos-core.json +106 -46
  2. package/clients/bongos-client/README.md +1 -1
  3. package/clients/bongos-client/bongos-client.global.js +8 -0
  4. package/clients/bongos-client/index.cjs +8 -0
  5. package/clients/bongos-client/index.d.ts +13 -1
  6. package/clients/bongos-client/index.mjs +8 -0
  7. package/docs/adr/0371-auto-pickup-applies-a-submitted-tweak-on-the-runner.md +1 -0
  8. package/docs/api/openapi.json +264 -4
  9. package/docs/api-reference.md +7 -3
  10. package/docs/copy-inventory.md +41 -13
  11. package/docs/copy-registry.json +319 -35
  12. package/docs/module-api-changelog.md +4 -0
  13. package/docs/page-inventory.json +40 -4
  14. package/docs/page-readings.json +69 -9
  15. package/modules/government/decision-board.js +5 -0
  16. package/modules/government/decision-rules.js +3 -0
  17. package/modules/government/routes/government.js +2 -0
  18. package/modules/hall-ui/public/market-watch-rules-lib.js +207 -0
  19. package/modules/hall-ui/public/market-watch-rules.css +68 -0
  20. package/modules/hall-ui/public/market-watch-rules.html +54 -0
  21. package/modules/hall-ui/public/market-watch-rules.js +129 -0
  22. package/modules/hall-ui/public/market-watch-rules.states.json +17 -0
  23. package/modules/hall-ui/public/project-settings.html +4 -4
  24. package/modules/hall-ui/public/project-settings.js +51 -1
  25. package/modules/lifecycle/autopickup.js +26 -9
  26. package/modules/lifecycle/db-claims.js +1 -1
  27. package/modules/lifecycle/routes/project-settings.js +71 -10
  28. package/modules/market-watch/matter-acts.js +59 -0
  29. package/modules/market-watch/module.json +5 -4
  30. package/modules/market-watch/proposals.js +214 -0
  31. package/modules/market-watch/research.js +49 -8
  32. package/modules/market-watch/routes/rules.js +202 -0
  33. package/modules/market-watch/rules-logic.js +264 -0
  34. package/modules/market-watch/rules-view.js +165 -0
  35. package/package-lock.json +2 -2
  36. package/package.json +1 -1
  37. package/release-notes.json +12 -0
  38. package/scripts/bongos/government-walk.js +18 -2
  39. package/scripts/bongos/run-unit-tests.js +3 -0
  40. package/src/bongos/module-scope-map.js +2 -0
  41. package/src/bongos/project-settings.js +59 -15
  42. package/src/bongos/serve-internal.js +2 -1
  43. package/src/module-api.js +1 -1
  44. package/tests/autopickup_cap.mjs +203 -11
  45. package/tests/government_act_alone_buildings.mjs +3 -0
  46. package/tests/government_decision_rules.mjs +4 -1
  47. package/tests/governor_matter_acts.mjs +5 -1
  48. package/tests/hall_page_gate_map.mjs +3 -0
  49. package/tests/market_watch_module.mjs +1 -0
  50. package/tests/market_watch_rules.mjs +496 -0
  51. package/tests/market_watch_rules_db.mjs +133 -0
  52. package/tests/project_settings_page.mjs +8 -5
@@ -65,9 +65,11 @@ function buildRouterWithStubs({ timer, categories, reward = WORKING_REWARD }) {
65
65
  list: gc.listCategories,
66
66
  set: api.projectSettings.set,
67
67
  resolveShipMode: api.projectSettings.resolveShipMode,
68
+ resolveTweak: api.projectSettings.resolveTweakAutopickup,
68
69
  };
69
70
  api.resolveRotDays = async () => timer;
70
71
  api.projectSettings.resolveShipMode = async () => ({ mode: 'auto', source: 'default', chosen: false, invalid: null });
72
+ api.projectSettings.resolveTweakAutopickup = async () => ({ mode: 'off', cap: 200, rank_caps: {}, source: { mode: 'default', cap: 'default', rank_caps: 'default' }, invalid: [] });
71
73
  // reward: WORKING_REWARD (default) | null (port absent) | 'throws' (rewardConfig raises).
72
74
  const rewardPort = reward === 'throws'
73
75
  ? { rewardConfig: () => { throw new Error('reward boom'); } }
@@ -84,6 +86,7 @@ function buildRouterWithStubs({ timer, categories, reward = WORKING_REWARD }) {
84
86
  gc.listCategories = saved.list;
85
87
  api.projectSettings.set = saved.set;
86
88
  api.projectSettings.resolveShipMode = saved.resolveShipMode;
89
+ api.projectSettings.resolveTweakAutopickup = saved.resolveTweak;
87
90
  };
88
91
  // The handler is the LAST layer on the matching route (requireBuilder and the
89
92
  // permission gate sit in front); calling it directly is what keeps this a unit test
@@ -103,22 +106,22 @@ const CATS = [
103
106
  { id: 2, slug: 'retired-thing', label: 'Retired thing', sort_order: 20, active: false },
104
107
  ];
105
108
 
106
- test('one read returns all six fundamentals, each naming where its value came from', async () => {
109
+ test('one read returns all seven fundamentals, each naming where its value came from', async () => {
107
110
  const { handlerFor, restore } = buildRouterWithStubs({ timer: TIMER_OK, categories: CATS });
108
111
  try {
109
112
  const res = fakeRes();
110
113
  await handlerFor('get', '/project-settings')({ query: {} }, res);
111
114
  const rows = res.payload.rows;
112
- assert.equal(rows.length, 6, 'the page draws six rows, so the read returns six');
115
+ assert.equal(rows.length, 7, 'the page draws seven rows, so the read returns seven');
113
116
  assert.deepEqual(rows.map((r) => r.key),
114
- ['ship_mode', 'rot_timer', 'work_categories', 'credit_calculation', 'equity_calculation', 'upmarket_percent']);
117
+ ['ship_mode', 'tweak_round_cap', 'rot_timer', 'work_categories', 'credit_calculation', 'equity_calculation', 'upmarket_percent']);
115
118
  // Provenance is the point of the page: every row says where its value came from.
116
119
  for (const r of rows) {
117
120
  assert.ok(r.reads && r.reads.file, `${r.key} names no file`);
118
121
  assert.ok(r.sentence && r.sentence.length > 20, `${r.key} has no readable sentence`);
119
122
  }
120
- // Three knobs: the criterion's two, plus ship mode (task 1004628).
121
- assert.deepEqual(rows.filter((r) => r.editable).map((r) => r.key), ['ship_mode', 'rot_timer', 'work_categories']);
123
+ // Four knobs: the criterion's two, ship mode (task 1004628) and the monthly tweak-round cap (task 1005003).
124
+ assert.deepEqual(rows.filter((r) => r.editable).map((r) => r.key), ['ship_mode', 'tweak_round_cap', 'rot_timer', 'work_categories']);
122
125
  // A no-store receipt: a cached settings read is wrong the moment a knob turns.
123
126
  assert.equal(res.headers['Cache-Control'], 'no-store');
124
127
  } finally { restore(); }