open-agents-ai 0.184.94 → 0.184.96

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/index.js +457 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31532,7 +31532,7 @@ var require_validation = __commonJS({
31532
31532
  var require_receiver = __commonJS({
31533
31533
  "node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/receiver.js"(exports, module) {
31534
31534
  "use strict";
31535
- var { Writable: Writable2 } = __require("stream");
31535
+ var { Writable } = __require("stream");
31536
31536
  var PerMessageDeflate = require_permessage_deflate();
31537
31537
  var {
31538
31538
  BINARY_TYPES,
@@ -31550,7 +31550,7 @@ var require_receiver = __commonJS({
31550
31550
  var GET_DATA = 4;
31551
31551
  var INFLATING = 5;
31552
31552
  var DEFER_EVENT = 6;
31553
- var Receiver2 = class extends Writable2 {
31553
+ var Receiver2 = class extends Writable {
31554
31554
  /**
31555
31555
  * Creates a Receiver instance.
31556
31556
  *
@@ -32994,7 +32994,7 @@ var require_extension = __commonJS({
32994
32994
  var require_websocket = __commonJS({
32995
32995
  "node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket.js"(exports, module) {
32996
32996
  "use strict";
32997
- var EventEmitter7 = __require("events");
32997
+ var EventEmitter8 = __require("events");
32998
32998
  var https2 = __require("https");
32999
32999
  var http2 = __require("http");
33000
33000
  var net = __require("net");
@@ -33026,7 +33026,7 @@ var require_websocket = __commonJS({
33026
33026
  var protocolVersions = [8, 13];
33027
33027
  var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
33028
33028
  var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
33029
- var WebSocket2 = class _WebSocket extends EventEmitter7 {
33029
+ var WebSocket2 = class _WebSocket extends EventEmitter8 {
33030
33030
  /**
33031
33031
  * Create a new `WebSocket`.
33032
33032
  *
@@ -34023,7 +34023,7 @@ var require_subprotocol = __commonJS({
34023
34023
  var require_websocket_server = __commonJS({
34024
34024
  "node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket-server.js"(exports, module) {
34025
34025
  "use strict";
34026
- var EventEmitter7 = __require("events");
34026
+ var EventEmitter8 = __require("events");
34027
34027
  var http2 = __require("http");
34028
34028
  var { Duplex } = __require("stream");
34029
34029
  var { createHash: createHash7 } = __require("crypto");
@@ -34036,7 +34036,7 @@ var require_websocket_server = __commonJS({
34036
34036
  var RUNNING = 0;
34037
34037
  var CLOSING = 1;
34038
34038
  var CLOSED = 2;
34039
- var WebSocketServer2 = class extends EventEmitter7 {
34039
+ var WebSocketServer2 = class extends EventEmitter8 {
34040
34040
  /**
34041
34041
  * Create a `WebSocketServer` instance.
34042
34042
  *
@@ -40311,7 +40311,7 @@ function tuiSelect(opts) {
40311
40311
  }
40312
40312
  if (rl) {
40313
40313
  rl.resume();
40314
- rl.prompt(false);
40314
+ rl.prompt?.(false);
40315
40315
  }
40316
40316
  }
40317
40317
  function onData(chunk) {
@@ -62320,6 +62320,37 @@ ${CONTENT_BG_SEQ}`);
62320
62320
  }
62321
62321
  };
62322
62322
  }
62323
+ /**
62324
+ * Hook into DirectInput — the blessed-style replacement for readline.
62325
+ * DirectInput emits named events for all special keys, so no monkey-patching needed.
62326
+ */
62327
+ hookDirectInput(di, onEscape, onCtrlO) {
62328
+ const self = this;
62329
+ if (onEscape)
62330
+ di.on("escape", () => onEscape());
62331
+ if (onCtrlO)
62332
+ di.on("ctrl-o", () => onCtrlO());
62333
+ di.on("pageup", () => self.pageUpContent());
62334
+ di.on("pagedown", () => self.pageDownContent());
62335
+ di.on("shiftup", () => self.scrollContentUp(3));
62336
+ di.on("shiftdown", () => self.scrollContentDown(3));
62337
+ di.on("tab-empty", () => self.cycleFocus());
62338
+ di.on("ctrl-backslash", () => self.cycleFocus());
62339
+ di.on("up", () => {
62340
+ if (self.writeDepth > 0 || self._contentScrollOffset > 0) {
62341
+ self.scrollContentUp(1);
62342
+ } else {
62343
+ di.historyUp();
62344
+ }
62345
+ });
62346
+ di.on("down", () => {
62347
+ if (self.writeDepth > 0 || self._contentScrollOffset > 0) {
62348
+ self.scrollContentDown(1);
62349
+ } else {
62350
+ di.historyDown();
62351
+ }
62352
+ });
62353
+ }
62323
62354
  hookStdin() {
62324
62355
  if (this.stdinHooked)
62325
62356
  return;
@@ -62439,6 +62470,413 @@ var init_mouse_filter = __esm({
62439
62470
  }
62440
62471
  });
62441
62472
 
62473
+ // packages/cli/dist/tui/direct-input.js
62474
+ var direct_input_exports = {};
62475
+ __export(direct_input_exports, {
62476
+ DirectInput: () => DirectInput
62477
+ });
62478
+ import { EventEmitter as EventEmitter7 } from "node:events";
62479
+ var DirectInput;
62480
+ var init_direct_input = __esm({
62481
+ "packages/cli/dist/tui/direct-input.js"() {
62482
+ "use strict";
62483
+ DirectInput = class extends EventEmitter7 {
62484
+ /** Current input line text */
62485
+ line = "";
62486
+ /** Cursor position within .line (0-based) */
62487
+ cursor = 0;
62488
+ _history;
62489
+ _historySize;
62490
+ _historyIndex = -1;
62491
+ _savedLine = "";
62492
+ // saved current input when navigating history
62493
+ _completer = null;
62494
+ _paused = false;
62495
+ _closed = false;
62496
+ _input;
62497
+ _buffer = "";
62498
+ // partial escape sequence buffer
62499
+ _flushTimer = null;
62500
+ constructor(input, options) {
62501
+ super();
62502
+ this._input = input;
62503
+ this._history = [...options?.history ?? []];
62504
+ this._historySize = options?.historySize ?? 500;
62505
+ this._completer = options?.completer ?? null;
62506
+ input.on("data", (chunk) => {
62507
+ if (this._paused || this._closed)
62508
+ return;
62509
+ this.feed(chunk.toString("utf8"));
62510
+ });
62511
+ input.on("end", () => {
62512
+ if (!this._closed)
62513
+ this.close();
62514
+ });
62515
+ }
62516
+ /** Process raw input data — parse escape sequences and printable chars */
62517
+ feed(data) {
62518
+ this._buffer += data;
62519
+ this._processBuffer();
62520
+ }
62521
+ /** Pause input processing (for overlay transitions) */
62522
+ pause() {
62523
+ this._paused = true;
62524
+ }
62525
+ /** Resume input processing */
62526
+ resume() {
62527
+ this._paused = false;
62528
+ }
62529
+ /** Close the input handler */
62530
+ close() {
62531
+ if (this._closed)
62532
+ return;
62533
+ this._closed = true;
62534
+ if (this._flushTimer) {
62535
+ clearTimeout(this._flushTimer);
62536
+ this._flushTimer = null;
62537
+ }
62538
+ this.emit("close");
62539
+ }
62540
+ /** No-op — readline compat (StatusBar renders the prompt, not us) */
62541
+ setPrompt(_prompt) {
62542
+ }
62543
+ /** No-op — readline compat */
62544
+ prompt(_preserveCursor) {
62545
+ }
62546
+ /** Set the line content and cursor position (for Esc-to-recall) */
62547
+ setLine(text, cursorPos) {
62548
+ this.line = text;
62549
+ this.cursor = cursorPos ?? text.length;
62550
+ }
62551
+ /** Navigate history up (older) */
62552
+ historyUp() {
62553
+ if (this._history.length === 0)
62554
+ return;
62555
+ if (this._historyIndex === -1) {
62556
+ this._savedLine = this.line;
62557
+ }
62558
+ if (this._historyIndex < this._history.length - 1) {
62559
+ this._historyIndex++;
62560
+ this.line = this._history[this._historyIndex];
62561
+ this.cursor = this.line.length;
62562
+ }
62563
+ }
62564
+ /** Navigate history down (newer) */
62565
+ historyDown() {
62566
+ if (this._historyIndex <= -1)
62567
+ return;
62568
+ this._historyIndex--;
62569
+ if (this._historyIndex === -1) {
62570
+ this.line = this._savedLine;
62571
+ } else {
62572
+ this.line = this._history[this._historyIndex];
62573
+ }
62574
+ this.cursor = this.line.length;
62575
+ }
62576
+ // ---------------------------------------------------------------------------
62577
+ // Private: buffer processing and escape sequence parsing
62578
+ // ---------------------------------------------------------------------------
62579
+ _processBuffer() {
62580
+ let i = 0;
62581
+ while (i < this._buffer.length) {
62582
+ const ch = this._buffer[i];
62583
+ const code = ch.charCodeAt(0);
62584
+ if (code === 27) {
62585
+ const remaining = this._buffer.slice(i);
62586
+ if (remaining.length >= 2 && remaining[1] === "[") {
62587
+ const mouseMatch = remaining.match(/^\x1B\[<(\d+);(\d+);(\d+)([Mm])/);
62588
+ if (mouseMatch) {
62589
+ i += mouseMatch[0].length;
62590
+ continue;
62591
+ }
62592
+ if (remaining.startsWith("\x1B[<") && remaining.length < 15) {
62593
+ break;
62594
+ }
62595
+ const csiMatch = remaining.match(/^\x1B\[([0-9;]*)([A-Za-z~])/);
62596
+ if (csiMatch) {
62597
+ this._handleCSI(csiMatch[1], csiMatch[2]);
62598
+ i += csiMatch[0].length;
62599
+ continue;
62600
+ }
62601
+ if (remaining.length < 10) {
62602
+ break;
62603
+ }
62604
+ i += 2;
62605
+ continue;
62606
+ }
62607
+ if (remaining.length >= 2 && remaining[1] === "O") {
62608
+ if (remaining.length >= 3) {
62609
+ this._handleSS3(remaining[2]);
62610
+ i += 3;
62611
+ continue;
62612
+ }
62613
+ break;
62614
+ }
62615
+ if (remaining.length === 1) {
62616
+ break;
62617
+ }
62618
+ i++;
62619
+ continue;
62620
+ }
62621
+ if (code < 32 || code === 127) {
62622
+ this._handleControl(code);
62623
+ i++;
62624
+ continue;
62625
+ }
62626
+ const char = this._buffer[i];
62627
+ this.line = this.line.slice(0, this.cursor) + char + this.line.slice(this.cursor);
62628
+ this.cursor++;
62629
+ i++;
62630
+ }
62631
+ this._buffer = this._buffer.slice(i);
62632
+ if (this._buffer.length > 0) {
62633
+ if (this._flushTimer)
62634
+ clearTimeout(this._flushTimer);
62635
+ this._flushTimer = setTimeout(() => {
62636
+ this._flushTimer = null;
62637
+ if (this._buffer.length > 0) {
62638
+ if (this._buffer === "\x1B") {
62639
+ this.emit("escape");
62640
+ }
62641
+ this._buffer = "";
62642
+ }
62643
+ }, 50);
62644
+ } else {
62645
+ if (this._flushTimer) {
62646
+ clearTimeout(this._flushTimer);
62647
+ this._flushTimer = null;
62648
+ }
62649
+ }
62650
+ }
62651
+ /** Handle CSI escape sequence: \x1B[ {params} {final} */
62652
+ _handleCSI(params, final) {
62653
+ switch (final) {
62654
+ case "A":
62655
+ if (params === "1;2") {
62656
+ this.emit("shiftup");
62657
+ return;
62658
+ }
62659
+ this.emit("up");
62660
+ return;
62661
+ case "B":
62662
+ if (params === "1;2") {
62663
+ this.emit("shiftdown");
62664
+ return;
62665
+ }
62666
+ this.emit("down");
62667
+ return;
62668
+ case "C":
62669
+ if (params === "1;5") {
62670
+ this._wordRight();
62671
+ return;
62672
+ }
62673
+ if (this.cursor < this.line.length)
62674
+ this.cursor++;
62675
+ return;
62676
+ case "D":
62677
+ if (params === "1;5") {
62678
+ this._wordLeft();
62679
+ return;
62680
+ }
62681
+ if (this.cursor > 0)
62682
+ this.cursor--;
62683
+ return;
62684
+ case "H":
62685
+ this.cursor = 0;
62686
+ return;
62687
+ case "F":
62688
+ this.cursor = this.line.length;
62689
+ return;
62690
+ case "~":
62691
+ if (params === "3") {
62692
+ if (this.cursor < this.line.length) {
62693
+ this.line = this.line.slice(0, this.cursor) + this.line.slice(this.cursor + 1);
62694
+ }
62695
+ return;
62696
+ }
62697
+ if (params === "5") {
62698
+ this.emit("pageup");
62699
+ return;
62700
+ }
62701
+ if (params === "6") {
62702
+ this.emit("pagedown");
62703
+ return;
62704
+ }
62705
+ return;
62706
+ case "u":
62707
+ return;
62708
+ }
62709
+ }
62710
+ /** Handle SS3 sequence: \x1BO {final} (some terminals use this for arrows/Home/End) */
62711
+ _handleSS3(final) {
62712
+ switch (final) {
62713
+ case "A":
62714
+ this.emit("up");
62715
+ return;
62716
+ case "B":
62717
+ this.emit("down");
62718
+ return;
62719
+ case "C":
62720
+ if (this.cursor < this.line.length)
62721
+ this.cursor++;
62722
+ return;
62723
+ case "D":
62724
+ if (this.cursor > 0)
62725
+ this.cursor--;
62726
+ return;
62727
+ case "H":
62728
+ this.cursor = 0;
62729
+ return;
62730
+ case "F":
62731
+ this.cursor = this.line.length;
62732
+ return;
62733
+ }
62734
+ }
62735
+ /** Handle control characters (ASCII < 32 and DEL) */
62736
+ _handleControl(code) {
62737
+ switch (code) {
62738
+ case 13:
62739
+ // Enter (CR)
62740
+ case 10:
62741
+ this._submit();
62742
+ return;
62743
+ case 127:
62744
+ // Backspace (DEL)
62745
+ case 8:
62746
+ if (this.cursor > 0) {
62747
+ this.line = this.line.slice(0, this.cursor - 1) + this.line.slice(this.cursor);
62748
+ this.cursor--;
62749
+ }
62750
+ return;
62751
+ case 3:
62752
+ this.emit("SIGINT");
62753
+ return;
62754
+ case 4:
62755
+ if (this.line.length === 0)
62756
+ this.close();
62757
+ return;
62758
+ case 9:
62759
+ this._handleTab();
62760
+ return;
62761
+ case 23:
62762
+ this._deleteWordLeft();
62763
+ return;
62764
+ case 21:
62765
+ this.line = this.line.slice(this.cursor);
62766
+ this.cursor = 0;
62767
+ return;
62768
+ case 11:
62769
+ this.line = this.line.slice(0, this.cursor);
62770
+ return;
62771
+ case 1:
62772
+ this.cursor = 0;
62773
+ return;
62774
+ case 5:
62775
+ this.cursor = this.line.length;
62776
+ return;
62777
+ case 15:
62778
+ this.emit("ctrl-o");
62779
+ return;
62780
+ case 28:
62781
+ this.emit("ctrl-backslash");
62782
+ return;
62783
+ }
62784
+ }
62785
+ /** Submit the current line */
62786
+ _submit() {
62787
+ const line = this.line;
62788
+ if (line.trim() && (this._history.length === 0 || this._history[0] !== line)) {
62789
+ this._history.unshift(line);
62790
+ if (this._history.length > this._historySize) {
62791
+ this._history.length = this._historySize;
62792
+ }
62793
+ }
62794
+ this._historyIndex = -1;
62795
+ this._savedLine = "";
62796
+ this.line = "";
62797
+ this.cursor = 0;
62798
+ this.emit("line", line);
62799
+ }
62800
+ /** Handle Tab completion */
62801
+ _handleTab() {
62802
+ if (this.line.length === 0) {
62803
+ this.emit("tab-empty");
62804
+ return;
62805
+ }
62806
+ if (!this._completer)
62807
+ return;
62808
+ this._completer(this.line, (err, result) => {
62809
+ if (err || !result)
62810
+ return;
62811
+ const [completions, substring] = result;
62812
+ if (completions.length === 0)
62813
+ return;
62814
+ if (completions.length === 1) {
62815
+ const completion = completions[0];
62816
+ const before = this.line.slice(0, this.cursor);
62817
+ const idx = before.lastIndexOf(substring);
62818
+ if (idx >= 0) {
62819
+ this.line = before.slice(0, idx) + completion + this.line.slice(this.cursor);
62820
+ this.cursor = idx + completion.length;
62821
+ }
62822
+ } else if (completions.length > 1) {
62823
+ let common = completions[0];
62824
+ for (let i = 1; i < completions.length; i++) {
62825
+ const other = completions[i];
62826
+ let j = 0;
62827
+ while (j < common.length && j < other.length && common[j] === other[j])
62828
+ j++;
62829
+ common = common.slice(0, j);
62830
+ }
62831
+ if (common.length > substring.length) {
62832
+ const before = this.line.slice(0, this.cursor);
62833
+ const idx = before.lastIndexOf(substring);
62834
+ if (idx >= 0) {
62835
+ this.line = before.slice(0, idx) + common + this.line.slice(this.cursor);
62836
+ this.cursor = idx + common.length;
62837
+ }
62838
+ }
62839
+ }
62840
+ });
62841
+ }
62842
+ /** Move cursor left by one word */
62843
+ _wordLeft() {
62844
+ if (this.cursor === 0)
62845
+ return;
62846
+ let i = this.cursor - 1;
62847
+ while (i > 0 && /\s/.test(this.line[i]))
62848
+ i--;
62849
+ while (i > 0 && /\S/.test(this.line[i - 1]))
62850
+ i--;
62851
+ this.cursor = i;
62852
+ }
62853
+ /** Move cursor right by one word */
62854
+ _wordRight() {
62855
+ if (this.cursor >= this.line.length)
62856
+ return;
62857
+ let i = this.cursor;
62858
+ while (i < this.line.length && /\S/.test(this.line[i]))
62859
+ i++;
62860
+ while (i < this.line.length && /\s/.test(this.line[i]))
62861
+ i++;
62862
+ this.cursor = i;
62863
+ }
62864
+ /** Delete word left of cursor (Ctrl+W) */
62865
+ _deleteWordLeft() {
62866
+ if (this.cursor === 0)
62867
+ return;
62868
+ let i = this.cursor - 1;
62869
+ while (i > 0 && /\s/.test(this.line[i]))
62870
+ i--;
62871
+ while (i > 0 && /\S/.test(this.line[i - 1]))
62872
+ i--;
62873
+ this.line = this.line.slice(0, i) + this.line.slice(this.cursor);
62874
+ this.cursor = i;
62875
+ }
62876
+ };
62877
+ }
62878
+ });
62879
+
62442
62880
  // packages/cli/dist/api/profiles.js
62443
62881
  import { existsSync as existsSync51, readFileSync as readFileSync40, writeFileSync as writeFileSync24, mkdirSync as mkdirSync25, readdirSync as readdirSync19, unlinkSync as unlinkSync12 } from "node:fs";
62444
62882
  import { join as join68 } from "node:path";
@@ -64038,8 +64476,6 @@ var init_serve = __esm({
64038
64476
  });
64039
64477
 
64040
64478
  // packages/cli/dist/tui/interactive.js
64041
- import * as readline2 from "node:readline";
64042
- import { Writable } from "node:stream";
64043
64479
  import { cwd } from "node:process";
64044
64480
  import { resolve as resolve32, join as join70, dirname as dirname21, extname as extname11 } from "node:path";
64045
64481
  import { createRequire as createRequire4 } from "node:module";
@@ -65974,18 +66410,18 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
65974
66410
  } catch {
65975
66411
  }
65976
66412
  });
65977
- const rl = readline2.createInterface({
65978
- input: mouseFilter,
65979
- output: process.stdout,
65980
- prompt: idlePrompt,
65981
- terminal: true,
65982
- historySize: MAX_HISTORY_LINES,
66413
+ const { DirectInput: DirectInput2 } = await Promise.resolve().then(() => (init_direct_input(), direct_input_exports));
66414
+ const rl = new DirectInput2(mouseFilter, {
65983
66415
  history: savedHistory,
65984
- completer
66416
+ historySize: MAX_HISTORY_LINES,
66417
+ completer: (line, cb) => {
66418
+ const result = completer(line);
66419
+ cb(null, result);
66420
+ }
65985
66421
  });
65986
- origTtyWriteRef = rl._ttyWrite?.bind(rl) ?? null;
66422
+ origTtyWriteRef = null;
65987
66423
  let _escapeHandler = null;
65988
- statusBar.hookReadlineScroll(rl, () => {
66424
+ statusBar.hookDirectInput(rl, () => {
65989
66425
  _escapeHandler?.();
65990
66426
  }, () => {
65991
66427
  if (sudoPromptPending) {
@@ -66028,7 +66464,6 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
66028
66464
  }
66029
66465
  })();
66030
66466
  });
66031
- rl.output = null;
66032
66467
  if (process.stdin.isTTY && typeof process.stdin.setRawMode === "function") {
66033
66468
  process.stdin.setRawMode(true);
66034
66469
  }
@@ -66053,7 +66488,6 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
66053
66488
  statusBar.setPromptText(idlePrompt, 2);
66054
66489
  statusBar.setCompletions(allCompletions);
66055
66490
  if (statusBar.isActive) {
66056
- rl.output = new Writable({ write: (_c, _e, cb) => cb() });
66057
66491
  statusBar.setInputStateProvider(() => ({
66058
66492
  line: rl.line ?? "",
66059
66493
  cursor: rl.cursor ?? 0
@@ -66980,7 +67414,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
66980
67414
  writeContent(() => renderInfo(`Heard: "${text}" ${c2.dim("(press Enter to submit)")}`));
66981
67415
  } else if (isFinal) {
66982
67416
  writeContent(() => renderInfo(`Auto-submitting: "${text}"`));
66983
- rl.write(text + "\n");
67417
+ rl.feed(text + "\n");
66984
67418
  } else {
66985
67419
  writeContent(() => renderInfo(`Hearing: "${text}"`));
66986
67420
  }
@@ -67126,7 +67560,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
67126
67560
  agent.handleTranscript(text);
67127
67561
  }
67128
67562
  if (callSubAgents.size === 0) {
67129
- rl.write(text + "\n");
67563
+ rl.feed(text + "\n");
67130
67564
  }
67131
67565
  }
67132
67566
  });
@@ -67733,7 +68167,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
67733
68167
  const timedOut = result.timedOut === true;
67734
68168
  if (timedOut) {
67735
68169
  try {
67736
- rl.write?.("\x1B");
68170
+ rl.feed("\x1B");
67737
68171
  } catch {
67738
68172
  }
67739
68173
  await new Promise((r) => setTimeout(r, 100));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.184.94",
3
+ "version": "0.184.96",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",