@cnrai/pave 0.3.35 → 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 -5776
  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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 CNRAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,237 +1,40 @@
1
- # PAVE - Personal AI Virtual Environment
1
+ # @cnrai/pave
2
2
 
3
- PAVE combines an OpenCode-Lite server with a terminal UI client in a single process, specifically optimized for resource-constrained environments like iSH on iOS.
3
+ PAVE - Personal AI Virtual Environment. AI agent framework for the terminal.
4
4
 
5
- ## Features
5
+ ## Installation
6
6
 
7
- - **Resource-Efficient**: Runs smoothly on iSH iOS with Node 16
8
- - **Configurable Memory Management**: CLI arguments for fine-tuning memory limits
9
- - **Auto-Detection**: Automatically detects iSH environment and applies appropriate settings
10
- - **Terminal UI**: Real-time chat interface with markdown rendering
11
- - **Embedded Server**: No separate server process required
12
-
13
- ## Quick Start
14
-
15
- ### Standard Usage
16
- ```bash
17
- node index.js
18
- ```
19
-
20
- ### ISH/iOS Usage
21
- ```bash
22
- # Using startup script (recommended)
23
- ./start-pave.sh
24
-
25
- # Or manually with garbage collection
26
- node --expose-gc index.js
27
- ```
28
-
29
- ## CLI Options
30
-
31
- ### Memory Configuration
32
- Perfect for ISH and other resource-constrained environments:
33
-
34
- ```bash
35
- # Force ISH mode with custom memory limits
36
- node index.js --ish-mode --memory-limit 16 --memory-warning 12
37
-
38
- # Disable memory monitoring
39
- node index.js --memory-monitor off
40
-
41
- # Custom startup memory allowance (for large JS bundles)
42
- node index.js --memory-startup 64 --memory-limit 12
43
- ```
44
-
45
- ### Server Configuration
46
- ```bash
47
- # Custom port and host
48
- node index.js --port 8080 --host 0.0.0.0
49
-
50
- # Custom working directory
51
- node index.js --opencode-dir /path/to/workspace
52
- ```
53
-
54
- ### Debug Options
55
- ```bash
56
- # Debug mode with verbose logging
57
- node index.js --debug --verbose
58
-
59
- # Help and version
60
- node index.js --help
61
- node index.js --version
62
- ```
63
-
64
- ## Memory Management Options
65
-
66
- | Option | Description | Default |
67
- |--------|-------------|---------|
68
- | `--ish-mode [on\|off]` | Force ISH mode detection | Auto-detected |
69
- | `--memory-limit <MB>` | Heap memory limit | 8MB (ISH), 100MB (standard) |
70
- | `--memory-warning <MB>` | Warning threshold | 80% of limit |
71
- | `--memory-critical <MB>` | Critical threshold | Same as limit |
72
- | `--memory-startup <MB>` | Startup limit | Higher to allow init |
73
- | `--memory-monitor [on\|off]` | Enable monitoring | Auto (ISH=on) |
74
-
75
- ## Environment Variables
76
-
77
- CLI arguments override environment variables:
78
-
79
- | Variable | CLI Override | Description |
80
- |----------|--------------|-------------|
81
- | `PORT` | `--port` | Server port (default: 4096) |
82
- | `HOST` | `--host` | Server hostname (default: 127.0.0.1) |
83
- | `OPENCODE_DIR` | `--opencode-dir` | Working directory |
84
- | `FORCE_ISH_MODE` | `--ish-mode` | Force ISH mode |
85
- | `DEBUG` | `--debug` | Enable debug logging |
86
-
87
- ## ISH/iOS Optimization
88
-
89
- PAVE is specifically designed to run efficiently on iSH:
90
-
91
- ### Automatic Detection
92
- ```bash
93
- # These indicators trigger ISH mode:
94
- # - platform === 'linux'
95
- # - TERM_PROGRAM === 'iSH'
96
- # - /etc/alpine-release exists
97
- # - Node version contains 'alpine'
98
- ```
99
-
100
- ### Memory Protection
101
- ```bash
102
- # ISH mode automatically enables:
103
- # - 8MB heap limit (vs 100MB standard)
104
- # - Memory monitoring every 5 seconds
105
- # - Aggressive garbage collection
106
- # - Emergency cleanup on memory pressure
107
- # - Process termination before system crash
108
- ```
109
-
110
- ### Recommended ISH Setup
111
7
  ```bash
112
- # Install with garbage collection support
113
- node --expose-gc index.js
114
-
115
- # Or use the startup script
116
- ./start-pave.sh
117
-
118
- # For persistent use, create an alias
119
- echo 'alias pave="cd /path/to/pave && ./start-pave.sh"' >> ~/.profile
8
+ npm install -g @cnrai/pave
120
9
  ```
