@listen-fire/engine-contracts 0.15.1 → 0.15.3

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.
@@ -0,0 +1,12 @@
1
+ import type { ActorIdentity } from './adapter';
2
+ export declare const ACTOR_FIELDS: readonly ["Id", "Email", "Domain", "Phone", "Name", "Proven"];
3
+ export interface NormalisedActor {
4
+ Id: string;
5
+ Email?: string;
6
+ Domain?: string;
7
+ Phone?: string;
8
+ Name?: string;
9
+ Proven: boolean;
10
+ }
11
+ /** `null` when the identity names nobody: a field that may be absent is better than an empty one a filter could match. */
12
+ export declare function normalisedActor(identity: ActorIdentity): NormalisedActor | null;
package/dist/actor.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ACTOR_FIELDS = void 0;
4
+ exports.normalisedActor = normalisedActor;
5
+ exports.ACTOR_FIELDS = ['Id', 'Email', 'Domain', 'Phone', 'Name', 'Proven'];
6
+ // The characters trimmed, named in docs/contracts/actor-field.md because
7
+ // `String.prototype.trim` and Rust's `str::trim` differ on U+FEFF and U+0085.
8
+ const TRIMMED = '\\t-\\r \\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff';
9
+ const TRIMMED_ENDS = new RegExp(`^[${TRIMMED}]+|[${TRIMMED}]+$`, 'g');
10
+ const trimmed = (text) => text.replace(TRIMMED_ENDS, '');
11
+ /** `null` when the identity names nobody: a field that may be absent is better than an empty one a filter could match. */
12
+ function normalisedActor(identity) {
13
+ if (trimmed(identity.identifier) === '')
14
+ return null;
15
+ const actor = { Id: identity.identifier, Proven: identity.proven === true };
16
+ // The address is `email`, else the identifier of an `email` identity ([Who acted]).
17
+ const given = identity.email ?? (identity.scheme === 'email' ? identity.identifier : undefined);
18
+ const address = given === undefined ? undefined : trimmed(given).toLowerCase();
19
+ if (address !== undefined && address !== '') {
20
+ actor.Email = address;
21
+ // The last `@`, so `a@x.com.evil.com` can never read as `x.com`.
22
+ const at = address.lastIndexOf('@');
23
+ if (at !== -1 && at < address.length - 1)
24
+ actor.Domain = address.slice(at + 1);
25
+ }
26
+ if (identity.scheme === 'phone') {
27
+ const digits = identity.identifier.replace(/\D/g, '');
28
+ if (digits !== '')
29
+ actor.Phone = digits;
30
+ }
31
+ const name = identity.name ?? identity.label;
32
+ if (name !== undefined && name !== '')
33
+ actor.Name = name;
34
+ return actor;
35
+ }
package/dist/adapter.d.ts CHANGED
@@ -66,6 +66,10 @@ export interface ActorIdentity {
66
66
  name?: string;
67
67
  /** Fallback display label when `name` isn't available. */
68
68
  label?: string;
69
+ /** True when the module checked that the source system vouches for this
70
+ * identity (a verified address, a signed request). Absent reads as not
71
+ * proven: it is a claim only the module can make. */
72
+ proven?: boolean;
69
73
  }
