@tbox.cn/app-template-agent 1.0.0-alpha.15 → 1.0.0-alpha.17

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 (90) hide show
  1. package/.gitignore +2 -0
  2. package/.tbox/app.json +1 -1
  3. package/.tbox/cache/._apps-client-strict.tsbuildinfo +0 -0
  4. package/.tbox/cache/._apps-client.tsbuildinfo +0 -0
  5. package/.tbox/cache/._apps-server-strict.tsbuildinfo +0 -0
  6. package/.tbox/cache/._apps-server.tsbuildinfo +0 -0
  7. package/.tbox/cache/._packages-agent-ui-kit-strict.tsbuildinfo +0 -0
  8. package/.tbox/cache/._packages-agent-ui-kit.tsbuildinfo +0 -0
  9. package/.tbox/cache/._packages-shared-strict.tsbuildinfo +0 -0
  10. package/.tbox/cache/._packages-shared.tsbuildinfo +0 -0
  11. package/.tbox/cache/apps-client-strict.tsbuildinfo +1 -0
  12. package/.tbox/cache/apps-client.tsbuildinfo +1 -0
  13. package/.tbox/cache/apps-server-strict.tsbuildinfo +1 -0
  14. package/.tbox/cache/apps-server.tsbuildinfo +1 -0
  15. package/.tbox/cache/packages-agent-ui-kit-strict.tsbuildinfo +1 -0
  16. package/.tbox/cache/packages-agent-ui-kit.tsbuildinfo +1 -0
  17. package/.tbox/cache/packages-shared-strict.tsbuildinfo +1 -0
  18. package/.tbox/cache/packages-shared.tsbuildinfo +1 -0
  19. package/.tbox/default-modules.json +1 -1
  20. package/.tbox/miniapp-containers.json +1 -1
  21. package/AGENTS.md +4 -0
  22. package/apps/client/scripts/._home-preset-wiring.test.ts +0 -0
  23. package/apps/client/scripts/._home-preset-wiring.ts +0 -0
  24. package/apps/client/scripts/._static-checks.test.mjs +0 -0
  25. package/apps/client/scripts/acceptance-changes.test.mjs +16 -3
  26. package/apps/client/scripts/check-evidence.mjs +69 -7
  27. package/apps/client/scripts/evidence-gate.mjs +9 -6
  28. package/apps/client/scripts/experience-checks.mjs +139 -0
  29. package/apps/client/scripts/geometry-kernel.test.mjs +3 -1
  30. package/apps/client/scripts/home-preset-wiring.test.ts +61 -0
  31. package/apps/client/scripts/home-preset-wiring.ts +41 -0
  32. package/apps/client/scripts/in-process-checks.mjs +100 -1
  33. package/apps/client/scripts/probe-checks.mjs +1 -0
  34. package/apps/client/scripts/static-checks.test.mjs +219 -0
  35. package/apps/client/src/cards/._home-preset.test.ts +0 -0
  36. package/apps/client/src/cards/._home-preset.ts +0 -0
  37. package/apps/client/src/cards/home-preset.test.ts +40 -0
  38. package/apps/client/src/cards/home-preset.ts +19 -0
  39. package/apps/client/src/cards/registry.ts +10 -3
  40. package/apps/client/src/pages/index/index.tsx +1 -1
  41. package/apps/client/src/styles/tailwind.css +3 -1
  42. package/apps/client/tsconfig.json +1 -0
  43. package/apps/client/vite.config.ts +15 -5
  44. package/apps/server/scripts/scenario-lib.mjs +12 -1
  45. package/config/._agent.jsonc +0 -0
  46. package/config/agent.jsonc +10 -0
  47. package/docs/agent/card-action.md +5 -1
  48. package/docs/agent/card.md +7 -1
  49. package/docs/agent/errors.md +7 -1
  50. package/docs/agent/kit.md +7 -6
  51. package/docs/agent/shell.md +3 -1
  52. package/docs/agent/style.md +37 -0
  53. package/docs/agent/verify.md +5 -2
  54. package/package.json +5 -4
  55. package/packages/agent-ui-kit/catalog.json +134 -5
  56. package/packages/agent-ui-kit/package.json +1 -1
  57. package/packages/agent-ui-kit/src/._contract.test.tsx +0 -0
  58. package/packages/agent-ui-kit/src/ChatPage.tsx +204 -27
  59. package/packages/agent-ui-kit/src/card/._confirm-fields.test.tsx +0 -0
  60. package/packages/agent-ui-kit/src/card/confirm-fields.test.tsx +106 -0
  61. package/packages/agent-ui-kit/src/card/primitives.tsx +270 -59
  62. package/packages/agent-ui-kit/src/card/use-card-actions.ts +5 -1
  63. package/packages/agent-ui-kit/src/card/view-card.tsx +113 -22
  64. package/packages/agent-ui-kit/src/chat-config.ts +2 -0
  65. package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.tsx +12 -4
  66. package/packages/agent-ui-kit/src/components/ActionBar/index.tsx +61 -27
  67. package/packages/agent-ui-kit/src/components/BottomSheet/index.tsx +26 -2
  68. package/packages/agent-ui-kit/src/components/QuickCommands/index.tsx +60 -14
  69. package/packages/agent-ui-kit/src/components/ToolCallBlock/detail.test.ts +2 -0
  70. package/packages/agent-ui-kit/src/components/ToolCallBlock/detail.ts +9 -2
  71. package/packages/agent-ui-kit/src/contract.test.tsx +176 -0
  72. package/packages/agent-ui-kit/src/hooks/use-stick-to-bottom.test.tsx +101 -0
  73. package/packages/agent-ui-kit/src/hooks/use-stick-to-bottom.ts +35 -7
  74. package/packages/agent-ui-kit/src/index.ts +2 -0
  75. package/packages/agent-ui-kit/src/overlay/Overlay.tsx +21 -2
  76. package/packages/agent-ui-kit/src/overlay/overlay.test.tsx +15 -0
  77. package/packages/agent-ui-kit/src/preview-provider.tsx +8 -0
  78. package/packages/agent-ui-kit/src/shell.contract.json +1 -1
  79. package/packages/agent-ui-kit/src/shell.test.ts +105 -2
  80. package/packages/agent-ui-kit/src/theme/base.css +42 -2
  81. package/pnpm-lock.template.yaml +94 -94
  82. package/pnpm-workspace.template.yaml +11 -11
  83. package/scripts/._interaction-probe.mjs +0 -0
  84. package/scripts/check-fast.mjs +11 -2
  85. package/scripts/checks.json +80 -2
  86. package/scripts/deliver.mjs +85 -7
  87. package/scripts/interaction-probe.mjs +222 -0
  88. package/scripts/lib/geometry-kernel.mjs +8 -1
  89. package/scripts/shell-probe.mjs +8 -3
  90. package/scripts/storyboard.mjs +5 -0
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../packages/shared/src/index.ts"],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},"fd02581a128182857d71cf1fc2ad61d086ca0d5499990ab2d1483309876bfee1"],"root":[60],"options":{"allowImportingTsExtensions":true,"esModuleInterop":true,"module":99,"noFallthroughCasesInSwitch":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"../../packages/shared/src","skipLibCheck":true,"strict":true,"target":9,"tsBuildInfoFile":"./packages-shared-strict.tsbuildinfo","useDefineForClassFields":true},"affectedFilesPendingEmit":[60],"version":"5.9.3"}
@@ -0,0 +1 @@
1
+ {"fileNames":["../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../packages/shared/src/index.ts"],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},"fd02581a128182857d71cf1fc2ad61d086ca0d5499990ab2d1483309876bfee1"],"root":[60],"options":{"allowImportingTsExtensions":true,"esModuleInterop":true,"module":99,"noFallthroughCasesInSwitch":true,"noUnusedLocals":false,"noUnusedParameters":false,"rootDir":"../../packages/shared/src","skipLibCheck":true,"strict":true,"target":9,"tsBuildInfoFile":"./packages-shared.tsbuildinfo","useDefineForClassFields":true},"affectedFilesPendingEmit":[60],"version":"5.9.3"}
@@ -1,6 +1,6 @@
1
1
  [
2
2
  {
3
3
  "package": "@tbox.cn/app-module-ai-payment",
4
- "version": "1.0.0-alpha.15"
4
+ "version": "1.0.0-alpha.17"
5
5
  }
6
6
  ]
