@mochabug/adapt-sdk 0.4.3 → 0.4.5

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 (47) hide show
  1. package/dist/anthropic/anthropic-roundtrip.test.d.ts +2 -0
  2. package/dist/anthropic/anthropic-roundtrip.test.d.ts.map +1 -0
  3. package/dist/anthropic/anthropic.test.d.ts +2 -0
  4. package/dist/anthropic/anthropic.test.d.ts.map +1 -0
  5. package/dist/anthropic/index.d.ts +3 -70
  6. package/dist/anthropic/index.d.ts.map +1 -1
  7. package/dist/api/api.spec.d.ts +2 -0
  8. package/dist/api/api.spec.d.ts.map +1 -0
  9. package/dist/api/signal-api.spec.d.ts +17 -0
  10. package/dist/api/signal-api.spec.d.ts.map +1 -0
  11. package/dist/cel/cel.test.d.ts +2 -0
  12. package/dist/cel/cel.test.d.ts.map +1 -0
  13. package/dist/cjs/anthropic.cjs +1 -1
  14. package/dist/cjs/anthropic.cjs.map +4 -4
  15. package/dist/cjs/gemini.cjs +1 -1
  16. package/dist/cjs/gemini.cjs.map +4 -4
  17. package/dist/cjs/openai.cjs +1 -1
  18. package/dist/cjs/openai.cjs.map +4 -4
  19. package/dist/esm/anthropic.mjs +1 -1
  20. package/dist/esm/anthropic.mjs.map +4 -4
  21. package/dist/esm/gemini.mjs +1 -1
  22. package/dist/esm/gemini.mjs.map +4 -4
  23. package/dist/esm/openai.mjs +1 -1
  24. package/dist/esm/openai.mjs.map +4 -4
  25. package/dist/gemini/gemini-roundtrip.test.d.ts +2 -0
  26. package/dist/gemini/gemini-roundtrip.test.d.ts.map +1 -0
  27. package/dist/gemini/gemini.test.d.ts +2 -0
  28. package/dist/gemini/gemini.test.d.ts.map +1 -0
  29. package/dist/gemini/index.d.ts +2 -69
  30. package/dist/gemini/index.d.ts.map +1 -1
  31. package/dist/multi-format-regression.test.d.ts +2 -0
  32. package/dist/multi-format-regression.test.d.ts.map +1 -0
  33. package/dist/openai/index.d.ts +3 -76
  34. package/dist/openai/index.d.ts.map +1 -1
  35. package/dist/openai/openai-roundtrip.test.d.ts +2 -0
  36. package/dist/openai/openai-roundtrip.test.d.ts.map +1 -0
  37. package/dist/openai/openai.test.d.ts +2 -0
  38. package/dist/openai/openai.test.d.ts.map +1 -0
  39. package/dist/router/router.spec.d.ts +2 -0
  40. package/dist/router/router.spec.d.ts.map +1 -0
  41. package/dist/schema-utils.d.ts +80 -0
  42. package/dist/schema-utils.d.ts.map +1 -0
  43. package/dist/schema-utils.test.d.ts +2 -0
  44. package/dist/schema-utils.test.d.ts.map +1 -0
  45. package/dist/signals/signals.test.d.ts +2 -0
  46. package/dist/signals/signals.test.d.ts.map +1 -0
  47. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import type { JTDSchemaJson, SignalDescriptorJson } from '../api';
