@unson/brainbase-mcp 0.5.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.
Files changed (92) hide show
  1. package/README.md +8 -0
  2. package/contracts/judgment-dag/digest.json +2 -2
  3. package/dist/canonical-task-contract.d.ts +9 -0
  4. package/dist/canonical-task-contract.js +39 -0
  5. package/dist/canonical-task-principal.d.ts +16 -0
  6. package/dist/canonical-task-principal.js +36 -0
  7. package/dist/canonical-task-service.d.ts +251 -0
  8. package/dist/canonical-task-service.js +809 -0
  9. package/dist/company-os-evaluation.d.ts +193 -0
  10. package/dist/company-os-evaluation.js +1150 -0
  11. package/dist/company-os-impact-review.d.ts +248 -0
  12. package/dist/company-os-impact-review.js +663 -0
  13. package/dist/company-os-learning-adoption.d.ts +288 -0
  14. package/dist/company-os-learning-adoption.js +944 -0
  15. package/dist/company-os-objectives.d.ts +52 -0
  16. package/dist/company-os-objectives.js +197 -0
  17. package/dist/company-os-receipt-adapter.d.ts +109 -0
  18. package/dist/company-os-receipt-adapter.js +636 -0
  19. package/dist/constraint-exception-store.d.ts +23 -0
  20. package/dist/constraint-exception-store.js +108 -0
  21. package/dist/constraint-resolution.d.ts +175 -0
  22. package/dist/constraint-resolution.js +922 -0
  23. package/dist/decision-adapter.d.ts +145 -0
  24. package/dist/decision-adapter.js +586 -0
  25. package/dist/durable-wait-http.d.ts +51 -0
  26. package/dist/durable-wait-http.js +497 -0
  27. package/dist/durable-waits.d.ts +234 -0
  28. package/dist/durable-waits.js +944 -0
  29. package/dist/execution-authority-http.d.ts +28 -0
  30. package/dist/execution-authority-http.js +359 -0
  31. package/dist/execution-authority.d.ts +201 -0
  32. package/dist/execution-authority.js +634 -0
  33. package/dist/foundation-catalog.d.ts +26 -0
  34. package/dist/foundation-catalog.js +206 -0
  35. package/dist/foundation-constraint-store.d.ts +50 -0
  36. package/dist/foundation-constraint-store.js +215 -0
  37. package/dist/foundation-http.d.ts +90 -0
  38. package/dist/foundation-http.js +439 -0
  39. package/dist/foundation-store.d.ts +132 -0
  40. package/dist/foundation-store.js +654 -0
  41. package/dist/judgment-dag-composition.d.ts +224 -0
  42. package/dist/judgment-dag-composition.js +731 -0
  43. package/dist/judgment-dag.d.ts +2 -0
  44. package/dist/judgment-dag.js +1 -0
  45. package/dist/judgment-problem-snapshot.d.ts +185 -0
  46. package/dist/judgment-problem-snapshot.js +777 -0
  47. package/dist/judgment-view-http.d.ts +22 -0
  48. package/dist/judgment-view-http.js +128 -0
  49. package/dist/judgment-view.d.ts +222 -0
  50. package/dist/judgment-view.js +627 -0
  51. package/dist/knowledge-adapter.d.ts +112 -0
  52. package/dist/knowledge-adapter.js +691 -0
  53. package/dist/ontology-foundation.d.ts +209 -0
  54. package/dist/ontology-foundation.js +1000 -0
  55. package/dist/ontology.d.ts +13 -0
  56. package/dist/ontology.js +14 -0
  57. package/dist/organization-connection.d.ts +164 -0
  58. package/dist/organization-connection.js +428 -0
  59. package/dist/personal-knowledge.d.ts +120 -0
  60. package/dist/personal-knowledge.js +750 -0
  61. package/dist/problem-candidates.d.ts +149 -0
  62. package/dist/problem-candidates.js +898 -0
  63. package/dist/problem-selection.d.ts +238 -0
  64. package/dist/problem-selection.js +995 -0
  65. package/dist/resource-reservation-http.d.ts +31 -0
  66. package/dist/resource-reservation-http.js +371 -0
  67. package/dist/resource-reservations.d.ts +221 -0
  68. package/dist/resource-reservations.js +577 -0
  69. package/dist/server.d.ts +97 -0
  70. package/dist/server.js +180 -1
  71. package/dist/ssot.d.ts +6 -1
  72. package/dist/ssot.js +63 -5
  73. package/dist/streamable-http.d.ts +42 -0
  74. package/dist/streamable-http.js +288 -0
  75. package/dist/types.d.ts +20 -0
  76. package/dist/world-model.d.ts +181 -0
  77. package/dist/world-model.js +873 -0
  78. package/package.json +145 -3
  79. package/ui/icons/mana/LICENSE.tabler.txt +21 -0
  80. package/ui/icons/mana/affiliate.svg +20 -0
  81. package/ui/icons/mana/brand-github.svg +15 -0
  82. package/ui/icons/mana/brand-google-drive.svg +17 -0
  83. package/ui/icons/mana/brand-slack.svg +18 -0
  84. package/ui/icons/mana/cpu.svg +24 -0
  85. package/ui/judgment-view.css +238 -0
  86. package/ui/judgment-view.js +508 -0
  87. package/ui/objective-editor.css +180 -0
  88. package/ui/objective-editor.js +1139 -0
  89. package/ui/outcome-knowledge.css +365 -0
  90. package/ui/outcome-knowledge.js +1570 -0
  91. package/ui/outcome-mana.css +255 -0
  92. package/ui/outcome-mana.js +2325 -0
