@seqyuan/annodex 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -0
- package/.next/app-path-routes-manifest.json +39 -0
- package/.next/build-manifest.json +20 -0
- package/.next/diagnostics/build-diagnostics.json +6 -0
- package/.next/diagnostics/framework.json +1 -0
- package/.next/export-marker.json +6 -0
- package/.next/images-manifest.json +68 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +109 -0
- package/.next/react-loadable-manifest.json +2320 -0
- package/.next/required-server-files.js +343 -0
- package/.next/required-server-files.json +343 -0
- package/.next/routes-manifest.json +286 -0
- package/.next/server/app/_global-error/page.js +32 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -0
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_global-error.html +1 -0
- package/.next/server/app/_global-error.meta +16 -0
- package/.next/server/app/_global-error.rsc +14 -0
- package/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
- package/.next/server/app/_not-found/page.js +2 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +16 -0
- package/.next/server/app/_not-found.rsc +18 -0
- package/.next/server/app/_not-found.segments/_full.segment.rsc +18 -0
- package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -0
- package/.next/server/app/api/agent/[id]/events/route.js +3 -0
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/agent/[id]/route.js +1 -0
- package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/agent/new/route.js +1 -0
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/new/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/all-providers/route.js +1 -0
- package/.next/server/app/api/auth/all-providers/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/all-providers/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -0
- package/.next/server/app/api/auth/api-key/[provider]/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/api-key/[provider]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/login/[provider]/route.js +1 -0
- package/.next/server/app/api/auth/login/[provider]/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/login/[provider]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/login/route.js +1 -0
- package/.next/server/app/api/auth/login/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/logout/[provider]/route.js +1 -0
- package/.next/server/app/api/auth/logout/[provider]/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/logout/[provider]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/providers/route.js +1 -0
- package/.next/server/app/api/auth/providers/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/providers/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/status/route.js +1 -0
- package/.next/server/app/api/auth/status/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/default-cwd/route.js +1 -0
- package/.next/server/app/api/default-cwd/route.js.nft.json +1 -0
- package/.next/server/app/api/default-cwd/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/files/[...path]/route.js +4 -0
- package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/harness/route.js +1 -0
- package/.next/server/app/api/harness/route.js.nft.json +1 -0
- package/.next/server/app/api/harness/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/home/route.js +1 -0
- package/.next/server/app/api/home/route.js.nft.json +1 -0
- package/.next/server/app/api/home/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/internal/runtime/route.js +1 -0
- package/.next/server/app/api/internal/runtime/route.js.nft.json +1 -0
- package/.next/server/app/api/internal/runtime/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models/route.js +1 -0
- package/.next/server/app/api/models/route.js.nft.json +1 -0
- package/.next/server/app/api/models/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models-config/discover/route.js +1 -0
- package/.next/server/app/api/models-config/discover/route.js.nft.json +1 -0
- package/.next/server/app/api/models-config/discover/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models-config/route.js +1 -0
- package/.next/server/app/api/models-config/route.js.nft.json +1 -0
- package/.next/server/app/api/models-config/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models-config/test/route.js +1 -0
- package/.next/server/app/api/models-config/test/route.js.nft.json +1 -0
- package/.next/server/app/api/models-config/test/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/projects/browse/route.js +1 -0
- package/.next/server/app/api/projects/browse/route.js.nft.json +1 -0
- package/.next/server/app/api/projects/browse/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/projects/route.js +1 -0
- package/.next/server/app/api/projects/route.js.nft.json +1 -0
- package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/reports/[id]/route.js +10 -0
- package/.next/server/app/api/reports/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/reports/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/search/route.js +1 -0
- package/.next/server/app/api/search/route.js.nft.json +1 -0
- package/.next/server/app/api/search/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/[id]/context/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/[id]/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/new/route.js +1 -0
- package/.next/server/app/api/sessions/new/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/new/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/route.js +1 -0
- package/.next/server/app/api/sessions/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/settings/route.js +1 -0
- package/.next/server/app/api/settings/route.js.nft.json +1 -0
- package/.next/server/app/api/settings/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/install/route.js +5 -0
- package/.next/server/app/api/skills/install/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/route.js +6 -0
- package/.next/server/app/api/skills/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/search/route.js +1 -0
- package/.next/server/app/api/skills/search/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/search/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/soul/route.js +1 -0
- package/.next/server/app/api/soul/route.js.nft.json +1 -0
- package/.next/server/app/api/soul/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/version/route.js +1 -0
- package/.next/server/app/api/version/route.js.nft.json +1 -0
- package/.next/server/app/api/version/route_client-reference-manifest.js +1 -0
- package/.next/server/app/index.html +1 -0
- package/.next/server/app/index.meta +14 -0
- package/.next/server/app/index.rsc +17 -0
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -0
- package/.next/server/app/index.segments/_full.segment.rsc +17 -0
- package/.next/server/app/index.segments/_head.segment.rsc +6 -0
- package/.next/server/app/index.segments/_index.segment.rsc +5 -0
- package/.next/server/app/index.segments/_tree.segment.rsc +4 -0
- package/.next/server/app/login/page.js +2 -0
- package/.next/server/app/login/page.js.nft.json +1 -0
- package/.next/server/app/login/page_client-reference-manifest.js +1 -0
- package/.next/server/app/login.html +1 -0
- package/.next/server/app/login.meta +15 -0
- package/.next/server/app/login.rsc +22 -0
- package/.next/server/app/login.segments/_full.segment.rsc +22 -0
- package/.next/server/app/login.segments/_head.segment.rsc +6 -0
- package/.next/server/app/login.segments/_index.segment.rsc +5 -0
- package/.next/server/app/login.segments/_tree.segment.rsc +4 -0
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +9 -0
- package/.next/server/app/login.segments/login.segment.rsc +5 -0
- package/.next/server/app/page.js +261 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +39 -0
- package/.next/server/chunks/1048.js +1 -0
- package/.next/server/chunks/1367.js +77 -0
- package/.next/server/chunks/1381.js +1 -0
- package/.next/server/chunks/165.js +1 -0
- package/.next/server/chunks/1681.js +215 -0
- package/.next/server/chunks/1688.js +45 -0
- package/.next/server/chunks/1703.js +79 -0
- package/.next/server/chunks/1712.js +43 -0
- package/.next/server/chunks/1813.js +1 -0
- package/.next/server/chunks/2325.js +80 -0
- package/.next/server/chunks/258.js +1 -0
- package/.next/server/chunks/2671.js +287 -0
- package/.next/server/chunks/2778.js +1 -0
- package/.next/server/chunks/2943.js +1 -0
- package/.next/server/chunks/3031.js +226 -0
- package/.next/server/chunks/3181.js +1 -0
- package/.next/server/chunks/3493.js +1 -0
- package/.next/server/chunks/3672.js +1 -0
- package/.next/server/chunks/3701.js +104 -0
- package/.next/server/chunks/4013.js +1 -0
- package/.next/server/chunks/402.js +2 -0
- package/.next/server/chunks/4035.js +80 -0
- package/.next/server/chunks/4248.js +153 -0
- package/.next/server/chunks/4367.js +1 -0
- package/.next/server/chunks/4406.js +141 -0
- package/.next/server/chunks/4741.js +18 -0
- package/.next/server/chunks/4768.js +1 -0
- package/.next/server/chunks/4858.js +148 -0
- package/.next/server/chunks/4980.js +1 -0
- package/.next/server/chunks/5155.js +5 -0
- package/.next/server/chunks/5293.js +166 -0
- package/.next/server/chunks/5399.js +8 -0
- package/.next/server/chunks/5409.js +1 -0
- package/.next/server/chunks/5797.js +93 -0
- package/.next/server/chunks/5851.js +36 -0
- package/.next/server/chunks/6206.js +1 -0
- package/.next/server/chunks/6296.js +1 -0
- package/.next/server/chunks/63.js +45 -0
- package/.next/server/chunks/6346.js +1 -0
- package/.next/server/chunks/6406.js +23 -0
- package/.next/server/chunks/642.js +1 -0
- package/.next/server/chunks/6429.js +50 -0
- package/.next/server/chunks/6729.js +64 -0
- package/.next/server/chunks/6907.js +115 -0
- package/.next/server/chunks/6980.js +1 -0
- package/.next/server/chunks/7073.js +24 -0
- package/.next/server/chunks/7233.js +24 -0
- package/.next/server/chunks/7307.js +1 -0
- package/.next/server/chunks/7362.js +9 -0
- package/.next/server/chunks/7567.js +29 -0
- package/.next/server/chunks/7765.js +1 -0
- package/.next/server/chunks/7890.js +1 -0
- package/.next/server/chunks/8065.js +1 -0
- package/.next/server/chunks/8238.js +34 -0
- package/.next/server/chunks/8276.js +1 -0
- package/.next/server/chunks/8336.js +1 -0
- package/.next/server/chunks/8477.js +3 -0
- package/.next/server/chunks/8490.js +1 -0
- package/.next/server/chunks/8916.js +1 -0
- package/.next/server/chunks/9280.js +252 -0
- package/.next/server/chunks/9315.js +1 -0
- package/.next/server/chunks/9537.js +90 -0
- package/.next/server/chunks/966.js +1 -0
- package/.next/server/chunks/9818.js +21 -0
- package/.next/server/chunks/static/media/pdf.worker.min.c476e1a0.mjs +6 -0
- package/.next/server/functions-config-manifest.json +16 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/middleware.js +18 -0
- package/.next/server/middleware.js.nft.json +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages-manifest.json +4 -0
- package/.next/server/prefetch-hints.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/chunks/0b9a0da7.9075af772487e743.js +62 -0
- package/.next/static/chunks/1413.922d232de90c0c41.js +115 -0
- package/.next/static/chunks/1643.467a526a1f24f54d.js +24 -0
- package/.next/static/chunks/1852.5543122f11aa7fed.js +1 -0
- package/.next/static/chunks/1960.b1e26436d7a5f586.js +1 -0
- package/.next/static/chunks/2170a4aa.4213bb2183c9cdf9.js +1 -0
- package/.next/static/chunks/2274.6cd173f80a1405a2.js +21 -0
- package/.next/static/chunks/2419.347fdfe3c170854d.js +166 -0
- package/.next/static/chunks/2619.9aac8983f30c7c8a.js +1 -0
- package/.next/static/chunks/2623.d20fabd8e18197c6.js +287 -0
- package/.next/static/chunks/2729.f5365061a849d659.js +34 -0
- package/.next/static/chunks/2821.934bcf60fbdc28c6.js +1 -0
- package/.next/static/chunks/2918becc.abff2ece1de37bc1.js +153 -0
- package/.next/static/chunks/2947.114e51cb06d1c01a.js +23 -0
- package/.next/static/chunks/3079.4c511fa1144e3adf.js +79 -0
- package/.next/static/chunks/3274.208ca44844cd7d95.js +148 -0
- package/.next/static/chunks/3308.465a94263d04bfea.js +73 -0
- package/.next/static/chunks/3325.e4bfe1ca657f3b5b.js +80 -0
- package/.next/static/chunks/3506.2a7eaa08b9f55337.js +90 -0
- package/.next/static/chunks/363642f4-043c1475ab9af70e.js +1 -0
- package/.next/static/chunks/3794-123fdf632563f469.js +32 -0
- package/.next/static/chunks/3837.a755ccfe6f9c1c1c.js +5 -0
- package/.next/static/chunks/394.91597771688df6d0.js +1 -0
- package/.next/static/chunks/3997.1009c06025691712.js +1 -0
- package/.next/static/chunks/4453.91a357dc43c21745.js +1 -0
- package/.next/static/chunks/4491.44fdf20580ac72bd.js +24 -0
- package/.next/static/chunks/4829.cf1d50e43e6d9db5.js +1 -0
- package/.next/static/chunks/498.fe1d9da9ecad6c36.js +1 -0
- package/.next/static/chunks/4bd1b696-e356ca5ba0218e27.js +1 -0
- package/.next/static/chunks/5019.b5a1a2b8daf17525.js +1 -0
- package/.next/static/chunks/5034.8f16c3fa3ce75411.js +1 -0
- package/.next/static/chunks/5074.d16651da01ec4e02.js +1 -0
- package/.next/static/chunks/51fb665c.0950e1b79671348d.js +45 -0
- package/.next/static/chunks/532.5956ed631aff722b.js +9 -0
- package/.next/static/chunks/5326.69460442bdcd6cd3.js +1 -0
- package/.next/static/chunks/5403.ff110bf5bf600758.js +64 -0
- package/.next/static/chunks/547.902a733488cfe3f7.js +77 -0
- package/.next/static/chunks/5567.540d7fc108ad6ee5.js +215 -0
- package/.next/static/chunks/5590.ef62922166d308b4.js +1 -0
- package/.next/static/chunks/5690.9d6eb1edb1399995.js +1 -0
- package/.next/static/chunks/5749.25faee4a1e55b854.js +226 -0
- package/.next/static/chunks/58bb9007.1ccb6bba34b4c635.js +80 -0
- package/.next/static/chunks/6121.f3f43f1896ea0cd9.js +1 -0
- package/.next/static/chunks/6600.583c88eef37aa524.js +1 -0
- package/.next/static/chunks/6696.a41aec266e657d54.js +141 -0
- package/.next/static/chunks/6922.42148793782d2fe7.js +1 -0
- package/.next/static/chunks/7006.e191611ffc2b9528.js +43 -0
- package/.next/static/chunks/7343.9fbb58204d8ac681.js +1 -0
- package/.next/static/chunks/73972abe.25a4cffa03b2bcef.js +119 -0
- package/.next/static/chunks/7547.58bda8a2aabba0d4.js +93 -0
- package/.next/static/chunks/7648.4ae2f183b4db0353.js +1 -0
- package/.next/static/chunks/7874.8db6929b94cdf697.js +1 -0
- package/.next/static/chunks/7959.1f20a35df316216a.js +104 -0
- package/.next/static/chunks/83.85d62d7fc9850b75.js +29 -0
- package/.next/static/chunks/8436.cab94b59cca0a8ff.js +1 -0
- package/.next/static/chunks/8451.ff6ff72b57dc52e1.js +1 -0
- package/.next/static/chunks/8489.45f22859734f514f.js +36 -0
- package/.next/static/chunks/8568.f85d8b36fc9a9037.js +1 -0
- package/.next/static/chunks/8771-3e14b6810486df1f.js +1 -0
- package/.next/static/chunks/8863.be51033a67436277.js +1 -0
- package/.next/static/chunks/90542734.dc1a2723e4f6affb.js +1 -0
- package/.next/static/chunks/9500.1488aec06ee78127.js +1 -0
- package/.next/static/chunks/9633.155548b5fca6e580.js +1 -0
- package/.next/static/chunks/9779.673004a62d70e36a.js +1 -0
- package/.next/static/chunks/app/_global-error/page-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/_not-found/page-c72daab99269beff.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/all-providers/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/login/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/status/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/harness/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/home/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/internal/runtime/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/models/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/models-config/discover/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/models-config/test/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/projects/browse/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/projects/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/reports/[id]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/search/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/sessions/new/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/settings/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/skills/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/soul/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/version/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/layout-be148b7ae915b22a.js +1 -0
- package/.next/static/chunks/app/login/page-ebf0e6de99062783.js +1 -0
- package/.next/static/chunks/app/page-0594cb7a3cbb0211.js +260 -0
- package/.next/static/chunks/d3ac728e.7964f816a1ca64e5.js +1 -0
- package/.next/static/chunks/framework-711ef29bc66f648c.js +1 -0
- package/.next/static/chunks/main-app-45a0f19af99d61b6.js +1 -0
- package/.next/static/chunks/main-f74964b7ae52493e.js +5 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/global-error-9bfa08b9491621f2.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-fcf4a889ecbd753c.js +1 -0
- package/.next/static/css/45029451a1d7255d.css +3 -0
- package/.next/static/media/15605e25b523335c-s.woff2 +0 -0
- package/.next/static/media/1a3dce5cfb5f7760-s.woff2 +0 -0
- package/.next/static/media/1cdd02902f937a18-s.woff2 +0 -0
- package/.next/static/media/4c4b3b30b6bcb2be-s.woff2 +0 -0
- package/.next/static/media/641a7b8a5800ee0e-s.woff2 +0 -0
- package/.next/static/media/7deddc85b7ffd1dc-s.p.woff2 +0 -0
- package/.next/static/media/ec14413c594b3356-s.p.woff2 +0 -0
- package/.next/static/media/pdf.worker.min.29aaf158.mjs +6 -0
- package/.next/static/nmfQlwnkhzbPmuiCmhW-_/_buildManifest.js +1 -0
- package/.next/static/nmfQlwnkhzbPmuiCmhW-_/_ssgManifest.js +1 -0
- package/package.json +21 -21
- package/app/api/agent/[id]/events/route.ts +0 -94
- package/app/api/agent/[id]/route.ts +0 -83
- package/app/api/agent/new/route.ts +0 -53
- package/app/api/auth/all-providers/route.ts +0 -21
- package/app/api/auth/api-key/[provider]/route.ts +0 -7
- package/app/api/auth/login/[provider]/route.ts +0 -7
- package/app/api/auth/login/route.ts +0 -22
- package/app/api/auth/logout/[provider]/route.ts +0 -7
- package/app/api/auth/providers/route.ts +0 -15
- package/app/api/auth/status/route.ts +0 -6
- package/app/api/default-cwd/route.ts +0 -22
- package/app/api/files/[...path]/route.ts +0 -621
- package/app/api/harness/route.ts +0 -47
- package/app/api/home/route.ts +0 -6
- package/app/api/internal/runtime/route.ts +0 -26
- package/app/api/models/route.ts +0 -67
- package/app/api/models-config/discover/route.ts +0 -42
- package/app/api/models-config/route.ts +0 -152
- package/app/api/models-config/test/route.ts +0 -154
- package/app/api/projects/browse/route.ts +0 -51
- package/app/api/projects/route.ts +0 -83
- package/app/api/reports/[id]/route.ts +0 -108
- package/app/api/search/route.ts +0 -122
- package/app/api/sessions/[id]/context/route.ts +0 -23
- package/app/api/sessions/[id]/route.ts +0 -124
- package/app/api/sessions/new/route.ts +0 -5
- package/app/api/sessions/route.ts +0 -16
- package/app/api/settings/route.ts +0 -51
- package/app/api/skills/install/route.ts +0 -249
- package/app/api/skills/route.ts +0 -161
- package/app/api/skills/search/route.ts +0 -121
- package/app/api/soul/route.ts +0 -47
- package/app/api/version/route.ts +0 -55
- package/app/globals.css +0 -736
- package/app/layout.tsx +0 -40
- package/app/login/page.tsx +0 -133
- package/app/page.tsx +0 -10
- package/components/AppShell.tsx +0 -1058
- package/components/ChatInput.tsx +0 -1103
- package/components/ChatMinimap.tsx +0 -381
- package/components/ChatWindow.tsx +0 -576
- package/components/CodeMirrorEditor.tsx +0 -137
- package/components/ConversationSearch.tsx +0 -369
- package/components/DataTableViewer.tsx +0 -248
- package/components/FileExplorer.tsx +0 -758
- package/components/FileIcons.tsx +0 -241
- package/components/FileViewer.tsx +0 -1273
- package/components/GlobalFileEditor.tsx +0 -98
- package/components/MarkdownRenderer.tsx +0 -331
- package/components/MermaidDiagram.tsx +0 -80
- package/components/MessageView.tsx +0 -1141
- package/components/ModelsConfig.tsx +0 -1991
- package/components/ProjectContext.tsx +0 -252
- package/components/ProjectFolderPicker.tsx +0 -202
- package/components/ProjectsConfig.tsx +0 -288
- package/components/ProviderIcons.tsx +0 -91
- package/components/ReportPanel.tsx +0 -237
- package/components/ResizeHandle.tsx +0 -105
- package/components/SessionSidebar.tsx +0 -1464
- package/components/SettingsDialog.tsx +0 -287
- package/components/SkillsConfig.tsx +0 -1093
- package/components/SubagentPanel.tsx +0 -191
- package/components/TabBar.tsx +0 -115
- package/components/ToolPanel.tsx +0 -131
- package/components/WidgetRenderer.tsx +0 -505
- package/components/viewers/DocumentToolbar.tsx +0 -78
- package/components/viewers/DocxViewer.tsx +0 -97
- package/components/viewers/PdfViewer.tsx +0 -206
- package/components/viewers/PptxViewer.tsx +0 -240
- package/components/viewers/XlsxViewer.tsx +0 -143
- package/hooks/useAgentSession.ts +0 -710
- package/hooks/useAudio.ts +0 -50
- package/hooks/useDragDrop.ts +0 -52
- package/hooks/useResizable.ts +0 -60
- package/hooks/useTheme.ts +0 -85
- package/lib/agent-client.ts +0 -39
- package/lib/annodex-config.ts +0 -556
- package/lib/auth-token.ts +0 -74
- package/lib/auth.ts +0 -90
- package/lib/brand.ts +0 -5
- package/lib/code-theme.ts +0 -32
- package/lib/codex-compat-proxy.ts +0 -1603
- package/lib/codex-home.ts +0 -6
- package/lib/codex-server.ts +0 -796
- package/lib/codex-session.ts +0 -590
- package/lib/codex-usage.ts +0 -213
- package/lib/file-paths.ts +0 -34
- package/lib/model-discovery.ts +0 -379
- package/lib/normalize.ts +0 -30
- package/lib/npx.ts +0 -87
- package/lib/pi-types.ts +0 -49
- package/lib/projects.ts +0 -269
- package/lib/provider-api.ts +0 -88
- package/lib/report-prompt.ts +0 -61
- package/lib/report-store.ts +0 -597
- package/lib/report-update-parser.ts +0 -66
- package/lib/rpc-manager.ts +0 -668
- package/lib/runtime-state.ts +0 -117
- package/lib/session-reader.ts +0 -903
- package/lib/session-runtime.ts +0 -105
- package/lib/subagent-progress.ts +0 -279
- package/lib/types.ts +0 -241
- package/lib/widget-export.ts +0 -318
- package/lib/widget-guidelines.ts +0 -288
- package/lib/widget-prompt.ts +0 -76
- package/lib/widget-utils.ts +0 -523
- package/postcss.config.mjs +0 -8
- package/proxy.ts +0 -64
- package/scripts/postinstall.cjs +0 -25
- package/tsconfig.json +0 -41
package/hooks/useAgentSession.ts
DELETED
|
@@ -1,710 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useState, useCallback, useRef, useEffect, useReducer } from "react";
|
|
4
|
-
import type { AgentMessage, SessionInfo, SubagentRun } from "@/lib/types";
|
|
5
|
-
import { normalizeToolCalls } from "@/lib/normalize";
|
|
6
|
-
import { sendAgentCommand } from "@/lib/agent-client";
|
|
7
|
-
import type { ToolEntry } from "@/components/ToolPanel";
|
|
8
|
-
import { coerceSubagentRuns, mergeSubagentRuns } from "@/lib/subagent-progress";
|
|
9
|
-
|
|
10
|
-
export interface SessionData {
|
|
11
|
-
sessionId: string;
|
|
12
|
-
filePath: string;
|
|
13
|
-
info?: SessionInfo | null;
|
|
14
|
-
leafId: string | null;
|
|
15
|
-
context: {
|
|
16
|
-
messages: AgentMessage[];
|
|
17
|
-
entryIds: string[];
|
|
18
|
-
thinkingLevel: string;
|
|
19
|
-
model: { provider: string; modelId: string } | null;
|
|
20
|
-
subagentRuns?: SubagentRun[];
|
|
21
|
-
sessionStats?: { tokens: { input: number; output: number; cacheRead: number; cacheWrite: number }; cost?: number } | null;
|
|
22
|
-
contextUsage?: { percent: number | null; contextWindow: number; tokens: number | null } | null;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface StreamingState {
|
|
27
|
-
isStreaming: boolean;
|
|
28
|
-
streamingMessage: Partial<AgentMessage> | null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type StreamAction =
|
|
32
|
-
| { type: "start" }
|
|
33
|
-
| { type: "update"; message: Partial<AgentMessage> }
|
|
34
|
-
| { type: "end" }
|
|
35
|
-
| { type: "reset" };
|
|
36
|
-
|
|
37
|
-
function streamReducer(state: StreamingState, action: StreamAction): StreamingState {
|
|
38
|
-
switch (action.type) {
|
|
39
|
-
case "start":
|
|
40
|
-
return { isStreaming: true, streamingMessage: null };
|
|
41
|
-
case "update":
|
|
42
|
-
return { isStreaming: true, streamingMessage: action.message };
|
|
43
|
-
case "end":
|
|
44
|
-
case "reset":
|
|
45
|
-
return { isStreaming: false, streamingMessage: null };
|
|
46
|
-
default:
|
|
47
|
-
return state;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface AgentEvent {
|
|
52
|
-
type: string;
|
|
53
|
-
[key: string]: unknown;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
type AgentCommandResult<T> = T & { __sessionId?: string };
|
|
57
|
-
|
|
58
|
-
export type AgentPhase =
|
|
59
|
-
| { kind: "waiting_model" }
|
|
60
|
-
| { kind: "running_tools"; tools: { id: string; name: string }[] }
|
|
61
|
-
| null;
|
|
62
|
-
|
|
63
|
-
export interface UseAgentSessionOptions {
|
|
64
|
-
session: SessionInfo | null;
|
|
65
|
-
newSessionCwd: string | null;
|
|
66
|
-
onAgentEnd?: () => void;
|
|
67
|
-
onSessionCreated?: (session: SessionInfo) => void;
|
|
68
|
-
onSessionForked?: (newSessionId: string) => void;
|
|
69
|
-
modelsRefreshKey?: number;
|
|
70
|
-
chatInputRef?: React.RefObject<ChatInputHandle | null>;
|
|
71
|
-
onSystemPromptChange?: (prompt: string | null) => void;
|
|
72
|
-
setNewSessionModel?: (model: { provider: string; modelId: string } | null) => void;
|
|
73
|
-
setToolPreset?: (preset: "none" | "default" | "full") => void;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export type ThinkingLevelOption = "auto" | "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
77
|
-
|
|
78
|
-
export interface ChatInputHandle {
|
|
79
|
-
insertText: (text: string) => void;
|
|
80
|
-
insertIfEmpty: (content: string) => void;
|
|
81
|
-
addImages: (files: File[]) => void;
|
|
82
|
-
addFiles: (files: File[]) => void;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface AttachedImage {
|
|
86
|
-
data: string;
|
|
87
|
-
mimeType: string;
|
|
88
|
-
previewUrl: string;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface AttachedDocument {
|
|
92
|
-
data: ArrayBuffer;
|
|
93
|
-
fileName: string;
|
|
94
|
-
mimeType: string;
|
|
95
|
-
size: number;
|
|
96
|
-
extractedText?: string;
|
|
97
|
-
extractionError?: string;
|
|
98
|
-
truncated?: boolean;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export function useAgentSession(opts: UseAgentSessionOptions) {
|
|
102
|
-
const {
|
|
103
|
-
session, newSessionCwd, onAgentEnd, onSessionCreated, onSessionForked,
|
|
104
|
-
modelsRefreshKey, onSystemPromptChange,
|
|
105
|
-
} = opts;
|
|
106
|
-
|
|
107
|
-
const isNew = session === null && newSessionCwd !== null;
|
|
108
|
-
|
|
109
|
-
const [data, setData] = useState<SessionData | null>(null);
|
|
110
|
-
const [loading, setLoading] = useState(!isNew);
|
|
111
|
-
const [error, setError] = useState<string | null>(null);
|
|
112
|
-
const [messages, setMessages] = useState<AgentMessage[]>([]);
|
|
113
|
-
const [entryIds, setEntryIds] = useState<string[]>([]);
|
|
114
|
-
const [streamState, dispatch] = useReducer(streamReducer, { isStreaming: false, streamingMessage: null });
|
|
115
|
-
const [agentRunning, setAgentRunning] = useState(false);
|
|
116
|
-
const [modelNames, setModelNames] = useState<Record<string, string>>({});
|
|
117
|
-
const [modelList, setModelList] = useState<{ id: string; name: string; provider: string }[]>([]);
|
|
118
|
-
const [modelThinkingLevels, setModelThinkingLevels] = useState<Record<string, string[]>>({});
|
|
119
|
-
const [modelThinkingLevelMaps, setModelThinkingLevelMaps] = useState<Record<string, Record<string, string | null>>>({});
|
|
120
|
-
const [newSessionModel, setNewSessionModelState] = useState<{ provider: string; modelId: string } | null>(null);
|
|
121
|
-
const [toolPreset, setToolPreset] = useState<"none" | "default" | "full">("full");
|
|
122
|
-
const [thinkingLevel, setThinkingLevel] = useState<ThinkingLevelOption>("auto");
|
|
123
|
-
const [retryInfo, setRetryInfo] = useState<{ attempt: number; maxAttempts: number; errorMessage?: string } | null>(null);
|
|
124
|
-
const [contextUsage, setContextUsage] = useState<{ percent: number | null; contextWindow: number; tokens: number | null } | null>(null);
|
|
125
|
-
const [systemPrompt, setSystemPrompt] = useState<string | null>(null);
|
|
126
|
-
const [forkingEntryId, setForkingEntryId] = useState<string | null>(null);
|
|
127
|
-
const [currentModelOverride, setCurrentModelOverride] = useState<{ provider: string; modelId: string } | null>(null);
|
|
128
|
-
const [pendingModel, setPendingModel] = useState<{ provider: string; modelId: string } | null>(null);
|
|
129
|
-
const [isCompacting, setIsCompacting] = useState(false);
|
|
130
|
-
const [compactError, setCompactError] = useState<string | null>(null);
|
|
131
|
-
const [agentPhase, setAgentPhase] = useState<AgentPhase>(null);
|
|
132
|
-
const [agentError, setAgentError] = useState<string | null>(null);
|
|
133
|
-
const [subagentRuns, setSubagentRuns] = useState<SubagentRun[]>([]);
|
|
134
|
-
|
|
135
|
-
const eventSourceRef = useRef<EventSource | null>(null);
|
|
136
|
-
const sessionIdRef = useRef<string | null>(session?.id ?? null);
|
|
137
|
-
const agentRunningRef = useRef(false);
|
|
138
|
-
const handleAgentEventRef = useRef<((event: AgentEvent) => void) | null>(null);
|
|
139
|
-
const initialScrollDoneRef = useRef(false);
|
|
140
|
-
const lastUserMsgRef = useRef<HTMLDivElement | null>(null);
|
|
141
|
-
const pendingScrollToUserRef = useRef(false);
|
|
142
|
-
const messagesEndRef = useRef<HTMLDivElement | null>(null);
|
|
143
|
-
const scrollContainerRef = useRef<HTMLDivElement | null>(null);
|
|
144
|
-
// Skip the session-change useEffect when handleSend already connected EventSource
|
|
145
|
-
const skipSessionEffectRef = useRef(false);
|
|
146
|
-
|
|
147
|
-
const setNewSessionModel = opts.setNewSessionModel ?? setNewSessionModelState;
|
|
148
|
-
const setToolPresetState = opts.setToolPreset ?? setToolPreset;
|
|
149
|
-
|
|
150
|
-
const currentModel = currentModelOverride ?? data?.context.model ?? pendingModel ?? null;
|
|
151
|
-
const displayModel = isNew ? newSessionModel : currentModel;
|
|
152
|
-
|
|
153
|
-
const buildDocumentAppendix = useCallback((documents?: AttachedDocument[]) => {
|
|
154
|
-
if (!documents?.length) return "";
|
|
155
|
-
return documents.map((doc, index) => {
|
|
156
|
-
const header = `Attachment ${index + 1}: ${doc.fileName} (${doc.mimeType || "application/octet-stream"}, ${doc.size} bytes)`;
|
|
157
|
-
if (doc.extractedText) {
|
|
158
|
-
const note = doc.truncated ? "\n[The extracted text was truncated before sending.]" : "";
|
|
159
|
-
return `${header}\n${note}\n${doc.extractedText}`.trim();
|
|
160
|
-
}
|
|
161
|
-
return `${header}\n[Text extraction unavailable: ${doc.extractionError ?? "unsupported file type"}]`;
|
|
162
|
-
}).join("\n\n---\n\n");
|
|
163
|
-
}, []);
|
|
164
|
-
|
|
165
|
-
const messageSessionStats = (() => {
|
|
166
|
-
const tokens = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
167
|
-
let cost = 0;
|
|
168
|
-
for (const msg of messages) {
|
|
169
|
-
if (msg.role !== "assistant") continue;
|
|
170
|
-
const u = (msg as import("@/lib/types").AssistantMessage).usage;
|
|
171
|
-
if (!u) continue;
|
|
172
|
-
tokens.input += u.input ?? 0;
|
|
173
|
-
tokens.output += u.output ?? 0;
|
|
174
|
-
tokens.cacheRead += u.cacheRead ?? 0;
|
|
175
|
-
tokens.cacheWrite += u.cacheWrite ?? 0;
|
|
176
|
-
cost += u.cost?.total ?? 0;
|
|
177
|
-
}
|
|
178
|
-
const total = tokens.input + tokens.output + tokens.cacheRead + tokens.cacheWrite;
|
|
179
|
-
return total > 0 ? { tokens, cost } : null;
|
|
180
|
-
})();
|
|
181
|
-
const sessionStats = data?.context.sessionStats ?? messageSessionStats;
|
|
182
|
-
|
|
183
|
-
const loadSession = useCallback(async (sid: string, showLoading = false, includeState = false) => {
|
|
184
|
-
try {
|
|
185
|
-
if (showLoading) setLoading(true);
|
|
186
|
-
const url = includeState
|
|
187
|
-
? `/api/sessions/${encodeURIComponent(sid)}?includeState`
|
|
188
|
-
: `/api/sessions/${encodeURIComponent(sid)}`;
|
|
189
|
-
const res = await fetch(url);
|
|
190
|
-
if (res.status === 404) {
|
|
191
|
-
if (showLoading) {
|
|
192
|
-
setData(null);
|
|
193
|
-
setMessages([]);
|
|
194
|
-
setError(null);
|
|
195
|
-
}
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
199
|
-
const d = await res.json() as SessionData & { agentState?: { running: boolean; state?: { isStreaming?: boolean; isCompacting?: boolean; contextUsage?: { percent: number | null; contextWindow: number; tokens: number | null } | null; systemPrompt?: string; thinkingLevel?: string } } };
|
|
200
|
-
setData(d);
|
|
201
|
-
setMessages(d.context.messages);
|
|
202
|
-
setEntryIds(d.context.entryIds ?? []);
|
|
203
|
-
setSubagentRuns(d.context.subagentRuns ?? []);
|
|
204
|
-
if (!d.agentState?.state?.contextUsage && d.context.contextUsage !== undefined) {
|
|
205
|
-
setContextUsage(d.context.contextUsage ?? null);
|
|
206
|
-
}
|
|
207
|
-
setCurrentModelOverride(null);
|
|
208
|
-
setError(null);
|
|
209
|
-
// If no live agent state, fall back to thinking level from session file
|
|
210
|
-
if (!d.agentState?.state?.thinkingLevel && d.context.thinkingLevel && d.context.thinkingLevel !== "off") {
|
|
211
|
-
setThinkingLevel(d.context.thinkingLevel as ThinkingLevelOption);
|
|
212
|
-
}
|
|
213
|
-
return d.agentState ?? null;
|
|
214
|
-
} catch (e) {
|
|
215
|
-
setError(String(e));
|
|
216
|
-
return null;
|
|
217
|
-
} finally {
|
|
218
|
-
if (showLoading) setLoading(false);
|
|
219
|
-
}
|
|
220
|
-
}, []);
|
|
221
|
-
|
|
222
|
-
const loadTools = useCallback(async (sid: string) => {
|
|
223
|
-
try {
|
|
224
|
-
const tools = await sendAgentCommand<ToolEntry[]>(sid, { type: "get_tools" });
|
|
225
|
-
if (tools) {
|
|
226
|
-
const { getPresetFromTools } = await import("@/components/ToolPanel");
|
|
227
|
-
setToolPresetState(getPresetFromTools(tools));
|
|
228
|
-
}
|
|
229
|
-
} catch (e) {
|
|
230
|
-
console.error("Failed to load tools:", e);
|
|
231
|
-
}
|
|
232
|
-
}, [setToolPresetState]);
|
|
233
|
-
|
|
234
|
-
const connectEvents = useCallback((sid: string) => {
|
|
235
|
-
if (eventSourceRef.current) {
|
|
236
|
-
eventSourceRef.current.close();
|
|
237
|
-
eventSourceRef.current = null;
|
|
238
|
-
}
|
|
239
|
-
const es = new EventSource(`/api/agent/${encodeURIComponent(sid)}/events`);
|
|
240
|
-
eventSourceRef.current = es;
|
|
241
|
-
es.onmessage = (e) => {
|
|
242
|
-
try {
|
|
243
|
-
const event = JSON.parse(e.data) as AgentEvent;
|
|
244
|
-
handleAgentEventRef.current?.(event);
|
|
245
|
-
} catch {
|
|
246
|
-
// ignore
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
es.onerror = () => {
|
|
250
|
-
if (eventSourceRef.current === es && agentRunningRef.current) {
|
|
251
|
-
es.close();
|
|
252
|
-
eventSourceRef.current = null;
|
|
253
|
-
setTimeout(() => {
|
|
254
|
-
if (agentRunningRef.current) connectEvents(sid);
|
|
255
|
-
}, 1000);
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
}, []);
|
|
259
|
-
|
|
260
|
-
const waitForEventsConnected = useCallback((sid: string, timeoutMs = 5000) => {
|
|
261
|
-
return new Promise<void>((resolve) => {
|
|
262
|
-
const startedAt = Date.now();
|
|
263
|
-
const tick = () => {
|
|
264
|
-
if (eventSourceRef.current?.readyState === EventSource.OPEN) {
|
|
265
|
-
resolve();
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
if (Date.now() - startedAt >= timeoutMs) {
|
|
269
|
-
resolve();
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
setTimeout(tick, 50);
|
|
273
|
-
};
|
|
274
|
-
connectEvents(sid);
|
|
275
|
-
tick();
|
|
276
|
-
});
|
|
277
|
-
}, [connectEvents]);
|
|
278
|
-
|
|
279
|
-
useEffect(() => {
|
|
280
|
-
agentRunningRef.current = agentRunning;
|
|
281
|
-
}, [agentRunning]);
|
|
282
|
-
|
|
283
|
-
const handleAgentEvent = useCallback((event: AgentEvent) => {
|
|
284
|
-
switch (event.type) {
|
|
285
|
-
case "connected": {
|
|
286
|
-
const replacementSessionId = typeof event.sessionId === "string" ? event.sessionId : null;
|
|
287
|
-
if (replacementSessionId && sessionIdRef.current && replacementSessionId !== sessionIdRef.current) {
|
|
288
|
-
sessionIdRef.current = replacementSessionId;
|
|
289
|
-
onSessionForked?.(replacementSessionId);
|
|
290
|
-
}
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
case "agent_start":
|
|
294
|
-
setAgentError(null);
|
|
295
|
-
setAgentRunning(true);
|
|
296
|
-
agentRunningRef.current = true;
|
|
297
|
-
setAgentPhase({ kind: "waiting_model" });
|
|
298
|
-
dispatch({ type: "start" });
|
|
299
|
-
break;
|
|
300
|
-
case "agent_end":
|
|
301
|
-
setAgentRunning(false);
|
|
302
|
-
agentRunningRef.current = false;
|
|
303
|
-
setAgentPhase(null);
|
|
304
|
-
setRetryInfo(null);
|
|
305
|
-
setAgentError(typeof event.error === "string" ? event.error : null);
|
|
306
|
-
dispatch({ type: "end" });
|
|
307
|
-
if (sessionIdRef.current) {
|
|
308
|
-
loadSession(sessionIdRef.current);
|
|
309
|
-
fetch(`/api/agent/${encodeURIComponent(sessionIdRef.current)}`)
|
|
310
|
-
.then((r) => r.json())
|
|
311
|
-
.then((d: { state?: { contextUsage?: { percent: number | null; contextWindow: number; tokens: number | null } | null; systemPrompt?: string } }) => {
|
|
312
|
-
if (d.state?.contextUsage !== undefined) setContextUsage(d.state.contextUsage ?? null);
|
|
313
|
-
if (d.state?.systemPrompt !== undefined) setSystemPrompt(d.state.systemPrompt ?? null);
|
|
314
|
-
})
|
|
315
|
-
.catch(() => {});
|
|
316
|
-
}
|
|
317
|
-
onAgentEnd?.();
|
|
318
|
-
break;
|
|
319
|
-
case "message_start":
|
|
320
|
-
case "message_update": {
|
|
321
|
-
const msg = event.message as Partial<AgentMessage> | undefined;
|
|
322
|
-
if (msg) {
|
|
323
|
-
dispatch({ type: "update", message: normalizeToolCalls(msg as AgentMessage) });
|
|
324
|
-
}
|
|
325
|
-
setAgentPhase(null);
|
|
326
|
-
break;
|
|
327
|
-
}
|
|
328
|
-
case "message_end": {
|
|
329
|
-
const completed = event.message as AgentMessage | undefined;
|
|
330
|
-
if (completed) {
|
|
331
|
-
setMessages((prev) => [...prev, normalizeToolCalls(completed)]);
|
|
332
|
-
}
|
|
333
|
-
dispatch({ type: "reset" });
|
|
334
|
-
setAgentPhase({ kind: "waiting_model" });
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
case "tool_execution_start": {
|
|
338
|
-
const id = event.toolCallId as string;
|
|
339
|
-
const name = event.toolName as string;
|
|
340
|
-
setAgentPhase((prev) => {
|
|
341
|
-
const tools = prev?.kind === "running_tools" ? [...prev.tools] : [];
|
|
342
|
-
if (!tools.some((t) => t.id === id)) tools.push({ id, name });
|
|
343
|
-
return { kind: "running_tools", tools };
|
|
344
|
-
});
|
|
345
|
-
break;
|
|
346
|
-
}
|
|
347
|
-
case "tool_execution_end": {
|
|
348
|
-
const id = event.toolCallId as string;
|
|
349
|
-
setAgentPhase((prev) => {
|
|
350
|
-
if (prev?.kind !== "running_tools") return prev;
|
|
351
|
-
const tools = prev.tools.filter((t) => t.id !== id);
|
|
352
|
-
if (tools.length === 0) return { kind: "waiting_model" };
|
|
353
|
-
return { kind: "running_tools", tools };
|
|
354
|
-
});
|
|
355
|
-
break;
|
|
356
|
-
}
|
|
357
|
-
case "subagent_progress": {
|
|
358
|
-
const runs = coerceSubagentRuns(event.runs);
|
|
359
|
-
if (runs.length > 0) {
|
|
360
|
-
setSubagentRuns((prev) => mergeSubagentRuns(prev, runs));
|
|
361
|
-
const activeRuns = runs.filter((run) => run.status === "running" || run.status === "pending");
|
|
362
|
-
if (activeRuns.length > 0) {
|
|
363
|
-
setAgentPhase({
|
|
364
|
-
kind: "running_tools",
|
|
365
|
-
tools: activeRuns.map((run) => ({ id: run.id, name: run.agent })),
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
371
|
-
case "auto_retry_start":
|
|
372
|
-
setRetryInfo({ attempt: event.attempt as number, maxAttempts: event.maxAttempts as number, errorMessage: event.errorMessage as string | undefined });
|
|
373
|
-
break;
|
|
374
|
-
case "auto_retry_end":
|
|
375
|
-
setRetryInfo(null);
|
|
376
|
-
break;
|
|
377
|
-
case "auto_compaction_start":
|
|
378
|
-
case "compaction_start":
|
|
379
|
-
setIsCompacting(true);
|
|
380
|
-
setCompactError(null);
|
|
381
|
-
break;
|
|
382
|
-
case "auto_compaction_end":
|
|
383
|
-
case "compaction_end":
|
|
384
|
-
setIsCompacting(false);
|
|
385
|
-
if (event.errorMessage) {
|
|
386
|
-
setCompactError(event.errorMessage as string);
|
|
387
|
-
} else if (!event.aborted) {
|
|
388
|
-
if (sessionIdRef.current) loadSession(sessionIdRef.current);
|
|
389
|
-
}
|
|
390
|
-
break;
|
|
391
|
-
}
|
|
392
|
-
}, [loadSession, onAgentEnd, onSessionForked]);
|
|
393
|
-
handleAgentEventRef.current = handleAgentEvent;
|
|
394
|
-
|
|
395
|
-
const handleSend = useCallback(async (message: string, images?: AttachedImage[], documents?: AttachedDocument[]) => {
|
|
396
|
-
if (!message.trim() && !images?.length && !documents?.length) return;
|
|
397
|
-
if (agentRunning) return;
|
|
398
|
-
|
|
399
|
-
const docRefs = buildDocumentAppendix(documents);
|
|
400
|
-
const fullMessage = message.trim()
|
|
401
|
-
? (docRefs ? `${message}\n\nAttached document text:\n\n${docRefs}` : message)
|
|
402
|
-
: (docRefs ? `Attached document text:\n\n${docRefs}` : "");
|
|
403
|
-
|
|
404
|
-
const imageBlocks = images?.map((img) => ({ type: "image" as const, source: { type: "base64" as const, media_type: img.mimeType, data: img.data } }));
|
|
405
|
-
const userMsg: AgentMessage = {
|
|
406
|
-
role: "user",
|
|
407
|
-
content: imageBlocks?.length
|
|
408
|
-
? [...(fullMessage.trim() ? [{ type: "text" as const, text: fullMessage }] : []), ...imageBlocks]
|
|
409
|
-
: fullMessage,
|
|
410
|
-
timestamp: Date.now(),
|
|
411
|
-
};
|
|
412
|
-
setMessages((prev) => [...prev, userMsg]);
|
|
413
|
-
setAgentError(null);
|
|
414
|
-
setAgentRunning(true);
|
|
415
|
-
agentRunningRef.current = true;
|
|
416
|
-
setAgentPhase({ kind: "waiting_model" });
|
|
417
|
-
dispatch({ type: "start" });
|
|
418
|
-
pendingScrollToUserRef.current = true;
|
|
419
|
-
|
|
420
|
-
const piImages = images?.map((img) => ({ type: "image" as const, data: img.data, mimeType: img.mimeType }));
|
|
421
|
-
|
|
422
|
-
try {
|
|
423
|
-
if (isNew && newSessionCwd) {
|
|
424
|
-
const selectedModel = newSessionModel;
|
|
425
|
-
if (selectedModel) setPendingModel(selectedModel);
|
|
426
|
-
const { PRESET_NONE, PRESET_DEFAULT, PRESET_FULL } = await import("@/components/ToolPanel");
|
|
427
|
-
const toolNames = toolPreset === "none" ? PRESET_NONE : toolPreset === "default" ? PRESET_DEFAULT : PRESET_FULL;
|
|
428
|
-
const res = await fetch("/api/agent/new", {
|
|
429
|
-
method: "POST",
|
|
430
|
-
headers: { "Content-Type": "application/json" },
|
|
431
|
-
body: JSON.stringify({
|
|
432
|
-
cwd: newSessionCwd,
|
|
433
|
-
toolNames,
|
|
434
|
-
...(selectedModel ? { provider: selectedModel.provider, modelId: selectedModel.modelId } : {}),
|
|
435
|
-
...(thinkingLevel !== "auto" ? { thinkingLevel } : {}),
|
|
436
|
-
}),
|
|
437
|
-
});
|
|
438
|
-
const result = await res.json().catch(() => ({})) as { sessionId?: string; error?: string };
|
|
439
|
-
if (!res.ok || result.error || !result.sessionId) {
|
|
440
|
-
throw new Error(result.error ?? `HTTP ${res.status}`);
|
|
441
|
-
}
|
|
442
|
-
const realId = result.sessionId;
|
|
443
|
-
sessionIdRef.current = realId;
|
|
444
|
-
await waitForEventsConnected(realId);
|
|
445
|
-
await sendAgentCommand(realId, {
|
|
446
|
-
type: "prompt",
|
|
447
|
-
message: fullMessage,
|
|
448
|
-
toolNames,
|
|
449
|
-
...(piImages?.length ? { images: piImages } : {}),
|
|
450
|
-
});
|
|
451
|
-
skipSessionEffectRef.current = true;
|
|
452
|
-
onSessionCreated?.({
|
|
453
|
-
id: realId,
|
|
454
|
-
path: "",
|
|
455
|
-
cwd: newSessionCwd,
|
|
456
|
-
name: undefined,
|
|
457
|
-
created: new Date().toISOString(),
|
|
458
|
-
modified: new Date().toISOString(),
|
|
459
|
-
messageCount: 1,
|
|
460
|
-
firstMessage: message,
|
|
461
|
-
});
|
|
462
|
-
} else if (session) {
|
|
463
|
-
const { PRESET_NONE, PRESET_DEFAULT, PRESET_FULL } = await import("@/components/ToolPanel");
|
|
464
|
-
const toolNames = toolPreset === "none" ? PRESET_NONE : toolPreset === "default" ? PRESET_DEFAULT : PRESET_FULL;
|
|
465
|
-
await waitForEventsConnected(session.id);
|
|
466
|
-
const promptResult = await sendAgentCommand<Record<string, unknown>>(session.id, {
|
|
467
|
-
type: "prompt",
|
|
468
|
-
message: fullMessage,
|
|
469
|
-
toolNames,
|
|
470
|
-
...(piImages?.length ? { images: piImages } : {}),
|
|
471
|
-
});
|
|
472
|
-
if (promptResult?.__sessionId && promptResult.__sessionId !== session.id) {
|
|
473
|
-
sessionIdRef.current = promptResult.__sessionId;
|
|
474
|
-
connectEvents(promptResult.__sessionId);
|
|
475
|
-
onSessionForked?.(promptResult.__sessionId);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
} catch (e) {
|
|
479
|
-
console.error("Failed to send message:", e);
|
|
480
|
-
setAgentError(e instanceof Error ? e.message : String(e));
|
|
481
|
-
setAgentRunning(false);
|
|
482
|
-
agentRunningRef.current = false;
|
|
483
|
-
setAgentPhase(null);
|
|
484
|
-
dispatch({ type: "end" });
|
|
485
|
-
}
|
|
486
|
-
}, [isNew, newSessionCwd, newSessionModel, toolPreset, thinkingLevel, session, agentRunning, waitForEventsConnected, onSessionCreated, onSessionForked, connectEvents, buildDocumentAppendix]);
|
|
487
|
-
|
|
488
|
-
const handleAbort = useCallback(async () => {
|
|
489
|
-
const sid = sessionIdRef.current;
|
|
490
|
-
if (!sid) return;
|
|
491
|
-
agentRunningRef.current = false;
|
|
492
|
-
setAgentError(null);
|
|
493
|
-
setAgentRunning(false);
|
|
494
|
-
setAgentPhase(null);
|
|
495
|
-
dispatch({ type: "end" });
|
|
496
|
-
eventSourceRef.current?.close();
|
|
497
|
-
eventSourceRef.current = null;
|
|
498
|
-
try {
|
|
499
|
-
await sendAgentCommand(sid, { type: "abort" });
|
|
500
|
-
await loadSession(sid);
|
|
501
|
-
} catch (e) {
|
|
502
|
-
console.error("Failed to abort:", e);
|
|
503
|
-
await loadSession(sid);
|
|
504
|
-
}
|
|
505
|
-
}, [loadSession]);
|
|
506
|
-
|
|
507
|
-
const handleFork = useCallback(async (entryId: string) => {
|
|
508
|
-
const sid = sessionIdRef.current;
|
|
509
|
-
if (!sid) return;
|
|
510
|
-
setForkingEntryId(entryId);
|
|
511
|
-
try {
|
|
512
|
-
const result = await sendAgentCommand<{ cancelled?: boolean; newSessionId?: string }>(sid, {
|
|
513
|
-
type: "fork",
|
|
514
|
-
entryId,
|
|
515
|
-
});
|
|
516
|
-
const { cancelled, newSessionId } = result ?? {};
|
|
517
|
-
if (!cancelled && newSessionId) {
|
|
518
|
-
onSessionForked?.(newSessionId);
|
|
519
|
-
}
|
|
520
|
-
} catch (e) {
|
|
521
|
-
console.error("Fork failed:", e);
|
|
522
|
-
} finally {
|
|
523
|
-
setForkingEntryId(null);
|
|
524
|
-
}
|
|
525
|
-
}, [onSessionForked]);
|
|
526
|
-
|
|
527
|
-
const handleModelChange = useCallback(async (provider: string, modelId: string) => {
|
|
528
|
-
if (isNew) {
|
|
529
|
-
setNewSessionModel({ provider, modelId });
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
const sid = sessionIdRef.current;
|
|
533
|
-
if (!sid) return;
|
|
534
|
-
try {
|
|
535
|
-
const result: AgentCommandResult<{ id?: string; provider?: string; newSessionId?: string }> = await sendAgentCommand(sid, { type: "set_model", provider, modelId });
|
|
536
|
-
const replacementSessionId = result.newSessionId ?? result.__sessionId;
|
|
537
|
-
if (replacementSessionId && replacementSessionId !== sid) {
|
|
538
|
-
sessionIdRef.current = replacementSessionId;
|
|
539
|
-
onSessionForked?.(replacementSessionId);
|
|
540
|
-
}
|
|
541
|
-
setCurrentModelOverride({
|
|
542
|
-
provider: result?.provider ?? provider,
|
|
543
|
-
modelId: result?.id ?? modelId,
|
|
544
|
-
});
|
|
545
|
-
} catch (e) {
|
|
546
|
-
console.error("Failed to set model:", e);
|
|
547
|
-
}
|
|
548
|
-
}, [isNew, onSessionForked, setNewSessionModel]);
|
|
549
|
-
|
|
550
|
-
const handleCompact = useCallback(async () => {
|
|
551
|
-
const sid = sessionIdRef.current;
|
|
552
|
-
if (!sid || isCompacting) return;
|
|
553
|
-
setIsCompacting(true);
|
|
554
|
-
setCompactError(null);
|
|
555
|
-
try {
|
|
556
|
-
await sendAgentCommand(sid, { type: "compact" });
|
|
557
|
-
await loadSession(sid, true);
|
|
558
|
-
} catch (e) {
|
|
559
|
-
setCompactError(e instanceof Error ? e.message : String(e));
|
|
560
|
-
} finally {
|
|
561
|
-
setIsCompacting(false);
|
|
562
|
-
}
|
|
563
|
-
}, [isCompacting, loadSession]);
|
|
564
|
-
|
|
565
|
-
const handleAbortCompaction = useCallback(async () => {
|
|
566
|
-
const sid = sessionIdRef.current;
|
|
567
|
-
if (!sid) return;
|
|
568
|
-
try {
|
|
569
|
-
await sendAgentCommand(sid, { type: "abort_compaction" });
|
|
570
|
-
} catch (e) {
|
|
571
|
-
console.error("Failed to abort compaction:", e);
|
|
572
|
-
}
|
|
573
|
-
}, []);
|
|
574
|
-
|
|
575
|
-
const handleThinkingLevelChange = useCallback(async (level: ThinkingLevelOption) => {
|
|
576
|
-
setThinkingLevel(level);
|
|
577
|
-
if (level === "auto") return; // "auto" leaves codex's current setting untouched
|
|
578
|
-
const sid = sessionIdRef.current;
|
|
579
|
-
if (!sid) return;
|
|
580
|
-
try {
|
|
581
|
-
await sendAgentCommand(sid, { type: "set_thinking_level", level });
|
|
582
|
-
} catch (e) {
|
|
583
|
-
console.error("Failed to set thinking level:", e);
|
|
584
|
-
}
|
|
585
|
-
}, []);
|
|
586
|
-
|
|
587
|
-
const handleToolPresetChange = useCallback(async (preset: "none" | "default" | "full") => {
|
|
588
|
-
const { PRESET_NONE, PRESET_DEFAULT, PRESET_FULL } = await import("@/components/ToolPanel");
|
|
589
|
-
const toolNames = preset === "none" ? PRESET_NONE : preset === "default" ? PRESET_DEFAULT : PRESET_FULL;
|
|
590
|
-
setToolPresetState(preset);
|
|
591
|
-
const sid = sessionIdRef.current;
|
|
592
|
-
if (!sid) return;
|
|
593
|
-
try {
|
|
594
|
-
await sendAgentCommand(sid, { type: "set_tools", toolNames });
|
|
595
|
-
} catch (e) {
|
|
596
|
-
console.error("Failed to set tools:", e);
|
|
597
|
-
}
|
|
598
|
-
}, [setToolPresetState]);
|
|
599
|
-
|
|
600
|
-
const scrollToBottom = useCallback((behavior: ScrollBehavior = "smooth") => {
|
|
601
|
-
messagesEndRef.current?.scrollIntoView({ behavior });
|
|
602
|
-
}, []);
|
|
603
|
-
|
|
604
|
-
const scrollUserMsgToTop = useCallback(() => {
|
|
605
|
-
const container = scrollContainerRef.current;
|
|
606
|
-
const el = lastUserMsgRef.current;
|
|
607
|
-
if (!container || !el) return;
|
|
608
|
-
const elAbsTop = el.getBoundingClientRect().top - container.getBoundingClientRect().top + container.scrollTop;
|
|
609
|
-
container.scrollTo({ top: elAbsTop - 16, behavior: "smooth" });
|
|
610
|
-
}, []);
|
|
611
|
-
|
|
612
|
-
// Load session on mount or when session id changes (model switch fork)
|
|
613
|
-
useEffect(() => {
|
|
614
|
-
if (skipSessionEffectRef.current) {
|
|
615
|
-
// session created by handleSend — EventSource already connected, skip reload
|
|
616
|
-
skipSessionEffectRef.current = false;
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
if (session) {
|
|
620
|
-
sessionIdRef.current = session.id;
|
|
621
|
-
loadSession(session.id, true, true).then((agentState) => {
|
|
622
|
-
if (agentState?.running) {
|
|
623
|
-
loadTools(session.id);
|
|
624
|
-
// Always reconnect when agent is running — not just when isStreaming.
|
|
625
|
-
// During tool execution isStreaming is false, but the agent is still
|
|
626
|
-
// active and we need to receive tool_result / agent_end events.
|
|
627
|
-
setAgentRunning(true);
|
|
628
|
-
setAgentPhase({ kind: "waiting_model" });
|
|
629
|
-
dispatch({ type: "start" });
|
|
630
|
-
connectEvents(session.id);
|
|
631
|
-
}
|
|
632
|
-
if (agentState?.state) {
|
|
633
|
-
if (agentState.state.isCompacting !== undefined) setIsCompacting(agentState.state.isCompacting);
|
|
634
|
-
if (agentState.state.contextUsage !== undefined) setContextUsage(agentState.state.contextUsage ?? null);
|
|
635
|
-
if (agentState.state.systemPrompt !== undefined) setSystemPrompt(agentState.state.systemPrompt ?? null);
|
|
636
|
-
if (agentState.state.thinkingLevel !== undefined) setThinkingLevel((agentState.state.thinkingLevel as ThinkingLevelOption) ?? "auto");
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
return () => {
|
|
641
|
-
eventSourceRef.current?.close();
|
|
642
|
-
eventSourceRef.current = null;
|
|
643
|
-
};
|
|
644
|
-
}, [session?.id]);
|
|
645
|
-
|
|
646
|
-
useEffect(() => {
|
|
647
|
-
onSystemPromptChange?.(systemPrompt);
|
|
648
|
-
}, [systemPrompt, onSystemPromptChange]);
|
|
649
|
-
|
|
650
|
-
useEffect(() => {
|
|
651
|
-
if (messages.length > 0) {
|
|
652
|
-
if (pendingScrollToUserRef.current) {
|
|
653
|
-
pendingScrollToUserRef.current = false;
|
|
654
|
-
initialScrollDoneRef.current = true;
|
|
655
|
-
scrollUserMsgToTop();
|
|
656
|
-
} else if (!initialScrollDoneRef.current) {
|
|
657
|
-
initialScrollDoneRef.current = true;
|
|
658
|
-
scrollToBottom("instant");
|
|
659
|
-
} else if (!agentRunningRef.current) {
|
|
660
|
-
scrollToBottom("smooth");
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}, [messages.length, agentRunning, scrollToBottom, scrollUserMsgToTop]);
|
|
664
|
-
|
|
665
|
-
// Load model list
|
|
666
|
-
useEffect(() => {
|
|
667
|
-
fetch("/api/models").then((r) => r.json()).then((d: { models: Record<string, string>; modelList?: { id: string; name: string; provider: string }[]; defaultModel?: { provider: string; modelId: string } | null; thinkingLevels?: Record<string, string[]>; thinkingLevelMaps?: Record<string, Record<string, string | null>> }) => {
|
|
668
|
-
setModelNames(d.models);
|
|
669
|
-
if (d.thinkingLevels) setModelThinkingLevels(d.thinkingLevels);
|
|
670
|
-
if (d.thinkingLevelMaps) setModelThinkingLevelMaps(d.thinkingLevelMaps);
|
|
671
|
-
if (d.modelList) {
|
|
672
|
-
setModelList(d.modelList);
|
|
673
|
-
if (isNew) {
|
|
674
|
-
const def = d.defaultModel;
|
|
675
|
-
const match = def && d.modelList.find((m) => m.id === def.modelId && m.provider === def.provider);
|
|
676
|
-
setNewSessionModel(match
|
|
677
|
-
? { provider: match.provider, modelId: match.id }
|
|
678
|
-
: def ?? null);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
}).catch(() => {});
|
|
682
|
-
}, [isNew, modelsRefreshKey, setNewSessionModel]);
|
|
683
|
-
|
|
684
|
-
// Compact error auto-dismiss
|
|
685
|
-
useEffect(() => {
|
|
686
|
-
if (!compactError) return;
|
|
687
|
-
const t = setTimeout(() => setCompactError(null), 3000);
|
|
688
|
-
return () => clearTimeout(t);
|
|
689
|
-
}, [compactError]);
|
|
690
|
-
|
|
691
|
-
return {
|
|
692
|
-
// State
|
|
693
|
-
data, loading, error, messages, entryIds, streamState,
|
|
694
|
-
agentRunning, modelNames, modelList, modelThinkingLevels, modelThinkingLevelMaps, newSessionModel, toolPreset, thinkingLevel,
|
|
695
|
-
retryInfo, contextUsage, systemPrompt, forkingEntryId,
|
|
696
|
-
isCompacting, compactError, currentModel, displayModel, sessionStats,
|
|
697
|
-
agentPhase, agentError, subagentRuns,
|
|
698
|
-
isNew,
|
|
699
|
-
// Refs
|
|
700
|
-
sessionIdRef, eventSourceRef, messagesEndRef, scrollContainerRef,
|
|
701
|
-
lastUserMsgRef, pendingScrollToUserRef, initialScrollDoneRef,
|
|
702
|
-
// Actions
|
|
703
|
-
handleSend, handleAbort, handleFork, handleModelChange,
|
|
704
|
-
handleCompact, handleAbortCompaction,
|
|
705
|
-
handleToolPresetChange, handleThinkingLevelChange, loadTools, setData, setMessages,
|
|
706
|
-
dispatch, setAgentRunning, setForkingEntryId,
|
|
707
|
-
// Subscriptions
|
|
708
|
-
handleAgentEventRef,
|
|
709
|
-
};
|
|
710
|
-
}
|