@unson/brainbase-mcp 0.50.25 → 0.50.26

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.
@@ -46,11 +46,7 @@ export function createJudgmentJournalTurnPublisher(options) {
46
46
  || ('tenant_id' in episode && episode.tenant_id !== input.trustedPrincipal.tenantId))
47
47
  throw new Error('invalid');
48
48
  const final = (await read(`${prefix}.final.json`));
49
- const receipt = episode.initial_route_receipt;
50
- if (!object(receipt) || typeof receipt.resolution_id !== 'string' || !receipt.resolution_id
51
- || receipt.project_code !== input.projectCode
52
- || (receipt.turn_id !== undefined && receipt.turn_id !== input.turnId)
53
- || (episode.turn_id !== undefined && episode.turn_id !== input.turnId)
49
+ if ((episode.turn_id !== undefined && episode.turn_id !== input.turnId)
54
50
  || (episode.session_ref !== undefined && episode.session_ref !== sessionRef)
55
51
  || (final.turn_id !== undefined && final.turn_id !== input.turnId)
56
52
  || (final.session_ref !== undefined && final.session_ref !== sessionRef)
@@ -80,6 +76,19 @@ export function createJudgmentJournalTurnPublisher(options) {
80
76
  });
81
77
  if (final.event_count !== events.length)
82
78
  throw new Error('invalid');
79
+ // The Host finalizes against the last successful brainbase_resolve_turn TurnContract,
80
+ // falling back to the episode's bootstrap route receipt; the history reader binds the same way.
81
+ const resolved = [...rawEvents].reverse().find(event => event.success === true
82
+ && Array.isArray(event.satisfies) && event.satisfies.includes('judgment.resolve_turn')
83
+ && object(event.safe_metadata) && object(event.safe_metadata.turn_contract));
84
+ const receipt = resolved ? resolved.safe_metadata.turn_contract
85
+ : episode.initial_route_receipt;
86
+ if (!object(receipt) || typeof receipt.resolution_id !== 'string' || !receipt.resolution_id
87
+ || receipt.project_code !== input.projectCode
88
+ || (receipt.turn_id !== undefined && receipt.turn_id !== input.turnId)
89
+ || ('owner_person_id' in receipt && receipt.owner_person_id !== input.trustedPrincipal.personId)
90
+ || ('tenant_id' in receipt && receipt.tenant_id !== input.trustedPrincipal.tenantId))
91
+ throw new Error('invalid');
83
92
  const turnInput = await read(`${prefix}.turn-input.json`, true);
84
93
  const valueProof = await read(`${prefix}.value-proof.json`, true);
85
94
  body = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.50.25",
3
+ "version": "0.50.26",
4
4
  "description": "Local-first Brainbase judgment OS that lets supported AI agents reuse a user's approved goals, priorities, decisions, and judgment criteria.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -669,5 +669,5 @@
669
669
  "url": "https://github.com/Unson-LLC/brainbase/issues"
670
670
  },
671
671
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
672
- "gitHead": "66825861926190cf2ec1c736285393a68bd307fe"
672
+ "gitHead": "be6520308b1f4e17bdb4494a556532e89e231268"
673
673
  }