@mochabug/adapt-sdk 0.4.6 → 0.4.9

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.
@@ -1,5 +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
+ import { type ConvertFailure, type ConvertSuccess, type ConvertSuccessBinary, type ConvertSuccessJson, type ConvertSuccessSignals } from '../schema-utils';
3
3
  /**
4
4
  * JSON Schema subset accepted by the Gemini structured-output API.
5
5
  *
@@ -11,6 +11,7 @@ import { type ConvertSuccessJson, type ConvertSuccessBinary, type ConvertSuccess
11
11
  */
12
12
  export interface GeminiSchema {
13
13
  type?: string | string[];
14
+ nullable?: boolean;
14
15
  title?: string;
15
16
  description?: string;
16
17
  properties?: Record<string, GeminiSchema>;
@@ -21,8 +22,38 @@ export interface GeminiSchema {
21
22
  items?: GeminiSchema;
22
23
  minimum?: number;
23
24
  maximum?: number;
25
+ minItems?: number;
26
+ maxItems?: number;
27
+ anyOf?: GeminiSchema[];
24
28
  }
25
- export type { ConvertSuccessJson, ConvertSuccessBinary, ConvertSuccessSignals, ConvertFailure, ConvertSuccess, ConvertResult } from '../schema-utils';
29
+ /**
30
+ * Schema subset matching the Gemini v1beta Schema protobuf message.
31
+ * Used for function calling `parameters` field in `FunctionDeclaration`.
32
+ *
33
+ * Key differences from {@link GeminiSchema}:
34
+ * - `type` is always a single string (no type arrays)
35
+ * - Uses `nullable: true` instead of `["type", "null"]` type arrays
36
+ * - Does NOT include `additionalProperties`
37
+ * - Supports `anyOf` for discriminator unions
38
+ * - Supports `minItems`/`maxItems` for array bounds
39
+ */
40
+ export interface GeminiFCSchema {
41
+ type?: string;
42
+ nullable?: boolean;
43
+ title?: string;
44
+ description?: string;
45
+ properties?: Record<string, GeminiFCSchema>;
46
+ required?: string[];
47
+ enum?: string[];
48
+ format?: string;
49
+ items?: GeminiFCSchema;
50
+ minimum?: number;
51
+ maximum?: number;
52
+ minItems?: number;
53
+ maxItems?: number;
54
+ anyOf?: GeminiFCSchema[];
55
+ }
56
+ export type { ConvertFailure, ConvertResult, ConvertSuccess, ConvertSuccessBinary, ConvertSuccessJson, ConvertSuccessSignals } from '../schema-utils';
26
57
  /**
27
58
  * Converts JTD schemas or Adapt signal descriptors into Gemini-compatible
28
59
  * JSON Schema, and converts raw LLM output back into validated data.
@@ -55,16 +86,16 @@ export type { ConvertSuccessJson, ConvertSuccessBinary, ConvertSuccessSignals, C
55
86
  * serialized form (string or parsed object).
56
87
  *
57
88
  * ```ts
58
- * const conv = GeminiConversion.fromJTD(jtdSchema);
89
+ * const conv = GeminiStructuredOutputConversion.fromJTD(jtdSchema);
59
90
  * conv.schema; // Gemini JSON Schema to pass to the LLM
60
91
  * conv.convert(output); // coerce + validate -> ConvertResult
61
92
  *
62
93
  * // Serialize & restore
63
94
  * const cached = JSON.stringify(conv);
64
- * const restored = GeminiConversion.fromJSON(cached);
95
+ * const restored = GeminiStructuredOutputConversion.fromJSON(cached);
65
96
  * ```
66
97
  */
67
- export declare class GeminiConversion<T extends ConvertSuccess = ConvertSuccess> {
98
+ export declare class GeminiStructuredOutputConversion<T extends ConvertSuccess = ConvertSuccess> {
68
99
  /** The Gemini-specific JSON Schema to pass to the Gemini API as the response schema. */
69
100
  readonly schema: GeminiSchema;
70
101
  /**
@@ -90,11 +121,11 @@ export declare class GeminiConversion<T extends ConvertSuccess = ConvertSuccess>
90
121
  * Gemini does not support `$ref`.
91
122
  *
92
123
  * @param jtdSchema - A valid JTD schema (RFC 8927).
93
- * @returns A new {@link GeminiConversion} with `jtdSchema` set.
124
+ * @returns A new {@link GeminiStructuredOutputConversion} with `jtdSchema` set.
94
125
  * @throws If the schema contains an unknown JTD type, an unresolved `ref`,
95
126
  * or circular / excessively deep refs (exceeding 32 levels).
96
127
  */
97
- static fromJTD(jtdSchema: JTDSchemaJson): GeminiConversion<ConvertSuccessJson>;
128
+ static fromJTD(jtdSchema: JTDSchemaJson): GeminiStructuredOutputConversion<ConvertSuccessJson>;
98
129
  /**
99
130
  * Build a conversion from an Adapt signal descriptor.
100
131
  *
@@ -104,11 +135,11 @@ export declare class GeminiConversion<T extends ConvertSuccess = ConvertSuccess>
104
135
  * populate exactly one. MIME formats become base64 string schemas.
105
136
  *
106
137
  * @param descriptor - An Adapt signal descriptor with one or more formats.
107
- * @returns A new {@link GeminiConversion} with `descriptor` set.
138
+ * @returns A new {@link GeminiStructuredOutputConversion} with `descriptor` set.
108
139
  * @throws If the descriptor has no formats, or a format has neither
109
140
  * `jtdSchema` nor `mimeType`.
110
141
  */
111
- static fromSignal(descriptor: SignalDescriptorJson): GeminiConversion<ConvertSuccessJson | ConvertSuccessBinary>;
142
+ static fromSignal(descriptor: SignalDescriptorJson): GeminiStructuredOutputConversion<ConvertSuccessJson | ConvertSuccessBinary>;
112
143
  /**
113
144
  * Build a conversion from multiple signal descriptors.
114
145
  *
@@ -121,7 +152,7 @@ export declare class GeminiConversion<T extends ConvertSuccess = ConvertSuccess>
121
152
  *
122
153
  * Receiver/transceiver compatible:
123
154
  * ```ts
124
- * const conv = GeminiConversion.fromSignals(
155
+ * const conv = GeminiStructuredOutputConversion.fromSignals(
125
156
  * receiver.signals!,
126
157
  * receiver.description,
127
158
  * receiver.name
@@ -131,12 +162,12 @@ export declare class GeminiConversion<T extends ConvertSuccess = ConvertSuccess>
131
162
  * @param signals - Array of signal descriptors.
132
163
  * @param description - Optional description for the compound schema.
133
164
  * @param label - Optional label (mapped to `title` on the schema).
134
- * @returns A new {@link GeminiConversion} with `descriptors` set.
165
+ * @returns A new {@link GeminiStructuredOutputConversion} with `descriptors` set.
135
166
  * @throws If any signal has no formats or an invalid format.
136
167
  */
137
- static fromSignals(signals: SignalDescriptorJson[], description?: string, label?: string): GeminiConversion<ConvertSuccessSignals>;
168
+ static fromSignals(signals: SignalDescriptorJson[], description?: string, label?: string): GeminiStructuredOutputConversion<ConvertSuccessSignals>;
138
169
  /**
139
- * Restore a {@link GeminiConversion} from its serialized form.
170
+ * Restore a {@link GeminiStructuredOutputConversion} from its serialized form.
140
171
  *
141
172
  * Accepts either the JSON string produced by `JSON.stringify(conv)` or the
142
173
  * already-parsed plain object. The original `jtdSchema` or `descriptor` is
@@ -144,10 +175,10 @@ export declare class GeminiConversion<T extends ConvertSuccess = ConvertSuccess>
144
175
  * is fully functional.
145
176
  *
146
177
  * @param data - A JSON string or parsed object previously produced by {@link toJSON}.
147
- * @returns A fully reconstructed {@link GeminiConversion}.
178
+ * @returns A fully reconstructed {@link GeminiStructuredOutputConversion}.
148
179
  * @throws If the serialized data contains neither `jtdSchema` nor `descriptor`.
149
180
  */
150
- static fromJSON(data: string | Record<string, unknown>): GeminiConversion;
181
+ static fromJSON(data: string | Record<string, unknown>): GeminiStructuredOutputConversion;
151
182
  private constructor();
152
183
  /**
153
184
  * Convert raw LLM output into a validated result.
@@ -180,17 +211,191 @@ export declare class GeminiConversion<T extends ConvertSuccess = ConvertSuccess>
180
211
  toJSON(): Record<string, unknown>;
181
212
  }
182
213
  /**
183
- * Convenience alias for {@link GeminiConversion.fromJTD}.
214
+ * Converts JTD schemas or Adapt signal descriptors into Gemini v1beta Schema
215
+ * protobuf-compatible schemas for use with function calling `parameters`.
216
+ *
217
+ * ### Differences from {@link GeminiStructuredOutputConversion}
218
+ * - Uses `nullable: true` instead of `["type", "null"]` type arrays
219
+ * - Does NOT emit `additionalProperties`
220
+ * - Uses `anyOf` for discriminator unions instead of wrapper objects
221
+ * - Uses key-value array pattern for `values` form (maps/dictionaries)
222
+ * - Unstructured/empty schemas are encoded as JSON strings
223
+ *
224
+ * ### JTD form mapping
225
+ * - **type** -- mapped to the corresponding JSON Schema `type` with
226
+ * `minimum`/`maximum` for integers, `format: "date-time"` for timestamps.
227
+ * - **enum** -- mapped to `type: "string"` with an `enum` array.
228
+ * - **elements** -- mapped to `type: "array"` with `items`.
229
+ * - **properties / optionalProperties** -- mapped to `type: "object"` with
230
+ * - **values** -- mapped to `type: "array"` with items of
231
+ * `{key: string, value: ...}` objects (key-value array pattern).
232
+ * - **discriminator** -- mapped to `anyOf` with single-value `enum` for the
233
+ * discriminator tag on each variant.
234
+ * - **empty / unstructured** -- mapped to `type: "string"` with a description
235
+ * requesting JSON-encoded content.
236
+ *
237
+ * ### MIME formats
238
+ * MIME signal formats become `type: "object"` with `data` and `filename`
239
+ * properties (same as structured output). On {@link convert}, the base64
240
+ * string is decoded into a {@link ConvertSuccessBinary} result.
241
+ *
242
+ * ### Serialization
243
+ * `JSON.stringify(conv)` produces a JSON-safe object via {@link toJSON}.
244
+ * The serialized form includes `mode: 'fc'` to distinguish it from
245
+ * {@link GeminiStructuredOutputConversion} during deserialization.
246
+ *
247
+ * ```ts
248
+ * const conv = GeminiFunctionCallingConversion.fromJTD(jtdSchema);
249
+ * conv.schema; // FC-compatible schema for FunctionDeclaration.parameters
250
+ * conv.convert(output); // coerce + validate -> ConvertResult
251
+ *
252
+ * // Serialize & restore
253
+ * const cached = JSON.stringify(conv);
254
+ * const restored = GeminiFunctionCallingConversion.fromJSON(cached);
255
+ * ```
256
+ */
257
+ export declare class GeminiFunctionCallingConversion<T extends ConvertSuccess = ConvertSuccess> {
258
+ /** The FC-specific schema to pass as `parameters` in a `FunctionDeclaration`. */
259
+ readonly schema: GeminiFCSchema;
260
+ /**
261
+ * The original JTD schema used to build this conversion.
262
+ * Set when created via {@link fromJTD}; `undefined` when created via {@link fromSignal}.
263
+ */
264
+ readonly jtdSchema?: JTDSchemaJson;
265
+ /**
266
+ * The original signal descriptor used to build this conversion.
267
+ * Set when created via {@link fromSignal}; `undefined` when created via {@link fromJTD}.
268
+ */
269
+ readonly descriptor?: SignalDescriptorJson;
270
+ /**
271
+ * The original signal descriptors used to build this conversion.
272
+ * Set when created via {@link fromSignals}; `undefined` otherwise.
273
+ */
274
+ readonly descriptors?: SignalDescriptorJson[];
275
+ /**
276
+ * Build a conversion from a JTD schema.
277
+ *
278
+ * Recursively converts every JTD form into the equivalent Gemini FC schema
279
+ * node. Definitions (`jtdSchema.definitions`) are resolved inline because
280
+ * the FC protobuf schema does not support `$ref`.
281
+ *
282
+ * @param jtdSchema - A valid JTD schema (RFC 8927).
283
+ * @returns A new {@link GeminiFunctionCallingConversion} with `jtdSchema` set.
284
+ * @throws If the schema contains an unknown JTD type, an unresolved `ref`,
285
+ * or circular / excessively deep refs (exceeding 32 levels).
286
+ */
287
+ static fromJTD(jtdSchema: JTDSchemaJson): GeminiFunctionCallingConversion<ConvertSuccessJson>;
288
+ /**
289
+ * Build a conversion from an Adapt signal descriptor.
290
+ *
291
+ * If the descriptor has a single format, its schema is used directly
292
+ * (unwrapped). If it has multiple formats, a wrapper object schema is
293
+ * produced with `format_0`, `format_1`, ... properties -- the LLM must
294
+ * populate exactly one. MIME formats become base64 string schemas.
295
+ *
296
+ * @param descriptor - An Adapt signal descriptor with one or more formats.
297
+ * @returns A new {@link GeminiFunctionCallingConversion} with `descriptor` set.
298
+ * @throws If the descriptor has no formats, or a format has neither
299
+ * `jtdSchema` nor `mimeType`.
300
+ */
301
+ static fromSignal(descriptor: SignalDescriptorJson): GeminiFunctionCallingConversion<ConvertSuccessJson | ConvertSuccessBinary>;
302
+ /**
303
+ * Build a conversion from multiple signal descriptors.
304
+ *
305
+ * Produces an object schema with one property per signal, suitable for
306
+ * use as function calling parameters. Each signal's schema is built via
307
+ * {@link fromSignal} internally.
308
+ *
309
+ * Optional signals are omitted from `required`.
310
+ *
311
+ * Receiver/transceiver compatible:
312
+ * ```ts
313
+ * const conv = GeminiFunctionCallingConversion.fromSignals(
314
+ * receiver.signals!,
315
+ * receiver.description,
316
+ * receiver.name
317
+ * );
318
+ * ```
319
+ *
320
+ * @param signals - Array of signal descriptors.
321
+ * @param description - Optional description for the compound schema.
322
+ * @param label - Optional label (mapped to `title` on the schema).
323
+ * @returns A new {@link GeminiFunctionCallingConversion} with `descriptors` set.
324
+ * @throws If any signal has no formats or an invalid format.
325
+ */
326
+ static fromSignals(signals: SignalDescriptorJson[], description?: string, label?: string): GeminiFunctionCallingConversion<ConvertSuccessSignals>;
327
+ /**
328
+ * Restore a {@link GeminiFunctionCallingConversion} from its serialized form.
329
+ *
330
+ * Accepts either the JSON string produced by `JSON.stringify(conv)` or the
331
+ * already-parsed plain object. The original `jtdSchema` or `descriptor` is
332
+ * re-processed through the corresponding factory, so the restored instance
333
+ * is fully functional.
334
+ *
335
+ * @param data - A JSON string or parsed object previously produced by {@link toJSON}.
336
+ * @returns A fully reconstructed {@link GeminiFunctionCallingConversion}.
337
+ * @throws If the serialized data contains neither `jtdSchema` nor `descriptor`,
338
+ * or if `mode` is not `'fc'`.
339
+ */
340
+ static fromJSON(data: string | Record<string, unknown>): GeminiFunctionCallingConversion;
341
+ private constructor();
342
+ /**
343
+ * Convert raw LLM output into a validated result.
344
+ *
345
+ * For JTD-based conversions, the value is coerced to conform to the original
346
+ * JTD schema:
347
+ * - Non-integer numbers are rounded for integer types.
348
+ * - `{key, value}` arrays from the values form are reassembled into Records.
349
+ * - Unstructured/empty schemas parse the raw JSON string via `JSON.parse`.
350
+ * - Discriminator variants are coerced from flat objects.
351
+ *
352
+ * The coerced value is then validated against the JTD schema. Returns
353
+ * {@link ConvertSuccessJson} on success.
354
+ *
355
+ * For MIME-based conversions, the value is expected to be a base64 string
356
+ * which is decoded into raw bytes. Returns {@link ConvertSuccessBinary} on
357
+ * success.
358
+ *
359
+ * For multi-format signals, the first non-null `format_N` property is
360
+ * selected and converted individually.
361
+ *
362
+ * @param json - The raw value returned by the Gemini API (typically parsed JSON).
363
+ * @returns A {@link ConvertResult} indicating success or failure with errors.
364
+ */
365
+ convert: (json: unknown) => T | ConvertFailure;
366
+ /**
367
+ * Produce a JSON-serializable representation of this conversion.
368
+ *
369
+ * The output includes the FC `schema`, `mode: 'fc'`, and either the
370
+ * original `jtdSchema` or `descriptor` (whichever was used to create this
371
+ * instance), which is sufficient to fully restore the conversion via
372
+ * {@link fromJSON}.
373
+ *
374
+ * Called automatically by `JSON.stringify(conv)`.
375
+ */
376
+ toJSON(): Record<string, unknown>;
377
+ }
378
+ /** @deprecated Use {@link GeminiStructuredOutputConversion} instead. */
379
+ export { GeminiStructuredOutputConversion as GeminiConversion };
380
+ /**
381
+ * Convenience alias for {@link GeminiStructuredOutputConversion.fromJTD}.
184
382
  *
185
383
  * @param jtdSchema - A valid JTD schema (RFC 8927).
186
- * @returns A new {@link GeminiConversion}.
384
+ * @returns A new {@link GeminiStructuredOutputConversion}.
187
385
  */
188
- export declare function convertToGeminiSchema(jtdSchema: JTDSchemaJson): GeminiConversion<ConvertSuccessJson>;
386
+ export declare function convertToGeminiSchema(jtdSchema: JTDSchemaJson): GeminiStructuredOutputConversion<ConvertSuccessJson>;
189
387
  /**
190
- * Convenience alias for {@link GeminiConversion.fromSignal}.
388
+ * Convenience alias for {@link GeminiStructuredOutputConversion.fromSignal}.
191
389
  *
192
390
  * @param descriptor - An Adapt signal descriptor.
193
- * @returns A new {@link GeminiConversion}.
391
+ * @returns A new {@link GeminiStructuredOutputConversion}.
392
+ */
393
+ export declare function convertSignalToGeminiSchema(descriptor: SignalDescriptorJson): GeminiStructuredOutputConversion<ConvertSuccessJson | ConvertSuccessBinary>;
394
+ /**
395
+ * Convenience alias for {@link GeminiFunctionCallingConversion.fromJTD}.
396
+ *
397
+ * @param jtdSchema - A valid JTD schema (RFC 8927).
398
+ * @returns A new {@link GeminiFunctionCallingConversion}.
194
399
  */
195
- export declare function convertSignalToGeminiSchema(descriptor: SignalDescriptorJson): GeminiConversion<ConvertSuccessJson | ConvertSuccessBinary>;
400
+ export declare function convertToGeminiFCSchema(jtdSchema: JTDSchemaJson): GeminiFunctionCallingConversion<ConvertSuccessJson>;
196
401
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gemini/index.ts"],"names":[],"mappings":"AAGA,OAAO,KA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AqB,CACnC,SAAS,EAAE,aAAa,GACvB,gCAAgC,CAAC,kBAAkB,CAAC,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,oBAAoB,GAC/B,gCAAgC,CAAC,kBAAkB,GAAG,oBAAoB,CAAC,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,aAAa,GACvB,+BAA+B,CAAC,kBAAkB,CAAC,CAErD"}
@@ -76,5 +76,11 @@ export declare function poolSignalDefinitions(signals: SignalDescriptorJson[]):
76
76
  mergedDefs: Record<string, JTDSchemaJson>;
77
77
  signalsCopy: SignalDescriptorJson[];
78
78
  };
79
+ /**
80
+ * Build a human-readable description of a JTD definition for use as a
81
+ * fallback at recursive ref break points. Used by both Anthropic and Gemini
82
+ * converters when a cycle is detected.
83
+ */
84
+ export declare function describeDefinitionForCycle(defName: string, def: JTDSchemaJson): string;
79
85
  export {};
80
86
  //# sourceMappingURL=schema-utils.d.ts.map
@@ -1 +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,OAAO,EAAE,MAAM,CAAA;CAAE,CAO/E,CAAC;AAEF,eAAO,MAAM,cAAc;;;CAAoD,CAAC;AAEhF,eAAO,MAAM,iBAAiB,QAEyF,CAAC;AAExH,eAAO,MAAM,yBAAyB,QAEN,CAAC;AAEjC,eAAO,MAAM,iBAAiB,QAE2D,CAAC;AAM1F,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,GA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jB,MAAM,CAqCR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mochabug/adapt-sdk",
3
- "version": "0.4.6",
3
+ "version": "0.4.9",
4
4
  "description": "The API toolkit to facilitate mochabug adapt plugin development",
5
5
  "publishConfig": {
6
6
  "access": "public"