open-agents-ai 0.187.251 → 0.187.253
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 +264 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40874,11 +40874,11 @@ var require_eventemitter3 = __commonJS({
|
|
|
40874
40874
|
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
40875
40875
|
else delete emitter._events[evt];
|
|
40876
40876
|
}
|
|
40877
|
-
function
|
|
40877
|
+
function EventEmitter11() {
|
|
40878
40878
|
this._events = new Events();
|
|
40879
40879
|
this._eventsCount = 0;
|
|
40880
40880
|
}
|
|
40881
|
-
|
|
40881
|
+
EventEmitter11.prototype.eventNames = function eventNames() {
|
|
40882
40882
|
var names = [], events, name10;
|
|
40883
40883
|
if (this._eventsCount === 0) return names;
|
|
40884
40884
|
for (name10 in events = this._events) {
|
|
@@ -40889,7 +40889,7 @@ var require_eventemitter3 = __commonJS({
|
|
|
40889
40889
|
}
|
|
40890
40890
|
return names;
|
|
40891
40891
|
};
|
|
40892
|
-
|
|
40892
|
+
EventEmitter11.prototype.listeners = function listeners(event) {
|
|
40893
40893
|
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
40894
40894
|
if (!handlers) return [];
|
|
40895
40895
|
if (handlers.fn) return [handlers.fn];
|
|
@@ -40898,13 +40898,13 @@ var require_eventemitter3 = __commonJS({
|
|
|
40898
40898
|
}
|
|
40899
40899
|
return ee;
|
|
40900
40900
|
};
|
|
40901
|
-
|
|
40901
|
+
EventEmitter11.prototype.listenerCount = function listenerCount(event) {
|
|
40902
40902
|
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
40903
40903
|
if (!listeners) return 0;
|
|
40904
40904
|
if (listeners.fn) return 1;
|
|
40905
40905
|
return listeners.length;
|
|
40906
40906
|
};
|
|
40907
|
-
|
|
40907
|
+
EventEmitter11.prototype.emit = function emit2(event, a1, a2, a3, a4, a5) {
|
|
40908
40908
|
var evt = prefix ? prefix + event : event;
|
|
40909
40909
|
if (!this._events[evt]) return false;
|
|
40910
40910
|
var listeners = this._events[evt], len = arguments.length, args, i2;
|
|
@@ -40955,13 +40955,13 @@ var require_eventemitter3 = __commonJS({
|
|
|
40955
40955
|
}
|
|
40956
40956
|
return true;
|
|
40957
40957
|
};
|
|
40958
|
-
|
|
40958
|
+
EventEmitter11.prototype.on = function on2(event, fn, context2) {
|
|
40959
40959
|
return addListener2(this, event, fn, context2, false);
|
|
40960
40960
|
};
|
|
40961
|
-
|
|
40961
|
+
EventEmitter11.prototype.once = function once(event, fn, context2) {
|
|
40962
40962
|
return addListener2(this, event, fn, context2, true);
|
|
40963
40963
|
};
|
|
40964
|
-
|
|
40964
|
+
EventEmitter11.prototype.removeListener = function removeListener2(event, fn, context2, once) {
|
|
40965
40965
|
var evt = prefix ? prefix + event : event;
|
|
40966
40966
|
if (!this._events[evt]) return this;
|
|
40967
40967
|
if (!fn) {
|
|
@@ -40984,7 +40984,7 @@ var require_eventemitter3 = __commonJS({
|
|
|
40984
40984
|
}
|
|
40985
40985
|
return this;
|
|
40986
40986
|
};
|
|
40987
|
-
|
|
40987
|
+
EventEmitter11.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
40988
40988
|
var evt;
|
|
40989
40989
|
if (event) {
|
|
40990
40990
|
evt = prefix ? prefix + event : event;
|
|
@@ -40995,12 +40995,12 @@ var require_eventemitter3 = __commonJS({
|
|
|
40995
40995
|
}
|
|
40996
40996
|
return this;
|
|
40997
40997
|
};
|
|
40998
|
-
|
|
40999
|
-
|
|
41000
|
-
|
|
41001
|
-
|
|
40998
|
+
EventEmitter11.prototype.off = EventEmitter11.prototype.removeListener;
|
|
40999
|
+
EventEmitter11.prototype.addListener = EventEmitter11.prototype.on;
|
|
41000
|
+
EventEmitter11.prefixed = prefix;
|
|
41001
|
+
EventEmitter11.EventEmitter = EventEmitter11;
|
|
41002
41002
|
if ("undefined" !== typeof module) {
|
|
41003
|
-
module.exports =
|
|
41003
|
+
module.exports = EventEmitter11;
|
|
41004
41004
|
}
|
|
41005
41005
|
}
|
|
41006
41006
|
});
|
|
@@ -113772,10 +113772,10 @@ var require_wrap_handler = __commonJS({
|
|
|
113772
113772
|
var require_dispatcher = __commonJS({
|
|
113773
113773
|
"../node_modules/undici/lib/dispatcher/dispatcher.js"(exports, module) {
|
|
113774
113774
|
"use strict";
|
|
113775
|
-
var
|
|
113775
|
+
var EventEmitter11 = __require("node:events");
|
|
113776
113776
|
var WrapHandler = require_wrap_handler();
|
|
113777
113777
|
var wrapInterceptor = (dispatch) => (opts, handler) => dispatch(opts, WrapHandler.wrap(handler));
|
|
113778
|
-
var Dispatcher2 = class extends
|
|
113778
|
+
var Dispatcher2 = class extends EventEmitter11 {
|
|
113779
113779
|
dispatch() {
|
|
113780
113780
|
throw new Error("not implemented");
|
|
113781
113781
|
}
|
|
@@ -121058,7 +121058,7 @@ var require_socks5_utils = __commonJS({
|
|
|
121058
121058
|
var require_socks5_client = __commonJS({
|
|
121059
121059
|
"../node_modules/undici/lib/core/socks5-client.js"(exports, module) {
|
|
121060
121060
|
"use strict";
|
|
121061
|
-
var { EventEmitter:
|
|
121061
|
+
var { EventEmitter: EventEmitter11 } = __require("node:events");
|
|
121062
121062
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
121063
121063
|
var { InvalidArgumentError, Socks5ProxyError } = require_errors2();
|
|
121064
121064
|
var { debuglog } = __require("node:util");
|
|
@@ -121101,7 +121101,7 @@ var require_socks5_client = __commonJS({
|
|
|
121101
121101
|
ERROR: "error",
|
|
121102
121102
|
CLOSED: "closed"
|
|
121103
121103
|
};
|
|
121104
|
-
var Socks5Client = class extends
|
|
121104
|
+
var Socks5Client = class extends EventEmitter11 {
|
|
121105
121105
|
constructor(socket, options2 = {}) {
|
|
121106
121106
|
super();
|
|
121107
121107
|
if (!socket) {
|
|
@@ -127486,9 +127486,9 @@ var require_memory_cache_store = __commonJS({
|
|
|
127486
127486
|
"../node_modules/undici/lib/cache/memory-cache-store.js"(exports, module) {
|
|
127487
127487
|
"use strict";
|
|
127488
127488
|
var { Writable } = __require("node:stream");
|
|
127489
|
-
var { EventEmitter:
|
|
127489
|
+
var { EventEmitter: EventEmitter11 } = __require("node:events");
|
|
127490
127490
|
var { assertCacheKey, assertCacheValue } = require_cache();
|
|
127491
|
-
var MemoryCacheStore = class extends
|
|
127491
|
+
var MemoryCacheStore = class extends EventEmitter11 {
|
|
127492
127492
|
#maxCount = 1024;
|
|
127493
127493
|
#maxSize = 104857600;
|
|
127494
127494
|
// 100MB
|
|
@@ -231525,7 +231525,7 @@ var require_extension2 = __commonJS({
|
|
|
231525
231525
|
var require_websocket2 = __commonJS({
|
|
231526
231526
|
"../node_modules/ws/lib/websocket.js"(exports, module) {
|
|
231527
231527
|
"use strict";
|
|
231528
|
-
var
|
|
231528
|
+
var EventEmitter11 = __require("events");
|
|
231529
231529
|
var https4 = __require("https");
|
|
231530
231530
|
var http6 = __require("http");
|
|
231531
231531
|
var net5 = __require("net");
|
|
@@ -231557,7 +231557,7 @@ var require_websocket2 = __commonJS({
|
|
|
231557
231557
|
var protocolVersions = [8, 13];
|
|
231558
231558
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
231559
231559
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
231560
|
-
var WebSocket6 = class _WebSocket extends
|
|
231560
|
+
var WebSocket6 = class _WebSocket extends EventEmitter11 {
|
|
231561
231561
|
/**
|
|
231562
231562
|
* Create a new `WebSocket`.
|
|
231563
231563
|
*
|
|
@@ -232554,7 +232554,7 @@ var require_subprotocol = __commonJS({
|
|
|
232554
232554
|
var require_websocket_server = __commonJS({
|
|
232555
232555
|
"../node_modules/ws/lib/websocket-server.js"(exports, module) {
|
|
232556
232556
|
"use strict";
|
|
232557
|
-
var
|
|
232557
|
+
var EventEmitter11 = __require("events");
|
|
232558
232558
|
var http6 = __require("http");
|
|
232559
232559
|
var { Duplex: Duplex3 } = __require("stream");
|
|
232560
232560
|
var { createHash: createHash10 } = __require("crypto");
|
|
@@ -232567,7 +232567,7 @@ var require_websocket_server = __commonJS({
|
|
|
232567
232567
|
var RUNNING = 0;
|
|
232568
232568
|
var CLOSING = 1;
|
|
232569
232569
|
var CLOSED = 2;
|
|
232570
|
-
var WebSocketServer4 = class extends
|
|
232570
|
+
var WebSocketServer4 = class extends EventEmitter11 {
|
|
232571
232571
|
/**
|
|
232572
232572
|
* Create a `WebSocketServer` instance.
|
|
232573
232573
|
*
|
|
@@ -273043,6 +273043,28 @@ Do NOT re-run it. Use the result you already have and proceed to the next step.`
|
|
|
273043
273043
|
break;
|
|
273044
273044
|
}
|
|
273045
273045
|
}
|
|
273046
|
+
{
|
|
273047
|
+
const recentCalls = this._littlemanToolOutcomes.slice(-5);
|
|
273048
|
+
if (recentCalls.length >= 3) {
|
|
273049
|
+
let consecutiveShortResults = 0;
|
|
273050
|
+
for (let i2 = recentCalls.length - 1; i2 >= 0; i2--) {
|
|
273051
|
+
const o2 = recentCalls[i2];
|
|
273052
|
+
if (o2.succeeded && o2.preview.length <= 10) {
|
|
273053
|
+
consecutiveShortResults++;
|
|
273054
|
+
} else {
|
|
273055
|
+
break;
|
|
273056
|
+
}
|
|
273057
|
+
}
|
|
273058
|
+
if (consecutiveShortResults >= 3) {
|
|
273059
|
+
this.pendingUserMessages.push(`[LITTLEMAN] You have sent ${consecutiveShortResults} consecutive outputs without reading any input. In an interactive session, you MUST alternate: receive input, then respond, then receive again. STOP sending and call your input/listening tool NOW to hear what the other side said.`);
|
|
273060
|
+
this.emit({
|
|
273061
|
+
type: "status",
|
|
273062
|
+
content: `Littleman: blocked runaway output (${consecutiveShortResults} consecutive sends without receive)`,
|
|
273063
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
273064
|
+
});
|
|
273065
|
+
}
|
|
273066
|
+
}
|
|
273067
|
+
}
|
|
273046
273068
|
const succCount = this._littlemanToolOutcomes.filter((o2) => o2.succeeded).length;
|
|
273047
273069
|
const failCount = this._littlemanToolOutcomes.filter((o2) => !o2.succeeded).length;
|
|
273048
273070
|
this.emit({
|
|
@@ -280340,7 +280362,7 @@ var require_extension3 = __commonJS({
|
|
|
280340
280362
|
var require_websocket3 = __commonJS({
|
|
280341
280363
|
"node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket.js"(exports, module) {
|
|
280342
280364
|
"use strict";
|
|
280343
|
-
var
|
|
280365
|
+
var EventEmitter11 = __require("events");
|
|
280344
280366
|
var https4 = __require("https");
|
|
280345
280367
|
var http6 = __require("http");
|
|
280346
280368
|
var net5 = __require("net");
|
|
@@ -280372,7 +280394,7 @@ var require_websocket3 = __commonJS({
|
|
|
280372
280394
|
var protocolVersions = [8, 13];
|
|
280373
280395
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
280374
280396
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
280375
|
-
var WebSocket6 = class _WebSocket extends
|
|
280397
|
+
var WebSocket6 = class _WebSocket extends EventEmitter11 {
|
|
280376
280398
|
/**
|
|
280377
280399
|
* Create a new `WebSocket`.
|
|
280378
280400
|
*
|
|
@@ -281369,7 +281391,7 @@ var require_subprotocol2 = __commonJS({
|
|
|
281369
281391
|
var require_websocket_server2 = __commonJS({
|
|
281370
281392
|
"node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket-server.js"(exports, module) {
|
|
281371
281393
|
"use strict";
|
|
281372
|
-
var
|
|
281394
|
+
var EventEmitter11 = __require("events");
|
|
281373
281395
|
var http6 = __require("http");
|
|
281374
281396
|
var { Duplex: Duplex3 } = __require("stream");
|
|
281375
281397
|
var { createHash: createHash10 } = __require("crypto");
|
|
@@ -281382,7 +281404,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
281382
281404
|
var RUNNING = 0;
|
|
281383
281405
|
var CLOSING = 1;
|
|
281384
281406
|
var CLOSED = 2;
|
|
281385
|
-
var WebSocketServer4 = class extends
|
|
281407
|
+
var WebSocketServer4 = class extends EventEmitter11 {
|
|
281386
281408
|
/**
|
|
281387
281409
|
* Create a `WebSocketServer` instance.
|
|
281388
281410
|
*
|
|
@@ -303351,8 +303373,38 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
|
|
|
303351
303373
|
if (ctx3.isCallActive?.()) {
|
|
303352
303374
|
await ctx3.callStop();
|
|
303353
303375
|
renderInfo("Call session ended.");
|
|
303376
|
+
} else if (ctx3.voiceChatStop) {
|
|
303377
|
+
await ctx3.voiceChatStop();
|
|
303378
|
+
renderInfo("Voice chat ended.");
|
|
303354
303379
|
} else {
|
|
303355
|
-
renderWarning("No active call session.");
|
|
303380
|
+
renderWarning("No active call or voice chat session.");
|
|
303381
|
+
}
|
|
303382
|
+
return "handled";
|
|
303383
|
+
}
|
|
303384
|
+
case "voicechat": {
|
|
303385
|
+
if (arg === "stop" || arg === "off") {
|
|
303386
|
+
if (ctx3.voiceChatStop) {
|
|
303387
|
+
await ctx3.voiceChatStop();
|
|
303388
|
+
renderInfo("Voice chat ended.");
|
|
303389
|
+
} else {
|
|
303390
|
+
renderWarning("No active voice chat session.");
|
|
303391
|
+
}
|
|
303392
|
+
return "handled";
|
|
303393
|
+
}
|
|
303394
|
+
if (ctx3.isVoiceChatActive?.()) {
|
|
303395
|
+
renderInfo("Voice chat is already active. Use /voicechat stop to end it, or /hangup.");
|
|
303396
|
+
return "handled";
|
|
303397
|
+
}
|
|
303398
|
+
if (!ctx3.voiceChatStart) {
|
|
303399
|
+
renderWarning("Voice chat not available in this context.");
|
|
303400
|
+
return "handled";
|
|
303401
|
+
}
|
|
303402
|
+
renderInfo("Starting voice chat — mic will capture your speech, agent will respond via TTS...");
|
|
303403
|
+
try {
|
|
303404
|
+
await ctx3.voiceChatStart();
|
|
303405
|
+
renderInfo("Voice chat active. Speak naturally — agent hears you and responds. /hangup to stop.");
|
|
303406
|
+
} catch (err) {
|
|
303407
|
+
renderError(`Voice chat failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
303356
303408
|
}
|
|
303357
303409
|
return "handled";
|
|
303358
303410
|
}
|
|
@@ -326959,6 +327011,148 @@ var init_serve = __esm({
|
|
|
326959
327011
|
}
|
|
326960
327012
|
});
|
|
326961
327013
|
|
|
327014
|
+
// packages/cli/src/tui/voicechat.ts
|
|
327015
|
+
var voicechat_exports = {};
|
|
327016
|
+
__export(voicechat_exports, {
|
|
327017
|
+
VoiceChatSession: () => VoiceChatSession
|
|
327018
|
+
});
|
|
327019
|
+
import { EventEmitter as EventEmitter10 } from "node:events";
|
|
327020
|
+
var VoiceChatSession;
|
|
327021
|
+
var init_voicechat = __esm({
|
|
327022
|
+
"packages/cli/src/tui/voicechat.ts"() {
|
|
327023
|
+
"use strict";
|
|
327024
|
+
VoiceChatSession = class extends EventEmitter10 {
|
|
327025
|
+
voice;
|
|
327026
|
+
listen;
|
|
327027
|
+
runner;
|
|
327028
|
+
active = false;
|
|
327029
|
+
silenceTimeout;
|
|
327030
|
+
onStatus;
|
|
327031
|
+
onUserSpeech;
|
|
327032
|
+
onAgentSpeech;
|
|
327033
|
+
transcriptBuffer = "";
|
|
327034
|
+
silenceTimer = null;
|
|
327035
|
+
agentTextBuffer = "";
|
|
327036
|
+
speakQueue = [];
|
|
327037
|
+
isSpeaking = false;
|
|
327038
|
+
lastSpokenText = "";
|
|
327039
|
+
constructor(opts) {
|
|
327040
|
+
super();
|
|
327041
|
+
this.voice = opts.voice;
|
|
327042
|
+
this.listen = opts.listen;
|
|
327043
|
+
this.runner = opts.runner;
|
|
327044
|
+
this.silenceTimeout = opts.silenceTimeout ?? 3;
|
|
327045
|
+
this.onStatus = opts.onStatus ?? (() => {
|
|
327046
|
+
});
|
|
327047
|
+
this.onUserSpeech = opts.onUserSpeech ?? (() => {
|
|
327048
|
+
});
|
|
327049
|
+
this.onAgentSpeech = opts.onAgentSpeech ?? (() => {
|
|
327050
|
+
});
|
|
327051
|
+
}
|
|
327052
|
+
get isActive() {
|
|
327053
|
+
return this.active;
|
|
327054
|
+
}
|
|
327055
|
+
/** Start the voice chat session — begins listening and wires agent responses to TTS */
|
|
327056
|
+
async start() {
|
|
327057
|
+
if (this.active) return;
|
|
327058
|
+
if (!this.voice.enabled || !this.voice.ready) {
|
|
327059
|
+
this.onStatus("Enabling voice engine...");
|
|
327060
|
+
await this.voice.toggle();
|
|
327061
|
+
}
|
|
327062
|
+
this.active = true;
|
|
327063
|
+
this.onStatus("Voice chat active — speak naturally, agent will respond");
|
|
327064
|
+
this.listen.on("transcript", (evt) => {
|
|
327065
|
+
const { text, isFinal } = evt;
|
|
327066
|
+
if (!text?.trim()) return;
|
|
327067
|
+
this.transcriptBuffer = text.trim();
|
|
327068
|
+
if (this.silenceTimer) clearTimeout(this.silenceTimer);
|
|
327069
|
+
if (isFinal || this.silenceTimeout === 0) {
|
|
327070
|
+
this.submitTranscript();
|
|
327071
|
+
} else {
|
|
327072
|
+
this.silenceTimer = setTimeout(() => {
|
|
327073
|
+
this.submitTranscript();
|
|
327074
|
+
}, this.silenceTimeout * 1e3);
|
|
327075
|
+
}
|
|
327076
|
+
});
|
|
327077
|
+
this.runner.onEvent((event) => {
|
|
327078
|
+
if (!this.active) return;
|
|
327079
|
+
if (event.type === "assistant_text" && event.content) {
|
|
327080
|
+
const text = event.content.trim();
|
|
327081
|
+
if (!text || text.length < 3) return;
|
|
327082
|
+
if (text === this.lastSpokenText) return;
|
|
327083
|
+
this.lastSpokenText = text;
|
|
327084
|
+
this.onAgentSpeech(text);
|
|
327085
|
+
this.queueSpeak(text);
|
|
327086
|
+
}
|
|
327087
|
+
});
|
|
327088
|
+
try {
|
|
327089
|
+
await this.listen.start();
|
|
327090
|
+
this.onStatus("Mic active — listening...");
|
|
327091
|
+
} catch (err) {
|
|
327092
|
+
this.onStatus(`Mic failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
327093
|
+
this.active = false;
|
|
327094
|
+
}
|
|
327095
|
+
}
|
|
327096
|
+
/** Stop the voice chat session */
|
|
327097
|
+
async stop() {
|
|
327098
|
+
if (!this.active) return;
|
|
327099
|
+
this.active = false;
|
|
327100
|
+
if (this.silenceTimer) {
|
|
327101
|
+
clearTimeout(this.silenceTimer);
|
|
327102
|
+
this.silenceTimer = null;
|
|
327103
|
+
}
|
|
327104
|
+
if (this.transcriptBuffer.trim()) {
|
|
327105
|
+
this.submitTranscript();
|
|
327106
|
+
}
|
|
327107
|
+
try {
|
|
327108
|
+
await this.listen.stop();
|
|
327109
|
+
} catch {
|
|
327110
|
+
}
|
|
327111
|
+
this.listen.removeAllListeners("transcript");
|
|
327112
|
+
this.speakQueue.length = 0;
|
|
327113
|
+
this.onStatus("Voice chat ended");
|
|
327114
|
+
this.emit("stopped");
|
|
327115
|
+
}
|
|
327116
|
+
/** Submit the current transcript buffer to the agent */
|
|
327117
|
+
submitTranscript() {
|
|
327118
|
+
const text = this.transcriptBuffer.trim();
|
|
327119
|
+
if (!text) return;
|
|
327120
|
+
this.transcriptBuffer = "";
|
|
327121
|
+
if (this.silenceTimer) {
|
|
327122
|
+
clearTimeout(this.silenceTimer);
|
|
327123
|
+
this.silenceTimer = null;
|
|
327124
|
+
}
|
|
327125
|
+
this.onUserSpeech(text);
|
|
327126
|
+
this.runner.injectUserMessage(
|
|
327127
|
+
`[VOICE] The user spoke (live microphone): "${text}"
|
|
327128
|
+
This is a live voice conversation running alongside your work. Respond briefly and naturally — your text response will be spoken aloud via TTS. If they ask you to look something up, acknowledge first then research. After responding, continue your current task.`
|
|
327129
|
+
);
|
|
327130
|
+
}
|
|
327131
|
+
/** Queue text for TTS playback — non-blocking, processes sequentially */
|
|
327132
|
+
queueSpeak(text) {
|
|
327133
|
+
this.speakQueue.push(text);
|
|
327134
|
+
if (!this.isSpeaking) {
|
|
327135
|
+
this.processQueue();
|
|
327136
|
+
}
|
|
327137
|
+
}
|
|
327138
|
+
/** Process the TTS queue — speaks one item at a time */
|
|
327139
|
+
async processQueue() {
|
|
327140
|
+
if (this.isSpeaking) return;
|
|
327141
|
+
this.isSpeaking = true;
|
|
327142
|
+
while (this.speakQueue.length > 0 && this.active) {
|
|
327143
|
+
const text = this.speakQueue.shift();
|
|
327144
|
+
try {
|
|
327145
|
+
this.voice.speak(text);
|
|
327146
|
+
await new Promise((r2) => setTimeout(r2, 500));
|
|
327147
|
+
} catch {
|
|
327148
|
+
}
|
|
327149
|
+
}
|
|
327150
|
+
this.isSpeaking = false;
|
|
327151
|
+
}
|
|
327152
|
+
};
|
|
327153
|
+
}
|
|
327154
|
+
});
|
|
327155
|
+
|
|
326962
327156
|
// packages/cli/src/tui/interactive.ts
|
|
326963
327157
|
import { cwd } from "node:process";
|
|
326964
327158
|
import { resolve as resolve36, join as join99, dirname as dirname30, extname as extname11 } from "node:path";
|
|
@@ -329516,6 +329710,7 @@ ${opts.systemPromptAddition}` : `Working directory: ${repoRoot}`;
|
|
|
329516
329710
|
autoUpdateTimer.unref();
|
|
329517
329711
|
const voiceEngine = new VoiceEngine();
|
|
329518
329712
|
let voiceSession = null;
|
|
329713
|
+
let _voiceChatSession = null;
|
|
329519
329714
|
let tunnelGateway = null;
|
|
329520
329715
|
let p2pGateway = null;
|
|
329521
329716
|
let peerMesh = null;
|
|
@@ -331168,6 +331363,46 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
331168
331363
|
getCallUrl() {
|
|
331169
331364
|
return voiceSession?.tunnelUrl ?? null;
|
|
331170
331365
|
},
|
|
331366
|
+
// --- /voicechat: async voice conversation parallel to agent loop ---
|
|
331367
|
+
async voiceChatStart() {
|
|
331368
|
+
if (_voiceChatSession?.isActive) return;
|
|
331369
|
+
if (!voiceEngine.enabled || !voiceEngine.ready) {
|
|
331370
|
+
writeContent(() => renderInfo("Auto-enabling voice for voice chat..."));
|
|
331371
|
+
const voiceMsg = await voiceEngine.toggle();
|
|
331372
|
+
statusBar.setVoiceStatus(voiceEngine.enabled, voiceEngine.modelId || "");
|
|
331373
|
+
writeContent(() => renderInfo(voiceMsg));
|
|
331374
|
+
}
|
|
331375
|
+
const { VoiceChatSession: VoiceChatSession2 } = await Promise.resolve().then(() => (init_voicechat(), voicechat_exports));
|
|
331376
|
+
const { ListenEngine: ListenEngine2 } = await Promise.resolve().then(() => (init_listen(), listen_exports));
|
|
331377
|
+
const listenEng = new ListenEngine2();
|
|
331378
|
+
if (!activeTask?.runner) {
|
|
331379
|
+
throw new Error("No active task — start a task first, then /voicechat to talk alongside it.");
|
|
331380
|
+
}
|
|
331381
|
+
_voiceChatSession = new VoiceChatSession2({
|
|
331382
|
+
voice: voiceEngine,
|
|
331383
|
+
listen: listenEng,
|
|
331384
|
+
runner: activeTask.runner,
|
|
331385
|
+
onStatus(msg) {
|
|
331386
|
+
writeContent(() => renderInfo(`[voicechat] ${msg}`));
|
|
331387
|
+
},
|
|
331388
|
+
onUserSpeech(text) {
|
|
331389
|
+
writeContent(() => renderInfo(`\x1B[38;5;45m[you]\x1B[0m ${text}`));
|
|
331390
|
+
},
|
|
331391
|
+
onAgentSpeech(text) {
|
|
331392
|
+
writeContent(() => renderInfo(`\x1B[38;5;178m[agent]\x1B[0m ${text.slice(0, 120)}`));
|
|
331393
|
+
}
|
|
331394
|
+
});
|
|
331395
|
+
await _voiceChatSession.start();
|
|
331396
|
+
},
|
|
331397
|
+
async voiceChatStop() {
|
|
331398
|
+
if (_voiceChatSession?.isActive) {
|
|
331399
|
+
await _voiceChatSession.stop();
|
|
331400
|
+
_voiceChatSession = null;
|
|
331401
|
+
}
|
|
331402
|
+
},
|
|
331403
|
+
isVoiceChatActive() {
|
|
331404
|
+
return _voiceChatSession?.isActive ?? false;
|
|
331405
|
+
},
|
|
331171
331406
|
async exposeStart(kindOrUrl, authKey, transport, fullAccess, passthrough, loadbalance) {
|
|
331172
331407
|
const knownKinds = ["ollama", "vllm", "llvm", "passthrough"];
|
|
331173
331408
|
let kind;
|
package/package.json
CHANGED