@automate.ax/api-contract 0.57.4 → 0.59.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 +38 -9
- package/dist/runtime.d.ts +145 -8
- package/dist/runtime.js +76 -27
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/runtime.ts +94 -29
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { automationExecutionStatusSchema } from "./automation.js";
|
|
2
2
|
export { AUTOMATION_SDK_VERSION } from "./deployment.js";
|
|
3
3
|
export { integrationAccountOutputSchema } from "./account.js";
|
|
4
|
-
export { AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT, AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX, DEFAULT_GATEWAY_MODEL_ID, automationInvocationInputSchema, automationInvocationOutputSchema, automationInvocationScheduleSchema, generationInputSchema, generationResultSchema, hashSignalCoordinatorConfiguration, runtimeContract, type GenerationInput, type GenerationResult, type RuntimeGenerationInput, } from "./runtime.js";
|
|
4
|
+
export { AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT, AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX, DEFAULT_GATEWAY_MODEL_ID, automationInvocationInputSchema, automationInvocationOutputSchema, automationInvocationScheduleSchema, generationInputSchema, generationResultSchema, hashSignalCoordinatorConfiguration, runtimeContract, type GenerationInput, type GenerationResult, type RuntimeGenerationInput, type RuntimeCoordinationOffer, } from "./runtime.js";
|
|
5
5
|
export type { GatewayModelId } from "@ai-sdk/gateway";
|
|
6
6
|
export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
|
|
7
7
|
export { activeSubscriptionOutputSchema, createdInvitationOutputSchema, organizationDetailsOutputSchema, organizationInvitationOutputSchema, organizationMemberOutputSchema, organizationProjectOutputSchema, organizationRoleSchema, organizationSummaryOutputSchema, publicOrganizationOutputSchema, } from "./org.js";
|
|
@@ -1111,6 +1111,7 @@ export declare const contract: {
|
|
|
1111
1111
|
key: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
1112
1112
|
outcomeSeq: import("zod").ZodNumber;
|
|
1113
1113
|
policy: import("zod").ZodLiteral<"collect">;
|
|
1114
|
+
position: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1114
1115
|
primaryPosition: import("zod").ZodEnum<{
|
|
1115
1116
|
first: "first";
|
|
1116
1117
|
last: "last";
|
|
@@ -1129,6 +1130,15 @@ export declare const contract: {
|
|
|
1129
1130
|
streamName: import("zod").ZodString;
|
|
1130
1131
|
streamNames: import("zod").ZodArray<import("zod").ZodString>;
|
|
1131
1132
|
ttl: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
1133
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1134
|
+
actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1135
|
+
eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1136
|
+
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1137
|
+
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1138
|
+
slot: import("zod").ZodNumber;
|
|
1139
|
+
count: import("zod").ZodNumber;
|
|
1140
|
+
outcomeSeq: import("zod").ZodNumber;
|
|
1141
|
+
policy: import("zod").ZodLiteral<"fanout">;
|
|
1132
1142
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1133
1143
|
actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1134
1144
|
eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
@@ -1224,8 +1234,16 @@ export declare const contract: {
|
|
|
1224
1234
|
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1225
1235
|
slot: import("zod").ZodNumber;
|
|
1226
1236
|
outcomeSeq: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1227
|
-
selectedIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1228
1237
|
status: import("zod").ZodLiteral<"open">;
|
|
1238
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1239
|
+
actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1240
|
+
eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1241
|
+
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1242
|
+
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1243
|
+
slot: import("zod").ZodNumber;
|
|
1244
|
+
outcomeSeq: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1245
|
+
selectedIndex: import("zod").ZodNumber;
|
|
1246
|
+
status: import("zod").ZodLiteral<"succeeded">;
|
|
1229
1247
|
}, import("zod/v4/core").$strip>]>>>;
|
|
1230
1248
|
}, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
|
|
1231
1249
|
completeAction: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
@@ -1473,7 +1491,6 @@ export declare const contract: {
|
|
|
1473
1491
|
contextId: import("zod").ZodString;
|
|
1474
1492
|
outcomeSeq: import("zod").ZodNumber;
|
|
1475
1493
|
signalInvocationId: import("zod").ZodString;
|
|
1476
|
-
selectedIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1477
1494
|
status: import("zod").ZodLiteral<"open">;
|
|
1478
1495
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1479
1496
|
actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
@@ -1511,6 +1528,7 @@ export declare const contract: {
|
|
|
1511
1528
|
contextId: import("zod").ZodString;
|
|
1512
1529
|
outcomeSeq: import("zod").ZodNumber;
|
|
1513
1530
|
signalInvocationId: import("zod").ZodString;
|
|
1531
|
+
selectedIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1514
1532
|
status: import("zod").ZodLiteral<"succeeded">;
|
|
1515
1533
|
}, import("zod/v4/core").$strip>]>>;
|
|
1516
1534
|
}, import("zod/v4/core").$strip>;
|
|
@@ -1587,7 +1605,6 @@ export declare const contract: {
|
|
|
1587
1605
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1588
1606
|
signalInvocationId: import("zod").ZodString;
|
|
1589
1607
|
slot: import("zod").ZodNumber;
|
|
1590
|
-
selectedIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1591
1608
|
status: import("zod").ZodLiteral<"open">;
|
|
1592
1609
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1593
1610
|
contextId: import("zod").ZodString;
|
|
@@ -1613,7 +1630,8 @@ export declare const contract: {
|
|
|
1613
1630
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1614
1631
|
signalInvocationId: import("zod").ZodString;
|
|
1615
1632
|
slot: import("zod").ZodNumber;
|
|
1616
|
-
output: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable
|
|
1633
|
+
output: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>;
|
|
1634
|
+
selectedIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1617
1635
|
status: import("zod").ZodLiteral<"succeeded">;
|
|
1618
1636
|
}, import("zod/v4/core").$strip>]>>;
|
|
1619
1637
|
}, import("zod/v4/core").$strip>;
|
|
@@ -1707,7 +1725,6 @@ export declare const contract: {
|
|
|
1707
1725
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1708
1726
|
signalInvocationId: import("zod").ZodString;
|
|
1709
1727
|
slot: import("zod").ZodNumber;
|
|
1710
|
-
selectedIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1711
1728
|
status: import("zod").ZodLiteral<"open">;
|
|
1712
1729
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1713
1730
|
contextId: import("zod").ZodString;
|
|
@@ -1733,7 +1750,8 @@ export declare const contract: {
|
|
|
1733
1750
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1734
1751
|
signalInvocationId: import("zod").ZodString;
|
|
1735
1752
|
slot: import("zod").ZodNumber;
|
|
1736
|
-
output: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable
|
|
1753
|
+
output: import("zod").ZodOptional<import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>;
|
|
1754
|
+
selectedIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1737
1755
|
status: import("zod").ZodLiteral<"succeeded">;
|
|
1738
1756
|
}, import("zod/v4/core").$strip>]>>;
|
|
1739
1757
|
}, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -1752,11 +1770,22 @@ export declare const contract: {
|
|
|
1752
1770
|
}, import("zod/v4/core").$strip>;
|
|
1753
1771
|
outputIndex: import("zod").ZodNumber;
|
|
1754
1772
|
}, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
|
|
1755
|
-
sendEmail: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
1773
|
+
sendEmail: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodIntersection<import("zod").ZodObject<{
|
|
1756
1774
|
subject: import("zod").ZodString;
|
|
1757
|
-
text: import("zod").ZodString;
|
|
1758
1775
|
to: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodEmail, import("zod").ZodLiteral<"*">]>>;
|
|
1776
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
1777
|
+
html: import("zod").ZodString;
|
|
1778
|
+
markdown: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1779
|
+
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1759
1780
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1781
|
+
html: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1782
|
+
markdown: import("zod").ZodString;
|
|
1783
|
+
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1784
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1785
|
+
html: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1786
|
+
markdown: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1787
|
+
text: import("zod").ZodString;
|
|
1788
|
+
}, import("zod/v4/core").$strip>]>>, import("zod").ZodObject<{
|
|
1760
1789
|
id: import("zod").ZodNullable<import("zod").ZodString>;
|
|
1761
1790
|
}, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
|
|
1762
1791
|
};
|
package/dist/runtime.d.ts
CHANGED
|
@@ -38,6 +38,114 @@ export declare const automationInvocationInputSchema: z.ZodIntersection<z.ZodInt
|
|
|
38
38
|
runAt: z.ZodOptional<z.ZodNever>;
|
|
39
39
|
runIn: z.ZodOptional<z.ZodNever>;
|
|
40
40
|
}, z.core.$strip>]>>;
|
|
41
|
+
declare const COORDINATION_OFFER_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
|
|
42
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
43
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
44
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
45
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
46
|
+
slot: z.ZodNumber;
|
|
47
|
+
count: z.ZodNumber;
|
|
48
|
+
key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
49
|
+
outcomeSeq: z.ZodNumber;
|
|
50
|
+
policy: z.ZodLiteral<"collect">;
|
|
51
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
primaryPosition: z.ZodEnum<{
|
|
53
|
+
first: "first";
|
|
54
|
+
last: "last";
|
|
55
|
+
}>;
|
|
56
|
+
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
59
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
60
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
61
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
62
|
+
slot: z.ZodNumber;
|
|
63
|
+
key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
64
|
+
order: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
65
|
+
outcomeSeq: z.ZodNumber;
|
|
66
|
+
policy: z.ZodLiteral<"correlate">;
|
|
67
|
+
streamName: z.ZodString;
|
|
68
|
+
streamNames: z.ZodArray<z.ZodString>;
|
|
69
|
+
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
72
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
73
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
74
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
75
|
+
slot: z.ZodNumber;
|
|
76
|
+
count: z.ZodNumber;
|
|
77
|
+
outcomeSeq: z.ZodNumber;
|
|
78
|
+
policy: z.ZodLiteral<"fanout">;
|
|
79
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
80
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
81
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
82
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
83
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
84
|
+
slot: z.ZodNumber;
|
|
85
|
+
key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
86
|
+
maxBurstDuration: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
87
|
+
minGap: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
88
|
+
minQuietPeriod: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
89
|
+
outcomeSeq: z.ZodNumber;
|
|
90
|
+
policy: z.ZodLiteral<"funnel">;
|
|
91
|
+
primaryPosition: z.ZodEnum<{
|
|
92
|
+
first: "first";
|
|
93
|
+
last: "last";
|
|
94
|
+
}>;
|
|
95
|
+
selection: z.ZodEnum<{
|
|
96
|
+
first: "first";
|
|
97
|
+
last: "last";
|
|
98
|
+
all: "all";
|
|
99
|
+
}>;
|
|
100
|
+
triggerAt: z.ZodEnum<{
|
|
101
|
+
start: "start";
|
|
102
|
+
end: "end";
|
|
103
|
+
both: "both";
|
|
104
|
+
}>;
|
|
105
|
+
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
106
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
107
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
108
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
109
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
110
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
111
|
+
slot: z.ZodNumber;
|
|
112
|
+
inputOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
113
|
+
outcomeSeq: z.ZodNumber;
|
|
114
|
+
policy: z.ZodLiteral<"race">;
|
|
115
|
+
scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
116
|
+
selectedIndex: z.ZodNumber;
|
|
117
|
+
status: z.ZodLiteral<"closed">;
|
|
118
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
119
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
120
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
121
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
122
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
123
|
+
slot: z.ZodNumber;
|
|
124
|
+
inputOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
125
|
+
outcomeSeq: z.ZodNumber;
|
|
126
|
+
policy: z.ZodLiteral<"race">;
|
|
127
|
+
scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
128
|
+
selectedIndex: z.ZodNumber;
|
|
129
|
+
failure: z.ZodObject<{
|
|
130
|
+
message: z.ZodString;
|
|
131
|
+
name: z.ZodString;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
status: z.ZodLiteral<"failed">;
|
|
134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
136
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
137
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
138
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
139
|
+
slot: z.ZodNumber;
|
|
140
|
+
inputOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
141
|
+
outcomeSeq: z.ZodNumber;
|
|
142
|
+
policy: z.ZodLiteral<"race">;
|
|
143
|
+
scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
144
|
+
selectedIndex: z.ZodNumber;
|
|
145
|
+
status: z.ZodLiteral<"succeeded">;
|
|
146
|
+
}, z.core.$strip>]>]>;
|
|
147
|
+
/** One validated durable coordination offer sent by the automation runtime. */
|
|
148
|
+
export type RuntimeCoordinationOffer = z.output<typeof COORDINATION_OFFER_SCHEMA>;
|
|
41
149
|
/** Shared text-generation options accepted by the built-in generate action. */
|
|
42
150
|
export declare const generationInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
43
151
|
frequencyPenalty: z.ZodOptional<z.ZodNumber>;
|
|
@@ -243,6 +351,7 @@ export declare const runtimeContract: {
|
|
|
243
351
|
key: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
|
|
244
352
|
outcomeSeq: z.ZodNumber;
|
|
245
353
|
policy: z.ZodLiteral<"collect">;
|
|
354
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
246
355
|
primaryPosition: z.ZodEnum<{
|
|
247
356
|
first: "first";
|
|
248
357
|
last: "last";
|
|
@@ -261,6 +370,15 @@ export declare const runtimeContract: {
|
|
|
261
370
|
streamName: z.ZodString;
|
|
262
371
|
streamNames: z.ZodArray<z.ZodString>;
|
|
263
372
|
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
373
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
374
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
375
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
376
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
377
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
378
|
+
slot: z.ZodNumber;
|
|
379
|
+
count: z.ZodNumber;
|
|
380
|
+
outcomeSeq: z.ZodNumber;
|
|
381
|
+
policy: z.ZodLiteral<"fanout">;
|
|
264
382
|
}, z.core.$strip>, z.ZodObject<{
|
|
265
383
|
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
266
384
|
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
@@ -356,8 +474,16 @@ export declare const runtimeContract: {
|
|
|
356
474
|
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
357
475
|
slot: z.ZodNumber;
|
|
358
476
|
outcomeSeq: z.ZodOptional<z.ZodNumber>;
|
|
359
|
-
selectedIndex: z.ZodOptional<z.ZodNumber>;
|
|
360
477
|
status: z.ZodLiteral<"open">;
|
|
478
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
479
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
480
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
481
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
482
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
483
|
+
slot: z.ZodNumber;
|
|
484
|
+
outcomeSeq: z.ZodOptional<z.ZodNumber>;
|
|
485
|
+
selectedIndex: z.ZodNumber;
|
|
486
|
+
status: z.ZodLiteral<"succeeded">;
|
|
361
487
|
}, z.core.$strip>]>>>;
|
|
362
488
|
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
363
489
|
completeAction: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -605,7 +731,6 @@ export declare const runtimeContract: {
|
|
|
605
731
|
contextId: z.ZodString;
|
|
606
732
|
outcomeSeq: z.ZodNumber;
|
|
607
733
|
signalInvocationId: z.ZodString;
|
|
608
|
-
selectedIndex: z.ZodOptional<z.ZodNumber>;
|
|
609
734
|
status: z.ZodLiteral<"open">;
|
|
610
735
|
}, z.core.$strip>, z.ZodObject<{
|
|
611
736
|
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
@@ -643,6 +768,7 @@ export declare const runtimeContract: {
|
|
|
643
768
|
contextId: z.ZodString;
|
|
644
769
|
outcomeSeq: z.ZodNumber;
|
|
645
770
|
signalInvocationId: z.ZodString;
|
|
771
|
+
selectedIndex: z.ZodOptional<z.ZodNumber>;
|
|
646
772
|
status: z.ZodLiteral<"succeeded">;
|
|
647
773
|
}, z.core.$strip>]>>;
|
|
648
774
|
}, z.core.$strip>;
|
|
@@ -719,7 +845,6 @@ export declare const runtimeContract: {
|
|
|
719
845
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
720
846
|
signalInvocationId: z.ZodString;
|
|
721
847
|
slot: z.ZodNumber;
|
|
722
|
-
selectedIndex: z.ZodOptional<z.ZodNumber>;
|
|
723
848
|
status: z.ZodLiteral<"open">;
|
|
724
849
|
}, z.core.$strip>, z.ZodObject<{
|
|
725
850
|
contextId: z.ZodString;
|
|
@@ -745,7 +870,8 @@ export declare const runtimeContract: {
|
|
|
745
870
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
746
871
|
signalInvocationId: z.ZodString;
|
|
747
872
|
slot: z.ZodNumber;
|
|
748
|
-
output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable
|
|
873
|
+
output: z.ZodOptional<z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>;
|
|
874
|
+
selectedIndex: z.ZodOptional<z.ZodNumber>;
|
|
749
875
|
status: z.ZodLiteral<"succeeded">;
|
|
750
876
|
}, z.core.$strip>]>>;
|
|
751
877
|
}, z.core.$strip>;
|
|
@@ -839,7 +965,6 @@ export declare const runtimeContract: {
|
|
|
839
965
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
840
966
|
signalInvocationId: z.ZodString;
|
|
841
967
|
slot: z.ZodNumber;
|
|
842
|
-
selectedIndex: z.ZodOptional<z.ZodNumber>;
|
|
843
968
|
status: z.ZodLiteral<"open">;
|
|
844
969
|
}, z.core.$strip>, z.ZodObject<{
|
|
845
970
|
contextId: z.ZodString;
|
|
@@ -865,7 +990,8 @@ export declare const runtimeContract: {
|
|
|
865
990
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
866
991
|
signalInvocationId: z.ZodString;
|
|
867
992
|
slot: z.ZodNumber;
|
|
868
|
-
output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable
|
|
993
|
+
output: z.ZodOptional<z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>;
|
|
994
|
+
selectedIndex: z.ZodOptional<z.ZodNumber>;
|
|
869
995
|
status: z.ZodLiteral<"succeeded">;
|
|
870
996
|
}, z.core.$strip>]>>;
|
|
871
997
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
@@ -884,11 +1010,22 @@ export declare const runtimeContract: {
|
|
|
884
1010
|
}, z.core.$strip>;
|
|
885
1011
|
outputIndex: z.ZodNumber;
|
|
886
1012
|
}, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
|
|
887
|
-
sendEmail: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1013
|
+
sendEmail: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodIntersection<z.ZodObject<{
|
|
888
1014
|
subject: z.ZodString;
|
|
889
|
-
text: z.ZodString;
|
|
890
1015
|
to: z.ZodDefault<z.ZodUnion<readonly [z.ZodEmail, z.ZodLiteral<"*">]>>;
|
|
1016
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
1017
|
+
html: z.ZodString;
|
|
1018
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
1019
|
+
text: z.ZodOptional<z.ZodString>;
|
|
1020
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1021
|
+
html: z.ZodOptional<z.ZodString>;
|
|
1022
|
+
markdown: z.ZodString;
|
|
1023
|
+
text: z.ZodOptional<z.ZodString>;
|
|
891
1024
|
}, z.core.$strip>, z.ZodObject<{
|
|
1025
|
+
html: z.ZodOptional<z.ZodString>;
|
|
1026
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
1027
|
+
text: z.ZodString;
|
|
1028
|
+
}, z.core.$strip>]>>, z.ZodObject<{
|
|
892
1029
|
id: z.ZodNullable<z.ZodString>;
|
|
893
1030
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
894
1031
|
};
|
package/dist/runtime.js
CHANGED
|
@@ -25,6 +25,23 @@ const AUTOMATION_INVOCATION_RUN_IN_SCHEMA = z.union([
|
|
|
25
25
|
z.string().min(1),
|
|
26
26
|
z.number().nonnegative(),
|
|
27
27
|
]);
|
|
28
|
+
const EMAIL_BODY_SCHEMA = z.union([
|
|
29
|
+
z.object({
|
|
30
|
+
html: z.string().min(1),
|
|
31
|
+
markdown: z.string().min(1).optional(),
|
|
32
|
+
text: z.string().min(1).optional(),
|
|
33
|
+
}),
|
|
34
|
+
z.object({
|
|
35
|
+
html: z.string().min(1).optional(),
|
|
36
|
+
markdown: z.string().min(1),
|
|
37
|
+
text: z.string().min(1).optional(),
|
|
38
|
+
}),
|
|
39
|
+
z.object({
|
|
40
|
+
html: z.string().min(1).optional(),
|
|
41
|
+
markdown: z.string().min(1).optional(),
|
|
42
|
+
text: z.string().min(1),
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
28
45
|
/** Immediate or mutually exclusive absolute/relative invocation timing. */
|
|
29
46
|
export const automationInvocationScheduleSchema = z.union([
|
|
30
47
|
z.object({
|
|
@@ -163,9 +180,15 @@ const COLLECTION_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
163
180
|
key: encodableSchema,
|
|
164
181
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
165
182
|
policy: z.literal("collect"),
|
|
183
|
+
position: z.number().int().nonnegative().optional(),
|
|
166
184
|
primaryPosition: COORDINATION_PRIMARY_POSITION_SCHEMA,
|
|
167
185
|
ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
|
|
168
186
|
});
|
|
187
|
+
const FANOUT_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
188
|
+
count: z.number().int().nonnegative(),
|
|
189
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
190
|
+
policy: z.literal("fanout"),
|
|
191
|
+
});
|
|
169
192
|
const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
170
193
|
key: encodableSchema,
|
|
171
194
|
maxBurstDuration: COORDINATION_DURATION_SCHEMA.optional(),
|
|
@@ -178,6 +201,14 @@ const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
178
201
|
triggerAt: z.enum(["start", "end", "both"]),
|
|
179
202
|
ttl: COORDINATION_DURATION_SCHEMA.optional(),
|
|
180
203
|
}).superRefine((offer, context) => {
|
|
204
|
+
if (offer.maxBurstDuration === undefined &&
|
|
205
|
+
offer.minGap === undefined &&
|
|
206
|
+
offer.minQuietPeriod === undefined) {
|
|
207
|
+
context.addIssue({
|
|
208
|
+
code: "custom",
|
|
209
|
+
message: "A funnel requires at least one timing control.",
|
|
210
|
+
});
|
|
211
|
+
}
|
|
181
212
|
if (offer.triggerAt === "end" &&
|
|
182
213
|
offer.minGap !== undefined &&
|
|
183
214
|
offer.minQuietPeriod === undefined &&
|
|
@@ -191,7 +222,7 @@ const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
191
222
|
if (offer.selection !== "all" && offer.selection !== offer.primaryPosition) {
|
|
192
223
|
context.addIssue({
|
|
193
224
|
code: "custom",
|
|
194
|
-
message: "A selecting funnel must
|
|
225
|
+
message: "A selecting funnel must inherit conflicting values from its selected occurrence.",
|
|
195
226
|
path: ["primaryPosition"],
|
|
196
227
|
});
|
|
197
228
|
}
|
|
@@ -204,7 +235,7 @@ const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
204
235
|
}
|
|
205
236
|
});
|
|
206
237
|
const RACE_OFFER_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
207
|
-
inputOrigins: z.string().array().array().min(
|
|
238
|
+
inputOrigins: z.string().array().array().min(2),
|
|
208
239
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
209
240
|
policy: z.literal("race"),
|
|
210
241
|
scopeOrigins: z.string().array().default([]),
|
|
@@ -223,6 +254,13 @@ const RACE_OFFER_SCHEMA = z
|
|
|
223
254
|
message: "Race input must identify a declared input.",
|
|
224
255
|
path: ["selectedIndex"],
|
|
225
256
|
});
|
|
257
|
+
const COORDINATION_OFFER_SCHEMA = z.union([
|
|
258
|
+
COLLECTION_OFFER_SCHEMA,
|
|
259
|
+
CORRELATION_OFFER_SCHEMA,
|
|
260
|
+
FANOUT_OFFER_SCHEMA,
|
|
261
|
+
FUNNEL_OFFER_SCHEMA,
|
|
262
|
+
RACE_OFFER_SCHEMA,
|
|
263
|
+
]);
|
|
226
264
|
const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
227
265
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
228
266
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA.optional(),
|
|
@@ -234,9 +272,13 @@ const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
|
234
272
|
}),
|
|
235
273
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
236
274
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA.optional(),
|
|
237
|
-
selectedIndex: z.number().int().nonnegative().optional(),
|
|
238
275
|
status: z.literal("open"),
|
|
239
276
|
}),
|
|
277
|
+
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
278
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA.optional(),
|
|
279
|
+
selectedIndex: z.number().int().nonnegative(),
|
|
280
|
+
status: z.literal("succeeded"),
|
|
281
|
+
}),
|
|
240
282
|
]);
|
|
241
283
|
const SIGNAL_BATCH_OUTCOME_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
242
284
|
coordinatorConfigurationHash: z.string().optional(),
|
|
@@ -245,16 +287,16 @@ const SIGNAL_BATCH_OUTCOME_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.e
|
|
|
245
287
|
signalInvocationId: z.string(),
|
|
246
288
|
});
|
|
247
289
|
const SIGNAL_BATCH_OUTCOME_SCHEMA = z.union([
|
|
248
|
-
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
|
|
249
|
-
selectedIndex: z.number().int().nonnegative().optional(),
|
|
250
|
-
status: z.literal("open"),
|
|
251
|
-
}),
|
|
290
|
+
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("open") }),
|
|
252
291
|
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("closed") }),
|
|
253
292
|
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
|
|
254
293
|
failure: SIGNAL_FAILURE_SCHEMA,
|
|
255
294
|
status: z.literal("failed"),
|
|
256
295
|
}),
|
|
257
|
-
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
|
|
296
|
+
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
|
|
297
|
+
selectedIndex: z.number().int().nonnegative().optional(),
|
|
298
|
+
status: z.literal("succeeded"),
|
|
299
|
+
}),
|
|
258
300
|
]);
|
|
259
301
|
const ACTION_VALUE_OUTCOME_BASE_SCHEMA = z.object({
|
|
260
302
|
actionInvocationId: z.string(),
|
|
@@ -306,17 +348,15 @@ const COORDINATION_SELECTION_SCHEMA = z.object({
|
|
|
306
348
|
signalInvocationId: z.string(),
|
|
307
349
|
});
|
|
308
350
|
const SIGNAL_VALUE_OUTCOME_SCHEMA = z.union([
|
|
309
|
-
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
|
|
310
|
-
selectedIndex: z.number().int().nonnegative().optional(),
|
|
311
|
-
status: z.literal("open"),
|
|
312
|
-
}),
|
|
351
|
+
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("open") }),
|
|
313
352
|
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("closed") }),
|
|
314
353
|
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
|
|
315
354
|
failure: SIGNAL_FAILURE_SCHEMA,
|
|
316
355
|
status: z.literal("failed"),
|
|
317
356
|
}),
|
|
318
357
|
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
|
|
319
|
-
output: encodableSchema,
|
|
358
|
+
output: encodableSchema.optional(),
|
|
359
|
+
selectedIndex: z.number().int().nonnegative().optional(),
|
|
320
360
|
status: z.literal("succeeded"),
|
|
321
361
|
}),
|
|
322
362
|
]);
|
|
@@ -489,9 +529,25 @@ const RUNTIME_GENERATION_INPUT_SCHEMA = z.union([
|
|
|
489
529
|
* @param primaryPosition - Optional inherited-parent precedence.
|
|
490
530
|
*/
|
|
491
531
|
export async function hashSignalCoordinatorConfiguration(definition, primaryPosition) {
|
|
532
|
+
const definitionEntries = typeof definition === "object" &&
|
|
533
|
+
definition !== null &&
|
|
534
|
+
!Array.isArray(definition)
|
|
535
|
+
? Object.entries(definition)
|
|
536
|
+
: undefined;
|
|
537
|
+
const policy = definitionEntries?.find(([key]) => key === "policy")?.[1];
|
|
538
|
+
// Existing coordinators were hashed with `strategy` and implicit primary
|
|
539
|
+
// positions for race and fan-out. Preserve that identity while the runtime
|
|
540
|
+
// uses the clearer policy vocabulary and no longer overloads primary state.
|
|
541
|
+
const persistedDefinition = definitionEntries
|
|
542
|
+
? Object.fromEntries(definitionEntries.map(([key, value]) => [
|
|
543
|
+
key === "policy" ? "strategy" : key,
|
|
544
|
+
value,
|
|
545
|
+
]))
|
|
546
|
+
: definition;
|
|
492
547
|
return await sha256Base64Url(JSON.stringify({
|
|
493
|
-
definitionHash: await sha256Base64Url(JSON.stringify(
|
|
494
|
-
primaryPosition: primaryPosition ??
|
|
548
|
+
definitionHash: await sha256Base64Url(JSON.stringify(persistedDefinition)),
|
|
549
|
+
primaryPosition: primaryPosition ??
|
|
550
|
+
(policy === "fanout" || policy === "race" ? "first" : null),
|
|
495
551
|
}));
|
|
496
552
|
}
|
|
497
553
|
/**
|
|
@@ -509,15 +565,7 @@ export const runtimeContract = {
|
|
|
509
565
|
commit: oc
|
|
510
566
|
.input(z.object({
|
|
511
567
|
actionInvocations: ACTION_INVOCATION_SCHEMA.array().default([]),
|
|
512
|
-
coordinationOffers:
|
|
513
|
-
.union([
|
|
514
|
-
COLLECTION_OFFER_SCHEMA,
|
|
515
|
-
CORRELATION_OFFER_SCHEMA,
|
|
516
|
-
FUNNEL_OFFER_SCHEMA,
|
|
517
|
-
RACE_OFFER_SCHEMA,
|
|
518
|
-
])
|
|
519
|
-
.array()
|
|
520
|
-
.default([]),
|
|
568
|
+
coordinationOffers: COORDINATION_OFFER_SCHEMA.array().default([]),
|
|
521
569
|
settled: z.boolean().default(true),
|
|
522
570
|
signalInvocations: SIGNAL_INVOCATION_SCHEMA.array().default([]),
|
|
523
571
|
}))
|
|
@@ -580,11 +628,12 @@ export const runtimeContract = {
|
|
|
580
628
|
}))
|
|
581
629
|
.output(z.void()),
|
|
582
630
|
sendEmail: oc
|
|
583
|
-
.input(z
|
|
631
|
+
.input(z
|
|
632
|
+
.object({
|
|
584
633
|
subject: z.string().min(1),
|
|
585
|
-
text: z.string().min(1),
|
|
586
634
|
to: z.union([z.email(), z.literal("*")]).default("*"),
|
|
587
|
-
})
|
|
635
|
+
})
|
|
636
|
+
.and(EMAIL_BODY_SCHEMA))
|
|
588
637
|
.output(z.object({
|
|
589
638
|
id: z.string().nullable(),
|
|
590
639
|
})),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/api-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
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.
|
|
31
|
+
"@automate.ax/codec": "0.59.0",
|
|
32
32
|
"@orpc/contract": "1.15.0",
|
|
33
33
|
"zod": "^4.3.6"
|
|
34
34
|
},
|
package/src/index.ts
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -31,6 +31,23 @@ const AUTOMATION_INVOCATION_RUN_IN_SCHEMA = z.union([
|
|
|
31
31
|
z.string().min(1),
|
|
32
32
|
z.number().nonnegative(),
|
|
33
33
|
])
|
|
34
|
+
const EMAIL_BODY_SCHEMA = z.union([
|
|
35
|
+
z.object({
|
|
36
|
+
html: z.string().min(1),
|
|
37
|
+
markdown: z.string().min(1).optional(),
|
|
38
|
+
text: z.string().min(1).optional(),
|
|
39
|
+
}),
|
|
40
|
+
z.object({
|
|
41
|
+
html: z.string().min(1).optional(),
|
|
42
|
+
markdown: z.string().min(1),
|
|
43
|
+
text: z.string().min(1).optional(),
|
|
44
|
+
}),
|
|
45
|
+
z.object({
|
|
46
|
+
html: z.string().min(1).optional(),
|
|
47
|
+
markdown: z.string().min(1).optional(),
|
|
48
|
+
text: z.string().min(1),
|
|
49
|
+
}),
|
|
50
|
+
])
|
|
34
51
|
|
|
35
52
|
/** Immediate or mutually exclusive absolute/relative invocation timing. */
|
|
36
53
|
export const automationInvocationScheduleSchema = z.union([
|
|
@@ -184,10 +201,17 @@ const COLLECTION_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
184
201
|
key: encodableSchema,
|
|
185
202
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
186
203
|
policy: z.literal("collect"),
|
|
204
|
+
position: z.number().int().nonnegative().optional(),
|
|
187
205
|
primaryPosition: COORDINATION_PRIMARY_POSITION_SCHEMA,
|
|
188
206
|
ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
|
|
189
207
|
})
|
|
190
208
|
|
|
209
|
+
const FANOUT_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
210
|
+
count: z.number().int().nonnegative(),
|
|
211
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
212
|
+
policy: z.literal("fanout"),
|
|
213
|
+
})
|
|
214
|
+
|
|
191
215
|
const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
192
216
|
key: encodableSchema,
|
|
193
217
|
maxBurstDuration: COORDINATION_DURATION_SCHEMA.optional(),
|
|
@@ -200,6 +224,16 @@ const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
200
224
|
triggerAt: z.enum(["start", "end", "both"]),
|
|
201
225
|
ttl: COORDINATION_DURATION_SCHEMA.optional(),
|
|
202
226
|
}).superRefine((offer, context) => {
|
|
227
|
+
if (
|
|
228
|
+
offer.maxBurstDuration === undefined &&
|
|
229
|
+
offer.minGap === undefined &&
|
|
230
|
+
offer.minQuietPeriod === undefined
|
|
231
|
+
) {
|
|
232
|
+
context.addIssue({
|
|
233
|
+
code: "custom",
|
|
234
|
+
message: "A funnel requires at least one timing control.",
|
|
235
|
+
})
|
|
236
|
+
}
|
|
203
237
|
if (
|
|
204
238
|
offer.triggerAt === "end" &&
|
|
205
239
|
offer.minGap !== undefined &&
|
|
@@ -216,7 +250,8 @@ const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
216
250
|
if (offer.selection !== "all" && offer.selection !== offer.primaryPosition) {
|
|
217
251
|
context.addIssue({
|
|
218
252
|
code: "custom",
|
|
219
|
-
message:
|
|
253
|
+
message:
|
|
254
|
+
"A selecting funnel must inherit conflicting values from its selected occurrence.",
|
|
220
255
|
path: ["primaryPosition"],
|
|
221
256
|
})
|
|
222
257
|
}
|
|
@@ -230,7 +265,7 @@ const FUNNEL_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
230
265
|
})
|
|
231
266
|
|
|
232
267
|
const RACE_OFFER_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
233
|
-
inputOrigins: z.string().array().array().min(
|
|
268
|
+
inputOrigins: z.string().array().array().min(2),
|
|
234
269
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
235
270
|
policy: z.literal("race"),
|
|
236
271
|
scopeOrigins: z.string().array().default([]),
|
|
@@ -251,6 +286,19 @@ const RACE_OFFER_SCHEMA = z
|
|
|
251
286
|
path: ["selectedIndex"],
|
|
252
287
|
})
|
|
253
288
|
|
|
289
|
+
const COORDINATION_OFFER_SCHEMA = z.union([
|
|
290
|
+
COLLECTION_OFFER_SCHEMA,
|
|
291
|
+
CORRELATION_OFFER_SCHEMA,
|
|
292
|
+
FANOUT_OFFER_SCHEMA,
|
|
293
|
+
FUNNEL_OFFER_SCHEMA,
|
|
294
|
+
RACE_OFFER_SCHEMA,
|
|
295
|
+
])
|
|
296
|
+
|
|
297
|
+
/** One validated durable coordination offer sent by the automation runtime. */
|
|
298
|
+
export type RuntimeCoordinationOffer = z.output<
|
|
299
|
+
typeof COORDINATION_OFFER_SCHEMA
|
|
300
|
+
>
|
|
301
|
+
|
|
254
302
|
const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
255
303
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
256
304
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA.optional(),
|
|
@@ -262,9 +310,13 @@ const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
|
262
310
|
}),
|
|
263
311
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
264
312
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA.optional(),
|
|
265
|
-
selectedIndex: z.number().int().nonnegative().optional(),
|
|
266
313
|
status: z.literal("open"),
|
|
267
314
|
}),
|
|
315
|
+
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
316
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA.optional(),
|
|
317
|
+
selectedIndex: z.number().int().nonnegative(),
|
|
318
|
+
status: z.literal("succeeded"),
|
|
319
|
+
}),
|
|
268
320
|
])
|
|
269
321
|
|
|
270
322
|
const SIGNAL_BATCH_OUTCOME_BASE_SCHEMA =
|
|
@@ -276,16 +328,16 @@ const SIGNAL_BATCH_OUTCOME_BASE_SCHEMA =
|
|
|
276
328
|
})
|
|
277
329
|
|
|
278
330
|
const SIGNAL_BATCH_OUTCOME_SCHEMA = z.union([
|
|
279
|
-
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
|
|
280
|
-
selectedIndex: z.number().int().nonnegative().optional(),
|
|
281
|
-
status: z.literal("open"),
|
|
282
|
-
}),
|
|
331
|
+
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("open") }),
|
|
283
332
|
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("closed") }),
|
|
284
333
|
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
|
|
285
334
|
failure: SIGNAL_FAILURE_SCHEMA,
|
|
286
335
|
status: z.literal("failed"),
|
|
287
336
|
}),
|
|
288
|
-
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
|
|
337
|
+
SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
|
|
338
|
+
selectedIndex: z.number().int().nonnegative().optional(),
|
|
339
|
+
status: z.literal("succeeded"),
|
|
340
|
+
}),
|
|
289
341
|
])
|
|
290
342
|
|
|
291
343
|
const ACTION_VALUE_OUTCOME_BASE_SCHEMA = z.object({
|
|
@@ -343,17 +395,15 @@ const COORDINATION_SELECTION_SCHEMA = z.object({
|
|
|
343
395
|
})
|
|
344
396
|
|
|
345
397
|
const SIGNAL_VALUE_OUTCOME_SCHEMA = z.union([
|
|
346
|
-
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
|
|
347
|
-
selectedIndex: z.number().int().nonnegative().optional(),
|
|
348
|
-
status: z.literal("open"),
|
|
349
|
-
}),
|
|
398
|
+
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("open") }),
|
|
350
399
|
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("closed") }),
|
|
351
400
|
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
|
|
352
401
|
failure: SIGNAL_FAILURE_SCHEMA,
|
|
353
402
|
status: z.literal("failed"),
|
|
354
403
|
}),
|
|
355
404
|
SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
|
|
356
|
-
output: encodableSchema,
|
|
405
|
+
output: encodableSchema.optional(),
|
|
406
|
+
selectedIndex: z.number().int().nonnegative().optional(),
|
|
357
407
|
status: z.literal("succeeded"),
|
|
358
408
|
}),
|
|
359
409
|
])
|
|
@@ -553,10 +603,32 @@ export async function hashSignalCoordinatorConfiguration(
|
|
|
553
603
|
definition: unknown,
|
|
554
604
|
primaryPosition?: "first" | "last",
|
|
555
605
|
) {
|
|
606
|
+
const definitionEntries =
|
|
607
|
+
typeof definition === "object" &&
|
|
608
|
+
definition !== null &&
|
|
609
|
+
!Array.isArray(definition)
|
|
610
|
+
? Object.entries(definition)
|
|
611
|
+
: undefined
|
|
612
|
+
const policy = definitionEntries?.find(([key]) => key === "policy")?.[1]
|
|
613
|
+
// Existing coordinators were hashed with `strategy` and implicit primary
|
|
614
|
+
// positions for race and fan-out. Preserve that identity while the runtime
|
|
615
|
+
// uses the clearer policy vocabulary and no longer overloads primary state.
|
|
616
|
+
const persistedDefinition = definitionEntries
|
|
617
|
+
? Object.fromEntries(
|
|
618
|
+
definitionEntries.map(([key, value]) => [
|
|
619
|
+
key === "policy" ? "strategy" : key,
|
|
620
|
+
value,
|
|
621
|
+
]),
|
|
622
|
+
)
|
|
623
|
+
: definition
|
|
556
624
|
return await sha256Base64Url(
|
|
557
625
|
JSON.stringify({
|
|
558
|
-
definitionHash: await sha256Base64Url(
|
|
559
|
-
|
|
626
|
+
definitionHash: await sha256Base64Url(
|
|
627
|
+
JSON.stringify(persistedDefinition),
|
|
628
|
+
),
|
|
629
|
+
primaryPosition:
|
|
630
|
+
primaryPosition ??
|
|
631
|
+
(policy === "fanout" || policy === "race" ? "first" : null),
|
|
560
632
|
}),
|
|
561
633
|
)
|
|
562
634
|
}
|
|
@@ -584,15 +656,7 @@ export const runtimeContract = {
|
|
|
584
656
|
.input(
|
|
585
657
|
z.object({
|
|
586
658
|
actionInvocations: ACTION_INVOCATION_SCHEMA.array().default([]),
|
|
587
|
-
coordinationOffers:
|
|
588
|
-
.union([
|
|
589
|
-
COLLECTION_OFFER_SCHEMA,
|
|
590
|
-
CORRELATION_OFFER_SCHEMA,
|
|
591
|
-
FUNNEL_OFFER_SCHEMA,
|
|
592
|
-
RACE_OFFER_SCHEMA,
|
|
593
|
-
])
|
|
594
|
-
.array()
|
|
595
|
-
.default([]),
|
|
659
|
+
coordinationOffers: COORDINATION_OFFER_SCHEMA.array().default([]),
|
|
596
660
|
settled: z.boolean().default(true),
|
|
597
661
|
signalInvocations: SIGNAL_INVOCATION_SCHEMA.array().default([]),
|
|
598
662
|
}),
|
|
@@ -669,11 +733,12 @@ export const runtimeContract = {
|
|
|
669
733
|
.output(z.void()),
|
|
670
734
|
sendEmail: oc
|
|
671
735
|
.input(
|
|
672
|
-
z
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
736
|
+
z
|
|
737
|
+
.object({
|
|
738
|
+
subject: z.string().min(1),
|
|
739
|
+
to: z.union([z.email(), z.literal("*")]).default("*"),
|
|
740
|
+
})
|
|
741
|
+
.and(EMAIL_BODY_SCHEMA),
|
|
677
742
|
)
|
|
678
743
|
.output(
|
|
679
744
|
z.object({
|