@mingxy/ocosay 1.0.28 → 1.0.29
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/package.json +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +26 -24
- package/dist/plugin.js.map +3 -3
- package/dist/tools/tts.d.ts +1 -45
- package/dist/tools/tts.d.ts.map +1 -1
- package/dist/tools/tts.js +17 -54
- package/dist/tools/tts.js.map +1 -1
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAA8B,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAA8B,MAAM,qBAAqB,CAAA;AAY7E,QAAA,MAAM,EAAE,WAAW,CAAA;AAiJnB,QAAA,MAAM,MAAM,EAAE,MAmGK,CAAA;AAGnB,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAA;;;;;AACrB,wBAA6B"}
|
package/dist/plugin.js
CHANGED
|
@@ -4336,7 +4336,7 @@ var require_thread_stream = __commonJS({
|
|
|
4336
4336
|
nextFlush(stream);
|
|
4337
4337
|
});
|
|
4338
4338
|
} else {
|
|
4339
|
-
|
|
4339
|
+
destroy(stream, new Error("overwritten"));
|
|
4340
4340
|
}
|
|
4341
4341
|
}
|
|
4342
4342
|
function onWorkerMessage(msg) {
|
|
@@ -4355,7 +4355,7 @@ var require_thread_stream = __commonJS({
|
|
|
4355
4355
|
});
|
|
4356
4356
|
break;
|
|
4357
4357
|
case "ERROR":
|
|
4358
|
-
|
|
4358
|
+
destroy(stream, msg.err);
|
|
4359
4359
|
break;
|
|
4360
4360
|
case "EVENT":
|
|
4361
4361
|
if (Array.isArray(msg.args)) {
|
|
@@ -4368,7 +4368,7 @@ var require_thread_stream = __commonJS({
|
|
|
4368
4368
|
process.emitWarning(msg.err);
|
|
4369
4369
|
break;
|
|
4370
4370
|
default:
|
|
4371
|
-
|
|
4371
|
+
destroy(stream, new Error("this should not happen: " + msg.code));
|
|
4372
4372
|
}
|
|
4373
4373
|
}
|
|
4374
4374
|
function onWorkerExit(code) {
|
|
@@ -4379,7 +4379,7 @@ var require_thread_stream = __commonJS({
|
|
|
4379
4379
|
registry.unregister(stream);
|
|
4380
4380
|
stream.worker.exited = true;
|
|
4381
4381
|
stream.worker.off("exit", onWorkerExit);
|
|
4382
|
-
|
|
4382
|
+
destroy(stream, code !== 0 ? new Error("the worker thread exited") : null);
|
|
4383
4383
|
}
|
|
4384
4384
|
var ThreadStream = class extends EventEmitter6 {
|
|
4385
4385
|
constructor(opts = {}) {
|
|
@@ -4422,7 +4422,7 @@ var require_thread_stream = __commonJS({
|
|
|
4422
4422
|
writeSync(this);
|
|
4423
4423
|
this[kImpl].flushing = true;
|
|
4424
4424
|
} catch (err) {
|
|
4425
|
-
|
|
4425
|
+
destroy(this, err);
|
|
4426
4426
|
return false;
|
|
4427
4427
|
}
|
|
4428
4428
|
}
|
|
@@ -4432,7 +4432,7 @@ var require_thread_stream = __commonJS({
|
|
|
4432
4432
|
writeSync(this);
|
|
4433
4433
|
return true;
|
|
4434
4434
|
} catch (err) {
|
|
4435
|
-
|
|
4435
|
+
destroy(this, err);
|
|
4436
4436
|
return false;
|
|
4437
4437
|
}
|
|
4438
4438
|
}
|
|
@@ -4460,7 +4460,7 @@ var require_thread_stream = __commonJS({
|
|
|
4460
4460
|
const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX);
|
|
4461
4461
|
wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
|
|
4462
4462
|
if (err) {
|
|
4463
|
-
|
|
4463
|
+
destroy(this, err);
|
|
4464
4464
|
process.nextTick(cb, err);
|
|
4465
4465
|
return;
|
|
4466
4466
|
}
|
|
@@ -4517,7 +4517,7 @@ var require_thread_stream = __commonJS({
|
|
|
4517
4517
|
stream.emit("error", err);
|
|
4518
4518
|
});
|
|
4519
4519
|
}
|
|
4520
|
-
function
|
|
4520
|
+
function destroy(stream, err) {
|
|
4521
4521
|
if (stream[kImpl].destroyed) {
|
|
4522
4522
|
return;
|
|
4523
4523
|
}
|
|
@@ -4563,11 +4563,11 @@ var require_thread_stream = __commonJS({
|
|
|
4563
4563
|
Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
|
|
4564
4564
|
readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
|
|
4565
4565
|
if (readIndex === -2) {
|
|
4566
|
-
|
|
4566
|
+
destroy(stream, new Error("end() failed"));
|
|
4567
4567
|
return;
|
|
4568
4568
|
}
|
|
4569
4569
|
if (++spins === 10) {
|
|
4570
|
-
|
|
4570
|
+
destroy(stream, new Error("end() took too long (10s)"));
|
|
4571
4571
|
return;
|
|
4572
4572
|
}
|
|
4573
4573
|
}
|
|
@@ -4576,7 +4576,7 @@ var require_thread_stream = __commonJS({
|
|
|
4576
4576
|
stream.emit("finish");
|
|
4577
4577
|
});
|
|
4578
4578
|
} catch (err) {
|
|
4579
|
-
|
|
4579
|
+
destroy(stream, err);
|
|
4580
4580
|
}
|
|
4581
4581
|
}
|
|
4582
4582
|
function writeSync(stream) {
|
|
@@ -7877,21 +7877,30 @@ function extractTextArg(args) {
|
|
|
7877
7877
|
return text.trim();
|
|
7878
7878
|
}
|
|
7879
7879
|
const text7 = argObj.text7;
|
|
7880
|
-
if (
|
|
7881
|
-
|
|
7882
|
-
|
|
7880
|
+
if (text7 !== null && text7 !== void 0) {
|
|
7881
|
+
if (typeof text7 === "string" && text7.trim().length > 0) {
|
|
7882
|
+
console.warn("[tts] Received text7 instead of text from OpenCode framework");
|
|
7883
|
+
return text7.trim();
|
|
7884
|
+
}
|
|
7885
|
+
if (typeof text7 === "object" && "content" in text7) {
|
|
7886
|
+
const content = text7.content;
|
|
7887
|
+
if (typeof content === "string" && content.trim().length > 0) {
|
|
7888
|
+
console.warn("[tts] text7 is an object with content field");
|
|
7889
|
+
return content.trim();
|
|
7890
|
+
}
|
|
7891
|
+
}
|
|
7892
|
+
console.warn("[tts] text7 is not a valid string or object with content, type:", typeof text7);
|
|
7883
7893
|
}
|
|
7884
7894
|
for (const key of Object.keys(argObj)) {
|
|
7885
7895
|
if (key.startsWith("text") && key !== "text" && key !== "text7") {
|
|
7886
7896
|
const val = argObj[key];
|
|
7887
7897
|
if (typeof val === "string" && val.trim().length > 0) {
|
|
7888
|
-
console.debug(`[tts] Using ${key} as text source`);
|
|
7889
7898
|
return val.trim();
|
|
7890
7899
|
}
|
|
7891
7900
|
}
|
|
7892
7901
|
}
|
|
7893
7902
|
if (text !== void 0) {
|
|
7894
|
-
console.warn("[tts] text arg is not a valid string, type:", typeof text
|
|
7903
|
+
console.warn("[tts] text arg is not a valid string, type:", typeof text);
|
|
7895
7904
|
}
|
|
7896
7905
|
return void 0;
|
|
7897
7906
|
}
|
|
@@ -7903,14 +7912,7 @@ async function handleToolCall(toolName, args) {
|
|
|
7903
7912
|
if (!text) {
|
|
7904
7913
|
return { success: false, error: "No valid text found in args" };
|
|
7905
7914
|
}
|
|
7906
|
-
await speak(text
|
|
7907
|
-
provider: args?.provider,
|
|
7908
|
-
voice: args?.voice,
|
|
7909
|
-
model: args?.model,
|
|
7910
|
-
speed: args?.speed,
|
|
7911
|
-
volume: args?.volume,
|
|
7912
|
-
pitch: args?.pitch
|
|
7913
|
-
});
|
|
7915
|
+
await speak(text);
|
|
7914
7916
|
return { success: true, message: "Speech completed" };
|
|
7915
7917
|
}
|
|
7916
7918
|
case "tts_stop":
|