@serkanalgur/opencode-nexus 2.3.4 → 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.
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 = {
package/dist/tui.js CHANGED
@@ -129,7 +129,11 @@ class NexusConfigManager {
129
129
  }
130
130
  getModelForRole(role) {
131
131
  const config = this.getConfig();
132
- return config.models[role] || config.models.coder || DEFAULT_CONFIG.models.coder;
132
+ const model = config.models[role] || config.models.coder || DEFAULT_CONFIG.models.coder;
133
+ if (!model.includes("/")) {
134
+ console.warn(`[nexus] Model "${model}" for role "${role}" is missing provider prefix. Expected "providerID/modelID" format.`);
135
+ }
136
+ return model;
133
137
  }
134
138
  updateStorageConfig(update) {
135
139
  this.storageConfig = {
@@ -213,10 +217,18 @@ class NexusConfigManager {
213
217
  }
214
218
  initProjectConfig(basePath) {
215
219
  const projectPath = join(basePath, ".opencode", "nexus.jsonc");
220
+ try {
221
+ readFileSync(projectPath, "utf-8");
222
+ return;
223
+ } catch {}
216
224
  this.writeJsoncFile(projectPath, { ...DEFAULT_CONFIG });
217
225
  }
218
226
  initGlobalConfig() {
219
227
  const globalPath = join(homedir(), ".config", "opencode", "nexus.jsonc");
228
+ try {
229
+ readFileSync(globalPath, "utf-8");
230
+ return;
231
+ } catch {}
220
232
  this.writeJsoncFile(globalPath, { ...DEFAULT_CONFIG });
221
233
  }
222
234
  saveConfig(level, basePath) {
@@ -382,6 +394,12 @@ var tui_default = define({
382
394
  id: "nexus.cli",
383
395
  setup(context) {
384
396
  const configManager = new NexusConfigManager;
397
+ try {
398
+ const loc = context.location ?? context.data.location.default();
399
+ if (loc?.directory) {
400
+ configManager.loadFromPath(loc.directory);
401
+ }
402
+ } catch {}
385
403
  let configSaveScope = "global";
386
404
  const handleModelSelect = async (role) => {
387
405
  if (!configManager.getRoles().includes(role)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serkanalgur/opencode-nexus",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "description": "Adaptive Multi-Agent Orchestration with Cost Intelligence for OpenCode V2",
5
5
  "keywords": [
6
6
  "opencode",