@khalilgharbaoui/opencode-claude-code-plugin 0.23.0 → 0.24.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/README.md +31 -1
- package/dist/index.d.ts +34 -0
- package/dist/index.js +1153 -671
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/skills/claude-code-plugin/SKILL.md +33 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khalilgharbaoui/opencode-claude-code-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Claude Code CLI provider plugin for opencode",
|
|
5
5
|
"author": "Khalil Gharbaoui",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"build": "tsup",
|
|
22
22
|
"dev": "tsup --watch",
|
|
23
23
|
"typecheck": "tsc --noEmit",
|
|
24
|
-
"test": "tsx --test test-bridge.ts test-broker.ts test-proxy-mcp.ts test-proxy-task.ts test-auto-continue.ts test-has-new-user-content.ts test-get-claude-user-message.ts test-logger.ts test-cli-args.ts test-session-manager.ts test-compaction-model.ts test-tool-mapping.ts test-cwd-resolution.ts test-todo-ledger.ts test-session-affinity.ts test-config-models.ts test-ask-user-question.ts test-claude-session-wrapper.ts test-spawn-env.ts test-respawn.ts test-startup-diagnostics.ts test-subagent-hint.ts test-exit-plan-mode-question.ts test-compress-tool.ts test-agent-models.ts test-side-question.ts test-btw-command.ts test-effort-sessions.ts test-tool-block-index.ts test-skill-bridge.ts test-turn-stats.ts test-cli-events.ts test-cli-events-stream.ts test-doctor.ts test-configure-skill.ts test-unattended-replay.ts test-process-lifecycle.ts"
|
|
24
|
+
"test": "tsx --test test-bridge.ts test-broker.ts test-proxy-mcp.ts test-proxy-task.ts test-auto-continue.ts test-has-new-user-content.ts test-get-claude-user-message.ts test-logger.ts test-cli-args.ts test-session-manager.ts test-compaction-model.ts test-tool-mapping.ts test-cwd-resolution.ts test-todo-ledger.ts test-session-affinity.ts test-config-models.ts test-ask-user-question.ts test-claude-session-wrapper.ts test-spawn-env.ts test-respawn.ts test-startup-diagnostics.ts test-subagent-hint.ts test-exit-plan-mode-question.ts test-compress-tool.ts test-agent-models.ts test-side-question.ts test-btw-command.ts test-effort-sessions.ts test-tool-block-index.ts test-skill-bridge.ts test-turn-stats.ts test-cli-events.ts test-cli-events-stream.ts test-result-fallback.ts test-doctor.ts test-configure-skill.ts test-unattended-replay.ts test-process-lifecycle.ts test-account-failover.ts"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@ai-sdk/provider": "^3.0.8",
|
|
@@ -79,6 +79,9 @@ Defaults below describe normal headless opencode use when the key is absent.
|
|
|
79
79
|
|---|---|---|---|
|
|
80
80
|
| `cliPath` | string | `"claude"` | Executable, not a shell command with flags. Use an absolute path for a non-PATH install. The opencode config hook supplies this default; only direct `createClaudeCode()` use falls back to `CLAUDE_CLI_PATH`. Account providers wrap it; never select a generated wrapper yourself. |
|
|
81
81
|
| `accounts` | string[] | unset | Unset keeps provider `claude-code`. Any array, including `[]`, expands to `claude-code-default` plus normalized, deduplicated names. Non-default accounts use `~/.claude-<name>`; default uses the CLI's normal environment/auth. |
|
|
82
|
+
| `accountFailover` | `"ask"` / `"off"` | `"ask"` | When the account a conversation runs on is out of usage, end the turn on opencode's native `question` form listing the other configured accounts, and continue the task on the pick inside the same opencode turn. Only ever fires with more than one account configured, so a single-account install is unaffected by the default. The pick is sticky for the LIMITED account until the limit's reset time (or until opencode restarts when the CLI reported none), so it covers every session on that account and subagents follow their parent; child sessions are never shown the form. Leaving it unanswered waits and costs nothing. `stop`, a dismissal, or text that is not one of the offered accounts ends the turn as the rate-limit error does. Triggered only by a rejected `rate_limit_event` or the two known account-limit error texts, never by a generic failure. Never on compaction turns or the interactive transport. A switch cannot resume the Claude session (transcripts live under the account's own config dir), so the conversation is replayed into a fresh one: it costs input tokens on the new account, and MCP servers configured only in the limited account's Claude profile are gone. `"off"` keeps the plain rate-limit error. |
|
|
83
|
+
| `failoverAccounts` | string[] | unset/derived | Account expansion supplies the resolved account list so a limited account can offer the others. Do not hand-wire it; set `accounts` instead. |
|
|
84
|
+
| `baseCliPath` | string | unset/derived | The `cliPath` before the per-account wrapper substitution, so a failover can build another account's wrapper on the same binary. Supplied by the config hook. Do not hand-wire it. |
|
|
82
85
|
| `defaultSubagentModel` | string | unset | Seed-config default for discovered `mode: subagent` agents without a full `provider/model` pin; `forceModel` takes precedence. Keeps the caller's account. Unknown ids warn and keep the inherited model. Not independently read per expanded account. |
|
|
83
86
|
| `cwd` | string | automatic | Pin an absolute existing directory. Otherwise: session directory from SDK, usable `process.cwd()`, captured project directory, final `process.cwd()` fallback. Startup diagnostics cannot show the per-call session tier. |
|
|
84
87
|
| `skipPermissions` | boolean | `true` | Pass `--dangerously-skip-permissions` to headless Claude, even with proxies enabled. Proxied calls still use opencode permissions, but unproxied CLI tools do not. `false` removes the bypass flag; it does not by itself create human approval prompts. Ignored when `permissionMode` is `"plan"`, which always drops the flag. |
|
|
@@ -144,6 +147,7 @@ their secret values. Arbitrary MCP `{env:NAME}` placeholders are outside this li
|
|
|
144
147
|
| `CLAUDE_CODE_INTERACTIVE_TRANSPORT` | Fallback when `interactive` is absent: `1` enables; empty/`0`/`false`/`no`/`off` disable (case-insensitive). Explicit `interactive: false` wins. |
|
|
145
148
|
| `CLAUDE_CODE_INTERACTIVE_BYPASS` | Deprecated no-op, like `interactiveBypass`. |
|
|
146
149
|
| `CLAUDE_CODE_START_WATCHDOG_MS` | Positive integer ms before a headless start or proxy-result continuation is considered silent; default 90000 for missing/invalid/nonpositive values. First expiry respawns, second errors. Bookkeeping-only output is not progress. Keep within timer range; do not lower for routine config checks. |
|
|
150
|
+
| `CLAUDE_CODE_RESULT_FALLBACK_MS` | Positive integer ms of stdout silence, after the CLI has produced output, before the turn is closed with no `result`; default 60000 for missing/invalid/nonpositive values. The close is announced in the reply as a `▌ **stream timeout:**` note, which is stripped from any rebuilt transcript. An aborted turn gets no note. |
|
|
147
151
|
| `OPENCODE_CLAUDE_CODE_LOG_FILE` | Overrides `logging.file`: trimmed `0/false/no/off` are false; any other nonempty value is true; empty falls back to config. Prefer `1` or `0`. |
|
|
148
152
|
| `OPENCODE_CLAUDE_CODE_LOG_DIR` | Overrides `logging.dir`. |
|
|
149
153
|
| `OPENCODE_CLAUDE_CODE_LOG_LEVEL` | Overrides `logging.level`. Invalid values fall through to config. |
|
|
@@ -191,6 +195,35 @@ suffix and sets the config dir. Existing `CLAUDE.md`, `settings.json`, `skills/`
|
|
|
191
195
|
missing; existing targets stay untouched. This shares capabilities/settings, not an
|
|
192
196
|
isolation boundary. Auth/session files are not part of the shared list.
|
|
193
197
|
|
|
198
|
+
### Account failover
|
|
199
|
+
|
|
200
|
+
With more than one account configured, `accountFailover` is `"ask"` by default. When a
|
|
201
|
+
turn is rejected for usage, the turn ends on opencode's `question` form instead of an
|
|
202
|
+
error: one option per other configured account, plus `stop`. Picking an account applies
|
|
203
|
+
it inside the same opencode turn, with no new user message, and the task carries on.
|
|
204
|
+
Leaving the form unanswered waits and costs nothing.
|
|
205
|
+
|
|
206
|
+
Tell the user what a pick actually does before recommending one:
|
|
207
|
+
|
|
208
|
+
- It is sticky for the **limited account** until that limit's reset time, or until
|
|
209
|
+
opencode restarts when the CLI reported no reset time. Every session on the limited
|
|
210
|
+
account follows the same pick, and subagents follow their parent. Child sessions are
|
|
211
|
+
never shown the form themselves.
|
|
212
|
+
- A switch **cannot resume the Claude session**, because transcripts live under each
|
|
213
|
+
account's own `CLAUDE_CONFIG_DIR`. The conversation is replayed into a fresh session
|
|
214
|
+
on the target account, which costs input tokens there and loses anything the CLI held
|
|
215
|
+
but opencode did not.
|
|
216
|
+
- MCP servers configured only in the limited account's Claude profile will be **missing**
|
|
217
|
+
on the target account.
|
|
218
|
+
- `stop`, dismissing the form, or answering with anything that is not one of the offered
|
|
219
|
+
accounts ends the turn exactly as the rate-limit error does today. The limit is
|
|
220
|
+
unchanged either way; failover moves the work, it does not create usage.
|
|
221
|
+
- Only a rejected `rate_limit_event` or one of the two known account-limit error texts
|
|
222
|
+
opens the form. A generic 4xx, a timeout or a bad flag never does.
|
|
223
|
+
- Not available on the interactive transport or on compaction turns.
|
|
224
|
+
|
|
225
|
+
`{ "accountFailover": "off" }` keeps the plain rate-limit error.
|
|
226
|
+
|
|
194
227
|
### Subagents on one model, on the caller's account
|
|
195
228
|
|
|
196
229
|
opencode's agent config cannot say "inherit the account, change the model", because the
|