@automate.ax/api-contract 0.57.3 → 0.57.4

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
@@ -1129,6 +1129,33 @@ export declare const contract: {
1129
1129
  streamName: import("zod").ZodString;
1130
1130
  streamNames: import("zod").ZodArray<import("zod").ZodString>;
1131
1131
  ttl: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
1132
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1133
+ actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1134
+ eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1135
+ scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
1136
+ signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1137
+ slot: import("zod").ZodNumber;
1138
+ key: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1139
+ maxBurstDuration: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
1140
+ minGap: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
1141
+ minQuietPeriod: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
1142
+ outcomeSeq: import("zod").ZodNumber;
1143
+ policy: import("zod").ZodLiteral<"funnel">;
1144
+ primaryPosition: import("zod").ZodEnum<{
1145
+ first: "first";
1146
+ last: "last";
1147
+ }>;
1148
+ selection: import("zod").ZodEnum<{
1149
+ first: "first";
1150
+ last: "last";
1151
+ all: "all";
1152
+ }>;
1153
+ triggerAt: import("zod").ZodEnum<{
1154
+ start: "start";
1155
+ end: "end";
1156
+ both: "both";
1157
+ }>;
1158
+ ttl: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
1132
1159
  }, import("zod/v4/core").$strip>, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
1133
1160
  actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1134
1161
  eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
@@ -1169,22 +1196,7 @@ export declare const contract: {
1169
1196
  scopeOrigins: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
1170
1197
  selectedIndex: import("zod").ZodNumber;
1171
1198
  status: import("zod").ZodLiteral<"succeeded">;
1172
- }, import("zod/v4/core").$strip>]>, import("zod").ZodObject<{
1173
- actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1174
- eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1175
- scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
1176
- signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1177
- slot: import("zod").ZodNumber;
1178
- duration: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
1179
- key: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1180
- outcomeSeq: import("zod").ZodNumber;
1181
- policy: import("zod").ZodLiteral<"window">;
1182
- primaryPosition: import("zod").ZodEnum<{
1183
- first: "first";
1184
- last: "last";
1185
- }>;
1186
- ttl: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
1187
- }, import("zod/v4/core").$strip>]>>>;
1199
+ }, import("zod/v4/core").$strip>]>]>>>;
1188
1200
  settled: import("zod").ZodDefault<import("zod").ZodBoolean>;
1189
1201
  signalInvocations: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
1190
1202
  actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
package/dist/runtime.d.ts CHANGED
@@ -261,6 +261,33 @@ export declare const runtimeContract: {
261
261
  streamName: z.ZodString;
262
262
  streamNames: z.ZodArray<z.ZodString>;
263
263
  ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
264
+ }, z.core.$strip>, z.ZodObject<{
265
+ actionDependencyIds: z.ZodArray<z.ZodString>;
266
+ eventDependencyIds: z.ZodArray<z.ZodString>;
267
+ scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
268
+ signalDependencyIds: z.ZodArray<z.ZodString>;
269
+ slot: z.ZodNumber;
270
+ key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
271
+ maxBurstDuration: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
272
+ minGap: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
273
+ minQuietPeriod: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
274
+ outcomeSeq: z.ZodNumber;
275
+ policy: z.ZodLiteral<"funnel">;
276
+ primaryPosition: z.ZodEnum<{
277
+ first: "first";
278
+ last: "last";
279
+ }>;
280
+ selection: z.ZodEnum<{
281
+ first: "first";
282
+ last: "last";
283
+ all: "all";
284
+ }>;
285
+ triggerAt: z.ZodEnum<{
286
+ start: "start";
287
+ end: "end";
288
+ both: "both";
289
+ }>;
290
+ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
264
291
  }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
265
292
  actionDependencyIds: z.ZodArray<z.ZodString>;
266
293
  eventDependencyIds: z.ZodArray<z.ZodString>;
