@unson/brainbase-mcp 0.49.1 → 0.50.1

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.
@@ -0,0 +1,487 @@
1
+ import { queueTaskToolDefinitions, QUEUE_TASK_TOOL_NAMES } from '../queue-task-tools.js';
2
+ import { createQueueReferenceSeed, QUEUE_REFERENCE_CODES as C, } from './queue-task-reference-backend.js';
3
+ export const QUEUE_TASK_CONTRACT_SCENARIO_NAMES = [
4
+ 'AC-2 reads only visible tasks and forwards opaque cursors one page per call',
5
+ 'AC-2 reads an approved task by id',
6
+ 'AC-3 binds every call and replay to the authenticated agent',
7
+ 'AC-4 claims next and renews without duplicate claims',
8
+ 'AC-4 claims an approved task by id without duplicates',
9
+ 'AC-5 attaches evidence once for the same operation',
10
+ 'AC-6 completes through queue status without bypassing gates',
11
+ 'AC-7 validates inputs before calling the queue backend',
12
+ 'AC-8 preserves structured failures without leaking credentials',
13
+ 'AC-9 advertises conservative queue tool annotations',
14
+ ];
15
+ export { createQueueReferenceBackend, createQueueReferenceSeed, QUEUE_REFERENCE_CODES, } from './queue-task-reference-backend.js';
16
+ export async function runQueueTaskContractScenario(name, adapter, assert) {
17
+ const steps = [];
18
+ const connections = [];
19
+ async function connect(state = createQueueReferenceSeed(), agent = { agentId: 'A', credential: 'credential-sentinel' }, generatedKeys = ['generated-1', 'generated-2', 'generated-3', 'generated-4']) {
20
+ const c = await adapter.connect({
21
+ state,
22
+ agent,
23
+ sharedServiceToken: 'shared-sentinel',
24
+ generatedKeys,
25
+ });
26
+ connections.push(c);
27
+ return c;
28
+ }
29
+ async function call(c, n, args, code) {
30
+ const r = await c.callTool(n, args);
31
+ assert.equal(r.content[0].type, 'text');
32
+ assert.equal(r.structuredContent, undefined);
33
+ const text = r.content[0].text;
34
+ assert.ok(!text.includes('credential-sentinel'));
35
+ assert.ok(!text.includes('exception-sentinel'));
36
+ assert.ok(!text.includes('shared-sentinel'));
37
+ const v = JSON.parse(text);
38
+ assert.equal(!!r.isError, v.status !== 'ok');
39
+ if (code)
40
+ assert.equal(v.error?.code, code);
41
+ else
42
+ assert.equal(v.status, 'ok');
43
+ steps.push(v);
44
+ return v.queue;
45
+ }
46
+ try {
47
+ const c = await connect();
48
+ const index = QUEUE_TASK_CONTRACT_SCENARIO_NAMES.indexOf(name);
49
+ if (index === 0) {
50
+ const p = await call(c, 'list_my_tasks', { limit: 2 });
51
+ assert.equal(p.items.length, 2);
52
+ assert.ok(p.next_cursor);
53
+ const q = await call(c, 'list_my_tasks', { cursor: p.next_cursor, limit: 2 });
54
+ assert.equal(q.items.length, 1);
55
+ assert.equal(q.next_cursor, null);
56
+ await call(c, 'list_my_tasks', { statuses: ['pending'] });
57
+ const s = await c.snapshot();
58
+ assert.equal(s.calls.length, 3);
59
+ assert.equal(s.calls[1].input.cursor, p.next_cursor);
60
+ assert.ok(!JSON.stringify(steps).includes('synthetic-task-4'));
61
+ const empty = await connect(s, { agentId: 'Z', credential: 'agent-credential-sentinel' });
62
+ assert.deepEqual(await call(empty, 'list_my_tasks', {}), { items: [], next_cursor: null });
63
+ }
64
+ else if (index === 1) {
65
+ const q = await call(c, 'get_task', { task_id: 't1' });
66
+ assert.equal(q.task.title, 'synthetic-task-1');
67
+ assert.equal(q.task.version, 1);
68
+ await call(c, 'get_task', { task_id: 't4' }, C.agent_scope_denied);
69
+ await call(c, 'get_task', { task_id: 'missing' }, C.task_not_found);
70
+ for (const x of (await c.snapshot()).calls) {
71
+ assert.equal(x.operation, 'get');
72
+ assert.equal(x.agentId, 'A');
73
+ assert.deepEqual(Object.keys(x.input), ['task_id']);
74
+ }
75
+ }
76
+ else if (index === 2) {
77
+ const args = [
78
+ {},
79
+ { task_id: 't1' },
80
+ { task_id: 't1' },
81
+ {},
82
+ { task_id: 't1' },
83
+ { task_id: 't1', expected_version: 1, kind: 'ci', ref: {} },
84
+ { task_id: 't1', expected_version: 1, to_status: 'done' },
85
+ ];
86
+ for (const agent of [
87
+ null,
88
+ { agentId: 'A', credential: '' },
89
+ { agentId: 'A', credential: ' ' },
90
+ ]) {
91
+ const x = await connect(createQueueReferenceSeed(), agent);
92
+ for (let i = 0; i < 7; i++) {
93
+ await call(x, QUEUE_TASK_TOOL_NAMES[i], args[i], 'task_auth_unavailable');
94
+ if (i >= 2)
95
+ assert.deepEqual(steps.at(-1).error.details, { outcome: 'not_sent' });
96
+ }
97
+ assert.equal((await x.snapshot()).calls.length, 0);
98
+ }
99
+ for (const field of ['agent_id', 'assignee', 'scope'])
100
+ await call(c, 'claim_next', { [field]: '*' }, 'task_input_invalid');
101
+ assert.equal((await c.snapshot()).calls.length, 0);
102
+ await call(c, 'claim_next', { idempotency_key: 'k' });
103
+ const s = await c.snapshot();
104
+ assert.ok(s.calls.every((x) => x.agentId === 'A' && x.credentialMatchesAgent));
105
+ const b = await connect(s, { agentId: 'B', credential: 'agent-credential-sentinel' });
106
+ const q = await call(b, 'claim_next', { idempotency_key: 'k' });
107
+ assert.equal(q.task.id, 't4');
108
+ assert.ok((await b.snapshot()).calls.every((x) => x.credentialMatchesAgent));
109
+ s.tasks.forEach((t) => {
110
+ t.assignee = 'B';
111
+ });
112
+ const revoked = await connect(s);
113
+ await call(revoked, 'claim_next', { idempotency_key: 'k' }, C.agent_scope_denied);
114
+ }
115
+ else if (index === 3 || index === 4) {
116
+ const tool = index === 3 ? 'claim_next' : 'claim_task';
117
+ const args = index === 3 ? { idempotency_key: 'k' } : { task_id: 't1', idempotency_key: 'k' };
118
+ const q = await call(c, tool, args);
119
+ assert.equal(q.replayed, false);
120
+ assert.ok(q.claimed_until);
121
+ assert.equal(q.renew_interval_minutes, 10);
122
+ const replay = await call(c, tool, args);
123
+ assert.equal(replay.task.id, q.task.id);
124
+ assert.equal(replay.replayed, true);
125
+ assert.equal(Object.keys((await c.snapshot()).claims).length, 1);
126
+ if (index === 4) {
127
+ assert.deepEqual((await c.snapshot()).calls[0].input, {
128
+ mode: 'by_id',
129
+ task_id: 't1',
130
+ idempotency_key: 'k',
131
+ });
132
+ await call(c, tool, { task_id: 't2', idempotency_key: 'k' }, C.idempotency_conflict);
133
+ await call(c, tool, { task_id: 't4' }, C.agent_scope_denied);
134
+ const s = await c.snapshot();
135
+ s.claims.t2 = { agent: 'B', claimed_until: q.claimed_until };
136
+ const x = await connect(s);
137
+ await call(x, tool, { task_id: 't2' }, C.claim_not_held);
138
+ }
139
+ else {
140
+ await call(c, tool, {});
141
+ await call(c, tool, {});
142
+ const s = await c.snapshot();
143
+ assert.equal(s.calls[2].input.idempotency_key, 'mcp:generated-1');
144
+ assert.equal(s.calls[3].input.idempotency_key, 'mcp:generated-2');
145
+ assert.equal((await call(c, tool, {})).status, 'no_claimable_task');
146
+ const renewed = await call(c, 'renew_claim', { task_id: 't1', idempotency_key: 'renew' });
147
+ assert.ok(renewed.claimed_until > q.claimed_until);
148
+ assert.equal((await c.snapshot()).claims.t1.claimed_until, renewed.claimed_until);
149
+ await call(c, 'renew_claim', { task_id: 't4' }, C.agent_scope_denied);
150
+ await call(c, 'renew_claim', { task_id: 't2', idempotency_key: 'renew' }, C.idempotency_conflict);
151
+ const competing = createQueueReferenceSeed();
152
+ competing.claims.t1 = { agent: 'B', claimed_until: q.claimed_until };
153
+ const competitor = await connect(competing);
154
+ const next = await call(competitor, 'claim_next', {});
155
+ assert.equal(next.task.id, 't2');
156
+ assert.equal((await competitor.snapshot()).claims.t1.agent, 'B');
157
+ const unclaimed = await connect();
158
+ await call(unclaimed, 'renew_claim', { task_id: 't1' }, C.claim_not_held);
159
+ }
160
+ }
161
+ else if (index === 5 || index === 6) {
162
+ await call(c, 'claim_task', { task_id: 't1' });
163
+ let version = 1;
164
+ if (index === 6) {
165
+ await call(c, 'update_status', {
166
+ task_id: 't1',
167
+ expected_version: version++,
168
+ to_status: 'started',
169
+ idempotency_key: 'start',
170
+ });
171
+ const before = (await c.snapshot()).calls.length;
172
+ await call(c, 'update_status', { task_id: 't1', expected_version: version, to_status: 'blocked' }, 'task_input_invalid');
173
+ assert.equal((await c.snapshot()).calls.length, before);
174
+ await call(c, 'update_status', {
175
+ task_id: 't1',
176
+ expected_version: version++,
177
+ to_status: 'blocked',
178
+ waiting_on: 'synthetic dependency',
179
+ });
180
+ await call(c, 'update_status', { task_id: 't1', expected_version: version, to_status: 'done', waiting_on: 'x' }, 'task_input_invalid');
181
+ await call(c, 'update_status', { task_id: 't1', expected_version: version, to_status: 'done' }, C.completion_gate_unmet);
182
+ await call(c, 'update_status', { task_id: 't1', expected_version: 1, to_status: 'started' }, C.version_conflict);
183
+ }
184
+ for (const kind of ['pull_request', 'ci', 'production_readback']) {
185
+ const args = {
186
+ task_id: 't1',
187
+ expected_version: version,
188
+ kind,
189
+ ref: { a: 1, b: 2 },
190
+ idempotency_key: `e-${kind}`,
191
+ };
192
+ const q = await call(c, 'attach_evidence', args);
193
+ assert.equal(q.task.version, ++version);
194
+ assert.deepEqual(await call(c, 'attach_evidence', { ...args, ref: { b: 2, a: 1 } }), q);
195
+ await call(c, 'attach_evidence', { ...args, ref: { a: 2 } }, C.idempotency_conflict);
196
+ }
197
+ assert.equal((await c.snapshot()).evidence.length, 3);
198
+ await call(c, 'attach_evidence', { task_id: 't1', expected_version: 1, kind: 'ci', ref: {} }, C.version_conflict);
199
+ await call(c, 'attach_evidence', { task_id: 't2', expected_version: 1, kind: 'ci', ref: {} }, C.claim_not_held);
200
+ if (index === 6) {
201
+ const args = {
202
+ task_id: 't1',
203
+ expected_version: version,
204
+ to_status: 'done',
205
+ idempotency_key: 'done',
206
+ };
207
+ const q = await call(c, 'update_status', args);
208
+ assert.equal(q.task.status, 'completed');
209
+ assert.deepEqual(await call(c, 'update_status', args), q);
210
+ await call(c, 'update_status', { ...args, idempotency_key: 'done-again' }, C.task_already_completed);
211
+ const s = await c.snapshot();
212
+ assert.equal(s.completions.length, 1);
213
+ assert.equal(s.audit.length, 1);
214
+ assert.equal(s.tasks[0].version, version + 1);
215
+ }
216
+ }
217
+ else if (index === 7) {
218
+ const valid = [
219
+ {},
220
+ { task_id: 't1' },
221
+ { task_id: 't1' },
222
+ {},
223
+ { task_id: 't1' },
224
+ { task_id: 't1', expected_version: 1, kind: 'ci', ref: {} },
225
+ { task_id: 't1', expected_version: 1, to_status: 'started' },
226
+ ];
227
+ for (let i = 0; i < 7; i++) {
228
+ await call(c, QUEUE_TASK_TOOL_NAMES[i], { ...valid[i], unknown: true }, 'task_input_invalid');
229
+ await call(c, QUEUE_TASK_TOOL_NAMES[i], { task_id: 7 }, 'task_input_invalid');
230
+ if (i !== 0 && i !== 3)
231
+ await call(c, QUEUE_TASK_TOOL_NAMES[i], {}, 'task_input_invalid');
232
+ }
233
+ for (let i = 0; i < 7; i++) {
234
+ const required = queueTaskToolDefinitions[i].inputSchema.required ?? [];
235
+ for (const field of required) {
236
+ const missing = { ...valid[i] };
237
+ delete missing[field];
238
+ await call(c, QUEUE_TASK_TOOL_NAMES[i], missing, 'task_input_invalid');
239
+ await call(c, QUEUE_TASK_TOOL_NAMES[i], { ...valid[i], [field]: false }, 'task_input_invalid');
240
+ }
241
+ }
242
+ for (const task_id of ['', ' ', '😀'.repeat(257)])
243
+ await call(c, 'get_task', { task_id }, 'task_input_invalid');
244
+ for (const limit of [0, 51, 1.5])
245
+ await call(c, 'list_my_tasks', { limit }, 'task_input_invalid');
246
+ await call(c, 'list_my_tasks', { statuses: ['unknown'] }, 'task_input_invalid');
247
+ for (const expected_version of [0, -1, 1.2])
248
+ await call(c, 'attach_evidence', { ...valid[5], expected_version }, 'task_input_invalid');
249
+ for (const ref of [[], null, 'text'])
250
+ await call(c, 'attach_evidence', { ...valid[5], ref }, 'task_input_invalid');
251
+ await call(c, 'attach_evidence', { ...valid[5], kind: 'unknown' }, 'task_input_invalid');
252
+ for (const waiting_on of [' ', 'x'.repeat(2001)])
253
+ await call(c, 'update_status', { ...valid[6], to_status: 'blocked', waiting_on }, 'task_input_invalid');
254
+ for (const idempotency_key of [' ', 'api:x', 'workflow:x'])
255
+ await call(c, 'claim_next', { idempotency_key }, 'task_input_invalid');
256
+ assert.equal((await c.snapshot()).calls.length, 0);
257
+ for (const task_id of ['😀'.repeat(256), 'a/b'])
258
+ await call(c, 'get_task', { task_id }, C.task_not_found);
259
+ for (const limit of [1, 50])
260
+ await call(c, 'list_my_tasks', { limit });
261
+ await call(c, 'claim_task', { task_id: 't1' });
262
+ await call(c, 'update_status', {
263
+ ...valid[6],
264
+ to_status: 'blocked',
265
+ waiting_on: 'x'.repeat(2000),
266
+ });
267
+ const s = await c.snapshot();
268
+ assert.equal(s.calls[0].input.task_id, '😀'.repeat(256));
269
+ assert.equal(s.calls[1].input.task_id, 'a/b');
270
+ assert.equal(s.calls[4].input.mode, 'by_id');
271
+ }
272
+ else if (index === 8) {
273
+ const keyFailure = await connect(createQueueReferenceSeed(), undefined, ['invalid/key']);
274
+ await call(keyFailure, 'claim_next', {}, 'task_contract_error');
275
+ assert.deepEqual(steps.at(-1).error.details, { outcome: 'not_sent' });
276
+ assert.equal((await keyFailure.snapshot()).calls.length, 0);
277
+ const cases = [
278
+ ...['get_task', 'claim_next'].flatMap((tool) => [
279
+ {
280
+ tool,
281
+ result: {
282
+ status: 'error',
283
+ error: {
284
+ code: 'synthetic_denied',
285
+ message: 'denied',
286
+ details: { body: { auth: 'credential-sentinel' } },
287
+ },
288
+ },
289
+ code: 'task_contract_error',
290
+ },
291
+ {
292
+ tool,
293
+ result: {
294
+ status: 'error',
295
+ error: { code: 'synthetic_denied', message: 'credential-sentinel' },
296
+ },
297
+ code: 'task_contract_error',
298
+ },
299
+ {
300
+ tool,
301
+ result: {
302
+ status: 'unavailable',
303
+ error: {
304
+ code: 'unexpected',
305
+ message: 'unavailable',
306
+ details: { outcome: 'unknown' },
307
+ },
308
+ },
309
+ code: 'task_contract_error',
310
+ },
311
+ ]),
312
+ { tool: 'claim_next', result: null, code: 'task_contract_error' },
313
+ {
314
+ tool: 'get_task',
315
+ result: {
316
+ status: 'error',
317
+ error: {
318
+ code: 'synthetic_denied',
319
+ message: 'denied',
320
+ http_status: 409,
321
+ details: { reason: 'synthetic' },
322
+ },
323
+ },
324
+ code: 'synthetic_denied',
325
+ },
326
+ ...['not_sent', 'unknown'].map((outcome) => ({
327
+ tool: 'claim_next',
328
+ result: {
329
+ status: 'unavailable',
330
+ error: { code: 'task_api_unavailable', message: 'unavailable', details: { outcome } },
331
+ },
332
+ code: 'task_api_unavailable',
333
+ })),
334
+ {
335
+ tool: 'claim_next',
336
+ result: {
337
+ status: 'unavailable',
338
+ error: { code: 'task_api_unavailable', message: 'unavailable' },
339
+ },
340
+ code: 'task_contract_error',
341
+ },
342
+ {
343
+ tool: 'claim_next',
344
+ result: {
345
+ status: 'unavailable',
346
+ error: {
347
+ code: 'task_auth_unavailable',
348
+ message: 'unavailable',
349
+ details: { outcome: 'unknown' },
350
+ },
351
+ },
352
+ code: 'task_auth_unavailable',
353
+ },
354
+ ...['throw', 'reject'].map((type) => ({
355
+ tool: 'claim_next',
356
+ type,
357
+ code: 'task_api_unavailable',
358
+ })),
359
+ ...[
360
+ { items: [] },
361
+ { items: [{ id: 't1', version: 0, status: 'pending' }], next_cursor: null },
362
+ null,
363
+ ].map((queue) => ({
364
+ tool: 'list_my_tasks',
365
+ result: { status: 'ok', queue },
366
+ code: 'task_contract_error',
367
+ })),
368
+ {
369
+ tool: 'claim_next',
370
+ result: { status: 'ok', queue: { status: 'unknown' } },
371
+ code: 'task_contract_error',
372
+ },
373
+ {
374
+ tool: 'renew_claim',
375
+ result: { status: 'ok', queue: { task: { id: 't1', version: 1, status: 'pending' } } },
376
+ code: 'task_contract_error',
377
+ },
378
+ ...[{ code: 'x' }, { code: 1, message: 'x' }].map((error) => ({
379
+ tool: 'claim_next',
380
+ result: { status: 'error', error },
381
+ code: 'task_contract_error',
382
+ })),
383
+ ];
384
+ for (const test of cases) {
385
+ const state = createQueueReferenceSeed();
386
+ state.scripted = [{ at: 1, type: test.type ?? 'result', result: test.result }];
387
+ const x = await connect(state);
388
+ await call(x, test.tool, test.tool === 'get_task' || test.tool === 'renew_claim' ? { task_id: 't1' } : {}, test.code);
389
+ const last = steps.at(-1);
390
+ if (test.result &&
391
+ test.result.status !== 'ok' &&
392
+ test.code !== 'task_contract_error')
393
+ assert.deepEqual(last, test.result);
394
+ if ((test.type || test.code === 'task_contract_error') &&
395
+ test.tool !== 'list_my_tasks' &&
396
+ test.tool !== 'get_task')
397
+ assert.deepEqual(last.error.details, { outcome: 'unknown' });
398
+ assert.equal((await x.snapshot()).calls.length, 1);
399
+ }
400
+ }
401
+ else {
402
+ const tools = await c.listTools();
403
+ assert.deepEqual(tools, queueTaskToolDefinitions);
404
+ assert.deepEqual(tools.map((t) => t.name), QUEUE_TASK_TOOL_NAMES);
405
+ const expectedAnnotations = {
406
+ list_my_tasks: {
407
+ readOnlyHint: true,
408
+ destructiveHint: false,
409
+ idempotentHint: true,
410
+ openWorldHint: true,
411
+ },
412
+ get_task: {
413
+ readOnlyHint: true,
414
+ destructiveHint: false,
415
+ idempotentHint: true,
416
+ openWorldHint: true,
417
+ },
418
+ claim_task: {
419
+ readOnlyHint: false,
420
+ destructiveHint: true,
421
+ idempotentHint: false,
422
+ openWorldHint: true,
423
+ },
424
+ claim_next: {
425
+ readOnlyHint: false,
426
+ destructiveHint: true,
427
+ idempotentHint: false,
428
+ openWorldHint: true,
429
+ },
430
+ renew_claim: {
431
+ readOnlyHint: false,
432
+ destructiveHint: true,
433
+ idempotentHint: false,
434
+ openWorldHint: true,
435
+ },
436
+ attach_evidence: {
437
+ readOnlyHint: false,
438
+ destructiveHint: true,
439
+ idempotentHint: false,
440
+ openWorldHint: true,
441
+ },
442
+ update_status: {
443
+ readOnlyHint: false,
444
+ destructiveHint: true,
445
+ idempotentHint: false,
446
+ openWorldHint: true,
447
+ },
448
+ };
449
+ for (let i = 0; i < tools.length; i++) {
450
+ assert.deepEqual(tools[i].annotations, expectedAnnotations[tools[i].name]);
451
+ assert.equal(tools[i].inputSchema.additionalProperties, false);
452
+ for (const key of ['agent_id', 'assignee', 'principal', 'scope', 'token', 'api_url'])
453
+ assert.ok(!(key in (tools[i].inputSchema.properties ?? {})));
454
+ }
455
+ assert.deepEqual(tools.map((t) => t.inputSchema.required), [
456
+ [],
457
+ ['task_id'],
458
+ ['task_id'],
459
+ [],
460
+ ['task_id'],
461
+ ['task_id', 'expected_version', 'kind', 'ref'],
462
+ ['task_id', 'expected_version', 'to_status'],
463
+ ]);
464
+ const properties = tools.map((t) => t.inputSchema.properties);
465
+ assert.deepEqual(properties[0].statuses.items.enum, [
466
+ 'pending',
467
+ 'in_progress',
468
+ 'waiting',
469
+ 'completed',
470
+ 'cancelled',
471
+ ]);
472
+ assert.deepEqual(properties[5].kind.enum, ['pull_request', 'ci', 'production_readback']);
473
+ assert.deepEqual(properties[6].to_status.enum, [
474
+ 'started',
475
+ 'waiting_for_review',
476
+ 'blocked',
477
+ 'done',
478
+ ]);
479
+ steps.push(tools);
480
+ }
481
+ steps.push(await c.snapshot());
482
+ return { scenario: name, steps };
483
+ }
484
+ finally {
485
+ await Promise.all(connections.map((c) => c.close()));
486
+ }
487
+ }
@@ -14,11 +14,11 @@ Brainbase OSS and organization deployments share the same Judgment DAG semantic
14
14
 
