@automate.ax/api-contract 0.61.0 → 0.62.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/index.d.ts CHANGED
@@ -1124,11 +1124,11 @@ export declare const contract: {
1124
1124
  signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1125
1125
  slot: import("zod").ZodNumber;
1126
1126
  key: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1127
- order: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1127
+ ordered: import("zod").ZodBoolean;
1128
1128
  outcomeSeq: import("zod").ZodNumber;
1129
1129
  policy: import("zod").ZodLiteral<"correlate">;
1130
- streamName: import("zod").ZodString;
1131
- streamNames: import("zod").ZodArray<import("zod").ZodString>;
1130
+ streamIndex: import("zod").ZodNumber;
1131
+ streamOrigins: import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodString>>;
1132
1132
  ttl: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
1133
1133
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1134
1134
  actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
package/dist/runtime.d.ts CHANGED
@@ -61,11 +61,11 @@ declare const COORDINATION_OFFER_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
61
61
  signalDependencyIds: z.ZodArray<z.ZodString>;
62
62
  slot: z.ZodNumber;
63
63
  key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
64
- order: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
+ ordered: z.ZodBoolean;
65
65
  outcomeSeq: z.ZodNumber;
66
66
  policy: z.ZodLiteral<"correlate">;
67
- streamName: z.ZodString;
68
- streamNames: z.ZodArray<z.ZodString>;
67
+ streamIndex: z.ZodNumber;
68
+ streamOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
69
69
  ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
70
70
  }, z.core.$strip>, z.ZodObject<{
71
71
  actionDependencyIds: z.ZodArray<z.ZodString>;
@@ -364,11 +364,11 @@ export declare const runtimeContract: {
364
364
  signalDependencyIds: z.ZodArray<z.ZodString>;
365
365
  slot: z.ZodNumber;
366
366
  key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
367
- order: z.ZodOptional<z.ZodArray<z.ZodString>>;
367
+ ordered: z.ZodBoolean;
368
368
  outcomeSeq: z.ZodNumber;
369
369
  policy: z.ZodLiteral<"correlate">;
370
- streamName: z.ZodString;
371
- streamNames: z.ZodArray<z.ZodString>;
370
+ streamIndex: z.ZodNumber;
371
+ streamOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
372
372
  ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
373
373
  }, z.core.$strip>, z.ZodObject<{
374
374
  actionDependencyIds: z.ZodArray<z.ZodString>;
package/dist/runtime.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { encodableSchema } from "@automate.ax/codec";
2
2
  import { oc } from "@orpc/contract";
3
+ import stableStringify from "fast-json-stable-stringify";
3
4
  import { z } from "zod";
4
5
  /** Default model used by the platform Vercel AI Gateway account. */
5
6
  export const DEFAULT_GATEWAY_MODEL_ID = "openai/gpt-4.1-nano";
@@ -141,37 +142,27 @@ const COORDINATION_DURATION_SCHEMA = z.union([
141
142
  z.string().min(1),
142
143
  z.number().nonnegative(),
143
144
  ]);
144
- const CORRELATION_STREAM_NAMES_SCHEMA = z
145
+ const CORRELATION_STREAM_ORIGINS_SCHEMA = z
145
146
  .string()
146
147
  .min(1)
147
148
  .array()
148
- .min(2)
149
- .refine((names) => new Set(names).size === names.length, {
150
- message: "Correlation stream names must be unique.",
151
- });
149
+ .min(1)
150
+ .array()
151
+ .min(2);
152
152
  const CORRELATION_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
153
153
  key: encodableSchema,
154
- order: CORRELATION_STREAM_NAMES_SCHEMA.optional(),
154
+ ordered: z.boolean(),
155
155
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
156
156
  policy: z.literal("correlate"),
157
- streamName: z.string().min(1),
158
- streamNames: CORRELATION_STREAM_NAMES_SCHEMA,
157
+ streamIndex: z.number().int().nonnegative(),
158
+ streamOrigins: CORRELATION_STREAM_ORIGINS_SCHEMA,
159
159
  ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
160
160
  }).superRefine((entry, context) => {
161
- if (!entry.streamNames.includes(entry.streamName)) {
162
- context.addIssue({
163
- code: "custom",
164
- message: "Correlation stream must be included in streamNames.",
165
- path: ["streamName"],
166
- });
167
- }
168
- if (entry.order &&
169
- (entry.order.length !== entry.streamNames.length ||
170
- entry.order.some((name) => !entry.streamNames.includes(name)))) {
161
+ if (entry.streamIndex >= entry.streamOrigins.length) {
171
162
  context.addIssue({
172
163
  code: "custom",
173
- message: "Correlation order must name every stream exactly once.",
174
- path: ["order"],
164
+ message: "Correlation stream index must identify an input stream.",
165
+ path: ["streamIndex"],
175
166
  });
176
167
  }
177
168
  });
@@ -544,8 +535,8 @@ export async function hashSignalCoordinatorConfiguration(definition, primaryPosi
544
535
  value,
545
536
  ]))
