@bloxystudios/bloxycode 1.0.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.
- package/LICENSE +21 -0
- package/README.md +256 -0
- package/bin/bloxycode +84 -0
- package/package.json +133 -0
- package/src/acp/README.md +164 -0
- package/src/acp/agent.ts +1437 -0
- package/src/acp/session.ts +105 -0
- package/src/acp/types.ts +22 -0
- package/src/agent/agent.ts +356 -0
- package/src/agent/generate.txt +75 -0
- package/src/agent/prompt/bloxy.txt +46 -0
- package/src/agent/prompt/compaction.txt +12 -0
- package/src/agent/prompt/explore.txt +18 -0
- package/src/agent/prompt/summary.txt +11 -0
- package/src/agent/prompt/title.txt +44 -0
- package/src/auth/index.ts +73 -0
- package/src/bloxy/event.ts +41 -0
- package/src/bloxy/index.ts +5 -0
- package/src/bloxy/parser.ts +263 -0
- package/src/bloxy/prompt.ts +121 -0
- package/src/bloxy/runner.ts +193 -0
- package/src/bloxy/state.ts +246 -0
- package/src/bun/index.ts +134 -0
- package/src/bus/bus-event.ts +43 -0
- package/src/bus/global.ts +10 -0
- package/src/bus/index.ts +105 -0
- package/src/cli/bootstrap.ts +17 -0
- package/src/cli/cmd/acp.ts +69 -0
- package/src/cli/cmd/agent.ts +257 -0
- package/src/cli/cmd/auth.ts +400 -0
- package/src/cli/cmd/cmd.ts +7 -0
- package/src/cli/cmd/debug/agent.ts +167 -0
- package/src/cli/cmd/debug/config.ts +16 -0
- package/src/cli/cmd/debug/file.ts +97 -0
- package/src/cli/cmd/debug/index.ts +48 -0
- package/src/cli/cmd/debug/lsp.ts +52 -0
- package/src/cli/cmd/debug/ripgrep.ts +87 -0
- package/src/cli/cmd/debug/scrap.ts +16 -0
- package/src/cli/cmd/debug/skill.ts +16 -0
- package/src/cli/cmd/debug/snapshot.ts +52 -0
- package/src/cli/cmd/export.ts +88 -0
- package/src/cli/cmd/generate.ts +38 -0
- package/src/cli/cmd/github.ts +1548 -0
- package/src/cli/cmd/import.ts +98 -0
- package/src/cli/cmd/mcp.ts +755 -0
- package/src/cli/cmd/models.ts +77 -0
- package/src/cli/cmd/pr.ts +112 -0
- package/src/cli/cmd/run.ts +395 -0
- package/src/cli/cmd/serve.ts +20 -0
- package/src/cli/cmd/session.ts +135 -0
- package/src/cli/cmd/stats.ts +402 -0
- package/src/cli/cmd/tui/app.tsx +771 -0
- package/src/cli/cmd/tui/attach.ts +39 -0
- package/src/cli/cmd/tui/component/border.tsx +21 -0
- package/src/cli/cmd/tui/component/dialog-agent.tsx +31 -0
- package/src/cli/cmd/tui/component/dialog-command.tsx +148 -0
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +86 -0
- package/src/cli/cmd/tui/component/dialog-model.tsx +234 -0
- package/src/cli/cmd/tui/component/dialog-provider.tsx +256 -0
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +114 -0
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +31 -0
- package/src/cli/cmd/tui/component/dialog-stash.tsx +87 -0
- package/src/cli/cmd/tui/component/dialog-status.tsx +164 -0
- package/src/cli/cmd/tui/component/dialog-tag.tsx +44 -0
- package/src/cli/cmd/tui/component/dialog-theme-list.tsx +50 -0
- package/src/cli/cmd/tui/component/logo.tsx +102 -0
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +653 -0
- package/src/cli/cmd/tui/component/prompt/frecency.tsx +89 -0
- package/src/cli/cmd/tui/component/prompt/history.tsx +108 -0
- package/src/cli/cmd/tui/component/prompt/index.tsx +1138 -0
- package/src/cli/cmd/tui/component/prompt/stash.tsx +101 -0
- package/src/cli/cmd/tui/component/textarea-keybindings.ts +73 -0
- package/src/cli/cmd/tui/component/tips.tsx +153 -0
- package/src/cli/cmd/tui/component/todo-item.tsx +32 -0
- package/src/cli/cmd/tui/context/args.tsx +14 -0
- package/src/cli/cmd/tui/context/directory.ts +13 -0
- package/src/cli/cmd/tui/context/exit.tsx +23 -0
- package/src/cli/cmd/tui/context/helper.tsx +25 -0
- package/src/cli/cmd/tui/context/keybind.tsx +101 -0
- package/src/cli/cmd/tui/context/kv.tsx +52 -0
- package/src/cli/cmd/tui/context/local.tsx +402 -0
- package/src/cli/cmd/tui/context/prompt.tsx +18 -0
- package/src/cli/cmd/tui/context/route.tsx +46 -0
- package/src/cli/cmd/tui/context/sdk.tsx +94 -0
- package/src/cli/cmd/tui/context/sync.tsx +470 -0
- package/src/cli/cmd/tui/context/theme/aura.json +69 -0
- package/src/cli/cmd/tui/context/theme/ayu.json +80 -0
- package/src/cli/cmd/tui/context/theme/bloxycode.json +245 -0
- package/src/cli/cmd/tui/context/theme/carbonfox.json +248 -0
- package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +233 -0
- package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +233 -0
- package/src/cli/cmd/tui/context/theme/catppuccin.json +112 -0
- package/src/cli/cmd/tui/context/theme/cobalt2.json +228 -0
- package/src/cli/cmd/tui/context/theme/cursor.json +249 -0
- package/src/cli/cmd/tui/context/theme/dracula.json +219 -0
- package/src/cli/cmd/tui/context/theme/everforest.json +241 -0
- package/src/cli/cmd/tui/context/theme/flexoki.json +237 -0
- package/src/cli/cmd/tui/context/theme/github.json +233 -0
- package/src/cli/cmd/tui/context/theme/gruvbox.json +242 -0
- package/src/cli/cmd/tui/context/theme/kanagawa.json +77 -0
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +237 -0
- package/src/cli/cmd/tui/context/theme/material.json +235 -0
- package/src/cli/cmd/tui/context/theme/matrix.json +77 -0
- package/src/cli/cmd/tui/context/theme/mercury.json +252 -0
- package/src/cli/cmd/tui/context/theme/monokai.json +221 -0
- package/src/cli/cmd/tui/context/theme/nightowl.json +221 -0
- package/src/cli/cmd/tui/context/theme/nord.json +223 -0
- package/src/cli/cmd/tui/context/theme/one-dark.json +84 -0
- package/src/cli/cmd/tui/context/theme/orng.json +249 -0
- package/src/cli/cmd/tui/context/theme/osaka-jade.json +93 -0
- package/src/cli/cmd/tui/context/theme/palenight.json +222 -0
- package/src/cli/cmd/tui/context/theme/rosepine.json +234 -0
- package/src/cli/cmd/tui/context/theme/solarized.json +223 -0
- package/src/cli/cmd/tui/context/theme/synthwave84.json +226 -0
- package/src/cli/cmd/tui/context/theme/tokyonight.json +243 -0
- package/src/cli/cmd/tui/context/theme/vercel.json +245 -0
- package/src/cli/cmd/tui/context/theme/vesper.json +218 -0
- package/src/cli/cmd/tui/context/theme/zenburn.json +223 -0
- package/src/cli/cmd/tui/context/theme.tsx +1152 -0
- package/src/cli/cmd/tui/event.ts +48 -0
- package/src/cli/cmd/tui/routes/home.tsx +140 -0
- package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +64 -0
- package/src/cli/cmd/tui/routes/session/dialog-message.tsx +109 -0
- package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +26 -0
- package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +47 -0
- package/src/cli/cmd/tui/routes/session/footer.tsx +91 -0
- package/src/cli/cmd/tui/routes/session/header.tsx +142 -0
- package/src/cli/cmd/tui/routes/session/index.tsx +2048 -0
- package/src/cli/cmd/tui/routes/session/permission.tsx +508 -0
- package/src/cli/cmd/tui/routes/session/question.tsx +453 -0
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +313 -0
- package/src/cli/cmd/tui/thread.ts +165 -0
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +57 -0
- package/src/cli/cmd/tui/ui/dialog-confirm.tsx +83 -0
- package/src/cli/cmd/tui/ui/dialog-export-options.tsx +204 -0
- package/src/cli/cmd/tui/ui/dialog-help.tsx +38 -0
- package/src/cli/cmd/tui/ui/dialog-prompt.tsx +77 -0
- package/src/cli/cmd/tui/ui/dialog-select.tsx +385 -0
- package/src/cli/cmd/tui/ui/dialog.tsx +167 -0
- package/src/cli/cmd/tui/ui/link.tsx +28 -0
- package/src/cli/cmd/tui/ui/spinner.ts +368 -0
- package/src/cli/cmd/tui/ui/toast.tsx +100 -0
- package/src/cli/cmd/tui/util/clipboard.ts +160 -0
- package/src/cli/cmd/tui/util/editor.ts +32 -0
- package/src/cli/cmd/tui/util/signal.ts +7 -0
- package/src/cli/cmd/tui/util/terminal.ts +114 -0
- package/src/cli/cmd/tui/util/transcript.ts +98 -0
- package/src/cli/cmd/tui/worker.ts +152 -0
- package/src/cli/cmd/uninstall.ts +357 -0
- package/src/cli/cmd/upgrade.ts +73 -0
- package/src/cli/cmd/web.ts +81 -0
- package/src/cli/error.ts +57 -0
- package/src/cli/network.ts +53 -0
- package/src/cli/ui.ts +86 -0
- package/src/cli/upgrade.ts +25 -0
- package/src/command/index.ts +173 -0
- package/src/command/template/bloxy-resume.txt +15 -0
- package/src/command/template/bloxy-status.txt +25 -0
- package/src/command/template/bloxy-validate.txt +22 -0
- package/src/command/template/bloxy.txt +14 -0
- package/src/command/template/initialize.txt +10 -0
- package/src/command/template/review.txt +99 -0
- package/src/config/config.ts +1367 -0
- package/src/config/markdown.ts +93 -0
- package/src/env/index.ts +26 -0
- package/src/file/ignore.ts +83 -0
- package/src/file/index.ts +415 -0
- package/src/file/ripgrep.ts +407 -0
- package/src/file/time.ts +69 -0
- package/src/file/watcher.ts +127 -0
- package/src/flag/flag.ts +79 -0
- package/src/format/formatter.ts +357 -0
- package/src/format/index.ts +137 -0
- package/src/global/index.ts +55 -0
- package/src/id/id.ts +83 -0
- package/src/ide/index.ts +76 -0
- package/src/index.ts +159 -0
- package/src/installation/index.ts +246 -0
- package/src/lsp/client.ts +252 -0
- package/src/lsp/index.ts +485 -0
- package/src/lsp/language.ts +119 -0
- package/src/lsp/server.ts +2046 -0
- package/src/mcp/auth.ts +135 -0
- package/src/mcp/index.ts +934 -0
- package/src/mcp/oauth-callback.ts +200 -0
- package/src/mcp/oauth-provider.ts +154 -0
- package/src/patch/index.ts +680 -0
- package/src/permission/arity.ts +163 -0
- package/src/permission/index.ts +210 -0
- package/src/permission/next.ts +280 -0
- package/src/plugin/antigravity.ts +378 -0
- package/src/plugin/codex.ts +506 -0
- package/src/plugin/copilot.ts +298 -0
- package/src/plugin/index.ts +136 -0
- package/src/project/bootstrap.ts +35 -0
- package/src/project/instance.ts +91 -0
- package/src/project/project.ts +371 -0
- package/src/project/state.ts +66 -0
- package/src/project/vcs.ts +76 -0
- package/src/provider/auth.ts +147 -0
- package/src/provider/models-snapshot.ts +2 -0
- package/src/provider/models.ts +133 -0
- package/src/provider/provider.ts +1241 -0
- package/src/provider/sdk/openai-compatible/src/README.md +5 -0
- package/src/provider/sdk/openai-compatible/src/index.ts +2 -0
- package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +100 -0
- package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +303 -0
- package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +22 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +18 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +22 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +207 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +1732 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +177 -0
- package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +1 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +88 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +128 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +115 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +65 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +104 -0
- package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +103 -0
- package/src/provider/transform.ts +741 -0
- package/src/pty/index.ts +241 -0
- package/src/question/index.ts +171 -0
- package/src/scheduler/index.ts +61 -0
- package/src/server/error.ts +36 -0
- package/src/server/event.ts +7 -0
- package/src/server/mdns.ts +59 -0
- package/src/server/routes/config.ts +92 -0
- package/src/server/routes/experimental.ts +208 -0
- package/src/server/routes/file.ts +197 -0
- package/src/server/routes/global.ts +135 -0
- package/src/server/routes/mcp.ts +225 -0
- package/src/server/routes/permission.ts +68 -0
- package/src/server/routes/project.ts +82 -0
- package/src/server/routes/provider.ts +165 -0
- package/src/server/routes/pty.ts +169 -0
- package/src/server/routes/question.ts +98 -0
- package/src/server/routes/session.ts +939 -0
- package/src/server/routes/tui.ts +379 -0
- package/src/server/server.ts +604 -0
- package/src/session/compaction.ts +225 -0
- package/src/session/fallback.ts +246 -0
- package/src/session/index.ts +498 -0
- package/src/session/instruction.ts +164 -0
- package/src/session/llm.ts +298 -0
- package/src/session/message-v2.ts +747 -0
- package/src/session/message.ts +189 -0
- package/src/session/processor.ts +450 -0
- package/src/session/prompt/anthropic-20250930.txt +166 -0
- package/src/session/prompt/anthropic.txt +105 -0
- package/src/session/prompt/beast.txt +147 -0
- package/src/session/prompt/build-switch.txt +5 -0
- package/src/session/prompt/codex_header.txt +79 -0
- package/src/session/prompt/copilot-gpt-5.txt +143 -0
- package/src/session/prompt/gemini.txt +155 -0
- package/src/session/prompt/max-steps.txt +16 -0
- package/src/session/prompt/plan-reminder-anthropic.txt +67 -0
- package/src/session/prompt/plan.txt +26 -0
- package/src/session/prompt/qwen.txt +109 -0
- package/src/session/prompt.ts +1822 -0
- package/src/session/retry.ts +99 -0
- package/src/session/revert.ts +121 -0
- package/src/session/status.ts +100 -0
- package/src/session/summary.ts +217 -0
- package/src/session/system.ts +52 -0
- package/src/session/todo.ts +37 -0
- package/src/share/share-next.ts +200 -0
- package/src/share/share.ts +92 -0
- package/src/shell/shell.ts +67 -0
- package/src/skill/index.ts +1 -0
- package/src/skill/skill.ts +135 -0
- package/src/snapshot/index.ts +236 -0
- package/src/storage/storage.ts +227 -0
- package/src/tool/apply_patch.ts +281 -0
- package/src/tool/apply_patch.txt +33 -0
- package/src/tool/bash.ts +258 -0
- package/src/tool/bash.txt +115 -0
- package/src/tool/batch.ts +175 -0
- package/src/tool/batch.txt +24 -0
- package/src/tool/bloxy-control.ts +123 -0
- package/src/tool/bloxy-control.txt +13 -0
- package/src/tool/codesearch.ts +132 -0
- package/src/tool/codesearch.txt +12 -0
- package/src/tool/edit.ts +655 -0
- package/src/tool/edit.txt +10 -0
- package/src/tool/external-directory.ts +32 -0
- package/src/tool/glob.ts +77 -0
- package/src/tool/glob.txt +6 -0
- package/src/tool/grep.ts +154 -0
- package/src/tool/grep.txt +8 -0
- package/src/tool/invalid.ts +17 -0
- package/src/tool/ls.ts +121 -0
- package/src/tool/ls.txt +1 -0
- package/src/tool/lsp.ts +96 -0
- package/src/tool/lsp.txt +19 -0
- package/src/tool/multiedit.ts +46 -0
- package/src/tool/multiedit.txt +41 -0
- package/src/tool/plan-enter.txt +14 -0
- package/src/tool/plan-exit.txt +13 -0
- package/src/tool/plan.ts +130 -0
- package/src/tool/question.ts +33 -0
- package/src/tool/question.txt +10 -0
- package/src/tool/read.ts +211 -0
- package/src/tool/read.txt +12 -0
- package/src/tool/registry.ts +161 -0
- package/src/tool/skill.ts +82 -0
- package/src/tool/task.ts +191 -0
- package/src/tool/task.txt +60 -0
- package/src/tool/todo.ts +53 -0
- package/src/tool/todoread.txt +14 -0
- package/src/tool/todowrite.txt +167 -0
- package/src/tool/tool.ts +89 -0
- package/src/tool/truncation.ts +106 -0
- package/src/tool/webfetch.ts +188 -0
- package/src/tool/webfetch.txt +13 -0
- package/src/tool/websearch.ts +150 -0
- package/src/tool/websearch.txt +14 -0
- package/src/tool/write.ts +85 -0
- package/src/tool/write.txt +8 -0
- package/src/util/archive.ts +16 -0
- package/src/util/binary.ts +41 -0
- package/src/util/color.ts +19 -0
- package/src/util/context.ts +25 -0
- package/src/util/defer.ts +12 -0
- package/src/util/error.ts +54 -0
- package/src/util/eventloop.ts +20 -0
- package/src/util/filesystem.ts +93 -0
- package/src/util/fn.ts +11 -0
- package/src/util/format.ts +20 -0
- package/src/util/iife.ts +3 -0
- package/src/util/keybind.ts +103 -0
- package/src/util/lazy.ts +23 -0
- package/src/util/locale.ts +81 -0
- package/src/util/lock.ts +98 -0
- package/src/util/log.ts +180 -0
- package/src/util/queue.ts +32 -0
- package/src/util/rpc.ts +66 -0
- package/src/util/scrap.ts +10 -0
- package/src/util/signal.ts +12 -0
- package/src/util/slug.ts +74 -0
- package/src/util/timeout.ts +14 -0
- package/src/util/token.ts +7 -0
- package/src/util/wildcard.ts +56 -0
- package/src/worktree/index.ts +549 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Bloxy Studios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# BloxyCode
|
|
2
|
+
|
|
3
|
+
[](https://www.bridgemind.ai/vibeathon)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://bun.sh/)
|
|
6
|
+
|
|
7
|
+
> **Vibeathon Entry**: This project is a submission for the [BridgeMind Vibeathon](https://www.bridgemind.ai/vibeathon) (Feb 1-14, 2026)
|
|
8
|
+
>
|
|
9
|
+
> **BloxyCode** is an enhanced fork of [OpenCode](https://github.com/opencode-ai/opencode) featuring **Bloxy** - an autonomous task execution system that runs until your tasks are done.
|
|
10
|
+
|
|
11
|
+
An AI-powered coding CLI tool that brings the power of Claude and other LLMs directly to your terminal. BloxyCode enables autonomous code generation, intelligent file operations, and seamless AI-assisted development workflows.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
### 🤖 Autonomous Task Execution (Bloxy Mode)
|
|
16
|
+
BloxyCode's flagship feature - execute complex coding tasks autonomously from Product Requirements Documents (PRDs):
|
|
17
|
+
- **Sequential Task Processing**: Parse PRD markdown files and execute tasks one by one
|
|
18
|
+
- **Automatic Testing**: Run tests after each task (when configured)
|
|
19
|
+
- **Auto-commit**: Optional automatic git commits with descriptive messages
|
|
20
|
+
- **Retry Logic**: Configurable retry attempts for failed tasks
|
|
21
|
+
- **Task State Management**: Track pending, in-progress, completed, and failed tasks
|
|
22
|
+
|
|
23
|
+
### 🛠️ Comprehensive Tool Set
|
|
24
|
+
- **File Operations**: Read, write, edit files with intelligent context awareness
|
|
25
|
+
- **Code Search**: Fast glob patterns and grep-based content search with ripgrep
|
|
26
|
+
- **Bash Integration**: Execute shell commands with proper error handling
|
|
27
|
+
- **Web Capabilities**: Web search and content fetching
|
|
28
|
+
- **Task Management**: Built-in todo list tracking for complex workflows
|
|
29
|
+
|
|
30
|
+
### 🎯 Multi-Agent System
|
|
31
|
+
Create and manage specialized AI agents for different tasks:
|
|
32
|
+
- **Primary Agents**: Main agents for direct interaction
|
|
33
|
+
- **Subagents**: Specialized agents for delegated tasks
|
|
34
|
+
- **Custom Tools**: Configure which tools each agent can access
|
|
35
|
+
- **Agent Generation**: LLM-powered agent creation from descriptions
|
|
36
|
+
|
|
37
|
+
### 🔌 Extensibility
|
|
38
|
+
- **Model Provider Support**: Anthropic, OpenAI, Google, Azure, AWS Bedrock, and 15+ other providers
|
|
39
|
+
- **MCP (Model Context Protocol)**: Standard protocol for AI-tool integration
|
|
40
|
+
- **Custom Commands**: Define project-specific slash commands
|
|
41
|
+
- **Skill System**: Reusable best practices and workflows
|
|
42
|
+
|
|
43
|
+
### 🚀 Antigravity Integration (Built-in)
|
|
44
|
+
Access Claude and Gemini models through your Google account — no API keys required:
|
|
45
|
+
- **Claude Opus 4.5 & Sonnet 4.5** with extended thinking support
|
|
46
|
+
- **Gemini 3 Pro/Flash** with configurable thinking levels
|
|
47
|
+
- **Multi-account support** with automatic rate limit rotation
|
|
48
|
+
- **Free tier access** using your Google Cloud quota
|
|
49
|
+
- See [Antigravity Documentation](docs/ANTIGRAVITY.md) for setup
|
|
50
|
+
|
|
51
|
+
### 💬 Multiple Interaction Modes
|
|
52
|
+
- **CLI Chat**: Direct command-line interaction with AI
|
|
53
|
+
- **Server Mode**: Run as a persistent server with HTTP API
|
|
54
|
+
- **TUI (Terminal UI)**: Rich terminal interface built with SolidJS
|
|
55
|
+
- **Session Management**: Continue conversations, attach to running servers
|
|
56
|
+
|
|
57
|
+
### 🔐 Smart Permissions
|
|
58
|
+
- **Permission System**: Fine-grained control over tool usage
|
|
59
|
+
- **Pattern Matching**: Allow/deny based on file patterns
|
|
60
|
+
- **Interactive Prompts**: Ask for permission when needed
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Install via npm (coming soon)
|
|
66
|
+
npm install -g @bloxystudios/bloxycode
|
|
67
|
+
|
|
68
|
+
# Or run directly with bun
|
|
69
|
+
bun install
|
|
70
|
+
bun run dev
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Basic Usage
|
|
74
|
+
|
|
75
|
+
### Start a conversation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Simple prompt
|
|
79
|
+
bloxycode run "create a new React component"
|
|
80
|
+
|
|
81
|
+
# Continue previous session
|
|
82
|
+
bloxycode run -c "add tests for the component"
|
|
83
|
+
|
|
84
|
+
# Use specific model
|
|
85
|
+
bloxycode run -m anthropic/claude-sonnet-4 "refactor the authentication logic"
|
|
86
|
+
|
|
87
|
+
# Attach files to context
|
|
88
|
+
bloxycode run -f src/app.ts "review this code for bugs"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Run in Bloxy autonomous mode
|
|
92
|
+
|
|
93
|
+
Create a `PRD.md` file:
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
# My Feature PRD
|
|
97
|
+
|
|
98
|
+
## Tasks
|
|
99
|
+
- [ ] Create user authentication module
|
|
100
|
+
- [ ] Add login and signup endpoints
|
|
101
|
+
- [ ] Write unit tests for auth module
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Then execute:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
bloxycode run "/bloxy PRD.md"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
BloxyCode will autonomously:
|
|
111
|
+
1. Read and parse the PRD
|
|
112
|
+
2. Execute each task sequentially
|
|
113
|
+
3. Run tests (if configured)
|
|
114
|
+
4. Commit changes (if auto-commit enabled)
|
|
115
|
+
5. Report progress and results
|
|
116
|
+
|
|
117
|
+
### Agent Management
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Create a new custom agent
|
|
121
|
+
bloxycode agent create
|
|
122
|
+
|
|
123
|
+
# List available agents
|
|
124
|
+
bloxycode agent list
|
|
125
|
+
|
|
126
|
+
# Use a specific agent
|
|
127
|
+
bloxycode run --agent code-reviewer "review my changes"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Server Mode
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Start server on specific port
|
|
134
|
+
bloxycode serve --port 4096
|
|
135
|
+
|
|
136
|
+
# Attach to running server
|
|
137
|
+
bloxycode run --attach http://localhost:4096 "your prompt"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Configuration
|
|
141
|
+
|
|
142
|
+
BloxyCode can be configured via:
|
|
143
|
+
- `~/.config/bloxycode/config.yml` (global)
|
|
144
|
+
- `.bloxycode/config.yml` (project-specific)
|
|
145
|
+
|
|
146
|
+
Example configuration:
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
# Default model
|
|
150
|
+
model: anthropic/claude-sonnet-4
|
|
151
|
+
|
|
152
|
+
# Share sessions automatically
|
|
153
|
+
share: auto
|
|
154
|
+
|
|
155
|
+
# Custom agents directory
|
|
156
|
+
agents: .bloxycode/agent
|
|
157
|
+
|
|
158
|
+
# Bloxy mode settings
|
|
159
|
+
bloxy:
|
|
160
|
+
autoCommit: true
|
|
161
|
+
testCommand: "bun test"
|
|
162
|
+
lintCommand: "bun run typecheck"
|
|
163
|
+
maxRetries: 3
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Commands
|
|
167
|
+
|
|
168
|
+
| Command | Description |
|
|
169
|
+
|---------|-------------|
|
|
170
|
+
| `run [message]` | Start or continue a conversation |
|
|
171
|
+
| `serve` | Start the BloxyCode server |
|
|
172
|
+
| `agent create` | Create a new custom agent |
|
|
173
|
+
| `agent list` | List all available agents |
|
|
174
|
+
| `auth` | Authenticate with providers |
|
|
175
|
+
| `models` | List available models |
|
|
176
|
+
| `export` | Export session history |
|
|
177
|
+
| `import` | Import session history |
|
|
178
|
+
| `stats` | View usage statistics |
|
|
179
|
+
|
|
180
|
+
## Tools Available to AI
|
|
181
|
+
|
|
182
|
+
BloxyCode provides these tools to AI agents:
|
|
183
|
+
|
|
184
|
+
- **bash**: Execute shell commands
|
|
185
|
+
- **read**: Read file contents
|
|
186
|
+
- **write**: Create/overwrite files
|
|
187
|
+
- **edit**: Make precise edits to files
|
|
188
|
+
- **glob**: Find files by pattern
|
|
189
|
+
- **grep**: Search file contents
|
|
190
|
+
- **webfetch**: Fetch web content
|
|
191
|
+
- **task**: Delegate to subagents
|
|
192
|
+
- **todowrite/todoread**: Manage task lists
|
|
193
|
+
- **bloxy_control**: Control autonomous execution (Bloxy mode)
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Install dependencies
|
|
199
|
+
bun install
|
|
200
|
+
|
|
201
|
+
# Run in development mode
|
|
202
|
+
bun run dev
|
|
203
|
+
|
|
204
|
+
# Type check
|
|
205
|
+
bun run typecheck
|
|
206
|
+
|
|
207
|
+
# Run tests
|
|
208
|
+
bun test
|
|
209
|
+
|
|
210
|
+
# Run specific test
|
|
211
|
+
bun test test/tool/tool.test.ts
|
|
212
|
+
|
|
213
|
+
# Build
|
|
214
|
+
bun run build
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Project Structure
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
src/
|
|
221
|
+
├── cli/ # CLI commands and interface
|
|
222
|
+
├── tool/ # AI tool implementations
|
|
223
|
+
├── session/ # Session management
|
|
224
|
+
├── agent/ # Agent system
|
|
225
|
+
├── bloxy/ # Autonomous mode implementation
|
|
226
|
+
├── provider/ # LLM provider integrations
|
|
227
|
+
├── server/ # HTTP server
|
|
228
|
+
└── util/ # Utilities
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Architecture
|
|
232
|
+
|
|
233
|
+
BloxyCode uses a modern TypeScript architecture:
|
|
234
|
+
- **Runtime**: Bun with TypeScript ESM modules
|
|
235
|
+
- **Validation**: Zod schemas for all inputs
|
|
236
|
+
- **State**: Namespace-based organization
|
|
237
|
+
- **UI**: SolidJS + OpenTUI for terminal interfaces
|
|
238
|
+
- **Communication**: MCP (Model Context Protocol) compatible
|
|
239
|
+
|
|
240
|
+
## Contributing
|
|
241
|
+
|
|
242
|
+
Contributions are welcome! Please see our contributing guidelines for more details.
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
MIT
|
|
247
|
+
|
|
248
|
+
## Links
|
|
249
|
+
|
|
250
|
+
- [Documentation](https://docs.bloxycode.dev) (coming soon)
|
|
251
|
+
- [GitHub](https://github.com/bloxystudios/bloxycode)
|
|
252
|
+
- [Discord Community](https://discord.gg/bloxycode) (coming soon)
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
Built with ❤️ by Bloxy Studios
|
package/bin/bloxycode
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
function run(target) {
|
|
9
|
+
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
})
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error(result.error.message)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
17
|
+
process.exit(code)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const envPath = process.env.BLOXYCODE_BIN_PATH
|
|
21
|
+
if (envPath) {
|
|
22
|
+
run(envPath)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
26
|
+
const scriptDir = path.dirname(scriptPath)
|
|
27
|
+
|
|
28
|
+
const platformMap = {
|
|
29
|
+
darwin: "darwin",
|
|
30
|
+
linux: "linux",
|
|
31
|
+
win32: "windows",
|
|
32
|
+
}
|
|
33
|
+
const archMap = {
|
|
34
|
+
x64: "x64",
|
|
35
|
+
arm64: "arm64",
|
|
36
|
+
arm: "arm",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let platform = platformMap[os.platform()]
|
|
40
|
+
if (!platform) {
|
|
41
|
+
platform = os.platform()
|
|
42
|
+
}
|
|
43
|
+
let arch = archMap[os.arch()]
|
|
44
|
+
if (!arch) {
|
|
45
|
+
arch = os.arch()
|
|
46
|
+
}
|
|
47
|
+
const base = "bloxycode-" + platform + "-" + arch
|
|
48
|
+
const binary = platform === "windows" ? "bloxycode.exe" : "bloxycode"
|
|
49
|
+
|
|
50
|
+
function findBinary(startDir) {
|
|
51
|
+
let current = startDir
|
|
52
|
+
for (;;) {
|
|
53
|
+
const modules = path.join(current, "node_modules")
|
|
54
|
+
if (fs.existsSync(modules)) {
|
|
55
|
+
const entries = fs.readdirSync(modules)
|
|
56
|
+
for (const entry of entries) {
|
|
57
|
+
if (!entry.startsWith(base)) {
|
|
58
|
+
continue
|
|
59
|
+
}
|
|
60
|
+
const candidate = path.join(modules, entry, "bin", binary)
|
|
61
|
+
if (fs.existsSync(candidate)) {
|
|
62
|
+
return candidate
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const parent = path.dirname(current)
|
|
67
|
+
if (parent === current) {
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
current = parent
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const resolved = findBinary(scriptDir)
|
|
75
|
+
if (!resolved) {
|
|
76
|
+
console.error(
|
|
77
|
+
'It seems that your package manager failed to install the right version of the bloxycode CLI for your platform. You can try manually installing the "' +
|
|
78
|
+
base +
|
|
79
|
+
'" package',
|
|
80
|
+
)
|
|
81
|
+
process.exit(1)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
run(resolved)
|
package/package.json
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"name": "@bloxystudios/bloxycode",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Bloxy Studios <contact@bloxystudios.com>",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/bloxystudios/bloxycode.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/bloxystudios/bloxycode#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/bloxystudios/bloxycode/issues"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"typecheck": "tsgo --noEmit",
|
|
18
|
+
"test": "bun test",
|
|
19
|
+
"build": "bun run script/build.ts",
|
|
20
|
+
"dev": "bun run --conditions=browser ./src/index.ts",
|
|
21
|
+
"random": "echo 'Random script updated at $(date)' && echo 'Change queued successfully' && echo 'Another change made' && echo 'Yet another change' && echo 'One more change' && echo 'Final change' && echo 'Another final change' && echo 'Yet another final change'",
|
|
22
|
+
"clean": "echo 'Cleaning up...' && rm -rf node_modules dist",
|
|
23
|
+
"lint": "echo 'Running lint checks...' && bun test --coverage",
|
|
24
|
+
"format": "echo 'Formatting code...' && bun run --prettier --write src/**/*.ts",
|
|
25
|
+
"docs": "echo 'Generating documentation...' && find src -name '*.ts' -exec echo 'Processing: {}' \\;",
|
|
26
|
+
"deploy": "echo 'Deploying application...' && bun run build && echo 'Deployment completed successfully'"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"bloxycode": "./bin/bloxycode"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin/",
|
|
33
|
+
"src/",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"exports": {
|
|
38
|
+
"./*": "./src/*.ts"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@babel/core": "7.28.4",
|
|
42
|
+
"@octokit/webhooks-types": "7.6.1",
|
|
43
|
+
"@parcel/watcher-darwin-arm64": "2.5.1",
|
|
44
|
+
"@parcel/watcher-darwin-x64": "2.5.1",
|
|
45
|
+
"@parcel/watcher-linux-arm64-glibc": "2.5.1",
|
|
46
|
+
"@parcel/watcher-linux-arm64-musl": "2.5.1",
|
|
47
|
+
"@parcel/watcher-linux-x64-glibc": "2.5.1",
|
|
48
|
+
"@parcel/watcher-linux-x64-musl": "2.5.1",
|
|
49
|
+
"@parcel/watcher-win32-x64": "2.5.1",
|
|
50
|
+
"@tsconfig/bun": "^1.0.10",
|
|
51
|
+
"@types/babel__core": "7.20.5",
|
|
52
|
+
"@types/bun": "^1.3.8",
|
|
53
|
+
"@types/turndown": "5.0.5",
|
|
54
|
+
"@types/yargs": "17.0.33",
|
|
55
|
+
"@typescript/native-preview": "^7.0.0-dev.20260130.1",
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"vscode-languageserver-types": "3.17.5",
|
|
58
|
+
"why-is-node-running": "3.2.2"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@actions/core": "1.11.1",
|
|
62
|
+
"@actions/github": "6.0.1",
|
|
63
|
+
"@agentclientprotocol/sdk": "0.12.0",
|
|
64
|
+
"@ai-sdk/amazon-bedrock": "3.0.73",
|
|
65
|
+
"@ai-sdk/anthropic": "2.0.57",
|
|
66
|
+
"@ai-sdk/azure": "2.0.91",
|
|
67
|
+
"@ai-sdk/cerebras": "1.0.34",
|
|
68
|
+
"@ai-sdk/cohere": "2.0.22",
|
|
69
|
+
"@ai-sdk/deepinfra": "1.0.31",
|
|
70
|
+
"@ai-sdk/gateway": "2.0.25",
|
|
71
|
+
"@ai-sdk/google": "2.0.52",
|
|
72
|
+
"@ai-sdk/google-vertex": "3.0.97",
|
|
73
|
+
"@ai-sdk/groq": "2.0.34",
|
|
74
|
+
"@ai-sdk/mistral": "2.0.27",
|
|
75
|
+
"@ai-sdk/openai": "2.0.89",
|
|
76
|
+
"@ai-sdk/openai-compatible": "1.0.30",
|
|
77
|
+
"@ai-sdk/perplexity": "2.0.23",
|
|
78
|
+
"@ai-sdk/provider": "2.0.1",
|
|
79
|
+
"@ai-sdk/provider-utils": "3.0.20",
|
|
80
|
+
"@ai-sdk/togetherai": "1.0.31",
|
|
81
|
+
"@ai-sdk/vercel": "1.0.31",
|
|
82
|
+
"@ai-sdk/xai": "2.0.51",
|
|
83
|
+
"@clack/prompts": "1.0.0-alpha.1",
|
|
84
|
+
"@gitlab/gitlab-ai-provider": "3.3.1",
|
|
85
|
+
"@hono/standard-validator": "0.1.5",
|
|
86
|
+
"@hono/zod-validator": "^0.7.6",
|
|
87
|
+
"@modelcontextprotocol/sdk": "1.25.2",
|
|
88
|
+
"@octokit/graphql": "9.0.2",
|
|
89
|
+
"@octokit/rest": "^22.0.1",
|
|
90
|
+
"@openauthjs/openauth": "^0.4.3",
|
|
91
|
+
"@opencode-ai/plugin": "^1.1.44",
|
|
92
|
+
"@opencode-ai/sdk": "^1.1.44",
|
|
93
|
+
"@openrouter/ai-sdk-provider": "1.5.2",
|
|
94
|
+
"@opentui/core": "0.1.75",
|
|
95
|
+
"@opentui/solid": "0.1.75",
|
|
96
|
+
"@parcel/watcher": "2.5.1",
|
|
97
|
+
"@pierre/diffs": "^1.0.9",
|
|
98
|
+
"@solid-primitives/event-bus": "1.1.2",
|
|
99
|
+
"@solid-primitives/scheduled": "1.5.2",
|
|
100
|
+
"@standard-schema/spec": "1.0.0",
|
|
101
|
+
"@zip.js/zip.js": "2.7.62",
|
|
102
|
+
"ai": "5.0.119",
|
|
103
|
+
"bonjour-service": "1.3.0",
|
|
104
|
+
"bun-pty": "0.4.4",
|
|
105
|
+
"chokidar": "4.0.3",
|
|
106
|
+
"clipboardy": "4.0.0",
|
|
107
|
+
"decimal.js": "10.5.0",
|
|
108
|
+
"diff": "8.0.2",
|
|
109
|
+
"fuzzysort": "3.1.0",
|
|
110
|
+
"gray-matter": "4.0.3",
|
|
111
|
+
"hono": "4.10.7",
|
|
112
|
+
"hono-openapi": "1.1.2",
|
|
113
|
+
"ignore": "7.0.5",
|
|
114
|
+
"jsonc-parser": "3.3.1",
|
|
115
|
+
"minimatch": "10.0.3",
|
|
116
|
+
"open": "10.1.2",
|
|
117
|
+
"opentui-spinner": "0.0.6",
|
|
118
|
+
"partial-json": "0.1.7",
|
|
119
|
+
"quansync": "^1.0.0",
|
|
120
|
+
"remeda": "2.26.0",
|
|
121
|
+
"solid-js": "1.9.10",
|
|
122
|
+
"strip-ansi": "7.1.2",
|
|
123
|
+
"tree-sitter-bash": "0.25.0",
|
|
124
|
+
"turndown": "7.2.0",
|
|
125
|
+
"ulid": "3.0.1",
|
|
126
|
+
"vscode-jsonrpc": "8.2.1",
|
|
127
|
+
"web-tree-sitter": "0.25.10",
|
|
128
|
+
"xdg-basedir": "5.1.0",
|
|
129
|
+
"yargs": "18.0.0",
|
|
130
|
+
"zod": "4.1.8",
|
|
131
|
+
"zod-to-json-schema": "3.24.5"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# ACP (Agent Client Protocol) Implementation
|
|
2
|
+
|
|
3
|
+
This directory contains a clean, protocol-compliant implementation of the [Agent Client Protocol](https://agentclientprotocol.com/) for opencode.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
The implementation follows a clean separation of concerns:
|
|
8
|
+
|
|
9
|
+
### Core Components
|
|
10
|
+
|
|
11
|
+
- **`agent.ts`** - Implements the `Agent` interface from `@agentclientprotocol/sdk`
|
|
12
|
+
- Handles initialization and capability negotiation
|
|
13
|
+
- Manages session lifecycle (`session/new`, `session/load`)
|
|
14
|
+
- Processes prompts and returns responses
|
|
15
|
+
- Properly implements ACP protocol v1
|
|
16
|
+
|
|
17
|
+
- **`client.ts`** - Implements the `Client` interface for client-side capabilities
|
|
18
|
+
- File operations (`readTextFile`, `writeTextFile`)
|
|
19
|
+
- Permission requests (auto-approves for now)
|
|
20
|
+
- Terminal support (stub implementation)
|
|
21
|
+
|
|
22
|
+
- **`session.ts`** - Session state management
|
|
23
|
+
- Creates and tracks ACP sessions
|
|
24
|
+
- Maps ACP sessions to internal opencode sessions
|
|
25
|
+
- Maintains working directory context
|
|
26
|
+
- Handles MCP server configurations
|
|
27
|
+
|
|
28
|
+
- **`server.ts`** - ACP server startup and lifecycle
|
|
29
|
+
- Sets up JSON-RPC over stdio using the official library
|
|
30
|
+
- Manages graceful shutdown on SIGTERM/SIGINT
|
|
31
|
+
- Provides Instance context for the agent
|
|
32
|
+
|
|
33
|
+
- **`types.ts`** - Type definitions for internal use
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Command Line
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Start the ACP server in the current directory
|
|
41
|
+
opencode acp
|
|
42
|
+
|
|
43
|
+
# Start in a specific directory
|
|
44
|
+
opencode acp --cwd /path/to/project
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Programmatic
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { ACPServer } from "./acp/server"
|
|
51
|
+
|
|
52
|
+
await ACPServer.start()
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Integration with Zed
|
|
56
|
+
|
|
57
|
+
Add to your Zed configuration (`~/.config/zed/settings.json`):
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"agent_servers": {
|
|
62
|
+
"OpenCode": {
|
|
63
|
+
"command": "opencode",
|
|
64
|
+
"args": ["acp"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Protocol Compliance
|
|
71
|
+
|
|
72
|
+
This implementation follows the ACP specification v1:
|
|
73
|
+
|
|
74
|
+
✅ **Initialization**
|
|
75
|
+
|
|
76
|
+
- Proper `initialize` request/response with protocol version negotiation
|
|
77
|
+
- Capability advertisement (`agentCapabilities`)
|
|
78
|
+
- Authentication support (stub)
|
|
79
|
+
|
|
80
|
+
✅ **Session Management**
|
|
81
|
+
|
|
82
|
+
- `session/new` - Create new conversation sessions
|
|
83
|
+
- `session/load` - Resume existing sessions (basic support)
|
|
84
|
+
- Working directory context (`cwd`)
|
|
85
|
+
- MCP server configuration support
|
|
86
|
+
|
|
87
|
+
✅ **Prompting**
|
|
88
|
+
|
|
89
|
+
- `session/prompt` - Process user messages
|
|
90
|
+
- Content block handling (text, resources)
|
|
91
|
+
- Response with stop reasons
|
|
92
|
+
|
|
93
|
+
✅ **Client Capabilities**
|
|
94
|
+
|
|
95
|
+
- File read/write operations
|
|
96
|
+
- Permission requests
|
|
97
|
+
- Terminal support (stub for future)
|
|
98
|
+
|
|
99
|
+
## Current Limitations
|
|
100
|
+
|
|
101
|
+
### Not Yet Implemented
|
|
102
|
+
|
|
103
|
+
1. **Streaming Responses** - Currently returns complete responses instead of streaming via `session/update` notifications
|
|
104
|
+
2. **Tool Call Reporting** - Doesn't report tool execution progress
|
|
105
|
+
3. **Session Modes** - No mode switching support yet
|
|
106
|
+
4. **Authentication** - No actual auth implementation
|
|
107
|
+
5. **Terminal Support** - Placeholder only
|
|
108
|
+
6. **Session Persistence** - `session/load` doesn't restore actual conversation history
|
|
109
|
+
|
|
110
|
+
### Future Enhancements
|
|
111
|
+
|
|
112
|
+
- **Real-time Streaming**: Implement `session/update` notifications for progressive responses
|
|
113
|
+
- **Tool Call Visibility**: Report tool executions as they happen
|
|
114
|
+
- **Session Persistence**: Save and restore full conversation history
|
|
115
|
+
- **Mode Support**: Implement different operational modes (ask, code, etc.)
|
|
116
|
+
- **Enhanced Permissions**: More sophisticated permission handling
|
|
117
|
+
- **Terminal Integration**: Full terminal support via opencode's bash tool
|
|
118
|
+
|
|
119
|
+
## Testing
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Run ACP tests
|
|
123
|
+
bun test test/acp.test.ts
|
|
124
|
+
|
|
125
|
+
# Test manually with stdio
|
|
126
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1}}' | opencode acp
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Design Decisions
|
|
130
|
+
|
|
131
|
+
### Why the Official Library?
|
|
132
|
+
|
|
133
|
+
We use `@agentclientprotocol/sdk` instead of implementing JSON-RPC ourselves because:
|
|
134
|
+
|
|
135
|
+
- Ensures protocol compliance
|
|
136
|
+
- Handles edge cases and future protocol versions
|
|
137
|
+
- Reduces maintenance burden
|
|
138
|
+
- Works with other ACP clients automatically
|
|
139
|
+
|
|
140
|
+
### Clean Architecture
|
|
141
|
+
|
|
142
|
+
Each component has a single responsibility:
|
|
143
|
+
|
|
144
|
+
- **Agent** = Protocol interface
|
|
145
|
+
- **Client** = Client-side operations
|
|
146
|
+
- **Session** = State management
|
|
147
|
+
- **Server** = Lifecycle and I/O
|
|
148
|
+
|
|
149
|
+
This makes the codebase maintainable and testable.
|
|
150
|
+
|
|
151
|
+
### Mapping to OpenCode
|
|
152
|
+
|
|
153
|
+
ACP sessions map cleanly to opencode's internal session model:
|
|
154
|
+
|
|
155
|
+
- ACP `session/new` → creates internal Session
|
|
156
|
+
- ACP `session/prompt` → uses SessionPrompt.prompt()
|
|
157
|
+
- Working directory context preserved per-session
|
|
158
|
+
- Tool execution uses existing ToolRegistry
|
|
159
|
+
|
|
160
|
+
## References
|
|
161
|
+
|
|
162
|
+
- [ACP Specification](https://agentclientprotocol.com/)
|
|
163
|
+
- [TypeScript Library](https://github.com/agentclientprotocol/typescript-sdk)
|
|
164
|
+
- [Protocol Examples](https://github.com/agentclientprotocol/typescript-sdk/tree/main/src/examples)
|