@automate.ax/api-contract 0.102.0 → 0.103.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.
@@ -54,6 +54,97 @@ export declare const automationExecutionStatusSchema: z.ZodEnum<{
54
54
  running: "running";
55
55
  settled: "settled";
56
56
  }>;
57
+ export declare const automationExecutionSummarySchema: z.ZodObject<{
58
+ createdAt: z.ZodDate;
59
+ eventTypes: z.ZodArray<z.ZodString>;
60
+ failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
61
+ id: z.ZodString;
62
+ settledAt: z.ZodNullable<z.ZodDate>;
63
+ status: z.ZodEnum<{
64
+ failed: "failed";
65
+ running: "running";
66
+ settled: "settled";
67
+ }>;
68
+ }, z.core.$strip>;
69
+ export declare const automationExecutionOutputSchema: z.ZodObject<{
70
+ id: z.ZodString;
71
+ status: z.ZodEnum<{
72
+ failed: "failed";
73
+ running: "running";
74
+ settled: "settled";
75
+ }>;
76
+ createdAt: z.ZodDate;
77
+ failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
78
+ settledAt: z.ZodNullable<z.ZodDate>;
79
+ actions: z.ZodArray<z.ZodObject<{
80
+ attempts: z.ZodArray<z.ZodObject<{
81
+ completedAt: z.ZodNullable<z.ZodDate>;
82
+ failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
83
+ id: z.ZodString;
84
+ ordinal: z.ZodNumber;
85
+ retryAt: z.ZodNullable<z.ZodDate>;
86
+ startedAt: z.ZodDate;
87
+ status: z.ZodEnum<{
88
+ succeeded: "succeeded";
89
+ failed: "failed";
90
+ running: "running";
91
+ indeterminate: "indeterminate";
92
+ retrying: "retrying";
93
+ }>;
94
+ }, z.core.$strip>>;
95
+ completedAt: z.ZodNullable<z.ZodDate>;
96
+ createdAt: z.ZodDate;
97
+ description: z.ZodNullable<z.ZodString>;
98
+ failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
99
+ hasOutput: z.ZodBoolean;
100
+ id: z.ZodString;
101
+ maxAttempts: z.ZodNumber;
102
+ name: z.ZodString;
103
+ output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>>;
104
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<import("@automate.ax/codec").SensitivityMask, import("@automate.ax/codec").SensitivityMask>>>;
105
+ replaySafety: z.ZodNullable<z.ZodEnum<{
106
+ safe: "safe";
107
+ unsafe: "unsafe";
108
+ }>>;
109
+ slot: z.ZodNumber;
110
+ status: z.ZodEnum<{
111
+ pending: "pending";
112
+ succeeded: "succeeded";
113
+ failed: "failed";
114
+ skipped: "skipped";
115
+ }>;
116
+ }, z.core.$strip>>;
117
+ events: z.ZodArray<z.ZodObject<{
118
+ createdAt: z.ZodDate;
119
+ id: z.ZodString;
120
+ payload: z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>;
121
+ type: z.ZodString;
122
+ }, z.core.$strip>>;
123
+ outputs: z.ZodArray<z.ZodObject<{
124
+ actionInvocationId: z.ZodString;
125
+ createdAt: z.ZodDate;
126
+ data: z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>;
127
+ id: z.ZodString;
128
+ sensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<import("@automate.ax/codec").SensitivityMask, import("@automate.ax/codec").SensitivityMask>>>;
129
+ outputIndex: z.ZodNumber;
130
+ type: z.ZodString;
131
+ }, z.core.$strip>>;
132
+ }, z.core.$strip>;
133
+ export declare const automationManagementInvocationInputSchema: z.ZodIntersection<z.ZodObject<{
134
+ automationId: z.ZodString;
135
+ entrypoint: z.ZodDefault<z.ZodString>;
136
+ idempotencyKey: z.ZodOptional<z.ZodString>;
137
+ payload: z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>;
138
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
139
+ runAt: z.ZodUnion<readonly [z.ZodDate, z.ZodString, z.ZodNumber]>;
140
+ runIn: z.ZodOptional<z.ZodNever>;
141
+ }, z.core.$strip>, z.ZodObject<{
142
+ runAt: z.ZodOptional<z.ZodNever>;
143
+ runIn: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
144
+ }, z.core.$strip>, z.ZodObject<{
145
+ runAt: z.ZodOptional<z.ZodNever>;
146
+ runIn: z.ZodOptional<z.ZodNever>;
147
+ }, z.core.$strip>]>>;
57
148
  export declare const automationContract: {
58
149
  get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
59
150
  automationId: z.ZodString;
@@ -121,15 +212,35 @@ export declare const automationContract: {
121
212
  failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
122
213
  settledAt: z.ZodNullable<z.ZodDate>;
123
214
  actions: z.ZodArray<z.ZodObject<{
215
+ attempts: z.ZodArray<z.ZodObject<{
216
+ completedAt: z.ZodNullable<z.ZodDate>;
217
+ failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
218
+ id: z.ZodString;
219
+ ordinal: z.ZodNumber;
220
+ retryAt: z.ZodNullable<z.ZodDate>;
221
+ startedAt: z.ZodDate;
222
+ status: z.ZodEnum<{
223
+ succeeded: "succeeded";
224
+ failed: "failed";
225
+ running: "running";
226
+ indeterminate: "indeterminate";
227
+ retrying: "retrying";
228
+ }>;
229
+ }, z.core.$strip>>;
124
230
  completedAt: z.ZodNullable<z.ZodDate>;
125
231
  createdAt: z.ZodDate;
126
232
  description: z.ZodNullable<z.ZodString>;
127
233
  failure: z.ZodNullable<z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>>;
128
234
  hasOutput: z.ZodBoolean;
129
235
  id: z.ZodString;
236
+ maxAttempts: z.ZodNumber;
130
237
  name: z.ZodString;
131
238
  output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>>;
132
239
  outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<import("@automate.ax/codec").SensitivityMask, import("@automate.ax/codec").SensitivityMask>>>;
240
+ replaySafety: z.ZodNullable<z.ZodEnum<{
241
+ safe: "safe";
242
+ unsafe: "unsafe";
243
+ }>>;
133
244
  slot: z.ZodNumber;
134
245
  status: z.ZodEnum<{
135
246
  pending: "pending";
@@ -154,6 +265,24 @@ export declare const automationContract: {
154
265
  type: z.ZodString;
155
266
  }, z.core.$strip>>;
156
267
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
268
+ invoke: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodIntersection<z.ZodObject<{
269
+ automationId: z.ZodString;
270
+ entrypoint: z.ZodDefault<z.ZodString>;
271
+ idempotencyKey: z.ZodOptional<z.ZodString>;
272
+ payload: z.ZodCustom<import("@automate.ax/codec/rpc").CodecEnvelope, import("@automate.ax/codec/rpc").CodecEnvelope>;
273
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
274
+ runAt: z.ZodUnion<readonly [z.ZodDate, z.ZodString, z.ZodNumber]>;
275
+ runIn: z.ZodOptional<z.ZodNever>;
276
+ }, z.core.$strip>, z.ZodObject<{
277
+ runAt: z.ZodOptional<z.ZodNever>;
278
+ runIn: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
279
+ }, z.core.$strip>, z.ZodObject<{
280
+ runAt: z.ZodOptional<z.ZodNever>;
281
+ runIn: z.ZodOptional<z.ZodNever>;
282
+ }, z.core.$strip>]>>, z.ZodObject<{
283
+ id: z.ZodString;
284
+ runAt: z.ZodDate;
285
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
157
286
  list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodPrefault<z.ZodObject<{
158
287
  cursor: z.ZodOptional<z.ZodString>;
159
288
  limit: z.ZodDefault<z.ZodNumber>;
@@ -1,5 +1,5 @@
1
1
  import { codecEnvelopeSchema } from "@automate.ax/codec/rpc";
2
- import { sensitivityMaskSchema } from "./runtime.js";
2
+ import { actionReplaySafetySchema, AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT, automationInvocationOutputSchema, automationInvocationScheduleSchema, sensitivityMaskSchema, } from "./runtime.js";
3
3
  import { oc } from "@orpc/contract";
4
4
  import * as z from "zod";
5
5
  import { integrationAccountBindingOutputSchema } from "./account.js";
@@ -51,7 +51,7 @@ export const automationExecutionStatusSchema = z.enum([
51
51
  "settled",
52
52
  "failed",
53
53
  ]);
54
- const EXECUTION_SUMMARY_SCHEMA = z.object({
54
+ export const automationExecutionSummarySchema = z.object({
55
55
  createdAt: z.date(),
56
56
  eventTypes: z.string().array(),
57
57
  failure: automationErrorSchema.nullable(),
@@ -59,6 +59,74 @@ const EXECUTION_SUMMARY_SCHEMA = z.object({
59
59
  settledAt: z.date().nullable(),
60
60
  status: automationExecutionStatusSchema,
61
61
  });
62
+ export const automationExecutionOutputSchema = automationExecutionSummarySchema
63
+ .omit({ eventTypes: true })
64
+ .extend({
65
+ actions: z
66
+ .object({
67
+ attempts: z
68
+ .object({
69
+ completedAt: z.date().nullable(),
70
+ failure: automationErrorSchema.nullable(),
71
+ id: z.string(),
72
+ ordinal: z.number().int().positive(),
73
+ retryAt: z.date().nullable(),
74
+ startedAt: z.date(),
75
+ status: z.enum([
76
+ "running",
77
+ "retrying",
78
+ "succeeded",
79
+ "failed",
80
+ "indeterminate",
81
+ ]),
82
+ })
83
+ .array(),
84
+ completedAt: z.date().nullable(),
85
+ createdAt: z.date(),
86
+ description: z.string().nullable(),
87
+ failure: automationErrorSchema.nullable(),
88
+ hasOutput: z.boolean(),
89
+ id: z.string(),
90
+ maxAttempts: z.number().int().positive(),
91
+ name: z.string(),
92
+ output: codecEnvelopeSchema.optional(),
93
+ outputSensitivity: sensitivityMaskSchema.nullable().optional(),
94
+ replaySafety: actionReplaySafetySchema.nullable(),
95
+ slot: z.number().int().nonnegative(),
96
+ status: z.enum(["pending", "succeeded", "skipped", "failed"]),
97
+ })
98
+ .array(),
99
+ events: z
100
+ .object({
101
+ createdAt: z.date(),
102
+ id: z.string(),
103
+ payload: codecEnvelopeSchema,
104
+ type: z.string(),
105
+ })
106
+ .array(),
107
+ outputs: z
108
+ .object({
109
+ actionInvocationId: z.string(),
110
+ createdAt: z.date(),
111
+ data: codecEnvelopeSchema,
112
+ id: z.string(),
113
+ sensitivity: sensitivityMaskSchema.nullable().optional(),
114
+ outputIndex: z.number().int().nonnegative(),
115
+ type: z.string(),
116
+ })
117
+ .array(),
118
+ });
119
+ export const automationManagementInvocationInputSchema = z
120
+ .object({
121
+ automationId: z.string().min(1),
122
+ entrypoint: z
123
+ .string()
124
+ .min(1)
125
+ .default(AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT),
126
+ idempotencyKey: z.string().min(1).max(255).optional(),
127
+ payload: codecEnvelopeSchema,
128
+ })
129
+ .and(automationInvocationScheduleSchema);
62
130
  export const automationContract = {
63
131
  get: oc
64
132
  .route({
@@ -72,46 +140,32 @@ export const automationContract = {
72
140
  .input(z.object({ automationId: z.string() }))
73
141
  .output(automationOutputSchema),
74
142
  getExecution: oc
143
+ .route({
144
+ method: "GET",
145
+ path: "/automations/{automationId}/executions/{executionId}",
146
+ operationId: "getAutomationExecution",
147
+ summary: "Get automation execution",
148
+ description: "Returns one execution with decoded events, outputs, actions, and durable logical attempt history.",
149
+ tags: ["Automations"],
150
+ })
75
151
  .input(z.object({
76
152
  automationId: z.string(),
77
153
  executionId: z.string(),
78
154
  }))
79
- .output(EXECUTION_SUMMARY_SCHEMA.omit({ eventTypes: true }).extend({
80
- actions: z
81
- .object({
82
- completedAt: z.date().nullable(),
83
- createdAt: z.date(),
84
- description: z.string().nullable(),
85
- failure: automationErrorSchema.nullable(),
86
- hasOutput: z.boolean(),
87
- id: z.string(),
88
- name: z.string(),
89
- output: codecEnvelopeSchema.optional(),
90
- outputSensitivity: sensitivityMaskSchema.nullable().optional(),
91
- slot: z.number().int().nonnegative(),
92
- status: z.enum(["pending", "succeeded", "skipped", "failed"]),
93
- })
94
- .array(),
95
- events: z
96
- .object({
97
- createdAt: z.date(),
98
- id: z.string(),
99
- payload: codecEnvelopeSchema,
100
- type: z.string(),
101
- })
102
- .array(),
103
- outputs: z
104
- .object({
105
- actionInvocationId: z.string(),
106
- createdAt: z.date(),
107
- data: codecEnvelopeSchema,
108
- id: z.string(),
109
- sensitivity: sensitivityMaskSchema.nullable().optional(),
110
- outputIndex: z.number().int().nonnegative(),
111
- type: z.string(),
112
- })
113
- .array(),
114
- })),
155
+ .output(automationExecutionOutputSchema),
156
+ invoke: oc
157
+ .route({
158
+ method: "POST",
159
+ path: "/automations/{automationId}/invocations",
160
+ operationId: "invokeAutomation",
161
+ summary: "Invoke automation",
162
+ description: "Schedules an invocation for an active automation. Runtime callers use the active action as the idempotency identity; other callers must provide idempotencyKey.",
163
+ successStatus: 202,
164
+ successDescription: "Invocation accepted.",
165
+ tags: ["Automations"],
166
+ })
167
+ .input(automationManagementInvocationInputSchema)
168
+ .output(automationInvocationOutputSchema),
115
169
  list: oc
116
170
  .route({
117
171
  method: "GET",
@@ -131,11 +185,19 @@ export const automationContract = {
131
185
  .prefault({}))
132
186
  .output(cursorPageOutputSchema(automationOutputSchema)),
133
187
  listExecutions: oc
188
+ .route({
189
+ method: "GET",
190
+ path: "/automations/{automationId}/executions",
191
+ operationId: "listAutomationExecutions",
192
+ summary: "List automation executions",
193
+ description: "Lists recent execution summaries for one automation.",
194
+ tags: ["Automations"],
195
+ })
134
196
  .input(z.object({
135
197
  automationId: z.string(),
136
198
  limit: z.number().int().min(1).max(100).default(50),
137
199
  }))
138
- .output(EXECUTION_SUMMARY_SCHEMA.array()),
200
+ .output(automationExecutionSummarySchema.array()),
139
201
  update: oc
140
202
  .route({
141
203
  method: "PATCH",