@automate.ax/api-contract 0.26.1 → 0.28.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.
@@ -11,8 +11,13 @@ export declare const deploymentTriggerInfoSchema: z.ZodObject<{
11
11
  }, z.core.$strip>;
12
12
  export type DeploymentTriggerInfo = z.infer<typeof deploymentTriggerInfoSchema>;
13
13
  export declare const deploymentContract: {
14
+ cancel: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
15
+ deploymentId: z.ZodString;
16
+ projectId: z.ZodString;
17
+ }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
14
18
  create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
15
19
  artifact: z.ZodCustom<Blob, Blob>;
20
+ cancelExisting: z.ZodDefault<z.ZodBoolean>;
16
21
  manifest: z.ZodArray<z.ZodObject<{
17
22
  identityKey: z.ZodString;
18
23
  }, z.core.$strip>>;
@@ -24,7 +29,24 @@ export declare const deploymentContract: {
24
29
  rebindAccounts: z.ZodDefault<z.ZodBoolean>;
25
30
  }, z.core.$strip>, z.ZodObject<{
26
31
  id: z.ZodString;
27
- }, z.core.$strip>, Record<never, never>, Record<never, never>>;
32
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
33
+ DEPLOYMENT_IN_PROGRESS: {
34
+ readonly data: z.ZodObject<{
35
+ deploymentId: z.ZodString;
36
+ status: z.ZodEnum<{
37
+ succeeded: "succeeded";
38
+ failed: "failed";
39
+ planning: "planning";
40
+ awaiting_authorization: "awaiting_authorization";
41
+ configuring: "configuring";
42
+ publishing: "publishing";
43
+ cancelled: "cancelled";
44
+ }>;
45
+ }, z.core.$strip>;
46
+ readonly message: "A deployment is already in progress.";
47
+ readonly status: 409;
48
+ };
49
+ }>, Record<never, never>>;
28
50
  get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
29
51
  deploymentId: z.ZodString;
30
52
  projectId: z.ZodString;
@@ -59,6 +81,7 @@ export declare const deploymentContract: {
59
81
  awaiting_authorization: "awaiting_authorization";
60
82
  configuring: "configuring";
61
83
  publishing: "publishing";
84
+ cancelled: "cancelled";
62
85
  }>;
63
86
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
64
87
  };
@@ -12,10 +12,35 @@ export const deploymentTriggerInfoSchema = z.object({
12
12
  name: z.string(),
13
13
  type: z.string(),
14
14
  });
15
+ const DEPLOYMENT_STATUS_SCHEMA = z.enum([
16
+ "planning",
17
+ "awaiting_authorization",
18
+ "configuring",
19
+ "publishing",
20
+ "succeeded",
21
+ "failed",
22
+ "cancelled",
23
+ ]);
24
+ const DEPLOYMENT_IN_PROGRESS_ERROR = {
25
+ data: z.object({
26
+ deploymentId: z.string(),
27
+ status: DEPLOYMENT_STATUS_SCHEMA,
28
+ }),
29
+ message: "A deployment is already in progress.",
30
+ status: 409,
31
+ };
15
32
  export const deploymentContract = {
33
+ cancel: oc
34
+ .input(z.object({
35
+ deploymentId: z.string(),
36
+ projectId: z.string(),
37
+ }))
38
+ .output(z.void()),
16
39
  create: oc
40
+ .errors({ DEPLOYMENT_IN_PROGRESS: DEPLOYMENT_IN_PROGRESS_ERROR })
17
41
  .input(z.object({
18
42
  artifact: z.instanceof(Blob),
43
+ cancelExisting: z.boolean().default(false),
19
44
  manifest: z
20
45
  .object({
21
46
  identityKey: z.string().min(1),
@@ -65,13 +90,6 @@ export const deploymentContract = {
65
90
  id: z.string(),
66
91
  name: z.string(),
67
92
  }),
68
- status: z.enum([
69
- "planning",
70
- "awaiting_authorization",
71
- "configuring",
72
- "publishing",
73
- "succeeded",
74
- "failed",
75
- ]),
93
+ status: DEPLOYMENT_STATUS_SCHEMA,
76
94
  })),
77
95
  };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { AUTOMATION_SDK_VERSION, deploymentTriggerInfoSchema, type DeploymentTriggerInfo, } from "./deployment.js";
2
2
  export { integrationAccountOutputSchema } from "./account.js";
3
- export { runtimeContract } from "./runtime.js";
3
+ export { generationInputSchema, generationResultSchema, runtimeContract, type GenerationInput, type GenerationResult, type RuntimeGenerationInput, } from "./runtime.js";
4
4
  export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
5
5
  export { integrationConnectionManifestSchema, integrationServiceManifestSchema, type IntegrationConnectionManifest, type IntegrationServiceManifest, } from "./authorization.js";
6
6
  export { activeSubscriptionOutputSchema, createdInvitationOutputSchema, organizationDetailsOutputSchema, organizationInvitationOutputSchema, organizationMemberOutputSchema, organizationProjectOutputSchema, organizationRoleSchema, organizationSummaryOutputSchema, publicOrganizationOutputSchema, } from "./org.js";
@@ -469,8 +469,13 @@ export declare const firstPartyContract: {
469
469
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
470
470
  };
471
471
  deployment: {
472
+ cancel: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
473
+ deploymentId: import("zod").ZodString;
474
+ projectId: import("zod").ZodString;
475
+ }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
472
476
  create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
473
477
  artifact: import("zod").ZodCustom<Blob, Blob>;
478
+ cancelExisting: import("zod").ZodDefault<import("zod").ZodBoolean>;
474
479
  manifest: import("zod").ZodArray<import("zod").ZodObject<{
475
480
  identityKey: import("zod").ZodString;
476
481
  }, import("zod/v4/core").$strip>>;
@@ -482,7 +487,24 @@ export declare const firstPartyContract: {
482
487
  rebindAccounts: import("zod").ZodDefault<import("zod").ZodBoolean>;
483
488
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
484
489
  id: import("zod").ZodString;
485
- }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
490
+ }, import("zod/v4/core").$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
491
+ DEPLOYMENT_IN_PROGRESS: {
492
+ readonly data: import("zod").ZodObject<{
493
+ deploymentId: import("zod").ZodString;
494
+ status: import("zod").ZodEnum<{
495
+ succeeded: "succeeded";
496
+ failed: "failed";
497
+ planning: "planning";
498
+ awaiting_authorization: "awaiting_authorization";
499
+ configuring: "configuring";
500
+ publishing: "publishing";
501
+ cancelled: "cancelled";
502
+ }>;
503
+ }, import("zod/v4/core").$strip>;
504
+ readonly message: "A deployment is already in progress.";
505
+ readonly status: 409;
506
+ };
507
+ }>, Record<never, never>>;
486
508
  get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
