@automate.ax/api-contract 0.84.0 → 0.86.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/runtime.d.ts CHANGED
@@ -1,18 +1,34 @@
1
- import type { GatewayModelId } from "@ai-sdk/gateway";
1
+ import { type SensitivityMask } from "@automate.ax/codec";
2
+ import type { GatewayImageModelId, GatewayModelId } from "@ai-sdk/gateway";
2
3
  import * as z from "zod";
3
- export type { GatewayModelId } from "@ai-sdk/gateway";
4
+ export type { GatewayImageModelId, GatewayModelId } from "@ai-sdk/gateway";
4
5
  /** Default model used by the platform Vercel AI Gateway account. */
5
6
  export declare const DEFAULT_GATEWAY_MODEL_ID = "openai/gpt-4.1-nano";
7
+ /** Default image model used by the platform Vercel AI Gateway account. */
8
+ export declare const DEFAULT_GATEWAY_IMAGE_MODEL_ID = "bfl/flux-2-flex";
6
9
  export declare const AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT = "default";
7
10
  export declare const AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX = "__$";
8
11
  export declare const AUTOMATION_DELAY_ENTRYPOINT_PREFIX: "__$delay:";
12
+ export declare const AUTOMATION_IMAGE_GENERATION_ENTRYPOINT_PREFIX: "__$generate-image:";
9
13
  export declare const CALLBACK_PROTECTION_QUERY_PARAMETER = "_axCallback";
10
14
  export declare const AUTOMATION_LOG_MAX_ENTRIES = 1000;
11
15
  export declare const AUTOMATION_TRACE_MAX_SPANS = 250;
12
16
  export declare const AUTOMATION_OBSERVABILITY_MAX_FIELDS = 64;
13
17
  export declare const AUTOMATION_OBSERVABILITY_MAX_ENCODED_BYTES: number;
18
+ /** Preserves Blob media types while oRPC carries the bytes as multipart data. */
19
+ export declare const runtimeBlobJsonSerializer: {
20
+ type: number;
21
+ condition: (value: unknown) => boolean;
22
+ serialize(value: Blob): {
23
+ transportValue: Blob;
24
+ type: string;
25
+ };
26
+ deserialize(value: unknown): Blob;
27
+ };
14
28
  export declare const AUTOMATION_LOG_MAX_MESSAGE_LENGTH = 16384;
15
29
  export declare const AUTOMATION_TRACE_MAX_NAME_LENGTH = 256;
30
+ /** Runtime-validated structural policy for author-visible value projection. */
31
+ export declare const sensitivityMaskSchema: z.ZodCustom<SensitivityMask, SensitivityMask>;
16
32
  /** Immediate or mutually exclusive absolute/relative invocation timing. */
17
33
  export declare const automationInvocationScheduleSchema: z.ZodUnion<readonly [z.ZodObject<{
18
34
  runAt: z.ZodUnion<readonly [z.ZodDate, z.ZodString, z.ZodNumber]>;
@@ -469,6 +485,124 @@ declare const RUNTIME_GENERATION_INPUT_SCHEMA: z.ZodUnion<readonly [z.ZodObject<
469
485
  }, z.core.$strip>>;
470
486
  }, z.core.$strip>]>;
471
487
  export type RuntimeGenerationInput = z.output<typeof RUNTIME_GENERATION_INPUT_SCHEMA>;
