@unson/brainbase-mcp 0.50.31 → 0.51.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 (51) hide show
  1. package/contracts/canonical-task/store-schema.sql +3 -0
  2. package/dist/automation-run.js +3 -2
  3. package/dist/canonical-task-postgres.js +3 -0
  4. package/dist/canonical-task-service.d.ts +6 -0
  5. package/dist/canonical-task-service.js +40 -1
  6. package/dist/company-os-learning-adoption.d.ts +9 -0
  7. package/dist/company-os-learning-adoption.js +50 -1
  8. package/dist/durable-waits.d.ts +30 -0
  9. package/dist/durable-waits.js +100 -94
  10. package/dist/foundation-public-provider.d.ts +3 -1
  11. package/dist/foundation-public-provider.js +2 -2
  12. package/dist/graph-corrections.d.ts +46 -1
  13. package/dist/graph-corrections.js +172 -1
  14. package/dist/judgment-event-outbox.d.ts +24 -2
  15. package/dist/judgment-event-outbox.js +92 -10
  16. package/dist/judgment-frame.js +2 -2
  17. package/dist/judgment-host.d.ts +4 -1
  18. package/dist/judgment-host.js +126 -14
  19. package/dist/judgment-task-progress.d.ts +41 -0
  20. package/dist/judgment-task-progress.js +18 -0
  21. package/dist/knowledge-continuation.js +7 -1
  22. package/dist/knowledge-lookup.js +43 -58
  23. package/dist/mcp-runtime.d.ts +9 -0
  24. package/dist/mcp-runtime.js +12 -4
  25. package/dist/meeting-automation-runtime.d.ts +52 -0
  26. package/dist/meeting-automation-runtime.js +46 -0
  27. package/dist/queue-task-tools.js +2 -2
  28. package/dist/routine-liveness.js +0 -1
  29. package/dist/routine-runtime.js +1 -1
  30. package/dist/server.d.ts +59 -85
  31. package/dist/server.js +44 -36
  32. package/dist/ssot.js +1 -1
  33. package/dist/testing/queue-task-tools-contract.js +1 -1
  34. package/dist/world-model-impact-index.d.ts +132 -0
  35. package/dist/world-model-impact-index.js +901 -0
  36. package/package.json +6 -18
  37. package/ui/judgment-history.css +13 -0
  38. package/ui/objective-editor.css +19 -2
  39. package/ui/objective-editor.js +6 -3
  40. package/ui/project-workspace.css +33 -26
  41. package/ui/workspace-kit.js +9 -7
  42. package/ui/world/world-view.css +65 -46
  43. package/ui/world/world-view.js +27 -18
  44. package/dist/execution-authority-http.d.ts +0 -30
  45. package/dist/execution-authority-http.js +0 -454
  46. package/dist/execution-authority.d.ts +0 -282
  47. package/dist/execution-authority.js +0 -867
  48. package/dist/resource-reservation-http.d.ts +0 -31
  49. package/dist/resource-reservation-http.js +0 -371
  50. package/dist/resource-reservations.d.ts +0 -221
  51. package/dist/resource-reservations.js +0 -577