70
74
  /**
71
75
  * An ordered actor candidate parsed from an inbound event by the adapter's
@@ -63,6 +63,7 @@ declare const runInputSchema: z.ZodObject<{
63
63
  email?: string | undefined;
64
64
  name?: string | undefined;
65
65
  label?: string | undefined;
66
+ proven?: boolean | undefined;
66
67
  } | undefined;
67
68
  } | undefined;
68
69
  }, {
@@ -113,6 +114,7 @@ declare const runInputSchema: z.ZodObject<{
113
114
  email?: string | undefined;
114
115
  name?: string | undefined;
115
116
  label?: string | undefined;
117
+ proven?: boolean | undefined;
116
118
  } | undefined;
117
119
  } | undefined;
118
120
  }>;
@@ -188,6 +190,7 @@ declare const resumeInputSchema: z.ZodObject<{
188
190
  email?: string | undefined;
189
191
  name?: string | undefined;
190
192
  label?: string | undefined;
193
+ proven?: boolean | undefined;
191
194
  } | undefined;
192
195
  } | undefined;
193
196
  }, {
@@ -238,6 +241,7 @@ declare const resumeInputSchema: z.ZodObject<{
238
241
  email?: string | undefined;
239
242
  name?: string | undefined;
240
243
  label?: string | undefined;
244
+ proven?: boolean | undefined;
241
245
  } | undefined;
242
246
  } | undefined;
243
247
  }>;
@@ -363,6 +367,7 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
363
367
  email?: string | undefined;
364
368
  name?: string | undefined;
365
369
  label?: string | undefined;
370
+ proven?: boolean | undefined;
366
371
  } | undefined;
367
372
  } | undefined;
368
373
  }, {
@@ -413,6 +418,7 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
413
418
  email?: string | undefined;
414
419
  name?: string | undefined;
415
420
  label?: string | undefined;
421
+ proven?: boolean | undefined;
416
422
  } | undefined;
417
423
  } | undefined;
418
424
  }>;
@@ -516,6 +522,7 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
516
522
  email?: string | undefined;
517
523
  name?: string | undefined;
518
524
  label?: string | undefined;
525
+ proven?: boolean | undefined;
519
526
  } | undefined;
520
527
  } | undefined;
521
528
  }, {
@@ -566,6 +573,7 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
566
573
  email?: string | undefined;
567
574
  name?: string | undefined;
568
575
  label?: string | undefined;
576
+ proven?: boolean | undefined;
569
577
  } | undefined;
570
578
  } | undefined;
571
579
  }>;
@@ -677,6 +685,7 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
677
685
  email?: string | undefined;
678
686
  name?: string | undefined;
679
687
  label?: string | undefined;
688
+ proven?: boolean | undefined;
680
689
  } | undefined;
681
690
  } | undefined;
682
691
  }, {
@@ -727,6 +736,7 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
727
736
  email?: string | undefined;
728
737
  name?: string | undefined;
729
738
  label?: string | undefined;
739
+ proven?: boolean | undefined;
730
740
  } | undefined;
731
741
  } | undefined;
732
742
  }>;
package/dist/event.d.ts CHANGED
@@ -109,6 +109,7 @@ export declare const triggerEventSchema: z.ZodObject<{
109
109
  email: z.ZodOptional<z.ZodString>;
110
110
  name: z.ZodOptional<z.ZodString>;
111
111
  label: z.ZodOptional<z.ZodString>;
112
+ proven: z.ZodOptional<z.ZodBoolean>;
112
113
  }, z.core.$strip>>;
113
114
  }, z.core.$strip>>;
114
115
  }, z.core.$strip>;
package/dist/event.js CHANGED
@@ -34,6 +34,7 @@ const firedActorSchema = zod_1.z.object({
34
34
  email: zod_1.z.string().optional(),
35
35
  name: zod_1.z.string().optional(),
36
36
  label: zod_1.z.string().optional(),
37
+ proven: zod_1.z.boolean().optional(),
37
38
  });
38
39
  /** The source system's identifier for the record an inbound event is about. */
