@listen-fire/engine-contracts 0.13.0 → 0.14.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/adapter.d.ts CHANGED
@@ -351,18 +351,24 @@ interface PositionArg {
351
351
  /** Author-facing label (defaults to `name`). */
352
352
  label?: string;
353
353
  }
354
- /** A subscription for one listenable edge's arrivals (adapter protocol
355
- * 2.6), made once for every listen on the same connection, edge, filter and
356
- * scope, when the edge declares `delivery: connection` or `scope`. */
357
- export interface EnsureEventSubscriptionInput {
354
+ /** What every call about a subscription for one listenable edge's arrivals
355
+ * says it is for (adapter protocol 2.6): made once for every listen on the
356
+ * same connection, edge, filter and scope, when the edge declares
357
+ * `delivery: connection` or `scope`. */
358
+ export interface EdgeSubscription {
358
359
  /** The edge, by its name in the schema (`Notes`). */
359
360
  edge: string;
360
361
  /** The part of the listens' WHERE on the edge the adapter takes; absent
361
- * when it takes none of it. */
362
+ * when it takes none of it. Set `takenApplied: true` on an arrival
363
+ * delivered only when it was applied. */
362
364
  filter?: unknown;
363
365
  /** The record the edge hangs off, by its id, when the listens watch it
364
366
  * under one; absent for the whole connection. */
365
367
  scope?: string;
368
+ }
369
+ /** A subscription for one listenable edge's arrivals (adapter protocol
370
+ * 2.6). */
371
+ export interface EnsureEventSubscriptionInput extends EdgeSubscription {
366
372
  /** The stable per-subscription URL the source should POST to. */
367
373
  callbackUrl: string;
368
374
  /** The registration currently held for this URL, when one exists: keep
@@ -371,6 +377,7 @@ export interface EnsureEventSubscriptionInput {
371
377
  externalId?: string;
372
378
  };
373
379
  }
380
+ export type EnsureEdgeSubscriptionInput = EnsureEventSubscriptionInput;
374
381
  /** What the source issued — the platform persists it on the subscription
375
382
  * row (the secret verifies inbound signatures). Returning `undefined`
376
383
  * means "nothing registered" (a documented no-op adapter). */
@@ -384,6 +391,13 @@ export interface EventSubscriptionRegistration {
384
391
  * one that never expires. */
385
392
  expiresAt?: string;
386
393
  }
394
+ /** Refreshing a subscription for an edge's arrivals (adapter protocol 2.6). */
395
+ export interface RefreshEdgeSubscriptionInput extends EdgeSubscription {
396
+ /** The source-issued id of the subscription to extend. */
397
+ externalId: string;
398
+ }
399
+ /** Refreshing the webhook a 0.12 settings listen registered, told apart
400
+ * from an edge's by naming no `edge`. */
387
401
  export interface RefreshEventSubscriptionInput {
388
402
  /** The source-issued id of the subscription to extend. */
389
403
  externalId: string;
@@ -394,6 +408,14 @@ export interface RefreshEventSubscriptionInput {
394
408
  export interface EventSubscriptionRefresh {
395
409
  expiresAt?: string;
396
410
  }
411
+ /** Removing a subscription for an edge's arrivals (adapter protocol 2.6). */
412
+ export interface RemoveEdgeSubscriptionInput extends EdgeSubscription {
413
+ callbackUrl: string;
414
+ /** The source-issued id held for this URL, when one exists. */
415
+ externalId?: string;
416
+ }
417
+ /** Removing the webhook a 0.12 settings listen registered, told apart from
418
+ * an edge's by naming no `edge`. */
397
419
  export interface RemoveEventSubscriptionInput {
398
420
  callbackUrl: string;
399
421
  /** The source-issued id held for this URL, when one exists. */
@@ -539,12 +561,12 @@ export interface Adapter {
539
561
  ensureEventSubscription?(input: EnsureEventSubscriptionInput): Promise<EventSubscriptionRegistration | undefined>;
540
562
  /** Tear down the registration `ensureEventSubscription` created — called
541
563
  * when the last listen on the (adapter, credential) channel retires. */
542
- removeEventSubscription?(input: RemoveEventSubscriptionInput): Promise<void>;
564
+ removeEventSubscription?(input: RemoveEventSubscriptionInput | RemoveEdgeSubscriptionInput): Promise<void>;
543
565
  /** Extend a subscription the source lets lapse (Airtable's webhooks expire
544
566
  * 7 days after their last refresh): the host calls it before the
545
567
  * `expiresAt` the registration or the last refresh returned. Adapter
546
568
  * protocol 2.4. */
547
- refreshEventSubscription?(input: RefreshEventSubscriptionInput): Promise<EventSubscriptionRefresh | undefined>;
569
+ refreshEventSubscription?(input: RefreshEventSubscriptionInput | RefreshEdgeSubscriptionInput): Promise<EventSubscriptionRefresh | undefined>;
548
570
  /**
549
571
  * Match an inbound record against existing linked_objects. The framework
550
572
  * supplies candidates filtered by adapterType + recordType; the adapter
@@ -1,3 +1,4 @@
1
+ import type { ActorIdentity } from './adapter';
1
2
  /** A record a run waits on: the id its write answered, the data it
2
3
  * carried (Slack keys a thread by the channel in it, not by its id), and its
3
4
  * record type, as the module names it, wherever the host knows it (2.6). A
@@ -58,8 +59,14 @@ export type Arrival = {
58
59
  takenApplied?: boolean;
59
60
  /** When it happened at its provider (an ISO instant), where the
60
61
  * provider says: a host measures from it whether a run's write caused
61
- * it, however late a poll finds it (2.6). */
62
+ * it, however late a poll finds it (2.6), and the run it fires
63
+ * stamps its writes with it (2.7). */
62
64
  occurredAt?: string;
65
+ /** Who acted, where the provider says: the member who posted, the
66
+ * sender of the mail, the owner of the meeting (2.7). The run's
67
+ * `@actor_*` reads it, and a host resolves the acting user from it;
68
+ * set at the door, so nothing after it needs the raw event. */
69
+ actor?: ActorIdentity;
63
70
  } | {
64
71
  edge: string;
65
72
  key: string;
package/dist/catalog.d.ts CHANGED
@@ -483,6 +483,7 @@ export declare const schemaFieldDescriptorSchema: z.ZodObject<{
483
483
  changedIn: z.ZodOptional<z.ZodObject<{
484
484
  release: z.ZodString;
485
485
  note: z.ZodString;
486
+ unchangedValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
486
487
  }, z.core.$strip>>;
487
488
  }, z.core.$strip>;
488
489
  export type SchemaFieldDescriptor = z.infer<typeof schemaFieldDescriptorSchema>;
@@ -670,6 +671,7 @@ export declare const schemaReferenceDescriptorSchema: z.ZodPreprocess<z.ZodObjec
670
671
  changedIn: z.ZodOptional<z.ZodObject<{
671
672
  release: z.ZodString;
672
673
  note: z.ZodString;
674
+ unchangedValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
673
675
  }, z.core.$strip>>;
674
676
  }, z.core.$strip>>>;
675
677
  backingFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -844,6 +846,7 @@ export declare const schemaTypeDescriptorSchema: z.ZodObject<{
844
846
  changedIn: z.ZodOptional<z.ZodObject<{
845
847
  release: z.ZodString;
846
848
  note: z.ZodString;
849
+ unchangedValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
847
850
  }, z.core.$strip>>;
848
851
  }, z.core.$strip>>;
849
852
  references: z.ZodArray<z.ZodPreprocess<z.ZodObject<{
@@ -1005,6 +1008,7 @@ export declare const schemaTypeDescriptorSchema: z.ZodObject<{
1005
1008
  changedIn: z.ZodOptional<z.ZodObject<{
1006
1009
  release: z.ZodString;
1007
1010
  note: z.ZodString;
1011
+ unchangedValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
1008
1012
  }, z.core.$strip>>;
1009
1013
  }, z.core.$strip>>>;
1010
1014
  backingFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1235,6 +1239,7 @@ declare const schemaDescriptorSchema: z.ZodObject<{
1235
1239
  changedIn: z.ZodOptional<z.ZodObject<{
1236
1240
  release: z.ZodString;
1237
1241
  note: z.ZodString;
1242
+ unchangedValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
1238
1243
  }, z.core.$strip>>;
1239
1244
  }, z.core.$strip>>;
1240
1245
  references: z.ZodArray<z.ZodPreprocess<z.ZodObject<{
@@ -1396,6 +1401,7 @@ declare const schemaDescriptorSchema: z.ZodObject<{
1396
1401
  changedIn: z.ZodOptional<z.ZodObject<{
1397
1402
  release: z.ZodString;
1398
1403
  note: z.ZodString;
1404
+ unchangedValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
1399
1405
  }, z.core.$strip>>;
1400
1406
  }, z.core.$strip>>>;
1401
1407
  backingFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
package/dist/catalog.js CHANGED
@@ -743,8 +743,11 @@ exports.schemaFieldDescriptorSchema = zod_1.z.object({
743
743
  mayBeAbsent: zod_1.z.boolean().optional(),
744
744
  /** The release that changed what the field holds, and how, as a check for
745
745
  * an upgrade from before it warns where a program reads it (gmail's
746
- * `Labels`: label ids before 0.13, names since). */
747
- changedIn: zod_1.z.object({ release: zod_1.z.string().min(1), note: zod_1.z.string().min(1) }).optional(),
746
+ * `Labels`: label ids before 0.13, names since). `unchangedValues` are
747
+ * the values a program may compare the field with that mean what they
748
+ * meant before (the mailbox's own labels): a comparison with literals all
749
+ * among them is not warned. */
750
+ changedIn: zod_1.z.object({ release: zod_1.z.string().min(1), note: zod_1.z.string().min(1), unchangedValues: zod_1.z.array(zod_1.z.string().min(1)).optional() }).optional(),
748
751
  }).superRefine((field, ctx) => {
749
752
  if ((field.kind === 'owned') !== (field.owned !== undefined)) {
750
753
  ctx.addIssue({
@@ -0,0 +1,51 @@
1
+ {
2
+ "about": "The event a host hands the run an arrival fires: the landing, its carried parents, what it is about and who acted (adapter protocol 2.7), under the arrival's edge; stamped with when it happened at its provider, as an ISO instant, or with the host's now when the arrival names no time. listen-fire (crates/lf/src/routing.rs arrival_trigger_of) and the TypeScript host (movement-engine triggers/listen_plans.ts arrivalTriggerOf, which the embed and lf-platform build runs with) both read this table, so a run reads the same event on either host.",
3
+ "cases": [
4
+ {
5
+ "name": "a bare landing, stamped with the host's now",
6
+ "pipelineInputId": "listen:crm:welcome",
7
+ "adapterType": "acme_crm",
8
+ "now": "2026-10-31T00:00:00.000Z",
9
+ "arrival": { "edge": "Company", "identity": "company-1", "landing": { "recordId": "company-1", "recordType": "Company", "fields": { "id": "company-1", "Name": "Osprey" } } },
10
+ "trigger": {
11
+ "pipelineInputId": "listen:crm:welcome",
12
+ "adapterType": "acme_crm",
13
+ "triggerType": "arrival",
14
+ "arrival": { "adapterType": "acme_crm", "edge": "Company", "landing": { "recordId": "company-1", "recordType": "Company", "fields": { "id": "company-1", "Name": "Osprey" } } },
15
+ "occurredAt": "2026-10-31T00:00:00.000Z"
16
+ }
17
+ },
18
+ {
19
+ "name": "a reply carrying its channel, about its message, by a member, when it happened",
20
+ "pipelineInputId": "listen:chat:answer",
21
+ "adapterType": "slack",
22
+ "now": "2026-11-02T12:00:00.000Z",
23
+ "arrival": {
24
+ "edge": "Replies",
25
+ "key": "C1:1700000000.000100",
26
+ "identity": "C1:1700000050.000200",
27
+ "version": "1",
28
+ "landing": { "recordId": "C1:1700000050.000200", "recordType": "Message", "fields": { "text": "on it", "user": "U1" } },
29
+ "parents": [{ "recordId": "C1", "recordType": "Channel", "fields": { "Name": "deals" } }, null],
30
+ "about": { "recordType": "Message", "externalId": "C1:1700000000.000100" },
31
+ "occurredAt": "2023-11-14T22:14:10+00:00",
32
+ "actor": { "identifier": "U1", "scheme": "opaque", "label": "U1" },
33
+ "takenApplied": true
34
+ },
35
+ "trigger": {
36
+ "pipelineInputId": "listen:chat:answer",
37
+ "adapterType": "slack",
38
+ "triggerType": "arrival",
39
+ "arrival": {
40
+ "adapterType": "slack",
41
+ "edge": "Replies",
42
+ "landing": { "recordId": "C1:1700000050.000200", "recordType": "Message", "fields": { "text": "on it", "user": "U1" } },
43
+ "parents": [{ "recordId": "C1", "recordType": "Channel", "fields": { "Name": "deals" } }, null],
44
+ "about": { "recordType": "Message", "externalId": "C1:1700000000.000100" },
45
+ "actor": { "identifier": "U1", "scheme": "opaque", "label": "U1" }
46
+ },
47
+ "occurredAt": "2023-11-14T22:14:10.000Z"
48
+ }
49
+ }
50
+ ]
51
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "about": "Whether an arrival fires a listen, by its plan's filters. Each plan is the checker's answer for its listen's source against `catalog` (both runners check that it still is). Only hops judged on arrival are judged, each against the record the arrival carries for it: `landing` for the last hop, `parents` (aligned to the plan's `carries`) for earlier ones. Each record states its `recordType`, which must be the record type its hop lands on (`to`): one edge name may hang off several record types (`pay`'s Customer and Invoice each have `Changes`), and a record of another type skips at its hop, the landing judged first; a record that states none is undecided. A hop's checked part is always evaluated; its taken part too, unless `takenApplied` says the module applied it. `now` is the instant WITHIN measures from. The verdict is `{fires: true}`, `{skips: n}` (the hop whose filter fails, outermost 0; with a `reason` when the record carried for that hop is of another record type, so no filter was read), or `{undecided: reason}` (the host logs it and runs nothing). Held by listen-fire's Rust (crates/movement-engine/src/listen_judge.rs, judge_arrival), the engine's TypeScript (judgeArrival, through the wasm) and the hosted product. A read on through a record a field holds (`c.Current.Stage`) reads that field of the landing, then the member of what it holds; a record absent reads its members absent. The checker has the listen test a record present before it reads through it (`exists(c.Current) AND c.Current.Stage == …`), and an operand of AND or OR is read only when the operands before it leave the answer open, so a read the test guards is never read on an absent record. A record may name the fields its module could not read (`unknown`): a part of the filter reading one is undecided, whatever `fields` holds for it, never read as absent; AND, OR and NOT are three-valued, so an OR one side holds holds and an AND one side fails fails, in either order; a hop that fails still decides.",
2
+ "about": "Whether an arrival fires a listen, by its plan's filters. Each plan is the checker's answer for its listen's source against `catalog` (both runners check that it still is). Only hops judged on arrival are judged, each against the record the arrival carries for it: `landing` for the last hop, `parents` (aligned to the plan's `carries`) for earlier ones. Each record states its `recordType`, which must be the record type its hop lands on (`to`): one edge name may hang off several record types (`pay`'s Customer and Invoice each have `Changes`), and a record of another type skips at its hop, the landing judged first; a record that states none is undecided. A hop's checked part is always evaluated; its taken part too, unless `takenApplied` says the module applied it. `now` is the instant WITHIN measures from. The verdict is `{fires: true}`, `{skips: n}` (the hop whose filter fails, outermost 0; with a `reason` when the record carried for that hop is of another record type, so no filter was read), or `{undecided: reason}` (the host logs it and runs nothing). A listen through or onto a union is one plan holding each member's traversal (`members`), judged once: it fires when one member's does, a record of another member's type being that member's to decide; it is undecided when one member cannot tell; it skips when every member does, by a filter when one member's record types matched, else by type, naming every member's. Held by listen-fire's Rust (crates/movement-engine/src/listen_judge.rs, judge_arrival), the engine's TypeScript (judgeArrival, through the wasm) and the hosted product. A read on through a record a field holds (`c.Current.Stage`) reads that field of the landing, then the member of what it holds; a record absent reads its members absent. The checker has the listen test a record present before it reads through it (`exists(c.Current) AND c.Current.Stage == …`), and an operand of AND or OR is read only when the operands before it leave the answer open, so a read the test guards is never read on an absent record. A record may name the fields its module could not read (`unknown`): a part of the filter reading one is undecided, whatever `fields` holds for it, never read as absent; AND, OR and NOT are three-valued, so an OR one side holds holds and an AND one side fails fails, in either order; a hop that fails still decides.",
3
3
  "catalog": {
4
4
  "adapters": {
5
5
  "chat": {
@@ -403,6 +403,28 @@
403
403
  }
404
404
  }
405
405
  },
406
+ "crm": {
407
+ "canFire": false,
408
+ "constructionArgs": [],
409
+ "schemas": {
410
+ "": {
411
+ "positions": {
412
+ "Person": {
413
+ "properties": { "Name": "text" },
414
+ "edges": { "Notes": { "target": "Note", "listenable": true, "identity": "Id", "delivery": "connection", "carries": ["Subjects"] } }
415
+ },
416
+ "Company": {
417
+ "properties": { "Name": "text" },
418
+ "edges": { "Notes": { "target": "Note", "listenable": true, "identity": "Id", "delivery": "connection", "carries": ["Subjects"] } }
419
+ },
420
+ "Note": { "properties": { "Id": "text", "Text": "text" }, "edges": {} }
421
+ },
422
+ "unions": { "Subject": ["Person", "Company"] },
423
+ "collections": { "Subjects": { "target": "Subject" } },
424
+ "writableRoots": {}
425
+ }
426
+ }
427
+ },
406
428
  "rows": {
407
429
  "canFire": false,
408
430
  "constructionArgs": [],
@@ -1612,6 +1634,113 @@
1612
1634
  ],
1613
1635
  "movement": "neither"
1614
1636
  }
1637
+ },
1638
+ "subjects": {
1639
+ "source": "import { crm as crm_module } from adapters; crm = connect crm_module\nfunction noted(n: <crm-[:Note]->>) { return n.Text }\nlisten to crm-[s:Subjects WHERE s.Name == \"Acme\"]->-[n:Notes WHERE n.Text != \"skip\"]-> fire noted\n",
1640
+ "plan": {
1641
+ "adapter": "crm",
1642
+ "connection": "crm",
1643
+ "hops": [],
1644
+ "members": [
1645
+ {
1646
+ "carries": [
1647
+ "Subjects"
1648
+ ],
1649
+ "hops": [
1650
+ {
1651
+ "alias": "s",
1652
+ "checked": {
1653
+ "left": {
1654
+ "fieldOnly": true,
1655
+ "propertyTypeId": "Name",
1656
+ "type": "edge_property"
1657
+ },
1658
+ "op": "eq",
1659
+ "right": {
1660
+ "type": "static",
1661
+ "value": "Acme"
1662
+ },
1663
+ "type": "compare"
1664
+ },
1665
+ "edge": "Subjects",
1666
+ "from": "",
1667
+ "judged": "arrival",
1668
+ "memberOf": "Subject",
1669
+ "to": "Person"
1670
+ },
1671
+ {
1672
+ "alias": "n",
1673
+ "checked": {
1674
+ "left": {
1675
+ "fieldOnly": true,
1676
+ "propertyTypeId": "Text",
1677
+ "type": "edge_property"
1678
+ },
1679
+ "op": "neq",
1680
+ "right": {
1681
+ "type": "static",
1682
+ "value": "skip"
1683
+ },
1684
+ "type": "compare"
1685
+ },
1686
+ "edge": "Notes",
1687
+ "from": "Person",
1688
+ "judged": "arrival",
1689
+ "to": "Note"
1690
+ }
1691
+ ]
1692
+ },
1693
+ {
1694
+ "carries": [
1695
+ "Subjects"
1696
+ ],
1697
+ "hops": [
1698
+ {
1699
+ "alias": "s",
1700
+ "checked": {
1701
+ "left": {
1702
+ "fieldOnly": true,
1703
+ "propertyTypeId": "Name",
1704
+ "type": "edge_property"
1705
+ },
1706
+ "op": "eq",
1707
+ "right": {
1708
+ "type": "static",
1709
+ "value": "Acme"
1710
+ },
1711
+ "type": "compare"
1712
+ },
1713
+ "edge": "Subjects",
1714
+ "from": "",
1715
+ "judged": "arrival",
1716
+ "memberOf": "Subject",
1717
+ "to": "Company"
1718
+ },
1719
+ {
1720
+ "alias": "n",
1721
+ "checked": {
1722
+ "left": {
1723
+ "fieldOnly": true,
1724
+ "propertyTypeId": "Text",
1725
+ "type": "edge_property"
1726
+ },
1727
+ "op": "neq",
1728
+ "right": {
1729
+ "type": "static",
1730
+ "value": "skip"
1731
+ },
1732
+ "type": "compare"
1733
+ },
1734
+ "edge": "Notes",
1735
+ "from": "Company",
1736
+ "judged": "arrival",
1737
+ "to": "Note"
1738
+ }
1739
+ ]
1740
+ }
1741
+ ],
1742
+ "movement": "noted"
1743
+ }
1615
1744
  }
1616
1745
  },
1617
1746
  "cases": [
@@ -1678,6 +1807,12 @@
1678
1807
  {"case": "an OR one side holds fires though its other side could not be read, that side second", "plan": "either", "arrival": {"edge": "Changes", "key": "tblCAND01", "landing": {"recordType": "Change", "fields": {"Kind": "created"}, "unknown": ["Id"]}}, "now": "2026-10-31T10:00:00Z", "verdict": {"fires": true}},
1679
1808
  {"case": "an OR no side holds, one side unread, is undecided", "plan": "either", "arrival": {"edge": "Changes", "key": "tblCAND01", "landing": {"recordType": "Change", "fields": {"Id": "2:recB"}, "unknown": ["Kind"]}}, "now": "2026-10-31T10:00:00Z", "verdict": {"undecided": "rows could not read Kind of the arrival on Changes, which this listen's filter reads"}},
1680
1809
  {"case": "an AND one side fails fails though its other side could not be read, in either order", "plan": "neither", "arrival": {"edge": "Changes", "key": "tblCAND01", "landing": {"recordType": "Change", "fields": {"Kind": "created"}, "unknown": ["Id"]}}, "now": "2026-10-31T10:00:00Z", "verdict": {"skips": 1}},
1681
- {"case": "an AND one side fails fails though its other side could not be read, the unread field the other", "plan": "neither", "arrival": {"edge": "Changes", "key": "tblCAND01", "landing": {"recordType": "Change", "fields": {"Id": "z"}, "unknown": ["Kind"]}}, "now": "2026-10-31T10:00:00Z", "verdict": {"skips": 1}}
1810
+ {"case": "an AND one side fails fails though its other side could not be read, the unread field the other", "plan": "neither", "arrival": {"edge": "Changes", "key": "tblCAND01", "landing": {"recordType": "Change", "fields": {"Id": "z"}, "unknown": ["Kind"]}}, "now": "2026-10-31T10:00:00Z", "verdict": {"skips": 1}},
1811
+ {"case": "a listen through a union: a note under a Person fires, judged by the Person's traversal", "plan": "subjects", "arrival": {"edge": "Notes", "key": "p1", "landing": {"recordType": "Note", "fields": {"Id": "n1", "Text": "hi"}}, "parents": [{"recordType": "Person", "fields": {"Name": "Acme"}}]}, "now": "2026-10-31T10:00:00Z", "verdict": {"fires": true}},
1812
+ {"case": "a listen through a union: a note under a Company fires the same listen, judged by the Company's", "plan": "subjects", "arrival": {"edge": "Notes", "key": "c1", "landing": {"recordType": "Note", "fields": {"Id": "n2", "Text": "hi"}}, "parents": [{"recordType": "Company", "fields": {"Name": "Acme"}}]}, "now": "2026-10-31T10:00:00Z", "verdict": {"fires": true}},
1813
+ {"case": "a listen through a union: a note under a Company of another name skips at Subjects by the filter, not by type", "plan": "subjects", "arrival": {"edge": "Notes", "key": "c2", "landing": {"recordType": "Note", "fields": {"Id": "n3", "Text": "hi"}}, "parents": [{"recordType": "Company", "fields": {"Name": "Other"}}]}, "now": "2026-10-31T10:00:00Z", "verdict": {"skips": 0}},
1814
+ {"case": "a listen through a union: a note the filter on Notes refuses skips at Notes", "plan": "subjects", "arrival": {"edge": "Notes", "key": "p1", "landing": {"recordType": "Note", "fields": {"Id": "n4", "Text": "skip"}}, "parents": [{"recordType": "Person", "fields": {"Name": "Acme"}}]}, "now": "2026-10-31T10:00:00Z", "verdict": {"skips": 1}},
1815
+ {"case": "a listen through a union: a note under a record of no member's type skips by type, naming every member", "plan": "subjects", "arrival": {"edge": "Notes", "key": "l1", "landing": {"recordType": "Note", "fields": {"Id": "n5", "Text": "hi"}}, "parents": [{"recordType": "Lead", "fields": {"Name": "Acme"}}]}, "now": "2026-10-31T10:00:00Z", "verdict": {"skips": 0, "reason": "the Subjects record it carries has record type Lead, not Person or Company, which this listen's Subjects lands on"}},
1816
+ {"case": "a listen through a union: a note whose subject states no record type is undecided, once, naming every member", "plan": "subjects", "arrival": {"edge": "Notes", "key": "p1", "landing": {"recordType": "Note", "fields": {"Id": "n6", "Text": "hi"}}, "parents": [{"fields": {"Name": "Acme"}}]}, "now": "2026-10-31T10:00:00Z", "verdict": {"undecided": "the arrival crm reported on Notes carries a Subjects record that does not say its record type (this listen's Subjects lands on Person or Company)"}}
1682
1817
  ]
1683
1818
  }
@@ -52,6 +52,18 @@ declare const runInputSchema: z.ZodObject<{
52
52
  recordId?: string | undefined;
53
53
  recordType?: string | undefined;
54
54
  } | null)[] | undefined;
55
+ about?: {
56
+ recordType: string;
57
+ externalId: string;
58
+ } | undefined;
59
+ actor?: {
60
+ identifier: string;
61
+ scheme: "email" | "phone" | "opaque";
62
+ adapterType?: string | undefined;
63
+ email?: string | undefined;
64
+ name?: string | undefined;
65
+ label?: string | undefined;
66
+ } | undefined;
55
67
  } | undefined;
56
68
  }, {
57
69
  pipelineInputId: string;
@@ -90,6 +102,18 @@ declare const runInputSchema: z.ZodObject<{
90
102
  recordId?: string | undefined;
91
103
  recordType?: string | undefined;
92
104
  } | null)[] | undefined;
105
+ about?: {
106
+ recordType: string;
107
+ externalId: string;
108
+ } | undefined;
109
+ actor?: {
110
+ identifier: string;
111
+ scheme: "email" | "phone" | "opaque";
112
+ adapterType?: string | undefined;
113
+ email?: string | undefined;
114
+ name?: string | undefined;
115
+ label?: string | undefined;
116
+ } | undefined;
93
117
  } | undefined;
94
118
  }>;
95
119
  teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
@@ -153,6 +177,18 @@ declare const resumeInputSchema: z.ZodObject<{
153
177
  recordId?: string | undefined;
154
178
  recordType?: string | undefined;
155
179
  } | null)[] | undefined;
180
+ about?: {
181
+ recordType: string;
182
+ externalId: string;
183
+ } | undefined;
184
+ actor?: {
185
+ identifier: string;
186
+ scheme: "email" | "phone" | "opaque";
187
+ adapterType?: string | undefined;
188
+ email?: string | undefined;
189
+ name?: string | undefined;
190
+ label?: string | undefined;
191
+ } | undefined;
156
192
  } | undefined;
157
193
  }, {
158
194
  pipelineInputId: string;
@@ -191,6 +227,18 @@ declare const resumeInputSchema: z.ZodObject<{
191
227
  recordId?: string | undefined;
192
228
  recordType?: string | undefined;
193
229
  } | null)[] | undefined;
230
+ about?: {
231
+ recordType: string;
232
+ externalId: string;
233
+ } | undefined;
234
+ actor?: {
235
+ identifier: string;
236
+ scheme: "email" | "phone" | "opaque";
237
+ adapterType?: string | undefined;
238
+ email?: string | undefined;
239
+ name?: string | undefined;
240
+ label?: string | undefined;
241
+ } | undefined;
194
242
  } | undefined;
