@tbox.cn/app-template-agent 0.10.37 → 1.0.0-alpha.10

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 (455) hide show
  1. package/._.gitignore +0 -0
  2. package/._.nvmrc +0 -0
  3. package/._AGENTS.md +0 -0
  4. package/._ENV.md +0 -0
  5. package/._LEGAL.md +0 -0
  6. package/._LICENSE +0 -0
  7. package/._README.md +0 -0
  8. package/._eslint.config.mjs +0 -0
  9. package/._package.json +0 -0
  10. package/._pnpm-lock.template.yaml +0 -0
  11. package/._pnpm-workspace.template.yaml +0 -0
  12. package/._tsconfig.base.json +0 -0
  13. package/.gitignore +14 -2
  14. package/.tbox/._app.json +0 -0
  15. package/.tbox/._default-modules.json +0 -0
  16. package/.tbox/._miniapp-containers.json +0 -0
  17. package/.tbox/app.json +3 -19
  18. package/.tbox/default-modules.json +4 -1
  19. package/.tbox/factory/._chat.json +0 -0
  20. package/.tbox/factory/chat.json +9 -0
  21. package/.tbox/miniapp-containers.json +1 -1
  22. package/AGENTS.md +96 -148
  23. package/ENV.md +4 -4
  24. package/README.md +31 -27
  25. package/apps/._AGENTS.md +0 -0
  26. package/apps/AGENTS.md +9 -0
  27. package/apps/client/._index.html +0 -0
  28. package/apps/client/._package.json +0 -0
  29. package/apps/client/._tsconfig.json +0 -0
  30. package/apps/client/._vite.config.ts +0 -0
  31. package/apps/client/index.html +1 -20
  32. package/apps/client/package.json +7 -5
  33. package/apps/client/scripts/._acceptance-changes.test.mjs +0 -0
  34. package/apps/client/scripts/._check-evidence.mjs +0 -0
  35. package/apps/client/scripts/._color-scan.mjs +0 -0
  36. package/apps/client/scripts/._color-scan.test.mjs +0 -0
  37. package/apps/client/scripts/._evidence-gate.mjs +0 -0
  38. package/apps/client/scripts/._evidence-gate.test.mjs +0 -0
  39. package/apps/client/scripts/._experience-checks.mjs +0 -0
  40. package/apps/client/scripts/._geometry-kernel.test.mjs +0 -0
  41. package/apps/client/scripts/._in-process-checks.mjs +0 -0
  42. package/apps/client/scripts/._probe-checks.mjs +0 -0
  43. package/apps/client/scripts/._render-card.mjs +0 -0
  44. package/apps/client/scripts/._sample-entries.test.mjs +0 -0
  45. package/apps/client/scripts/._storyboard.test.mjs +0 -0
  46. package/apps/client/scripts/._surface-css.mjs +0 -0
  47. package/apps/client/scripts/._theme-kernel.mjs +0 -0
  48. package/apps/client/scripts/._theme-kernel.test.mjs +0 -0
  49. package/apps/client/scripts/acceptance-changes.test.mjs +97 -0
  50. package/apps/client/scripts/check-evidence.mjs +1402 -0
  51. package/apps/client/scripts/color-scan.mjs +66 -0
  52. package/apps/client/scripts/color-scan.test.mjs +25 -0
  53. package/apps/client/scripts/evidence-gate.mjs +337 -0
  54. package/apps/client/scripts/evidence-gate.test.mjs +135 -0
  55. package/apps/client/scripts/experience-checks.mjs +163 -0
  56. package/apps/client/scripts/geometry-kernel.test.mjs +92 -0
  57. package/apps/client/scripts/in-process-checks.mjs +51 -0
  58. package/apps/client/scripts/lib/._card-registry.mjs +0 -0
  59. package/apps/client/scripts/lib/._card-registry.test.mjs +0 -0
  60. package/apps/client/scripts/lib/._evidence-inputs.mjs +0 -0
  61. package/apps/client/scripts/lib/._evidence-inputs.test.mjs +0 -0
  62. package/apps/client/scripts/lib/._static-render.mjs +0 -0
  63. package/apps/client/scripts/lib/._static-render.test.mjs +0 -0
  64. package/apps/client/scripts/lib/card-registry.mjs +81 -0
  65. package/apps/client/scripts/lib/card-registry.test.mjs +59 -0
  66. package/apps/client/scripts/lib/evidence-inputs.mjs +91 -0
  67. package/apps/client/scripts/lib/evidence-inputs.test.mjs +27 -0
  68. package/apps/client/scripts/lib/static-render.mjs +35 -0
  69. package/apps/client/scripts/lib/static-render.test.mjs +21 -0
  70. package/apps/client/scripts/probe-checks.mjs +85 -0
  71. package/apps/client/scripts/render-card.mjs +710 -0
  72. package/apps/client/scripts/sample-entries.test.mjs +31 -0
  73. package/apps/client/scripts/storyboard.test.mjs +149 -0
  74. package/apps/client/scripts/surface-css.mjs +55 -0
  75. package/apps/client/scripts/theme-kernel.mjs +236 -0
  76. package/apps/client/scripts/theme-kernel.test.mjs +136 -0
  77. package/apps/client/src/._app.config.ts +0 -0
  78. package/apps/client/src/._vite-env.d.ts +0 -0
  79. package/apps/client/src/app.config.ts +43 -0
  80. package/apps/client/src/cards/._AGENTS.md +0 -0
  81. package/apps/client/src/cards/._registry.ts +0 -0
  82. package/apps/client/src/cards/AGENTS.md +11 -0
  83. package/apps/client/src/cards/registry.ts +6 -19
  84. package/apps/client/src/pages/._page.tsx +0 -0
  85. package/apps/client/src/pages/index/._index.tsx +0 -0
  86. package/apps/client/src/pages/index/index.tsx +1 -1
  87. package/apps/client/src/pages/page.tsx +11 -0
  88. package/apps/client/src/store/._chat.ts +0 -0
  89. package/apps/client/src/store/chat.ts +7 -3
  90. package/apps/client/src/styles/._brand.css +0 -0
  91. package/apps/client/src/styles/._tailwind.css +0 -0
  92. package/apps/client/src/styles/brand.css +50 -0
  93. package/apps/client/src/styles/tailwind.css +326 -0
  94. package/apps/client/src/test/._setup.ts +0 -0
  95. package/apps/client/src/vite-env.d.ts +0 -2
  96. package/apps/client/vite.config.ts +7 -53
  97. package/apps/server/._package.json +0 -0
  98. package/apps/server/._tsconfig.json +0 -0
  99. package/apps/server/._tsup.config.ts +0 -0
  100. package/apps/server/._vitest.config.ts +0 -0
  101. package/apps/server/package.json +1 -1
  102. package/apps/server/scripts/._probe.mjs +0 -0
  103. package/apps/server/scripts/._scenario-lib.mjs +0 -0
  104. package/apps/server/scripts/._scenario.mjs +0 -0
  105. package/apps/server/scripts/probe.mjs +387 -0
  106. package/apps/server/scripts/scenario-lib.mjs +295 -0
  107. package/apps/server/scripts/scenario.mjs +67 -0
  108. package/apps/server/src/._app.ts +0 -0
  109. package/apps/server/src/._dev.ts +0 -0
  110. package/apps/server/src/._index.ts +0 -0
  111. package/apps/server/src/._intent-routes.ts +0 -0
  112. package/apps/server/src/._pre-tools.ts +0 -0
  113. package/apps/server/src/app.ts +17 -17
  114. package/apps/server/src/cards/._AGENTS.md +0 -0
  115. package/apps/server/src/cards/AGENTS.md +19 -0
  116. package/apps/server/src/cli/._collect-registry.ts +0 -0
  117. package/apps/server/src/cli/._plugin-doctor.ts +0 -0
  118. package/apps/server/src/cli/._plugin-inspect.ts +0 -0
  119. package/apps/server/src/cli/collect-registry.ts +7 -11
  120. package/apps/server/src/config/._integration.ts +0 -0
  121. package/apps/server/src/dev.ts +38 -64
  122. package/apps/server/src/index.ts +27 -45
  123. package/apps/server/src/pre-tools.ts +7 -16
  124. package/apps/server/src/tools/._AGENTS.md +0 -0
  125. package/apps/server/src/tools/AGENTS.md +23 -0
  126. package/apps/server/tests/._agent-prompt.test.ts +0 -0
  127. package/apps/server/tests/._cards-registry.test.ts +0 -0
  128. package/apps/server/tests/._deployment-loader.test.ts +0 -0
  129. package/apps/server/tests/._intent-dispatcher.test.ts +0 -0
  130. package/apps/server/tests/._tool-runtime.test.ts +0 -0
  131. package/apps/server/tests/cards-registry.test.ts +1 -1
  132. package/apps/server/tests/helpers/._register.ts +0 -0
  133. package/apps/server/tests/helpers/register.ts +10 -0
  134. package/apps/server/tests/tool-runtime.test.ts +1 -28
  135. package/apps/server/tsconfig.json +1 -1
  136. package/apps/server/tsup.config.ts +6 -3
  137. package/config/._AGENTS.md +0 -0
  138. package/config/._README.md +0 -0
  139. package/config/._chat.json +0 -0
  140. package/config/._integrations.json +0 -0
  141. package/config/._llm_provider.json +0 -0
  142. package/config/._plugins.json +0 -0
  143. package/config/AGENTS.md +14 -0
  144. package/config/README.md +4 -4
  145. package/config/chat.json +25 -7
  146. package/config/integrations.json +1 -1
  147. package/docs/agent/._agent-prompt.md +0 -0
  148. package/docs/agent/._card-action.md +0 -0
  149. package/docs/agent/._card.md +0 -0
  150. package/docs/agent/._conversation.md +0 -0
  151. package/docs/agent/._kit.md +0 -0
  152. package/docs/agent/._shell.md +0 -0
  153. package/docs/agent/._state.md +0 -0
  154. package/docs/agent/._style.md +0 -0
  155. package/docs/agent/._tool-emits-card.md +0 -0
  156. package/docs/agent/._tool.md +0 -0
  157. package/docs/agent/._verify.md +0 -0
  158. package/docs/agent/agent-prompt.md +38 -0
  159. package/docs/agent/card-action.md +101 -0
  160. package/docs/agent/card.md +159 -0
  161. package/docs/agent/conversation.md +52 -0
  162. package/docs/agent/kit.md +80 -0
  163. package/docs/agent/shell.md +77 -0
  164. package/docs/agent/state.md +85 -0
  165. package/docs/agent/style.md +107 -0
  166. package/docs/agent/tool-emits-card.md +62 -0
  167. package/docs/agent/tool.md +71 -0
  168. package/docs/agent/verify.md +188 -0
  169. package/eslint.config.mjs +18 -0
  170. package/modules/provider-custom/._AGENTS.md +0 -0
  171. package/modules/provider-custom/._INTEGRATION.md +0 -0
  172. package/modules/provider-custom/._LICENSE +0 -0
  173. package/modules/provider-custom/._README.md +0 -0
  174. package/modules/provider-custom/._package.json +0 -0
  175. package/modules/provider-custom/._tbox.module.json +0 -0
  176. package/modules/provider-custom/._tsconfig.json +0 -0
  177. package/modules/provider-custom/._tsup.config.ts +0 -0
  178. package/{packages → modules}/provider-custom/AGENTS.md +6 -6
  179. package/modules/provider-custom/INTEGRATION.md +10 -0
  180. package/{packages → modules}/provider-custom/package.json +1 -0
  181. package/modules/provider-custom/src/._index.ts +0 -0
  182. package/modules/provider-custom/src/server/._example-adapter.ts +0 -0
  183. package/modules/provider-custom/src/server/._index.ts +0 -0
  184. package/{packages → modules}/provider-custom/src/server/example-adapter.ts +2 -2
  185. package/{packages → modules}/provider-custom/src/server/index.ts +1 -1
  186. package/modules/provider-custom/tests/._provider-custom.test.ts +0 -0
  187. package/package.json +38 -7
  188. package/packages/agent-ui-kit/._AGENTS.md +0 -0
  189. package/packages/agent-ui-kit/._LICENSE +0 -0
  190. package/packages/agent-ui-kit/._README.md +0 -0
  191. package/packages/agent-ui-kit/._catalog.json +0 -0
  192. package/packages/agent-ui-kit/._package.json +0 -0
  193. package/packages/agent-ui-kit/._tsconfig.json +0 -0
  194. package/packages/agent-ui-kit/._vitest.config.ts +0 -0
  195. package/packages/agent-ui-kit/AGENTS.md +8 -0
  196. package/packages/agent-ui-kit/README.md +59 -6
  197. package/packages/agent-ui-kit/assets/._keyboard-circle.svg +0 -0
  198. package/packages/agent-ui-kit/assets/._more-circle.svg +0 -0
  199. package/packages/agent-ui-kit/assets/._new-chat.svg +0 -0
  200. package/packages/agent-ui-kit/assets/._quick-command-star.svg +0 -0
  201. package/packages/agent-ui-kit/assets/._send-gradient.svg +0 -0
  202. package/packages/agent-ui-kit/assets/._stop@2x.png +0 -0
  203. package/packages/agent-ui-kit/assets/._voice-circle.svg +0 -0
  204. package/packages/agent-ui-kit/catalog.json +855 -0
  205. package/packages/agent-ui-kit/package.json +24 -9
  206. package/packages/agent-ui-kit/src/._ChatPage.tsx +0 -0
  207. package/packages/agent-ui-kit/src/._chat-config.test.ts +0 -0
  208. package/packages/agent-ui-kit/src/._chat-config.ts +0 -0
  209. package/packages/agent-ui-kit/src/._icons.ts +0 -0
  210. package/packages/agent-ui-kit/src/._index.ts +0 -0
  211. package/packages/agent-ui-kit/src/._preview-provider.tsx +0 -0
  212. package/packages/agent-ui-kit/src/._shell.contract.json +0 -0
  213. package/packages/agent-ui-kit/src/._shell.test.ts +0 -0
  214. package/packages/agent-ui-kit/src/._shell.ts +0 -0
  215. package/packages/agent-ui-kit/src/._store-context.tsx +0 -0
  216. package/packages/agent-ui-kit/src/._surface.test.tsx +0 -0
  217. package/packages/agent-ui-kit/src/._surface.tsx +0 -0
  218. package/packages/agent-ui-kit/src/._types.ts +0 -0
  219. package/packages/agent-ui-kit/src/._vite-env.d.ts +0 -0
  220. package/packages/agent-ui-kit/src/ChatPage.tsx +115 -20
  221. package/packages/agent-ui-kit/src/card/._action-list-pending.test.tsx +0 -0
  222. package/packages/agent-ui-kit/src/card/._define-card.test.ts +0 -0
  223. package/packages/agent-ui-kit/src/card/._define-card.ts +0 -0
  224. package/packages/agent-ui-kit/src/card/._primitives.test.tsx +0 -0
  225. package/packages/agent-ui-kit/src/card/._primitives.tsx +0 -0
  226. package/packages/agent-ui-kit/src/card/._use-card-actions.ts +0 -0
  227. package/packages/agent-ui-kit/src/card/._view-card-inline.test.tsx +0 -0
  228. package/packages/agent-ui-kit/src/card/._view-card.test.tsx +0 -0
  229. package/packages/agent-ui-kit/src/card/._view-card.tsx +0 -0
  230. package/packages/agent-ui-kit/src/card/action-list-pending.test.tsx +91 -0
  231. package/packages/agent-ui-kit/src/card/define-card.test.ts +25 -0
  232. package/packages/agent-ui-kit/src/card/define-card.ts +47 -0
  233. package/packages/agent-ui-kit/src/card/primitives.test.tsx +157 -0
  234. package/packages/agent-ui-kit/src/card/primitives.tsx +717 -0
  235. package/packages/agent-ui-kit/src/card/use-card-actions.ts +86 -0
  236. package/packages/agent-ui-kit/src/card/view-card-inline.test.tsx +42 -0
  237. package/packages/agent-ui-kit/src/card/view-card.test.tsx +79 -0
  238. package/packages/agent-ui-kit/src/card/view-card.tsx +250 -0
  239. package/packages/agent-ui-kit/src/chat-config.test.ts +35 -71
  240. package/packages/agent-ui-kit/src/chat-config.ts +29 -7
  241. package/packages/agent-ui-kit/src/components/._CardRenderer.tsx +0 -0
  242. package/packages/agent-ui-kit/src/components/ActionBar/._DebugButton.test.tsx +0 -0
  243. package/packages/agent-ui-kit/src/components/ActionBar/._DebugButton.tsx +0 -0
  244. package/packages/agent-ui-kit/src/components/ActionBar/._index.test.tsx +0 -0
  245. package/packages/agent-ui-kit/src/components/ActionBar/._index.tsx +0 -0
  246. package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.test.tsx +3 -0
  247. package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.tsx +5 -10
  248. package/packages/agent-ui-kit/src/components/ActionBar/index.tsx +13 -14
  249. package/packages/agent-ui-kit/src/components/BottomSheet/._index.test.tsx +0 -0
  250. package/packages/agent-ui-kit/src/components/BottomSheet/._index.tsx +0 -0
  251. package/packages/agent-ui-kit/src/components/BottomSheet/index.test.tsx +97 -0
  252. package/packages/agent-ui-kit/src/components/BottomSheet/index.tsx +49 -0
  253. package/packages/agent-ui-kit/src/components/ChatHeader/._index.test.tsx +0 -0
  254. package/packages/agent-ui-kit/src/components/ChatHeader/._index.tsx +0 -0
  255. package/packages/agent-ui-kit/src/components/ChatHeader/index.tsx +19 -17
  256. package/packages/agent-ui-kit/src/components/ChatInput/._index.test.tsx +0 -0
  257. package/packages/agent-ui-kit/src/components/ChatInput/._index.tsx +0 -0
  258. package/packages/agent-ui-kit/src/components/ChatInput/index.test.tsx +2 -2
  259. package/packages/agent-ui-kit/src/components/ChatInput/index.tsx +44 -33
  260. package/packages/agent-ui-kit/src/components/ChatInput/voice/._VoicePressField.tsx +0 -0
  261. package/packages/agent-ui-kit/src/components/ChatInput/voice/._VoiceRecordingOverlay.tsx +0 -0
  262. package/packages/agent-ui-kit/src/components/ChatInput/voice/._machine.ts +0 -0
  263. package/packages/agent-ui-kit/src/components/ChatInput/voice/._useVoicePress.ts +0 -0
  264. package/packages/agent-ui-kit/src/components/ChatInput/voice/VoicePressField.tsx +12 -3
  265. package/packages/agent-ui-kit/src/components/ChatInput/voice/VoiceRecordingOverlay.tsx +9 -9
  266. package/packages/agent-ui-kit/src/components/ChatInput/voice/useVoicePress.ts +1 -1
  267. package/packages/agent-ui-kit/src/components/HistoryEntry/._index.tsx +0 -0
  268. package/packages/agent-ui-kit/src/components/HistoryEntry/index.tsx +4 -4
  269. package/packages/agent-ui-kit/src/components/MediaList/._index.tsx +0 -0
  270. package/packages/agent-ui-kit/src/components/MediaList/index.tsx +42 -28
  271. package/packages/agent-ui-kit/src/components/MessageBubble/._index.test.tsx +0 -0
  272. package/packages/agent-ui-kit/src/components/MessageBubble/._index.tsx +0 -0
  273. package/packages/agent-ui-kit/src/components/MessageBubble/index.tsx +59 -28
  274. package/packages/agent-ui-kit/src/components/PullDownIndicator/._index.tsx +0 -0
  275. package/packages/agent-ui-kit/src/components/PullDownIndicator/index.tsx +3 -4
  276. package/packages/agent-ui-kit/src/components/QuickCommands/._index.test.tsx +0 -0
  277. package/packages/agent-ui-kit/src/components/QuickCommands/._index.tsx +0 -0
  278. package/packages/agent-ui-kit/src/components/QuickCommands/index.test.tsx +3 -1
  279. package/packages/agent-ui-kit/src/components/QuickCommands/index.tsx +33 -10
  280. package/packages/agent-ui-kit/src/components/ReasoningBlock/._index.tsx +0 -0
  281. package/packages/agent-ui-kit/src/components/ReasoningBlock/index.tsx +14 -9
  282. package/packages/agent-ui-kit/src/components/ScrollToBottomButton/._index.tsx +0 -0
  283. package/packages/agent-ui-kit/src/components/ScrollToBottomButton/index.tsx +7 -5
  284. package/packages/agent-ui-kit/src/components/ToolCallBlock/._detail.test.ts +0 -0
  285. package/packages/agent-ui-kit/src/components/ToolCallBlock/._detail.ts +0 -0
  286. package/packages/agent-ui-kit/src/components/ToolCallBlock/._index.test.tsx +0 -0
  287. package/packages/agent-ui-kit/src/components/ToolCallBlock/._index.tsx +0 -0
  288. package/packages/agent-ui-kit/src/components/ToolCallBlock/._titles.ts +0 -0
  289. package/packages/agent-ui-kit/src/components/ToolCallBlock/index.tsx +58 -38
  290. package/packages/agent-ui-kit/src/hooks/._use-drag-gesture.test.ts +0 -0
  291. package/packages/agent-ui-kit/src/hooks/._use-drag-gesture.ts +0 -0
  292. package/packages/agent-ui-kit/src/hooks/._use-pull-down-history.ts +0 -0
  293. package/packages/agent-ui-kit/src/hooks/._use-pull-down-wheel-native.test.ts +0 -0
  294. package/packages/agent-ui-kit/src/hooks/._useMediaUpload.ts +0 -0
  295. package/packages/agent-ui-kit/src/hooks/._useTTSAutoPlay.ts +0 -0
  296. package/packages/agent-ui-kit/src/icons.ts +39 -0
  297. package/packages/agent-ui-kit/src/index.ts +76 -2
  298. package/packages/agent-ui-kit/src/overlay/._Overlay.tsx +0 -0
  299. package/packages/agent-ui-kit/src/overlay/._focus.ts +0 -0
  300. package/packages/agent-ui-kit/src/overlay/._index.ts +0 -0
  301. package/packages/agent-ui-kit/src/overlay/._inert.ts +0 -0
  302. package/packages/agent-ui-kit/src/overlay/._layers.ts +0 -0
  303. package/packages/agent-ui-kit/src/overlay/._overlay.ssr.test.tsx +0 -0
  304. package/packages/agent-ui-kit/src/overlay/._overlay.test.tsx +0 -0
  305. package/packages/agent-ui-kit/src/overlay/._presence.ts +0 -0
  306. package/packages/agent-ui-kit/src/overlay/._scroll-lock.ts +0 -0
  307. package/packages/agent-ui-kit/src/overlay/._stack.ts +0 -0
  308. package/packages/agent-ui-kit/src/overlay/._use-overlay.ts +0 -0
  309. package/packages/agent-ui-kit/src/overlay/Overlay.tsx +154 -0
  310. package/packages/agent-ui-kit/src/overlay/focus.ts +53 -0
  311. package/packages/agent-ui-kit/src/overlay/index.ts +16 -0
  312. package/packages/agent-ui-kit/src/overlay/inert.ts +27 -0
  313. package/packages/agent-ui-kit/src/overlay/layers.ts +21 -0
  314. package/packages/agent-ui-kit/src/overlay/overlay.ssr.test.tsx +27 -0
  315. package/packages/agent-ui-kit/src/overlay/overlay.test.tsx +209 -0
  316. package/packages/agent-ui-kit/src/overlay/presence.ts +86 -0
  317. package/packages/agent-ui-kit/src/overlay/scroll-lock.ts +62 -0
  318. package/packages/agent-ui-kit/src/overlay/stack.ts +111 -0
  319. package/packages/agent-ui-kit/src/overlay/use-overlay.ts +80 -0
  320. package/packages/agent-ui-kit/src/preview-provider.tsx +47 -0
  321. package/packages/agent-ui-kit/src/shell.contract.json +75 -0
  322. package/packages/agent-ui-kit/src/shell.test.ts +72 -0
  323. package/packages/agent-ui-kit/src/shell.ts +60 -0
  324. package/packages/agent-ui-kit/src/surface.test.tsx +35 -0
  325. package/packages/agent-ui-kit/src/surface.tsx +44 -0
  326. package/packages/agent-ui-kit/src/test/._setup.ts +0 -0
  327. package/packages/agent-ui-kit/src/theme/._base.css +0 -0
  328. package/packages/agent-ui-kit/src/theme/._contract.json +0 -0
  329. package/packages/agent-ui-kit/src/theme/._motion.css +0 -0
  330. package/packages/agent-ui-kit/src/theme/._theme-contract.test.ts +0 -0
  331. package/packages/agent-ui-kit/src/theme/._theme.ts +0 -0
  332. package/packages/agent-ui-kit/src/theme/._tokens.css +0 -0
  333. package/packages/agent-ui-kit/src/theme/base.css +167 -0
  334. package/packages/agent-ui-kit/src/theme/contract.json +123 -2
  335. package/packages/agent-ui-kit/src/theme/theme-contract.test.ts +19 -3
  336. package/packages/agent-ui-kit/src/theme/{tokens.less → tokens.css} +19 -20
  337. package/packages/agent-ui-kit/src/utils/._copyText.ts +0 -0
  338. package/packages/agent-ui-kit/src/utils/._haptics.test.ts +0 -0
  339. package/packages/agent-ui-kit/src/utils/._haptics.ts +0 -0
  340. package/packages/agent-ui-kit/src/utils/._image-preview-host.tsx +0 -0
  341. package/packages/agent-ui-kit/src/utils/._imagePreview.test.ts +0 -0
  342. package/packages/agent-ui-kit/src/utils/._imagePreview.ts +0 -0
  343. package/packages/agent-ui-kit/src/utils/._pull-down-machine.test.ts +0 -0
  344. package/packages/agent-ui-kit/src/utils/._pull-down-machine.ts +0 -0
  345. package/packages/agent-ui-kit/src/utils/._session-error.ts +0 -0
  346. package/packages/agent-ui-kit/src/utils/._toast.test.ts +0 -0
  347. package/packages/agent-ui-kit/src/utils/._toast.ts +0 -0
  348. package/packages/agent-ui-kit/src/utils/._tool-call-display.test.ts +0 -0
  349. package/packages/agent-ui-kit/src/utils/._tool-call-display.ts +0 -0
  350. package/packages/agent-ui-kit/src/utils/image-preview-host.tsx +95 -0
  351. package/packages/agent-ui-kit/src/utils/imagePreview.test.ts +32 -0
  352. package/packages/agent-ui-kit/src/utils/imagePreview.ts +14 -5
  353. package/packages/agent-ui-kit/src/utils/toast.test.ts +64 -0
  354. package/packages/agent-ui-kit/src/utils/toast.ts +100 -7
  355. package/packages/contracts-mall/._package.json +0 -0
  356. package/packages/contracts-mall/._tsconfig.json +0 -0
  357. package/packages/contracts-mall/src/._index.ts +0 -0
  358. package/packages/contracts-mall/src/._runtime.ts +0 -0
  359. package/packages/contracts-mall/src/server/._index.ts +0 -0
  360. package/packages/shared/._AGENTS.md +0 -0
  361. package/packages/shared/._package.json +0 -0
  362. package/packages/shared/._tsconfig.json +0 -0
  363. package/packages/shared/AGENTS.md +13 -0
  364. package/packages/shared/package.json +20 -0
  365. package/packages/shared/src/._index.ts +0 -0
  366. package/packages/shared/src/index.ts +8 -0
  367. package/packages/shared/tsconfig.json +7 -0
  368. package/pnpm-lock.template.yaml +781 -846
  369. package/pnpm-workspace.template.yaml +19 -11
  370. package/profiles/._mall.json +0 -0
  371. package/profiles/mall/._TEMPLATE.md +0 -0
  372. package/profiles/mall/._chat.overrides.json +0 -0
  373. package/profiles/mall/chat.overrides.json +12 -0
  374. package/profiles/mall/config/._agent.jsonc +0 -0
  375. package/profiles/mall/config/._chat.json +0 -0
  376. package/profiles/mall/config/._knowledge.json +0 -0
  377. package/profiles/mall/config/chat.json +14 -6
  378. package/profiles/mall.json +2 -2
  379. package/scenarios/._README.md +0 -0
  380. package/scenarios/README.md +7 -0
  381. package/scripts/._assert-pack.mjs +0 -0
  382. package/scripts/._build.sh +0 -0
  383. package/scripts/._check-css-target.mjs +0 -0
  384. package/scripts/._check-fast.mjs +0 -0
  385. package/scripts/._check-workspace.mjs +0 -0
  386. package/scripts/._checks.json +0 -0
  387. package/scripts/._deliver.mjs +0 -0
  388. package/scripts/._dev-alipay.mjs +0 -0
  389. package/scripts/._dev.sh +0 -0
  390. package/scripts/._generate.mjs +0 -0
  391. package/scripts/._prepare.sh +0 -0
  392. package/scripts/._shell-probe.mjs +0 -0
  393. package/scripts/._smoke.mjs +0 -0
  394. package/scripts/._start.sh +0 -0
  395. package/scripts/._stop.sh +0 -0
  396. package/scripts/._storyboard.mjs +0 -0
  397. package/scripts/._verify-generated.mjs +0 -0
  398. package/scripts/assert-pack.mjs +48 -0
  399. package/scripts/check-css-target.mjs +54 -0
  400. package/scripts/check-fast.mjs +119 -0
  401. package/scripts/check-workspace.mjs +68 -19
  402. package/scripts/checks.json +627 -0
  403. package/scripts/deliver.mjs +183 -0
  404. package/scripts/dev-alipay.mjs +1 -1
  405. package/scripts/generate.mjs +3 -0
  406. package/scripts/lib/._chrome-pipe.mjs +0 -0
  407. package/scripts/lib/._geometry-kernel.mjs +0 -0
  408. package/scripts/lib/chrome-pipe.mjs +95 -0
  409. package/scripts/lib/geometry-kernel.mjs +137 -0
  410. package/scripts/shell-probe.mjs +280 -0
  411. package/scripts/storyboard.mjs +350 -0
  412. package/scripts/verify-generated.mjs +22 -127
  413. package/tsconfig.base.json +1 -0
  414. package/apps/client/STYLE_GUIDE.md +0 -81
  415. package/apps/client/VISUAL_RESTORE.md +0 -90
  416. package/apps/client/src/app.tsx +0 -11
  417. package/apps/client/src/business/App.tsx +0 -11
  418. package/apps/client/src/business/README.md +0 -99
  419. package/apps/client/src/business/routes.json +0 -3
  420. package/apps/client/src/main.tsx +0 -17
  421. package/apps/client/src/modules.ts +0 -33
  422. package/apps/client/src/platform/AgentChatApp.tsx +0 -14
  423. package/apps/client/src/platform/AppShell.tsx +0 -42
  424. package/apps/client/src/platform/agent-runtime.ts +0 -16
  425. package/apps/client/src/platform/bootstrap.ts +0 -55
  426. package/apps/client/src/platform/card-preview-page.tsx +0 -12
  427. package/apps/client/src/platform/mount-page.tsx +0 -25
  428. package/apps/client/src/platform/state/createPersistedStore.ts +0 -19
  429. package/apps/server/src/app-tools.ts +0 -14
  430. package/apps/server/src/modules.ts +0 -38
  431. package/apps/server/src/tools/clock.ts +0 -24
  432. package/apps/server/src/tools/translate.ts +0 -47
  433. package/packages/agent-ui-kit/src/ChatPage.less +0 -66
  434. package/packages/agent-ui-kit/src/components/ActionBar/index.less +0 -123
  435. package/packages/agent-ui-kit/src/components/ChatHeader/index.less +0 -148
  436. package/packages/agent-ui-kit/src/components/ChatInput/index.less +0 -394
  437. package/packages/agent-ui-kit/src/components/HistoryEntry/index.less +0 -49
  438. package/packages/agent-ui-kit/src/components/MediaList/index.less +0 -241
  439. package/packages/agent-ui-kit/src/components/MessageBubble/index.less +0 -325
  440. package/packages/agent-ui-kit/src/components/PullDownIndicator/index.less +0 -32
  441. package/packages/agent-ui-kit/src/components/QuickCommands/index.less +0 -63
  442. package/packages/agent-ui-kit/src/components/ReasoningBlock/index.less +0 -90
  443. package/packages/agent-ui-kit/src/components/ScrollToBottomButton/index.less +0 -32
  444. package/packages/agent-ui-kit/src/components/ToolCallBlock/index.less +0 -312
  445. package/packages/agent-ui-kit/src/theme/global.less +0 -99
  446. package/profiles/mall/config/llm_provider.json +0 -5
  447. package/profiles/mall/config/plugins.json +0 -3
  448. /package/{packages → modules}/provider-custom/LICENSE +0 -0
  449. /package/{packages → modules}/provider-custom/README.md +0 -0
  450. /package/{packages → modules}/provider-custom/src/index.ts +0 -0
  451. /package/{packages → modules}/provider-custom/tbox.module.json +0 -0
  452. /package/{packages → modules}/provider-custom/tests/provider-custom.test.ts +0 -0
  453. /package/{packages → modules}/provider-custom/tsconfig.json +0 -0
  454. /package/{packages → modules}/provider-custom/tsup.config.ts +0 -0
  455. /package/packages/agent-ui-kit/src/theme/{motion.less → motion.css} +0 -0
