@gobing-ai/knowledge-kit 0.1.19 → 0.1.22

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 (147) 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 +1315 -264
  4. package/dist/board/itc/index.js +1 -0
  5. package/dist/index.js +14674 -8775
  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/image-gen/README.md +31 -31
  13. package/plugins/generations/image-gen/assets/sample/provenance.json +314 -0
  14. package/plugins/generations/image-gen/config.example.yaml +3 -0
  15. package/plugins/generations/image-gen/dist/index.js +154 -14
  16. package/plugins/generations/image-gen/presets/SOURCE.md +65 -0
  17. package/plugins/generations/image-gen/scripts/eval-style-presets.ts +513 -0
  18. package/plugins/generations/image-gen/scripts/gen-samples.ts +57 -7
  19. package/plugins/generations/image-gen/src/presets.ts +6 -5
  20. package/plugins/generations/image-gen/src/providers/h3-local.ts +196 -0
  21. package/plugins/generations/image-gen/src/providers/types.ts +11 -1
  22. package/plugins/generations/music-gen/README.md +277 -0
  23. package/plugins/generations/music-gen/dist/index.js +23544 -0
  24. package/plugins/generations/music-gen/package.json +24 -0
  25. package/plugins/generations/music-gen/plugin.json +23 -0
  26. package/plugins/generations/music-gen/presets/SOURCE.md +39 -0
  27. package/plugins/generations/music-gen/presets/formats/clip.yaml +21 -0
  28. package/plugins/generations/music-gen/presets/formats/jingle.yaml +22 -0
  29. package/plugins/generations/music-gen/presets/formats/loop.yaml +21 -0
  30. package/plugins/generations/music-gen/presets/formats/song.yaml +31 -0
  31. package/plugins/generations/music-gen/presets/formats/underscore.yaml +22 -0
  32. package/plugins/generations/music-gen/presets/themes/ambient-tech.yaml +30 -0
  33. package/plugins/generations/music-gen/presets/themes/cinematic.yaml +30 -0
  34. package/plugins/generations/music-gen/presets/themes/lofi.yaml +30 -0
  35. package/plugins/generations/music-gen/presets/themes/synthwave.yaml +30 -0
  36. package/plugins/generations/music-gen/scripts/gen-preset-index.ts +181 -0
  37. package/plugins/generations/music-gen/scripts/resolve-preset.ts +64 -0
  38. package/plugins/generations/music-gen/src/adapter/index.ts +35 -0
  39. package/plugins/generations/music-gen/src/adapter/instance.ts +904 -0
  40. package/plugins/generations/music-gen/src/adapter/offline.ts +124 -0
  41. package/plugins/generations/music-gen/src/artifact.ts +223 -0
  42. package/plugins/generations/music-gen/src/audio/checks.ts +618 -0
  43. package/plugins/generations/music-gen/src/audio/master.ts +267 -0
  44. package/plugins/generations/music-gen/src/audio/measure.ts +507 -0
  45. package/plugins/generations/music-gen/src/audio/profile.ts +131 -0
  46. package/plugins/generations/music-gen/src/audio.ts +122 -0
  47. package/plugins/generations/music-gen/src/brief.ts +191 -0
  48. package/plugins/generations/music-gen/src/config.ts +451 -0
  49. package/plugins/generations/music-gen/src/content.ts +199 -0
  50. package/plugins/generations/music-gen/src/digest.ts +100 -0
  51. package/plugins/generations/music-gen/src/index.ts +147 -0
  52. package/plugins/generations/music-gen/src/job.ts +131 -0
  53. package/plugins/generations/music-gen/src/plugin.ts +371 -0
  54. package/plugins/generations/music-gen/src/presets.ts +918 -0
  55. package/plugins/generations/music-gen/src/render.ts +87 -0
  56. package/plugins/generations/music-gen/src/request.ts +102 -0
  57. package/plugins/generations/music-gen/src/spend.ts +495 -0
  58. package/plugins/generations/music-gen/tsconfig.json +8 -0
  59. package/plugins/kk/config.example.yaml +3 -0
  60. package/plugins/kk/decisions/extract/ai-news.yaml +5 -2
  61. package/plugins/kk/plugin.json +1 -1
  62. package/plugins/kk/publish-presets/daily-ai-voice.json +48 -7
  63. package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +2 -1
  64. package/plugins/kk/scripts/cover-compositor.ts +380 -32
  65. package/plugins/kk/scripts/daily-cover-mock.ts +40 -3
  66. package/plugins/kk/scripts/daily-stages.ts +897 -34
  67. package/plugins/kk/scripts/episode-identity.ts +180 -0
  68. package/plugins/kk/scripts/kk-workflow-stages.ts +37 -1
  69. package/plugins/kk/scripts/music-stages.ts +624 -0
  70. package/plugins/kk/scripts/news-editorial-ledger.ts +906 -0
  71. package/plugins/kk/scripts/source-citation.ts +187 -0
  72. package/plugins/kk/scripts/topic-selection-attempts.ts +446 -0
  73. package/plugins/kk/scripts/topic-selection-calibration.ts +161 -0
  74. package/plugins/kk/skills/content-judge/SKILL.md +11 -6
  75. package/plugins/kk/skills/content-judge/references/music-quality-rubric.md +147 -0
  76. package/plugins/kk/skills/content-judge/references/rubrics.md +15 -0
  77. package/plugins/kk/skills/content-safety/SKILL.md +12 -0
  78. package/plugins/kk/skills/image-authoring/SKILL.md +7 -3
  79. package/plugins/kk/skills/image-authoring/references/providers.md +27 -0
  80. package/plugins/kk/skills/image-authoring/references/style-extraction.md +1 -1
  81. package/plugins/kk/skills/music-authoring/SKILL.md +276 -0
  82. package/plugins/kk/skills/music-authoring/references/judge-input.md +117 -0
  83. package/plugins/kk/skills/news-editorial/SKILL.md +102 -15
  84. package/plugins/kk/skills/news-editorial/references/selection.md +4 -0
  85. package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +58 -11
  86. package/plugins/kk/skills/publish/SKILL.md +11 -0
  87. package/plugins/kk/skills/web-automation/SKILL.md +31 -1
  88. package/plugins/kk/workflows/kk-collect.yaml +8 -4
  89. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +10 -9
  90. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +11 -9
  91. package/plugins/kk/workflows/kk-music.yaml +328 -0
  92. package/plugins/kk/workflows/kk-news-generate.yaml +58 -3
  93. package/plugins/publishings/bilibili-pub/dist/index.js +11 -1
  94. package/plugins/publishings/bilibili-pub/dist/profile-check.js +11 -1
  95. package/plugins/publishings/cnblogs-pub/dist/index.js +11 -1
  96. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +11 -1
  97. package/plugins/publishings/csdn-pub/dist/index.js +11 -1
  98. package/plugins/publishings/csdn-pub/dist/profile-check.js +11 -1
  99. package/plugins/publishings/infoq-pub/dist/index.js +11 -1
  100. package/plugins/publishings/infoq-pub/dist/profile-check.js +11 -1
  101. package/plugins/publishings/jike-pub/dist/index.js +11 -1
  102. package/plugins/publishings/jike-pub/dist/profile-check.js +11 -1
  103. package/plugins/publishings/juejin-pub/dist/index.js +11 -1
  104. package/plugins/publishings/juejin-pub/dist/profile-check.js +11 -1
  105. package/plugins/publishings/linkedin-pub/dist/index.js +54 -7
  106. package/plugins/publishings/linkedin-pub/dist/profile-check.js +43 -6
  107. package/plugins/publishings/linkedin-pub/src/index.ts +52 -6
  108. package/plugins/publishings/podcast-pub/dist/index.js +586 -20
  109. package/plugins/publishings/podcast-pub/src/corrections.ts +509 -0
  110. package/plugins/publishings/podcast-pub/src/index.ts +257 -5
  111. package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +240 -0
  112. package/plugins/publishings/podcast-pub/src/show-notes.ts +69 -13
  113. package/plugins/publishings/shipinhao-pub/dist/index.js +437 -32
  114. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +14 -2
  115. package/plugins/publishings/shipinhao-pub/plugin.json +1 -1
  116. package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +492 -0
  117. package/plugins/publishings/shipinhao-pub/src/flow.ts +227 -12
  118. package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -0
  119. package/plugins/publishings/sspai-pub/dist/index.js +11 -1
  120. package/plugins/publishings/sspai-pub/dist/profile-check.js +11 -1
  121. package/plugins/publishings/substack-pub/dist/index.js +11 -1
  122. package/plugins/publishings/substack-pub/dist/profile-check.js +11 -1
  123. package/plugins/publishings/surfdash-pub/dist/index.js +122 -28
  124. package/plugins/publishings/surfdash-pub/src/digest-check.ts +7 -3
  125. package/plugins/publishings/surfdash-pub/src/index.ts +159 -25
  126. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +37 -4
  127. package/plugins/publishings/threads-pub/dist/index.js +9206 -296
  128. package/plugins/publishings/threads-pub/dist/profile-check.js +21149 -0
  129. package/plugins/publishings/threads-pub/package.json +3 -1
  130. package/plugins/publishings/threads-pub/plugin.json +6 -1
  131. package/plugins/publishings/threads-pub/src/index.ts +8 -1
  132. package/plugins/publishings/threads-pub/src/post-rail.ts +357 -0
  133. package/plugins/publishings/threads-pub/src/profile-check.ts +17 -0
  134. package/plugins/publishings/wechatmp-pub/dist/index.js +18 -1
  135. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +11 -1
  136. package/plugins/publishings/wechatmp-pub/src/flow.ts +13 -0
  137. package/plugins/publishings/weibo-pub/dist/index.js +57 -3
  138. package/plugins/publishings/weibo-pub/dist/profile-check.js +11 -1
  139. package/plugins/publishings/weibo-pub/src/index.ts +74 -2
  140. package/plugins/publishings/x-pub/dist/index.js +274 -44
  141. package/plugins/publishings/x-pub/dist/profile-check.js +14 -2
  142. package/plugins/publishings/x-pub/src/index.ts +15 -1
  143. package/plugins/publishings/x-pub/src/post-rail.ts +334 -0
  144. package/plugins/publishings/xhs-pub/dist/index.js +11 -1
  145. package/plugins/publishings/xhs-pub/dist/profile-check.js +11 -1
  146. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +11 -1
  147. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +11 -1
