@cnrai/pave 0.3.34 → 0.3.50

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -218
  3. package/package.json +32 -35
  4. package/pave.js +3 -0
  5. package/sandbox/SandboxRunner.js +1 -0
  6. package/sandbox/pave-run.js +2 -0
  7. package/sandbox/permission.js +1 -0
  8. package/sandbox/utils/yaml.js +1 -0
  9. package/MARKETPLACE.md +0 -406
  10. package/build-binary.js +0 -591
  11. package/build-npm.js +0 -537
  12. package/build.js +0 -230
  13. package/check-binary.js +0 -26
  14. package/deploy.sh +0 -95
  15. package/index.js +0 -5775
  16. package/lib/agent-registry.js +0 -1037
  17. package/lib/args-parser.js +0 -837
  18. package/lib/blessed-widget-patched.js +0 -93
  19. package/lib/cli-markdown.js +0 -590
  20. package/lib/compaction.js +0 -153
  21. package/lib/duration.js +0 -94
  22. package/lib/hash.js +0 -22
  23. package/lib/marketplace.js +0 -866
  24. package/lib/memory-config.js +0 -166
  25. package/lib/skill-manager.js +0 -891
  26. package/lib/soul.js +0 -31
  27. package/lib/tool-output-formatter.js +0 -180
  28. package/start-pave.sh +0 -149
  29. package/status.js +0 -271
  30. package/test/abort-stream.test.js +0 -445
  31. package/test/agent-auto-compaction.test.js +0 -552
  32. package/test/agent-comm-abort.test.js +0 -95
  33. package/test/agent-comm.test.js +0 -598
  34. package/test/agent-inbox.test.js +0 -576
  35. package/test/agent-init.test.js +0 -264
  36. package/test/agent-interrupt.test.js +0 -314
  37. package/test/agent-lifecycle.test.js +0 -520
  38. package/test/agent-log-files.test.js +0 -349
  39. package/test/agent-mode.manual-test.js +0 -392
  40. package/test/agent-parsing.test.js +0 -228
  41. package/test/agent-post-stream-idle.test.js +0 -762
  42. package/test/agent-registry.test.js +0 -359
  43. package/test/agent-rm.test.js +0 -442
  44. package/test/agent-spawn.test.js +0 -933
  45. package/test/agent-status-api.test.js +0 -624
  46. package/test/agent-update.test.js +0 -435
  47. package/test/args-parser.test.js +0 -391
  48. package/test/auto-compaction-chat.manual-test.js +0 -227
  49. package/test/auto-compaction.test.js +0 -941
  50. package/test/build-config.test.js +0 -120
  51. package/test/build-npm.test.js +0 -388
  52. package/test/chat-command.test.js +0 -137
  53. package/test/chat-leading-lines.test.js +0 -159
  54. package/test/config-flag.test.js +0 -272
  55. package/test/cursor-drift.test.js +0 -135
  56. package/test/debug-require.js +0 -23
  57. package/test/dir-migration.test.js +0 -323
  58. package/test/duration.test.js +0 -229
  59. package/test/ghostty-term.test.js +0 -202
  60. package/test/http500-backoff.test.js +0 -854
  61. package/test/integration.test.js +0 -86
  62. package/test/memory-guard-env.test.js +0 -220
  63. package/test/pr233-fixes.test.js +0 -259
  64. package/test/run-agent-init.js +0 -297
  65. package/test/run-all.js +0 -64
  66. package/test/run-config-flag.js +0 -159
  67. package/test/run-cursor-drift.js +0 -82
  68. package/test/run-session-path.js +0 -154
  69. package/test/run-tests.js +0 -643
  70. package/test/sandbox-redirect.test.js +0 -202
  71. package/test/session-path.test.js +0 -132
  72. package/test/shebang-strip.test.js +0 -241
  73. package/test/soul-reinject.test.js +0 -1027
  74. package/test/soul-reread.test.js +0 -281
  75. package/test/tool-output-formatter.test.js +0 -486
  76. package/test/tool-output-gating.test.js +0 -143
  77. package/test/tool-states.test.js +0 -167
  78. package/test/tools-flag.test.js +0 -65
  79. package/test/tui-attach.test.js +0 -1255
  80. package/test/tui-compaction.test.js +0 -354
  81. package/test/tui-wrap.test.js +0 -568
  82. package/test-binary.js +0 -52
  83. package/test-binary2.js +0 -36
