@gobing-ai/knowledge-kit 0.1.17 → 0.1.20

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 (95) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/board/daily-voice/index.js +40 -7
  3. package/dist/index.js +8428 -4448
  4. package/package.json +1 -1
  5. package/plugins/generations/image-gen/README.md +31 -31
  6. package/plugins/generations/image-gen/assets/sample/provenance.json +314 -0
  7. package/plugins/generations/image-gen/config.example.yaml +3 -0
  8. package/plugins/generations/image-gen/dist/index.js +154 -14
  9. package/plugins/generations/image-gen/presets/SOURCE.md +65 -0
  10. package/plugins/generations/image-gen/scripts/eval-style-presets.ts +513 -0
  11. package/plugins/generations/image-gen/scripts/gen-samples.ts +57 -7
  12. package/plugins/generations/image-gen/src/presets.ts +6 -5
  13. package/plugins/generations/image-gen/src/providers/h3-local.ts +196 -0
  14. package/plugins/generations/image-gen/src/providers/types.ts +11 -1
  15. package/plugins/kk/config.example.yaml +7 -2
  16. package/plugins/kk/decisions/extract/ai-news.yaml +5 -2
  17. package/plugins/kk/plugin.json +1 -1
  18. package/plugins/kk/publish-presets/chinese-article.json +8 -2
  19. package/plugins/kk/publish-presets/daily-ai-voice-migration.json +1 -1
  20. package/plugins/kk/publish-presets/daily-ai-voice.json +57 -16
  21. package/plugins/kk/publish-presets/itc-main.json +36 -9
  22. package/plugins/kk/publish-presets/technical-article.json +8 -2
  23. package/plugins/kk/schedules/kk-daily-ai-voice3.cron.tmpl +8 -9
  24. package/plugins/kk/schedules/kk-daily-publish3-cn-peak.cron.tmpl +13 -19
  25. package/plugins/kk/schedules/kk-daily-publish3-overseas.cron.tmpl +11 -9
  26. package/plugins/kk/scripts/daily-stages.ts +238 -14
  27. package/plugins/kk/scripts/daily-triage-core.ts +43 -25
  28. package/plugins/kk/scripts/daily-triage.ts +1 -1
  29. package/plugins/kk/skills/image-authoring/SKILL.md +7 -3
  30. package/plugins/kk/skills/image-authoring/references/providers.md +27 -0
  31. package/plugins/kk/skills/image-authoring/references/style-extraction.md +1 -1
  32. package/plugins/kk/skills/publish/SKILL.md +15 -2
  33. package/plugins/kk/skills/web-automation/SKILL.md +31 -1
  34. package/plugins/kk/workflows/kk-article-generate.yaml +485 -0
  35. package/plugins/kk/workflows/kk-collect.yaml +8 -4
  36. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +2 -1
  37. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +4 -2
  38. package/plugins/kk/workflows/kk-daily-safety.yaml +5 -7
  39. package/plugins/kk/workflows/kk-news-generate.yaml +410 -0
  40. package/plugins/kk/workflows/kk-publish.yaml +236 -0
  41. package/plugins/publishings/bilibili-pub/dist/profile-check.js +49 -10
  42. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +60 -10
  43. package/plugins/publishings/csdn-pub/dist/profile-check.js +60 -10
  44. package/plugins/publishings/infoq-pub/dist/profile-check.js +60 -10
  45. package/plugins/publishings/jike-pub/dist/profile-check.js +60 -10
  46. package/plugins/publishings/juejin-pub/dist/profile-check.js +60 -10
  47. package/plugins/publishings/linkedin-pub/dist/index.js +43 -6
  48. package/plugins/publishings/linkedin-pub/dist/profile-check.js +92 -15
  49. package/plugins/publishings/linkedin-pub/src/index.ts +52 -6
  50. package/plugins/publishings/shipinhao-pub/dist/index.js +391 -32
  51. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +52 -11
  52. package/plugins/publishings/shipinhao-pub/plugin.json +1 -1
  53. package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +393 -0
  54. package/plugins/publishings/shipinhao-pub/src/flow.ts +243 -14
  55. package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -0
  56. package/plugins/publishings/sspai-pub/dist/profile-check.js +60 -10
  57. package/plugins/publishings/substack-pub/dist/profile-check.js +60 -10
  58. package/plugins/publishings/surfdash-pub/dist/index.js +50 -8
  59. package/plugins/publishings/surfdash-pub/src/index.ts +59 -8
  60. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +34 -3
  61. package/plugins/publishings/threads-pub/dist/index.js +9196 -296
  62. package/plugins/publishings/threads-pub/dist/profile-check.js +21139 -0
  63. package/plugins/publishings/threads-pub/package.json +3 -1
  64. package/plugins/publishings/threads-pub/plugin.json +6 -1
  65. package/plugins/publishings/threads-pub/src/index.ts +8 -1
  66. package/plugins/publishings/threads-pub/src/post-rail.ts +357 -0
  67. package/plugins/publishings/threads-pub/src/profile-check.ts +17 -0
  68. package/plugins/publishings/wechatmp-pub/dist/index.js +454 -81
  69. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +401 -102
  70. package/plugins/publishings/wechatmp-pub/src/flow.ts +42 -4
  71. package/plugins/publishings/wechatmp-pub/src/index.ts +142 -102
  72. package/plugins/publishings/wechatmp-pub/src/profile-check.ts +36 -58
  73. package/plugins/publishings/weibo-pub/dist/index.js +136 -22
  74. package/plugins/publishings/weibo-pub/dist/profile-check.js +61 -11
  75. package/plugins/publishings/weibo-pub/src/index.ts +208 -22
  76. package/plugins/publishings/x-pub/dist/index.js +263 -43
  77. package/plugins/publishings/x-pub/dist/profile-check.js +63 -11
  78. package/plugins/publishings/x-pub/src/index.ts +15 -1
  79. package/plugins/publishings/x-pub/src/post-rail.ts +334 -0
  80. package/plugins/publishings/xhs-pub/dist/index.js +193 -201
  81. package/plugins/publishings/xhs-pub/dist/profile-check.js +380 -85
  82. package/plugins/publishings/xhs-pub/src/automation-guard.ts +2 -3
  83. package/plugins/publishings/xhs-pub/src/flow.ts +177 -205
  84. package/plugins/publishings/xhs-pub/src/index.ts +65 -59
  85. package/plugins/publishings/xhs-pub/src/modes.ts +1 -1
  86. package/plugins/publishings/xhs-pub/src/page.ts +2 -2
  87. package/plugins/publishings/xhs-pub/src/profile-check.ts +86 -150
  88. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +60 -10
  89. package/plugins/kk/scripts/daily-scheduled-run.ts +0 -581
  90. package/plugins/kk/scripts/voice3-publish-window.ts +0 -206
  91. package/plugins/kk/workflows/kk-daily-ai-voice3.yaml +0 -903
  92. package/plugins/kk/workflows/kk-daily-publish3.yaml +0 -353
  93. package/plugins/kk/workflows/kk-itc-author.yaml +0 -484
  94. package/plugins/kk/workflows/kk-itc-publish-tail.yaml +0 -112
  95. package/plugins/kk/workflows/kk-itc.yaml +0 -291
