@automate.ax/api-contract 0.57.1 → 0.57.3
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 +45 -1
- package/dist/index.js +1 -1
- package/dist/runtime.d.ts +51 -0
- package/dist/runtime.js +45 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/runtime.ts +60 -0
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, 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, } 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";
|
|
@@ -1129,7 +1129,47 @@ 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").ZodUnion<readonly [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
|
+
inputOrigins: import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1139
|
+
outcomeSeq: import("zod").ZodNumber;
|
|
1140
|
+
policy: import("zod").ZodLiteral<"race">;
|
|
1141
|
+
scopeOrigins: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1142
|
+
selectedIndex: import("zod").ZodNumber;
|
|
1143
|
+
status: import("zod").ZodLiteral<"closed">;
|
|
1144
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1145
|
+
actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1146
|
+
eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1147
|
+
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1148
|
+
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1149
|
+
slot: import("zod").ZodNumber;
|
|
1150
|
+
inputOrigins: import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1151
|
+
outcomeSeq: import("zod").ZodNumber;
|
|
1152
|
+
policy: import("zod").ZodLiteral<"race">;
|
|
1153
|
+
scopeOrigins: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1154
|
+
selectedIndex: import("zod").ZodNumber;
|
|
1155
|
+
failure: import("zod").ZodObject<{
|
|
1156
|
+
message: import("zod").ZodString;
|
|
1157
|
+
name: import("zod").ZodString;
|
|
1158
|
+
}, import("zod/v4/core").$strip>;
|
|
1159
|
+
status: import("zod").ZodLiteral<"failed">;
|
|
1132
1160
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
1161
|
+
actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1162
|
+
eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1163
|
+
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1164
|
+
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1165
|
+
slot: import("zod").ZodNumber;
|
|
1166
|
+
inputOrigins: import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1167
|
+
outcomeSeq: import("zod").ZodNumber;
|
|
1168
|
+
policy: import("zod").ZodLiteral<"race">;
|
|
1169
|
+
scopeOrigins: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1170
|
+
selectedIndex: import("zod").ZodNumber;
|
|
1171
|
+
status: import("zod").ZodLiteral<"succeeded">;
|
|
1172
|
+
}, import("zod/v4/core").$strip>]>, import("zod").ZodObject<{
|
|
1133
1173
|
actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1134
1174
|
eventDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1135
1175
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
@@ -1417,6 +1457,7 @@ export declare const contract: {
|
|
|
1417
1457
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1418
1458
|
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1419
1459
|
slot: import("zod").ZodNumber;
|
|
1460
|
+
coordinatorConfigurationHash: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1420
1461
|
contextId: import("zod").ZodString;
|
|
1421
1462
|
outcomeSeq: import("zod").ZodNumber;
|
|
1422
1463
|
signalInvocationId: import("zod").ZodString;
|
|
@@ -1428,6 +1469,7 @@ export declare const contract: {
|
|
|
1428
1469
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1429
1470
|
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1430
1471
|
slot: import("zod").ZodNumber;
|
|
1472
|
+
coordinatorConfigurationHash: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1431
1473
|
contextId: import("zod").ZodString;
|
|
1432
1474
|
outcomeSeq: import("zod").ZodNumber;
|
|
1433
1475
|
signalInvocationId: import("zod").ZodString;
|
|
@@ -1438,6 +1480,7 @@ export declare const contract: {
|
|
|
1438
1480
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1439
1481
|
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1440
1482
|
slot: import("zod").ZodNumber;
|
|
1483
|
+
coordinatorConfigurationHash: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1441
1484
|
contextId: import("zod").ZodString;
|
|
1442
1485
|
outcomeSeq: import("zod").ZodNumber;
|
|
1443
1486
|
signalInvocationId: import("zod").ZodString;
|
|
@@ -1452,6 +1495,7 @@ export declare const contract: {
|
|
|
1452
1495
|
scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
|
|
1453
1496
|
signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
|
|
1454
1497
|
slot: import("zod").ZodNumber;
|
|
1498
|
+
coordinatorConfigurationHash: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1455
1499
|
contextId: import("zod").ZodString;
|
|
1456
1500
|
outcomeSeq: import("zod").ZodNumber;
|
|
1457
1501
|
signalInvocationId: import("zod").ZodString;
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { runtimeContract } from "./runtime.js";
|
|
|
11
11
|
export { automationExecutionStatusSchema } from "./automation.js";
|
|
12
12
|
export { AUTOMATION_SDK_VERSION } from "./deployment.js";
|
|
13
13
|
export { integrationAccountOutputSchema } from "./account.js";
|
|
14
|
-
export { AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT, AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX, DEFAULT_GATEWAY_MODEL_ID, automationInvocationInputSchema, automationInvocationOutputSchema, automationInvocationScheduleSchema, generationInputSchema, generationResultSchema, runtimeContract, } from "./runtime.js";
|
|
14
|
+
export { AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT, AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX, DEFAULT_GATEWAY_MODEL_ID, automationInvocationInputSchema, automationInvocationOutputSchema, automationInvocationScheduleSchema, generationInputSchema, generationResultSchema, hashSignalCoordinatorConfiguration, runtimeContract, } from "./runtime.js";
|
|
15
15
|
export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
|
|
16
16
|
export { activeSubscriptionOutputSchema, createdInvitationOutputSchema, organizationDetailsOutputSchema, organizationInvitationOutputSchema, organizationMemberOutputSchema, organizationProjectOutputSchema, organizationRoleSchema, organizationSummaryOutputSchema, publicOrganizationOutputSchema, } from "./org.js";
|
|
17
17
|
export { projectOutputSchema } from "./project.js";
|
package/dist/runtime.d.ts
CHANGED
|
@@ -187,6 +187,13 @@ declare const RUNTIME_GENERATION_INPUT_SCHEMA: z.ZodUnion<readonly [z.ZodObject<
|
|
|
187
187
|
}, z.core.$strip>>;
|
|
188
188
|
}, z.core.$strip>]>;
|
|
189
189
|
export type RuntimeGenerationInput = z.output<typeof RUNTIME_GENERATION_INPUT_SCHEMA>;
|
|
190
|
+
/**
|
|
191
|
+
* Hashes one coordinator definition exactly as the runtime stores it.
|
|
192
|
+
*
|
|
193
|
+
* @param definition - Structural coordinator definition.
|
|
194
|
+
* @param primaryPosition - Optional inherited-parent precedence.
|
|
195
|
+
*/
|
|
196
|
+
export declare function hashSignalCoordinatorConfiguration(definition: unknown, primaryPosition?: "first" | "last"): Promise<string>;
|
|
190
197
|
export declare const runtimeContract: {
|
|
191
198
|
commit: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
192
199
|
actionInvocations: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -254,7 +261,47 @@ export declare const runtimeContract: {
|
|
|
254
261
|
streamName: z.ZodString;
|
|
255
262
|
streamNames: z.ZodArray<z.ZodString>;
|
|
256
263
|
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
264
|
+
}, z.core.$strip>, z.ZodUnion<readonly [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
|
+
inputOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
271
|
+
outcomeSeq: z.ZodNumber;
|
|
272
|
+
policy: z.ZodLiteral<"race">;
|
|
273
|
+
scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
274
|
+
selectedIndex: z.ZodNumber;
|
|
275
|
+
status: z.ZodLiteral<"closed">;
|
|
276
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
278
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
279
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
280
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
281
|
+
slot: z.ZodNumber;
|
|
282
|
+
inputOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
283
|
+
outcomeSeq: z.ZodNumber;
|
|
284
|
+
policy: z.ZodLiteral<"race">;
|
|
285
|
+
scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
286
|
+
selectedIndex: z.ZodNumber;
|
|
287
|
+
failure: z.ZodObject<{
|
|
288
|
+
message: z.ZodString;
|
|
289
|
+
name: z.ZodString;
|
|
290
|
+
}, z.core.$strip>;
|
|
291
|
+
status: z.ZodLiteral<"failed">;
|
|
257
292
|
}, z.core.$strip>, z.ZodObject<{
|
|
293
|
+
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
294
|
+
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
295
|
+
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
296
|
+
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
297
|
+
slot: z.ZodNumber;
|
|
298
|
+
inputOrigins: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
299
|
+
outcomeSeq: z.ZodNumber;
|
|
300
|
+
policy: z.ZodLiteral<"race">;
|
|
301
|
+
scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
302
|
+
selectedIndex: z.ZodNumber;
|
|
303
|
+
status: z.ZodLiteral<"succeeded">;
|
|
304
|
+
}, z.core.$strip>]>, z.ZodObject<{
|
|
258
305
|
actionDependencyIds: z.ZodArray<z.ZodString>;
|
|
259
306
|
eventDependencyIds: z.ZodArray<z.ZodString>;
|
|
260
307
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
@@ -542,6 +589,7 @@ export declare const runtimeContract: {
|
|
|
542
589
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
543
590
|
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
544
591
|
slot: z.ZodNumber;
|
|
592
|
+
coordinatorConfigurationHash: z.ZodOptional<z.ZodString>;
|
|
545
593
|
contextId: z.ZodString;
|
|
546
594
|
outcomeSeq: z.ZodNumber;
|
|
547
595
|
signalInvocationId: z.ZodString;
|
|
@@ -553,6 +601,7 @@ export declare const runtimeContract: {
|
|
|
553
601
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
554
602
|
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
555
603
|
slot: z.ZodNumber;
|
|
604
|
+
coordinatorConfigurationHash: z.ZodOptional<z.ZodString>;
|
|
556
605
|
contextId: z.ZodString;
|
|
557
606
|
outcomeSeq: z.ZodNumber;
|
|
558
607
|
signalInvocationId: z.ZodString;
|
|
@@ -563,6 +612,7 @@ export declare const runtimeContract: {
|
|
|
563
612
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
564
613
|
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
565
614
|
slot: z.ZodNumber;
|
|
615
|
+
coordinatorConfigurationHash: z.ZodOptional<z.ZodString>;
|
|
566
616
|
contextId: z.ZodString;
|
|
567
617
|
outcomeSeq: z.ZodNumber;
|
|
568
618
|
signalInvocationId: z.ZodString;
|
|
@@ -577,6 +627,7 @@ export declare const runtimeContract: {
|
|
|
577
627
|
scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
578
628
|
signalDependencyIds: z.ZodArray<z.ZodString>;
|
|
579
629
|
slot: z.ZodNumber;
|
|
630
|
+
coordinatorConfigurationHash: z.ZodOptional<z.ZodString>;
|
|
580
631
|
contextId: z.ZodString;
|
|
581
632
|
outcomeSeq: z.ZodNumber;
|
|
582
633
|
signalInvocationId: z.ZodString;
|
package/dist/runtime.js
CHANGED
|
@@ -170,6 +170,26 @@ const WINDOW_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
170
170
|
primaryPosition: COORDINATION_PRIMARY_POSITION_SCHEMA,
|
|
171
171
|
ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
|
|
172
172
|
});
|
|
173
|
+
const RACE_OFFER_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
174
|
+
inputOrigins: z.string().array().array().min(1),
|
|
175
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
176
|
+
policy: z.literal("race"),
|
|
177
|
+
scopeOrigins: z.string().array().default([]),
|
|
178
|
+
selectedIndex: z.number().int().nonnegative(),
|
|
179
|
+
});
|
|
180
|
+
const RACE_OFFER_SCHEMA = z
|
|
181
|
+
.union([
|
|
182
|
+
RACE_OFFER_BASE_SCHEMA.extend({ status: z.literal("closed") }),
|
|
183
|
+
RACE_OFFER_BASE_SCHEMA.extend({
|
|
184
|
+
failure: SIGNAL_FAILURE_SCHEMA,
|
|
185
|
+
status: z.literal("failed"),
|
|
186
|
+
}),
|
|
187
|
+
RACE_OFFER_BASE_SCHEMA.extend({ status: z.literal("succeeded") }),
|
|
188
|
+
])
|
|
189
|
+
.refine((offer) => offer.selectedIndex < offer.inputOrigins.length, {
|
|
190
|
+
message: "Race input must identify a declared input.",
|
|
191
|
+
path: ["selectedIndex"],
|
|
192
|
+
});
|
|
173
193
|
const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
174
194
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
175
195
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA.optional(),
|
|
@@ -186,6 +206,7 @@ const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
|
186
206
|
}),
|
|
187
207
|
]);
|
|
188
208
|
const SIGNAL_BATCH_OUTCOME_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
209
|
+
coordinatorConfigurationHash: z.string().optional(),
|
|
189
210
|
contextId: z.string(),
|
|
190
211
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
191
212
|
signalInvocationId: z.string(),
|
|
@@ -428,6 +449,29 @@ const RUNTIME_GENERATION_INPUT_SCHEMA = z.union([
|
|
|
428
449
|
output: RUNTIME_GENERATION_OUTPUT_SCHEMA,
|
|
429
450
|
}),
|
|
430
451
|
]);
|
|
452
|
+
/**
|
|
453
|
+
* Hashes one coordinator definition exactly as the runtime stores it.
|
|
454
|
+
*
|
|
455
|
+
* @param definition - Structural coordinator definition.
|
|
456
|
+
* @param primaryPosition - Optional inherited-parent precedence.
|
|
457
|
+
*/
|
|
458
|
+
export async function hashSignalCoordinatorConfiguration(definition, primaryPosition) {
|
|
459
|
+
return await sha256Base64Url(JSON.stringify({
|
|
460
|
+
definitionHash: await sha256Base64Url(JSON.stringify(definition)),
|
|
461
|
+
primaryPosition: primaryPosition ?? null,
|
|
462
|
+
}));
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Hashes UTF-8 text to an unpadded URL-safe base64 digest.
|
|
466
|
+
*
|
|
467
|
+
* @param value - Text to hash.
|
|
468
|
+
*/
|
|
469
|
+
async function sha256Base64Url(value) {
|
|
470
|
+
return btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value)))))
|
|
471
|
+
.replaceAll("+", "-")
|
|
472
|
+
.replaceAll("/", "_")
|
|
473
|
+
.replace(/=+$/, "");
|
|
474
|
+
}
|
|
431
475
|
export const runtimeContract = {
|
|
432
476
|
commit: oc
|
|
433
477
|
.input(z.object({
|
|
@@ -436,6 +480,7 @@ export const runtimeContract = {
|
|
|
436
480
|
.union([
|
|
437
481
|
COLLECTION_OFFER_SCHEMA,
|
|
438
482
|
CORRELATION_OFFER_SCHEMA,
|
|
483
|
+
RACE_OFFER_SCHEMA,
|
|
439
484
|
WINDOW_OFFER_SCHEMA,
|
|
440
485
|
])
|
|
441
486
|
.array()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/api-contract",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.3",
|
|
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.
|
|
31
|
+
"@automate.ax/codec": "0.57.3",
|
|
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
|
@@ -193,6 +193,28 @@ const WINDOW_OFFER_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
|
193
193
|
ttl: z.union([z.string().min(1), z.number().nonnegative()]).optional(),
|
|
194
194
|
})
|
|
195
195
|
|
|
196
|
+
const RACE_OFFER_BASE_SCHEMA = SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
197
|
+
inputOrigins: z.string().array().array().min(1),
|
|
198
|
+
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
199
|
+
policy: z.literal("race"),
|
|
200
|
+
scopeOrigins: z.string().array().default([]),
|
|
201
|
+
selectedIndex: z.number().int().nonnegative(),
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
const RACE_OFFER_SCHEMA = z
|
|
205
|
+
.union([
|
|
206
|
+
RACE_OFFER_BASE_SCHEMA.extend({ status: z.literal("closed") }),
|
|
207
|
+
RACE_OFFER_BASE_SCHEMA.extend({
|
|
208
|
+
failure: SIGNAL_FAILURE_SCHEMA,
|
|
209
|
+
status: z.literal("failed"),
|
|
210
|
+
}),
|
|
211
|
+
RACE_OFFER_BASE_SCHEMA.extend({ status: z.literal("succeeded") }),
|
|
212
|
+
])
|
|
213
|
+
.refine((offer) => offer.selectedIndex < offer.inputOrigins.length, {
|
|
214
|
+
message: "Race input must identify a declared input.",
|
|
215
|
+
path: ["selectedIndex"],
|
|
216
|
+
})
|
|
217
|
+
|
|
196
218
|
const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
197
219
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
198
220
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA.optional(),
|
|
@@ -211,6 +233,7 @@ const SIGNAL_INVOCATION_SCHEMA = z.union([
|
|
|
211
233
|
|
|
212
234
|
const SIGNAL_BATCH_OUTCOME_BASE_SCHEMA =
|
|
213
235
|
SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
|
|
236
|
+
coordinatorConfigurationHash: z.string().optional(),
|
|
214
237
|
contextId: z.string(),
|
|
215
238
|
outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
|
|
216
239
|
signalInvocationId: z.string(),
|
|
@@ -484,6 +507,42 @@ export type RuntimeGenerationInput = z.output<
|
|
|
484
507
|
typeof RUNTIME_GENERATION_INPUT_SCHEMA
|
|
485
508
|
>
|
|
486
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Hashes one coordinator definition exactly as the runtime stores it.
|
|
512
|
+
*
|
|
513
|
+
* @param definition - Structural coordinator definition.
|
|
514
|
+
* @param primaryPosition - Optional inherited-parent precedence.
|
|
515
|
+
*/
|
|
516
|
+
export async function hashSignalCoordinatorConfiguration(
|
|
517
|
+
definition: unknown,
|
|
518
|
+
primaryPosition?: "first" | "last",
|
|
519
|
+
) {
|
|
520
|
+
return await sha256Base64Url(
|
|
521
|
+
JSON.stringify({
|
|
522
|
+
definitionHash: await sha256Base64Url(JSON.stringify(definition)),
|
|
523
|
+
primaryPosition: primaryPosition ?? null,
|
|
524
|
+
}),
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Hashes UTF-8 text to an unpadded URL-safe base64 digest.
|
|
530
|
+
*
|
|
531
|
+
* @param value - Text to hash.
|
|
532
|
+
*/
|
|
533
|
+
async function sha256Base64Url(value: string) {
|
|
534
|
+
return btoa(
|
|
535
|
+
String.fromCharCode(
|
|
536
|
+
...new Uint8Array(
|
|
537
|
+
await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value)),
|
|
538
|
+
),
|
|
539
|
+
),
|
|
540
|
+
)
|
|
541
|
+
.replaceAll("+", "-")
|
|
542
|
+
.replaceAll("/", "_")
|
|
543
|
+
.replace(/=+$/, "")
|
|
544
|
+
}
|
|
545
|
+
|
|
487
546
|
export const runtimeContract = {
|
|
488
547
|
commit: oc
|
|
489
548
|
.input(
|
|
@@ -493,6 +552,7 @@ export const runtimeContract = {
|
|
|
493
552
|
.union([
|
|
494
553
|
COLLECTION_OFFER_SCHEMA,
|
|
495
554
|
CORRELATION_OFFER_SCHEMA,
|
|
555
|
+
RACE_OFFER_SCHEMA,
|
|
496
556
|
WINDOW_OFFER_SCHEMA,
|
|
497
557
|
])
|
|
498
558
|
.array()
|