@oh-my-pi/pi-ai 8.0.16 → 8.0.20

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-ai",
3
- "version": "8.0.16",
3
+ "version": "8.0.20",
4
4
  "description": "Unified LLM API with automatic model discovery and provider configuration",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -19,7 +19,7 @@
19
19
  "prepublishOnly": "cp tsconfig.publish.json tsconfig.json"
20
20
  },
21
21
  "dependencies": {
22
- "@oh-my-pi/pi-utils": "8.0.16",
22
+ "@oh-my-pi/pi-utils": "8.0.20",
23
23
  "@anthropic-ai/sdk": "0.71.2",
24
24
  "@aws-sdk/client-bedrock-runtime": "^3.968.0",
25
25
  "@bufbuild/protobuf": "^2.10.2",
@@ -63,6 +63,13 @@
63
63
  "types": "./src/index.ts",
64
64
  "import": "./src/index.ts"
65
65
  },
66
- "./*": "./src/*"
66
+ "./utils/*": {
67
+ "types": "./src/utils/*.ts",
68
+ "import": "./src/utils/*.ts"
69
+ },
70
+ "./*": {
71
+ "types": "./src/*",
72
+ "import": "./src/*"
73
+ }
67
74
  }
68
75
  }
@@ -3,7 +3,6 @@ import { appendFile } from "node:fs/promises";
3
3
  import http2 from "node:http2";
4
4
  import { create, fromBinary, fromJson, type JsonValue, toBinary, toJson } from "@bufbuild/protobuf";
5
5
  import { ValueSchema } from "@bufbuild/protobuf/wkt";
6
- import JSON5 from "json5";
7
6
  import { calculateCost } from "@oh-my-pi/pi-ai/models";
8
7
  import type {
9
8
  Api,
@@ -27,6 +26,7 @@ import type {
27
26
  import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
28
27
  import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
29
28
  import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
29
+ import JSON5 from "json5";
30
30
  import type { McpToolDefinition } from "./cursor/gen/agent_pb";
31
31
  import {
32
32
  AgentClientMessageSchema,
@@ -6,7 +6,6 @@
6
6
 
7
7
  import { createHash } from "node:crypto";
8
8
  import type { Content, ThinkingConfig } from "@google/genai";
9
- import { abortableSleep } from "@oh-my-pi/pi-utils";
10
9
  import { calculateCost } from "@oh-my-pi/pi-ai/models";
11
10
  import type {
12
11
  Api,
@@ -21,6 +20,7 @@ import type {
21
20
  } from "@oh-my-pi/pi-ai/types";
22
21
  import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
23
22
  import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
23
+ import { abortableSleep } from "@oh-my-pi/pi-utils";
24
24
  import {
25
25
  convertMessages,
26
26
  convertTools,
@@ -1,14 +1,4 @@
1
1
  import os from "node:os";
2
- import { abortableSleep } from "@oh-my-pi/pi-utils";
3
- import type {
4
- ResponseFunctionToolCall,
5
- ResponseInput,
6
- ResponseInputContent,
7
- ResponseInputImage,
8
- ResponseInputText,
9
- ResponseOutputMessage,
10
- ResponseReasoningItem,
11
- } from "openai/resources/responses/responses";
12
2
  import { calculateCost } from "@oh-my-pi/pi-ai/models";
13
3
  import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream";
14
4
  import type {
@@ -28,6 +18,16 @@ import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"
28
18
  import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
29
19
  import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
30
20
  import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
21
+ import { abortableSleep } from "@oh-my-pi/pi-utils";
22
+ import type {
23
+ ResponseFunctionToolCall,
24
+ ResponseInput,
25
+ ResponseInputContent,
26
+ ResponseInputImage,
27
+ ResponseInputText,
28
+ ResponseOutputMessage,
29
+ ResponseReasoningItem,
30
+ } from "openai/resources/responses/responses";
31
31
  import packageJson from "../../package.json" with { type: "json" };
32
32
  import {
33
33
  CODEX_BASE_URL,
@@ -1,13 +1,3 @@
1
- import OpenAI from "openai";
2
- import type {
3
- ChatCompletionAssistantMessageParam,
4
- ChatCompletionChunk,
5
- ChatCompletionContentPart,
6
- ChatCompletionContentPartImage,
7
- ChatCompletionContentPartText,
8
- ChatCompletionMessageParam,
9
- ChatCompletionToolMessageParam,
10
- } from "openai/resources/chat/completions";
11
1
  import { calculateCost } from "@oh-my-pi/pi-ai/models";
12
2
  import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream";
13
3
  import type {
@@ -29,6 +19,16 @@ import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"
29
19
  import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
30
20
  import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
31
21
  import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
22
+ import OpenAI from "openai";
23
+ import type {
24
+ ChatCompletionAssistantMessageParam,
25
+ ChatCompletionChunk,
26
+ ChatCompletionContentPart,
27
+ ChatCompletionContentPartImage,
28
+ ChatCompletionContentPartText,
29
+ ChatCompletionMessageParam,
30
+ ChatCompletionToolMessageParam,
31
+ } from "openai/resources/chat/completions";
32
32
  import { transformMessages } from "./transform-messages";
33
33
 
34
34
  /**
@@ -1,15 +1,3 @@
1
- import OpenAI from "openai";
2
- import type {
3
- Tool as OpenAITool,
4
- ResponseCreateParamsStreaming,
5
- ResponseFunctionToolCall,
6
- ResponseInput,
7
- ResponseInputContent,
8
- ResponseInputImage,
9
- ResponseInputText,
10
- ResponseOutputMessage,
11
- ResponseReasoningItem,
12
- } from "openai/resources/responses/responses";
13
1
  import { calculateCost } from "@oh-my-pi/pi-ai/models";
14
2
  import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream";
15
3
  import type {
@@ -29,6 +17,18 @@ import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"
29
17
  import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
30
18
  import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
31
19
  import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
20
+ import OpenAI from "openai";
21
+ import type {
22
+ Tool as OpenAITool,
23
+ ResponseCreateParamsStreaming,
24
+ ResponseFunctionToolCall,
25
+ ResponseInput,
26
+ ResponseInputContent,
27
+ ResponseInputImage,
28
+ ResponseInputText,
29
+ ResponseOutputMessage,
30
+ ResponseReasoningItem,
31
+ } from "openai/resources/responses/responses";
32
32
  import { transformMessages } from "./transform-messages";
33
33
 
34
34
  /** Fast deterministic hash to shorten long strings */
@@ -2,8 +2,8 @@
2
2
  * GitHub Copilot OAuth flow
3
3
  */
4
4
 
5
- import { abortableSleep } from "@oh-my-pi/pi-utils";
6
5
  import { getModels } from "@oh-my-pi/pi-ai/models";
6
+ import { abortableSleep } from "@oh-my-pi/pi-utils";
7
7
  import type { OAuthCredentials } from "./types";
8
8
 
9
9
  const decode = (s: string) => atob(s);