agentgui 1.0.273 → 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.
Files changed (71) hide show
  1. package/CLAUDE.md +280 -280
  2. package/IPFS_DOWNLOADER.md +277 -277
  3. package/TASK_2C_COMPLETION.md +334 -334
  4. package/bin/gmgui.cjs +54 -54
  5. package/build-portable.js +111 -0
  6. package/database.js +1422 -1406
  7. package/lib/claude-runner.js +1130 -1130
  8. package/lib/ipfs-downloader.js +459 -459
  9. package/lib/speech.js +152 -152
  10. package/package.json +1 -1
  11. package/portable-entry.js +43 -0
  12. package/readme.md +76 -76
  13. package/scripts/inject-pe-section.py +185 -0
  14. package/server.js +3787 -3794
  15. package/setup-npm-token.sh +68 -68
  16. package/static/app.js +773 -773
  17. package/static/event-rendering-showcase.html +708 -708
  18. package/static/index.html +3178 -3180
  19. package/static/js/agent-auth.js +298 -298
  20. package/static/js/audio-recorder-processor.js +18 -18
  21. package/static/js/client.js +2656 -2656
  22. package/static/js/conversations.js +583 -583
  23. package/static/js/dialogs.js +267 -267
  24. package/static/js/event-consolidator.js +101 -101
  25. package/static/js/event-filter.js +311 -311
  26. package/static/js/event-processor.js +452 -452
  27. package/static/js/features.js +413 -413
  28. package/static/js/kalman-filter.js +67 -67
  29. package/static/js/progress-dialog.js +130 -130
  30. package/static/js/script-runner.js +219 -219
  31. package/static/js/streaming-renderer.js +2123 -2120
  32. package/static/js/syntax-highlighter.js +269 -269
  33. package/static/js/tts-websocket-handler.js +152 -152
  34. package/static/js/ui-components.js +431 -431
  35. package/static/js/voice.js +849 -849
  36. package/static/js/websocket-manager.js +596 -596
  37. package/static/templates/INDEX.html +465 -465
  38. package/static/templates/README.md +190 -190
  39. package/static/templates/agent-capabilities.html +56 -56
  40. package/static/templates/agent-metadata-panel.html +44 -44
  41. package/static/templates/agent-status-badge.html +30 -30
  42. package/static/templates/code-annotation-panel.html +155 -155
  43. package/static/templates/code-suggestion-panel.html +184 -184
  44. package/static/templates/command-header.html +77 -77
  45. package/static/templates/command-output-scrollable.html +118 -118
  46. package/static/templates/elapsed-time.html +54 -54
  47. package/static/templates/error-alert.html +106 -106
  48. package/static/templates/error-history-timeline.html +160 -160
  49. package/static/templates/error-recovery-options.html +109 -109
  50. package/static/templates/error-stack-trace.html +95 -95
  51. package/static/templates/error-summary.html +80 -80
  52. package/static/templates/event-counter.html +48 -48
  53. package/static/templates/execution-actions.html +97 -97
  54. package/static/templates/execution-progress-bar.html +80 -80
  55. package/static/templates/execution-stepper.html +120 -120
  56. package/static/templates/file-breadcrumb.html +118 -118
  57. package/static/templates/file-diff-viewer.html +121 -121
  58. package/static/templates/file-metadata.html +133 -133
  59. package/static/templates/file-read-panel.html +66 -66
  60. package/static/templates/file-write-panel.html +120 -120
  61. package/static/templates/git-branch-remote.html +107 -107
  62. package/static/templates/git-diff-list.html +101 -101
  63. package/static/templates/git-log-visualization.html +153 -153
  64. package/static/templates/git-status-panel.html +115 -115
  65. package/static/templates/quality-metrics-display.html +170 -170
  66. package/static/templates/terminal-output-panel.html +87 -87
  67. package/static/templates/test-results-display.html +144 -144
  68. package/static/theme.js +72 -72
  69. package/test-download-progress.js +223 -223
  70. package/test-websocket-broadcast.js +147 -147
  71. 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;