@serkanalgur/opencode-nexus 2.3.3 → 2.3.5

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.
Files changed (3) hide show
  1. package/dist/index.js +25 -4
  2. package/dist/tui.js +46 -34018
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8486,7 +8486,11 @@ class NexusConfigManager {
8486
8486
  }
8487
8487
  getModelForRole(role) {
8488
8488
  const config = this.getConfig();
8489
- return config.models[role] || config.models.coder || DEFAULT_CONFIG.models.coder;
8489
+ const model = config.models[role] || config.models.coder || DEFAULT_CONFIG.models.coder;
8490
+ if (!model.includes("/")) {
8491
+ console.warn(`[nexus] Model "${model}" for role "${role}" is missing provider prefix. Expected "providerID/modelID" format.`);
8492
+ }
8493
+ return model;
8490
8494
  }
8491
8495
  updateStorageConfig(update) {
8492
8496
  this.storageConfig = {
@@ -8570,10 +8574,18 @@ class NexusConfigManager {
8570
8574
  }
8571
8575
  initProjectConfig(basePath) {
8572
8576
  const projectPath = join(basePath, ".opencode", "nexus.jsonc");
8577
+ try {
8578
+ readFileSync(projectPath, "utf-8");
8579
+ return;
8580
+ } catch {}
8573
8581
  this.writeJsoncFile(projectPath, { ...DEFAULT_CONFIG });
8574
8582
  }
8575
8583
  initGlobalConfig() {
8576
8584
  const globalPath = join(homedir(), ".config", "opencode", "nexus.jsonc");
8585
+ try {
8586
+ readFileSync(globalPath, "utf-8");
8587
+ return;
8588
+ } catch {}
8577
8589
  this.writeJsoncFile(globalPath, { ...DEFAULT_CONFIG });
8578
8590
  }
8579
8591
  saveConfig(level, basePath) {
@@ -10765,10 +10777,19 @@ Please continue from where the previous agent left off.`;
10765
10777
  throw new Error("Budget exceeded — cannot spawn new agents");
10766
10778
  }
10767
10779
  const agentId = `agent-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
10768
- const modelConfig = config.model || this.configManager.getModelForRole(config.role);
10780
+ let modelConfig = config.model || this.configManager.getModelForRole(config.role);
10781
+ if (!modelConfig.includes("/")) {
10782
+ const allModels = this.configManager.getConfig().models;
10783
+ const match = Object.values(allModels).find((m) => m?.split("/")[1] === modelConfig);
10784
+ if (match) {
10785
+ modelConfig = match;
10786
+ } else {
10787
+ throw new Error(`Invalid model "${config.model}". Use "providerID/modelID" format (e.g. "opencode-go/mimo-v2.5")`);
10788
+ }
10789
+ }
10769
10790
  const slashIndex = modelConfig.indexOf("/");
10770
- const provider = slashIndex > -1 ? modelConfig.slice(0, slashIndex) : modelConfig;
10771
- const modelName = slashIndex > -1 ? modelConfig.slice(slashIndex + 1) : modelConfig;
10791
+ const provider = modelConfig.slice(0, slashIndex);
10792
+ const modelName = modelConfig.slice(slashIndex + 1);
10772
10793
  const roleEmoji = this.configManager.getRoleEmoji(config.role);
10773
10794
  const title = `${roleEmoji} ${this.configManager.getRoleDisplayName(config.role)} — ${modelConfig}`;
10774
10795
  const agentTypeMap = {