@xrkseek/harness 0.7.6 → 0.7.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/node_modules/@xrkseek/a2a/dist/inbound.d.ts.map +1 -1
- package/node_modules/@xrkseek/a2a/dist/inbound.js +72 -2
- package/node_modules/@xrkseek/a2a/dist/inbound.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/subagent-prompt.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/subagent-prompt.js +2 -0
- package/node_modules/@xrkseek/core-tools/dist/subagent-prompt.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/README.md +4 -3
- package/node_modules/@xrkseek/exec-voice/dist/browser/index.d.ts +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/browser/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/browser/index.js +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/browser/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/browser/wav-capture.d.ts +91 -0
- package/node_modules/@xrkseek/exec-voice/dist/browser/wav-capture.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/browser/wav-capture.js +269 -0
- package/node_modules/@xrkseek/exec-voice/dist/browser/wav-capture.js.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/download-http.d.ts +46 -0
- package/node_modules/@xrkseek/exec-voice/dist/download-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/download-http.js +223 -0
- package/node_modules/@xrkseek/exec-voice/dist/download-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/engine-ids.d.ts +19 -0
- package/node_modules/@xrkseek/exec-voice/dist/engine-ids.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/engine-ids.js +36 -0
- package/node_modules/@xrkseek/exec-voice/dist/engine-ids.js.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/engines.d.ts +60 -0
- package/node_modules/@xrkseek/exec-voice/dist/engines.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/engines.js +130 -0
- package/node_modules/@xrkseek/exec-voice/dist/engines.js.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/format.d.ts +13 -0
- package/node_modules/@xrkseek/exec-voice/dist/format.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/format.js +22 -3
- package/node_modules/@xrkseek/exec-voice/dist/format.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/index.d.ts +23 -31
- package/node_modules/@xrkseek/exec-voice/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/index.js +17 -66
- package/node_modules/@xrkseek/exec-voice/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/readiness.d.ts +14 -8
- package/node_modules/@xrkseek/exec-voice/dist/readiness.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/readiness.js +36 -27
- package/node_modules/@xrkseek/exec-voice/dist/readiness.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-assets.d.ts +48 -0
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-assets.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-assets.js +64 -0
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-assets.js.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-local.d.ts +24 -0
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-local.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-local.js +66 -4
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-local.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-runtime.d.ts +78 -0
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-runtime.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-runtime.js +332 -0
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-runtime.js.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/system-tts.d.ts +40 -0
- package/node_modules/@xrkseek/exec-voice/dist/system-tts.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/system-tts.js +260 -0
- package/node_modules/@xrkseek/exec-voice/dist/system-tts.js.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/tools.d.ts +13 -12
- package/node_modules/@xrkseek/exec-voice/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/tools.js +12 -6
- package/node_modules/@xrkseek/exec-voice/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/types.d.ts +3 -1
- package/node_modules/@xrkseek/exec-voice/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/types.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/package.json +39 -31
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts +4 -3
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.js +31 -18
- package/node_modules/@xrkseek/preset-harness/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/protocol/dist/sidebar-previews.d.ts +2 -0
- package/node_modules/@xrkseek/protocol/dist/sidebar-previews.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/sidebar-previews.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/adapt/subagent-notice.d.ts +21 -2
- package/node_modules/@xrkseek/server-face/dist/adapt/subagent-notice.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/adapt/subagent-notice.js +56 -7
- package/node_modules/@xrkseek/server-face/dist/adapt/subagent-notice.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-roster-store.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-roster-store.js +26 -3
- package/node_modules/@xrkseek/server-face/dist/agent-roster-store.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-team-roles.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-team-roles.js +4 -0
- package/node_modules/@xrkseek/server-face/dist/agent-team-roles.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/dispatch.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/dispatch.js +16 -0
- package/node_modules/@xrkseek/server-face/dist/dispatch.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/voice.d.ts +30 -0
- package/node_modules/@xrkseek/server-face/dist/handlers/voice.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/handlers/voice.js +195 -0
- package/node_modules/@xrkseek/server-face/dist/handlers/voice.js.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/model-catalog.d.ts +15 -0
- package/node_modules/@xrkseek/server-face/dist/model-catalog.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/model-catalog.js +44 -10
- package/node_modules/@xrkseek/server-face/dist/model-catalog.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.js +7 -2
- package/node_modules/@xrkseek/server-face/dist/runtime.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/select-session-model.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/select-session-model.js +68 -1
- package/node_modules/@xrkseek/server-face/dist/select-session-model.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-posture.js +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-posture.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-tool-copy.d.ts +4 -0
- package/node_modules/@xrkseek/server-face/dist/session-tool-copy.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-tool-copy.js +16 -0
- package/node_modules/@xrkseek/server-face/dist/session-tool-copy.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-tools.js +2 -0
- package/node_modules/@xrkseek/server-face/dist/session-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-document.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-document.js +56 -1
- package/node_modules/@xrkseek/server-face/dist/settings-document.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js +42 -12
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts +43 -0
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.js +293 -24
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/wire/paths.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/wire/paths.js +6 -0
- package/node_modules/@xrkseek/server-face/dist/wire/paths.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/workspace-orchestrate-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/workspace-orchestrate-tools.js +4 -1
- package/node_modules/@xrkseek/server-face/dist/workspace-orchestrate-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/package.json +1 -0
- package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.js +8 -1
- package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.d.ts +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.js +44 -45
- package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.js +2 -0
- package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.js.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-tool-pre.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-tool-pre.js +5 -2
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/auto-review-tool-pre.js.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/our-free-model-host.d.ts +15 -0
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/our-free-model-host.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/our-free-model-host.js +61 -3
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/our-free-model-host.js.map +1 -1
- package/node_modules/sherpa-onnx-node/README.md +11 -0
- package/node_modules/sherpa-onnx-node/addon-static-import.js +76 -0
- package/node_modules/sherpa-onnx-node/addon.js +98 -0
- package/node_modules/sherpa-onnx-node/audio-tagg.js +45 -0
- package/node_modules/sherpa-onnx-node/keyword-spotter.js +68 -0
- package/node_modules/sherpa-onnx-node/non-streaming-asr.js +158 -0
- package/node_modules/sherpa-onnx-node/non-streaming-speaker-diarization.js +38 -0
- package/node_modules/sherpa-onnx-node/non-streaming-speech-denoiser.js +32 -0
- package/node_modules/sherpa-onnx-node/non-streaming-tts.js +117 -0
- package/node_modules/sherpa-onnx-node/online-speech-denoiser.js +46 -0
- package/node_modules/sherpa-onnx-node/package.json +68 -0
- package/node_modules/sherpa-onnx-node/punctuation.js +43 -0
- package/node_modules/sherpa-onnx-node/resampler.js +80 -0
- package/node_modules/sherpa-onnx-node/sherpa-onnx.js +49 -0
- package/node_modules/sherpa-onnx-node/speaker-identification.js +152 -0
- package/node_modules/sherpa-onnx-node/spoken-language-identification.js +38 -0
- package/node_modules/sherpa-onnx-node/streaming-asr.js +181 -0
- package/node_modules/sherpa-onnx-node/types.js +833 -0
- package/node_modules/sherpa-onnx-node/vad.js +134 -0
- package/node_modules/sherpa-onnx-win-x64/README.md +3 -0
- package/node_modules/sherpa-onnx-win-x64/index.js +1 -0
- package/node_modules/sherpa-onnx-win-x64/onnxruntime.dll +0 -0
- package/node_modules/sherpa-onnx-win-x64/onnxruntime_providers_shared.dll +0 -0
- package/node_modules/sherpa-onnx-win-x64/package.json +65 -0
- package/node_modules/sherpa-onnx-win-x64/sherpa-onnx-c-api.dll +0 -0
- package/node_modules/sherpa-onnx-win-x64/sherpa-onnx-cxx-api.dll +0 -0
- package/node_modules/sherpa-onnx-win-x64/sherpa-onnx.node +0 -0
- package/package.json +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensevoice-local.js","sourceRoot":"","sources":["../src/sensevoice-local.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,UAAU,GASX,MAAM,YAAY,CAAC;AAEpB,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAyB/D,SAAS,WAAW,CAAC,GAAsB;IACzC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC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,QAAQ,EAAE,kBAAkB;oBAC5B,QAAQ,EAAE,OAAO;oBACjB,QAAQ,EAAE,CAAC,IAAI;iBAChB,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,UAAU;oBAAE,MAAM,GAAG,CAAC;gBACzC,MAAM,IAAI,UAAU,CAClB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAChD,eAAe,CAChB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,KAAK,CAAC,iBAAiB,CACrB,IAA4B;YAE5B,MAAM,IAAI,UAAU,CAClB,wDAAwD,EACxD,wBAAwB,CACzB,CAAC;QACJ,CAAC;QACD,UAAU;YACR,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;YAC/B,OAAO;gBACL,SAAS,EAAE,KAAK;gBAChB,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,kBAAkB;gBAC5B,MAAM,EAAE,MAAM,CAAC,KAAK;oBAClB,CAAC,CAAC,MAAM,CAAC,EAAE;wBACT,CAAC,CAAC,mCAAmC;wBACrC,CAAC,CAAC,iBAAiB,MAAM,CAAC,MAAM,EAAE;oBACpC,CAAC,CAAC,yBAAyB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,GAAG;aACtE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Where the preparer is in its lifecycle. */
|
|
2
|
+
export type SenseVoicePreparePhase = "idle" | "preparing" | "ready" | "failed";
|
|
3
|
+
/** Failure taxonomy — the card turns each of these into one "do this next" line. */
|
|
4
|
+
export type SenseVoicePrepareErrorCode = "network" | "timeout" | "http" | "integrity" | "storage"
|
|
5
|
+
/** The operator's `downloadProxy` text cannot be used as written. */
|
|
6
|
+
| "proxy" | "cancelled" | "unknown";
|
|
7
|
+
export interface SenseVoicePrepareFailure {
|
|
8
|
+
readonly code: SenseVoicePrepareErrorCode;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
/** Origin that was serving when it broke (absent for local failures). */
|
|
11
|
+
readonly origin?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SenseVoicePrepareState {
|
|
14
|
+
readonly phase: SenseVoicePreparePhase;
|
|
15
|
+
/** Asset id in flight; `null` when idle / ready. */
|
|
16
|
+
readonly current: string | null;
|
|
17
|
+
readonly bytesDone: number;
|
|
18
|
+
readonly bytesTotal: number;
|
|
19
|
+
/** Smoothed bytes/second of the current asset (0 before the first sample). */
|
|
20
|
+
readonly speedBps: number;
|
|
21
|
+
readonly failure: SenseVoicePrepareFailure | null;
|
|
22
|
+
/** Origin serving the current transfer. */
|
|
23
|
+
readonly origin: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface SenseVoicePreparerOptions {
|
|
26
|
+
/** Absolute cache directory (`{XRK_HOME}/voice/sensevoice` by default). */
|
|
27
|
+
readonly dataRoot: string;
|
|
28
|
+
readonly origins?: readonly string[];
|
|
29
|
+
readonly fetchImpl?: typeof fetch;
|
|
30
|
+
/**
|
|
31
|
+
* How long one origin may take to answer with response headers before the
|
|
32
|
+
* walk moves to the next one. Only the wait for *headers* is bounded — a
|
|
33
|
+
* body that has started arriving keeps its full transfer time.
|
|
34
|
+
*/
|
|
35
|
+
readonly originTimeoutMs?: number;
|
|
36
|
+
/** Progress tick floor; a 238 MB body would otherwise re-render hundreds of times a second. */
|
|
37
|
+
readonly progressIntervalMs?: number;
|
|
38
|
+
}
|
|
39
|
+
export declare class SenseVoicePreparer {
|
|
40
|
+
private readonly options;
|
|
41
|
+
private state;
|
|
42
|
+
private controller;
|
|
43
|
+
private running;
|
|
44
|
+
constructor(options: SenseVoicePreparerOptions);
|
|
45
|
+
/** Latest state (the Face handler serializes this straight to the card). */
|
|
46
|
+
snapshot(): SenseVoicePrepareState;
|
|
47
|
+
/** True when a transfer is in flight. */
|
|
48
|
+
get busy(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Walk every asset: skip verified-by-size files, download the rest.
|
|
51
|
+
* @param options - Per-run transport overrides; `proxy` is the operator's
|
|
52
|
+
* HTTP CONNECT proxy for hosts that cannot reach the origins directly.
|
|
53
|
+
* @returns the settled state (never throws — failures land on the state).
|
|
54
|
+
*/
|
|
55
|
+
prepare(options?: {
|
|
56
|
+
readonly proxy?: string;
|
|
57
|
+
}): Promise<SenseVoicePrepareState>;
|
|
58
|
+
/** Abort an in-flight prepare; the state settles as `failed/cancelled`. */
|
|
59
|
+
cancel(): SenseVoicePrepareState;
|
|
60
|
+
private patch;
|
|
61
|
+
private download;
|
|
62
|
+
/**
|
|
63
|
+
* Open one asset URL.
|
|
64
|
+
*
|
|
65
|
+
* The default path is @see openAssetStream, which probes every DNS record —
|
|
66
|
+
* `fetch` here connected to a black-holed address and reported a 10 s
|
|
67
|
+
* connect timeout while `curl` on the same box succeeded in 1.5 s. The
|
|
68
|
+
* `fetchImpl` seam stays for tests that script responses.
|
|
69
|
+
* @param url - Absolute asset URL.
|
|
70
|
+
* @param signal - Caller cancellation.
|
|
71
|
+
* @param proxy - Operator-configured HTTP CONNECT proxy, if any.
|
|
72
|
+
* @returns Status plus the body stream.
|
|
73
|
+
*/
|
|
74
|
+
private open;
|
|
75
|
+
private writeVerified;
|
|
76
|
+
}
|
|
77
|
+
export declare function senseVoicePreparer(options: SenseVoicePreparerOptions): SenseVoicePreparer;
|
|
78
|
+
//# sourceMappingURL=sensevoice-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensevoice-runtime.d.ts","sourceRoot":"","sources":["../src/sensevoice-runtime.ts"],"names":[],"mappings":"AA8BA,8CAA8C;AAC9C,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/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CAAC,OAAO,CAAS;gBAEK,OAAO,EAAE,yBAAyB;IAE/D,4EAA4E;IAC5E,QAAQ,IAAI,sBAAsB;IAIlC,yCAAyC;IACzC,IAAI,IAAI,IAAI,OAAO,CAElB;IAED;;;;;OAKG;IACG,OAAO,CAAC,OAAO,GAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAqEzF,2EAA2E;IAC3E,MAAM,IAAI,sBAAsB;IAKhC,OAAO,CAAC,KAAK;YAIC,QAAQ;IA8DtB;;;;;;;;;;;OAWG;YACW,IAAI;YAcJ,aAAa;CA+D5B;AAUD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,kBAAkB,CAQpB"}
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SenseVoice asset preparer — fetch, verify, publish; never leave a half file.
|
|
3
|
+
*
|
|
4
|
+
* The invariants worth keeping (all of them learned from a broken download):
|
|
5
|
+
* 1. One `.part` file per asset, removed before the transfer starts, so a
|
|
6
|
+
* crash leaves garbage we can delete rather than a file that looks ready.
|
|
7
|
+
* 2. sha256 is computed **while** streaming, and the declared byte count is a
|
|
8
|
+
* ceiling — a mirror answering with an HTML error page fails at the first
|
|
9
|
+
* chunk instead of writing 238 MB of markup.
|
|
10
|
+
* 3. Publish is a single `rename` inside the same directory: readers either
|
|
11
|
+
* see the old state or the verified file, never a prefix of it.
|
|
12
|
+
* 4. Origins are walked in order (huggingface.co → hf-mirror.com). A failed
|
|
13
|
+
* origin is retried from byte zero — no ranged resume, because a mirror
|
|
14
|
+
* that died mid-body cannot be trusted to agree on the prefix.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately not here: ranged resume, concurrent multi-origin racing, and a
|
|
17
|
+
* background idle reaper. One user, one press, one transfer (YAGNI until the
|
|
18
|
+
* product proves otherwise).
|
|
19
|
+
*/
|
|
20
|
+
import { createHash } from "node:crypto";
|
|
21
|
+
import { promises as fs } from "node:fs";
|
|
22
|
+
import path from "node:path";
|
|
23
|
+
import { SENSEVOICE_ASSETS, SENSEVOICE_ORIGINS, SENSEVOICE_TOTAL_BYTES, } from "./sensevoice-assets.js";
|
|
24
|
+
import { openAssetStream, parseProxy } from "./download-http.js";
|
|
25
|
+
const REPORT_FLOOR_MS = 250;
|
|
26
|
+
/**
|
|
27
|
+
* A dead origin must not own the whole press.
|
|
28
|
+
*
|
|
29
|
+
* `huggingface.co` from a mainland link does not refuse — it black-holes, so
|
|
30
|
+
* an unbounded `fetch` sat at 0 % for as long as the socket kept waiting.
|
|
31
|
+
* Twelve seconds is long enough for a slow-but-alive mirror and short enough
|
|
32
|
+
* that the next origin is tried while the user is still watching.
|
|
33
|
+
*/
|
|
34
|
+
const ORIGIN_HEADER_TIMEOUT_MS = 12_000;
|
|
35
|
+
/**
|
|
36
|
+
* Adapt a `fetch` body to the one stream shape `writeVerified` consumes, so
|
|
37
|
+
* the injected test seam and the real downloader share every downstream step
|
|
38
|
+
* (hashing, byte ceiling, `.part` handling, atomic publish).
|
|
39
|
+
* @param stream - Web stream from a `Response`.
|
|
40
|
+
* @returns The same bytes as an async iterable.
|
|
41
|
+
*/
|
|
42
|
+
async function* bodyChunks(stream) {
|
|
43
|
+
const reader = stream.getReader();
|
|
44
|
+
try {
|
|
45
|
+
for (;;) {
|
|
46
|
+
const { done, value } = await reader.read();
|
|
47
|
+
if (done)
|
|
48
|
+
return;
|
|
49
|
+
yield value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
reader.releaseLock();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function classify(err, abortedByCaller) {
|
|
57
|
+
if (abortedByCaller) {
|
|
58
|
+
return { code: "cancelled", message: "preparation cancelled" };
|
|
59
|
+
}
|
|
60
|
+
const name = err instanceof Error ? err.name : "";
|
|
61
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
62
|
+
if (name === "AbortError" || name === "TimeoutError") {
|
|
63
|
+
return { code: "timeout", message };
|
|
64
|
+
}
|
|
65
|
+
if (/sha256|byte count|exceeded/i.test(message)) {
|
|
66
|
+
return { code: "integrity", message };
|
|
67
|
+
}
|
|
68
|
+
if (/ENOSPC|EACCES|EPERM|EROFS|ENOENT/i.test(message)) {
|
|
69
|
+
return { code: "storage", message };
|
|
70
|
+
}
|
|
71
|
+
return { code: "network", message };
|
|
72
|
+
}
|
|
73
|
+
/** One prepared asset on disk: size is the fast check, sha256 the slow truth. */
|
|
74
|
+
async function statSize(file) {
|
|
75
|
+
try {
|
|
76
|
+
const info = await fs.stat(file);
|
|
77
|
+
return info.isFile() ? info.size : undefined;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export class SenseVoicePreparer {
|
|
84
|
+
options;
|
|
85
|
+
state = {
|
|
86
|
+
phase: "idle",
|
|
87
|
+
current: null,
|
|
88
|
+
bytesDone: 0,
|
|
89
|
+
bytesTotal: SENSEVOICE_TOTAL_BYTES,
|
|
90
|
+
speedBps: 0,
|
|
91
|
+
failure: null,
|
|
92
|
+
origin: null,
|
|
93
|
+
};
|
|
94
|
+
controller = null;
|
|
95
|
+
running = false;
|
|
96
|
+
constructor(options) {
|
|
97
|
+
this.options = options;
|
|
98
|
+
}
|
|
99
|
+
/** Latest state (the Face handler serializes this straight to the card). */
|
|
100
|
+
snapshot() {
|
|
101
|
+
return this.state;
|
|
102
|
+
}
|
|
103
|
+
/** True when a transfer is in flight. */
|
|
104
|
+
get busy() {
|
|
105
|
+
return this.running;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Walk every asset: skip verified-by-size files, download the rest.
|
|
109
|
+
* @param options - Per-run transport overrides; `proxy` is the operator's
|
|
110
|
+
* HTTP CONNECT proxy for hosts that cannot reach the origins directly.
|
|
111
|
+
* @returns the settled state (never throws — failures land on the state).
|
|
112
|
+
*/
|
|
113
|
+
async prepare(options = {}) {
|
|
114
|
+
if (this.running)
|
|
115
|
+
return this.state;
|
|
116
|
+
this.running = true;
|
|
117
|
+
const controller = new AbortController();
|
|
118
|
+
this.controller = controller;
|
|
119
|
+
this.state = {
|
|
120
|
+
phase: "preparing",
|
|
121
|
+
current: null,
|
|
122
|
+
bytesDone: 0,
|
|
123
|
+
bytesTotal: SENSEVOICE_TOTAL_BYTES,
|
|
124
|
+
speedBps: 0,
|
|
125
|
+
failure: null,
|
|
126
|
+
origin: null,
|
|
127
|
+
};
|
|
128
|
+
// Check the proxy before touching the network. Letting each origin fail on
|
|
129
|
+
// its own would burn three header deadlines to say what one string says
|
|
130
|
+
// now, and the card could not tell a bad address from a dead mirror.
|
|
131
|
+
const proxySetting = options.proxy ?? process.env.XRK_DOWNLOAD_PROXY;
|
|
132
|
+
const proxyCheck = parseProxy(proxySetting);
|
|
133
|
+
if (proxyCheck.error !== undefined) {
|
|
134
|
+
this.running = false;
|
|
135
|
+
this.state = {
|
|
136
|
+
...this.state,
|
|
137
|
+
phase: "failed",
|
|
138
|
+
failure: {
|
|
139
|
+
code: "proxy",
|
|
140
|
+
message: `download proxy is unusable (${proxySetting ?? ""}): ${proxyCheck.error}`,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
return this.state;
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
let done = 0;
|
|
147
|
+
for (const asset of SENSEVOICE_ASSETS) {
|
|
148
|
+
const dest = path.join(this.options.dataRoot, asset.file);
|
|
149
|
+
if ((await statSize(dest)) === asset.bytes) {
|
|
150
|
+
// Size match means a previous run already published it. The sha256
|
|
151
|
+
// was verified at that publish; re-hashing 238 MB on every open would
|
|
152
|
+
// cost more than the risk it removes.
|
|
153
|
+
done += asset.bytes;
|
|
154
|
+
this.patch({ bytesDone: done, current: asset.id });
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
await this.download(asset, done, controller.signal, options.proxy);
|
|
158
|
+
done += asset.bytes;
|
|
159
|
+
}
|
|
160
|
+
this.state = {
|
|
161
|
+
...this.state,
|
|
162
|
+
phase: "ready",
|
|
163
|
+
current: null,
|
|
164
|
+
bytesDone: SENSEVOICE_TOTAL_BYTES,
|
|
165
|
+
speedBps: 0,
|
|
166
|
+
origin: null,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
this.state = {
|
|
171
|
+
...this.state,
|
|
172
|
+
phase: "failed",
|
|
173
|
+
current: null,
|
|
174
|
+
speedBps: 0,
|
|
175
|
+
failure: classify(err, controller.signal.aborted),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
this.running = false;
|
|
180
|
+
this.controller = null;
|
|
181
|
+
}
|
|
182
|
+
return this.state;
|
|
183
|
+
}
|
|
184
|
+
/** Abort an in-flight prepare; the state settles as `failed/cancelled`. */
|
|
185
|
+
cancel() {
|
|
186
|
+
this.controller?.abort();
|
|
187
|
+
return this.snapshot();
|
|
188
|
+
}
|
|
189
|
+
patch(next) {
|
|
190
|
+
this.state = { ...this.state, ...next };
|
|
191
|
+
}
|
|
192
|
+
async download(asset, doneBefore, signal, proxy) {
|
|
193
|
+
const origins = this.options.origins ?? SENSEVOICE_ORIGINS;
|
|
194
|
+
await fs.mkdir(this.options.dataRoot, { recursive: true });
|
|
195
|
+
const dest = path.join(this.options.dataRoot, asset.file);
|
|
196
|
+
const part = `${dest}.part`;
|
|
197
|
+
let lastFailure = null;
|
|
198
|
+
for (const origin of origins) {
|
|
199
|
+
if (signal.aborted)
|
|
200
|
+
throw new DOMException("aborted", "AbortError");
|
|
201
|
+
this.patch({ current: asset.id, origin });
|
|
202
|
+
// Bound only the wait for headers. The gate is cleared the instant they
|
|
203
|
+
// land, so the body below is governed by the caller's signal alone —
|
|
204
|
+
// otherwise a 238 MB transfer on a slow link would be cut at the same
|
|
205
|
+
// deadline that exists to catch a dead origin.
|
|
206
|
+
const gate = new AbortController();
|
|
207
|
+
const headerTimeoutMs = this.options.originTimeoutMs ?? ORIGIN_HEADER_TIMEOUT_MS;
|
|
208
|
+
let headerTimedOut = false;
|
|
209
|
+
const gateTimer = setTimeout(() => {
|
|
210
|
+
headerTimedOut = true;
|
|
211
|
+
gate.abort();
|
|
212
|
+
}, headerTimeoutMs);
|
|
213
|
+
try {
|
|
214
|
+
const opened = await this.open(`${origin}${asset.path}`, AbortSignal.any([signal, gate.signal]), proxy);
|
|
215
|
+
clearTimeout(gateTimer);
|
|
216
|
+
if (opened.status < 200 || opened.status >= 300 || opened.body === null) {
|
|
217
|
+
lastFailure = {
|
|
218
|
+
code: "http",
|
|
219
|
+
message: `HTTP ${opened.status}`,
|
|
220
|
+
origin,
|
|
221
|
+
};
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
await this.writeVerified(asset, opened.body, part, dest, doneBefore, origin, signal);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
catch (err) {
|
|
228
|
+
clearTimeout(gateTimer);
|
|
229
|
+
if (signal.aborted)
|
|
230
|
+
throw err;
|
|
231
|
+
lastFailure = headerTimedOut
|
|
232
|
+
? {
|
|
233
|
+
code: "timeout",
|
|
234
|
+
message: `no response in ${headerTimeoutMs} ms`,
|
|
235
|
+
origin,
|
|
236
|
+
}
|
|
237
|
+
: { ...classify(err, false), origin };
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
throw new Error(lastFailure === null
|
|
241
|
+
? `no origin could serve ${asset.file}`
|
|
242
|
+
: `${asset.file}: ${lastFailure.code} — ${lastFailure.message}`);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Open one asset URL.
|
|
246
|
+
*
|
|
247
|
+
* The default path is @see openAssetStream, which probes every DNS record —
|
|
248
|
+
* `fetch` here connected to a black-holed address and reported a 10 s
|
|
249
|
+
* connect timeout while `curl` on the same box succeeded in 1.5 s. The
|
|
250
|
+
* `fetchImpl` seam stays for tests that script responses.
|
|
251
|
+
* @param url - Absolute asset URL.
|
|
252
|
+
* @param signal - Caller cancellation.
|
|
253
|
+
* @param proxy - Operator-configured HTTP CONNECT proxy, if any.
|
|
254
|
+
* @returns Status plus the body stream.
|
|
255
|
+
*/
|
|
256
|
+
async open(url, signal, proxy) {
|
|
257
|
+
const fetchImpl = this.options.fetchImpl;
|
|
258
|
+
if (fetchImpl === undefined)
|
|
259
|
+
return openAssetStream(url, signal, proxy);
|
|
260
|
+
const response = await fetchImpl(url, { signal });
|
|
261
|
+
return {
|
|
262
|
+
status: response.status,
|
|
263
|
+
body: response.body === null ? null : bodyChunks(response.body),
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
async writeVerified(asset, body, part, dest, doneBefore, origin, signal) {
|
|
267
|
+
// A leftover `.part` is garbage from a crashed run; drop it before `w`.
|
|
268
|
+
await fs.rm(part, { force: true });
|
|
269
|
+
const handle = await fs.open(part, "w", 0o600);
|
|
270
|
+
const hash = createHash("sha256");
|
|
271
|
+
const startedAt = Date.now();
|
|
272
|
+
let received = 0;
|
|
273
|
+
let lastReport = 0;
|
|
274
|
+
try {
|
|
275
|
+
for await (const value of body) {
|
|
276
|
+
if (signal.aborted)
|
|
277
|
+
throw new DOMException("aborted", "AbortError");
|
|
278
|
+
received += value.byteLength;
|
|
279
|
+
if (received > asset.bytes) {
|
|
280
|
+
throw new Error(`byte count exceeded for ${asset.file} (${received} > ${asset.bytes})`);
|
|
281
|
+
}
|
|
282
|
+
hash.update(value);
|
|
283
|
+
let offset = 0;
|
|
284
|
+
while (offset < value.byteLength) {
|
|
285
|
+
const { bytesWritten } = await handle.write(value, offset, value.byteLength - offset);
|
|
286
|
+
offset += bytesWritten;
|
|
287
|
+
}
|
|
288
|
+
const now = Date.now();
|
|
289
|
+
if (now - lastReport >= (this.options.progressIntervalMs ?? REPORT_FLOOR_MS)) {
|
|
290
|
+
lastReport = now;
|
|
291
|
+
const elapsed = Math.max(1, now - startedAt) / 1000;
|
|
292
|
+
this.patch({
|
|
293
|
+
bytesDone: doneBefore + received,
|
|
294
|
+
speedBps: Math.round(received / elapsed),
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
await handle.sync();
|
|
299
|
+
}
|
|
300
|
+
finally {
|
|
301
|
+
await handle.close();
|
|
302
|
+
}
|
|
303
|
+
if (received !== asset.bytes) {
|
|
304
|
+
await fs.rm(part, { force: true });
|
|
305
|
+
throw new Error(`byte count mismatch for ${asset.file} (${received} != ${asset.bytes})`);
|
|
306
|
+
}
|
|
307
|
+
const digest = hash.digest("hex");
|
|
308
|
+
if (digest !== asset.sha256) {
|
|
309
|
+
await fs.rm(part, { force: true });
|
|
310
|
+
throw new Error(`sha256 mismatch for ${asset.file} (${digest} != ${asset.sha256})`);
|
|
311
|
+
}
|
|
312
|
+
await fs.rename(part, dest);
|
|
313
|
+
this.patch({ bytesDone: doneBefore + received, origin });
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* One preparer per data root for the life of the process.
|
|
318
|
+
*
|
|
319
|
+
* Two cards (or two sessions) pressing download must never race on the same
|
|
320
|
+
* `.part`, and the state has to survive a settings panel reopening mid-transfer.
|
|
321
|
+
*/
|
|
322
|
+
const preparers = new Map();
|
|
323
|
+
export function senseVoicePreparer(options) {
|
|
324
|
+
const key = path.resolve(options.dataRoot);
|
|
325
|
+
let existing = preparers.get(key);
|
|
326
|
+
if (existing === undefined) {
|
|
327
|
+
existing = new SenseVoicePreparer({ ...options, dataRoot: key });
|
|
328
|
+
preparers.set(key, existing);
|
|
329
|
+
}
|
|
330
|
+
return existing;
|
|
331
|
+
}
|
|
332
|
+
//# sourceMappingURL=sensevoice-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensevoice-runtime.js","sourceRoot":"","sources":["../src/sensevoice-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aA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";
|
|
2
|
+
/** One voice the Host's OS can speak with. */
|
|
3
|
+
export interface SystemVoice {
|
|
4
|
+
/** Value a card writes into `tts.voice`. */
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** Human label, usually `Name (locale)`. */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
}
|
|
9
|
+
/** How one system backend is driven. */
|
|
10
|
+
export interface SystemVoiceOptions {
|
|
11
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
12
|
+
/** Defaults to `process.platform`; a test seam. */
|
|
13
|
+
readonly platform?: NodeJS.Platform;
|
|
14
|
+
/** Voice selected when a request carries none. */
|
|
15
|
+
readonly defaultVoice?: string;
|
|
16
|
+
/** Test seam: run one command and resolve stdout. */
|
|
17
|
+
readonly run?: SystemRunner;
|
|
18
|
+
}
|
|
19
|
+
/** `execFile` with the flags every backend needs. */
|
|
20
|
+
type SystemRunner = (file: string, args: readonly string[], env: NodeJS.ProcessEnv) => Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* List the OS voices this Host can speak with, best-effort.
|
|
23
|
+
*
|
|
24
|
+
* A failed probe returns `[]`: the card still lets the user type a voice name,
|
|
25
|
+
* so an empty list must not read as "local TTS is broken".
|
|
26
|
+
* @param options - platform / env / runner overrides.
|
|
27
|
+
* @returns installed voices, or an empty list when the probe fails.
|
|
28
|
+
*/
|
|
29
|
+
export declare function listSystemVoices(options?: SystemVoiceOptions): Promise<SystemVoice[]>;
|
|
30
|
+
/**
|
|
31
|
+
* A {@link VoiceService} that synthesises with the Host's own OS voices.
|
|
32
|
+
*
|
|
33
|
+
* STT and live sessions are deliberately unsupported: this Provider exists to
|
|
34
|
+
* make `text_to_speech` work with zero credentials, nothing else.
|
|
35
|
+
* @param options - platform / env / runner / default-voice overrides.
|
|
36
|
+
* @returns the Provider.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createSystemVoiceProvider(options?: SystemVoiceOptions): VoiceService;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=system-tts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-tts.d.ts","sourceRoot":"","sources":["../src/system-tts.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAIV,YAAY,EAKb,MAAM,YAAY,CAAC;AAGpB,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,wCAAwC;AACxC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IACpC,kDAAkD;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,qDAAqD;AACrD,KAAK,YAAY,GAAG,CAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,CAAC,UAAU,KACnB,OAAO,CAAC,MAAM,CAAC,CAAC;AAoIrB;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,WAAW,EAAE,CAAC,CAoBxB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,kBAAuB,GAC/B,YAAY,CA2Hd"}
|