39
40
  exports.inboundRecordRefSchema = zod_1.z.object({
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export type { AdapterSnapshot, CatalogSnapshot, LanguageVersion } from '@listen-fire/movement-lang';
2
+ export * from './actor';
2
3
  export * from './adapter';
3
4
  export * from './arrivals';
4
5
  export * from './catalog';
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.RelatedPage = void 0;
28
+ __exportStar(require("./actor"), exports);
28
29
  __exportStar(require("./adapter"), exports);
29
30
  __exportStar(require("./arrivals"), exports);
30
31
  __exportStar(require("./catalog"), exports);
@@ -12,7 +12,7 @@ export declare const ADAPTER_TEAM_HEADER = "x-listen-fire-team";
12
12
  export declare const MANIFEST_PROTOCOL_VERSION = 2;
13
13
  /** The highest minor of version 2 this release speaks: a host reads 2.0 to
14
14
  * 2.`PROTOCOL_MINOR` (docs/contracts/adapter-protocol.md "Minors of version 2"). */
15
- export declare const PROTOCOL_MINOR = 7;
15
+ export declare const PROTOCOL_MINOR = 9;
16
16
  /** The method that names a minor's feature, by name or by its ending
17
17
  * (`<slot>.watch`). Data, so the Rust twin (module-wire
18
18
  * `envelope::PROTOCOL_MINORS`) is test-held equal to it. */
@@ -25,7 +25,9 @@ export type ProtocolMinorUse = {
25
25
  * speaking the minor may call it; a module offering it needs nothing of an
26
26
  * older host, which never calls it, so offering one never raises the minor
27
27
  * a module states. A minor that names no method has no row: 2.0, 2.3
28
- * (labelled poll events) and 2.7 (`pollAgainAt`), each a host behaviour. */
28
+ * (labelled poll events), 2.7 (`pollAgainAt`), 2.8 (`hostRelease` on a
29
+ * slot request) and 2.9 (`proven` on an actor identity), each a host
30
+ * behaviour. */
29
31
  export declare const PROTOCOL_MINORS: readonly {
30
32
  minor: number;
31
33
  feature: string;
@@ -455,6 +457,7 @@ export declare const WireTriggerEvent: z.ZodObject<{
455
457
  email: z.ZodOptional<z.ZodString>;
456
458
  name: z.ZodOptional<z.ZodString>;
457
459
  label: z.ZodOptional<z.ZodString>;
460
+ proven: z.ZodOptional<z.ZodBoolean>;
458
461
  }, z.core.$strip>>>;
459
462
  }, z.core.$strip>>;
460
463
  }, z.core.$strip>;
@@ -683,6 +686,7 @@ export declare const WireActorIdentity: z.ZodObject<{
683
686
  email: z.ZodOptional<z.ZodString>;
684
687
  name: z.ZodOptional<z.ZodString>;
685
688
  label: z.ZodOptional<z.ZodString>;
689
+ proven: z.ZodOptional<z.ZodBoolean>;
686
690
  }, z.core.$strip>;
687
691
  /** Mirror of `ActorCandidate`. */
688
692
  export declare const WireActorCandidate: z.ZodObject<{
@@ -697,6 +701,7 @@ export declare const WireActorCandidate: z.ZodObject<{
697
701
  email: z.ZodOptional<z.ZodString>;
698
702
  name: z.ZodOptional<z.ZodString>;
699
703
  label: z.ZodOptional<z.ZodString>;
704
+ proven: z.ZodOptional<z.ZodBoolean>;
700
705
  }, z.core.$strip>;
701
706
  source: z.ZodEnum<{
702
707
  originator: "originator";
@@ -1364,6 +1369,7 @@ export declare const WireGetActorCandidatesInput: z.ZodObject<{
1364
1369
  email: z.ZodOptional<z.ZodString>;
1365
1370
  name: z.ZodOptional<z.ZodString>;
1366
1371
  label: z.ZodOptional<z.ZodString>;
1372
+ proven: z.ZodOptional<z.ZodBoolean>;
1367
1373
  }, z.core.$strip>>>;
1368
1374
  }, z.core.$strip>>;
1369
1375
  }, z.core.$strip>;
@@ -1436,6 +1442,7 @@ export declare const WireExtractActorInput: z.ZodObject<{
1436
1442
  email: z.ZodOptional<z.ZodString>;
1437
1443
  name: z.ZodOptional<z.ZodString>;
1438
1444
  label: z.ZodOptional<z.ZodString>;
1445
+ proven: z.ZodOptional<z.ZodBoolean>;
1439
1446
  }, z.core.$strip>>>;
1440
1447
  }, z.core.$strip>>;
1441
1448
  }, z.core.$strip>;
