@llmist/cli 12.2.0 → 12.2.2
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.js +76 -59
- package/dist/cli.js.map +1 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -76,7 +76,7 @@ import { Command, InvalidArgumentError as InvalidArgumentError2 } from "commande
|
|
|
76
76
|
// package.json
|
|
77
77
|
var package_default = {
|
|
78
78
|
name: "@llmist/cli",
|
|
79
|
-
version: "12.2.
|
|
79
|
+
version: "12.2.2",
|
|
80
80
|
description: "CLI for llmist - run LLM agents from the command line",
|
|
81
81
|
type: "module",
|
|
82
82
|
main: "dist/cli.js",
|
|
@@ -132,7 +132,7 @@ var package_default = {
|
|
|
132
132
|
node: ">=22.0.0"
|
|
133
133
|
},
|
|
134
134
|
dependencies: {
|
|
135
|
-
llmist: "^12.2.
|
|
135
|
+
llmist: "^12.2.2",
|
|
136
136
|
"@unblessed/node": "^1.0.0-alpha.23",
|
|
137
137
|
chalk: "^5.6.2",
|
|
138
138
|
commander: "^12.1.0",
|
|
@@ -146,7 +146,7 @@ var package_default = {
|
|
|
146
146
|
zod: "^4.1.12"
|
|
147
147
|
},
|
|
148
148
|
devDependencies: {
|
|
149
|
-
"@llmist/testing": "^12.2.
|
|
149
|
+
"@llmist/testing": "^12.2.2",
|
|
150
150
|
"@types/diff": "^8.0.0",
|
|
151
151
|
"@types/js-yaml": "^4.0.9",
|
|
152
152
|
"@types/marked-terminal": "^6.1.1",
|
|
@@ -158,10 +158,7 @@ var package_default = {
|
|
|
158
158
|
};
|
|
159
159
|
|
|
160
160
|
// src/agent-command.ts
|
|
161
|
-
import { AgentBuilder } from "llmist";
|
|
162
|
-
import { isAbortError } from "llmist";
|
|
163
|
-
import { text } from "llmist";
|
|
164
|
-
import { GadgetRegistry } from "llmist";
|
|
161
|
+
import { AgentBuilder, GadgetRegistry, isAbortError, text } from "llmist";
|
|
165
162
|
|
|
166
163
|
// src/builtin-gadgets.ts
|
|
167
164
|
import { z } from "zod";
|
|
@@ -1207,54 +1204,6 @@ function resolveInheritance(config, configPath) {
|
|
|
1207
1204
|
return resolved;
|
|
1208
1205
|
}
|
|
1209
1206
|
|
|
1210
|
-
// src/subagent-config.ts
|
|
1211
|
-
var INHERIT_MODEL = "inherit";
|
|
1212
|
-
function resolveSubagentConfig(subagentName, parentModel, profileConfig, globalConfig) {
|
|
1213
|
-
const resolved = {};
|
|
1214
|
-
const globalDefaultModel = globalConfig?.["default-model"];
|
|
1215
|
-
const globalSubagent = extractSubagentConfig(globalConfig, subagentName);
|
|
1216
|
-
const profileSubagent = profileConfig?.[subagentName] ?? {};
|
|
1217
|
-
const merged = { ...globalSubagent, ...profileSubagent };
|
|
1218
|
-
const configModel = merged.model ?? globalDefaultModel ?? INHERIT_MODEL;
|
|
1219
|
-
resolved.model = configModel === INHERIT_MODEL ? parentModel : configModel;
|
|
1220
|
-
for (const [key, value] of Object.entries(merged)) {
|
|
1221
|
-
if (key !== "model") {
|
|
1222
|
-
resolved[key] = value;
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
return resolved;
|
|
1226
|
-
}
|
|
1227
|
-
function buildSubagentConfigMap(parentModel, profileConfig, globalConfig) {
|
|
1228
|
-
const subagentNames = /* @__PURE__ */ new Set();
|
|
1229
|
-
if (globalConfig) {
|
|
1230
|
-
for (const key of Object.keys(globalConfig)) {
|
|
1231
|
-
if (key !== "default-model" && typeof globalConfig[key] === "object") {
|
|
1232
|
-
subagentNames.add(key);
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
if (profileConfig) {
|
|
1237
|
-
for (const key of Object.keys(profileConfig)) {
|
|
1238
|
-
subagentNames.add(key);
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
const result = {};
|
|
1242
|
-
for (const name of subagentNames) {
|
|
1243
|
-
result[name] = resolveSubagentConfig(name, parentModel, profileConfig, globalConfig);
|
|
1244
|
-
}
|
|
1245
|
-
return result;
|
|
1246
|
-
}
|
|
1247
|
-
function extractSubagentConfig(globalConfig, subagentName) {
|
|
1248
|
-
if (!globalConfig) {
|
|
1249
|
-
return {};
|
|
1250
|
-
}
|
|
1251
|
-
const value = globalConfig[subagentName];
|
|
1252
|
-
if (typeof value === "object" && value !== null) {
|
|
1253
|
-
return value;
|
|
1254
|
-
}
|
|
1255
|
-
return {};
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
1207
|
// src/file-utils.ts
|
|
1259
1208
|
import { readFile, stat } from "fs/promises";
|
|
1260
1209
|
import { resolve as resolve2 } from "path";
|
|
@@ -3599,6 +3548,54 @@ function configToAgentOptions(config) {
|
|
|
3599
3548
|
return result;
|
|
3600
3549
|
}
|
|
3601
3550
|
|
|
3551
|
+
// src/subagent-config.ts
|
|
3552
|
+
var INHERIT_MODEL = "inherit";
|
|
3553
|
+
function resolveSubagentConfig(subagentName, parentModel, profileConfig, globalConfig) {
|
|
3554
|
+
const resolved = {};
|
|
3555
|
+
const globalDefaultModel = globalConfig?.["default-model"];
|
|
3556
|
+
const globalSubagent = extractSubagentConfig(globalConfig, subagentName);
|
|
3557
|
+
const profileSubagent = profileConfig?.[subagentName] ?? {};
|
|
3558
|
+
const merged = { ...globalSubagent, ...profileSubagent };
|
|
3559
|
+
const configModel = merged.model ?? globalDefaultModel ?? INHERIT_MODEL;
|
|
3560
|
+
resolved.model = configModel === INHERIT_MODEL ? parentModel : configModel;
|
|
3561
|
+
for (const [key, value] of Object.entries(merged)) {
|
|
3562
|
+
if (key !== "model") {
|
|
3563
|
+
resolved[key] = value;
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
return resolved;
|
|
3567
|
+
}
|
|
3568
|
+
function buildSubagentConfigMap(parentModel, profileConfig, globalConfig) {
|
|
3569
|
+
const subagentNames = /* @__PURE__ */ new Set();
|
|
3570
|
+
if (globalConfig) {
|
|
3571
|
+
for (const key of Object.keys(globalConfig)) {
|
|
3572
|
+
if (key !== "default-model" && typeof globalConfig[key] === "object") {
|
|
3573
|
+
subagentNames.add(key);
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
if (profileConfig) {
|
|
3578
|
+
for (const key of Object.keys(profileConfig)) {
|
|
3579
|
+
subagentNames.add(key);
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
const result = {};
|
|
3583
|
+
for (const name of subagentNames) {
|
|
3584
|
+
result[name] = resolveSubagentConfig(name, parentModel, profileConfig, globalConfig);
|
|
3585
|
+
}
|
|
3586
|
+
return result;
|
|
3587
|
+
}
|
|
3588
|
+
function extractSubagentConfig(globalConfig, subagentName) {
|
|
3589
|
+
if (!globalConfig) {
|
|
3590
|
+
return {};
|
|
3591
|
+
}
|
|
3592
|
+
const value = globalConfig[subagentName];
|
|
3593
|
+
if (typeof value === "object" && value !== null) {
|
|
3594
|
+
return value;
|
|
3595
|
+
}
|
|
3596
|
+
return {};
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3602
3599
|
// src/tui/block-renderer.ts
|
|
3603
3600
|
import { Box } from "@unblessed/node";
|
|
3604
3601
|
|
|
@@ -6878,6 +6875,25 @@ var TUIApp = class _TUIApp {
|
|
|
6878
6875
|
};
|
|
6879
6876
|
}
|
|
6880
6877
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
6878
|
+
// Memory Cleanup (REPL mode)
|
|
6879
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
6880
|
+
/**
|
|
6881
|
+
* Clear all blocks and reset BlockRenderer state.
|
|
6882
|
+
* CRITICAL for REPL mode to prevent memory leaks between iterations.
|
|
6883
|
+
*
|
|
6884
|
+
* Call this after each agent run completes (after unsubscribing from tree).
|
|
6885
|
+
*/
|
|
6886
|
+
clearBlockRenderer() {
|
|
6887
|
+
this.blockRenderer.clear();
|
|
6888
|
+
}
|
|
6889
|
+
/**
|
|
6890
|
+
* Clear status bar activity state.
|
|
6891
|
+
* Called between REPL turns to prevent stale state.
|
|
6892
|
+
*/
|
|
6893
|
+
clearStatusBar() {
|
|
6894
|
+
this.statusBar.clearActivity();
|
|
6895
|
+
}
|
|
6896
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
6881
6897
|
// Abort Control (delegated to controller)
|
|
6882
6898
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
6883
6899
|
/**
|
|
@@ -7406,6 +7422,10 @@ ${ctx.gadgetName} requires interactive approval. Run in a terminal to approve.`
|
|
|
7406
7422
|
if (unsubscribeTree) {
|
|
7407
7423
|
unsubscribeTree();
|
|
7408
7424
|
}
|
|
7425
|
+
if (tui) {
|
|
7426
|
+
tui.clearBlockRenderer();
|
|
7427
|
+
tui.clearStatusBar();
|
|
7428
|
+
}
|
|
7409
7429
|
};
|
|
7410
7430
|
if (tui) {
|
|
7411
7431
|
tui.onMidSessionInput((message) => {
|
|
@@ -7442,10 +7462,7 @@ ${ctx.gadgetName} requires interactive approval. Run in a terminal to approve.`
|
|
|
7442
7462
|
}
|
|
7443
7463
|
}
|
|
7444
7464
|
function registerAgentCommand(program, env, config, globalSubagents) {
|
|
7445
|
-
const cmd = program.command(COMMANDS.agent).description("Run the llmist agent loop with optional gadgets.").argument(
|
|
7446
|
-
"[prompt]",
|
|
7447
|
-
"Prompt for the agent loop. Falls back to stdin when available."
|
|
7448
|
-
);
|
|
7465
|
+
const cmd = program.command(COMMANDS.agent).description("Run the llmist agent loop with optional gadgets.").argument("[prompt]", "Prompt for the agent loop. Falls back to stdin when available.");
|
|
7449
7466
|
addAgentOptions(cmd, config);
|
|
7450
7467
|
cmd.action(
|
|
7451
7468
|
(prompt, options) => executeAction(() => {
|