@letta-ai/letta-code 0.29.13 → 0.30.1
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/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/schedules.js +189 -0
- package/dist/schedules.js.map +10 -0
- package/dist/types/cron/scheduled-task-prompt.d.ts +35 -0
- package/dist/types/cron/scheduled-task-prompt.d.ts.map +1 -0
- package/dist/types/schedules.d.ts +8 -0
- package/dist/types/schedules.d.ts.map +1 -0
- package/dist/types/types/protocol_v2.d.ts +12 -0
- package/dist/types/types/protocol_v2.d.ts.map +1 -1
- package/letta.js +839 -580
- package/package.json +14 -1
- package/scripts/source-file-size-baseline.json +3 -3
package/letta.js
CHANGED
|
@@ -5462,7 +5462,7 @@ var package_default;
|
|
|
5462
5462
|
var init_package = __esm(() => {
|
|
5463
5463
|
package_default = {
|
|
5464
5464
|
name: "@letta-ai/letta-code",
|
|
5465
|
-
version: "0.
|
|
5465
|
+
version: "0.30.1",
|
|
5466
5466
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
5467
5467
|
type: "module",
|
|
5468
5468
|
packageManager: "bun@1.3.0",
|
|
@@ -5488,6 +5488,8 @@ var init_package = __esm(() => {
|
|
|
5488
5488
|
"dist/mcp-client.js.map",
|
|
5489
5489
|
"dist/agent-presets.js",
|
|
5490
5490
|
"dist/agent-presets.js.map",
|
|
5491
|
+
"dist/schedules.js",
|
|
5492
|
+
"dist/schedules.js.map",
|
|
5491
5493
|
"dist/channels-public.js",
|
|
5492
5494
|
"dist/channels-public.js.map",
|
|
5493
5495
|
"dist/channels-slack.js",
|
|
@@ -5532,6 +5534,12 @@ var init_package = __esm(() => {
|
|
|
5532
5534
|
import: "./dist/agent-presets.js",
|
|
5533
5535
|
default: "./dist/agent-presets.js"
|
|
5534
5536
|
},
|
|
5537
|
+
"./schedules": {
|
|
5538
|
+
types: "./dist/types/schedules.d.ts",
|
|
5539
|
+
browser: "./dist/schedules.js",
|
|
5540
|
+
import: "./dist/schedules.js",
|
|
5541
|
+
default: "./dist/schedules.js"
|
|
5542
|
+
},
|
|
5535
5543
|
"./channels": {
|
|
5536
5544
|
types: "./dist/types/channels-public.d.ts",
|
|
5537
5545
|
browser: "./dist/channels-public.js",
|
|
@@ -5563,6 +5571,7 @@ var init_package = __esm(() => {
|
|
|
5563
5571
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
5564
5572
|
"@pierre/diffs": "1.2.2",
|
|
5565
5573
|
"@scarf/scarf": "^1.4.0",
|
|
5574
|
+
"cross-spawn": "^7.0.6",
|
|
5566
5575
|
"cron-parser": "^5.6.1",
|
|
5567
5576
|
glob: "^13.0.0",
|
|
5568
5577
|
"ink-link": "^5.0.0",
|
|
@@ -5581,6 +5590,7 @@ var init_package = __esm(() => {
|
|
|
5581
5590
|
"@modelcontextprotocol/server-everything": "^2026.7.4",
|
|
5582
5591
|
"@slack/bolt": "^4.7.0",
|
|
5583
5592
|
"@types/bun": "^1.3.7",
|
|
5593
|
+
"@types/cross-spawn": "^6.0.6",
|
|
5584
5594
|
"@types/diff": "^8.0.0",
|
|
5585
5595
|
"@types/picomatch": "^4.0.2",
|
|
5586
5596
|
"@types/react": "^19.2.9",
|
|
@@ -5632,6 +5642,9 @@ var init_package = __esm(() => {
|
|
|
5632
5642
|
"agent-presets": [
|
|
5633
5643
|
"./dist/types/agent-presets.d.ts"
|
|
5634
5644
|
],
|
|
5645
|
+
schedules: [
|
|
5646
|
+
"./dist/types/schedules.d.ts"
|
|
5647
|
+
],
|
|
5635
5648
|
"app-server-protocol": [
|
|
5636
5649
|
"./dist/types/types/app-server-protocol.d.ts"
|
|
5637
5650
|
],
|
|
@@ -147033,6 +147046,487 @@ var init_auto_update = __esm(() => {
|
|
|
147033
147046
|
VALID_PACKAGE_MANAGERS = new Set(Object.keys(INSTALL_ARG_PREFIX));
|
|
147034
147047
|
});
|
|
147035
147048
|
|
|
147049
|
+
// node_modules/isexe/windows.js
|
|
147050
|
+
var require_windows = __commonJS((exports, module3) => {
|
|
147051
|
+
module3.exports = isexe;
|
|
147052
|
+
isexe.sync = sync;
|
|
147053
|
+
var fs3 = __require("fs");
|
|
147054
|
+
function checkPathExt(path5, options3) {
|
|
147055
|
+
var pathext = options3.pathExt !== undefined ? options3.pathExt : process.env.PATHEXT;
|
|
147056
|
+
if (!pathext) {
|
|
147057
|
+
return true;
|
|
147058
|
+
}
|
|
147059
|
+
pathext = pathext.split(";");
|
|
147060
|
+
if (pathext.indexOf("") !== -1) {
|
|
147061
|
+
return true;
|
|
147062
|
+
}
|
|
147063
|
+
for (var i2 = 0;i2 < pathext.length; i2++) {
|
|
147064
|
+
var p = pathext[i2].toLowerCase();
|
|
147065
|
+
if (p && path5.substr(-p.length).toLowerCase() === p) {
|
|
147066
|
+
return true;
|
|
147067
|
+
}
|
|
147068
|
+
}
|
|
147069
|
+
return false;
|
|
147070
|
+
}
|
|
147071
|
+
function checkStat(stat3, path5, options3) {
|
|
147072
|
+
if (!stat3.isSymbolicLink() && !stat3.isFile()) {
|
|
147073
|
+
return false;
|
|
147074
|
+
}
|
|
147075
|
+
return checkPathExt(path5, options3);
|
|
147076
|
+
}
|
|
147077
|
+
function isexe(path5, options3, cb) {
|
|
147078
|
+
fs3.stat(path5, function(er, stat3) {
|
|
147079
|
+
cb(er, er ? false : checkStat(stat3, path5, options3));
|
|
147080
|
+
});
|
|
147081
|
+
}
|
|
147082
|
+
function sync(path5, options3) {
|
|
147083
|
+
return checkStat(fs3.statSync(path5), path5, options3);
|
|
147084
|
+
}
|
|
147085
|
+
});
|
|
147086
|
+
|
|
147087
|
+
// node_modules/isexe/mode.js
|
|
147088
|
+
var require_mode = __commonJS((exports, module3) => {
|
|
147089
|
+
module3.exports = isexe;
|
|
147090
|
+
isexe.sync = sync;
|
|
147091
|
+
var fs3 = __require("fs");
|
|
147092
|
+
function isexe(path5, options3, cb) {
|
|
147093
|
+
fs3.stat(path5, function(er, stat3) {
|
|
147094
|
+
cb(er, er ? false : checkStat(stat3, options3));
|
|
147095
|
+
});
|
|
147096
|
+
}
|
|
147097
|
+
function sync(path5, options3) {
|
|
147098
|
+
return checkStat(fs3.statSync(path5), options3);
|
|
147099
|
+
}
|
|
147100
|
+
function checkStat(stat3, options3) {
|
|
147101
|
+
return stat3.isFile() && checkMode(stat3, options3);
|
|
147102
|
+
}
|
|
147103
|
+
function checkMode(stat3, options3) {
|
|
147104
|
+
var mod = stat3.mode;
|
|
147105
|
+
var uid = stat3.uid;
|
|
147106
|
+
var gid = stat3.gid;
|
|
147107
|
+
var myUid = options3.uid !== undefined ? options3.uid : process.getuid && process.getuid();
|
|
147108
|
+
var myGid = options3.gid !== undefined ? options3.gid : process.getgid && process.getgid();
|
|
147109
|
+
var u = parseInt("100", 8);
|
|
147110
|
+
var g = parseInt("010", 8);
|
|
147111
|
+
var o = parseInt("001", 8);
|
|
147112
|
+
var ug = u | g;
|
|
147113
|
+
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
147114
|
+
return ret;
|
|
147115
|
+
}
|
|
147116
|
+
});
|
|
147117
|
+
|
|
147118
|
+
// node_modules/isexe/index.js
|
|
147119
|
+
var require_isexe = __commonJS((exports, module3) => {
|
|
147120
|
+
var fs3 = __require("fs");
|
|
147121
|
+
var core2;
|
|
147122
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
147123
|
+
core2 = require_windows();
|
|
147124
|
+
} else {
|
|
147125
|
+
core2 = require_mode();
|
|
147126
|
+
}
|
|
147127
|
+
module3.exports = isexe;
|
|
147128
|
+
isexe.sync = sync;
|
|
147129
|
+
function isexe(path5, options3, cb) {
|
|
147130
|
+
if (typeof options3 === "function") {
|
|
147131
|
+
cb = options3;
|
|
147132
|
+
options3 = {};
|
|
147133
|
+
}
|
|
147134
|
+
if (!cb) {
|
|
147135
|
+
if (typeof Promise !== "function") {
|
|
147136
|
+
throw new TypeError("callback not provided");
|
|
147137
|
+
}
|
|
147138
|
+
return new Promise(function(resolve3, reject) {
|
|
147139
|
+
isexe(path5, options3 || {}, function(er, is) {
|
|
147140
|
+
if (er) {
|
|
147141
|
+
reject(er);
|
|
147142
|
+
} else {
|
|
147143
|
+
resolve3(is);
|
|
147144
|
+
}
|
|
147145
|
+
});
|
|
147146
|
+
});
|
|
147147
|
+
}
|
|
147148
|
+
core2(path5, options3 || {}, function(er, is) {
|
|
147149
|
+
if (er) {
|
|
147150
|
+
if (er.code === "EACCES" || options3 && options3.ignoreErrors) {
|
|
147151
|
+
er = null;
|
|
147152
|
+
is = false;
|
|
147153
|
+
}
|
|
147154
|
+
}
|
|
147155
|
+
cb(er, is);
|
|
147156
|
+
});
|
|
147157
|
+
}
|
|
147158
|
+
function sync(path5, options3) {
|
|
147159
|
+
try {
|
|
147160
|
+
return core2.sync(path5, options3 || {});
|
|
147161
|
+
} catch (er) {
|
|
147162
|
+
if (options3 && options3.ignoreErrors || er.code === "EACCES") {
|
|
147163
|
+
return false;
|
|
147164
|
+
} else {
|
|
147165
|
+
throw er;
|
|
147166
|
+
}
|
|
147167
|
+
}
|
|
147168
|
+
}
|
|
147169
|
+
});
|
|
147170
|
+
|
|
147171
|
+
// node_modules/which/which.js
|
|
147172
|
+
var require_which = __commonJS((exports, module3) => {
|
|
147173
|
+
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
147174
|
+
var path5 = __require("path");
|
|
147175
|
+
var COLON2 = isWindows ? ";" : ":";
|
|
147176
|
+
var isexe = require_isexe();
|
|
147177
|
+
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
147178
|
+
var getPathInfo = (cmd, opt) => {
|
|
147179
|
+
const colon = opt.colon || COLON2;
|
|
147180
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
147181
|
+
...isWindows ? [process.cwd()] : [],
|
|
147182
|
+
...(opt.path || process.env.PATH || "").split(colon)
|
|
147183
|
+
];
|
|
147184
|
+
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
147185
|
+
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
147186
|
+
if (isWindows) {
|
|
147187
|
+
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
147188
|
+
pathExt.unshift("");
|
|
147189
|
+
}
|
|
147190
|
+
return {
|
|
147191
|
+
pathEnv,
|
|
147192
|
+
pathExt,
|
|
147193
|
+
pathExtExe
|
|
147194
|
+
};
|
|
147195
|
+
};
|
|
147196
|
+
var which = (cmd, opt, cb) => {
|
|
147197
|
+
if (typeof opt === "function") {
|
|
147198
|
+
cb = opt;
|
|
147199
|
+
opt = {};
|
|
147200
|
+
}
|
|
147201
|
+
if (!opt)
|
|
147202
|
+
opt = {};
|
|
147203
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
147204
|
+
const found = [];
|
|
147205
|
+
const step = (i2) => new Promise((resolve3, reject) => {
|
|
147206
|
+
if (i2 === pathEnv.length)
|
|
147207
|
+
return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
|
|
147208
|
+
const ppRaw = pathEnv[i2];
|
|
147209
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
147210
|
+
const pCmd = path5.join(pathPart, cmd);
|
|
147211
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
147212
|
+
resolve3(subStep(p, i2, 0));
|
|
147213
|
+
});
|
|
147214
|
+
const subStep = (p, i2, ii) => new Promise((resolve3, reject) => {
|
|
147215
|
+
if (ii === pathExt.length)
|
|
147216
|
+
return resolve3(step(i2 + 1));
|
|
147217
|
+
const ext = pathExt[ii];
|
|
147218
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
147219
|
+
if (!er && is) {
|
|
147220
|
+
if (opt.all)
|
|
147221
|
+
found.push(p + ext);
|
|
147222
|
+
else
|
|
147223
|
+
return resolve3(p + ext);
|
|
147224
|
+
}
|
|
147225
|
+
return resolve3(subStep(p, i2, ii + 1));
|
|
147226
|
+
});
|
|
147227
|
+
});
|
|
147228
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
147229
|
+
};
|
|
147230
|
+
var whichSync = (cmd, opt) => {
|
|
147231
|
+
opt = opt || {};
|
|
147232
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
147233
|
+
const found = [];
|
|
147234
|
+
for (let i2 = 0;i2 < pathEnv.length; i2++) {
|
|
147235
|
+
const ppRaw = pathEnv[i2];
|
|
147236
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
147237
|
+
const pCmd = path5.join(pathPart, cmd);
|
|
147238
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
147239
|
+
for (let j = 0;j < pathExt.length; j++) {
|
|
147240
|
+
const cur = p + pathExt[j];
|
|
147241
|
+
try {
|
|
147242
|
+
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
147243
|
+
if (is) {
|
|
147244
|
+
if (opt.all)
|
|
147245
|
+
found.push(cur);
|
|
147246
|
+
else
|
|
147247
|
+
return cur;
|
|
147248
|
+
}
|
|
147249
|
+
} catch (ex) {}
|
|
147250
|
+
}
|
|
147251
|
+
}
|
|
147252
|
+
if (opt.all && found.length)
|
|
147253
|
+
return found;
|
|
147254
|
+
if (opt.nothrow)
|
|
147255
|
+
return null;
|
|
147256
|
+
throw getNotFoundError(cmd);
|
|
147257
|
+
};
|
|
147258
|
+
module3.exports = which;
|
|
147259
|
+
which.sync = whichSync;
|
|
147260
|
+
});
|
|
147261
|
+
|
|
147262
|
+
// node_modules/path-key/index.js
|
|
147263
|
+
var require_path_key = __commonJS((exports, module3) => {
|
|
147264
|
+
var pathKey = (options3 = {}) => {
|
|
147265
|
+
const environment2 = options3.env || process.env;
|
|
147266
|
+
const platform = options3.platform || process.platform;
|
|
147267
|
+
if (platform !== "win32") {
|
|
147268
|
+
return "PATH";
|
|
147269
|
+
}
|
|
147270
|
+
return Object.keys(environment2).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
147271
|
+
};
|
|
147272
|
+
module3.exports = pathKey;
|
|
147273
|
+
module3.exports.default = pathKey;
|
|
147274
|
+
});
|
|
147275
|
+
|
|
147276
|
+
// node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
147277
|
+
var require_resolveCommand = __commonJS((exports, module3) => {
|
|
147278
|
+
var path5 = __require("path");
|
|
147279
|
+
var which = require_which();
|
|
147280
|
+
var getPathKey = require_path_key();
|
|
147281
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
147282
|
+
const env3 = parsed.options.env || process.env;
|
|
147283
|
+
const cwd = process.cwd();
|
|
147284
|
+
const hasCustomCwd = parsed.options.cwd != null;
|
|
147285
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
|
|
147286
|
+
if (shouldSwitchCwd) {
|
|
147287
|
+
try {
|
|
147288
|
+
process.chdir(parsed.options.cwd);
|
|
147289
|
+
} catch (err) {}
|
|
147290
|
+
}
|
|
147291
|
+
let resolved;
|
|
147292
|
+
try {
|
|
147293
|
+
resolved = which.sync(parsed.command, {
|
|
147294
|
+
path: env3[getPathKey({ env: env3 })],
|
|
147295
|
+
pathExt: withoutPathExt ? path5.delimiter : undefined
|
|
147296
|
+
});
|
|
147297
|
+
} catch (e2) {} finally {
|
|
147298
|
+
if (shouldSwitchCwd) {
|
|
147299
|
+
process.chdir(cwd);
|
|
147300
|
+
}
|
|
147301
|
+
}
|
|
147302
|
+
if (resolved) {
|
|
147303
|
+
resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
147304
|
+
}
|
|
147305
|
+
return resolved;
|
|
147306
|
+
}
|
|
147307
|
+
function resolveCommand(parsed) {
|
|
147308
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
147309
|
+
}
|
|
147310
|
+
module3.exports = resolveCommand;
|
|
147311
|
+
});
|
|
147312
|
+
|
|
147313
|
+
// node_modules/cross-spawn/lib/util/escape.js
|
|
147314
|
+
var require_escape = __commonJS((exports, module3) => {
|
|
147315
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
147316
|
+
function escapeCommand(arg) {
|
|
147317
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
147318
|
+
return arg;
|
|
147319
|
+
}
|
|
147320
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
147321
|
+
arg = `${arg}`;
|
|
147322
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
147323
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
147324
|
+
arg = `"${arg}"`;
|
|
147325
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
147326
|
+
if (doubleEscapeMetaChars) {
|
|
147327
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
147328
|
+
}
|
|
147329
|
+
return arg;
|
|
147330
|
+
}
|
|
147331
|
+
exports.command = escapeCommand;
|
|
147332
|
+
exports.argument = escapeArgument;
|
|
147333
|
+
});
|
|
147334
|
+
|
|
147335
|
+
// node_modules/shebang-regex/index.js
|
|
147336
|
+
var require_shebang_regex = __commonJS((exports, module3) => {
|
|
147337
|
+
module3.exports = /^#!(.*)/;
|
|
147338
|
+
});
|
|
147339
|
+
|
|
147340
|
+
// node_modules/shebang-command/index.js
|
|
147341
|
+
var require_shebang_command = __commonJS((exports, module3) => {
|
|
147342
|
+
var shebangRegex = require_shebang_regex();
|
|
147343
|
+
module3.exports = (string7 = "") => {
|
|
147344
|
+
const match2 = string7.match(shebangRegex);
|
|
147345
|
+
if (!match2) {
|
|
147346
|
+
return null;
|
|
147347
|
+
}
|
|
147348
|
+
const [path5, argument] = match2[0].replace(/#! ?/, "").split(" ");
|
|
147349
|
+
const binary = path5.split("/").pop();
|
|
147350
|
+
if (binary === "env") {
|
|
147351
|
+
return argument;
|
|
147352
|
+
}
|
|
147353
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
147354
|
+
};
|
|
147355
|
+
});
|
|
147356
|
+
|
|
147357
|
+
// node_modules/cross-spawn/lib/util/readShebang.js
|
|
147358
|
+
var require_readShebang = __commonJS((exports, module3) => {
|
|
147359
|
+
var fs3 = __require("fs");
|
|
147360
|
+
var shebangCommand = require_shebang_command();
|
|
147361
|
+
function readShebang(command) {
|
|
147362
|
+
const size = 150;
|
|
147363
|
+
const buffer = Buffer.alloc(size);
|
|
147364
|
+
let fd;
|
|
147365
|
+
try {
|
|
147366
|
+
fd = fs3.openSync(command, "r");
|
|
147367
|
+
fs3.readSync(fd, buffer, 0, size, 0);
|
|
147368
|
+
fs3.closeSync(fd);
|
|
147369
|
+
} catch (e2) {}
|
|
147370
|
+
return shebangCommand(buffer.toString());
|
|
147371
|
+
}
|
|
147372
|
+
module3.exports = readShebang;
|
|
147373
|
+
});
|
|
147374
|
+
|
|
147375
|
+
// node_modules/cross-spawn/lib/parse.js
|
|
147376
|
+
var require_parse2 = __commonJS((exports, module3) => {
|
|
147377
|
+
var path5 = __require("path");
|
|
147378
|
+
var resolveCommand = require_resolveCommand();
|
|
147379
|
+
var escape2 = require_escape();
|
|
147380
|
+
var readShebang = require_readShebang();
|
|
147381
|
+
var isWin = process.platform === "win32";
|
|
147382
|
+
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
147383
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
147384
|
+
function detectShebang(parsed) {
|
|
147385
|
+
parsed.file = resolveCommand(parsed);
|
|
147386
|
+
const shebang = parsed.file && readShebang(parsed.file);
|
|
147387
|
+
if (shebang) {
|
|
147388
|
+
parsed.args.unshift(parsed.file);
|
|
147389
|
+
parsed.command = shebang;
|
|
147390
|
+
return resolveCommand(parsed);
|
|
147391
|
+
}
|
|
147392
|
+
return parsed.file;
|
|
147393
|
+
}
|
|
147394
|
+
function parseNonShell(parsed) {
|
|
147395
|
+
if (!isWin) {
|
|
147396
|
+
return parsed;
|
|
147397
|
+
}
|
|
147398
|
+
const commandFile = detectShebang(parsed);
|
|
147399
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
147400
|
+
if (parsed.options.forceShell || needsShell) {
|
|
147401
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
147402
|
+
parsed.command = path5.normalize(parsed.command);
|
|
147403
|
+
parsed.command = escape2.command(parsed.command);
|
|
147404
|
+
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
147405
|
+
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
147406
|
+
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
147407
|
+
parsed.command = process.env.comspec || "cmd.exe";
|
|
147408
|
+
parsed.options.windowsVerbatimArguments = true;
|
|
147409
|
+
}
|
|
147410
|
+
return parsed;
|
|
147411
|
+
}
|
|
147412
|
+
function parse8(command, args, options3) {
|
|
147413
|
+
if (args && !Array.isArray(args)) {
|
|
147414
|
+
options3 = args;
|
|
147415
|
+
args = null;
|
|
147416
|
+
}
|
|
147417
|
+
args = args ? args.slice(0) : [];
|
|
147418
|
+
options3 = Object.assign({}, options3);
|
|
147419
|
+
const parsed = {
|
|
147420
|
+
command,
|
|
147421
|
+
args,
|
|
147422
|
+
options: options3,
|
|
147423
|
+
file: undefined,
|
|
147424
|
+
original: {
|
|
147425
|
+
command,
|
|
147426
|
+
args
|
|
147427
|
+
}
|
|
147428
|
+
};
|
|
147429
|
+
return options3.shell ? parsed : parseNonShell(parsed);
|
|
147430
|
+
}
|
|
147431
|
+
module3.exports = parse8;
|
|
147432
|
+
});
|
|
147433
|
+
|
|
147434
|
+
// node_modules/cross-spawn/lib/enoent.js
|
|
147435
|
+
var require_enoent = __commonJS((exports, module3) => {
|
|
147436
|
+
var isWin = process.platform === "win32";
|
|
147437
|
+
function notFoundError(original, syscall) {
|
|
147438
|
+
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
147439
|
+
code: "ENOENT",
|
|
147440
|
+
errno: "ENOENT",
|
|
147441
|
+
syscall: `${syscall} ${original.command}`,
|
|
147442
|
+
path: original.command,
|
|
147443
|
+
spawnargs: original.args
|
|
147444
|
+
});
|
|
147445
|
+
}
|
|
147446
|
+
function hookChildProcess(cp, parsed) {
|
|
147447
|
+
if (!isWin) {
|
|
147448
|
+
return;
|
|
147449
|
+
}
|
|
147450
|
+
const originalEmit = cp.emit;
|
|
147451
|
+
cp.emit = function(name, arg1) {
|
|
147452
|
+
if (name === "exit") {
|
|
147453
|
+
const err = verifyENOENT(arg1, parsed);
|
|
147454
|
+
if (err) {
|
|
147455
|
+
return originalEmit.call(cp, "error", err);
|
|
147456
|
+
}
|
|
147457
|
+
}
|
|
147458
|
+
return originalEmit.apply(cp, arguments);
|
|
147459
|
+
};
|
|
147460
|
+
}
|
|
147461
|
+
function verifyENOENT(status, parsed) {
|
|
147462
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
147463
|
+
return notFoundError(parsed.original, "spawn");
|
|
147464
|
+
}
|
|
147465
|
+
return null;
|
|
147466
|
+
}
|
|
147467
|
+
function verifyENOENTSync(status, parsed) {
|
|
147468
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
147469
|
+
return notFoundError(parsed.original, "spawnSync");
|
|
147470
|
+
}
|
|
147471
|
+
return null;
|
|
147472
|
+
}
|
|
147473
|
+
module3.exports = {
|
|
147474
|
+
hookChildProcess,
|
|
147475
|
+
verifyENOENT,
|
|
147476
|
+
verifyENOENTSync,
|
|
147477
|
+
notFoundError
|
|
147478
|
+
};
|
|
147479
|
+
});
|
|
147480
|
+
|
|
147481
|
+
// node_modules/cross-spawn/index.js
|
|
147482
|
+
var require_cross_spawn = __commonJS((exports, module3) => {
|
|
147483
|
+
var cp = __require("child_process");
|
|
147484
|
+
var parse8 = require_parse2();
|
|
147485
|
+
var enoent = require_enoent();
|
|
147486
|
+
function spawn(command, args, options3) {
|
|
147487
|
+
const parsed = parse8(command, args, options3);
|
|
147488
|
+
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
147489
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
147490
|
+
return spawned;
|
|
147491
|
+
}
|
|
147492
|
+
function spawnSync(command, args, options3) {
|
|
147493
|
+
const parsed = parse8(command, args, options3);
|
|
147494
|
+
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
147495
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
147496
|
+
return result;
|
|
147497
|
+
}
|
|
147498
|
+
module3.exports = spawn;
|
|
147499
|
+
module3.exports.spawn = spawn;
|
|
147500
|
+
module3.exports.sync = spawnSync;
|
|
147501
|
+
module3.exports._parse = parse8;
|
|
147502
|
+
module3.exports._enoent = enoent;
|
|
147503
|
+
});
|
|
147504
|
+
|
|
147505
|
+
// src/utils/package-manager-spawn.ts
|
|
147506
|
+
import {
|
|
147507
|
+
spawn
|
|
147508
|
+
} from "node:child_process";
|
|
147509
|
+
function isWindowsCommandShim(command) {
|
|
147510
|
+
return /\.(?:cmd|bat)$/i.test(command);
|
|
147511
|
+
}
|
|
147512
|
+
function getPackageManagerProcessFactory({
|
|
147513
|
+
nativeSpawn = spawn,
|
|
147514
|
+
platform = process.platform,
|
|
147515
|
+
windowsSpawn = import_cross_spawn.default
|
|
147516
|
+
} = {}) {
|
|
147517
|
+
if (platform !== "win32") {
|
|
147518
|
+
return nativeSpawn;
|
|
147519
|
+
}
|
|
147520
|
+
return (command, args, options3) => {
|
|
147521
|
+
const spawnImpl = isWindowsCommandShim(command) ? windowsSpawn : nativeSpawn;
|
|
147522
|
+
return spawnImpl(command, args, options3);
|
|
147523
|
+
};
|
|
147524
|
+
}
|
|
147525
|
+
var import_cross_spawn;
|
|
147526
|
+
var init_package_manager_spawn = __esm(() => {
|
|
147527
|
+
import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
147528
|
+
});
|
|
147529
|
+
|
|
147036
147530
|
// src/channels/runtime-deps.ts
|
|
147037
147531
|
var exports_runtime_deps = {};
|
|
147038
147532
|
__export(exports_runtime_deps, {
|
|
@@ -147049,7 +147543,6 @@ __export(exports_runtime_deps, {
|
|
|
147049
147543
|
__testOverrideChannelRuntimeDeps: () => __testOverrideChannelRuntimeDeps,
|
|
147050
147544
|
CHANNEL_RUNTIME_ROOT_ENV: () => CHANNEL_RUNTIME_ROOT_ENV
|
|
147051
147545
|
});
|
|
147052
|
-
import { spawn } from "node:child_process";
|
|
147053
147546
|
import { existsSync as existsSync7 } from "node:fs";
|
|
147054
147547
|
import { mkdir as mkdir2, symlink, writeFile as writeFile4 } from "node:fs/promises";
|
|
147055
147548
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -147182,6 +147675,7 @@ async function installChannelRuntime(channelId) {
|
|
|
147182
147675
|
const packageManager = resolveInstallPackageManager();
|
|
147183
147676
|
const command = getPackageManagerExecutable(packageManager);
|
|
147184
147677
|
const args = getInstallArgs(packageManager, spec.runtimePackages);
|
|
147678
|
+
const spawnInstallProcess = spawnInstallProcessOverride ?? getPackageManagerProcessFactory({ platform: resolveInstallPlatform() });
|
|
147185
147679
|
await new Promise((resolve3, reject) => {
|
|
147186
147680
|
const proc = spawnInstallProcess(command, args, {
|
|
147187
147681
|
cwd: getChannelRuntimeDir(channelId),
|
|
@@ -147224,16 +147718,16 @@ async function loadChannelRuntimeModule(channelId, moduleName) {
|
|
|
147224
147718
|
function __testOverrideChannelRuntimeDeps(overrides) {
|
|
147225
147719
|
userRuntimeRootOverride = overrides?.runtimeRoot ?? null;
|
|
147226
147720
|
bundledRuntimeRootOverride = overrides ? overrides.bundledRuntimeRoot ?? null : undefined;
|
|
147227
|
-
|
|
147721
|
+
spawnInstallProcessOverride = overrides?.spawnImpl ?? null;
|
|
147228
147722
|
packageManagerOverride = overrides?.packageManager ?? null;
|
|
147229
147723
|
platformOverride = overrides?.platform ?? null;
|
|
147230
147724
|
}
|
|
147231
|
-
var CHANNEL_RUNTIME_ROOT_ENV = "LETTA_CHANNEL_RUNTIME_ROOT",
|
|
147725
|
+
var CHANNEL_RUNTIME_ROOT_ENV = "LETTA_CHANNEL_RUNTIME_ROOT", spawnInstallProcessOverride = null, userRuntimeRootOverride = null, bundledRuntimeRootOverride, packageManagerOverride = null, platformOverride = null;
|
|
147232
147726
|
var init_runtime_deps = __esm(() => {
|
|
147233
147727
|
init_auto_update();
|
|
147728
|
+
init_package_manager_spawn();
|
|
147234
147729
|
init_config2();
|
|
147235
147730
|
init_plugin_registry();
|
|
147236
|
-
spawnInstallProcess = spawn;
|
|
147237
147731
|
});
|
|
147238
147732
|
|
|
147239
147733
|
// src/channels/telegram/runtime.ts
|
|
@@ -173976,7 +174470,7 @@ var init_channel_turn_session = __esm(() => {
|
|
|
173976
174470
|
});
|
|
173977
174471
|
|
|
173978
174472
|
// src/websocket/listener/constants.ts
|
|
173979
|
-
var MAX_RETRY_DURATION_MS, INITIAL_RETRY_DELAY_MS2 = 1000, MAX_RETRY_DELAY_MS = 30000, LISTENER_HEARTBEAT_INTERVAL_MS = 30000, LISTENER_PONG_TIMEOUT_MS = 90000, SYSTEM_REMINDER_RE, LLM_API_ERROR_MAX_RETRIES = 3, EMPTY_RESPONSE_MAX_RETRIES = 2, MAX_PRE_STREAM_RECOVERY = 2, MAX_POST_STOP_APPROVAL_RECOVERY = 2, PROVIDER_FALLBACK_MAP, PROVIDER_FALLBACK_NOTICE = "Anthropic API error; falling back to Bedrock...";
|
|
174473
|
+
var MAX_RETRY_DURATION_MS, INITIAL_RETRY_DELAY_MS2 = 1000, MAX_RETRY_DELAY_MS = 30000, LISTENER_STREAM_OPEN_TIMEOUT_MS = 30000, LISTENER_HEARTBEAT_INTERVAL_MS = 30000, LISTENER_PONG_TIMEOUT_MS = 90000, SYSTEM_REMINDER_RE, LLM_API_ERROR_MAX_RETRIES = 3, EMPTY_RESPONSE_MAX_RETRIES = 2, MAX_PRE_STREAM_RECOVERY = 2, MAX_POST_STOP_APPROVAL_RECOVERY = 2, PROVIDER_FALLBACK_MAP, PROVIDER_FALLBACK_NOTICE = "Anthropic API error; falling back to Bedrock...";
|
|
173980
174474
|
var init_constants3 = __esm(() => {
|
|
173981
174475
|
MAX_RETRY_DURATION_MS = 5 * 60 * 1000;
|
|
173982
174476
|
SYSTEM_REMINDER_RE = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
|
|
@@ -350930,7 +351424,7 @@ var require_scan = __commonJS((exports, module3) => {
|
|
|
350930
351424
|
});
|
|
350931
351425
|
|
|
350932
351426
|
// node_modules/picomatch/lib/parse.js
|
|
350933
|
-
var
|
|
351427
|
+
var require_parse3 = __commonJS((exports, module3) => {
|
|
350934
351428
|
var constants3 = require_constants();
|
|
350935
351429
|
var utils = require_utils3();
|
|
350936
351430
|
var {
|
|
@@ -351711,7 +352205,7 @@ var require_parse2 = __commonJS((exports, module3) => {
|
|
|
351711
352205
|
var require_picomatch = __commonJS((exports, module3) => {
|
|
351712
352206
|
var path27 = __require("path");
|
|
351713
352207
|
var scan = require_scan();
|
|
351714
|
-
var parse8 =
|
|
352208
|
+
var parse8 = require_parse3();
|
|
351715
352209
|
var utils = require_utils3();
|
|
351716
352210
|
var constants3 = require_constants();
|
|
351717
352211
|
var isObject3 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
@@ -354390,6 +354884,7 @@ var init_client6 = __esm(() => {
|
|
|
354390
354884
|
// src/lsp/servers/python.ts
|
|
354391
354885
|
var PythonServer;
|
|
354392
354886
|
var init_python = __esm(() => {
|
|
354887
|
+
init_package_manager_spawn();
|
|
354393
354888
|
PythonServer = {
|
|
354394
354889
|
id: "python",
|
|
354395
354890
|
extensions: [".py", ".pyi"],
|
|
@@ -354420,11 +354915,12 @@ var init_python = __esm(() => {
|
|
|
354420
354915
|
throw new Error("LSP auto-download is disabled. Please install pyright manually: npm install -g pyright");
|
|
354421
354916
|
}
|
|
354422
354917
|
console.log("[LSP] Installing pyright...");
|
|
354423
|
-
const
|
|
354918
|
+
const platform3 = process.platform;
|
|
354919
|
+
const command = platform3 === "win32" ? "npm.cmd" : "npm";
|
|
354920
|
+
const spawnPackageManager = getPackageManagerProcessFactory({ platform: platform3 });
|
|
354424
354921
|
return new Promise((resolve20, reject) => {
|
|
354425
|
-
const proc =
|
|
354426
|
-
|
|
354427
|
-
});
|
|
354922
|
+
const proc = spawnPackageManager(command, ["install", "-g", "pyright"], { stdio: "inherit" });
|
|
354923
|
+
proc.on("error", reject);
|
|
354428
354924
|
proc.on("exit", (code2) => {
|
|
354429
354925
|
if (code2 === 0) {
|
|
354430
354926
|
console.log("[LSP] Successfully installed pyright");
|
|
@@ -370426,10 +370922,6 @@ async function resolveBaseToolNamesForModel(modelIdentifier, options3) {
|
|
|
370426
370922
|
} else {
|
|
370427
370923
|
baseToolNames = TOOL_NAMES;
|
|
370428
370924
|
}
|
|
370429
|
-
if (options3?.exclude && options3.exclude.length > 0) {
|
|
370430
|
-
const excludeSet = new Set(options3.exclude);
|
|
370431
|
-
baseToolNames = baseToolNames.filter((name) => !excludeSet.has(name));
|
|
370432
|
-
}
|
|
370433
370925
|
if (options3?.include && options3.include.length > 0) {
|
|
370434
370926
|
const seen = new Set(baseToolNames);
|
|
370435
370927
|
for (const name of options3.include) {
|
|
@@ -370439,6 +370931,10 @@ async function resolveBaseToolNamesForModel(modelIdentifier, options3) {
|
|
|
370439
370931
|
}
|
|
370440
370932
|
}
|
|
370441
370933
|
}
|
|
370934
|
+
if (options3?.exclude && options3.exclude.length > 0) {
|
|
370935
|
+
const excludeSet = new Set(options3.exclude);
|
|
370936
|
+
baseToolNames = baseToolNames.filter((name) => !excludeSet.has(name));
|
|
370937
|
+
}
|
|
370442
370938
|
baseToolNames = filterWorktreeTools(baseToolNames);
|
|
370443
370939
|
baseToolNames = resolveArtifactToolNames(baseToolNames);
|
|
370444
370940
|
baseToolNames = maybeAppendChannelTools(baseToolNames, options3?.channelToolScope);
|
|
@@ -371630,6 +372126,28 @@ function appendArtifactToolsIfEnabled(toolNames) {
|
|
|
371630
372126
|
}
|
|
371631
372127
|
return [...withoutArtifactTools, ...ARTIFACT_TOOL_NAMES2];
|
|
371632
372128
|
}
|
|
372129
|
+
function resolveIncludedToolNames(toolNames) {
|
|
372130
|
+
if (!toolNames)
|
|
372131
|
+
return [];
|
|
372132
|
+
return toolNames.map((toolName) => {
|
|
372133
|
+
const internalName = getInternalToolName(toolName);
|
|
372134
|
+
if (!Object.hasOwn(TOOL_DEFINITIONS, internalName)) {
|
|
372135
|
+
throw new Error(`Unknown bundled client tool: ${toolName}`);
|
|
372136
|
+
}
|
|
372137
|
+
return internalName;
|
|
372138
|
+
});
|
|
372139
|
+
}
|
|
372140
|
+
function appendUniqueToolNames(baseToolNames, includedToolNames) {
|
|
372141
|
+
const result = [...baseToolNames];
|
|
372142
|
+
const seen = new Set(result);
|
|
372143
|
+
for (const toolName of includedToolNames) {
|
|
372144
|
+
if (!seen.has(toolName)) {
|
|
372145
|
+
result.push(toolName);
|
|
372146
|
+
seen.add(toolName);
|
|
372147
|
+
}
|
|
372148
|
+
}
|
|
372149
|
+
return result;
|
|
372150
|
+
}
|
|
371633
372151
|
function deriveToolsetFromModel(modelIdentifier, providerType) {
|
|
371634
372152
|
if (providerType === "chatgpt_oauth" || providerType === "openai-codex") {
|
|
371635
372153
|
return "codex";
|
|
@@ -371700,6 +372218,7 @@ async function prepareToolExecutionContextForResolvedTarget(params) {
|
|
|
371700
372218
|
providerType,
|
|
371701
372219
|
conversationId,
|
|
371702
372220
|
toolsetPreference,
|
|
372221
|
+
clientToolset,
|
|
371703
372222
|
exclude: exclude3,
|
|
371704
372223
|
clientToolAllowlist,
|
|
371705
372224
|
externalToolScopeIds,
|
|
@@ -371713,7 +372232,9 @@ async function prepareToolExecutionContextForResolvedTarget(params) {
|
|
|
371713
372232
|
agent: agent2
|
|
371714
372233
|
} = params;
|
|
371715
372234
|
const effectiveModel = modelIdentifier && modelIdentifier.length > 0 ? resolveModel(modelIdentifier) ?? modelIdentifier : null;
|
|
371716
|
-
|
|
372235
|
+
const effectiveToolsetPreference = clientToolset?.base ?? toolsetPreference;
|
|
372236
|
+
const includedToolNames = resolveIncludedToolNames(clientToolset?.include);
|
|
372237
|
+
if (effectiveToolsetPreference === "auto") {
|
|
371717
372238
|
const derivedToolset = effectiveModel ? deriveToolsetFromModel(effectiveModel, providerType) : "default";
|
|
371718
372239
|
const scopedModContext2 = buildModInvocationContext({
|
|
371719
372240
|
agent: agent2,
|
|
@@ -371727,6 +372248,7 @@ async function prepareToolExecutionContextForResolvedTarget(params) {
|
|
|
371727
372248
|
const modCapabilities2 = mergeModAdapterCapabilities(modAdapters, scopedModContext2);
|
|
371728
372249
|
const preparedToolContext2 = await prepareToolExecutionContextForModel(effectiveModel ?? undefined, {
|
|
371729
372250
|
exclude: exclude3,
|
|
372251
|
+
include: includedToolNames,
|
|
371730
372252
|
clientToolAllowlist,
|
|
371731
372253
|
externalToolScopeIds,
|
|
371732
372254
|
workingDirectory,
|
|
@@ -371752,11 +372274,11 @@ async function prepareToolExecutionContextForResolvedTarget(params) {
|
|
|
371752
372274
|
conversationId,
|
|
371753
372275
|
modelIdentifier: effectiveModel,
|
|
371754
372276
|
permissionMode: permissionModeState?.mode ?? runtimeContext?.permissionMode ?? null,
|
|
371755
|
-
toolset:
|
|
372277
|
+
toolset: effectiveToolsetPreference,
|
|
371756
372278
|
workingDirectory
|
|
371757
372279
|
});
|
|
371758
372280
|
const modCapabilities = mergeModAdapterCapabilities(modAdapters, scopedModContext);
|
|
371759
|
-
const preparedToolContext = await prepareToolExecutionContextForSpecificTools(filterBuiltInToolNamesByClientAllowlist(getToolNamesForToolset(
|
|
372281
|
+
const preparedToolContext = await prepareToolExecutionContextForSpecificTools(filterBuiltInToolNamesByClientAllowlist(appendUniqueToolNames(getToolNamesForToolset(effectiveToolsetPreference, channelToolScope), includedToolNames).filter((toolName) => exclude3 ? !exclude3.includes(toolName) : true), clientToolAllowlist), {
|
|
371760
372282
|
clientToolAllowlist,
|
|
371761
372283
|
externalToolScopeIds,
|
|
371762
372284
|
workingDirectory,
|
|
@@ -371770,7 +372292,7 @@ async function prepareToolExecutionContextForResolvedTarget(params) {
|
|
|
371770
372292
|
});
|
|
371771
372293
|
return {
|
|
371772
372294
|
preparedToolContext,
|
|
371773
|
-
toolset:
|
|
372295
|
+
toolset: effectiveToolsetPreference,
|
|
371774
372296
|
toolsetPreference,
|
|
371775
372297
|
effectiveModel,
|
|
371776
372298
|
agent: null
|
|
@@ -371881,6 +372403,7 @@ async function prepareToolExecutionContextForScope(params) {
|
|
|
371881
372403
|
overrideProviderType,
|
|
371882
372404
|
cachedEffectiveModel,
|
|
371883
372405
|
exclude: exclude3,
|
|
372406
|
+
clientToolset,
|
|
371884
372407
|
clientToolAllowlist,
|
|
371885
372408
|
externalToolScopeIds,
|
|
371886
372409
|
workingDirectory,
|
|
@@ -371927,6 +372450,7 @@ async function prepareToolExecutionContextForScope(params) {
|
|
|
371927
372450
|
providerType: effectiveProviderType,
|
|
371928
372451
|
conversationId: conversationId ?? undefined,
|
|
371929
372452
|
toolsetPreference,
|
|
372453
|
+
clientToolset,
|
|
371930
372454
|
exclude: exclude3,
|
|
371931
372455
|
clientToolAllowlist,
|
|
371932
372456
|
externalToolScopeIds,
|
|
@@ -372100,7 +372624,10 @@ var init_toolset = __esm(async () => {
|
|
|
372100
372624
|
init_runtime_context();
|
|
372101
372625
|
init_settings_manager();
|
|
372102
372626
|
init_filter();
|
|
372103
|
-
await
|
|
372627
|
+
await __promiseAll([
|
|
372628
|
+
init_manager4(),
|
|
372629
|
+
init_tool_definitions()
|
|
372630
|
+
]);
|
|
372104
372631
|
ARTIFACT_TOOL_NAMES2 = [
|
|
372105
372632
|
"read_artifact_file",
|
|
372106
372633
|
"write_artifact_file"
|
|
@@ -424009,6 +424536,17 @@ function validateRegistryHandleOrThrow(handle2) {
|
|
|
424009
424536
|
}
|
|
424010
424537
|
}
|
|
424011
424538
|
|
|
424539
|
+
// src/cli/startup-mode.ts
|
|
424540
|
+
function isHeadlessStartup(flags, stdinIsTTY, firstPositional) {
|
|
424541
|
+
if (flags.prompt || flags.run) {
|
|
424542
|
+
return true;
|
|
424543
|
+
}
|
|
424544
|
+
if (firstPositional) {
|
|
424545
|
+
return false;
|
|
424546
|
+
}
|
|
424547
|
+
return stdinIsTTY !== true;
|
|
424548
|
+
}
|
|
424549
|
+
|
|
424012
424550
|
// src/cli/helpers/shared-agent-listing.ts
|
|
424013
424551
|
function buildListSharedAgentsQuery(params) {
|
|
424014
424552
|
return {
|
|
@@ -436614,7 +437152,7 @@ var init_conversation_runtime = __esm(async () => {
|
|
|
436614
437152
|
]);
|
|
436615
437153
|
});
|
|
436616
437154
|
|
|
436617
|
-
// src/cron/prompt.ts
|
|
437155
|
+
// src/cron/scheduled-task-prompt.ts
|
|
436618
437156
|
function pad(value, width) {
|
|
436619
437157
|
return String(value).padStart(width, "0");
|
|
436620
437158
|
}
|
|
@@ -436696,6 +437234,34 @@ function formatTimezoneQualifiedIso(date6, timezone) {
|
|
|
436696
437234
|
const offsetMinutes = Math.round((zonedAsUtcMs - date6.getTime()) / 60000);
|
|
436697
437235
|
return `${pad(parts.year, 4)}-${pad(parts.month, 2)}-${pad(parts.day, 2)}T${pad(parts.hour, 2)}:${pad(parts.minute, 2)}:${pad(parts.second, 2)}.${pad(millis, 3)}${formatOffset(offsetMinutes)}[${effectiveTimezone ?? "local"}]`;
|
|
436698
437236
|
}
|
|
437237
|
+
function formatRecurrence(recurrence) {
|
|
437238
|
+
if (recurrence.type === "one-off") {
|
|
437239
|
+
return "This is a one-off scheduled task.";
|
|
437240
|
+
}
|
|
437241
|
+
if (recurrence.fireNumber !== undefined) {
|
|
437242
|
+
return `This is fire #${recurrence.fireNumber} (cron: ${recurrence.cron}).`;
|
|
437243
|
+
}
|
|
437244
|
+
return `This is a recurring scheduled task (cron: ${recurrence.cron}).`;
|
|
437245
|
+
}
|
|
437246
|
+
function formatScheduledTaskPrompt(input) {
|
|
437247
|
+
const lines = [
|
|
437248
|
+
`Scheduled task "${input.name}" is firing.`,
|
|
437249
|
+
...input.description ? [`Description: ${input.description}`] : [],
|
|
437250
|
+
`Timezone: ${formatTimezoneDisplay(input.timezone)}`,
|
|
437251
|
+
`Scheduled for: ${formatTimezoneQualifiedIso(input.scheduledFor, input.timezone)}`,
|
|
437252
|
+
`Current time: ${formatTimezoneQualifiedIso(input.currentTime, input.timezone)}`,
|
|
437253
|
+
formatRecurrence(input.recurrence),
|
|
437254
|
+
"",
|
|
437255
|
+
AUTONOMOUS_NOTICE,
|
|
437256
|
+
"",
|
|
437257
|
+
`Prompt: ${input.prompt}`
|
|
437258
|
+
];
|
|
437259
|
+
return lines.join(`
|
|
437260
|
+
`);
|
|
437261
|
+
}
|
|
437262
|
+
var AUTONOMOUS_NOTICE = "You are running autonomously: no user is watching this turn and questions will not be answered. Deliver results through your available channels or record them in memory, and work until the task is done or genuinely blocked.";
|
|
437263
|
+
|
|
437264
|
+
// src/cron/prompt.ts
|
|
436699
437265
|
function getIntendedCronOccurrence(task2, matchedAt) {
|
|
436700
437266
|
if (!task2.recurring && task2.scheduled_for) {
|
|
436701
437267
|
const scheduledFor = new Date(task2.scheduled_for);
|
|
@@ -436708,22 +437274,21 @@ function getIntendedCronOccurrence(task2, matchedAt) {
|
|
|
436708
437274
|
return occurrence;
|
|
436709
437275
|
}
|
|
436710
437276
|
function formatCronPrompt(task2, timing) {
|
|
436711
|
-
|
|
436712
|
-
|
|
436713
|
-
|
|
436714
|
-
|
|
436715
|
-
|
|
436716
|
-
|
|
436717
|
-
|
|
436718
|
-
|
|
436719
|
-
|
|
436720
|
-
|
|
436721
|
-
"",
|
|
436722
|
-
|
|
436723
|
-
|
|
436724
|
-
|
|
436725
|
-
|
|
436726
|
-
}
|
|
437277
|
+
return formatScheduledTaskPrompt({
|
|
437278
|
+
name: task2.name,
|
|
437279
|
+
description: task2.description,
|
|
437280
|
+
timezone: typeof task2.timezone === "string" ? task2.timezone : "",
|
|
437281
|
+
scheduledFor: timing.intendedOccurrence,
|
|
437282
|
+
currentTime: timing.schedulerNow,
|
|
437283
|
+
recurrence: task2.recurring ? {
|
|
437284
|
+
type: "recurring",
|
|
437285
|
+
cron: task2.cron,
|
|
437286
|
+
fireNumber: task2.fire_count + 1
|
|
437287
|
+
} : { type: "one-off" },
|
|
437288
|
+
prompt: task2.prompt
|
|
437289
|
+
});
|
|
437290
|
+
}
|
|
437291
|
+
var init_prompt = () => {};
|
|
436727
437292
|
|
|
436728
437293
|
// src/cron/scheduler.ts
|
|
436729
437294
|
function minuteKey(date6) {
|
|
@@ -437144,7 +437709,9 @@ var init_scheduler = __esm(async () => {
|
|
|
437144
437709
|
init_runtime6();
|
|
437145
437710
|
init_cron_file();
|
|
437146
437711
|
init_parse_interval();
|
|
437712
|
+
init_prompt();
|
|
437147
437713
|
init_run_log();
|
|
437714
|
+
init_prompt();
|
|
437148
437715
|
await __promiseAll([
|
|
437149
437716
|
init_conversation_runtime(),
|
|
437150
437717
|
init_protocol_outbound(),
|
|
@@ -446426,6 +446993,11 @@ function isExperimentId(value) {
|
|
|
446426
446993
|
function isStringArray6(value) {
|
|
446427
446994
|
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
446428
446995
|
}
|
|
446996
|
+
function isClientToolsetConfig(value) {
|
|
446997
|
+
if (!isObjectRecord2(value))
|
|
446998
|
+
return false;
|
|
446999
|
+
return (value.base === undefined || typeof value.base === "string" && TOOLSET_PREFERENCES.has(value.base)) && (value.include === undefined || isStringArray6(value.include));
|
|
447000
|
+
}
|
|
446429
447001
|
function isStringRecord2(value) {
|
|
446430
447002
|
return !!value && typeof value === "object" && !Array.isArray(value) && Object.values(value).every((item) => typeof item === "string");
|
|
446431
447003
|
}
|
|
@@ -446452,7 +447024,7 @@ function isInputCommand(value) {
|
|
|
446452
447024
|
}
|
|
446453
447025
|
const payload = candidate.payload;
|
|
446454
447026
|
if (payload.kind === "create_message") {
|
|
446455
|
-
return Array.isArray(payload.messages) && (payload.client_tool_allowlist === undefined || isStringArray6(payload.client_tool_allowlist)) && (payload.external_tool_scope_ids === undefined || isStringArray6(payload.external_tool_scope_ids)) && (payload.exclude_interactive_tools === undefined || typeof payload.exclude_interactive_tools === "boolean");
|
|
447027
|
+
return Array.isArray(payload.messages) && (payload.client_tool_allowlist === undefined || isStringArray6(payload.client_tool_allowlist)) && (payload.client_toolset === undefined || isClientToolsetConfig(payload.client_toolset)) && (payload.external_tool_scope_ids === undefined || isStringArray6(payload.external_tool_scope_ids)) && (payload.exclude_interactive_tools === undefined || typeof payload.exclude_interactive_tools === "boolean");
|
|
446456
447028
|
}
|
|
446457
447029
|
if (payload.kind === "approval_response") {
|
|
446458
447030
|
return isValidApprovalResponseBody(payload);
|
|
@@ -446478,6 +447050,7 @@ function legacyEnvironmentMessageToInputCommand(value) {
|
|
|
446478
447050
|
kind: "create_message",
|
|
446479
447051
|
messages: candidate.messages,
|
|
446480
447052
|
client_tool_allowlist: isStringArray6(candidate.clientToolAllowlist) ? candidate.clientToolAllowlist : undefined,
|
|
447053
|
+
client_toolset: isClientToolsetConfig(candidate.clientToolset) ? candidate.clientToolset : undefined,
|
|
446481
447054
|
external_tool_scope_ids: isStringArray6(candidate.externalToolScopeIds) ? candidate.externalToolScopeIds : undefined
|
|
446482
447055
|
}
|
|
446483
447056
|
};
|
|
@@ -446510,6 +447083,12 @@ function getInvalidInputReason(value) {
|
|
|
446510
447083
|
reason: "Protocol violation: input.payload.client_tool_allowlist must be string[]"
|
|
446511
447084
|
};
|
|
446512
447085
|
}
|
|
447086
|
+
if (payload.client_toolset !== undefined && !isClientToolsetConfig(payload.client_toolset)) {
|
|
447087
|
+
return {
|
|
447088
|
+
runtime: candidate.runtime,
|
|
447089
|
+
reason: "Protocol violation: input.payload.client_toolset must contain an optional valid base and string[] include"
|
|
447090
|
+
};
|
|
447091
|
+
}
|
|
446513
447092
|
if (payload.exclude_interactive_tools !== undefined && typeof payload.exclude_interactive_tools !== "boolean") {
|
|
446514
447093
|
return {
|
|
446515
447094
|
runtime: candidate.runtime,
|
|
@@ -447222,7 +447801,7 @@ function parseServerMessage(data) {
|
|
|
447222
447801
|
return null;
|
|
447223
447802
|
}
|
|
447224
447803
|
}
|
|
447225
|
-
var EXPERIMENT_IDS, CHANNEL_ACCOUNT_CREATE_FIELDS, CHANNEL_ACCOUNT_UPDATE_FIELDS, CHANNEL_SET_CONFIG_FIELDS;
|
|
447804
|
+
var EXPERIMENT_IDS, TOOLSET_PREFERENCES, CHANNEL_ACCOUNT_CREATE_FIELDS, CHANNEL_ACCOUNT_UPDATE_FIELDS, CHANNEL_SET_CONFIG_FIELDS;
|
|
447226
447805
|
var init_protocol_inbound = __esm(async () => {
|
|
447227
447806
|
init_skill_sources();
|
|
447228
447807
|
init_account_config7();
|
|
@@ -447233,6 +447812,15 @@ var init_protocol_inbound = __esm(async () => {
|
|
|
447233
447812
|
"desktop_conversation_bootstrap",
|
|
447234
447813
|
"tui_cron"
|
|
447235
447814
|
]);
|
|
447815
|
+
TOOLSET_PREFERENCES = new Set([
|
|
447816
|
+
"auto",
|
|
447817
|
+
"codex",
|
|
447818
|
+
"codex_snake",
|
|
447819
|
+
"default",
|
|
447820
|
+
"gemini",
|
|
447821
|
+
"gemini_snake",
|
|
447822
|
+
"none"
|
|
447823
|
+
]);
|
|
447236
447824
|
CHANNEL_ACCOUNT_CREATE_FIELDS = new Set([
|
|
447237
447825
|
"account_id",
|
|
447238
447826
|
"display_name",
|
|
@@ -459722,6 +460310,7 @@ async function prepareListenerTurn(params) {
|
|
|
459722
460310
|
connectionId,
|
|
459723
460311
|
agentId,
|
|
459724
460312
|
conversationId,
|
|
460313
|
+
clientToolset: msg.clientToolset,
|
|
459725
460314
|
clientToolAllowlist: msg.clientToolAllowlist,
|
|
459726
460315
|
...msg.excludeInteractiveTools ? { exclude: [...INTERACTIVE_USER_INPUT_TOOL_NAMES] } : {},
|
|
459727
460316
|
externalToolScopeIds: msg.externalToolScopeIds,
|
|
@@ -464512,6 +465101,10 @@ function summarizeInputPayload(payload) {
|
|
|
464512
465101
|
if (payload.kind === "create_message") {
|
|
464513
465102
|
pushField(fields, "messages", payload.messages);
|
|
464514
465103
|
pushField(fields, "client_tool_allowlist", payload.client_tool_allowlist);
|
|
465104
|
+
if (isRecord10(payload.client_toolset)) {
|
|
465105
|
+
pushField(fields, "client_toolset.base", payload.client_toolset.base);
|
|
465106
|
+
pushField(fields, "client_toolset.include", payload.client_toolset.include);
|
|
465107
|
+
}
|
|
464515
465108
|
pushField(fields, "external_tool_scope_ids", payload.external_tool_scope_ids);
|
|
464516
465109
|
pushField(fields, "exclude_interactive_tools", payload.exclude_interactive_tools);
|
|
464517
465110
|
} else if (payload.kind === "approval_response") {
|
|
@@ -464798,6 +465391,7 @@ function createListenerMessageHandler(params) {
|
|
|
464798
465391
|
agentId: parsed.runtime.agent_id,
|
|
464799
465392
|
conversationId: parsed.runtime.conversation_id,
|
|
464800
465393
|
clientToolAllowlist: inputPayload.client_tool_allowlist,
|
|
465394
|
+
clientToolset: inputPayload.client_toolset,
|
|
464801
465395
|
externalToolScopeIds: inputPayload.external_tool_scope_ids,
|
|
464802
465396
|
excludeInteractiveTools: inputPayload.exclude_interactive_tools,
|
|
464803
465397
|
messages: inputPayload.messages
|
|
@@ -465197,8 +465791,143 @@ var init_process_services = __esm(async () => {
|
|
|
465197
465791
|
]);
|
|
465198
465792
|
});
|
|
465199
465793
|
|
|
465794
|
+
// src/websocket/listener/split-stream-lifecycle.ts
|
|
465795
|
+
import { WebSocket as WebSocket6 } from "ws";
|
|
465796
|
+
function terminateSocketIfOpenOrConnecting(socket) {
|
|
465797
|
+
if (socket && (socket.readyState === WebSocket6.OPEN || socket.readyState === WebSocket6.CONNECTING)) {
|
|
465798
|
+
socket.terminate();
|
|
465799
|
+
}
|
|
465800
|
+
}
|
|
465801
|
+
function isCurrentSocketPair(runtime, controlSocket, streamSocket) {
|
|
465802
|
+
return runtime === getActiveRuntime() && !runtime.intentionallyClosed && runtime.socket === controlSocket && runtime.streamSocket === streamSocket;
|
|
465803
|
+
}
|
|
465804
|
+
function shouldHandleControlSocketClose(runtime, controlSocket, connectionId) {
|
|
465805
|
+
return runtime === getActiveRuntime() && (runtime.socket === controlSocket || runtime.connections.get(connectionId)?.writer === controlSocket);
|
|
465806
|
+
}
|
|
465807
|
+
function terminateCurrentSocketPair(runtime, controlSocket, streamSocket) {
|
|
465808
|
+
if (!isCurrentSocketPair(runtime, controlSocket, streamSocket)) {
|
|
465809
|
+
return;
|
|
465810
|
+
}
|
|
465811
|
+
runtime.streamTransport = null;
|
|
465812
|
+
terminateSocketIfOpenOrConnecting(streamSocket);
|
|
465813
|
+
terminateSocketIfOpenOrConnecting(controlSocket);
|
|
465814
|
+
}
|
|
465815
|
+
function terminateControlAfterStreamClose(runtime, streamSocket, code2, reason) {
|
|
465816
|
+
if (runtime.streamSocket !== streamSocket) {
|
|
465817
|
+
return;
|
|
465818
|
+
}
|
|
465819
|
+
if (code2 === 1000 && reason.toString() === "Replaced by new connection") {
|
|
465820
|
+
runtime.intentionallyClosed = true;
|
|
465821
|
+
}
|
|
465822
|
+
runtime.streamSocket = null;
|
|
465823
|
+
runtime.streamTransport = null;
|
|
465824
|
+
terminateSocketIfOpenOrConnecting(runtime.socket);
|
|
465825
|
+
}
|
|
465826
|
+
function getStreamOpenTimeoutMs() {
|
|
465827
|
+
const override = process.env.LETTA_LISTENER_STREAM_OPEN_TIMEOUT_MS;
|
|
465828
|
+
if (override !== undefined) {
|
|
465829
|
+
const parsed = Number(override);
|
|
465830
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
465831
|
+
return parsed;
|
|
465832
|
+
}
|
|
465833
|
+
}
|
|
465834
|
+
return LISTENER_STREAM_OPEN_TIMEOUT_MS;
|
|
465835
|
+
}
|
|
465836
|
+
async function waitForStreamSocketOpen(streamSocket) {
|
|
465837
|
+
if (streamSocket.readyState === WebSocket6.OPEN) {
|
|
465838
|
+
return { status: "open", transport: streamSocket };
|
|
465839
|
+
}
|
|
465840
|
+
if (streamSocket.readyState === WebSocket6.CLOSING || streamSocket.readyState === WebSocket6.CLOSED) {
|
|
465841
|
+
return { status: "closed" };
|
|
465842
|
+
}
|
|
465843
|
+
const timeoutMs = getStreamOpenTimeoutMs();
|
|
465844
|
+
return await new Promise((resolve32) => {
|
|
465845
|
+
let timeout = null;
|
|
465846
|
+
let settled = false;
|
|
465847
|
+
function cleanup() {
|
|
465848
|
+
streamSocket.off("open", handleOpen);
|
|
465849
|
+
streamSocket.off("error", handleFailure);
|
|
465850
|
+
streamSocket.off("close", handleFailure);
|
|
465851
|
+
if (timeout) {
|
|
465852
|
+
clearTimeout(timeout);
|
|
465853
|
+
timeout = null;
|
|
465854
|
+
}
|
|
465855
|
+
}
|
|
465856
|
+
function settle(result) {
|
|
465857
|
+
if (settled) {
|
|
465858
|
+
return;
|
|
465859
|
+
}
|
|
465860
|
+
settled = true;
|
|
465861
|
+
cleanup();
|
|
465862
|
+
resolve32(result);
|
|
465863
|
+
}
|
|
465864
|
+
function handleOpen() {
|
|
465865
|
+
settle({ status: "open", transport: streamSocket });
|
|
465866
|
+
}
|
|
465867
|
+
function handleFailure() {
|
|
465868
|
+
settle({ status: "closed" });
|
|
465869
|
+
}
|
|
465870
|
+
timeout = setTimeout(() => {
|
|
465871
|
+
settle({ status: "timed_out", timeoutMs });
|
|
465872
|
+
}, timeoutMs);
|
|
465873
|
+
timeout.unref?.();
|
|
465874
|
+
streamSocket.once("open", handleOpen);
|
|
465875
|
+
streamSocket.once("error", handleFailure);
|
|
465876
|
+
streamSocket.once("close", handleFailure);
|
|
465877
|
+
});
|
|
465878
|
+
}
|
|
465879
|
+
async function prepareSplitStreamTransport({
|
|
465880
|
+
runtime,
|
|
465881
|
+
controlSocket,
|
|
465882
|
+
streamSocket,
|
|
465883
|
+
trackListenerError: trackListenerError4
|
|
465884
|
+
}) {
|
|
465885
|
+
if (!isCurrentSocketPair(runtime, controlSocket, streamSocket)) {
|
|
465886
|
+
return { kind: "stale" };
|
|
465887
|
+
}
|
|
465888
|
+
if (!streamSocket) {
|
|
465889
|
+
return { kind: "ready", transport: null };
|
|
465890
|
+
}
|
|
465891
|
+
const result = await waitForStreamSocketOpen(streamSocket);
|
|
465892
|
+
if (!isCurrentSocketPair(runtime, controlSocket, streamSocket)) {
|
|
465893
|
+
return { kind: "stale" };
|
|
465894
|
+
}
|
|
465895
|
+
if (result.status !== "open") {
|
|
465896
|
+
const message = result.status === "timed_out" ? `Stream WebSocket did not open within ${result.timeoutMs}ms; reconnecting paired listener sockets` : "Stream WebSocket closed before the paired listener sockets finished opening; reconnecting paired listener sockets";
|
|
465897
|
+
trackListenerError4(result.status === "timed_out" ? "listener_stream_open_timeout" : "listener_stream_open_failed", new Error(message), "listener_stream_socket_open");
|
|
465898
|
+
if (isDebugEnabled()) {
|
|
465899
|
+
console.error(`[Listen] ${message}`);
|
|
465900
|
+
}
|
|
465901
|
+
terminateCurrentSocketPair(runtime, controlSocket, streamSocket);
|
|
465902
|
+
return { kind: "stale" };
|
|
465903
|
+
}
|
|
465904
|
+
runtime.streamTransport = result.transport;
|
|
465905
|
+
return { kind: "ready", transport: result.transport };
|
|
465906
|
+
}
|
|
465907
|
+
function handleListenerSocketOpenFailure({
|
|
465908
|
+
runtime,
|
|
465909
|
+
controlSocket,
|
|
465910
|
+
streamSocket,
|
|
465911
|
+
error: error54,
|
|
465912
|
+
trackListenerError: trackListenerError4
|
|
465913
|
+
}) {
|
|
465914
|
+
if (!isCurrentSocketPair(runtime, controlSocket, streamSocket)) {
|
|
465915
|
+
return;
|
|
465916
|
+
}
|
|
465917
|
+
trackListenerError4("listener_open_handler_failed", error54, "listener_socket_open");
|
|
465918
|
+
if (isDebugEnabled()) {
|
|
465919
|
+
console.error("[Listen] WebSocket open handler failed:", error54);
|
|
465920
|
+
}
|
|
465921
|
+
terminateCurrentSocketPair(runtime, controlSocket, streamSocket);
|
|
465922
|
+
}
|
|
465923
|
+
var init_split_stream_lifecycle = __esm(() => {
|
|
465924
|
+
init_debug();
|
|
465925
|
+
init_constants3();
|
|
465926
|
+
init_runtime6();
|
|
465927
|
+
});
|
|
465928
|
+
|
|
465200
465929
|
// src/websocket/listener/lifecycle.ts
|
|
465201
|
-
import
|
|
465930
|
+
import WebSocket7 from "ws";
|
|
465202
465931
|
function trackListenerError4(errorType, error54, context3) {
|
|
465203
465932
|
trackBoundaryError({
|
|
465204
465933
|
errorType,
|
|
@@ -465207,7 +465936,7 @@ function trackListenerError4(errorType, error54, context3) {
|
|
|
465207
465936
|
});
|
|
465208
465937
|
}
|
|
465209
465938
|
function safeSocketSend(socket, payload, errorType, context3) {
|
|
465210
|
-
if (socket.readyState !==
|
|
465939
|
+
if (socket.readyState !== WebSocket7.OPEN) {
|
|
465211
465940
|
return false;
|
|
465212
465941
|
}
|
|
465213
465942
|
try {
|
|
@@ -465344,48 +466073,6 @@ function getParsedRuntimeScope(parsed) {
|
|
|
465344
466073
|
conversation_id: typeof runtime.conversation_id === "string" ? runtime.conversation_id : "default"
|
|
465345
466074
|
};
|
|
465346
466075
|
}
|
|
465347
|
-
function terminateControlAfterStreamClose(runtime, streamSocket, code2, reason) {
|
|
465348
|
-
if (runtime.streamSocket !== streamSocket) {
|
|
465349
|
-
return;
|
|
465350
|
-
}
|
|
465351
|
-
if (code2 === 1000 && reason.toString() === "Replaced by new connection") {
|
|
465352
|
-
runtime.intentionallyClosed = true;
|
|
465353
|
-
}
|
|
465354
|
-
runtime.streamSocket = null;
|
|
465355
|
-
runtime.streamTransport = null;
|
|
465356
|
-
const controlSocket = runtime.socket;
|
|
465357
|
-
if (controlSocket && (controlSocket.readyState === WebSocket6.OPEN || controlSocket.readyState === WebSocket6.CONNECTING)) {
|
|
465358
|
-
controlSocket.terminate();
|
|
465359
|
-
}
|
|
465360
|
-
}
|
|
465361
|
-
async function waitForStreamSocketOpen(streamSocket, runtime) {
|
|
465362
|
-
if (streamSocket.readyState === WebSocket6.OPEN) {
|
|
465363
|
-
runtime.streamTransport = streamSocket;
|
|
465364
|
-
return streamSocket;
|
|
465365
|
-
}
|
|
465366
|
-
if (streamSocket.readyState === WebSocket6.CLOSING || streamSocket.readyState === WebSocket6.CLOSED) {
|
|
465367
|
-
return null;
|
|
465368
|
-
}
|
|
465369
|
-
return await new Promise((resolve32) => {
|
|
465370
|
-
const handleOpen = () => {
|
|
465371
|
-
cleanup();
|
|
465372
|
-
runtime.streamTransport = streamSocket;
|
|
465373
|
-
resolve32(streamSocket);
|
|
465374
|
-
};
|
|
465375
|
-
const handleFailure = () => {
|
|
465376
|
-
cleanup();
|
|
465377
|
-
resolve32(null);
|
|
465378
|
-
};
|
|
465379
|
-
const cleanup = () => {
|
|
465380
|
-
streamSocket.off("open", handleOpen);
|
|
465381
|
-
streamSocket.off("error", handleFailure);
|
|
465382
|
-
streamSocket.off("close", handleFailure);
|
|
465383
|
-
};
|
|
465384
|
-
streamSocket.once("open", handleOpen);
|
|
465385
|
-
streamSocket.once("error", handleFailure);
|
|
465386
|
-
streamSocket.once("close", handleFailure);
|
|
465387
|
-
});
|
|
465388
|
-
}
|
|
465389
466076
|
async function wireChannelIngress(listener, socket, opts, processQueuedTurn) {
|
|
465390
466077
|
const registry2 = getChannelRegistry();
|
|
465391
466078
|
if (!registry2)
|
|
@@ -465867,7 +466554,7 @@ async function attachOpenListenerSocket(runtime, socket, opts, options3 = {}) {
|
|
|
465867
466554
|
});
|
|
465868
466555
|
});
|
|
465869
466556
|
socket.on("close", (code2, reason) => {
|
|
465870
|
-
if (runtime !== getActiveRuntime()) {
|
|
466557
|
+
if (runtime !== getActiveRuntime() || runtime.connections.get(opts.connectionId) !== connection) {
|
|
465871
466558
|
return;
|
|
465872
466559
|
}
|
|
465873
466560
|
const reasonText = reason.toString();
|
|
@@ -465908,7 +466595,7 @@ async function attachOpenListenerSocket(runtime, socket, opts, options3 = {}) {
|
|
|
465908
466595
|
if (connection.cancellation.signal.aborted || runtime.connections.get(opts.connectionId) !== connection) {
|
|
465909
466596
|
return;
|
|
465910
466597
|
}
|
|
465911
|
-
const streamTransport = streamSocket?.readyState ===
|
|
466598
|
+
const streamTransport = streamSocket?.readyState === WebSocket7.OPEN ? streamSocket : null;
|
|
465912
466599
|
await startConnectedListenerRuntime(runtime, transport, opts, processQueuedTurn, {
|
|
465913
466600
|
startHeartbeat: options3.startHeartbeat ?? false,
|
|
465914
466601
|
startCronScheduler: options3.startCronScheduler ?? true,
|
|
@@ -466018,12 +466705,12 @@ async function connectWithRetry(runtime, opts, attempt = 0, startTime = Date.now
|
|
|
466018
466705
|
streamUrl.searchParams.set("connectionName", opts.connectionName);
|
|
466019
466706
|
streamUrl.searchParams.set("channel", "stream");
|
|
466020
466707
|
}
|
|
466021
|
-
const socket = new
|
|
466708
|
+
const socket = new WebSocket7(url2.toString(), {
|
|
466022
466709
|
headers: {
|
|
466023
466710
|
Authorization: `Bearer ${apiKey}`
|
|
466024
466711
|
}
|
|
466025
466712
|
});
|
|
466026
|
-
const streamSocket = streamUrl ? new
|
|
466713
|
+
const streamSocket = streamUrl ? new WebSocket7(streamUrl.toString(), {
|
|
466027
466714
|
headers: {
|
|
466028
466715
|
Authorization: `Bearer ${apiKey}`
|
|
466029
466716
|
}
|
|
@@ -466037,22 +466724,41 @@ async function connectWithRetry(runtime, opts, attempt = 0, startTime = Date.now
|
|
|
466037
466724
|
runtime.streamSocket = streamSocket;
|
|
466038
466725
|
const transport = socket;
|
|
466039
466726
|
const processQueuedTurn = createConnectionTurnProcessor(runtime);
|
|
466040
|
-
socket.on("open",
|
|
466041
|
-
|
|
466042
|
-
|
|
466043
|
-
|
|
466044
|
-
|
|
466045
|
-
|
|
466046
|
-
|
|
466047
|
-
|
|
466048
|
-
|
|
466049
|
-
|
|
466050
|
-
|
|
466051
|
-
|
|
466052
|
-
|
|
466053
|
-
|
|
466054
|
-
|
|
466055
|
-
|
|
466727
|
+
socket.on("open", () => {
|
|
466728
|
+
(async () => {
|
|
466729
|
+
const streamOpen = await prepareSplitStreamTransport({
|
|
466730
|
+
runtime,
|
|
466731
|
+
controlSocket: socket,
|
|
466732
|
+
streamSocket,
|
|
466733
|
+
trackListenerError: trackListenerError4
|
|
466734
|
+
});
|
|
466735
|
+
if (streamOpen.kind !== "ready") {
|
|
466736
|
+
return;
|
|
466737
|
+
}
|
|
466738
|
+
const streamTransport = streamOpen.transport;
|
|
466739
|
+
if (!isCurrentSocketPair(runtime, socket, streamSocket)) {
|
|
466740
|
+
return;
|
|
466741
|
+
}
|
|
466742
|
+
openListenerConnection({
|
|
466743
|
+
runtime,
|
|
466744
|
+
connectionId: opts.connectionId,
|
|
466745
|
+
writer: socket,
|
|
466746
|
+
streamWriter: streamTransport,
|
|
466747
|
+
options: opts
|
|
466748
|
+
});
|
|
466749
|
+
await startConnectedListenerRuntime(runtime, transport, opts, processQueuedTurn, {
|
|
466750
|
+
startHeartbeat: true,
|
|
466751
|
+
startCronScheduler: true,
|
|
466752
|
+
streamTransport
|
|
466753
|
+
});
|
|
466754
|
+
})().catch((error54) => {
|
|
466755
|
+
handleListenerSocketOpenFailure({
|
|
466756
|
+
runtime,
|
|
466757
|
+
controlSocket: socket,
|
|
466758
|
+
streamSocket,
|
|
466759
|
+
error: error54,
|
|
466760
|
+
trackListenerError: trackListenerError4
|
|
466761
|
+
});
|
|
466056
466762
|
});
|
|
466057
466763
|
});
|
|
466058
466764
|
socket.on("message", createListenerMessageHandler({
|
|
@@ -466075,7 +466781,7 @@ async function connectWithRetry(runtime, opts, attempt = 0, startTime = Date.now
|
|
|
466075
466781
|
wireChannelIngress
|
|
466076
466782
|
}));
|
|
466077
466783
|
socket.on("close", (code2, reason) => {
|
|
466078
|
-
if (runtime
|
|
466784
|
+
if (!shouldHandleControlSocketClose(runtime, socket, opts.connectionId)) {
|
|
466079
466785
|
return;
|
|
466080
466786
|
}
|
|
466081
466787
|
safeEmitWsEvent("recv", "lifecycle", {
|
|
@@ -466100,7 +466806,7 @@ async function connectWithRetry(runtime, opts, attempt = 0, startTime = Date.now
|
|
|
466100
466806
|
clearListenerWarmState(runtime);
|
|
466101
466807
|
if (streamSocket) {
|
|
466102
466808
|
streamSocket.removeAllListeners();
|
|
466103
|
-
if (streamSocket.readyState ===
|
|
466809
|
+
if (streamSocket.readyState === WebSocket7.OPEN || streamSocket.readyState === WebSocket7.CONNECTING) {
|
|
466104
466810
|
streamSocket.close();
|
|
466105
466811
|
}
|
|
466106
466812
|
}
|
|
@@ -466190,6 +466896,7 @@ var init_lifecycle = __esm(async () => {
|
|
|
466190
466896
|
init_heartbeat();
|
|
466191
466897
|
init_permission_mode();
|
|
466192
466898
|
init_runtime6();
|
|
466899
|
+
init_split_stream_lifecycle();
|
|
466193
466900
|
init_transport();
|
|
466194
466901
|
await __promiseAll([
|
|
466195
466902
|
init_scheduler(),
|
|
@@ -468718,9 +469425,7 @@ var init_messages10 = __esm(() => {
|
|
|
468718
469425
|
});
|
|
468719
469426
|
|
|
468720
469427
|
// src/mods/package-installer.ts
|
|
468721
|
-
import {
|
|
468722
|
-
spawn as spawn13
|
|
468723
|
-
} from "node:child_process";
|
|
469428
|
+
import { spawn as spawn13 } from "node:child_process";
|
|
468724
469429
|
import {
|
|
468725
469430
|
copyFileSync as copyFileSync4,
|
|
468726
469431
|
existsSync as existsSync56,
|
|
@@ -469113,7 +469818,9 @@ async function runNpmInstall(params) {
|
|
|
469113
469818
|
args: getNpmInstallArgs(params.installSpec),
|
|
469114
469819
|
command: getNpmExecutable(),
|
|
469115
469820
|
cwd: params.tempRoot,
|
|
469116
|
-
spawnImpl:
|
|
469821
|
+
spawnImpl: spawnNpmInstallProcessOverride ?? getPackageManagerProcessFactory({
|
|
469822
|
+
platform: platformOverride2 ?? process.platform
|
|
469823
|
+
})
|
|
469117
469824
|
});
|
|
469118
469825
|
} catch (error54) {
|
|
469119
469826
|
const message = error54 instanceof Error ? error54.message : String(error54);
|
|
@@ -469569,13 +470276,13 @@ async function updateGitManagedModPackage(params) {
|
|
|
469569
470276
|
rmSync13(tempRoot, { force: true, recursive: true });
|
|
469570
470277
|
}
|
|
469571
470278
|
}
|
|
469572
|
-
var SKIPPED_PACKAGE_COPY_NAMES,
|
|
470279
|
+
var SKIPPED_PACKAGE_COPY_NAMES, spawnNpmInstallProcessOverride = null, spawnGitInstallProcess, platformOverride2 = null;
|
|
469573
470280
|
var init_package_installer = __esm(() => {
|
|
469574
470281
|
init_file_extensions();
|
|
469575
470282
|
init_package_manifest();
|
|
469576
470283
|
init_package_registry();
|
|
470284
|
+
init_package_manager_spawn();
|
|
469577
470285
|
SKIPPED_PACKAGE_COPY_NAMES = new Set([".git", "node_modules"]);
|
|
469578
|
-
spawnNpmInstallProcess = spawn13;
|
|
469579
470286
|
spawnGitInstallProcess = spawn13;
|
|
469580
470287
|
});
|
|
469581
470288
|
|
|
@@ -471781,7 +472488,7 @@ var init_app_server_openai = __esm(async () => {
|
|
|
471781
472488
|
// src/websocket/app-server.ts
|
|
471782
472489
|
import { createServer as createServer2 } from "node:http";
|
|
471783
472490
|
import { hostname as hostname6 } from "node:os";
|
|
471784
|
-
import
|
|
472491
|
+
import WebSocket8, { WebSocketServer } from "ws";
|
|
471785
472492
|
function getRequiredAddressInfo(server2) {
|
|
471786
472493
|
const address = server2.address();
|
|
471787
472494
|
if (!address || typeof address === "string") {
|
|
@@ -471797,12 +472504,12 @@ function getWebSocketUrl(baseUrl, path43) {
|
|
|
471797
472504
|
function closeSocket(socket, code2 = 1001, reason = "closing") {
|
|
471798
472505
|
if (!socket)
|
|
471799
472506
|
return;
|
|
471800
|
-
if (socket.readyState ===
|
|
472507
|
+
if (socket.readyState === WebSocket8.OPEN || socket.readyState === WebSocket8.CONNECTING) {
|
|
471801
472508
|
socket.close(code2, reason);
|
|
471802
472509
|
}
|
|
471803
472510
|
}
|
|
471804
472511
|
function terminateSocket(socket) {
|
|
471805
|
-
if (!socket || socket.readyState ===
|
|
472512
|
+
if (!socket || socket.readyState === WebSocket8.CLOSED)
|
|
471806
472513
|
return;
|
|
471807
472514
|
socket.terminate();
|
|
471808
472515
|
}
|
|
@@ -471980,7 +472687,7 @@ async function startAppServer(options3 = {}) {
|
|
|
471980
472687
|
client.terminate();
|
|
471981
472688
|
continue;
|
|
471982
472689
|
}
|
|
471983
|
-
if (client.readyState ===
|
|
472690
|
+
if (client.readyState === WebSocket8.OPEN) {
|
|
471984
472691
|
client.ping();
|
|
471985
472692
|
}
|
|
471986
472693
|
}
|
|
@@ -473019,6 +473726,12 @@ function truncateAgentId(id2, availableWidth) {
|
|
|
473019
473726
|
const suffixLen = availableWidth - 3 - prefixLen;
|
|
473020
473727
|
return `${id2.slice(0, prefixLen)}...${id2.slice(-suffixLen)}`;
|
|
473021
473728
|
}
|
|
473729
|
+
function formatAgentMemoryBlockCount(blockCount) {
|
|
473730
|
+
if (blockCount === null || blockCount === undefined || blockCount <= 0) {
|
|
473731
|
+
return null;
|
|
473732
|
+
}
|
|
473733
|
+
return `${blockCount} memory block${blockCount === 1 ? "" : "s"}`;
|
|
473734
|
+
}
|
|
473022
473735
|
function formatAgentModel(agent2) {
|
|
473023
473736
|
let handle2 = null;
|
|
473024
473737
|
if (agent2.model) {
|
|
@@ -473808,11 +474521,13 @@ function AgentSelector({
|
|
|
473808
474521
|
const isCurrent = agent2.id === currentAgentId;
|
|
473809
474522
|
const isLocalAgent2 = isLocalAgentId(agent2.id);
|
|
473810
474523
|
const relativeTime = formatRelativeTime3(agent2.last_run_completion);
|
|
473811
|
-
const
|
|
474524
|
+
const blockCountText = formatAgentMemoryBlockCount(agent2.blocks?.length);
|
|
473812
474525
|
const modelStr = formatAgentModel(agent2);
|
|
473813
474526
|
const metadataParts = [relativeTime];
|
|
473814
474527
|
if (!isLocalAgent2 && extra?.backend !== "shared") {
|
|
473815
|
-
|
|
474528
|
+
if (blockCountText) {
|
|
474529
|
+
metadataParts.push(blockCountText);
|
|
474530
|
+
}
|
|
473816
474531
|
metadataParts.push(modelStr);
|
|
473817
474532
|
}
|
|
473818
474533
|
if (extra?.backend === "shared" && agent2.creator?.name) {
|
|
@@ -486998,462 +487713,6 @@ var init_sse = __esm(() => {
|
|
|
486998
487713
|
};
|
|
486999
487714
|
});
|
|
487000
487715
|
|
|
487001
|
-
// node_modules/isexe/windows.js
|
|
487002
|
-
var require_windows = __commonJS((exports, module3) => {
|
|
487003
|
-
module3.exports = isexe;
|
|
487004
|
-
isexe.sync = sync2;
|
|
487005
|
-
var fs15 = __require("fs");
|
|
487006
|
-
function checkPathExt(path43, options3) {
|
|
487007
|
-
var pathext = options3.pathExt !== undefined ? options3.pathExt : process.env.PATHEXT;
|
|
487008
|
-
if (!pathext) {
|
|
487009
|
-
return true;
|
|
487010
|
-
}
|
|
487011
|
-
pathext = pathext.split(";");
|
|
487012
|
-
if (pathext.indexOf("") !== -1) {
|
|
487013
|
-
return true;
|
|
487014
|
-
}
|
|
487015
|
-
for (var i4 = 0;i4 < pathext.length; i4++) {
|
|
487016
|
-
var p2 = pathext[i4].toLowerCase();
|
|
487017
|
-
if (p2 && path43.substr(-p2.length).toLowerCase() === p2) {
|
|
487018
|
-
return true;
|
|
487019
|
-
}
|
|
487020
|
-
}
|
|
487021
|
-
return false;
|
|
487022
|
-
}
|
|
487023
|
-
function checkStat(stat17, path43, options3) {
|
|
487024
|
-
if (!stat17.isSymbolicLink() && !stat17.isFile()) {
|
|
487025
|
-
return false;
|
|
487026
|
-
}
|
|
487027
|
-
return checkPathExt(path43, options3);
|
|
487028
|
-
}
|
|
487029
|
-
function isexe(path43, options3, cb) {
|
|
487030
|
-
fs15.stat(path43, function(er, stat17) {
|
|
487031
|
-
cb(er, er ? false : checkStat(stat17, path43, options3));
|
|
487032
|
-
});
|
|
487033
|
-
}
|
|
487034
|
-
function sync2(path43, options3) {
|
|
487035
|
-
return checkStat(fs15.statSync(path43), path43, options3);
|
|
487036
|
-
}
|
|
487037
|
-
});
|
|
487038
|
-
|
|
487039
|
-
// node_modules/isexe/mode.js
|
|
487040
|
-
var require_mode = __commonJS((exports, module3) => {
|
|
487041
|
-
module3.exports = isexe;
|
|
487042
|
-
isexe.sync = sync2;
|
|
487043
|
-
var fs15 = __require("fs");
|
|
487044
|
-
function isexe(path43, options3, cb) {
|
|
487045
|
-
fs15.stat(path43, function(er, stat17) {
|
|
487046
|
-
cb(er, er ? false : checkStat(stat17, options3));
|
|
487047
|
-
});
|
|
487048
|
-
}
|
|
487049
|
-
function sync2(path43, options3) {
|
|
487050
|
-
return checkStat(fs15.statSync(path43), options3);
|
|
487051
|
-
}
|
|
487052
|
-
function checkStat(stat17, options3) {
|
|
487053
|
-
return stat17.isFile() && checkMode(stat17, options3);
|
|
487054
|
-
}
|
|
487055
|
-
function checkMode(stat17, options3) {
|
|
487056
|
-
var mod = stat17.mode;
|
|
487057
|
-
var uid = stat17.uid;
|
|
487058
|
-
var gid = stat17.gid;
|
|
487059
|
-
var myUid = options3.uid !== undefined ? options3.uid : process.getuid && process.getuid();
|
|
487060
|
-
var myGid = options3.gid !== undefined ? options3.gid : process.getgid && process.getgid();
|
|
487061
|
-
var u2 = parseInt("100", 8);
|
|
487062
|
-
var g = parseInt("010", 8);
|
|
487063
|
-
var o3 = parseInt("001", 8);
|
|
487064
|
-
var ug = u2 | g;
|
|
487065
|
-
var ret = mod & o3 || mod & g && gid === myGid || mod & u2 && uid === myUid || mod & ug && myUid === 0;
|
|
487066
|
-
return ret;
|
|
487067
|
-
}
|
|
487068
|
-
});
|
|
487069
|
-
|
|
487070
|
-
// node_modules/isexe/index.js
|
|
487071
|
-
var require_isexe = __commonJS((exports, module3) => {
|
|
487072
|
-
var fs15 = __require("fs");
|
|
487073
|
-
var core4;
|
|
487074
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
487075
|
-
core4 = require_windows();
|
|
487076
|
-
} else {
|
|
487077
|
-
core4 = require_mode();
|
|
487078
|
-
}
|
|
487079
|
-
module3.exports = isexe;
|
|
487080
|
-
isexe.sync = sync2;
|
|
487081
|
-
function isexe(path43, options3, cb) {
|
|
487082
|
-
if (typeof options3 === "function") {
|
|
487083
|
-
cb = options3;
|
|
487084
|
-
options3 = {};
|
|
487085
|
-
}
|
|
487086
|
-
if (!cb) {
|
|
487087
|
-
if (typeof Promise !== "function") {
|
|
487088
|
-
throw new TypeError("callback not provided");
|
|
487089
|
-
}
|
|
487090
|
-
return new Promise(function(resolve34, reject) {
|
|
487091
|
-
isexe(path43, options3 || {}, function(er, is) {
|
|
487092
|
-
if (er) {
|
|
487093
|
-
reject(er);
|
|
487094
|
-
} else {
|
|
487095
|
-
resolve34(is);
|
|
487096
|
-
}
|
|
487097
|
-
});
|
|
487098
|
-
});
|
|
487099
|
-
}
|
|
487100
|
-
core4(path43, options3 || {}, function(er, is) {
|
|
487101
|
-
if (er) {
|
|
487102
|
-
if (er.code === "EACCES" || options3 && options3.ignoreErrors) {
|
|
487103
|
-
er = null;
|
|
487104
|
-
is = false;
|
|
487105
|
-
}
|
|
487106
|
-
}
|
|
487107
|
-
cb(er, is);
|
|
487108
|
-
});
|
|
487109
|
-
}
|
|
487110
|
-
function sync2(path43, options3) {
|
|
487111
|
-
try {
|
|
487112
|
-
return core4.sync(path43, options3 || {});
|
|
487113
|
-
} catch (er) {
|
|
487114
|
-
if (options3 && options3.ignoreErrors || er.code === "EACCES") {
|
|
487115
|
-
return false;
|
|
487116
|
-
} else {
|
|
487117
|
-
throw er;
|
|
487118
|
-
}
|
|
487119
|
-
}
|
|
487120
|
-
}
|
|
487121
|
-
});
|
|
487122
|
-
|
|
487123
|
-
// node_modules/which/which.js
|
|
487124
|
-
var require_which = __commonJS((exports, module3) => {
|
|
487125
|
-
var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
487126
|
-
var path43 = __require("path");
|
|
487127
|
-
var COLON2 = isWindows3 ? ";" : ":";
|
|
487128
|
-
var isexe = require_isexe();
|
|
487129
|
-
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
487130
|
-
var getPathInfo = (cmd, opt) => {
|
|
487131
|
-
const colon = opt.colon || COLON2;
|
|
487132
|
-
const pathEnv = cmd.match(/\//) || isWindows3 && cmd.match(/\\/) ? [""] : [
|
|
487133
|
-
...isWindows3 ? [process.cwd()] : [],
|
|
487134
|
-
...(opt.path || process.env.PATH || "").split(colon)
|
|
487135
|
-
];
|
|
487136
|
-
const pathExtExe = isWindows3 ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
487137
|
-
const pathExt = isWindows3 ? pathExtExe.split(colon) : [""];
|
|
487138
|
-
if (isWindows3) {
|
|
487139
|
-
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
|
487140
|
-
pathExt.unshift("");
|
|
487141
|
-
}
|
|
487142
|
-
return {
|
|
487143
|
-
pathEnv,
|
|
487144
|
-
pathExt,
|
|
487145
|
-
pathExtExe
|
|
487146
|
-
};
|
|
487147
|
-
};
|
|
487148
|
-
var which = (cmd, opt, cb) => {
|
|
487149
|
-
if (typeof opt === "function") {
|
|
487150
|
-
cb = opt;
|
|
487151
|
-
opt = {};
|
|
487152
|
-
}
|
|
487153
|
-
if (!opt)
|
|
487154
|
-
opt = {};
|
|
487155
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
487156
|
-
const found = [];
|
|
487157
|
-
const step = (i4) => new Promise((resolve34, reject) => {
|
|
487158
|
-
if (i4 === pathEnv.length)
|
|
487159
|
-
return opt.all && found.length ? resolve34(found) : reject(getNotFoundError(cmd));
|
|
487160
|
-
const ppRaw = pathEnv[i4];
|
|
487161
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
487162
|
-
const pCmd = path43.join(pathPart, cmd);
|
|
487163
|
-
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
487164
|
-
resolve34(subStep(p2, i4, 0));
|
|
487165
|
-
});
|
|
487166
|
-
const subStep = (p2, i4, ii) => new Promise((resolve34, reject) => {
|
|
487167
|
-
if (ii === pathExt.length)
|
|
487168
|
-
return resolve34(step(i4 + 1));
|
|
487169
|
-
const ext3 = pathExt[ii];
|
|
487170
|
-
isexe(p2 + ext3, { pathExt: pathExtExe }, (er, is) => {
|
|
487171
|
-
if (!er && is) {
|
|
487172
|
-
if (opt.all)
|
|
487173
|
-
found.push(p2 + ext3);
|
|
487174
|
-
else
|
|
487175
|
-
return resolve34(p2 + ext3);
|
|
487176
|
-
}
|
|
487177
|
-
return resolve34(subStep(p2, i4, ii + 1));
|
|
487178
|
-
});
|
|
487179
|
-
});
|
|
487180
|
-
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
487181
|
-
};
|
|
487182
|
-
var whichSync = (cmd, opt) => {
|
|
487183
|
-
opt = opt || {};
|
|
487184
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
487185
|
-
const found = [];
|
|
487186
|
-
for (let i4 = 0;i4 < pathEnv.length; i4++) {
|
|
487187
|
-
const ppRaw = pathEnv[i4];
|
|
487188
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
487189
|
-
const pCmd = path43.join(pathPart, cmd);
|
|
487190
|
-
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
487191
|
-
for (let j2 = 0;j2 < pathExt.length; j2++) {
|
|
487192
|
-
const cur = p2 + pathExt[j2];
|
|
487193
|
-
try {
|
|
487194
|
-
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
487195
|
-
if (is) {
|
|
487196
|
-
if (opt.all)
|
|
487197
|
-
found.push(cur);
|
|
487198
|
-
else
|
|
487199
|
-
return cur;
|
|
487200
|
-
}
|
|
487201
|
-
} catch (ex) {}
|
|
487202
|
-
}
|
|
487203
|
-
}
|
|
487204
|
-
if (opt.all && found.length)
|
|
487205
|
-
return found;
|
|
487206
|
-
if (opt.nothrow)
|
|
487207
|
-
return null;
|
|
487208
|
-
throw getNotFoundError(cmd);
|
|
487209
|
-
};
|
|
487210
|
-
module3.exports = which;
|
|
487211
|
-
which.sync = whichSync;
|
|
487212
|
-
});
|
|
487213
|
-
|
|
487214
|
-
// node_modules/path-key/index.js
|
|
487215
|
-
var require_path_key = __commonJS((exports, module3) => {
|
|
487216
|
-
var pathKey = (options3 = {}) => {
|
|
487217
|
-
const environment2 = options3.env || process.env;
|
|
487218
|
-
const platform10 = options3.platform || process.platform;
|
|
487219
|
-
if (platform10 !== "win32") {
|
|
487220
|
-
return "PATH";
|
|
487221
|
-
}
|
|
487222
|
-
return Object.keys(environment2).reverse().find((key2) => key2.toUpperCase() === "PATH") || "Path";
|
|
487223
|
-
};
|
|
487224
|
-
module3.exports = pathKey;
|
|
487225
|
-
module3.exports.default = pathKey;
|
|
487226
|
-
});
|
|
487227
|
-
|
|
487228
|
-
// node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
487229
|
-
var require_resolveCommand = __commonJS((exports, module3) => {
|
|
487230
|
-
var path43 = __require("path");
|
|
487231
|
-
var which = require_which();
|
|
487232
|
-
var getPathKey = require_path_key();
|
|
487233
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
487234
|
-
const env5 = parsed.options.env || process.env;
|
|
487235
|
-
const cwd2 = process.cwd();
|
|
487236
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
487237
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
|
|
487238
|
-
if (shouldSwitchCwd) {
|
|
487239
|
-
try {
|
|
487240
|
-
process.chdir(parsed.options.cwd);
|
|
487241
|
-
} catch (err) {}
|
|
487242
|
-
}
|
|
487243
|
-
let resolved;
|
|
487244
|
-
try {
|
|
487245
|
-
resolved = which.sync(parsed.command, {
|
|
487246
|
-
path: env5[getPathKey({ env: env5 })],
|
|
487247
|
-
pathExt: withoutPathExt ? path43.delimiter : undefined
|
|
487248
|
-
});
|
|
487249
|
-
} catch (e2) {} finally {
|
|
487250
|
-
if (shouldSwitchCwd) {
|
|
487251
|
-
process.chdir(cwd2);
|
|
487252
|
-
}
|
|
487253
|
-
}
|
|
487254
|
-
if (resolved) {
|
|
487255
|
-
resolved = path43.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
487256
|
-
}
|
|
487257
|
-
return resolved;
|
|
487258
|
-
}
|
|
487259
|
-
function resolveCommand(parsed) {
|
|
487260
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
487261
|
-
}
|
|
487262
|
-
module3.exports = resolveCommand;
|
|
487263
|
-
});
|
|
487264
|
-
|
|
487265
|
-
// node_modules/cross-spawn/lib/util/escape.js
|
|
487266
|
-
var require_escape = __commonJS((exports, module3) => {
|
|
487267
|
-
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
487268
|
-
function escapeCommand(arg) {
|
|
487269
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
487270
|
-
return arg;
|
|
487271
|
-
}
|
|
487272
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
487273
|
-
arg = `${arg}`;
|
|
487274
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
487275
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
487276
|
-
arg = `"${arg}"`;
|
|
487277
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
487278
|
-
if (doubleEscapeMetaChars) {
|
|
487279
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
487280
|
-
}
|
|
487281
|
-
return arg;
|
|
487282
|
-
}
|
|
487283
|
-
exports.command = escapeCommand;
|
|
487284
|
-
exports.argument = escapeArgument;
|
|
487285
|
-
});
|
|
487286
|
-
|
|
487287
|
-
// node_modules/shebang-regex/index.js
|
|
487288
|
-
var require_shebang_regex = __commonJS((exports, module3) => {
|
|
487289
|
-
module3.exports = /^#!(.*)/;
|
|
487290
|
-
});
|
|
487291
|
-
|
|
487292
|
-
// node_modules/shebang-command/index.js
|
|
487293
|
-
var require_shebang_command = __commonJS((exports, module3) => {
|
|
487294
|
-
var shebangRegex = require_shebang_regex();
|
|
487295
|
-
module3.exports = (string7 = "") => {
|
|
487296
|
-
const match4 = string7.match(shebangRegex);
|
|
487297
|
-
if (!match4) {
|
|
487298
|
-
return null;
|
|
487299
|
-
}
|
|
487300
|
-
const [path43, argument] = match4[0].replace(/#! ?/, "").split(" ");
|
|
487301
|
-
const binary = path43.split("/").pop();
|
|
487302
|
-
if (binary === "env") {
|
|
487303
|
-
return argument;
|
|
487304
|
-
}
|
|
487305
|
-
return argument ? `${binary} ${argument}` : binary;
|
|
487306
|
-
};
|
|
487307
|
-
});
|
|
487308
|
-
|
|
487309
|
-
// node_modules/cross-spawn/lib/util/readShebang.js
|
|
487310
|
-
var require_readShebang = __commonJS((exports, module3) => {
|
|
487311
|
-
var fs15 = __require("fs");
|
|
487312
|
-
var shebangCommand = require_shebang_command();
|
|
487313
|
-
function readShebang(command) {
|
|
487314
|
-
const size = 150;
|
|
487315
|
-
const buffer = Buffer.alloc(size);
|
|
487316
|
-
let fd;
|
|
487317
|
-
try {
|
|
487318
|
-
fd = fs15.openSync(command, "r");
|
|
487319
|
-
fs15.readSync(fd, buffer, 0, size, 0);
|
|
487320
|
-
fs15.closeSync(fd);
|
|
487321
|
-
} catch (e2) {}
|
|
487322
|
-
return shebangCommand(buffer.toString());
|
|
487323
|
-
}
|
|
487324
|
-
module3.exports = readShebang;
|
|
487325
|
-
});
|
|
487326
|
-
|
|
487327
|
-
// node_modules/cross-spawn/lib/parse.js
|
|
487328
|
-
var require_parse3 = __commonJS((exports, module3) => {
|
|
487329
|
-
var path43 = __require("path");
|
|
487330
|
-
var resolveCommand = require_resolveCommand();
|
|
487331
|
-
var escape4 = require_escape();
|
|
487332
|
-
var readShebang = require_readShebang();
|
|
487333
|
-
var isWin2 = process.platform === "win32";
|
|
487334
|
-
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
487335
|
-
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
487336
|
-
function detectShebang(parsed) {
|
|
487337
|
-
parsed.file = resolveCommand(parsed);
|
|
487338
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
487339
|
-
if (shebang) {
|
|
487340
|
-
parsed.args.unshift(parsed.file);
|
|
487341
|
-
parsed.command = shebang;
|
|
487342
|
-
return resolveCommand(parsed);
|
|
487343
|
-
}
|
|
487344
|
-
return parsed.file;
|
|
487345
|
-
}
|
|
487346
|
-
function parseNonShell(parsed) {
|
|
487347
|
-
if (!isWin2) {
|
|
487348
|
-
return parsed;
|
|
487349
|
-
}
|
|
487350
|
-
const commandFile = detectShebang(parsed);
|
|
487351
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
487352
|
-
if (parsed.options.forceShell || needsShell) {
|
|
487353
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
487354
|
-
parsed.command = path43.normalize(parsed.command);
|
|
487355
|
-
parsed.command = escape4.command(parsed.command);
|
|
487356
|
-
parsed.args = parsed.args.map((arg) => escape4.argument(arg, needsDoubleEscapeMetaChars));
|
|
487357
|
-
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
487358
|
-
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
487359
|
-
parsed.command = process.env.comspec || "cmd.exe";
|
|
487360
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
487361
|
-
}
|
|
487362
|
-
return parsed;
|
|
487363
|
-
}
|
|
487364
|
-
function parse9(command, args, options3) {
|
|
487365
|
-
if (args && !Array.isArray(args)) {
|
|
487366
|
-
options3 = args;
|
|
487367
|
-
args = null;
|
|
487368
|
-
}
|
|
487369
|
-
args = args ? args.slice(0) : [];
|
|
487370
|
-
options3 = Object.assign({}, options3);
|
|
487371
|
-
const parsed = {
|
|
487372
|
-
command,
|
|
487373
|
-
args,
|
|
487374
|
-
options: options3,
|
|
487375
|
-
file: undefined,
|
|
487376
|
-
original: {
|
|
487377
|
-
command,
|
|
487378
|
-
args
|
|
487379
|
-
}
|
|
487380
|
-
};
|
|
487381
|
-
return options3.shell ? parsed : parseNonShell(parsed);
|
|
487382
|
-
}
|
|
487383
|
-
module3.exports = parse9;
|
|
487384
|
-
});
|
|
487385
|
-
|
|
487386
|
-
// node_modules/cross-spawn/lib/enoent.js
|
|
487387
|
-
var require_enoent = __commonJS((exports, module3) => {
|
|
487388
|
-
var isWin2 = process.platform === "win32";
|
|
487389
|
-
function notFoundError(original, syscall) {
|
|
487390
|
-
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
487391
|
-
code: "ENOENT",
|
|
487392
|
-
errno: "ENOENT",
|
|
487393
|
-
syscall: `${syscall} ${original.command}`,
|
|
487394
|
-
path: original.command,
|
|
487395
|
-
spawnargs: original.args
|
|
487396
|
-
});
|
|
487397
|
-
}
|
|
487398
|
-
function hookChildProcess(cp2, parsed) {
|
|
487399
|
-
if (!isWin2) {
|
|
487400
|
-
return;
|
|
487401
|
-
}
|
|
487402
|
-
const originalEmit = cp2.emit;
|
|
487403
|
-
cp2.emit = function(name, arg1) {
|
|
487404
|
-
if (name === "exit") {
|
|
487405
|
-
const err = verifyENOENT(arg1, parsed);
|
|
487406
|
-
if (err) {
|
|
487407
|
-
return originalEmit.call(cp2, "error", err);
|
|
487408
|
-
}
|
|
487409
|
-
}
|
|
487410
|
-
return originalEmit.apply(cp2, arguments);
|
|
487411
|
-
};
|
|
487412
|
-
}
|
|
487413
|
-
function verifyENOENT(status, parsed) {
|
|
487414
|
-
if (isWin2 && status === 1 && !parsed.file) {
|
|
487415
|
-
return notFoundError(parsed.original, "spawn");
|
|
487416
|
-
}
|
|
487417
|
-
return null;
|
|
487418
|
-
}
|
|
487419
|
-
function verifyENOENTSync(status, parsed) {
|
|
487420
|
-
if (isWin2 && status === 1 && !parsed.file) {
|
|
487421
|
-
return notFoundError(parsed.original, "spawnSync");
|
|
487422
|
-
}
|
|
487423
|
-
return null;
|
|
487424
|
-
}
|
|
487425
|
-
module3.exports = {
|
|
487426
|
-
hookChildProcess,
|
|
487427
|
-
verifyENOENT,
|
|
487428
|
-
verifyENOENTSync,
|
|
487429
|
-
notFoundError
|
|
487430
|
-
};
|
|
487431
|
-
});
|
|
487432
|
-
|
|
487433
|
-
// node_modules/cross-spawn/index.js
|
|
487434
|
-
var require_cross_spawn = __commonJS((exports, module3) => {
|
|
487435
|
-
var cp2 = __require("child_process");
|
|
487436
|
-
var parse9 = require_parse3();
|
|
487437
|
-
var enoent = require_enoent();
|
|
487438
|
-
function spawn14(command, args, options3) {
|
|
487439
|
-
const parsed = parse9(command, args, options3);
|
|
487440
|
-
const spawned = cp2.spawn(parsed.command, parsed.args, parsed.options);
|
|
487441
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
487442
|
-
return spawned;
|
|
487443
|
-
}
|
|
487444
|
-
function spawnSync4(command, args, options3) {
|
|
487445
|
-
const parsed = parse9(command, args, options3);
|
|
487446
|
-
const result = cp2.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
487447
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
487448
|
-
return result;
|
|
487449
|
-
}
|
|
487450
|
-
module3.exports = spawn14;
|
|
487451
|
-
module3.exports.spawn = spawn14;
|
|
487452
|
-
module3.exports.sync = spawnSync4;
|
|
487453
|
-
module3.exports._parse = parse9;
|
|
487454
|
-
module3.exports._enoent = enoent;
|
|
487455
|
-
});
|
|
487456
|
-
|
|
487457
487716
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
487458
487717
|
class ReadBuffer {
|
|
487459
487718
|
constructor(options3) {
|
|
@@ -487529,7 +487788,7 @@ class StdioClientTransport {
|
|
|
487529
487788
|
throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
487530
487789
|
}
|
|
487531
487790
|
return new Promise((resolve34, reject) => {
|
|
487532
|
-
this._process =
|
|
487791
|
+
this._process = import_cross_spawn2.default(this._serverParams.command, this._serverParams.args ?? [], {
|
|
487533
487792
|
env: {
|
|
487534
487793
|
...getDefaultEnvironment(),
|
|
487535
487794
|
...this._serverParams.env
|
|
@@ -487633,10 +487892,10 @@ class StdioClientTransport {
|
|
|
487633
487892
|
});
|
|
487634
487893
|
}
|
|
487635
487894
|
}
|
|
487636
|
-
var
|
|
487895
|
+
var import_cross_spawn2, DEFAULT_INHERITED_ENV_VARS;
|
|
487637
487896
|
var init_stdio2 = __esm(() => {
|
|
487638
487897
|
init_stdio();
|
|
487639
|
-
|
|
487898
|
+
import_cross_spawn2 = __toESM(require_cross_spawn(), 1);
|
|
487640
487899
|
DEFAULT_INHERITED_ENV_VARS = process20.platform === "win32" ? [
|
|
487641
487900
|
"APPDATA",
|
|
487642
487901
|
"HOMEDRIVE",
|
|
@@ -488304,7 +488563,7 @@ var init_mcp_client = __esm(() => {
|
|
|
488304
488563
|
init_streamableHttp();
|
|
488305
488564
|
DEFAULT_CLIENT_INFO = {
|
|
488306
488565
|
name: "letta-code",
|
|
488307
|
-
version: "0.
|
|
488566
|
+
version: "0.30.1"
|
|
488308
488567
|
};
|
|
488309
488568
|
});
|
|
488310
488569
|
|
|
@@ -552022,7 +552281,7 @@ Note: Flags should use double dashes for full names (e.g., --yolo, not -yolo)`);
|
|
|
552022
552281
|
importFlagValue: values2.import,
|
|
552023
552282
|
fromAfFlagValue: values2["from-af"]
|
|
552024
552283
|
});
|
|
552025
|
-
const isHeadless = values2
|
|
552284
|
+
const isHeadless = isHeadlessStartup(values2, process.stdin.isTTY, command);
|
|
552026
552285
|
const terminalThemePromise = !isHeadless ? initTerminalTheme().catch(() => {
|
|
552027
552286
|
return;
|
|
552028
552287
|
}) : Promise.resolve(undefined);
|
|
@@ -555327,4 +555586,4 @@ function registerBunOAuthFlows() {
|
|
|
555327
555586
|
registerBunOAuthFlows();
|
|
555328
555587
|
await init_src5().then(() => exports_src2);
|
|
555329
555588
|
|
|
555330
|
-
//# debugId=
|
|
555589
|
+
//# debugId=176DD519C90983F764756E2164756E21
|