@cnrai/pave 0.3.33 → 0.3.35

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/MARKETPLACE.md +406 -0
  2. package/README.md +218 -21
  3. package/build-binary.js +591 -0
  4. package/build-npm.js +537 -0
  5. package/build.js +230 -0
  6. package/check-binary.js +26 -0
  7. package/deploy.sh +95 -0
  8. package/index.js +5776 -0
  9. package/lib/agent-registry.js +1037 -0
  10. package/lib/args-parser.js +837 -0
  11. package/lib/blessed-widget-patched.js +93 -0
  12. package/lib/cli-markdown.js +590 -0
  13. package/lib/compaction.js +153 -0
  14. package/lib/duration.js +94 -0
  15. package/lib/hash.js +22 -0
  16. package/lib/marketplace.js +866 -0
  17. package/lib/memory-config.js +166 -0
  18. package/lib/skill-manager.js +891 -0
  19. package/lib/soul.js +31 -0
  20. package/lib/tool-output-formatter.js +180 -0
  21. package/package.json +35 -32
  22. package/start-pave.sh +149 -0
  23. package/status.js +271 -0
  24. package/test/abort-stream.test.js +445 -0
  25. package/test/agent-auto-compaction.test.js +552 -0
  26. package/test/agent-comm-abort.test.js +95 -0
  27. package/test/agent-comm.test.js +598 -0
  28. package/test/agent-inbox.test.js +576 -0
  29. package/test/agent-init.test.js +264 -0
  30. package/test/agent-interrupt.test.js +314 -0
  31. package/test/agent-lifecycle.test.js +520 -0
  32. package/test/agent-log-files.test.js +349 -0
  33. package/test/agent-mode.manual-test.js +392 -0
  34. package/test/agent-parsing.test.js +228 -0
  35. package/test/agent-post-stream-idle.test.js +762 -0
  36. package/test/agent-registry.test.js +359 -0
  37. package/test/agent-rm.test.js +442 -0
  38. package/test/agent-spawn.test.js +933 -0
  39. package/test/agent-status-api.test.js +624 -0
  40. package/test/agent-update.test.js +435 -0
  41. package/test/args-parser.test.js +391 -0
  42. package/test/auto-compaction-chat.manual-test.js +227 -0
  43. package/test/auto-compaction.test.js +941 -0
  44. package/test/build-config.test.js +120 -0
  45. package/test/build-npm.test.js +388 -0
  46. package/test/chat-command.test.js +137 -0
  47. package/test/chat-leading-lines.test.js +159 -0
  48. package/test/config-flag.test.js +272 -0
  49. package/test/cursor-drift.test.js +135 -0
  50. package/test/debug-require.js +23 -0
  51. package/test/dir-migration.test.js +323 -0
  52. package/test/duration.test.js +229 -0
  53. package/test/ghostty-term.test.js +202 -0
  54. package/test/http500-backoff.test.js +854 -0
  55. package/test/integration.test.js +86 -0
  56. package/test/memory-guard-env.test.js +220 -0
  57. package/test/pr233-fixes.test.js +259 -0
  58. package/test/run-agent-init.js +297 -0
  59. package/test/run-all.js +64 -0
  60. package/test/run-config-flag.js +159 -0
  61. package/test/run-cursor-drift.js +82 -0
  62. package/test/run-session-path.js +154 -0
  63. package/test/run-tests.js +643 -0
  64. package/test/sandbox-redirect.test.js +202 -0
  65. package/test/session-path.test.js +132 -0
  66. package/test/shebang-strip.test.js +241 -0
  67. package/test/soul-reinject.test.js +1027 -0
  68. package/test/soul-reread.test.js +281 -0
  69. package/test/tool-output-formatter.test.js +486 -0
  70. package/test/tool-output-gating.test.js +143 -0
  71. package/test/tool-states.test.js +167 -0
  72. package/test/tools-flag.test.js +65 -0
  73. package/test/tui-attach.test.js +1255 -0
  74. package/test/tui-compaction.test.js +354 -0
  75. package/test/tui-wrap.test.js +568 -0
  76. package/test-binary.js +52 -0
  77. package/test-binary2.js +36 -0
  78. package/LICENSE +0 -21
  79. package/pave.js +0 -3
  80. package/sandbox/SandboxRunner.js +0 -1
  81. package/sandbox/pave-run.js +0 -2
  82. package/sandbox/permission.js +0 -1
  83. package/sandbox/utils/yaml.js +0 -1
