agentgui 1.0.274 → 1.0.275
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/bin/gmgui.cjs +54 -54
- package/build-portable.js +3 -42
- package/database.js +1422 -1406
- package/lib/claude-runner.js +1130 -1130
- package/lib/ipfs-downloader.js +459 -459
- package/lib/speech.js +152 -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,101 +1,101 @@
|
|
|
1
|
-
class EventConsolidator {
|
|
2
|
-
consolidate(chunks) {
|
|
3
|
-
const stats = { original: chunks.length, deduplicated: 0, textMerged: 0, toolsCollapsed: 0, systemSuperseded: 0 };
|
|
4
|
-
if (chunks.length <= 1) return { consolidated: chunks, stats };
|
|
5
|
-
|
|
6
|
-
const sorted = chunks.slice().sort((a, b) => (a.sequence || 0) - (b.sequence || 0));
|
|
7
|
-
|
|
8
|
-
const seen = new Set();
|
|
9
|
-
const deduped = [];
|
|
10
|
-
for (const c of sorted) {
|
|
11
|
-
const key = c.sessionId + ':' + c.sequence;
|
|
12
|
-
if (c.sequence !== undefined && seen.has(key)) { stats.deduplicated++; continue; }
|
|
13
|
-
if (c.sequence !== undefined) seen.add(key);
|
|
14
|
-
deduped.push(c);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const bySession = {};
|
|
18
|
-
for (const c of deduped) {
|
|
19
|
-
const sid = c.sessionId || '_';
|
|
20
|
-
if (!bySession[sid]) bySession[sid] = [];
|
|
21
|
-
bySession[sid].push(c);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const result = [];
|
|
25
|
-
for (const sid of Object.keys(bySession)) {
|
|
26
|
-
const sessionChunks = bySession[sid];
|
|
27
|
-
const merged = this._mergeTextBlocks(sessionChunks, stats);
|
|
28
|
-
this._collapseToolPairs(merged, stats);
|
|
29
|
-
const superseded = this._supersedeSystemBlocks(merged, stats);
|
|
30
|
-
result.push(...superseded);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
result.sort((a, b) => (a.sequence || 0) - (b.sequence || 0));
|
|
34
|
-
return { consolidated: result, stats };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
_mergeTextBlocks(chunks, stats) {
|
|
38
|
-
const result = [];
|
|
39
|
-
let pending = null;
|
|
40
|
-
const MAX_MERGE = 50 * 1024;
|
|
41
|
-
|
|
42
|
-
for (const c of chunks) {
|
|
43
|
-
if (c.block?.type === 'text') {
|
|
44
|
-
if (pending) {
|
|
45
|
-
const pendingText = pending.block.text || '';
|
|
46
|
-
const newText = c.block.text || '';
|
|
47
|
-
const combined = pendingText + newText;
|
|
48
|
-
if (combined.length <= MAX_MERGE) {
|
|
49
|
-
const needsSpace = pendingText.length > 0 && !pendingText.endsWith(' ') && !pendingText.endsWith('\n') && newText.length > 0 && !newText.startsWith(' ') && !newText.startsWith('\n');
|
|
50
|
-
pending = {
|
|
51
|
-
...pending,
|
|
52
|
-
block: { ...pending.block, text: needsSpace ? pendingText + ' ' + newText : combined },
|
|
53
|
-
created_at: c.created_at,
|
|
54
|
-
_mergedSequences: [...(pending._mergedSequences || [pending.sequence]), c.sequence]
|
|
55
|
-
};
|
|
56
|
-
stats.textMerged++;
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (pending) result.push(pending);
|
|
61
|
-
pending = { ...c, _mergedSequences: [c.sequence] };
|
|
62
|
-
} else {
|
|
63
|
-
if (pending) { result.push(pending); pending = null; }
|
|
64
|
-
result.push(c);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (pending) result.push(pending);
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
_collapseToolPairs(chunks, stats) {
|
|
72
|
-
const toolUseMap = {};
|
|
73
|
-
for (const c of chunks) {
|
|
74
|
-
if (c.block?.type === 'tool_use' && c.block.id) toolUseMap[c.block.id] = c;
|
|
75
|
-
}
|
|
76
|
-
for (const c of chunks) {
|
|
77
|
-
if (c.block?.type === 'tool_result' && c.block.tool_use_id) {
|
|
78
|
-
const match = toolUseMap[c.block.tool_use_id];
|
|
79
|
-
if (match) {
|
|
80
|
-
match.block._hasResult = true;
|
|
81
|
-
c.block._collapsed = true;
|
|
82
|
-
stats.toolsCollapsed++;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
_supersedeSystemBlocks(chunks, stats) {
|
|
89
|
-
const systemIndices = [];
|
|
90
|
-
for (let i = 0; i < chunks.length; i++) {
|
|
91
|
-
if (chunks[i].block?.type === 'system') systemIndices.push(i);
|
|
92
|
-
}
|
|
93
|
-
if (systemIndices.length <= 1) return chunks;
|
|
94
|
-
const keep = new Set();
|
|
95
|
-
keep.add(systemIndices[systemIndices.length - 1]);
|
|
96
|
-
stats.systemSuperseded += systemIndices.length - 1;
|
|
97
|
-
return chunks.filter((_, i) => !systemIndices.includes(i) || keep.has(i));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (typeof module !== 'undefined' && module.exports) module.exports = EventConsolidator;
|
|
1
|
+
class EventConsolidator {
|
|
2
|
+
consolidate(chunks) {
|
|
3
|
+
const stats = { original: chunks.length, deduplicated: 0, textMerged: 0, toolsCollapsed: 0, systemSuperseded: 0 };
|
|
4
|
+
if (chunks.length <= 1) return { consolidated: chunks, stats };
|
|
5
|
+
|
|
6
|
+
const sorted = chunks.slice().sort((a, b) => (a.sequence || 0) - (b.sequence || 0));
|
|
7
|
+
|
|
8
|
+
const seen = new Set();
|
|
9
|
+
const deduped = [];
|
|
10
|
+
for (const c of sorted) {
|
|
11
|
+
const key = c.sessionId + ':' + c.sequence;
|
|
12
|
+
if (c.sequence !== undefined && seen.has(key)) { stats.deduplicated++; continue; }
|
|
13
|
+
if (c.sequence !== undefined) seen.add(key);
|
|
14
|
+
deduped.push(c);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const bySession = {};
|
|
18
|
+
for (const c of deduped) {
|
|
19
|
+
const sid = c.sessionId || '_';
|
|
20
|
+
if (!bySession[sid]) bySession[sid] = [];
|
|
21
|
+
bySession[sid].push(c);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const result = [];
|
|
25
|
+
for (const sid of Object.keys(bySession)) {
|
|
26
|
+
const sessionChunks = bySession[sid];
|
|
27
|
+
const merged = this._mergeTextBlocks(sessionChunks, stats);
|
|
28
|
+
this._collapseToolPairs(merged, stats);
|
|
29
|
+
const superseded = this._supersedeSystemBlocks(merged, stats);
|
|
30
|
+
result.push(...superseded);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
result.sort((a, b) => (a.sequence || 0) - (b.sequence || 0));
|
|
34
|
+
return { consolidated: result, stats };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_mergeTextBlocks(chunks, stats) {
|
|
38
|
+
const result = [];
|
|
39
|
+
let pending = null;
|
|
40
|
+
const MAX_MERGE = 50 * 1024;
|
|
41
|
+
|
|
42
|
+
for (const c of chunks) {
|
|
43
|
+
if (c.block?.type === 'text') {
|
|
44
|
+
if (pending) {
|
|
45
|
+
const pendingText = pending.block.text || '';
|
|
46
|
+
const newText = c.block.text || '';
|
|
47
|
+
const combined = pendingText + newText;
|
|
48
|
+
if (combined.length <= MAX_MERGE) {
|
|
49
|
+
const needsSpace = pendingText.length > 0 && !pendingText.endsWith(' ') && !pendingText.endsWith('\n') && newText.length > 0 && !newText.startsWith(' ') && !newText.startsWith('\n');
|
|
50
|
+
pending = {
|
|
51
|
+
...pending,
|
|
52
|
+
block: { ...pending.block, text: needsSpace ? pendingText + ' ' + newText : combined },
|
|
53
|
+
created_at: c.created_at,
|
|
54
|
+
_mergedSequences: [...(pending._mergedSequences || [pending.sequence]), c.sequence]
|
|
55
|
+
};
|
|
56
|
+
stats.textMerged++;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (pending) result.push(pending);
|
|
61
|
+
pending = { ...c, _mergedSequences: [c.sequence] };
|
|
62
|
+
} else {
|
|
63
|
+
if (pending) { result.push(pending); pending = null; }
|
|
64
|
+
result.push(c);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (pending) result.push(pending);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_collapseToolPairs(chunks, stats) {
|
|
72
|
+
const toolUseMap = {};
|
|
73
|
+
for (const c of chunks) {
|
|
74
|
+
if (c.block?.type === 'tool_use' && c.block.id) toolUseMap[c.block.id] = c;
|
|
75
|
+
}
|
|
76
|
+
for (const c of chunks) {
|
|
77
|
+
if (c.block?.type === 'tool_result' && c.block.tool_use_id) {
|
|
78
|
+
const match = toolUseMap[c.block.tool_use_id];
|
|
79
|
+
if (match) {
|
|
80
|
+
match.block._hasResult = true;
|
|
81
|
+
c.block._collapsed = true;
|
|
82
|
+
stats.toolsCollapsed++;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_supersedeSystemBlocks(chunks, stats) {
|
|
89
|
+
const systemIndices = [];
|
|
90
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
91
|
+
if (chunks[i].block?.type === 'system') systemIndices.push(i);
|
|
92
|
+
}
|
|
93
|
+
if (systemIndices.length <= 1) return chunks;
|
|
94
|
+
const keep = new Set();
|
|
95
|
+
keep.add(systemIndices[systemIndices.length - 1]);
|
|
96
|
+
stats.systemSuperseded += systemIndices.length - 1;
|
|
97
|
+
return chunks.filter((_, i) => !systemIndices.includes(i) || keep.has(i));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (typeof module !== 'undefined' && module.exports) module.exports = EventConsolidator;
|