@yoooclaw/cli 0.1.7 → 0.1.8
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/bin.cjs +54 -5
- package/dist/bin.cjs.map +4 -4
- package/dist/index.cjs +54 -5
- package/dist/index.cjs.map +4 -4
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -4273,7 +4273,7 @@ function buildContext(flags) {
|
|
|
4273
4273
|
var import_node_fs3 = require("node:fs");
|
|
4274
4274
|
function readBuildInjectedVersion() {
|
|
4275
4275
|
if (false) {}
|
|
4276
|
-
const version = "0.1.
|
|
4276
|
+
const version = "0.1.8".trim();
|
|
4277
4277
|
return version || undefined;
|
|
4278
4278
|
}
|
|
4279
4279
|
function readVersionFromPackageJson() {
|
|
@@ -11641,6 +11641,9 @@ function overrideRecordingSync(deps) {
|
|
|
11641
11641
|
const { runtime, storage: storage2, logger, fallbackApiKey, asrConfigDir, notifyStatus } = deps;
|
|
11642
11642
|
const readFallbackApiKey = () => typeof fallbackApiKey === "function" ? fallbackApiKey() : fallbackApiKey;
|
|
11643
11643
|
const inFlight = new Map;
|
|
11644
|
+
function resolveConfiguredAsr(callerAsr) {
|
|
11645
|
+
return resolveAsrConfig(callerAsr, loadLocalAsrConfig(asrConfigDir), readFallbackApiKey());
|
|
11646
|
+
}
|
|
11644
11647
|
function markInFlight(recordingId) {
|
|
11645
11648
|
clearTimeout(inFlight.get(recordingId));
|
|
11646
11649
|
inFlight.set(recordingId, setTimeout(() => inFlight.delete(recordingId), INFLIGHT_TIMEOUT_MS));
|
|
@@ -11699,8 +11702,7 @@ function overrideRecordingSync(deps) {
|
|
|
11699
11702
|
}
|
|
11700
11703
|
};
|
|
11701
11704
|
}
|
|
11702
|
-
const
|
|
11703
|
-
const asr = resolveAsrConfig(params.asr, localAsr, readFallbackApiKey());
|
|
11705
|
+
const asr = resolveConfiguredAsr(params.asr);
|
|
11704
11706
|
if (asr && !params.asr) {
|
|
11705
11707
|
logger.info(`[recording-sync] 使用本地 asr-config.json(mode=${asr.mode}${asr.mode === "api" && asr.api?.apiKey ? ", key=ock-***" : ""})`);
|
|
11706
11708
|
}
|
|
@@ -11708,6 +11710,45 @@ function overrideRecordingSync(deps) {
|
|
|
11708
11710
|
const result = await handleRecordingSync(recordingId, recording, storage2, asr, logger, { notifyStatus: wrappedNotifyStatus });
|
|
11709
11711
|
return { ok: true, data: result };
|
|
11710
11712
|
}
|
|
11713
|
+
function retranscribe(params) {
|
|
11714
|
+
const recordingId = trimToString(params.recordingId);
|
|
11715
|
+
if (!recordingId) {
|
|
11716
|
+
return { ok: false, code: "INVALID_PARAMS", message: "recordingId is required" };
|
|
11717
|
+
}
|
|
11718
|
+
if (params.asr) {
|
|
11719
|
+
const err = validateAsrConfig(params.asr);
|
|
11720
|
+
if (err)
|
|
11721
|
+
return { ok: false, code: "ASR_NOT_CONFIGURED", message: err };
|
|
11722
|
+
}
|
|
11723
|
+
const asr = resolveConfiguredAsr(params.asr);
|
|
11724
|
+
const asrError = validateAsrConfig(asr);
|
|
11725
|
+
if (asrError) {
|
|
11726
|
+
return { ok: false, code: "ASR_NOT_CONFIGURED", message: asrError };
|
|
11727
|
+
}
|
|
11728
|
+
const entry = storage2.findById(recordingId);
|
|
11729
|
+
if (!entry) {
|
|
11730
|
+
return { ok: false, code: "NOT_FOUND", message: `Recording not found: ${recordingId}` };
|
|
11731
|
+
}
|
|
11732
|
+
if (!canStartTranscription(entry.status)) {
|
|
11733
|
+
return {
|
|
11734
|
+
ok: false,
|
|
11735
|
+
code: "INVALID_STATE",
|
|
11736
|
+
message: `Recording status does not allow retranscribe: ${entry.status}`
|
|
11737
|
+
};
|
|
11738
|
+
}
|
|
11739
|
+
if (asr && !params.asr) {
|
|
11740
|
+
logger.info(`[recording-retranscribe] 使用本地 asr-config.json(mode=${asr.mode}${asr.mode === "api" && asr.api?.apiKey ? ", key=ock-***" : ""})`);
|
|
11741
|
+
}
|
|
11742
|
+
triggerTranscription(recordingId, storage2, asr, logger, {
|
|
11743
|
+
notifyStatus: wrappedNotifyStatus
|
|
11744
|
+
}).catch((err) => {
|
|
11745
|
+
logger.error(`[recording-retranscribe] 重试转写失败: ${recordingId}, ${err?.message ?? err}`);
|
|
11746
|
+
});
|
|
11747
|
+
return {
|
|
11748
|
+
ok: true,
|
|
11749
|
+
data: { ok: true, recordingId, message: "转写已重新触发" }
|
|
11750
|
+
};
|
|
11751
|
+
}
|
|
11711
11752
|
runtime.registerGatewayMethod("recordings.sync", async ({ params, respond }) => {
|
|
11712
11753
|
const outcome = await doSync(params ?? {});
|
|
11713
11754
|
if (outcome.ok) {
|
|
@@ -11719,6 +11760,14 @@ function overrideRecordingSync(deps) {
|
|
|
11719
11760
|
respond(false, null, { code: outcome.code, message: outcome.message });
|
|
11720
11761
|
}
|
|
11721
11762
|
});
|
|
11763
|
+
runtime.registerGatewayMethod("recordings.retranscribe", ({ params, respond }) => {
|
|
11764
|
+
const outcome = retranscribe(params ?? {});
|
|
11765
|
+
if (outcome.ok) {
|
|
11766
|
+
respond(true, outcome.data);
|
|
11767
|
+
} else {
|
|
11768
|
+
respond(false, null, { code: outcome.code, message: outcome.message });
|
|
11769
|
+
}
|
|
11770
|
+
});
|
|
11722
11771
|
runtime.registerHttpRoute({
|
|
11723
11772
|
path: "/recordings",
|
|
11724
11773
|
auth: "gateway",
|
|
@@ -11744,7 +11793,7 @@ function overrideRecordingSync(deps) {
|
|
|
11744
11793
|
}
|
|
11745
11794
|
}
|
|
11746
11795
|
});
|
|
11747
|
-
logger.info("daemon 已覆盖 recordings.sync + POST /recordings(注入本地 ASR 配置)");
|
|
11796
|
+
logger.info("daemon 已覆盖 recordings.sync / recordings.retranscribe + POST /recordings(注入本地 ASR 配置)");
|
|
11748
11797
|
}
|
|
11749
11798
|
async function readJsonBody(req) {
|
|
11750
11799
|
const chunks = [];
|
|
@@ -14783,5 +14832,5 @@ async function run(argv = process.argv) {
|
|
|
14783
14832
|
// src/bin.ts
|
|
14784
14833
|
run(process.argv);
|
|
14785
14834
|
|
|
14786
|
-
//# debugId=
|
|
14835
|
+
//# debugId=00EB932D99327BB264756E2164756E21
|
|
14787
14836
|
//# sourceMappingURL=bin.cjs.map
|