@substrat-run/contracts 0.114.0 → 0.117.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/capability.d.ts +243 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +210 -0
- package/dist/capability.js.map +1 -0
- package/dist/control-plane.d.ts +154 -0
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +101 -2
- package/dist/control-plane.js.map +1 -1
- package/dist/denial.d.ts +16 -0
- package/dist/denial.d.ts.map +1 -1
- package/dist/denial.js +42 -0
- package/dist/denial.js.map +1 -1
- package/dist/events.d.ts +79 -21
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +154 -5
- package/dist/events.js.map +1 -1
- package/dist/ids.d.ts +12 -0
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +17 -0
- package/dist/ids.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +4 -0
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +27 -0
- package/dist/manifest.js.map +1 -1
- package/dist/mcp.d.ts +39 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +43 -0
- package/dist/mcp.js.map +1 -0
- package/dist/model.d.ts +16 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +4 -0
- package/dist/model.js.map +1 -1
- package/dist/permission.d.ts +68 -4
- package/dist/permission.d.ts.map +1 -1
- package/dist/permission.js +65 -5
- package/dist/permission.js.map +1 -1
- package/dist/platform-request.d.ts +5 -0
- package/dist/platform-request.d.ts.map +1 -1
- package/dist/platform-request.js +18 -0
- package/dist/platform-request.js.map +1 -1
- package/package.json +1 -1
package/dist/denial.js
CHANGED
|
@@ -53,9 +53,36 @@ export const permissionDenial = z.object({
|
|
|
53
53
|
* this log exists to answer — and `actor` alone would answer it wrongly.
|
|
54
54
|
*/
|
|
55
55
|
impersonation: impersonationStamp.nullable(),
|
|
56
|
+
/**
|
|
57
|
+
* The invocation this refusal happened during (#1525), or null.
|
|
58
|
+
*
|
|
59
|
+
* The same id #1237 stamps on every event of a call, and the only thing that joins a
|
|
60
|
+
* denial to the rest of its request. `operation` names *what* was attempted, never
|
|
61
|
+
* *which attempt* — so without this a refusal is reachable only by actor and time,
|
|
62
|
+
* and "what else did this call do" stops at the events that succeeded.
|
|
63
|
+
*
|
|
64
|
+
* Null is two facts, as ever: the transport carried no id (a seed, a test, an
|
|
65
|
+
* internal call, an attachment RPC), or the row predates the column.
|
|
66
|
+
*/
|
|
67
|
+
invocationId: z.string().nullable(),
|
|
56
68
|
/** ISO 8601. */
|
|
57
69
|
at: z.string().min(1),
|
|
58
70
|
drainedAt: z.string().nullable(),
|
|
71
|
+
/**
|
|
72
|
+
* Why this row could not be read whole (#1636). ABSENT on every row the kernel wrote,
|
|
73
|
+
* so a healthy page reads exactly as it did before.
|
|
74
|
+
*
|
|
75
|
+
* This log is the only witness to a refused check, and one row whose `actor` or
|
|
76
|
+
* `impersonation` would not parse used to make the whole read throw. So the read is
|
|
77
|
+
* tolerant and says so: each column that did not decode is named here and its field
|
|
78
|
+
* comes back EMPTY — `actor` as the self-naming `{ system: 'undecodable' }` marker,
|
|
79
|
+
* `impersonation` as `null` beside this reason, which is what keeps it from reading as
|
|
80
|
+
* "nobody was impersonating". A stored `permission` that is not a permission key reads as
|
|
81
|
+
* the self-naming `undecodable:permission`, and this QUOTES the stored key: a module that
|
|
82
|
+
* casts a malformed key is refused with it, and the key is the evidence of why. A row
|
|
83
|
+
* whose id, tenant or time does not decode is never returned as one of these at all.
|
|
84
|
+
*/
|
|
85
|
+
decodeError: z.string().min(1).optional(),
|
|
59
86
|
});
|
|
60
87
|
/**
|
|
61
88
|
* What narrows a denial read. Every field is an exact match except the `since`/`until`
|
|
@@ -155,6 +182,14 @@ export const denialBucket = z.object({
|
|
|
155
182
|
/** ISO 8601 — the first occurrence still in the window (see `windowOldestAt`). */
|
|
156
183
|
firstAt: z.string().min(1),
|
|
157
184
|
lastAt: z.string().min(1),
|
|
185
|
+
/**
|
|
186
|
+
* Why this bucket's key could not be read (#1636), absent otherwise. The buckets are
|
|
187
|
+
* `GROUP BY actor`, so one stored actor that would not parse used to throw the whole
|
|
188
|
+
* summary — "the read a console opens first". It now reads as the self-naming
|
|
189
|
+
* `{ system: 'undecodable' }` marker, with the count still counted and this saying why.
|
|
190
|
+
* A malformed permission key reads as `undecodable:permission`, the stored key quoted here.
|
|
191
|
+
*/
|
|
192
|
+
decodeError: z.string().min(1).optional(),
|
|
158
193
|
});
|
|
159
194
|
/**
|
|
160
195
|
* One per-operation bucket (#1456) — "which operation keeps getting refused", the
|
|
@@ -170,6 +205,13 @@ export const denialOperationBucket = z.object({
|
|
|
170
205
|
/** ISO 8601 — the first occurrence still in the window (see `windowOldestAt`). */
|
|
171
206
|
firstAt: z.string().min(1),
|
|
172
207
|
lastAt: z.string().min(1),
|
|
208
|
+
/**
|
|
209
|
+
* Why this bucket's key could not be read (#1643), absent otherwise. `operation` is the
|
|
210
|
+
* only column a bucket can fall back on: one that is not text reads as `null` — the
|
|
211
|
+
* bucket for a refusal outside an operation — beside this reason, which is what keeps it
|
|
212
|
+
* from reading as one. A bucket whose count or times do not decode is never returned.
|
|
213
|
+
*/
|
|
214
|
+
decodeError: z.string().min(1).optional(),
|
|
173
215
|
});
|
|
174
216
|
/**
|
|
175
217
|
* The facts every summary carries beside its buckets — what keeps the bucket list
|
package/dist/denial.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"denial.js","sourceRoot":"","sources":["../src/denial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aA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AAkB,CAAC,SAAS,EAAE;IAC3D,kBAAkB;IAClB,sBAAsB;CACvB,CAAC,CAAC"}
|
package/dist/events.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type EventId, type Instant, type ModuleId } from './ids.js';
|
|
3
2
|
export declare const entityRef: z.ZodObject<{
|
|
4
3
|
entityType: z.ZodString;
|
|
5
4
|
entityId: z.ZodString;
|
|
@@ -28,10 +27,24 @@ export declare const systemActor: z.ZodObject<{
|
|
|
28
27
|
export declare const connectorActor: z.ZodObject<{
|
|
29
28
|
connection: z.ZodString;
|
|
30
29
|
}, z.core.$strip>;
|
|
30
|
+
/**
|
|
31
|
+
* WHOEVER HELD A CAPABILITY acted — a link share, a claim link (#1672).
|
|
32
|
+
*
|
|
33
|
+
* The fourth member, and a member rather than a principal for #97's reason: the
|
|
34
|
+
* person holding a link is nobody the checker knows, and recording them as a
|
|
35
|
+
* principal would put a person in the trail who does not exist. The id names the
|
|
36
|
+
* capability's directory row, which says who minted it, for what, and until when —
|
|
37
|
+
* so the trail can answer "reached through Anna's link" without inventing a guest.
|
|
38
|
+
*/
|
|
39
|
+
export declare const capabilityActor: z.ZodObject<{
|
|
40
|
+
capability: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
41
|
+
}, z.core.$strip>;
|
|
31
42
|
export declare const actor: z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">, z.ZodObject<{
|
|
32
43
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
33
44
|
}, z.core.$strip>, z.ZodObject<{
|
|
34
45
|
connection: z.ZodString;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
+
capability: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
35
48
|
}, z.core.$strip>]>;
|
|
36
49
|
export type Actor = z.infer<typeof actor>;
|
|
37
50
|
/**
|
|
@@ -78,6 +91,8 @@ export declare const domainEvent: z.ZodObject<{
|
|
|
78
91
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
79
92
|
}, z.core.$strip>, z.ZodObject<{
|
|
80
93
|
connection: z.ZodString;
|
|
94
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
+
capability: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
81
96
|
}, z.core.$strip>]>;
|
|
82
97
|
entity: z.ZodObject<{
|
|
83
98
|
entityType: z.ZodString;
|
|
@@ -132,7 +147,10 @@ export declare const timelineEntry: z.ZodObject<{
|
|
|
132
147
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
133
148
|
}, z.core.$strip>, z.ZodObject<{
|
|
134
149
|
connection: z.ZodString;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
capability: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
135
152
|
}, z.core.$strip>]>;
|
|
153
|
+
decodeError: z.ZodOptional<z.ZodString>;
|
|
136
154
|
}, z.core.$strip>;
|
|
137
155
|
export type TimelineEntry = z.infer<typeof timelineEntry>;
|
|
138
156
|
/**
|
|
@@ -165,7 +183,10 @@ export declare const historyEntry: z.ZodObject<{
|
|
|
165
183
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
166
184
|
}, z.core.$strip>, z.ZodObject<{
|
|
167
185
|
connection: z.ZodString;
|
|
186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
+
capability: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
168
188
|
}, z.core.$strip>]>;
|
|
189
|
+
decodeError: z.ZodOptional<z.ZodString>;
|
|
169
190
|
payload: z.ZodUnknown;
|
|
170
191
|
authorization: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
171
192
|
permission: z.core.$ZodBranded<z.ZodString, "PermissionKey", "out">;
|
|
@@ -216,7 +237,10 @@ export declare const causeChain: z.ZodObject<{
|
|
|
216
237
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
217
238
|
}, z.core.$strip>, z.ZodObject<{
|
|
218
239
|
connection: z.ZodString;
|
|
240
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
241
|
+
capability: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
219
242
|
}, z.core.$strip>]>;
|
|
243
|
+
decodeError: z.ZodOptional<z.ZodString>;
|
|
220
244
|
payload: z.ZodUnknown;
|
|
221
245
|
authorization: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
222
246
|
permission: z.core.$ZodBranded<z.ZodString, "PermissionKey", "out">;
|
|
@@ -261,8 +285,25 @@ export declare const deliveryState: z.ZodEnum<{
|
|
|
261
285
|
retrying: "retrying";
|
|
262
286
|
}>;
|
|
263
287
|
export type DeliveryState = z.infer<typeof deliveryState>;
|
|
288
|
+
/**
|
|
289
|
+
* Who a delivery row belongs to (#1643): a module id, or `executor:<id>` for an executor.
|
|
290
|
+
*
|
|
291
|
+
* `_substrat_deliveries.consumer_module` holds both, and the contract typed it as a bare
|
|
292
|
+
* `ModuleId` — which a decode cannot honour, since `executor:mailer` is not one (the colon).
|
|
293
|
+
* The cast hid that; a decode against `moduleId` would have thrown on every healthy executor
|
|
294
|
+
* row. So the schema names the two shapes the column holds. The inferred type is unchanged
|
|
295
|
+
* (`ModuleId`), and every value the old one accepted is still accepted.
|
|
296
|
+
*
|
|
297
|
+
* The `executor:` branch matches the WRITER, not a tidier id. `registerExecutor` and
|
|
298
|
+
* `registerConnector` accept any string (`scope-host.ts`) and both adapters persist
|
|
299
|
+
* `executor:${id}`, so the kernel can itself write `executor:` with an empty id, or one with a
|
|
300
|
+
* newline. A reader that refused those would throw the whole dead-letter page or effects walk on
|
|
301
|
+
* a healthy delivery. It accepts whatever registration could have produced; tightening
|
|
302
|
+
* registration is a contract change, and #1645 carries it.
|
|
303
|
+
*/
|
|
304
|
+
export declare const deliveryConsumer: z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "ModuleId", "out">, z.core.$ZodBranded<z.ZodString, "ModuleId", "out">]>;
|
|
264
305
|
export declare const eventDelivery: z.ZodObject<{
|
|
265
|
-
consumer: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
306
|
+
consumer: z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "ModuleId", "out">, z.core.$ZodBranded<z.ZodString, "ModuleId", "out">]>;
|
|
266
307
|
state: z.ZodEnum<{
|
|
267
308
|
dead: "dead";
|
|
268
309
|
delivered: "delivered";
|
|
@@ -271,6 +312,8 @@ export declare const eventDelivery: z.ZodObject<{
|
|
|
271
312
|
at: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
272
313
|
error: z.ZodNullable<z.ZodString>;
|
|
273
314
|
attempts: z.ZodNumber;
|
|
315
|
+
invocationId: z.ZodNullable<z.ZodString>;
|
|
316
|
+
decodeError: z.ZodOptional<z.ZodString>;
|
|
274
317
|
}, z.core.$strip>;
|
|
275
318
|
export type EventDelivery = z.infer<typeof eventDelivery>;
|
|
276
319
|
/**
|
|
@@ -337,25 +380,23 @@ export interface InvocationEvents {
|
|
|
337
380
|
* No payload, deliberately. The envelope is enough to open the event's own reads, and a
|
|
338
381
|
* list that decoded every payload would be a disclosure decision per row.
|
|
339
382
|
*/
|
|
340
|
-
export
|
|
341
|
-
eventId: EventId
|
|
342
|
-
eventType:
|
|
343
|
-
occurredAt: Instant
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
attempts: number;
|
|
358
|
-
}
|
|
383
|
+
export declare const deadLetter: z.ZodObject<{
|
|
384
|
+
eventId: z.core.$ZodBranded<z.ZodString, "EventId", "out">;
|
|
385
|
+
eventType: z.ZodString;
|
|
386
|
+
occurredAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
387
|
+
entity: z.ZodObject<{
|
|
388
|
+
entityType: z.ZodString;
|
|
389
|
+
entityId: z.ZodString;
|
|
390
|
+
}, z.core.$strip>;
|
|
391
|
+
invocationId: z.ZodNullable<z.ZodString>;
|
|
392
|
+
attemptInvocationId: z.ZodNullable<z.ZodString>;
|
|
393
|
+
consumer: z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "ModuleId", "out">, z.core.$ZodBranded<z.ZodString, "ModuleId", "out">]>;
|
|
394
|
+
at: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
395
|
+
error: z.ZodString;
|
|
396
|
+
attempts: z.ZodNumber;
|
|
397
|
+
decodeError: z.ZodOptional<z.ZodString>;
|
|
398
|
+
}, z.core.$strip>;
|
|
399
|
+
export type DeadLetter = z.infer<typeof deadLetter>;
|
|
359
400
|
/**
|
|
360
401
|
* One event as it leaves the scope for Tier 2 (#1334) — the exact-history lake
|
|
361
402
|
* the master plan commits to (§5.3: "domain events → Pipelines → Iceberg on R2").
|
|
@@ -392,6 +433,8 @@ export declare const drainedEvent: z.ZodObject<{
|
|
|
392
433
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
393
434
|
}, z.core.$strip>, z.ZodObject<{
|
|
394
435
|
connection: z.ZodString;
|
|
436
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
437
|
+
capability: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
395
438
|
}, z.core.$strip>]>;
|
|
396
439
|
entity: z.ZodObject<{
|
|
397
440
|
entityType: z.ZodString;
|
|
@@ -440,8 +483,23 @@ export type DrainedEvent = z.infer<typeof drainedEvent>;
|
|
|
440
483
|
* not, and the final 0 is the only proof the window is exhausted.
|
|
441
484
|
*/
|
|
442
485
|
export declare const REDRAIN_BATCH = 5000;
|
|
486
|
+
/**
|
|
487
|
+
* `countOnly` (#1545): answer how many rows the window holds and reopen NOTHING.
|
|
488
|
+
*
|
|
489
|
+
* Optional, and absent means the reopen this verb has always performed — so every caller
|
|
490
|
+
* written before it keeps its behaviour. It exists because a dry run had no way to ask the
|
|
491
|
+
* one question it is run to answer: `redrainEvents` only ever reopened, so a caller could
|
|
492
|
+
* either learn the number by changing the rows or learn nothing. `pnpm lake:redrain
|
|
493
|
+
* --dry-run` was the honest version of the second.
|
|
494
|
+
*
|
|
495
|
+
* A count is UNBOUNDED where the reopen is batched at `REDRAIN_BATCH`: an aggregate
|
|
496
|
+
* materialises no rows, so the Durable-Object request budget that forces the batch does not
|
|
497
|
+
* apply. It therefore answers for the WHOLE window in one call — which is also why it is not
|
|
498
|
+
* comparable to a single reopen call's return value, only to the sum of the loop.
|
|
499
|
+
*/
|
|
443
500
|
export declare const redrainEventsInput: z.ZodObject<{
|
|
444
501
|
drainedBefore: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
502
|
+
countOnly: z.ZodOptional<z.ZodBoolean>;
|
|
445
503
|
}, z.core.$strip>;
|
|
446
504
|
export type RedrainEventsInput = z.infer<typeof redrainEventsInput>;
|
|
447
505
|
//# sourceMappingURL=events.d.ts.map
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,SAAS;;;iBAGpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAIlD,eAAO,MAAM,QAAQ;;;;EAA6C,CAAC;AACnE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,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,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2CG,CAAC;AAC7B,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;GAOG;AACH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,OAAQ,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB;;;iBAA0E,CAAC;AAC1G,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/dist/events.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { dataSubjectId, eventId, instant, moduleId, permissionKey, principalId, scopeId, tenantId, } from './ids.js';
|
|
2
|
+
import { capabilityId, dataSubjectId, eventId, instant, moduleId, permissionKey, principalId, scopeId, tenantId, } from './ids.js';
|
|
3
3
|
import { impersonationStamp } from './impersonation.js';
|
|
4
4
|
// Opaque ref — the kernel owns no entities (D-1); attachment contracts bind here.
|
|
5
5
|
export const entityRef = z.object({
|
|
@@ -23,7 +23,17 @@ export const systemActor = z.object({ system: moduleId });
|
|
|
23
23
|
* who did not.
|
|
24
24
|
*/
|
|
25
25
|
export const connectorActor = z.object({ connection: z.string().min(1) });
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* WHOEVER HELD A CAPABILITY acted — a link share, a claim link (#1672).
|
|
28
|
+
*
|
|
29
|
+
* The fourth member, and a member rather than a principal for #97's reason: the
|
|
30
|
+
* person holding a link is nobody the checker knows, and recording them as a
|
|
31
|
+
* principal would put a person in the trail who does not exist. The id names the
|
|
32
|
+
* capability's directory row, which says who minted it, for what, and until when —
|
|
33
|
+
* so the trail can answer "reached through Anna's link" without inventing a guest.
|
|
34
|
+
*/
|
|
35
|
+
export const capabilityActor = z.object({ capability: capabilityId });
|
|
36
|
+
export const actor = z.union([principalId, systemActor, connectorActor, capabilityActor]);
|
|
27
37
|
/**
|
|
28
38
|
* What authorized a mutation (K-34). Each entry is a permission the emitting operation
|
|
29
39
|
* checked-and-passed; `grant` — present only when the allow resolved through a
|
|
@@ -137,6 +147,25 @@ export const timelineEntry = z.object({
|
|
|
137
147
|
type: eventType,
|
|
138
148
|
occurredAt: instant,
|
|
139
149
|
actor,
|
|
150
|
+
/**
|
|
151
|
+
* Why this entry could not be read whole (#1636). ABSENT on every row the kernel
|
|
152
|
+
* wrote, which is what "decoded whole" looks like, so a healthy page reads exactly
|
|
153
|
+
* as it did before.
|
|
154
|
+
*
|
|
155
|
+
* An entity's history is a LIST, and a strict decode let one row whose JSON would
|
|
156
|
+
* not parse throw for the whole page — and end a cause walk in an exception rather
|
|
157
|
+
* than at the link it could not read. So the read is tolerant and SAYS SO: every
|
|
158
|
+
* column that did not decode is named here, and its field comes back EMPTY rather
|
|
159
|
+
* than guessed at — `actor` as the self-naming `{ system: 'undecodable' }` marker,
|
|
160
|
+
* a JSON field as `null`. Every field still satisfies this schema; a row whose id,
|
|
161
|
+
* type, time or PII class does not is never returned as one of these at all.
|
|
162
|
+
*
|
|
163
|
+
* On a history entry this is what separates an undecodable `payload` from an
|
|
164
|
+
* ERASED one: both read `null`, and only an erasure is a fact about the event.
|
|
165
|
+
*
|
|
166
|
+
* Reachable without a forge: `importDump` replays a dump's rows verbatim.
|
|
167
|
+
*/
|
|
168
|
+
decodeError: z.string().min(1).optional(),
|
|
140
169
|
});
|
|
141
170
|
/**
|
|
142
171
|
* A timeline entry plus what a history VIEW needs — the second layer of #800.
|
|
@@ -249,6 +278,11 @@ export const causeTerminal = z.enum([
|
|
|
249
278
|
* A cause named an event this scope's outbox does not hold. Should not happen —
|
|
250
279
|
* the spine is append-only and never pruned — so it is reported rather than
|
|
251
280
|
* smoothed over: silently stopping here would look exactly like a complete chain.
|
|
281
|
+
*
|
|
282
|
+
* Also the ending when the last entry's cause could not be DECODED (#1636 — its
|
|
283
|
+
* `decodeError` names `caused_by` or `operation`): the trail cannot be followed
|
|
284
|
+
* further, and reading the undecodable cause as a null one would call a fragment
|
|
285
|
+
* a complete chain.
|
|
252
286
|
*/
|
|
253
287
|
'missing',
|
|
254
288
|
/**
|
|
@@ -288,15 +322,60 @@ export const deliveryState = z.enum([
|
|
|
288
322
|
/** Ran, threw, and will not be tried again. The failure stands. */
|
|
289
323
|
'dead',
|
|
290
324
|
]);
|
|
325
|
+
/**
|
|
326
|
+
* Who a delivery row belongs to (#1643): a module id, or `executor:<id>` for an executor.
|
|
327
|
+
*
|
|
328
|
+
* `_substrat_deliveries.consumer_module` holds both, and the contract typed it as a bare
|
|
329
|
+
* `ModuleId` — which a decode cannot honour, since `executor:mailer` is not one (the colon).
|
|
330
|
+
* The cast hid that; a decode against `moduleId` would have thrown on every healthy executor
|
|
331
|
+
* row. So the schema names the two shapes the column holds. The inferred type is unchanged
|
|
332
|
+
* (`ModuleId`), and every value the old one accepted is still accepted.
|
|
333
|
+
*
|
|
334
|
+
* The `executor:` branch matches the WRITER, not a tidier id. `registerExecutor` and
|
|
335
|
+
* `registerConnector` accept any string (`scope-host.ts`) and both adapters persist
|
|
336
|
+
* `executor:${id}`, so the kernel can itself write `executor:` with an empty id, or one with a
|
|
337
|
+
* newline. A reader that refused those would throw the whole dead-letter page or effects walk on
|
|
338
|
+
* a healthy delivery. It accepts whatever registration could have produced; tightening
|
|
339
|
+
* registration is a contract change, and #1645 carries it.
|
|
340
|
+
*/
|
|
341
|
+
export const deliveryConsumer = z.union([
|
|
342
|
+
moduleId,
|
|
343
|
+
z
|
|
344
|
+
.string()
|
|
345
|
+
.startsWith('executor:')
|
|
346
|
+
.brand(),
|
|
347
|
+
]);
|
|
291
348
|
export const eventDelivery = z.object({
|
|
292
|
-
/** The module whose consumer this row is about
|
|
293
|
-
consumer:
|
|
349
|
+
/** The module whose consumer this row is about — or `executor:<id>`, see `deliveryConsumer`. */
|
|
350
|
+
consumer: deliveryConsumer,
|
|
294
351
|
state: deliveryState,
|
|
295
352
|
/** Delivered: when. Retrying or dead: when it was last attempted. */
|
|
296
353
|
at: instant,
|
|
297
354
|
/** The thrown message, for a row that is not `delivered`. */
|
|
298
355
|
error: z.string().nullable(),
|
|
299
356
|
attempts: z.number().int().nonnegative(),
|
|
357
|
+
/**
|
|
358
|
+
* The invocation the attempt `at` dates ran in (#1525), or null.
|
|
359
|
+
*
|
|
360
|
+
* NOT the event's — that one is on the outbox, and a delivery already joins to it
|
|
361
|
+
* through its event id. This is the call that attempted the DELIVERY, which for an
|
|
362
|
+
* executor is a different fact: attempt one runs in the emitting call's post-commit
|
|
363
|
+
* tail, and every retry after it in a drain that is another call or none. It moves
|
|
364
|
+
* with the row, like `at`, `error` and `attempts`, so it describes the latest
|
|
365
|
+
* attempt rather than the first.
|
|
366
|
+
*
|
|
367
|
+
* Null is two facts, as ever: the attempt carried no call (a scheduled drain, an
|
|
368
|
+
* alarm, a seed, an attachment RPC), or the row predates the column.
|
|
369
|
+
*/
|
|
370
|
+
invocationId: z.string().nullable(),
|
|
371
|
+
/**
|
|
372
|
+
* Why this delivery could not be read whole (#1643). ABSENT on every row the kernel
|
|
373
|
+
* wrote. A nullable column that broke its schema reads as `null` beside this reason;
|
|
374
|
+
* `state` is resolved from the stored `next_attempt_at` and `error`, so it stays the
|
|
375
|
+
* fact even when `error` itself did not decode. A row whose consumer, time or
|
|
376
|
+
* `attempts` does not decode is never returned as one of these at all.
|
|
377
|
+
*/
|
|
378
|
+
decodeError: z.string().min(1).optional(),
|
|
300
379
|
});
|
|
301
380
|
/** How far the forward walk got, with the same care as `causeTerminal`. */
|
|
302
381
|
export const effectsTerminal = z.enum([
|
|
@@ -313,6 +392,62 @@ export const effectsTerminal = z.enum([
|
|
|
313
392
|
*/
|
|
314
393
|
'cycle',
|
|
315
394
|
]);
|
|
395
|
+
/**
|
|
396
|
+
* One delivery that gave up (#1525), with enough of its event to find it again —
|
|
397
|
+
* `readDeadLetters`' entry.
|
|
398
|
+
*
|
|
399
|
+
* The scope-wide read `walkEventEffects` could not be: that walk reaches a delivery
|
|
400
|
+
* only THROUGH its event, so a dead letter was visible only to someone who already knew
|
|
401
|
+
* which record to open. An in-scope consumer does not retry, so one failure is terminal
|
|
402
|
+
* and these rows wait for a human.
|
|
403
|
+
*
|
|
404
|
+
* No payload, deliberately. The envelope is enough to open the event's own reads, and a
|
|
405
|
+
* list that decoded every payload would be a disclosure decision per row.
|
|
406
|
+
*/
|
|
407
|
+
export const deadLetter = z.object({
|
|
408
|
+
eventId,
|
|
409
|
+
eventType,
|
|
410
|
+
occurredAt: instant,
|
|
411
|
+
/** The entity the event was about — what a reader opens next. */
|
|
412
|
+
entity: entityRef,
|
|
413
|
+
/**
|
|
414
|
+
* The call the EVENT came from (#1237). Null for a seed or internal call, or an
|
|
415
|
+
* event older than the column.
|
|
416
|
+
*
|
|
417
|
+
* It is not, in general, the call that attempted the delivery — see
|
|
418
|
+
* `attemptInvocationId`, which is. This one said it was until #1525 put the
|
|
419
|
+
* delivery's own id beside it, and the rows in this very list are where the two
|
|
420
|
+
* come apart most often.
|
|
421
|
+
*/
|
|
422
|
+
invocationId: z.string().nullable(),
|
|
423
|
+
/**
|
|
424
|
+
* The call the LAST attempt ran in (#1525) — the one that gave up, since these rows
|
|
425
|
+
* are terminal. Pairs with `at`, which is when that attempt happened.
|
|
426
|
+
*
|
|
427
|
+
* Usually NOT `invocationId`: an executor's first attempt runs in the emitting
|
|
428
|
+
* call's post-commit tail, and every retry after it in a drain that is a different
|
|
429
|
+
* call or none. A row that exhausted its attempts therefore most often names a
|
|
430
|
+
* later call, or null. An in-scope consumer does not retry, so for those two the
|
|
431
|
+
* ids do agree — and that agreement is a fact about consumers, not a rule.
|
|
432
|
+
*
|
|
433
|
+
* Null is two facts: the attempt carried no call (a drain, an alarm, a seed), or
|
|
434
|
+
* the row predates the column.
|
|
435
|
+
*/
|
|
436
|
+
attemptInvocationId: z.string().nullable(),
|
|
437
|
+
/** The consumer that gave up — a module id, or `executor:<id>` for an executor. */
|
|
438
|
+
consumer: deliveryConsumer,
|
|
439
|
+
/** When it was last attempted, which for a dead row is when it gave up. */
|
|
440
|
+
at: instant,
|
|
441
|
+
error: z.string(),
|
|
442
|
+
attempts: z.number().int().nonnegative(),
|
|
443
|
+
/**
|
|
444
|
+
* Why this row could not be read whole (#1643). ABSENT on every row the kernel wrote.
|
|
445
|
+
* Only the two invocation ids are nullable columns, so those are what can come back
|
|
446
|
+
* `null` beside this reason; a row whose event id, type, time, entity, consumer, error
|
|
447
|
+
* or `attempts` does not decode is never returned as one of these at all.
|
|
448
|
+
*/
|
|
449
|
+
decodeError: z.string().min(1).optional(),
|
|
450
|
+
});
|
|
316
451
|
/**
|
|
317
452
|
* One event as it leaves the scope for Tier 2 (#1334) — the exact-history lake
|
|
318
453
|
* the master plan commits to (§5.3: "domain events → Pipelines → Iceberg on R2").
|
|
@@ -410,5 +545,19 @@ export const drainedEvent = domainEventShape
|
|
|
410
545
|
* not, and the final 0 is the only proof the window is exhausted.
|
|
411
546
|
*/
|
|
412
547
|
export const REDRAIN_BATCH = 5_000;
|
|
413
|
-
|
|
548
|
+
/**
|
|
549
|
+
* `countOnly` (#1545): answer how many rows the window holds and reopen NOTHING.
|
|
550
|
+
*
|
|
551
|
+
* Optional, and absent means the reopen this verb has always performed — so every caller
|
|
552
|
+
* written before it keeps its behaviour. It exists because a dry run had no way to ask the
|
|
553
|
+
* one question it is run to answer: `redrainEvents` only ever reopened, so a caller could
|
|
554
|
+
* either learn the number by changing the rows or learn nothing. `pnpm lake:redrain
|
|
555
|
+
* --dry-run` was the honest version of the second.
|
|
556
|
+
*
|
|
557
|
+
* A count is UNBOUNDED where the reopen is batched at `REDRAIN_BATCH`: an aggregate
|
|
558
|
+
* materialises no rows, so the Durable-Object request budget that forces the batch does not
|
|
559
|
+
* apply. It therefore answers for the WHOLE window in one call — which is also why it is not
|
|
560
|
+
* comparable to a single reopen call's return value, only to the sum of the loop.
|
|
561
|
+
*/
|
|
562
|
+
export const redrainEventsInput = z.object({ drainedBefore: instant, countOnly: z.boolean().optional() });
|
|
414
563
|
//# sourceMappingURL=events.js.map
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,aAAa,EACb,WAAW,EACX,OAAO,EACP,QAAQ,GAIT,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,kFAAkF;AAClF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC;AAGH,0EAA0E;AAC1E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGnE,4CAA4C;AAC5C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC1D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,C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AAa,GAAG,KAAK,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC"}
|
package/dist/ids.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare const platformRequestId: z.core.$ZodBranded<z.ZodString, "Platfor
|
|
|
15
15
|
export type PlatformRequestId = z.infer<typeof platformRequestId>;
|
|
16
16
|
export declare const dataSubjectId: z.core.$ZodBranded<z.ZodString, "DataSubjectId", "out">;
|
|
17
17
|
export type DataSubjectId = z.infer<typeof dataSubjectId>;
|
|
18
|
+
export declare const capabilityId: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
19
|
+
export type CapabilityId = z.infer<typeof capabilityId>;
|
|
18
20
|
export declare const moduleId: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
19
21
|
export type ModuleId = z.infer<typeof moduleId>;
|
|
20
22
|
/**
|
|
@@ -57,6 +59,16 @@ export type Instant = z.infer<typeof instant>;
|
|
|
57
59
|
*/
|
|
58
60
|
export declare const calendarDate: z.ZodISODate;
|
|
59
61
|
export type CalendarDate = z.infer<typeof calendarDate>;
|
|
62
|
+
/**
|
|
63
|
+
* The longest permission key, in bytes (#1655). Not a style choice: the checker finds
|
|
64
|
+
* a subject's grants with `relation LIKE 'granted:<key>%'`, and a Durable Object's
|
|
65
|
+
* SQLite refuses any LIKE pattern over 50 bytes — node's allows 50 000, so no node
|
|
66
|
+
* suite can see it. `granted:` is 8 bytes and `%` is 1, leaving 41. A longer key would
|
|
67
|
+
* parse, deploy, and then make every check of it throw on a hosted scope. The key
|
|
68
|
+
* alphabet is ASCII, so characters are bytes; it has no `_` or `%`, so it needs no
|
|
69
|
+
* escaping inside the pattern either.
|
|
70
|
+
*/
|
|
71
|
+
export declare const PERMISSION_KEY_MAX_LENGTH = 41;
|
|
60
72
|
export declare const permissionKey: z.core.$ZodBranded<z.ZodString, "PermissionKey", "out">;
|
|
61
73
|
export type PermissionKey = z.infer<typeof permissionKey>;
|
|
62
74
|
export declare const slug: z.ZodString;
|
package/dist/ids.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,QAAQ,oDAA6C,CAAC;AACnE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,OAAO,mDAA4C,CAAC;AACjE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C,eAAO,MAAM,WAAW,uDAAgD,CAAC;AACzE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAMtD,eAAO,MAAM,KAAK,iDAA0C,CAAC;AAC7D,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAK1C,eAAO,MAAM,eAAe,2DAAoD,CAAC;AACjF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,OAAO,mDAA4C,CAAC;AACjE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAK9C,eAAO,MAAM,iBAAiB,6DAAsD,CAAC;AACrF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,aAAa,yDAAkD,CAAC;AAC7E,MAAM,MAAM,aAAa,G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,YAAY,CAAC,CAAC;AAGxD,eAAO,MAAM,QAAQ,oDAGC,CAAC;AACvB,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,OAAO,mDAOC,CAAC;AACtB,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,cAAe,CAAC;AACzC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAG5C,eAAO,MAAM,aAAa,yDAIC,CAAC;AAC5B,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,eAAO,MAAM,IAAI,aAAwD,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,aAEwD,CAAC"}
|
package/dist/ids.js
CHANGED
|
@@ -21,6 +21,12 @@ export const eventId = z.string().regex(ULID).brand();
|
|
|
21
21
|
// other id so a request id can't be confused with an event or scope id.
|
|
22
22
|
export const platformRequestId = z.string().regex(ULID).brand();
|
|
23
23
|
export const dataSubjectId = z.string().regex(ULID).brand();
|
|
24
|
+
// A capability (#1672) — authority carried by a secret rather than held by a principal:
|
|
25
|
+
// "anyone with this link may read this folder until Friday". Branded distinctly from
|
|
26
|
+
// PrincipalId for the reason PlatformActorId is: whoever holds the link is not a person
|
|
27
|
+
// the checker knows, and an audit view that showed one as a principal would be lying.
|
|
28
|
+
// The id names the directory row; the SECRET is a separate value only its hash is kept of.
|
|
29
|
+
export const capabilityId = z.string().regex(ULID).brand();
|
|
24
30
|
// npm-package-shaped, e.g. '@substrat-run/engine-workorder'
|
|
25
31
|
export const moduleId = z
|
|
26
32
|
.string()
|
|
@@ -71,10 +77,21 @@ export const instant = z
|
|
|
71
77
|
* field it already exposes without changing any caller's type.
|
|
72
78
|
*/
|
|
73
79
|
export const calendarDate = z.iso.date();
|
|
80
|
+
/**
|
|
81
|
+
* The longest permission key, in bytes (#1655). Not a style choice: the checker finds
|
|
82
|
+
* a subject's grants with `relation LIKE 'granted:<key>%'`, and a Durable Object's
|
|
83
|
+
* SQLite refuses any LIKE pattern over 50 bytes — node's allows 50 000, so no node
|
|
84
|
+
* suite can see it. `granted:` is 8 bytes and `%` is 1, leaving 41. A longer key would
|
|
85
|
+
* parse, deploy, and then make every check of it throw on a hosted scope. The key
|
|
86
|
+
* alphabet is ASCII, so characters are bytes; it has no `_` or `%`, so it needs no
|
|
87
|
+
* escaping inside the pattern either.
|
|
88
|
+
*/
|
|
89
|
+
export const PERMISSION_KEY_MAX_LENGTH = 41;
|
|
74
90
|
// Module-namespaced permission key, e.g. 'workorder:create'
|
|
75
91
|
export const permissionKey = z
|
|
76
92
|
.string()
|
|
77
93
|
.regex(/^[a-z0-9-]+:[a-z0-9-]+$/)
|
|
94
|
+
.max(PERMISSION_KEY_MAX_LENGTH)
|
|
78
95
|
.brand();
|
|
79
96
|
export const slug = z.string().regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/);
|
|
80
97
|
/**
|
package/dist/ids.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oFAAoF;AACpF,oFAAoF;AACpF,oEAAoE;AAEpE,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAExC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAc,CAAC;AAGnE,MAAM,CAAC,MAAM,OAAO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AM,EAAE,IAAI,EAAE,CAAC;KAC1B,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;IACf,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAC3D,CAAC,CAAC;KACD,KAAK,EAAa,CAAC;AAGtB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AAGzC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,KAAK,CAAC,yBAAyB,CAAC;KAChC,GAAG,CAAC,yBAAyB,CAAC;KAC9B,KAAK,EAAmB,CAAC;AAG5B,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,KAAK,CAAC,uEAAuE,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export * from './control-plane.js';
|
|
|
31
31
|
export * from './permission.js';
|
|
32
32
|
export * from './impersonation.js';
|
|
33
33
|
export * from './events.js';
|
|
34
|
+
export * from './capability.js';
|
|
34
35
|
export * from './errors.js';
|
|
35
36
|
export * from './platform-request.js';
|
|
36
37
|
export * from './denial.js';
|
|
@@ -47,4 +48,5 @@ export * from './client-context.js';
|
|
|
47
48
|
export * from './model-usage.js';
|
|
48
49
|
export * from './seam.js';
|
|
49
50
|
export * from './signals.js';
|
|
51
|
+
export * from './mcp.js';
|
|
50
52
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cA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