@listen-fire/engine-contracts 0.13.1 → 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
@@ -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
@@ -47,13 +47,15 @@ export interface CodeAsTree extends ParkedCode {
47
47
  * (`…/expr/nested/<start>-<end>/value/…`).
48
48
  */
49
49
  export type CodePlace = string;
50
- /** The Rust engine's (version 2 from 0.12, 3 from 0.13): code is its place
51
- * in the pinned program (a collection op its span among its statement's
52
- * calls), and the libraries ride beside it (`ParkedScopeState.libraries`).
53
- * Version 3 adds a run's waits and an await's captured values; 0.13 reads
54
- * no version 2 state. */
50
+ /** The Rust engine's (version 2 from 0.12, 3 from 0.13, 4 from 0.14): code is
51
+ * its place in the pinned program (a collection op its span among its
52
+ * statement's calls), and the libraries ride beside it
53
+ * (`ParkedScopeState.libraries`). Version 3 adds a run's waits and an await's
54
+ * captured values; 0.13 reads no version 2 state. Version 4 holds no kept
55
+ * walk (`lazyWalk`, a node edge's `deferred`): `lazy` is retired in 0.14, and
56
+ * a 0.14 engine reads a version 3 state only when it holds none. */
55
57
  export interface CodeByPlace extends ParkedCode {
56
- version: 3;
58
+ version: 3 | 4;
57
59
  closure: CodePlace;
58
60
  shape: CodePlace;
59
61
  head: CodePlace;
@@ -294,7 +296,8 @@ export type BindingDescriptor<C extends ParkedCode = CodeAsTree> = {
294
296
  kind: 'nodeRef';
295
297
  id: number;
296
298
  }
297
- /** Bucket 3 (recursive) — a stored, unrun traversal. */
299
+ /** Bucket 3 (recursive) — a stored, unrun traversal (`lazy`). Version 1,
300
+ * and 3; version 4 holds none. */
298
301
  | {
299
302
  kind: 'lazyWalk';
300
303
  walk: DeferredWalkDescriptor<C>;
@@ -350,7 +353,9 @@ export type NodeEdgeDescriptor<C extends ParkedCode = CodeAsTree> =
350
353
  /** The earlier spelling — nested edge names only, `{ founder: {} }` —
351
354
  * which a park written before field order was kept still carries. */
352
355
  landingShape?: LegacyLandingShape;
353
- } | {
356
+ }
357
+ /** A `lazy` entry's edge. Version 1, and 3; version 4 holds none. */
358
+ | {
354
359
  kind: 'deferred';
355
360
  walk: DeferredWalkDescriptor<C>;
356
361
  };
@@ -436,7 +441,7 @@ export type ScopeLink<C extends ParkedCode = CodeAsTree> = {
436
441
  */
437
442
  export interface ParkedScopeState<C extends ParkedCode = CodeAsTree> {
438
443
  /** The park state contract's version: 1 for the earlier TypeScript
439
- * engine's states, 3 for the Rust engine's. */
444
+ * engine's states, 4 (or 0.13's 3) for the Rust engine's. */
440
445
  version: C['version'];
441
446
  /** The parked statement's canonical lexical address — the resume entry
442
447
  * point. */
@@ -1750,8 +1750,7 @@ export type WireModuleKindShape = z.infer<typeof WireModuleKind>;
1750
1750
  /** The host's core services a `core` module can fill. Each slot's contract
1751
1751
  * is its family's contract suite (the run host's store cases for `store`,
1752
1752
  * and so on); the host names one module per slot, and every slot has a
1753
- * default module but `loopGuard`, which stays empty unless named, and
1754
- * `browser`, which the platform's api image fills with Chromium and every
1753
+ * default module but `browser`, which the platform's api image fills with Chromium and every
1755
1754
  * other host leaves empty (a module asking for a page is refused by name),
1756
1755
  * and `wake`, which stays empty unless named (nobody is told work is due;
1757
1756
  * a scheduled worker finds it), and `ocr`, which stays empty unless named
@@ -1761,14 +1760,13 @@ export type WireModuleKindShape = z.infer<typeof WireModuleKind>;
1761
1760
  * from itself. `movements` answers the project's movement files by name
1762
1761
  * (`listen-fire`'s default: the movements folder); its module's own settings come
1763
1762
  * from the same two places. */
1764
- export declare const CORE_SLOTS: readonly ["models", "judge", "store", "files", "limiter", "loopGuard", "browser", "wake", "ocr", "secrets", "movements"];
1763
+ export declare const CORE_SLOTS: readonly ["models", "judge", "store", "files", "limiter", "browser", "wake", "ocr", "secrets", "movements"];
1765
1764
  export declare const WireCoreSlot: z.ZodEnum<{
1766
1765
  store: "store";
1767
1766
  models: "models";
1768
1767
  judge: "judge";
1769
1768
  files: "files";
1770
1769
  limiter: "limiter";
1771
- loopGuard: "loopGuard";
1772
1770
  browser: "browser";
1773
1771
  wake: "wake";
1774
1772
  ocr: "ocr";
@@ -1828,7 +1826,6 @@ export declare const WireModuleDeclarations: z.ZodObject<{
1828
1826
  judge: "judge";
1829
1827
  files: "files";
1830
1828
  limiter: "limiter";
1831
- loopGuard: "loopGuard";
1832
1829
  browser: "browser";
1833
1830
  wake: "wake";
1834
1831
  ocr: "ocr";
@@ -1986,7 +1983,6 @@ export declare const WireManifestResult: z.ZodPreprocess<z.ZodObject<{
1986
1983
  judge: "judge";
1987
1984
  files: "files";
1988
1985
  limiter: "limiter";
1989
- loopGuard: "loopGuard";
1990
1986
  browser: "browser";
1991
1987
  wake: "wake";
1992
1988
  ocr: "ocr";
@@ -2740,7 +2736,6 @@ export declare const METHODS: {
2740
2736
  judge: "judge";
2741
2737
  files: "files";
2742
2738
  limiter: "limiter";
2743
- loopGuard: "loopGuard";
2744
2739
  browser: "browser";
2745
2740
  wake: "wake";
2746
2741
  ocr: "ocr";
package/dist/protocol.js CHANGED
@@ -886,8 +886,7 @@ exports.WireModuleKind = zod_1.z.enum(exports.MODULE_KINDS);
886
886
  /** The host's core services a `core` module can fill. Each slot's contract
887
887
  * is its family's contract suite (the run host's store cases for `store`,
888
888
  * and so on); the host names one module per slot, and every slot has a
889
- * default module but `loopGuard`, which stays empty unless named, and
890
- * `browser`, which the platform's api image fills with Chromium and every
889
+ * default module but `browser`, which the platform's api image fills with Chromium and every
891
890
  * other host leaves empty (a module asking for a page is refused by name),
892
891
  * and `wake`, which stays empty unless named (nobody is told work is due;
893
892
  * a scheduled worker finds it), and `ocr`, which stays empty unless named
@@ -897,7 +896,7 @@ exports.WireModuleKind = zod_1.z.enum(exports.MODULE_KINDS);
897
896
  * from itself. `movements` answers the project's movement files by name
898
897
  * (`listen-fire`'s default: the movements folder); its module's own settings come
899
898
  * from the same two places. */
900
- exports.CORE_SLOTS = ['models', 'judge', 'store', 'files', 'limiter', 'loopGuard', 'browser', 'wake', 'ocr', 'secrets', 'movements'];
899
+ exports.CORE_SLOTS = ['models', 'judge', 'store', 'files', 'limiter', 'browser', 'wake', 'ocr', 'secrets', 'movements'];
901
900
  exports.WireCoreSlot = zod_1.z.enum(exports.CORE_SLOTS);
902
901
  /** One construction argument the install supplies (an Airtable `base`, a
903
902
  * Sheets `spreadsheet`): asked for when the module is set up (`listen-fire connect`,
@@ -36,7 +36,6 @@ export declare const WireSlotManifest: z.ZodObject<{
36
36
  judge: "judge";
37
37
  files: "files";
38
38
  limiter: "limiter";
39
- loopGuard: "loopGuard";
40
39
  browser: "browser";
41
40
  wake: "wake";
42
41
  ocr: "ocr";
@@ -2,10 +2,11 @@ import { CATALOG_SNAPSHOT_VERSION, DEPRECATED_CATALOG_SNAPSHOT_VERSIONS, DEPRECA
2
2
  export { CATALOG_SNAPSHOT_VERSION, DEPRECATED_CATALOG_SNAPSHOT_VERSIONS, SUPPORTED_CATALOG_SNAPSHOT_VERSIONS };
3
3
  export { DEPRECATED_STORY_ANALYSIS_VERSIONS, STORY_ANALYSIS_VERSION, SUPPORTED_STORY_ANALYSIS_VERSIONS };
4
4
  /** A parked flow's state (docs/contracts/park-state.md). Engine to engine: a
5
- * host stores it and hands it back. Version 3 is the Rust engine's from 0.13
6
- * (2 was 0.12's, whose awaits parked on keys); the earlier TypeScript engine
7
- * wrote and read 1. */
8
- export declare const PARK_STATE_VERSION = 3;
5
+ * host stores it and hands it back. Version 4 is the Rust engine's from 0.14,
6
+ * which holds no `lazy` walk; it reads 0.13's 3 too, refusing one that holds
7
+ * a `lazy` walk (2 was 0.12's, whose awaits parked on keys). The earlier
8
+ * TypeScript engine wrote and read 1. */
9
+ export declare const PARK_STATE_VERSION = 4;
9
10
  /** The park state versions this release reads: each engine its own. */
10
11
  export declare const SUPPORTED_PARK_STATE_VERSIONS: ReadonlySet<number>;
11
12
  /** The host families and the entry points (docs/contracts/host-families.md),
@@ -33,7 +34,7 @@ export declare const CONTRACTS: {
33
34
  readonly deprecated: readonly number[];
34
35
  };
35
36
  readonly 'park-state': {
36
- readonly current: 3;
37
+ readonly current: 4;
37
38
  readonly supported: readonly number[];
38
39
  readonly deprecated: readonly [];
39
40
  };
package/dist/versions.js CHANGED
@@ -20,12 +20,13 @@ Object.defineProperty(exports, "SUPPORTED_CATALOG_SNAPSHOT_VERSIONS", { enumerab
20
20
  Object.defineProperty(exports, "SUPPORTED_STORY_ANALYSIS_VERSIONS", { enumerable: true, get: function () { return movement_lang_1.SUPPORTED_STORY_ANALYSIS_VERSIONS; } });
21
21
  const protocol_1 = require("./protocol");
22
22
  /** A parked flow's state (docs/contracts/park-state.md). Engine to engine: a
23
- * host stores it and hands it back. Version 3 is the Rust engine's from 0.13
24
- * (2 was 0.12's, whose awaits parked on keys); the earlier TypeScript engine
25
- * wrote and read 1. */
26
- exports.PARK_STATE_VERSION = 3;
23
+ * host stores it and hands it back. Version 4 is the Rust engine's from 0.14,
24
+ * which holds no `lazy` walk; it reads 0.13's 3 too, refusing one that holds
25
+ * a `lazy` walk (2 was 0.12's, whose awaits parked on keys). The earlier
26
+ * TypeScript engine wrote and read 1. */
27
+ exports.PARK_STATE_VERSION = 4;
27
28
  /** The park state versions this release reads: each engine its own. */
28
- exports.SUPPORTED_PARK_STATE_VERSIONS = new Set([1, 3]);
29
+ exports.SUPPORTED_PARK_STATE_VERSIONS = new Set([1, 3, 4]);
29
30
  /** The host families and the entry points (docs/contracts/host-families.md),
30
31
  * carried on every `segment.open`. */
31
32
  exports.HOST_FAMILIES_VERSION = 2;
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.13.1",
4
+ "version": "0.14.0",
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.13.1"
33
+ "@listen-fire/movement-lang": "^0.14.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.16.5",