agentgui 1.0.947 → 1.0.949
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/.claude/workflows/gui-audit.js +86 -0
- package/AGENTS.md +29 -11
- package/docs/demo.html +27 -27
- package/lib/codec.js +1 -1
- package/lib/http-handler.js +31 -4
- package/lib/process-message.js +1 -1
- package/lib/stream-event-handler.js +3 -3
- package/lib/terminal.js +1 -1
- package/lib/ws-handlers-util.js +9 -0
- package/lib/ws-setup.js +1 -1
- package/package.json +2 -2
- package/scripts/build-rippleui.mjs +5 -5
- package/scripts/capture-screenshots.mjs +3 -3
- package/scripts/copy-vendor.js +1 -1
- package/scripts/harvest-fixtures.mjs +7 -7
- package/scripts/seed-large-conversation.js +2 -2
- package/scripts/smoke-ws-chat.mjs +2 -2
- package/server.js +1 -1
- package/site/app/index.html +25 -19
- package/site/app/js/app.js +224 -76
- package/site/app/js/backend.js +13 -9
- package/site/app/vendor/anentrypoint-design/247420.css +923 -46
- package/site/app/vendor/anentrypoint-design/247420.js +89 -42
- package/site/theme.mjs +1 -1
- package/test.js +27 -11
package/site/app/js/backend.js
CHANGED
|
@@ -88,8 +88,8 @@ const SYNC_PATH = '/sync';
|
|
|
88
88
|
let _ws = null;
|
|
89
89
|
let _wsReady = null; // Promise that resolves when ws is OPEN
|
|
90
90
|
let _nextReqId = 1;
|
|
91
|
-
const _pending = new Map(); // requestId
|
|
92
|
-
const _sessionListeners = new Map(); // sessionId
|
|
91
|
+
const _pending = new Map(); // requestId -> { resolve, reject }
|
|
92
|
+
const _sessionListeners = new Map(); // sessionId -> Set<(event)=>void>
|
|
93
93
|
const _statusListeners = new Set(); // fn(state) where state in 'open'|'closed'|'error'|'reconnecting'
|
|
94
94
|
let _reconnectAttempts = 0;
|
|
95
95
|
let _reconnectTimer = null;
|
|
@@ -172,7 +172,7 @@ function ensureWs(base) {
|
|
|
172
172
|
else p.resolve(msg.d);
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
|
-
// Unsolicited broadcast
|
|
175
|
+
// Unsolicited broadcast - route by sessionId to subscribers.
|
|
176
176
|
// Server may send a single event or a batch (array) per ws-optimizer.
|
|
177
177
|
const items = Array.isArray(msg) ? msg : [msg];
|
|
178
178
|
for (const item of items) {
|
|
@@ -231,9 +231,9 @@ export async function listAgentModels(base, agentId) {
|
|
|
231
231
|
// ---------- Streaming chat (WS) ----------
|
|
232
232
|
//
|
|
233
233
|
// Yields events of shape:
|
|
234
|
-
// { type: 'text', text: '...' }
|
|
235
|
-
// { type: 'tool', block: {...} }
|
|
236
|
-
// { type: 'result', block: {...} }
|
|
234
|
+
// { type: 'text', text: '...' } - assistant text deltas
|
|
235
|
+
// { type: 'tool', block: {...} } - tool_use blocks
|
|
236
|
+
// { type: 'result', block: {...} } - terminal result block
|
|
237
237
|
// { type: 'error', error: '...' }
|
|
238
238
|
//
|
|
239
239
|
// Caller signature kept compatible with the previous HTTP/SSE impl.
|
|
@@ -268,7 +268,11 @@ export async function* streamChat(base, { model, messages, signal, agentId, resu
|
|
|
268
268
|
const finish = () => { done = true; if (resolveWait) { resolveWait(); resolveWait = null; } };
|
|
269
269
|
|
|
270
270
|
const unsub = addSessionListener(sessionId, (ev) => {
|
|
271
|
-
if (ev.type === '
|
|
271
|
+
if (ev.type === 'streaming_session') {
|
|
272
|
+
// claude's real session id - surface it so the host can --resume this
|
|
273
|
+
// conversation on the next turn (multi-turn continuity).
|
|
274
|
+
if (ev.claudeSessionId) push({ type: 'session', sessionId: ev.claudeSessionId });
|
|
275
|
+
} else if (ev.type === 'streaming_progress') {
|
|
272
276
|
const block = ev.block;
|
|
273
277
|
if (block?.type === 'text' && block.text) push({ type: 'text', text: block.text });
|
|
274
278
|
else if (block?.type === 'tool_use') push({ type: 'tool', block });
|
|
@@ -282,12 +286,12 @@ export async function* streamChat(base, { model, messages, signal, agentId, resu
|
|
|
282
286
|
}
|
|
283
287
|
});
|
|
284
288
|
|
|
285
|
-
// If the websocket drops mid-stream, streaming_complete will never arrive
|
|
289
|
+
// If the websocket drops mid-stream, streaming_complete will never arrive -
|
|
286
290
|
// surface an error and end the iterator instead of hanging forever.
|
|
287
291
|
const onWs = (s) => { if ((s === 'closed' || s === 'error') && !done) { errored = errored || 'connection lost during stream'; finish(); } };
|
|
288
292
|
const unsubWs = onWsStatus ? onWsStatus(onWs) : null;
|
|
289
293
|
|
|
290
|
-
// Wire AbortSignal to chat.cancel
|
|
294
|
+
// Wire AbortSignal to chat.cancel - and end the iterator immediately so the
|
|
291
295
|
// caller's busy state clears even if the server never emits a final event.
|
|
292
296
|
const onAbort = () => { wsCall(base, 'chat.cancel', { sessionId }).catch(() => {}); finish(); };
|
|
293
297
|
if (signal) {
|