opencode-anthropic-multi-account 0.2.32 → 0.2.34

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 CHANGED
@@ -1,10 +1,15 @@
1
1
  # opencode-anthropic-multi-account
2
2
 
3
- OpenCode plugin for multi-account Anthropic (Claude) OAuth management with automatic rate limit switching.
3
+ OpenCode plugin for multi-account Claude OAuth. It runs inside OpenCode and does not
4
+ launch `kyoli serve`.
5
+
6
+ Use this package for OpenCode Plugin Mode. Use Server Mode (`kyoli serve` +
7
+ `kyoli install opencode`) when the same account pool should also serve Codex CLI, SDK
8
+ clients, or a dashboard.
4
9
 
5
10
  ## Install
6
11
 
7
- Add to `opencode.json`:
12
+ Add the plugin to `~/.config/opencode/opencode.json`:
8
13
 
9
14
  ```jsonc
10
15
  {
@@ -12,20 +17,73 @@ Add to `opencode.json`:
12
17
  }
13
18
  ```
14
19
 
15
- ## Features
20
+ If `plugin` already exists, append this package to the existing array.
21
+
22
+ Then use OpenCode's normal auth flow:
23
+
24
+ ```bash
25
+ opencode auth login
26
+ ```
27
+
28
+ Choose the Claude/Anthropic multi-auth OAuth method. Run the same command again to add
29
+ more Claude accounts or open the account management menu.
30
+
31
+ ## What it does
16
32
 
17
- - Automatic account rotation on 429 responses
18
- - Three selection strategies: sticky, round-robin, and hybrid
19
- - Cross-process coordination for parallel sessions
20
- - Background token refresh before expiry
21
- - Status tool (`claude_multiauth_status`) for mid-session account overview
33
+ - Uses OpenCode's built-in `anthropic` provider.
34
+ - Stores accounts under OpenCode's config directory.
35
+ - Rotates accounts on auth/rate-limit failures.
36
+ - Refreshes tokens before expiry.
37
+ - Keeps routing sticky by default for prompt-cache-heavy sessions.
22
38
 
23
- ## Architecture
39
+ ## Tool policy
24
40
 
41
+ Claude tool handling is OpenCode-first:
42
+
43
+ - preserve incoming OpenCode tools when present;
44
+ - use Claude Code template tools only when OpenCode sends no tools;
45
+ - fill missing `input_schema` from the template only when tool counts match;
46
+ - do not remap unknown OpenCode/custom tools onto Claude Code fallback tools.
47
+
48
+ This is an internal compatibility policy, not a third user-facing mode.
49
+
50
+ ## Server Mode migration
51
+
52
+ ```bash
53
+ kyoli accounts import opencode --dry-run --provider claude-code
54
+ kyoli accounts import opencode --provider claude-code
55
+ kyoli install opencode
25
56
  ```
26
- opencode-anthropic-multi-account ← you are here
27
-
28
- opencode-multi-account-core
57
+
58
+ Do not keep this plugin enabled for Anthropic while also routing Anthropic through
59
+ `kyoli install opencode`, unless you are intentionally comparing both paths.
60
+
61
+ ## Checks
62
+
63
+ No-live contract:
64
+
65
+ ```bash
66
+ pnpm --filter opencode-anthropic-multi-account test:contract:native
67
+ ```
68
+
69
+ Full package checks:
70
+
71
+ ```bash
72
+ pnpm --filter opencode-anthropic-multi-account typecheck
73
+ pnpm --filter opencode-anthropic-multi-account test
74
+ pnpm --filter opencode-anthropic-multi-account build
29
75
  ```
30
76
 
