codex-to-im 1.0.55 → 1.0.57
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/daemon.mjs
CHANGED
|
@@ -10231,6 +10231,27 @@ function summarizeToolSearchOutput(value) {
|
|
|
10231
10231
|
function getDynamicToolCallId(payload) {
|
|
10232
10232
|
return extractNormalizedFreeText(payload.call_id ?? payload.callId);
|
|
10233
10233
|
}
|
|
10234
|
+
function getImageGenerationToolId(payload) {
|
|
10235
|
+
return extractNormalizedFreeText(payload.call_id ?? payload.callId ?? payload.id);
|
|
10236
|
+
}
|
|
10237
|
+
function limitDesktopToolContent(value, maxChars = 1e3) {
|
|
10238
|
+
const normalized = value.trim();
|
|
10239
|
+
if (normalized.length <= maxChars) return normalized;
|
|
10240
|
+
return `${normalized.slice(0, maxChars).trimEnd()}
|
|
10241
|
+
...`;
|
|
10242
|
+
}
|
|
10243
|
+
function summarizeImageGenerationOutput(payload) {
|
|
10244
|
+
const savedPath = extractNormalizedFreeText(payload.saved_path);
|
|
10245
|
+
const prompt = extractNormalizedStructuredText(payload.revised_prompt);
|
|
10246
|
+
const error = extractNormalizedStructuredText(payload.error);
|
|
10247
|
+
const status = extractNormalizedFreeText(payload.status);
|
|
10248
|
+
const parts = [];
|
|
10249
|
+
if (savedPath) parts.push(`Saved: ${savedPath}`);
|
|
10250
|
+
if (prompt) parts.push(`Prompt: ${limitDesktopToolContent(prompt)}`);
|
|
10251
|
+
if (error) parts.push(`Error: ${limitDesktopToolContent(error)}`);
|
|
10252
|
+
if (parts.length === 0 && status) parts.push(`Status: ${status}`);
|
|
10253
|
+
return parts.join("\n\n");
|
|
10254
|
+
}
|
|
10234
10255
|
function formatDesktopToolName(namespaceValue, nameValue) {
|
|
10235
10256
|
const name = extractNormalizedFreeText(nameValue);
|
|
10236
10257
|
if (!name) return "";
|
|
@@ -10272,11 +10293,13 @@ function isTurnContextLine(line) {
|
|
|
10272
10293
|
}
|
|
10273
10294
|
var IGNORED_EVENT_MSG_TYPES = /* @__PURE__ */ new Set([
|
|
10274
10295
|
"context_compacted",
|
|
10296
|
+
"thread_settings_applied",
|
|
10275
10297
|
"thread_name_updated",
|
|
10276
10298
|
"thread_rolled_back",
|
|
10277
10299
|
"token_count"
|
|
10278
10300
|
]);
|
|
10279
10301
|
var IGNORED_RESPONSE_ITEM_TYPES = /* @__PURE__ */ new Set([
|
|
10302
|
+
"image_generation_call",
|
|
10280
10303
|
"web_search_call"
|
|
10281
10304
|
]);
|
|
10282
10305
|
var TERMINAL_COMPLETION_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -10560,6 +10583,21 @@ function pushDesktopMirrorEventRecord(records, parsed, rawLine, activeTurnId) {
|
|
|
10560
10583
|
});
|
|
10561
10584
|
return true;
|
|
10562
10585
|
}
|
|
10586
|
+
if (parsed.payload?.type === "image_generation_end") {
|
|
10587
|
+
const toolId = getImageGenerationToolId(parsed.payload) || signature;
|
|
10588
|
+
const status = extractNormalizedFreeText(parsed.payload.status).toLowerCase();
|
|
10589
|
+
records.push({
|
|
10590
|
+
signature,
|
|
10591
|
+
type: "tool_finished",
|
|
10592
|
+
content: summarizeImageGenerationOutput(parsed.payload),
|
|
10593
|
+
timestamp,
|
|
10594
|
+
...parsed.payload.turn_id || activeTurnId ? { turnId: parsed.payload.turn_id || activeTurnId || void 0 } : {},
|
|
10595
|
+
toolId,
|
|
10596
|
+
toolName: "image_generation",
|
|
10597
|
+
isError: Boolean(parsed.payload.error) || status === "failed"
|
|
10598
|
+
});
|
|
10599
|
+
return true;
|
|
10600
|
+
}
|
|
10563
10601
|
if (parsed.payload?.type === "dynamic_tool_call_request") {
|
|
10564
10602
|
const toolId = getDynamicToolCallId(parsed.payload) || signature;
|
|
10565
10603
|
const toolName = extractNormalizedFreeText(parsed.payload.tool) || "tool";
|
|
@@ -14627,6 +14665,25 @@ var STREAM_DEFAULTS = {
|
|
|
14627
14665
|
};
|
|
14628
14666
|
var STREAM_STATUS_IDLE_START_MS = 18e4;
|
|
14629
14667
|
var STREAM_STATUS_HEARTBEAT_MS = 1e4;
|
|
14668
|
+
var EXTERNAL_PROCESS_CLEANUP_TIMEOUT_MS = 5e3;
|
|
14669
|
+
async function waitForProcessCleanup(promise, timeoutMs) {
|
|
14670
|
+
let timer = null;
|
|
14671
|
+
const settled = promise.then(
|
|
14672
|
+
() => true,
|
|
14673
|
+
() => true
|
|
14674
|
+
);
|
|
14675
|
+
if (timeoutMs <= 0) return settled;
|
|
14676
|
+
try {
|
|
14677
|
+
return await Promise.race([
|
|
14678
|
+
settled,
|
|
14679
|
+
new Promise((resolve2) => {
|
|
14680
|
+
timer = setTimeout(() => resolve2(false), timeoutMs);
|
|
14681
|
+
})
|
|
14682
|
+
]);
|
|
14683
|
+
} finally {
|
|
14684
|
+
if (timer) clearTimeout(timer);
|
|
14685
|
+
}
|
|
14686
|
+
}
|
|
14630
14687
|
function getStreamConfig(channelType = "default") {
|
|
14631
14688
|
const { store } = getBridgeContext();
|
|
14632
14689
|
const defaults = STREAM_DEFAULTS[channelType] || STREAM_DEFAULTS.default;
|
|
@@ -15095,10 +15152,20 @@ async function runInteractiveMessage(adapter, msg, text2, attachments, deps) {
|
|
|
15095
15152
|
raced = { kind: "external", terminal: externalTerminalRequest };
|
|
15096
15153
|
}
|
|
15097
15154
|
if (raced.kind === "external") {
|
|
15098
|
-
processPromise.catch(() => {
|
|
15099
|
-
});
|
|
15100
15155
|
finalOutcome = raced.terminal.outcome;
|
|
15101
15156
|
finalOutcomeDetail = raced.terminal.detail;
|
|
15157
|
+
if (!taskAbort.signal.aborted) {
|
|
15158
|
+
taskAbort.abort();
|
|
15159
|
+
}
|
|
15160
|
+
processResultSettled = await waitForProcessCleanup(
|
|
15161
|
+
processPromise,
|
|
15162
|
+
Math.max(0, deps.externalProcessCleanupTimeoutMs ?? EXTERNAL_PROCESS_CLEANUP_TIMEOUT_MS)
|
|
15163
|
+
);
|
|
15164
|
+
if (!processResultSettled) {
|
|
15165
|
+
console.warn(
|
|
15166
|
+
`[interactive-message-runner] External terminal finalized session ${binding.codepilotSessionId}, but SDK process cleanup did not finish before timeout.`
|
|
15167
|
+
);
|
|
15168
|
+
}
|
|
15102
15169
|
const streamEndStatus = raced.terminal.outcome === "completed" ? "completed" : raced.terminal.outcome === "aborted" ? "interrupted" : "error";
|
|
15103
15170
|
const staleTaskNotice2 = buildStaleTaskCompletionNotice(msg.address, binding);
|
|
15104
15171
|
const terminalResponse2 = assembleDesktopFinalResponse({
|
|
@@ -17610,21 +17677,30 @@ async function handleCommand(adapter, msg, text2) {
|
|
|
17610
17677
|
diagnoseAllActiveSessions: () => SESSION_HEALTH_RUNTIME.diagnoseAllActiveSessions()
|
|
17611
17678
|
});
|
|
17612
17679
|
}
|
|
17613
|
-
function computeSdkSessionUpdate(sdkSessionId, hasError) {
|
|
17680
|
+
function computeSdkSessionUpdate(sdkSessionId, hasError, options = {}) {
|
|
17614
17681
|
if (sdkSessionId && !hasError) {
|
|
17615
17682
|
return sdkSessionId;
|
|
17616
17683
|
}
|
|
17617
17684
|
if (hasError) {
|
|
17685
|
+
if (options.preserveOnError) return null;
|
|
17618
17686
|
return "";
|
|
17619
17687
|
}
|
|
17620
17688
|
return null;
|
|
17621
17689
|
}
|
|
17690
|
+
function shouldPreserveSdkSessionOnError(session) {
|
|
17691
|
+
if (session?.thread_origin !== "desktop") return false;
|
|
17692
|
+
return Boolean(session.desktop_thread_id || session.sdk_session_id || session.codex_thread_id);
|
|
17693
|
+
}
|
|
17622
17694
|
function persistSdkSessionUpdate(sessionId, sdkSessionId, hasError) {
|
|
17623
|
-
const
|
|
17695
|
+
const store = getBridgeContext().store;
|
|
17696
|
+
const session = store.getSession(sessionId);
|
|
17697
|
+
const update = computeSdkSessionUpdate(sdkSessionId, hasError, {
|
|
17698
|
+
preserveOnError: shouldPreserveSdkSessionOnError(session)
|
|
17699
|
+
});
|
|
17624
17700
|
if (update === null) {
|
|
17625
17701
|
return;
|
|
17626
17702
|
}
|
|
17627
|
-
|
|
17703
|
+
store.updateSdkSessionId(sessionId, update);
|
|
17628
17704
|
}
|
|
17629
17705
|
|
|
17630
17706
|
// src/store.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-to-im",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "Installable Codex-to-IM bridge with local setup UI and background service",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/zhangle1987/codex-to-im#readme",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@larksuiteoapi/node-sdk": "^1.66.0",
|
|
44
|
-
"@openai/codex-sdk": "^0.
|
|
44
|
+
"@openai/codex-sdk": "^0.144.1",
|
|
45
45
|
"markdown-it": "^14.2.0",
|
|
46
46
|
"qrcode": "^1.5.4",
|
|
47
47
|
"ws": "^8.21.0"
|
|
@@ -15,7 +15,7 @@ import path from 'node:path';
|
|
|
15
15
|
* - If upstream adds `windowsHide` natively, remove this script.
|
|
16
16
|
*/
|
|
17
17
|
const PATCH_MARKER = 'windowsHide: process.platform === "win32"';
|
|
18
|
-
const SUPPORTED_SDK_VERSION = /^0\.(11\d|12\d|13[0-
|
|
18
|
+
const SUPPORTED_SDK_VERSION = /^0\.(11\d|12\d|13\d|14[0-4])\.\d+$/;
|
|
19
19
|
|
|
20
20
|
function logSkip(message) {
|
|
21
21
|
console.warn(`[postinstall] ${message}`);
|