195
243
  }>;
196
244
  teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
@@ -304,6 +352,18 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
304
352
  recordId?: string | undefined;
305
353
  recordType?: string | undefined;
306
354
  } | null)[] | undefined;
355
+ about?: {
356
+ recordType: string;
357
+ externalId: string;
358
+ } | undefined;
359
+ actor?: {
360
+ identifier: string;
361
+ scheme: "email" | "phone" | "opaque";
362
+ adapterType?: string | undefined;
363
+ email?: string | undefined;
364
+ name?: string | undefined;
365
+ label?: string | undefined;
366
+ } | undefined;
307
367
  } | undefined;
308
368
  }, {
309
369
  pipelineInputId: string;
@@ -342,6 +402,18 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
342
402
  recordId?: string | undefined;
343
403
  recordType?: string | undefined;
344
404
  } | null)[] | undefined;
405
+ about?: {
406
+ recordType: string;
407
+ externalId: string;
408
+ } | undefined;
409
+ actor?: {
410
+ identifier: string;
411
+ scheme: "email" | "phone" | "opaque";
412
+ adapterType?: string | undefined;
413
+ email?: string | undefined;
414
+ name?: string | undefined;
415
+ label?: string | undefined;
416
+ } | undefined;
345
417
  } | undefined;
346
418
  }>;