487
509
  deploymentId: import("zod").ZodString;
488
510
  projectId: import("zod").ZodString;
@@ -517,6 +539,7 @@ export declare const firstPartyContract: {
517
539
  awaiting_authorization: "awaiting_authorization";
518
540
  configuring: "configuring";
519
541
  publishing: "publishing";
542
+ cancelled: "cancelled";
520
543
  }>;
521
544
  }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
522
545
  };
@@ -1008,6 +1031,108 @@ export declare const contract: {
1008
1031
  output: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1009
1032
  status: import("zod").ZodLiteral<"succeeded">;
1010
1033
  }, import("zod/v4/core").$strip>], "status">, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
1034
+ generate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
1035
+ frequencyPenalty: import("zod").ZodOptional<import("zod").ZodNumber>;
1036
+ instructions: import("zod").ZodOptional<import("zod").ZodString>;
1037
+ maxOutputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1038
+ maxRetries: import("zod").ZodOptional<import("zod").ZodNumber>;
1039
+ model: import("zod").ZodString;
1040
+ presencePenalty: import("zod").ZodOptional<import("zod").ZodNumber>;
1041
+ providerOptions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodJSONSchema>>>;
1042
+ seed: import("zod").ZodOptional<import("zod").ZodNumber>;
1043
+ stopSequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1044
+ system: import("zod").ZodOptional<import("zod").ZodString>;
1045
+ temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
1046
+ timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
1047
+ topK: import("zod").ZodOptional<import("zod").ZodNumber>;
1048
+ topP: import("zod").ZodOptional<import("zod").ZodNumber>;
1049
+ messages: import("zod").ZodOptional<import("zod").ZodNever>;
1050
+ prompt: import("zod").ZodString;
1051
+ output: import("zod").ZodOptional<import("zod").ZodObject<{
1052
+ description: import("zod").ZodOptional<import("zod").ZodString>;
1053
+ name: import("zod").ZodOptional<import("zod").ZodString>;
1054
+ schema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodJSONSchema>;
1055
+ }, import("zod/v4/core").$strip>>;
1056
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1057
+ frequencyPenalty: import("zod").ZodOptional<import("zod").ZodNumber>;
1058
+ instructions: import("zod").ZodOptional<import("zod").ZodString>;
1059
+ maxOutputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1060
+ maxRetries: import("zod").ZodOptional<import("zod").ZodNumber>;
1061
+ model: import("zod").ZodString;
1062
+ presencePenalty: import("zod").ZodOptional<import("zod").ZodNumber>;
1063
+ providerOptions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodJSONSchema>>>;
1064
+ seed: import("zod").ZodOptional<import("zod").ZodNumber>;
1065
+ stopSequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
1066
+ system: import("zod").ZodOptional<import("zod").ZodString>;
1067
+ temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
1068
+ timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
1069
+ topK: import("zod").ZodOptional<import("zod").ZodNumber>;
1070
+ topP: import("zod").ZodOptional<import("zod").ZodNumber>;
1071
+ messages: import("zod").ZodArray<import("zod").ZodObject<{
1072
+ content: import("zod").ZodString;
1073
+ role: import("zod").ZodEnum<{
1074
+ assistant: "assistant";
1075
+ user: "user";
1076
+ }>;
1077
+ }, import("zod/v4/core").$strip>>;
1078
+ prompt: import("zod").ZodOptional<import("zod").ZodNever>;
1079
+ output: import("zod").ZodOptional<import("zod").ZodObject<{
1080
+ description: import("zod").ZodOptional<import("zod").ZodString>;
1081
+ name: import("zod").ZodOptional<import("zod").ZodString>;
1082
+ schema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodJSONSchema>;
1083
+ }, import("zod/v4/core").$strip>>;
1084
+ }, import("zod/v4/core").$strip>]>, import("zod").ZodObject<{
1085
+ finishReason: import("zod").ZodEnum<{
1086
+ error: "error";
1087
+ length: "length";
1088
+ other: "other";
1089
+ stop: "stop";
1090
+ "content-filter": "content-filter";
1091
+ "tool-calls": "tool-calls";
1092
+ }>;
1093
+ output: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1094
+ providerMetadata: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1095
+ rawFinishReason: import("zod").ZodOptional<import("zod").ZodString>;
1096
+ reasoningText: import("zod").ZodOptional<import("zod").ZodString>;
1097
+ response: import("zod").ZodObject<{
1098
+ headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
1099
+ id: import("zod").ZodString;
1100
+ modelId: import("zod").ZodString;
1101
+ timestamp: import("zod").ZodISODateTime;
1102
+ }, import("zod/v4/core").$strip>;
1103
+ text: import("zod").ZodString;
1104
+ usage: import("zod").ZodObject<{
1105
+ inputTokenDetails: import("zod").ZodObject<{
1106
+ cacheReadTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1107
+ cacheWriteTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1108
+ noCacheTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1109
+ }, import("zod/v4/core").$strip>;
1110
+ inputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1111
+ outputTokenDetails: import("zod").ZodObject<{
1112
+ reasoningTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1113
+ textTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1114
+ }, import("zod/v4/core").$strip>;
1115
+ outputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1116
+ raw: import("zod").ZodOptional<import("zod").ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1117
+ totalTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
1118
+ }, import("zod/v4/core").$strip>;
1119
+ warnings: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
1120
+ details: import("zod").ZodOptional<import("zod").ZodString>;
1121
+ feature: import("zod").ZodString;
1122
+ type: import("zod").ZodLiteral<"unsupported">;
1123
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1124
+ details: import("zod").ZodOptional<import("zod").ZodString>;
1125
+ feature: import("zod").ZodString;
1126
+ type: import("zod").ZodLiteral<"compatibility">;
1127
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1128
+ message: import("zod").ZodString;
1129
+ setting: import("zod").ZodString;
1130
+ type: import("zod").ZodLiteral<"deprecated">;
1131
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1132
+ message: import("zod").ZodString;
1133
+ type: import("zod").ZodLiteral<"other">;
1134
+ }, import("zod/v4/core").$strip>], "type">>>;
1135
+ }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
1011
1136
  loadInvocation: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodObject<{
1012
1137
  context: import("zod").ZodObject<{
1013
1138
  actionOutputs: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
@@ -1183,8 +1308,13 @@ export declare const contract: {
1183
1308
  }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
1184
1309
  };
1185
1310
  deployment: {
1311
+ cancel: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
1312
+ deploymentId: import("zod").ZodString;
1313
+ projectId: import("zod").ZodString;
1314
+ }, import("zod/v4/core").$strip>, import("zod").ZodVoid, Record<never, never>, Record<never, never>>;
1186
1315
  create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
1187
1316
  artifact: import("zod").ZodCustom<Blob, Blob>;
1317
+ cancelExisting: import("zod").ZodDefault<import("zod").ZodBoolean>;
1188
1318
  manifest: import("zod").ZodArray<import("zod").ZodObject<{
1189
1319
  identityKey: import("zod").ZodString;
1190
1320
  }, import("zod/v4/core").$strip>>;
@@ -1196,7 +1326,24 @@ export declare const contract: {
1196
1326
  rebindAccounts: import("zod").ZodDefault<import("zod").ZodBoolean>;
1197
1327
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1198
1328
  id: import("zod").ZodString;
1199
- }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
1329
+ }, import("zod/v4/core").$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
1330
+ DEPLOYMENT_IN_PROGRESS: {
1331
+ readonly data: import("zod").ZodObject<{
1332
+ deploymentId: import("zod").ZodString;
1333
+ status: import("zod").ZodEnum<{
1334
+ succeeded: "succeeded";
1335
+ failed: "failed";
1336
+ planning: "planning";
1337
+ awaiting_authorization: "awaiting_authorization";
1338
+ configuring: "configuring";
1339
+ publishing: "publishing";
1340
+ cancelled: "cancelled";
1341
+ }>;
1342
+ }, import("zod/v4/core").$strip>;
1343
+ readonly message: "A deployment is already in progress.";
1344
+ readonly status: 409;
1345
+ };
1346
+ }>, Record<never, never>>;
1200
1347
  get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
