@oh-my-pi/pi-ai 13.3.9 → 13.3.12

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-ai",
4
- "version": "13.3.9",
4
+ "version": "13.3.12",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -41,7 +41,7 @@
41
41
  "@aws-sdk/client-bedrock-runtime": "^3.998",
42
42
  "@bufbuild/protobuf": "^2.11",
43
43
  "@google/genai": "^1.43",
44
- "@oh-my-pi/pi-utils": "13.3.9",
44
+ "@oh-my-pi/pi-utils": "13.3.12",
45
45
  "@sinclair/typebox": "^0.34",
46
46
  "@smithy/node-http-handler": "^4.4",
47
47
  "ajv": "^8.18",
package/src/stream.ts CHANGED
@@ -71,6 +71,7 @@ const serviceProviderMap: Record<string, KeyResolver> = {
71
71
  cursor: "CURSOR_ACCESS_TOKEN",
72
72
  "azure-openai-responses": "AZURE_OPENAI_API_KEY",
73
73
  exa: "EXA_API_KEY",
74
+ jina: "JINA_API_KEY",
74
75
  brave: "BRAVE_API_KEY",
75
76
  perplexity: "PERPLEXITY_API_KEY",
76
77
  // GitHub Copilot uses GitHub personal access token
@@ -51,6 +51,20 @@ const NON_STRUCTURAL_SCHEMA_KEYS = new Set([
51
51
  "unevaluatedProperties",
52
52
  "unevaluatedItems",
53
53
  "patternProperties",
54
+ "propertyNames",
55
+ "contains",
56
+ "minContains",
57
+ "maxContains",
58
+ "dependentRequired",
59
+ "dependentSchemas",
60
+ "contentEncoding",
61
+ "contentMediaType",
62
+ "contentSchema",
63
+ "deprecated",
64
+ "readOnly",
65
+ "writeOnly",
66
+ "minProperties",
67
+ "maxProperties",
54
68
  "$dynamicRef",
55
69
  "$dynamicAnchor",
56
70
  ]);
@@ -169,6 +183,11 @@ export function sanitizeSchemaForStrictMode(schema: Record<string, unknown>): Re
169
183
  * Properties absent from the original `required` array were TypeBox-optional.
170
184
  * They are made nullable (`anyOf: [T, { type: "null" }]`) so the model can
171
185
  * signal omission by outputting null rather than omitting the key entirely.
186
+ *
187
+ * @throws {Error} When a schema node has no `type`, array-based combinator
188
+ * (`anyOf`/`allOf`/`oneOf`), object-based combinator (`not`), or `$ref` —
189
+ * i.e. the node is not representable in strict mode. Prefer
190
+ * {@link tryEnforceStrictSchema} which catches this and degrades gracefully.
172
191
  */
173
192
  export function enforceStrictSchema(schema: Record<string, unknown>): Record<string, unknown> {
174
193
  const result = { ...schema };
@@ -216,6 +235,16 @@ export function enforceStrictSchema(schema: Record<string, unknown>): Record<str
216
235
  );
217
236
  }
218
237
  }
238
+ // Strict mode requires every schema node to declare a concrete type (or combinator/$ref).
239
+ // Schemas like `{}` (match anything) or `{items: {}}` are not representable in strict mode.
240
+ if (
241
+ result.type === undefined &&
242
+ result.$ref === undefined &&
243
+ !COMBINATOR_KEYS.some(key => Array.isArray(result[key])) &&
244
+ !isObjectRecord(result.not)
245
+ ) {
246
+ throw new Error("Schema node has no type, combinator, or $ref — cannot enforce strict mode");
247
+ }
219
248
  return result;
220
249
  }
221
250