codex-to-im 1.0.54 → 1.0.56
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
|
@@ -14627,6 +14627,25 @@ var STREAM_DEFAULTS = {
|
|
|
14627
14627
|
};
|
|
14628
14628
|
var STREAM_STATUS_IDLE_START_MS = 18e4;
|
|
14629
14629
|
var STREAM_STATUS_HEARTBEAT_MS = 1e4;
|
|
14630
|
+
var EXTERNAL_PROCESS_CLEANUP_TIMEOUT_MS = 5e3;
|
|
14631
|
+
async function waitForProcessCleanup(promise, timeoutMs) {
|
|
14632
|
+
let timer = null;
|
|
14633
|
+
const settled = promise.then(
|
|
14634
|
+
() => true,
|
|
14635
|
+
() => true
|
|
14636
|
+
);
|
|
14637
|
+
if (timeoutMs <= 0) return settled;
|
|
14638
|
+
try {
|
|
14639
|
+
return await Promise.race([
|
|
14640
|
+
settled,
|
|
14641
|
+
new Promise((resolve2) => {
|
|
14642
|
+
timer = setTimeout(() => resolve2(false), timeoutMs);
|
|
14643
|
+
})
|
|
14644
|
+
]);
|
|
14645
|
+
} finally {
|
|
14646
|
+
if (timer) clearTimeout(timer);
|
|
14647
|
+
}
|
|
14648
|
+
}
|
|
14630
14649
|
function getStreamConfig(channelType = "default") {
|
|
14631
14650
|
const { store } = getBridgeContext();
|
|
14632
14651
|
const defaults = STREAM_DEFAULTS[channelType] || STREAM_DEFAULTS.default;
|
|
@@ -15095,10 +15114,20 @@ async function runInteractiveMessage(adapter, msg, text2, attachments, deps) {
|
|
|
15095
15114
|
raced = { kind: "external", terminal: externalTerminalRequest };
|
|
15096
15115
|
}
|
|
15097
15116
|
if (raced.kind === "external") {
|
|
15098
|
-
processPromise.catch(() => {
|
|
15099
|
-
});
|
|
15100
15117
|
finalOutcome = raced.terminal.outcome;
|
|
15101
15118
|
finalOutcomeDetail = raced.terminal.detail;
|
|
15119
|
+
if (!taskAbort.signal.aborted) {
|
|
15120
|
+
taskAbort.abort();
|
|
15121
|
+
}
|
|
15122
|
+
processResultSettled = await waitForProcessCleanup(
|
|
15123
|
+
processPromise,
|
|
15124
|
+
Math.max(0, deps.externalProcessCleanupTimeoutMs ?? EXTERNAL_PROCESS_CLEANUP_TIMEOUT_MS)
|
|
15125
|
+
);
|
|
15126
|
+
if (!processResultSettled) {
|
|
15127
|
+
console.warn(
|
|
15128
|
+
`[interactive-message-runner] External terminal finalized session ${binding.codepilotSessionId}, but SDK process cleanup did not finish before timeout.`
|
|
15129
|
+
);
|
|
15130
|
+
}
|
|
15102
15131
|
const streamEndStatus = raced.terminal.outcome === "completed" ? "completed" : raced.terminal.outcome === "aborted" ? "interrupted" : "error";
|
|
15103
15132
|
const staleTaskNotice2 = buildStaleTaskCompletionNotice(msg.address, binding);
|
|
15104
15133
|
const terminalResponse2 = assembleDesktopFinalResponse({
|
|
@@ -17610,21 +17639,30 @@ async function handleCommand(adapter, msg, text2) {
|
|
|
17610
17639
|
diagnoseAllActiveSessions: () => SESSION_HEALTH_RUNTIME.diagnoseAllActiveSessions()
|
|
17611
17640
|
});
|
|
17612
17641
|
}
|
|
17613
|
-
function computeSdkSessionUpdate(sdkSessionId, hasError) {
|
|
17642
|
+
function computeSdkSessionUpdate(sdkSessionId, hasError, options = {}) {
|
|
17614
17643
|
if (sdkSessionId && !hasError) {
|
|
17615
17644
|
return sdkSessionId;
|
|
17616
17645
|
}
|
|
17617
17646
|
if (hasError) {
|
|
17647
|
+
if (options.preserveOnError) return null;
|
|
17618
17648
|
return "";
|
|
17619
17649
|
}
|
|
17620
17650
|
return null;
|
|
17621
17651
|
}
|
|
17652
|
+
function shouldPreserveSdkSessionOnError(session) {
|
|
17653
|
+
if (session?.thread_origin !== "desktop") return false;
|
|
17654
|
+
return Boolean(session.desktop_thread_id || session.sdk_session_id || session.codex_thread_id);
|
|
17655
|
+
}
|
|
17622
17656
|
function persistSdkSessionUpdate(sessionId, sdkSessionId, hasError) {
|
|
17623
|
-
const
|
|
17657
|
+
const store = getBridgeContext().store;
|
|
17658
|
+
const session = store.getSession(sessionId);
|
|
17659
|
+
const update = computeSdkSessionUpdate(sdkSessionId, hasError, {
|
|
17660
|
+
preserveOnError: shouldPreserveSdkSessionOnError(session)
|
|
17661
|
+
});
|
|
17624
17662
|
if (update === null) {
|
|
17625
17663
|
return;
|
|
17626
17664
|
}
|
|
17627
|
-
|
|
17665
|
+
store.updateSdkSessionId(sessionId, update);
|
|
17628
17666
|
}
|
|
17629
17667
|
|
|
17630
17668
|
// 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.56",
|
|
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.140.0",
|
|
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
|
|
18
|
+
const SUPPORTED_SDK_VERSION = /^0\.(11\d|12\d|13\d|140)\.\d+$/;
|
|
19
19
|
|
|
20
20
|
function logSkip(message) {
|
|
21
21
|
console.warn(`[postinstall] ${message}`);
|