@drawsy/companion 0.1.31 → 0.1.32
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", {
|