@howaboua/pi-codex-conversion 1.0.2 → 1.0.3
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 +1 -1
- package/src/adapter/codex-model.ts +2 -1
- package/src/index.ts +9 -2
package/package.json
CHANGED
|
@@ -14,7 +14,8 @@ export function isCodexLikeModel(model: Partial<CodexLikeModelDescriptor> | null
|
|
|
14
14
|
const provider = (model.provider ?? "").toLowerCase();
|
|
15
15
|
const api = (model.api ?? "").toLowerCase();
|
|
16
16
|
const id = (model.id ?? "").toLowerCase();
|
|
17
|
-
|
|
17
|
+
const isCopilotGpt = (provider.includes("copilot") || api.includes("copilot")) && id.includes("gpt");
|
|
18
|
+
return provider.includes("codex") || api.includes("codex") || id.includes("codex") || (provider.includes("openai") && id.includes("gpt")) || isCopilotGpt;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function isCodexLikeContext(ctx: ExtensionContext): boolean {
|
package/src/index.ts
CHANGED
|
@@ -99,9 +99,12 @@ function enableAdapter(pi: ExtensionAPI, ctx: ExtensionContext, state: AdapterSt
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
function disableAdapter(pi: ExtensionAPI, ctx: ExtensionContext, state: AdapterState): void {
|
|
102
|
+
const previousToolNames = state.previousToolNames && state.previousToolNames.length > 0 ? state.previousToolNames : DEFAULT_TOOL_NAMES;
|
|
103
|
+
const restoredTools = restoreTools(previousToolNames, pi.getActiveTools());
|
|
104
|
+
if (state.enabled || hasAdapterTools(pi.getActiveTools())) {
|
|
105
|
+
pi.setActiveTools(restoredTools);
|
|
106
|
+
}
|
|
102
107
|
if (state.enabled) {
|
|
103
|
-
const previousToolNames = state.previousToolNames && state.previousToolNames.length > 0 ? state.previousToolNames : DEFAULT_TOOL_NAMES;
|
|
104
|
-
pi.setActiveTools(restoreTools(previousToolNames, pi.getActiveTools()));
|
|
105
108
|
state.enabled = false;
|
|
106
109
|
}
|
|
107
110
|
setStatus(ctx, false);
|
|
@@ -133,3 +136,7 @@ export function restoreTools(previousTools: string[], activeTools: string[]): st
|
|
|
133
136
|
}
|
|
134
137
|
return restored;
|
|
135
138
|
}
|
|
139
|
+
|
|
140
|
+
function hasAdapterTools(activeTools: string[]): boolean {
|
|
141
|
+
return activeTools.some((toolName) => ADAPTER_TOOL_NAMES.includes(toolName));
|
|
142
|
+
}
|