@@ -0,0 +1,314 @@
1
+ {
2
+ "cover__clean-webapp-ui.jpg": {
3
+ "provider": "minimax",
4
+ "model": "image-01"
5
+ },
6
+ "cover__cute.jpg": {
7
+ "provider": "minimax",
8
+ "model": "image-01"
9
+ },
10
+ "cover__daily-news.jpg": {
11
+ "provider": "minimax",
12
+ "model": "image-01"
13
+ },
14
+ "cover__editorial.jpg": {
15
+ "provider": "minimax",
16
+ "model": "image-01"
17
+ },
18
+ "cover__fresh.jpg": {
19
+ "provider": "minimax",
20
+ "model": "image-01"
21
+ },
22
+ "cover__minimalist.jpg": {
23
+ "provider": "minimax",
24
+ "model": "image-01"
25
+ },
26
+ "cover__photorealistic.jpg": {
27
+ "provider": "minimax",
28
+ "model": "image-01"
29
+ },
30
+ "cover__quasi-news-podcast.jpg": {
31
+ "provider": "minimax",
32
+ "model": "image-01"
33
+ },
34
+ "cover__sketch.jpg": {
35
+ "provider": "minimax",
36
+ "model": "image-01"
37
+ },
38
+ "cover__technical-diagram.jpg": {
39
+ "provider": "minimax",
40
+ "model": "image-01"
41
+ },
42
+ "cover__vibrant.jpg": {
43
+ "provider": "minimax",
44
+ "model": "image-01"
45
+ },
46
+ "cover__warm.jpg": {
47
+ "provider": "minimax",
48
+ "model": "image-01"
49
+ },
50
+ "cover__xhs-knowledge.jpg": {
51
+ "provider": "minimax",
52
+ "model": "image-01"
53
+ },
54
+ "daily-news-cover__clean-webapp-ui.jpg": {
55
+ "provider": "minimax",
56
+ "model": "image-01"
57
+ },
58
+ "daily-news-cover__cute.jpg": {
59
+ "provider": "minimax",
60
+ "model": "image-01"
61
+ },
62
+ "daily-news-cover__daily-news.jpg": {
63
+ "provider": "minimax",
64
+ "model": "image-01"
65
+ },
66
+ "daily-news-cover__editorial.jpg": {
67
+ "provider": "minimax",
68
+ "model": "image-01"
69
+ },
70
+ "daily-news-cover__fresh.jpg": {
71
+ "provider": "minimax",
72
+ "model": "image-01"
73
+ },
74
+ "daily-news-cover__minimalist.jpg": {
75
+ "provider": "minimax",
76
+ "model": "image-01"
77
+ },
78
+ "daily-news-cover__photorealistic.jpg": {
79
+ "provider": "minimax",
80
+ "model": "image-01"
81
+ },
82
+ "daily-news-cover__quasi-news-podcast.jpg": {
83
+ "provider": "minimax",
84
+ "model": "image-01"
85
+ },
86
+ "daily-news-cover__sketch.jpg": {
87
+ "provider": "minimax",
88
+ "model": "image-01"
89
+ },
90
+ "daily-news-cover__technical-diagram.jpg": {
91
+ "provider": "minimax",
92
+ "model": "image-01"
93
+ },
94
+ "daily-news-cover__vibrant.jpg": {
95
+ "provider": "minimax",
96
+ "model": "image-01"
97
+ },
98
+ "daily-news-cover__warm.jpg": {
99
+ "provider": "minimax",
100
+ "model": "image-01"
101
+ },
102
+ "daily-news-cover__xhs-knowledge.jpg": {
103
+ "provider": "minimax",
104
+ "model": "image-01"
105
+ },
106
+ "daily-news-podcast-cover__clean-webapp-ui.jpg": {
107
+ "provider": "minimax",
108
+ "model": "image-01"
109
+ },
110
+ "daily-news-podcast-cover__cute.jpg": {
111
+ "provider": "minimax",
112
+ "model": "image-01"
113
+ },
114
+ "daily-news-podcast-cover__daily-news.jpg": {
115
+ "provider": "minimax",
116
+ "model": "image-01"
117
+ },
118
+ "daily-news-podcast-cover__editorial.jpg": {
119
+ "provider": "minimax",
120
+ "model": "image-01"
121
+ },
122
+ "daily-news-podcast-cover__fresh.jpg": {
123
+ "provider": "minimax",
124
+ "model": "image-01"
125
+ },
126
+ "daily-news-podcast-cover__minimalist.jpg": {
127
+ "provider": "minimax",
128
+ "model": "image-01"
129
+ },
130
+ "daily-news-podcast-cover__photorealistic.jpg": {
131
+ "provider": "minimax",
132
+ "model": "image-01"
133
+ },
134
+ "daily-news-podcast-cover__quasi-news-podcast.jpg": {
135
+ "provider": "minimax",
136
+ "model": "image-01"
137
+ },
138
+ "daily-news-podcast-cover__sketch.jpg": {
139
+ "provider": "minimax",
140
+ "model": "image-01"
141
+ },
142
+ "daily-news-podcast-cover__technical-diagram.jpg": {
143
+ "provider": "minimax",
144
+ "model": "image-01"
145
+ },
146
+ "daily-news-podcast-cover__vibrant.jpg": {
147
+ "provider": "minimax",
148
+ "model": "image-01"
149
+ },
150
+ "daily-news-podcast-cover__warm.jpg": {
151
+ "provider": "minimax",
152
+ "model": "image-01"
153
+ },
154
+ "daily-news-podcast-cover__xhs-knowledge.jpg": {
155
+ "provider": "minimax",
156
+ "model": "image-01"
157
+ },
158
+ "free__clean-webapp-ui.jpg": {
159
+ "provider": "minimax",
160
+ "model": "image-01"
161
+ },
162
+ "free__cute.jpg": {
163
+ "provider": "minimax",
164
+ "model": "image-01"
165
+ },
166
+ "free__daily-news.jpg": {
167
+ "provider": "minimax",
168
+ "model": "image-01"
169
+ },
170
+ "free__editorial.jpg": {
171
+ "provider": "minimax",
172
+ "model": "image-01"
173
+ },
174
+ "free__fresh.jpg": {
175
+ "provider": "minimax",
176
+ "model": "image-01"
177
+ },
178
+ "free__minimalist.jpg": {
179
+ "provider": "minimax",
180
+ "model": "image-01"
181
+ },
182
+ "free__photorealistic.jpg": {
183
+ "provider": "minimax",
184
+ "model": "image-01"
185
+ },
186
+ "free__quasi-news-podcast.jpg": {
187
+ "provider": "minimax",
188
+ "model": "image-01"
189
+ },
190
+ "free__sketch.jpg": {
191
+ "provider": "minimax",
192
+ "model": "image-01"
193
+ },
194
+ "free__technical-diagram.jpg": {
195
+ "provider": "minimax",
196
+ "model": "image-01"
197
+ },
198
+ "free__vibrant.jpg": {
199
+ "provider": "minimax",
200
+ "model": "image-01"
201
+ },
202
+ "free__warm.jpg": {
203
+ "provider": "minimax",
204
+ "model": "image-01"
205
+ },
206
+ "free__xhs-knowledge.jpg": {
207
+ "provider": "minimax",
208
+ "model": "image-01"
209
+ },
210
+ "illustration__clean-webapp-ui.jpg": {
211
+ "provider": "minimax",
212
+ "model": "image-01"
213
+ },
214
+ "illustration__cute.jpg": {
215
+ "provider": "minimax",
216
+ "model": "image-01"
217
+ },
218
+ "illustration__daily-news.jpg": {
219
+ "provider": "minimax",
220
+ "model": "image-01"
221
+ },
222
+ "illustration__editorial.jpg": {
223
+ "provider": "minimax",
224
+ "model": "image-01"
225
+ },
226
+ "illustration__fresh.jpg": {
227
+ "provider": "minimax",
228
+ "model": "image-01"
229
+ },
230
+ "illustration__minimalist.jpg": {
231
+ "provider": "minimax",
232
+ "model": "image-01"
233
+ },
234
+ "illustration__photorealistic.jpg": {
235
+ "provider": "minimax",
236
+ "model": "image-01"
237
+ },
238
+ "illustration__quasi-news-podcast.jpg": {
239
+ "provider": "minimax",
240
+ "model": "image-01"
241
+ },
242
+ "illustration__sketch.jpg": {
243
+ "provider": "minimax",
244
+ "model": "image-01"
245
+ },
246
+ "illustration__technical-diagram.jpg": {
247
+ "provider": "minimax",
248
+ "model": "image-01"
249
+ },
250
+ "illustration__vibrant.jpg": {
251
+ "provider": "minimax",
252
+ "model": "image-01"
253
+ },
254
+ "illustration__warm.jpg": {
255
+ "provider": "minimax",
256
+ "model": "image-01"
257
+ },
258
+ "illustration__xhs-knowledge.jpg": {
259
+ "provider": "minimax",
260
+ "model": "image-01"
261
+ },
262
+ "xhs-card__clean-webapp-ui.jpg": {
263
+ "provider": "minimax",
264
+ "model": "image-01"
265
+ },
266
+ "xhs-card__cute.jpg": {
267
+ "provider": "minimax",
268
+ "model": "image-01"
269
+ },
270
+ "xhs-card__daily-news.jpg": {
271
+ "provider": "minimax",
272
+ "model": "image-01"
273
+ },
274
+ "xhs-card__editorial.jpg": {
275
+ "provider": "minimax",
276
+ "model": "image-01"
277
+ },
278
+ "xhs-card__fresh.jpg": {
279
+ "provider": "minimax",
280
+ "model": "image-01"
281
+ },
282
+ "xhs-card__minimalist.jpg": {
283
+ "provider": "minimax",
284
+ "model": "image-01"
285
+ },
286
+ "xhs-card__photorealistic.jpg": {
287
+ "provider": "minimax",
288
+ "model": "image-01"
289
+ },
290
+ "xhs-card__quasi-news-podcast.jpg": {
291
+ "provider": "minimax",
292
+ "model": "image-01"
293
+ },
294
+ "xhs-card__sketch.jpg": {
295
+ "provider": "minimax",
296
+ "model": "image-01"
297
+ },
298
+ "xhs-card__technical-diagram.jpg": {
299
+ "provider": "minimax",
300
+ "model": "image-01"
301
+ },
302
+ "xhs-card__vibrant.jpg": {
303
+ "provider": "minimax",
304
+ "model": "image-01"
305
+ },
306
+ "xhs-card__warm.jpg": {
307
+ "provider": "minimax",
308
+ "model": "image-01"
309
+ },
310
+ "xhs-card__xhs-knowledge.jpg": {
311
+ "provider": "minimax",
312
+ "model": "image-01"
313
+ }
314
+ }
@@ -70,6 +70,9 @@ plugins:
70
70
  BAOYU_CODEX_IMAGEGEN_BIN: "" # optional — wrapper entrypoint override