@@ -2323,6 +2330,7 @@ export declare const WireArrival: z.ZodUnion<readonly [z.ZodObject<{
2323
2330
  email: z.ZodOptional<z.ZodString>;
2324
2331
  name: z.ZodOptional<z.ZodString>;
2325
2332
  label: z.ZodOptional<z.ZodString>;
2333
+ proven: z.ZodOptional<z.ZodBoolean>;
2326
2334
  }, z.core.$strip>>;
2327
2335
  }, z.core.$strip>, z.ZodObject<{
2328
2336
  edge: z.ZodString;
@@ -2385,6 +2393,7 @@ export declare const WirePollEdgeResult: z.ZodObject<{
2385
2393
  email: z.ZodOptional<z.ZodString>;
2386
2394
  name: z.ZodOptional<z.ZodString>;
2387
2395
  label: z.ZodOptional<z.ZodString>;
2396
+ proven: z.ZodOptional<z.ZodBoolean>;
2388
2397
  }, z.core.$strip>>;
2389
2398
  }, z.core.$strip>, z.ZodObject<{
2390
2399
  edge: z.ZodString;
@@ -2437,6 +2446,7 @@ export declare const AdapterWakeBody: z.ZodObject<{
2437
2446
  email: z.ZodOptional<z.ZodString>;
2438
2447
  name: z.ZodOptional<z.ZodString>;
2439
2448
  label: z.ZodOptional<z.ZodString>;
2449
+ proven: z.ZodOptional<z.ZodBoolean>;
2440
2450
  }, z.core.$strip>>;
2441
2451
  }, z.core.$strip>, z.ZodObject<{
2442
2452
  edge: z.ZodString;
@@ -2530,6 +2540,7 @@ export declare const WireInboundCheck: z.ZodDiscriminatedUnion<[z.ZodObject<{
2530
2540
  email: z.ZodOptional<z.ZodString>;
2531
2541
  name: z.ZodOptional<z.ZodString>;
2532
2542
  label: z.ZodOptional<z.ZodString>;
2543
+ proven: z.ZodOptional<z.ZodBoolean>;
2533
2544
  }, z.core.$strip>>;
2534
2545
  }, z.core.$strip>, z.ZodObject<{
2535
2546
  edge: z.ZodString;
@@ -3780,6 +3791,7 @@ export declare const METHODS: {
3780
3791
  email: z.ZodOptional<z.ZodString>;
3781
3792
  name: z.ZodOptional<z.ZodString>;
3782
3793
  label: z.ZodOptional<z.ZodString>;
3794
+ proven: z.ZodOptional<z.ZodBoolean>;
3783
3795
  }, z.core.$strip>>;
3784
3796
  }, z.core.$strip>, z.ZodObject<{
3785
3797
  edge: z.ZodString;
@@ -4196,6 +4208,7 @@ export declare const METHODS: {
4196
4208
  email: z.ZodOptional<z.ZodString>;
4197
4209
  name: z.ZodOptional<z.ZodString>;
4198
4210
  label: z.ZodOptional<z.ZodString>;
4211
+ proven: z.ZodOptional<z.ZodBoolean>;
4199
4212
  }, z.core.$strip>>>;
4200
4213
  }, z.core.$strip>>;
4201
4214
  }, z.core.$strip>;
@@ -4212,6 +4225,7 @@ export declare const METHODS: {
4212
4225
  email: z.ZodOptional<z.ZodString>;
4213
4226
  name: z.ZodOptional<z.ZodString>;
4214
4227
  label: z.ZodOptional<z.ZodString>;
4228
+ proven: z.ZodOptional<z.ZodBoolean>;
4215
4229
  }, z.core.$strip>;
4216
4230
  source: z.ZodEnum<{
4217
4231
  originator: "originator";
@@ -4288,6 +4302,7 @@ export declare const METHODS: {
4288
4302
  email: z.ZodOptional<z.ZodString>;
4289
4303
  name: z.ZodOptional<z.ZodString>;
4290
4304
  label: z.ZodOptional<z.ZodString>;
4305
+ proven: z.ZodOptional<z.ZodBoolean>;
4291
4306
  }, z.core.$strip>>>;
4292
4307
  }, z.core.$strip>>;
4293
4308
  }, z.core.$strip>;
@@ -4303,6 +4318,7 @@ export declare const METHODS: {
4303
4318
  email: z.ZodOptional<z.ZodString>;
4304
4319
  name: z.ZodOptional<z.ZodString>;
4305
4320
  label: z.ZodOptional<z.ZodString>;
4321
+ proven: z.ZodOptional<z.ZodBoolean>;
4306
4322
  }, z.core.$strip>>;
4307
4323
  };
