@howaboua/pi-codex-conversion 1.5.6-dev.28.300a94c → 1.5.6-dev.32.699e826
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/adapter/compaction-output.ts +1 -1
- package/src/index.ts +5 -1
- package/src/providers/openai-codex-custom-provider.ts +12 -1
- package/vendor/apply-patch/win32-arm64/apply_patch.exe +0 -0
- package/vendor/apply-patch/win32-x64/apply_patch.exe +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.7
|
|
4
|
+
|
|
5
|
+
- Fixed OpenAI Codex custom-provider requests so synthetic `web.run` and `image_generation` adapter tools are rewritten to native Responses tool payloads before sending.
|
|
6
|
+
- Fixed subagent and other RPC/no-session Codex runs failing with invalid function tool names when native web search is active.
|
|
7
|
+
|
|
3
8
|
## 1.5.6
|
|
4
9
|
|
|
5
10
|
- Added Compaction and Overrides tabs to `/codex`.
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const COMPACTION_ITEM_TYPES = new Set(["compaction", "compaction_summary"]);
|
|
1
|
+
const COMPACTION_ITEM_TYPES = new Set(["compaction", "compaction_summary", "context_compaction"]);
|
|
2
2
|
|
|
3
3
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
4
4
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
package/src/index.ts
CHANGED
|
@@ -64,6 +64,10 @@ export default function codexConversion(pi: ExtensionAPI) {
|
|
|
64
64
|
|
|
65
65
|
registerOpenAICodexCustomProvider(pi, {
|
|
66
66
|
getCurrentCwd: () => state.cwd,
|
|
67
|
+
getNativeToolRewriteConfig: () => ({
|
|
68
|
+
webSearch: !state.config.applyPatchOnly && state.config.webSearch,
|
|
69
|
+
imageGeneration: !state.config.applyPatchOnly && state.config.imageGeneration,
|
|
70
|
+
}),
|
|
67
71
|
});
|
|
68
72
|
registerApplyPatchTool(pi);
|
|
69
73
|
registerExecCommandTool(pi, tracker, sessions);
|
|
@@ -139,7 +143,7 @@ export default function codexConversion(pi: ExtensionAPI) {
|
|
|
139
143
|
if (!shouldUseCodexAdapter(ctx, state.config)) {
|
|
140
144
|
return undefined;
|
|
141
145
|
}
|
|
142
|
-
const skills = hasNoSkillsFlag() ? [] :
|
|
146
|
+
const skills = resolvePromptSkills(event.systemPromptOptions?.skills, hasNoSkillsFlag() ? [] : state.promptSkills);
|
|
143
147
|
return {
|
|
144
148
|
systemPrompt: buildCodexSystemPrompt(event.systemPrompt, {
|
|
145
149
|
skills,
|
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
processResponsesStream,
|
|
22
22
|
} from "./openai-responses-shared.ts";
|
|
23
23
|
import { WEB_SEARCH_TOOL_NAME } from "../adapter/tool-set.ts";
|
|
24
|
+
import { rewriteNativeImageGenerationTool } from "../tools/image-generation-tool.ts";
|
|
25
|
+
import { rewriteNativeWebSearchTool } from "../tools/web-search-tool.ts";
|
|
24
26
|
|
|
25
27
|
const DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
26
28
|
const JWT_CLAIM_PATH = "https://api.openai.com/auth";
|
|
@@ -1538,6 +1540,7 @@ function createCodexStream<TApi extends Api>(
|
|
|
1538
1540
|
options: SimpleStreamOptions | undefined,
|
|
1539
1541
|
deps: {
|
|
1540
1542
|
getCurrentCwd: () => string;
|
|
1543
|
+
getNativeToolRewriteConfig?: () => { webSearch: boolean; imageGeneration: boolean };
|
|
1541
1544
|
onImageSaved?: (savedImage: SavedGeneratedImage, imageData: { data: string; mimeType: string }) => void;
|
|
1542
1545
|
onWebSearchCaptured?: (search: SurfacedWebSearch) => void;
|
|
1543
1546
|
},
|
|
@@ -1561,6 +1564,13 @@ function createCodexStream<TApi extends Api>(
|
|
|
1561
1564
|
if (nextBody !== undefined) {
|
|
1562
1565
|
body = nextBody as ResponsesBody;
|
|
1563
1566
|
}
|
|
1567
|
+
const nativeToolRewriteConfig = deps.getNativeToolRewriteConfig?.();
|
|
1568
|
+
if (nativeToolRewriteConfig?.webSearch) {
|
|
1569
|
+
body = rewriteNativeWebSearchTool(body, model) as ResponsesBody;
|
|
1570
|
+
}
|
|
1571
|
+
if (nativeToolRewriteConfig?.imageGeneration) {
|
|
1572
|
+
body = rewriteNativeImageGenerationTool(body, model) as ResponsesBody;
|
|
1573
|
+
}
|
|
1564
1574
|
|
|
1565
1575
|
const websocketRequestId = options?.sessionId || createCodexRequestId();
|
|
1566
1576
|
const sseHeaders = buildSSEHeaders(model.headers, options?.headers, accountId, apiKey, options?.sessionId);
|
|
@@ -1692,7 +1702,7 @@ function createCodexStream<TApi extends Api>(
|
|
|
1692
1702
|
return stream;
|
|
1693
1703
|
}
|
|
1694
1704
|
|
|
1695
|
-
export function registerOpenAICodexCustomProvider(pi: ExtensionAPI, options: { getCurrentCwd: () => string }): void {
|
|
1705
|
+
export function registerOpenAICodexCustomProvider(pi: ExtensionAPI, options: { getCurrentCwd: () => string; getNativeToolRewriteConfig?: () => { webSearch: boolean; imageGeneration: boolean } }): void {
|
|
1696
1706
|
const pendingActivities: PendingActivity[] = [];
|
|
1697
1707
|
const imagePreviewCache = new Map<string, CachedImagePreview>();
|
|
1698
1708
|
let pendingFlushTimer: ReturnType<typeof setTimeout> | undefined;
|
|
@@ -1754,6 +1764,7 @@ export function registerOpenAICodexCustomProvider(pi: ExtensionAPI, options: { g
|
|
|
1754
1764
|
streamSimple: (model, context, streamOptions) =>
|
|
1755
1765
|
createCodexStream(model, context, streamOptions, {
|
|
1756
1766
|
getCurrentCwd: options.getCurrentCwd,
|
|
1767
|
+
getNativeToolRewriteConfig: options.getNativeToolRewriteConfig,
|
|
1757
1768
|
onImageSaved: (savedImage, imageData) => {
|
|
1758
1769
|
pendingActivities.push({ kind: "image", savedImage, imageData });
|
|
1759
1770
|
},
|
|
Binary file
|
|
Binary file
|