71
71
  BAOYU_CODEX_IMAGEGEN_TIMEOUT_MS: "" # optional — per-call timeout (ms)
72
72
  BAOYU_CODEX_IMAGEGEN_RETRIES: "" # optional — retry count
73
+ # -- h3-local (local Apple Silicon MLX runtime; NEVER auto-selected — pin explicitly) --
74
+ H3_IMAGE_MLX_BIN: "" # absolute path to ../gitops/apps/h3-image-mlx/h3gen.sh — its presence IS readiness (0379)
75
+ H3_LOCAL_TIMEOUT_MS: "" # optional — per-render bound in ms; default 1800000 (30 min: a 2-reference edit measured 27m46s)
73
76
  # -- 0104 R6 runtime seams (behavior, not credentials; placeholder values only) --
74
77
  KK_IMAGE_MAX_IMAGES: "" # optional — per-run budget cap; default 4 (OPEN for the operator to set)
75
78
  KK_IMAGE_DRY_RUN: "" # optional — "1" composes every prompt, selects the provider, spends nothing
@@ -13021,7 +13021,8 @@ function renderTemplate(template, vars, formatName) {
13021
13021
  }
13022
13022
  function composePrompt(format, style, vars, extra) {
13023
13023
  const body = renderTemplate(format.template, mergeVars(format.variables, vars), format.name);
13024
- return [body, format.keywords.join(", "), style.modifiers, extra].filter(Boolean).join(", ");
13024
+ const negative = style.negative ? `avoid: ${style.negative}` : undefined;
13025
+ return [body, format.keywords.join(", "), style.modifiers, negative, extra].filter(Boolean).join(", ");
13025
13026
  }
