@gobing-ai/knowledge-kit 0.1.20 → 0.1.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.
Files changed (149) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/board/collect/index.js +1 -0
  3. package/dist/board/daily-voice/index.js +1279 -261
  4. package/dist/board/itc/index.js +1 -0
  5. package/dist/index.js +13938 -8966
  6. package/package.json +1 -1
  7. package/plugins/generations/dailynews-gen/dist/index.js +285 -16
  8. package/plugins/generations/dailynews-gen/src/editorial-claims.ts +215 -0
  9. package/plugins/generations/dailynews-gen/src/index.ts +23 -4
  10. package/plugins/generations/dailynews-gen/src/script-builder.ts +10 -3
  11. package/plugins/generations/dailynews-gen/src/script-plan.ts +74 -14
  12. package/plugins/generations/gemini-tts/dist/index.js +47 -7
  13. package/plugins/generations/gemini-tts/src/gemini-client.ts +34 -6
  14. package/plugins/generations/music-gen/README.md +277 -0
  15. package/plugins/generations/music-gen/dist/index.js +23580 -0
  16. package/plugins/generations/music-gen/package.json +24 -0
  17. package/plugins/generations/music-gen/plugin.json +23 -0
  18. package/plugins/generations/music-gen/presets/SOURCE.md +39 -0
  19. package/plugins/generations/music-gen/presets/formats/clip.yaml +21 -0
  20. package/plugins/generations/music-gen/presets/formats/jingle.yaml +22 -0
  21. package/plugins/generations/music-gen/presets/formats/loop.yaml +21 -0
  22. package/plugins/generations/music-gen/presets/formats/song.yaml +36 -0
  23. package/plugins/generations/music-gen/presets/formats/underscore.yaml +22 -0
  24. package/plugins/generations/music-gen/presets/themes/ambient-tech.yaml +30 -0
  25. package/plugins/generations/music-gen/presets/themes/cinematic.yaml +30 -0
  26. package/plugins/generations/music-gen/presets/themes/lofi.yaml +30 -0
  27. package/plugins/generations/music-gen/presets/themes/synthwave.yaml +35 -0
  28. package/plugins/generations/music-gen/scripts/gen-preset-index.ts +181 -0
  29. package/plugins/generations/music-gen/scripts/resolve-preset.ts +64 -0
  30. package/plugins/generations/music-gen/src/adapter/index.ts +35 -0
  31. package/plugins/generations/music-gen/src/adapter/instance.ts +927 -0
  32. package/plugins/generations/music-gen/src/adapter/offline.ts +124 -0
  33. package/plugins/generations/music-gen/src/artifact.ts +223 -0
  34. package/plugins/generations/music-gen/src/audio/checks.ts +618 -0
  35. package/plugins/generations/music-gen/src/audio/master.ts +267 -0
  36. package/plugins/generations/music-gen/src/audio/measure.ts +507 -0
  37. package/plugins/generations/music-gen/src/audio/profile.ts +131 -0
  38. package/plugins/generations/music-gen/src/audio.ts +122 -0
  39. package/plugins/generations/music-gen/src/brief.ts +191 -0
  40. package/plugins/generations/music-gen/src/config.ts +451 -0
  41. package/plugins/generations/music-gen/src/content.ts +199 -0
  42. package/plugins/generations/music-gen/src/digest.ts +100 -0
  43. package/plugins/generations/music-gen/src/index.ts +147 -0
  44. package/plugins/generations/music-gen/src/job.ts +131 -0
  45. package/plugins/generations/music-gen/src/plugin.ts +371 -0
  46. package/plugins/generations/music-gen/src/presets.ts +951 -0
  47. package/plugins/generations/music-gen/src/render.ts +87 -0
  48. package/plugins/generations/music-gen/src/request.ts +102 -0
  49. package/plugins/generations/music-gen/src/spend.ts +495 -0
  50. package/plugins/generations/music-gen/tsconfig.json +8 -0
  51. package/plugins/generations/omni-voice-gen/uv.toml +5 -0
  52. package/plugins/generations/vibe-voice-tts/README.md +64 -0
  53. package/plugins/generations/vibe-voice-tts/dist/index.js +14259 -0
  54. package/plugins/generations/vibe-voice-tts/package.json +16 -0
  55. package/plugins/generations/vibe-voice-tts/plugin.json +6 -0
  56. package/plugins/generations/vibe-voice-tts/profiles.json +10 -0
  57. package/plugins/generations/vibe-voice-tts/pyproject.toml +9 -0
  58. package/plugins/generations/vibe-voice-tts/python/worker.py +566 -0
  59. package/plugins/generations/vibe-voice-tts/src/index.ts +88 -0
  60. package/plugins/generations/vibe-voice-tts/src/vibevoice-client.ts +828 -0
  61. package/plugins/generations/vibe-voice-tts/tsconfig.json +8 -0
  62. package/plugins/generations/vibe-voice-tts/uv.lock +1767 -0
  63. package/plugins/generations/vibe-voice-tts/uv.toml +4 -0
  64. package/plugins/generations/voice-gen/dist/index.js +31 -1
  65. package/plugins/generations/voice-gen/src/voicebox-client.ts +50 -1
  66. package/plugins/generations/voxcpm-tts/dist/index.js +81 -9
  67. package/plugins/generations/voxcpm-tts/python/worker.py +9 -0
  68. package/plugins/generations/voxcpm-tts/src/index.ts +41 -0
  69. package/plugins/generations/voxcpm-tts/src/voxcpm-client.ts +32 -11
  70. package/plugins/generations/voxcpm-tts/uv.toml +5 -0
  71. package/plugins/kk/README.md +21 -0
  72. package/plugins/kk/decisions/kk-safety.yaml +5 -2
  73. package/plugins/kk/plugin.json +1 -1
  74. package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +14 -2
  75. package/plugins/kk/scripts/cover-compositor.ts +380 -32
  76. package/plugins/kk/scripts/daily-cover-mock.ts +40 -3
  77. package/plugins/kk/scripts/daily-stages.ts +933 -60
  78. package/plugins/kk/scripts/episode-identity.ts +180 -0
  79. package/plugins/kk/scripts/kk-workflow-stages.ts +111 -12
  80. package/plugins/kk/scripts/music-stages.ts +624 -0
  81. package/plugins/kk/scripts/news-editorial-ledger.ts +906 -0
  82. package/plugins/kk/scripts/safety-artifact-check.ts +28 -5
  83. package/plugins/kk/scripts/source-citation.ts +187 -0
  84. package/plugins/kk/scripts/topic-selection-attempts.ts +446 -0
  85. package/plugins/kk/scripts/topic-selection-calibration.ts +161 -0
  86. package/plugins/kk/skills/content-judge/SKILL.md +11 -6
  87. package/plugins/kk/skills/content-judge/references/music-quality-rubric.md +147 -0
  88. package/plugins/kk/skills/content-judge/references/rubrics.md +15 -0
  89. package/plugins/kk/skills/content-safety/SKILL.md +12 -0
  90. package/plugins/kk/skills/music-authoring/SKILL.md +276 -0
  91. package/plugins/kk/skills/music-authoring/references/judge-input.md +117 -0
  92. package/plugins/kk/skills/news-editorial/SKILL.md +102 -15
  93. package/plugins/kk/skills/news-editorial/references/selection.md +4 -0
  94. package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +58 -11
  95. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +12 -11
  96. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +13 -12
  97. package/plugins/kk/workflows/kk-daily-safety.yaml +12 -10
  98. package/plugins/kk/workflows/kk-music.yaml +332 -0
  99. package/plugins/kk/workflows/kk-news-generate.yaml +81 -6
  100. package/plugins/kk/workflows/kk-publish.yaml +4 -1
  101. package/plugins/publishings/bilibili-pub/dist/index.js +11 -1
  102. package/plugins/publishings/bilibili-pub/dist/profile-check.js +11 -1
  103. package/plugins/publishings/cnblogs-pub/dist/index.js +11 -1
  104. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +11 -1
  105. package/plugins/publishings/csdn-pub/dist/index.js +11 -1
  106. package/plugins/publishings/csdn-pub/dist/profile-check.js +11 -1
  107. package/plugins/publishings/infoq-pub/dist/index.js +11 -1
  108. package/plugins/publishings/infoq-pub/dist/profile-check.js +11 -1
  109. package/plugins/publishings/jike-pub/dist/index.js +11 -1
  110. package/plugins/publishings/jike-pub/dist/profile-check.js +11 -1
  111. package/plugins/publishings/juejin-pub/dist/index.js +11 -1
  112. package/plugins/publishings/juejin-pub/dist/profile-check.js +11 -1
  113. package/plugins/publishings/linkedin-pub/dist/index.js +62 -10
  114. package/plugins/publishings/linkedin-pub/dist/profile-check.js +16 -1
  115. package/plugins/publishings/linkedin-pub/src/index.ts +99 -12
  116. package/plugins/publishings/podcast-pub/dist/index.js +586 -20
  117. package/plugins/publishings/podcast-pub/src/corrections.ts +509 -0
  118. package/plugins/publishings/podcast-pub/src/index.ts +257 -5
  119. package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +240 -0
  120. package/plugins/publishings/podcast-pub/src/show-notes.ts +69 -13
  121. package/plugins/publishings/shipinhao-pub/dist/index.js +59 -8
  122. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +11 -1
  123. package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +105 -6
  124. package/plugins/publishings/sspai-pub/dist/index.js +11 -1
  125. package/plugins/publishings/sspai-pub/dist/profile-check.js +11 -1
  126. package/plugins/publishings/substack-pub/dist/index.js +11 -1
  127. package/plugins/publishings/substack-pub/dist/profile-check.js +11 -1
  128. package/plugins/publishings/surfdash-pub/dist/index.js +80 -24
  129. package/plugins/publishings/surfdash-pub/src/digest-check.ts +7 -3
  130. package/plugins/publishings/surfdash-pub/src/index.ts +107 -18
  131. package/plugins/publishings/surfdash-pub/src/patch.ts +21 -3
  132. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +3 -1
  133. package/plugins/publishings/threads-pub/dist/index.js +58 -6
  134. package/plugins/publishings/threads-pub/dist/profile-check.js +18 -2
  135. package/plugins/publishings/threads-pub/src/post-rail.ts +101 -4
  136. package/plugins/publishings/wechatmp-pub/dist/index.js +105 -35
  137. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +11 -1
  138. package/plugins/publishings/wechatmp-pub/src/cgi-draft.ts +87 -53
  139. package/plugins/publishings/wechatmp-pub/src/enrich.ts +61 -3
  140. package/plugins/publishings/wechatmp-pub/src/flow.ts +28 -0
  141. package/plugins/publishings/weibo-pub/dist/index.js +11 -1
  142. package/plugins/publishings/weibo-pub/dist/profile-check.js +11 -1
  143. package/plugins/publishings/x-pub/dist/index.js +95 -10
  144. package/plugins/publishings/x-pub/dist/profile-check.js +11 -1
  145. package/plugins/publishings/x-pub/src/post-rail.ts +154 -12
  146. package/plugins/publishings/xhs-pub/dist/index.js +11 -1
  147. package/plugins/publishings/xhs-pub/dist/profile-check.js +11 -1
  148. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +11 -1
  149. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +11 -1
