@everworker/oneringai 0.4.6 → 0.4.7
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/README.md +17 -1
- package/dist/capabilities/agents/index.d.cts +1 -1
- package/dist/capabilities/agents/index.d.ts +1 -1
- package/dist/{index-oBtp-8Qn.d.ts → index-Blci0FEd.d.ts} +47 -3
- package/dist/{index-DJ-qAK15.d.cts → index-D8RCwpK9.d.cts} +47 -3
- package/dist/index.cjs +789 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +355 -4
- package/dist/index.d.ts +355 -4
- package/dist/index.js +784 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/index.cjs +3 -0
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.js +3 -0
- package/dist/shared/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import process2 from 'process';
|
|
|
21
21
|
import { PassThrough } from 'stream';
|
|
22
22
|
import * as fs17 from 'fs/promises';
|
|
23
23
|
import { stat, readFile, mkdir, writeFile, readdir } from 'fs/promises';
|
|
24
|
+
import { EventEmitter as EventEmitter$1 } from 'events';
|
|
24
25
|
import * as simpleIcons from 'simple-icons';
|
|
25
26
|
import { exec, spawn } from 'child_process';
|
|
26
27
|
import { promisify } from 'util';
|
|
@@ -12742,6 +12743,9 @@ var MODEL_REGISTRY = {
|
|
|
12742
12743
|
video: false,
|
|
12743
12744
|
batchAPI: true,
|
|
12744
12745
|
promptCaching: true,
|
|
12746
|
+
parameters: {
|
|
12747
|
+
temperature: false
|
|
12748
|
+
},
|
|
12745
12749
|
input: {
|
|
12746
12750
|
tokens: 128e3,
|
|
12747
12751
|
text: true,
|
|
@@ -20899,6 +20903,9 @@ var StreamEventType = /* @__PURE__ */ ((StreamEventType2) => {
|
|
|
20899
20903
|
StreamEventType2["REASONING_DONE"] = "response.reasoning.done";
|
|
20900
20904
|
StreamEventType2["RESPONSE_COMPLETE"] = "response.complete";
|
|
20901
20905
|
StreamEventType2["ERROR"] = "response.error";
|
|
20906
|
+
StreamEventType2["AUDIO_CHUNK_READY"] = "response.audio_chunk.ready";
|
|
20907
|
+
StreamEventType2["AUDIO_CHUNK_ERROR"] = "response.audio_chunk.error";
|
|
20908
|
+
StreamEventType2["AUDIO_STREAM_COMPLETE"] = "response.audio_stream.complete";
|
|
20902
20909
|
return StreamEventType2;
|
|
20903
20910
|
})(StreamEventType || {});
|
|
20904
20911
|
function isStreamEvent(event, type) {
|
|
@@ -20928,6 +20935,15 @@ function isResponseComplete(event) {
|
|
|
20928
20935
|
function isErrorEvent(event) {
|
|
20929
20936
|
return event.type === "response.error" /* ERROR */;
|
|
20930
20937
|
}
|
|
20938
|
+
function isAudioChunkReady(event) {
|
|
20939
|
+
return event.type === "response.audio_chunk.ready" /* AUDIO_CHUNK_READY */;
|
|
20940
|
+
}
|
|
20941
|
+
function isAudioChunkError(event) {
|
|
20942
|
+
return event.type === "response.audio_chunk.error" /* AUDIO_CHUNK_ERROR */;
|
|
20943
|
+
}
|
|
20944
|
+
function isAudioStreamComplete(event) {
|
|
20945
|
+
return event.type === "response.audio_stream.complete" /* AUDIO_STREAM_COMPLETE */;
|
|
20946
|
+
}
|
|
20931
20947
|
|
|
20932
20948
|
// src/infrastructure/providers/openai/OpenAIResponsesStreamConverter.ts
|
|
20933
20949
|
var OpenAIResponsesStreamConverter = class {
|
|
@@ -34235,6 +34251,56 @@ var OpenAITTSProvider = class extends BaseMediaProvider {
|
|
|
34235
34251
|
{ model: options.model, voice: options.voice }
|
|
34236
34252
|
);
|
|
34237
34253
|
}
|
|
34254
|
+
/**
|
|
34255
|
+
* Check if streaming is supported for the given format
|
|
34256
|
+
*/
|
|
34257
|
+
supportsStreaming(format) {
|
|
34258
|
+
if (!format) return true;
|
|
34259
|
+
return ["pcm", "wav", "mp3", "opus", "aac", "flac"].includes(format);
|
|
34260
|
+
}
|
|
34261
|
+
/**
|
|
34262
|
+
* Stream TTS audio chunks as they arrive from the API
|
|
34263
|
+
*/
|
|
34264
|
+
async *synthesizeStream(options) {
|
|
34265
|
+
const format = this.mapFormat(options.format);
|
|
34266
|
+
const requestParams = {
|
|
34267
|
+
model: options.model,
|
|
34268
|
+
input: options.input,
|
|
34269
|
+
voice: options.voice,
|
|
34270
|
+
response_format: format,
|
|
34271
|
+
speed: options.speed
|
|
34272
|
+
};
|
|
34273
|
+
if (options.vendorOptions?.instructions) {
|
|
34274
|
+
requestParams.instructions = options.vendorOptions.instructions;
|
|
34275
|
+
}
|
|
34276
|
+
this.logOperationStart("tts.synthesizeStream", {
|
|
34277
|
+
model: options.model,
|
|
34278
|
+
voice: options.voice,
|
|
34279
|
+
inputLength: options.input.length,
|
|
34280
|
+
format
|
|
34281
|
+
});
|
|
34282
|
+
try {
|
|
34283
|
+
const response = await this.client.audio.speech.create(requestParams);
|
|
34284
|
+
const body = response.body;
|
|
34285
|
+
if (!body) {
|
|
34286
|
+
throw new Error("No response body from OpenAI TTS API");
|
|
34287
|
+
}
|
|
34288
|
+
let totalBytes = 0;
|
|
34289
|
+
for await (const chunk of body) {
|
|
34290
|
+
const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
34291
|
+
totalBytes += buf.length;
|
|
34292
|
+
yield { audio: buf, isFinal: false };
|
|
34293
|
+
}
|
|
34294
|
+
yield { audio: Buffer.alloc(0), isFinal: true };
|
|
34295
|
+
this.logOperationComplete("tts.synthesizeStream", {
|
|
34296
|
+
model: options.model,
|
|
34297
|
+
totalBytes
|
|
34298
|
+
});
|
|
34299
|
+
} catch (error) {
|
|
34300
|
+
this.handleError(error);
|
|
34301
|
+
throw error;
|
|
34302
|
+
}
|
|
34303
|
+
}
|
|
34238
34304
|
/**
|
|
34239
34305
|
* List available voices (returns static list for OpenAI)
|
|
34240
34306
|
*/
|
|
@@ -34977,6 +35043,35 @@ var TextToSpeech = class _TextToSpeech {
|
|
|
34977
35043
|
const response = await this.synthesize(text, options);
|
|
34978
35044
|
await fs17.writeFile(filePath, response.audio);
|
|
34979
35045
|
}
|
|
35046
|
+
// ======================== Streaming Methods ========================
|
|
35047
|
+
/**
|
|
35048
|
+
* Check if the underlying provider supports streaming TTS
|
|
35049
|
+
*/
|
|
35050
|
+
supportsStreaming(format) {
|
|
35051
|
+
const provider = this.provider;
|
|
35052
|
+
return typeof provider.supportsStreaming === "function" && provider.supportsStreaming(format);
|
|
35053
|
+
}
|
|
35054
|
+
/**
|
|
35055
|
+
* Stream TTS audio chunks as they arrive from the API.
|
|
35056
|
+
* Falls back to buffered synthesis yielding a single chunk if provider doesn't support streaming.
|
|
35057
|
+
*/
|
|
35058
|
+
async *synthesizeStream(text, options) {
|
|
35059
|
+
const fullOptions = {
|
|
35060
|
+
model: this.config.model ?? this.getDefaultModel(),
|
|
35061
|
+
input: text,
|
|
35062
|
+
voice: options?.voice ?? this.config.voice ?? this.getDefaultVoice(),
|
|
35063
|
+
format: options?.format ?? this.config.format,
|
|
35064
|
+
speed: options?.speed ?? this.config.speed,
|
|
35065
|
+
vendorOptions: options?.vendorOptions
|
|
35066
|
+
};
|
|
35067
|
+
const provider = this.provider;
|
|
35068
|
+
if (typeof provider.synthesizeStream === "function" && provider.supportsStreaming?.(fullOptions.format)) {
|
|
35069
|
+
yield* provider.synthesizeStream(fullOptions);
|
|
35070
|
+
} else {
|
|
35071
|
+
const response = await this.provider.synthesize(fullOptions);
|
|
35072
|
+
yield { audio: response.audio, isFinal: true };
|
|
35073
|
+
}
|
|
35074
|
+
}
|
|
34980
35075
|
// ======================== Introspection Methods ========================
|
|
34981
35076
|
/**
|
|
34982
35077
|
* Get model information for current or specified model
|
|
@@ -38681,6 +38776,694 @@ var VideoGeneration = class _VideoGeneration {
|
|
|
38681
38776
|
}
|
|
38682
38777
|
};
|
|
38683
38778
|
|
|
38779
|
+
// src/capabilities/speech/SentenceSplitter.ts
|
|
38780
|
+
var DEFAULT_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
38781
|
+
"dr.",
|
|
38782
|
+
"mr.",
|
|
38783
|
+
"mrs.",
|
|
38784
|
+
"ms.",
|
|
38785
|
+
"prof.",
|
|
38786
|
+
"sr.",
|
|
38787
|
+
"jr.",
|
|
38788
|
+
"st.",
|
|
38789
|
+
"ave.",
|
|
38790
|
+
"blvd.",
|
|
38791
|
+
"rd.",
|
|
38792
|
+
"u.s.",
|
|
38793
|
+
"u.k.",
|
|
38794
|
+
"u.s.a.",
|
|
38795
|
+
"u.n.",
|
|
38796
|
+
"e.g.",
|
|
38797
|
+
"i.e.",
|
|
38798
|
+
"etc.",
|
|
38799
|
+
"vs.",
|
|
38800
|
+
"viz.",
|
|
38801
|
+
"approx.",
|
|
38802
|
+
"dept.",
|
|
38803
|
+
"est.",
|
|
38804
|
+
"inc.",
|
|
38805
|
+
"ltd.",
|
|
38806
|
+
"corp.",
|
|
38807
|
+
"no.",
|
|
38808
|
+
"vol.",
|
|
38809
|
+
"rev.",
|
|
38810
|
+
"gen.",
|
|
38811
|
+
"gov.",
|
|
38812
|
+
"jan.",
|
|
38813
|
+
"feb.",
|
|
38814
|
+
"mar.",
|
|
38815
|
+
"apr.",
|
|
38816
|
+
"jun.",
|
|
38817
|
+
"jul.",
|
|
38818
|
+
"aug.",
|
|
38819
|
+
"sep.",
|
|
38820
|
+
"oct.",
|
|
38821
|
+
"nov.",
|
|
38822
|
+
"dec.",
|
|
38823
|
+
"fig.",
|
|
38824
|
+
"eq.",
|
|
38825
|
+
"ref.",
|
|
38826
|
+
"sec.",
|
|
38827
|
+
"ch.",
|
|
38828
|
+
"min.",
|
|
38829
|
+
"max.",
|
|
38830
|
+
"avg."
|
|
38831
|
+
]);
|
|
38832
|
+
var DEFAULT_OPTIONS = {
|
|
38833
|
+
minChunkLength: 20,
|
|
38834
|
+
maxChunkLength: 500,
|
|
38835
|
+
skipCodeBlocks: true,
|
|
38836
|
+
stripMarkdown: true,
|
|
38837
|
+
additionalAbbreviations: []
|
|
38838
|
+
};
|
|
38839
|
+
var SentenceChunkingStrategy = class {
|
|
38840
|
+
buffer = "";
|
|
38841
|
+
inCodeBlock = false;
|
|
38842
|
+
codeBlockBuffer = "";
|
|
38843
|
+
options;
|
|
38844
|
+
abbreviations;
|
|
38845
|
+
constructor(options) {
|
|
38846
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
38847
|
+
this.abbreviations = /* @__PURE__ */ new Set([
|
|
38848
|
+
...DEFAULT_ABBREVIATIONS,
|
|
38849
|
+
...this.options.additionalAbbreviations.map((a) => a.toLowerCase())
|
|
38850
|
+
]);
|
|
38851
|
+
}
|
|
38852
|
+
feed(delta) {
|
|
38853
|
+
this.buffer += delta;
|
|
38854
|
+
return this.extractChunks();
|
|
38855
|
+
}
|
|
38856
|
+
flush() {
|
|
38857
|
+
if (this.inCodeBlock) {
|
|
38858
|
+
this.codeBlockBuffer = "";
|
|
38859
|
+
this.inCodeBlock = false;
|
|
38860
|
+
}
|
|
38861
|
+
const text = this.cleanForSpeech(this.buffer.trim());
|
|
38862
|
+
this.buffer = "";
|
|
38863
|
+
return text.length > 0 ? text : null;
|
|
38864
|
+
}
|
|
38865
|
+
reset() {
|
|
38866
|
+
this.buffer = "";
|
|
38867
|
+
this.inCodeBlock = false;
|
|
38868
|
+
this.codeBlockBuffer = "";
|
|
38869
|
+
}
|
|
38870
|
+
// ======================== Private Methods ========================
|
|
38871
|
+
extractChunks() {
|
|
38872
|
+
const chunks = [];
|
|
38873
|
+
if (this.options.skipCodeBlocks) {
|
|
38874
|
+
this.processCodeBlocks();
|
|
38875
|
+
}
|
|
38876
|
+
let paragraphIdx = this.buffer.indexOf("\n\n");
|
|
38877
|
+
while (paragraphIdx !== -1) {
|
|
38878
|
+
const chunk = this.buffer.slice(0, paragraphIdx).trim();
|
|
38879
|
+
this.buffer = this.buffer.slice(paragraphIdx + 2);
|
|
38880
|
+
if (chunk.length > 0) {
|
|
38881
|
+
const cleaned = this.cleanForSpeech(chunk);
|
|
38882
|
+
if (cleaned.length > 0) {
|
|
38883
|
+
chunks.push(cleaned);
|
|
38884
|
+
}
|
|
38885
|
+
}
|
|
38886
|
+
paragraphIdx = this.buffer.indexOf("\n\n");
|
|
38887
|
+
}
|
|
38888
|
+
let sentenceEnd = this.findSentenceBoundary();
|
|
38889
|
+
while (sentenceEnd !== -1) {
|
|
38890
|
+
const sentence = this.buffer.slice(0, sentenceEnd).trim();
|
|
38891
|
+
this.buffer = this.buffer.slice(sentenceEnd).trimStart();
|
|
38892
|
+
if (sentence.length > 0) {
|
|
38893
|
+
const cleaned = this.cleanForSpeech(sentence);
|
|
38894
|
+
if (cleaned.length > 0) {
|
|
38895
|
+
chunks.push(cleaned);
|
|
38896
|
+
}
|
|
38897
|
+
}
|
|
38898
|
+
sentenceEnd = this.findSentenceBoundary();
|
|
38899
|
+
}
|
|
38900
|
+
if (this.buffer.length > this.options.maxChunkLength) {
|
|
38901
|
+
const splitChunks = this.splitLongText(this.buffer);
|
|
38902
|
+
this.buffer = splitChunks.pop() ?? "";
|
|
38903
|
+
for (const chunk of splitChunks) {
|
|
38904
|
+
const cleaned = this.cleanForSpeech(chunk.trim());
|
|
38905
|
+
if (cleaned.length > 0) {
|
|
38906
|
+
chunks.push(cleaned);
|
|
38907
|
+
}
|
|
38908
|
+
}
|
|
38909
|
+
}
|
|
38910
|
+
return this.mergeSmallChunks(chunks);
|
|
38911
|
+
}
|
|
38912
|
+
/**
|
|
38913
|
+
* Track and remove fenced code blocks from the buffer.
|
|
38914
|
+
* Text inside code blocks is discarded (not spoken).
|
|
38915
|
+
*/
|
|
38916
|
+
processCodeBlocks() {
|
|
38917
|
+
let idx = 0;
|
|
38918
|
+
let result = "";
|
|
38919
|
+
while (idx < this.buffer.length) {
|
|
38920
|
+
if (this.buffer.startsWith("```", idx)) {
|
|
38921
|
+
if (this.inCodeBlock) {
|
|
38922
|
+
this.inCodeBlock = false;
|
|
38923
|
+
this.codeBlockBuffer = "";
|
|
38924
|
+
idx += 3;
|
|
38925
|
+
const newline = this.buffer.indexOf("\n", idx);
|
|
38926
|
+
idx = newline !== -1 ? newline + 1 : this.buffer.length;
|
|
38927
|
+
} else {
|
|
38928
|
+
this.inCodeBlock = true;
|
|
38929
|
+
this.codeBlockBuffer = "";
|
|
38930
|
+
idx += 3;
|
|
38931
|
+
const newline = this.buffer.indexOf("\n", idx);
|
|
38932
|
+
idx = newline !== -1 ? newline + 1 : this.buffer.length;
|
|
38933
|
+
}
|
|
38934
|
+
} else if (this.inCodeBlock) {
|
|
38935
|
+
this.codeBlockBuffer += this.buffer[idx];
|
|
38936
|
+
idx++;
|
|
38937
|
+
} else {
|
|
38938
|
+
result += this.buffer[idx];
|
|
38939
|
+
idx++;
|
|
38940
|
+
}
|
|
38941
|
+
}
|
|
38942
|
+
this.buffer = result;
|
|
38943
|
+
}
|
|
38944
|
+
/**
|
|
38945
|
+
* Find the position right after the next sentence boundary.
|
|
38946
|
+
* Returns -1 if no complete sentence boundary found.
|
|
38947
|
+
*/
|
|
38948
|
+
findSentenceBoundary() {
|
|
38949
|
+
const terminators = [".", "?", "!"];
|
|
38950
|
+
for (let i = 0; i < this.buffer.length; i++) {
|
|
38951
|
+
const ch = this.buffer.charAt(i);
|
|
38952
|
+
if (!terminators.includes(ch)) continue;
|
|
38953
|
+
if (i + 1 >= this.buffer.length) return -1;
|
|
38954
|
+
const nextChar = this.buffer[i + 1];
|
|
38955
|
+
if (nextChar !== " " && nextChar !== "\n" && nextChar !== "\r" && nextChar !== " ") {
|
|
38956
|
+
continue;
|
|
38957
|
+
}
|
|
38958
|
+
if (ch === ".") {
|
|
38959
|
+
if (this.isAbbreviation(i)) continue;
|
|
38960
|
+
if (this.isDecimalNumber(i)) continue;
|
|
38961
|
+
if (this.isEllipsis(i)) continue;
|
|
38962
|
+
}
|
|
38963
|
+
const candidate = this.buffer.slice(0, i + 1).trim();
|
|
38964
|
+
if (candidate.length < this.options.minChunkLength) continue;
|
|
38965
|
+
return i + 1;
|
|
38966
|
+
}
|
|
38967
|
+
return -1;
|
|
38968
|
+
}
|
|
38969
|
+
/**
|
|
38970
|
+
* Check if the period at position `pos` is part of a known abbreviation.
|
|
38971
|
+
*/
|
|
38972
|
+
isAbbreviation(pos) {
|
|
38973
|
+
let wordStart = pos - 1;
|
|
38974
|
+
while (wordStart >= 0 && this.buffer[wordStart] !== " " && this.buffer[wordStart] !== "\n") {
|
|
38975
|
+
wordStart--;
|
|
38976
|
+
}
|
|
38977
|
+
wordStart++;
|
|
38978
|
+
const word = this.buffer.slice(wordStart, pos + 1).toLowerCase();
|
|
38979
|
+
return this.abbreviations.has(word);
|
|
38980
|
+
}
|
|
38981
|
+
/**
|
|
38982
|
+
* Check if the period at position `pos` is a decimal point.
|
|
38983
|
+
* e.g., 3.14, $1.50
|
|
38984
|
+
*/
|
|
38985
|
+
isDecimalNumber(pos) {
|
|
38986
|
+
if (pos === 0 || pos + 1 >= this.buffer.length) return false;
|
|
38987
|
+
const before = this.buffer.charAt(pos - 1);
|
|
38988
|
+
const after = this.buffer.charAt(pos + 1);
|
|
38989
|
+
return /\d/.test(before) && /\d/.test(after);
|
|
38990
|
+
}
|
|
38991
|
+
/**
|
|
38992
|
+
* Check if the period at position `pos` is part of an ellipsis (...).
|
|
38993
|
+
*/
|
|
38994
|
+
isEllipsis(pos) {
|
|
38995
|
+
if (pos >= 2 && this.buffer[pos - 1] === "." && this.buffer[pos - 2] === ".") return true;
|
|
38996
|
+
if (pos + 1 < this.buffer.length && this.buffer[pos + 1] === ".") return true;
|
|
38997
|
+
return false;
|
|
38998
|
+
}
|
|
38999
|
+
/**
|
|
39000
|
+
* Split text that exceeds maxChunkLength at clause boundaries.
|
|
39001
|
+
*/
|
|
39002
|
+
splitLongText(text) {
|
|
39003
|
+
const max = this.options.maxChunkLength;
|
|
39004
|
+
const chunks = [];
|
|
39005
|
+
let remaining = text;
|
|
39006
|
+
while (remaining.length > max) {
|
|
39007
|
+
let splitPos = -1;
|
|
39008
|
+
const clauseBreaks = [",", ";", ":", " \u2014", " \u2013", " -"];
|
|
39009
|
+
for (const brk of clauseBreaks) {
|
|
39010
|
+
const searchRegion = remaining.slice(0, max);
|
|
39011
|
+
const lastPos = searchRegion.lastIndexOf(brk);
|
|
39012
|
+
if (lastPos > this.options.minChunkLength) {
|
|
39013
|
+
splitPos = lastPos + brk.length;
|
|
39014
|
+
break;
|
|
39015
|
+
}
|
|
39016
|
+
}
|
|
39017
|
+
if (splitPos === -1) {
|
|
39018
|
+
const searchRegion = remaining.slice(0, max);
|
|
39019
|
+
splitPos = searchRegion.lastIndexOf(" ");
|
|
39020
|
+
if (splitPos <= this.options.minChunkLength) {
|
|
39021
|
+
splitPos = max;
|
|
39022
|
+
}
|
|
39023
|
+
}
|
|
39024
|
+
chunks.push(remaining.slice(0, splitPos));
|
|
39025
|
+
remaining = remaining.slice(splitPos);
|
|
39026
|
+
}
|
|
39027
|
+
chunks.push(remaining);
|
|
39028
|
+
return chunks;
|
|
39029
|
+
}
|
|
39030
|
+
/**
|
|
39031
|
+
* Merge chunks that are shorter than minChunkLength with the next chunk.
|
|
39032
|
+
*/
|
|
39033
|
+
mergeSmallChunks(chunks) {
|
|
39034
|
+
if (chunks.length <= 1) return chunks;
|
|
39035
|
+
const merged = [];
|
|
39036
|
+
let accumulator = "";
|
|
39037
|
+
for (const chunk of chunks) {
|
|
39038
|
+
if (accumulator.length > 0) {
|
|
39039
|
+
accumulator += " " + chunk;
|
|
39040
|
+
} else {
|
|
39041
|
+
accumulator = chunk;
|
|
39042
|
+
}
|
|
39043
|
+
if (accumulator.length >= this.options.minChunkLength) {
|
|
39044
|
+
merged.push(accumulator);
|
|
39045
|
+
accumulator = "";
|
|
39046
|
+
}
|
|
39047
|
+
}
|
|
39048
|
+
if (accumulator.length > 0) {
|
|
39049
|
+
if (merged.length > 0) {
|
|
39050
|
+
merged[merged.length - 1] += " " + accumulator;
|
|
39051
|
+
} else {
|
|
39052
|
+
merged.push(accumulator);
|
|
39053
|
+
}
|
|
39054
|
+
}
|
|
39055
|
+
return merged;
|
|
39056
|
+
}
|
|
39057
|
+
/**
|
|
39058
|
+
* Strip markdown formatting from text for natural speech.
|
|
39059
|
+
*/
|
|
39060
|
+
cleanForSpeech(text) {
|
|
39061
|
+
if (!this.options.stripMarkdown) return text;
|
|
39062
|
+
let cleaned = text;
|
|
39063
|
+
cleaned = cleaned.replace(/`([^`]+)`/g, "$1");
|
|
39064
|
+
cleaned = cleaned.replace(/\*\*([^*]+)\*\*/g, "$1");
|
|
39065
|
+
cleaned = cleaned.replace(/__([^_]+)__/g, "$1");
|
|
39066
|
+
cleaned = cleaned.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, "$1");
|
|
39067
|
+
cleaned = cleaned.replace(/(?<!_)_([^_]+)_(?!_)/g, "$1");
|
|
39068
|
+
cleaned = cleaned.replace(/~~([^~]+)~~/g, "$1");
|
|
39069
|
+
cleaned = cleaned.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
|
39070
|
+
cleaned = cleaned.replace(/!\[([^\]]*)\]\([^)]+\)/g, "");
|
|
39071
|
+
cleaned = cleaned.replace(/^#{1,6}\s+/gm, "");
|
|
39072
|
+
cleaned = cleaned.replace(/^[-*+]\s+/gm, "");
|
|
39073
|
+
cleaned = cleaned.replace(/^\d+\.\s+/gm, "");
|
|
39074
|
+
cleaned = cleaned.replace(/^>\s+/gm, "");
|
|
39075
|
+
cleaned = cleaned.replace(/^[-*_]{3,}\s*$/gm, "");
|
|
39076
|
+
cleaned = cleaned.replace(/\n+/g, " ");
|
|
39077
|
+
cleaned = cleaned.replace(/\s{2,}/g, " ");
|
|
39078
|
+
return cleaned.trim();
|
|
39079
|
+
}
|
|
39080
|
+
};
|
|
39081
|
+
|
|
39082
|
+
// src/capabilities/speech/VoiceStream.ts
|
|
39083
|
+
var VoiceStream = class _VoiceStream extends EventEmitter$1 {
|
|
39084
|
+
tts;
|
|
39085
|
+
chunker;
|
|
39086
|
+
format;
|
|
39087
|
+
speed;
|
|
39088
|
+
maxConcurrentTTS;
|
|
39089
|
+
maxQueuedChunks;
|
|
39090
|
+
vendorOptions;
|
|
39091
|
+
streaming;
|
|
39092
|
+
// Pipeline state
|
|
39093
|
+
chunkIndex = 0;
|
|
39094
|
+
totalCharacters = 0;
|
|
39095
|
+
totalDuration = 0;
|
|
39096
|
+
activeJobs = /* @__PURE__ */ new Map();
|
|
39097
|
+
activeTTSCount = 0;
|
|
39098
|
+
interrupted = false;
|
|
39099
|
+
lastResponseId = "";
|
|
39100
|
+
_isDestroyed = false;
|
|
39101
|
+
// Semaphore for TTS concurrency control
|
|
39102
|
+
slotWaiters = [];
|
|
39103
|
+
// Audio event buffer for interleaving with text events
|
|
39104
|
+
audioEventBuffer = [];
|
|
39105
|
+
// Async notification: resolves when new events are pushed to audioEventBuffer
|
|
39106
|
+
bufferNotify = null;
|
|
39107
|
+
// Queue backpressure
|
|
39108
|
+
queueWaiters = [];
|
|
39109
|
+
/**
|
|
39110
|
+
* Create a new VoiceStream instance
|
|
39111
|
+
*/
|
|
39112
|
+
static create(config) {
|
|
39113
|
+
return new _VoiceStream(config);
|
|
39114
|
+
}
|
|
39115
|
+
constructor(config) {
|
|
39116
|
+
super();
|
|
39117
|
+
this.tts = TextToSpeech.create({
|
|
39118
|
+
connector: config.ttsConnector,
|
|
39119
|
+
model: config.ttsModel,
|
|
39120
|
+
voice: config.voice
|
|
39121
|
+
});
|
|
39122
|
+
this.chunker = config.chunkingStrategy ?? new SentenceChunkingStrategy(config.chunkingOptions);
|
|
39123
|
+
this.format = config.format ?? "mp3";
|
|
39124
|
+
this.speed = config.speed ?? 1;
|
|
39125
|
+
this.maxConcurrentTTS = config.maxConcurrentTTS ?? 2;
|
|
39126
|
+
this.maxQueuedChunks = config.maxQueuedChunks ?? 5;
|
|
39127
|
+
this.vendorOptions = config.vendorOptions;
|
|
39128
|
+
this.streaming = config.streaming ?? false;
|
|
39129
|
+
}
|
|
39130
|
+
// ======================== Public API ========================
|
|
39131
|
+
/**
|
|
39132
|
+
* Transform an agent text stream into an augmented stream with audio events.
|
|
39133
|
+
* Original text events pass through unchanged; audio events are interleaved.
|
|
39134
|
+
*
|
|
39135
|
+
* The generator yields events in this order:
|
|
39136
|
+
* 1. All original StreamEvents (pass-through)
|
|
39137
|
+
* 2. AudioChunkReady/AudioChunkError events as TTS completes
|
|
39138
|
+
* 3. AudioStreamComplete as the final audio event
|
|
39139
|
+
*/
|
|
39140
|
+
async *wrap(textStream) {
|
|
39141
|
+
this.reset();
|
|
39142
|
+
try {
|
|
39143
|
+
for await (const event of textStream) {
|
|
39144
|
+
yield event;
|
|
39145
|
+
if (event.response_id) {
|
|
39146
|
+
this.lastResponseId = event.response_id;
|
|
39147
|
+
}
|
|
39148
|
+
if (event.type === "response.output_text.delta" /* OUTPUT_TEXT_DELTA */ && !this.interrupted) {
|
|
39149
|
+
const completedChunks = this.chunker.feed(event.delta);
|
|
39150
|
+
for (const chunk of completedChunks) {
|
|
39151
|
+
await this.scheduleTTS(chunk);
|
|
39152
|
+
}
|
|
39153
|
+
}
|
|
39154
|
+
if ((event.type === "response.output_text.done" /* OUTPUT_TEXT_DONE */ || event.type === "response.complete" /* RESPONSE_COMPLETE */) && !this.interrupted) {
|
|
39155
|
+
const remaining = this.chunker.flush();
|
|
39156
|
+
if (remaining) {
|
|
39157
|
+
await this.scheduleTTS(remaining);
|
|
39158
|
+
}
|
|
39159
|
+
}
|
|
39160
|
+
yield* this.drainAudioBuffer();
|
|
39161
|
+
}
|
|
39162
|
+
while (this.activeJobs.size > 0 || this.audioEventBuffer.length > 0) {
|
|
39163
|
+
if (this.audioEventBuffer.length === 0) {
|
|
39164
|
+
await Promise.race([
|
|
39165
|
+
this.waitForBufferNotify(),
|
|
39166
|
+
...Array.from(this.activeJobs.values()).map((j) => j.promise)
|
|
39167
|
+
]);
|
|
39168
|
+
}
|
|
39169
|
+
yield* this.drainAudioBuffer();
|
|
39170
|
+
}
|
|
39171
|
+
if (this.chunkIndex > 0) {
|
|
39172
|
+
const completeEvent = {
|
|
39173
|
+
type: "response.audio_stream.complete" /* AUDIO_STREAM_COMPLETE */,
|
|
39174
|
+
response_id: this.lastResponseId,
|
|
39175
|
+
total_chunks: this.chunkIndex,
|
|
39176
|
+
total_characters: this.totalCharacters,
|
|
39177
|
+
total_duration_seconds: this.totalDuration > 0 ? this.totalDuration : void 0
|
|
39178
|
+
};
|
|
39179
|
+
yield completeEvent;
|
|
39180
|
+
this.emit("audio:complete", {
|
|
39181
|
+
totalChunks: this.chunkIndex,
|
|
39182
|
+
totalDurationSeconds: this.totalDuration > 0 ? this.totalDuration : void 0
|
|
39183
|
+
});
|
|
39184
|
+
}
|
|
39185
|
+
} finally {
|
|
39186
|
+
this.cleanup();
|
|
39187
|
+
}
|
|
39188
|
+
}
|
|
39189
|
+
/**
|
|
39190
|
+
* Interrupt audio generation. Cancels pending TTS and flushes queue.
|
|
39191
|
+
* Call this when the user sends a new message mid-speech.
|
|
39192
|
+
* Active HTTP requests cannot be cancelled but their results will be discarded.
|
|
39193
|
+
*/
|
|
39194
|
+
interrupt() {
|
|
39195
|
+
this.interrupted = true;
|
|
39196
|
+
const pendingCount = this.activeJobs.size;
|
|
39197
|
+
this.activeJobs.clear();
|
|
39198
|
+
this.activeTTSCount = 0;
|
|
39199
|
+
this.audioEventBuffer = [];
|
|
39200
|
+
this.releaseAllWaiters();
|
|
39201
|
+
this.chunker.reset();
|
|
39202
|
+
this.emit("audio:interrupted", { pendingChunks: pendingCount });
|
|
39203
|
+
}
|
|
39204
|
+
/**
|
|
39205
|
+
* Reset state for a new stream. Called automatically by wrap().
|
|
39206
|
+
*/
|
|
39207
|
+
reset() {
|
|
39208
|
+
this.chunkIndex = 0;
|
|
39209
|
+
this.totalCharacters = 0;
|
|
39210
|
+
this.totalDuration = 0;
|
|
39211
|
+
this.activeJobs.clear();
|
|
39212
|
+
this.activeTTSCount = 0;
|
|
39213
|
+
this.interrupted = false;
|
|
39214
|
+
this.lastResponseId = "";
|
|
39215
|
+
this.audioEventBuffer = [];
|
|
39216
|
+
this.bufferNotify = null;
|
|
39217
|
+
this.slotWaiters = [];
|
|
39218
|
+
this.queueWaiters = [];
|
|
39219
|
+
this.chunker.reset();
|
|
39220
|
+
}
|
|
39221
|
+
destroy() {
|
|
39222
|
+
this.interrupt();
|
|
39223
|
+
this._isDestroyed = true;
|
|
39224
|
+
this.removeAllListeners();
|
|
39225
|
+
}
|
|
39226
|
+
get isDestroyed() {
|
|
39227
|
+
return this._isDestroyed;
|
|
39228
|
+
}
|
|
39229
|
+
// ======================== Private Methods ========================
|
|
39230
|
+
/**
|
|
39231
|
+
* Schedule a text chunk for TTS synthesis.
|
|
39232
|
+
* Awaits a free queue slot if backpressure is active (lossless).
|
|
39233
|
+
*/
|
|
39234
|
+
async scheduleTTS(text) {
|
|
39235
|
+
if (this.interrupted || this._isDestroyed) return;
|
|
39236
|
+
const cleanText = text.trim();
|
|
39237
|
+
if (cleanText.length === 0) return;
|
|
39238
|
+
while (this.activeJobs.size >= this.maxQueuedChunks && !this.interrupted) {
|
|
39239
|
+
await this.waitForQueueSlot();
|
|
39240
|
+
}
|
|
39241
|
+
if (this.interrupted) return;
|
|
39242
|
+
const index = this.chunkIndex++;
|
|
39243
|
+
this.totalCharacters += cleanText.length;
|
|
39244
|
+
const job = {
|
|
39245
|
+
index,
|
|
39246
|
+
text: cleanText,
|
|
39247
|
+
promise: this.executeTTS(index, cleanText)
|
|
39248
|
+
};
|
|
39249
|
+
this.activeJobs.set(index, job);
|
|
39250
|
+
job.promise.finally(() => {
|
|
39251
|
+
this.activeJobs.delete(index);
|
|
39252
|
+
this.releaseQueueWaiter();
|
|
39253
|
+
});
|
|
39254
|
+
}
|
|
39255
|
+
/**
|
|
39256
|
+
* Execute TTS for a single text chunk.
|
|
39257
|
+
* Respects concurrency semaphore.
|
|
39258
|
+
* Branches on streaming mode: yields sub-chunks or a single buffered chunk.
|
|
39259
|
+
*/
|
|
39260
|
+
async executeTTS(index, text) {
|
|
39261
|
+
while (this.activeTTSCount >= this.maxConcurrentTTS && !this.interrupted) {
|
|
39262
|
+
await this.waitForTTSSlot();
|
|
39263
|
+
}
|
|
39264
|
+
if (this.interrupted) return;
|
|
39265
|
+
this.activeTTSCount++;
|
|
39266
|
+
try {
|
|
39267
|
+
const ttsStart = Date.now();
|
|
39268
|
+
if (this.streaming && this.tts.supportsStreaming(this.format)) {
|
|
39269
|
+
let subIndex = 0;
|
|
39270
|
+
const streamFormat = this.format === "mp3" ? "pcm" : this.format;
|
|
39271
|
+
const MIN_BUFFER_BYTES = 6e3;
|
|
39272
|
+
const pendingBuffers = [];
|
|
39273
|
+
let pendingSize = 0;
|
|
39274
|
+
const flushPending = () => {
|
|
39275
|
+
if (pendingSize === 0) return;
|
|
39276
|
+
const merged = Buffer.concat(pendingBuffers, pendingSize);
|
|
39277
|
+
pendingBuffers.length = 0;
|
|
39278
|
+
pendingSize = 0;
|
|
39279
|
+
const currentSubIndex = subIndex++;
|
|
39280
|
+
const audioEvent = {
|
|
39281
|
+
type: "response.audio_chunk.ready" /* AUDIO_CHUNK_READY */,
|
|
39282
|
+
response_id: this.lastResponseId,
|
|
39283
|
+
chunk_index: index,
|
|
39284
|
+
sub_index: currentSubIndex,
|
|
39285
|
+
text: currentSubIndex === 0 ? text : "",
|
|
39286
|
+
audio_base64: merged.toString("base64"),
|
|
39287
|
+
format: streamFormat
|
|
39288
|
+
};
|
|
39289
|
+
this.pushAudioEvent(audioEvent);
|
|
39290
|
+
};
|
|
39291
|
+
for await (const chunk of this.tts.synthesizeStream(text, {
|
|
39292
|
+
format: streamFormat,
|
|
39293
|
+
speed: this.speed,
|
|
39294
|
+
vendorOptions: this.vendorOptions
|
|
39295
|
+
})) {
|
|
39296
|
+
if (this.interrupted) return;
|
|
39297
|
+
if (chunk.audio.length > 0) {
|
|
39298
|
+
pendingBuffers.push(chunk.audio);
|
|
39299
|
+
pendingSize += chunk.audio.length;
|
|
39300
|
+
if (pendingSize >= MIN_BUFFER_BYTES) {
|
|
39301
|
+
flushPending();
|
|
39302
|
+
}
|
|
39303
|
+
}
|
|
39304
|
+
if (chunk.isFinal) {
|
|
39305
|
+
break;
|
|
39306
|
+
}
|
|
39307
|
+
}
|
|
39308
|
+
flushPending();
|
|
39309
|
+
console.log(`[VoiceStream] TTS chunk ${index} streamed ${subIndex} sub-chunks in ${Date.now() - ttsStart}ms, text: "${text.slice(0, 40)}..."`);
|
|
39310
|
+
this.emit("audio:ready", { chunkIndex: index, text });
|
|
39311
|
+
} else {
|
|
39312
|
+
const response = await this.tts.synthesize(text, {
|
|
39313
|
+
format: this.format,
|
|
39314
|
+
speed: this.speed,
|
|
39315
|
+
vendorOptions: this.vendorOptions
|
|
39316
|
+
});
|
|
39317
|
+
if (this.interrupted) return;
|
|
39318
|
+
if (response.durationSeconds) {
|
|
39319
|
+
this.totalDuration += response.durationSeconds;
|
|
39320
|
+
}
|
|
39321
|
+
const audioEvent = {
|
|
39322
|
+
type: "response.audio_chunk.ready" /* AUDIO_CHUNK_READY */,
|
|
39323
|
+
response_id: this.lastResponseId,
|
|
39324
|
+
chunk_index: index,
|
|
39325
|
+
text,
|
|
39326
|
+
audio_base64: response.audio.toString("base64"),
|
|
39327
|
+
format: response.format,
|
|
39328
|
+
duration_seconds: response.durationSeconds,
|
|
39329
|
+
characters_used: response.charactersUsed
|
|
39330
|
+
};
|
|
39331
|
+
this.pushAudioEvent(audioEvent);
|
|
39332
|
+
console.log(`[VoiceStream] TTS chunk ${index} ready in ${Date.now() - ttsStart}ms, text: "${text.slice(0, 40)}..."`);
|
|
39333
|
+
this.emit("audio:ready", {
|
|
39334
|
+
chunkIndex: index,
|
|
39335
|
+
text,
|
|
39336
|
+
durationSeconds: response.durationSeconds
|
|
39337
|
+
});
|
|
39338
|
+
}
|
|
39339
|
+
} catch (error) {
|
|
39340
|
+
if (this.interrupted) return;
|
|
39341
|
+
const errorEvent = {
|
|
39342
|
+
type: "response.audio_chunk.error" /* AUDIO_CHUNK_ERROR */,
|
|
39343
|
+
response_id: this.lastResponseId,
|
|
39344
|
+
chunk_index: index,
|
|
39345
|
+
text,
|
|
39346
|
+
error: error.message
|
|
39347
|
+
};
|
|
39348
|
+
this.pushAudioEvent(errorEvent);
|
|
39349
|
+
this.emit("audio:error", {
|
|
39350
|
+
chunkIndex: index,
|
|
39351
|
+
text,
|
|
39352
|
+
error
|
|
39353
|
+
});
|
|
39354
|
+
} finally {
|
|
39355
|
+
this.activeTTSCount--;
|
|
39356
|
+
this.releaseTTSSlot();
|
|
39357
|
+
}
|
|
39358
|
+
}
|
|
39359
|
+
/**
|
|
39360
|
+
* Drain the audio event buffer, yielding all ready events.
|
|
39361
|
+
*/
|
|
39362
|
+
*drainAudioBuffer() {
|
|
39363
|
+
while (this.audioEventBuffer.length > 0) {
|
|
39364
|
+
yield this.audioEventBuffer.shift();
|
|
39365
|
+
}
|
|
39366
|
+
}
|
|
39367
|
+
// ======================== Buffer Notification ========================
|
|
39368
|
+
/**
|
|
39369
|
+
* Push an audio event and wake up the consumer in wrap()
|
|
39370
|
+
*/
|
|
39371
|
+
pushAudioEvent(event) {
|
|
39372
|
+
this.audioEventBuffer.push(event);
|
|
39373
|
+
if (this.bufferNotify) {
|
|
39374
|
+
this.bufferNotify();
|
|
39375
|
+
this.bufferNotify = null;
|
|
39376
|
+
}
|
|
39377
|
+
}
|
|
39378
|
+
/**
|
|
39379
|
+
* Wait until a new event is pushed to the audio buffer
|
|
39380
|
+
*/
|
|
39381
|
+
waitForBufferNotify() {
|
|
39382
|
+
return new Promise((resolve4) => {
|
|
39383
|
+
this.bufferNotify = resolve4;
|
|
39384
|
+
});
|
|
39385
|
+
}
|
|
39386
|
+
// ======================== Semaphore / Backpressure ========================
|
|
39387
|
+
waitForTTSSlot() {
|
|
39388
|
+
return new Promise((resolve4) => {
|
|
39389
|
+
this.slotWaiters.push(resolve4);
|
|
39390
|
+
});
|
|
39391
|
+
}
|
|
39392
|
+
releaseTTSSlot() {
|
|
39393
|
+
const waiter = this.slotWaiters.shift();
|
|
39394
|
+
if (waiter) waiter();
|
|
39395
|
+
}
|
|
39396
|
+
waitForQueueSlot() {
|
|
39397
|
+
return new Promise((resolve4) => {
|
|
39398
|
+
this.queueWaiters.push(resolve4);
|
|
39399
|
+
});
|
|
39400
|
+
}
|
|
39401
|
+
releaseQueueWaiter() {
|
|
39402
|
+
const waiter = this.queueWaiters.shift();
|
|
39403
|
+
if (waiter) waiter();
|
|
39404
|
+
}
|
|
39405
|
+
releaseAllWaiters() {
|
|
39406
|
+
for (const waiter of this.slotWaiters) waiter();
|
|
39407
|
+
this.slotWaiters = [];
|
|
39408
|
+
for (const waiter of this.queueWaiters) waiter();
|
|
39409
|
+
this.queueWaiters = [];
|
|
39410
|
+
if (this.bufferNotify) {
|
|
39411
|
+
this.bufferNotify();
|
|
39412
|
+
this.bufferNotify = null;
|
|
39413
|
+
}
|
|
39414
|
+
}
|
|
39415
|
+
cleanup() {
|
|
39416
|
+
this.releaseAllWaiters();
|
|
39417
|
+
}
|
|
39418
|
+
};
|
|
39419
|
+
|
|
39420
|
+
// src/capabilities/speech/AudioPlaybackQueue.ts
|
|
39421
|
+
var AudioPlaybackQueue = class {
|
|
39422
|
+
buffer = /* @__PURE__ */ new Map();
|
|
39423
|
+
nextPlayIndex = 0;
|
|
39424
|
+
onReady;
|
|
39425
|
+
constructor(onReady) {
|
|
39426
|
+
this.onReady = onReady;
|
|
39427
|
+
}
|
|
39428
|
+
/**
|
|
39429
|
+
* Enqueue an audio chunk event. If it's the next expected chunk,
|
|
39430
|
+
* it (and any subsequent buffered chunks) are immediately delivered
|
|
39431
|
+
* to the callback in order.
|
|
39432
|
+
*/
|
|
39433
|
+
enqueue(event) {
|
|
39434
|
+
this.buffer.set(event.chunk_index, event);
|
|
39435
|
+
this.drain();
|
|
39436
|
+
}
|
|
39437
|
+
/**
|
|
39438
|
+
* Reset the queue (e.g., on interruption or new stream).
|
|
39439
|
+
*/
|
|
39440
|
+
reset() {
|
|
39441
|
+
this.buffer.clear();
|
|
39442
|
+
this.nextPlayIndex = 0;
|
|
39443
|
+
}
|
|
39444
|
+
/**
|
|
39445
|
+
* Number of chunks currently buffered waiting for earlier chunks.
|
|
39446
|
+
*/
|
|
39447
|
+
get pendingCount() {
|
|
39448
|
+
return this.buffer.size;
|
|
39449
|
+
}
|
|
39450
|
+
/**
|
|
39451
|
+
* The next chunk index expected for playback.
|
|
39452
|
+
*/
|
|
39453
|
+
get nextExpectedIndex() {
|
|
39454
|
+
return this.nextPlayIndex;
|
|
39455
|
+
}
|
|
39456
|
+
// ======================== Private ========================
|
|
39457
|
+
drain() {
|
|
39458
|
+
while (this.buffer.has(this.nextPlayIndex)) {
|
|
39459
|
+
const event = this.buffer.get(this.nextPlayIndex);
|
|
39460
|
+
this.buffer.delete(this.nextPlayIndex);
|
|
39461
|
+
this.nextPlayIndex++;
|
|
39462
|
+
this.onReady(event);
|
|
39463
|
+
}
|
|
39464
|
+
}
|
|
39465
|
+
};
|
|
39466
|
+
|
|
38684
39467
|
// src/capabilities/search/SearchProvider.ts
|
|
38685
39468
|
init_Connector();
|
|
38686
39469
|
|
|
@@ -55715,6 +56498,6 @@ var EventEmitterTrigger = class {
|
|
|
55715
56498
|
}
|
|
55716
56499
|
};
|
|
55717
56500
|
|
|
55718
|
-
export { AGENT_DEFINITION_FORMAT_VERSION, AIError, APPROVAL_STATE_VERSION, Agent, AgentContextNextGen, ApproximateTokenEstimator, BaseMediaProvider, BasePluginNextGen, BaseProvider, BaseTextProvider, BraveProvider, CONNECTOR_CONFIG_VERSION, CONTEXT_SESSION_FORMAT_VERSION, CUSTOM_TOOL_DEFINITION_VERSION, CheckpointManager, CircuitBreaker, CircuitOpenError, Connector, ConnectorConfigStore, ConnectorTools, ConsoleMetrics, ContentType, ContextOverflowError, DEFAULT_ALLOWLIST, DEFAULT_BACKOFF_CONFIG, DEFAULT_BASE_DELAY_MS, DEFAULT_CHECKPOINT_STRATEGY, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONFIG2 as DEFAULT_CONFIG, DEFAULT_CONNECTOR_TIMEOUT, DEFAULT_CONTEXT_CONFIG, DEFAULT_DESKTOP_CONFIG, DEFAULT_FEATURES, DEFAULT_FILESYSTEM_CONFIG, DEFAULT_HISTORY_MANAGER_CONFIG, DEFAULT_MAX_DELAY_MS, DEFAULT_MAX_RETRIES, DEFAULT_MEMORY_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_RATE_LIMITER_CONFIG, DEFAULT_RETRYABLE_STATUSES, DEFAULT_SHELL_CONFIG, DESKTOP_TOOL_NAMES, DefaultCompactionStrategy, DependencyCycleError, DocumentReader, ErrorHandler, EventEmitterTrigger, ExecutionContext, ExternalDependencyHandler, FileAgentDefinitionStorage, FileConnectorStorage, FileContextStorage, FileCustomToolStorage, FileMediaStorage as FileMediaOutputHandler, FileMediaStorage, FilePersistentInstructionsStorage, FileRoutineDefinitionStorage, FileStorage, FileUserInfoStorage, FormatDetector, FrameworkLogger, HookManager, IMAGE_MODELS, IMAGE_MODEL_REGISTRY, ImageGeneration, InContextMemoryPluginNextGen, InMemoryAgentStateStorage, InMemoryHistoryStorage, InMemoryMetrics, InMemoryPlanStorage, InMemoryStorage, InvalidConfigError, InvalidToolArgumentsError, LLM_MODELS, LoggingPlugin, MCPClient, MCPConnectionError, MCPError, MCPProtocolError, MCPRegistry, MCPResourceError, MCPTimeoutError, MCPToolError, MEMORY_PRIORITY_VALUES, MODEL_REGISTRY, MemoryConnectorStorage, MemoryEvictionCompactor, MemoryStorage, MessageBuilder, MessageRole, ModelNotSupportedError, NoOpMetrics, NutTreeDriver, OAuthManager, ParallelTasksError, PersistentInstructionsPluginNextGen, PlanningAgent, ProviderAuthError, ProviderConfigAgent, ProviderContextLengthError, ProviderError, ProviderErrorMapper, ProviderNotFoundError, ProviderRateLimitError, ROUTINE_KEYS, RapidAPIProvider, RateLimitError, SERVICE_DEFINITIONS, SERVICE_INFO, SERVICE_URL_PATTERNS, SIMPLE_ICONS_CDN, STT_MODELS, STT_MODEL_REGISTRY, ScopedConnectorRegistry, ScrapeProvider, SearchProvider, SerperProvider, Services, SimpleScheduler, SpeechToText, StorageRegistry, StrategyRegistry, StreamEventType, StreamHelpers, StreamState, SummarizeCompactor, TERMINAL_TASK_STATUSES, TTS_MODELS, TTS_MODEL_REGISTRY, TaskTimeoutError, TaskValidationError, TavilyProvider, TextToSpeech, TokenBucketRateLimiter, ToolCallState, ToolCatalogPluginNextGen, ToolCatalogRegistry, ToolExecutionError, ToolExecutionPipeline, ToolManager, ToolNotFoundError, ToolPermissionManager, ToolRegistry, ToolTimeoutError, TruncateCompactor, UserInfoPluginNextGen, VENDORS, VENDOR_ICON_MAP, VIDEO_MODELS, VIDEO_MODEL_REGISTRY, Vendor, VideoGeneration, WorkingMemory, WorkingMemoryPluginNextGen, addJitter, allVendorTemplates, assertNotDestroyed, authenticatedFetch, backoffSequence, backoffWait, bash, buildAuthConfig, buildEndpointWithQuery, buildQueryString, calculateBackoff, calculateCost, calculateEntrySize, calculateImageCost, calculateSTTCost, calculateTTSCost, calculateVideoCost, canTaskExecute, createAgentStorage, createAuthenticatedFetch, createBashTool, createConnectorFromTemplate, createCreatePRTool, createCustomToolDelete, createCustomToolDraft, createCustomToolList, createCustomToolLoad, createCustomToolMetaTools, createCustomToolSave, createCustomToolTest, createDesktopGetCursorTool, createDesktopGetScreenSizeTool, createDesktopKeyboardKeyTool, createDesktopKeyboardTypeTool, createDesktopMouseClickTool, createDesktopMouseDragTool, createDesktopMouseMoveTool, createDesktopMouseScrollTool, createDesktopScreenshotTool, createDesktopWindowFocusTool, createDesktopWindowListTool, createDraftEmailTool, createEditFileTool, createEditMeetingTool, createEstimator, createExecuteJavaScriptTool, createExecutionRecorder, createFileAgentDefinitionStorage, createFileContextStorage, createFileCustomToolStorage, createFileMediaStorage, createFileRoutineDefinitionStorage, createFindMeetingSlotsTool, createGetMeetingTranscriptTool, createGetPRTool, createGitHubReadFileTool, createGlobTool, createGrepTool, createImageGenerationTool, createImageProvider, createListDirectoryTool, createMeetingTool, createMessageWithImages, createMetricsCollector, createMicrosoftListFilesTool, createMicrosoftReadFileTool, createMicrosoftSearchFilesTool, createPRCommentsTool, createPRFilesTool, createPlan, createProvider, createReadFileTool, createRoutineDefinition, createRoutineExecution, createRoutineExecutionRecord, createSearchCodeTool, createSearchFilesTool, createSendEmailTool, createSpeechToTextTool, createTask, createTaskSnapshots, createTextMessage, createTextToSpeechTool, createVideoProvider, createVideoTools, createWriteFileTool, customToolDelete, customToolDraft, customToolList, customToolLoad, customToolSave, customToolTest, defaultDescribeCall, desktopGetCursor, desktopGetScreenSize, desktopKeyboardKey, desktopKeyboardType, desktopMouseClick, desktopMouseDrag, desktopMouseMove, desktopMouseScroll, desktopScreenshot, desktopTools, desktopWindowFocus, desktopWindowList, detectDependencyCycle, detectServiceFromURL, developerTools, documentToContent, editFile, encodeSharingUrl, evaluateCondition, executeRoutine, extractJSON, extractJSONField, extractNumber, findConnectorByServiceTypes, forPlan, forTasks, formatAttendees, formatFileSize, formatPluginDisplayName, formatRecipients, generateEncryptionKey, generateSimplePlan, generateWebAPITool, getActiveImageModels, getActiveModels, getActiveSTTModels, getActiveTTSModels, getActiveVideoModels, getAllBuiltInTools, getAllServiceIds, getAllVendorLogos, getAllVendorTemplates, getBackgroundOutput, getConnectorTools, getCredentialsSetupURL, getDesktopDriver, getDocsURL, getDrivePrefix, getImageModelInfo, getImageModelsByVendor, getImageModelsWithFeature, getMediaOutputHandler, getMediaStorage, getModelInfo, getModelsByVendor, getNextExecutableTasks, getRegisteredScrapeProviders, getRoutineProgress, getSTTModelInfo, getSTTModelsByVendor, getSTTModelsWithFeature, getServiceDefinition, getServiceInfo, getServicesByCategory, getTTSModelInfo, getTTSModelsByVendor, getTTSModelsWithFeature, getTaskDependencies, getToolByName, getToolCallDescription, getToolCategories, getToolRegistry, getToolsByCategory, getToolsRequiringConnector, getUserPathPrefix, getVendorAuthTemplate, getVendorColor, getVendorDefaultBaseURL, getVendorInfo, getVendorLogo, getVendorLogoCdnUrl, getVendorLogoSvg, getVendorTemplate, getVideoModelInfo, getVideoModelsByVendor, getVideoModelsWithAudio, getVideoModelsWithFeature, glob, globalErrorHandler, grep, hasClipboardImage, hasVendorLogo, hydrateCustomTool, isBlockedCommand, isErrorEvent, isExcludedExtension, isKnownService, isMicrosoftFileUrl, isOutputTextDelta, isReasoningDelta, isReasoningDone, isResponseComplete, isSimpleScope, isStreamEvent, isTaskAwareScope, isTaskBlocked, isTeamsMeetingUrl, isTerminalMemoryStatus, isTerminalStatus, isToolCallArgumentsDelta, isToolCallArgumentsDone, isToolCallStart, isVendor, isWebUrl, killBackgroundProcess, listConnectorsByServiceTypes, listDirectory, listVendorIds, listVendors, listVendorsByAuthType, listVendorsByCategory, listVendorsWithLogos, logger, mergeTextPieces, metrics, microsoftFetch, normalizeEmails, parseKeyCombo, parseRepository, readClipboardImage, readDocumentAsContent, readFile5 as readFile, registerScrapeProvider, resetDefaultDriver, resolveConnector, resolveDependencies, resolveFileEndpoints, resolveFlowSource, resolveMaxContextTokens, resolveMeetingId, resolveModelCapabilities, resolveRepository, resolveTemplates, retryWithBackoff, sanitizeToolName, scopeEquals, scopeMatches, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, tools_exports as tools, updateTaskStatus, validatePath, writeFile5 as writeFile };
|
|
56501
|
+
export { AGENT_DEFINITION_FORMAT_VERSION, AIError, APPROVAL_STATE_VERSION, Agent, AgentContextNextGen, ApproximateTokenEstimator, AudioPlaybackQueue, BaseMediaProvider, BasePluginNextGen, BaseProvider, BaseTextProvider, BraveProvider, CONNECTOR_CONFIG_VERSION, CONTEXT_SESSION_FORMAT_VERSION, CUSTOM_TOOL_DEFINITION_VERSION, CheckpointManager, CircuitBreaker, CircuitOpenError, Connector, ConnectorConfigStore, ConnectorTools, ConsoleMetrics, ContentType, ContextOverflowError, DEFAULT_ALLOWLIST, DEFAULT_BACKOFF_CONFIG, DEFAULT_BASE_DELAY_MS, DEFAULT_CHECKPOINT_STRATEGY, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONFIG2 as DEFAULT_CONFIG, DEFAULT_CONNECTOR_TIMEOUT, DEFAULT_CONTEXT_CONFIG, DEFAULT_DESKTOP_CONFIG, DEFAULT_FEATURES, DEFAULT_FILESYSTEM_CONFIG, DEFAULT_HISTORY_MANAGER_CONFIG, DEFAULT_MAX_DELAY_MS, DEFAULT_MAX_RETRIES, DEFAULT_MEMORY_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_RATE_LIMITER_CONFIG, DEFAULT_RETRYABLE_STATUSES, DEFAULT_SHELL_CONFIG, DESKTOP_TOOL_NAMES, DefaultCompactionStrategy, DependencyCycleError, DocumentReader, ErrorHandler, EventEmitterTrigger, ExecutionContext, ExternalDependencyHandler, FileAgentDefinitionStorage, FileConnectorStorage, FileContextStorage, FileCustomToolStorage, FileMediaStorage as FileMediaOutputHandler, FileMediaStorage, FilePersistentInstructionsStorage, FileRoutineDefinitionStorage, FileStorage, FileUserInfoStorage, FormatDetector, FrameworkLogger, HookManager, IMAGE_MODELS, IMAGE_MODEL_REGISTRY, ImageGeneration, InContextMemoryPluginNextGen, InMemoryAgentStateStorage, InMemoryHistoryStorage, InMemoryMetrics, InMemoryPlanStorage, InMemoryStorage, InvalidConfigError, InvalidToolArgumentsError, LLM_MODELS, LoggingPlugin, MCPClient, MCPConnectionError, MCPError, MCPProtocolError, MCPRegistry, MCPResourceError, MCPTimeoutError, MCPToolError, MEMORY_PRIORITY_VALUES, MODEL_REGISTRY, MemoryConnectorStorage, MemoryEvictionCompactor, MemoryStorage, MessageBuilder, MessageRole, ModelNotSupportedError, NoOpMetrics, NutTreeDriver, OAuthManager, ParallelTasksError, PersistentInstructionsPluginNextGen, PlanningAgent, ProviderAuthError, ProviderConfigAgent, ProviderContextLengthError, ProviderError, ProviderErrorMapper, ProviderNotFoundError, ProviderRateLimitError, ROUTINE_KEYS, RapidAPIProvider, RateLimitError, SERVICE_DEFINITIONS, SERVICE_INFO, SERVICE_URL_PATTERNS, SIMPLE_ICONS_CDN, STT_MODELS, STT_MODEL_REGISTRY, ScopedConnectorRegistry, ScrapeProvider, SearchProvider, SentenceChunkingStrategy, SerperProvider, Services, SimpleScheduler, SpeechToText, StorageRegistry, StrategyRegistry, StreamEventType, StreamHelpers, StreamState, SummarizeCompactor, TERMINAL_TASK_STATUSES, TTS_MODELS, TTS_MODEL_REGISTRY, TaskTimeoutError, TaskValidationError, TavilyProvider, TextToSpeech, TokenBucketRateLimiter, ToolCallState, ToolCatalogPluginNextGen, ToolCatalogRegistry, ToolExecutionError, ToolExecutionPipeline, ToolManager, ToolNotFoundError, ToolPermissionManager, ToolRegistry, ToolTimeoutError, TruncateCompactor, UserInfoPluginNextGen, VENDORS, VENDOR_ICON_MAP, VIDEO_MODELS, VIDEO_MODEL_REGISTRY, Vendor, VideoGeneration, VoiceStream, WorkingMemory, WorkingMemoryPluginNextGen, addJitter, allVendorTemplates, assertNotDestroyed, authenticatedFetch, backoffSequence, backoffWait, bash, buildAuthConfig, buildEndpointWithQuery, buildQueryString, calculateBackoff, calculateCost, calculateEntrySize, calculateImageCost, calculateSTTCost, calculateTTSCost, calculateVideoCost, canTaskExecute, createAgentStorage, createAuthenticatedFetch, createBashTool, createConnectorFromTemplate, createCreatePRTool, createCustomToolDelete, createCustomToolDraft, createCustomToolList, createCustomToolLoad, createCustomToolMetaTools, createCustomToolSave, createCustomToolTest, createDesktopGetCursorTool, createDesktopGetScreenSizeTool, createDesktopKeyboardKeyTool, createDesktopKeyboardTypeTool, createDesktopMouseClickTool, createDesktopMouseDragTool, createDesktopMouseMoveTool, createDesktopMouseScrollTool, createDesktopScreenshotTool, createDesktopWindowFocusTool, createDesktopWindowListTool, createDraftEmailTool, createEditFileTool, createEditMeetingTool, createEstimator, createExecuteJavaScriptTool, createExecutionRecorder, createFileAgentDefinitionStorage, createFileContextStorage, createFileCustomToolStorage, createFileMediaStorage, createFileRoutineDefinitionStorage, createFindMeetingSlotsTool, createGetMeetingTranscriptTool, createGetPRTool, createGitHubReadFileTool, createGlobTool, createGrepTool, createImageGenerationTool, createImageProvider, createListDirectoryTool, createMeetingTool, createMessageWithImages, createMetricsCollector, createMicrosoftListFilesTool, createMicrosoftReadFileTool, createMicrosoftSearchFilesTool, createPRCommentsTool, createPRFilesTool, createPlan, createProvider, createReadFileTool, createRoutineDefinition, createRoutineExecution, createRoutineExecutionRecord, createSearchCodeTool, createSearchFilesTool, createSendEmailTool, createSpeechToTextTool, createTask, createTaskSnapshots, createTextMessage, createTextToSpeechTool, createVideoProvider, createVideoTools, createWriteFileTool, customToolDelete, customToolDraft, customToolList, customToolLoad, customToolSave, customToolTest, defaultDescribeCall, desktopGetCursor, desktopGetScreenSize, desktopKeyboardKey, desktopKeyboardType, desktopMouseClick, desktopMouseDrag, desktopMouseMove, desktopMouseScroll, desktopScreenshot, desktopTools, desktopWindowFocus, desktopWindowList, detectDependencyCycle, detectServiceFromURL, developerTools, documentToContent, editFile, encodeSharingUrl, evaluateCondition, executeRoutine, extractJSON, extractJSONField, extractNumber, findConnectorByServiceTypes, forPlan, forTasks, formatAttendees, formatFileSize, formatPluginDisplayName, formatRecipients, generateEncryptionKey, generateSimplePlan, generateWebAPITool, getActiveImageModels, getActiveModels, getActiveSTTModels, getActiveTTSModels, getActiveVideoModels, getAllBuiltInTools, getAllServiceIds, getAllVendorLogos, getAllVendorTemplates, getBackgroundOutput, getConnectorTools, getCredentialsSetupURL, getDesktopDriver, getDocsURL, getDrivePrefix, getImageModelInfo, getImageModelsByVendor, getImageModelsWithFeature, getMediaOutputHandler, getMediaStorage, getModelInfo, getModelsByVendor, getNextExecutableTasks, getRegisteredScrapeProviders, getRoutineProgress, getSTTModelInfo, getSTTModelsByVendor, getSTTModelsWithFeature, getServiceDefinition, getServiceInfo, getServicesByCategory, getTTSModelInfo, getTTSModelsByVendor, getTTSModelsWithFeature, getTaskDependencies, getToolByName, getToolCallDescription, getToolCategories, getToolRegistry, getToolsByCategory, getToolsRequiringConnector, getUserPathPrefix, getVendorAuthTemplate, getVendorColor, getVendorDefaultBaseURL, getVendorInfo, getVendorLogo, getVendorLogoCdnUrl, getVendorLogoSvg, getVendorTemplate, getVideoModelInfo, getVideoModelsByVendor, getVideoModelsWithAudio, getVideoModelsWithFeature, glob, globalErrorHandler, grep, hasClipboardImage, hasVendorLogo, hydrateCustomTool, isAudioChunkError, isAudioChunkReady, isAudioStreamComplete, isBlockedCommand, isErrorEvent, isExcludedExtension, isKnownService, isMicrosoftFileUrl, isOutputTextDelta, isReasoningDelta, isReasoningDone, isResponseComplete, isSimpleScope, isStreamEvent, isTaskAwareScope, isTaskBlocked, isTeamsMeetingUrl, isTerminalMemoryStatus, isTerminalStatus, isToolCallArgumentsDelta, isToolCallArgumentsDone, isToolCallStart, isVendor, isWebUrl, killBackgroundProcess, listConnectorsByServiceTypes, listDirectory, listVendorIds, listVendors, listVendorsByAuthType, listVendorsByCategory, listVendorsWithLogos, logger, mergeTextPieces, metrics, microsoftFetch, normalizeEmails, parseKeyCombo, parseRepository, readClipboardImage, readDocumentAsContent, readFile5 as readFile, registerScrapeProvider, resetDefaultDriver, resolveConnector, resolveDependencies, resolveFileEndpoints, resolveFlowSource, resolveMaxContextTokens, resolveMeetingId, resolveModelCapabilities, resolveRepository, resolveTemplates, retryWithBackoff, sanitizeToolName, scopeEquals, scopeMatches, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, tools_exports as tools, updateTaskStatus, validatePath, writeFile5 as writeFile };
|
|
55719
56502
|
//# sourceMappingURL=index.js.map
|
|
55720
56503
|
//# sourceMappingURL=index.js.map
|