@unson/brainbase-mcp 0.50.31 → 0.51.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.
Files changed (53) hide show
  1. package/contracts/canonical-task/store-schema.sql +3 -0
  2. package/dist/antigravity-judgment-hook.d.ts +5 -0
  3. package/dist/antigravity-judgment-hook.js +344 -27
  4. package/dist/automation-run.js +3 -2
  5. package/dist/canonical-task-postgres.js +3 -0
  6. package/dist/canonical-task-service.d.ts +6 -0
  7. package/dist/canonical-task-service.js +40 -1
  8. package/dist/company-os-learning-adoption.d.ts +9 -0
  9. package/dist/company-os-learning-adoption.js +50 -1
  10. package/dist/durable-waits.d.ts +30 -0
  11. package/dist/durable-waits.js +100 -94
  12. package/dist/foundation-public-provider.d.ts +3 -1
  13. package/dist/foundation-public-provider.js +2 -2
  14. package/dist/graph-corrections.d.ts +46 -1
  15. package/dist/graph-corrections.js +172 -1
  16. package/dist/judgment-event-outbox.d.ts +24 -2
  17. package/dist/judgment-event-outbox.js +92 -10
  18. package/dist/judgment-frame.js +2 -2
  19. package/dist/judgment-host.d.ts +4 -1
  20. package/dist/judgment-host.js +126 -14
  21. package/dist/judgment-task-progress.d.ts +41 -0
  22. package/dist/judgment-task-progress.js +18 -0
  23. package/dist/knowledge-continuation.js +7 -1
  24. package/dist/knowledge-lookup.js +43 -58
  25. package/dist/mcp-runtime.d.ts +9 -0
  26. package/dist/mcp-runtime.js +12 -4
  27. package/dist/meeting-automation-runtime.d.ts +52 -0
  28. package/dist/meeting-automation-runtime.js +46 -0
  29. package/dist/queue-task-tools.js +2 -2
  30. package/dist/routine-liveness.js +0 -1
  31. package/dist/routine-runtime.js +1 -1
  32. package/dist/server.d.ts +59 -85
  33. package/dist/server.js +44 -36
  34. package/dist/ssot.js +1 -1
  35. package/dist/testing/queue-task-tools-contract.js +1 -1
  36. package/dist/world-model-impact-index.d.ts +132 -0
  37. package/dist/world-model-impact-index.js +901 -0
  38. package/package.json +6 -18
  39. package/ui/judgment-history.css +13 -0
  40. package/ui/objective-editor.css +19 -2
  41. package/ui/objective-editor.js +6 -3
  42. package/ui/project-workspace.css +33 -26
  43. package/ui/workspace-kit.js +9 -7
  44. package/ui/world/world-view.css +65 -46
  45. package/ui/world/world-view.js +27 -18
  46. package/dist/execution-authority-http.d.ts +0 -30
  47. package/dist/execution-authority-http.js +0 -454
  48. package/dist/execution-authority.d.ts +0 -282
  49. package/dist/execution-authority.js +0 -867
  50. package/dist/resource-reservation-http.d.ts +0 -31
  51. package/dist/resource-reservation-http.js +0 -371
  52. package/dist/resource-reservations.d.ts +0 -221
  53. package/dist/resource-reservations.js +0 -577
