agentgui 1.0.274 → 1.0.276
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.md +280 -280
- package/IPFS_DOWNLOADER.md +277 -277
- package/TASK_2C_COMPLETION.md +334 -334
- package/agentgui.ico +0 -0
- package/bin/gmgui.cjs +54 -54
- package/build-portable.js +13 -42
- package/database.js +1422 -1406
- package/lib/claude-runner.js +1130 -1130
- package/lib/ipfs-downloader.js +459 -459
- package/lib/speech.js +159 -152
- package/package.json +1 -1
- package/readme.md +76 -76
- package/server.js +3787 -3794
- package/setup-npm-token.sh +68 -68
- package/static/app.js +773 -773
- package/static/event-rendering-showcase.html +708 -708
- package/static/index.html +3178 -3180
- package/static/js/agent-auth.js +298 -298
- package/static/js/audio-recorder-processor.js +18 -18
- package/static/js/client.js +2656 -2656
- package/static/js/conversations.js +583 -583
- package/static/js/dialogs.js +267 -267
- package/static/js/event-consolidator.js +101 -101
- package/static/js/event-filter.js +311 -311
- package/static/js/event-processor.js +452 -452
- package/static/js/features.js +413 -413
- package/static/js/kalman-filter.js +67 -67
- package/static/js/progress-dialog.js +130 -130
- package/static/js/script-runner.js +219 -219
- package/static/js/streaming-renderer.js +2123 -2120
- package/static/js/syntax-highlighter.js +269 -269
- package/static/js/tts-websocket-handler.js +152 -152
- package/static/js/ui-components.js +431 -431
- package/static/js/voice.js +849 -849
- package/static/js/websocket-manager.js +596 -596
- package/static/templates/INDEX.html +465 -465
- package/static/templates/README.md +190 -190
- package/static/templates/agent-capabilities.html +56 -56
- package/static/templates/agent-metadata-panel.html +44 -44
- package/static/templates/agent-status-badge.html +30 -30
- package/static/templates/code-annotation-panel.html +155 -155
- package/static/templates/code-suggestion-panel.html +184 -184
- package/static/templates/command-header.html +77 -77
- package/static/templates/command-output-scrollable.html +118 -118
- package/static/templates/elapsed-time.html +54 -54
- package/static/templates/error-alert.html +106 -106
- package/static/templates/error-history-timeline.html +160 -160
- package/static/templates/error-recovery-options.html +109 -109
- package/static/templates/error-stack-trace.html +95 -95
- package/static/templates/error-summary.html +80 -80
- package/static/templates/event-counter.html +48 -48
- package/static/templates/execution-actions.html +97 -97
- package/static/templates/execution-progress-bar.html +80 -80
- package/static/templates/execution-stepper.html +120 -120
- package/static/templates/file-breadcrumb.html +118 -118
- package/static/templates/file-diff-viewer.html +121 -121
- package/static/templates/file-metadata.html +133 -133
- package/static/templates/file-read-panel.html +66 -66
- package/static/templates/file-write-panel.html +120 -120
- package/static/templates/git-branch-remote.html +107 -107
- package/static/templates/git-diff-list.html +101 -101
- package/static/templates/git-log-visualization.html +153 -153
- package/static/templates/git-status-panel.html +115 -115
- package/static/templates/quality-metrics-display.html +170 -170
- package/static/templates/terminal-output-panel.html +87 -87
- package/static/templates/test-results-display.html +144 -144
- package/static/theme.js +72 -72
- package/test-download-progress.js +223 -223
- package/test-websocket-broadcast.js +147 -147
- package/tests/ipfs-downloader.test.js +370 -370
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
class TTSWebSocketHandler {
|
|
3
|
-
constructor(wsManager) {
|
|
4
|
-
this.wsManager = wsManager;
|
|
5
|
-
this.streamBuffers = new Map();
|
|
6
|
-
this.playbackBuffers = new Map();
|
|
7
|
-
this.sequenceTrackers = new Map();
|
|
8
|
-
this.MIN_BUFFER_CHUNKS = 2;
|
|
9
|
-
this.JITTER_BUFFER_SIZE = 10;
|
|
10
|
-
this.chunkTimeoutMs = 5000;
|
|
11
|
-
this.chunkTimers = new Map();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
initStream(streamId) {
|
|
15
|
-
if (!this.streamBuffers.has(streamId)) {
|
|
16
|
-
this.streamBuffers.set(streamId, []);
|
|
17
|
-
this.playbackBuffers.set(streamId, []);
|
|
18
|
-
this.sequenceTrackers.set(streamId, {
|
|
19
|
-
lastSeq: -1,
|
|
20
|
-
missing: [],
|
|
21
|
-
outOfOrder: 0,
|
|
22
|
-
complete: false
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
receiveChunk(streamId, chunk, seq, isLast) {
|
|
28
|
-
this.initStream(streamId);
|
|
29
|
-
const tracker = this.sequenceTrackers.get(streamId);
|
|
30
|
-
const buffer = this.streamBuffers.get(streamId);
|
|
31
|
-
|
|
32
|
-
clearTimeout(this.chunkTimers.get(`${streamId}:${seq}`));
|
|
33
|
-
|
|
34
|
-
if (seq <= tracker.lastSeq) {
|
|
35
|
-
tracker.outOfOrder++;
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (seq > tracker.lastSeq + 1) {
|
|
40
|
-
for (let i = tracker.lastSeq + 1; i < seq; i++) {
|
|
41
|
-
tracker.missing.push(i);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
tracker.lastSeq = seq;
|
|
46
|
-
buffer.push({ chunk, seq, isLast, receivedAt: Date.now() });
|
|
47
|
-
|
|
48
|
-
if (buffer.length > this.JITTER_BUFFER_SIZE) {
|
|
49
|
-
buffer.shift();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (isLast) {
|
|
53
|
-
this.markStreamComplete(streamId);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
this.setChunkTimeout(streamId, seq);
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
setChunkTimeout(streamId, seq) {
|
|
61
|
-
const key = `${streamId}:${seq}`;
|
|
62
|
-
const timer = setTimeout(() => {
|
|
63
|
-
const tracker = this.sequenceTrackers.get(streamId);
|
|
64
|
-
if (tracker && !tracker.missing.includes(seq)) {
|
|
65
|
-
tracker.missing.push(seq);
|
|
66
|
-
}
|
|
67
|
-
}, this.chunkTimeoutMs);
|
|
68
|
-
this.chunkTimers.set(key, timer);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
getPlayableChunks(streamId) {
|
|
72
|
-
const buffer = this.streamBuffers.get(streamId);
|
|
73
|
-
if (!buffer || buffer.length === 0) return [];
|
|
74
|
-
|
|
75
|
-
const playback = this.playbackBuffers.get(streamId);
|
|
76
|
-
const lastPlayedSeq = playback.length > 0
|
|
77
|
-
? playback[playback.length - 1].seq
|
|
78
|
-
: -1;
|
|
79
|
-
|
|
80
|
-
const chunks = buffer.filter(c => c.seq > lastPlayedSeq);
|
|
81
|
-
return chunks;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
markChunksPlayed(streamId, upToSeq) {
|
|
85
|
-
const buffer = this.streamBuffers.get(streamId);
|
|
86
|
-
const playback = this.playbackBuffers.get(streamId);
|
|
87
|
-
|
|
88
|
-
const toPlay = buffer.filter(c => c.seq <= upToSeq);
|
|
89
|
-
playback.push(...toPlay);
|
|
90
|
-
|
|
91
|
-
const newBuffer = buffer.filter(c => c.seq > upToSeq);
|
|
92
|
-
this.streamBuffers.set(streamId, newBuffer);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
canStartPlayback(streamId) {
|
|
96
|
-
const buffer = this.streamBuffers.get(streamId);
|
|
97
|
-
const playback = this.playbackBuffers.get(streamId);
|
|
98
|
-
const tracker = this.sequenceTrackers.get(streamId);
|
|
99
|
-
|
|
100
|
-
if (!buffer) return false;
|
|
101
|
-
if (buffer.length === 0 && !tracker.complete) return false;
|
|
102
|
-
|
|
103
|
-
return buffer.length >= this.MIN_BUFFER_CHUNKS || tracker.complete;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
markStreamComplete(streamId) {
|
|
107
|
-
const tracker = this.sequenceTrackers.get(streamId);
|
|
108
|
-
if (tracker) tracker.complete = true;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
isStreamComplete(streamId) {
|
|
112
|
-
const tracker = this.sequenceTrackers.get(streamId);
|
|
113
|
-
return tracker && tracker.complete;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
hasLostPackets(streamId) {
|
|
117
|
-
const tracker = this.sequenceTrackers.get(streamId);
|
|
118
|
-
return tracker && tracker.missing.length > 0;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
getStreamStats(streamId) {
|
|
122
|
-
const tracker = this.sequenceTrackers.get(streamId);
|
|
123
|
-
const buffer = this.streamBuffers.get(streamId);
|
|
124
|
-
const playback = this.playbackBuffers.get(streamId);
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
buffered: buffer ? buffer.length : 0,
|
|
128
|
-
played: playback ? playback.length : 0,
|
|
129
|
-
totalSeq: tracker ? tracker.lastSeq + 1 : 0,
|
|
130
|
-
missing: tracker ? tracker.missing.length : 0,
|
|
131
|
-
outOfOrder: tracker ? tracker.outOfOrder : 0,
|
|
132
|
-
complete: tracker ? tracker.complete : false
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
cleanupStream(streamId) {
|
|
137
|
-
this.streamBuffers.delete(streamId);
|
|
138
|
-
this.playbackBuffers.delete(streamId);
|
|
139
|
-
this.sequenceTrackers.delete(streamId);
|
|
140
|
-
|
|
141
|
-
const keys = Array.from(this.chunkTimers.keys());
|
|
142
|
-
keys.forEach(key => {
|
|
143
|
-
if (key.startsWith(`${streamId}:`)) {
|
|
144
|
-
clearTimeout(this.chunkTimers.get(key));
|
|
145
|
-
this.chunkTimers.delete(key);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
window.TTSWebSocketHandler = TTSWebSocketHandler;
|
|
152
|
-
})();
|
|
1
|
+
(function() {
|
|
2
|
+
class TTSWebSocketHandler {
|
|
3
|
+
constructor(wsManager) {
|
|
4
|
+
this.wsManager = wsManager;
|
|
5
|
+
this.streamBuffers = new Map();
|
|
6
|
+
this.playbackBuffers = new Map();
|
|
7
|
+
this.sequenceTrackers = new Map();
|
|
8
|
+
this.MIN_BUFFER_CHUNKS = 2;
|
|
9
|
+
this.JITTER_BUFFER_SIZE = 10;
|
|
10
|
+
this.chunkTimeoutMs = 5000;
|
|
11
|
+
this.chunkTimers = new Map();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
initStream(streamId) {
|
|
15
|
+
if (!this.streamBuffers.has(streamId)) {
|
|
16
|
+
this.streamBuffers.set(streamId, []);
|
|
17
|
+
this.playbackBuffers.set(streamId, []);
|
|
18
|
+
this.sequenceTrackers.set(streamId, {
|
|
19
|
+
lastSeq: -1,
|
|
20
|
+
missing: [],
|
|
21
|
+
outOfOrder: 0,
|
|
22
|
+
complete: false
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
receiveChunk(streamId, chunk, seq, isLast) {
|
|
28
|
+
this.initStream(streamId);
|
|
29
|
+
const tracker = this.sequenceTrackers.get(streamId);
|
|
30
|
+
const buffer = this.streamBuffers.get(streamId);
|
|
31
|
+
|
|
32
|
+
clearTimeout(this.chunkTimers.get(`${streamId}:${seq}`));
|
|
33
|
+
|
|
34
|
+
if (seq <= tracker.lastSeq) {
|
|
35
|
+
tracker.outOfOrder++;
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (seq > tracker.lastSeq + 1) {
|
|
40
|
+
for (let i = tracker.lastSeq + 1; i < seq; i++) {
|
|
41
|
+
tracker.missing.push(i);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
tracker.lastSeq = seq;
|
|
46
|
+
buffer.push({ chunk, seq, isLast, receivedAt: Date.now() });
|
|
47
|
+
|
|
48
|
+
if (buffer.length > this.JITTER_BUFFER_SIZE) {
|
|
49
|
+
buffer.shift();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (isLast) {
|
|
53
|
+
this.markStreamComplete(streamId);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.setChunkTimeout(streamId, seq);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
setChunkTimeout(streamId, seq) {
|
|
61
|
+
const key = `${streamId}:${seq}`;
|
|
62
|
+
const timer = setTimeout(() => {
|
|
63
|
+
const tracker = this.sequenceTrackers.get(streamId);
|
|
64
|
+
if (tracker && !tracker.missing.includes(seq)) {
|
|
65
|
+
tracker.missing.push(seq);
|
|
66
|
+
}
|
|
67
|
+
}, this.chunkTimeoutMs);
|
|
68
|
+
this.chunkTimers.set(key, timer);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
getPlayableChunks(streamId) {
|
|
72
|
+
const buffer = this.streamBuffers.get(streamId);
|
|
73
|
+
if (!buffer || buffer.length === 0) return [];
|
|
74
|
+
|
|
75
|
+
const playback = this.playbackBuffers.get(streamId);
|
|
76
|
+
const lastPlayedSeq = playback.length > 0
|
|
77
|
+
? playback[playback.length - 1].seq
|
|
78
|
+
: -1;
|
|
79
|
+
|
|
80
|
+
const chunks = buffer.filter(c => c.seq > lastPlayedSeq);
|
|
81
|
+
return chunks;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
markChunksPlayed(streamId, upToSeq) {
|
|
85
|
+
const buffer = this.streamBuffers.get(streamId);
|
|
86
|
+
const playback = this.playbackBuffers.get(streamId);
|
|
87
|
+
|
|
88
|
+
const toPlay = buffer.filter(c => c.seq <= upToSeq);
|
|
89
|
+
playback.push(...toPlay);
|
|
90
|
+
|
|
91
|
+
const newBuffer = buffer.filter(c => c.seq > upToSeq);
|
|
92
|
+
this.streamBuffers.set(streamId, newBuffer);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
canStartPlayback(streamId) {
|
|
96
|
+
const buffer = this.streamBuffers.get(streamId);
|
|
97
|
+
const playback = this.playbackBuffers.get(streamId);
|
|
98
|
+
const tracker = this.sequenceTrackers.get(streamId);
|
|
99
|
+
|
|
100
|
+
if (!buffer) return false;
|
|
101
|
+
if (buffer.length === 0 && !tracker.complete) return false;
|
|
102
|
+
|
|
103
|
+
return buffer.length >= this.MIN_BUFFER_CHUNKS || tracker.complete;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
markStreamComplete(streamId) {
|
|
107
|
+
const tracker = this.sequenceTrackers.get(streamId);
|
|
108
|
+
if (tracker) tracker.complete = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
isStreamComplete(streamId) {
|
|
112
|
+
const tracker = this.sequenceTrackers.get(streamId);
|
|
113
|
+
return tracker && tracker.complete;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
hasLostPackets(streamId) {
|
|
117
|
+
const tracker = this.sequenceTrackers.get(streamId);
|
|
118
|
+
return tracker && tracker.missing.length > 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getStreamStats(streamId) {
|
|
122
|
+
const tracker = this.sequenceTrackers.get(streamId);
|
|
123
|
+
const buffer = this.streamBuffers.get(streamId);
|
|
124
|
+
const playback = this.playbackBuffers.get(streamId);
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
buffered: buffer ? buffer.length : 0,
|
|
128
|
+
played: playback ? playback.length : 0,
|
|
129
|
+
totalSeq: tracker ? tracker.lastSeq + 1 : 0,
|
|
130
|
+
missing: tracker ? tracker.missing.length : 0,
|
|
131
|
+
outOfOrder: tracker ? tracker.outOfOrder : 0,
|
|
132
|
+
complete: tracker ? tracker.complete : false
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
cleanupStream(streamId) {
|
|
137
|
+
this.streamBuffers.delete(streamId);
|
|
138
|
+
this.playbackBuffers.delete(streamId);
|
|
139
|
+
this.sequenceTrackers.delete(streamId);
|
|
140
|
+
|
|
141
|
+
const keys = Array.from(this.chunkTimers.keys());
|
|
142
|
+
keys.forEach(key => {
|
|
143
|
+
if (key.startsWith(`${streamId}:`)) {
|
|
144
|
+
clearTimeout(this.chunkTimers.get(key));
|
|
145
|
+
this.chunkTimers.delete(key);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
window.TTSWebSocketHandler = TTSWebSocketHandler;
|
|
152
|
+
})();
|