@mingxy/ocosay 1.1.20 → 1.1.21
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 +8 -8
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/plugin.js
CHANGED
|
@@ -9899,6 +9899,8 @@ import { execSync as execSync2 } from "child_process";
|
|
|
9899
9899
|
import { createRequire } from "module";
|
|
9900
9900
|
var logger8 = createModuleLogger("Plugin");
|
|
9901
9901
|
var require2 = createRequire(import.meta.url);
|
|
9902
|
+
var opencodeNodeModules = join8(dirname2(require2.resolve("@opencode-ai/plugin")), "..", "..");
|
|
9903
|
+
var pluginRequire = createRequire(join8(opencodeNodeModules, "package.json"));
|
|
9902
9904
|
function getSkipFilePath() {
|
|
9903
9905
|
return join8(homedir3(), ".config", "opencode", ".naudiodon_skip");
|
|
9904
9906
|
}
|
|
@@ -10064,7 +10066,7 @@ async function ensureNaudiodonCompiled() {
|
|
|
10064
10066
|
}
|
|
10065
10067
|
function isModuleInstalled(moduleName) {
|
|
10066
10068
|
try {
|
|
10067
|
-
|
|
10069
|
+
pluginRequire.resolve(moduleName);
|
|
10068
10070
|
return true;
|
|
10069
10071
|
} catch {
|
|
10070
10072
|
return false;
|
|
@@ -10072,7 +10074,7 @@ function isModuleInstalled(moduleName) {
|
|
|
10072
10074
|
}
|
|
10073
10075
|
async function verifyModuleLoad(dep) {
|
|
10074
10076
|
try {
|
|
10075
|
-
|
|
10077
|
+
pluginRequire(dep);
|
|
10076
10078
|
logger8.info(`${dep} loaded successfully`);
|
|
10077
10079
|
return true;
|
|
10078
10080
|
} catch (err) {
|
|
@@ -10082,7 +10084,6 @@ async function verifyModuleLoad(dep) {
|
|
|
10082
10084
|
}
|
|
10083
10085
|
async function ensureSpeakerCompiled(maxRetries = 5) {
|
|
10084
10086
|
const dep = "speaker";
|
|
10085
|
-
const basePath = dirname2(require2.resolve("./package.json"));
|
|
10086
10087
|
if (isModuleInstalled(dep)) {
|
|
10087
10088
|
logger8.info("speaker already installed");
|
|
10088
10089
|
if (await verifyModuleLoad(dep)) {
|
|
@@ -10092,7 +10093,7 @@ async function ensureSpeakerCompiled(maxRetries = 5) {
|
|
|
10092
10093
|
notificationService.info("\u6B63\u5728\u7F16\u8BD1 speaker...", "Ocosay \u97F3\u9891\u540E\u7AEF", 5e3);
|
|
10093
10094
|
try {
|
|
10094
10095
|
execSync2("npm rebuild speaker", {
|
|
10095
|
-
cwd:
|
|
10096
|
+
cwd: opencodeNodeModules,
|
|
10096
10097
|
stdio: "inherit"
|
|
10097
10098
|
});
|
|
10098
10099
|
logger8.info("speaker rebuilt");
|
|
@@ -10108,7 +10109,7 @@ async function ensureSpeakerCompiled(maxRetries = 5) {
|
|
|
10108
10109
|
notificationService.info("\u6B63\u5728\u5B89\u88C5 speaker...", "Ocosay \u97F3\u9891\u540E\u7AEF", 5e3);
|
|
10109
10110
|
try {
|
|
10110
10111
|
execSync2("npm install speaker", {
|
|
10111
|
-
cwd:
|
|
10112
|
+
cwd: opencodeNodeModules,
|
|
10112
10113
|
stdio: "inherit"
|
|
10113
10114
|
});
|
|
10114
10115
|
logger8.info("speaker installed");
|
|
@@ -10125,7 +10126,7 @@ async function ensureSpeakerCompiled(maxRetries = 5) {
|
|
|
10125
10126
|
notificationService.info(`\u6B63\u5728\u91CD\u65B0\u7F16\u8BD1 speaker (${attempt + 1}/${maxRetries})...`, "Ocosay", 3e3);
|
|
10126
10127
|
try {
|
|
10127
10128
|
execSync2("npm rebuild speaker", {
|
|
10128
|
-
cwd:
|
|
10129
|
+
cwd: opencodeNodeModules,
|
|
10129
10130
|
stdio: "inherit"
|
|
10130
10131
|
});
|
|
10131
10132
|
logger8.info("speaker rebuilt");
|
|
@@ -10145,7 +10146,6 @@ async function ensureSpeakerCompiled(maxRetries = 5) {
|
|
|
10145
10146
|
}
|
|
10146
10147
|
async function ensurePlaySoundInstalled() {
|
|
10147
10148
|
const dep = "play-sound";
|
|
10148
|
-
const basePath = dirname2(require2.resolve("./package.json"));
|
|
10149
10149
|
if (isModuleInstalled(dep)) {
|
|
10150
10150
|
logger8.info("play-sound already installed");
|
|
10151
10151
|
if (await verifyModuleLoad(dep)) {
|
|
@@ -10156,7 +10156,7 @@ async function ensurePlaySoundInstalled() {
|
|
|
10156
10156
|
notificationService.info("\u6B63\u5728\u5B89\u88C5 play-sound...", "Ocosay \u97F3\u9891\u540E\u7AEF", 5e3);
|
|
10157
10157
|
try {
|
|
10158
10158
|
execSync2("npm install play-sound", {
|
|
10159
|
-
cwd:
|
|
10159
|
+
cwd: opencodeNodeModules,
|
|
10160
10160
|
stdio: "inherit"
|
|
10161
10161
|
});
|
|
10162
10162
|
logger8.info("play-sound installed");
|