@@ -8,6 +8,7 @@
8
8
  packages:
9
9
  - apps/*
10
10
  - packages/*
11
+ - modules/*
11
12
 
12
13
  onlyBuiltDependencies:
13
14
  - esbuild
@@ -38,14 +39,17 @@ catalog:
38
39
  ws: 8.21.3
39
40
  "@types/ws": 8.18.1
40
41
  "@tbox.cn/agent-plugin": 0.1.0
41
- "@tbox.cn/app-sdk-core": 0.20.5
42
- "@tbox.cn/app-sdk-client": 0.21.4
43
- "@tbox.cn/app-sdk-server": 0.26.8
44
- "@tbox.cn/app-agent-sdk-server": 0.3.8
45
- "@tbox.cn/app-agent-sdk-client": 0.2.2
46
- "@tbox.cn/app-contracts": 0.13.5
47
- "@tbox.cn/app-contracts-mall": 0.18.0
48
- "@tbox.cn/app-theme-tbox": 0.1.6
42
+ "@tbox.cn/app-sdk-core": 1.0.0-alpha.10
43
+ "@tbox.cn/app-sdk-client": 1.0.0-alpha.10
44
+ "@tbox.cn/app-sdk-server": 1.0.0-alpha.10
45
+ "@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.10
46
+ "@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.10
47
+ "@tbox.cn/app-contracts": 1.0.0-alpha.10
48
+ "@tbox.cn/app-contracts-mall": 1.0.0-alpha.10
49
+ "@tbox.cn/app-theme-tbox": 1.0.0-alpha.10
50
+ "@tbox.cn/app-build": 1.0.0-alpha.10
51
+ "@tbox.cn/app-agent-ui-kit": 1.0.0-alpha.10
52
+ "@tbox.cn/app-cli": 1.0.0-alpha.10
49
53
  zustand: 4.5.7
50
54
  eslint: 9.39.5
51
55
  typescript-eslint: 8.67.0
@@ -56,13 +60,13 @@ catalog:
56
60
  "@types/cors": 2.8.19
57
61
  "@tbox-dev-js/sdk": 0.1.18
58
62
  "@vitejs/plugin-react": 4.7.0
59
- less: 4.8.1
63
+ tailwindcss: 4.3.5
64
+ "@tailwindcss/vite": 4.3.5
60
65
  "@phosphor-icons/react": 2.1.10
61
- antd-mobile: 5.42.3
66
+ yet-another-react-lightbox: 3.33.1
62
67
  react-markdown: 9.1.0
63
68
  remark-gfm: 4.0.1
64
69
  happy-dom: 20.11.2
65
- postcss-pxtorem: 6.1.0
66
70
 
67
71
  # debug 钉版止血(与根 pnpm-workspace.yaml 同步维护;见 2026-09-16-ci-internal-registry-pollution.md):
68
72
  # 模板锁种子投影会清 overrides 段致 debug 重解析为 4.4.3(R5 子集校验失败),故模板必须同携此键;
@@ -70,3 +74,7 @@ catalog:
70
74
  # 平台修复内网 registry 数据后随根一并移除。
71
75
  overrides:
72
76
  "debug@4.4.3": "4.4.1"
77
+ # 应用自带 agent-ui-kit 源码(packages/agent-ui-kit);模块把它声明为 optional peer,
78
+ # 不指向本地副本就会去 registry 装旧版(旧版仍是 .less + 750 设计稿 px,需要 less/pxtorem)。
79
+ # 指向本副本后整条链不再有 .less、也不需要 pxtorem。
80
+ "@tbox.cn/app-agent-ui-kit": "link:packages/agent-ui-kit"
Binary file
Binary file
@@ -0,0 +1,12 @@
1
+ {
2
+ "$comment": "mall 画像的 chat 增量(生成 profiles/mall/config/chat.json;改这里后在模板仓根跑 node scripts/sync-profile-config.mjs)。身份/欢迎语/重试等展示面继承模板 base,不在本文件重复。",
3
+ "enableImageUpload": false,
4
+ "enableVideoUpload": false,
5
+ "enableTTS": false,
6
+ "enableVoiceInput": true,
7
+ "quickCommands": [
8
+ { "label": "今日优惠", "query": "现在有什么优惠?" },
9
+ { "label": "品牌导览", "query": "品牌导览" },
10
+ { "label": "活动中心", "query": "活动中心" }
11
+ ]
12
+ }
Binary file
@@ -1,9 +1,13 @@
1
1
  {
2
- "enableImageUpload": false,
3
- "enableVideoUpload": false,
4
- "enableTTS": false,
5
- "enableVoiceInput": true,
6
- "defaultInputMode": "TEXT",
2
+ "identity": {
3
+ "name": "悦享里",
4
+ "tagline": "商圈智能服务"
5
+ },
6
+ "welcome": {
7
+ "title": "今天想逛点什么?",
8
+ "subtitle": "停车、入会、积分、商户、导航、活动和优惠券都能问我"
9
+ },
10
+ "retryOnError": true,
7
11
  "quickCommands": [
8
12
  {
9
13
  "label": "今日优惠",
@@ -17,5 +21,9 @@
17
21
  "label": "活动中心",
18
22
  "query": "活动中心"
19
23
  }
20
- ]
24
+ ],
25
+ "enableImageUpload": false,
26
+ "enableVideoUpload": false,
27
+ "enableTTS": false,
28
+ "enableVoiceInput": true
21
29
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "$comment": "mall 画像(单一模板统一化 W4):create --profile mall 执行器(W5 接线)按 modules 序列加装 + configOverlay 叠加(--config-dir 通道)+ rootFiles 根文件落地(TEMPLATE.md 使用指南 → 应用根)。provider 轴独立(缺省 mock-only 演示态;vendor 档由部署者后续 add)。",
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)。",
3
3
  "name": "mall",
4
- "description": "商圈 AI Agent:家页形态(home 槽)+ 域装配 + 七业务域(门店导览/会员/停车/营销/活动/客服/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",
Binary file
@@ -0,0 +1,7 @@
1
+ # scenarios
2
+
3
+ 联动链路的可执行断言:一个 JSON 一个场景,`pnpm scenario` 与 `pnpm check:fast` 都会跑。
4
+
5
+ - 写法、`policy` 与 `handoff` 见 `docs/agent/verify.md`;录制用 `pnpm exec tbox-app scenario record <名称> --steps "tool-id{} action:action-id{}"`。
6
+ - 断言只写稳定字段(业务结果、卡片序列),不要写时间戳、随机 id。
7
+ - 场景直调工具与动作,不连端口、不调模型、不开浏览器——它是构建自检的一部分。
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * assert-pack — 发布前制品卫生断言(prepack 钩子)。
4
+ *
5
+ * 模板包曾带 430 个 tar 条目、其中 215 个 AppleDouble(._*):生成应用首轮 check:fast
6
+ * 直接以「Parsing error: Invalid character」失败,Agent 先删 207 个文件才继续。
7
+ * 这里在打包前把工作树里的垃圾判掉——修不了源头,就不要发出去。
8
+ *
9
+ * 退出码:0 = 干净;1 = 有垃圾(列出前 20 个)。
10
+ */
11
+ import { readdirSync, statSync } from 'node:fs';
12
+ import path from 'node:path';
13
+ import process from 'node:process';
14
+
15
+ const root = path.resolve(import.meta.dirname, '..');
16
+ const SKIP_DIRS = new Set(['node_modules', 'dist', 'dist-ssr', '.git', '.tbox-gen', '.vite']);
17
+ // 运行产物目录不阻断(files 已排除、create 也会过滤);只把 macOS 垃圾判死。
18
+ const NOTE_DIRS = new Set(['card-render', 'evidence', 'state']);
19
+ const junk = [];
20
+ const notes = [];
21
+
22
+ function walk(dir, rel = '') {
23
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
24
+ const name = entry.name;
25
+ const nextRel = rel ? rel + '/' + name : name;
26
+ if (entry.isDirectory()) {
27
+ if (SKIP_DIRS.has(name)) continue;
28
+ if (rel === '.tbox' && NOTE_DIRS.has(name)) {
29
+ notes.push(nextRel + '/');
30
+ continue;
31
+ }
32
+ walk(path.join(dir, name), nextRel);
33
+ continue;
34
+ }
35
+ if (name.startsWith('._') || name === '.DS_Store') junk.push(nextRel);
36
+ }
37
+ }
38
+
39
+ walk(root);
40
+
41
+ if (junk.length > 0) {
42
+ console.error('❌ 模板包里有 ' + junk.length + ' 个制品垃圾(AppleDouble / Finder / 运行产物):');
43
+ for (const item of junk.slice(0, 20)) console.error(' - ' + item);
44
+ console.error(' 修复:删掉它们(macOS 上用 COPYFILE_DISABLE=1 打包),再重试。');
45
+ process.exitCode = 1;
46
+ } else {
47
+ console.log('✅ 制品卫生:没有 ._* / .DS_Store' + (notes.length > 0 ? '(运行产物目录 ' + notes.join('、') + ' 由 files 排除)' : ''));
48
+ }
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * check-css-target — 产物兼容门禁(多引擎矩阵 + 兜底后能力)。
4
+ *
5
+ * 读 `apps/client/dist/assets/*.css`,按模板 `package.json` 的 `tbox.compat.baseline` 判定:
6
+ * baseline = { "safari": 16.4, "chrome": 105 } // 矩阵;缺任一引擎即判基线非法
7
+ * 判定内核在 `@tbox.cn/app-build/compat`(与根级 `verify:css` 同一份实现):
8
+ * - 所有声明引擎都满足才算通过(AND,不是任一引擎通过);
9
+ * - 先剥掉 `@supports` 条件块再判,条件块内属于渐进增强。
10
+ * **缺产物 = 失败**(fail-closed):没有证据不得放行。
11
+ *
12
+ * 用法:node scripts/check-css-target.mjs [--baseline "safari 16.4, chrome 105"] [--json]
13
+ * 退出码:0 = 产物在基线内;1 = 越线 / 基线非法 / 无产物。
14
+ */
15
+ import { readFileSync } from 'node:fs';
16
+ import path from 'node:path';
17
+ import process from 'node:process';
18
+ import { checkDist, formatBaseline } from '@tbox.cn/app-build/compat';
19
+
20
+ const appDir = path.resolve(import.meta.dirname, '..');
21
+ const args = process.argv.slice(2);
22
+ const asJson = args.includes('--json');
23
+ const baselineArg = args.indexOf('--baseline');
24
+ const pkg = JSON.parse(readFileSync(path.join(appDir, 'package.json'), 'utf8'));
25
+ const baseline = baselineArg >= 0 ? args[baselineArg + 1] : pkg?.tbox?.compat?.baseline;
26
+ const result = checkDist({ appDir, baseline });
27
+
28
+ if (asJson) {
29
+ console.log(
30
+ JSON.stringify(
31
+ {
32
+ ok: result.ok,
33
+ baseline: formatBaseline(baseline),
34
+ engines: result.engines,
35
+ files: result.files.length,
36
+ bytes: result.totalBytes,
37
+ errors: result.errors,
38
+ findings: result.findings,
39
+ },
40
+ null,
41
+ 2,
42
+ ),
43
+ );
44
+ } else if (result.ok) {
45
+ console.log(`✅ 产物在基线内:${formatBaseline(baseline)}(${result.files.length} 个 CSS,${result.totalBytes} B)`);
46
+ } else {
47
+ for (const error of result.errors) console.error(`❌ ${error}`);
48
+ for (const finding of result.findings) {
49
+ console.error(
50
+ `❌ ${finding.file} ${finding.feature}(${finding.sample}):${finding.message}——${finding.fix}`,
51
+ );
52
+ }
53
+ }
54
+ process.exitCode = result.ok ? 0 : 1;
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * check:fast — 开发期秒级回路(T0,构建自检)。
4
+ *
5
+ * 顺序:生成 → eslint --fix → [类型检查(并行,按包)| 结构检查 | 证据包]。
6
+ * 类型检查在 lint 修复之后跑,避免 --fix 改文件与 tsc 读文件竞争;开发期放宽未用变量,
7
+ * 交付前的 `pnpm verify` 仍按严格 tsconfig 检。
8
+ *
9
+ * 成功时输出一行 JSON 摘要,自带证据:各步耗时、注册清单、告警、未运行的检查。
10
+ * 失败时输出失败步骤的完整输出并以非零退出。
11
+ *
12
+ * 「用户说不要测试」指不起 dev server、不开浏览器、不写测试文件;本脚本属于构建,照常运行。
13
+ * 与 `pnpm verify` 的分工:verify 是交付前全量(含 build 与 smoke),本脚本只做「改完一批就能跑」的层。
14
+ */
15
+ import { spawn } from 'node:child_process';
16
+ import path from 'node:path';
17
+ import process from 'node:process';
18
+
19
+ const appDir = path.resolve(process.argv[2] ?? path.join(import.meta.dirname, '..'));
20
+
21
+ function run(command, args, { cwd = appDir, env = process.env } = {}) {
22
+ return new Promise((resolve) => {
23
+ const started = Date.now();
24
+ const child = spawn(command, args, { cwd, env, shell: false, stdio: ['ignore', 'pipe', 'pipe'] });
25
+ let out = '';
26
+ child.stdout.on('data', (chunk) => (out += chunk));
27
+ child.stderr.on('data', (chunk) => (out += chunk));
28
+ child.on('error', (error) => resolve({ ok: false, ms: Date.now() - started, out: `${command}: ${error.message}` }));
29
+ child.on('close', (code) => resolve({ ok: code === 0, ms: Date.now() - started, out }));
30
+ });
31
+ }
32
+
33
+ async function main() {
34
+ const started = Date.now();
35
+ const steps = [];
36
+
37
+ const generate = await run('node', ['scripts/generate.mjs']);
38
+ steps.push({ name: 'generate', ms: generate.ms, ok: generate.ok });
39
+ if (!generate.ok) return fail('generate', generate);
40
+
41
+ const lint = await run('pnpm', ['exec', 'eslint', 'apps', 'packages', '--fix', '--quiet']);
42
+ steps.push({ name: 'lint', ms: lint.ms, ok: lint.ok });
43
+ if (!lint.ok) return fail('lint', lint);
44
+
45
+ const packages = ['apps/server', 'apps/client', 'packages/shared', 'packages/agent-ui-kit'];
46
+ const typecheck = (p) =>
47
+ run('pnpm', ['exec', 'tsc', '--noEmit', '-p', `${p}/tsconfig.json`, '--noUnusedLocals', 'false', '--noUnusedParameters', 'false']);
48
+ const typechecks = Promise.all(packages.map(typecheck));
49
+ const structure = run('node', ['scripts/verify-generated.mjs']);
50
+ const evidence = run('node', ['scripts/check-evidence.mjs'], {
51
+ cwd: path.join(appDir, 'apps/client'),
52
+ env: { ...process.env, TBOX_STATE_MEMORY: '1' },
53
+ });
54
+
55
+ const [typecheckResults, structureResult, evidenceResult] = await Promise.all([typechecks, structure, evidence]);
56
+ const typecheckOk = typecheckResults.every((result) => result.ok);
57
+ steps.push({ name: 'typecheck', ms: Math.max(...typecheckResults.map((result) => result.ms)), ok: typecheckOk });
58
+ steps.push({ name: 'structure', ms: structureResult.ms, ok: structureResult.ok });
59
+ const parsed = parseEvidence(evidenceResult.out);
60
+ steps.push({ name: 'evidence', ms: evidenceResult.ms, ok: evidenceResult.ok, steps: parsed?.steps });
61
+
62
+ if (!typecheckOk) {
63
+ const failed = packages.filter((_, index) => !typecheckResults[index].ok);
64
+ return fail('typecheck', { out: packages.map((p, index) => (typecheckResults[index].ok ? '' : `--- ${p}\n${typecheckResults[index].out}`)).join('\n') }, failed);
65
+ }
66
+ if (!structureResult.ok) return fail('structure', structureResult);
67
+ if (!evidenceResult.ok) return fail('evidence', evidenceResult, [], parsed);
68
+
69
+ const summary = {
70
+ ok: true,
71
+ durationMs: Date.now() - started,
72
+ steps,
73
+ registry: parsed?.registry ?? {},
74
+ warnings: parsed?.warnings ?? [],
75
+ ...(parsed?.verdict ? { verdict: parsed.verdict, acceptance: parsed.acceptance, next: parsed.next } : {}),
76
+ // E1/E2/C3:覆盖面、证据策略、能力图缺口与移交清单都随摘要向上传(调用方与 harness 只读这一行)。
77
+ ...(parsed?.policy ? { policy: parsed.policy } : {}),
78
+ ...(parsed?.coverage ? { coverage: parsed.coverage } : {}),
79
+ ...(parsed?.capabilities ? { capabilities: parsed.capabilities } : {}),
80
+ ...(parsed?.handoff ? { handoff: parsed.handoff } : {}),
81
+ ...(parsed?.sinceDeliverable ? { sinceDeliverable: parsed.sinceDeliverable } : {}),
82
+ ...(parsed?.notRun?.length ? { notRun: parsed.notRun } : {}),
83
+ ...(parsed?.delivery ? { delivery: parsed.delivery } : {}),
84
+ };
85
+ process.stdout.write(`${JSON.stringify(summary)}\n`);
86
+ return undefined;
87
+ }
88
+
89
+ /** 证据脚本的 stdout 里最后一行是 JSON 摘要;其余是给人看的告警。 */
90
+ function parseEvidence(out) {
91
+ const lines = String(out ?? '').trim().split('\n');
92
+ for (let i = lines.length - 1; i >= 0; i -= 1) {
93
+ const line = lines[i].trim();
94
+ if (!line.startsWith('{')) continue;
95
+ try {
96
+ return JSON.parse(line);
97
+ } catch {
98
+ continue;
99
+ }
100
+ }
101
+ return undefined;
102
+ }
103
+
104
+ function fail(step, result, extra = [], parsed) {
105
+ process.stdout.write(
106
+ `${JSON.stringify({
107
+ ok: false,
108
+ step,
109
+ durationMs: null,
110
+ ...(extra.length ? { packages: extra } : {}),
111
+ ...(parsed?.errors ? { errors: parsed.errors } : {}),
112
+ ...(parsed?.warnings ? { warnings: parsed.warnings } : {}),
113
+ })}\n`,
114
+ );
115
+ if (result?.out) process.stderr.write(result.out);
116
+ process.exitCode = 1;
117
+ }
118
+
119
+ await main();
@@ -31,25 +31,52 @@ const nestedLockfiles = new Set([
31
31
  const viteConfigPattern = /^vite\.config\.(?:js|mjs|cjs|ts|mts|cts)$/;
32
32
 
33
33
  /**
34
- * CLI 裸简写防线:应用文档里不得出现 `tbox-app <cmd>`(agent 照抄后 PATH 无 bin → 命令失败)。
35
- * 唯一合法形态 = `npx --yes @tbox.cn/app-cli <cmd>`;`tbox-app-dev`(私有 CLI)不匹配。
34
+ * CLI 调用形态防线:应用内唯一合法形态 = `pnpm exec tbox-app <cmd>`(CLI 是项目 devDependency,
35
+ * 版本与 SDK 同批)。两类违规:
36
+ * - `pnpm exec tbox-app`:绕过项目锁定版本,取 latest,且离线环境不可用;
37
+ * - 裸 `tbox-app <cmd>`:PATH 无该 bin,agent 照抄后命令失败。
38
+ * 扫描面 = 应用内全部 .md / .mjs / .json / .jsonc(排除 node_modules、dist、.tbox-gen、锁文件)。
36
39
  */
37
- const bareCliPattern = /\btbox-app\s+(?:module|provider|theme|starter|new|create|schema|skills|doctor|miniapp-container)\b/g;
38
- const cliDocFiles = [
39
- 'AGENTS.md',
40
- 'README.md',
41
- 'ENV.md',
42
- 'TEMPLATE.md',
43
- 'apps/client/src/business/README.md',
44
- ];
40
+ const cliVerb = '(?:module|provider|theme|starter|new|create|schema|skills|doctor|miniapp-container|api|context|check|tool|scenario|card)';
41
+ const cliCmdPattern = new RegExp(`(^|[^\\w-])tbox-app\\s+${cliVerb}\\b`, 'g');
42
+ const npxCliPattern = /npx\s+(?:--yes\s+)?@tbox\.cn\/app-cli\b/g;
43
+ const cliScanSkipDirs = new Set(['node_modules', 'dist', 'dist-ssr', '.tbox-gen', '.git', '.vite', '.playwright']);
44
+ const cliScanExts = new Set(['.md', '.mjs', '.json', '.jsonc']);
45
+
46
+ async function collectScanFiles(dir, out) {
47
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
48
+ if (entry.name.startsWith('.') && entry.name !== '.tbox') continue;
49
+ const child = path.join(dir, entry.name);
50
+ if (entry.isDirectory()) {
51
+ if (cliScanSkipDirs.has(entry.name)) continue;
52
+ await collectScanFiles(child, out);
53
+ continue;
54
+ }
55
+ if (!cliScanExts.has(path.extname(entry.name))) continue;
56
+ if (entry.name === 'pnpm-lock.template.yaml' || entry.name === 'pnpm-lock.yaml') continue;
57
+ out.push(child);
58
+ }
59
+ }
45
60
 
46
61
  async function checkCliShorthand(findings) {
47
- for (const rel of cliDocFiles) {
48
- const file = path.join(projectDir, rel);
49
- if (!existsSync(file)) continue;
62
+ const files = [];
63
+ await collectScanFiles(projectDir, files);
64
+ for (const file of files) {
50
65
  const text = await readFile(file, 'utf8');
51
- for (const match of text.matchAll(bareCliPattern)) {
52
- findings.bareCliShorthands.push(`${rel}: ${match[0]}`);
66
+ const rel = path.relative(projectDir, file).split(path.sep).join('/');
67
+ for (const match of text.matchAll(npxCliPattern)) {
68
+ const at = (match.index ?? 0) + match[0].length;
69
+ // 例外:`create` 是项目存在之前唯一的命令,此时无本地 CLI 可用
70
+ if (/^\s+create\b/.test(text.slice(at, at + 24))) continue;
71
+ findings.cliInvocations.push(`${rel}: npx 形态(改用 pnpm exec tbox-app)`);
72
+ }
73
+ for (const match of text.matchAll(cliCmdPattern)) {
74
+ const localAt = match[0].indexOf('tbox-app');
75
+ const at = (match.index ?? 0) + localAt;
76
+ const before = text.slice(Math.max(0, at - 8), at);
77
+ // `pnpm exec ` 前缀 = 合法;紧邻 `-` = 包名片段(如 @tbox.cn/app-cli)
78
+ if (/exec\s$/.test(before) || /-$/.test(before)) continue;
79
+ findings.cliInvocations.push(`${rel}: ${match[0].trim()}(缺 pnpm exec 前缀)`);
53
80
  }
54
81
  }
55
82
  }
@@ -119,15 +146,35 @@ function printFailure(findings) {
119
146
  console.error('\npackages/* 缺少 tbox.module.json(contracts / app-sdk / shared 除外):');
120
147
  for (const file of findings.missingModuleDescriptors) console.error(` - ${file}`);
121
148
  }
122
- if (findings.bareCliShorthands.length > 0) {
123
- console.error('\n检测到 CLI 裸简写(须写全 npx --yes @tbox.cn/app-cli <cmd>):');
124
- for (const item of findings.bareCliShorthands) console.error(` - ${item}`);
149
+ if (findings.cliInvocations.length > 0) {
150
+ console.error('\n检测到非规范的 CLI 调用(唯一合法形态:pnpm exec tbox-app <cmd>):');
151
+ for (const item of findings.cliInvocations) console.error(` - ${item}`);
152
+ }
153
+ if (findings.sourceBuildInfo.length > 0) {
154
+ console.error('\n检测到落在源码目录的 *.tsbuildinfo(会把递归检索变成超大单行文件):');
155
+ for (const file of findings.sourceBuildInfo) console.error(` - ${file}`);
156
+ console.error(' 处理:删掉这些文件;tsconfig.base.json 已把 tsBuildInfoFile 指到 node_modules/.cache/tsc。');
125
157
  }
126
158
 
127
159
  console.error('');
128
160
  process.exitCode = 1;
129
161
  }
130
162
 
163
+ /** 源码目录里的 *.tsbuildinfo:grep 的隐形地雷(单个文件可达 1 MB 单行)。 */
164
+ async function checkSourceBuildInfo(projectDir, findings) {
165
+ const roots = ['apps', 'packages', 'modules'].map((dir) => path.join(projectDir, dir));
166
+ const walkDir = async (dir) => {
167
+ if (!existsSync(dir)) return;
168
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
169
+ if (entry.name === 'node_modules' || entry.name === 'dist' || entry.name === '.tbox-gen') continue;
170
+ const child = path.join(dir, entry.name);
171
+ if (entry.isDirectory()) await walkDir(child);
172
+ else if (entry.name.endsWith('.tsbuildinfo')) findings.sourceBuildInfo.push(path.relative(projectDir, child));
173
+ }
174
+ };
175
+ for (const root of roots) await walkDir(root);
176
+ }
177
+
131
178
  /** 豁免:SDK/契约/UI-Kit 包无 tbox.module.json(002 §2.3 / 003 §4.1;kit 为壳 UI 源码包,
132
179
  * 单一模板统一化——无模块贡献面,非业务模块) */
133
180
  function isExemptPackage(dirName) {
@@ -175,12 +222,14 @@ async function main() {
175
222
  nestedLockfiles: [],
176
223
  detachedViteConfigs: [],
177
224
  missingModuleDescriptors: [],
178
- bareCliShorthands: [],
225
+ cliInvocations: [],
226
+ sourceBuildInfo: [],
179
227
  };
180
228
 
181
229
  await walk(projectDir, findings);
182
230
  await checkModuleDescriptors(projectDir, findings);
183
231
  await checkCliShorthand(findings);
232
+ await checkSourceBuildInfo(projectDir, findings);
184
233
 
185
234
  if (Object.values(findings).some((items) => items.length > 0)) {
186
235
  printFailure(findings);