@tbox.cn/app-template-agent 0.10.36 → 1.0.0-alpha.6
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 +7 -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 +3 -19
- package/.tbox/card-render/._demo.html +0 -0
- package/.tbox/card-render/._demo.png +0 -0
- package/.tbox/card-render/._scale-demo.audit.html +0 -0
- package/.tbox/card-render/._scale-demo.html +0 -0
- package/.tbox/card-render/baseline/._demo.png +0 -0
- package/.tbox/card-render/baseline/demo.png +0 -0
- package/.tbox/card-render/demo.html +342 -0
- package/.tbox/card-render/demo.png +0 -0
- package/.tbox/card-render/scale-demo.audit.html +984 -0
- package/.tbox/card-render/scale-demo.html +939 -0
- package/.tbox/default-modules.json +4 -1
- package/.tbox/evidence/._cards.txt +0 -0
- package/.tbox/evidence/._gate.json +0 -0
- package/.tbox/evidence/._last-gate.json +0 -0
- package/.tbox/evidence/._scenarios.json +0 -0
- package/.tbox/evidence/cards.txt +1 -0
- package/.tbox/evidence/gate.json +1 -0
- package/.tbox/evidence/last-gate.json +1 -0
- package/.tbox/evidence/scenarios.json +1 -0
- package/.tbox/miniapp-containers.json +1 -1
- package/AGENTS.md +93 -148
- package/ENV.md +4 -4
- package/README.md +31 -27
- package/apps/._AGENTS.md +0 -0
- package/apps/AGENTS.md +9 -0
- package/apps/client/._STYLE_GUIDE.md +0 -0
- package/apps/client/._VISUAL_RESTORE.md +0 -0
- 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/.tbox-gen/._manifest.json +0 -0
- package/apps/client/.tbox-gen/._registry.client.ts +0 -0
- package/apps/client/.tbox-gen/._registry.server.ts +0 -0
- package/apps/client/.tbox-gen/documents/._index.html +0 -0
- package/apps/client/.tbox-gen/documents/_tbox/._card-preview.html +0 -0
- package/apps/client/.tbox-gen/documents/_tbox/card-preview.html +62 -0
- package/apps/client/.tbox-gen/documents/index.html +63 -0
- package/apps/client/.tbox-gen/entries/._card-preview.tsx +0 -0
- package/apps/client/.tbox-gen/entries/._index.tsx +0 -0
- package/apps/client/.tbox-gen/entries/card-preview.tsx +6 -0
- package/apps/client/.tbox-gen/entries/index.tsx +11 -0
- package/apps/client/.tbox-gen/manifest.json +17 -0
- package/apps/client/.tbox-gen/registry.client.ts +6 -0
- package/apps/client/.tbox-gen/registry.server.ts +15 -0
- package/apps/client/STYLE_GUIDE.md +31 -64
- package/apps/client/index.html +39 -15
- package/apps/client/package.json +6 -5
- package/apps/client/scripts/._check-evidence.mjs +0 -0
- package/apps/client/scripts/._render-card.mjs +0 -0
- package/apps/client/scripts/check-evidence.mjs +688 -0
- package/apps/client/scripts/render-card.mjs +743 -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 +40 -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/cards/registry.ts +6 -19
- 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 +11 -0
- 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 +51 -0
- package/apps/client/src/styles/tailwind.css +307 -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 +5 -53
- 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/package.json +1 -1
- 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 +382 -0
- package/apps/server/scripts/scenario-lib.mjs +223 -0
- package/apps/server/scripts/scenario.mjs +33 -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 +17 -17
- 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/cli/collect-registry.ts +7 -11
- package/apps/server/src/config/._integration.ts +0 -0
- package/apps/server/src/dev.ts +38 -64
- package/apps/server/src/index.ts +27 -45
- 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 +20 -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/cards-registry.test.ts +1 -1
- package/apps/server/tests/helpers/._register.ts +0 -0
- package/apps/server/tests/helpers/register.ts +10 -0
- package/apps/server/tests/tool-runtime.test.ts +1 -28
- package/apps/server/tsconfig.json +1 -1
- package/apps/server/tsup.config.ts +6 -3
- 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 +13 -0
- package/config/README.md +4 -4
- package/config/chat.json +8 -2
- 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 +96 -0
- package/docs/agent/card.md +116 -0
- package/docs/agent/conversation.md +52 -0
- package/docs/agent/kit.md +79 -0
- package/docs/agent/shell.md +76 -0
- package/docs/agent/state.md +85 -0
- package/docs/agent/style.md +95 -0
- package/docs/agent/tool-emits-card.md +57 -0
- package/docs/agent/tool.md +69 -0
- package/docs/agent/verify.md +129 -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/{packages → modules}/provider-custom/AGENTS.md +6 -6
- package/modules/provider-custom/INTEGRATION.md +10 -0
- package/{packages → modules}/provider-custom/package.json +1 -0
- 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/{packages → modules}/provider-custom/src/server/example-adapter.ts +2 -2
- package/{packages → modules}/provider-custom/src/server/index.ts +1 -1
- package/modules/provider-custom/tests/._provider-custom.test.ts +0 -0
- package/package.json +19 -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 +4 -4
- 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 +842 -0
- package/packages/agent-ui-kit/package.json +8 -5
- 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/._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/._types.ts +0 -0
- package/packages/agent-ui-kit/src/._vite-env.d.ts +0 -0
- package/packages/agent-ui-kit/src/ChatPage.tsx +34 -7
- 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/define-card.ts +34 -0
- package/packages/agent-ui-kit/src/card/primitives.test.tsx +147 -0
- package/packages/agent-ui-kit/src/card/primitives.tsx +627 -0
- package/packages/agent-ui-kit/src/card/use-card-actions.ts +86 -0
- package/packages/agent-ui-kit/src/chat-config.test.ts +35 -71
- package/packages/agent-ui-kit/src/chat-config.ts +18 -0
- 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.tsx +3 -3
- package/packages/agent-ui-kit/src/components/ActionBar/index.tsx +13 -14
- 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.tsx +32 -26
- 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/HistoryEntry/._index.tsx +0 -0
- package/packages/agent-ui-kit/src/components/HistoryEntry/index.tsx +3 -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 +52 -27
- 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.tsx +6 -6
- 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 +2 -4
- 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 +54 -36
- 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 +55 -2
- package/packages/agent-ui-kit/src/shell.contract.json +59 -0
- package/packages/agent-ui-kit/src/shell.test.ts +61 -0
- package/packages/agent-ui-kit/src/shell.ts +45 -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 +132 -0
- package/packages/agent-ui-kit/src/theme/contract.json +1 -1
- package/packages/agent-ui-kit/src/theme/theme-contract.test.ts +3 -3
- package/packages/agent-ui-kit/src/theme/{tokens.less → tokens.css} +14 -12
- 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/._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.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/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 +13 -0
- package/packages/shared/package.json +20 -0
- package/packages/shared/src/._index.ts +0 -0
- package/packages/shared/src/index.ts +8 -0
- package/packages/shared/tsconfig.json +7 -0
- package/pnpm-lock.template.yaml +745 -512
- package/pnpm-workspace.template.yaml +17 -10
- package/profiles/._mall.json +0 -0
- package/profiles/mall/._TEMPLATE.md +0 -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/._llm_provider.json +0 -0
- package/profiles/mall/config/._plugins.json +0 -0
- package/scenarios/._README.md +0 -0
- package/scenarios/README.md +7 -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/._compat-probe.mjs +0 -0
- package/scripts/._dev-alipay.mjs +0 -0
- package/scripts/._dev.sh +0 -0
- package/scripts/._gen-tailwind-sources.mjs +0 -0
- package/scripts/._generate.mjs +0 -0
- package/scripts/._prepare.sh +0 -0
- package/scripts/._smoke.mjs +0 -0
- package/scripts/._start.sh +0 -0
- package/scripts/._stop.sh +0 -0
- package/scripts/._verify-generated.mjs +0 -0
- package/scripts/check-css-target.mjs +69 -0
- package/scripts/check-fast.mjs +113 -0
- package/scripts/check-workspace.mjs +68 -19
- package/scripts/checks.json +205 -0
- package/scripts/compat-probe.mjs +108 -0
- package/scripts/dev-alipay.mjs +1 -1
- package/scripts/gen-tailwind-sources.mjs +55 -0
- package/scripts/generate.mjs +3 -0
- package/scripts/verify-generated.mjs +22 -127
- package/tsconfig.base.json +1 -0
- package/apps/client/src/app.tsx +0 -11
- package/apps/client/src/business/App.tsx +0 -11
- package/apps/client/src/business/README.md +0 -99
- package/apps/client/src/business/routes.json +0 -3
- package/apps/client/src/main.tsx +0 -17
- package/apps/client/src/modules.ts +0 -33
- package/apps/client/src/platform/AgentChatApp.tsx +0 -14
- 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 -12
- package/apps/client/src/platform/mount-page.tsx +0 -25
- package/apps/client/src/platform/state/createPersistedStore.ts +0 -19
- package/apps/server/src/app-tools.ts +0 -14
- package/apps/server/src/modules.ts +0 -38
- package/apps/server/src/tools/clock.ts +0 -24
- package/apps/server/src/tools/translate.ts +0 -47
- package/packages/agent-ui-kit/src/ChatPage.less +0 -66
- 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/{packages → modules}/provider-custom/LICENSE +0 -0
- /package/{packages → modules}/provider-custom/README.md +0 -0
- /package/{packages → modules}/provider-custom/src/index.ts +0 -0
- /package/{packages → modules}/provider-custom/tbox.module.json +0 -0
- /package/{packages → modules}/provider-custom/tests/provider-custom.test.ts +0 -0
- /package/{packages → modules}/provider-custom/tsconfig.json +0 -0
- /package/{packages → modules}/provider-custom/tsup.config.ts +0 -0
- /package/packages/agent-ui-kit/src/theme/{motion.less → motion.css} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@app
|
|
3
|
-
"version": "0.
|
|
2
|
+
"name": "@tbox.cn/app-agent-ui-kit",
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Agent 对话壳 UI 组件包(源码发布,单一模板统一化 W2-1):ChatPage/壳组件族/主题 tokens。",
|
|
6
6
|
"exports": {
|
|
@@ -13,8 +13,12 @@
|
|
|
13
13
|
"import": "./src/theme/theme.ts"
|
|
14
14
|
},
|
|
15
15
|
"./package.json": "./package.json",
|
|
16
|
-
"./theme/
|
|
17
|
-
"./theme/contract": "./src/theme/contract.json"
|
|
16
|
+
"./theme/base.css": "./src/theme/base.css",
|
|
17
|
+
"./theme/contract": "./src/theme/contract.json",
|
|
18
|
+
"./icons": {
|
|
19
|
+
"types": "./src/icons.ts",
|
|
20
|
+
"import": "./src/icons.ts"
|
|
21
|
+
}
|
|
18
22
|
},
|
|
19
23
|
"scripts": {
|
|
20
24
|
"typecheck": "tsc --noEmit",
|
|
@@ -44,7 +48,6 @@
|
|
|
44
48
|
"@types/react": "catalog:",
|
|
45
49
|
"@types/react-dom": "catalog:",
|
|
46
50
|
"happy-dom": "catalog:",
|
|
47
|
-
"less": "catalog:",
|
|
48
51
|
"react": "catalog:",
|
|
49
52
|
"react-dom": "catalog:",
|
|
50
53
|
"typescript": "catalog:",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -17,6 +17,7 @@ import { MessageBubble } from './components/MessageBubble';
|
|
|
17
17
|
import { QuickCommands } from './components/QuickCommands';
|
|
18
18
|
import ScrollToBottomButton from './components/ScrollToBottomButton';
|
|
19
19
|
import { useChatConfigStore } from './chat-config';
|
|
20
|
+
import { resolveBrandName } from './shell';
|
|
20
21
|
import {
|
|
21
22
|
KitChatProvider,
|
|
22
23
|
useChatStore,
|
|
@@ -25,8 +26,7 @@ import {
|
|
|
25
26
|
type KitChatContextValue,
|
|
26
27
|
} from './store-context';
|
|
27
28
|
import type { ChatInputMessage } from './types';
|
|
28
|
-
import './
|
|
29
|
-
import './theme/tokens.less';
|
|
29
|
+
import './theme/tokens.css';
|
|
30
30
|
|
|
31
31
|
export interface ChatPageProps {
|
|
32
32
|
/** 应用 chat store(zustand 绑定 hook + API;如 `useChatStore`) */
|
|
@@ -87,6 +87,10 @@ function ChatPageInner() {
|
|
|
87
87
|
|
|
88
88
|
const slots = useClientSlots();
|
|
89
89
|
const homeSlot = slots?.resolve('home');
|
|
90
|
+
const identity = useChatConfigStore((s) => s.identity);
|
|
91
|
+
const welcome = useChatConfigStore((s) => s.welcome);
|
|
92
|
+
// 常驻品牌条:chat.json identity.name → HELLO_ACK 的 mallName → 不渲染(壳契约见 shell.ts)
|
|
93
|
+
const brandName = resolveBrandName(identity, mallName);
|
|
90
94
|
|
|
91
95
|
const [showScrollToBottom, setShowScrollToBottom] = useState(false);
|
|
92
96
|
const [voiceActive, setVoiceActive] = useState(false);
|
|
@@ -196,6 +200,14 @@ function ChatPageInner() {
|
|
|
196
200
|
|
|
197
201
|
const showHistoryEntry = historyHasMore && historyMessages.length === 0;
|
|
198
202
|
|
|
203
|
+
// 空会话欢迎区:没有 home 槽时给首屏一个落点(标题来自 chat.json welcome,缺省「开始对话」)
|
|
204
|
+
const showWelcome = !homeSlot
|
|
205
|
+
&& historyMessages.length === 0
|
|
206
|
+
&& messages.length === 0
|
|
207
|
+
&& inlineOrphanCards.length === 0;
|
|
208
|
+
const welcomeTitle = welcome?.title ?? identity?.name ?? '开始对话';
|
|
209
|
+
const welcomeSubtitle = welcome?.subtitle ?? identity?.tagline;
|
|
210
|
+
|
|
199
211
|
const pull = usePullDownHistory({
|
|
200
212
|
isAtTopRef,
|
|
201
213
|
isLoadingHistory,
|
|
@@ -239,12 +251,19 @@ function ChatPageInner() {
|
|
|
239
251
|
}, [messages, orphanCards, liveCardSignature]);
|
|
240
252
|
|
|
241
253
|
return (
|
|
242
|
-
<div className={`chat-page${showHome ? '' : ' chat-page--conversation'}`}>
|
|
243
|
-
<div className="chat-page__bg" />
|
|
254
|
+
<div className={`chat-page relative flex h-full w-full min-h-0 flex-col overflow-hidden bg-background ${showHome ? '' : ' chat-page--conversation'}`}>
|
|
255
|
+
<div className="chat-page__bg pointer-events-none absolute inset-0 z-0 bg-background" />
|
|
244
256
|
|
|
245
|
-
|
|
257
|
+
{brandName ? (
|
|
258
|
+
<div className="chat-page__brand relative z-10 flex items-baseline justify-center gap-3 border-b border-border bg-background px-page pb-3 pt-[calc(16px+env(safe-area-inset-top))]" aria-label={brandName}>
|
|
259
|
+
<span className="chat-page__brand-name text-base font-bold tracking-wide text-foreground">{brandName}</span>
|
|
260
|
+
{identity?.tagline ? <span className="chat-page__brand-tagline text-xs text-muted-foreground">{identity.tagline}</span> : null}
|
|
261
|
+
</div>
|
|
262
|
+
) : null}
|
|
263
|
+
|
|
264
|
+
<div className="chat-page__body-wrapper relative z-10 flex min-h-0 flex-1 flex-col">
|
|
246
265
|
<div
|
|
247
|
-
className="chat-page__body"
|
|
266
|
+
className="chat-page__body mx-auto w-full max-w-content flex-1 min-h-0 overflow-y-auto overflow-x-hidden overscroll-contain pb-6 pt-[calc(12px+env(safe-area-inset-top))] [overflow-anchor:none] [scrollbar-width:none] [-webkit-overflow-scrolling:touch] [&::-webkit-scrollbar]:hidden"
|
|
248
267
|
ref={bodyRef}
|
|
249
268
|
onScroll={onScroll}
|
|
250
269
|
onWheel={pull.handleWheel}
|
|
@@ -267,6 +286,14 @@ function ChatPageInner() {
|
|
|
267
286
|
))}
|
|
268
287
|
</div>
|
|
269
288
|
|
|
289
|
+
{/* 空会话欢迎区:没有 home 槽时的首屏落点(文案来自 chat.json welcome / identity) */}
|
|
290
|
+
{showWelcome ? (
|
|
291
|
+
<div className="chat-page__welcome flex flex-col items-center justify-center gap-2 px-page pb-5 pt-15 text-center">
|
|
292
|
+
<h2 className="chat-page__welcome-title m-0 text-xl font-bold text-foreground">{welcomeTitle}</h2>
|
|
293
|
+
{welcomeSubtitle ? <p className="chat-page__welcome-subtitle m-0 text-sm leading-normal text-muted-foreground">{welcomeSubtitle}</p> : null}
|
|
294
|
+
</div>
|
|
295
|
+
) : null}
|
|
296
|
+
|
|
270
297
|
{/* 历史前插视口锚 + home 槽渲染位(域自持显隐;缺席则不渲染) */}
|
|
271
298
|
<div className="chat-page__home-slot" ref={historyAnchorRef}>
|
|
272
299
|
{homeSlot?.({ onSend: send, ...(mallName ? { mallName } : {}) })}
|
|
@@ -274,7 +301,7 @@ function ChatPageInner() {
|
|
|
274
301
|
|
|
275
302
|
{/* 业务旁路 emit 的卡片(如欢迎卡) */}
|
|
276
303
|
{inlineOrphanCards.map((card) => (
|
|
277
|
-
<div key={card.id} className="chat-page__orphan-card">
|
|
304
|
+
<div key={card.id} className="chat-page__orphan-card mx-page">
|
|
278
305
|
<CardRenderer card={card} />
|
|
279
306
|
</div>
|
|
280
307
|
))}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 卡片工厂:把「带静态 type 的组件」这一形态固化。
|
|
3
|
+
*
|
|
4
|
+
* 应用级卡片有两条强制约束同时成立:
|
|
5
|
+
* - app-build 扫描器要求 `export const card = defineCard({ type: '…' }, …)` 的首参是对象字面量;
|
|
6
|
+
* - 生成 registry 把导出值直接当 `CardComponent` 注册,所以运行期必须是组件且带 `.type`。
|
|
7
|
+
* 手写 Object.assign 每张卡重复一遍形态,且容易漏掉 `.type`——本工厂是唯一写法。
|
|
8
|
+
*/
|
|
9
|
+
import type { ComponentType } from 'react';
|
|
10
|
+
import type { CardComponent } from '@tbox.cn/app-contracts';
|
|
11
|
+
|
|
12
|
+
/** 应用级卡片的渲染入参(与 `CardComponent` 同形,由协议定义,此处仅命名)。 */
|
|
13
|
+
export interface CardRenderProps<T> {
|
|
14
|
+
data: T;
|
|
15
|
+
cardId: string;
|
|
16
|
+
isHistory: boolean;
|
|
17
|
+
actionTokens?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** `defineCard` 的返回类型:既是可注册的卡片组件,也带静态 `type`。 */
|
|
21
|
+
export type DefinedCard<T> = CardComponent<T> & { type: string };
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 声明一张应用级卡片。
|
|
25
|
+
*
|
|
26
|
+
* @param meta 卡片类型声明;`type` 必须与同 base 的服务端 meta 的 `cardType` 一致
|
|
27
|
+
* @param Component 渲染组件,入参为 `CardRenderProps`
|
|
28
|
+
*/
|
|
29
|
+
export function defineCard<T>(
|
|
30
|
+
meta: { type: string },
|
|
31
|
+
Component: ComponentType<CardRenderProps<T>>,
|
|
32
|
+
): DefinedCard<T> {
|
|
33
|
+
return Object.assign(Component, { type: meta.type }) as unknown as DefinedCard<T>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
3
|
+
import {
|
|
4
|
+
ActionList,
|
|
5
|
+
ActionRow,
|
|
6
|
+
Bill,
|
|
7
|
+
Card,
|
|
8
|
+
CardButton,
|
|
9
|
+
CardHeader,
|
|
10
|
+
CheckRow,
|
|
11
|
+
ConfirmSheet,
|
|
12
|
+
EmptyState,
|
|
13
|
+
EntityRow,
|
|
14
|
+
Hero,
|
|
15
|
+
KeyValueList,
|
|
16
|
+
MediaRow,
|
|
17
|
+
Notice,
|
|
18
|
+
StatGrid,
|
|
19
|
+
StatusTag,
|
|
20
|
+
Steps,
|
|
21
|
+
TagList,
|
|
22
|
+
Ticket,
|
|
23
|
+
Timeline,
|
|
24
|
+
} from './primitives';
|
|
25
|
+
|
|
26
|
+
const html = (node: React.ReactElement) => renderToStaticMarkup(node);
|
|
27
|
+
|
|
28
|
+
describe('卡片基元', () => {
|
|
29
|
+
it('容器 + 标题 + 属性列表成套渲染', () => {
|
|
30
|
+
const markup = html(
|
|
31
|
+
<Card footer="数据更新于刚刚">
|
|
32
|
+
<CardHeader eyebrow="订单" title="待支付" status={<StatusTag tone="warning">待支付</StatusTag>} />
|
|
33
|
+
<KeyValueList items={[{ label: '车牌', value: '浙A·12345' }, { label: '入场', value: '12:01' }]} />
|
|
34
|
+
</Card>,
|
|
35
|
+
);
|
|
36
|
+
expect(markup).toContain('tbox-card-primitive');
|
|
37
|
+
expect(markup).toContain('待支付');
|
|
38
|
+
expect(markup).toContain('浙A·12345');
|
|
39
|
+
expect(markup).toContain('数据更新于刚刚');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('明细带合计', () => {
|
|
43
|
+
const markup = html(
|
|
44
|
+
<Bill lines={[{ label: '停车费', value: '15.00 元' }, { label: '券抵扣', value: '-10.00 元', muted: true }]} total={{ label: '应付', value: '5.00 元' }} />,
|
|
45
|
+
);
|
|
46
|
+
expect(markup).toContain('应付');
|
|
47
|
+
expect(markup).toContain('tbox-bill__row--muted');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('提示条按 tone 变体', () => {
|
|
51
|
+
expect(html(<Notice tone="warning">额度不足</Notice>)).toContain('tbox-notice--warning');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('按钮行在禁用态加类名', () => {
|
|
55
|
+
const markup = html(
|
|
56
|
+
<ActionRow disabled primary={<CardButton>立即支付</CardButton>} secondary={<CardButton variant="secondary">取消</CardButton>} />,
|
|
57
|
+
);
|
|
58
|
+
expect(markup).toContain('tbox-actions--disabled');
|
|
59
|
+
expect(markup).toContain('立即支付');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('确认弹层关闭时渲染为空', () => {
|
|
63
|
+
expect(
|
|
64
|
+
html(
|
|
65
|
+
<ConfirmSheet open={false} title="确认" onConfirm={() => {}} onCancel={() => {}} />,
|
|
66
|
+
),
|
|
67
|
+
).toBe('');
|
|
68
|
+
expect(
|
|
69
|
+
html(<ConfirmSheet open title="确认入会" description="将获得 100 积分" onConfirm={() => {}} onCancel={() => {}} />),
|
|
70
|
+
).toContain('确认入会');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('票券、步骤、图文条目可渲染', () => {
|
|
74
|
+
expect(html(<Ticket amount="20 元" condition="满 100 可用" meta="有效期至 12-31" />)).toContain('tbox-ticket__amount');
|
|
75
|
+
expect(html(<Steps steps={[{ title: 'B2 层', detail: '靠近 3 号电梯' }, { title: '取车' }]} />)).toContain('tbox-steps__index');
|
|
76
|
+
expect(html(<MediaRow title="江南小馆" meta="B1 · 人均 60" action={<CardButton variant="link">去看看</CardButton>} />)).toContain('江南小馆');
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
describe('第二版基元', () => {
|
|
82
|
+
it('Hero / StatGrid / Timeline 渲染品牌块与数值', () => {
|
|
83
|
+
const markup = html(
|
|
84
|
+
<>
|
|
85
|
+
<Hero eyebrow="MEMBER" title="我的积分" value={100} unit="积分" footnote="可兑停车券" />
|
|
86
|
+
<StatGrid items={[{ label: '积分', value: 100 }, { label: '券', value: 2, hint: '本月' }]} />
|
|
87
|
+
<Timeline items={[{ label: '入会礼', amount: '+100', tone: 'gain', time: '11/18' }]} />
|
|
88
|
+
</>,
|
|
89
|
+
);
|
|
90
|
+
expect(markup).toContain('tbox-hero');
|
|
91
|
+
expect(markup).toContain('我的积分');
|
|
92
|
+
expect(markup).toContain('tbox-stats__value');
|
|
93
|
+
expect(markup).toContain('tbox-timeline__item--gain');
|
|
94
|
+
expect(markup).toContain('+100');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('EntityRow 支持价格与说明,EmptyState 给下一步', () => {
|
|
98
|
+
const markup = html(
|
|
99
|
+
<>
|
|
100
|
+
<EntityRow title="江南小馆" meta="餐饮 · L1" price="¥80/人" tags={<TagList tags={['满100减15']} />} />
|
|
101
|
+
<EmptyState title="暂无停车券" description="缴费或参加活动可攒积分" />
|
|
102
|
+
</>,
|
|
103
|
+
);
|
|
104
|
+
expect(markup).toContain('tbox-entity__price');
|
|
105
|
+
expect(markup).toContain('¥80/人');
|
|
106
|
+
expect(markup).toContain('tbox-empty__desc');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('CheckRow 只读态不带交互语义', () => {
|
|
110
|
+
const readOnly = html(<CheckRow label="使用停车券" checked />);
|
|
111
|
+
expect(readOnly).toContain('tbox-check--on');
|
|
112
|
+
expect(readOnly).toContain('tbox-check--static');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('ActionList 点击前确认时先开弹层,确认后才调用动作', () => {
|
|
116
|
+
const calls: string[] = [];
|
|
117
|
+
const api = {
|
|
118
|
+
send: (text: string) => calls.push(`send:${text}`),
|
|
119
|
+
invoke: (id: string, input?: Record<string, unknown>) => calls.push(`invoke:${id}:${JSON.stringify(input ?? {})}`),
|
|
120
|
+
disabled: false,
|
|
121
|
+
isHistory: false,
|
|
122
|
+
isGenerating: false,
|
|
123
|
+
};
|
|
124
|
+
const markup = html(
|
|
125
|
+
<ActionList
|
|
126
|
+
api={api}
|
|
127
|
+
actions={[
|
|
128
|
+
{ label: '确认支付', invoke: { id: 'pay-parking', input: { plate: '浙A' } }, confirm: { title: '确认支付 ¥5?' } },
|
|
129
|
+
{ label: '再想想', send: { text: '先不付', displayText: '先不付' } },
|
|
130
|
+
]}
|
|
131
|
+
/>,
|
|
132
|
+
);
|
|
133
|
+
expect(markup).toContain('确认支付');
|
|
134
|
+
expect(markup).toContain('再想想');
|
|
135
|
+
expect(calls).toEqual([]);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('ActionList 禁用时按钮带 disabled', () => {
|
|
139
|
+
const markup = html(
|
|
140
|
+
<ActionList
|
|
141
|
+
api={{ send: () => {}, invoke: () => {}, disabled: true, isHistory: false, isGenerating: false }}
|
|
142
|
+
actions={[{ label: '领券', invoke: { id: 'claim' } }]}
|
|
143
|
+
/>,
|
|
144
|
+
);
|
|
145
|
+
expect(markup).toContain('disabled');
|
|
146
|
+
});
|
|
147
|
+
});
|