@listen-fire/engine-contracts 0.12.5 → 0.12.7

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.
@@ -60,7 +60,7 @@ declare const runInputSchema: z.ZodObject<{
60
60
  idempotencyKey?: string | undefined;
61
61
  occurredAt?: string | undefined;
62
62
  }>;
63
- teamId: z.core.$ZodBranded<z.ZodString, "TenantId">;
63
+ teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
64
64
  firedAt: z.ZodOptional<z.ZodString>;
65
65
  costCapMicrodollars: z.ZodOptional<z.ZodNumber>;
66
66
  priorSpentMicrodollars: z.ZodOptional<z.ZodNumber>;
@@ -132,7 +132,7 @@ declare const resumeInputSchema: z.ZodObject<{
132
132
  idempotencyKey?: string | undefined;
133
133
  occurredAt?: string | undefined;
134
134
  }>;
135
- teamId: z.core.$ZodBranded<z.ZodString, "TenantId">;
135
+ teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
136
136
  firedAt: z.ZodOptional<z.ZodString>;
137
137
  costCapMicrodollars: z.ZodOptional<z.ZodNumber>;
138
138
  priorSpentMicrodollars: z.ZodOptional<z.ZodNumber>;
@@ -254,7 +254,7 @@ export declare const hostRecordingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
254
254
  idempotencyKey?: string | undefined;
255
255
  occurredAt?: string | undefined;
256
256
  }>;
257
- teamId: z.core.$ZodBranded<z.ZodString, "TenantId">;
257
+ teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
258
258
  firedAt: z.ZodOptional<z.ZodString>;
259
259
  costCapMicrodollars: z.ZodOptional<z.ZodNumber>;
260
260
  priorSpentMicrodollars: z.ZodOptional<z.ZodNumber>;
@@ -354,7 +354,7 @@ export declare const hostRecordingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
354
354
  idempotencyKey?: string | undefined;
355
355
  occurredAt?: string | undefined;
356
356
  }>;
357
- teamId: z.core.$ZodBranded<z.ZodString, "TenantId">;
357
+ teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
358
358
  firedAt: z.ZodOptional<z.ZodString>;
359
359
  costCapMicrodollars: z.ZodOptional<z.ZodNumber>;
360
360
  priorSpentMicrodollars: z.ZodOptional<z.ZodNumber>;
@@ -462,7 +462,7 @@ export declare const hostRecordingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
462
462
  idempotencyKey?: string | undefined;
463
463
  occurredAt?: string | undefined;
464
464
  }>;
465
- teamId: z.core.$ZodBranded<z.ZodString, "TenantId">;
465
+ teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
466
466
  firedAt: z.ZodOptional<z.ZodString>;
467
467
  costCapMicrodollars: z.ZodOptional<z.ZodNumber>;
468
468
  priorSpentMicrodollars: z.ZodOptional<z.ZodNumber>;
@@ -571,7 +571,7 @@ export declare const hostRecordingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
571
571
  idempotencyKey?: string | undefined;
572
572
  occurredAt?: string | undefined;
573
573
  }>;
574
- teamId: z.core.$ZodBranded<z.ZodString, "TenantId">;
574
+ teamId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
575
575
  firedAt: z.ZodOptional<z.ZodString>;
576
576
  costCapMicrodollars: z.ZodOptional<z.ZodNumber>;
577
577
  priorSpentMicrodollars: z.ZodOptional<z.ZodNumber>;
@@ -10,10 +10,60 @@ export declare const ADAPTER_TEAM_HEADER = "x-listen-fire-team";
10
10
  /** The same version as the manifest's `protocolVersion` field. A number there
11
11
  * because manifests are hand-written files, where `2` is what an author types. */
12
12
  export declare const MANIFEST_PROTOCOL_VERSION = 2;
