agentgui 1.0.785 → 1.0.786
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/lib/oauth-codex.js +3 -1
- package/lib/oauth-gemini.js +3 -1
- package/lib/ws-handlers-conv.js +5 -0
- package/lib/ws-handlers-msg.js +2 -0
- package/package.json +1 -1
package/lib/oauth-codex.js
CHANGED
|
@@ -75,7 +75,8 @@ export async function startCodexOAuth(req, { PORT, BASE_URL }) {
|
|
|
75
75
|
const mode = remote ? 'remote' : 'local';
|
|
76
76
|
codexOAuthPending = { pkce, redirectUri, state: csrfToken };
|
|
77
77
|
codexOAuthState = { status: 'pending', error: null, email: null };
|
|
78
|
-
|
|
78
|
+
if (codexOAuthPending._timeout) clearTimeout(codexOAuthPending._timeout);
|
|
79
|
+
codexOAuthPending._timeout = setTimeout(() => {
|
|
79
80
|
if (codexOAuthState.status === 'pending') {
|
|
80
81
|
codexOAuthState = { status: 'error', error: 'Authentication timed out', email: null };
|
|
81
82
|
codexOAuthPending = null;
|
|
@@ -86,6 +87,7 @@ export async function startCodexOAuth(req, { PORT, BASE_URL }) {
|
|
|
86
87
|
|
|
87
88
|
export async function exchangeCodexOAuthCode(code, stateParam) {
|
|
88
89
|
if (!codexOAuthPending) throw new Error('No pending OAuth flow. Please start authentication again.');
|
|
90
|
+
if (codexOAuthPending._timeout) { clearTimeout(codexOAuthPending._timeout); codexOAuthPending._timeout = null; }
|
|
89
91
|
const { pkce, redirectUri, state: expectedCsrf } = codexOAuthPending;
|
|
90
92
|
const { csrfToken } = decodeOAuthState(stateParam);
|
|
91
93
|
if (csrfToken !== expectedCsrf) {
|
package/lib/oauth-gemini.js
CHANGED
|
@@ -105,7 +105,8 @@ export async function startGeminiOAuth(req, { PORT, BASE_URL, rootDir }) {
|
|
|
105
105
|
const mode = useCustomClient ? 'custom' : (remote ? 'cli-remote' : 'cli-local');
|
|
106
106
|
geminiOAuthPending = { client, redirectUri, state: csrfToken };
|
|
107
107
|
geminiOAuthState = { status: 'pending', error: null, email: null };
|
|
108
|
-
|
|
108
|
+
if (geminiOAuthPending._timeout) clearTimeout(geminiOAuthPending._timeout);
|
|
109
|
+
geminiOAuthPending._timeout = setTimeout(() => {
|
|
109
110
|
if (geminiOAuthState.status === 'pending') {
|
|
110
111
|
geminiOAuthState = { status: 'error', error: 'Authentication timed out', email: null };
|
|
111
112
|
geminiOAuthPending = null;
|
|
@@ -116,6 +117,7 @@ export async function startGeminiOAuth(req, { PORT, BASE_URL, rootDir }) {
|
|
|
116
117
|
|
|
117
118
|
export async function exchangeGeminiOAuthCode(code, stateParam) {
|
|
118
119
|
if (!geminiOAuthPending) throw new Error('No pending OAuth flow. Please start authentication again.');
|
|
120
|
+
if (geminiOAuthPending._timeout) { clearTimeout(geminiOAuthPending._timeout); geminiOAuthPending._timeout = null; }
|
|
119
121
|
const { client, redirectUri, state: expectedCsrf } = geminiOAuthPending;
|
|
120
122
|
const { csrfToken } = decodeOAuthState(stateParam);
|
|
121
123
|
if (csrfToken !== expectedCsrf) {
|
package/lib/ws-handlers-conv.js
CHANGED
|
@@ -63,6 +63,8 @@ export function register(router, deps) {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
router.handle('conv.del', (p) => {
|
|
66
|
+
cleanupExecution(p.id);
|
|
67
|
+
execMachine.remove(p.id);
|
|
66
68
|
if (!queries.deleteConversation(p.id)) notFound();
|
|
67
69
|
getJsonlWatcher()?.removeConversation(p.id);
|
|
68
70
|
broadcastSync({ type: 'conversation_deleted', conversationId: p.id });
|
|
@@ -70,6 +72,9 @@ export function register(router, deps) {
|
|
|
70
72
|
});
|
|
71
73
|
|
|
72
74
|
router.handle('conv.del.all', (p) => {
|
|
75
|
+
// Clean up all execution machine actors
|
|
76
|
+
const convs = queries.getConversationsList();
|
|
77
|
+
for (const c of convs) { cleanupExecution(c.id); execMachine.remove(c.id); }
|
|
73
78
|
if (!queries.deleteAllConversations()) fail(500, 'Failed to delete all conversations');
|
|
74
79
|
getJsonlWatcher()?.removeAllConversations();
|
|
75
80
|
broadcastSync({ type: 'all_conversations_deleted', timestamp: Date.now() });
|
package/lib/ws-handlers-msg.js
CHANGED
|
@@ -92,6 +92,7 @@ export function register(router, deps) {
|
|
|
92
92
|
const session = startExecution(p.id, message, agentId, model, p.content, subAgent);
|
|
93
93
|
return { message, session, idempotencyKey };
|
|
94
94
|
}
|
|
95
|
+
broadcastSync({ type: 'message_created', conversationId: p.id, message, timestamp: Date.now() });
|
|
95
96
|
const qp = enqueue(p.id, p.content, agentId, model, message.id, subAgent);
|
|
96
97
|
return { message, queued: true, queuePosition: qp, idempotencyKey };
|
|
97
98
|
});
|
|
@@ -111,6 +112,7 @@ export function register(router, deps) {
|
|
|
111
112
|
const session = startExecution(p.id, userMessage, agentId, model, prompt, subAgent);
|
|
112
113
|
return { message: userMessage, session, streamId: session.id };
|
|
113
114
|
}
|
|
115
|
+
broadcastSync({ type: 'message_created', conversationId: p.id, message: userMessage, timestamp: Date.now() });
|
|
114
116
|
const qp = enqueue(p.id, prompt, agentId, model, userMessage.id, subAgent);
|
|
115
117
|
const seq = getNextQueueSeq(p.id);
|
|
116
118
|
broadcastSync({ type: 'queue_status', conversationId: p.id, queueLength: execMachine.getQueue(p.id).length, seq, timestamp: Date.now() });
|