package/MARKETPLACE.md ADDED
@@ -0,0 +1,406 @@
1
+ # OpenPave Skill Marketplace
2
+
3
+ The OpenPave Skill Marketplace is a centralized registry for discovering, installing, and publishing PAVE skills. It uses GitHub Pages for the public-facing website and a simple YAML-based registry for skill metadata.
4
+
5
+ ## Architecture
6
+
7
+ ```
8
+ ┌─────────────────────────────────────────────────────────────────┐
9
+ │ GitHub Pages Marketplace │
10
+ │ (cnrai.github.io/openpave-marketplace) │
11
+ ├─────────────────────────────────────────────────────────────────┤
12
+ │ registry.yaml │ Static site (Jekyll/HTML) │
13
+ │ ┌─────────────────┐ │ ┌─────────────────────────────────────┐│
14
+ │ │ - gmail │ │ │ Browse skills, search, categories ││
15
+ │ │ - dropbox │ │ │ Installation instructions ││
16
+ │ │ - exa │ │ │ Auto-generated from registry.yaml ││
17
+ │ │ - ... │ │ └─────────────────────────────────────┘│
18
+ │ └─────────────────┘ │ │
19
+ └─────────────────────────────────────────────────────────────────┘
20
+
21
+
22
+ ┌─────────────────────────────────────────────────────────────────┐
23
+ │ pave CLI │
24
+ ├─────────────────────────────────────────────────────────────────┤
25
+ │ pave search <query> │ Search marketplace registry │
26
+ │ pave install <name> │ Lookup in registry → clone from GitHub│
27
+ │ pave publish │ Validate & add to registry via PR │
28
+ │ pave update <name> │ Pull latest version from GitHub │
29
+ └─────────────────────────────────────────────────────────────────┘
30
+ ```
31
+
32
+ ## Registry Location
33
+
34
+ - **Repository**: `cnrai/openpave-marketplace`
35
+ - **GitHub Pages URL**: `https://cnrai.github.io/openpave-marketplace`
36
+ - **Raw Registry URL**: `https://raw.githubusercontent.com/cnrai/openpave-marketplace/main/registry.yaml`
37
+
38
+ ## CLI Commands
39
+
40
+ ### `pave search <query>`
41
+
42
+ Search the marketplace for skills by name, description, or keywords.
43
+
44
+ ```bash
45
+ # Search for email-related skills
46
+ pave search email
47
+
48
+ # Search for storage skills
49
+ pave search storage
50
+
51
+ # List all available skills
52
+ pave search --all
53
+ ```
54
+
55
+ ### `pave install <source>`
56
+
57
+ Install a skill from various sources. Priority order:
58
+
59
+ | Source Type | Example | Description |
60
+ |-------------|---------|-------------|
61
+ | Registry name | `pave install gmail` | Lookup in marketplace → clone from GitHub |
62
+ | GitHub shorthand | `pave install cnrai/openpave-gmail` | Direct clone from GitHub |
63
+ | GitHub URL | `pave install https://github.com/cnrai/openpave-gmail` | Direct clone from URL |
64
+ | Local path | `pave install ./my-skill` | Copy from local directory |
65
+
66
+ ```bash
67
+ # Install from marketplace (recommended)
68
+ pave install gmail
69
+ pave install dropbox
70
+
71
+ # Install from GitHub directly
72
+ pave install cnrai/openpave-gmail
73
+
74
+ # Install from local path (for development)
75
+ pave install /path/to/my-skill
76
+ pave install ./my-local-skill
77
+
78
+ # Force reinstall
79
+ pave install gmail --force
80
+ ```
81
+
82
+ ### `pave publish [path]`
83
+
84
+ Publish a skill to the marketplace. This validates your skill and creates a pull request to add it to the registry.
85
+
86
+ ```bash
87
+ # Publish current directory
88
+ pave publish
89
+
90
+ # Publish specific path
91
+ pave publish ./my-skill
92
+
93
+ # Publish with verbose output
94
+ pave publish --verbose
95
+ ```
96
+
97
+ **Requirements for publishing:**
98
+ - Valid `skill.yaml` with required fields
99
+ - Public GitHub repository
100
+ - MIT or compatible license
101
+ - README.md with usage instructions
102
+
103
+ ### `pave update <name>`
104
+
105
+ Update an installed skill to the latest version from GitHub.
106
+
107
+ ```bash
108
+ # Update a specific skill
109
+ pave update gmail
110
+
111
+ # Update all skills
112
+ pave update --all
113
+
114
+ # Check for updates without installing
115
+ pave update --check
116
+ ```
117
+
118
+ ### `pave list`
119
+
120
+ List installed skills.
121
+
122
+ ```bash
123
+ pave list
124
+ pave list --json
125
+ ```
126
+
127
+ ### `pave remove <name>`
128
+
129
+ Remove an installed skill.
130
+
131
+ ```bash
132
+ pave remove gmail
133
+ ```
134
+
135
+ ### `pave info <name>`
136
+
137
+ Show detailed information about a skill.
138
+
139
+ ```bash
140
+ pave info gmail
141
+ pave info ./my-skill
142
+ ```
143
+
144
+ ## Registry Format
145
+
146
+ The marketplace uses a YAML-based registry (`registry.yaml`):
147
+
148
+ ```yaml
149
+ # OpenPave Skill Marketplace Registry
150
+ version: 1
151
+ updated: 2026-02-22T12:00:00Z
152
+
153
+ skills:
154
+ gmail:
155
+ name: gmail
156
+ version: 1.0.0
157
+ description: Read and manage Gmail messages securely using OAuth
158
+ author: cnrai
159
+ repository: cnrai/openpave-gmail
160
+ category: communication
161
+ icon: "📧"
162
+ keywords:
163
+ - email
164
+ - gmail
165
+ - google
166
+ - inbox
167
+ - messages
168
+ published: 2026-02-21T00:00:00Z
169
+
170
+ dropbox:
171
+ name: dropbox
172
+ version: 1.0.0
173
+ description: Access Dropbox files and Paper documents
174
+ author: cnrai
175
+ repository: cnrai/openpave-dropbox
176
+ category: storage
177
+ icon: "📦"
178
+ keywords:
179
+ - files
180
+ - cloud
181
+ - storage
182
+ - dropbox
183
+ published: 2026-02-21T00:00:00Z
184
+ ```
185
+
186
+ ### Registry Fields
187
+
188
+ | Field | Required | Description |
189
+ |-------|----------|-------------|
190
+ | `name` | Yes | Unique skill identifier (lowercase, hyphens only) |
191
+ | `version` | Yes | Semver version (e.g., 1.0.0) |
192
+ | `description` | Yes | Short description (max 100 chars) |
193
+ | `author` | Yes | GitHub username or org |
194
+ | `repository` | Yes | GitHub repo in `owner/repo` format |
195
+ | `category` | Yes | One of: communication, storage, search, productivity, development, other |
196
+ | `icon` | No | Emoji icon for display |
197
+ | `keywords` | No | Array of search keywords |
198
+ | `published` | Yes | ISO 8601 timestamp |
199
+
200
+ ## Skill Format (skill.yaml)
201
+
202
+ Each skill must have a `skill.yaml` in its root directory:
203
+
204
+ ```yaml
205
+ # Required fields
206
+ name: gmail
207
+ version: 1.0.0
208
+ description: Read and manage Gmail messages securely using OAuth
209
+ entrypoint: index.js
210
+ pattern: sandbox
211
+
212
+ # Author information
213
+ author:
214
+ name: OpenPave
215
+ url: https://github.com/cnrai
216
+
217
+ # License and links
218
+ license: MIT
219
+ homepage: https://github.com/cnrai/openpave-gmail
220
+ repository: cnrai/openpave-gmail
221
+
222
+ # Available commands
223
+ commands:
224
+ - name: list
225
+ description: List recent messages
226
+ options:
227
+ - --max <number>
228
+ - --summary
229
+ - --json
230
+
231
+ - name: read
232
+ description: Read a specific message
233
+ args:
234
+ - <messageId>
235
+ options:
236
+ - --summary
237
+ - --json
238
+
239
+ # Token configuration for secure API access
240
+ tokens:
241
+ gmail:
242
+ type: oauth
243
+ description: Gmail API OAuth credentials
244
+ domains:
245
+ - gmail.googleapis.com
246
+ - "*.googleapis.com"
247
+ env:
248
+ required:
249
+ - GMAIL_CLIENT_ID
250
+ - GMAIL_CLIENT_SECRET
251
+ - GMAIL_REFRESH_TOKEN
252
+
253
+ # Sandbox permissions
254
+ permissions:
255
+ fs.read: []
256
+ fs.write: []
257
+ network:
258
+ - gmail.googleapis.com
259
+ - oauth2.googleapis.com
260
+ modules:
261
+ - fs
262
+ - path
263
+
264
+ # Metadata
265
+ category: communication
266
+ icon: "📧"
267
+ keywords:
268
+ - email
269
+ - gmail
270
+ - google
271
+ ```
272
+
273
+ ## Categories
274
+
275
+ | Category | Description | Examples |
276
+ |----------|-------------|----------|
277
+ | `communication` | Email, messaging, notifications | gmail, slack, discord |
278
+ | `storage` | File storage, cloud drives | dropbox, gdrive, s3 |
279
+ | `search` | Web search, research tools | exa, google-search |
280
+ | `productivity` | Calendar, tasks, notes | google-calendar, notion |
281
+ | `development` | Code, git, CI/CD tools | github, gitlab |
282
+ | `other` | Everything else | - |
283
+
284
+ ## Marketplace Repository Structure
285
+
286
+ ```
287
+ cnrai/openpave-marketplace/
288
+ ├── registry.yaml # Main skill registry
289
+ ├── skills/ # Individual skill metadata (optional, for caching)
290
+ │ ├── gmail.yaml
291
+ │ ├── dropbox.yaml
292
+ │ └── exa.yaml
293
+ ├── index.html # Static site homepage
294
+ ├── _config.yml # Jekyll config for GitHub Pages
295
+ ├── assets/
296
+ │ └── style.css
297
+ └── README.md
298
+ ```
299
+
300
+ ## Publishing Workflow
301
+
302
+ ### For Skill Authors
303
+
304
+ 1. **Create your skill repository** on GitHub (e.g., `yourname/openpave-myskill`)
305
+
306
+ 2. **Add required files:**
307
+ - `skill.yaml` - Skill manifest
308
+ - `index.js` - Main entrypoint
309
+ - `README.md` - Documentation
310
+ - `LICENSE` - MIT recommended
311
+
312
+ 3. **Test locally:**
313
+ ```bash
314
+ pave install ./my-skill
315
+ pave run myskill --help
316
+ ```
317
+
318
+ 4. **Publish to marketplace:**
319
+ ```bash
320
+ cd my-skill
321
+ pave publish
322
+ ```
323
+
324
+ 5. **Wait for PR approval** - maintainers will review and merge
325
+
326
+ ### For Maintainers
327
+
328
+ 1. Review incoming PRs to `cnrai/openpave-marketplace`
329
+ 2. Verify skill.yaml is valid
330
+ 3. Check repository exists and is accessible
331
+ 4. Test installation: `pave install owner/repo`
332
+ 5. Merge PR to add to registry
333
+
334
+ ## Local Development
335
+
336
+ ### Testing without marketplace
337
+
338
+ ```bash
339
+ # Install from local path
340
+ pave install ./my-skill
341
+
342
+ # Run commands
343
+ pave run myskill command --args
344
+
345
+ # Check info
346
+ pave info myskill
347
+ ```
348
+
349
+ ### Testing marketplace integration
350
+
351
+ ```bash
352
+ # Set custom registry URL (for testing)
353
+ PAVE_REGISTRY_URL=https://raw.githubusercontent.com/yourname/test-marketplace/main/registry.yaml pave search test
354
+
355
+ # Or use local file
356
+ PAVE_REGISTRY_FILE=./test-registry.yaml pave search test
357
+ ```
358
+
359
+ ## Configuration
360
+
361
+ ### Environment Variables
362
+
363
+ | Variable | Description | Default |
364
+ |----------|-------------|---------|
365
+ | `PAVE_REGISTRY_URL` | Custom registry URL | `https://raw.githubusercontent.com/cnrai/openpave-marketplace/main/registry.yaml` |
366
+ | `PAVE_REGISTRY_FILE` | Local registry file (overrides URL) | - |
367
+ | `PAVE_CACHE_TTL` | Registry cache TTL in seconds | `3600` (1 hour) |
368
+
369
+ ### Cache Location
370
+
371
+ The registry is cached locally to reduce network requests:
372
+
373
+ ```
374
+ ~/.pave/cache/
375
+ ├── registry.yaml # Cached registry
376
+ └── registry.meta.json # Cache metadata (timestamp, etag)
377
+ ```
378
+
379
+ ## Error Handling
380
+
381
+ ### Common Errors
382
+
383
+ | Error | Cause | Solution |
384
+ |-------|-------|----------|
385
+ | `Skill not found in registry` | Skill name not in marketplace | Check spelling or install from GitHub URL |
386
+ | `Repository not found` | GitHub repo doesn't exist | Verify repository URL |
387
+ | `Invalid skill.yaml` | Missing required fields | Check skill.yaml format |
388
+ | `Network error` | Can't reach GitHub | Check internet connection |
389
+
390
+ ## Node 16 Compatibility
391
+
392
+ The marketplace module is designed for Node 16 compatibility:
393
+
394
+ - Uses `https` module instead of `fetch`
395
+ - Synchronous YAML parsing with `js-yaml`
396
+ - No ES2022+ features
397
+ - Works on iSH iOS
398
+
399
+ ## Future Enhancements
400
+
401
+ - [ ] Skill ratings and reviews
402
+ - [ ] Download statistics
403
+ - [ ] Verified publisher badges
404
+ - [ ] Automatic version updates
405
+ - [ ] Dependency resolution between skills
406
+ - [ ] Private/enterprise registries
package/README.md CHANGED
@@ -1,40 +1,237 @@
1
- # @cnrai/pave
1
+ # PAVE - Personal AI Virtual Environment
2
2
 