@@ -0,0 +1,332 @@
1
+ ---
2
+ # kk-music — one idea → a measured, judged, loudness-normalized take (feature D8, task 0403).
3
+ #
4
+ # prepare → brief → explore → select → analyze → check → judge → master → finalize → done
5
+ # ↘ failed
6
+ #
7
+ # **The spend shape (R2).** `explore` authors-or-adopts one brief per direction and takes exactly
8
+ # ONE take per brief in the FORMAT's own model (the preset names it: pro for song/jingle/underscore,
9
+ # clip for clip/loop). There is no Clip→Pro explore: a Clip render is a different model and cannot
10
+ # exhibit arrangement, structure timing or lyrics past 0:30. `select` is the only operator gate;
11
+ # `auto` skips it only when exactly one take exists (one take is not a choice). `analyze` runs on
12
+ # the selected take only. A brief whose take is already on disk is adopted by `music-stages.ts`, so
13
+ # re-running `explore` into the same run directory pays for nothing (0400's digest dedupe is the
14
+ # backstop), and anything else needs `force` + `force_reason`.
15
+ #
16
+ # **The gate order (R3).** `check` (`kk music check`, 0405 take checks) exits 0 before `judge`;
17
+ # `judge` is one `agent.run` on kk:content-judge with the `music-quality` rubric, routed through the
18
+ # same confidence-aware jq filter every kk judge gate uses (a `PASS` without a HIGH/MEDIUM/LOW
19
+ # confidence is `PASS!`, which no accept guard matches); `master` is reached only on `PASS`, or on
20
+ # `NEEDS_REVISION` with `accept_revision=true`; and `master` (0405's delivery check) exits 0 before
21
+ # `finalize`. A failing action aborts the run as failed at that state (the engine's default
22
+ # onError), which is what keeps an unmeasured take out of the judge and a failed file out of the
23
+ # report — the explicit `failed` edges below are the judgement route.
24
+ #
25
+ # **ADR-115.** Each shell action is one bounded call: a `kk music` verb, or one `kk stage run
26
+ # music-*` subcommand whose body lives in `plugins/kk/scripts/music-stages.ts` (fan-out and bundle
27
+ # assembly are verbs here, never YAML). Both `agent.run` prompts are skill invocations under the
28
+ # 1000-character cap and paste no brief, no rows and no rubric.
29
+ #
30
+ # **Resume (R5).** Every state is artifact-gated: briefs, prompt text, take sidecars, the analysis,
31
+ # `checks.json`, the judge bundle and the verdict all survive a failure, so a resumed run continues
32
+ # from the first artifact that is missing and never re-pays for a take that is on disk.
33
+ "$schema": "@gobing-ai/spur/schemas/state-machine-workflow.schema.json"
34
+ name: kk-music
35
+ kind: state-machine
36
+ description: >-
37
+ One musical idea into one delivered take: author differentiated briefs, explore them in the
38
+ format's own model, let the operator pick, analyze and measure that take, judge it against the
39
+ music-quality rubric, loudness-normalize it to a delivery profile and report the run.
40
+ initialState: prepare
41
+ terminalStates:
42
+ - done
43
+ - failed
44
+ failureStates:
45
+ - failed
46
+ iterationBound: 12
47
+ vars:
48
+ # --- the idea (R1): a one-line topic, or an existing idea/brief file ---
49
+ topic: ""
50
+ idea_file: ""
51
+ # --- the musical direction: shipped format + theme presets (`kk music presets`) ---
52
+ format: "song"
53
+ theme: ""
54
+ # --- the run directory: <works>/kk-music/<topic-slug>/ ---
55
+ works: ".works"
56
+ run_dir: ""
57
+ # --- spend shape: differentiated briefs to explore (default 2, never above music.takesCap) ---
58
+ directions: "2"
59
+ # --- who runs the authoring and judging agent.run steps ---
60
+ agent: ""
61
+ # --- delivery: the loudness profile `kk music master` normalizes to ---
62
+ delivery_profile: "streaming"
63
+ # --- gates ---
64
+ auto: "false"
65
+ accept_revision: "false"
66
+ force: "false"
67
+ force_reason: ""
68
+ # --- free rehearsal: KK_MUSIC_DRY_RUN=1 for every paid verb (offline adapter, no network) ---
69
+ dry_run: "false"
70
+ # --- projected from the run directory, never authored by hand ---
71
+ take_file: ""
72
+ instance_id: ""
73
+ brief_number: ""
74
+ verdict: ""
75
+ __runId: ""
76
+ __hitlAnswer: ""
77
+
78
+ states:
79
+ - id: prepare
80
+ description: >-
81
+ Resolve <works>/kk-music/<topic-slug>/, stage 1-brief/ and 3-takes/, write idea.md and publish
82
+ the run-bound path this workflow projects into vars.run_dir. No instance traffic.
83
+ onEnter:
84
+ - kind: shell
85
+ options:
86
+ command: >-
87
+ kk stage run music-prepare "${vars.works}" "${vars.topic}" "${vars.idea_file}"
88
+ "${vars.format}" "${vars.theme}" "${vars.directions}" "${vars.force}" "${vars.__runId}"
89
+ - kind: file.read.into-var
90
+ options:
91
+ path: ".spur/run/${vars.__runId}-music-run-dir.txt"
92
+ var: run_dir
93
+
94
+ - id: brief
95
+ description: >-
96
+ Author `directions` differentiated briefs and render each one's prompt text (agent.run on
97
+ kk:music-authoring). Free: render opens no socket. Existing briefs are reused verbatim.
98
+ onEnter:
99
+ - kind: agent.run
100
+ options:
101
+ role: scribe
102
+ agent: ${vars.agent}
103
+ input: |
104
+ Invoke the kk:music-authoring skill, operation `brief`.
105
+ Run directory: ${vars.run_dir} — idea at ${vars.run_dir}/idea.md.
106
+ Format ${vars.format}, theme ${vars.theme}, ${vars.directions} differentiated direction(s).
107
+ For each number 01..0${vars.directions}: write 1-brief/brief-<nn>.yaml in the 0397 authoring form
108
+ (takes: 1, no invented keys) and render it — kk music render --in 1-brief/brief-<nn>.yaml
109
+ --out 1-brief/brief-<nn>.prompt.txt, stdout into 1-brief/brief-<nn>.render.txt.
110
+ Reuse any brief-<nn>.yaml that already exists verbatim; never edit an authored brief.
111
+ Do not call kk music gen: exploring is the next state's job.
112
+ expectFile: ${vars.run_dir}/1-brief/brief-01.prompt.txt
113
+ - kind: shell
114
+ options:
115
+ # The workflow's own prompt numbers the directions `01..0<n>`, so the guard must test the
116
+ # padded file — testing the bare `${vars.directions}` made every 2-direction run die here
117
+ # (2026-11-20). The arithmetic also normalizes a caller-supplied `02`, and both `test -f`
118
+ # calls stay inside ADR-115's command budget.
119
+ command: >-
120
+ test -f "${vars.run_dir}/1-brief/brief-0$((${vars.directions})).yaml" &&
121
+ test -f "${vars.run_dir}/1-brief/brief-0$((${vars.directions})).prompt.txt"
122
+
123
+ - description: >-
124
+ One take per differentiated brief, in the format's own model. A brief whose sidecar and take
125
+ are on disk is adopted (no request); a digest already paid for refuses without force+reason.
126
+ id: explore
127
+ onEnter:
128
+ - kind: shell
129
+ options:
130
+ command: >-
131
+ kk stage run music-explore "${vars.run_dir}" "${vars.directions}" "${vars.force}"
132
+ "${vars.force_reason}" "${vars.dry_run}" "${vars.__runId}"
133
+
134
+ - id: select
135
+ description: "The only operator gate: pick which take becomes the deliverable (skipped by `auto` only when one take exists)"
136
+ pause: true
137
+ onEnter:
138
+ # `hitl.input`, not `hitl.select`: the run is resumed headlessly (`spur workflow continue`), and
139
+ # `--answer` there accepts only yes|no|cancel, so a numbered choice could never be delivered.
140
+ # Free text carries the take number, and `analyze` below re-binds from it because a resume
141
+ # skips this state's own actions (`resumeMode: skip-enter`).
142
+ - kind: hitl.input
143
+ options:
144
+ prompt: >-
145
+ Pick the take to deliver from ${vars.run_dir}/3-takes/ — answer with a brief number
146
+ (01 for the first direction, 02 for the second). Each take's prompt text is at
147
+ 1-brief/brief-<nn>.prompt.txt and its spend is in 3-takes/explore.json.
148
+ var: __hitlAnswer
149
+ - kind: shell
150
+ options:
151
+ command: >-
152
+ kk stage run music-select "${vars.run_dir}" "${vars.__hitlAnswer}" "${vars.auto}"
153
+ - kind: file.read.into-var
154
+ options:
155
+ path: ${vars.run_dir}/3-takes/.brief
156
+ var: brief_number
157
+
158
+ - id: analyze
159
+ description: >-
160
+ Bind the selected take and pay for that take's instance analysis once. A cached
161
+ analysis-<instanceId>.json is adopted, never re-bought.
162
+ onEnter:
163
+ # The binding step lives here as well as in `select`: a resume of the operator gate skips
164
+ # `select`'s actions, so this is the pass that actually writes the selection from the answer.
165
+ - kind: shell
166
+ options:
167
+ command: >-
168
+ kk stage run music-select "${vars.run_dir}" "${vars.__hitlAnswer}" "${vars.auto}"
169
+ - kind: file.read.into-var
170
+ options:
171
+ path: ${vars.run_dir}/3-takes/.take-file
172
+ var: take_file
173
+ - kind: file.read.into-var
174
+ options:
175
+ path: ${vars.run_dir}/3-takes/.instance-id
176
+ var: instance_id
177
+ - kind: file.read.into-var
178
+ options:
179
+ path: ${vars.run_dir}/3-takes/.brief
180
+ var: brief_number
181
+ - kind: shell
182
+ options:
183
+ command: 'kk stage run music-analyze "${vars.run_dir}" "${vars.dry_run}"'
184
+
185
+ - id: check
186
+ description: >-
187
+ Measure the selected take (0405 take checks: duration band, leading/trailing silence, analysis
188
+ present, warn-only brief agreement) and write <take>.checks.json. A fail row exits 1, so no
189
+ unmeasured take reaches the judge.
190
+ onEnter:
191
+ - kind: shell
192
+ options:
193
+ command: >-
194
+ kk music check "${vars.run_dir}/3-takes/${vars.take_file}"
195
+ --brief "${vars.run_dir}/1-brief/brief-${vars.brief_number}.yaml"
196
+
197
+ - id: judge
198
+ description: >-
199
+ Assemble 4-judge-input.md from the five verbatim inputs once checks are clean, then judge the
200
+ take against the music-quality rubric (agent.run on kk:content-judge).
201
+ onEnter:
202
+ - kind: shell
203
+ options:
204
+ command: 'kk stage run music-judge-input "${vars.run_dir}"'
205
+ - kind: agent.run
206
+ options:
207
+ role: reviewer
208
+ agent: ${vars.agent}
209
+ input: |
210
+ Invoke the kk:content-judge skill with rubric `music-quality`.
211
+ content_path: ${vars.run_dir}/4-judge-input.md
212
+ content_ref: ${vars.run_dir}/3-takes/${vars.take_file}
213
+ verdict_path: ${vars.run_dir}/4-verdict-music.json
214
+ Grade only what the bundle shows; every measurement is quoted from checks.json with its
215
+ unit and source, never re-derived and never scored by ear. Emit the existing verdict
216
+ contract (verdict, confidence HIGH|MEDIUM|LOW, rubric, findings[], content_ref) and no
217
+ second verdict file.
218
+ expectFile: ${vars.run_dir}/4-verdict-music.json
219
+
220
+ - id: master
221
+ description: >-
222
+ Loudness-normalize the selected take to the delivery profile (0405). The post-master delivery
223
+ check is the last word: a delivery miss exits 1 and never reaches finalize.
224
+ onEnter:
225
+ - kind: shell
226
+ options:
227
+ command: >-
228
+ kk music master "${vars.run_dir}/3-takes/${vars.take_file}" --profile "${vars.delivery_profile}"
229
+
230
+ - id: finalize
231
+ description: >-
232
+ Write the run report: spend summed from the take sidecars, instance ids, verdict, the delivery
233
+ profile with its measured LUFS/true peak, and the final artifact path (R4).
234
+ onEnter:
235
+ - kind: shell
236
+ options:
237
+ command: >-
238
+ kk stage run music-finalize "${vars.run_dir}" "${vars.delivery_profile}" "${vars.format}"
239
+ "${vars.__runId}"
240
+
241
+ - id: done
242
+ description: "Terminal — the take is measured, judged PASS, normalized and reported."
243
+ - id: failed
244
+ description: >-
245
+ Terminal — the verdict refused the take (FAIL, an out-of-contract PASS, or NEEDS_REVISION
246
+ without accept_revision). A failing deterministic action fails the run at its own state.
247
+
248
+ transitions:
249
+ - from: prepare
250
+ to: brief
251
+ description: "Run directory staged and idea.md written -> author the briefs"
252
+ guard:
253
+ kind: always
254
+
255
+ - from: brief
256
+ to: explore
257
+ description: "Every direction has a brief and a rendered prompt -> take one take per brief"
258
+ guard:
259
+ kind: always
260
+
261
+ - from: explore
262
+ to: analyze
263
+ description: "auto with exactly one take -> the single take is not a choice, skip the operator gate"
264
+ guard:
265
+ kind: shell
266
+ options:
267
+ command: >-
268
+ test "${vars.auto}" = "true" &&
269
+ jq -e '.takes == 1' "${vars.run_dir}/3-takes/explore.json" >/dev/null
270
+
271
+ - from: explore
272
+ to: select
273
+ description: "Takes on disk -> pause for the operator's pick (always, when there is more than one take)"
274
+ guard:
275
+ kind: always
276
+
277
+ - from: select
278
+ to: analyze
279
+ description: "A take was selected -> bind and analyze that take only"
280
+ guard:
281
+ kind: always
282
+
283
+ - from: analyze
284
+ to: check
285
+ description: "The selected take's analysis is on disk -> measure it"
286
+ guard:
287
+ kind: always
288
+
289
+ - from: check
290
+ to: judge
291
+ description: "Every take check passed (checks.json has no fail row) -> assemble the bundle and judge"
292
+ guard:
293
+ kind: always
294
+
295
+ - from: judge
296
+ to: master
297
+ description: "PASS with a HIGH/MEDIUM/LOW confidence -> normalize"
298
+ guard:
299
+ kind: shell
300
+ options:
301
+ command: >-
302
+ v="$(jq -r 'if (.verdict // "") == "PASS" then (.verdict + (if ((.confidence // "") | test("^(HIGH|MEDIUM|LOW)$")) then "" else "!" end)) else (.verdict // "") end' ${vars.run_dir}/4-verdict-music.json 2>/dev/null)";
303
+ test "$v" = PASS
304
+
305
+ - from: judge
306
+ to: master
307
+ description: "NEEDS_REVISION with accept_revision=true -> normalize the take as it is"
308
+ guard:
309
+ kind: shell
310
+ options:
311
+ command: >-
312
+ v="$(jq -r 'if (.verdict // "") == "PASS" then (.verdict + (if ((.confidence // "") | test("^(HIGH|MEDIUM|LOW)$")) then "" else "!" end)) else (.verdict // "") end' ${vars.run_dir}/4-verdict-music.json 2>/dev/null)";
313
+ test "$v" = NEEDS_REVISION && test "${vars.accept_revision}" = "true"
314
+
315
+ - from: judge
316
+ to: failed
317
+ terminalReason: failed-guard
318
+ description: "FAIL, an out-of-contract PASS, or NEEDS_REVISION without accept_revision -> block master"
319
+ guard:
320
+ kind: always
321
+
322
+ - from: master
323
+ to: finalize
324
+ description: "Delivery check passed on the encoded output -> report the run"
325
+ guard:
326
+ kind: always
327
+
328
+ - from: finalize
329
+ to: done
330
+ description: "Run report written -> complete"
331
+ guard:
332
+ kind: always
@@ -91,7 +91,10 @@ nodes:
91
91
  --in ${vars.work_dir}/21-plan/${vars.run_date}_04_quality-control-content_candidates.json (metadata.docs is the candidate Doc[]; don't edit it)
92
92
  --out-plan ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
93
93
  --out-excluded ${vars.work_dir}/21-plan/${vars.run_date}_03_curate_excluded.json
94
- Deliver both JSON files with your file-write tool (a headless sandbox may block shell writes).
94
+ Then follow mode `align` (SKILL.md) and deliver ${vars.work_dir}/21-plan/${vars.run_date}_judgment-proposal.json:
95
+ evidence-backed judgments over the SAME selected ids, superseding (never rewriting) an aired one;
96
+ no new evidence = {"version":1,"judgments":[]}. Ledger for reference: ${vars.work_dir}/../conclusion.md
97
+ Deliver all three JSON files with your file-write tool (a headless sandbox may block shell writes).
95
98
  expectFile: ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
96
99
  allowAppend: false
97
100
 
@@ -135,7 +138,7 @@ nodes:
135
138
  allowAppend: false
136
139
 
137
140
  - id: curate-final
138
- description: "`generate-check --step curate --final`: the documented fallback — untranslated candidates with `[]` exclusions — when the fix pass still fails"
141
+ description: "`generate-check --step curate --final`: the documented fallback — untranslated candidates with `[]` exclusions — when the fix pass still fails; also commits the editorial judgment ledger (0384), the deterministic alignment entry before `script-write`"
139
142
  dependsOn: [curate-check, curate-fix]
140
143
  condition:
141
144
  kind: shell
@@ -167,6 +170,9 @@ nodes:
167
170
  --in ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json (don't edit it)
168
171
  --excluded ${vars.work_dir}/21-plan/${vars.run_date}_03_curate_excluded.json
169
172
  --out ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
173
+ Draft from the frozen judgments at ${vars.work_dir}/21-plan/${vars.run_date}_judgment-snapshot.json (never the live
174
+ ledger): acknowledge any correction it carries openly (error, apology, corrected fact), and never restate
175
+ a superseded claim.
170
176
  Output only the JSON file.
171
177
  expectFile: ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
172
178
  allowAppend: false
@@ -291,6 +297,55 @@ nodes:
291
297
  test "${vars.skip_review}" != "true"
292
298
  && grep -q "status.*PASS" "${vars.work_dir}/pool-gate.json" 2>/dev/null
293
299
 
300
+ # ── 13a. localize: en/ja translations of the reviewed zh article, before the freeze ────────
301
+ - id: localize
302
+ description: >-
303
+ Translate the reviewed zh article into en/ja (0409 R1) and write
304
+ `22-article/locales/{en,ja}.md` (first line `# <title>`, rest the body). The site's publish
305
+ orchestrator refuses a `sub-category:ai-daily` post whose locale set is incomplete, and the
306
+ translations must exist BEFORE the freeze so the variant — hence the variants safety review
307
+ and the freeze digest — covers exactly the bytes that publish (ADR-053). Translating here,
308
+ not in the plugin, keeps the model call in the workflow and the plugin deterministic.
309
+ dependsOn: [render, review]
310
+ condition:
311
+ kind: shell
312
+ options:
313
+ command: 'grep -q "status.*PASS" "${vars.work_dir}/pool-gate.json" 2>/dev/null'
314
+ action:
315
+ kind: agent.run
316
+ options:
317
+ role: scribe
318
+ agent: ${vars.agent}
319
+ timeoutMs: 900000
320
+ # ADR-115 error tier: keep this prompt <= 1000 chars.
321
+ input: |
322
+ Translate the daily AI digest article into English and Japanese (task 0409).
323
+ Source: ${vars.work_dir}/22-article/${vars.run_date}_06_article_content.json (title, body).
324
+ Write TWO plain markdown files with your file-write tool (a headless sandbox may block shell writes):
325
+ ${vars.work_dir}/22-article/locales/en.md and ${vars.work_dir}/22-article/locales/ja.md
326
+ Each file: first line `# <translated title>`, then a blank line, then the translated body.
327
+ Keep every code block, URL, model name, company name and reference intact; translate prose only.
328
+ English: natural tech-journalism English. Japanese: natural です・ます tech-journalism Japanese.
329
+ Neither file may contain Chinese text — a zh draft under /en/ or /ja/ fails the gate.
330
+ expectFile: ${vars.work_dir}/22-article/locales/ja.md
331
+ allowAppend: false
332
+
333
+ - id: localize-check
334
+ description: >-
335
+ `news-localize-validate` (0409 R1): a deterministic gate on the two translations — missing,
336
+ empty, untitled, or untranslated (a zh document under en/ja) fails the run HERE, before the
337
+ variants are built and long before `surfdash-pub` would hit the site's opaque
338
+ "missing locale file(s)". No `onError: continue`: a half-localized day must not freeze.
339
+ dependsOn: [localize]
340
+ condition:
341
+ kind: shell
342
+ options:
343
+ command: 'grep -q "status.*PASS" "${vars.work_dir}/pool-gate.json" 2>/dev/null'
344
+ action:
345
+ kind: shell
346
+ options:
347
+ command: 'kk stage news-localize-validate "${vars.work_dir}"'
348
+
294
349
  # ── 14–16. voice: one engine per attempt, the fallback chain visible in the graph ───────────
295
350
  - id: voice
296
351
  description: >-
@@ -309,9 +364,29 @@ nodes:
309
364
  options:
310
365
  command: 'kk news generate-voice --work-dir "${vars.work_dir}" --engine voxcpm'
311
366
 
312
- - id: voice-fallback
313
- description: "Fallback 1: gemini — runs when no engine has left a passing audio verdict (the content JSON is the evidence; `grep` keeps `jq` out of the graph)"
367
+ - id: voice-fallback-box
368
+ description: >-
369
+ Fallback 1: voicebox — the local Voicebox REST renderer (`voice-gen`), no cloud credits and no
370
+ in-process ASR, so it is tried before the cloud engines. It was previously reachable only by
371
+ hand (2026-11-20: voxcpm ~19x realtime on CPU, gemini HTTP 402 on every call, and the episode
372
+ was rescued with `--engine voicebox` after 55 min of failed fallbacks). The node also warns
373
+ loudly when Voicebox answers `gpu_available: true` with `backend_variant: "cpu"`.
314
374
  dependsOn: [voice]
375
+ condition:
376
+ kind: shell
377
+ options:
378
+ command: >-
379
+ ! grep -q '"passed": true' "${vars.work_dir}/30-audio/${vars.run_date}_11_generate_content.json" 2>/dev/null
380
+ && grep -q "status.*PASS" "${vars.work_dir}/pool-gate.json" 2>/dev/null
381
+ action:
382
+ kind: shell
383
+ onError: continue
384
+ options:
385
+ command: 'kk news generate-voice --work-dir "${vars.work_dir}" --engine voicebox'
386
+
387
+ - id: voice-fallback
388
+ description: "Fallback 2: gemini — runs when no local engine has left a passing audio verdict (the content JSON is the evidence; `grep` keeps `jq` out of the graph); HTTP 401/402/403 now fail fast instead of retrying for minutes"
389
+ dependsOn: [voice-fallback-box]
315
390
  condition:
316
391
  kind: shell
317
392
  options:
@@ -325,7 +400,7 @@ nodes:
325
400
  command: 'kk news generate-voice --work-dir "${vars.work_dir}" --engine gemini'
326
401
 
327
402
  - id: voice-fallback2
328
- description: "Fallback 2 (last, loud): omnivoice — the run fails here if three engines could not render the script"
403
+ description: "Fallback 3 (last, loud): omnivoice — OOM-prone on a 16 GB host (exit 137 measured twice, 32 min and 80 min in), so it stays the last resort; the run fails here if four engines could not render the script"
329
404
  dependsOn: [voice-fallback]
330
405
  condition:
331
406
  kind: shell
@@ -359,7 +434,7 @@ nodes:
359
434
  `daily-safety-manifest` in one process: `31-publish/` prep, `30-variants/*` payloads and the
360
435
  manifest the nested variants review registers. Two stages, because the review of those
361
436
  variants has to run between them and a nested workflow call cannot live inside a verb.
362
- dependsOn: [voice, voice-fallback, voice-fallback2, cards]
437
+ dependsOn: [voice, voice-fallback, voice-fallback2, cards, localize-check]
363
438
  condition:
364
439
  kind: shell
365
440
  options:
@@ -228,7 +228,10 @@ nodes:
228
228
  row did not succeed (design §5.3 R3 — the page and the ledger row are already written, so a
229
229
  partial window keeps its report and still fails). Depends on `settle` so a report can never
230
230
  race an unfinished settlement, and on `diagnose` so a gated-miss day (settle skipped, diagnose
231
- ran) still writes its page and stays done (no outcome file).
231
+ ran) still writes its page and stays done (no outcome file). The verb also prunes the
232
+ published episode's WAV intermediates (`kk stage audio-prune`: section renders, joined final,
233
+ intro merge — 987 MB across six daily runs) once `metadata.mp3Path` is on disk; a run with no
234
+ delivered MP3 keeps its source, and a prune miss is a warning, never a publish failure.
232
235
  dependsOn: [settle, diagnose]
