@harperfast/agent 0.12.0 → 0.12.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.
Files changed (2) hide show
  1. package/dist/agent.js +32 -9
  2. package/package.json +1 -1
package/dist/agent.js CHANGED
@@ -2284,7 +2284,7 @@ var compactionModelSettings = {
2284
2284
  };
2285
2285
 
2286
2286
  // utils/shell/askQuestion.ts
2287
- import { createInterface } from "readline/promises";
2287
+ import { createInterface } from "readline";
2288
2288
 
2289
2289
  // lifecycle/handleExit.ts
2290
2290
  async function handleExit() {
@@ -2296,16 +2296,39 @@ async function handleExit() {
2296
2296
  async function askQuestion(query) {
2297
2297
  const rl = createInterface({
2298
2298
  input: process.stdin,
2299
- output: process.stdout
2299
+ output: process.stdout,
2300
+ terminal: true
2300
2301
  });
2301
2302
  rl.on("SIGINT", handleExit);
2302
- try {
2303
- const response = await rl.question(query);
2304
- console.log("");
2305
- return response;
2306
- } finally {
2307
- rl.close();
2308
- }
2303
+ return await new Promise((resolve2) => {
2304
+ const lines = [];
2305
+ let timer = null;
2306
+ let finished = false;
2307
+ const DEBOUNCE_MS = 75;
2308
+ const finish = () => {
2309
+ if (finished) {
2310
+ return;
2311
+ }
2312
+ finished = true;
2313
+ if (timer) {
2314
+ clearTimeout(timer);
2315
+ }
2316
+ rl.removeListener("line", onLine);
2317
+ console.log("");
2318
+ rl.close();
2319
+ resolve2(lines.join("\n"));
2320
+ };
2321
+ const onLine = (line) => {
2322
+ lines.push(line);
2323
+ if (timer) {
2324
+ clearTimeout(timer);
2325
+ }
2326
+ timer = setTimeout(finish, DEBOUNCE_MS);
2327
+ };
2328
+ rl.on("line", onLine);
2329
+ rl.setPrompt(query);
2330
+ rl.prompt();
2331
+ });
2309
2332
  }
2310
2333
 
2311
2334
  // utils/shell/ensureApiKey.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@harperfast/agent",
3
3
  "description": "AI to help you with Harper app management",
4
- "version": "0.12.0",
4
+ "version": "0.12.1",
5
5
  "main": "dist/agent.js",
6
6
  "repository": "github:HarperFast/harper-agent",
7
7
  "bugs": {