@khalilgharbaoui/opencode-claude-code-plugin 0.5.1 → 0.6.3

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
@@ -23,7 +23,7 @@ claude --version
23
23
 
24
24
  That's it. Restart opencode, pick a `claude-code` model, done.
25
25
 
26
- The plugin self-registers the `claude-code` provider, all current Claude Code models (Haiku 4.5, Sonnet 4.5/4.6, Opus 4.5/4.6/4.7) with reasoning variants (`low` / `medium` / `high` / `xhigh` / `max`), and sensible defaults for tool proxying. You don't need to write a `provider` block at all unless you want to override something.
26
+ The plugin self-registers the `claude-code` provider, all current Claude Code models (Haiku 4.5, Sonnet 4.5/4.6, Opus 4.5/4.6/4.7/4.8) with reasoning variants (`low` / `medium` / `high` / `xhigh` / `max`), and sensible defaults for tool proxying. You don't need to write a `provider` block at all unless you want to override something.
27
27
 
28
28
  ---
29
29
 
@@ -74,6 +74,7 @@ The plugin auto-registers the following. They appear in the model picker without
74
74
  | `claude-opus-4-5` | Claude Code Opus 4.5 | 1M | 16,384 | low/medium/high/xhigh/max |
75
75
  | `claude-opus-4-6` | Claude Code Opus 4.6 | 1M | 16,384 | low/medium/high/xhigh/max |
76
76
  | `claude-opus-4-7` | Claude Code Opus 4.7 | 1M | 16,384 | low/medium/high/xhigh/max |
77
+ | `claude-opus-4-8` | Claude Code Opus 4.8 | 1M | 16,384 | low/medium/high/xhigh/max |
77
78
 
78
79
  Capabilities for every model: text + image input, text output, tool use, attachments. No temperature control, no PDF/audio/video, no interleaved streaming.
79
80
 
@@ -456,6 +457,24 @@ doesn't accrete a log file on every user's disk by default — opt in when
456
457
  you need to inspect auto-continue decisions, broker state, or other
457
458
  plugin internals.
458
459
 
460
+ ## Compatibility with other opencode plugins
461
+
462
+ ### [opencode-dcp](https://github.com/Opencode-DCP/opencode-dynamic-context-pruning) (Dynamic Context Pruning)
463
+
464
+ Partial support since v0.5.1. DCP runs in a useful degraded mode: automatic strategies and slash commands work, autonomous model-driven compression does not.
465
+
466
+ | DCP feature | Status | Notes |
467
+ |---|---|---|
468
+ | `experimental.chat.messages.transform` (compression placeholders, dedup, error purge) | ✅ Works | Transforms run inside opencode before reaching this plugin. |
469
+ | `experimental.chat.system.transform` (context-limit nudges, iteration reminders) | ✅ Works | `extractSystemMessages` forwards system-role content to Claude CLI via `--append-system-prompt-file`. |
470
+ | `/dcp compress`, `/dcp sweep`, `/dcp manual`, `/dcp context`, `/dcp stats` slash commands | ✅ Works | Handled by opencode's `command.execute.before` hook, not the model. |
471
+ | Automatic `deduplication` + `purgeErrors` strategies | ✅ Works | Message-transform only, no model tool calls. |
472
+ | Autonomous model-driven `compress` tool calls | ❌ Not supported | DCP registers `compress` as an opencode-native tool. Claude CLI only sees its own built-ins and MCP-bridged servers, so the model never sees `compress`. The plugin prepends a runtime note instructing Claude to ignore any system instruction that asks it to call `compress`/`distill`/`prune`. |
473
+
474
+ Workaround for autonomous compression: trigger it manually with `/dcp compress` whenever you'd want the model to call it. Full autonomous support would require exposing `compress` as an MCP-bridged tool, which is upstream of this plugin.
475
+
476
+ ---
477
+
459
478
  ## Known limitations
460
479
 
461
480
  - No streaming of tool inputs as they're being constructed (Anthropic's `input_json_delta`); the plugin emits them once complete.
package/dist/index.d.ts CHANGED
@@ -542,9 +542,15 @@ interface ClaudeCodeProvider {
542
542
  languageModel(modelId: string): LanguageModelV3;
543
543
  }
544
544
  declare function createClaudeCode(settings?: ClaudeCodeProviderSettings): ClaudeCodeProvider;
545
+ /**
546
+ * Build models in OpenCode's config schema format (flat properties like
547
+ * `temperature`, `reasoning`, `cost.cache_read`, `modalities`, etc.)
548
+ * so the config-path provider loader parses them correctly.
549
+ */
550
+ declare function configModelsForProvider(providerModels: OpenCodeProvider["models"], providerID: string, modelSuffix?: string): Record<string, Record<string, unknown>>;
545
551
  declare const _default: {
546
552
  id: string;
547
553
  server: OpenCodePlugin;
548
554
  };
549
555
 
