@khalilgharbaoui/opencode-claude-code-plugin 0.50.0 → 0.51.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/dist/index.d.ts +38 -0
- package/dist/index.js +350 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/claude-code-plugin/SKILL.md +35 -1
package/package.json
CHANGED
|
@@ -113,6 +113,7 @@ Defaults below describe normal headless opencode use when the key is absent.
|
|
|
113
113
|
| `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. |
|
|
114
114
|
| `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. |
|
|
115
115
|
| `accountFailover` | `"ask"` / `"off"` | `"off"` | **Opt-in: only an explicit `"ask"` opens the switch form**, so unset and `"off"` behave identically. `"ask"` ends a usage-limited turn on opencode's native `question` form listing the other configured accounts, and continues the task on the pick inside the same opencode turn. Only ever fires with more than one account configured. 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 the way a limited turn ends without the form. Triggered only by a rejected `rate_limit_event`, one of the two known account-limit error texts, or one of the five account-level failure kinds the CLI names on its own error reply (`authentication_failed`, `oauth_org_not_allowed`, `account_on_hold`, `verification_required`, `billing_error`); never by a generic failure. Never on compaction turns; both transports (the TUI's limit reply carries the same `error: "rate_limit"` kind). A switch carries the Claude conversation to the target account's config dir and resumes it there (`crossAccountResume`, default on) and only replays the thread as text when that copy is refused; either way, MCP servers configured only in the limited account's Claude profile are gone. With the default `"off"`, a limited turn ends on one `▌ **usage limit:**` note instead (see "When an account runs out of usage"). |
|
|
116
|
+
| `accountGroups` | object | – | **Off unless set**, and unset means every account behaves as one group, so nothing changes on an install that does not set it. A map from an account name in `accounts` to a group name, e.g. `{"work": "work"}`; every account not named, `default` included, is in one implicit group. With it set the plugin only moves a conversation between accounts in the SAME group, which covers all four ways one can move: the by-hand switch (picking a model under another account's provider in the same opencode session), the `accountFailover` form, the override that form sets, and `crossAccountResume`. A switch ACROSS groups sends the other account nothing at all, neither the Claude transcript nor a text replay of the thread (the replay is the same history by another route), starts fresh with only the current user message, and writes one `▌ **account group:**` note naming both accounts and both groups. The source account keeps the conversation and its transcript, so switching back continues it. The switch form offers only same-group accounts, and with none left behaves as a single-account install; `describeOtherAccounts` in the usage-limit and account-block notes is filtered the same way. An account name that is not configured is ignored with one WARN, as is a non-object value or a non-string group. Compaction is exempt and a child session follows its parent. Shown resolved (never echoed) in the startup block and `/claude-code-doctor` as `accountGroups`, names only. Log: `starting fresh on this account: it is in another account group` (NOTICE, reason `another-account-group`). It guards what the plugin moves on its own; it is not a permission system. |
|
|
116
117
|
| `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. |
|
|
117
118
|
| `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. |
|
|
118
119
|
| `accountInProcess` | boolean | unset/derived | Set by the config hook on Windows, where there is no per-account wrapper script: the spawn exports `CLAUDE_CONFIG_DIR` itself and strips the `@<account>` marker off `--model`. Do not hand-wire it. |
|
|
@@ -473,10 +474,43 @@ Tell the user what a pick actually does before recommending one:
|
|
|
473
474
|
fix; a switch made from that form lasts until opencode restarts. With the form off and
|
|
474
475
|
another account configured the note ends with "Or pick a model from the
|
|
475
476
|
`"<account>"` account and resend." instead of offering the form.
|
|
476
|
-
-
|
|
477
|
+
- Works on both transports; not available on compaction turns.
|
|
477
478
|
|
|
478
479
|
`{ "accountFailover": "off" }`, which is also the default, keeps the note.
|
|
479
480
|
|
|
481
|
+
### Switching account by hand, and keeping two accounts apart
|
|
482
|
+
|
|
483
|
+
Picking a model under another account's provider in the **same** opencode session
|
|
484
|
+
continues the conversation on that account rather than starting over: the Claude
|
|
485
|
+
transcript is copied into the other account's `CLAUDE_CONFIG_DIR` and resumed with
|
|
486
|
+
`--resume`. Both transports, either direction, and it composes with a model or effort
|
|
487
|
+
change in the same step. It refuses (and replays as text, saying which in one NOTICE)
|
|
488
|
+
when the thread is no longer the conversation that account was last asked to continue,
|
|
489
|
+
when the transcript is gone or still being written, or with
|
|
490
|
+
`"crossAccountResume": false`.
|
|
491
|
+
|
|
492
|
+
When two accounts must NOT see each other's work, name them into groups:
|
|
493
|
+
|
|
494
|
+
```json
|
|
495
|
+
{
|
|
496
|
+
"provider": {
|
|
497
|
+
"claude-code": {
|
|
498
|
+
"options": {
|
|
499
|
+
"accounts": ["work", "hobby"],
|
|
500
|
+
"accountGroups": { "work": "work" }
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
`work` is alone in the group `work`; `hobby` and `default` share the implicit `default`
|
|
508
|
+
group. Moving a conversation from `work` to `hobby` now sends `hobby` nothing: no
|
|
509
|
+
transcript copy and no text replay, one `▌ **account group:**` note, and the
|
|
510
|
+
conversation left intact on `work` to switch back to. Recommend one group name per
|
|
511
|
+
real-world boundary (employer, client, personal), and name only the accounts that have
|
|
512
|
+
to stay apart, since everything unnamed is already together.
|
|
513
|
+
|
|
480
514
|
### Subagents on one model, on the caller's account
|
|
481
515
|
|
|
482
516
|
opencode's agent config cannot say "inherit the account, change the model", because the
|