1201
1348
  deploymentId: import("zod").ZodString;
1202
1349
  projectId: import("zod").ZodString;
@@ -1231,6 +1378,7 @@ export declare const contract: {
1231
1378
  awaiting_authorization: "awaiting_authorization";
1232
1379
  configuring: "configuring";
1233
1380
  publishing: "publishing";
1381
+ cancelled: "cancelled";
1234
1382
  }>;
1235
1383
  }, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
1236
1384
  };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { projectContract } from "./project.js";
9
9
  import { runtimeContract } from "./runtime.js";
10
10
  export { AUTOMATION_SDK_VERSION, deploymentTriggerInfoSchema, } from "./deployment.js";
11
11
  export { integrationAccountOutputSchema } from "./account.js";
12
- export { runtimeContract } from "./runtime.js";
12
+ export { generationInputSchema, generationResultSchema, runtimeContract, } from "./runtime.js";
13
13
  export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
14
14
  export { integrationConnectionManifestSchema, integrationServiceManifestSchema, } from "./authorization.js";
15
15
  export { activeSubscriptionOutputSchema, createdInvitationOutputSchema, organizationDetailsOutputSchema, organizationInvitationOutputSchema, organizationMemberOutputSchema, organizationProjectOutputSchema, organizationRoleSchema, organizationSummaryOutputSchema, publicOrganizationOutputSchema, } from "./org.js";
