@khalilgharbaoui/opencode-claude-code-plugin 0.6.2 → 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/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
@@ -4559,22 +4559,6 @@ function cleanProviderOptions(options = {}) {
4559
4559
  delete result.accounts;
4560
4560
  return result;
4561
4561
  }
4562
- function mergeDefaultVariants(models = {}) {
4563
- const result = { ...models };
4564
- for (const [id, model] of Object.entries(defaultModels)) {
4565
- if (!model.variants) continue;
4566
- const existing = result[id] && typeof result[id] === "object" ? result[id] : {};
4567
- const variants = existing.variants && typeof existing.variants === "object" ? existing.variants : {};
4568
- result[id] = {
4569
- ...existing,
4570
- variants: {
4571
- ...model.variants,
4572
- ...variants
4573
- }
4574
- };
4575
- }
4576
- return result;
4577
- }
4578
4562
  function defaultModelsForProvider(providerModels, providerID = PROVIDER_ID2, modelSuffix) {
4579
4563
  const models = Object.fromEntries(
4580
4564
  Object.entries(defaultModels).map(([id, model]) => {
@@ -4611,6 +4595,7 @@ function configModelsForProvider(providerModels, providerID, modelSuffix) {
4611
4595
  for (const [id, model] of Object.entries(defaultModels)) {
4612
4596
  const modelId = modelSuffix ? `${id}@${modelSuffix}` : id;
4613
4597
  const existing = providerModels[id] ?? providerModels[modelId];
4598
+ const existingVariants = existing && typeof existing.variants === "object" ? existing.variants ?? {} : {};
4614
4599
  const full = {
4615
4600
  ...model,
4616
4601
  id: modelId,
@@ -4620,6 +4605,10 @@ function configModelsForProvider(providerModels, providerID, modelSuffix) {
4620
4605
  id: modelId,
4621
4606
  npm: existing?.api?.npm ?? model.api.npm,
4622
4607
  url: existing?.api?.url ?? model.api.url
4608
+ },
4609
+ variants: {
4610
+ ...model.variants ?? {},
4611
+ ...existingVariants
4623
4612
  }
4624
4613
  };
4625
4614
  models[modelId] = toConfigModel(full);
@@ -4648,8 +4637,10 @@ async function providerConfig(existing, providerID = PROVIDER_ID2, optionDefault
4648
4637
  options: {
4649
4638
  ...mergedOptions,
4650
4639
  ...runtime
4651
- },
4652
- 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).
4653
4644
  };
4654
4645
  }
4655
4646
  async function expandAccountProviders(config) {
@@ -4717,7 +4708,11 @@ var server = async (input) => {
4717
4708
  const existing = config.provider[PROVIDER_ID2];
4718
4709
  config.provider[PROVIDER_ID2] = {
4719
4710
  ...existing,
4720
- ...await providerConfig(existing)
4711
+ ...await providerConfig(existing),
4712
+ models: configModelsForProvider(
4713
+ existing?.models ?? {},
4714
+ PROVIDER_ID2
4715
+ )
4721
4716
  };
4722
4717
  log.notice("registered claude-code provider", {
4723
4718
  id: PROVIDER_ID2,
@@ -4768,6 +4763,7 @@ var index_default = {
4768
4763
  export {
4769
4764
  ClaudeCodeLanguageModel,
4770
4765
  bridgeOpencodeMcp,
4766
+ configModelsForProvider,
4771
4767
  createClaudeCode,
4772
4768
  index_default as default,
4773
4769
  defaultModels