@oh-my-pi/pi-ai 6.8.5 → 6.9.0
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": "6.
|
|
3
|
+
"version": "6.9.0",
|
|
4
4
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test": "bun test"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@oh-my-pi/pi-utils": "6.
|
|
20
|
+
"@oh-my-pi/pi-utils": "6.9.0",
|
|
21
21
|
"@anthropic-ai/sdk": "0.71.2",
|
|
22
22
|
"@aws-sdk/client-bedrock-runtime": "^3.968.0",
|
|
23
23
|
"@bufbuild/protobuf": "^2.10.2",
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ export * from "./providers/cursor";
|
|
|
6
6
|
export * from "./providers/google";
|
|
7
7
|
export * from "./providers/google-gemini-cli";
|
|
8
8
|
export * from "./providers/google-vertex";
|
|
9
|
-
export * from "./providers/openai-codex/index";
|
|
10
9
|
export * from "./providers/openai-completions";
|
|
11
10
|
export * from "./providers/openai-responses";
|
|
12
11
|
export * from "./stream";
|
|
@@ -36,8 +36,6 @@ import {
|
|
|
36
36
|
OPENAI_HEADERS,
|
|
37
37
|
URL_PATHS,
|
|
38
38
|
} from "./openai-codex/constants";
|
|
39
|
-
import { getCodexInstructions } from "./openai-codex/prompts/codex";
|
|
40
|
-
import { buildCodexSystemPrompt } from "./openai-codex/prompts/system-prompt";
|
|
41
39
|
import { type CodexRequestOptions, type RequestBody, transformRequestBody } from "./openai-codex/request-transformer";
|
|
42
40
|
import { parseCodexError, parseCodexSseStream } from "./openai-codex/response-handler";
|
|
43
41
|
import { transformMessages } from "./transform-messages";
|
|
@@ -50,6 +48,27 @@ export interface OpenAICodexResponsesOptions extends StreamOptions {
|
|
|
50
48
|
codexMode?: boolean;
|
|
51
49
|
}
|
|
52
50
|
|
|
51
|
+
export const CODEX_INSTRUCTIONS = `You are an expert coding assistant operating inside pi, a coding agent harness.`;
|
|
52
|
+
|
|
53
|
+
export interface CodexSystemPrompt {
|
|
54
|
+
instructions: string;
|
|
55
|
+
developerMessages: string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function buildCodexSystemPrompt(args: { userSystemPrompt?: string }): CodexSystemPrompt {
|
|
59
|
+
const { userSystemPrompt } = args;
|
|
60
|
+
const developerMessages: string[] = [];
|
|
61
|
+
|
|
62
|
+
if (userSystemPrompt && userSystemPrompt.trim().length > 0) {
|
|
63
|
+
developerMessages.push(userSystemPrompt.trim());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
instructions: CODEX_INSTRUCTIONS,
|
|
68
|
+
developerMessages,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
53
72
|
const CODEX_DEBUG = process.env.OMP_CODEX_DEBUG === "1" || process.env.OMP_CODEX_DEBUG === "true";
|
|
54
73
|
const CODEX_MAX_RETRIES = 2;
|
|
55
74
|
const CODEX_RETRYABLE_STATUS = new Set([408, 429, 500, 502, 503, 504]);
|
|
@@ -135,9 +154,7 @@ export const streamOpenAICodexResponses: StreamFunction<"openai-codex-responses"
|
|
|
135
154
|
params.tools = convertTools(context.tools);
|
|
136
155
|
}
|
|
137
156
|
|
|
138
|
-
const codexInstructions = getCodexInstructions();
|
|
139
157
|
const systemPrompt = buildCodexSystemPrompt({
|
|
140
|
-
codexInstructions,
|
|
141
158
|
userSystemPrompt: context.systemPrompt,
|
|
142
159
|
});
|
|
143
160
|
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface CodexSystemPrompt {
|
|
2
|
-
instructions: string;
|
|
3
|
-
developerMessages: string[];
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function buildCodexSystemPrompt(args: {
|
|
7
|
-
codexInstructions: string;
|
|
8
|
-
userSystemPrompt?: string;
|
|
9
|
-
}): CodexSystemPrompt {
|
|
10
|
-
const { codexInstructions, userSystemPrompt } = args;
|
|
11
|
-
const developerMessages: string[] = [];
|
|
12
|
-
|
|
13
|
-
if (userSystemPrompt && userSystemPrompt.trim().length > 0) {
|
|
14
|
-
developerMessages.push(userSystemPrompt.trim());
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
instructions: codexInstructions.trim(),
|
|
19
|
-
developerMessages,
|
|
20
|
-
};
|
|
21
|
-
}
|