@axhub/acp 0.1.0
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/.next/BUILD_ID +1 -0
- package/.next/app-path-routes-manifest.json +21 -0
- package/.next/build-manifest.json +22 -0
- package/.next/export-marker.json +6 -0
- package/.next/fallback-build-manifest.json +13 -0
- package/.next/images-manifest.json +68 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +90 -0
- package/.next/required-server-files.js +336 -0
- package/.next/required-server-files.json +336 -0
- package/.next/routes-manifest.json +171 -0
- package/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
- package/.next/server/app/_global-error/page/build-manifest.json +18 -0
- package/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
- package/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
- package/.next/server/app/_global-error/page.js +10 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -0
- package/.next/server/app/_global-error/page_client-reference-manifest.js +3 -0
- package/.next/server/app/_global-error.html +1 -0
- package/.next/server/app/_global-error.meta +15 -0
- package/.next/server/app/_global-error.rsc +15 -0
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_full.segment.rsc +15 -0
- package/.next/server/app/_global-error.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
- package/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
- package/.next/server/app/_not-found/page/build-manifest.json +18 -0
- package/.next/server/app/_not-found/page/next-font-manifest.json +6 -0
- package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
- package/.next/server/app/_not-found/page.js +13 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +3 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +16 -0
- package/.next/server/app/_not-found.rsc +17 -0
- package/.next/server/app/_not-found.segments/_full.segment.rsc +17 -0
- package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_index.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
- package/.next/server/app/api/acp/capabilities/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/acp/capabilities/route/build-manifest.json +9 -0
- package/.next/server/app/api/acp/capabilities/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/acp/capabilities/route.js +9 -0
- package/.next/server/app/api/acp/capabilities/route.js.nft.json +1 -0
- package/.next/server/app/api/acp/capabilities/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/acp/commands/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/acp/commands/route/build-manifest.json +9 -0
- package/.next/server/app/api/acp/commands/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/acp/commands/route.js +6 -0
- package/.next/server/app/api/acp/commands/route.js.nft.json +1 -0
- package/.next/server/app/api/acp/commands/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/acp/runtime/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/acp/runtime/route/build-manifest.json +9 -0
- package/.next/server/app/api/acp/runtime/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/acp/runtime/route.js +6 -0
- package/.next/server/app/api/acp/runtime/route.js.nft.json +1 -0
- package/.next/server/app/api/acp/runtime/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/chat/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/chat/route/build-manifest.json +9 -0
- package/.next/server/app/api/chat/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/chat/route.js +9 -0
- package/.next/server/app/api/chat/route.js.nft.json +1 -0
- package/.next/server/app/api/chat/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/conversations/[threadId]/messages/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/conversations/[threadId]/messages/route/build-manifest.json +9 -0
- package/.next/server/app/api/conversations/[threadId]/messages/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/conversations/[threadId]/messages/route.js +8 -0
- package/.next/server/app/api/conversations/[threadId]/messages/route.js.nft.json +1 -0
- package/.next/server/app/api/conversations/[threadId]/messages/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/conversations/[threadId]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/conversations/[threadId]/route/build-manifest.json +9 -0
- package/.next/server/app/api/conversations/[threadId]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/conversations/[threadId]/route.js +8 -0
- package/.next/server/app/api/conversations/[threadId]/route.js.nft.json +1 -0
- package/.next/server/app/api/conversations/[threadId]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/conversations/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/conversations/route/build-manifest.json +9 -0
- package/.next/server/app/api/conversations/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/conversations/route.js +8 -0
- package/.next/server/app/api/conversations/route.js.nft.json +1 -0
- package/.next/server/app/api/conversations/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/local-files/image/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/local-files/image/route/build-manifest.json +9 -0
- package/.next/server/app/api/local-files/image/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/local-files/image/route.js +6 -0
- package/.next/server/app/api/local-files/image/route.js.nft.json +1 -0
- package/.next/server/app/api/local-files/image/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/local-files/open/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/local-files/open/route/build-manifest.json +9 -0
- package/.next/server/app/api/local-files/open/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/local-files/open/route.js +6 -0
- package/.next/server/app/api/local-files/open/route.js.nft.json +1 -0
- package/.next/server/app/api/local-files/open/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/output-artifacts/workspace/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/output-artifacts/workspace/route/build-manifest.json +9 -0
- package/.next/server/app/api/output-artifacts/workspace/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/output-artifacts/workspace/route.js +6 -0
- package/.next/server/app/api/output-artifacts/workspace/route.js.nft.json +1 -0
- package/.next/server/app/api/output-artifacts/workspace/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/tools/image-generation/files/[id]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/tools/image-generation/files/[id]/route/build-manifest.json +9 -0
- package/.next/server/app/api/tools/image-generation/files/[id]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/tools/image-generation/files/[id]/route.js +7 -0
- package/.next/server/app/api/tools/image-generation/files/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/tools/image-generation/files/[id]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/tools/image-generation/records/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/tools/image-generation/records/route/build-manifest.json +9 -0
- package/.next/server/app/api/tools/image-generation/records/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/tools/image-generation/records/route.js +7 -0
- package/.next/server/app/api/tools/image-generation/records/route.js.nft.json +1 -0
- package/.next/server/app/api/tools/image-generation/records/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/tools/user-choice/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/tools/user-choice/route/build-manifest.json +9 -0
- package/.next/server/app/api/tools/user-choice/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/tools/user-choice/route.js +6 -0
- package/.next/server/app/api/tools/user-choice/route.js.nft.json +1 -0
- package/.next/server/app/api/tools/user-choice/route_client-reference-manifest.js +3 -0
- package/.next/server/app/favicon.ico/route/app-paths-manifest.json +3 -0
- package/.next/server/app/favicon.ico/route/build-manifest.json +9 -0
- package/.next/server/app/favicon.ico/route.js +7 -0
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
- package/.next/server/app/favicon.ico.body +0 -0
- package/.next/server/app/favicon.ico.meta +1 -0
- package/.next/server/app/page/app-paths-manifest.json +3 -0
- package/.next/server/app/page/build-manifest.json +18 -0
- package/.next/server/app/page/next-font-manifest.json +6 -0
- package/.next/server/app/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/page/server-reference-manifest.json +4 -0
- package/.next/server/app/page.js +14 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +3 -0
- package/.next/server/app/session/[provider]/[sessionId]/page/app-paths-manifest.json +3 -0
- package/.next/server/app/session/[provider]/[sessionId]/page/build-manifest.json +18 -0
- package/.next/server/app/session/[provider]/[sessionId]/page/next-font-manifest.json +6 -0
- package/.next/server/app/session/[provider]/[sessionId]/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/session/[provider]/[sessionId]/page/server-reference-manifest.json +4 -0
- package/.next/server/app/session/[provider]/[sessionId]/page.js +16 -0
- package/.next/server/app/session/[provider]/[sessionId]/page.js.nft.json +1 -0
- package/.next/server/app/session/[provider]/[sessionId]/page_client-reference-manifest.js +3 -0
- package/.next/server/app/thread/[threadId]/page/app-paths-manifest.json +3 -0
- package/.next/server/app/thread/[threadId]/page/build-manifest.json +18 -0
- package/.next/server/app/thread/[threadId]/page/next-font-manifest.json +6 -0
- package/.next/server/app/thread/[threadId]/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/thread/[threadId]/page/server-reference-manifest.json +4 -0
- package/.next/server/app/thread/[threadId]/page.js +15 -0
- package/.next/server/app/thread/[threadId]/page.js.nft.json +1 -0
- package/.next/server/app/thread/[threadId]/page_client-reference-manifest.js +3 -0
- package/.next/server/app-paths-manifest.json +21 -0
- package/.next/server/chunks/0zjb_server_app_api_conversations_[threadId]_messages_route_actions_0poed25.js +3 -0
- package/.next/server/chunks/0zjb_server_app_api_tools_image-generation_files_[id]_route_actions_0-tbvpw.js +3 -0
- package/.next/server/chunks/0zjb_server_app_api_tools_image-generation_records_route_actions_0vu38s2.js +3 -0
- package/.next/server/chunks/[externals]_next_dist_0.m~pv6._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__04xq..~._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__07sxz4_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0dwg3fr._.js +178 -0
- package/.next/server/chunks/[root-of-the-server]__0eanzwb._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0gqx~5k._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0iokgmz._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0j-lxr4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0ly6hop._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0nil~wi._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0tmhg7j._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0txmfnw._.js +4 -0
- package/.next/server/chunks/[root-of-the-server]__0wo0b8z._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0~mtsby._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__10-n4io._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__10g507v._.js +3 -0
- package/.next/server/chunks/[turbopack]_runtime.js +903 -0
- package/.next/server/chunks/_next-internal_server_app_api_acp_capabilities_route_actions_08lck.p.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_acp_commands_route_actions_0as.2z6.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_acp_runtime_route_actions_0o1ybkn.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_chat_route_actions_0tmcf6..js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_conversations_[threadId]_route_actions_12yq8z_.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_conversations_route_actions_131xv69.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_local-files_image_route_actions_0f~10mn.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_local-files_open_route_actions_026mg-2.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_output-artifacts_workspace_route_actions_1239-n7.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_tools_user-choice_route_actions_09xqbn_.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_095lj93.js +3 -0
- package/.next/server/chunks/instrumentation_ts_0zq9-xz._.js +3 -0
- package/.next/server/chunks/lib_conversations_store_ts_0gzcj38._.js +7 -0
- package/.next/server/chunks/node_modules_@vercel_oidc_dist_token_0zdeuds.js +3 -0
- package/.next/server/chunks/node_modules_next_00hve1e._.js +13 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__02qo-zr._.js +19 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0488vn3._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__08e5v4-._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__08iwq-u._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0a1m1mq._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0i9qg2.._.js +33 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0icm-_h._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0piffp7._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0xn-a8p._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0~c929r._.js +33 -0
- package/.next/server/chunks/ssr/[turbopack]_runtime.js +903 -0
- package/.next/server/chunks/ssr/_0-oaqqe._.js +6 -0
- package/.next/server/chunks/ssr/_006q235._.js +3 -0
- package/.next/server/chunks/ssr/_03.pm1z._.js +108 -0
- package/.next/server/chunks/ssr/_0txwi90._.js +3 -0
- package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0k77kol.js +3 -0
- package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0eq97pa.js +3 -0
- package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_09-gtaw.js +3 -0
- package/.next/server/chunks/ssr/_next-internal_server_app_session_[provider]_[sessionId]_page_actions_0_67qh_.js +3 -0
- package/.next/server/chunks/ssr/_next-internal_server_app_thread_[threadId]_page_actions_11mcypo.js +3 -0
- package/.next/server/chunks/ssr/lib_conversations_store_ts_0-pd6d3._.js +4 -0
- package/.next/server/chunks/ssr/node_modules_09w7yel._.js +33 -0
- package/.next/server/chunks/ssr/node_modules_0tev5qq._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_@vercel_oidc_dist_token_0yj7kvj.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_09jzzl8._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_0h9llsw._.js +6 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_0t-hj0x._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0inhx6q._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js +3 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_00297nb.js +4 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_002l7yi.js +4 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_02suzhc.js +4 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_04x9gct.js +4 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0nsg22r.js +4 -0
- package/.next/server/chunks/tools_image-generation_service_mjs_0k_th7-._.js +3 -0
- package/.next/server/edge/chunks/_0e82_ds._.js +3 -0
- package/.next/server/edge/chunks/turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_00ue99t.js +3 -0
- package/.next/server/functions-config-manifest.json +11 -0
- package/.next/server/instrumentation/middleware-manifest.json +12 -0
- package/.next/server/instrumentation.js +4 -0
- package/.next/server/instrumentation.js.nft.json +1 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +22 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +6 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages-manifest.json +4 -0
- package/.next/server/prefetch-hints.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +5 -0
- package/.next/static/chunks/01xlw8hd842-c.js +1 -0
- package/.next/static/chunks/03edqrb4zdj~g.js +31 -0
- package/.next/static/chunks/03qq5fxc~pg00.js +1 -0
- package/.next/static/chunks/03~yq9q893hmn.js +1 -0
- package/.next/static/chunks/0l-_vd.~~z2bw.js +2 -0
- package/.next/static/chunks/0qid5lwcbx9s0.js +1 -0
- package/.next/static/chunks/0t.k8~x~sghva.js +4 -0
- package/.next/static/chunks/0tmpufzgpw2-w.js +1 -0
- package/.next/static/chunks/0v_ue~msygctw.js +1 -0
- package/.next/static/chunks/0y2l0xgouorae.css +1 -0
- package/.next/static/chunks/0zftsky7gte_9.js +102 -0
- package/.next/static/chunks/13nvdsh0e09d0.js +1 -0
- package/.next/static/chunks/1610ha42i.fl~.css +1 -0
- package/.next/static/chunks/turbopack-0mxz-ap91rcoe.js +1 -0
- package/.next/static/mbk_N5Gs4ZJg3lciRL6ya/_buildManifest.js +11 -0
- package/.next/static/mbk_N5Gs4ZJg3lciRL6ya/_clientMiddlewareManifest.js +1 -0
- package/.next/static/mbk_N5Gs4ZJg3lciRL6ya/_ssgManifest.js +1 -0
- package/.next/static/media/favicon.0x3dzn~oxb6tn.ico +0 -0
- package/README.md +113 -0
- package/THIRD_PARTY_NOTICES.md +34 -0
- package/bin/acp.mjs +224 -0
- package/dist/app/globals.css +146 -0
- package/dist/components/assistant-ui/acp-command-menu.d.ts +2 -0
- package/dist/components/assistant-ui/acp-command-menu.mjs +176 -0
- package/dist/components/assistant-ui/acp-elicitation-option-list.d.ts +3 -0
- package/dist/components/assistant-ui/acp-elicitation-option-list.mjs +157 -0
- package/dist/components/assistant-ui/acp-selectors.d.ts +2 -0
- package/dist/components/assistant-ui/acp-selectors.mjs +301 -0
- package/dist/components/assistant-ui/acp-tool-content.d.ts +4 -0
- package/dist/components/assistant-ui/acp-tool-content.mjs +127 -0
- package/dist/components/assistant-ui/addons/host.d.ts +4 -0
- package/dist/components/assistant-ui/addons/host.mjs +85 -0
- package/dist/components/assistant-ui/addons/image-generation-records-section.d.ts +14 -0
- package/dist/components/assistant-ui/addons/image-generation-records-section.mjs +116 -0
- package/dist/components/assistant-ui/addons/output-artifacts-section.d.ts +9 -0
- package/dist/components/assistant-ui/addons/output-artifacts-section.mjs +24 -0
- package/dist/components/assistant-ui/addons/output-artifacts.d.ts +14 -0
- package/dist/components/assistant-ui/addons/output-artifacts.mjs +87 -0
- package/dist/components/assistant-ui/addons/plan-addon.d.ts +2 -0
- package/dist/components/assistant-ui/addons/plan-addon.mjs +39 -0
- package/dist/components/assistant-ui/addons/plan-data.d.ts +5 -0
- package/dist/components/assistant-ui/addons/plan-data.mjs +97 -0
- package/dist/components/assistant-ui/addons/registry.d.ts +2 -0
- package/dist/components/assistant-ui/addons/registry.mjs +8 -0
- package/dist/components/assistant-ui/addons/types.d.ts +13 -0
- package/dist/components/assistant-ui/addons/types.mjs +1 -0
- package/dist/components/assistant-ui/attachment.d.ts +7 -0
- package/dist/components/assistant-ui/attachment.mjs +88 -0
- package/dist/components/assistant-ui/file.d.ts +37 -0
- package/dist/components/assistant-ui/file.mjs +107 -0
- package/dist/components/assistant-ui/image-generation-settings-dialog.d.ts +4 -0
- package/dist/components/assistant-ui/image-generation-settings-dialog.mjs +28 -0
- package/dist/components/assistant-ui/image.d.ts +51 -0
- package/dist/components/assistant-ui/image.mjs +215 -0
- package/dist/components/assistant-ui/markdown-text.d.ts +2 -0
- package/dist/components/assistant-ui/markdown-text.mjs +208 -0
- package/dist/components/assistant-ui/thread/composer.d.ts +27 -0
- package/dist/components/assistant-ui/thread/composer.mjs +15 -0
- package/dist/components/assistant-ui/thread/context-chips.d.ts +2 -0
- package/dist/components/assistant-ui/thread/context-chips.mjs +123 -0
- package/dist/components/assistant-ui/thread/empty-state.d.ts +9 -0
- package/dist/components/assistant-ui/thread/empty-state.mjs +24 -0
- package/dist/components/assistant-ui/thread/index.d.ts +11 -0
- package/dist/components/assistant-ui/thread/index.mjs +43 -0
- package/dist/components/assistant-ui/thread/message-list.d.ts +3 -0
- package/dist/components/assistant-ui/thread/message-list.mjs +16 -0
- package/dist/components/assistant-ui/thread/messages.d.ts +9 -0
- package/dist/components/assistant-ui/thread/messages.mjs +71 -0
- package/dist/components/assistant-ui/thread/scroll-to-bottom.d.ts +2 -0
- package/dist/components/assistant-ui/thread/scroll-to-bottom.mjs +8 -0
- package/dist/components/assistant-ui/thread-list.d.ts +2 -0
- package/dist/components/assistant-ui/thread-list.mjs +31 -0
- package/dist/components/assistant-ui/thread.d.ts +1 -0
- package/dist/components/assistant-ui/thread.mjs +2 -0
- package/dist/components/assistant-ui/threadlist-sidebar.d.ts +6 -0
- package/dist/components/assistant-ui/threadlist-sidebar.mjs +32 -0
- package/dist/components/assistant-ui/tool-fallback.d.ts +31 -0
- package/dist/components/assistant-ui/tool-fallback.mjs +114 -0
- package/dist/components/assistant-ui/tooltip-icon-button.d.ts +7 -0
- package/dist/components/assistant-ui/tooltip-icon-button.mjs +23 -0
- package/dist/components/icons/github.d.ts +3 -0
- package/dist/components/icons/github.mjs +4 -0
- package/dist/components/theme-toggle.d.ts +1 -0
- package/dist/components/theme-toggle.mjs +26 -0
- package/dist/components/tool-ui/option-list.d.ts +34 -0
- package/dist/components/tool-ui/option-list.mjs +163 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/avatar.mjs +40 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.mjs +47 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.mjs +27 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.mjs +58 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.mjs +18 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.mjs +20 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.mjs +26 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/select.mjs +59 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.mjs +20 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.mjs +61 -0
- package/dist/components/ui/sidebar.d.ts +69 -0
- package/dist/components/ui/sidebar.mjs +245 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.mjs +18 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.mjs +20 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.mjs +32 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.mjs +32 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.mjs +15 -0
- package/dist/lib/acp2aisdk/capabilities.d.ts +6 -0
- package/dist/lib/acp2aisdk/capabilities.mjs +210 -0
- package/dist/lib/acp2aisdk/capability-cache.d.ts +17 -0
- package/dist/lib/acp2aisdk/capability-cache.mjs +259 -0
- package/dist/lib/acp2aisdk/client-context.d.ts +38 -0
- package/dist/lib/acp2aisdk/client-context.mjs +247 -0
- package/dist/lib/acp2aisdk/commands.d.ts +11 -0
- package/dist/lib/acp2aisdk/commands.mjs +121 -0
- package/dist/lib/acp2aisdk/config-options.d.ts +3 -0
- package/dist/lib/acp2aisdk/config-options.mjs +86 -0
- package/dist/lib/acp2aisdk/context.d.ts +88 -0
- package/dist/lib/acp2aisdk/context.mjs +33 -0
- package/dist/lib/acp2aisdk/default-capabilities.d.ts +275 -0
- package/dist/lib/acp2aisdk/default-capabilities.mjs +421 -0
- package/dist/lib/acp2aisdk/elicitation.d.ts +37 -0
- package/dist/lib/acp2aisdk/elicitation.mjs +193 -0
- package/dist/lib/acp2aisdk/hitl.d.ts +25 -0
- package/dist/lib/acp2aisdk/hitl.mjs +134 -0
- package/dist/lib/acp2aisdk/index.d.ts +12 -0
- package/dist/lib/acp2aisdk/index.mjs +182 -0
- package/dist/lib/acp2aisdk/mcp-servers.d.ts +17 -0
- package/dist/lib/acp2aisdk/mcp-servers.mjs +153 -0
- package/dist/lib/acp2aisdk/model-selection.d.ts +16 -0
- package/dist/lib/acp2aisdk/model-selection.mjs +65 -0
- package/dist/lib/acp2aisdk/prompt-history.d.ts +9 -0
- package/dist/lib/acp2aisdk/prompt-history.mjs +168 -0
- package/dist/lib/acp2aisdk/provider-compat.d.ts +85 -0
- package/dist/lib/acp2aisdk/provider-compat.mjs +501 -0
- package/dist/lib/acp2aisdk/provider-registry.d.ts +15 -0
- package/dist/lib/acp2aisdk/provider-registry.mjs +196 -0
- package/dist/lib/acp2aisdk/response.d.ts +3 -0
- package/dist/lib/acp2aisdk/response.mjs +33 -0
- package/dist/lib/acp2aisdk/runtime-options.d.ts +2 -0
- package/dist/lib/acp2aisdk/runtime-options.mjs +10 -0
- package/dist/lib/acp2aisdk/session-runtime.d.ts +5 -0
- package/dist/lib/acp2aisdk/session-runtime.mjs +186 -0
- package/dist/lib/acp2aisdk/session-store.d.ts +31 -0
- package/dist/lib/acp2aisdk/session-store.mjs +169 -0
- package/dist/lib/acp2aisdk/skill-command-cache.d.ts +20 -0
- package/dist/lib/acp2aisdk/skill-command-cache.mjs +122 -0
- package/dist/lib/acp2aisdk/stream-metadata.d.ts +10 -0
- package/dist/lib/acp2aisdk/stream-metadata.mjs +251 -0
- package/dist/lib/acp2aisdk/types.d.ts +129 -0
- package/dist/lib/acp2aisdk/types.mjs +0 -0
- package/dist/lib/acp2aisdk/vendor/acp-ai-provider/index.d.ts +10 -0
- package/dist/lib/acp2aisdk/vendor/acp-ai-provider/index.mjs +10 -0
- package/dist/lib/acp2aisdk/vendor/acp-ai-provider/package/index.mjs +1945 -0
- package/dist/lib/api/client.d.ts +93 -0
- package/dist/lib/api/client.mjs +199 -0
- package/dist/lib/api/cors.d.ts +2 -0
- package/dist/lib/api/cors.mjs +47 -0
- package/dist/lib/conversations/client-adapter.d.ts +21 -0
- package/dist/lib/conversations/client-adapter.mjs +329 -0
- package/dist/lib/conversations/message-repository.d.ts +8 -0
- package/dist/lib/conversations/message-repository.mjs +87 -0
- package/dist/lib/conversations/store.d.ts +17 -0
- package/dist/lib/conversations/store.mjs +678 -0
- package/dist/lib/conversations/types.d.ts +92 -0
- package/dist/lib/conversations/types.mjs +0 -0
- package/dist/lib/local-image-files.d.ts +5 -0
- package/dist/lib/local-image-files.mjs +76 -0
- package/dist/lib/local-image-paths.d.ts +7 -0
- package/dist/lib/local-image-paths.mjs +106 -0
- package/dist/lib/output-artifacts/workspace.d.ts +8 -0
- package/dist/lib/output-artifacts/workspace.mjs +174 -0
- package/dist/lib/provider-history/codex.d.ts +4 -0
- package/dist/lib/provider-history/codex.mjs +272 -0
- package/dist/lib/provider-history/index.d.ts +7 -0
- package/dist/lib/provider-history/index.mjs +88 -0
- package/dist/lib/provider-history/types.d.ts +31 -0
- package/dist/lib/provider-history/types.mjs +0 -0
- package/dist/lib/server-runtime.d.ts +22 -0
- package/dist/lib/server-runtime.mjs +78 -0
- package/dist/lib/url-routing.d.ts +18 -0
- package/dist/lib/url-routing.mjs +59 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.mjs +5 -0
- package/dist/lib/workspace-metadata.d.ts +2 -0
- package/dist/lib/workspace-metadata.mjs +20 -0
- package/dist/public-api/react.d.ts +14 -0
- package/dist/public-api/react.mjs +16 -0
- package/dist/public-api/runtime.d.ts +8 -0
- package/dist/public-api/runtime.mjs +7 -0
- package/dist/public-api/server.d.ts +5 -0
- package/dist/public-api/server.mjs +4 -0
- package/dist/public-api/styles.css +1 -0
- package/dist/public-api/ui.d.ts +13 -0
- package/dist/public-api/ui.mjs +13 -0
- package/dist/tools/client-registry.d.ts +9 -0
- package/dist/tools/client-registry.mjs +70 -0
- package/dist/tools/image-generation/client.d.ts +18 -0
- package/dist/tools/image-generation/client.mjs +31 -0
- package/dist/tools/image-generation/config.d.ts +9 -0
- package/dist/tools/image-generation/config.example.json +14 -0
- package/dist/tools/image-generation/config.mjs +11 -0
- package/dist/tools/image-generation/mcp-server.mjs +87 -0
- package/dist/tools/image-generation/registry.d.ts +13 -0
- package/dist/tools/image-generation/registry.mjs +30 -0
- package/dist/tools/image-generation/server.d.ts +6 -0
- package/dist/tools/image-generation/server.mjs +58 -0
- package/dist/tools/image-generation/service.mjs +978 -0
- package/dist/tools/image-generation/shared.d.ts +103 -0
- package/dist/tools/image-generation/shared.mjs +80 -0
- package/dist/tools/image-generation/storage.d.ts +22 -0
- package/dist/tools/image-generation/storage.mjs +8 -0
- package/dist/tools/image-generation/ui-detail.d.ts +26 -0
- package/dist/tools/image-generation/ui-detail.mjs +109 -0
- package/dist/tools/image-generation/ui.d.ts +8 -0
- package/dist/tools/image-generation/ui.mjs +121 -0
- package/dist/tools/registry.d.ts +32 -0
- package/dist/tools/registry.mjs +142 -0
- package/dist/tools/ui-registry.d.ts +3 -0
- package/dist/tools/ui-registry.mjs +20 -0
- package/dist/tools/user-choice/client.d.ts +10 -0
- package/dist/tools/user-choice/client.mjs +18 -0
- package/dist/tools/user-choice/registry.d.ts +12 -0
- package/dist/tools/user-choice/registry.mjs +21 -0
- package/dist/tools/user-choice/server.d.ts +6 -0
- package/dist/tools/user-choice/server.mjs +42 -0
- package/dist/tools/user-choice/shared.d.ts +79 -0
- package/dist/tools/user-choice/shared.mjs +56 -0
- package/dist/tools/user-choice/store.d.ts +19 -0
- package/dist/tools/user-choice/store.mjs +95 -0
- package/dist/tools/user-choice/ui.d.ts +3 -0
- package/dist/tools/user-choice/ui.mjs +396 -0
- package/package.json +118 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
4
|
+
import { TooltipIconButton } from "../tooltip-icon-button.mjs";
|
|
5
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "../../ui/sheet.mjs";
|
|
6
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
7
|
+
import { getAcpPlanKey, useLatestAcpPlan } from "./plan-data.mjs";
|
|
8
|
+
import { getThreadAddons } from "./registry.mjs";
|
|
9
|
+
const ThreadAddonContext = createContext(null);
|
|
10
|
+
function useThreadAddonContext() {
|
|
11
|
+
const context = useContext(ThreadAddonContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error("useThreadAddonContext must be used within ThreadAddonProvider.");
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
function useIsXlViewport() {
|
|
18
|
+
const [matches, setMatches] = useState(false);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const media = window.matchMedia("(min-width: 1280px)");
|
|
21
|
+
const updateMatches = () => setMatches(media.matches);
|
|
22
|
+
updateMatches();
|
|
23
|
+
media.addEventListener("change", updateMatches);
|
|
24
|
+
return () => media.removeEventListener("change", updateMatches);
|
|
25
|
+
}, []);
|
|
26
|
+
return matches;
|
|
27
|
+
}
|
|
28
|
+
export function ThreadAddonProvider({ children }) {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
const addons = useMemo(() => getThreadAddons(), []);
|
|
31
|
+
const defaultAddonId = (_b = (_a = addons[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
|
|
32
|
+
const [activeAddonId, setActiveAddonId] = useState(defaultAddonId);
|
|
33
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
34
|
+
const isDesktop = useIsXlViewport();
|
|
35
|
+
const plan = useLatestAcpPlan();
|
|
36
|
+
const planKey = getAcpPlanKey(plan);
|
|
37
|
+
const lastAutoOpenedPlanKeyRef = useRef("");
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!isDesktop || !planKey)
|
|
40
|
+
return;
|
|
41
|
+
if (lastAutoOpenedPlanKeyRef.current === planKey)
|
|
42
|
+
return;
|
|
43
|
+
lastAutoOpenedPlanKeyRef.current = planKey;
|
|
44
|
+
setActiveAddonId("plan");
|
|
45
|
+
setIsOpen(true);
|
|
46
|
+
}, [isDesktop, planKey]);
|
|
47
|
+
const activeAddon = (_d = (_c = addons.find((addon) => addon.id === activeAddonId)) !== null && _c !== void 0 ? _c : addons[0]) !== null && _d !== void 0 ? _d : null;
|
|
48
|
+
const value = useMemo(() => {
|
|
49
|
+
var _a;
|
|
50
|
+
return ({
|
|
51
|
+
addons,
|
|
52
|
+
activeAddon,
|
|
53
|
+
activeAddonId: (_a = activeAddon === null || activeAddon === void 0 ? void 0 : activeAddon.id) !== null && _a !== void 0 ? _a : null,
|
|
54
|
+
isDesktop,
|
|
55
|
+
isOpen,
|
|
56
|
+
closeAddon: () => setIsOpen(false),
|
|
57
|
+
toggleAddon: (addonId) => {
|
|
58
|
+
setActiveAddonId(addonId);
|
|
59
|
+
setIsOpen((currentOpen) => {
|
|
60
|
+
if (currentOpen && (activeAddon === null || activeAddon === void 0 ? void 0 : activeAddon.id) === addonId)
|
|
61
|
+
return false;
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}, [activeAddon, addons, isDesktop, isOpen]);
|
|
67
|
+
return (_jsx(ThreadAddonContext.Provider, { value: value, children: children }));
|
|
68
|
+
}
|
|
69
|
+
export function ThreadAddonToolbar() {
|
|
70
|
+
const { addons, activeAddonId, isOpen, toggleAddon } = useThreadAddonContext();
|
|
71
|
+
if (addons.length === 0)
|
|
72
|
+
return null;
|
|
73
|
+
return (_jsx("div", { "data-slot": "thread-addon-toolbar", className: "ml-auto flex items-center gap-1", children: addons.map((addon) => {
|
|
74
|
+
const Icon = addon.Icon;
|
|
75
|
+
const active = isOpen && activeAddonId === addon.id;
|
|
76
|
+
return (_jsx(TooltipIconButton, { tooltip: addon.label, "aria-pressed": active, className: cn("size-8 rounded-lg bg-background/80 text-muted-foreground backdrop-blur-sm [&_svg]:size-4", active && "bg-muted text-foreground"), onClick: () => toggleAddon(addon.id), children: _jsx(Icon, { className: "size-4" }) }, addon.id));
|
|
77
|
+
}) }));
|
|
78
|
+
}
|
|
79
|
+
export function ThreadAddonHost({ children }) {
|
|
80
|
+
var _a;
|
|
81
|
+
const { activeAddon, closeAddon, isDesktop, isOpen } = useThreadAddonContext();
|
|
82
|
+
const Panel = activeAddon === null || activeAddon === void 0 ? void 0 : activeAddon.Panel;
|
|
83
|
+
const sheetOpen = Boolean(Panel && isOpen && !isDesktop);
|
|
84
|
+
return (_jsxs("div", { "data-slot": "thread-addon-host", className: "flex h-full min-h-0 w-full", children: [_jsx("div", { className: "min-w-0 flex-1 overflow-hidden", children: children }), Panel && isDesktop && isOpen ? (_jsx("aside", { "data-slot": "thread-addon-desktop-panel", className: "hidden w-[22rem] shrink-0 bg-background px-3 pt-20 pb-4 xl:block", children: _jsx(Panel, { location: "desktop" }) })) : null, _jsx(Sheet, { open: sheetOpen, onOpenChange: (open) => !open && closeAddon(), children: _jsxs(SheetContent, { className: "w-[88vw] gap-0 p-0 sm:max-w-md", children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: (_a = activeAddon === null || activeAddon === void 0 ? void 0 : activeAddon.label) !== null && _a !== void 0 ? _a : "扩展面板" }), _jsx(SheetDescription, { children: "\u663E\u793A\u5F53\u524D\u5BF9\u8BDD\u7684\u6269\u5C55\u9762\u677F\u3002" })] }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto p-4 pt-20", children: Panel ? _jsx(Panel, { location: "mobile" }) : null })] }) })] }));
|
|
85
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
import { type ImageGenerationRecord } from "../../../tools/image-generation/shared";
|
|
3
|
+
type ImageGenerationRecordsState = {
|
|
4
|
+
records: ImageGenerationRecord[];
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: string | null;
|
|
7
|
+
showSection: boolean;
|
|
8
|
+
loadRecords: () => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export declare function useImageGenerationRecords(): ImageGenerationRecordsState;
|
|
11
|
+
export declare const ImageGenerationRecordsSection: FC<{
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
} & ImageGenerationRecordsState>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAuiState } from "@assistant-ui/react";
|
|
4
|
+
import { ImageIcon, RefreshCwIcon } from "lucide-react";
|
|
5
|
+
import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
6
|
+
import { TooltipIconButton } from "../tooltip-icon-button.mjs";
|
|
7
|
+
import { useAcpUiRuntimeContext } from "../../../lib/acp2aisdk/client-context.mjs";
|
|
8
|
+
import { acpApiClient } from "../../../lib/api/client.mjs";
|
|
9
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
10
|
+
import { ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME, IMAGE_GENERATION_MCP_NAME, IMAGE_GENERATION_MCP_TOOL_TITLE, IMAGE_GENERATION_TOOL_NAME, isRecord, parseAcpDynamicToolArgs, parseImageGenerationOutput, } from "../../../tools/image-generation/shared.mjs";
|
|
11
|
+
import { ImageGenerationRecordCard } from "../../../tools/image-generation/ui.mjs";
|
|
12
|
+
const IMAGE_RECORD_LIMIT = 20;
|
|
13
|
+
const IMAGE_RECORD_IDLE_POLL_MS = 12000;
|
|
14
|
+
const IMAGE_RECORD_RUNNING_POLL_MS = 1500;
|
|
15
|
+
function isMcpImageGenerationToolArgs(value) {
|
|
16
|
+
return (isRecord(value) &&
|
|
17
|
+
value.server === IMAGE_GENERATION_MCP_NAME &&
|
|
18
|
+
value.tool === IMAGE_GENERATION_TOOL_NAME);
|
|
19
|
+
}
|
|
20
|
+
function isImageGenerationToolCall(part) {
|
|
21
|
+
if (!isRecord(part) || part.type !== "tool-call")
|
|
22
|
+
return false;
|
|
23
|
+
if (part.toolName === IMAGE_GENERATION_MCP_TOOL_TITLE)
|
|
24
|
+
return true;
|
|
25
|
+
const dynamicArgs = parseAcpDynamicToolArgs(part.args);
|
|
26
|
+
return (part.toolName === ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME &&
|
|
27
|
+
((dynamicArgs === null || dynamicArgs === void 0 ? void 0 : dynamicArgs.toolName) === IMAGE_GENERATION_TOOL_NAME ||
|
|
28
|
+
(dynamicArgs === null || dynamicArgs === void 0 ? void 0 : dynamicArgs.toolName) === IMAGE_GENERATION_MCP_TOOL_TITLE ||
|
|
29
|
+
isMcpImageGenerationToolArgs(dynamicArgs === null || dynamicArgs === void 0 ? void 0 : dynamicArgs.args)));
|
|
30
|
+
}
|
|
31
|
+
function getImageGenerationRecordsKey(messages) {
|
|
32
|
+
const completed = new Set();
|
|
33
|
+
let running = 0;
|
|
34
|
+
for (const message of messages) {
|
|
35
|
+
if (!isRecord(message) || !Array.isArray(message.content))
|
|
36
|
+
continue;
|
|
37
|
+
for (const part of message.content) {
|
|
38
|
+
if (!isImageGenerationToolCall(part))
|
|
39
|
+
continue;
|
|
40
|
+
const result = parseImageGenerationOutput(part.result);
|
|
41
|
+
if (result === null || result === void 0 ? void 0 : result.recordId) {
|
|
42
|
+
completed.add(result.recordId);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
running += 1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (completed.size === 0 && running === 0)
|
|
50
|
+
return "";
|
|
51
|
+
return JSON.stringify({
|
|
52
|
+
completed: [...completed].sort(),
|
|
53
|
+
running,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export function useImageGenerationRecords() {
|
|
57
|
+
const { workspacePath } = useAcpUiRuntimeContext();
|
|
58
|
+
const isRunning = useAuiState((state) => state.thread.isRunning);
|
|
59
|
+
const messages = useAuiState((state) => state.thread.messages);
|
|
60
|
+
const threadId = useAuiState((state) => { var _a; return (_a = state.threadListItem.remoteId) !== null && _a !== void 0 ? _a : state.threads.mainThreadId; });
|
|
61
|
+
const recordsKey = useMemo(() => getImageGenerationRecordsKey([...messages]), [messages]);
|
|
62
|
+
const [records, setRecords] = useState([]);
|
|
63
|
+
const [state, setState] = useState("idle");
|
|
64
|
+
const [error, setError] = useState(null);
|
|
65
|
+
const loadRequestIdRef = useRef(0);
|
|
66
|
+
const loadRecords = useCallback(async () => {
|
|
67
|
+
const loadRequestId = loadRequestIdRef.current + 1;
|
|
68
|
+
loadRequestIdRef.current = loadRequestId;
|
|
69
|
+
if (!threadId) {
|
|
70
|
+
setRecords([]);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
setState((current) => (current === "idle" ? "loading" : current));
|
|
74
|
+
try {
|
|
75
|
+
const response = await acpApiClient.listImageGenerationRecords(workspacePath, threadId, IMAGE_RECORD_LIMIT);
|
|
76
|
+
if (loadRequestId !== loadRequestIdRef.current)
|
|
77
|
+
return;
|
|
78
|
+
setRecords(response.records);
|
|
79
|
+
setError(null);
|
|
80
|
+
setState("idle");
|
|
81
|
+
}
|
|
82
|
+
catch (loadError) {
|
|
83
|
+
if (loadRequestId !== loadRequestIdRef.current)
|
|
84
|
+
return;
|
|
85
|
+
setError(loadError instanceof Error ? loadError.message : String(loadError));
|
|
86
|
+
setState("error");
|
|
87
|
+
}
|
|
88
|
+
}, [threadId, workspacePath]);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
void loadRecords();
|
|
91
|
+
}, [loadRecords]);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (recordsKey)
|
|
94
|
+
void loadRecords();
|
|
95
|
+
}, [loadRecords, recordsKey]);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
const interval = window.setInterval(() => {
|
|
98
|
+
void loadRecords();
|
|
99
|
+
}, isRunning ? IMAGE_RECORD_RUNNING_POLL_MS : IMAGE_RECORD_IDLE_POLL_MS);
|
|
100
|
+
return () => window.clearInterval(interval);
|
|
101
|
+
}, [isRunning, loadRecords]);
|
|
102
|
+
const loading = state === "loading";
|
|
103
|
+
const showSection = records.length > 0;
|
|
104
|
+
return {
|
|
105
|
+
records,
|
|
106
|
+
loading,
|
|
107
|
+
error: state === "error" ? error : null,
|
|
108
|
+
showSection,
|
|
109
|
+
loadRecords,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export const ImageGenerationRecordsSection = ({ compact, records, loading, error, showSection, loadRecords }) => {
|
|
113
|
+
if (!showSection)
|
|
114
|
+
return null;
|
|
115
|
+
return (_jsxs("section", { "data-slot": "thread-image-generation-records", className: "flex min-h-0 flex-col gap-2", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(ImageIcon, { className: "size-4 shrink-0 text-muted-foreground" }), _jsx("h2", { className: "truncate font-medium text-muted-foreground text-sm", children: "\u56FE\u7247\u8BB0\u5F55" })] }), _jsx(TooltipIconButton, { tooltip: "\u5237\u65B0\u56FE\u7247\u8BB0\u5F55", size: "icon-xs", className: "size-7", onClick: () => void loadRecords(), children: _jsx(RefreshCwIcon, { className: cn("size-3.5", loading && "animate-spin") }) })] }), _jsx("div", { className: cn("min-h-0 overflow-y-auto pr-1", compact ? "max-h-72" : "max-h-[min(42vh,24rem)]"), children: records.length > 0 ? (_jsx("div", { className: "flex flex-col gap-2", children: records.map((record) => (_jsx(ImageGenerationRecordCard, { record: record, compact: true }, record.id))) })) : (_jsx("div", { className: "rounded-md border border-dashed px-3 py-4 text-muted-foreground text-sm", children: loading ? "正在加载图片记录" : "暂无图片记录" })) }), error ? (_jsx("p", { className: "rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-destructive text-xs", children: error })) : null] }));
|
|
116
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import { type AcpOutputArtifact } from "./output-artifacts";
|
|
3
|
+
type OutputArtifactsSectionProps = {
|
|
4
|
+
artifacts: AcpOutputArtifact[];
|
|
5
|
+
compact?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function useAcpOutputArtifacts(): AcpOutputArtifact[];
|
|
8
|
+
export declare const OutputArtifactsSection: FC<OutputArtifactsSectionProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAuiState } from "@assistant-ui/react";
|
|
4
|
+
import { FileCodeIcon, PackageOpenIcon } from "lucide-react";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
7
|
+
import { normalizeAcpOutputArtifacts, } from "./output-artifacts.mjs";
|
|
8
|
+
export function useAcpOutputArtifacts() {
|
|
9
|
+
const messages = useAuiState((state) => state.thread.messages);
|
|
10
|
+
return useMemo(() => normalizeAcpOutputArtifacts([...messages]), [messages]);
|
|
11
|
+
}
|
|
12
|
+
function getArtifactTypeLabel(artifact) {
|
|
13
|
+
var _a;
|
|
14
|
+
return (_a = artifact.status) !== null && _a !== void 0 ? _a : "文件";
|
|
15
|
+
}
|
|
16
|
+
function OutputArtifactRow({ artifact }) {
|
|
17
|
+
const typeLabel = getArtifactTypeLabel(artifact);
|
|
18
|
+
return (_jsxs("li", { className: "flex min-w-0 items-start gap-2 rounded-md border border-border/70 bg-muted/15 px-2.5 py-2", children: [_jsx(FileCodeIcon, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground" }), _jsx("div", { className: "min-w-0 flex-1", children: _jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("p", { className: "truncate font-medium text-sm leading-5", children: artifact.title }), _jsx("span", { className: "shrink-0 rounded-sm border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground leading-none", children: typeLabel })] }) })] }));
|
|
19
|
+
}
|
|
20
|
+
export const OutputArtifactsSection = ({ artifacts, compact, }) => {
|
|
21
|
+
if (artifacts.length === 0)
|
|
22
|
+
return null;
|
|
23
|
+
return (_jsxs("section", { "data-slot": "thread-output-artifacts", className: "flex min-h-0 flex-col gap-2", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(PackageOpenIcon, { className: "size-4 shrink-0 text-muted-foreground" }), _jsx("h2", { className: "truncate font-medium text-muted-foreground text-sm", children: "\u4EA7\u7269" })] }), _jsx("ol", { className: cn("flex min-h-0 flex-col gap-2 overflow-y-auto pr-1", compact ? "max-h-56" : "max-h-[min(28vh,16rem)]"), children: artifacts.map((artifact) => (_jsx(OutputArtifactRow, { artifact: artifact }, artifact.id))) })] }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type AcpOutputArtifactKind = "diff";
|
|
2
|
+
export type AcpOutputArtifact = {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: AcpOutputArtifactKind;
|
|
5
|
+
title: string;
|
|
6
|
+
detail?: string;
|
|
7
|
+
status?: "新增" | "修改";
|
|
8
|
+
path?: string;
|
|
9
|
+
oldText?: string | null;
|
|
10
|
+
newText?: string;
|
|
11
|
+
toolCallId: string;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function normalizeAcpOutputArtifacts(messages: readonly unknown[]): AcpOutputArtifact[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
function isRecord(value) {
|
|
2
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
3
|
+
}
|
|
4
|
+
function normalizeString(value) {
|
|
5
|
+
return typeof value === "string" ? value.trim() : "";
|
|
6
|
+
}
|
|
7
|
+
function normalizeUpdatedAt(value) {
|
|
8
|
+
const updatedAt = Number(value);
|
|
9
|
+
return Number.isFinite(updatedAt) ? updatedAt : 0;
|
|
10
|
+
}
|
|
11
|
+
function recordsFromCollection(value) {
|
|
12
|
+
if (Array.isArray(value)) {
|
|
13
|
+
return value.filter((item) => isRecord(item));
|
|
14
|
+
}
|
|
15
|
+
if (!isRecord(value))
|
|
16
|
+
return [];
|
|
17
|
+
return Object.values(value).filter((item) => isRecord(item));
|
|
18
|
+
}
|
|
19
|
+
function getCustomMetadata(message) {
|
|
20
|
+
if (!isRecord(message))
|
|
21
|
+
return undefined;
|
|
22
|
+
const metadata = isRecord(message.metadata) ? message.metadata : undefined;
|
|
23
|
+
const custom = metadata && isRecord(metadata.custom) ? metadata.custom : undefined;
|
|
24
|
+
return custom;
|
|
25
|
+
}
|
|
26
|
+
function getRecordToolCallId(record, fallbackToolCallId) {
|
|
27
|
+
return normalizeString(record.toolCallId) || fallbackToolCallId;
|
|
28
|
+
}
|
|
29
|
+
function normalizeDiffArtifact(record, fallbackToolCallId) {
|
|
30
|
+
const type = normalizeString(record.type);
|
|
31
|
+
if (type && type !== "diff")
|
|
32
|
+
return undefined;
|
|
33
|
+
const toolCallId = getRecordToolCallId(record, fallbackToolCallId);
|
|
34
|
+
if (!toolCallId)
|
|
35
|
+
return undefined;
|
|
36
|
+
const path = normalizeString(record.path);
|
|
37
|
+
const status = record.oldText === null || record.oldText === undefined ? "新增" : "修改";
|
|
38
|
+
const title = path || "未命名文件";
|
|
39
|
+
return {
|
|
40
|
+
id: `diff:${toolCallId}:${path || title}`,
|
|
41
|
+
kind: "diff",
|
|
42
|
+
title,
|
|
43
|
+
detail: status,
|
|
44
|
+
status,
|
|
45
|
+
path: path || undefined,
|
|
46
|
+
oldText: typeof record.oldText === "string" || record.oldText === null
|
|
47
|
+
? record.oldText
|
|
48
|
+
: undefined,
|
|
49
|
+
newText: typeof record.newText === "string" ? record.newText : undefined,
|
|
50
|
+
toolCallId,
|
|
51
|
+
updatedAt: normalizeUpdatedAt(record.updatedAt),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function collectArtifactsFromToolGroup(group, toolCallId) {
|
|
55
|
+
return recordsFromCollection(group.diffs).flatMap((record) => {
|
|
56
|
+
const artifact = normalizeDiffArtifact(record, toolCallId);
|
|
57
|
+
return artifact ? [artifact] : [];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function getArtifactDedupeKey(artifact) {
|
|
61
|
+
const identity = artifact.path || artifact.title;
|
|
62
|
+
return `${artifact.kind}:${artifact.toolCallId}:${identity || artifact.title}`;
|
|
63
|
+
}
|
|
64
|
+
export function normalizeAcpOutputArtifacts(messages) {
|
|
65
|
+
const byDedupeKey = new Map();
|
|
66
|
+
for (const message of messages) {
|
|
67
|
+
const custom = getCustomMetadata(message);
|
|
68
|
+
const acpToolContent = custom === null || custom === void 0 ? void 0 : custom.acpToolContent;
|
|
69
|
+
if (!isRecord(acpToolContent))
|
|
70
|
+
continue;
|
|
71
|
+
const byToolCallId = acpToolContent.byToolCallId;
|
|
72
|
+
if (!isRecord(byToolCallId))
|
|
73
|
+
continue;
|
|
74
|
+
for (const [toolCallId, group] of Object.entries(byToolCallId)) {
|
|
75
|
+
if (!isRecord(group))
|
|
76
|
+
continue;
|
|
77
|
+
for (const artifact of collectArtifactsFromToolGroup(group, toolCallId)) {
|
|
78
|
+
const dedupeKey = getArtifactDedupeKey(artifact);
|
|
79
|
+
const previous = byDedupeKey.get(dedupeKey);
|
|
80
|
+
if (!previous || artifact.updatedAt >= previous.updatedAt) {
|
|
81
|
+
byDedupeKey.set(dedupeKey, artifact);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return [...byDedupeKey.values()].sort((left, right) => left.updatedAt - right.updatedAt);
|
|
87
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CheckCircle2Icon, CircleIcon, ListTodoIcon, ListXIcon, LoaderCircleIcon, } from "lucide-react";
|
|
4
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
5
|
+
import { ImageGenerationRecordsSection, useImageGenerationRecords, } from "./image-generation-records-section.mjs";
|
|
6
|
+
import { OutputArtifactsSection, useAcpOutputArtifacts, } from "./output-artifacts-section.mjs";
|
|
7
|
+
import { useLatestAcpPlan } from "./plan-data.mjs";
|
|
8
|
+
const statusIconMap = {
|
|
9
|
+
pending: CircleIcon,
|
|
10
|
+
in_progress: LoaderCircleIcon,
|
|
11
|
+
completed: CheckCircle2Icon,
|
|
12
|
+
};
|
|
13
|
+
const statusLabelMap = {
|
|
14
|
+
pending: "待处理",
|
|
15
|
+
in_progress: "进行中",
|
|
16
|
+
completed: "已完成",
|
|
17
|
+
};
|
|
18
|
+
const PlanAddonPanel = ({ location }) => {
|
|
19
|
+
const plan = useLatestAcpPlan();
|
|
20
|
+
const artifacts = useAcpOutputArtifacts();
|
|
21
|
+
const imageRecords = useImageGenerationRecords();
|
|
22
|
+
const compact = location === "mobile";
|
|
23
|
+
const hasPlan = plan.length > 0;
|
|
24
|
+
const hasArtifacts = artifacts.length > 0;
|
|
25
|
+
const isEmpty = !hasPlan && !hasArtifacts && !imageRecords.showSection;
|
|
26
|
+
return (_jsxs("div", { "data-slot": "thread-plan-addon", className: cn("flex h-full min-h-0 flex-col gap-5", compact && "px-1"), children: [hasPlan ? (_jsxs("section", { className: "flex min-h-0 flex-col gap-3", children: [_jsx("h2", { className: "font-medium text-muted-foreground text-sm", children: "\u4EFB\u52A1\u8FDB\u5EA6" }), _jsx("ol", { className: "flex max-h-[min(56vh,32rem)] flex-col gap-3 overflow-x-hidden overflow-y-auto pr-1", children: plan.map((entry) => {
|
|
27
|
+
const Icon = statusIconMap[entry.status];
|
|
28
|
+
const isRunning = entry.status === "in_progress";
|
|
29
|
+
return (_jsxs("li", { className: "flex min-w-0 items-start gap-3", children: [_jsx("span", { "aria-hidden": "true", className: cn("mt-0.5 flex size-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground", isRunning && "text-foreground"), children: _jsx(Icon, { className: cn("size-4 shrink-0", entry.status === "completed" &&
|
|
30
|
+
"fill-muted-foreground text-background", isRunning && "animate-spin motion-reduce:animate-none") }) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "wrap-break-word font-medium text-sm leading-5", children: entry.content }), _jsx("span", { className: "sr-only", children: statusLabelMap[entry.status] })] })] }, `${entry.status}-${entry.priority}-${entry.content}`));
|
|
31
|
+
}) })] })) : null, _jsx(OutputArtifactsSection, { artifacts: artifacts, compact: compact }), _jsx(ImageGenerationRecordsSection, Object.assign({ compact: compact }, imageRecords)), isEmpty ? (_jsxs("div", { className: "flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed px-4 py-8 text-center text-muted-foreground text-sm", children: [_jsx(ListXIcon, { className: "size-5" }), _jsx("p", { children: "\u6682\u65E0\u4EFB\u52A1\u3001\u4EA7\u7269\u548C\u5DE5\u5177\u8BB0\u5F55" })] })) : null] }));
|
|
32
|
+
};
|
|
33
|
+
export const planThreadAddon = {
|
|
34
|
+
id: "plan",
|
|
35
|
+
label: "任务",
|
|
36
|
+
Icon: ListTodoIcon,
|
|
37
|
+
Panel: PlanAddonPanel,
|
|
38
|
+
order: 10,
|
|
39
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PlanEntry } from "@agentclientprotocol/sdk/dist/schema";
|
|
2
|
+
export type AcpPlanEntry = Pick<PlanEntry, "content" | "priority" | "status">;
|
|
3
|
+
export declare function normalizeAcpPlan(value: unknown): AcpPlanEntry[];
|
|
4
|
+
export declare function useLatestAcpPlan(): AcpPlanEntry[];
|
|
5
|
+
export declare function getAcpPlanKey(plan: readonly AcpPlanEntry[]): string;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useAuiState } from "@assistant-ui/react";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
const PLAN_PRIORITIES = new Set(["high", "medium", "low"]);
|
|
5
|
+
const PLAN_STATUSES = new Set(["pending", "in_progress", "completed"]);
|
|
6
|
+
function isRecord(value) {
|
|
7
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
8
|
+
}
|
|
9
|
+
export function normalizeAcpPlan(value) {
|
|
10
|
+
if (!Array.isArray(value))
|
|
11
|
+
return [];
|
|
12
|
+
return value.flatMap((entry) => {
|
|
13
|
+
if (!isRecord(entry))
|
|
14
|
+
return [];
|
|
15
|
+
const { content, priority, status } = entry;
|
|
16
|
+
if (typeof content !== "string")
|
|
17
|
+
return [];
|
|
18
|
+
if (typeof priority !== "string" || !PLAN_PRIORITIES.has(priority)) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
if (typeof status !== "string" || !PLAN_STATUSES.has(status)) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
content,
|
|
27
|
+
priority: priority,
|
|
28
|
+
status: status,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function getCustomMetadata(message) {
|
|
34
|
+
var _a;
|
|
35
|
+
return (_a = message.metadata) === null || _a === void 0 ? void 0 : _a.custom;
|
|
36
|
+
}
|
|
37
|
+
function normalizePlanId(value) {
|
|
38
|
+
return typeof value === "string" ? value.trim() : "";
|
|
39
|
+
}
|
|
40
|
+
function getLatestKeyedAcpPlan(custom) {
|
|
41
|
+
const acpPlans = custom === null || custom === void 0 ? void 0 : custom.acpPlans;
|
|
42
|
+
if (!isRecord(acpPlans))
|
|
43
|
+
return [];
|
|
44
|
+
const byId = isRecord(acpPlans.byId) ? acpPlans.byId : {};
|
|
45
|
+
const removed = isRecord(acpPlans.removed) ? acpPlans.removed : {};
|
|
46
|
+
const latestId = normalizePlanId(acpPlans.latestId);
|
|
47
|
+
const sortedCandidates = Object.entries(byId).sort(([, left], [, right]) => {
|
|
48
|
+
const leftUpdatedAt = isRecord(left) ? Number(left.updatedAt) : 0;
|
|
49
|
+
const rightUpdatedAt = isRecord(right) ? Number(right.updatedAt) : 0;
|
|
50
|
+
return rightUpdatedAt - leftUpdatedAt;
|
|
51
|
+
});
|
|
52
|
+
const candidates = latestId
|
|
53
|
+
? [
|
|
54
|
+
[latestId, byId[latestId]],
|
|
55
|
+
...sortedCandidates.filter(([id]) => id !== latestId),
|
|
56
|
+
]
|
|
57
|
+
: sortedCandidates;
|
|
58
|
+
for (const [id, plan] of candidates) {
|
|
59
|
+
if (removed[id])
|
|
60
|
+
continue;
|
|
61
|
+
if (!isRecord(plan) || plan.removed)
|
|
62
|
+
continue;
|
|
63
|
+
if (plan.type !== "items")
|
|
64
|
+
continue;
|
|
65
|
+
const entries = normalizeAcpPlan(plan.entries);
|
|
66
|
+
if (entries.length > 0)
|
|
67
|
+
return entries;
|
|
68
|
+
}
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
export function useLatestAcpPlan() {
|
|
72
|
+
const messages = useAuiState((state) => state.thread.messages);
|
|
73
|
+
return useMemo(() => {
|
|
74
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
75
|
+
const message = messages[index];
|
|
76
|
+
if (!message)
|
|
77
|
+
continue;
|
|
78
|
+
if (message.role === "user")
|
|
79
|
+
return [];
|
|
80
|
+
if (message.role !== "assistant")
|
|
81
|
+
continue;
|
|
82
|
+
const custom = getCustomMetadata(message);
|
|
83
|
+
const keyedPlan = getLatestKeyedAcpPlan(custom);
|
|
84
|
+
if (keyedPlan.length > 0)
|
|
85
|
+
return keyedPlan;
|
|
86
|
+
const plan = normalizeAcpPlan(custom === null || custom === void 0 ? void 0 : custom.acpPlan);
|
|
87
|
+
if (plan.length > 0)
|
|
88
|
+
return plan;
|
|
89
|
+
}
|
|
90
|
+
return [];
|
|
91
|
+
}, [messages]);
|
|
92
|
+
}
|
|
93
|
+
export function getAcpPlanKey(plan) {
|
|
94
|
+
if (plan.length === 0)
|
|
95
|
+
return "";
|
|
96
|
+
return JSON.stringify(plan);
|
|
97
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ComponentType } from "react";
|
|
3
|
+
export type ThreadAddonPanelLocation = "desktop" | "mobile";
|
|
4
|
+
export type ThreadAddonPanelProps = {
|
|
5
|
+
location: ThreadAddonPanelLocation;
|
|
6
|
+
};
|
|
7
|
+
export type ThreadAddon = {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
Icon: LucideIcon;
|
|
11
|
+
Panel: ComponentType<ThreadAddonPanelProps>;
|
|
12
|
+
order: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
export declare const UserMessageAttachments: FC;
|
|
3
|
+
export declare const ComposerAttachments: FC;
|
|
4
|
+
export type ComposerAddAttachmentProps = {
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const ComposerAddAttachment: FC<ComposerAddAttachmentProps>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AttachmentPrimitive, ComposerPrimitive, MessagePrimitive, useAui, useAuiState, } from "@assistant-ui/react";
|
|
4
|
+
import { FileText, PlusIcon, XIcon } from "lucide-react";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { useShallow } from "zustand/shallow";
|
|
7
|
+
import { TooltipIconButton } from "./tooltip-icon-button.mjs";
|
|
8
|
+
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar.mjs";
|
|
9
|
+
import { Dialog, DialogContent, DialogTitle, DialogTrigger, } from "../ui/dialog.mjs";
|
|
10
|
+
import { Tooltip, TooltipContent, TooltipTrigger, } from "../ui/tooltip.mjs";
|
|
11
|
+
import { cn } from "../../lib/utils.mjs";
|
|
12
|
+
const useFileSrc = (file) => {
|
|
13
|
+
const [src, setSrc] = useState(undefined);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!file) {
|
|
16
|
+
setSrc(undefined);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const objectUrl = URL.createObjectURL(file);
|
|
20
|
+
setSrc(objectUrl);
|
|
21
|
+
return () => {
|
|
22
|
+
URL.revokeObjectURL(objectUrl);
|
|
23
|
+
};
|
|
24
|
+
}, [file]);
|
|
25
|
+
return src;
|
|
26
|
+
};
|
|
27
|
+
const useAttachmentSrc = () => {
|
|
28
|
+
var _a;
|
|
29
|
+
const { file, src } = useAuiState(useShallow((s) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (s.attachment.type !== "image")
|
|
32
|
+
return {};
|
|
33
|
+
if (s.attachment.file)
|
|
34
|
+
return { file: s.attachment.file };
|
|
35
|
+
const src = (_b = (_a = s.attachment.content) === null || _a === void 0 ? void 0 : _a.filter((c) => c.type === "image")[0]) === null || _b === void 0 ? void 0 : _b.image;
|
|
36
|
+
if (!src)
|
|
37
|
+
return {};
|
|
38
|
+
return { src };
|
|
39
|
+
}));
|
|
40
|
+
return (_a = useFileSrc(file)) !== null && _a !== void 0 ? _a : src;
|
|
41
|
+
};
|
|
42
|
+
const AttachmentPreview = ({ src }) => {
|
|
43
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
44
|
+
return (_jsx("img", { src: src, alt: "\u9644\u4EF6\u9884\u89C8", className: cn("block h-auto max-h-[80vh] w-auto max-w-full object-contain", isLoaded
|
|
45
|
+
? "aui-attachment-preview-image-loaded"
|
|
46
|
+
: "aui-attachment-preview-image-loading invisible"), onLoad: () => setIsLoaded(true) }));
|
|
47
|
+
};
|
|
48
|
+
const AttachmentPreviewDialog = ({ children }) => {
|
|
49
|
+
const src = useAttachmentSrc();
|
|
50
|
+
if (!src)
|
|
51
|
+
return children;
|
|
52
|
+
return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { className: "aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50", asChild: true, children: children }), _jsxs(DialogContent, { className: "aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0! [&_svg]:text-background [&>button]:hover:[&_svg]:text-destructive", children: [_jsx(DialogTitle, { className: "aui-sr-only sr-only", children: "\u56FE\u7247\u9644\u4EF6\u9884\u89C8" }), _jsx("div", { className: "aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background", children: _jsx(AttachmentPreview, { src: src }) })] })] }));
|
|
53
|
+
};
|
|
54
|
+
const AttachmentThumb = () => {
|
|
55
|
+
const src = useAttachmentSrc();
|
|
56
|
+
return (_jsxs(Avatar, { className: "aui-attachment-tile-avatar h-full w-full rounded-none", children: [_jsx(AvatarImage, { src: src, alt: "\u9644\u4EF6\u9884\u89C8", className: "aui-attachment-tile-image object-cover" }), _jsx(AvatarFallback, { children: _jsx(FileText, { className: "aui-attachment-tile-fallback-icon size-8 text-muted-foreground" }) })] }));
|
|
57
|
+
};
|
|
58
|
+
const AttachmentUI = () => {
|
|
59
|
+
const aui = useAui();
|
|
60
|
+
const isComposer = aui.attachment.source !== "message";
|
|
61
|
+
const isImage = useAuiState((s) => s.attachment.type === "image");
|
|
62
|
+
const typeLabel = useAuiState((s) => {
|
|
63
|
+
const type = s.attachment.type;
|
|
64
|
+
switch (type) {
|
|
65
|
+
case "image":
|
|
66
|
+
return "图片";
|
|
67
|
+
case "document":
|
|
68
|
+
return "文档";
|
|
69
|
+
case "file":
|
|
70
|
+
return "文件";
|
|
71
|
+
default:
|
|
72
|
+
return type;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return (_jsxs(Tooltip, { children: [_jsxs(AttachmentPrimitive.Root, { className: cn("aui-attachment-root relative", isImage && "aui-attachment-root-composer only:*:first:size-24"), children: [_jsx(AttachmentPreviewDialog, { children: _jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[calc(var(--composer-radius)-var(--composer-padding))] border bg-muted p-0 transition-opacity hover:opacity-75", "aria-label": `${typeLabel}附件`, children: _jsx(AttachmentThumb, {}) }) }) }), isComposer && _jsx(AttachmentRemove, {})] }), _jsx(TooltipContent, { side: "top", children: _jsx(AttachmentPrimitive.Name, {}) })] }));
|
|
76
|
+
};
|
|
77
|
+
const AttachmentRemove = () => {
|
|
78
|
+
return (_jsx(AttachmentPrimitive.Remove, { asChild: true, children: _jsx(TooltipIconButton, { tooltip: "\u79FB\u9664\u6587\u4EF6", className: "aui-attachment-tile-remove absolute end-1.5 top-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:bg-white! [&_svg]:text-black hover:[&_svg]:text-destructive", side: "top", children: _jsx(XIcon, { className: "aui-attachment-remove-icon size-3 dark:stroke-[2.5px]" }) }) }));
|
|
79
|
+
};
|
|
80
|
+
export const UserMessageAttachments = () => {
|
|
81
|
+
return (_jsx("div", { className: "aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2", children: _jsx(MessagePrimitive.Attachments, { children: () => _jsx(AttachmentUI, {}) }) }));
|
|
82
|
+
};
|
|
83
|
+
export const ComposerAttachments = () => {
|
|
84
|
+
return (_jsx("div", { className: "aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden", children: _jsx(ComposerPrimitive.Attachments, { children: () => _jsx(AttachmentUI, {}) }) }));
|
|
85
|
+
};
|
|
86
|
+
export const ComposerAddAttachment = ({ label = "添加附件", }) => {
|
|
87
|
+
return (_jsx(ComposerPrimitive.AddAttachment, { asChild: true, children: _jsx(TooltipIconButton, { tooltip: label, side: "bottom", variant: "ghost", size: "icon", className: "aui-composer-add-attachment size-8 rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30", "aria-label": label, children: _jsx(PlusIcon, { className: "aui-attachment-add-icon size-5 stroke-[1.5px]" }) }) }));
|
|
88
|
+
};
|