13026
13027
  var fs = createNodeFileSystem();
13027
13028
  function isDirectory(path) {
@@ -14471,8 +14472,140 @@ header = ${curlQuote(`x-goog-api-key: ${apiKey}`)}
14471
14472
  };
14472
14473
  };
14473
14474
 
14475
+ // ../../plugins/generations/image-gen/src/providers/h3-local.ts
14476
+ import { spawn as spawn2 } from "child_process";
14477
+ import { randomBytes as randomBytes2 } from "crypto";
14478
+ import { mkdir as mkdir2, rm as rm2 } from "fs/promises";
14479
+ import { tmpdir as tmpdir3 } from "os";
14480
+ import { resolve as resolve3 } from "path";
14481
+ var DEFAULT_MODEL7 = "h3";
14482
+ var H3_DIM_MIN = 256;
14483
+ var H3_DIM_MAX = 4096;
14484
+ var H3_DIM_STEP = 32;
14485
+ var DEFAULT_TIMEOUT_MS = 30 * 60 * 1000;
14486
+ function snapDim2(value) {
14487
+ const snapped = Math.round(value / H3_DIM_STEP) * H3_DIM_STEP;
14488
+ return Math.min(H3_DIM_MAX, Math.max(H3_DIM_MIN, snapped));
14489
+ }
14490
+ function h3ExactSize(width, height) {
14491
+ if (!Number.isFinite(width) || !Number.isFinite(height))
14492
+ return false;
14493
+ const legal = (value) => Number.isInteger(value) && value % H3_DIM_STEP === 0 && value >= H3_DIM_MIN && value <= H3_DIM_MAX;
14494
+ return legal(width) && legal(height);
14495
+ }
14496
+ function h3Canvas(aspectRatio) {
14497
+ const match = /^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(aspectRatio?.trim() ?? "");
14498
+ if (match === null)
14499
+ return null;
14500
+ const ratioWidth = Number(match[1]);
14501
+ const ratioHeight = Number(match[2]);
14502
+ if (!(ratioWidth > 0) || !(ratioHeight > 0))
14503
+ return null;
14504
+ const height = snapDim2(1024);
14505
+ return { width: snapDim2(1024 * ratioWidth / ratioHeight), height };
14506
+ }
14507
+ function spawnWrapper2(command, args, timeoutMs) {
14508
+ return new Promise((resolveSpawn, rejectSpawn) => {
14509
+ const child = spawn2(command, args, { stdio: ["ignore", "pipe", "pipe"], detached: true });
14510
+ let stdout = "";
14511
+ let stderr = "";
14512
+ let timedOut = false;
14513
+ const timer = setTimeout(() => {
14514
+ timedOut = true;
14515
+ try {
14516
+ if (child.pid !== undefined)
14517
+ process.kill(-child.pid, "SIGKILL");
14518
+ } catch {}
14519
+ }, timeoutMs);
14520
+ child.stdout.on("data", (chunk) => {
14521
+ stdout += chunk.toString("utf8");
14522
+ });
14523
+ child.stderr.on("data", (chunk) => {
14524
+ stderr += chunk.toString("utf8");
14525
+ });
14526
+ child.on("error", (err) => {
14527
+ clearTimeout(timer);
14528
+ rejectSpawn(err);
14529
+ });
14530
+ child.on("close", (code) => {
14531
+ clearTimeout(timer);
14532
+ resolveSpawn({ stdout, stderr, code: code ?? 1, timedOut });
14533
+ });
14534
+ });
14535
+ }
14536
+ function stderrTail(text) {
14537
+ const trimmed = text.trim();
14538
+ if (trimmed === "")
14539
+ return "";
14540
+ return `; ${trimmed.slice(-800)}`;
14541
+ }
14542
+ function positiveInt(value) {
14543
+ if (value === "")
14544
+ return null;
14545
+ const parsed = Number.parseInt(value, 10);
14546
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
14547
+ }
14548
+ var createH3Local = (options) => {
14549
+ const env = options?.env ?? process.env;
14550
+ const readEnv = (key) => env[key] ?? "";
14551
+ const timeoutMs = options?.timeoutMs ?? positiveInt(readEnv("H3_LOCAL_TIMEOUT_MS")) ?? DEFAULT_TIMEOUT_MS;
14552
+ return {
14553
+ name: "h3-local",
14554
+ defaultModel: () => DEFAULT_MODEL7,
14555
+ isAvailable: () => readEnv("H3_IMAGE_MLX_BIN") !== "",
14556
+ supportsReferenceImages: () => true,
14557
+ exactSize: (_model, width, height) => h3ExactSize(width, height),
14558
+ validate(req) {
14559
+ if ((req.n ?? 1) > 1) {
14560
+ throw new Error("h3-local provider supports only n=1 (the wrapper renders one image per call).");
14561
+ }
14562
+ },
14563
+ async generate(req) {
14564
+ const wrapper = readEnv("H3_IMAGE_MLX_BIN");
14565
+ if (wrapper === "") {
14566
+ throw new Error("h3-local provider requires H3_IMAGE_MLX_BIN pointing at an executable h3gen.sh (or set the provider explicitly with IMAGE_GEN_PROVIDER).");
14567
+ }
14568
+ const canvas = req.width !== undefined && req.height !== undefined && h3ExactSize(req.width, req.height) ? { width: req.width, height: req.height } : h3Canvas(req.aspectRatio) ?? { width: 1024, height: 1024 };
14569
+ const sessionDir = resolve3(tmpdir3(), "kk-image-gen-h3-local");
14570
+ await mkdir2(sessionDir, { recursive: true });
14571
+ const tmpOutput = resolve3(sessionDir, `out-${randomBytes2(8).toString("hex")}.png`);
14572
+ const args = [
14573
+ "--prompt",
14574
+ req.prompt,
14575
+ "--output",
14576
+ tmpOutput,
14577
+ "--width",
14578
+ String(canvas.width),
14579
+ "--height",
14580
+ String(canvas.height)
14581
+ ];
14582
+ for (const ref of req.referenceImages ?? []) {
14583
+ args.push("--reference", resolve3(ref));
14584
+ }
14585
+ try {
14586
+ const spawnResult = await spawnWrapper2(wrapper, args, timeoutMs);
14587
+ if (spawnResult.timedOut) {
14588
+ throw new Error(`h3-local wrapper timed out after ${timeoutMs}ms (${canvas.width}x${canvas.height})${stderrTail(spawnResult.stderr)}`);
14589
+ }
14590
+ if (spawnResult.code !== 0) {
14591
+ throw new Error(`h3-local wrapper exited with code ${spawnResult.code}${stderrTail(spawnResult.stderr)}`);
14592
+ }
14593
+ const bytes = await readBytes(tmpOutput).catch(() => null);
14594
+ if (bytes === null) {
14595
+ throw new Error(`h3-local wrapper wrote no output at ${tmpOutput}${stderrTail(spawnResult.stderr)}`);
14596
+ }
14597
+ return { bytes, extension: "png", provider: "h3-local", model: req.model };
14598
+ } finally {
14599
+ await rm2(tmpOutput, { force: true }).catch(() => {
14600
+ return;
14601
+ });
14602
+ }
14603
+ }
14604
+ };
14605
+ };
14606
+
14474
14607
  // ../../plugins/generations/image-gen/src/providers/huggingface.ts