@@ -0,0 +1,234 @@
1
+ import { type JudgmentProblemScope, type JudgmentProblemReferenceResolutionPhase } from './judgment-problem-snapshot.js';
2
+ import type { FoundationAcl } from './ontology-foundation.js';
3
+ /** Story13's persisted contract. The ledger is deliberately separate from the
4
+ * canonical graph but is committed by the same Personal OS sidecar transaction.
5
+ */
6
+ export declare const DURABLE_WAIT_VERSION: "durable-wait.v1";
7
+ export declare const DURABLE_WAIT_SIDECAR_PATH: "durable-waits/ledger.json";
8
+ export declare const DURABLE_WAIT_LEDGER_VERSION: "durable-wait.v1";
9
+ export type DurableWaitState = 'waiting' | 'claimed' | 'resumed' | 'handoff_required' | 'reconciliation_wait' | 'failed' | 'cancelled';
10
+ export type DurableWaitTrigger = 'event' | 'timer' | 'manual';
11
+ export type DurableWaitResumeMethod = 'resume_run' | 'new_problem' | 'reconcile_external_effect' | 'manual_review';
12
+ export type DurableWaitFailurePolicy = 'handoff' | 'new_problem' | 'reconciliation_wait' | 'fail';
13
+ export interface DurableWaitEventCondition {
14
+ readonly event_type: string;
15
+ readonly event_id?: string;
16
+ readonly predicate?: string;
17
+ }
18
+ export interface DurableWaitCondition {
19
+ readonly event?: DurableWaitEventCondition;
20
+ readonly expression?: string;
21
+ }
22
+ export interface DurableWaitDeadline {
23
+ readonly due_at?: string;
24
+ readonly review_interval_ms?: number;
25
+ /** The next periodic review is persisted so a restarted worker does not lose it. */
26
+ readonly next_review_at?: string;
27
+ }
28
+ export interface DurableWaitResponsible {
29
+ readonly principal: string;
30
+ readonly scope?: string;
31
+ }
32
+ export interface DurableWaitRunReference {
33
+ readonly run_id: string;
34
+ readonly node_id?: string;
35
+ }
36
+ /** Structural alias compatible with JudgmentDAG's snapshot locator. */
37
+ export interface DurableWaitProblemReference {
38
+ readonly snapshot_id: `sha256:${string}` | string;
39
+ readonly problem_id: string;
40
+ readonly revision: string;
41
+ }
42
+ export interface DurableWaitLease {
43
+ readonly lease_id: string;
44
+ readonly holder: string;
45
+ readonly token: string;
46
+ readonly expires_at: string;
47
+ }
48
+ export interface DurableWaitClaim {
49
+ readonly claim_id: string;
50
+ /** Idempotency key for the scheduler/worker claim request. */
51
+ readonly request_id: string;
52
+ readonly trigger: DurableWaitTrigger;
53
+ readonly claimed_by: string;
54
+ readonly claimed_at: string;
55
+ readonly lease: DurableWaitLease;
56
+ readonly event_id?: string;
57
+ }
58
+ export interface DurableWaitResumeReceipt {
59
+ readonly resume_id: string;
60
+ readonly wait_id: string;
61
+ readonly claim_id: string;
62
+ readonly run_ref: DurableWaitRunReference;
63
+ readonly recorded_at: string;
64
+ }
65
+ export type DurableWaitHistoryAction = 'create' | 'claim' | 'handoff' | 'premise_changed' | 'effect_unknown' | 'resume';
66
+ export interface DurableWaitHistoryEntry {
67
+ readonly action: DurableWaitHistoryAction;
68
+ readonly occurred_at: string;
69
+ readonly principal: string;
70
+ readonly from_state?: DurableWaitState;
71
+ readonly to_state: DurableWaitState;
72
+ readonly detail?: string;
73
+ readonly responsible?: DurableWaitResponsible;
74
+ }
75
+ export interface DurableWaitReconciliation {
76
+ readonly reason: string;
77
+ readonly recorded_at: string;
78
+ readonly responsible: DurableWaitResponsible;
79
+ }
80
+ export interface DurableWaitRecord {
81
+ readonly wait_id: string;
82
+ readonly version: typeof DURABLE_WAIT_VERSION;
83
+ readonly owner_scope: JudgmentProblemScope;
84
+ readonly read_policy: FoundationAcl;
85
+ readonly problem_snapshot: DurableWaitProblemReference;
86
+ readonly condition: DurableWaitCondition;
87
+ readonly deadline?: DurableWaitDeadline;
88
+ readonly responsible: DurableWaitResponsible;
89
+ readonly resume_method: DurableWaitResumeMethod;
90
+ readonly failure_policy: DurableWaitFailurePolicy;
91
+ readonly run_ref: DurableWaitRunReference;
92
+ readonly state: DurableWaitState;
93
+ readonly created_at: string;
94
+ readonly updated_at: string;
95
+ readonly claim?: DurableWaitClaim;
96
+ readonly resume_receipt?: DurableWaitResumeReceipt;
97
+ readonly next_problem?: DurableWaitProblemReference;
98
+ readonly reconciliation?: DurableWaitReconciliation;
99
+ readonly history: readonly DurableWaitHistoryEntry[];
100
+ }
101
+ export interface DurableWaitCreateInput {
102
+ readonly wait_id?: string;
103
+ readonly principal: string;
104
+ readonly owner_scope: JudgmentProblemScope;
105
+ readonly read_policy: FoundationAcl;
106
+ readonly problem_snapshot?: DurableWaitProblemReference;
107
+ /** `problem` is an ergonomic alias for adapters using existing run vocabulary. */
108
+ readonly problem?: DurableWaitProblemReference;
109
+ readonly condition: DurableWaitCondition;
110
+ readonly deadline?: DurableWaitDeadline;
111
+ readonly responsible: DurableWaitResponsible;
112
+ readonly resume_method: DurableWaitResumeMethod;
113
+ readonly failure_policy: DurableWaitFailurePolicy;
114
+ readonly run_ref: DurableWaitRunReference;
115
+ readonly created_at?: string;
116
+ }
117
+ export interface DurableWaitReadInput {
118
+ readonly wait_id: string;
119
+ readonly principal: string;
120
+ }
121
+ export interface DurableWaitClaimInput extends DurableWaitReadInput {
122
+ /** Binds the returned lease/token to this particular claim attempt. */
123
+ readonly request_id: string;
124
+ readonly trigger: DurableWaitTrigger;
125
+ readonly event_type?: string;
126
+ readonly event_id?: string;
127
+ readonly occurred_at?: string;
128
+ readonly lease_ms?: number;
129
+ }
130
+ export interface DurableWaitClaimResult {
131
+ readonly wait: DurableWaitRecord;
132
+ readonly claim: DurableWaitClaim;
133
+ /** True when an event/timer observed an already claimed wait. */
134
+ readonly duplicate: boolean;
135
+ /** Only this request may call resume with the returned claim credentials. */
136
+ readonly claimed_by_this_request: boolean;
137
+ }
138
+ export interface DurableWaitHandoffInput extends DurableWaitReadInput {
139
+ /** New idempotency key bound to the replacement lease. */
140
+ readonly request_id: string;
141
+ readonly responsible: DurableWaitResponsible;
142
+ readonly lease_ms?: number;
143
+ readonly now?: string;
144
+ readonly reason?: string;
145
+ }
146
+ export interface DurableWaitPremiseChangedInput extends DurableWaitReadInput {
147
+ readonly new_problem_snapshot?: DurableWaitProblemReference;
148
+ readonly new_problem?: DurableWaitProblemReference;
149
+ readonly responsible?: DurableWaitResponsible;
150
+ readonly reason: string;
151
+ }
152
+ export interface DurableWaitEffectUnknownInput extends DurableWaitReadInput {
153
+ readonly reason: string;
154
+ readonly responsible?: DurableWaitResponsible;
155
+ }
156
+ export interface DurableWaitResumeInput extends DurableWaitReadInput {
157
+ /** Must match the request that won the claim (or the replacement handoff). */
158
+ readonly request_id: string;
159
+ readonly claim_id: string;
160
+ readonly lease_id: string;
161
+ readonly lease_token: string;
162
+ }
163
+ export interface DurableWaitProblemSnapshotPort {
164
+ /**
165
+ * The adapter owns immutable snapshot lookup, exact identity/digest checks,
166
+ * and current read ACL. It must fail closed when the reference is missing or
167
+ * not readable. `historical_read` is intentionally not accepted here because
168
+ * a live wait is a new continuation, never an audit replay.
169
+ */
170
+ verify(input: {
171
+ readonly principal: string;
172
+ readonly reference: DurableWaitProblemReference;
173
+ readonly phase: Extract<JudgmentProblemReferenceResolutionPhase, 'save' | 'read'>;
174
+ }): void | boolean | Promise<void | boolean>;
175
+ }
176
+ export type DurableWaitAccessAction = 'read' | 'write' | 'claim';
177
+ export interface DurableWaitAccessPort {
178
+ authorize(input: {
179
+ readonly action: DurableWaitAccessAction;
180
+ readonly principal: string;
181
+ readonly acl: FoundationAcl;
182
+ readonly wait?: DurableWaitRecord;
183
+ }): void | boolean | Promise<void | boolean>;
184
+ }
185
+ export interface DurableWaitStoreOptions {
186
+ readonly dataDir: string;
187
+ readonly problemSnapshot: DurableWaitProblemSnapshotPort;
188
+ readonly access?: DurableWaitAccessPort;
189
+ readonly clock?: () => Date;
190
+ readonly sidecarPath?: string;
191
+ readonly defaultLeaseMs?: number;
192
+ }
193
+ export type DurableWaitErrorCode = 'invalid_request' | 'not_found' | 'unauthorized' | 'ledger_invalid' | 'problem_snapshot_invalid' | 'condition_unmet' | 'lease_active' | 'lease_expired' | 'state_conflict' | 'reconciliation_required';
194
+ export declare class DurableWaitError extends Error {
195
+ readonly code: DurableWaitErrorCode;
196
+ readonly wait_id?: string;
197
+ constructor(code: DurableWaitErrorCode, message: string, wait_id?: string);
198
+ }
199
+ export declare const defaultDurableWaitAccessProvider: DurableWaitAccessPort;
200
+ export declare class DurableWaitStore {
201
+ private readonly dataDir;
202
+ private readonly problemSnapshot;
203
+ private readonly access;
204
+ private readonly clock;
205
+ private readonly sidecarPath;
206
+ private readonly defaultLeaseMs;
207
+ constructor(options: DurableWaitStoreOptions);
208
+ initialize(): Promise<void>;
209
+ create(input: DurableWaitCreateInput): Promise<DurableWaitRecord>;
210
+ get(input: DurableWaitReadInput): Promise<DurableWaitRecord>;
211
+ /** Alias used by adapters that model stores as read operations. */
212
+ read(input: DurableWaitReadInput): Promise<DurableWaitRecord>;
213
+ list(input: {
214
+ readonly principal: string;
215
+ readonly owner_scope_id?: string;
216
+ }): Promise<readonly DurableWaitRecord[]>;
217
+ claim(input: DurableWaitClaimInput): Promise<DurableWaitClaimResult>;
218
+ handoff(input: DurableWaitHandoffInput): Promise<DurableWaitRecord>;
219
+ /** Explicit name for scheduler adapters that only hand off expired leases. */
220
+ handoffExpired(input: DurableWaitHandoffInput): Promise<DurableWaitRecord>;
221
+ resume(input: DurableWaitResumeInput): Promise<DurableWaitResumeReceipt>;
222
+ markPremiseChanged(input: DurableWaitPremiseChangedInput): Promise<DurableWaitRecord>;
223
+ markEffectUnknown(input: DurableWaitEffectUnknownInput): Promise<DurableWaitRecord>;
224
+ private captureMutationPreflight;
225
+ private assertMutationPreflight;
226
+ private readStored;
227
+ private reconcileClaimAfterPreflightConflict;
228
+ private authorize;
229
+ private verifyProblem;
230
+ private now;
231
+ private nowFromMillis;
232
+ private timestamp;
233
+ }
234
+ export declare function createDurableWaitStore(options: DurableWaitStoreOptions): DurableWaitStore;