@zenaigc/zenmcp 0.1.9 → 0.1.11

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 (50) hide show
  1. package/INSTALL.md +114 -102
  2. package/dist/src/assets/index.js +1 -1
  3. package/dist/src/assets/model-library.js +157 -16
  4. package/dist/src/core/schema.js +1 -0
  5. package/dist/src/doctor.js +0 -0
  6. package/dist/src/effects/index.js +54 -13
  7. package/dist/src/engine/card.js +5 -2
  8. package/dist/src/engine/direct.js +2 -0
  9. package/dist/src/engine/generate.js +15 -2
  10. package/dist/src/engine/steps.js +84 -9
  11. package/dist/src/inspect/index.js +51 -12
  12. package/dist/src/mcp/guidance.js +1 -1
  13. package/dist/src/mcp/server.js +247 -19
  14. package/dist/src/timeline/conform.js +19 -5
  15. package/dist/src/timeline/cuts.js +13 -13
  16. package/dist/src/timeline/diff.js +25 -7
  17. package/dist/src/timeline/index.js +2 -2
  18. package/dist/templates/pop-title/render.js +28 -8
  19. package/package.json +1 -1
  20. package/skills/zenmcp/SKILL.md +77 -46
  21. package/skills/zenmcp/references/00-model-card.md +165 -0
  22. package/skills/zenmcp/references/01-dissect-and-checkpoints.md +68 -0
  23. package/skills/zenmcp/references/02-character-and-tryon.md +63 -0
  24. package/skills/zenmcp/references/03-wan3-camera-and-audio.md +43 -0
  25. package/skills/zenmcp/references/04-hyperframes-effects.md +61 -0
  26. package/skills/zenmcp/references/05-interaction-and-media.md +203 -0
  27. package/skills/zenmcp/references/06-work-delivery.md +29 -0
  28. package/skills/zenmcp/scripts/build-contact-sheet.mjs +179 -0
  29. package/skills/zenmcp/scripts/build-dissect-report.mjs +1233 -0
  30. package/skills/zenmcp/scripts/build-height-ruler.mjs +49 -0
  31. package/skills/zenmcp/scripts/build-side-by-side.mjs +56 -0
  32. package/skills/zenmcp/widgets/fixtures/zenmcp-budget-confirm.readonly.json +31 -0
  33. package/skills/zenmcp/widgets/zenmcp-account/template.json +1 -1
  34. package/skills/zenmcp/widgets/zenmcp-account/widget.html +8 -10
  35. package/skills/zenmcp/widgets/zenmcp-budget-confirm/template.json +5 -2
  36. package/skills/zenmcp/widgets/zenmcp-budget-confirm/widget.html +50 -13
  37. package/skills/zenmcp/widgets/zenmcp-install-checklist/template.json +1 -1
  38. package/skills/zenmcp/widgets/zenmcp-install-checklist/widget.html +18 -12
  39. package/skills/zenmcp/widgets/zenmcp-spend-confirm/template.json +13 -83
  40. package/skills/zenmcp/widgets/zenmcp-spend-confirm/widget.html +88 -65
  41. package/dist/src/setup/targets.js +0 -314
  42. package/skills/zenmcp/widgets/fixtures/zenmcp-asset-roles.json +0 -24
  43. package/skills/zenmcp/widgets/fixtures/zenmcp-model-picker.json +0 -25
  44. package/skills/zenmcp/widgets/fixtures/zenmcp-trim-range.json +0 -19
  45. package/skills/zenmcp/widgets/zenmcp-asset-roles/template.json +0 -54
  46. package/skills/zenmcp/widgets/zenmcp-asset-roles/widget.html +0 -73
  47. package/skills/zenmcp/widgets/zenmcp-model-picker/template.json +0 -31
  48. package/skills/zenmcp/widgets/zenmcp-model-picker/widget.html +0 -28
  49. package/skills/zenmcp/widgets/zenmcp-trim-range/template.json +0 -53
  50. package/skills/zenmcp/widgets/zenmcp-trim-range/widget.html +0 -52
@@ -38,9 +38,12 @@ export function planCard(input, planData, issues, planDigest) {
38
38
  lines.push('');
39
39
  }
