@oh-my-pi/pi-ai 15.1.0 → 15.1.1

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": "15.1.0",
4
+ "version": "15.1.1",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -46,8 +46,8 @@
46
46
  "@aws-sdk/credential-provider-node": "^3.972.39",
47
47
  "@bufbuild/protobuf": "^2.12.0",
48
48
  "@google/genai": "^1.52.0",
49
- "@oh-my-pi/pi-natives": "15.1.0",
50
- "@oh-my-pi/pi-utils": "15.1.0",
49
+ "@oh-my-pi/pi-natives": "15.1.1",
50
+ "@oh-my-pi/pi-utils": "15.1.1",
51
51
  "@smithy/node-http-handler": "^4.6.1",
52
52
  "openai": "^6.36.0",
53
53
  "partial-json": "^0.1.7",
@@ -348,7 +348,7 @@ function updateCodexSessionMetadataFromHeaders(
348
348
  }
349
349
  }
350
350
 
351
- function extractCodexWebSocketHandshakeHeaders(socket: WebSocket, openEvent?: Event): Headers | undefined {
351
+ function extractCodexWebSocketHandshakeHeaders(socket: Bun.WebSocket, openEvent?: Event): Headers | undefined {
352
352
  const eventRecord = openEvent as Record<string, unknown> | undefined;
353
353
  const eventResponse = eventRecord?.response as Record<string, unknown> | undefined;
354
354
  const socketRecord = socket as unknown as Record<string, unknown>;
@@ -1889,7 +1889,7 @@ class CodexWebSocketConnection {
1889
1889
  #idleTimeoutMs: number;
1890
1890
  #firstEventTimeoutMs: number;
1891
1891
  #onHandshakeHeaders?: (headers: Headers) => void;
1892
- #socket: WebSocket | null = null;
1892
+ #socket: Bun.WebSocket | null = null;
1893
1893
  #queue: Array<Record<string, unknown> | Error | null> = [];
1894
1894
  #waiters: Array<() => void> = [];
1895
1895
  #connectPromise?: Promise<void>;
@@ -1930,7 +1930,10 @@ class CodexWebSocketConnection {
1930
1930
  }
1931
1931
  const { promise, resolve, reject } = Promise.withResolvers<void>();
1932
1932
  this.#connectPromise = promise;
1933
- const socket = new WebSocket(this.#url, { headers: this.#headers });
1933
+ const socket = new (WebSocket as unknown as new (url: string, opts: Bun.WebSocketOptions) => Bun.WebSocket)(
1934
+ this.#url,
1935
+ { headers: this.#headers },
1936
+ );
1934
1937
  socket.binaryType = "nodebuffer";
1935
1938
  this.#socket = socket;
1936
1939
  let settled = false;
@@ -2092,7 +2095,7 @@ class CodexWebSocketConnection {
2092
2095
  }
2093
2096
  }
2094
2097
 
2095
- #captureHandshakeHeaders(socket: WebSocket, openEvent?: Event): void {
2098
+ #captureHandshakeHeaders(socket: Bun.WebSocket, openEvent?: Event): void {
2096
2099
  if (!this.#onHandshakeHeaders) return;
2097
2100
  const headers = extractCodexWebSocketHandshakeHeaders(socket, openEvent);
2098
2101
  if (!headers) return;
@@ -914,7 +914,7 @@ async function createClient(
914
914
  // SDK UA so traffic is identifiable in upstream provider logs.
915
915
  // https://openrouter.ai/docs/app-attribution
916
916
  headers["User-Agent"] = `Oh-My-Pi/${packageJson.version}`;
917
- headers["HTTP-Referer"] = "https://github.com/can1357/oh-my-pi";
917
+ headers["HTTP-Referer"] = "https://omp.sh/";
918
918
  headers["X-OpenRouter-Title"] = "Oh-My-Pi";
919
919
  headers["X-OpenRouter-Categories"] = "cli-agent";
920
920
  // Always-on response caching: identical requests return cached responses for free.
@@ -92,9 +92,10 @@ function walk(node: unknown): void {
92
92
  export function zodToWireSchema(schema: ZodType): Record<string, unknown> {
93
93
  let json = wireCache.get(schema);
94
94
  if (json) return json;
95
- // `target: "draft-7"` keeps the output compatible with downstream sanitizers
96
- // (OpenAI strict, Google, Anthropic CCA) that already understand draft-07.
97
- const raw = z.toJSONSchema(schema, { target: "draft-7" }) as Record<string, unknown>;
95
+ // `target: "draft-2020-12"` matches what Anthropic's `input_schema` validator
96
+ // requires out of the box; our other provider sanitizers (OpenAI strict,
97
+ // Google, Anthropic CCA) already handle the superset structurally.
98
+ const raw = z.toJSONSchema(schema, { target: "draft-2020-12" }) as Record<string, unknown>;
98
99
  json = postProcess(raw);
99
100
  wireCache.set(schema, json);
100
101
  return json;