@oh-my-pi/pi-ai 8.0.15 → 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 +10 -3
- package/src/providers/amazon-bedrock.ts +5 -5
- package/src/providers/anthropic.ts +7 -7
- package/src/providers/cursor.ts +6 -6
- package/src/providers/google-gemini-cli-usage.ts +2 -2
- package/src/providers/google-gemini-cli.ts +5 -5
- package/src/providers/google-shared.ts +2 -2
- package/src/providers/google-vertex.ts +5 -5
- package/src/providers/google.ts +6 -6
- package/src/providers/openai-codex-responses.ts +17 -17
- package/src/providers/openai-completions.ts +17 -17
- package/src/providers/openai-responses.ts +19 -19
- package/src/providers/transform-messages.ts +1 -1
- package/src/usage/claude.ts +1 -1
- package/src/usage/github-copilot.ts +1 -1
- package/src/usage/google-antigravity.ts +2 -2
- package/src/usage/openai-codex.ts +2 -2
- package/src/usage/zai.ts +1 -1
- package/src/utils/event-stream.ts +1 -1
- package/src/utils/oauth/github-copilot.ts +1 -1
- package/src/utils/overflow.ts +1 -1
- package/src/utils/validation.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-ai",
|
|
3
|
-
"version": "8.0.
|
|
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.
|
|
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
|
-
"
|
|
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
|
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
ToolResultStatus,
|
|
19
19
|
} from "@aws-sdk/client-bedrock-runtime";
|
|
20
20
|
|
|
21
|
-
import { calculateCost } from "
|
|
21
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
22
22
|
import type {
|
|
23
23
|
Api,
|
|
24
24
|
AssistantMessage,
|
|
@@ -34,10 +34,10 @@ import type {
|
|
|
34
34
|
Tool,
|
|
35
35
|
ToolCall,
|
|
36
36
|
ToolResultMessage,
|
|
37
|
-
} from "
|
|
38
|
-
import { AssistantMessageEventStream } from "
|
|
39
|
-
import { parseStreamingJson } from "
|
|
40
|
-
import { sanitizeSurrogates } from "
|
|
37
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
38
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
39
|
+
import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
|
|
40
|
+
import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
|
|
41
41
|
import { transformMessages } from "./transform-messages";
|
|
42
42
|
|
|
43
43
|
export interface BedrockOptions extends StreamOptions {
|
|
@@ -4,8 +4,8 @@ import type {
|
|
|
4
4
|
MessageCreateParamsStreaming,
|
|
5
5
|
MessageParam,
|
|
6
6
|
} from "@anthropic-ai/sdk/resources/messages";
|
|
7
|
-
import { calculateCost } from "
|
|
8
|
-
import { getEnvApiKey, OUTPUT_FALLBACK_BUFFER } from "
|
|
7
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
8
|
+
import { getEnvApiKey, OUTPUT_FALLBACK_BUFFER } from "@oh-my-pi/pi-ai/stream";
|
|
9
9
|
import type {
|
|
10
10
|
Api,
|
|
11
11
|
AssistantMessage,
|
|
@@ -21,11 +21,11 @@ import type {
|
|
|
21
21
|
Tool,
|
|
22
22
|
ToolCall,
|
|
23
23
|
ToolResultMessage,
|
|
24
|
-
} from "
|
|
25
|
-
import { AssistantMessageEventStream } from "
|
|
26
|
-
import { parseStreamingJson } from "
|
|
27
|
-
import { formatErrorMessageWithRetryAfter } from "
|
|
28
|
-
import { sanitizeSurrogates } from "
|
|
24
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
25
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
26
|
+
import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
|
|
27
|
+
import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
|
|
28
|
+
import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
|
|
29
29
|
|
|
30
30
|
import { transformMessages } from "./transform-messages";
|
|
31
31
|
|
package/src/providers/cursor.ts
CHANGED
|
@@ -3,8 +3,7 @@ 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
|
|
7
|
-
import { calculateCost } from "$ai/models";
|
|
6
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
8
7
|
import type {
|
|
9
8
|
Api,
|
|
10
9
|
AssistantMessage,
|
|
@@ -23,10 +22,11 @@ import type {
|
|
|
23
22
|
Tool,
|
|
24
23
|
ToolCall,
|
|
25
24
|
ToolResultMessage,
|
|
26
|
-
} from "
|
|
27
|
-
import { AssistantMessageEventStream } from "
|
|
28
|
-
import { parseStreamingJson } from "
|
|
29
|
-
import { formatErrorMessageWithRetryAfter } from "
|
|
25
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
26
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
27
|
+
import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
|
|
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,8 +6,8 @@ import type {
|
|
|
6
6
|
UsageProvider,
|
|
7
7
|
UsageReport,
|
|
8
8
|
UsageWindow,
|
|
9
|
-
} from "
|
|
10
|
-
import { refreshGoogleCloudToken } from "
|
|
9
|
+
} from "@oh-my-pi/pi-ai/usage";
|
|
10
|
+
import { refreshGoogleCloudToken } from "@oh-my-pi/pi-ai/utils/oauth/google-gemini-cli";
|
|
11
11
|
|
|
12
12
|
const DEFAULT_ENDPOINT = "https://cloudcode-pa.googleapis.com";
|
|
13
13
|
const CACHE_TTL_MS = 60_000;
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import type { Content, ThinkingConfig } from "@google/genai";
|
|
9
|
-
import {
|
|
10
|
-
import { calculateCost } from "$ai/models";
|
|
9
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
11
10
|
import type {
|
|
12
11
|
Api,
|
|
13
12
|
AssistantMessage,
|
|
@@ -18,9 +17,10 @@ import type {
|
|
|
18
17
|
TextContent,
|
|
19
18
|
ThinkingContent,
|
|
20
19
|
ToolCall,
|
|
21
|
-
} from "
|
|
22
|
-
import { AssistantMessageEventStream } from "
|
|
23
|
-
import { sanitizeSurrogates } from "
|
|
20
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
21
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
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,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { type Content, FinishReason, FunctionCallingConfigMode, type Part, type Schema } from "@google/genai";
|
|
6
|
-
import type { Context, ImageContent, Model, StopReason, TextContent, Tool } from "
|
|
7
|
-
import { sanitizeSurrogates } from "
|
|
6
|
+
import type { Context, ImageContent, Model, StopReason, TextContent, Tool } from "@oh-my-pi/pi-ai/types";
|
|
7
|
+
import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
|
|
8
8
|
import { transformMessages } from "./transform-messages";
|
|
9
9
|
|
|
10
10
|
type GoogleApiType = "google-generative-ai" | "google-gemini-cli" | "google-vertex";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type ThinkingConfig,
|
|
6
6
|
ThinkingLevel,
|
|
7
7
|
} from "@google/genai";
|
|
8
|
-
import { calculateCost } from "
|
|
8
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
9
9
|
import type {
|
|
10
10
|
Api,
|
|
11
11
|
AssistantMessage,
|
|
@@ -16,10 +16,10 @@ import type {
|
|
|
16
16
|
TextContent,
|
|
17
17
|
ThinkingContent,
|
|
18
18
|
ToolCall,
|
|
19
|
-
} from "
|
|
20
|
-
import { AssistantMessageEventStream } from "
|
|
21
|
-
import { formatErrorMessageWithRetryAfter } from "
|
|
22
|
-
import { sanitizeSurrogates } from "
|
|
19
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
20
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
21
|
+
import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
|
|
22
|
+
import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
|
|
23
23
|
import type { GoogleThinkingLevel } from "./google-gemini-cli";
|
|
24
24
|
import {
|
|
25
25
|
convertMessages,
|
package/src/providers/google.ts
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
GoogleGenAI,
|
|
5
5
|
type ThinkingConfig,
|
|
6
6
|
} from "@google/genai";
|
|
7
|
-
import { calculateCost } from "
|
|
8
|
-
import { getEnvApiKey } from "
|
|
7
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
8
|
+
import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream";
|
|
9
9
|
import type {
|
|
10
10
|
Api,
|
|
11
11
|
AssistantMessage,
|
|
@@ -16,10 +16,10 @@ import type {
|
|
|
16
16
|
TextContent,
|
|
17
17
|
ThinkingContent,
|
|
18
18
|
ToolCall,
|
|
19
|
-
} from "
|
|
20
|
-
import { AssistantMessageEventStream } from "
|
|
21
|
-
import { formatErrorMessageWithRetryAfter } from "
|
|
22
|
-
import { sanitizeSurrogates } from "
|
|
19
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
20
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
21
|
+
import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
|
|
22
|
+
import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode";
|
|
23
23
|
import type { GoogleThinkingLevel } from "./google-gemini-cli";
|
|
24
24
|
import {
|
|
25
25
|
convertMessages,
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
ResponseFunctionToolCall,
|
|
5
|
-
ResponseInput,
|
|
6
|
-
ResponseInputContent,
|
|
7
|
-
ResponseInputImage,
|
|
8
|
-
ResponseInputText,
|
|
9
|
-
ResponseOutputMessage,
|
|
10
|
-
ResponseReasoningItem,
|
|
11
|
-
} from "openai/resources/responses/responses";
|
|
12
|
-
import { calculateCost } from "$ai/models";
|
|
13
|
-
import { getEnvApiKey } from "$ai/stream";
|
|
2
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
3
|
+
import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream";
|
|
14
4
|
import type {
|
|
15
5
|
Api,
|
|
16
6
|
AssistantMessage,
|
|
@@ -23,11 +13,21 @@ import type {
|
|
|
23
13
|
ThinkingContent,
|
|
24
14
|
Tool,
|
|
25
15
|
ToolCall,
|
|
26
|
-
} from "
|
|
27
|
-
import { AssistantMessageEventStream } from "
|
|
28
|
-
import { parseStreamingJson } from "
|
|
29
|
-
import { formatErrorMessageWithRetryAfter } from "
|
|
30
|
-
import { sanitizeSurrogates } from "
|
|
16
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
17
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
18
|
+
import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
|
|
19
|
+
import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
|
|
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,15 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
ChatCompletionAssistantMessageParam,
|
|
4
|
-
ChatCompletionChunk,
|
|
5
|
-
ChatCompletionContentPart,
|
|
6
|
-
ChatCompletionContentPartImage,
|
|
7
|
-
ChatCompletionContentPartText,
|
|
8
|
-
ChatCompletionMessageParam,
|
|
9
|
-
ChatCompletionToolMessageParam,
|
|
10
|
-
} from "openai/resources/chat/completions";
|
|
11
|
-
import { calculateCost } from "$ai/models";
|
|
12
|
-
import { getEnvApiKey } from "$ai/stream";
|
|
1
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
2
|
+
import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream";
|
|
13
3
|
import type {
|
|
14
4
|
AssistantMessage,
|
|
15
5
|
Context,
|
|
@@ -24,11 +14,21 @@ import type {
|
|
|
24
14
|
Tool,
|
|
25
15
|
ToolCall,
|
|
26
16
|
ToolResultMessage,
|
|
27
|
-
} from "
|
|
28
|
-
import { AssistantMessageEventStream } from "
|
|
29
|
-
import { parseStreamingJson } from "
|
|
30
|
-
import { formatErrorMessageWithRetryAfter } from "
|
|
31
|
-
import { sanitizeSurrogates } from "
|
|
17
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
18
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
19
|
+
import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
|
|
20
|
+
import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
|
|
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,17 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
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
|
-
import { calculateCost } from "$ai/models";
|
|
14
|
-
import { getEnvApiKey } from "$ai/stream";
|
|
1
|
+
import { calculateCost } from "@oh-my-pi/pi-ai/models";
|
|
2
|
+
import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream";
|
|
15
3
|
import type {
|
|
16
4
|
Api,
|
|
17
5
|
AssistantMessage,
|
|
@@ -24,11 +12,23 @@ import type {
|
|
|
24
12
|
ThinkingContent,
|
|
25
13
|
Tool,
|
|
26
14
|
ToolCall,
|
|
27
|
-
} from "
|
|
28
|
-
import { AssistantMessageEventStream } from "
|
|
29
|
-
import { parseStreamingJson } from "
|
|
30
|
-
import { formatErrorMessageWithRetryAfter } from "
|
|
31
|
-
import { sanitizeSurrogates } from "
|
|
15
|
+
} from "@oh-my-pi/pi-ai/types";
|
|
16
|
+
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
|
|
17
|
+
import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse";
|
|
18
|
+
import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after";
|
|
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 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Api, AssistantMessage, Message, Model, ToolCall, ToolResultMessage } from "
|
|
1
|
+
import type { Api, AssistantMessage, Message, Model, ToolCall, ToolResultMessage } from "@oh-my-pi/pi-ai/types";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Normalize tool call ID for cross-provider compatibility.
|
package/src/usage/claude.ts
CHANGED
|
@@ -7,8 +7,8 @@ import type {
|
|
|
7
7
|
UsageReport,
|
|
8
8
|
UsageStatus,
|
|
9
9
|
UsageWindow,
|
|
10
|
-
} from "
|
|
11
|
-
import { refreshAntigravityToken } from "
|
|
10
|
+
} from "@oh-my-pi/pi-ai/usage";
|
|
11
|
+
import { refreshAntigravityToken } from "@oh-my-pi/pi-ai/utils/oauth/google-antigravity";
|
|
12
12
|
|
|
13
13
|
interface AntigravityQuotaInfo {
|
|
14
14
|
remainingFraction?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
|
-
import { CODEX_BASE_URL } from "
|
|
2
|
+
import { CODEX_BASE_URL } from "@oh-my-pi/pi-ai/providers/openai-codex/constants";
|
|
3
3
|
import type {
|
|
4
4
|
UsageAmount,
|
|
5
5
|
UsageCache,
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
UsageProvider,
|
|
10
10
|
UsageReport,
|
|
11
11
|
UsageWindow,
|
|
12
|
-
} from "
|
|
12
|
+
} from "@oh-my-pi/pi-ai/usage";
|
|
13
13
|
|
|
14
14
|
const CODEX_USAGE_PATH = "wham/usage";
|
|
15
15
|
const DEFAULT_CACHE_TTL_MS = 60_000;
|
package/src/usage/zai.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssistantMessage, AssistantMessageEvent } from "
|
|
1
|
+
import type { AssistantMessage, AssistantMessageEvent } from "@oh-my-pi/pi-ai/types";
|
|
2
2
|
|
|
3
3
|
// Generic event stream class for async iteration
|
|
4
4
|
export class EventStream<T, R = T> implements AsyncIterable<T> {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* GitHub Copilot OAuth flow
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { getModels } from "@oh-my-pi/pi-ai/models";
|
|
5
6
|
import { abortableSleep } from "@oh-my-pi/pi-utils";
|
|
6
|
-
import { getModels } from "$ai/models";
|
|
7
7
|
import type { OAuthCredentials } from "./types";
|
|
8
8
|
|
|
9
9
|
const decode = (s: string) => atob(s);
|
package/src/utils/overflow.ts
CHANGED
package/src/utils/validation.ts
CHANGED
|
@@ -5,7 +5,7 @@ import addFormatsModule from "ajv-formats";
|
|
|
5
5
|
const Ajv = (AjvModule as any).default || AjvModule;
|
|
6
6
|
const addFormats = (addFormatsModule as any).default || addFormatsModule;
|
|
7
7
|
|
|
8
|
-
import type { Tool, ToolCall } from "
|
|
8
|
+
import type { Tool, ToolCall } from "@oh-my-pi/pi-ai/types";
|
|
9
9
|
|
|
10
10
|
// ============================================================================
|
|
11
11
|
// Type Coercion Utilities
|