zenox 1.1.1 → 1.1.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.
Files changed (2) hide show
  1. package/dist/cli/index.js +29 -13
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -3255,7 +3255,7 @@ async function createDefaultConfig(configPath) {
3255
3255
 
3256
3256
  // src/cli/zenox-config.ts
3257
3257
  import { existsSync as existsSync2 } from "node:fs";
3258
- import { readFile as readFile2, writeFile as writeFile2, mkdir } from "node:fs/promises";
3258
+ import { readFile as readFile2, writeFile as writeFile2, mkdir, unlink } from "node:fs/promises";
3259
3259
  import { join as join2, dirname } from "node:path";
3260
3260
  import { homedir as homedir2 } from "node:os";
3261
3261
  function getZenoxConfigPath() {
@@ -3283,12 +3283,24 @@ async function writeZenoxConfig(config) {
3283
3283
  }
3284
3284
  async function updateAgentModels(models) {
3285
3285
  const existing = await readZenoxConfig() ?? {};
3286
- const agents = { ...existing.agents };
3286
+ const configPath = getZenoxConfigPath();
3287
+ const agents = {};
3287
3288
  for (const [agent, model] of Object.entries(models)) {
3288
3289
  if (model) {
3289
3290
  agents[agent] = { model };
3290
3291
  }
3291
3292
  }
3293
+ if (Object.keys(agents).length === 0) {
3294
+ const { agents: _3, ...rest } = existing;
3295
+ if (Object.keys(rest).length === 0) {
3296
+ if (existsSync2(configPath)) {
3297
+ await unlink(configPath);
3298
+ }
3299
+ return;
3300
+ }
3301
+ await writeZenoxConfig(rest);
3302
+ return;
3303
+ }
3292
3304
  await writeZenoxConfig({
3293
3305
  ...existing,
3294
3306
  agents
@@ -3310,9 +3322,13 @@ function getDisabledMcps(config) {
3310
3322
  }
3311
3323
  async function updateDisabledMcps(disabledMcps) {
3312
3324
  const existing = await readZenoxConfig() ?? {};
3325
+ const configPath = getZenoxConfigPath();
3313
3326
  if (disabledMcps.length === 0) {
3314
3327
  const { disabled_mcps: _3, ...rest } = existing;
3315
3328
  if (Object.keys(rest).length === 0) {
3329
+ if (existsSync2(configPath)) {
3330
+ await unlink(configPath);
3331
+ }
3316
3332
  return;
3317
3333
  }
3318
3334
  await writeZenoxConfig(rest);
@@ -3744,19 +3760,19 @@ async function runConfig() {
3744
3760
  finalModels[agent] = model;
3745
3761
  }
3746
3762
  }
3747
- if (Object.keys(finalModels).length > 0) {
3748
- const spinner = Y2();
3749
- spinner.start("Saving model configuration");
3750
- try {
3751
- await updateAgentModels(finalModels);
3763
+ const spinner = Y2();
3764
+ spinner.start("Saving model configuration");
3765
+ try {
3766
+ await updateAgentModels(finalModels);
3767
+ if (Object.keys(finalModels).length > 0) {
3752
3768
  spinner.stop(`Updated ${getZenoxConfigPath()}`);
3753
- } catch (err) {
3754
- spinner.stop("Failed to save config");
3755
- M2.error(err instanceof Error ? err.message : "Unknown error");
3756
- process.exit(1);
3769
+ } else {
3770
+ spinner.stop("All agents using default models");
3757
3771
  }
3758
- } else {
3759
- M2.info("All agents using default models - zenox.json not needed");
3772
+ } catch (err) {
3773
+ spinner.stop("Failed to save config");
3774
+ M2.error(err instanceof Error ? err.message : "Unknown error");
3775
+ process.exit(1);
3760
3776
  }
3761
3777
  Se(import_picocolors6.default.green("Configuration updated!"));
3762
3778
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zenox",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "OpenCode plugin with specialized agents (explorer, librarian, oracle, ui-planner), background tasks for parallel execution, and smart orchestration",
5
5
  "author": "Ayush",
6
6
  "license": "MIT",