@kaana.ai/contracts 0.0.0-stage → 4.4.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 (79) hide show
  1. package/LICENSE +673 -0
  2. package/NOTICE +21 -0
  3. package/dist/index.d.ts +29 -0
  4. package/dist/index.js +29 -0
  5. package/dist/internal/attribution.d.ts +116 -0
  6. package/dist/internal/attribution.js +82 -0
  7. package/dist/internal/canonical.d.ts +31 -0
  8. package/dist/internal/canonical.js +57 -0
  9. package/dist/internal/catalogue.d.ts +1059 -0
  10. package/dist/internal/catalogue.js +389 -0
  11. package/dist/internal/credentialControl.d.ts +329 -0
  12. package/dist/internal/credentialControl.js +256 -0
  13. package/dist/internal/decisions.d.ts +245 -0
  14. package/dist/internal/decisions.js +69 -0
  15. package/dist/internal/economics.d.ts +27 -0
  16. package/dist/internal/economics.js +26 -0
  17. package/dist/internal/embeddings.d.ts +164 -0
  18. package/dist/internal/embeddings.js +59 -0
  19. package/dist/internal/errors.d.ts +185 -0
  20. package/dist/internal/errors.js +211 -0
  21. package/dist/internal/grant.d.ts +699 -0
  22. package/dist/internal/grant.js +445 -0
  23. package/dist/internal/identifiers.d.ts +63 -0
  24. package/dist/internal/identifiers.js +65 -0
  25. package/dist/internal/privateAutoExecution.d.ts +158 -0
  26. package/dist/internal/privateAutoExecution.js +188 -0
  27. package/dist/internal/realtime.d.ts +1005 -0
  28. package/dist/internal/realtime.js +187 -0
  29. package/dist/internal/request.d.ts +1079 -0
  30. package/dist/internal/request.js +404 -0
  31. package/dist/internal/routing.d.ts +90 -0
  32. package/dist/internal/routing.js +139 -0
  33. package/dist/internal/scopedExecution.d.ts +74 -0
  34. package/dist/internal/scopedExecution.js +61 -0
  35. package/dist/internal/settlement.d.ts +205 -0
  36. package/dist/internal/settlement.js +71 -0
  37. package/dist/internal/streamEvents.d.ts +422 -0
  38. package/dist/internal/streamEvents.js +171 -0
  39. package/dist/internal/usage.d.ts +127 -0
  40. package/dist/internal/usage.js +109 -0
  41. package/dist/internal.d.ts +30 -0
  42. package/dist/internal.js +30 -0
  43. package/dist/public/audio.d.ts +347 -0
  44. package/dist/public/audio.js +236 -0
  45. package/dist/public/audioFormats.d.ts +64 -0
  46. package/dist/public/audioFormats.js +60 -0
  47. package/dist/public/catalogue.d.ts +914 -0
  48. package/dist/public/catalogue.js +516 -0
  49. package/dist/public/chatCompletions.d.ts +381 -0
  50. package/dist/public/chatCompletions.js +321 -0
  51. package/dist/public/decisions.d.ts +182 -0
  52. package/dist/public/decisions.js +257 -0
  53. package/dist/public/embeddings.d.ts +34 -0
  54. package/dist/public/embeddings.js +66 -0
  55. package/dist/public/errors.d.ts +195 -0
  56. package/dist/public/errors.js +274 -0
  57. package/dist/public/generations.d.ts +330 -0
  58. package/dist/public/generations.js +121 -0
  59. package/dist/public/identifiers.d.ts +139 -0
  60. package/dist/public/identifiers.js +160 -0
  61. package/dist/public/images.d.ts +36 -0
  62. package/dist/public/images.js +36 -0
  63. package/dist/public/messages.d.ts +297 -0
  64. package/dist/public/messages.js +251 -0
  65. package/dist/public/money.d.ts +308 -0
  66. package/dist/public/money.js +237 -0
  67. package/dist/public/policy.d.ts +19 -0
  68. package/dist/public/policy.js +20 -0
  69. package/dist/public/realtime.d.ts +2006 -0
  70. package/dist/public/realtime.js +797 -0
  71. package/dist/public/responses.d.ts +253 -0
  72. package/dist/public/responses.js +95 -0
  73. package/dist/public/streamEvents.d.ts +372 -0
  74. package/dist/public/streamEvents.js +157 -0
  75. package/dist/public/version.d.ts +184 -0
  76. package/dist/public/version.js +184 -0
  77. package/openapi.json +6967 -0
  78. package/package.json +44 -4
  79. package/README.md +0 -3
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Identifiers and wire primitives of the public API (`https://kaana.ai/v1`).
3
+ *
4
+ * Every regex is plain ASCII: the package runs on Hermes (React Native), which
5
+ * rejects Unicode property escapes at runtime.
6
+ *
7
+ * Moved from `@oxy.so/contracts` 4.12.0 (`src/inference/identifiers.ts`) by Kaana ADR 0002.
8
+ */
9
+ import { z } from 'zod';
10
+ /**
11
+ * A delegated end-user identity (Alia's `X-Oxy-User-Id`), branded with a
12
+ * DIFFERENT brand from {@link oxyAccountIdSchema} so the two cannot be
13
+ * substituted for one another in either direction, in any consumer, without a
14
+ * cast that review would catch.
15
+ *
16
+ * It exists for attribution and product-side personalisation only. It is never
17
+ * a billing principal, never an access-control principal, and its presence
18
+ * never changes which account is charged.
19
+ */
20
+ export const delegatedUserIdSchema = z.string().min(1).max(64).brand();
21
+ /**
22
+ * An Oxy `Application._id`. Not branded: no invariant in this contract turns on
23
+ * confusing it with another id, and brand inflation costs every producer a
24
+ * parse call for no safety. The two ids above are branded because ADR 0007's
25
+ * rule is exactly that they must not be interchangeable.
26
+ */
27
+ export const oxyApplicationIdSchema = z.string().min(1).max(64);
28
+ /** An Oxy `ApplicationCredential._id` — the credential used for this request. */
29
+ export const oxyCredentialIdSchema = z.string().min(1).max(64);
30
+ /**
31
+ * A request id allocated by the Oxy EDGE, at admission and BEFORE
32
+ * authentication, so that a request rejected for a bad credential is as
33
+ * traceable as one that was served (ADR 0007, and step 1 of ADR 0010's edge
34
+ * order). It is required on the inbound envelope, which is what makes the data
35
+ * plane a consumer of this id rather than its source: the data plane echoes it
36
+ * on every stream event, on the usage report, in its response header and on
37
+ * anything it can be asked about later. It never mints one for a request it
38
+ * received.
39
+ *
40
+ * The one case that is NOT an exception to that: an envelope the data plane
41
+ * cannot read or authenticate carries no id to echo, so its rejection is
42
+ * labelled with an id of the data plane's own — visibly local, and never
43
+ * correlated with an Oxy request, because there is no Oxy request it belongs to.
44
+ * Saying so is what stops "consumer, not source" from being read as forbidding
45
+ * the only id such a rejection could have.
46
+ *
47
+ * Correlates the Oxy edge, the data plane, the financial ledger and the
48
+ * customer-visible receipt, so it appears on every stream event and every
49
+ * ledger record.
50
+ */
51
+ export const requestIdSchema = z.string().min(1).max(128);
52
+ /**
53
+ * A generation id generated by the data plane, present when a request produced
54
+ * a generation that can be looked up later (`GET /v1/generations/:id`).
55
+ */
56
+ export const generationIdSchema = z.string().min(1).max(128);
57
+ /**
58
+ * A caller-supplied idempotency key. Every reserve/settle/refund call is keyed
59
+ * on one so a retry, a redelivered event or a duplicated webhook can never
60
+ * charge twice.
61
+ */
62
+ export const idempotencyKeySchema = z.string().min(1).max(255);
63
+ /** Credential environments. A credential is issued into exactly one of them. */
64
+ export const inferenceEnvironmentSchema = z.enum(['development', 'staging', 'production']);
65
+ /**
66
+ * An instant, as an ISO 8601 string in UTC (`2026-08-15T09:41:00.000Z`).
67
+ *
68
+ * Validated rather than left free-form — unlike the session contracts, which
69
+ * carry legacy expiry strings no consumer interprets, every instant here is
70
+ * read: a reservation expires, a price version starts applying, a receipt is
71
+ * settled. One canonical spelling (UTC, `Z`) so two records that describe the
72
+ * same moment compare and sort as equal, which a mix of offsets would not.
73
+ */
74
+ export const inferenceTimestampSchema = z.string().datetime();
75
+ /**
76
+ * A calendar DATE with no instant attached (`2026-05-01`) — a knowledge cutoff
77
+ * or a release date, which are published as days and become wrong when a
78
+ * timezone is invented for them.
79
+ */
80
+ export const inferenceDateSchema = z
81
+ .string()
82
+ .regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/, 'must be an ISO 8601 calendar date (YYYY-MM-DD)');
83
+ /** An absolute https URL, for model cards, licenses and provider documentation. */
84
+ export const inferenceHttpsUrlSchema = z
85
+ .string()
86
+ .max(2048)
87
+ .regex(/^https:\/\/[^\s]+$/, 'must be an absolute https URL');
88
+ /**
89
+ * A content digest, `sha256:<64 lowercase hex>`.
90
+ *
91
+ * ONE spelling, because a digest is compared for equality and nothing else: an
92
+ * uppercase or unprefixed variant of the same hash is a different string, so two
93
+ * records describing the same bytes would not match. Lowercase hex with the
94
+ * algorithm prefix is what the `inference_model_revisions` CHECK stores and what
95
+ * every artifact registry emits.
96
+ */
97
+ export const sha256DigestSchema = z
98
+ .string()
99
+ .regex(/^sha256:[a-f0-9]{64}$/, 'digest must be sha256:<64 lowercase hex>');
100
+ /** Standard base64 in whole, padded 4-character groups. */
101
+ export const PADDED_BASE64_PATTERN = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
102
+ /** One path segment of a canonical model id: a lowercase, URL-safe slug. */
103
+ const SLUG_PATTERN = '[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?';
104
+ /** A revision label. Case-preserving, because upstream revisions often are. */
105
+ const REVISION_PATTERN = '[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?';
106
+ /** A publisher slug, e.g. `openai`, `anthropic`, `meta`, `alia`. */
107
+ export const publisherSlugSchema = z
108
+ .string()
109
+ .max(64)
110
+ .regex(new RegExp(`^${SLUG_PATTERN}$`), 'publisher must be a lowercase URL-safe slug');
111
+ /** A model slug within its publisher's namespace, e.g. `gpt-5`, `llama-3.1-70b`. */
112
+ export const modelSlugSchema = z
113
+ .string()
114
+ .max(64)
115
+ .regex(new RegExp(`^${SLUG_PATTERN}$`), 'model must be a lowercase URL-safe slug');
116
+ /**
117
+ * A canonical model id, `<publisher>/<model>`. This names a MODEL — a
118
+ * long-lived product identity whose behaviour changes as revisions ship. It
119
+ * does not name a revision, a deployment or a provider.
120
+ */
121
+ export const modelIdSchema = z
122
+ .string()
123
+ .max(129)
124
+ .regex(new RegExp(`^${SLUG_PATTERN}/${SLUG_PATTERN}$`), 'model id must be <publisher>/<model>');
125
+ /** An immutable revision label, unique within its model, e.g. `2026-05-01`. */
126
+ export const modelRevisionLabelSchema = z
127
+ .string()
128
+ .max(64)
129
+ .regex(new RegExp(`^${REVISION_PATTERN}$`), 'revision must be a URL-safe label');
130
+ /**
131
+ * A model reference as a customer writes it: `<publisher>/<model>` (the model's
132
+ * current revision, chosen by Oxy) or `<publisher>/<model>@<revision>` (an
133
+ * immutable revision the customer pinned).
134
+ *
135
+ * Both forms name a CONCRETE MODEL. Neither can name a routing profile — see
136
+ * {@link routingProfileSlugSchema} — which is what makes "a request for a
137
+ * concrete model is never silently replaced with a different model" a
138
+ * distinction the type system can carry rather than a convention.
139
+ */
140
+ export const modelReferenceSchema = z
141
+ .string()
142
+ .max(194)
143
+ .regex(new RegExp(`^${SLUG_PATTERN}/${SLUG_PATTERN}(?:@${REVISION_PATTERN})?$`), 'model reference must be <publisher>/<model> or <publisher>/<model>@<revision>');
144
+ /**
145
+ * A region identifier, e.g. `us-west-2`, `eu-central-1`. Free-form rather than
146
+ * a closed enum because the set is provider-defined and grows without any
147
+ * contract change; residency policies match on exact strings.
148
+ */
149
+ export const inferenceRegionSchema = z
150
+ .string()
151
+ .max(64)
152
+ .regex(new RegExp(`^${SLUG_PATTERN}$`), 'region must be a lowercase URL-safe slug');
153
+ /**
154
+ * The publisher namespace reserved for models Alia actually owns or derives.
155
+ *
156
+ * `alia/*` is never a re-badged third-party route and never a prompt preset —
157
+ * enforcing that is the job of `modelSchema`'s provenance refinement, which
158
+ * this constant exists to be checked against.
159
+ */
160
+ export const RESERVED_ALIA_PUBLISHER = 'alia';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `POST /v1/images/generations` — text to image, in OpenAI's shapes.
3
+ *
4
+ * Moved from the Oxy edge (`packages/api/src/schemas/inferenceEdge.schemas.ts`)
5
+ * by Kaana ADR 0002, unchanged. `size` and `quality` are forwarded and do not
6
+ * widen the hold: each size/quality class is its own model reference in the
7
+ * catalogue, because a price prices a unit, not a `(unit, size, quality)` tuple.
8
+ */
9
+ import { z } from 'zod';
10
+ export declare const imageGenerationsRequestSchema: z.ZodObject<{
11
+ model: z.ZodString;
12
+ prompt: z.ZodString;
13
+ n: z.ZodOptional<z.ZodNumber>;
14
+ size: z.ZodOptional<z.ZodString>;
15
+ quality: z.ZodOptional<z.ZodString>;
16
+ style: z.ZodOptional<z.ZodString>;
17
+ response_format: z.ZodOptional<z.ZodEnum<{
18
+ url: "url";
19
+ b64_json: "b64_json";
20
+ }>>;
21
+ user: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strict>;
23
+ /**
24
+ * A union per element rather than two optional fields: the endpoint returns a
25
+ * URL or inline base64 and never both.
26
+ */
27
+ export declare const imageGenerationsSchema: z.ZodObject<{
28
+ created: z.ZodNumber;
29
+ data: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
30
+ url: z.ZodString;
31
+ }, z.core.$strict>, z.ZodObject<{
32
+ b64_json: z.ZodString;
33
+ }, z.core.$strict>]>>;
34
+ }, z.core.$strict>;
35
+ export type ImageGenerationsRequest = z.infer<typeof imageGenerationsRequestSchema>;
36
+ export type ImageGenerations = z.infer<typeof imageGenerationsSchema>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `POST /v1/images/generations` — text to image, in OpenAI's shapes.
3
+ *
4
+ * Moved from the Oxy edge (`packages/api/src/schemas/inferenceEdge.schemas.ts`)
5
+ * by Kaana ADR 0002, unchanged. `size` and `quality` are forwarded and do not
6
+ * widen the hold: each size/quality class is its own model reference in the
7
+ * catalogue, because a price prices a unit, not a `(unit, size, quality)` tuple.
8
+ */
9
+ import { z } from 'zod';
10
+ import { modelReferenceSchema } from './identifiers.js';
11
+ export const imageGenerationsRequestSchema = z
12
+ .object({
13
+ model: modelReferenceSchema,
14
+ prompt: z.string().min(1).max(32_000),
15
+ /** OpenAI caps this at 10. Exact, declared, and the whole ceiling. */
16
+ n: z.number().int().min(1).max(10).optional(),
17
+ size: z.string().min(1).max(32).optional(),
18
+ quality: z.string().min(1).max(32).optional(),
19
+ style: z.string().min(1).max(32).optional(),
20
+ response_format: z.enum(['url', 'b64_json']).optional(),
21
+ user: z.string().min(1).max(64).optional(),
22
+ })
23
+ .strict();
24
+ /**
25
+ * A union per element rather than two optional fields: the endpoint returns a
26
+ * URL or inline base64 and never both.
27
+ */
28
+ export const imageGenerationsSchema = z
29
+ .object({
30
+ created: z.number().int().nonnegative(),
31
+ data: z.array(z.union([
32
+ z.object({ url: z.string().min(1) }).strict(),
33
+ z.object({ b64_json: z.string().min(1) }).strict(),
34
+ ])),
35
+ })
36
+ .strict();
@@ -0,0 +1,297 @@
1
+ /**
2
+ * Messages, content parts, tools and generation controls shared by every
3
+ * public request and by the signed envelope.
4
+ *
5
+ * Moved from `@oxy.so/contracts` 4.12.0 (`src/inference/request.ts`) by Kaana ADR 0002.
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * Where binary or remote content comes from.
10
+ *
11
+ * `url` is fetched by the data plane; `inline` carries base64 the customer sent
12
+ * with the request. Both are transient: neither is persisted by default, and
13
+ * neither appears in a receipt, a log line or a telemetry event.
14
+ */
15
+ export declare const inferenceContentSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
+ kind: z.ZodLiteral<"url">;
17
+ url: z.ZodString;
18
+ }, z.core.$strict>, z.ZodObject<{
19
+ kind: z.ZodLiteral<"inline">;
20
+ mediaType: z.ZodString;
21
+ data: z.ZodString;
22
+ }, z.core.$strict>], "kind">;
23
+ /**
24
+ * One part of a message's content. A message is always a list of parts.
25
+ *
26
+ * ## `refusal` is a member and `reasoning` is not, and the asymmetry is the point
27
+ *
28
+ * A model that DECLINES says why, and those words are meant for the customer:
29
+ * they are the difference between "rephrase this" and "stop asking". Before this
30
+ * member existed there was nowhere in an {@link InferenceMessage} to put them, so
31
+ * a non-streaming fold kept `finishReason: 'refusal'` and dropped the sentence —
32
+ * the customer learned they were refused and not why, while a streaming caller of
33
+ * the same request got the whole explanation on the `refusal` delta channel.
34
+ *
35
+ * Reasoning is the opposite case and stays absent. It is the model's private
36
+ * working, and a `text` part is where somebody would put it — which renders
37
+ * private reasoning to the customer AS the answer, the product bug the delta
38
+ * channels exist to prevent. An opaque per-block reasoning blob crossing this
39
+ * boundary needs a home nobody has chosen yet, and inventing one here would
40
+ * choose it by accident.
41
+ *
42
+ * Both public dialects can carry a refusal, which is what separates the two
43
+ * cases at the boundary as well as in principle: `refusal` is OpenAI's OWN field
44
+ * in both of its shapes (`delta.refusal` streaming, `message.refusal`
45
+ * non-streaming), while reasoning has no OpenAI field at all — the
46
+ * `reasoning_content`/`reasoning` spellings an OpenAI-compatible provider emits
47
+ * are provider extensions. So carrying the refusal costs no dialect its
48
+ * standard-client parseability, and carrying reasoning would.
49
+ *
50
+ * The part is a MEMBER rather than a field because a refusal need not have text:
51
+ * an Anthropic `stop_reason: "refusal"` maps to the finish reason and separates
52
+ * no words from the answer, while an OpenAI-compatible `refusal` does. A required
53
+ * field would force the first provider to invent a sentence.
54
+ */
55
+ export declare const inferenceContentPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
56
+ type: z.ZodLiteral<"text">;
57
+ text: z.ZodString;
58
+ }, z.core.$strict>, z.ZodObject<{
59
+ type: z.ZodLiteral<"image">;
60
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
61
+ kind: z.ZodLiteral<"url">;
62
+ url: z.ZodString;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ kind: z.ZodLiteral<"inline">;
65
+ mediaType: z.ZodString;
66
+ data: z.ZodString;
67
+ }, z.core.$strict>], "kind">;
68
+ detail: z.ZodOptional<z.ZodEnum<{
69
+ low: "low";
70
+ high: "high";
71
+ auto: "auto";
72
+ }>>;
73
+ }, z.core.$strict>, z.ZodObject<{
74
+ type: z.ZodLiteral<"audio">;
75
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
76
+ kind: z.ZodLiteral<"url">;
77
+ url: z.ZodString;
78
+ }, z.core.$strict>, z.ZodObject<{
79
+ kind: z.ZodLiteral<"inline">;
80
+ mediaType: z.ZodString;
81
+ data: z.ZodString;
82
+ }, z.core.$strict>], "kind">;
83
+ }, z.core.$strict>, z.ZodObject<{
84
+ type: z.ZodLiteral<"file">;
85
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
86
+ kind: z.ZodLiteral<"url">;
87
+ url: z.ZodString;
88
+ }, z.core.$strict>, z.ZodObject<{
89
+ kind: z.ZodLiteral<"inline">;
90
+ mediaType: z.ZodString;
91
+ data: z.ZodString;
92
+ }, z.core.$strict>], "kind">;
93
+ filename: z.ZodOptional<z.ZodString>;
94
+ }, z.core.$strict>, z.ZodObject<{
95
+ type: z.ZodLiteral<"refusal">;
96
+ text: z.ZodString;
97
+ }, z.core.$strict>], "type">;
98
+ /**
99
+ * A tool call an assistant made, in the normalized form.
100
+ *
101
+ * `arguments` is the JSON TEXT the model emitted, not a parsed object: models
102
+ * emit invalid JSON often enough that parsing it here would turn a recoverable
103
+ * model mistake into a rejected message.
104
+ */
105
+ export declare const inferenceToolCallSchema: z.ZodObject<{
106
+ id: z.ZodString;
107
+ name: z.ZodString;
108
+ arguments: z.ZodString;
109
+ }, z.core.$strict>;
110
+ export declare const inferenceMessageRoleSchema: z.ZodEnum<{
111
+ user: "user";
112
+ system: "system";
113
+ developer: "developer";
114
+ assistant: "assistant";
115
+ tool: "tool";
116
+ }>;
117
+ /**
118
+ * One normalized message.
119
+ *
120
+ * The role-specific fields are refined rather than modelled as a discriminated
121
+ * union so the shape stays the one a caller recognises from the OpenAI-style
122
+ * dialects; the refinement is what stops `toolCallId` from riding on a user
123
+ * message, where every provider would silently ignore it.
124
+ */
125
+ export declare const inferenceMessageSchema: z.ZodObject<{
126
+ role: z.ZodEnum<{
127
+ user: "user";
128
+ system: "system";
129
+ developer: "developer";
130
+ assistant: "assistant";
131
+ tool: "tool";
132
+ }>;
133
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
134
+ type: z.ZodLiteral<"text">;
135
+ text: z.ZodString;
136
+ }, z.core.$strict>, z.ZodObject<{
137
+ type: z.ZodLiteral<"image">;
138
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
139
+ kind: z.ZodLiteral<"url">;
140
+ url: z.ZodString;
141
+ }, z.core.$strict>, z.ZodObject<{
142
+ kind: z.ZodLiteral<"inline">;
143
+ mediaType: z.ZodString;
144
+ data: z.ZodString;
145
+ }, z.core.$strict>], "kind">;
146
+ detail: z.ZodOptional<z.ZodEnum<{
147
+ low: "low";
148
+ high: "high";
149
+ auto: "auto";
150
+ }>>;
151
+ }, z.core.$strict>, z.ZodObject<{
152
+ type: z.ZodLiteral<"audio">;
153
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
154
+ kind: z.ZodLiteral<"url">;
155
+ url: z.ZodString;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ kind: z.ZodLiteral<"inline">;
158
+ mediaType: z.ZodString;
159
+ data: z.ZodString;
160
+ }, z.core.$strict>], "kind">;
161
+ }, z.core.$strict>, z.ZodObject<{
162
+ type: z.ZodLiteral<"file">;
163
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
164
+ kind: z.ZodLiteral<"url">;
165
+ url: z.ZodString;
166
+ }, z.core.$strict>, z.ZodObject<{
167
+ kind: z.ZodLiteral<"inline">;
168
+ mediaType: z.ZodString;
169
+ data: z.ZodString;
170
+ }, z.core.$strict>], "kind">;
171
+ filename: z.ZodOptional<z.ZodString>;
172
+ }, z.core.$strict>, z.ZodObject<{
173
+ type: z.ZodLiteral<"refusal">;
174
+ text: z.ZodString;
175
+ }, z.core.$strict>], "type">>;
176
+ name: z.ZodOptional<z.ZodString>;
177
+ toolCallId: z.ZodOptional<z.ZodString>;
178
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
179
+ id: z.ZodString;
180
+ name: z.ZodString;
181
+ arguments: z.ZodString;
182
+ }, z.core.$strict>>>;
183
+ }, z.core.$strict>;
184
+ /** Sampling parameters, all optional: absent means the route's own default. */
185
+ export declare const samplingParametersSchema: z.ZodObject<{
186
+ temperature: z.ZodOptional<z.ZodNumber>;
187
+ topP: z.ZodOptional<z.ZodNumber>;
188
+ topK: z.ZodOptional<z.ZodNumber>;
189
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
190
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
191
+ seed: z.ZodOptional<z.ZodNumber>;
192
+ stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
193
+ }, z.core.$strict>;
194
+ /**
195
+ * A tool the model may call. `parameters` is a JSON Schema document, carried
196
+ * as an opaque object: validating the customer's JSON Schema against a meta
197
+ * schema here would reject documents providers accept.
198
+ */
199
+ export declare const toolDefinitionSchema: z.ZodObject<{
200
+ type: z.ZodLiteral<"function">;
201
+ name: z.ZodString;
202
+ description: z.ZodOptional<z.ZodString>;
203
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
204
+ strict: z.ZodOptional<z.ZodBoolean>;
205
+ }, z.core.$strict>;
206
+ /** Whether, and which, tool the model must call. */
207
+ export declare const toolChoiceSchema: z.ZodUnion<readonly [z.ZodEnum<{
208
+ auto: "auto";
209
+ none: "none";
210
+ required: "required";
211
+ }>, z.ZodObject<{
212
+ type: z.ZodLiteral<"function">;
213
+ name: z.ZodString;
214
+ }, z.core.$strict>]>;
215
+ /** Structured-output request: free text, any JSON object, or a named schema. */
216
+ export declare const responseFormatSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
217
+ type: z.ZodLiteral<"text">;
218
+ }, z.core.$strict>, z.ZodObject<{
219
+ type: z.ZodLiteral<"json_object">;
220
+ }, z.core.$strict>, z.ZodObject<{
221
+ type: z.ZodLiteral<"json_schema">;
222
+ name: z.ZodString;
223
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
224
+ strict: z.ZodBoolean;
225
+ }, z.core.$strict>], "type">;
226
+ /**
227
+ * The caller's reasoning control. Strict, like every leaf: a provider-specific
228
+ * knob (`budget_tokens`, `summary`) is refused rather than silently dropped.
229
+ *
230
+ * Oxy forwards it only after checking the resolved model advertises the effort
231
+ * in its catalogue `reasoningEfforts`; Kaana translates it per provider.
232
+ */
233
+ export declare const inferenceReasoningSchema: z.ZodObject<{
234
+ effort: z.ZodEnum<{
235
+ low: "low";
236
+ medium: "medium";
237
+ high: "high";
238
+ }>;
239
+ }, z.core.$strict>;
240
+ /** Parameters for text-to-speech, preserved in the signed request. */
241
+ export declare const inferenceSpeechParametersSchema: z.ZodObject<{
242
+ voice: z.ZodString;
243
+ responseFormat: z.ZodEnum<{
244
+ mp3: "mp3";
245
+ opus: "opus";
246
+ aac: "aac";
247
+ flac: "flac";
248
+ wav: "wav";
249
+ pcm: "pcm";
250
+ }>;
251
+ speed: z.ZodOptional<z.ZodNumber>;
252
+ }, z.core.$strict>;
253
+ /**
254
+ * Spoken output from a CONVERSATIONAL model (contract set 3.2.0) — an audio chat
255
+ * model answering in its own voice, as opposed to `speech`, which reads given
256
+ * text aloud. Presence is the request: a chat request carrying this asks for
257
+ * the answer as audio AND its transcript, which is the only combination the
258
+ * audio chat models produce (OpenAI's `modalities: ["text", "audio"]`).
259
+ *
260
+ * The audio streams as `audio` events and the words as `delta` events on the
261
+ * `output_audio_transcript` channel — never as `output_text`, because a
262
+ * transcript of speech the customer is already hearing is not a second answer.
263
+ * `pcm` is the only format an audio chat model can STREAM; the refinement on the
264
+ * envelope holds that rather than leaving a provider to refuse it mid-flight.
265
+ */
266
+ export declare const inferenceAudioOutputParametersSchema: z.ZodObject<{
267
+ voice: z.ZodString;
268
+ format: z.ZodEnum<{
269
+ mp3: "mp3";
270
+ opus: "opus";
271
+ flac: "flac";
272
+ wav: "wav";
273
+ pcm: "pcm";
274
+ }>;
275
+ }, z.core.$strict>;
276
+ /**
277
+ * Customer-supplied cost-attribution labels, echoed on the generation record.
278
+ *
279
+ * Bounded in both directions because they are stored and read back: sixteen
280
+ * keys is a team/feature/environment tag set, not a place to smuggle a payload.
281
+ *
282
+ * Moved from the Oxy edge (`packages/api/src/schemas/inferenceEdge.schemas.ts`).
283
+ */
284
+ export declare const requestLabelsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
285
+ export type InferenceSpeechParameters = z.infer<typeof inferenceSpeechParametersSchema>;
286
+ export type InferenceAudioOutputParameters = z.infer<typeof inferenceAudioOutputParametersSchema>;
287
+ export type InferenceContentSource = z.infer<typeof inferenceContentSourceSchema>;
288
+ export type InferenceContentPart = z.infer<typeof inferenceContentPartSchema>;
289
+ export type InferenceToolCall = z.infer<typeof inferenceToolCallSchema>;
290
+ export type InferenceMessageRole = z.infer<typeof inferenceMessageRoleSchema>;
291
+ export type InferenceMessage = z.infer<typeof inferenceMessageSchema>;
292
+ export type SamplingParameters = z.infer<typeof samplingParametersSchema>;
293
+ export type InferenceReasoning = z.infer<typeof inferenceReasoningSchema>;
294
+ export type ToolDefinition = z.infer<typeof toolDefinitionSchema>;
295
+ export type ToolChoice = z.infer<typeof toolChoiceSchema>;
296
+ export type ResponseFormat = z.infer<typeof responseFormatSchema>;
297
+ export type RequestLabels = z.infer<typeof requestLabelsSchema>;