@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,248 @@
|
|
|
1
|
+
import type { DurableWaitStore } from './durable-waits.js';
|
|
2
|
+
import type { FoundationAcl } from './ontology-foundation.js';
|
|
3
|
+
/**
|
|
4
|
+
* Story 15 keeps impact review at the port boundary. It reads adopted
|
|
5
|
+
* references and plans, records an idempotent notification, and asks a
|
|
6
|
+
* durable-wait/rejudgment adapter to continue. It never owns a canonical
|
|
7
|
+
* Objective, Model, Constraint, run, reservation, or external effect.
|
|
8
|
+
*/
|
|
9
|
+
export declare const COMPANY_OS_IMPACT_REVIEW_VERSION: "company-os-impact-review.v1";
|
|
10
|
+
export declare const COMPANY_OS_IMPACT_REVIEW_NOTIFICATION_SIDECAR: "impact-review/notifications.json";
|
|
11
|
+
export type ImpactReviewReferenceKind = 'objective' | 'model' | 'constraint' | 'method' | 'dag';
|
|
12
|
+
export type ImpactReviewChangeSource = 'world_model' | 'objective' | 'constraint' | 'judgment_method';
|
|
13
|
+
export type ImpactReviewChangeSignificance = 'minor' | 'material' | 'premise_refuted' | 'unknown';
|
|
14
|
+
export type ImpactReviewRelationDomain = 'world_model' | 'execution';
|
|
15
|
+
export type ImpactReviewRelationKind = 'uses_as_input' | 'predicts' | 'adopted' | 'applies_to' | 'execution_depends_on' | 'selected_method';
|
|
16
|
+
export interface ImpactReviewScope {
|
|
17
|
+
readonly type: 'personal' | 'project' | 'organization';
|
|
18
|
+
readonly id: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ImpactReviewAccessContext {
|
|
21
|
+
readonly principal: string;
|
|
22
|
+
readonly scope?: ImpactReviewScope;
|
|
23
|
+
}
|
|
24
|
+
export interface ImpactReviewReference {
|
|
25
|
+
readonly kind: ImpactReviewReferenceKind;
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly revision: string;
|
|
28
|
+
readonly digest: string;
|
|
29
|
+
readonly scope: ImpactReviewScope;
|
|
30
|
+
}
|
|
31
|
+
export interface ImpactReviewChange {
|
|
32
|
+
readonly change_id: string;
|
|
33
|
+
readonly source: ImpactReviewChangeSource;
|
|
34
|
+
readonly previous?: ImpactReviewReference;
|
|
35
|
+
readonly current: ImpactReviewReference;
|
|
36
|
+
readonly significance: ImpactReviewChangeSignificance;
|
|
37
|
+
readonly reason: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ImpactReviewProblemReference {
|
|
40
|
+
readonly snapshot_id: string;
|
|
41
|
+
readonly problem_id: string;
|
|
42
|
+
readonly revision: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ImpactReviewResponsible {
|
|
45
|
+
readonly principal: string;
|
|
46
|
+
readonly scope?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ImpactReviewPlan {
|
|
49
|
+
readonly plan_id: string;
|
|
50
|
+
readonly owner_scope: ImpactReviewScope;
|
|
51
|
+
readonly read_policy: FoundationAcl;
|
|
52
|
+
readonly problem_snapshot: ImpactReviewProblemReference;
|
|
53
|
+
readonly run_id: string;
|
|
54
|
+
readonly references?: readonly ImpactReviewReference[];
|
|
55
|
+
readonly execution_state: 'planned' | 'running' | 'completed' | 'effect_unknown';
|
|
56
|
+
readonly authority_state: 'valid' | 'expired' | 'revoked' | 'unknown';
|
|
57
|
+
readonly constraint_state: 'valid' | 'violated' | 'expired' | 'unknown';
|
|
58
|
+
readonly responsible: ImpactReviewResponsible;
|
|
59
|
+
readonly due_at?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface ImpactReviewPlanMatch {
|
|
62
|
+
readonly change_id: string;
|
|
63
|
+
readonly relation: ImpactReviewRelationKind;
|
|
64
|
+
readonly domain: ImpactReviewRelationDomain;
|
|
65
|
+
readonly evidence: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ImpactReviewAffectedPlan {
|
|
68
|
+
readonly plan: ImpactReviewPlan;
|
|
69
|
+
readonly matches: readonly ImpactReviewPlanMatch[];
|
|
70
|
+
}
|
|
71
|
+
/** Read-only current-reference lookup. A null result is unresolved, not no impact. */
|
|
72
|
+
export interface ImpactReviewCurrentReferencePort {
|
|
73
|
+
readCurrent(reference: ImpactReviewReference, access: ImpactReviewAccessContext): Promise<ImpactReviewReference | null>;
|
|
74
|
+
}
|
|
75
|
+
/** Read-only reverse lookup. It must not change a plan, run, reservation, or effect. */
|
|
76
|
+
export interface ImpactReviewIndexPort {
|
|
77
|
+
findAffectedPlans(input: {
|
|
78
|
+
readonly changes: readonly ImpactReviewChange[];
|
|
79
|
+
readonly current_references: readonly ImpactReviewReference[];
|
|
80
|
+
readonly access: ImpactReviewAccessContext;
|
|
81
|
+
}): Promise<readonly ImpactReviewAffectedPlan[]>;
|
|
82
|
+
}
|
|
83
|
+
export interface ImpactReviewDurableWaitCreateInput {
|
|
84
|
+
readonly wait_id: string;
|
|
85
|
+
readonly principal: string;
|
|
86
|
+
readonly owner_scope: ImpactReviewScope;
|
|
87
|
+
readonly read_policy: FoundationAcl;
|
|
88
|
+
readonly problem_snapshot: ImpactReviewProblemReference;
|
|
89
|
+
readonly condition: {
|
|
90
|
+
readonly event?: {
|
|
91
|
+
readonly event_type: string;
|
|
92
|
+
readonly event_id?: string;
|
|
93
|
+
};
|
|
94
|
+
readonly expression?: string;
|
|
95
|
+
};
|
|
96
|
+
readonly deadline?: {
|
|
97
|
+
readonly due_at?: string;
|
|
98
|
+
readonly review_interval_ms?: number;
|
|
99
|
+
};
|
|
100
|
+
readonly responsible: ImpactReviewResponsible;
|
|
101
|
+
readonly resume_method: 'new_problem' | 'reconcile_external_effect' | 'manual_review';
|
|
102
|
+
readonly failure_policy: 'new_problem' | 'reconciliation_wait' | 'handoff' | 'fail';
|
|
103
|
+
readonly run_ref: {
|
|
104
|
+
readonly run_id: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Structural compatibility with Story 13; this package does not import it before it is merged. */
|
|
108
|
+
export interface ImpactReviewWaitPort {
|
|
109
|
+
/** The adapter must treat wait_id as an idempotency key. */
|
|
110
|
+
create(input: ImpactReviewDurableWaitCreateInput): Promise<unknown>;
|
|
111
|
+
/** Read the canonical wait with current ACL and snapshot checks. */
|
|
112
|
+
readonly read?: (input: {
|
|
113
|
+
readonly wait_id: string;
|
|
114
|
+
readonly principal: string;
|
|
115
|
+
}) => Promise<unknown>;
|
|
116
|
+
markPremiseChanged(input: {
|
|
117
|
+
readonly wait_id: string;
|
|
118
|
+
readonly principal: string;
|
|
119
|
+
readonly new_problem_snapshot: ImpactReviewProblemReference;
|
|
120
|
+
readonly responsible?: ImpactReviewResponsible;
|
|
121
|
+
readonly reason: string;
|
|
122
|
+
}): Promise<unknown>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Adapt Story 13's canonical durable-wait ledger to the impact-review port.
|
|
126
|
+
* The coordinator remains independent from the ledger implementation; this
|
|
127
|
+
* boundary only forwards the wait operations it is allowed to request.
|
|
128
|
+
*/
|
|
129
|
+
export declare function createCompanyOsImpactReviewDurableWaitPort(store: Pick<DurableWaitStore, 'create' | 'get' | 'markPremiseChanged'>): ImpactReviewWaitPort;
|
|
130
|
+
export interface ImpactReviewNewProblemAndRun {
|
|
131
|
+
readonly problem: ImpactReviewProblemReference;
|
|
132
|
+
readonly run_id: string;
|
|
133
|
+
}
|
|
134
|
+
export interface ImpactReviewRejudgmentPort {
|
|
135
|
+
createNewProblemAndRun(input: {
|
|
136
|
+
readonly access: ImpactReviewAccessContext;
|
|
137
|
+
readonly plan: ImpactReviewPlan;
|
|
138
|
+
readonly changes: readonly ImpactReviewChange[];
|
|
139
|
+
readonly reason: string;
|
|
140
|
+
/** Stable across retries so the provider can make Problem/run creation idempotent. */
|
|
141
|
+
readonly operation_id: string;
|
|
142
|
+
}): Promise<ImpactReviewNewProblemAndRun>;
|
|
143
|
+
}
|
|
144
|
+
export type ImpactReviewDisposition = 'continue' | 'hold' | 'stop';
|
|
145
|
+
export interface ImpactReviewNotificationInput {
|
|
146
|
+
readonly plan_id: string;
|
|
147
|
+
readonly disposition: ImpactReviewDisposition;
|
|
148
|
+
readonly change_ids: readonly string[];
|
|
149
|
+
readonly reason: string;
|
|
150
|
+
readonly references: readonly ImpactReviewReference[];
|
|
151
|
+
readonly wait_id?: string;
|
|
152
|
+
readonly created_at?: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ImpactReviewNotificationRecord extends Omit<ImpactReviewNotificationInput, 'created_at'> {
|
|
155
|
+
readonly version: typeof COMPANY_OS_IMPACT_REVIEW_VERSION;
|
|
156
|
+
readonly notification_id: string;
|
|
157
|
+
readonly created_at: string;
|
|
158
|
+
}
|
|
159
|
+
export interface ImpactReviewNotificationReceipt {
|
|
160
|
+
readonly record: ImpactReviewNotificationRecord;
|
|
161
|
+
readonly status: 'created' | 'existing';
|
|
162
|
+
}
|
|
163
|
+
export interface ImpactReviewNotificationStore {
|
|
164
|
+
record(input: ImpactReviewNotificationInput): Promise<ImpactReviewNotificationReceipt>;
|
|
165
|
+
read(): Promise<readonly ImpactReviewNotificationRecord[]>;
|
|
166
|
+
list(): Promise<readonly ImpactReviewNotificationRecord[]>;
|
|
167
|
+
}
|
|
168
|
+
export declare class CompanyOsImpactReviewError extends Error {
|
|
169
|
+
readonly code: 'invalid_request' | 'invalid_provider_result' | 'unresolved_reference' | 'notification_conflict' | 'wait_conflict' | 'corrupt_sidecar' | 'missing_dependency' | 'rejudgment_not_allowed';
|
|
170
|
+
constructor(code: CompanyOsImpactReviewError['code'], message: string);
|
|
171
|
+
}
|
|
172
|
+
export interface CompanyOsImpactReviewNotificationStoreOptions {
|
|
173
|
+
readonly dataDir: string;
|
|
174
|
+
readonly sidecarPath?: string;
|
|
175
|
+
readonly clock?: () => Date;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Transactional, reference-only notification storage. The sidecar never
|
|
179
|
+
* stores an Objective/Model/Constraint body and never changes canonical SSOT.
|
|
180
|
+
*/
|
|
181
|
+
export declare class AtomicCompanyOsImpactReviewNotificationStore implements ImpactReviewNotificationStore {
|
|
182
|
+
private readonly dataDir;
|
|
183
|
+
private readonly sidecarPath;
|
|
184
|
+
private readonly clock;
|
|
185
|
+
constructor(options: CompanyOsImpactReviewNotificationStoreOptions);
|
|
186
|
+
record(input: ImpactReviewNotificationInput): Promise<ImpactReviewNotificationReceipt>;
|
|
187
|
+
read(): Promise<readonly ImpactReviewNotificationRecord[]>;
|
|
188
|
+
list(): Promise<readonly ImpactReviewNotificationRecord[]>;
|
|
189
|
+
}
|
|
190
|
+
export declare function createCompanyOsImpactReviewNotificationStore(options: CompanyOsImpactReviewNotificationStoreOptions): ImpactReviewNotificationStore;
|
|
191
|
+
export interface ImpactReviewPlanDecision {
|
|
192
|
+
readonly plan: ImpactReviewPlan;
|
|
193
|
+
readonly matches: readonly ImpactReviewPlanMatch[];
|
|
194
|
+
readonly disposition: ImpactReviewDisposition;
|
|
195
|
+
readonly reason: string;
|
|
196
|
+
readonly notification: ImpactReviewNotificationRecord;
|
|
197
|
+
readonly wait_id?: string;
|
|
198
|
+
}
|
|
199
|
+
export interface ImpactReviewUnresolvedChange {
|
|
200
|
+
readonly change: ImpactReviewChange;
|
|
201
|
+
readonly reason: string;
|
|
202
|
+
}
|
|
203
|
+
export interface ImpactReviewResult {
|
|
204
|
+
readonly outcome: 'affected' | 'no_affected_plans' | 'unresolved' | 'affected_and_unresolved';
|
|
205
|
+
readonly decisions: readonly ImpactReviewPlanDecision[];
|
|
206
|
+
readonly resolved_change_ids: readonly string[];
|
|
207
|
+
readonly unresolved_changes: readonly ImpactReviewUnresolvedChange[];
|
|
208
|
+
}
|
|
209
|
+
export interface ImpactReviewRequest {
|
|
210
|
+
readonly access: ImpactReviewAccessContext;
|
|
211
|
+
readonly changes: readonly ImpactReviewChange[];
|
|
212
|
+
}
|
|
213
|
+
export interface ImpactReviewReassessRequest {
|
|
214
|
+
readonly access: ImpactReviewAccessContext;
|
|
215
|
+
readonly plan: ImpactReviewPlan;
|
|
216
|
+
readonly changes: readonly ImpactReviewChange[];
|
|
217
|
+
readonly reason: string;
|
|
218
|
+
readonly wait_id?: string;
|
|
219
|
+
}
|
|
220
|
+
export interface ImpactReviewReassessResult extends ImpactReviewNewProblemAndRun {
|
|
221
|
+
readonly wait_id?: string;
|
|
222
|
+
}
|
|
223
|
+
export interface CompanyOsImpactReviewCoordinatorOptions {
|
|
224
|
+
readonly currentReferences: ImpactReviewCurrentReferencePort;
|
|
225
|
+
readonly index: ImpactReviewIndexPort;
|
|
226
|
+
readonly notifications: ImpactReviewNotificationStore;
|
|
227
|
+
readonly waits?: ImpactReviewWaitPort;
|
|
228
|
+
readonly rejudgment?: ImpactReviewRejudgmentPort;
|
|
229
|
+
}
|
|
230
|
+
export declare class CompanyOsImpactReviewCoordinator {
|
|
231
|
+
private readonly currentReferences;
|
|
232
|
+
private readonly index;
|
|
233
|
+
private readonly notifications;
|
|
234
|
+
private readonly waits?;
|
|
235
|
+
private readonly rejudgment?;
|
|
236
|
+
constructor(options: CompanyOsImpactReviewCoordinatorOptions);
|
|
237
|
+
review(request: ImpactReviewRequest): Promise<ImpactReviewResult>;
|
|
238
|
+
reassess(request: ImpactReviewReassessRequest): Promise<ImpactReviewReassessResult>;
|
|
239
|
+
}
|
|
240
|
+
export declare function computeImpactReviewNotificationId(input: ImpactReviewNotificationInput): string;
|
|
241
|
+
export declare function computeImpactReviewWaitId(planId: string, changeIds: readonly string[], reason: string, references?: readonly ImpactReviewReference[]): string;
|
|
242
|
+
export declare function computeImpactReviewRejudgmentOperationId(input: {
|
|
243
|
+
readonly access: ImpactReviewAccessContext;
|
|
244
|
+
readonly plan: ImpactReviewPlan;
|
|
245
|
+
readonly changes: readonly ImpactReviewChange[];
|
|
246
|
+
readonly reason: string;
|
|
247
|
+
readonly wait_id?: string;
|
|
248
|
+
}): string;
|