121
10
 
122
- ## Examples
11
+ ## Usage
123
12
 
124
- ### Basic Usage
125
13
  ```bash
126
- # Auto-detected environment
127
- node index.js
128
-
129
- # With debug logging
130
- node index.js --debug
14
+ pave # Launch TUI
15
+ pave --help # Show help
16
+ pave --version # Show version
17
+ pave chat "question" # Quick chat
131
18
  ```
132
19
 
133
- ### ISH Customization
134
- ```bash
135
- # Conservative memory settings
136
- node index.js --memory-limit 6 --memory-warning 4
137
-
138
- # Higher startup allowance for large projects
139
- node index.js --memory-startup 32 --memory-limit 8
20
+ ### iSH (iOS)
140
21
 
141
- # Force ISH mode for testing
142
- node index.js --ish-mode --debug
143
- ```
144
-
145
- ### Development Setup
146
22
  ```bash
147
- # Custom server for development
148
- node index.js --port 3000 --host 0.0.0.0 --debug --verbose
149
-
150
- # Disable memory monitoring for debugging
151
- node index.js --memory-monitor off --debug
23
+ npm install -g @cnrai/pave
24
+ pave # Auto-detects iSH and applies optimized Node flags
152
25
  ```
153
26
 
154
- ### Production ISH Setup
155
- ```bash
156
- # Optimized for production use in iSH
157
- ./start-pave.sh --memory-limit 12 --memory-warning 8
158
- ```
159
-
160
- ## Startup Script
161
-
162
- The `start-pave.sh` script provides additional convenience:
163
-
164
- ```bash
165
- # Standard startup with auto-detection
166
- ./start-pave.sh
167
-
168
- # Force ISH mode
169
- ./start-pave.sh --ish-mode
170
-
171
- # Custom memory limit
172
- ./start-pave.sh --memory-limit 32
173
-
174
- # Debug mode
175
- ./start-pave.sh --debug --verbose
176
-
177
- # Disable garbage collection
178
- ./start-pave.sh --no-gc
179
- ```
180
-
181
- ## Troubleshooting
182
-
183
- ### Memory Issues
184
- ```bash
185
- # Check current memory usage
186
- node index.js --debug --verbose
187
-
188
- # Lower memory limits
189
- node index.js --memory-limit 6 --memory-warning 4
190
-
191
- # Disable monitoring temporarily
192
- node index.js --memory-monitor off
193
- ```
194
-
195
- ### ISH Detection Issues
196
- ```bash
197
- # Force ISH mode
198
- node index.js --ish-mode
199
-
200
- # Check detection
201
- FORCE_ISH_MODE=true node index.js --debug
202
- ```
203
-
204
- ### Performance Issues
205
- ```bash
206
- # Enable garbage collection
207
- node --expose-gc index.js
208
-
209
- # Use startup script
210
- ./start-pave.sh
211
-
212
- # Check memory configuration
213
- node index.js --debug | grep -i memory
214
- ```
215
-
216
- ## Architecture
27
+ ## Requirements
217
28
 
218
- PAVE runs OpenCode-Lite and the TUI client in the same Node.js process:
29
+ - Node.js >= 16.0.0
30
+ - A GitHub Copilot subscription (for the AI backend)
219
31
 