@@ -301,22 +328,7 @@ export declare const runtimeContract: {
301
328
  scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
302
329
  selectedIndex: z.ZodNumber;
303
330
  status: z.ZodLiteral<"succeeded">;
304
- }, z.core.$strip>]>, z.ZodObject<{
305
- actionDependencyIds: z.ZodArray<z.ZodString>;
306
- eventDependencyIds: z.ZodArray<z.ZodString>;
307
- scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
308
- signalDependencyIds: z.ZodArray<z.ZodString>;
309
- slot: z.ZodNumber;
310
- duration: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
311
- key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
312
- outcomeSeq: z.ZodNumber;
313
- policy: z.ZodLiteral<"window">;
314
- primaryPosition: z.ZodEnum<{
315
- first: "first";
316
- last: "last";
317
- }>;
318
- ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
319
- }, z.core.$strip>]>>>;
331
+ }, z.core.$strip>]>]>>>;
320
332
  settled: z.ZodDefault<z.ZodBoolean>;
321
333
  signalInvocations: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
322
334
  actionDependencyIds: z.ZodArray<z.ZodString>;
package/dist/runtime.js CHANGED
@@ -120,6 +120,10 @@ const SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA = z.object({
120
120
  slot: z.number().int().nonnegative(),
121
121
  });
122
122
  const COORDINATION_PRIMARY_POSITION_SCHEMA = z.enum(["first", "last"]);
123
+ const COORDINATION_DURATION_SCHEMA = z.union([
124
+ z.string().min(1),
125
+ z.number().nonnegative(),
126
+ ]);
123
127
  const CORRELATION_STREAM_NAMES_SCHEMA = z
124
128
  .string()
125
129
  .min(1)
@@ -162,13 +166,42 @@ const COLLECTION_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
162
166
  primaryPosition: COORDINATION_PRIMARY_POSITION_SCHEMA,
163
167
  ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
164
168
  });
165
- const WINDOW_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
166
- duration: z.union([z.string().min(1), z.number().nonnegative()]),
169
+ const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
167
170
  key: encodableSchema,
171
+ maxBurstDuration: COORDINATION_DURATION_SCHEMA.optional(),
172
+ minGap: COORDINATION_DURATION_SCHEMA.optional(),
173
+ minQuietPeriod: COORDINATION_DURATION_SCHEMA.optional(),
168
174
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
169
- policy: z.literal("window"),
175
+ policy: z.literal("funnel"),
170
176
  primaryPosition: COORDINATION_PRIMARY_POSITION_SCHEMA,
171
- ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
177
+ selection: z.enum(["all", "first", "last"]),
178
+ triggerAt: z.enum(["start", "end", "both"]),
179
+ ttl: COORDINATION_DURATION_SCHEMA.optional(),
180
+ }).superRefine((offer, context) => {
181
+ if (offer.triggerAt === "end" &&
182
+ offer.minGap !== undefined &&
183
+ offer.minQuietPeriod === undefined &&
184
+ offer.maxBurstDuration === undefined) {
185
+ context.addIssue({
186
+ code: "custom",
187
+ message: "A trailing funnel with minGap also requires minQuietPeriod or maxBurstDuration.",
188
+ path: ["minGap"],
189
+ });
190
+ }
191
+ if (offer.selection !== "all" && offer.selection !== offer.primaryPosition) {
192
+ context.addIssue({
193
+ code: "custom",
194
+ message: "A selecting funnel must continue from its selected occurrence.",
195
+ path: ["primaryPosition"],
196
+ });
197
+ }
198
+ if (offer.triggerAt === "start" && offer.selection !== "first") {
199
+ context.addIssue({
200
+ code: "custom",
201
+ message: "A start-only funnel can only select its first occurrence.",
202
+ path: ["selection"],
203
+ });
204
+ }
172
205
  });
173
206
  const RACE_OFFER_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
174
207
  inputOrigins: z.string().array().array().min(1),
