@tbox.cn/app-template-agent 1.0.0-alpha.19 → 1.0.0-alpha.21

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 (47) hide show
  1. package/._.ignore +0 -0
  2. package/.ignore +9 -0
  3. package/.tbox/app.json +1 -1
  4. package/.tbox/cache/._.eslintcache +0 -0
  5. package/.tbox/cache/.eslintcache +1 -0
  6. package/.tbox/cache/apps-client.tsbuildinfo +1 -1
  7. package/.tbox/cache/apps-server.tsbuildinfo +1 -1
  8. package/.tbox/cache/packages-agent-ui-kit.tsbuildinfo +1 -1
  9. package/.tbox/default-modules.json +1 -1
  10. package/.tbox/miniapp-containers.json +1 -1
  11. package/AGENTS.md +1 -1
  12. package/apps/client/scripts/check-evidence.mjs +61 -15
  13. package/apps/client/scripts/experience-checks.mjs +50 -5
  14. package/apps/client/scripts/in-process-checks.mjs +52 -2
  15. package/apps/client/scripts/lib/._tool-cards-static.mjs +0 -0
  16. package/apps/client/scripts/lib/tool-cards-static.mjs +91 -0
  17. package/apps/client/scripts/probe-checks.mjs +1 -0
  18. package/docs/agent/card.md +1 -1
  19. package/docs/agent/errors.md +4 -1
  20. package/docs/agent/kit.md +4 -3
  21. package/docs/agent/shell.md +34 -3
  22. package/docs/agent/style.md +3 -3
  23. package/package.json +5 -4
  24. package/packages/agent-ui-kit/catalog.json +16 -3
  25. package/packages/agent-ui-kit/package.json +1 -1
  26. package/packages/agent-ui-kit/src/ChatPage.tsx +48 -11
  27. package/packages/agent-ui-kit/src/card/primitives.tsx +38 -17
  28. package/packages/agent-ui-kit/src/card/view-card.tsx +4 -1
  29. package/packages/agent-ui-kit/src/chat-config.test.ts +19 -1
  30. package/packages/agent-ui-kit/src/chat-config.ts +23 -1
  31. package/packages/agent-ui-kit/src/components/QuickCommands/index.test.tsx +55 -0
  32. package/packages/agent-ui-kit/src/components/QuickCommands/index.tsx +72 -11
  33. package/packages/agent-ui-kit/src/components/StarterQuestions/._index.test.tsx +0 -0
  34. package/packages/agent-ui-kit/src/components/StarterQuestions/._index.tsx +0 -0
  35. package/packages/agent-ui-kit/src/components/StarterQuestions/index.test.tsx +115 -0
  36. package/packages/agent-ui-kit/src/components/StarterQuestions/index.tsx +61 -0
  37. package/packages/agent-ui-kit/src/contract.test.tsx +13 -1
  38. package/packages/agent-ui-kit/src/shell.contract.json +9 -2
  39. package/packages/agent-ui-kit/src/shell.test.ts +1 -0
  40. package/packages/agent-ui-kit/src/theme/base.css +10 -5
  41. package/pnpm-lock.template.yaml +94 -94
  42. package/pnpm-workspace.template.yaml +11 -11
  43. package/profiles/mall.json +5 -3
  44. package/scripts/check-fast.mjs +3 -1
  45. package/scripts/checks.json +42 -3
  46. package/scripts/shell-probe.mjs +82 -5
  47. package/scripts/storyboard.mjs +37 -0
@@ -44,17 +44,17 @@ catalog:
44
44
  ws: 8.21.3
45
45
  "@types/ws": 8.18.1
46
46
  "@tbox.cn/agent-plugin": 0.1.0
