@nextclaw/nextclaw-ncp-runtime-plugin-codex-sdk 0.1.29 → 0.1.30
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 +19 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1057,6 +1057,19 @@ function readErrorMessage(value) {
|
|
|
1057
1057
|
const record = value;
|
|
1058
1058
|
return readString(record.message) ?? readString(record.error) ?? "";
|
|
1059
1059
|
}
|
|
1060
|
+
function didReceiveResponseCompleted(rawText) {
|
|
1061
|
+
for (const block of rawText.split(/\r?\n\r?\n/g)) {
|
|
1062
|
+
const trimmedBlock = block.trim();
|
|
1063
|
+
if (!trimmedBlock) {
|
|
1064
|
+
continue;
|
|
1065
|
+
}
|
|
1066
|
+
const eventLine = trimmedBlock.split(/\r?\n/g).find((line) => line.startsWith("event:"));
|
|
1067
|
+
if (eventLine?.slice("event:".length).trim() === "response.completed") {
|
|
1068
|
+
return true;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
return false;
|
|
1072
|
+
}
|
|
1060
1073
|
function shouldTreatResponsesProbeFailureAsUnsupported(params) {
|
|
1061
1074
|
const normalizedMessage = params.message.trim().toLowerCase();
|
|
1062
1075
|
if (params.status === 404 || params.status === 405 || params.status === 501) {
|
|
@@ -1098,7 +1111,7 @@ async function probeCodexResponsesApiSupport(params) {
|
|
|
1098
1111
|
model: params.model,
|
|
1099
1112
|
input: "ping",
|
|
1100
1113
|
max_output_tokens: 1,
|
|
1101
|
-
stream:
|
|
1114
|
+
stream: true
|
|
1102
1115
|
})
|
|
1103
1116
|
});
|
|
1104
1117
|
const rawText = await response.text();
|
|
@@ -1111,8 +1124,11 @@ async function probeCodexResponsesApiSupport(params) {
|
|
|
1111
1124
|
const parsedRecord = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
1112
1125
|
const message = readErrorMessage(parsedRecord?.error) || readErrorMessage(parsed) || rawText.slice(0, 240);
|
|
1113
1126
|
const responseFailed = readString(parsedRecord?.status)?.toLowerCase() === "failed" || Boolean(parsedRecord?.error);
|
|
1114
|
-
if (response.ok
|
|
1115
|
-
return
|
|
1127
|
+
if (!response.ok || responseFailed) {
|
|
1128
|
+
return false;
|
|
1129
|
+
}
|
|
1130
|
+
if (!didReceiveResponseCompleted(rawText)) {
|
|
1131
|
+
return false;
|
|
1116
1132
|
}
|
|
1117
1133
|
return !shouldTreatResponsesProbeFailureAsUnsupported({
|
|
1118
1134
|
status: response.status,
|
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.30",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NextClaw plugin that registers Codex SDK as an optional NCP runtime.",
|
|
6
6
|
"type": "module",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@nextclaw/ncp": "0.4.0",
|
|
25
|
-
"@nextclaw/
|
|
26
|
-
"@nextclaw/ncp-
|
|
25
|
+
"@nextclaw/ncp-toolkit": "0.4.4",
|
|
26
|
+
"@nextclaw/nextclaw-ncp-runtime-codex-sdk": "0.1.7"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^20.17.6",
|