package/dist/runtime.d.ts CHANGED
@@ -1,4 +1,153 @@
1
1
  import { z } from "zod";
2
+ /** Shared text-generation options accepted by the built-in generate action. */
3
+ export declare const generationInputSchema: z.ZodUnion<readonly [z.ZodObject<{
4
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
5
+ instructions: z.ZodOptional<z.ZodString>;
6
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
7
+ maxRetries: z.ZodOptional<z.ZodNumber>;
8
+ model: z.ZodString;
9
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
10
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
11
+ seed: z.ZodOptional<z.ZodNumber>;
12
+ stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ system: z.ZodOptional<z.ZodString>;
14
+ temperature: z.ZodOptional<z.ZodNumber>;
15
+ timeout: z.ZodOptional<z.ZodNumber>;
16
+ topK: z.ZodOptional<z.ZodNumber>;
17
+ topP: z.ZodOptional<z.ZodNumber>;
18
+ messages: z.ZodOptional<z.ZodNever>;
19
+ prompt: z.ZodString;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
22
+ instructions: z.ZodOptional<z.ZodString>;
23
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
24
+ maxRetries: z.ZodOptional<z.ZodNumber>;
25
+ model: z.ZodString;
26
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
27
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
28
+ seed: z.ZodOptional<z.ZodNumber>;
29
+ stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
30
+ system: z.ZodOptional<z.ZodString>;
31
+ temperature: z.ZodOptional<z.ZodNumber>;
32
+ timeout: z.ZodOptional<z.ZodNumber>;
33
+ topK: z.ZodOptional<z.ZodNumber>;
34
+ topP: z.ZodOptional<z.ZodNumber>;
35
+ messages: z.ZodArray<z.ZodObject<{
36
+ content: z.ZodString;
37
+ role: z.ZodEnum<{
38
+ assistant: "assistant";
39
+ user: "user";
40
+ }>;
41
+ }, z.core.$strip>>;
42
+ prompt: z.ZodOptional<z.ZodNever>;
43
+ }, z.core.$strip>]>;
44
+ /** Serializable subset of the AI SDK text-generation result. */
45
+ export declare const generationResultSchema: z.ZodObject<{
46
+ finishReason: z.ZodEnum<{
47
+ error: "error";
48
+ length: "length";
49
+ other: "other";
50
+ stop: "stop";
51
+ "content-filter": "content-filter";
52
+ "tool-calls": "tool-calls";
53
+ }>;
54
+ output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
55
+ providerMetadata: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
56
+ rawFinishReason: z.ZodOptional<z.ZodString>;
57
+ reasoningText: z.ZodOptional<z.ZodString>;
58
+ response: z.ZodObject<{
59
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
60
+ id: z.ZodString;
61
+ modelId: z.ZodString;
62
+ timestamp: z.ZodISODateTime;
63
+ }, z.core.$strip>;
64
+ text: z.ZodString;
65
+ usage: z.ZodObject<{
66
+ inputTokenDetails: z.ZodObject<{
67
+ cacheReadTokens: z.ZodOptional<z.ZodNumber>;
68
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
69
+ noCacheTokens: z.ZodOptional<z.ZodNumber>;
70
+ }, z.core.$strip>;
71
+ inputTokens: z.ZodOptional<z.ZodNumber>;
72
+ outputTokenDetails: z.ZodObject<{
73
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
74
+ textTokens: z.ZodOptional<z.ZodNumber>;
75
+ }, z.core.$strip>;
76
+ outputTokens: z.ZodOptional<z.ZodNumber>;
77
+ raw: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
78
+ totalTokens: z.ZodOptional<z.ZodNumber>;
79
+ }, z.core.$strip>;
80
+ warnings: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
81
+ details: z.ZodOptional<z.ZodString>;
82
+ feature: z.ZodString;
83
+ type: z.ZodLiteral<"unsupported">;
84
+ }, z.core.$strip>, z.ZodObject<{
85
+ details: z.ZodOptional<z.ZodString>;
86
+ feature: z.ZodString;
87
+ type: z.ZodLiteral<"compatibility">;
88
+ }, z.core.$strip>, z.ZodObject<{
89
+ message: z.ZodString;
90
+ setting: z.ZodString;
91
+ type: z.ZodLiteral<"deprecated">;
92
+ }, z.core.$strip>, z.ZodObject<{
93
+ message: z.ZodString;
94
+ type: z.ZodLiteral<"other">;
95
+ }, z.core.$strip>], "type">>>;
96
+ }, z.core.$strip>;
97
+ export type GenerationInput = z.output<typeof generationInputSchema>;
98
+ export type GenerationResult = z.output<typeof generationResultSchema>;
99
+ declare const RUNTIME_GENERATION_INPUT_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
100
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
101
+ instructions: z.ZodOptional<z.ZodString>;
102
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
103
+ maxRetries: z.ZodOptional<z.ZodNumber>;
104
+ model: z.ZodString;
105
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
106
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
107
+ seed: z.ZodOptional<z.ZodNumber>;
108
+ stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ system: z.ZodOptional<z.ZodString>;
110
+ temperature: z.ZodOptional<z.ZodNumber>;
111
+ timeout: z.ZodOptional<z.ZodNumber>;
112
+ topK: z.ZodOptional<z.ZodNumber>;
113
+ topP: z.ZodOptional<z.ZodNumber>;
114
+ messages: z.ZodOptional<z.ZodNever>;
115
+ prompt: z.ZodString;
116
+ output: z.ZodOptional<z.ZodObject<{
117
+ description: z.ZodOptional<z.ZodString>;
118
+ name: z.ZodOptional<z.ZodString>;
119
+ schema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
120
+ }, z.core.$strip>>;
121
+ }, z.core.$strip>, z.ZodObject<{
122
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
123
+ instructions: z.ZodOptional<z.ZodString>;
124
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
125
+ maxRetries: z.ZodOptional<z.ZodNumber>;
126
+ model: z.ZodString;
127
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
128
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
129
+ seed: z.ZodOptional<z.ZodNumber>;
130
+ stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
+ system: z.ZodOptional<z.ZodString>;
132
+ temperature: z.ZodOptional<z.ZodNumber>;
133
+ timeout: z.ZodOptional<z.ZodNumber>;
134
+ topK: z.ZodOptional<z.ZodNumber>;
135
+ topP: z.ZodOptional<z.ZodNumber>;
136
+ messages: z.ZodArray<z.ZodObject<{
137
+ content: z.ZodString;
138
+ role: z.ZodEnum<{
139
+ assistant: "assistant";
140
+ user: "user";
141
+ }>;
142
+ }, z.core.$strip>>;
143
+ prompt: z.ZodOptional<z.ZodNever>;
144
+ output: z.ZodOptional<z.ZodObject<{
145
+ description: z.ZodOptional<z.ZodString>;
146
+ name: z.ZodOptional<z.ZodString>;
147
+ schema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
148
+ }, z.core.$strip>>;
149
+ }, z.core.$strip>]>;
150
+ export type RuntimeGenerationInput = z.output<typeof RUNTIME_GENERATION_INPUT_SCHEMA>;
2
151
  export declare const runtimeContract: {
3
152
  commit: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4
153
  actionInvocations: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -22,6 +171,108 @@ export declare const runtimeContract: {
22
171
  output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
23
172
  status: z.ZodLiteral<"succeeded">;
24
173
  }, z.core.$strip>], "status">, z.ZodVoid, Record<never, never>, Record<never, never>>;
