@khalilgharbaoui/opencode-claude-code-plugin 0.54.1 → 0.55.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 CHANGED
@@ -490,12 +490,13 @@ interface LoggingConfig {
490
490
  }
491
491
  type WebSearchRouting = "claude" | "disabled" | (string & {});
492
492
  /**
493
- * What happens when the account a conversation runs on is out of usage.
494
- * `"ask"` (default) shows the operator a form listing the other configured
495
- * accounts and applies the pick inside the same turn; `"off"` keeps today's
496
- * behaviour, where the turn ends with the rate-limit error.
493
+ * What happens when the account a conversation is running on is out of usage
494
+ * or cannot serve. `"off"` (the default, also what unset means) ends the turn
495
+ * on one `▌ **usage limit:**` note; `"ask"` ends it on a form listing the
496
+ * other configured accounts and continues on the pick; `"auto"` moves the same
497
+ * request to the next eligible configured account without asking.
497
498
  */
498
- type AccountFailoverMode = "ask" | "off";
499
+ type AccountFailoverMode = "ask" | "off" | "auto";
499
500
  /** `subagentDispatch`. Unset behaves as `"off"`; see the option's own note. */
500
501
  type SubagentDispatchMode = "ask" | "off";
501
502
  interface ClaudeCodeProviderSettings {
@@ -539,11 +540,13 @@ interface ClaudeCodeProviderSettings {
539
540
  */
540
541
  accountInProcess?: boolean;
541
542
  /**
542
- * When this account is out of usage, show the operator a form listing the
543
- * other configured accounts and continue the task on the pick, inside the
544
- * same opencode turn. `"ask"` by default, which only does anything when
545
- * more than one account is configured. `"off"` keeps the plain rate-limit
546
- * error. See README "Account failover".
543
+ * What a usage limit or an account that cannot serve does to the turn.
544
+ * Unset or `"off"` (the default) ends it on one `▌ **usage limit:**` note.
545
+ * `"ask"` shows a form listing the other configured accounts and continues
546
+ * on the pick. `"auto"` continues the same request on the next eligible
547
+ * configured account, in configured order, without asking. Both only do
548
+ * anything when more than one account is configured. See
549
+ * docs/configuration/accounts.md.
547
550
  */
548
551
  accountFailover?: AccountFailoverMode;
549
552
  /**
@@ -1489,6 +1492,31 @@ declare class ClaudeCodeLanguageModel implements LanguageModelV3 {
1489
1492
  * because which method opencode used is not in them.
1490
1493
  */
1491
1494
  private streamTurn;
1495
+ /**
1496
+ * Run the turn, moving the same request to the next eligible configured
1497
+ * account when the one it ran on is out of usage or cannot serve
1498
+ * (`accountFailover: "auto"`). The single wiring point for the automatic
1499
+ * switch, and outside `runModelChain` on purpose: an account switch starts
1500
+ * that account's own model chain from the top.
1501
+ *
1502
+ * Anything but `"auto"` is `runModelChain` and one `await`, so `"off"` and
1503
+ * `"ask"` are exactly what they were. With `"auto"`, the attempt that failed
1504
+ * decides the switch itself (`completeResult` sets `run.switchTo` and closes
1505
+ * its stream without a `finish`), and the next attempt's prologue makes the
1506
+ * switch the form's pick would have made. This only splices the attempts
1507
+ * into one caller turn: one `stream-start`, and the `finish` of whichever
1508
+ * attempt did not switch.
1509
+ *
1510
+ * The bound is `run.tried`, as it is `tried` for the model chain: every
1511
+ * account spawned or switched to goes in, and none in it is picked again.
1512
+ *
1513
+ * Cancelling the returned stream is a stop, for every attempt: this loop is
1514
+ * the plugin starting more work on the caller's behalf, so a caller that
1515
+ * has gone away must reach all of it. Each attempt gets a signal that the
1516
+ * caller's own `abortSignal` and a `cancel()` both abort, and the loop
1517
+ * starts no further account once either has happened.
1518
+ */
1519
+ private runAccountFailover;
1492
1520
  /**
1493
1521
  * Run the turn, moving to the next model in the fallback chain if the one
1494
1522
  * it started on is refused. The single wiring point for `src/model-fallback.ts`.