@kryvenaiofficial/kryven 0.2.5 → 0.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 (2) hide show
  1. package/dist/cli.mjs +1545 -685
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1162,8 +1162,8 @@ var require_command = __commonJS({
1162
1162
  "node_modules/commander/lib/command.js"(exports) {
1163
1163
  var EventEmitter6 = __require("node:events").EventEmitter;
1164
1164
  var childProcess = __require("node:child_process");
1165
- var path9 = __require("node:path");
1166
- var fs5 = __require("node:fs");
1165
+ var path11 = __require("node:path");
1166
+ var fs7 = __require("node:fs");
1167
1167
  var process21 = __require("node:process");
1168
1168
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1169
1169
  var { CommanderError: CommanderError2 } = require_error();
@@ -2144,7 +2144,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2144
2144
  * @param {string} subcommandName
2145
2145
  */
2146
2146
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
2147
- if (fs5.existsSync(executableFile)) return;
2147
+ if (fs7.existsSync(executableFile)) return;
2148
2148
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
2149
2149
  const executableMissing = `'${executableFile}' does not exist
2150
2150
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
@@ -2162,11 +2162,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2162
2162
  let launchWithNode = false;
2163
2163
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2164
2164
  function findFile(baseDir, baseName) {
2165
- const localBin = path9.resolve(baseDir, baseName);
2166
- if (fs5.existsSync(localBin)) return localBin;
2167
- if (sourceExt.includes(path9.extname(baseName))) return void 0;
2165
+ const localBin = path11.resolve(baseDir, baseName);
2166
+ if (fs7.existsSync(localBin)) return localBin;
2167
+ if (sourceExt.includes(path11.extname(baseName))) return void 0;
2168
2168
  const foundExt = sourceExt.find(
2169
- (ext) => fs5.existsSync(`${localBin}${ext}`)
2169
+ (ext) => fs7.existsSync(`${localBin}${ext}`)
2170
2170
  );
2171
2171
  if (foundExt) return `${localBin}${foundExt}`;
2172
2172
  return void 0;
@@ -2178,21 +2178,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
2178
2178
  if (this._scriptPath) {
2179
2179
  let resolvedScriptPath;
2180
2180
  try {
2181
- resolvedScriptPath = fs5.realpathSync(this._scriptPath);
2181
+ resolvedScriptPath = fs7.realpathSync(this._scriptPath);
2182
2182
  } catch {
2183
2183
  resolvedScriptPath = this._scriptPath;
2184
2184
  }
2185
- executableDir = path9.resolve(
2186
- path9.dirname(resolvedScriptPath),
2185
+ executableDir = path11.resolve(
2186
+ path11.dirname(resolvedScriptPath),
2187
2187
  executableDir
2188
2188
  );
2189
2189
  }
2190
2190
  if (executableDir) {
2191
2191
  let localFile = findFile(executableDir, executableFile);
2192
2192
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2193
- const legacyName = path9.basename(
2193
+ const legacyName = path11.basename(
2194
2194
  this._scriptPath,
2195
- path9.extname(this._scriptPath)
2195
+ path11.extname(this._scriptPath)
2196
2196
  );
2197
2197
  if (legacyName !== this._name) {
2198
2198
  localFile = findFile(
@@ -2203,7 +2203,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2203
2203
  }
2204
2204
  executableFile = localFile || executableFile;
2205
2205
  }
2206
- launchWithNode = sourceExt.includes(path9.extname(executableFile));
2206
+ launchWithNode = sourceExt.includes(path11.extname(executableFile));
2207
2207
  let proc;
2208
2208
  if (process21.platform !== "win32") {
2209
2209
  if (launchWithNode) {
@@ -3050,7 +3050,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3050
3050
  * @return {Command}
3051
3051
  */
3052
3052
  nameFromFilename(filename) {
3053
- this._name = path9.basename(filename, path9.extname(filename));
3053
+ this._name = path11.basename(filename, path11.extname(filename));
3054
3054
  return this;
3055
3055
  }
3056
3056
  /**
@@ -3064,9 +3064,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3064
3064
  * @param {string} [path]
3065
3065
  * @return {(string|null|Command)}
3066
3066
  */
3067
- executableDir(path10) {
3068
- if (path10 === void 0) return this._executableDir;
3069
- this._executableDir = path10;
3067
+ executableDir(path12) {
3068
+ if (path12 === void 0) return this._executableDir;
3069
+ this._executableDir = path12;
3070
3070
  return this;
3071
3071
  }
3072
3072
  /**
@@ -3658,7 +3658,7 @@ function getHistoryPath() {
3658
3658
  function getProjectConfigPath(cwd2) {
3659
3659
  return join(cwd2, ".kryven", "settings.json");
3660
3660
  }
3661
- var DEFAULT_BASE_URL, DEFAULT_MODEL, DEFAULT_MOOD;
3661
+ var DEFAULT_BASE_URL, DEFAULT_MODEL, DEFAULT_MOOD, DEFAULT_EFFORT;
3662
3662
  var init_defaults = __esm({
3663
3663
  "src/config/defaults.ts"() {
3664
3664
  "use strict";
@@ -3666,6 +3666,7 @@ var init_defaults = __esm({
3666
3666
  DEFAULT_BASE_URL = "https://kryven.cc";
3667
3667
  DEFAULT_MODEL = "kryven-extended";
3668
3668
  DEFAULT_MOOD = "builder";
3669
+ DEFAULT_EFFORT = "low";
3669
3670
  }
3670
3671
  });
3671
3672
 
@@ -3679,10 +3680,10 @@ function logPath() {
3679
3680
  }
3680
3681
  function writeLine(level, parts) {
3681
3682
  if (!DEBUG) return;
3682
- const path9 = logPath();
3683
- if (!existsSync(dirname(path9))) {
3683
+ const path11 = logPath();
3684
+ if (!existsSync(dirname(path11))) {
3684
3685
  try {
3685
- mkdirSync(dirname(path9), { recursive: true });
3686
+ mkdirSync(dirname(path11), { recursive: true });
3686
3687
  } catch {
3687
3688
  return;
3688
3689
  }
@@ -3690,7 +3691,7 @@ function writeLine(level, parts) {
3690
3691
  const line = `${(/* @__PURE__ */ new Date()).toISOString()} ${level} ${parts.map((p) => typeof p === "string" ? p : JSON.stringify(p)).join(" ")}
3691
3692
  `;
3692
3693
  try {
3693
- appendFileSync(path9, line);
3694
+ appendFileSync(path11, line);
3694
3695
  } catch {
3695
3696
  }
3696
3697
  }
@@ -3790,8 +3791,8 @@ var init_client = __esm({
3790
3791
  ...extra
3791
3792
  };
3792
3793
  }
3793
- async request(path9, init, signal) {
3794
- const url = `${this.baseUrl}${path9}`;
3794
+ async request(path11, init, signal) {
3795
+ const url = `${this.baseUrl}${path11}`;
3795
3796
  logger.debug(
3796
3797
  "request",
3797
3798
  init.method ?? "GET",
@@ -4838,8 +4839,8 @@ var require_windows = __commonJS({
4838
4839
  "node_modules/isexe/windows.js"(exports, module) {
4839
4840
  module.exports = isexe;
4840
4841
  isexe.sync = sync;
4841
- var fs5 = __require("fs");
4842
- function checkPathExt(path9, options) {
4842
+ var fs7 = __require("fs");
4843
+ function checkPathExt(path11, options) {
4843
4844
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
4844
4845
  if (!pathext) {
4845
4846
  return true;
@@ -4850,25 +4851,25 @@ var require_windows = __commonJS({
4850
4851
  }
4851
4852
  for (var i2 = 0; i2 < pathext.length; i2++) {
4852
4853
  var p = pathext[i2].toLowerCase();
4853
- if (p && path9.substr(-p.length).toLowerCase() === p) {
4854
+ if (p && path11.substr(-p.length).toLowerCase() === p) {
4854
4855
  return true;
4855
4856
  }
4856
4857
  }
4857
4858
  return false;
4858
4859
  }
4859
- function checkStat(stat9, path9, options) {
4860
+ function checkStat(stat9, path11, options) {
4860
4861
  if (!stat9.isSymbolicLink() && !stat9.isFile()) {
4861
4862
  return false;
4862
4863
  }
4863
- return checkPathExt(path9, options);
4864
+ return checkPathExt(path11, options);
4864
4865
  }
4865
- function isexe(path9, options, cb) {
4866
- fs5.stat(path9, function(er, stat9) {
4867
- cb(er, er ? false : checkStat(stat9, path9, options));
4866
+ function isexe(path11, options, cb) {
4867
+ fs7.stat(path11, function(er, stat9) {
4868
+ cb(er, er ? false : checkStat(stat9, path11, options));
4868
4869
  });
4869
4870
  }
4870
- function sync(path9, options) {
4871
- return checkStat(fs5.statSync(path9), path9, options);
4871
+ function sync(path11, options) {
4872
+ return checkStat(fs7.statSync(path11), path11, options);
4872
4873
  }
4873
4874
  }
4874
4875
  });
@@ -4878,14 +4879,14 @@ var require_mode = __commonJS({
4878
4879
  "node_modules/isexe/mode.js"(exports, module) {
4879
4880
  module.exports = isexe;
4880
4881
  isexe.sync = sync;
4881
- var fs5 = __require("fs");
4882
- function isexe(path9, options, cb) {
4883
- fs5.stat(path9, function(er, stat9) {
4882
+ var fs7 = __require("fs");
4883
+ function isexe(path11, options, cb) {
4884
+ fs7.stat(path11, function(er, stat9) {
4884
4885
  cb(er, er ? false : checkStat(stat9, options));
4885
4886
  });
4886
4887
  }
4887
- function sync(path9, options) {
4888
- return checkStat(fs5.statSync(path9), options);
4888
+ function sync(path11, options) {
4889
+ return checkStat(fs7.statSync(path11), options);
4889
4890
  }
4890
4891
  function checkStat(stat9, options) {
4891
4892
  return stat9.isFile() && checkMode(stat9, options);
@@ -4909,7 +4910,7 @@ var require_mode = __commonJS({
4909
4910
  // node_modules/isexe/index.js
4910
4911
  var require_isexe = __commonJS({
4911
4912
  "node_modules/isexe/index.js"(exports, module) {
4912
- var fs5 = __require("fs");
4913
+ var fs7 = __require("fs");
4913
4914
  var core;
4914
4915
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
4915
4916
  core = require_windows();
@@ -4918,7 +4919,7 @@ var require_isexe = __commonJS({
4918
4919
  }
4919
4920
  module.exports = isexe;
4920
4921
  isexe.sync = sync;
4921
- function isexe(path9, options, cb) {
4922
+ function isexe(path11, options, cb) {
4922
4923
  if (typeof options === "function") {
4923
4924
  cb = options;
4924
4925
  options = {};
@@ -4928,7 +4929,7 @@ var require_isexe = __commonJS({
4928
4929
  throw new TypeError("callback not provided");
4929
4930
  }
4930
4931
  return new Promise(function(resolve7, reject) {
4931
- isexe(path9, options || {}, function(er, is) {
4932
+ isexe(path11, options || {}, function(er, is) {
4932
4933
  if (er) {
4933
4934
  reject(er);
4934
4935
  } else {
@@ -4937,7 +4938,7 @@ var require_isexe = __commonJS({
4937
4938
  });
4938
4939
  });
4939
4940
  }
4940
- core(path9, options || {}, function(er, is) {
4941
+ core(path11, options || {}, function(er, is) {
4941
4942
  if (er) {
4942
4943
  if (er.code === "EACCES" || options && options.ignoreErrors) {
4943
4944
  er = null;
@@ -4947,9 +4948,9 @@ var require_isexe = __commonJS({
4947
4948
  cb(er, is);
4948
4949
  });
4949
4950
  }
4950
- function sync(path9, options) {
4951
+ function sync(path11, options) {
4951
4952
  try {
4952
- return core.sync(path9, options || {});
4953
+ return core.sync(path11, options || {});
4953
4954
  } catch (er) {
4954
4955
  if (options && options.ignoreErrors || er.code === "EACCES") {
4955
4956
  return false;
@@ -4965,7 +4966,7 @@ var require_isexe = __commonJS({
4965
4966
  var require_which = __commonJS({
4966
4967
  "node_modules/which/which.js"(exports, module) {
4967
4968
  var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
4968
- var path9 = __require("path");
4969
+ var path11 = __require("path");
4969
4970
  var COLON = isWindows3 ? ";" : ":";
4970
4971
  var isexe = require_isexe();
4971
4972
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -5003,7 +5004,7 @@ var require_which = __commonJS({
5003
5004
  return opt.all && found.length ? resolve7(found) : reject(getNotFoundError(cmd));
5004
5005
  const ppRaw = pathEnv[i2];
5005
5006
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
5006
- const pCmd = path9.join(pathPart, cmd);
5007
+ const pCmd = path11.join(pathPart, cmd);
5007
5008
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
5008
5009
  resolve7(subStep(p, i2, 0));
5009
5010
  });
@@ -5030,7 +5031,7 @@ var require_which = __commonJS({
5030
5031
  for (let i2 = 0; i2 < pathEnv.length; i2++) {
5031
5032
  const ppRaw = pathEnv[i2];
5032
5033
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
5033
- const pCmd = path9.join(pathPart, cmd);
5034
+ const pCmd = path11.join(pathPart, cmd);
5034
5035
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
5035
5036
  for (let j = 0; j < pathExt.length; j++) {
5036
5037
  const cur = p + pathExt[j];
@@ -5078,7 +5079,7 @@ var require_path_key = __commonJS({
5078
5079
  var require_resolveCommand = __commonJS({
5079
5080
  "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
5080
5081
  "use strict";
5081
- var path9 = __require("path");
5082
+ var path11 = __require("path");
5082
5083
  var which = require_which();
5083
5084
  var getPathKey = require_path_key();
5084
5085
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -5096,7 +5097,7 @@ var require_resolveCommand = __commonJS({
5096
5097
  try {
5097
5098
  resolved = which.sync(parsed.command, {
5098
5099
  path: env4[getPathKey({ env: env4 })],
5099
- pathExt: withoutPathExt ? path9.delimiter : void 0
5100
+ pathExt: withoutPathExt ? path11.delimiter : void 0
5100
5101
  });
5101
5102
  } catch (e) {
5102
5103
  } finally {
@@ -5105,7 +5106,7 @@ var require_resolveCommand = __commonJS({
5105
5106
  }
5106
5107
  }
5107
5108
  if (resolved) {
5108
- resolved = path9.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
5109
+ resolved = path11.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
5109
5110
  }
5110
5111
  return resolved;
5111
5112
  }
@@ -5159,8 +5160,8 @@ var require_shebang_command = __commonJS({
5159
5160
  if (!match) {
5160
5161
  return null;
5161
5162
  }
5162
- const [path9, argument] = match[0].replace(/#! ?/, "").split(" ");
5163
- const binary = path9.split("/").pop();
5163
+ const [path11, argument] = match[0].replace(/#! ?/, "").split(" ");
5164
+ const binary = path11.split("/").pop();
5164
5165
  if (binary === "env") {
5165
5166
  return argument;
5166
5167
  }
@@ -5173,16 +5174,16 @@ var require_shebang_command = __commonJS({
5173
5174
  var require_readShebang = __commonJS({
5174
5175
  "node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
5175
5176
  "use strict";
5176
- var fs5 = __require("fs");
5177
+ var fs7 = __require("fs");
5177
5178
  var shebangCommand = require_shebang_command();
5178
5179
  function readShebang(command) {
5179
5180
  const size = 150;
5180
5181
  const buffer = Buffer.alloc(size);
5181
5182
  let fd;
5182
5183
  try {
5183
- fd = fs5.openSync(command, "r");
5184
- fs5.readSync(fd, buffer, 0, size, 0);
5185
- fs5.closeSync(fd);
5184
+ fd = fs7.openSync(command, "r");
5185
+ fs7.readSync(fd, buffer, 0, size, 0);
5186
+ fs7.closeSync(fd);
5186
5187
  } catch (e) {
5187
5188
  }
5188
5189
  return shebangCommand(buffer.toString());
@@ -5195,7 +5196,7 @@ var require_readShebang = __commonJS({
5195
5196
  var require_parse = __commonJS({
5196
5197
  "node_modules/cross-spawn/lib/parse.js"(exports, module) {
5197
5198
  "use strict";
5198
- var path9 = __require("path");
5199
+ var path11 = __require("path");
5199
5200
  var resolveCommand = require_resolveCommand();
5200
5201
  var escape2 = require_escape();
5201
5202
  var readShebang = require_readShebang();
@@ -5220,7 +5221,7 @@ var require_parse = __commonJS({
5220
5221
  const needsShell = !isExecutableRegExp.test(commandFile);
5221
5222
  if (parsed.options.forceShell || needsShell) {
5222
5223
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
5223
- parsed.command = path9.normalize(parsed.command);
5224
+ parsed.command = path11.normalize(parsed.command);
5224
5225
  parsed.command = escape2.command(parsed.command);
5225
5226
  parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
5226
5227
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -5310,7 +5311,7 @@ var require_cross_spawn = __commonJS({
5310
5311
  var cp2 = __require("child_process");
5311
5312
  var parse = require_parse();
5312
5313
  var enoent = require_enoent();
5313
- function spawn10(command, args, options) {
5314
+ function spawn12(command, args, options) {
5314
5315
  const parsed = parse(command, args, options);
5315
5316
  const spawned = cp2.spawn(parsed.command, parsed.args, parsed.options);
5316
5317
  enoent.hookChildProcess(spawned, parsed);
@@ -5322,8 +5323,8 @@ var require_cross_spawn = __commonJS({
5322
5323
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
5323
5324
  return result;
5324
5325
  }
5325
- module.exports = spawn10;
5326
- module.exports.spawn = spawn10;
5326
+ module.exports = spawn12;
5327
+ module.exports.spawn = spawn12;
5327
5328
  module.exports.sync = spawnSync3;
5328
5329
  module.exports._parse = parse;
5329
5330
  module.exports._enoent = enoent;
@@ -9350,13 +9351,13 @@ var init_output_sync = __esm({
9350
9351
  }
9351
9352
  };
9352
9353
  writeToFiles = (serializedResult, stdioItems, outputFiles) => {
9353
- for (const { path: path9, append } of stdioItems.filter(({ type }) => FILE_TYPES.has(type))) {
9354
- const pathString = typeof path9 === "string" ? path9 : path9.toString();
9354
+ for (const { path: path11, append } of stdioItems.filter(({ type }) => FILE_TYPES.has(type))) {
9355
+ const pathString = typeof path11 === "string" ? path11 : path11.toString();
9355
9356
  if (append || outputFiles.has(pathString)) {
9356
- appendFileSync2(path9, serializedResult);
9357
+ appendFileSync2(path11, serializedResult);
9357
9358
  } else {
9358
9359
  outputFiles.add(pathString);
9359
- writeFileSync(path9, serializedResult);
9360
+ writeFileSync(path11, serializedResult);
9360
9361
  }
9361
9362
  }
9362
9363
  };
@@ -12518,8 +12519,8 @@ var init_parseUtil = __esm({
12518
12519
  init_errors2();
12519
12520
  init_en();
12520
12521
  makeIssue = (params) => {
12521
- const { data, path: path9, errorMaps, issueData } = params;
12522
- const fullPath = [...path9, ...issueData.path || []];
12522
+ const { data, path: path11, errorMaps, issueData } = params;
12523
+ const fullPath = [...path11, ...issueData.path || []];
12523
12524
  const fullIssue = {
12524
12525
  ...issueData,
12525
12526
  path: fullPath
@@ -12827,11 +12828,11 @@ var init_types = __esm({
12827
12828
  init_parseUtil();
12828
12829
  init_util();
12829
12830
  ParseInputLazyPath = class {
12830
- constructor(parent, value, path9, key) {
12831
+ constructor(parent, value, path11, key) {
12831
12832
  this._cachedPath = [];
12832
12833
  this.parent = parent;
12833
12834
  this.data = value;
12834
- this._path = path9;
12835
+ this._path = path11;
12835
12836
  this._key = key;
12836
12837
  }
12837
12838
  get path() {
@@ -16224,6 +16225,10 @@ var init_schema = __esm({
16224
16225
  apiBaseUrl: external_exports.string().url().optional(),
16225
16226
  defaultModel: external_exports.string().optional(),
16226
16227
  defaultMood: external_exports.string().optional(),
16228
+ // Effort level for the multi-stage orchestrator (low|medium|high|ultra|
16229
+ // self-improve|forge). Default 'low' = current single-pass behavior. Stored as
16230
+ // a free string (validated at use); an unknown value falls back to a single pass.
16231
+ effort: external_exports.string().optional(),
16227
16232
  telemetry: external_exports.boolean().optional(),
16228
16233
  shareFingerprint: external_exports.boolean().optional(),
16229
16234
  vim: external_exports.boolean().optional(),
@@ -16262,35 +16267,35 @@ import {
16262
16267
  } from "node:fs";
16263
16268
  import { dirname as dirname2 } from "node:path";
16264
16269
  function loadUserConfig() {
16265
- const path9 = getConfigPath();
16266
- if (!existsSync2(path9)) return {};
16270
+ const path11 = getConfigPath();
16271
+ if (!existsSync2(path11)) return {};
16267
16272
  try {
16268
- const raw = JSON.parse(readFileSync3(path9, "utf8"));
16273
+ const raw = JSON.parse(readFileSync3(path11, "utf8"));
16269
16274
  return UserConfigSchema.parse(raw);
16270
16275
  } catch (err) {
16271
- logger.warn("config: failed to parse", path9, String(err));
16276
+ logger.warn("config: failed to parse", path11, String(err));
16272
16277
  return {};
16273
16278
  }
16274
16279
  }
16275
16280
  function saveUserConfig(cfg) {
16276
- const path9 = getConfigPath();
16277
- const dir = dirname2(path9);
16281
+ const path11 = getConfigPath();
16282
+ const dir = dirname2(path11);
16278
16283
  if (!existsSync2(dir)) mkdirSync2(dir, { recursive: true, mode: 448 });
16279
- writeFileSync2(path9, JSON.stringify(cfg, null, 2));
16284
+ writeFileSync2(path11, JSON.stringify(cfg, null, 2));
16280
16285
  try {
16281
- chmodSync(path9, 384);
16286
+ chmodSync(path11, 384);
16282
16287
  } catch (err) {
16283
16288
  logger.warn("config: chmod 0600 failed", String(err));
16284
16289
  }
16285
16290
  }
16286
16291
  function loadProjectConfig(cwd2) {
16287
- const path9 = getProjectConfigPath(cwd2);
16288
- if (!existsSync2(path9)) return {};
16292
+ const path11 = getProjectConfigPath(cwd2);
16293
+ if (!existsSync2(path11)) return {};
16289
16294
  try {
16290
- const raw = JSON.parse(readFileSync3(path9, "utf8"));
16295
+ const raw = JSON.parse(readFileSync3(path11, "utf8"));
16291
16296
  return ProjectConfigSchema.parse(raw);
16292
16297
  } catch (err) {
16293
- logger.warn("project config: failed to parse", path9, String(err));
16298
+ logger.warn("project config: failed to parse", path11, String(err));
16294
16299
  return {};
16295
16300
  }
16296
16301
  }
@@ -16328,7 +16333,8 @@ function resolveConfig(flagKey) {
16328
16333
  telemetry: cfg.telemetry,
16329
16334
  shareFingerprint: cfg.shareFingerprint,
16330
16335
  vim: cfg.vim,
16331
- theme: cfg.theme
16336
+ theme: cfg.theme,
16337
+ effort: env2("KRYVEN_EFFORT") || cfg.effort || DEFAULT_EFFORT
16332
16338
  };
16333
16339
  }
16334
16340
  var init_load = __esm({
@@ -16346,12 +16352,12 @@ var init_load = __esm({
16346
16352
  import { readFileSync as readFileSync4, existsSync as existsSync3 } from "node:fs";
16347
16353
  import { join as join2 } from "node:path";
16348
16354
  import { homedir as homedir2 } from "node:os";
16349
- function readCapped(path9) {
16350
- if (!existsSync3(path9)) return null;
16355
+ function readCapped(path11) {
16356
+ if (!existsSync3(path11)) return null;
16351
16357
  try {
16352
- const raw = readFileSync4(path9, "utf8");
16358
+ const raw = readFileSync4(path11, "utf8");
16353
16359
  const truncated = raw.length > MAX_CHARS;
16354
- return { path: path9, content: truncated ? raw.slice(0, MAX_CHARS) : raw, truncated };
16360
+ return { path: path11, content: truncated ? raw.slice(0, MAX_CHARS) : raw, truncated };
16355
16361
  } catch {
16356
16362
  return null;
16357
16363
  }
@@ -28223,8 +28229,8 @@ function classifyBashRisk(cmd) {
28223
28229
  }
28224
28230
  return { blocked: false };
28225
28231
  }
28226
- function isProtectedPath(path9) {
28227
- const p = path9.replace(/\\/g, "/");
28232
+ function isProtectedPath(path11) {
28233
+ const p = path11.replace(/\\/g, "/");
28228
28234
  return PROTECTED_PATHS.some((re) => re.test(p));
28229
28235
  }
28230
28236
  function commandHash(toolName, args) {
@@ -28316,8 +28322,8 @@ var init_Read = __esm({
28316
28322
  async call(rawInput, ctx) {
28317
28323
  const v = validateInput(Input, rawInput);
28318
28324
  if (!v.ok) return { ok: false, output: `Invalid input: ${v.error}` };
28319
- const { path: path9, offset, limit } = v.value;
28320
- const abs = isAbsolute6(path9) ? path9 : resolve3(ctx.cwd, path9);
28325
+ const { path: path11, offset, limit } = v.value;
28326
+ const abs = isAbsolute6(path11) ? path11 : resolve3(ctx.cwd, path11);
28321
28327
  const absKey = abs.replace(/\\/g, "/");
28322
28328
  if (isProtectedPath(absKey)) {
28323
28329
  return {
@@ -28387,8 +28393,8 @@ var init_Write = __esm({
28387
28393
  async call(rawInput, ctx) {
28388
28394
  const v = validateInput(Input2, rawInput);
28389
28395
  if (!v.ok) return { ok: false, output: `Invalid input: ${v.error}` };
28390
- const { path: path9, content } = v.value;
28391
- const abs = isAbsolute7(path9) ? path9 : resolve4(ctx.cwd, path9);
28396
+ const { path: path11, content } = v.value;
28397
+ const abs = isAbsolute7(path11) ? path11 : resolve4(ctx.cwd, path11);
28392
28398
  const absKey = abs.replace(/\\/g, "/");
28393
28399
  if (isProtectedPath(absKey)) {
28394
28400
  return { ok: false, output: `Refused: ${abs} matches a protected-secrets pattern. Cannot write.` };
@@ -28468,8 +28474,8 @@ var init_Edit = __esm({
28468
28474
  async call(rawInput, ctx) {
28469
28475
  const v = validateInput(Input3, rawInput);
28470
28476
  if (!v.ok) return { ok: false, output: `Invalid input: ${v.error}` };
28471
- const { path: path9, old_string, new_string, replace_all } = v.value;
28472
- const abs = isAbsolute8(path9) ? path9 : resolve5(ctx.cwd, path9);
28477
+ const { path: path11, old_string, new_string, replace_all } = v.value;
28478
+ const abs = isAbsolute8(path11) ? path11 : resolve5(ctx.cwd, path11);
28473
28479
  const absKey = abs.replace(/\\/g, "/");
28474
28480
  if (isProtectedPath(absKey)) {
28475
28481
  return { ok: false, output: `Refused: ${abs} matches a protected-secrets pattern. Cannot edit.` };
@@ -28954,9 +28960,9 @@ var init_Grep = __esm({
28954
28960
  import { spawn as spawn5 } from "node:child_process";
28955
28961
  import { stat as stat7 } from "node:fs/promises";
28956
28962
  import { join as join20, isAbsolute as isAbsolute11 } from "node:path";
28957
- async function fileExists(path9) {
28963
+ async function fileExists(path11) {
28958
28964
  try {
28959
- await stat7(path9);
28965
+ await stat7(path11);
28960
28966
  return true;
28961
28967
  } catch {
28962
28968
  return false;
@@ -29473,6 +29479,67 @@ To run this command, set force_allow: true (requires user consent).`
29473
29479
  }
29474
29480
  });