174
+ generate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodUnion<readonly [z.ZodObject<{
175
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
176
+ instructions: z.ZodOptional<z.ZodString>;
177
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
178
+ maxRetries: z.ZodOptional<z.ZodNumber>;
179
+ model: z.ZodString;
180
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
181
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
182
+ seed: z.ZodOptional<z.ZodNumber>;
183
+ stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
184
+ system: z.ZodOptional<z.ZodString>;
185
+ temperature: z.ZodOptional<z.ZodNumber>;
186
+ timeout: z.ZodOptional<z.ZodNumber>;
187
+ topK: z.ZodOptional<z.ZodNumber>;
188
+ topP: z.ZodOptional<z.ZodNumber>;
189
+ messages: z.ZodOptional<z.ZodNever>;
190
+ prompt: z.ZodString;
191
+ output: z.ZodOptional<z.ZodObject<{
192
+ description: z.ZodOptional<z.ZodString>;
193
+ name: z.ZodOptional<z.ZodString>;
194
+ schema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
195
+ }, z.core.$strip>>;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
198
+ instructions: z.ZodOptional<z.ZodString>;
199
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
200
+ maxRetries: z.ZodOptional<z.ZodNumber>;
201
+ model: z.ZodString;
202
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
203
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
204
+ seed: z.ZodOptional<z.ZodNumber>;
205
+ stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
206
+ system: z.ZodOptional<z.ZodString>;
207
+ temperature: z.ZodOptional<z.ZodNumber>;
208
+ timeout: z.ZodOptional<z.ZodNumber>;
209
+ topK: z.ZodOptional<z.ZodNumber>;
210
+ topP: z.ZodOptional<z.ZodNumber>;
211
+ messages: z.ZodArray<z.ZodObject<{
212
+ content: z.ZodString;
213
+ role: z.ZodEnum<{
214
+ assistant: "assistant";
215
+ user: "user";
216
+ }>;
217
+ }, z.core.$strip>>;
218
+ prompt: z.ZodOptional<z.ZodNever>;
219
+ output: z.ZodOptional<z.ZodObject<{
220
+ description: z.ZodOptional<z.ZodString>;
221
+ name: z.ZodOptional<z.ZodString>;
222
+ schema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
223
+ }, z.core.$strip>>;
224
+ }, z.core.$strip>]>, z.ZodObject<{
225
+ finishReason: z.ZodEnum<{
226
+ error: "error";
227
+ length: "length";
228
+ other: "other";
229
+ stop: "stop";
230
+ "content-filter": "content-filter";
231
+ "tool-calls": "tool-calls";
232
+ }>;
233
+ output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
234
+ providerMetadata: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
235
+ rawFinishReason: z.ZodOptional<z.ZodString>;
236
+ reasoningText: z.ZodOptional<z.ZodString>;
237
+ response: z.ZodObject<{
238
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
239
+ id: z.ZodString;
240
+ modelId: z.ZodString;
241
+ timestamp: z.ZodISODateTime;
242
+ }, z.core.$strip>;
243
+ text: z.ZodString;
244
+ usage: z.ZodObject<{
245
+ inputTokenDetails: z.ZodObject<{
246
+ cacheReadTokens: z.ZodOptional<z.ZodNumber>;
247
+ cacheWriteTokens: z.ZodOptional<z.ZodNumber>;
248
+ noCacheTokens: z.ZodOptional<z.ZodNumber>;
249
+ }, z.core.$strip>;
250
+ inputTokens: z.ZodOptional<z.ZodNumber>;
251
+ outputTokenDetails: z.ZodObject<{
252
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
253
+ textTokens: z.ZodOptional<z.ZodNumber>;
254
+ }, z.core.$strip>;
255
+ outputTokens: z.ZodOptional<z.ZodNumber>;
256
+ raw: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
257
+ totalTokens: z.ZodOptional<z.ZodNumber>;
258
+ }, z.core.$strip>;
259
+ warnings: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
260
+ details: z.ZodOptional<z.ZodString>;
261
+ feature: z.ZodString;
262
+ type: z.ZodLiteral<"unsupported">;
263
+ }, z.core.$strip>, z.ZodObject<{
264
+ details: z.ZodOptional<z.ZodString>;
265
+ feature: z.ZodString;
266
+ type: z.ZodLiteral<"compatibility">;
267
+ }, z.core.$strip>, z.ZodObject<{
268
+ message: z.ZodString;
269
+ setting: z.ZodString;
270
+ type: z.ZodLiteral<"deprecated">;
271
+ }, z.core.$strip>, z.ZodObject<{
272
+ message: z.ZodString;
273
+ type: z.ZodLiteral<"other">;
274
+ }, z.core.$strip>], "type">>>;
275
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
25
276
  loadInvocation: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