@@ -480,8 +513,8 @@ export const runtimeContract = {
480
513
  .union([
481
514
  COLLECTION_OFFER_SCHEMA,
482
515
  CORRELATION_OFFER_SCHEMA,
516
+ FUNNEL_OFFER_SCHEMA,
483
517
  RACE_OFFER_SCHEMA,
484
- WINDOW_OFFER_SCHEMA,
485
518
  ])
486
519
  .array()
487
520
  .default([]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.57.3",
3
+ "version": "0.57.4",
4
4
  "description": "Public oRPC contract for the Automate.ax API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@ai-sdk/gateway": "^4.0.46",
31
- "@automate.ax/codec": "0.57.3",
31
+ "@automate.ax/codec": "0.57.4",
32
32
  "@orpc/contract": "1.15.0",
33
33
  "zod": "^4.3.6"
34
34
  },
package/src/runtime.ts CHANGED
@@ -137,6 +137,10 @@ const SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA = z.object({
137
137
  })
138
138
 
139
139
  const COORDINATION_PRIMARY_POSITION_SCHEMA = z.enum(["first", "last"])
140
+ const COORDINATION_DURATION_SCHEMA = z.union([
141
+ z.string().min(1),
142
+ z.number().nonnegative(),
143
+ ])
140
144
  const CORRELATION_STREAM_NAMES_SCHEMA = z
141
145
  .string()
142
146
  .min(1)
@@ -184,13 +188,45 @@ const COLLECTION_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
184
188
  ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
185
189
  })
186
190
 
187
- const WINDOW_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
188
- duration: z.union([z.string().min(1), z.number().nonnegative()]),
191
+ const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
189
192
  key: encodableSchema,
193
+ maxBurstDuration: COORDINATION_DURATION_SCHEMA.optional(),
194
+ minGap: COORDINATION_DURATION_SCHEMA.optional(),
195
+ minQuietPeriod: COORDINATION_DURATION_SCHEMA.optional(),
190
196
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
191
- policy: z.literal("window"),
197
+ policy: z.literal("funnel"),
192
198
  primaryPosition: COORDINATION_PRIMARY_POSITION_SCHEMA,
193
- ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
199
+ selection: z.enum(["all", "first", "last"]),
200
+ triggerAt: z.enum(["start", "end", "both"]),
201
+ ttl: COORDINATION_DURATION_SCHEMA.optional(),
202
+ }).superRefine((offer, context) => {
203
+ if (
204
+ offer.triggerAt === "end" &&
205
+ offer.minGap !== undefined &&
206
+ offer.minQuietPeriod === undefined &&
207
+ offer.maxBurstDuration === undefined
208
+ ) {
209
+ context.addIssue({
210
+ code: "custom",
211
+ message:
212
+ "A trailing funnel with minGap also requires minQuietPeriod or maxBurstDuration.",
213
+ path: ["minGap"],
214
+ })
215
+ }
216
+ if (offer.selection !== "all" && offer.selection !== offer.primaryPosition) {
217
+ context.addIssue({
218
+ code: "custom",
219
+ message: "A selecting funnel must continue from its selected occurrence.",
220
+ path: ["primaryPosition"],
221
+ })
222
+ }
223
+ if (offer.triggerAt === "start" && offer.selection !== "first") {
224
+ context.addIssue({
225
+ code: "custom",
226
+ message: "A start-only funnel can only select its first occurrence.",
227
+ path: ["selection"],
228
+ })
229
+ }
194
230
  })
195
231
 
196
232
  const RACE_OFFER_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
@@ -552,8 +588,8 @@ export const runtimeContract = {
552
588
  .union([
553
589
  COLLECTION_OFFER_SCHEMA,
554
590
  CORRELATION_OFFER_SCHEMA,
591
+ FUNNEL_OFFER_SCHEMA,
555
592
  RACE_OFFER_SCHEMA,
556
- WINDOW_OFFER_SCHEMA,
557
593
  ])
558
594
  .array()
559
595
  .default([]),