233
236
  action:
234
237
  kind: shell
@@ -20758,6 +20758,9 @@ async function ensureProfileDir2(profileDir, headless) {
20758
20758
  var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
20759
20759
  // ../../packages/publish-harness/src/browser.ts
20760
20760
  var DEFAULT_CHECK_TIMEOUT_MS = 30000;
20761
+ var VERDICT_PRINT_MARGIN_MS = 2000;
20762
+ var MIN_PASS_BUDGET_MS = 5000;
20763
+ var PASS_LAUNCH_RESERVE_MS = 20000;
20761
20764
  var DEFAULT_POLL_MS = 500;
20762
20765
  function isInstantBrowserDeath(message) {
20763
20766
  return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
@@ -20880,14 +20883,21 @@ async function checkChannelSession(config, opts) {
20880
20883
  const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
20881
20884
  const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
20882
20885
  let lastDetail = `${config.channel} readiness was never probed`;
20886
+ const deadline = Date.now() + timeoutMs;
20887
+ const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
20888
+ const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
20889
+ const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
20883
20890
  for (const headless of passes) {
20891
+ const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
20892
+ if (remainingMs < minPassMs)
20893
+ break;
20884
20894
  try {
20885
20895
  await withProfilePage({
20886
20896
  profileDir: opts.profileDir,
20887
20897
  headless,
20888
20898
  url: config.homeUrl,
20889
20899
  isAuthenticated: config.isAuthenticated,
20890
- timeoutMs,
20900
+ timeoutMs: remainingMs,
20891
20901
  launcher: opts.launcher ?? kkBrowserLauncher
20892
20902
  }, async () => true);
20893
20903
  return {
@@ -20189,6 +20189,9 @@ var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
20189
20189
  var DEFAULT_LOGIN_TIMEOUT_MS = 180000;
20190
20190
  var DEFAULT_OPEN_NAV_TIMEOUT_MS = 30000;
20191
20191
  var DEFAULT_CHECK_TIMEOUT_MS = 30000;
20192
+ var VERDICT_PRINT_MARGIN_MS = 2000;
20193
+ var MIN_PASS_BUDGET_MS = 5000;
20194
+ var PASS_LAUNCH_RESERVE_MS = 20000;
20192
20195
  var DEFAULT_POLL_MS = 500;
20193
20196
  function isInstantBrowserDeath(message) {
20194
20197
  return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
@@ -20311,14 +20314,21 @@ async function checkChannelSession(config, opts) {
20311
20314
  const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
20312
20315
  const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
20313
20316
  let lastDetail = `${config.channel} readiness was never probed`;
20317
+ const deadline = Date.now() + timeoutMs;
20318
+ const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
20319
+ const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
20320
+ const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
20314
20321
  for (const headless of passes) {
20322
+ const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
20323
+ if (remainingMs < minPassMs)
20324
+ break;
20315
20325
  try {
20316
20326
  await withProfilePage({
20317
20327
  profileDir: opts.profileDir,
20318
20328
  headless,
20319
20329
  url: config.homeUrl,
20320
20330
  isAuthenticated: config.isAuthenticated,
20321
- timeoutMs,
20331
+ timeoutMs: remainingMs,
20322
20332
  launcher: opts.launcher ?? kkBrowserLauncher
20323
20333
  }, async () => true);
20324
20334
  return {
@@ -20779,6 +20779,9 @@ async function ensureProfileDir2(profileDir, headless) {
20779
20779
  var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
20780
20780
  // ../../packages/publish-harness/src/browser.ts
20781
20781
  var DEFAULT_CHECK_TIMEOUT_MS = 30000;
20782
+ var VERDICT_PRINT_MARGIN_MS = 2000;
20783
+ var MIN_PASS_BUDGET_MS = 5000;
20784
+ var PASS_LAUNCH_RESERVE_MS = 20000;
20782
20785
  var DEFAULT_STEP_TIMEOUT_MS = 30000;
20783
20786
  var DEFAULT_POLL_MS = 500;
20784
20787
  var ATTACH_POLL_MS = 100;
@@ -20903,14 +20906,21 @@ async function checkChannelSession(config, opts) {
20903
20906
  const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
20904
20907
  const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
20905
20908
  let lastDetail = `${config.channel} readiness was never probed`;
20909
+ const deadline = Date.now() + timeoutMs;
20910
+ const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
20911
+ const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
20912
+ const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
20906
20913
  for (const headless of passes) {
20914
+ const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
20915
+ if (remainingMs < minPassMs)
20916
+ break;
20907
20917
  try {
20908
20918
  await withProfilePage({
20909
20919
  profileDir: opts.profileDir,
20910
20920
  headless,
20911
20921
  url: config.homeUrl,
20912
20922
  isAuthenticated: config.isAuthenticated,
20913
- timeoutMs,
20923
+ timeoutMs: remainingMs,
20914
20924
  launcher: opts.launcher ?? kkBrowserLauncher
20915
20925
  }, async () => true);
20916
20926
  return {
@@ -20210,6 +20210,9 @@ var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
20210
20210
  var DEFAULT_LOGIN_TIMEOUT_MS = 180000;
20211
20211
  var DEFAULT_OPEN_NAV_TIMEOUT_MS = 30000;
20212
20212
  var DEFAULT_CHECK_TIMEOUT_MS = 30000;
20213
+ var VERDICT_PRINT_MARGIN_MS = 2000;
20214
+ var MIN_PASS_BUDGET_MS = 5000;
20215
+ var PASS_LAUNCH_RESERVE_MS = 20000;
20213
20216
  var DEFAULT_POLL_MS = 500;
20214
20217
  function isInstantBrowserDeath(message) {
20215
20218
  return /target page, context or browser has been closed|browser has been closed|target closed/i.test(message);
@@ -20332,14 +20335,21 @@ async function checkChannelSession(config, opts) {
20332
20335
  const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
20333
20336
  const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
20334
20337
  let lastDetail = `${config.channel} readiness was never probed`;
20338
+ const deadline = Date.now() + timeoutMs;
20339
+ const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
20340
+ const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
20341
+ const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
20335
20342
  for (const headless of passes) {
20343
+ const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
20344
+ if (remainingMs < minPassMs)
20345
+ break;
20336
20346
  try {
20337
20347
  await withProfilePage({
20338
20348
  profileDir: opts.profileDir,
20339
20349
  headless,
20340
20350
  url: config.homeUrl,
20341
20351
  isAuthenticated: config.isAuthenticated,
20342
- timeoutMs,
20352
+ timeoutMs: remainingMs,
20343
20353
  launcher: opts.launcher ?? kkBrowserLauncher
20344
20354
  }, async () => true);
20345
20355
  return {
@@ -20776,6 +20776,9 @@ async function ensureProfileDir2(profileDir, headless) {
20776
20776
  var MAX_QUEUED_BYTES = 8 * 1024 * 1024;
20777
20777
  // ../../packages/publish-harness/src/browser.ts
20778
20778
  var DEFAULT_CHECK_TIMEOUT_MS = 30000;
20779
+ var VERDICT_PRINT_MARGIN_MS = 2000;
20780
+ var MIN_PASS_BUDGET_MS = 5000;
20781
+ var PASS_LAUNCH_RESERVE_MS = 20000;
20779
20782
  var DEFAULT_STEP_TIMEOUT_MS = 30000;
20780
20783
  var DEFAULT_POLL_MS = 500;
20781
20784
  var ATTACH_POLL_MS = 100;
@@ -20900,14 +20903,21 @@ async function checkChannelSession(config, opts) {
20900
20903
  const timeoutMs = opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS;
20901
20904
  const passes = opts.headedOnly ? [false] : opts.headedFallback === false ? [true] : [true, false];
20902
20905
  let lastDetail = `${config.channel} readiness was never probed`;
20906
+ const deadline = Date.now() + timeoutMs;
20907
+ const printMarginMs = Math.min(VERDICT_PRINT_MARGIN_MS, Math.floor(timeoutMs / 4));
20908
+ const minPassMs = Math.min(MIN_PASS_BUDGET_MS, Math.floor(timeoutMs / 3));
20909
+ const launchReserveMs = Math.min(PASS_LAUNCH_RESERVE_MS, Math.floor(timeoutMs / 3));
20903
20910
  for (const headless of passes) {
20911
+ const remainingMs = deadline - Date.now() - printMarginMs - launchReserveMs;
20912
+ if (remainingMs < minPassMs)
20913
+ break;
20904
20914
  try {
20905
20915
  await withProfilePage({
20906
20916
  profileDir: opts.profileDir,
20907
20917
  headless,
20908
20918
  url: config.homeUrl,
20909
20919
  isAuthenticated: config.isAuthenticated,
20910
- timeoutMs,
20920
+ timeoutMs: remainingMs,
20911
20921
  launcher: opts.launcher ?? kkBrowserLauncher
20912
20922
  }, async () => true);
20913
20923
  return {