@nextclaw/nextclaw-ncp-runtime-plugin-codex-sdk 0.1.4 → 0.1.6
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/dist/index.js +20 -11
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
findProviderByModel,
|
|
3
|
+
findProviderByName,
|
|
2
4
|
getApiBase,
|
|
5
|
+
buildRequestedSkillsUserPrompt,
|
|
3
6
|
getProvider,
|
|
4
7
|
getProviderName,
|
|
5
8
|
getWorkspacePath,
|
|
@@ -33,6 +36,11 @@ function readStringArray(value) {
|
|
|
33
36
|
const values = value.map((entry) => readString(entry)).filter((entry) => Boolean(entry));
|
|
34
37
|
return values.length > 0 ? values : void 0;
|
|
35
38
|
}
|
|
39
|
+
function resolveCodexCapabilitySpec(params) {
|
|
40
|
+
const providerSpec = params.providerName ? findProviderByName(params.providerName) : void 0;
|
|
41
|
+
const modelSpec = params.model ? findProviderByModel(params.model) : void 0;
|
|
42
|
+
return providerSpec?.isGateway ? modelSpec ?? providerSpec : providerSpec ?? modelSpec;
|
|
43
|
+
}
|
|
36
44
|
function readStringRecord(value) {
|
|
37
45
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
38
46
|
return void 0;
|
|
@@ -132,17 +140,7 @@ function buildCodexInputBuilder(workspace) {
|
|
|
132
140
|
const userText = readUserText(input);
|
|
133
141
|
const metadata = input.metadata && typeof input.metadata === "object" && !Array.isArray(input.metadata) ? input.metadata : {};
|
|
134
142
|
const requestedSkills = readRequestedSkills(metadata);
|
|
135
|
-
|
|
136
|
-
if (requestedSkillsContent.trim().length === 0) {
|
|
137
|
-
return userText;
|
|
138
|
-
}
|
|
139
|
-
return [
|
|
140
|
-
"## Requested Skills",
|
|
141
|
-
`Selected skill names: ${requestedSkills.join(", ")}`,
|
|
142
|
-
requestedSkillsContent,
|
|
143
|
-
"## User Message",
|
|
144
|
-
userText
|
|
145
|
-
].join("\n\n");
|
|
143
|
+
return buildRequestedSkillsUserPrompt(skillsLoader, requestedSkills, userText);
|
|
146
144
|
};
|
|
147
145
|
}
|
|
148
146
|
function resolveCodexModel(params) {
|
|
@@ -171,6 +169,10 @@ const plugin = {
|
|
|
171
169
|
});
|
|
172
170
|
const provider = getProvider(nextConfig, model);
|
|
173
171
|
const providerName = getProviderName(nextConfig, model);
|
|
172
|
+
const capabilitySpec = resolveCodexCapabilitySpec({
|
|
173
|
+
model,
|
|
174
|
+
providerName
|
|
175
|
+
});
|
|
174
176
|
const apiBase = readString(pluginConfig.apiBase) ?? getApiBase(nextConfig, model) ?? void 0;
|
|
175
177
|
const apiKey = readString(pluginConfig.apiKey) ?? provider?.apiKey ?? void 0;
|
|
176
178
|
if (!apiKey) {
|
|
@@ -178,6 +180,12 @@ const plugin = {
|
|
|
178
180
|
`[codex] missing apiKey. Set plugins.entries.${PLUGIN_ID}.config.apiKey or providers.*.apiKey for model "${model}".`
|
|
179
181
|
);
|
|
180
182
|
}
|
|
183
|
+
if (capabilitySpec?.supportsResponsesApi === false) {
|
|
184
|
+
const capabilityProviderName = capabilitySpec.displayName ?? capabilitySpec.name ?? providerName ?? "provider";
|
|
185
|
+
throw new Error(
|
|
186
|
+
`[codex] model "${model}" is routed through "${capabilityProviderName}", which does not support the Responses API. Codex SDK currently only supports models available through the Responses API.`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
181
189
|
const executionOptions = resolveCodexExecutionOptions({
|
|
182
190
|
config: nextConfig,
|
|
183
191
|
pluginConfig
|
|
@@ -193,6 +201,7 @@ const plugin = {
|
|
|
193
201
|
env: readStringRecord(pluginConfig.env),
|
|
194
202
|
cliConfig: resolveCodexCliConfig({
|
|
195
203
|
pluginConfig,
|
|
204
|
+
model,
|
|
196
205
|
providerName,
|
|
197
206
|
apiBase
|
|
198
207
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/nextclaw-ncp-runtime-plugin-codex-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NextClaw plugin that registers Codex SDK as an optional NCP runtime.",
|
|
6
6
|
"type": "module",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@nextclaw/core": "0.9.
|
|
24
|
+
"@nextclaw/core": "0.9.4",
|
|
25
25
|
"@nextclaw/ncp-toolkit": "0.4.1",
|
|
26
|
-
"@nextclaw/
|
|
27
|
-
"@nextclaw/ncp": "0.
|
|
26
|
+
"@nextclaw/ncp": "0.3.1",
|
|
27
|
+
"@nextclaw/nextclaw-ncp-runtime-codex-sdk": "0.1.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.17.6",
|