open-agents-ai 0.184.93 → 0.184.95
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/index.js +467 -31
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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) {
|
|
@@ -53729,12 +53729,13 @@ var init_banner = __esm({
|
|
|
53729
53729
|
}
|
|
53730
53730
|
buf += "\x1B[0m";
|
|
53731
53731
|
}
|
|
53732
|
-
|
|
53733
|
-
const inputRow = termRows - 2;
|
|
53734
|
-
buf += `\x1B[${inputRow};1H\x1B[0m\x1B[?2026l`;
|
|
53732
|
+
buf += "\x1B[0m";
|
|
53735
53733
|
process.stdout.write(buf);
|
|
53736
53734
|
if (this.onAfterRender)
|
|
53737
53735
|
this.onAfterRender();
|
|
53736
|
+
const termRows = process.stdout.rows ?? 24;
|
|
53737
|
+
const inputRow = termRows - 2;
|
|
53738
|
+
process.stdout.write(`\x1B[${inputRow};1H\x1B[?2026l`);
|
|
53738
53739
|
}
|
|
53739
53740
|
/** Handle terminal resize */
|
|
53740
53741
|
handleResize() {
|
|
@@ -62319,6 +62320,37 @@ ${CONTENT_BG_SEQ}`);
|
|
|
62319
62320
|
}
|
|
62320
62321
|
};
|
|
62321
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
|
+
}
|
|
62322
62354
|
hookStdin() {
|
|
62323
62355
|
if (this.stdinHooked)
|
|
62324
62356
|
return;
|
|
@@ -62374,19 +62406,19 @@ var init_mouse_filter = __esm({
|
|
|
62374
62406
|
const mouseMatch = remaining.match(/^\x1B\[<(\d+);(\d+);(\d+)([Mm])/);
|
|
62375
62407
|
if (mouseMatch) {
|
|
62376
62408
|
const btn = parseInt(mouseMatch[1]);
|
|
62377
|
-
const row = parseInt(mouseMatch[3]);
|
|
62378
62409
|
const col = parseInt(mouseMatch[2]);
|
|
62410
|
+
const row = parseInt(mouseMatch[3]);
|
|
62379
62411
|
const suffix = mouseMatch[4];
|
|
62380
62412
|
if ((btn === 64 || btn === 96) && this.onScroll)
|
|
62381
62413
|
this.onScroll("up", 3, row);
|
|
62382
62414
|
else if ((btn === 65 || btn === 97) && this.onScroll)
|
|
62383
62415
|
this.onScroll("down", 3, row);
|
|
62384
62416
|
else if (this.onPointer) {
|
|
62385
|
-
if (btn === 0 && suffix === "M")
|
|
62417
|
+
if ((btn === 0 || btn === 1 || btn === 2) && suffix === "M")
|
|
62386
62418
|
this.onPointer("press", col, row);
|
|
62387
|
-
else if (btn
|
|
62419
|
+
else if (btn >= 32 && btn <= 35 && suffix === "M")
|
|
62388
62420
|
this.onPointer("drag", col, row);
|
|
62389
|
-
else if (
|
|
62421
|
+
else if (suffix === "m")
|
|
62390
62422
|
this.onPointer("release", col, row);
|
|
62391
62423
|
}
|
|
62392
62424
|
if (this.onActivity)
|
|
@@ -62438,6 +62470,405 @@ var init_mouse_filter = __esm({
|
|
|
62438
62470
|
}
|
|
62439
62471
|
});
|
|
62440
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 csiMatch = remaining.match(/^\x1B\[([0-9;]*)([A-Za-z~])/);
|
|
62588
|
+
if (csiMatch) {
|
|
62589
|
+
this._handleCSI(csiMatch[1], csiMatch[2]);
|
|
62590
|
+
i += csiMatch[0].length;
|
|
62591
|
+
continue;
|
|
62592
|
+
}
|
|
62593
|
+
if (remaining.length < 10) {
|
|
62594
|
+
break;
|
|
62595
|
+
}
|
|
62596
|
+
i += 2;
|
|
62597
|
+
continue;
|
|
62598
|
+
}
|
|
62599
|
+
if (remaining.length >= 2 && remaining[1] === "O") {
|
|
62600
|
+
if (remaining.length >= 3) {
|
|
62601
|
+
this._handleSS3(remaining[2]);
|
|
62602
|
+
i += 3;
|
|
62603
|
+
continue;
|
|
62604
|
+
}
|
|
62605
|
+
break;
|
|
62606
|
+
}
|
|
62607
|
+
if (remaining.length === 1) {
|
|
62608
|
+
break;
|
|
62609
|
+
}
|
|
62610
|
+
i++;
|
|
62611
|
+
continue;
|
|
62612
|
+
}
|
|
62613
|
+
if (code < 32 || code === 127) {
|
|
62614
|
+
this._handleControl(code);
|
|
62615
|
+
i++;
|
|
62616
|
+
continue;
|
|
62617
|
+
}
|
|
62618
|
+
const char = this._buffer[i];
|
|
62619
|
+
this.line = this.line.slice(0, this.cursor) + char + this.line.slice(this.cursor);
|
|
62620
|
+
this.cursor++;
|
|
62621
|
+
i++;
|
|
62622
|
+
}
|
|
62623
|
+
this._buffer = this._buffer.slice(i);
|
|
62624
|
+
if (this._buffer.length > 0) {
|
|
62625
|
+
if (this._flushTimer)
|
|
62626
|
+
clearTimeout(this._flushTimer);
|
|
62627
|
+
this._flushTimer = setTimeout(() => {
|
|
62628
|
+
this._flushTimer = null;
|
|
62629
|
+
if (this._buffer.length > 0) {
|
|
62630
|
+
if (this._buffer === "\x1B") {
|
|
62631
|
+
this.emit("escape");
|
|
62632
|
+
}
|
|
62633
|
+
this._buffer = "";
|
|
62634
|
+
}
|
|
62635
|
+
}, 50);
|
|
62636
|
+
} else {
|
|
62637
|
+
if (this._flushTimer) {
|
|
62638
|
+
clearTimeout(this._flushTimer);
|
|
62639
|
+
this._flushTimer = null;
|
|
62640
|
+
}
|
|
62641
|
+
}
|
|
62642
|
+
}
|
|
62643
|
+
/** Handle CSI escape sequence: \x1B[ {params} {final} */
|
|
62644
|
+
_handleCSI(params, final) {
|
|
62645
|
+
switch (final) {
|
|
62646
|
+
case "A":
|
|
62647
|
+
if (params === "1;2") {
|
|
62648
|
+
this.emit("shiftup");
|
|
62649
|
+
return;
|
|
62650
|
+
}
|
|
62651
|
+
this.emit("up");
|
|
62652
|
+
return;
|
|
62653
|
+
case "B":
|
|
62654
|
+
if (params === "1;2") {
|
|
62655
|
+
this.emit("shiftdown");
|
|
62656
|
+
return;
|
|
62657
|
+
}
|
|
62658
|
+
this.emit("down");
|
|
62659
|
+
return;
|
|
62660
|
+
case "C":
|
|
62661
|
+
if (params === "1;5") {
|
|
62662
|
+
this._wordRight();
|
|
62663
|
+
return;
|
|
62664
|
+
}
|
|
62665
|
+
if (this.cursor < this.line.length)
|
|
62666
|
+
this.cursor++;
|
|
62667
|
+
return;
|
|
62668
|
+
case "D":
|
|
62669
|
+
if (params === "1;5") {
|
|
62670
|
+
this._wordLeft();
|
|
62671
|
+
return;
|
|
62672
|
+
}
|
|
62673
|
+
if (this.cursor > 0)
|
|
62674
|
+
this.cursor--;
|
|
62675
|
+
return;
|
|
62676
|
+
case "H":
|
|
62677
|
+
this.cursor = 0;
|
|
62678
|
+
return;
|
|
62679
|
+
case "F":
|
|
62680
|
+
this.cursor = this.line.length;
|
|
62681
|
+
return;
|
|
62682
|
+
case "~":
|
|
62683
|
+
if (params === "3") {
|
|
62684
|
+
if (this.cursor < this.line.length) {
|
|
62685
|
+
this.line = this.line.slice(0, this.cursor) + this.line.slice(this.cursor + 1);
|
|
62686
|
+
}
|
|
62687
|
+
return;
|
|
62688
|
+
}
|
|
62689
|
+
if (params === "5") {
|
|
62690
|
+
this.emit("pageup");
|
|
62691
|
+
return;
|
|
62692
|
+
}
|
|
62693
|
+
if (params === "6") {
|
|
62694
|
+
this.emit("pagedown");
|
|
62695
|
+
return;
|
|
62696
|
+
}
|
|
62697
|
+
return;
|
|
62698
|
+
case "u":
|
|
62699
|
+
return;
|
|
62700
|
+
}
|
|
62701
|
+
}
|
|
62702
|
+
/** Handle SS3 sequence: \x1BO {final} (some terminals use this for arrows/Home/End) */
|
|
62703
|
+
_handleSS3(final) {
|
|
62704
|
+
switch (final) {
|
|
62705
|
+
case "A":
|
|
62706
|
+
this.emit("up");
|
|
62707
|
+
return;
|
|
62708
|
+
case "B":
|
|
62709
|
+
this.emit("down");
|
|
62710
|
+
return;
|
|
62711
|
+
case "C":
|
|
62712
|
+
if (this.cursor < this.line.length)
|
|
62713
|
+
this.cursor++;
|
|
62714
|
+
return;
|
|
62715
|
+
case "D":
|
|
62716
|
+
if (this.cursor > 0)
|
|
62717
|
+
this.cursor--;
|
|
62718
|
+
return;
|
|
62719
|
+
case "H":
|
|
62720
|
+
this.cursor = 0;
|
|
62721
|
+
return;
|
|
62722
|
+
case "F":
|
|
62723
|
+
this.cursor = this.line.length;
|
|
62724
|
+
return;
|
|
62725
|
+
}
|
|
62726
|
+
}
|
|
62727
|
+
/** Handle control characters (ASCII < 32 and DEL) */
|
|
62728
|
+
_handleControl(code) {
|
|
62729
|
+
switch (code) {
|
|
62730
|
+
case 13:
|
|
62731
|
+
// Enter (CR)
|
|
62732
|
+
case 10:
|
|
62733
|
+
this._submit();
|
|
62734
|
+
return;
|
|
62735
|
+
case 127:
|
|
62736
|
+
// Backspace (DEL)
|
|
62737
|
+
case 8:
|
|
62738
|
+
if (this.cursor > 0) {
|
|
62739
|
+
this.line = this.line.slice(0, this.cursor - 1) + this.line.slice(this.cursor);
|
|
62740
|
+
this.cursor--;
|
|
62741
|
+
}
|
|
62742
|
+
return;
|
|
62743
|
+
case 3:
|
|
62744
|
+
this.emit("SIGINT");
|
|
62745
|
+
return;
|
|
62746
|
+
case 4:
|
|
62747
|
+
if (this.line.length === 0)
|
|
62748
|
+
this.close();
|
|
62749
|
+
return;
|
|
62750
|
+
case 9:
|
|
62751
|
+
this._handleTab();
|
|
62752
|
+
return;
|
|
62753
|
+
case 23:
|
|
62754
|
+
this._deleteWordLeft();
|
|
62755
|
+
return;
|
|
62756
|
+
case 21:
|
|
62757
|
+
this.line = this.line.slice(this.cursor);
|
|
62758
|
+
this.cursor = 0;
|
|
62759
|
+
return;
|
|
62760
|
+
case 11:
|
|
62761
|
+
this.line = this.line.slice(0, this.cursor);
|
|
62762
|
+
return;
|
|
62763
|
+
case 1:
|
|
62764
|
+
this.cursor = 0;
|
|
62765
|
+
return;
|
|
62766
|
+
case 5:
|
|
62767
|
+
this.cursor = this.line.length;
|
|
62768
|
+
return;
|
|
62769
|
+
case 15:
|
|
62770
|
+
this.emit("ctrl-o");
|
|
62771
|
+
return;
|
|
62772
|
+
case 28:
|
|
62773
|
+
this.emit("ctrl-backslash");
|
|
62774
|
+
return;
|
|
62775
|
+
}
|
|
62776
|
+
}
|
|
62777
|
+
/** Submit the current line */
|
|
62778
|
+
_submit() {
|
|
62779
|
+
const line = this.line;
|
|
62780
|
+
if (line.trim() && (this._history.length === 0 || this._history[0] !== line)) {
|
|
62781
|
+
this._history.unshift(line);
|
|
62782
|
+
if (this._history.length > this._historySize) {
|
|
62783
|
+
this._history.length = this._historySize;
|
|
62784
|
+
}
|
|
62785
|
+
}
|
|
62786
|
+
this._historyIndex = -1;
|
|
62787
|
+
this._savedLine = "";
|
|
62788
|
+
this.line = "";
|
|
62789
|
+
this.cursor = 0;
|
|
62790
|
+
this.emit("line", line);
|
|
62791
|
+
}
|
|
62792
|
+
/** Handle Tab completion */
|
|
62793
|
+
_handleTab() {
|
|
62794
|
+
if (this.line.length === 0) {
|
|
62795
|
+
this.emit("tab-empty");
|
|
62796
|
+
return;
|
|
62797
|
+
}
|
|
62798
|
+
if (!this._completer)
|
|
62799
|
+
return;
|
|
62800
|
+
this._completer(this.line, (err, result) => {
|
|
62801
|
+
if (err || !result)
|
|
62802
|
+
return;
|
|
62803
|
+
const [completions, substring] = result;
|
|
62804
|
+
if (completions.length === 0)
|
|
62805
|
+
return;
|
|
62806
|
+
if (completions.length === 1) {
|
|
62807
|
+
const completion = completions[0];
|
|
62808
|
+
const before = this.line.slice(0, this.cursor);
|
|
62809
|
+
const idx = before.lastIndexOf(substring);
|
|
62810
|
+
if (idx >= 0) {
|
|
62811
|
+
this.line = before.slice(0, idx) + completion + this.line.slice(this.cursor);
|
|
62812
|
+
this.cursor = idx + completion.length;
|
|
62813
|
+
}
|
|
62814
|
+
} else if (completions.length > 1) {
|
|
62815
|
+
let common = completions[0];
|
|
62816
|
+
for (let i = 1; i < completions.length; i++) {
|
|
62817
|
+
const other = completions[i];
|
|
62818
|
+
let j = 0;
|
|
62819
|
+
while (j < common.length && j < other.length && common[j] === other[j])
|
|
62820
|
+
j++;
|
|
62821
|
+
common = common.slice(0, j);
|
|
62822
|
+
}
|
|
62823
|
+
if (common.length > substring.length) {
|
|
62824
|
+
const before = this.line.slice(0, this.cursor);
|
|
62825
|
+
const idx = before.lastIndexOf(substring);
|
|
62826
|
+
if (idx >= 0) {
|
|
62827
|
+
this.line = before.slice(0, idx) + common + this.line.slice(this.cursor);
|
|
62828
|
+
this.cursor = idx + common.length;
|
|
62829
|
+
}
|
|
62830
|
+
}
|
|
62831
|
+
}
|
|
62832
|
+
});
|
|
62833
|
+
}
|
|
62834
|
+
/** Move cursor left by one word */
|
|
62835
|
+
_wordLeft() {
|
|
62836
|
+
if (this.cursor === 0)
|
|
62837
|
+
return;
|
|
62838
|
+
let i = this.cursor - 1;
|
|
62839
|
+
while (i > 0 && /\s/.test(this.line[i]))
|
|
62840
|
+
i--;
|
|
62841
|
+
while (i > 0 && /\S/.test(this.line[i - 1]))
|
|
62842
|
+
i--;
|
|
62843
|
+
this.cursor = i;
|
|
62844
|
+
}
|
|
62845
|
+
/** Move cursor right by one word */
|
|
62846
|
+
_wordRight() {
|
|
62847
|
+
if (this.cursor >= this.line.length)
|
|
62848
|
+
return;
|
|
62849
|
+
let i = this.cursor;
|
|
62850
|
+
while (i < this.line.length && /\S/.test(this.line[i]))
|
|
62851
|
+
i++;
|
|
62852
|
+
while (i < this.line.length && /\s/.test(this.line[i]))
|
|
62853
|
+
i++;
|
|
62854
|
+
this.cursor = i;
|
|
62855
|
+
}
|
|
62856
|
+
/** Delete word left of cursor (Ctrl+W) */
|
|
62857
|
+
_deleteWordLeft() {
|
|
62858
|
+
if (this.cursor === 0)
|
|
62859
|
+
return;
|
|
62860
|
+
let i = this.cursor - 1;
|
|
62861
|
+
while (i > 0 && /\s/.test(this.line[i]))
|
|
62862
|
+
i--;
|
|
62863
|
+
while (i > 0 && /\S/.test(this.line[i - 1]))
|
|
62864
|
+
i--;
|
|
62865
|
+
this.line = this.line.slice(0, i) + this.line.slice(this.cursor);
|
|
62866
|
+
this.cursor = i;
|
|
62867
|
+
}
|
|
62868
|
+
};
|
|
62869
|
+
}
|
|
62870
|
+
});
|
|
62871
|
+
|
|
62441
62872
|
// packages/cli/dist/api/profiles.js
|
|
62442
62873
|
import { existsSync as existsSync51, readFileSync as readFileSync40, writeFileSync as writeFileSync24, mkdirSync as mkdirSync25, readdirSync as readdirSync19, unlinkSync as unlinkSync12 } from "node:fs";
|
|
62443
62874
|
import { join as join68 } from "node:path";
|
|
@@ -64037,8 +64468,6 @@ var init_serve = __esm({
|
|
|
64037
64468
|
});
|
|
64038
64469
|
|
|
64039
64470
|
// packages/cli/dist/tui/interactive.js
|
|
64040
|
-
import * as readline2 from "node:readline";
|
|
64041
|
-
import { Writable } from "node:stream";
|
|
64042
64471
|
import { cwd } from "node:process";
|
|
64043
64472
|
import { resolve as resolve32, join as join70, dirname as dirname21, extname as extname11 } from "node:path";
|
|
64044
64473
|
import { createRequire as createRequire4 } from "node:module";
|
|
@@ -65973,18 +66402,18 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
65973
66402
|
} catch {
|
|
65974
66403
|
}
|
|
65975
66404
|
});
|
|
65976
|
-
const
|
|
65977
|
-
|
|
65978
|
-
output: process.stdout,
|
|
65979
|
-
prompt: idlePrompt,
|
|
65980
|
-
terminal: true,
|
|
65981
|
-
historySize: MAX_HISTORY_LINES,
|
|
66405
|
+
const { DirectInput: DirectInput2 } = await Promise.resolve().then(() => (init_direct_input(), direct_input_exports));
|
|
66406
|
+
const rl = new DirectInput2(mouseFilter, {
|
|
65982
66407
|
history: savedHistory,
|
|
65983
|
-
|
|
66408
|
+
historySize: MAX_HISTORY_LINES,
|
|
66409
|
+
completer: (line, cb) => {
|
|
66410
|
+
const result = completer(line);
|
|
66411
|
+
cb(null, result);
|
|
66412
|
+
}
|
|
65984
66413
|
});
|
|
65985
|
-
origTtyWriteRef =
|
|
66414
|
+
origTtyWriteRef = null;
|
|
65986
66415
|
let _escapeHandler = null;
|
|
65987
|
-
statusBar.
|
|
66416
|
+
statusBar.hookDirectInput(rl, () => {
|
|
65988
66417
|
_escapeHandler?.();
|
|
65989
66418
|
}, () => {
|
|
65990
66419
|
if (sudoPromptPending) {
|
|
@@ -66027,7 +66456,6 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
66027
66456
|
}
|
|
66028
66457
|
})();
|
|
66029
66458
|
});
|
|
66030
|
-
rl.output = null;
|
|
66031
66459
|
if (process.stdin.isTTY && typeof process.stdin.setRawMode === "function") {
|
|
66032
66460
|
process.stdin.setRawMode(true);
|
|
66033
66461
|
}
|
|
@@ -66052,7 +66480,6 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
66052
66480
|
statusBar.setPromptText(idlePrompt, 2);
|
|
66053
66481
|
statusBar.setCompletions(allCompletions);
|
|
66054
66482
|
if (statusBar.isActive) {
|
|
66055
|
-
rl.output = new Writable({ write: (_c, _e, cb) => cb() });
|
|
66056
66483
|
statusBar.setInputStateProvider(() => ({
|
|
66057
66484
|
line: rl.line ?? "",
|
|
66058
66485
|
cursor: rl.cursor ?? 0
|
|
@@ -66333,6 +66760,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
66333
66760
|
const directSponsors = active.filter((s) => !/trycloudflare\.com/i.test(s.tunnelUrl));
|
|
66334
66761
|
const sorted = [...tunnelSponsors, ...directSponsors];
|
|
66335
66762
|
let best = null;
|
|
66763
|
+
let bestNoAuth = false;
|
|
66336
66764
|
for (const sponsor of sorted) {
|
|
66337
66765
|
try {
|
|
66338
66766
|
const baseUrl = normalizeBaseUrl(sponsor.tunnelUrl);
|
|
@@ -66345,6 +66773,14 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
66345
66773
|
best = sponsor;
|
|
66346
66774
|
break;
|
|
66347
66775
|
}
|
|
66776
|
+
if (probe.status === 401 && sponsor.authKey) {
|
|
66777
|
+
const noAuthProbe = await fetch(testUrl, { signal: AbortSignal.timeout(5e3) });
|
|
66778
|
+
if (noAuthProbe.ok) {
|
|
66779
|
+
best = sponsor;
|
|
66780
|
+
bestNoAuth = true;
|
|
66781
|
+
break;
|
|
66782
|
+
}
|
|
66783
|
+
}
|
|
66348
66784
|
} catch {
|
|
66349
66785
|
}
|
|
66350
66786
|
}
|
|
@@ -66356,7 +66792,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
66356
66792
|
renderInfo(`Change anytime: /endpoint or /endpoint sponsor`);
|
|
66357
66793
|
});
|
|
66358
66794
|
currentConfig.backendUrl = best.tunnelUrl;
|
|
66359
|
-
currentConfig.apiKey = best.authKey;
|
|
66795
|
+
currentConfig.apiKey = bestNoAuth ? "" : best.authKey;
|
|
66360
66796
|
currentConfig.backendType = "openai";
|
|
66361
66797
|
} else if (active.length > 0) {
|
|
66362
66798
|
writeContent(() => {
|
|
@@ -66970,7 +67406,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
66970
67406
|
writeContent(() => renderInfo(`Heard: "${text}" ${c2.dim("(press Enter to submit)")}`));
|
|
66971
67407
|
} else if (isFinal) {
|
|
66972
67408
|
writeContent(() => renderInfo(`Auto-submitting: "${text}"`));
|
|
66973
|
-
rl.
|
|
67409
|
+
rl.feed(text + "\n");
|
|
66974
67410
|
} else {
|
|
66975
67411
|
writeContent(() => renderInfo(`Hearing: "${text}"`));
|
|
66976
67412
|
}
|
|
@@ -67116,7 +67552,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
67116
67552
|
agent.handleTranscript(text);
|
|
67117
67553
|
}
|
|
67118
67554
|
if (callSubAgents.size === 0) {
|
|
67119
|
-
rl.
|
|
67555
|
+
rl.feed(text + "\n");
|
|
67120
67556
|
}
|
|
67121
67557
|
}
|
|
67122
67558
|
});
|
|
@@ -67723,7 +68159,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
67723
68159
|
const timedOut = result.timedOut === true;
|
|
67724
68160
|
if (timedOut) {
|
|
67725
68161
|
try {
|
|
67726
|
-
rl.
|
|
68162
|
+
rl.feed("\x1B");
|
|
67727
68163
|
} catch {
|
|
67728
68164
|
}
|
|
67729
68165
|
await new Promise((r) => setTimeout(r, 100));
|
package/package.json
CHANGED