@@ -1,6 +1,6 @@
1
1
  [
2
2
  {
3
3
  "platform": "alipay",
4
- "source": "@tbox.cn/app-miniapp-container-alipay@1.0.0-alpha.15"
4
+ "source": "@tbox.cn/app-miniapp-container-alipay@1.0.0-alpha.17"
5
5
  }
6
6
  ]
package/AGENTS.md CHANGED
@@ -8,7 +8,10 @@
8
8
  - **模型由平台托管**:需求里的「不需要 API Key」指不用自配密钥,不等于不用模型。
9
9
  - **不读 `node_modules`**:API 形状查 `docs/agent/` 或 `pnpm exec tbox-app api <符号>`,约定查 `docs/agent/`。读构建产物反推是最慢的路径。
10
10
  - 先跑通一片再铺开:验收项 → 领域与状态 → 第一项能力整条竖切(卡片 + 工具 + 动作 + 一条场景)→ `pnpm check:fast` → 其余能力成批写。每步都有固定成本(首 token 等待),一次只写一个文件是最贵的写法;但把全部写完才首验更贵——首验越晚,返工越大。开发期不跑 `pnpm build`。
11
+ - **按域整批并行写**:首验通过后,一轮写一个完整域(该域的 tool + card + action + 场景,约 6–10 个文件),不要逐文件串行写——串行写 20 个文件就是 20 次首 token 等待。
12
+ - **跑完 `brief` 直接开工**:不要批量 `cat docs/agent/*.md`(一次 60KB+ 会把上下文推到 100K 以上,之后每一步都更慢);只有遇到具体报错时按 `errors.md` 查对应那一篇。
11
13
  - 卡片默认写视图卡:`defineViewCard` + `view(data)`,一张卡只有服务端一个文件(客户端由 app-build 派生);只有需要局部自定义图形或富交互时才写 `defineCard` + tsx 三件套。
