osagent 0.1.95 → 0.1.97

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.
package/LICENSE ADDED
@@ -0,0 +1,73 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ APPENDIX: How to apply the Apache License to your work.
58
+
59
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
+
61
+ Copyright 2025 OSA
62
+
63
+ Licensed under the Apache License, Version 2.0 (the "License");
64
+ you may not use this file except in compliance with the License.
65
+ You may obtain a copy of the License at
66
+
67
+ http://www.apache.org/licenses/LICENSE-2.0
68
+
69
+ Unless required by applicable law or agreed to in writing, software
70
+ distributed under the License is distributed on an "AS IS" BASIS,
71
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72
+ See the License for the specific language governing permissions and
73
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,406 @@
1
+ # OS Agent
2
+
3
+ An AI-powered autonomous coding assistant CLI that runs locally with Ollama or connects to cloud AI providers. Built for developers who want full control over their AI coding assistant.
4
+
5
+ ## Features
6
+
7
+ - **Smart Onboarding**: Auto-detects your system, tools, and project on first run
8
+ - **Local-first AI**: Works with Ollama for completely private, offline usage
9
+ - **Cloud support**: Connect to Ollama Cloud or OpenAI-compatible APIs
10
+ - **Interactive CLI**: Beautiful terminal interface with monochrome green theme
11
+ - **Autonomous coding**: Generate, edit, and refactor code with natural language
12
+ - **Multi-file editing**: Make changes across your entire project
13
+ - **Git integration**: Automatic commits and PR creation
14
+ - **Consultation mode**: AI asks clarifying questions to better understand your needs
15
+ - **Conversation persistence**: Resume previous sessions with `/continue`
16
+ - **System health checks**: Built-in diagnostics with `/doctor`
17
+ - **Extensible**: MCP (Model Context Protocol) support for custom tools
18
+ - **Custom agents**: Define your own specialized agents in `~/.osagent/agents/`
19
+ - **Custom commands**: Create custom slash commands in `~/.osagent/commands/`
20
+ - **Custom skills**: Create skill plugins for multi-step workflows
21
+ - **Multi-agent orchestration**: Automatic skill detection and agent dispatch
22
+ - **Episodic memory**: Session tracking and learning from past interactions
23
+ - **Vector memory**: Semantic search over session history with ChromaDB
24
+ - **Embeddings**: Ollama embeddings with OpenRouter fallback
25
+ - **Advanced hooks**: 12 subagent hooks for lifecycle, memory, and skill events
26
+
27
+ ## Installation
28
+
29
+ ### From npm (recommended)
30
+
31
+ ```bash
32
+ npm install -g osagent
33
+ ```
34
+
35
+ ### From source
36
+
37
+ ```bash
38
+ git clone https://github.com/robertohluna/osagent.git
39
+ cd osagent
40
+ npm install
41
+ npm run build
42
+ npm link
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ### Option 1: Use with Ollama (Local - Recommended)
48
+
49
+ 1. Install [Ollama](https://ollama.com)
50
+ 2. Pull a coding model:
51
+ ```bash
52
+ ollama pull qwen2.5-coder:32b
53
+ ```
54
+ 3. Run OS Agent:
55
+ ```bash
56
+ osagent
57
+ ```
58
+
59
+ ### Option 2: Use with Ollama Cloud
60
+
61
+ 1. Get an API key from [Ollama Cloud](https://ollama.com)
62
+ 2. Set your API key:
63
+ ```bash
64
+ export OLLAMA_API_KEY=your-api-key
65
+ ```
66
+ 3. Run OS Agent:
67
+ ```bash
68
+ osagent
69
+ ```
70
+
71
+ ### Option 3: Use with OpenAI-compatible APIs
72
+
73
+ ```bash
74
+ osagent --auth openai
75
+ ```
76
+
77
+ ## Usage
78
+
79
+ ### Basic Commands
80
+
81
+ ```bash
82
+ # Start interactive mode
83
+ osagent
84
+
85
+ # Start with a prompt
86
+ osagent "Explain this codebase"
87
+
88
+ # Use a specific model
89
+ osagent --model qwen2.5-coder:32b
90
+
91
+ # Resume last conversation
92
+ osagent --continue
93
+
94
+ # Print a file and ask about it
95
+ osagent "What does this do?" < src/main.ts
96
+
97
+ # Run health check
98
+ osagent doctor
99
+
100
+ # Dangerous mode (auto-accept all tool executions)
101
+ osagent --dangerously
102
+ ```
103
+
104
+ ### Slash Commands
105
+
106
+ Once in the interactive mode, you can use these commands:
107
+
108
+ #### General
109
+ - `/help` - Show available commands
110
+ - `/about` - Show version and system info
111
+ - `/settings` - View and edit settings
112
+ - `/quit` or `/q` - Exit OS Agent
113
+
114
+ #### Model & AI
115
+ - `/model` - Switch AI model (supports local Ollama models)
116
+ - `/agents` - Manage custom agents
117
+ - `/consult` - Toggle consultation mode (AI asks clarifying questions)
118
+
119
+ #### Conversation
120
+ - `/continue` - Resume the most recent conversation
121
+ - `/continue list` - List recent sessions to resume
122
+ - `/reset` - Clear conversation and start fresh
123
+ - `/clear` - Clear the screen
124
+ - `/chat save <tag>` - Save conversation checkpoint
125
+ - `/chat resume <tag>` - Resume from checkpoint
126
+
127
+ #### Safety & Permissions
128
+ - `/dangerously` or `/yolo` - Toggle auto-accept mode for tool executions
129
+ - `/permissions` - View and manage tool permissions
130
+
131
+ #### System
132
+ - `/doctor` - Check system health and updates
133
+ - `/doctor update` - Auto-update to latest version
134
+ - `/doctor init` - Initialize `~/.osagent/` directory structure
135
+ - `/view` - View system architecture and configuration
136
+ - `/view config` - Current configuration
137
+ - `/view files` - Configuration files
138
+ - `/view models` - Supported models
139
+ - `/context` or `/ctx` - View context window usage and token stats
140
+
141
+ #### Utilities
142
+ - `/copy` - Copy last response to clipboard
143
+ - `/memory` - View and edit project memory
144
+ - `/tools` - List available tools
145
+ - `/mcp` - Manage MCP servers
146
+
147
+ ### Status Bar
148
+
149
+ While OS Agent works, you'll see a real-time status bar showing:
150
+ - Current activity with spinner
151
+ - Token usage (input ↑ / output ↓)
152
+ - Elapsed time
153
+ - Task progress and list
154
+
155
+ ```
156
+ ┌─────────────────────────────────────────────────────────┐
157
+ │ ◐ Writing tests for auth module... (2/5) ↑12.3k ↓8.2k 2m 15s │
158
+ │ ├─ ○ Create test file │
159
+ │ ├─ ◐ Writing unit tests │
160
+ │ └─ ○ Run tests and fix errors │
161
+ └─────────────────────────────────────────────────────────┘
162
+ ```
163
+
164
+ ### Consultation Mode
165
+
166
+ OS Agent can ask you clarifying questions as it works to better understand your requirements:
167
+
168
+ ```bash
169
+ /consult on # Active mode - questions shown while agent works
170
+ /consult blocking # Blocking mode - high-priority questions pause the agent
171
+ /consult off # Disable consultation
172
+ /consult context # View collected context
173
+ ```
174
+
175
+ Questions appear in a dedicated panel below the status bar during agent operations.
176
+
177
+ ### Vector Memory (Optional)
178
+
179
+ For semantic search over session history, start ChromaDB:
180
+
181
+ ```bash
182
+ # Start ChromaDB with Docker
183
+ docker compose -f docker/docker-compose.yml up -d
184
+
185
+ # Ensure Ollama has the embedding model
186
+ ollama pull nomic-embed-text
187
+ ```
188
+
189
+ ### Multi-Agent Orchestration
190
+
191
+ OS Agent features an intelligent orchestration system that automatically:
192
+
193
+ - **Detects skills** in your prompts (debugging, testing, refactoring, etc.)
194
+ - **Selects the best agent** for each task based on capabilities
195
+ - **Dispatches execution** to specialized subagents
196
+ - **Tracks progress** with real-time status updates
197
+
198
+ The orchestrator runs transparently - just describe what you want and OS Agent handles the rest.
199
+
200
+ ### Episodic Memory
201
+
202
+ OS Agent learns from your sessions:
203
+
204
+ - **Records episodes** of your interactions automatically
205
+ - **Tracks actions** including tools used and files modified
206
+ - **Saves outcomes** for future reference
207
+ - **Enables recall** of past patterns and solutions
208
+
209
+ Episodes are stored locally in `~/.osagent/episodes/`.
210
+
211
+ ### Configuration
212
+
213
+ OS Agent stores its configuration in `~/.osagent/` (created automatically on first run):
214
+
215
+ ```
216
+ ~/.osagent/
217
+ ├── settings.json # User settings
218
+ ├── agents/ # Custom agent definitions (.md, .yaml, .json)
219
+ ├── commands/ # Custom slash commands (.toml)
220
+ ├── skills/ # Custom skill plugins (.yaml)
221
+ ├── prompts/ # Custom prompts
222
+ └── episodes/ # Episodic memory storage
223
+ ```
224
+
225
+ ### Custom Agents
226
+
227
+ Create custom agents in `~/.osagent/agents/`:
228
+
229
+ ```yaml
230
+ # ~/.osagent/agents/my-agent.yaml
231
+ name: my-agent
232
+ description: A specialized agent for my use case
233
+ systemPrompt: You are an expert in...
234
+ model: qwen2.5-coder:32b
235
+ ```
236
+
237
+ ### Project Memory
238
+
239
+ Create an `OSAGENT.md` file in your project root to give OS Agent context:
240
+
241
+ ```bash
242
+ osagent /init
243
+ ```
244
+
245
+ ## Supported Models
246
+
247
+ ### Cloud Models (Ollama Cloud)
248
+ - `qwen3-coder:480b-cloud` - Most powerful (256K context)
249
+ - `qwen3-coder:30b` - Efficient (30B params, 3.3B active)
250
+
251
+ ### Local Models (Ollama)
252
+ - `qwen2.5-coder:32b` - Best local coding model (~20GB VRAM)
253
+ - `qwen2.5-coder:14b` - Great balance (~10GB VRAM)
254
+ - `qwen2.5-coder:7b` - Good for limited VRAM (~5GB)
255
+ - `codellama:34b` - Meta's coding model
256
+ - `deepseek-coder-v2:16b` - Efficient MoE model
257
+ - `llama3.2:latest` - General purpose
258
+
259
+ ## Requirements
260
+
261
+ - Node.js >= 20.0.0
262
+ - Ollama (for local usage) or API key for cloud providers
263
+
264
+ ## Development
265
+
266
+ ```bash
267
+ # Install dependencies
268
+ npm install
269
+
270
+ # Build all packages
271
+ npm run build
272
+
273
+ # Run in development mode
274
+ npm run start
275
+
276
+ # Run tests
277
+ npm run test
278
+
279
+ # Type check
280
+ npm run typecheck
281
+
282
+ # Lint
283
+ npm run lint
284
+ ```
285
+
286
+ ## Architecture
287
+
288
+ OS Agent is a monorepo with the following packages:
289
+
290
+ ```
291
+ packages/
292
+ ├── cli/ # Terminal UI and user interaction (React/Ink)
293
+ ├── core/ # AI engine, tools, and services
294
+ ├── test-utils/ # Shared test utilities
295
+ └── vscode-ide-companion/ # VS Code extension
296
+ ```
297
+
298
+ ## Keyboard Shortcuts
299
+
300
+ ### General
301
+ - `Ctrl+C` - Cancel current operation / Exit (press twice)
302
+ - `Ctrl+D` - Exit
303
+ - `Escape` - Cancel operation / Clear input
304
+ - `Tab` - Autocomplete commands
305
+ - `Up/Down` - Navigate history
306
+ - `?` - Show shortcuts help
307
+
308
+ ### During Operations
309
+ - `Ctrl+O` - Expand/collapse output
310
+ - `Ctrl+Y` - Toggle todo list visibility
311
+ - `Ctrl+E` - Toggle agent detail level
312
+ - `Ctrl+F` - Focus embedded shell
313
+
314
+ ### Text Editing
315
+ - `Ctrl+L` - Clear screen
316
+ - `Ctrl+A` - Move to start of line
317
+ - `Ctrl+E` - Move to end of line
318
+ - `Ctrl+K` - Delete to end of line
319
+ - `Ctrl+U` - Delete to start of line
320
+ - `Shift+Enter` - Insert newline
321
+
322
+ ## Recent Updates
323
+
324
+ ### v0.1.87 - Test Fixes & Documentation
325
+ - Fixed all test failures (3170/3170 tests now passing)
326
+ - Updated naming consistency across codebase
327
+ - Fixed vision model detection in DashScope provider
328
+ - Added gopd dependency troubleshooting documentation
329
+ - Improved MCP client transport handling
330
+
331
+ ### v0.1.86 - Auto Project Context
332
+ - Automatic project context injection on first prompt
333
+ - When no OSAGENT.md exists, AI auto-explores project structure before responding
334
+ - No manual `/init` required for casual usage
335
+
336
+ ### v0.1.85 - Security & Stability Fixes
337
+ - Timer now only counts active work time (stops when idle)
338
+ - Fixed command injection vulnerability in git co-author feature
339
+ - Fixed symlink bypass in path validation
340
+ - Fixed VimModeContext re-render loop
341
+
342
+ ### v0.1.83 - Enhanced Doctor Command
343
+ - Added enhanced installation diagnostics to `/doctor`
344
+ - Shows installation method (npm-global, homebrew, native, source)
345
+ - Displays binary path and invoked path
346
+ - Shows auto-updates status and search/ripgrep status
347
+ - Detects and warns about multiple installations
348
+ - New "All systems go" summary style
349
+
350
+ ### v0.1.81 - Stability & Auto-Initialization
351
+ - Fixed "Maximum update depth exceeded" infinite loop (3800+ errors)
352
+ - Added automatic `~/.osagent/` directory initialization on startup
353
+ - Creates required directories: agents, commands, prompts, skills, episodes
354
+ - Auth credentials now properly saved when switching providers
355
+
356
+ ### v0.1.80 - Auth Provider Fix
357
+ - Fixed auth configuration mismatch when switching providers
358
+ - Ensures baseUrl and model are saved correctly to settings
359
+
360
+ ### v0.1.79 - IDE Terminal Compatibility
361
+ - Migrated all dialogs from custom `useKeypress` to Ink's `useInput` hook
362
+ - Fixes arrow key issues in VS Code, Cursor, and other IDE terminals
363
+ - Arrow keys no longer print escape sequences (`^[[A^[[B`) in dialogs
364
+ - Improved compatibility with IDE terminals that don't support raw mode
365
+
366
+ ### v0.1.66 - Focus Management
367
+ - New `useFocusedKeypress` hook for enforced focus management
368
+ - Prevents keypress conflicts between dialogs and main UI
369
+ - Required `isFocused` parameter catches bugs at compile time
370
+
371
+ ### v0.1.65 - Input Routing Fix
372
+ - Fixed keyboard input routing issues with selectors
373
+ - Arrow keys and Enter now properly isolated to focused component
374
+ - No more keypress "leakage" between dialogs
375
+
376
+ ### v0.1.64 - UI Improvements
377
+ - Tree-view style tool display with `├─` `└─` connectors
378
+ - Expandable results with `Ctrl+O`
379
+ - Token counts and duration stats
380
+ - Sleeker ASCII art header
381
+ - Minimal init banner
382
+
383
+ ### v0.1.63 - Stability Fix
384
+ - Fixed infinite loop on startup (Maximum update depth exceeded)
385
+ - Improved React effect dependency management
386
+
387
+ ### v0.1.59 - Terminal Stability
388
+ - Fixed EIO error crash on stdin
389
+ - Graceful handling of TTY disconnects
390
+ - Stable arrow key navigation in selectors
391
+
392
+ See [KNOWN_ISSUES.md](docs/KNOWN_ISSUES.md) for detailed issue tracking.
393
+
394
+ ## License
395
+
396
+ Apache-2.0
397
+
398
+ ## Contributing
399
+
400
+ Contributions are welcome! Please read our contributing guidelines before submitting PRs.
401
+
402
+ ## Links
403
+
404
+ - [GitHub](https://github.com/robertohluna/osagent)
405
+ - [npm](https://www.npmjs.com/package/osagent)
406
+ - [Issues](https://github.com/robertohluna/osagent/issues)