package/dist/server.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { type FoundationPublicConnection } from './foundation-public-provider.js';
2
2
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { normalizeMcpToolInputSchemaForPortability, type McpToolSchemaProfile } from './mcp-tool-schema-portability.js';
4
+ export { normalizeMcpToolInputSchemaForPortability };
3
5
  export declare const toolDefinitions: readonly [{
4
6
  readonly name: "get_context";
5
7
  readonly description: "Return an initial owner context snapshot. For a question needing related judgments or evidence, use search with an explicit relation plan; this snapshot is not a retrieval answer.";
@@ -30,6 +32,7 @@ export declare const toolDefinitions: readonly [{
30
32
  readonly type: "string";
31
33
  };
32
34
  readonly type: {
35
+ readonly type: "string";
33
36
  readonly enum: readonly ["person", "org", "project", "relationship", "decision"];
34
37
  };
35
38
  };
@@ -73,12 +76,15 @@ export declare const toolDefinitions: readonly [{
73
76
  readonly required: readonly ["relation", "direction"];
74
77
  readonly properties: {
75
78
  readonly relation: {
79
+ readonly type: "string";
76
80
  readonly enum: readonly ["member_of", "participates_in", "accountable_for", "owned_by", "related_to", "governs", "supersedes"];
77
81
  };
78
82
  readonly direction: {
83
+ readonly type: "string";
79
84
  readonly enum: readonly ["incoming", "outgoing"];
80
85
  };
81
86
  readonly targetType: {
87
+ readonly type: "string";
82
88
  readonly enum: readonly ["person", "org", "project", "decision"];
83
89
  };
84
90
  };
@@ -161,13 +167,21 @@ export declare const toolDefinitions: readonly [{
161
167
  readonly type: "string";
162
168
  readonly minLength: 1;
163
169
  };
164
- readonly source: {};
165
- readonly source_pointer: {};
170
+ readonly source: {
171
+ readonly type: "string";
172
+ readonly description: "Optional caller source label or serialized pointer.";
173
+ };
174
+ readonly source_pointer: {
175
+ readonly type: "string";
176
+ readonly description: "Optional source pointer URI or identifier.";
177
+ };
166
178
  readonly parent_episode_id: {
167
- readonly type: readonly ["string", "null"];
179
+ readonly type: "string";
180
+ readonly description: "Optional parent episode ID. Omit when there is no parent episode.";
168
181
  };
169
182
  readonly permission_snapshot: {
170
183
  readonly type: "object";
184
+ readonly additionalProperties: true;
171
185
  };
172
186
  readonly sensitivity: {
173
187
  readonly type: "string";
@@ -190,6 +204,7 @@ export declare const toolDefinitions: readonly [{
190
204
  };
191
205
  readonly metadata: {
192
206
  readonly type: "object";
207
+ readonly additionalProperties: true;
193
208
  };
194
209
  };
195
210
  };
@@ -272,9 +287,11 @@ export declare const toolDefinitions: readonly [{
272
287
  readonly type: "string";
273
288
  };
274
289
  readonly mode: {
290
+ readonly type: "string";
275
291
  readonly enum: readonly ["mcp", "drive", "gmail", "local_folder", "single_document"];
276
292
  };
277
293
  readonly status: {
294
+ readonly type: "string";
278
295
  readonly enum: readonly ["ready", "waiting_for_authorization", "unavailable", "error", "unconfirmed"];
279
296
  };
280
297
  readonly evidencePointer: {
@@ -341,9 +358,11 @@ export declare const toolDefinitions: readonly [{
341
358
  };
342
359
  readonly permissionSnapshot: {
343
360
  readonly type: "object";
361
+ readonly additionalProperties: true;
344
362
  };
345
363
  readonly collectionStatus: {
346
- readonly const: "collected";
364
+ readonly type: "string";
365
+ readonly enum: readonly ["collected"];
347
366
  };
348
367
  };
349
368
  };
@@ -360,8 +379,10 @@ export declare const toolDefinitions: readonly [{
360
379
  };
361
380
  readonly payload: {
362
381
  readonly type: "object";
382
+ readonly additionalProperties: true;
363
383
  };
364
384
  readonly observationClass: {
385
+ readonly type: "string";
365
386
  readonly enum: readonly ["observed", "inferred"];
366
387
  };
367
388
  readonly evidenceId: {
@@ -393,91 +414,37 @@ export declare const toolDefinitions: readonly [{
393
414
  readonly minItems: 1;
394
415
  readonly maxItems: 50;
395
416
  readonly items: {
396
- readonly oneOf: readonly [{
397
- readonly type: "object";
398
- readonly required: readonly ["candidateId", "decision", "reason"];
399
- readonly additionalProperties: false;
400
- readonly properties: {
401
- readonly candidateId: {
402
- readonly type: "string";
403
- readonly minLength: 1;
404
- readonly maxLength: 200;
405
- };
406
- readonly decision: {
407
- readonly const: "approve";
408
- };
409
- readonly reason: {
410
- readonly type: "string";
411
- readonly minLength: 1;
412
- readonly maxLength: 500;
413
- };
417
+ readonly type: "object";
418
+ readonly required: readonly ["candidateId", "decision", "reason"];
419
+ readonly additionalProperties: false;
420
+ readonly properties: {
421
+ readonly candidateId: {
422
+ readonly type: "string";
423
+ readonly minLength: 1;
424
+ readonly maxLength: 200;
414
425
  };
415
- }, {
416
- readonly type: "object";
417
- readonly required: readonly ["candidateId", "decision", "reason", "payload"];
418
- readonly additionalProperties: false;
419
- readonly properties: {
420
- readonly candidateId: {
421
- readonly type: "string";
422
- readonly minLength: 1;
423
- readonly maxLength: 200;
424
- };
425
- readonly decision: {
426
- readonly const: "edit";
427
- };
428
- readonly reason: {
429
- readonly type: "string";
430
- readonly minLength: 1;
431
- readonly maxLength: 500;
432
- };
433
- readonly payload: {
434
- readonly type: "object";
435
- };
426
+ readonly decision: {
427
+ readonly type: "string";
428
+ readonly enum: readonly ["approve", "edit", "reject", "merge"];
429
+ readonly description: "Review decision. Supply payload only for edit and mergeIntoCandidateId only for merge.";
436
430
  };
437
- }, {
438
- readonly type: "object";
439
- readonly required: readonly ["candidateId", "decision", "reason"];
440
- readonly additionalProperties: false;
441
- readonly properties: {
442
- readonly candidateId: {
443
- readonly type: "string";
444
- readonly minLength: 1;
445
- readonly maxLength: 200;
446
- };
447
- readonly decision: {
448
- readonly const: "reject";
449
- };
450
- readonly reason: {
451
- readonly type: "string";
452
- readonly minLength: 1;
453
- readonly maxLength: 500;
454
- };
431
+ readonly reason: {
432
+ readonly type: "string";
433
+ readonly minLength: 1;
434
+ readonly maxLength: 500;
455
435
  };
456
- }, {
457
- readonly type: "object";
458
- readonly required: readonly ["candidateId", "decision", "reason", "mergeIntoCandidateId"];
459
- readonly additionalProperties: false;
460
- readonly properties: {
461
- readonly candidateId: {
462
- readonly type: "string";
463
- readonly minLength: 1;
464
- readonly maxLength: 200;
465
- };
466
- readonly decision: {
467
- readonly const: "merge";
468
- };
469
- readonly reason: {
470
- readonly type: "string";
471
- readonly minLength: 1;
472
- readonly maxLength: 500;
473
- };
474
- readonly mergeIntoCandidateId: {
475
- readonly type: "string";
476
- readonly minLength: 1;
477
- readonly maxLength: 200;
478
- };
436
+ readonly payload: {
437
+ readonly type: "object";
438
+ readonly additionalProperties: true;
439
+ readonly description: "Required only when decision is edit; omit for approve, reject, or merge.";
440
+ };
441
+ readonly mergeIntoCandidateId: {
442
+ readonly type: "string";
443
+ readonly minLength: 1;
444
+ readonly maxLength: 200;
445
+ readonly description: "Required only when decision is merge; omit for approve, edit, or reject.";
479
446
  };
480
- }];
447
+ };
481
448
  };
482
449
  };
483
450
  };
@@ -501,6 +468,7 @@ export declare const toolDefinitions: readonly [{
501
468
  readonly description: "runId returned by the previous onboarding step.";
502
469
  };
503
470
  readonly action: {
471
+ readonly type: "string";
504
472
  readonly enum: readonly ["record", "review"];
505
473
  readonly description: "Use record first. Use review only after the answer receipt has been recorded.";
506
474
  };
@@ -521,6 +489,7 @@ export declare const toolDefinitions: readonly [{
521
489
  readonly description: "Required for action=record. Use only promotedCanonicalIds returned by review.";
522
490
  };
523
491
  readonly verdict: {
492
+ readonly type: "string";
524
493
  readonly enum: readonly ["useful", "not_useful"];
525
494
  readonly description: "Required for action=review.";
526
495
  };
@@ -553,6 +522,7 @@ export declare const toolDefinitions: readonly [{
553
522
  readonly type: "string";
554
523
  };
555
524
  readonly ontologyVersion: {
525
+ readonly type: "string";
556
526
  readonly enum: readonly ["0.0.0", "1.0.0", "2.0.0"];
557
527
  };
558
528
  };
@@ -571,6 +541,7 @@ export declare const toolDefinitions: readonly [{
571
541
  readonly format: "date-time";
572
542
  };
573
543
  readonly ontologyVersion: {
544
+ readonly type: "string";
574
545
  readonly enum: readonly ["0.0.0", "1.0.0", "2.0.0"];
575
546
  };
576
547
  };
@@ -639,6 +610,7 @@ export declare const toolDefinitions: readonly [{
639
610
  };
640
611
  };
641
612
  readonly policy: {
613
+ readonly type: "string";
642
614
  readonly enum: readonly ["strict", "prefer_project", "allow_global_fallback"];
643
615
  };
644
616
  };
@@ -647,6 +619,7 @@ export declare const toolDefinitions: readonly [{
647
619
  readonly type: "array";
648
620
  readonly minItems: 1;
649
621
  readonly items: {
622
+ readonly type: "string";
650
623
  readonly enum: readonly ["person", "org", "project", "decision"];
651
624
  };
652
625
  };
@@ -658,5 +631,6 @@ export declare function callBrainbaseTool(name: string, rawArgs?: unknown, optio
658
631
  }): Promise<unknown>;
659
632
  export declare function createServer(options?: {
660
633
  foundation?: FoundationPublicConnection;
634
+ schemaProfile?: McpToolSchemaProfile;
661
635
  }): Server;
662
636
  export declare function runMcpServer(): Promise<void>;
package/dist/server.js CHANGED
@@ -8,6 +8,8 @@ import { join } from 'node:path';
8
8
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
9
9
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
10
10
  import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
11
+ import { applyMcpToolSchemaProfile, normalizeMcpToolInputSchemaForPortability } from './mcp-tool-schema-portability.js';
12
+ export { normalizeMcpToolInputSchemaForPortability };
11
13
  import { z } from 'zod';
12
14
  import { ConnectedOnboardingRuntime } from './connected-onboarding.js';
13
15
  import { validateCanonicalGraph } from './canonical-graph.js';
@@ -171,7 +173,7 @@ export const toolDefinitions = [
171
173
  type: 'object',
172
174
  properties: {
173
175
  dataDir: { type: 'string' },
174
- type: { enum: ['person', 'org', 'project', 'relationship', 'decision'] }
176
+ type: { type: 'string', enum: ['person', 'org', 'project', 'relationship', 'decision'] }
175
177
  }
176
178
  }
177
179
  },
@@ -189,9 +191,9 @@ export const toolDefinitions = [
189
191
  seedIds: { type: 'array', minItems: 1, maxItems: 10, items: { type: 'string' }, description: 'Canonical IDs chosen by the calling model; no embeddings needed.' },
190
192
  steps: { type: 'array', minItems: 1, maxItems: 3, items: {
191
193
  type: 'object', additionalProperties: false, required: ['relation', 'direction'], properties: {
192
- relation: { enum: ['member_of', 'participates_in', 'accountable_for', 'owned_by', 'related_to', 'governs', 'supersedes'] },
193
- direction: { enum: ['incoming', 'outgoing'] },
194
- targetType: { enum: ['person', 'org', 'project', 'decision'] }
194
+ relation: { type: 'string', enum: ['member_of', 'participates_in', 'accountable_for', 'owned_by', 'related_to', 'governs', 'supersedes'] },
195
+ direction: { type: 'string', enum: ['incoming', 'outgoing'] },
196
+ targetType: { type: 'string', enum: ['person', 'org', 'project', 'decision'] }
195
197
  }
196
198
  } },
197
199
  limit: { type: 'integer', minimum: 1, maximum: 50 },
@@ -241,15 +243,15 @@ export const toolDefinitions = [
241
243
  body_hash: { type: 'string', minLength: 1 },
242
244
  occurred_at: { type: 'string', minLength: 1 },
243
245
  captured_at: { type: 'string', minLength: 1 },
244
- source: {},
245
- source_pointer: {},
246
- parent_episode_id: { type: ['string', 'null'] },
247
- permission_snapshot: { type: 'object' },
246
+ source: { type: 'string', description: 'Optional caller source label or serialized pointer.' },
247
+ source_pointer: { type: 'string', description: 'Optional source pointer URI or identifier.' },
248
+ parent_episode_id: { type: 'string', description: 'Optional parent episode ID. Omit when there is no parent episode.' },
249
+ permission_snapshot: { type: 'object', additionalProperties: true },
248
250
  sensitivity: { type: 'string', minLength: 1 },
249
251
  kind: { type: 'string', minLength: 1 },
250
252
  type: { type: 'string', minLength: 1 },
251
253
  tags: { type: 'array', items: { type: 'string', minLength: 1 } },
252
- metadata: { type: 'object' }
254
+ metadata: { type: 'object', additionalProperties: true }
253
255
  }
254
256
  }
255
257
  }
@@ -297,8 +299,8 @@ export const toolDefinitions = [
297
299
  properties: {
298
300
  dataDir: { type: 'string', description: 'Optional Personal OS directory.' }, valueTarget: { type: 'string', description: 'One concrete question the first useful answer should resolve.' },
299
301
  sources: { type: 'array', maxItems: 50, items: { type: 'object', required: ['id', 'mode', 'status'], additionalProperties: false, properties: {
300
- id: { type: 'string' }, mode: { enum: ['mcp', 'drive', 'gmail', 'local_folder', 'single_document'] },
301
- status: { enum: ['ready', 'waiting_for_authorization', 'unavailable', 'error', 'unconfirmed'] }, evidencePointer: { type: 'string' },
302
+ id: { type: 'string' }, mode: { type: 'string', enum: ['mcp', 'drive', 'gmail', 'local_folder', 'single_document'] },
303
+ status: { type: 'string', enum: ['ready', 'waiting_for_authorization', 'unavailable', 'error', 'unconfirmed'] }, evidencePointer: { type: 'string' },
302
304
  permissionScope: { type: 'array', items: { type: 'string' } }, detail: { type: 'string' }
303
305
  } } }
304
306
  }
@@ -317,10 +319,10 @@ export const toolDefinitions = [
317
319
  properties: {
318
320
  dataDir: { type: 'string' }, runId: { type: 'string', description: 'runId returned by brainbase_onboarding_start.' },
319
321
  source: { type: 'object', required: ['sourceId', 'evidencePointer', 'contentHash', 'permissionSnapshot', 'collectionStatus'], additionalProperties: false, properties: {
320
- sourceId: { type: 'string' }, evidencePointer: { type: 'string' }, contentHash: { type: 'string' }, permissionSnapshot: { type: 'object' }, collectionStatus: { const: 'collected' }
322
+ sourceId: { type: 'string' }, evidencePointer: { type: 'string' }, contentHash: { type: 'string' }, permissionSnapshot: { type: 'object', additionalProperties: true }, collectionStatus: { type: 'string', enum: ['collected'] }
321
323
  } },
322
324
  candidates: { type: 'array', maxItems: 50, items: { type: 'object', required: ['kind', 'payload', 'observationClass', 'evidenceId'], additionalProperties: false, properties: {
323
- kind: { type: 'string' }, payload: { type: 'object' }, observationClass: { enum: ['observed', 'inferred'] }, evidenceId: { type: 'string' }
325
+ kind: { type: 'string' }, payload: { type: 'object', additionalProperties: true }, observationClass: { type: 'string', enum: ['observed', 'inferred'] }, evidenceId: { type: 'string' }
324
326
  } } }
325
327
  }
326
328
  }
@@ -330,22 +332,27 @@ export const toolDefinitions = [
330
332
  description: 'Submit review decisions in actions. Inferred candidates cannot be approved or merged; use edit with a human-confirmed payload, or reject.',
331
333
  inputSchema: {
332
334
  type: 'object', required: ['runId', 'actions'], additionalProperties: false,
333
- properties: { dataDir: { type: 'string' }, runId: { type: 'string', minLength: 1, maxLength: 200 }, actions: { type: 'array', minItems: 1, maxItems: 50, items: {
334
- oneOf: [
335
- { type: 'object', required: ['candidateId', 'decision', 'reason'], additionalProperties: false, properties: {
336
- candidateId: { type: 'string', minLength: 1, maxLength: 200 }, decision: { const: 'approve' }, reason: { type: 'string', minLength: 1, maxLength: 500 }
337
- } },
338
- { type: 'object', required: ['candidateId', 'decision', 'reason', 'payload'], additionalProperties: false, properties: {
339
- candidateId: { type: 'string', minLength: 1, maxLength: 200 }, decision: { const: 'edit' }, reason: { type: 'string', minLength: 1, maxLength: 500 }, payload: { type: 'object' }
340
- } },
341
- { type: 'object', required: ['candidateId', 'decision', 'reason'], additionalProperties: false, properties: {
342
- candidateId: { type: 'string', minLength: 1, maxLength: 200 }, decision: { const: 'reject' }, reason: { type: 'string', minLength: 1, maxLength: 500 }
343
- } },
344
- { type: 'object', required: ['candidateId', 'decision', 'reason', 'mergeIntoCandidateId'], additionalProperties: false, properties: {
345
- candidateId: { type: 'string', minLength: 1, maxLength: 200 }, decision: { const: 'merge' }, reason: { type: 'string', minLength: 1, maxLength: 500 }, mergeIntoCandidateId: { type: 'string', minLength: 1, maxLength: 200 }
346
- } }
347
- ]
348
- } } }
335
+ properties: {
336
+ dataDir: { type: 'string' },
337
+ runId: { type: 'string', minLength: 1, maxLength: 200 },
338
+ actions: {
339
+ type: 'array',
340
+ minItems: 1,
341
+ maxItems: 50,
342
+ items: {
343
+ type: 'object',
344
+ required: ['candidateId', 'decision', 'reason'],
345
+ additionalProperties: false,
346
+ properties: {
347
+ candidateId: { type: 'string', minLength: 1, maxLength: 200 },
348
+ decision: { type: 'string', enum: ['approve', 'edit', 'reject', 'merge'], description: 'Review decision. Supply payload only for edit and mergeIntoCandidateId only for merge.' },
349
+ reason: { type: 'string', minLength: 1, maxLength: 500 },
350
+ payload: { type: 'object', additionalProperties: true, description: 'Required only when decision is edit; omit for approve, reject, or merge.' },
351
+ mergeIntoCandidateId: { type: 'string', minLength: 1, maxLength: 200, description: 'Required only when decision is merge; omit for approve, edit, or reject.' }
352
+ }
353
+ }
354
+ }
355
+ }
349
356
  }
350
357
  },
351
358
  {
@@ -356,10 +363,10 @@ export const toolDefinitions = [
356
363
  properties: {
357
364
  dataDir: { type: 'string', description: 'Optional Personal OS directory.' },
358
365
  runId: { type: 'string', minLength: 1, maxLength: 200, description: 'runId returned by the previous onboarding step.' },
359
- action: { enum: ['record', 'review'], description: 'Use record first. Use review only after the answer receipt has been recorded.' },
366
+ action: { type: 'string', enum: ['record', 'review'], description: 'Use record first. Use review only after the answer receipt has been recorded.' },
360
367
  answerHash: { type: 'string', pattern: '^sha256:[a-f0-9]{64}$', description: 'Required for action=record. SHA-256 of the answer body; the body itself is not stored.' },
361
368
  usedCanonicalIds: { type: 'array', minItems: 1, maxItems: 50, items: { type: 'string', minLength: 1, maxLength: 200 }, description: 'Required for action=record. Use only promotedCanonicalIds returned by review.' },
362
- verdict: { enum: ['useful', 'not_useful'], description: 'Required for action=review.' },
369
+ verdict: { type: 'string', enum: ['useful', 'not_useful'], description: 'Required for action=review.' },
363
370
  missingContext: { type: 'array', maxItems: 50, items: { type: 'string', minLength: 1, maxLength: 200 }, description: 'Optional short labels for context the answer still lacked.' }
364
371
  }
365
372
  }
@@ -379,7 +386,7 @@ export const toolDefinitions = [
379
386
  type: 'object',
380
387
  properties: {
381
388
  dataDir: { type: 'string' },
382
- ontologyVersion: { enum: ['0.0.0', '1.0.0', '2.0.0'] }
389
+ ontologyVersion: { type: 'string', enum: ['0.0.0', '1.0.0', '2.0.0'] }
383
390
  }
384
391
  }
385
392
  },
@@ -391,7 +398,7 @@ export const toolDefinitions = [
391
398
  properties: {
392
399
  dataDir: { type: 'string' },
393
400
  asOf: { type: 'string', format: 'date-time' },
394
- ontologyVersion: { enum: ['0.0.0', '1.0.0', '2.0.0'] }
401
+ ontologyVersion: { type: 'string', enum: ['0.0.0', '1.0.0', '2.0.0'] }
395
402
  }
396
403
  }
397
404
  },
@@ -431,13 +438,13 @@ export const toolDefinitions = [
431
438
  additionalProperties: false,
432
439
  properties: {
433
440
  projectIds: { type: 'array', minItems: 1, items: { type: 'string', minLength: 1 } },
434
- policy: { enum: ['strict', 'prefer_project', 'allow_global_fallback'] }
441
+ policy: { type: 'string', enum: ['strict', 'prefer_project', 'allow_global_fallback'] }
435
442
  }
436
443
  },
437
444
  entityTypes: {
438
445
  type: 'array',
439
446
  minItems: 1,
440
- items: { enum: ['person', 'org', 'project', 'decision'] }
447
+ items: { type: 'string', enum: ['person', 'org', 'project', 'decision'] }
441
448
  }
442
449
  }
443
450
  }
@@ -882,6 +889,7 @@ function onboardingGuide(state) {
882
889
  return guides[state];
883
890
  }
884
891
  export function createServer(options = {}) {
892
+ const schemaProfile = options.schemaProfile ?? 'gemini';
885
893
  const server = new Server({
886
894
  name: 'brainbase-mcp',
887
895
  version: '0.1.0'
@@ -891,7 +899,7 @@ export function createServer(options = {}) {
891
899
  }
892
900
  });
893
901
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
894
- tools: configuredToolDefinitions(options.foundation)
902
+ tools: configuredToolDefinitions(options.foundation).map((tool) => applyMcpToolSchemaProfile(tool, schemaProfile))
895
903
  }));
896
904
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
897
905
  const result = await callBrainbaseTool(request.params.name, request.params.arguments, options);
package/dist/ssot.js CHANGED
@@ -365,7 +365,7 @@ async function ensureAncillaryDirectories(dataDir) {
365
365
  /**
366
366
  * Callers in this process that wait for the same lock directory, in arrival order.
367
367
  * The directory lock still guards other processes. Without this queue, callers in
368
- * one process (for example the parallel checks in execution-authority) polled the
368
+ * one process (for example parallel checks against the same data directory) polled the
369
369
  * directory lock every retry interval, so each one waited longer than the holder
370
370
  * worked, and the polling added file operations while the holder was still writing.
371
371
  */
@@ -452,7 +452,7 @@ export async function runQueueTaskContractScenario(name, adapter, assert) {
452
452
  for (const key of ['agent_id', 'assignee', 'principal', 'scope', 'token', 'api_url'])
453
453
  assert.ok(!(key in (tools[i].inputSchema.properties ?? {})));
454
454
  }
455
- assert.deepEqual(tools.map((t) => t.inputSchema.required), [
455
+ assert.deepEqual(tools.map((t) => t.inputSchema.required ?? []), [
456
456
  [],
457
457
  ['task_id'],
458
458
  ['task_id'],
@@ -0,0 +1,132 @@
1
+ import type { FoundationAcl, FoundationRelationEndpoint, FoundationRelationId, FoundationRelationReference, FoundationType } from './ontology-foundation.js';
2
+ import type { FoundationCatalog, FoundationCatalogRecord } from './types.js';
3
+ import type { JudgmentProblemSnapshot } from './judgment-problem-snapshot.js';
4
+ import type { ImpactReviewAccessContext, ImpactReviewAffectedPlan, ImpactReviewChange, ImpactReviewIndexPort, ImpactReviewPlan, ImpactReviewReference, ImpactReviewRelationDomain } from './company-os-impact-review.js';
5
+ /**
6
+ * Deterministic reverse-dependency indexer for Brainbase world models.
7
+ *
8
+ * Traverses `FoundationCatalog` definitions and relations (`uses_as_input`,
9
+ * `predicts`, `evaluated_by`, `used_as_basis`, `applies_to`, `contributes_to`,
10
+ * `execution_depends_on`, `time_condition`), `JudgmentProblemSnapshot` bundles,
11
+ * and active `ImpactReviewPlan` entries to enumerate models, objectives,
12
+ * snapshots, and plans that need review when a variable, model, objective,
13
+ * constraint, or method changes or is refuted.
14
+ *
15
+ * World models are allowed to contain feedback cycles; traversal tracks active
16
+ * path ancestry and visited nodes so cyclic graphs always terminate cleanly
17
+ * with deterministic shortest dependency paths.
18
+ */
19
+ export declare const WORLD_MODEL_IMPACT_INDEX_VERSION: "world-model-impact-index.v1";
20
+ export declare const REDACTED_WORLD_MODEL_REF_LABEL: "<redacted>";
21
+ export declare const REDACTED_WORLD_MODEL_RELATION: "redacted";
22
+ export type WorldModelImpactNodeKind = FoundationRelationEndpoint | 'method' | 'dag' | 'plan' | 'redacted';
23
+ export interface WorldModelImpactRef {
24
+ readonly kind: WorldModelImpactNodeKind;
25
+ readonly id: string;
26
+ readonly revision?: string;
27
+ }
28
+ export type WorldModelDependencyRelation = FoundationRelationId | 'adopted' | 'selected_method' | 'snapshot_reference' | 'plan_reference' | typeof REDACTED_WORLD_MODEL_RELATION;
29
+ export interface WorldModelDependencyStep {
30
+ readonly from: WorldModelImpactRef;
31
+ readonly to: WorldModelImpactRef;
32
+ readonly relation: WorldModelDependencyRelation;
33
+ readonly domain: ImpactReviewRelationDomain;
34
+ }
35
+ export interface WorldModelAffectedItem {
36
+ readonly status: 'needs_review';
37
+ readonly affectedRef: WorldModelImpactRef;
38
+ readonly sourceRef: WorldModelImpactRef;
39
+ readonly dependencyPath: readonly WorldModelDependencyStep[];
40
+ readonly depth: number;
41
+ readonly reason: string;
42
+ }
43
+ export interface WorldModelImpactQueryInput {
44
+ readonly catalog?: FoundationCatalog;
45
+ readonly relations?: readonly FoundationRelationReference[];
46
+ readonly snapshots?: readonly JudgmentProblemSnapshot[];
47
+ readonly plans?: readonly ImpactReviewPlan[];
48
+ readonly changedRefs: readonly WorldModelImpactRef[];
49
+ readonly maxDepth?: number;
50
+ }
51
+ export interface WorldModelImpactAnalysis {
52
+ readonly version: typeof WORLD_MODEL_IMPACT_INDEX_VERSION;
53
+ readonly changedRefs: readonly WorldModelImpactRef[];
54
+ readonly affectedItems: readonly WorldModelAffectedItem[];
55
+ readonly affectedModels: readonly WorldModelAffectedItem[];
56
+ readonly affectedObjectives: readonly WorldModelAffectedItem[];
57
+ readonly affectedSnapshots: readonly WorldModelAffectedItem[];
58
+ readonly affectedPlans: readonly WorldModelAffectedItem[];
59
+ readonly cyclesDetected: number;
60
+ }
61
+ export interface WorldModelImpactIndexSource {
62
+ readonly catalog?: FoundationCatalog;
63
+ readonly relations?: readonly FoundationRelationReference[];
64
+ readonly snapshots?: readonly JudgmentProblemSnapshot[];
65
+ readonly plans: readonly ImpactReviewPlan[];
66
+ }
67
+ export interface WorldModelImpactIndexOptions {
68
+ /** Static dataset or dynamic loader evaluated on each lookup. */
69
+ readonly source: WorldModelImpactIndexSource | (() => WorldModelImpactIndexSource | Promise<WorldModelImpactIndexSource>);
70
+ /** Optional plan authorization predicate. Defaults to FoundationAcl read access. */
71
+ readonly canReadPlan?: (plan: ImpactReviewPlan, access: ImpactReviewAccessContext, snapshot?: JudgmentProblemSnapshot) => boolean;
72
+ readonly maxDepth?: number;
73
+ }
74
+ export interface FormatWorldModelDependencyPathOptions {
75
+ /**
76
+ * Optional node readability predicate. Unreadable nodes (and consecutive
77
+ * unreadable segments) are collapsed into `<redacted>` with redacted edge
78
+ * labels so private ids, kinds, revisions, and internal structure are never
79
+ * leaked.
80
+ */
81
+ readonly isReadable?: (ref: WorldModelImpactRef) => boolean;
82
+ }
83
+ /**
84
+ * Checks whether a principal can read a Foundation resource according to its ACL.
85
+ * Fails closed when `principal` is omitted for non-public resources.
86
+ */
87
+ export declare function canReadFoundationAcl(acl: FoundationAcl, principal: string | undefined): boolean;
88
+ /**
89
+ * Redacts unauthorized intermediate nodes and their incident relation labels
90
+ * from a dependency path, collapsing consecutive redacted nodes into a single
91
+ * `<redacted>` hop so neither private IDs/kinds/revisions nor hidden hop counts
92
+ * are exposed.
93
+ */
94
+ export declare function redactWorldModelDependencyPath(path: readonly WorldModelDependencyStep[], isReadable: (ref: WorldModelImpactRef) => boolean): readonly WorldModelDependencyStep[];
95
+ /**
96
+ * Formats a dependency path into a deterministic, human-readable trail suitable
97
+ * for review reasons and `ImpactReviewPlanMatch.evidence`.
98
+ */
99
+ export declare function formatWorldModelDependencyPath(path: readonly WorldModelDependencyStep[], options?: FormatWorldModelDependencyPathOptions): string;
100
+ /**
101
+ * Pure deterministic reverse-impact traversal over foundation definitions,
102
+ * explicit foundation relations, judgment problem snapshots, and plans.
103
+ */
104
+ export declare function analyzeWorldModelImpact(input: WorldModelImpactQueryInput): WorldModelImpactAnalysis;
105
+ /**
106
+ * Concrete OSS implementation of `ImpactReviewIndexPort` backed by the
107
+ * deterministic world-model reverse-dependency graph.
108
+ */
109
+ export declare class WorldModelImpactIndex implements ImpactReviewIndexPort {
110
+ private readonly loadSource;
111
+ private readonly canReadPlan;
112
+ private readonly maxDepth;
113
+ constructor(options: WorldModelImpactIndexOptions);
114
+ analyze(changedRefs: readonly WorldModelImpactRef[], access?: ImpactReviewAccessContext): Promise<WorldModelImpactAnalysis>;
115
+ findAffectedPlans(input: {
116
+ readonly changes: readonly ImpactReviewChange[];
117
+ readonly current_references: readonly ImpactReviewReference[];
118
+ readonly access: ImpactReviewAccessContext;
119
+ }): Promise<readonly ImpactReviewAffectedPlan[]>;
120
+ }
121
+ export declare function createWorldModelImpactIndex(options: WorldModelImpactIndexOptions): WorldModelImpactIndex;
122
+ /**
123
+ * Resolves the latest record for `(type, id)` from a `FoundationCatalog` using
124
+ * `catalog.latest` as the authoritative pointer and falling back to natural
125
+ * revision ordering only when no `latest` pointer exists.
126
+ */
127
+ export declare function resolveLatestCatalogRecord(catalog: FoundationCatalog, type: FoundationType, id: string): FoundationCatalogRecord | undefined;
128
+ /**
129
+ * Natural revision comparison so numeric revisions (`9` vs `10`) and prefixed
130
+ * revisions (`r9` vs `r10`, `v1.9` vs `v1.10`) sort in true numeric order.
131
+ */
132
+ export declare function compareRevisionStrings(left: string, right: string): number;