14
+ - **动作结果卡的落点**:`cardResult(card, data, { placement, replaceKey, notice })`——`timeline`(缺省)追加在对话流末尾并滚入视口;`sheet` 进半屏抽屉(详情、完整券包);`top` 只给业务旁路欢迎卡。反复触发的结果卡必须给 `replaceKey`(同键原位替换,不叠重复卡);改动了同会话别处状态时带 `invalidateCardTypes`。
12
15
  - **动手前先跑一次 `pnpm exec tbox-app brief`**:应用现状、核心 API 签名、基元、壳契约、样式变量、命令、配方索引都在里面。
13
16
  - **不读源码**:`packages/agent-ui-kit/src`、`apps/server/src/app.ts`、`README.md`、`.tbox-gen`、`tgz` 都不必读——装配由平台生成,写法以简报与配方为准。
14
17
  - **交付纪律**:实现前先把需求拆成 `scenarios/acceptance.jsonc` 的验收项;开发期用 `pnpm check:fast`,交付时用 `pnpm deliver`(裁决 + 摘要 + DELIVERY.md,**只跑一次**)。`verdict: "deliverable"` 即交付,交付后不再逐行复审;门禁内部已跑过 `check:fast` 与 storyboard,不要再单独跑 `deliver` 或 `storyboard`。摘要里的 `handoff`、`notRun` 与 `delivery.deferred` 是当前策略验不了的项——原样写进交付说明,不要用读代码代替验证;标 `advisory` 的告警可以不处理,交付后由人决定。