488
+ /** Shared options accepted by the built-in image-generation action. */
489
+ export declare const imageGenerationInputSchema: z.ZodObject<{
490
+ aspectRatio: z.ZodOptional<z.ZodCustom<`${number}:${number}`, `${number}:${number}`>>;
491
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
492
+ maxImagesPerCall: z.ZodOptional<z.ZodNumber>;
493
+ maxRetries: z.ZodOptional<z.ZodNumber>;
494
+ model: z.ZodDefault<z.ZodCustom<GatewayImageModelId, GatewayImageModelId>>;
495
+ n: z.ZodOptional<z.ZodNumber>;
496
+ prompt: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
497
+ images: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<Blob, Blob>]>>;
498
+ mask: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<Blob, Blob>]>>;
499
+ text: z.ZodOptional<z.ZodString>;
500
+ }, z.core.$strip>]>;
501
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
502
+ seed: z.ZodOptional<z.ZodNumber>;
503
+ size: z.ZodOptional<z.ZodCustom<`${number}x${number}`, `${number}x${number}`>>;
504
+ }, z.core.$strip>;
505
+ /** Serializable subset of the AI SDK image-generation result. */
506
+ export declare const imageGenerationResultSchema: z.ZodObject<{
507
+ images: z.ZodArray<z.ZodCustom<Blob, Blob>>;
508
+ providerMetadata: z.ZodRecord<z.ZodString, z.ZodObject<{
509
+ images: z.ZodOptional<z.ZodArray<z.ZodJSONSchema>>;
510
+ }, z.core.$catchall<z.ZodJSONSchema>>>;
511
+ responses: z.ZodArray<z.ZodObject<{
512
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
513
+ modelId: z.ZodString;
514
+ timestamp: z.ZodISODateTime;
515
+ }, z.core.$strip>>;
516
+ usage: z.ZodObject<{
517
+ inputTokens: z.ZodOptional<z.ZodNumber>;
518
+ outputTokens: z.ZodOptional<z.ZodNumber>;
519
+ totalTokens: z.ZodOptional<z.ZodNumber>;
520
+ }, z.core.$strip>;
521
+ warnings: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
522
+ details: z.ZodOptional<z.ZodString>;
523
+ feature: z.ZodString;
524
+ type: z.ZodLiteral<"unsupported">;
525
+ }, z.core.$strip>, z.ZodObject<{
526
+ details: z.ZodOptional<z.ZodString>;
527
+ feature: z.ZodString;
528
+ type: z.ZodLiteral<"compatibility">;
529
+ }, z.core.$strip>, z.ZodObject<{
530
+ message: z.ZodString;
531
+ setting: z.ZodString;
532
+ type: z.ZodLiteral<"deprecated">;
533
+ }, z.core.$strip>, z.ZodObject<{
534
+ message: z.ZodString;
535
+ type: z.ZodLiteral<"other">;
536
+ }, z.core.$strip>], "type">>;
537
+ }, z.core.$strip>;
538
+ /** Internal terminal delivery emitted by a platform image-generation job. */
539
+ export declare const imageGenerationCompletionSchema: z.ZodObject<{
540
+ key: z.ZodString;
541
+ outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
542
+ result: z.ZodObject<{
543
+ images: z.ZodArray<z.ZodCustom<Blob, Blob>>;
544
+ providerMetadata: z.ZodRecord<z.ZodString, z.ZodObject<{
545
+ images: z.ZodOptional<z.ZodArray<z.ZodJSONSchema>>;
546
+ }, z.core.$catchall<z.ZodJSONSchema>>>;
547
+ responses: z.ZodArray<z.ZodObject<{
548
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
549
+ modelId: z.ZodString;
550
+ timestamp: z.ZodISODateTime;
551
+ }, z.core.$strip>>;
552
+ usage: z.ZodObject<{
553
+ inputTokens: z.ZodOptional<z.ZodNumber>;
554
+ outputTokens: z.ZodOptional<z.ZodNumber>;
555
+ totalTokens: z.ZodOptional<z.ZodNumber>;
556
+ }, z.core.$strip>;
557
+ warnings: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
558
+ details: z.ZodOptional<z.ZodString>;
559
+ feature: z.ZodString;
560
+ type: z.ZodLiteral<"unsupported">;
561
+ }, z.core.$strip>, z.ZodObject<{
562
+ details: z.ZodOptional<z.ZodString>;
563
+ feature: z.ZodString;
564
+ type: z.ZodLiteral<"compatibility">;
565
+ }, z.core.$strip>, z.ZodObject<{
566
+ message: z.ZodString;
567
+ setting: z.ZodString;
568
+ type: z.ZodLiteral<"deprecated">;
569
+ }, z.core.$strip>, z.ZodObject<{
570
+ message: z.ZodString;
571
+ type: z.ZodLiteral<"other">;
572
+ }, z.core.$strip>], "type">>;
573
+ }, z.core.$strip>;
574
+ status: z.ZodLiteral<"succeeded">;
575
+ }, z.core.$strip>, z.ZodObject<{
576
+ failure: z.ZodType<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue, z.core.$ZodTypeInternals<import("./errors").AutomationErrorValue, import("./errors").AutomationErrorValue>>;
577
+ status: z.ZodLiteral<"failed">;
578
+ }, z.core.$strip>], "status">;
579
+ }, z.core.$strip>;
580
+ /** Starts platform image generation for one reserved internal entrypoint. */
581
+ export declare const platformImageGenerationInputSchema: z.ZodObject<{
582
+ aspectRatio: z.ZodOptional<z.ZodCustom<`${number}:${number}`, `${number}:${number}`>>;
583
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
584
+ maxImagesPerCall: z.ZodOptional<z.ZodNumber>;
585
+ maxRetries: z.ZodOptional<z.ZodNumber>;
586
+ model: z.ZodDefault<z.ZodCustom<GatewayImageModelId, GatewayImageModelId>>;
587
+ n: z.ZodOptional<z.ZodNumber>;
588
+ prompt: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
589
+ images: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<Blob, Blob>]>>;
590
+ mask: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<Blob, Blob>]>>;
591
+ text: z.ZodOptional<z.ZodString>;
592
+ }, z.core.$strip>]>;
593
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
594
+ seed: z.ZodOptional<z.ZodNumber>;
595
+ size: z.ZodOptional<z.ZodCustom<`${number}x${number}`, `${number}x${number}`>>;
596
+ entrypoint: z.ZodString;
597
+ }, z.core.$strip>;
598
+ /** Durable identity returned after platform image generation is queued. */
599
+ export declare const platformImageGenerationStartSchema: z.ZodObject<{
600
+ key: z.ZodString;
601
+ }, z.core.$strip>;
602
+ export type ImageGenerationInput = z.output<typeof imageGenerationInputSchema>;
603
+ export type ImageGenerationResult = z.output<typeof imageGenerationResultSchema>;
604
+ export type ImageGenerationCompletion = z.output<typeof imageGenerationCompletionSchema>;
605
+ export type PlatformImageGenerationInput = z.output<typeof platformImageGenerationInputSchema>;
472
606
  /**
473
607
  * Hashes one coordinator definition exactly as the runtime stores it.
474
608
  *
@@ -503,6 +637,7 @@ export declare const runtimeContract: {
503
637
  eventDependencyIds: z.ZodArray<z.ZodString>;
504
638
  inputHash: z.ZodString;
505
639
  name: z.ZodString;
640
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
506
641
  scopePath: z.ZodArray<z.ZodNumber>;
507
642
  signalDependencyIds: z.ZodArray<z.ZodString>;
508
643
  slot: z.ZodNumber;
@@ -532,6 +667,7 @@ export declare const runtimeContract: {
532
667
  eventDependencyIds: z.ZodArray<z.ZodString>;
533
668
  inputHash: z.ZodString;
534
669
  name: z.ZodString;
670
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
535
671
  scopePath: z.ZodArray<z.ZodNumber>;
536
672
  signalDependencyIds: z.ZodArray<z.ZodString>;
537
673
  slot: z.ZodNumber;
@@ -562,6 +698,7 @@ export declare const runtimeContract: {
562
698
  eventDependencyIds: z.ZodArray<z.ZodString>;
563
699
  inputHash: z.ZodString;
564
700
  name: z.ZodString;
701
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
565
702
  scopePath: z.ZodArray<z.ZodNumber>;
566
703
  signalDependencyIds: z.ZodArray<z.ZodString>;
567
704
  slot: z.ZodNumber;
@@ -1055,6 +1192,25 @@ export declare const runtimeContract: {
1055
1192
  type: z.ZodLiteral<"other">;
1056
1193
  }, z.core.$strip>], "type">>>;
1057
1194
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1195
+ startImageGeneration: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1196
+ aspectRatio: z.ZodOptional<z.ZodCustom<`${number}:${number}`, `${number}:${number}`>>;
1197
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1198
+ maxImagesPerCall: z.ZodOptional<z.ZodNumber>;
1199
+ maxRetries: z.ZodOptional<z.ZodNumber>;
1200
+ model: z.ZodDefault<z.ZodCustom<GatewayImageModelId, GatewayImageModelId>>;
1201
+ n: z.ZodOptional<z.ZodNumber>;
1202
+ prompt: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1203
+ images: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<Blob, Blob>]>>;
1204
+ mask: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<Blob, Blob>]>>;
1205
+ text: z.ZodOptional<z.ZodString>;
1206
+ }, z.core.$strip>]>;
1207
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
1208
+ seed: z.ZodOptional<z.ZodNumber>;
1209
+ size: z.ZodOptional<z.ZodCustom<`${number}x${number}`, `${number}x${number}`>>;
1210
+ entrypoint: z.ZodString;
1211
+ }, z.core.$strip>, z.ZodObject<{
1212
+ key: z.ZodString;
1213
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1058
1214
  createCallbackToken: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1059
1215
  endpointKey: z.ZodString;
1060
1216
  }, z.core.$strip>, z.ZodString, Record<never, never>, Record<never, never>>;
@@ -1107,6 +1263,7 @@ export declare const runtimeContract: {
1107
1263
  eventDependencyIds: z.ZodArray<z.ZodString>;
1108
1264
  inputHash: z.ZodString;
1109
1265
  name: z.ZodString;
1266
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
1110
1267
  scopePath: z.ZodArray<z.ZodNumber>;
1111
1268
  signalDependencyIds: z.ZodArray<z.ZodString>;
1112
1269
  slot: z.ZodNumber;
@@ -1138,6 +1295,7 @@ export declare const runtimeContract: {
1138
1295
  eventDependencyIds: z.ZodArray<z.ZodString>;
1139
1296
  inputHash: z.ZodString;
1140
1297
  name: z.ZodString;
1298
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
1141
1299
  scopePath: z.ZodArray<z.ZodNumber>;
1142
1300
  signalDependencyIds: z.ZodArray<z.ZodString>;
1143
1301
  slot: z.ZodNumber;
@@ -1171,6 +1329,7 @@ export declare const runtimeContract: {
1171
1329
  eventDependencyIds: z.ZodArray<z.ZodString>;
1172
1330
  inputHash: z.ZodString;
1173
1331
  name: z.ZodString;
1332
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
1174
1333
  scopePath: z.ZodArray<z.ZodNumber>;
1175
1334
  signalDependencyIds: z.ZodArray<z.ZodString>;
1176
1335
  slot: z.ZodNumber;
@@ -1204,6 +1363,7 @@ export declare const runtimeContract: {
1204
1363
  eventDependencyIds: z.ZodArray<z.ZodString>;
1205
1364
  inputHash: z.ZodString;
1206
1365
  name: z.ZodString;
1366
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
1207
1367
  scopePath: z.ZodArray<z.ZodNumber>;
1208
1368
  signalDependencyIds: z.ZodArray<z.ZodString>;
1209
1369
  slot: z.ZodNumber;
@@ -1238,6 +1398,7 @@ export declare const runtimeContract: {
1238
1398
  eventDependencyIds: z.ZodArray<z.ZodString>;
1239
1399
  inputHash: z.ZodString;
1240
1400
  name: z.ZodString;
1401
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
1241
1402
  scopePath: z.ZodArray<z.ZodNumber>;
1242
1403
  signalDependencyIds: z.ZodArray<z.ZodString>;
1243
1404
  slot: z.ZodNumber;
@@ -1423,6 +1584,7 @@ export declare const runtimeContract: {
1423
1584
  slot: z.ZodNumber;
1424
1585
  timestamp: z.ZodDate;
1425
1586
  output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1587
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
1426
1588
  status: z.ZodLiteral<"succeeded">;
1427
1589
  }, z.core.$strip>]>>;
1428
1590
  coordinationSelections: z.ZodArray<z.ZodObject<{
@@ -1562,6 +1724,7 @@ export declare const runtimeContract: {
1562
1724
  slot: z.ZodNumber;
1563
1725
  timestamp: z.ZodDate;
1564
1726
  output: z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>;
1727
+ outputSensitivity: z.ZodOptional<z.ZodNullable<z.ZodCustom<SensitivityMask, SensitivityMask>>>;
1565
1728
  status: z.ZodLiteral<"succeeded">;
1566
1729
  }, z.core.$strip>]>>;
1567
1730
  coordinationSelections: z.ZodArray<z.ZodObject<{
@@ -1659,6 +1822,7 @@ export declare const runtimeContract: {
1659
1822
  type: z.ZodString;
1660
1823
  }, z.core.$strip>;
1661
1824
  outputIndex: z.ZodNumber;
1825
+ sensitivity: z.ZodOptional<z.ZodCustom<SensitivityMask, SensitivityMask>>;
1662
1826
  }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
1663
1827
  sendLog: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1664
1828
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>>;
@@ -1670,12 +1834,14 @@ export declare const runtimeContract: {
1670
1834
  }>;
1671
1835
  logIndex: z.ZodNumber;
1672
1836
  message: z.ZodString;
1837
+ sensitivity: z.ZodOptional<z.ZodCustom<SensitivityMask, SensitivityMask>>;
1673
1838
  spanIndex: z.ZodOptional<z.ZodNumber>;
1674
1839
  timestamp: z.ZodDate;
1675
1840
  }, z.core.$strip>, z.ZodVoid, Record<never, never>, Record<never, never>>;
1676
1841
  startTraceSpan: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1677
1842
  attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodCustom<import("@automate.ax/codec").Encodable, import("@automate.ax/codec").Encodable>>>>;
1678
1843
  name: z.ZodString;
1844
+ sensitivity: z.ZodOptional<z.ZodCustom<SensitivityMask, SensitivityMask>>;
1679
1845
  parentSpanIndex: z.ZodOptional<z.ZodNumber>;
1680
1846
  spanIndex: z.ZodNumber;
1681
1847
  startedAt: z.ZodDate;
package/dist/runtime.js CHANGED
@@ -1,18 +1,40 @@
1
- import { encodableSchema } from "@automate.ax/codec";
1
+ import { encodableSchema, isSensitivityMask, } from "@automate.ax/codec";
2
2
  import { oc } from "@orpc/contract";
3
3
  import stableStringify from "fast-json-stable-stringify";
4
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
+ /** Default image model used by the platform Vercel AI Gateway account. */
9
+ export const DEFAULT_GATEWAY_IMAGE_MODEL_ID = "bfl/flux-2-flex";
8
10
  export const AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT = "default";