@@ -1,282 +0,0 @@
1
- import type { ResourceReservationProblemReference, ResourceReservationService } from './resource-reservations.js';
2
- declare const ledgerVersion: 1;
3
- export type ExecutionProblemReference = ResourceReservationProblemReference;
4
- export interface ExecutionStartInput {
5
- operationId: string;
6
- tenantId: string;
7
- principal: string;
8
- scopeId: string;
9
- runId: string;
10
- reservationId: string;
11
- approvalId: string;
12
- authorityRef: string;
13
- constraintRefs: readonly string[];
14
- /** Evidence reference only. It never grants execution permission. */
15
- problem: ExecutionProblemReference;
16
- }
17
- /**
18
- * Who started the execution, as resolved by the host from authenticated
19
- * context. Request bodies never supply it.
20
- */
21
- export type ExecutionAttributionMode = 'person' | 'delegated_service' | 'service';
22
- export interface ExecutionAttribution {
23
- /** person: the principal acted directly. delegated_service: a service acted for the principal. service: an automated job acted on its own authority. */
24
- mode: ExecutionAttributionMode;
25
- /** Authenticated service principal. Required unless mode is person. */
26
- servicePrincipal?: string;
27
- /** Verified delegation, or for mode service the authority grant that the job relies on. */
28
- delegationRef?: string;
29
- correlationId?: string;
30
- }
31
- export interface ExecutionRequestOptions {
32
- attribution?: ExecutionAttribution;
33
- }
34
- export type ExecutionCheckKind = 'authority' | 'approval' | 'constraint' | 'reservation';
35
- export type ExecutionVerificationPhase = 'initial' | 'final';
36
- export type ExecutionCheckStatus = 'approved' | 'revoked' | 'expired' | 'unknown';
37
- export type ExecutionReadAccessStatus = 'approved' | 'revoked' | 'expired' | 'unknown';
38
- export interface ExecutionCheckRequest extends ExecutionStartInput {
39
- check: ExecutionCheckKind;
40
- phase: ExecutionVerificationPhase;
41
- /** The revision returned by the first check. Providers may fence on it. */
42
- expectedRevision?: string;
43
- /** Present when the host resolved an attribution; providers verify delegation with it. */
44
- attribution?: ExecutionAttribution;
45
- }
46
- export interface ExecutionCheckResult {
47
- status: ExecutionCheckStatus;
48
- revision: string | null;
49
- /** Opaque token that the effect owner must consume and validate at start. */
50
- fencingToken?: string;
51
- /** Short validity bound for the fencing token. */
52
- expiresAt?: string;
53
- evidence?: Readonly<Record<string, string>>;
54
- }
55
- export interface ExecutionReadAccessRequest {
56
- operationId: string;
57
- tenantId: string;
58
- principal: string;
59
- scopeId: string;
60
- phase: 'read';
61
- }
62
- export interface ExecutionReadAccessResult {
63
- status: ExecutionReadAccessStatus;
64
- revision: string | null;
65
- }
66
- export interface ExecutionReadAccessPort {
67
- verify(input: ExecutionReadAccessRequest): ExecutionReadAccessResult | Promise<ExecutionReadAccessResult>;
68
- }
69
- export interface ExecutionAuthorityPort {
70
- verify(input: ExecutionCheckRequest): ExecutionCheckResult | Promise<ExecutionCheckResult>;
71
- }
72
- export interface ExecutionApprovalPort {
73
- verify(input: ExecutionCheckRequest): ExecutionCheckResult | Promise<ExecutionCheckResult>;
74
- }
75
- export interface ExecutionConstraintPort {
76
- verify(input: ExecutionCheckRequest): ExecutionCheckResult | Promise<ExecutionCheckResult>;
77
- }
78
- export interface ExecutionReservationPort {
79
- verify(input: ExecutionCheckRequest): ExecutionCheckResult | Promise<ExecutionCheckResult>;
80
- /** The returned revision is the read fence; the reservation store is the start linearization point. */
81
- markStarted(input: ExecutionReservationMarkRequest): ExecutionReservationMarkResult | Promise<ExecutionReservationMarkResult>;
82
- }
83
- export interface ExecutionReservationMarkRequest extends ExecutionStartInput {
84
- expectedRevision: string;
85
- }
86
- export interface ExecutionReservationMarkResult {
87
- status: 'started' | 'unknown';
88
- }
89
- export interface ExecutionEffectPort {
90
- /** The effect owner must consume and validate this capability at its own start boundary. */
91
- start(input: ExecutionEffectRequest): ExecutionEffectResult | Promise<ExecutionEffectResult>;
92
- }
93
- export interface ExecutionEffectRequest extends ExecutionStartInput {
94
- capability: ExecutionStartCapability;
95
- }
96
- export interface ExecutionStartCapability {
97
- kind: 'execution-start';
98
- operationId: string;
99
- tenantId: string;
100
- principal: string;
101
- scopeId: string;
102
- issuedAt: string;
103
- expiresAt: string;
104
- attribution?: ExecutionAttribution;
105
- checks: Record<ExecutionCheckKind, {
106
- revision: string;
107
- fencingToken: string;
108
- expiresAt: string;
109
- }>;
110
- }
111
- export interface ExecutionEffectResult {
112
- status: 'started' | 'unknown';
113
- }
114
- /** registered: checks passed and a permit was issued; the effect owner has not reported yet. */
115
- export type ExecutionIntentPhase = 'recovery_required' | 'reservation_marked' | 'registered' | 'started' | 'unknown' | 'rejected';
116
- export type ExecutionIntentEffectStatus = 'not_started' | 'started' | 'unknown';
117
- export type ExecutionIntentReservationMarkStatus = 'not_started' | 'started' | 'unknown';
118
- export interface ExecutionCheckRecord {
119
- check: ExecutionCheckKind;
120
- status: ExecutionCheckStatus;
121
- revision: string | null;
122
- fencingTokenDigest?: string;
123
- expiresAt?: string;
124
- evidence: Record<string, string>;
125
- }
126
- export type ExecutionAuthorityErrorCode = 'validation_error' | 'authority_revoked' | 'authority_expired' | 'authority_unknown' | 'approval_revoked' | 'approval_expired' | 'approval_unknown' | 'constraint_revoked' | 'constraint_expired' | 'constraint_unknown' | 'reservation_revoked' | 'reservation_expired' | 'reservation_unknown' | 'read_revoked' | 'read_expired' | 'read_unknown' | 'revision_conflict' | 'fencing_unsupported' | 'capability_expired' | 'operation_conflict' | 'scope_mismatch' | 'recovery_required' | 'reservation_mark_unknown' | 'effect_unknown' | 'effect_unconfigured' | 'capability_mismatch' | 'intent_not_found' | 'store_unavailable' | 'ledger_invalid';
127
- export interface ExecutionIntentFailure {
128
- code: ExecutionAuthorityErrorCode;
129
- reason: string;
130
- }
131
- export interface ExecutionIntentRecord {
132
- version: typeof ledgerVersion;
133
- operationId: string;
134
- tenantId: string;
135
- principal: string;
136
- scopeId: string;
137
- runId: string;
138
- reservationId: string;
139
- approvalId: string;
140
- authorityRef: string;
141
- constraintRefs: string[];
142
- problem: ExecutionProblemReference;
143
- payloadDigest: string;
144
- attribution?: ExecutionAttribution;
145
- phase: ExecutionIntentPhase;
146
- reservationMark: ExecutionIntentReservationMarkStatus;
147
- effect: {
148
- operationId: string;
149
- status: ExecutionIntentEffectStatus;
150
- };
151
- verification: {
152
- initial: ExecutionCheckRecord[];
153
- final?: ExecutionCheckRecord[];
154
- };
155
- capability?: {
156
- expiresAt: string;
157
- digest: string;
158
- /** Stored only for registrations so a lost response can be replayed. Never returned to readers. */
159
- grant?: ExecutionStartCapability;
160
- };
161
- failure?: ExecutionIntentFailure;
162
- createdAt: string;
163
- updatedAt: string;
164
- }
165
- export interface ExecutionStartResult {
166
- intent: ExecutionIntentRecord;
167
- effect: {
168
- operationId: string;
169
- status: 'started';
170
- };
171
- replayed: boolean;
172
- }
173
- export interface ExecutionRegistrationResult {
174
- intent: ExecutionIntentRecord;
175
- capability: ExecutionStartCapability;
176
- capabilityDigest: string;
177
- replayed: boolean;
178
- }
179
- export interface ExecutionEffectReport {
180
- operationId: string;
181
- tenantId: string;
182
- principal: string;
183
- scopeId: string;
184
- /** Binds the report to the issued permit. It is not a secret. */
185
- capabilityDigest: string;
186
- status: 'started' | 'unknown';
187
- }
188
- export interface ExecutionIntentKey {
189
- tenantId: string;
190
- operationId: string;
191
- }
192
- /**
193
- * Durable intent storage. A host injects a database adapter here; the default
194
- * is the local sidecar. insert and update must each be atomic per key.
195
- */
196
- export interface ExecutionIntentStore {
197
- initialize?(): Promise<void>;
198
- read(key: ExecutionIntentKey): Promise<ExecutionIntentRecord | undefined>;
199
- /** Stores the intent when the key is absent; otherwise returns the existing record with created false. */
200
- insert(intent: ExecutionIntentRecord): Promise<{
201
- intent: ExecutionIntentRecord;
202
- created: boolean;
203
- }>;
204
- /** Writes mutate(current) atomically. Returns undefined when absent. A throwing mutate writes nothing and rethrows. */
205
- update(key: ExecutionIntentKey, mutate: (current: ExecutionIntentRecord) => ExecutionIntentRecord): Promise<ExecutionIntentRecord | undefined>;
206
- }
207
- export interface ExecutionAuthorityServiceOptions {
208
- /** Used for the default sidecar store when store is omitted. */
209
- dataDir?: string;
210
- store?: ExecutionIntentStore;
211
- authority: ExecutionAuthorityPort;
212
- approval: ExecutionApprovalPort;
213
- constraint: ExecutionConstraintPort;
214
- reservation: ExecutionReservationPort;
215
- readAccess: ExecutionReadAccessPort;
216
- /** Required for start. Registration-only hosts leave the effect to its owner. */
217
- effect?: ExecutionEffectPort;
218
- clock?: () => Date;
219
- sidecarPath?: string;
220
- }
221
- export declare class ExecutionAuthorityError extends Error {
222
- readonly code: ExecutionAuthorityErrorCode;
223
- constructor(code: ExecutionAuthorityErrorCode, message: string);
224
- }
225
- /**
226
- * Persists the execution intent before crossing either the reservation or
227
- * external-effect boundary. The reservation and intent stores are separate
228
- * transactions; callers must reconcile recovery_required/unknown states.
229
- */
230
- export declare class ExecutionAuthorityService {
231
- private readonly store;
232
- private readonly authority;
233
- private readonly approval;
234
- private readonly constraint;
235
- private readonly reservation;
236
- private readonly readAccess;
237
- private readonly effect;
238
- private readonly clock;
239
- constructor(options: ExecutionAuthorityServiceOptions);
240
- initialize(): Promise<void>;
241
- /** Runs the checks, marks the reservation, and calls the in-process effect port. */
242
- start(input: ExecutionStartInput, options?: ExecutionRequestOptions): Promise<ExecutionStartResult>;
243
- /**
244
- * Registers the execution: runs the checks, marks the reservation, and
245
- * issues the permit. The effect owner reports the outcome with reportEffect.
246
- */
247
- register(input: ExecutionStartInput, options?: ExecutionRequestOptions): Promise<ExecutionRegistrationResult>;
248
- /** Records the effect owner's outcome for a registered execution. */
249
- reportEffect(report: ExecutionEffectReport): Promise<ExecutionIntentRecord>;
250
- readIntent(input: Pick<ExecutionStartInput, 'operationId' | 'tenantId' | 'principal' | 'scopeId'>): Promise<ExecutionIntentRecord | undefined>;
251
- /**
252
- * Shared path for start and register: initial checks, durable intent,
253
- * fenced final checks, permit, and the reservation mark.
254
- */
255
- private prepare;
256
- private findIntent;
257
- private verifyReadAccess;
258
- private recordIntent;
259
- private updateIntent;
260
- private tryUpdateIntent;
261
- private persistRecovery;
262
- private verifyAll;
263
- private handleExisting;
264
- private replayRegistration;
265
- /** Store failures are never success and never switch to another ledger. */
266
- private storeCall;
267
- private now;
268
- }
269
- /** The default store: a JSON sidecar under the local SSOT lock. */
270
- export declare function createSidecarExecutionIntentStore(options: {
271
- dataDir: string;
272
- sidecarPath?: string;
273
- }): ExecutionIntentStore;
274
- /**
275
- * Binds the existing reservation store to the execution port without calling
276
- * it from inside the execution sidecar transaction. The store remains the
277
- * owner of its current authorization and reservation-state checks.
278
- */
279
- export declare function createResourceReservationExecutionPort(options: {
280
- service: Pick<ResourceReservationService, 'readLedger' | 'startExternalAction'>;
281
- }): ExecutionReservationPort;
282
- export {};