@@ -96,6 +99,7 @@ export const clientModule = { cards: {}, register(ctx) {} } satisfies ClientModu
96
99
  ```sh
97
100
  pnpm check:fast # 生成 → 类型 → lint 修复 → 结构 → 证据包(样式/原语/真渲染/场景;开发期主力,秒级)
98
101
  pnpm probe:shell # 壳体验探针(390 宽:无固定区 / 输入框行数 / 贴底跟随;无 Chrome 记 not-run,TBOX_PROBE_REQUIRED=1 时直接失败)
102
+ pnpm probe:interaction # 弹层命中探针(真 Chrome 量 elementFromPoint,含 prefers-reduced-motion;改弹层/按钮后跑)
99
103
  pnpm deliver # 交付:裁决 + 摘要 + DELIVERY.md(交付唯一入口)
100
104
  pnpm scenario # 跑 scenarios/*.json(进程内,零端口零模型)
101
105
  pnpm generate # 生成 manifest/registry/entries
@@ -75,16 +75,29 @@ describe('验收变更(D4)', () => {
75
75
  });
76
76
 
77
77
  describe('出厂模块偏离(D4)', () => {
78
- it('少了出厂模块 → module-removed;新增 → module-added', () => {
78
+ it('少了出厂模块 → module-removed', () => {
79
79
  const drift = defaultModuleDrift({
80
80
  factory: [{ package: '@tbox.cn/app-module-ai-payment', version: '1.0.0' }],
81
- actual: [{ package: '@tbox.cn/app-module-custom' }],
81
+ actual: [],
82
82
  });
83
83
  expect(drift.skipped).toBe(false);
84
- expect(drift.items.map((item) => item.kind)).toEqual(['module-removed', 'module-added']);
84
+ expect(drift.items.map((item) => item.kind)).toEqual(['module-removed']);
85
85
  expect(drift.items[0].key).toBe('@tbox.cn/app-module-ai-payment');
86
86
  });
87
87
 
88
+ it('用户自己加装的模块不算偏离(否则 mall 画像/ provider-custom 会给每份交付加噪音)', () => {
89
+ const drift = defaultModuleDrift({
90
+ factory: [{ package: '@tbox.cn/app-module-ai-payment', version: '1.0.0' }],
91
+ actual: [
92
+ { package: '@tbox.cn/app-module-ai-payment' },
93
+ { package: '@tbox.cn/app-module-mall-core' },
94
+ { package: '@tbox.cn/app-provider-custom' },
95
+ ],
96
+ });
97
+ expect(drift.skipped).toBe(false);
98
+ expect(drift.items).toEqual([]);
99
+ });
100
+
88
101
  it('出厂快照没有模块时跳过,不误报', () => {
89
102
  expect(defaultModuleDrift({ factory: [], actual: [] }).skipped).toBe(true);
90
103
  expect(defaultModuleDrift({ factory: undefined, actual: [{ package: 'x' }] }).skipped).toBe(true);
@@ -235,7 +235,10 @@ function checkUtilityClasses(cssText) {
235
235
  if (!looksLikeUtility(token)) continue;
236
236
  if (seen.has(token)) continue;
237
237
  seen.add(token);
238
- const pattern = new RegExp('\\.' + token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?![\\w-])');
238
+ // Tailwind 会把类名里的 `.` 转义成 `\.`(如 `mt-2\\.5`),所以匹配 CSS 时先把
239
+ // token 内的点还原成「转义点」形态,否则所有半步间距类都会被误判成「没有生成 CSS」。
240
+ const cssToken = token.replace(/\./g, '\\.');
241
+ const pattern = new RegExp('\\.' + cssToken.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?![\\w-])');
239
242
  if (!pattern.test(cssText)) {
240
243
  warn('utility-class-missing', `apps/client/src/cards/${entry}: 类名 ${token} 没有生成 CSS(拼写或未登记)`, {
241
244
  fix: '对照 docs/agent/style.md 的语义色与档位;任意值改用方括号写法',
@@ -921,12 +924,25 @@ function gateVerdict() {
921
924
  let moduleDrift = { skipped: true, reason: '缺出厂模块快照', items: [] };
922
925
  try {
923
926
  const factoryFile = path.join(appDir, '.tbox/factory/modules.json');
924
- const actualFile = path.join(appDir, '.tbox/default-modules.json');
925
927
  if (existsSync(factoryFile)) {
926
- const actualDoc = existsSync(actualFile) ? JSON.parse(readFileSync(actualFile, 'utf8')) : [];
927
- moduleDrift = defaultModuleDrift({ factory: JSON.parse(readFileSync(factoryFile, 'utf8')), actual: actualDoc });
928
+ // 真源 = `modules/` 实际目录:计划文件(.tbox/default-modules.json)是「打算装什么」,
929
+ // 用户/agent 直接删目录时它不会变——只比计划等于对「悄悄删掉模块」视而不见。
930
+ const actualPackages = [];
931
+ const modulesDir = path.join(appDir, 'modules');
932
+ for (const entry of existsSync(modulesDir) ? readdirSync(modulesDir) : []) {
933
+ const manifestPath = path.join(modulesDir, entry, 'package.json');
934
+ if (!existsSync(manifestPath)) continue;
935
+ try {
936
+ const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
937
+ const pkg = manifest?.tbox?.upstream?.package ?? manifest?.name;
938
+ if (typeof pkg === 'string' && pkg) actualPackages.push(pkg);
939
+ } catch {
940
+ // 坏 manifest 不阻断审计
941
+ }
942
+ }
943
+ moduleDrift = defaultModuleDrift({ factory: JSON.parse(readFileSync(factoryFile, 'utf8')), actual: actualPackages });
928
944
  for (const item of moduleDrift.items) {
929
- warn('module-drift', '出厂模块偏离:' + item.key + (item.kind === 'module-removed' ? ' 已移除' : ' 是新增的'), {
945
+ warn('module-drift', '出厂默认模块已移除:' + item.key, {
930
946
  fix: '删掉/加上是用户的决定时,在交付说明的「偏离出厂」里写清楚;否则 module add 加回来',
931
947
  recipe: 'shell',
932
948
  });
@@ -1149,8 +1165,15 @@ async function checkCardDensity() {
1149
1165
  if (typeof estimate !== 'function') return { available: false, worst: 0, violations: [], reason: '契约未导出 estimateCardHeight' };
1150
1166
  let worst = 0;
1151
1167
  const violations = [];
1168
+ const sheetCards = [];
1152
1169
  for (const [cardType, meta] of Object.entries(mergedMetas)) {
1153
1170
  if (!meta || !meta.view) continue;
1171
+ // 明细卡(meta.defaultPlacement === 'sheet')由半屏抽屉承接,自带滚动容器:
1172
+ // 不参与「流内一屏」判定(否则明细卡必然越 506/633 线,压制合理的详情设计)。
1173
+ if (meta.defaultPlacement === 'sheet') {
1174
+ sheetCards.push(cardType);
1175
+ continue;
1176
+ }
1154
1177
  const samples = [meta.sampleData, ...(Array.isArray(meta.samples) ? meta.samples.map((sample) => sample && sample.data) : [])];
1155
1178
  for (const data of samples) {
1156
1179
  if (!data) continue;
@@ -1161,7 +1184,7 @@ async function checkCardDensity() {
1161
1184
  } catch { /* 形状不对由 render 报 */ }
1162
1185
  }
1163
1186
  }
1164
- return { available: true, worst, violations };
1187
+ return { available: true, worst, violations, sheetCards };
1165
1188
  }
1166
1189
 
1167
1190
  // ── 4.8 体验不变量(登记在 checks.json 的 experience 族)──────────────
@@ -1425,5 +1448,44 @@ try {
1425
1448
  // 只读环境不影响门禁
1426
1449
  }
1427
1450
 
1428
- process.stdout.write(json(summary) + '\n');
1451
+ // stdout 是「回灌给模型/CLI 的那一份」:结论、计数与失败项在此,全量明细在 last-gate.json。
1452
+ // 契约不变(顶层键全保留,消费方零改动),但不再把 27 条检查明细与逐条 trace 倒进对话上下文
1453
+ //(旧形态单次 24KB,等价于每次 check:fast 都往上下文里塞一篇文档)。
1454
+ const slim = {
1455
+ ...summary,
1456
+ steps: summary.steps.map((step) => {
1457
+ const { items: stepItems, ...rest } = step;
1458
+ if (!Array.isArray(stepItems)) return rest;
1459
+ const failed = stepItems.filter((item) => item.status === 'fail');
1460
+ return {
1461
+ ...rest,
1462
+ itemCount: stepItems.length,
1463
+ ...(failed.length > 0
1464
+ ? { items: failed.slice(0, 10).map(({ id, lane, status, detail }) => ({ id, lane, status, detail })) }
1465
+ : {}),
1466
+ };
1467
+ }),
1468
+ // 体验不变量只回灌失败项(通过项在 last-gate.json;全量 27 条 ≈ 8KB)
1469
+ experience: (summary.experience ?? []).filter((item) => item.status === 'fail'),
1470
+ ...(summary.delivery
1471
+ ? {
1472
+ delivery: {
1473
+ ...summary.delivery,
1474
+ // 同一原因会在 11 条 shell 检查上重复出现:只留前 6 条 + 计数,全量明细在 last-gate.json。
1475
+ deferred: Array.isArray(summary.delivery.deferred) ? summary.delivery.deferred.slice(0, 6) : undefined,
1476
+ deferredCount: Array.isArray(summary.delivery.deferred) ? summary.delivery.deferred.length : 0,
1477
+ // 逐条 trace 与验收覆盖明细同一原因重复,只回灌条数。
1478
+ trace: undefined,
1479
+ traceCount: Array.isArray(summary.delivery.trace) ? summary.delivery.trace.length : 0,
1480
+ },
1481
+ }
1482
+ : {}),
1483
+ ...(Array.isArray(summary.warnings) && summary.warnings.length > 8
1484
+ ? {
1485
+ warnings: summary.warnings.slice(0, 8),
1486
+ warningCount: summary.warnings.length,
1487
+ }
1488
+ : {}),
1489
+ };
1490
+ process.stdout.write(json(slim) + '\n');
1429
1491
  if (!ok) process.exitCode = 1;
@@ -196,19 +196,22 @@ const packageNamesOf = (value) => {
196
196
  return list.map((item) => (typeof item === 'string' ? item : String(item?.package ?? ''))).filter(Boolean);
197
197
  };
198
198
 
199
- /** 出厂模块集 vs 当前 default-modules:少了的包就是一次偏离。 */
199
+ /**
200
+ * 出厂默认模块审计:**只报「出厂默认模块被移除」**。
201
+ *
202
+ * 为什么不报「新增」:`actual` 现在是 `modules/` 的实际内容,里面必然包含用户自己加装的模块
203
+ * (`create --profile mall` 的 7 个商圈模块、`module add provider-custom` 等)。
204
+ * 把正常加装报成「偏离出厂」,只会让每一份交付摘要都顶着几条噪音——用户于是开始忽略整块。
205
+ * 新增模块本来就写在交付说明的「本次实现」里,不需要门禁再提醒一次。
206
+ */
200
207
  export function defaultModuleDrift({ factory, actual }) {
201
208
  const before = packageNamesOf(factory);
202
209
  const now = packageNamesOf(actual);
203
210
  if (before.length === 0) return { skipped: true, reason: '出厂快照没有登记默认模块', items: [] };
204
211
  const removed = before.filter((name) => !now.includes(name));
205
- const added = now.filter((name) => !before.includes(name));
206
212
  return {
207
213
  skipped: false,
208
- items: [
209
- ...removed.map((name) => ({ key: name, kind: 'module-removed', factory: true, actual: false, change: 'declared' })),
210
- ...added.map((name) => ({ key: name, kind: 'module-added', factory: false, actual: true, change: 'declared' })),
211
- ],
214
+ items: removed.map((name) => ({ key: name, kind: 'module-removed', factory: true, actual: false, change: 'declared' })),
212
215
  };
213
216
  }
214
217
 
@@ -207,6 +207,84 @@ export const STATIC_CHECKS = {
207
207
  : CUSTOM_CHROME_DETAIL + ':' + offenders.slice(0, 5).join('、') + (offenders.length > 5 ? ` 等 ${offenders.length} 处` : ''),
208
208
  };
209
209
  },
210
+ /**
211
+ * 静态类冲突:同一个静态字符串里写了互斥类(典型是基础类 `border-0` + 变体 `border`)。
212
+ * 只在单个字面量内判定——跨三元分支/条件拼接不误报。
213
+ */
214
+ 'style.class-conflict': ({ clientDir }) => {
215
+ const hits = [];
216
+ for (const { file, value } of classNameLiterals(path.join(clientDir, 'src'))) {
217
+ const tokens = value.split(/\s+/).filter(Boolean);
218
+ for (const rule of CLASS_CONFLICTS) {
219
+ const hasLeft = tokens.some((token) => new RegExp('^' + rule.left + '$').test(token));
220
+ const hasRight = tokens.some((token) => new RegExp('^' + rule.right + '$').test(token));
221
+ if (hasLeft && hasRight) hits.push(file + '(' + rule.message + ')');
222
+ }
223
+ }
224
+ return hits.length === 0
225
+ ? { status: 'pass', detail: '静态类名无互斥组合' }
226
+ : { status: 'fail', detail: hits.slice(0, 4).join(';') };
227
+ },
228
+
229
+ /**
230
+ * 结果卡去重/落点提示:`cardResult(...)` 没写 `replaceKey` 也没声明 `placement: 'sheet'` 时提醒。
231
+ *
232
+ * 只是建议(warning):同一动作被点两次就会叠出两张一样的卡,或详情卡挤在对话流里。
233
+ * 明细卡正解是在卡声明里写 `defaultPlacement: 'sheet'`,反复触发的卡正解是 `replaceKey`。
234
+ */
235
+ 'action.placement-check': ({ clientDir }) => {
236
+ const serverDir = path.join(clientDir, '..', 'server');
237
+ const actionsDir = path.join(serverDir, 'src', 'actions');
238
+ const hits = [];
239
+ if (existsSync(actionsDir)) {
240
+ for (const entry of readdirSync(actionsDir)) {
241
+ if (!entry.endsWith('.action.ts')) continue;
242
+ const source = readFileSync(path.join(actionsDir, entry), 'utf8');
243
+ let at = source.indexOf('cardResult(');
244
+ while (at >= 0) {
245
+ // 取一段有界窗口:多行调用的参数通常就在其后 400 字符内
246
+ const window = source.slice(at, at + 400);
247
+ if (!/replaceKey\s*:/.test(window) && !/placement\s*:\s*'sheet'/.test(window)) {
248
+ hits.push('src/actions/' + entry);
249
+ break;
250
+ }
251
+ at = source.indexOf('cardResult(', at + 1);
252
+ }
253
+ }
254
+ }
255
+ return hits.length === 0
256
+ ? { status: 'pass', detail: '结果卡都声明了落点或去重键' }
257
+ : {
258
+ status: 'fail',
259
+ detail: '未声明 replaceKey/placement:' + [...new Set(hits)].slice(0, 4).join('、') +
260
+ '(明细卡写 defaultPlacement: \'sheet\';反复触发的卡写 replaceKey)',
261
+ };
262
+ },
263
+
264
+ /** 自定义卡片里的裸 <button>:漏 type 会在表单里触发提交;热区也常常不足 44。 */
265
+ 'card.raw-button': ({ clientDir }) => {
266
+ const problems = [];
267
+ const cardsDir = path.join(clientDir, 'src', 'cards');
268
+ if (existsSync(cardsDir)) {
269
+ for (const entry of readdirSync(cardsDir)) {
270
+ if (!entry.endsWith('.tsx')) continue;
271
+ const source = readFileSync(path.join(cardsDir, entry), 'utf8');
272
+ for (let at = source.indexOf('<button'); at >= 0; at = source.indexOf('<button', at + 7)) {
273
+ // 用同一段「配平后的开标签」同时判 type 与热区:另写一条 `[^>]*` 正则会再次被 `=>` 截断。
274
+ const openTag = findOpenTagText(source, at);
275
+ if (!/\btype\s*=/.test(openTag)) problems.push('src/cards/' + entry + ' 缺 type="button"');
276
+ const classMatch = /className=(?:"([^"]*)"|\{'([^']*)'\})/.exec(openTag);
277
+ const className = classMatch ? (classMatch[1] ?? classMatch[2] ?? '') : '';
278
+ // 合法热区不只 `min-h-11`:44px 的任意值写法与大号档位都算达标。
279
+ const hasTarget = /(?:\b(?:min-h|h|size)-(?:1[1-9]|[2-9]\d)\b|\bmin-h-\[(?:4[4-9]|[5-9]\d|\d{3,})px\]|\b(?:py|p)-[3-9]\b)/.test(className);
280
+ if (!hasTarget) problems.push('src/cards/' + entry + ' 按钮未写最小热区(≥44px)');
281
+ }
282
+ }
283
+ }
284
+ return problems.length === 0
285
+ ? { status: 'pass', detail: '自定义卡按钮语义与热区齐备' }
286
+ : { status: 'fail', detail: problems.slice(0, 4).join(';') };
287
+ },
210
288
  };
211
289
 
212
290
  /** 按 checks.json 的 phase=static 顺序执行;未知 id 明确失败,避免「登记了但静默没跑」。 */
@@ -217,3 +295,64 @@ export function runStaticChecks(context, ids) {
217
295
  return { id, ...run(context) };
218
296
  });
219
297
  }
298
+
299
+
300
+ /** 应用源码里的 className 静态字面量(含插值的模板字符串跳过——无法静态判定)。 */
301
+ function classNameLiterals(dir) {
302
+ const out = [];
303
+ const walk = (current) => {
304
+ for (const entry of readdirSync(current, { withFileTypes: true })) {
305
+ const full = path.join(current, entry.name);
306
+ if (entry.isDirectory()) {
307
+ if (entry.name === 'node_modules' || entry.name === '.tbox-gen') continue;
308
+ walk(full);
309
+ continue;
310
+ }
311
+ if (!/\.tsx?$/.test(entry.name) || /\.test\.tsx?$/.test(entry.name)) continue;
312
+ const source = readFileSync(full, 'utf8');
313
+ for (const match of source.matchAll(/className=(?:"([^"]*)"|\{'([^']*)'\})/g)) {
314
+ const value = match[1] ?? match[2] ?? '';
315
+ if (value.includes('${')) continue;
316
+ out.push({ file: path.relative(dir, full).split(path.sep).join('/'), value });
317
+ }
318
+ }
319
+ };
320
+ if (existsSync(dir)) walk(dir);
321
+ return out;
322
+ }
323
+
324
+ /** 互斥工具类对:同时出现在同一个静态字符串里 = 后写的按声明序胜出,意图必然落空。 */
325
+ const CLASS_CONFLICTS = [
326
+ // 注意右式必须同时覆盖「裸类」(`border` / `rounded`)与「带修饰」(`border-b` / `rounded-lg`):
327
+ // 只写 `border-(?!0)` 会漏掉最常见的 `border-0 border`(新写测试时踩到过)。
328
+ { left: 'border-0', right: 'border(?:-(?!0)[\\w-]+)?', message: 'border-0 与其它 border 类互相覆盖' },
329
+ { left: 'bg-transparent', right: 'bg-(?!transparent)[\\w-]+', message: 'bg-transparent 与实心底色互相覆盖' },
330
+ { left: 'hidden', right: 'flex(?![\\w-])', message: 'hidden 与 flex 互相覆盖' },
331
+ { left: 'rounded-none', right: 'rounded(?:-(?!none)[\\w-]+)?', message: 'rounded-none 与圆角类互相覆盖' },
332
+ ];
333
+
334
+ /**
335
+ * 取 `<button` 开标签的真实结束位置(括号/引号配平)。
336
+ *
337
+ * 为什么不能写 `/<button(?![^>]*\btype=)/`:属性里的箭头函数 `onClick={() => …}` 自带 `>`,
338
+ * `[^>]*` 会在那里截断 —— 于是 "type 写在后面" 的合法按钮被误判成缺 type。
339
+ */
340
+ function findOpenTagText(source, startIndex) {
341
+ let depth = 0;
342
+ let quote = '';
343
+ for (let i = startIndex; i < source.length; i += 1) {
344
+ const ch = source[i];
345
+ if (quote) {
346
+ if (ch === quote && source[i - 1] !== '\\') quote = '';
347
+ continue;
348
+ }
349
+ if (ch === '"' || ch === "'" || ch === '`') {
350
+ quote = ch;
351
+ continue;
352
+ }
353
+ if (ch === '{') depth += 1;
354
+ else if (ch === '}') depth = Math.max(0, depth - 1);
355
+ else if (ch === '>' && depth === 0) return source.slice(startIndex, i + 1);
356
+ }
357
+ return source.slice(startIndex);
358
+ }
@@ -89,6 +89,8 @@ describe('几何内核', () => {
89
89
  if (!existsSync(file)) return;
90
90
  const result = JSON.parse(readFileSync(file, 'utf8'));
91
91
  const blank = result.items.find((item) => item.id === 'shell.blank');
92
- expect(blank.status === 'pass' || blank.status === 'fail').toBe(true);
92
+ // 本机跑过探针才有这个文件;`na`(聊天流不适用)同样是合法裁决——
93
+ // 只要求「跑出了结论」,不要求一定是 pass/fail,否则换形态的应用会误红。
94
+ expect(['pass', 'fail', 'na', 'skip']).toContain(blank.status);
93
95
  });