13
+ /** The highest minor of version 2 this release speaks: a host reads 2.0 to
14
+ * 2.`PROTOCOL_MINOR` (docs/contracts/adapter-protocol.md "Minors of version 2"). */
15
+ export declare const PROTOCOL_MINOR = 2;
16
+ /** What a manifest shows of a feature: a method it lists, by name or by its
17
+ * ending (`<slot>.watch`). Data, so the Rust twin
18
+ * (module-wire `envelope::PROTOCOL_MINORS`) is test-held equal to it. */
19
+ export type ProtocolMinorUse = {
20
+ method: string;
21
+ } | {
22
+ methodEndingWith: string;
23
+ };
24
+ /** Each minor of version 2 and the feature that a manifest using it lists. A
25
+ * minor whose feature a manifest cannot show (2.0's) has no row. */
26
+ export declare const PROTOCOL_MINORS: readonly {
27
+ minor: number;
28
+ feature: string;
29
+ uses: ProtocolMinorUse;
30
+ }[];
31
+ /** The minor a manifest states: the highest among the features it lists, so a
32
+ * module rebuilt with a newer kit is never refused by an older host for a
33
+ * feature it does not use. */
34
+ export declare function protocolMinorOf(manifest: {
35
+ methods: readonly string[];
36
+ }): number;
13
37
  /** A manifest's `protocolVersion`, shared by the server's `manifest` answer and
14
- * the installable manifest file so both refuse an older adapter in the same
15
- * words. */
38
+ * the installable manifest file so both refuse a module in the same words,
39
+ * naming which way it is out of step. */
16
40
  export declare const WireManifestProtocolVersion: z.ZodLiteral<2>;
41
+ /** A manifest's `protocolMinor`: absent is unstated, read as 2.0. */
42
+ export declare const WireManifestProtocolMinor: z.ZodOptional<z.ZodNumber>;
43
+ /** Who a refusal names: the module (absent when the caller names it itself),
44
+ * its slot for a core module, its package when the host found it, and the
45
+ * host refusing it with its own version. */
46
+ export interface ProtocolSpeaker {
47
+ name?: string;
48
+ slot?: string;
49
+ package?: {
50
+ name: string;
51
+ version: string;
52
+ };
53
+ host: {
54
+ name: string;
55
+ version: string;
56
+ };
57
+ }
58
+ /** Whether a host speaking 2.0 to 2.`PROTOCOL_MINOR` reads a module whose
59
+ * manifest is `raw`, and if not, why in words naming both sides. lf's twin
60
+ * is `protocol::protocol_standing` (crates/lf), in the same words. */
61
+ export declare function protocolStanding(raw: unknown, speaker: ProtocolSpeaker): {
62
+ ok: true;
63
+ } | {
64
+ ok: false;
65
+ message: string;
66
+ };
17
67
  /** A credential's fields as stored, every value a string (`expires_at` an ISO
18
68
  * time). */
19
69
  export declare const WireCredentialFields: z.ZodRecord<z.ZodString, z.ZodString>;