14475
- var DEFAULT_MODEL7 = "stabilityai/stable-diffusion-xl-base-1.0";
14608
+ var DEFAULT_MODEL8 = "stabilityai/stable-diffusion-xl-base-1.0";
14476
14609
  var BASE_URL = "https://api-inference.huggingface.co/models";
14477
14610
  var buildPayload = (req) => ({
14478
14611
  inputs: req.prompt,
@@ -14489,7 +14622,7 @@ var createHuggingface = (options) => {
14489
14622
  const readEnv = (key) => env[key] ?? "";
14490
14623
  return {
14491
14624
  name: "huggingface",
14492
- defaultModel: () => readEnv("HUGGINGFACE_MODEL") || DEFAULT_MODEL7,
14625
+ defaultModel: () => readEnv("HUGGINGFACE_MODEL") || DEFAULT_MODEL8,
14493
14626
  isAvailable: () => readEnv("HUGGINGFACE_API_TOKEN") !== "",
14494
14627
  supportsReferenceImages: () => false,
14495
14628
  async generate(req) {
@@ -14520,7 +14653,7 @@ var createHuggingface = (options) => {
14520
14653
 
14521
14654
  // ../../plugins/generations/image-gen/src/providers/jimeng.ts
14522
14655
  import * as crypto from "crypto";
14523
- var DEFAULT_MODEL8 = "jimeng_t2i_v40";
14656
+ var DEFAULT_MODEL9 = "jimeng_t2i_v40";
14524
14657
  var SIZE_PRESETS = {
14525
14658
  normal: {
14526
14659
  "1:1": "1024x1024",
@@ -14695,7 +14828,7 @@ var createJimeng = (options) => {
14695
14828
  }
14696
14829
  return {
14697
14830
  name: "jimeng",
14698
- defaultModel: () => DEFAULT_MODEL8,
14831
+ defaultModel: () => DEFAULT_MODEL9,
14699
14832
  isAvailable: () => readEnv("JIMENG_ACCESS_KEY_ID") !== "" && readEnv("JIMENG_SECRET_ACCESS_KEY") !== "",
14700
14833
  supportsReferenceImages: () => true,
14701
14834
  generate
@@ -14765,7 +14898,7 @@ function isFallbackEligible(cls) {
14765
14898
  }
14766
14899
 
14767
14900
  // ../../plugins/generations/image-gen/src/providers/minimax.ts
14768
- var DEFAULT_MODEL9 = "image-01";
14901
+ var DEFAULT_MODEL10 = "image-01";
14769
14902
  var MAX_REFERENCE_IMAGE_BYTES = 10 * 1024 * 1024;
14770
14903
  var SUPPORTED_ASPECT_RATIOS = new Set(["1:1", "16:9", "4:3", "3:2", "2:3", "3:4", "9:16", "21:9"]);
14771
14904
  function responseError(result) {
@@ -14857,7 +14990,7 @@ var createMinimax = (options) => {
14857
14990
  const readEnv = (key) => env[key] ?? "";
14858
14991
  return {
14859
14992
  name: "minimax",
14860
- defaultModel: () => DEFAULT_MODEL9,
14993
+ defaultModel: () => DEFAULT_MODEL10,
14861
14994
  isAvailable: () => readEnv("MINIMAX_API_KEY") !== "",
14862
14995
  supportsReferenceImages: () => true,
14863
14996
  exactSize: (model, width, height) => model === "image-01" && isAcceptablePixelSize(width, height),
@@ -14912,7 +15045,7 @@ var createMinimax = (options) => {
14912
15045
 
14913
15046
  // ../../plugins/generations/image-gen/src/providers/openrouter.ts
14914
15047
  import { Buffer as Buffer8 } from "buffer";
14915
- var DEFAULT_MODEL10 = "google/gemini-3.1-flash-image";
15048
+ var DEFAULT_MODEL11 = "google/gemini-3.1-flash-image";
14916
15049
  var COMMON_ASPECT_RATIOS = ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"];
14917
15050
  var GEMINI_EXTENDED_ASPECT_RATIOS = ["1:4", "4:1", "1:8", "8:1"];
14918
15051
  function normalizeModelId(model) {
@@ -15091,7 +15224,7 @@ var createOpenrouter = (options) => {
15091
15224
  const readEnv = (key) => env[key] ?? "";
15092
15225
  return {
15093
15226
  name: "openrouter",
15094
- defaultModel: () => DEFAULT_MODEL10,
15227
+ defaultModel: () => DEFAULT_MODEL11,
15095
15228
  isAvailable: () => readEnv("OPENROUTER_API_KEY") !== "",
15096
15229
  supportsReferenceImages: () => true,
15097
15230
  async generate(req) {
@@ -15132,7 +15265,7 @@ var createOpenrouter = (options) => {
15132
15265
  };
15133
15266
 
15134
15267
  // ../../plugins/generations/image-gen/src/providers/replicate.ts
15135
- var DEFAULT_MODEL11 = "google/nano-banana-2";
15268
+ var DEFAULT_MODEL12 = "google/nano-banana-2";
15136
15269
  var SYNC_WAIT_SECONDS = 60;
15137
15270
  var POLL_INTERVAL_MS = 2000;
15138
15271
  var MAX_POLL_MS = 300000;
@@ -15325,7 +15458,7 @@ var createReplicate = (options) => {
15325
15458
  }
15326
15459
  return {
15327
15460
  name: "replicate",
15328
- defaultModel: () => DEFAULT_MODEL11,
15461
+ defaultModel: () => DEFAULT_MODEL12,
15329
15462
  isAvailable: () => readEnv("REPLICATE_API_TOKEN") !== "",
15330
15463
  supportsReferenceImages: () => true,
15331
15464
  async generate(req) {
@@ -15428,7 +15561,7 @@ function parseSize2(size) {
15428
15561
  function roundToStep2(value, step) {
15429
15562
  return Math.max(step, Math.round(value / step) * step);
15430
15563
  }
15431
- var DEFAULT_MODEL12 = "glm-image";
15564
+ var DEFAULT_MODEL13 = "glm-image";
15432
15565
  function getRatioValue(ar) {
15433
15566
  const parsed = parseAspectRatio4(ar);
15434
15567
  return parsed === null ? null : parsed.width / parsed.height;
@@ -15518,7 +15651,7 @@ var createZai = (options) => {
15518
15651
  const readEnv = (key) => env[key] ?? "";
15519
15652
  return {
15520
15653
  name: "zai",
15521
- defaultModel: () => DEFAULT_MODEL12,
15654
+ defaultModel: () => DEFAULT_MODEL13,
15522
15655
  isAvailable: () => (readEnv("ZAI_API_KEY") || readEnv("BIGMODEL_API_KEY")) !== "",
15523
15656
  supportsReferenceImages: () => false,
15524
15657
  validate(req) {
@@ -15571,7 +15704,7 @@ var createZai = (options) => {
15571
15704
 
15572
15705
  // ../../plugins/generations/image-gen/src/providers/types.ts
15573
15706
  var IMAGE_GEN_PROVIDER_ENV = "IMAGE_GEN_PROVIDER";
15574
- var NEVER_AUTO = new Set(["codex-cli"]);
15707
+ var NEVER_AUTO = new Set(["codex-cli", "h3-local"]);
15575
15708
  var PROVIDERS = {
15576
15709
  agnes: {
15577
15710
  name: "agnes",
@@ -15612,6 +15745,13 @@ var PROVIDERS = {
15612
15745
  ],
15613
15746
  create: createGoogle
15614
15747
  },
15748
+ "h3-local": {
15749
+ name: "h3-local",
15750
+ env: ["H3_IMAGE_MLX_BIN"],
15751
+ defaultModel: "h3",
15752
+ note: "requires H3_IMAGE_MLX_BIN pointing at the local h3gen.sh wrapper (never auto-selected)",
15753
+ create: createH3Local
15754
+ },
15615
15755
  huggingface: {
15616
15756
  name: "huggingface",
15617
15757
  env: ["HUGGINGFACE_API_TOKEN"],
@@ -0,0 +1,65 @@
1
+ # Preset sources and validation provenance
2
+
3
+ ## Open Image Prompts style-card adaptations
4
+
5
+ Source: [NanmiCoder/open-image-prompts](https://github.com/NanmiCoder/open-image-prompts),
6
+ commit `0e8da2c8d317ec517af75f5bbf3a76124cfff5b1`, under `skills/img-gen-taste/references/`.
7
+ The Skill instructions are MIT-licensed, Copyright 2026 NanmiCoder. Adaptations remove subject and
8
+ aspect-ratio slots so the existing `FormatPreset` continues to own the deliverable and canvas.
9
+
10
+ All candidates begin **generation-pending**, including cards marked `corpus-reviewed` upstream.
11
+ Corpus review establishes reference evidence, not generation quality. `source.refImages` is omitted
12
+ because upstream images are not downloaded or vendored. Reference IDs below are provenance only;
13
+ third-party source images and prompts are not relicensed or included here.
14
+
15
+ | Card | Upstream reference tweet IDs | Initial evidence status |
16
+ | --- | --- | --- |
17
+ | `limited-ink-risograph-editorial` | `2065135532875645242` | corpus-reviewed / generation-pending; one explicit source |
18
+ | `layered-papercraft-diorama` | `2059228200841232771`, `2066752996499927074` | corpus-reviewed / generation-pending |
19
+ | `minimalist-ink-wash-negative-space` | `2062404916174569621`, `2066447081980473664` | corpus-reviewed / generation-pending |
20
+ | `notion-editorial-line-art` | none supplied | authored-unverified / generation-pending; upstream reference section is empty |
21
+ | `product-exploded-identity` | `2071674030998933562`, `2039274904843960366`, `2073026525243310084` | corpus-reviewed / generation-pending |
22
+ | `handcrafted-clay-character` | `2031792275765047546`, `2042595606670004459` | corpus-reviewed / generation-pending |
23
+
24
+ Generation outcomes and final promotion status are recorded in the K3/task-0380 evaluation report.
25
+ Only accepted candidates belong in `styles/`; rejected candidates remain evaluation evidence.
26
+
27
+ **Outcome (2026-11-16): none of the six candidates is promoted.** Two independent blind reviews under
28
+ the same gate (`>= 3 of 4 cells won` and `zero critical violations`) both returned 0 accepted:
29
+ `minimax/image-01` rejected risograph, papercraft, ink-wash, Notion line art and exploded-product, with
30
+ clay blocked by Token Plan exhaustion. The complete `h3-local/h3` v2 run rejected all six after 48 renders
31
+ and 24 blind reviews: risograph 0 wins / 3 critical groups; papercraft 0/4; ink-wash 1/2;
32
+ Notion line art 0/1; exploded-product 0/3; clay 1/4. Reports: `docs/tasks/evidence/K3/0380/`.
33
+ No candidate is in `styles/`; rejected candidates remain evaluation evidence, and no quality claim is
34
+ made for a provider or revision that was not evaluated.
35
+
36
+ ## Provider neutrality
37
+
38
+ Preset YAML declares only portable format/style data. Provider and model selection never belongs in
39
+ `formats/*.yaml` or `styles/*.yaml`; runners resolve them from CLI flags and the existing provider
40
+ registry. Each evaluation run uses a provider-specific work directory and records actual provider/model
41
+ provenance, so switching providers never mixes images or scores from different runs.
42
+
43
+ ## MIT License notice for adapted Skill instructions
44
+
45
+ MIT License
46
+
47
+ Copyright (c) 2026 NanmiCoder
48
+
49
+ Permission is hereby granted, free of charge, to any person obtaining a copy
50
+ of this software and associated documentation files (the "Software"), to deal
51
+ in the Software without restriction, including without limitation the rights
52
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
+ copies of the Software, and to permit persons to whom the Software is
54
+ furnished to do so, subject to the following conditions:
55
+
56
+ The above copyright notice and this permission notice shall be included in all
57
+ copies or substantial portions of the Software.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65
+ SOFTWARE.