9
11
  export const AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX = "__$";
10
12
  export const AUTOMATION_DELAY_ENTRYPOINT_PREFIX = `${AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX}delay:`;
13
+ export const AUTOMATION_IMAGE_GENERATION_ENTRYPOINT_PREFIX = `${AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX}generate-image:`;
11
14
  export const CALLBACK_PROTECTION_QUERY_PARAMETER = "_axCallback";
12
15
  export const AUTOMATION_LOG_MAX_ENTRIES = 1_000;
13
16
  export const AUTOMATION_TRACE_MAX_SPANS = 250;
14
17
  export const AUTOMATION_OBSERVABILITY_MAX_FIELDS = 64;
15
18
  export const AUTOMATION_OBSERVABILITY_MAX_ENCODED_BYTES = 64 * 1_024;
19
+ const RUNTIME_BLOB_JSON_SERIALIZER_TYPE = 8;
20
+ /** Blob wrappers that should use oRPC's native multipart serialization. */
21
+ const runtimeBlobTransportValues = new WeakSet();
22
+ /** Preserves Blob media types while oRPC carries the bytes as multipart data. */
23
+ export const runtimeBlobJsonSerializer = {
24
+ type: RUNTIME_BLOB_JSON_SERIALIZER_TYPE,
25
+ condition: (value) => value instanceof Blob && !runtimeBlobTransportValues.has(value),
26
+ serialize(value) {
27
+ const transportValue = new Blob([value]);
28
+ runtimeBlobTransportValues.add(transportValue);
29
+ return { transportValue, type: value.type };
30
+ },
31
+ deserialize(value) {
32
+ const { transportValue, type } = z
33
+ .object({ transportValue: z.instanceof(Blob), type: z.string() })
34
+ .parse(value);
35
+ return new Blob([transportValue], { type });
36
+ },
37
+ };
16
38
  export const AUTOMATION_LOG_MAX_MESSAGE_LENGTH = 16_384;
