@tbox.cn/app-template-agent 1.0.0-alpha.1 → 1.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/._.gitignore +0 -0
- package/._.nvmrc +0 -0
- package/._AGENTS.md +0 -0
- package/._ENV.md +0 -0
- package/._LEGAL.md +0 -0
- package/._LICENSE +0 -0
- package/._README.md +0 -0
- package/._eslint.config.mjs +0 -0
- package/._package.json +0 -0
- package/._pnpm-lock.template.yaml +0 -0
- package/._pnpm-workspace.template.yaml +0 -0
- package/._tsconfig.base.json +0 -0
- package/.gitignore +14 -2
- package/.tbox/._app.json +0 -0
- package/.tbox/._default-modules.json +0 -0
- package/.tbox/._miniapp-containers.json +0 -0
- package/.tbox/app.json +1 -1
- package/.tbox/default-modules.json +1 -1
- package/.tbox/factory/._chat.json +0 -0
- package/.tbox/factory/chat.json +9 -0
- package/.tbox/miniapp-containers.json +1 -1
- package/AGENTS.md +64 -13
- package/ENV.md +4 -4
- package/README.md +24 -20
- package/apps/._AGENTS.md +0 -0
- package/apps/AGENTS.md +0 -4
- package/apps/client/._index.html +0 -0
- package/apps/client/._package.json +0 -0
- package/apps/client/._tsconfig.json +0 -0
- package/apps/client/._vite.config.ts +0 -0
- package/apps/client/index.html +1 -20
- package/apps/client/package.json +4 -3
- package/apps/client/scripts/._acceptance-changes.test.mjs +0 -0
- package/apps/client/scripts/._check-evidence.mjs +0 -0
- package/apps/client/scripts/._color-scan.mjs +0 -0
- package/apps/client/scripts/._color-scan.test.mjs +0 -0
- package/apps/client/scripts/._evidence-gate.mjs +0 -0
- package/apps/client/scripts/._evidence-gate.test.mjs +0 -0
- package/apps/client/scripts/._experience-checks.mjs +0 -0
- package/apps/client/scripts/._geometry-kernel.test.mjs +0 -0
- package/apps/client/scripts/._in-process-checks.mjs +0 -0
- package/apps/client/scripts/._probe-checks.mjs +0 -0
- package/apps/client/scripts/._render-card.mjs +0 -0
- package/apps/client/scripts/._sample-entries.test.mjs +0 -0
- package/apps/client/scripts/._storyboard.test.mjs +0 -0
- package/apps/client/scripts/._surface-css.mjs +0 -0
- package/apps/client/scripts/._theme-kernel.mjs +0 -0
- package/apps/client/scripts/._theme-kernel.test.mjs +0 -0
- package/apps/client/scripts/acceptance-changes.test.mjs +97 -0
- package/apps/client/scripts/check-evidence.mjs +1402 -0
- package/apps/client/scripts/color-scan.mjs +66 -0
- package/apps/client/scripts/color-scan.test.mjs +25 -0
- package/apps/client/scripts/evidence-gate.mjs +337 -0
- package/apps/client/scripts/evidence-gate.test.mjs +135 -0
- package/apps/client/scripts/experience-checks.mjs +163 -0
- package/apps/client/scripts/geometry-kernel.test.mjs +92 -0
- package/apps/client/scripts/in-process-checks.mjs +51 -0
- package/apps/client/scripts/lib/._card-registry.mjs +0 -0
- package/apps/client/scripts/lib/._card-registry.test.mjs +0 -0
- package/apps/client/scripts/lib/._evidence-inputs.mjs +0 -0
- package/apps/client/scripts/lib/._evidence-inputs.test.mjs +0 -0
- package/apps/client/scripts/lib/._static-render.mjs +0 -0
- package/apps/client/scripts/lib/._static-render.test.mjs +0 -0
- package/apps/client/scripts/lib/card-registry.mjs +81 -0
- package/apps/client/scripts/lib/card-registry.test.mjs +59 -0
- package/apps/client/scripts/lib/evidence-inputs.mjs +91 -0
- package/apps/client/scripts/lib/evidence-inputs.test.mjs +27 -0
- package/apps/client/scripts/lib/static-render.mjs +35 -0
- package/apps/client/scripts/lib/static-render.test.mjs +21 -0
- package/apps/client/scripts/probe-checks.mjs +85 -0
- package/apps/client/scripts/render-card.mjs +710 -0
- package/apps/client/scripts/sample-entries.test.mjs +31 -0
- package/apps/client/scripts/storyboard.test.mjs +149 -0
- package/apps/client/scripts/surface-css.mjs +55 -0
- package/apps/client/scripts/theme-kernel.mjs +236 -0
- package/apps/client/scripts/theme-kernel.test.mjs +136 -0
- package/apps/client/src/._app.config.ts +0 -0
- package/apps/client/src/._vite-env.d.ts +0 -0
- package/apps/client/src/app.config.ts +43 -0
- package/apps/client/src/cards/._AGENTS.md +0 -0
- package/apps/client/src/cards/._registry.ts +0 -0
- package/apps/client/src/cards/AGENTS.md +11 -0
- package/apps/client/src/pages/._page.tsx +0 -0
- package/apps/client/src/pages/index/._index.tsx +0 -0
- package/apps/client/src/pages/index/index.tsx +1 -1
- package/apps/client/src/pages/page.tsx +2 -2
- package/apps/client/src/store/._chat.ts +0 -0
- package/apps/client/src/store/chat.ts +7 -3
- package/apps/client/src/styles/._brand.css +0 -0
- package/apps/client/src/styles/._tailwind.css +0 -0
- package/apps/client/src/styles/brand.css +50 -0
- package/apps/client/src/styles/tailwind.css +326 -0
- package/apps/client/src/test/._setup.ts +0 -0
- package/apps/client/src/vite-env.d.ts +0 -2
- package/apps/client/vite.config.ts +8 -23
- package/apps/server/._package.json +0 -0
- package/apps/server/._tsconfig.json +0 -0
- package/apps/server/._tsup.config.ts +0 -0
- package/apps/server/._vitest.config.ts +0 -0
- package/apps/server/scripts/._probe.mjs +0 -0
- package/apps/server/scripts/._scenario-lib.mjs +0 -0
- package/apps/server/scripts/._scenario.mjs +0 -0
- package/apps/server/scripts/probe.mjs +387 -0
- package/apps/server/scripts/scenario-lib.mjs +295 -0
- package/apps/server/scripts/scenario.mjs +67 -0
- package/apps/server/src/._app.ts +0 -0
- package/apps/server/src/._dev.ts +0 -0
- package/apps/server/src/._index.ts +0 -0
- package/apps/server/src/._intent-routes.ts +0 -0
- package/apps/server/src/._pre-tools.ts +0 -0
- package/apps/server/src/app.ts +10 -3
- package/apps/server/src/cards/._AGENTS.md +0 -0
- package/apps/server/src/cards/AGENTS.md +19 -0
- package/apps/server/src/cli/._collect-registry.ts +0 -0
- package/apps/server/src/cli/._plugin-doctor.ts +0 -0
- package/apps/server/src/cli/._plugin-inspect.ts +0 -0
- package/apps/server/src/config/._integration.ts +0 -0
- package/apps/server/src/dev.ts +2 -2
- package/apps/server/src/index.ts +2 -2
- package/apps/server/src/pre-tools.ts +7 -16
- package/apps/server/src/tools/._AGENTS.md +0 -0
- package/apps/server/src/tools/AGENTS.md +23 -0
- package/apps/server/tests/._agent-prompt.test.ts +0 -0
- package/apps/server/tests/._cards-registry.test.ts +0 -0
- package/apps/server/tests/._deployment-loader.test.ts +0 -0
- package/apps/server/tests/._intent-dispatcher.test.ts +0 -0
- package/apps/server/tests/._tool-runtime.test.ts +0 -0
- package/apps/server/tests/helpers/._register.ts +0 -0
- package/apps/server/tests/tool-runtime.test.ts +0 -27
- package/config/._AGENTS.md +0 -0
- package/config/._README.md +0 -0
- package/config/._chat.json +0 -0
- package/config/._integrations.json +0 -0
- package/config/._llm_provider.json +0 -0
- package/config/._plugins.json +0 -0
- package/config/AGENTS.md +14 -0
- package/config/README.md +4 -4
- package/config/chat.json +25 -7
- package/config/integrations.json +1 -1
- package/docs/agent/._agent-prompt.md +0 -0
- package/docs/agent/._card-action.md +0 -0
- package/docs/agent/._card.md +0 -0
- package/docs/agent/._conversation.md +0 -0
- package/docs/agent/._kit.md +0 -0
- package/docs/agent/._shell.md +0 -0
- package/docs/agent/._state.md +0 -0
- package/docs/agent/._style.md +0 -0
- package/docs/agent/._tool-emits-card.md +0 -0
- package/docs/agent/._tool.md +0 -0
- package/docs/agent/._verify.md +0 -0
- package/docs/agent/agent-prompt.md +38 -0
- package/docs/agent/card-action.md +101 -0
- package/docs/agent/card.md +159 -0
- package/docs/agent/conversation.md +52 -0
- package/docs/agent/kit.md +80 -0
- package/docs/agent/shell.md +77 -0
- package/docs/agent/state.md +85 -0
- package/docs/agent/style.md +107 -0
- package/docs/agent/tool-emits-card.md +62 -0
- package/docs/agent/tool.md +71 -0
- package/docs/agent/verify.md +188 -0
- package/eslint.config.mjs +18 -0
- package/modules/provider-custom/._AGENTS.md +0 -0
- package/modules/provider-custom/._INTEGRATION.md +0 -0
- package/modules/provider-custom/._LICENSE +0 -0
- package/modules/provider-custom/._README.md +0 -0
- package/modules/provider-custom/._package.json +0 -0
- package/modules/provider-custom/._tbox.module.json +0 -0
- package/modules/provider-custom/._tsconfig.json +0 -0
- package/modules/provider-custom/._tsup.config.ts +0 -0
- package/modules/provider-custom/AGENTS.md +5 -5
- package/modules/provider-custom/INTEGRATION.md +2 -2
- package/modules/provider-custom/src/._index.ts +0 -0
- package/modules/provider-custom/src/server/._example-adapter.ts +0 -0
- package/modules/provider-custom/src/server/._index.ts +0 -0
- package/modules/provider-custom/src/server/example-adapter.ts +2 -2
- package/modules/provider-custom/src/server/index.ts +1 -1
- package/modules/provider-custom/tests/._provider-custom.test.ts +0 -0
- package/package.json +33 -6
- package/packages/agent-ui-kit/._AGENTS.md +0 -0
- package/packages/agent-ui-kit/._LICENSE +0 -0
- package/packages/agent-ui-kit/._README.md +0 -0
- package/packages/agent-ui-kit/._catalog.json +0 -0
- package/packages/agent-ui-kit/._package.json +0 -0
- package/packages/agent-ui-kit/._tsconfig.json +0 -0
- package/packages/agent-ui-kit/._vitest.config.ts +0 -0
- package/packages/agent-ui-kit/AGENTS.md +8 -0
- package/packages/agent-ui-kit/README.md +59 -6
- package/packages/agent-ui-kit/assets/._keyboard-circle.svg +0 -0
- package/packages/agent-ui-kit/assets/._more-circle.svg +0 -0
- package/packages/agent-ui-kit/assets/._new-chat.svg +0 -0
- package/packages/agent-ui-kit/assets/._quick-command-star.svg +0 -0
- package/packages/agent-ui-kit/assets/._send-gradient.svg +0 -0
- package/packages/agent-ui-kit/assets/._stop@2x.png +0 -0
- package/packages/agent-ui-kit/assets/._voice-circle.svg +0 -0
- package/packages/agent-ui-kit/catalog.json +855 -0
- package/packages/agent-ui-kit/package.json +24 -9
- package/packages/agent-ui-kit/src/._ChatPage.tsx +0 -0
- package/packages/agent-ui-kit/src/._chat-config.test.ts +0 -0
- package/packages/agent-ui-kit/src/._chat-config.ts +0 -0
- package/packages/agent-ui-kit/src/._icons.ts +0 -0
- package/packages/agent-ui-kit/src/._index.ts +0 -0
- package/packages/agent-ui-kit/src/._preview-provider.tsx +0 -0
- package/packages/agent-ui-kit/src/._shell.contract.json +0 -0
- package/packages/agent-ui-kit/src/._shell.test.ts +0 -0
- package/packages/agent-ui-kit/src/._shell.ts +0 -0
- package/packages/agent-ui-kit/src/._store-context.tsx +0 -0
- package/packages/agent-ui-kit/src/._surface.test.tsx +0 -0
- package/packages/agent-ui-kit/src/._surface.tsx +0 -0
- package/packages/agent-ui-kit/src/._types.ts +0 -0
- package/packages/agent-ui-kit/src/._vite-env.d.ts +0 -0
- package/packages/agent-ui-kit/src/ChatPage.tsx +115 -20
- package/packages/agent-ui-kit/src/card/._action-list-pending.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._define-card.test.ts +0 -0
- package/packages/agent-ui-kit/src/card/._define-card.ts +0 -0
- package/packages/agent-ui-kit/src/card/._primitives.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._primitives.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._use-card-actions.ts +0 -0
- package/packages/agent-ui-kit/src/card/._view-card-inline.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._view-card.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/._view-card.tsx +0 -0
- package/packages/agent-ui-kit/src/card/action-list-pending.test.tsx +91 -0
- package/packages/agent-ui-kit/src/card/define-card.test.ts +25 -0
- package/packages/agent-ui-kit/src/card/define-card.ts +47 -0
- package/packages/agent-ui-kit/src/card/primitives.test.tsx +157 -0
- package/packages/agent-ui-kit/src/card/primitives.tsx +717 -0
- package/packages/agent-ui-kit/src/card/use-card-actions.ts +86 -0
- package/packages/agent-ui-kit/src/card/view-card-inline.test.tsx +42 -0
- package/packages/agent-ui-kit/src/card/view-card.test.tsx +79 -0
- package/packages/agent-ui-kit/src/card/view-card.tsx +250 -0
- package/packages/agent-ui-kit/src/chat-config.test.ts +35 -71
- package/packages/agent-ui-kit/src/chat-config.ts +29 -7
- package/packages/agent-ui-kit/src/components/._CardRenderer.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/._DebugButton.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/._DebugButton.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.test.tsx +3 -0
- package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.tsx +5 -10
- package/packages/agent-ui-kit/src/components/ActionBar/index.tsx +13 -14
- package/packages/agent-ui-kit/src/components/BottomSheet/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/index.test.tsx +97 -0
- package/packages/agent-ui-kit/src/components/BottomSheet/index.tsx +49 -0
- package/packages/agent-ui-kit/src/components/ChatHeader/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatHeader/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatHeader/index.tsx +19 -17
- package/packages/agent-ui-kit/src/components/ChatInput/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/index.test.tsx +2 -2
- package/packages/agent-ui-kit/src/components/ChatInput/index.tsx +44 -33
- package/packages/agent-ui-kit/src/components/ChatInput/voice/._VoicePressField.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/voice/._VoiceRecordingOverlay.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/voice/._machine.ts +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/voice/._useVoicePress.ts +0 -0
- package/packages/agent-ui-kit/src/components/ChatInput/voice/VoicePressField.tsx +12 -3
- package/packages/agent-ui-kit/src/components/ChatInput/voice/VoiceRecordingOverlay.tsx +9 -9
- package/packages/agent-ui-kit/src/components/ChatInput/voice/useVoicePress.ts +1 -1
- package/packages/agent-ui-kit/src/components/HistoryEntry/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/HistoryEntry/index.tsx +4 -4
- package/packages/agent-ui-kit/src/components/MediaList/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/MediaList/index.tsx +42 -28
- package/packages/agent-ui-kit/src/components/MessageBubble/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/MessageBubble/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/MessageBubble/index.tsx +59 -28
- package/packages/agent-ui-kit/src/components/PullDownIndicator/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/PullDownIndicator/index.tsx +3 -4
- package/packages/agent-ui-kit/src/components/QuickCommands/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/QuickCommands/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/QuickCommands/index.test.tsx +3 -1
- package/packages/agent-ui-kit/src/components/QuickCommands/index.tsx +33 -10
- package/packages/agent-ui-kit/src/components/ReasoningBlock/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ReasoningBlock/index.tsx +14 -9
- package/packages/agent-ui-kit/src/components/ScrollToBottomButton/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ScrollToBottomButton/index.tsx +7 -5
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._detail.test.ts +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._detail.ts +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._index.test.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/._titles.ts +0 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/index.tsx +58 -38
- package/packages/agent-ui-kit/src/hooks/._use-drag-gesture.test.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._use-drag-gesture.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._use-pull-down-history.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._use-pull-down-wheel-native.test.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._useMediaUpload.ts +0 -0
- package/packages/agent-ui-kit/src/hooks/._useTTSAutoPlay.ts +0 -0
- package/packages/agent-ui-kit/src/icons.ts +39 -0
- package/packages/agent-ui-kit/src/index.ts +76 -2
- package/packages/agent-ui-kit/src/overlay/._Overlay.tsx +0 -0
- package/packages/agent-ui-kit/src/overlay/._focus.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._index.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._inert.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._layers.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._overlay.ssr.test.tsx +0 -0
- package/packages/agent-ui-kit/src/overlay/._overlay.test.tsx +0 -0
- package/packages/agent-ui-kit/src/overlay/._presence.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._scroll-lock.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._stack.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/._use-overlay.ts +0 -0
- package/packages/agent-ui-kit/src/overlay/Overlay.tsx +154 -0
- package/packages/agent-ui-kit/src/overlay/focus.ts +53 -0
- package/packages/agent-ui-kit/src/overlay/index.ts +16 -0
- package/packages/agent-ui-kit/src/overlay/inert.ts +27 -0
- package/packages/agent-ui-kit/src/overlay/layers.ts +21 -0
- package/packages/agent-ui-kit/src/overlay/overlay.ssr.test.tsx +27 -0
- package/packages/agent-ui-kit/src/overlay/overlay.test.tsx +209 -0
- package/packages/agent-ui-kit/src/overlay/presence.ts +86 -0
- package/packages/agent-ui-kit/src/overlay/scroll-lock.ts +62 -0
- package/packages/agent-ui-kit/src/overlay/stack.ts +111 -0
- package/packages/agent-ui-kit/src/overlay/use-overlay.ts +80 -0
- package/packages/agent-ui-kit/src/preview-provider.tsx +47 -0
- package/packages/agent-ui-kit/src/shell.contract.json +75 -0
- package/packages/agent-ui-kit/src/shell.test.ts +72 -0
- package/packages/agent-ui-kit/src/shell.ts +60 -0
- package/packages/agent-ui-kit/src/surface.test.tsx +35 -0
- package/packages/agent-ui-kit/src/surface.tsx +44 -0
- package/packages/agent-ui-kit/src/test/._setup.ts +0 -0
- package/packages/agent-ui-kit/src/theme/._base.css +0 -0
- package/packages/agent-ui-kit/src/theme/._contract.json +0 -0
- package/packages/agent-ui-kit/src/theme/._motion.css +0 -0
- package/packages/agent-ui-kit/src/theme/._theme-contract.test.ts +0 -0
- package/packages/agent-ui-kit/src/theme/._theme.ts +0 -0
- package/packages/agent-ui-kit/src/theme/._tokens.css +0 -0
- package/packages/agent-ui-kit/src/theme/base.css +167 -0
- package/packages/agent-ui-kit/src/theme/contract.json +123 -2
- package/packages/agent-ui-kit/src/theme/theme-contract.test.ts +19 -3
- package/packages/agent-ui-kit/src/theme/{tokens.less → tokens.css} +19 -20
- package/packages/agent-ui-kit/src/utils/._copyText.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._haptics.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._haptics.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._image-preview-host.tsx +0 -0
- package/packages/agent-ui-kit/src/utils/._imagePreview.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._imagePreview.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._pull-down-machine.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._pull-down-machine.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._session-error.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._toast.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._toast.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._tool-call-display.test.ts +0 -0
- package/packages/agent-ui-kit/src/utils/._tool-call-display.ts +0 -0
- package/packages/agent-ui-kit/src/utils/image-preview-host.tsx +95 -0
- package/packages/agent-ui-kit/src/utils/imagePreview.test.ts +32 -0
- package/packages/agent-ui-kit/src/utils/imagePreview.ts +14 -5
- package/packages/agent-ui-kit/src/utils/toast.test.ts +64 -0
- package/packages/agent-ui-kit/src/utils/toast.ts +100 -7
- package/packages/contracts-mall/._package.json +0 -0
- package/packages/contracts-mall/._tsconfig.json +0 -0
- package/packages/contracts-mall/src/._index.ts +0 -0
- package/packages/contracts-mall/src/._runtime.ts +0 -0
- package/packages/contracts-mall/src/server/._index.ts +0 -0
- package/packages/shared/._AGENTS.md +0 -0
- package/packages/shared/._package.json +0 -0
- package/packages/shared/._tsconfig.json +0 -0
- package/packages/shared/AGENTS.md +4 -2
- package/packages/shared/package.json +7 -0
- package/packages/shared/src/._index.ts +0 -0
- package/pnpm-lock.template.yaml +712 -779
- package/pnpm-workspace.template.yaml +19 -13
- package/profiles/._mall.json +0 -0
- package/profiles/mall/._TEMPLATE.md +0 -0
- package/profiles/mall/._chat.overrides.json +0 -0
- package/profiles/mall/chat.overrides.json +12 -0
- package/profiles/mall/config/._agent.jsonc +0 -0
- package/profiles/mall/config/._chat.json +0 -0
- package/profiles/mall/config/._knowledge.json +0 -0
- package/profiles/mall/config/chat.json +14 -6
- package/profiles/mall.json +2 -2
- package/scenarios/._README.md +0 -0
- package/scenarios/README.md +7 -0
- package/scripts/._assert-pack.mjs +0 -0
- package/scripts/._build.sh +0 -0
- package/scripts/._check-css-target.mjs +0 -0
- package/scripts/._check-fast.mjs +0 -0
- package/scripts/._check-workspace.mjs +0 -0
- package/scripts/._checks.json +0 -0
- package/scripts/._deliver.mjs +0 -0
- package/scripts/._dev-alipay.mjs +0 -0
- package/scripts/._dev.sh +0 -0
- package/scripts/._generate.mjs +0 -0
- package/scripts/._prepare.sh +0 -0
- package/scripts/._shell-probe.mjs +0 -0
- package/scripts/._smoke.mjs +0 -0
- package/scripts/._start.sh +0 -0
- package/scripts/._stop.sh +0 -0
- package/scripts/._storyboard.mjs +0 -0
- package/scripts/._verify-generated.mjs +0 -0
- package/scripts/assert-pack.mjs +48 -0
- package/scripts/check-css-target.mjs +54 -0
- package/scripts/check-fast.mjs +119 -0
- package/scripts/check-workspace.mjs +68 -19
- package/scripts/checks.json +627 -0
- package/scripts/deliver.mjs +183 -0
- package/scripts/dev-alipay.mjs +1 -1
- package/scripts/lib/._chrome-pipe.mjs +0 -0
- package/scripts/lib/._geometry-kernel.mjs +0 -0
- package/scripts/lib/chrome-pipe.mjs +95 -0
- package/scripts/lib/geometry-kernel.mjs +137 -0
- package/scripts/shell-probe.mjs +280 -0
- package/scripts/storyboard.mjs +350 -0
- package/tsconfig.base.json +1 -0
- package/apps/client/.tbox-gen/app-kind.ts +0 -1
- package/apps/client/.tbox-gen/documents/_tbox/card-preview.html +0 -38
- package/apps/client/.tbox-gen/documents/index.html +0 -39
- package/apps/client/.tbox-gen/entries/card-preview.tsx +0 -18
- package/apps/client/.tbox-gen/entries/index.tsx +0 -18
- package/apps/client/.tbox-gen/manifest.json +0 -17
- package/apps/client/.tbox-gen/registry.client.ts +0 -6
- package/apps/client/.tbox-gen/registry.server.ts +0 -15
- package/apps/client/STYLE_GUIDE.md +0 -81
- package/apps/client/VISUAL_RESTORE.md +0 -90
- package/apps/client/src/platform/AgentChatApp.tsx +0 -6
- package/apps/client/src/platform/AppShell.tsx +0 -42
- package/apps/client/src/platform/agent-runtime.ts +0 -16
- package/apps/client/src/platform/bootstrap.ts +0 -55
- package/apps/client/src/platform/card-preview-page.tsx +0 -10
- package/apps/client/src/platform/mount-page.tsx +0 -20
- package/apps/client/src/platform/state/createPersistedStore.ts +0 -19
- package/apps/server/src/tools/clock.tool.ts +0 -24
- package/apps/server/src/tools/translate.tool.ts +0 -47
- package/packages/agent-ui-kit/src/ChatPage.less +0 -62
- package/packages/agent-ui-kit/src/components/ActionBar/index.less +0 -123
- package/packages/agent-ui-kit/src/components/ChatHeader/index.less +0 -148
- package/packages/agent-ui-kit/src/components/ChatInput/index.less +0 -394
- package/packages/agent-ui-kit/src/components/HistoryEntry/index.less +0 -49
- package/packages/agent-ui-kit/src/components/MediaList/index.less +0 -241
- package/packages/agent-ui-kit/src/components/MessageBubble/index.less +0 -325
- package/packages/agent-ui-kit/src/components/PullDownIndicator/index.less +0 -32
- package/packages/agent-ui-kit/src/components/QuickCommands/index.less +0 -63
- package/packages/agent-ui-kit/src/components/ReasoningBlock/index.less +0 -90
- package/packages/agent-ui-kit/src/components/ScrollToBottomButton/index.less +0 -32
- package/packages/agent-ui-kit/src/components/ToolCallBlock/index.less +0 -312
- package/packages/agent-ui-kit/src/theme/global.less +0 -99
- package/profiles/mall/config/llm_provider.json +0 -5
- package/profiles/mall/config/plugins.json +0 -3
- /package/packages/agent-ui-kit/src/theme/{motion.less → motion.css} +0 -0
|
@@ -39,15 +39,17 @@ catalog:
|
|
|
39
39
|
ws: 8.21.3
|
|
40
40
|
"@types/ws": 8.18.1
|
|
41
41
|
"@tbox.cn/agent-plugin": 0.1.0
|
|
42
|
-
"@tbox.cn/app-sdk-core": 1.0.0-alpha.
|
|
43
|
-
"@tbox.cn/app-sdk-client": 1.0.0-alpha.
|
|
44
|
-
"@tbox.cn/app-sdk-server": 1.0.0-alpha.
|
|
45
|
-
"@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.
|
|
46
|
-
"@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.
|
|
47
|
-
"@tbox.cn/app-contracts": 1.0.0-alpha.
|
|
48
|
-
"@tbox.cn/app-contracts-mall": 1.0.0-alpha.
|
|
49
|
-
"@tbox.cn/app-theme-tbox": 1.0.0-alpha.
|
|
50
|
-
"@tbox.cn/app-build": 1.0.0-alpha.
|
|
42
|
+
"@tbox.cn/app-sdk-core": 1.0.0-alpha.11
|
|
43
|
+
"@tbox.cn/app-sdk-client": 1.0.0-alpha.11
|
|
44
|
+
"@tbox.cn/app-sdk-server": 1.0.0-alpha.11
|
|
45
|
+
"@tbox.cn/app-agent-sdk-server": 1.0.0-alpha.11
|
|
46
|
+
"@tbox.cn/app-agent-sdk-client": 1.0.0-alpha.11
|
|
47
|
+
"@tbox.cn/app-contracts": 1.0.0-alpha.11
|
|
48
|
+
"@tbox.cn/app-contracts-mall": 1.0.0-alpha.11
|
|
49
|
+
"@tbox.cn/app-theme-tbox": 1.0.0-alpha.11
|
|
50
|
+
"@tbox.cn/app-build": 1.0.0-alpha.11
|
|
51
|
+
"@tbox.cn/app-agent-ui-kit": 1.0.0-alpha.11
|
|
52
|
+
"@tbox.cn/app-cli": 1.0.0-alpha.11
|
|
51
53
|
zustand: 4.5.7
|
|
52
54
|
eslint: 9.39.5
|
|
53
55
|
typescript-eslint: 8.67.0
|
|
@@ -58,17 +60,21 @@ catalog:
|
|
|
58
60
|
"@types/cors": 2.8.19
|
|
59
61
|
"@tbox-dev-js/sdk": 0.1.18
|
|
60
62
|
"@vitejs/plugin-react": 4.7.0
|
|
61
|
-
|
|
63
|
+
tailwindcss: 4.3.5
|
|
64
|
+
"@tailwindcss/vite": 4.3.5
|
|
62
65
|
"@phosphor-icons/react": 2.1.10
|
|
63
|
-
|
|
66
|
+
yet-another-react-lightbox: 3.33.1
|
|
64
67
|
react-markdown: 9.1.0
|
|
65
68
|
remark-gfm: 4.0.1
|
|
66
69
|
happy-dom: 20.11.2
|
|
67
|
-
postcss-pxtorem: 6.1.0
|
|
68
70
|
|
|
69
71
|
# debug 钉版止血(与根 pnpm-workspace.yaml 同步维护;见 2026-09-16-ci-internal-registry-pollution.md):
|
|
70
|
-
#
|
|
72
|
+
# pnpm <10.5.1 会静默忽略 overrides,致 debug 重解析为 4.4.3(模板锁断言失败);工程下限 = engines.pnpm ">=11 <12";
|
|
71
73
|
# 段恒居文件末尾——create --local-deps 的 overrides 条目按"并入末尾段"注入(cli/src/commands/create.ts)。
|
|
72
74
|
# 平台修复内网 registry 数据后随根一并移除。
|
|
73
75
|
overrides:
|
|
74
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
|
|
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
|
|
Binary file
|
|
Binary file
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
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
|
}
|
package/profiles/mall.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$comment": "mall 画像(单一模板统一化 W4):create --profile mall 执行器(W5 接线)按 modules 序列加装 + configOverlay
|
|
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
|
|
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
|
package/scripts/._dev.sh
ADDED
|
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
|
|
35
|
-
*
|
|
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
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
const files = [];
|
|
63
|
+
await collectScanFiles(projectDir, files);
|
|
64
|
+
for (const file of files) {
|
|
50
65
|
const text = await readFile(file, 'utf8');
|
|
51
|
-
|
|
52
|
-
|
|
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.
|
|
123
|
-
console.error('\n
|
|
124
|
-
for (const item of findings.
|
|
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
|
-
|
|
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);
|