@howaboua/pi-codex-conversion 1.0.26 → 1.0.28
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": "@howaboua/pi-codex-conversion",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "Codex-oriented tool and prompt adapter for pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"typebox": "^1.1.24"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@mariozechner/pi-ai": "^0.70.
|
|
61
|
-
"@mariozechner/pi-coding-agent": "^0.70.
|
|
62
|
-
"@mariozechner/pi-tui": "^0.70.
|
|
60
|
+
"@mariozechner/pi-ai": "^0.70.5",
|
|
61
|
+
"@mariozechner/pi-coding-agent": "^0.70.5",
|
|
62
|
+
"@mariozechner/pi-tui": "^0.70.5",
|
|
63
63
|
"tsx": "^4.20.5",
|
|
64
64
|
"typebox": "^1.1.24",
|
|
65
65
|
"typescript": "^5.9.3"
|
|
@@ -525,7 +525,7 @@ function buildRequestBody<TApi extends Api>(model: Model<TApi>, context: Context
|
|
|
525
525
|
stream: true,
|
|
526
526
|
instructions: context.systemPrompt,
|
|
527
527
|
input: messages,
|
|
528
|
-
text: { verbosity: ((options as { textVerbosity?: string } | undefined)?.textVerbosity ?? "
|
|
528
|
+
text: { verbosity: ((options as { textVerbosity?: string } | undefined)?.textVerbosity ?? "low") as string },
|
|
529
529
|
include: ["reasoning.encrypted_content"],
|
|
530
530
|
prompt_cache_key: options?.sessionId,
|
|
531
531
|
tool_choice: "auto",
|
|
@@ -546,7 +546,7 @@ function buildRequestBody<TApi extends Api>(model: Model<TApi>, context: Context
|
|
|
546
546
|
body.service_tier = serviceTier;
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
if (context.tools) {
|
|
549
|
+
if (context.tools && context.tools.length > 0) {
|
|
550
550
|
body.tools = convertResponsesTools(context.tools, { strict: null });
|
|
551
551
|
const hasWebSearchTool = context.tools.some((tool) => tool.name === "web_search");
|
|
552
552
|
if (hasWebSearchTool) {
|
|
@@ -1303,7 +1303,15 @@ function createErrorMessage(message: AssistantMessage, error: unknown, aborted:
|
|
|
1303
1303
|
}
|
|
1304
1304
|
}
|
|
1305
1305
|
message.stopReason = aborted ? "aborted" : "error";
|
|
1306
|
-
message.errorMessage =
|
|
1306
|
+
message.errorMessage = buildProviderErrorMessage(error);
|
|
1307
|
+
return message;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
export function buildProviderErrorMessage(error: unknown): string {
|
|
1311
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1312
|
+
if (/^(?:WebSocket (?:error|closed)|WebSocket stream closed before response\.completed|Stream closed before response\.completed)/.test(message)) {
|
|
1313
|
+
return `Connection error: ${message}`;
|
|
1314
|
+
}
|
|
1307
1315
|
return message;
|
|
1308
1316
|
}
|
|
1309
1317
|
|