sisyo 1.6.7 → 1.7.0

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.
Files changed (42) hide show
  1. package/README.md +6 -1
  2. package/bin/known-hashes.json +109 -0
  3. package/bin/sisyo.js +285 -285
  4. package/package.json +30 -30
  5. package/templates/.claude/rules/agents-and-tests.md +24 -0
  6. package/templates/.claude/skills/g6-style/SKILL.md +125 -0
  7. package/templates/.claude/skills/g6-style/references/checks.md +58 -0
  8. package/templates/.claude/skills/g6-style/references/imagery.md +103 -0
  9. package/templates/.claude/skills/g6-style/references/motion.md +121 -0
  10. package/templates/.claude/skills/g6-style/references/sections.md +263 -0
  11. package/templates/.claude/skills/g6-style/references/tokens.md +197 -0
  12. package/templates/.claude/skills/hindsight/SKILL.md +13 -10
  13. package/templates/.claude/skills/i18n-multilang/SKILL.md +153 -0
  14. package/templates/.claude/skills/i18n-multilang/assets/languages.json +47 -0
  15. package/templates/.claude/skills/i18n-multilang/assets/plural-vectors.json +46 -0
  16. package/templates/.claude/skills/i18n-multilang/assets/project/README.md +17 -0
  17. package/templates/.claude/skills/i18n-multilang/assets/project/gitattributes.txt +6 -0
  18. package/templates/.claude/skills/i18n-multilang/assets/project/gitignore.txt +4 -0
  19. package/templates/.claude/skills/i18n-multilang/assets/project/glossary.json +6 -0
  20. package/templates/.claude/skills/i18n-multilang/assets/project/i18n.config.json +22 -0
  21. package/templates/.claude/skills/i18n-multilang/assets/project/locales/__source__/common.json +10 -0
  22. package/templates/.claude/skills/i18n-multilang/assets/project/notes/common.json +5 -0
  23. package/templates/.claude/skills/i18n-multilang/assets/project/style.md +20 -0
  24. package/templates/.claude/skills/i18n-multilang/references/format.md +100 -0
  25. package/templates/.claude/skills/i18n-multilang/references/languages.md +97 -0
  26. package/templates/.claude/skills/i18n-multilang/references/layout-and-versioning.md +256 -0
  27. package/templates/.claude/skills/i18n-multilang/references/numbers.md +161 -0
  28. package/templates/.claude/skills/i18n-multilang/references/platform-unity.md +142 -0
  29. package/templates/.claude/skills/i18n-multilang/references/platform-web.md +107 -0
  30. package/templates/.claude/skills/i18n-multilang/references/translation.md +143 -0
  31. package/templates/.claude/skills/i18n-multilang/references/voice.md +271 -0
  32. package/templates/.claude/skills/i18n-multilang/scripts/i18n.py +1041 -0
  33. package/templates/.claude/skills/i18n-multilang/scripts/numwords.py +1013 -0
  34. package/templates/.claude/skills/i18n-multilang/scripts/voice.py +478 -0
  35. package/templates/.claude/skills/neon-game-ui-ux-skill/COMPONENTS.md +490 -0
  36. package/templates/.claude/skills/neon-game-ui-ux-skill/GAMIFICATION.md +246 -0
  37. package/templates/.claude/skills/neon-game-ui-ux-skill/ICONS.md +249 -0
  38. package/templates/.claude/skills/neon-game-ui-ux-skill/LAYOUT-NAV.md +362 -0
  39. package/templates/.claude/skills/neon-game-ui-ux-skill/MOTION-A11Y.md +168 -0
  40. package/templates/.claude/skills/neon-game-ui-ux-skill/SKILL.md +137 -0
  41. package/templates/.claude/skills/neon-game-ui-ux-skill/TOKENS.md +323 -0
  42. package/templates/SISYO.md +1 -1