15
15
  Brainbase is not only a memory/knowledge store. Its core responsibility is to externalize, preserve, replay, evaluate, and improve the structure by which a person or organization turns context into judgment and action.
16
16
 
17
- The prior product boundary that limited OSS Brainbase to `Remember / Organize / Retrieve / Learn` is revised. Brainbase owns the **judgment substrate**; Mana may own autonomous operating loops, continuous follow-through, and outcome ownership on top of that substrate.
17
+ The prior product boundary that limited OSS Brainbase to `Remember / Organize / Retrieve / Learn` is revised. Brainbase owns the **judgment substrate**. [ADR-026](https://github.com/Unson-LLC/brainbase-project/blob/main/docs/architecture/adr/ADR-026-review-promises-and-external-agents.md) retires Mana and makes Brainbase the canonical home of review promises, read by external agents such as Grok Bot and, for enterprise use, Claude (Duet).
18
18
 
19
19
  ```text
20
20
  Brainbase = Remember / Organize / Retrieve / Judge / Replay / Learn
21
- Mana = Operate / Prioritize continuously / Act autonomously / Follow-through
21
+ External agents = Check agreed review dates / Read promises and actuals / Propose the agreed next step
22
22
  ```
23
23
 
24
24
  Brainbase may represent and execute judgment nodes. It does not become an always-on autonomous operator merely because it can execute a DAG.
@@ -269,19 +269,24 @@ Organization/Enterprise adds operational concerns rather than a different brain
269
269
  - cross-project governance
270
270
  - enterprise security boundaries
271
271
 
272
- ## Mana boundary after this decision
272
+ ## Review promises and external-agent boundary
273
273
 
274
- Mana is no longer defined as the only place where judgment can occur.
274
+ [ADR-026](https://github.com/Unson-LLC/brainbase-project/blob/main/docs/architecture/adr/ADR-026-review-promises-and-external-agents.md) supersedes the former Mana operating boundary. Brainbase is not paired with Mana; Mana is retired by product decision.
275
275
 
276
- Brainbase owns **what the judgment graph is, what it depends on, who/what can run it, what it produced, and how it evaluated**.
276
+ Brainbase owns **what the judgment graph is, what it depends on, who/what can run it, what it produced, and how it evaluated**. It is also the canonical home of the review promise for each world-model hypothesis and prediction: one metric, an acceptable deviation, a review date (check even without a deviation), and the action agreed in advance if it deviates.
277
277
 
278
- Mana owns the higher-order operating behavior that repeatedly decides *when* to run graphs, prioritizes across goals, initiates work, monitors progress, follows through, and intervenes over time.
278
+ The human sets that promise when placing the hypothesis. The AI does not invent or change review conditions when results arrive. Grok Bot routines are the current intended watcher: read the promise and actuals on the review date, then produce the agreed replanning proposal or return the decision to Sato. Enterprise Claude (Duet) should be able to read the same promise. Brainbase does not depend on a particular watcher.
279
+
280
+ ADR-014 F5's return to a human when relying on a refuted world model remains one of these agreed actions; the promise does not grant additional execution or adoption authority. Recording the promise version, observations, check, and resulting action must allow later inspection of whether the agent followed the agreement.
279
281
 
280
282
  ```text
281
- Brainbase: executable organizational cognition
282
- Mana: autonomous organizational operation
283
+ Brainbase: judgment substrate and canonical review promises
284
+ External agents: scheduled observation and the pre-agreed next step
285
+ Human: hypotheses, review conditions, and required adoption/approval decisions
283
286
  ```
284
287
 
288
+ This is an accepted design direction. Promise fields in schemas/contracts, watcher integrations, and operational rollout remain Planned in ADR-026's next steps; this document update does not implement them or stop a running bot.
289
+
285
290
  ## Non-goals
286
291
 
287
292
  - Do not migrate the entire Brainbase ontology to a large Company Ontology in one release.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.49.1",
3
+ "version": "0.50.1",
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",
@@ -540,7 +540,20 @@
540
540
  "import": "./dist/private-philosophy-graph.js"
541
541
  },
542
542
  "./ui/native-scrollbars": "./ui/native-scrollbars.js",
543
- "./ui/native-scrollbars.css": "./ui/native-scrollbars.css"
543
+ "./ui/native-scrollbars.css": "./ui/native-scrollbars.css",
544
+ "./queue-task-tools": {
545
+ "types": "./dist/queue-task-tools.d.ts",
546
+ "import": "./dist/queue-task-tools.js"
547
+ },
548
+ "./testing/queue-task-tools-contract": {
549
+ "types": "./dist/testing/queue-task-tools-contract.d.ts",
550
+ "import": "./dist/testing/queue-task-tools-contract.js"
551
+ },
552
+ "./contracts/brainbase-public-contract.v1.json": "./contracts/brainbase-public-contract.v1.json",
553
+ "./ownership-survey": {
554
+ "types": "./dist/ownership-survey.d.ts",
555
+ "import": "./dist/ownership-survey.js"
556
+ }
544
557
  },
