moderado 0.3.7 → 0.3.8

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 (58) hide show
  1. package/README.md +215 -215
  2. package/dist/args.js +29 -29
  3. package/dist/chat_mode.d.ts +14 -0
  4. package/dist/chat_mode.d.ts.map +1 -0
  5. package/dist/chat_mode.js +13 -0
  6. package/dist/chat_mode.js.map +1 -0
  7. package/dist/commands/chat.d.ts.map +1 -1
  8. package/dist/commands/chat.js +2 -2
  9. package/dist/commands/chat.js.map +1 -1
  10. package/dist/commands/host.d.ts +4 -0
  11. package/dist/commands/host.d.ts.map +1 -0
  12. package/dist/commands/host.js +30 -0
  13. package/dist/commands/host.js.map +1 -0
  14. package/dist/commands/models.d.ts.map +1 -1
  15. package/dist/commands/models.js +2 -2
  16. package/dist/commands/models.js.map +1 -1
  17. package/dist/host/approval_queue.d.ts +9 -0
  18. package/dist/host/approval_queue.d.ts.map +1 -0
  19. package/dist/host/approval_queue.js +63 -0
  20. package/dist/host/approval_queue.js.map +1 -0
  21. package/dist/host/auto_approve.d.ts +22 -0
  22. package/dist/host/auto_approve.d.ts.map +1 -0
  23. package/dist/host/auto_approve.js +36 -0
  24. package/dist/host/auto_approve.js.map +1 -0
  25. package/dist/host/ndjson.d.ts +3 -0
  26. package/dist/host/ndjson.d.ts.map +1 -0
  27. package/dist/host/ndjson.js +68 -0
  28. package/dist/host/ndjson.js.map +1 -0
  29. package/dist/host/protocol_server.d.ts +9 -0
  30. package/dist/host/protocol_server.d.ts.map +1 -0
  31. package/dist/host/protocol_server.js +101 -0
  32. package/dist/host/protocol_server.js.map +1 -0
  33. package/dist/host/runtime.d.ts +30 -0
  34. package/dist/host/runtime.d.ts.map +1 -0
  35. package/dist/host/runtime.js +603 -0
  36. package/dist/host/runtime.js.map +1 -0
  37. package/dist/skills.js +2 -2
  38. package/dist/ui/session_screen.d.ts +32 -0
  39. package/dist/ui/session_screen.d.ts.map +1 -0
  40. package/dist/ui/session_screen.js +148 -0
  41. package/dist/ui/session_screen.js.map +1 -0
  42. package/dist/ui/session_terminal.d.ts +46 -0
  43. package/dist/ui/session_terminal.d.ts.map +1 -0
  44. package/dist/ui/session_terminal.js +342 -0
  45. package/dist/ui/session_terminal.js.map +1 -0
  46. package/dist/ui/welcome.d.ts.map +1 -1
  47. package/dist/ui/welcome.js +11 -12
  48. package/dist/ui/welcome.js.map +1 -1
  49. package/dist/vendor/contracts/host_protocol.d.ts +3545 -0
  50. package/dist/vendor/contracts/host_protocol.d.ts.map +1 -0
  51. package/dist/vendor/contracts/host_protocol.js +292 -0
  52. package/dist/vendor/contracts/host_protocol.js.map +1 -0
  53. package/dist/vendor/core/agent.js +24 -24
  54. package/dist/web_search_route.d.ts +16 -0
  55. package/dist/web_search_route.d.ts.map +1 -0
  56. package/dist/web_search_route.js +60 -0
  57. package/dist/web_search_route.js.map +1 -0
  58. package/package.json +28 -28
