@automate.ax/api-contract 0.75.0 → 0.77.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.
Files changed (91) hide show
  1. package/dist/account.d.ts +373 -8
  2. package/dist/account.js +245 -14
  3. package/dist/api-key.d.ts +17 -9
  4. package/dist/api-key.js +4 -4
  5. package/dist/auth.d.ts +1 -1
  6. package/dist/auth.js +1 -1
  7. package/dist/authorization.d.ts +5 -5
  8. package/dist/authorization.js +21 -5
  9. package/dist/automation.d.ts +171 -6
  10. package/dist/automation.js +83 -3
  11. package/dist/deployment.d.ts +166 -10
  12. package/dist/deployment.js +113 -44
  13. package/dist/errors.d.ts +1 -1
  14. package/dist/errors.js +1 -1
  15. package/dist/events/airtable.d.ts +1 -1
  16. package/dist/events/airtable.js +1 -1
  17. package/dist/events/asana.d.ts +1 -1
  18. package/dist/events/asana.js +1 -1
  19. package/dist/events/brevo.d.ts +1 -1
  20. package/dist/events/brevo.js +1 -1
  21. package/dist/events/github.d.ts +1 -1
  22. package/dist/events/github.js +1 -1
  23. package/dist/events/gmail.d.ts +1 -1
  24. package/dist/events/gmail.js +1 -1
  25. package/dist/events/google-calendar.d.ts +1 -1
  26. package/dist/events/google-calendar.js +1 -1
  27. package/dist/events/google-forms.d.ts +1 -1
  28. package/dist/events/google-forms.js +1 -1
  29. package/dist/events/google-meet.d.ts +20 -0
  30. package/dist/events/google-meet.js +38 -0
  31. package/dist/events/index.d.ts +17 -0
  32. package/dist/events/index.js +2 -0
  33. package/dist/events/linear.d.ts +1 -1
  34. package/dist/events/linear.js +1 -1
  35. package/dist/events/mailhook.d.ts +1 -1
  36. package/dist/events/mailhook.js +1 -1
  37. package/dist/events/microsoft.d.ts +1 -1
  38. package/dist/events/microsoft.js +1 -1
  39. package/dist/events/resend.d.ts +1 -1
  40. package/dist/events/resend.js +1 -1
  41. package/dist/events/slack.d.ts +1 -1
  42. package/dist/events/slack.js +1 -1
  43. package/dist/events/trello.d.ts +1 -1
  44. package/dist/events/trello.js +1 -1
  45. package/dist/events/vercel.d.ts +1 -1
  46. package/dist/events/vercel.js +1 -1
  47. package/dist/events/whatsapp.d.ts +1 -1
  48. package/dist/events/whatsapp.js +1 -1
  49. package/dist/execution-data.d.ts +90 -0
  50. package/dist/execution-data.js +53 -0
  51. package/dist/index.d.ts +2022 -392
  52. package/dist/index.js +30 -9
  53. package/dist/org.d.ts +44 -36
  54. package/dist/org.js +6 -6
  55. package/dist/project.d.ts +24 -16
  56. package/dist/project.js +6 -6
  57. package/dist/runtime.d.ts +38 -3
  58. package/dist/runtime.js +54 -2
  59. package/dist/schemas.d.ts +21 -1
  60. package/dist/schemas.js +20 -1
  61. package/package.json +17 -6
  62. package/src/account.ts +263 -18
  63. package/src/api-key.ts +8 -4
  64. package/src/auth.ts +1 -1
  65. package/src/authorization.ts +23 -5
  66. package/src/automation.ts +90 -3
  67. package/src/deployment.ts +119 -44
  68. package/src/errors.ts +1 -1
  69. package/src/events/airtable.ts +1 -1
  70. package/src/events/asana.ts +1 -1
  71. package/src/events/brevo.ts +1 -1
  72. package/src/events/github.ts +1 -1
  73. package/src/events/gmail.ts +1 -1
  74. package/src/events/google-calendar.ts +1 -1
  75. package/src/events/google-forms.ts +1 -1
  76. package/src/events/google-meet.ts +48 -0
  77. package/src/events/index.ts +2 -0
  78. package/src/events/linear.ts +1 -1
  79. package/src/events/mailhook.ts +1 -1
  80. package/src/events/microsoft.ts +1 -1
  81. package/src/events/resend.ts +1 -1
  82. package/src/events/slack.ts +1 -1
  83. package/src/events/trello.ts +1 -1
  84. package/src/events/vercel.ts +1 -1
  85. package/src/events/whatsapp.ts +1 -1
  86. package/src/execution-data.ts +69 -0
  87. package/src/index.ts +61 -8
  88. package/src/org.ts +10 -6
  89. package/src/project.ts +10 -6
  90. package/src/runtime.ts +68 -2
  91. package/src/schemas.ts +23 -1