40
40
  lines.push('## 输出', '', `时长:${output.duration_seconds} 秒;分辨率:${output.resolution};比例:${cell(output.ratio)}。`, `参考:${cell(filename(input.reference))}。音源:${input.audio ? `用户音频(${cell(filename(input.audio))})` : source.has_audio ? `参考音频(${cell(filename(input.reference))})` : '静音'}。`, '', '## 预算', '', '| 项目 | 积分 |', '| --- | --- |');
41
+ const opLabels = { generate: '视频生成', tts: '语音合成', image: '图像生成' };
42
+ const currencyLabels = { ZEN_CREDIT: '平台积分', CNY: '人民币' };
41
43
  for (const item of planData.lineItems)
42
- lines.push(`| ${cell(item.operation)} | ${item.credits} |`);
43
- lines.push('', `重试预留上限:${planData.retryReserveCredits} 积分,仅在实际重试时使用,不是已收取费用。`, `**总预算上限:${planData.totalCredits} 积分(${cell(planData.currency)})**`, '');
44
+ lines.push(`| ${cell(opLabels[item.operation] ?? item.operation)} | ${item.credits} |`);
45
+ const currencyText = currencyLabels[String(planData.currency ?? '')] ?? cell(planData.currency);
46
+ lines.push('', `重试预留上限:${planData.retryReserveCredits} 积分,仅在实际重试时使用,不是已收取费用。`, `**总预算上限:${planData.totalCredits} 积分(${currencyText})**`, '');
44
47
  if (planDigest)
45
48
  lines.push(`计划摘要:\`${cell(planDigest)}\``, '');
46
49
  if (issues.length)
