tower-studio 0.2.7 → 0.2.8
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/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- 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/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +41 -41
- 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 +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/adapters/test/route.js +3 -2
- package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js +1 -1
- package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +9 -9
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +71 -71
- package/.next/standalone/.next/server/app/missions/page.js +5 -5
- package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +41 -41
- package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/onboarding.html +1 -1
- package/.next/standalone/.next/server/app/onboarding.rsc +16 -16
- package/.next/standalone/.next/server/app/onboarding.segments/_full.segment.rsc +16 -16
- package/.next/standalone/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/onboarding.segments/_index.segment.rsc +9 -9
- package/.next/standalone/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +41 -41
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +54 -54
- package/.next/standalone/.next/server/app/settings/page.js +3 -3
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings.html +1 -1
- package/.next/standalone/.next/server/app/settings.rsc +16 -16
- package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +16 -16
- package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +9 -9
- package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +98 -98
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +82 -82
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +71 -71
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +70 -70
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js +3 -3
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +41 -41
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +74 -74
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +80 -80
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +5 -5
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +59 -59
- package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__028ucbo._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__03gi3ue._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__07f7~6u._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_90467._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d~z6xs._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0_w835g._.js +4 -0
- package/.next/standalone/.next/server/chunks/src_0bkvm8c._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_0ba0ntr._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_ai_0q-~me1._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_ai_0xx6y51._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_ai_providers_index_ts_0.y.3vp._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.ukame._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__006_qh0._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01j8ix6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02px.0y._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03ebsif._.js +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0o8k4pc._.js → [root-of-the-server]__08901f9._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ca_ueb._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0dsdplu._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0l43.5g._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0zujp5l._.js → [root-of-the-server]__0miur_1._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n.cuy2._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0nbj.ml._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ojv-d0._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pm2~fu._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ps55l6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ribsk4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rjue04._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0souuv~._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0tc6uh2._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0v2eslh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0wjg_.n._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0wlmzzq._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0wvyks.._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0zbmoit._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0~03tpv._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0~a-emb._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0u4gc4b._.js → [root-of-the-server]__121lss.._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13vdw4w._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{_0ysyq9g._.js → _0.knmg-._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0f6u19w._.js → _0.oe3b8._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_04b71ua._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_05h.8a~._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_02v3fjp._.js → _05unqgy._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/_0_l8.dg._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_07~0_w6._.js → _0a2m~cj._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0b0.-sj._.js → _0d2cdox._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0ds6nk2._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0pd0.8f._.js → _0fq4yrr._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0i4__mf._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0ysygps._.js → _0icu6m~._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0ihq._v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0bw-tx8._.js → _0kx.c-s._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0c-jnbs._.js → _0pu8x.f._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0r9w-k8._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0rbctq7._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0rt8hus._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_08w-r6e._.js → _0vnfnib._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{_0fob8fc._.js → _0xvsyc0._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0~80adm._.js +3 -3
- package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_13jha60._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +286 -286
- package/.next/standalone/.next/static/chunks/{0fxm-wv..y_a_.js → 000k30wpair3e.js} +2 -2
- package/.next/standalone/.next/static/chunks/005169or2nxlh.js +1 -0
- package/.next/standalone/.next/static/chunks/{142w-q8.7m3kl.js → 04uepvk5f~_a-.js} +1 -1
- package/.next/standalone/.next/static/chunks/{02edbrlq~2uyx.js → 07vas3ezrfrjg.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ft77ybyq903..js → 087l367c1psb6.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0v~pz9e87t99b.js → 09m-rcwwlggjy.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0r1mkt5qs~s6m.js → 0h1-tehkx05kz.js} +1 -1
- package/.next/standalone/.next/static/chunks/{05-ui_o~3irq_.js → 0hueiuk3kjujl.js} +2 -2
- package/.next/standalone/.next/static/chunks/{05hls.3r4bz.0.js → 0ikej72py2xo3.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0l3mmc866npw4.js → 0lx08u-wp-gt6.js} +2 -2
- package/.next/standalone/.next/static/chunks/0mu8uzvw4gvpf.js +1 -0
- package/.next/standalone/.next/static/chunks/0ow7ynd7g7ptv.js +1 -0
- package/.next/standalone/.next/static/chunks/{0i55dediewjp5.js → 0szduy0e92e5g.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0w3jww1m3k77x.js → 0szie_5oyakv1.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0bw4ahlj4~l~g.js → 0ur-499l_2jrc.js} +1 -1
- package/.next/standalone/.next/static/chunks/{00.52653v5c~c.js → 0xs0yzxjkoeas.js} +1 -1
- package/.next/standalone/.next/static/chunks/{08~e63d2q~cam.js → 0ynbql~9oq0av.js} +1 -1
- package/.next/standalone/.next/static/chunks/{117qu902jput3.js → 0~88n47ys3due.js} +1 -1
- package/.next/standalone/.next/static/chunks/10nil20v3q7~..js +1 -0
- package/.next/standalone/.next/static/chunks/{0q-u-hhre1uyw.js → 12rh72_2o79jv.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0~27mkhc9s5k2.js → 156si6w7d-_ct.js} +2 -2
- package/.next/standalone/package.json +1 -2
- package/dist/mcp-server.cjs +34 -28
- package/package.json +1 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wbndoc._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04pq37d._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__07_b6c.._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09kc.q_._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jo1r7k._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_095o8x6._.js +0 -3
- package/.next/standalone/.next/static/chunks/00j0mdc41wa44.js +0 -1
- package/.next/standalone/.next/static/chunks/0nno5if2x1mvs.js +0 -1
- package/.next/standalone/.next/static/chunks/0qazzw-pr_sv7.js +0 -1
- package/.next/standalone/.next/static/chunks/0z01g02xstbqe.js +0 -1
- package/src/mcp/db.ts +0 -11
- package/src/mcp/index.ts +0 -15
- package/src/mcp/server.ts +0 -52
- package/src/mcp/tools/__tests__/label-tools.test.ts +0 -140
- package/src/mcp/tools/__tests__/project-tools.test.ts +0 -182
- package/src/mcp/tools/__tests__/report-tools.test.ts +0 -212
- package/src/mcp/tools/__tests__/task-tools.test.ts +0 -418
- package/src/mcp/tools/__tests__/terminal-tools.test.ts +0 -318
- package/src/mcp/tools/__tests__/workspace-tools.test.ts +0 -146
- package/src/mcp/tools/knowledge-tools.ts +0 -100
- package/src/mcp/tools/label-tools.ts +0 -70
- package/src/mcp/tools/note-asset-tools.ts +0 -271
- package/src/mcp/tools/project-tools.ts +0 -79
- package/src/mcp/tools/report-tools.ts +0 -220
- package/src/mcp/tools/search-tools.ts +0 -32
- package/src/mcp/tools/task-tools.ts +0 -272
- package/src/mcp/tools/terminal-tools.ts +0 -154
- package/src/mcp/tools/workspace-tools.ts +0 -73
- /package/.next/standalone/.next/static/{om3SyUw4eAwMA0KLhpSGh → 7DBkEq_6oXffs_C5TFLBR}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{om3SyUw4eAwMA0KLhpSGh → 7DBkEq_6oXffs_C5TFLBR}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{om3SyUw4eAwMA0KLhpSGh → 7DBkEq_6oXffs_C5TFLBR}/_ssgManifest.js +0 -0
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import { vi, describe, it, expect, beforeAll, beforeEach } from "vitest";
|
|
2
|
-
|
|
3
|
-
// Mock db before any imports
|
|
4
|
-
vi.mock("../../db", () => ({
|
|
5
|
-
db: {
|
|
6
|
-
taskExecution: {
|
|
7
|
-
findFirst: vi.fn(),
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
// Mock global.fetch before any imports
|
|
13
|
-
const mockFetch = vi.fn();
|
|
14
|
-
global.fetch = mockFetch;
|
|
15
|
-
|
|
16
|
-
import { db } from "../../db";
|
|
17
|
-
import { terminalTools } from "../terminal-tools";
|
|
18
|
-
|
|
19
|
-
const mockDb = db as {
|
|
20
|
-
taskExecution: {
|
|
21
|
-
findFirst: ReturnType<typeof vi.fn>;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Helper to create mock fetch response
|
|
26
|
-
function mockFetchResponse(status: number, data: unknown): Response {
|
|
27
|
-
return {
|
|
28
|
-
ok: status >= 200 && status < 400,
|
|
29
|
-
status,
|
|
30
|
-
json: () => Promise.resolve(data),
|
|
31
|
-
} as unknown as Response;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Valid CUID-format task ID for tests
|
|
35
|
-
const VALID_TASK_ID = "cjldlkfxz0000ld08001abcde";
|
|
36
|
-
|
|
37
|
-
describe("terminal-tools", () => {
|
|
38
|
-
beforeAll(() => {
|
|
39
|
-
// Ensure PORT is set for bridge URL
|
|
40
|
-
process.env.PORT = "3000";
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
beforeEach(() => {
|
|
44
|
-
vi.clearAllMocks();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
describe("CUID validation", () => {
|
|
48
|
-
it("returns error immediately for invalid taskId without calling fetch", async () => {
|
|
49
|
-
const result = await terminalTools.get_task_terminal_output.handler({ taskId: "invalid" });
|
|
50
|
-
|
|
51
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
52
|
-
expect(result).toMatchObject({
|
|
53
|
-
error: expect.stringContaining("Invalid taskId"),
|
|
54
|
-
taskId: "invalid",
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("returns error for numeric-looking taskId", async () => {
|
|
59
|
-
const result = await terminalTools.get_task_terminal_output.handler({ taskId: "12345" });
|
|
60
|
-
|
|
61
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
62
|
-
expect(result).toMatchObject({ error: expect.stringContaining("Invalid taskId") });
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("returns error for taskId with hyphens (not CUID format)", async () => {
|
|
66
|
-
const result = await terminalTools.send_task_terminal_input.handler({
|
|
67
|
-
taskId: "not-a-cuid-format",
|
|
68
|
-
text: "hello",
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
72
|
-
expect(result).toMatchObject({ error: expect.stringContaining("Invalid taskId") });
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
describe("start_task_execution", () => {
|
|
77
|
-
it("POSTs to /{taskId}/start and returns ok: true with merged data on success", async () => {
|
|
78
|
-
const mockData = { executionId: "exec1", worktreePath: "/tmp/wt" };
|
|
79
|
-
mockFetch.mockResolvedValue(mockFetchResponse(200, mockData));
|
|
80
|
-
|
|
81
|
-
const result = await terminalTools.start_task_execution.handler({
|
|
82
|
-
taskId: VALID_TASK_ID,
|
|
83
|
-
prompt: "do something",
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
expect(mockFetch).toHaveBeenCalledOnce();
|
|
87
|
-
const [url, init] = mockFetch.mock.calls[0];
|
|
88
|
-
expect(url).toContain(`/api/internal/terminal/${VALID_TASK_ID}/start`);
|
|
89
|
-
expect(init.method).toBe("POST");
|
|
90
|
-
expect(JSON.parse(init.body)).toEqual({ prompt: "do something" });
|
|
91
|
-
|
|
92
|
-
expect(result).toMatchObject({ ok: true, executionId: "exec1", worktreePath: "/tmp/wt" });
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("returns error with status on non-ok response", async () => {
|
|
96
|
-
const errData = { error: "Task not found" };
|
|
97
|
-
mockFetch.mockResolvedValue(mockFetchResponse(404, errData));
|
|
98
|
-
|
|
99
|
-
const result = await terminalTools.start_task_execution.handler({
|
|
100
|
-
taskId: VALID_TASK_ID,
|
|
101
|
-
prompt: "do something",
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
expect(result).toMatchObject({ error: "Task not found", status: 404 });
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("uses empty string as default prompt when not provided", async () => {
|
|
108
|
-
mockFetch.mockResolvedValue(mockFetchResponse(200, { executionId: "exec1" }));
|
|
109
|
-
|
|
110
|
-
await terminalTools.start_task_execution.handler({ taskId: VALID_TASK_ID });
|
|
111
|
-
|
|
112
|
-
const [, init] = mockFetch.mock.calls[0];
|
|
113
|
-
expect(JSON.parse(init.body)).toEqual({ prompt: "" });
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
describe("get_task_terminal_output", () => {
|
|
118
|
-
it("GETs /{taskId}/buffer?lines=N and returns lines/total/killed on 200", async () => {
|
|
119
|
-
const mockData = {
|
|
120
|
-
taskId: VALID_TASK_ID,
|
|
121
|
-
lines: ["line1", "line2"],
|
|
122
|
-
total: 2,
|
|
123
|
-
killed: false,
|
|
124
|
-
};
|
|
125
|
-
mockFetch.mockResolvedValue(mockFetchResponse(200, mockData));
|
|
126
|
-
|
|
127
|
-
const result = await terminalTools.get_task_terminal_output.handler({
|
|
128
|
-
taskId: VALID_TASK_ID,
|
|
129
|
-
lines: 20,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
expect(mockFetch).toHaveBeenCalledOnce();
|
|
133
|
-
const [url] = mockFetch.mock.calls[0];
|
|
134
|
-
expect(url).toContain(`/api/internal/terminal/${VALID_TASK_ID}/buffer?lines=20`);
|
|
135
|
-
|
|
136
|
-
expect(result).toEqual({
|
|
137
|
-
taskId: VALID_TASK_ID,
|
|
138
|
-
lines: ["line1", "line2"],
|
|
139
|
-
total: 2,
|
|
140
|
-
killed: false,
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it("returns 'No active terminal session' error on 404", async () => {
|
|
145
|
-
mockFetch.mockResolvedValue(mockFetchResponse(404, {}));
|
|
146
|
-
|
|
147
|
-
const result = await terminalTools.get_task_terminal_output.handler({
|
|
148
|
-
taskId: VALID_TASK_ID,
|
|
149
|
-
lines: 10,
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
expect(result).toMatchObject({
|
|
153
|
-
error: "No active terminal session for this task",
|
|
154
|
-
taskId: VALID_TASK_ID,
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it("uses default lines=50 when lines param not provided", async () => {
|
|
159
|
-
mockFetch.mockResolvedValue(
|
|
160
|
-
mockFetchResponse(200, { taskId: VALID_TASK_ID, lines: [], total: 0, killed: false })
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
await terminalTools.get_task_terminal_output.handler({ taskId: VALID_TASK_ID });
|
|
164
|
-
|
|
165
|
-
const [url] = mockFetch.mock.calls[0];
|
|
166
|
-
expect(url).toContain("buffer?lines=50");
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
describe("send_task_terminal_input", () => {
|
|
171
|
-
it("POSTs to /{taskId}/input with text body and returns ok: true on success", async () => {
|
|
172
|
-
mockFetch.mockResolvedValue(mockFetchResponse(200, {}));
|
|
173
|
-
|
|
174
|
-
const result = await terminalTools.send_task_terminal_input.handler({
|
|
175
|
-
taskId: VALID_TASK_ID,
|
|
176
|
-
text: "hello\n",
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
expect(mockFetch).toHaveBeenCalledOnce();
|
|
180
|
-
const [url, init] = mockFetch.mock.calls[0];
|
|
181
|
-
expect(url).toContain(`/api/internal/terminal/${VALID_TASK_ID}/input`);
|
|
182
|
-
expect(init.method).toBe("POST");
|
|
183
|
-
expect(JSON.parse(init.body)).toEqual({ text: "hello\n" });
|
|
184
|
-
|
|
185
|
-
expect(result).toMatchObject({ ok: true, taskId: VALID_TASK_ID });
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
it("returns 'No active terminal session' error on 404", async () => {
|
|
189
|
-
mockFetch.mockResolvedValue(mockFetchResponse(404, {}));
|
|
190
|
-
|
|
191
|
-
const result = await terminalTools.send_task_terminal_input.handler({
|
|
192
|
-
taskId: VALID_TASK_ID,
|
|
193
|
-
text: "hello",
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
expect(result).toMatchObject({
|
|
197
|
-
error: "No active terminal session for this task",
|
|
198
|
-
taskId: VALID_TASK_ID,
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it("returns 'Terminal session has exited' error on 410", async () => {
|
|
203
|
-
mockFetch.mockResolvedValue(mockFetchResponse(410, {}));
|
|
204
|
-
|
|
205
|
-
const result = await terminalTools.send_task_terminal_input.handler({
|
|
206
|
-
taskId: VALID_TASK_ID,
|
|
207
|
-
text: "hello",
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
expect(result).toMatchObject({
|
|
211
|
-
error: "Terminal session has exited",
|
|
212
|
-
taskId: VALID_TASK_ID,
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
describe("get_task_execution_status", () => {
|
|
218
|
-
it("returns error when no execution found in db", async () => {
|
|
219
|
-
mockDb.taskExecution.findFirst.mockResolvedValue(null);
|
|
220
|
-
|
|
221
|
-
const result = await terminalTools.get_task_execution_status.handler({
|
|
222
|
-
taskId: VALID_TASK_ID,
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
expect(result).toMatchObject({
|
|
226
|
-
error: "No execution found for this task",
|
|
227
|
-
taskId: VALID_TASK_ID,
|
|
228
|
-
});
|
|
229
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
it("returns terminalStatus=exited when buffer returns 404 and execution is COMPLETED", async () => {
|
|
233
|
-
mockDb.taskExecution.findFirst.mockResolvedValue({
|
|
234
|
-
id: "exec1",
|
|
235
|
-
status: "COMPLETED",
|
|
236
|
-
startedAt: null,
|
|
237
|
-
endedAt: null,
|
|
238
|
-
});
|
|
239
|
-
mockFetch.mockResolvedValue(mockFetchResponse(404, {}));
|
|
240
|
-
|
|
241
|
-
const result = await terminalTools.get_task_execution_status.handler({
|
|
242
|
-
taskId: VALID_TASK_ID,
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
expect(result).toMatchObject({
|
|
246
|
-
taskId: VALID_TASK_ID,
|
|
247
|
-
executionId: "exec1",
|
|
248
|
-
executionStatus: "COMPLETED",
|
|
249
|
-
terminalStatus: "exited",
|
|
250
|
-
outputSnippet: null,
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
it("returns terminalStatus=not_running when buffer returns 404 and execution is RUNNING", async () => {
|
|
255
|
-
mockDb.taskExecution.findFirst.mockResolvedValue({
|
|
256
|
-
id: "exec1",
|
|
257
|
-
status: "RUNNING",
|
|
258
|
-
startedAt: null,
|
|
259
|
-
endedAt: null,
|
|
260
|
-
});
|
|
261
|
-
mockFetch.mockResolvedValue(mockFetchResponse(404, {}));
|
|
262
|
-
|
|
263
|
-
const result = await terminalTools.get_task_execution_status.handler({
|
|
264
|
-
taskId: VALID_TASK_ID,
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
expect(result).toMatchObject({
|
|
268
|
-
terminalStatus: "not_running",
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
it("returns terminalStatus=exited when buffer is ok and killed=true", async () => {
|
|
273
|
-
mockDb.taskExecution.findFirst.mockResolvedValue({
|
|
274
|
-
id: "exec1",
|
|
275
|
-
status: "RUNNING",
|
|
276
|
-
startedAt: null,
|
|
277
|
-
endedAt: null,
|
|
278
|
-
});
|
|
279
|
-
mockFetch.mockResolvedValue(
|
|
280
|
-
mockFetchResponse(200, { lines: ["done"], killed: true })
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
const result = await terminalTools.get_task_execution_status.handler({
|
|
284
|
-
taskId: VALID_TASK_ID,
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
expect(result).toMatchObject({
|
|
288
|
-
terminalStatus: "exited",
|
|
289
|
-
outputSnippet: "done",
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it("returns terminalStatus=running with outputSnippet when buffer is ok and killed=false", async () => {
|
|
294
|
-
mockDb.taskExecution.findFirst.mockResolvedValue({
|
|
295
|
-
id: "exec1",
|
|
296
|
-
status: "RUNNING",
|
|
297
|
-
startedAt: null,
|
|
298
|
-
endedAt: null,
|
|
299
|
-
});
|
|
300
|
-
mockFetch.mockResolvedValue(
|
|
301
|
-
mockFetchResponse(200, { lines: ["line1", "line2", "line3"], killed: false })
|
|
302
|
-
);
|
|
303
|
-
|
|
304
|
-
const result = await terminalTools.get_task_execution_status.handler({
|
|
305
|
-
taskId: VALID_TASK_ID,
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
expect(result).toMatchObject({
|
|
309
|
-
terminalStatus: "running",
|
|
310
|
-
outputSnippet: "line1\nline2\nline3",
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
// Verify bridge fetch was called with buffer?lines=10
|
|
314
|
-
const [url] = mockFetch.mock.calls[0];
|
|
315
|
-
expect(url).toContain(`/api/internal/terminal/${VALID_TASK_ID}/buffer?lines=10`);
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
});
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { vi, describe, it, expect, beforeEach } from "vitest";
|
|
2
|
-
|
|
3
|
-
// Mock db before any imports
|
|
4
|
-
vi.mock("../../db", () => ({
|
|
5
|
-
db: {
|
|
6
|
-
workspace: {
|
|
7
|
-
findMany: vi.fn(),
|
|
8
|
-
create: vi.fn(),
|
|
9
|
-
update: vi.fn(),
|
|
10
|
-
delete: vi.fn(),
|
|
11
|
-
count: vi.fn(),
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
import { db } from "../../db";
|
|
17
|
-
import { workspaceTools } from "../workspace-tools";
|
|
18
|
-
|
|
19
|
-
const mockDb = db as unknown as {
|
|
20
|
-
workspace: {
|
|
21
|
-
findMany: ReturnType<typeof vi.fn>;
|
|
22
|
-
create: ReturnType<typeof vi.fn>;
|
|
23
|
-
update: ReturnType<typeof vi.fn>;
|
|
24
|
-
delete: ReturnType<typeof vi.fn>;
|
|
25
|
-
count: ReturnType<typeof vi.fn>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
describe("workspace-tools", () => {
|
|
30
|
-
beforeEach(() => {
|
|
31
|
-
vi.clearAllMocks();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe("list_workspaces", () => {
|
|
35
|
-
it("calls db.workspace.findMany with projects include and returns projectCount", async () => {
|
|
36
|
-
const mockWorkspaces = [
|
|
37
|
-
{
|
|
38
|
-
id: "ws1",
|
|
39
|
-
name: "Workspace 1",
|
|
40
|
-
description: null,
|
|
41
|
-
createdAt: new Date(),
|
|
42
|
-
updatedAt: new Date(),
|
|
43
|
-
projects: [{ id: "p1" }, { id: "p2" }],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
id: "ws2",
|
|
47
|
-
name: "Workspace 2",
|
|
48
|
-
description: "desc",
|
|
49
|
-
createdAt: new Date(),
|
|
50
|
-
updatedAt: new Date(),
|
|
51
|
-
projects: [],
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
mockDb.workspace.findMany.mockResolvedValue(mockWorkspaces);
|
|
55
|
-
|
|
56
|
-
const result = await workspaceTools.list_workspaces.handler({});
|
|
57
|
-
|
|
58
|
-
expect(mockDb.workspace.findMany).toHaveBeenCalledOnce();
|
|
59
|
-
const callArgs = mockDb.workspace.findMany.mock.calls[0][0];
|
|
60
|
-
expect(callArgs.include.projects).toBeDefined();
|
|
61
|
-
expect(callArgs.orderBy).toEqual({ updatedAt: "desc" });
|
|
62
|
-
|
|
63
|
-
expect(result).toHaveLength(2);
|
|
64
|
-
expect(result[0]).toMatchObject({ id: "ws1", name: "Workspace 1", projectCount: 2 });
|
|
65
|
-
expect(result[0]).not.toHaveProperty("projects");
|
|
66
|
-
expect(result[1]).toMatchObject({ id: "ws2", name: "Workspace 2", projectCount: 0 });
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe("create_workspace", () => {
|
|
71
|
-
it("calls db.workspace.create with name and description", async () => {
|
|
72
|
-
const mockWorkspace = { id: "ws1", name: "New WS", description: "My desc", createdAt: new Date(), updatedAt: new Date() };
|
|
73
|
-
mockDb.workspace.create.mockResolvedValue(mockWorkspace);
|
|
74
|
-
|
|
75
|
-
const result = await workspaceTools.create_workspace.handler({ name: "New WS", description: "My desc" });
|
|
76
|
-
|
|
77
|
-
expect(mockDb.workspace.create).toHaveBeenCalledWith({
|
|
78
|
-
data: { name: "New WS", description: "My desc" },
|
|
79
|
-
});
|
|
80
|
-
expect(result).toEqual(mockWorkspace);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("calls db.workspace.create without description when not provided", async () => {
|
|
84
|
-
const mockWorkspace = { id: "ws1", name: "No Desc", description: null, createdAt: new Date(), updatedAt: new Date() };
|
|
85
|
-
mockDb.workspace.create.mockResolvedValue(mockWorkspace);
|
|
86
|
-
|
|
87
|
-
await workspaceTools.create_workspace.handler({ name: "No Desc" });
|
|
88
|
-
|
|
89
|
-
expect(mockDb.workspace.create).toHaveBeenCalledWith({
|
|
90
|
-
data: { name: "No Desc", description: undefined },
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
describe("update_workspace", () => {
|
|
96
|
-
it("calls db.workspace.update with correct where and data", async () => {
|
|
97
|
-
const mockWorkspace = { id: "ws1", name: "Updated", description: "new desc", createdAt: new Date(), updatedAt: new Date() };
|
|
98
|
-
mockDb.workspace.update.mockResolvedValue(mockWorkspace);
|
|
99
|
-
|
|
100
|
-
const result = await workspaceTools.update_workspace.handler({
|
|
101
|
-
workspaceId: "ws1",
|
|
102
|
-
name: "Updated",
|
|
103
|
-
description: "new desc",
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
expect(mockDb.workspace.update).toHaveBeenCalledWith({
|
|
107
|
-
where: { id: "ws1" },
|
|
108
|
-
data: { name: "Updated", description: "new desc" },
|
|
109
|
-
});
|
|
110
|
-
expect(result).toEqual(mockWorkspace);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("calls db.workspace.update with partial data (name only)", async () => {
|
|
114
|
-
const mockWorkspace = { id: "ws1", name: "Renamed", description: null, createdAt: new Date(), updatedAt: new Date() };
|
|
115
|
-
mockDb.workspace.update.mockResolvedValue(mockWorkspace);
|
|
116
|
-
|
|
117
|
-
await workspaceTools.update_workspace.handler({ workspaceId: "ws1", name: "Renamed" });
|
|
118
|
-
|
|
119
|
-
expect(mockDb.workspace.update).toHaveBeenCalledWith({
|
|
120
|
-
where: { id: "ws1" },
|
|
121
|
-
data: { name: "Renamed", description: undefined },
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
describe("delete_workspace", () => {
|
|
127
|
-
it("calls db.workspace.delete with workspaceId and returns deleted: true", async () => {
|
|
128
|
-
mockDb.workspace.count.mockResolvedValue(2);
|
|
129
|
-
mockDb.workspace.delete.mockResolvedValue({ id: "ws1" });
|
|
130
|
-
|
|
131
|
-
const result = await workspaceTools.delete_workspace.handler({ workspaceId: "ws1" });
|
|
132
|
-
|
|
133
|
-
expect(mockDb.workspace.delete).toHaveBeenCalledWith({ where: { id: "ws1" } });
|
|
134
|
-
expect(result).toEqual({ deleted: true, workspaceId: "ws1" });
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it("throws when trying to delete the last workspace", async () => {
|
|
138
|
-
mockDb.workspace.count.mockResolvedValue(1);
|
|
139
|
-
|
|
140
|
-
await expect(
|
|
141
|
-
workspaceTools.delete_workspace.handler({ workspaceId: "ws1" }),
|
|
142
|
-
).rejects.toThrow("Cannot delete the last workspace");
|
|
143
|
-
expect(mockDb.workspace.delete).not.toHaveBeenCalled();
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { db } from "../db";
|
|
3
|
-
|
|
4
|
-
// Scoring constants
|
|
5
|
-
const NAME_EXACT = 1.0;
|
|
6
|
-
const NAME_STARTS_WITH = 0.9;
|
|
7
|
-
const NAME_CONTAINS = 0.75;
|
|
8
|
-
const ALIAS_EXACT = 0.85;
|
|
9
|
-
const ALIAS_STARTS_WITH = 0.75;
|
|
10
|
-
const ALIAS_CONTAINS = 0.6;
|
|
11
|
-
const DESC_CONTAINS = 0.4;
|
|
12
|
-
const MIN_CONFIDENCE = 0.3;
|
|
13
|
-
|
|
14
|
-
interface ProjectFields {
|
|
15
|
-
name: string;
|
|
16
|
-
alias: string | null;
|
|
17
|
-
description?: string | null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Score a project against a query string.
|
|
22
|
-
* Returns a confidence value between 0 and 1.
|
|
23
|
-
* Name match > alias match > description match.
|
|
24
|
-
*/
|
|
25
|
-
export function scoreProject(project: ProjectFields, query: string): number {
|
|
26
|
-
const q = query.toLowerCase();
|
|
27
|
-
const name = project.name.toLowerCase();
|
|
28
|
-
|
|
29
|
-
// Name scoring
|
|
30
|
-
let nameScore = 0;
|
|
31
|
-
if (name === q) {
|
|
32
|
-
nameScore = NAME_EXACT;
|
|
33
|
-
} else if (name.startsWith(q)) {
|
|
34
|
-
nameScore = NAME_STARTS_WITH;
|
|
35
|
-
} else if (name.includes(q)) {
|
|
36
|
-
nameScore = NAME_CONTAINS;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Alias scoring
|
|
40
|
-
let aliasScore = 0;
|
|
41
|
-
if (project.alias) {
|
|
42
|
-
const alias = project.alias.toLowerCase();
|
|
43
|
-
if (alias === q) {
|
|
44
|
-
aliasScore = ALIAS_EXACT;
|
|
45
|
-
} else if (alias.startsWith(q)) {
|
|
46
|
-
aliasScore = ALIAS_STARTS_WITH;
|
|
47
|
-
} else if (alias.includes(q)) {
|
|
48
|
-
aliasScore = ALIAS_CONTAINS;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Description scoring
|
|
53
|
-
let descScore = 0;
|
|
54
|
-
if (project.description) {
|
|
55
|
-
const desc = project.description.toLowerCase();
|
|
56
|
-
if (desc.includes(q)) {
|
|
57
|
-
descScore = DESC_CONTAINS;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return Math.max(nameScore, aliasScore, descScore);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export const knowledgeTools = {
|
|
65
|
-
identify_project: {
|
|
66
|
-
description:
|
|
67
|
-
"Find a project by partial name, alias, or description. Returns matches sorted by confidence score (0-1).",
|
|
68
|
-
schema: z.object({
|
|
69
|
-
query: z.string(),
|
|
70
|
-
workspaceId: z.string().optional(),
|
|
71
|
-
}),
|
|
72
|
-
handler: async (args: { query: string; workspaceId?: string }) => {
|
|
73
|
-
// Fetch all projects (with workspace) optionally filtered by workspaceId
|
|
74
|
-
const projects = await db.project.findMany({
|
|
75
|
-
where: args.workspaceId ? { workspaceId: args.workspaceId } : undefined,
|
|
76
|
-
include: { workspace: true },
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Score each project
|
|
80
|
-
const scored = projects
|
|
81
|
-
.map((project) => ({
|
|
82
|
-
projectId: project.id,
|
|
83
|
-
name: project.name,
|
|
84
|
-
alias: project.alias,
|
|
85
|
-
workspaceId: project.workspaceId,
|
|
86
|
-
workspaceName: project.workspace.name,
|
|
87
|
-
confidence: scoreProject(
|
|
88
|
-
{ name: project.name, alias: project.alias, description: project.description },
|
|
89
|
-
args.query
|
|
90
|
-
),
|
|
91
|
-
}))
|
|
92
|
-
// Filter out low-confidence results
|
|
93
|
-
.filter((result) => result.confidence >= MIN_CONFIDENCE)
|
|
94
|
-
// Sort by confidence descending
|
|
95
|
-
.sort((a, b) => b.confidence - a.confidence);
|
|
96
|
-
|
|
97
|
-
return scored;
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { db } from "../db";
|
|
3
|
-
|
|
4
|
-
export const labelTools = {
|
|
5
|
-
list_labels: {
|
|
6
|
-
description: "List all labels available for a workspace, including builtin labels and workspace-specific labels.",
|
|
7
|
-
schema: z.object({
|
|
8
|
-
workspaceId: z.string(),
|
|
9
|
-
}),
|
|
10
|
-
handler: async (args: { workspaceId: string }) => {
|
|
11
|
-
return db.label.findMany({
|
|
12
|
-
where: {
|
|
13
|
-
OR: [
|
|
14
|
-
{ isBuiltin: true },
|
|
15
|
-
{ workspaceId: args.workspaceId },
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
orderBy: [{ isBuiltin: "desc" }, { name: "asc" }],
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
create_label: {
|
|
24
|
-
description: "Create a custom label for a workspace with a name and color.",
|
|
25
|
-
schema: z.object({
|
|
26
|
-
workspaceId: z.string(),
|
|
27
|
-
name: z.string(),
|
|
28
|
-
color: z.string().regex(/^#[0-9a-fA-F]{6}$/, "Color must be a hex color code like #ff0000"),
|
|
29
|
-
}),
|
|
30
|
-
handler: async (args: { workspaceId: string; name: string; color: string }) => {
|
|
31
|
-
return db.label.create({
|
|
32
|
-
data: {
|
|
33
|
-
name: args.name,
|
|
34
|
-
color: args.color,
|
|
35
|
-
workspaceId: args.workspaceId,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
delete_label: {
|
|
42
|
-
description: "Delete a label by ID.",
|
|
43
|
-
schema: z.object({
|
|
44
|
-
labelId: z.string(),
|
|
45
|
-
}),
|
|
46
|
-
handler: async (args: { labelId: string }) => {
|
|
47
|
-
await db.label.delete({ where: { id: args.labelId } });
|
|
48
|
-
return { deleted: true };
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
set_task_labels: {
|
|
53
|
-
description: "Replace all labels on a task with the provided list of label IDs.",
|
|
54
|
-
schema: z.object({
|
|
55
|
-
taskId: z.string(),
|
|
56
|
-
labelIds: z.array(z.string()),
|
|
57
|
-
}),
|
|
58
|
-
handler: async (args: { taskId: string; labelIds: string[] }) => {
|
|
59
|
-
await db.$transaction(async (tx) => {
|
|
60
|
-
await tx.taskLabel.deleteMany({ where: { taskId: args.taskId } });
|
|
61
|
-
if (args.labelIds.length > 0) {
|
|
62
|
-
await tx.taskLabel.createMany({
|
|
63
|
-
data: args.labelIds.map((labelId) => ({ taskId: args.taskId, labelId })),
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return { taskId: args.taskId, labelIds: args.labelIds };
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
};
|