4308
4324
  readonly describeOpaqueId: {
@@ -4386,6 +4402,7 @@ export declare const METHODS: {
4386
4402
  email: z.ZodOptional<z.ZodString>;
4387
4403
  name: z.ZodOptional<z.ZodString>;
4388
4404
  label: z.ZodOptional<z.ZodString>;
4405
+ proven: z.ZodOptional<z.ZodBoolean>;
4389
4406
  }, z.core.$strip>>;
4390
4407
  }, z.core.$strip>, z.ZodObject<{
4391
4408
  edge: z.ZodString;
@@ -4475,6 +4492,7 @@ export declare const METHODS: {
4475
4492
  email: z.ZodOptional<z.ZodString>;
4476
4493
  name: z.ZodOptional<z.ZodString>;
4477
4494
  label: z.ZodOptional<z.ZodString>;
4495
+ proven: z.ZodOptional<z.ZodBoolean>;
4478
4496
  }, z.core.$strip>>;
4479
4497
  }, z.core.$strip>, z.ZodObject<{
4480
4498
  edge: z.ZodString;
package/dist/protocol.js CHANGED
@@ -42,12 +42,14 @@ exports.ADAPTER_TEAM_HEADER = 'x-listen-fire-team';
42
42
  exports.MANIFEST_PROTOCOL_VERSION = 2;
43
43
  /** The highest minor of version 2 this release speaks: a host reads 2.0 to
44
44
  * 2.`PROTOCOL_MINOR` (docs/contracts/adapter-protocol.md "Minors of version 2"). */
45
- exports.PROTOCOL_MINOR = 7;
45
+ exports.PROTOCOL_MINOR = 9;
46
46
  /** Each minor of version 2 whose hosts speak a method, and that method. A host
47
47
  * speaking the minor may call it; a module offering it needs nothing of an
48
48
  * older host, which never calls it, so offering one never raises the minor
49
49
  * a module states. A minor that names no method has no row: 2.0, 2.3
50
- * (labelled poll events) and 2.7 (`pollAgainAt`), each a host behaviour. */
50
+ * (labelled poll events), 2.7 (`pollAgainAt`), 2.8 (`hostRelease` on a
51
+ * slot request) and 2.9 (`proven` on an actor identity), each a host
52
+ * behaviour. */
51
53
  exports.PROTOCOL_MINORS = [
52
54
  { minor: 1, feature: 'a <slot>.watch method', uses: { methodEndingWith: '.watch' } },
53
55
  { minor: 2, feature: 'work.enqueueIfAbsent', uses: { method: 'work.enqueueIfAbsent' } },
@@ -436,6 +438,7 @@ exports.WireActorIdentity = zod_1.z.object({
436
438
  email: zod_1.z.string().optional(),
437
439
  name: zod_1.z.string().optional(),
438
440
  label: zod_1.z.string().optional(),
441
+ proven: zod_1.z.boolean().optional(),
439
442
  });
440
443
  /** Mirror of `ActorCandidate`. */
441
444
  exports.WireActorCandidate = zod_1.z.object({
@@ -5,6 +5,7 @@ export declare const SlotRequestEnvelope: z.ZodObject<{
5
5
  cacheScopeId: z.ZodOptional<z.ZodString>;
6
6
  params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
7
7
  settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
8
+ hostRelease: z.ZodOptional<z.ZodString>;
8
9
  }, z.core.$strip>;
9
10
  export declare const SlotError: z.ZodObject<{
10
11
  code: z.ZodString;
@@ -23,6 +23,11 @@ exports.SlotRequestEnvelope = zod_1.z.object({
23
23
  cacheScopeId: zod_1.z.string().optional(),
24
24
  params: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).default({}),
25
25
  settings: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
26
+ /** Adapter protocol 2.8: the release of the runner that sent the request
27
+ * (`"0.15.2"`), so a module serving runners of several releases answers
28
+ * each by its line. A request without it did not state its sender's
29
+ * release: a runner before 0.15.2, or a host or module that does not set it. */
30
+ hostRelease: zod_1.z.string().optional(),
26
31
  });
27
32
  exports.SlotError = zod_1.z.object({
28
33
  code: zod_1.z.string(),
@@ -47,7 +47,7 @@ export declare const CONTRACTS: {
47
47
  readonly current: 2;
48
48
  readonly supported: readonly [2];
49
49
  readonly deprecated: readonly [];
50
- readonly minor: 7;
50
+ readonly minor: 9;
51
51
  };
52
52
  readonly 'system-caller': {
53
53
  readonly current: 1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@listen-fire/engine-contracts",
3
3
  "license": "Apache-2.0",
4
- "version": "0.15.1",
4
+ "version": "0.15.3",
5
5
  "description": "The contracts the movement engine speaks: the tenant id, the host families and entry-point inputs, the parked state, file descriptors, the adapter protocol, the adapter contract and its manifest, the catalog's schema types and positions, the Expression vocabulary, plugins as data and the model names. Runtime-neutral: no Node import, no ambient types.",
6
6
  "engines": {
7
7
  "node": ">=22.23.4 <23"
@@ -30,7 +30,7 @@
30
30
  "type": "commonjs",
31
31
  "dependencies": {
32
32
  "zod": "4.1.12",
33
- "@listen-fire/movement-lang": "^0.15.1"
33
+ "@listen-fire/movement-lang": "^0.15.3"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.16.5",