3
- PAVE - Personal AI Virtual Environment. AI agent framework for the terminal.
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.
4
4
 
5
- ## Installation
5
+ ## Features
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
7
21
  ```bash
8
- npm install -g @cnrai/pave
22
+ # Using startup script (recommended)
23
+ ./start-pave.sh
24
+
25
+ # Or manually with garbage collection
26
+ node --expose-gc index.js
9
27
  ```
10
28
 
11
- ## Usage
29
+ ## CLI Options
30
+
31
+ ### Memory Configuration
32
+ Perfect for ISH and other resource-constrained environments:
12
33
 
13
34
  ```bash
14
- pave # Launch TUI
15
- pave --help # Show help
16
- pave --version # Show version
17
- pave chat "question" # Quick chat
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
18
43
  ```
19
44
 
20
- ### iSH (iOS)
45
+ ### Server Configuration
46
+ ```bash
47
+ # Custom port and host
48
+ node index.js --port 8080 --host 0.0.0.0
21
49
 
50
+ # Custom working directory
51
+ node index.js --opencode-dir /path/to/workspace
52
+ ```
53
+
54
+ ### Debug Options
22
55
  ```bash
23
- npm install -g @cnrai/pave
24
- pave # Auto-detects iSH and applies optimized Node flags
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
25
62
  ```
26
63
 
27
- ## Requirements
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
+ ```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
120
+ ```
121
+
122
+ ## Examples
123
+
124
+ ### Basic Usage
125
+ ```bash
126
+ # Auto-detected environment
127
+ node index.js
128
+
129
+ # With debug logging
130
+ node index.js --debug
131
+ ```
132
+
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
140
+
141
+ # Force ISH mode for testing
142
+ node index.js --ish-mode --debug
143
+ ```
144
+
145
+ ### Development Setup
146
+ ```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
152
+ ```
28
153
 
29
- - Node.js >= 16.0.0
30
- - A GitHub Copilot subscription (for the AI backend)
154
+ ### Production ISH Setup
155
+ ```bash
156
+ # Optimized for production use in iSH
157
+ ./start-pave.sh --memory-limit 12 --memory-warning 8
158
+ ```
31
159
 
32
- ## Links
160
+ ## Startup Script
33
161
 
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`
162
+ The `start-pave.sh` script provides additional convenience:
37
163
 
38
- ## License
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
217
+
218
+ PAVE runs OpenCode-Lite and the TUI client in the same Node.js process:
219
+
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
225
+
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)
231
+
232
+ ## Requirements
39
233
 
40
- MIT - Copyright (c) 2025 CNRAI
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