220
- 1. **Server starts** with configurable memory limits
221
- 2. **Console redirected** to log file to avoid TUI corruption
222
- 3. **TUI launches** and connects to embedded server
223
- 4. **Memory monitoring** starts when first session is activated
224
- 5. **Automatic cleanup** prevents memory exhaustion crashes
32
+ ## Links
225
33
 
226
- This architecture is specifically designed for environments where:
227
- - Memory is extremely limited (8MB heap in iSH)
228
- - Process spawning is expensive
229
- - Terminal UI corruption must be avoided
230
- - Reliability is critical (no crashes in mobile environment)
34
+ - Source: https://github.com/cnrai/openpave
35
+ - Issues: https://github.com/cnrai/openpave/issues
36
+ - Homebrew (native binary): `brew tap cnrai/tap && brew install pave`
231
37
 
232
- ## Requirements
38
+ ## License
233
39
 
234
- - Node.js 16+ (tested extensively on iSH iOS)
235
- - 12MB+ available memory (8MB for heap + overhead)
236
- - Terminal with basic ANSI support
237
- - Optional: `--expose-gc` for optimal memory management
40
+ MIT - Copyright (c) 2025 CNRAI
package/package.json CHANGED
@@ -1,36 +1,14 @@
1
1
  {
2
2
  "name": "@cnrai/pave",
3
- "version": "0.3.35",
4
- "description": "Personal AI Virtual Environment - Terminal UI + OpenCode-Lite Server",
5
- "main": "index.js",
3
+ "version": "0.3.50",
4
+ "description": "PAVE - Personal AI Virtual Environment. AI agent framework for the terminal.",
5
+ "main": "pave.js",
6
6
  "bin": {
7
- "pave": "./index.js"
7
+ "pave": "./pave.js"
8
8
  },
9
9
  "scripts": {
10
- "start": "node index.js",
11
- "start:ish": "node --expose-gc index.js",
12
- "start:debug": "node --expose-gc index.js --debug --verbose",
13
- "help": "node index.js --help",
14
- "build": "node build.js",
15
- "build:install": "node build.js --install",
16
- "build:npm": "node build-npm.js",
17
- "build:npm:publish": "node build-npm.js --publish",
18
- "clean": "rm -rf dist",
19
- "test": "node test/run-tests.js",
20
- "test:verbose": "node test/run-tests.js --verbose",
21
- "test:ish": "node test/ish-fetch.test.js",
22
- "status": "node status.js"
10
+ "start": "node pave.js"
23
11
  },
24
- "keywords": [
25
- "ai",
26
- "terminal",
27
- "tui",
28
- "opencode",
29
- "ish",
30
- "ios",
31
- "memory-efficient",
32
- "resource-constrained"
33
- ],
34
12
  "engines": {
35
13
  "node": ">=16.0.0"
36
14
  },
@@ -40,15 +18,34 @@
40
18
  "win32"
41
19
  ],
42
20
  "dependencies": {
43
- "abort-controller": "^3.0.0",
44
- "figlet": "^1.10.0",
45
- "js-yaml": "^4.1.0",
46
- "ulid": "^2.3.0"
21
+ "blessed": "^0.1.81",
22
+ "js-yaml": "^4.1.0"
23
+ },
24
+ "files": [
25
+ "pave.js",
26
+ "sandbox/",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "keywords": [
31
+ "ai",
32
+ "terminal",
33
+ "tui",
34
+ "agent",
35
+ "cli",
36
+ "ish",
37
+ "ios",
38
+ "node16",
39
+ "memory-efficient"
40
+ ],
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/cnrai/openpave.git"
47
44
  },
48
- "devDependencies": {
49
- "esbuild": "^0.27.3",
50
- "javascript-obfuscator": "^5.3.0"
45
+ "homepage": "https://github.com/cnrai/openpave",
46
+ "bugs": {
47
+ "url": "https://github.com/cnrai/openpave/issues"
51
48
  },
52
- "author": "PAVE Team",
49
+ "author": "CNRAI",
53
50
  "license": "MIT"
54
51
  }