26
277
  context: z.ZodObject<{
27
278
  actionOutputs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -97,3 +348,4 @@ export declare const runtimeContract: {
97
348
  id: z.ZodNullable<z.ZodString>;
98
349
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
99
350
  };
351
+ export {};
package/dist/runtime.js CHANGED
@@ -6,6 +6,118 @@ const SIGNAL_FAILURE_SCHEMA = z.object({
6
6
  name: z.string(),
7
7
  });
8
8
  const TERMINAL_ACTION_STATUS_SCHEMA = z.enum(["closed", "failed", "succeeded"]);
9
+ const GENERATION_WARNING_SCHEMA = z.discriminatedUnion("type", [
10
+ z.object({
11
+ details: z.string().optional(),
12
+ feature: z.string(),
13
+ type: z.literal("unsupported"),
14
+ }),
15
+ z.object({
16
+ details: z.string().optional(),
17
+ feature: z.string(),
18
+ type: z.literal("compatibility"),
19
+ }),
20
+ z.object({
21
+ message: z.string(),
22
+ setting: z.string(),
23
+ type: z.literal("deprecated"),
24
+ }),
25
+ z.object({
26
+ message: z.string(),
27
+ type: z.literal("other"),
28
+ }),
29
+ ]);
30
+ const GENERATION_USAGE_SCHEMA = z.object({
31
+ inputTokenDetails: z.object({
32
+ cacheReadTokens: z.number().optional(),
33
+ cacheWriteTokens: z.number().optional(),
34
+ noCacheTokens: z.number().optional(),
35
+ }),
36
+ inputTokens: z.number().optional(),
37
+ outputTokenDetails: z.object({
38
+ reasoningTokens: z.number().optional(),
39
+ textTokens: z.number().optional(),
40
+ }),
41
+ outputTokens: z.number().optional(),
42
+ raw: encodableSchema,
43
+ totalTokens: z.number().optional(),
44
+ });
45
+ const GENERATION_OPTIONS_SCHEMA = z.object({
46
+ frequencyPenalty: z.number().optional(),
47
+ instructions: z.string().optional(),
48
+ maxOutputTokens: z.number().int().positive().optional(),
49
+ maxRetries: z.number().int().nonnegative().optional(),
50
+ model: z.string().min(1),
51
+ presencePenalty: z.number().optional(),
52
+ providerOptions: z
53
+ .record(z.string(), z.record(z.string(), z.json()))
54
+ .optional(),
55
+ seed: z.number().int().optional(),
56
+ stopSequences: z.string().array().min(1).optional(),
57
+ system: z.string().optional(),
58
+ temperature: z.number().optional(),
59
+ timeout: z.number().int().positive().optional(),
60
+ topK: z.number().int().positive().optional(),
61
+ topP: z.number().optional(),
62
+ });
63
+ const GENERATION_MESSAGES_INPUT_SCHEMA = GENERATION_OPTIONS_SCHEMA.extend({
64
+ messages: z
65
+ .object({
66
+ content: z.string(),
67
+ role: z.enum(["assistant", "user"]),
68
+ })
69
+ .array()
70
+ .min(1),
71
+ prompt: z.never().optional(),
72
+ });
73
+ const GENERATION_PROMPT_INPUT_SCHEMA = GENERATION_OPTIONS_SCHEMA.extend({
74
+ messages: z.never().optional(),
75
+ prompt: z.string(),
76
+ });
77
+ /** Shared text-generation options accepted by the built-in generate action. */
78
+ export const generationInputSchema = z.union([
79
+ GENERATION_PROMPT_INPUT_SCHEMA,
80
+ GENERATION_MESSAGES_INPUT_SCHEMA,
81
+ ]);
82
+ /** Serializable subset of the AI SDK text-generation result. */
83
+ export const generationResultSchema = z.object({
84
+ finishReason: z.enum([
85
+ "stop",
86
+ "length",
87
+ "content-filter",
88
+ "tool-calls",
89
+ "error",
90
+ "other",
91
+ ]),
92
+ output: encodableSchema,
93
+ providerMetadata: encodableSchema,
94
+ rawFinishReason: z.string().optional(),
95
+ reasoningText: z.string().optional(),
96
+ response: z.object({
97
+ headers: z.record(z.string(), z.string()).optional(),
98
+ id: z.string(),
99
+ modelId: z.string(),
100
+ timestamp: z.iso.datetime(),
101
+ }),
102
+ text: z.string(),
103
+ usage: GENERATION_USAGE_SCHEMA,
104
+ warnings: GENERATION_WARNING_SCHEMA.array().optional(),
105
+ });
106
+ const RUNTIME_GENERATION_OUTPUT_SCHEMA = z
107
+ .object({
108
+ description: z.string().optional(),
109
+ name: z.string().optional(),
110
+ schema: z.record(z.string(), z.json()),
111
+ })
112
+ .optional();
113
+ const RUNTIME_GENERATION_INPUT_SCHEMA = z.union([
114
+ GENERATION_PROMPT_INPUT_SCHEMA.extend({
115
+ output: RUNTIME_GENERATION_OUTPUT_SCHEMA,
116
+ }),
117
+ GENERATION_MESSAGES_INPUT_SCHEMA.extend({
118
+ output: RUNTIME_GENERATION_OUTPUT_SCHEMA,
119
+ }),
120
+ ]);
9
121
  export const runtimeContract = {
10
122
  commit: oc
11
123
  .input(z.object({
@@ -35,6 +147,9 @@ export const runtimeContract = {
35
147
  }),
36
148
  ]))
37
149
  .output(z.void()),
150
+ generate: oc
151
+ .input(RUNTIME_GENERATION_INPUT_SCHEMA)
152
+ .output(generationResultSchema),
38
153
  loadInvocation: oc.output(z.object({
39
154
  context: z.object({
40
155
  actionOutputs: z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.26.1",
3
+ "version": "0.28.0",
4
4
  "description": "Public oRPC contract for the Automate.ax API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@automate.ax/codec": "0.26.1",
29
+ "@automate.ax/codec": "0.28.0",
30
30
  "@orpc/contract": "1.13.14",
31
31
  "zod": "^4.3.6"
32
32
  },
package/src/deployment.ts CHANGED
@@ -17,11 +17,40 @@ export const deploymentTriggerInfoSchema = z.object({
17
17
 
18
18
  export type DeploymentTriggerInfo = z.infer<typeof deploymentTriggerInfoSchema>
19
19
 
20
+ const DEPLOYMENT_STATUS_SCHEMA = z.enum([
21
+ "planning",
22
+ "awaiting_authorization",
23
+ "configuring",
24
+ "publishing",
25
+ "succeeded",
26
+ "failed",
27
+ "cancelled",
28
+ ])
29
+
30
+ const DEPLOYMENT_IN_PROGRESS_ERROR = {
31
+ data: z.object({
32
+ deploymentId: z.string(),
33
+ status: DEPLOYMENT_STATUS_SCHEMA,
34
+ }),
35
+ message: "A deployment is already in progress.",
36
+ status: 409,
37
+ } as const
38
+
20
39
  export const deploymentContract = {
40
+ cancel: oc
41
+ .input(
42
+ z.object({
43
+ deploymentId: z.string(),
44
+ projectId: z.string(),
45
+ }),
46
+ )
47
+ .output(z.void()),
21
48
  create: oc
49
+ .errors({ DEPLOYMENT_IN_PROGRESS: DEPLOYMENT_IN_PROGRESS_ERROR })
22
50
  .input(
23
51
  z.object({
24
52
  artifact: z.instanceof(Blob),
53
+ cancelExisting: z.boolean().default(false),
25
54
  manifest: z
26
55
  .object({
27
56
  identityKey: z.string().min(1),
@@ -76,14 +105,7 @@ export const deploymentContract = {
76
105
  id: z.string(),
77
106
  name: z.string(),
78
107
  }),
79
- status: z.enum([
80
- "planning",
81
- "awaiting_authorization",
82
- "configuring",
83
- "publishing",
84
- "succeeded",
85
- "failed",
86
- ]),
108
+ status: DEPLOYMENT_STATUS_SCHEMA,
87
109
  }),
88
110
  ),
89
111
  }
package/src/index.ts CHANGED
@@ -14,7 +14,14 @@ export {
14
14
  type DeploymentTriggerInfo,
15
15
  } from "./deployment"
16
16
  export { integrationAccountOutputSchema } from "./account"
17
- export { runtimeContract } from "./runtime"
17
+ export {
18
+ generationInputSchema,
19
+ generationResultSchema,
20
+ runtimeContract,
21
+ type GenerationInput,
22
+ type GenerationResult,
23
+ type RuntimeGenerationInput,
24
+ } from "./runtime"
18
25
  export {
19
26
  createdOrganizationApiKeyOutputSchema,
20
27
  organizationApiKeyOutputSchema,
package/src/runtime.ts CHANGED
@@ -9,6 +9,134 @@ const SIGNAL_FAILURE_SCHEMA = z.object({
9
9
 
10
10
  const TERMINAL_ACTION_STATUS_SCHEMA = z.enum(["closed", "failed", "succeeded"])
11
11
 
12
+ const GENERATION_WARNING_SCHEMA = z.discriminatedUnion("type", [
13
+ z.object({
14
+ details: z.string().optional(),
15
+ feature: z.string(),
16
+ type: z.literal("unsupported"),
17
+ }),
18
+ z.object({
19
+ details: z.string().optional(),
20
+ feature: z.string(),
21
+ type: z.literal("compatibility"),
22
+ }),
23
+ z.object({
24
+ message: z.string(),
25
+ setting: z.string(),
26
+ type: z.literal("deprecated"),
27
+ }),
28
+ z.object({
29
+ message: z.string(),
30
+ type: z.literal("other"),
31
+ }),
32
+ ])
33
+
34
+ const GENERATION_USAGE_SCHEMA = z.object({
35
+ inputTokenDetails: z.object({
36
+ cacheReadTokens: z.number().optional(),
37
+ cacheWriteTokens: z.number().optional(),
38
+ noCacheTokens: z.number().optional(),
39
+ }),
40
+ inputTokens: z.number().optional(),
41
+ outputTokenDetails: z.object({
42
+ reasoningTokens: z.number().optional(),
43
+ textTokens: z.number().optional(),
44
+ }),
45
+ outputTokens: z.number().optional(),
46
+ raw: encodableSchema,
47
+ totalTokens: z.number().optional(),
48
+ })
49
+
50
+ const GENERATION_OPTIONS_SCHEMA = z.object({
51
+ frequencyPenalty: z.number().optional(),
52
+ instructions: z.string().optional(),
53
+ maxOutputTokens: z.number().int().positive().optional(),
54
+ maxRetries: z.number().int().nonnegative().optional(),
55
+ model: z.string().min(1),
56
+ presencePenalty: z.number().optional(),
57
+ providerOptions: z
58
+ .record(z.string(), z.record(z.string(), z.json()))
59
+ .optional(),
60
+ seed: z.number().int().optional(),
61
+ stopSequences: z.string().array().min(1).optional(),
62
+ system: z.string().optional(),
63
+ temperature: z.number().optional(),
64
+ timeout: z.number().int().positive().optional(),
65
+ topK: z.number().int().positive().optional(),
66
+ topP: z.number().optional(),
67
+ })
68
+
69
+ const GENERATION_MESSAGES_INPUT_SCHEMA = GENERATION_OPTIONS_SCHEMA.extend({
70
+ messages: z
71
+ .object({
72
+ content: z.string(),
73
+ role: z.enum(["assistant", "user"]),
74
+ })
75
+ .array()
76
+ .min(1),
77
+ prompt: z.never().optional(),
78
+ })
79
+
80
+ const GENERATION_PROMPT_INPUT_SCHEMA = GENERATION_OPTIONS_SCHEMA.extend({
81
+ messages: z.never().optional(),
82
+ prompt: z.string(),
83
+ })
84
+
85
+ /** Shared text-generation options accepted by the built-in generate action. */
86
+ export const generationInputSchema = z.union([
87
+ GENERATION_PROMPT_INPUT_SCHEMA,
88
+ GENERATION_MESSAGES_INPUT_SCHEMA,
89
+ ])
90
+
91
+ /** Serializable subset of the AI SDK text-generation result. */
92
+ export const generationResultSchema = z.object({
93
+ finishReason: z.enum([
94
+ "stop",
95
+ "length",
96
+ "content-filter",
97
+ "tool-calls",
98
+ "error",
99
+ "other",
100
+ ]),
101
+ output: encodableSchema,
102
+ providerMetadata: encodableSchema,
103
+ rawFinishReason: z.string().optional(),
104
+ reasoningText: z.string().optional(),
105
+ response: z.object({
106
+ headers: z.record(z.string(), z.string()).optional(),
107
+ id: z.string(),
108
+ modelId: z.string(),
109
+ timestamp: z.iso.datetime(),
110
+ }),
111
+ text: z.string(),
112
+ usage: GENERATION_USAGE_SCHEMA,
113
+ warnings: GENERATION_WARNING_SCHEMA.array().optional(),
114
+ })
115
+
116
+ export type GenerationInput = z.output<typeof generationInputSchema>
117
+ export type GenerationResult = z.output<typeof generationResultSchema>
118
+
119
+ const RUNTIME_GENERATION_OUTPUT_SCHEMA = z
120
+ .object({
121
+ description: z.string().optional(),
122
+ name: z.string().optional(),
123
+ schema: z.record(z.string(), z.json()),
124
+ })
125
+ .optional()
126
+
127
+ const RUNTIME_GENERATION_INPUT_SCHEMA = z.union([
128
+ GENERATION_PROMPT_INPUT_SCHEMA.extend({
129
+ output: RUNTIME_GENERATION_OUTPUT_SCHEMA,
130
+ }),
131
+ GENERATION_MESSAGES_INPUT_SCHEMA.extend({
132
+ output: RUNTIME_GENERATION_OUTPUT_SCHEMA,
133
+ }),
134
+ ])
135
+
136
+ export type RuntimeGenerationInput = z.output<
137
+ typeof RUNTIME_GENERATION_INPUT_SCHEMA
138
+ >
139
+
12
140
  export const runtimeContract = {
13
141
  commit: oc
14
142
  .input(
@@ -42,6 +170,9 @@ export const runtimeContract = {
42
170
  ]),
43
171
  )
44
172
  .output(z.void()),
173
+ generate: oc
174
+ .input(RUNTIME_GENERATION_INPUT_SCHEMA)
175
+ .output(generationResultSchema),
45
176
  loadInvocation: oc.output(
46
177
  z.object({
47
178
  context: z.object({