550
- export { type ClaudeCodeConfig, ClaudeCodeLanguageModel, type ClaudeCodeProvider, type ClaudeCodeProviderSettings, type ClaudeStreamMessage, type OpenCodeHooks, type OpenCodeModel, type OpenCodePlugin, bridgeOpencodeMcp, createClaudeCode, _default as default, defaultModels };
556
+ export { type ClaudeCodeConfig, ClaudeCodeLanguageModel, type ClaudeCodeProvider, type ClaudeCodeProviderSettings, type ClaudeStreamMessage, type OpenCodeHooks, type OpenCodeModel, type OpenCodePlugin, bridgeOpencodeMcp, configModelsForProvider, createClaudeCode, _default as default, defaultModels };
package/dist/index.js CHANGED
@@ -4231,6 +4231,16 @@ var defaultModels = {
4231
4231
  output: 16384,
4232
4232
  cost: opusCost,
4233
4233
  releaseDate: "2025-07-16"
4234
+ }),
4235
+ "claude-opus-4-8": defineModel({
4236
+ id: "claude-opus-4-8",
4237
+ name: "Claude Opus 4.8",
4238
+ family: "opus",
4239
+ reasoning: true,
4240
+ context: 1e6,
4241
+ output: 16384,
4242
+ cost: opusCost,
4243
+ releaseDate: "2026-05-28"
4234
4244
  })
4235
4245
  };
4236
4246
 
@@ -4549,22 +4559,6 @@ function cleanProviderOptions(options = {}) {
4549
4559
  delete result.accounts;
4550
4560
  return result;
4551
4561
  }
4552
- function mergeDefaultVariants(models = {}) {
4553
- const result = { ...models };
4554
- for (const [id, model] of Object.entries(defaultModels)) {
4555
- if (!model.variants) continue;
4556
- const existing = result[id] && typeof result[id] === "object" ? result[id] : {};
4557
- const variants = existing.variants && typeof existing.variants === "object" ? existing.variants : {};
4558
- result[id] = {
4559
- ...existing,
4560
- variants: {
4561
- ...model.variants,
4562
- ...variants
4563
- }
4564
- };
4565
- }
4566
- return result;
4567
- }
4568
4562
  function defaultModelsForProvider(providerModels, providerID = PROVIDER_ID2, modelSuffix) {
4569
4563
  const models = Object.fromEntries(
4570
4564
  Object.entries(defaultModels).map(([id, model]) => {
@@ -4601,6 +4595,7 @@ function configModelsForProvider(providerModels, providerID, modelSuffix) {
4601
4595
  for (const [id, model] of Object.entries(defaultModels)) {
4602
4596
  const modelId = modelSuffix ? `${id}@${modelSuffix}` : id;
4603
4597
  const existing = providerModels[id] ?? providerModels[modelId];
4598
+ const existingVariants = existing && typeof existing.variants === "object" ? existing.variants ?? {} : {};
4604
4599
  const full = {
4605
4600
  ...model,
4606
4601
  id: modelId,
@@ -4610,6 +4605,10 @@ function configModelsForProvider(providerModels, providerID, modelSuffix) {
4610
4605
  id: modelId,
4611
4606
  npm: existing?.api?.npm ?? model.api.npm,
4612
4607
  url: existing?.api?.url ?? model.api.url
4608
+ },
4609
+ variants: {
4610
+ ...model.variants ?? {},
4611
+ ...existingVariants
4613
4612
  }
4614
4613
  };
4615
4614
  models[modelId] = toConfigModel(full);
@@ -4638,8 +4637,10 @@ async function providerConfig(existing, providerID = PROVIDER_ID2, optionDefault
4638
4637
  options: {
4639
4638
  ...mergedOptions,
4640
4639
  ...runtime
4641
- },
4642
- models: mergeDefaultVariants(existing?.models)
4640
+ }
4641
+ // models is intentionally omitted: both callers overwrite it with
4642
+ // configModelsForProvider(), which emits the flat config schema
4643
+ // opencode's config-path loader parses (and merges user variants).
4643
4644
  };
4644
4645
  }
4645
4646
  async function expandAccountProviders(config) {
@@ -4707,7 +4708,11 @@ var server = async (input) => {
4707
4708
  const existing = config.provider[PROVIDER_ID2];
4708
4709
  config.provider[PROVIDER_ID2] = {
4709
4710
  ...existing,
4710
- ...await providerConfig(existing)
4711
+ ...await providerConfig(existing),
4712
+ models: configModelsForProvider(
4713
+ existing?.models ?? {},
4714
+ PROVIDER_ID2
4715
+ )
4711
4716
  };
4712
4717
  log.notice("registered claude-code provider", {
4713
4718
  id: PROVIDER_ID2,
@@ -4758,6 +4763,7 @@ var index_default = {
4758
4763
  export {
4759
4764
  ClaudeCodeLanguageModel,
4760
4765
  bridgeOpencodeMcp,
4766
+ configModelsForProvider,
4761
4767
  createClaudeCode,
4762
4768
  index_default as default,
4763
4769
  defaultModels