47
- "@tbox.cn/app-sdk-core": 1.0.0-alpha.19
48
- "@tbox.cn/app-sdk-client": 1.0.0-alpha.19
49
- "@tbox.cn/app-sdk-server": 1.0.0-alpha.19
50
- "@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.19
51
- "@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.19
52
- "@tbox.cn/app-contracts": 1.0.0-alpha.19
53
- "@tbox.cn/app-contracts-mall": 1.0.0-alpha.19
54
- "@tbox.cn/app-theme-tbox": 1.0.0-alpha.19
55
- "@tbox.cn/app-build": 1.0.0-alpha.19
56
- "@tbox.cn/app-agent-ui-kit": 1.0.0-alpha.19
57
- "@tbox.cn/app-cli": 1.0.0-alpha.19
47
+ "@tbox.cn/app-sdk-core": 1.0.0-alpha.21
48
+ "@tbox.cn/app-sdk-client": 1.0.0-alpha.21
49
+ "@tbox.cn/app-sdk-server": 1.0.0-alpha.21
50
+ "@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.21
51
+ "@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.21
52
+ "@tbox.cn/app-contracts": 1.0.0-alpha.21
53
+ "@tbox.cn/app-contracts-mall": 1.0.0-alpha.21
54
+ "@tbox.cn/app-theme-tbox": 1.0.0-alpha.21
55
+ "@tbox.cn/app-build": 1.0.0-alpha.21
56
+ "@tbox.cn/app-agent-ui-kit": 1.0.0-alpha.21
57
+ "@tbox.cn/app-cli": 1.0.0-alpha.21
58
58
  zustand: 4.5.7
59
59
  eslint: 9.39.5
60
60
  typescript-eslint: 8.67.0