@@ -1,166 +0,0 @@
1
- /**
2
- * Memory Configuration Bridge
3
- * Applies CLI arguments to OpenCode-Lite memory guard settings
4
- */
5
-
6
- const { getMemoryGuard } = require("../../opencode-lite/src/utils/memory-guard");
7
-
8
- /**
9
- * Apply memory configuration from CLI arguments
10
- * @param {Object} args - Parsed CLI arguments
11
- */
12
- function applyMemoryConfig(args) {
13
- const guard = getMemoryGuard();
14
- const originalIsISH = guard.isISH;
15
-
16
- // Override ISH mode if specified
17
- if (args.ishMode !== null) {
18
- guard.isISH = args.ishMode;
19
-
20
- if (args.ishMode !== originalIsISH) {
21
- console.log(`Memory guard: ISH mode ${args.ishMode ? 'ENABLED' : 'DISABLED'} via CLI argument`);
22
- }
23
- }
24
-
25
- // Apply custom memory limits if provided
26
- const hasCustomLimits = args.memoryLimit || args.memoryWarning || args.memoryCritical || args.memoryStartup;
27
-
28
- if (hasCustomLimits) {
29
- console.log("Memory guard: Applying custom memory limits from CLI arguments");
30
-
31
- // Start with current limits as base
32
- const _currentLimits = guard.limits;
33
- const _isISHMode = guard.isISH;
34
-
35
- // Create custom limits
36
- const customNormalLimits = { ...guard.normalLimits };
37
- const customStartupLimits = { ...guard.startupLimits };
38
-
39
- if (args.memoryLimit) {
40
- const limitBytes = args.memoryLimit * 1024 * 1024;
41
- customNormalLimits.heapUsed = limitBytes;
42
- customStartupLimits.heapUsed = Math.max(
43
- limitBytes, args.memoryStartup ? args.memoryStartup * 1024 * 1024 : limitBytes * 1.5,
44
- );
45
- console.log(` Heap limit: ${args.memoryLimit}MB`);
46
- }
47
-
48
- if (args.memoryWarning) {
49
- const warningBytes = args.memoryWarning * 1024 * 1024;
50
- // Warning is implemented as 80% of heap limit, so adjust heap limit accordingly
51
- const impliedHeapLimit = warningBytes / 0.8;
52
- customNormalLimits.heapUsed = impliedHeapLimit;
53
- customStartupLimits.heapUsed = Math.max(
54
- impliedHeapLimit,
55
- args.memoryStartup ? args.memoryStartup * 1024 * 1024 : impliedHeapLimit * 1.5,
56
- );
57
- console.log(` Warning threshold: ${args.memoryWarning}MB (implied heap limit: ${Math.round(impliedHeapLimit / 1024 / 1024)}MB)`);
58
- }
59
-
60
- if (args.memoryCritical) {
61
- const criticalBytes = args.memoryCritical * 1024 * 1024;
62
- customNormalLimits.critical = criticalBytes;
63
- customStartupLimits.critical = Math.max(criticalBytes, customStartupLimits.critical || criticalBytes * 1.5);
64
- console.log(` Critical threshold: ${args.memoryCritical}MB`);
65
- }
66
-
67
- if (args.memoryStartup) {
68
- const startupBytes = args.memoryStartup * 1024 * 1024;
69
- customStartupLimits.heapUsed = startupBytes;
70
- customStartupLimits.critical = Math.max(startupBytes * 1.5, customStartupLimits.critical || startupBytes * 2);
71
- console.log(` Startup limit: ${args.memoryStartup}MB`);
72
- }
73
-
74
- // Update the guard's limits
75
- guard.normalLimits = customNormalLimits;
76
- guard.startupLimits = customStartupLimits;
77
-
78
- // Apply the appropriate limit set based on current mode
79
- guard.limits = guard.startupMode ? customStartupLimits : customNormalLimits;
80
-
81
- console.log("Memory guard: Custom limits applied");
82
- console.log(` Normal mode: ${Math.round(customNormalLimits.heapUsed / 1024 / 1024)}MB heap, ${Math.round(customNormalLimits.critical / 1024 / 1024)}MB critical`);
83
- console.log(` Startup mode: ${Math.round(customStartupLimits.heapUsed / 1024 / 1024)}MB heap, ${Math.round(customStartupLimits.critical / 1024 / 1024)}MB critical`);
84
- }
85
-
86
- return guard;
87
- }
88
-
89
- /**
90
- * Apply environment variables from CLI arguments
91
- * @param {Object} args - Parsed CLI arguments
92
- */
93
- function applyEnvironmentConfig(args) {
94
- // Apply environment overrides (these are used by opencode-lite initialization)
95
- if (args.ishMode === true) {
96
- process.env.FORCE_ISH_MODE = 'true';
97
- } else if (args.ishMode === false) {
98
- process.env.FORCE_ISH_MODE = 'false';
99
- }
100
-
101
- if (args.port) {
102
- process.env.PORT = String(args.port);
103
- }
104
-
105
- if (args.host) {
106
- process.env.HOST = args.host;
107
- }
108
-
109
- if (args.opencodedir) {
110
- process.env.OPENCODE_DIR = args.opencodedir;
111
- }
112
-
113
- if (args.debug) {
114
- process.env.DEBUG = '1';
115
- }
116
-
117
- return {
118
- PORT: parseInt(process.env.PORT || "4096", 10),
119
- HOSTNAME: process.env.HOST || "127.0.0.1",
120
- CWD: process.env.OPENCODE_DIR || process.cwd(),
121
- HOME_DIR: process.env.HOME || "/root",
122
- DEBUG: process.env.DEBUG === '1',
123
- };
124
- }
125
-
126
- /**
127
- * Get memory monitoring configuration from arguments
128
- * @param {Object} args - Parsed CLI arguments
129
- * @returns {Object} Memory monitoring config
130
- */
131
- function getMemoryMonitorConfig(args) {
132
- const guard = getMemoryGuard();
133
-
134
- return {
135
- enabled: args.memoryMonitor !== null ? args.memoryMonitor : guard.isISH,
136
- interval: guard.isISH ? 5000 : 30000,
137
- verbose: args.verbose || args.debug,
138
- };
139
- }
140
-
141
- /**
142
- * Print effective memory configuration for debugging
143
- */
144
- function printMemoryConfig() {
145
- const guard = getMemoryGuard();
146
- const limits = guard.limits;
147
-
148
- console.log("\nEFFECTIVE MEMORY CONFIGURATION:");
149
- console.log(" ISH mode:", guard.isISH ? "YES" : "NO");
150
- console.log(" Current mode:", guard.startupMode ? "STARTUP" : "NORMAL");
151
- console.log(" Heap limit:", Math.round(limits.heapUsed / 1024 / 1024) + "MB");
152
- console.log(" Critical threshold:", Math.round(limits.critical / 1024 / 1024) + "MB");
153
- console.log(" Warning at:", Math.round(limits.heapUsed * 0.8 / 1024 / 1024) + "MB (80% of limit)");
154
-
155
- if (guard.startupMode) {
156
- const normalLimits = guard.normalLimits;
157
- console.log(" Normal mode limits:", Math.round(normalLimits.heapUsed / 1024 / 1024) + "MB heap");
158
- }
159
- }
160
-
161
- module.exports = {
162
- applyMemoryConfig,
163
- applyEnvironmentConfig,
164
- getMemoryMonitorConfig,
165
- printMemoryConfig,
166
- };