@khalilgharbaoui/opencode-claude-code-plugin 0.49.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 +74 -1
- package/dist/index.js +666 -219
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/claude-code-plugin/SKILL.md +38 -1
package/dist/index.d.ts
CHANGED
|
@@ -335,6 +335,9 @@ type OpenCodeHooks = {
|
|
|
335
335
|
};
|
|
336
336
|
type OpenCodePlugin = (input: unknown, options?: Record<string, unknown>) => Promise<OpenCodeHooks>;
|
|
337
337
|
|
|
338
|
+
/** Account name -> group name. Empty is never stored; `null` means no guard. */
|
|
339
|
+
type AccountGroups = Readonly<Record<string, string>>;
|
|
340
|
+
|
|
338
341
|
type LogLevel = "debug" | "info" | "notice" | "warn" | "error";
|
|
339
342
|
type LogMode = "silent" | "debug";
|
|
340
343
|
|
|
@@ -390,6 +393,12 @@ interface ClaudeCodeConfig {
|
|
|
390
393
|
*/
|
|
391
394
|
accountInProcess?: boolean;
|
|
392
395
|
accountFailover?: AccountFailoverMode;
|
|
396
|
+
/**
|
|
397
|
+
* The resolved `accountGroups` guard, or null for "no guard". Resolved once
|
|
398
|
+
* by `createClaudeCode` from the user's option, so every turn reads a value
|
|
399
|
+
* that has already been validated and warned about (h #g226).
|
|
400
|
+
*/
|
|
401
|
+
accountGroups?: AccountGroups | null;
|
|
393
402
|
providerID?: string;
|
|
394
403
|
skipPermissions?: boolean;
|
|
395
404
|
/**
|
|
@@ -404,6 +413,7 @@ interface ClaudeCodeConfig {
|
|
|
404
413
|
mcpConfig?: string | string[];
|
|
405
414
|
strictMcpConfig?: boolean;
|
|
406
415
|
bridgeOpencodeMcp?: boolean;
|
|
416
|
+
bridgeMcpOauthTokens?: boolean;
|
|
407
417
|
controlRequestBehavior?: ControlRequestBehavior;
|
|
408
418
|
controlRequestToolBehaviors?: Record<string, ControlRequestBehavior>;
|
|
409
419
|
controlRequestDenyMessage?: string;
|
|
@@ -530,6 +540,35 @@ interface ClaudeCodeProviderSettings {
|
|
|
530
540
|
* error. See README "Account failover".
|
|
531
541
|
*/
|
|
532
542
|
accountFailover?: AccountFailoverMode;
|
|
543
|
+
/**
|
|
544
|
+
* Which accounts may see each other's conversations. A map from an account
|
|
545
|
+
* name in `accounts` to a group name, e.g. `{ "appical": "work" }`.
|
|
546
|
+
*
|
|
547
|
+
* **Off unless set**, and unset is the default: with no map, or an empty one,
|
|
548
|
+
* every account behaves as one group and nothing about today's behaviour
|
|
549
|
+
* changes. Every account not named here, `default` included, is in one
|
|
550
|
+
* implicit group, so naming the one account that must stay apart is the whole
|
|
551
|
+
* configuration.
|
|
552
|
+
*
|
|
553
|
+
* When it is set, the plugin only ever moves a conversation between accounts
|
|
554
|
+
* in the SAME group: the by-hand switch (picking a model under another
|
|
555
|
+
* account's provider), the account-switch form, the override that form sets,
|
|
556
|
+
* and `crossAccountResume`. A switch ACROSS groups sends the other account
|
|
557
|
+
* nothing at all, not the Claude transcript and not a text replay of the
|
|
558
|
+
* thread either, because the replay is the same history by another route. The
|
|
559
|
+
* turn there starts fresh with only the current message and says so once, in
|
|
560
|
+
* one `▌ **account group:**` note naming both accounts. The conversation is
|
|
561
|
+
* left intact on the account it was on, so switching back continues it.
|
|
562
|
+
*
|
|
563
|
+
* The switch form offers only accounts in the limited account's own group,
|
|
564
|
+
* and with none left it behaves as a single-account install does.
|
|
565
|
+
*
|
|
566
|
+
* An account name that is not in `accounts` is a typo, so it is ignored with
|
|
567
|
+
* one WARN rather than silently creating a group that guards nothing. The
|
|
568
|
+
* resolved map is printed in the startup block and in
|
|
569
|
+
* `/claude-code-doctor`, names only.
|
|
570
|
+
*/
|
|
571
|
+
accountGroups?: Record<string, string>;
|
|
533
572
|
/**
|
|
534
573
|
* Model that subagents run on when their own definition pins nothing.
|
|
535
574
|
* Unset means no implicit override at all, so an agent keeps inheriting the
|
|
@@ -586,6 +625,25 @@ interface ClaudeCodeProviderSettings {
|
|
|
586
625
|
* the same MCP servers opencode is configured with.
|
|
587
626
|
*/
|
|
588
627
|
bridgeOpencodeMcp?: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Give a bridged remote MCP server the OAuth bearer token opencode already
|
|
630
|
+
* holds for it, so the Claude CLI can use a server you authenticated
|
|
631
|
+
* through opencode's own OAuth flow instead of reporting it `needs-auth`
|
|
632
|
+
* for the whole session.
|
|
633
|
+
*
|
|
634
|
+
* **Off by default, and deliberately.** You authenticated that server to
|
|
635
|
+
* opencode; this copies the token into the private config file the plugin
|
|
636
|
+
* writes for a second program, which then lets a model drive calls with it.
|
|
637
|
+
* That is your decision rather than a default. Nothing is read from
|
|
638
|
+
* opencode's credential store unless this is `true`.
|
|
639
|
+
*
|
|
640
|
+
* opencode 1 only: opencode 2 keeps MCP credentials in its database behind
|
|
641
|
+
* a typed plugin domain rather than in the `mcp-auth.json` file this reads,
|
|
642
|
+
* so the option finds nothing there. A server with no usable token is
|
|
643
|
+
* bridged exactly as it is today, never dropped, and an `Authorization`
|
|
644
|
+
* header you set yourself always wins.
|
|
645
|
+
*/
|
|
646
|
+
bridgeMcpOauthTokens?: boolean;
|
|
589
647
|
/**
|
|
590
648
|
* Behavior for Claude CLI `control_request` permission checks
|
|
591
649
|
* (`subtype: can_use_tool`) when `skipPermissions` is false.
|
|
@@ -1388,6 +1446,17 @@ declare class ClaudeCodeLanguageModel implements LanguageModelV3 {
|
|
|
1388
1446
|
}
|
|
1389
1447
|
|
|
1390
1448
|
type McpHostApi = "v1" | "v2";
|
|
1449
|
+
/**
|
|
1450
|
+
* How a bridge call reaches opencode's MCP OAuth store.
|
|
1451
|
+
*
|
|
1452
|
+
* `oauthTokens` is the `bridgeMcpOauthTokens` provider option and is false
|
|
1453
|
+
* unless the operator set it. `stateDir` exists so a spec can point the read
|
|
1454
|
+
* at a scratch directory; production callers never pass it.
|
|
1455
|
+
*/
|
|
1456
|
+
interface McpBridgeAuthOptions {
|
|
1457
|
+
oauthTokens?: boolean;
|
|
1458
|
+
stateDir?: string;
|
|
1459
|
+
}
|
|
1391
1460
|
interface BridgedMcp {
|
|
1392
1461
|
/** Path to the temp file containing the translated `--mcp-config`. */
|
|
1393
1462
|
path: string;
|
|
@@ -1429,8 +1498,12 @@ type RuntimeMcpStatus = Record<string, string>;
|
|
|
1429
1498
|
* translate each server to Claude CLI format, write a scratch file, and
|
|
1430
1499
|
* return its path + a stable hash. Returns null when no enabled MCP servers
|
|
1431
1500
|
* remain after the merge + overlay.
|
|
1501
|
+
*
|
|
1502
|
+
* @param stateDir Override the opencode state directory (`~/.local/share/opencode`
|
|
1503
|
+
* by default) where `mcp-auth.json` is read from. Exposed for
|
|
1504
|
+
* testing; production callers should omit it.
|
|
1432
1505
|
*/
|
|
1433
|
-
declare function bridgeOpencodeMcp(cwd: string, runtimeStatus?: RuntimeMcpStatus, excludeServers?: ReadonlySet<string>, hostApi?: McpHostApi): BridgedMcp | null;
|
|
1506
|
+
declare function bridgeOpencodeMcp(cwd: string, runtimeStatus?: RuntimeMcpStatus, excludeServers?: ReadonlySet<string>, hostApi?: McpHostApi, auth?: McpBridgeAuthOptions): BridgedMcp | null;
|
|
1434
1507
|
|
|
1435
1508
|
type AgentRecord = {
|
|
1436
1509
|
mode?: string;
|