@unson/brainbase-mcp 0.6.0 → 0.7.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/dist/canonical-task-contract.d.ts +9 -0
- package/dist/canonical-task-contract.js +39 -0
- package/dist/canonical-task-principal.d.ts +16 -0
- package/dist/canonical-task-principal.js +36 -0
- package/dist/canonical-task-service.d.ts +251 -0
- package/dist/canonical-task-service.js +809 -0
- package/dist/company-os-evaluation.d.ts +193 -0
- package/dist/company-os-evaluation.js +1150 -0
- package/dist/company-os-impact-review.d.ts +248 -0
- package/dist/company-os-impact-review.js +663 -0
- package/dist/company-os-learning-adoption.d.ts +288 -0
- package/dist/company-os-learning-adoption.js +944 -0
- package/dist/company-os-objectives.d.ts +52 -0
- package/dist/company-os-objectives.js +197 -0
- package/dist/company-os-receipt-adapter.d.ts +109 -0
- package/dist/company-os-receipt-adapter.js +636 -0
- package/dist/constraint-exception-store.d.ts +23 -0
- package/dist/constraint-exception-store.js +108 -0
- package/dist/constraint-resolution.d.ts +175 -0
- package/dist/constraint-resolution.js +922 -0
- package/dist/decision-adapter.d.ts +145 -0
- package/dist/decision-adapter.js +586 -0
- package/dist/durable-wait-http.d.ts +51 -0
- package/dist/durable-wait-http.js +497 -0
- package/dist/durable-waits.d.ts +234 -0
- package/dist/durable-waits.js +944 -0
- package/dist/execution-authority-http.d.ts +28 -0
- package/dist/execution-authority-http.js +359 -0
- package/dist/execution-authority.d.ts +201 -0
- package/dist/execution-authority.js +634 -0
- package/dist/foundation-catalog.d.ts +26 -0
- package/dist/foundation-catalog.js +206 -0
- package/dist/foundation-constraint-store.d.ts +50 -0
- package/dist/foundation-constraint-store.js +215 -0
- package/dist/foundation-http.d.ts +90 -0
- package/dist/foundation-http.js +439 -0
- package/dist/foundation-store.d.ts +132 -0
- package/dist/foundation-store.js +654 -0
- package/dist/judgment-dag-composition.d.ts +224 -0
- package/dist/judgment-dag-composition.js +731 -0
- package/dist/judgment-dag.d.ts +2 -0
- package/dist/judgment-dag.js +1 -0
- package/dist/judgment-problem-snapshot.d.ts +185 -0
- package/dist/judgment-problem-snapshot.js +777 -0
- package/dist/judgment-view-http.d.ts +22 -0
- package/dist/judgment-view-http.js +128 -0
- package/dist/judgment-view.d.ts +222 -0
- package/dist/judgment-view.js +627 -0
- package/dist/knowledge-adapter.d.ts +112 -0
- package/dist/knowledge-adapter.js +691 -0
- package/dist/ontology-foundation.d.ts +209 -0
- package/dist/ontology-foundation.js +1000 -0
- package/dist/ontology.d.ts +13 -0
- package/dist/ontology.js +14 -0
- package/dist/organization-connection.d.ts +164 -0
- package/dist/organization-connection.js +428 -0
- package/dist/personal-knowledge.d.ts +120 -0
- package/dist/personal-knowledge.js +750 -0
- package/dist/problem-candidates.d.ts +149 -0
- package/dist/problem-candidates.js +898 -0
- package/dist/problem-selection.d.ts +238 -0
- package/dist/problem-selection.js +995 -0
- package/dist/resource-reservation-http.d.ts +31 -0
- package/dist/resource-reservation-http.js +371 -0
- package/dist/resource-reservations.d.ts +221 -0
- package/dist/resource-reservations.js +577 -0
- package/dist/server.d.ts +97 -0
- package/dist/server.js +180 -1
- package/dist/ssot.d.ts +6 -1
- package/dist/ssot.js +63 -5
- package/dist/streamable-http.d.ts +42 -0
- package/dist/streamable-http.js +288 -0
- package/dist/types.d.ts +20 -0
- package/dist/world-model.d.ts +181 -0
- package/dist/world-model.js +873 -0
- package/package.json +139 -3
- package/ui/judgment-view.css +238 -0
- package/ui/judgment-view.js +508 -0
- package/ui/objective-editor.css +180 -0
- package/ui/objective-editor.js +1139 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import type { CompanyOsEvaluationRecord, EvaluationAccessContext, CompanyOsEvaluationStore } from './company-os-evaluation.js';
|
|
2
|
+
import type { FoundationDefinition, FoundationScope, ModelDefinition, FoundationAcl } from './ontology-foundation.js';
|
|
3
|
+
import type { FoundationStoreContext } from './foundation-store.js';
|
|
4
|
+
import type { PersonalOs } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Learning adoption is an append-only ledger over the existing canonical
|
|
7
|
+
* aggregate. It does not promote a candidate to truth and it does not
|
|
8
|
+
* mutate a running judgment. Foundation target revisions are appended to
|
|
9
|
+
* Graph v2; the ledger stores only the references and decision evidence.
|
|
10
|
+
*/
|
|
11
|
+
export declare const COMPANY_OS_LEARNING_ADOPTION_CONTRACT_VERSION: "0.1.0";
|
|
12
|
+
export declare const COMPANY_OS_LEARNING_ADOPTION_RECORD_CATALOG_VERSION: 1;
|
|
13
|
+
/**
|
|
14
|
+
* Stable identity for a canonical adoption record when it crosses a
|
|
15
|
+
* knowledge boundary. This is deliberately separate from the catalog
|
|
16
|
+
* version and from the adopted foundation target revision.
|
|
17
|
+
*/
|
|
18
|
+
export declare const COMPANY_OS_LEARNING_ADOPTION_LOCATOR_SCHEMA: "company-os-learning-adoption-record.v1";
|
|
19
|
+
export declare const COMPANY_OS_LEARNING_ADOPTION_SIDECAR: "evidence/company-os-learning-adoption.json";
|
|
20
|
+
export type LearningTargetKind = 'world_model' | 'judgment_method' | 'execution_method' | 'objective';
|
|
21
|
+
export type LearningFindingKind = 'measurement_error' | 'execution_difference' | 'external_change' | 'other';
|
|
22
|
+
export type LearningValidationConclusion = 'supported' | 'partially_supported' | 'indeterminate' | 'rejected';
|
|
23
|
+
export type LearningModelDisposition = 'unchanged' | 'revise' | 'refuted' | 'indeterminate';
|
|
24
|
+
export interface LearningTargetReference {
|
|
25
|
+
readonly kind: LearningTargetKind;
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly revision: string;
|
|
28
|
+
readonly digest: string;
|
|
29
|
+
/** Foundation targets identify the canonical Graph type explicitly. */
|
|
30
|
+
readonly foundationType?: FoundationDefinition['type'];
|
|
31
|
+
}
|
|
32
|
+
export interface LearningTargetVersion {
|
|
33
|
+
readonly target: LearningTargetReference;
|
|
34
|
+
readonly reference: LearningTargetReference;
|
|
35
|
+
readonly definition: unknown;
|
|
36
|
+
readonly acl: FoundationAcl;
|
|
37
|
+
readonly scope: FoundationScope;
|
|
38
|
+
}
|
|
39
|
+
export interface LearningCandidateReference {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly digest: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Stable locator for a canonical adoption record. `contentDigest` is the
|
|
45
|
+
* digest of the complete adoption record; it is not a catalog version and it
|
|
46
|
+
* is not the revision of the target adopted by that record.
|
|
47
|
+
*/
|
|
48
|
+
export interface LearningAdoptionLocator {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly schema: typeof COMPANY_OS_LEARNING_ADOPTION_LOCATOR_SCHEMA;
|
|
51
|
+
readonly contentDigest: string;
|
|
52
|
+
}
|
|
53
|
+
export interface LearningEvaluationReference {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly digest: string;
|
|
56
|
+
}
|
|
57
|
+
export interface LearningCandidateInput {
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly sourceEvaluationRef: LearningEvaluationReference;
|
|
60
|
+
readonly target: LearningTargetReference;
|
|
61
|
+
/** Opaque proposed change. Target providers validate and materialize it. */
|
|
62
|
+
readonly proposedChange: unknown;
|
|
63
|
+
readonly grounds: readonly string[];
|
|
64
|
+
readonly counterexamples: readonly string[];
|
|
65
|
+
readonly uncertainty: readonly string[];
|
|
66
|
+
readonly applicability: FoundationScope;
|
|
67
|
+
readonly createdAt: string;
|
|
68
|
+
}
|
|
69
|
+
export interface LearningCandidate extends LearningCandidateInput {
|
|
70
|
+
readonly version: typeof COMPANY_OS_LEARNING_ADOPTION_RECORD_CATALOG_VERSION;
|
|
71
|
+
readonly digest: string;
|
|
72
|
+
}
|
|
73
|
+
export interface LearningFinding {
|
|
74
|
+
readonly kind: LearningFindingKind;
|
|
75
|
+
readonly description: string;
|
|
76
|
+
readonly evidenceRefs: readonly string[];
|
|
77
|
+
}
|
|
78
|
+
export interface LearningValidationInput {
|
|
79
|
+
readonly id: string;
|
|
80
|
+
readonly candidateRef: LearningCandidateReference;
|
|
81
|
+
readonly findings: readonly LearningFinding[];
|
|
82
|
+
readonly conclusion: LearningValidationConclusion;
|
|
83
|
+
readonly modelDisposition: LearningModelDisposition;
|
|
84
|
+
readonly basis: string;
|
|
85
|
+
readonly validatedAt: string;
|
|
86
|
+
}
|
|
87
|
+
export interface LearningValidation extends LearningValidationInput {
|
|
88
|
+
readonly version: typeof COMPANY_OS_LEARNING_ADOPTION_RECORD_CATALOG_VERSION;
|
|
89
|
+
readonly sourceEvaluationRef: LearningEvaluationReference;
|
|
90
|
+
readonly digest: string;
|
|
91
|
+
}
|
|
92
|
+
export interface LearningAuthorizationRequest {
|
|
93
|
+
readonly candidate: LearningCandidate;
|
|
94
|
+
readonly validation: LearningValidation;
|
|
95
|
+
readonly target: LearningTargetVersion;
|
|
96
|
+
readonly access: LearningAccessContext;
|
|
97
|
+
}
|
|
98
|
+
export interface LearningAuthorizationDecision {
|
|
99
|
+
readonly status: 'authorized' | 'denied';
|
|
100
|
+
readonly authorizationId: string;
|
|
101
|
+
readonly authorizedBy: string;
|
|
102
|
+
readonly reason?: string;
|
|
103
|
+
readonly decidedAt: string;
|
|
104
|
+
}
|
|
105
|
+
export interface LearningAdoptionAuthorizationPort {
|
|
106
|
+
authorize(request: LearningAuthorizationRequest): Promise<LearningAuthorizationDecision> | LearningAuthorizationDecision;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A host adapter can expose this port to a knowledge reader. Implementations
|
|
110
|
+
* must re-read the canonical adoption record before returning its locator.
|
|
111
|
+
*/
|
|
112
|
+
export interface LearningAdoptionLocatorReadPort {
|
|
113
|
+
read(input: {
|
|
114
|
+
readonly locator: LearningAdoptionLocator;
|
|
115
|
+
readonly access: LearningAccessContext;
|
|
116
|
+
}): Promise<LearningAdoptionLocator | null>;
|
|
117
|
+
}
|
|
118
|
+
export interface LearningTargetRevisionPreparationInput {
|
|
119
|
+
readonly candidate: LearningCandidate;
|
|
120
|
+
readonly validation: LearningValidation;
|
|
121
|
+
readonly current: LearningTargetVersion;
|
|
122
|
+
}
|
|
123
|
+
export interface LearningTargetRevisionPreparation {
|
|
124
|
+
readonly target: LearningTargetReference;
|
|
125
|
+
readonly reference: LearningTargetReference;
|
|
126
|
+
readonly definition: unknown;
|
|
127
|
+
readonly acl: FoundationAcl;
|
|
128
|
+
readonly scope: FoundationScope;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Target providers perform external reads and authorization before the SSOT
|
|
132
|
+
* lock. `commitRevision` is deliberately synchronous and pure: it receives
|
|
133
|
+
* the aggregate held by the lock and must fail closed when the expected
|
|
134
|
+
* revision no longer matches. It must not call a network or re-enter SSOT.
|
|
135
|
+
*/
|
|
136
|
+
export interface LearningTargetPort {
|
|
137
|
+
readCurrent(reference: LearningTargetReference, access: LearningAccessContext): Promise<LearningTargetVersion | null>;
|
|
138
|
+
read(reference: LearningTargetReference, access: LearningAccessContext): Promise<LearningTargetVersion | null>;
|
|
139
|
+
prepareRevision(input: LearningTargetRevisionPreparationInput): Promise<LearningTargetRevisionPreparation> | LearningTargetRevisionPreparation;
|
|
140
|
+
commitRevision(input: {
|
|
141
|
+
readonly currentAggregate: PersonalOs;
|
|
142
|
+
readonly expectedCurrent: LearningTargetVersion;
|
|
143
|
+
readonly prepared: LearningTargetRevisionPreparation;
|
|
144
|
+
}): {
|
|
145
|
+
readonly nextAggregate: PersonalOs;
|
|
146
|
+
readonly adopted: LearningTargetVersion;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export interface LearningAccessContext extends FoundationStoreContext {
|
|
150
|
+
readonly principal: string;
|
|
151
|
+
}
|
|
152
|
+
export interface LearningEvaluationPort {
|
|
153
|
+
read(id: string, access: EvaluationAccessContext): Promise<CompanyOsEvaluationRecord | null>;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The execution host owns run receipts. The adoption ledger stores only the
|
|
157
|
+
* exact receipt reference; it never accepts a caller-supplied receipt body.
|
|
158
|
+
* A host must re-read the receipt with its current authorization boundary and
|
|
159
|
+
* return the exact target version that the run actually used.
|
|
160
|
+
*/
|
|
161
|
+
export interface LearningRunReceiptReference {
|
|
162
|
+
readonly id: string;
|
|
163
|
+
readonly digest: string;
|
|
164
|
+
}
|
|
165
|
+
export interface LearningRunReceipt {
|
|
166
|
+
readonly id: string;
|
|
167
|
+
readonly runId: string;
|
|
168
|
+
readonly runPhase: 'actual';
|
|
169
|
+
readonly adoptedTarget: LearningTargetReference;
|
|
170
|
+
readonly digest: string;
|
|
171
|
+
}
|
|
172
|
+
export interface LearningRunReceiptPort {
|
|
173
|
+
read(reference: LearningRunReceiptReference, access: LearningAccessContext): Promise<LearningRunReceipt | null>;
|
|
174
|
+
}
|
|
175
|
+
export interface LearningAdoptionStoreOptions {
|
|
176
|
+
readonly dataDir: string;
|
|
177
|
+
readonly evaluation: LearningEvaluationPort;
|
|
178
|
+
readonly target: LearningTargetPort;
|
|
179
|
+
/** Optional for planned-only consumers; required to record/read actual use. */
|
|
180
|
+
readonly runReceipt?: LearningRunReceiptPort;
|
|
181
|
+
readonly authorization?: LearningAdoptionAuthorizationPort;
|
|
182
|
+
readonly now?: () => string;
|
|
183
|
+
}
|
|
184
|
+
export interface CreateLearningCandidateRequest extends LearningCandidateInput {
|
|
185
|
+
readonly access: LearningAccessContext;
|
|
186
|
+
}
|
|
187
|
+
export interface CreateLearningValidationRequest extends LearningValidationInput {
|
|
188
|
+
readonly access: LearningAccessContext;
|
|
189
|
+
}
|
|
190
|
+
export interface AdoptLearningCandidateRequest {
|
|
191
|
+
readonly id: string;
|
|
192
|
+
readonly idempotencyKey: string;
|
|
193
|
+
readonly candidateRef: LearningCandidateReference;
|
|
194
|
+
readonly validationRef: LearningCandidateReference;
|
|
195
|
+
readonly access: LearningAccessContext;
|
|
196
|
+
}
|
|
197
|
+
export interface LearningAdoptionRecord {
|
|
198
|
+
readonly version: typeof COMPANY_OS_LEARNING_ADOPTION_RECORD_CATALOG_VERSION;
|
|
199
|
+
readonly id: string;
|
|
200
|
+
readonly idempotencyKey: string;
|
|
201
|
+
readonly requestDigest: string;
|
|
202
|
+
readonly candidateRef: LearningCandidateReference;
|
|
203
|
+
readonly validationRef: LearningCandidateReference;
|
|
204
|
+
readonly previousTarget: LearningTargetReference;
|
|
205
|
+
readonly adoptedTarget: LearningTargetReference;
|
|
206
|
+
readonly authorization: LearningAuthorizationDecision;
|
|
207
|
+
/** Adoption does not change the epistemic state of the target. */
|
|
208
|
+
readonly targetValidationState?: ModelDefinition['validationState'];
|
|
209
|
+
readonly adoptedAt: string;
|
|
210
|
+
readonly digest: string;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Project a canonical adoption record into the locator contract used by
|
|
214
|
+
* knowledge adapters. The full record digest is the content identity; the
|
|
215
|
+
* catalog version and adopted target revision have different meanings.
|
|
216
|
+
*/
|
|
217
|
+
export declare function createLearningAdoptionLocator(record: Pick<LearningAdoptionRecord, 'id' | 'digest'>): LearningAdoptionLocator;
|
|
218
|
+
export interface RecordLearningRunUseRequest {
|
|
219
|
+
readonly id: string;
|
|
220
|
+
readonly runId: string;
|
|
221
|
+
readonly adoptionId: string;
|
|
222
|
+
/** planned selects a version; actual proves the running host used it. */
|
|
223
|
+
readonly runPhase: 'planned' | 'actual';
|
|
224
|
+
/** Required for actual; it is read from the host-owned receipt port. */
|
|
225
|
+
readonly receiptRef?: LearningRunReceiptReference;
|
|
226
|
+
readonly access: LearningAccessContext;
|
|
227
|
+
}
|
|
228
|
+
export interface LearningRunUseRecord {
|
|
229
|
+
readonly version: typeof COMPANY_OS_LEARNING_ADOPTION_RECORD_CATALOG_VERSION;
|
|
230
|
+
readonly id: string;
|
|
231
|
+
readonly runId: string;
|
|
232
|
+
readonly adoptionId: string;
|
|
233
|
+
readonly requestDigest: string;
|
|
234
|
+
readonly adoptedTarget: LearningTargetReference;
|
|
235
|
+
readonly runPhase: 'planned' | 'actual';
|
|
236
|
+
readonly receiptRef?: LearningRunReceiptReference;
|
|
237
|
+
readonly usedAt: string;
|
|
238
|
+
readonly digest: string;
|
|
239
|
+
}
|
|
240
|
+
export interface CompanyOsLearningAdoptionStore {
|
|
241
|
+
createCandidate(request: CreateLearningCandidateRequest): Promise<LearningCandidate>;
|
|
242
|
+
readCandidate(id: string, access: LearningAccessContext): Promise<LearningCandidate | null>;
|
|
243
|
+
createValidation(request: CreateLearningValidationRequest): Promise<LearningValidation>;
|
|
244
|
+
readValidation(id: string, access: LearningAccessContext): Promise<LearningValidation | null>;
|
|
245
|
+
adopt(request: AdoptLearningCandidateRequest): Promise<LearningAdoptionRecord>;
|
|
246
|
+
readAdoption(id: string, access: LearningAccessContext): Promise<LearningAdoptionRecord | null>;
|
|
247
|
+
/** Read the stable locator after the canonical record and its target are revalidated. */
|
|
248
|
+
readAdoptionLocator(id: string, access: LearningAccessContext): Promise<LearningAdoptionLocator | null>;
|
|
249
|
+
/** Resolve an exact locator through the current canonical ACL/target read boundary. */
|
|
250
|
+
readAdoptionByLocator(locator: LearningAdoptionLocator, access: LearningAccessContext): Promise<LearningAdoptionRecord | null>;
|
|
251
|
+
recordRunUse(request: RecordLearningRunUseRequest): Promise<LearningRunUseRecord>;
|
|
252
|
+
readRunUse(id: string, access: LearningAccessContext): Promise<LearningRunUseRecord | null>;
|
|
253
|
+
}
|
|
254
|
+
export type CompanyOsLearningAdoptionErrorCode = 'invalid_input' | 'not_found' | 'authorization_denied' | 'scope_violation' | 'revision_conflict' | 'integrity_mismatch' | 'invalid_validation' | 'unsupported_target' | 'corrupt_record' | 'readback_mismatch';
|
|
255
|
+
export declare class CompanyOsLearningAdoptionError extends Error {
|
|
256
|
+
readonly code: CompanyOsLearningAdoptionErrorCode;
|
|
257
|
+
constructor(code: CompanyOsLearningAdoptionErrorCode, message: string);
|
|
258
|
+
}
|
|
259
|
+
export declare function createCompanyOsLearningEvaluationPort(store: Pick<CompanyOsEvaluationStore, 'read'>): LearningEvaluationPort;
|
|
260
|
+
export declare function createLocalLearningAdoptionAuthorizationPort(): LearningAdoptionAuthorizationPort;
|
|
261
|
+
export declare function createCompanyOsLearningAdoptionStore(options: LearningAdoptionStoreOptions): CompanyOsLearningAdoptionStore;
|
|
262
|
+
/**
|
|
263
|
+
* Expose only the exact adoption locator after the store has performed its
|
|
264
|
+
* current ACL, candidate, validation, and canonical target checks.
|
|
265
|
+
*/
|
|
266
|
+
export declare function createLearningAdoptionLocatorReadPort(store: Pick<CompanyOsLearningAdoptionStore, 'readAdoptionByLocator'>): LearningAdoptionLocatorReadPort;
|
|
267
|
+
/**
|
|
268
|
+
* Foundation-backed target provider. It is the concrete OSS path for
|
|
269
|
+
* Objective and world-model revisions. Judgment/execution method registries
|
|
270
|
+
* belong to a consuming provider and are intentionally unsupported here.
|
|
271
|
+
*/
|
|
272
|
+
export declare function createFoundationLearningTargetPort(options: {
|
|
273
|
+
readonly foundationStore: {
|
|
274
|
+
read(reference: {
|
|
275
|
+
id: string;
|
|
276
|
+
type: FoundationDefinition['type'];
|
|
277
|
+
revision: string;
|
|
278
|
+
}, context: FoundationStoreContext): Promise<{
|
|
279
|
+
definition: FoundationDefinition;
|
|
280
|
+
digest: string;
|
|
281
|
+
} | null>;
|
|
282
|
+
readLatest(type: FoundationDefinition['type'], id: string, context: FoundationStoreContext): Promise<{
|
|
283
|
+
definition: FoundationDefinition;
|
|
284
|
+
digest: string;
|
|
285
|
+
} | null>;
|
|
286
|
+
};
|
|
287
|
+
}): LearningTargetPort;
|
|
288
|
+
export declare function digestEvaluationRecord(record: CompanyOsEvaluationRecord): string;
|