codex-relay 1.4.7 → 1.4.9
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/src.js +28 -1
- package/package.json +2 -2
package/dist/src.js
CHANGED
|
@@ -5231,6 +5231,23 @@ function rolloutRecordMessage(threadId, record, messageKey, workspacePath = defa
|
|
|
5231
5231
|
const timestamp = typeof record.timestamp === "string" ? record.timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
5232
5232
|
const payload = record.payload;
|
|
5233
5233
|
if (!payload) return;
|
|
5234
|
+
if (record.type === "response_item" && payload.type === "message") {
|
|
5235
|
+
const role = firstString(payload, ["role"]);
|
|
5236
|
+
if (role !== "user" && role !== "assistant") return;
|
|
5237
|
+
const content = rolloutResponseItemMessageContent(payload, role);
|
|
5238
|
+
if (!content) return;
|
|
5239
|
+
const messageParts = role === "assistant" ? agentMessageParts(content) : void 0;
|
|
5240
|
+
return ChatMessageSchema.parse({
|
|
5241
|
+
id: firstString(payload, ["id"]) ?? `${messageKey}:${role}`,
|
|
5242
|
+
threadId,
|
|
5243
|
+
role,
|
|
5244
|
+
content: messageParts?.content ?? content,
|
|
5245
|
+
details: messageParts?.details,
|
|
5246
|
+
createdAt: timestamp,
|
|
5247
|
+
state: "completed",
|
|
5248
|
+
turnId
|
|
5249
|
+
});
|
|
5250
|
+
}
|
|
5234
5251
|
if (record.type === "event_msg" && payload.type === "user_message") {
|
|
5235
5252
|
const content = firstString(payload, ["message"]);
|
|
5236
5253
|
if (!content) return;
|
|
@@ -5320,6 +5337,16 @@ function rolloutRecordMessage(threadId, record, messageKey, workspacePath = defa
|
|
|
5320
5337
|
});
|
|
5321
5338
|
}
|
|
5322
5339
|
}
|
|
5340
|
+
function rolloutResponseItemMessageContent(payload, role) {
|
|
5341
|
+
if (!Array.isArray(payload.content)) return;
|
|
5342
|
+
const expectedType = role === "user" ? "input_text" : "output_text";
|
|
5343
|
+
const text = payload.content.flatMap((item) => {
|
|
5344
|
+
if (!item || typeof item !== "object") return [];
|
|
5345
|
+
const contentItem = item;
|
|
5346
|
+
return contentItem.type === expectedType && typeof contentItem.text === "string" ? [contentItem.text] : [];
|
|
5347
|
+
});
|
|
5348
|
+
return text.length > 0 ? text.join("\n\n") : void 0;
|
|
5349
|
+
}
|
|
5323
5350
|
function rolloutUserMessageDetails(payload) {
|
|
5324
5351
|
const attachments = [...rolloutImageAttachments(payload.images, "dataUri"), ...rolloutImageAttachments(payload.local_images, "path")];
|
|
5325
5352
|
return attachments.length > 0 ? { attachments } : void 0;
|
|
@@ -5465,7 +5492,7 @@ function fileUrlPath(value) {
|
|
|
5465
5492
|
}
|
|
5466
5493
|
}
|
|
5467
5494
|
function isRolloutMessageLine(line) {
|
|
5468
|
-
return line.includes("\"type\":\"event_msg\"") && (line.includes("\"type\":\"user_message\"") || line.includes("\"type\":\"agent_message\"") || line.includes("\"type\":\"patch_apply_end\"") || line.includes("\"type\":\"task_started\"") || line.includes("\"type\":\"task_complete\"") || line.includes("\"type\":\"exec_command_end\"") || line.includes("\"type\":\"mcp_tool_call_end\"")) || line.includes("\"type\":\"response_item\"") && (line.includes("\"type\":\"custom_tool_call\"") || line.includes("\"type\":\"custom_tool_call_output\""));
|
|
5495
|
+
return line.includes("\"type\":\"event_msg\"") && (line.includes("\"type\":\"user_message\"") || line.includes("\"type\":\"agent_message\"") || line.includes("\"type\":\"patch_apply_end\"") || line.includes("\"type\":\"task_started\"") || line.includes("\"type\":\"task_complete\"") || line.includes("\"type\":\"exec_command_end\"") || line.includes("\"type\":\"mcp_tool_call_end\"")) || line.includes("\"type\":\"response_item\"") && (line.includes("\"type\":\"message\"") || line.includes("\"type\":\"custom_tool_call\"") || line.includes("\"type\":\"custom_tool_call_output\""));
|
|
5469
5496
|
}
|
|
5470
5497
|
function threadDetailResponse(input) {
|
|
5471
5498
|
return ThreadDetailResponseSchema.parse({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-relay",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "Local Codex Relay CLI bridge for the Codex Relay mobile app.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@noble/ciphers": "2.2.0",
|
|
42
42
|
"@noble/curves": "2.2.0",
|
|
43
43
|
"@noble/hashes": "2.2.0",
|
|
44
|
-
"@openai/codex-sdk": "0.
|
|
44
|
+
"@openai/codex-sdk": "0.149.1",
|
|
45
45
|
"base64-js": "1.5.1",
|
|
46
46
|
"commander": "^14.0.3",
|
|
47
47
|
"es-git": "^0.6.0",
|