@kaana.ai/contracts 0.0.0-stage → 4.3.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 +1030 -0
  10. package/dist/internal/catalogue.js +349 -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 +696 -0
  22. package/dist/internal/grant.js +437 -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 +177 -0
  76. package/dist/public/version.js +177 -0
  77. package/openapi.json +6967 -0
  78. package/package.json +44 -4
  79. package/README.md +0 -3
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Version rule for the Oxy↔data-plane inference contracts.
3
+ *
4
+ * Oxy is the control plane; the inference data plane is a separate service.
5
+ * They are deployed independently, in different repositories, possibly in
6
+ * different languages.
7
+ * Every shape they exchange therefore carries its version IN THE PARSED DATA,
8
+ * never as a comment or an out-of-band assumption, so a producer running ahead
9
+ * of a consumer fails loudly at the parse instead of being silently reinterpreted.
10
+ *
11
+ * The rule, enforced by `src/__tests__/inference.compatibility.test.ts`:
12
+ *
13
+ * - A schema carries `schemaVersion: z.literal(<n>)` **if and only if** it can
14
+ * appear on the wire as a whole message — a request envelope, a stream event,
15
+ * a catalogue descriptor, a ledger record, an error body.
16
+ * - A schema that only ever appears EMBEDDED inside such a message (the
17
+ * attribution block, one message part, one usage quantity, a data-retention
18
+ * policy) carries no version of its own: it inherits the version of the
19
+ * envelope it rides in. Versioning it separately would create two versions
20
+ * that can disagree about one byte stream.
21
+ * - A shape that is BOTH — `inferenceErrorSchema` is returned as an HTTP body
22
+ * and also rides inside the stream's error event — keeps its own version.
23
+ * The envelope's version then governs the envelope and the payload's governs
24
+ * the payload, which is two versions of two things rather than two versions
25
+ * of one.
26
+ * - Every exported object schema in `src/inference/` must fall into exactly one
27
+ * of those groups. The compatibility test holds both lists as exact
28
+ * equalities, so a new shape that is in neither fails the build rather than
29
+ * quietly shipping unversioned.
30
+ *
31
+ * A shape's own version is bumped when its meaning changes in a way a consumer
32
+ * pinned to the previous version would misread — a field removed, a field's
33
+ * units changed, a closed enum's member given a new meaning. Adding an OPTIONAL
34
+ * field is additive and does not bump it, because a consumer on the previous
35
+ * version parses the message correctly and simply does not read the new field.
36
+ *
37
+ * ## Which shapes reject an unknown field
38
+ *
39
+ * That last rule is why the shapes EXCHANGED WITH THE DATA PLANE are not
40
+ * `.strict()` at their top level — the request envelope, the four usage records,
41
+ * the stream events, the error body, the catalogue descriptors, the price
42
+ * version. The split is a decision rather than an omission: `.strict()` and
43
+ * "adding an optional field is additive" cannot both hold on one shape, because
44
+ * a producer one minor version ahead would have its whole message REFUSED
45
+ * rather than its new field ignored. For a usage report that means a request
46
+ * already served upstream can never be settled and Oxy absorbs its cost, which
47
+ * is a worse failure than the one strictness would have caught.
48
+ *
49
+ * Their LEAVES are strict, and that is where the protection lives: a stripped
50
+ * field is the worse outcome exactly where it would be a leak or a second
51
+ * source of truth, because it disappears at this parse and survives in the
52
+ * producer, which is where somebody eventually reads it. So
53
+ * `clientRequestMetadataSchema` (no IP, ever), `moneySchema` (no convenience
54
+ * float beside the exact decimal), `providerErrorPassthroughSchema` (no
55
+ * upstream request or headers beside the message), `usageQuantitySchema` and
56
+ * `unitPriceSchema` all refuse an unknown field, while the envelope carrying
57
+ * them tolerates an additive one.
58
+ *
59
+ * A shape Oxy does NOT exchange with the data plane is strict at its top level
60
+ * too, since nothing there can run ahead of this package:
61
+ * `providerConnectionSchema`, where an unknown field is how a BYOK credential
62
+ * escapes, and the billing and entitlement records, where one is a second
63
+ * number beside an exact amount.
64
+ *
65
+ * A SIGNED document is strict at its top level for a third reason, and there it
66
+ * is forced rather than chosen. `aliaModelReleaseManifestSchema` carries
67
+ * signatures over its own canonical bytes, so a field stripped at this parse is a
68
+ * field missing from the bytes a verifier re-canonicalizes: a tolerant parse
69
+ * would report an invalid SIGNATURE where the truth is that this build does not
70
+ * understand the DOCUMENT. Its producer can run ahead of this package — Alia's
71
+ * release tooling is deployed independently — so the usual argument applies here
72
+ * and is outweighed, because the refusal costs an operator one retry after Oxy
73
+ * takes the newer contract, while the tolerant parse costs a misdiagnosis of a
74
+ * cryptographic failure.
75
+ *
76
+ * Decided in: Oxy docs/adr/0006-oxy-kaana-boundary.md,
77
+ * docs/adr/0010-public-api-compatibility.md,
78
+ * docs/adr/0017-authorized-routes-in-the-envelope.md; moved from
79
+ * `@oxy.so/contracts` 4.12.0 (`src/inference/version.ts`) by Kaana ADR 0002.
80
+ */
81
+ /**
82
+ * Version of the contract SET as a whole — the value the control plane and the
83
+ * data plane exchange in a startup/health handshake to establish that they were built against
84
+ * compatible definitions before a single inference request is served.
85
+ *
86
+ * MAJOR is bumped when any individual shape's `schemaVersion` increments (at
87
+ * least one message is now read differently by the two sides); MINOR when a
88
+ * shape or an optional field is added, when a CLOSED ENUM gains a member, or
89
+ * when a refinement changes which bytes parse; PATCH for documentation-only
90
+ * changes that leave every parsed byte identical.
91
+ *
92
+ * The last two are MINOR rather than PATCH because both produce the same
93
+ * failure: a producer on the newer set emits something the older set refuses,
94
+ * with no `schemaVersion` difference to explain it. A new enum member and a
95
+ * loosened refinement are exactly what the handshake exists to surface — a
96
+ * skew the per-message version cannot express.
97
+ *
98
+ * This constant is deliberately NOT embedded in the request envelope. Pinning a
99
+ * request to the version of the whole set would make an unrelated additive
100
+ * change to, say, the catalogue reject every in-flight inference request; the
101
+ * per-shape `schemaVersion` is what a message is validated against.
102
+ */
103
+ export declare const INFERENCE_CONTRACT_VERSION = "4.3.0";
104
+ /**
105
+ * Contract set 4.0.0 (Kaana ADR 0002) is the first published as
106
+ * `@kaana.ai/contracts`. MAJOR because the set changed hands and split in two:
107
+ * the public `https://kaana.ai/v1` shapes at the package root, and the
108
+ * Oxy↔Kaana shapes under `@kaana.ai/contracts/internal`. Against `@oxy.so/contracts`
109
+ * 4.12.0 (set 3.8.0) every moved shape parses the same bytes, with two
110
+ * deliberate exceptions: the signed envelope admits `audio_speech` with
111
+ * `stream: true`, and the economic treatment gains `platform_fee_only`.
112
+ *
113
+ * Contract set 4.1.0 (Alia ADR 0017, Kaana phase 1) is MINOR: the closed usage
114
+ * unit set gains `input_transcription_milliseconds` (input transcription
115
+ * inside a realtime conversation, billed by the deployment's transcription
116
+ * model), `capabilities.realtime` gains the optional `inputAudioTranscription`
117
+ * and `audioFormats`, and `realtimeAudioFormatSchema` moves from `realtime.ts`
118
+ * to `audioFormats.ts` with the same members. A consumer on 4.0.0 refuses a
119
+ * usage report carrying the new unit, which is why the signed-envelope lane
120
+ * keeps refusing input transcription (docs/realtime.md).
121
+ *
122
+ * Contract set 4.2.0 (Kaana ADR 0002 phase 3) is additive: the JSON form of a
123
+ * transcription upload, the transcription duration ceiling, and the response
124
+ * headers and realtime subprotocols `https://kaana.ai/v1` speaks.
125
+ *
126
+ * Contract set 4.3.0 (Kaana ADR 0002, amendment 2026-10-15) is additive: the
127
+ * internal `declaredModelSchema` and `declaredCatalogueSchema`, the catalogue
128
+ * Kaana declares (identity, licence, data policy, capabilities and the list
129
+ * price per unit), carried to Oxy as `declaredCatalogue` on the signed
130
+ * `GET /internal/v1/models`. Nothing in 4.2.0 changes.
131
+ */
132
+ /** The public API's one origin and version. */
133
+ export declare const KAANA_API_BASE_URL = "https://kaana.ai/v1";
134
+ /** The response header that carries the request id. */
135
+ export declare const KAANA_REQUEST_ID_HEADER = "Kaana-Request-Id";
136
+ /** The response header that carries {@link INFERENCE_CONTRACT_VERSION}. */
137
+ export declare const KAANA_CONTRACT_VERSION_HEADER = "Kaana-Contract-Version";
138
+ /**
139
+ * The response header that names the revision that actually served a request
140
+ * whose body is not JSON (`POST /v1/audio/speech` without SSE), e.g.
141
+ * `elevenlabs/eleven-multilingual@v2`.
142
+ */
143
+ export declare const KAANA_MODEL_HEADER = "Kaana-Model";
144
+ /**
145
+ * The response header that carries the usage of a request whose body is not
146
+ * JSON (`POST /v1/audio/speech` without streaming): `unit=quantity` pairs
147
+ * joined by `,`, each unit once, e.g. `characters=12,requests=1`.
148
+ */
149
+ export declare const KAANA_USAGE_HEADER = "Kaana-Usage";
150
+ /**
151
+ * The response headers that carry the customer's routing-policy revision on
152
+ * `POST /v1/responses`, so a streamed response can be folded into a
153
+ * `Response` without a second request.
154
+ */
155
+ export declare const KAANA_ROUTING_POLICY_ID_HEADER = "Kaana-Routing-Policy-Id";
156
+ export declare const KAANA_ROUTING_POLICY_VERSION_HEADER = "Kaana-Routing-Policy-Version";
157
+ /** The request header that names the end user a service token acts for. */
158
+ export declare const KAANA_ON_BEHALF_OF_HEADER = "X-Oxy-User-Id";
159
+ /** The request header that makes a request idempotent. */
160
+ export declare const KAANA_IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
161
+ /**
162
+ * The WebSocket subprotocol of `GET /v1/realtime`. A client offers it, and the
163
+ * server selects it, on every connection.
164
+ */
165
+ export declare const KAANA_REALTIME_SUBPROTOCOL = "kaana.v1";
166
+ /**
167
+ * A runtime whose WebSocket cannot set `Authorization` (a browser, React
168
+ * Native, Node's global WebSocket) carries the credential as a second offered
169
+ * subprotocol: this prefix followed by the unpadded base64url of the
170
+ * credential's UTF-8 bytes. The server never selects it.
171
+ */
172
+ export declare const KAANA_REALTIME_BEARER_PROTOCOL_PREFIX = "kaana.bearer.";
173
+ /**
174
+ * Likewise for `X-Oxy-User-Id`: this prefix followed by the unpadded base64url
175
+ * of the user id. Honoured only with a service token, as the header is.
176
+ */
177
+ export declare const KAANA_REALTIME_USER_PROTOCOL_PREFIX = "kaana.user.";
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Version rule for the Oxy↔data-plane inference contracts.
3
+ *
4
+ * Oxy is the control plane; the inference data plane is a separate service.
5
+ * They are deployed independently, in different repositories, possibly in
6
+ * different languages.
7
+ * Every shape they exchange therefore carries its version IN THE PARSED DATA,
8
+ * never as a comment or an out-of-band assumption, so a producer running ahead
9
+ * of a consumer fails loudly at the parse instead of being silently reinterpreted.
10
+ *
11
+ * The rule, enforced by `src/__tests__/inference.compatibility.test.ts`:
12
+ *
13
+ * - A schema carries `schemaVersion: z.literal(<n>)` **if and only if** it can
14
+ * appear on the wire as a whole message — a request envelope, a stream event,
15
+ * a catalogue descriptor, a ledger record, an error body.
16
+ * - A schema that only ever appears EMBEDDED inside such a message (the
17
+ * attribution block, one message part, one usage quantity, a data-retention
18
+ * policy) carries no version of its own: it inherits the version of the
19
+ * envelope it rides in. Versioning it separately would create two versions
20
+ * that can disagree about one byte stream.
21
+ * - A shape that is BOTH — `inferenceErrorSchema` is returned as an HTTP body
22
+ * and also rides inside the stream's error event — keeps its own version.
23
+ * The envelope's version then governs the envelope and the payload's governs
24
+ * the payload, which is two versions of two things rather than two versions
25
+ * of one.
26
+ * - Every exported object schema in `src/inference/` must fall into exactly one
27
+ * of those groups. The compatibility test holds both lists as exact
28
+ * equalities, so a new shape that is in neither fails the build rather than
29
+ * quietly shipping unversioned.
30
+ *
31
+ * A shape's own version is bumped when its meaning changes in a way a consumer
32
+ * pinned to the previous version would misread — a field removed, a field's
33
+ * units changed, a closed enum's member given a new meaning. Adding an OPTIONAL
34
+ * field is additive and does not bump it, because a consumer on the previous
35
+ * version parses the message correctly and simply does not read the new field.
36
+ *
37
+ * ## Which shapes reject an unknown field
38
+ *
39
+ * That last rule is why the shapes EXCHANGED WITH THE DATA PLANE are not
40
+ * `.strict()` at their top level — the request envelope, the four usage records,
41
+ * the stream events, the error body, the catalogue descriptors, the price
42
+ * version. The split is a decision rather than an omission: `.strict()` and
43
+ * "adding an optional field is additive" cannot both hold on one shape, because
44
+ * a producer one minor version ahead would have its whole message REFUSED
45
+ * rather than its new field ignored. For a usage report that means a request
46
+ * already served upstream can never be settled and Oxy absorbs its cost, which
47
+ * is a worse failure than the one strictness would have caught.
48
+ *
49
+ * Their LEAVES are strict, and that is where the protection lives: a stripped
50
+ * field is the worse outcome exactly where it would be a leak or a second
51
+ * source of truth, because it disappears at this parse and survives in the
52
+ * producer, which is where somebody eventually reads it. So
53
+ * `clientRequestMetadataSchema` (no IP, ever), `moneySchema` (no convenience
54
+ * float beside the exact decimal), `providerErrorPassthroughSchema` (no
55
+ * upstream request or headers beside the message), `usageQuantitySchema` and
56
+ * `unitPriceSchema` all refuse an unknown field, while the envelope carrying
57
+ * them tolerates an additive one.
58
+ *
59
+ * A shape Oxy does NOT exchange with the data plane is strict at its top level
60
+ * too, since nothing there can run ahead of this package:
61
+ * `providerConnectionSchema`, where an unknown field is how a BYOK credential
62
+ * escapes, and the billing and entitlement records, where one is a second
63
+ * number beside an exact amount.
64
+ *
65
+ * A SIGNED document is strict at its top level for a third reason, and there it
66
+ * is forced rather than chosen. `aliaModelReleaseManifestSchema` carries
67
+ * signatures over its own canonical bytes, so a field stripped at this parse is a
68
+ * field missing from the bytes a verifier re-canonicalizes: a tolerant parse
69
+ * would report an invalid SIGNATURE where the truth is that this build does not
70
+ * understand the DOCUMENT. Its producer can run ahead of this package — Alia's
71
+ * release tooling is deployed independently — so the usual argument applies here
72
+ * and is outweighed, because the refusal costs an operator one retry after Oxy
73
+ * takes the newer contract, while the tolerant parse costs a misdiagnosis of a
74
+ * cryptographic failure.
75
+ *
76
+ * Decided in: Oxy docs/adr/0006-oxy-kaana-boundary.md,
77
+ * docs/adr/0010-public-api-compatibility.md,
78
+ * docs/adr/0017-authorized-routes-in-the-envelope.md; moved from
79
+ * `@oxy.so/contracts` 4.12.0 (`src/inference/version.ts`) by Kaana ADR 0002.
80
+ */
81
+ /**
82
+ * Version of the contract SET as a whole — the value the control plane and the
83
+ * data plane exchange in a startup/health handshake to establish that they were built against
84
+ * compatible definitions before a single inference request is served.
85
+ *
86
+ * MAJOR is bumped when any individual shape's `schemaVersion` increments (at
87
+ * least one message is now read differently by the two sides); MINOR when a
88
+ * shape or an optional field is added, when a CLOSED ENUM gains a member, or
89
+ * when a refinement changes which bytes parse; PATCH for documentation-only
90
+ * changes that leave every parsed byte identical.
91
+ *
92
+ * The last two are MINOR rather than PATCH because both produce the same
93
+ * failure: a producer on the newer set emits something the older set refuses,
94
+ * with no `schemaVersion` difference to explain it. A new enum member and a
95
+ * loosened refinement are exactly what the handshake exists to surface — a
96
+ * skew the per-message version cannot express.
97
+ *
98
+ * This constant is deliberately NOT embedded in the request envelope. Pinning a
99
+ * request to the version of the whole set would make an unrelated additive
100
+ * change to, say, the catalogue reject every in-flight inference request; the
101
+ * per-shape `schemaVersion` is what a message is validated against.
102
+ */
103
+ export const INFERENCE_CONTRACT_VERSION = '4.3.0';
104
+ /**
105
+ * Contract set 4.0.0 (Kaana ADR 0002) is the first published as
106
+ * `@kaana.ai/contracts`. MAJOR because the set changed hands and split in two:
107
+ * the public `https://kaana.ai/v1` shapes at the package root, and the
108
+ * Oxy↔Kaana shapes under `@kaana.ai/contracts/internal`. Against `@oxy.so/contracts`
109
+ * 4.12.0 (set 3.8.0) every moved shape parses the same bytes, with two
110
+ * deliberate exceptions: the signed envelope admits `audio_speech` with
111
+ * `stream: true`, and the economic treatment gains `platform_fee_only`.
112
+ *
113
+ * Contract set 4.1.0 (Alia ADR 0017, Kaana phase 1) is MINOR: the closed usage
114
+ * unit set gains `input_transcription_milliseconds` (input transcription
115
+ * inside a realtime conversation, billed by the deployment's transcription
116
+ * model), `capabilities.realtime` gains the optional `inputAudioTranscription`
117
+ * and `audioFormats`, and `realtimeAudioFormatSchema` moves from `realtime.ts`
118
+ * to `audioFormats.ts` with the same members. A consumer on 4.0.0 refuses a
119
+ * usage report carrying the new unit, which is why the signed-envelope lane
120
+ * keeps refusing input transcription (docs/realtime.md).
121
+ *
122
+ * Contract set 4.2.0 (Kaana ADR 0002 phase 3) is additive: the JSON form of a
123
+ * transcription upload, the transcription duration ceiling, and the response
124
+ * headers and realtime subprotocols `https://kaana.ai/v1` speaks.
125
+ *
126
+ * Contract set 4.3.0 (Kaana ADR 0002, amendment 2026-10-15) is additive: the
127
+ * internal `declaredModelSchema` and `declaredCatalogueSchema`, the catalogue
128
+ * Kaana declares (identity, licence, data policy, capabilities and the list
129
+ * price per unit), carried to Oxy as `declaredCatalogue` on the signed
130
+ * `GET /internal/v1/models`. Nothing in 4.2.0 changes.
131
+ */
132
+ /** The public API's one origin and version. */
133
+ export const KAANA_API_BASE_URL = 'https://kaana.ai/v1';
134
+ /** The response header that carries the request id. */
135
+ export const KAANA_REQUEST_ID_HEADER = 'Kaana-Request-Id';
136
+ /** The response header that carries {@link INFERENCE_CONTRACT_VERSION}. */
137
+ export const KAANA_CONTRACT_VERSION_HEADER = 'Kaana-Contract-Version';
138
+ /**
139
+ * The response header that names the revision that actually served a request
140
+ * whose body is not JSON (`POST /v1/audio/speech` without SSE), e.g.
141
+ * `elevenlabs/eleven-multilingual@v2`.
142
+ */
143
+ export const KAANA_MODEL_HEADER = 'Kaana-Model';
144
+ /**
145
+ * The response header that carries the usage of a request whose body is not
146
+ * JSON (`POST /v1/audio/speech` without streaming): `unit=quantity` pairs
147
+ * joined by `,`, each unit once, e.g. `characters=12,requests=1`.
148
+ */
149
+ export const KAANA_USAGE_HEADER = 'Kaana-Usage';
150
+ /**
151
+ * The response headers that carry the customer's routing-policy revision on
152
+ * `POST /v1/responses`, so a streamed response can be folded into a
153
+ * `Response` without a second request.
154
+ */
155
+ export const KAANA_ROUTING_POLICY_ID_HEADER = 'Kaana-Routing-Policy-Id';
156
+ export const KAANA_ROUTING_POLICY_VERSION_HEADER = 'Kaana-Routing-Policy-Version';
157
+ /** The request header that names the end user a service token acts for. */
158
+ export const KAANA_ON_BEHALF_OF_HEADER = 'X-Oxy-User-Id';
159
+ /** The request header that makes a request idempotent. */
160
+ export const KAANA_IDEMPOTENCY_KEY_HEADER = 'Idempotency-Key';
161
+ /**
162
+ * The WebSocket subprotocol of `GET /v1/realtime`. A client offers it, and the
163
+ * server selects it, on every connection.
164
+ */
165
+ export const KAANA_REALTIME_SUBPROTOCOL = 'kaana.v1';
166
+ /**
167
+ * A runtime whose WebSocket cannot set `Authorization` (a browser, React
168
+ * Native, Node's global WebSocket) carries the credential as a second offered
169
+ * subprotocol: this prefix followed by the unpadded base64url of the
170
+ * credential's UTF-8 bytes. The server never selects it.
171
+ */
172
+ export const KAANA_REALTIME_BEARER_PROTOCOL_PREFIX = 'kaana.bearer.';
173
+ /**
174
+ * Likewise for `X-Oxy-User-Id`: this prefix followed by the unpadded base64url
175
+ * of the user id. Honoured only with a service token, as the header is.
176
+ */
177
+ export const KAANA_REALTIME_USER_PROTOCOL_PREFIX = 'kaana.user.';