@botconnector/bccli 0.4.0-beta.9 → 0.4.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 (60) hide show
  1. package/README.en.md +242 -0
  2. package/README.md +80 -4
  3. package/dist/acp-ATIL4JOZ.js +182 -0
  4. package/dist/args-J5ONVGIF.js +13 -0
  5. package/dist/chunk-45SDLMTV.js +341 -0
  6. package/dist/chunk-6M5X2KZE.js +8 -0
  7. package/dist/chunk-7F3IWBPQ.js +191 -0
  8. package/dist/{chunk-CLN4Z5E3.js → chunk-BLOYFIAD.js} +6 -3
  9. package/dist/chunk-BNA74HPN.js +145 -0
  10. package/dist/{chunk-DX7CZTBB.js → chunk-BQ2IGPBR.js} +14 -9
  11. package/dist/chunk-JL5ZCSP2.js +76 -0
  12. package/dist/chunk-KEMYIGCP.js +235 -0
  13. package/dist/{chunk-BFZXRKW5.js → chunk-L7QI6JN2.js} +24 -2
  14. package/dist/chunk-LACUWBWS.js +361 -0
  15. package/dist/chunk-M7CALSP3.js +733 -0
  16. package/dist/{chunk-ELML4KVQ.js → chunk-O7M3TGIW.js} +34 -2
  17. package/dist/chunk-PSO7R5AD.js +10 -0
  18. package/dist/chunk-PUN4HMAG.js +940 -0
  19. package/dist/{chunk-SJH3YLW4.js → chunk-QDQU6VY2.js} +60 -6
  20. package/dist/chunk-QZKLZELZ.js +64 -0
  21. package/dist/{chunk-7S6JXQCH.js → chunk-SPRNLS7K.js} +2 -1
  22. package/dist/chunk-TLPFQIS2.js +231 -0
  23. package/dist/chunk-TVALKHFB.js +2143 -0
  24. package/dist/chunk-UZWJQF67.js +500 -0
  25. package/dist/chunk-XBO5GACQ.js +56 -0
  26. package/dist/cli.js +151 -1382
  27. package/dist/completion-HPPFDAPB.js +125 -0
  28. package/dist/{config-YUNKPCNB.js → config-COPNMMV6.js} +5 -2
  29. package/dist/config-RZ5JONMX.js +30 -0
  30. package/dist/ghBotCli-IBCZIWT5.js +677 -0
  31. package/dist/integrationCli-P75R2VSC.js +685 -0
  32. package/dist/login-SYIQP46J.js +16 -0
  33. package/dist/{mcpCli-DZWQPTOS.js → mcpCli-QUV5SD64.js} +42 -9
  34. package/dist/modelsCli-TRRB5LX4.js +36 -0
  35. package/dist/npmRunner-LU43GM3W.js +46 -0
  36. package/dist/oauthLogin-6FWQABJ7.js +210 -0
  37. package/dist/pluginsCli-GNW4TPVV.js +284 -0
  38. package/dist/prCli-5IMV3VNQ.js +78 -0
  39. package/dist/providerCli-FAOZHOKW.js +15 -0
  40. package/dist/sdk.js +5490 -0
  41. package/dist/serve-6QLBJUYW.js +178 -0
  42. package/dist/serve-JG7RLIUD.js +515 -0
  43. package/dist/session-KBAQ4BZ5.js +12 -0
  44. package/dist/setup-FJAWDWV4.js +24 -0
  45. package/dist/statsCli-CF3R7ATL.js +353 -0
  46. package/dist/transferCli-TK2GSVRK.js +71 -0
  47. package/dist/ui-B3CJ6TGE.js +2365 -0
  48. package/dist/update-K5IQ2MYR.js +145 -0
  49. package/package.json +25 -4
  50. package/dist/args-JPVSGCGY.js +0 -12
  51. package/dist/chunk-2MGINW4O.js +0 -114
  52. package/dist/chunk-ISGBGFSU.js +0 -52
  53. package/dist/chunk-KV27KTOX.js +0 -254
  54. package/dist/chunk-U7GK73CK.js +0 -341
  55. package/dist/chunk-ZYCYTEKD.js +0 -96
  56. package/dist/integrationCli-BGT5UZU4.js +0 -223
  57. package/dist/login-6K32PIXV.js +0 -9
  58. package/dist/providerCli-Q7LRM2NP.js +0 -12
  59. package/dist/session-7UB77CEG.js +0 -9
  60. package/dist/ui-6GTQUJOE.js +0 -1415