347
419
  teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
@@ -433,6 +505,18 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
433
505
  recordId?: string | undefined;
434
506
  recordType?: string | undefined;
435
507
  } | null)[] | undefined;
508
+ about?: {
509
+ recordType: string;
510
+ externalId: string;
511
+ } | undefined;
512
+ actor?: {
513
+ identifier: string;
514
+ scheme: "email" | "phone" | "opaque";
515
+ adapterType?: string | undefined;
516
+ email?: string | undefined;
517
+ name?: string | undefined;
518
+ label?: string | undefined;
519
+ } | undefined;
436
520
  } | undefined;
437
521
  }, {
438
522
  pipelineInputId: string;
@@ -471,6 +555,18 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
471
555
  recordId?: string | undefined;
472
556
  recordType?: string | undefined;
473
557
  } | null)[] | undefined;
558
+ about?: {
559
+ recordType: string;
560
+ externalId: string;
561
+ } | undefined;
562
+ actor?: {
563
+ identifier: string;
564
+ scheme: "email" | "phone" | "opaque";
565
+ adapterType?: string | undefined;
566
+ email?: string | undefined;
567
+ name?: string | undefined;
568
+ label?: string | undefined;
569
+ } | undefined;
474
570
  } | undefined;
475
571
  }>;
476
572
  teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
