min-agent 0.1.8 → 0.1.9
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/agent.js +8 -6
- package/dist/cli.js +7 -1
- package/dist/confirm.js +2 -0
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -161,10 +161,11 @@ export async function runChat(modelId, resumeSessionId) {
|
|
|
161
161
|
rl.close();
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
// Listen for ESC key to cancel running agent task
|
|
164
|
+
// Listen for ESC key to cancel running agent task via keypress events
|
|
165
165
|
if (process.stdin.isTTY) {
|
|
166
|
-
process.stdin
|
|
167
|
-
|
|
166
|
+
readline.emitKeypressEvents(process.stdin, rl);
|
|
167
|
+
process.stdin.on("keypress", (_ch, key) => {
|
|
168
|
+
if (key && key.name === "escape" && abortController) {
|
|
168
169
|
killActiveProcesses();
|
|
169
170
|
abortController.abort();
|
|
170
171
|
abortController = null;
|
|
@@ -282,10 +283,11 @@ export async function runCode(modelId, resumeSessionId) {
|
|
|
282
283
|
rl.close();
|
|
283
284
|
}
|
|
284
285
|
});
|
|
285
|
-
// Listen for ESC key to cancel running agent task
|
|
286
|
+
// Listen for ESC key to cancel running agent task via keypress events
|
|
286
287
|
if (process.stdin.isTTY) {
|
|
287
|
-
process.stdin
|
|
288
|
-
|
|
288
|
+
readline.emitKeypressEvents(process.stdin, rl);
|
|
289
|
+
process.stdin.on("keypress", (_ch, key) => {
|
|
290
|
+
if (key && key.name === "escape" && abortController) {
|
|
289
291
|
killActiveProcesses();
|
|
290
292
|
abortController.abort();
|
|
291
293
|
abortController = null;
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { discoverSkills, getSkills } from "./skills.js";
|
|
|
4
4
|
import { loadMemories, addMemory, deleteMemory, searchMemories } from "./memory.js";
|
|
5
5
|
import { runSetup, isConfigured, loadConfig, saveConfig, fetchModels, getConfigDir, getRulesFile } from "./config.js";
|
|
6
6
|
import { setAutoApprove } from "./confirm.js";
|
|
7
|
-
import { existsSync, writeFileSync, mkdirSync } from "fs";
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
8
8
|
import path from "path";
|
|
9
9
|
const rawArgs = process.argv.slice(2);
|
|
10
10
|
// Extract leading global flags only, so subcommands can still use "-y"
|
|
@@ -108,6 +108,12 @@ async function main() {
|
|
|
108
108
|
printUsage();
|
|
109
109
|
process.exit(0);
|
|
110
110
|
}
|
|
111
|
+
if (args[0] === "--version" || args[0] === "-v") {
|
|
112
|
+
const pkgPath = path.resolve(path.dirname(new URL(import.meta.url).pathname), "../package.json");
|
|
113
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
114
|
+
console.log(pkg.version);
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
111
117
|
const command = args[0];
|
|
112
118
|
switch (command) {
|
|
113
119
|
case "setup": {
|
package/dist/confirm.js
CHANGED
|
@@ -21,6 +21,8 @@ export async function confirm(message) {
|
|
|
21
21
|
const wasRaw = process.stdin.isRaw;
|
|
22
22
|
if (process.stdin.isTTY)
|
|
23
23
|
process.stdin.setRawMode(true);
|
|
24
|
+
// Ensure stdin is flowing so we can receive data even after readline pause
|
|
25
|
+
process.stdin.resume();
|
|
24
26
|
const onData = (buf) => {
|
|
25
27
|
const ch = buf.toString();
|
|
26
28
|
process.stdin.removeListener("data", onData);
|