protoagent 0.0.4 → 0.1.0

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 +99 -19
  2. package/dist/App.js +602 -0
  3. package/dist/agentic-loop.js +492 -525
  4. package/dist/cli.js +39 -0
  5. package/dist/components/CollapsibleBox.js +26 -0
  6. package/dist/components/ConfigDialog.js +40 -0
  7. package/dist/components/ConsolidatedToolMessage.js +41 -0
  8. package/dist/components/FormattedMessage.js +93 -0
  9. package/dist/components/Table.js +275 -0
  10. package/dist/config.js +171 -0
  11. package/dist/mcp.js +170 -0
  12. package/dist/providers.js +137 -0
  13. package/dist/sessions.js +161 -0
  14. package/dist/skills.js +229 -0
  15. package/dist/sub-agent.js +103 -0
  16. package/dist/system-prompt.js +131 -0
  17. package/dist/tools/bash.js +178 -0
  18. package/dist/tools/edit-file.js +65 -171
  19. package/dist/tools/index.js +79 -134
  20. package/dist/tools/list-directory.js +20 -73
  21. package/dist/tools/read-file.js +57 -101
  22. package/dist/tools/search-files.js +74 -162
  23. package/dist/tools/todo.js +57 -140
  24. package/dist/tools/webfetch.js +310 -0
  25. package/dist/tools/write-file.js +44 -135
  26. package/dist/utils/approval.js +69 -0
  27. package/dist/utils/compactor.js +87 -0
  28. package/dist/utils/cost-tracker.js +26 -81
  29. package/dist/utils/format-message.js +26 -0
  30. package/dist/utils/logger.js +101 -307
  31. package/dist/utils/path-validation.js +74 -0
  32. package/package.json +45 -51
  33. package/LICENSE +0 -21
  34. package/dist/config/client.js +0 -315
  35. package/dist/config/commands.js +0 -223
  36. package/dist/config/manager.js +0 -117
  37. package/dist/config/mcp-commands.js +0 -266
  38. package/dist/config/mcp-manager.js +0 -240
  39. package/dist/config/mcp-types.js +0 -28
  40. package/dist/config/providers.js +0 -229
  41. package/dist/config/setup.js +0 -209
  42. package/dist/config/system-prompt.js +0 -397
  43. package/dist/config/types.js +0 -4
  44. package/dist/index.js +0 -222
  45. package/dist/tools/create-directory.js +0 -76
  46. package/dist/tools/directory-operations.js +0 -195
  47. package/dist/tools/file-operations.js +0 -211
  48. package/dist/tools/run-shell-command.js +0 -746
  49. package/dist/tools/search-operations.js +0 -179
  50. package/dist/tools/shell-operations.js +0 -342
  51. package/dist/tools/task-complete.js +0 -26
  52. package/dist/tools/view-directory-tree.js +0 -125
  53. package/dist/tools.js +0 -2
  54. package/dist/utils/conversation-compactor.js +0 -140
  55. package/dist/utils/enhanced-prompt.js +0 -23
  56. package/dist/utils/file-operations-approval.js +0 -373
  57. package/dist/utils/interrupt-handler.js +0 -127
  58. package/dist/utils/user-cancellation.js +0 -34
package/README.md CHANGED
@@ -1,39 +1,119 @@
1
1
  # ProtoAgent
2
2
 
3
- 🤖 **Interactive AI coding agent that can read, write, and execute files in your terminal.**
3
+ A minimal, educational AI coding agent CLI written in TypeScript. It stays small enough to read in an afternoon, but it still has the core pieces you expect from a real coding agent: a streaming tool-use loop, approvals, sessions, MCP, skills, sub-agents, and cost tracking.
4
4
 
5
- ## Get Started
5
+ ## Features
6
+
7
+ - **Multi-provider chat** — OpenAI, Anthropic, Google Gemini, and Cerebras via the OpenAI SDK
8
+ - **Built-in tools** — Read, write, edit, list, search, run shell commands, manage todos, and fetch web pages with `webfetch`
9
+ - **Approval system** — Inline confirmation for file writes, file edits, and non-safe shell commands
10
+ - **Session persistence** — Conversations and TODO state are saved automatically and can be resumed with `--session`
11
+ - **Dynamic extensions** — Load skills on demand and add external tools through MCP servers
12
+ - **Sub-agents** — Delegate self-contained tasks to isolated child conversations
13
+ - **Usage tracking** — Live token, context, and estimated cost display in the TUI
14
+
15
+ ## Quick Start
6
16
 
7
17
  ```bash
8
18
  npm install -g protoagent
9
19
  protoagent
10
20
  ```
11
21
 