@@ -147,6 +147,8 @@ function parameters(cap, values) {
147
147
  for (const p of cap.params) {
148
148
  if (params[p.key] === undefined && p.default !== undefined)
149
149
  params[p.key] = p.default;
150
+ if (p.key === 'quality' && params[p.key] === 'med' && p.options?.some(o => o.value === 'medium') && !p.options.some(o => o.value === 'med'))
151
+ params[p.key] = 'medium';
150
152
  const v = params[p.key];
151
153
  if (v === undefined) {
152
154
  if (p.required)
@@ -9,7 +9,9 @@ import { GatewayError, owns } from '../gateway/index.js';
9
9
  /** Compare parameter objects independently of catalog and cloud asset IDs. */
10
10
  export const same = (body) => JSON.stringify(Object.fromEntries(Object.entries(body).sort(([a], [b]) => a.localeCompare(b))));
11
11
  export function mapRequest(compiled, catalog, slots) {
12
- const capability = catalog.capabilities.find(c => c.model === compiled.model && c.medium === 'video');
12
+ const capability = (compiled.model === 'wan3.0-video'
13
+ ? catalog.capabilities.find(c => c.medium === 'video' && c.id === 'wan3.0-media')
14
+ : undefined) ?? catalog.capabilities.find(c => c.model === compiled.model && c.medium === 'video');
13
15
  if (!capability)
14
16
  throw new Error(`capability_not_available:catalog 未列出 ${compiled.model},不能生成或报价。`);
15
17
  const assigned = new Set();
@@ -194,7 +196,18 @@ export async function pollAttempt(runner, attempt, poll = { intervalMs: 5000, ti
194
196
  const deadline = Date.now() + poll.timeoutMs;
195
197
  while (attempt.state === 'submitted' && Date.now() < deadline) {
196
198
  await new Promise(resolve => setTimeout(resolve, Math.min(poll.intervalMs, Math.max(0, deadline - Date.now()))));
197
- attempt = await runner.refresh(attempt.idempotency_key);
199
+ try {
200
+ attempt = await runner.refresh(attempt.idempotency_key);
201
+ }
202
+ catch (error) {
203
+ if (error instanceof GatewayError && error.status === 429 && Date.now() < deadline) {
204
+ const extra = Math.min(error.retryAfterMs ?? poll.intervalMs * 2, Math.max(0, deadline - Date.now()));
205
+ if (extra > 0)
206
+ await new Promise(resolve => setTimeout(resolve, extra));
207
+ continue;
208
+ }
209
+ throw error;
210
+ }
198
211
  }
199
212
  return attempt;
200
213
  }
@@ -3,7 +3,7 @@ import { resolve, join } from 'node:path';
3
3
  import { randomInt, randomUUID } from 'node:crypto';
4
4
  import { parseJob, cutsOf, sha256File, sha256String } from '../core/index.js';
5
5
  import { FileAttemptStore, PaidRunner, LocalBudget, scrub } from '../gateway/index.js';
6
- import { probe, frameDiffs, detectCuts, locateCuts, conform } from '../timeline/index.js';
6
+ import { probe, frameDiffSeries, frameDiffs, detectCuts, locateCuts, conform, timelineParams } from '../timeline/index.js';
7
7
  import { WAN3_LIMITS } from '../models/wan3/limits.js';
8
8
  import { compileWan3 } from '../models/wan3/index.js';
9
9
  import { inspectGenerated, inspectConformed, inspectComposited, inspectExport, buildReport } from '../inspect/index.js';
@@ -33,10 +33,82 @@ export function hash(value) {
33
33
  const stable = (v) => Array.isArray(v) ? v.map(stable) : v && typeof v === 'object' ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => [k, stable(v)])) : v;
34
34
  return sha256String(JSON.stringify(stable(value)));
35
35
  }
36
+ const MIN_CUT_CHANGED_FRACTION = 0.06;
37
+ const FLASH_EDGE_MAX_FRAMES = 6;
38
+ function percentile(sorted, q) {
39
+ if (!sorted.length)
40
+ return 0;
41
+ const idx = Math.min(sorted.length - 1, Math.max(0, Math.floor(sorted.length * q)));
42
+ return sorted[idx] ?? 0;
43
+ }
36
44
  export async function analyzeReference(path) {
37
45
  const source = { ...await probe(path), sha256: await sha256File(path) };
38
- const cuts = detectCuts(await frameDiffs(path));
39
- return { source, cuts, note: '仅软件切点检测,阈值待校准;标签、绑定、定稿属性与语义需 Agent/用户确认。' };
46
+ const series = await frameDiffSeries(path);
47
+ const rawCuts = detectCuts(series.diffs, timelineParams);
48
+ const cuts = detectCuts(series.diffs, timelineParams, {
49
+ changedFractions: series.changed_fractions,
50
+ minChangedFraction: MIN_CUT_CHANGED_FRACTION,
51
+ });
52
+ const keptStarts = new Set(cuts.map(c => c.start));
53
+ const filteredPopupSpikes = rawCuts.filter(c => !keptStarts.has(c.start)).map(c => c.frame);
54
+ const headCut = source.frames > 15 ? cuts.find(c => c.start <= FLASH_EDGE_MAX_FRAMES) : undefined;
55
+ const tailCut = source.frames > 15 ? [...cuts].reverse().find(c => source.frames - c.start <= FLASH_EDGE_MAX_FRAMES && c.start > (headCut?.frame ?? 0)) : undefined;
56
+ const headFlashEndFrame = headCut ? headCut.frame : 0;
57
+ const tailFlashStartFrame = tailCut ? tailCut.start : null;
58
+ const cutNeighborhood = new Set();
59
+ for (const c of rawCuts) {
60
+ for (let k = Math.max(0, c.start - 2); k <= Math.min(series.diffs.length - 1, c.frame); k++)
61
+ cutNeighborhood.add(k);
62
+ }
63
+ const nonCutDiffs = [...series.diffs].filter((_, i) => !cutNeighborhood.has(i)).sort((a, b) => a - b);
64
+ const medianDiff = Number(percentile(nonCutDiffs, 0.5).toFixed(2));
65
+ const p90Diff = Number(percentile(nonCutDiffs, 0.9).toFixed(2));
66
+ const cameraStability = medianDiff <= 4 && p90Diff <= 10 ? 'fixed_likely' : (medianDiff > 5 || p90Diff > 12 ? 'moving_suspect' : 'moderate');
67
+ const warnings = [];
68
+ if (headFlashEndFrame > 0)
69
+ warnings.push(`检测到片头第 0–${headFlashEndFrame} 帧疑似静止封面闪帧,建议先用 trim_media 裁除后再拆解生成。`);
70
+ if (tailFlashStartFrame !== null)
71
+ warnings.push(`检测到片尾第 ${tailFlashStartFrame}–${source.frames} 帧疑似尾帧贴片/黑场,建议裁至第 ${tailFlashStartFrame} 帧。`);
72
+ if (filteredPopupSpikes.length > 0)
73
+ warnings.push(`已自动过滤 ${filteredPopupSpikes.length} 处小面积局部突变(帧 ${filteredPopupSpikes.join(', ')},常见于弹出花字或贴纸)。`);
74
+ if (cameraStability === 'moving_suspect')
75
+ warnings.push(`镜头内画面连续变化偏高(median=${medianDiff}, p90=${p90Diff}),疑似存在手持运镜、推拉或跨场景运动,请结合关键帧核实是否超出固定机位第一类边界。`);
76
+ const fpsValue = source.fps.num / source.fps.den;
77
+ const recommendedTrim = (headFlashEndFrame > 0 || tailFlashStartFrame !== null)
78
+ ? {
79
+ start_frame: headFlashEndFrame,
80
+ end_frame: tailFlashStartFrame ?? source.frames,
81
+ start_seconds: Number((headFlashEndFrame / fpsValue).toFixed(3)),
82
+ end_seconds: Number(((tailFlashStartFrame ?? source.frames) / fpsValue).toFixed(3)),
83
+ }
84
+ : null;
85
+ const hints = {
86
+ head_flash_end_frame: headFlashEndFrame,
87
+ tail_flash_start_frame: tailFlashStartFrame,
88
+ recommended_trim: recommendedTrim,
89
+ filtered_popup_spikes: filteredPopupSpikes,
90
+ camera_stability: cameraStability,
91
+ motion_baseline: { median_diff: medianDiff, p90_diff: p90Diff },
92
+ warnings,
93
+ };
94
+ return {
95
+ source,
96
+ cuts,
97
+ hints,
98
+ note: '仅软件切点与运动基线检测;标签、绑定、定稿属性与语义需 Agent/用户结合关键帧确认。' + (warnings.length ? ` 提示:${warnings.join(' ')}` : ''),
99
+ };
100
+ }
101
+ function locateGeneratedCuts(diffs, expected) {
102
+ const located = locateCuts(diffs, expected);
103
+ if (!expected.length || located.every(c => c.status === 'found'))
104
+ return located;
105
+ const bounds = [0, ...expected, diffs.length + 1];
106
+ const shortest = Math.min(...bounds.slice(1).map((end, i) => end - bounds[i]));
107
+ const widened = Math.min(6, Math.floor(shortest / 2));
108
+ if (widened <= timelineParams.locateWindow)
109
+ return located;
110
+ const retry = locateCuts(diffs, expected, { ...timelineParams, locateWindow: widened });
111
+ return retry.filter(c => c.status === 'found').length > located.filter(c => c.status === 'found').length ? retry : located;
40
112
  }
41
113
  export function draftJob(analysis) {
42
114
  const { source, cuts } = analysis;
@@ -59,7 +131,7 @@ function compilePlan(input) {
59
131
  const attributes = Object.fromEntries(input.job.assets.filter(a => a.role === 'product').map(a => [a.id, a.attributes ?? '']));
60
132
  const motion = input.job.assets.find(a => a.role === 'motion_ref');
61
133
  const source = input.job.storyboard.source;
62
- return { job: input.job, attributes, motion_ref: motion?.id ?? '', motion_ref_seconds: source.frames * source.fps.den / source.fps.num, output: input.output };
134
+ return { job: input.job, attributes, ...(input.actions ? { actions: input.actions } : {}), motion_ref: motion?.id ?? '', motion_ref_seconds: source.frames * source.fps.den / source.fps.num, output: input.output };
63
135
  }
64
136
  function compiled(input) {
65
137
  const result = compileWan3(compilePlan(input));
@@ -74,6 +146,7 @@ export function computePlanDigest(input) {
74
146
  job: input.job,
75
147
  output: outputWithoutSeed,
76
148
  slots: input.slots ?? {},
149
+ ...(input.actions ? { actions: input.actions } : {}),
77
150
  retryReserveCredits: input.retryReserveCredits,
78
151
  hasUserAudio: Boolean(input.audio),
79
152
  });
@@ -284,8 +357,9 @@ export class Engine {
284
357
  case 'inspect': return out({ checks: await inspectGenerated(job, path('generate')) });
285
358
  case 'conform': {
286
359
  const target = await file('conformed.mp4');
287
- await conform(path('generate'), { actual_cuts: locateCuts(await frameDiffs(path('generate')), cutsOf(job.storyboard)), target_cuts: cutsOf(job.storyboard), target_frames: job.storyboard.source.frames }, target);
288
- return out({ path: target, checks: await inspectConformed(job, target) }, [target]);
360
+ const expectedCuts = cutsOf(job.storyboard);
361
+ const conformReport = await conform(path('generate'), { actual_cuts: locateGeneratedCuts(await frameDiffs(path('generate')), expectedCuts), target_cuts: expectedCuts, target_frames: job.storyboard.source.frames }, target);
362
+ return out({ path: target, segments: conformReport.segments, checks: await inspectConformed(job, target, { conformSegments: conformReport.segments }) }, [target]);
289
363
  }
290
364
  case 'effects': {
291
365
  if (!job.storyboard.effects.length)
@@ -307,8 +381,8 @@ export class Engine {
307
381
  return out({ path: target, checks: await inspectExport(job, target) }, [target]);
308
382
  }
309
383
  case 'report': {
310
- const checks = ['inspect', 'conform', 'effects', 'export'].flatMap(s => (artifact(s).checks ?? []));
311
- checks.push({ check: 'audio_source', check_version: 'engine-v1', status: artifact('mix').silent ? 'not_applicable' : 'pass', evidence: null, note: artifact('mix').note });
384
+ const checks = ['inspect', 'conform', 'effects', 'export'].flatMap(stage => (artifact(stage).checks ?? []).map(c => ({ ...c, stage })));
385
+ checks.push({ stage: 'mix', check: 'audio_source', check_version: 'engine-v1', status: artifact('mix').silent ? 'not_applicable' : 'pass', evidence: null, note: artifact('mix').note });
312
386
  const result = await buildReport(job, checks, path('export'), resolve(dir, 'report'), { referencePath: input.reference, assetRoot: dir });
313
387
  return out({ ...result, markdown: await readFile(result.report_md, 'utf8'), path: path('export') }, [result.report_json, result.report_md, ...result.cards]);
314
388
  }
@@ -374,7 +448,8 @@ export class Engine {
374
448
  const local = step.name === 'analyze' ? { source: input.job.storyboard.source, reference: await sha256File(input.reference) }
375
449
  : step.name === 'plan' ? { job: input.job, output: input.output, catalog: c.catalog, slots: input.slots, reserve: input.retryReserveCredits }
376
450
  : step.name === 'mix' ? { audio: input.audio ? await sha256File(input.audio) : null }
377
- : step.name === 'effects' ? { renderer: renderer?.version } : {};
451
+ : step.name === 'effects' ? { renderer: renderer?.version }
452
+ : step.name === 'report' ? { reportVersion: 2 } : {};
378
453
  if (step.name === 'prepare')
379
454
  Object.assign(local, { assets: await Promise.all(input.job.assets.map(async (a) => [a.id, await sha256File(await child(dir, ...a.path.split('/')))])) });
380
455
  const key = hash({ chain, local, revision: state.revisions[step.name] ?? 0, version: 1 });
@@ -1,7 +1,7 @@
1
1
  import { mkdir, writeFile, rm } from "node:fs/promises";
2
2
  import { resolve, join } from "node:path";
3
3
  import { cutsOf } from "../core/schema.js";
4
- import { probe, frameDiffs, locateCuts, detectCuts, timelineParams } from "../timeline/index.js";
4
+ import { probe, frameDiffs, locateCuts, detectCuts, timelineParams, CONFORM_MIN_NORMAL_RATIO, CONFORM_MAX_NORMAL_RATIO } from "../timeline/index.js";
5
5
  import { command, frames, still } from "./media.js";
6
6
  const VERSION = "inspect-v1-pending-calibration";
7
7
  function result(check, status, evidence, note, segment) {
@@ -109,7 +109,22 @@ export async function inspectConformed(job, artifactPath, opts = {}) {
109
109
  catch (e) {
110
110
  checks.push(error("frame_count", e));
111
111
  }
112
- return [...checks, ...await cutChecks(job, artifactPath, true, opts)];
112
+ const cuts = await cutChecks(job, artifactPath, true, opts);
113
+ if (opts.conformSegments?.length) {
114
+ const abnormal = opts.conformSegments
115
+ .map((seg, idx) => ({ seg, id: job.storyboard.segments[idx]?.id ?? `s${idx + 1}` }))
116
+ .filter(({ seg }) => seg.speed_warning !== undefined);
117
+ if (!abnormal.length) {
118
+ checks.push(result("segment_speed", "pass", { min_normal_ratio: CONFORM_MIN_NORMAL_RATIO, max_normal_ratio: CONFORM_MAX_NORMAL_RATIO, ratios: opts.conformSegments.map(s => Number(s.ratio.toFixed(4))) }, "全部段落伸缩倍率处于正常区间 [0.70, 1.45]"));
119
+ }
120
+ else {
121
+ for (const { seg, id } of abnormal) {
122
+ const kind = seg.speed_warning === "slowdown" ? "慢放幅度偏大" : "快进压缩偏大";
123
+ checks.push(result("segment_speed", "suspect", { ...seg, min_normal_ratio: CONFORM_MIN_NORMAL_RATIO, max_normal_ratio: CONFORM_MAX_NORMAL_RATIO }, `${kind}(ratio=${seg.ratio.toFixed(2)}),建议人工核查该镜头动作是否卡顿或过快`, id));
124
+ }
125
+ }
126
+ }
127
+ return [...checks, ...cuts];
113
128
  }
114
129
  export async function inspectComposited(job, basePath, compositePath, opts = {}) {
115
130
  const checks = [];
@@ -251,11 +266,38 @@ export async function buildReport(job, results, artifactPath, outDir, opts = {})
251
266
  cardChecks.push({ ...error("comparison_card", e), segment: s.id });
252
267
  }
253
268
  }
254
- const all = [...results, ...cardChecks], cov = coverage(job, all);
255
- const counts = Object.fromEntries(["pass", "fail", "suspect", "not_applicable", "unsupported", "error"].map(s => [s, all.filter(c => c.status === s).length]));
256
- const lines = ["# 结论摘要", `软件检查统计:${JSON.stringify(counts)}。pass 仅代表对应软件检查已执行;报告不阻止导出。`, "服装、身份、局部语义需人工看。所有启发式阈值待校准。", "", "## 问题(段落与证据)"];
257
- for (const c of all.filter(c => c.status === "fail" || c.status === "suspect"))
258
- lines.push(`- 段 ${c.segment ?? "全片"} / ${c.check}: ${c.status};${c.note ?? ""};证据 ${JSON.stringify(c.evidence)}`);
269
+ const rendered = renderReport(job, [...results, ...cardChecks.map(c => ({ ...c, stage: "report" }))], artifactPath, cards);
270
+ const report_json = resolve(outDir, "report.json"), report_md = join(resolve(outDir), "report.md");
271
+ await writeFile(report_json, JSON.stringify(rendered.data, null, 2));
272
+ await writeFile(report_md, rendered.markdown);
273
+ return { report_json, report_md, cards };
274
+ }
275
+ /** Render saved checks without rerunning media inspection or comparison cards. */
276
+ export function renderReport(job, all, artifactPath, cards) {
277
+ const stages = { inspect: "生成原片", conform: "后期校正", effects: "后期特效", mix: "音频混合", export: "最终导出", report: "报告对照卡" };
278
+ const order = Object.keys(stages);
279
+ const label = (c) => c.stage ? stages[c.stage] : "未标记阶段";
280
+ // Only a comparable, conclusive later check supersedes earlier evidence.
281
+ const latest = (c) => all.filter(n => c.stage && n.stage && order.indexOf(n.stage) > order.indexOf(c.stage)
282
+ && n.check === c.check && n.segment === c.segment && n.requirement === c.requirement
283
+ && ["pass", "fail", "suspect"].includes(n.status)).sort((a, b) => order.indexOf(b.stage) - order.indexOf(a.stage))[0];
284
+ const current = all.filter(c => !latest(c)), cov = coverage(job, current);
285
+ const count = (checks) => Object.fromEntries(["pass", "fail", "suspect", "not_applicable", "unsupported", "error"].map(s => [s, checks.filter(c => c.status === s).length]));
286
+ const counts = count(current);
287
+ const lines = ["# 结论摘要", `汇总检查统计(同项采用后续复检结果,未复检项保留原阶段结果):${JSON.stringify(counts)}。pass 仅代表对应软件检查已执行;报告不阻止导出。`, "服装、身份、局部语义需人工看。所有启发式阈值待校准。", "", "## 分阶段检查统计"];
288
+ for (const stage of order) {
289
+ const checks = all.filter(c => c.stage === stage);
290
+ if (checks.length)
291
+ lines.push(`- ${stages[stage]}(${stage}):${JSON.stringify(count(checks))}`);
292
+ }
293
+ lines.push("", "## 当前问题(段落与证据)");
294
+ for (const c of current.filter(c => c.status === "fail" || c.status === "suspect"))
295
+ lines.push(`- [${label(c)}] 段 ${c.segment ?? "全片"} / ${c.check}: ${c.status};${c.note ?? ""};证据 ${JSON.stringify(c.evidence)}`);
296
+ lines.push("", "## 历史偏差(保留原始检查证据)");
297
+ for (const c of all.filter(c => (c.status === "fail" || c.status === "suspect") && latest(c))) {
298
+ const next = latest(c);
299
+ lines.push(`- [${label(c)}] 段 ${c.segment ?? "全片"} / ${c.check}: ${c.status};${c.note ?? ""};原始证据 ${JSON.stringify(c.evidence)};[${label(next)}] ${next.status === "pass" ? "已修复(该项复检通过)" : "复检仍有偏差"};复检证据 ${JSON.stringify(next.evidence)}`);
300
+ }
259
301
  for (const level of ["minimum", "detail"]) {
260
302
  lines.push("", `## ${level === "minimum" ? "最低要求" : "细节要求"}:需人工看与覆盖情况`);
261
303
  for (const r of job.requirements.filter(r => r.level === level)) {
@@ -265,12 +307,9 @@ export async function buildReport(job, results, artifactPath, outDir, opts = {})
265
307
  }
266
308
  lines.push("", "## 未检查项");
267
309
  for (const c of all.filter(c => ["not_applicable", "unsupported", "error"].includes(c.status)))
268
- lines.push(`- 段 ${c.segment ?? "全片"} / ${c.check}: ${c.status};${c.note ?? ""};${JSON.stringify(c.evidence)}`);
310
+ lines.push(`- [${label(c)}] 段 ${c.segment ?? "全片"} / ${c.check}: ${c.status};${c.note ?? ""};${JSON.stringify(c.evidence)}`);
269
311
  lines.push("", "## 逐段对照卡", "列顺序:原始参考、目标素材、生成帧。代表帧不能覆盖整段语义。");
270
312
  for (const card of cards)
271
313
  lines.push(`![对照卡](<${card}>)`);
272
- const report_json = resolve(outDir, "report.json"), report_md = join(resolve(outDir), "report.md");
273
- await writeFile(report_json, JSON.stringify({ job_id: job.job_id, artifactPath, conclusion: counts, results: all, coverage: cov, cards, blocks_export: false, pending_calibration: true }, null, 2));
274
- await writeFile(report_md, lines.join("\n") + "\n");
275
- return { report_json, report_md, cards };
314
+ return { markdown: lines.join("\n") + "\n", data: { job_id: job.job_id, artifactPath, conclusion: counts, results: all, coverage: cov, cards, blocks_export: false, pending_calibration: true } };
276
315
  }
@@ -1,5 +1,5 @@
1
1
  /** 固定展示文案:外部错误原文脱敏之后才可附加,不能插入外部详情。 */
2
- export const ACCOUNT_URL = 'https://api.zenaigc.com';
2
+ export const ACCOUNT_URL = 'https://zenaigc.com/console';
3
3
  export const POLL_AFTER_SECONDS = 15;
4
4
  // 展示阈值暂定,仅提醒,不参与预算或执行判断。
5
5
  export const LARGE_AMOUNT_CREDITS = 100;