@@ -570,6 +666,18 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
570
666
  recordId?: string | undefined;
571
667
  recordType?: string | undefined;
572
668
  } | null)[] | undefined;
669
+ about?: {
670
+ recordType: string;
671
+ externalId: string;
672
+ } | undefined;
673
+ actor?: {
674
+ identifier: string;
675
+ scheme: "email" | "phone" | "opaque";
676
+ adapterType?: string | undefined;
677
+ email?: string | undefined;
678
+ name?: string | undefined;
679
+ label?: string | undefined;
680
+ } | undefined;
573
681
  } | undefined;
574
682
  }, {
575
683
  pipelineInputId: string;
@@ -608,6 +716,18 @@ export declare const hostRecordingSchema: z.ZodPreprocess<z.ZodDiscriminatedUnio
608
716
  recordId?: string | undefined;
609
717
  recordType?: string | undefined;
610
718
  } | null)[] | undefined;
719
+ about?: {
720
+ recordType: string;
721
+ externalId: string;
722
+ } | undefined;
723
+ actor?: {
724
+ identifier: string;
725
+ scheme: "email" | "phone" | "opaque";
726
+ adapterType?: string | undefined;
727
+ email?: string | undefined;
728
+ name?: string | undefined;
729
+ label?: string | undefined;
730
+ } | undefined;
611
731
  } | undefined;
