@serkanalgur/opencode-nexus 1.2.5 → 1.2.7

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 +16 -34
  2. package/dist/tui.js +14 -32
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8559,14 +8559,22 @@ class NexusConfigManager {
8559
8559
  }
8560
8560
  saveProjectConfig(basePath) {
8561
8561
  const projectPath = join(basePath, ".opencode", "nexus.jsonc");
8562
- const config = this.getNonDefaultConfig();
8562
+ const config = this.getSaveableConfig();
8563
8563
  this.writeJsoncFile(projectPath, config);
8564
8564
  }
8565
8565
  saveGlobalConfig() {
8566
8566
  const globalPath = join(homedir(), ".config", "opencode", "nexus.jsonc");
8567
- const config = this.getNonDefaultConfig();
8567
+ const config = this.getSaveableConfig();
8568
8568
  this.writeJsoncFile(globalPath, config);
8569
8569
  }
8570
+ initProjectConfig(basePath) {
8571
+ const projectPath = join(basePath, ".opencode", "nexus.jsonc");
8572
+ this.writeJsoncFile(projectPath, { ...DEFAULT_CONFIG });
8573
+ }
8574
+ initGlobalConfig() {
8575
+ const globalPath = join(homedir(), ".config", "opencode", "nexus.jsonc");
8576
+ this.writeJsoncFile(globalPath, { ...DEFAULT_CONFIG });
8577
+ }
8570
8578
  saveConfig(level, basePath) {
8571
8579
  if (level === "project") {
8572
8580
  this.saveProjectConfig(basePath || process.cwd());
@@ -8574,38 +8582,12 @@ class NexusConfigManager {
8574
8582
  this.saveGlobalConfig();
8575
8583
  }
8576
8584
  }
8577
- getNonDefaultConfig() {
8585
+ getSaveableConfig() {
8578
8586
  const current = this.getConfig();
8579
8587
  const result = {};
8580
- const models = {};
8581
- for (const role of this.getRoles()) {
8582
- if (current.models[role] !== DEFAULT_CONFIG.models[role]) {
8583
- models[role] = current.models[role];
8584
- }
8585
- }
8586
- if (Object.keys(models).length > 0) {
8587
- result.models = models;
8588
- }
8589
- const budget = {};
8590
- const budgetKeys = ["maxTotalCost", "maxCostPerTask", "maxCostPerAgent", "alertThreshold"];
8591
- for (const key of budgetKeys) {
8592
- if (current.budget[key] !== DEFAULT_CONFIG.budget[key]) {
8593
- budget[key] = current.budget[key];
8594
- }
8595
- }
8596
- if (Object.keys(budget).length > 0) {
8597
- result.budget = budget;
8598
- }
8599
- const selfHealing = {};
8600
- const shKeys = ["enabled", "maxRetries", "contextTransfer"];
8601
- for (const key of shKeys) {
8602
- if (current.selfHealing[key] !== DEFAULT_CONFIG.selfHealing[key]) {
8603
- selfHealing[key] = current.selfHealing[key];
8604
- }
8605
- }
8606
- if (Object.keys(selfHealing).length > 0) {
8607
- result.selfHealing = selfHealing;
8608
- }
8588
+ result.models = { ...current.models };
8589
+ result.budget = { ...current.budget };
8590
+ result.selfHealing = { ...current.selfHealing };
8609
8591
  return result;
8610
8592
  }
8611
8593
  resetToDefaults() {
@@ -10862,11 +10844,11 @@ var src_default = define({
10862
10844
  const path = basePath || process.cwd();
10863
10845
  const locations = [];
10864
10846
  if (level === "project" || level === "both") {
10865
- orchestrator.configManager.saveProjectConfig(path);
10847
+ orchestrator.configManager.initProjectConfig(path);
10866
10848
  locations.push(`${path}/.opencode/nexus.jsonc`);
10867
10849
  }
10868
10850
  if (level === "global" || level === "both") {
10869
- orchestrator.configManager.saveGlobalConfig();
10851
+ orchestrator.configManager.initGlobalConfig();
10870
10852
  locations.push("~/.config/opencode/nexus.jsonc");
10871
10853
  }
10872
10854
  return { content: `Config initialized at ${level} level(s): ${locations.join(", ")}` };
package/dist/tui.js CHANGED
@@ -302,14 +302,22 @@ class NexusConfigManager {
302
302
  }
303
303
  saveProjectConfig(basePath) {
304
304
  const projectPath = join(basePath, ".opencode", "nexus.jsonc");
305
- const config = this.getNonDefaultConfig();
305
+ const config = this.getSaveableConfig();
306
306
  this.writeJsoncFile(projectPath, config);
307
307
  }
308
308
  saveGlobalConfig() {
309
309
  const globalPath = join(homedir(), ".config", "opencode", "nexus.jsonc");
310
- const config = this.getNonDefaultConfig();
310
+ const config = this.getSaveableConfig();
311
311
  this.writeJsoncFile(globalPath, config);
312
312
  }
313
+ initProjectConfig(basePath) {
314
+ const projectPath = join(basePath, ".opencode", "nexus.jsonc");
315
+ this.writeJsoncFile(projectPath, { ...DEFAULT_CONFIG });
316
+ }
317
+ initGlobalConfig() {
318
+ const globalPath = join(homedir(), ".config", "opencode", "nexus.jsonc");
319
+ this.writeJsoncFile(globalPath, { ...DEFAULT_CONFIG });
320
+ }
313
321
  saveConfig(level, basePath) {
314
322
  if (level === "project") {
315
323
  this.saveProjectConfig(basePath || process.cwd());
@@ -317,38 +325,12 @@ class NexusConfigManager {
317
325
  this.saveGlobalConfig();
318
326
  }
319
327
  }
320
- getNonDefaultConfig() {
328
+ getSaveableConfig() {
321
329
  const current = this.getConfig();
322
330
  const result = {};
323
- const models = {};
324
- for (const role of this.getRoles()) {
325
- if (current.models[role] !== DEFAULT_CONFIG.models[role]) {
326
- models[role] = current.models[role];
327
- }
328
- }
329
- if (Object.keys(models).length > 0) {
330
- result.models = models;
331
- }
332
- const budget = {};
333
- const budgetKeys = ["maxTotalCost", "maxCostPerTask", "maxCostPerAgent", "alertThreshold"];
334
- for (const key of budgetKeys) {
335
- if (current.budget[key] !== DEFAULT_CONFIG.budget[key]) {
336
- budget[key] = current.budget[key];
337
- }
338
- }
339
- if (Object.keys(budget).length > 0) {
340
- result.budget = budget;
341
- }
342
- const selfHealing = {};
343
- const shKeys = ["enabled", "maxRetries", "contextTransfer"];
344
- for (const key of shKeys) {
345
- if (current.selfHealing[key] !== DEFAULT_CONFIG.selfHealing[key]) {
346
- selfHealing[key] = current.selfHealing[key];
347
- }
348
- }
349
- if (Object.keys(selfHealing).length > 0) {
350
- result.selfHealing = selfHealing;
351
- }
331
+ result.models = { ...current.models };
332
+ result.budget = { ...current.budget };
333
+ result.selfHealing = { ...current.selfHealing };
352
334
  return result;
353
335
  }
354
336
  resetToDefaults() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serkanalgur/opencode-nexus",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "Adaptive Multi-Agent Orchestration with Cost Intelligence for OpenCode V2",
5
5
  "keywords": [
6
6
  "opencode",