@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,678 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { normalizeAcpProvider } from "../acp2aisdk/provider-registry.mjs";
|
|
4
|
+
import { DEFAULT_PERMISSION_MODE, normalizeWorkspacePath, } from "../acp2aisdk/session-store.mjs";
|
|
5
|
+
import { convertTranscriptToMessageRepository, findProviderSession, loadProviderTranscript, scanProviderSessions, } from "../provider-history/index.mjs";
|
|
6
|
+
import { mergePersistedBuiltinToolSettings, normalizePersistedBuiltinToolSettings, } from "../../tools/registry.mjs";
|
|
7
|
+
import { deleteRuntimeMessages, getRuntimeMessageRepository, isRuntimeMessageConversationExpired, pruneExpiredRuntimeMessages, upsertRuntimeMessage, } from "./message-repository.mjs";
|
|
8
|
+
const STORE_VERSION = 1;
|
|
9
|
+
const DEFAULT_CONVERSATION_LIST_LIMIT = 50;
|
|
10
|
+
const MAX_CONVERSATION_LIST_LIMIT = 200;
|
|
11
|
+
const PROVIDER_SCAN_CACHE_TTL_MS = 30000;
|
|
12
|
+
const PLACEHOLDER_TITLE = "新对话";
|
|
13
|
+
const GENERATED_TITLE_MAX_LENGTH = 48;
|
|
14
|
+
const providerSessionScanCache = new Map();
|
|
15
|
+
function createProviderSessionThreadId(provider, sessionId) {
|
|
16
|
+
return `${provider}-${sessionId}`;
|
|
17
|
+
}
|
|
18
|
+
function getStorePath(workspacePath) {
|
|
19
|
+
const overridePath = process.env.ACP_UI_CONVERSATION_STORE;
|
|
20
|
+
if (overridePath)
|
|
21
|
+
return path.resolve(/* turbopackIgnore: true */ overridePath);
|
|
22
|
+
const resolvedWorkspacePath = normalizeWorkspacePath(workspacePath);
|
|
23
|
+
return path.join(
|
|
24
|
+
/* turbopackIgnore: true */ resolvedWorkspacePath, ".axhub", "sessions", "conversations.json");
|
|
25
|
+
}
|
|
26
|
+
function emptyStore() {
|
|
27
|
+
return {
|
|
28
|
+
version: STORE_VERSION,
|
|
29
|
+
conversations: [],
|
|
30
|
+
sessions: [],
|
|
31
|
+
messages: {},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function nowIso() {
|
|
35
|
+
return new Date().toISOString();
|
|
36
|
+
}
|
|
37
|
+
function compareUpdatedAtDesc(left, right) {
|
|
38
|
+
return right.updatedAt.localeCompare(left.updatedAt);
|
|
39
|
+
}
|
|
40
|
+
function normalizeConversationListLimit(limit) {
|
|
41
|
+
if (!Number.isFinite(limit))
|
|
42
|
+
return DEFAULT_CONVERSATION_LIST_LIMIT;
|
|
43
|
+
return Math.min(MAX_CONVERSATION_LIST_LIMIT, Math.max(1, Math.floor(limit)));
|
|
44
|
+
}
|
|
45
|
+
function isActiveConversation(thread) {
|
|
46
|
+
return thread.status !== "deleted";
|
|
47
|
+
}
|
|
48
|
+
function compareSessionActivityDesc(left, right) {
|
|
49
|
+
var _a, _b, _c, _d;
|
|
50
|
+
return ((_b = (_a = right.lastActivityAt) !== null && _a !== void 0 ? _a : right.createdAt) !== null && _b !== void 0 ? _b : "").localeCompare((_d = (_c = left.lastActivityAt) !== null && _c !== void 0 ? _c : left.createdAt) !== null && _d !== void 0 ? _d : "");
|
|
51
|
+
}
|
|
52
|
+
function findActiveConversation(data, threadId) {
|
|
53
|
+
var _a;
|
|
54
|
+
return ((_a = data.conversations.find((thread) => thread.threadId === threadId && isActiveConversation(thread))) !== null && _a !== void 0 ? _a : null);
|
|
55
|
+
}
|
|
56
|
+
function findConversationByProviderSession(data, { provider, sessionId, workspacePath, }) {
|
|
57
|
+
var _a;
|
|
58
|
+
const normalizedSessionId = sessionId.trim();
|
|
59
|
+
if (!normalizedSessionId)
|
|
60
|
+
return null;
|
|
61
|
+
const runtimeSession = data.sessions
|
|
62
|
+
.filter((session) => session.provider === provider &&
|
|
63
|
+
session.workspacePath === workspacePath &&
|
|
64
|
+
session.acpSessionId === normalizedSessionId)
|
|
65
|
+
.sort(compareSessionActivityDesc)[0];
|
|
66
|
+
if (runtimeSession) {
|
|
67
|
+
const thread = findActiveConversation(data, runtimeSession.threadId);
|
|
68
|
+
if (thread)
|
|
69
|
+
return { thread, source: "runtime-session" };
|
|
70
|
+
}
|
|
71
|
+
const conversation = (_a = data.conversations.find((thread) => isActiveConversation(thread) &&
|
|
72
|
+
thread.provider === provider &&
|
|
73
|
+
thread.workspacePath === workspacePath &&
|
|
74
|
+
thread.providerSessionId === normalizedSessionId)) !== null && _a !== void 0 ? _a : null;
|
|
75
|
+
if (conversation)
|
|
76
|
+
return { thread: conversation, source: "conversation" };
|
|
77
|
+
const importedThread = findActiveConversation(data, `${provider}:${normalizedSessionId}`);
|
|
78
|
+
if (importedThread)
|
|
79
|
+
return { thread: importedThread, source: "thread" };
|
|
80
|
+
const directThread = findActiveConversation(data, normalizedSessionId);
|
|
81
|
+
if (directThread)
|
|
82
|
+
return { thread: directThread, source: "thread" };
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
function paginateConversations(conversations, options = {}) {
|
|
86
|
+
var _a;
|
|
87
|
+
const limit = normalizeConversationListLimit(options.limit);
|
|
88
|
+
const visible = conversations
|
|
89
|
+
.filter(isActiveConversation)
|
|
90
|
+
.sort(compareUpdatedAtDesc);
|
|
91
|
+
const startIndex = options.after
|
|
92
|
+
? Math.max(visible.findIndex((thread) => thread.threadId === options.after) + 1, 0)
|
|
93
|
+
: 0;
|
|
94
|
+
const threads = visible.slice(startIndex, startIndex + limit);
|
|
95
|
+
const nextCursor = startIndex + threads.length < visible.length
|
|
96
|
+
? (_a = threads.at(-1)) === null || _a === void 0 ? void 0 : _a.threadId
|
|
97
|
+
: undefined;
|
|
98
|
+
return {
|
|
99
|
+
threads,
|
|
100
|
+
nextCursor,
|
|
101
|
+
total: visible.length,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
async function scanProviderSessionsCached(workspacePath, refreshProvider) {
|
|
105
|
+
const cacheKey = workspacePath;
|
|
106
|
+
const cached = providerSessionScanCache.get(cacheKey);
|
|
107
|
+
const now = Date.now();
|
|
108
|
+
if (!refreshProvider && cached && cached.expiresAt > now) {
|
|
109
|
+
return cached.sessions;
|
|
110
|
+
}
|
|
111
|
+
const sessions = await scanProviderSessions(workspacePath);
|
|
112
|
+
providerSessionScanCache.set(cacheKey, {
|
|
113
|
+
expiresAt: now + PROVIDER_SCAN_CACHE_TTL_MS,
|
|
114
|
+
sessions,
|
|
115
|
+
});
|
|
116
|
+
return sessions;
|
|
117
|
+
}
|
|
118
|
+
async function readStore(workspacePath) {
|
|
119
|
+
const storePath = getStorePath(workspacePath);
|
|
120
|
+
try {
|
|
121
|
+
const raw = await fs.readFile(
|
|
122
|
+
/* turbopackIgnore: true */ storePath, "utf8");
|
|
123
|
+
const parsed = JSON.parse(raw);
|
|
124
|
+
return {
|
|
125
|
+
version: STORE_VERSION,
|
|
126
|
+
conversations: Array.isArray(parsed.conversations)
|
|
127
|
+
? parsed.conversations
|
|
128
|
+
: [],
|
|
129
|
+
sessions: Array.isArray(parsed.sessions) ? parsed.sessions : [],
|
|
130
|
+
messages: parsed.messages && typeof parsed.messages === "object"
|
|
131
|
+
? parsed.messages
|
|
132
|
+
: {},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (error.code === "ENOENT") {
|
|
137
|
+
return emptyStore();
|
|
138
|
+
}
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function writeStore(data, workspacePath) {
|
|
143
|
+
const storePath = getStorePath(workspacePath);
|
|
144
|
+
const tempStorePath = `${storePath}.${process.pid}.${Date.now()}.tmp`;
|
|
145
|
+
await fs.mkdir(/* turbopackIgnore: true */ path.dirname(storePath), {
|
|
146
|
+
recursive: true,
|
|
147
|
+
});
|
|
148
|
+
const body = `${JSON.stringify(data, null, 2)}\n`;
|
|
149
|
+
await fs.writeFile(/* turbopackIgnore: true */ tempStorePath, body, "utf8");
|
|
150
|
+
await fs.rename(
|
|
151
|
+
/* turbopackIgnore: true */ tempStorePath,
|
|
152
|
+
/* turbopackIgnore: true */ storePath);
|
|
153
|
+
}
|
|
154
|
+
let updateQueue = Promise.resolve();
|
|
155
|
+
async function updateStore(workspacePath, updater) {
|
|
156
|
+
const task = updateQueue.then(async () => {
|
|
157
|
+
const data = await readStore(workspacePath);
|
|
158
|
+
const result = await updater(data);
|
|
159
|
+
await writeStore(data, workspacePath);
|
|
160
|
+
return result;
|
|
161
|
+
});
|
|
162
|
+
updateQueue = task.then(() => undefined, () => undefined);
|
|
163
|
+
return task;
|
|
164
|
+
}
|
|
165
|
+
function defaultTitle(threadId) {
|
|
166
|
+
return `Chat ${threadId.slice(-6) || threadId}`;
|
|
167
|
+
}
|
|
168
|
+
function isRecord(value) {
|
|
169
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
170
|
+
}
|
|
171
|
+
function normalizeConversationTitle(value, maxLength) {
|
|
172
|
+
let title = typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";
|
|
173
|
+
if (maxLength)
|
|
174
|
+
title = title.slice(0, maxLength).trim();
|
|
175
|
+
return title && title !== PLACEHOLDER_TITLE ? title : undefined;
|
|
176
|
+
}
|
|
177
|
+
function normalizeRuntimeSessionTitle(value) {
|
|
178
|
+
return normalizeConversationTitle(value);
|
|
179
|
+
}
|
|
180
|
+
function extractStoredText(value) {
|
|
181
|
+
if (typeof value === "string")
|
|
182
|
+
return value;
|
|
183
|
+
if (Array.isArray(value)) {
|
|
184
|
+
return value
|
|
185
|
+
.map((item) => extractStoredText(item))
|
|
186
|
+
.filter((text) => text.trim())
|
|
187
|
+
.join(" ");
|
|
188
|
+
}
|
|
189
|
+
if (!isRecord(value))
|
|
190
|
+
return "";
|
|
191
|
+
if (typeof value.text === "string")
|
|
192
|
+
return value.text;
|
|
193
|
+
if (typeof value.input_text === "string")
|
|
194
|
+
return value.input_text;
|
|
195
|
+
if (typeof value.output_text === "string")
|
|
196
|
+
return value.output_text;
|
|
197
|
+
if ("content" in value)
|
|
198
|
+
return extractStoredText(value.content);
|
|
199
|
+
return "";
|
|
200
|
+
}
|
|
201
|
+
function titleFromStoredMessage(message) {
|
|
202
|
+
const content = message.content;
|
|
203
|
+
if (!isRecord(content) || content.role !== "user")
|
|
204
|
+
return undefined;
|
|
205
|
+
const body = Array.isArray(content.parts) ? content.parts : content.content;
|
|
206
|
+
return normalizeConversationTitle(extractStoredText(body), GENERATED_TITLE_MAX_LENGTH);
|
|
207
|
+
}
|
|
208
|
+
function titleFromRuntimeMessages(data, threadId) {
|
|
209
|
+
var _a, _b, _c;
|
|
210
|
+
const messages = (_c = (_b = (_a = data.messages) === null || _a === void 0 ? void 0 : _a[threadId]) === null || _b === void 0 ? void 0 : _b.messages) !== null && _c !== void 0 ? _c : [];
|
|
211
|
+
for (const message of messages) {
|
|
212
|
+
const title = titleFromStoredMessage(message);
|
|
213
|
+
if (title)
|
|
214
|
+
return title;
|
|
215
|
+
}
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
function backfillMissingConversationTitles(data) {
|
|
219
|
+
var _a;
|
|
220
|
+
for (const conversation of data.conversations) {
|
|
221
|
+
const title = normalizeConversationTitle(conversation.title);
|
|
222
|
+
if (title) {
|
|
223
|
+
conversation.title = title;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
conversation.title =
|
|
227
|
+
(_a = titleFromRuntimeMessages(data, conversation.threadId)) !== null && _a !== void 0 ? _a : null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function shouldScanProviderSessionsForTitleBackfill(data, workspacePath) {
|
|
231
|
+
const activeSessionThreadIds = new Set(data.sessions
|
|
232
|
+
.filter((session) => session.provider === "codex" &&
|
|
233
|
+
session.workspacePath === workspacePath &&
|
|
234
|
+
!!session.acpSessionId &&
|
|
235
|
+
!session.closedAt)
|
|
236
|
+
.map((session) => session.threadId));
|
|
237
|
+
return data.conversations.some((thread) => isActiveConversation(thread) &&
|
|
238
|
+
thread.provider === "codex" &&
|
|
239
|
+
thread.workspacePath === workspacePath &&
|
|
240
|
+
!normalizeConversationTitle(thread.title) &&
|
|
241
|
+
!!(thread.providerSessionId ||
|
|
242
|
+
thread.sourcePath ||
|
|
243
|
+
activeSessionThreadIds.has(thread.threadId)));
|
|
244
|
+
}
|
|
245
|
+
function normalizeBuiltinToolSettings(value) {
|
|
246
|
+
return normalizePersistedBuiltinToolSettings(value);
|
|
247
|
+
}
|
|
248
|
+
function mergeBuiltinToolSettings(current, patch) {
|
|
249
|
+
return mergePersistedBuiltinToolSettings(current, patch);
|
|
250
|
+
}
|
|
251
|
+
function createConversationRecord(request) {
|
|
252
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
253
|
+
const timestamp = nowIso();
|
|
254
|
+
return {
|
|
255
|
+
threadId: request.threadId,
|
|
256
|
+
title: (_a = normalizeConversationTitle(request.title)) !== null && _a !== void 0 ? _a : null,
|
|
257
|
+
createdAt: timestamp,
|
|
258
|
+
updatedAt: timestamp,
|
|
259
|
+
archivedAt: null,
|
|
260
|
+
deletedAt: null,
|
|
261
|
+
workspacePath: normalizeWorkspacePath(request.workspacePath),
|
|
262
|
+
provider: normalizeAcpProvider(request.provider),
|
|
263
|
+
model: (_b = request.model) !== null && _b !== void 0 ? _b : null,
|
|
264
|
+
modeId: (_c = request.modeId) !== null && _c !== void 0 ? _c : null,
|
|
265
|
+
thoughtLevel: (_d = request.thoughtLevel) !== null && _d !== void 0 ? _d : null,
|
|
266
|
+
permissionMode: (_e = request.permissionMode) !== null && _e !== void 0 ? _e : DEFAULT_PERMISSION_MODE,
|
|
267
|
+
status: "active",
|
|
268
|
+
builtinToolSettings: normalizeBuiltinToolSettings(request.builtinToolSettings),
|
|
269
|
+
providerSessionId: (_f = request.providerSessionId) !== null && _f !== void 0 ? _f : null,
|
|
270
|
+
sourcePath: (_g = request.sourcePath) !== null && _g !== void 0 ? _g : null,
|
|
271
|
+
sourceKind: (_h = request.sourceKind) !== null && _h !== void 0 ? _h : null,
|
|
272
|
+
lastSeenMtime: (_j = request.lastSeenMtime) !== null && _j !== void 0 ? _j : null,
|
|
273
|
+
lastActiveAt: (_k = request.lastActiveAt) !== null && _k !== void 0 ? _k : null,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function updateConversationRecord(record, request) {
|
|
277
|
+
var _a, _b, _c;
|
|
278
|
+
return Object.assign(Object.assign({}, record), { title: (_b = (_a = normalizeConversationTitle(request.title)) !== null && _a !== void 0 ? _a : normalizeConversationTitle(record.title)) !== null && _b !== void 0 ? _b : null, workspacePath: request.workspacePath
|
|
279
|
+
? normalizeWorkspacePath(request.workspacePath)
|
|
280
|
+
: record.workspacePath, provider: request.provider
|
|
281
|
+
? normalizeAcpProvider(request.provider)
|
|
282
|
+
: record.provider, model: request.model !== undefined ? request.model : record.model, modeId: request.modeId !== undefined ? request.modeId : record.modeId, thoughtLevel: request.thoughtLevel !== undefined
|
|
283
|
+
? request.thoughtLevel
|
|
284
|
+
: record.thoughtLevel, permissionMode: (_c = request.permissionMode) !== null && _c !== void 0 ? _c : record.permissionMode, builtinToolSettings: request.builtinToolSettings !== undefined
|
|
285
|
+
? mergeBuiltinToolSettings(record.builtinToolSettings, request.builtinToolSettings)
|
|
286
|
+
: record.builtinToolSettings, providerSessionId: request.providerSessionId !== undefined
|
|
287
|
+
? request.providerSessionId
|
|
288
|
+
: record.providerSessionId, sourcePath: request.sourcePath !== undefined ? request.sourcePath : record.sourcePath, sourceKind: request.sourceKind !== undefined ? request.sourceKind : record.sourceKind, lastSeenMtime: request.lastSeenMtime !== undefined
|
|
289
|
+
? request.lastSeenMtime
|
|
290
|
+
: record.lastSeenMtime, lastActiveAt: request.lastActiveAt !== undefined
|
|
291
|
+
? request.lastActiveAt
|
|
292
|
+
: record.lastActiveAt, updatedAt: nowIso(), status: record.status === "deleted" ? "active" : record.status, deletedAt: record.status === "deleted" ? null : record.deletedAt });
|
|
293
|
+
}
|
|
294
|
+
function filterMessagesByFormat(repo, format) {
|
|
295
|
+
return format
|
|
296
|
+
? repo.messages.filter((message) => message.format === format)
|
|
297
|
+
: repo.messages;
|
|
298
|
+
}
|
|
299
|
+
function errorMessage(error) {
|
|
300
|
+
return error instanceof Error ? error.message : String(error);
|
|
301
|
+
}
|
|
302
|
+
export async function listConversations(workspacePath, options = {}) {
|
|
303
|
+
const normalizedWorkspacePath = normalizeWorkspacePath(workspacePath);
|
|
304
|
+
const shouldRefreshProvider = options.refreshProvider === true;
|
|
305
|
+
const snapshot = shouldRefreshProvider
|
|
306
|
+
? null
|
|
307
|
+
: await readStore(normalizedWorkspacePath);
|
|
308
|
+
const shouldScanProvider = shouldRefreshProvider ||
|
|
309
|
+
(snapshot
|
|
310
|
+
? shouldScanProviderSessionsForTitleBackfill(snapshot, normalizedWorkspacePath)
|
|
311
|
+
: false);
|
|
312
|
+
const providerSessions = shouldScanProvider
|
|
313
|
+
? await scanProviderSessionsCached(normalizedWorkspacePath, options.refreshProvider)
|
|
314
|
+
: [];
|
|
315
|
+
return updateStore(normalizedWorkspacePath, (data) => {
|
|
316
|
+
var _a, _b, _c, _d, _e, _f;
|
|
317
|
+
const now = nowIso();
|
|
318
|
+
const importProviderSessions = shouldRefreshProvider;
|
|
319
|
+
backfillMissingConversationTitles(data);
|
|
320
|
+
for (const session of providerSessions) {
|
|
321
|
+
const existingSession = data.sessions.find((record) => {
|
|
322
|
+
var _a;
|
|
323
|
+
return record.provider === session.provider &&
|
|
324
|
+
record.workspacePath ===
|
|
325
|
+
normalizeWorkspacePath((_a = session.workspacePath) !== null && _a !== void 0 ? _a : normalizedWorkspacePath) &&
|
|
326
|
+
record.acpSessionId === session.sessionId;
|
|
327
|
+
});
|
|
328
|
+
let existingIndex = existingSession
|
|
329
|
+
? data.conversations.findIndex((thread) => thread.threadId === existingSession.threadId)
|
|
330
|
+
: -1;
|
|
331
|
+
if (existingIndex < 0) {
|
|
332
|
+
existingIndex = data.conversations.findIndex((thread) => thread.provider === session.provider &&
|
|
333
|
+
(thread.sourcePath === session.sourcePath ||
|
|
334
|
+
thread.providerSessionId === session.sessionId));
|
|
335
|
+
}
|
|
336
|
+
const existing = existingIndex >= 0 ? data.conversations[existingIndex] : null;
|
|
337
|
+
if (!existing && !importProviderSessions)
|
|
338
|
+
continue;
|
|
339
|
+
const existingTitle = normalizeConversationTitle(existing === null || existing === void 0 ? void 0 : existing.title);
|
|
340
|
+
const providerTitle = normalizeConversationTitle(session.title);
|
|
341
|
+
const record = Object.assign(Object.assign({}, (existing !== null && existing !== void 0 ? existing : {
|
|
342
|
+
threadId: createProviderSessionThreadId(session.provider, session.sessionId),
|
|
343
|
+
title: providerTitle !== null && providerTitle !== void 0 ? providerTitle : null,
|
|
344
|
+
createdAt: (_a = session.createdAt) !== null && _a !== void 0 ? _a : now,
|
|
345
|
+
archivedAt: null,
|
|
346
|
+
deletedAt: null,
|
|
347
|
+
model: null,
|
|
348
|
+
modeId: null,
|
|
349
|
+
thoughtLevel: null,
|
|
350
|
+
permissionMode: DEFAULT_PERMISSION_MODE,
|
|
351
|
+
status: "active",
|
|
352
|
+
})), { updatedAt: (_c = (_b = session.lastActiveAt) !== null && _b !== void 0 ? _b : session.createdAt) !== null && _c !== void 0 ? _c : now, workspacePath: normalizeWorkspacePath((_d = session.workspacePath) !== null && _d !== void 0 ? _d : normalizedWorkspacePath), provider: session.provider, title: (_f = (_e = existingTitle !== null && existingTitle !== void 0 ? existingTitle : providerTitle) !== null && _e !== void 0 ? _e : (existing
|
|
353
|
+
? titleFromRuntimeMessages(data, existing.threadId)
|
|
354
|
+
: null)) !== null && _f !== void 0 ? _f : null, providerSessionId: session.sessionId, sourcePath: session.sourcePath, sourceKind: session.sourceKind, lastSeenMtime: session.lastSeenMtime, lastActiveAt: session.lastActiveAt });
|
|
355
|
+
if (existingIndex >= 0) {
|
|
356
|
+
data.conversations[existingIndex] = record;
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
data.conversations.unshift(record);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return paginateConversations(data.conversations, options);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
export async function getConversation(threadId, workspacePath) {
|
|
366
|
+
const data = await readStore(workspacePath);
|
|
367
|
+
return findActiveConversation(data, threadId);
|
|
368
|
+
}
|
|
369
|
+
export async function resolveConversationByProviderSession({ provider: providerInput, sessionId, workspacePath, }) {
|
|
370
|
+
var _a;
|
|
371
|
+
const provider = normalizeAcpProvider(providerInput);
|
|
372
|
+
const normalizedSessionId = sessionId.trim();
|
|
373
|
+
if (!normalizedSessionId)
|
|
374
|
+
return null;
|
|
375
|
+
const normalizedWorkspacePath = normalizeWorkspacePath(workspacePath);
|
|
376
|
+
const data = await readStore(normalizedWorkspacePath);
|
|
377
|
+
const existing = findConversationByProviderSession(data, {
|
|
378
|
+
provider,
|
|
379
|
+
sessionId: normalizedSessionId,
|
|
380
|
+
workspacePath: normalizedWorkspacePath,
|
|
381
|
+
});
|
|
382
|
+
if (existing)
|
|
383
|
+
return existing;
|
|
384
|
+
const providerSession = await findProviderSession(provider, normalizedSessionId, normalizedWorkspacePath);
|
|
385
|
+
if (!providerSession)
|
|
386
|
+
return null;
|
|
387
|
+
await listConversations(normalizedWorkspacePath, { refreshProvider: true });
|
|
388
|
+
const refreshedData = await readStore(normalizedWorkspacePath);
|
|
389
|
+
return ((_a = findConversationByProviderSession(refreshedData, {
|
|
390
|
+
provider,
|
|
391
|
+
sessionId: normalizedSessionId,
|
|
392
|
+
workspacePath: normalizedWorkspacePath,
|
|
393
|
+
})) !== null && _a !== void 0 ? _a : null);
|
|
394
|
+
}
|
|
395
|
+
export async function upsertConversation(request) {
|
|
396
|
+
const workspacePath = normalizeWorkspacePath(request.workspacePath);
|
|
397
|
+
return updateStore(workspacePath, (data) => {
|
|
398
|
+
const existingIndex = data.conversations.findIndex((thread) => thread.threadId === request.threadId);
|
|
399
|
+
const existing = existingIndex >= 0 ? data.conversations[existingIndex] : undefined;
|
|
400
|
+
const record = existing
|
|
401
|
+
? updateConversationRecord(existing, request)
|
|
402
|
+
: createConversationRecord(request);
|
|
403
|
+
if (existingIndex >= 0) {
|
|
404
|
+
data.conversations[existingIndex] = record;
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
data.conversations.unshift(record);
|
|
408
|
+
}
|
|
409
|
+
return record;
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
export async function renameConversation(threadId, title, workspacePath) {
|
|
413
|
+
return updateStore(workspacePath, (data) => {
|
|
414
|
+
var _a, _b;
|
|
415
|
+
const record = data.conversations.find((thread) => thread.threadId === threadId && thread.status !== "deleted");
|
|
416
|
+
if (!record)
|
|
417
|
+
throw new Error("未找到对话");
|
|
418
|
+
record.title =
|
|
419
|
+
(_b = (_a = normalizeConversationTitle(title)) !== null && _a !== void 0 ? _a : normalizeConversationTitle(record.title)) !== null && _b !== void 0 ? _b : defaultTitle(threadId);
|
|
420
|
+
record.updatedAt = nowIso();
|
|
421
|
+
return record;
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
export async function archiveConversation(threadId, archived, workspacePath) {
|
|
425
|
+
return updateStore(workspacePath, (data) => {
|
|
426
|
+
const record = data.conversations.find((thread) => thread.threadId === threadId && thread.status !== "deleted");
|
|
427
|
+
if (!record)
|
|
428
|
+
throw new Error("未找到对话");
|
|
429
|
+
record.status = archived ? "archived" : "active";
|
|
430
|
+
record.archivedAt = archived ? nowIso() : null;
|
|
431
|
+
record.updatedAt = nowIso();
|
|
432
|
+
return record;
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
export async function deleteConversation(threadId, workspacePath) {
|
|
436
|
+
await updateStore(workspacePath, (data) => {
|
|
437
|
+
const record = data.conversations.find((thread) => thread.threadId === threadId);
|
|
438
|
+
if (record) {
|
|
439
|
+
record.status = "deleted";
|
|
440
|
+
record.deletedAt = nowIso();
|
|
441
|
+
record.updatedAt = nowIso();
|
|
442
|
+
}
|
|
443
|
+
for (const session of data.sessions) {
|
|
444
|
+
if (session.threadId === threadId && !session.closedAt) {
|
|
445
|
+
session.closedAt = nowIso();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
deleteRuntimeMessages(data, threadId);
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
function readRuntimeMessagesIfAvailable(data, threadId, format) {
|
|
452
|
+
const runtimeRepo = getRuntimeMessageRepository(data, threadId, format);
|
|
453
|
+
return runtimeRepo.messages.length > 0 ? runtimeRepo : null;
|
|
454
|
+
}
|
|
455
|
+
async function deleteExpiredRuntimeMessagesForThread(workspacePath, threadId) {
|
|
456
|
+
await updateStore(workspacePath, (data) => {
|
|
457
|
+
var _a;
|
|
458
|
+
const conversation = findActiveConversation(data, threadId);
|
|
459
|
+
if (conversation &&
|
|
460
|
+
((_a = data.messages) === null || _a === void 0 ? void 0 : _a[threadId]) &&
|
|
461
|
+
isRuntimeMessageConversationExpired(conversation)) {
|
|
462
|
+
deleteRuntimeMessages(data, threadId);
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
async function loadProviderMessageRepository({ threadId, format, workspacePath, conversation, }) {
|
|
467
|
+
var _a, _b;
|
|
468
|
+
let providerSession = null;
|
|
469
|
+
let providerSessionError = null;
|
|
470
|
+
const providerSessionId = (_a = conversation === null || conversation === void 0 ? void 0 : conversation.providerSessionId) !== null && _a !== void 0 ? _a : (threadId.includes(":") ? threadId.slice(threadId.indexOf(":") + 1) : null);
|
|
471
|
+
const provider = (_b = conversation === null || conversation === void 0 ? void 0 : conversation.provider) !== null && _b !== void 0 ? _b : threadId.split(":")[0];
|
|
472
|
+
if (!(conversation === null || conversation === void 0 ? void 0 : conversation.sourcePath) && providerSessionId) {
|
|
473
|
+
try {
|
|
474
|
+
providerSession = await findProviderSession(provider, providerSessionId, workspacePath);
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
providerSessionError = errorMessage(error);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (conversation === null || conversation === void 0 ? void 0 : conversation.sourcePath) {
|
|
481
|
+
try {
|
|
482
|
+
const transcript = await loadProviderTranscript({
|
|
483
|
+
provider: conversation.provider,
|
|
484
|
+
sessionId: conversation.providerSessionId,
|
|
485
|
+
sourcePath: conversation.sourcePath,
|
|
486
|
+
});
|
|
487
|
+
const repo = convertTranscriptToMessageRepository(transcript, format !== null && format !== void 0 ? format : "ai-sdk/v6");
|
|
488
|
+
const messages = filterMessagesByFormat(repo, format);
|
|
489
|
+
if (messages.length === 0) {
|
|
490
|
+
return {
|
|
491
|
+
messages: [],
|
|
492
|
+
diagnostic: {
|
|
493
|
+
source: "provider-history",
|
|
494
|
+
error: "Provider transcript had no messages",
|
|
495
|
+
},
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
headId: repo.headId,
|
|
500
|
+
messages,
|
|
501
|
+
diagnostic: { source: "provider-history" },
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
return {
|
|
506
|
+
messages: [],
|
|
507
|
+
diagnostic: {
|
|
508
|
+
source: "provider-history",
|
|
509
|
+
error: errorMessage(error),
|
|
510
|
+
},
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
if (providerSession === null || providerSession === void 0 ? void 0 : providerSession.sourcePath) {
|
|
515
|
+
try {
|
|
516
|
+
const transcript = await loadProviderTranscript({
|
|
517
|
+
provider: providerSession.provider,
|
|
518
|
+
sessionId: providerSession.sessionId,
|
|
519
|
+
sourcePath: providerSession.sourcePath,
|
|
520
|
+
});
|
|
521
|
+
const repo = convertTranscriptToMessageRepository(transcript, format !== null && format !== void 0 ? format : "ai-sdk/v6");
|
|
522
|
+
const messages = filterMessagesByFormat(repo, format);
|
|
523
|
+
if (messages.length === 0) {
|
|
524
|
+
return {
|
|
525
|
+
messages: [],
|
|
526
|
+
diagnostic: {
|
|
527
|
+
source: "provider-history",
|
|
528
|
+
error: "Provider transcript had no messages",
|
|
529
|
+
},
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
return {
|
|
533
|
+
headId: repo.headId,
|
|
534
|
+
messages,
|
|
535
|
+
diagnostic: { source: "provider-history" },
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
catch (error) {
|
|
539
|
+
return {
|
|
540
|
+
messages: [],
|
|
541
|
+
diagnostic: {
|
|
542
|
+
source: "provider-history",
|
|
543
|
+
error: errorMessage(error),
|
|
544
|
+
},
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return {
|
|
549
|
+
messages: [],
|
|
550
|
+
diagnostic: {
|
|
551
|
+
source: "provider-history",
|
|
552
|
+
error: providerSessionError !== null && providerSessionError !== void 0 ? providerSessionError : "Provider transcript not found",
|
|
553
|
+
},
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
export async function loadConversationMessages(threadId, format, workspacePath) {
|
|
557
|
+
var _a;
|
|
558
|
+
const data = await readStore(workspacePath);
|
|
559
|
+
const conversation = data.conversations.find((thread) => thread.threadId === threadId && thread.status !== "deleted");
|
|
560
|
+
if (conversation) {
|
|
561
|
+
if (isRuntimeMessageConversationExpired(conversation)) {
|
|
562
|
+
if ((_a = data.messages) === null || _a === void 0 ? void 0 : _a[threadId]) {
|
|
563
|
+
await deleteExpiredRuntimeMessagesForThread(workspacePath, threadId);
|
|
564
|
+
deleteRuntimeMessages(data, threadId);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
const runtimeRepo = readRuntimeMessagesIfAvailable(data, threadId, format);
|
|
569
|
+
if (runtimeRepo)
|
|
570
|
+
return runtimeRepo;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const providerRepo = await loadProviderMessageRepository({
|
|
574
|
+
threadId,
|
|
575
|
+
format,
|
|
576
|
+
workspacePath,
|
|
577
|
+
conversation: conversation !== null && conversation !== void 0 ? conversation : null,
|
|
578
|
+
});
|
|
579
|
+
return providerRepo;
|
|
580
|
+
}
|
|
581
|
+
export async function saveConversationMessage(threadId, request, workspacePath) {
|
|
582
|
+
return updateStore(workspacePath, (data) => {
|
|
583
|
+
var _a, _b;
|
|
584
|
+
const record = data.conversations.find((thread) => thread.threadId === threadId && thread.status !== "deleted");
|
|
585
|
+
if (!record)
|
|
586
|
+
throw new Error("未找到对话");
|
|
587
|
+
record.updatedAt = nowIso();
|
|
588
|
+
const message = upsertRuntimeMessage(data, threadId, request);
|
|
589
|
+
if (!normalizeConversationTitle(record.title)) {
|
|
590
|
+
record.title =
|
|
591
|
+
(_b = (_a = titleFromStoredMessage(message)) !== null && _a !== void 0 ? _a : titleFromRuntimeMessages(data, threadId)) !== null && _b !== void 0 ? _b : null;
|
|
592
|
+
}
|
|
593
|
+
pruneExpiredRuntimeMessages(data);
|
|
594
|
+
return message;
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
export async function touchConversationFromRuntime(metadata) {
|
|
598
|
+
const providerSession = metadata.acpSessionId
|
|
599
|
+
? await findProviderSession(metadata.provider, metadata.acpSessionId, metadata.workspacePath)
|
|
600
|
+
: null;
|
|
601
|
+
await updateStore(metadata.workspacePath, (data) => {
|
|
602
|
+
var _a, _b, _c, _d;
|
|
603
|
+
const timestamp = nowIso();
|
|
604
|
+
const conversationIndex = data.conversations.findIndex((thread) => thread.threadId === metadata.threadId);
|
|
605
|
+
const sessionTitle = (_b = (_a = normalizeRuntimeSessionTitle(metadata.sessionTitle)) !== null && _a !== void 0 ? _a : normalizeRuntimeSessionTitle(providerSession === null || providerSession === void 0 ? void 0 : providerSession.title)) !== null && _b !== void 0 ? _b : (conversationIndex >= 0
|
|
606
|
+
? titleFromRuntimeMessages(data, metadata.threadId)
|
|
607
|
+
: undefined);
|
|
608
|
+
const conversationPatch = {
|
|
609
|
+
threadId: metadata.threadId,
|
|
610
|
+
workspacePath: metadata.workspacePath,
|
|
611
|
+
provider: metadata.provider,
|
|
612
|
+
model: metadata.model,
|
|
613
|
+
modeId: metadata.modeId,
|
|
614
|
+
thoughtLevel: metadata.thoughtLevel,
|
|
615
|
+
permissionMode: metadata.permissionMode,
|
|
616
|
+
providerSessionId: (_c = providerSession === null || providerSession === void 0 ? void 0 : providerSession.sessionId) !== null && _c !== void 0 ? _c : metadata.acpSessionId,
|
|
617
|
+
sourcePath: providerSession === null || providerSession === void 0 ? void 0 : providerSession.sourcePath,
|
|
618
|
+
sourceKind: providerSession === null || providerSession === void 0 ? void 0 : providerSession.sourceKind,
|
|
619
|
+
lastSeenMtime: providerSession === null || providerSession === void 0 ? void 0 : providerSession.lastSeenMtime,
|
|
620
|
+
lastActiveAt: (_d = providerSession === null || providerSession === void 0 ? void 0 : providerSession.lastActiveAt) !== null && _d !== void 0 ? _d : timestamp,
|
|
621
|
+
};
|
|
622
|
+
if (sessionTitle)
|
|
623
|
+
conversationPatch.title = sessionTitle;
|
|
624
|
+
const existingConversation = conversationIndex >= 0
|
|
625
|
+
? data.conversations[conversationIndex]
|
|
626
|
+
: undefined;
|
|
627
|
+
const conversation = existingConversation
|
|
628
|
+
? updateConversationRecord(existingConversation, conversationPatch)
|
|
629
|
+
: createConversationRecord(conversationPatch);
|
|
630
|
+
conversation.updatedAt = timestamp;
|
|
631
|
+
if (conversationIndex >= 0) {
|
|
632
|
+
data.conversations[conversationIndex] = conversation;
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
data.conversations.unshift(conversation);
|
|
636
|
+
}
|
|
637
|
+
const existingSession = data.sessions.find((session) => session.threadId === metadata.threadId &&
|
|
638
|
+
session.provider === metadata.provider &&
|
|
639
|
+
session.workspacePath === metadata.workspacePath &&
|
|
640
|
+
!session.closedAt);
|
|
641
|
+
if (existingSession) {
|
|
642
|
+
existingSession.acpSessionId = metadata.acpSessionId;
|
|
643
|
+
existingSession.model = metadata.model;
|
|
644
|
+
existingSession.modeId = metadata.modeId;
|
|
645
|
+
existingSession.thoughtLevel = metadata.thoughtLevel;
|
|
646
|
+
existingSession.lastActivityAt = timestamp;
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
data.sessions.push({
|
|
650
|
+
threadId: metadata.threadId,
|
|
651
|
+
acpSessionId: metadata.acpSessionId,
|
|
652
|
+
provider: metadata.provider,
|
|
653
|
+
workspacePath: metadata.workspacePath,
|
|
654
|
+
model: metadata.model,
|
|
655
|
+
modeId: metadata.modeId,
|
|
656
|
+
thoughtLevel: metadata.thoughtLevel,
|
|
657
|
+
createdAt: timestamp,
|
|
658
|
+
lastActivityAt: timestamp,
|
|
659
|
+
closedAt: null,
|
|
660
|
+
});
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
export async function closeConversationSession(metadata) {
|
|
664
|
+
if (!metadata)
|
|
665
|
+
return;
|
|
666
|
+
await updateStore(metadata.workspacePath, (data) => {
|
|
667
|
+
const timestamp = nowIso();
|
|
668
|
+
for (const session of data.sessions) {
|
|
669
|
+
if (session.threadId === metadata.threadId &&
|
|
670
|
+
session.provider === metadata.provider &&
|
|
671
|
+
session.workspacePath === metadata.workspacePath &&
|
|
672
|
+
!session.closedAt) {
|
|
673
|
+
session.closedAt = timestamp;
|
|
674
|
+
session.lastActivityAt = timestamp;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
}
|