agentgui 1.0.599 → 1.0.600
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/package.json +1 -1
- package/static/js/client.js +0 -119
package/package.json
CHANGED
package/static/js/client.js
CHANGED
|
@@ -3300,122 +3300,3 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|
|
3300
3300
|
if (typeof module !== 'undefined' && module.exports) {
|
|
3301
3301
|
module.exports = AgentGUIClient;
|
|
3302
3302
|
}
|
|
3303
|
-
// PHASE 2: Generate unique request ID
|
|
3304
|
-
_generateRequestId() {
|
|
3305
|
-
return ++this._currentRequestId;
|
|
3306
|
-
}
|
|
3307
|
-
|
|
3308
|
-
// PHASE 2: Make a load request with tracking
|
|
3309
|
-
_makeLoadRequest(conversationId) {
|
|
3310
|
-
const requestId = this._generateRequestId();
|
|
3311
|
-
const abortController = new AbortController();
|
|
3312
|
-
|
|
3313
|
-
// Cancel previous request for this conversation if exists
|
|
3314
|
-
const prev = this._loadInProgress[conversationId];
|
|
3315
|
-
if (prev?.abortController) {
|
|
3316
|
-
prev.abortController.abort();
|
|
3317
|
-
}
|
|
3318
|
-
|
|
3319
|
-
this._loadInProgress[conversationId] = {
|
|
3320
|
-
requestId,
|
|
3321
|
-
abortController,
|
|
3322
|
-
timestamp: Date.now(),
|
|
3323
|
-
conversationId
|
|
3324
|
-
};
|
|
3325
|
-
|
|
3326
|
-
return { requestId, abortController };
|
|
3327
|
-
}
|
|
3328
|
-
|
|
3329
|
-
// PHASE 2: Verify request is current before rendering
|
|
3330
|
-
_isCurrentRequest(conversationId, requestId) {
|
|
3331
|
-
const current = this._loadInProgress[conversationId];
|
|
3332
|
-
return current?.requestId === requestId;
|
|
3333
|
-
}
|
|
3334
|
-
|
|
3335
|
-
// PHASE 3: Queue WebSocket message based on priority
|
|
3336
|
-
_queueWebSocketMessage(data) {
|
|
3337
|
-
const highPriorityTypes = ['conversation_deleted', 'all_conversations_deleted'];
|
|
3338
|
-
|
|
3339
|
-
if (highPriorityTypes.includes(data.type)) {
|
|
3340
|
-
this._highPriorityQueue.push(data);
|
|
3341
|
-
} else {
|
|
3342
|
-
this._lowPriorityQueue.push(data);
|
|
3343
|
-
}
|
|
3344
|
-
}
|
|
3345
|
-
|
|
3346
|
-
// PHASE 3: Process queued WebSocket messages
|
|
3347
|
-
_drainMessageQueues() {
|
|
3348
|
-
// Process high-priority first (deletions)
|
|
3349
|
-
while (this._highPriorityQueue.length > 0) {
|
|
3350
|
-
const msg = this._highPriorityQueue.shift();
|
|
3351
|
-
this._processWebSocketMessageDirect(msg);
|
|
3352
|
-
}
|
|
3353
|
-
|
|
3354
|
-
// Then process low-priority (metadata)
|
|
3355
|
-
while (this._lowPriorityQueue.length > 0) {
|
|
3356
|
-
const msg = this._lowPriorityQueue.shift();
|
|
3357
|
-
this._processWebSocketMessageDirect(msg);
|
|
3358
|
-
}
|
|
3359
|
-
}
|
|
3360
|
-
|
|
3361
|
-
// PHASE 3: Direct WebSocket message processing (extracted from switch)
|
|
3362
|
-
_processWebSocketMessageDirect(data) {
|
|
3363
|
-
switch (data.type) {
|
|
3364
|
-
case 'streaming_start':
|
|
3365
|
-
this.handleStreamingStart(data).catch(e => console.error('handleStreamingStart error:', e));
|
|
3366
|
-
break;
|
|
3367
|
-
case 'streaming_progress':
|
|
3368
|
-
this.handleStreamingProgress(data);
|
|
3369
|
-
break;
|
|
3370
|
-
case 'streaming_complete':
|
|
3371
|
-
this.handleStreamingComplete(data);
|
|
3372
|
-
break;
|
|
3373
|
-
case 'streaming_error':
|
|
3374
|
-
this.handleStreamingError(data);
|
|
3375
|
-
break;
|
|
3376
|
-
case 'conversation_created':
|
|
3377
|
-
this.handleConversationCreated(data);
|
|
3378
|
-
break;
|
|
3379
|
-
case 'conversation_deleted':
|
|
3380
|
-
this.handleConversationDeleted(data);
|
|
3381
|
-
break;
|
|
3382
|
-
case 'all_conversations_deleted':
|
|
3383
|
-
this.handleAllConversationsDeleted(data);
|
|
3384
|
-
break;
|
|
3385
|
-
case 'message_created':
|
|
3386
|
-
this.handleMessageCreated(data);
|
|
3387
|
-
break;
|
|
3388
|
-
case 'conversation_updated':
|
|
3389
|
-
this.handleConversationUpdated(data);
|
|
3390
|
-
break;
|
|
3391
|
-
case 'message_updated':
|
|
3392
|
-
this.handleMessageUpdated(data);
|
|
3393
|
-
break;
|
|
3394
|
-
default:
|
|
3395
|
-
// Other types handled elsewhere
|
|
3396
|
-
break;
|
|
3397
|
-
}
|
|
3398
|
-
}
|
|
3399
|
-
|
|
3400
|
-
// PHASE 4: Track streaming event sequence
|
|
3401
|
-
_recordStreamingSequence(sessionId, sequence) {
|
|
3402
|
-
this._lastProcessedSequence[sessionId] = sequence;
|
|
3403
|
-
}
|
|
3404
|
-
|
|
3405
|
-
// PHASE 4: Verify streaming event is current and in-order
|
|
3406
|
-
_isValidStreamingEvent(event) {
|
|
3407
|
-
// Must be for current session
|
|
3408
|
-
if (event.sessionId !== this.state.currentSession?.id) {
|
|
3409
|
-
return false;
|
|
3410
|
-
}
|
|
3411
|
-
|
|
3412
|
-
// Check sequence number
|
|
3413
|
-
const lastSeq = this._lastProcessedSequence[event.sessionId] || -1;
|
|
3414
|
-
if (event.sequence !== undefined && event.sequence <= lastSeq) {
|
|
3415
|
-
return false; // Duplicate or out-of-order
|
|
3416
|
-
}
|
|
3417
|
-
|
|
3418
|
-
return true;
|
|
3419
|
-
}
|
|
3420
|
-
|
|
3421
|
-
|