@mingxy/ocosay 1.1.27 → 1.1.28
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.js +3 -54
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/plugin.js
CHANGED
|
@@ -10526,59 +10526,6 @@ async function initAsync() {
|
|
|
10526
10526
|
await ensureSpeakerInstalledAsync();
|
|
10527
10527
|
}, 100);
|
|
10528
10528
|
}
|
|
10529
|
-
async function ensureSpeakerCompiled(maxRetries = 5) {
|
|
10530
|
-
const dep = "speaker";
|
|
10531
|
-
if (isModuleInstalled(dep)) {
|
|
10532
|
-
logger9.info("speaker already installed");
|
|
10533
|
-
if (await verifyModuleLoad(dep)) {
|
|
10534
|
-
return;
|
|
10535
|
-
}
|
|
10536
|
-
logger9.info("speaker installed but not loadable, rebuilding");
|
|
10537
|
-
notificationService.info("\u6B63\u5728\u7F16\u8BD1 speaker...", "Ocosay \u97F3\u9891\u540E\u7AEF", 5e3);
|
|
10538
|
-
const rebuildResult = await execAsync("npm rebuild speaker", opencodeNodeModules);
|
|
10539
|
-
if (rebuildResult.error) {
|
|
10540
|
-
logger9.warn({ err: rebuildResult.error }, "speaker rebuild failed");
|
|
10541
|
-
} else {
|
|
10542
|
-
logger9.info("speaker rebuilt");
|
|
10543
|
-
}
|
|
10544
|
-
if (await verifyModuleLoad(dep)) {
|
|
10545
|
-
notificationService.success("speaker \u7F16\u8BD1\u6210\u529F", "\u97F3\u9891\u540E\u7AEF\u5DF2\u5C31\u7EEA", 5e3);
|
|
10546
|
-
return;
|
|
10547
|
-
}
|
|
10548
|
-
} else {
|
|
10549
|
-
logger9.info("speaker not found, installing");
|
|
10550
|
-
notificationService.info("\u6B63\u5728\u5B89\u88C5 speaker...", "Ocosay \u97F3\u9891\u540E\u7AEF", 5e3);
|
|
10551
|
-
const installResult = await execAsync("npm install speaker", opencodeNodeModules);
|
|
10552
|
-
if (installResult.error) {
|
|
10553
|
-
logger9.warn({ err: installResult.error }, "speaker install failed");
|
|
10554
|
-
} else {
|
|
10555
|
-
logger9.info("speaker installed");
|
|
10556
|
-
}
|
|
10557
|
-
}
|
|
10558
|
-
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
10559
|
-
if (await verifyModuleLoad(dep)) {
|
|
10560
|
-
notificationService.success("speaker \u7F16\u8BD1\u6210\u529F", "\u97F3\u9891\u540E\u7AEF\u5DF2\u5C31\u7EEA", 5e3);
|
|
10561
|
-
return;
|
|
10562
|
-
}
|
|
10563
|
-
logger9.info({ attempt, dep }, "speaker not loadable, trying rebuild");
|
|
10564
|
-
notificationService.info(`\u6B63\u5728\u91CD\u65B0\u7F16\u8BD1 speaker (${attempt + 1}/${maxRetries})...`, "Ocosay", 3e3);
|
|
10565
|
-
const rebuildResult = await execAsync("npm rebuild speaker", opencodeNodeModules);
|
|
10566
|
-
if (rebuildResult.error) {
|
|
10567
|
-
logger9.warn({ err: rebuildResult.error }, "speaker rebuild failed");
|
|
10568
|
-
} else {
|
|
10569
|
-
logger9.info("speaker rebuilt");
|
|
10570
|
-
}
|
|
10571
|
-
if (await verifyModuleLoad(dep)) {
|
|
10572
|
-
notificationService.success("speaker \u7F16\u8BD1\u6210\u529F", "\u97F3\u9891\u540E\u7AEF\u5DF2\u5C31\u7EEA", 5e3);
|
|
10573
|
-
return;
|
|
10574
|
-
}
|
|
10575
|
-
if (attempt < maxRetries - 1) {
|
|
10576
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
10577
|
-
}
|
|
10578
|
-
}
|
|
10579
|
-
logger9.error({ dep }, "speaker could not be compiled");
|
|
10580
|
-
notificationService.error("speaker \u7F16\u8BD1\u5931\u8D25", "\u8BF7\u624B\u52A8\u8FD0\u884C: npm install speaker && npm rebuild speaker", 8e3);
|
|
10581
|
-
}
|
|
10582
10529
|
async function ensurePlaySoundInstalled() {
|
|
10583
10530
|
const dep = "play-sound";
|
|
10584
10531
|
if (isModuleInstalled(dep)) {
|
|
@@ -10611,7 +10558,9 @@ async function ensurePlaySoundInstalled() {
|
|
|
10611
10558
|
}
|
|
10612
10559
|
}
|
|
10613
10560
|
async function ensureOptionalDepsInstalled() {
|
|
10614
|
-
|
|
10561
|
+
ensureSpeakerCompiledAsync().catch((err) => {
|
|
10562
|
+
logger9.warn({ err }, "ensureSpeakerCompiledAsync failed");
|
|
10563
|
+
});
|
|
10615
10564
|
await ensurePlaySoundInstalled();
|
|
10616
10565
|
}
|
|
10617
10566
|
function execCmd2(cmd) {
|