@oxyhq/contracts 0.26.0 → 0.27.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 (46) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/accountGraph.js +4 -3
  3. package/dist/cjs/index.js +143 -1
  4. package/dist/cjs/inference/attribution.js +101 -0
  5. package/dist/cjs/inference/catalogue.js +482 -0
  6. package/dist/cjs/inference/errors.js +195 -0
  7. package/dist/cjs/inference/identifiers.js +189 -0
  8. package/dist/cjs/inference/money.js +145 -0
  9. package/dist/cjs/inference/priceVersion.js +110 -0
  10. package/dist/cjs/inference/providerConnection.js +142 -0
  11. package/dist/cjs/inference/request.js +288 -0
  12. package/dist/cjs/inference/routingPolicy.js +213 -0
  13. package/dist/cjs/inference/streamEvents.js +219 -0
  14. package/dist/cjs/inference/usage.js +291 -0
  15. package/dist/cjs/inference/version.js +57 -0
  16. package/dist/esm/.tsbuildinfo +1 -1
  17. package/dist/esm/accountGraph.js +4 -3
  18. package/dist/esm/index.js +45 -0
  19. package/dist/esm/inference/attribution.js +98 -0
  20. package/dist/esm/inference/catalogue.js +479 -0
  21. package/dist/esm/inference/errors.js +192 -0
  22. package/dist/esm/inference/identifiers.js +186 -0
  23. package/dist/esm/inference/money.js +142 -0
  24. package/dist/esm/inference/priceVersion.js +107 -0
  25. package/dist/esm/inference/providerConnection.js +139 -0
  26. package/dist/esm/inference/request.js +285 -0
  27. package/dist/esm/inference/routingPolicy.js +210 -0
  28. package/dist/esm/inference/streamEvents.js +216 -0
  29. package/dist/esm/inference/usage.js +288 -0
  30. package/dist/esm/inference/version.js +54 -0
  31. package/dist/types/.tsbuildinfo +1 -1
  32. package/dist/types/accountGraph.d.ts +6 -5
  33. package/dist/types/index.d.ts +23 -0
  34. package/dist/types/inference/attribution.d.ts +171 -0
  35. package/dist/types/inference/catalogue.d.ts +1612 -0
  36. package/dist/types/inference/errors.d.ts +193 -0
  37. package/dist/types/inference/identifiers.d.ts +149 -0
  38. package/dist/types/inference/money.d.ts +142 -0
  39. package/dist/types/inference/priceVersion.d.ts +182 -0
  40. package/dist/types/inference/providerConnection.d.ts +297 -0
  41. package/dist/types/inference/request.d.ts +2364 -0
  42. package/dist/types/inference/routingPolicy.d.ts +426 -0
  43. package/dist/types/inference/streamEvents.d.ts +906 -0
  44. package/dist/types/inference/usage.d.ts +1133 -0
  45. package/dist/types/inference/version.d.ts +54 -0
  46. package/package.json +1 -1
@@ -0,0 +1,54 @@
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
+ * Decided in: docs/adr/0006-oxy-relay-boundary.md, docs/adr/0010-public-api-compatibility.md.
38
+ */
39
+ /**
40
+ * Version of the contract SET as a whole — the value the control plane and the
41
+ * data plane exchange in a startup/health handshake to establish that they were built against
42
+ * compatible definitions before a single inference request is served.
43
+ *
44
+ * MAJOR is bumped when any individual shape's `schemaVersion` increments (at
45
+ * least one message is now read differently by the two sides); MINOR when a
46
+ * shape or an optional field is added; PATCH for documentation-only changes
47
+ * that leave every parsed byte identical.
48
+ *
49
+ * This constant is deliberately NOT embedded in the request envelope. Pinning a
50
+ * request to the version of the whole set would make an unrelated additive
51
+ * change to, say, the catalogue reject every in-flight inference request; the
52
+ * per-shape `schemaVersion` is what a message is validated against.
53
+ */
54
+ export declare const INFERENCE_CONTRACT_VERSION = "1.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/contracts",
3
- "version": "0.26.0",
3
+ "version": "0.27.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",