17
39
  export const AUTOMATION_TRACE_MAX_NAME_LENGTH = 256;
18
40
  const OUTCOME_SEQUENCE_SCHEMA = z.number().int().positive();
@@ -30,6 +52,8 @@ const TRACE_SPAN_INDEX_SCHEMA = z
30
52
  .int()
31
53
  .min(0)
32
54
  .max(AUTOMATION_TRACE_MAX_SPANS - 1);
55
+ /** Runtime-validated structural policy for author-visible value projection. */
56
+ export const sensitivityMaskSchema = z.custom(isSensitivityMask, { message: "Invalid structural sensitivity mask" });
33
57
  const AUTOMATION_INVOCATION_RUN_AT_SCHEMA = z.union([
34
58
  z.date(),
35
59
  z.string().min(1),
@@ -147,6 +171,7 @@ const ACTION_INVOCATION_BASE_SCHEMA = z.object({
147
171
  eventDependencyIds: z.string().array(),
148
172
  inputHash: z.string(),
149
173
  name: z.string(),
174
+ outputSensitivity: sensitivityMaskSchema.nullable().optional(),
150
175
  scopePath: HOOK_SCOPE_PATH_SCHEMA,
151
176
  signalDependencyIds: z.string().array(),
152
177
  slot: z.number().int().nonnegative(),
@@ -391,6 +416,7 @@ const ACTION_VALUE_OUTCOME_SCHEMA = z.union([
391
416
  }),
392
417
  ACTION_VALUE_OUTCOME_BASE_SCHEMA.extend({
393
418
  output: encodableSchema,
419
+ outputSensitivity: sensitivityMaskSchema.nullable().optional(),
394
420
  status: z.literal("succeeded"),
395
421
  }),
396
422
  ]);
@@ -478,7 +504,7 @@ const TARGET_ACTION_SCHEMA = z.union([
478
504
  status: z.enum(["failed", "skipped", "succeeded"]),
479
505
  }),
480
506
  ]);