546
537
  : definition;
547
- return await sha256Base64Url(JSON.stringify({
548
- definitionHash: await sha256Base64Url(JSON.stringify(persistedDefinition)),
538
+ return await sha256Base64Url(stableStringify({
539
+ definitionHash: await sha256Base64Url(stableStringify(persistedDefinition)),
549
540
  primaryPosition: primaryPosition ??
550
541
  (policy === "fanout" || policy === "race" ? "first" : null),
551
542
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "Public oRPC contract for the Automate.ax API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,8 +28,9 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@ai-sdk/gateway": "^4.0.46",
31
- "@automate.ax/codec": "0.61.0",
31
+ "@automate.ax/codec": "0.62.0",
32
32
  "@orpc/contract": "1.15.0",
33
+ "fast-json-stable-stringify": "^2.1.0",
33
34
  "zod": "^4.3.6"
34
35
  },
35
36
  "devDependencies": {
package/src/runtime.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { encodableSchema } from "@automate.ax/codec"
2
2
  import type { GatewayModelId } from "@ai-sdk/gateway"
3
3
  import { oc } from "@orpc/contract"
4
+ import stableStringify from "fast-json-stable-stringify"
4
5
  import { z } from "zod"
5
6
 
6
7
  /** Default model used by the platform Vercel AI Gateway account. */
@@ -158,40 +159,28 @@ const COORDINATION_DURATION_SCHEMA = z.union([
158
159
  z.string().min(1),
159
160
  z.number().nonnegative(),
160
161
  ])
161
- const CORRELATION_STREAM_NAMES_SCHEMA = z
162
+ const CORRELATION_STREAM_ORIGINS_SCHEMA = z
162
163
  .string()
163
164
  .min(1)
164
165
  .array()
166
+ .min(1)
167
+ .array()
165
168
  .min(2)
166
- .refine((names) => new Set(names).size === names.length, {
167
- message: "Correlation stream names must be unique.",
168
- })
169
169
 
170
170
  const CORRELATION_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
171
171
  key: encodableSchema,
172
- order: CORRELATION_STREAM_NAMES_SCHEMA.optional(),
172
+ ordered: z.boolean(),
173
173
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
174
174
  policy: z.literal("correlate"),
175
- streamName: z.string().min(1),
176
- streamNames: CORRELATION_STREAM_NAMES_SCHEMA,
175
+ streamIndex: z.number().int().nonnegative(),
176
+ streamOrigins: CORRELATION_STREAM_ORIGINS_SCHEMA,
177
177
  ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
178
178
  }).superRefine((entry, context) => {
179
- if (!entry.streamNames.includes(entry.streamName)) {
180
- context.addIssue({
181
- code: "custom",
182
- message: "Correlation stream must be included in streamNames.",
183
- path: ["streamName"],
184
- })
185
- }
186
- if (
187
- entry.order &&
188
- (entry.order.length !== entry.streamNames.length ||
189
- entry.order.some((name) => !entry.streamNames.includes(name)))
190
- ) {
179
+ if (entry.streamIndex >= entry.streamOrigins.length) {
191
180
  context.addIssue({
192
181
  code: "custom",
193
- message: "Correlation order must name every stream exactly once.",
194
- path: ["order"],
182
+ message: "Correlation stream index must identify an input stream.",
183
+ path: ["streamIndex"],
195
184
  })
196
185
  }
197
186
  })
@@ -622,9 +611,9 @@ export async function hashSignalCoordinatorConfiguration(
622
611
  )
623
612
  : definition
624
613
  return await sha256Base64Url(
625
- JSON.stringify({
614
+ stableStringify({
626
615
  definitionHash: await sha256Base64Url(
627
- JSON.stringify(persistedDefinition),
616
+ stableStringify(persistedDefinition),
628
617
  ),
629
618
  primaryPosition:
630
619
  primaryPosition ??