package/dist/index.js CHANGED
@@ -5,23 +5,42 @@ import { authContract } from "./auth.js";
5
5
  import { authorizationContract } from "./authorization.js";
6
6
  import { deploymentContract } from "./deployment.js";
7
7
  import { eventsContract } from "./events/index.js";
8
+ import { executionDataContract } from "./execution-data.js";
8
9
  import { orgContract } from "./org.js";
9
10
  import { projectContract } from "./project.js";
10
11
  import { runtimeContract } from "./runtime.js";
11
- export { automationExecutionStatusSchema } from "./automation.js";
12
- export { AUTOMATION_SDK_VERSION } from "./deployment.js";
12
+ export { automationExecutionStatusSchema, automationOutputSchema, } from "./automation.js";
13
+ export { EXECUTION_DATASET_VERSION, executionDatasetManifestSchema, executionDatasetResourceSchema, executionDatasetScopeSchema, executionDataContract, } from "./execution-data.js";
14
+ export { AUTOMATION_SDK_VERSION, deploymentOutputSchema, deploymentStatusSchema, } from "./deployment.js";
13
15
  export { AUTOMATION_ERROR_CAUSE_DEPTH, automationErrorSchema, } from "./errors.js";
14
- export { integrationAccountOutputSchema } from "./account.js";
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";
16
+ export { integrationAccountOutputSchema, integrationAccountRevocationImpactOutputSchema, integrationAccountRevocationOutputSchema, integrationServiceOutputSchema, } from "./account.js";
17
+ export { AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT, AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX, AUTOMATION_LOG_MAX_ENTRIES, AUTOMATION_LOG_MAX_MESSAGE_LENGTH, AUTOMATION_OBSERVABILITY_MAX_ENCODED_BYTES, AUTOMATION_OBSERVABILITY_MAX_FIELDS, AUTOMATION_TRACE_MAX_NAME_LENGTH, AUTOMATION_TRACE_MAX_SPANS, DEFAULT_GATEWAY_MODEL_ID, automationInvocationInputSchema, automationInvocationOutputSchema, automationInvocationScheduleSchema, generationInputSchema, generationResultSchema, hashSignalCoordinatorConfiguration, runtimeContract, } from "./runtime.js";
16
18
  export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
17
19
  export { activeSubscriptionOutputSchema, createdInvitationOutputSchema, organizationDetailsOutputSchema, organizationInvitationOutputSchema, organizationMemberOutputSchema, organizationProjectOutputSchema, organizationRoleSchema, organizationSummaryOutputSchema, publicOrganizationOutputSchema, } from "./org.js";
18
20
  export { projectOutputSchema } from "./project.js";
19
- export { reasonableNameSchema } from "./schemas.js";
21
+ export { cursorPageInfoSchema, cursorPageOutputSchema, cursorPaginationInputSchema, reasonableNameSchema, } from "./schemas.js";
20
22
  export { userOutputSchema } from "./auth.js";
21
23
  export { managementPermissionStatement, managementRolePermissions, organizationApiKeyPermissions, } from "./permissions.js";
22
24
  /** Procedures exposed by the public Node client and OpenAPI document. */