612
732
  }>;
613
733
  teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
package/dist/event.d.ts CHANGED
@@ -94,6 +94,22 @@ export declare const triggerEventSchema: z.ZodObject<{
94
94
  recordType: z.ZodOptional<z.ZodString>;
95
95
  fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
96
96
  }, z.core.$strip>>>>;
97
+ about: z.ZodOptional<z.ZodObject<{
98
+ recordType: z.ZodString;
99
+ externalId: z.ZodString;
100
+ }, z.core.$strip>>;
101
+ actor: z.ZodOptional<z.ZodObject<{
102
+ identifier: z.ZodString;
103
+ scheme: z.ZodEnum<{
104
+ email: "email";
105
+ phone: "phone";
106
+ opaque: "opaque";
107
+ }>;
108
+ adapterType: z.ZodOptional<z.ZodString>;
109
+ email: z.ZodOptional<z.ZodString>;
110
+ name: z.ZodOptional<z.ZodString>;
111
+ label: z.ZodOptional<z.ZodString>;
112
+ }, z.core.$strip>>;
97
113
  }, z.core.$strip>>;
98
114
  }, z.core.$strip>;
99
115
  export type TriggerEvent = z.infer<typeof triggerEventSchema>;
package/dist/event.js CHANGED
@@ -26,6 +26,15 @@ exports.firedTriggerTypeSchema = zod_1.z.union([exports.triggerTypeSchema, zod_1
26
26
  /** The record that landed on a listen's last edge, and the records it
27
27
  * carries from earlier hops (adapter protocol 2.6). */
28
28
  const firedLandingSchema = zod_1.z.object({ recordId: zod_1.z.string().optional(), recordType: zod_1.z.string().optional(), fields: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()) });
29
+ /** Who acted on an arrival, as its module says (`ActorIdentity`, 2.7). */
30
+ const firedActorSchema = zod_1.z.object({
31
+ identifier: zod_1.z.string(),
32
+ scheme: zod_1.z.enum(['email', 'phone', 'opaque']),
33
+ adapterType: zod_1.z.string().optional(),
34
+ email: zod_1.z.string().optional(),
35
+ name: zod_1.z.string().optional(),
36
+ label: zod_1.z.string().optional(),
37
+ });
29
38
  /** The source system's identifier for the record an inbound event is about. */
30
39
  exports.inboundRecordRefSchema = zod_1.z.object({
31
40
  adapterType: zod_1.z.string(),
@@ -69,7 +78,17 @@ exports.triggerEventSchema = zod_1.z.object({
69
78
  * What fired a listen on a traversal (`triggerType: 'arrival'`): the record
70
79
  * that landed on its last edge, which the fired function's parameter binds
71
80
  * as a wait binds what lands on its edge, and the records it carries from
72
- * earlier hops (adapter protocol 2.6).
81
+ * earlier hops (adapter protocol 2.6); the record it is about and who
82
+ * acted, as its module said at the door (2.7).
73
83
  */
74
- arrival: zod_1.z.object({ adapterType: zod_1.z.string(), edge: zod_1.z.string(), landing: firedLandingSchema, parents: zod_1.z.array(firedLandingSchema.nullable()).optional() }).optional(),
84
+ arrival: zod_1.z
85
+ .object({
86
+ adapterType: zod_1.z.string(),
87
+ edge: zod_1.z.string(),
88
+ landing: firedLandingSchema,
89
+ parents: zod_1.z.array(firedLandingSchema.nullable()).optional(),
90
+ about: zod_1.z.object({ recordType: zod_1.z.string(), externalId: zod_1.z.string() }).optional(),
91
+ actor: firedActorSchema.optional(),
92
+ })
93
+ .optional(),
75
94
  });
@@ -67,6 +67,9 @@ const _expressionSchema = zod_1.z.lazy(() => zod_1.z.union([
67
67
  aliasRoot: zod_1.z.string().optional(),
68
68
  steps: zod_1.z.array(schemas_1.traversalStepSchema),
69
69
  expression: _expressionSchema,
70
+ // `x?.F`: written knowing the root may be missing. It reads as `x.F`
71
+ // does (absent when the root is); only the checker tells them apart.
72
+ optional: zod_1.z.boolean().optional(),
70
73
  }),
71
74
  // Quantifier — `exists` returns true iff the traversal yields at least
72
75
  // one position satisfying `where` (or any position when `where` is