@kryvenaiofficial/kryven 0.2.6 → 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.
- package/dist/cli.mjs +1116 -635
- 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
|
|
1166
|
-
var
|
|
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 (
|
|
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 =
|
|
2166
|
-
if (
|
|
2167
|
-
if (sourceExt.includes(
|
|
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) =>
|
|
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 =
|
|
2181
|
+
resolvedScriptPath = fs7.realpathSync(this._scriptPath);
|
|
2182
2182
|
} catch {
|
|
2183
2183
|
resolvedScriptPath = this._scriptPath;
|
|
2184
2184
|
}
|
|
2185
|
-
executableDir =
|
|
2186
|
-
|
|
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 =
|
|
2193
|
+
const legacyName = path11.basename(
|
|
2194
2194
|
this._scriptPath,
|
|
2195
|
-
|
|
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(
|
|
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 =
|
|
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(
|
|
3068
|
-
if (
|
|
3069
|
-
this._executableDir =
|
|
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
|
|
3683
|
-
if (!existsSync(dirname(
|
|
3683
|
+
const path11 = logPath();
|
|
3684
|
+
if (!existsSync(dirname(path11))) {
|
|
3684
3685
|
try {
|
|
3685
|
-
mkdirSync(dirname(
|
|
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(
|
|
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(
|
|
3794
|
-
const url = `${this.baseUrl}${
|
|
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
|
|
4842
|
-
function checkPathExt(
|
|
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 &&
|
|
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,
|
|
4860
|
+
function checkStat(stat9, path11, options) {
|
|
4860
4861
|
if (!stat9.isSymbolicLink() && !stat9.isFile()) {
|
|
4861
4862
|
return false;
|
|
4862
4863
|
}
|
|
4863
|
-
return checkPathExt(
|
|
4864
|
+
return checkPathExt(path11, options);
|
|
4864
4865
|
}
|
|
4865
|
-
function isexe(
|
|
4866
|
-
|
|
4867
|
-
cb(er, er ? false : checkStat(stat9,
|
|
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(
|
|
4871
|
-
return checkStat(
|
|
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
|
|
4882
|
-
function isexe(
|
|
4883
|
-
|
|
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(
|
|
4888
|
-
return checkStat(
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
4951
|
+
function sync(path11, options) {
|
|
4951
4952
|
try {
|
|
4952
|
-
return core.sync(
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
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 ?
|
|
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 =
|
|
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 [
|
|
5163
|
-
const binary =
|
|
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
|
|
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 =
|
|
5184
|
-
|
|
5185
|
-
|
|
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
|
|
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 =
|
|
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(" ");
|
|
@@ -9350,13 +9351,13 @@ var init_output_sync = __esm({
|
|
|
9350
9351
|
}
|
|
9351
9352
|
};
|
|
9352
9353
|
writeToFiles = (serializedResult, stdioItems, outputFiles) => {
|
|
9353
|
-
for (const { path:
|
|
9354
|
-
const pathString = typeof
|
|
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(
|
|
9357
|
+
appendFileSync2(path11, serializedResult);
|
|
9357
9358
|
} else {
|
|
9358
9359
|
outputFiles.add(pathString);
|
|
9359
|
-
writeFileSync(
|
|
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:
|
|
12522
|
-
const fullPath = [...
|
|
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,
|
|
12831
|
+
constructor(parent, value, path11, key) {
|
|
12831
12832
|
this._cachedPath = [];
|
|
12832
12833
|
this.parent = parent;
|
|
12833
12834
|
this.data = value;
|
|
12834
|
-
this._path =
|
|
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
|
|
16266
|
-
if (!existsSync2(
|
|
16270
|
+
const path11 = getConfigPath();
|
|
16271
|
+
if (!existsSync2(path11)) return {};
|
|
16267
16272
|
try {
|
|
16268
|
-
const raw = JSON.parse(readFileSync3(
|
|
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",
|
|
16276
|
+
logger.warn("config: failed to parse", path11, String(err));
|
|
16272
16277
|
return {};
|
|
16273
16278
|
}
|
|
16274
16279
|
}
|
|
16275
16280
|
function saveUserConfig(cfg) {
|
|
16276
|
-
const
|
|
16277
|
-
const dir = dirname2(
|
|
16281
|
+
const path11 = getConfigPath();
|
|
16282
|
+
const dir = dirname2(path11);
|
|
16278
16283
|
if (!existsSync2(dir)) mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
16279
|
-
writeFileSync2(
|
|
16284
|
+
writeFileSync2(path11, JSON.stringify(cfg, null, 2));
|
|
16280
16285
|
try {
|
|
16281
|
-
chmodSync(
|
|
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
|
|
16288
|
-
if (!existsSync2(
|
|
16292
|
+
const path11 = getProjectConfigPath(cwd2);
|
|
16293
|
+
if (!existsSync2(path11)) return {};
|
|
16289
16294
|
try {
|
|
16290
|
-
const raw = JSON.parse(readFileSync3(
|
|
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",
|
|
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(
|
|
16350
|
-
if (!existsSync3(
|
|
16355
|
+
function readCapped(path11) {
|
|
16356
|
+
if (!existsSync3(path11)) return null;
|
|
16351
16357
|
try {
|
|
16352
|
-
const raw = readFileSync4(
|
|
16358
|
+
const raw = readFileSync4(path11, "utf8");
|
|
16353
16359
|
const truncated = raw.length > MAX_CHARS;
|
|
16354
|
-
return { path:
|
|
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(
|
|
28227
|
-
const p =
|
|
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:
|
|
28320
|
-
const abs = isAbsolute6(
|
|
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:
|
|
28391
|
-
const abs = isAbsolute7(
|
|
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:
|
|
28472
|
-
const abs = isAbsolute8(
|
|
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(
|
|
28963
|
+
async function fileExists(path11) {
|
|
28958
28964
|
try {
|
|
28959
|
-
await stat7(
|
|
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
|
|
29550
|
-
if (!existsSync13(
|
|
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(
|
|
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",
|
|
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",
|
|
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
|
|
29572
|
-
const dir = dirname11(
|
|
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(
|
|
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",
|
|
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
|
|
29718
|
-
if (!existsSync14(
|
|
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(
|
|
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(
|
|
29745
|
-
if (!existsSync15(
|
|
29813
|
+
function readEventHooks(path11, event) {
|
|
29814
|
+
if (!existsSync15(path11)) return [];
|
|
29746
29815
|
try {
|
|
29747
|
-
const parsed = JSON.parse(readFileSync11(
|
|
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 = [];
|
|
@@ -29954,7 +30023,10 @@ async function* runAgentLoopWithTools(client, conversation, opts) {
|
|
|
29954
30023
|
shell: true,
|
|
29955
30024
|
cwd: opts.reflect.cwd,
|
|
29956
30025
|
timeout: 18e4,
|
|
29957
|
-
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
|
|
29958
30030
|
});
|
|
29959
30031
|
ok = exitCode === 0;
|
|
29960
30032
|
detail = [stdout, stderr].filter(Boolean).join("\n").slice(0, 8e3);
|
|
@@ -30099,6 +30171,7 @@ ${detail}`,
|
|
|
30099
30171
|
}
|
|
30100
30172
|
}
|
|
30101
30173
|
yield { type: "max_iterations", n: MAX_ITER };
|
|
30174
|
+
yield { type: "end_turn", finishReason: "length", usage: sawUsage ? totalUsage : void 0 };
|
|
30102
30175
|
}
|
|
30103
30176
|
var init_loop = __esm({
|
|
30104
30177
|
"src/agent/loop.ts"() {
|
|
@@ -30232,54 +30305,54 @@ var require_polyfills = __commonJS({
|
|
|
30232
30305
|
}
|
|
30233
30306
|
var chdir;
|
|
30234
30307
|
module.exports = patch;
|
|
30235
|
-
function patch(
|
|
30308
|
+
function patch(fs7) {
|
|
30236
30309
|
if (constants5.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
30237
|
-
patchLchmod(
|
|
30238
|
-
}
|
|
30239
|
-
if (!
|
|
30240
|
-
patchLutimes(
|
|
30241
|
-
}
|
|
30242
|
-
|
|
30243
|
-
|
|
30244
|
-
|
|
30245
|
-
|
|
30246
|
-
|
|
30247
|
-
|
|
30248
|
-
|
|
30249
|
-
|
|
30250
|
-
|
|
30251
|
-
|
|
30252
|
-
|
|
30253
|
-
|
|
30254
|
-
|
|
30255
|
-
|
|
30256
|
-
|
|
30257
|
-
|
|
30258
|
-
|
|
30259
|
-
|
|
30260
|
-
if (
|
|
30261
|
-
|
|
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) {
|
|
30262
30335
|
if (cb) process.nextTick(cb);
|
|
30263
30336
|
};
|
|
30264
|
-
|
|
30337
|
+
fs7.lchmodSync = function() {
|
|
30265
30338
|
};
|
|
30266
30339
|
}
|
|
30267
|
-
if (
|
|
30268
|
-
|
|
30340
|
+
if (fs7.chown && !fs7.lchown) {
|
|
30341
|
+
fs7.lchown = function(path11, uid, gid, cb) {
|
|
30269
30342
|
if (cb) process.nextTick(cb);
|
|
30270
30343
|
};
|
|
30271
|
-
|
|
30344
|
+
fs7.lchownSync = function() {
|
|
30272
30345
|
};
|
|
30273
30346
|
}
|
|
30274
30347
|
if (platform3 === "win32") {
|
|
30275
|
-
|
|
30348
|
+
fs7.rename = typeof fs7.rename !== "function" ? fs7.rename : (function(fs$rename) {
|
|
30276
30349
|
function rename(from, to, cb) {
|
|
30277
30350
|
var start = Date.now();
|
|
30278
30351
|
var backoff = 0;
|
|
30279
30352
|
fs$rename(from, to, function CB(er) {
|
|
30280
30353
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
30281
30354
|
setTimeout(function() {
|
|
30282
|
-
|
|
30355
|
+
fs7.stat(to, function(stater, st) {
|
|
30283
30356
|
if (stater && stater.code === "ENOENT")
|
|
30284
30357
|
fs$rename(from, to, CB);
|
|
30285
30358
|
else
|
|
@@ -30295,9 +30368,9 @@ var require_polyfills = __commonJS({
|
|
|
30295
30368
|
}
|
|
30296
30369
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
30297
30370
|
return rename;
|
|
30298
|
-
})(
|
|
30371
|
+
})(fs7.rename);
|
|
30299
30372
|
}
|
|
30300
|
-
|
|
30373
|
+
fs7.read = typeof fs7.read !== "function" ? fs7.read : (function(fs$read) {
|
|
30301
30374
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
30302
30375
|
var callback;
|
|
30303
30376
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -30305,22 +30378,22 @@ var require_polyfills = __commonJS({
|
|
|
30305
30378
|
callback = function(er, _, __) {
|
|
30306
30379
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
30307
30380
|
eagCounter++;
|
|
30308
|
-
return fs$read.call(
|
|
30381
|
+
return fs$read.call(fs7, fd, buffer, offset, length, position, callback);
|
|
30309
30382
|
}
|
|
30310
30383
|
callback_.apply(this, arguments);
|
|
30311
30384
|
};
|
|
30312
30385
|
}
|
|
30313
|
-
return fs$read.call(
|
|
30386
|
+
return fs$read.call(fs7, fd, buffer, offset, length, position, callback);
|
|
30314
30387
|
}
|
|
30315
30388
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
30316
30389
|
return read;
|
|
30317
|
-
})(
|
|
30318
|
-
|
|
30390
|
+
})(fs7.read);
|
|
30391
|
+
fs7.readSync = typeof fs7.readSync !== "function" ? fs7.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
30319
30392
|
return function(fd, buffer, offset, length, position) {
|
|
30320
30393
|
var eagCounter = 0;
|
|
30321
30394
|
while (true) {
|
|
30322
30395
|
try {
|
|
30323
|
-
return fs$readSync.call(
|
|
30396
|
+
return fs$readSync.call(fs7, fd, buffer, offset, length, position);
|
|
30324
30397
|
} catch (er) {
|
|
30325
30398
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
30326
30399
|
eagCounter++;
|
|
@@ -30330,11 +30403,11 @@ var require_polyfills = __commonJS({
|
|
|
30330
30403
|
}
|
|
30331
30404
|
}
|
|
30332
30405
|
};
|
|
30333
|
-
})(
|
|
30334
|
-
function patchLchmod(
|
|
30335
|
-
|
|
30336
|
-
|
|
30337
|
-
|
|
30406
|
+
})(fs7.readSync);
|
|
30407
|
+
function patchLchmod(fs8) {
|
|
30408
|
+
fs8.lchmod = function(path11, mode, callback) {
|
|
30409
|
+
fs8.open(
|
|
30410
|
+
path11,
|
|
30338
30411
|
constants5.O_WRONLY | constants5.O_SYMLINK,
|
|
30339
30412
|
mode,
|
|
30340
30413
|
function(err, fd) {
|
|
@@ -30342,80 +30415,80 @@ var require_polyfills = __commonJS({
|
|
|
30342
30415
|
if (callback) callback(err);
|
|
30343
30416
|
return;
|
|
30344
30417
|
}
|
|
30345
|
-
|
|
30346
|
-
|
|
30418
|
+
fs8.fchmod(fd, mode, function(err2) {
|
|
30419
|
+
fs8.close(fd, function(err22) {
|
|
30347
30420
|
if (callback) callback(err2 || err22);
|
|
30348
30421
|
});
|
|
30349
30422
|
});
|
|
30350
30423
|
}
|
|
30351
30424
|
);
|
|
30352
30425
|
};
|
|
30353
|
-
|
|
30354
|
-
var fd =
|
|
30426
|
+
fs8.lchmodSync = function(path11, mode) {
|
|
30427
|
+
var fd = fs8.openSync(path11, constants5.O_WRONLY | constants5.O_SYMLINK, mode);
|
|
30355
30428
|
var threw = true;
|
|
30356
30429
|
var ret;
|
|
30357
30430
|
try {
|
|
30358
|
-
ret =
|
|
30431
|
+
ret = fs8.fchmodSync(fd, mode);
|
|
30359
30432
|
threw = false;
|
|
30360
30433
|
} finally {
|
|
30361
30434
|
if (threw) {
|
|
30362
30435
|
try {
|
|
30363
|
-
|
|
30436
|
+
fs8.closeSync(fd);
|
|
30364
30437
|
} catch (er) {
|
|
30365
30438
|
}
|
|
30366
30439
|
} else {
|
|
30367
|
-
|
|
30440
|
+
fs8.closeSync(fd);
|
|
30368
30441
|
}
|
|
30369
30442
|
}
|
|
30370
30443
|
return ret;
|
|
30371
30444
|
};
|
|
30372
30445
|
}
|
|
30373
|
-
function patchLutimes(
|
|
30374
|
-
if (constants5.hasOwnProperty("O_SYMLINK") &&
|
|
30375
|
-
|
|
30376
|
-
|
|
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) {
|
|
30377
30450
|
if (er) {
|
|
30378
30451
|
if (cb) cb(er);
|
|
30379
30452
|
return;
|
|
30380
30453
|
}
|
|
30381
|
-
|
|
30382
|
-
|
|
30454
|
+
fs8.futimes(fd, at, mt, function(er2) {
|
|
30455
|
+
fs8.close(fd, function(er22) {
|
|
30383
30456
|
if (cb) cb(er2 || er22);
|
|
30384
30457
|
});
|
|
30385
30458
|
});
|
|
30386
30459
|
});
|
|
30387
30460
|
};
|
|
30388
|
-
|
|
30389
|
-
var fd =
|
|
30461
|
+
fs8.lutimesSync = function(path11, at, mt) {
|
|
30462
|
+
var fd = fs8.openSync(path11, constants5.O_SYMLINK);
|
|
30390
30463
|
var ret;
|
|
30391
30464
|
var threw = true;
|
|
30392
30465
|
try {
|
|
30393
|
-
ret =
|
|
30466
|
+
ret = fs8.futimesSync(fd, at, mt);
|
|
30394
30467
|
threw = false;
|
|
30395
30468
|
} finally {
|
|
30396
30469
|
if (threw) {
|
|
30397
30470
|
try {
|
|
30398
|
-
|
|
30471
|
+
fs8.closeSync(fd);
|
|
30399
30472
|
} catch (er) {
|
|
30400
30473
|
}
|
|
30401
30474
|
} else {
|
|
30402
|
-
|
|
30475
|
+
fs8.closeSync(fd);
|
|
30403
30476
|
}
|
|
30404
30477
|
}
|
|
30405
30478
|
return ret;
|
|
30406
30479
|
};
|
|
30407
|
-
} else if (
|
|
30408
|
-
|
|
30480
|
+
} else if (fs8.futimes) {
|
|
30481
|
+
fs8.lutimes = function(_a, _b, _c, cb) {
|
|
30409
30482
|
if (cb) process.nextTick(cb);
|
|
30410
30483
|
};
|
|
30411
|
-
|
|
30484
|
+
fs8.lutimesSync = function() {
|
|
30412
30485
|
};
|
|
30413
30486
|
}
|
|
30414
30487
|
}
|
|
30415
30488
|
function chmodFix(orig) {
|
|
30416
30489
|
if (!orig) return orig;
|
|
30417
30490
|
return function(target, mode, cb) {
|
|
30418
|
-
return orig.call(
|
|
30491
|
+
return orig.call(fs7, target, mode, function(er) {
|
|
30419
30492
|
if (chownErOk(er)) er = null;
|
|
30420
30493
|
if (cb) cb.apply(this, arguments);
|
|
30421
30494
|
});
|
|
@@ -30425,7 +30498,7 @@ var require_polyfills = __commonJS({
|
|
|
30425
30498
|
if (!orig) return orig;
|
|
30426
30499
|
return function(target, mode) {
|
|
30427
30500
|
try {
|
|
30428
|
-
return orig.call(
|
|
30501
|
+
return orig.call(fs7, target, mode);
|
|
30429
30502
|
} catch (er) {
|
|
30430
30503
|
if (!chownErOk(er)) throw er;
|
|
30431
30504
|
}
|
|
@@ -30434,7 +30507,7 @@ var require_polyfills = __commonJS({
|
|
|
30434
30507
|
function chownFix(orig) {
|
|
30435
30508
|
if (!orig) return orig;
|
|
30436
30509
|
return function(target, uid, gid, cb) {
|
|
30437
|
-
return orig.call(
|
|
30510
|
+
return orig.call(fs7, target, uid, gid, function(er) {
|
|
30438
30511
|
if (chownErOk(er)) er = null;
|
|
30439
30512
|
if (cb) cb.apply(this, arguments);
|
|
30440
30513
|
});
|
|
@@ -30444,7 +30517,7 @@ var require_polyfills = __commonJS({
|
|
|
30444
30517
|
if (!orig) return orig;
|
|
30445
30518
|
return function(target, uid, gid) {
|
|
30446
30519
|
try {
|
|
30447
|
-
return orig.call(
|
|
30520
|
+
return orig.call(fs7, target, uid, gid);
|
|
30448
30521
|
} catch (er) {
|
|
30449
30522
|
if (!chownErOk(er)) throw er;
|
|
30450
30523
|
}
|
|
@@ -30464,13 +30537,13 @@ var require_polyfills = __commonJS({
|
|
|
30464
30537
|
}
|
|
30465
30538
|
if (cb) cb.apply(this, arguments);
|
|
30466
30539
|
}
|
|
30467
|
-
return options ? orig.call(
|
|
30540
|
+
return options ? orig.call(fs7, target, options, callback) : orig.call(fs7, target, callback);
|
|
30468
30541
|
};
|
|
30469
30542
|
}
|
|
30470
30543
|
function statFixSync(orig) {
|
|
30471
30544
|
if (!orig) return orig;
|
|
30472
30545
|
return function(target, options) {
|
|
30473
|
-
var stats = options ? orig.call(
|
|
30546
|
+
var stats = options ? orig.call(fs7, target, options) : orig.call(fs7, target);
|
|
30474
30547
|
if (stats) {
|
|
30475
30548
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
30476
30549
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -30499,16 +30572,16 @@ var require_legacy_streams = __commonJS({
|
|
|
30499
30572
|
"node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
30500
30573
|
var Stream2 = __require("stream").Stream;
|
|
30501
30574
|
module.exports = legacy;
|
|
30502
|
-
function legacy(
|
|
30575
|
+
function legacy(fs7) {
|
|
30503
30576
|
return {
|
|
30504
30577
|
ReadStream,
|
|
30505
30578
|
WriteStream
|
|
30506
30579
|
};
|
|
30507
|
-
function ReadStream(
|
|
30508
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
30580
|
+
function ReadStream(path11, options) {
|
|
30581
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path11, options);
|
|
30509
30582
|
Stream2.call(this);
|
|
30510
30583
|
var self = this;
|
|
30511
|
-
this.path =
|
|
30584
|
+
this.path = path11;
|
|
30512
30585
|
this.fd = null;
|
|
30513
30586
|
this.readable = true;
|
|
30514
30587
|
this.paused = false;
|
|
@@ -30542,7 +30615,7 @@ var require_legacy_streams = __commonJS({
|
|
|
30542
30615
|
});
|
|
30543
30616
|
return;
|
|
30544
30617
|
}
|
|
30545
|
-
|
|
30618
|
+
fs7.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
30546
30619
|
if (err) {
|
|
30547
30620
|
self.emit("error", err);
|
|
30548
30621
|
self.readable = false;
|
|
@@ -30553,10 +30626,10 @@ var require_legacy_streams = __commonJS({
|
|
|
30553
30626
|
self._read();
|
|
30554
30627
|
});
|
|
30555
30628
|
}
|
|
30556
|
-
function WriteStream(
|
|
30557
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
30629
|
+
function WriteStream(path11, options) {
|
|
30630
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path11, options);
|
|
30558
30631
|
Stream2.call(this);
|
|
30559
|
-
this.path =
|
|
30632
|
+
this.path = path11;
|
|
30560
30633
|
this.fd = null;
|
|
30561
30634
|
this.writable = true;
|
|
30562
30635
|
this.flags = "w";
|
|
@@ -30581,7 +30654,7 @@ var require_legacy_streams = __commonJS({
|
|
|
30581
30654
|
this.busy = false;
|
|
30582
30655
|
this._queue = [];
|
|
30583
30656
|
if (this.fd === null) {
|
|
30584
|
-
this._open =
|
|
30657
|
+
this._open = fs7.open;
|
|
30585
30658
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
30586
30659
|
this.flush();
|
|
30587
30660
|
}
|
|
@@ -30616,7 +30689,7 @@ var require_clone = __commonJS({
|
|
|
30616
30689
|
// node_modules/graceful-fs/graceful-fs.js
|
|
30617
30690
|
var require_graceful_fs = __commonJS({
|
|
30618
30691
|
"node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
30619
|
-
var
|
|
30692
|
+
var fs7 = __require("fs");
|
|
30620
30693
|
var polyfills = require_polyfills();
|
|
30621
30694
|
var legacy = require_legacy_streams();
|
|
30622
30695
|
var clone = require_clone();
|
|
@@ -30648,12 +30721,12 @@ var require_graceful_fs = __commonJS({
|
|
|
30648
30721
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
30649
30722
|
console.error(m);
|
|
30650
30723
|
};
|
|
30651
|
-
if (!
|
|
30724
|
+
if (!fs7[gracefulQueue]) {
|
|
30652
30725
|
queue = global[gracefulQueue] || [];
|
|
30653
|
-
publishQueue(
|
|
30654
|
-
|
|
30726
|
+
publishQueue(fs7, queue);
|
|
30727
|
+
fs7.close = (function(fs$close) {
|
|
30655
30728
|
function close(fd, cb) {
|
|
30656
|
-
return fs$close.call(
|
|
30729
|
+
return fs$close.call(fs7, fd, function(err) {
|
|
30657
30730
|
if (!err) {
|
|
30658
30731
|
resetQueue();
|
|
30659
30732
|
}
|
|
@@ -30665,48 +30738,48 @@ var require_graceful_fs = __commonJS({
|
|
|
30665
30738
|
value: fs$close
|
|
30666
30739
|
});
|
|
30667
30740
|
return close;
|
|
30668
|
-
})(
|
|
30669
|
-
|
|
30741
|
+
})(fs7.close);
|
|
30742
|
+
fs7.closeSync = (function(fs$closeSync) {
|
|
30670
30743
|
function closeSync3(fd) {
|
|
30671
|
-
fs$closeSync.apply(
|
|
30744
|
+
fs$closeSync.apply(fs7, arguments);
|
|
30672
30745
|
resetQueue();
|
|
30673
30746
|
}
|
|
30674
30747
|
Object.defineProperty(closeSync3, previousSymbol, {
|
|
30675
30748
|
value: fs$closeSync
|
|
30676
30749
|
});
|
|
30677
30750
|
return closeSync3;
|
|
30678
|
-
})(
|
|
30751
|
+
})(fs7.closeSync);
|
|
30679
30752
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
30680
30753
|
process.on("exit", function() {
|
|
30681
|
-
debug(
|
|
30682
|
-
__require("assert").equal(
|
|
30754
|
+
debug(fs7[gracefulQueue]);
|
|
30755
|
+
__require("assert").equal(fs7[gracefulQueue].length, 0);
|
|
30683
30756
|
});
|
|
30684
30757
|
}
|
|
30685
30758
|
}
|
|
30686
30759
|
var queue;
|
|
30687
30760
|
if (!global[gracefulQueue]) {
|
|
30688
|
-
publishQueue(global,
|
|
30689
|
-
}
|
|
30690
|
-
module.exports = patch(clone(
|
|
30691
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
30692
|
-
module.exports = patch(
|
|
30693
|
-
|
|
30694
|
-
}
|
|
30695
|
-
function patch(
|
|
30696
|
-
polyfills(
|
|
30697
|
-
|
|
30698
|
-
|
|
30699
|
-
|
|
30700
|
-
var fs$readFile =
|
|
30701
|
-
|
|
30702
|
-
function readFile18(
|
|
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) {
|
|
30703
30776
|
if (typeof options === "function")
|
|
30704
30777
|
cb = options, options = null;
|
|
30705
|
-
return go$readFile(
|
|
30706
|
-
function go$readFile(
|
|
30707
|
-
return fs$readFile(
|
|
30778
|
+
return go$readFile(path11, options, cb);
|
|
30779
|
+
function go$readFile(path12, options2, cb2, startTime) {
|
|
30780
|
+
return fs$readFile(path12, options2, function(err) {
|
|
30708
30781
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
30709
|
-
enqueue([go$readFile, [
|
|
30782
|
+
enqueue([go$readFile, [path12, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
30710
30783
|
else {
|
|
30711
30784
|
if (typeof cb2 === "function")
|
|
30712
30785
|
cb2.apply(this, arguments);
|
|
@@ -30714,16 +30787,16 @@ var require_graceful_fs = __commonJS({
|
|
|
30714
30787
|
});
|
|
30715
30788
|
}
|
|
30716
30789
|
}
|
|
30717
|
-
var fs$writeFile =
|
|
30718
|
-
|
|
30719
|
-
function writeFile12(
|
|
30790
|
+
var fs$writeFile = fs8.writeFile;
|
|
30791
|
+
fs8.writeFile = writeFile12;
|
|
30792
|
+
function writeFile12(path11, data, options, cb) {
|
|
30720
30793
|
if (typeof options === "function")
|
|
30721
30794
|
cb = options, options = null;
|
|
30722
|
-
return go$writeFile(
|
|
30723
|
-
function go$writeFile(
|
|
30724
|
-
return fs$writeFile(
|
|
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) {
|
|
30725
30798
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
30726
|
-
enqueue([go$writeFile, [
|
|
30799
|
+
enqueue([go$writeFile, [path12, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
30727
30800
|
else {
|
|
30728
30801
|
if (typeof cb2 === "function")
|
|
30729
30802
|
cb2.apply(this, arguments);
|
|
@@ -30731,17 +30804,17 @@ var require_graceful_fs = __commonJS({
|
|
|
30731
30804
|
});
|
|
30732
30805
|
}
|
|
30733
30806
|
}
|
|
30734
|
-
var fs$appendFile =
|
|
30807
|
+
var fs$appendFile = fs8.appendFile;
|
|
30735
30808
|
if (fs$appendFile)
|
|
30736
|
-
|
|
30737
|
-
function appendFile4(
|
|
30809
|
+
fs8.appendFile = appendFile4;
|
|
30810
|
+
function appendFile4(path11, data, options, cb) {
|
|
30738
30811
|
if (typeof options === "function")
|
|
30739
30812
|
cb = options, options = null;
|
|
30740
|
-
return go$appendFile(
|
|
30741
|
-
function go$appendFile(
|
|
30742
|
-
return fs$appendFile(
|
|
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) {
|
|
30743
30816
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
30744
|
-
enqueue([go$appendFile, [
|
|
30817
|
+
enqueue([go$appendFile, [path12, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
30745
30818
|
else {
|
|
30746
30819
|
if (typeof cb2 === "function")
|
|
30747
30820
|
cb2.apply(this, arguments);
|
|
@@ -30749,9 +30822,9 @@ var require_graceful_fs = __commonJS({
|
|
|
30749
30822
|
});
|
|
30750
30823
|
}
|
|
30751
30824
|
}
|
|
30752
|
-
var fs$copyFile =
|
|
30825
|
+
var fs$copyFile = fs8.copyFile;
|
|
30753
30826
|
if (fs$copyFile)
|
|
30754
|
-
|
|
30827
|
+
fs8.copyFile = copyFile;
|
|
30755
30828
|
function copyFile(src, dest, flags, cb) {
|
|
30756
30829
|
if (typeof flags === "function") {
|
|
30757
30830
|
cb = flags;
|
|
@@ -30769,34 +30842,34 @@ var require_graceful_fs = __commonJS({
|
|
|
30769
30842
|
});
|
|
30770
30843
|
}
|
|
30771
30844
|
}
|
|
30772
|
-
var fs$readdir =
|
|
30773
|
-
|
|
30845
|
+
var fs$readdir = fs8.readdir;
|
|
30846
|
+
fs8.readdir = readdir11;
|
|
30774
30847
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
30775
|
-
function readdir11(
|
|
30848
|
+
function readdir11(path11, options, cb) {
|
|
30776
30849
|
if (typeof options === "function")
|
|
30777
30850
|
cb = options, options = null;
|
|
30778
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
30779
|
-
return fs$readdir(
|
|
30780
|
-
|
|
30851
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path12, options2, cb2, startTime) {
|
|
30852
|
+
return fs$readdir(path12, fs$readdirCallback(
|
|
30853
|
+
path12,
|
|
30781
30854
|
options2,
|
|
30782
30855
|
cb2,
|
|
30783
30856
|
startTime
|
|
30784
30857
|
));
|
|
30785
|
-
} : function go$readdir2(
|
|
30786
|
-
return fs$readdir(
|
|
30787
|
-
|
|
30858
|
+
} : function go$readdir2(path12, options2, cb2, startTime) {
|
|
30859
|
+
return fs$readdir(path12, options2, fs$readdirCallback(
|
|
30860
|
+
path12,
|
|
30788
30861
|
options2,
|
|
30789
30862
|
cb2,
|
|
30790
30863
|
startTime
|
|
30791
30864
|
));
|
|
30792
30865
|
};
|
|
30793
|
-
return go$readdir(
|
|
30794
|
-
function fs$readdirCallback(
|
|
30866
|
+
return go$readdir(path11, options, cb);
|
|
30867
|
+
function fs$readdirCallback(path12, options2, cb2, startTime) {
|
|
30795
30868
|
return function(err, files) {
|
|
30796
30869
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
30797
30870
|
enqueue([
|
|
30798
30871
|
go$readdir,
|
|
30799
|
-
[
|
|
30872
|
+
[path12, options2, cb2],
|
|
30800
30873
|
err,
|
|
30801
30874
|
startTime || Date.now(),
|
|
30802
30875
|
Date.now()
|
|
@@ -30811,21 +30884,21 @@ var require_graceful_fs = __commonJS({
|
|
|
30811
30884
|
}
|
|
30812
30885
|
}
|
|
30813
30886
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
30814
|
-
var legStreams = legacy(
|
|
30887
|
+
var legStreams = legacy(fs8);
|
|
30815
30888
|
ReadStream = legStreams.ReadStream;
|
|
30816
30889
|
WriteStream = legStreams.WriteStream;
|
|
30817
30890
|
}
|
|
30818
|
-
var fs$ReadStream =
|
|
30891
|
+
var fs$ReadStream = fs8.ReadStream;
|
|
30819
30892
|
if (fs$ReadStream) {
|
|
30820
30893
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
30821
30894
|
ReadStream.prototype.open = ReadStream$open;
|
|
30822
30895
|
}
|
|
30823
|
-
var fs$WriteStream =
|
|
30896
|
+
var fs$WriteStream = fs8.WriteStream;
|
|
30824
30897
|
if (fs$WriteStream) {
|
|
30825
30898
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
30826
30899
|
WriteStream.prototype.open = WriteStream$open;
|
|
30827
30900
|
}
|
|
30828
|
-
Object.defineProperty(
|
|
30901
|
+
Object.defineProperty(fs8, "ReadStream", {
|
|
30829
30902
|
get: function() {
|
|
30830
30903
|
return ReadStream;
|
|
30831
30904
|
},
|
|
@@ -30835,7 +30908,7 @@ var require_graceful_fs = __commonJS({
|
|
|
30835
30908
|
enumerable: true,
|
|
30836
30909
|
configurable: true
|
|
30837
30910
|
});
|
|
30838
|
-
Object.defineProperty(
|
|
30911
|
+
Object.defineProperty(fs8, "WriteStream", {
|
|
30839
30912
|
get: function() {
|
|
30840
30913
|
return WriteStream;
|
|
30841
30914
|
},
|
|
@@ -30846,7 +30919,7 @@ var require_graceful_fs = __commonJS({
|
|
|
30846
30919
|
configurable: true
|
|
30847
30920
|
});
|
|
30848
30921
|
var FileReadStream = ReadStream;
|
|
30849
|
-
Object.defineProperty(
|
|
30922
|
+
Object.defineProperty(fs8, "FileReadStream", {
|
|
30850
30923
|
get: function() {
|
|
30851
30924
|
return FileReadStream;
|
|
30852
30925
|
},
|
|
@@ -30857,7 +30930,7 @@ var require_graceful_fs = __commonJS({
|
|
|
30857
30930
|
configurable: true
|
|
30858
30931
|
});
|
|
30859
30932
|
var FileWriteStream = WriteStream;
|
|
30860
|
-
Object.defineProperty(
|
|
30933
|
+
Object.defineProperty(fs8, "FileWriteStream", {
|
|
30861
30934
|
get: function() {
|
|
30862
30935
|
return FileWriteStream;
|
|
30863
30936
|
},
|
|
@@ -30867,7 +30940,7 @@ var require_graceful_fs = __commonJS({
|
|
|
30867
30940
|
enumerable: true,
|
|
30868
30941
|
configurable: true
|
|
30869
30942
|
});
|
|
30870
|
-
function ReadStream(
|
|
30943
|
+
function ReadStream(path11, options) {
|
|
30871
30944
|
if (this instanceof ReadStream)
|
|
30872
30945
|
return fs$ReadStream.apply(this, arguments), this;
|
|
30873
30946
|
else
|
|
@@ -30887,7 +30960,7 @@ var require_graceful_fs = __commonJS({
|
|
|
30887
30960
|
}
|
|
30888
30961
|
});
|
|
30889
30962
|
}
|
|
30890
|
-
function WriteStream(
|
|
30963
|
+
function WriteStream(path11, options) {
|
|
30891
30964
|
if (this instanceof WriteStream)
|
|
30892
30965
|
return fs$WriteStream.apply(this, arguments), this;
|
|
30893
30966
|
else
|
|
@@ -30905,22 +30978,22 @@ var require_graceful_fs = __commonJS({
|
|
|
30905
30978
|
}
|
|
30906
30979
|
});
|
|
30907
30980
|
}
|
|
30908
|
-
function createReadStream2(
|
|
30909
|
-
return new
|
|
30981
|
+
function createReadStream2(path11, options) {
|
|
30982
|
+
return new fs8.ReadStream(path11, options);
|
|
30910
30983
|
}
|
|
30911
|
-
function createWriteStream2(
|
|
30912
|
-
return new
|
|
30984
|
+
function createWriteStream2(path11, options) {
|
|
30985
|
+
return new fs8.WriteStream(path11, options);
|
|
30913
30986
|
}
|
|
30914
|
-
var fs$open =
|
|
30915
|
-
|
|
30916
|
-
function open(
|
|
30987
|
+
var fs$open = fs8.open;
|
|
30988
|
+
fs8.open = open;
|
|
30989
|
+
function open(path11, flags, mode, cb) {
|
|
30917
30990
|
if (typeof mode === "function")
|
|
30918
30991
|
cb = mode, mode = null;
|
|
30919
|
-
return go$open(
|
|
30920
|
-
function go$open(
|
|
30921
|
-
return fs$open(
|
|
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) {
|
|
30922
30995
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
30923
|
-
enqueue([go$open, [
|
|
30996
|
+
enqueue([go$open, [path12, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
30924
30997
|
else {
|
|
30925
30998
|
if (typeof cb2 === "function")
|
|
30926
30999
|
cb2.apply(this, arguments);
|
|
@@ -30928,20 +31001,20 @@ var require_graceful_fs = __commonJS({
|
|
|
30928
31001
|
});
|
|
30929
31002
|
}
|
|
30930
31003
|
}
|
|
30931
|
-
return
|
|
31004
|
+
return fs8;
|
|
30932
31005
|
}
|
|
30933
31006
|
function enqueue(elem) {
|
|
30934
31007
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
30935
|
-
|
|
31008
|
+
fs7[gracefulQueue].push(elem);
|
|
30936
31009
|
retry2();
|
|
30937
31010
|
}
|
|
30938
31011
|
var retryTimer;
|
|
30939
31012
|
function resetQueue() {
|
|
30940
31013
|
var now = Date.now();
|
|
30941
|
-
for (var i2 = 0; i2 <
|
|
30942
|
-
if (
|
|
30943
|
-
|
|
30944
|
-
|
|
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;
|
|
30945
31018
|
}
|
|
30946
31019
|
}
|
|
30947
31020
|
retry2();
|
|
@@ -30949,9 +31022,9 @@ var require_graceful_fs = __commonJS({
|
|
|
30949
31022
|
function retry2() {
|
|
30950
31023
|
clearTimeout(retryTimer);
|
|
30951
31024
|
retryTimer = void 0;
|
|
30952
|
-
if (
|
|
31025
|
+
if (fs7[gracefulQueue].length === 0)
|
|
30953
31026
|
return;
|
|
30954
|
-
var elem =
|
|
31027
|
+
var elem = fs7[gracefulQueue].shift();
|
|
30955
31028
|
var fn = elem[0];
|
|
30956
31029
|
var args = elem[1];
|
|
30957
31030
|
var err = elem[2];
|
|
@@ -30973,7 +31046,7 @@ var require_graceful_fs = __commonJS({
|
|
|
30973
31046
|
debug("RETRY", fn.name, args);
|
|
30974
31047
|
fn.apply(null, args.concat([startTime]));
|
|
30975
31048
|
} else {
|
|
30976
|
-
|
|
31049
|
+
fs7[gracefulQueue].push(elem);
|
|
30977
31050
|
}
|
|
30978
31051
|
}
|
|
30979
31052
|
if (retryTimer === void 0) {
|
|
@@ -31408,10 +31481,10 @@ var require_mtime_precision = __commonJS({
|
|
|
31408
31481
|
"node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
|
|
31409
31482
|
"use strict";
|
|
31410
31483
|
var cacheSymbol = Symbol();
|
|
31411
|
-
function probe(file,
|
|
31412
|
-
const cachedPrecision =
|
|
31484
|
+
function probe(file, fs7, callback) {
|
|
31485
|
+
const cachedPrecision = fs7[cacheSymbol];
|
|
31413
31486
|
if (cachedPrecision) {
|
|
31414
|
-
return
|
|
31487
|
+
return fs7.stat(file, (err, stat9) => {
|
|
31415
31488
|
if (err) {
|
|
31416
31489
|
return callback(err);
|
|
31417
31490
|
}
|
|
@@ -31419,16 +31492,16 @@ var require_mtime_precision = __commonJS({
|
|
|
31419
31492
|
});
|
|
31420
31493
|
}
|
|
31421
31494
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
31422
|
-
|
|
31495
|
+
fs7.utimes(file, mtime, mtime, (err) => {
|
|
31423
31496
|
if (err) {
|
|
31424
31497
|
return callback(err);
|
|
31425
31498
|
}
|
|
31426
|
-
|
|
31499
|
+
fs7.stat(file, (err2, stat9) => {
|
|
31427
31500
|
if (err2) {
|
|
31428
31501
|
return callback(err2);
|
|
31429
31502
|
}
|
|
31430
31503
|
const precision = stat9.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
31431
|
-
Object.defineProperty(
|
|
31504
|
+
Object.defineProperty(fs7, cacheSymbol, { value: precision });
|
|
31432
31505
|
callback(null, stat9.mtime, precision);
|
|
31433
31506
|
});
|
|
31434
31507
|
});
|
|
@@ -31449,8 +31522,8 @@ var require_mtime_precision = __commonJS({
|
|
|
31449
31522
|
var require_lockfile = __commonJS({
|
|
31450
31523
|
"node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
31451
31524
|
"use strict";
|
|
31452
|
-
var
|
|
31453
|
-
var
|
|
31525
|
+
var path11 = __require("path");
|
|
31526
|
+
var fs7 = require_graceful_fs();
|
|
31454
31527
|
var retry2 = require_retry2();
|
|
31455
31528
|
var onExit2 = require_signal_exit3();
|
|
31456
31529
|
var mtimePrecision = require_mtime_precision();
|
|
@@ -31460,7 +31533,7 @@ var require_lockfile = __commonJS({
|
|
|
31460
31533
|
}
|
|
31461
31534
|
function resolveCanonicalPath(file, options, callback) {
|
|
31462
31535
|
if (!options.realpath) {
|
|
31463
|
-
return callback(null,
|
|
31536
|
+
return callback(null, path11.resolve(file));
|
|
31464
31537
|
}
|
|
31465
31538
|
options.fs.realpath(file, callback);
|
|
31466
31539
|
}
|
|
@@ -31581,7 +31654,7 @@ var require_lockfile = __commonJS({
|
|
|
31581
31654
|
update: null,
|
|
31582
31655
|
realpath: true,
|
|
31583
31656
|
retries: 0,
|
|
31584
|
-
fs:
|
|
31657
|
+
fs: fs7,
|
|
31585
31658
|
onCompromised: (err) => {
|
|
31586
31659
|
throw err;
|
|
31587
31660
|
},
|
|
@@ -31625,7 +31698,7 @@ var require_lockfile = __commonJS({
|
|
|
31625
31698
|
}
|
|
31626
31699
|
function unlock(file, options, callback) {
|
|
31627
31700
|
options = {
|
|
31628
|
-
fs:
|
|
31701
|
+
fs: fs7,
|
|
31629
31702
|
realpath: true,
|
|
31630
31703
|
...options
|
|
31631
31704
|
};
|
|
@@ -31647,7 +31720,7 @@ var require_lockfile = __commonJS({
|
|
|
31647
31720
|
options = {
|
|
31648
31721
|
stale: 1e4,
|
|
31649
31722
|
realpath: true,
|
|
31650
|
-
fs:
|
|
31723
|
+
fs: fs7,
|
|
31651
31724
|
...options
|
|
31652
31725
|
};
|
|
31653
31726
|
options.stale = Math.max(options.stale || 0, 2e3);
|
|
@@ -31686,16 +31759,16 @@ var require_lockfile = __commonJS({
|
|
|
31686
31759
|
var require_adapter = __commonJS({
|
|
31687
31760
|
"node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
|
|
31688
31761
|
"use strict";
|
|
31689
|
-
var
|
|
31690
|
-
function createSyncFs(
|
|
31762
|
+
var fs7 = require_graceful_fs();
|
|
31763
|
+
function createSyncFs(fs8) {
|
|
31691
31764
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
31692
|
-
const newFs = { ...
|
|
31765
|
+
const newFs = { ...fs8 };
|
|
31693
31766
|
methods.forEach((method) => {
|
|
31694
31767
|
newFs[method] = (...args) => {
|
|
31695
31768
|
const callback = args.pop();
|
|
31696
31769
|
let ret;
|
|
31697
31770
|
try {
|
|
31698
|
-
ret =
|
|
31771
|
+
ret = fs8[`${method}Sync`](...args);
|
|
31699
31772
|
} catch (err) {
|
|
31700
31773
|
return callback(err);
|
|
31701
31774
|
}
|
|
@@ -31733,7 +31806,7 @@ var require_adapter = __commonJS({
|
|
|
31733
31806
|
}
|
|
31734
31807
|
function toSyncOptions(options) {
|
|
31735
31808
|
options = { ...options };
|
|
31736
|
-
options.fs = createSyncFs(options.fs ||
|
|
31809
|
+
options.fs = createSyncFs(options.fs || fs7);
|
|
31737
31810
|
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
31738
31811
|
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
31739
31812
|
}
|
|
@@ -36740,8 +36813,8 @@ function Text({ color, backgroundColor, dimColor = false, bold: bold2 = false, i
|
|
|
36740
36813
|
}
|
|
36741
36814
|
|
|
36742
36815
|
// node_modules/ink/build/components/ErrorOverview.js
|
|
36743
|
-
var cleanupPath = (
|
|
36744
|
-
return
|
|
36816
|
+
var cleanupPath = (path11) => {
|
|
36817
|
+
return path11?.replace(`file://${cwd()}/`, "");
|
|
36745
36818
|
};
|
|
36746
36819
|
var stackUtils = new import_stack_utils.default({
|
|
36747
36820
|
cwd: cwd(),
|
|
@@ -37962,13 +38035,11 @@ var PromptInput = ({
|
|
|
37962
38035
|
vimMode,
|
|
37963
38036
|
vimCmdline,
|
|
37964
38037
|
accentColor,
|
|
37965
|
-
|
|
37966
|
-
mood,
|
|
38038
|
+
summary,
|
|
37967
38039
|
themeColors
|
|
37968
38040
|
}) => {
|
|
37969
38041
|
const fg = themeColors?.fg ?? "#F5EFE6";
|
|
37970
38042
|
const muted = themeColors?.muted ?? "#736560";
|
|
37971
|
-
const info = themeColors?.info ?? "#7EA8C4";
|
|
37972
38043
|
const accent = accentColor ?? "#8B5CF6";
|
|
37973
38044
|
const isStatic = disabled || vimMode === "NORMAL";
|
|
37974
38045
|
const barColor = disabled ? muted : vimMode === "NORMAL" ? "#F59E0B" : accent;
|
|
@@ -37987,11 +38058,9 @@ var PromptInput = ({
|
|
|
37987
38058
|
borderLeftColor: barColor,
|
|
37988
38059
|
children: [
|
|
37989
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 }) }),
|
|
37990
|
-
(
|
|
37991
|
-
|
|
37992
|
-
|
|
37993
|
-
model ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: fg, children: model }) : null,
|
|
37994
|
-
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
|
|
37995
38064
|
] })
|
|
37996
38065
|
]
|
|
37997
38066
|
}
|
|
@@ -38290,79 +38359,6 @@ var CompletionMenu = ({ items, selected }) => /* @__PURE__ */ (0, import_jsx_run
|
|
|
38290
38359
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "gray", dimColor: true, children: "Tab to complete" })
|
|
38291
38360
|
] });
|
|
38292
38361
|
|
|
38293
|
-
// src/tui/ModelPicker.tsx
|
|
38294
|
-
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
38295
|
-
var VISIBLE = 10;
|
|
38296
|
-
var ModelPicker = ({ models, selected, current: current2 }) => {
|
|
38297
|
-
const total = models.length;
|
|
38298
|
-
const start = Math.max(
|
|
38299
|
-
0,
|
|
38300
|
-
Math.min(selected - Math.floor(VISIBLE / 2), Math.max(0, total - VISIBLE))
|
|
38301
|
-
);
|
|
38302
|
-
const end = Math.min(total, start + VISIBLE);
|
|
38303
|
-
const windowed = models.slice(start, end);
|
|
38304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, borderStyle: "round", borderColor: "cyan", paddingX: 1, children: [
|
|
38305
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
|
|
38306
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { bold: true, color: "cyan", children: "Select a model " }),
|
|
38307
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "gray", children: [
|
|
38308
|
-
"\u2014 \u2191/\u2193 move \xB7 Enter switch \xB7 Esc cancel (",
|
|
38309
|
-
selected + 1,
|
|
38310
|
-
"/",
|
|
38311
|
-
total,
|
|
38312
|
-
")"
|
|
38313
|
-
] })
|
|
38314
|
-
] }),
|
|
38315
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", dimColor: true, children: start > 0 ? " \u2191 more" : " " }),
|
|
38316
|
-
windowed.map((m, i2) => {
|
|
38317
|
-
const idx = start + i2;
|
|
38318
|
-
const isSel = idx === selected;
|
|
38319
|
-
const isCur = m.id === current2;
|
|
38320
|
-
const cost = m.costIn != null && m.costOut != null ? ` $${m.costIn.toFixed(2)}/$${m.costOut.toFixed(2)}` : "";
|
|
38321
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
|
|
38322
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { width: 2, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "cyanBright", children: isSel ? "\u25B6" : " " }) }),
|
|
38323
|
-
/* @__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: [
|
|
38324
|
-
m.id,
|
|
38325
|
-
isCur ? " \u25CF" : ""
|
|
38326
|
-
] }) }),
|
|
38327
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "gray", children: [
|
|
38328
|
-
m.publisher,
|
|
38329
|
-
m.description ? ` \u2014 ${m.description}` : "",
|
|
38330
|
-
cost
|
|
38331
|
-
] })
|
|
38332
|
-
] }, m.id);
|
|
38333
|
-
}),
|
|
38334
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", dimColor: true, children: end < total ? " \u2193 more" : " " })
|
|
38335
|
-
] });
|
|
38336
|
-
};
|
|
38337
|
-
|
|
38338
|
-
// src/tui/Wordmark.tsx
|
|
38339
|
-
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
|
|
38340
|
-
var ROWS = [
|
|
38341
|
-
"## ## ##### ## ## ## ## ##### ## ##",
|
|
38342
|
-
"## ## ## ## #### ## ## ## ### ##",
|
|
38343
|
-
"#### ##### ## ## ## ##### #### ##",
|
|
38344
|
-
"## ## ## ## ## ## ## ## ## ####",
|
|
38345
|
-
"## ## ## ## ## ### ##### ## ###"
|
|
38346
|
-
];
|
|
38347
|
-
var Wordmark = ({ muted, fg }) => {
|
|
38348
|
-
const rows = ROWS.map((r) => r.replace(/#/g, "\u2588"));
|
|
38349
|
-
const width = Math.max(...rows.map((r) => r.length));
|
|
38350
|
-
const mid = Math.floor(width / 2);
|
|
38351
|
-
let split = mid;
|
|
38352
|
-
outer: for (let d = 0; d <= mid; d++) {
|
|
38353
|
-
for (const c3 of [mid - d, mid + d]) {
|
|
38354
|
-
if (c3 >= 0 && c3 <= width && rows.every((r) => (r[c3] ?? " ") === " ")) {
|
|
38355
|
-
split = c3;
|
|
38356
|
-
break outer;
|
|
38357
|
-
}
|
|
38358
|
-
}
|
|
38359
|
-
}
|
|
38360
|
-
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: [
|
|
38361
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { color: muted, children: line.slice(0, split) }),
|
|
38362
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { bold: true, color: fg, children: line.slice(split) })
|
|
38363
|
-
] }, i2)) });
|
|
38364
|
-
};
|
|
38365
|
-
|
|
38366
38362
|
// src/commands-palette/parser.ts
|
|
38367
38363
|
function parseSlash(input) {
|
|
38368
38364
|
const t = input.trimStart();
|
|
@@ -38426,8 +38422,6 @@ var MODELS = [
|
|
|
38426
38422
|
{ id: "qwen3-235b", publisher: "Alibaba", description: "Workhorse general" },
|
|
38427
38423
|
// Moonshot
|
|
38428
38424
|
{ id: "kimi-k2-thinking", publisher: "Moonshot", description: "Thinking budget" },
|
|
38429
|
-
// Zhipu
|
|
38430
|
-
{ id: "glm-4.7", publisher: "Zhipu", description: "Long-context all-rounder" },
|
|
38431
38425
|
// xAI
|
|
38432
38426
|
{ id: "grok-4.20-reasoning", publisher: "xAI", description: "Reasoning" },
|
|
38433
38427
|
{ id: "grok-4.1-fast-reasoning", publisher: "xAI", description: "Fast reasoning" },
|
|
@@ -38437,6 +38431,13 @@ var MODELS = [
|
|
|
38437
38431
|
{ id: "mistral-small-3.2-abliterated", publisher: "fabhaus", description: "Mistral Small 3.2, abliterated" }
|
|
38438
38432
|
];
|
|
38439
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
|
+
]);
|
|
38440
38441
|
function publisherFor(id) {
|
|
38441
38442
|
return MODELS.find((m) => m.id === id)?.publisher ?? "(unknown)";
|
|
38442
38443
|
}
|
|
@@ -38486,6 +38487,83 @@ var moodCommand = {
|
|
|
38486
38487
|
}
|
|
38487
38488
|
};
|
|
38488
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
|
+
|
|
38489
38567
|
// src/tui/input/complete.ts
|
|
38490
38568
|
import { opendirSync } from "node:fs";
|
|
38491
38569
|
import { join as join26, dirname as dirname12, basename as basename5 } from "node:path";
|
|
@@ -38545,6 +38623,118 @@ var exitCommand = {
|
|
|
38545
38623
|
name: "exit"
|
|
38546
38624
|
};
|
|
38547
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
|
+
|
|
38548
38738
|
// src/commands-palette/builtin/login.ts
|
|
38549
38739
|
init_crypto();
|
|
38550
38740
|
var loginCommand2 = {
|
|
@@ -38800,7 +38990,7 @@ function normalizeArrayFields(fm) {
|
|
|
38800
38990
|
}
|
|
38801
38991
|
return fm;
|
|
38802
38992
|
}
|
|
38803
|
-
function parseSkillFile(
|
|
38993
|
+
function parseSkillFile(path11, src) {
|
|
38804
38994
|
const m = src.match(FRONTMATTER_RE);
|
|
38805
38995
|
if (!m) {
|
|
38806
38996
|
return { frontmatter: {}, body: src };
|
|
@@ -38809,7 +38999,7 @@ function parseSkillFile(path10, src) {
|
|
|
38809
38999
|
try {
|
|
38810
39000
|
frontmatter = normalizeArrayFields(parseSimpleYaml(m[1]));
|
|
38811
39001
|
} catch (err) {
|
|
38812
|
-
logger.warn("skill: yaml parse failed",
|
|
39002
|
+
logger.warn("skill: yaml parse failed", path11, String(err));
|
|
38813
39003
|
}
|
|
38814
39004
|
const body = src.slice(m[0].length);
|
|
38815
39005
|
return { frontmatter, body };
|
|
@@ -40661,12 +40851,12 @@ var ThemeManager = class extends EventEmitter4 {
|
|
|
40661
40851
|
async loadAll() {
|
|
40662
40852
|
await mkdir4(THEMES_DIR, { recursive: true, mode: 448 });
|
|
40663
40853
|
for (const t of BUILTIN_THEMES) {
|
|
40664
|
-
const
|
|
40854
|
+
const path11 = join10(THEMES_DIR, `${t.name}.json`);
|
|
40665
40855
|
try {
|
|
40666
|
-
await writeFile3(
|
|
40856
|
+
await writeFile3(path11, JSON.stringify(t, null, 2), { flag: "wx" });
|
|
40667
40857
|
} catch (err) {
|
|
40668
40858
|
if (err?.code !== "EEXIST") {
|
|
40669
|
-
logger.warn("theme: cannot materialize built-in",
|
|
40859
|
+
logger.warn("theme: cannot materialize built-in", path11, String(err));
|
|
40670
40860
|
}
|
|
40671
40861
|
}
|
|
40672
40862
|
}
|
|
@@ -40674,15 +40864,15 @@ var ThemeManager = class extends EventEmitter4 {
|
|
|
40674
40864
|
const files = await readdir4(THEMES_DIR);
|
|
40675
40865
|
for (const f of files) {
|
|
40676
40866
|
if (!f.endsWith(".json")) continue;
|
|
40677
|
-
const
|
|
40867
|
+
const path11 = join10(THEMES_DIR, f);
|
|
40678
40868
|
try {
|
|
40679
|
-
const raw = await readFile5(
|
|
40869
|
+
const raw = await readFile5(path11, "utf8");
|
|
40680
40870
|
const parsed = JSON.parse(raw);
|
|
40681
40871
|
if (parsed?.name && parsed?.colors) {
|
|
40682
|
-
this.themes.set(parsed.name, { ...parsed, sourcePath:
|
|
40872
|
+
this.themes.set(parsed.name, { ...parsed, sourcePath: path11 });
|
|
40683
40873
|
}
|
|
40684
40874
|
} catch (err) {
|
|
40685
|
-
logger.warn("theme: parse failed",
|
|
40875
|
+
logger.warn("theme: parse failed", path11, String(err));
|
|
40686
40876
|
}
|
|
40687
40877
|
}
|
|
40688
40878
|
} catch (err) {
|
|
@@ -40701,20 +40891,20 @@ var ThemeManager = class extends EventEmitter4 {
|
|
|
40701
40891
|
try {
|
|
40702
40892
|
this.watcher = fsWatch(THEMES_DIR, { persistent: false }, async (_event, filename) => {
|
|
40703
40893
|
if (!filename || !filename.endsWith(".json")) return;
|
|
40704
|
-
const
|
|
40705
|
-
if (!existsSync10(
|
|
40894
|
+
const path11 = join10(THEMES_DIR, filename);
|
|
40895
|
+
if (!existsSync10(path11)) return;
|
|
40706
40896
|
try {
|
|
40707
|
-
const raw = await readFile5(
|
|
40897
|
+
const raw = await readFile5(path11, "utf8");
|
|
40708
40898
|
const parsed = JSON.parse(raw);
|
|
40709
40899
|
if (parsed?.name && parsed?.colors) {
|
|
40710
|
-
this.themes.set(parsed.name, { ...parsed, sourcePath:
|
|
40900
|
+
this.themes.set(parsed.name, { ...parsed, sourcePath: path11 });
|
|
40711
40901
|
if (this.active.name === parsed.name) {
|
|
40712
40902
|
this.active = this.themes.get(parsed.name);
|
|
40713
40903
|
this.emit("change", this.active);
|
|
40714
40904
|
}
|
|
40715
40905
|
}
|
|
40716
40906
|
} catch (err) {
|
|
40717
|
-
logger.warn("theme: hot-reload parse failed",
|
|
40907
|
+
logger.warn("theme: hot-reload parse failed", path11, String(err));
|
|
40718
40908
|
}
|
|
40719
40909
|
});
|
|
40720
40910
|
} catch (err) {
|
|
@@ -41810,9 +42000,9 @@ function getMemoryPath() {
|
|
|
41810
42000
|
return join16(getConfigDir(), "memory.json");
|
|
41811
42001
|
}
|
|
41812
42002
|
async function loadNotes() {
|
|
41813
|
-
const
|
|
42003
|
+
const path11 = getMemoryPath();
|
|
41814
42004
|
try {
|
|
41815
|
-
const raw = await readFile8(
|
|
42005
|
+
const raw = await readFile8(path11, "utf8");
|
|
41816
42006
|
const parsed = JSON.parse(raw);
|
|
41817
42007
|
if (Array.isArray(parsed)) {
|
|
41818
42008
|
return parsed.filter(
|
|
@@ -41824,16 +42014,16 @@ async function loadNotes() {
|
|
|
41824
42014
|
return [];
|
|
41825
42015
|
}
|
|
41826
42016
|
async function saveNotes(notes) {
|
|
41827
|
-
const
|
|
41828
|
-
await mkdir7(dirname8(
|
|
41829
|
-
await writeFile6(
|
|
42017
|
+
const path11 = getMemoryPath();
|
|
42018
|
+
await mkdir7(dirname8(path11), { recursive: true });
|
|
42019
|
+
await writeFile6(path11, JSON.stringify(notes, null, 2) + "\n", "utf8");
|
|
41830
42020
|
}
|
|
41831
42021
|
function fmtDate2(ts) {
|
|
41832
42022
|
const d = new Date(ts);
|
|
41833
42023
|
const pad = (n2) => String(n2).padStart(2, "0");
|
|
41834
42024
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
41835
42025
|
}
|
|
41836
|
-
var NoteListPanel = ({ notes, path:
|
|
42026
|
+
var NoteListPanel = ({ notes, path: path11 }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
41837
42027
|
Box_default,
|
|
41838
42028
|
{
|
|
41839
42029
|
flexDirection: "column",
|
|
@@ -41849,7 +42039,7 @@ var NoteListPanel = ({ notes, path: path10 }) => /* @__PURE__ */ (0, import_jsx_
|
|
|
41849
42039
|
" ",
|
|
41850
42040
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Text, { color: "gray", dimColor: true, children: [
|
|
41851
42041
|
"(",
|
|
41852
|
-
|
|
42042
|
+
path11,
|
|
41853
42043
|
")"
|
|
41854
42044
|
] })
|
|
41855
42045
|
] }),
|
|
@@ -42002,21 +42192,21 @@ function projectSettingsPath(cwd2) {
|
|
|
42002
42192
|
function settingsPathForScope(scope, cwd2) {
|
|
42003
42193
|
return scope === "global" ? globalSettingsPath() : projectSettingsPath(cwd2);
|
|
42004
42194
|
}
|
|
42005
|
-
function readSettings(
|
|
42006
|
-
if (!existsSync12(
|
|
42195
|
+
function readSettings(path11) {
|
|
42196
|
+
if (!existsSync12(path11)) return {};
|
|
42007
42197
|
try {
|
|
42008
|
-
return JSON.parse(readFileSync8(
|
|
42198
|
+
return JSON.parse(readFileSync8(path11, "utf8"));
|
|
42009
42199
|
} catch {
|
|
42010
42200
|
return {};
|
|
42011
42201
|
}
|
|
42012
42202
|
}
|
|
42013
|
-
function writeSettings(
|
|
42014
|
-
const dir = dirname9(
|
|
42203
|
+
function writeSettings(path11, settings) {
|
|
42204
|
+
const dir = dirname9(path11);
|
|
42015
42205
|
if (!existsSync12(dir)) mkdirSync4(dir, { recursive: true });
|
|
42016
|
-
writeFileSync5(
|
|
42206
|
+
writeFileSync5(path11, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
42017
42207
|
}
|
|
42018
|
-
function readHooks(
|
|
42019
|
-
const settings = readSettings(
|
|
42208
|
+
function readHooks(path11) {
|
|
42209
|
+
const settings = readSettings(path11);
|
|
42020
42210
|
const raw = settings.hooks;
|
|
42021
42211
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
|
|
42022
42212
|
const out = {};
|
|
@@ -42037,32 +42227,32 @@ function readHooks(path10) {
|
|
|
42037
42227
|
}
|
|
42038
42228
|
return out;
|
|
42039
42229
|
}
|
|
42040
|
-
function writeHooks(
|
|
42041
|
-
const settings = readSettings(
|
|
42230
|
+
function writeHooks(path11, hooks) {
|
|
42231
|
+
const settings = readSettings(path11);
|
|
42042
42232
|
settings.hooks = hooks;
|
|
42043
|
-
writeSettings(
|
|
42233
|
+
writeSettings(path11, settings);
|
|
42044
42234
|
}
|
|
42045
|
-
function addHook(
|
|
42046
|
-
const hooks = readHooks(
|
|
42235
|
+
function addHook(path11, event, command) {
|
|
42236
|
+
const hooks = readHooks(path11);
|
|
42047
42237
|
const list = hooks[event] ?? [];
|
|
42048
42238
|
const newEntry = { command, enabled: true };
|
|
42049
42239
|
list.push(newEntry);
|
|
42050
42240
|
hooks[event] = list;
|
|
42051
|
-
writeHooks(
|
|
42241
|
+
writeHooks(path11, hooks);
|
|
42052
42242
|
return { added: true, index: list.length - 1 };
|
|
42053
42243
|
}
|
|
42054
|
-
function setEnabled(
|
|
42055
|
-
const hooks = readHooks(
|
|
42244
|
+
function setEnabled(path11, event, index, enabled) {
|
|
42245
|
+
const hooks = readHooks(path11);
|
|
42056
42246
|
const list = hooks[event];
|
|
42057
42247
|
if (!list || list.length === 0) return { ok: false, reason: "no-event" };
|
|
42058
42248
|
if (index < 0 || index >= list.length) return { ok: false, reason: "out-of-range" };
|
|
42059
42249
|
list[index] = { ...list[index], enabled };
|
|
42060
42250
|
hooks[event] = list;
|
|
42061
|
-
writeHooks(
|
|
42251
|
+
writeHooks(path11, hooks);
|
|
42062
42252
|
return { ok: true };
|
|
42063
42253
|
}
|
|
42064
|
-
function removeHook(
|
|
42065
|
-
const hooks = readHooks(
|
|
42254
|
+
function removeHook(path11, event, index) {
|
|
42255
|
+
const hooks = readHooks(path11);
|
|
42066
42256
|
const list = hooks[event];
|
|
42067
42257
|
if (!list || list.length === 0) return { ok: false, reason: "no-event" };
|
|
42068
42258
|
if (index < 0 || index >= list.length) return { ok: false, reason: "out-of-range" };
|
|
@@ -42072,17 +42262,17 @@ function removeHook(path10, event, index) {
|
|
|
42072
42262
|
} else {
|
|
42073
42263
|
hooks[event] = list;
|
|
42074
42264
|
}
|
|
42075
|
-
writeHooks(
|
|
42265
|
+
writeHooks(path11, hooks);
|
|
42076
42266
|
return { ok: true };
|
|
42077
42267
|
}
|
|
42078
|
-
function editHook(
|
|
42079
|
-
const hooks = readHooks(
|
|
42268
|
+
function editHook(path11, event, index, newCommand2) {
|
|
42269
|
+
const hooks = readHooks(path11);
|
|
42080
42270
|
const list = hooks[event];
|
|
42081
42271
|
if (!list || list.length === 0) return { ok: false, reason: "no-event" };
|
|
42082
42272
|
if (index < 0 || index >= list.length) return { ok: false, reason: "out-of-range" };
|
|
42083
42273
|
list[index] = { ...list[index], command: newCommand2 };
|
|
42084
42274
|
hooks[event] = list;
|
|
42085
|
-
writeHooks(
|
|
42275
|
+
writeHooks(path11, hooks);
|
|
42086
42276
|
return { ok: true };
|
|
42087
42277
|
}
|
|
42088
42278
|
var HookRow = ({ index, entry }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Box_default, { flexDirection: "row", marginLeft: 2, children: [
|
|
@@ -42239,14 +42429,14 @@ var hooksCommand = {
|
|
|
42239
42429
|
message: `Usage: /hooks add ${rawScope} ${event} <command>`
|
|
42240
42430
|
};
|
|
42241
42431
|
}
|
|
42242
|
-
const
|
|
42432
|
+
const path11 = settingsPathForScope(scope, ctx.cwd);
|
|
42243
42433
|
try {
|
|
42244
|
-
const { index } = addHook(
|
|
42434
|
+
const { index } = addHook(path11, event, command);
|
|
42245
42435
|
return {
|
|
42246
42436
|
type: "ack",
|
|
42247
42437
|
message: `Added hook [${index}] to ${scope}/${event}:
|
|
42248
42438
|
${command}
|
|
42249
|
-
Saved to ${
|
|
42439
|
+
Saved to ${path11}`
|
|
42250
42440
|
};
|
|
42251
42441
|
} catch (err) {
|
|
42252
42442
|
return { type: "error", message: `Failed to write hook: ${err.message}` };
|
|
@@ -42271,9 +42461,9 @@ Saved to ${path10}`
|
|
|
42271
42461
|
message: `Usage: /hooks ${sub} ${rawScope} <event> <index>`
|
|
42272
42462
|
};
|
|
42273
42463
|
}
|
|
42274
|
-
const
|
|
42464
|
+
const path11 = settingsPathForScope(scope, ctx.cwd);
|
|
42275
42465
|
try {
|
|
42276
|
-
const result = setEnabled(
|
|
42466
|
+
const result = setEnabled(path11, event, index, enabled);
|
|
42277
42467
|
if (!result.ok) {
|
|
42278
42468
|
if (result.reason === "no-event") {
|
|
42279
42469
|
return {
|
|
@@ -42313,9 +42503,9 @@ Saved to ${path10}`
|
|
|
42313
42503
|
message: `Usage: /hooks edit ${rawScope} <event> <index> <new-command>`
|
|
42314
42504
|
};
|
|
42315
42505
|
}
|
|
42316
|
-
const
|
|
42506
|
+
const path11 = settingsPathForScope(scope, ctx.cwd);
|
|
42317
42507
|
try {
|
|
42318
|
-
const result = editHook(
|
|
42508
|
+
const result = editHook(path11, event, index, newCommand2);
|
|
42319
42509
|
if (!result.ok) {
|
|
42320
42510
|
if (result.reason === "no-event") {
|
|
42321
42511
|
return {
|
|
@@ -42355,9 +42545,9 @@ Saved to ${path10}`
|
|
|
42355
42545
|
message: `Usage: /hooks rm ${rawScope} <event> <index>`
|
|
42356
42546
|
};
|
|
42357
42547
|
}
|
|
42358
|
-
const
|
|
42548
|
+
const path11 = settingsPathForScope(scope, ctx.cwd);
|
|
42359
42549
|
try {
|
|
42360
|
-
const result = removeHook(
|
|
42550
|
+
const result = removeHook(path11, event, index);
|
|
42361
42551
|
if (!result.ok) {
|
|
42362
42552
|
if (result.reason === "no-event") {
|
|
42363
42553
|
return {
|
|
@@ -43593,8 +43783,8 @@ async function listBgAgents() {
|
|
|
43593
43783
|
const tailBytes = Math.min(st.size, 4096);
|
|
43594
43784
|
if (tailBytes > 0) {
|
|
43595
43785
|
const buf = Buffer.alloc(tailBytes);
|
|
43596
|
-
const
|
|
43597
|
-
const fd = await
|
|
43786
|
+
const fs7 = await import("node:fs/promises");
|
|
43787
|
+
const fd = await fs7.open(log, "r");
|
|
43598
43788
|
try {
|
|
43599
43789
|
await fd.read(buf, 0, tailBytes, st.size - tailBytes);
|
|
43600
43790
|
} finally {
|
|
@@ -43670,8 +43860,8 @@ async function attachBgAgent(id, onLine, signal) {
|
|
|
43670
43860
|
const s = await stat8(p);
|
|
43671
43861
|
if (s.size > pos) {
|
|
43672
43862
|
const buf = Buffer.alloc(s.size - pos);
|
|
43673
|
-
const
|
|
43674
|
-
const fd = await
|
|
43863
|
+
const fs7 = await import("node:fs/promises");
|
|
43864
|
+
const fd = await fs7.open(p, "r");
|
|
43675
43865
|
try {
|
|
43676
43866
|
await fd.read(buf, 0, buf.length, pos);
|
|
43677
43867
|
flush(decoder.write(buf), false);
|
|
@@ -43760,7 +43950,7 @@ async function runBgAgent(id) {
|
|
|
43760
43950
|
apiKey: cfg.apiKey,
|
|
43761
43951
|
baseUrl: cfg.apiBaseUrl,
|
|
43762
43952
|
clientType: "ide",
|
|
43763
|
-
userAgent: `kryven-cli-bg/${"0.2.
|
|
43953
|
+
userAgent: `kryven-cli-bg/${"0.2.7"}`
|
|
43764
43954
|
});
|
|
43765
43955
|
const transcriptPath = join25(dir, "transcript.jsonl");
|
|
43766
43956
|
const appendTranscript = async (m) => {
|
|
@@ -44037,6 +44227,7 @@ var BUILTIN_COMMANDS = [
|
|
|
44037
44227
|
exitCommand,
|
|
44038
44228
|
modelCommand,
|
|
44039
44229
|
moodCommand,
|
|
44230
|
+
effortCommand,
|
|
44040
44231
|
loginCommand2,
|
|
44041
44232
|
costCommand,
|
|
44042
44233
|
skillCommand,
|
|
@@ -44181,6 +44372,175 @@ function applyCompletion(buffer, result, item) {
|
|
|
44181
44372
|
init_messages();
|
|
44182
44373
|
init_system_prompt();
|
|
44183
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
|
|
44184
44544
|
init_client();
|
|
44185
44545
|
init_errors();
|
|
44186
44546
|
|
|
@@ -44188,8 +44548,8 @@ init_errors();
|
|
|
44188
44548
|
init_defaults();
|
|
44189
44549
|
init_logger();
|
|
44190
44550
|
import { appendFile, mkdir as mkdir10, readFile as readFile13, readdir as readdir9 } from "node:fs/promises";
|
|
44191
|
-
import { existsSync as
|
|
44192
|
-
import { join as
|
|
44551
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
44552
|
+
import { join as join28 } from "node:path";
|
|
44193
44553
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
44194
44554
|
var SessionStore = class {
|
|
44195
44555
|
id;
|
|
@@ -44199,12 +44559,12 @@ var SessionStore = class {
|
|
|
44199
44559
|
writing = Promise.resolve();
|
|
44200
44560
|
constructor(id) {
|
|
44201
44561
|
this.id = id ?? randomUUID2();
|
|
44202
|
-
this.dir =
|
|
44203
|
-
this.transcriptPath =
|
|
44204
|
-
this.metaPath =
|
|
44562
|
+
this.dir = join28(getSessionsDir(), this.id);
|
|
44563
|
+
this.transcriptPath = join28(this.dir, "transcript.jsonl");
|
|
44564
|
+
this.metaPath = join28(this.dir, "meta.json");
|
|
44205
44565
|
}
|
|
44206
44566
|
async init(meta) {
|
|
44207
|
-
if (!
|
|
44567
|
+
if (!existsSync18(this.dir)) {
|
|
44208
44568
|
await mkdir10(this.dir, { recursive: true, mode: 448 });
|
|
44209
44569
|
}
|
|
44210
44570
|
const full = {
|
|
@@ -44228,17 +44588,17 @@ var SessionStore = class {
|
|
|
44228
44588
|
true
|
|
44229
44589
|
);
|
|
44230
44590
|
}
|
|
44231
|
-
async queueWrite(
|
|
44591
|
+
async queueWrite(path11, data, append) {
|
|
44232
44592
|
this.writing = this.writing.then(async () => {
|
|
44233
44593
|
try {
|
|
44234
44594
|
if (append) {
|
|
44235
|
-
await appendFile(
|
|
44595
|
+
await appendFile(path11, data);
|
|
44236
44596
|
} else {
|
|
44237
44597
|
const { writeFile: writeFile12 } = await import("node:fs/promises");
|
|
44238
|
-
await writeFile12(
|
|
44598
|
+
await writeFile12(path11, data);
|
|
44239
44599
|
}
|
|
44240
44600
|
} catch (err) {
|
|
44241
|
-
logger.warn("session: write failed",
|
|
44601
|
+
logger.warn("session: write failed", path11, String(err));
|
|
44242
44602
|
}
|
|
44243
44603
|
});
|
|
44244
44604
|
return this.writing;
|
|
@@ -44247,13 +44607,13 @@ var SessionStore = class {
|
|
|
44247
44607
|
await this.writing;
|
|
44248
44608
|
}
|
|
44249
44609
|
static async load(id) {
|
|
44250
|
-
const dir =
|
|
44251
|
-
const metaPath =
|
|
44252
|
-
const transcriptPath =
|
|
44253
|
-
if (!
|
|
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;
|
|
44254
44614
|
try {
|
|
44255
44615
|
const meta = JSON.parse(await readFile13(metaPath, "utf8"));
|
|
44256
|
-
const transcriptText =
|
|
44616
|
+
const transcriptText = existsSync18(transcriptPath) ? await readFile13(transcriptPath, "utf8") : "";
|
|
44257
44617
|
const messages = transcriptText.split("\n").filter(Boolean).map((line) => JSON.parse(line));
|
|
44258
44618
|
return { meta, messages };
|
|
44259
44619
|
} catch (err) {
|
|
@@ -44263,13 +44623,13 @@ var SessionStore = class {
|
|
|
44263
44623
|
}
|
|
44264
44624
|
static async list() {
|
|
44265
44625
|
const root = getSessionsDir();
|
|
44266
|
-
if (!
|
|
44626
|
+
if (!existsSync18(root)) return [];
|
|
44267
44627
|
try {
|
|
44268
44628
|
const ids = await readdir9(root);
|
|
44269
44629
|
const metas = [];
|
|
44270
44630
|
for (const id of ids) {
|
|
44271
|
-
const metaPath =
|
|
44272
|
-
if (!
|
|
44631
|
+
const metaPath = join28(root, id, "meta.json");
|
|
44632
|
+
if (!existsSync18(metaPath)) continue;
|
|
44273
44633
|
try {
|
|
44274
44634
|
metas.push(JSON.parse(await readFile13(metaPath, "utf8")));
|
|
44275
44635
|
} catch {
|
|
@@ -44287,16 +44647,16 @@ var SessionStore = class {
|
|
|
44287
44647
|
init_defaults();
|
|
44288
44648
|
init_logger();
|
|
44289
44649
|
import { appendFile as appendFile2, readFile as readFile14, writeFile as writeFile10, mkdir as mkdir11 } from "node:fs/promises";
|
|
44290
|
-
import { existsSync as
|
|
44291
|
-
import { dirname as dirname13, join as
|
|
44650
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
44651
|
+
import { dirname as dirname13, join as join29 } from "node:path";
|
|
44292
44652
|
var Outbox = class {
|
|
44293
44653
|
path;
|
|
44294
44654
|
constructor(sessionId) {
|
|
44295
|
-
this.path =
|
|
44655
|
+
this.path = join29(getSessionsDir(), sessionId, "_outbox.jsonl");
|
|
44296
44656
|
}
|
|
44297
44657
|
async push(entry) {
|
|
44298
44658
|
const dir = dirname13(this.path);
|
|
44299
|
-
if (!
|
|
44659
|
+
if (!existsSync19(dir)) await mkdir11(dir, { recursive: true, mode: 448 });
|
|
44300
44660
|
try {
|
|
44301
44661
|
await appendFile2(this.path, JSON.stringify(entry) + "\n");
|
|
44302
44662
|
} catch (err) {
|
|
@@ -44304,7 +44664,7 @@ var Outbox = class {
|
|
|
44304
44664
|
}
|
|
44305
44665
|
}
|
|
44306
44666
|
async drain() {
|
|
44307
|
-
if (!
|
|
44667
|
+
if (!existsSync19(this.path)) return [];
|
|
44308
44668
|
try {
|
|
44309
44669
|
const text = await readFile14(this.path, "utf8");
|
|
44310
44670
|
const lines = text.split("\n").filter(Boolean);
|
|
@@ -44321,7 +44681,7 @@ var Outbox = class {
|
|
|
44321
44681
|
}
|
|
44322
44682
|
}
|
|
44323
44683
|
async clear() {
|
|
44324
|
-
if (!
|
|
44684
|
+
if (!existsSync19(this.path)) return;
|
|
44325
44685
|
try {
|
|
44326
44686
|
await writeFile10(this.path, "");
|
|
44327
44687
|
} catch (err) {
|
|
@@ -44329,7 +44689,7 @@ var Outbox = class {
|
|
|
44329
44689
|
}
|
|
44330
44690
|
}
|
|
44331
44691
|
async size() {
|
|
44332
|
-
if (!
|
|
44692
|
+
if (!existsSync19(this.path)) return 0;
|
|
44333
44693
|
try {
|
|
44334
44694
|
const text = await readFile14(this.path, "utf8");
|
|
44335
44695
|
return text.split("\n").filter(Boolean).length;
|
|
@@ -44463,9 +44823,9 @@ var SessionsClient = class {
|
|
|
44463
44823
|
headers() {
|
|
44464
44824
|
return this.client.headers();
|
|
44465
44825
|
}
|
|
44466
|
-
async req(method,
|
|
44467
|
-
const url = `${this.baseUrl}${
|
|
44468
|
-
logger.debug("sessions", method,
|
|
44826
|
+
async req(method, path11, body, signal) {
|
|
44827
|
+
const url = `${this.baseUrl}${path11}`;
|
|
44828
|
+
logger.debug("sessions", method, path11);
|
|
44469
44829
|
const res = await this.fetch(url, {
|
|
44470
44830
|
method,
|
|
44471
44831
|
headers: this.headers(),
|
|
@@ -44546,27 +44906,27 @@ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
|
44546
44906
|
init_defaults();
|
|
44547
44907
|
init_logger();
|
|
44548
44908
|
import { appendFile as appendFile3, mkdir as mkdir12, readFile as readFile15 } from "node:fs/promises";
|
|
44549
|
-
import { existsSync as
|
|
44909
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
44550
44910
|
import { dirname as dirname14 } from "node:path";
|
|
44551
44911
|
async function ensureFile() {
|
|
44552
|
-
const
|
|
44553
|
-
if (!
|
|
44554
|
-
await mkdir12(dirname14(
|
|
44912
|
+
const path11 = getHistoryPath();
|
|
44913
|
+
if (!existsSync20(dirname14(path11))) {
|
|
44914
|
+
await mkdir12(dirname14(path11), { recursive: true, mode: 448 });
|
|
44555
44915
|
}
|
|
44556
|
-
if (!
|
|
44557
|
-
await appendFile3(
|
|
44916
|
+
if (!existsSync20(path11)) {
|
|
44917
|
+
await appendFile3(path11, "");
|
|
44558
44918
|
}
|
|
44559
|
-
return
|
|
44919
|
+
return path11;
|
|
44560
44920
|
}
|
|
44561
44921
|
async function appendHistory(entry) {
|
|
44562
44922
|
try {
|
|
44563
|
-
const
|
|
44564
|
-
const release = await import_proper_lockfile.default.lock(
|
|
44923
|
+
const path11 = await ensureFile();
|
|
44924
|
+
const release = await import_proper_lockfile.default.lock(path11, {
|
|
44565
44925
|
retries: { retries: 3, factor: 1.5, minTimeout: 30 },
|
|
44566
44926
|
stale: 5e3
|
|
44567
44927
|
});
|
|
44568
44928
|
try {
|
|
44569
|
-
await appendFile3(
|
|
44929
|
+
await appendFile3(path11, JSON.stringify(entry) + "\n");
|
|
44570
44930
|
} finally {
|
|
44571
44931
|
await release();
|
|
44572
44932
|
}
|
|
@@ -44852,9 +45212,9 @@ function sanitizeForSpeech(text) {
|
|
|
44852
45212
|
|
|
44853
45213
|
// src/tui/FilePicker.tsx
|
|
44854
45214
|
var import_react28 = __toESM(require_react(), 1);
|
|
44855
|
-
var
|
|
44856
|
-
import * as
|
|
44857
|
-
import * as
|
|
45215
|
+
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
45216
|
+
import * as fs5 from "node:fs";
|
|
45217
|
+
import * as path9 from "node:path";
|
|
44858
45218
|
var IGNORED = /* @__PURE__ */ new Set([
|
|
44859
45219
|
"node_modules",
|
|
44860
45220
|
".git",
|
|
@@ -44872,11 +45232,11 @@ var IGNORED = /* @__PURE__ */ new Set([
|
|
|
44872
45232
|
function listDir2(dir) {
|
|
44873
45233
|
let dirents;
|
|
44874
45234
|
try {
|
|
44875
|
-
dirents =
|
|
45235
|
+
dirents = fs5.readdirSync(dir, { withFileTypes: true });
|
|
44876
45236
|
} catch {
|
|
44877
45237
|
return [];
|
|
44878
45238
|
}
|
|
44879
|
-
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:
|
|
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() }));
|
|
44880
45240
|
out.sort((a2, b) => a2.isDir === b.isDir ? a2.name.localeCompare(b.name) : a2.isDir ? -1 : 1);
|
|
44881
45241
|
return out;
|
|
44882
45242
|
}
|
|
@@ -44892,8 +45252,8 @@ var FilePicker = ({ cwd: cwd2, theme, onSubmit, onCancel }) => {
|
|
|
44892
45252
|
const all = new Set(selected);
|
|
44893
45253
|
if (extraAbs) all.add(extraAbs);
|
|
44894
45254
|
const rels = [...all].map((abs) => {
|
|
44895
|
-
const rel2 =
|
|
44896
|
-
return rel2 === "" ? "." : rel2.split(
|
|
45255
|
+
const rel2 = path9.relative(cwd2, abs);
|
|
45256
|
+
return rel2 === "" ? "." : rel2.split(path9.sep).join("/");
|
|
44897
45257
|
});
|
|
44898
45258
|
onSubmit(rels);
|
|
44899
45259
|
};
|
|
@@ -44911,7 +45271,7 @@ var FilePicker = ({ cwd: cwd2, theme, onSubmit, onCancel }) => {
|
|
|
44911
45271
|
return;
|
|
44912
45272
|
}
|
|
44913
45273
|
if (key.leftArrow) {
|
|
44914
|
-
const parent =
|
|
45274
|
+
const parent = path9.dirname(dir);
|
|
44915
45275
|
if (parent !== dir) {
|
|
44916
45276
|
setDir(parent);
|
|
44917
45277
|
setCursor(0);
|
|
@@ -44950,28 +45310,28 @@ var FilePicker = ({ cwd: cwd2, theme, onSubmit, onCancel }) => {
|
|
|
44950
45310
|
return;
|
|
44951
45311
|
}
|
|
44952
45312
|
});
|
|
44953
|
-
const rel =
|
|
44954
|
-
return /* @__PURE__ */ (0,
|
|
44955
|
-
/* @__PURE__ */ (0,
|
|
44956
|
-
/* @__PURE__ */ (0,
|
|
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: [
|
|
44957
45317
|
"./",
|
|
44958
45318
|
rel === "." ? "" : rel,
|
|
44959
45319
|
"/"
|
|
44960
45320
|
] }),
|
|
44961
|
-
/* @__PURE__ */ (0,
|
|
44962
|
-
start > 0 && /* @__PURE__ */ (0,
|
|
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" }),
|
|
44963
45323
|
visible.map((e) => {
|
|
44964
45324
|
const i2 = entries.indexOf(e);
|
|
44965
45325
|
const isCursor = i2 === cursor;
|
|
44966
45326
|
const isSel = selected.has(e.abs);
|
|
44967
45327
|
const mark = isSel ? "\u25C9" : "\u25EF";
|
|
44968
45328
|
const icon = e.isDir ? "\u25B8 " : " ";
|
|
44969
|
-
return /* @__PURE__ */ (0,
|
|
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);
|
|
44970
45330
|
}),
|
|
44971
|
-
entries.length === 0 && /* @__PURE__ */ (0,
|
|
44972
|
-
start + WINDOW < entries.length && /* @__PURE__ */ (0,
|
|
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" })
|
|
44973
45333
|
] }),
|
|
44974
|
-
/* @__PURE__ */ (0,
|
|
45334
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Text, { color: theme.muted, children: [
|
|
44975
45335
|
"\u2191\u2193 move \xB7 \u2192 open \xB7 \u2190 up \xB7 space select",
|
|
44976
45336
|
selected.size > 0 ? ` (${selected.size})` : "",
|
|
44977
45337
|
" \xB7 enter add \xB7 esc cancel"
|
|
@@ -44980,9 +45340,36 @@ var FilePicker = ({ cwd: cwd2, theme, onSubmit, onCancel }) => {
|
|
|
44980
45340
|
};
|
|
44981
45341
|
|
|
44982
45342
|
// src/tui/REPL.tsx
|
|
44983
|
-
var
|
|
44984
|
-
import
|
|
44985
|
-
import
|
|
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
|
+
}
|
|
44986
45373
|
function extractCodeBlocks(text) {
|
|
44987
45374
|
if (!text) return [];
|
|
44988
45375
|
const out = [];
|
|
@@ -44999,10 +45386,10 @@ function detectReflectCommand(cwd2) {
|
|
|
44999
45386
|
const override = process.env.KRYVEN_REFLECT_CMD;
|
|
45000
45387
|
if (override !== void 0) return override.trim() || null;
|
|
45001
45388
|
try {
|
|
45002
|
-
if (
|
|
45003
|
-
const pkgPath =
|
|
45004
|
-
if (
|
|
45005
|
-
const pkg = JSON.parse(
|
|
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"));
|
|
45006
45393
|
if (pkg?.scripts?.typecheck) return "npm run typecheck";
|
|
45007
45394
|
if (pkg?.scripts?.test) return "npm test";
|
|
45008
45395
|
}
|
|
@@ -45062,12 +45449,20 @@ var REPL = ({
|
|
|
45062
45449
|
const [busy, setBusy] = (0, import_react29.useState)(false);
|
|
45063
45450
|
const [model, setModel] = (0, import_react29.useState)(initialModel);
|
|
45064
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);
|
|
45065
45457
|
const [git, setGit] = (0, import_react29.useState)({ isRepo: false });
|
|
45066
45458
|
const [, forceRender] = (0, import_react29.useState)(0);
|
|
45067
45459
|
const [overlay, setOverlay] = (0, import_react29.useState)(null);
|
|
45068
45460
|
const [notes, setNotes] = (0, import_react29.useState)([]);
|
|
45069
45461
|
const [sessionTokens, setSessionTokens] = (0, import_react29.useState)(0);
|
|
45070
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)([]);
|
|
45071
45466
|
const [permissionReq, setPermissionReq] = (0, import_react29.useState)(null);
|
|
45072
45467
|
const [modelPicker, setModelPicker] = (0, import_react29.useState)(null);
|
|
45073
45468
|
const [filePicker, setFilePicker] = (0, import_react29.useState)(false);
|
|
@@ -45149,13 +45544,13 @@ var REPL = ({
|
|
|
45149
45544
|
}, []);
|
|
45150
45545
|
const toolsEnabled = (0, import_react29.useMemo)(() => listTools().length > 0, []);
|
|
45151
45546
|
(0, import_react29.useEffect)(() => {
|
|
45152
|
-
void checkForUpdate("0.2.
|
|
45547
|
+
void checkForUpdate("0.2.7").then((info) => {
|
|
45153
45548
|
if (info?.updateAvailable) {
|
|
45154
45549
|
setNotes((p) => [
|
|
45155
45550
|
...p,
|
|
45156
45551
|
{
|
|
45157
45552
|
kind: "system",
|
|
45158
|
-
text: `Update available: ${"0.2.
|
|
45553
|
+
text: `Update available: ${"0.2.7"} \u2192 ${info.latest}. Run \`kryven update\` to update.`
|
|
45159
45554
|
}
|
|
45160
45555
|
]);
|
|
45161
45556
|
}
|
|
@@ -45214,6 +45609,34 @@ var REPL = ({
|
|
|
45214
45609
|
}
|
|
45215
45610
|
return;
|
|
45216
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
|
+
}
|
|
45217
45640
|
if (filePicker) return;
|
|
45218
45641
|
if (permissionReq && permissionResolveRef.current) {
|
|
45219
45642
|
const ch = inputCh.toLowerCase();
|
|
@@ -45252,7 +45675,12 @@ var REPL = ({
|
|
|
45252
45675
|
}
|
|
45253
45676
|
return;
|
|
45254
45677
|
}
|
|
45255
|
-
|
|
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() === "") {
|
|
45256
45684
|
setFilePicker(true);
|
|
45257
45685
|
return;
|
|
45258
45686
|
}
|
|
@@ -45302,6 +45730,14 @@ var REPL = ({
|
|
|
45302
45730
|
sessionMessages: conversationRef.current.size(),
|
|
45303
45731
|
setModel: (m) => setModel(m),
|
|
45304
45732
|
setMood: (m) => setMood(m),
|
|
45733
|
+
effort,
|
|
45734
|
+
setEffort: (e) => {
|
|
45735
|
+
setEffort(e);
|
|
45736
|
+
try {
|
|
45737
|
+
saveUserConfig({ ...loadUserConfig(), effort: e });
|
|
45738
|
+
} catch {
|
|
45739
|
+
}
|
|
45740
|
+
},
|
|
45305
45741
|
// /login: validate a new key, persist it, and hot-swap the live client so
|
|
45306
45742
|
// the next message uses it — no restart. Flips guest -> authenticated too.
|
|
45307
45743
|
relogin: async (rawKey) => {
|
|
@@ -45314,7 +45750,7 @@ var REPL = ({
|
|
|
45314
45750
|
apiKey: key,
|
|
45315
45751
|
baseUrl: cfg.apiBaseUrl,
|
|
45316
45752
|
clientType: "ide",
|
|
45317
|
-
userAgent: `kryven-cli/${"0.2.
|
|
45753
|
+
userAgent: `kryven-cli/${"0.2.7"}`
|
|
45318
45754
|
});
|
|
45319
45755
|
try {
|
|
45320
45756
|
await candidate.ping();
|
|
@@ -45333,7 +45769,7 @@ var REPL = ({
|
|
|
45333
45769
|
return { ok: true, message: `Logged in \u2014 key validated, saved, and active for this session.${toolHint}` };
|
|
45334
45770
|
}
|
|
45335
45771
|
}),
|
|
45336
|
-
[model, mood, cwd2, sessionTokens]
|
|
45772
|
+
[model, mood, effort, cwd2, sessionTokens]
|
|
45337
45773
|
);
|
|
45338
45774
|
const handleSlashResult = (res) => {
|
|
45339
45775
|
switch (res.type) {
|
|
@@ -45403,6 +45839,11 @@ var REPL = ({
|
|
|
45403
45839
|
setModelPicker({ sel: idx >= 0 ? idx : 0 });
|
|
45404
45840
|
return;
|
|
45405
45841
|
}
|
|
45842
|
+
case "effort-picker": {
|
|
45843
|
+
const eIdx = EFFORT_LEVELS.indexOf(effort);
|
|
45844
|
+
setEffortPicker({ sel: eIdx >= 0 ? eIdx : 0 });
|
|
45845
|
+
return;
|
|
45846
|
+
}
|
|
45406
45847
|
}
|
|
45407
45848
|
};
|
|
45408
45849
|
const askPermission = (req) => new Promise((resolve7) => {
|
|
@@ -45414,7 +45855,14 @@ var REPL = ({
|
|
|
45414
45855
|
});
|
|
45415
45856
|
});
|
|
45416
45857
|
const submit = async (rawText) => {
|
|
45417
|
-
|
|
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();
|
|
45418
45866
|
if (!text || busy || permissionReq) return;
|
|
45419
45867
|
setInput("");
|
|
45420
45868
|
if (/^\/voice(\s|$)/i.test(text)) {
|
|
@@ -45452,14 +45900,19 @@ var REPL = ({
|
|
|
45452
45900
|
}
|
|
45453
45901
|
return;
|
|
45454
45902
|
}
|
|
45455
|
-
|
|
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() };
|
|
45456
45909
|
conversationRef.current.append(userMsg);
|
|
45457
45910
|
void sessionRef.current.appendMessage(userMsg);
|
|
45458
45911
|
if (remoteSessionRef.current) {
|
|
45459
45912
|
void remoteSessionRef.current.appendMessage(userMsg).catch(() => {
|
|
45460
45913
|
});
|
|
45461
45914
|
}
|
|
45462
|
-
void appendHistory({ ts: userMsg.ts, cwd: cwd2, prompt:
|
|
45915
|
+
void appendHistory({ ts: userMsg.ts, cwd: cwd2, prompt: promptText });
|
|
45463
45916
|
forceRender((n2) => n2 + 1);
|
|
45464
45917
|
const baseSys = composeSystemPrompt({
|
|
45465
45918
|
cwd: cwd2,
|
|
@@ -45473,6 +45926,8 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45473
45926
|
abortRef.current = ac;
|
|
45474
45927
|
setBusy(true);
|
|
45475
45928
|
setToolEntries([]);
|
|
45929
|
+
turnActionsRef.current.clear();
|
|
45930
|
+
setLastSummary("");
|
|
45476
45931
|
try {
|
|
45477
45932
|
if (isGuest) {
|
|
45478
45933
|
await runGuestTurn(ac);
|
|
@@ -45582,7 +46037,7 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45582
46037
|
}
|
|
45583
46038
|
};
|
|
45584
46039
|
const reflectCmd = detectReflectCommand(cwd2);
|
|
45585
|
-
|
|
46040
|
+
const loopOpts = {
|
|
45586
46041
|
systemPrompt: sys,
|
|
45587
46042
|
model,
|
|
45588
46043
|
mood,
|
|
@@ -45591,7 +46046,10 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45591
46046
|
toolCtx: { cwd: cwd2, readPaths: readPathsRef.current },
|
|
45592
46047
|
signal: ac.signal,
|
|
45593
46048
|
reflect: reflectCmd ? { command: reflectCmd, cwd: cwd2, maxReflections: Number(process.env.KRYVEN_MAX_REFLECTIONS) || 2 } : void 0
|
|
45594
|
-
}
|
|
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) {
|
|
45595
46053
|
switch (ev.type) {
|
|
45596
46054
|
case "iteration_start":
|
|
45597
46055
|
streamAcc = "";
|
|
@@ -45620,6 +46078,11 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45620
46078
|
};
|
|
45621
46079
|
toolMetaRef.current.set(entry.callId, entry);
|
|
45622
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
|
+
});
|
|
45623
46086
|
}
|
|
45624
46087
|
break;
|
|
45625
46088
|
case "tool_result": {
|
|
@@ -45636,6 +46099,10 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45636
46099
|
renderHint: ev.renderHint
|
|
45637
46100
|
});
|
|
45638
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
|
+
}
|
|
45639
46106
|
const toolMsg = {
|
|
45640
46107
|
role: "tool",
|
|
45641
46108
|
content: ev.output,
|
|
@@ -45666,16 +46133,21 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45666
46133
|
endedNormally = true;
|
|
45667
46134
|
setStreaming(null);
|
|
45668
46135
|
streamAcc = "";
|
|
46136
|
+
setLastSummary(buildTurnSummary([...turnActionsRef.current.values()]));
|
|
45669
46137
|
if (ev.usage) setSessionTokens((t) => t + ev.usage.total_tokens);
|
|
45670
46138
|
flushPersistableTurns();
|
|
45671
46139
|
break;
|
|
45672
46140
|
case "reflection":
|
|
45673
46141
|
setStreaming(null);
|
|
45674
46142
|
streamAcc = "";
|
|
45675
|
-
|
|
45676
|
-
...p,
|
|
45677
|
-
|
|
45678
|
-
|
|
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
|
+
}
|
|
45679
46151
|
break;
|
|
45680
46152
|
case "max_iterations":
|
|
45681
46153
|
setNotes((p) => [
|
|
@@ -45715,11 +46187,11 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45715
46187
|
const items = [
|
|
45716
46188
|
{
|
|
45717
46189
|
id: `${gen}-header`,
|
|
45718
|
-
node: /* @__PURE__ */ (0,
|
|
45719
|
-
/* @__PURE__ */ (0,
|
|
45720
|
-
/* @__PURE__ */ (0,
|
|
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: [
|
|
45721
46193
|
"Kryven CLI ",
|
|
45722
|
-
"0.2.
|
|
46194
|
+
"0.2.7",
|
|
45723
46195
|
toolsEnabled ? " \xB7 tools" : "",
|
|
45724
46196
|
" \xB7 Powered by KRY-5.2 Extended"
|
|
45725
46197
|
] }) })
|
|
@@ -45740,11 +46212,12 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45740
46212
|
}
|
|
45741
46213
|
for (let i2 = 0; i2 < all.length; i2++) {
|
|
45742
46214
|
const m = all[i2];
|
|
46215
|
+
if (m.ephemeral) continue;
|
|
45743
46216
|
if (m.role === "user") {
|
|
45744
|
-
items.push({ id: `${gen}-m${i2}`, node: /* @__PURE__ */ (0,
|
|
46217
|
+
items.push({ id: `${gen}-m${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MessageList, { message: m, theme }) });
|
|
45745
46218
|
} else if (m.role === "assistant") {
|
|
45746
46219
|
if (typeof m.content === "string" && m.content.trim().length > 0) {
|
|
45747
|
-
items.push({ id: `${gen}-m${i2}`, node: /* @__PURE__ */ (0,
|
|
46220
|
+
items.push({ id: `${gen}-m${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MessageList, { message: m, theme }) });
|
|
45748
46221
|
}
|
|
45749
46222
|
} else if (m.role === "tool") {
|
|
45750
46223
|
const meta = m.tool_call_id ? toolMetaRef.current.get(m.tool_call_id) : void 0;
|
|
@@ -45756,7 +46229,7 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45756
46229
|
status: "ok",
|
|
45757
46230
|
output: typeof m.content === "string" ? m.content : ""
|
|
45758
46231
|
};
|
|
45759
|
-
items.push({ id: `${gen}-t${i2}`, node: /* @__PURE__ */ (0,
|
|
46232
|
+
items.push({ id: `${gen}-t${i2}`, node: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ToolCall, { ...entry }) });
|
|
45760
46233
|
}
|
|
45761
46234
|
}
|
|
45762
46235
|
return items;
|
|
@@ -45768,15 +46241,16 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45768
46241
|
}
|
|
45769
46242
|
prevCommittedCountRef.current = committedCount;
|
|
45770
46243
|
}, [committedCount]);
|
|
45771
|
-
return /* @__PURE__ */ (0,
|
|
45772
|
-
/* @__PURE__ */ (0,
|
|
45773
|
-
streaming != null && /* @__PURE__ */ (0,
|
|
45774
|
-
/* @__PURE__ */ (0,
|
|
45775
|
-
/* @__PURE__ */ (0,
|
|
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 }) })
|
|
45776
46249
|
] }),
|
|
45777
|
-
/* @__PURE__ */ (0,
|
|
45778
|
-
modelPicker && /* @__PURE__ */ (0,
|
|
45779
|
-
|
|
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)(
|
|
45780
46254
|
FilePicker,
|
|
45781
46255
|
{
|
|
45782
46256
|
cwd: cwd2,
|
|
@@ -45784,111 +46258,118 @@ ${VOICE_CONVERSATION_ADDENDUM}` : baseSys;
|
|
|
45784
46258
|
onSubmit: (rels) => {
|
|
45785
46259
|
setFilePicker(false);
|
|
45786
46260
|
if (rels.length > 0) {
|
|
45787
|
-
const
|
|
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(" ");
|
|
45788
46270
|
setInput((prev) => prev ? `${prev} ${tokens} ` : `${tokens} `);
|
|
45789
|
-
pushToast(`Added ${rels.length}
|
|
46271
|
+
pushToast(`Added ${rels.length} file${rels.length === 1 ? "" : "s"} to the prompt`);
|
|
45790
46272
|
}
|
|
45791
46273
|
setVimTick((n2) => n2 + 1);
|
|
45792
46274
|
},
|
|
45793
46275
|
onCancel: () => setFilePicker(false)
|
|
45794
46276
|
}
|
|
45795
46277
|
) }),
|
|
45796
|
-
permissionReq && /* @__PURE__ */ (0,
|
|
45797
|
-
/* @__PURE__ */ (0,
|
|
45798
|
-
/* @__PURE__ */ (0,
|
|
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: [
|
|
45799
46281
|
"Tool: ",
|
|
45800
|
-
/* @__PURE__ */ (0,
|
|
46282
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "cyan", children: permissionReq.toolName }),
|
|
45801
46283
|
" ",
|
|
45802
|
-
/* @__PURE__ */ (0,
|
|
46284
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { color: riskColor(permissionReq.risk), children: [
|
|
45803
46285
|
"[",
|
|
45804
46286
|
permissionReq.risk,
|
|
45805
46287
|
"]"
|
|
45806
46288
|
] })
|
|
45807
46289
|
] }),
|
|
45808
|
-
/* @__PURE__ */ (0,
|
|
45809
|
-
/* @__PURE__ */ (0,
|
|
45810
|
-
/* @__PURE__ */ (0,
|
|
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]" }),
|
|
45811
46293
|
" allow once \xB7",
|
|
45812
46294
|
" ",
|
|
45813
|
-
/* @__PURE__ */ (0,
|
|
46295
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "green", children: "[A]" }),
|
|
45814
46296
|
" always (this command) \xB7",
|
|
45815
46297
|
" ",
|
|
45816
|
-
/* @__PURE__ */ (0,
|
|
46298
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "green", children: "[Shift+A]" }),
|
|
45817
46299
|
" always (this tool) \xB7",
|
|
45818
46300
|
" ",
|
|
45819
|
-
/* @__PURE__ */ (0,
|
|
46301
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "red", children: "[N]" }),
|
|
45820
46302
|
" deny"
|
|
45821
46303
|
] })
|
|
45822
46304
|
] }),
|
|
45823
|
-
notes.length > 0 && /* @__PURE__ */ (0,
|
|
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: [
|
|
45824
46306
|
n2.kind === "error" ? "\u2717 " : "\xB7 ",
|
|
45825
46307
|
n2.text
|
|
45826
46308
|
] }, i2)) }),
|
|
45827
|
-
overlay && /* @__PURE__ */ (0,
|
|
46309
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box_default, { marginBottom: 1, flexDirection: "column", children: [
|
|
45828
46310
|
overlay,
|
|
45829
|
-
/* @__PURE__ */ (0,
|
|
46311
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { color: "gray", children: "(press Enter or Esc to dismiss)" })
|
|
45830
46312
|
] }),
|
|
45831
|
-
completion && completion.items.length > 0 && /* @__PURE__ */ (0,
|
|
45832
|
-
voiceMode && /* @__PURE__ */ (0,
|
|
45833
|
-
/* @__PURE__ */ (0,
|
|
45834
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
45835
46317
|
] }),
|
|
45836
|
-
toast && /* @__PURE__ */ (0,
|
|
45837
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
45838
46320
|
PromptInput,
|
|
45839
46321
|
{
|
|
45840
46322
|
value: input,
|
|
45841
46323
|
onChange: setInput,
|
|
45842
46324
|
onSubmit: submit,
|
|
45843
|
-
disabled: busy || Boolean(permissionReq) || Boolean(modelPicker) || filePicker,
|
|
46325
|
+
disabled: busy || Boolean(permissionReq) || Boolean(modelPicker) || Boolean(effortPicker) || filePicker,
|
|
45844
46326
|
placeholder: busy ? "" : void 0,
|
|
45845
46327
|
vimMode: vimEnabledRef.current ? vimRef.current.mode : null,
|
|
45846
46328
|
vimCmdline: vimEnabledRef.current ? vimRef.current.cmdline : null,
|
|
45847
46329
|
accentColor,
|
|
45848
|
-
|
|
45849
|
-
mood,
|
|
46330
|
+
summary: lastSummary,
|
|
45850
46331
|
themeColors: theme
|
|
45851
46332
|
},
|
|
45852
46333
|
`pi-${vimTick}`
|
|
45853
46334
|
),
|
|
45854
|
-
isHome ? /* @__PURE__ */ (0,
|
|
45855
|
-
/* @__PURE__ */ (0,
|
|
45856
|
-
/* @__PURE__ */ (0,
|
|
45857
|
-
/* @__PURE__ */ (0,
|
|
45858
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
45859
46340
|
] }),
|
|
45860
|
-
/* @__PURE__ */ (0,
|
|
45861
|
-
/* @__PURE__ */ (0,
|
|
45862
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
45863
46344
|
] }),
|
|
45864
|
-
/* @__PURE__ */ (0,
|
|
45865
|
-
/* @__PURE__ */ (0,
|
|
45866
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
45867
46348
|
] })
|
|
45868
46349
|
] }),
|
|
45869
|
-
/* @__PURE__ */ (0,
|
|
45870
|
-
/* @__PURE__ */ (0,
|
|
45871
|
-
/* @__PURE__ */ (0,
|
|
45872
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
45873
46354
|
] }),
|
|
45874
|
-
/* @__PURE__ */ (0,
|
|
45875
|
-
/* @__PURE__ */ (0,
|
|
45876
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
45877
46358
|
] }),
|
|
45878
|
-
/* @__PURE__ */ (0,
|
|
45879
|
-
/* @__PURE__ */ (0,
|
|
45880
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
45881
46362
|
] })
|
|
45882
46363
|
] }),
|
|
45883
|
-
/* @__PURE__ */ (0,
|
|
45884
|
-
/* @__PURE__ */ (0,
|
|
45885
|
-
/* @__PURE__ */ (0,
|
|
45886
|
-
/* @__PURE__ */ (0,
|
|
45887
|
-
/* @__PURE__ */ (0,
|
|
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." })
|
|
45888
46369
|
] })
|
|
45889
|
-
] }) : /* @__PURE__ */ (0,
|
|
45890
|
-
/* @__PURE__ */ (0,
|
|
45891
|
-
/* @__PURE__ */ (0,
|
|
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 }) })
|
|
45892
46373
|
] })
|
|
45893
46374
|
] });
|
|
45894
46375
|
};
|
|
@@ -45901,19 +46382,19 @@ init_errors();
|
|
|
45901
46382
|
init_logger();
|
|
45902
46383
|
|
|
45903
46384
|
// src/utils/fingerprint.ts
|
|
45904
|
-
import { readFileSync as readFileSync13, writeFileSync as writeFileSync7, existsSync as
|
|
45905
|
-
import { dirname as dirname16, join as
|
|
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";
|
|
45906
46387
|
import { homedir as homedir10 } from "node:os";
|
|
45907
46388
|
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
45908
46389
|
import os6 from "node:os";
|
|
45909
|
-
var FP_PATH =
|
|
46390
|
+
var FP_PATH = join31(homedir10(), ".kryven", ".fingerprint");
|
|
45910
46391
|
function readMachineId() {
|
|
45911
46392
|
try {
|
|
45912
|
-
if (
|
|
46393
|
+
if (existsSync21("/etc/machine-id")) return readFileSync13("/etc/machine-id", "utf8").trim();
|
|
45913
46394
|
} catch {
|
|
45914
46395
|
}
|
|
45915
46396
|
try {
|
|
45916
|
-
if (
|
|
46397
|
+
if (existsSync21("/var/lib/dbus/machine-id")) return readFileSync13("/var/lib/dbus/machine-id", "utf8").trim();
|
|
45917
46398
|
} catch {
|
|
45918
46399
|
}
|
|
45919
46400
|
return "";
|
|
@@ -45941,7 +46422,7 @@ function getFingerprint(opts = {}) {
|
|
|
45941
46422
|
return createHash3("sha256").update(randomBytes(32)).digest("hex");
|
|
45942
46423
|
}
|
|
45943
46424
|
if (cached) return cached;
|
|
45944
|
-
if (
|
|
46425
|
+
if (existsSync21(FP_PATH)) {
|
|
45945
46426
|
try {
|
|
45946
46427
|
const v = readFileSync13(FP_PATH, "utf8").trim();
|
|
45947
46428
|
if (/^[a-f0-9]{32,128}$/i.test(v)) {
|
|
@@ -46033,11 +46514,11 @@ init_tools();
|
|
|
46033
46514
|
// src/commands-palette/file-commands.ts
|
|
46034
46515
|
init_logger();
|
|
46035
46516
|
import { readdir as readdir10, readFile as readFile16 } from "node:fs/promises";
|
|
46036
|
-
import { existsSync as
|
|
46037
|
-
import { join as
|
|
46517
|
+
import { existsSync as existsSync22 } from "node:fs";
|
|
46518
|
+
import { join as join32, isAbsolute as isAbsolute12, resolve as resolve6 } from "node:path";
|
|
46038
46519
|
import { homedir as homedir11 } from "node:os";
|
|
46039
46520
|
async function readDirCommands(dir, scope) {
|
|
46040
|
-
if (!
|
|
46521
|
+
if (!existsSync22(dir)) return [];
|
|
46041
46522
|
const out = [];
|
|
46042
46523
|
let entries;
|
|
46043
46524
|
try {
|
|
@@ -46047,7 +46528,7 @@ async function readDirCommands(dir, scope) {
|
|
|
46047
46528
|
}
|
|
46048
46529
|
for (const e of entries) {
|
|
46049
46530
|
if (!e.isFile() || !e.name.endsWith(".md")) continue;
|
|
46050
|
-
const file =
|
|
46531
|
+
const file = join32(dir, e.name);
|
|
46051
46532
|
try {
|
|
46052
46533
|
const src = await readFile16(file, "utf8");
|
|
46053
46534
|
const { frontmatter, body } = parseSkillFile(file, src);
|
|
@@ -46068,10 +46549,10 @@ async function readDirCommands(dir, scope) {
|
|
|
46068
46549
|
async function loadFileCommands(cwd2) {
|
|
46069
46550
|
const root = isAbsolute12(cwd2 || "") ? cwd2 : cwd2 ? resolve6(cwd2) : process.cwd();
|
|
46070
46551
|
const sources = [
|
|
46071
|
-
[
|
|
46072
|
-
[
|
|
46073
|
-
[
|
|
46074
|
-
[
|
|
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"]
|
|
46075
46556
|
];
|
|
46076
46557
|
const seen = /* @__PURE__ */ new Map();
|
|
46077
46558
|
for (const [dir, scope] of sources) {
|
|
@@ -46103,11 +46584,11 @@ ${c3.body}${argText}`.trim(),
|
|
|
46103
46584
|
init_logger();
|
|
46104
46585
|
init_defaults();
|
|
46105
46586
|
import { readFile as readFile17 } from "node:fs/promises";
|
|
46106
|
-
import { existsSync as
|
|
46107
|
-
import { join as
|
|
46108
|
-
var MCP_CONFIG_PATH =
|
|
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");
|
|
46109
46590
|
async function loadMCPRegistry() {
|
|
46110
|
-
if (!
|
|
46591
|
+
if (!existsSync23(MCP_CONFIG_PATH)) return { servers: [] };
|
|
46111
46592
|
try {
|
|
46112
46593
|
const raw = await readFile17(MCP_CONFIG_PATH, "utf8");
|
|
46113
46594
|
const parsed = JSON.parse(raw);
|
|
@@ -46159,7 +46640,7 @@ init_client();
|
|
|
46159
46640
|
init_crypto();
|
|
46160
46641
|
init_errors();
|
|
46161
46642
|
init_load();
|
|
46162
|
-
var
|
|
46643
|
+
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
|
|
46163
46644
|
import { dirname as dirname17 } from "node:path";
|
|
46164
46645
|
import { spawn as spawn10 } from "node:child_process";
|
|
46165
46646
|
var OPTIONS = [
|
|
@@ -46221,7 +46702,7 @@ var SetupWizard = ({
|
|
|
46221
46702
|
apiKey: k,
|
|
46222
46703
|
baseUrl,
|
|
46223
46704
|
clientType: "ide",
|
|
46224
|
-
userAgent: `kryven-cli/${"0.2.
|
|
46705
|
+
userAgent: `kryven-cli/${"0.2.7"}`
|
|
46225
46706
|
}).ping();
|
|
46226
46707
|
onDone({ mode: "key", key: k });
|
|
46227
46708
|
} catch (err) {
|
|
@@ -46230,8 +46711,8 @@ var SetupWizard = ({
|
|
|
46230
46711
|
}
|
|
46231
46712
|
})();
|
|
46232
46713
|
};
|
|
46233
|
-
return /* @__PURE__ */ (0,
|
|
46234
|
-
/* @__PURE__ */ (0,
|
|
46714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
46715
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
46235
46716
|
Box_default,
|
|
46236
46717
|
{
|
|
46237
46718
|
flexDirection: "column",
|
|
@@ -46240,18 +46721,18 @@ var SetupWizard = ({
|
|
|
46240
46721
|
paddingX: 2,
|
|
46241
46722
|
marginBottom: 1,
|
|
46242
46723
|
children: [
|
|
46243
|
-
/* @__PURE__ */ (0,
|
|
46244
|
-
/* @__PURE__ */ (0,
|
|
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." })
|
|
46245
46726
|
]
|
|
46246
46727
|
}
|
|
46247
46728
|
),
|
|
46248
|
-
step === "choose" && /* @__PURE__ */ (0,
|
|
46249
|
-
/* @__PURE__ */ (0,
|
|
46250
|
-
/* @__PURE__ */ (0,
|
|
46251
|
-
/* @__PURE__ */ (0,
|
|
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) => {
|
|
46252
46733
|
const on6 = i2 === sel;
|
|
46253
|
-
return /* @__PURE__ */ (0,
|
|
46254
|
-
/* @__PURE__ */ (0,
|
|
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: [
|
|
46255
46736
|
on6 ? "(\u25CF)" : "(\u25CB)",
|
|
46256
46737
|
" ",
|
|
46257
46738
|
i2 + 1,
|
|
@@ -46259,20 +46740,20 @@ var SetupWizard = ({
|
|
|
46259
46740
|
o2.title,
|
|
46260
46741
|
o2.id === "guest" ? " (recommended)" : ""
|
|
46261
46742
|
] }),
|
|
46262
|
-
/* @__PURE__ */ (0,
|
|
46743
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Text, { color: "gray", children: [
|
|
46263
46744
|
" ",
|
|
46264
46745
|
o2.desc
|
|
46265
46746
|
] })
|
|
46266
46747
|
] }, o2.id);
|
|
46267
46748
|
}) }),
|
|
46268
|
-
error && /* @__PURE__ */ (0,
|
|
46749
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { color: "red", children: error })
|
|
46269
46750
|
] }),
|
|
46270
|
-
step === "enter-key" && /* @__PURE__ */ (0,
|
|
46271
|
-
/* @__PURE__ */ (0,
|
|
46272
|
-
/* @__PURE__ */ (0,
|
|
46273
|
-
/* @__PURE__ */ (0,
|
|
46274
|
-
/* @__PURE__ */ (0,
|
|
46275
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
46276
46757
|
build_default,
|
|
46277
46758
|
{
|
|
46278
46759
|
value: keyVal,
|
|
@@ -46283,10 +46764,10 @@ var SetupWizard = ({
|
|
|
46283
46764
|
}
|
|
46284
46765
|
)
|
|
46285
46766
|
] }),
|
|
46286
|
-
/* @__PURE__ */ (0,
|
|
46287
|
-
error && /* @__PURE__ */ (0,
|
|
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 })
|
|
46288
46769
|
] }),
|
|
46289
|
-
step === "validating" && /* @__PURE__ */ (0,
|
|
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" }) })
|
|
46290
46771
|
] });
|
|
46291
46772
|
};
|
|
46292
46773
|
function openBrowser(url) {
|
|
@@ -46304,7 +46785,7 @@ function openBrowser(url) {
|
|
|
46304
46785
|
function runSetupWizard(baseUrl) {
|
|
46305
46786
|
return new Promise((resolve7) => {
|
|
46306
46787
|
const instance = render_default(
|
|
46307
|
-
/* @__PURE__ */ (0,
|
|
46788
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
46308
46789
|
SetupWizard,
|
|
46309
46790
|
{
|
|
46310
46791
|
baseUrl,
|
|
@@ -46355,7 +46836,7 @@ async function chatCommand(opts = {}) {
|
|
|
46355
46836
|
client = new GuestKryvenClient({
|
|
46356
46837
|
baseUrl: cfg.apiBaseUrl,
|
|
46357
46838
|
shareFingerprint: cfg.shareFingerprint !== false,
|
|
46358
|
-
userAgent: `kryven-cli/${"0.2.
|
|
46839
|
+
userAgent: `kryven-cli/${"0.2.7"}`
|
|
46359
46840
|
});
|
|
46360
46841
|
console.log(source_default.cyan("Guest mode \u2014 3 free prompts. Run `kryven login` for unlimited chat."));
|
|
46361
46842
|
} else {
|
|
@@ -46363,7 +46844,7 @@ async function chatCommand(opts = {}) {
|
|
|
46363
46844
|
apiKey: cfg.apiKey,
|
|
46364
46845
|
baseUrl: cfg.apiBaseUrl,
|
|
46365
46846
|
clientType: "ide",
|
|
46366
|
-
userAgent: `kryven-cli/${"0.2.
|
|
46847
|
+
userAgent: `kryven-cli/${"0.2.7"}`
|
|
46367
46848
|
});
|
|
46368
46849
|
}
|
|
46369
46850
|
let resumeMessages;
|
|
@@ -46451,7 +46932,7 @@ async function chatCommand(opts = {}) {
|
|
|
46451
46932
|
init_execa();
|
|
46452
46933
|
|
|
46453
46934
|
// src/shims/version.ts
|
|
46454
|
-
var KRYVEN_VERSION = "0.2.
|
|
46935
|
+
var KRYVEN_VERSION = "0.2.7";
|
|
46455
46936
|
|
|
46456
46937
|
// src/commands/update.ts
|
|
46457
46938
|
var PACKAGE2 = "@kryvenaiofficial/kryven";
|
|
@@ -46481,8 +46962,8 @@ On macOS/Linux a global install may need sudo:
|
|
|
46481
46962
|
|
|
46482
46963
|
// src/commands/skills.ts
|
|
46483
46964
|
import { writeFile as writeFile11, mkdir as mkdir13 } from "node:fs/promises";
|
|
46484
|
-
import { existsSync as
|
|
46485
|
-
import { join as
|
|
46965
|
+
import { existsSync as existsSync24 } from "node:fs";
|
|
46966
|
+
import { join as join34 } from "node:path";
|
|
46486
46967
|
import { homedir as homedir12 } from "node:os";
|
|
46487
46968
|
import { spawn as spawn11 } from "node:child_process";
|
|
46488
46969
|
var SCOPE_LABEL3 = {
|
|
@@ -46582,13 +47063,13 @@ async function skillsCreate(name) {
|
|
|
46582
47063
|
process.exit(2);
|
|
46583
47064
|
}
|
|
46584
47065
|
const safe = name.replace(/[^a-zA-Z0-9._-]/g, "-").toLowerCase();
|
|
46585
|
-
const dir =
|
|
46586
|
-
if (
|
|
47066
|
+
const dir = join34(homedir12(), ".kryven", "skills", safe);
|
|
47067
|
+
if (existsSync24(dir)) {
|
|
46587
47068
|
console.error(source_default.red(`Already exists at ${dir}.`));
|
|
46588
47069
|
process.exit(1);
|
|
46589
47070
|
}
|
|
46590
47071
|
await mkdir13(dir, { recursive: true, mode: 448 });
|
|
46591
|
-
const file =
|
|
47072
|
+
const file = join34(dir, "SKILL.md");
|
|
46592
47073
|
await writeFile11(file, SKELETON_SKILL_MD.replace(/NAME_PLACEHOLDER/g, safe), { mode: 384 });
|
|
46593
47074
|
console.log(source_default.green(`Created ${file}`));
|
|
46594
47075
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
@@ -46627,7 +47108,7 @@ async function skillsUpdate(name) {
|
|
|
46627
47108
|
}
|
|
46628
47109
|
for (const s of targets) {
|
|
46629
47110
|
const dir = s.sourcePath.replace(/\/SKILL\.md$/, "");
|
|
46630
|
-
if (!
|
|
47111
|
+
if (!existsSync24(join34(dir, ".git"))) {
|
|
46631
47112
|
console.log(source_default.dim(`Skipping ${s.name} (not a git checkout).`));
|
|
46632
47113
|
continue;
|
|
46633
47114
|
}
|
|
@@ -46832,7 +47313,7 @@ async function main(argv2) {
|
|
|
46832
47313
|
var argv = process.argv.slice(2);
|
|
46833
47314
|
var first = argv[0];
|
|
46834
47315
|
if (first === "--version" || first === "-v" || first === "-V") {
|
|
46835
|
-
const v = "0.2.
|
|
47316
|
+
const v = "0.2.7";
|
|
46836
47317
|
process.stdout.write(v + "\n");
|
|
46837
47318
|
process.exit(0);
|
|
46838
47319
|
}
|