@agegr/pi-web 0.2.1
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/package.json +1 -0
- package/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
- package/.next/server/app/_global-error/page/build-manifest.json +17 -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.map +5 -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 +17 -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.map +5 -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 +16 -0
- package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -0
- package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -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/agent/[id]/events/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/agent/[id]/events/route/build-manifest.json +9 -0
- package/.next/server/app/api/agent/[id]/events/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/agent/[id]/events/route.js +6 -0
- package/.next/server/app/api/agent/[id]/events/route.js.map +5 -0
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/agent/[id]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/agent/[id]/route/build-manifest.json +9 -0
- package/.next/server/app/api/agent/[id]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/agent/[id]/route.js +7 -0
- package/.next/server/app/api/agent/[id]/route.js.map +5 -0
- package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/agent/new/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/agent/new/route/build-manifest.json +9 -0
- package/.next/server/app/api/agent/new/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/agent/new/route.js +7 -0
- package/.next/server/app/api/agent/new/route.js.map +5 -0
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/new/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/files/[...path]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/files/[...path]/route/build-manifest.json +9 -0
- package/.next/server/app/api/files/[...path]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/files/[...path]/route.js +7 -0
- package/.next/server/app/api/files/[...path]/route.js.map +5 -0
- package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/models/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/models/route/build-manifest.json +9 -0
- package/.next/server/app/api/models/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/models/route.js +6 -0
- package/.next/server/app/api/models/route.js.map +5 -0
- package/.next/server/app/api/models/route.js.nft.json +1 -0
- package/.next/server/app/api/models/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/models-config/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/models-config/route/build-manifest.json +9 -0
- package/.next/server/app/api/models-config/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/models-config/route.js +7 -0
- package/.next/server/app/api/models-config/route.js.map +5 -0
- package/.next/server/app/api/models-config/route.js.nft.json +1 -0
- package/.next/server/app/api/models-config/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/sessions/[id]/context/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/sessions/[id]/context/route/build-manifest.json +9 -0
- package/.next/server/app/api/sessions/[id]/context/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/sessions/[id]/context/route.js +7 -0
- package/.next/server/app/api/sessions/[id]/context/route.js.map +5 -0
- package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/sessions/[id]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/sessions/[id]/route/build-manifest.json +9 -0
- package/.next/server/app/api/sessions/[id]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/sessions/[id]/route.js +7 -0
- package/.next/server/app/api/sessions/[id]/route.js.map +5 -0
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/sessions/new/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/sessions/new/route/build-manifest.json +9 -0
- package/.next/server/app/api/sessions/new/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/sessions/new/route.js +6 -0
- package/.next/server/app/api/sessions/new/route.js.map +5 -0
- package/.next/server/app/api/sessions/new/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/new/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/sessions/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/sessions/route/build-manifest.json +9 -0
- package/.next/server/app/api/sessions/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/sessions/route.js +7 -0
- package/.next/server/app/api/sessions/route.js.map +5 -0
- package/.next/server/app/api/sessions/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/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 +8 -0
- package/.next/server/app/favicon.ico/route.js.map +5 -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/index.html +1 -0
- package/.next/server/app/index.meta +14 -0
- package/.next/server/app/index.rsc +15 -0
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -0
- package/.next/server/app/index.segments/_full.segment.rsc +15 -0
- package/.next/server/app/index.segments/_head.segment.rsc +6 -0
- package/.next/server/app/index.segments/_index.segment.rsc +5 -0
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -0
- package/.next/server/app/page/app-paths-manifest.json +3 -0
- package/.next/server/app/page/build-manifest.json +17 -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.map +5 -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-paths-manifest.json +16 -0
- package/.next/server/chunks/[externals]_next_dist_0h.fyd6._.js +3 -0
- package/.next/server/chunks/[externals]_next_dist_0h.fyd6._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__002d92q._.js +6 -0
- package/.next/server/chunks/[root-of-the-server]__002d92q._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__00a-~o4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__00a-~o4._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__06qx74m._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__06qx74m._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0_ehal9._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0_ehal9._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0a-p9wd._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0a-p9wd._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0b0kii6._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__0b0kii6._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0cw6f~v._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0cw6f~v._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0llo_uy._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0llo_uy._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0rr3q~-._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0rr3q~-._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0y7g-4j._.js +4 -0
- package/.next/server/chunks/[root-of-the-server]__0y7g-4j._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__11j~5mn._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__11j~5mn._.js.map +1 -0
- package/.next/server/chunks/[turbopack]_runtime.js +903 -0
- package/.next/server/chunks/[turbopack]_runtime.js.map +11 -0
- package/.next/server/chunks/_next-internal_server_app_api_agent_[id]_events_route_actions_05o7blz.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_agent_[id]_events_route_actions_05o7blz.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_agent_[id]_route_actions_0kr98j0.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_agent_[id]_route_actions_0kr98j0.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_agent_new_route_actions_0w3r5tj.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_agent_new_route_actions_0w3r5tj.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_files_[___path]_route_actions_0_g4akf.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_files_[___path]_route_actions_0_g4akf.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_models-config_route_actions_0ipr5cq.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_models-config_route_actions_0ipr5cq.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_models_route_actions_0vfccm4.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_models_route_actions_0vfccm4.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_context_route_actions_0d0pnzf.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_context_route_actions_0d0pnzf.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_route_actions_0eo4u5w.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_route_actions_0eo4u5w.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_new_route_actions_093p~n-.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_new_route_actions_093p~n-.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_route_actions_0y1t9w0.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_route_actions_0y1t9w0.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_095lj93.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_favicon_ico_route_actions_095lj93.js.map +1 -0
- package/.next/server/chunks/lib_session-reader_ts_07kvkqq._.js +5 -0
- package/.next/server/chunks/lib_session-reader_ts_07kvkqq._.js.map +1 -0
- package/.next/server/chunks/node_modules_next_04~_e52._.js +13 -0
- package/.next/server/chunks/node_modules_next_04~_e52._.js.map +1 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0yubv2d.js +3 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0yubv2d.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__00d4x5d._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__00d4x5d._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__02hi65f._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__02hi65f._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__06-2p1a._.js +33 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__06-2p1a._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__09z7o2x._.js +19 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__09z7o2x._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0jag6jd._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0jag6jd._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0pr3cat._.js +33 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0pr3cat._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0pspq~2._.js +6 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0pspq~2._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0w~zl.s._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0w~zl.s._.js.map +1 -0
- package/.next/server/chunks/ssr/[turbopack]_runtime.js +903 -0
- package/.next/server/chunks/ssr/[turbopack]_runtime.js.map +11 -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__global-error_page_actions_0k77kol.js.map +1 -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__not-found_page_actions_0eq97pa.js.map +1 -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_page_actions_09-gtaw.js.map +1 -0
- package/.next/server/chunks/ssr/app_layout_tsx_13yf0ls._.js +3 -0
- package/.next/server/chunks/ssr/app_layout_tsx_13yf0ls._.js.map +1 -0
- package/.next/server/chunks/ssr/components_ToolPanel_tsx_0r3vloj._.js +3 -0
- package/.next/server/chunks/ssr/components_ToolPanel_tsx_0r3vloj._.js.map +1 -0
- package/.next/server/chunks/ssr/components_ToolPanel_tsx_0ybdq6k._.js +3 -0
- package/.next/server/chunks/ssr/components_ToolPanel_tsx_0ybdq6k._.js.map +1 -0
- package/.next/server/chunks/ssr/node_modules_09w7yel._.js +33 -0
- package/.next/server/chunks/ssr/node_modules_09w7yel._.js.map +1 -0
- package/.next/server/chunks/ssr/node_modules_0vtdjw7._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_0vtdjw7._.js.map +1 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_09y1ibj._.js +6 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_09y1ibj._.js.map +1 -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_0inhx6q._.js.map +1 -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_forbidden_0ghu-f7.js.map +1 -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_global-error_0lgvd_..js.map +1 -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_client_components_builtin_unauthorized_0cjv-23.js.map +1 -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_002l7yi.js.map +1 -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_02suzhc.js.map +1 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0nsg22r.js +4 -0
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0nsg22r.js.map +1 -0
- package/.next/server/functions-config-manifest.json +4 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +21 -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/0-j.wjqnc6zff.js +1 -0
- package/.next/static/chunks/02i7dfk78~t~2.js +4 -0
- package/.next/static/chunks/02p06lvcsni3l.js +1 -0
- package/.next/static/chunks/03~yq9q893hmn.js +1 -0
- package/.next/static/chunks/09dho1gmydle0.js +1 -0
- package/.next/static/chunks/0_mdnxjv887c..css +1 -0
- package/.next/static/chunks/0cj37tl-sc0gx.js +2 -0
- package/.next/static/chunks/0h4bblvd1oiwg.js +1 -0
- package/.next/static/chunks/0j-yjan8jn-8-.js +31 -0
- package/.next/static/chunks/0lpjxrppxb_hc.js +1 -0
- package/.next/static/chunks/turbopack-04u~j1o-remaj.js +1 -0
- package/.next/static/h_DPSqE34dYtPmxavamVm/_buildManifest.js +11 -0
- package/.next/static/h_DPSqE34dYtPmxavamVm/_clientMiddlewareManifest.js +1 -0
- package/.next/static/h_DPSqE34dYtPmxavamVm/_ssgManifest.js +1 -0
- package/.next/static/media/favicon.0~uco8ba8mwit.ico +0 -0
- package/README.md +62 -0
- package/bin/pi-web.js +24 -0
- package/next.config.ts +8 -0
- package/package.json +43 -0
- package/public/file.svg +1 -0
- package/public/globe.svg +1 -0
- package/public/next.svg +1 -0
- package/public/vercel.svg +1 -0
- package/public/window.svg +1 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},60440,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),x=e.i(74838),v=e.i(10372),R=e.i(93695);e.i(52474);var f=e.i(220),m=e.i(89171),g=e.i(22734),y=e.i(14747),w=e.i(46786);function E(){let e;return(0,y.join)((e=process.env.PI_CODING_AGENT_DIR)?"~"===e?(0,w.homedir)():e.startsWith("~/")?(0,w.homedir)()+e.slice(1):e:(0,y.join)((0,w.homedir)(),".pi","agent"),"models.json")}async function C(){return m.NextResponse.json(function(){let e=E();if(!(0,g.existsSync)(e))return{providers:{}};try{return JSON.parse((0,g.readFileSync)(e,"utf8"))}catch{return{providers:{}}}}())}async function A(t){try{var r;let n,a;r=await t.json(),n=E(),a=(0,y.dirname)(n),(0,g.existsSync)(a)||(0,g.mkdirSync)(a,{recursive:!0}),(0,g.writeFileSync)(n,JSON.stringify(r,null,2),"utf8");let{invalidateModelCache:s}=await e.A(39865);return s(),m.NextResponse.json({success:!0})}catch(e){return m.NextResponse.json({error:String(e)},{status:500})}}e.s(["GET",0,C,"PUT",0,A,"dynamic",0,"force-dynamic"],66358);var N=e.i(66358);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/models-config/route",pathname:"/api/models-config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/models-config/route.ts",nextConfigOutput:"",userland:N}),{workAsyncStorage:S,workUnitAsyncStorage:q,serverHooks:_}=b;async function T(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),b.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/models-config/route";m=m.replace(/\/index$/,"")||"/";let g=await b.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,params:w,nextConfig:E,parsedUrl:C,isDraftMode:A,prerenderManifest:N,routerServerContext:S,isOnDemandRevalidate:q,revalidateOnlyGenerated:_,resolvedPathname:T,clientReferenceManifest:P,serverActionsManifest:j}=g,k=(0,o.normalizeAppPath)(m),O=!!(N.dynamicRoutes[k]||N.routes[T]),I=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,C,!1):t.end("This page could not be found"),null);if(O&&!A){let e=!!N.routes[T],t=N.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await I();throw new R.NoFallbackError}}let H=null;!O||b.isDev||A||(H="/index"===(H=T)?"/":H);let U=!0===b.isDev||!O,D=O&&!U;j&&P&&(0,i.setManifestsSingleton)({page:m,clientReferenceManifest:P,serverActionsManifest:j});let M=e.method||"GET",F=(0,s.getTracer)(),$=F.getActiveScopeSpan(),K=!!(null==S?void 0:S.isWrappedByNextServer),B=!!(0,a.getRequestMeta)(e,"minimalMode"),G=(0,a.getRequestMeta)(e,"incrementalCache")||await b.getIncrementalCache(e,E,N,B);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let L={params:w,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:G,cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>b.onRequestError(e,t,n,a,S)},sharedContext:{buildId:y}},W=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t));try{let a,i=async e=>b.handle(X,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",n),a.updateName(t))}else e.updateName(`${M} ${m}`)}),o=async a=>{var s,o;let l=async({previousCacheEntry:r})=>{try{if(!B&&q&&_&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(a);e.fetchMetrics=L.renderOpts.fetchMetrics;let o=L.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=L.renderOpts.collectedTags;if(!O)return await (0,c.sendResponse)(W,V,s,L.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[v.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,n=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:q})},!1,S),t}},d=await b.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:q,revalidateOnlyGenerated:_,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:B});if(!O)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",q?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return B&&O||u.delete(v.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,x.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(W,V,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&$?await o($):(a=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${m}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},o),void 0,!K))}catch(t){if(t instanceof R.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:q})},!1,S),O)throw t;return await (0,c.sendResponse)(W,V,new Response(null,{status:500})),null}}e.s(["handler",0,T,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:q})},"routeModule",0,b,"serverHooks",0,_,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,q],60440)},39865,e=>{e.v(t=>Promise.all(["server/chunks/lib_session-reader_ts_07kvkqq._.js"].map(t=>e.l(t))).then(()=>t(9890)))}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__00a-~o4._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../app/api/models-config/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextResponse } from \"next/server\";\nimport { readFileSync, writeFileSync, existsSync, mkdirSync } from \"fs\";\nimport { join, dirname } from \"path\";\nimport { homedir } from \"os\";\n\nexport const dynamic = \"force-dynamic\";\n\nfunction getAgentDir(): string {\n const env = process.env.PI_CODING_AGENT_DIR;\n if (env) {\n if (env === \"~\") return homedir();\n if (env.startsWith(\"~/\")) return homedir() + env.slice(1);\n return env;\n }\n return join(homedir(), \".pi\", \"agent\");\n}\n\nfunction getModelsPath(): string {\n return join(getAgentDir(), \"models.json\");\n}\n\nfunction readModelsJson(): Record<string, unknown> {\n const path = getModelsPath();\n if (!existsSync(path)) return { providers: {} };\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as Record<string, unknown>;\n } catch {\n return { providers: {} };\n }\n}\n\nfunction writeModelsJson(data: Record<string, unknown>): void {\n const path = getModelsPath();\n const dir = dirname(path);\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n writeFileSync(path, JSON.stringify(data, null, 2), \"utf8\");\n}\n\nexport async function GET() {\n return NextResponse.json(readModelsJson());\n}\n\nexport async function PUT(req: Request) {\n try {\n const body = await req.json() as Record<string, unknown>;\n writeModelsJson(body);\n // Invalidate model cache so next /api/models returns fresh data\n const { invalidateModelCache } = await import(\"@/lib/session-reader\");\n invalidateModelCache();\n return NextResponse.json({ success: true });\n } catch (error) {\n return NextResponse.json({ error: String(error) }, { status: 500 });\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/models-config/route\",\n pathname: \"/api/models-config\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/models-config/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/models-config/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["dynamic","getAgentDir","env","process","PI_CODING_AGENT_DIR","startsWith","slice","getModelsPath","readModelsJson","path","providers","JSON","parse","writeModelsJson","data","dir","recursive","stringify","GET","json","PUT","req","body","invalidateModelCache","success","error","String","status"],"mappings":"4pCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,KDhBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAcA,SAASO,IATP,MAUA,MAAO,CAAA,EAAA,EAAA,IAAA,AAAI,EATX,AASYN,CAVNC,EAAMC,CACRD,KAAK,EADWA,GAAG,CAACE,mBAAmB,EAE7B,AAAZ,KAAiB,CAAbF,EAAoB,CAAA,EAAA,EAAA,OAAA,AAAO,IAC3BA,EAAIG,UAAU,CAAC,MAAc,CAAP,AAAO,EAAA,EAAA,OAAA,AAAO,IAAKH,EAAII,KAAK,CAAC,GAChDJ,EAEF,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAO,AAAP,IAAW,MAAO,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A,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,GAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[1]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
module.exports=[24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},9890,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(46786);function i(){let e=process.env.PI_CODING_AGENT_DIR;return e?"~"===e?(0,n.homedir)():e.startsWith("~/")?(0,n.homedir)()+e.slice(1):e:(0,r.join)((0,n.homedir)(),".pi","agent")}function s(){return(0,r.join)(i(),"sessions")}let a=null;function o(){if(a)return a;a=new Map;let e=(0,r.join)(i(),"models.json");if(!(0,t.existsSync)(e))return a;try{let r=JSON.parse((0,t.readFileSync)(e,"utf8"));for(let[e,t]of Object.entries(r.providers??{}))for(let r of t.models??[])r.id&&r.name&&a.set(`${e}:${r.id}`,{id:r.id,name:r.name,provider:e})}catch{}return a}function l(e){if(!(0,t.existsSync)(e))return[];let r=(0,t.readFileSync)(e,"utf8"),n=[];for(let e of r.trim().split("\n"))if(e.trim())try{n.push(JSON.parse(e))}catch{}return n}function d(e){try{let r,n,i=l(e);if(0===i.length)return null;let s=i[0];if("session"!==s.type)return null;let a=(0,t.statSync)(e),o=s.id,d=s.cwd??"",u=s.timestamp,p=s.parentSession?(n=(s.parentSession.replace(/\\/g,"/").split("/").pop()??"").match(/_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i),n?.[1]):void 0,c=0,f="";for(let e of i){if("session_info"===e.type&&e.name&&(r=e.name.trim()),"message"!==e.type)continue;c++;let t=e.message;if("user"!==t.role&&"assistant"!==t.role)continue;let n=function(e){let t=e.content;return"string"==typeof t?t:Array.isArray(t)?t.filter(e=>"text"===e.type).map(e=>e.text).join(" "):""}(t);f||"user"!==t.role||(f=n)}return{path:e,id:o,cwd:d,name:r,created:u,modified:a.mtime.toISOString(),messageCount:c,firstMessage:f||"(no messages)",parentSessionId:p}}catch{return null}}async function u(){let e=s(),n=[];if(!(0,t.existsSync)(e))return n;try{for(let i of(0,t.readdirSync)(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(t=>(0,r.join)(e,t.name)))try{for(let e of(0,t.readdirSync)(i).filter(e=>e.endsWith(".jsonl")).map(e=>(0,r.join)(i,e))){let t=d(e);t&&n.push(t)}}catch{}}catch{}return n.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime()),n}function p(){return globalThis.__piSessionPathCache||(globalThis.__piSessionPathCache=new Map),globalThis.__piSessionPathCache}e.s(["buildSessionContext",0,function(e,t){let r,n=new Map;for(let t of e)n.set(t.id,t);if(null===t||(t&&(r=n.get(t)),r||(r=e[e.length-1]),!r))return{messages:[],entryIds:[],thinkingLevel:"off",model:null};let i=[],s=r;for(;s;)i.unshift(s),s=s.parentId?n.get(s.parentId):void 0;let a="off",o=null,l=null;for(let e of i)if("thinking_level_change"===e.type)a=e.thinkingLevel;else if("model_change"===e.type)o={provider:e.provider,modelId:e.modelId};else if("message"===e.type&&"assistant"===e.message.role){let t=e.message;o={provider:t.provider,modelId:t.model}}else"compaction"===e.type&&(l=e);let d=[],u=[],p=e=>{"message"===e.type&&(d.push(function(e){if("assistant"!==e.role||!Array.isArray(e.content))return e;let t=e.content.map(e=>"toolCall"!==e.type?e:{type:"toolCall",toolCallId:e.toolCallId??e.id,toolName:e.toolName??e.name,input:e.input??e.arguments});return{...e,content:t}}(e.message)),u.push(e.id))};if(l){let e={role:"user",content:`*The conversation history before this point was compacted into the following summary:*
|
|
2
|
+
|
|
3
|
+
${l.summary}`,timestamp:new Date(l.timestamp).getTime()};d.push(e),u.push(l.id);let t=i.findIndex(e=>"compaction"===e.type&&e.id===l.id),r=i.findIndex((e,r)=>r<t&&e.id===l.firstKeptEntryId),n=r>=0?r:t;for(let e=n;e<t;e++)p(i[e]);for(let e=t+1;e<i.length;e++)p(i[e])}else for(let e of i)p(e);return{messages:d,entryIds:u,thinkingLevel:a,model:o}},"buildSessionInfo",0,d,"buildTree",0,function(e){let t=new Map;for(let r of e)"label"===r.type&&(r.label?t.set(r.targetId,r.label):t.delete(r.targetId));let r=new Map,n=[];for(let n of e)r.set(n.id,{entry:n,children:[],label:t.get(n.id)});for(let t of e){let e=r.get(t.id);if(t.parentId){let i=r.get(t.parentId);i?i.children.push(e):n.push(e)}else n.push(e)}let i=[...n];for(;i.length>0;){let e=i.pop();e.children.sort((e,t)=>new Date(e.entry.timestamp).getTime()-new Date(t.entry.timestamp).getTime()),i.push(...e.children)}return n},"getDefaultModel",0,function(){let e=(0,r.join)(i(),"settings.json");if(!(0,t.existsSync)(e))return null;try{let r=JSON.parse((0,t.readFileSync)(e,"utf8"));if(!r.defaultProvider)return null;if(r.defaultModel)return{provider:r.defaultProvider,modelId:r.defaultModel};let n=Array.from(o().values()).find(e=>e.provider===r.defaultProvider);if(n)return{provider:n.provider,modelId:n.id}}catch{}return null},"getLeafId",0,function(e){return 0===e.length?null:e[e.length-1].id},"getModelList",0,function(){return Array.from(o().values())},"getModelNameMap",0,function(){let e=new Map;for(let t of o().values())e.set(t.id,t.name);return e},"getSessionEntries",0,function(e){return l(e).filter(e=>"session"!==e.type)},"invalidateModelCache",0,function(){a=null},"invalidateSessionPathCache",0,function(e){p().delete(e)},"listAllSessions",0,u,"resolveSessionPath",0,function(e){let n=p(),i=n.get(e);if(i&&(0,t.existsSync)(i))return i;let a=s();if(!(0,t.existsSync)(a))return null;try{for(let i of(0,t.readdirSync)(a,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>(0,r.join)(a,e.name)))try{for(let s of(0,t.readdirSync)(i).filter(e=>e.endsWith(".jsonl"))){let a=(0,r.join)(i,s),o=(0,t.readFileSync)(a,"utf8").split("\n")[0];try{let t=JSON.parse(o);if("session"===t.type&&t.id===e)return n.set(e,a),a}catch{}}}catch{}}catch{}return null}],9890)},87473,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),i=e.i(59756),s=e.i(61916),a=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),f=e.i(70101),h=e.i(74838),m=e.i(10372),g=e.i(93695);e.i(52474);var y=e.i(220),x=e.i(89171),v=e.i(9890);async function R(e,{params:t}){let{id:r}=await t,n=new URL(e.url).searchParams.get("leafId")??void 0;try{let e=(0,v.resolveSessionPath)(r);if(!e)return x.NextResponse.json({error:"Session not found"},{status:404});let t=(0,v.getSessionEntries)(e),i=(0,v.buildSessionContext)(t,n);return x.NextResponse.json({context:i})}catch(e){return x.NextResponse.json({error:String(e)},{status:500})}}e.s(["GET",0,R],65659);var w=e.i(65659);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/context/route",pathname:"/api/sessions/[id]/context",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/sessions/[id]/context/route.ts",nextConfigOutput:"",userland:w}),{workAsyncStorage:C,workUnitAsyncStorage:E,serverHooks:b}=S;async function I(e,t,n){n.requestMeta&&(0,i.setRequestMeta)(e,n.requestMeta),S.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/sessions/[id]/context/route";x=x.replace(/\/index$/,"")||"/";let v=await S.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,params:w,nextConfig:C,parsedUrl:E,isDraftMode:b,prerenderManifest:I,routerServerContext:A,isOnDemandRevalidate:T,revalidateOnlyGenerated:N,resolvedPathname:_,clientReferenceManifest:j,serverActionsManifest:P}=v,M=(0,o.normalizeAppPath)(x),O=!!(I.dynamicRoutes[M]||I.routes[_]),q=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,E,!1):t.end("This page could not be found"),null);if(O&&!b){let e=!!I.routes[_],t=I.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await q();throw new g.NoFallbackError}}let k=null;!O||S.isDev||b||(k="/index"===(k=_)?"/":k);let D=!0===S.isDev||!O,H=O&&!D;P&&j&&(0,a.setManifestsSingleton)({page:x,clientReferenceManifest:j,serverActionsManifest:P});let U=e.method||"GET",F=(0,s.getTracer)(),$=F.getActiveScopeSpan(),L=!!(null==A?void 0:A.isWrappedByNextServer),K=!!(0,i.getRequestMeta)(e,"minimalMode"),B=(0,i.getRequestMeta)(e,"incrementalCache")||await S.getIncrementalCache(e,C,I,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let G={params:w,previewProps:I.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:D,incrementalCache:B,cacheLifeProfiles:C.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,i)=>S.onRequestError(e,t,n,i,A)},sharedContext:{buildId:R}},W=new l.NodeNextRequest(e),J=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t));try{let i,a=async e=>S.handle(V,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${U} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),i&&i!==e&&(i.setAttribute("http.route",n),i.updateName(t))}else e.updateName(`${U} ${x}`)}),o=async i=>{var s,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&T&&N&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await a(i);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=G.renderOpts.collectedTags;if(!O)return await (0,c.sendResponse)(W,J,s,G.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,n=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await S.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,A),t}},d=await S.handleResponse({req:e,nextConfig:C,cacheKey:k,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:N,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!O)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",T?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return K&&O||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(W,J,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};L&&$?await o($):(i=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${x}`,kind:s.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof g.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,A),O)throw t;return await (0,c.sendResponse)(W,J,new Response(null,{status:500})),null}}e.s(["handler",0,I,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:E})},"routeModule",0,S,"serverHooks",0,b,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,E],87473)}];
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__06qx74m._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/session-reader.ts","../../../lib/normalize.ts","../../../app/api/sessions/%5Bid%5D/context/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { readFileSync, readdirSync, statSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport type {\n FileEntry,\n SessionEntry,\n SessionHeader,\n SessionInfo,\n SessionTreeNode,\n SessionMessageEntry,\n SessionInfoEntry,\n LabelEntry,\n AgentMessage,\n SessionContext,\n CompactionEntry,\n TextContent,\n} from \"./types\";\nimport { normalizeToolCalls } from \"./normalize\";\n\nfunction getAgentDir(): string {\n const envDir = process.env.PI_CODING_AGENT_DIR;\n if (envDir) {\n if (envDir === \"~\") return homedir();\n if (envDir.startsWith(\"~/\")) return homedir() + envDir.slice(1);\n return envDir;\n }\n return join(homedir(), \".pi\", \"agent\");\n}\n\nexport function getSessionsDir(): string {\n return join(getAgentDir(), \"sessions\");\n}\n\nexport interface ModelInfo {\n id: string;\n name: string;\n provider: string;\n}\n\n// Build a map of \"provider:modelId\" -> ModelInfo from ~/.pi/agent/models.json\nlet _modelCache: Map<string, ModelInfo> | null = null;\nfunction getModelCache(): Map<string, ModelInfo> {\n if (_modelCache) return _modelCache;\n _modelCache = new Map();\n const path = join(getAgentDir(), \"models.json\");\n if (!existsSync(path)) return _modelCache;\n try {\n const data = JSON.parse(readFileSync(path, \"utf8\")) as {\n providers?: Record<string, { models?: { id: string; name?: string }[] }>;\n };\n for (const [provider, providerData] of Object.entries(data.providers ?? {})) {\n for (const model of providerData.models ?? []) {\n if (model.id && model.name) {\n _modelCache.set(`${provider}:${model.id}`, { id: model.id, name: model.name, provider });\n }\n }\n }\n } catch { /* ignore */ }\n return _modelCache;\n}\n\nexport function getModelNameMap(): Map<string, string> {\n const result = new Map<string, string>();\n for (const info of getModelCache().values()) result.set(info.id, info.name);\n return result;\n}\n\nexport function getModelList(): ModelInfo[] {\n return Array.from(getModelCache().values());\n}\n\nexport function invalidateModelCache(): void {\n _modelCache = null;\n}\n\nexport function getDefaultModel(): { provider: string; modelId: string } | null {\n const path = join(getAgentDir(), \"settings.json\");\n if (!existsSync(path)) return null;\n try {\n const data = JSON.parse(readFileSync(path, \"utf8\")) as {\n defaultProvider?: string;\n defaultModel?: string;\n };\n if (!data.defaultProvider) return null;\n if (data.defaultModel) {\n return { provider: data.defaultProvider, modelId: data.defaultModel };\n }\n // Only provider saved — pick the first model from that provider in models.json\n const first = Array.from(getModelCache().values()).find((m) => m.provider === data.defaultProvider);\n if (first) return { provider: first.provider, modelId: first.id };\n } catch { /* ignore */ }\n return null;\n}\n\nexport function parseSessionFile(filePath: string): FileEntry[] {\n if (!existsSync(filePath)) return [];\n const content = readFileSync(filePath, \"utf8\");\n const entries: FileEntry[] = [];\n for (const line of content.trim().split(\"\\n\")) {\n if (!line.trim()) continue;\n try {\n entries.push(JSON.parse(line) as FileEntry);\n } catch {\n // skip malformed lines\n }\n }\n return entries;\n}\n\nfunction extractTextContent(message: AgentMessage): string {\n const content = (message as { content: unknown }).content;\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n return content\n .filter((b): b is TextContent => b.type === \"text\")\n .map((b) => b.text)\n .join(\" \");\n}\n\n// Extract session UUID from a session file path like \".../2026-03-18T12-11-02-213Z_20a1e7e5-991f-4b91-856d-14dd2d256f20.jsonl\"\nfunction extractSessionIdFromPath(filePath: string): string | undefined {\n const base = filePath.replace(/\\\\/g, \"/\").split(\"/\").pop() ?? \"\";\n // format: <timestamp>_<uuid>.jsonl\n const match = base.match(/_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\.jsonl$/i);\n return match?.[1];\n}\n\nexport function buildSessionInfo(filePath: string): SessionInfo | null {\n try {\n const entries = parseSessionFile(filePath);\n if (entries.length === 0) return null;\n\n // Skip files without a valid session header (incomplete fork artifacts)\n const maybeHeader = entries[0] as SessionHeader;\n if (maybeHeader.type !== \"session\") return null;\n\n const stats = statSync(filePath);\n const id = maybeHeader.id;\n const cwd = maybeHeader.cwd ?? \"\";\n const created = maybeHeader.timestamp;\n const parentSessionId = maybeHeader.parentSession\n ? extractSessionIdFromPath(maybeHeader.parentSession)\n : undefined;\n\n let messageCount = 0;\n let firstMessage = \"\";\n let name: string | undefined;\n\n for (const entry of entries) {\n if (entry.type === \"session_info\") {\n const e = entry as SessionInfoEntry;\n if (e.name) name = e.name.trim();\n }\n if (entry.type !== \"message\") continue;\n messageCount++;\n const msg = (entry as SessionMessageEntry).message;\n if (msg.role !== \"user\" && msg.role !== \"assistant\") continue;\n const text = extractTextContent(msg);\n if (!firstMessage && msg.role === \"user\") firstMessage = text;\n }\n\n return {\n path: filePath,\n id,\n cwd,\n name,\n created,\n modified: stats.mtime.toISOString(),\n messageCount,\n firstMessage: firstMessage || \"(no messages)\",\n parentSessionId,\n };\n } catch {\n return null;\n }\n}\n\nexport async function listAllSessions(): Promise<SessionInfo[]> {\n const sessionsDir = getSessionsDir();\n const sessions: SessionInfo[] = [];\n if (!existsSync(sessionsDir)) return sessions;\n\n try {\n const dirs = readdirSync(sessionsDir, { withFileTypes: true })\n .filter((e) => e.isDirectory())\n .map((e) => join(sessionsDir, e.name));\n\n for (const dir of dirs) {\n try {\n const files = readdirSync(dir)\n .filter((f) => f.endsWith(\".jsonl\"))\n .map((f) => join(dir, f));\n for (const file of files) {\n const info = buildSessionInfo(file);\n if (info) sessions.push(info);\n }\n } catch {\n // skip unreadable dir\n }\n }\n } catch {\n // skip\n }\n\n sessions.sort((a, b) => new Date(b.modified).getTime() - new Date(a.modified).getTime());\n return sessions;\n}\n\nexport function getSessionEntries(filePath: string): SessionEntry[] {\n const entries = parseSessionFile(filePath);\n return entries.filter((e): e is SessionEntry => e.type !== \"session\");\n}\n\nexport function buildTree(entries: SessionEntry[]): SessionTreeNode[] {\n const labelsById = new Map<string, string>();\n for (const entry of entries) {\n if (entry.type === \"label\") {\n const l = entry as LabelEntry;\n if (l.label) labelsById.set(l.targetId, l.label);\n else labelsById.delete(l.targetId);\n }\n }\n\n const nodeMap = new Map<string, SessionTreeNode>();\n const roots: SessionTreeNode[] = [];\n\n for (const entry of entries) {\n nodeMap.set(entry.id, { entry, children: [], label: labelsById.get(entry.id) });\n }\n\n for (const entry of entries) {\n const node = nodeMap.get(entry.id)!;\n if (!entry.parentId) {\n roots.push(node);\n } else {\n const parent = nodeMap.get(entry.parentId);\n if (parent) {\n parent.children.push(node);\n } else {\n roots.push(node);\n }\n }\n }\n\n // sort children by timestamp\n const stack = [...roots];\n while (stack.length > 0) {\n const node = stack.pop()!;\n node.children.sort(\n (a, b) => new Date(a.entry.timestamp).getTime() - new Date(b.entry.timestamp).getTime()\n );\n stack.push(...node.children);\n }\n\n return roots;\n}\n\n\n\nexport function buildSessionContext(\n entries: SessionEntry[],\n leafId?: string | null\n): SessionContext {\n const byId = new Map<string, SessionEntry>();\n for (const entry of entries) {\n byId.set(entry.id, entry);\n }\n\n let leaf: SessionEntry | undefined;\n if (leafId === null) {\n return { messages: [], entryIds: [], thinkingLevel: \"off\", model: null };\n }\n if (leafId) {\n leaf = byId.get(leafId);\n }\n if (!leaf) {\n leaf = entries[entries.length - 1];\n }\n if (!leaf) {\n return { messages: [], entryIds: [], thinkingLevel: \"off\", model: null };\n }\n\n // walk from leaf to root\n const path: SessionEntry[] = [];\n let current: SessionEntry | undefined = leaf;\n while (current) {\n path.unshift(current);\n current = current.parentId ? byId.get(current.parentId) : undefined;\n }\n\n let thinkingLevel = \"off\";\n let model: { provider: string; modelId: string } | null = null;\n let compaction: CompactionEntry | null = null;\n\n for (const entry of path) {\n if (entry.type === \"thinking_level_change\") {\n thinkingLevel = entry.thinkingLevel;\n } else if (entry.type === \"model_change\") {\n model = { provider: entry.provider, modelId: entry.modelId };\n } else if (entry.type === \"message\" && (entry as SessionMessageEntry).message.role === \"assistant\") {\n const msg = (entry as SessionMessageEntry).message as { provider: string; model: string };\n model = { provider: msg.provider, modelId: msg.model };\n } else if (entry.type === \"compaction\") {\n compaction = entry as CompactionEntry;\n }\n }\n\n const messages: AgentMessage[] = [];\n const entryIds: string[] = [];\n\n const appendMessage = (entry: SessionEntry) => {\n if (entry.type === \"message\") {\n messages.push(normalizeToolCalls((entry as SessionMessageEntry).message));\n entryIds.push(entry.id);\n }\n };\n\n if (compaction) {\n // Inject compaction summary as a virtual user message matching agent's format\n const summaryMsg: AgentMessage = {\n role: \"user\",\n content: `*The conversation history before this point was compacted into the following summary:*\\n\\n${compaction.summary}`,\n timestamp: new Date(compaction.timestamp).getTime(),\n };\n messages.push(summaryMsg);\n entryIds.push(compaction.id);\n\n const compactionIdx = path.findIndex(\n (e) => e.type === \"compaction\" && e.id === compaction!.id\n );\n // Find firstKeptEntryId before the compaction node; if not found, skip all pre-compaction entries\n const firstKeptIdx = path.findIndex(\n (e, i) => i < compactionIdx && e.id === compaction!.firstKeptEntryId\n );\n const startIdx = firstKeptIdx >= 0 ? firstKeptIdx : compactionIdx;\n for (let i = startIdx; i < compactionIdx; i++) {\n appendMessage(path[i]);\n }\n for (let i = compactionIdx + 1; i < path.length; i++) {\n appendMessage(path[i]);\n }\n } else {\n for (const entry of path) {\n appendMessage(entry);\n }\n }\n\n return { messages, entryIds, thinkingLevel, model };\n}\n\nexport function getLeafId(entries: SessionEntry[]): string | null {\n if (entries.length === 0) return null;\n return entries[entries.length - 1].id;\n}\n\n// ============================================================================\n// Session path cache: sessionId → absolute file path\n// Stored in globalThis for hot-reload safety (same as rpc-manager registry)\n// ============================================================================\ndeclare global {\n var __piSessionPathCache: Map<string, string> | undefined;\n}\n\nfunction getPathCache(): Map<string, string> {\n if (!globalThis.__piSessionPathCache) globalThis.__piSessionPathCache = new Map();\n return globalThis.__piSessionPathCache;\n}\n\nexport function invalidateSessionPathCache(sessionId: string): void {\n getPathCache().delete(sessionId);\n}\n\nexport function resolveSessionPath(sessionId: string): string | null {\n const cache = getPathCache();\n const cached = cache.get(sessionId);\n if (cached && existsSync(cached)) return cached;\n\n const sessionsDir = getSessionsDir();\n if (!existsSync(sessionsDir)) return null;\n try {\n const dirs = readdirSync(sessionsDir, { withFileTypes: true })\n .filter((e) => e.isDirectory())\n .map((e) => join(sessionsDir, e.name));\n for (const dir of dirs) {\n try {\n const files = readdirSync(dir).filter((f) => f.endsWith(\".jsonl\"));\n for (const file of files) {\n const fullPath = join(dir, file);\n // Read only first line to check header id\n const firstLine = readFileSync(fullPath, \"utf8\").split(\"\\n\")[0];\n try {\n const header = JSON.parse(firstLine) as SessionHeader;\n if (header.type === \"session\" && header.id === sessionId) {\n cache.set(sessionId, fullPath);\n return fullPath;\n }\n } catch { /* skip malformed */ }\n }\n } catch {\n // skip\n }\n }\n } catch {\n // skip\n }\n return null;\n}\n","import type { AgentMessage } from \"./types\";\n\n/**\n * Pi stores toolCall blocks as {id, name, arguments} but our types use\n * {toolCallId, toolName, input}. Normalize both file-read and streaming paths.\n */\nexport function normalizeToolCalls(msg: AgentMessage): AgentMessage {\n if (msg.role !== \"assistant\") return msg;\n const raw = msg as unknown as { content?: unknown[] };\n if (!Array.isArray(raw.content)) return msg;\n const normalized = raw.content.map((block) => {\n const b = block as Record<string, unknown>;\n if (b.type !== \"toolCall\") return b;\n return {\n type: \"toolCall\",\n toolCallId: b.toolCallId ?? b.id,\n toolName: b.toolName ?? b.name,\n input: b.input ?? b.arguments,\n };\n });\n return { ...(msg as object), content: normalized } as unknown as AgentMessage;\n}\n","import { NextResponse } from \"next/server\";\nimport {\n resolveSessionPath,\n getSessionEntries,\n buildSessionContext,\n} from \"@/lib/session-reader\";\n\nexport async function GET(\n req: Request,\n { params }: { params: Promise<{ id: string }> }\n) {\n const { id } = await params;\n const url = new URL(req.url);\n const leafId = url.searchParams.get(\"leafId\") ?? undefined;\n\n try {\n const filePath = resolveSessionPath(id);\n if (!filePath) {\n return NextResponse.json({ error: \"Session not found\" }, { status: 404 });\n }\n\n const entries = getSessionEntries(filePath);\n const context = buildSessionContext(entries, leafId);\n\n return NextResponse.json({ context });\n } catch (error) {\n return NextResponse.json({ error: String(error) }, { status: 500 });\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sessions/[id]/context/route\",\n pathname: \"/api/sessions/[id]/context\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/sessions/[id]/context/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/sessions/[id]/context/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["normalizeToolCalls","msg","role","raw","Array","isArray","content","normalized","map","block","b","type","toolCallId","id","toolName","name","input","arguments","status","GET","req","params","url","URL","leafId","searchParams","get","undefined","filePath","json","error","entries","context","String"],"mappings":"2pCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAiBA,SAAS,IACP,IAAM,EAAS,QAAQ,GAAG,CAAC,mBAAmB,QAC9C,AAAI,EACF,AAAe,KAAK,CADV,AACN,EAAuB,CAAA,EAAA,EAAA,OAAA,AAAO,IAC9B,EAAO,UAAU,CAAC,MAAc,CAAP,AAAO,EAAA,EAAA,OAAA,AAAO,IAAK,EAAO,KAAK,CAAC,GACtD,EAEF,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAA,AAAO,IAAI,MAAO,QAChC,CAEOU,SAAS,IACd,MAAO,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,IAAe,WAC7B,CASA,IAAI,EAA6C,KACjD,SAAS,IACP,GAAI,EAAa,OAAO,EACxB,EAAc,IAAI,IAClB,IAAM,EAAO,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,IAAe,eACjC,GAAI,CAAC,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,GAAO,OAAO,EAC9B,GAAI,CACF,IAAM,EAAO,KAAK,KAAK,CAAC,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAM,SAG3C,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EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[3]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
module.exports=[24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},9890,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(46786);function i(){let e=process.env.PI_CODING_AGENT_DIR;return e?"~"===e?(0,n.homedir)():e.startsWith("~/")?(0,n.homedir)()+e.slice(1):e:(0,r.join)((0,n.homedir)(),".pi","agent")}function a(){return(0,r.join)(i(),"sessions")}let s=null;function o(){if(s)return s;s=new Map;let e=(0,r.join)(i(),"models.json");if(!(0,t.existsSync)(e))return s;try{let r=JSON.parse((0,t.readFileSync)(e,"utf8"));for(let[e,t]of Object.entries(r.providers??{}))for(let r of t.models??[])r.id&&r.name&&s.set(`${e}:${r.id}`,{id:r.id,name:r.name,provider:e})}catch{}return s}function l(e){if(!(0,t.existsSync)(e))return[];let r=(0,t.readFileSync)(e,"utf8"),n=[];for(let e of r.trim().split("\n"))if(e.trim())try{n.push(JSON.parse(e))}catch{}return n}function d(e){try{let r,n,i=l(e);if(0===i.length)return null;let a=i[0];if("session"!==a.type)return null;let s=(0,t.statSync)(e),o=a.id,d=a.cwd??"",u=a.timestamp,p=a.parentSession?(n=(a.parentSession.replace(/\\/g,"/").split("/").pop()??"").match(/_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i),n?.[1]):void 0,c=0,f="";for(let e of i){if("session_info"===e.type&&e.name&&(r=e.name.trim()),"message"!==e.type)continue;c++;let t=e.message;if("user"!==t.role&&"assistant"!==t.role)continue;let n=function(e){let t=e.content;return"string"==typeof t?t:Array.isArray(t)?t.filter(e=>"text"===e.type).map(e=>e.text).join(" "):""}(t);f||"user"!==t.role||(f=n)}return{path:e,id:o,cwd:d,name:r,created:u,modified:s.mtime.toISOString(),messageCount:c,firstMessage:f||"(no messages)",parentSessionId:p}}catch{return null}}async function u(){let e=a(),n=[];if(!(0,t.existsSync)(e))return n;try{for(let i of(0,t.readdirSync)(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(t=>(0,r.join)(e,t.name)))try{for(let e of(0,t.readdirSync)(i).filter(e=>e.endsWith(".jsonl")).map(e=>(0,r.join)(i,e))){let t=d(e);t&&n.push(t)}}catch{}}catch{}return n.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime()),n}function p(){return globalThis.__piSessionPathCache||(globalThis.__piSessionPathCache=new Map),globalThis.__piSessionPathCache}e.s(["buildSessionContext",0,function(e,t){let r,n=new Map;for(let t of e)n.set(t.id,t);if(null===t||(t&&(r=n.get(t)),r||(r=e[e.length-1]),!r))return{messages:[],entryIds:[],thinkingLevel:"off",model:null};let i=[],a=r;for(;a;)i.unshift(a),a=a.parentId?n.get(a.parentId):void 0;let s="off",o=null,l=null;for(let e of i)if("thinking_level_change"===e.type)s=e.thinkingLevel;else if("model_change"===e.type)o={provider:e.provider,modelId:e.modelId};else if("message"===e.type&&"assistant"===e.message.role){let t=e.message;o={provider:t.provider,modelId:t.model}}else"compaction"===e.type&&(l=e);let d=[],u=[],p=e=>{"message"===e.type&&(d.push(function(e){if("assistant"!==e.role||!Array.isArray(e.content))return e;let t=e.content.map(e=>"toolCall"!==e.type?e:{type:"toolCall",toolCallId:e.toolCallId??e.id,toolName:e.toolName??e.name,input:e.input??e.arguments});return{...e,content:t}}(e.message)),u.push(e.id))};if(l){let e={role:"user",content:`*The conversation history before this point was compacted into the following summary:*
|
|
2
|
+
|
|
3
|
+
${l.summary}`,timestamp:new Date(l.timestamp).getTime()};d.push(e),u.push(l.id);let t=i.findIndex(e=>"compaction"===e.type&&e.id===l.id),r=i.findIndex((e,r)=>r<t&&e.id===l.firstKeptEntryId),n=r>=0?r:t;for(let e=n;e<t;e++)p(i[e]);for(let e=t+1;e<i.length;e++)p(i[e])}else for(let e of i)p(e);return{messages:d,entryIds:u,thinkingLevel:s,model:o}},"buildSessionInfo",0,d,"buildTree",0,function(e){let t=new Map;for(let r of e)"label"===r.type&&(r.label?t.set(r.targetId,r.label):t.delete(r.targetId));let r=new Map,n=[];for(let n of e)r.set(n.id,{entry:n,children:[],label:t.get(n.id)});for(let t of e){let e=r.get(t.id);if(t.parentId){let i=r.get(t.parentId);i?i.children.push(e):n.push(e)}else n.push(e)}let i=[...n];for(;i.length>0;){let e=i.pop();e.children.sort((e,t)=>new Date(e.entry.timestamp).getTime()-new Date(t.entry.timestamp).getTime()),i.push(...e.children)}return n},"getDefaultModel",0,function(){let e=(0,r.join)(i(),"settings.json");if(!(0,t.existsSync)(e))return null;try{let r=JSON.parse((0,t.readFileSync)(e,"utf8"));if(!r.defaultProvider)return null;if(r.defaultModel)return{provider:r.defaultProvider,modelId:r.defaultModel};let n=Array.from(o().values()).find(e=>e.provider===r.defaultProvider);if(n)return{provider:n.provider,modelId:n.id}}catch{}return null},"getLeafId",0,function(e){return 0===e.length?null:e[e.length-1].id},"getModelList",0,function(){return Array.from(o().values())},"getModelNameMap",0,function(){let e=new Map;for(let t of o().values())e.set(t.id,t.name);return e},"getSessionEntries",0,function(e){return l(e).filter(e=>"session"!==e.type)},"invalidateModelCache",0,function(){s=null},"invalidateSessionPathCache",0,function(e){p().delete(e)},"listAllSessions",0,u,"resolveSessionPath",0,function(e){let n=p(),i=n.get(e);if(i&&(0,t.existsSync)(i))return i;let s=a();if(!(0,t.existsSync)(s))return null;try{for(let i of(0,t.readdirSync)(s,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>(0,r.join)(s,e.name)))try{for(let a of(0,t.readdirSync)(i).filter(e=>e.endsWith(".jsonl"))){let s=(0,r.join)(i,a),o=(0,t.readFileSync)(s,"utf8").split("\n")[0];try{let t=JSON.parse(o);if("session"===t.type&&t.id===e)return n.set(e,s),s}catch{}}}catch{}}catch{}return null}],9890)},95764,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),i=e.i(59756),a=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),f=e.i(70101),h=e.i(74838),m=e.i(10372),g=e.i(93695);e.i(52474);var y=e.i(220),v=e.i(89171),x=e.i(9890);async function R(){try{let e=await (0,x.listAllSessions)();return v.NextResponse.json({sessions:e})}catch(e){return v.NextResponse.json({error:String(e)},{status:500})}}e.s(["GET",0,R],45306);var w=e.i(45306);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/route",pathname:"/api/sessions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/sessions/route.ts",nextConfigOutput:"",userland:w}),{workAsyncStorage:C,workUnitAsyncStorage:E,serverHooks:b}=S;async function A(e,t,n){n.requestMeta&&(0,i.setRequestMeta)(e,n.requestMeta),S.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/sessions/route";v=v.replace(/\/index$/,"")||"/";let x=await S.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!x)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,params:w,nextConfig:C,parsedUrl:E,isDraftMode:b,prerenderManifest:A,routerServerContext:I,isOnDemandRevalidate:T,revalidateOnlyGenerated:N,resolvedPathname:_,clientReferenceManifest:j,serverActionsManifest:P}=x,M=(0,o.normalizeAppPath)(v),O=!!(A.dynamicRoutes[M]||A.routes[_]),q=async()=>((null==I?void 0:I.render404)?await I.render404(e,t,E,!1):t.end("This page could not be found"),null);if(O&&!b){let e=!!A.routes[_],t=A.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await q();throw new g.NoFallbackError}}let k=null;!O||S.isDev||b||(k="/index"===(k=_)?"/":k);let D=!0===S.isDev||!O,H=O&&!D;P&&j&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:j,serverActionsManifest:P});let U=e.method||"GET",F=(0,a.getTracer)(),$=F.getActiveScopeSpan(),K=!!(null==I?void 0:I.isWrappedByNextServer),L=!!(0,i.getRequestMeta)(e,"minimalMode"),B=(0,i.getRequestMeta)(e,"incrementalCache")||await S.getIncrementalCache(e,C,A,L);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let G={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:D,incrementalCache:B,cacheLifeProfiles:C.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,i)=>S.onRequestError(e,t,n,i,I)},sharedContext:{buildId:R}},W=new l.NodeNextRequest(e),J=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t));try{let i,s=async e=>S.handle(V,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${U} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),i&&i!==e&&(i.setAttribute("http.route",n),i.updateName(t))}else e.updateName(`${U} ${v}`)}),o=async i=>{var a,o;let l=async({previousCacheEntry:r})=>{try{if(!L&&T&&N&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await s(i);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=G.renderOpts.collectedTags;if(!O)return await (0,c.sendResponse)(W,J,a,G.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,n=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await S.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,I),t}},d=await S.handleResponse({req:e,nextConfig:C,cacheKey:k,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:N,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:L});if(!O)return null;if((null==d||null==(a=d.value)?void 0:a.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",T?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return L&&O||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(W,J,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&$?await o($):(i=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${v}`,kind:a.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},o),void 0,!K))}catch(t){if(t instanceof g.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,I),O)throw t;return await (0,c.sendResponse)(W,J,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:E})},"routeModule",0,S,"serverHooks",0,b,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,E],95764)}];
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__0_ehal9._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/session-reader.ts","../../../lib/normalize.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../app/api/sessions/route.ts"],"sourcesContent":["import { readFileSync, readdirSync, statSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport type {\n FileEntry,\n SessionEntry,\n SessionHeader,\n SessionInfo,\n SessionTreeNode,\n SessionMessageEntry,\n SessionInfoEntry,\n LabelEntry,\n AgentMessage,\n SessionContext,\n CompactionEntry,\n TextContent,\n} from \"./types\";\nimport { normalizeToolCalls } from \"./normalize\";\n\nfunction getAgentDir(): string {\n const envDir = process.env.PI_CODING_AGENT_DIR;\n if (envDir) {\n if (envDir === \"~\") return homedir();\n if (envDir.startsWith(\"~/\")) return homedir() + envDir.slice(1);\n return envDir;\n }\n return join(homedir(), \".pi\", \"agent\");\n}\n\nexport function getSessionsDir(): string {\n return join(getAgentDir(), \"sessions\");\n}\n\nexport interface ModelInfo {\n id: string;\n name: string;\n provider: string;\n}\n\n// Build a map of \"provider:modelId\" -> ModelInfo from ~/.pi/agent/models.json\nlet _modelCache: Map<string, ModelInfo> | null = null;\nfunction getModelCache(): Map<string, ModelInfo> {\n if (_modelCache) return _modelCache;\n _modelCache = new Map();\n const path = join(getAgentDir(), \"models.json\");\n if (!existsSync(path)) return _modelCache;\n try {\n const data = JSON.parse(readFileSync(path, \"utf8\")) as {\n providers?: Record<string, { models?: { id: string; name?: string }[] }>;\n };\n for (const [provider, providerData] of Object.entries(data.providers ?? {})) {\n for (const model of providerData.models ?? []) {\n if (model.id && model.name) {\n _modelCache.set(`${provider}:${model.id}`, { id: model.id, name: model.name, provider });\n }\n }\n }\n } catch { /* ignore */ }\n return _modelCache;\n}\n\nexport function getModelNameMap(): Map<string, string> {\n const result = new Map<string, string>();\n for (const info of getModelCache().values()) result.set(info.id, info.name);\n return result;\n}\n\nexport function getModelList(): ModelInfo[] {\n return Array.from(getModelCache().values());\n}\n\nexport function invalidateModelCache(): void {\n _modelCache = null;\n}\n\nexport function getDefaultModel(): { provider: string; modelId: string } | null {\n const path = join(getAgentDir(), \"settings.json\");\n if (!existsSync(path)) return null;\n try {\n const data = JSON.parse(readFileSync(path, \"utf8\")) as {\n defaultProvider?: string;\n defaultModel?: string;\n };\n if (!data.defaultProvider) return null;\n if (data.defaultModel) {\n return { provider: data.defaultProvider, modelId: data.defaultModel };\n }\n // Only provider saved — pick the first model from that provider in models.json\n const first = Array.from(getModelCache().values()).find((m) => m.provider === data.defaultProvider);\n if (first) return { provider: first.provider, modelId: first.id };\n } catch { /* ignore */ }\n return null;\n}\n\nexport function parseSessionFile(filePath: string): FileEntry[] {\n if (!existsSync(filePath)) return [];\n const content = readFileSync(filePath, \"utf8\");\n const entries: FileEntry[] = [];\n for (const line of content.trim().split(\"\\n\")) {\n if (!line.trim()) continue;\n try {\n entries.push(JSON.parse(line) as FileEntry);\n } catch {\n // skip malformed lines\n }\n }\n return entries;\n}\n\nfunction extractTextContent(message: AgentMessage): string {\n const content = (message as { content: unknown }).content;\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n return content\n .filter((b): b is TextContent => b.type === \"text\")\n .map((b) => b.text)\n .join(\" \");\n}\n\n// Extract session UUID from a session file path like \".../2026-03-18T12-11-02-213Z_20a1e7e5-991f-4b91-856d-14dd2d256f20.jsonl\"\nfunction extractSessionIdFromPath(filePath: string): string | undefined {\n const base = filePath.replace(/\\\\/g, \"/\").split(\"/\").pop() ?? \"\";\n // format: <timestamp>_<uuid>.jsonl\n const match = base.match(/_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\.jsonl$/i);\n return match?.[1];\n}\n\nexport function buildSessionInfo(filePath: string): SessionInfo | null {\n try {\n const entries = parseSessionFile(filePath);\n if (entries.length === 0) return null;\n\n // Skip files without a valid session header (incomplete fork artifacts)\n const maybeHeader = entries[0] as SessionHeader;\n if (maybeHeader.type !== \"session\") return null;\n\n const stats = statSync(filePath);\n const id = maybeHeader.id;\n const cwd = maybeHeader.cwd ?? \"\";\n const created = maybeHeader.timestamp;\n const parentSessionId = maybeHeader.parentSession\n ? extractSessionIdFromPath(maybeHeader.parentSession)\n : undefined;\n\n let messageCount = 0;\n let firstMessage = \"\";\n let name: string | undefined;\n\n for (const entry of entries) {\n if (entry.type === \"session_info\") {\n const e = entry as SessionInfoEntry;\n if (e.name) name = e.name.trim();\n }\n if (entry.type !== \"message\") continue;\n messageCount++;\n const msg = (entry as SessionMessageEntry).message;\n if (msg.role !== \"user\" && msg.role !== \"assistant\") continue;\n const text = extractTextContent(msg);\n if (!firstMessage && msg.role === \"user\") firstMessage = text;\n }\n\n return {\n path: filePath,\n id,\n cwd,\n name,\n created,\n modified: stats.mtime.toISOString(),\n messageCount,\n firstMessage: firstMessage || \"(no messages)\",\n parentSessionId,\n };\n } catch {\n return null;\n }\n}\n\nexport async function listAllSessions(): Promise<SessionInfo[]> {\n const sessionsDir = getSessionsDir();\n const sessions: SessionInfo[] = [];\n if (!existsSync(sessionsDir)) return sessions;\n\n try {\n const dirs = readdirSync(sessionsDir, { withFileTypes: true })\n .filter((e) => e.isDirectory())\n .map((e) => join(sessionsDir, e.name));\n\n for (const dir of dirs) {\n try {\n const files = readdirSync(dir)\n .filter((f) => f.endsWith(\".jsonl\"))\n .map((f) => join(dir, f));\n for (const file of files) {\n const info = buildSessionInfo(file);\n if (info) sessions.push(info);\n }\n } catch {\n // skip unreadable dir\n }\n }\n } catch {\n // skip\n }\n\n sessions.sort((a, b) => new Date(b.modified).getTime() - new Date(a.modified).getTime());\n return sessions;\n}\n\nexport function getSessionEntries(filePath: string): SessionEntry[] {\n const entries = parseSessionFile(filePath);\n return entries.filter((e): e is SessionEntry => e.type !== \"session\");\n}\n\nexport function buildTree(entries: SessionEntry[]): SessionTreeNode[] {\n const labelsById = new Map<string, string>();\n for (const entry of entries) {\n if (entry.type === \"label\") {\n const l = entry as LabelEntry;\n if (l.label) labelsById.set(l.targetId, l.label);\n else labelsById.delete(l.targetId);\n }\n }\n\n const nodeMap = new Map<string, SessionTreeNode>();\n const roots: SessionTreeNode[] = [];\n\n for (const entry of entries) {\n nodeMap.set(entry.id, { entry, children: [], label: labelsById.get(entry.id) });\n }\n\n for (const entry of entries) {\n const node = nodeMap.get(entry.id)!;\n if (!entry.parentId) {\n roots.push(node);\n } else {\n const parent = nodeMap.get(entry.parentId);\n if (parent) {\n parent.children.push(node);\n } else {\n roots.push(node);\n }\n }\n }\n\n // sort children by timestamp\n const stack = [...roots];\n while (stack.length > 0) {\n const node = stack.pop()!;\n node.children.sort(\n (a, b) => new Date(a.entry.timestamp).getTime() - new Date(b.entry.timestamp).getTime()\n );\n stack.push(...node.children);\n }\n\n return roots;\n}\n\n\n\nexport function buildSessionContext(\n entries: SessionEntry[],\n leafId?: string | null\n): SessionContext {\n const byId = new Map<string, SessionEntry>();\n for (const entry of entries) {\n byId.set(entry.id, entry);\n }\n\n let leaf: SessionEntry | undefined;\n if (leafId === null) {\n return { messages: [], entryIds: [], thinkingLevel: \"off\", model: null };\n }\n if (leafId) {\n leaf = byId.get(leafId);\n }\n if (!leaf) {\n leaf = entries[entries.length - 1];\n }\n if (!leaf) {\n return { messages: [], entryIds: [], thinkingLevel: \"off\", model: null };\n }\n\n // walk from leaf to root\n const path: SessionEntry[] = [];\n let current: SessionEntry | undefined = leaf;\n while (current) {\n path.unshift(current);\n current = current.parentId ? byId.get(current.parentId) : undefined;\n }\n\n let thinkingLevel = \"off\";\n let model: { provider: string; modelId: string } | null = null;\n let compaction: CompactionEntry | null = null;\n\n for (const entry of path) {\n if (entry.type === \"thinking_level_change\") {\n thinkingLevel = entry.thinkingLevel;\n } else if (entry.type === \"model_change\") {\n model = { provider: entry.provider, modelId: entry.modelId };\n } else if (entry.type === \"message\" && (entry as SessionMessageEntry).message.role === \"assistant\") {\n const msg = (entry as SessionMessageEntry).message as { provider: string; model: string };\n model = { provider: msg.provider, modelId: msg.model };\n } else if (entry.type === \"compaction\") {\n compaction = entry as CompactionEntry;\n }\n }\n\n const messages: AgentMessage[] = [];\n const entryIds: string[] = [];\n\n const appendMessage = (entry: SessionEntry) => {\n if (entry.type === \"message\") {\n messages.push(normalizeToolCalls((entry as SessionMessageEntry).message));\n entryIds.push(entry.id);\n }\n };\n\n if (compaction) {\n // Inject compaction summary as a virtual user message matching agent's format\n const summaryMsg: AgentMessage = {\n role: \"user\",\n content: `*The conversation history before this point was compacted into the following summary:*\\n\\n${compaction.summary}`,\n timestamp: new Date(compaction.timestamp).getTime(),\n };\n messages.push(summaryMsg);\n entryIds.push(compaction.id);\n\n const compactionIdx = path.findIndex(\n (e) => e.type === \"compaction\" && e.id === compaction!.id\n );\n // Find firstKeptEntryId before the compaction node; if not found, skip all pre-compaction entries\n const firstKeptIdx = path.findIndex(\n (e, i) => i < compactionIdx && e.id === compaction!.firstKeptEntryId\n );\n const startIdx = firstKeptIdx >= 0 ? firstKeptIdx : compactionIdx;\n for (let i = startIdx; i < compactionIdx; i++) {\n appendMessage(path[i]);\n }\n for (let i = compactionIdx + 1; i < path.length; i++) {\n appendMessage(path[i]);\n }\n } else {\n for (const entry of path) {\n appendMessage(entry);\n }\n }\n\n return { messages, entryIds, thinkingLevel, model };\n}\n\nexport function getLeafId(entries: SessionEntry[]): string | null {\n if (entries.length === 0) return null;\n return entries[entries.length - 1].id;\n}\n\n// ============================================================================\n// Session path cache: sessionId → absolute file path\n// Stored in globalThis for hot-reload safety (same as rpc-manager registry)\n// ============================================================================\ndeclare global {\n var __piSessionPathCache: Map<string, string> | undefined;\n}\n\nfunction getPathCache(): Map<string, string> {\n if (!globalThis.__piSessionPathCache) globalThis.__piSessionPathCache = new Map();\n return globalThis.__piSessionPathCache;\n}\n\nexport function invalidateSessionPathCache(sessionId: string): void {\n getPathCache().delete(sessionId);\n}\n\nexport function resolveSessionPath(sessionId: string): string | null {\n const cache = getPathCache();\n const cached = cache.get(sessionId);\n if (cached && existsSync(cached)) return cached;\n\n const sessionsDir = getSessionsDir();\n if (!existsSync(sessionsDir)) return null;\n try {\n const dirs = readdirSync(sessionsDir, { withFileTypes: true })\n .filter((e) => e.isDirectory())\n .map((e) => join(sessionsDir, e.name));\n for (const dir of dirs) {\n try {\n const files = readdirSync(dir).filter((f) => f.endsWith(\".jsonl\"));\n for (const file of files) {\n const fullPath = join(dir, file);\n // Read only first line to check header id\n const firstLine = readFileSync(fullPath, \"utf8\").split(\"\\n\")[0];\n try {\n const header = JSON.parse(firstLine) as SessionHeader;\n if (header.type === \"session\" && header.id === sessionId) {\n cache.set(sessionId, fullPath);\n return fullPath;\n }\n } catch { /* skip malformed */ }\n }\n } catch {\n // skip\n }\n }\n } catch {\n // skip\n }\n return null;\n}\n","import type { AgentMessage } from \"./types\";\n\n/**\n * Pi stores toolCall blocks as {id, name, arguments} but our types use\n * {toolCallId, toolName, input}. Normalize both file-read and streaming paths.\n */\nexport function normalizeToolCalls(msg: AgentMessage): AgentMessage {\n if (msg.role !== \"assistant\") return msg;\n const raw = msg as unknown as { content?: unknown[] };\n if (!Array.isArray(raw.content)) return msg;\n const normalized = raw.content.map((block) => {\n const b = block as Record<string, unknown>;\n if (b.type !== \"toolCall\") return b;\n return {\n type: \"toolCall\",\n toolCallId: b.toolCallId ?? b.id,\n toolName: b.toolName ?? b.name,\n input: b.input ?? b.arguments,\n };\n });\n return { ...(msg as object), content: normalized } as unknown as AgentMessage;\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sessions/route\",\n pathname: \"/api/sessions\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/sessions/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/sessions/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextResponse } from \"next/server\";\nimport { listAllSessions } from \"@/lib/session-reader\";\n\nexport async function GET() {\n try {\n const sessions = await listAllSessions();\n return NextResponse.json({ sessions });\n } catch (error) {\n return NextResponse.json(\n { error: String(error) },\n { status: 500 }\n );\n }\n}\n"],"names":["normalizeToolCalls","msg","role","raw","Array","isArray","content","normalized","map","block","b","type","toolCallId","id","toolName","name","input","arguments","GET","sessions","json","error","String","status"],"mappings":"2pCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAiBA,SAAS,IACP,IAAM,EAAS,QAAQ,GAAG,CAAC,mBAAmB,QAC9C,AAAI,EACF,AAAe,KAAK,CADV,AACN,EAAuB,CAAA,EAAA,EAAA,OAAA,AAAO,IAC9B,EAAO,UAAU,CAAC,MAAc,CAAP,AAAO,EAAA,EAAA,OAAA,AAAO,IAAK,EAAO,KAAK,CAAC,GACtD,EAEF,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAA,AAAO,IAAI,MAAO,QAChC,CAEOU,SAAS,IACd,MAAO,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,IAAe,WAC7B,CASA,IAAI,EAA6C,KACjD,SAAS,IACP,GAAI,EAAa,OAAO,EACxB,EAAc,IAAI,IAClB,IAAM,EAAO,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,IAAe,eACjC,GAAI,CAAC,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,GAAO,OAAO,EAC9B,GAAI,CACF,IAAM,EAAO,KAAK,KAAK,CAAC,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAM,SAG3C,IAAK,GAAM,CAAC,EAAU,EAAa,GAAI,OAAO,OAAO,CAAC,EAAK,SAAS,EAAI,CAAC,GAAI,AAC3E,IAAK,IAAM,KAAS,EAAa,MAAM,EAAI,EAAE,CAAE,AACzC,EAAM,EAAE,EAAI,EAAM,IAAI,EAAE,AAC1B,EAAY,GAAG,CAAC,CAAA,EAAG,EA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,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAW,AAAX,EAAY,kBACf,uBACA,CACJ,EACJ","ignoreList":[2]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},88598,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),R=e.i(74838),x=e.i(10372),v=e.i(93695);e.i(52474);var w=e.i(220);async function g(){return new Response("Not used",{status:410})}e.s(["POST",0,g],26447);var f=e.i(26447);let m=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/new/route",pathname:"/api/sessions/new",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/sessions/new/route.ts",nextConfigOutput:"",userland:f}),{workAsyncStorage:E,workUnitAsyncStorage:C,serverHooks:y}=m;async function A(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),m.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/sessions/new/route";g=g.replace(/\/index$/,"")||"/";let f=await m.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:E,params:C,nextConfig:y,parsedUrl:A,isDraftMode:b,prerenderManifest:N,routerServerContext:T,isOnDemandRevalidate:P,revalidateOnlyGenerated:q,resolvedPathname:S,clientReferenceManifest:O,serverActionsManifest:_}=f,k=(0,o.normalizeAppPath)(g),H=!!(N.dynamicRoutes[k]||N.routes[S]),I=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,A,!1):t.end("This page could not be found"),null);if(H&&!b){let e=!!N.routes[S],t=N.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(y.adapterPath)return await I();throw new v.NoFallbackError}}let U=null;!H||m.isDev||b||(U="/index"===(U=S)?"/":U);let j=!0===m.isDev||!H,M=H&&!j;_&&O&&(0,i.setManifestsSingleton)({page:g,clientReferenceManifest:O,serverActionsManifest:_});let D=e.method||"GET",$=(0,s.getTracer)(),F=$.getActiveScopeSpan(),K=!!(null==T?void 0:T.isWrappedByNextServer),B=!!(0,n.getRequestMeta)(e,"minimalMode"),L=(0,n.getRequestMeta)(e,"incrementalCache")||await m.getIncrementalCache(e,y,N,B);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let G={params:C,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:j,incrementalCache:L,cacheLifeProfiles:y.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>m.onRequestError(e,t,a,n,T)},sharedContext:{buildId:E}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t));try{let n,i=async e=>m.handle(X,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${D} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${D} ${g}`)}),o=async n=>{var s,o;let l=async({previousCacheEntry:r})=>{try{if(!B&&P&&q&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=G.renderOpts.collectedTags;if(!H)return await (0,c.sendResponse)(V,W,s,G.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,a=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:w.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await m.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:P})},!1,T),t}},d=await m.handleResponse({req:e,nextConfig:y,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:P,revalidateOnlyGenerated:q,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:B});if(!H)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==w.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",P?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return B&&H||u.delete(x.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,R.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(V,W,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&F?await o(F):(n=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${D} ${g}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},o),void 0,!K))}catch(t){if(t instanceof v.NoFallbackError||await m.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:P})},!1,T),H)throw t;return await (0,c.sendResponse)(V,W,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:C})},"routeModule",0,m,"serverHooks",0,y,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,C],88598)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__0a-p9wd._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../app/api/sessions/new/route.ts"],"sourcesContent":["import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sessions/new/route\",\n pathname: \"/api/sessions/new\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/app/api/sessions/new/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/sessions/new/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","// This route is no longer used — new sessions are created fully client-side.\n// Kept as a no-op for reference.\nexport async function POST() {\n return new Response(\"Not used\", { status: 410 });\n}\n"],"names":["POST","Response","status"],"mappings":"g0BAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CA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C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,EACA,sBACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[0]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module.exports=[18622,(e,t,n)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},70406,(e,t,n)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,n)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,n)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,n)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,n)=>{t.exports=e.x("os",()=>require("os"))},9890,e=>{"use strict";var t=e.i(22734),n=e.i(14747),r=e.i(46786);function i(){let e=process.env.PI_CODING_AGENT_DIR;return e?"~"===e?(0,r.homedir)():e.startsWith("~/")?(0,r.homedir)()+e.slice(1):e:(0,n.join)((0,r.homedir)(),".pi","agent")}function s(){return(0,n.join)(i(),"sessions")}let a=null;function o(){if(a)return a;a=new Map;let e=(0,n.join)(i(),"models.json");if(!(0,t.existsSync)(e))return a;try{let n=JSON.parse((0,t.readFileSync)(e,"utf8"));for(let[e,t]of Object.entries(n.providers??{}))for(let n of t.models??[])n.id&&n.name&&a.set(`${e}:${n.id}`,{id:n.id,name:n.name,provider:e})}catch{}return a}function l(e){if(!(0,t.existsSync)(e))return[];let n=(0,t.readFileSync)(e,"utf8"),r=[];for(let e of n.trim().split("\n"))if(e.trim())try{r.push(JSON.parse(e))}catch{}return r}function d(e){try{let n,r,i=l(e);if(0===i.length)return null;let s=i[0];if("session"!==s.type)return null;let a=(0,t.statSync)(e),o=s.id,d=s.cwd??"",u=s.timestamp,c=s.parentSession?(r=(s.parentSession.replace(/\\/g,"/").split("/").pop()??"").match(/_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i),r?.[1]):void 0,p=0,h="";for(let e of i){if("session_info"===e.type&&e.name&&(n=e.name.trim()),"message"!==e.type)continue;p++;let t=e.message;if("user"!==t.role&&"assistant"!==t.role)continue;let r=function(e){let t=e.content;return"string"==typeof t?t:Array.isArray(t)?t.filter(e=>"text"===e.type).map(e=>e.text).join(" "):""}(t);h||"user"!==t.role||(h=r)}return{path:e,id:o,cwd:d,name:n,created:u,modified:a.mtime.toISOString(),messageCount:p,firstMessage:h||"(no messages)",parentSessionId:c}}catch{return null}}async function u(){let e=s(),r=[];if(!(0,t.existsSync)(e))return r;try{for(let i of(0,t.readdirSync)(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(t=>(0,n.join)(e,t.name)))try{for(let e of(0,t.readdirSync)(i).filter(e=>e.endsWith(".jsonl")).map(e=>(0,n.join)(i,e))){let t=d(e);t&&r.push(t)}}catch{}}catch{}return r.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime()),r}function c(){return globalThis.__piSessionPathCache||(globalThis.__piSessionPathCache=new Map),globalThis.__piSessionPathCache}e.s(["buildSessionContext",0,function(e,t){let n,r=new Map;for(let t of e)r.set(t.id,t);if(null===t||(t&&(n=r.get(t)),n||(n=e[e.length-1]),!n))return{messages:[],entryIds:[],thinkingLevel:"off",model:null};let i=[],s=n;for(;s;)i.unshift(s),s=s.parentId?r.get(s.parentId):void 0;let a="off",o=null,l=null;for(let e of i)if("thinking_level_change"===e.type)a=e.thinkingLevel;else if("model_change"===e.type)o={provider:e.provider,modelId:e.modelId};else if("message"===e.type&&"assistant"===e.message.role){let t=e.message;o={provider:t.provider,modelId:t.model}}else"compaction"===e.type&&(l=e);let d=[],u=[],c=e=>{"message"===e.type&&(d.push(function(e){if("assistant"!==e.role||!Array.isArray(e.content))return e;let t=e.content.map(e=>"toolCall"!==e.type?e:{type:"toolCall",toolCallId:e.toolCallId??e.id,toolName:e.toolName??e.name,input:e.input??e.arguments});return{...e,content:t}}(e.message)),u.push(e.id))};if(l){let e={role:"user",content:`*The conversation history before this point was compacted into the following summary:*
|
|
2
|
+
|
|
3
|
+
${l.summary}`,timestamp:new Date(l.timestamp).getTime()};d.push(e),u.push(l.id);let t=i.findIndex(e=>"compaction"===e.type&&e.id===l.id),n=i.findIndex((e,n)=>n<t&&e.id===l.firstKeptEntryId),r=n>=0?n:t;for(let e=r;e<t;e++)c(i[e]);for(let e=t+1;e<i.length;e++)c(i[e])}else for(let e of i)c(e);return{messages:d,entryIds:u,thinkingLevel:a,model:o}},"buildSessionInfo",0,d,"buildTree",0,function(e){let t=new Map;for(let n of e)"label"===n.type&&(n.label?t.set(n.targetId,n.label):t.delete(n.targetId));let n=new Map,r=[];for(let r of e)n.set(r.id,{entry:r,children:[],label:t.get(r.id)});for(let t of e){let e=n.get(t.id);if(t.parentId){let i=n.get(t.parentId);i?i.children.push(e):r.push(e)}else r.push(e)}let i=[...r];for(;i.length>0;){let e=i.pop();e.children.sort((e,t)=>new Date(e.entry.timestamp).getTime()-new Date(t.entry.timestamp).getTime()),i.push(...e.children)}return r},"getDefaultModel",0,function(){let e=(0,n.join)(i(),"settings.json");if(!(0,t.existsSync)(e))return null;try{let n=JSON.parse((0,t.readFileSync)(e,"utf8"));if(!n.defaultProvider)return null;if(n.defaultModel)return{provider:n.defaultProvider,modelId:n.defaultModel};let r=Array.from(o().values()).find(e=>e.provider===n.defaultProvider);if(r)return{provider:r.provider,modelId:r.id}}catch{}return null},"getLeafId",0,function(e){return 0===e.length?null:e[e.length-1].id},"getModelList",0,function(){return Array.from(o().values())},"getModelNameMap",0,function(){let e=new Map;for(let t of o().values())e.set(t.id,t.name);return e},"getSessionEntries",0,function(e){return l(e).filter(e=>"session"!==e.type)},"invalidateModelCache",0,function(){a=null},"invalidateSessionPathCache",0,function(e){c().delete(e)},"listAllSessions",0,u,"resolveSessionPath",0,function(e){let r=c(),i=r.get(e);if(i&&(0,t.existsSync)(i))return i;let a=s();if(!(0,t.existsSync)(a))return null;try{for(let i of(0,t.readdirSync)(a,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>(0,n.join)(a,e.name)))try{for(let s of(0,t.readdirSync)(i).filter(e=>e.endsWith(".jsonl"))){let a=(0,n.join)(i,s),o=(0,t.readFileSync)(a,"utf8").split("\n")[0];try{let t=JSON.parse(o);if("session"===t.type&&t.id===e)return r.set(e,a),a}catch{}}}catch{}}catch{}return null}],9890)},9072,e=>e.a(async(t,n)=>{try{let t=await e.y("@mariozechner/pi-coding-agent-25ed40b2b9196719");e.n(t),n()}catch(e){n(e)}},!0),91885,e=>{"use strict";e.s(["buildNoToolsSystemPrompt",0,function(e){return`You are a reliable, direct, and practical assistant.
|
|
4
|
+
`}])},77845,e=>e.a(async(t,n)=>{try{var r=e.i(9072),i=e.i(14747),s=e.i(46786),a=e.i(91885),o=t([r]);[r]=o.then?(await o)():o;class u{inner;listeners;unsubscribe;idleTimer;onDestroyCallback;_alive;constructor(e){this.inner=e,this.listeners=[],this.unsubscribe=null,this.idleTimer=null,this.onDestroyCallback=null,this._alive=!0}get sessionId(){return this.inner.sessionId}get sessionFile(){return this.inner.sessionFile??""}isAlive(){return this._alive}start(){this.unsubscribe=this.inner.subscribe(e=>{for(let t of(this.resetIdleTimer(),this.listeners))t(e)}),this.resetIdleTimer()}resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>this.destroy(),6e5)}onEvent(e){return this.listeners.push(e),()=>{let t=this.listeners.indexOf(e);-1!==t&&this.listeners.splice(t,1)}}onDestroy(e){this.onDestroyCallback=e}async send(e){this.resetIdleTimer();let t=e.type;switch(t){case"prompt":return this.inner.prompt(e.message).catch(()=>{}),null;case"abort":return await this.inner.abort(),null;case"get_state":{let e=this.inner.model;return{sessionId:this.inner.sessionId,sessionFile:this.inner.sessionFile??"",isStreaming:this.inner.isStreaming,isCompacting:this.inner.isCompacting??!1,thinkingLevel:this.inner.thinkingLevel??"off",autoCompactionEnabled:this.inner.autoCompactionEnabled??!1,autoRetryEnabled:this.inner.autoRetryEnabled??!1,model:e?{id:e.id,provider:e.provider}:void 0,messageCount:0,pendingMessageCount:0}}case"set_model":{let{provider:t,modelId:n}=e,r=this.inner.modelRegistry,i=r?.find(t,n);if(!i)throw Error(`Model not found: ${t}/${n}`);return await this.inner.setModel(i),i}case"fork":{if((await this.inner.fork(e.entryId)).cancelled)return{cancelled:!0};let t=this.inner.sessionId;return this.destroy(),{cancelled:!1,newSessionId:t}}case"navigate_tree":return{cancelled:(await this.inner.navigateTree(e.targetId,{})).cancelled};case"set_thinking_level":return this.inner.setThinkingLevel(e.level),null;case"compact":{let t=this.inner.settingsManager.getCompactionSettings(),n=t?.keepRecentTokens??2e4,r=this.inner.getContextUsage(),i=r?.tokens??null;if(null!==i&&i<n)throw Error("Conversation too short to compact");return await this.inner.compact(e.customInstructions)}case"set_auto_compaction":return this.inner.setAutoCompactionEnabled(e.enabled),null;case"steer":return await this.inner.steer(e.message),null;case"follow_up":return await this.inner.followUp(e.message),null;case"get_tools":{let e=this.inner.getAllTools(),t=new Set(this.inner.getActiveToolNames());return e.map(e=>({name:e.name,description:e.description,active:t.has(e.name)}))}case"set_tools":return this.inner.setActiveToolsByName(e.toolNames),null;case"abort_compaction":return this.inner.abortCompaction(),null;case"set_auto_retry":return this.inner.setAutoRetryEnabled(e.enabled),null;default:throw Error(`Unsupported command: ${t}`)}}destroy(){this._alive&&(this._alive=!1,this.idleTimer&&clearTimeout(this.idleTimer),this.unsubscribe?.(),this.onDestroyCallback?.())}}function l(){if(!globalThis.__piSessions){globalThis.__piSessions=new Map;let e=()=>globalThis.__piSessions?.forEach(e=>e.destroy());process.once("exit",e),process.once("SIGINT",e),process.once("SIGTERM",e)}return globalThis.__piSessions}async function d(t,n,o,d){let c=l(),p=(globalThis.__piStartLocks||(globalThis.__piStartLocks=new Map),globalThis.__piStartLocks),h=c.get(t);if(h?.isAlive())return{session:h,realSessionId:t};let f=p.get(t);if(f)return f;let m=(async()=>{let t,l,p,h=(t=process.env.PI_CODING_AGENT_DIR)?"~"===t?(0,s.homedir)():t.startsWith("~/")?(0,s.homedir)()+t.slice(1):t:(0,i.join)((0,s.homedir)(),".pi","agent"),{SessionManager:f}=await e.A(44441),m=n?f.open(n,void 0):f.create(o,void 0);if(void 0!==d&&0===d.length){let{DefaultResourceLoader:t}=await e.A(44441),n=(0,a.buildNoToolsSystemPrompt)(o),r=new t({cwd:o,agentDir:h,systemPromptOverride:()=>n});await r.reload(),l=r}if(void 0!==d){let{createReadTool:t,createBashTool:n,createEditTool:r,createWriteTool:i,createGrepTool:s,createFindTool:a,createLsTool:l}=await e.A(44441),u={read:()=>t(o),bash:()=>n(o),edit:()=>r(o),write:()=>i(o),grep:()=>s(o),find:()=>a(o),ls:()=>l(o)};p=d.map(e=>u[e]?.()).filter(Boolean)}let{session:g}=await (0,r.createAgentSession)({cwd:o,agentDir:h,sessionManager:m,...l?{resourceLoader:l}:{},...void 0!==p?{tools:p}:{}}),y=new u(g);y.start();let v=g.sessionId;return y.onDestroy(()=>c.delete(v)),c.set(v,y),{session:y,realSessionId:v}})().finally(()=>p.delete(t));return p.set(t,m),m}e.s(["getRpcSession",0,function(e){return l().get(e)},"startRpcSession",0,d]),n()}catch(e){n(e)}},!1),43172,e=>e.a(async(t,n)=>{try{var r=e.i(9890),i=e.i(77845),s=t([i]);async function a(e,{params:t}){let{id:n}=await t,s=(0,i.getRpcSession)(n);if(!s||!s.isAlive()){let e=(0,r.resolveSessionPath)(n);if(!e)return new Response("Session not found",{status:404});let t=(0,r.buildSessionInfo)(e),a=t?.cwd??process.cwd();try{({session:s}=await (0,i.startRpcSession)(n,e,a))}catch(e){return new Response(`Failed to start agent: ${e}`,{status:500})}}let o=new ReadableStream({start(t){let r=e=>{let n=`data: ${JSON.stringify(e)}
|
|
5
|
+
|
|
6
|
+
`;t.enqueue(new TextEncoder().encode(n))};r({type:"connected",sessionId:n});let i=s.onEvent(e=>{r(e)});e.signal?.addEventListener("abort",()=>{i(),t.close()})}});return new Response(o,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}[i]=s.then?(await s)():s,e.s(["GET",0,a,"dynamic",0,"force-dynamic"]),n()}catch(e){n(e)}},!1),5283,e=>e.a(async(t,n)=>{try{var r=e.i(47909),i=e.i(74017),s=e.i(96250),a=e.i(59756),o=e.i(61916),l=e.i(74677),d=e.i(69741),u=e.i(16795),c=e.i(87718),p=e.i(95169),h=e.i(47587),f=e.i(66012),m=e.i(70101),g=e.i(74838),y=e.i(10372),v=e.i(93695);e.i(52474);var w=e.i(220),b=e.i(43172),x=t([b]);[b]=x.then?(await x)():x;let R=new r.AppRouteRouteModule({definition:{kind:i.RouteKind.APP_ROUTE,page:"/api/agent/[id]/events/route",pathname:"/api/agent/[id]/events",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/agent/[id]/events/route.ts",nextConfigOutput:"",userland:b}),{workAsyncStorage:T,workUnitAsyncStorage:_,serverHooks:C}=R;async function S(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),R.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let r="/api/agent/[id]/events/route";r=r.replace(/\/index$/,"")||"/";let s=await R.prepare(e,t,{srcPage:r,multiZoneDraftMode:!1});if(!s)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:b,params:x,nextConfig:S,parsedUrl:T,isDraftMode:_,prerenderManifest:C,routerServerContext:E,isOnDemandRevalidate:I,revalidateOnlyGenerated:A,resolvedPathname:N,clientReferenceManifest:k,serverActionsManifest:P}=s,M=(0,d.normalizeAppPath)(r),O=!!(C.dynamicRoutes[M]||C.routes[N]),j=async()=>((null==E?void 0:E.render404)?await E.render404(e,t,T,!1):t.end("This page could not be found"),null);if(O&&!_){let e=!!C.routes[N],t=C.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(S.adapterPath)return await j();throw new v.NoFallbackError}}let D=null;!O||R.isDev||_||(D=N,D="/index"===D?"/":D);let q=!0===R.isDev||!O,F=O&&!q;P&&k&&(0,l.setManifestsSingleton)({page:r,clientReferenceManifest:k,serverActionsManifest:P});let U=e.method||"GET",$=(0,o.getTracer)(),H=$.getActiveScopeSpan(),L=!!(null==E?void 0:E.isWrappedByNextServer),G=!!(0,a.getRequestMeta)(e,"minimalMode"),K=(0,a.getRequestMeta)(e,"incrementalCache")||await R.getIncrementalCache(e,S,C,G);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let B={params:x,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!S.experimental.authInterrupts},cacheComponents:!!S.cacheComponents,supportsDynamicResponse:q,incrementalCache:K,cacheLifeProfiles:S.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,n,r,i)=>R.onRequestError(e,t,r,i,E)},sharedContext:{buildId:b}},W=new u.NodeNextRequest(e),J=new u.NodeNextResponse(t),V=c.NextRequestAdapter.fromNodeNextRequest(W,(0,c.signalFromNodeResponse)(t));try{let s,a=async e=>R.handle(V,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let n=$.getRootSpanAttributes();if(!n)return;if(n.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${n.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let i=n.get("next.route");if(i){let t=`${U} ${i}`;e.setAttributes({"next.route":i,"http.route":i,"next.span_name":t}),e.updateName(t),s&&s!==e&&(s.setAttribute("http.route",i),s.updateName(t))}else e.updateName(`${U} ${r}`)}),l=async s=>{var o,l;let d=async({previousCacheEntry:i})=>{try{if(!G&&I&&A&&!i)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let r=await a(s);e.fetchMetrics=B.renderOpts.fetchMetrics;let o=B.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=B.renderOpts.collectedTags;if(!O)return await (0,f.sendResponse)(W,J,r,B.renderOpts.pendingWaitUntil),null;{let e=await r.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(r.headers);l&&(t[y.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let n=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=y.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,i=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=y.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:w.CachedRouteKind.APP_ROUTE,status:r.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:n,expire:i}}}}catch(t){throw(null==i?void 0:i.isStale)&&await R.onRequestError(e,t,{routerKind:"App Router",routePath:r,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:I})},!1,E),t}},u=await R.handleResponse({req:e,nextConfig:S,cacheKey:D,routeKind:i.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:I,revalidateOnlyGenerated:A,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:G});if(!O)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==w.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",I?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),_&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let c=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return G&&O||c.delete(y.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||c.get("Cache-Control")||c.set("Cache-Control",(0,g.getCacheControlHeader)(u.cacheControl)),await (0,f.sendResponse)(W,J,new Response(u.value.body,{headers:c,status:u.value.status||200})),null};L&&H?await l(H):(s=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(p.BaseServerSpan.handleRequest,{spanName:`${U} ${r}`,kind:o.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},l),void 0,!L))}catch(t){if(t instanceof v.NoFallbackError||await R.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:I})},!1,E),O)throw t;return await (0,f.sendResponse)(W,J,new Response(null,{status:500})),null}}e.s(["handler",0,S,"patchFetch",0,function(){return(0,s.patchFetch)({workAsyncStorage:T,workUnitAsyncStorage:_})},"routeModule",0,R,"serverHooks",0,C,"workAsyncStorage",0,T,"workUnitAsyncStorage",0,_]),n()}catch(e){n(e)}},!1),44441,e=>{e.v(e=>Promise.resolve().then(()=>e(9072)))}];
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__0b0kii6._.js.map
|