@unson/brainbase-mcp 0.7.0 → 0.8.0
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/contracts/foundation/graph-history.sql +634 -0
- package/contracts/judgment-value-proof/schema.json +43 -1
- package/dist/canonical-task-service.js +16 -5
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +107 -0
- package/dist/company-os-objectives.d.ts +11 -0
- package/dist/company-os-objectives.js +84 -47
- package/dist/foundation-authenticated-tools.d.ts +56 -0
- package/dist/foundation-authenticated-tools.js +347 -0
- package/dist/foundation-graph-http.d.ts +43 -0
- package/dist/foundation-graph-http.js +243 -0
- package/dist/foundation-graph-write.d.ts +90 -0
- package/dist/foundation-graph-write.js +447 -0
- package/dist/foundation-public-provider.d.ts +140 -0
- package/dist/foundation-public-provider.js +192 -0
- package/dist/graph-corrections.d.ts +157 -0
- package/dist/graph-corrections.js +620 -0
- package/dist/graph-foundation-reader.d.ts +60 -0
- package/dist/graph-foundation-reader.js +494 -0
- package/dist/graph-retrieval.d.ts +6 -1
- package/dist/graph-revision-reader.d.ts +80 -0
- package/dist/graph-revision-reader.js +246 -0
- package/dist/graph-web-http.d.ts +26 -0
- package/dist/graph-web-http.js +215 -0
- package/dist/graph-web.d.ts +364 -0
- package/dist/graph-web.js +639 -0
- package/dist/judgment-problem-snapshot.d.ts +30 -2
- package/dist/judgment-problem-snapshot.js +302 -6
- package/dist/judgment-value-proof-review.d.ts +166 -0
- package/dist/judgment-value-proof-review.js +437 -0
- package/dist/judgment-value-proof.d.ts +28 -1
- package/dist/judgment-value-proof.js +53 -8
- package/dist/knowledge-continuation.d.ts +127 -0
- package/dist/knowledge-continuation.js +446 -0
- package/dist/knowledge-lookup.d.ts +178 -0
- package/dist/knowledge-lookup.js +758 -0
- package/dist/local-web-fetch-bridge.d.ts +5 -0
- package/dist/local-web-fetch-bridge.js +37 -0
- package/dist/local-web-host.d.ts +109 -0
- package/dist/local-web-host.js +688 -0
- package/dist/local-web-security.d.ts +25 -0
- package/dist/local-web-security.js +95 -0
- package/dist/organization-graph.d.ts +15 -0
- package/dist/organization-graph.js +24 -4
- package/dist/personal-knowledge.d.ts +12 -0
- package/dist/personal-knowledge.js +29 -0
- package/dist/personal-memory-handover.d.ts +108 -0
- package/dist/personal-memory-handover.js +369 -0
- package/dist/philosophy-revision-reader.d.ts +85 -0
- package/dist/philosophy-revision-reader.js +241 -0
- package/dist/portable-graph.d.ts +24 -0
- package/dist/portable-graph.js +77 -0
- package/dist/server.d.ts +7 -2
- package/dist/server.js +9 -6
- package/dist/value-proof-review-http.d.ts +25 -0
- package/dist/value-proof-review-http.js +185 -0
- package/dist/world-model.d.ts +21 -3
- package/dist/world-model.js +94 -12
- package/package.json +94 -3
- package/ui/brainbase-tokens.css +56 -0
- package/ui/graph-own-share.js +367 -0
- package/ui/graph-projects-view.css +23 -0
- package/ui/graph-projects-view.js +730 -0
- package/ui/graph-registry-view.css +101 -0
- package/ui/graph-registry-view.js +804 -0
- package/ui/graph-view-shared.css +522 -0
- package/ui/graph-view-shared.js +1227 -0
- package/ui/judgment-view.css +119 -45
- package/ui/local-web-shell.css +396 -0
- package/ui/local-web-shell.js +378 -0
- package/ui/objective-editor-http-port.js +154 -0
- package/ui/objective-editor.css +180 -74
- package/ui/objective-editor.js +490 -43
- package/ui/outcome-knowledge.css +50 -14
- package/ui/outcome-knowledge.js +15 -1
- package/ui/outcome-mana.css +91 -14
- package/ui/outcome-mana.js +958 -61
- package/ui/value-proof-review.css +504 -0
- package/ui/value-proof-review.js +1104 -0
- package/ui/workspace-kit.css +485 -0
- package/ui/workspace-kit.js +229 -0
- package/ui/world-model-view.css +188 -0
- package/ui/world-model-view.js +486 -0
package/dist/world-model.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface WorldModelObservation extends WorldModelObservationInput {
|
|
|
40
40
|
readonly sourceRef: FoundationProvenance;
|
|
41
41
|
readonly supersedes?: string;
|
|
42
42
|
}
|
|
43
|
-
export type WorldModelValidationIssueCode = 'MISSING_FIELD' | 'INVALID_FIELD' | 'INVALID_TIMESTAMP' | 'INVALID_PERIOD' | 'INVALID_VARIABLE_REFERENCE' | 'VARIABLE_VALUE_KIND_MISMATCH' | 'OBSERVATION_SCOPE_MISMATCH' | 'OBSERVATION_PERIOD_MISMATCH' | 'RECORDED_BEFORE_OCCURRED' | 'INVALID_CORRECTION_REFERENCE' | 'MISSING_SOURCE' | 'MODEL_CONTRACT_INVALID';
|
|
43
|
+
export type WorldModelValidationIssueCode = 'MISSING_FIELD' | 'INVALID_FIELD' | 'INVALID_TIMESTAMP' | 'INVALID_PERIOD' | 'INVALID_VARIABLE_REFERENCE' | 'VARIABLE_VALUE_KIND_MISMATCH' | 'OBSERVATION_SCOPE_MISMATCH' | 'OBSERVATION_PERIOD_MISMATCH' | 'RECORDED_BEFORE_OCCURRED' | 'INVALID_CORRECTION_REFERENCE' | 'MISSING_SOURCE' | 'MODEL_CONTRACT_INVALID' | 'MISSING_APPROVAL_REFERENCE' | 'INVALID_APPROVAL_REFERENCE' | 'MODEL_DIGEST_MISMATCH';
|
|
44
44
|
export interface WorldModelValidationIssue {
|
|
45
45
|
readonly code: WorldModelValidationIssueCode;
|
|
46
46
|
readonly path: string;
|
|
@@ -70,14 +70,17 @@ export interface ModelAdoptionInput {
|
|
|
70
70
|
readonly adoptionState: Extract<FoundationAdoptionState, 'proposed' | 'approved'>;
|
|
71
71
|
readonly authorizedUse: FoundationUse;
|
|
72
72
|
readonly adoptedAt: string;
|
|
73
|
+
/** Digest of the exact Model definition used for this adoption. */
|
|
74
|
+
readonly modelDigest?: string;
|
|
73
75
|
readonly approvalRef?: DecisionRevision;
|
|
74
76
|
}
|
|
75
|
-
export interface ModelAdoptionRecord extends ModelAdoptionInput {
|
|
77
|
+
export interface ModelAdoptionRecord extends Omit<ModelAdoptionInput, 'modelDigest'> {
|
|
76
78
|
readonly modelRef: FoundationRevision;
|
|
77
79
|
readonly candidate: CandidateModelSnapshot;
|
|
78
80
|
readonly adoptionState: Extract<FoundationAdoptionState, 'proposed' | 'approved'>;
|
|
79
81
|
readonly authorizedUse: FoundationUse;
|
|
80
82
|
readonly adoptedAt: string;
|
|
83
|
+
readonly modelDigest: string;
|
|
81
84
|
readonly approvalRef?: DecisionRevision;
|
|
82
85
|
}
|
|
83
86
|
/**
|
|
@@ -113,13 +116,27 @@ export interface WorldModelFoundationStore {
|
|
|
113
116
|
}>;
|
|
114
117
|
read(reference: FoundationRevision, context: WorldModelStoreContext): Promise<WorldModelFoundationRecord | null>;
|
|
115
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Approval resolution is the world-model adapter for the existing
|
|
121
|
+
* constraint-resolution DecisionRevisionReader contract. The adapter must
|
|
122
|
+
* resolve the exact decision revision, verify that it actually approves the
|
|
123
|
+
* exact Model revision, and enforce the current authorization boundary. A
|
|
124
|
+
* mere decision-existence check is not sufficient to return true here.
|
|
125
|
+
*/
|
|
126
|
+
export interface WorldModelApprovalReader {
|
|
127
|
+
isApproved(request: {
|
|
128
|
+
readonly approvalRef: DecisionRevision;
|
|
129
|
+
readonly modelRef: FoundationRevision;
|
|
130
|
+
readonly context: WorldModelStoreContext;
|
|
131
|
+
}): Promise<boolean>;
|
|
132
|
+
}
|
|
116
133
|
export interface WorldModelObservationQuery {
|
|
117
134
|
readonly variableRef?: FoundationRevision;
|
|
118
135
|
readonly subjectId?: string;
|
|
119
136
|
readonly supersedes?: string;
|
|
120
137
|
}
|
|
121
138
|
export type ModelAdoptionStoreInput = Omit<ModelAdoptionInput, 'candidate' | 'modelRef'>;
|
|
122
|
-
export type WorldModelStoreErrorCode = 'invalid_input' | 'not_found' | 'revision_conflict' | 'authorization_denied' | 'unsupported_graph' | 'corrupt_record' | 'readback_mismatch';
|
|
139
|
+
export type WorldModelStoreErrorCode = 'invalid_input' | 'not_found' | 'revision_conflict' | 'authorization_denied' | 'unsupported_graph' | 'corrupt_record' | 'readback_mismatch' | 'approval_reference_unresolved';
|
|
123
140
|
export declare class WorldModelStoreError extends Error {
|
|
124
141
|
readonly code: WorldModelStoreErrorCode;
|
|
125
142
|
constructor(code: WorldModelStoreErrorCode, message: string);
|
|
@@ -178,4 +195,5 @@ export declare function retainCandidateModel(candidate: CandidateModelSnapshot,
|
|
|
178
195
|
export declare function createWorldModelStore(options: {
|
|
179
196
|
dataDir: string;
|
|
180
197
|
foundationStore: WorldModelFoundationStore;
|
|
198
|
+
approvalReader?: WorldModelApprovalReader;
|
|
181
199
|
}): WorldModelRecordStore;
|
package/dist/world-model.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validateFoundationDefinition } from './ontology-foundation.js';
|
|
2
|
-
import { findFoundationRecord, findLatestFoundationRecord, foundationCatalogOrEmpty } from './foundation-catalog.js';
|
|
2
|
+
import { digestFoundationDefinition, findFoundationRecord, findLatestFoundationRecord, foundationCatalogOrEmpty } from './foundation-catalog.js';
|
|
3
3
|
import { loadPersonalOs, mutatePersonalOsWithSidecar, readPersonalOsSidecar } from './ssot.js';
|
|
4
4
|
/**
|
|
5
5
|
* The world-model helpers are deliberately independent of storage. Definitions
|
|
@@ -115,6 +115,16 @@ export function validateWorldModelModel(model, use = 'judgment') {
|
|
|
115
115
|
*/
|
|
116
116
|
export function retainCandidateModel(candidate, model, adoption) {
|
|
117
117
|
const issues = [];
|
|
118
|
+
if (!isNonEmptyString(adoption.adoptionId))
|
|
119
|
+
issues.push(missing('adoptionId'));
|
|
120
|
+
if (!['proposed', 'approved'].includes(String(adoption.adoptionState))) {
|
|
121
|
+
issues.push({ code: 'INVALID_FIELD', path: 'adoptionState', message: 'Adoption state must be proposed or approved.' });
|
|
122
|
+
}
|
|
123
|
+
if (!isFoundationUse(adoption.authorizedUse)) {
|
|
124
|
+
issues.push({ code: 'INVALID_FIELD', path: 'authorizedUse', message: 'Adoption authorizedUse must be a valid Foundation use.' });
|
|
125
|
+
}
|
|
126
|
+
if (!isIsoTimestamp(adoption.adoptedAt))
|
|
127
|
+
issues.push(invalidTimestamp('adoptedAt'));
|
|
118
128
|
if (!candidate.candidateId.trim())
|
|
119
129
|
issues.push(missing('candidate.candidateId'));
|
|
120
130
|
if (!candidate.hypothesis.trim())
|
|
@@ -159,6 +169,29 @@ export function retainCandidateModel(candidate, model, adoption) {
|
|
|
159
169
|
message: `Adoption modelRef must match ${model.id}@${model.revision}.`
|
|
160
170
|
});
|
|
161
171
|
}
|
|
172
|
+
if (adoption.approvalRef !== undefined && !isDecisionRevision(adoption.approvalRef)) {
|
|
173
|
+
issues.push({
|
|
174
|
+
code: 'INVALID_APPROVAL_REFERENCE',
|
|
175
|
+
path: 'approvalRef',
|
|
176
|
+
message: 'approvalRef must contain a decision id and positive revision.'
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (adoption.adoptionState === 'approved' && !isDecisionRevision(adoption.approvalRef)) {
|
|
180
|
+
issues.push({
|
|
181
|
+
code: adoption.approvalRef === undefined ? 'MISSING_APPROVAL_REFERENCE' : 'INVALID_APPROVAL_REFERENCE',
|
|
182
|
+
path: 'approvalRef',
|
|
183
|
+
message: 'Approved adoption requires a valid approvalRef decision revision.'
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
const canonicalModelDigest = digestFoundationDefinition(model);
|
|
187
|
+
if (adoption.modelDigest !== undefined
|
|
188
|
+
&& (!isDigest(adoption.modelDigest) || adoption.modelDigest !== canonicalModelDigest)) {
|
|
189
|
+
issues.push({
|
|
190
|
+
code: 'MODEL_DIGEST_MISMATCH',
|
|
191
|
+
path: 'modelDigest',
|
|
192
|
+
message: 'modelDigest must match the canonical digest of the adopted Model definition.'
|
|
193
|
+
});
|
|
194
|
+
}
|
|
162
195
|
if (issues.length > 0)
|
|
163
196
|
throw new WorldModelValidationError(issues);
|
|
164
197
|
const modelRef = freezeCloneRevision(adoption.modelRef ?? {
|
|
@@ -180,12 +213,9 @@ export function retainCandidateModel(candidate, model, adoption) {
|
|
|
180
213
|
adoptionState: adoption.adoptionState,
|
|
181
214
|
authorizedUse: adoption.authorizedUse,
|
|
182
215
|
adoptedAt: adoption.adoptedAt,
|
|
216
|
+
modelDigest: canonicalModelDigest,
|
|
183
217
|
...(adoption.approvalRef === undefined ? {} : { approvalRef: freezeCloneDecisionRevision(adoption.approvalRef) })
|
|
184
218
|
};
|
|
185
|
-
if (!record.adoptionId)
|
|
186
|
-
throw new WorldModelValidationError([missing('adoptionId')]);
|
|
187
|
-
if (!parseIsoTimestamp(record.adoptedAt))
|
|
188
|
-
throw new WorldModelValidationError([invalidTimestamp('adoptedAt')]);
|
|
189
219
|
return deepFreeze(record);
|
|
190
220
|
}
|
|
191
221
|
/**
|
|
@@ -202,14 +232,19 @@ export function createWorldModelStore(options) {
|
|
|
202
232
|
|| typeof options.foundationStore.create !== 'function') {
|
|
203
233
|
throw new WorldModelStoreError('invalid_input', 'foundationStore with create/read is required');
|
|
204
234
|
}
|
|
205
|
-
|
|
235
|
+
if (options.approvalReader !== undefined && typeof options.approvalReader.isApproved !== 'function') {
|
|
236
|
+
throw new WorldModelStoreError('invalid_input', 'approvalReader.isApproved is required when approvalReader is provided');
|
|
237
|
+
}
|
|
238
|
+
return new GraphWorldModelRecordStore(options.dataDir, options.foundationStore, options.approvalReader);
|
|
206
239
|
}
|
|
207
240
|
class GraphWorldModelRecordStore {
|
|
208
241
|
dataDir;
|
|
209
242
|
foundationStore;
|
|
210
|
-
|
|
243
|
+
approvalReader;
|
|
244
|
+
constructor(dataDir, foundationStore, approvalReader) {
|
|
211
245
|
this.dataDir = dataDir;
|
|
212
246
|
this.foundationStore = foundationStore;
|
|
247
|
+
this.approvalReader = approvalReader;
|
|
213
248
|
}
|
|
214
249
|
async createVariable(variable, context) {
|
|
215
250
|
assertStoreContext(context);
|
|
@@ -320,18 +355,22 @@ class GraphWorldModelRecordStore {
|
|
|
320
355
|
assertFoundationAclWrite(modelRecord.definition, context.principal);
|
|
321
356
|
assertCandidateAclWrite(candidate, context.principal);
|
|
322
357
|
let record;
|
|
323
|
-
await this.mutateCatalog((catalog, current) => {
|
|
358
|
+
await this.mutateCatalog(async (catalog, current) => {
|
|
324
359
|
const currentModel = resolveFoundationAtAggregate(current, modelRef, modelRecord, context.principal, 'write');
|
|
325
360
|
if (currentModel.definition.type !== 'model') {
|
|
326
361
|
throw new WorldModelStoreError('corrupt_record', `Model ${modelRef.id} changed type during commit`);
|
|
327
362
|
}
|
|
328
363
|
assertFoundationAclWrite(currentModel.definition, context.principal);
|
|
329
364
|
assertCandidateAclWrite(candidate, context.principal);
|
|
365
|
+
if (catalog.adoptions.some((existing) => existing.adoptionId === adoption.adoptionId)) {
|
|
366
|
+
throw new WorldModelStoreError('revision_conflict', `Model adoption ${adoption.adoptionId} already exists`);
|
|
367
|
+
}
|
|
368
|
+
// Resolve approval while the SSOT mutation lock is held and before the
|
|
369
|
+
// sidecar is returned for commit. A post-commit approval read could
|
|
370
|
+
// fail after the approved record was already persisted.
|
|
371
|
+
await this.assertApprovalReference(modelRef, adoption, context);
|
|
330
372
|
const retained = retainCandidateModel(candidate, currentModel.definition, { ...adoption, modelRef });
|
|
331
373
|
record = retained;
|
|
332
|
-
if (catalog.adoptions.some((existing) => existing.adoptionId === retained.adoptionId)) {
|
|
333
|
-
throw new WorldModelStoreError('revision_conflict', `Model adoption ${retained.adoptionId} already exists`);
|
|
334
|
-
}
|
|
335
374
|
return {
|
|
336
375
|
...catalog,
|
|
337
376
|
adoptions: [...catalog.adoptions, retained]
|
|
@@ -339,12 +378,18 @@ class GraphWorldModelRecordStore {
|
|
|
339
378
|
});
|
|
340
379
|
if (!record)
|
|
341
380
|
throw new WorldModelStoreError('readback_mismatch', 'Model adoption commit did not produce a record');
|
|
342
|
-
|
|
381
|
+
// Approval was checked before the atomic append. This structural readback
|
|
382
|
+
// deliberately avoids a second provider call that could report failure
|
|
383
|
+
// while leaving the successful commit in place.
|
|
384
|
+
const readback = await this.readModelAdoptionRecord(record.adoptionId, context, { verifyApproval: false });
|
|
343
385
|
if (!readback)
|
|
344
386
|
throw new WorldModelStoreError('readback_mismatch', `Model adoption ${record.adoptionId} was not readable after commit`);
|
|
345
387
|
return readback;
|
|
346
388
|
}
|
|
347
389
|
async readModelAdoption(adoptionId, context) {
|
|
390
|
+
return this.readModelAdoptionRecord(adoptionId, context, { verifyApproval: true });
|
|
391
|
+
}
|
|
392
|
+
async readModelAdoptionRecord(adoptionId, context, options) {
|
|
348
393
|
assertStoreContext(context);
|
|
349
394
|
if (!isNonEmptyString(adoptionId))
|
|
350
395
|
throw new WorldModelStoreError('invalid_input', 'adoptionId is required');
|
|
@@ -358,12 +403,18 @@ class GraphWorldModelRecordStore {
|
|
|
358
403
|
throw new WorldModelStoreError('corrupt_record', `Model for adoption ${adoptionId} is missing`);
|
|
359
404
|
}
|
|
360
405
|
assertFoundationAclRead(modelRecord.definition, context.principal);
|
|
406
|
+
if (options.verifyApproval)
|
|
407
|
+
await this.assertApprovalReference(record.modelRef, record, context);
|
|
408
|
+
if (record.modelDigest !== modelRecord.digest) {
|
|
409
|
+
throw new WorldModelStoreError('readback_mismatch', `Model adoption ${adoptionId} digest does not match ${record.modelRef.id}@${record.modelRef.revision}`);
|
|
410
|
+
}
|
|
361
411
|
const verified = retainCandidateModel(record.candidate, modelRecord.definition, {
|
|
362
412
|
adoptionId: record.adoptionId,
|
|
363
413
|
adoptionState: record.adoptionState,
|
|
364
414
|
authorizedUse: record.authorizedUse,
|
|
365
415
|
adoptedAt: record.adoptedAt,
|
|
366
416
|
modelRef: record.modelRef,
|
|
417
|
+
modelDigest: record.modelDigest,
|
|
367
418
|
...(record.approvalRef === undefined ? {} : { approvalRef: record.approvalRef })
|
|
368
419
|
});
|
|
369
420
|
return verified;
|
|
@@ -396,6 +447,30 @@ class GraphWorldModelRecordStore {
|
|
|
396
447
|
throw new WorldModelStoreError('corrupt_record', formatError(error));
|
|
397
448
|
}
|
|
398
449
|
}
|
|
450
|
+
async assertApprovalReference(modelRef, adoption, context) {
|
|
451
|
+
if (adoption.adoptionState !== 'approved')
|
|
452
|
+
return;
|
|
453
|
+
if (!isDecisionRevision(adoption.approvalRef)) {
|
|
454
|
+
throw new WorldModelStoreError('approval_reference_unresolved', 'Approved model adoption requires a valid approvalRef decision revision');
|
|
455
|
+
}
|
|
456
|
+
if (!this.approvalReader) {
|
|
457
|
+
throw new WorldModelStoreError('approval_reference_unresolved', 'Approved model adoption requires an approval reader that verifies the decision binding');
|
|
458
|
+
}
|
|
459
|
+
let approved = false;
|
|
460
|
+
try {
|
|
461
|
+
approved = await this.approvalReader.isApproved({
|
|
462
|
+
approvalRef: adoption.approvalRef,
|
|
463
|
+
modelRef,
|
|
464
|
+
context
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
catch {
|
|
468
|
+
approved = false;
|
|
469
|
+
}
|
|
470
|
+
if (!approved) {
|
|
471
|
+
throw new WorldModelStoreError('approval_reference_unresolved', `Approval ${adoption.approvalRef.id}@${adoption.approvalRef.revision} does not approve Model ${modelRef.id}@${modelRef.revision}`);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
399
474
|
async mutateCatalog(mutator) {
|
|
400
475
|
await mutatePersonalOsWithSidecar(this.dataDir, WORLD_MODEL_EVIDENCE_SIDECAR, async (current, existingContent) => {
|
|
401
476
|
if (current.graph.version !== 2) {
|
|
@@ -591,6 +666,7 @@ function normalizeStoredAdoption(value) {
|
|
|
591
666
|
if (!isRecord(value)
|
|
592
667
|
|| !isNonEmptyString(value.adoptionId)
|
|
593
668
|
|| !isVariableOrModelRevision(value.modelRef, 'model')
|
|
669
|
+
|| !isDigest(value.modelDigest)
|
|
594
670
|
|| !isRecord(value.candidate)
|
|
595
671
|
|| !isNonEmptyString(value.candidate.candidateId)
|
|
596
672
|
|| !isNonEmptyString(value.candidate.hypothesis)
|
|
@@ -602,6 +678,7 @@ function normalizeStoredAdoption(value) {
|
|
|
602
678
|
|| !['proposed', 'approved'].includes(String(value.adoptionState))
|
|
603
679
|
|| !isFoundationUse(String(value.authorizedUse))
|
|
604
680
|
|| !isIsoTimestamp(value.adoptedAt)
|
|
681
|
+
|| (value.adoptionState === 'approved' && !isDecisionRevision(value.approvalRef))
|
|
605
682
|
|| (value.approvalRef !== undefined && !isDecisionRevision(value.approvalRef))) {
|
|
606
683
|
throw new WorldModelStoreError('corrupt_record', 'world-model adoption record is malformed');
|
|
607
684
|
}
|
|
@@ -619,6 +696,7 @@ function normalizeStoredAdoption(value) {
|
|
|
619
696
|
adoptionState: value.adoptionState,
|
|
620
697
|
authorizedUse: value.authorizedUse,
|
|
621
698
|
adoptedAt: String(value.adoptedAt),
|
|
699
|
+
modelDigest: String(value.modelDigest),
|
|
622
700
|
...(value.approvalRef === undefined ? {} : { approvalRef: freezeCloneDecisionRevision(value.approvalRef) })
|
|
623
701
|
});
|
|
624
702
|
}
|
|
@@ -631,6 +709,9 @@ function isDecisionRevision(value) {
|
|
|
631
709
|
&& isNonEmptyString(value.id)
|
|
632
710
|
&& /^[1-9]\d*$/.test(String(value.revision));
|
|
633
711
|
}
|
|
712
|
+
function isDigest(value) {
|
|
713
|
+
return typeof value === 'string' && /^sha256:[0-9a-f]{64}$/.test(value);
|
|
714
|
+
}
|
|
634
715
|
function isCandidateAcl(value) {
|
|
635
716
|
return isRecord(value)
|
|
636
717
|
&& isNonEmptyString(value.ownerId)
|
|
@@ -667,6 +748,7 @@ function freezeAdoption(adoption) {
|
|
|
667
748
|
adoptionState: adoption.adoptionState,
|
|
668
749
|
authorizedUse: adoption.authorizedUse,
|
|
669
750
|
adoptedAt: adoption.adoptedAt,
|
|
751
|
+
modelDigest: adoption.modelDigest,
|
|
670
752
|
...(adoption.approvalRef === undefined ? {} : { approvalRef: freezeCloneDecisionRevision(adoption.approvalRef) })
|
|
671
753
|
});
|
|
672
754
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unson/brainbase-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
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",
|
|
@@ -31,10 +31,46 @@
|
|
|
31
31
|
"types": "./dist/judgment-value-proof.d.ts",
|
|
32
32
|
"import": "./dist/judgment-value-proof.js"
|
|
33
33
|
},
|
|
34
|
+
"./judgment-value-proof-review": {
|
|
35
|
+
"types": "./dist/judgment-value-proof-review.d.ts",
|
|
36
|
+
"import": "./dist/judgment-value-proof-review.js"
|
|
37
|
+
},
|
|
38
|
+
"./value-proof-review-http": {
|
|
39
|
+
"types": "./dist/value-proof-review-http.d.ts",
|
|
40
|
+
"import": "./dist/value-proof-review-http.js"
|
|
41
|
+
},
|
|
42
|
+
"./local-web-host": {
|
|
43
|
+
"types": "./dist/local-web-host.d.ts",
|
|
44
|
+
"import": "./dist/local-web-host.js"
|
|
45
|
+
},
|
|
46
|
+
"./graph-corrections": {
|
|
47
|
+
"types": "./dist/graph-corrections.d.ts",
|
|
48
|
+
"import": "./dist/graph-corrections.js"
|
|
49
|
+
},
|
|
50
|
+
"./graph-web": {
|
|
51
|
+
"types": "./dist/graph-web.d.ts",
|
|
52
|
+
"import": "./dist/graph-web.js"
|
|
53
|
+
},
|
|
54
|
+
"./graph-web-http": {
|
|
55
|
+
"types": "./dist/graph-web-http.d.ts",
|
|
56
|
+
"import": "./dist/graph-web-http.js"
|
|
57
|
+
},
|
|
34
58
|
"./portable-graph": {
|
|
35
59
|
"types": "./dist/portable-graph.d.ts",
|
|
36
60
|
"import": "./dist/portable-graph.js"
|
|
37
61
|
},
|
|
62
|
+
"./canonical-graph": {
|
|
63
|
+
"types": "./dist/canonical-graph.d.ts",
|
|
64
|
+
"import": "./dist/canonical-graph.js"
|
|
65
|
+
},
|
|
66
|
+
"./embedding-provider": {
|
|
67
|
+
"types": "./dist/embedding-provider.d.ts",
|
|
68
|
+
"import": "./dist/embedding-provider.js"
|
|
69
|
+
},
|
|
70
|
+
"./graph-revision-reader": {
|
|
71
|
+
"types": "./dist/graph-revision-reader.d.ts",
|
|
72
|
+
"import": "./dist/graph-revision-reader.js"
|
|
73
|
+
},
|
|
38
74
|
"./canonical-task-principal": {
|
|
39
75
|
"types": "./dist/canonical-task-principal.d.ts",
|
|
40
76
|
"import": "./dist/canonical-task-principal.js"
|
|
@@ -55,6 +91,10 @@
|
|
|
55
91
|
"types": "./dist/foundation-store.d.ts",
|
|
56
92
|
"import": "./dist/foundation-store.js"
|
|
57
93
|
},
|
|
94
|
+
"./foundation-graph-write": {
|
|
95
|
+
"types": "./dist/foundation-graph-write.d.ts",
|
|
96
|
+
"import": "./dist/foundation-graph-write.js"
|
|
97
|
+
},
|
|
58
98
|
"./company-os-objectives": {
|
|
59
99
|
"types": "./dist/company-os-objectives.d.ts",
|
|
60
100
|
"import": "./dist/company-os-objectives.js"
|
|
@@ -83,6 +123,10 @@
|
|
|
83
123
|
"types": "./dist/foundation-http.d.ts",
|
|
84
124
|
"import": "./dist/foundation-http.js"
|
|
85
125
|
},
|
|
126
|
+
"./foundation-graph-http": {
|
|
127
|
+
"types": "./dist/foundation-graph-http.d.ts",
|
|
128
|
+
"import": "./dist/foundation-graph-http.js"
|
|
129
|
+
},
|
|
86
130
|
"./constraint-exception-store": {
|
|
87
131
|
"types": "./dist/constraint-exception-store.d.ts",
|
|
88
132
|
"import": "./dist/constraint-exception-store.js"
|
|
@@ -155,6 +199,23 @@
|
|
|
155
199
|
"./ui/judgment-view.css": "./ui/judgment-view.css",
|
|
156
200
|
"./ui/objective-editor": "./ui/objective-editor.js",
|
|
157
201
|
"./ui/objective-editor.css": "./ui/objective-editor.css",
|
|
202
|
+
"./ui/value-proof-review": "./ui/value-proof-review.js",
|
|
203
|
+
"./ui/value-proof-review.css": "./ui/value-proof-review.css",
|
|
204
|
+
"./ui/objective-editor-http-port": "./ui/objective-editor-http-port.js",
|
|
205
|
+
"./ui/world-model-view": "./ui/world-model-view.js",
|
|
206
|
+
"./ui/world-model-view.css": "./ui/world-model-view.css",
|
|
207
|
+
"./ui/local-web-shell": "./ui/local-web-shell.js",
|
|
208
|
+
"./ui/local-web-shell.css": "./ui/local-web-shell.css",
|
|
209
|
+
"./ui/workspace-kit": "./ui/workspace-kit.js",
|
|
210
|
+
"./ui/workspace-kit.css": "./ui/workspace-kit.css",
|
|
211
|
+
"./ui/graph-view-shared": "./ui/graph-view-shared.js",
|
|
212
|
+
"./ui/graph-view-shared.css": "./ui/graph-view-shared.css",
|
|
213
|
+
"./ui/graph-own-share": "./ui/graph-own-share.js",
|
|
214
|
+
"./ui/graph-projects-view": "./ui/graph-projects-view.js",
|
|
215
|
+
"./ui/graph-projects-view.css": "./ui/graph-projects-view.css",
|
|
216
|
+
"./ui/graph-registry-view": "./ui/graph-registry-view.js",
|
|
217
|
+
"./ui/graph-registry-view.css": "./ui/graph-registry-view.css",
|
|
218
|
+
"./ui/brainbase-tokens.css": "./ui/brainbase-tokens.css",
|
|
158
219
|
"./ui/icons/*": "./ui/icons/*",
|
|
159
220
|
"./dist/*": "./dist/*",
|
|
160
221
|
"./contracts/judgment-dag/schema.json": "./contracts/judgment-dag/schema.json",
|
|
@@ -175,7 +236,36 @@
|
|
|
175
236
|
"./execution-authority": {
|
|
176
237
|
"types": "./dist/execution-authority.d.ts",
|
|
177
238
|
"import": "./dist/execution-authority.js"
|
|
178
|
-
}
|
|
239
|
+
},
|
|
240
|
+
"./knowledge-continuation": {
|
|
241
|
+
"types": "./dist/knowledge-continuation.d.ts",
|
|
242
|
+
"import": "./dist/knowledge-continuation.js"
|
|
243
|
+
},
|
|
244
|
+
"./knowledge-lookup": {
|
|
245
|
+
"types": "./dist/knowledge-lookup.d.ts",
|
|
246
|
+
"import": "./dist/knowledge-lookup.js"
|
|
247
|
+
},
|
|
248
|
+
"./foundation-public-provider": {
|
|
249
|
+
"types": "./dist/foundation-public-provider.d.ts",
|
|
250
|
+
"import": "./dist/foundation-public-provider.js"
|
|
251
|
+
},
|
|
252
|
+
"./foundation-authenticated-tools": {
|
|
253
|
+
"types": "./dist/foundation-authenticated-tools.d.ts",
|
|
254
|
+
"import": "./dist/foundation-authenticated-tools.js"
|
|
255
|
+
},
|
|
256
|
+
"./philosophy-revision-reader": {
|
|
257
|
+
"types": "./dist/philosophy-revision-reader.d.ts",
|
|
258
|
+
"import": "./dist/philosophy-revision-reader.js"
|
|
259
|
+
},
|
|
260
|
+
"./server": {
|
|
261
|
+
"types": "./dist/server.d.ts",
|
|
262
|
+
"import": "./dist/server.js"
|
|
263
|
+
},
|
|
264
|
+
"./graph-foundation-reader": {
|
|
265
|
+
"types": "./dist/graph-foundation-reader.d.ts",
|
|
266
|
+
"import": "./dist/graph-foundation-reader.js"
|
|
267
|
+
},
|
|
268
|
+
"./contracts/foundation/graph-history.sql": "./contracts/foundation/graph-history.sql"
|
|
179
269
|
},
|
|
180
270
|
"bin": {
|
|
181
271
|
"brainbase-mcp": "dist/index.js",
|
|
@@ -231,6 +321,7 @@
|
|
|
231
321
|
"ip-address": "^10.4.0"
|
|
232
322
|
},
|
|
233
323
|
"devDependencies": {
|
|
324
|
+
"@electric-sql/pglite": "^0.5.8",
|
|
234
325
|
"@types/node": "^22.15.29",
|
|
235
326
|
"tsx": "^4.19.4",
|
|
236
327
|
"typescript": "^5.8.3",
|
|
@@ -240,5 +331,5 @@
|
|
|
240
331
|
"engines": {
|
|
241
332
|
"node": ">=20"
|
|
242
333
|
},
|
|
243
|
-
"gitHead": "
|
|
334
|
+
"gitHead": "3313189aecafbc086d33dc1ef20a7fe9f70bb54e"
|
|
244
335
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Brainbase shared visual tokens (color, type, radius, spacing, rail).
|
|
3
|
+
* Common UI parts and hosts read only these names so that the personal and
|
|
4
|
+
* organization editions look the same. The values are the organization
|
|
5
|
+
* edition's design (brainbase-organization apps/web/public/styles.css, final
|
|
6
|
+
* :root layer and the outcome workspace rules), which is the visual source of
|
|
7
|
+
* truth for every Brainbase Web surface.
|
|
8
|
+
*/
|
|
9
|
+
:root {
|
|
10
|
+
--bb-color-ink: #1e2822;
|
|
11
|
+
--bb-color-muted: #69746d;
|
|
12
|
+
--bb-color-quiet: #929b95;
|
|
13
|
+
--bb-color-border: #dce3dd;
|
|
14
|
+
--bb-color-border-strong: #b7c3ba;
|
|
15
|
+
--bb-color-control-border: #cbd8d0;
|
|
16
|
+
--bb-color-paper: #fbfcfa;
|
|
17
|
+
--bb-color-canvas: #f1f3f0;
|
|
18
|
+
--bb-color-panel: #ffffff;
|
|
19
|
+
--bb-color-surface: #f5f8f5;
|
|
20
|
+
--bb-color-header-start: #f7faf8;
|
|
21
|
+
--bb-color-header-end: #eef5f0;
|
|
22
|
+
--bb-color-eyebrow: #47715a;
|
|
23
|
+
--bb-color-accent: #087d62;
|
|
24
|
+
--bb-color-accent-soft: #e6f2ec;
|
|
25
|
+
--bb-color-accent-strong: #176448;
|
|
26
|
+
--bb-color-action: #35684c;
|
|
27
|
+
--bb-color-action-hover: #2a5540;
|
|
28
|
+
--bb-color-action-text: #ffffff;
|
|
29
|
+
--bb-color-focus: #20a37e;
|
|
30
|
+
--bb-color-success: #087d62;
|
|
31
|
+
--bb-color-success-soft: #e6f2ec;
|
|
32
|
+
--bb-color-warning: #8a631d;
|
|
33
|
+
--bb-color-warning-soft: #fff0c7;
|
|
34
|
+
--bb-color-danger: #d92335;
|
|
35
|
+
--bb-color-danger-soft: #fde9eb;
|
|
36
|
+
--bb-color-rail: #171c19;
|
|
37
|
+
--bb-color-rail-border: #2c332e;
|
|
38
|
+
--bb-color-rail-text: #d5ded8;
|
|
39
|
+
--bb-color-rail-muted: #89938c;
|
|
40
|
+
--bb-color-rail-hover: #232c26;
|
|
41
|
+
--bb-color-rail-active: #203e33;
|
|
42
|
+
--bb-color-rail-strong: #ffffff;
|
|
43
|
+
--bb-color-overlay: rgb(8 15 11 / 40%);
|
|
44
|
+
--bb-shadow: 0 16px 42px rgb(13 24 17 / 12%);
|
|
45
|
+
--bb-font-sans: Geist, "Noto Sans JP", "Hiragino Sans", system-ui, sans-serif;
|
|
46
|
+
--bb-font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
47
|
+
--bb-radius-sm: 7px;
|
|
48
|
+
--bb-radius-md: 14px;
|
|
49
|
+
--bb-radius-lg: 16px;
|
|
50
|
+
--bb-space-1: 4px;
|
|
51
|
+
--bb-space-2: 8px;
|
|
52
|
+
--bb-space-3: 12px;
|
|
53
|
+
--bb-space-4: 16px;
|
|
54
|
+
--bb-space-5: 24px;
|
|
55
|
+
--bb-space-6: 32px;
|
|
56
|
+
}
|