94
96
  });
@@ -0,0 +1,61 @@
1
+ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { dirname, join } from 'node:path';
4
+ import { afterEach, describe, expect, it } from 'vitest';
5
+ import { assertHomePresetWiring } from './home-preset-wiring';
6
+
7
+ const dirs: string[] = [];
8
+
9
+ function fixture(chat: unknown, withModule = true): { chatFile: string; homeSlot: string } {
10
+ const dir = mkdtempSync(join(tmpdir(), 'tbox-home-preset-'));
11
+ dirs.push(dir);
12
+ const chatFile = join(dir, 'chat.json');
13
+ const homeSlot = join(dir, 'home-slot.tsx');
14
+ writeFileSync(chatFile, typeof chat === 'string' ? chat : JSON.stringify(chat));
15
+ if (withModule) {
16
+ writeFileSync(homeSlot, 'export function HomeSlot() { return null; }\n');
17
+ }
18
+ return { chatFile, homeSlot };
19
+ }
20
+
21
+ afterEach(() => {
22
+ for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true });
23
+ });
24
+
25
+ describe('homePreset 构建期校验', () => {
26
+ it('缺席 / none:不要求 module-mall-core', () => {
27
+ const absent = fixture({}, false);
28
+ expect(() => assertHomePresetWiring(absent.chatFile, absent.homeSlot)).not.toThrow();
29
+ const none = fixture({ homePreset: 'none' }, false);
30
+ expect(() => assertHomePresetWiring(none.chatFile, none.homeSlot)).not.toThrow();
31
+ });
32
+
33
+ it('mall-home + module 在场:通过', () => {
34
+ const ok = fixture({ homePreset: 'mall-home' });
35
+ expect(() => assertHomePresetWiring(ok.chatFile, ok.homeSlot)).not.toThrow();
36
+ });
37
+
38
+ it('非法值:拒绝并报允许集合与原始值', () => {
39
+ // 诊断值用 JSON.stringify:空串与对象能看出原值(String 会丢成空串 / [object Object])
40
+ for (const [value, shown] of [['mall_home', '"mall_home"'], ['', '""'], [{}, '{}']] as const) {
41
+ const bad = fixture({ homePreset: value }, false);
42
+ expect(() => assertHomePresetWiring(bad.chatFile, bad.homeSlot)).toThrow(/只允许 "mall-home" \| "none"/);
43
+ expect(() => assertHomePresetWiring(bad.chatFile, bad.homeSlot)).toThrow(`实际:${shown}`);
44
+ }
45
+ });
46
+
47
+ it('mall-home 缺 module:拒绝并指路 module add', () => {
48
+ const missing = fixture({ homePreset: 'mall-home' }, false);
49
+ expect(() => assertHomePresetWiring(missing.chatFile, missing.homeSlot)).toThrow(/module add/);
50
+ });
51
+
52
+ it('chat.json 缺席、损坏或非对象:交给 config loader,不在构建期重复报错', () => {
53
+ const broken = fixture('{ not-json', false);
54
+ expect(() => assertHomePresetWiring(broken.chatFile, broken.homeSlot)).not.toThrow();
55
+ expect(() => assertHomePresetWiring(join(dirname(broken.chatFile), 'missing.json'), broken.homeSlot)).not.toThrow();
56
+ for (const value of [null, [], 'string', 1]) {
57
+ const odd = fixture(value, false);
58
+ expect(() => assertHomePresetWiring(odd.chatFile, odd.homeSlot)).not.toThrow();
59
+ }
60
+ });
61
+ });
@@ -0,0 +1,41 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+
3
+ /**
4
+ * `homePreset` 构建/启动期校验(Vite config 调用;Node 侧,不进客户端 bundle)。
5
+ *
6
+ * 与 `@tbox.cn/app-contracts` 的 `HOME_PRESET_IDS` 同值:Vite config 由 Node 直接加载,
7
+ * 不能 import 该 TS 源码包(内部相对导入无扩展名),这里保留本地镜像;
8
+ * 需与 @tbox.cn/app-contracts 的 HOME_PRESET_IDS 保持同值。
9
+ */
10
+ export const HOME_PRESET_IDS = ['mall-home', 'none'] as const;
11
+ const HOME_PRESET_ID_SET = new Set<string>(HOME_PRESET_IDS);
12
+
13
+ /**
14
+ * `homePreset=mall-home` 必须有 module-mall-core 的 home-slot 源。
15
+ * 缺模块时 `import.meta.glob` 会返回空对象,若只靠运行期 throw 会等到浏览器打开才白屏;
16
+ * 这里把故障前移到 dev 启动与 vite build(stage 锁门可捕获)。
17
+ */
18
+ export function assertHomePresetWiring(chatFile: string, homeSlot: string): void {
19
+ if (!existsSync(chatFile)) return;
20
+ let raw: unknown;
21
+ try {
22
+ raw = JSON.parse(readFileSync(chatFile, 'utf8'));
23
+ } catch {
24
+ // 损坏 JSON 交给 config loader 统一报错,这里只负责 homePreset 的选择器校验。
25
+ return;
26
+ }
27
+ // null / 数组 / 标量 JSON 合法但不是 chat 配置对象:交给 config loader 报错。
28
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return;
29
+ const chat = raw as { homePreset?: unknown };
30
+ if (chat.homePreset === undefined) return;
31
+ if (typeof chat.homePreset !== 'string' || !HOME_PRESET_ID_SET.has(chat.homePreset)) {
32
+ const allowed = HOME_PRESET_IDS.map((id) => `"${id}"`).join(' | ');
33
+ throw new Error(`[home] chat.json 的 homePreset 只允许 ${allowed}(实际:${JSON.stringify(chat.homePreset)})`);
34
+ }
35
+ if (chat.homePreset !== 'mall-home') return;
36
+ if (!existsSync(homeSlot)) {
37
+ throw new Error(
38
+ '[home] homePreset=mall-home 但未安装 module-mall-core(module-mall-core/src/client/home-slot.tsx 缺席)——先运行 pnpm exec tbox-app module add @tbox.cn/app-module-mall-core,或将 config/chat.json 的 homePreset 改为 "none"/删除该键',
39
+ );
40
+ }
41
+ }