@gobing-ai/knowledge-kit 0.0.22 → 0.0.23

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.
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "plugins": [
8
8
  {
9
- "version": "0.0.22",
9
+ "version": "0.0.23",
10
10
  "name": "kk",
11
11
  "source": "./plugins/kk",
12
12
  "description": "knowledge-kit — a set of toolkit for knowledge management"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/knowledge-kit",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "An ingest → create → publish content pipeline CLI (Bun).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,101 @@
1
+ # gemini-tts operator runbook
2
+
3
+ One-time setup for the replicated `robin-news` voice, and the yearly renewal. The daily workflow
4
+ stays on `vdriver: voicebox` until you opt in with `vdriver: gemini`.
5
+
6
+ The API key stays in the environment or in `~/.config/kk/config.yaml`. This runbook never asks you
7
+ to paste it into the repo. Source and consent clips are biometric data: keep them out of git.
8
+ Operator-run copies belong in a scratch directory outside the checkout.
9
+
10
+ ## Consent statement
11
+
12
+ The same speaker as the source clip reads this verbatim, in zh-CN:
13
+
14
+ > 我是此声音的拥有者并授权谷歌使用此声音创建语音合成模型
15
+
16
+ Or in English (en-US):
17
+
18
+ > I am the owner of this voice and I consent to Google using it to create a synthetic voice model.
19
+
20
+ Note: Google's verification model penalizes cross-lingual acoustic drift (e.g. Chinese source clip paired with an English consent clip will fail with `Voice mismatch detected`). To replicate cleanly, ensure both source and consent are in the same language. A clean 10–30 s English recording containing the consent statement can be passed as both `--source` and `--consent`.
21
+
22
+ ## Export the Voicebox sample
23
+
24
+ The consent clip lives in Voicebox as a cloned-voice profile named `gemini-consent-clip`, not as a
25
+ history entry (`GET /history` 500s on the current build). Default origin: `http://127.0.0.1:17493`.
26
+
27
+ 1. `GET /profiles` and match `name == gemini-consent-clip`.
28
+ 2. `GET /profiles/{id}/samples` and take that profile's sample id.
29
+ 3. `GET /samples/{sample_id}` — the body is `audio/wav`.
30
+
31
+ Write that body to a scratch file, for example `$T/consent.wav`.
32
+
33
+ The source clip is already in the repo and already 24 kHz mono 16-bit PCM, about 28 s:
34
+
35
+ `plugins/generations/omni-voice-gen/voices/robin-news.wav`
36
+
37
+ ## Convert a clip that is not already 24 kHz mono s16
38
+
39
+ Skip this when `ffprobe` already reports `24000 Hz`, `1` channel, `pcm_s16le`.
40
+
41
+ ```sh
42
+ ffmpeg -i consent.m4a -ar 24000 -ac 1 -sample_fmt s16 consent.wav
43
+ ```
44
+
45
+ `voice-create` rejects anything else. A source clip must also be 10–30 seconds. The error names the
46
+ measured rate, channels, bit depth, and duration.
47
+
48
+ ## Create the stored voice
49
+
50
+ `--store` defaults to `true`. An unstored `voicekey_…` id expires in 7 days and is the wrong choice
51
+ for the daily workflow. Create with `gemini-3.8-flash-tts` (or omit `--model`). `gemini-3.8-flash-lite-tts`
52
+ does not replicate: the API returns HTTP 400 telling you to omit `voice.model`. A stored voice can
53
+ then be synthesized with either TTS model.
54
+
55
+ ```sh
56
+ T=$(mktemp -d)
57
+ # fetch the consent sample into "$T/consent.wav" (see above)
58
+ GEMINI_API_KEY="$GEMINI_API_KEY" bun plugins/generations/gemini-tts/src/voice-create.ts \
59
+ --source plugins/generations/omni-voice-gen/voices/robin-news.wav \
60
+ --consent "$T/consent.wav" \
61
+ --name robin-news
62
+ rm -rf "$T"
63
+ ```
64
+
65
+ Stdout is the `voice_…` id. A non-zero exit prints the HTTP status and API message and does not
66
+ print the key. Note on HTTP 500 / Voice mismatch errors:
67
+ - Upstream `POST /v1beta/voices` can return HTTP 500 when server-side validation serializes an invalid argument or consent mismatch.
68
+ - A Chinese source paired with an English consent fails with `Voice mismatch detected`.
69
+ - Using a clean 10–30s English recording containing the verbatim consent statement as both `--source` and `--consent` succeeds reliably via the API, creating a stored voice that synthesizes both English and Chinese content.
70
+ - Google AI Studio's interactive voice replication UI is also available as a manual fallback.
71
+ Re-record the source and consent in one session and retry if needed; do not commit the clips.
72
+
73
+ ## Wire the id
74
+
75
+ Write the operator-private map `~/.config/kk/gemini-tts-profiles.json`:
76
+
77
+ ```json
78
+ { "robin-news": { "voice": "voice_…" } }
79
+ ```
80
+
81
+ Point the plugin at it. Under `plugins.generations.gemini-tts.env` in `~/.config/kk/config.yaml`:
82
+
83
+ ```yaml
84
+ GEMINI_TTS_PROFILES: /Users/<you>/.config/kk/gemini-tts-profiles.json
85
+ ```
86
+
87
+ The committed `profiles.json` stays on `voice_REPLACE_ME`. That placeholder fails closed with a
88
+ pointer back to this file.
89
+
90
+ Then render once per model (`gemini-3.8-flash-tts` and `gemini-3.8-flash-lite-tts`). If flash-lite
91
+ rejects the stored voice, keep `GEMINI_TTS_MODEL` on the creation model. Create a second voice only
92
+ when you explicitly want a lite-specific id.
93
+
94
+ Run the daily workflow with `--vars '{"vdriver":"gemini"}'`. The default `vdriver` remains
95
+ `voicebox`.
96
+
97
+ ## Renewal
98
+
99
+ A stored voice lasts 1 year (200 stored voices per project, shared with prompted voices). Before
100
+ `expire_time`, repeat export → create → replace the id in the operator map. Delete the scratch
101
+ clips when the new id is wired. Do not commit the wavs or the voice id.