@drawsy/companion 0.1.31 → 0.1.33
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/drawsy/bridge.js
CHANGED
|
@@ -331,7 +331,9 @@ export const createDrawsyBridge = (options = {}) => {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
};
|
|
334
|
-
const closeSession = (session) => {
|
|
334
|
+
const closeSession = (session, event) => {
|
|
335
|
+
if (event)
|
|
336
|
+
emit(session, event);
|
|
335
337
|
sessions.delete(session.id);
|
|
336
338
|
if (session.conversationId &&
|
|
337
339
|
conversationSessions.get(session.conversationId)?.id === session.id) {
|
|
@@ -1767,8 +1769,9 @@ export const createDrawsyBridge = (options = {}) => {
|
|
|
1767
1769
|
selections.delete(id);
|
|
1768
1770
|
}
|
|
1769
1771
|
for (const session of sessions.values()) {
|
|
1770
|
-
if (now - session.touchedAt > 30 * 60 * 1000)
|
|
1771
|
-
closeSession(session);
|
|
1772
|
+
if (now - session.touchedAt > 30 * 60 * 1000) {
|
|
1773
|
+
closeSession(session, { type: "session.closed", data: { reason: "idle" } });
|
|
1774
|
+
}
|
|
1772
1775
|
}
|
|
1773
1776
|
}, 60_000);
|
|
1774
1777
|
cleanup.unref();
|
|
@@ -774,6 +774,7 @@ export class CodexAppServer {
|
|
|
774
774
|
nextId = 1;
|
|
775
775
|
threadId = null;
|
|
776
776
|
turnActive = false;
|
|
777
|
+
hasSubmittedTurn = false;
|
|
777
778
|
activeTurnId = null;
|
|
778
779
|
activeDrawMode = false;
|
|
779
780
|
nativeBrowserFailureInterruptSent = false;
|
|
@@ -1319,6 +1320,9 @@ export class CodexAppServer {
|
|
|
1319
1320
|
this.activeDrawMode = pointerDrawMode;
|
|
1320
1321
|
this.nativeBrowserFailureInterruptSent = false;
|
|
1321
1322
|
try {
|
|
1323
|
+
// Once a user turn reaches Codex, never replace a missing rollout with an
|
|
1324
|
+
// empty thread while changing settings.
|
|
1325
|
+
this.hasSubmittedTurn = true;
|
|
1322
1326
|
const result = (await this.request("turn/start", {
|
|
1323
1327
|
threadId: this.threadId,
|
|
1324
1328
|
cwd: this.folderPath,
|
|
@@ -1675,12 +1679,27 @@ export class CodexAppServer {
|
|
|
1675
1679
|
const previousMetadata = { ...this.agentMetadata };
|
|
1676
1680
|
const previousControls = this.lastControls;
|
|
1677
1681
|
if (internetChanged) {
|
|
1678
|
-
|
|
1682
|
+
const threadOptions = {
|
|
1679
1683
|
internetEnabled: nextInternet,
|
|
1680
1684
|
model: selectedModel?.model || this.agentMetadata.model,
|
|
1681
1685
|
effort: settings.effort || this.agentMetadata.reasoningEffort,
|
|
1682
|
-
|
|
1683
|
-
|
|
1686
|
+
};
|
|
1687
|
+
try {
|
|
1688
|
+
await this.startAgentThread({
|
|
1689
|
+
...threadOptions,
|
|
1690
|
+
nativeThreadId: previousThreadId,
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
catch (error) {
|
|
1694
|
+
if (!isCodexThreadMissingError(error) ||
|
|
1695
|
+
this.session.nativeThreadId ||
|
|
1696
|
+
this.hasSubmittedTurn) {
|
|
1697
|
+
throw error;
|
|
1698
|
+
}
|
|
1699
|
+
// Codex does not persist a new thread until its first user turn.
|
|
1700
|
+
// Reconfigure this empty thread without trying to resume its rollout.
|
|
1701
|
+
await this.startAgentThread(threadOptions);
|
|
1702
|
+
}
|
|
1684
1703
|
}
|
|
1685
1704
|
try {
|
|
1686
1705
|
await this.request("thread/settings/update", {
|
|
@@ -257,7 +257,8 @@ const runtimeEnvironment = (runtimePath, previewPort) => {
|
|
|
257
257
|
XDG_CONFIG_HOME: path.join(runtimePath, "config"),
|
|
258
258
|
XDG_CACHE_HOME: path.join(runtimePath, "cache"),
|
|
259
259
|
XDG_STATE_HOME: path.join(runtimePath, "state"),
|
|
260
|
-
TMPDIR: path.join(runtimePath, "tmp")
|
|
260
|
+
TMPDIR: path.join(runtimePath, "tmp"),
|
|
261
|
+
OPENCODE_PURE: "1"
|
|
261
262
|
};
|
|
262
263
|
if (previewPort) {
|
|
263
264
|
environment.PORT = String(previewPort);
|
|
@@ -319,7 +320,6 @@ const createLinuxSandboxArguments = (input) => {
|
|
|
319
320
|
input.runtimePath,
|
|
320
321
|
input.executable,
|
|
321
322
|
"serve",
|
|
322
|
-
"--pure",
|
|
323
323
|
"--hostname",
|
|
324
324
|
"127.0.0.1",
|
|
325
325
|
"--port",
|
|
@@ -443,7 +443,6 @@ export class OpenCodeAppServer {
|
|
|
443
443
|
}),
|
|
444
444
|
openCodeBinary,
|
|
445
445
|
"serve",
|
|
446
|
-
"--pure",
|
|
447
446
|
"--hostname",
|
|
448
447
|
"127.0.0.1",
|
|
449
448
|
"--port",
|