545
558
  "bin": {
546
559
  "brainbase-mcp": "dist/index.js",
@@ -601,7 +614,10 @@
601
614
  "zod": "^4.6.7"
602
615
  },
603
616
  "overrides": {
604
- "ip-address": "^10.4.0"
617
+ "ip-address": "^10.4.0",
618
+ "vitepress": {
619
+ "vite": "^6.4.5"
620
+ }
605
621
  },
606
622
  "devDependencies": {
607
623
  "@electric-sql/pglite": "^0.5.8",
@@ -613,7 +629,7 @@
613
629
  "tsx": "^4.19.4",
614
630
  "typescript": "^5.8.3",
615
631
  "vitepress": "^1.6.4",
616
- "vitest": "^4.1.8"
632
+ "vitest": "^4.1.12"
617
633
  },
618
634
  "engines": {
619
635
  "node": ">=20"
@@ -628,5 +644,5 @@
628
644
  "url": "https://github.com/Unson-LLC/brainbase/issues"
629
645
  },
630
646
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
631
- "gitHead": "f952568d63552398c0d6ebf29e05dbbf080d1bf9"
647
+ "gitHead": "75bd4a34f5092032688284d857badc7d8984cd73"
632
648
  }
@@ -1073,10 +1073,6 @@ function appendReferenceList(doc, references) {
1073
1073
  if (list.children?.length) wrap.append(list);
1074
1074
  if (bare.length) {
1075
1075
  wrap.append(makeWorkspaceElement(doc, 'p', { className: 'bb-jh-reference-kinds', text: referenceKindCounts(bare) }));
1076
- wrap.append(makeWorkspaceElement(doc, 'p', {
1077
- className: 'bb-jh-reference-note',
1078
- text: 'この記録には参照の名前が残っていません。どの記録かは「記録の詳細」のIDで確かめられます。',
1079
- }));
1080
1076
  }
1081
1077
  return wrap;
1082
1078
  }