2
+ import { type ConvertSuccessJson, type ConvertSuccessBinary, type ConvertSuccessSignals, type ConvertFailure, type ConvertSuccess } from '../schema-utils';
2
3
  /**
3
4
  * JSON Schema subset accepted by the Gemini structured-output API.
4
5
  *
@@ -21,75 +22,7 @@ export interface GeminiSchema {
21
22
  minimum?: number;
22
23
  maximum?: number;
23
24
  }
24
- /**
25
- * Successful conversion result for a JTD format.
26
- *
27
- * Returned when the raw LLM output has been coerced to match the JTD schema
28
- * and passes JTD validation. `data` contains the deserialized, coerced, and
29
- * JTD-validated JSON value.
30
- */
31
- export interface ConvertSuccessJson {
32
- success: true;
33
- kind: 'json';
34
- /** The deserialized, coerced, and JTD-validated JSON value. */
35
- data: unknown;
36
- }
37
- /**
38
- * Successful conversion result for a MIME (binary) format.
39
- *
40
- * Returned when the raw LLM output matches a MIME format. The base64 string
41
- * produced by the model is decoded into raw binary bytes.
42
- */
43
- export interface ConvertSuccessBinary {
44
- success: true;
45
- kind: 'binary';
46
- /** The concrete MIME type of the binary content (e.g. `"image/png"`). */
47
- mimeType: string;
48
- /** The raw binary data decoded from the base64 string returned by the LLM. */
49
- data: Uint8Array;
50
- /** Optional filename, provided by the caller if available. */
51
- filename?: string;
52
- }
53
- /**
54
- * Failed conversion result.
55
- *
56
- * `errors` contains one or more human-readable strings describing validation
57
- * or coercion failures. Each entry uses a JSON Pointer path prefix
58
- * (e.g. `"/foo/bar: ..."`) to locate the problem within the data.
59
- */
60
- export interface ConvertFailure {
61
- success: false;
62
- /** Array of human-readable error messages with JSON Pointer path prefixes. */
63
- errors: string[];
64
- }
65
- /**
66
- * Successful conversion result for multiple signal descriptors.
67
- *
68
- * Returned when the conversion was created via {@link GeminiConversion.fromSignals}.
69
- * Contains per-signal results keyed by signal name.
70
- */
71
- export interface ConvertSuccessSignals {
72
- success: true;
73
- kind: 'signals';
74
- /**
75
- * Per-signal values in dispatch-ready format.
76
- *
77
- * JSON signals are raw values (the JTD-validated data).
78
- * Binary signals are `{ data: Uint8Array, mimeType: string, filename?: string }`.
79
- *
80
- * This record can be passed directly to `dispatchExchange()` or `send()`.
81
- */
82
- signals: Record<string, unknown>;
83
- }
84
- /** Union of all successful conversion outcomes. */
85
- export type ConvertSuccess = ConvertSuccessJson | ConvertSuccessBinary | ConvertSuccessSignals;
86
- /**
87
- * Discriminated union of conversion outcomes.
88
- *
89
- * Check `success` first, then narrow on `kind` (`'json'`, `'binary'`, or
90
- * `'signals'`) for successful results.
91
- */
92
- export type ConvertResult = ConvertSuccess | ConvertFailure;
25
+ export type { ConvertSuccessJson, ConvertSuccessBinary, ConvertSuccessSignals, ConvertFailure, ConvertSuccess, ConvertResult } from '../schema-utils';
93
26
  /**
94
27
  * Converts JTD schemas or Adapt signal descriptors into Gemini-compatible
95
28
  * JSON Schema, and converts raw LLM output back into validated data.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gemini/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EAErB,MAAM,QAAQ,CAAC;AAOhB;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,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@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=multi-format-regression.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-format-regression.test.d.ts","sourceRoot":"","sources":["../src/multi-format-regression.test.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
1
  import type { JTDSchemaJson, SignalDescriptorJson } from '../api';
2
+ import { type ConvertSuccessJson, type ConvertSuccessBinary, type ConvertSuccessSignals, type ConvertFailure, type ConvertSuccess } from '../schema-utils';
2
3
  /**
3
4
  * JSON Schema subset accepted by the OpenAI structured-output API (strict mode).
4
5
  *
@@ -23,81 +24,7 @@ export interface OpenAISchema {
23
24
  $defs?: Record<string, OpenAISchema>;
24
25
  $ref?: string;
25
26
  }
26
- /**
27
- * Successful conversion result for a JTD format.
28
- *
29
- * Returned when the raw LLM output has been coerced to match the JTD schema
30
- * and passes JTD validation. `data` contains the deserialized, coerced, and
31
- * JTD-validated JSON value.
32
- */
33
- export interface ConvertSuccessJson {
34
- success: true;
35
- kind: 'json';
36
- /** The deserialized, coerced, and JTD-validated JSON value. */
37
- data: unknown;
38
- }
39
- /**
40
- * Successful conversion result for a MIME (binary) format.
41
- *
42
- * Returned when the raw LLM output matches a MIME format. The base64 string
43
- * produced by the model is decoded into raw binary bytes.
44
- */
45
- export interface ConvertSuccessBinary {
46
- success: true;
47
- kind: 'binary';
48
- /** The concrete MIME type of the binary content (e.g. `"image/png"`). */
49
- mimeType: string;
50
- /** The raw binary data decoded from the base64 string returned by the LLM. */
51
- data: Uint8Array;
52
- /** Optional filename, provided by the caller if available. */
53
- filename?: string;
54
- }
55
- /**
56
- * Failed conversion result.
57
- *
58
- * `errors` contains one or more human-readable strings describing validation
59
- * or coercion failures. Each entry uses a JSON Pointer path prefix
60
- * (e.g. `"/foo/bar: ..."`) to locate the problem within the data.
61
- */
62
- export interface ConvertFailure {
63
- success: false;
64
- /** Array of human-readable error messages with JSON Pointer path prefixes. */
65
- errors: string[];
66
- }
67
- /**
68
- * Discriminated union of conversion outcomes.
69
- *
70
- * Check `success` first, then narrow on `kind` (`'json'` or `'binary'`)
71
- * for successful results.
72
- */
73
- /**
74
- * Successful conversion result for multiple signal descriptors.
75
- *
76
- * Returned when the conversion was created via {@link OpenAIConversion.fromSignals}.
77
- * Contains per-signal results keyed by signal name.
78
- */
79
- export interface ConvertSuccessSignals {
80
- success: true;
81
- kind: 'signals';
82
- /**
83
- * Per-signal values in dispatch-ready format.
84
- *
85
- * JSON signals are raw values (the JTD-validated data).
86
- * Binary signals are `{ data: Uint8Array, mimeType: string, filename?: string }`.
87
- *
88
- * This record can be passed directly to `dispatchExchange()` or `send()`.
89
- */
90
- signals: Record<string, unknown>;
91
- }
92
- /** Union of all successful conversion outcomes. */
93
- export type ConvertSuccess = ConvertSuccessJson | ConvertSuccessBinary | ConvertSuccessSignals;
94
- /**
95
- * Discriminated union of conversion outcomes.
96
- *
97
- * Check `success` first, then narrow on `kind` (`'json'`, `'binary'`, or
98
- * `'signals'`) for successful results.
99
- */
100
- export type ConvertResult = ConvertSuccess | ConvertFailure;
27
+ export type { ConvertSuccessJson, ConvertSuccessBinary, ConvertSuccessSignals, ConvertFailure, ConvertSuccess, ConvertResult, } from '../schema-utils';
101
28
  /**
102
29
  * Converts JTD schemas or Adapt signal descriptors into OpenAI-compatible
103
30
  * JSON Schema (strict mode), and converts raw LLM output back into
@@ -207,7 +134,7 @@ export declare class OpenAIConversion<T extends ConvertSuccess = ConvertSuccess>
207
134
  * @throws If the descriptor has no formats, or a format has neither
208
135
  * `jtdSchema` nor `mimeType`.
209
136
  */