@@ -0,0 +1,271 @@
1
+ # Voice
2
+
3
+ ## Contents
4
+ 1. Scope: voice is opt-in
5
+ 2. Where the voice comes from: the project's voice backend
6
+ 3. Declaring voice in a project
7
+ 4. The pipeline
8
+ 5. Text version and voice version: when the text changes first
9
+ 6. Rules on a voice server
10
+ 7. Checking every clip
11
+ 8. Files, formats, storage
12
+ 9. In the app
13
+
14
+ ## 1. Scope: voice is opt-in
15
+
16
+ - **Most products have no voice at all.** Text is the standard; voice is an option a few products add. A product
17
+ whose config has no `voice.languages` or no `voice.sets` has nothing to do with this file.
18
+ - Text and voice are separate. A product has text in up to 40 languages and voice in **zero to ten**, each with its
19
+ own version (section 5). Voice does not follow text one to one: a story game voices its dialogue, a game of
20
+ buttons voices nothing.
21
+ - Voice exists only for (a) the languages in `voice.languages` and (b) the lines selected by `voice.sets`. Both are
22
+ empty by default. **Do not add a language or a set because it seems useful: the owner names them.**
23
+ - The ten default voice languages: en, ja, es, pt-BR, ko, zh-Hans, de, fr, vi, id (`"voice": true` in the registry).
24
+ Another language needs three things first: a voice for it in the backend, a registry entry with `"voice": true`
25
+ (the project's `extraLanguages`), and number rules for it in `scripts/numwords.py`.
26
+
27
+ ## 2. Where the voice comes from: the project's voice backend
28
+
29
+ This skill ships no TTS engine and names none. A product with voice has **one voice backend** chosen by its owner
30
+ (a self-hosted TTS or voice-cloning server, or a hosted TTS service) and one voice family on it. The backend is
31
+ described where agents will read it: in the project's `SISYO.md`, or in a file that `SISYO.md` points to (for
32
+ example `docs/09_integrations/voice-backend.md`). In this file its address is written `<voice-host>`; the real
33
+ address, like any key, belongs in the project's private docs and environment, never in a shared skill.
34
+
35
+ **Before generating anything, read that description**, and the backend's own README if it has one. It must answer:
36
+
37
+ | Question | Why it matters |
38
+ |---|---|
39
+ | Address, and which endpoint is used for synthesis | so nothing else on the server is touched |
40
+ | Where the API key lives (an env file on the server, a secret store) | the key is never printed, copied or committed |
41
+ | The voice name for each language | goes into `voice.voicePattern` / `voice.voices`; a clip is tied to the voice that made it |
42
+ | Whose voice it is and under what consent or licence | what may be done with it: commercial use, which languages, what is forbidden |
43
+ | Endpoints and actions that are forbidden | on some servers a write to history or profiles destroys the owner's saved work |
44
+ | Capacity: what else runs on the machine, allowed concurrency, time windows | a bulk run must not starve other services |
45
+ | Who operates and restarts it | an agent does not |
46
+
47
+ If the description is missing or does not answer these, stop and ask the owner. Do not guess a backend, and do not
48
+ switch to another TTS service because the named one is unavailable.
49
+
50
+ Rules that hold for any backend:
51
+ - Choose the voice by the **language of the text**. A voice made for one language gives other languages an accent
52
+ and misreads them: a language without its own voice in the backend is not synthesised with another one. Ask the
53
+ owner.
54
+ - A cloned voice is a real person's. It is used only within their written consent. **Never export, upload, share or
55
+ re-encode the reference recordings or the voice profiles**, and never send them, or the voice, to another service.
56
+ Generated clips are product assets and may be published; the references may not. Never use the voice for fraud,
57
+ to impersonate the person, or to pass voice authentication.
58
+ - Label output as AI-generated where a law or platform requires it.
59
+ - No other voice or TTS service is used for shipped audio unless the owner says so for that product.
60
+
61
+ ## 3. Declaring voice in a project
62
+
63
+ `i18n.config.json`:
64
+
65
+ ```json
66
+ "voice": {
67
+ "languages": ["vi", "en", "ja"],
68
+ "fallback": "en",
69
+ "voicePattern": "Narrator-{lang}",
70
+ "sets": {
71
+ "common": { "include": ["voice:*"] },
72
+ "chapter01": { "include": ["chapter01:dlg.*", "chapter01:hint.*"], "exclude": ["chapter01:*.title"] }
73
+ },
74
+ "numberStyle": { "vi": { "four": "tư" } },
75
+ "format": "mp3"
76
+ }
77
+ ```
78
+
79
+ - A **voice line is a text key**. Its id is `ns:key`; its words are that key's translation. There is no second list
80
+ of sentences to keep in step.
81
+ - A **set** is a group of lines downloaded together (shared lines, one chapter, one feature). Patterns are shell-style
82
+ (`*`) on `ns:key`; a line belongs to the first set that matches. Keep a set to what one screen or chapter needs, so
83
+ the app downloads little at a time.
84
+ - `voicePattern`: the backend's voice name per language, with `{lang}` replaced by the language code (default
85
+ `{lang}`); `voices` (`{"pt-BR": "Narrator-pt"}`) overrides single languages. The voice name is part of every
86
+ clip's identity: changing it makes all clips of that language stale.
87
+ - `fallback`: the voice language used when the user's text language has no voice (`"en"`), or `"none"` for silence.
88
+ A product decision: for young children, hearing English under Thai text may be worse than no voice.
89
+ - **Spoken-text overrides** in `i18n/voice/speak/<lang>.json`, for a line whose spoken words differ from the shown
90
+ text (a number with a symbol or a counter, an abbreviation, a name that needs a phonetic spelling, "v2.0"). Write
91
+ them with `voice.py say`, which ties each one to the shown text and checks its numbers
92
+ ([numbers.md](numbers.md)):
93
+
94
+ ```json
95
+ { "game:say.reward": { "text": "<the shown text it was written for>", "speak": "<what is said, no digits>" } }
96
+ ```
97
+ - A plural key or a text with a `{{placeholder}}` cannot be one clip. Give it fixed spoken words with `say`, split
98
+ it into fixed lines, or leave it out of the set.
99
+ - **A new spoken line the owner asked for** goes where an existing set's pattern selects it (name the key to match,
100
+ for example `game:say.reward` for the set `game:say.*`), or the set's `include` gains a pattern for it. That is
101
+ filling a set the owner already has, not adding one. A new set, or voice for lines nobody asked voice for, is the
102
+ owner's call.
103
+
104
+ ## 4. The pipeline
105
+
106
+ ```bash
107
+ python <skill>/scripts/voice.py plan # per language and set: ready / behind / new / stale / blocked
108
+ python <skill>/scripts/voice.py say --lang ja --id ns:key "…" # settle each blocked line (or fix its shown text)
109
+ python <skill>/scripts/voice.py plan --lang vi --out todo.vi.json # the lines to make, with speak text and numbers
110
+ # make and check the clips with the project's voice tool (sections 6 and 7)
111
+ python <skill>/scripts/voice.py add --lang vi --map clips.vi.json # register them
112
+ python <skill>/scripts/voice.py pack # sets + voice manifest for the CDN
113
+ ```
114
+
115
+ These tools never talk to a voice backend. They decide **what** must be said and keep the record; making the audio
116
+ is the project's own voice tool.
117
+
118
+ `plan` gives each line a state:
119
+
120
+ | State | Meaning | Do |
121
+ |---|---|---|
122
+ | `ok` | a registered clip matches the current spoken text and voice | nothing |
123
+ | `missing` | no clip yet | synthesise |
124
+ | `behind` | the text changed a little and someone decided the old clip still fits (`voice.py keep`): it keeps playing | synthesise again when voice is next updated |
125
+ | `stale` | the spoken text (or the voice name) changed since the clip was made, and nobody has decided: the line is left out, so it is silent | decide: `voice.py keep`, or synthesise again (section 5) |
126
+ | `blocked` | the spoken text is unsettled: a number or symbol the tool will not guess, a placeholder, an override written for an older text or one that does not say the text's numbers ([numbers.md](numbers.md)) | fix the shown text, or `voice.py say` |
127
+ | `untranslated` | the text in that language is missing or stale | translate first |
128
+
129
+ **Run `voice.py pack` every time `i18n.py pack` runs** (text first, then voice), also when no clip could be made
130
+ yet. Only lines in state `ok` or `behind` go into a set; `voice.py pack` prints which lines are behind and which are
131
+ silent, and refuses to run if the text was edited after the last text pack.
132
+
133
+ `todo.<lang>.json` holds, per line: `id`, `set`, `text` (shown), `speak` (sent to the voice: no digits), `numbers`
134
+ (for the check), `speakHash`, `textHash`, `voice`. The answer for `add` maps ids to clips and repeats the hash, so a
135
+ clip made from an old text is refused:
136
+
137
+ ```json
138
+ { "chapter01:dlg.elder.0": { "file": "out/c01_dlg_elder_0.mp3", "speakHash": "79fc6ec7d1f8d17e", "checked": "whisper-large-v3: words ok, numbers ok" } }
139
+ ```
140
+
141
+ Order of work when the owner asks for voice in a new language or set:
142
+ 1. Text for those lines translated and reviewed (`i18n.py status`).
143
+ 2. `voice.py plan`: clear every `blocked` line.
144
+ 3. **A listening sample first**: about 30 lines per language, chosen to include numbers, questions, names and the
145
+ longest line. Give the owner the clips to listen to. Bulk generation starts only after the owner says the sample
146
+ is good.
147
+ 4. Bulk run in small jobs with the guards of section 6, resumable, every take checked (section 7).
148
+ 5. `add`, `pack`, upload (the owner approves publishing), then the app-side work if it is a new language.
149
+
150
+ **When the sample is needed.** A new voice language, a new set, a new or changed voice, or any run of more than
151
+ about 50 clips: sample first, then the owner's word. A few new or reworded lines in a language and set the owner has
152
+ already approved go straight through the per-clip checks; tell the owner which lines were made so they can listen.
153
+
154
+ ## 5. Text version and voice version: when the text changes first
155
+
156
+ Text is cheap to change and voice is not, so text regularly moves ahead of voice. The two are versioned separately
157
+ and the link between them is recorded:
158
+
159
+ | What | Where | Meaning |
160
+ |---|---|---|
161
+ | text `version` of a language | `i18n/manifest.json` | bumps when that language's texts change (`i18n.py pack`) |
162
+ | voice `version` of a set | `i18n/voice/manifest.json` | bumps when that set's clips or their accepted texts change (`voice.py pack`) |
163
+ | `textVersion` of a voice language | `i18n/voice/manifest.json` | the text version the voice sets were packed for |
164
+ | per set: `clips`, `lines`, `behind`, `silent` | `i18n/voice/manifest.json` | how far the set is from complete and current |
165
+ | per clip: `textHash`, `textVersion`, `keptFor` | `i18n/voice/<lang>/manifest.json` | the text a clip was recorded for, and the later text it was kept for |
166
+
167
+ ```
168
+ $ python <skill>/scripts/i18n.py versions
169
+ mygame: compat 1, text revision 14 (…), voice revision 6 (…)
170
+ lang text state voice set voice for text clips behind silent
171
+ vi v12 ready common v4 v12 140/141 1 1
172
+ chapter01 v3 v12 135/135 0 0
173
+ en v12 ready common v4 v11 ! …
174
+ ko v9 ready -
175
+ ```
176
+
177
+ `*` after a text version: the files were edited since the last text pack. `!`: the voice sets were packed for an
178
+ older text version (run `voice.py pack`).
179
+
180
+ **What happens to a voiced line when its text changes** (in that language), before anyone remakes the clip:
181
+
182
+ | The change | State | In the app | Do |
183
+ |---|---|---|---|
184
+ | Only punctuation, case or spacing: the same words | `ok` | the clip plays | nothing |
185
+ | A small rewording the old audio still fits: nobody listening would be misled ("Xin chào các bạn nhỏ!" → "Xin chào các bạn!") | `stale` until decided, then `behind` | the old clip keeps playing | `voice.py keep --lang L --id ns:key --why "…"`; remake it with the next voice update |
186
+ | The audio would now be wrong: another instruction, name, answer or direction; a sentence added or removed | `stale` | silent | leave it; synthesise again |
187
+ | A number changed | `stale` | silent | synthesise again. `keep` refuses: a clip that says another number is never kept |
188
+
189
+ The agent that changes the text makes this decision in the same piece of work, by reading "clip says / text now" in
190
+ `voice.py plan`, and reports both lists (kept, silent) to the owner. When unsure, do not keep: a silent line is a
191
+ smaller fault than a voice that says something the screen does not. `keep --undo` takes a decision back. A new clip
192
+ (`add`) ends the lag, and a further change to the text ends an earlier `keep`.
193
+
194
+ Publishing: text and voice are uploaded together (voice files first, then the text manifest). If lines would go
195
+ out silent, the owner chooses between waiting for the clips and publishing now; say which lines.
196
+
197
+ ## 6. Rules on a voice server
198
+
199
+ A self-hosted voice server is usually shared: the same GPU serves other things, and the server keeps the owner's
200
+ saved takes and voice profiles. A careless bulk run can wipe saved work or get the voice process killed for lack of
201
+ memory. The backend's own rules (section 2) come first; where they are silent, these hold:
202
+
203
+ - **Use only the stateless synthesis endpoint** the backend's rules name (on an OpenAI-compatible server:
204
+ `POST <voice-host>/v1/audio/speech` with `model`, `voice`, `input`, `response_format`). Stay away from endpoints
205
+ that write history, profiles or presets, and from reference uploads: on some servers every history row pushes out
206
+ an older take and its audio.
207
+ - **One request at a time**, with a lock, in small jobs with pauses. Before each job check free RAM and GPU memory;
208
+ stop on an out-of-memory answer, on repeated 5xx answers or timeouts, or if something the run must not change has
209
+ changed. Fail closed: if a guard cannot be read, do not generate.
210
+ - Never restart, reconfigure, `docker exec` into or install anything on the voice server. If it needs a restart,
211
+ tell the owner.
212
+ - The API key stays where the backend's description says it lives: read it into memory there, never print, copy or
213
+ commit it.
214
+ - Recognition and scoring (section 7) run on the agent's own machine, on CPU, not on the voice server's GPU.
215
+ - Bulk runs happen in the time window the owner gives.
216
+ - A hosted, paid TTS service: count the characters first (a dry run) and get the owner's word on the spend.
217
+
218
+ A project that already has a voice tool with these guards uses it. A new project copies the guards before it writes
219
+ its first request loop: they are the part that incidents taught.
220
+
221
+ ## 7. Checking every clip
222
+
223
+ A clip is registered with `add` only after it passed, per take:
224
+
225
+ 1. **Words**: a recogniser (Whisper large-v3 on CPU; plus a language-specific one where available) hears the line.
226
+ Names and invented words are compared loosely, everything else strictly.
227
+ 2. **Numbers**: `numwords.heard(numbers, transcript, lang)` is true ([numbers.md](numbers.md)). No exceptions.
228
+ 3. **Language**: the recogniser's language-ID probability for the target language is at least 0.8 (catches an accent
229
+ from the wrong voice).
230
+ 4. **Shape**: no silence longer than about 1 s inside the line; duration plausible for its length; numbers and
231
+ questions not rushed.
232
+ 5. **Loudness**: normalised to the product's level so languages and sets match.
233
+
234
+ Take the best of up to three seeds; a line that still fails is rewritten or reported, never shipped. Record in the
235
+ `add` map what was checked (`"checked": "whisper-large-v3 wer 0, numbers ok"`): it is stored with the clip.
236
+
237
+ After a set is complete, listen to a few assembled sequences as the user will hear them (a question followed by its
238
+ answer, two dialogue lines in a row): single clips can each pass and still not fit together.
239
+
240
+ ## 8. Files, formats, storage
241
+
242
+ - One encoded format per product (`voice.format`): `mp3` mono, about 48–64 kbit/s plays everywhere (Unity, web, iOS,
243
+ Android). `ogg` is an option for a Unity-only product.
244
+ - `i18n/voice/<lang>/manifest.json` (git): for every clip its spoken text, `speakHash`, voice, SHA-256, size, date.
245
+ - Audio itself is **not in git**: `i18n/voice/_audio/` is a local cache; the durable copy is the CDN bucket, where
246
+ clips are named by their content (`voice/clips/<lang>/<sha16>.mp3`) and so never overwritten. Lossless WAV takes may
247
+ be kept under a private prefix such as `voice-master/`.
248
+ - `voice.py pack` writes, per language and set, an index `voice/c<compat>/<lang>/<set>.<hash12>.json`
249
+ (`{"clips": {"ns:key": {"file": "<sha16>.mp3", "bytes": 12345, "text": ["<hash of a shown text>", …]}}}`), copies
250
+ the clips it has locally to `dist/voice/clips/`, writes `voice/c<compat>/manifest.json` (per language
251
+ `textVersion`; per set `version`, `hash`, `file`, `lines`, `clips`, `behind`, `silent`, `bytes`, `complete`) and
252
+ `dist/upload-plan.voice.json`. Upload order: clips, indexes, the manifest last
253
+ ([layout-and-versioning.md](layout-and-versioning.md), sections 7 and 8).
254
+ - Voice clips that already ship inside an app may stay there; new languages go to the CDN only.
255
+
256
+ ## 9. In the app
257
+
258
+ - Voice language is its own setting: the text language if it has voice, else `fallback`.
259
+ - **Lazy download**: when a set is first needed (the user opens chapter 1 in Spanish), fetch the voice manifest, then
260
+ the set's index, then its clips (a few in parallel), verifying sizes; show progress and the size before a large
261
+ download. Play from the local copy. A set counts as ready when all its clips are present.
262
+ - **A clip is played only with a text it was made or kept for.** Each index entry carries `text`: a list of
263
+ hashes, each the first 12 hex characters of the SHA-256 of a shown text (UTF-8, NFC). The list holds the text the
264
+ clip was recorded for and, after `keep` or a punctuation-only change, the current text. Before playing, the app
265
+ hashes the text it is showing for that key and plays the clip only if the hash is in the list. Text packs and
266
+ voice sets update separately, so without this an app could show one wording and speak another. Test vector:
267
+ `"Xin chào các bạn nhỏ!"` → `7fedecb3477a`.
268
+ - A line without a matching clip is shown without sound; the app never plays another language's clip for a single
269
+ line in the middle of a set.
270
+ - A newer set version re-downloads only the clips whose file name changed. Remove clips no index refers to any more.
271
+ - Keep text and voice in step: the index is keyed by `ns:key`, the same id the text uses.