@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,37 @@
|
|
|
1
|
+
import type { FileMessagePartComponent } from "@assistant-ui/react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { type FC } from "react";
|
|
4
|
+
declare const fileVariants: (props?: ({
|
|
5
|
+
variant?: "outline" | "ghost" | "muted" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function getMimeTypeIcon(mimeType: string): FC<{
|
|
9
|
+
className?: string;
|
|
10
|
+
}>;
|
|
11
|
+
declare function getBase64Size(base64: string): number;
|
|
12
|
+
declare function formatFileSize(bytes: number): string;
|
|
13
|
+
export type FileRootProps = React.ComponentProps<"div"> & VariantProps<typeof fileVariants>;
|
|
14
|
+
declare function FileRoot({ className, variant, size, children, ...props }: FileRootProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
type FileIconDisplayProps = React.ComponentProps<"span"> & {
|
|
16
|
+
mimeType?: string;
|
|
17
|
+
};
|
|
18
|
+
declare function FileIconDisplay({ mimeType, className, children, ...props }: FileIconDisplayProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function FileName({ className, children, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
type FileSizeProps = React.ComponentProps<"span"> & {
|
|
21
|
+
bytes: number;
|
|
22
|
+
};
|
|
23
|
+
declare function FileSize({ bytes, className, ...props }: FileSizeProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
type FileDownloadProps = Omit<React.ComponentProps<"a">, "href"> & {
|
|
25
|
+
data: string;
|
|
26
|
+
mimeType: string;
|
|
27
|
+
filename?: string;
|
|
28
|
+
};
|
|
29
|
+
declare function FileDownload({ data, mimeType, filename, className, children, ...props }: FileDownloadProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare const File: FileMessagePartComponent & {
|
|
31
|
+
Root: typeof FileRoot;
|
|
32
|
+
Icon: typeof FileIconDisplay;
|
|
33
|
+
Name: typeof FileName;
|
|
34
|
+
Size: typeof FileSize;
|
|
35
|
+
Download: typeof FileDownload;
|
|
36
|
+
};
|
|
37
|
+
export { File, FileDownload, FileIconDisplay, FileName, FileRoot, FileSize, fileVariants, formatFileSize, getBase64Size, getMimeTypeIcon, };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { cva } from "class-variance-authority";
|
|
15
|
+
import { BracesIcon, DownloadIcon, FileIcon, FileTextIcon, ImageIcon, MusicIcon, VideoIcon, } from "lucide-react";
|
|
16
|
+
import { memo } from "react";
|
|
17
|
+
import { cn } from "../../lib/utils.mjs";
|
|
18
|
+
const fileVariants = cva("aui-file-root inline-flex items-center gap-3 rounded-lg transition-colors", {
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
outline: "border-border border hover:bg-muted/50",
|
|
22
|
+
ghost: "hover:bg-muted/50",
|
|
23
|
+
muted: "bg-muted/50 hover:bg-muted/70",
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
sm: "px-2.5 py-1.5 text-xs",
|
|
27
|
+
default: "px-3 py-2 text-sm",
|
|
28
|
+
lg: "px-4 py-3 text-base",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: "outline",
|
|
33
|
+
size: "default",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
function getMimeTypeIcon(mimeType) {
|
|
37
|
+
if (mimeType.startsWith("image/")) {
|
|
38
|
+
return ImageIcon;
|
|
39
|
+
}
|
|
40
|
+
if (mimeType === "application/pdf") {
|
|
41
|
+
return FileTextIcon;
|
|
42
|
+
}
|
|
43
|
+
if (mimeType === "application/json") {
|
|
44
|
+
return BracesIcon;
|
|
45
|
+
}
|
|
46
|
+
if (mimeType.startsWith("text/")) {
|
|
47
|
+
return FileTextIcon;
|
|
48
|
+
}
|
|
49
|
+
if (mimeType.startsWith("audio/")) {
|
|
50
|
+
return MusicIcon;
|
|
51
|
+
}
|
|
52
|
+
if (mimeType.startsWith("video/")) {
|
|
53
|
+
return VideoIcon;
|
|
54
|
+
}
|
|
55
|
+
return FileIcon;
|
|
56
|
+
}
|
|
57
|
+
function getBase64Size(base64) {
|
|
58
|
+
const commaIndex = base64.indexOf(",");
|
|
59
|
+
const base64Data = commaIndex >= 0 ? base64.slice(commaIndex + 1) : base64;
|
|
60
|
+
const padding = (base64Data.match(/=/g) || []).length;
|
|
61
|
+
return Math.floor((base64Data.length * 3) / 4) - padding;
|
|
62
|
+
}
|
|
63
|
+
function formatFileSize(bytes) {
|
|
64
|
+
if (bytes < 1024) {
|
|
65
|
+
return `${bytes} B`;
|
|
66
|
+
}
|
|
67
|
+
if (bytes < 1024 * 1024) {
|
|
68
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
69
|
+
}
|
|
70
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
71
|
+
}
|
|
72
|
+
function FileRoot(_a) {
|
|
73
|
+
var { className, variant, size, children } = _a, props = __rest(_a, ["className", "variant", "size", "children"]);
|
|
74
|
+
return (_jsx("div", Object.assign({ "data-slot": "file-root", "data-variant": variant, "data-size": size, className: cn(fileVariants({ variant, size, className })) }, props, { children: children })));
|
|
75
|
+
}
|
|
76
|
+
function FileIconDisplay(_a) {
|
|
77
|
+
var { mimeType, className, children } = _a, props = __rest(_a, ["mimeType", "className", "children"]);
|
|
78
|
+
const IconComponent = mimeType ? getMimeTypeIcon(mimeType) : FileIcon;
|
|
79
|
+
return (_jsx("span", Object.assign({ "data-slot": "file-icon", className: cn("shrink-0 text-muted-foreground", className) }, props, { children: children !== null && children !== void 0 ? children : _jsx(IconComponent, { className: "size-5" }) })));
|
|
80
|
+
}
|
|
81
|
+
function FileName(_a) {
|
|
82
|
+
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
83
|
+
return (_jsx("span", Object.assign({ "data-slot": "file-name", className: cn("min-w-0 flex-1 truncate font-medium", className) }, props, { children: children || "Unnamed file" })));
|
|
84
|
+
}
|
|
85
|
+
function FileSize(_a) {
|
|
86
|
+
var { bytes, className } = _a, props = __rest(_a, ["bytes", "className"]);
|
|
87
|
+
return (_jsx("span", Object.assign({ "data-slot": "file-size", className: cn("shrink-0 text-muted-foreground", className) }, props, { children: formatFileSize(bytes) })));
|
|
88
|
+
}
|
|
89
|
+
function FileDownload(_a) {
|
|
90
|
+
var { data, mimeType, filename, className, children } = _a, props = __rest(_a, ["data", "mimeType", "filename", "className", "children"]);
|
|
91
|
+
const href = data.startsWith("data:")
|
|
92
|
+
? data
|
|
93
|
+
: `data:${mimeType};base64,${data}`;
|
|
94
|
+
return (_jsx("a", Object.assign({ "data-slot": "file-download", href: href, download: filename || "download", className: cn("shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground", className) }, props, { children: children || _jsx(DownloadIcon, { className: "size-4" }) })));
|
|
95
|
+
}
|
|
96
|
+
const FileImpl = ({ filename, data, mimeType }) => {
|
|
97
|
+
const bytes = getBase64Size(data);
|
|
98
|
+
return (_jsxs(FileRoot, { children: [_jsx(FileIconDisplay, { mimeType: mimeType }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsx(FileName, { children: filename }), _jsx(FileSize, { bytes: bytes, className: "text-xs" })] }), _jsx(FileDownload, Object.assign({ data: data, mimeType: mimeType }, (filename !== undefined && { filename })))] }));
|
|
99
|
+
};
|
|
100
|
+
const File = memo(FileImpl);
|
|
101
|
+
File.displayName = "File";
|
|
102
|
+
File.Root = FileRoot;
|
|
103
|
+
File.Icon = FileIconDisplay;
|
|
104
|
+
File.Name = FileName;
|
|
105
|
+
File.Size = FileSize;
|
|
106
|
+
File.Download = FileDownload;
|
|
107
|
+
export { File, FileDownload, FileIconDisplay, FileName, FileRoot, FileSize, fileVariants, formatFileSize, getBase64Size, getMimeTypeIcon, };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "../ui/dialog.mjs";
|
|
4
|
+
import { Input } from "../ui/input.mjs";
|
|
5
|
+
import { Label } from "../ui/label.mjs";
|
|
6
|
+
import { Switch } from "../ui/switch.mjs";
|
|
7
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs.mjs";
|
|
8
|
+
import { useAcpUiRuntimeContext } from "../../lib/acp2aisdk/client-context.mjs";
|
|
9
|
+
import { normalizeImageGenerationToolSettings } from "../../tools/image-generation/client.mjs";
|
|
10
|
+
import { IMAGE_GENERATION_TOOL_ID } from "../../tools/image-generation/shared.mjs";
|
|
11
|
+
import { normalizeUserChoiceToolSettings } from "../../tools/user-choice/client.mjs";
|
|
12
|
+
import { USER_CHOICE_TOOL_ID } from "../../tools/user-choice/shared.mjs";
|
|
13
|
+
export function ImageGenerationSettingsDialog({ trigger, }) {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
const { builtinToolSettings, setBuiltinToolSettings } = useAcpUiRuntimeContext();
|
|
16
|
+
const imageGenerationToolSettings = normalizeImageGenerationToolSettings(builtinToolSettings[IMAGE_GENERATION_TOOL_ID]);
|
|
17
|
+
const userChoiceToolSettings = normalizeUserChoiceToolSettings(builtinToolSettings[USER_CHOICE_TOOL_ID]);
|
|
18
|
+
const updateSetting = (key, value) => {
|
|
19
|
+
setBuiltinToolSettings(IMAGE_GENERATION_TOOL_ID, (current) => (Object.assign(Object.assign({}, normalizeImageGenerationToolSettings(current)), { [key]: value })));
|
|
20
|
+
};
|
|
21
|
+
const updateUserChoiceSetting = (key, value) => {
|
|
22
|
+
setBuiltinToolSettings(USER_CHOICE_TOOL_ID, (current) => (Object.assign(Object.assign({}, normalizeUserChoiceToolSettings(current)), { [key]: value })));
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: trigger }), _jsxs(DialogContent, { className: "sm:max-w-xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "\u5DE5\u5177\u8BBE\u7F6E" }), _jsx(DialogDescription, { children: "\u914D\u7F6E\u5185\u7F6E\u5DE5\u5177\u7684\u8FDE\u63A5\u4FE1\u606F\u548C\u4EA4\u4E92\u884C\u4E3A\u3002" })] }), _jsxs(Tabs, { defaultValue: "image-generation", children: [_jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [_jsx(TabsTrigger, { value: "image-generation", children: "\u56FE\u7247\u751F\u6210" }), _jsx(TabsTrigger, { value: "user-choice", children: "\u7528\u6237\u9009\u62E9" })] }), _jsxs(TabsContent, { value: "image-generation", className: "grid gap-4", children: [_jsxs("div", { className: "flex items-center justify-between gap-3 rounded-md border px-3 py-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx(Label, { htmlFor: "image-generation-enabled", children: "\u56FE\u7247\u751F\u6210\u5DE5\u5177" }), _jsx("p", { className: "mt-1 text-muted-foreground text-xs", children: "\u5141\u8BB8\u6A21\u578B\u901A\u8FC7 MCP \u8C03\u7528\u56FE\u7247\u751F\u6210\u3002" })] }), _jsx(Switch, { id: "image-generation-enabled", checked: imageGenerationToolSettings.enabled, onCheckedChange: (checked) => updateSetting("enabled", checked) })] }), _jsx(SettingsInput, { id: "image-generation-base-url", label: "API Base URL", placeholder: "https://api.openai.com/v1", value: (_a = imageGenerationToolSettings.baseUrl) !== null && _a !== void 0 ? _a : "", onValueChange: (value) => updateSetting("baseUrl", value) }), _jsx(SettingsInput, { id: "image-generation-api-key", label: "API Key", placeholder: "sk-...", type: "password", value: (_b = imageGenerationToolSettings.apiKey) !== null && _b !== void 0 ? _b : "", onValueChange: (value) => updateSetting("apiKey", value) }), _jsx(SettingsInput, { id: "image-generation-model", label: "\u6A21\u578B", placeholder: "gpt-image-1", value: (_c = imageGenerationToolSettings.model) !== null && _c !== void 0 ? _c : "", onValueChange: (value) => updateSetting("model", value) }), _jsxs("div", { className: "flex items-center justify-between gap-3 rounded-md border px-3 py-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx(Label, { htmlFor: "image-generation-preserve-prompt", children: "\u4FDD\u7559\u539F\u59CB\u63D0\u793A\u8BCD" }), _jsx("p", { className: "mt-1 text-muted-foreground text-xs", children: "\u8BF7\u6C42\u56FE\u7247 API \u65F6\u5728 prompt \u524D\u52A0\u5165\u4E0D\u8981\u6539\u5199\u63D0\u793A\uFF0C\u8BB0\u5F55\u4ECD\u663E\u793A\u539F\u59CB\u63D0\u793A\u8BCD\u3002" })] }), _jsx(Switch, { id: "image-generation-preserve-prompt", checked: imageGenerationToolSettings.preservePrompt, onCheckedChange: (checked) => updateSetting("preservePrompt", checked) })] })] }), _jsxs(TabsContent, { value: "user-choice", className: "grid gap-4", children: [_jsxs("div", { className: "flex items-center justify-between gap-3 rounded-md border px-3 py-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx(Label, { htmlFor: "user-choice-enabled", children: "\u7528\u6237\u9009\u62E9\u5DE5\u5177" }), _jsx("p", { className: "mt-1 text-muted-foreground text-xs", children: "\u5141\u8BB8\u6A21\u578B\u901A\u8FC7 MCP \u53D1\u8D77\u5355\u9009\u3001\u591A\u9009\u6216\u591A\u9898\u9009\u62E9\u3002" })] }), _jsx(Switch, { id: "user-choice-enabled", checked: userChoiceToolSettings.enabled, onCheckedChange: (checked) => updateUserChoiceSetting("enabled", checked) })] }), _jsx(SettingsInput, { id: "user-choice-timeout-ms", label: "\u7B49\u5F85\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09", type: "number", value: String(userChoiceToolSettings.waitTimeoutMs), onValueChange: (value) => updateUserChoiceSetting("waitTimeoutMs", Number.parseInt(value, 10)) }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx(Label, { htmlFor: "user-choice-custom-input", children: "\u5141\u8BB8\u81EA\u5B9A\u4E49\u8F93\u5165" }), _jsx(Switch, { id: "user-choice-custom-input", checked: userChoiceToolSettings.allowCustomInput, onCheckedChange: (checked) => updateUserChoiceSetting("allowCustomInput", checked) })] }), _jsx(SettingsInput, { id: "user-choice-custom-input-label", label: "\u81EA\u5B9A\u4E49\u9009\u9879\u6587\u6848", value: userChoiceToolSettings.customInputLabel, onValueChange: (value) => updateUserChoiceSetting("customInputLabel", value) })] })] }), _jsx(DialogFooter, { showCloseButton: true })] })] }));
|
|
25
|
+
}
|
|
26
|
+
function SettingsInput({ id, label, value, onValueChange, placeholder, type = "text", }) {
|
|
27
|
+
return (_jsxs("div", { className: "grid gap-2", children: [_jsx(Label, { htmlFor: id, children: label }), _jsx(Input, { id: id, type: type, value: value, placeholder: placeholder, onChange: (event) => onValueChange(event.currentTarget.value) })] }));
|
|
28
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ImageMessagePart, ImageMessagePartComponent } from "@assistant-ui/react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { type PropsWithChildren } from "react";
|
|
4
|
+
declare const imageVariants: (props?: ({
|
|
5
|
+
variant?: "outline" | "ghost" | "muted" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | "full" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export type ImageRootProps = React.ComponentProps<"div"> & VariantProps<typeof imageVariants>;
|
|
9
|
+
declare function ImageRoot({ className, variant, size, children, ...props }: ImageRootProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
type ImagePreviewProps = Omit<React.ComponentProps<"img">, "children"> & {
|
|
11
|
+
containerClassName?: string;
|
|
12
|
+
};
|
|
13
|
+
declare function ImagePreview({ className, containerClassName, onLoad, onError, alt, src, ...props }: ImagePreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function ImageFilename({ className, children, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
type ImageZoomProps = PropsWithChildren<{
|
|
16
|
+
src: string;
|
|
17
|
+
alt?: string;
|
|
18
|
+
}>;
|
|
19
|
+
declare function ImageZoom({ src, alt, children }: ImageZoomProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function ImageGenerating({ className }: {
|
|
21
|
+
className?: string;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function ImageContentFilterError({ className, reason, }: {
|
|
24
|
+
className?: string;
|
|
25
|
+
reason?: string;
|
|
26
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export type ImageActionsProps = {
|
|
28
|
+
part: ImageMessagePart;
|
|
29
|
+
onRegenerate?: () => void | Promise<void>;
|
|
30
|
+
className?: string;
|
|
31
|
+
};
|
|
32
|
+
declare function ImageActions({ part, onRegenerate, className }: ImageActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
declare const Image: ImageMessagePartComponent & {
|
|
34
|
+
Root: typeof ImageRoot;
|
|
35
|
+
Preview: typeof ImagePreview;
|
|
36
|
+
Filename: typeof ImageFilename;
|
|
37
|
+
Zoom: typeof ImageZoom;
|
|
38
|
+
Actions: typeof ImageActions;
|
|
39
|
+
Generating: typeof ImageGenerating;
|
|
40
|
+
ContentFilterError: typeof ImageContentFilterError;
|
|
41
|
+
};
|
|
42
|
+
export { Image, ImageActions, ImageContentFilterError, ImageFilename, ImageGenerating, ImagePreview, ImageRoot, ImageZoom, imageVariants, };
|
|
43
|
+
export declare const ImageMessage: ImageMessagePartComponent & {
|
|
44
|
+
Root: typeof ImageRoot;
|
|
45
|
+
Preview: typeof ImagePreview;
|
|
46
|
+
Filename: typeof ImageFilename;
|
|
47
|
+
Zoom: typeof ImageZoom;
|
|
48
|
+
Actions: typeof ImageActions;
|
|
49
|
+
Generating: typeof ImageGenerating;
|
|
50
|
+
ContentFilterError: typeof ImageContentFilterError;
|
|
51
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { cva } from "class-variance-authority";
|
|
15
|
+
import { CopyIcon, DownloadIcon, ImageIcon, ImageOffIcon, Loader2Icon, RefreshCwIcon, ShieldAlertIcon, } from "lucide-react";
|
|
16
|
+
import { memo, useEffect, useRef, useState, } from "react";
|
|
17
|
+
import { createPortal } from "react-dom";
|
|
18
|
+
import { cn } from "../../lib/utils.mjs";
|
|
19
|
+
const extensionForMimeType = (mimeType) => {
|
|
20
|
+
switch (mimeType) {
|
|
21
|
+
case "image/png":
|
|
22
|
+
return "png";
|
|
23
|
+
case "image/jpeg":
|
|
24
|
+
case "image/jpg":
|
|
25
|
+
return "jpg";
|
|
26
|
+
case "image/webp":
|
|
27
|
+
return "webp";
|
|
28
|
+
case "image/gif":
|
|
29
|
+
return "gif";
|
|
30
|
+
case "image/svg+xml":
|
|
31
|
+
return "svg";
|
|
32
|
+
default:
|
|
33
|
+
return "png";
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const dataUriToBlob = (dataUri) => {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const [meta, data] = dataUri.split(",");
|
|
39
|
+
const mime = (_b = (_a = meta === null || meta === void 0 ? void 0 : meta.match(/data:([^;]+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : "application/octet-stream";
|
|
40
|
+
if (!/;base64/i.test(meta !== null && meta !== void 0 ? meta : "")) {
|
|
41
|
+
return new Blob([decodeURIComponent(data !== null && data !== void 0 ? data : "")], { type: mime });
|
|
42
|
+
}
|
|
43
|
+
const bytes = atob(data !== null && data !== void 0 ? data : "");
|
|
44
|
+
const arr = new Uint8Array(bytes.length);
|
|
45
|
+
for (let i = 0; i < bytes.length; i++)
|
|
46
|
+
arr[i] = bytes.charCodeAt(i);
|
|
47
|
+
return new Blob([arr], { type: mime });
|
|
48
|
+
};
|
|
49
|
+
const mimeFromImage = (image) => { var _a; return (_a = image.match(/^data:([^;,]+)/)) === null || _a === void 0 ? void 0 : _a[1]; };
|
|
50
|
+
const downloadImagePart = (part) => {
|
|
51
|
+
var _a;
|
|
52
|
+
if (typeof document === "undefined")
|
|
53
|
+
return;
|
|
54
|
+
const ext = extensionForMimeType(mimeFromImage(part.image));
|
|
55
|
+
const filename = (_a = part.filename) !== null && _a !== void 0 ? _a : `image.${ext}`;
|
|
56
|
+
const isDataUri = part.image.startsWith("data:");
|
|
57
|
+
const objectUrl = isDataUri
|
|
58
|
+
? URL.createObjectURL(dataUriToBlob(part.image))
|
|
59
|
+
: null;
|
|
60
|
+
const href = objectUrl !== null && objectUrl !== void 0 ? objectUrl : part.image;
|
|
61
|
+
const a = document.createElement("a");
|
|
62
|
+
a.href = href;
|
|
63
|
+
a.download = filename;
|
|
64
|
+
a.rel = "noopener";
|
|
65
|
+
document.body.appendChild(a);
|
|
66
|
+
a.click();
|
|
67
|
+
document.body.removeChild(a);
|
|
68
|
+
if (objectUrl)
|
|
69
|
+
URL.revokeObjectURL(objectUrl);
|
|
70
|
+
};
|
|
71
|
+
const copyImagePart = async (part) => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
if (typeof navigator === "undefined" ||
|
|
74
|
+
!navigator.clipboard ||
|
|
75
|
+
typeof ClipboardItem === "undefined") {
|
|
76
|
+
throw new Error("Clipboard API is not available in this environment.");
|
|
77
|
+
}
|
|
78
|
+
const blob = part.image.startsWith("data:")
|
|
79
|
+
? dataUriToBlob(part.image)
|
|
80
|
+
: await fetch(part.image).then((r) => r.blob());
|
|
81
|
+
const mime = (_b = (_a = mimeFromImage(part.image)) !== null && _a !== void 0 ? _a : blob.type) !== null && _b !== void 0 ? _b : "image/png";
|
|
82
|
+
await navigator.clipboard.write([new ClipboardItem({ [mime]: blob })]);
|
|
83
|
+
};
|
|
84
|
+
const imageVariants = cva("aui-image-root relative overflow-hidden rounded-lg", {
|
|
85
|
+
variants: {
|
|
86
|
+
variant: {
|
|
87
|
+
outline: "border-border border",
|
|
88
|
+
ghost: "",
|
|
89
|
+
muted: "bg-muted/50",
|
|
90
|
+
},
|
|
91
|
+
size: {
|
|
92
|
+
sm: "max-w-64",
|
|
93
|
+
default: "inline-block max-w-[30vw] max-md:max-w-full",
|
|
94
|
+
lg: "max-w-[512px]",
|
|
95
|
+
full: "w-full",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
variant: "outline",
|
|
100
|
+
size: "default",
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
function ImageRoot(_a) {
|
|
104
|
+
var { className, variant, size, children } = _a, props = __rest(_a, ["className", "variant", "size", "children"]);
|
|
105
|
+
return (_jsx("div", Object.assign({ "data-slot": "image-root", "data-variant": variant, "data-size": size, className: cn(imageVariants({ variant, size, className })) }, props, { children: children })));
|
|
106
|
+
}
|
|
107
|
+
function ImagePreview(_a) {
|
|
108
|
+
var { className, containerClassName, onLoad, onError, alt = "Image content", src } = _a, props = __rest(_a, ["className", "containerClassName", "onLoad", "onError", "alt", "src"]);
|
|
109
|
+
const imgRef = useRef(null);
|
|
110
|
+
const [loadedSrc, setLoadedSrc] = useState(undefined);
|
|
111
|
+
const [errorSrc, setErrorSrc] = useState(undefined);
|
|
112
|
+
const loaded = loadedSrc === src;
|
|
113
|
+
const error = errorSrc === src;
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
var _a;
|
|
116
|
+
if (typeof src === "string" &&
|
|
117
|
+
((_a = imgRef.current) === null || _a === void 0 ? void 0 : _a.complete) &&
|
|
118
|
+
imgRef.current.naturalWidth > 0) {
|
|
119
|
+
setLoadedSrc(src);
|
|
120
|
+
}
|
|
121
|
+
}, [src]);
|
|
122
|
+
return (_jsxs("div", { "data-slot": "image-preview", className: cn("relative min-h-32", containerClassName), children: [!loaded && !error && (_jsx("div", { "data-slot": "image-preview-loading", className: "absolute inset-0 flex items-center justify-center bg-muted/50", children: _jsx(ImageIcon, { className: "size-8 animate-pulse text-muted-foreground" }) })), error ? (_jsx("div", { "data-slot": "image-preview-error", className: "flex min-h-32 items-center justify-center bg-muted/50 p-4", children: _jsx(ImageOffIcon, { className: "size-8 text-muted-foreground" }) })) : (_jsx("img", Object.assign({ ref: imgRef, src: src, alt: alt, className: cn("block h-auto w-auto max-h-[30vh] max-w-[30vw] object-contain max-md:max-w-full", !loaded && "invisible", className), onLoad: (e) => {
|
|
123
|
+
if (typeof src === "string")
|
|
124
|
+
setLoadedSrc(src);
|
|
125
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
|
|
126
|
+
}, onError: (e) => {
|
|
127
|
+
if (typeof src === "string")
|
|
128
|
+
setErrorSrc(src);
|
|
129
|
+
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
130
|
+
} }, props)))] }));
|
|
131
|
+
}
|
|
132
|
+
function ImageFilename(_a) {
|
|
133
|
+
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
134
|
+
if (!children)
|
|
135
|
+
return null;
|
|
136
|
+
return (_jsx("span", Object.assign({ "data-slot": "image-filename", className: cn("block w-full min-w-0 truncate px-2 py-1.5 text-muted-foreground text-xs [contain:inline-size]", className) }, props, { children: children })));
|
|
137
|
+
}
|
|
138
|
+
function ImageZoom({ src, alt = "Image preview", children }) {
|
|
139
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
140
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
setIsMounted(true);
|
|
143
|
+
}, []);
|
|
144
|
+
const handleOpen = () => setIsOpen(true);
|
|
145
|
+
const handleClose = () => setIsOpen(false);
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
if (!isOpen)
|
|
148
|
+
return;
|
|
149
|
+
const handleKeyDown = (e) => {
|
|
150
|
+
if (e.key === "Escape")
|
|
151
|
+
setIsOpen(false);
|
|
152
|
+
};
|
|
153
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
154
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
155
|
+
}, [isOpen]);
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
if (!isOpen)
|
|
158
|
+
return;
|
|
159
|
+
const originalOverflow = document.body.style.overflow;
|
|
160
|
+
document.body.style.overflow = "hidden";
|
|
161
|
+
return () => {
|
|
162
|
+
document.body.style.overflow = originalOverflow;
|
|
163
|
+
};
|
|
164
|
+
}, [isOpen]);
|
|
165
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: handleOpen, onKeyDown: (e) => e.key === "Enter" && handleOpen(), className: "aui-image-zoom-trigger cursor-zoom-in border-0 bg-transparent p-0 text-left", "aria-label": "Click to zoom image", children: children }), isMounted &&
|
|
166
|
+
isOpen &&
|
|
167
|
+
createPortal(_jsx("button", { type: "button", "data-slot": "image-zoom-overlay", className: "aui-image-zoom-overlay fade-in fixed inset-0 z-50 flex animate-in items-center justify-center bg-black/80 duration-200", onClick: handleClose, onKeyDown: (e) => e.key === "Enter" && handleClose(), "aria-label": "Close zoomed image", children: _jsx("img", { "data-slot": "image-zoom-content", src: src, alt: alt, className: "aui-image-zoom-content fade-in zoom-in-95 max-h-[90vh] max-w-[90vw] animate-in cursor-zoom-out object-contain duration-200", onClick: (e) => {
|
|
168
|
+
e.stopPropagation();
|
|
169
|
+
handleClose();
|
|
170
|
+
} }) }), document.body)] }));
|
|
171
|
+
}
|
|
172
|
+
function ImageGenerating({ className }) {
|
|
173
|
+
return (_jsxs("div", { "data-slot": "image-generating", className: cn("flex min-h-32 items-center justify-center bg-muted/50 p-4", className), children: [_jsx(Loader2Icon, { className: "size-8 animate-spin text-muted-foreground" }), _jsx("span", { className: "sr-only", children: "Generating image..." })] }));
|
|
174
|
+
}
|
|
175
|
+
function ImageContentFilterError({ className, reason, }) {
|
|
176
|
+
return (_jsxs("div", { "data-slot": "image-content-filter-error", className: cn("flex min-h-32 flex-col items-center justify-center gap-2 bg-muted/50 p-4 text-center", className), children: [_jsx(ShieldAlertIcon, { className: "size-8 text-muted-foreground" }), _jsx("p", { className: "font-medium text-sm", children: "Image could not be generated" }), reason && _jsx("p", { className: "text-muted-foreground text-xs", children: reason })] }));
|
|
177
|
+
}
|
|
178
|
+
function RegenerateButton({ onRegenerate, }) {
|
|
179
|
+
const [isRegenerating, setIsRegenerating] = useState(false);
|
|
180
|
+
return (_jsx("button", { type: "button", onClick: async () => {
|
|
181
|
+
setIsRegenerating(true);
|
|
182
|
+
try {
|
|
183
|
+
await onRegenerate();
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
setIsRegenerating(false);
|
|
187
|
+
}
|
|
188
|
+
}, disabled: isRegenerating, "data-slot": "image-regenerate", "aria-label": "Regenerate image", className: "inline-flex size-7 items-center justify-center rounded hover:bg-muted disabled:opacity-50", children: _jsx(RefreshCwIcon, { className: cn("size-4", isRegenerating && "animate-spin") }) }));
|
|
189
|
+
}
|
|
190
|
+
function ImageActions({ part, onRegenerate, className }) {
|
|
191
|
+
return (_jsxs("div", { "data-slot": "image-actions", className: cn("flex items-center gap-1 p-1", className), children: [_jsx("button", { type: "button", onClick: () => downloadImagePart(part), "data-slot": "image-download", "aria-label": "Download image", className: "inline-flex size-7 items-center justify-center rounded hover:bg-muted", children: _jsx(DownloadIcon, { className: "size-4" }) }), _jsx("button", { type: "button", onClick: () => {
|
|
192
|
+
copyImagePart(part).catch(() => { });
|
|
193
|
+
}, "data-slot": "image-copy", "aria-label": "Copy image", className: "inline-flex size-7 items-center justify-center rounded hover:bg-muted", children: _jsx(CopyIcon, { className: "size-4" }) }), onRegenerate && _jsx(RegenerateButton, { onRegenerate: onRegenerate })] }));
|
|
194
|
+
}
|
|
195
|
+
const ImageImpl = (props) => {
|
|
196
|
+
const { image, filename, status } = props;
|
|
197
|
+
if ((status === null || status === void 0 ? void 0 : status.type) === "running") {
|
|
198
|
+
return (_jsxs(ImageRoot, { children: [_jsx(ImageGenerating, {}), _jsx(ImageFilename, { children: filename })] }));
|
|
199
|
+
}
|
|
200
|
+
if ((status === null || status === void 0 ? void 0 : status.type) === "incomplete" && status.reason === "content-filter") {
|
|
201
|
+
return (_jsx(ImageRoot, { children: _jsx(ImageContentFilterError, { reason: "The provider blocked this image." }) }));
|
|
202
|
+
}
|
|
203
|
+
return (_jsxs(ImageRoot, { children: [_jsx(ImageZoom, { src: image, alt: filename || "Image content", children: _jsx(ImagePreview, { src: image, alt: filename || "Image content" }) }), _jsx(ImageFilename, { children: filename })] }));
|
|
204
|
+
};
|
|
205
|
+
const Image = memo(ImageImpl);
|
|
206
|
+
Image.displayName = "Image";
|
|
207
|
+
Image.Root = ImageRoot;
|
|
208
|
+
Image.Preview = ImagePreview;
|
|
209
|
+
Image.Filename = ImageFilename;
|
|
210
|
+
Image.Zoom = ImageZoom;
|
|
211
|
+
Image.Actions = ImageActions;
|
|
212
|
+
Image.Generating = ImageGenerating;
|
|
213
|
+
Image.ContentFilterError = ImageContentFilterError;
|
|
214
|
+
export { Image, ImageActions, ImageContentFilterError, ImageFilename, ImageGenerating, ImagePreview, ImageRoot, ImageZoom, imageVariants, };
|
|
215
|
+
export const ImageMessage = Image;
|