package/README.en.md ADDED
@@ -0,0 +1,242 @@
1
+ # BCCLI
2
+
3
+ [English](README.en.md) · **Bahasa Indonesia**
4
+
5
+ [![npm](https://img.shields.io/npm/v/@botconnector/bccli?label=@botconnector/bccli)](https://www.npmjs.com/package/@botconnector/bccli?activeTab=versions)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@botconnector/bccli)](https://www.npmjs.com/package/@botconnector/bccli)
7
+ [![Node.js](https://img.shields.io/node/v/@botconnector/bccli?label=Node.js)](https://nodejs.org/)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+ [![Website](https://img.shields.io/badge/website-botconnector.id-06305A)](https://botconnector.id/id/download)
10
+
11
+ An AI coding agent from [BotConnector](https://botconnector.id/) that works in your terminal: it reads code,
12
+ edits files, and runs commands — with your permission.
13
+
14
+ ![BCCLI creating hello.js and running it with node](docs/demo.gif)
15
+
16
+ *Real session recording: BCCLI creates `hello.js` and runs it with `node`.*
17
+
18
+ ```bash
19
+ # one-line install (macOS / Linux / WSL2) — provisions a portable Node if needed, no sudo
20
+ curl -fsSL https://raw.githubusercontent.com/farijarifriyanto-debug/bccli/main/install.sh | bash
21
+
22
+ # or manual, if you already have Node.js 22+
23
+ npm i -g @botconnector/bccli # latest stable, requires Node.js 22+
24
+ npm i -g @botconnector/bccli@next # …or the next prerelease
25
+ bccli login # store your BotConnector Cloud API key
26
+ cd your-project && bccli
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ | Command | What it does |
32
+ |---|---|
33
+ | `bccli` | interactive mode |
34
+ | `bccli -p "task"` | one-shot task (scripts/CI) |
35
+ | `bccli -p "task" --output-format json` | final result as a single JSON object; `stream-json` = JSONL events per stage (tool_use/tool_result/message/result) for CI |
36
+ | `bccli -c` / `bccli -r` | continue last session / pick a session |
37
+ | `bccli -m provider/model` | choose a model |
38
+ | `bccli --reasoning <auto\|off\|low\|medium\|high\|max>` | set reasoning level for this invocation |
39
+ | `bccli models` | list models |
40
+
41
+ In-session commands (type `/` for suggestions, ↑↓ to select, Enter to run):
42
+
43
+ | Command | What it does |
44
+ |---|---|
45
+ | `/help` | list commands and shortcuts |
46
+ | `/model` | switch model |
47
+ | `/reasoning` | pick Auto / Off / Low / Medium / High / Max |
48
+ | `/provider` | add/select an AI provider |
49
+ | `/language` | change display language (`en` / `id`) |
50
+ | `/mcp` | install/manage MCP servers |
51
+ | `/new` | new session (old sessions are kept) |
52
+ | `/resume` | continue another session in this folder |
53
+ | `/session` | info about this session |
54
+ | `/status` | version, model, permission mode, MCP, context |
55
+ | `/permissions` | view/revoke permissions |
56
+ | `/undo` | undo the last file-edit turn |
57
+ | `/diff` | git diff of the project |
58
+ | `/copy` | copy the last answer |
59
+ | `/export` | save the conversation to markdown |
60
+ | `/memory` | project instructions (/memory <text>, /memory global <text>) |
61
+ | `/init` | create/update AGENTS.md for this project |
62
+ | `/agents` | list subagents |
63
+ | `/skills` | list skills and custom commands |
64
+ | `/doctor` | check installation health |
65
+ | `/login` | store the active provider's API key |
66
+ | `/logout` | remove the active provider's API key |
67
+ | `/clear` | start a fresh conversation |
68
+ | `/compact` | compact the conversation |
69
+ | `/cost` | token usage for this session |
70
+ | `/exit` | quit |
71
+
72
+ `/undo` only reverts file edit/write tool changes (not bash commands), one turn at a time, up to 20 turns back.
73
+ Shift+Tab cycles permission modes: `default` → `acceptEdits` → `plan` → `allowAll`.
74
+
75
+ Reading a secret file (`.env`, `.ssh`, `.aws`, `id_rsa`, `*.pem`, `*.key`, `secret*`,
76
+ `credential*`) always asks for approval; `allowAll` is the only mode that does not, and the
77
+ approval cannot be granted "for this session".
78
+
79
+ `-p` mode never prompts: permission-requiring tools are refused unless you pass
80
+ `--allow-all` or `--allowed-tools bash,edit,fetch`.
81
+
82
+ ## Language
83
+
84
+ BCCLI's UI (help, messages, permission prompts) is **English by default**. Indonesian stays available:
85
+
86
+ ```bash
87
+ bccli --lang id # one-off
88
+ BCCLI_LANG=id bccli # via environment
89
+ /language id # inside a session; stored in ~/.bccli/config.json ("language")
90
+ ```
91
+
92
+ Priority order: `--lang`, then `BCCLI_LANG`, then `language` in config, then English. The model answers in
93
+ the language you write; tool messages the model reads (tool output, errors) are always English so they
94
+ don't distort the reply language.
95
+
96
+ ## Providers
97
+
98
+ `/provider` in a session (or `bccli provider add <id>`) adds a provider with just an API key:
99
+
100
+ | Id | Provider |
101
+ |---|---|
102
+ | `bc-cloud` | BotConnector Cloud (default) |
103
+ | `openrouter` | OpenRouter |
104
+ | `openai` | OpenAI |
105
+ | `gemini` | Google Gemini |
106
+ | `deepseek` | DeepSeek |
107
+ | `groq` | Groq |
108
+ | `ollama-cloud` | Ollama Cloud |
109
+ | `ollama` | local Ollama (no key) |
110
+ | `lmstudio` | local LM Studio (no key) |
111
+
112
+ Any other OpenAI-compatible provider: pick **Custom…** in `/provider`, or
113
+ `bccli provider add corp --url https://corp.example/v1 --name "Corp"`.
114
+
115
+ `/model` lists models from **every** provider that has a key, grouped by provider;
116
+ type to filter. Your choice is saved as the default.
117
+
118
+ Reasoning can be set via `bccli --reasoning <auto|off|low|medium|high|max>` or `/reasoning`.
119
+ **Auto** uses the model/provider default and BCCLI sends no reasoning override. BCCLI never
120
+ silently lowers or raises reasoning effort. Manual levels pass through when the provider/model
121
+ contract supports them; unsupported levels produce a clear error instead of a silent downgrade.
122
+
123
+ `.bccli/config.json` inside a project may only pick a `model` and add new keyless providers —
124
+ the `reasoning` preference is read only from the user config `~/.bccli/config.json`, never from a
125
+ cloned repo — permissions (`permissionMode`, `allow`) and existing providers are configured only
126
+ from `~/.bccli/config.json`, so a cloned repo cannot grant itself full permissions or steal API keys.
127
+
128
+ ## External agent integrations
129
+
130
+ BCCLI can set up BotConnector as a provider for other agents:
131
+
132
+ | Command | What it does |
133
+ |---|---|
134
+ | `bccli integrations` | show integration status |
135
+ | `bccli connect opencode` | connect OpenCode to BotConnector |
136
+ | `bccli connect aider` | connect Aider to BotConnector |
137
+ | `bccli connect cline` | connect Cline CLI to BotConnector |
138
+ | `bccli connect deepseek-harness` / `bccli connect dsh` | connect DeepSeek Harness to BotConnector |
139
+ | `bccli connect codex` | create Codex Responses API profile + BotConnector launcher |
140
+ | `bccli connect claude-code` | create a Claude Code launcher via Anthropic Messages compatibility |
141
+ | `bccli connect cursor` | guided Cursor setup + Base URL override warning |
142
+ | `bccli connect openai-cli` | create an OpenAI CLI launcher for BotConnector |
143
+ | `bccli connect openai-sdk` | create an env profile for the OpenAI Python/Node SDK |
144
+ | `bccli connect openai-compatible` | create a universal OpenAI-compatible env profile |
145
+ | `bccli disconnect <agent>` | restore the config from before the integration |
146
+
147
+ OpenCode uses the global config `~/.config/opencode/opencode.json`. BCCLI fetches the BotConnector
148
+ model catalog on connect, preserves other providers' config, and stores secrets in a separate file
149
+ under `~/.bccli/integrations/`.
150
+ Aider uses `~/.aider.conf.yml` pointing at a separate BCCLI env file; BCCLI refuses to overwrite
151
+ existing Aider OpenAI/env-file settings.
152
+
153
+ Cline uses an `openai-compatible` provider in `~/.cline/data/settings/providers.json`. If that slot
154
+ is taken by another endpoint, BCCLI refuses to overwrite it. Cline itself stores provider API keys
155
+ in that file.
156
+
157
+ DeepSeek Harness uses a custom `botconnector` provider in `$DSH_HOME/settings.yaml` with
158
+ `api: openai-completions` and `apiKeyEnv: BOTCONNECTOR_API_KEY`; the key goes in the BCCLI block of
159
+ `$DSH_HOME/.env`. Other DSH providers are kept. After connecting, run the web profile with
160
+ `dsh web` (same as `dsh --profile web`); bare `dsh` without a profile is rejected by DSH 0.1.x.
161
+
162
+ Codex uses a profile `$CODEX_HOME/botconnector.config.toml` with `wire_api = "responses"` and a BCCLI
163
+ launcher that reads the key from BCCLI storage at runtime. Claude Code gets an isolated launcher with
164
+ `ANTHROPIC_BASE_URL=https://api.botconnector.id` and the `/v1/messages` compatibility endpoint +
165
+ token counting. Codex and Claude Code primary login/config are not overwritten.
166
+
167
+ External agents call BotConnector directly, so model discovery does not use BCCLI-specific identity.
168
+ Access restricted to BCCLI/Web App (for example Luna launch access) is not automatically inherited.
169
+ Before changing external config, BCCLI makes a backup so `disconnect` can restore it.
170
+
171
+ ## Internet
172
+
173
+ - `web_search`: web search with no permission prompt. Uses your BotConnector Cloud account when a key
174
+ is present, otherwise goes straight to Keenable (free, no key). Results are titles, URLs, and short
175
+ snippets, so they are token-efficient.
176
+ - `fetch`: open one URL from this machine (permission required per host).
177
+
178
+ ## MCP
179
+
180
+ `/mcp` (or `bccli mcp add <name>`) installs servers from the catalog:
181
+ `playwright`, `context7`, `fetch`, `filesystem`, `git`, `github`. Other remote servers:
182
+ `bccli mcp add name --url https://…`. Stored in `~/.bccli/mcp.json` (`mcpServers` format, same as
183
+ Claude Code). All MCP tools always require permission.
184
+
185
+ A `.bccli/mcp.json` inside a repo is not executed until you approve it (asked once per folder).
186
+
187
+ `bccli mcp serve` runs a stdio MCP server with your BotConnector tools
188
+ (`bc_search`, `bc_fetch`, `bc_models`, `bc_chat`) for Claude Code, Cursor, opencode, and other MCP
189
+ hosts. Requires `bccli login` (or `BOTCONNECTOR_API_KEY`):
190
+
191
+ ```bash
192
+ claude mcp add botconnector -- npx -y @botconnector/bccli mcp serve
193
+ ```
194
+
195
+ ## Subagents
196
+
197
+ The agent can delegate work via the `task` tool:
198
+ - `explore` — read & search only, can run in parallel;
199
+ - `general` — all tools (edits/commands still ask permission);
200
+ - custom — `.bccli/agents/name.md` or `.claude/agents/name.md`:
201
+
202
+ ```markdown
203
+ ---
204
+ name: reviewer
205
+ description: review code changes
206
+ tools: [read, grep, glob]
207
+ model: openrouter/qwen/qwen3-coder
208
+ ---
209
+ You are a code reviewer. Report real bugs only.
210
+ ```
211
+
212
+ ## Skills & custom commands
213
+
214
+ - Skills: folders containing `SKILL.md` in `~/.bccli/skills/`, `.bccli/skills/`, `~/.claude/skills/`,
215
+ `.claude/skills/` — used automatically when relevant, or via `/skill-name`.
216
+ - Commands: `commands/name.md` in the same folders → `/name arguments` (`$ARGUMENTS` is replaced).
217
+
218
+ ## Todos & plan mode
219
+
220
+ Tasks with ≥ 3 steps show a checklist above the input box. In plan mode (Shift+Tab),
221
+ the agent only reads and then proposes a plan; `[a]` approves with automatic edits,
222
+ `[y]` approves asking at each step, `[n]` asks for revisions.
223
+
224
+ Project instructions are read from `AGENTS.md` and `BCCLI.md`.
225
+
226
+ ## Development
227
+
228
+ ```bash
229
+ npm install
230
+ npm test && npm run typecheck && npm run lint && npm run build
231
+ ```
232
+
233
+ CI (`ci.yml`) runs the same on Linux, macOS, and Windows.
234
+ Releases: bump `version` in `package.json`, then push a `v<version>` tag — `release.yml`
235
+ runs tests, a smoke test against BotConnector Cloud, and `npm publish --provenance`.
236
+
237
+ ## Learn more
238
+
239
+ - [Download & BCCLI guide](https://botconnector.id/id/download)
240
+ - [BotConnector Developer API](https://botconnector.id/id/developers/api) — OpenAI SDK-compatible endpoint
241
+ - [Switchboard](https://github.com/farijarifriyanto-debug/switchboard) — BotConnector's open source agent harness
242
+ - [Contributing](CONTRIBUTING.md)
package/README.md CHANGED
@@ -1,11 +1,28 @@
1
1
  # BCCLI
2
2
 
3
- Agent AI coding dari BotConnector yang bekerja di terminal: membaca kode, mengedit file,
3
+ **Bahasa Indonesia** · [English](README.en.md)
4
+
5
+ [![npm](https://img.shields.io/npm/v/@botconnector/bccli?label=@botconnector/bccli)](https://www.npmjs.com/package/@botconnector/bccli?activeTab=versions)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@botconnector/bccli)](https://www.npmjs.com/package/@botconnector/bccli)
7
+ [![Node.js](https://img.shields.io/node/v/@botconnector/bccli?label=Node.js)](https://nodejs.org/)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+ [![Website](https://img.shields.io/badge/website-botconnector.id-06305A)](https://botconnector.id/id/download)
10
+
11
+ Agent AI coding dari [BotConnector](https://botconnector.id/) yang bekerja di terminal: membaca kode, mengedit file,
4
12
  dan menjalankan perintah — dengan izin kamu.
5
13
 
14
+ ![BCCLI membuat hello.js dan menjalankannya dengan node](docs/demo.gif)
15
+
16
+ *Rekaman sesi asli: BCCLI membuat file `hello.js` lalu menjalankannya dengan `node`.*
17
+
6
18
  ```bash
7
- npm i -g @botconnector/bccli@next # beta terbaru, butuh Node.js 22+
8
- bccli login # simpan API key BotConnector Cloud
19
+ # install satu baris (macOS / Linux / WSL2) — pasang Node portable bila perlu, tanpa sudo
20
+ curl -fsSL https://raw.githubusercontent.com/farijarifriyanto-debug/bccli/main/install.sh | bash
21
+
22
+ # atau manual, bila Node.js 22+ sudah terpasang
23
+ npm i -g @botconnector/bccli # rilis stabil terbaru, butuh Node.js 22+
24
+ npm i -g @botconnector/bccli@next # …atau pra-rilis berikutnya
25
+ bccli login # simpan API key BotConnector Cloud
9
26
  cd project-kamu && bccli
10
27
  ```
11
28
 
@@ -15,6 +32,7 @@ cd project-kamu && bccli
15
32
  |---|---|
16
33
  | `bccli` | mode interaktif |
17
34
  | `bccli -p "tugas"` | satu tugas tanpa interaksi (skrip/CI) |
35
+ | `bccli -p "tugas" --output-format json` | hasil akhir sebagai satu objek JSON; `stream-json` = event JSONL per tahap (tool_use/tool_result/message/result) untuk CI |
18
36
  | `bccli -c` / `bccli -r` | lanjutkan sesi terakhir / pilih sesi |
19
37
  | `bccli -m provider/model` | pilih model |
20
38
  | `bccli --reasoning <auto|off|low|medium|high|max>` | pilih level reasoning untuk invocation ini |
@@ -28,6 +46,7 @@ Perintah di dalam sesi (ketik `/` untuk saran, ↑↓ pilih, Enter jalankan):
28
46
  | `/model` | ganti model |
29
47
  | `/reasoning` | pilih Auto / Off / Low / Medium / High / Max |
30
48
  | `/provider` | tambah/pilih provider AI |
49
+ | `/language` | ganti bahasa tampilan (`en` / `id`) |
31
50
  | `/mcp` | pasang/kelola server MCP |
32
51
  | `/new` | sesi baru (sesi lama tetap tersimpan) |
33
52
  | `/resume` | lanjutkan sesi lain di folder ini |
@@ -53,9 +72,26 @@ Perintah di dalam sesi (ketik `/` untuk saran, ↑↓ pilih, Enter jalankan):
53
72
  `/undo` hanya membatalkan perubahan lewat alat edit/tulis (bukan perintah bash), per giliran, sampai 20 giliran ke belakang.
54
73
  Shift+Tab ganti mode izin: `default` → `acceptEdits` → `plan` → `allowAll`.
55
74
 
75
+ Membaca file rahasia (`.env`, `.ssh`, `.aws`, `id_rsa`, `*.pem`, `*.key`, `secret*`,
76
+ `credential*`) selalu meminta izin; `allowAll` satu-satunya mode yang tidak bertanya, dan
77
+ izin itu tidak bisa diberikan "untuk sesi ini".
78
+
56
79
  Mode `-p` tidak pernah bertanya: alat yang butuh izin ditolak, kecuali memakai
57
80
  `--allow-all` atau `--allowed-tools bash,edit,fetch`.
58
81
 
82
+ ## Bahasa
83
+
84
+ Tampilan BCCLI (bantuan, pesan, prompt izin) memakai **bahasa Inggris secara default**. Bahasa Indonesia tetap tersedia:
85
+
86
+ ```bash
87
+ bccli --lang id # hanya untuk satu kali jalan
88
+ BCCLI_LANG=id bccli # lewat environment
89
+ /language id # di dalam sesi; disimpan di ~/.bccli/config.json ("language")
90
+ ```
91
+
92
+ Urutan prioritas: `--lang`, lalu `BCCLI_LANG`, lalu `language` di config, lalu Inggris. Bahasa jawaban model mengikuti bahasa yang kamu tulis, dan
93
+ pesan alat yang dibaca model (hasil tool, galat) selalu berbahasa Inggris supaya tidak mengganggu bahasa jawabannya.
94
+
59
95
  ## Provider
60
96
 
61
97
  `/provider` di dalam sesi (atau `bccli provider add <id>`) memasang provider hanya dengan API key:
@@ -97,12 +133,37 @@ BCCLI dapat memasang BotConnector sebagai provider untuk agent lain:
97
133
  | `bccli integrations` | lihat status integrasi |
98
134
  | `bccli connect opencode` | hubungkan OpenCode ke BotConnector |
99
135
  | `bccli connect aider` | hubungkan Aider ke BotConnector |
136
+ | `bccli connect cline` | hubungkan Cline CLI ke BotConnector |
137
+ | `bccli connect deepseek-harness` / `bccli connect dsh` | hubungkan DeepSeek Harness ke BotConnector |
138
+ | `bccli connect codex` | buat profile Codex Responses API + launcher BotConnector |
139
+ | `bccli connect claude-code` | buat launcher Claude Code via Anthropic Messages compatibility |
140
+ | `bccli connect cursor` | buat guided setup Cursor + warning override Base URL |
141
+ | `bccli connect openai-cli` | buat launcher OpenAI CLI khusus BotConnector |
142
+ | `bccli connect openai-sdk` | buat env profile untuk OpenAI Python/Node SDK |
143
+ | `bccli connect openai-compatible` | buat env profile universal OpenAI-compatible |
100
144
  | `bccli disconnect <agent>` | pulihkan config sebelum integrasi |
101
145
 
102
146
  OpenCode memakai config global `~/.config/opencode/opencode.json`. BCCLI mengambil katalog model BotConnector saat connect,
103
147
  menjaga config provider lain, dan menyimpan secret di file terpisah di `~/.bccli/integrations/`.
104
148
  Aider memakai `~/.aider.conf.yml` yang menunjuk ke env file BCCLI terpisah; BCCLI menolak menimpa setting
105
- OpenAI/env-file Aider yang sudah ada. Sebelum mengubah config eksternal, BCCLI membuat backup agar disconnect dapat memulihkannya.
149
+ OpenAI/env-file Aider yang sudah ada.
150
+
151
+ Cline memakai provider `openai-compatible` di `~/.cline/data/settings/providers.json`. Jika slot itu sudah dipakai
152
+ endpoint lain, BCCLI menolak menimpanya. Cline sendiri menyimpan API key provider di file tersebut.
153
+
154
+ DeepSeek Harness memakai custom provider `botconnector` di `$DSH_HOME/settings.yaml` dengan
155
+ `api: openai-completions` dan `apiKeyEnv: BOTCONNECTOR_API_KEY`; key diletakkan pada blok BCCLI di
156
+ `$DSH_HOME/.env`. Provider DSH lain tetap dipertahankan. Setelah connect, jalankan profile web dengan
157
+ `dsh web` (setara dengan `dsh --profile web`); `dsh` tanpa profile memang ditolak oleh DSH 0.1.x.
158
+
159
+ Codex memakai profile `$CODEX_HOME/botconnector.config.toml` dengan `wire_api = "responses"` dan launcher
160
+ BCCLI yang membaca key dari storage BCCLI saat dijalankan. Claude Code memakai launcher terisolasi dengan
161
+ `ANTHROPIC_BASE_URL=https://api.botconnector.id` dan endpoint kompatibilitas `/v1/messages` + token counting.
162
+ Login/config utama Codex dan Claude Code tidak ditimpa.
163
+
164
+ External agent memanggil BotConnector langsung, jadi discovery model tidak memakai identitas khusus BCCLI.
165
+ Akses yang memang dibatasi ke BCCLI/Web App (misalnya Luna launch access) tidak otomatis diwariskan.
166
+ Sebelum mengubah config eksternal, BCCLI membuat backup agar disconnect dapat memulihkannya.
106
167
 
107
168
  ## Internet
108
169
 
@@ -120,6 +181,14 @@ seperti Claude Code). Semua alat MCP selalu minta izin.
120
181
 
121
182
  `.bccli/mcp.json` di dalam repo tidak dijalankan sebelum kamu setujui (ditanya sekali per folder).
122
183
 
184
+ `bccli mcp serve` menjalankan MCP server stdio dengan tools BotConnector milikmu
185
+ (`bc_search`, `bc_fetch`, `bc_models`, `bc_chat`) untuk dipakai Claude Code, Cursor,
186
+ opencode, dan host MCP lain. Butuh `bccli login` (atau `BOTCONNECTOR_API_KEY`):
187
+
188
+ ```bash
189
+ claude mcp add botconnector -- npx -y @botconnector/bccli mcp serve
190
+ ```
191
+
123
192
  ## Subagent
124
193
 
125
194
  Agent bisa mendelegasikan pekerjaan lewat alat `task`:
@@ -161,3 +230,10 @@ npm test && npm run typecheck && npm run lint && npm run build
161
230
  CI (`ci.yml`) menjalankan hal yang sama di Linux, macOS, dan Windows.
162
231
  Rilis: naikkan `version` di `package.json`, lalu push tag `v<version>` — `release.yml`
163
232
  menjalankan test, smoke test ke BotConnector Cloud, dan `npm publish --provenance`.
233
+
234
+ ## Pelajari lebih lanjut
235
+
236
+ - [Unduh & panduan BCCLI](https://botconnector.id/id/download)
237
+ - [Developer API BotConnector](https://botconnector.id/id/developers/api) — endpoint kompatibel OpenAI SDK
238
+ - [Switchboard](https://github.com/farijarifriyanto-debug/switchboard) — harness agent open source dari BotConnector
239
+ - [Berkontribusi](CONTRIBUTING.md)
@@ -0,0 +1,182 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/acp.ts
4
+ var ACP_PROTOCOL_VERSION = 1;
5
+ var TOOL_KINDS = {
6
+ read: "read",
7
+ repo_map: "read",
8
+ edit: "edit",
9
+ write: "edit",
10
+ grep: "search",
11
+ glob: "search",
12
+ bash: "execute",
13
+ powershell: "execute",
14
+ fetch: "fetch",
15
+ web_search: "fetch"
16
+ };
17
+ var kindOf = (tool) => TOOL_KINDS[tool] ?? "other";
18
+ var titleOf = (tool, target) => (target ? `${tool}: ${target}` : tool).slice(0, 200);
19
+ var MAX_OUTPUT = 4e3;
20
+ var PERMISSION_OPTIONS = [
21
+ { optionId: "allow", name: "Allow", kind: "allow_once" },
22
+ { optionId: "allow_session", name: "Allow for this session", kind: "allow_always" },
23
+ { optionId: "reject", name: "Reject", kind: "reject_once" }
24
+ ];
25
+ var ANSWERS = { allow: "yes", allow_session: "session", reject: "no" };
26
+ function runAcp(input, output, opts) {
27
+ const sessions = /* @__PURE__ */ new Map();
28
+ const awaiting = /* @__PURE__ */ new Map();
29
+ let nextSession = 1;
30
+ let nextRequest = 1;
31
+ const write = (msg) => {
32
+ output.write(`${JSON.stringify(msg)}
33
+ `);
34
+ };
35
+ const reply = (id, result) => write({ jsonrpc: "2.0", id, result });
36
+ const replyError = (id, code, message) => write({ jsonrpc: "2.0", id, error: { code, message } });
37
+ const update = (sessionId, body) => write({ jsonrpc: "2.0", method: "session/update", params: { sessionId, update: body } });
38
+ const ioFor = (sid, session) => ({
39
+ toolStart(id, tool, target) {
40
+ session.open.push({ id, tool, target });
41
+ update(sid, { sessionUpdate: "tool_call", toolCallId: id, title: titleOf(tool, target), kind: kindOf(tool), status: "in_progress", rawInput: { target } });
42
+ },
43
+ toolEnd(id, output2, isError) {
44
+ session.open = session.open.filter((c) => c.id !== id);
45
+ const text = output2.length > MAX_OUTPUT ? `${output2.slice(0, MAX_OUTPUT)}
46
+ [truncated]` : output2;
47
+ update(sid, {
48
+ sessionUpdate: "tool_call_update",
49
+ toolCallId: id,
50
+ status: isError ? "failed" : "completed",
51
+ ...text ? { content: [{ type: "content", content: { type: "text", text } }] } : {}
52
+ });
53
+ },
54
+ askPermission(req) {
55
+ return new Promise((resolve) => {
56
+ const requestId = nextRequest++;
57
+ const call = [...session.open].reverse().find((c) => c.tool === req.tool && c.target === req.target);
58
+ const settle = (answer) => {
59
+ session.pending.delete(settle);
60
+ awaiting.delete(requestId);
61
+ resolve(answer);
62
+ };
63
+ session.pending.add(settle);
64
+ awaiting.set(requestId, (message) => {
65
+ const outcome = message.result?.outcome;
66
+ settle(outcome?.outcome === "selected" ? ANSWERS[outcome.optionId ?? ""] ?? "no" : "no");
67
+ });
68
+ write({
69
+ jsonrpc: "2.0",
70
+ id: requestId,
71
+ method: "session/request_permission",
72
+ params: {
73
+ sessionId: sid,
74
+ toolCall: { toolCallId: call?.id ?? `permission-${requestId}`, title: titleOf(req.tool, req.target), kind: kindOf(req.tool), status: "pending" },
75
+ options: PERMISSION_OPTIONS
76
+ }
77
+ });
78
+ });
79
+ }
80
+ });
81
+ const handle = async (msg) => {
82
+ const { id, method, params } = msg ?? {};
83
+ if (method === void 0 && id !== void 0 && (msg.result !== void 0 || msg.error !== void 0)) {
84
+ awaiting.get(id)?.(msg);
85
+ return;
86
+ }
87
+ if (method === "initialize") {
88
+ return reply(id, {
89
+ protocolVersion: ACP_PROTOCOL_VERSION,
90
+ agentCapabilities: {
91
+ loadSession: false,
92
+ promptCapabilities: { image: false, audio: false, embeddedContext: false }
93
+ }
94
+ });
95
+ }
96
+ if (method === "session/new") {
97
+ const sessionId = `s${nextSession++}`;
98
+ sessions.set(sessionId, { controller: null, pending: /* @__PURE__ */ new Set(), open: [] });
99
+ return reply(id, { sessionId });
100
+ }
101
+ if (method === "session/cancel") {
102
+ const session = sessions.get(params?.sessionId ?? "");
103
+ session?.controller?.abort();
104
+ for (const settle of [...session?.pending ?? []]) settle("no");
105
+ return;
106
+ }
107
+ if (method === "session/prompt") {
108
+ const sid = params?.sessionId ?? "";
109
+ const session = sessions.get(sid);
110
+ if (!session) return replyError(id, -32602, "Unknown session");
111
+ const text = (params?.prompt ?? []).filter((p) => p?.type === "text").map((p) => String(p.text ?? "")).join("\n");
112
+ const controller = new AbortController();
113
+ session.controller = controller;
114
+ let cancelled = false;
115
+ controller.signal.addEventListener("abort", () => {
116
+ cancelled = true;
117
+ });
118
+ try {
119
+ session.agent ??= opts.newAgent(params?.cwd ?? opts.cwd);
120
+ await session.agent.run(text, (chunk) => update(sid, { sessionUpdate: "agent_message_chunk", content: { type: "text", text: chunk } }), controller.signal, ioFor(sid, session));
121
+ } catch (e) {
122
+ if (cancelled) return reply(id, { stopReason: "cancelled" });
123
+ return replyError(id, -32603, e.message);
124
+ } finally {
125
+ session.controller = null;
126
+ session.open = [];
127
+ }
128
+ return reply(id, { stopReason: cancelled ? "cancelled" : "end_turn" });
129
+ }
130
+ if (id !== void 0) return replyError(id, -32601, "Method not found");
131
+ };
132
+ return new Promise((resolve) => {
133
+ let buf = "";
134
+ const onData = (chunk) => {
135
+ buf += chunk.toString();
136
+ let idx = buf.indexOf("\n");
137
+ while (idx >= 0) {
138
+ const line = buf.slice(0, idx);
139
+ buf = buf.slice(idx + 1);
140
+ idx = buf.indexOf("\n");
141
+ if (!line.trim()) continue;
142
+ let msg;
143
+ try {
144
+ msg = JSON.parse(line);
145
+ } catch {
146
+ continue;
147
+ }
148
+ void handle(msg);
149
+ }
150
+ };
151
+ const onEnd = () => {
152
+ input.removeListener("data", onData);
153
+ resolve();
154
+ };
155
+ input.on("data", onData);
156
+ input.on("end", onEnd);
157
+ });
158
+ }
159
+ function runtimeAgent(cwd, allowAll = false) {
160
+ let rt;
161
+ return {
162
+ async run(text, onChunk, signal, io) {
163
+ if (!rt) {
164
+ const { parseCliArgs } = await import("./args-J5ONVGIF.js");
165
+ const { createRuntime } = await import("./setup-FJAWDWV4.js");
166
+ rt = createRuntime({ cwd, args: { ...parseCliArgs([]), allowAll } });
167
+ }
168
+ if (io && !allowAll) rt.agent.askPermission = (req) => io.askPermission(req);
169
+ rt.agent.onEvent = (event) => {
170
+ if (event.type === "text") onChunk(event.delta);
171
+ else if (event.type === "toolStart") io?.toolStart(event.id, event.tool, event.target);
172
+ else if (event.type === "toolEnd") io?.toolEnd(event.id, event.output, event.isError);
173
+ };
174
+ await rt.agent.run(text, signal);
175
+ }
176
+ };
177
+ }
178
+ export {
179
+ ACP_PROTOCOL_VERSION,
180
+ runAcp,
181
+ runtimeAgent
182
+ };
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ helpText,
4
+ parseCliArgs
5
+ } from "./chunk-KEMYIGCP.js";
6
+ import "./chunk-O7M3TGIW.js";
7
+ import "./chunk-BLOYFIAD.js";
8
+ import "./chunk-LACUWBWS.js";
9
+ import "./chunk-UZWJQF67.js";
10
+ export {
11
+ helpText,
12
+ parseCliArgs
13
+ };