@substrat-run/contracts 0.116.0 → 0.118.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/auth-delivery.d.ts +17 -0
- package/dist/auth-delivery.d.ts.map +1 -0
- package/dist/auth-delivery.js +17 -0
- package/dist/auth-delivery.js.map +1 -0
- 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 +116 -0
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +85 -2
- package/dist/control-plane.js.map +1 -1
- package/dist/denial.d.ts +15 -0
- package/dist/denial.d.ts.map +1 -1
- package/dist/denial.js +30 -0
- package/dist/denial.js.map +1 -1
- package/dist/events.d.ts +63 -39
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +125 -4
- 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 +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.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/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/places.d.ts +98 -0
- package/dist/places.d.ts.map +1 -0
- package/dist/places.js +103 -0
- package/dist/places.js.map +1 -0
- 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/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";
|
|
@@ -272,6 +313,7 @@ export declare const eventDelivery: z.ZodObject<{
|
|
|
272
313
|
error: z.ZodNullable<z.ZodString>;
|
|
273
314
|
attempts: z.ZodNumber;
|
|
274
315
|
invocationId: z.ZodNullable<z.ZodString>;
|
|
316
|
+
decodeError: z.ZodOptional<z.ZodString>;
|
|
275
317
|
}, z.core.$strip>;
|
|
276
318
|
export type EventDelivery = z.infer<typeof eventDelivery>;
|
|
277
319
|
/**
|
|
@@ -338,43 +380,23 @@ export interface InvocationEvents {
|
|
|
338
380
|
* No payload, deliberately. The envelope is enough to open the event's own reads, and a
|
|
339
381
|
* list that decoded every payload would be a disclosure decision per row.
|
|
340
382
|
*/
|
|
341
|
-
export
|
|
342
|
-
eventId: EventId
|
|
343
|
-
eventType:
|
|
344
|
-
occurredAt: Instant
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
* The call the LAST attempt ran in (#1525) — the one that gave up, since these rows
|
|
359
|
-
* are terminal. Pairs with `at`, which is when that attempt happened.
|
|
360
|
-
*
|
|
361
|
-
* Usually NOT `invocationId`: an executor's first attempt runs in the emitting
|
|
362
|
-
* call's post-commit tail, and every retry after it in a drain that is a different
|
|
363
|
-
* call or none. A row that exhausted its attempts therefore most often names a
|
|
364
|
-
* later call, or null. An in-scope consumer does not retry, so for those two the
|
|
365
|
-
* ids do agree — and that agreement is a fact about consumers, not a rule.
|
|
366
|
-
*
|
|
367
|
-
* Null is two facts: the attempt carried no call (a drain, an alarm, a seed), or
|
|
368
|
-
* the row predates the column.
|
|
369
|
-
*/
|
|
370
|
-
attemptInvocationId: string | null;
|
|
371
|
-
/** The consumer that gave up — a module id, or `executor:<id>` for an executor. */
|
|
372
|
-
consumer: ModuleId;
|
|
373
|
-
/** When it was last attempted, which for a dead row is when it gave up. */
|
|
374
|
-
at: Instant;
|
|
375
|
-
error: string;
|
|
376
|
-
attempts: number;
|
|
377
|
-
}
|
|
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>;
|
|
378
400
|
/**
|
|
379
401
|
* One event as it leaves the scope for Tier 2 (#1334) — the exact-history lake
|
|
380
402
|
* the master plan commits to (§5.3: "domain events → Pipelines → Iceberg on R2").
|
|
@@ -411,6 +433,8 @@ export declare const drainedEvent: z.ZodObject<{
|
|
|
411
433
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
412
434
|
}, z.core.$strip>, z.ZodObject<{
|
|
413
435
|
connection: z.ZodString;
|
|
436
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
437
|
+
capability: z.core.$ZodBranded<z.ZodString, "CapabilityId", "out">;
|
|
414
438
|
}, z.core.$strip>]>;
|
|
415
439
|
entity: z.ZodObject<{
|
|
416
440
|
entityType: z.ZodString;
|
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,CAAC;AAGhD,eAAO,MAAM,SAAS,aAA+C,CAAC;AAEtE,eAAO,MAAM,WAAW;;iBAAiC,CAAC;AAC1D;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;;iBAA8C,CAAC;AAC1E;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;iBAAyC,CAAC;AACtE,eAAO,MAAM,KAAK;;;;;;mBAAuE,CAAC;AAC1F,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB;;;iBAM7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAiBpE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;iBASD,CAAC;AAC7B,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
|
@@ -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,9 +322,32 @@ 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,
|
|
@@ -311,6 +368,14 @@ export const eventDelivery = z.object({
|
|
|
311
368
|
* alarm, a seed, an attachment RPC), or the row predates the column.
|
|
312
369
|
*/
|
|
313
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(),
|
|
314
379
|
});
|
|
315
380
|
/** How far the forward walk got, with the same care as `causeTerminal`. */
|
|
316
381
|
export const effectsTerminal = z.enum([
|
|
@@ -327,6 +392,62 @@ export const effectsTerminal = z.enum([
|
|
|
327
392
|
*/
|
|
328
393
|
'cycle',
|
|
329
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
|
+
});
|
|
330
451
|
/**
|
|
331
452
|
* One event as it leaves the scope for Tier 2 (#1334) — the exact-history lake
|
|
332
453
|
* the master plan commits to (§5.3: "domain events → Pipelines → Iceberg on R2").
|
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,E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QAAQ,EAAE;CAC1C,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,4EAA4E;AAC5E,4EAA4E;AAC5E,iFAAiF;AACjF,kFAAkF;AAClF,mFAAmF;AACnF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB;KACzC,MAAM,CAAC;IACN;;;;;;;;OAQG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACvC;;;;;;;;OAQG;IACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC;;;;;;;;;;;OAWG;IACH,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;IAC5B;;;;;OAKG;IACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC;KACD,WAAW,CAAC,YAAY,CAAC,CAAC;AAG7B;;;;;;;GAOG;AACH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,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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AAC;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,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAa,CAAC;AAGjE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAiB,CAAC;AAGzE,oFAAoF;AACpF,sFAAsF;AACtF,qFAAqF;AACrF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAW,CAAC;AAG7D,qFAAqF;AACrF,sFAAsF;AACtF,kEAAkE;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EA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D,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,7 @@ 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';
|
|
52
|
+
export * from './auth-delivery.js';
|
|
53
|
+
export * from './places.js';
|
|
50
54
|
//# 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,CA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AAc,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;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
|
package/dist/index.js
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,7 @@ 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';
|
|
52
|
+
export * from './auth-delivery.js';
|
|
53
|
+
export * from './places.js';
|
|
50
54
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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,c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7B,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;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A vertical's MCP endpoint, named the ONE way both of its ends name it (#1619).
|
|
3
|
+
*
|
|
4
|
+
* The endpoint `mountOperations` mounts is an OAuth protected resource, and its identifier
|
|
5
|
+
* is a string two parties have to agree on byte for byte. The vertical publishes it in its
|
|
6
|
+
* RFC 9728 document and holds a presented token to it (`aud`). The platform registers it
|
|
7
|
+
* at the vertical's issuer, which refuses to mint for any `resource` it has no row for
|
|
8
|
+
* (RFC 8707). If each side built the string itself, one would eventually add a trailing
|
|
9
|
+
* slash the other did not, and the only symptom would be `invalid_target` at a login that
|
|
10
|
+
* never renders.
|
|
11
|
+
*
|
|
12
|
+
* So both sides call these. `@substrat-run/vertical-host` uses them for the document and
|
|
13
|
+
* for the `aud` check. The dashboard uses them for the resources it registers, one per
|
|
14
|
+
* hostname the app answers on, because the identifier is the URL a client actually
|
|
15
|
+
* reached.
|
|
16
|
+
*/
|
|
17
|
+
/** Where the MCP endpoint lives under a vertical's API base path: `${basePath}/mcp`. */
|
|
18
|
+
export declare function mcpEndpointPath(basePath?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* The fleet's convention, `/api/mcp`, which is `mountOperations`' default. It is the only
|
|
21
|
+
* path the platform can register without asking the vertical, so a vertical that mounts
|
|
22
|
+
* the endpoint elsewhere (`mcp.path`) or pins a different `resource` is not covered by
|
|
23
|
+
* the platform's registration.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MCP_ENDPOINT_PATH: string;
|
|
26
|
+
/**
|
|
27
|
+
* An MCP endpoint's resource identifier: its own absolute URL on the origin a client
|
|
28
|
+
* reached it at. `origin` is `scheme://host[:port]` with no trailing slash, which is what
|
|
29
|
+
* `new URL(…).origin` returns.
|
|
30
|
+
*/
|
|
31
|
+
export declare function mcpResourceOf(origin: string, path?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* The delivered-config key through which the platform tells a team auth-server which MCP
|
|
34
|
+
* endpoints it may mint for: `${MCP_RESOURCES_CONFIG_PREFIX}<app scope id>`, whose value is
|
|
35
|
+
* that app's whole set as a JSON array of `mcpResourceOf` identifiers, or `""` for none.
|
|
36
|
+
* The dashboard writes it. `demos/auth-server/src/resources.ts` turns it into rows.
|
|
37
|
+
*/
|
|
38
|
+
export declare const MCP_RESOURCES_CONFIG_PREFIX = "substrat:resources:";
|
|
39
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,QAAQ,SAAS,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAoB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,MAA0B,GAAG,MAAM,CAEtF;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,wBAAwB,CAAC"}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A vertical's MCP endpoint, named the ONE way both of its ends name it (#1619).
|
|
3
|
+
*
|
|
4
|
+
* The endpoint `mountOperations` mounts is an OAuth protected resource, and its identifier
|
|
5
|
+
* is a string two parties have to agree on byte for byte. The vertical publishes it in its
|
|
6
|
+
* RFC 9728 document and holds a presented token to it (`aud`). The platform registers it
|
|
7
|
+
* at the vertical's issuer, which refuses to mint for any `resource` it has no row for
|
|
8
|
+
* (RFC 8707). If each side built the string itself, one would eventually add a trailing
|
|
9
|
+
* slash the other did not, and the only symptom would be `invalid_target` at a login that
|
|
10
|
+
* never renders.
|
|
11
|
+
*
|
|
12
|
+
* So both sides call these. `@substrat-run/vertical-host` uses them for the document and
|
|
13
|
+
* for the `aud` check. The dashboard uses them for the resources it registers, one per
|
|
14
|
+
* hostname the app answers on, because the identifier is the URL a client actually
|
|
15
|
+
* reached.
|
|
16
|
+
*/
|
|
17
|
+
/** Where the MCP endpoint lives under a vertical's API base path: `${basePath}/mcp`. */
|
|
18
|
+
export function mcpEndpointPath(basePath = '/api') {
|
|
19
|
+
return `${basePath}/mcp`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The fleet's convention, `/api/mcp`, which is `mountOperations`' default. It is the only
|
|
23
|
+
* path the platform can register without asking the vertical, so a vertical that mounts
|
|
24
|
+
* the endpoint elsewhere (`mcp.path`) or pins a different `resource` is not covered by
|
|
25
|
+
* the platform's registration.
|
|
26
|
+
*/
|
|
27
|
+
export const MCP_ENDPOINT_PATH = mcpEndpointPath();
|
|
28
|
+
/**
|
|
29
|
+
* An MCP endpoint's resource identifier: its own absolute URL on the origin a client
|
|
30
|
+
* reached it at. `origin` is `scheme://host[:port]` with no trailing slash, which is what
|
|
31
|
+
* `new URL(…).origin` returns.
|
|
32
|
+
*/
|
|
33
|
+
export function mcpResourceOf(origin, path = MCP_ENDPOINT_PATH) {
|
|
34
|
+
return `${origin}${path}`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The delivered-config key through which the platform tells a team auth-server which MCP
|
|
38
|
+
* endpoints it may mint for: `${MCP_RESOURCES_CONFIG_PREFIX}<app scope id>`, whose value is
|
|
39
|
+
* that app's whole set as a JSON array of `mcpResourceOf` identifiers, or `""` for none.
|
|
40
|
+
* The dashboard writes it. `demos/auth-server/src/resources.ts` turns it into rows.
|
|
41
|
+
*/
|
|
42
|
+
export const MCP_RESOURCES_CONFIG_PREFIX = 'substrat:resources:';
|
|
43
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wFAAwF;AACxF,MAAM,UAAU,eAAe,CAAC,QAAQ,GAAG,MAAM;IAC/C,OAAO,GAAG,QAAQ,MAAM,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,EAAE,CAAC;AAEnD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,IAAI,GAAW,iBAAiB;IAC5E,OAAO,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC"}
|