29475
29481
 
29482
+ // src/tools/WebSearch.ts
29483
+ var Input9, WebSearchTool;
29484
+ var init_WebSearch = __esm({
29485
+ "src/tools/WebSearch.ts"() {
29486
+ "use strict";
29487
+ init_zod();
29488
+ init_Tool();
29489
+ init_load();
29490
+ Input9 = external_exports.object({
29491
+ query: external_exports.string().min(1),
29492
+ max_results: external_exports.number().int().min(1).max(10).optional().default(5)
29493
+ });
29494
+ WebSearchTool = {
29495
+ name: "web_search",
29496
+ description: "Search the web for documentation, libraries, GitHub repos, and examples relevant to a task. Returns titles, URLs, and snippets.",
29497
+ inputSchema: Input9,
29498
+ parameters: {
29499
+ type: "object",
29500
+ properties: {
29501
+ query: { type: "string", description: "The search query." },
29502
+ max_results: { type: "integer", description: "Max results to return (1-10, default 5).", minimum: 1, maximum: 10 }
29503
+ },
29504
+ required: ["query"]
29505
+ },
29506
+ isReadOnly: () => true,
29507
+ classifyRisk: () => "low",
29508
+ async call(input, ctx) {
29509
+ const v = validateInput(Input9, input);
29510
+ if (!v.ok) return { ok: false, output: `Invalid input: ${v.error}` };
29511
+ const cfg = resolveConfig();
29512
+ if (!cfg.apiKey) return { ok: false, output: "Web search requires an API key (run /login)." };
29513
+ const url = `${cfg.apiBaseUrl.replace(/\/$/, "")}/v1/search`;
29514
+ try {
29515
+ const res = await fetch(url, {
29516
+ method: "POST",
29517
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${cfg.apiKey}` },
29518
+ body: JSON.stringify({ query: v.value.query, max_results: v.value.max_results }),
29519
+ signal: ctx.signal
29520
+ });
29521
+ if (!res.ok) {
29522
+ if (res.status === 404 || res.status === 501) {
29523
+ return { ok: false, output: "Web search is not enabled on the server yet (no provider configured)." };
29524
+ }
29525
+ return { ok: false, output: `Web search failed (HTTP ${res.status}).` };
29526
+ }
29527
+ const data = await res.json();
29528
+ const results = Array.isArray(data?.results) ? data.results : [];
29529
+ if (results.length === 0) return { ok: true, output: "No results." };
29530
+ const text = results.map((r, i2) => `${i2 + 1}. ${r.title || "(untitled)"}
29531
+ ${r.url || ""}
29532
+ ${(r.snippet || "").slice(0, 300)}`).join("\n\n");
29533
+ return { ok: true, output: text };
29534
+ } catch (err) {
29535
+ if (err.name === "AbortError") return { ok: false, output: "aborted" };
29536
+ return { ok: false, output: `Web search error: ${err.message}` };
29537
+ }
29538
+ }
29539
+ };
29540
+ }
29541
+ });
29542
+
29476
29543
  // src/tools/index.ts
29477
29544
  var tools_exports = {};
29478
29545
  __export(tools_exports, {
@@ -29492,6 +29559,7 @@ function registerBuiltinTools() {
29492
29559
  registerTool(GrepTool);
29493
29560
  registerTool(TestRunnerTool);
29494
29561
  registerTool(SafeShellTool);
29562
+ registerTool(WebSearchTool);
29495
29563
  initialized = true;
29496
29564
  }
29497
29565
  function resetBuiltinTools() {
@@ -29511,6 +29579,7 @@ var init_tools = __esm({
29511
29579
  init_Grep();
29512
29580
  init_TestRunner();
29513
29581
  init_SafeShell();
29582
+ init_WebSearch();
29514
29583
  init_registry();
29515
29584
  initialized = false;
29516
29585
  }
@@ -29546,39 +29615,39 @@ var init_store = __esm({
29546
29615
  // ── I/O ────────────────────────────────────────────────────────────────────
29547
29616
  /** Load rules from disk. Safe to call multiple times (re-reads each time). */
29548
29617
  load() {
29549
- const path9 = permissionsPath();
29550
- if (!existsSync13(path9)) {
29618
+ const path11 = permissionsPath();
29619
+ if (!existsSync13(path11)) {
29551
29620
  this.rules = [];
29552
29621
  return;
29553
29622
  }
29554
29623
  try {
29555
- const raw = JSON.parse(readFileSync9(path9, "utf8"));
29624
+ const raw = JSON.parse(readFileSync9(path11, "utf8"));
29556
29625
  if (raw.version !== 1 || !Array.isArray(raw.rules)) {
29557
- logger.warn("permissions/store: unrecognised format, ignoring", path9);
29626
+ logger.warn("permissions/store: unrecognised format, ignoring", path11);
29558
29627
  this.rules = [];
29559
29628
  return;
29560
29629
  }
29561
29630
  this.rules = raw.rules;
29562
29631
  this.dirty = false;
29563
29632
  } catch (err) {
29564
- logger.warn("permissions/store: failed to parse", path9, String(err));
29633
+ logger.warn("permissions/store: failed to parse", path11, String(err));
29565
29634
  this.rules = [];
29566
29635
  }
29567
29636
  }
29568
29637
  /** Flush dirty rules to disk. No-op when nothing has changed. */
29569
29638
  save() {
29570
29639
  if (!this.dirty) return;
29571
- const path9 = permissionsPath();
29572
- const dir = dirname11(path9);
29640
+ const path11 = permissionsPath();
29641
+ const dir = dirname11(path11);
29573
29642
  if (!existsSync13(dir)) {
29574
29643
  mkdirSync5(dir, { recursive: true, mode: 448 });
29575
29644
  }
29576
29645
  const file = { version: 1, rules: this.rules };
29577
29646
  try {
29578
- writeFileSync6(path9, JSON.stringify(file, null, 2), { mode: 384 });
29647
+ writeFileSync6(path11, JSON.stringify(file, null, 2), { mode: 384 });
29579
29648
  this.dirty = false;
29580
29649
  } catch (err) {
29581
- logger.warn("permissions/store: failed to save", path9, String(err));
29650
+ logger.warn("permissions/store: failed to save", path11, String(err));
29582
29651
  }
29583
29652
  }
29584
29653
  // ── Mutations ───────────────────────────────────────────────────────────────
@@ -29714,11 +29783,11 @@ function patternMatches(pattern, toolName, args) {
29714
29783
  }
29715
29784
  }
29716
29785
  function consultProjectPermissions(toolName, args, cwd2) {
29717
- const path9 = join22(cwd2, ".kryven", "settings.json");
29718
- if (!existsSync14(path9)) return null;
29786
+ const path11 = join22(cwd2, ".kryven", "settings.json");
29787
+ if (!existsSync14(path11)) return null;
29719
29788
  let perms;
29720
29789
  try {
29721
- const parsed = JSON.parse(readFileSync10(path9, "utf8"));
29790
+ const parsed = JSON.parse(readFileSync10(path11, "utf8"));
29722
29791
  perms = parsed.permissions ?? {};
29723
29792
  } catch {
29724
29793
  return null;
@@ -29741,10 +29810,10 @@ var init_project_rules = __esm({
29741
29810
  // src/agent/hooks-runner.ts
29742
29811
  import { existsSync as existsSync15, readFileSync as readFileSync11 } from "node:fs";
29743
29812
  import { join as join23 } from "node:path";
29744
- function readEventHooks(path9, event) {
29745
- if (!existsSync15(path9)) return [];
29813
+ function readEventHooks(path11, event) {
29814
+ if (!existsSync15(path11)) return [];
29746
29815
  try {
29747
- const parsed = JSON.parse(readFileSync11(path9, "utf8"));
29816
+ const parsed = JSON.parse(readFileSync11(path11, "utf8"));
29748
29817
  const list = parsed.hooks?.[event];
29749
29818
  if (!Array.isArray(list)) return [];
29750
29819
  const out = [];
@@ -29915,12 +29984,33 @@ async function* runAgentLoopWithTools(client, conversation, opts) {
29915
29984
  }
29916
29985
  if (!message.tool_calls || message.tool_calls.length === 0) {
29917
29986
  const emptyTurn = !message.content || message.content.trim().length === 0;
29918
- if (emptyTurn && !escalated && activeModel !== "kryven-extended") {
29987
+ const ESCALATION_NEXT = {
29988
+ "kryven-flash": "kryven-extended",
29989
+ "kryven-extended": "kryven-coder"
29990
+ };
29991
+ const lowerC = (message.content || "").toLowerCase();
29992
+ const STALL_PHRASES = [
29993
+ "i don't have access",
29994
+ "i do not have access",
29995
+ "i cannot access",
29996
+ "i can't access",
29997
+ "i'm unable to",
29998
+ "i am unable to",
29999
+ "you'll need to",
30000
+ "you will need to",
30001
+ "please run",
30002
+ "please paste",
30003
+ "could you provide",
30004
+ "i don't have the ability"
30005
+ ];
30006
+ const stalledChat = iter === 1 && opts.tools.length > 0 && lowerC.length > 0 && lowerC.length < 600 && STALL_PHRASES.some((p) => lowerC.includes(p));
30007
+ const nextModel = ESCALATION_NEXT[activeModel];
30008
+ if ((emptyTurn || stalledChat) && !escalated && nextModel) {
29919
30009
  escalated = true;
29920
30010
  const from = activeModel;
29921
- activeModel = "kryven-extended";
30011
+ activeModel = nextModel;
29922
30012
  conversation.truncateTo(conversation.size() - 1);
29923
- yield { type: "reflection", phase: `escalate:${from}->kryven-extended`, ok: false, detail: "Empty response \u2014 retrying on a stronger model." };
30013
+ yield { type: "reflection", phase: `escalate:${from}->${nextModel}`, ok: false, detail: "Retrying on a more capable model." };
29924
30014
  continue;
29925
30015
  }
29926
30016
  if (opts.reflect && editsMade && reflectionsLeft > 0 && !opts.signal?.aborted) {
@@ -29933,7 +30023,10 @@ async function* runAgentLoopWithTools(client, conversation, opts) {
29933
30023
  shell: true,
29934
30024
  cwd: opts.reflect.cwd,
29935
30025
  timeout: 18e4,
29936
- reject: false
30026
+ reject: false,
30027
+ // Honor Ctrl+C: without the signal a slow check (tsc/test) ignores
30028
+ // an abort for up to the 180s timeout, hanging the turn.
30029
+ signal: opts.signal
29937
30030
  });
29938
30031
  ok = exitCode === 0;
29939
30032
  detail = [stdout, stderr].filter(Boolean).join("\n").slice(0, 8e3);
@@ -29943,6 +30036,12 @@ async function* runAgentLoopWithTools(client, conversation, opts) {
29943
30036
  }
29944
30037
  yield { type: "reflection", phase: "check", ok, detail };
29945
30038
  if (!ok && iter < MAX_ITER) {
30039
+ if (!escalated && ESCALATION_NEXT[activeModel]) {
30040
+ escalated = true;
30041
+ const from = activeModel;
30042
+ activeModel = ESCALATION_NEXT[activeModel];
30043
+ yield { type: "reflection", phase: `escalate:${from}->${activeModel}`, ok: false, detail: "Build check failed \u2014 fixing on a more capable model." };
30044
+ }
29946
30045
  conversation.append({
29947
30046
  role: "user",
29948
30047
  content: `Your edits did not pass the project check \`${opts.reflect.command}\`. Fix the issues, then stop. Check output:
@@ -30072,6 +30171,7 @@ ${detail}`,
30072
30171
  }
30073
30172
  }
30074
30173
  yield { type: "max_iterations", n: MAX_ITER };
30174
+ yield { type: "end_turn", finishReason: "length", usage: sawUsage ? totalUsage : void 0 };
30075
30175
  }
30076
30176
  var init_loop = __esm({
30077
30177
  "src/agent/loop.ts"() {
@@ -30205,54 +30305,54 @@ var require_polyfills = __commonJS({
30205
30305
  }
30206
30306
  var chdir;
30207
30307
  module.exports = patch;
30208
- function patch(fs5) {
30308
+ function patch(fs7) {
30209
30309
  if (constants5.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
30210
- patchLchmod(fs5);
30211
- }
30212
- if (!fs5.lutimes) {
30213
- patchLutimes(fs5);
30214
- }
30215
- fs5.chown = chownFix(fs5.chown);
30216
- fs5.fchown = chownFix(fs5.fchown);
30217
- fs5.lchown = chownFix(fs5.lchown);
30218
- fs5.chmod = chmodFix(fs5.chmod);
30219
- fs5.fchmod = chmodFix(fs5.fchmod);
30220
- fs5.lchmod = chmodFix(fs5.lchmod);
30221
- fs5.chownSync = chownFixSync(fs5.chownSync);
30222
- fs5.fchownSync = chownFixSync(fs5.fchownSync);
30223
- fs5.lchownSync = chownFixSync(fs5.lchownSync);
30224
- fs5.chmodSync = chmodFixSync(fs5.chmodSync);
30225
- fs5.fchmodSync = chmodFixSync(fs5.fchmodSync);
30226
- fs5.lchmodSync = chmodFixSync(fs5.lchmodSync);
30227
- fs5.stat = statFix(fs5.stat);
30228
- fs5.fstat = statFix(fs5.fstat);
30229
- fs5.lstat = statFix(fs5.lstat);
30230
- fs5.statSync = statFixSync(fs5.statSync);
30231
- fs5.fstatSync = statFixSync(fs5.fstatSync);
30232
- fs5.lstatSync = statFixSync(fs5.lstatSync);
30233
- if (fs5.chmod && !fs5.lchmod) {
30234
- fs5.lchmod = function(path9, mode, cb) {
30310
+ patchLchmod(fs7);
30311
+ }
30312
+ if (!fs7.lutimes) {
30313
+ patchLutimes(fs7);
30314
+ }
30315
+ fs7.chown = chownFix(fs7.chown);
30316
+ fs7.fchown = chownFix(fs7.fchown);
30317
+ fs7.lchown = chownFix(fs7.lchown);
30318
+ fs7.chmod = chmodFix(fs7.chmod);
30319
+ fs7.fchmod = chmodFix(fs7.fchmod);
30320
+ fs7.lchmod = chmodFix(fs7.lchmod);
30321
+ fs7.chownSync = chownFixSync(fs7.chownSync);
30322
+ fs7.fchownSync = chownFixSync(fs7.fchownSync);
30323
+ fs7.lchownSync = chownFixSync(fs7.lchownSync);
30324
+ fs7.chmodSync = chmodFixSync(fs7.chmodSync);
30325
+ fs7.fchmodSync = chmodFixSync(fs7.fchmodSync);
30326
+ fs7.lchmodSync = chmodFixSync(fs7.lchmodSync);
30327
+ fs7.stat = statFix(fs7.stat);
30328
+ fs7.fstat = statFix(fs7.fstat);
30329
+ fs7.lstat = statFix(fs7.lstat);
30330
+ fs7.statSync = statFixSync(fs7.statSync);
30331
+ fs7.fstatSync = statFixSync(fs7.fstatSync);
30332
+ fs7.lstatSync = statFixSync(fs7.lstatSync);
30333
+ if (fs7.chmod && !fs7.lchmod) {
30334
+ fs7.lchmod = function(path11, mode, cb) {
30235
30335
  if (cb) process.nextTick(cb);
30236
30336
  };
30237
- fs5.lchmodSync = function() {
30337
+ fs7.lchmodSync = function() {
30238
30338
  };
30239
30339
  }
30240
- if (fs5.chown && !fs5.lchown) {
30241
- fs5.lchown = function(path9, uid, gid, cb) {
30340
+ if (fs7.chown && !fs7.lchown) {
30341
+ fs7.lchown = function(path11, uid, gid, cb) {
30242
30342
  if (cb) process.nextTick(cb);
30243
30343
  };
30244
- fs5.lchownSync = function() {
30344
+ fs7.lchownSync = function() {
30245
30345
  };
30246
30346
  }
30247
30347
  if (platform3 === "win32") {
30248
- fs5.rename = typeof fs5.rename !== "function" ? fs5.rename : (function(fs$rename) {
30348
+ fs7.rename = typeof fs7.rename !== "function" ? fs7.rename : (function(fs$rename) {
30249
30349
  function rename(from, to, cb) {
30250
30350
  var start = Date.now();
30251
30351
  var backoff = 0;
30252
30352
  fs$rename(from, to, function CB(er) {
30253
30353
  if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
30254
30354
  setTimeout(function() {
30255
- fs5.stat(to, function(stater, st) {
30355
+ fs7.stat(to, function(stater, st) {
30256
30356
  if (stater && stater.code === "ENOENT")
30257
30357
  fs$rename(from, to, CB);
30258
30358
  else
@@ -30268,9 +30368,9 @@ var require_polyfills = __commonJS({
30268
30368
  }
30269
30369
  if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
30270
30370
  return rename;
30271
- })(fs5.rename);
30371
+ })(fs7.rename);
30272
30372
  }
30273
- fs5.read = typeof fs5.read !== "function" ? fs5.read : (function(fs$read) {
30373
+ fs7.read = typeof fs7.read !== "function" ? fs7.read : (function(fs$read) {
30274
30374
  function read(fd, buffer, offset, length, position, callback_) {
30275
30375
  var callback;
30276
30376
  if (callback_ && typeof callback_ === "function") {
@@ -30278,22 +30378,22 @@ var require_polyfills = __commonJS({
30278
30378
  callback = function(er, _, __) {
30279
30379
  if (er && er.code === "EAGAIN" && eagCounter < 10) {
30280
30380
  eagCounter++;
30281
- return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
30381
+ return fs$read.call(fs7, fd, buffer, offset, length, position, callback);
30282
30382
  }
30283
30383
  callback_.apply(this, arguments);
30284
30384
  };
30285
30385
  }
30286
- return fs$read.call(fs5, fd, buffer, offset, length, position, callback);
30386
+ return fs$read.call(fs7, fd, buffer, offset, length, position, callback);
30287
30387
  }
30288
30388
  if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
30289
30389
  return read;
30290
- })(fs5.read);
30291
- fs5.readSync = typeof fs5.readSync !== "function" ? fs5.readSync : /* @__PURE__ */ (function(fs$readSync) {
30390
+ })(fs7.read);
30391
+ fs7.readSync = typeof fs7.readSync !== "function" ? fs7.readSync : /* @__PURE__ */ (function(fs$readSync) {
30292
30392
  return function(fd, buffer, offset, length, position) {
30293
30393
  var eagCounter = 0;
30294
30394
  while (true) {
30295
30395
  try {
30296
- return fs$readSync.call(fs5, fd, buffer, offset, length, position);
30396
+ return fs$readSync.call(fs7, fd, buffer, offset, length, position);
30297
30397
  } catch (er) {
30298
30398
  if (er.code === "EAGAIN" && eagCounter < 10) {
30299
30399
  eagCounter++;
@@ -30303,11 +30403,11 @@ var require_polyfills = __commonJS({
30303
30403
  }
30304
30404
  }
30305
30405
  };
30306
- })(fs5.readSync);
30307
- function patchLchmod(fs6) {
30308
- fs6.lchmod = function(path9, mode, callback) {
30309
- fs6.open(
30310
- path9,
30406
+ })(fs7.readSync);
30407
+ function patchLchmod(fs8) {
30408
+ fs8.lchmod = function(path11, mode, callback) {
30409
+ fs8.open(
30410
+ path11,
30311
30411
  constants5.O_WRONLY | constants5.O_SYMLINK,
30312
30412
  mode,
30313
30413
  function(err, fd) {
@@ -30315,80 +30415,80 @@ var require_polyfills = __commonJS({
30315
30415
  if (callback) callback(err);
30316
30416
  return;
30317
30417
  }
30318
- fs6.fchmod(fd, mode, function(err2) {
30319
- fs6.close(fd, function(err22) {
30418
+ fs8.fchmod(fd, mode, function(err2) {
30419
+ fs8.close(fd, function(err22) {
30320
30420
  if (callback) callback(err2 || err22);
30321
30421
  });
30322
30422
  });
30323
30423
  }
30324
30424
  );
30325
30425
  };
30326
- fs6.lchmodSync = function(path9, mode) {
30327
- var fd = fs6.openSync(path9, constants5.O_WRONLY | constants5.O_SYMLINK, mode);
30426
+ fs8.lchmodSync = function(path11, mode) {
30427
+ var fd = fs8.openSync(path11, constants5.O_WRONLY | constants5.O_SYMLINK, mode);
30328
30428
  var threw = true;
30329
30429
  var ret;
30330
30430
  try {
30331
- ret = fs6.fchmodSync(fd, mode);
30431
+ ret = fs8.fchmodSync(fd, mode);
30332
30432
  threw = false;
30333
30433
  } finally {
30334
30434
  if (threw) {
30335
30435
  try {
30336
- fs6.closeSync(fd);
30436
+ fs8.closeSync(fd);
30337
30437
  } catch (er) {
30338
30438
  }
30339
30439
  } else {
30340
- fs6.closeSync(fd);
30440
+ fs8.closeSync(fd);
30341
30441
  }
30342
30442
  }
30343
30443
  return ret;
30344
30444
  };
30345
30445
  }
30346
- function patchLutimes(fs6) {
30347
- if (constants5.hasOwnProperty("O_SYMLINK") && fs6.futimes) {
30348
- fs6.lutimes = function(path9, at, mt, cb) {
30349
- fs6.open(path9, constants5.O_SYMLINK, function(er, fd) {
30446
+ function patchLutimes(fs8) {
30447
+ if (constants5.hasOwnProperty("O_SYMLINK") && fs8.futimes) {
30448
+ fs8.lutimes = function(path11, at, mt, cb) {
30449
+ fs8.open(path11, constants5.O_SYMLINK, function(er, fd) {
30350
30450
  if (er) {
30351
30451
  if (cb) cb(er);
30352
30452
  return;
30353
30453
  }
30354
- fs6.futimes(fd, at, mt, function(er2) {
30355
- fs6.close(fd, function(er22) {
30454
+ fs8.futimes(fd, at, mt, function(er2) {
30455
+ fs8.close(fd, function(er22) {
30356
30456
  if (cb) cb(er2 || er22);
30357
30457
  });
30358
30458
  });
30359
30459
  });
30360
30460
  };
30361
- fs6.lutimesSync = function(path9, at, mt) {
30362
- var fd = fs6.openSync(path9, constants5.O_SYMLINK);
30461
+ fs8.lutimesSync = function(path11, at, mt) {
30462
+ var fd = fs8.openSync(path11, constants5.O_SYMLINK);
30363
30463
  var ret;
30364
30464
  var threw = true;
30365
30465
  try {
30366
- ret = fs6.futimesSync(fd, at, mt);
30466
+ ret = fs8.futimesSync(fd, at, mt);
30367
30467
  threw = false;
30368
30468
  } finally {
30369
30469
  if (threw) {
30370
30470
  try {
30371
- fs6.closeSync(fd);
30471
+ fs8.closeSync(fd);
30372
30472
  } catch (er) {
30373
30473
  }
30374
30474
  } else {
30375
- fs6.closeSync(fd);
30475
+ fs8.closeSync(fd);
30376
30476
  }
30377
30477
  }
30378
30478
  return ret;
30379
30479
  };
30380
- } else if (fs6.futimes) {
30381
- fs6.lutimes = function(_a, _b, _c, cb) {
30480
+ } else if (fs8.futimes) {
30481
+ fs8.lutimes = function(_a, _b, _c, cb) {
30382
30482
  if (cb) process.nextTick(cb);
30383
30483
  };
30384
- fs6.lutimesSync = function() {
30484
+ fs8.lutimesSync = function() {
30385
30485
  };
30386
30486
  }
30387
30487
  }
30388
30488
  function chmodFix(orig) {
30389
30489
  if (!orig) return orig;
30390
30490
  return function(target, mode, cb) {
30391
- return orig.call(fs5, target, mode, function(er) {
30491
+ return orig.call(fs7, target, mode, function(er) {
30392
30492
  if (chownErOk(er)) er = null;
30393
30493
  if (cb) cb.apply(this, arguments);
30394
30494
  });
@@ -30398,7 +30498,7 @@ var require_polyfills = __commonJS({
30398
30498
  if (!orig) return orig;
30399
30499
  return function(target, mode) {
30400
30500
  try {
30401
- return orig.call(fs5, target, mode);
30501
+ return orig.call(fs7, target, mode);
30402
30502
  } catch (er) {
30403
30503
  if (!chownErOk(er)) throw er;
30404
30504
  }
@@ -30407,7 +30507,7 @@ var require_polyfills = __commonJS({
30407
30507
  function chownFix(orig) {
30408
30508
  if (!orig) return orig;
30409
30509
  return function(target, uid, gid, cb) {
30410
- return orig.call(fs5, target, uid, gid, function(er) {
30510
+ return orig.call(fs7, target, uid, gid, function(er) {
30411
30511
  if (chownErOk(er)) er = null;
30412
30512
  if (cb) cb.apply(this, arguments);
30413
30513
  });
@@ -30417,7 +30517,7 @@ var require_polyfills = __commonJS({
30417
30517
  if (!orig) return orig;
30418
30518
  return function(target, uid, gid) {
30419
30519
  try {
30420
- return orig.call(fs5, target, uid, gid);
30520
+ return orig.call(fs7, target, uid, gid);
30421
30521
  } catch (er) {
30422
30522
  if (!chownErOk(er)) throw er;
30423
30523
  }
@@ -30437,13 +30537,13 @@ var require_polyfills = __commonJS({
30437
30537
  }
30438
30538
  if (cb) cb.apply(this, arguments);
30439
30539
  }
30440
- return options ? orig.call(fs5, target, options, callback) : orig.call(fs5, target, callback);
30540
+ return options ? orig.call(fs7, target, options, callback) : orig.call(fs7, target, callback);
30441
30541
  };
30442
30542
  }
30443
30543
  function statFixSync(orig) {
30444
30544
  if (!orig) return orig;
30445
30545
  return function(target, options) {
30446
- var stats = options ? orig.call(fs5, target, options) : orig.call(fs5, target);
30546
+ var stats = options ? orig.call(fs7, target, options) : orig.call(fs7, target);
30447
30547
  if (stats) {
30448
30548
  if (stats.uid < 0) stats.uid += 4294967296;
30449
30549
  if (stats.gid < 0) stats.gid += 4294967296;
@@ -30472,16 +30572,16 @@ var require_legacy_streams = __commonJS({
30472
30572
  "node_modules/graceful-fs/legacy-streams.js"(exports, module) {
30473
30573
  var Stream2 = __require("stream").Stream;
30474
30574
  module.exports = legacy;
30475
- function legacy(fs5) {
30575
+ function legacy(fs7) {
30476
30576
  return {
30477
30577
  ReadStream,
30478
30578
  WriteStream
30479
30579
  };
30480
- function ReadStream(path9, options) {
30481
- if (!(this instanceof ReadStream)) return new ReadStream(path9, options);
30580
+ function ReadStream(path11, options) {
30581
+ if (!(this instanceof ReadStream)) return new ReadStream(path11, options);
30482
30582
  Stream2.call(this);
30483
30583
  var self = this;
30484
- this.path = path9;
30584
+ this.path = path11;
30485
30585
  this.fd = null;
30486
30586
  this.readable = true;
30487
30587
  this.paused = false;
@@ -30515,7 +30615,7 @@ var require_legacy_streams = __commonJS({
30515
30615
  });
30516
30616
  return;
30517
30617
  }
30518
- fs5.open(this.path, this.flags, this.mode, function(err, fd) {
30618
+ fs7.open(this.path, this.flags, this.mode, function(err, fd) {
30519
30619
  if (err) {
30520
30620
  self.emit("error", err);
30521
30621
  self.readable = false;
@@ -30526,10 +30626,10 @@ var require_legacy_streams = __commonJS({
30526
30626
  self._read();
30527
30627
  });
30528
30628
  }
30529
- function WriteStream(path9, options) {
30530
- if (!(this instanceof WriteStream)) return new WriteStream(path9, options);
30629
+ function WriteStream(path11, options) {
30630
+ if (!(this instanceof WriteStream)) return new WriteStream(path11, options);
30531
30631
  Stream2.call(this);
30532
- this.path = path9;
30632
+ this.path = path11;
30533
30633
  this.fd = null;
30534
30634
  this.writable = true;
30535
30635
  this.flags = "w";
@@ -30554,7 +30654,7 @@ var require_legacy_streams = __commonJS({
30554
30654
  this.busy = false;
30555
30655
  this._queue = [];
30556
30656
  if (this.fd === null) {
30557
- this._open = fs5.open;
30657
+ this._open = fs7.open;
30558
30658
  this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
30559
30659
  this.flush();
30560
30660
  }
@@ -30589,7 +30689,7 @@ var require_clone = __commonJS({
30589
30689
  // node_modules/graceful-fs/graceful-fs.js
30590
30690
  var require_graceful_fs = __commonJS({
30591
30691
  "node_modules/graceful-fs/graceful-fs.js"(exports, module) {
30592
- var fs5 = __require("fs");
30692
+ var fs7 = __require("fs");
30593
30693
  var polyfills = require_polyfills();
30594
30694
  var legacy = require_legacy_streams();
30595
30695
  var clone = require_clone();
@@ -30621,12 +30721,12 @@ var require_graceful_fs = __commonJS({
30621
30721
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
30622
30722
  console.error(m);
30623
30723
  };
30624
- if (!fs5[gracefulQueue]) {
30724
+ if (!fs7[gracefulQueue]) {
30625
30725
  queue = global[gracefulQueue] || [];
30626
- publishQueue(fs5, queue);
30627
- fs5.close = (function(fs$close) {
30726
+ publishQueue(fs7, queue);
30727
+ fs7.close = (function(fs$close) {
30628
30728
  function close(fd, cb) {
30629
- return fs$close.call(fs5, fd, function(err) {
30729
+ return fs$close.call(fs7, fd, function(err) {
30630
30730
  if (!err) {
30631
30731
  resetQueue();
30632
30732
  }
@@ -30638,48 +30738,48 @@ var require_graceful_fs = __commonJS({
30638
30738
  value: fs$close
30639
30739
  });
30640
30740
  return close;
30641
- })(fs5.close);
30642
- fs5.closeSync = (function(fs$closeSync) {
30741
+ })(fs7.close);
30742
+ fs7.closeSync = (function(fs$closeSync) {
30643
30743
  function closeSync3(fd) {
30644
- fs$closeSync.apply(fs5, arguments);
30744
+ fs$closeSync.apply(fs7, arguments);
30645
30745
  resetQueue();
30646
30746
  }
30647
30747
  Object.defineProperty(closeSync3, previousSymbol, {
30648
30748
  value: fs$closeSync
30649
30749
  });
30650
30750
  return closeSync3;
30651
- })(fs5.closeSync);
30751
+ })(fs7.closeSync);
30652
30752
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
30653
30753
  process.on("exit", function() {
30654
- debug(fs5[gracefulQueue]);
30655
- __require("assert").equal(fs5[gracefulQueue].length, 0);
30754
+ debug(fs7[gracefulQueue]);
30755
+ __require("assert").equal(fs7[gracefulQueue].length, 0);
30656
30756
  });
30657
30757
  }
30658
30758
  }
30659
30759
  var queue;
30660
30760
  if (!global[gracefulQueue]) {
30661
- publishQueue(global, fs5[gracefulQueue]);
30662
- }
30663
- module.exports = patch(clone(fs5));
30664
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs5.__patched) {
30665
- module.exports = patch(fs5);
30666
- fs5.__patched = true;
30667
- }
30668
- function patch(fs6) {
30669
- polyfills(fs6);
30670
- fs6.gracefulify = patch;
30671
- fs6.createReadStream = createReadStream2;
30672
- fs6.createWriteStream = createWriteStream2;
30673
- var fs$readFile = fs6.readFile;
30674
- fs6.readFile = readFile18;
30675
- function readFile18(path9, options, cb) {
30761
+ publishQueue(global, fs7[gracefulQueue]);
30762
+ }
30763
+ module.exports = patch(clone(fs7));
30764
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs7.__patched) {
30765
+ module.exports = patch(fs7);
30766
+ fs7.__patched = true;
30767
+ }
30768
+ function patch(fs8) {
30769
+ polyfills(fs8);
30770
+ fs8.gracefulify = patch;
30771
+ fs8.createReadStream = createReadStream2;
30772
+ fs8.createWriteStream = createWriteStream2;
30773
+ var fs$readFile = fs8.readFile;
30774
+ fs8.readFile = readFile18;
30775
+ function readFile18(path11, options, cb) {
30676
30776
  if (typeof options === "function")
30677
30777
  cb = options, options = null;
30678
- return go$readFile(path9, options, cb);
30679
- function go$readFile(path10, options2, cb2, startTime) {
30680
- return fs$readFile(path10, options2, function(err) {
30778
+ return go$readFile(path11, options, cb);
30779
+ function go$readFile(path12, options2, cb2, startTime) {
30780
+ return fs$readFile(path12, options2, function(err) {
30681
30781
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
30682
- enqueue([go$readFile, [path10, options2, cb2], err, startTime || Date.now(), Date.now()]);
30782
+ enqueue([go$readFile, [path12, options2, cb2], err, startTime || Date.now(), Date.now()]);
30683
30783
  else {
30684
30784
  if (typeof cb2 === "function")
30685
30785
  cb2.apply(this, arguments);
@@ -30687,16 +30787,16 @@ var require_graceful_fs = __commonJS({
30687
30787
  });
30688
30788
  }
30689
30789
  }
30690
- var fs$writeFile = fs6.writeFile;
30691
- fs6.writeFile = writeFile12;
30692
- function writeFile12(path9, data, options, cb) {
30790
+ var fs$writeFile = fs8.writeFile;
30791
+ fs8.writeFile = writeFile12;
30792
+ function writeFile12(path11, data, options, cb) {
30693
30793
  if (typeof options === "function")
30694
30794
  cb = options, options = null;
30695
- return go$writeFile(path9, data, options, cb);
30696
- function go$writeFile(path10, data2, options2, cb2, startTime) {
30697
- return fs$writeFile(path10, data2, options2, function(err) {
30795
+ return go$writeFile(path11, data, options, cb);
30796
+ function go$writeFile(path12, data2, options2, cb2, startTime) {
30797
+ return fs$writeFile(path12, data2, options2, function(err) {
30698
30798
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
30699
- enqueue([go$writeFile, [path10, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
30799
+ enqueue([go$writeFile, [path12, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
30700
30800
  else {
30701
30801
  if (typeof cb2 === "function")
30702
30802
  cb2.apply(this, arguments);
@@ -30704,17 +30804,17 @@ var require_graceful_fs = __commonJS({
30704
30804
  });
30705
30805
  }
30706
30806
  }
30707
- var fs$appendFile = fs6.appendFile;
30807
+ var fs$appendFile = fs8.appendFile;
30708
30808
  if (fs$appendFile)
30709
- fs6.appendFile = appendFile4;
30710
- function appendFile4(path9, data, options, cb) {
30809
+ fs8.appendFile = appendFile4;
30810
+ function appendFile4(path11, data, options, cb) {
30711
30811
  if (typeof options === "function")
30712
30812
  cb = options, options = null;
30713
- return go$appendFile(path9, data, options, cb);
30714
- function go$appendFile(path10, data2, options2, cb2, startTime) {
30715
- return fs$appendFile(path10, data2, options2, function(err) {
30813
+ return go$appendFile(path11, data, options, cb);
30814
+ function go$appendFile(path12, data2, options2, cb2, startTime) {
30815
+ return fs$appendFile(path12, data2, options2, function(err) {
30716
30816
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
30717
- enqueue([go$appendFile, [path10, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
30817
+ enqueue([go$appendFile, [path12, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
30718
30818
  else {
30719
30819
  if (typeof cb2 === "function")
30720
30820
  cb2.apply(this, arguments);
@@ -30722,9 +30822,9 @@ var require_graceful_fs = __commonJS({
30722
30822
  });
30723
30823
  }
30724
30824
  }
30725
- var fs$copyFile = fs6.copyFile;
30825
+ var fs$copyFile = fs8.copyFile;
30726
30826
  if (fs$copyFile)
30727
- fs6.copyFile = copyFile;
30827
+ fs8.copyFile = copyFile;
30728
30828
  function copyFile(src, dest, flags, cb) {
30729
30829
  if (typeof flags === "function") {
30730
30830
  cb = flags;
@@ -30742,34 +30842,34 @@ var require_graceful_fs = __commonJS({
30742
30842
  });
30743
30843
  }
30744
30844
  }
30745
- var fs$readdir = fs6.readdir;
30746
- fs6.readdir = readdir11;
30845
+ var fs$readdir = fs8.readdir;
30846
+ fs8.readdir = readdir11;
30747
30847
  var noReaddirOptionVersions = /^v[0-5]\./;
30748
- function readdir11(path9, options, cb) {
30848
+ function readdir11(path11, options, cb) {
30749
30849
  if (typeof options === "function")
30750
30850
  cb = options, options = null;
30751
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path10, options2, cb2, startTime) {
30752
- return fs$readdir(path10, fs$readdirCallback(
30753
- path10,
30851
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path12, options2, cb2, startTime) {
30852
+ return fs$readdir(path12, fs$readdirCallback(
30853
+ path12,
30754
30854
  options2,
30755
30855
  cb2,
30756
30856
  startTime
30757
30857
  ));
30758
- } : function go$readdir2(path10, options2, cb2, startTime) {
30759
- return fs$readdir(path10, options2, fs$readdirCallback(
30760
- path10,
30858
+ } : function go$readdir2(path12, options2, cb2, startTime) {
30859
+ return fs$readdir(path12, options2, fs$readdirCallback(
30860
+ path12,
30761
30861
  options2,
30762
30862
  cb2,
30763
30863
  startTime
30764
30864
  ));
30765
30865
  };
30766
- return go$readdir(path9, options, cb);
30767
- function fs$readdirCallback(path10, options2, cb2, startTime) {
30866
+ return go$readdir(path11, options, cb);
30867
+ function fs$readdirCallback(path12, options2, cb2, startTime) {
30768
30868
  return function(err, files) {
30769
30869
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
30770
30870
  enqueue([
30771
30871
  go$readdir,
30772
- [path10, options2, cb2],
30872
+ [path12, options2, cb2],
30773
30873
  err,
30774
30874
  startTime || Date.now(),
30775
30875
  Date.now()
@@ -30784,21 +30884,21 @@ var require_graceful_fs = __commonJS({
30784
30884
  }
30785
30885
  }
30786
30886
  if (process.version.substr(0, 4) === "v0.8") {
30787
- var legStreams = legacy(fs6);
30887
+ var legStreams = legacy(fs8);
30788
30888
  ReadStream = legStreams.ReadStream;
30789
30889
  WriteStream = legStreams.WriteStream;
30790
30890
  }
30791
- var fs$ReadStream = fs6.ReadStream;
30891
+ var fs$ReadStream = fs8.ReadStream;
30792
30892
  if (fs$ReadStream) {
30793
30893
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
30794
30894
  ReadStream.prototype.open = ReadStream$open;
30795
30895
  }
30796
- var fs$WriteStream = fs6.WriteStream;
30896
+ var fs$WriteStream = fs8.WriteStream;
30797
30897
  if (fs$WriteStream) {
30798
30898
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
30799
30899
  WriteStream.prototype.open = WriteStream$open;
30800
30900
  }
30801
- Object.defineProperty(fs6, "ReadStream", {
30901
+ Object.defineProperty(fs8, "ReadStream", {
30802
30902
  get: function() {
30803
30903
  return ReadStream;
30804
30904
  },
@@ -30808,7 +30908,7 @@ var require_graceful_fs = __commonJS({
30808
30908
  enumerable: true,
30809
30909
  configurable: true
30810
30910
  });
30811
- Object.defineProperty(fs6, "WriteStream", {
30911
+ Object.defineProperty(fs8, "WriteStream", {
30812
30912
  get: function() {
30813
30913
  return WriteStream;
30814
30914
  },
@@ -30819,7 +30919,7 @@ var require_graceful_fs = __commonJS({
30819
30919
  configurable: true
30820
30920
  });
30821
30921
  var FileReadStream = ReadStream;
30822
- Object.defineProperty(fs6, "FileReadStream", {
30922
+ Object.defineProperty(fs8, "FileReadStream", {
30823
30923
  get: function() {
30824
30924
  return FileReadStream;
30825
30925
  },
@@ -30830,7 +30930,7 @@ var require_graceful_fs = __commonJS({
30830
30930
  configurable: true
30831
30931
  });
30832
30932
  var FileWriteStream = WriteStream;
30833
- Object.defineProperty(fs6, "FileWriteStream", {
30933
+ Object.defineProperty(fs8, "FileWriteStream", {
30834
30934
  get: function() {
30835
30935
  return FileWriteStream;
30836
30936
  },
@@ -30840,7 +30940,7 @@ var require_graceful_fs = __commonJS({
30840
30940
  enumerable: true,
30841
30941
  configurable: true
30842
30942
  });
30843
- function ReadStream(path9, options) {
30943
+ function ReadStream(path11, options) {
30844
30944
  if (this instanceof ReadStream)
30845
30945
  return fs$ReadStream.apply(this, arguments), this;
30846
30946
  else
@@ -30860,7 +30960,7 @@ var require_graceful_fs = __commonJS({
30860
30960
  }
30861
30961
  });
30862
30962
  }
30863
- function WriteStream(path9, options) {
30963
+ function WriteStream(path11, options) {
30864
30964
  if (this instanceof WriteStream)
30865
30965
  return fs$WriteStream.apply(this, arguments), this;
30866
30966
  else
@@ -30878,22 +30978,22 @@ var require_graceful_fs = __commonJS({
30878
30978
  }
30879
30979
  });
30880
30980
  }
30881
- function createReadStream2(path9, options) {
30882
- return new fs6.ReadStream(path9, options);
30981
+ function createReadStream2(path11, options) {
30982
+ return new fs8.ReadStream(path11, options);
30883
30983
  }
30884
- function createWriteStream2(path9, options) {
30885
- return new fs6.WriteStream(path9, options);
30984
+ function createWriteStream2(path11, options) {
30985
+ return new fs8.WriteStream(path11, options);
30886
30986
  }
30887
- var fs$open = fs6.open;
30888
- fs6.open = open;
30889
- function open(path9, flags, mode, cb) {
30987
+ var fs$open = fs8.open;
30988
+ fs8.open = open;
30989
+ function open(path11, flags, mode, cb) {
30890
30990
  if (typeof mode === "function")
30891
30991
  cb = mode, mode = null;
30892
- return go$open(path9, flags, mode, cb);
30893
- function go$open(path10, flags2, mode2, cb2, startTime) {
30894
- return fs$open(path10, flags2, mode2, function(err, fd) {
30992
+ return go$open(path11, flags, mode, cb);
30993
+ function go$open(path12, flags2, mode2, cb2, startTime) {
30994
+ return fs$open(path12, flags2, mode2, function(err, fd) {
30895
30995
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
30896
- enqueue([go$open, [path10, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
30996
+ enqueue([go$open, [path12, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
30897
30997
  else {
30898
30998
  if (typeof cb2 === "function")
30899
30999
  cb2.apply(this, arguments);
@@ -30901,20 +31001,20 @@ var require_graceful_fs = __commonJS({
30901
31001
  });
30902
31002
  }
30903
31003
  }
30904
- return fs6;
31004
+ return fs8;
30905
31005
  }
30906
31006
  function enqueue(elem) {
30907
31007
  debug("ENQUEUE", elem[0].name, elem[1]);
30908
- fs5[gracefulQueue].push(elem);
31008
+ fs7[gracefulQueue].push(elem);
30909
31009
  retry2();
30910
31010
  }
30911
31011
  var retryTimer;
30912
31012
  function resetQueue() {
30913
31013
  var now = Date.now();
30914
- for (var i2 = 0; i2 < fs5[gracefulQueue].length; ++i2) {
30915
- if (fs5[gracefulQueue][i2].length > 2) {
30916
- fs5[gracefulQueue][i2][3] = now;
30917
- fs5[gracefulQueue][i2][4] = now;
31014
+ for (var i2 = 0; i2 < fs7[gracefulQueue].length; ++i2) {
31015
+ if (fs7[gracefulQueue][i2].length > 2) {
31016
+ fs7[gracefulQueue][i2][3] = now;
31017
+ fs7[gracefulQueue][i2][4] = now;
30918
31018
  }
30919
31019
  }
30920
31020
  retry2();
@@ -30922,9 +31022,9 @@ var require_graceful_fs = __commonJS({
30922
31022
  function retry2() {
30923
31023
  clearTimeout(retryTimer);
30924
31024
  retryTimer = void 0;
30925
- if (fs5[gracefulQueue].length === 0)
31025
+ if (fs7[gracefulQueue].length === 0)
30926
31026
  return;
30927
- var elem = fs5[gracefulQueue].shift();
31027
+ var elem = fs7[gracefulQueue].shift();
30928
31028
  var fn = elem[0];
30929
31029
  var args = elem[1];
30930
31030
  var err = elem[2];
@@ -30946,7 +31046,7 @@ var require_graceful_fs = __commonJS({
30946
31046
  debug("RETRY", fn.name, args);
30947
31047
  fn.apply(null, args.concat([startTime]));
30948
31048
  } else {
30949
- fs5[gracefulQueue].push(elem);
31049
+ fs7[gracefulQueue].push(elem);
30950
31050
  }
30951
31051
  }
30952
31052
  if (retryTimer === void 0) {
@@ -31381,10 +31481,10 @@ var require_mtime_precision = __commonJS({
31381
31481
  "node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
31382
31482
  "use strict";
31383
31483
  var cacheSymbol = Symbol();
31384
- function probe(file, fs5, callback) {
31385
- const cachedPrecision = fs5[cacheSymbol];
31484
+ function probe(file, fs7, callback) {
31485
+ const cachedPrecision = fs7[cacheSymbol];
31386
31486
  if (cachedPrecision) {
31387
- return fs5.stat(file, (err, stat9) => {
31487
+ return fs7.stat(file, (err, stat9) => {
31388
31488
  if (err) {
31389
31489
  return callback(err);
31390
31490
  }
@@ -31392,16 +31492,16 @@ var require_mtime_precision = __commonJS({
31392
31492
  });
31393
31493
  }
31394
31494
  const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
31395
- fs5.utimes(file, mtime, mtime, (err) => {
31495
+ fs7.utimes(file, mtime, mtime, (err) => {
31396
31496
  if (err) {
31397
31497
  return callback(err);
31398
31498
  }
31399
- fs5.stat(file, (err2, stat9) => {
31499
+ fs7.stat(file, (err2, stat9) => {
31400
31500
  if (err2) {
31401
31501
  return callback(err2);
31402
31502
  }
31403
31503
  const precision = stat9.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
31404
- Object.defineProperty(fs5, cacheSymbol, { value: precision });
31504
+ Object.defineProperty(fs7, cacheSymbol, { value: precision });
31405
31505
  callback(null, stat9.mtime, precision);
31406
31506
  });
31407
31507
  });
@@ -31422,8 +31522,8 @@ var require_mtime_precision = __commonJS({
31422
31522
  var require_lockfile = __commonJS({
31423
31523
  "node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
31424
31524
  "use strict";
31425
- var path9 = __require("path");
31426
- var fs5 = require_graceful_fs();
31525
+ var path11 = __require("path");
31526
+ var fs7 = require_graceful_fs();
31427
31527
  var retry2 = require_retry2();
31428
31528
  var onExit2 = require_signal_exit3();
31429
31529
  var mtimePrecision = require_mtime_precision();
@@ -31433,7 +31533,7 @@ var require_lockfile = __commonJS({
31433
31533
  }
31434
31534
  function resolveCanonicalPath(file, options, callback) {
31435
31535
  if (!options.realpath) {
31436
- return callback(null, path9.resolve(file));
31536
+ return callback(null, path11.resolve(file));
31437
31537
  }
31438
31538
  options.fs.realpath(file, callback);
31439
31539
  }
@@ -31554,7 +31654,7 @@ var require_lockfile = __commonJS({
31554
31654
  update: null,
31555
31655
  realpath: true,
31556
31656
  retries: 0,
31557
- fs: fs5,
31657
+ fs: fs7,
31558
31658
  onCompromised: (err) => {
31559
31659
  throw err;
31560
31660
  },
@@ -31598,7 +31698,7 @@ var require_lockfile = __commonJS({
31598
31698
  }
31599
31699
  function unlock(file, options, callback) {
31600
31700
  options = {
31601
- fs: fs5,
31701
+ fs: fs7,
31602
31702
  realpath: true,
31603
31703
  ...options
31604
31704
  };
@@ -31620,7 +31720,7 @@ var require_lockfile = __commonJS({
31620
31720
  options = {
31621
31721
  stale: 1e4,
31622
31722
  realpath: true,
31623
- fs: fs5,
31723
+ fs: fs7,
31624
31724
  ...options
31625
31725
  };
31626
31726
  options.stale = Math.max(options.stale || 0, 2e3);
@@ -31659,16 +31759,16 @@ var require_lockfile = __commonJS({
31659
31759
  var require_adapter = __commonJS({
31660
31760
  "node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
31661
31761
  "use strict";
31662
- var fs5 = require_graceful_fs();
31663
- function createSyncFs(fs6) {
31762
+ var fs7 = require_graceful_fs();
31763
+ function createSyncFs(fs8) {
31664
31764
  const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
31665
- const newFs = { ...fs6 };
31765
+ const newFs = { ...fs8 };
31666
31766
  methods.forEach((method) => {
31667
31767
  newFs[method] = (...args) => {
31668
31768
  const callback = args.pop();
31669
31769
  let ret;
31670
31770
  try {
31671
- ret = fs6[`${method}Sync`](...args);
31771
+ ret = fs8[`${method}Sync`](...args);
31672
31772
  } catch (err) {
31673
31773
  return callback(err);
31674
31774
  }
@@ -31706,7 +31806,7 @@ var require_adapter = __commonJS({
31706
31806
  }
31707
31807
  function toSyncOptions(options) {
31708
31808
  options = { ...options };
31709
- options.fs = createSyncFs(options.fs || fs5);
31809
+ options.fs = createSyncFs(options.fs || fs7);
31710
31810
  if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
31711
31811
  throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
31712
31812
  }
@@ -32502,7 +32602,7 @@ async function modelsCommand() {
32502
32602
  }
32503
32603
 
32504
32604
  // src/commands/chat.ts
32505
- var import_react30 = __toESM(require_react(), 1);
32605
+ var import_react31 = __toESM(require_react(), 1);
32506
32606
 
32507
32607
  // node_modules/ink/build/render.js
32508
32608
  import { Stream } from "node:stream";
@@ -35042,7 +35142,7 @@ var checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
35042
35142
  output = output.filter((element, index) => output.indexOf(element) === index);
35043
35143
  if (endAnsiCode !== void 0) {
35044
35144
  const fistEscapeCode = wrapAnsi2(ansi_styles_default2.codes.get(Number.parseInt(endAnsiCode, 10)));
35045
- output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
35145
+ output = output.reduce((current2, next) => next === fistEscapeCode ? [next, ...current2] : [...current2, next], []);
35046
35146
  }
35047
35147
  }
35048
35148
  return output.join("");
@@ -36713,8 +36813,8 @@ function Text({ color, backgroundColor, dimColor = false, bold: bold2 = false, i
36713
36813
  }
36714
36814
 
36715
36815
  // node_modules/ink/build/components/ErrorOverview.js
36716
- var cleanupPath = (path9) => {
36717
- return path9?.replace(`file://${cwd()}/`, "");
36816
+ var cleanupPath = (path11) => {
36817
+ return path11?.replace(`file://${cwd()}/`, "");
36718
36818
  };
36719
36819
  var stackUtils = new import_stack_utils.default({
36720
36820
  cwd: cwd(),
@@ -37657,7 +37757,7 @@ var import_react20 = __toESM(require_react(), 1);
37657
37757
  var import_react21 = __toESM(require_react(), 1);
37658
37758
 
37659
37759
  // src/tui/REPL.tsx
37660
- var import_react28 = __toESM(require_react(), 1);
37760
+ var import_react29 = __toESM(require_react(), 1);
37661
37761
 
37662
37762
  // src/tui/Markdown.tsx
37663
37763
  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
@@ -37705,11 +37805,25 @@ function renderInline(s) {
37705
37805
 
37706
37806
  // src/tui/MessageList.tsx
37707
37807
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
37708
- var MessageList = ({ message: m }) => {
37709
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
37710
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, color: m.role === "user" ? "blue" : "green", children: m.role === "user" ? "you" : "kryven" }),
37711
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { paddingLeft: 2, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Markdown, { text: m.content ?? "" }) })
37712
- ] });
37808
+ var MessageList = ({ message: m, theme }) => {
37809
+ const isUser = m.role === "user";
37810
+ const accent = theme ? isUser ? theme.info : theme.accent : isUser ? "blue" : "green";
37811
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
37812
+ Box_default,
37813
+ {
37814
+ borderStyle: "single",
37815
+ borderTop: false,
37816
+ borderRight: false,
37817
+ borderBottom: false,
37818
+ borderColor: accent,
37819
+ paddingLeft: 1,
37820
+ flexDirection: "column",
37821
+ children: [
37822
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, color: accent, children: isUser ? "you" : "kryven" }),
37823
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Markdown, { text: m.content ?? "" }) })
37824
+ ]
37825
+ }
37826
+ ) });
37713
37827
  };
37714
37828
 
37715
37829
  // src/tui/MarkdownStream.tsx
@@ -37921,13 +38035,11 @@ var PromptInput = ({
37921
38035
  vimMode,
37922
38036
  vimCmdline,
37923
38037
  accentColor,
37924
- model,
37925
- mood,
38038
+ summary,
37926
38039
  themeColors
37927
38040
  }) => {
37928
38041
  const fg = themeColors?.fg ?? "#F5EFE6";
37929
38042
  const muted = themeColors?.muted ?? "#736560";
37930
- const info = themeColors?.info ?? "#7EA8C4";
37931
38043
  const accent = accentColor ?? "#8B5CF6";
37932
38044
  const isStatic = disabled || vimMode === "NORMAL";
37933
38045
  const barColor = disabled ? muted : vimMode === "NORMAL" ? "#F59E0B" : accent;
@@ -37946,11 +38058,9 @@ var PromptInput = ({
37946
38058
  borderLeftColor: barColor,
37947
38059
  children: [
37948
38060
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { children: isStatic ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: value ? fg : muted, children: vimCmdline != null ? `:${vimCmdline}` : value || ph }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(build_default, { value, onChange, onSubmit, placeholder: ph }) }),
37949
- (mood || model) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, flexDirection: "row", children: [
37950
- mood ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: info, children: mood }) : null,
37951
- mood && model ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: muted, children: " \xB7 " }) : null,
37952
- model ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: fg, children: model }) : null,
37953
- vimMode ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: muted, children: ` ${vimMode === "NORMAL" ? "N" : "I"}` }) : null
38061
+ (summary || vimMode) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { marginTop: 1, flexDirection: "row", children: [
38062
+ summary ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: muted, children: summary }) : null,
38063
+ vimMode ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: muted, children: `${summary ? " " : ""}${vimMode === "NORMAL" ? "N" : "I"}` }) : null
37954
38064
  ] })
37955
38065
  ]
37956
38066
  }
@@ -38249,79 +38359,6 @@ var CompletionMenu = ({ items, selected }) => /* @__PURE__ */ (0, import_jsx_run
38249
38359
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "gray", dimColor: true, children: "Tab to complete" })
38250
38360
  ] });
38251
38361
 
38252
- // src/tui/ModelPicker.tsx
38253
- var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
38254
- var VISIBLE = 10;
38255
- var ModelPicker = ({ models, selected, current }) => {
38256
- const total = models.length;
38257
- const start = Math.max(
38258
- 0,
38259
- Math.min(selected - Math.floor(VISIBLE / 2), Math.max(0, total - VISIBLE))
38260
- );
38261
- const end = Math.min(total, start + VISIBLE);
38262
- const windowed = models.slice(start, end);
38263
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
38264
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
38265
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: true, color: "cyan", children: "Select a model " }),
38266
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "gray", children: [
38267
- "\u2014 \u2191/\u2193 move \xB7 Enter switch \xB7 Esc cancel (",
38268
- selected + 1,
38269
- "/",
38270
- total,
38271
- ")"
38272
- ] })
38273
- ] }),
38274
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", dimColor: true, children: start > 0 ? " \u2191 more" : " " }),
38275
- windowed.map((m, i2) => {
38276
- const idx = start + i2;
38277
- const isSel = idx === selected;
38278
- const isCur = m.id === current;
38279
- const cost = m.costIn != null && m.costOut != null ? ` $${m.costIn.toFixed(2)}/$${m.costOut.toFixed(2)}` : "";
38280
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
38281
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { width: 2, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "cyanBright", children: isSel ? "\u25B6" : " " }) }),
38282
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { width: 30, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: isSel ? "greenBright" : "white", bold: isSel, children: [
38283
- m.id,
38284
- isCur ? " \u25CF" : ""
38285
- ] }) }),
38286
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "gray", children: [
38287
- m.publisher,
38288
- m.description ? ` \u2014 ${m.description}` : "",
38289
- cost
38290
- ] })
38291
- ] }, m.id);
38292
- }),
38293
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", dimColor: true, children: end < total ? " \u2193 more" : " " })
38294
- ] });
38295
- };
38296
-
38297
- // src/tui/Wordmark.tsx
38298
- var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
38299
- var ROWS = [
38300
- "## ## ##### ## ## ## ## ##### ## ##",
38301
- "## ## ## ## #### ## ## ## ### ##",
38302
- "#### ##### ## ## ## ##### #### ##",
38303
- "## ## ## ## ## ## ## ## ## ####",
38304
- "## ## ## ## ## ### ##### ## ###"
38305
- ];
38306
- var Wordmark = ({ muted, fg }) => {
38307
- const rows = ROWS.map((r) => r.replace(/#/g, "\u2588"));
38308
- const width = Math.max(...rows.map((r) => r.length));
38309
- const mid = Math.floor(width / 2);
38310
- let split = mid;
38311
- outer: for (let d = 0; d <= mid; d++) {
38312
- for (const c3 of [mid - d, mid + d]) {
38313
- if (c3 >= 0 && c3 <= width && rows.every((r) => (r[c3] ?? " ") === " ")) {
38314
- split = c3;
38315
- break outer;
38316
- }
38317
- }
38318
- }
38319
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { flexDirection: "column", children: rows.map((line, i2) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "row", children: [
38320
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: muted, children: line.slice(0, split) }),
38321
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, color: fg, children: line.slice(split) })
38322
- ] }, i2)) });
38323
- };
38324
-
38325
38362
  // src/commands-palette/parser.ts
38326
38363
  function parseSlash(input) {
38327
38364
  const t = input.trimStart();
@@ -38385,8 +38422,6 @@ var MODELS = [
38385
38422
  { id: "qwen3-235b", publisher: "Alibaba", description: "Workhorse general" },
38386
38423
  // Moonshot
38387
38424
  { id: "kimi-k2-thinking", publisher: "Moonshot", description: "Thinking budget" },
38388
- // Zhipu
38389
- { id: "glm-4.7", publisher: "Zhipu", description: "Long-context all-rounder" },
38390
38425
  // xAI
38391
38426
  { id: "grok-4.20-reasoning", publisher: "xAI", description: "Reasoning" },
38392
38427
  { id: "grok-4.1-fast-reasoning", publisher: "xAI", description: "Fast reasoning" },
@@ -38396,6 +38431,13 @@ var MODELS = [
38396
38431
  { id: "mistral-small-3.2-abliterated", publisher: "fabhaus", description: "Mistral Small 3.2, abliterated" }
38397
38432
  ];
38398
38433
  var KNOWN_IDS = new Set(MODELS.map((m) => m.id));
38434
+ var UNCENSORED_MODEL_IDS = /* @__PURE__ */ new Set([
38435
+ "kryven-flash",
38436
+ "kryven-extended",
38437
+ "kryven-coder",
38438
+ "huihui-gemma-4-26b-abliterated",
38439
+ "mistral-small-3.2-abliterated"
38440
+ ]);
38399
38441
  function publisherFor(id) {
38400
38442
  return MODELS.find((m) => m.id === id)?.publisher ?? "(unknown)";
38401
38443
  }
@@ -38445,6 +38487,83 @@ var moodCommand = {
38445
38487
  }
38446
38488
  };
38447
38489
 
38490
+ // src/tui/ModelPicker.tsx
38491
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
38492
+ var VISIBLE = 10;
38493
+ var ModelPicker = ({ models, selected, current: current2 }) => {
38494
+ const total = models.length;
38495
+ const start = Math.max(
38496
+ 0,
38497
+ Math.min(selected - Math.floor(VISIBLE / 2), Math.max(0, total - VISIBLE))
38498
+ );
38499
+ const end = Math.min(total, start + VISIBLE);
38500
+ const windowed = models.slice(start, end);
38501
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
38502
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
38503
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: true, color: "cyan", children: "Select a model " }),
38504
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "gray", children: [
38505
+ "\u2014 \u2191/\u2193 move \xB7 Enter switch \xB7 Esc cancel (",
38506
+ selected + 1,
38507
+ "/",
38508
+ total,
38509
+ ")"
38510
+ ] })
38511
+ ] }),
38512
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", dimColor: true, children: start > 0 ? " \u2191 more" : " " }),
38513
+ windowed.map((m, i2) => {
38514
+ const idx = start + i2;
38515
+ const isSel = idx === selected;
38516
+ const isCur = m.id === current2;
38517
+ const cost = m.costIn != null && m.costOut != null ? ` $${m.costIn.toFixed(2)}/$${m.costOut.toFixed(2)}` : "";
38518
+ const isUncensored = UNCENSORED_MODEL_IDS.has(m.id);
38519
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
38520
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { width: 2, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "cyanBright", children: isSel ? "\u25B6" : " " }) }),
38521
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { width: 30, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: isSel ? "greenBright" : "white", bold: isSel, children: [
38522
+ m.id,
38523
+ isCur ? " \u25CF" : ""
38524
+ ] }) }),
38525
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "gray", children: [
38526
+ m.publisher,
38527
+ m.description ? ` \u2014 ${m.description}` : "",
38528
+ cost
38529
+ ] }),
38530
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { flexGrow: 1 }),
38531
+ isUncensored ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "black", backgroundColor: "green", children: " Uncensored " }) }) : null,
38532
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "black", backgroundColor: "cyan", children: " Private " }) })
38533
+ ] }, m.id);
38534
+ }),
38535
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", dimColor: true, children: end < total ? " \u2193 more" : " " })
38536
+ ] });
38537
+ };
38538
+
38539
+ // src/tui/Wordmark.tsx
38540
+ var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
38541
+ var ROWS = [
38542
+ "## ## ##### ## ## ## ## ##### ## ##",
38543
+ "## ## ## ## #### ## ## ## ### ##",
38544
+ "#### ##### ## ## ## ##### #### ##",
38545
+ "## ## ## ## ## ## ## ## ## ####",
38546
+ "## ## ## ## ## ### ##### ## ###"
38547
+ ];
38548
+ var Wordmark = ({ muted, fg }) => {
38549
+ const rows = ROWS.map((r) => r.replace(/#/g, "\u2588"));
38550
+ const width = Math.max(...rows.map((r) => r.length));
38551
+ const mid = Math.floor(width / 2);
38552
+ let split = mid;
38553
+ outer: for (let d = 0; d <= mid; d++) {
38554
+ for (const c3 of [mid - d, mid + d]) {
38555
+ if (c3 >= 0 && c3 <= width && rows.every((r) => (r[c3] ?? " ") === " ")) {
38556
+ split = c3;
38557
+ break outer;
38558
+ }
38559
+ }
38560
+ }
38561
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box_default, { flexDirection: "column", children: rows.map((line, i2) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "row", children: [
38562
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: muted, children: line.slice(0, split) }),
38563
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, color: fg, children: line.slice(split) })
38564
+ ] }, i2)) });
38565
+ };
38566
+
38448
38567
  // src/tui/input/complete.ts
38449
38568
  import { opendirSync } from "node:fs";
38450
38569
  import { join as join26, dirname as dirname12, basename as basename5 } from "node:path";
@@ -38504,6 +38623,118 @@ var exitCommand = {
38504
38623
  name: "exit"
38505
38624
  };
38506
38625
 
38626
+ // src/agent/effort-prompts.ts
38627
+ var EFFORT_LEVELS = [
38628
+ "low",
38629
+ "medium",
38630
+ "high",
38631
+ "ultra",
38632
+ "self-improve",
38633
+ "forge"
38634
+ ];
38635
+ var EFFORT_DESCRIPTIONS = {
38636
+ low: "Default \u2014 a single direct pass. Fast and cheap.",
38637
+ medium: "3 agents: plan \u2192 implement \u2192 refine.",
38638
+ high: "5 agents: plan \u2192 implement \u2192 refine \u2192 research (web) \u2192 research-refine.",
38639
+ ultra: "7 agents: high + adversarial verify \u2192 harden.",
38640
+ "self-improve": "medium + 2 self-improvement rounds + a critique/synthesis pass.",
38641
+ forge: "self-improve + the conductor-forge MoE-research pipeline (define purpose first)."
38642
+ };
38643
+ var PLAN = {
38644
+ name: "plan",
38645
+ label: "Plan",
38646
+ addendum: "EFFORT STAGE \u2014 PLANNER. Your ONLY job this turn is to produce a comprehensive, concrete plan for the user's request, grounded in the actual project (read files/search as needed) and the chat context. Output a short numbered plan: the files to change, the approach, edge cases, and how you'll verify. Do NOT edit any files yet \u2014 planning only.",
38647
+ toolMode: "read"
38648
+ };
38649
+ var IMPLEMENT = {
38650
+ name: "implement",
38651
+ label: "Implement",
38652
+ instruction: "Now IMPLEMENT the plan above. Make the actual edits with your tools, step by step, reading before editing. Follow the plan; adapt only where a tool result contradicts it. Do not re-plan or summarize \u2014 just execute.",
38653
+ addendum: "EFFORT STAGE \u2014 IMPLEMENTER. Execute the plan from the previous turn precisely using your tools. Minimal, targeted edits; read before editing; verify with the build/test tool when available.",
38654
+ toolMode: "all"
38655
+ };
38656
+ var REFINE = {
38657
+ name: "refine",
38658
+ label: "Refine",
38659
+ instruction: "Now REFINE the implementation. Re-read what was changed, hunt for correctness bugs, missed cases, inconsistencies, and rough edges, and fix them with your tools. Then stop.",
38660
+ addendum: "EFFORT STAGE \u2014 REFINER. Critically review the implementation so far using the full chat context and the actual changed files. Fix real issues with your tools; do not rewrite working code for style alone.",
38661
+ toolMode: "all"
38662
+ };
38663
+ var RESEARCH = {
38664
+ name: "research",
38665
+ label: "Research",
38666
+ instruction: "Now RESEARCH. Use the web_search tool to find resources, documentation, and relevant GitHub repos for this task. Summarize the most useful findings (with URLs) as a short report \u2014 do not edit files in this stage.",
38667
+ addendum: "EFFORT STAGE \u2014 RESEARCHER. Use web_search to gather high-quality, relevant resources (docs, libraries, GitHub repos, examples) for the task. Produce a concise findings report with links. No file edits.",
38668
+ toolMode: "research"
38669
+ };
38670
+ var RESEARCH_REFINE = {
38671
+ name: "research-refine",
38672
+ label: "Apply research",
38673
+ instruction: "Now apply the research above: make a second round of improvements to the project informed by the findings (better patterns, fixes, or additions). Use your tools, then stop.",
38674
+ addendum: "EFFORT STAGE \u2014 RESEARCH-REFINER. Improve the implementation using the research findings from the previous turn. Real, targeted edits via your tools.",
38675
+ toolMode: "all"
38676
+ };
38677
+ var VERIFY = {
38678
+ name: "verify",
38679
+ label: "Verify",
38680
+ instruction: "Now VERIFY adversarially. Try to BREAK the current implementation: read the changed files, look for correctness bugs, edge cases, security issues, and broken assumptions, and run the build/tests if available. Report a numbered list of concrete problems (or 'no issues found'). Do not fix yet.",
38681
+ addendum: "EFFORT STAGE \u2014 VERIFIER (adversarial). Assume the implementation has bugs and find them. Be specific and skeptical; cite file:line. You may run the build/tests (read-only) but must NOT edit files. List concrete issues only.",
38682
+ toolMode: "verify"
38683
+ };
38684
+ var HARDEN = {
38685
+ name: "harden",
38686
+ label: "Harden",
38687
+ instruction: "Now HARDEN: fix every real issue the verification stage found, using your tools. Re-run the build/tests if available. Then stop.",
38688
+ addendum: "EFFORT STAGE \u2014 HARDENER. Fix the issues raised by the verifier with precise edits; re-verify with the build/test tool. Do not introduce new scope.",
38689
+ toolMode: "all"
38690
+ };
38691
+ var improveRound = (n2) => ({
38692
+ name: `improve-${n2}`,
38693
+ label: `Improve ${n2}`,
38694
+ instruction: `Self-improvement round ${n2}: re-examine the whole solution end-to-end, find the single biggest weakness remaining (correctness, robustness, clarity, or completeness), and fix it with your tools. Then stop.`,
38695
+ addendum: "EFFORT STAGE \u2014 SELF-IMPROVER. Make the solution materially better than the previous round. Target the highest-impact remaining weakness; real edits only.",
38696
+ toolMode: "all"
38697
+ });
38698
+ var CRITIQUE = {
38699
+ name: "critique",
38700
+ label: "Critique",
38701
+ instruction: "Final CRITIQUE + synthesis: act as a senior reviewer double-checking everything. Diagnose any remaining problems across the whole change, apply final fixes with your tools, and leave the solution in its best state. Then stop.",
38702
+ addendum: "EFFORT STAGE \u2014 CRITIC/SYNTHESIZER. Double-check the entire result, diagnose weaknesses the implementers may have missed, and apply the final improving fixes.",
38703
+ toolMode: "all"
38704
+ };
38705
+ var EFFORT_STAGES = {
38706
+ low: [],
38707
+ medium: [PLAN, IMPLEMENT, REFINE],
38708
+ high: [PLAN, IMPLEMENT, REFINE, RESEARCH, RESEARCH_REFINE],
38709
+ ultra: [PLAN, IMPLEMENT, REFINE, RESEARCH, RESEARCH_REFINE, VERIFY, HARDEN],
38710
+ "self-improve": [PLAN, IMPLEMENT, REFINE, improveRound(1), improveRound(2), CRITIQUE],
38711
+ forge: [PLAN, IMPLEMENT, REFINE, improveRound(1), improveRound(2), CRITIQUE]
38712
+ };
38713
+
38714
+ // src/commands-palette/builtin/effort.ts
38715
+ var effortCommand = {
38716
+ name: "effort",
38717
+ description: "Set the effort level (low | medium | high | ultra | self-improve | forge)",
38718
+ argHint: "[level]",
38719
+ run: (args, ctx) => {
38720
+ const trimmed = args.trim().toLowerCase();
38721
+ if (!trimmed) {
38722
+ return { type: "effort-picker" };
38723
+ }
38724
+ const match = EFFORT_LEVELS.find(
38725
+ (l) => l === trimmed || l.replace(/[^a-z]/g, "") === trimmed.replace(/[^a-z]/g, "")
38726
+ );
38727
+ if (!match) {
38728
+ return {
38729
+ type: "error",
38730
+ message: `Unknown effort "${trimmed}". Options: ${EFFORT_LEVELS.join(", ")}.`
38731
+ };
38732
+ }
38733
+ ctx.setEffort?.(match);
38734
+ return { type: "ack", message: `Effort: ${match} \u2014 ${EFFORT_DESCRIPTIONS[match]}` };
38735
+ }
38736
+ };
38737
+
38507
38738
  // src/commands-palette/builtin/login.ts
38508
38739
  init_crypto();
38509
38740
  var loginCommand2 = {
@@ -38759,7 +38990,7 @@ function normalizeArrayFields(fm) {
38759
38990
  }
38760
38991
  return fm;
38761
38992
  }
38762
- function parseSkillFile(path9, src) {
38993
+ function parseSkillFile(path11, src) {
38763
38994
  const m = src.match(FRONTMATTER_RE);
38764
38995
  if (!m) {
38765
38996
  return { frontmatter: {}, body: src };
@@ -38768,7 +38999,7 @@ function parseSkillFile(path9, src) {
38768
38999
  try {
38769
39000
  frontmatter = normalizeArrayFields(parseSimpleYaml(m[1]));
38770
39001
  } catch (err) {
38771
- logger.warn("skill: yaml parse failed", path9, String(err));
39002
+ logger.warn("skill: yaml parse failed", path11, String(err));
38772
39003
  }
38773
39004
  const body = src.slice(m[0].length);
38774
39005
  return { frontmatter, body };
@@ -40620,12 +40851,12 @@ var ThemeManager = class extends EventEmitter4 {
40620
40851
  async loadAll() {
40621
40852
  await mkdir4(THEMES_DIR, { recursive: true, mode: 448 });
40622
40853
  for (const t of BUILTIN_THEMES) {
40623
- const path9 = join10(THEMES_DIR, `${t.name}.json`);
40854
+ const path11 = join10(THEMES_DIR, `${t.name}.json`);
40624
40855
  try {
40625
- await writeFile3(path9, JSON.stringify(t, null, 2), { flag: "wx" });
40856
+ await writeFile3(path11, JSON.stringify(t, null, 2), { flag: "wx" });
40626
40857
  } catch (err) {
40627
40858
  if (err?.code !== "EEXIST") {
40628
- logger.warn("theme: cannot materialize built-in", path9, String(err));
40859
+ logger.warn("theme: cannot materialize built-in", path11, String(err));
40629
40860
  }
40630
40861
  }
40631
40862
  }
@@ -40633,15 +40864,15 @@ var ThemeManager = class extends EventEmitter4 {
40633
40864
  const files = await readdir4(THEMES_DIR);
40634
40865
  for (const f of files) {
40635
40866
  if (!f.endsWith(".json")) continue;
40636
- const path9 = join10(THEMES_DIR, f);
40867
+ const path11 = join10(THEMES_DIR, f);
40637
40868
  try {
40638
- const raw = await readFile5(path9, "utf8");
40869
+ const raw = await readFile5(path11, "utf8");
40639
40870
  const parsed = JSON.parse(raw);
40640
40871
  if (parsed?.name && parsed?.colors) {
40641
- this.themes.set(parsed.name, { ...parsed, sourcePath: path9 });
40872
+ this.themes.set(parsed.name, { ...parsed, sourcePath: path11 });
40642
40873
  }
40643
40874
  } catch (err) {
40644
- logger.warn("theme: parse failed", path9, String(err));
40875
+ logger.warn("theme: parse failed", path11, String(err));
40645
40876
  }
40646
40877
  }
40647
40878
  } catch (err) {
@@ -40660,20 +40891,20 @@ var ThemeManager = class extends EventEmitter4 {
40660
40891
  try {
40661
40892
  this.watcher = fsWatch(THEMES_DIR, { persistent: false }, async (_event, filename) => {
40662
40893
  if (!filename || !filename.endsWith(".json")) return;
40663
- const path9 = join10(THEMES_DIR, filename);
40664
- if (!existsSync10(path9)) return;
40894
+ const path11 = join10(THEMES_DIR, filename);
40895
+ if (!existsSync10(path11)) return;
40665
40896
  try {
40666
- const raw = await readFile5(path9, "utf8");
40897
+ const raw = await readFile5(path11, "utf8");
40667
40898
  const parsed = JSON.parse(raw);
40668
40899
  if (parsed?.name && parsed?.colors) {
40669
- this.themes.set(parsed.name, { ...parsed, sourcePath: path9 });
40900
+ this.themes.set(parsed.name, { ...parsed, sourcePath: path11 });
40670
40901
  if (this.active.name === parsed.name) {
40671
40902
  this.active = this.themes.get(parsed.name);
40672
40903
  this.emit("change", this.active);
40673
40904
  }
40674
40905
  }
40675
40906
  } catch (err) {
40676
- logger.warn("theme: hot-reload parse failed", path9, String(err));
40907
+ logger.warn("theme: hot-reload parse failed", path11, String(err));
40677
40908
  }
40678
40909
  });
40679
40910
  } catch (err) {
@@ -40701,7 +40932,7 @@ init_load();
40701
40932
  var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
40702
40933
  var ThemePanel = ({
40703
40934
  entries,
40704
- current
40935
+ current: current2
40705
40936
  }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 1, children: [
40706
40937
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { bold: true, color: "magenta", children: "Themes" }),
40707
40938
  entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Box_default, { children: [
@@ -40713,7 +40944,7 @@ var ThemePanel = ({
40713
40944
  ] }, e.name)),
40714
40945
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Text, { color: "gray", children: [
40715
40946
  "Active: ",
40716
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { color: "magentaBright", children: current }),
40947
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { color: "magentaBright", children: current2 }),
40717
40948
  " \xB7 ",
40718
40949
  "/theme ",
40719
40950
  "<name>",
@@ -40729,15 +40960,15 @@ var themeCommand = {
40729
40960
  const trimmed = args.trim().toLowerCase();
40730
40961
  if (!trimmed) {
40731
40962
  const all2 = tm.list();
40732
- const current = tm.current();
40963
+ const current2 = tm.current();
40733
40964
  const entries = all2.map((t) => ({
40734
40965
  name: t.name,
40735
- active: t.name === current.name,
40966
+ active: t.name === current2.name,
40736
40967
  accent: t.colors.accent
40737
40968
  }));
40738
40969
  return {
40739
40970
  type: "render",
40740
- element: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ThemePanel, { entries, current: current.name })
40971
+ element: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ThemePanel, { entries, current: current2.name })
40741
40972
  };
40742
40973
  }
40743
40974
  if (trimmed === "cycle") {
@@ -41583,9 +41814,9 @@ Valid actions: ${[...VALID_ACTIONS].join(", ")}`
41583
41814
  };
41584
41815
  }
41585
41816
  const mgr = getKeybindings();
41586
- const current = mgr.list();
41817
+ const current2 = mgr.list();
41587
41818
  const merged = /* @__PURE__ */ new Map();
41588
- for (const b of current) merged.set(b.key, b);
41819
+ for (const b of current2) merged.set(b.key, b);
41589
41820
  merged.set(key, { key, action });
41590
41821
  const next = [...merged.values()];
41591
41822
  try {
@@ -41611,15 +41842,15 @@ Valid actions: ${[...VALID_ACTIONS].join(", ")}`
41611
41842
  };
41612
41843
  }
41613
41844
  const mgr = getKeybindings();
41614
- const current = mgr.list();
41615
- const found = current.some((b) => b.key === key);
41845
+ const current2 = mgr.list();
41846
+ const found = current2.some((b) => b.key === key);
41616
41847
  if (!found) {
41617
41848
  return {
41618
41849
  type: "error",
41619
41850
  message: `No binding for key "${key}". Run /keybindings to see active bindings.`
41620
41851
  };
41621
41852
  }
41622
- const next = current.filter((b) => b.key !== key);
41853
+ const next = current2.filter((b) => b.key !== key);
41623
41854
  try {
41624
41855
  await saveToDisk(next);
41625
41856
  await mgr.loadFromDisk();
@@ -41769,9 +42000,9 @@ function getMemoryPath() {
41769
42000
  return join16(getConfigDir(), "memory.json");
41770
42001
  }
41771
42002
  async function loadNotes() {
41772
- const path9 = getMemoryPath();
42003
+ const path11 = getMemoryPath();
41773
42004
  try {
41774
- const raw = await readFile8(path9, "utf8");
42005
+ const raw = await readFile8(path11, "utf8");
41775
42006
  const parsed = JSON.parse(raw);
41776
42007
  if (Array.isArray(parsed)) {
41777
42008
  return parsed.filter(
@@ -41783,16 +42014,16 @@ async function loadNotes() {
41783
42014
  return [];
41784
42015
  }
41785
42016
  async function saveNotes(notes) {
41786
- const path9 = getMemoryPath();
41787
- await mkdir7(dirname8(path9), { recursive: true });
41788
- await writeFile6(path9, JSON.stringify(notes, null, 2) + "\n", "utf8");
42017
+ const path11 = getMemoryPath();
42018
+ await mkdir7(dirname8(path11), { recursive: true });
42019
+ await writeFile6(path11, JSON.stringify(notes, null, 2) + "\n", "utf8");
41789
42020
  }
41790
42021
  function fmtDate2(ts) {
41791
42022
  const d = new Date(ts);
41792
42023
  const pad = (n2) => String(n2).padStart(2, "0");
41793
42024
  return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
41794
42025
  }
41795
- var NoteListPanel = ({ notes, path: path9 }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
42026
+ var NoteListPanel = ({ notes, path: path11 }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
41796
42027
  Box_default,
41797
42028
  {
41798
42029
  flexDirection: "column",
@@ -41808,7 +42039,7 @@ var NoteListPanel = ({ notes, path: path9 }) => /* @__PURE__ */ (0, import_jsx_r
41808
42039
  " ",
41809
42040
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Text, { color: "gray", dimColor: true, children: [
41810
42041
  "(",
41811
- path9,
42042
+ path11,
41812
42043
  ")"
41813
42044
  ] })
41814
42045
  ] }),
@@ -41961,21 +42192,21 @@ function projectSettingsPath(cwd2) {
41961
42192
  function settingsPathForScope(scope, cwd2) {
41962
42193
  return scope === "global" ? globalSettingsPath() : projectSettingsPath(cwd2);
41963
42194
  }
41964
- function readSettings(path9) {
41965
- if (!existsSync12(path9)) return {};
42195
+ function readSettings(path11) {
42196
+ if (!existsSync12(path11)) return {};
41966
42197
  try {
41967
- return JSON.parse(readFileSync8(path9, "utf8"));
42198
+ return JSON.parse(readFileSync8(path11, "utf8"));
41968
42199
  } catch {
41969
42200
  return {};
41970
42201
  }
41971
42202
  }
41972
- function writeSettings(path9, settings) {
41973
- const dir = dirname9(path9);
42203
+ function writeSettings(path11, settings) {
42204
+ const dir = dirname9(path11);
41974
42205
  if (!existsSync12(dir)) mkdirSync4(dir, { recursive: true });
41975
- writeFileSync5(path9, JSON.stringify(settings, null, 2) + "\n", "utf8");
42206
+ writeFileSync5(path11, JSON.stringify(settings, null, 2) + "\n", "utf8");
41976
42207
  }
41977
- function readHooks(path9) {
41978
- const settings = readSettings(path9);
42208
+ function readHooks(path11) {
42209
+ const settings = readSettings(path11);
41979
42210
  const raw = settings.hooks;
41980
42211
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
41981
42212
  const out = {};
@@ -41996,32 +42227,32 @@ function readHooks(path9) {
41996
42227
  }
41997
42228
  return out;
41998
42229
  }
41999
- function writeHooks(path9, hooks) {
42000
- const settings = readSettings(path9);
42230
+ function writeHooks(path11, hooks) {
42231
+ const settings = readSettings(path11);
42001
42232
  settings.hooks = hooks;
42002
- writeSettings(path9, settings);
42233
+ writeSettings(path11, settings);
42003
42234
  }
42004
- function addHook(path9, event, command) {
42005
- const hooks = readHooks(path9);
42235
+ function addHook(path11, event, command) {
42236
+ const hooks = readHooks(path11);
42006
42237
  const list = hooks[event] ?? [];
42007
42238
  const newEntry = { command, enabled: true };
42008
42239
  list.push(newEntry);
42009
42240
  hooks[event] = list;
42010
- writeHooks(path9, hooks);
42241
+ writeHooks(path11, hooks);
42011
42242
  return { added: true, index: list.length - 1 };
42012
42243
  }
42013
- function setEnabled(path9, event, index, enabled) {
42014
- const hooks = readHooks(path9);
42244
+ function setEnabled(path11, event, index, enabled) {
42245
+ const hooks = readHooks(path11);
42015
42246
  const list = hooks[event];
42016
42247
  if (!list || list.length === 0) return { ok: false, reason: "no-event" };
42017
42248
  if (index < 0 || index >= list.length) return { ok: false, reason: "out-of-range" };
42018
42249
  list[index] = { ...list[index], enabled };
42019
42250
  hooks[event] = list;
42020
- writeHooks(path9, hooks);
42251
+ writeHooks(path11, hooks);
42021
42252
  return { ok: true };
42022
42253
  }
42023
- function removeHook(path9, event, index) {
42024
- const hooks = readHooks(path9);
42254
+ function removeHook(path11, event, index) {
42255
+ const hooks = readHooks(path11);
42025
42256
  const list = hooks[event];
42026
42257
  if (!list || list.length === 0) return { ok: false, reason: "no-event" };
42027
42258
  if (index < 0 || index >= list.length) return { ok: false, reason: "out-of-range" };
@@ -42031,17 +42262,17 @@ function removeHook(path9, event, index) {
42031
42262
  } else {
42032
42263
  hooks[event] = list;
42033
42264
  }
42034
- writeHooks(path9, hooks);
42265
+ writeHooks(path11, hooks);
42035
42266
  return { ok: true };
42036
42267
  }
42037
- function editHook(path9, event, index, newCommand2) {
42038
- const hooks = readHooks(path9);
42268
+ function editHook(path11, event, index, newCommand2) {
42269
+ const hooks = readHooks(path11);
42039
42270
  const list = hooks[event];
42040
42271
  if (!list || list.length === 0) return { ok: false, reason: "no-event" };
42041
42272
  if (index < 0 || index >= list.length) return { ok: false, reason: "out-of-range" };
42042
42273
  list[index] = { ...list[index], command: newCommand2 };
42043
42274
  hooks[event] = list;
42044
- writeHooks(path9, hooks);
42275
+ writeHooks(path11, hooks);
42045
42276
  return { ok: true };
42046
42277
  }
42047
42278
  var HookRow = ({ index, entry }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Box_default, { flexDirection: "row", marginLeft: 2, children: [
@@ -42198,14 +42429,14 @@ var hooksCommand = {
42198
42429
  message: `Usage: /hooks add ${rawScope} ${event} <command>`
42199
42430
  };
42200
42431
  }
42201
- const path9 = settingsPathForScope(scope, ctx.cwd);
42432
+ const path11 = settingsPathForScope(scope, ctx.cwd);
42202
42433
  try {
42203
- const { index } = addHook(path9, event, command);
42434
+ const { index } = addHook(path11, event, command);
42204
42435
  return {
42205
42436
  type: "ack",
42206
42437
  message: `Added hook [${index}] to ${scope}/${event}:
42207
42438
  ${command}
42208
- Saved to ${path9}`
42439
+ Saved to ${path11}`
42209
42440
  };
42210
42441
  } catch (err) {
42211
42442
  return { type: "error", message: `Failed to write hook: ${err.message}` };
@@ -42230,9 +42461,9 @@ Saved to ${path9}`
42230
42461
  message: `Usage: /hooks ${sub} ${rawScope} <event> <index>`
42231
42462
  };
42232
42463
  }
42233
- const path9 = settingsPathForScope(scope, ctx.cwd);
42464
+ const path11 = settingsPathForScope(scope, ctx.cwd);
42234
42465
  try {
42235
- const result = setEnabled(path9, event, index, enabled);
42466
+ const result = setEnabled(path11, event, index, enabled);
42236
42467
  if (!result.ok) {
42237
42468
  if (result.reason === "no-event") {
42238
42469
  return {
@@ -42272,9 +42503,9 @@ Saved to ${path9}`
42272
42503
  message: `Usage: /hooks edit ${rawScope} <event> <index> <new-command>`
42273
42504
  };
42274
42505
  }
42275
- const path9 = settingsPathForScope(scope, ctx.cwd);
42506
+ const path11 = settingsPathForScope(scope, ctx.cwd);
42276
42507
  try {
42277
- const result = editHook(path9, event, index, newCommand2);
42508
+ const result = editHook(path11, event, index, newCommand2);
42278
42509
  if (!result.ok) {
42279
42510
  if (result.reason === "no-event") {
42280
42511
  return {
@@ -42314,9 +42545,9 @@ Saved to ${path9}`
42314
42545
  message: `Usage: /hooks rm ${rawScope} <event> <index>`
42315
42546
  };
42316
42547
  }
42317
- const path9 = settingsPathForScope(scope, ctx.cwd);
42548
+ const path11 = settingsPathForScope(scope, ctx.cwd);
42318
42549
  try {
42319
- const result = removeHook(path9, event, index);
42550
+ const result = removeHook(path11, event, index);
42320
42551
  if (!result.ok) {
42321
42552
  if (result.reason === "no-event") {
42322
42553
  return {
@@ -43552,8 +43783,8 @@ async function listBgAgents() {
43552
43783
  const tailBytes = Math.min(st.size, 4096);
43553
43784
  if (tailBytes > 0) {
43554
43785
  const buf = Buffer.alloc(tailBytes);
43555
- const fs5 = await import("node:fs/promises");
43556
- const fd = await fs5.open(log, "r");
43786
+ const fs7 = await import("node:fs/promises");
43787
+ const fd = await fs7.open(log, "r");
43557
43788
  try {
43558
43789
  await fd.read(buf, 0, tailBytes, st.size - tailBytes);
43559
43790
  } finally {
@@ -43629,8 +43860,8 @@ async function attachBgAgent(id, onLine, signal) {
43629
43860
  const s = await stat8(p);
43630
43861
  if (s.size > pos) {
43631
43862
  const buf = Buffer.alloc(s.size - pos);
43632
- const fs5 = await import("node:fs/promises");
43633
- const fd = await fs5.open(p, "r");
43863
+ const fs7 = await import("node:fs/promises");
43864
+ const fd = await fs7.open(p, "r");
43634
43865
  try {
43635
43866
  await fd.read(buf, 0, buf.length, pos);
43636
43867
  flush(decoder.write(buf), false);
@@ -43719,7 +43950,7 @@ async function runBgAgent(id) {
43719
43950
  apiKey: cfg.apiKey,
43720
43951
  baseUrl: cfg.apiBaseUrl,
43721
43952
  clientType: "ide",
43722
- userAgent: `kryven-cli-bg/${"0.2.5"}`
43953
+ userAgent: `kryven-cli-bg/${"0.2.7"}`
43723
43954
  });
43724
43955
  const transcriptPath = join25(dir, "transcript.jsonl");
43725
43956
  const appendTranscript = async (m) => {
@@ -43937,10 +44168,10 @@ var bgCommand = {
43937
44168
  init_modes();
43938
44169
  var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
43939
44170
  var ORDER = ["plan", "default", "acceptEdits", "bypass", "deny"];
43940
- var ModePanel = ({ current }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
44171
+ var ModePanel = ({ current: current2 }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
43941
44172
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { bold: true, color: "cyan", children: "Permission mode" }),
43942
44173
  ORDER.map((m) => {
43943
- const active = m === current;
44174
+ const active = m === current2;
43944
44175
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box_default, { children: [
43945
44176
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box_default, { width: 14, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Text, { color: active ? "greenBright" : "cyan", bold: active, children: [
43946
44177
  active ? "\u25B8 " : " ",
@@ -43996,6 +44227,7 @@ var BUILTIN_COMMANDS = [
43996
44227
  exitCommand,
43997
44228
  modelCommand,
43998
44229
  moodCommand,
44230
+ effortCommand,
43999
44231
  loginCommand2,
44000
44232
  costCommand,
44001
44233
  skillCommand,
@@ -44140,6 +44372,175 @@ function applyCompletion(buffer, result, item) {
44140
44372
  init_messages();
44141
44373
  init_system_prompt();
44142
44374
  init_loop();
44375
+
44376
+ // src/agent/orchestrator.ts
44377
+ init_loop();
44378
+
44379
+ // src/agent/forge.ts
44380
+ init_execa();
44381
+ import * as fs4 from "node:fs";
44382
+ import * as path8 from "node:path";
44383
+ var DEFAULT_FORGE_DIR = "D:\\Downloads\\conductor-forge-main";
44384
+ async function* maybeRunForge(_conversation, baseOpts) {
44385
+ const dir = process.env.KRYVEN_FORGE_DIR || DEFAULT_FORGE_DIR;
44386
+ const enabled = process.env.KRYVEN_FORGE_ENABLED === "1";
44387
+ if (!enabled) {
44388
+ yield {
44389
+ type: "reflection",
44390
+ phase: "effort:forge-bridge",
44391
+ ok: true,
44392
+ detail: "Forge bridge scaffolded (not run). The code work above used the self-improve pipeline. To run the conductor-forge MoE-research pipeline, set KRYVEN_FORGE_ENABLED=1 (and KRYVEN_FORGE_DIR if not the default)."
44393
+ };
44394
+ return;
44395
+ }
44396
+ if (!dir || !fs4.existsSync(path8.join(dir, "infrastructure", "runner.py"))) {
44397
+ yield {
44398
+ type: "reflection",
44399
+ phase: "effort:forge-bridge",
44400
+ ok: false,
44401
+ detail: `Forge pipeline not found at ${dir || "(KRYVEN_FORGE_DIR unset)"}.`
44402
+ };
44403
+ return;
44404
+ }
44405
+ yield { type: "reflection", phase: "effort:forge-bridge", ok: true, detail: "Forge: querying pipeline status (scaffold)\u2026" };
44406
+ try {
44407
+ const { stdout, stderr } = await execa("python", ["infrastructure/runner.py", "status"], {
44408
+ cwd: dir,
44409
+ timeout: 6e4,
44410
+ reject: false,
44411
+ signal: baseOpts.signal
44412
+ });
44413
+ const out = [stdout, stderr].filter(Boolean).join("\n").slice(0, 2e3);
44414
+ yield { type: "text", content: `
44415
+ [Forge pipeline status]
44416
+ ${out || "(no output)"}
44417
+ ` };
44418
+ } catch (err) {
44419
+ yield { type: "reflection", phase: "effort:forge-bridge", ok: false, detail: `Forge status failed: ${err.message}` };
44420
+ }
44421
+ }
44422
+
44423
+ // src/agent/orchestrator.ts
44424
+ var READ_TOOL_RE = /read|grep|glob|ls|list|search|find/i;
44425
+ var WEB_SEARCH_RE = /web.?search|search.?web|websearch/i;
44426
+ var TEST_TOOL_RE = /test|safeshell/i;
44427
+ function filterTools(tools, mode) {
44428
+ const nameOf = (t) => t?.function?.name ?? "";
44429
+ const isRead = (t) => READ_TOOL_RE.test(nameOf(t)) && !WEB_SEARCH_RE.test(nameOf(t));
44430
+ switch (mode) {
44431
+ case "none":
44432
+ return [];
44433
+ case "read":
44434
+ return tools.filter(isRead);
44435
+ case "verify":
44436
+ return tools.filter((t) => isRead(t) || TEST_TOOL_RE.test(nameOf(t)));
44437
+ case "research":
44438
+ return tools.filter((t) => isRead(t) || WEB_SEARCH_RE.test(nameOf(t)));
44439
+ case "all":
44440
+ default:
44441
+ return tools;
44442
+ }
44443
+ }
44444
+ async function* runEffortOrchestration(client, conversation, baseOpts, effort) {
44445
+ const stages = EFFORT_STAGES[effort];
44446
+ if (effort === "low" || !stages || stages.length === 0) {
44447
+ yield* runAgentLoopWithTools(client, conversation, baseOpts);
44448
+ return;
44449
+ }
44450
+ yield {
44451
+ type: "reflection",
44452
+ phase: `effort:${effort}`,
44453
+ ok: true,
44454
+ detail: `Effort ${effort}: running ${stages.length} stages${effort === "forge" ? " + the Forge bridge" : ""} \u2014 this uses more tokens than a single pass.`
44455
+ };
44456
+ const totalUsage = {
44457
+ prompt_tokens: 0,
44458
+ completion_tokens: 0,
44459
+ total_tokens: 0,
44460
+ kryven_tokens_charged: 0
44461
+ };
44462
+ for (let i2 = 0; i2 < stages.length; i2++) {
44463
+ const stage = stages[i2];
44464
+ if (baseOpts.signal?.aborted) {
44465
+ yield { type: "error", message: "aborted" };
44466
+ return;
44467
+ }
44468
+ if (i2 > 0 && stage.instruction) {
44469
+ conversation.append({ role: "user", content: stage.instruction, ts: Date.now(), ephemeral: true });
44470
+ }
44471
+ yield {
44472
+ type: "reflection",
44473
+ phase: `effort:${stage.name}`,
44474
+ ok: true,
44475
+ detail: `Effort ${effort} \u2014 stage ${i2 + 1}/${stages.length}: ${stage.label}`
44476
+ };
44477
+ const isLastStage = i2 === stages.length - 1;
44478
+ const emitEndTurn = isLastStage && effort !== "forge";
44479
+ const stageOpts = {
44480
+ ...baseOpts,
44481
+ systemPrompt: `${baseOpts.systemPrompt}
44482
+
44483
+ ${stage.addendum}`,
44484
+ tools: filterTools(baseOpts.tools, stage.toolMode),
44485
+ // Self-repair only on the final code stage (incl. forge's CRITIQUE).
44486
+ reflect: isLastStage ? baseOpts.reflect : void 0
44487
+ };
44488
+ let stageErrored = false;
44489
+ let sawEndTurn = false;
44490
+ for await (const ev of runAgentLoopWithTools(client, conversation, stageOpts)) {
44491
+ if (ev.type === "end_turn") {
44492
+ sawEndTurn = true;
44493
+ if (ev.usage) {
44494
+ totalUsage.prompt_tokens += ev.usage.prompt_tokens || 0;
44495
+ totalUsage.completion_tokens += ev.usage.completion_tokens || 0;
44496
+ totalUsage.total_tokens += ev.usage.total_tokens || 0;
44497
+ totalUsage.kryven_tokens_charged = (totalUsage.kryven_tokens_charged ?? 0) + (ev.usage.kryven_tokens_charged ?? 0);
44498
+ }
44499
+ if (emitEndTurn) yield { type: "end_turn", finishReason: ev.finishReason, usage: totalUsage };
44500
+ break;
44501
+ } else if (ev.type === "error") {
44502
+ yield ev;
44503
+ stageErrored = true;
44504
+ break;
44505
+ } else {
44506
+ yield ev;
44507
+ }
44508
+ }
44509
+ if (stageErrored) return;
44510
+ if (emitEndTurn && !sawEndTurn) {
44511
+ yield { type: "end_turn", finishReason: "stop", usage: totalUsage };
44512
+ }
44513
+ }
44514
+ if (effort === "forge") {
44515
+ yield* maybeRunForge(conversation, baseOpts);
44516
+ yield { type: "end_turn", finishReason: "stop", usage: totalUsage };
44517
+ }
44518
+ }
44519
+
44520
+ // src/tui/EffortPicker.tsx
44521
+ var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
44522
+ var EffortPicker = ({ selected, current: current2 }) => {
44523
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, borderStyle: "round", borderColor: "magenta", paddingX: 1, children: [
44524
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { children: [
44525
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { bold: true, color: "magenta", children: "Select effort level " }),
44526
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "gray", children: "\u2014 \u2191/\u2193 move \xB7 Enter set \xB7 Esc cancel" })
44527
+ ] }),
44528
+ EFFORT_LEVELS.map((level, idx) => {
44529
+ const isSel = idx === selected;
44530
+ const isCur = level === current2;
44531
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { children: [
44532
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { width: 2, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "magentaBright", children: isSel ? "\u25B6" : " " }) }),
44533
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { width: 16, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { color: isSel ? "greenBright" : "white", bold: isSel, children: [
44534
+ level,
44535
+ isCur ? " \u25CF" : ""
44536
+ ] }) }),
44537
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "gray", children: EFFORT_DESCRIPTIONS[level] })
44538
+ ] }, level);
44539
+ })
44540
+ ] });
44541
+ };
44542
+
44543
+ // src/tui/REPL.tsx
44143
44544
  init_client();
44144
44545
  init_errors();
44145
44546
 
@@ -44147,8 +44548,8 @@ init_errors();
44147
44548
  init_defaults();
44148
44549
  init_logger();
44149
44550
  import { appendFile, mkdir as mkdir10, readFile as readFile13, readdir as readdir9 } from "node:fs/promises";
44150
- import { existsSync as existsSync17 } from "node:fs";
44151
- import { join as join27 } from "node:path";
44551
+ import { existsSync as existsSync18 } from "node:fs";
44552
+ import { join as join28 } from "node:path";
44152
44553
  import { randomUUID as randomUUID2 } from "node:crypto";
44153
44554
  var SessionStore = class {
44154
44555
  id;
@@ -44158,12 +44559,12 @@ var SessionStore = class {
44158
44559
  writing = Promise.resolve();
44159
44560
  constructor(id) {
44160
44561
  this.id = id ?? randomUUID2();
44161
- this.dir = join27(getSessionsDir(), this.id);
44162
- this.transcriptPath = join27(this.dir, "transcript.jsonl");
44163
- this.metaPath = join27(this.dir, "meta.json");
44562
+ this.dir = join28(getSessionsDir(), this.id);
44563
+ this.transcriptPath = join28(this.dir, "transcript.jsonl");
44564
+ this.metaPath = join28(this.dir, "meta.json");
44164
44565
  }
44165
44566
  async init(meta) {
44166
- if (!existsSync17(this.dir)) {
44567
+ if (!existsSync18(this.dir)) {
44167
44568
  await mkdir10(this.dir, { recursive: true, mode: 448 });
44168
44569
  }
44169
44570
  const full = {
@@ -44187,17 +44588,17 @@ var SessionStore = class {
44187
44588
  true
44188
44589
  );
44189
44590
  }
44190
- async queueWrite(path9, data, append) {
44591
+ async queueWrite(path11, data, append) {
44191
44592
  this.writing = this.writing.then(async () => {
44192
44593
  try {
44193
44594
  if (append) {
44194
- await appendFile(path9, data);
44595
+ await appendFile(path11, data);
44195
44596
  } else {
44196
44597
  const { writeFile: writeFile12 } = await import("node:fs/promises");
44197
- await writeFile12(path9, data);
44598
+ await writeFile12(path11, data);
44198
44599
  }
44199
44600
  } catch (err) {
44200
- logger.warn("session: write failed", path9, String(err));
44601
+ logger.warn("session: write failed", path11, String(err));
44201
44602
  }
44202
44603
  });
44203
44604
  return this.writing;
@@ -44206,13 +44607,13 @@ var SessionStore = class {
44206
44607
  await this.writing;
44207
44608
  }
44208
44609
  static async load(id) {
44209
- const dir = join27(getSessionsDir(), id);
44210
- const metaPath = join27(dir, "meta.json");
44211
- const transcriptPath = join27(dir, "transcript.jsonl");
44212
- if (!existsSync17(metaPath)) return null;
44610
+ const dir = join28(getSessionsDir(), id);
44611
+ const metaPath = join28(dir, "meta.json");
44612
+ const transcriptPath = join28(dir, "transcript.jsonl");
44613
+ if (!existsSync18(metaPath)) return null;
44213
44614
  try {
44214
44615
  const meta = JSON.parse(await readFile13(metaPath, "utf8"));
44215
- const transcriptText = existsSync17(transcriptPath) ? await readFile13(transcriptPath, "utf8") : "";
44616
+ const transcriptText = existsSync18(transcriptPath) ? await readFile13(transcriptPath, "utf8") : "";
44216
44617
  const messages = transcriptText.split("\n").filter(Boolean).map((line) => JSON.parse(line));
44217
44618
  return { meta, messages };
44218
44619
  } catch (err) {
@@ -44222,13 +44623,13 @@ var SessionStore = class {
44222
44623
  }
44223
44624
  static async list() {
44224
44625
  const root = getSessionsDir();
44225
- if (!existsSync17(root)) return [];
44626
+ if (!existsSync18(root)) return [];
44226
44627
  try {
44227
44628
  const ids = await readdir9(root);
44228
44629
  const metas = [];
44229
44630
  for (const id of ids) {
44230
- const metaPath = join27(root, id, "meta.json");
44231
- if (!existsSync17(metaPath)) continue;
44631
+ const metaPath = join28(root, id, "meta.json");
44632
+ if (!existsSync18(metaPath)) continue;
44232
44633
  try {
44233
44634
  metas.push(JSON.parse(await readFile13(metaPath, "utf8")));
44234
44635
  } catch {
@@ -44246,16 +44647,16 @@ var SessionStore = class {
44246
44647
  init_defaults();
44247
44648
  init_logger();
44248
44649
  import { appendFile as appendFile2, readFile as readFile14, writeFile as writeFile10, mkdir as mkdir11 } from "node:fs/promises";
44249
- import { existsSync as existsSync18 } from "node:fs";
44250
- import { dirname as dirname13, join as join28 } from "node:path";
44650
+ import { existsSync as existsSync19 } from "node:fs";
44651
+ import { dirname as dirname13, join as join29 } from "node:path";
44251
44652
  var Outbox = class {
44252
44653
  path;
44253
44654
  constructor(sessionId) {
44254
- this.path = join28(getSessionsDir(), sessionId, "_outbox.jsonl");
44655
+ this.path = join29(getSessionsDir(), sessionId, "_outbox.jsonl");
44255
44656
  }
44256
44657
  async push(entry) {
44257
44658
  const dir = dirname13(this.path);
44258
- if (!existsSync18(dir)) await mkdir11(dir, { recursive: true, mode: 448 });
44659
+ if (!existsSync19(dir)) await mkdir11(dir, { recursive: true, mode: 448 });
44259
44660
  try {
44260
44661
  await appendFile2(this.path, JSON.stringify(entry) + "\n");
44261
44662
  } catch (err) {
@@ -44263,7 +44664,7 @@ var Outbox = class {
44263
44664
  }
44264
44665
  }
44265
44666
  async drain() {
44266
- if (!existsSync18(this.path)) return [];
44667
+ if (!existsSync19(this.path)) return [];
44267
44668
  try {
44268
44669
  const text = await readFile14(this.path, "utf8");
44269
44670
  const lines = text.split("\n").filter(Boolean);
@@ -44280,7 +44681,7 @@ var Outbox = class {
44280
44681
  }
44281
44682
  }
44282
44683
  async clear() {
44283
- if (!existsSync18(this.path)) return;
44684
+ if (!existsSync19(this.path)) return;
44284
44685
  try {
44285
44686
  await writeFile10(this.path, "");
44286
44687
  } catch (err) {
@@ -44288,7 +44689,7 @@ var Outbox = class {
44288
44689
  }
44289
44690
  }
44290
44691
  async size() {
44291
- if (!existsSync18(this.path)) return 0;
44692
+ if (!existsSync19(this.path)) return 0;
44292
44693
  try {
44293
44694
  const text = await readFile14(this.path, "utf8");
44294
44695
  return text.split("\n").filter(Boolean).length;
@@ -44422,9 +44823,9 @@ var SessionsClient = class {
44422
44823
  headers() {
44423
44824
  return this.client.headers();
44424
44825
  }
44425
- async req(method, path9, body, signal) {
44426
- const url = `${this.baseUrl}${path9}`;
44427
- logger.debug("sessions", method, path9);
44826
+ async req(method, path11, body, signal) {
44827
+ const url = `${this.baseUrl}${path11}`;
44828
+ logger.debug("sessions", method, path11);
44428
44829
  const res = await this.fetch(url, {
44429
44830
  method,
44430
44831
  headers: this.headers(),
@@ -44505,27 +44906,27 @@ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
44505
44906
  init_defaults();
44506
44907
  init_logger();
44507
44908
  import { appendFile as appendFile3, mkdir as mkdir12, readFile as readFile15 } from "node:fs/promises";
44508
- import { existsSync as existsSync19 } from "node:fs";
44909
+ import { existsSync as existsSync20 } from "node:fs";
44509
44910
  import { dirname as dirname14 } from "node:path";
44510
44911
  async function ensureFile() {
44511
- const path9 = getHistoryPath();
44512
- if (!existsSync19(dirname14(path9))) {
44513
- await mkdir12(dirname14(path9), { recursive: true, mode: 448 });
44912
+ const path11 = getHistoryPath();
44913
+ if (!existsSync20(dirname14(path11))) {
44914
+ await mkdir12(dirname14(path11), { recursive: true, mode: 448 });
44514
44915
  }
44515
- if (!existsSync19(path9)) {
44516
- await appendFile3(path9, "");
44916
+ if (!existsSync20(path11)) {
44917
+ await appendFile3(path11, "");
44517
44918
  }
44518
- return path9;
44919
+ return path11;
44519
44920
  }
44520
44921
  async function appendHistory(entry) {
44521
44922
  try {
44522
- const path9 = await ensureFile();
44523
- const release = await import_proper_lockfile.default.lock(path9, {
44923
+ const path11 = await ensureFile();
44924
+ const release = await import_proper_lockfile.default.lock(path11, {
44524
44925
  retries: { retries: 3, factor: 1.5, minTimeout: 30 },
44525
44926
  stale: 5e3
44526
44927
  });
44527
44928
  try {
44528
- await appendFile3(path9, JSON.stringify(entry) + "\n");
44929
+ await appendFile3(path11, JSON.stringify(entry) + "\n");
44529
44930
  } finally {
44530
44931
  await release();
44531
44932
  }
@@ -44672,8 +45073,8 @@ function compareSemver(a2, b) {
44672
45073
  }
44673
45074
  return 0;
44674
45075
  }
44675
- async function checkForUpdate(current, timeoutMs = 2500) {
44676
- if (!current || !SEMVER.test(current)) return null;
45076
+ async function checkForUpdate(current2, timeoutMs = 2500) {
45077
+ if (!current2 || !SEMVER.test(current2)) return null;
44677
45078
  try {
44678
45079
  const ac = new AbortController();
44679
45080
  const timer = setTimeout(() => ac.abort(), timeoutMs);
@@ -44690,24 +45091,305 @@ async function checkForUpdate(current, timeoutMs = 2500) {
44690
45091
  const j = await res.json();
44691
45092
  const latest = String(j?.version ?? "");
44692
45093
  if (!SEMVER.test(latest)) return null;
44693
- return { updateAvailable: compareSemver(latest, current) > 0, latest };
45094
+ return { updateAvailable: compareSemver(latest, current2) > 0, latest };
44694
45095
  } catch {
44695
45096
  return null;
44696
45097
  }
44697
45098
  }
44698
45099
 
45100
+ // src/utils/clipboard.ts
45101
+ import { spawn as spawn8 } from "node:child_process";
45102
+ function osc52(payload) {
45103
+ const b64 = Buffer.from(payload, "utf8").toString("base64");
45104
+ return `\x1B]52;c;${b64}\x07`;
45105
+ }
45106
+ function osClipboardFallback(text) {
45107
+ const candidates = process.platform === "win32" ? [{ cmd: "clip", args: [] }] : process.platform === "darwin" ? [{ cmd: "pbcopy", args: [] }] : [
45108
+ { cmd: "wl-copy", args: [] },
45109
+ { cmd: "xclip", args: ["-selection", "clipboard"] },
45110
+ { cmd: "xsel", args: ["--clipboard", "--input"] }
45111
+ ];
45112
+ return new Promise((resolve7) => {
45113
+ const tryNext = (i2) => {
45114
+ if (i2 >= candidates.length) return resolve7(false);
45115
+ const { cmd, args } = candidates[i2];
45116
+ let settled = false;
45117
+ try {
45118
+ const child = spawn8(cmd, args, { stdio: ["pipe", "ignore", "ignore"] });
45119
+ child.on("error", () => {
45120
+ if (!settled) {
45121
+ settled = true;
45122
+ tryNext(i2 + 1);
45123
+ }
45124
+ });
45125
+ child.on("close", (code) => {
45126
+ if (!settled) {
45127
+ settled = true;
45128
+ code === 0 ? resolve7(true) : tryNext(i2 + 1);
45129
+ }
45130
+ });
45131
+ child.stdin.end(text);
45132
+ } catch {
45133
+ tryNext(i2 + 1);
45134
+ }
45135
+ };
45136
+ tryNext(0);
45137
+ });
45138
+ }
45139
+ async function copyToClipboard(text) {
45140
+ let wroteOsc = false;
45141
+ try {
45142
+ if (process.stdout.isTTY) {
45143
+ process.stdout.write(osc52(text));
45144
+ wroteOsc = true;
45145
+ }
45146
+ } catch {
45147
+ }
45148
+ const osOk = await osClipboardFallback(text).catch(() => false);
45149
+ return wroteOsc || osOk;
45150
+ }
45151
+
45152
+ // src/utils/tts.ts
45153
+ import { spawn as spawn9 } from "node:child_process";
45154
+ var current = null;
45155
+ function ttsLikelyAvailable() {
45156
+ return process.platform === "win32" || process.platform === "darwin" || process.platform === "linux";
45157
+ }
45158
+ function stopSpeaking() {
45159
+ if (current && !current.killed) {
45160
+ try {
45161
+ current.kill();
45162
+ } catch {
45163
+ }
45164
+ }
45165
+ current = null;
45166
+ }
45167
+ function speak(text) {
45168
+ stopSpeaking();
45169
+ const clean = sanitizeForSpeech(text);
45170
+ if (!clean) return Promise.resolve();
45171
+ return new Promise((resolve7) => {
45172
+ let child;
45173
+ try {
45174
+ if (process.platform === "win32") {
45175
+ const ps = "Add-Type -AssemblyName System.Speech;$s=New-Object System.Speech.Synthesis.SpeechSynthesizer;$t=[Console]::In.ReadToEnd();$s.Speak($t);";
45176
+ child = spawn9("powershell", ["-NoProfile", "-NonInteractive", "-Command", ps], {
45177
+ stdio: ["pipe", "ignore", "ignore"]
45178
+ });
45179
+ child.stdin?.end(clean);
45180
+ } else if (process.platform === "darwin") {
45181
+ child = spawn9("say", [], { stdio: ["pipe", "ignore", "ignore"] });
45182
+ child.stdin?.end(clean);
45183
+ } else {
45184
+ child = spawn9("sh", ["-c", "command -v spd-say >/dev/null 2>&1 && spd-say -e || espeak"], {
45185
+ stdio: ["pipe", "ignore", "ignore"]
45186
+ });
45187
+ child.stdin?.end(clean);
45188
+ }
45189
+ } catch {
45190
+ return resolve7();
45191
+ }
45192
+ current = child;
45193
+ child.on("error", () => {
45194
+ current = null;
45195
+ resolve7();
45196
+ });
45197
+ child.on("close", () => {
45198
+ current = null;
45199
+ resolve7();
45200
+ });
45201
+ });
45202
+ }
45203
+ function sanitizeForSpeech(text) {
45204
+ if (!text) return "";
45205
+ let s = text;
45206
+ s = s.replace(/```[\s\S]*?```/g, " (code block) ");
45207
+ s = s.replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/[*_#>]/g, "");
45208
+ s = s.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
45209
+ s = s.replace(/\s+/g, " ").trim();
45210
+ return s.length > 1200 ? s.slice(0, 1200) + " \u2026" : s;
45211
+ }
45212
+
45213
+ // src/tui/FilePicker.tsx
45214
+ var import_react28 = __toESM(require_react(), 1);
45215
+ var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
45216
+ import * as fs5 from "node:fs";
45217
+ import * as path9 from "node:path";
45218
+ var IGNORED = /* @__PURE__ */ new Set([
45219
+ "node_modules",
45220
+ ".git",
45221
+ ".next",
45222
+ "dist",
45223
+ "build",
45224
+ ".cache",
45225
+ "coverage",
45226
+ ".turbo",
45227
+ ".parcel-cache",
45228
+ "__pycache__",
45229
+ ".venv",
45230
+ "venv"
45231
+ ]);
45232
+ function listDir2(dir) {
45233
+ let dirents;
45234
+ try {
45235
+ dirents = fs5.readdirSync(dir, { withFileTypes: true });
45236
+ } catch {
45237
+ return [];
45238
+ }
45239
+ const out = dirents.filter((d) => !(d.isDirectory() && IGNORED.has(d.name))).filter((d) => !d.name.startsWith(".") || d.name === ".env").map((d) => ({ name: d.name, abs: path9.join(dir, d.name), isDir: d.isDirectory() }));
45240
+ out.sort((a2, b) => a2.isDir === b.isDir ? a2.name.localeCompare(b.name) : a2.isDir ? -1 : 1);
45241
+ return out;
45242
+ }
45243
+ var FilePicker = ({ cwd: cwd2, theme, onSubmit, onCancel }) => {
45244
+ const [dir, setDir] = (0, import_react28.useState)(cwd2);
45245
+ const [cursor, setCursor] = (0, import_react28.useState)(0);
45246
+ const [selected, setSelected] = (0, import_react28.useState)(/* @__PURE__ */ new Set());
45247
+ const entries = (0, import_react28.useMemo)(() => listDir2(dir), [dir]);
45248
+ const WINDOW = 12;
45249
+ const start = Math.max(0, Math.min(cursor - Math.floor(WINDOW / 2), Math.max(0, entries.length - WINDOW)));
45250
+ const visible = entries.slice(start, start + WINDOW);
45251
+ const finish = (extraAbs) => {
45252
+ const all = new Set(selected);
45253
+ if (extraAbs) all.add(extraAbs);
45254
+ const rels = [...all].map((abs) => {
45255
+ const rel2 = path9.relative(cwd2, abs);
45256
+ return rel2 === "" ? "." : rel2.split(path9.sep).join("/");
45257
+ });
45258
+ onSubmit(rels);
45259
+ };
45260
+ use_input_default((inputCh, key) => {
45261
+ if (key.escape) {
45262
+ onCancel();
45263
+ return;
45264
+ }
45265
+ if (key.upArrow) {
45266
+ setCursor((c3) => Math.max(0, c3 - 1));
45267
+ return;
45268
+ }
45269
+ if (key.downArrow) {
45270
+ setCursor((c3) => Math.min(entries.length - 1, c3 + 1));
45271
+ return;
45272
+ }
45273
+ if (key.leftArrow) {
45274
+ const parent = path9.dirname(dir);
45275
+ if (parent !== dir) {
45276
+ setDir(parent);
45277
+ setCursor(0);
45278
+ }
45279
+ return;
45280
+ }
45281
+ const cur = entries[cursor];
45282
+ if (key.rightArrow) {
45283
+ if (cur?.isDir) {
45284
+ setDir(cur.abs);
45285
+ setCursor(0);
45286
+ }
45287
+ return;
45288
+ }
45289
+ if (inputCh === " ") {
45290
+ if (cur) {
45291
+ setSelected((prev) => {
45292
+ const next = new Set(prev);
45293
+ next.has(cur.abs) ? next.delete(cur.abs) : next.add(cur.abs);
45294
+ return next;
45295
+ });
45296
+ }
45297
+ return;
45298
+ }
45299
+ if (inputCh === "a" && cur) {
45300
+ finish(cur.abs);
45301
+ return;
45302
+ }
45303
+ if (key.return) {
45304
+ if (cur?.isDir && selected.size === 0) {
45305
+ setDir(cur.abs);
45306
+ setCursor(0);
45307
+ return;
45308
+ }
45309
+ finish(selected.size === 0 && cur ? cur.abs : void 0);
45310
+ return;
45311
+ }
45312
+ });
45313
+ const rel = path9.relative(cwd2, dir) || ".";
45314
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
45315
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: theme.accent, bold: true, children: "\uFF0B Add files / folders to the prompt" }),
45316
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { color: theme.muted, children: [
45317
+ "./",
45318
+ rel === "." ? "" : rel,
45319
+ "/"
45320
+ ] }),
45321
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
45322
+ start > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: theme.muted, children: " \u2191 more\u2026" }),
45323
+ visible.map((e) => {
45324
+ const i2 = entries.indexOf(e);
45325
+ const isCursor = i2 === cursor;
45326
+ const isSel = selected.has(e.abs);
45327
+ const mark = isSel ? "\u25C9" : "\u25EF";
45328
+ const icon = e.isDir ? "\u25B8 " : " ";
45329
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: isCursor ? theme.accent : theme.fg, inverse: isCursor, children: `${mark} ${icon}${e.name}${e.isDir ? "/" : ""}` }, e.abs);
45330
+ }),
45331
+ entries.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: theme.muted, children: " (empty)" }),
45332
+ start + WINDOW < entries.length && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: theme.muted, children: " \u2193 more\u2026" })
45333
+ ] }),
45334
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { color: theme.muted, children: [
45335
+ "\u2191\u2193 move \xB7 \u2192 open \xB7 \u2190 up \xB7 space select",
45336
+ selected.size > 0 ? ` (${selected.size})` : "",
45337
+ " \xB7 enter add \xB7 esc cancel"
45338
+ ] }) })
45339
+ ] });
45340
+ };
45341
+
44699
45342
  // src/tui/REPL.tsx
44700
- var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
44701
- import fs4 from "node:fs";
44702
- import path8 from "node:path";
45343
+ var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
45344
+ import fs6 from "node:fs";
45345
+ import path10 from "node:path";
45346
+ function extractFileFromArgs(argsJson) {
45347
+ try {
45348
+ const a2 = JSON.parse(argsJson || "{}");
45349
+ const p = a2.path || a2.file_path || a2.filePath || a2.filename || a2.file;
45350
+ if (typeof p === "string" && p) return p.split(/[\\/]/).pop() || p;
45351
+ } catch {
45352
+ }
45353
+ return void 0;
45354
+ }
45355
+ function buildTurnSummary(actions) {
45356
+ if (actions.length === 0) return "";
45357
+ const edits = actions.filter((a2) => /write|edit/i.test(a2.tool) && a2.ok);
45358
+ const editFiles = [...new Set(edits.map((a2) => a2.file).filter((f) => !!f))];
45359
+ const reads = actions.filter((a2) => /read|grep|glob|search|ls|list/i.test(a2.tool));
45360
+ const cmds = actions.filter((a2) => /bash|shell|test|run|exec/i.test(a2.tool));
45361
+ const parts = [];
45362
+ if (editFiles.length) {
45363
+ const shown = editFiles.slice(0, 3).join(", ");
45364
+ const extra = editFiles.length > 3 ? `, +${editFiles.length - 3}` : "";
45365
+ parts.push(`edited ${editFiles.length} file${editFiles.length > 1 ? "s" : ""} (${shown}${extra})`);
45366
+ } else if (edits.length) {
45367
+ parts.push(`edited ${edits.length} file${edits.length > 1 ? "s" : ""}`);
45368
+ }
45369
+ if (reads.length) parts.push(`${reads.length} read${reads.length > 1 ? "s" : ""}`);
45370
+ if (cmds.length) parts.push(`ran ${cmds.length} command${cmds.length > 1 ? "s" : ""}`);
45371
+ return parts.length ? `\u2713 ${parts.join(" \xB7 ")}` : "\u2713 done";
45372
+ }
45373
+ function extractCodeBlocks(text) {
45374
+ if (!text) return [];
45375
+ const out = [];
45376
+ const re = /```[^\n]*\n([\s\S]*?)```/g;
45377
+ let m;
45378
+ while ((m = re.exec(text)) !== null) {
45379
+ const body = (m[1] ?? "").replace(/\n+$/, "");
45380
+ if (body.trim()) out.push(body);
45381
+ }
45382
+ return out;
45383
+ }
45384
+ var VOICE_CONVERSATION_ADDENDUM = `CONVERSATION MODE (voice): Talk to the user like a friendly pair-programmer having a real conversation. Narrate what you're about to do in a natural, spoken style before you do it ("Alrighty, I'll get started on your file\u2026", "Okay, I just created it \u2014 want me to wire it up next?"). When something is genuinely ambiguous or you need a decision, STOP and ask the user a short question, then wait for their reply instead of guessing. Keep each spoken turn brief and natural (1\u20134 sentences) since it will be read aloud; avoid dumping long code or file contents into the spoken reply \u2014 make the edits via tools and describe them in a sentence. Stay warm and concise.`;
44703
45385
  function detectReflectCommand(cwd2) {
44704
45386
  const override = process.env.KRYVEN_REFLECT_CMD;
44705
45387
  if (override !== void 0) return override.trim() || null;
44706
45388
  try {
44707
- if (fs4.existsSync(path8.join(cwd2, "tsconfig.json"))) return "npx tsc --noEmit";
44708
- const pkgPath = path8.join(cwd2, "package.json");
44709
- if (fs4.existsSync(pkgPath)) {
44710
- const pkg = JSON.parse(fs4.readFileSync(pkgPath, "utf8"));
45389
+ if (fs6.existsSync(path10.join(cwd2, "tsconfig.json"))) return "npx tsc --noEmit";
45390
+ const pkgPath = path10.join(cwd2, "package.json");
45391
+ if (fs6.existsSync(pkgPath)) {
45392
+ const pkg = JSON.parse(fs6.readFileSync(pkgPath, "utf8"));
44711
45393
  if (pkg?.scripts?.typecheck) return "npm run typecheck";
44712
45394
  if (pkg?.scripts?.test) return "npm test";
44713
45395
  }
@@ -44735,16 +45417,16 @@ var REPL = ({
44735
45417
  seedPrompt
44736
45418
  }) => {
44737
45419
  const app = use_app_default();
44738
- const clientRef = (0, import_react28.useRef)(client);
44739
- const [isGuest, setIsGuest] = (0, import_react28.useState)(initialIsGuest);
44740
- const conversationRef = (0, import_react28.useRef)(new Conversation());
44741
- const sessionRef = (0, import_react28.useRef)(new SessionStore(resumeSessionId));
44742
- const remoteSessionRef = (0, import_react28.useRef)(null);
44743
- const abortRef = (0, import_react28.useRef)(null);
44744
- const permissionResolveRef = (0, import_react28.useRef)(null);
44745
- const readPathsRef = (0, import_react28.useRef)(/* @__PURE__ */ new Set());
44746
- const toolMetaRef = (0, import_react28.useRef)(/* @__PURE__ */ new Map());
44747
- (0, import_react28.useEffect)(() => {
45420
+ const clientRef = (0, import_react29.useRef)(client);
45421
+ const [isGuest, setIsGuest] = (0, import_react29.useState)(initialIsGuest);
45422
+ const conversationRef = (0, import_react29.useRef)(new Conversation());
45423
+ const sessionRef = (0, import_react29.useRef)(new SessionStore(resumeSessionId));
45424
+ const remoteSessionRef = (0, import_react29.useRef)(null);
45425
+ const abortRef = (0, import_react29.useRef)(null);
45426
+ const permissionResolveRef = (0, import_react29.useRef)(null);
45427
+ const readPathsRef = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
45428
+ const toolMetaRef = (0, import_react29.useRef)(/* @__PURE__ */ new Map());
45429
+ (0, import_react29.useEffect)(() => {
44748
45430
  if (isGuest) return;
44749
45431
  const cfg = resolveConfig();
44750
45432
  if (cfg.apiKey && cfg.telemetry !== false) {
@@ -44762,27 +45444,45 @@ var REPL = ({
44762
45444
  );
44763
45445
  };
44764
45446
  }, []);
44765
- const [input, setInput] = (0, import_react28.useState)("");
44766
- const [streaming, setStreaming] = (0, import_react28.useState)(null);
44767
- const [busy, setBusy] = (0, import_react28.useState)(false);
44768
- const [model, setModel] = (0, import_react28.useState)(initialModel);
44769
- const [mood, setMood] = (0, import_react28.useState)(initialMood);
44770
- const [git, setGit] = (0, import_react28.useState)({ isRepo: false });
44771
- const [, forceRender] = (0, import_react28.useState)(0);
44772
- const [overlay, setOverlay] = (0, import_react28.useState)(null);
44773
- const [notes, setNotes] = (0, import_react28.useState)([]);
44774
- const [sessionTokens, setSessionTokens] = (0, import_react28.useState)(0);
44775
- const [toolEntries, setToolEntries] = (0, import_react28.useState)([]);
44776
- const [permissionReq, setPermissionReq] = (0, import_react28.useState)(null);
44777
- const [modelPicker, setModelPicker] = (0, import_react28.useState)(null);
44778
- const [staticGen, setStaticGen] = (0, import_react28.useState)(0);
44779
- const prevCommittedCountRef = (0, import_react28.useRef)(0);
44780
- const cfgRef = (0, import_react28.useRef)(resolveConfig());
44781
- const vimEnabledRef = (0, import_react28.useRef)(cfgRef.current.vim === true);
44782
- const vimRef = (0, import_react28.useRef)(initialVim());
44783
- const [vimTick, setVimTick] = (0, import_react28.useState)(0);
44784
- const themeMgrRef = (0, import_react28.useRef)(null);
44785
- const keyMgrRef = (0, import_react28.useRef)(null);
45447
+ const [input, setInput] = (0, import_react29.useState)("");
45448
+ const [streaming, setStreaming] = (0, import_react29.useState)(null);
45449
+ const [busy, setBusy] = (0, import_react29.useState)(false);
45450
+ const [model, setModel] = (0, import_react29.useState)(initialModel);
45451
+ const [mood, setMood] = (0, import_react29.useState)(initialMood);
45452
+ const [effort, setEffort] = (0, import_react29.useState)(() => {
45453
+ const e = resolveConfig().effort ?? "low";
45454
+ return EFFORT_LEVELS.includes(e) ? e : "low";
45455
+ });
45456
+ const [effortPicker, setEffortPicker] = (0, import_react29.useState)(null);
45457
+ const [git, setGit] = (0, import_react29.useState)({ isRepo: false });
45458
+ const [, forceRender] = (0, import_react29.useState)(0);
45459
+ const [overlay, setOverlay] = (0, import_react29.useState)(null);
45460
+ const [notes, setNotes] = (0, import_react29.useState)([]);
45461
+ const [sessionTokens, setSessionTokens] = (0, import_react29.useState)(0);
45462
+ const [toolEntries, setToolEntries] = (0, import_react29.useState)([]);
45463
+ const [lastSummary, setLastSummary] = (0, import_react29.useState)("");
45464
+ const turnActionsRef = (0, import_react29.useRef)(/* @__PURE__ */ new Map());
45465
+ const attachmentsRef = (0, import_react29.useRef)([]);
45466
+ const [permissionReq, setPermissionReq] = (0, import_react29.useState)(null);
45467
+ const [modelPicker, setModelPicker] = (0, import_react29.useState)(null);
45468
+ const [filePicker, setFilePicker] = (0, import_react29.useState)(false);
45469
+ const [voiceMode, setVoiceMode] = (0, import_react29.useState)(false);
45470
+ const voiceModeRef = (0, import_react29.useRef)(false);
45471
+ const [toast, setToast] = (0, import_react29.useState)(null);
45472
+ const toastTimerRef = (0, import_react29.useRef)(null);
45473
+ const pushToast = (msg) => {
45474
+ setToast(msg);
45475
+ if (toastTimerRef.current) clearTimeout(toastTimerRef.current);
45476
+ toastTimerRef.current = setTimeout(() => setToast(null), 3500);
45477
+ };
45478
+ const [staticGen, setStaticGen] = (0, import_react29.useState)(0);
45479
+ const prevCommittedCountRef = (0, import_react29.useRef)(0);
45480
+ const cfgRef = (0, import_react29.useRef)(resolveConfig());
45481
+ const vimEnabledRef = (0, import_react29.useRef)(cfgRef.current.vim === true);
45482
+ const vimRef = (0, import_react29.useRef)(initialVim());
45483
+ const [vimTick, setVimTick] = (0, import_react29.useState)(0);
45484
+ const themeMgrRef = (0, import_react29.useRef)(null);
45485
+ const keyMgrRef = (0, import_react29.useRef)(null);
44786
45486
  const initialTheme = (() => {
44787
45487
  const name = _themeOverride || cfgRef.current.theme || "default";
44788
45488
  const c3 = (BUILTIN_THEMES.find((b) => b.name === name) ?? BUILTIN_THEMES.find((b) => b.name === "default"))?.colors;
@@ -44795,9 +45495,9 @@ var REPL = ({
44795
45495
  border: c3?.border ?? "#3F3F46"
44796
45496
  };
44797
45497
  })();
44798
- const [accentColor, setAccentColor] = (0, import_react28.useState)(initialTheme.accent);
44799
- const [theme, setTheme] = (0, import_react28.useState)(initialTheme);
44800
- (0, import_react28.useEffect)(() => {
45498
+ const [accentColor, setAccentColor] = (0, import_react29.useState)(initialTheme.accent);
45499
+ const [theme, setTheme] = (0, import_react29.useState)(initialTheme);
45500
+ (0, import_react29.useEffect)(() => {
44801
45501
  let cancelled = false;
44802
45502
  (async () => {
44803
45503
  try {
@@ -44842,15 +45542,15 @@ var REPL = ({
44842
45542
  keyMgrRef.current?.stopWatching?.();
44843
45543
  };
44844
45544
  }, []);
44845
- const toolsEnabled = (0, import_react28.useMemo)(() => listTools().length > 0, []);
44846
- (0, import_react28.useEffect)(() => {
44847
- void checkForUpdate("0.2.5").then((info) => {
45545
+ const toolsEnabled = (0, import_react29.useMemo)(() => listTools().length > 0, []);
45546
+ (0, import_react29.useEffect)(() => {
45547
+ void checkForUpdate("0.2.7").then((info) => {
44848
45548
  if (info?.updateAvailable) {
44849
45549
  setNotes((p) => [
44850
45550
  ...p,
44851
45551
  {
44852
45552
  kind: "system",
44853
- text: `Update available: ${"0.2.5"} \u2192 ${info.latest}. Run \`kryven update\` to update.`
45553
+ text: `Update available: ${"0.2.7"} \u2192 ${info.latest}. Run \`kryven update\` to update.`
44854
45554
  }
44855
45555
  ]);
44856
45556
  }
@@ -44876,7 +45576,7 @@ var REPL = ({
44876
45576
  }
44877
45577
  })();
44878
45578
  }, []);
44879
- const completion = (0, import_react28.useMemo)(() => {
45579
+ const completion = (0, import_react29.useMemo)(() => {
44880
45580
  if (busy || permissionReq || overlay || !input) return null;
44881
45581
  try {
44882
45582
  return getCompletions(input, input.length, cwd2);
@@ -44909,6 +45609,35 @@ var REPL = ({
44909
45609
  }
44910
45610
  return;
44911
45611
  }
45612
+ if (effortPicker) {
45613
+ if (key.upArrow) {
45614
+ setEffortPicker((p) => p ? { sel: Math.max(0, p.sel - 1) } : p);
45615
+ return;
45616
+ }
45617
+ if (key.downArrow) {
45618
+ setEffortPicker((p) => p ? { sel: Math.min(EFFORT_LEVELS.length - 1, p.sel + 1) } : p);
45619
+ return;
45620
+ }
45621
+ if (key.return) {
45622
+ const lvl = EFFORT_LEVELS[effortPicker.sel];
45623
+ if (lvl) {
45624
+ setEffort(lvl);
45625
+ try {
45626
+ saveUserConfig({ ...loadUserConfig(), effort: lvl });
45627
+ } catch {
45628
+ }
45629
+ setNotes((p) => [...p, { kind: "system", text: `Effort: ${lvl}` }]);
45630
+ }
45631
+ setEffortPicker(null);
45632
+ return;
45633
+ }
45634
+ if (key.escape) {
45635
+ setEffortPicker(null);
45636
+ return;
45637
+ }
45638
+ return;
45639
+ }
45640
+ if (filePicker) return;
44912
45641
  if (permissionReq && permissionResolveRef.current) {
44913
45642
  const ch = inputCh.toLowerCase();
44914
45643
  let decision = null;
@@ -44925,6 +45654,7 @@ var REPL = ({
44925
45654
  }
44926
45655
  if (key.ctrl && inputCh === "c") {
44927
45656
  if (abortRef.current) abortRef.current.abort();
45657
+ stopSpeaking();
44928
45658
  if (permissionResolveRef.current) {
44929
45659
  permissionResolveRef.current("deny");
44930
45660
  permissionResolveRef.current = null;
@@ -44932,6 +45662,28 @@ var REPL = ({
44932
45662
  }
44933
45663
  return;
44934
45664
  }
45665
+ if (key.ctrl && (inputCh === "y" || inputCh === "Y")) {
45666
+ const lastAsst = [...conversationRef.current.all()].reverse().find((m) => m.role === "assistant");
45667
+ const content = lastAsst?.content || "";
45668
+ const blocks = extractCodeBlocks(content);
45669
+ const target = blocks.length > 0 ? blocks[blocks.length - 1] : content.trim();
45670
+ if (target) {
45671
+ void copyToClipboard(target);
45672
+ pushToast(blocks.length > 0 ? "\u2713 Copied command to clipboard" : "\u2713 Copied reply to clipboard");
45673
+ } else {
45674
+ pushToast("Nothing to copy yet");
45675
+ }
45676
+ return;
45677
+ }
45678
+ const openPickerOk = !busy && !permissionReq && !overlay && !modelPicker;
45679
+ if (openPickerOk && key.ctrl && (inputCh === "g" || inputCh === "G")) {
45680
+ setFilePicker(true);
45681
+ return;
45682
+ }
45683
+ if (openPickerOk && inputCh === "+" && !key.ctrl && !key.meta && input.trim() === "") {
45684
+ setFilePicker(true);
45685
+ return;
45686
+ }
44935
45687
  if (key.tab && key.shift && !permissionReq && !overlay) {
44936
45688
  const next = cyclePermissionMode();
44937
45689
  setNotes((p) => [...p, { kind: "system", text: `Permission mode: ${next}` }]);
@@ -44968,7 +45720,7 @@ var REPL = ({
44968
45720
  if (out.consumed) setVimTick((n2) => n2 + 1);
44969
45721
  }
44970
45722
  });
44971
- const slashCtx = (0, import_react28.useMemo)(
45723
+ const slashCtx = (0, import_react29.useMemo)(
44972
45724
  () => ({
44973
45725
  conversation: conversationRef.current,
44974
45726
  model,
@@ -44978,6 +45730,14 @@ var REPL = ({
44978
45730
  sessionMessages: conversationRef.current.size(),
44979
45731
  setModel: (m) => setModel(m),
44980
45732
  setMood: (m) => setMood(m),
45733
+ effort,
45734
+ setEffort: (e) => {
45735
+ setEffort(e);
45736
+ try {
45737
+ saveUserConfig({ ...loadUserConfig(), effort: e });
45738
+ } catch {
45739
+ }
45740
+ },
44981
45741
  // /login: validate a new key, persist it, and hot-swap the live client so
44982
45742
  // the next message uses it — no restart. Flips guest -> authenticated too.
44983
45743
  relogin: async (rawKey) => {
@@ -44990,7 +45750,7 @@ var REPL = ({
44990
45750
  apiKey: key,
44991
45751
  baseUrl: cfg.apiBaseUrl,
44992
45752
  clientType: "ide",
44993
- userAgent: `kryven-cli/${"0.2.5"}`
45753
+ userAgent: `kryven-cli/${"0.2.7"}`
44994
45754
  });
44995
45755
  try {
44996
45756
  await candidate.ping();
@@ -45009,7 +45769,7 @@ var REPL = ({
45009
45769
  return { ok: true, message: `Logged in \u2014 key validated, saved, and active for this session.${toolHint}` };
45010
45770
  }
45011
45771
  }),
45012
- [model, mood, cwd2, sessionTokens]
45772
+ [model, mood, effort, cwd2, sessionTokens]
45013
45773
  );
45014
45774
  const handleSlashResult = (res) => {
45015
45775
  switch (res.type) {
@@ -45079,6 +45839,11 @@ var REPL = ({
45079
45839
  setModelPicker({ sel: idx >= 0 ? idx : 0 });
45080
45840
  return;
45081
45841
  }
45842
+ case "effort-picker": {
45843
+ const eIdx = EFFORT_LEVELS.indexOf(effort);
45844
+ setEffortPicker({ sel: eIdx >= 0 ? eIdx : 0 });
45845
+ return;
45846
+ }
45082
45847
  }
45083
45848
  };
45084
45849
  const askPermission = (req) => new Promise((resolve7) => {
@@ -45090,9 +45855,28 @@ var REPL = ({
45090
45855
  });
45091
45856
  });
45092
45857
  const submit = async (rawText) => {
45093
- const text = rawText.trim();
45858
+ let processedText = rawText;
45859
+ if (attachmentsRef.current.length > 0) {
45860
+ for (const attachment of attachmentsRef.current) {
45861
+ processedText = processedText.replace(attachment.label, attachment.path);
45862
+ }
45863
+ attachmentsRef.current = [];
45864
+ }
45865
+ const text = processedText.trim();
45094
45866
  if (!text || busy || permissionReq) return;
45095
45867
  setInput("");
45868
+ if (/^\/voice(\s|$)/i.test(text)) {
45869
+ const arg = text.replace(/^\/voice\s*/i, "").trim().toLowerCase();
45870
+ const next = arg === "on" ? true : arg === "off" ? false : !voiceModeRef.current;
45871
+ voiceModeRef.current = next;
45872
+ setVoiceMode(next);
45873
+ if (!next) stopSpeaking();
45874
+ setNotes((p) => [...p, {
45875
+ kind: "system",
45876
+ text: next ? `Voice + conversation mode ON \u2014 I'll talk through my work and read replies aloud.${ttsLikelyAvailable() ? "" : " (no OS voice detected; conversational text still applies)"}` : "Voice mode OFF."
45877
+ }]);
45878
+ return;
45879
+ }
45096
45880
  const slash = parseSlash(text);
45097
45881
  if (slash) {
45098
45882
  let cmd = findCommand(slash.name);
@@ -45116,24 +45900,34 @@ var REPL = ({
45116
45900
  }
45117
45901
  return;
45118
45902
  }
45119
- const userMsg = { role: "user", content: text, ts: Date.now() };
45903
+ let promptText = text;
45904
+ if (attachmentsRef.current.length > 0) {
45905
+ for (const a2 of attachmentsRef.current) promptText = promptText.split(a2.label).join(a2.path);
45906
+ attachmentsRef.current = [];
45907
+ }
45908
+ const userMsg = { role: "user", content: promptText, ts: Date.now() };
45120
45909
  conversationRef.current.append(userMsg);
45121
45910
  void sessionRef.current.appendMessage(userMsg);
45122
45911
  if (remoteSessionRef.current) {
45123
45912
  void remoteSessionRef.current.appendMessage(userMsg).catch(() => {
45124
45913
  });
45125
45914
  }
45126
- void appendHistory({ ts: userMsg.ts, cwd: cwd2, prompt: text });
45915
+ void appendHistory({ ts: userMsg.ts, cwd: cwd2, prompt: promptText });
45127
45916
  forceRender((n2) => n2 + 1);
45128
- const sys = composeSystemPrompt({
45917
+ const baseSys = composeSystemPrompt({
45129
45918
  cwd: cwd2,
45130
45919
  git,
45131
45920
  toolsList: toolsEnabled ? listTools().map((t) => t.name) : void 0
45132
45921
  });
45922
+ const sys = voiceModeRef.current ? `${baseSys}
45923
+
45924
+ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
45133
45925
  const ac = new AbortController();
45134
45926
  abortRef.current = ac;
45135
45927
  setBusy(true);
45136
45928
  setToolEntries([]);
45929
+ turnActionsRef.current.clear();
45930
+ setLastSummary("");
45137
45931
  try {
45138
45932
  if (isGuest) {
45139
45933
  await runGuestTurn(ac);
@@ -45154,6 +45948,10 @@ var REPL = ({
45154
45948
  setStreaming(null);
45155
45949
  setBusy(false);
45156
45950
  forceRender((n2) => n2 + 1);
45951
+ if (voiceModeRef.current && !ac.signal.aborted) {
45952
+ const lastAsst = [...conversationRef.current.all()].reverse().find((m) => m.role === "assistant");
45953
+ if (lastAsst?.content) void speak(lastAsst.content);
45954
+ }
45157
45955
  }
45158
45956
  };
45159
45957
  const runGuestTurn = async (ac) => {
@@ -45239,7 +46037,7 @@ var REPL = ({
45239
46037
  }
45240
46038
  };
45241
46039
  const reflectCmd = detectReflectCommand(cwd2);
45242
- for await (const ev of runAgentLoopWithTools(clientRef.current, conversationRef.current, {
46040
+ const loopOpts = {
45243
46041
  systemPrompt: sys,
45244
46042
  model,
45245
46043
  mood,
@@ -45248,7 +46046,10 @@ var REPL = ({
45248
46046
  toolCtx: { cwd: cwd2, readPaths: readPathsRef.current },
45249
46047
  signal: ac.signal,
45250
46048
  reflect: reflectCmd ? { command: reflectCmd, cwd: cwd2, maxReflections: Number(process.env.KRYVEN_MAX_REFLECTIONS) || 2 } : void 0
45251
- })) {
46049
+ };
46050
+ const client2 = clientRef.current;
46051
+ const eventSource = effort === "low" ? runAgentLoopWithTools(client2, conversationRef.current, loopOpts) : runEffortOrchestration(client2, conversationRef.current, loopOpts, effort);
46052
+ for await (const ev of eventSource) {
45252
46053
  switch (ev.type) {
45253
46054
  case "iteration_start":
45254
46055
  streamAcc = "";
@@ -45277,6 +46078,11 @@ var REPL = ({
45277
46078
  };
45278
46079
  toolMetaRef.current.set(entry.callId, entry);
45279
46080
  setToolEntries((prev) => [...prev, entry]);
46081
+ turnActionsRef.current.set(entry.callId, {
46082
+ tool: ev.call.function.name,
46083
+ file: extractFileFromArgs(ev.call.function.arguments),
46084
+ ok: false
46085
+ });
45280
46086
  }
45281
46087
  break;
45282
46088
  case "tool_result": {
@@ -45293,6 +46099,10 @@ var REPL = ({
45293
46099
  renderHint: ev.renderHint
45294
46100
  });
45295
46101
  setToolEntries((prev) => prev.filter((e) => e.callId !== ev.callId));
46102
+ {
46103
+ const a2 = turnActionsRef.current.get(ev.callId);
46104
+ if (a2) a2.ok = ev.ok;
46105
+ }
45296
46106
  const toolMsg = {
45297
46107
  role: "tool",
45298
46108
  content: ev.output,
@@ -45323,16 +46133,21 @@ var REPL = ({
45323
46133
  endedNormally = true;
45324
46134
  setStreaming(null);
45325
46135
  streamAcc = "";
46136
+ setLastSummary(buildTurnSummary([...turnActionsRef.current.values()]));
45326
46137
  if (ev.usage) setSessionTokens((t) => t + ev.usage.total_tokens);
45327
46138
  flushPersistableTurns();
45328
46139
  break;
45329
46140
  case "reflection":
45330
46141
  setStreaming(null);
45331
46142
  streamAcc = "";
45332
- setNotes((p) => [
45333
- ...p,
45334
- ev.ok ? { kind: "system", text: "Self-check passed \u2713" } : { kind: "system", text: "Self-check failed \u2014 repairing\u2026" }
45335
- ]);
46143
+ if (ev.phase?.startsWith("effort:") || ev.phase?.startsWith("escalate:")) {
46144
+ setNotes((p) => [...p, { kind: "system", text: `${ev.ok ? "\u25B8" : "\u26A0"} ${ev.detail}` }]);
46145
+ } else {
46146
+ setNotes((p) => [
46147
+ ...p,
46148
+ ev.ok ? { kind: "system", text: "Self-check passed \u2713" } : { kind: "system", text: "Self-check failed \u2014 repairing\u2026" }
46149
+ ]);
46150
+ }
45336
46151
  break;
45337
46152
  case "max_iterations":
45338
46153
  setNotes((p) => [
@@ -45367,16 +46182,16 @@ var REPL = ({
45367
46182
  costUsd: sessionCostUsd(conversationRef.current.all(), model),
45368
46183
  mode: getPermissionMode()
45369
46184
  };
45370
- const staticItems = (0, import_react28.useMemo)(() => {
46185
+ const staticItems = (0, import_react29.useMemo)(() => {
45371
46186
  const gen = `g${staticGen}`;
45372
46187
  const items = [
45373
46188
  {
45374
46189
  id: `${gen}-header`,
45375
- node: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
45376
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Wordmark, { muted: theme.muted, fg: theme.fg }),
45377
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { color: theme.muted, children: [
46190
+ node: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
46191
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Wordmark, { muted: theme.muted, fg: theme.fg }),
46192
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { color: theme.muted, children: [
45378
46193
  "Kryven CLI ",
45379
- "0.2.5",
46194
+ "0.2.7",
45380
46195
  toolsEnabled ? " \xB7 tools" : "",
45381
46196
  " \xB7 Powered by KRY-5.2 Extended"
45382
46197
  ] }) })
@@ -45397,11 +46212,12 @@ var REPL = ({
45397
46212
  }
45398
46213
  for (let i2 = 0; i2 < all.length; i2++) {
45399
46214
  const m = all[i2];
46215
+ if (m.ephemeral) continue;
45400
46216
  if (m.role === "user") {
45401
- items.push({ id: `${gen}-m${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MessageList, { message: m }) });
46217
+ items.push({ id: `${gen}-m${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MessageList, { message: m, theme }) });
45402
46218
  } else if (m.role === "assistant") {
45403
46219
  if (typeof m.content === "string" && m.content.trim().length > 0) {
45404
- items.push({ id: `${gen}-m${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MessageList, { message: m }) });
46220
+ items.push({ id: `${gen}-m${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MessageList, { message: m, theme }) });
45405
46221
  }
45406
46222
  } else if (m.role === "tool") {
45407
46223
  const meta = m.tool_call_id ? toolMetaRef.current.get(m.tool_call_id) : void 0;
@@ -45413,103 +46229,147 @@ var REPL = ({
45413
46229
  status: "ok",
45414
46230
  output: typeof m.content === "string" ? m.content : ""
45415
46231
  };
45416
- items.push({ id: `${gen}-t${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ToolCall, { ...entry }) });
46232
+ items.push({ id: `${gen}-t${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ToolCall, { ...entry }) });
45417
46233
  }
45418
46234
  }
45419
46235
  return items;
45420
46236
  }, [convSize, staticGen, toolsEnabled]);
45421
46237
  const committedCount = staticItems.length;
45422
- (0, import_react28.useEffect)(() => {
46238
+ (0, import_react29.useEffect)(() => {
45423
46239
  if (committedCount < prevCommittedCountRef.current) {
45424
46240
  setStaticGen((g) => g + 1);
45425
46241
  }
45426
46242
  prevCommittedCountRef.current = committedCount;
45427
46243
  }, [committedCount]);
45428
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "column", children: [
45429
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Static, { items: staticItems, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { flexDirection: "column", children: item.node }, item.id) }, staticGen),
45430
- streaming != null && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
45431
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { bold: true, color: "green", children: "kryven" }),
45432
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { paddingLeft: 2, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MarkdownStream, { streamingText: streaming, done: !busy }) })
46244
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", children: [
46245
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Static, { items: staticItems, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box_default, { flexDirection: "column", children: item.node }, item.id) }, staticGen),
46246
+ streaming != null && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
46247
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { bold: true, color: "green", children: "kryven" }),
46248
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box_default, { paddingLeft: 2, flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MarkdownStream, { streamingText: streaming, done: !busy }) })
45433
46249
  ] }),
45434
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ToolCallList, { entries: toolEntries, paused: Boolean(permissionReq) }),
45435
- modelPicker && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ModelPicker, { models: MODELS, selected: modelPicker.sel, current: model }),
45436
- permissionReq && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, borderStyle: "round", borderColor: "yellow", paddingX: 1, children: [
45437
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { bold: true, children: "Permission required" }),
45438
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
46250
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ToolCallList, { entries: toolEntries, paused: Boolean(permissionReq) }),
46251
+ modelPicker && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ModelPicker, { models: MODELS, selected: modelPicker.sel, current: model }),
46252
+ effortPicker && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EffortPicker, { selected: effortPicker.sel, current: effort }),
46253
+ filePicker && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
46254
+ FilePicker,
46255
+ {
46256
+ cwd: cwd2,
46257
+ theme,
46258
+ onSubmit: (rels) => {
46259
+ setFilePicker(false);
46260
+ if (rels.length > 0) {
46261
+ const chips = [];
46262
+ for (const r of rels) {
46263
+ const n2 = attachmentsRef.current.length + 1;
46264
+ const name = r.split(/[\\/]/).pop() || r;
46265
+ const label = `[File #${n2}: ${name}]`;
46266
+ attachmentsRef.current.push({ label, path: r });
46267
+ chips.push(label);
46268
+ }
46269
+ const tokens = chips.join(" ");
46270
+ setInput((prev) => prev ? `${prev} ${tokens} ` : `${tokens} `);
46271
+ pushToast(`Added ${rels.length} file${rels.length === 1 ? "" : "s"} to the prompt`);
46272
+ }
46273
+ setVimTick((n2) => n2 + 1);
46274
+ },
46275
+ onCancel: () => setFilePicker(false)
46276
+ }
46277
+ ) }),
46278
+ permissionReq && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, borderStyle: "round", borderColor: "yellow", paddingX: 1, children: [
46279
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { bold: true, children: "Permission required" }),
46280
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
45439
46281
  "Tool: ",
45440
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "cyan", children: permissionReq.toolName }),
46282
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "cyan", children: permissionReq.toolName }),
45441
46283
  " ",
45442
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { color: riskColor(permissionReq.risk), children: [
46284
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { color: riskColor(permissionReq.risk), children: [
45443
46285
  "[",
45444
46286
  permissionReq.risk,
45445
46287
  "]"
45446
46288
  ] })
45447
46289
  ] }),
45448
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "gray", children: permissionReq.argsPreview }),
45449
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
45450
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "green", children: "[Y]" }),
46290
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "gray", children: permissionReq.argsPreview }),
46291
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
46292
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "green", children: "[Y]" }),
45451
46293
  " allow once \xB7",
45452
46294
  " ",
45453
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "green", children: "[A]" }),
46295
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "green", children: "[A]" }),
45454
46296
  " always (this command) \xB7",
45455
46297
  " ",
45456
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "green", children: "[Shift+A]" }),
46298
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "green", children: "[Shift+A]" }),
45457
46299
  " always (this tool) \xB7",
45458
46300
  " ",
45459
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "red", children: "[N]" }),
46301
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "red", children: "[N]" }),
45460
46302
  " deny"
45461
46303
  ] })
45462
46304
  ] }),
45463
- notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { flexDirection: "column", marginBottom: 1, children: notes.slice(-3).map((n2, i2) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { color: n2.kind === "error" ? "red" : "gray", children: [
46305
+ notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box_default, { flexDirection: "column", marginBottom: 1, children: notes.slice(-3).map((n2, i2) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { color: n2.kind === "error" ? "red" : "gray", children: [
45464
46306
  n2.kind === "error" ? "\u2717 " : "\xB7 ",
45465
46307
  n2.text
45466
46308
  ] }, i2)) }),
45467
- overlay && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { marginBottom: 1, flexDirection: "column", children: [
46309
+ overlay && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { marginBottom: 1, flexDirection: "column", children: [
45468
46310
  overlay,
45469
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: "gray", children: "(press Enter or Esc to dismiss)" })
46311
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "gray", children: "(press Enter or Esc to dismiss)" })
46312
+ ] }),
46313
+ completion && completion.items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CompletionMenu, { items: completion.items, selected: 0 }),
46314
+ voiceMode && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { children: [
46315
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.accent, children: "\u{1F399} voice + conversation mode \u2014 replies read aloud \xB7 " }),
46316
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: "/voice to turn off" })
45470
46317
  ] }),
45471
- completion && completion.items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CompletionMenu, { items: completion.items, selected: 0 }),
45472
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
46318
+ toast && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.accent, children: toast }) }),
46319
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
45473
46320
  PromptInput,
45474
46321
  {
45475
46322
  value: input,
45476
46323
  onChange: setInput,
45477
46324
  onSubmit: submit,
45478
- disabled: busy || Boolean(permissionReq) || Boolean(modelPicker),
46325
+ disabled: busy || Boolean(permissionReq) || Boolean(modelPicker) || Boolean(effortPicker) || filePicker,
45479
46326
  placeholder: busy ? "" : void 0,
45480
46327
  vimMode: vimEnabledRef.current ? vimRef.current.mode : null,
45481
46328
  vimCmdline: vimEnabledRef.current ? vimRef.current.cmdline : null,
45482
46329
  accentColor,
45483
- model,
45484
- mood,
46330
+ summary: lastSummary,
45485
46331
  themeColors: theme
45486
46332
  },
45487
46333
  `pi-${vimTick}`
45488
46334
  ),
45489
- isHome ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
45490
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "row", gap: 2, justifyContent: "flex-end", children: [
45491
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
45492
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.fg, children: "/model" }),
45493
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.muted, children: " models" })
46335
+ isHome ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
46336
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "row", gap: 2, justifyContent: "flex-end", children: [
46337
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
46338
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.fg, children: "/model" }),
46339
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: " models" })
45494
46340
  ] }),
45495
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
45496
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.fg, children: "/help" }),
45497
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.muted, children: " commands" })
46341
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
46342
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.fg, children: "/help" }),
46343
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: " commands" })
45498
46344
  ] }),
45499
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
45500
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.fg, children: "shift+tab" }),
45501
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.muted, children: " mode" })
46345
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
46346
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.fg, children: "shift+tab" }),
46347
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: " mode" })
45502
46348
  ] })
45503
46349
  ] }),
45504
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box_default, { marginTop: 1, flexDirection: "row", children: [
45505
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.warn, children: "\u25CF Tip " }),
45506
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.muted, children: "Run " }),
45507
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.fg, children: isGuest ? "/login" : "/model" }),
45508
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { color: theme.muted, children: isGuest ? " to unlock unlimited chat and tools." : " to switch models, or /help for all commands." })
46350
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "row", gap: 2, justifyContent: "flex-end", children: [
46351
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
46352
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.fg, children: "+" }),
46353
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: " add files" })
46354
+ ] }),
46355
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
46356
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.fg, children: "ctrl+y" }),
46357
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: " copy cmd" })
46358
+ ] }),
46359
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
46360
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.fg, children: "/voice" }),
46361
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: " talk" })
46362
+ ] })
46363
+ ] }),
46364
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { marginTop: 1, flexDirection: "row", children: [
46365
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.warn, children: "\u25CF Tip " }),
46366
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: "Run " }),
46367
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.fg, children: isGuest ? "/login" : "/model" }),
46368
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: theme.muted, children: isGuest ? " to unlock unlimited chat and tools." : " to switch models, or /help for all commands." })
45509
46369
  ] })
45510
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
45511
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { marginTop: 1, children: busy && !permissionReq && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Spinner2, { label: "thinking\u2026 (Ctrl+C to cancel)" }) }),
45512
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(StatusBar, { status }) })
46370
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
46371
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box_default, { marginTop: 1, children: busy && !permissionReq && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Spinner2, { label: "thinking\u2026 (Ctrl+C to cancel)" }) }),
46372
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(StatusBar, { status }) })
45513
46373
  ] })
45514
46374
  ] });
45515
46375
  };
@@ -45522,19 +46382,19 @@ init_errors();
45522
46382
  init_logger();
45523
46383
 
45524
46384
  // src/utils/fingerprint.ts
45525
- import { readFileSync as readFileSync13, writeFileSync as writeFileSync7, existsSync as existsSync20, mkdirSync as mkdirSync6, chmodSync as chmodSync2 } from "node:fs";
45526
- import { dirname as dirname15, join as join29 } from "node:path";
46385
+ import { readFileSync as readFileSync13, writeFileSync as writeFileSync7, existsSync as existsSync21, mkdirSync as mkdirSync6, chmodSync as chmodSync2 } from "node:fs";
46386
+ import { dirname as dirname16, join as join31 } from "node:path";
45527
46387
  import { homedir as homedir10 } from "node:os";
45528
46388
  import { createHash as createHash3, randomBytes } from "node:crypto";
45529
46389
  import os6 from "node:os";
45530
- var FP_PATH = join29(homedir10(), ".kryven", ".fingerprint");
46390
+ var FP_PATH = join31(homedir10(), ".kryven", ".fingerprint");
45531
46391
  function readMachineId() {
45532
46392
  try {
45533
- if (existsSync20("/etc/machine-id")) return readFileSync13("/etc/machine-id", "utf8").trim();
46393
+ if (existsSync21("/etc/machine-id")) return readFileSync13("/etc/machine-id", "utf8").trim();
45534
46394
  } catch {
45535
46395
  }
45536
46396
  try {
45537
- if (existsSync20("/var/lib/dbus/machine-id")) return readFileSync13("/var/lib/dbus/machine-id", "utf8").trim();
46397
+ if (existsSync21("/var/lib/dbus/machine-id")) return readFileSync13("/var/lib/dbus/machine-id", "utf8").trim();
45538
46398
  } catch {
45539
46399
  }
45540
46400
  return "";
@@ -45562,7 +46422,7 @@ function getFingerprint(opts = {}) {
45562
46422
  return createHash3("sha256").update(randomBytes(32)).digest("hex");
45563
46423
  }
45564
46424
  if (cached) return cached;
45565
- if (existsSync20(FP_PATH)) {
46425
+ if (existsSync21(FP_PATH)) {
45566
46426
  try {
45567
46427
  const v = readFileSync13(FP_PATH, "utf8").trim();
45568
46428
  if (/^[a-f0-9]{32,128}$/i.test(v)) {
@@ -45574,7 +46434,7 @@ function getFingerprint(opts = {}) {
45574
46434
  }
45575
46435
  const fresh = computeFingerprint();
45576
46436
  try {
45577
- mkdirSync6(dirname15(FP_PATH), { recursive: true, mode: 448 });
46437
+ mkdirSync6(dirname16(FP_PATH), { recursive: true, mode: 448 });
45578
46438
  writeFileSync7(FP_PATH, fresh, { mode: 384 });
45579
46439
  chmodSync2(FP_PATH, 384);
45580
46440
  } catch {
@@ -45654,11 +46514,11 @@ init_tools();
45654
46514
  // src/commands-palette/file-commands.ts
45655
46515
  init_logger();
45656
46516
  import { readdir as readdir10, readFile as readFile16 } from "node:fs/promises";
45657
- import { existsSync as existsSync21 } from "node:fs";
45658
- import { join as join30, isAbsolute as isAbsolute12, resolve as resolve6 } from "node:path";
46517
+ import { existsSync as existsSync22 } from "node:fs";
46518
+ import { join as join32, isAbsolute as isAbsolute12, resolve as resolve6 } from "node:path";
45659
46519
  import { homedir as homedir11 } from "node:os";
45660
46520
  async function readDirCommands(dir, scope) {
45661
- if (!existsSync21(dir)) return [];
46521
+ if (!existsSync22(dir)) return [];
45662
46522
  const out = [];
45663
46523
  let entries;
45664
46524
  try {
@@ -45668,7 +46528,7 @@ async function readDirCommands(dir, scope) {
45668
46528
  }
45669
46529
  for (const e of entries) {
45670
46530
  if (!e.isFile() || !e.name.endsWith(".md")) continue;
45671
- const file = join30(dir, e.name);
46531
+ const file = join32(dir, e.name);
45672
46532
  try {
45673
46533
  const src = await readFile16(file, "utf8");
45674
46534
  const { frontmatter, body } = parseSkillFile(file, src);
@@ -45689,10 +46549,10 @@ async function readDirCommands(dir, scope) {
45689
46549
  async function loadFileCommands(cwd2) {
45690
46550
  const root = isAbsolute12(cwd2 || "") ? cwd2 : cwd2 ? resolve6(cwd2) : process.cwd();
45691
46551
  const sources = [
45692
- [join30(root, ".kryven", "commands"), "project-kryven"],
45693
- [join30(root, ".claude", "commands"), "project-claude"],
45694
- [join30(homedir11(), ".kryven", "commands"), "user-kryven"],
45695
- [join30(homedir11(), ".claude", "commands"), "user-claude"]
46552
+ [join32(root, ".kryven", "commands"), "project-kryven"],
46553
+ [join32(root, ".claude", "commands"), "project-claude"],
46554
+ [join32(homedir11(), ".kryven", "commands"), "user-kryven"],
46555
+ [join32(homedir11(), ".claude", "commands"), "user-claude"]
45696
46556
  ];
45697
46557
  const seen = /* @__PURE__ */ new Map();
45698
46558
  for (const [dir, scope] of sources) {
@@ -45724,11 +46584,11 @@ ${c3.body}${argText}`.trim(),
45724
46584
  init_logger();
45725
46585
  init_defaults();
45726
46586
  import { readFile as readFile17 } from "node:fs/promises";
45727
- import { existsSync as existsSync22 } from "node:fs";
45728
- import { join as join31 } from "node:path";
45729
- var MCP_CONFIG_PATH = join31(getConfigDir(), "mcp.json");
46587
+ import { existsSync as existsSync23 } from "node:fs";
46588
+ import { join as join33 } from "node:path";
46589
+ var MCP_CONFIG_PATH = join33(getConfigDir(), "mcp.json");
45730
46590
  async function loadMCPRegistry() {
45731
- if (!existsSync22(MCP_CONFIG_PATH)) return { servers: [] };
46591
+ if (!existsSync23(MCP_CONFIG_PATH)) return { servers: [] };
45732
46592
  try {
45733
46593
  const raw = await readFile17(MCP_CONFIG_PATH, "utf8");
45734
46594
  const parsed = JSON.parse(raw);
@@ -45775,14 +46635,14 @@ async function bootstrapMCP(opts = {}) {
45775
46635
  init_store();
45776
46636
 
45777
46637
  // src/tui/SetupWizard.tsx
45778
- var import_react29 = __toESM(require_react(), 1);
46638
+ var import_react30 = __toESM(require_react(), 1);
45779
46639
  init_client();
45780
46640
  init_crypto();
45781
46641
  init_errors();
45782
46642
  init_load();
45783
- var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
45784
- import { dirname as dirname16 } from "node:path";
45785
- import { spawn as spawn8 } from "node:child_process";
46643
+ var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
46644
+ import { dirname as dirname17 } from "node:path";
46645
+ import { spawn as spawn10 } from "node:child_process";
45786
46646
  var OPTIONS = [
45787
46647
  {
45788
46648
  id: "guest",
@@ -45799,10 +46659,10 @@ var SetupWizard = ({
45799
46659
  baseUrl,
45800
46660
  onDone
45801
46661
  }) => {
45802
- const [step, setStep] = (0, import_react29.useState)("choose");
45803
- const [sel, setSel] = (0, import_react29.useState)(0);
45804
- const [keyVal, setKeyVal] = (0, import_react29.useState)("");
45805
- const [error, setError] = (0, import_react29.useState)(null);
46662
+ const [step, setStep] = (0, import_react30.useState)("choose");
46663
+ const [sel, setSel] = (0, import_react30.useState)(0);
46664
+ const [keyVal, setKeyVal] = (0, import_react30.useState)("");
46665
+ const [error, setError] = (0, import_react30.useState)(null);
45806
46666
  use_input_default((input, key) => {
45807
46667
  if (key.ctrl && input === "c") {
45808
46668
  onDone({ mode: "cancel" });
@@ -45842,7 +46702,7 @@ var SetupWizard = ({
45842
46702
  apiKey: k,
45843
46703
  baseUrl,
45844
46704
  clientType: "ide",
45845
- userAgent: `kryven-cli/${"0.2.5"}`
46705
+ userAgent: `kryven-cli/${"0.2.7"}`
45846
46706
  }).ping();
45847
46707
  onDone({ mode: "key", key: k });
45848
46708
  } catch (err) {
@@ -45851,8 +46711,8 @@ var SetupWizard = ({
45851
46711
  }
45852
46712
  })();
45853
46713
  };
45854
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", children: [
45855
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
46714
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", children: [
46715
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
45856
46716
  Box_default,
45857
46717
  {
45858
46718
  flexDirection: "column",
@@ -45861,18 +46721,18 @@ var SetupWizard = ({
45861
46721
  paddingX: 2,
45862
46722
  marginBottom: 1,
45863
46723
  children: [
45864
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { bold: true, color: "magentaBright", children: "\u2726 Kryven CLI Setup Wizard" }),
45865
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "gray", children: "Let's configure your Kryven CLI. Press Ctrl+C any time to exit." })
46724
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { bold: true, color: "magentaBright", children: "\u2726 Kryven CLI Setup Wizard" }),
46725
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "gray", children: "Let's configure your Kryven CLI. Press Ctrl+C any time to exit." })
45866
46726
  ]
45867
46727
  }
45868
46728
  ),
45869
- step === "choose" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
45870
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "white", children: "How would you like to start?" }),
45871
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "gray", children: "Use \u2191/\u2193 (or 1-2), Enter to confirm." }),
45872
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box_default, { marginTop: 1, flexDirection: "column", children: OPTIONS.map((o2, i2) => {
46729
+ step === "choose" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
46730
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "white", children: "How would you like to start?" }),
46731
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "gray", children: "Use \u2191/\u2193 (or 1-2), Enter to confirm." }),
46732
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Box_default, { marginTop: 1, flexDirection: "column", children: OPTIONS.map((o2, i2) => {
45873
46733
  const on6 = i2 === sel;
45874
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
45875
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { color: on6 ? "greenBright" : "white", bold: on6, children: [
46734
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
46735
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Text, { color: on6 ? "greenBright" : "white", bold: on6, children: [
45876
46736
  on6 ? "(\u25CF)" : "(\u25CB)",
45877
46737
  " ",
45878
46738
  i2 + 1,
@@ -45880,20 +46740,20 @@ var SetupWizard = ({
45880
46740
  o2.title,
45881
46741
  o2.id === "guest" ? " (recommended)" : ""
45882
46742
  ] }),
45883
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { color: "gray", children: [
46743
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Text, { color: "gray", children: [
45884
46744
  " ",
45885
46745
  o2.desc
45886
46746
  ] })
45887
46747
  ] }, o2.id);
45888
46748
  }) }),
45889
- error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "red", children: error })
46749
+ error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "red", children: error })
45890
46750
  ] }),
45891
- step === "enter-key" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
45892
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: "Paste your Kryven API key:" }),
45893
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "gray", children: "Get one at https://kryven.cc/api-dashboard" }),
45894
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box_default, { marginTop: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
45895
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "cyan", children: "kry> " }),
45896
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
46751
+ step === "enter-key" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
46752
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { children: "Paste your Kryven API key:" }),
46753
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "gray", children: "Get one at https://kryven.cc/api-dashboard" }),
46754
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Box_default, { marginTop: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
46755
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "cyan", children: "kry> " }),
46756
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
45897
46757
  build_default,
45898
46758
  {
45899
46759
  value: keyVal,
@@ -45904,20 +46764,20 @@ var SetupWizard = ({
45904
46764
  }
45905
46765
  )
45906
46766
  ] }),
45907
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "gray", children: "Enter to validate \xB7 Esc to go back" }),
45908
- error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "red", children: error })
46767
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "gray", children: "Enter to validate \xB7 Esc to go back" }),
46768
+ error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "red", children: error })
45909
46769
  ] }),
45910
- step === "validating" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { color: "yellow", children: "Validating key against /v1/models\u2026" }) })
46770
+ step === "validating" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "yellow", children: "Validating key against /v1/models\u2026" }) })
45911
46771
  ] });
45912
46772
  };
45913
46773
  function openBrowser(url) {
45914
46774
  try {
45915
46775
  if (process.platform === "win32") {
45916
- spawn8("cmd", ["/c", "start", "", url], { detached: true, stdio: "ignore" }).unref();
46776
+ spawn10("cmd", ["/c", "start", "", url], { detached: true, stdio: "ignore" }).unref();
45917
46777
  } else if (process.platform === "darwin") {
45918
- spawn8("open", [url], { detached: true, stdio: "ignore" }).unref();
46778
+ spawn10("open", [url], { detached: true, stdio: "ignore" }).unref();
45919
46779
  } else {
45920
- spawn8("xdg-open", [url], { detached: true, stdio: "ignore" }).unref();
46780
+ spawn10("xdg-open", [url], { detached: true, stdio: "ignore" }).unref();
45921
46781
  }
45922
46782
  } catch {
45923
46783
  }
@@ -45925,7 +46785,7 @@ function openBrowser(url) {
45925
46785
  function runSetupWizard(baseUrl) {
45926
46786
  return new Promise((resolve7) => {
45927
46787
  const instance = render_default(
45928
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
46788
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
45929
46789
  SetupWizard,
45930
46790
  {
45931
46791
  baseUrl,
@@ -45943,7 +46803,7 @@ async function maybeRunFirstRunSetup(opts) {
45943
46803
  const cfg = resolveConfig(opts.apiKey);
45944
46804
  const user = loadUserConfig();
45945
46805
  if (user.setupComplete || cfg.apiKeySource !== "none" || !process.stdin.isTTY) return;
45946
- console.log(source_default.green(`[OK] Config directory ready at ${dirname16(cfg.configPath)}`));
46806
+ console.log(source_default.green(`[OK] Config directory ready at ${dirname17(cfg.configPath)}`));
45947
46807
  console.log(source_default.green("[OK] 6 built-in tools available (Read/Write/Edit/Bash/Glob/Grep)"));
45948
46808
  console.log(source_default.cyan("\n-> Starting setup wizard...\n"));
45949
46809
  const res = await runSetupWizard(cfg.apiBaseUrl);
@@ -45976,7 +46836,7 @@ async function chatCommand(opts = {}) {
45976
46836
  client = new GuestKryvenClient({
45977
46837
  baseUrl: cfg.apiBaseUrl,
45978
46838
  shareFingerprint: cfg.shareFingerprint !== false,
45979
- userAgent: `kryven-cli/${"0.2.5"}`
46839
+ userAgent: `kryven-cli/${"0.2.7"}`
45980
46840
  });
45981
46841
  console.log(source_default.cyan("Guest mode \u2014 3 free prompts. Run `kryven login` for unlimited chat."));
45982
46842
  } else {
@@ -45984,7 +46844,7 @@ async function chatCommand(opts = {}) {
45984
46844
  apiKey: cfg.apiKey,
45985
46845
  baseUrl: cfg.apiBaseUrl,
45986
46846
  clientType: "ide",
45987
- userAgent: `kryven-cli/${"0.2.5"}`
46847
+ userAgent: `kryven-cli/${"0.2.7"}`
45988
46848
  });
45989
46849
  }
45990
46850
  let resumeMessages;
@@ -46051,7 +46911,7 @@ async function chatCommand(opts = {}) {
46051
46911
  logger.warn("config save (touch) failed", String(err));
46052
46912
  }
46053
46913
  const { waitUntilExit } = render_default(
46054
- import_react30.default.createElement(REPL, {
46914
+ import_react31.default.createElement(REPL, {
46055
46915
  client,
46056
46916
  initialModel: model,
46057
46917
  initialMood: mood,
@@ -46072,7 +46932,7 @@ async function chatCommand(opts = {}) {
46072
46932
  init_execa();
46073
46933
 
46074
46934
  // src/shims/version.ts
46075
- var KRYVEN_VERSION = "0.2.5";
46935
+ var KRYVEN_VERSION = "0.2.7";
46076
46936
 
46077
46937
  // src/commands/update.ts
46078
46938
  var PACKAGE2 = "@kryvenaiofficial/kryven";
@@ -46102,10 +46962,10 @@ On macOS/Linux a global install may need sudo:
46102
46962
 
46103
46963
  // src/commands/skills.ts
46104
46964
  import { writeFile as writeFile11, mkdir as mkdir13 } from "node:fs/promises";
46105
- import { existsSync as existsSync23 } from "node:fs";
46106
- import { join as join32 } from "node:path";
46965
+ import { existsSync as existsSync24 } from "node:fs";
46966
+ import { join as join34 } from "node:path";
46107
46967
  import { homedir as homedir12 } from "node:os";
46108
- import { spawn as spawn9 } from "node:child_process";
46968
+ import { spawn as spawn11 } from "node:child_process";
46109
46969
  var SCOPE_LABEL3 = {
46110
46970
  "project-kryven": "project (.kryven)",
46111
46971
  "project-claude": "project (.claude)",
@@ -46203,19 +47063,19 @@ async function skillsCreate(name) {
46203
47063
  process.exit(2);
46204
47064
  }
46205
47065
  const safe = name.replace(/[^a-zA-Z0-9._-]/g, "-").toLowerCase();
46206
- const dir = join32(homedir12(), ".kryven", "skills", safe);
46207
- if (existsSync23(dir)) {
47066
+ const dir = join34(homedir12(), ".kryven", "skills", safe);
47067
+ if (existsSync24(dir)) {
46208
47068
  console.error(source_default.red(`Already exists at ${dir}.`));
46209
47069
  process.exit(1);
46210
47070
  }
46211
47071
  await mkdir13(dir, { recursive: true, mode: 448 });
46212
- const file = join32(dir, "SKILL.md");
47072
+ const file = join34(dir, "SKILL.md");
46213
47073
  await writeFile11(file, SKELETON_SKILL_MD.replace(/NAME_PLACEHOLDER/g, safe), { mode: 384 });
46214
47074
  console.log(source_default.green(`Created ${file}`));
46215
47075
  const editor = process.env.EDITOR || process.env.VISUAL || "vi";
46216
47076
  console.log(source_default.dim(`Opening in ${editor}\u2026`));
46217
47077
  await new Promise((resolveP) => {
46218
- const child = spawn9(editor, [file], { stdio: "inherit" });
47078
+ const child = spawn11(editor, [file], { stdio: "inherit" });
46219
47079
  child.on("close", () => resolveP());
46220
47080
  child.on("error", () => resolveP());
46221
47081
  });
@@ -46248,12 +47108,12 @@ async function skillsUpdate(name) {
46248
47108
  }
46249
47109
  for (const s of targets) {
46250
47110
  const dir = s.sourcePath.replace(/\/SKILL\.md$/, "");
46251
- if (!existsSync23(join32(dir, ".git"))) {
47111
+ if (!existsSync24(join34(dir, ".git"))) {
46252
47112
  console.log(source_default.dim(`Skipping ${s.name} (not a git checkout).`));
46253
47113
  continue;
46254
47114
  }
46255
47115
  const r = await new Promise((resolveP) => {
46256
- const child = spawn9("git", ["-C", dir, "pull", "--ff-only"], { stdio: ["ignore", "pipe", "pipe"] });
47116
+ const child = spawn11("git", ["-C", dir, "pull", "--ff-only"], { stdio: ["ignore", "pipe", "pipe"] });
46257
47117
  const chunks = [];
46258
47118
  child.stdout.on("data", (d) => chunks.push(d));
46259
47119
  child.stderr.on("data", (d) => chunks.push(d));
@@ -46453,7 +47313,7 @@ async function main(argv2) {
46453
47313
  var argv = process.argv.slice(2);
46454
47314
  var first = argv[0];
46455
47315
  if (first === "--version" || first === "-v" || first === "-V") {
46456
- const v = "0.2.5";
47316
+ const v = "0.2.7";
46457
47317
  process.stdout.write(v + "\n");
46458
47318
  process.exit(0);
46459
47319
  }