@@ -1,291 +0,0 @@
1
- ---
2
- name: kk-itc
3
- kind: dag
4
- version: "2"
5
- description: >-
6
- IT content authoring and publication DAG: prepare -> child authoring FSM -> verify-child-freeze
7
- -> illustration/SEO branches -> materialize & plan -> target check -> fan-out send -> reconcile-settle -> report
8
-
9
- vars:
10
- # Config-backed options default to "" so `workflows.kk-itc` and compiled defaults apply (0303);
11
- # the frozen `$work_dir/itc-options.json` is the single source every downstream node reads.
12
- topic: ""
13
- input_file: ""
14
- from_collect: ""
15
- topic_profile: ""
16
- run_date: ""
17
- work_dir: ""
18
- writer: ""
19
- playbook: ""
20
- rubric: "tech-accuracy"
21
- outline: ""
22
- outline_bullets_only: ""
23
- plan_only: "false"
24
- research: ""
25
- judge: ""
26
- auto: ""
27
- unslop: ""
28
- force: "false"
29
- max_revisions: ""
30
- source_locale: ""
31
- publish_targets: ""
32
- publish_preset: ""
33
- publish_live: ""
34
- cover_enabled: ""
35
- inline_images: ""
36
- seo_mode: ""
37
- agent: "inline"
38
- __runId: ""
39
- __definitionDigest: ""
40
-
41
- nodes:
42
- - id: prepare
43
- description: "Freeze the effective options (itc-prepare) bound to this run, then prepare the brief"
44
- action:
45
- kind: shell
46
- options:
47
- # The entry normally freezes itc-options.json before launch (a collected topic must be
48
- # chosen first); a direct launch freezes it here. A snapshot from another run is refused.
49
- command: |
50
- wd="${vars.work_dir}"; run="${vars.__runId}"; o="$wd/itc-options.json"
51
- test -n "$wd" || { echo "work_dir is required (derive it with kk stage run itc-prepare)" >&2; exit 1; }
52
- if [ ! -f "$o" ]; then
53
- req="$(mktemp)"
54
- jq -n --arg topic "${vars.topic}" --arg inputFile "${vars.input_file}" --arg fromCollect "${vars.from_collect}" \
55
- --arg topicProfile "${vars.topic_profile}" --arg runDate "${vars.run_date}" --arg workDir "$wd" --arg parentRunId "$run" \
56
- --arg writer "${vars.writer}" --arg playbook "${vars.playbook}" --arg sourceLocale "${vars.source_locale}" \
57
- --arg publishTargets "${vars.publish_targets}" --arg publishPreset "${vars.publish_preset}" --arg seo "${vars.seo_mode}" \
58
- --arg maxRevisions "${vars.max_revisions}" --arg research "${vars.research}" --arg judge "${vars.judge}" \
59
- --arg auto "${vars.auto}" --arg unslop "${vars.unslop}" --arg force "${vars.force}" --arg publishLive "${vars.publish_live}" \
60
- --arg coverEnabled "${vars.cover_enabled}" --arg inlineImages "${vars.inline_images}" \
61
- '$ARGS.named | with_entries(select(.value != ""))
62
- | with_entries(if (.key | IN("research","judge","auto","unslop","force","publishLive","coverEnabled","inlineImages"))
63
- then .value = (.value == "true") else . end)
64
- | if has("maxRevisions") then .maxRevisions |= tonumber else . end' > "$req" || { rm -f "$req"; exit 1; }
65
- kk stage run itc-prepare --request "$req" > /dev/null; rc=$?; rm -f "$req"; test "$rc" -eq 0 || exit 1
66
- fi
67
- test -f "$o" || { echo "a collected topic must be chosen before launch: run the entry's intake, then itc-prepare --chosen" >&2; exit 1; }
68
- pr=$(jq -r '.parentRunId' "$o")
69
- if [ "$pr" != "$run" ] && [ "${vars.force}" != "true" ]; then
70
- echo "$o belongs to run '$pr', not '$run'; pass force=true to adopt it" >&2; exit 1
71
- fi
72
- kind=$(jq -r '.sourceKind' "$o"); val=$(jq -r '.sourceValue' "$o")
73
- case "$kind" in
74
- input_file) kk stage run prepare-itc "$wd" "" "$val" "${vars.force}" ;;
75
- from_collect) kk stage run prepare-itc "$wd" "$(jq -r '.displayTitle' "$o")" "" "${vars.force}" ;;
76
- *) kk stage run prepare-itc "$wd" "$val" "" "${vars.force}" ;;
77
- esac
78
-
79
- - id: child-author
80
- description: "Run child authoring state machine (outline -> draft -> unslop -> review/judge)"
81
- dependsOn:
82
- - prepare
83
- action:
84
- kind: shell
85
- options:
86
- # The child id is derived from the parent before launch, so an interrupted parent queries
87
- # and continues the SAME child instead of starting a second one; a paused child stays a
88
- # distinct non-success for the parent until it is answered and reaches done. The child
89
- # runs as an owned process: a cancelled parent signals it and cancels its run.
90
- command: |
91
- cid="${vars.__runId}-author"
92
- v=$(jq -c --arg wd "${vars.work_dir}" --arg agent "${vars.agent}" --arg rubric "${vars.rubric}" --arg outline "${vars.outline}" \
93
- --arg ob "${vars.outline_bullets_only}" \
94
- --arg run "${vars.__runId}" --arg dd "${vars.__definitionDigest}" \
95
- '{work_dir:$wd, agent:$agent, rubric:$rubric, outline:$outline, writer:.writer, playbook:.playbook,
96
- outline_bullets_only:(if $ob == "true" then "true" else "false" end),
97
- auto:(.auto|tostring), unslop:(.unslop|tostring), judge:(.judge|tostring), max_revisions:(.maxRevisions|tostring),
98
- parent_run_id:$run, child_run_id:($run + "-author"), definition_digest:$dd, options_digest:.optionsDigest}' \
99
- "${vars.work_dir}/itc-options.json") || exit 1
100
- # Child definition: the running tree first (a project checkout shadows the install),
101
- # else the installed kk package root via its real path (the run's cwd may be anywhere).
102
- wf="plugins/kk/workflows/kk-itc-author.yaml"
103
- if [ ! -f "$wf" ]; then
104
- test -x "$(command -v kk)" || { echo "kk-itc-author.yaml not found from the cwd and no kk binary for fallback" >&2; exit 1; }
105
- kk_pkg="$(dirname "$(dirname "$(python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$(command -v kk)")")")"
106
- wf="$kk_pkg/plugins/kk/workflows/kk-itc-author.yaml"
107
- fi
108
- test -f "$wf" || { echo "child workflow not found at $wf (cwd tree or kk package root)" >&2; exit 1; }
109
- owned() {
110
- env -u SPUR_WORKFLOW_RUN_ACTIVE -u SPUR_EXPECTED_DEFINITION_DIGEST "$@" &
111
- pid=$!
112
- trap 'kill -TERM "$pid" 2>/dev/null; spur workflow cancel "$cid" >/dev/null 2>&1; exit 143' TERM INT HUP
113
- wait "$pid"; rc=$?
114
- trap - TERM INT HUP
115
- return "$rc"
116
- }
117
- st=$(spur workflow trace "$cid" --json 2>/dev/null | jq -r '.run.status // empty')
118
- case "$st" in
119
- done) exit 0 ;;
120
- paused) owned spur workflow continue "$cid" --yes ;;
121
- "") owned spur workflow run "$wf" --run-id "$cid" --vars "$v" ;;
122
- *) echo "child $cid is $st; refusing to relaunch it" >&2; exit 1 ;;
123
- esac
124
- st=$(spur workflow trace "$cid" --json 2>/dev/null | jq -r '.run.status // empty')
125
- if [ "$st" = paused ]; then echo "child $cid paused: answer it with spur workflow continue $cid, then resume this run" >&2; exit 1; fi
126
- test "$st" = done || { echo "child $cid ended $st" >&2; exit 1; }
127
-
128
- - id: verify-child-freeze
129
- description: "Verify child authoring completion receipt and freeze draft/outline digests"
130
- dependsOn:
131
- - child-author
132
- action:
133
- kind: shell
134
- options:
135
- command: >-
136
- kk stage run itc-author-complete "${vars.work_dir}" "${vars.__runId}"
137
-
138
- - id: illustrate
139
- description: "Optional cover/inline illustrations via kk:image-authoring — entered only when a spend var is on (R7)"
140
- dependsOn:
141
- - verify-child-freeze
142
- condition:
143
- kind: shell
144
- options:
145
- command: 'jq -e ".coverEnabled or .inlineImages" "${vars.work_dir}/itc-options.json" >/dev/null'
146
- action:
147
- kind: agent.run
148
- options:
149
- role: scribe
150
- agent: ${vars.agent}
151
- input: |
152
- Invoke the kk:image-authoring skill with KK_NONINTERACTIVE=1 and KK_IMAGE_AUTO_CONFIRM=1 (non-interactive, auto-confirm — the operator approved spend via the cover_enabled/inline_images vars).
153
- Create ${vars.work_dir}/4-illustrations/ and generate the cover illustration into it as cover.png (cover.jpg acceptable), sized for an article hero image.
154
- When inline_images=true, also generate inline figures for the draft's key sections as inline-<slug>.png in the same directory.
155
- Print each written path as the last line of stdout.
156
-
157
- - id: materialize-plan
158
- description: "Materialize content.json and resolve publication targets into publish-plan.json"
159
- dependsOn:
160
- - verify-child-freeze
161
- - illustrate
162
- action:
163
- kind: shell
164
- options:
165
- command: >-
166
- kk stage run itc-materialize-plan "${vars.work_dir}"
167
-
168
- - id: adapt
169
- description: "Prepare per-platform variant Content files via kk:article-adapt — runs only for adapt:true variants (R9)"
170
- dependsOn:
171
- - materialize-plan
172
- action:
173
- kind: agent.run
174
- options:
175
- role: scribe
176
- agent: ${vars.agent}
177
- input: |
178
- Invoke the kk:article-adapt skill.
179
- Read ${vars.work_dir}/4-publish/publish-plan.json and, for each entry in variants with adapt=true, read ${vars.work_dir}/4-publish/content.json and write the variant Content file to ${vars.work_dir}/4-publish/<variant.file>.
180
- Apply the plan's variant limits and translate title and body into the variant's locale. Never set metadata.published; the publishing states set switches.
181
- Print each written variant file path as the last line of stdout.
182
-
183
- - id: adapt-verify
184
- description: "Verify adapted variant content files"
185
- dependsOn:
186
- - adapt
187
- action:
188
- kind: shell
189
- options:
190
- command: >-
191
- test -f "${vars.work_dir}/4-publish/publish-plan.json" || exit 0;
192
- kk stage run itc-adapt-verify "${vars.work_dir}"
193
-
194
- - id: check-targets
195
- description: "Check readiness probes for plannable publish targets"
196
- dependsOn:
197
- - materialize-plan
198
- action:
199
- kind: shell
200
- options:
201
- command: >-
202
- test -f "${vars.work_dir}/4-publish/publish-plan.json" || exit 0;
203
- kk stage run itc-check-targets "${vars.work_dir}"
204
-
205
- - id: send-confirm
206
- description: >-
207
- Operator approval of a send: `pause: true` stops the run and RESUME is the approval
208
- (no action); cancelling is the rejection. Entered for any plan with targets — a draft
209
- still creates real remote drafts, not only a LIVE send — and skipped for empty plans
210
- and plan_only runs (the plan preview is the stop point).
211
- dependsOn:
212
- - adapt-verify
213
- - check-targets
214
- pause: true
215
- condition:
216
- kind: shell
217
- options:
218
- # Item 5: draft-only plans with targets also confirm (draft saves are real remote
219
- # artifacts). plan_only runs stop at the plan instead of pausing for a no-op confirm.
220
- command: 'jq -e "((.targets // []) | length) > 0" "${vars.work_dir}/4-publish/publish-plan.json" >/dev/null 2>&1 && test "${vars.plan_only}" != "true"'
221
-
222
- - id: fanout-send
223
- description: "Dispatch target payloads via executor fan-out and record receipts"
224
- dependsOn:
225
- - send-confirm
226
- # plan_only stops after the confirmed plan: no sends, no recovery, no settle.
227
- condition:
228
- kind: shell
229
- options:
230
- command: 'test "${vars.plan_only}" != "true"'
231
- action:
232
- kind: shell
233
- options:
234
- command: >-
235
- test -f "${vars.work_dir}/4-publish/publish-plan.json" || exit 0;
236
- kk stage run itc-send-targets "${vars.work_dir}"
237
-
238
- - id: fanout-recovery
239
- description: "Retry safe effect-none target failures once within budget"
240
- dependsOn:
241
- - fanout-send
242
- condition:
243
- kind: shell
244
- options:
245
- command: 'test "${vars.plan_only}" != "true"'
246
- action:
247
- kind: shell
248
- options:
249
- command: >-
250
- test -f "${vars.work_dir}/4-publish/publish-plan.json" || exit 0;
251
- kk stage run itc-send-targets "${vars.work_dir}" --retry
252
-
253
- - id: reconcile-settle
254
- description: "Reconcile target receipts and settle store selection"
255
- dependsOn:
256
- - fanout-recovery
257
- # plan_only left no receipts to reconcile; with targets present the stage would fail on
258
- # their absence, so the plan preview ends the run before settle (report still runs).
259
- condition:
260
- kind: shell
261
- options:
262
- command: 'test "${vars.plan_only}" != "true"'
263
- action:
264
- kind: shell
265
- options:
266
- command: >-
267
- kk stage run itc-reconcile-receipts "${vars.work_dir}"
268
-
269
- - id: seo
270
- description: "Export SEO prepublish request and published pages handoffs"
271
- dependsOn:
272
- - verify-child-freeze
273
- action:
274
- kind: shell
275
- options:
276
- command: >-
277
- kk stage run itc-export-seo "${vars.work_dir}" "$(jq -r '.seo' "${vars.work_dir}/itc-options.json")"
278
-
279
- - id: report
280
- description: "Produce final run report summary"
281
- # Mandatory freeze plus every branch: a skipped optional branch still satisfies the edge,
282
- # so an all-skipped publication reports, but a report never races an unfinished send.
283
- dependsOn:
284
- - verify-child-freeze
285
- - reconcile-settle
286
- - seo
287
- action:
288
- kind: shell
289
- options:
290
- command: >-
291
- kk stage run itc-report-summary "${vars.work_dir}" "$(jq -r '.maxRevisions' "${vars.work_dir}/itc-options.json")"