210
- static fromSignal(descriptor: SignalDescriptorJson): OpenAIConversion<ConvertSuccessJson | ConvertSuccessBinary>;
137
+ static fromSignal(descriptor: SignalDescriptorJson, sharedDefs?: Record<string, JTDSchemaJson>): OpenAIConversion<ConvertSuccessJson | ConvertSuccessBinary>;
211
138
  /**
212
139
  * Build a conversion from multiple signal descriptors.
213
140
  *
@@ -1 +1 @@
1
- {"version":3,"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C,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,gBAAgB,CAAC,qBAAqB,CAAC;IAyD1C;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB;IAwBzE,OAAO;IAgBP;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,GAAI,MAAM,OAAO,KAAG,CAAC,GAAG,cAAc,CAW3C;IAIF;;;;;;;;;OASG;IACH,MAAM;CAuBP;AAsHD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,aAAa,GACvB,gBAAgB,CAElB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,oBAAoB,GAC/B,gBAAgB,CAElB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=openai-roundtrip.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-roundtrip.test.d.ts","sourceRoot":"","sources":["../../src/openai/openai-roundtrip.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=openai.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.test.d.ts","sourceRoot":"","sources":["../../src/openai/openai.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=router.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.spec.d.ts","sourceRoot":"","sources":["../../src/router/router.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Shared utilities for JSON Schema providers (OpenAI, Anthropic, Gemini).
3
+ *
4
+ * Contains constants, types, convert output pipeline, definition pooling,
5
+ * and schema inspection helpers used identically across providers.
6
+ */
7
+ import type { JTDSchemaJson, SignalDescriptorJson, SignalFormatJson } from './api';
8
+ export declare const MAX_REF_DEPTH = 32;
9
+ export declare const INTEGER_BOUNDS: Record<string, {
10
+ minimum: number;
11
+ maximum: number;
12
+ }>;
13
+ export declare const FLOAT32_BOUNDS: {
14
+ minimum: number;
15
+ maximum: number;
16
+ };
17
+ export declare const UNSTRUCTURED_DESC: string;
18
+ export declare const UNSTRUCTURED_VARIANT_DESC: string;
19
+ export declare const VALUES_ARRAY_DESC: string;
20
+ export declare function nullableType(baseType: string, nullable: boolean): string | string[];
21
+ export declare function deepEqual(a: unknown, b: unknown): boolean;
22
+ export declare function isUnstructuredSchema(schema: JTDSchemaJson): boolean;
23
+ export declare function isRootUnstructured(schema: JTDSchemaJson, defs: Record<string, JTDSchemaJson> | undefined): boolean;
24
+ export interface ConvertSuccessJson {
25
+ success: true;
26
+ kind: 'json';
27
+ data: unknown;
28
+ }
29
+ export interface ConvertSuccessBinary {
30
+ success: true;
31
+ kind: 'binary';
32
+ mimeType: string;
33
+ data: Uint8Array;
34
+ filename?: string;
35
+ }
36
+ export interface ConvertSuccessSignals {
37
+ success: true;
38
+ kind: 'signals';
39
+ signals: Record<string, unknown>;
40
+ }
41
+ export interface ConvertFailure {
42
+ success: false;
43
+ errors: string[];
44
+ }
45
+ export type ConvertSuccess = ConvertSuccessJson | ConvertSuccessBinary | ConvertSuccessSignals;
46
+ export type ConvertResult = ConvertSuccess | ConvertFailure;
47
+ export declare function convertJTDOutput(jtdSchema: JTDSchemaJson, json: unknown, coerce: (value: unknown, schema: JTDSchemaJson, defs: Record<string, JTDSchemaJson> | undefined, depth: number) => unknown): ConvertResult;
48
+ export declare function convertMimeOutput(mimeType: string, json: unknown): ConvertResult;
49
+ export declare function convertSingleFormatOutput(fmt: SignalFormatJson, json: unknown, coerce: (value: unknown, schema: JTDSchemaJson, defs: Record<string, JTDSchemaJson> | undefined, depth: number) => unknown): ConvertResult;
50
+ export declare function convertSignalOutput(descriptor: SignalDescriptorJson, json: unknown, coerce: (value: unknown, schema: JTDSchemaJson, defs: Record<string, JTDSchemaJson> | undefined, depth: number) => unknown): ConvertResult;
51
+ export declare function convertSignalsOutput(descriptors: SignalDescriptorJson[], json: unknown, coerce: (value: unknown, schema: JTDSchemaJson, defs: Record<string, JTDSchemaJson> | undefined, depth: number) => unknown): ConvertResult;
52
+ /** Minimal shape for $ref-bearing schemas (satisfied by OpenAISchema and AnthropicSchema). */
53
+ interface RefNode {
54
+ properties?: Record<string, RefNode>;
55
+ items?: RefNode;
56
+ anyOf?: RefNode[];
57
+ $defs?: Record<string, RefNode>;
58
+ $ref?: string;
59
+ }
60
+ export declare function walkSchema<T extends RefNode>(schema: T, fn: (node: T) => void): void;
61
+ /**
62
+ * Pre-scan all signal descriptors, pool their JTD definitions.
63
+ * Deduplicates identical definition SETS; renames conflicts with `_N` suffix.
64
+ *
65
+ * Equivalence is checked per-format: all definitions within a single format's
66
+ * `definitions` block are treated as a unit. Two formats with the same set of
67
+ * definition names and identical schemas (deep-equal) share their defs.
68
+ * If ANY definition name conflicts (same name, different schema), ALL defs
69
+ * from that format get their own namespace to preserve internal cross-references.
70
+ *
71
+ * Returns the merged JTD definitions and signal copies with:
72
+ * - refs rewritten to match merged names
73
+ * - definitions stripped (they live in the merged pool now)
74
+ */
75
+ export declare function poolSignalDefinitions(signals: SignalDescriptorJson[]): {
76
+ mergedDefs: Record<string, JTDSchemaJson>;
77
+ signalsCopy: SignalDescriptorJson[];
78
+ };
79
+ export {};
80
+ //# sourceMappingURL=schema-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../src/schema-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAOnF,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OA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E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI,CAMpF;AAsCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG;IACtE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACrC,CAwFA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema-utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-utils.test.d.ts","sourceRoot":"","sources":["../src/schema-utils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=signals.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signals.test.d.ts","sourceRoot":"","sources":["../../src/signals/signals.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mochabug/adapt-sdk",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "The API toolkit to facilitate mochabug adapt plugin development",
5
5
  "publishConfig": {
6
6
  "access": "public"