@oxyhq/contracts 0.30.0 → 0.31.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.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * The credential itself is NOT here and cannot be put here. This shape carries
6
6
  * a locator (`secretRef`) into Vault/KMS/managed secret storage, a prefix short
7
- * enough to be useless, a fingerprint, and validation state. Two mechanisms
7
+ * enough to be useless, a fingerprint, and validation state. Three mechanisms
8
8
  * make that structural rather than a convention somebody must remember:
9
9
  *
10
10
  * - The object is `.strict()`. A producer that attaches `apiKey`, `secret`,
@@ -14,6 +14,10 @@
14
14
  * - `keyPrefix` is capped at 12 characters — shorter than any provider's
15
15
  * usable credential — so the one field designed to show part of a key cannot
16
16
  * be widened into showing all of it without changing the contract.
17
+ * - `secretRef` is DERIVED, not free text: the grammar is closed and the
18
+ * refinement below requires it to be this connection's own environment,
19
+ * owner account and id under one namespace. A field with no free span is a
20
+ * field a credential cannot be smuggled through.
17
21
  *
18
22
  * BYOK does not move the billing relationship: the upstream provider bills the
19
23
  * customer's own account directly, and Oxy charges only its platform fee. The
@@ -64,12 +68,37 @@ export declare const providerConnectionScopeSchema: z.ZodDiscriminatedUnion<"kin
64
68
  accountId: string;
65
69
  applicationId: string;
66
70
  }>]>;
71
+ /**
72
+ * The namespace every Oxy BYOK locator lives under, whichever store holds it.
73
+ *
74
+ * Part of the grammar rather than an implementation detail of the writer: it is
75
+ * the prefix a store-side IAM or Vault policy is scoped to, so a locator outside
76
+ * it is one Oxy's own credentials could not resolve anyway.
77
+ */
78
+ export declare const PROVIDER_SECRET_REFERENCE_NAMESPACE = "oxy/inference/byok";
67
79
  /**
68
80
  * A locator for the credential in managed secret storage — never the credential.
69
81
  *
70
- * The scheme prefix is constrained to the stores Oxy actually uses, so a
71
- * producer cannot pass a raw key through this field and have it look like a
72
- * reference; whitespace is excluded for the same reason.
82
+ * The grammar is CLOSED, and that is the whole of its value: a store from a
83
+ * four-name set, one fixed namespace, an environment from a three-name set, and
84
+ * two bounded id segments. Nothing may precede, follow or be interpolated
85
+ * between them, so there is no free-form span for credential material to occupy:
86
+ * the only places anything a producer chooses can sit are the two ids, and
87
+ * `providerConnectionSchema` below pins those to THIS connection's own owner
88
+ * account and id.
89
+ *
90
+ * ## It was not always closed, and the difference was measured
91
+ *
92
+ * The previous grammar was `<store>:<anything from a wide charset>`, under a
93
+ * comment claiming that meant "a producer cannot pass a raw key through this
94
+ * field and have it look like a reference". It did not. Splicing a credential in
95
+ * after the store name —
96
+ * `vault:sk-ant-api03-…/oxy/inference/byok/production/<account>/<id>` — satisfied
97
+ * that regex, satisfied the storage partition CHECK (which pins the END of the
98
+ * string and said nothing about its start), and parsed cleanly. Both mechanisms
99
+ * constrained the SHAPE of the locator; neither constrained what could be put in
100
+ * front of it. `packages/api`'s `providerSecretLeak.test.ts` plants exactly that
101
+ * value, and it is now refused here, by the CHECK, and by the refinement below.
73
102
  */
74
103
  export declare const providerSecretReferenceSchema: z.ZodString;
75
104
  /** Why a credential check failed, as a closed set the Console can render. */
@@ -99,4 +99,4 @@
99
99
  * change to, say, the catalogue reject every in-flight inference request; the
100
100
  * per-shape `schemaVersion` is what a message is validated against.
101
101
  */
102
- export declare const INFERENCE_CONTRACT_VERSION = "1.2.0";
102
+ export declare const INFERENCE_CONTRACT_VERSION = "1.3.0";
@@ -115,18 +115,22 @@ export declare const assetUploadTicketSchema: z.ZodObject<{
115
115
  * carries the long immutable cache header (assets are content-addressed).
116
116
  */
117
117
  cacheControl: z.ZodString;
118
+ /** Base64 SHA-256 value required in the presigned PUT's checksum header. */
119
+ checksumSHA256: z.ZodString;
118
120
  }, "strip", z.ZodTypeAny, {
119
121
  sha256: string;
120
122
  contentType: string;
121
123
  uploadUrl: string;
122
124
  storageKey: string;
123
125
  cacheControl: string;
126
+ checksumSHA256: string;
124
127
  }, {
125
128
  sha256: string;
126
129
  contentType: string;
127
130
  uploadUrl: string;
128
131
  storageKey: string;
129
132
  cacheControl: string;
133
+ checksumSHA256: string;
130
134
  }>;
131
135
  export type AssetUploadTicket = z.infer<typeof assetUploadTicketSchema>;
132
136
  /**
@@ -149,18 +153,22 @@ export declare const assetInitResponseSchema: z.ZodObject<{
149
153
  * carries the long immutable cache header (assets are content-addressed).
150
154
  */
151
155
  cacheControl: z.ZodString;
156
+ /** Base64 SHA-256 value required in the presigned PUT's checksum header. */
157
+ checksumSHA256: z.ZodString;
152
158
  }, "strip", z.ZodTypeAny, {
153
159
  sha256: string;
154
160
  contentType: string;
155
161
  uploadUrl: string;
156
162
  storageKey: string;
157
163
  cacheControl: string;
164
+ checksumSHA256: string;
158
165
  }, {
159
166
  sha256: string;
160
167
  contentType: string;
161
168
  uploadUrl: string;
162
169
  storageKey: string;
163
170
  cacheControl: string;
171
+ checksumSHA256: string;
164
172
  }>, "many">;
165
173
  existing: z.ZodArray<z.ZodString, "many">;
166
174
  }, "strip", z.ZodTypeAny, {
@@ -170,6 +178,7 @@ export declare const assetInitResponseSchema: z.ZodObject<{
170
178
  uploadUrl: string;
171
179
  storageKey: string;
172
180
  cacheControl: string;
181
+ checksumSHA256: string;
173
182
  }[];
174
183
  existing: string[];
175
184
  }, {
@@ -179,6 +188,7 @@ export declare const assetInitResponseSchema: z.ZodObject<{
179
188
  uploadUrl: string;
180
189
  storageKey: string;
181
190
  cacheControl: string;
191
+ checksumSHA256: string;
182
192
  }[];
183
193
  existing: string[];
184
194
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/contracts",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",