481
- const GENERATION_WARNING_SCHEMA = z.discriminatedUnion("type", [
507
+ const AI_WARNING_SCHEMA = z.discriminatedUnion("type", [
482
508
  z.object({
483
509
  details: z.string().optional(),
484
510
  feature: z.string(),
@@ -576,7 +602,7 @@ export const generationResultSchema = z.object({
576
602
  }),
577
603
  text: z.string(),
578
604
  usage: GENERATION_USAGE_SCHEMA,
579
- warnings: GENERATION_WARNING_SCHEMA.array().optional(),
605
+ warnings: AI_WARNING_SCHEMA.array().optional(),
580
606
  });
581
607
  const RUNTIME_GENERATION_OUTPUT_SCHEMA = z
582
608
  .object({
@@ -593,6 +619,84 @@ const RUNTIME_GENERATION_INPUT_SCHEMA = z.union([
593
619
  output: RUNTIME_GENERATION_OUTPUT_SCHEMA,
594
620
  }),
595
621
  ]);
622
+ const IMAGE_DATA_CONTENT_SCHEMA = z.union([
623
+ z.string(),
624
+ z.custom((value) => value instanceof Uint8Array),
625
+ z.instanceof(ArrayBuffer),
626
+ z.instanceof(Blob),
627
+ ]);
628
+ const IMAGE_GENERATION_PROMPT_SCHEMA = z.union([
629
+ z.string(),
630
+ z.object({
631
+ images: IMAGE_DATA_CONTENT_SCHEMA.array(),
632
+ mask: IMAGE_DATA_CONTENT_SCHEMA.optional(),
633
+ text: z.string().optional(),
634
+ }),
635
+ ]);
636
+ const GATEWAY_IMAGE_MODEL_ID_SCHEMA = z
637
+ .custom((value) => typeof value === "string" && value.length > 0, "Model must be a nonempty AI Gateway image model ID.")
638
+ .default(DEFAULT_GATEWAY_IMAGE_MODEL_ID);
639
+ /** Shared options accepted by the built-in image-generation action. */
640
+ export const imageGenerationInputSchema = z.object({
641
+ aspectRatio: z
642
+ .custom((value) => typeof value === "string" && /^\d+(?:\.\d+)?:\d+(?:\.\d+)?$/.test(value), "Aspect ratio must use the format {width}:{height}.")
643
+ .optional(),
644
+ headers: z.record(z.string(), z.string()).optional(),
645
+ maxImagesPerCall: z.number().int().positive().optional(),
646
+ maxRetries: z.number().int().nonnegative().optional(),
647
+ model: GATEWAY_IMAGE_MODEL_ID_SCHEMA,
648
+ n: z.number().int().positive().optional(),
649
+ prompt: IMAGE_GENERATION_PROMPT_SCHEMA,
650
+ providerOptions: z
651
+ .record(z.string(), z.record(z.string(), z.json()))
652
+ .optional(),
653
+ seed: z.number().int().optional(),
654
+ size: z
655
+ .custom((value) => typeof value === "string" && /^\d+x\d+$/.test(value), "Size must use the format {width}x{height}.")
656
+ .optional(),
657
+ });
658
+ const IMAGE_PROVIDER_METADATA_SCHEMA = z
659
+ .object({ images: z.json().array().optional() })
660
+ .catchall(z.json());
661
+ /** Serializable subset of the AI SDK image-generation result. */
662
+ export const imageGenerationResultSchema = z.object({
663
+ images: z.instanceof(Blob).array().min(1),
664
+ providerMetadata: z.record(z.string(), IMAGE_PROVIDER_METADATA_SCHEMA),
665
+ responses: z
666
+ .object({
667
+ headers: z.record(z.string(), z.string()).optional(),
668
+ modelId: z.string(),
669
+ timestamp: z.iso.datetime(),
670
+ })
671
+ .array(),
672
+ usage: z.object({
673
+ inputTokens: z.number().optional(),
674
+ outputTokens: z.number().optional(),
675
+ totalTokens: z.number().optional(),
676
+ }),
677
+ warnings: AI_WARNING_SCHEMA.array(),
678
+ });
679
+ /** Internal terminal delivery emitted by a platform image-generation job. */
680
+ export const imageGenerationCompletionSchema = z.object({
681
+ key: z.string().min(1),
682
+ outcome: z.discriminatedUnion("status", [
683
+ z.object({
684
+ result: imageGenerationResultSchema,
685
+ status: z.literal("succeeded"),
686
+ }),
687
+ z.object({ failure: automationErrorSchema, status: z.literal("failed") }),
688
+ ]),
689
+ });
690
+ /** Starts platform image generation for one reserved internal entrypoint. */
691
+ export const platformImageGenerationInputSchema = imageGenerationInputSchema.extend({
692
+ entrypoint: z
693
+ .string()
694
+ .startsWith(AUTOMATION_IMAGE_GENERATION_ENTRYPOINT_PREFIX),
695
+ });
696
+ /** Durable identity returned after platform image generation is queued. */
697
+ export const platformImageGenerationStartSchema = z.object({
698
+ key: z.string().min(1),
699
+ });
596
700
  /**
597
701
  * Hashes one coordinator definition exactly as the runtime stores it.
598
702
  *
@@ -663,6 +767,9 @@ export const runtimeContract = {
663
767
  generate: oc
664
768
  .input(RUNTIME_GENERATION_INPUT_SCHEMA)
665
769
  .output(generationResultSchema),
770
+ startImageGeneration: oc
771
+ .input(platformImageGenerationInputSchema)
772
+ .output(platformImageGenerationStartSchema),
666
773
  createCallbackToken: oc
667
774
  .input(z.object({ endpointKey: z.string().min(1) }))
668
775
  .output(z.string()),
@@ -697,6 +804,7 @@ export const runtimeContract = {
697
804
  type: z.string().min(1),
698
805
  }),
699
806
  outputIndex: z.number().int().nonnegative(),
807
+ sensitivity: sensitivityMaskSchema.optional(),
700
808
  }))
701
809
  .output(z.void()),
702
810
  sendLog: oc
@@ -705,6 +813,7 @@ export const runtimeContract = {
705
813
  level: z.enum(["debug", "info", "warn", "error"]),
706
814
  logIndex: LOG_INDEX_SCHEMA,
707
815
  message: z.string().min(1).max(AUTOMATION_LOG_MAX_MESSAGE_LENGTH),
816
+ sensitivity: sensitivityMaskSchema.optional(),
708
817
  spanIndex: TRACE_SPAN_INDEX_SCHEMA.optional(),
709
818
  timestamp: z.date(),
710
819
  }))
@@ -713,6 +822,7 @@ export const runtimeContract = {
713
822
  .input(z.object({
714
823
  attributes: OBSERVABILITY_FIELDS_SCHEMA.optional(),
715
824
  name: z.string().min(1).max(AUTOMATION_TRACE_MAX_NAME_LENGTH),
825
+ sensitivity: sensitivityMaskSchema.optional(),
716
826
  parentSpanIndex: TRACE_SPAN_INDEX_SCHEMA.optional(),
717
827
  spanIndex: TRACE_SPAN_INDEX_SCHEMA,
718
828
  startedAt: z.date(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.84.0",
3
+ "version": "0.86.1",
4
4
  "description": "Public oRPC contract for the Automate.ax API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,14 +31,14 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ai-sdk/gateway": "^4.0.46",
34
- "@automate.ax/codec": "0.84.0",
35
- "@automate.ax/integration-contracts": "0.84.0",
34
+ "@automate.ax/codec": "0.86.1",
35
+ "@automate.ax/integration-contracts": "0.86.1",
36
36
  "@orpc/contract": "1.15.0",
37
37
  "fast-json-stable-stringify": "^2.1.0",
38
38
  "zod": "^4.3.6"
39
39
  },
40
40
  "devDependencies": {
41
- "@internal/config": "0.1.0",
41
+ "@internal/config": "0.2.0",
42
42
  "@types/bun": "latest",
43
43
  "@typescript/native": "npm:typescript@^7.0.2",
44
44
  "@zachsents/oxlint-config": "^0.4.1",
package/src/automation.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { encodableSchema } from "@automate.ax/codec"
2
+ import { sensitivityMaskSchema } from "./runtime"
2
3
  import { oc } from "@orpc/contract"
3
4
  import * as z from "zod"
4
5
  import { integrationAccountBindingOutputSchema } from "./account"
@@ -95,6 +96,7 @@ export const automationContract = {
95
96
  id: z.string(),
96
97
  name: z.string(),
97
98
  output: encodableSchema,
99
+ outputSensitivity: sensitivityMaskSchema.nullable().optional(),
98
100
  slot: z.number().int().nonnegative(),
99
101
  status: z.enum(["pending", "succeeded", "skipped", "failed"]),
100
102
  })
@@ -113,6 +115,7 @@ export const automationContract = {
113
115
  createdAt: z.date(),
114
116
  data: encodableSchema,
115
117
  id: z.string(),
118
+ sensitivity: sensitivityMaskSchema.nullable().optional(),
116
119
  outputIndex: z.number().int().nonnegative(),
117
120
  type: z.string(),
118
121
  })
@@ -15,6 +15,7 @@ import { slackEventsContract } from "./slack"
15
15
  import { stripeEventsContract } from "./stripe"
16
16
  import { trelloEventsContract } from "./trello"
17
17
  import { vercelEventsContract } from "./vercel"
18
+ import { webflowEventsContract } from "./webflow"
18
19
  import { whatsappEventsContract } from "./whatsapp"
19
20
 
20
21
  export const eventsContract = {
@@ -35,5 +36,6 @@ export const eventsContract = {
35
36
  ...stripeEventsContract,
36
37
  ...trelloEventsContract,
37
38
  ...vercelEventsContract,
39
+ ...webflowEventsContract,
38
40
  ...whatsappEventsContract,
39
41
  }
@@ -0,0 +1,18 @@
1
+ import { oc } from "@orpc/contract"
2
+ import * as z from "zod"
3
+
4
+ export const webflowEventsContract = {
5
+ webflowEvent: oc
6
+ .route({
7
+ method: "POST",
8
+ path: "/events/webflow/{sourceId}",
9
+ operationId: "receiveWebflowEvent",
10
+ summary: "Receive a Webflow event",
11
+ description:
12
+ "Receives and authenticates callbacks delivered by Webflow webhooks.",
13
+ tags: ["Events"],
14
+ successStatus: 200,
15
+ })
16
+ .input(z.looseObject({ sourceId: z.string() }))
17
+ .output(z.void()),
18
+ }
@@ -1,7 +1,7 @@
1
1
  import { oc } from "@orpc/contract"
2
2
  import { z } from "zod"
3
3
 
4
- export const EXECUTION_DATASET_VERSION = 6
4
+ export const EXECUTION_DATASET_VERSION = 7
5
5
 
6
6
  export const executionDatasetResourceSchema = z.enum([
7
7
  "projects",
package/src/index.ts CHANGED
@@ -44,26 +44,37 @@ export {
44
44
  export {
45
45
  AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT,
46
46
  AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX,
47
+ AUTOMATION_IMAGE_GENERATION_ENTRYPOINT_PREFIX,
47
48
  AUTOMATION_LOG_MAX_ENTRIES,
48
49
  AUTOMATION_LOG_MAX_MESSAGE_LENGTH,
49
50
  AUTOMATION_OBSERVABILITY_MAX_ENCODED_BYTES,
50
51
  AUTOMATION_OBSERVABILITY_MAX_FIELDS,
51
52
  AUTOMATION_TRACE_MAX_NAME_LENGTH,
52
53
  AUTOMATION_TRACE_MAX_SPANS,
54
+ DEFAULT_GATEWAY_IMAGE_MODEL_ID,
53
55
  DEFAULT_GATEWAY_MODEL_ID,
54
56
  automationInvocationInputSchema,
55
57
  automationInvocationOutputSchema,
56
58
  automationInvocationScheduleSchema,
57
59
  generationInputSchema,
58
60
  generationResultSchema,
61
+ imageGenerationInputSchema,
62
+ imageGenerationCompletionSchema,
63
+ imageGenerationResultSchema,
64
+ platformImageGenerationInputSchema,
65
+ platformImageGenerationStartSchema,
59
66
  hashSignalCoordinatorConfiguration,
60
67
  runtimeContract,
61
68
  type GenerationInput,
62
69
  type GenerationResult,
70
+ type ImageGenerationInput,
71
+ type ImageGenerationCompletion,
72
+ type ImageGenerationResult,
73
+ type PlatformImageGenerationInput,
63
74
  type RuntimeGenerationInput,
64
75
  type RuntimeCoordinationOffer,
65
76
  } from "./runtime"
66
- export type { GatewayModelId } from "@ai-sdk/gateway"
77
+ export type { GatewayImageModelId, GatewayModelId } from "@ai-sdk/gateway"
67
78
  export {
68
79
  createdOrganizationApiKeyOutputSchema,
69
80
  organizationApiKeyOutputSchema,