package/README.md CHANGED
@@ -1,215 +1,215 @@
1
- # Moderado
2
-
3
- > **A lightweight, provider-independent CLI coding agent with dynamic NVIDIA NIM discovery, free-first AUTO routing, and an uncompromised human-in-the-loop approval boundary.**
4
-
5
- [![Version](https://img.shields.io/badge/version-v0.3.0%2B2609221-blue.svg)](file:///d:/projects/moderado/VERSION)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](file:///d:/projects/moderado/LICENSE)
7
- [![Standards: Alfazen](https://img.shields.io/badge/standard-alfazen--coding-green.svg)](https://github.com/marcuz-apl/alfazen-skills)
8
-
9
- ---
10
-
11
- ## Highlights
12
-
13
- - **Clean-Room & Original**: Built from scratch in TypeScript on Node.js (>= 20 LTS). No code copied from Cline, OpenCode, or legacy wrappers.
14
- - **Provider-Independent Core**: Core agent loops, tool dispatching, and routing depend on pure contracts (`packages/contracts`) using Dependency Injection.
15
- - **Dynamic NVIDIA Discovery**: Queries live `/v1/models` from NVIDIA NIM hosted catalog or local NIM instances; never relies on stale static lists.
16
- - **Free-First AUTO Routing**: Intelligently ranks and selects verified free/trial tool-capable models before any paid endpoints. Paid models and unverified pricing require explicit user opt-in.
17
- - **Strict Approval Boundary**: Auto-approved reads; interactive human approval for file writes, edits, and command executions. Non-interactive sessions fail closed.
18
- - **Minimalist & Bloat-Free (`ponytail`)**: Follows the Decision Ladder: YAGNI, standard library first (native Node `fetch`, `AbortController`, `child_process.spawn`), and zero unnecessary dependencies.
19
- - **Alfazen Versioning (`versioning-alfazen`)**: SemVer 2.0.0 with high-traceability connected UTC build prefixes (`v<m.n.p>+<yymmddc>`) and mandatory owner advisory gates for major releases.
20
-
21
- ---
22
-
23
- ## Documentation Index
24
-
25
- | Document | Purpose |
26
- |---|---|
27
- | [**PRD.md**](file:///d:/projects/moderado/PRD.md) | **Product Requirements Document**: Personas, requirements, CLI specs, and acceptance criteria |
28
- | [**AGENTS.md**](file:///d:/projects/moderado/AGENTS.md) | **Agent Operational Manual**: Rules of engagement, Ponytail Decision Ladder, and subagent patterns |
29
- | [**docs/ARCHITECTURE.md**](file:///d:/projects/moderado/docs/ARCHITECTURE.md) | **System Architecture**: Workspaces, Dependency Injection, state machines, and event streams |
30
- | [**docs/TOOLS.md**](file:///d:/projects/moderado/docs/TOOLS.md) | **Tool Specifications**: Schemas, limits, atomic writes, and validation rules for the 7 tools |
31
- | [**docs/ROUTING.md**](file:///d:/projects/moderado/docs/ROUTING.md) | **Discovery & Routing**: Classification taxonomy, AUTO selection algorithm, and retry/fallback cascades |
32
- | [**docs/SECURITY.md**](file:///d:/projects/moderado/docs/SECURITY.md) | **Security Model**: Workspace jail, `shell: false` isolation, environment cleansing, and injection defense |
33
- | [**HANDOFF.md**](file:///d:/projects/moderado/HANDOFF.md) | **Project Handoff Snapshot**: Real-time status, decisions, blockers, and next implementation milestones |
34
-
35
- ---
36
-
37
- ## Workspace Layout
38
-
39
- Moderado is organized as an npm workspace:
40
-
41
- ```text
42
- moderado/
43
- ├── apps/
44
- │ └── cli/ # v0.1 CLI application and terminal event rendering
45
- ├── packages/
46
- │ ├── contracts/ # Pure TypeScript interfaces, Zod schemas, events
47
- │ ├── core/ # Agent loop, routing policy, session state machine
48
- │ ├── providers/ # NVIDIA NIM HTTP adapter and mock/fake providers
49
- │ └── tools/ # Workspace file jail and process execution engine
50
- ├── tests/ # Cross-package and CLI integration tests
51
- ├── docs/ # Architectural and subsystem specifications
52
- ├── VERSION # Alfazen connected version identifier
53
- ├── PRD.md # Product requirements document
54
- ├── AGENTS.md # Agent operational guide
55
- └── HANDOFF.md # Resumption and state ledger
56
- ```
57
-
58
- ---
59
-
60
- ## CLI Command Quick Reference
61
-
62
- ```bash
63
- # Discover live models and display access/capability classifications
64
- moderado models
65
-
66
- # Run a bounded coding task in the current workspace (default AUTO routing)
67
- moderado run "Add unit tests for user authentication"
68
-
69
- # Pin a specific model (disables fallback)
70
- moderado run "Refactor database client" --model meta/llama-3.3-70b-instruct
71
-
72
- # Run against a local NIM container
73
- moderado run "Audit codebase" --profile local-nim
74
-
75
- # Run in read-only audit mode (denies all writes and commands)
76
- moderado run "Analyze security boundaries" --read-only
77
- ```
78
-
79
- ---
80
-
81
- ## Install Moderado
82
-
83
- Moderado requires **Node.js 20 or newer**.
84
-
85
- ```bash
86
- npm install -g moderado
87
- moderado --help
88
- ```
89
-
90
- moderado@0.3.0 is live on the public npm registry (latest tag points at 0.3.0).
91
- Any npm-compatible installer works (bun add -g moderado,
92
- pnpm add -g moderado, npx -y moderado@latest --help), and prebuilt
93
- dependency-free binaries (moderado-win-x64.exe, moderado-macos-arm64,
94
- moderado-linux-x64) are attached to the
95
- GitHub Release v0.3.0 at https://github.com/marcuz-apl/moderado/releases/tag/v0.3.0.
96
- The curl installer (`scripts/install.sh`, Linux x64 + macOS arm64), the
97
- Homebrew tap, and the Scoop bucket are available; the winget and AUR
98
- submissions are pending. See docs/DISTRIBUTION.md in the repository.
99
- To build from source instead:
100
-
101
- ```bash
102
- git clone https://github.com/marcuz-apl/moderado.git
103
- cd moderado
104
- npm install
105
- npm run build
106
- node apps/cli/dist/index.js
107
- ```
108
-
109
- Maintainers can install a verified release artifact directly with
110
- `npm install -g ./moderado-<version>.tgz`. See
111
- [docs/RELEASING.md](docs/RELEASING.md) for the review procedure.
112
-
113
- ### Connect a provider
114
-
115
- Open Moderado and use `/connect`. NVIDIA NIM is the default free-first provider;
116
- OpenRouter, Agnes AI, and compatible OpenAI-style endpoints are also supported.
117
- On Windows, newly saved provider keys go to Windows Credential Manager and
118
- `~/.moderado/config.json` retains only a credential reference. On other
119
- platforms, use an environment variable such as `NVIDIA_API_KEY` or
120
- `OPENROUTER_API_KEY`.
121
-
122
- Run `moderado doctor` to inspect local setup without exposing secrets. Add
123
- `--connectivity` only when you want an optional live model-catalog check.
124
- `npm test` never performs live provider calls.
125
- ## Getting Started & Development
126
-
127
- ### Connect a provider in the TUI
128
-
129
- Run `moderado` to open the TUI immediately. A fresh installation does not require
130
- an API key or a preselected model. The welcome card shows **No model connected —
131
- use `/connect`** until you add one.
132
-
133
- Use `/connect` to add NVIDIA NIM. NVIDIA NIM starts with `AUTO` free-first
134
- routing, so choosing a model is optional; use `/model` later to pin one. Obtain
135
- an NVIDIA key from [build.nvidia.com](https://build.nvidia.com), or set it as
136
- `NVIDIA_API_KEY` before launching Moderado.
137
-
138
- ### Sessions and usage
139
-
140
- Moderado stores sessions per workspace in `~/.moderado/sessions/`. Use
141
- `/session` to create, resume, export, or compact a local conversation. Session
142
- exports redact recognized API-key prefixes. The status line uses only
143
- provider-reported token usage. It shows the calculated cost when the selected
144
- model exposes prompt and completion prices, and **Cost unknown** otherwise.
145
-
146
- `/connect` also accepts an OpenAI-compatible base URL, API key, and explicit
147
- model ID for providers such as OpenRouter, Z.AI, DeepSeek, Moonshot, and
148
- Mistral. Compatibility depends on each provider supporting `/v1/models` and
149
- streaming `/v1/chat/completions` with tool calls. Provider credentials are saved
150
- in `~/.moderado/config.json`; protect that file and never commit it.
151
-
152
- ### 1. Build & Test
153
- ```bash
154
- # Install workspace dependencies
155
- npm install
156
-
157
- # Build all packages via TypeScript project references
158
- npm run build
159
-
160
- # Run full automated test suite (100% offline, zero API keys required)
161
- npm test
162
- ```
163
-
164
- ### 2. Manual Live Smoke Test (Optional)
165
- To test live model discovery and chat against NVIDIA NIM with real credentials:
166
- ```bash
167
- # PowerShell
168
- $env:NVIDIA_API_KEY="nvapi-..."
169
- node scripts/smoke_test.js
170
-
171
- # POSIX (bash/zsh)
172
- export NVIDIA_API_KEY="nvapi-..."
173
- node scripts/smoke_test.js
174
- ```
175
-
176
- ---
177
-
178
- ## License
179
-
180
- This project is licensed under the MIT License.
181
- *NVIDIA NIM, NGC, and model weights/APIs are subject to their respective terms and licenses. Moderado is independent and not endorsed by NVIDIA.*
182
-
183
- ### Practical coding workflow
184
-
185
- Use `/workflow` from the TUI to work through a change safely:
186
-
187
- - **Git status** shows the current branch and changed files without using a shell.
188
- - **Review diff** shows the bounded working-tree diff.
189
- - In **Plan** mode, Moderado asks the model for a concise checklist and cannot make workspace changes. Choose **Build plan** and confirm to send that checklist to Execute mode.
190
- - File writes, exact edits, and multi-file patches show their change preview and still require approval. Moderado records a byte-preserving checkpoint immediately before an approved file mutation.
191
- - **Undo latest agent change** requires its own approval. It restores the latest completed checkpoint from `~/.moderado/checkpoints/` only when every affected file still has the expected post-change digest. If a file changed externally, it reports the conflict and restores nothing.
192
-
193
- ### Diagnostics evidence
194
-
195
- Ask Moderado to run diagnostics, typecheck, lint, or tests in a TypeScript or JavaScript workspace. It may run only the direct `typecheck`, `lint`, or `test` script defined in that workspace�s `package.json`, and every run requires approval. A non-zero exit returns parsed TypeScript errors as repair evidence; it does not bypass the safety boundary.
196
-
197
- ### TypeScript language intelligence
198
-
199
- Install `typescript-language-server` yourself, then set `typescriptLanguageServer` in `~/.moderado/config.json` to its executable path. Moderado can then use read-only definition and reference lookup for TypeScript/JavaScript files. When the executable is unavailable, it reports how to configure it and leaves normal tools available.
200
-
201
- ### Local MCP tools
202
-
203
- Configure trusted local stdio MCP servers under `mcpServers` in `~/.moderado/config.json`, with an executable and fixed `args` list. Moderado discovers server tools at session startup, namespaces them as `mcp.<server>.<tool>`, and requires approval for every call. MCP network transports and automatic server installation are not supported.
204
-
205
- ### Host event protocol
206
-
207
- Moderado exposes a versioned host-event envelope with session identity and monotonic sequence numbers. The CLI continues to render the contained agent event, while a future desktop host can consume the same protocol without importing CLI code.
208
-
209
- ### Doctor command
210
-
211
- Run `moderado doctor` to check the local Node runtime, workspace, Moderado home directory, provider/key presence, Git, and npm without exposing credentials. Run `moderado doctor --connectivity` only when you want an explicit live provider catalog check.
212
-
213
- ## Windows credential storage
214
-
215
- On Windows, /connect saves provider API keys in Windows Credential Manager and stores only a provider credential reference in ~/.moderado/config.json. Existing plaintext keys remain usable for compatibility. Migrate them explicitly with moderado doctor --migrate-credentials; a failed migration leaves the existing configuration unchanged. On other platforms, set the provider environment variable (for example, NVIDIA_API_KEY or OPENROUTER_API_KEY).
1
+ # Moderado
2
+
3
+ > **A lightweight, provider-independent CLI coding agent with dynamic NVIDIA NIM discovery, free-first AUTO routing, and an uncompromised human-in-the-loop approval boundary.**
4
+
5
+ [![Version](https://img.shields.io/badge/version-v0.3.0%2B2609221-blue.svg)](file:///d:/projects/moderado/VERSION)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](file:///d:/projects/moderado/LICENSE)
7
+ [![Standards: Alfazen](https://img.shields.io/badge/standard-alfazen--coding-green.svg)](https://github.com/marcuz-apl/alfazen-skills)
8
+
9
+ ---
10
+
11
+ ## Highlights
12
+
13
+ - **Clean-Room & Original**: Built from scratch in TypeScript on Node.js (>= 20 LTS). No code copied from Cline, OpenCode, or legacy wrappers.
14
+ - **Provider-Independent Core**: Core agent loops, tool dispatching, and routing depend on pure contracts (`packages/contracts`) using Dependency Injection.
15
+ - **Dynamic NVIDIA Discovery**: Queries live `/v1/models` from NVIDIA NIM hosted catalog or local NIM instances; never relies on stale static lists.
16
+ - **Free-First AUTO Routing**: Intelligently ranks and selects verified free/trial tool-capable models before any paid endpoints. Paid models and unverified pricing require explicit user opt-in.
17
+ - **Strict Approval Boundary**: Auto-approved reads; interactive human approval for file writes, edits, and command executions. Non-interactive sessions fail closed.
18
+ - **Minimalist & Bloat-Free (`ponytail`)**: Follows the Decision Ladder: YAGNI, standard library first (native Node `fetch`, `AbortController`, `child_process.spawn`), and zero unnecessary dependencies.
19
+ - **Alfazen Versioning (`versioning-alfazen`)**: SemVer 2.0.0 with high-traceability connected UTC build prefixes (`v<m.n.p>+<yymmddc>`) and mandatory owner advisory gates for major releases.
20
+
21
+ ---
22
+
23
+ ## Documentation Index
24
+
25
+ | Document | Purpose |
26
+ |---|---|
27
+ | [**PRD.md**](file:///d:/projects/moderado/PRD.md) | **Product Requirements Document**: Personas, requirements, CLI specs, and acceptance criteria |
28
+ | [**AGENTS.md**](file:///d:/projects/moderado/AGENTS.md) | **Agent Operational Manual**: Rules of engagement, Ponytail Decision Ladder, and subagent patterns |
29
+ | [**docs/ARCHITECTURE.md**](file:///d:/projects/moderado/docs/ARCHITECTURE.md) | **System Architecture**: Workspaces, Dependency Injection, state machines, and event streams |
30
+ | [**docs/TOOLS.md**](file:///d:/projects/moderado/docs/TOOLS.md) | **Tool Specifications**: Schemas, limits, atomic writes, and validation rules for the 7 tools |
31
+ | [**docs/ROUTING.md**](file:///d:/projects/moderado/docs/ROUTING.md) | **Discovery & Routing**: Classification taxonomy, AUTO selection algorithm, and retry/fallback cascades |
32
+ | [**docs/SECURITY.md**](file:///d:/projects/moderado/docs/SECURITY.md) | **Security Model**: Workspace jail, `shell: false` isolation, environment cleansing, and injection defense |
33
+ | [**HANDOFF.md**](file:///d:/projects/moderado/HANDOFF.md) | **Project Handoff Snapshot**: Real-time status, decisions, blockers, and next implementation milestones |
34
+
35
+ ---
36
+
37
+ ## Workspace Layout
38
+
39
+ Moderado is organized as an npm workspace:
40
+
41
+ ```text
42
+ moderado/
43
+ ├── apps/
44
+ │ └── cli/ # v0.1 CLI application and terminal event rendering
45
+ ├── packages/
46
+ │ ├── contracts/ # Pure TypeScript interfaces, Zod schemas, events
47
+ │ ├── core/ # Agent loop, routing policy, session state machine
48
+ │ ├── providers/ # NVIDIA NIM HTTP adapter and mock/fake providers
49
+ │ └── tools/ # Workspace file jail and process execution engine
50
+ ├── tests/ # Cross-package and CLI integration tests
51
+ ├── docs/ # Architectural and subsystem specifications
52
+ ├── VERSION # Alfazen connected version identifier
53
+ ├── PRD.md # Product requirements document
54
+ ├── AGENTS.md # Agent operational guide
55
+ └── HANDOFF.md # Resumption and state ledger
56
+ ```
57
+
58
+ ---
59
+
60
+ ## CLI Command Quick Reference
61
+
62
+ ```bash
63
+ # Discover live models and display access/capability classifications
64
+ moderado models
65
+
66
+ # Run a bounded coding task in the current workspace (default AUTO routing)
67
+ moderado run "Add unit tests for user authentication"
68
+
69
+ # Pin a specific model (disables fallback)
70
+ moderado run "Refactor database client" --model meta/llama-3.3-70b-instruct
71
+
72
+ # Run against a local NIM container
73
+ moderado run "Audit codebase" --profile local-nim
74
+
75
+ # Run in read-only audit mode (denies all writes and commands)
76
+ moderado run "Analyze security boundaries" --read-only
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Install Moderado
82
+
83
+ Moderado requires **Node.js 20 or newer**.
84
+
85
+ ```bash
86
+ npm install -g moderado
87
+ moderado --help
88
+ ```
89
+
90
+ moderado@0.3.0 is live on the public npm registry (latest tag points at 0.3.0).
91
+ Any npm-compatible installer works (bun add -g moderado,
92
+ pnpm add -g moderado, npx -y moderado@latest --help), and prebuilt
93
+ dependency-free binaries (moderado-win-x64.exe, moderado-macos-arm64,
94
+ moderado-linux-x64) are attached to the
95
+ GitHub Release v0.3.0 at https://github.com/marcuz-apl/moderado/releases/tag/v0.3.0.
96
+ The curl installer (`scripts/install.sh`, Linux x64 + macOS arm64), the
97
+ Homebrew tap, and the Scoop bucket are available; the winget and AUR
98
+ submissions are pending. See docs/DISTRIBUTION.md in the repository.
99
+ To build from source instead:
100
+
101
+ ```bash
102
+ git clone https://github.com/marcuz-apl/moderado.git
103
+ cd moderado
104
+ npm install
105
+ npm run build
106
+ node apps/cli/dist/index.js
107
+ ```
108
+
109
+ Maintainers can install a verified release artifact directly with
110
+ `npm install -g ./moderado-<version>.tgz`. See
111
+ [docs/RELEASING.md](docs/RELEASING.md) for the review procedure.
112
+
113
+ ### Connect a provider
114
+
115
+ Open Moderado and use `/connect`. NVIDIA NIM is the default free-first provider;
116
+ OpenRouter, Agnes AI, and compatible OpenAI-style endpoints are also supported.
117
+ On Windows, newly saved provider keys go to Windows Credential Manager and
118
+ `~/.moderado/config.json` retains only a credential reference. On other
119
+ platforms, use an environment variable such as `NVIDIA_API_KEY` or
120
+ `OPENROUTER_API_KEY`.
121
+
122
+ Run `moderado doctor` to inspect local setup without exposing secrets. Add
123
+ `--connectivity` only when you want an optional live model-catalog check.
124
+ `npm test` never performs live provider calls.
125
+ ## Getting Started & Development
126
+
127
+ ### Connect a provider in the TUI
128
+
129
+ Run `moderado` to open the TUI immediately. A fresh installation does not require
130
+ an API key or a preselected model. The welcome card shows **No model connected —
131
+ use `/connect`** until you add one.
132
+
133
+ Use `/connect` to add NVIDIA NIM. NVIDIA NIM starts with `AUTO` free-first
134
+ routing, so choosing a model is optional; use `/model` later to pin one. Obtain
135
+ an NVIDIA key from [build.nvidia.com](https://build.nvidia.com), or set it as
136
+ `NVIDIA_API_KEY` before launching Moderado.
137
+
138
+ ### Sessions and usage
139
+
140
+ Moderado stores sessions per workspace in `~/.moderado/sessions/`. Use
141
+ `/session` to create, resume, export, or compact a local conversation. Session
142
+ exports redact recognized API-key prefixes. The status line uses only
143
+ provider-reported token usage. It shows the calculated cost when the selected
144
+ model exposes prompt and completion prices, and **Cost unknown** otherwise.
145
+
146
+ `/connect` also accepts an OpenAI-compatible base URL, API key, and explicit
147
+ model ID for providers such as OpenRouter, Z.AI, DeepSeek, Moonshot, and
148
+ Mistral. Compatibility depends on each provider supporting `/v1/models` and
149
+ streaming `/v1/chat/completions` with tool calls. Provider credentials are saved
150
+ in `~/.moderado/config.json`; protect that file and never commit it.
151
+
152
+ ### 1. Build & Test
153
+ ```bash
154
+ # Install workspace dependencies
155
+ npm install
156
+
157
+ # Build all packages via TypeScript project references
158
+ npm run build
159
+
160
+ # Run full automated test suite (100% offline, zero API keys required)
161
+ npm test
162
+ ```
163
+
164
+ ### 2. Manual Live Smoke Test (Optional)
165
+ To test live model discovery and chat against NVIDIA NIM with real credentials:
166
+ ```bash
167
+ # PowerShell
168
+ $env:NVIDIA_API_KEY="nvapi-..."
169
+ node scripts/smoke_test.js
170
+
171
+ # POSIX (bash/zsh)
172
+ export NVIDIA_API_KEY="nvapi-..."
173
+ node scripts/smoke_test.js
174
+ ```
175
+
176
+ ---
177
+
178
+ ## License
179
+
180
+ This project is licensed under the MIT License.
181
+ *NVIDIA NIM, NGC, and model weights/APIs are subject to their respective terms and licenses. Moderado is independent and not endorsed by NVIDIA.*
182
+
183
+ ### Practical coding workflow
184
+
185
+ Use `/workflow` from the TUI to work through a change safely:
186
+
187
+ - **Git status** shows the current branch and changed files without using a shell.
188
+ - **Review diff** shows the bounded working-tree diff.
189
+ - In **Plan** mode, Moderado asks the model for a concise checklist and cannot make workspace changes. Choose **Build plan** and confirm to send that checklist to Execute mode.
190
+ - File writes, exact edits, and multi-file patches show their change preview and still require approval. Moderado records a byte-preserving checkpoint immediately before an approved file mutation.
191
+ - **Undo latest agent change** requires its own approval. It restores the latest completed checkpoint from `~/.moderado/checkpoints/` only when every affected file still has the expected post-change digest. If a file changed externally, it reports the conflict and restores nothing.
192
+
193
+ ### Diagnostics evidence
194
+
195
+ Ask Moderado to run diagnostics, typecheck, lint, or tests in a TypeScript or JavaScript workspace. It may run only the direct `typecheck`, `lint`, or `test` script defined in that workspace�s `package.json`, and every run requires approval. A non-zero exit returns parsed TypeScript errors as repair evidence; it does not bypass the safety boundary.
196
+
197
+ ### TypeScript language intelligence
198
+
199
+ Install `typescript-language-server` yourself, then set `typescriptLanguageServer` in `~/.moderado/config.json` to its executable path. Moderado can then use read-only definition and reference lookup for TypeScript/JavaScript files. When the executable is unavailable, it reports how to configure it and leaves normal tools available.
200
+
201
+ ### Local MCP tools
202
+
203
+ Configure trusted local stdio MCP servers under `mcpServers` in `~/.moderado/config.json`, with an executable and fixed `args` list. Moderado discovers server tools at session startup, namespaces them as `mcp.<server>.<tool>`, and requires approval for every call. MCP network transports and automatic server installation are not supported.
204
+
205
+ ### Host event protocol
206
+
207
+ Moderado exposes a versioned host-event envelope with session identity and monotonic sequence numbers. The CLI continues to render the contained agent event, while a future desktop host can consume the same protocol without importing CLI code.
208
+
209
+ ### Doctor command
210
+
211
+ Run `moderado doctor` to check the local Node runtime, workspace, Moderado home directory, provider/key presence, Git, and npm without exposing credentials. Run `moderado doctor --connectivity` only when you want an explicit live provider catalog check.
212
+
213
+ ## Windows credential storage
214
+
215
+ On Windows, /connect saves provider API keys in Windows Credential Manager and stores only a provider credential reference in ~/.moderado/config.json. Existing plaintext keys remain usable for compatibility. Migrate them explicitly with moderado doctor --migrate-credentials; a failed migration leaves the existing configuration unchanged. On other platforms, set the provider environment variable (for example, NVIDIA_API_KEY or OPENROUTER_API_KEY).
package/dist/args.js CHANGED
@@ -78,35 +78,35 @@ export function parseCliArgs(args = process.argv.slice(2)) {
78
78
  };
79
79
  }
80
80
  export function getHelpText() {
81
- return `Moderado - Lightweight CLI coding agent with NVIDIA NIM discovery and free-first routing.
82
-
83
- USAGE:
84
- moderado models [options]
85
- moderado run "<task>" [options]
86
- moderado "<task>" [options]
87
-
88
- COMMANDS:
89
- models Discover live models, capability & access tiers
90
- run "<task>" Execute a bounded coding task in the workspace\n skills List installed user skills
91
- doctor Check local Moderado setup
92
-
93
- OPTIONS:
94
- -w, --workspace <path> Target workspace directory (default: current directory)
95
- -m, --model <id> Pin a specific model (disables AUTO fallback)
96
- -p, --profile <name> Target configured profile (default: hosted-nvidia)
97
- --max-steps <int> Upper bound on tool interaction cycles (default: 25)
98
- --max-tokens <int> Hard limit on generated output tokens per response (default: 1024)
99
- --timeout <seconds> Global session execution timeout (default: 600s)
100
- --read-only Enforce read-only mode (blocks writes & commands)
101
- -y, --auto-approve Automatically approve all tool operations
102
- --non-interactive Fail closed on operations requiring approval
103
- --allow-paid Permit paid models during AUTO routing
104
- --allow-unknown Permit unverified/unknown access models in AUTO
105
- --verbose Display raw tool inputs and event logs
106
- --json Output results in structured JSON (models command)
107
- --migrate-credentials Move legacy Windows config keys into Credential Manager
108
- -h, --help Show this help screen
109
- -v, --version Show version identifier
81
+ return `Moderado - Lightweight CLI coding agent with NVIDIA NIM discovery and free-first routing.
82
+
83
+ USAGE:
84
+ moderado models [options]
85
+ moderado run "<task>" [options]
86
+ moderado "<task>" [options]
87
+
88
+ COMMANDS:
89
+ models Discover live models, capability & access tiers
90
+ run "<task>" Execute a bounded coding task in the workspace\n skills List installed user skills
91
+ doctor Check local Moderado setup
92
+
93
+ OPTIONS:
94
+ -w, --workspace <path> Target workspace directory (default: current directory)
95
+ -m, --model <id> Pin a specific model (disables AUTO fallback)
96
+ -p, --profile <name> Target configured profile (default: hosted-nvidia)
97
+ --max-steps <int> Upper bound on tool interaction cycles (default: 25)
98
+ --max-tokens <int> Hard limit on generated output tokens per response (default: 1024)
99
+ --timeout <seconds> Global session execution timeout (default: 600s)
100
+ --read-only Enforce read-only mode (blocks writes & commands)
101
+ -y, --auto-approve Automatically approve all tool operations
102
+ --non-interactive Fail closed on operations requiring approval
103
+ --allow-paid Permit paid models during AUTO routing
104
+ --allow-unknown Permit unverified/unknown access models in AUTO
105
+ --verbose Display raw tool inputs and event logs
106
+ --json Output results in structured JSON (models command)
107
+ --migrate-credentials Move legacy Windows config keys into Credential Manager
108
+ -h, --help Show this help screen
109
+ -v, --version Show version identifier
110
110
  `;
111
111
  }
112
112
  //# sourceMappingURL=args.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The per-turn agent modes shared by the interactive CLI and the VS Code host
3
+ * runtime, so both build the same planning prompt from one definition.
4
+ */
5
+ export type ChatMode = 'plan' | 'act';
6
+ /**
7
+ * Build the task prompt for a mode. `Execute` passes the request through
8
+ * untouched; `Plan` asks for a checklist and forbids mutation in the prompt.
9
+ *
10
+ * This text is advisory. A read-only `PolicyManager` is what actually blocks
11
+ * writes, so a caller in plan mode must also run the turn with `readOnly: true`.
12
+ */
13
+ export declare function createAgentTask(request: string, mode: 'Plan' | 'Execute'): string;
14
+ //# sourceMappingURL=chat_mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat_mode.d.ts","sourceRoot":"","sources":["../src/chat_mode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGjF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Build the task prompt for a mode. `Execute` passes the request through
3
+ * untouched; `Plan` asks for a checklist and forbids mutation in the prompt.
4
+ *
5
+ * This text is advisory. A read-only `PolicyManager` is what actually blocks
6
+ * writes, so a caller in plan mode must also run the turn with `readOnly: true`.
7
+ */
8
+ export function createAgentTask(request, mode) {
9
+ if (mode === 'Execute')
10
+ return request;
11
+ return `Create a concise implementation checklist for this request. Inspect files as needed, but do not modify files or run commands.\n\nUser request:\n${request}`;
12
+ }
13
+ //# sourceMappingURL=chat_mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat_mode.js","sourceRoot":"","sources":["../src/chat_mode.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,IAAwB;IACvE,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IACvC,OAAO,mJAAmJ,OAAO,EAAE,CAAC;AACtK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/commands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AU,EAAE,MAAM,EAAE,KAAK,IAAI,EACzC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CA+Hf;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC9F,QAAQ,EAAE,aAAa,GAAG,SAAS,EACnC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,UAAU,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1E,MAAM,CAAC,EAAE,WAAW,EACpB,SAAS,CAAC,EAAE,WAAW,GACtB,OAAO,CAAC,IAAI,CAAC,CAoGf;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA03BnH"}
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import fs from 'node:fs';
3
+ import readline from 'node:readline';
3
4
  import { AgentLoop, PolicyManager, Router, cleanConversationalFiller, DEFAULT_MAX_OUTPUT_TOKENS } from '../vendor/core/index.js';
4
5
  import { NvidiaAdapter } from '../vendor/providers/index.js';
5
6
  import { createDefaultToolRegistry, ToolRegistry, canonicalizeRoot, createMcpTools, createWebSearchTool, discoverMcpServers, resolveInJail, WorkspaceCheckpointStore, WriteFileTool } from '../vendor/tools/index.js';
@@ -1440,9 +1441,8 @@ export async function handleChatSession(args, version, signal) {
1440
1441
  });
1441
1442
  };
1442
1443
  if (process.stdin.isTTY) {
1443
- const readlineModule = await import('node:readline');
1444
1444
  const attachGenerationListener = () => {
1445
- readlineModule.emitKeypressEvents(process.stdin);
1445
+ readline.emitKeypressEvents(process.stdin);
1446
1446
  process.stdin.resume();
1447
1447
  process.stdin.setRawMode(true);
1448
1448
  process.stdin.on('keypress', onGenerationKeypress);