@@ -1466,10 +1462,6 @@ function appendNormalRecordDetails(doc, record, { onCopyReference, open = false,
1466
1462
  ]));
1467
1463
  const handoff = makeWorkspaceElement(doc, 'div', { className: 'bb-jh-handoff' });
1468
1464
  handoff.append(makeWorkspaceElement(doc, 'h4', { text: '次の判断に引き継ぐ' }));
1469
- handoff.append(makeWorkspaceElement(doc, 'p', {
1470
- className: 'bb-jh-reference-note',
1471
- text: 'この判断を別の判断の根拠として使うときに、AIへ渡す参照です。コピーしてAIとの会話に貼ります。',
1472
- }));
1473
1465
  handoff.append(appendNormalReferenceExport(doc, record, null, { onCopyReference }));
1474
1466
  for (const event of events) handoff.append(appendNormalReferenceExport(doc, record, event, { onCopyReference }));
1475
1467
  details.append(handoff);
@@ -1896,13 +1888,6 @@ function summaryLine(doc, aggregate, { loading = false } = {}) {
1896
1888
  if (aggregate?.mode !== 'normal') return line;
1897
1889
  line.append(makeWorkspaceElement(doc, 'span', { text: ' ・ 結果を確かめた判断 ' }));
1898
1890
  line.append(makeWorkspaceElement(doc, Number.isInteger(confirmed) ? 'strong' : 'span', { text: Number.isInteger(confirmed) ? `${confirmed}件` : '数えられません' }));
1899
- // Results are never recorded automatically; say how a person adds one.
1900
- if (Number.isInteger(confirmed) && confirmed < retrieved) {
1901
- line.append(makeWorkspaceElement(doc, 'span', {
1902
- className: 'bb-jh-summary-note',
1903
- text: ' 結果は自動では記録されません。判断を開いて「良かったか」を記録すると数えられます。',
1904
- }));
1905
- }
1906
1891
  return line;
1907
1892
  }
1908
1893