vibepulse 0.2.2 → 0.3.1-beta
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 -1
- package/.next/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +2 -2
- package/.next/cache/.previewinfo +1 -1
- package/.next/cache/.rscinfo +1 -1
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +8 -0
- package/.next/server/app/_global-error/page.js +1 -1
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/node/events/route.js +2 -2
- package/.next/server/app/api/node/events/route.js.nft.json +1 -1
- package/.next/server/app/api/node/sessions/[id]/delete/route.js +2 -2
- package/.next/server/app/api/node/sessions/[id]/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/node/sessions/[id]/open-editor/route.js +2 -2
- package/.next/server/app/api/node/sessions/[id]/open-editor/route.js.nft.json +1 -1
- package/.next/server/app/api/node/sessions/route.js +6 -4
- package/.next/server/app/api/node/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/nodes/route.js +2 -2
- package/.next/server/app/api/nodes/route.js.nft.json +1 -1
- package/.next/server/app/api/opencode-config/route.js +2 -2
- package/.next/server/app/api/opencode-config/route.js.nft.json +1 -1
- package/.next/server/app/api/opencode-config/status/route.js +2 -2
- package/.next/server/app/api/opencode-config/status/route.js.nft.json +1 -1
- package/.next/server/app/api/opencode-events/route.js +3 -3
- package/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/[id]/apply/route.js +2 -2
- package/.next/server/app/api/profiles/[id]/apply/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/[id]/export/route.js +2 -2
- package/.next/server/app/api/profiles/[id]/export/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/[id]/route.js +2 -2
- package/.next/server/app/api/profiles/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/import/route.js +2 -2
- package/.next/server/app/api/profiles/import/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/route.js +2 -2
- package/.next/server/app/api/profiles/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/archive/route.js +3 -2
- package/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/delete/route.js +4 -3
- package/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/open-editor/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/open-editor/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/restore/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/sessions/[id]/restore/route/build-manifest.json +11 -0
- package/.next/server/app/api/sessions/[id]/restore/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/sessions/[id]/restore/route.js +8 -0
- package/.next/server/app/api/sessions/[id]/restore/route.js.map +5 -0
- package/.next/server/app/api/sessions/[id]/restore/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/restore/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/sessions/[id]/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route.js +5 -3
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +1 -0
- package/.next/server/chunks/[root-of-the-server]__005eb0c5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__005eb0c5._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__09e90d57._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__09e90d57._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__18dd0ce9._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__18dd0ce9._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__19468536._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__19468536._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__1b87ec42._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1b87ec42._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__2b912935._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__2b912935._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__303d3bac._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__303d3bac._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__3fac2b91._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__3fac2b91._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__43440b8d._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__43440b8d._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__438f8bbe._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__438f8bbe._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__4a0bfb55._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__4a0bfb55._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__534c3949._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__534c3949._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__59160266._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__59160266._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__6f812da0._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__6f812da0._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__71aac504._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__71aac504._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__907a8bf2._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__907a8bf2._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__92089220._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__92089220._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__9b7bc2d0._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__9b7bc2d0._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__b2640944._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__b2640944._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__c2267cf1._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__c2267cf1._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__d7f7e6dd._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__6924c09d._.js.map → [root-of-the-server]__d7f7e6dd._.js.map} +1 -1
- package/.next/server/chunks/[root-of-the-server]__d8e61048._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__d8e61048._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__f6d0d488._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__192ed2f4._.js.map → [root-of-the-server]__f6d0d488._.js.map} +1 -1
- package/.next/server/chunks/[root-of-the-server]__fa559e1e._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__fa559e1e._.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_restore_route_actions_af7d6b6c.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_restore_route_actions_af7d6b6c.js.map +1 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js.map +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js.map +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js.map +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +2 -2
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js.map +1 -1
- package/.next/server/chunks/src_lib_opencodeConfig_ts_8e209941._.js +3 -0
- package/.next/server/chunks/src_lib_opencodeConfig_ts_8e209941._.js.map +1 -0
- package/.next/server/chunks/src_lib_session-providers_claudeCode_ts_0f9590ed._.js +3 -0
- package/.next/server/chunks/src_lib_session-providers_claudeCode_ts_0f9590ed._.js.map +1 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__631e12d0._.js → [root-of-the-server]__c91a8380._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__631e12d0._.js.map → [root-of-the-server]__c91a8380._.js.map} +1 -1
- package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
- package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +1 -0
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/routes-manifest.json +8 -0
- package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +2 -2
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/node/events/route.js +2 -2
- package/.next/standalone/.next/server/app/api/node/events/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js +2 -2
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js +2 -2
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/node/sessions/route.js +6 -4
- package/.next/standalone/.next/server/app/api/node/sessions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/nodes/route.js +2 -2
- package/.next/standalone/.next/server/app/api/nodes/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/opencode-config/route.js +2 -2
- package/.next/standalone/.next/server/app/api/opencode-config/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/opencode-config/status/route.js +2 -2
- package/.next/standalone/.next/server/app/api/opencode-config/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/opencode-events/route.js +3 -3
- package/.next/standalone/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/[id]/apply/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/[id]/apply/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/[id]/export/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/[id]/export/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/[id]/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/import/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/import/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js +3 -2
- package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js +4 -3
- package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js +2 -2
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/restore/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/restore/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/restore/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/restore/route.js +8 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/restore/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/restore/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/restore/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/route.js +2 -2
- package/.next/standalone/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/route.js +5 -3
- package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__005eb0c5._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__09e90d57._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__18dd0ce9._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__19468536._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1b87ec42._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__2b912935._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__303d3bac._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__3fac2b91._.js +5 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__43440b8d._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__438f8bbe._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__4a0bfb55._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__534c3949._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__59160266._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__6f812da0._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__71aac504._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__907a8bf2._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__92089220._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__9b7bc2d0._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__b2640944._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__c2267cf1._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__d7f7e6dd._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__d8e61048._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__f6d0d488._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__fa559e1e._.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_restore_route_actions_af7d6b6c.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +2 -2
- package/.next/standalone/.next/server/chunks/src_lib_opencodeConfig_ts_8e209941._.js +3 -0
- package/.next/standalone/.next/server/chunks/src_lib_session-providers_claudeCode_ts_0f9590ed._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__631e12d0._.js → [root-of-the-server]__c91a8380._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +2 -2
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/9e790b67c80f853c.js +13 -0
- package/.next/standalone/.next/static/chunks/c3dc8cd80979c971.css +3 -0
- package/.next/standalone/AGENTS.md +4 -0
- package/.next/standalone/README.md +54 -5
- package/.next/standalone/check-hsql.mjs +1 -1
- package/.next/standalone/docs/session-status-detection.md +36 -0
- package/.next/standalone/docs/superpowers/specs/2026-04-09-claude-capability-alignment-design.md +39 -0
- package/.next/standalone/eslint.config.mjs +1 -0
- package/.next/standalone/package-lock.json +74 -13
- package/.next/standalone/package.json +2 -2
- package/.next/standalone/src/app/api/node/events/route.ts +3 -3
- package/.next/standalone/src/app/api/node/sessions/[id]/archive/route.test.ts +60 -1
- package/.next/standalone/src/app/api/node/sessions/[id]/archive/route.ts +77 -22
- package/.next/standalone/src/app/api/node/sessions/[id]/delete/route.ts +6 -5
- package/.next/standalone/src/app/api/node/sessions/[id]/open-editor/route.ts +6 -5
- package/.next/standalone/src/app/api/node/sessions/route.test.ts +282 -0
- package/.next/standalone/src/app/api/node/sessions/route.ts +156 -30
- package/.next/standalone/src/app/api/opencode-config/route.test.ts +613 -0
- package/.next/standalone/src/app/api/opencode-config/route.ts +336 -185
- package/.next/standalone/src/app/api/opencode-events/route.test.ts +77 -1
- package/.next/standalone/src/app/api/opencode-events/route.ts +3 -3
- package/.next/standalone/src/app/api/opencode-models/route.test.ts +19 -0
- package/.next/standalone/src/app/api/opencode-models/route.ts +4 -1
- package/.next/standalone/src/app/api/profiles/[id]/apply/route.test.ts +227 -0
- package/.next/standalone/src/app/api/profiles/[id]/apply/route.ts +13 -9
- package/.next/standalone/src/app/api/sessions/[id]/archive/route.test.ts +126 -0
- package/.next/standalone/src/app/api/sessions/[id]/archive/route.ts +47 -12
- package/.next/standalone/src/app/api/sessions/[id]/delete/route.test.ts +140 -0
- package/.next/standalone/src/app/api/sessions/[id]/delete/route.ts +51 -16
- package/.next/standalone/src/app/api/sessions/[id]/open-editor/route.test.ts +74 -0
- package/.next/standalone/src/app/api/sessions/[id]/open-editor/route.ts +22 -2
- package/.next/standalone/src/app/api/sessions/[id]/restore/route.test.ts +186 -0
- package/.next/standalone/src/app/api/sessions/[id]/restore/route.ts +184 -0
- package/.next/standalone/src/app/api/sessions/[id]/route.ts +3 -3
- package/.next/standalone/src/app/api/sessions/route.test.ts +1955 -100
- package/.next/standalone/src/app/api/sessions/route.ts +361 -986
- package/.next/standalone/src/components/KanbanBoard.test.tsx +307 -1
- package/.next/standalone/src/components/KanbanBoard.tsx +106 -19
- package/.next/standalone/src/components/ProjectCard.test.tsx +420 -6
- package/.next/standalone/src/components/ProjectCard.tsx +238 -86
- package/.next/standalone/src/components/SessionCard.test.tsx +259 -8
- package/.next/standalone/src/components/SessionCard.tsx +182 -76
- package/.next/standalone/src/components/opencode-config/AgentConfigForm.test.tsx +141 -1
- package/.next/standalone/src/components/opencode-config/AgentConfigForm.tsx +99 -7
- package/.next/standalone/src/components/opencode-config/GeneralSettingsForm.test.tsx +11 -0
- package/.next/standalone/src/components/opencode-config/GeneralSettingsForm.tsx +41 -2
- package/.next/standalone/src/components/opencode-config/categories/CategoriesManager.tsx +3 -1
- package/.next/standalone/src/components/opencode-config/categories/CategoryConfigForm.test.tsx +106 -8
- package/.next/standalone/src/components/opencode-config/categories/CategoryConfigForm.tsx +82 -5
- package/.next/standalone/src/hooks/useHostSources.test.ts +0 -41
- package/.next/standalone/src/hooks/useOpencodeSync.test.ts +321 -1
- package/.next/standalone/src/hooks/useOpencodeSync.ts +16 -12
- package/.next/standalone/src/lib/claudeSessionOverrides.test.ts +75 -0
- package/.next/standalone/src/lib/claudeSessionOverrides.ts +169 -0
- package/.next/standalone/src/lib/fixtures/opencode-config/oh-my-openagent.v4.jsonc +70 -0
- package/.next/standalone/src/lib/fixtures/opencode-config/oh-my-openagent.v4.secret-like.jsonc +21 -0
- package/.next/standalone/src/lib/fixtures/opencode-config/oh-my-opencode.v3.jsonc +17 -0
- package/.next/standalone/src/lib/opencodeConfig.test.ts +430 -3
- package/.next/standalone/src/lib/opencodeConfig.ts +157 -4
- package/.next/standalone/src/lib/opencodeDiscovery.test.ts +241 -0
- package/.next/standalone/src/lib/opencodeDiscovery.ts +164 -9
- package/.next/standalone/src/lib/profiles/share.test.ts +92 -0
- package/.next/standalone/src/lib/profiles/share.ts +1 -0
- package/.next/standalone/src/lib/profiles/storage.test.ts +77 -1
- package/.next/standalone/src/lib/profiles/storage.ts +10 -9
- package/.next/standalone/src/lib/session-providers/claudeCode.test.ts +2288 -0
- package/.next/standalone/src/lib/session-providers/claudeCode.ts +1083 -0
- package/.next/standalone/src/lib/session-providers/localAggregator.test.ts +322 -0
- package/.next/standalone/src/lib/session-providers/localAggregator.ts +302 -0
- package/.next/standalone/src/lib/session-providers/opencodeProvider.test.ts +170 -0
- package/.next/standalone/src/lib/session-providers/opencodeProvider.ts +721 -0
- package/.next/standalone/src/lib/session-providers/opencodeSdkCompat.ts +92 -0
- package/.next/standalone/src/lib/session-providers/providerIds.test.ts +337 -0
- package/.next/standalone/src/lib/session-providers/providerIds.ts +176 -0
- package/.next/standalone/src/lib/session-providers/types.ts +131 -0
- package/.next/standalone/src/lib/transform.test.ts +253 -0
- package/.next/standalone/src/lib/transform.ts +96 -37
- package/.next/standalone/src/types/index.ts +23 -17
- package/.next/standalone/src/types/opencodeConfig.ts +55 -0
- package/.next/static/chunks/9e790b67c80f853c.js +13 -0
- package/.next/static/chunks/c3dc8cd80979c971.css +3 -0
- package/.next/trace +1 -1
- package/.next/trace-build +1 -1
- package/.next/types/routes.d.ts +2 -1
- package/.next/types/validator.ts +9 -0
- package/README.md +54 -5
- package/package.json +2 -2
- package/.next/server/chunks/[root-of-the-server]__1211da38._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1211da38._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__192ed2f4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__2b526e7a._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__2b526e7a._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__2f981540._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__2f981540._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__3745b314._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__3745b314._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__56690af0._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__56690af0._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__56f5f249._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__56f5f249._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__59175de4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__59175de4._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__64fffc02._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__64fffc02._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__6924c09d._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__6c428a24._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__6c428a24._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__73a00b88._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__73a00b88._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__7e757f50._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__7e757f50._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__b796d06c._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__b796d06c._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__db285678._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__db285678._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__e00a9200._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__e00a9200._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__edbc8d9e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__edbc8d9e._.js.map +0 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1211da38._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__192ed2f4._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__2b526e7a._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__2f981540._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__3745b314._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__56690af0._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__56f5f249._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__59175de4._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__64fffc02._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__6924c09d._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__6c428a24._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__73a00b88._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__7e757f50._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__b796d06c._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__db285678._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e00a9200._.js +0 -5
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__edbc8d9e._.js +0 -3
- package/.next/standalone/.next/static/chunks/65d5354ba0add961.js +0 -13
- package/.next/standalone/.next/static/chunks/f42202943f6742e5.css +0 -3
- package/.next/static/chunks/65d5354ba0add961.js +0 -13
- package/.next/static/chunks/f42202943f6742e5.css +0 -3
- /package/.next/standalone/.next/static/{5kq9DtuBFVxu4jsgmL5Q- → 0WaQ6UjiNBgvh531pJVh0}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{5kq9DtuBFVxu4jsgmL5Q- → 0WaQ6UjiNBgvh531pJVh0}/_clientMiddlewareManifest.json +0 -0
- /package/.next/standalone/.next/static/{5kq9DtuBFVxu4jsgmL5Q- → 0WaQ6UjiNBgvh531pJVh0}/_ssgManifest.js +0 -0
- /package/.next/static/{5kq9DtuBFVxu4jsgmL5Q- → 0WaQ6UjiNBgvh531pJVh0}/_buildManifest.js +0 -0
- /package/.next/static/{5kq9DtuBFVxu4jsgmL5Q- → 0WaQ6UjiNBgvh531pJVh0}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{5kq9DtuBFVxu4jsgmL5Q- → 0WaQ6UjiNBgvh531pJVh0}/_ssgManifest.js +0 -0
package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module.exports=[46418,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),a=e.i(61916),
|
|
1
|
+
module.exports=[46418,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),a=e.i(61916),s=e.i(74677),l=e.i(69741),i=e.i(16795),d=e.i(87718),c=e.i(95169),u=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),m=e.i(10372),v=e.i(93695);e.i(52474);var y=e.i(220),E=e.i(99686),R=e.i(68817),g=e.i(82414),w=e.i(81951),b=e.i(84044);function C(e){return"object"==typeof e&&null!==e}function O(e){return e instanceof Error&&"AbortError"===e.name||!!C(e)&&("AbortError"===e.name||20===e.code)}function S(e){if(e instanceof Error)return e.message;if("string"==typeof e)return e;try{return JSON.stringify(e)}catch{return String(e)}}function P(e){if(!C(e)||"node"!==e.role||e.protocolVersion!==R.NODE_PROTOCOL_VERSION)return null;let t=e.source;return C(t)&&"local"===t.hostId&&"Local"===t.hostLabel&&"local"===t.hostKind&&"event"in e?{event:e.event}:null}async function T(e,t,r){let n=r??new AbortController,o=(0,b.createVibePulseOpencodeClient)(`http://localhost:${e}`),a=null,s=new Promise((r,o)=>{a=setTimeout(()=>{n.abort(),o(Error(`OpenCode event stream preflight timed out for port ${e} after ${t}ms`))},t)});try{let t=await Promise.race([(0,b.streamOpencodeGlobalEvents)(o,n.signal),s]);return{key:`local:${e}`,label:`OpenCode port ${e}`,stream:t.stream,controller:n}}finally{a&&clearTimeout(a)}}async function x(e){try{let t=await e.json();if(C(t)&&"string"==typeof t.reason&&t.reason.trim())return t.reason}catch{}return`node_request_failed_${e.status}`}function A(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")}function N(e){let t=A(e).split("\n").filter(e=>e.startsWith("data:")).map(e=>e.slice(5).trimStart());return t.length>0?t.join("\n"):null}async function*I(e,t,r){let n=e.getReader(),o=new TextDecoder,a="";try{for(;;){let{done:e,value:s}=await n.read();if(e)break;let l=(a+=A(o.decode(s,{stream:!0}))).indexOf("\n\n");for(;-1!==l;){let e=a.slice(0,l);a=a.slice(l+2);let n=N(e);if(n)try{let e=JSON.parse(n),o=P(e);o?yield{source:t,event:o.event}:console.warn("Ignoring malformed remote node SSE event from",r,e)}catch(e){console.warn("Failed to parse remote node SSE event from",r,e)}l=a.indexOf("\n\n")}}a+=A(o.decode());let e=N(a);if(e)try{let r=JSON.parse(e),n=P(r);n&&(yield{source:t,event:n.event})}catch(e){console.warn("Failed to parse trailing remote node SSE event from",r,e)}}finally{try{await n.cancel()}catch{}n.releaseLock()}}async function _(e,t,r){let n=r??new AbortController,o=`${e.baseUrl}/api/node/events`,a=`node ${e.nodeId}`,s=null,l=new Promise((r,o)=>{s=setTimeout(()=>{n.abort(),o(Error(`Remote node event stream preflight timed out for ${e.nodeId} after ${t}ms`))},t)});try{let t=await Promise.race([fetch(o,{method:"GET",headers:(0,R.createNodeRequestHeaders)(e.token),signal:n.signal}),l]);if(!t.ok)throw Error(`Remote node event stream request failed for ${e.nodeId}: ${await x(t)}`);if(!t.body)throw Error(`Remote node event stream missing response body for ${e.nodeId}`);return{key:`remote:${e.nodeId}`,label:a,stream:I(t.body,{hostId:e.nodeId,hostLabel:e.nodeLabel,hostKind:"remote",hostBaseUrl:e.baseUrl},a),controller:n}}finally{s&&clearTimeout(s)}}function k(e){return e?Response.json({error:"OpenCode discovery timed out",hint:"Host process discovery exceeded timeout. Retry shortly, or increase OPENCODE_DISCOVERY_TIMEOUT_MS."},{status:503}):Response.json({error:"OpenCode server not found",hint:"Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports)."},{status:503})}async function $(e){let t,r=new TextEncoder,{ports:n,timedOut:o}=(0,E.discoverOpencodePortsWithMeta)(),a="node"===process.env[w.RUNTIME_ROLE_ENV_VAR]?[]:await (0,g.listNodeRecords)(),s=Number.isFinite(t=Number(process.env.OPENCODE_EVENTS_PREFLIGHT_TIMEOUT_MS))&&t>0?t:2500,l=[...n.map(e=>({key:`local:${e}`,label:`OpenCode port ${e}`,connect:t=>T(e,s,t)})),...a.filter(e=>e.enabled).map(e=>({key:`remote:${e.nodeId}`,label:`node ${e.nodeId}`,connect:t=>_(e,s,t)}))];if(0===l.length)return k(o);try{let t=new Map,s=l.map(e=>{let r=new AbortController;return t.set(e.key,r),e.connect(r)}),i=await Promise.any(s).catch(async()=>{for(let e of(await Promise.allSettled(s)))"rejected"===e.status&&console.warn("Failed to connect to event source during preflight:",S(e.reason));return null});if(!i){if(0===n.length&&0===a.filter(e=>e.enabled).length)return k(o);return Response.json({error:"Failed to connect to OpenCode event streams",hint:"Detected local and/or remote node event sources, but every streaming handshake failed. Ensure the hub can reach each source and retry."},{status:503})}for(let[e,r]of t.entries())e!==i.key&&r.abort();let d=null,c=new ReadableStream({async start(t){let n=!1,o=new Set([i.controller]),a=new Set,s=e=>{try{return t.enqueue(r.encode(`data: ${JSON.stringify(e)}
|
|
2
2
|
|
|
3
|
-
`)),!0}catch{return!1}},c=()=>{try{t.close()}catch{}},u=()=>{d?d():(n=!0,c())};d=()=>{for(let e of(n=!0,o))e.abort();Promise.allSettled(Array.from(a).map(e=>e.return?.())),e.signal.removeEventListener("abort",u),c()},e.signal.addEventListener("abort",u);let p=async t=>{let r=t.stream[Symbol.asyncIterator]();a.add(r);try{for(;!n;){let e=await r.next();if(e.done||n||!
|
|
3
|
+
`)),!0}catch{return!1}},c=()=>{try{t.close()}catch{}},u=()=>{d?d():(n=!0,c())};d=()=>{for(let e of(n=!0,o))e.abort();Promise.allSettled(Array.from(a).map(e=>e.return?.())),e.signal.removeEventListener("abort",u),c()},e.signal.addEventListener("abort",u);let p=async t=>{let r=t.stream[Symbol.asyncIterator]();a.add(r);try{for(;!n;){let e=await r.next();if(e.done||n||!s(e.value))break}}catch(r){n||e.signal.aborted||O(r)||console.warn("Event stream failed for source:",t.label,S(r))}finally{a.delete(r),o.delete(t.controller)}};try{let t=p(i),r=l.filter(e=>e.key!==i.key).map(async t=>{if(!n)try{let e=await t.connect();if(o.add(e.controller),n){e.controller.abort(),o.delete(e.controller);return}await p(e)}catch(r){n||e.signal.aborted||O(r)||console.warn("Failed to connect to secondary event source:",t.label,S(r))}});await Promise.allSettled([t,...r])}catch(e){console.error("Error in event stream:",e)}finally{n=!0,d=null,e.signal.removeEventListener("abort",u),c()}},cancel(){d&&d()}});return new Response(c,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}catch(e){return console.error("Error creating event stream:",e),Response.json({error:"Failed to create event stream",details:e instanceof Error?e.message:String(e),hint:"Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports)."},{status:500})}}e.s(["GET",()=>$,"dynamic",0,"force-dynamic"],94866);var U=e.i(94866);let M=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/opencode-events/route",pathname:"/api/opencode-events",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/opencode-events/route.ts",nextConfigOutput:"standalone",userland:U}),{workAsyncStorage:H,workUnitAsyncStorage:D,serverHooks:q}=M;function F(){return(0,n.patchFetch)({workAsyncStorage:H,workUnitAsyncStorage:D})}async function L(e,t,n){M.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let E="/api/opencode-events/route";E=E.replace(/\/index$/,"")||"/";let R=await M.prepare(e,t,{srcPage:E,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:g,params:w,nextConfig:b,parsedUrl:C,isDraftMode:O,prerenderManifest:S,routerServerContext:P,isOnDemandRevalidate:T,revalidateOnlyGenerated:x,resolvedPathname:A,clientReferenceManifest:N,serverActionsManifest:I}=R,_=(0,l.normalizeAppPath)(E),k=!!(S.dynamicRoutes[_]||S.routes[A]),$=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,C,!1):t.end("This page could not be found"),null);if(k&&!O){let e=!!S.routes[A],t=S.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(b.experimental.adapterPath)return await $();throw new v.NoFallbackError}}let U=null;!k||M.isDev||O||(U="/index"===(U=A)?"/":U);let H=!0===M.isDev||!k,D=k&&!H;I&&N&&(0,s.setManifestsSingleton)({page:E,clientReferenceManifest:N,serverActionsManifest:I});let q=e.method||"GET",F=(0,a.getTracer)(),L=F.getActiveScopeSpan(),j={params:w,prerenderManifest:S,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts},cacheComponents:!!b.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,o.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:b.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,o)=>M.onRequestError(e,t,n,o,P)},sharedContext:{buildId:g}},V=new i.NodeNextRequest(e),K=new i.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t));try{let s=async e=>M.handle(G,j).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")!==c.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=`${q} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${q} ${E}`)}),l=!!(0,o.getRequestMeta)(e,"minimalMode"),i=async o=>{var a,i;let d=async({previousCacheEntry:r})=>{try{if(!l&&T&&x&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await s(o);e.fetchMetrics=j.renderOpts.fetchMetrics;let i=j.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let d=j.renderOpts.collectedTags;if(!k)return await (0,p.sendResponse)(V,K,a,j.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);d&&(t[m.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==j.renderOpts.collectedRevalidate&&!(j.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&j.renderOpts.collectedRevalidate,n=void 0===j.renderOpts.collectedExpire||j.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:j.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 M.onRequestError(e,t,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,P),t}},c=await M.handleResponse({req:e,nextConfig:b,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:S,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:x,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:l});if(!k)return null;if((null==c||null==(a=c.value)?void 0:a.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==c||null==(i=c.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});l||t.setHeader("x-nextjs-cache",T?"REVALIDATED":c.isMiss?"MISS":c.isStale?"STALE":"HIT"),O&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let v=(0,f.fromNodeOutgoingHttpHeaders)(c.value.headers);return l&&k||v.delete(m.NEXT_CACHE_TAGS_HEADER),!c.cacheControl||t.getHeader("Cache-Control")||v.get("Cache-Control")||v.set("Cache-Control",(0,h.getCacheControlHeader)(c.cacheControl)),await (0,p.sendResponse)(V,K,new Response(c.value.body,{headers:v,status:c.value.status||200})),null};L?await i(L):await F.withPropagatedContext(e.headers,()=>F.trace(c.BaseServerSpan.handleRequest,{spanName:`${q} ${E}`,kind:a.SpanKind.SERVER,attributes:{"http.method":q,"http.target":e.url}},i))}catch(t){if(t instanceof v.NoFallbackError||await M.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,P),k)throw t;return await (0,p.sendResponse)(V,K,new Response(null,{status:500})),null}}e.s(["handler",()=>L,"patchFetch",()=>F,"routeModule",()=>M,"serverHooks",()=>q,"workAsyncStorage",()=>H,"workUnitAsyncStorage",()=>D],46418)}];
|
|
4
4
|
|
|
5
5
|
//# sourceMappingURL=node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js.map
|
package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/app/api/opencode-events/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { createOpencodeClient } from '@opencode-ai/sdk';\nimport { discoverOpencodePortsWithMeta } from '@/lib/opencodeDiscovery';\nimport { NODE_PROTOCOL_VERSION, createNodeRequestHeaders } from '@/lib/nodeProtocol';\nimport { listNodeRecords, type StoredNodeRecord } from '@/lib/nodeRegistry';\nimport { RUNTIME_ROLE_ENV_VAR } from '@/lib/runtimeMode';\n\nconst DEFAULT_EVENTS_PREFLIGHT_TIMEOUT_MS = 2500;\n\ntype ConnectedStream = {\n key: string;\n label: string;\n stream: AsyncIterable<unknown>;\n controller: AbortController;\n};\n\ntype StreamSourceSpec = {\n key: string;\n label: string;\n connect: (controller?: AbortController) => Promise<ConnectedStream>;\n};\n\ntype RemoteEventSource = {\n hostId: string;\n hostLabel: string;\n hostKind: 'remote';\n hostBaseUrl: string;\n};\n\nfunction getPreflightTimeoutMs(): number {\n const parsedTimeout = Number(process.env.OPENCODE_EVENTS_PREFLIGHT_TIMEOUT_MS);\n return Number.isFinite(parsedTimeout) && parsedTimeout > 0\n ? parsedTimeout\n : DEFAULT_EVENTS_PREFLIGHT_TIMEOUT_MS;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction isAbortLikeError(error: unknown): boolean {\n if (error instanceof Error && error.name === 'AbortError') {\n return true;\n }\n\n if (!isRecord(error)) {\n return false;\n }\n\n return error['name'] === 'AbortError' || error['code'] === 20;\n}\n\nfunction formatErrorForLog(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n if (typeof error === 'string') {\n return error;\n }\n\n try {\n return JSON.stringify(error);\n } catch {\n return String(error);\n }\n}\n\nfunction toRemoteEventSource(nodeRecord: StoredNodeRecord): RemoteEventSource {\n return {\n hostId: nodeRecord.nodeId,\n hostLabel: nodeRecord.nodeLabel,\n hostKind: 'remote',\n hostBaseUrl: nodeRecord.baseUrl,\n };\n}\n\nfunction parseRemoteNodeEventEnvelope(payload: unknown): { event: unknown } | null {\n if (!isRecord(payload)) {\n return null;\n }\n\n if (payload['role'] !== 'node' || payload['protocolVersion'] !== NODE_PROTOCOL_VERSION) {\n return null;\n }\n\n const source = payload['source'];\n if (\n !isRecord(source) ||\n source['hostId'] !== 'local' ||\n source['hostLabel'] !== 'Local' ||\n source['hostKind'] !== 'local'\n ) {\n return null;\n }\n\n if (!('event' in payload)) {\n return null;\n }\n\n return { event: payload['event'] };\n}\n\nasync function connectLocalEventStreamWithTimeout(\n port: number,\n timeoutMs: number,\n controller?: AbortController\n): Promise<ConnectedStream> {\n const connectionController = controller ?? new AbortController();\n const client = createOpencodeClient({ baseUrl: `http://localhost:${port}` });\n\n let timerId: ReturnType<typeof setTimeout> | null = null;\n const timeoutPromise = new Promise<never>((_, reject) => {\n timerId = setTimeout(() => {\n connectionController.abort();\n reject(new Error(`OpenCode event stream preflight timed out for port ${port} after ${timeoutMs}ms`));\n }, timeoutMs);\n });\n\n try {\n const connection = await Promise.race([\n client.global.event({ signal: connectionController.signal }),\n timeoutPromise,\n ]);\n\n return {\n key: `local:${port}`,\n label: `OpenCode port ${port}`,\n stream: connection.stream as AsyncIterable<unknown>,\n controller: connectionController,\n };\n } finally {\n if (timerId) {\n clearTimeout(timerId);\n }\n }\n}\n\nasync function readNodeFailureReason(response: Response): Promise<string> {\n try {\n const body = await response.json();\n if (isRecord(body) && typeof body.reason === 'string' && body.reason.trim()) {\n return body.reason;\n }\n } catch {\n }\n\n return `node_request_failed_${response.status}`;\n}\n\nfunction normalizeSseChunk(chunk: string): string {\n return chunk.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n}\n\nfunction readSseDataBlock(block: string): string | null {\n const dataLines = normalizeSseChunk(block)\n .split('\\n')\n .filter((line) => line.startsWith('data:'))\n .map((line) => line.slice(5).trimStart());\n\n return dataLines.length > 0 ? dataLines.join('\\n') : null;\n}\n\nasync function* streamRemoteNodeEvents(\n body: ReadableStream<Uint8Array>,\n source: RemoteEventSource,\n label: string\n): AsyncIterable<unknown> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += normalizeSseChunk(decoder.decode(value, { stream: true }));\n\n let boundaryIndex = buffer.indexOf('\\n\\n');\n while (boundaryIndex !== -1) {\n const block = buffer.slice(0, boundaryIndex);\n buffer = buffer.slice(boundaryIndex + 2);\n\n const data = readSseDataBlock(block);\n if (data) {\n try {\n const payload = JSON.parse(data) as unknown;\n const envelope = parseRemoteNodeEventEnvelope(payload);\n if (!envelope) {\n console.warn('Ignoring malformed remote node SSE event from', label, payload);\n } else {\n yield {\n source,\n event: envelope.event,\n };\n }\n } catch (error) {\n console.warn('Failed to parse remote node SSE event from', label, error);\n }\n }\n\n boundaryIndex = buffer.indexOf('\\n\\n');\n }\n }\n\n buffer += normalizeSseChunk(decoder.decode());\n const data = readSseDataBlock(buffer);\n if (data) {\n try {\n const payload = JSON.parse(data) as unknown;\n const envelope = parseRemoteNodeEventEnvelope(payload);\n if (envelope) {\n yield {\n source,\n event: envelope.event,\n };\n }\n } catch (error) {\n console.warn('Failed to parse trailing remote node SSE event from', label, error);\n }\n }\n } finally {\n try {\n await reader.cancel();\n } catch {\n }\n reader.releaseLock();\n }\n}\n\nasync function connectRemoteNodeEventStreamWithTimeout(\n nodeRecord: StoredNodeRecord,\n timeoutMs: number,\n controller?: AbortController\n): Promise<ConnectedStream> {\n const connectionController = controller ?? new AbortController();\n const endpoint = `${nodeRecord.baseUrl}/api/node/events`;\n const label = `node ${nodeRecord.nodeId}`;\n\n let timerId: ReturnType<typeof setTimeout> | null = null;\n const timeoutPromise = new Promise<never>((_, reject) => {\n timerId = setTimeout(() => {\n connectionController.abort();\n reject(new Error(`Remote node event stream preflight timed out for ${nodeRecord.nodeId} after ${timeoutMs}ms`));\n }, timeoutMs);\n });\n\n try {\n const response = await Promise.race([\n fetch(endpoint, {\n method: 'GET',\n headers: createNodeRequestHeaders(nodeRecord.token),\n signal: connectionController.signal,\n }),\n timeoutPromise,\n ]);\n\n if (!response.ok) {\n throw new Error(`Remote node event stream request failed for ${nodeRecord.nodeId}: ${await readNodeFailureReason(response)}`);\n }\n\n if (!response.body) {\n throw new Error(`Remote node event stream missing response body for ${nodeRecord.nodeId}`);\n }\n\n return {\n key: `remote:${nodeRecord.nodeId}`,\n label,\n stream: streamRemoteNodeEvents(response.body, toRemoteEventSource(nodeRecord), label),\n controller: connectionController,\n };\n } finally {\n if (timerId) {\n clearTimeout(timerId);\n }\n }\n}\n\nfunction createLocalUnavailableResponse(timedOut: boolean): Response {\n if (timedOut) {\n return Response.json(\n {\n error: 'OpenCode discovery timed out',\n hint: 'Host process discovery exceeded timeout. Retry shortly, or increase OPENCODE_DISCOVERY_TIMEOUT_MS.',\n },\n { status: 503 }\n );\n }\n\n return Response.json(\n {\n error: 'OpenCode server not found',\n hint: 'Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports).',\n },\n { status: 503 }\n );\n}\n\nfunction createAllSourcesUnavailableResponse(): Response {\n return Response.json(\n {\n error: 'Failed to connect to OpenCode event streams',\n hint: 'Detected local and/or remote node event sources, but every streaming handshake failed. Ensure the hub can reach each source and retry.',\n },\n { status: 503 }\n );\n}\n\nfunction buildStreamSourceSpecs(ports: number[], nodes: StoredNodeRecord[], timeoutMs: number): StreamSourceSpec[] {\n const localSpecs = ports.map((port) => ({\n key: `local:${port}`,\n label: `OpenCode port ${port}`,\n connect: (controller?: AbortController) => connectLocalEventStreamWithTimeout(port, timeoutMs, controller),\n }));\n\n const remoteSpecs = nodes\n .filter((node) => node.enabled)\n .map((node) => ({\n key: `remote:${node.nodeId}`,\n label: `node ${node.nodeId}`,\n connect: (controller?: AbortController) => connectRemoteNodeEventStreamWithTimeout(node, timeoutMs, controller),\n }));\n\n return [...localSpecs, ...remoteSpecs];\n}\n\nexport const dynamic = 'force-dynamic';\n\nexport async function GET(request: Request) {\n const encoder = new TextEncoder();\n const { ports, timedOut } = discoverOpencodePortsWithMeta();\n const isNodeMode = process.env[RUNTIME_ROLE_ENV_VAR] === 'node';\n const nodeRecords = isNodeMode ? [] : await listNodeRecords();\n const preflightTimeoutMs = getPreflightTimeoutMs();\n const sourceSpecs = buildStreamSourceSpecs(ports, nodeRecords, preflightTimeoutMs);\n\n if (sourceSpecs.length === 0) {\n return createLocalUnavailableResponse(timedOut);\n }\n\n try {\n const preflightControllers = new Map<string, AbortController>();\n const preflightAttempts = sourceSpecs.map((sourceSpec) => {\n const controller = new AbortController();\n preflightControllers.set(sourceSpec.key, controller);\n return sourceSpec.connect(controller);\n });\n\n const firstConnectedStream = await Promise.any(preflightAttempts).catch(async () => {\n const settled = await Promise.allSettled(preflightAttempts);\n for (const result of settled) {\n if (result.status === 'rejected') {\n console.warn('Failed to connect to event source during preflight:', formatErrorForLog(result.reason));\n }\n }\n return null;\n });\n\n if (!firstConnectedStream) {\n if (ports.length === 0 && nodeRecords.filter((node) => node.enabled).length === 0) {\n return createLocalUnavailableResponse(timedOut);\n }\n\n return createAllSourcesUnavailableResponse();\n }\n\n for (const [key, controller] of preflightControllers.entries()) {\n if (key !== firstConnectedStream.key) {\n controller.abort();\n }\n }\n\n let teardown: (() => void) | null = null;\n const stream = new ReadableStream({\n async start(controller) {\n let isClosed = false;\n const activeControllers = new Set<AbortController>([firstConnectedStream.controller]);\n const activeIterators = new Set<AsyncIterator<unknown>>();\n\n const enqueueEvent = (event: unknown) => {\n try {\n controller.enqueue(encoder.encode(`data: ${JSON.stringify(event)}\\n\\n`));\n return true;\n } catch {\n return false;\n }\n };\n\n const closeControllerSafely = () => {\n try {\n controller.close();\n } catch {\n }\n };\n\n const onAbort = () => {\n if (teardown) {\n teardown();\n return;\n }\n\n isClosed = true;\n closeControllerSafely();\n };\n\n teardown = () => {\n isClosed = true;\n for (const activeController of activeControllers) {\n activeController.abort();\n }\n void Promise.allSettled(Array.from(activeIterators).map((iterator) => iterator.return?.()));\n request.signal.removeEventListener('abort', onAbort);\n closeControllerSafely();\n };\n\n request.signal.addEventListener('abort', onAbort);\n\n const streamEvents = async (connected: ConnectedStream) => {\n const iterator = connected.stream[Symbol.asyncIterator]();\n activeIterators.add(iterator);\n\n try {\n while (!isClosed) {\n const next = await iterator.next();\n if (next.done) {\n break;\n }\n if (isClosed) {\n break;\n }\n if (!enqueueEvent(next.value)) {\n break;\n }\n }\n } catch (error) {\n if (!isClosed && !request.signal.aborted && !isAbortLikeError(error)) {\n console.warn('Event stream failed for source:', connected.label, formatErrorForLog(error));\n }\n } finally {\n activeIterators.delete(iterator);\n activeControllers.delete(connected.controller);\n }\n };\n\n try {\n const primaryTask = streamEvents(firstConnectedStream);\n\n const secondaryTasks = sourceSpecs\n .filter((sourceSpec) => sourceSpec.key !== firstConnectedStream.key)\n .map(async (sourceSpec) => {\n if (isClosed) {\n return;\n }\n\n try {\n const connected = await sourceSpec.connect();\n activeControllers.add(connected.controller);\n if (isClosed) {\n connected.controller.abort();\n activeControllers.delete(connected.controller);\n return;\n }\n await streamEvents(connected);\n } catch (error) {\n if (!isClosed && !request.signal.aborted && !isAbortLikeError(error)) {\n console.warn('Failed to connect to secondary event source:', sourceSpec.label, formatErrorForLog(error));\n }\n }\n });\n\n await Promise.allSettled([primaryTask, ...secondaryTasks]);\n } catch (error) {\n console.error('Error in event stream:', error);\n } finally {\n isClosed = true;\n teardown = null;\n request.signal.removeEventListener('abort', onAbort);\n closeControllerSafely();\n }\n },\n cancel() {\n if (teardown) {\n teardown();\n }\n },\n });\n\n return new Response(stream, {\n headers: {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n },\n });\n } catch (error) {\n console.error('Error creating event stream:', error);\n return Response.json(\n {\n error: 'Failed to create event stream',\n details: error instanceof Error ? error.message : String(error),\n hint: 'Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports).',\n },\n { status: 500 }\n );\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 } 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 = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/opencode-events/route\",\n pathname: \"/api/opencode-events\",\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]/src/app/api/opencode-events/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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/opencode-events/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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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;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AAO,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,EAEA,qCAAqC","ignoreList":[1]}
|
|
1
|
+
{"version":3,"sources":["../../../src/app/api/opencode-events/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { discoverOpencodePortsWithMeta } from '@/lib/opencodeDiscovery';\nimport { NODE_PROTOCOL_VERSION, createNodeRequestHeaders } from '@/lib/nodeProtocol';\nimport { listNodeRecords, type StoredNodeRecord } from '@/lib/nodeRegistry';\nimport { RUNTIME_ROLE_ENV_VAR } from '@/lib/runtimeMode';\nimport { createVibePulseOpencodeClient, streamOpencodeGlobalEvents } from '@/lib/session-providers/opencodeSdkCompat';\n\nconst DEFAULT_EVENTS_PREFLIGHT_TIMEOUT_MS = 2500;\n\ntype ConnectedStream = {\n key: string;\n label: string;\n stream: AsyncIterable<unknown>;\n controller: AbortController;\n};\n\ntype StreamSourceSpec = {\n key: string;\n label: string;\n connect: (controller?: AbortController) => Promise<ConnectedStream>;\n};\n\ntype RemoteEventSource = {\n hostId: string;\n hostLabel: string;\n hostKind: 'remote';\n hostBaseUrl: string;\n};\n\nfunction getPreflightTimeoutMs(): number {\n const parsedTimeout = Number(process.env.OPENCODE_EVENTS_PREFLIGHT_TIMEOUT_MS);\n return Number.isFinite(parsedTimeout) && parsedTimeout > 0\n ? parsedTimeout\n : DEFAULT_EVENTS_PREFLIGHT_TIMEOUT_MS;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction isAbortLikeError(error: unknown): boolean {\n if (error instanceof Error && error.name === 'AbortError') {\n return true;\n }\n\n if (!isRecord(error)) {\n return false;\n }\n\n return error['name'] === 'AbortError' || error['code'] === 20;\n}\n\nfunction formatErrorForLog(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n if (typeof error === 'string') {\n return error;\n }\n\n try {\n return JSON.stringify(error);\n } catch {\n return String(error);\n }\n}\n\nfunction toRemoteEventSource(nodeRecord: StoredNodeRecord): RemoteEventSource {\n return {\n hostId: nodeRecord.nodeId,\n hostLabel: nodeRecord.nodeLabel,\n hostKind: 'remote',\n hostBaseUrl: nodeRecord.baseUrl,\n };\n}\n\nfunction parseRemoteNodeEventEnvelope(payload: unknown): { event: unknown } | null {\n if (!isRecord(payload)) {\n return null;\n }\n\n if (payload['role'] !== 'node' || payload['protocolVersion'] !== NODE_PROTOCOL_VERSION) {\n return null;\n }\n\n const source = payload['source'];\n if (\n !isRecord(source) ||\n source['hostId'] !== 'local' ||\n source['hostLabel'] !== 'Local' ||\n source['hostKind'] !== 'local'\n ) {\n return null;\n }\n\n if (!('event' in payload)) {\n return null;\n }\n\n return { event: payload['event'] };\n}\n\nasync function connectLocalEventStreamWithTimeout(\n port: number,\n timeoutMs: number,\n controller?: AbortController\n): Promise<ConnectedStream> {\n const connectionController = controller ?? new AbortController();\n const client = createVibePulseOpencodeClient(`http://localhost:${port}`);\n\n let timerId: ReturnType<typeof setTimeout> | null = null;\n const timeoutPromise = new Promise<never>((_, reject) => {\n timerId = setTimeout(() => {\n connectionController.abort();\n reject(new Error(`OpenCode event stream preflight timed out for port ${port} after ${timeoutMs}ms`));\n }, timeoutMs);\n });\n\n try {\n const connection = await Promise.race([\n streamOpencodeGlobalEvents(client, connectionController.signal),\n timeoutPromise,\n ]);\n\n return {\n key: `local:${port}`,\n label: `OpenCode port ${port}`,\n stream: connection.stream as AsyncIterable<unknown>,\n controller: connectionController,\n };\n } finally {\n if (timerId) {\n clearTimeout(timerId);\n }\n }\n}\n\nasync function readNodeFailureReason(response: Response): Promise<string> {\n try {\n const body = await response.json();\n if (isRecord(body) && typeof body.reason === 'string' && body.reason.trim()) {\n return body.reason;\n }\n } catch {\n }\n\n return `node_request_failed_${response.status}`;\n}\n\nfunction normalizeSseChunk(chunk: string): string {\n return chunk.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n}\n\nfunction readSseDataBlock(block: string): string | null {\n const dataLines = normalizeSseChunk(block)\n .split('\\n')\n .filter((line) => line.startsWith('data:'))\n .map((line) => line.slice(5).trimStart());\n\n return dataLines.length > 0 ? dataLines.join('\\n') : null;\n}\n\nasync function* streamRemoteNodeEvents(\n body: ReadableStream<Uint8Array>,\n source: RemoteEventSource,\n label: string\n): AsyncIterable<unknown> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n buffer += normalizeSseChunk(decoder.decode(value, { stream: true }));\n\n let boundaryIndex = buffer.indexOf('\\n\\n');\n while (boundaryIndex !== -1) {\n const block = buffer.slice(0, boundaryIndex);\n buffer = buffer.slice(boundaryIndex + 2);\n\n const data = readSseDataBlock(block);\n if (data) {\n try {\n const payload = JSON.parse(data) as unknown;\n const envelope = parseRemoteNodeEventEnvelope(payload);\n if (!envelope) {\n console.warn('Ignoring malformed remote node SSE event from', label, payload);\n } else {\n yield {\n source,\n event: envelope.event,\n };\n }\n } catch (error) {\n console.warn('Failed to parse remote node SSE event from', label, error);\n }\n }\n\n boundaryIndex = buffer.indexOf('\\n\\n');\n }\n }\n\n buffer += normalizeSseChunk(decoder.decode());\n const data = readSseDataBlock(buffer);\n if (data) {\n try {\n const payload = JSON.parse(data) as unknown;\n const envelope = parseRemoteNodeEventEnvelope(payload);\n if (envelope) {\n yield {\n source,\n event: envelope.event,\n };\n }\n } catch (error) {\n console.warn('Failed to parse trailing remote node SSE event from', label, error);\n }\n }\n } finally {\n try {\n await reader.cancel();\n } catch {\n }\n reader.releaseLock();\n }\n}\n\nasync function connectRemoteNodeEventStreamWithTimeout(\n nodeRecord: StoredNodeRecord,\n timeoutMs: number,\n controller?: AbortController\n): Promise<ConnectedStream> {\n const connectionController = controller ?? new AbortController();\n const endpoint = `${nodeRecord.baseUrl}/api/node/events`;\n const label = `node ${nodeRecord.nodeId}`;\n\n let timerId: ReturnType<typeof setTimeout> | null = null;\n const timeoutPromise = new Promise<never>((_, reject) => {\n timerId = setTimeout(() => {\n connectionController.abort();\n reject(new Error(`Remote node event stream preflight timed out for ${nodeRecord.nodeId} after ${timeoutMs}ms`));\n }, timeoutMs);\n });\n\n try {\n const response = await Promise.race([\n fetch(endpoint, {\n method: 'GET',\n headers: createNodeRequestHeaders(nodeRecord.token),\n signal: connectionController.signal,\n }),\n timeoutPromise,\n ]);\n\n if (!response.ok) {\n throw new Error(`Remote node event stream request failed for ${nodeRecord.nodeId}: ${await readNodeFailureReason(response)}`);\n }\n\n if (!response.body) {\n throw new Error(`Remote node event stream missing response body for ${nodeRecord.nodeId}`);\n }\n\n return {\n key: `remote:${nodeRecord.nodeId}`,\n label,\n stream: streamRemoteNodeEvents(response.body, toRemoteEventSource(nodeRecord), label),\n controller: connectionController,\n };\n } finally {\n if (timerId) {\n clearTimeout(timerId);\n }\n }\n}\n\nfunction createLocalUnavailableResponse(timedOut: boolean): Response {\n if (timedOut) {\n return Response.json(\n {\n error: 'OpenCode discovery timed out',\n hint: 'Host process discovery exceeded timeout. Retry shortly, or increase OPENCODE_DISCOVERY_TIMEOUT_MS.',\n },\n { status: 503 }\n );\n }\n\n return Response.json(\n {\n error: 'OpenCode server not found',\n hint: 'Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports).',\n },\n { status: 503 }\n );\n}\n\nfunction createAllSourcesUnavailableResponse(): Response {\n return Response.json(\n {\n error: 'Failed to connect to OpenCode event streams',\n hint: 'Detected local and/or remote node event sources, but every streaming handshake failed. Ensure the hub can reach each source and retry.',\n },\n { status: 503 }\n );\n}\n\nfunction buildStreamSourceSpecs(ports: number[], nodes: StoredNodeRecord[], timeoutMs: number): StreamSourceSpec[] {\n const localSpecs = ports.map((port) => ({\n key: `local:${port}`,\n label: `OpenCode port ${port}`,\n connect: (controller?: AbortController) => connectLocalEventStreamWithTimeout(port, timeoutMs, controller),\n }));\n\n const remoteSpecs = nodes\n .filter((node) => node.enabled)\n .map((node) => ({\n key: `remote:${node.nodeId}`,\n label: `node ${node.nodeId}`,\n connect: (controller?: AbortController) => connectRemoteNodeEventStreamWithTimeout(node, timeoutMs, controller),\n }));\n\n return [...localSpecs, ...remoteSpecs];\n}\n\nexport const dynamic = 'force-dynamic';\n\nexport async function GET(request: Request) {\n const encoder = new TextEncoder();\n const { ports, timedOut } = discoverOpencodePortsWithMeta();\n const isNodeMode = process.env[RUNTIME_ROLE_ENV_VAR] === 'node';\n const nodeRecords = isNodeMode ? [] : await listNodeRecords();\n const preflightTimeoutMs = getPreflightTimeoutMs();\n const sourceSpecs = buildStreamSourceSpecs(ports, nodeRecords, preflightTimeoutMs);\n\n if (sourceSpecs.length === 0) {\n return createLocalUnavailableResponse(timedOut);\n }\n\n try {\n const preflightControllers = new Map<string, AbortController>();\n const preflightAttempts = sourceSpecs.map((sourceSpec) => {\n const controller = new AbortController();\n preflightControllers.set(sourceSpec.key, controller);\n return sourceSpec.connect(controller);\n });\n\n const firstConnectedStream = await Promise.any(preflightAttempts).catch(async () => {\n const settled = await Promise.allSettled(preflightAttempts);\n for (const result of settled) {\n if (result.status === 'rejected') {\n console.warn('Failed to connect to event source during preflight:', formatErrorForLog(result.reason));\n }\n }\n return null;\n });\n\n if (!firstConnectedStream) {\n if (ports.length === 0 && nodeRecords.filter((node) => node.enabled).length === 0) {\n return createLocalUnavailableResponse(timedOut);\n }\n\n return createAllSourcesUnavailableResponse();\n }\n\n for (const [key, controller] of preflightControllers.entries()) {\n if (key !== firstConnectedStream.key) {\n controller.abort();\n }\n }\n\n let teardown: (() => void) | null = null;\n const stream = new ReadableStream({\n async start(controller) {\n let isClosed = false;\n const activeControllers = new Set<AbortController>([firstConnectedStream.controller]);\n const activeIterators = new Set<AsyncIterator<unknown>>();\n\n const enqueueEvent = (event: unknown) => {\n try {\n controller.enqueue(encoder.encode(`data: ${JSON.stringify(event)}\\n\\n`));\n return true;\n } catch {\n return false;\n }\n };\n\n const closeControllerSafely = () => {\n try {\n controller.close();\n } catch {\n }\n };\n\n const onAbort = () => {\n if (teardown) {\n teardown();\n return;\n }\n\n isClosed = true;\n closeControllerSafely();\n };\n\n teardown = () => {\n isClosed = true;\n for (const activeController of activeControllers) {\n activeController.abort();\n }\n void Promise.allSettled(Array.from(activeIterators).map((iterator) => iterator.return?.()));\n request.signal.removeEventListener('abort', onAbort);\n closeControllerSafely();\n };\n\n request.signal.addEventListener('abort', onAbort);\n\n const streamEvents = async (connected: ConnectedStream) => {\n const iterator = connected.stream[Symbol.asyncIterator]();\n activeIterators.add(iterator);\n\n try {\n while (!isClosed) {\n const next = await iterator.next();\n if (next.done) {\n break;\n }\n if (isClosed) {\n break;\n }\n if (!enqueueEvent(next.value)) {\n break;\n }\n }\n } catch (error) {\n if (!isClosed && !request.signal.aborted && !isAbortLikeError(error)) {\n console.warn('Event stream failed for source:', connected.label, formatErrorForLog(error));\n }\n } finally {\n activeIterators.delete(iterator);\n activeControllers.delete(connected.controller);\n }\n };\n\n try {\n const primaryTask = streamEvents(firstConnectedStream);\n\n const secondaryTasks = sourceSpecs\n .filter((sourceSpec) => sourceSpec.key !== firstConnectedStream.key)\n .map(async (sourceSpec) => {\n if (isClosed) {\n return;\n }\n\n try {\n const connected = await sourceSpec.connect();\n activeControllers.add(connected.controller);\n if (isClosed) {\n connected.controller.abort();\n activeControllers.delete(connected.controller);\n return;\n }\n await streamEvents(connected);\n } catch (error) {\n if (!isClosed && !request.signal.aborted && !isAbortLikeError(error)) {\n console.warn('Failed to connect to secondary event source:', sourceSpec.label, formatErrorForLog(error));\n }\n }\n });\n\n await Promise.allSettled([primaryTask, ...secondaryTasks]);\n } catch (error) {\n console.error('Error in event stream:', error);\n } finally {\n isClosed = true;\n teardown = null;\n request.signal.removeEventListener('abort', onAbort);\n closeControllerSafely();\n }\n },\n cancel() {\n if (teardown) {\n teardown();\n }\n },\n });\n\n return new Response(stream, {\n headers: {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n },\n });\n } catch (error) {\n console.error('Error creating event stream:', error);\n return Response.json(\n {\n error: 'Failed to create event stream',\n details: error instanceof Error ? error.message : String(error),\n hint: 'Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports).',\n },\n { status: 500 }\n );\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 } 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 = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/opencode-events/route\",\n pathname: \"/api/opencode-events\",\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]/src/app/api/opencode-events/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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/opencode-events/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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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":[],"mappings":"uCCAA,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,EAAA,EAAA,CAAA,CAAA,OA+BA,SAAS,EAAS,CAAc,EAC9B,MAAwB,UAAjB,OAAO,GAAgC,OAAV,CACtC,CAEA,SAAS,EAAiB,CAAc,SACtC,AAAI,aAAiB,OA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AI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,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,GAEf,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,EAEA,qCAAqC","ignoreList":[1]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[57181,e=>{"use strict";var t=e.i(24868),n=e.i(22734),r=e.i(14747),o=e.i(46786),i=e.i(89196);let c=(0,r.join)((0,o.homedir)(),".config","opencode"),s=(0,r.join)(c,"oh-my-openagent.jsonc"),a=(0,r.join)(c,"oh-my-opencode.jsonc"),u="https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/master/assets/oh-my-openagent.schema.json";function f(e){let t="object"!=typeof e||null===e||Array.isArray(e)?{}:{...e};return{...t,openEditorTargetMode:"hub"===t.openEditorTargetMode?"hub":"remote"}}function l(e=s){return e!==s?e:(0,n.existsSync)(s)?s:(0,n.existsSync)(a)?a:s}function y(e=s){try{return(0,n.existsSync)(l(e))}catch{return!1}}function g(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}async function h(e=s){try{let n=await (0,t.readFile)(l(e),"utf-8");return(0,i.parse)(n,null,!1)}catch{return{}}}async function m(e,o=s){try{let c=(0,r.dirname)(o);(0,n.existsSync)(c)||(0,n.mkdirSync)(c,{recursive:!0});let a=o===s?{...e,$schema:e.$schema||u}:e,f=(0,i.stringify)(a,null,2);await (0,t.writeFile)(o,f,"utf-8")}catch(e){throw Error(`Failed to write config: ${e}`)}}e.s(["OH_MY_OPENAGENT_CONFIG_SCHEMA",0,u,"detectConfig",()=>y,"mergeConfig",()=>function e(t,n){let r={...t};for(let[t,o]of Object.entries(n)){let n=r[t];if(g(n)&&g(o)){r[t]=e(n,o);continue}r[t]=o}return r},"normalizeVibePulseConfig",()=>f,"readConfig",()=>h,"resolveConfigPath",()=>l,"writeConfig",()=>m])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=src_lib_opencodeConfig_ts_8e209941._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/opencodeConfig.ts"],"sourcesContent":["import { copyFile, readFile, rm, writeFile } from 'fs/promises';\nimport { existsSync, mkdirSync } from 'fs';\nimport { dirname, join, parse as parsePath } from 'path';\nimport { homedir } from 'os';\nimport { parse, stringify } from 'comment-json';\nimport type { OhMyOpenAgentConfig, OpenEditorTargetMode, VibePulseConfig } from '@/types/opencodeConfig';\n\nexport const CONFIG_DIR = join(homedir(), '.config', 'opencode');\nexport const CONFIG_PATH = join(CONFIG_DIR, 'oh-my-openagent.jsonc');\nexport const LEGACY_CONFIG_PATH = join(CONFIG_DIR, 'oh-my-opencode.jsonc');\nexport const PROJECT_CONFIG_DIR = '.opencode';\nexport const PROJECT_CONFIG_JSONC = 'oh-my-openagent.jsonc';\nexport const PROJECT_CONFIG_JSON = 'oh-my-openagent.json';\nexport const LEGACY_PROJECT_CONFIG_JSONC = 'oh-my-opencode.jsonc';\nexport const LEGACY_PROJECT_CONFIG_JSON = 'oh-my-opencode.json';\nexport const OH_MY_OPENAGENT_CONFIG_SCHEMA = 'https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/master/assets/oh-my-openagent.schema.json';\nexport const DEFAULT_OPEN_EDITOR_TARGET_MODE: OpenEditorTargetMode = 'remote';\nconst PROJECT_CONFIG_FILENAMES = [\n PROJECT_CONFIG_JSONC,\n PROJECT_CONFIG_JSON,\n LEGACY_PROJECT_CONFIG_JSONC,\n LEGACY_PROJECT_CONFIG_JSON,\n];\n\nexport type OpenCodeConfig = OhMyOpenAgentConfig;\n\nexport interface EffectiveConfigOptions {\n userConfigPath?: string;\n projectStartDir?: string;\n projectConfigPath?: string | null;\n}\n\nexport interface LegacyMigrationOptions {\n legacyPath?: string;\n canonicalPath?: string;\n backupPath?: string;\n now?: () => Date;\n writeCanonicalConfig?: (config: OpenCodeConfig, canonicalPath: string) => Promise<void>;\n}\n\nexport interface LegacyMigrationResult {\n migrated: boolean;\n legacyPath: string;\n canonicalPath: string;\n backupPath?: string;\n reason?: 'legacy-missing' | 'canonical-exists';\n}\n\nexport function normalizeOpenEditorTargetMode(value: unknown): OpenEditorTargetMode {\n return value === 'hub' ? 'hub' : DEFAULT_OPEN_EDITOR_TARGET_MODE;\n}\n\nexport function normalizeVibePulseConfig(value: unknown): VibePulseConfig {\n const vibepulse = typeof value === 'object' && value !== null && !Array.isArray(value)\n ? { ...(value as Record<string, unknown>) }\n : {};\n\n return {\n ...vibepulse,\n openEditorTargetMode: normalizeOpenEditorTargetMode(vibepulse.openEditorTargetMode),\n };\n}\n\nexport function getCanonicalUserConfigPath(): string {\n return CONFIG_PATH;\n}\n\nexport function getLegacyUserConfigPath(): string {\n return LEGACY_CONFIG_PATH;\n}\n\nexport function detectLegacyConfig(legacyPath: string = LEGACY_CONFIG_PATH): boolean {\n try {\n return existsSync(legacyPath);\n } catch {\n return false;\n }\n}\n\nexport function resolveConfigPath(configPath: string = CONFIG_PATH): string {\n if (configPath !== CONFIG_PATH) {\n return configPath;\n }\n\n if (existsSync(CONFIG_PATH)) {\n return CONFIG_PATH;\n }\n\n if (existsSync(LEGACY_CONFIG_PATH)) {\n return LEGACY_CONFIG_PATH;\n }\n\n return CONFIG_PATH;\n}\n\nexport function detectConfig(configPath: string = CONFIG_PATH): boolean {\n try {\n return existsSync(resolveConfigPath(configPath));\n } catch {\n return false;\n }\n}\n\nexport function findProjectConfigPath(startDir: string = process.cwd()): string | null {\n let currentDir = startDir;\n\n while (true) {\n for (const filename of PROJECT_CONFIG_FILENAMES) {\n const configPath = join(currentDir, PROJECT_CONFIG_DIR, filename);\n if (existsSync(configPath)) {\n return configPath;\n }\n }\n\n const parentDir = dirname(currentDir);\n if (parentDir === currentDir) {\n return null;\n }\n\n currentDir = parentDir;\n }\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function mergeConfig(base: OpenCodeConfig, overlay: OpenCodeConfig): OpenCodeConfig {\n const merged: Record<string, unknown> = { ...base };\n\n for (const [key, overlayValue] of Object.entries(overlay)) {\n const baseValue = merged[key];\n\n if (isPlainObject(baseValue) && isPlainObject(overlayValue)) {\n merged[key] = mergeConfig(baseValue as OpenCodeConfig, overlayValue as OpenCodeConfig);\n continue;\n }\n\n merged[key] = overlayValue;\n }\n\n return merged as OpenCodeConfig;\n}\n\nexport async function readConfig(configPath: string = CONFIG_PATH): Promise<OpenCodeConfig> {\n try {\n const content = await readFile(resolveConfigPath(configPath), 'utf-8');\n const config = parse(content, null, false) as OpenCodeConfig;\n return config;\n } catch {\n return {};\n }\n}\n\nasync function readLegacyConfigForMigration(legacyPath: string): Promise<OpenCodeConfig> {\n try {\n const content = await readFile(legacyPath, 'utf-8');\n return parse(content, null, false) as OpenCodeConfig;\n } catch (error) {\n throw new Error(`Failed to read legacy config: ${error}`);\n }\n}\n\nexport async function readEffectiveConfig(options: EffectiveConfigOptions = {}): Promise<OpenCodeConfig> {\n const userConfig = await readConfig(options.userConfigPath);\n const projectConfigPath = options.projectConfigPath === undefined\n ? findProjectConfigPath(options.projectStartDir)\n : options.projectConfigPath;\n\n if (!projectConfigPath) {\n return userConfig;\n }\n\n const projectConfig = await readConfig(projectConfigPath);\n return mergeConfig(userConfig, projectConfig);\n}\n\nexport async function writeConfig(\n config: OpenCodeConfig, \n configPath: string = CONFIG_PATH\n): Promise<void> {\n try {\n const configDir = dirname(configPath);\n if (!existsSync(configDir)) {\n mkdirSync(configDir, { recursive: true });\n }\n\n const shouldEnforceSchema = configPath === CONFIG_PATH;\n const configWithSchema: OpenCodeConfig = shouldEnforceSchema\n ? {\n ...config,\n $schema: config.$schema || OH_MY_OPENAGENT_CONFIG_SCHEMA,\n }\n : config;\n\n const content = stringify(configWithSchema, null, 2);\n await writeFile(configPath, content, 'utf-8');\n } catch (error) {\n throw new Error(`Failed to write config: ${error}`);\n }\n}\n\nfunction formatBackupTimestamp(date: Date): string {\n return date.toISOString().replace(/[:.]/g, '-');\n}\n\nfunction defaultBackupPath(legacyPath: string, date: Date): string {\n const parsed = parsePath(legacyPath);\n return join(parsed.dir, `${parsed.base}.backup-${formatBackupTimestamp(date)}`);\n}\n\nexport async function migrateLegacyConfig(options: LegacyMigrationOptions = {}): Promise<LegacyMigrationResult> {\n const legacyPath = options.legacyPath ?? LEGACY_CONFIG_PATH;\n const canonicalPath = options.canonicalPath ?? CONFIG_PATH;\n\n if (!existsSync(legacyPath)) {\n return { migrated: false, legacyPath, canonicalPath, reason: 'legacy-missing' };\n }\n\n if (existsSync(canonicalPath)) {\n return { migrated: false, legacyPath, canonicalPath, reason: 'canonical-exists' };\n }\n\n const backupPath = options.backupPath ?? defaultBackupPath(legacyPath, options.now?.() ?? new Date());\n const canonicalDir = dirname(canonicalPath);\n if (!existsSync(canonicalDir)) {\n mkdirSync(canonicalDir, { recursive: true });\n }\n\n await copyFile(legacyPath, backupPath);\n\n try {\n const legacyConfig = await readLegacyConfigForMigration(legacyPath);\n const writeCanonicalConfig = options.writeCanonicalConfig ?? writeConfig;\n await writeCanonicalConfig(legacyConfig, canonicalPath);\n return { migrated: true, legacyPath, canonicalPath, backupPath };\n } catch (error) {\n await rm(canonicalPath, { force: true });\n throw error;\n }\n}\n"],"names":[],"mappings":"uCAAA,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,OAGO,IAAM,EAAa,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAA,AAAO,IAAI,UAAW,YACxC,EAAc,CAAA,EAAA,EAAA,IAAI,AAAJ,EAAK,EAAY,yBAC/B,EAAqB,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAY,wBAMtC,EAAgC,2GAqCtC,SAAS,EAAyB,CAAc,EACrD,IAAM,EAA6B,UAAjB,OAAO,GAAgC,OAAV,CAAkB,EAAC,MAAM,OAAO,CAAC,GAE5E,CAAC,EADD,CAAE,GAAI,CAAK,AAA6B,EAG5C,MAAO,CACL,GAAG,CAAS,CACZ,qBAVK,AAAU,CAUO,OAA8B,EAAU,oBAAoB,CAV3D,MAjC0C,EAiClC,MAWjC,CACF,CAkBO,SAAS,EAAkB,EAAqB,CAAW,SAChE,AAAI,IAAe,EACV,EAGL,CAAA,EAAA,EAAA,IAJ4B,MAI5B,AAAU,EAAC,GACN,EAGL,CAAA,EAAA,EAAA,IAJyB,MAIzB,AAAU,EAAC,GACN,EAGF,CACT,CAEO,SAAS,EAAa,EAAqB,CAPZ,AAOuB,EAC3D,GAAI,CACF,MAAO,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,EAAkB,GACtC,CAAE,KAAM,CACN,OAAO,CACT,CACF,CAsBA,SAAS,EAAc,CAAc,EACnC,MAAwB,UAAjB,OAAO,GAAgC,OAAV,GAAkB,CAAC,MAAM,OAAO,CAAC,EACvE,CAmBO,eAAe,EAAW,EAAqB,CAAW,EAC/D,GAAI,CACF,IAAM,EAAU,MAAM,CAAA,EAAA,EAAA,QAAA,AAAQ,EAAC,EAAkB,GAAa,SAE9D,MADe,CAAA,AACR,EADQ,EAAA,KAAA,AAAK,EAAC,EAAS,MAAM,EAEtC,CAAE,KAAM,CACN,MAAO,CAAC,CACV,CACF,CAyBO,eAAe,EACpB,CAAsB,CACtB,EAAqB,CAAW,EAEhC,GAAI,CACF,IAAM,EAAY,CAAA,EAAA,EAAA,OAAA,AAAO,EAAC,EACtB,CAAC,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,IACd,CAAA,EAAA,EAAA,GAD0B,MACjB,AAAT,EAAU,EAAW,CAAE,WAAW,CAAK,GAIzC,IAAM,EADsB,AACa,IADE,EAEvC,CACE,GAAG,CAAM,CACT,QAAS,EAAO,OAAO,EAAI,CAC7B,EACA,EAEE,EAAU,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,EAAkB,KAAM,EAClD,OAAM,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,EAAY,EAAS,QACvC,CAAE,MAAO,EAAO,CACd,MAAM,AAAI,MAAM,CAAC,wBAAwB,EAAE,EAAA,CAAO,CACpD,CACF,iFAzEO,SAAS,EAAY,CAAoB,CAAE,CAAuB,EACvE,IAAM,EAAkC,CAAE,GAAG,CAAI,AAAC,EAElD,IAAK,GAAM,CAAC,EAAK,EAAa,GAAI,OAAO,OAAO,CAAC,GAAU,CACzD,IAAM,EAAY,CAAM,CAAC,EAAI,CAE7B,GAAI,EAAc,IAAc,EAAc,GAAe,CAC3D,CAAM,CAAC,EAAI,CAAG,EAAY,EAA6B,GACvD,QACF,CAEA,CAAM,CAAC,EAAI,CAAG,CAChB,CAEA,OAAO,CACT"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[63127,t=>{"use strict";var e=t.i(22734),i=t.i(24868),n=t.i(46786),r=t.i(14747),s=t.i(17506),a=t.i(39948);let o=["command-message","local-command-caveat"],l=[/^\s*<ide_[a-z0-9_-]+(?=[\s>/]|$)/i,/^the\s+user\s+opened\s+(?:\.\.\/|\.\/|~\/|\/|[a-zA-Z]:[\\/])/i];function c(t){let e=(function(t){let e=t;for(let t of o){let i=RegExp(`<${t}(?=[\\s>/]|$)\\s*/?>?`,"ig"),n=RegExp(`</${t}(?=[\\s>]|$)\\s*>?`,"ig");e=e.replace(i," ").replace(n," ")}return e.trim()})(t).replace(/\s+/g," ").trim();return e.length<=72?e:`${e.slice(0,69)}...`}function u(t){var e,i;let n=c(t);return!n||(e=t,!(i=n)||l.some(t=>t.test(e)||t.test(i)))?null:n}function d(t){return(0,a.namespaceClaudeRawId)(t)}function f(t){var e;let i,n=d(t.sessionId),r="string"==typeof t.title?c(t.title):"",s=(e=t.topology,e?.childSessions==="authoritative"?e:a.READONLY_PROVIDER_CONTEXT.topology);return{id:n,slug:t.sessionId,title:r||((i=t.sessionId.trim())?i.slice(0,8):"Session"),directory:t.cwd,projectName:t.projectName,...t.gitBranch?{branch:t.gitBranch}:{},time:{created:t.createdAt,updated:t.updatedAt,..."number"==typeof t.archivedAt?{archived:t.archivedAt}:{}},rawSessionId:t.sessionId,providerRawId:t.sessionId,provider:"claude-code",readOnly:!0,capabilities:a.READONLY_PROVIDER_CONTEXT.capabilities,topology:s,realTimeStatus:t.waitingForUser?"idle":t.isRunning?"busy":"idle",waitingForUser:t.waitingForUser,children:[]}}function p(t){let e=0;return"number"==typeof t.runningPid&&(e+=2),"number"==typeof t.startedAt&&(e+=1),e}async function y(t){try{return await (0,i.access)(t,e.constants.F_OK),!0}catch{return!1}}async function g(t){try{return await (0,i.realpath)(t)}catch{return null}}async function m(t,e){let n;try{n=await (0,i.open)(t,"r");let r=Buffer.alloc(e),{bytesRead:s}=await n.read(r,0,e,0);return r.subarray(0,s).toString("utf8")}catch{return null}finally{await n?.close().catch(()=>void 0)}}async function h(t,e){try{let n=await (0,i.stat)(t);if(!n.isFile()||n.size>e)return null}catch{return null}let n=await m(t,e);if(!n)return null;try{return JSON.parse(n)}catch{return null}}async function w(t,e){let i=(0,r.join)(t,"sessions-index.json"),n=await h(i,e);if(!n?.originalPath||"string"!=typeof n.originalPath)return null;let s=await g(n.originalPath);return s||null}async function I(t,e){let i=await m(t,e);if(null===i)return null;let n={};for(let t of i.split("\n")){let e=t.trim();if(e){try{let t=JSON.parse(e);if("string"!=typeof t.cwd||n.cwd||(n.cwd=t.cwd),"string"!=typeof t.sessionId||n.sessionId||(n.sessionId=t.sessionId),"string"==typeof t.agentId&&!n.agentId){let e=t.agentId.trim();e&&(n.agentId=e)}if("boolean"==typeof t.isSidechain&&void 0===n.isSidechain&&(n.isSidechain=t.isSidechain),"string"!=typeof t.gitBranch||n.gitBranch||(n.gitBranch=t.gitBranch),!n.title){let e=function(t){let e=t.type,i=t.message,n=i&&"object"==typeof i?i.role:void 0;if("user"!==e&&"user"!==n)return null;let r=i&&"object"==typeof i?i.content:t.content;if("string"==typeof r)return u(r);if(Array.isArray(r))for(let t of r){if(!t||"object"!=typeof t||"string"==typeof t.type&&"text"!==t.type)continue;let e="string"==typeof t.text?t.text:"string"==typeof t.content?t.content:null;if(!e)continue;let i=u(e);if(i)return i}return null}(t);e&&(n.title=e)}if(!n.explicitParentSessionId){let e=function(t){let e=t.parentSessionId??t.parent_session_id??t.parentSessionID;return"string"!=typeof e?null:e.trim()||null}(t);e&&(n.explicitParentSessionId=e)}let i=function(t){if("number"==typeof t&&Number.isFinite(t))return t;if("string"==typeof t){let e=Date.parse(t);if(Number.isFinite(e))return e}}(t.timestamp);void 0!==i&&void 0===n.timestampMs&&(n.timestampMs=i)}catch{continue}if(n.cwd&&n.sessionId&&n.gitBranch&&void 0!==n.timestampMs&&n.title&&n.explicitParentSessionId)break}}return n}async function v(t){let e;try{e=await (0,i.readdir)(t,{withFileTypes:!0})}catch{return[]}let n=[];for(let s of e){let e,a=(0,r.join)(t,s.name);if(s.isFile()&&s.name.endsWith(".jsonl")){n.push(a);continue}if(!s.isDirectory())continue;let o=(0,r.join)(a,"subagents");try{e=await (0,i.readdir)(o,{withFileTypes:!0})}catch{continue}for(let t of e)t.isFile()&&t.name.endsWith(".jsonl")&&n.push((0,r.join)(o,t.name))}return n}async function b(t,e){let n;try{let r=await (0,i.stat)(t);if(!r.isFile())return null;n=await (0,i.open)(t,"r");let s=Math.min(e,r.size),a=Math.max(0,r.size-s),o=Buffer.alloc(s),{bytesRead:l}=await n.read(o,0,s,a);return o.subarray(0,l).toString("utf8")}catch{return null}finally{await n?.close().catch(()=>void 0)}}async function S(t,e){let i=Array.from(new Set([Math.max(1,e),Math.max(4*e,262144)])),n=null;for(let e of i){let i=await I(t,e);if(i&&(n=i).title)break}return n}async function A(t,e){if(Date.now()-e>6e5)return{waitingForUser:!1,trailingParseErrors:!1};let i=await b(t,65536);if(!i)return{waitingForUser:!1,trailingParseErrors:!1};let n=i.split("\n").map(t=>t.trim()).filter(Boolean),r=!1;for(let t=n.length-1;t>=0;t--)try{let e=JSON.parse(n[t]),i=e.type,o=e.message,l=o&&"object"==typeof o?o.role:void 0;if("user"===i||"user"===l)return{waitingForUser:!1,trailingParseErrors:r};if("assistant"===i&&o&&"object"==typeof o){var s,a;let t=o.stop_reason,e=(s=o.content,"string"==typeof s?s.trim()||null:Array.isArray(s)&&s.map(t=>t&&"object"==typeof t&&"string"==typeof t.text?t.text:null).filter(t=>!!t).join("\n").trim()||null);if("tool_use"===t||(a=o.content,Array.isArray(a)&&a.some(t=>t&&"object"==typeof t&&"tool_use"===t.type))||"end_turn"===t&&"string"==typeof e&&function(t){let e=t.trim();return e.endsWith("?")||e.endsWith("?")}(e))return{waitingForUser:!0,trailingParseErrors:r};break}}catch{r=!0;continue}return{waitingForUser:!1,trailingParseErrors:r}}async function F(t){try{return process.kill(t,0),!0}catch{return!1}}async function j(t,e,n){let s,a=(0,r.join)(t,"sessions");try{s=(await (0,i.readdir)(a,{withFileTypes:!0})).sort((t,e)=>t.name.localeCompare(e.name))}catch{return new Map}let o=new Map;for(let t of s){if(!t.isFile()||!t.name.endsWith(".json"))continue;let i=await h((0,r.join)(a,t.name),e);if(!i?.sessionId||"string"!=typeof i.sessionId||"string"!=typeof i.cwd)continue;let s=await g(i.cwd);if(!s)continue;let l={sessionId:i.sessionId,cwd:s,startedAt:"number"==typeof i.startedAt&&Number.isFinite(i.startedAt)?i.startedAt:void 0};if("number"==typeof i.pid&&Number.isInteger(i.pid)&&i.pid>0){let t=!1;try{t=await n(i.pid)}catch{t=!1}t&&void 0!==l.startedAt&&(l.runningPid=i.pid)}let c=o.get(i.sessionId);if(!c){o.set(i.sessionId,l);continue}o.set(i.sessionId,function(t,e){let i=p(t),n=p(e);if(n>i)return e;if(n<i)return t;let r=t.startedAt??-1/0;return(e.startedAt??-1/0)>r?e:t}(c,l))}return o}async function M(t={}){let e,a=function({claudeDir:t,homeDir:e}){return t||(0,r.join)(e??(0,n.homedir)(),".claude")}(t),o=(0,r.join)(a,"projects");if(!await y(o))return[];let l=t.smallFileLimitBytes??131072,c=t.jsonlHeadLimitBytes??65536,u=await j(a,l,t.isPidAlive??F);try{e=await (0,i.readdir)(o,{withFileTypes:!0})}catch{return[]}let d=new Map,f=new Map,p=new Map((await (0,s.listClaudeSessionOverrides)()).map(t=>[t.sessionId,t])),m=Date.now();for(let t of e){if(!t.isDirectory())continue;let e=(0,r.join)(o,t.name),n=await w(e,l);for(let t of(await v(e))){let e,s=(0,r.basename)(t).slice(0,-6);if(!s)continue;let a=u.get(s);try{if(!(e=await (0,i.stat)(t)).isFile())continue}catch{continue}let o=await S(t,c);if(null===o)continue;let l=n;if("string"==typeof o.cwd){let t=await g(o.cwd);if(!t||n&&t!==n)continue;l=t}if(!l)continue;let y=function(t,e){if(!(t.startsWith("agent-")&&t.length>6))return null;let i=t.slice(6),n="string"==typeof e.agentId?e.agentId.trim():"";if(n&&n!==i||!0!==e.isSidechain&&!n)return null;let r="string"==typeof e.sessionId?e.sessionId.trim():"";return r&&r!==t?r:null}(s,o),h="string"==typeof y,w=o.sessionId??s;if(!h&&w!==s)continue;let I=o.title,v=y?`${y}__${s}`:s,b=p.get(v),F=y?p.get(y):void 0,j="number"==typeof b?.deletedAt?b:F;if("number"==typeof j?.deletedAt)continue;let M=a?.cwd===l?a:void 0,P=Math.max(e.mtimeMs,o.timestampMs??0),x=m-P<=1e4,_="number"==typeof b?.restoredAt&&b.restoredAt>=P?{waitingForUser:!1,trailingParseErrors:!1}:await A(t,P),B="number"==typeof M?.runningPid||h,N=_.waitingForUser&&_.trailingParseErrors&&x&&B,O=!!B&&!N&&_.waitingForUser,R=!O&&x&&B,U=M?.runningPid!==void 0?M.startedAt??o.timestampMs??e.birthtimeMs??e.mtimeMs:o.timestampMs??e.birthtimeMs??e.mtimeMs;d.set(v,{sessionId:v,...I?{title:I}:{},cwd:l,projectPath:l,projectName:(0,r.basename)(l),artifactPath:t,gitBranch:o.gitBranch??null,createdAt:U,updatedAt:P,startedAt:M?.runningPid!==void 0?M.startedAt:void 0,pid:M?.runningPid,isRunning:R,waitingForUser:O,..."number"==typeof b?.archivedAt?{archivedAt:b.archivedAt}:{}}),o.explicitParentSessionId?f.set(v,o.explicitParentSessionId):y&&f.set(v,y)}}if(0===d.size)return[];for(let[t,e]of f){let i=d.get(t),n=d.get(e);i&&n&&t!==e&&(d.set(t,{...i,parentSessionId:e,topology:{childSessions:"authoritative"}}),d.set(e,{...n,topology:{childSessions:"authoritative"}}))}return Array.from(d.values()).sort((t,e)=>e.updatedAt-t.updatedAt)}t.s(["claudeCodeLocalSessionProvider",0,{id:"claude-code",async getSessionsResult(){try{let t=function(t){let e=t.map(f),i=new Map(e.map(t=>[t.id,t])),n=new Map,r=new Map,s=new Set,a=t=>{let e=new Set([t]),i=n.get(t);for(;i&&!e.has(i);){e.add(i);let t=n.get(i);if(!t)return i;i=t}};for(let e of t){if(e.topology?.childSessions!=="authoritative"||!e.parentSessionId)continue;let t=d(e.sessionId),r=d(e.parentSessionId),s=i.get(t),a=i.get(r);s&&a&&t!==r&&"authoritative"===a.topology.childSessions&&n.set(t,r)}for(let[t]of n){let e=i.get(t);if(!e)continue;let n=a(t);if(!n||n===t)continue;let o=i.get(n);if(!o||"authoritative"!==o.topology.childSessions)continue;let l=r.get(n)??[];l.push({id:e.id,slug:e.slug,title:e.title,directory:e.directory,parentID:n,time:e.time,realTimeStatus:e.realTimeStatus,waitingForUser:e.waitingForUser,readOnly:e.readOnly,capabilities:e.capabilities,rawSessionId:e.rawSessionId,provider:e.provider,providerRawId:e.providerRawId,topology:e.topology}),r.set(n,l),s.add(t)}return e.filter(t=>!s.has(t.id)).map(t=>({...t,children:r.get(t.id)??[]}))}(await M({repoPath:process.cwd()}));return{payload:{sessions:t,processHints:[]},sourceMeta:{online:t.length>0}}}catch{return{payload:{sessions:[],processHints:[]},sourceMeta:{online:!1,degraded:!0,reason:"Claude Code discovery failed"}}}}}])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=src_lib_session-providers_claudeCode_ts_0f9590ed._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/session-providers/claudeCode.ts"],"sourcesContent":["import { constants, type Dirent, type Stats } from 'fs';\nimport { access, open, readdir, realpath, stat, type FileHandle } from 'fs/promises';\nimport { homedir } from 'os';\nimport { basename, join } from 'path';\nimport { listClaudeSessionOverrides } from '@/lib/claudeSessionOverrides';\nimport type { ChildEntry, LocalSessionProvider, ProviderTopology, SessionsRouteResult } from './types';\nimport { namespaceClaudeRawId, READONLY_PROVIDER_CONTEXT } from './providerIds';\n\nconst DEFAULT_SMALL_FILE_LIMIT_BYTES = 128 * 1024;\nconst DEFAULT_JSONL_HEAD_LIMIT_BYTES = 64 * 1024;\nconst DEFAULT_JSONL_HEAD_RETRY_LIMIT_BYTES = 256 * 1024;\nconst DEFAULT_SESSION_TITLE_MAX_CHARS = 72;\nconst DEFAULT_BUSY_ACTIVITY_WINDOW_MS = 10 * 1000;\nconst DEFAULT_WAITING_FOR_USER_WINDOW_MS = 10 * 60 * 1000;\nconst CLAUDE_PROJECTS_DIR = 'projects';\nconst CLAUDE_SESSIONS_DIR = 'sessions';\nconst PROJECT_INDEX_FILE = 'sessions-index.json';\nconst CLAUDE_TITLE_WRAPPER_TAGS = ['command-message', 'local-command-caveat'] as const;\nconst CLAUDE_TITLE_NOISE_PATTERNS = [\n /^\\s*<ide_[a-z0-9_-]+(?=[\\s>/]|$)/i,\n /^the\\s+user\\s+opened\\s+(?:\\.\\.\\/|\\.\\/|~\\/|\\/|[a-zA-Z]:[\\\\/])/i,\n] as const;\n\nfunction stripKnownClaudeTitleWrappers(title: string): string {\n let normalized = title;\n\n for (const tagName of CLAUDE_TITLE_WRAPPER_TAGS) {\n const openTagFragment = new RegExp(`<${tagName}(?=[\\\\s>/]|$)\\\\s*/?>?`, 'ig');\n const closeTagFragment = new RegExp(`</${tagName}(?=[\\\\s>]|$)\\\\s*>?`, 'ig');\n\n normalized = normalized.replace(openTagFragment, ' ').replace(closeTagFragment, ' ');\n }\n\n return normalized.trim();\n}\n\nfunction normalizeSessionTitle(title: string): string {\n const compact = stripKnownClaudeTitleWrappers(title).replace(/\\s+/g, ' ').trim();\n if (compact.length <= DEFAULT_SESSION_TITLE_MAX_CHARS) {\n return compact;\n }\n\n return `${compact.slice(0, DEFAULT_SESSION_TITLE_MAX_CHARS - 3)}...`;\n}\n\nfunction toClaudeTitleCandidate(rawText: string): string | null {\n const normalizedTitle = normalizeSessionTitle(rawText);\n if (!normalizedTitle) {\n return null;\n }\n\n if (isNoisyClaudeSessionTitle(rawText, normalizedTitle)) {\n return null;\n }\n\n return normalizedTitle;\n}\n\nfunction isNoisyClaudeSessionTitle(rawTitle: string, normalizedTitle: string): boolean {\n if (!normalizedTitle) {\n return true;\n }\n\n return CLAUDE_TITLE_NOISE_PATTERNS.some((pattern) => pattern.test(rawTitle) || pattern.test(normalizedTitle));\n}\n\nfunction composeClaudeCodeSessionFallbackTitle(sessionId: string): string {\n const trimmedId = sessionId.trim();\n if (!trimmedId) {\n return 'Session';\n }\n\n return trimmedId.slice(0, 8);\n}\n\nexport type ClaudeCodeDiscoveredSession = {\n sessionId: string;\n title?: string;\n cwd: string;\n projectPath: string;\n projectName: string;\n artifactPath: string;\n gitBranch: string | null;\n createdAt: number;\n updatedAt: number;\n startedAt?: number;\n pid?: number;\n isRunning: boolean;\n archivedAt?: number;\n waitingForUser: boolean;\n parentSessionId?: string;\n topology?: ProviderTopology;\n};\n\nexport type ClaudeCodeNormalizedSession = {\n id: string;\n slug: string;\n title: string;\n directory: string;\n projectName: string;\n branch?: string;\n parentID?: string;\n messageCount?: number;\n hasTranscript?: boolean;\n time: {\n created: number;\n updated: number;\n archived?: number;\n };\n provider: 'claude-code';\n readOnly: true;\n capabilities: typeof READONLY_PROVIDER_CONTEXT.capabilities;\n realTimeStatus: 'idle' | 'busy';\n waitingForUser: boolean;\n children: ChildEntry[];\n rawSessionId: string;\n providerRawId: string;\n topology: ProviderTopology;\n};\n\nexport type ClaudeCodeDiscoveryOptions = {\n repoPath?: string;\n homeDir?: string;\n claudeDir?: string;\n jsonlHeadLimitBytes?: number;\n smallFileLimitBytes?: number;\n isPidAlive?: (pid: number) => boolean | Promise<boolean>;\n};\n\nfunction normalizeClaudeCodeSessionId(rawSessionId: string): string {\n return namespaceClaudeRawId(rawSessionId);\n}\n\nfunction normalizeClaudeTopology(topology?: ProviderTopology): ProviderTopology {\n if (topology?.childSessions === 'authoritative') {\n return topology;\n }\n\n return READONLY_PROVIDER_CONTEXT.topology;\n}\n\nfunction toClaudeChildEntry(\n session: ClaudeCodeNormalizedSession,\n parentId: string\n): ChildEntry {\n return {\n id: session.id,\n slug: session.slug,\n title: session.title,\n directory: session.directory,\n parentID: parentId,\n time: session.time,\n realTimeStatus: session.realTimeStatus,\n waitingForUser: session.waitingForUser,\n readOnly: session.readOnly,\n capabilities: session.capabilities,\n rawSessionId: session.rawSessionId,\n provider: session.provider,\n providerRawId: session.providerRawId,\n topology: session.topology,\n };\n}\n\nexport function normalizeClaudeCodeSession(\n session: ClaudeCodeDiscoveredSession\n): ClaudeCodeNormalizedSession {\n const normalizedId = normalizeClaudeCodeSessionId(session.sessionId);\n const normalizedTitle = typeof session.title === 'string' ? normalizeSessionTitle(session.title) : '';\n const topology = normalizeClaudeTopology(session.topology);\n\n return {\n id: normalizedId,\n slug: session.sessionId,\n title: normalizedTitle || composeClaudeCodeSessionFallbackTitle(session.sessionId),\n directory: session.cwd,\n projectName: session.projectName,\n ...(session.gitBranch ? { branch: session.gitBranch } : {}),\n time: {\n created: session.createdAt,\n updated: session.updatedAt,\n ...(typeof session.archivedAt === 'number' ? { archived: session.archivedAt } : {}),\n },\n rawSessionId: session.sessionId,\n providerRawId: session.sessionId,\n provider: 'claude-code',\n readOnly: true,\n capabilities: READONLY_PROVIDER_CONTEXT.capabilities,\n topology,\n realTimeStatus: session.waitingForUser ? 'idle' : session.isRunning ? 'busy' : 'idle',\n waitingForUser: session.waitingForUser,\n children: [],\n };\n}\n\nexport function normalizeClaudeCodeSessions(\n sessions: ClaudeCodeDiscoveredSession[]\n): ClaudeCodeNormalizedSession[] {\n const normalizedSessions = sessions.map(normalizeClaudeCodeSession);\n const sessionById = new Map(normalizedSessions.map((session) => [session.id, session]));\n const parentByChildId = new Map<string, string>();\n const childrenByParentId = new Map<string, ChildEntry[]>();\n const nestedChildIds = new Set<string>();\n\n const resolveRootParentId = (childId: string): string | undefined => {\n const visited = new Set<string>([childId]);\n let currentParentId = parentByChildId.get(childId);\n\n while (currentParentId) {\n if (visited.has(currentParentId)) {\n return undefined;\n }\n\n visited.add(currentParentId);\n const nextParentId = parentByChildId.get(currentParentId);\n if (!nextParentId) {\n return currentParentId;\n }\n\n currentParentId = nextParentId;\n }\n\n return undefined;\n };\n\n for (const session of sessions) {\n if (session.topology?.childSessions !== 'authoritative' || !session.parentSessionId) {\n continue;\n }\n\n const normalizedChildId = normalizeClaudeCodeSessionId(session.sessionId);\n const normalizedParentId = normalizeClaudeCodeSessionId(session.parentSessionId);\n const normalizedChild = sessionById.get(normalizedChildId);\n const normalizedParent = sessionById.get(normalizedParentId);\n\n if (\n !normalizedChild\n || !normalizedParent\n || normalizedChildId === normalizedParentId\n || normalizedParent.topology.childSessions !== 'authoritative'\n ) {\n continue;\n }\n\n parentByChildId.set(normalizedChildId, normalizedParentId);\n }\n\n for (const [normalizedChildId] of parentByChildId) {\n const normalizedChild = sessionById.get(normalizedChildId);\n if (!normalizedChild) {\n continue;\n }\n\n const normalizedRootParentId = resolveRootParentId(normalizedChildId);\n if (!normalizedRootParentId || normalizedRootParentId === normalizedChildId) {\n continue;\n }\n\n const normalizedRootParent = sessionById.get(normalizedRootParentId);\n if (!normalizedRootParent || normalizedRootParent.topology.childSessions !== 'authoritative') {\n continue;\n }\n\n const rootChildren = childrenByParentId.get(normalizedRootParentId) ?? [];\n rootChildren.push(toClaudeChildEntry(normalizedChild, normalizedRootParentId));\n childrenByParentId.set(normalizedRootParentId, rootChildren);\n nestedChildIds.add(normalizedChildId);\n }\n\n return normalizedSessions\n .filter((session) => !nestedChildIds.has(session.id))\n .map((session) => ({\n ...session,\n children: childrenByParentId.get(session.id) ?? [],\n }));\n}\n\nexport const claudeCodeLocalSessionProvider: LocalSessionProvider = {\n id: 'claude-code',\n async getSessionsResult(): Promise<SessionsRouteResult> {\n try {\n const sessions = normalizeClaudeCodeSessions(await discoverClaudeCodeSessions({ repoPath: process.cwd() }));\n return {\n payload: {\n sessions,\n processHints: [],\n },\n sourceMeta: {\n online: sessions.length > 0,\n },\n };\n } catch {\n return {\n payload: {\n sessions: [],\n processHints: [],\n },\n sourceMeta: {\n online: false,\n degraded: true,\n reason: 'Claude Code discovery failed',\n },\n };\n }\n },\n};\n\ntype ProjectIndexMetadata = {\n originalPath?: string;\n};\n\ntype SessionIndexMetadata = {\n pid?: number;\n sessionId?: string;\n cwd?: string;\n startedAt?: number;\n};\n\ntype JsonlSessionHead = {\n cwd?: string;\n sessionId?: string;\n title?: string;\n gitBranch?: string;\n timestampMs?: number;\n explicitParentSessionId?: string;\n agentId?: string;\n isSidechain?: boolean;\n};\n\ntype CandidateSessionMetadata = {\n sessionId: string;\n cwd?: string;\n startedAt?: number;\n runningPid?: number;\n};\n\nfunction candidateMetadataScore(candidate: CandidateSessionMetadata): number {\n let score = 0;\n if (typeof candidate.runningPid === 'number') {\n score += 2;\n }\n if (typeof candidate.startedAt === 'number') {\n score += 1;\n }\n return score;\n}\n\nfunction mergeCandidateSessionMetadata(\n existing: CandidateSessionMetadata,\n incoming: CandidateSessionMetadata\n): CandidateSessionMetadata {\n const existingScore = candidateMetadataScore(existing);\n const incomingScore = candidateMetadataScore(incoming);\n\n if (incomingScore > existingScore) {\n return incoming;\n }\n\n if (incomingScore < existingScore) {\n return existing;\n }\n\n const existingStartedAt = existing.startedAt ?? -Infinity;\n const incomingStartedAt = incoming.startedAt ?? -Infinity;\n\n if (incomingStartedAt > existingStartedAt) {\n return incoming;\n }\n\n return existing;\n}\n\nfunction getClaudeDir({ claudeDir, homeDir }: ClaudeCodeDiscoveryOptions): string {\n if (claudeDir) {\n return claudeDir;\n }\n\n return join(homeDir ?? homedir(), '.claude');\n}\n\nexport function sanitizeClaudeProjectPath(repoPath: string): string {\n return repoPath.replace(/[^a-zA-Z0-9]/g, '-');\n}\n\nfunction toFiniteTimestamp(value: unknown): number | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n\n if (typeof value === 'string') {\n const parsed = Date.parse(value);\n if (Number.isFinite(parsed)) {\n return parsed;\n }\n }\n\n return undefined;\n}\n\nasync function safeAccess(filePath: string): Promise<boolean> {\n try {\n await access(filePath, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nasync function safeRealpath(filePath: string): Promise<string | null> {\n try {\n return await realpath(filePath);\n } catch {\n return null;\n }\n}\n\nasync function readFileHead(filePath: string, byteLimit: number): Promise<string | null> {\n let handle: FileHandle | undefined;\n\n try {\n handle = await open(filePath, 'r');\n const buffer = Buffer.alloc(byteLimit);\n const { bytesRead } = await handle.read(buffer, 0, byteLimit, 0);\n return buffer.subarray(0, bytesRead).toString('utf8');\n } catch {\n return null;\n } finally {\n await handle?.close().catch(() => undefined);\n }\n}\n\nasync function readSmallJsonFile<T>(filePath: string, byteLimit: number): Promise<T | null> {\n try {\n const fileStat = await stat(filePath);\n if (!fileStat.isFile() || fileStat.size > byteLimit) {\n return null;\n }\n } catch {\n return null;\n }\n\n const text = await readFileHead(filePath, byteLimit);\n if (!text) {\n return null;\n }\n\n try {\n return JSON.parse(text) as T;\n } catch {\n return null;\n }\n}\n\nasync function readProjectIndexRealpath(projectDir: string, byteLimit: number): Promise<string | null> {\n const indexPath = join(projectDir, PROJECT_INDEX_FILE);\n const index = await readSmallJsonFile<ProjectIndexMetadata>(indexPath, byteLimit);\n\n if (!index?.originalPath || typeof index.originalPath !== 'string') {\n return null;\n }\n\n const originalRealpath = await safeRealpath(index.originalPath);\n if (!originalRealpath) {\n return null;\n }\n\n return originalRealpath;\n}\n\nasync function readJsonlSessionHead(filePath: string, byteLimit: number): Promise<JsonlSessionHead | null> {\n const text = await readFileHead(filePath, byteLimit);\n if (text === null) {\n return null;\n }\n\n const metadata: JsonlSessionHead = {};\n\n for (const rawLine of text.split('\\n')) {\n const line = rawLine.trim();\n if (!line) {\n continue;\n }\n\n try {\n const parsed = JSON.parse(line) as Record<string, unknown>;\n\n if (typeof parsed.cwd === 'string' && !metadata.cwd) {\n metadata.cwd = parsed.cwd;\n }\n\n if (typeof parsed.sessionId === 'string' && !metadata.sessionId) {\n metadata.sessionId = parsed.sessionId;\n }\n\n if (typeof parsed.agentId === 'string' && !metadata.agentId) {\n const normalizedAgentId = parsed.agentId.trim();\n if (normalizedAgentId) {\n metadata.agentId = normalizedAgentId;\n }\n }\n\n if (typeof parsed.isSidechain === 'boolean' && metadata.isSidechain === undefined) {\n metadata.isSidechain = parsed.isSidechain;\n }\n\n if (typeof parsed.gitBranch === 'string' && !metadata.gitBranch) {\n metadata.gitBranch = parsed.gitBranch;\n }\n\n if (!metadata.title) {\n const titleCandidate = extractTitleFromSessionEvent(parsed);\n if (titleCandidate) {\n metadata.title = titleCandidate;\n }\n }\n\n if (!metadata.explicitParentSessionId) {\n const parentSessionId = extractExplicitParentSessionId(parsed);\n if (parentSessionId) {\n metadata.explicitParentSessionId = parentSessionId;\n }\n }\n\n const timestampMs = toFiniteTimestamp(parsed.timestamp);\n if (timestampMs !== undefined && metadata.timestampMs === undefined) {\n metadata.timestampMs = timestampMs;\n }\n } catch {\n continue;\n }\n\n if (\n metadata.cwd\n && metadata.sessionId\n && metadata.gitBranch\n && metadata.timestampMs !== undefined\n && metadata.title\n && metadata.explicitParentSessionId\n ) {\n break;\n }\n }\n\n return metadata;\n}\n\nfunction isAgentSessionArtifactId(value: string): boolean {\n return value.startsWith('agent-') && value.length > 'agent-'.length;\n}\n\nfunction extractSidechainParentSessionId(\n artifactSessionId: string,\n metadata: JsonlSessionHead\n): string | null {\n if (!isAgentSessionArtifactId(artifactSessionId)) {\n return null;\n }\n\n const artifactAgentId = artifactSessionId.slice('agent-'.length);\n const metadataAgentId = typeof metadata.agentId === 'string' ? metadata.agentId.trim() : '';\n if (metadataAgentId && metadataAgentId !== artifactAgentId) {\n return null;\n }\n\n if (metadata.isSidechain !== true && !metadataAgentId) {\n return null;\n }\n\n const candidateParentSessionId = typeof metadata.sessionId === 'string' ? metadata.sessionId.trim() : '';\n if (!candidateParentSessionId || candidateParentSessionId === artifactSessionId) {\n return null;\n }\n\n return candidateParentSessionId;\n}\n\nfunction toScopedSidechainSessionId(parentSessionId: string, artifactSessionId: string): string {\n return `${parentSessionId}__${artifactSessionId}`;\n}\n\nasync function collectProjectArtifactPaths(projectDir: string): Promise<string[]> {\n let projectArtifacts: Dirent[];\n try {\n projectArtifacts = await readdir(projectDir, { withFileTypes: true });\n } catch {\n return [];\n }\n\n const artifactPaths: string[] = [];\n\n for (const entry of projectArtifacts) {\n const entryPath = join(projectDir, entry.name);\n\n if (entry.isFile() && entry.name.endsWith('.jsonl')) {\n artifactPaths.push(entryPath);\n continue;\n }\n\n if (!entry.isDirectory()) {\n continue;\n }\n\n const subagentsDir = join(entryPath, 'subagents');\n\n let subagentArtifacts: Dirent[];\n try {\n subagentArtifacts = await readdir(subagentsDir, { withFileTypes: true });\n } catch {\n continue;\n }\n\n for (const subagentArtifact of subagentArtifacts) {\n if (!subagentArtifact.isFile() || !subagentArtifact.name.endsWith('.jsonl')) {\n continue;\n }\n\n artifactPaths.push(join(subagentsDir, subagentArtifact.name));\n }\n }\n\n return artifactPaths;\n}\n\nasync function readFileTail(filePath: string, byteLimit: number): Promise<string | null> {\n let handle: FileHandle | undefined;\n\n try {\n const fileStat = await stat(filePath);\n if (!fileStat.isFile()) {\n return null;\n }\n\n handle = await open(filePath, 'r');\n const bytesToRead = Math.min(byteLimit, fileStat.size);\n const start = Math.max(0, fileStat.size - bytesToRead);\n const buffer = Buffer.alloc(bytesToRead);\n const { bytesRead } = await handle.read(buffer, 0, bytesToRead, start);\n return buffer.subarray(0, bytesRead).toString('utf8');\n } catch {\n return null;\n } finally {\n await handle?.close().catch(() => undefined);\n }\n}\n\nasync function readJsonlSessionHeadWithTitleRetry(filePath: string, byteLimit: number): Promise<JsonlSessionHead | null> {\n const headReadLimits = Array.from(\n new Set([\n Math.max(1, byteLimit),\n Math.max(byteLimit * 4, DEFAULT_JSONL_HEAD_RETRY_LIMIT_BYTES),\n ])\n );\n\n let headMetadata: JsonlSessionHead | null = null;\n for (const headReadLimit of headReadLimits) {\n const scanned = await readJsonlSessionHead(filePath, headReadLimit);\n if (!scanned) {\n continue;\n }\n\n headMetadata = scanned;\n if (headMetadata.title) {\n break;\n }\n }\n\n return headMetadata;\n}\n\nfunction extractTextMessage(content: unknown): string | null {\n if (typeof content === 'string') {\n const compact = content.trim();\n return compact || null;\n }\n\n if (!Array.isArray(content)) return null;\n const texts = content\n .map((part) => (part && typeof part === 'object' && typeof (part as Record<string, unknown>).text === 'string'\n ? (part as Record<string, unknown>).text as string\n : null))\n .filter((value): value is string => !!value)\n .join('\\n')\n .trim();\n return texts || null;\n}\n\nfunction extractTitleFromSessionEvent(entry: Record<string, unknown>): string | null {\n const outerType = entry.type;\n const message = entry.message;\n const role = message && typeof message === 'object' ? (message as Record<string, unknown>).role : undefined;\n const isUserEvent = outerType === 'user' || role === 'user';\n if (!isUserEvent) {\n return null;\n }\n\n const content = message && typeof message === 'object'\n ? (message as Record<string, unknown>).content\n : entry.content;\n\n if (typeof content === 'string') {\n return toClaudeTitleCandidate(content);\n }\n\n if (Array.isArray(content)) {\n for (const part of content) {\n if (!part || typeof part !== 'object') {\n continue;\n }\n\n const typedPart = part as Record<string, unknown>;\n if (typeof typedPart.type === 'string' && typedPart.type !== 'text') {\n continue;\n }\n\n const text = typeof typedPart.text === 'string'\n ? typedPart.text\n : typeof typedPart.content === 'string'\n ? typedPart.content\n : null;\n if (!text) {\n continue;\n }\n\n const titleCandidate = toClaudeTitleCandidate(text);\n if (titleCandidate) {\n return titleCandidate;\n }\n }\n\n return null;\n }\n\n return null;\n}\n\nfunction extractExplicitParentSessionId(entry: Record<string, unknown>): string | null {\n const candidate = entry.parentSessionId ?? entry.parent_session_id ?? entry.parentSessionID;\n if (typeof candidate !== 'string') {\n return null;\n }\n\n const normalizedCandidate = candidate.trim();\n return normalizedCandidate || null;\n}\n\nfunction hasToolUseContent(content: unknown): boolean {\n return Array.isArray(content) && content.some((part) => part && typeof part === 'object' && (part as Record<string, unknown>).type === 'tool_use');\n}\n\nfunction textLooksLikeUserQuestion(text: string): boolean {\n const trimmed = text.trim();\n return trimmed.endsWith('?') || trimmed.endsWith('?');\n}\n\ntype WaitingDetectionResult = {\n waitingForUser: boolean;\n trailingParseErrors: boolean;\n};\n\nasync function detectWaitingForUserFromTranscript(\n filePath: string,\n updatedAt: number\n): Promise<WaitingDetectionResult> {\n const now = Date.now();\n if (now - updatedAt > DEFAULT_WAITING_FOR_USER_WINDOW_MS) {\n return {\n waitingForUser: false,\n trailingParseErrors: false,\n };\n }\n\n const tail = await readFileTail(filePath, DEFAULT_JSONL_HEAD_LIMIT_BYTES);\n if (!tail) {\n return {\n waitingForUser: false,\n trailingParseErrors: false,\n };\n }\n\n const lines = tail.split('\\n').map((line) => line.trim()).filter(Boolean);\n let trailingParseErrors = false;\n for (let i = lines.length - 1; i >= 0; i--) {\n try {\n const parsed = JSON.parse(lines[i]) as Record<string, unknown>;\n const outerType = parsed.type;\n const message = parsed.message;\n const role = message && typeof message === 'object' ? (message as Record<string, unknown>).role : undefined;\n\n if (outerType === 'user' || role === 'user') {\n return {\n waitingForUser: false,\n trailingParseErrors,\n };\n }\n\n if (outerType === 'assistant' && message && typeof message === 'object') {\n const msg = message as Record<string, unknown>;\n const stopReason = msg.stop_reason;\n const text = extractTextMessage(msg.content);\n const toolUsePending = stopReason === 'tool_use' || hasToolUseContent(msg.content);\n if (toolUsePending) {\n return {\n waitingForUser: true,\n trailingParseErrors,\n };\n }\n if (stopReason === 'end_turn' && typeof text === 'string' && textLooksLikeUserQuestion(text)) {\n return {\n waitingForUser: true,\n trailingParseErrors,\n };\n }\n return {\n waitingForUser: false,\n trailingParseErrors,\n };\n }\n } catch {\n trailingParseErrors = true;\n continue;\n }\n }\n\n return {\n waitingForUser: false,\n trailingParseErrors,\n };\n}\n\nasync function defaultIsPidAlive(pid: number): Promise<boolean> {\n try {\n process.kill(pid, 0);\n return true;\n } catch {\n return false;\n }\n}\n\nasync function readCandidateSessionMetadata(\n claudeDir: string,\n byteLimit: number,\n isPidAlive: (pid: number) => boolean | Promise<boolean>\n): Promise<Map<string, CandidateSessionMetadata>> {\n const sessionsDir = join(claudeDir, CLAUDE_SESSIONS_DIR);\n\n let entries: Dirent[];\n try {\n entries = (await readdir(sessionsDir, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name));\n } catch {\n return new Map();\n }\n\n const metadataBySessionId = new Map<string, CandidateSessionMetadata>();\n\n for (const entry of entries) {\n if (!entry.isFile() || !entry.name.endsWith('.json')) {\n continue;\n }\n\n const metadata = await readSmallJsonFile<SessionIndexMetadata>(join(sessionsDir, entry.name), byteLimit);\n if (!metadata?.sessionId || typeof metadata.sessionId !== 'string') {\n continue;\n }\n\n if (typeof metadata.cwd !== 'string') {\n continue;\n }\n\n const metadataRepoRealpath = await safeRealpath(metadata.cwd);\n if (!metadataRepoRealpath) {\n continue;\n }\n\n const candidate: CandidateSessionMetadata = {\n sessionId: metadata.sessionId,\n cwd: metadataRepoRealpath,\n startedAt: typeof metadata.startedAt === 'number' && Number.isFinite(metadata.startedAt)\n ? metadata.startedAt\n : undefined,\n };\n\n if (typeof metadata.pid === 'number' && Number.isInteger(metadata.pid) && metadata.pid > 0) {\n let alive = false;\n try {\n alive = await isPidAlive(metadata.pid);\n } catch {\n alive = false;\n }\n\n if (alive && candidate.startedAt !== undefined) {\n candidate.runningPid = metadata.pid;\n }\n }\n\n const existing = metadataBySessionId.get(metadata.sessionId);\n if (!existing) {\n metadataBySessionId.set(metadata.sessionId, candidate);\n continue;\n }\n\n metadataBySessionId.set(metadata.sessionId, mergeCandidateSessionMetadata(existing, candidate));\n }\n\n return metadataBySessionId;\n}\n\nexport async function discoverClaudeCodeSessions(\n options: ClaudeCodeDiscoveryOptions = {}\n): Promise<ClaudeCodeDiscoveredSession[]> {\n const claudeDir = getClaudeDir(options);\n const projectsDir = join(claudeDir, CLAUDE_PROJECTS_DIR);\n if (!(await safeAccess(projectsDir))) {\n return [];\n }\n\n const smallFileLimitBytes = options.smallFileLimitBytes ?? DEFAULT_SMALL_FILE_LIMIT_BYTES;\n const jsonlHeadLimitBytes = options.jsonlHeadLimitBytes ?? DEFAULT_JSONL_HEAD_LIMIT_BYTES;\n const candidateMetadata = await readCandidateSessionMetadata(\n claudeDir,\n smallFileLimitBytes,\n options.isPidAlive ?? defaultIsPidAlive\n );\n\n let projectDirs: Dirent[];\n try {\n projectDirs = await readdir(projectsDir, { withFileTypes: true });\n } catch {\n return [];\n }\n\n const discoveredSessions = new Map<string, ClaudeCodeDiscoveredSession>();\n const explicitParentSessionIds = new Map<string, string>();\n const overrideMap = new Map((await listClaudeSessionOverrides()).map((entry) => [entry.sessionId, entry]));\n const now = Date.now();\n\n for (const projectEntry of projectDirs) {\n if (!projectEntry.isDirectory()) {\n continue;\n }\n\n const projectDir = join(projectsDir, projectEntry.name);\n const projectIndexRealpath = await readProjectIndexRealpath(projectDir, smallFileLimitBytes);\n\n const projectArtifactPaths = await collectProjectArtifactPaths(projectDir);\n\n for (const artifactPath of projectArtifactPaths) {\n const artifactName = basename(artifactPath);\n const artifactSessionId = artifactName.slice(0, -'.jsonl'.length);\n if (!artifactSessionId) {\n continue;\n }\n\n const metadata = candidateMetadata.get(artifactSessionId);\n let artifactStat: Stats;\n try {\n artifactStat = await stat(artifactPath);\n if (!artifactStat.isFile()) {\n continue;\n }\n } catch {\n continue;\n }\n\n const headMetadata = await readJsonlSessionHeadWithTitleRetry(artifactPath, jsonlHeadLimitBytes);\n if (headMetadata === null) {\n continue;\n }\n\n let scopedCwd: string | null = projectIndexRealpath;\n if (typeof headMetadata.cwd === 'string') {\n const artifactRepoRealpath = await safeRealpath(headMetadata.cwd);\n if (!artifactRepoRealpath) {\n continue;\n }\n\n if (projectIndexRealpath && artifactRepoRealpath !== projectIndexRealpath) {\n continue;\n }\n\n scopedCwd = artifactRepoRealpath;\n }\n\n if (!scopedCwd) {\n continue;\n }\n\n const sidechainParentSessionId = extractSidechainParentSessionId(artifactSessionId, headMetadata);\n const isSidechainArtifact = typeof sidechainParentSessionId === 'string';\n const resolvedSessionId = headMetadata.sessionId ?? artifactSessionId;\n if (!isSidechainArtifact && resolvedSessionId !== artifactSessionId) {\n continue;\n }\n\n const discoveredTitle = headMetadata.title;\n\n const sessionId = sidechainParentSessionId\n ? toScopedSidechainSessionId(sidechainParentSessionId, artifactSessionId)\n : artifactSessionId;\n\n const directOverride = overrideMap.get(sessionId);\n const parentDeletedOverride = sidechainParentSessionId\n ? overrideMap.get(sidechainParentSessionId)\n : undefined;\n const deletedOverride = typeof directOverride?.deletedAt === 'number'\n ? directOverride\n : parentDeletedOverride;\n if (typeof deletedOverride?.deletedAt === 'number') {\n continue;\n }\n\n const scopedMetadata = metadata?.cwd === scopedCwd ? metadata : undefined;\n const updatedAt = Math.max(artifactStat.mtimeMs, headMetadata.timestampMs ?? 0);\n const artifactAgeMs = now - updatedAt;\n const hasVeryRecentArtifactActivity = artifactAgeMs <= DEFAULT_BUSY_ACTIVITY_WINDOW_MS;\n const waitingSuppressedByRestore = typeof directOverride?.restoredAt === 'number' && directOverride.restoredAt >= updatedAt;\n const waitingDetection = waitingSuppressedByRestore\n ? { waitingForUser: false, trailingParseErrors: false }\n : await detectWaitingForUserFromTranscript(artifactPath, updatedAt);\n const hasRunningEvidence = typeof scopedMetadata?.runningPid === 'number' || isSidechainArtifact;\n const waitingStaleDuringActiveWrite =\n waitingDetection.waitingForUser\n && waitingDetection.trailingParseErrors\n && hasVeryRecentArtifactActivity\n && hasRunningEvidence;\n const waitingForUser = hasRunningEvidence\n ? (waitingStaleDuringActiveWrite ? false : waitingDetection.waitingForUser)\n : false;\n const isRunning =\n !waitingForUser\n && hasVeryRecentArtifactActivity\n && hasRunningEvidence;\n const createdAt = scopedMetadata?.runningPid !== undefined\n ? scopedMetadata.startedAt ?? headMetadata.timestampMs ?? artifactStat.birthtimeMs ?? artifactStat.mtimeMs\n : headMetadata.timestampMs ?? artifactStat.birthtimeMs ?? artifactStat.mtimeMs;\n\n discoveredSessions.set(sessionId, {\n sessionId,\n ...(discoveredTitle ? { title: discoveredTitle } : {}),\n cwd: scopedCwd,\n projectPath: scopedCwd,\n projectName: basename(scopedCwd),\n artifactPath,\n gitBranch: headMetadata.gitBranch ?? null,\n createdAt,\n updatedAt,\n startedAt: scopedMetadata?.runningPid !== undefined ? scopedMetadata.startedAt : undefined,\n pid: scopedMetadata?.runningPid,\n isRunning,\n waitingForUser,\n ...(typeof directOverride?.archivedAt === 'number' ? { archivedAt: directOverride.archivedAt } : {}),\n });\n\n if (headMetadata.explicitParentSessionId) {\n explicitParentSessionIds.set(sessionId, headMetadata.explicitParentSessionId);\n } else if (sidechainParentSessionId) {\n explicitParentSessionIds.set(sessionId, sidechainParentSessionId);\n }\n }\n }\n\n if (discoveredSessions.size === 0) {\n return [];\n }\n\n for (const [sessionId, parentSessionId] of explicitParentSessionIds) {\n const childSession = discoveredSessions.get(sessionId);\n const parentSession = discoveredSessions.get(parentSessionId);\n if (!childSession || !parentSession || sessionId === parentSessionId) {\n continue;\n }\n\n discoveredSessions.set(sessionId, {\n ...childSession,\n parentSessionId,\n topology: { childSessions: 'authoritative' },\n });\n discoveredSessions.set(parentSessionId, {\n ...parentSession,\n topology: { childSessions: 'authoritative' },\n });\n }\n\n return Array.from(discoveredSessions.values()).sort((a, b) => b.updatedAt - a.updatedAt);\n}\n"],"names":[],"mappings":"uCAAA,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,OAEA,EAAA,EAAA,CAAA,CAAA,OAWA,IAAM,EAA4B,CAAC,kBAAmB,uBAAuB,CACvE,EAA8B,CAClC,oCACA,gEACD,CAeD,SAAS,EAAsB,CAAa,EAC1C,IAAM,EAAU,CAdlB,SAAS,AAA8B,CAAa,EAClD,IAAI,EAAa,EAEjB,IAAK,IAAM,KAAW,EAA2B,CAC/C,IAAM,EAAkB,AAAI,OAAO,CAAC,CAAC,EAAE,EAAQ,qBAAqB,CAAC,CAAE,MACjE,EAAuB,AAAJ,OAAW,CAAC,EAAE,EAAE,EAAQ,kBAAkB,CAAC,CAAE,MAEtE,EAAa,EAAW,OAAO,CAAC,EAAiB,KAAK,OAAO,CAAC,EAAkB,IAClF,CAEA,OAAO,EAAW,IAAI,GACxB,EAGgD,GAAO,OAAO,CAAC,OAAQ,KAAK,IAAI,UAC9E,AAAI,EAAQ,MAAM,EA3BoB,EA2BhB,CACb,EAGF,CAAA,EAAG,EAAQ,KAAK,CAAC,EA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EAAE,AAClB,EACA,WAAY,CACV,OAAQ,GACR,UAAU,EACV,OAAQ,8BACV,CACF,CACF,CACF,CACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[32319,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},18622,(a,b,c)=>{b.exports=a.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,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},70406,(a,b,c)=>{b.exports=a.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(a,b,c)=>{b.exports=a.x("path",()=>require("path"))},
|
|
1
|
+
module.exports=[32319,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},18622,(a,b,c)=>{b.exports=a.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,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},70406,(a,b,c)=>{b.exports=a.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(a,b,c)=>{b.exports=a.x("path",()=>require("path"))},4276,(a,b,c)=>{let{createClientModuleProxy:d}=a.r(11857);a.n(d("[project]/node_modules/next/dist/client/components/builtin/global-error.js <module evaluation>"))},82509,(a,b,c)=>{let{createClientModuleProxy:d}=a.r(11857);a.n(d("[project]/node_modules/next/dist/client/components/builtin/global-error.js"))},66114,a=>{"use strict";a.i(4276);var b=a.i(82509);a.n(b)},24725,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},20635,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},43285,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/dynamic-access-async-storage.external.js",()=>require("next/dist/server/app-render/dynamic-access-async-storage.external.js"))},11857,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].ReactServerDOMTurbopackServer},24361,(a,b,c)=>{b.exports=a.x("util",()=>require("util"))},24951,(a,b,c)=>{"use strict";b.exports=a.r(18622)},7997,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].ReactJsxRuntime},717,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].React}];
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__c91a8380._.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../node_modules/next/dist/client/components/builtin/global-error.js/__nextjs-internal-proxy.cjs","../../../../node_modules/next/src/client/components/builtin/global-error.tsx","../../../../node_modules/next/src/server/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server.ts","../../../../node_modules/next/src/server/route-modules/app-page/module.compiled.js","../../../../node_modules/next/src/server/route-modules/app-page/vendored/rsc/react-jsx-runtime.ts","../../../../node_modules/next/src/server/route-modules/app-page/vendored/rsc/react.ts"],"sourcesContent":["// This file is generated by next-core EcmascriptClientReferenceModule.\nconst { createClientModuleProxy } = require(\"react-server-dom-turbopack/server\");\n\n__turbopack_context__.n(createClientModuleProxy(\"[project]/node_modules/next/dist/client/components/builtin/global-error.js\"));\n","'use client'\n\nimport { HandleISRError } from '../handle-isr-error'\n\nconst styles = {\n error: {\n // https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52\n fontFamily:\n 'system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"',\n height: '100vh',\n textAlign: 'center',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n text: {\n fontSize: '14px',\n fontWeight: 400,\n lineHeight: '28px',\n margin: '0 8px',\n },\n} as const\n\nexport type GlobalErrorComponent = React.ComponentType<{\n error: any\n}>\nfunction DefaultGlobalError({ error }: { error: any }) {\n const digest: string | undefined = error?.digest\n return (\n <html id=\"__next_error__\">\n <head></head>\n <body>\n <HandleISRError error={error} />\n <div style={styles.error}>\n <div>\n <h2 style={styles.text}>\n Application error: a {digest ? 'server' : 'client'}-side exception\n has occurred while loading {window.location.hostname} (see the{' '}\n {digest ? 'server logs' : 'browser console'} for more\n information).\n </h2>\n {digest ? <p style={styles.text}>{`Digest: ${digest}`}</p> : null}\n </div>\n </div>\n </body>\n </html>\n )\n}\n\n// Exported so that the import signature in the loaders can be identical to user\n// supplied custom global error signatures.\nexport default DefaultGlobalError\n","module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['react-rsc']!.ReactServerDOMTurbopackServer\n","if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/app-page/module.js')\n} else {\n if (process.env.__NEXT_EXPERIMENTAL_REACT) {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo-experimental.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page-experimental.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page-experimental.runtime.prod.js')\n }\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page.runtime.prod.js')\n }\n }\n }\n}\n","module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['react-rsc']!.ReactJsxRuntime\n","module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['react-rsc']!.React\n"],"names":["styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","text","fontSize","fontWeight","lineHeight","margin","DefaultGlobalError","digest","html","id","head","body","HandleISRError","div","style","h2","window","location","hostname","p","module","exports","require","vendored","ReactServerDOMTurbopackServer","process","env","NEXT_RUNTIME","__NEXT_EXPERIMENTAL_REACT","NODE_ENV","TURBOPACK","ReactJsxRuntime","React"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/next/dist/client/components/builtin/global-error.js/__nextjs-internal-proxy.cjs","../../../../node_modules/next/src/client/components/builtin/global-error.tsx","../../../../node_modules/next/src/server/route-modules/app-page/vendored/rsc/react-server-dom-turbopack-server.ts","../../../../node_modules/next/src/server/route-modules/app-page/module.compiled.js","../../../../node_modules/next/src/server/route-modules/app-page/vendored/rsc/react-jsx-runtime.ts","../../../../node_modules/next/src/server/route-modules/app-page/vendored/rsc/react.ts"],"sourcesContent":["// This file is generated by next-core EcmascriptClientReferenceModule.\nconst { createClientModuleProxy } = require(\"react-server-dom-turbopack/server\");\n\n__turbopack_context__.n(createClientModuleProxy(\"[project]/node_modules/next/dist/client/components/builtin/global-error.js\"));\n","'use client'\n\nimport { HandleISRError } from '../handle-isr-error'\n\nconst styles = {\n error: {\n // https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52\n fontFamily:\n 'system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"',\n height: '100vh',\n textAlign: 'center',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n text: {\n fontSize: '14px',\n fontWeight: 400,\n lineHeight: '28px',\n margin: '0 8px',\n },\n} as const\n\nexport type GlobalErrorComponent = React.ComponentType<{\n error: any\n}>\nfunction DefaultGlobalError({ error }: { error: any }) {\n const digest: string | undefined = error?.digest\n return (\n <html id=\"__next_error__\">\n <head></head>\n <body>\n <HandleISRError error={error} />\n <div style={styles.error}>\n <div>\n <h2 style={styles.text}>\n Application error: a {digest ? 'server' : 'client'}-side exception\n has occurred while loading {window.location.hostname} (see the{' '}\n {digest ? 'server logs' : 'browser console'} for more\n information).\n </h2>\n {digest ? <p style={styles.text}>{`Digest: ${digest}`}</p> : null}\n </div>\n </div>\n </body>\n </html>\n )\n}\n\n// Exported so that the import signature in the loaders can be identical to user\n// supplied custom global error signatures.\nexport default DefaultGlobalError\n","module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['react-rsc']!.ReactServerDOMTurbopackServer\n","if (process.env.NEXT_RUNTIME === 'edge') {\n module.exports = require('next/dist/server/route-modules/app-page/module.js')\n} else {\n if (process.env.__NEXT_EXPERIMENTAL_REACT) {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo-experimental.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page-experimental.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page-experimental.runtime.prod.js')\n }\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo.runtime.dev.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page.runtime.dev.js')\n }\n } else {\n if (process.env.TURBOPACK) {\n module.exports = require('next/dist/compiled/next-server/app-page-turbo.runtime.prod.js')\n } else {\n module.exports = require('next/dist/compiled/next-server/app-page.runtime.prod.js')\n }\n }\n }\n}\n","module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['react-rsc']!.ReactJsxRuntime\n","module.exports = (\n require('../../module.compiled') as typeof import('../../module.compiled')\n).vendored['react-rsc']!.React\n"],"names":["styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","text","fontSize","fontWeight","lineHeight","margin","DefaultGlobalError","digest","html","id","head","body","HandleISRError","div","style","h2","window","location","hostname","p","module","exports","require","vendored","ReactServerDOMTurbopackServer","process","env","NEXT_RUNTIME","__NEXT_EXPERIMENTAL_REACT","NODE_ENV","TURBOPACK","ReactJsxRuntime","React"],"mappings":"4tBACA,GAAM,CAAE,yBAAuB,CAAE,CAAA,EAAA,CAAA,CAAA,OAEjC,EAAsB,CAAC,CAAC,EAAwB,oHAFhD,GAAM,yBAAE,CAAuB,CAAE,CAAA,EAAA,CAAA,CAAA,OAEjC,EAAsB,CAAC,CAAC,EAAwB,+rBEHhD4B,GAAOC,OAAO,CACZC,EAAQ,CAAA,CAAA,IAAA,GACRC,QAAQ,CAAC,YAAY,CAAEC,6BAA6B,0FCwB9CJ,EAAOC,OAAO,CAAGC,EAAQ,CAAA,CAAA,IAAA,gCC1BjCF,EAAOC,OAAO,CACZC,EAAQ,CAAA,CAAA,IAAA,GACRC,QAAQ,CAAC,YAAY,CAAEQ,eAAe,6BCFxCX,EAAOC,OAAO,CACZC,EAAQ,CAAA,CAAA,IAAA,GACRC,QAAQ,CAAC,YAAY,CAAES,KAAK","ignoreList":[0,2,3,4,5]}
|