12
- That's it! ProtoAgent will guide you through setup and start helping with your coding tasks.
22
+ On first run, ProtoAgent shows an inline setup flow where you pick a provider/model pair and enter an API key. Config is stored in `~/.local/share/protoagent/config.json` on macOS/Linux and `~/AppData/Local/protoagent/config.json` on Windows.
23
+
24
+ You can also run the standalone wizard directly:
25
+
26
+ ```bash
27
+ protoagent configure
28
+ ```
29
+
30
+ ## Interactive Commands
13
31
 
14
- ## What it does
32
+ - `/help` Show available slash commands
33
+ - `/clear` — Start a fresh conversation in a new session
34
+ - `/collapse` — Collapse long system and tool output
35
+ - `/expand` — Expand collapsed messages
36
+ - `/quit` or `/exit` — Save and exit
15
37
 
16
- - **File Operations** - Read, write, edit, and search files
17
- - **Shell Commands** - Execute terminal commands safely
18
- - **Code Analysis** - Understand and analyze your codebase
19
- - **Project Generation** - Create files, folders, and entire project structures
20
- - **Interactive Chat** - Natural language interface for all coding tasks
38
+ Other useful shortcuts:
21
39
 
22
- ## Example Usage
40
+ - `Esc` — Abort the current in-flight completion
41
+ - `Ctrl-C` — Exit immediately
23
42
 
43
+ ## Building From Source
44
+
45
+ ```bash
46
+ npm install
47
+ npm run build
48
+ npm run dev
24
49
  ```
25
- protoagent> Create a React component called Button.tsx
26
- protoagent> Find all TODO comments in my project
27
- protoagent> Set up a Node.js Express server with TypeScript
28
- protoagent> Debug this error in my package.json
29
- protoagent> Show me the structure of my src folder
50
+
51
+ ## Documentation
52
+
53
+ Full guides and tutorials live in `docs/`:
54
+
55
+ - `docs/guide/getting-started.md`
56
+ - `docs/guide/configuration.md`
57
+ - `docs/guide/tools.md`
58
+ - `docs/guide/sessions.md`
59
+ - `docs/guide/skills.md`
60
+ - `docs/guide/sub-agents.md`
61
+ - `docs/guide/mcp.md`
62
+
63
+ Build the docs site locally:
64
+
65
+ ```bash
66
+ npm run docs:dev
67
+ npm run docs:build
30
68
  ```
31
69
 
32
- ## Requirements
70
+ Top-level technical references:
71
+
72
+ - `SPEC.md` — current implementation specification
73
+ - `ARCHITECTURE.md` — current runtime architecture and module relationships
74
+
75
+ ## Architecture
76
+
77
+ The codebase is organized so each part is easy to trace:
78
+
79
+ - `src/cli.tsx` — CLI flags and the `configure` subcommand
80
+ - `src/App.tsx` — Ink app shell, runtime orchestration, slash commands, approvals, session display
81
+ - `src/agentic-loop.ts` — Streaming tool-use loop and error handling
82
+ - `src/tools/` — Built-in tools such as file I/O, shell, todo tracking, and `webfetch`
83
+ - `src/config.tsx` — Config persistence and setup wizard
84
+ - `src/providers.ts` — Provider/model catalog and pricing metadata
85
+ - `src/sessions.ts` — Session save/load and TODO persistence
86
+ - `src/skills.ts` — Skill discovery and dynamic `activate_skill` tool registration
87
+ - `src/mcp.ts` — MCP server loading and dynamic tool registration
88
+ - `src/sub-agent.ts` — Isolated child agent execution
89
+
90
+ ## Supported Providers
91
+
92
+ ### OpenAI
93
+ - GPT-5.2
94
+ - GPT-5 Mini
95
+ - GPT-4.1
96
+
97
+ ### Anthropic Claude
98
+ - Claude Opus 4.6
99
+ - Claude Sonnet 4.6
100
+ - Claude Haiku 4.5
101
+
102
+ ### Google Gemini
103
+ - Gemini 3 Flash (Preview)
104
+ - Gemini 3 Pro (Preview)
105
+ - Gemini 2.5 Flash
106
+ - Gemini 2.5 Pro
107
+
108
+ ### Cerebras
109
+ - Cerebras — Llama 4 Scout 17B
110
+
111
+ ## Why ProtoAgent?
112
+
113
+ ProtoAgent is not trying to be a giant framework. It is a compact reference implementation for how coding agents work in practice: configuration, dynamic system prompts, a streaming agent loop, tool registries, approvals, sessions, MCP, skills, and delegated sub-agents.
33
114
 
34
- - Node.js 16+
35
- - OpenAI API key (you'll be prompted to set this up on first run)
115
+ If you want to learn by reading source instead of magic abstractions, this repo is built for that.
36
116
 
37
117
  ## License
38
118
 
39
- MIT
119
+ MIT