@@ -759,7 +809,7 @@ export declare const WireResolveEntityInput: z.ZodObject<{
759
809
  * keeps such adapters working instead of failing the write path with a cryptic
760
810
  * "expected object, received array".
761
811
  */
762
- export declare const WireResolveEntityResult: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
812
+ export declare const WireResolveEntityResult: z.ZodPreprocess<z.ZodObject<{
763
813
  candidates: z.ZodArray<z.ZodObject<{
764
814
  adapterType: z.ZodString;
765
815
  externalId: z.ZodString;
@@ -767,7 +817,7 @@ export declare const WireResolveEntityResult: z.ZodPipe<z.ZodTransform<unknown,
767
817
  url: z.ZodOptional<z.ZodString>;
768
818
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
769
819
  }, z.core.$strip>>;
770
- }, z.core.$strip>>;
820
+ }, z.core.$strip>, unknown>;
771
821
  export declare const WireGetFieldValueInput: z.ZodObject<{
772
822
  position: z.ZodObject<{
773
823
  adapterType: z.ZodString;
@@ -1590,8 +1640,8 @@ export type WireModuleSettingShape = z.infer<typeof WireModuleSetting>;
1590
1640
  * one install of it, or one team's installs. */
1591
1641
  export declare const LIMIT_SCOPES: readonly ["credential", "module", "install", "team"];
1592
1642
  export declare const WireLimitScope: z.ZodEnum<{
1593
- credential: "credential";
1594
1643
  module: "module";
1644
+ credential: "credential";
1595
1645
  install: "install";
1596
1646
  team: "team";
1597
1647
  }>;
@@ -1605,8 +1655,8 @@ export declare const WireLimitDuration: z.ZodString;
1605
1655
  * each request, so no limiter needs the manifest. */
1606
1656
  export declare const WireDeclaredLimit: z.ZodObject<{
1607
1657
  scope: z.ZodEnum<{
1608
- credential: "credential";
1609
1658
  module: "module";
1659
+ credential: "credential";
1610
1660
  install: "install";
1611
1661
  team: "team";
1612
1662
  }>;
@@ -1731,8 +1781,8 @@ export declare const WireModuleDeclarations: z.ZodObject<{
1731
1781
  }, z.core.$strip>>;
1732
1782
  limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
1733
1783
  scope: z.ZodEnum<{
1734
- credential: "credential";
1735
1784
  module: "module";
1785
+ credential: "credential";
1736
1786
  install: "install";
1737
1787
  team: "team";
1738
1788
  }>;
@@ -1750,6 +1800,7 @@ export declare function refuseUnpairedDeclarations(manifest: WireModuleDeclarati
1750
1800
  }, ctx: z.RefinementCtx): void;
1751
1801
  export declare const WireManifestResult: z.ZodObject<{
1752
1802
  protocolVersion: z.ZodLiteral<2>;
1803
+ protocolMinor: z.ZodOptional<z.ZodNumber>;
1753
1804
  adapterType: z.ZodString;
1754
1805
  supportedTriggers: z.ZodArray<z.ZodString>;
1755
1806
  runtimeCapabilities: z.ZodObject<{
@@ -1877,8 +1928,8 @@ export declare const WireManifestResult: z.ZodObject<{
1877
1928
  }, z.core.$strip>>;
1878
1929
  limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
1879
1930
  scope: z.ZodEnum<{
1880
- credential: "credential";
1881
1931
  module: "module";
1932
+ credential: "credential";
1882
1933
  install: "install";
1883
1934
  team: "team";
1884
1935
  }>;
@@ -2258,6 +2309,7 @@ export declare const METHODS: {
2258
2309
  readonly params: z.ZodObject<{}, z.core.$strip>;
2259
2310
  readonly result: z.ZodObject<{
2260
2311
  protocolVersion: z.ZodLiteral<2>;
2312
+ protocolMinor: z.ZodOptional<z.ZodNumber>;
2261
2313
  adapterType: z.ZodString;
2262
2314
  supportedTriggers: z.ZodArray<z.ZodString>;
2263
2315
  runtimeCapabilities: z.ZodObject<{
@@ -2385,8 +2437,8 @@ export declare const METHODS: {
2385
2437
  }, z.core.$strip>>;
2386
2438
  limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
2387
2439
  scope: z.ZodEnum<{
2388
- credential: "credential";
2389
2440
  module: "module";
2441
+ credential: "credential";
2390
2442
  install: "install";
2391
2443
  team: "team";
2392
2444
  }>;
@@ -2618,7 +2670,7 @@ export declare const METHODS: {
2618
2670
  }, z.core.$strip>>;
2619
2671
  }, z.core.$strip>;
2620
2672
  }, z.core.$strip>;
2621
- readonly result: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
2673
+ readonly result: z.ZodPreprocess<z.ZodObject<{
2622
2674
  candidates: z.ZodArray<z.ZodObject<{
2623
2675
  adapterType: z.ZodString;
2624
2676
  externalId: z.ZodString;
@@ -2626,7 +2678,7 @@ export declare const METHODS: {
2626
2678
  url: z.ZodOptional<z.ZodString>;
2627
2679
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2628
2680
  }, z.core.$strip>>;
2629
- }, z.core.$strip>>;
2681
+ }, z.core.$strip>, unknown>;
2630
2682
  };
2631
2683
  readonly getFieldValue: {
2632
2684
  readonly params: z.ZodObject<{
package/dist/protocol.js CHANGED
@@ -18,9 +18,11 @@
18
18
  // adapter's own internal ids never cross it (record ids aside: those are
19
19
  // identity, not names); each side resolves names to whatever it needs.
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.WireUpdateWriteResult = exports.WireParentAssociation = exports.WireUpdateNotFound = exports.WireWriteResult = exports.WireDeleteInput = exports.WireUpdateInput = exports.WireWriteInput = exports.WireGetRelatedInput = exports.WireGetFieldValueInput = exports.WireResolveEntityResult = exports.WireResolveEntityInput = exports.WireEdgesFromResult = exports.WireSchemaTypeDescriptor = exports.WireSchemaEntryPoint = exports.WireSchemaReferenceDescriptor = exports.WireSchemaFieldDescriptor = exports.WireActorCandidate = exports.WireActorIdentity = exports.WireRelatedResult = exports.WireUniquenessConstraints = exports.WireMutationContext = exports.WireFieldEvidence = exports.WireResource = exports.WireResourceProvenance = exports.WireFact = exports.WireFileRef = exports.WireLinkedObject = exports.WireTriggerEvent = exports.WireExternalRecordRef = exports.WireInboundRecordRef = exports.WireActor = exports.WireLandedRecordPosition = exports.WireSourcePosition = exports.WireEphemeralOriginRef = exports.WirePositionIdentity = exports.RpcResponse = exports.WireRetryAfter = exports.CREDENTIAL_REFUSED_CODE = exports.RpcError = exports.RpcRequest = exports.WireHostLimitsDoor = exports.WireModuleSettingValues = exports.WireCostLine = exports.WireCredentialUpdate = exports.WireCredential = exports.WireCredentialFields = exports.WireManifestProtocolVersion = exports.MANIFEST_PROTOCOL_VERSION = exports.ADAPTER_TEAM_HEADER = exports.PROTOCOL_VERSION = void 0;
22
- exports.HostLimitRequest = exports.HostModelAnswer = exports.WireModelUsage = exports.HostModelRequest = exports.WireInboundCheck = exports.WireCheckInboundInput = exports.WireInboundRequest = exports.AdapterWakeBody = exports.AdapterEmitBody = exports.ADAPTER_DOOR_MAX_BATCH = exports.WireDiscriminableEvent = exports.RelatedPage = exports.WireManifestResult = exports.WireModuleDeclarations = exports.WireDeclaredLimit = exports.WireLimitDuration = exports.WireLimitScope = exports.LIMIT_SCOPES = exports.WireModuleSetting = exports.WireCoreSlot = exports.CORE_SLOTS = exports.WireModuleKind = exports.MODULE_KINDS = exports.WirePluginsDeclaration = exports.WirePluginSpec = exports.WirePeriodicDeclaration = exports.WirePollDeclaration = exports.WireInboundDeclaration = exports.WireModuleCheckedInboundDeclaration = exports.WireSignedInboundDeclaration = exports.WireInboundIntercept = exports.INBOUND_INTERCEPTS = exports.WireInboundSignatureScheme = exports.INBOUND_SIGNATURE_SCHEMES = exports.WireCredentialDeclaration = exports.WireOAuth2Declaration = exports.WireCredentialField = exports.WireListenDeclarations = exports.WireInvokeFieldFunctionInput = exports.WireExtractActorInput = exports.WireGetActorCandidatesInput = exports.WireDescribeOpaqueIdInput = exports.WireGetDedupRulesInput = exports.WireDedupRules = exports.WireFilterTranslationResult = exports.WireTranslateFilterInput = exports.WireReadInput = exports.WireLinkRecordsInput = exports.WireDeleteResult = exports.WireUpdateResult = void 0;
23
- exports.METHODS = exports.WirePluginResult = exports.WirePluginFile = exports.WireAwaitResolution = exports.WireAwaitLanding = exports.WireAwaitPoint = exports.WireRemoveEventSubscriptionInput = exports.WireEventSubscriptionRegistration = exports.WireEnsureEventSubscriptionInput = exports.WireEventType = exports.HostLimitGrant = void 0;
21
+ exports.WireWriteResult = exports.WireDeleteInput = exports.WireUpdateInput = exports.WireWriteInput = exports.WireGetRelatedInput = exports.WireGetFieldValueInput = exports.WireResolveEntityResult = exports.WireResolveEntityInput = exports.WireEdgesFromResult = exports.WireSchemaTypeDescriptor = exports.WireSchemaEntryPoint = exports.WireSchemaReferenceDescriptor = exports.WireSchemaFieldDescriptor = exports.WireActorCandidate = exports.WireActorIdentity = exports.WireRelatedResult = exports.WireUniquenessConstraints = exports.WireMutationContext = exports.WireFieldEvidence = exports.WireResource = exports.WireResourceProvenance = exports.WireFact = exports.WireFileRef = exports.WireLinkedObject = exports.WireTriggerEvent = exports.WireExternalRecordRef = exports.WireInboundRecordRef = exports.WireActor = exports.WireLandedRecordPosition = exports.WireSourcePosition = exports.WireEphemeralOriginRef = exports.WirePositionIdentity = exports.RpcResponse = exports.WireRetryAfter = exports.CREDENTIAL_REFUSED_CODE = exports.RpcError = exports.RpcRequest = exports.WireHostLimitsDoor = exports.WireModuleSettingValues = exports.WireCostLine = exports.WireCredentialUpdate = exports.WireCredential = exports.WireCredentialFields = exports.WireManifestProtocolMinor = exports.WireManifestProtocolVersion = exports.PROTOCOL_MINORS = exports.PROTOCOL_MINOR = exports.MANIFEST_PROTOCOL_VERSION = exports.ADAPTER_TEAM_HEADER = exports.PROTOCOL_VERSION = void 0;
22
+ exports.HostModelRequest = exports.WireInboundCheck = exports.WireCheckInboundInput = exports.WireInboundRequest = exports.AdapterWakeBody = exports.AdapterEmitBody = exports.ADAPTER_DOOR_MAX_BATCH = exports.WireDiscriminableEvent = exports.RelatedPage = exports.WireManifestResult = exports.WireModuleDeclarations = exports.WireDeclaredLimit = exports.WireLimitDuration = exports.WireLimitScope = exports.LIMIT_SCOPES = exports.WireModuleSetting = exports.WireCoreSlot = exports.CORE_SLOTS = exports.WireModuleKind = exports.MODULE_KINDS = exports.WirePluginsDeclaration = exports.WirePluginSpec = exports.WirePeriodicDeclaration = exports.WirePollDeclaration = exports.WireInboundDeclaration = exports.WireModuleCheckedInboundDeclaration = exports.WireSignedInboundDeclaration = exports.WireInboundIntercept = exports.INBOUND_INTERCEPTS = exports.WireInboundSignatureScheme = exports.INBOUND_SIGNATURE_SCHEMES = exports.WireCredentialDeclaration = exports.WireOAuth2Declaration = exports.WireCredentialField = exports.WireListenDeclarations = exports.WireInvokeFieldFunctionInput = exports.WireExtractActorInput = exports.WireGetActorCandidatesInput = exports.WireDescribeOpaqueIdInput = exports.WireGetDedupRulesInput = exports.WireDedupRules = exports.WireFilterTranslationResult = exports.WireTranslateFilterInput = exports.WireReadInput = exports.WireLinkRecordsInput = exports.WireDeleteResult = exports.WireUpdateResult = exports.WireUpdateWriteResult = exports.WireParentAssociation = exports.WireUpdateNotFound = void 0;
23
+ exports.METHODS = exports.WirePluginResult = exports.WirePluginFile = exports.WireAwaitResolution = exports.WireAwaitLanding = exports.WireAwaitPoint = exports.WireRemoveEventSubscriptionInput = exports.WireEventSubscriptionRegistration = exports.WireEnsureEventSubscriptionInput = exports.WireEventType = exports.HostLimitGrant = exports.HostLimitRequest = exports.HostModelAnswer = exports.WireModelUsage = void 0;
24
+ exports.protocolMinorOf = protocolMinorOf;
25
+ exports.protocolStanding = protocolStanding;
24
26
  exports.refuseUnpairedDeclarations = refuseUnpairedDeclarations;
25
27
  const zod_1 = require("zod");
26
28
  // ── Envelope ───────────────────────────────────────────────────────────────
@@ -35,13 +37,71 @@ exports.ADAPTER_TEAM_HEADER = 'x-listen-fire-team';
35
37
  /** The same version as the manifest's `protocolVersion` field. A number there
36
38
  * because manifests are hand-written files, where `2` is what an author types. */
37
39
  exports.MANIFEST_PROTOCOL_VERSION = 2;
40
+ /** The highest minor of version 2 this release speaks: a host reads 2.0 to
41
+ * 2.`PROTOCOL_MINOR` (docs/contracts/adapter-protocol.md "Minors of version 2"). */
42
+ exports.PROTOCOL_MINOR = 2;
43
+ /** Each minor of version 2 and the feature that a manifest using it lists. A
44
+ * minor whose feature a manifest cannot show (2.0's) has no row. */
45
+ exports.PROTOCOL_MINORS = [
46
+ { minor: 1, feature: 'a <slot>.watch method', uses: { methodEndingWith: '.watch' } },
47
+ { minor: 2, feature: 'work.enqueueIfAbsent', uses: { method: 'work.enqueueIfAbsent' } },
48
+ ];
49
+ function lists(methods, uses) {
50
+ return 'method' in uses ? methods.includes(uses.method) : methods.some((method) => method.endsWith(uses.methodEndingWith));
51
+ }
52
+ /** The minor a manifest states: the highest among the features it lists, so a
53
+ * module rebuilt with a newer kit is never refused by an older host for a
54
+ * feature it does not use. */
55
+ function protocolMinorOf(manifest) {
56
+ return exports.PROTOCOL_MINORS.reduce((highest, { minor, uses }) => (lists(manifest.methods, uses) ? Math.max(highest, minor) : highest), 0);
57
+ }
58
+ function olderProtocolText(got, module) {
59
+ return (`protocolVersion: expected ${exports.MANIFEST_PROTOCOL_VERSION}, got ${JSON.stringify(got) ?? 'nothing'} — ` +
60
+ `this ${module} targets an older adapter protocol; update it to protocol version ${exports.MANIFEST_PROTOCOL_VERSION}.`);
61
+ }
38
62
  /** A manifest's `protocolVersion`, shared by the server's `manifest` answer and
39
- * the installable manifest file so both refuse an older adapter in the same
40
- * words. */
63
+ * the installable manifest file so both refuse a module in the same words,
64
+ * naming which way it is out of step. */
41
65
  exports.WireManifestProtocolVersion = zod_1.z.literal(exports.MANIFEST_PROTOCOL_VERSION, {
42
- error: (issue) => `protocolVersion: expected ${exports.MANIFEST_PROTOCOL_VERSION}, got ${JSON.stringify(issue.input) ?? 'nothing'} — ` +
43
- `this adapter targets an older adapter protocol; update it to protocol version ${exports.MANIFEST_PROTOCOL_VERSION}.`,
66
+ error: (issue) => typeof issue.input === 'number' && issue.input > exports.MANIFEST_PROTOCOL_VERSION
67
+ ? `protocolVersion: expected ${exports.MANIFEST_PROTOCOL_VERSION}, got ${issue.input} — this adapter targets a newer adapter protocol; upgrade to a release that speaks it.`
68
+ : olderProtocolText(issue.input, 'adapter'),
44
69
  });
70
+ /** A manifest's `protocolMinor`: absent is unstated, read as 2.0. */
71
+ exports.WireManifestProtocolMinor = zod_1.z.number().int().min(0).optional();
72
+ /** Whether a host speaking 2.0 to 2.`PROTOCOL_MINOR` reads a module whose
73
+ * manifest is `raw`, and if not, why in words naming both sides. lf's twin
74
+ * is `protocol::protocol_standing` (crates/lf), in the same words. */
75
+ function protocolStanding(raw, speaker) {
76
+ const field = (key) => (raw !== null && typeof raw === 'object' ? Reflect.get(raw, key) : undefined);
77
+ const version = field('protocolVersion');
78
+ const minor = field('protocolMinor');
79
+ const named = speaker.name === undefined ? undefined : speaker.slot === undefined ? `external "${speaker.name}"` : `core module "${speaker.name}" (${speaker.slot} slot)`;
80
+ const subject = named === undefined ? undefined : speaker.package === undefined ? named : `${named} (${speaker.package.name} ${speaker.package.version})`;
81
+ const prefixed = (text) => (subject === undefined ? text : `${subject}: ${text}`);
82
+ const host = `this ${speaker.host.name} (${speaker.host.version}) speaks ${exports.MANIFEST_PROTOCOL_VERSION}.0–${exports.MANIFEST_PROTOCOL_VERSION}.${exports.PROTOCOL_MINOR}`;
83
+ if (typeof version === 'number' && version > exports.MANIFEST_PROTOCOL_VERSION) {
84
+ return { ok: false, message: prefixed(`${subject === undefined ? 'it ' : ''}speaks adapter protocol ${version}; ${host}. Upgrade ${speaker.host.name}.`) };
85
+ }
86
+ if (version !== exports.MANIFEST_PROTOCOL_VERSION) {
87
+ return { ok: false, message: prefixed(olderProtocolText(version, speaker.slot === undefined ? 'adapter' : 'module')) };
88
+ }
89
+ if (minor === undefined)
90
+ return { ok: true };
91
+ if (typeof minor !== 'number' || !Number.isInteger(minor) || minor < 0) {
92
+ return { ok: false, message: prefixed(`protocolMinor: expected a whole number, got ${JSON.stringify(minor)}.`) };
93
+ }
94
+ if (minor <= exports.PROTOCOL_MINOR)
95
+ return { ok: true };
96
+ const stated = `${exports.MANIFEST_PROTOCOL_VERSION}.${minor}`;
97
+ const older = speaker.package === undefined ? 'a version of it' : `a ${speaker.package.name}`;
98
+ return {
99
+ ok: false,
100
+ message: `${subject ?? 'it'} speaks adapter protocol ${stated}; ${host}. ` +
101
+ `Upgrade ${speaker.host.name} to a release that speaks ${stated} (the protocol's Changes list names it), ` +
102
+ `or use ${older} that speaks ${exports.MANIFEST_PROTOCOL_VERSION}.${exports.PROTOCOL_MINOR} or lower.`,
103
+ };
104
+ }
45
105
  /** A credential's fields as stored, every value a string (`expires_at` an ISO
46
106
  * time). */
47
107
  exports.WireCredentialFields = zod_1.z.record(zod_1.z.string(), zod_1.z.string());
@@ -851,6 +911,7 @@ exports.WireManifestResult = zod_1.z.object({
851
911
  ...exports.WireListenDeclarations.shape,
852
912
  ...exports.WireModuleDeclarations.shape,
853
913
  protocolVersion: exports.WireManifestProtocolVersion,
914
+ protocolMinor: exports.WireManifestProtocolMinor,
854
915
  adapterType: zod_1.z.string(),
855
916
  supportedTriggers: zod_1.z.array(zod_1.z.string()),
856
917
  // Whole-adapter capability (mirrors `Adapter.runtimeCapabilities()`):
@@ -27,6 +27,7 @@ export declare const SlotAnswerEnvelope: z.ZodUnion<readonly [z.ZodObject<{
27
27
  /** What a core module answers `manifest` with. */
28
28
  export declare const WireSlotManifest: z.ZodObject<{
29
29
  protocolVersion: z.ZodLiteral<2>;
30
+ protocolMinor: z.ZodOptional<z.ZodNumber>;
30
31
  name: z.ZodString;
31
32
  kind: z.ZodLiteral<"core">;
32
33
  slot: z.ZodEnum<{
@@ -38,6 +38,7 @@ exports.SlotAnswerEnvelope = zod_1.z.union([
38
38
  /** What a core module answers `manifest` with. */
39
39
  exports.WireSlotManifest = zod_1.z.object({
40
40
  protocolVersion: zod_1.z.literal(2),
41
+ protocolMinor: protocol_1.WireManifestProtocolMinor,
41
42
  name: zod_1.z.string().min(1),
42
43
  kind: zod_1.z.literal('core'),
43
44
  slot: zod_1.z.enum(protocol_1.CORE_SLOTS),
package/dist/tenant.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  /** A tenant id as it crosses a wire: any non-empty string, branded on parse. */
3
- export declare const tenantIdSchema: z.core.$ZodBranded<z.ZodString, "TenantId">;
3
+ export declare const tenantIdSchema: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
4
4
  /** An opaque tenant id. Mint one with `tenantIdOf`. */
5
5
  export type TenantId = z.infer<typeof tenantIdSchema>;
6
6
  /** The tenant id a host's own identifier stands for. Refuses the empty
@@ -19,6 +19,9 @@ export interface ContractStanding {
19
19
  current: number;
20
20
  supported: readonly number[];
21
21
  deprecated: readonly number[];
22
+ /** The highest minor of `current` this release speaks, for a contract
23
+ * versioned 2.N (the adapter protocol): it reads every minor from 0 up. */
24
+ minor?: number;
22
25
  }
23
26
  /** What this release speaks, contract by contract: the index
24
27
  * docs/contracts/README.md tabulates. */
@@ -42,6 +45,7 @@ export declare const CONTRACTS: {
42
45
  readonly current: 2;
43
46
  readonly supported: readonly [2];
44
47
  readonly deprecated: readonly [];
48
+ readonly minor: 2;
45
49
  };
46
50
  readonly 'system-caller': {
47
51
  readonly current: 1;
package/dist/versions.js CHANGED
@@ -46,7 +46,7 @@ exports.CONTRACTS = {
46
46
  supported: [...exports.SUPPORTED_HOST_FAMILIES_VERSIONS],
47
47
  deprecated: [],
48
48
  },
49
- 'adapter-protocol': { current: protocol_1.MANIFEST_PROTOCOL_VERSION, supported: [protocol_1.MANIFEST_PROTOCOL_VERSION], deprecated: [] },
49
+ 'adapter-protocol': { current: protocol_1.MANIFEST_PROTOCOL_VERSION, supported: [protocol_1.MANIFEST_PROTOCOL_VERSION], deprecated: [], minor: protocol_1.PROTOCOL_MINOR },
50
50
  'system-caller': { current: exports.SYSTEM_CALLER_VERSION, supported: [exports.SYSTEM_CALLER_VERSION], deprecated: [] },
51
51
  // The shape of what the check settled, for a surface that draws a movement's story (docs/contracts/story-analysis.md).
52
52
  'story-analysis': { current: movement_lang_1.STORY_ANALYSIS_VERSION, supported: [...movement_lang_1.SUPPORTED_STORY_ANALYSIS_VERSIONS], deprecated: [] },
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.12.5",
4
+ "version": "0.12.7",
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.12.5"
33
+ "@listen-fire/movement-lang": "^0.12.7"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.16.5",