@@ -1,7 +1,7 @@
1
1
  {
2
- "$comment": "mall 画像(单一模板统一化 W4):create --profile mall 执行器(W5 接线)按 modules 序列加装 + configOverlay delta 叠加(优先级 模板 base < 画像 < --config-dir;chat.json 由 chat.overrides.json 生成)+ rootFiles 根文件落地(TEMPLATE.md 使用指南 → 应用根)。provider 轴独立(缺省 mock-only 演示态;vendor 档由部署者后续 add)。",
2
+ "$comment": "mall 画像:create --profile mall 按 modules 序列加装,configOverlay 叠加配置,rootFiles 落地使用指南。默认携带业务模块及其专属供应商;服务绑定与商场实例配置由部署者显式设置。",
3
3
  "name": "mall",
4
- "description": "商圈 AI Agent:按需组装首页 + 域装配 + 九供给+业务域(门店导览/会员/停车/营销/活动/活动玩法/客服/AI 支付)",
4
+ "description": "商圈 AI Agent:按需组装首页 + 域装配 + 九供给+业务域(门店导览/会员/停车/营销/活动/活动玩法/客服/AI 支付)+ 室内导航",
5
5
  "modules": [
6
6
  "@tbox.cn/app-module-mall-core",
7
7
  "@tbox.cn/app-module-shopping-guide",
@@ -12,7 +12,9 @@
12
12
  "@tbox.cn/app-module-activity-play",
13
13
  "@tbox.cn/app-provider-hupo",
14
14
  "@tbox.cn/app-module-customer-service",
15
- "@tbox.cn/app-module-ai-payment"
15
+ "@tbox.cn/app-module-ai-payment",
16
+ "@tbox.cn/app-module-indoor-navigation",
17
+ "@tbox.cn/app-provider-aibee"
16
18
  ],
17
19
  "configOverlay": "profiles/mall/config",
18
20
  "rootFiles": [
@@ -38,7 +38,9 @@ async function main() {
38
38
  steps.push({ name: 'generate', ms: generate.ms, ok: generate.ok });
39
39
  if (!generate.ok) return fail('generate', generate);
40
40
 
41
- const lint = await run('pnpm', ['exec', 'eslint', 'apps', 'packages', '--fix', '--quiet']);
41
+ // eslint 缓存(2026-11):.tbox/cache 下已做 tsc 增量缓存,eslint 原先每轮全仓冷扫。
42
+ // --cache 后未改动文件的 lint 结果直接命中(首轮写缓存,次轮毫秒级)。
43
+ const lint = await run('pnpm', ['exec', 'eslint', 'apps', 'packages', '--fix', '--quiet', '--cache', '--cache-location', '.tbox/cache/.eslintcache']);
42
44
  steps.push({ name: 'lint', ms: lint.ms, ok: lint.ok });
43
45
  if (!lint.ok) return fail('lint', lint);
44
46
 
@@ -370,6 +370,19 @@
370
370
  "since": "1.0.0-alpha.8",
371
371
  "phase": "in-process"
372
372
  },
373
+ {
374
+ "id": "shell.home-geometry",
375
+ "level": "warning",
376
+ "severity": "advisory",
377
+ "source": "experience",
378
+ "lane": "layout",
379
+ "threshold": "屏边距≥12px / 字号≤32px / 图标≤44px",
380
+ "symptom": "欢迎卡 / home 自动块 0px 贴屏、或首屏字号/图标比例失控(2x 稿残留)",
381
+ "fix": "实体 surface 用 mx-page(壳表面);首页槽注册传 { gutter: 'inset' };字号回八档 token、图标用 size-* 标度",
382
+ "recipe": "shell",
383
+ "since": "1.0.0-alpha.20",
384
+ "phase": "probe"
385
+ },
373
386
  {
374
387
  "id": "shell.blank",
375
388
  "level": "warning",
@@ -384,6 +397,19 @@
384
397
  "since": "1.0.0-alpha.8",
385
398
  "phase": "probe"
386
399
  },
400
+ {
401
+ "id": "contract.cross-ref",
402
+ "level": "warning",
403
+ "severity": "advisory",
404
+ "source": "experience",
405
+ "lane": "in-process",
406
+ "threshold": "声明齐备",
407
+ "symptom": "工具 import ../cards/<x>.card 却未在 defineTool 声明 cards;invalidateCardTypes 引用未注册卡名;工具直出卡声明 sheet 落点失配",
408
+ "fix": "在 defineTool options 补 cards: [<cardType>](否则 withCardEmissionHint 不生效);纠正 invalidateCardTypes 里的拼写;工具直出卡去掉 defaultPlacement: sheet 或改为动作弹层",
409
+ "recipe": "tool-emits-card",
410
+ "since": "1.0.0-alpha.20",
411
+ "phase": "in-process"
412
+ },
387
413
  {
388
414
  "id": "card.height",
389
415
  "level": "warning",
@@ -465,13 +491,26 @@
465
491
  "severity": "advisory",
466
492
  "source": "experience",
467
493
  "lane": "static",
468
- "threshold": "一致或包含",
469
- "symptom": "快捷问题按钮文案与发送文本不一致",
470
- "fix": "query 缺省等于 label,或让 query 包含 label",
494
+ "threshold": "非空白、无内部标识符、按钮 ≤16 字",
495
+ "symptom": "快捷问题文案为空白、透传内部实现标识符、或按钮文案超长折行",
496
+ "fix": "补全 label/query;query 用自然问句(短按钮 → 完整问题合法);按钮文案压到 16 字内",
471
497
  "recipe": "shell",
472
498
  "since": "1.0.0-alpha.8",
473
499
  "phase": "static"
474
500
  },
501
+ {
502
+ "id": "style.brand-contract",
503
+ "level": "warning",
504
+ "severity": "advisory",
505
+ "source": "experience",
506
+ "lane": "static",
507
+ "threshold": "零覆写版式合同",
508
+ "symptom": "brand.css 覆写 --tbox-fs-*/--tbox-radius-*/--tbox-shadow-* 或欢迎区 padding;index.html 外链 Google Fonts",
509
+ "fix": "品牌只改颜色/素材令牌(版式变量是基元合同);移除外链字体改系统字体栈或本地字体",
510
+ "recipe": "style",
511
+ "since": "1.0.0-alpha.20",
512
+ "phase": "static"
513
+ },
475
514
  {
476
515
  "id": "checks.registry",
477
516
  "level": "error",
@@ -26,6 +26,7 @@ const PROBE_IDS = [
26
26
  'shell.hit-target', 'shell.quick-visible', 'shell.icon-render', 'shell.controls-semantic',
27
27
  'shell.control-present', 'shell.a11y-name', 'shell.blank',
28
28
  'shell.no-fixed-chrome', 'shell.input-rows', 'shell.follow-latest', 'shell.console-clean',
29
+ 'shell.home-geometry',
29
30
  ];
30
31
 
31
32
  /** 运行时车道(要真实水合 + 交互)的检查 id。 */
@@ -96,7 +97,13 @@ try {
96
97
  vite = await createServer({
97
98
  configFile: false, root: clientDir, appType: 'custom', logLevel: 'error',
98
99
  plugins: [tailwindcss(), react()],
99
- resolve: { alias: { '@': path.join(clientDir, 'src'), '@config': path.join(appDir, 'config') } },
100
+ // @app-module 与 @config 是 registry 装配面(src/cards/registry.ts)可用的别名:
101
+ // home 几何探针要加载应用 registry(CLIENT_SLOTS),缺别名会在 transform 阶段崩。
102
+ resolve: { alias: {
103
+ '@': path.join(clientDir, 'src'),
104
+ '@config': path.join(appDir, 'config'),
105
+ '@app-module': path.join(appDir, 'modules'),
106
+ } },
100
107
  server: { middlewareMode: true, hmr: { server: hub }, fs: { allow: [appDir] } },
101
108
  optimizeDeps: { noDiscovery: true, include: [] },
102
109
  });
@@ -105,11 +112,31 @@ try {
105
112
  const kit = await vite.ssrLoadModule('@tbox.cn/app-agent-ui-kit');
106
113
  const registry = await vite.ssrLoadModule('/.tbox-gen/registry.client.ts');
107
114
  kit.configureChatConfigDefaults(chat);
108
- const store = kit.createPreviewStore({
115
+ // 2026-11:home-geometry 探针——应用注册表(src/cards/registry.ts)导出的 CLIENT_SLOTS
116
+ // 尝试一并挂进 SSR markup(无注册/无 slots/域组件含浏览器 API 时三者全部 graceful):
117
+ // 加载失败 → homeGeometry 标 not-run;渲染失败 → 同(回退到 slots-free markup,既有探针行为零变化)。
118
+ let clientSlots = undefined;
119
+ try {
120
+ const appCards = await vite.ssrLoadModule('/@fs' + path.join(clientDir, 'src/cards/registry.ts'));
121
+ if (appCards && typeof appCards === 'object' && 'CLIENT_SLOTS' in appCards) clientSlots = appCards.CLIENT_SLOTS;
122
+ } catch (error) {
123
+ // 加载失败腿:显式标 not-run 给原因,不被 applyChecks 的 na 覆盖。
124
+ clientSlots = undefined;
125
+ push('shell.home-geometry', 'probe', 'not-run', '客户端 registry 不可 SSR(' + (error && error.message ? String(error.message).slice(0, 120) : '加载失败') + ')——用运行时车道(真 Chrome)核验');
126
+ }
127
+ const previewStoreInit = {
109
128
  messages: [], historyMessages: [], historyHasMore: false, isLoadingHistory: false,
110
129
  isGenerating: false, runtimeStatus: 'ready', authBlocked: null, orphanCards: [], cardsByMessageId: {},
111
- });
112
- const markup = renderToStaticMarkup(React.createElement(kit.ChatPage, { store, cards: registry.cards, rawCards: registry.cards }));
130
+ };
131
+ const store = kit.createPreviewStore(previewStoreInit);
132
+ let markup;
133
+ try {
134
+ markup = renderToStaticMarkup(React.createElement(kit.ChatPage, { store, cards: registry.cards, rawCards: registry.cards, ...(clientSlots ? { slots: clientSlots } : {}) }));
135
+ } catch (_SLOT_RENDER_ERROR) {
136
+ if (!clientSlots) throw _SLOT_RENDER_ERROR;
137
+ push('shell.home-geometry', 'probe', 'not-run', '客户端 home 槽在 SSR 下不可渲染(域组件含浏览器态)——用运行时车道(真 Chrome)核验');
138
+ markup = renderToStaticMarkup(React.createElement(kit.ChatPage, { store, cards: registry.cards, rawCards: registry.cards }));
139
+ }
113
140
  const htmlFile = path.join(outDir, 'shell.html');
114
141
  writeFileSync(htmlFile, '<!doctype html><html lang="zh-CN" data-theme="tbox"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>shell probe</title><style>' + surface.cssText + '</style></head><body>' + markup + '</body></html>', 'utf8');
115
142
  // 运行时车道:真实水合(IIFE 内联)→ 量回合可见性与控制台噪声。
@@ -251,7 +278,26 @@ function staticExpression() {
251
278
  ' const homeSlot = document.querySelector(".chat-page__home-slot");',
252
279
  ' const hasHomeContent = Boolean(homeSlot && homeSlot.children.length > 0 && homeSlot.getBoundingClientRect().height > 0);',
253
280
  ' const blank = geometry.blankGap && hasHomeContent ? { maxGap: geometry.blankGap.maxGap, blocks: geometry.blankGap.blocks, viewport: geometry.viewport.h } : null;',
254
- ' return JSON.stringify({ controls, quick, icons, bodyTop, input, pageTop: 0, blank, geometry });',
281
+ // home-geometry(2026-11):welcome / home 自动块相对屏边与字号/图标上限原语
282
+ ' const homeRoot = document.querySelector(".chat-page__home-slot");',
283
+ ' const firstHomeBlock = homeRoot && homeRoot.firstElementChild ? homeRoot.firstElementChild : null;',
284
+ ' const welcomeEl = document.querySelector(".chat-page__welcome");',
285
+ ' const maxFontOf = (root) => { let m = 0; if (root) { for (const el of root.querySelectorAll("*")) { const fs = parseFloat(getComputedStyle(el).fontSize); if (Number.isFinite(fs) && el.textContent && el.textContent.trim()) m = Math.max(m, fs); } } return Math.round(m * 10) / 10; };',
286
+ ' const maxIconOf = (root) => { let m = 0; if (root) { for (const el of [...root.querySelectorAll("img, svg")]) { const b = el.getBoundingClientRect(); if (b.width > 0) m = Math.max(m, Math.round(Math.max(b.width, b.height))); } } return m; };',
287
+ ' const hRoot = firstHomeBlock || homeRoot;',
288
+ ' const hR = firstHomeBlock ? firstHomeBlock.getBoundingClientRect() : null;',
289
+ // 实体 surface(brand/subtle)的欢迎卡才有 16px 对齐承诺;default 透明文字态全宽合法。
290
+ ' const solidWelcome = welcomeEl && (welcomeEl.classList.contains("chat-page__welcome--brand") || welcomeEl.classList.contains("chat-page__welcome--subtle"));',
291
+ ' const wR = solidWelcome ? welcomeEl.getBoundingClientRect() : null;',
292
+ ' const home = {',
293
+ ' hasHomeContent: Boolean(firstHomeBlock),',
294
+ ' hasWelcome: Boolean(welcomeEl),',
295
+ ' blockRect: hR ? { left: Math.round(hR.left), right: Math.round(window.innerWidth - hR.right), width: Math.round(hR.width) } : null,',
296
+ ' welcomeRect: wR ? { left: Math.round(wR.left), right: Math.round(window.innerWidth - wR.right), width: Math.round(wR.width) } : null,',
297
+ ' maxFontPx: Math.max(maxFontOf(hRoot), welcomeEl ? maxFontOf(welcomeEl) : 0),',
298
+ ' maxIconPx: Math.max(maxIconOf(hRoot), welcomeEl ? maxIconOf(welcomeEl) : 0),',
299
+ ' };',
300
+ ' return JSON.stringify({ controls, quick, icons, bodyTop, input, pageTop: 0, blank, home, geometry });',
255
301
  '})()',
256
302
  ].join('\n');
257
303
  }
@@ -356,6 +402,37 @@ function applyChecks(result, chat) {
356
402
  ? '找不到输入框'
357
403
  : '输入框 ' + input.fieldH + 'px(期望 ' + (lineH ? lineH * expectedRows : '?') + 'px = 行高 ' + lineH + ' × ' + expectedRows + ' 行);外框 ' + input.wrapH + '×' + input.wrapW + '(命中区要求 ≥44)');
358
404
 
405
+ // home-geometry(2026-11):欢迎卡 / home 自动块相对屏边的 16px 对齐线断言。
406
+ // 真实构建 3 例欢迎卡 0px 贴屏(缺 mx-page)、1 例 1× 比例失真(48px 标题/图标)——
407
+ // 三个原语:屏边距 ≥12px(仅实体 surface)、字号 ≤32px / 图标 ≤44px(**独立恒**判,
408
+ // default 透明面的 2x 失真同样要拦)。
409
+ const homeGeo = result.home;
410
+ const fontIconProblems = [];
411
+ if (homeGeo && homeGeo.maxFontPx > 32) fontIconProblems.push('首屏最大字号 ' + homeGeo.maxFontPx + 'px(要求 ≤32)');
412
+ if (homeGeo && homeGeo.maxIconPx > 44) fontIconProblems.push('首屏最大图标 ' + homeGeo.maxIconPx + 'px(要求 ≤44)');
413
+ const edgeOf = (rect) => (rect ? [rect.left, rect.right] : []);
414
+ const edges = homeGeo ? [...edgeOf(homeGeo.blockRect), ...edgeOf(homeGeo.welcomeRect)] : [];
415
+ const edgeTargets = homeGeo ? [homeGeo.blockRect, homeGeo.welcomeRect].filter(Boolean) : [];
416
+ const priorGeoItem = items.find((item) => item.id === 'shell.home-geometry');
417
+ if (priorGeoItem && priorGeoItem.status === 'not-run') {
418
+ // 短路:加载/渲染失败腿的 not-run 是真实失败,不能被 na 覆盖。
419
+ // 字号/图标独立原语仍判(回退 markup 的采集值有效);边距断言因槽未挂起而无法判。
420
+ if (fontIconProblems.length > 0) {
421
+ push('shell.home-geometry', 'layout', 'fail', fontIconProblems.join(';') + '(home 槽 SSR 失败,结算见上条 not-run)');
422
+ }
423
+ // 无字号/图标越线时保留原 not-run 条目(不 push,push 会按 id 覆盖)。
424
+ } else if (edges.length === 0 && fontIconProblems.length === 0) {
425
+ push('shell.home-geometry', 'layout', 'na', '无自定义 home / 实体欢迎 surface——几何断言不适用');
426
+ } else {
427
+ const problems = [...fontIconProblems];
428
+ const nameOf = (rect) => (rect === homeGeo.blockRect ? 'home块' : '欢迎卡');
429
+ edgeTargets.forEach((rect) => {
430
+ if (rect.left < 12 || rect.right < 12) problems.push(nameOf(rect) + '相对屏边距 左' + rect.left + '/右' + rect.right + 'px(要求 ≥12,目标 16)');
431
+ });
432
+ push('shell.home-geometry', 'layout', problems.length ? 'fail' : 'pass',
433
+ problems.length ? problems.join(';') : '屏边距 ' + edges.join('/') + 'px、最大字号 ' + (homeGeo?.maxFontPx ?? 0) + 'px、最大图标 ' + (homeGeo?.maxIconPx ?? 0) + 'px——均在线内');
434
+ }
435
+
359
436
  const blank = result.blank;
360
437
  if (!blank) {
361
438
  // 探针直接渲染 ChatPage,不注入应用 slots → home 槽恒空,密度断言在这里无从量起。
@@ -194,10 +194,47 @@ function clearStalePages() {
194
194
  function write(record) {
195
195
  mkdirSync(outDir, { recursive: true });
196
196
  writeFileSync(path.join(outDir, 'storyboard.json'), JSON.stringify(record, null, 2) + '\n', 'utf8');
197
+ writeSummary(record);
197
198
  console.log(summary(record));
198
199
  return record;
199
200
  }
200
201
 
202
+ /**
203
+ * 几何摘要(2026-11):storyboard-summary.md 让消费方以纯文本核验每帧几何,
204
+ * 不必读 12000px 缩略长图(真实构建两例读 PNG 后自述 Hard to read 且触发缓存全量击穿)。
205
+ * 只覆盖门禁可判的字段(高度/溢出/最小字号/截断/触控),帧渲染的真实像素仍以 PNG 为准。
206
+ */
207
+ function writeSummary(record) {
208
+ if (record.status !== 'ok') return;
209
+ const lines = [
210
+ '# Storyboard 几何摘要',
211
+ '',
212
+ '> 由 pnpm storyboard 生成(status=ok 时随 storyboard.json 一起写入)。',
213
+ '> 先读本表核对几何;只有看到异常帧才去读对应整页 PNG(长图缩略后不可读)。',
214
+ '',
215
+ '| 帧 | 宽×高(px) | overflowX | 最小字号 | 截断 | 触控<44px | 问题数 |',
216
+ '|---|---|---|---|---|---|---|',
217
+ ];
218
+ for (const frame of record.frames ?? []) {
219
+ const g = frame.geometry ?? {};
220
+ const problems = geometryProblems(frame);
221
+ lines.push([
222
+ '| ' + frame.id,
223
+ frame.width + '×' + (g.height ?? '?'),
224
+ (g.overflowX ?? 0) + 'px',
225
+ typeof g.minFontPx === 'number' ? g.minFontPx + 'px' : '?',
226
+ (g.clipped ?? []).length,
227
+ (g.smallTargets ?? []).length,
228
+ problems.length + ' |',
229
+ ].join(' | ').replace(/^\| /, '| '));
230
+ }
231
+ const problemsTotal = (record.frames ?? []).reduce((total, frame) => total + geometryProblems(frame).length, 0);
232
+ lines.push('', '(几何问题合计 ' + problemsTotal + ' 个;处理建议按 geometryProblems 输出的检查 id 查 errors.md 对照表)');
233
+ let text = lines.join('\n');
234
+ if (text.length > 3072) text = text.slice(0, 3072) + '\n\n…(超 3KB 截断;帧级明细看 storyboard.json)';
235
+ writeFileSync(path.join(outDir, 'storyboard-summary.md'), text + '\n', 'utf8');
236
+ }
237
+
201
238
  function summary(record) {
202
239
  if (record.status === 'not-run') return 'storyboard: not-run(' + record.reason + ')';
203
240
  const problems = (record.frames ?? []).reduce((total, frame) => total + geometryProblems(frame).length, 0);