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
package/bin/gmgui.cjs CHANGED
@@ -1,20 +1,20 @@
1
- #!/usr/bin/env node
2
- const { spawn, spawnSync } = require('child_process');
3
- const path = require('path');
4
- const fs = require('fs');
5
-
6
- const projectRoot = path.join(__dirname, '..');
7
-
8
- async function gmgui(args = []) {
9
- const command = args[0] || 'start';
10
-
11
- if (command === 'start') {
12
- // Always use node as runtime for reliability. When invoked via bunx,
13
- // dependencies are already managed. When invoked via npm/npx, we install
14
- // dependencies ourselves. This avoids ENOENT errors on systems where bun
15
- // may not be in PATH even though bunx works.
16
- const installer = 'npm';
17
-
1
+ #!/usr/bin/env node
2
+ const { spawn, spawnSync } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+
6
+ const projectRoot = path.join(__dirname, '..');
7
+
8
+ async function gmgui(args = []) {
9
+ const command = args[0] || 'start';
10
+
11
+ if (command === 'start') {
12
+ // Always use node as runtime for reliability. When invoked via bunx,
13
+ // dependencies are already managed. When invoked via npm/npx, we install
14
+ // dependencies ourselves. This avoids ENOENT errors on systems where bun
15
+ // may not be in PATH even though bunx works.
16
+ const installer = 'npm';
17
+
18
18
  // Ensure dependencies are installed only if node_modules is missing
19
19
  // Skip this for bunx/npx which manage dependencies independently
20
20
  const nodeModulesPath = path.join(projectRoot, 'node_modules');
@@ -40,40 +40,40 @@ async function gmgui(args = []) {
40
40
  throw new Error(`${installer} install failed: ${installResult.error.message}`);
41
41
  }
42
42
  }
43
-
44
- const port = process.env.PORT || 3000;
45
- const baseUrl = process.env.BASE_URL || '/gm';
46
- const runtime = 'node';
47
-
48
- return new Promise((resolve, reject) => {
49
- const ps = spawn(runtime, [path.join(projectRoot, 'server.js')], {
50
- cwd: projectRoot,
51
- env: { ...process.env, PORT: port, BASE_URL: baseUrl, STARTUP_CWD: process.cwd() },
52
- stdio: 'inherit'
53
- });
54
-
55
- ps.on('error', (err) => {
56
- console.error(`Failed to start server: ${err.message}`);
57
- reject(err);
58
- });
59
-
60
- ps.on('exit', (code) => {
61
- if (code !== 0) {
62
- console.error(`Server exited with code ${code}`);
63
- // Don't reject - keep the promise pending so process stays alive
64
- }
65
- });
66
-
67
- // Never resolve this promise - keeps the process alive indefinitely
68
- });
69
- } else {
70
- throw new Error(`Unknown command: ${command}`);
71
- }
72
- }
73
-
74
- // Always run when executed as a bin file (this file should only be used that way)
75
- // Works with npm, npx, bunx, and direct execution
76
- gmgui(process.argv.slice(2)).catch(err => {
77
- console.error(err.message);
78
- process.exit(1);
79
- });
43
+
44
+ const port = process.env.PORT || 3000;
45
+ const baseUrl = process.env.BASE_URL || '/gm';
46
+ const runtime = 'node';
47
+
48
+ return new Promise((resolve, reject) => {
49
+ const ps = spawn(runtime, [path.join(projectRoot, 'server.js')], {
50
+ cwd: projectRoot,
51
+ env: { ...process.env, PORT: port, BASE_URL: baseUrl, STARTUP_CWD: process.cwd() },
52
+ stdio: 'inherit'
53
+ });
54
+
55
+ ps.on('error', (err) => {
56
+ console.error(`Failed to start server: ${err.message}`);
57
+ reject(err);
58
+ });
59
+
60
+ ps.on('exit', (code) => {
61
+ if (code !== 0) {
62
+ console.error(`Server exited with code ${code}`);
63
+ // Don't reject - keep the promise pending so process stays alive
64
+ }
65
+ });
66
+
67
+ // Never resolve this promise - keeps the process alive indefinitely
68
+ });
69
+ } else {
70
+ throw new Error(`Unknown command: ${command}`);
71
+ }
72
+ }
73
+
74
+ // Always run when executed as a bin file (this file should only be used that way)
75
+ // Works with npm, npx, bunx, and direct execution
76
+ gmgui(process.argv.slice(2)).catch(err => {
77
+ console.error(err.message);
78
+ process.exit(1);
79
+ });
@@ -0,0 +1,111 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { execSync } from 'child_process';
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const src = __dirname;
8
+ const out = path.join(src, '..', 'wagentgui');
9
+ const nm = path.join(src, 'node_modules');
10
+
11
+ function log(msg) { console.log('[BUILD] ' + msg); }
12
+
13
+ function rmrf(dir) {
14
+ if (!fs.existsSync(dir)) return;
15
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
16
+ const fp = path.join(dir, entry.name);
17
+ if (entry.isDirectory()) fs.rmSync(fp, { recursive: true, force: true });
18
+ else fs.unlinkSync(fp);
19
+ }
20
+ }
21
+
22
+ function copyDir(from, to) {
23
+ if (!fs.existsSync(from)) return;
24
+ fs.mkdirSync(to, { recursive: true });
25
+ for (const entry of fs.readdirSync(from, { withFileTypes: true })) {
26
+ const s = path.join(from, entry.name);
27
+ const d = path.join(to, entry.name);
28
+ if (entry.isDirectory()) copyDir(s, d);
29
+ else fs.copyFileSync(s, d);
30
+ }
31
+ }
32
+
33
+ function copyFile(from, to) {
34
+ fs.mkdirSync(path.dirname(to), { recursive: true });
35
+ fs.copyFileSync(from, to);
36
+ }
37
+
38
+ function sizeOf(dir) {
39
+ if (!fs.existsSync(dir)) return 0;
40
+ let sz = 0;
41
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
42
+ const fp = path.join(dir, e.name);
43
+ sz += e.isDirectory() ? sizeOf(fp) : fs.statSync(fp).size;
44
+ }
45
+ return sz;
46
+ }
47
+
48
+ log('Output: ' + out);
49
+ rmrf(out);
50
+ fs.mkdirSync(out, { recursive: true });
51
+
52
+ log('Compiling Windows executable...');
53
+ execSync(
54
+ `~/.bun/bin/bun build --compile --target=bun-windows-x64 --outfile=${path.join(out, 'agentgui.exe')} ${path.join(src, 'portable-entry.js')}`,
55
+ { stdio: 'inherit', cwd: src }
56
+ );
57
+
58
+ const exeSize = fs.statSync(path.join(out, 'agentgui.exe')).size;
59
+ const buf = Buffer.alloc(2);
60
+ const fd = fs.openSync(path.join(out, 'agentgui.exe'), 'r');
61
+ fs.readSync(fd, buf, 0, 2, 0);
62
+ fs.closeSync(fd);
63
+ if (buf[0] !== 0x4D || buf[1] !== 0x5A) throw new Error('Output exe is not a valid PE file (bad MZ magic)');
64
+ log(`Exe compiled: ${Math.round(exeSize / 1024 / 1024)}MB (valid PE)`);
65
+
66
+ log('Copying static files...');
67
+ copyDir(path.join(src, 'static'), path.join(out, 'static'));
68
+
69
+ const destNm = path.join(out, 'node_modules');
70
+
71
+ log('Copying @huggingface/transformers (dist + win32 natives)...');
72
+ const hfSrc = path.join(nm, '@huggingface', 'transformers');
73
+ const hfDest = path.join(destNm, '@huggingface', 'transformers');
74
+ copyFile(path.join(hfSrc, 'package.json'), path.join(hfDest, 'package.json'));
75
+ copyDir(path.join(hfSrc, 'dist'), path.join(hfDest, 'dist'));
76
+ const hfNmSrc = path.join(hfSrc, 'node_modules');
77
+ const hfNmDest = path.join(hfDest, 'node_modules');
78
+ const hfOnnxSrc = path.join(hfNmSrc, 'onnxruntime-node');
79
+ const hfOnnxDest = path.join(hfNmDest, 'onnxruntime-node');
80
+ copyFile(path.join(hfOnnxSrc, 'package.json'), path.join(hfOnnxDest, 'package.json'));
81
+ copyDir(path.join(hfOnnxSrc, 'dist'), path.join(hfOnnxDest, 'dist'));
82
+ copyDir(path.join(hfOnnxSrc, 'lib'), path.join(hfOnnxDest, 'lib'));
83
+ copyDir(path.join(hfOnnxSrc, 'bin', 'napi-v3', 'win32', 'x64'), path.join(hfOnnxDest, 'bin', 'napi-v3', 'win32', 'x64'));
84
+ copyDir(path.join(hfNmSrc, 'onnxruntime-common'), path.join(hfNmDest, 'onnxruntime-common'));
85
+
86
+ log('Copying webtalk...');
87
+ copyDir(path.join(nm, 'webtalk'), path.join(destNm, 'webtalk'));
88
+
89
+ log('Copying @anthropic-ai/claude-code ripgrep (win32)...');
90
+ const claudeSrc = path.join(nm, '@anthropic-ai', 'claude-code');
91
+ const claudeDest = path.join(destNm, '@anthropic-ai', 'claude-code');
92
+ copyFile(path.join(claudeSrc, 'package.json'), path.join(claudeDest, 'package.json'));
93
+ copyDir(path.join(claudeSrc, 'vendor', 'ripgrep', 'x64-win32'), path.join(claudeDest, 'vendor', 'ripgrep', 'x64-win32'));
94
+
95
+ log('Creating data directory...');
96
+ fs.mkdirSync(path.join(out, 'data'), { recursive: true });
97
+
98
+ fs.writeFileSync(path.join(out, 'README.txt'), [
99
+ '# AgentGUI Portable',
100
+ '',
101
+ 'No installation required. Double-click agentgui.exe to start.',
102
+ '',
103
+ 'Web interface: http://localhost:3000/gm/',
104
+ '',
105
+ 'Data is stored in the data/ folder next to the executable.',
106
+ '',
107
+ 'Requirements: None - fully self-contained.',
108
+ ].join('\n'));
109
+
110
+ const totalMB = Math.round(sizeOf(out) / 1024 / 1024);
111
+ log(`Build complete! Total: ${totalMB}MB Output: ${out}`);