23
25
  export const publicContract = {
26
+ account: accountContract,
27
+ automation: {
28
+ get: automationContract.get,
29
+ list: automationContract.list,
30
+ update: automationContract.update,
31
+ },
24
32
  apiKey: apiKeyContract,
33
+ authorization: {
34
+ get: authorizationContract.get,
35
+ proceed: authorizationContract.proceed,
36
+ },
37
+ deployment: {
38
+ cancel: deploymentContract.cancel,
39
+ get: deploymentContract.get,
40
+ list: deploymentContract.list,
41
+ redeploy: deploymentContract.redeploy,
42
+ },
43
+ executionData: executionDataContract,
25
44
  org: {
26
45
  create: orgContract.create,
27
46
  delete: orgContract.delete,
@@ -46,12 +65,14 @@ export const publicContract = {
46
65
  /** Procedures used by first-party control-plane clients. */
47
66
  export const firstPartyContract = {
48
67
  ...publicContract,
49
- account: accountContract,
50
- automation: automationContract,
68
+ automation: {
69
+ ...publicContract.automation,
70
+ getExecution: automationContract.getExecution,
71
+ listExecutions: automationContract.listExecutions,
72
+ },
51
73
  authorization: {
74
+ ...publicContract.authorization,
52
75
  beginConnection: authorizationContract.beginConnection,
53
- get: authorizationContract.get,
54
- proceed: authorizationContract.proceed,
55
76
  selectAccount: authorizationContract.selectAccount,
56
77
  submitCredentials: authorizationContract.submitCredentials,
57
78
  },
package/dist/org.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
2
  export declare const organizationRoleSchema: z.ZodEnum<{
3
3
  member: "member";
4
4
  admin: "admin";
@@ -282,45 +282,53 @@ export declare const orgContract: {
282
282
  leave: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
283
283
  organizationId: z.ZodString;
284
284
  }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
285
- list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodDefault<z.ZodObject<{
285
+ list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodPrefault<z.ZodObject<{
286
+ cursor: z.ZodOptional<z.ZodString>;
287
+ limit: z.ZodDefault<z.ZodNumber>;
286
288
  query: z.ZodOptional<z.ZodString>;
287
- }, z.core.$strip>>, z.ZodArray<z.ZodObject<{
288
- id: z.ZodString;
289
- name: z.ZodString;
290
- logo: z.ZodNullable<z.ZodString>;
291
- metadata: z.ZodNullable<z.ZodString>;
292
- createdAt: z.ZodDate;
293
- role: z.ZodEnum<{
294
- member: "member";
295
- admin: "admin";
296
- owner: "owner";
297
- }>;
298
- memberCount: z.ZodNumber;
299
- pendingInvitationCount: z.ZodNumber;
300
- projectCount: z.ZodNumber;
301
- activeSubscription: z.ZodNullable<z.ZodObject<{
289
+ }, z.core.$strip>>, z.ZodObject<{
290
+ items: z.ZodArray<z.ZodObject<{
302
291
  id: z.ZodString;
303
- plan: z.ZodString;
304
- status: z.ZodString;
305
- periodEnd: z.ZodNullable<z.ZodDate>;
306
- cancelAtPeriodEnd: z.ZodBoolean;
292
+ name: z.ZodString;
293
+ logo: z.ZodNullable<z.ZodString>;
294
+ metadata: z.ZodNullable<z.ZodString>;
295
+ createdAt: z.ZodDate;
296
+ role: z.ZodEnum<{
297
+ member: "member";
298
+ admin: "admin";
299
+ owner: "owner";
300
+ }>;
301
+ memberCount: z.ZodNumber;
302
+ pendingInvitationCount: z.ZodNumber;
303
+ projectCount: z.ZodNumber;
304
+ activeSubscription: z.ZodNullable<z.ZodObject<{
305
+ id: z.ZodString;
306
+ plan: z.ZodString;
307
+ status: z.ZodString;
308
+ periodEnd: z.ZodNullable<z.ZodDate>;
309
+ cancelAtPeriodEnd: z.ZodBoolean;
310
+ }, z.core.$strip>>;
311
+ plan: z.ZodEnum<{
312
+ free: "free";
313
+ pro: "pro";
314
+ enterprise: "enterprise";
315
+ }>;
316
+ limits: z.ZodObject<{
317
+ aiSpendUsd: z.ZodNumber;
318
+ emailRecipients: z.ZodNumber;
319
+ projects: z.ZodNumber;
320
+ seats: z.ZodNumber;
321
+ }, z.core.$strip>;
322
+ usage: z.ZodObject<{
323
+ aiSpendUsd: z.ZodNumber;
324
+ emailRecipients: z.ZodNumber;
325
+ }, z.core.$strip>;
307
326
  }, z.core.$strip>>;
308
- plan: z.ZodEnum<{
309
- free: "free";
310
- pro: "pro";
311
- enterprise: "enterprise";
312
- }>;
313
- limits: z.ZodObject<{
314
- aiSpendUsd: z.ZodNumber;
315
- emailRecipients: z.ZodNumber;
316
- projects: z.ZodNumber;
317
- seats: z.ZodNumber;
327
+ pageInfo: z.ZodObject<{
328
+ hasMore: z.ZodBoolean;
329
+ nextCursor: z.ZodNullable<z.ZodString>;
318
330
  }, z.core.$strip>;
319
- usage: z.ZodObject<{
320
- aiSpendUsd: z.ZodNumber;
321
- emailRecipients: z.ZodNumber;
322
- }, z.core.$strip>;
323
- }, z.core.$strip>>, Record<never, never>, Record<never, never>>;
331
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
324
332
  remove: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
325
333
  organizationId: z.ZodString;
326
334
  memberIdOrEmail: z.ZodString;
package/dist/org.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { oc } from "@orpc/contract";
2
- import { z } from "zod";
3
- import { reasonableNameSchema } from "./schemas.js";
2
+ import * as z from "zod";
3
+ import { cursorPageOutputSchema, cursorPaginationInputSchema, reasonableNameSchema, } from "./schemas.js";
4
4
  export const organizationRoleSchema = z.enum(["member", "admin", "owner"]);
5
5
  export const publicOrganizationOutputSchema = z.object({
6
6
  id: z.string(),
@@ -162,12 +162,12 @@ export const orgContract = {
162
162
  description: "Lists organizations the authenticated user belongs to, optionally filtered by name or ID.",
163
163
  tags: ["Organizations"],
164
164
  })
165
- .input(z
166
- .object({
165
+ .input(cursorPaginationInputSchema
166
+ .extend({
167
167
  query: z.string().min(1).optional(),
168
168
  })
169
- .default({}))
170
- .output(organizationSummaryOutputSchema.array()),
169
+ .prefault({}))
170
+ .output(cursorPageOutputSchema(organizationSummaryOutputSchema)),
171
171
  remove: oc
172
172
  .route({
173
173
  method: "DELETE",
package/dist/project.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
2
  export declare const projectOutputSchema: z.ZodObject<{
3
3
  activeDeploymentId: z.ZodNullable<z.ZodString>;
4
4
  id: z.ZodString;
@@ -42,26 +42,34 @@ export declare const projectContract: {
42
42
  }, z.core.$strip>>;
43
43
  txid: z.ZodNumber;
44
44
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
45
- list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodOptional<z.ZodObject<{
45
+ list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodPrefault<z.ZodObject<{
46
+ cursor: z.ZodOptional<z.ZodString>;
47
+ limit: z.ZodDefault<z.ZodNumber>;
46
48
  organizationId: z.ZodOptional<z.ZodString>;
47
49
  query: z.ZodOptional<z.ZodString>;
48
- }, z.core.$strip>>, z.ZodArray<z.ZodObject<{
49
- activeDeploymentId: z.ZodNullable<z.ZodString>;
50
- id: z.ZodString;
51
- name: z.ZodString;
52
- organizationId: z.ZodString;
53
- createdAt: z.ZodDate;
54
- createdBy: z.ZodNullable<z.ZodString>;
55
- org: z.ZodObject<{
50
+ }, z.core.$strip>>, z.ZodObject<{
51
+ items: z.ZodArray<z.ZodObject<{
52
+ activeDeploymentId: z.ZodNullable<z.ZodString>;
56
53
  id: z.ZodString;
57
54
  name: z.ZodString;
58
- }, z.core.$strip>;
59
- activeAutomations: z.ZodArray<z.ZodObject<{
60
- description: z.ZodString;
61
- id: z.ZodString;
62
- identityKey: z.ZodString;
55
+ organizationId: z.ZodString;
56
+ createdAt: z.ZodDate;
57
+ createdBy: z.ZodNullable<z.ZodString>;
58
+ org: z.ZodObject<{
59
+ id: z.ZodString;
60
+ name: z.ZodString;
61
+ }, z.core.$strip>;
62
+ activeAutomations: z.ZodArray<z.ZodObject<{
63
+ description: z.ZodString;
64
+ id: z.ZodString;
65
+ identityKey: z.ZodString;
66
+ }, z.core.$strip>>;
63
67
  }, z.core.$strip>>;
64
- }, z.core.$strip>>, Record<never, never>, Record<never, never>>;
68
+ pageInfo: z.ZodObject<{
69
+ hasMore: z.ZodBoolean;
70
+ nextCursor: z.ZodNullable<z.ZodString>;
71
+ }, z.core.$strip>;
72
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
65
73
  get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
66
74
  projectId: z.ZodString;
67
75
  }, z.core.$strip>, z.ZodObject<{
package/dist/project.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { oc } from "@orpc/contract";
2
- import { z } from "zod";
3
- import { reasonableNameSchema } from "./schemas.js";
2
+ import * as z from "zod";
3
+ import { cursorPageOutputSchema, cursorPaginationInputSchema, reasonableNameSchema, } from "./schemas.js";
4
4
  const TRANSACTION_OUTPUT_SCHEMA = z.object({
5
5
  txid: z.number().int().nonnegative(),
6
6
  });
@@ -53,13 +53,13 @@ export const projectContract = {
53
53
  description: "Lists projects visible to the authenticated user, optionally filtered by organization or query.",
54
54
  tags: ["Projects"],
55
55
  })
56
- .input(z
57
- .object({
56
+ .input(cursorPaginationInputSchema
57
+ .extend({
58
58
  organizationId: z.string().optional(),
59
59
  query: z.string().min(1).optional(),
60
60
  })
61
- .optional())
62
- .output(projectOutputSchema.array()),
61
+ .prefault({}))
62
+ .output(cursorPageOutputSchema(projectOutputSchema)),
63
63
  get: oc
64
64
  .route({
65
65
  method: "GET",
package/dist/runtime.d.ts CHANGED
@@ -1,9 +1,16 @@
1
1
  import type { GatewayModelId } from "@ai-sdk/gateway";
2
- import { z } from "zod";
2
+ import * as z from "zod";
3
+ export type { GatewayModelId } from "@ai-sdk/gateway";
3
4
  /** Default model used by the platform Vercel AI Gateway account. */
4
5
  export declare const DEFAULT_GATEWAY_MODEL_ID = "openai/gpt-4.1-nano";
5
6
  export declare const AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT = "default";
6
7
  export declare const AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX = "__$";
8
+ export declare const AUTOMATION_LOG_MAX_ENTRIES = 1000;
9
+ export declare const AUTOMATION_TRACE_MAX_SPANS = 250;
10
+ export declare const AUTOMATION_OBSERVABILITY_MAX_FIELDS = 64;
11
+ export declare const AUTOMATION_OBSERVABILITY_MAX_ENCODED_BYTES: number;
12
+ export declare const AUTOMATION_LOG_MAX_MESSAGE_LENGTH = 16384;
13
+ export declare const AUTOMATION_TRACE_MAX_NAME_LENGTH = 256;
7
14
  /** Immediate or mutually exclusive absolute/relative invocation timing. */
8
15
  export declare const automationInvocationScheduleSchema: z.ZodUnion<readonly [z.ZodObject<{
9
16
  runAt: z.ZodUnion<readonly [z.ZodDate, z.ZodString, z.ZodNumber]>;
@@ -490,6 +497,15 @@ export declare const runtimeContract: {
490
497
  output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
491
498
  status: z.ZodLiteral<"succeeded">;
492
499
  }, z.core.$strip>]>, z.ZodVoid, Record<never, never>, Record<never, never>>;
500
+ completeTraceSpan: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodIntersection<z.ZodObject<{
501
+ completedAt: z.ZodDate;
502
+ spanIndex: z.ZodNumber;
503
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
504
+ status: z.ZodLiteral<"succeeded">;
505
+ }, z.core.$strip>, z.ZodObject<{
506
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
507
+ status: z.ZodLiteral<"failed">;
508
+ }, z.core.$strip>]>>, z.ZodVoid, Record<never, never>, Record<never, never>>;
493
509
  generate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodUnion<readonly [z.ZodObject<{
494
510
  frequencyPenalty: z.ZodOptional<z.ZodNumber>;
495
511
  instructions: z.ZodOptional<z.ZodString>;
@@ -974,7 +990,7 @@ export declare const runtimeContract: {
974
990
  binding: z.ZodString;
975
991
  serviceId: z.ZodString;
976
992
  }, z.core.$strict>, z.ZodObject<{
977
- connectionId: z.ZodString;
993
+ connectionMethodId: z.ZodString;
978
994
  secret: z.ZodRecord<z.ZodString, z.ZodUnknown>;
979
995
  serviceId: z.ZodString;
980
996
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -985,6 +1001,26 @@ export declare const runtimeContract: {
985
1001
  }, z.core.$strip>;
986
1002
  outputIndex: z.ZodNumber;
987
1003
  }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
1004
+ sendLog: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1005
+ fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>>;
1006
+ level: z.ZodEnum<{
1007
+ error: "error";
1008
+ debug: "debug";
1009
+ info: "info";
1010
+ warn: "warn";
1011
+ }>;
1012
+ logIndex: z.ZodNumber;
1013
+ message: z.ZodString;
1014
+ spanIndex: z.ZodOptional<z.ZodNumber>;
1015
+ timestamp: z.ZodDate;
1016
+ }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
1017
+ startTraceSpan: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1018
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>>;
1019
+ name: z.ZodString;
1020
+ parentSpanIndex: z.ZodOptional<z.ZodNumber>;
1021
+ spanIndex: z.ZodNumber;
1022
+ startedAt: z.ZodDate;
1023
+ }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
988
1024
  sendEmail: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodIntersection<z.ZodObject<{
989
1025
  replyTo: z.ZodOptional<z.ZodEmail>;
990
1026
  subject: z.ZodString;
@@ -1005,4 +1041,3 @@ export declare const runtimeContract: {
1005
1041
  id: z.ZodNullable<z.ZodString>;
1006
1042
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1007
1043
  };
1008
- export {};
package/dist/runtime.js CHANGED
@@ -1,12 +1,18 @@
1
1
  import { encodableSchema } from "@automate.ax/codec";
2
2
  import { oc } from "@orpc/contract";
3
3
  import stableStringify from "fast-json-stable-stringify";
4
- import { z } from "zod";
4
+ import * as z from "zod";
5
5
  import { automationErrorSchema } from "./errors.js";
6
6
  /** Default model used by the platform Vercel AI Gateway account. */
7
7
  export const DEFAULT_GATEWAY_MODEL_ID = "openai/gpt-4.1-nano";
8
8
  export const AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT = "default";
9
9
  export const AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX = "__$";
10
+ export const AUTOMATION_LOG_MAX_ENTRIES = 1_000;
11
+ export const AUTOMATION_TRACE_MAX_SPANS = 250;
12
+ export const AUTOMATION_OBSERVABILITY_MAX_FIELDS = 64;
13
+ export const AUTOMATION_OBSERVABILITY_MAX_ENCODED_BYTES = 64 * 1_024;
14
+ export const AUTOMATION_LOG_MAX_MESSAGE_LENGTH = 16_384;
15
+ export const AUTOMATION_TRACE_MAX_NAME_LENGTH = 256;
10
16
  const OUTCOME_SEQUENCE_SCHEMA = z.number().int().positive();
11
17
  const HOOK_SCOPE_PATH_SCHEMA = z
12
18
  .number()
@@ -14,6 +20,19 @@ const HOOK_SCOPE_PATH_SCHEMA = z
14
20
  .nonnegative()
15
21
  .array()
16
22
  .default([]);
23
+ const OBSERVABILITY_FIELDS_SCHEMA = z
24
+ .record(z.string().min(1).max(128), encodableSchema)
25
+ .refine((fields) => Object.keys(fields).length <= AUTOMATION_OBSERVABILITY_MAX_FIELDS, `Observability fields may contain at most ${AUTOMATION_OBSERVABILITY_MAX_FIELDS} entries.`);
26
+ const LOG_INDEX_SCHEMA = z
27
+ .number()
28
+ .int()
29
+ .min(0)
30
+ .max(AUTOMATION_LOG_MAX_ENTRIES - 1);
31
+ const TRACE_SPAN_INDEX_SCHEMA = z
32
+ .number()
33
+ .int()
34
+ .min(0)
35
+ .max(AUTOMATION_TRACE_MAX_SPANS - 1);
17
36
  const AUTOMATION_INVOCATION_RUN_AT_SCHEMA = z.union([
18
37
  z.date(),
19
38
  z.string().min(1),
@@ -592,6 +611,20 @@ export const runtimeContract = {
592
611
  }),
593
612
  ]))
594
613
  .output(z.void()),
614
+ completeTraceSpan: oc
615
+ .input(z
616
+ .object({
617
+ completedAt: z.date(),
618
+ spanIndex: TRACE_SPAN_INDEX_SCHEMA,
619
+ })
620
+ .and(z.union([
621
+ z.object({ status: z.literal("succeeded") }),
622
+ z.object({
623
+ failure: automationErrorSchema,
624
+ status: z.literal("failed"),
625
+ }),
626
+ ])))
627
+ .output(z.void()),
595
628
  generate: oc
596
629
  .input(RUNTIME_GENERATION_INPUT_SCHEMA)
597
630
  .output(generationResultSchema),
@@ -615,7 +648,7 @@ export const runtimeContract = {
615
648
  serviceId: z.string().min(1),
616
649
  }))
617
650
  .output(z.object({
618
- connectionId: z.string().min(1),
651
+ connectionMethodId: z.string().min(1),
619
652
  secret: z.record(z.string(), z.unknown()),
620
653
  serviceId: z.string(),
621
654
  })),
@@ -628,6 +661,25 @@ export const runtimeContract = {
628
661
  outputIndex: z.number().int().nonnegative(),
629
662
  }))
630
663
  .output(z.void()),
664
+ sendLog: oc
665
+ .input(z.object({
666
+ fields: OBSERVABILITY_FIELDS_SCHEMA.optional(),
667
+ level: z.enum(["debug", "info", "warn", "error"]),
668
+ logIndex: LOG_INDEX_SCHEMA,
669
+ message: z.string().min(1).max(AUTOMATION_LOG_MAX_MESSAGE_LENGTH),
670
+ spanIndex: TRACE_SPAN_INDEX_SCHEMA.optional(),
671
+ timestamp: z.date(),
672
+ }))
673
+ .output(z.void()),
674
+ startTraceSpan: oc
675
+ .input(z.object({
676
+ attributes: OBSERVABILITY_FIELDS_SCHEMA.optional(),
677
+ name: z.string().min(1).max(AUTOMATION_TRACE_MAX_NAME_LENGTH),
678
+ parentSpanIndex: TRACE_SPAN_INDEX_SCHEMA.optional(),
679
+ spanIndex: TRACE_SPAN_INDEX_SCHEMA,
680
+ startedAt: z.date(),
681
+ }))
682
+ .output(z.void()),
631
683
  sendEmail: oc
632
684
  .input(z
633
685
  .object({
package/dist/schemas.d.ts CHANGED
@@ -1,2 +1,22 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
+ export declare const cursorPaginationInputSchema: z.ZodObject<{
3
+ cursor: z.ZodOptional<z.ZodString>;
4
+ limit: z.ZodDefault<z.ZodNumber>;
5
+ }, z.core.$strip>;
6
+ export declare const cursorPageInfoSchema: z.ZodObject<{
7
+ hasMore: z.ZodBoolean;
8
+ nextCursor: z.ZodNullable<z.ZodString>;
9
+ }, z.core.$strip>;
10
+ /**
11
+ * Builds the common cursor-paginated collection response.
12
+ *
13
+ * @param itemSchema - Schema for one collection item.
14
+ */
15
+ export declare function cursorPageOutputSchema<T extends z.ZodType>(itemSchema: T): z.ZodObject<{
16
+ items: z.ZodArray<T>;
17
+ pageInfo: z.ZodObject<{
18
+ hasMore: z.ZodBoolean;
19
+ nextCursor: z.ZodNullable<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ }, z.core.$strip>;
2
22
  export declare const reasonableNameSchema: z.ZodString;
package/dist/schemas.js CHANGED
@@ -1,2 +1,21 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
+ export const cursorPaginationInputSchema = z.object({
3
+ cursor: z.string().min(1).optional(),
4
+ limit: z.number().int().min(1).max(100).default(50),
5
+ });
6
+ export const cursorPageInfoSchema = z.object({
7
+ hasMore: z.boolean(),
8
+ nextCursor: z.string().nullable(),
9
+ });
10
+ /**
11
+ * Builds the common cursor-paginated collection response.
12
+ *
13
+ * @param itemSchema - Schema for one collection item.
14
+ */
15
+ export function cursorPageOutputSchema(itemSchema) {
16
+ return z.object({
17
+ items: itemSchema.array(),
18
+ pageInfo: cursorPageInfoSchema,
19
+ });
20
+ }
2
21
  export const reasonableNameSchema = z.string().min(1).max(255).trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.75.0",
3
+ "version": "0.77.0",
4
4
  "description": "Public oRPC contract for the Automate.ax API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -19,7 +19,9 @@
19
19
  "zshy": {
20
20
  "exports": {
21
21
  ".": "./src/index.ts",
22
- "./permissions": "./src/permissions.ts"
22
+ "./errors": "./src/errors.ts",
23
+ "./permissions": "./src/permissions.ts",
24
+ "./runtime": "./src/runtime.ts"
23
25
  },
24
26
  "cjs": false,
25
27
  "conditions": {
@@ -28,7 +30,7 @@
28
30
  },
29
31
  "dependencies": {
30
32
  "@ai-sdk/gateway": "^4.0.46",
31
- "@automate.ax/codec": "0.75.0",
33
+ "@automate.ax/codec": "0.77.0",
32
34
  "@orpc/contract": "1.15.0",
33
35
  "fast-json-stable-stringify": "^2.1.0",
34
36
  "zod": "^4.3.6"
@@ -38,7 +40,6 @@
38
40
  "@types/bun": "latest",
39
41
  "@typescript/native": "npm:typescript@^7.0.2",
40
42
  "@zachsents/oxlint-config": "^0.4.1",
41
- "concurrently": "^10.0.4",
42
43
  "eslint": "^9.39.5",
43
44
  "oxlint": "^1.76.0",
44
45
  "oxlint-tsgolint": "^7.0.2001",
@@ -46,8 +47,8 @@
46
47
  },
47
48
  "scripts": {
48
49
  "typecheck": "tsc --noEmit",
49
- "lint": "concurrently --success all --kill-others-on-fail \"oxlint --type-aware\" \"bun --bun eslint .\"",
50
- "lint:fix": "concurrently --success all --kill-others-on-fail \"oxlint --type-aware --fix --fix-suggestions\" \"bun --bun eslint . --fix\"",
50
+ "lint": "oxlint --type-aware --threads=2 && bun --bun eslint . --cache --cache-strategy content",
51
+ "lint:fix": "oxlint --type-aware --threads=2 --fix --fix-suggestions && bun --bun eslint . --fix --cache --cache-strategy content",
51
52
  "check": "bun run typecheck && bun run lint",
52
53
  "build": "zshy",
53
54
  "prepublishOnly": "bun run check && bun run build"
@@ -70,10 +71,20 @@
70
71
  "types": "./dist/index.d.ts",
71
72
  "default": "./dist/index.js"
72
73
  },
74
+ "./errors": {
75
+ "bun": "./src/errors.ts",
76
+ "types": "./dist/errors.d.ts",
77
+ "default": "./dist/errors.js"
78
+ },
73
79
  "./permissions": {
74
80
  "bun": "./src/permissions.ts",
75
81
  "types": "./dist/permissions.d.ts",
76
82
  "default": "./dist/permissions.js"
83
+ },
84
+ "./runtime": {
85
+ "bun": "./src/runtime.ts",
86
+ "types": "./dist/runtime.d.ts",
87
+ "default": "./dist/runtime.js"
77
88
  }
78
89
  }
79
90
  }