31
- See the [root README](../../README.md) for full documentation.
77
+ Opt-in live acceptance:
78
+
79
+ ```bash
80
+ KYOLI_ENABLE_LIVE_OPENCODE_CLAUDE_NATIVE=1 \
81
+ KYOLI_CLAUDE_ALLOW_LIVE_MESSAGES=1 \
82
+ pnpm --filter opencode-anthropic-multi-account test:live:opencode-claude-native
83
+ ```
84
+
85
+ ## Docs
86
+
87
+ - [Root README](../../README.md)
88
+ - [OpenCode Plugin Usage](../../docs/opencode-plugin-usage.md)
89
+ - [Claude live acceptance](../../docs/claude-live-acceptance.md)
@@ -21,7 +21,7 @@ import {
21
21
  var data_default = {
22
22
  _version: 1,
23
23
  _schemaVersion: 1,
24
- _captured: "2026-05-09T04:25:44.414Z",
24
+ _captured: "2026-05-13T04:41:29.162Z",
25
25
  _source: "bundled",
26
26
  agent_identity: "You are a Claude agent, built on Anthropic's Claude Agent SDK.",
27
27
  system_prompt: `You are an interactive agent that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
@@ -101,7 +101,7 @@ Always respond in Korean. Use Korean for all explanations, comments, and communi
101
101
  Maintain full orthographic correctness for Korean, including all required diacritical marks, accents, and special characters. Never substitute accented characters with their ASCII equivalents (e.g., never write "nao" for "n\xE3o", "fur" for "f\xFCr", or "loeschen" for "l\xF6schen").
102
102
 
103
103
  # Context management
104
- When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.
104
+ When the conversation grows long, some or all of the current context is summarized; the summary, along with any remaining unsummarized context, is provided in the next context window so work can continue \u2014 you don't need to wrap up early or hand off mid-task.
105
105
 
106
106
  gitStatus: This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.
107
107
 
@@ -122,6 +122,7 @@ Recent commits:
122
122
  description: `Launch a new agent to handle complex, multi-step tasks. Each agent type has specific capabilities and tools available to it.
123
123
 
124
124
  Available agent types and the tools they have access to:
125
+ - claude: Catch-all for any task that doesn't fit a more specific agent. FleetView's default when no agent name is typed. (Tools: *)
125
126
  - Explore: Fast read-only search agent for locating code. Use it to find files by pattern (eg. "src/components/**/*.tsx"), grep for symbols or keywords (eg. "API endpoints"), or answer "where is X defined / which files reference Y." Do NOT use it for code review, design-doc auditing, cross-file consistency checks, or open-ended analysis \u2014 it reads excerpts rather than whole files and will miss content past its read window. When calling, specify search breadth: "quick" for a single targeted lookup, "medium" for moderate exploration, or "very thorough" to search across multiple locations and naming conventions. (Tools: All tools except Agent, ExitPlanMode, Edit, Write, NotebookEdit)
126
127
  - general-purpose: General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you. (Tools: *)
127
128
  - Plan: Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs. (Tools: All tools except Agent, ExitPlanMode, Edit, Write, NotebookEdit)
@@ -961,7 +962,7 @@ If the result says the push wasn't sent, that's expected \u2014 no action needed
961
962
  },
962
963
  {
963
964
  name: "ScheduleWakeup",
964
- description: "Schedule when to resume work in /loop dynamic mode \u2014 the user invoked /loop without an interval, asking you to self-pace iterations of a specific task.\n\nPass the same /loop prompt back via `prompt` each turn so the next firing repeats the task. For an autonomous /loop (no user prompt), pass the literal sentinel `<<autonomous-loop-dynamic>>` as `prompt` instead \u2014 the runtime resolves it back to the autonomous-loop instructions at fire time. (There is a similar `<<autonomous-loop>>` sentinel for CronCreate-based autonomous loops; do not confuse the two \u2014 ScheduleWakeup always uses the `-dynamic` variant.) Omit the call to end the loop.\n\n## Picking delaySeconds\n\nThe Anthropic prompt cache has a 5-minute TTL. Sleeping past 300 seconds means the next wake-up reads your full conversation context uncached \u2014 slower and more expensive. So the natural breakpoints:\n\n- **Under 5 minutes (60s\u2013270s)**: cache stays warm. Right for active work \u2014 checking a build, polling for state that's about to change, watching a process you just started.\n- **5 minutes to 1 hour (300s\u20133600s)**: pay the cache miss. Right when there's no point checking sooner \u2014 waiting on something that takes minutes to change, or genuinely idle.\n\n**Don't pick 300s.** It's the worst-of-both: you pay the cache miss without amortizing it. If you're tempted to \"wait 5 minutes,\" either drop to 270s (stay in cache) or commit to 1200s+ (one cache miss buys a much longer wait). Don't think in round-number minutes \u2014 think in cache windows.\n\nFor idle ticks with no specific signal to watch, default to **1200s\u20131800s** (20\u201330 min). The loop checks back, you don't burn cache 12\xD7 per hour for nothing, and the user can always interrupt if they need you sooner.\n\nThink about what you're actually waiting for, not just \"how long should I sleep.\" If you kicked off an 8-minute build, sleeping 60s burns the cache 8 times before it finishes \u2014 sleep ~270s twice instead.\n\nThe runtime clamps to [60, 3600], so you don't need to clamp yourself.\n\n## The reason field\n\nOne short sentence on what you chose and why. Goes to telemetry and is shown back to the user. \"checking long bun build\" beats \"waiting.\" The user reads this to understand what you're doing without having to predict your cadence in advance \u2014 make it specific.\n",
965
+ description: "Schedule when to resume work in /loop dynamic mode \u2014 the user invoked /loop without an interval, asking you to self-pace iterations of a specific task.\n\nDo NOT schedule a short-interval wakeup to poll for background work you started \u2014 when harness-tracked work finishes, you are re-invoked automatically, so polling is wasted. Instead schedule a long fallback (1200s+) so the loop survives if the work hangs or never notifies. The exception is external work the harness cannot track (a CI run, a deploy, a remote queue) \u2014 there, pick a delay matched to how fast that state actually changes.\n\nPass the same /loop prompt back via `prompt` each turn so the next firing repeats the task. For an autonomous /loop (no user prompt), pass the literal sentinel `<<autonomous-loop-dynamic>>` as `prompt` instead \u2014 the runtime resolves it back to the autonomous-loop instructions at fire time. (There is a similar `<<autonomous-loop>>` sentinel for CronCreate-based autonomous loops; do not confuse the two \u2014 ScheduleWakeup always uses the `-dynamic` variant.) Omit the call to end the loop.\n\n## Picking delaySeconds\n\nThe Anthropic prompt cache has a 5-minute TTL. Sleeping past 300 seconds means the next wake-up reads your full conversation context uncached \u2014 slower and more expensive. So the natural breakpoints:\n\n- **Under 5 minutes (60s\u2013270s)**: cache stays warm. Right for actively polling external state the harness can't notify you about \u2014 a CI run, a deploy, a remote queue.\n- **5 minutes to 1 hour (300s\u20133600s)**: pay the cache miss. Right when there's no point checking sooner \u2014 waiting on something that takes minutes to change, genuinely idle, or as the long fallback heartbeat when something else is the primary wake signal.\n\n**Don't pick 300s.** It's the worst-of-both: you pay the cache miss without amortizing it. If you're tempted to \"wait 5 minutes,\" either drop to 270s (stay in cache) or commit to 1200s+ (one cache miss buys a much longer wait). Don't think in round-number minutes \u2014 think in cache windows.\n\nFor idle ticks with no specific signal to watch, default to **1200s\u20131800s** (20\u201330 min). The loop checks back, you don't burn cache 12\xD7 per hour for nothing, and the user can always interrupt if they need you sooner.\n\nThink about what you're actually waiting for, not just \"how long should I sleep.\" If you're polling a CI run that takes ~8 minutes, sleeping 60s burns the cache 8 times before it finishes \u2014 sleep ~270s twice instead.\n\nThe runtime clamps to [60, 3600], so you don't need to clamp yourself.\n\n## The reason field\n\nOne short sentence on what you chose and why. Goes to telemetry and is shown back to the user. \"watching CI run\" beats \"waiting.\" The user reads this to understand what you're doing without having to predict your cadence in advance \u2014 make it specific.\n",
965
966
  input_schema: {
966
967
  $schema: "https://json-schema.org/draft/2020-12/schema",
967
968
  type: "object",
@@ -1419,7 +1420,7 @@ IMPORTANT - Use the correct year in search queries:
1419
1420
  "Write"
1420
1421
  ],
1421
1422
  anthropic_beta: "claude-code-20250219,oauth-2025-04-20,context-1m-2025-08-07,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advisor-tool-2026-03-01,effort-2025-11-24,extended-cache-ttl-2025-04-11",
1422
- cc_version: "2.1.137",
1423
+ cc_version: "2.1.140",
1423
1424
  header_order: [
1424
1425
  "Accept",
1425
1426
  "Authorization",
@@ -1449,7 +1450,7 @@ IMPORTANT - Use the correct year in search queries:
1449
1450
  "anthropic-dangerous-direct-browser-access": "true",
1450
1451
  "anthropic-version": "2023-06-01",
1451
1452
  "content-type": "application/json",
1452
- "user-agent": "claude-cli/2.1.137 (external, sdk-cli)",
1453
+ "user-agent": "claude-cli/2.1.140 (external, sdk-cli)",
1453
1454
  "x-app": "cli",
1454
1455
  "x-stainless-timeout": "600"
1455
1456
  },
@@ -2042,7 +2043,7 @@ var STATIC_HEADER_NAMES = [
2042
2043
  ];
2043
2044
  var SUPPORTED_CC_RANGE = {
2044
2045
  min: "1.0.0",
2045
- maxTested: "2.1.138"
2046
+ maxTested: "2.1.140"
2046
2047
  };
2047
2048
  var bundledTemplate = data_default;
2048
2049
  var fingerprintCaptureTestOverrides = {};
@@ -2543,9 +2544,9 @@ export {
2543
2544
  PLAN_LABELS,
2544
2545
  TOKEN_EXPIRY_BUFFER_MS,
2545
2546
  TOKEN_REFRESH_TIMEOUT_MS,
2546
- cc_derived_defaults_default,
2547
2547
  data_default,
2548
2548
  detectCliVersion,
2549
+ cc_derived_defaults_default,
2549
2550
  showToast,
2550
2551
  debugLog,
2551
2552
  createMinimalClient,
@@ -2568,4 +2569,4 @@ export {
2568
2569
  setFingerprintCaptureTestOverridesForTest,
2569
2570
  resetFingerprintCaptureForTest
2570
2571
  };
2571
- //# sourceMappingURL=chunk-DDA3ZBC5.js.map
2572
+ //# sourceMappingURL=chunk-JQCI5OK3.js.map