@automate.ax/api-contract 0.70.1 → 0.72.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.
@@ -48,6 +48,11 @@ export declare const authorizationContract: {
48
48
  serviceId: z.ZodString;
49
49
  }, z.core.$strip>>;
50
50
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
51
+ proceed: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
52
+ deploymentId: z.ZodString;
53
+ }, z.core.$strip>, z.ZodObject<{
54
+ txid: z.ZodNumber;
55
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
51
56
  submitCredentials: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
52
57
  binding: z.ZodString;
53
58
  connectionId: z.ZodString;
@@ -72,6 +72,9 @@ export const authorizationContract = {
72
72
  })
73
73
  .array(),
74
74
  })),
75
+ proceed: oc
76
+ .input(z.object({ deploymentId: z.string() }))
77
+ .output(z.object({ txid: z.number().int().nonnegative() })),
75
78
  submitCredentials: oc
76
79
  .input(z.object({
77
80
  binding: z.string().min(1),
@@ -17,18 +17,12 @@ export declare const automationContract: {
17
17
  }>;
18
18
  completedAt: z.ZodNullable<z.ZodDate>;
19
19
  createdAt: z.ZodDate;
20
- failure: z.ZodNullable<z.ZodObject<{
21
- message: z.ZodString;
22
- name: z.ZodString;
23
- }, z.core.$strip>>;
20
+ failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
24
21
  actions: z.ZodArray<z.ZodObject<{
25
22
  completedAt: z.ZodNullable<z.ZodDate>;
26
23
  createdAt: z.ZodDate;
27
24
  description: z.ZodNullable<z.ZodString>;
28
- failure: z.ZodNullable<z.ZodObject<{
29
- message: z.ZodString;
30
- name: z.ZodString;
31
- }, z.core.$strip>>;
25
+ failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
32
26
  hasOutput: z.ZodBoolean;
33
27
  id: z.ZodString;
34
28
  name: z.ZodString;
@@ -63,10 +57,7 @@ export declare const automationContract: {
63
57
  completedAt: z.ZodNullable<z.ZodDate>;
64
58
  createdAt: z.ZodDate;
65
59
  eventTypes: z.ZodArray<z.ZodString>;
66
- failure: z.ZodNullable<z.ZodObject<{
67
- message: z.ZodString;
68
- name: z.ZodString;
69
- }, z.core.$strip>>;
60
+ failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
70
61
  id: z.ZodString;
71
62
  status: z.ZodEnum<{
72
63
  failed: "failed";
@@ -1,20 +1,17 @@
1
1
  import { encodableSchema } from "@automate.ax/codec";
2
2
  import { oc } from "@orpc/contract";
3
3
  import { z } from "zod";
4
+ import { automationErrorSchema } from "./errors.js";
4
5
  export const automationExecutionStatusSchema = z.enum([
5
6
  "running",
6
7
  "completed",
7
8
  "failed",
8
9
  ]);
9
- const EXECUTION_FAILURE_SCHEMA = z.object({
10
- message: z.string(),
11
- name: z.string(),
12
- });
13
10
  const EXECUTION_SUMMARY_SCHEMA = z.object({
14
11
  completedAt: z.date().nullable(),
15
12
  createdAt: z.date(),
16
13
  eventTypes: z.string().array(),
17
- failure: EXECUTION_FAILURE_SCHEMA.nullable(),
14
+ failure: automationErrorSchema.nullable(),
18
15
  id: z.string(),
19
16
  status: automationExecutionStatusSchema,
20
17
  });
@@ -30,7 +27,7 @@ export const automationContract = {
30
27
  completedAt: z.date().nullable(),
31
28
  createdAt: z.date(),
32
29
  description: z.string().nullable(),
33
- failure: EXECUTION_FAILURE_SCHEMA.nullable(),
30
+ failure: automationErrorSchema.nullable(),
34
31
  hasOutput: z.boolean(),
35
32
  id: z.string(),
36
33
  name: z.string(),
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export declare const AUTOMATION_ERROR_CAUSE_DEPTH = 3;
3
+ export interface AutomationErrorValue {
4
+ /** Normalized and depth-limited underlying failure. */
5
+ cause?: AutomationErrorValue;
6
+ /** Stable machine-readable classification. */
7
+ code: string;
8
+ /** Structured author-safe diagnostics such as validation issues. */
9
+ details?: z.output<ReturnType<typeof z.json>>;
10
+ /** Human-readable summary safe to show automation authors. */
11
+ message: string;
12
+ /** Original JavaScript or provider error class when available. */
13
+ name?: string;
14
+ }
15
+ /** Author-safe normalized automation lifecycle error. */
16
+ export declare const automationErrorSchema: z.ZodType<AutomationErrorValue, AutomationErrorValue, z.core.$ZodTypeInternals<AutomationErrorValue, AutomationErrorValue>>;
package/dist/errors.js ADDED
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ const AUTOMATION_ERROR_BASE_SCHEMA = z.object({
3
+ code: z.string().min(1),
4
+ details: z.json().optional(),
5
+ message: z.string(),
6
+ name: z.string().optional(),
7
+ });
8
+ export const AUTOMATION_ERROR_CAUSE_DEPTH = 3;
9
+ /** Author-safe normalized automation lifecycle error. */
10
+ export const automationErrorSchema = createAutomationErrorSchema(AUTOMATION_ERROR_CAUSE_DEPTH);
11
+ /**
12
+ * Builds the finite public causal chain accepted at runtime boundaries.
13
+ *
14
+ * @param remainingDepth - Additional nested causes accepted by this level.
15
+ */
16
+ function createAutomationErrorSchema(remainingDepth) {
17
+ return AUTOMATION_ERROR_BASE_SCHEMA.extend({
18
+ cause: remainingDepth > 0
19
+ ? createAutomationErrorSchema(remainingDepth - 1).optional()
20
+ : z.never().optional(),
21
+ });
22
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { automationExecutionStatusSchema } from "./automation.js";
2
2
  export { AUTOMATION_SDK_VERSION } from "./deployment.js";
3
+ export { AUTOMATION_ERROR_CAUSE_DEPTH, automationErrorSchema, type AutomationErrorValue, } from "./errors.js";
3
4
  export { integrationAccountOutputSchema } from "./account.js";
4
5
  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
6
  export type { GatewayModelId } from "@ai-sdk/gateway";
@@ -353,18 +354,12 @@ export declare const firstPartyContract: {
353
354
  }>;
354
355
  completedAt: import("zod").ZodNullable<import("zod").ZodDate>;
355
356
  createdAt: import("zod").ZodDate;
356
- failure: import("zod").ZodNullable<import("zod").ZodObject<{
357
- message: import("zod").ZodString;
358
- name: import("zod").ZodString;
359
- }, import("zod/v4/core").$strip>>;
357
+ failure: import("zod").ZodNullable<import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
360
358
  actions: import("zod").ZodArray<import("zod").ZodObject<{
361
359
  completedAt: import("zod").ZodNullable<import("zod").ZodDate>;
362
360
  createdAt: import("zod").ZodDate;
363
361
  description: import("zod").ZodNullable<import("zod").ZodString>;
364
- failure: import("zod").ZodNullable<import("zod").ZodObject<{
365
- message: import("zod").ZodString;
366
- name: import("zod").ZodString;
367
- }, import("zod/v4/core").$strip>>;
362
+ failure: import("zod").ZodNullable<import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
368
363
  hasOutput: import("zod").ZodBoolean;
369
364
  id: import("zod").ZodString;
370
365
  name: import("zod").ZodString;
@@ -399,10 +394,7 @@ export declare const firstPartyContract: {
399
394
  completedAt: import("zod").ZodNullable<import("zod").ZodDate>;
400
395
  createdAt: import("zod").ZodDate;
401
396
  eventTypes: import("zod").ZodArray<import("zod").ZodString>;
402
- failure: import("zod").ZodNullable<import("zod").ZodObject<{
403
- message: import("zod").ZodString;
404
- name: import("zod").ZodString;
405
- }, import("zod/v4/core").$strip>>;
397
+ failure: import("zod").ZodNullable<import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
406
398
  id: import("zod").ZodString;
407
399
  status: import("zod").ZodEnum<{
408
400
  failed: "failed";
@@ -461,6 +453,11 @@ export declare const firstPartyContract: {
461
453
  serviceId: import("zod").ZodString;
462
454
  }, import("zod/v4/core").$strip>>;
463
455
  }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
456
+ proceed: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
457
+ deploymentId: import("zod").ZodString;
458
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
459
+ txid: import("zod").ZodNumber;
460
+ }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
464
461
  selectAccount: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
465
462
  accountId: import("zod").ZodString;
466
463
  binding: import("zod").ZodString;
@@ -947,6 +944,11 @@ export declare const contract: {
947
944
  serviceId: import("zod").ZodString;
948
945
  }, import("zod/v4/core").$strip>>;
949
946
  }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
947
+ proceed: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
948
+ deploymentId: import("zod").ZodString;
949
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
950
+ txid: import("zod").ZodNumber;
951
+ }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
950
952
  selectAccount: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
951
953
  accountId: import("zod").ZodString;
952
954
  binding: import("zod").ZodString;
@@ -1095,10 +1097,7 @@ export declare const contract: {
1095
1097
  scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
1096
1098
  signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1097
1099
  slot: import("zod").ZodNumber;
1098
- failure: import("zod").ZodObject<{
1099
- message: import("zod").ZodString;
1100
- name: import("zod").ZodString;
1101
- }, import("zod/v4/core").$strip>;
1100
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1102
1101
  reason: import("zod").ZodLiteral<"failed-dependency">;
1103
1102
  status: import("zod").ZodLiteral<"skipped">;
1104
1103
  }, import("zod/v4/core").$strip>]>>>;
@@ -1191,10 +1190,7 @@ export declare const contract: {
1191
1190
  policy: import("zod").ZodLiteral<"race">;
1192
1191
  scopeOrigins: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
1193
1192
  selectedIndex: import("zod").ZodNumber;
1194
- failure: import("zod").ZodObject<{
1195
- message: import("zod").ZodString;
1196
- name: import("zod").ZodString;
1197
- }, import("zod/v4/core").$strip>;
1193
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1198
1194
  status: import("zod").ZodLiteral<"failed">;
1199
1195
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1200
1196
  actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
@@ -1224,10 +1220,7 @@ export declare const contract: {
1224
1220
  scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
1225
1221
  signalDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
1226
1222
  slot: import("zod").ZodNumber;
1227
- failure: import("zod").ZodObject<{
1228
- message: import("zod").ZodString;
1229
- name: import("zod").ZodString;
1230
- }, import("zod/v4/core").$strip>;
1223
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1231
1224
  status: import("zod").ZodLiteral<"failed">;
1232
1225
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1233
1226
  actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
@@ -1252,17 +1245,11 @@ export declare const contract: {
1252
1245
  reason: import("zod").ZodLiteral<"closed-dependency">;
1253
1246
  status: import("zod").ZodLiteral<"skipped">;
1254
1247
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1255
- failure: import("zod").ZodObject<{
1256
- message: import("zod").ZodString;
1257
- name: import("zod").ZodString;
1258
- }, import("zod/v4/core").$strip>;
1248
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1259
1249
  reason: import("zod").ZodLiteral<"failed-dependency">;
1260
1250
  status: import("zod").ZodLiteral<"skipped">;
1261
1251
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1262
- failure: import("zod").ZodObject<{
1263
- message: import("zod").ZodString;
1264
- name: import("zod").ZodString;
1265
- }, import("zod/v4/core").$strip>;
1252
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1266
1253
  status: import("zod").ZodLiteral<"failed">;
1267
1254
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1268
1255
  output: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
@@ -1417,10 +1404,7 @@ export declare const contract: {
1417
1404
  slot: import("zod").ZodNumber;
1418
1405
  actionInvocationId: import("zod").ZodString;
1419
1406
  contextId: import("zod").ZodString;
1420
- failure: import("zod").ZodObject<{
1421
- message: import("zod").ZodString;
1422
- name: import("zod").ZodString;
1423
- }, import("zod/v4/core").$strip>;
1407
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1424
1408
  outcomeSeq: import("zod").ZodNumber;
1425
1409
  status: import("zod").ZodLiteral<"failed">;
1426
1410
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -1448,10 +1432,7 @@ export declare const contract: {
1448
1432
  slot: import("zod").ZodNumber;
1449
1433
  actionInvocationId: import("zod").ZodString;
1450
1434
  contextId: import("zod").ZodString;
1451
- failure: import("zod").ZodObject<{
1452
- message: import("zod").ZodString;
1453
- name: import("zod").ZodString;
1454
- }, import("zod/v4/core").$strip>;
1435
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1455
1436
  outcomeSeq: import("zod").ZodNumber;
1456
1437
  reason: import("zod").ZodLiteral<"failed-dependency">;
1457
1438
  status: import("zod").ZodLiteral<"skipped">;
@@ -1515,10 +1496,7 @@ export declare const contract: {
1515
1496
  contextId: import("zod").ZodString;
1516
1497
  outcomeSeq: import("zod").ZodNumber;
1517
1498
  signalInvocationId: import("zod").ZodString;
1518
- failure: import("zod").ZodObject<{
1519
- message: import("zod").ZodString;
1520
- name: import("zod").ZodString;
1521
- }, import("zod/v4/core").$strip>;
1499
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1522
1500
  status: import("zod").ZodLiteral<"failed">;
1523
1501
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1524
1502
  actionDependencyIds: import("zod").ZodArray<import("zod").ZodString>;
@@ -1545,10 +1523,7 @@ export declare const contract: {
1545
1523
  timestamp: import("zod").ZodDate;
1546
1524
  outcomeSeq: import("zod").ZodNumber;
1547
1525
  status: import("zod").ZodLiteral<"failed">;
1548
- failure: import("zod").ZodObject<{
1549
- message: import("zod").ZodString;
1550
- name: import("zod").ZodString;
1551
- }, import("zod/v4/core").$strip>;
1526
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1552
1527
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1553
1528
  actionInvocationId: import("zod").ZodString;
1554
1529
  contextId: import("zod").ZodString;
@@ -1565,10 +1540,7 @@ export declare const contract: {
1565
1540
  scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
1566
1541
  slot: import("zod").ZodNumber;
1567
1542
  timestamp: import("zod").ZodDate;
1568
- failure: import("zod").ZodObject<{
1569
- message: import("zod").ZodString;
1570
- name: import("zod").ZodString;
1571
- }, import("zod/v4/core").$strip>;
1543
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1572
1544
  reason: import("zod").ZodLiteral<"failed-dependency">;
1573
1545
  status: import("zod").ZodLiteral<"skipped">;
1574
1546
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -1629,10 +1601,7 @@ export declare const contract: {
1629
1601
  signalInvocationId: import("zod").ZodString;
1630
1602
  slot: import("zod").ZodNumber;
1631
1603
  timestamp: import("zod").ZodDate;
1632
- failure: import("zod").ZodObject<{
1633
- message: import("zod").ZodString;
1634
- name: import("zod").ZodString;
1635
- }, import("zod/v4/core").$strip>;
1604
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1636
1605
  status: import("zod").ZodLiteral<"failed">;
1637
1606
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1638
1607
  contextId: import("zod").ZodString;
@@ -1674,10 +1643,7 @@ export declare const contract: {
1674
1643
  timestamp: import("zod").ZodDate;
1675
1644
  outcomeSeq: import("zod").ZodNumber;
1676
1645
  status: import("zod").ZodLiteral<"failed">;
1677
- failure: import("zod").ZodObject<{
1678
- message: import("zod").ZodString;
1679
- name: import("zod").ZodString;
1680
- }, import("zod/v4/core").$strip>;
1646
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1681
1647
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1682
1648
  actionInvocationId: import("zod").ZodString;
1683
1649
  contextId: import("zod").ZodString;
@@ -1694,10 +1660,7 @@ export declare const contract: {
1694
1660
  scopePath: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodNumber>>;
1695
1661
  slot: import("zod").ZodNumber;
1696
1662
  timestamp: import("zod").ZodDate;
1697
- failure: import("zod").ZodObject<{
1698
- message: import("zod").ZodString;
1699
- name: import("zod").ZodString;
1700
- }, import("zod/v4/core").$strip>;
1663
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1701
1664
  reason: import("zod").ZodLiteral<"failed-dependency">;
1702
1665
  status: import("zod").ZodLiteral<"skipped">;
1703
1666
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -1758,10 +1721,7 @@ export declare const contract: {
1758
1721
  signalInvocationId: import("zod").ZodString;
1759
1722
  slot: import("zod").ZodNumber;
1760
1723
  timestamp: import("zod").ZodDate;
1761
- failure: import("zod").ZodObject<{
1762
- message: import("zod").ZodString;
1763
- name: import("zod").ZodString;
1764
- }, import("zod/v4/core").$strip>;
1724
+ failure: import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1765
1725
  status: import("zod").ZodLiteral<"failed">;
1766
1726
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1767
1727
  contextId: import("zod").ZodString;
@@ -1874,18 +1834,12 @@ export declare const contract: {
1874
1834
  }>;
1875
1835
  completedAt: import("zod").ZodNullable<import("zod").ZodDate>;
1876
1836
  createdAt: import("zod").ZodDate;
1877
- failure: import("zod").ZodNullable<import("zod").ZodObject<{
1878
- message: import("zod").ZodString;
1879
- name: import("zod").ZodString;
1880
- }, import("zod/v4/core").$strip>>;
1837
+ failure: import("zod").ZodNullable<import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
1881
1838
  actions: import("zod").ZodArray<import("zod").ZodObject<{
1882
1839
  completedAt: import("zod").ZodNullable<import("zod").ZodDate>;
1883
1840
  createdAt: import("zod").ZodDate;
1884
1841
  description: import("zod").ZodNullable<import("zod").ZodString>;
1885
- failure: import("zod").ZodNullable<import("zod").ZodObject<{
1886
- message: import("zod").ZodString;
1887
- name: import("zod").ZodString;
1888
- }, import("zod/v4/core").$strip>>;
1842
+ failure: import("zod").ZodNullable<import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
1889
1843
  hasOutput: import("zod").ZodBoolean;
1890
1844
  id: import("zod").ZodString;
1891
1845
  name: import("zod").ZodString;
@@ -1920,10 +1874,7 @@ export declare const contract: {
1920
1874
  completedAt: import("zod").ZodNullable<import("zod").ZodDate>;
1921
1875
  createdAt: import("zod").ZodDate;
1922
1876
  eventTypes: import("zod").ZodArray<import("zod").ZodString>;
1923
- failure: import("zod").ZodNullable<import("zod").ZodObject<{
1924
- message: import("zod").ZodString;
1925
- name: import("zod").ZodString;
1926
- }, import("zod/v4/core").$strip>>;
1877
+ failure: import("zod").ZodNullable<import("zod").ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, import("zod/v4/core").$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
1927
1878
  id: import("zod").ZodString;
1928
1879
  status: import("zod").ZodEnum<{
1929
1880
  failed: "failed";
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import { projectContract } from "./project.js";
10
10
  import { runtimeContract } from "./runtime.js";
11
11
  export { automationExecutionStatusSchema } from "./automation.js";
12
12
  export { AUTOMATION_SDK_VERSION } from "./deployment.js";
13
+ export { AUTOMATION_ERROR_CAUSE_DEPTH, automationErrorSchema, } from "./errors.js";
13
14
  export { integrationAccountOutputSchema } from "./account.js";
14
15
  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
16
  export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
@@ -50,6 +51,7 @@ export const firstPartyContract = {
50
51
  authorization: {
51
52
  beginConnection: authorizationContract.beginConnection,
52
53
  get: authorizationContract.get,
54
+ proceed: authorizationContract.proceed,
53
55
  selectAccount: authorizationContract.selectAccount,
54
56
  submitCredentials: authorizationContract.submitCredentials,
55
57
  },
package/dist/runtime.d.ts CHANGED
@@ -127,10 +127,7 @@ declare const COORDINATION_OFFER_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
127
127
  policy: z.ZodLiteral<"race">;
128
128
  scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
129
129
  selectedIndex: z.ZodNumber;
130
- failure: z.ZodObject<{
131
- message: z.ZodString;
132
- name: z.ZodString;
133
- }, z.core.$strip>;
130
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
134
131
  status: z.ZodLiteral<"failed">;
135
132
  }, z.core.$strip>, z.ZodObject<{
136
133
  actionDependencyIds: z.ZodArray<z.ZodString>;
@@ -335,10 +332,7 @@ export declare const runtimeContract: {
335
332
  scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
336
333
  signalDependencyIds: z.ZodArray<z.ZodString>;
337
334
  slot: z.ZodNumber;
338
- failure: z.ZodObject<{
339
- message: z.ZodString;
340
- name: z.ZodString;
341
- }, z.core.$strip>;
335
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
342
336
  reason: z.ZodLiteral<"failed-dependency">;
343
337
  status: z.ZodLiteral<"skipped">;
344
338
  }, z.core.$strip>]>>>;
@@ -431,10 +425,7 @@ export declare const runtimeContract: {
431
425
  policy: z.ZodLiteral<"race">;
432
426
  scopeOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
433
427
  selectedIndex: z.ZodNumber;
434
- failure: z.ZodObject<{
435
- message: z.ZodString;
436
- name: z.ZodString;
437
- }, z.core.$strip>;
428
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
438
429
  status: z.ZodLiteral<"failed">;
439
430
  }, z.core.$strip>, z.ZodObject<{
440
431
  actionDependencyIds: z.ZodArray<z.ZodString>;
@@ -464,10 +455,7 @@ export declare const runtimeContract: {
464
455
  scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
465
456
  signalDependencyIds: z.ZodArray<z.ZodString>;
466
457
  slot: z.ZodNumber;
467
- failure: z.ZodObject<{
468
- message: z.ZodString;
469
- name: z.ZodString;
470
- }, z.core.$strip>;
458
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
471
459
  status: z.ZodLiteral<"failed">;
472
460
  }, z.core.$strip>, z.ZodObject<{
473
461
  actionDependencyIds: z.ZodArray<z.ZodString>;
@@ -492,17 +480,11 @@ export declare const runtimeContract: {
492
480
  reason: z.ZodLiteral<"closed-dependency">;
493
481
  status: z.ZodLiteral<"skipped">;
494
482
  }, z.core.$strip>, z.ZodObject<{
495
- failure: z.ZodObject<{
496
- message: z.ZodString;
497
- name: z.ZodString;
498
- }, z.core.$strip>;
483
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
499
484
  reason: z.ZodLiteral<"failed-dependency">;
500
485
  status: z.ZodLiteral<"skipped">;
501
486
  }, z.core.$strip>, z.ZodObject<{
502
- failure: z.ZodObject<{
503
- message: z.ZodString;
504
- name: z.ZodString;
505
- }, z.core.$strip>;
487
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
506
488
  status: z.ZodLiteral<"failed">;
507
489
  }, z.core.$strip>, z.ZodObject<{
508
490
  output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
@@ -657,10 +639,7 @@ export declare const runtimeContract: {
657
639
  slot: z.ZodNumber;
658
640
  actionInvocationId: z.ZodString;
659
641
  contextId: z.ZodString;
660
- failure: z.ZodObject<{
661
- message: z.ZodString;
662
- name: z.ZodString;
663
- }, z.core.$strip>;
642
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
664
643
  outcomeSeq: z.ZodNumber;
665
644
  status: z.ZodLiteral<"failed">;
666
645
  }, z.core.$strip>, z.ZodObject<{
@@ -688,10 +667,7 @@ export declare const runtimeContract: {
688
667
  slot: z.ZodNumber;
689
668
  actionInvocationId: z.ZodString;
690
669
  contextId: z.ZodString;
691
- failure: z.ZodObject<{
692
- message: z.ZodString;
693
- name: z.ZodString;
694
- }, z.core.$strip>;
670
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
695
671
  outcomeSeq: z.ZodNumber;
696
672
  reason: z.ZodLiteral<"failed-dependency">;
697
673
  status: z.ZodLiteral<"skipped">;
@@ -755,10 +731,7 @@ export declare const runtimeContract: {
755
731
  contextId: z.ZodString;
756
732
  outcomeSeq: z.ZodNumber;
757
733
  signalInvocationId: z.ZodString;
758
- failure: z.ZodObject<{
759
- message: z.ZodString;
760
- name: z.ZodString;
761
- }, z.core.$strip>;
734
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
762
735
  status: z.ZodLiteral<"failed">;
763
736
  }, z.core.$strip>, z.ZodObject<{
764
737
  actionDependencyIds: z.ZodArray<z.ZodString>;
@@ -785,10 +758,7 @@ export declare const runtimeContract: {
785
758
  timestamp: z.ZodDate;
786
759
  outcomeSeq: z.ZodNumber;
787
760
  status: z.ZodLiteral<"failed">;
788
- failure: z.ZodObject<{
789
- message: z.ZodString;
790
- name: z.ZodString;
791
- }, z.core.$strip>;
761
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
792
762
  }, z.core.$strip>, z.ZodObject<{
793
763
  actionInvocationId: z.ZodString;
794
764
  contextId: z.ZodString;
@@ -805,10 +775,7 @@ export declare const runtimeContract: {
805
775
  scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
806
776
  slot: z.ZodNumber;
807
777
  timestamp: z.ZodDate;
808
- failure: z.ZodObject<{
809
- message: z.ZodString;
810
- name: z.ZodString;
811
- }, z.core.$strip>;
778
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
812
779
  reason: z.ZodLiteral<"failed-dependency">;
813
780
  status: z.ZodLiteral<"skipped">;
814
781
  }, z.core.$strip>, z.ZodObject<{
@@ -869,10 +836,7 @@ export declare const runtimeContract: {
869
836
  signalInvocationId: z.ZodString;
870
837
  slot: z.ZodNumber;
871
838
  timestamp: z.ZodDate;
872
- failure: z.ZodObject<{
873
- message: z.ZodString;
874
- name: z.ZodString;
875
- }, z.core.$strip>;
839
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
876
840
  status: z.ZodLiteral<"failed">;
877
841
  }, z.core.$strip>, z.ZodObject<{
878
842
  contextId: z.ZodString;
@@ -914,10 +878,7 @@ export declare const runtimeContract: {
914
878
  timestamp: z.ZodDate;
915
879
  outcomeSeq: z.ZodNumber;
916
880
  status: z.ZodLiteral<"failed">;
917
- failure: z.ZodObject<{
918
- message: z.ZodString;
919
- name: z.ZodString;
920
- }, z.core.$strip>;
881
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
921
882
  }, z.core.$strip>, z.ZodObject<{
922
883
  actionInvocationId: z.ZodString;
923
884
  contextId: z.ZodString;
@@ -934,10 +895,7 @@ export declare const runtimeContract: {
934
895
  scopePath: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
935
896
  slot: z.ZodNumber;
936
897
  timestamp: z.ZodDate;
937
- failure: z.ZodObject<{
938
- message: z.ZodString;
939
- name: z.ZodString;
940
- }, z.core.$strip>;
898
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
941
899
  reason: z.ZodLiteral<"failed-dependency">;
942
900
  status: z.ZodLiteral<"skipped">;
943
901
  }, z.core.$strip>, z.ZodObject<{
@@ -998,10 +956,7 @@ export declare const runtimeContract: {
998
956
  signalInvocationId: z.ZodString;
999
957
  slot: z.ZodNumber;
1000
958
  timestamp: z.ZodDate;
1001
- failure: z.ZodObject<{
1002
- message: z.ZodString;
1003
- name: z.ZodString;
1004
- }, z.core.$strip>;
959
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
1005
960
  status: z.ZodLiteral<"failed">;
1006
961
  }, z.core.$strip>, z.ZodObject<{
1007
962
  contextId: z.ZodString;
package/dist/runtime.js CHANGED
@@ -2,14 +2,11 @@ import { encodableSchema } from "@automate.ax/codec";
2
2
  import { oc } from "@orpc/contract";
3
3
  import stableStringify from "fast-json-stable-stringify";
4
4
  import { z } from "zod";
5
+ import { automationErrorSchema } from "./errors.js";
5
6
  /** Default model used by the platform Vercel AI Gateway account. */
6
7
  export const DEFAULT_GATEWAY_MODEL_ID = "openai/gpt-4.1-nano";
7
8
  export const AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT = "default";
8
9
  export const AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX = "__$";
9
- const SIGNAL_FAILURE_SCHEMA = z.object({
10
- message: z.string(),
11
- name: z.string(),
12
- });
13
10
  const OUTCOME_SEQUENCE_SCHEMA = z.number().int().positive();
14
11
  const HOOK_SCOPE_PATH_SCHEMA = z
15
12
  .number()
@@ -98,7 +95,7 @@ const ACTION_INVOCATION_SCHEMA = z.union([
98
95
  status: z.literal("skipped"),
99
96
  }),
100
97
  ACTION_INVOCATION_BASE_SCHEMA.extend({
101
- failure: SIGNAL_FAILURE_SCHEMA,
98
+ failure: automationErrorSchema,
102
99
  reason: z.literal("failed-dependency"),
103
100
  status: z.literal("skipped"),
104
101
  }),
@@ -110,7 +107,7 @@ const ACTION_RUN_INVOCATION_BASE_SCHEMA = ACTION_INVOCATION_BASE_SCHEMA.extend({
110
107
  const ACTION_RUN_INVOCATION_SCHEMA = z.union([
111
108
  ACTION_RUN_INVOCATION_BASE_SCHEMA.extend({ status: z.literal("pending") }),
112
109
  ACTION_RUN_INVOCATION_BASE_SCHEMA.extend({
113
- failure: SIGNAL_FAILURE_SCHEMA,
110
+ failure: automationErrorSchema,
114
111
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
115
112
  status: z.literal("failed"),
116
113
  }),
@@ -120,7 +117,7 @@ const ACTION_RUN_INVOCATION_SCHEMA = z.union([
120
117
  status: z.literal("skipped"),
121
118
  }),
122
119
  ACTION_RUN_INVOCATION_BASE_SCHEMA.extend({
123
- failure: SIGNAL_FAILURE_SCHEMA,
120
+ failure: automationErrorSchema,
124
121
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
125
122
  reason: z.literal("failed-dependency"),
126
123
  status: z.literal("skipped"),
@@ -246,7 +243,7 @@ const RACE_OFFER_SCHEMA = z
246
243
  .union([
247
244
  RACE_OFFER_BASE_SCHEMA.extend({ status: z.literal("closed") }),
248
245
  RACE_OFFER_BASE_SCHEMA.extend({
249
- failure: SIGNAL_FAILURE_SCHEMA,
246
+ failure: automationErrorSchema,
250
247
  status: z.literal("failed"),
251
248
  }),
252
249
  RACE_OFFER_BASE_SCHEMA.extend({ status: z.literal("succeeded") }),
@@ -268,7 +265,7 @@ const SIGNAL_INVOCATION_SCHEMA = z.union([
268
265
  status: z.literal("closed"),
269
266
  }),
270
267
  SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
271
- failure: SIGNAL_FAILURE_SCHEMA,
268
+ failure: automationErrorSchema,
272
269
  status: z.literal("failed"),
273
270
  }),
274
271
  SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
@@ -291,7 +288,7 @@ const SIGNAL_BATCH_OUTCOME_SCHEMA = z.union([
291
288
  SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("open") }),
292
289
  SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("closed") }),
293
290
  SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
294
- failure: SIGNAL_FAILURE_SCHEMA,
291
+ failure: automationErrorSchema,
295
292
  status: z.literal("failed"),
296
293
  }),
297
294
  SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
@@ -311,14 +308,14 @@ const ACTION_VALUE_OUTCOME_SCHEMA = z.union([
311
308
  ACTION_VALUE_OUTCOME_BASE_SCHEMA.extend({
312
309
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
313
310
  status: z.literal("failed"),
314
- failure: SIGNAL_FAILURE_SCHEMA,
311
+ failure: automationErrorSchema,
315
312
  }),
316
313
  ACTION_VALUE_OUTCOME_BASE_SCHEMA.extend({
317
314
  reason: z.literal("closed-dependency"),
318
315
  status: z.literal("skipped"),
319
316
  }),
320
317
  ACTION_VALUE_OUTCOME_BASE_SCHEMA.extend({
321
- failure: SIGNAL_FAILURE_SCHEMA,
318
+ failure: automationErrorSchema,
322
319
  reason: z.literal("failed-dependency"),
323
320
  status: z.literal("skipped"),
324
321
  }),
@@ -354,7 +351,7 @@ const SIGNAL_VALUE_OUTCOME_SCHEMA = z.union([
354
351
  SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("open") }),
355
352
  SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("closed") }),
356
353
  SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
357
- failure: SIGNAL_FAILURE_SCHEMA,
354
+ failure: automationErrorSchema,
358
355
  status: z.literal("failed"),
359
356
  }),
360
357
  SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
@@ -581,12 +578,12 @@ export const runtimeContract = {
581
578
  status: z.literal("skipped"),
582
579
  }),
583
580
  z.object({
584
- failure: SIGNAL_FAILURE_SCHEMA,
581
+ failure: automationErrorSchema,
585
582
  reason: z.literal("failed-dependency"),
586
583
  status: z.literal("skipped"),
587
584
  }),
588
585
  z.object({
589
- failure: SIGNAL_FAILURE_SCHEMA,
586
+ failure: automationErrorSchema,
590
587
  status: z.literal("failed"),
591
588
  }),
592
589
  z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.70.1",
3
+ "version": "0.72.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.70.1",
31
+ "@automate.ax/codec": "0.72.0",
32
32
  "@orpc/contract": "1.15.0",
33
33
  "fast-json-stable-stringify": "^2.1.0",
34
34
  "zod": "^4.3.6"
@@ -90,6 +90,9 @@ export const authorizationContract = {
90
90
  .array(),
91
91
  }),
92
92
  ),
93
+ proceed: oc
94
+ .input(z.object({ deploymentId: z.string() }))
95
+ .output(z.object({ txid: z.number().int().nonnegative() })),
93
96
  submitCredentials: oc
94
97
  .input(
95
98
  z.object({
package/src/automation.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { encodableSchema } from "@automate.ax/codec"
2
2
  import { oc } from "@orpc/contract"
3
3
  import { z } from "zod"
4
+ import { automationErrorSchema } from "./errors"
4
5
 
5
6
  export const automationExecutionStatusSchema = z.enum([
6
7
  "running",
@@ -8,16 +9,11 @@ export const automationExecutionStatusSchema = z.enum([
8
9
  "failed",
9
10
  ])
10
11
 
11
- const EXECUTION_FAILURE_SCHEMA = z.object({
12
- message: z.string(),
13
- name: z.string(),
14
- })
15
-
16
12
  const EXECUTION_SUMMARY_SCHEMA = z.object({
17
13
  completedAt: z.date().nullable(),
18
14
  createdAt: z.date(),
19
15
  eventTypes: z.string().array(),
20
- failure: EXECUTION_FAILURE_SCHEMA.nullable(),
16
+ failure: automationErrorSchema.nullable(),
21
17
  id: z.string(),
22
18
  status: automationExecutionStatusSchema,
23
19
  })
@@ -37,7 +33,7 @@ export const automationContract = {
37
33
  completedAt: z.date().nullable(),
38
34
  createdAt: z.date(),
39
35
  description: z.string().nullable(),
40
- failure: EXECUTION_FAILURE_SCHEMA.nullable(),
36
+ failure: automationErrorSchema.nullable(),
41
37
  hasOutput: z.boolean(),
42
38
  id: z.string(),
43
39
  name: z.string(),
package/src/errors.ts ADDED
@@ -0,0 +1,48 @@
1
+ import { z } from "zod"
2
+
3
+ const AUTOMATION_ERROR_BASE_SCHEMA = z.object({
4
+ code: z.string().min(1),
5
+ details: z.json().optional(),
6
+ message: z.string(),
7
+ name: z.string().optional(),
8
+ })
9
+
10
+ export const AUTOMATION_ERROR_CAUSE_DEPTH = 3
11
+
12
+ export interface AutomationErrorValue {
13
+ /** Normalized and depth-limited underlying failure. */
14
+ cause?: AutomationErrorValue
15
+
16
+ /** Stable machine-readable classification. */
17
+ code: string
18
+
19
+ /** Structured author-safe diagnostics such as validation issues. */
20
+ details?: z.output<ReturnType<typeof z.json>>
21
+
22
+ /** Human-readable summary safe to show automation authors. */
23
+ message: string
24
+
25
+ /** Original JavaScript or provider error class when available. */
26
+ name?: string
27
+ }
28
+
29
+ /** Author-safe normalized automation lifecycle error. */
30
+ export const automationErrorSchema = createAutomationErrorSchema(
31
+ AUTOMATION_ERROR_CAUSE_DEPTH,
32
+ )
33
+
34
+ /**
35
+ * Builds the finite public causal chain accepted at runtime boundaries.
36
+ *
37
+ * @param remainingDepth - Additional nested causes accepted by this level.
38
+ */
39
+ function createAutomationErrorSchema(
40
+ remainingDepth: number,
41
+ ): z.ZodType<AutomationErrorValue, AutomationErrorValue> {
42
+ return AUTOMATION_ERROR_BASE_SCHEMA.extend({
43
+ cause:
44
+ remainingDepth > 0
45
+ ? createAutomationErrorSchema(remainingDepth - 1).optional()
46
+ : z.never().optional(),
47
+ })
48
+ }
package/src/index.ts CHANGED
@@ -11,6 +11,11 @@ import { runtimeContract } from "./runtime"
11
11
 
12
12
  export { automationExecutionStatusSchema } from "./automation"
13
13
  export { AUTOMATION_SDK_VERSION } from "./deployment"
14
+ export {
15
+ AUTOMATION_ERROR_CAUSE_DEPTH,
16
+ automationErrorSchema,
17
+ type AutomationErrorValue,
18
+ } from "./errors"
14
19
  export { integrationAccountOutputSchema } from "./account"
15
20
  export {
16
21
  AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT,
@@ -87,6 +92,7 @@ export const firstPartyContract = {
87
92
  authorization: {
88
93
  beginConnection: authorizationContract.beginConnection,
89
94
  get: authorizationContract.get,
95
+ proceed: authorizationContract.proceed,
90
96
  selectAccount: authorizationContract.selectAccount,
91
97
  submitCredentials: authorizationContract.submitCredentials,
92
98
  },
package/src/runtime.ts CHANGED
@@ -3,6 +3,7 @@ import type { GatewayModelId } from "@ai-sdk/gateway"
3
3
  import { oc } from "@orpc/contract"
4
4
  import stableStringify from "fast-json-stable-stringify"
5
5
  import { z } from "zod"
6
+ import { automationErrorSchema } from "./errors"
6
7
 
7
8
  /** Default model used by the platform Vercel AI Gateway account. */
8
9
  export const DEFAULT_GATEWAY_MODEL_ID =
@@ -10,11 +11,6 @@ export const DEFAULT_GATEWAY_MODEL_ID =
10
11
  export const AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT = "default"
11
12
  export const AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX = "__$"
12
13
 
13
- const SIGNAL_FAILURE_SCHEMA = z.object({
14
- message: z.string(),
15
- name: z.string(),
16
- })
17
-
18
14
  const OUTCOME_SEQUENCE_SCHEMA = z.number().int().positive()
19
15
  const HOOK_SCOPE_PATH_SCHEMA = z
20
16
  .number()
@@ -111,7 +107,7 @@ const ACTION_INVOCATION_SCHEMA = z.union([
111
107
  status: z.literal("skipped"),
112
108
  }),
113
109
  ACTION_INVOCATION_BASE_SCHEMA.extend({
114
- failure: SIGNAL_FAILURE_SCHEMA,
110
+ failure: automationErrorSchema,
115
111
  reason: z.literal("failed-dependency"),
116
112
  status: z.literal("skipped"),
117
113
  }),
@@ -125,7 +121,7 @@ const ACTION_RUN_INVOCATION_BASE_SCHEMA = ACTION_INVOCATION_BASE_SCHEMA.extend({
125
121
  const ACTION_RUN_INVOCATION_SCHEMA = z.union([
126
122
  ACTION_RUN_INVOCATION_BASE_SCHEMA.extend({ status: z.literal("pending") }),
127
123
  ACTION_RUN_INVOCATION_BASE_SCHEMA.extend({
128
- failure: SIGNAL_FAILURE_SCHEMA,
124
+ failure: automationErrorSchema,
129
125
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
130
126
  status: z.literal("failed"),
131
127
  }),
@@ -135,7 +131,7 @@ const ACTION_RUN_INVOCATION_SCHEMA = z.union([
135
131
  status: z.literal("skipped"),
136
132
  }),
137
133
  ACTION_RUN_INVOCATION_BASE_SCHEMA.extend({
138
- failure: SIGNAL_FAILURE_SCHEMA,
134
+ failure: automationErrorSchema,
139
135
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
140
136
  reason: z.literal("failed-dependency"),
141
137
  status: z.literal("skipped"),
@@ -275,7 +271,7 @@ const RACE_OFFER_SCHEMA = z
275
271
  .union([
276
272
  RACE_OFFER_BASE_SCHEMA.extend({ status: z.literal("closed") }),
277
273
  RACE_OFFER_BASE_SCHEMA.extend({
278
- failure: SIGNAL_FAILURE_SCHEMA,
274
+ failure: automationErrorSchema,
279
275
  status: z.literal("failed"),
280
276
  }),
281
277
  RACE_OFFER_BASE_SCHEMA.extend({ status: z.literal("succeeded") }),
@@ -304,7 +300,7 @@ const SIGNAL_INVOCATION_SCHEMA = z.union([
304
300
  status: z.literal("closed"),
305
301
  }),
306
302
  SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
307
- failure: SIGNAL_FAILURE_SCHEMA,
303
+ failure: automationErrorSchema,
308
304
  status: z.literal("failed"),
309
305
  }),
310
306
  SIGNAL_INVOCATION_DEPENDENCIES_SCHEMA.extend({
@@ -330,7 +326,7 @@ const SIGNAL_BATCH_OUTCOME_SCHEMA = z.union([
330
326
  SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("open") }),
331
327
  SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("closed") }),
332
328
  SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
333
- failure: SIGNAL_FAILURE_SCHEMA,
329
+ failure: automationErrorSchema,
334
330
  status: z.literal("failed"),
335
331
  }),
336
332
  SIGNAL_BATCH_OUTCOME_BASE_SCHEMA.extend({
@@ -352,14 +348,14 @@ const ACTION_VALUE_OUTCOME_SCHEMA = z.union([
352
348
  ACTION_VALUE_OUTCOME_BASE_SCHEMA.extend({
353
349
  outcomeSeq: OUTCOME_SEQUENCE_SCHEMA,
354
350
  status: z.literal("failed"),
355
- failure: SIGNAL_FAILURE_SCHEMA,
351
+ failure: automationErrorSchema,
356
352
  }),
357
353
  ACTION_VALUE_OUTCOME_BASE_SCHEMA.extend({
358
354
  reason: z.literal("closed-dependency"),
359
355
  status: z.literal("skipped"),
360
356
  }),
361
357
  ACTION_VALUE_OUTCOME_BASE_SCHEMA.extend({
362
- failure: SIGNAL_FAILURE_SCHEMA,
358
+ failure: automationErrorSchema,
363
359
  reason: z.literal("failed-dependency"),
364
360
  status: z.literal("skipped"),
365
361
  }),
@@ -399,7 +395,7 @@ const SIGNAL_VALUE_OUTCOME_SCHEMA = z.union([
399
395
  SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("open") }),
400
396
  SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({ status: z.literal("closed") }),
401
397
  SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
402
- failure: SIGNAL_FAILURE_SCHEMA,
398
+ failure: automationErrorSchema,
403
399
  status: z.literal("failed"),
404
400
  }),
405
401
  SIGNAL_VALUE_OUTCOME_BASE_SCHEMA.extend({
@@ -672,12 +668,12 @@ export const runtimeContract = {
672
668
  status: z.literal("skipped"),
673
669
  }),
674
670
  z.object({
675
- failure: SIGNAL_FAILURE_SCHEMA,
671
+ failure: automationErrorSchema,
676
672
  reason: z.literal("failed-dependency"),
677
673
  status: z.literal("skipped"),
678
674
  }),
679
675
  z.object({
680
- failure: SIGNAL_FAILURE_SCHEMA,
676
+ failure: automationErrorSchema,
681
677
  status: z.literal("failed"),
682
678
  }),
683
679
  z.object({