@automate.ax/api-contract 0.137.0 → 0.139.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/deployment.d.ts +2 -2
- package/dist/events/anthropic.d.ts +4 -0
- package/dist/events/anthropic.js +16 -0
- package/dist/events/index.d.ts +151 -150
- package/dist/events/index.js +2 -0
- package/dist/events/notion.d.ts +150 -150
- package/dist/index.d.ts +262 -155
- package/dist/runtime-protocol.d.ts +1 -1
- package/dist/runtime-protocol.js +1 -1
- package/dist/runtime.d.ts +212 -0
- package/dist/runtime.js +46 -0
- package/package.json +3 -3
- package/src/events/anthropic.ts +18 -0
- package/src/events/index.ts +2 -0
- package/src/runtime-protocol.ts +1 -1
- package/src/runtime.ts +60 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Runtime protocol required by newly built automation bundles. */
|
|
2
|
-
export declare const AUTOMATION_RUNTIME_PROTOCOL_VERSION =
|
|
2
|
+
export declare const AUTOMATION_RUNTIME_PROTOCOL_VERSION = 5;
|
package/dist/runtime-protocol.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Runtime protocol required by newly built automation bundles. */
|
|
2
|
-
export const AUTOMATION_RUNTIME_PROTOCOL_VERSION =
|
|
2
|
+
export const AUTOMATION_RUNTIME_PROTOCOL_VERSION = 5;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -142,6 +142,16 @@ declare const COORDINATION_OFFER_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
142
142
|
roots: z.ZodArray<z.ZodNumber>;
|
|
143
143
|
}, z.core.$strip>>;
|
|
144
144
|
key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
145
|
+
inputPolicies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
consumption: z.ZodEnum<{
|
|
147
|
+
consume: "consume";
|
|
148
|
+
retain: "retain";
|
|
149
|
+
}>;
|
|
150
|
+
selection: z.ZodEnum<{
|
|
151
|
+
oldest: "oldest";
|
|
152
|
+
latest: "latest";
|
|
153
|
+
}>;
|
|
154
|
+
}, z.core.$strip>>>;
|
|
145
155
|
occurrenceTtl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
146
156
|
ordered: z.ZodBoolean;
|
|
147
157
|
outcomeSeq: z.ZodNumber;
|
|
@@ -149,6 +159,38 @@ declare const COORDINATION_OFFER_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
149
159
|
streamIndex: z.ZodNumber;
|
|
150
160
|
streamOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
151
161
|
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
164
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
165
|
+
scopePath: z.ZodArray<z.ZodNumber>;
|
|
166
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
167
|
+
slot: z.ZodNumber;
|
|
168
|
+
derivation: z.ZodNullable<z.ZodObject<{
|
|
169
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
source: z.ZodEnum<{
|
|
172
|
+
action: "action";
|
|
173
|
+
event: "event";
|
|
174
|
+
signal: "signal";
|
|
175
|
+
}>;
|
|
176
|
+
type: z.ZodLiteral<"source">;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
179
|
+
property: z.ZodString;
|
|
180
|
+
type: z.ZodLiteral<"property">;
|
|
181
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
182
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
183
|
+
type: z.ZodLiteral<"transform">;
|
|
184
|
+
}, z.core.$strip>], "type">>;
|
|
185
|
+
roots: z.ZodArray<z.ZodNumber>;
|
|
186
|
+
}, z.core.$strip>>;
|
|
187
|
+
key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
188
|
+
limit: z.ZodNumber;
|
|
189
|
+
outcomeSeq: z.ZodNumber;
|
|
190
|
+
policy: z.ZodLiteral<"concurrent">;
|
|
191
|
+
releaseScopePath: z.ZodArray<z.ZodNumber>;
|
|
192
|
+
releaseSlot: z.ZodNumber;
|
|
193
|
+
sourceOrigins: z.ZodArray<z.ZodString>;
|
|
152
194
|
}, z.core.$strip>, z.ZodObject<{
|
|
153
195
|
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
154
196
|
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
@@ -253,6 +295,40 @@ declare const COORDINATION_OFFER_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
253
295
|
outcomeSeq: z.ZodNumber;
|
|
254
296
|
policy: z.ZodLiteral<"merge">;
|
|
255
297
|
selectedIndex: z.ZodNumber;
|
|
298
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
299
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
300
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
301
|
+
scopePath: z.ZodArray<z.ZodNumber>;
|
|
302
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
303
|
+
slot: z.ZodNumber;
|
|
304
|
+
derivation: z.ZodNullable<z.ZodObject<{
|
|
305
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
306
|
+
id: z.ZodString;
|
|
307
|
+
source: z.ZodEnum<{
|
|
308
|
+
action: "action";
|
|
309
|
+
event: "event";
|
|
310
|
+
signal: "signal";
|
|
311
|
+
}>;
|
|
312
|
+
type: z.ZodLiteral<"source">;
|
|
313
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
314
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
315
|
+
property: z.ZodString;
|
|
316
|
+
type: z.ZodLiteral<"property">;
|
|
317
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
318
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
319
|
+
type: z.ZodLiteral<"transform">;
|
|
320
|
+
}, z.core.$strip>], "type">>;
|
|
321
|
+
roots: z.ZodArray<z.ZodNumber>;
|
|
322
|
+
}, z.core.$strip>>;
|
|
323
|
+
interval: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
324
|
+
key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
325
|
+
limit: z.ZodNumber;
|
|
326
|
+
outcomeSeq: z.ZodNumber;
|
|
327
|
+
overflow: z.ZodEnum<{
|
|
328
|
+
drop: "drop";
|
|
329
|
+
wait: "wait";
|
|
330
|
+
}>;
|
|
331
|
+
policy: z.ZodLiteral<"rateLimit">;
|
|
256
332
|
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
257
333
|
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
258
334
|
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
@@ -390,6 +466,36 @@ declare const COORDINATION_OFFER_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
390
466
|
releaseScopePath: z.ZodArray<z.ZodNumber>;
|
|
391
467
|
releaseSlot: z.ZodNumber;
|
|
392
468
|
sourceOrigins: z.ZodArray<z.ZodString>;
|
|
469
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
470
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
471
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
472
|
+
scopePath: z.ZodArray<z.ZodNumber>;
|
|
473
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
474
|
+
slot: z.ZodNumber;
|
|
475
|
+
derivation: z.ZodNullable<z.ZodObject<{
|
|
476
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
477
|
+
id: z.ZodString;
|
|
478
|
+
source: z.ZodEnum<{
|
|
479
|
+
action: "action";
|
|
480
|
+
event: "event";
|
|
481
|
+
signal: "signal";
|
|
482
|
+
}>;
|
|
483
|
+
type: z.ZodLiteral<"source">;
|
|
484
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
485
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
486
|
+
property: z.ZodString;
|
|
487
|
+
type: z.ZodLiteral<"property">;
|
|
488
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
489
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
490
|
+
type: z.ZodLiteral<"transform">;
|
|
491
|
+
}, z.core.$strip>], "type">>;
|
|
492
|
+
roots: z.ZodArray<z.ZodNumber>;
|
|
493
|
+
}, z.core.$strip>>;
|
|
494
|
+
count: z.ZodNumber;
|
|
495
|
+
key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
496
|
+
outcomeSeq: z.ZodNumber;
|
|
497
|
+
policy: z.ZodLiteral<"take">;
|
|
498
|
+
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
393
499
|
}, z.core.$strip>]>;
|
|
394
500
|
/** One validated durable coordination offer sent by the automation runtime. */
|
|
395
501
|
export type RuntimeCoordinationOffer = z.output<typeof COORDINATION_OFFER_SCHEMA>;
|
|
@@ -1440,6 +1546,16 @@ export declare const runtimeContract: {
|
|
|
1440
1546
|
roots: z.ZodArray<z.ZodNumber>;
|
|
1441
1547
|
}, z.core.$strip>>;
|
|
1442
1548
|
key: z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>;
|
|
1549
|
+
inputPolicies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1550
|
+
consumption: z.ZodEnum<{
|
|
1551
|
+
consume: "consume";
|
|
1552
|
+
retain: "retain";
|
|
1553
|
+
}>;
|
|
1554
|
+
selection: z.ZodEnum<{
|
|
1555
|
+
oldest: "oldest";
|
|
1556
|
+
latest: "latest";
|
|
1557
|
+
}>;
|
|
1558
|
+
}, z.core.$strip>>>;
|
|
1443
1559
|
occurrenceTtl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1444
1560
|
ordered: z.ZodBoolean;
|
|
1445
1561
|
outcomeSeq: z.ZodNumber;
|
|
@@ -1447,6 +1563,38 @@ export declare const runtimeContract: {
|
|
|
1447
1563
|
streamIndex: z.ZodNumber;
|
|
1448
1564
|
streamOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
1449
1565
|
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1566
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1567
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
1568
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
1569
|
+
scopePath: z.ZodArray<z.ZodNumber>;
|
|
1570
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
1571
|
+
slot: z.ZodNumber;
|
|
1572
|
+
derivation: z.ZodNullable<z.ZodObject<{
|
|
1573
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1574
|
+
id: z.ZodString;
|
|
1575
|
+
source: z.ZodEnum<{
|
|
1576
|
+
action: "action";
|
|
1577
|
+
event: "event";
|
|
1578
|
+
signal: "signal";
|
|
1579
|
+
}>;
|
|
1580
|
+
type: z.ZodLiteral<"source">;
|
|
1581
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1582
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
1583
|
+
property: z.ZodString;
|
|
1584
|
+
type: z.ZodLiteral<"property">;
|
|
1585
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1586
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
1587
|
+
type: z.ZodLiteral<"transform">;
|
|
1588
|
+
}, z.core.$strip>], "type">>;
|
|
1589
|
+
roots: z.ZodArray<z.ZodNumber>;
|
|
1590
|
+
}, z.core.$strip>>;
|
|
1591
|
+
key: z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>;
|
|
1592
|
+
limit: z.ZodNumber;
|
|
1593
|
+
outcomeSeq: z.ZodNumber;
|
|
1594
|
+
policy: z.ZodLiteral<"concurrent">;
|
|
1595
|
+
releaseScopePath: z.ZodArray<z.ZodNumber>;
|
|
1596
|
+
releaseSlot: z.ZodNumber;
|
|
1597
|
+
sourceOrigins: z.ZodArray<z.ZodString>;
|
|
1450
1598
|
}, z.core.$strip>, z.ZodObject<{
|
|
1451
1599
|
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
1452
1600
|
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
@@ -1551,6 +1699,40 @@ export declare const runtimeContract: {
|
|
|
1551
1699
|
outcomeSeq: z.ZodNumber;
|
|
1552
1700
|
policy: z.ZodLiteral<"merge">;
|
|
1553
1701
|
selectedIndex: z.ZodNumber;
|
|
1702
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1703
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
1704
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
1705
|
+
scopePath: z.ZodArray<z.ZodNumber>;
|
|
1706
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
1707
|
+
slot: z.ZodNumber;
|
|
1708
|
+
derivation: z.ZodNullable<z.ZodObject<{
|
|
1709
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1710
|
+
id: z.ZodString;
|
|
1711
|
+
source: z.ZodEnum<{
|
|
1712
|
+
action: "action";
|
|
1713
|
+
event: "event";
|
|
1714
|
+
signal: "signal";
|
|
1715
|
+
}>;
|
|
1716
|
+
type: z.ZodLiteral<"source">;
|
|
1717
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1718
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
1719
|
+
property: z.ZodString;
|
|
1720
|
+
type: z.ZodLiteral<"property">;
|
|
1721
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1722
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
1723
|
+
type: z.ZodLiteral<"transform">;
|
|
1724
|
+
}, z.core.$strip>], "type">>;
|
|
1725
|
+
roots: z.ZodArray<z.ZodNumber>;
|
|
1726
|
+
}, z.core.$strip>>;
|
|
1727
|
+
interval: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
1728
|
+
key: z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>;
|
|
1729
|
+
limit: z.ZodNumber;
|
|
1730
|
+
outcomeSeq: z.ZodNumber;
|
|
1731
|
+
overflow: z.ZodEnum<{
|
|
1732
|
+
drop: "drop";
|
|
1733
|
+
wait: "wait";
|
|
1734
|
+
}>;
|
|
1735
|
+
policy: z.ZodLiteral<"rateLimit">;
|
|
1554
1736
|
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
1555
1737
|
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
1556
1738
|
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
@@ -1688,6 +1870,36 @@ export declare const runtimeContract: {
|
|
|
1688
1870
|
releaseScopePath: z.ZodArray<z.ZodNumber>;
|
|
1689
1871
|
releaseSlot: z.ZodNumber;
|
|
1690
1872
|
sourceOrigins: z.ZodArray<z.ZodString>;
|
|
1873
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1874
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
1875
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
1876
|
+
scopePath: z.ZodArray<z.ZodNumber>;
|
|
1877
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
1878
|
+
slot: z.ZodNumber;
|
|
1879
|
+
derivation: z.ZodNullable<z.ZodObject<{
|
|
1880
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1881
|
+
id: z.ZodString;
|
|
1882
|
+
source: z.ZodEnum<{
|
|
1883
|
+
action: "action";
|
|
1884
|
+
event: "event";
|
|
1885
|
+
signal: "signal";
|
|
1886
|
+
}>;
|
|
1887
|
+
type: z.ZodLiteral<"source">;
|
|
1888
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1889
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
1890
|
+
property: z.ZodString;
|
|
1891
|
+
type: z.ZodLiteral<"property">;
|
|
1892
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1893
|
+
inputs: z.ZodArray<z.ZodNumber>;
|
|
1894
|
+
type: z.ZodLiteral<"transform">;
|
|
1895
|
+
}, z.core.$strip>], "type">>;
|
|
1896
|
+
roots: z.ZodArray<z.ZodNumber>;
|
|
1897
|
+
}, z.core.$strip>>;
|
|
1898
|
+
count: z.ZodNumber;
|
|
1899
|
+
key: z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>;
|
|
1900
|
+
outcomeSeq: z.ZodNumber;
|
|
1901
|
+
policy: z.ZodLiteral<"take">;
|
|
1902
|
+
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1691
1903
|
}, z.core.$strip>]>>;
|
|
1692
1904
|
observedFrontier: z.ZodOptional<z.ZodObject<{
|
|
1693
1905
|
boundaryCount: z.ZodNumber;
|
package/dist/runtime.js
CHANGED
|
@@ -222,6 +222,10 @@ const CORRELATION_STREAM_ORIGINS_SCHEMA = z
|
|
|
222
222
|
.min(1)
|
|
223
223
|
.array()
|
|
224
224
|
.min(2);
|
|
225
|
+
const CORRELATION_INPUT_POLICY_SCHEMA = z.object({
|
|
226
|
+
consumption: z.enum(["consume", "retain"]),
|
|
227
|
+
selection: z.enum(["oldest", "latest"]),
|
|
228
|
+
});
|
|
225
229
|
const MERGE_INPUT_ORIGINS_SCHEMA = z
|
|
226
230
|
.string()
|
|
227
231
|
.min(1)
|
|
@@ -231,6 +235,7 @@ const MERGE_INPUT_ORIGINS_SCHEMA = z
|
|
|
231
235
|
.min(2);
|
|
232
236
|
const createCorrelationOfferSchema = (keySchema) => SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
233
237
|
key: keySchema,
|
|
238
|
+
inputPolicies: CORRELATION_INPUT_POLICY_SCHEMA.array().min(2).optional(),
|
|
234
239
|
occurrenceTtl: COORDINATION_DURATION_SCHEMA.optional(),
|
|
235
240
|
ordered: z.boolean(),
|
|
236
241
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
@@ -247,6 +252,29 @@ const createCorrelationOfferSchema = (keySchema) => SIGNAL_INVOCATION_DEPENDENCI
|
|
|
247
252
|
path: ["streamIndex"],
|
|
248
253
|
});
|
|
249
254
|
}
|
|
255
|
+
if (entry.inputPolicies &&
|
|
256
|
+
entry.inputPolicies.length !== entry.streamOrigins.length) {
|
|
257
|
+
context.addIssue({
|
|
258
|
+
code: "custom",
|
|
259
|
+
message: "Correlation input policies must match the input streams.",
|
|
260
|
+
path: ["inputPolicies"],
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
const createTakeOfferSchema = (keySchema) => SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
265
|
+
count: z.number().int().positive(),
|
|
266
|
+
key: keySchema,
|
|
267
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
268
|
+
policy: z.literal("take"),
|
|
269
|
+
ttl: COORDINATION_DURATION_SCHEMA.optional(),
|
|
270
|
+
});
|
|
271
|
+
const createRateLimitOfferSchema = (keySchema) => SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
272
|
+
interval: COORDINATION_DURATION_SCHEMA,
|
|
273
|
+
key: keySchema,
|
|
274
|
+
limit: z.number().int().positive(),
|
|
275
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
276
|
+
overflow: z.enum(["drop", "wait"]),
|
|
277
|
+
policy: z.literal("rateLimit"),
|
|
250
278
|
});
|
|
251
279
|
const MERGE_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
252
280
|
inputOrigins: MERGE_INPUT_ORIGINS_SCHEMA,
|
|
@@ -265,6 +293,15 @@ const createSerializationOfferSchema = (keySchema) => SIGNAL_INVOCATION_DEPENDEN
|
|
|
265
293
|
releaseSlot: z.number().int().nonnegative(),
|
|
266
294
|
sourceOrigins: z.string().min(1).array(),
|
|
267
295
|
});
|
|
296
|
+
const createConcurrencyOfferSchema = (keySchema) => SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
297
|
+
key: keySchema,
|
|
298
|
+
limit: z.number().int().positive(),
|
|
299
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
300
|
+
policy: z.literal("concurrent"),
|
|
301
|
+
releaseScopePath: HOOK_SCOPE_PATH_SCHEMA,
|
|
302
|
+
releaseSlot: z.number().int().nonnegative(),
|
|
303
|
+
sourceOrigins: z.string().min(1).array(),
|
|
304
|
+
});
|
|
268
305
|
const createCollectionOfferSchema = (keySchema) => SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
269
306
|
count: z.number().int().positive(),
|
|
270
307
|
key: keySchema,
|
|
@@ -342,6 +379,9 @@ const COLLECTION_OFFER_SCHEMA = createCollectionOfferSchema(encodableSchema);
|
|
|
342
379
|
const CORRELATION_OFFER_SCHEMA = createCorrelationOfferSchema(encodableSchema);
|
|
343
380
|
const FUNNEL_OFFER_SCHEMA = createFunnelOfferSchema(encodableSchema);
|
|
344
381
|
const SERIALIZATION_OFFER_SCHEMA = createSerializationOfferSchema(encodableSchema);
|
|
382
|
+
const CONCURRENCY_OFFER_SCHEMA = createConcurrencyOfferSchema(encodableSchema);
|
|
383
|
+
const RATE_LIMIT_OFFER_SCHEMA = createRateLimitOfferSchema(encodableSchema);
|
|
384
|
+
const TAKE_OFFER_SCHEMA = createTakeOfferSchema(encodableSchema);
|
|
345
385
|
const RACE_OFFER_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
346
386
|
cohortActionDependencyIds: z.string().array(),
|
|
347
387
|
cohortEventDependencyIds: z.string().array(),
|
|
@@ -369,20 +409,26 @@ const RACE_OFFER_SCHEMA = z
|
|
|
369
409
|
const COORDINATION_OFFER_SCHEMA = z.union([
|
|
370
410
|
COLLECTION_OFFER_SCHEMA,
|
|
371
411
|
CORRELATION_OFFER_SCHEMA,
|
|
412
|
+
CONCURRENCY_OFFER_SCHEMA,
|
|
372
413
|
FANOUT_OFFER_SCHEMA,
|
|
373
414
|
FUNNEL_OFFER_SCHEMA,
|
|
374
415
|
MERGE_OFFER_SCHEMA,
|
|
416
|
+
RATE_LIMIT_OFFER_SCHEMA,
|
|
375
417
|
RACE_OFFER_SCHEMA,
|
|
376
418
|
SERIALIZATION_OFFER_SCHEMA,
|
|
419
|
+
TAKE_OFFER_SCHEMA,
|
|
377
420
|
]);
|
|
378
421
|
const COORDINATION_OFFER_TRANSPORT_SCHEMA = z.union([
|
|
379
422
|
createCollectionOfferSchema(codecEnvelopeSchema),
|
|
380
423
|
createCorrelationOfferSchema(codecEnvelopeSchema),
|
|
424
|
+
createConcurrencyOfferSchema(codecEnvelopeSchema),
|
|
381
425
|
FANOUT_OFFER_SCHEMA,
|
|
382
426
|
createFunnelOfferSchema(codecEnvelopeSchema),
|
|
383
427
|
MERGE_OFFER_SCHEMA,
|
|
428
|
+
createRateLimitOfferSchema(codecEnvelopeSchema),
|
|
384
429
|
RACE_OFFER_SCHEMA,
|
|
385
430
|
createSerializationOfferSchema(codecEnvelopeSchema),
|
|
431
|
+
createTakeOfferSchema(codecEnvelopeSchema),
|
|
386
432
|
]);
|
|
387
433
|
const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
388
434
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/api-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.139.0",
|
|
4
4
|
"description": "Public oRPC contract for the Automate.ax API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ai-sdk/gateway": "4.0.46",
|
|
34
|
-
"@automate.ax/codec": "0.
|
|
35
|
-
"@automate.ax/integration-contracts": "0.
|
|
34
|
+
"@automate.ax/codec": "0.139.0",
|
|
35
|
+
"@automate.ax/integration-contracts": "0.139.0",
|
|
36
36
|
"@orpc/contract": "1.15.0",
|
|
37
37
|
"fast-json-stable-stringify": "^2.1.0",
|
|
38
38
|
"zod": "^4.3.6"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { oc } from "@orpc/contract"
|
|
2
|
+
import * as z from "zod"
|
|
3
|
+
|
|
4
|
+
export const anthropicEventsContract = {
|
|
5
|
+
anthropicEvent: oc
|
|
6
|
+
.route({
|
|
7
|
+
description:
|
|
8
|
+
"Receives signed lifecycle callbacks from Anthropic Claude Managed Agents.",
|
|
9
|
+
method: "POST",
|
|
10
|
+
operationId: "receiveAnthropicEvent",
|
|
11
|
+
path: "/events/anthropic",
|
|
12
|
+
successStatus: 200,
|
|
13
|
+
summary: "Receive an Anthropic Managed Agents event",
|
|
14
|
+
tags: ["Events"],
|
|
15
|
+
})
|
|
16
|
+
.input(z.unknown())
|
|
17
|
+
.output(z.void()),
|
|
18
|
+
}
|
package/src/events/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { airtableEventsContract } from "./airtable"
|
|
2
2
|
import { apifyEventsContract } from "./apify"
|
|
3
|
+
import { anthropicEventsContract } from "./anthropic"
|
|
3
4
|
import { axiomEventsContract } from "./axiom"
|
|
4
5
|
import { asanaEventsContract } from "./asana"
|
|
5
6
|
import { brevoEventsContract } from "./brevo"
|
|
@@ -27,6 +28,7 @@ import { webflowEventsContract } from "./webflow"
|
|
|
27
28
|
import { whatsappEventsContract } from "./whatsapp"
|
|
28
29
|
|
|
29
30
|
export const eventsContract = {
|
|
31
|
+
...anthropicEventsContract,
|
|
30
32
|
...airtableEventsContract,
|
|
31
33
|
...apifyEventsContract,
|
|
32
34
|
...axiomEventsContract,
|
package/src/runtime-protocol.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Runtime protocol required by newly built automation bundles. */
|
|
2
|
-
export const AUTOMATION_RUNTIME_PROTOCOL_VERSION =
|
|
2
|
+
export const AUTOMATION_RUNTIME_PROTOCOL_VERSION = 5
|
package/src/runtime.ts
CHANGED
|
@@ -273,6 +273,10 @@ const CORRELATION_STREAM_ORIGINS_SCHEMA = z
|
|
|
273
273
|
.min(1)
|
|
274
274
|
.array()
|
|
275
275
|
.min(2)
|
|
276
|
+
const CORRELATION_INPUT_POLICY_SCHEMA = z.object({
|
|
277
|
+
consumption: z.enum(["consume", "retain"]),
|
|
278
|
+
selection: z.enum(["oldest", "latest"]),
|
|
279
|
+
})
|
|
276
280
|
|
|
277
281
|
const MERGE_INPUT_ORIGINS_SCHEMA = z
|
|
278
282
|
.string()
|
|
@@ -287,6 +291,7 @@ const createCorrelationOfferSchema = <TKeySchema extends z.ZodType>(
|
|
|
287
291
|
) =>
|
|
288
292
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
289
293
|
key: keySchema,
|
|
294
|
+
inputPolicies: CORRELATION_INPUT_POLICY_SCHEMA.array().min(2).optional(),
|
|
290
295
|
occurrenceTtl: COORDINATION_DURATION_SCHEMA.optional(),
|
|
291
296
|
ordered: z.boolean(),
|
|
292
297
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
@@ -304,6 +309,39 @@ const createCorrelationOfferSchema = <TKeySchema extends z.ZodType>(
|
|
|
304
309
|
path: ["streamIndex"],
|
|
305
310
|
})
|
|
306
311
|
}
|
|
312
|
+
if (
|
|
313
|
+
entry.inputPolicies &&
|
|
314
|
+
entry.inputPolicies.length !== entry.streamOrigins.length
|
|
315
|
+
) {
|
|
316
|
+
context.addIssue({
|
|
317
|
+
code: "custom",
|
|
318
|
+
message: "Correlation input policies must match the input streams.",
|
|
319
|
+
path: ["inputPolicies"],
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
const createTakeOfferSchema = <TKeySchema extends z.ZodType>(
|
|
325
|
+
keySchema: TKeySchema,
|
|
326
|
+
) =>
|
|
327
|
+
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
328
|
+
count: z.number().int().positive(),
|
|
329
|
+
key: keySchema,
|
|
330
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
331
|
+
policy: z.literal("take"),
|
|
332
|
+
ttl: COORDINATION_DURATION_SCHEMA.optional(),
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
const createRateLimitOfferSchema = <TKeySchema extends z.ZodType>(
|
|
336
|
+
keySchema: TKeySchema,
|
|
337
|
+
) =>
|
|
338
|
+
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
339
|
+
interval: COORDINATION_DURATION_SCHEMA,
|
|
340
|
+
key: keySchema,
|
|
341
|
+
limit: z.number().int().positive(),
|
|
342
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
343
|
+
overflow: z.enum(["drop", "wait"]),
|
|
344
|
+
policy: z.literal("rateLimit"),
|
|
307
345
|
})
|
|
308
346
|
|
|
309
347
|
const MERGE_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
@@ -328,6 +366,19 @@ const createSerializationOfferSchema = <TKeySchema extends z.ZodType>(
|
|
|
328
366
|
sourceOrigins: z.string().min(1).array(),
|
|
329
367
|
})
|
|
330
368
|
|
|
369
|
+
const createConcurrencyOfferSchema = <TKeySchema extends z.ZodType>(
|
|
370
|
+
keySchema: TKeySchema,
|
|
371
|
+
) =>
|
|
372
|
+
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
373
|
+
key: keySchema,
|
|
374
|
+
limit: z.number().int().positive(),
|
|
375
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
376
|
+
policy: z.literal("concurrent"),
|
|
377
|
+
releaseScopePath: HOOK_SCOPE_PATH_SCHEMA,
|
|
378
|
+
releaseSlot: z.number().int().nonnegative(),
|
|
379
|
+
sourceOrigins: z.string().min(1).array(),
|
|
380
|
+
})
|
|
381
|
+
|
|
331
382
|
const createCollectionOfferSchema = <TKeySchema extends z.ZodType>(
|
|
332
383
|
keySchema: TKeySchema,
|
|
333
384
|
) =>
|
|
@@ -425,6 +476,9 @@ const CORRELATION_OFFER_SCHEMA = createCorrelationOfferSchema(encodableSchema)
|
|
|
425
476
|
const FUNNEL_OFFER_SCHEMA = createFunnelOfferSchema(encodableSchema)
|
|
426
477
|
const SERIALIZATION_OFFER_SCHEMA =
|
|
427
478
|
createSerializationOfferSchema(encodableSchema)
|
|
479
|
+
const CONCURRENCY_OFFER_SCHEMA = createConcurrencyOfferSchema(encodableSchema)
|
|
480
|
+
const RATE_LIMIT_OFFER_SCHEMA = createRateLimitOfferSchema(encodableSchema)
|
|
481
|
+
const TAKE_OFFER_SCHEMA = createTakeOfferSchema(encodableSchema)
|
|
428
482
|
|
|
429
483
|
const RACE_OFFER_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
430
484
|
cohortActionDependencyIds: z.string().array(),
|
|
@@ -455,21 +509,27 @@ const RACE_OFFER_SCHEMA = z
|
|
|
455
509
|
const COORDINATION_OFFER_SCHEMA = z.union([
|
|
456
510
|
COLLECTION_OFFER_SCHEMA,
|
|
457
511
|
CORRELATION_OFFER_SCHEMA,
|
|
512
|
+
CONCURRENCY_OFFER_SCHEMA,
|
|
458
513
|
FANOUT_OFFER_SCHEMA,
|
|
459
514
|
FUNNEL_OFFER_SCHEMA,
|
|
460
515
|
MERGE_OFFER_SCHEMA,
|
|
516
|
+
RATE_LIMIT_OFFER_SCHEMA,
|
|
461
517
|
RACE_OFFER_SCHEMA,
|
|
462
518
|
SERIALIZATION_OFFER_SCHEMA,
|
|
519
|
+
TAKE_OFFER_SCHEMA,
|
|
463
520
|
])
|
|
464
521
|
|
|
465
522
|
const COORDINATION_OFFER_TRANSPORT_SCHEMA = z.union([
|
|
466
523
|
createCollectionOfferSchema(codecEnvelopeSchema),
|
|
467
524
|
createCorrelationOfferSchema(codecEnvelopeSchema),
|
|
525
|
+
createConcurrencyOfferSchema(codecEnvelopeSchema),
|
|
468
526
|
FANOUT_OFFER_SCHEMA,
|
|
469
527
|
createFunnelOfferSchema(codecEnvelopeSchema),
|
|
470
528
|
MERGE_OFFER_SCHEMA,
|
|
529
|
+
createRateLimitOfferSchema(codecEnvelopeSchema),
|
|
471
530
|
RACE_OFFER_SCHEMA,
|
|
472
531
|
createSerializationOfferSchema(codecEnvelopeSchema),
|
|
532
|
+
createTakeOfferSchema(codecEnvelopeSchema),
|
|
473
533
|
])
|
|
474
534
|
|
|
475
535
|
/** One validated durable coordination offer sent by the automation runtime. */
|