@shepai/cli 1.142.0 → 1.142.1-pr455.16bd4d2
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/dist/src/presentation/cli/commands/feat/ls.command.d.ts +44 -2
- package/dist/src/presentation/cli/commands/feat/ls.command.d.ts.map +1 -1
- package/dist/src/presentation/cli/commands/feat/ls.command.js +182 -82
- package/dist/src/presentation/web/app/api/sessions/route.d.ts.map +1 -1
- package/dist/src/presentation/web/app/api/sessions/route.js +45 -13
- package/dist/src/presentation/web/components/common/feature-node/feature-node.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-node/feature-node.js +1 -1
- package/dist/src/presentation/web/components/common/feature-node/feature-sessions-dropdown.d.ts +3 -1
- package/dist/src/presentation/web/components/common/feature-node/feature-sessions-dropdown.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-node/feature-sessions-dropdown.js +13 -5
- package/dist/src/presentation/web/components/common/repository-node/repository-node.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/repository-node/repository-node.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +3 -3
- package/web/.next/required-server-files.json +3 -3
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/(dashboard)/create/page.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/page.js +1 -1
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +26 -26
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/api/sessions/route.js +3 -2
- package/web/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/skills/page.js +1 -1
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +8 -8
- package/web/.next/server/app/tools/page.js +1 -1
- package/web/.next/server/app/tools/page.js.nft.json +1 -1
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +3 -3
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_ff60e4a5.js +3 -0
- package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_ff60e4a5.js.map +1 -0
- package/web/.next/server/chunks/[externals]__448264a3._.js +3 -0
- package/web/.next/server/chunks/[externals]__448264a3._.js.map +1 -0
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__6ec59045._.js → [root-of-the-server]__0b150ddf._.js} +2 -2
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__6ec59045._.js.map → [root-of-the-server]__0b150ddf._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__a5f9c6e5._.js → [root-of-the-server]__2138fa7e._.js} +3 -3
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__a5f9c6e5._.js.map → [root-of-the-server]__2138fa7e._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__29580090._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3ef34e4c._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__43f51aa6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__815546bd._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c094882b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__d48c5b11._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__dac5dbf1._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fae8b355._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_0c5f56e3._.js +2 -2
- package/web/.next/server/chunks/ssr/_0c5f56e3._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js +1 -1
- package/web/.next/server/chunks/ssr/_1b719e7f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js +1 -1
- package/web/.next/server/chunks/ssr/_37e8548b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js +1 -1
- package/web/.next/server/chunks/ssr/_55d763e2._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js +1 -1
- package/web/.next/server/chunks/ssr/_6256a985._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_64bdfc6f._.js +2 -2
- package/web/.next/server/chunks/ssr/_64bdfc6f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_7dca1882._.js +1 -1
- package/web/.next/server/chunks/ssr/_7dca1882._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_a9f57758._.js +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js +1 -1
- package/web/.next/server/chunks/ssr/_b71645b4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_7e5c4d9c._.js → _c2b8e868._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_7e5c4d9c._.js.map → _c2b8e868._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{_1c6fbecf._.js → _c904beb8._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_1c6fbecf._.js.map → _c904beb8._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js +1 -1
- package/web/.next/server/chunks/ssr/_d8575088._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_f39a1adb._.js +1 -1
- package/web/.next/server/chunks/ssr/_f39a1adb._.js.map +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{src_presentation_web_7bda2f00._.js → src_presentation_web_8207e252._.js} +2 -2
- package/web/.next/server/chunks/ssr/{src_presentation_web_7bda2f00._.js.map → src_presentation_web_8207e252._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1b176e3c.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_bd9f0dda.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +44 -44
- package/web/.next/static/chunks/{13978ecd00a81172.js → 0a6be91d8d53e3fd.js} +1 -1
- package/web/.next/static/chunks/{74eef53714ab461d.js → 12e3ff09fc17f052.js} +1 -1
- package/web/.next/static/chunks/1330778ac8908e69.js +1 -0
- package/web/.next/static/chunks/{2eec9756f5220e22.js → 3aa226c0e32ce07c.js} +1 -1
- package/web/.next/static/chunks/{e599050b1f6466fe.js → 65085b062e182aa4.js} +1 -1
- package/web/.next/static/chunks/{4d7e25ef4b8e2f62.js → 6eb17d2ce8a9aa4f.js} +1 -1
- package/web/.next/static/chunks/{21ddf1d59c98adf0.js → 80b1513ba8f15d69.js} +1 -1
- package/web/.next/static/chunks/{73889aad2b3356b1.js → 9a16838aae04976b.js} +2 -2
- package/web/.next/static/chunks/{4adda8dd11458a46.js → 9c2e38efcd95fe72.js} +2 -2
- package/web/.next/static/chunks/{ea9969f79b2162ec.js → a7f51b1734e55a52.js} +1 -1
- package/web/.next/static/chunks/b0a40414ed362492.js +1 -0
- package/web/.next/static/chunks/b88100de43de46a4.js +1 -0
- package/web/.next/server/chunks/[root-of-the-server]__a62bd945._.js +0 -3
- package/web/.next/server/chunks/[root-of-the-server]__a62bd945._.js.map +0 -1
- package/web/.next/static/chunks/3f18dfdd07d48ecd.js +0 -1
- package/web/.next/static/chunks/6ad8d8682f4836c9.js +0 -1
- package/web/.next/static/chunks/a6a6a8387bae31f0.js +0 -1
- /package/web/.next/static/{G2BdtwIuunZEcXQ0FjJJF → rDu9PslAKyILjx18WKTCI}/_buildManifest.js +0 -0
- /package/web/.next/static/{G2BdtwIuunZEcXQ0FjJJF → rDu9PslAKyILjx18WKTCI}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{G2BdtwIuunZEcXQ0FjJJF → rDu9PslAKyILjx18WKTCI}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),o=e.i(91967),a=e.i(5978),s=e.i(22528),n=e.i(53532),l=e.i(41687),i=e.i(56720),c=e.i(13123),d=e.i(52740),p=e.i(39979),u=e.i(85995),h=e.i(87620),f=e.i(86874),m=e.i(36589),x=e.i(73772),v=e.i(13044),b="Popover",[g,j]=(0,s.createContextScope)(b,[d.createPopperScope]),C=(0,d.createPopperScope)(),[w,y]=g(b),N=e=>{let{__scopePopover:o,children:a,open:s,defaultOpen:n,onOpenChange:l,modal:i=!1}=e,p=C(o),u=r.useRef(null),[h,f]=r.useState(!1),[x,v]=(0,m.useControllableState)({prop:s,defaultProp:n??!1,onChange:l,caller:b});return(0,t.jsx)(d.Root,{...p,children:(0,t.jsx)(w,{scope:o,contentId:(0,c.useId)(),triggerRef:u,open:x,onOpenChange:v,onOpenToggle:r.useCallback(()=>v(e=>!e),[v]),hasCustomAnchor:h,onCustomAnchorAdd:r.useCallback(()=>f(!0),[]),onCustomAnchorRemove:r.useCallback(()=>f(!1),[]),modal:i,children:a})})};N.displayName=b;var P="PopoverAnchor",R=r.forwardRef((e,o)=>{let{__scopePopover:a,...s}=e,n=y(P,a),l=C(a),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=n;return r.useEffect(()=>(i(),()=>c()),[i,c]),(0,t.jsx)(d.Anchor,{...l,...s,ref:o})});R.displayName=P;var S="PopoverTrigger",k=r.forwardRef((e,r)=>{let{__scopePopover:s,...n}=e,l=y(S,s),i=C(s),c=(0,a.useComposedRefs)(r,l.triggerRef),p=(0,t.jsx)(h.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":z(l.open),...n,ref:c,onClick:(0,o.composeEventHandlers)(e.onClick,l.onOpenToggle)});return l.hasCustomAnchor?p:(0,t.jsx)(d.Anchor,{asChild:!0,...i,children:p})});k.displayName=S;var A="PopoverPortal",[E,D]=g(A,{forceMount:void 0}),O=e=>{let{__scopePopover:r,forceMount:o,children:a,container:s}=e,n=y(A,r);return(0,t.jsx)(E,{scope:r,forceMount:o,children:(0,t.jsx)(u.Presence,{present:o||n.open,children:(0,t.jsx)(p.Portal,{asChild:!0,container:s,children:a})})})};O.displayName=A;var F="PopoverContent",L=r.forwardRef((e,r)=>{let o=D(F,e.__scopePopover),{forceMount:a=o.forceMount,...s}=e,n=y(F,e.__scopePopover);return(0,t.jsx)(u.Presence,{present:a||n.open,children:n.modal?(0,t.jsx)(B,{...s,ref:r}):(0,t.jsx)(I,{...s,ref:r})})});L.displayName=F;var T=(0,f.createSlot)("PopoverContent.RemoveScroll"),B=r.forwardRef((e,s)=>{let n=y(F,e.__scopePopover),l=r.useRef(null),i=(0,a.useComposedRefs)(s,l),c=r.useRef(!1);return r.useEffect(()=>{let e=l.current;if(e)return(0,x.hideOthers)(e)},[]),(0,t.jsx)(v.RemoveScroll,{as:T,allowPinchZoom:!0,children:(0,t.jsx)(U,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),c.current||n.triggerRef.current?.focus()}),onPointerDownOutside:(0,o.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;c.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,o.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),I=r.forwardRef((e,o)=>{let a=y(F,e.__scopePopover),s=r.useRef(!1),n=r.useRef(!1);return(0,t.jsx)(U,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(s.current||a.triggerRef.current?.focus(),t.preventDefault()),s.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,"pointerdown"===t.detail.originalEvent.type&&(n.current=!0));let r=t.target;a.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&n.current&&t.preventDefault()}})}),U=r.forwardRef((e,r)=>{let{__scopePopover:o,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:c,disableOutsidePointerEvents:p,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,...x}=e,v=y(F,o),b=C(o);return(0,l.useFocusGuards)(),(0,t.jsx)(i.FocusScope,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:c,children:(0,t.jsx)(n.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:p,onInteractOutside:m,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onDismiss:()=>v.onOpenChange(!1),children:(0,t.jsx)(d.Content,{"data-state":z(v.open),role:"dialog",id:v.contentId,...b,...x,ref:r,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_="PopoverClose",H=r.forwardRef((e,r)=>{let{__scopePopover:a,...s}=e,n=y(_,a);return(0,t.jsx)(h.Primitive.button,{type:"button",...s,ref:r,onClick:(0,o.composeEventHandlers)(e.onClick,()=>n.onOpenChange(!1))})});H.displayName=_;var M=r.forwardRef((e,r)=>{let{__scopePopover:o,...a}=e,s=C(o);return(0,t.jsx)(d.Arrow,{...s,...a,ref:r})});function z(e){return e?"open":"closed"}M.displayName="PopoverArrow",e.s(["Anchor",()=>R,"Arrow",()=>M,"Close",()=>H,"Content",()=>L,"Popover",()=>N,"PopoverAnchor",()=>R,"PopoverArrow",()=>M,"PopoverClose",()=>H,"PopoverContent",()=>L,"PopoverPortal",()=>O,"PopoverTrigger",()=>k,"Portal",()=>O,"Root",()=>N,"Trigger",()=>k,"createPopoverScope",()=>j],89920);var G=e.i(89920),G=G,K=e.i(31777);let $=G.Root,W=G.Trigger;G.Anchor;let Z=r.forwardRef(({className:e,align:r="center",sideOffset:o=4,...a},s)=>(0,t.jsx)(G.Portal,{children:(0,t.jsx)(G.Content,{ref:s,align:r,sideOffset:o,className:(0,K.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...a})}));Z.displayName=G.Content.displayName,e.s(["Popover",()=>$,"PopoverContent",()=>Z,"PopoverTrigger",()=>W],90382)},83843,e=>{"use strict";let t=(0,e.i(3645).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);e.s(["ChevronsUpDown",()=>t],83843)},36479,e=>{"use strict";var t=e.i(20314),r=e.i(79054),o=e.i(31406),a=e.i(60112),s=e.i(21023);let n=(0,s.createServerReference)("4081559c4d3731a8f731ec4a54922f4beb7a472e54",s.callServer,void 0,s.findSourceMapURL,"adoptBranch"),l=(0,s.createServerReference)("404ec2b216ef34b2f7614120158751870c4ae39409",s.callServer,void 0,s.findSourceMapURL,"listBranches");var i=e.i(23925),c=e.i(97667),d=e.i(83843),p=e.i(49228),u=e.i(83428);e.i(1650);var h=e.i(11495),f=e.i(45811),m=e.i(35364),x=e.i(98127),v=e.i(41957),b=e.i(66459),g=e.i(31777);let j=r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...r}));j.displayName="Command";let C=r.forwardRef(({className:e,...r},o)=>(0,t.jsxs)("div",{className:"flex items-center border-b px-3",children:[(0,t.jsx)(b.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,t.jsx)("input",{ref:o,className:(0,g.cn)("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...r})]}));C.displayName="CommandInput";let w=r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("max-h-[300px] overflow-x-hidden overflow-y-auto",e),...r}));w.displayName="CommandList";let y=r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("text-muted-foreground py-6 text-center text-sm",e),...r}));y.displayName="CommandEmpty";let N=r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("text-foreground overflow-hidden p-1",e),...r}));N.displayName="CommandGroup";let P=r.forwardRef(({className:e,selected:r,...o},a)=>(0,t.jsx)("button",{ref:a,type:"button","data-selected":r,className:(0,g.cn)("relative flex w-full cursor-default items-center rounded-sm px-2 py-1.5 text-sm transition-colors outline-none select-none","hover:bg-accent hover:text-accent-foreground","data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground","disabled:pointer-events-none disabled:opacity-50",e),...o}));P.displayName="CommandItem",r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("bg-border -mx-1 h-px",e),...r})).displayName="CommandSeparator";var R=e.i(90382);function S({open:e,onClose:o,onSubmit:a,isSubmitting:s=!1,error:n,repositories:l=[],selectedRepositoryPath:b,onRepositoryChange:S,branches:k=[],branchesLoading:A=!1}){let[E,D]=(0,r.useState)(""),[O,F]=(0,r.useState)(!1),[L,T]=(0,r.useState)(""),B=(0,r.useRef)(null),[I,U]=(0,r.useState)(!1),[_,H]=(0,r.useState)(""),M=(0,r.useRef)(null),z=l.find(e=>e.path===b),G=!!b;(0,r.useEffect)(()=>{e||(D(""),T(""),F(!1),U(!1),H(""))},[e]),(0,r.useEffect)(()=>{D(""),T("")},[b]);let K=(0,r.useCallback)(e=>{e.preventDefault();let t=E.trim();t&&b&&!s&&a(t,b)},[E,b,s,a]),$=(0,r.useCallback)(()=>{D(""),T(""),o()},[o]),W=(0,r.useCallback)(e=>{D(e),T(e),F(!1)},[]),Z=(0,r.useCallback)(e=>{T(e.target.value),O||F(!0)},[O]),q=(0,r.useCallback)(e=>{if("Enter"===e.key){e.preventDefault();let t=L.trim();t&&(D(t),F(!1))}"Escape"===e.key&&(F(!1),T(E))},[L,E]),J=(0,r.useCallback)(e=>{S?.(e),U(!1),H("")},[S]),Q=k.filter(e=>e.toLowerCase().includes(L.toLowerCase())),V=_.trim()?l.filter(e=>e.name.toLowerCase().includes(_.toLowerCase())||e.path.toLowerCase().includes(_.toLowerCase())):l;(0,r.useEffect)(()=>{I?setTimeout(()=>M.current?.focus(),0):H("")},[I]);let X=!E.trim()||!b||s,Y=(0,t.jsxs)("div",{children:[(0,t.jsxs)(f.DrawerTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(p.GitBranch,{className:"h-4 w-4"}),"Adopt Branch"]}),(0,t.jsx)(f.DrawerDescription,{className:"text-muted-foreground text-sm",children:"Import an existing git branch into Shep's feature tracking"})]});return(0,t.jsx)(h.BaseDrawer,{open:e,onClose:$,size:"sm",modal:!1,header:Y,"data-testid":"adopt-branch-drawer",children:(0,t.jsxs)("form",{onSubmit:K,className:"flex flex-1 flex-col",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(v.Label,{children:"Repository"}),(0,t.jsxs)(R.Popover,{open:I,onOpenChange:U,children:[(0,t.jsx)(R.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",role:"combobox","aria-expanded":I,"aria-label":"Repository",disabled:s,"data-testid":"adopt-repo-combobox",className:(0,g.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!z&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:z?z.name:"Select repository..."}),(0,t.jsx)(d.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(R.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"adopt-repo-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(x.Input,{ref:M,placeholder:"Search repositories...",value:_,onChange:e=>H(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"adopt-repo-search"})}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Repositories",children:0===V.length?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No repositories found."}):V.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":b===e.path,onClick:()=>J(e.path),className:(0,g.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",b===e.path&&"bg-accent/50"),"data-testid":`adopt-repo-option-${e.id}`,children:[(0,t.jsx)(c.CheckIcon,{className:(0,g.cn)("h-4 w-4 shrink-0",b!==e.path&&"invisible")}),(0,t.jsxs)("span",{className:"flex flex-col items-start truncate",children:[(0,t.jsx)("span",{className:"truncate",children:e.name}),(0,t.jsx)("span",{className:"text-muted-foreground truncate text-xs",children:e.path})]})]},e.id))})]})})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Select the repository that contains the branch you want to adopt."})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(v.Label,{htmlFor:"branch-name",children:"Branch name"}),(0,t.jsxs)(R.Popover,{open:O,onOpenChange:F,children:[(0,t.jsx)(R.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(m.Button,{variant:"outline",role:"combobox","aria-expanded":O,disabled:s||!G,className:"w-full justify-between font-normal","data-testid":"adopt-branch-input",children:[(0,t.jsx)("span",{className:"truncate",children:G?A?"Loading branches...":E||"Select a branch...":"Select a repository first..."}),(0,t.jsx)(d.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(R.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:(0,t.jsxs)(j,{children:[(0,t.jsx)(C,{ref:B,placeholder:"Search branches...",value:L,onChange:Z,onKeyDown:q,"data-testid":"adopt-branch-search"}),(0,t.jsxs)(w,{children:[!A&&0===Q.length&&(0,t.jsx)(y,{children:0===k.length?"No branches found.":L?"No match — press Enter to use this value.":"No branches available."}),A?(0,t.jsx)(y,{children:(0,t.jsx)(u.Loader2,{className:"mx-auto h-4 w-4 animate-spin"})}):null,Q.length>0&&(0,t.jsx)(N,{children:Q.map(e=>(0,t.jsxs)(P,{selected:e===E,onClick:()=>W(e),children:[(0,t.jsx)(i.Check,{className:(0,g.cn)("mr-2 h-4 w-4",e===E?"opacity-100":"opacity-0")}),(0,t.jsx)(p.GitBranch,{className:"mr-2 h-3 w-3 opacity-50"}),e]},e))})]})]})})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:G?"Select a branch from the dropdown or type to search. Local and remote branches are shown.":"Please select a repository above to see available branches."})]}),n?(0,t.jsx)("p",{className:"text-destructive text-sm","data-testid":"adopt-branch-error",children:n}):null]})}),(0,t.jsx)("div",{className:"border-t p-4",children:(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(m.Button,{type:"button",variant:"outline",onClick:$,disabled:s,className:"flex-1",children:"Cancel"}),(0,t.jsx)(m.Button,{type:"submit",disabled:X,className:"flex-1","data-testid":"adopt-branch-submit",children:s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Adopting..."]}):"Adopt Branch"})]})})]})})}function k({repositoryPath:e,repositories:s}){let i=(0,o.useRouter)(),c=(0,o.usePathname)(),[d,p]=(0,r.useState)(!1),[u,h]=(0,r.useState)(),[f,m]=(0,r.useState)([]),[x,v]=(0,r.useState)(!1),[b,g]=(0,r.useState)(e),j=c.startsWith("/adopt"),C=!d&&j;(0,r.useEffect)(()=>{!j&&d&&p(!1)},[j,d]),(0,r.useEffect)(()=>{j&&(h(void 0),g(e))},[j,e]),(0,r.useEffect)(()=>{j&&b?(v(!0),m([]),l(b).then(m).catch(()=>m([])).finally(()=>v(!1))):m([])},[j,b]);let w=(0,r.useCallback)(()=>{i.push("/")},[i]),y=(0,r.useCallback)(e=>{g(e)},[]),N=(0,r.useCallback)((e,t)=>{h(void 0),p(!0),i.push("/"),n({branchName:e,repositoryPath:t}).then(e=>{e.error?a.toast.error(e.error):(window.dispatchEvent(new CustomEvent("shep:feature-created",{detail:{featureId:e.feature.id,name:e.feature.name,description:e.feature.description,repositoryPath:e.feature.repositoryPath}})),a.toast.success(`Branch adopted as "${e.feature.name}"`))}).catch(()=>{a.toast.error("Failed to adopt branch"),p(!1)})},[i]);return(0,t.jsx)(S,{open:C,onClose:w,onSubmit:N,isSubmitting:d,error:u,repositories:s,selectedRepositoryPath:b,onRepositoryChange:y,branches:f,branchesLoading:x})}e.s(["AdoptDrawerClient",()=>k],36479)}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),o=e.i(91967),a=e.i(5978),s=e.i(22528),n=e.i(53532),l=e.i(41687),i=e.i(56720),c=e.i(13123),d=e.i(52740),p=e.i(39979),u=e.i(85995),h=e.i(87620),f=e.i(86874),m=e.i(36589),x=e.i(73772),v=e.i(13044),b="Popover",[g,j]=(0,s.createContextScope)(b,[d.createPopperScope]),C=(0,d.createPopperScope)(),[w,y]=g(b),N=e=>{let{__scopePopover:o,children:a,open:s,defaultOpen:n,onOpenChange:l,modal:i=!1}=e,p=C(o),u=r.useRef(null),[h,f]=r.useState(!1),[x,v]=(0,m.useControllableState)({prop:s,defaultProp:n??!1,onChange:l,caller:b});return(0,t.jsx)(d.Root,{...p,children:(0,t.jsx)(w,{scope:o,contentId:(0,c.useId)(),triggerRef:u,open:x,onOpenChange:v,onOpenToggle:r.useCallback(()=>v(e=>!e),[v]),hasCustomAnchor:h,onCustomAnchorAdd:r.useCallback(()=>f(!0),[]),onCustomAnchorRemove:r.useCallback(()=>f(!1),[]),modal:i,children:a})})};N.displayName=b;var P="PopoverAnchor",R=r.forwardRef((e,o)=>{let{__scopePopover:a,...s}=e,n=y(P,a),l=C(a),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=n;return r.useEffect(()=>(i(),()=>c()),[i,c]),(0,t.jsx)(d.Anchor,{...l,...s,ref:o})});R.displayName=P;var S="PopoverTrigger",k=r.forwardRef((e,r)=>{let{__scopePopover:s,...n}=e,l=y(S,s),i=C(s),c=(0,a.useComposedRefs)(r,l.triggerRef),p=(0,t.jsx)(h.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":z(l.open),...n,ref:c,onClick:(0,o.composeEventHandlers)(e.onClick,l.onOpenToggle)});return l.hasCustomAnchor?p:(0,t.jsx)(d.Anchor,{asChild:!0,...i,children:p})});k.displayName=S;var A="PopoverPortal",[E,D]=g(A,{forceMount:void 0}),O=e=>{let{__scopePopover:r,forceMount:o,children:a,container:s}=e,n=y(A,r);return(0,t.jsx)(E,{scope:r,forceMount:o,children:(0,t.jsx)(u.Presence,{present:o||n.open,children:(0,t.jsx)(p.Portal,{asChild:!0,container:s,children:a})})})};O.displayName=A;var F="PopoverContent",L=r.forwardRef((e,r)=>{let o=D(F,e.__scopePopover),{forceMount:a=o.forceMount,...s}=e,n=y(F,e.__scopePopover);return(0,t.jsx)(u.Presence,{present:a||n.open,children:n.modal?(0,t.jsx)(B,{...s,ref:r}):(0,t.jsx)(I,{...s,ref:r})})});L.displayName=F;var T=(0,f.createSlot)("PopoverContent.RemoveScroll"),B=r.forwardRef((e,s)=>{let n=y(F,e.__scopePopover),l=r.useRef(null),i=(0,a.useComposedRefs)(s,l),c=r.useRef(!1);return r.useEffect(()=>{let e=l.current;if(e)return(0,x.hideOthers)(e)},[]),(0,t.jsx)(v.RemoveScroll,{as:T,allowPinchZoom:!0,children:(0,t.jsx)(U,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),c.current||n.triggerRef.current?.focus()}),onPointerDownOutside:(0,o.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;c.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,o.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),I=r.forwardRef((e,o)=>{let a=y(F,e.__scopePopover),s=r.useRef(!1),n=r.useRef(!1);return(0,t.jsx)(U,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(s.current||a.triggerRef.current?.focus(),t.preventDefault()),s.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,"pointerdown"===t.detail.originalEvent.type&&(n.current=!0));let r=t.target;a.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&n.current&&t.preventDefault()}})}),U=r.forwardRef((e,r)=>{let{__scopePopover:o,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:c,disableOutsidePointerEvents:p,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,...x}=e,v=y(F,o),b=C(o);return(0,l.useFocusGuards)(),(0,t.jsx)(i.FocusScope,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:c,children:(0,t.jsx)(n.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:p,onInteractOutside:m,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onDismiss:()=>v.onOpenChange(!1),children:(0,t.jsx)(d.Content,{"data-state":z(v.open),role:"dialog",id:v.contentId,...b,...x,ref:r,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_="PopoverClose",H=r.forwardRef((e,r)=>{let{__scopePopover:a,...s}=e,n=y(_,a);return(0,t.jsx)(h.Primitive.button,{type:"button",...s,ref:r,onClick:(0,o.composeEventHandlers)(e.onClick,()=>n.onOpenChange(!1))})});H.displayName=_;var M=r.forwardRef((e,r)=>{let{__scopePopover:o,...a}=e,s=C(o);return(0,t.jsx)(d.Arrow,{...s,...a,ref:r})});function z(e){return e?"open":"closed"}M.displayName="PopoverArrow",e.s(["Anchor",()=>R,"Arrow",()=>M,"Close",()=>H,"Content",()=>L,"Popover",()=>N,"PopoverAnchor",()=>R,"PopoverArrow",()=>M,"PopoverClose",()=>H,"PopoverContent",()=>L,"PopoverPortal",()=>O,"PopoverTrigger",()=>k,"Portal",()=>O,"Root",()=>N,"Trigger",()=>k,"createPopoverScope",()=>j],89920);var G=e.i(89920),G=G,K=e.i(31777);let $=G.Root,W=G.Trigger;G.Anchor;let Z=r.forwardRef(({className:e,align:r="center",sideOffset:o=4,...a},s)=>(0,t.jsx)(G.Portal,{children:(0,t.jsx)(G.Content,{ref:s,align:r,sideOffset:o,className:(0,K.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...a})}));Z.displayName=G.Content.displayName,e.s(["Popover",()=>$,"PopoverContent",()=>Z,"PopoverTrigger",()=>W],90382)},83843,e=>{"use strict";let t=(0,e.i(3645).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);e.s(["ChevronsUpDown",()=>t],83843)},36479,e=>{"use strict";var t=e.i(20314),r=e.i(79054),o=e.i(31406),a=e.i(60112),s=e.i(21023);let n=(0,s.createServerReference)("40424d3d246379c5671fe9a1a9e8fe26461a67c647",s.callServer,void 0,s.findSourceMapURL,"adoptBranch"),l=(0,s.createServerReference)("40167b5f47ff0875a487cb17e7a2498fa391635bca",s.callServer,void 0,s.findSourceMapURL,"listBranches");var i=e.i(23925),c=e.i(97667),d=e.i(83843),p=e.i(49228),u=e.i(83428);e.i(1650);var h=e.i(11495),f=e.i(45811),m=e.i(35364),x=e.i(98127),v=e.i(41957),b=e.i(66459),g=e.i(31777);let j=r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...r}));j.displayName="Command";let C=r.forwardRef(({className:e,...r},o)=>(0,t.jsxs)("div",{className:"flex items-center border-b px-3",children:[(0,t.jsx)(b.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,t.jsx)("input",{ref:o,className:(0,g.cn)("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...r})]}));C.displayName="CommandInput";let w=r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("max-h-[300px] overflow-x-hidden overflow-y-auto",e),...r}));w.displayName="CommandList";let y=r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("text-muted-foreground py-6 text-center text-sm",e),...r}));y.displayName="CommandEmpty";let N=r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("text-foreground overflow-hidden p-1",e),...r}));N.displayName="CommandGroup";let P=r.forwardRef(({className:e,selected:r,...o},a)=>(0,t.jsx)("button",{ref:a,type:"button","data-selected":r,className:(0,g.cn)("relative flex w-full cursor-default items-center rounded-sm px-2 py-1.5 text-sm transition-colors outline-none select-none","hover:bg-accent hover:text-accent-foreground","data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground","disabled:pointer-events-none disabled:opacity-50",e),...o}));P.displayName="CommandItem",r.forwardRef(({className:e,...r},o)=>(0,t.jsx)("div",{ref:o,className:(0,g.cn)("bg-border -mx-1 h-px",e),...r})).displayName="CommandSeparator";var R=e.i(90382);function S({open:e,onClose:o,onSubmit:a,isSubmitting:s=!1,error:n,repositories:l=[],selectedRepositoryPath:b,onRepositoryChange:S,branches:k=[],branchesLoading:A=!1}){let[E,D]=(0,r.useState)(""),[O,F]=(0,r.useState)(!1),[L,T]=(0,r.useState)(""),B=(0,r.useRef)(null),[I,U]=(0,r.useState)(!1),[_,H]=(0,r.useState)(""),M=(0,r.useRef)(null),z=l.find(e=>e.path===b),G=!!b;(0,r.useEffect)(()=>{e||(D(""),T(""),F(!1),U(!1),H(""))},[e]),(0,r.useEffect)(()=>{D(""),T("")},[b]);let K=(0,r.useCallback)(e=>{e.preventDefault();let t=E.trim();t&&b&&!s&&a(t,b)},[E,b,s,a]),$=(0,r.useCallback)(()=>{D(""),T(""),o()},[o]),W=(0,r.useCallback)(e=>{D(e),T(e),F(!1)},[]),Z=(0,r.useCallback)(e=>{T(e.target.value),O||F(!0)},[O]),q=(0,r.useCallback)(e=>{if("Enter"===e.key){e.preventDefault();let t=L.trim();t&&(D(t),F(!1))}"Escape"===e.key&&(F(!1),T(E))},[L,E]),J=(0,r.useCallback)(e=>{S?.(e),U(!1),H("")},[S]),Q=k.filter(e=>e.toLowerCase().includes(L.toLowerCase())),V=_.trim()?l.filter(e=>e.name.toLowerCase().includes(_.toLowerCase())||e.path.toLowerCase().includes(_.toLowerCase())):l;(0,r.useEffect)(()=>{I?setTimeout(()=>M.current?.focus(),0):H("")},[I]);let X=!E.trim()||!b||s,Y=(0,t.jsxs)("div",{children:[(0,t.jsxs)(f.DrawerTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(p.GitBranch,{className:"h-4 w-4"}),"Adopt Branch"]}),(0,t.jsx)(f.DrawerDescription,{className:"text-muted-foreground text-sm",children:"Import an existing git branch into Shep's feature tracking"})]});return(0,t.jsx)(h.BaseDrawer,{open:e,onClose:$,size:"sm",modal:!1,header:Y,"data-testid":"adopt-branch-drawer",children:(0,t.jsxs)("form",{onSubmit:K,className:"flex flex-1 flex-col",children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(v.Label,{children:"Repository"}),(0,t.jsxs)(R.Popover,{open:I,onOpenChange:U,children:[(0,t.jsx)(R.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",role:"combobox","aria-expanded":I,"aria-label":"Repository",disabled:s,"data-testid":"adopt-repo-combobox",className:(0,g.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!z&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:z?z.name:"Select repository..."}),(0,t.jsx)(d.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(R.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"adopt-repo-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(x.Input,{ref:M,placeholder:"Search repositories...",value:_,onChange:e=>H(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"adopt-repo-search"})}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Repositories",children:0===V.length?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No repositories found."}):V.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":b===e.path,onClick:()=>J(e.path),className:(0,g.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",b===e.path&&"bg-accent/50"),"data-testid":`adopt-repo-option-${e.id}`,children:[(0,t.jsx)(c.CheckIcon,{className:(0,g.cn)("h-4 w-4 shrink-0",b!==e.path&&"invisible")}),(0,t.jsxs)("span",{className:"flex flex-col items-start truncate",children:[(0,t.jsx)("span",{className:"truncate",children:e.name}),(0,t.jsx)("span",{className:"text-muted-foreground truncate text-xs",children:e.path})]})]},e.id))})]})})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Select the repository that contains the branch you want to adopt."})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(v.Label,{htmlFor:"branch-name",children:"Branch name"}),(0,t.jsxs)(R.Popover,{open:O,onOpenChange:F,children:[(0,t.jsx)(R.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(m.Button,{variant:"outline",role:"combobox","aria-expanded":O,disabled:s||!G,className:"w-full justify-between font-normal","data-testid":"adopt-branch-input",children:[(0,t.jsx)("span",{className:"truncate",children:G?A?"Loading branches...":E||"Select a branch...":"Select a repository first..."}),(0,t.jsx)(d.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(R.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:(0,t.jsxs)(j,{children:[(0,t.jsx)(C,{ref:B,placeholder:"Search branches...",value:L,onChange:Z,onKeyDown:q,"data-testid":"adopt-branch-search"}),(0,t.jsxs)(w,{children:[!A&&0===Q.length&&(0,t.jsx)(y,{children:0===k.length?"No branches found.":L?"No match — press Enter to use this value.":"No branches available."}),A?(0,t.jsx)(y,{children:(0,t.jsx)(u.Loader2,{className:"mx-auto h-4 w-4 animate-spin"})}):null,Q.length>0&&(0,t.jsx)(N,{children:Q.map(e=>(0,t.jsxs)(P,{selected:e===E,onClick:()=>W(e),children:[(0,t.jsx)(i.Check,{className:(0,g.cn)("mr-2 h-4 w-4",e===E?"opacity-100":"opacity-0")}),(0,t.jsx)(p.GitBranch,{className:"mr-2 h-3 w-3 opacity-50"}),e]},e))})]})]})})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:G?"Select a branch from the dropdown or type to search. Local and remote branches are shown.":"Please select a repository above to see available branches."})]}),n?(0,t.jsx)("p",{className:"text-destructive text-sm","data-testid":"adopt-branch-error",children:n}):null]})}),(0,t.jsx)("div",{className:"border-t p-4",children:(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(m.Button,{type:"button",variant:"outline",onClick:$,disabled:s,className:"flex-1",children:"Cancel"}),(0,t.jsx)(m.Button,{type:"submit",disabled:X,className:"flex-1","data-testid":"adopt-branch-submit",children:s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Adopting..."]}):"Adopt Branch"})]})})]})})}function k({repositoryPath:e,repositories:s}){let i=(0,o.useRouter)(),c=(0,o.usePathname)(),[d,p]=(0,r.useState)(!1),[u,h]=(0,r.useState)(),[f,m]=(0,r.useState)([]),[x,v]=(0,r.useState)(!1),[b,g]=(0,r.useState)(e),j=c.startsWith("/adopt"),C=!d&&j;(0,r.useEffect)(()=>{!j&&d&&p(!1)},[j,d]),(0,r.useEffect)(()=>{j&&(h(void 0),g(e))},[j,e]),(0,r.useEffect)(()=>{j&&b?(v(!0),m([]),l(b).then(m).catch(()=>m([])).finally(()=>v(!1))):m([])},[j,b]);let w=(0,r.useCallback)(()=>{i.push("/")},[i]),y=(0,r.useCallback)(e=>{g(e)},[]),N=(0,r.useCallback)((e,t)=>{h(void 0),p(!0),i.push("/"),n({branchName:e,repositoryPath:t}).then(e=>{e.error?a.toast.error(e.error):(window.dispatchEvent(new CustomEvent("shep:feature-created",{detail:{featureId:e.feature.id,name:e.feature.name,description:e.feature.description,repositoryPath:e.feature.repositoryPath}})),a.toast.success(`Branch adopted as "${e.feature.name}"`))}).catch(()=>{a.toast.error("Failed to adopt branch"),p(!1)})},[i]);return(0,t.jsx)(S,{open:C,onClose:w,onSubmit:N,isSubmitting:d,error:u,repositories:s,selectedRepositoryPath:b,onRepositoryChange:y,branches:f,branchesLoading:x})}e.s(["AdoptDrawerClient",()=>k],36479)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58860,44229,e=>{"use strict";let t=(0,e.i(3645).default)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);e.s(["Timer",()=>t],58860);var r=e.i(93752);e.s(["Code",()=>r.default],44229)},10714,99105,e=>{"use strict";var t=e.i(3645);let r=(0,t.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",()=>r],10714);let o=(0,t.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>o],99105)},38573,e=>{"use strict";let t=(0,e.i(3645).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],38573)},30702,e=>{"use strict";let t=(0,e.i(3645).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],30702)},23925,1012,e=>{"use strict";let t=(0,e.i(3645).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],1012),e.s(["Check",()=>t],23925)},23405,e=>{"use strict";var t=e.i(79054);function r(e){let r=t.useRef({value:e,previous:e});return t.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}e.s(["usePrevious",()=>r])},11345,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",()=>t],11345)},76016,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],76016)},93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},83902,e=>{"use strict";let t=(0,e.i(3645).default)("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);e.s(["Rocket",()=>t],83902)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),o=e.i(91967),a=e.i(5978),n=e.i(22528),s=e.i(53532),i=e.i(41687),l=e.i(56720),d=e.i(13123),c=e.i(52740),u=e.i(39979),p=e.i(85995),f=e.i(87620),h=e.i(86874),m=e.i(36589),v=e.i(73772),x=e.i(13044),g="Popover",[b,y]=(0,n.createContextScope)(g,[c.createPopperScope]),k=(0,c.createPopperScope)(),[w,j]=b(g),C=e=>{let{__scopePopover:o,children:a,open:n,defaultOpen:s,onOpenChange:i,modal:l=!1}=e,u=k(o),p=r.useRef(null),[f,h]=r.useState(!1),[v,x]=(0,m.useControllableState)({prop:n,defaultProp:s??!1,onChange:i,caller:g});return(0,t.jsx)(c.Root,{...u,children:(0,t.jsx)(w,{scope:o,contentId:(0,d.useId)(),triggerRef:p,open:v,onOpenChange:x,onOpenToggle:r.useCallback(()=>x(e=>!e),[x]),hasCustomAnchor:f,onCustomAnchorAdd:r.useCallback(()=>h(!0),[]),onCustomAnchorRemove:r.useCallback(()=>h(!1),[]),modal:l,children:a})})};C.displayName=g;var P="PopoverAnchor",R=r.forwardRef((e,o)=>{let{__scopePopover:a,...n}=e,s=j(P,a),i=k(a),{onCustomAnchorAdd:l,onCustomAnchorRemove:d}=s;return r.useEffect(()=>(l(),()=>d()),[l,d]),(0,t.jsx)(c.Anchor,{...i,...n,ref:o})});R.displayName=P;var N="PopoverTrigger",A=r.forwardRef((e,r)=>{let{__scopePopover:n,...s}=e,i=j(N,n),l=k(n),d=(0,a.useComposedRefs)(r,i.triggerRef),u=(0,t.jsx)(f.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":U(i.open),...s,ref:d,onClick:(0,o.composeEventHandlers)(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?u:(0,t.jsx)(c.Anchor,{asChild:!0,...l,children:u})});A.displayName=N;var S="PopoverPortal",[T,M]=b(S,{forceMount:void 0}),E=e=>{let{__scopePopover:r,forceMount:o,children:a,container:n}=e,s=j(S,r);return(0,t.jsx)(T,{scope:r,forceMount:o,children:(0,t.jsx)(p.Presence,{present:o||s.open,children:(0,t.jsx)(u.Portal,{asChild:!0,container:n,children:a})})})};E.displayName=S;var F="PopoverContent",O=r.forwardRef((e,r)=>{let o=M(F,e.__scopePopover),{forceMount:a=o.forceMount,...n}=e,s=j(F,e.__scopePopover);return(0,t.jsx)(p.Presence,{present:a||s.open,children:s.modal?(0,t.jsx)(D,{...n,ref:r}):(0,t.jsx)(I,{...n,ref:r})})});O.displayName=F;var z=(0,h.createSlot)("PopoverContent.RemoveScroll"),D=r.forwardRef((e,n)=>{let s=j(F,e.__scopePopover),i=r.useRef(null),l=(0,a.useComposedRefs)(n,i),d=r.useRef(!1);return r.useEffect(()=>{let e=i.current;if(e)return(0,v.hideOthers)(e)},[]),(0,t.jsx)(x.RemoveScroll,{as:z,allowPinchZoom:!0,children:(0,t.jsx)(q,{...e,ref:l,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),d.current||s.triggerRef.current?.focus()}),onPointerDownOutside:(0,o.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;d.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,o.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),I=r.forwardRef((e,o)=>{let a=j(F,e.__scopePopover),n=r.useRef(!1),s=r.useRef(!1);return(0,t.jsx)(q,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(n.current||a.triggerRef.current?.focus(),t.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(s.current=!0));let r=t.target;a.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),q=r.forwardRef((e,r)=>{let{__scopePopover:o,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:d,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,...v}=e,x=j(F,o),g=k(o);return(0,i.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:d,children:(0,t.jsx)(s.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:m,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:(0,t.jsx)(c.Content,{"data-state":U(x.open),role:"dialog",id:x.contentId,...g,...v,ref:r,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),H="PopoverClose",L=r.forwardRef((e,r)=>{let{__scopePopover:a,...n}=e,s=j(H,a);return(0,t.jsx)(f.Primitive.button,{type:"button",...n,ref:r,onClick:(0,o.composeEventHandlers)(e.onClick,()=>s.onOpenChange(!1))})});L.displayName=H;var _=r.forwardRef((e,r)=>{let{__scopePopover:o,...a}=e,n=k(o);return(0,t.jsx)(c.Arrow,{...n,...a,ref:r})});function U(e){return e?"open":"closed"}_.displayName="PopoverArrow",e.s(["Anchor",()=>R,"Arrow",()=>_,"Close",()=>L,"Content",()=>O,"Popover",()=>C,"PopoverAnchor",()=>R,"PopoverArrow",()=>_,"PopoverClose",()=>L,"PopoverContent",()=>O,"PopoverPortal",()=>E,"PopoverTrigger",()=>A,"Portal",()=>E,"Root",()=>C,"Trigger",()=>A,"createPopoverScope",()=>y],89920);var B=e.i(89920),B=B,K=e.i(31777);let X=B.Root,G=B.Trigger;B.Anchor;let V=r.forwardRef(({className:e,align:r="center",sideOffset:o=4,...a},n)=>(0,t.jsx)(B.Portal,{children:(0,t.jsx)(B.Content,{ref:n,align:r,sideOffset:o,className:(0,K.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...a})}));V.displayName=B.Content.displayName,e.s(["Popover",()=>X,"PopoverContent",()=>V,"PopoverTrigger",()=>G],90382)},878,81636,e=>{"use strict";var t=e.i(21023);let r=(0,t.createServerReference)("00df71ce74dc6594084fd1ecc487ec02f55b6db017",t.callServer,void 0,t.findSourceMapURL,"getAllAgentModels");e.s(["getAllAgentModels",()=>r],878);let o=(0,t.createServerReference)("6072bd64fd2f9348e7503e605694e27f8d8749cc0e",t.callServer,void 0,t.findSourceMapURL,"updateAgentAndModel");e.s(["updateAgentAndModel",()=>o],81636)},51911,41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),o=e.i(91967),a=e.i(5978),n=e.i(22528),s=e.i(36589),i=e.i(23405),l=e.i(77624),d=e.i(87620),c="Switch",[u,p]=(0,n.createContextScope)(c),[f,h]=u(c),m=r.forwardRef((e,n)=>{let{__scopeSwitch:i,name:l,checked:u,defaultChecked:p,required:h,disabled:m,value:v="on",onCheckedChange:x,form:y,...k}=e,[w,j]=r.useState(null),C=(0,a.useComposedRefs)(n,e=>j(e)),P=r.useRef(!1),R=!w||y||!!w.closest("form"),[N,A]=(0,s.useControllableState)({prop:u,defaultProp:p??!1,onChange:x,caller:c});return(0,t.jsxs)(f,{scope:i,checked:N,disabled:m,children:[(0,t.jsx)(d.Primitive.button,{type:"button",role:"switch","aria-checked":N,"aria-required":h,"data-state":b(N),"data-disabled":m?"":void 0,disabled:m,value:v,...k,ref:C,onClick:(0,o.composeEventHandlers)(e.onClick,e=>{A(e=>!e),R&&(P.current=e.isPropagationStopped(),P.current||e.stopPropagation())})}),R&&(0,t.jsx)(g,{control:w,bubbles:!P.current,name:l,value:v,checked:N,required:h,disabled:m,form:y,style:{transform:"translateX(-100%)"}})]})});m.displayName=c;var v="SwitchThumb",x=r.forwardRef((e,r)=>{let{__scopeSwitch:o,...a}=e,n=h(v,o);return(0,t.jsx)(d.Primitive.span,{"data-state":b(n.checked),"data-disabled":n.disabled?"":void 0,...a,ref:r})});x.displayName=v;var g=r.forwardRef(({__scopeSwitch:e,control:o,checked:n,bubbles:s=!0,...d},c)=>{let u=r.useRef(null),p=(0,a.useComposedRefs)(u,c),f=(0,i.usePrevious)(n),h=(0,l.useSize)(o);return r.useEffect(()=>{let e=u.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(f!==n&&t){let r=new Event("click",{bubbles:s});t.call(e,n),e.dispatchEvent(r)}},[f,n,s]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...d,tabIndex:-1,ref:p,style:{...d.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function b(e){return e?"checked":"unchecked"}g.displayName="SwitchBubbleInput",e.s(["Root",()=>m,"Switch",()=>m,"SwitchThumb",()=>x,"Thumb",()=>x,"createSwitchScope",()=>p],95291);var y=e.i(95291),y=y,k=e.i(31777);function w({className:e,size:r="default",...o}){return(0,t.jsx)(y.Root,{"data-slot":"switch","data-size":r,className:(0,k.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...o,children:(0,t.jsx)(y.Thumb,{"data-slot":"switch-thumb",className:(0,k.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>w],51911);var j=e.i(23925),C=e.i(11345),P=e.i(76016),R=e.i(878),N=e.i(81636),A=e.i(86782),S=e.i(29847),T=e.i(35364),M=e.i(90382);function E({initialAgentType:e,initialModel:o,onAgentModelChange:a,disabled:n,className:s,mode:i}){let[l,d]=r.useState(!1),[c,u]=r.useState([]),[p,f]=r.useState(!0),[h,m]=r.useState(e),[v,x]=r.useState(o),[g,b]=r.useState(null),[y,w]=r.useState(0),[E,F]=r.useState(null);r.useEffect(()=>{(0,R.getAllAgentModels)().then(u).finally(()=>f(!1))},[]),r.useEffect(()=>{if(!l){let e=setTimeout(()=>{w(0),F(null)},150);return()=>clearTimeout(e)}},[l]);let O=async(e,t)=>{if(d(!1),e!==h||t!==v){if("override"===i){m(e),x(t),a?.(e,t);return}m(e),x(t),a?.(e,t),b(null);try{let r=await (0,N.updateAgentAndModel)(e,t||null);r.ok||(m(h),x(v),a?.(h,v),b(r.error??"Failed to save"))}catch{m(h),x(v),a?.(h,v),b("Failed to save")}}},z=(0,A.getAgentTypeIcon)(h),D=c.find(e=>e.agentType===h)?.label??h,I=v?(0,S.getModelMeta)(v).displayName||v:null,q=E?c.find(e=>e.agentType===E):null;return(0,t.jsxs)("div",{className:(0,k.cn)("flex flex-col gap-1",s),children:[(0,t.jsxs)(M.Popover,{open:l,onOpenChange:d,children:[(0,t.jsx)(M.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(T.Button,{variant:"outline",role:"combobox","aria-expanded":l,disabled:(n??!1)||p,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(z,{className:"h-4 w-4 shrink-0"}),p?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:D}),I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:I})]}):null]})]})})}),(0,t.jsx)(M.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===y?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),c.map(e=>{let r=(0,A.getAgentTypeIcon)(e.agentType),o=h===e.agentType,a=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,k.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",o&&"bg-accent/50"),onClick:()=>{a?(F(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>w(1))})):O(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),o&&!a?(0,t.jsx)(j.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,a?(0,t.jsx)(P.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{w(0),setTimeout(()=>F(null),220)},children:[(0,t.jsx)(C.ChevronLeft,{className:"h-3.5 w-3.5"}),q.label]}),q.models.map(e=>{let r=h===q.agentType&&v===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,k.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>O(q.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(j.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!g&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:g})]})}e.s(["AgentModelPicker",()=>E],41413)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95230,e=>{"use strict";let t=(0,e.i(3645).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["default",()=>t])},93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},16868,48306,80436,28267,16298,86254,50032,42076,e=>{"use strict";var t=e.i(3645);let r=(0,t.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);e.s(["PaperclipIcon",()=>r],16868);var a=e.i(20314),s=e.i(31777);function o({className:e,...t}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,s.cn)("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input field-sizing-content min-h-[80px] w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...t})}e.s(["Textarea",()=>o],48306);var i=e.i(60253),n=e.i(15506),n=n,l=e.i(95230);e.s(["DownloadIcon",()=>l.default],80436);var l=l,d=e.i(2287),c=e.i(1693);e.s(["VisuallyHidden",0,c],28267);var c=c;let p=(0,t.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),u=(0,t.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",()=>u],16298);let h=(0,t.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var m=e.i(93752),m=m;e.i(35364);let x=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]),f=new Set([".ts",".tsx",".js",".jsx",".json",".yaml",".yml",".xml",".html",".css",".md"]);function g(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(+(0!==t))} ${["B","KB","MB","GB"][t]}`}let b=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function v(e,t){let r=new URLSearchParams({path:e,mimeType:t});return`/api/attachments/preview?${r.toString()}`}function j({name:e,size:t,mimeType:r,path:o,onRemove:j,loading:w=!1,disabled:y=!1}){let C,k,N=(C=e.lastIndexOf("."))>=0?e.slice(C).toLowerCase():"",P=x.has(N)?h:".pdf"===N?u:f.has(N)?m.default:p,T=".pdf"===N?"bg-red-50 text-red-600":x.has(N)?"bg-blue-50 text-blue-600":f.has(N)?"bg-emerald-50 text-emerald-600":"bg-gray-50 text-gray-600",S=(k=e.lastIndexOf("."))>=0&&b.has(e.slice(k).toLowerCase());return w?(0,a.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-md border",children:(0,a.jsx)(n.default,{className:"text-muted-foreground h-5 w-5 animate-spin"})}):S?(0,a.jsxs)(d.Dialog,{children:[(0,a.jsxs)("div",{className:"group relative",children:[(0,a.jsx)(d.DialogTrigger,{asChild:!0,children:(0,a.jsx)("img",{src:v(o,r),alt:e,title:e,className:"h-12 w-12 cursor-pointer rounded-md border object-cover transition-opacity hover:opacity-80"})}),!y&&(0,a.jsx)("button",{type:"button",onClick:j,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,a.jsx)(i.X,{className:"h-3 w-3"})})]}),(0,a.jsxs)(d.DialogContent,{className:"max-w-3xl gap-0 overflow-hidden border-0 p-0 [&>button:last-child]:!cursor-pointer [&>button:last-child]:!rounded-full [&>button:last-child]:!bg-black/70 [&>button:last-child]:!p-1.5 [&>button:last-child]:!text-white [&>button:last-child]:!opacity-100 [&>button:last-child]:!shadow-lg [&>button:last-child]:!backdrop-blur-md [&>button:last-child]:hover:!bg-black/90",children:[(0,a.jsx)(c.Root,{children:(0,a.jsxs)(d.DialogTitle,{children:["Preview: ",e]})}),(0,a.jsx)("div",{className:"relative bg-black/90",children:(0,a.jsx)("img",{src:v(o,r),alt:e,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,a.jsxs)("div",{className:"bg-background flex items-center gap-3 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,a.jsx)("span",{className:"truncate text-sm font-medium",children:e}),(0,a.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)})]}),(0,a.jsx)("a",{href:v(o,r),download:e,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${e}`,children:(0,a.jsx)(l.default,{className:"h-4 w-4"})})]})]})]}):(0,a.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-full border py-1 pr-3 pl-2",children:[(0,a.jsx)("div",{className:(0,s.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",T),children:(0,a.jsx)(P,{className:"h-3 w-3"})}),(0,a.jsx)("span",{className:"max-w-[120px] truncate text-sm",children:e}),(0,a.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)}),!y&&(0,a.jsx)("button",{type:"button",onClick:j,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,a.jsx)(i.X,{className:"h-3 w-3"})})]})}async function w(){let e=await fetch("/api/dialog/pick-files",{method:"POST"});if(!e.ok)throw Error("Failed to open file dialog");let t=await e.json();return t.cancelled?null:t.files}e.s(["AttachmentChip",()=>j],86254),e.s([],50032),e.s(["pickFiles",()=>w],42076)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),s=e.i(5978),o=e.i(22528),i=e.i(53532),n=e.i(41687),l=e.i(56720),d=e.i(13123),c=e.i(52740),p=e.i(39979),u=e.i(85995),h=e.i(87620),m=e.i(86874),x=e.i(36589),f=e.i(73772),g=e.i(13044),b="Popover",[v,j]=(0,o.createContextScope)(b,[c.createPopperScope]),w=(0,c.createPopperScope)(),[y,C]=v(b),k=e=>{let{__scopePopover:a,children:s,open:o,defaultOpen:i,onOpenChange:n,modal:l=!1}=e,p=w(a),u=r.useRef(null),[h,m]=r.useState(!1),[f,g]=(0,x.useControllableState)({prop:o,defaultProp:i??!1,onChange:n,caller:b});return(0,t.jsx)(c.Root,{...p,children:(0,t.jsx)(y,{scope:a,contentId:(0,d.useId)(),triggerRef:u,open:f,onOpenChange:g,onOpenToggle:r.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:h,onCustomAnchorAdd:r.useCallback(()=>m(!0),[]),onCustomAnchorRemove:r.useCallback(()=>m(!1),[]),modal:l,children:s})})};k.displayName=b;var N="PopoverAnchor",P=r.forwardRef((e,a)=>{let{__scopePopover:s,...o}=e,i=C(N,s),n=w(s),{onCustomAnchorAdd:l,onCustomAnchorRemove:d}=i;return r.useEffect(()=>(l(),()=>d()),[l,d]),(0,t.jsx)(c.Anchor,{...n,...o,ref:a})});P.displayName=N;var T="PopoverTrigger",S=r.forwardRef((e,r)=>{let{__scopePopover:o,...i}=e,n=C(T,o),l=w(o),d=(0,s.useComposedRefs)(r,n.triggerRef),p=(0,t.jsx)(h.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":H(n.open),...i,ref:d,onClick:(0,a.composeEventHandlers)(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:(0,t.jsx)(c.Anchor,{asChild:!0,...l,children:p})});S.displayName=T;var R="PopoverPortal",[A,F]=v(R,{forceMount:void 0}),E=e=>{let{__scopePopover:r,forceMount:a,children:s,container:o}=e,i=C(R,r);return(0,t.jsx)(A,{scope:r,forceMount:a,children:(0,t.jsx)(u.Presence,{present:a||i.open,children:(0,t.jsx)(p.Portal,{asChild:!0,container:o,children:s})})})};E.displayName=R;var D="PopoverContent",O=r.forwardRef((e,r)=>{let a=F(D,e.__scopePopover),{forceMount:s=a.forceMount,...o}=e,i=C(D,e.__scopePopover);return(0,t.jsx)(u.Presence,{present:s||i.open,children:i.modal?(0,t.jsx)(z,{...o,ref:r}):(0,t.jsx)(M,{...o,ref:r})})});O.displayName=D;var I=(0,m.createSlot)("PopoverContent.RemoveScroll"),z=r.forwardRef((e,o)=>{let i=C(D,e.__scopePopover),n=r.useRef(null),l=(0,s.useComposedRefs)(o,n),d=r.useRef(!1);return r.useEffect(()=>{let e=n.current;if(e)return(0,f.hideOthers)(e)},[]),(0,t.jsx)(g.RemoveScroll,{as:I,allowPinchZoom:!0,children:(0,t.jsx)(L,{...e,ref:l,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,a.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),d.current||i.triggerRef.current?.focus()}),onPointerDownOutside:(0,a.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;d.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,a.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),M=r.forwardRef((e,a)=>{let s=C(D,e.__scopePopover),o=r.useRef(!1),i=r.useRef(!1);return(0,t.jsx)(L,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||s.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let r=t.target;s.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),L=r.forwardRef((e,r)=>{let{__scopePopover:a,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:d,disableOutsidePointerEvents:p,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:x,...f}=e,g=C(D,a),b=w(a);return(0,n.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:d,children:(0,t.jsx)(i.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:p,onInteractOutside:x,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>g.onOpenChange(!1),children:(0,t.jsx)(c.Content,{"data-state":H(g.open),role:"dialog",id:g.contentId,...b,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),U="PopoverClose",B=r.forwardRef((e,r)=>{let{__scopePopover:s,...o}=e,i=C(U,s);return(0,t.jsx)(h.Primitive.button,{type:"button",...o,ref:r,onClick:(0,a.composeEventHandlers)(e.onClick,()=>i.onOpenChange(!1))})});B.displayName=U;var $=r.forwardRef((e,r)=>{let{__scopePopover:a,...s}=e,o=w(a);return(0,t.jsx)(c.Arrow,{...o,...s,ref:r})});function H(e){return e?"open":"closed"}$.displayName="PopoverArrow",e.s(["Anchor",()=>P,"Arrow",()=>$,"Close",()=>B,"Content",()=>O,"Popover",()=>k,"PopoverAnchor",()=>P,"PopoverArrow",()=>$,"PopoverClose",()=>B,"PopoverContent",()=>O,"PopoverPortal",()=>E,"PopoverTrigger",()=>S,"Portal",()=>E,"Root",()=>k,"Trigger",()=>S,"createPopoverScope",()=>j],89920);var q=e.i(89920),q=q,G=e.i(31777);let _=q.Root,K=q.Trigger;q.Anchor;let W=r.forwardRef(({className:e,align:r="center",sideOffset:a=4,...s},o)=>(0,t.jsx)(q.Portal,{children:(0,t.jsx)(q.Content,{ref:o,align:r,sideOffset:a,className:(0,G.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...s})}));W.displayName=q.Content.displayName,e.s(["Popover",()=>_,"PopoverContent",()=>W,"PopoverTrigger",()=>K],90382)},83843,e=>{"use strict";let t=(0,e.i(3645).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);e.s(["ChevronsUpDown",()=>t],83843)},51911,41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),s=e.i(5978),o=e.i(22528),i=e.i(36589),n=e.i(23405),l=e.i(77624),d=e.i(87620),c="Switch",[p,u]=(0,o.createContextScope)(c),[h,m]=p(c),x=r.forwardRef((e,o)=>{let{__scopeSwitch:n,name:l,checked:p,defaultChecked:u,required:m,disabled:x,value:f="on",onCheckedChange:g,form:j,...w}=e,[y,C]=r.useState(null),k=(0,s.useComposedRefs)(o,e=>C(e)),N=r.useRef(!1),P=!y||j||!!y.closest("form"),[T,S]=(0,i.useControllableState)({prop:p,defaultProp:u??!1,onChange:g,caller:c});return(0,t.jsxs)(h,{scope:n,checked:T,disabled:x,children:[(0,t.jsx)(d.Primitive.button,{type:"button",role:"switch","aria-checked":T,"aria-required":m,"data-state":v(T),"data-disabled":x?"":void 0,disabled:x,value:f,...w,ref:k,onClick:(0,a.composeEventHandlers)(e.onClick,e=>{S(e=>!e),P&&(N.current=e.isPropagationStopped(),N.current||e.stopPropagation())})}),P&&(0,t.jsx)(b,{control:y,bubbles:!N.current,name:l,value:f,checked:T,required:m,disabled:x,form:j,style:{transform:"translateX(-100%)"}})]})});x.displayName=c;var f="SwitchThumb",g=r.forwardRef((e,r)=>{let{__scopeSwitch:a,...s}=e,o=m(f,a);return(0,t.jsx)(d.Primitive.span,{"data-state":v(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})});g.displayName=f;var b=r.forwardRef(({__scopeSwitch:e,control:a,checked:o,bubbles:i=!0,...d},c)=>{let p=r.useRef(null),u=(0,s.useComposedRefs)(p,c),h=(0,n.usePrevious)(o),m=(0,l.useSize)(a);return r.useEffect(()=>{let e=p.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(h!==o&&t){let r=new Event("click",{bubbles:i});t.call(e,o),e.dispatchEvent(r)}},[h,o,i]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...d,tabIndex:-1,ref:u,style:{...d.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function v(e){return e?"checked":"unchecked"}b.displayName="SwitchBubbleInput",e.s(["Root",()=>x,"Switch",()=>x,"SwitchThumb",()=>g,"Thumb",()=>g,"createSwitchScope",()=>u],95291);var j=e.i(95291),j=j,w=e.i(31777);function y({className:e,size:r="default",...a}){return(0,t.jsx)(j.Root,{"data-slot":"switch","data-size":r,className:(0,w.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...a,children:(0,t.jsx)(j.Thumb,{"data-slot":"switch-thumb",className:(0,w.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>y],51911);var C=e.i(23925),k=e.i(11345),N=e.i(76016),P=e.i(878),T=e.i(81636),S=e.i(86782),R=e.i(29847),A=e.i(35364),F=e.i(90382);function E({initialAgentType:e,initialModel:a,onAgentModelChange:s,disabled:o,className:i,mode:n}){let[l,d]=r.useState(!1),[c,p]=r.useState([]),[u,h]=r.useState(!0),[m,x]=r.useState(e),[f,g]=r.useState(a),[b,v]=r.useState(null),[j,y]=r.useState(0),[E,D]=r.useState(null);r.useEffect(()=>{(0,P.getAllAgentModels)().then(p).finally(()=>h(!1))},[]),r.useEffect(()=>{if(!l){let e=setTimeout(()=>{y(0),D(null)},150);return()=>clearTimeout(e)}},[l]);let O=async(e,t)=>{if(d(!1),e!==m||t!==f){if("override"===n){x(e),g(t),s?.(e,t);return}x(e),g(t),s?.(e,t),v(null);try{let r=await (0,T.updateAgentAndModel)(e,t||null);r.ok||(x(m),g(f),s?.(m,f),v(r.error??"Failed to save"))}catch{x(m),g(f),s?.(m,f),v("Failed to save")}}},I=(0,S.getAgentTypeIcon)(m),z=c.find(e=>e.agentType===m)?.label??m,M=f?(0,R.getModelMeta)(f).displayName||f:null,L=E?c.find(e=>e.agentType===E):null;return(0,t.jsxs)("div",{className:(0,w.cn)("flex flex-col gap-1",i),children:[(0,t.jsxs)(F.Popover,{open:l,onOpenChange:d,children:[(0,t.jsx)(F.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(A.Button,{variant:"outline",role:"combobox","aria-expanded":l,disabled:(o??!1)||u,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(I,{className:"h-4 w-4 shrink-0"}),u?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:z}),M?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:M})]}):null]})]})})}),(0,t.jsx)(F.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===j?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),c.map(e=>{let r=(0,S.getAgentTypeIcon)(e.agentType),a=m===e.agentType,s=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,w.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",a&&"bg-accent/50"),onClick:()=>{s?(D(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>y(1))})):O(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),a&&!s?(0,t.jsx)(C.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,s?(0,t.jsx)(N.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{y(0),setTimeout(()=>D(null),220)},children:[(0,t.jsx)(k.ChevronLeft,{className:"h-3.5 w-3.5"}),L.label]}),L.models.map(e=>{let r=m===L.agentType&&f===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,w.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>O(L.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(C.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!b&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:b})]})}e.s(["AgentModelPicker",()=>E],41413)},15203,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(31406),s=e.i(60112),o=e.i(21023);let i=(0,o.createServerReference)("401f83856655e7e46b3e381a64e393e0052da2b270",o.callServer,void 0,o.findSourceMapURL,"createFeature");var n=e.i(16868),l=e.i(83843),d=e.i(97667),c=e.i(53360),p=e.i(55016),u=e.i(91925),h=e.i(83428),m=e.i(31777),x=e.i(8361);e.i(1650);var f=e.i(11495),g=e.i(45811),b=e.i(35364),v=e.i(98127),j=e.i(48306),w=e.i(41957),y=e.i(81846),C=e.i(90382),k=e.i(51911),N=e.i(2828),P=e.i(30153);e.i(50032);var T=e.i(86254),S=e.i(41413),R=e.i(25235),A=e.i(78521);e.i(13322);var F=e.i(61201),E=e.i(75921),D=e.i(38556),O=e.i(42076);let I=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]),z=[{id:"allowPrd",label:"PRD",description:"Auto-approve requirements move to planning."},{id:"allowPlan",label:"Plan",description:"Auto-approve planning move to implementation."},{id:"allowMerge",label:"Merge",description:"Auto-approve merge move to Done."}],M={allowPrd:!1,allowPlan:!1,allowMerge:!1};function L({open:e,onClose:a,onSubmit:s,repositoryPath:o,isSubmitting:i=!1,workflowDefaults:l,features:d,repositories:u,initialParentId:h,currentAgentType:v,currentModel:C,initialDescription:R}){let A=(0,x.useSoundAction)("create"),F=o&&(!u||0===u.length||u.some(e=>e.path===o))?o:"",E=l?.approvalGates??M,D=l?.push??!1,L=l?.openPr??!1,$=l?.ciWatchEnabled!==!1,H=l?.enableEvidence??!1,q=l?.commitEvidence??!1,[G,_]=(0,r.useState)(R??"");(0,r.useEffect)(()=>{R&&_(R)},[R]);let[K,W]=(0,r.useState)([]),[V,X]=(0,r.useState)({...E}),[Y,Z]=(0,r.useState)(D),[J,Q]=(0,r.useState)(L),[ee,et]=(0,r.useState)(l?.ciWatchEnabled!==!1),[er,ea]=(0,r.useState)(H),[es,eo]=(0,r.useState)(q),[ei,en]=(0,r.useState)(void 0),[el,ed]=(0,r.useState)(!1),[ec,ep]=(0,r.useState)(!1),[eu,eh]=(0,r.useState)(void 0),[em,ex]=(0,r.useState)(void 0),[ef,eg]=(0,r.useState)(F||void 0),[eb,ev]=(0,r.useState)(u??[]),[ej,ew]=(0,r.useState)(!1),[ey,eC]=(0,r.useState)(null),[ek,eN]=(0,r.useState)(!1),eP=(0,r.useRef)(crypto.randomUUID()),eT=(0,r.useRef)(0),eS=(0,r.useRef)(null);(0,r.useEffect)(()=>{l&&(X({...l.approvalGates}),Z(l.push),Q(l.openPr),et(!1!==l.ciWatchEnabled),ea(l.enableEvidence),eo(l.commitEvidence))},[l]),(0,r.useEffect)(()=>{ev(u??[])},[u]),(0,r.useEffect)(()=>{e&&h&&en(h)},[e,h]);let eR=(0,r.useCallback)(()=>{_(""),W([]),X({...E}),Z(D),Q(L),et($),ea(H),eo(q),en(void 0),eg(F||void 0),ev(u??[]),ed(!1),ep(!1),eh(void 0),ex(void 0),eC(null),eT.current=0,ew(!1)},[E,D,L,H,$,q,F,u]),eA=""!==G.trim()||K.length>0,{attemptClose:eF}=(0,P.useGuardedDrawerClose)({open:e,isDirty:eA,onClose:a,onReset:eR}),eE=(0,r.useCallback)(async e=>{for(let t of(eC(null),e)){if(t.size>0xa00000)return void eC(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!I.has(e))return void eC(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();W(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let r=new FormData;r.append("file",t),r.append("sessionId",eP.current);let a=await fetch("/api/attachments/upload",{method:"POST",body:r});if(!a.ok){let t=await a.json().catch(()=>({error:"Upload failed"}));W(t=>t.filter(t=>t.id!==e)),eC(t.error??"Upload failed");return}let s=await a.json();W(t=>t.some(t=>t.id!==e&&t.path===s.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...s,id:e,loading:!1}:t))}catch{W(t=>t.filter(t=>t.id!==e)),eC("Upload failed")}}},[]),eD=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eT.current+=1,1===eT.current&&ew(!0)},[]),eO=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eT.current-=1,0===eT.current&&ew(!1)},[]),eI=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),ez=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eT.current=0,ew(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&eE(t)},[eE]),eM=(0,r.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),eE(r))},[eE]),eL=(0,r.useCallback)(e=>{if(e.preventDefault(),!G.trim())return;let t=ef??F;t&&(A.play(),s({description:G.trim(),attachments:K.filter(e=>!e.loading),repositoryPath:t,approvalGates:{allowPrd:V.allowPrd??!1,allowPlan:V.allowPlan??!1,allowMerge:V.allowMerge??!1},push:Y||J,openPr:J,ciWatchEnabled:ee,enableEvidence:er,commitEvidence:es,fast:el,...ec?{pending:ec}:{},...eu?{agentType:eu}:{},...em?{model:em}:{},...ei?{parentId:ei}:{},sessionId:eP.current}),eR())},[G,K,V,ef,F,s,Y,J,er,ee,es,el,ec,eu,em,ei,A,eR]),eU=(0,r.useCallback)(async()=>{try{let e=await (0,O.pickFiles)();if(!e)return;for(let t of e){let e=crypto.randomUUID();W(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:"application/octet-stream",path:"",loading:!0}]);try{let r=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,sessionId:eP.current})});if(!r.ok){let t=await r.json().catch(()=>({error:"Upload failed"}));W(t=>t.filter(t=>t.id!==e)),eC(t.error??"Upload failed");return}let a=await r.json();W(t=>t.some(t=>t.id!==e&&t.path===a.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...a,id:e,loading:!1}:t))}catch{W(t=>t.filter(t=>t.id!==e)),eC("Upload failed")}}}catch{}},[]),eB=(0,r.useCallback)(e=>{W(t=>t.filter(t=>t.id!==e))},[]),e$=(0,r.useRef)(null),eH=(0,r.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),e$.current?.requestSubmit())},[]),eq=(0,r.useCallback)(()=>{eN(!0)},[]),eG=(0,r.useCallback)(()=>{setTimeout(()=>{let e=eS.current?.contains(document.activeElement),t=eS.current?.querySelector('[aria-expanded="true"]')!==null;e||t||eN(!1)},0)},[]),e_=d&&d.length>0,eK=!F&&!ef,eW=!F&&void 0!==u;return(0,t.jsx)(f.BaseDrawer,{open:e,onClose:eF,size:"md",modal:!1,dismissOnOutsideClick:!0,"data-testid":"feature-create-drawer",header:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsx)(g.DrawerTitle,{children:"NEW FEATURE"})]}),i?(0,t.jsx)(g.DrawerDescription,{asChild:!0,children:(0,t.jsx)("div",{children:(0,t.jsx)(y.Badge,{variant:"secondary",children:"Creating..."})})}):null]}),footer:(0,t.jsxs)("div",{className:"flex flex-row justify-end gap-2",children:[(0,t.jsx)(b.Button,{variant:"outline",onClick:eF,disabled:i,children:"Cancel"}),(0,t.jsx)(b.Button,{type:"submit",form:"create-feature-form",disabled:!G.trim()||i||eK,children:i?"Creating...":"+ Create Feature"})]}),children:(0,t.jsx)("div",{className:"overflow-y-auto p-4",children:(0,t.jsx)(N.TooltipProvider,{delayDuration:400,children:(0,t.jsxs)("form",{ref:e$,id:"create-feature-form",onSubmit:eL,onKeyDown:eH,className:"flex flex-col gap-4",children:[eW?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"repo-selector-section",children:[(0,t.jsx)(w.Label,{className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"REPOSITORY"}),(0,t.jsx)(B,{repositories:eb,value:ef,onChange:eg,onAddRepository:e=>{ev(t=>[...t,e]),eg(e.path)},disabled:i})]}):F?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"repo-readonly-section",children:[(0,t.jsx)(w.Label,{className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"REPOSITORY"}),(0,t.jsx)("p",{className:"text-sm","data-testid":"repo-readonly-label",children:u?.find(e=>e.path===F)?.name??F.split("/").pop()})]}):null,(0,t.jsxs)("div",{role:"region","aria-label":"File drop zone","data-drag-over":ej?"true":"false",onDragEnter:eD,onDragLeave:eO,onDragOver:eI,onDrop:ez,className:(0,m.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",ej&&"border-primary/50 bg-primary/5"),children:[(0,t.jsx)(w.Label,{htmlFor:"feature-description",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"DESCRIBE YOUR FEATURE"}),(0,t.jsxs)("div",{ref:eS,onFocus:eq,onBlur:eG,className:(0,m.cn)("border-input flex h-56 flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",ek&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,t.jsx)(j.Textarea,{id:"feature-description",placeholder:"e.g. Add GitHub OAuth login with callback handling and token refresh...",value:G,onChange:e=>_(e.target.value),onPaste:eM,required:!0,disabled:i,className:"min-h-0 flex-1 resize-none rounded-none border-0 shadow-none focus-visible:ring-0"}),K.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:K.map(e=>(0,t.jsx)(T.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>eB(e.id),disabled:i,loading:e.loading},e.id))}),ey?(0,t.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:ey}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[(0,t.jsx)(S.AgentModelPicker,{initialAgentType:eu??v??"claude-code",initialModel:em??C??"claude-sonnet-4-6",mode:"override",onAgentModelChange:(e,t)=>{eh(e),ex(t)},disabled:i,className:"w-55"}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex cursor-pointer items-center gap-2",children:[(0,t.jsx)(k.Switch,{id:"pending-mode",checked:ec,onCheckedChange:ep,disabled:i}),(0,t.jsxs)(w.Label,{htmlFor:"pending-mode",className:"flex cursor-pointer items-center gap-1 text-sm font-medium",children:[(0,t.jsx)(p.Clock,{className:"h-3.5 w-3.5"}),"Pending"]})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Create without starting — start manually later."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-2",children:[(0,t.jsx)(k.Switch,{id:"fast-mode",checked:el,onCheckedChange:ed,disabled:i}),(0,t.jsxs)(w.Label,{htmlFor:"fast-mode",className:"flex cursor-pointer items-center gap-1 text-sm font-medium",children:[(0,t.jsx)(c.Zap,{className:"h-3.5 w-3.5"}),"Fast Mode"]})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Skip SDLC phases and implement directly from your prompt."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:eU,disabled:i,"aria-label":"Attach files",className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(n.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Attach files"})]})]})]})]}),e_&&void 0!==h?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(w.Label,{htmlFor:"parent-feature",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"PARENT FEATURE"}),(0,t.jsx)(U,{features:d,value:ei,onChange:en,disabled:i})]}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 cursor-default text-xs font-semibold tracking-wider",children:"APPROVE"})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Auto-approve phase transitions without manual review."})]}),(0,t.jsx)("div",{className:"flex flex-1 items-center gap-4",children:z.map(e=>(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:`approve-${e.id}`,size:"sm",checked:V[e.id]??!1,onCheckedChange:t=>X(r=>({...r,[e.id]:t})),disabled:i||el&&("allowPrd"===e.id||"allowPlan"===e.id)}),(0,t.jsx)(w.Label,{htmlFor:`approve-${e.id}`,className:"cursor-pointer text-xs font-medium",children:e.label})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:el&&("allowPrd"===e.id||"allowPlan"===e.id)?"Skipped in Fast Mode":e.description})]},e.id))}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:()=>{let e=z.every(e=>V[e.id]),t={};for(let r of z)t[r.id]=!e;X(t)},disabled:i,className:(0,m.cn)("text-muted-foreground hover:text-foreground cursor-pointer rounded px-1.5 py-0.5 text-[10px] font-semibold tracking-wider uppercase transition-colors",z.every(e=>V[e.id])&&"text-primary"),children:"All"})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Toggle all approval gates"})]})]}),(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 cursor-default text-xs font-semibold tracking-wider",children:"EVIDENCE"})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Collect and attach evidence after implementation."})]}),(0,t.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"enable-evidence",size:"sm",checked:er,onCheckedChange:e=>{ea(e),e||eo(!1)},disabled:i}),(0,t.jsx)(w.Label,{htmlFor:"enable-evidence",className:"cursor-pointer text-xs font-medium",children:"Collect"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Capture screenshots and artifacts after implementation."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"commit-evidence",size:"sm",checked:es,onCheckedChange:eo,disabled:i||!er||!J}),(0,t.jsx)(w.Label,{htmlFor:"commit-evidence",className:(0,m.cn)("cursor-pointer text-xs font-medium",(!er||!J)&&"opacity-50"),children:"Add to PR"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:J?er?"Include evidence in the pull request body.":"Requires evidence collection to be enabled":"Requires PR to be enabled"})]})]})]}),(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 text-xs font-semibold tracking-wider",children:"GIT"}),(0,t.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"push",size:"sm",checked:Y||J,onCheckedChange:e=>{Z(e),!e&&J&&Q(!1)},disabled:i}),(0,t.jsx)(w.Label,{htmlFor:"push",className:"cursor-pointer text-xs font-medium",children:"Push"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Push branch to remote after implementation."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"open-pr",size:"sm",checked:J,onCheckedChange:e=>{Q(e),e||eo(!1)},disabled:i}),(0,t.jsx)(w.Label,{htmlFor:"open-pr",className:"cursor-pointer text-xs font-medium",children:"PR"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Open a pull request after pushing."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"ci-watch",size:"sm",checked:ee,onCheckedChange:et,disabled:i}),(0,t.jsx)(w.Label,{htmlFor:"ci-watch",className:"cursor-pointer text-xs font-medium",children:"Watch"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Watch CI and auto-fix after push."})]})]})]})]})]})})})})}function U({features:e,value:a,onChange:s,disabled:o}){let[i,n]=(0,r.useState)(!1),[c,p]=(0,r.useState)(""),u=(0,r.useRef)(null),h=e.find(e=>e.id===a),x=c.trim()?e.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())||e.id.toLowerCase().includes(c.toLowerCase())):e,f=(0,r.useCallback)(e=>{s(e),n(!1),p("")},[s]);return(0,r.useEffect)(()=>{i?setTimeout(()=>u.current?.focus(),0):p("")},[i]),(0,t.jsxs)(C.Popover,{open:i,onOpenChange:n,children:[(0,t.jsx)(C.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{id:"parent-feature",type:"button",role:"combobox","aria-expanded":i,"aria-label":"Parent Feature",disabled:o,"data-testid":"parent-feature-combobox",className:(0,m.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!h&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:h?`${h.name} (${h.id.slice(0,8)})`:"Select parent feature..."}),(0,t.jsx)(l.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(C.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"parent-feature-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(v.Input,{ref:u,placeholder:"Search features...",value:c,onChange:e=>p(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"parent-feature-search"})}),(0,t.jsxs)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Features",children:[(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":void 0===a,onClick:()=>f(void 0),className:(0,m.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",void 0===a&&"bg-accent/50"),"data-testid":"parent-feature-option-none",children:[(0,t.jsx)(d.CheckIcon,{className:(0,m.cn)("h-4 w-4 shrink-0",void 0!==a&&"invisible")}),(0,t.jsx)("span",{className:"text-muted-foreground italic",children:"No parent"})]}),0===x.length&&c?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No features found."}):x.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":a===e.id,onClick:()=>f(e.id),className:(0,m.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",a===e.id&&"bg-accent/50"),"data-testid":`parent-feature-option-${e.id}`,children:[(0,t.jsx)(d.CheckIcon,{className:(0,m.cn)("h-4 w-4 shrink-0",a!==e.id&&"invisible")}),(0,t.jsxs)("span",{className:"truncate",children:[e.name," ",(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-xs",children:["(",e.id.slice(0,8),")"]})]})]},e.id))]})]})})]})}function B({repositories:e,value:a,onChange:s,onAddRepository:o,disabled:i}){let[n,c]=(0,r.useState)(!1),[p,x]=(0,r.useState)(""),[f,g]=(0,r.useState)(!1),[b,j]=(0,r.useState)(null),[w,y]=(0,r.useState)(!1),k=(0,r.useRef)(null),{reactFileManager:N}=(0,E.useFeatureFlags)(),P=e.find(e=>e.path===a),T=p.trim()?e.filter(e=>e.name.toLowerCase().includes(p.toLowerCase())||e.path.toLowerCase().includes(p.toLowerCase())):e,S=(0,r.useCallback)(e=>{s(e),c(!1),x("")},[s]),O=(0,r.useCallback)(async e=>{let t=await (0,D.addRepository)({path:e});if(t.error){j(t.error),g(!1);return}if(t.repository){let e={id:t.repository.id,name:t.repository.name,path:t.repository.path};o?.(e),s(e.path),c(!1),x("")}},[o,s]),I=(0,r.useCallback)(async()=>{if(!f){if(N)return void y(!0);g(!0),j(null);try{let e=await (0,A.pickFolder)();if(!e)return void g(!1);await O(e)}catch{y(!0)}finally{g(!1)}}},[f,N,O]),z=(0,r.useCallback)(async e=>{if(y(!1),e){g(!0),j(null);try{await O(e)}catch(e){j(e instanceof Error?e.message:"Failed to add repository")}finally{g(!1)}}},[O]);return(0,r.useEffect)(()=>{n?setTimeout(()=>k.current?.focus(),0):x("")},[n]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(C.Popover,{open:n,onOpenChange:c,children:[(0,t.jsx)(C.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",role:"combobox","aria-expanded":n,"aria-label":"Repository",disabled:i,"data-testid":"repository-combobox",className:(0,m.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!P&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:P?P.name:"Select repository..."}),(0,t.jsx)(l.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(C.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"repository-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(v.Input,{ref:k,placeholder:"Search repositories...",value:p,onChange:e=>x(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"repository-search"})}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Repositories",children:0===T.length?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm","data-testid":"repository-empty",children:"No repositories found."}):T.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":a===e.path,onClick:()=>S(e.path),className:(0,m.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",a===e.path&&"bg-accent/50"),"data-testid":`repository-option-${e.id}`,children:[(0,t.jsx)(d.CheckIcon,{className:(0,m.cn)("h-4 w-4 shrink-0",a!==e.path&&"invisible")}),(0,t.jsxs)("span",{className:"flex flex-col items-start truncate",children:[(0,t.jsx)("span",{className:"truncate",children:e.name}),(0,t.jsx)("span",{className:"text-muted-foreground truncate text-xs",children:e.path})]})]},e.id))}),(0,t.jsx)(R.Separator,{}),(0,t.jsxs)("button",{type:"button",onClick:I,disabled:f,className:"hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm","data-testid":"add-repository-item",children:[f?(0,t.jsx)(h.Loader2,{className:"h-4 w-4 shrink-0 animate-spin"}):(0,t.jsx)(u.FolderPlus,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:"Add new repository..."})]}),b?(0,t.jsx)("p",{className:"px-3 pb-2 text-xs text-red-500","data-testid":"add-repository-error",children:b}):null]})})]}),(0,t.jsx)(F.ReactFileManagerDialog,{open:w,onOpenChange:e=>{e||y(!1)},onSelect:z})]})}function $({repositoryPath:e,initialParentId:o,initialDescription:n,features:l,repositories:d,workflowDefaults:c,currentAgentType:p,currentModel:u}){let h=(0,a.useRouter)(),[m,x]=(0,r.useState)(!1),f=(0,a.usePathname)().startsWith("/create"),g=!m&&f;(0,r.useEffect)(()=>{!f&&m&&x(!1)},[f,m]);let b=(0,r.useCallback)(()=>{h.push("/")},[h]),v=(0,r.useCallback)(e=>{x(!0),h.push("/"),i(e).then(t=>{t.error?s.toast.error(t.error):window.dispatchEvent(new CustomEvent("shep:feature-created",{detail:{featureId:t.feature.id,name:t.feature.name,description:t.feature.description,repositoryPath:t.feature.repositoryPath,parentId:e.parentId}}))}).catch(()=>{s.toast.error("Failed to create feature"),x(!1)})},[h]);return(0,t.jsx)(L,{open:g,onClose:b,onSubmit:v,repositoryPath:e,features:l,repositories:d,workflowDefaults:c,initialParentId:o,initialDescription:n,isSubmitting:m,currentAgentType:p,currentModel:u})}e.s(["CreateDrawerClient",()=>$],15203)}]);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},87913,e=>{"use strict";var t=e.i(22925),r=e.i(62995),a=e.i(14112),n=e.i(31716),s=e.i(16340),i=e.i(40522),o=e.i(21994),l=e.i(5802),u=e.i(17171),d=e.i(177),p=e.i(43685),c=e.i(84832),m=e.i(92435),f=e.i(41260),h=e.i(80556),x=e.i(93695);e.i(97230);var g=e.i(35162),y=e.i(27980),R=e.i(60526),w=e.i(50227),v=e.i(12714);async function E(e,t){let r,a=e.replace(/[/\\.]/g,"-"),n=(0,w.join)((0,R.homedir)(),".claude","projects",a);try{r=(await (0,v.readdir)(n)).filter(e=>e.endsWith(".jsonl"))}catch{return[]}let s=(await Promise.allSettled(r.map(async e=>{let t=(0,w.join)(n,e),r=await (0,v.stat)(t);return{name:e,filePath:t,mtime:r.mtime.getTime()}}))).filter(e=>"fulfilled"===e.status).map(e=>e.value).sort((e,t)=>t.mtime-e.mtime).slice(0,t);return(await Promise.allSettled(s.map(async t=>P(t.filePath,t.name,t.mtime,e)))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}async function P(t,r,a,n){let{createReadStream:s}=await e.A(6714),i=r.replace(".jsonl",""),o=null,l=null,u=0,d=await new Promise(e=>{let r=[],a=0,n=s(t,{end:8191});n.on("data",e=>{r.push(e),a+=e.length}),n.on("end",()=>e(Buffer.concat(r,a).toString("utf-8"))),n.on("error",()=>e(""))});if(!d)return null;for(let e of d.split("\n").filter(e=>e.trim()))try{let t=JSON.parse(e);if("user"===t.type||"assistant"===t.type){let e=t.message?.role;("user"===e||"assistant"===e)&&(u++,t.timestamp&&(l??=t.timestamp),"user"===e&&null===o&&(o=C(t.message?.content)))}}catch{break}if(0===u)return null;let p=new Date(a).toISOString();return{id:i,agentType:"claude-code",preview:o,messageCount:u,firstMessageAt:l,lastMessageAt:p,createdAt:l??p,projectPath:n,filePath:t,_mtime:a}}async function A(e,t){let r,a=e.replace(/^\//,"").replace(/\./g,"").replace(/[/\\]/g,"-"),n=(0,w.join)((0,R.homedir)(),".cursor","projects",a,"agent-transcripts");try{r=await (0,v.readdir)(n)}catch{return[]}let s=(await Promise.allSettled(r.map(async e=>{let t=(0,w.join)(n,e),r=await (0,v.stat)(t);if(r.isFile()&&e.endsWith(".jsonl"))return{name:e,filePath:t,mtime:r.mtime.getTime()};if(r.isDirectory()){let r=(0,w.join)(t,`${e}.jsonl`);try{let t=await (0,v.stat)(r);return{name:`${e}.jsonl`,filePath:r,mtime:t.mtime.getTime()}}catch{}}return null}))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e).sort((e,t)=>t.mtime-e.mtime).slice(0,t);return(await Promise.allSettled(s.map(async t=>j(t.filePath,t.name,t.mtime,e)))).filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>null!==e)}async function j(t,r,a,n){let{createReadStream:s}=await e.A(6714),i=r.replace(".jsonl",""),o=await new Promise(e=>{let r=[],a=0,n=s(t,{end:8191});n.on("data",e=>{r.push(e),a+=e.length}),n.on("end",()=>e(Buffer.concat(r,a).toString("utf-8"))),n.on("error",()=>e(""))});if(!o)return null;let l=null,u=0;for(let e of o.split("\n").filter(e=>e.trim()))try{let t=JSON.parse(e);("user"===t.role||"assistant"===t.role)&&(u++,"user"===t.role&&null===l&&(l=C(t.message?.content)))}catch{break}if(0===u)return null;let d=new Date(a).toISOString();return{id:i,agentType:"cursor",preview:l,messageCount:u,firstMessageAt:d,lastMessageAt:d,createdAt:d,projectPath:n,filePath:t,_mtime:a}}function C(e){if("string"==typeof e)return e;if(Array.isArray(e)){for(let t of e)if("object"==typeof t&&null!==t&&"text"===t.type&&"string"==typeof t.text)return t.text}return null}async function S(e){let t=new URL(e.url),r=t.searchParams.get("repositoryPath"),a=parseInt(t.searchParams.get("limit")??"10",10);if(!r?.trim())return y.NextResponse.json({error:"repositoryPath is required"},{status:400});try{let[e,t]=await Promise.all([E(r,a),A(r,a)]),n=[...e,...t].sort((e,t)=>t._mtime-e._mtime).slice(0,Math.min(a,50));return y.NextResponse.json({sessions:n.map(({_mtime:e,...t})=>t)})}catch(e){return console.error("[API] GET /api/sessions error:",e),y.NextResponse.json({error:String(e)},{status:500})}}e.s(["GET",()=>S,"dynamic",0,"force-dynamic"],17276);var b=e.i(17276);let T=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/route",pathname:"/api/sessions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/presentation/web/app/api/sessions/route.ts",nextConfigOutput:"standalone",userland:b}),{workAsyncStorage:N,workUnitAsyncStorage:_,serverHooks:O}=T;function k(){return(0,a.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:_})}async function q(e,t,a){T.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/sessions/route";y=y.replace(/\/index$/,"")||"/";let R=await T.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:w,params:v,nextConfig:E,parsedUrl:P,isDraftMode:A,prerenderManifest:j,routerServerContext:C,isOnDemandRevalidate:S,revalidateOnlyGenerated:b,resolvedPathname:N,clientReferenceManifest:_,serverActionsManifest:O}=R,k=(0,o.normalizeAppPath)(y),q=!!(j.dynamicRoutes[k]||j.routes[N]),I=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,P,!1):t.end("This page could not be found"),null);if(q&&!A){let e=!!j.routes[N],t=j.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await I();throw new x.NoFallbackError}}let H=null;!q||T.isDev||A||(H="/index"===(H=N)?"/":H);let M=!0===T.isDev||!q,U=q&&!M;O&&_&&(0,i.setManifestsSingleton)({page:y,clientReferenceManifest:_,serverActionsManifest:O});let D=e.method||"GET",$=(0,s.getTracer)(),F=$.getActiveScopeSpan(),K={params:v,prerenderManifest:j,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:M,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>T.onRequestError(e,t,a,n,C)},sharedContext:{buildId:w}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),G=u.NextRequestAdapter.fromNodeNextRequest(B,(0,u.signalFromNodeResponse)(t));try{let i=async e=>T.handle(G,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${D} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${D} ${y}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let u=async({previousCacheEntry:r})=>{try{if(!o&&S&&b&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let u=K.renderOpts.collectedTags;if(!q)return await (0,c.sendResponse)(B,L,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(s.headers);u&&(t[h.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await T.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:S})},!1,C),t}},d=await T.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:j,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:b,responseGenerator:u,waitUntil:a.waitUntil,isMinimalMode:o});if(!q)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",S?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,m.fromNodeOutgoingHttpHeaders)(d.value.headers);return o&&q||x.delete(h.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,f.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(B,L,new Response(d.value.body,{headers:x,status:d.value.status||200})),null};F?await l(F):await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${D} ${y}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},l))}catch(t){if(t instanceof x.NoFallbackError||await T.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:S})},!1,C),q)throw t;return await (0,c.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>q,"patchFetch",()=>k,"routeModule",()=>T,"serverHooks",()=>O,"workAsyncStorage",()=>N,"workUnitAsyncStorage",()=>_],87913)},6714,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_node:fs_ddf6f167._.js"].map(t=>e.l(t))).then(()=>t(2157)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__a62bd945._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/presentation/web/app/api/sessions/route.ts","../../../../../../node_modules/.pnpm/next%4016.1.6_%40babel%2Bcore%407.29.0_%40playwright%2Btest%401.58.1_react-dom%4019.2.4_react%4019.2.4__react%4019.2.4/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextResponse } from 'next/server';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { readdir, stat } from 'node:fs/promises';\n\nexport const dynamic = 'force-dynamic';\n\ninterface SessionResult {\n id: string;\n agentType: string;\n preview: string | null;\n messageCount: number;\n firstMessageAt: string | null;\n lastMessageAt: string | null;\n createdAt: string | null;\n projectPath: string;\n filePath: string;\n /** mtime for sorting — not sent to client */\n _mtime: number;\n}\n\n// ── Path encoding helpers ─────────────────────────────────────────────\n\n/**\n * Claude Code encodes paths by replacing '/', '\\', '.' with '-'.\n * e.g. /home/user/.shep/repos/abc → -home-user--shep-repos-abc\n */\nfunction claudeEncodePath(p: string): string {\n return p.replace(/[/\\\\.]/g, '-');\n}\n\n/**\n * Cursor encodes paths by stripping the leading '/', removing dots,\n * and replacing '/' and '\\' with '-'.\n * e.g. /home/user/.shep/repos/abc → home-user-shep-repos-abc\n */\nfunction cursorEncodePath(p: string): string {\n return p.replace(/^\\//, '').replace(/\\./g, '').replace(/[/\\\\]/g, '-');\n}\n\n// ── Claude Code session scanner ───────────────────────────────────────\n\nasync function scanClaudeSessions(repositoryPath: string, limit: number): Promise<SessionResult[]> {\n const dirName = claudeEncodePath(repositoryPath);\n const projectDir = join(homedir(), '.claude', 'projects', dirName);\n\n let files: string[];\n try {\n const entries = await readdir(projectDir);\n files = entries.filter((e) => e.endsWith('.jsonl'));\n } catch {\n return [];\n }\n\n // Stat all files for mtime sorting\n const fileInfos = await Promise.allSettled(\n files.map(async (name) => {\n const filePath = join(projectDir, name);\n const s = await stat(filePath);\n return { name, filePath, mtime: s.mtime.getTime() };\n })\n );\n\n const valid = fileInfos\n .filter(\n (r): r is PromiseFulfilledResult<{ name: string; filePath: string; mtime: number }> =>\n r.status === 'fulfilled'\n )\n .map((r) => r.value)\n .sort((a, b) => b.mtime - a.mtime)\n .slice(0, limit);\n\n // Parse each file\n const results = await Promise.allSettled(\n valid.map(async (fi) => parseClaudeSession(fi.filePath, fi.name, fi.mtime, repositoryPath))\n );\n\n return results\n .filter((r): r is PromiseFulfilledResult<SessionResult | null> => r.status === 'fulfilled')\n .map((r) => r.value)\n .filter((s): s is SessionResult => s !== null);\n}\n\n/**\n * Read the first N bytes of a file to extract preview and timestamps\n * without loading the entire (potentially multi-MB) session file.\n */\nconst PREVIEW_READ_BYTES = 8_192; // 8KB is enough for first few messages\n\nasync function parseClaudeSession(\n filePath: string,\n fileName: string,\n mtime: number,\n repositoryPath: string\n): Promise<SessionResult | null> {\n const { createReadStream } = await import('node:fs');\n const id = fileName.replace('.jsonl', '');\n\n // Read only the first chunk to extract preview and first timestamp\n let preview: string | null = null;\n let firstTimestamp: string | null = null;\n let messageCount = 0;\n\n const head = await new Promise<string>((resolve) => {\n const chunks: Buffer[] = [];\n let size = 0;\n const stream = createReadStream(filePath, { end: PREVIEW_READ_BYTES - 1 });\n stream.on('data', (chunk: Buffer) => {\n chunks.push(chunk);\n size += chunk.length;\n });\n stream.on('end', () => resolve(Buffer.concat(chunks, size).toString('utf-8')));\n stream.on('error', () => resolve(''));\n });\n\n if (!head) return null;\n\n const lines = head.split('\\n').filter((l) => l.trim());\n for (const line of lines) {\n try {\n const entry = JSON.parse(line) as {\n type?: string;\n timestamp?: string;\n message?: { role?: string; content?: unknown };\n };\n if (entry.type === 'user' || entry.type === 'assistant') {\n const role = entry.message?.role;\n if (role === 'user' || role === 'assistant') {\n messageCount++;\n if (entry.timestamp) {\n firstTimestamp ??= entry.timestamp;\n }\n if (role === 'user' && preview === null) {\n preview = extractText(entry.message?.content);\n }\n }\n }\n } catch {\n break;\n }\n }\n\n if (messageCount === 0) return null;\n\n // Use mtime as lastMessageAt — avoids reading entire file for last line\n const mtimeIso = new Date(mtime).toISOString();\n return {\n id,\n agentType: 'claude-code',\n preview,\n messageCount,\n firstMessageAt: firstTimestamp,\n lastMessageAt: mtimeIso,\n createdAt: firstTimestamp ?? mtimeIso,\n projectPath: repositoryPath,\n filePath,\n _mtime: mtime,\n };\n}\n\n// ── Cursor session scanner ────────────────────────────────────────────\n\nasync function scanCursorSessions(repositoryPath: string, limit: number): Promise<SessionResult[]> {\n const dirName = cursorEncodePath(repositoryPath);\n const transcriptsDir = join(homedir(), '.cursor', 'projects', dirName, 'agent-transcripts');\n\n let entries: string[];\n try {\n entries = await readdir(transcriptsDir);\n } catch {\n return [];\n }\n\n // Cursor has two session structures:\n // 1. Flat: agent-transcripts/<uuid>.jsonl\n // 2. Nested: agent-transcripts/<uuid>/<uuid>.jsonl\n const fileInfos = await Promise.allSettled(\n entries.map(async (entry) => {\n const entryPath = join(transcriptsDir, entry);\n const s = await stat(entryPath);\n\n if (s.isFile() && entry.endsWith('.jsonl')) {\n // Flat structure\n return { name: entry, filePath: entryPath, mtime: s.mtime.getTime() };\n }\n\n if (s.isDirectory()) {\n // Nested structure — look for <uuid>.jsonl inside\n const jsonlPath = join(entryPath, `${entry}.jsonl`);\n try {\n const jsonlStat = await stat(jsonlPath);\n return {\n name: `${entry}.jsonl`,\n filePath: jsonlPath,\n mtime: jsonlStat.mtime.getTime(),\n };\n } catch {\n return null;\n }\n }\n\n return null;\n })\n );\n\n const valid = fileInfos\n .filter(\n (\n r\n ): r is PromiseFulfilledResult<{\n name: string;\n filePath: string;\n mtime: number;\n } | null> => r.status === 'fulfilled'\n )\n .map((r) => r.value)\n .filter((v): v is { name: string; filePath: string; mtime: number } => v !== null)\n .sort((a, b) => b.mtime - a.mtime)\n .slice(0, limit);\n\n const results = await Promise.allSettled(\n valid.map(async (fi) => parseCursorSession(fi.filePath, fi.name, fi.mtime, repositoryPath))\n );\n\n return results\n .filter((r): r is PromiseFulfilledResult<SessionResult | null> => r.status === 'fulfilled')\n .map((r) => r.value)\n .filter((s): s is SessionResult => s !== null);\n}\n\nasync function parseCursorSession(\n filePath: string,\n fileName: string,\n mtime: number,\n repositoryPath: string\n): Promise<SessionResult | null> {\n const { createReadStream } = await import('node:fs');\n const id = fileName.replace('.jsonl', '');\n\n // Read only the first chunk for preview extraction\n const head = await new Promise<string>((resolve) => {\n const chunks: Buffer[] = [];\n let size = 0;\n const stream = createReadStream(filePath, { end: PREVIEW_READ_BYTES - 1 });\n stream.on('data', (chunk: Buffer) => {\n chunks.push(chunk);\n size += chunk.length;\n });\n stream.on('end', () => resolve(Buffer.concat(chunks, size).toString('utf-8')));\n stream.on('error', () => resolve(''));\n });\n\n if (!head) return null;\n\n let preview: string | null = null;\n let messageCount = 0;\n\n const lines = head.split('\\n').filter((l) => l.trim());\n for (const line of lines) {\n try {\n const entry = JSON.parse(line) as {\n role?: string;\n message?: { content?: unknown };\n };\n if (entry.role === 'user' || entry.role === 'assistant') {\n messageCount++;\n if (entry.role === 'user' && preview === null) {\n preview = extractText(entry.message?.content);\n }\n }\n } catch {\n break;\n }\n }\n\n if (messageCount === 0) return null;\n\n const mtimeIso = new Date(mtime).toISOString();\n return {\n id,\n agentType: 'cursor',\n preview,\n messageCount,\n firstMessageAt: mtimeIso,\n lastMessageAt: mtimeIso,\n createdAt: mtimeIso,\n projectPath: repositoryPath,\n filePath,\n _mtime: mtime,\n };\n}\n\n// ── Shared helpers ────────────────────────────────────────────────────\n\nfunction extractText(content: unknown): string | null {\n if (typeof content === 'string') return content;\n if (Array.isArray(content)) {\n for (const block of content) {\n if (typeof block === 'object' && block !== null) {\n const b = block as Record<string, unknown>;\n if (b.type === 'text' && typeof b.text === 'string') return b.text;\n }\n }\n }\n return null;\n}\n\n// ── Route handler ─────────────────────────────────────────────────────\n\n/**\n * GET /api/sessions?repositoryPath=<path>&limit=<n>\n *\n * Returns agent sessions from all supported providers (Claude Code, Cursor)\n * filtered by repository path, merged and sorted by recency.\n */\nexport async function GET(request: Request) {\n const url = new URL(request.url);\n const repositoryPath = url.searchParams.get('repositoryPath');\n const limit = parseInt(url.searchParams.get('limit') ?? '10', 10);\n\n if (!repositoryPath?.trim()) {\n return NextResponse.json({ error: 'repositoryPath is required' }, { status: 400 });\n }\n\n try {\n // Scan all providers in parallel\n const [claudeSessions, cursorSessions] = await Promise.all([\n scanClaudeSessions(repositoryPath, limit),\n scanCursorSessions(repositoryPath, limit),\n ]);\n\n // Merge and sort by mtime descending, apply limit\n const allSessions = [...claudeSessions, ...cursorSessions]\n .sort((a, b) => b._mtime - a._mtime)\n .slice(0, Math.min(limit, 50));\n\n return NextResponse.json({\n sessions: allSessions.map(({ _mtime, ...s }) => s),\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[API] GET /api/sessions error:', error);\n return NextResponse.json({ error: String(error) }, { status: 500 });\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sessions/route\",\n pathname: \"/api/sessions\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/presentation/web/app/api/sessions/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/sessions/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"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","ignoreList":[1]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95230,e=>{"use strict";let t=(0,e.i(3645).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["default",()=>t])},93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},16868,48306,80436,28267,16298,86254,50032,42076,e=>{"use strict";var t=e.i(3645);let r=(0,t.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);e.s(["PaperclipIcon",()=>r],16868);var a=e.i(20314),s=e.i(31777);function o({className:e,...t}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,s.cn)("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input field-sizing-content min-h-[80px] w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...t})}e.s(["Textarea",()=>o],48306);var i=e.i(60253),n=e.i(15506),n=n,l=e.i(95230);e.s(["DownloadIcon",()=>l.default],80436);var l=l,d=e.i(2287),c=e.i(1693);e.s(["VisuallyHidden",0,c],28267);var c=c;let p=(0,t.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),u=(0,t.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",()=>u],16298);let h=(0,t.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var m=e.i(93752),m=m;e.i(35364);let x=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]),f=new Set([".ts",".tsx",".js",".jsx",".json",".yaml",".yml",".xml",".html",".css",".md"]);function g(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(+(0!==t))} ${["B","KB","MB","GB"][t]}`}let b=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function v(e,t){let r=new URLSearchParams({path:e,mimeType:t});return`/api/attachments/preview?${r.toString()}`}function j({name:e,size:t,mimeType:r,path:o,onRemove:j,loading:w=!1,disabled:y=!1}){let C,k,N=(C=e.lastIndexOf("."))>=0?e.slice(C).toLowerCase():"",P=x.has(N)?h:".pdf"===N?u:f.has(N)?m.default:p,T=".pdf"===N?"bg-red-50 text-red-600":x.has(N)?"bg-blue-50 text-blue-600":f.has(N)?"bg-emerald-50 text-emerald-600":"bg-gray-50 text-gray-600",S=(k=e.lastIndexOf("."))>=0&&b.has(e.slice(k).toLowerCase());return w?(0,a.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-md border",children:(0,a.jsx)(n.default,{className:"text-muted-foreground h-5 w-5 animate-spin"})}):S?(0,a.jsxs)(d.Dialog,{children:[(0,a.jsxs)("div",{className:"group relative",children:[(0,a.jsx)(d.DialogTrigger,{asChild:!0,children:(0,a.jsx)("img",{src:v(o,r),alt:e,title:e,className:"h-12 w-12 cursor-pointer rounded-md border object-cover transition-opacity hover:opacity-80"})}),!y&&(0,a.jsx)("button",{type:"button",onClick:j,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,a.jsx)(i.X,{className:"h-3 w-3"})})]}),(0,a.jsxs)(d.DialogContent,{className:"max-w-3xl gap-0 overflow-hidden border-0 p-0 [&>button:last-child]:!cursor-pointer [&>button:last-child]:!rounded-full [&>button:last-child]:!bg-black/70 [&>button:last-child]:!p-1.5 [&>button:last-child]:!text-white [&>button:last-child]:!opacity-100 [&>button:last-child]:!shadow-lg [&>button:last-child]:!backdrop-blur-md [&>button:last-child]:hover:!bg-black/90",children:[(0,a.jsx)(c.Root,{children:(0,a.jsxs)(d.DialogTitle,{children:["Preview: ",e]})}),(0,a.jsx)("div",{className:"relative bg-black/90",children:(0,a.jsx)("img",{src:v(o,r),alt:e,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,a.jsxs)("div",{className:"bg-background flex items-center gap-3 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,a.jsx)("span",{className:"truncate text-sm font-medium",children:e}),(0,a.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)})]}),(0,a.jsx)("a",{href:v(o,r),download:e,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${e}`,children:(0,a.jsx)(l.default,{className:"h-4 w-4"})})]})]})]}):(0,a.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-full border py-1 pr-3 pl-2",children:[(0,a.jsx)("div",{className:(0,s.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",T),children:(0,a.jsx)(P,{className:"h-3 w-3"})}),(0,a.jsx)("span",{className:"max-w-[120px] truncate text-sm",children:e}),(0,a.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)}),!y&&(0,a.jsx)("button",{type:"button",onClick:j,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,a.jsx)(i.X,{className:"h-3 w-3"})})]})}async function w(){let e=await fetch("/api/dialog/pick-files",{method:"POST"});if(!e.ok)throw Error("Failed to open file dialog");let t=await e.json();return t.cancelled?null:t.files}e.s(["AttachmentChip",()=>j],86254),e.s([],50032),e.s(["pickFiles",()=>w],42076)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),s=e.i(5978),o=e.i(22528),i=e.i(53532),n=e.i(41687),l=e.i(56720),d=e.i(13123),c=e.i(52740),p=e.i(39979),u=e.i(85995),h=e.i(87620),m=e.i(86874),x=e.i(36589),f=e.i(73772),g=e.i(13044),b="Popover",[v,j]=(0,o.createContextScope)(b,[c.createPopperScope]),w=(0,c.createPopperScope)(),[y,C]=v(b),k=e=>{let{__scopePopover:a,children:s,open:o,defaultOpen:i,onOpenChange:n,modal:l=!1}=e,p=w(a),u=r.useRef(null),[h,m]=r.useState(!1),[f,g]=(0,x.useControllableState)({prop:o,defaultProp:i??!1,onChange:n,caller:b});return(0,t.jsx)(c.Root,{...p,children:(0,t.jsx)(y,{scope:a,contentId:(0,d.useId)(),triggerRef:u,open:f,onOpenChange:g,onOpenToggle:r.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:h,onCustomAnchorAdd:r.useCallback(()=>m(!0),[]),onCustomAnchorRemove:r.useCallback(()=>m(!1),[]),modal:l,children:s})})};k.displayName=b;var N="PopoverAnchor",P=r.forwardRef((e,a)=>{let{__scopePopover:s,...o}=e,i=C(N,s),n=w(s),{onCustomAnchorAdd:l,onCustomAnchorRemove:d}=i;return r.useEffect(()=>(l(),()=>d()),[l,d]),(0,t.jsx)(c.Anchor,{...n,...o,ref:a})});P.displayName=N;var T="PopoverTrigger",S=r.forwardRef((e,r)=>{let{__scopePopover:o,...i}=e,n=C(T,o),l=w(o),d=(0,s.useComposedRefs)(r,n.triggerRef),p=(0,t.jsx)(h.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":H(n.open),...i,ref:d,onClick:(0,a.composeEventHandlers)(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?p:(0,t.jsx)(c.Anchor,{asChild:!0,...l,children:p})});S.displayName=T;var R="PopoverPortal",[A,F]=v(R,{forceMount:void 0}),E=e=>{let{__scopePopover:r,forceMount:a,children:s,container:o}=e,i=C(R,r);return(0,t.jsx)(A,{scope:r,forceMount:a,children:(0,t.jsx)(u.Presence,{present:a||i.open,children:(0,t.jsx)(p.Portal,{asChild:!0,container:o,children:s})})})};E.displayName=R;var D="PopoverContent",O=r.forwardRef((e,r)=>{let a=F(D,e.__scopePopover),{forceMount:s=a.forceMount,...o}=e,i=C(D,e.__scopePopover);return(0,t.jsx)(u.Presence,{present:s||i.open,children:i.modal?(0,t.jsx)(z,{...o,ref:r}):(0,t.jsx)(M,{...o,ref:r})})});O.displayName=D;var I=(0,m.createSlot)("PopoverContent.RemoveScroll"),z=r.forwardRef((e,o)=>{let i=C(D,e.__scopePopover),n=r.useRef(null),l=(0,s.useComposedRefs)(o,n),d=r.useRef(!1);return r.useEffect(()=>{let e=n.current;if(e)return(0,f.hideOthers)(e)},[]),(0,t.jsx)(g.RemoveScroll,{as:I,allowPinchZoom:!0,children:(0,t.jsx)(L,{...e,ref:l,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,a.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),d.current||i.triggerRef.current?.focus()}),onPointerDownOutside:(0,a.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;d.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,a.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),M=r.forwardRef((e,a)=>{let s=C(D,e.__scopePopover),o=r.useRef(!1),i=r.useRef(!1);return(0,t.jsx)(L,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||s.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let r=t.target;s.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),L=r.forwardRef((e,r)=>{let{__scopePopover:a,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:d,disableOutsidePointerEvents:p,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:x,...f}=e,g=C(D,a),b=w(a);return(0,n.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:d,children:(0,t.jsx)(i.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:p,onInteractOutside:x,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>g.onOpenChange(!1),children:(0,t.jsx)(c.Content,{"data-state":H(g.open),role:"dialog",id:g.contentId,...b,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),U="PopoverClose",B=r.forwardRef((e,r)=>{let{__scopePopover:s,...o}=e,i=C(U,s);return(0,t.jsx)(h.Primitive.button,{type:"button",...o,ref:r,onClick:(0,a.composeEventHandlers)(e.onClick,()=>i.onOpenChange(!1))})});B.displayName=U;var $=r.forwardRef((e,r)=>{let{__scopePopover:a,...s}=e,o=w(a);return(0,t.jsx)(c.Arrow,{...o,...s,ref:r})});function H(e){return e?"open":"closed"}$.displayName="PopoverArrow",e.s(["Anchor",()=>P,"Arrow",()=>$,"Close",()=>B,"Content",()=>O,"Popover",()=>k,"PopoverAnchor",()=>P,"PopoverArrow",()=>$,"PopoverClose",()=>B,"PopoverContent",()=>O,"PopoverPortal",()=>E,"PopoverTrigger",()=>S,"Portal",()=>E,"Root",()=>k,"Trigger",()=>S,"createPopoverScope",()=>j],89920);var q=e.i(89920),q=q,G=e.i(31777);let _=q.Root,K=q.Trigger;q.Anchor;let W=r.forwardRef(({className:e,align:r="center",sideOffset:a=4,...s},o)=>(0,t.jsx)(q.Portal,{children:(0,t.jsx)(q.Content,{ref:o,align:r,sideOffset:a,className:(0,G.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...s})}));W.displayName=q.Content.displayName,e.s(["Popover",()=>_,"PopoverContent",()=>W,"PopoverTrigger",()=>K],90382)},83843,e=>{"use strict";let t=(0,e.i(3645).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);e.s(["ChevronsUpDown",()=>t],83843)},51911,41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),s=e.i(5978),o=e.i(22528),i=e.i(36589),n=e.i(23405),l=e.i(77624),d=e.i(87620),c="Switch",[p,u]=(0,o.createContextScope)(c),[h,m]=p(c),x=r.forwardRef((e,o)=>{let{__scopeSwitch:n,name:l,checked:p,defaultChecked:u,required:m,disabled:x,value:f="on",onCheckedChange:g,form:j,...w}=e,[y,C]=r.useState(null),k=(0,s.useComposedRefs)(o,e=>C(e)),N=r.useRef(!1),P=!y||j||!!y.closest("form"),[T,S]=(0,i.useControllableState)({prop:p,defaultProp:u??!1,onChange:g,caller:c});return(0,t.jsxs)(h,{scope:n,checked:T,disabled:x,children:[(0,t.jsx)(d.Primitive.button,{type:"button",role:"switch","aria-checked":T,"aria-required":m,"data-state":v(T),"data-disabled":x?"":void 0,disabled:x,value:f,...w,ref:k,onClick:(0,a.composeEventHandlers)(e.onClick,e=>{S(e=>!e),P&&(N.current=e.isPropagationStopped(),N.current||e.stopPropagation())})}),P&&(0,t.jsx)(b,{control:y,bubbles:!N.current,name:l,value:f,checked:T,required:m,disabled:x,form:j,style:{transform:"translateX(-100%)"}})]})});x.displayName=c;var f="SwitchThumb",g=r.forwardRef((e,r)=>{let{__scopeSwitch:a,...s}=e,o=m(f,a);return(0,t.jsx)(d.Primitive.span,{"data-state":v(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})});g.displayName=f;var b=r.forwardRef(({__scopeSwitch:e,control:a,checked:o,bubbles:i=!0,...d},c)=>{let p=r.useRef(null),u=(0,s.useComposedRefs)(p,c),h=(0,n.usePrevious)(o),m=(0,l.useSize)(a);return r.useEffect(()=>{let e=p.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(h!==o&&t){let r=new Event("click",{bubbles:i});t.call(e,o),e.dispatchEvent(r)}},[h,o,i]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...d,tabIndex:-1,ref:u,style:{...d.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function v(e){return e?"checked":"unchecked"}b.displayName="SwitchBubbleInput",e.s(["Root",()=>x,"Switch",()=>x,"SwitchThumb",()=>g,"Thumb",()=>g,"createSwitchScope",()=>u],95291);var j=e.i(95291),j=j,w=e.i(31777);function y({className:e,size:r="default",...a}){return(0,t.jsx)(j.Root,{"data-slot":"switch","data-size":r,className:(0,w.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...a,children:(0,t.jsx)(j.Thumb,{"data-slot":"switch-thumb",className:(0,w.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>y],51911);var C=e.i(23925),k=e.i(11345),N=e.i(76016),P=e.i(65271),T=e.i(6345),S=e.i(86782),R=e.i(29847),A=e.i(35364),F=e.i(90382);function E({initialAgentType:e,initialModel:a,onAgentModelChange:s,disabled:o,className:i,mode:n}){let[l,d]=r.useState(!1),[c,p]=r.useState([]),[u,h]=r.useState(!0),[m,x]=r.useState(e),[f,g]=r.useState(a),[b,v]=r.useState(null),[j,y]=r.useState(0),[E,D]=r.useState(null);r.useEffect(()=>{(0,P.getAllAgentModels)().then(p).finally(()=>h(!1))},[]),r.useEffect(()=>{if(!l){let e=setTimeout(()=>{y(0),D(null)},150);return()=>clearTimeout(e)}},[l]);let O=async(e,t)=>{if(d(!1),e!==m||t!==f){if("override"===n){x(e),g(t),s?.(e,t);return}x(e),g(t),s?.(e,t),v(null);try{let r=await (0,T.updateAgentAndModel)(e,t||null);r.ok||(x(m),g(f),s?.(m,f),v(r.error??"Failed to save"))}catch{x(m),g(f),s?.(m,f),v("Failed to save")}}},I=(0,S.getAgentTypeIcon)(m),z=c.find(e=>e.agentType===m)?.label??m,M=f?(0,R.getModelMeta)(f).displayName||f:null,L=E?c.find(e=>e.agentType===E):null;return(0,t.jsxs)("div",{className:(0,w.cn)("flex flex-col gap-1",i),children:[(0,t.jsxs)(F.Popover,{open:l,onOpenChange:d,children:[(0,t.jsx)(F.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(A.Button,{variant:"outline",role:"combobox","aria-expanded":l,disabled:(o??!1)||u,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(I,{className:"h-4 w-4 shrink-0"}),u?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:z}),M?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:M})]}):null]})]})})}),(0,t.jsx)(F.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===j?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),c.map(e=>{let r=(0,S.getAgentTypeIcon)(e.agentType),a=m===e.agentType,s=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,w.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",a&&"bg-accent/50"),onClick:()=>{s?(D(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>y(1))})):O(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),a&&!s?(0,t.jsx)(C.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,s?(0,t.jsx)(N.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{y(0),setTimeout(()=>D(null),220)},children:[(0,t.jsx)(k.ChevronLeft,{className:"h-3.5 w-3.5"}),L.label]}),L.models.map(e=>{let r=m===L.agentType&&f===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,w.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>O(L.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(C.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!b&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:b})]})}e.s(["AgentModelPicker",()=>E],41413)},15203,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(31406),s=e.i(60112),o=e.i(21023);let i=(0,o.createServerReference)("40d7210d7a4cdc7569766a4d3c099ecef4aae1ed59",o.callServer,void 0,o.findSourceMapURL,"createFeature");var n=e.i(16868),l=e.i(83843),d=e.i(97667),c=e.i(53360),p=e.i(55016),u=e.i(91925),h=e.i(83428),m=e.i(31777),x=e.i(8361);e.i(1650);var f=e.i(11495),g=e.i(45811),b=e.i(35364),v=e.i(98127),j=e.i(48306),w=e.i(41957),y=e.i(81846),C=e.i(90382),k=e.i(51911),N=e.i(2828),P=e.i(30153);e.i(50032);var T=e.i(86254),S=e.i(41413),R=e.i(25235),A=e.i(78521);e.i(13322);var F=e.i(61201),E=e.i(75921),D=e.i(82222),O=e.i(42076);let I=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]),z=[{id:"allowPrd",label:"PRD",description:"Auto-approve requirements move to planning."},{id:"allowPlan",label:"Plan",description:"Auto-approve planning move to implementation."},{id:"allowMerge",label:"Merge",description:"Auto-approve merge move to Done."}],M={allowPrd:!1,allowPlan:!1,allowMerge:!1};function L({open:e,onClose:a,onSubmit:s,repositoryPath:o,isSubmitting:i=!1,workflowDefaults:l,features:d,repositories:u,initialParentId:h,currentAgentType:v,currentModel:C,initialDescription:R}){let A=(0,x.useSoundAction)("create"),F=o&&(!u||0===u.length||u.some(e=>e.path===o))?o:"",E=l?.approvalGates??M,D=l?.push??!1,L=l?.openPr??!1,$=l?.ciWatchEnabled!==!1,H=l?.enableEvidence??!1,q=l?.commitEvidence??!1,[G,_]=(0,r.useState)(R??"");(0,r.useEffect)(()=>{R&&_(R)},[R]);let[K,W]=(0,r.useState)([]),[V,X]=(0,r.useState)({...E}),[Y,Z]=(0,r.useState)(D),[J,Q]=(0,r.useState)(L),[ee,et]=(0,r.useState)(l?.ciWatchEnabled!==!1),[er,ea]=(0,r.useState)(H),[es,eo]=(0,r.useState)(q),[ei,en]=(0,r.useState)(void 0),[el,ed]=(0,r.useState)(!1),[ec,ep]=(0,r.useState)(!1),[eu,eh]=(0,r.useState)(void 0),[em,ex]=(0,r.useState)(void 0),[ef,eg]=(0,r.useState)(F||void 0),[eb,ev]=(0,r.useState)(u??[]),[ej,ew]=(0,r.useState)(!1),[ey,eC]=(0,r.useState)(null),[ek,eN]=(0,r.useState)(!1),eP=(0,r.useRef)(crypto.randomUUID()),eT=(0,r.useRef)(0),eS=(0,r.useRef)(null);(0,r.useEffect)(()=>{l&&(X({...l.approvalGates}),Z(l.push),Q(l.openPr),et(!1!==l.ciWatchEnabled),ea(l.enableEvidence),eo(l.commitEvidence))},[l]),(0,r.useEffect)(()=>{ev(u??[])},[u]),(0,r.useEffect)(()=>{e&&h&&en(h)},[e,h]);let eR=(0,r.useCallback)(()=>{_(""),W([]),X({...E}),Z(D),Q(L),et($),ea(H),eo(q),en(void 0),eg(F||void 0),ev(u??[]),ed(!1),ep(!1),eh(void 0),ex(void 0),eC(null),eT.current=0,ew(!1)},[E,D,L,H,$,q,F,u]),eA=""!==G.trim()||K.length>0,{attemptClose:eF}=(0,P.useGuardedDrawerClose)({open:e,isDirty:eA,onClose:a,onReset:eR}),eE=(0,r.useCallback)(async e=>{for(let t of(eC(null),e)){if(t.size>0xa00000)return void eC(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!I.has(e))return void eC(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();W(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let r=new FormData;r.append("file",t),r.append("sessionId",eP.current);let a=await fetch("/api/attachments/upload",{method:"POST",body:r});if(!a.ok){let t=await a.json().catch(()=>({error:"Upload failed"}));W(t=>t.filter(t=>t.id!==e)),eC(t.error??"Upload failed");return}let s=await a.json();W(t=>t.some(t=>t.id!==e&&t.path===s.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...s,id:e,loading:!1}:t))}catch{W(t=>t.filter(t=>t.id!==e)),eC("Upload failed")}}},[]),eD=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eT.current+=1,1===eT.current&&ew(!0)},[]),eO=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eT.current-=1,0===eT.current&&ew(!1)},[]),eI=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),ez=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eT.current=0,ew(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&eE(t)},[eE]),eM=(0,r.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),eE(r))},[eE]),eL=(0,r.useCallback)(e=>{if(e.preventDefault(),!G.trim())return;let t=ef??F;t&&(A.play(),s({description:G.trim(),attachments:K.filter(e=>!e.loading),repositoryPath:t,approvalGates:{allowPrd:V.allowPrd??!1,allowPlan:V.allowPlan??!1,allowMerge:V.allowMerge??!1},push:Y||J,openPr:J,ciWatchEnabled:ee,enableEvidence:er,commitEvidence:es,fast:el,...ec?{pending:ec}:{},...eu?{agentType:eu}:{},...em?{model:em}:{},...ei?{parentId:ei}:{},sessionId:eP.current}),eR())},[G,K,V,ef,F,s,Y,J,er,ee,es,el,ec,eu,em,ei,A,eR]),eU=(0,r.useCallback)(async()=>{try{let e=await (0,O.pickFiles)();if(!e)return;for(let t of e){let e=crypto.randomUUID();W(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:"application/octet-stream",path:"",loading:!0}]);try{let r=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,sessionId:eP.current})});if(!r.ok){let t=await r.json().catch(()=>({error:"Upload failed"}));W(t=>t.filter(t=>t.id!==e)),eC(t.error??"Upload failed");return}let a=await r.json();W(t=>t.some(t=>t.id!==e&&t.path===a.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...a,id:e,loading:!1}:t))}catch{W(t=>t.filter(t=>t.id!==e)),eC("Upload failed")}}}catch{}},[]),eB=(0,r.useCallback)(e=>{W(t=>t.filter(t=>t.id!==e))},[]),e$=(0,r.useRef)(null),eH=(0,r.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),e$.current?.requestSubmit())},[]),eq=(0,r.useCallback)(()=>{eN(!0)},[]),eG=(0,r.useCallback)(()=>{setTimeout(()=>{let e=eS.current?.contains(document.activeElement),t=eS.current?.querySelector('[aria-expanded="true"]')!==null;e||t||eN(!1)},0)},[]),e_=d&&d.length>0,eK=!F&&!ef,eW=!F&&void 0!==u;return(0,t.jsx)(f.BaseDrawer,{open:e,onClose:eF,size:"md",modal:!1,dismissOnOutsideClick:!0,"data-testid":"feature-create-drawer",header:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsx)(g.DrawerTitle,{children:"NEW FEATURE"})]}),i?(0,t.jsx)(g.DrawerDescription,{asChild:!0,children:(0,t.jsx)("div",{children:(0,t.jsx)(y.Badge,{variant:"secondary",children:"Creating..."})})}):null]}),footer:(0,t.jsxs)("div",{className:"flex flex-row justify-end gap-2",children:[(0,t.jsx)(b.Button,{variant:"outline",onClick:eF,disabled:i,children:"Cancel"}),(0,t.jsx)(b.Button,{type:"submit",form:"create-feature-form",disabled:!G.trim()||i||eK,children:i?"Creating...":"+ Create Feature"})]}),children:(0,t.jsx)("div",{className:"overflow-y-auto p-4",children:(0,t.jsx)(N.TooltipProvider,{delayDuration:400,children:(0,t.jsxs)("form",{ref:e$,id:"create-feature-form",onSubmit:eL,onKeyDown:eH,className:"flex flex-col gap-4",children:[eW?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"repo-selector-section",children:[(0,t.jsx)(w.Label,{className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"REPOSITORY"}),(0,t.jsx)(B,{repositories:eb,value:ef,onChange:eg,onAddRepository:e=>{ev(t=>[...t,e]),eg(e.path)},disabled:i})]}):F?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"repo-readonly-section",children:[(0,t.jsx)(w.Label,{className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"REPOSITORY"}),(0,t.jsx)("p",{className:"text-sm","data-testid":"repo-readonly-label",children:u?.find(e=>e.path===F)?.name??F.split("/").pop()})]}):null,(0,t.jsxs)("div",{role:"region","aria-label":"File drop zone","data-drag-over":ej?"true":"false",onDragEnter:eD,onDragLeave:eO,onDragOver:eI,onDrop:ez,className:(0,m.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",ej&&"border-primary/50 bg-primary/5"),children:[(0,t.jsx)(w.Label,{htmlFor:"feature-description",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"DESCRIBE YOUR FEATURE"}),(0,t.jsxs)("div",{ref:eS,onFocus:eq,onBlur:eG,className:(0,m.cn)("border-input flex h-56 flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",ek&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,t.jsx)(j.Textarea,{id:"feature-description",placeholder:"e.g. Add GitHub OAuth login with callback handling and token refresh...",value:G,onChange:e=>_(e.target.value),onPaste:eM,required:!0,disabled:i,className:"min-h-0 flex-1 resize-none rounded-none border-0 shadow-none focus-visible:ring-0"}),K.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:K.map(e=>(0,t.jsx)(T.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>eB(e.id),disabled:i,loading:e.loading},e.id))}),ey?(0,t.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:ey}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[(0,t.jsx)(S.AgentModelPicker,{initialAgentType:eu??v??"claude-code",initialModel:em??C??"claude-sonnet-4-6",mode:"override",onAgentModelChange:(e,t)=>{eh(e),ex(t)},disabled:i,className:"w-55"}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex cursor-pointer items-center gap-2",children:[(0,t.jsx)(k.Switch,{id:"pending-mode",checked:ec,onCheckedChange:ep,disabled:i}),(0,t.jsxs)(w.Label,{htmlFor:"pending-mode",className:"flex cursor-pointer items-center gap-1 text-sm font-medium",children:[(0,t.jsx)(p.Clock,{className:"h-3.5 w-3.5"}),"Pending"]})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Create without starting — start manually later."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-2",children:[(0,t.jsx)(k.Switch,{id:"fast-mode",checked:el,onCheckedChange:ed,disabled:i}),(0,t.jsxs)(w.Label,{htmlFor:"fast-mode",className:"flex cursor-pointer items-center gap-1 text-sm font-medium",children:[(0,t.jsx)(c.Zap,{className:"h-3.5 w-3.5"}),"Fast Mode"]})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Skip SDLC phases and implement directly from your prompt."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:eU,disabled:i,"aria-label":"Attach files",className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(n.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Attach files"})]})]})]})]}),e_&&void 0!==h?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(w.Label,{htmlFor:"parent-feature",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"PARENT FEATURE"}),(0,t.jsx)(U,{features:d,value:ei,onChange:en,disabled:i})]}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 cursor-default text-xs font-semibold tracking-wider",children:"APPROVE"})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Auto-approve phase transitions without manual review."})]}),(0,t.jsx)("div",{className:"flex flex-1 items-center gap-4",children:z.map(e=>(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:`approve-${e.id}`,size:"sm",checked:V[e.id]??!1,onCheckedChange:t=>X(r=>({...r,[e.id]:t})),disabled:i||el&&("allowPrd"===e.id||"allowPlan"===e.id)}),(0,t.jsx)(w.Label,{htmlFor:`approve-${e.id}`,className:"cursor-pointer text-xs font-medium",children:e.label})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:el&&("allowPrd"===e.id||"allowPlan"===e.id)?"Skipped in Fast Mode":e.description})]},e.id))}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:()=>{let e=z.every(e=>V[e.id]),t={};for(let r of z)t[r.id]=!e;X(t)},disabled:i,className:(0,m.cn)("text-muted-foreground hover:text-foreground cursor-pointer rounded px-1.5 py-0.5 text-[10px] font-semibold tracking-wider uppercase transition-colors",z.every(e=>V[e.id])&&"text-primary"),children:"All"})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Toggle all approval gates"})]})]}),(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 cursor-default text-xs font-semibold tracking-wider",children:"EVIDENCE"})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Collect and attach evidence after implementation."})]}),(0,t.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"enable-evidence",size:"sm",checked:er,onCheckedChange:e=>{ea(e),e||eo(!1)},disabled:i}),(0,t.jsx)(w.Label,{htmlFor:"enable-evidence",className:"cursor-pointer text-xs font-medium",children:"Collect"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Capture screenshots and artifacts after implementation."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"commit-evidence",size:"sm",checked:es,onCheckedChange:eo,disabled:i||!er||!J}),(0,t.jsx)(w.Label,{htmlFor:"commit-evidence",className:(0,m.cn)("cursor-pointer text-xs font-medium",(!er||!J)&&"opacity-50"),children:"Add to PR"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:J?er?"Include evidence in the pull request body.":"Requires evidence collection to be enabled":"Requires PR to be enabled"})]})]})]}),(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 text-xs font-semibold tracking-wider",children:"GIT"}),(0,t.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"push",size:"sm",checked:Y||J,onCheckedChange:e=>{Z(e),!e&&J&&Q(!1)},disabled:i}),(0,t.jsx)(w.Label,{htmlFor:"push",className:"cursor-pointer text-xs font-medium",children:"Push"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Push branch to remote after implementation."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"open-pr",size:"sm",checked:J,onCheckedChange:e=>{Q(e),e||eo(!1)},disabled:i}),(0,t.jsx)(w.Label,{htmlFor:"open-pr",className:"cursor-pointer text-xs font-medium",children:"PR"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Open a pull request after pushing."})]}),(0,t.jsxs)(N.Tooltip,{children:[(0,t.jsx)(N.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(k.Switch,{id:"ci-watch",size:"sm",checked:ee,onCheckedChange:et,disabled:i}),(0,t.jsx)(w.Label,{htmlFor:"ci-watch",className:"cursor-pointer text-xs font-medium",children:"Watch"})]})}),(0,t.jsx)(N.TooltipContent,{side:"bottom",children:"Watch CI and auto-fix after push."})]})]})]})]})]})})})})}function U({features:e,value:a,onChange:s,disabled:o}){let[i,n]=(0,r.useState)(!1),[c,p]=(0,r.useState)(""),u=(0,r.useRef)(null),h=e.find(e=>e.id===a),x=c.trim()?e.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())||e.id.toLowerCase().includes(c.toLowerCase())):e,f=(0,r.useCallback)(e=>{s(e),n(!1),p("")},[s]);return(0,r.useEffect)(()=>{i?setTimeout(()=>u.current?.focus(),0):p("")},[i]),(0,t.jsxs)(C.Popover,{open:i,onOpenChange:n,children:[(0,t.jsx)(C.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{id:"parent-feature",type:"button",role:"combobox","aria-expanded":i,"aria-label":"Parent Feature",disabled:o,"data-testid":"parent-feature-combobox",className:(0,m.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!h&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:h?`${h.name} (${h.id.slice(0,8)})`:"Select parent feature..."}),(0,t.jsx)(l.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(C.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"parent-feature-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(v.Input,{ref:u,placeholder:"Search features...",value:c,onChange:e=>p(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"parent-feature-search"})}),(0,t.jsxs)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Features",children:[(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":void 0===a,onClick:()=>f(void 0),className:(0,m.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",void 0===a&&"bg-accent/50"),"data-testid":"parent-feature-option-none",children:[(0,t.jsx)(d.CheckIcon,{className:(0,m.cn)("h-4 w-4 shrink-0",void 0!==a&&"invisible")}),(0,t.jsx)("span",{className:"text-muted-foreground italic",children:"No parent"})]}),0===x.length&&c?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No features found."}):x.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":a===e.id,onClick:()=>f(e.id),className:(0,m.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",a===e.id&&"bg-accent/50"),"data-testid":`parent-feature-option-${e.id}`,children:[(0,t.jsx)(d.CheckIcon,{className:(0,m.cn)("h-4 w-4 shrink-0",a!==e.id&&"invisible")}),(0,t.jsxs)("span",{className:"truncate",children:[e.name," ",(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-xs",children:["(",e.id.slice(0,8),")"]})]})]},e.id))]})]})})]})}function B({repositories:e,value:a,onChange:s,onAddRepository:o,disabled:i}){let[n,c]=(0,r.useState)(!1),[p,x]=(0,r.useState)(""),[f,g]=(0,r.useState)(!1),[b,j]=(0,r.useState)(null),[w,y]=(0,r.useState)(!1),k=(0,r.useRef)(null),{reactFileManager:N}=(0,E.useFeatureFlags)(),P=e.find(e=>e.path===a),T=p.trim()?e.filter(e=>e.name.toLowerCase().includes(p.toLowerCase())||e.path.toLowerCase().includes(p.toLowerCase())):e,S=(0,r.useCallback)(e=>{s(e),c(!1),x("")},[s]),O=(0,r.useCallback)(async e=>{let t=await (0,D.addRepository)({path:e});if(t.error){j(t.error),g(!1);return}if(t.repository){let e={id:t.repository.id,name:t.repository.name,path:t.repository.path};o?.(e),s(e.path),c(!1),x("")}},[o,s]),I=(0,r.useCallback)(async()=>{if(!f){if(N)return void y(!0);g(!0),j(null);try{let e=await (0,A.pickFolder)();if(!e)return void g(!1);await O(e)}catch{y(!0)}finally{g(!1)}}},[f,N,O]),z=(0,r.useCallback)(async e=>{if(y(!1),e){g(!0),j(null);try{await O(e)}catch(e){j(e instanceof Error?e.message:"Failed to add repository")}finally{g(!1)}}},[O]);return(0,r.useEffect)(()=>{n?setTimeout(()=>k.current?.focus(),0):x("")},[n]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(C.Popover,{open:n,onOpenChange:c,children:[(0,t.jsx)(C.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",role:"combobox","aria-expanded":n,"aria-label":"Repository",disabled:i,"data-testid":"repository-combobox",className:(0,m.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!P&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:P?P.name:"Select repository..."}),(0,t.jsx)(l.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(C.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"repository-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(v.Input,{ref:k,placeholder:"Search repositories...",value:p,onChange:e=>x(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"repository-search"})}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Repositories",children:0===T.length?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm","data-testid":"repository-empty",children:"No repositories found."}):T.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":a===e.path,onClick:()=>S(e.path),className:(0,m.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",a===e.path&&"bg-accent/50"),"data-testid":`repository-option-${e.id}`,children:[(0,t.jsx)(d.CheckIcon,{className:(0,m.cn)("h-4 w-4 shrink-0",a!==e.path&&"invisible")}),(0,t.jsxs)("span",{className:"flex flex-col items-start truncate",children:[(0,t.jsx)("span",{className:"truncate",children:e.name}),(0,t.jsx)("span",{className:"text-muted-foreground truncate text-xs",children:e.path})]})]},e.id))}),(0,t.jsx)(R.Separator,{}),(0,t.jsxs)("button",{type:"button",onClick:I,disabled:f,className:"hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm","data-testid":"add-repository-item",children:[f?(0,t.jsx)(h.Loader2,{className:"h-4 w-4 shrink-0 animate-spin"}):(0,t.jsx)(u.FolderPlus,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{children:"Add new repository..."})]}),b?(0,t.jsx)("p",{className:"px-3 pb-2 text-xs text-red-500","data-testid":"add-repository-error",children:b}):null]})})]}),(0,t.jsx)(F.ReactFileManagerDialog,{open:w,onOpenChange:e=>{e||y(!1)},onSelect:z})]})}function $({repositoryPath:e,initialParentId:o,initialDescription:n,features:l,repositories:d,workflowDefaults:c,currentAgentType:p,currentModel:u}){let h=(0,a.useRouter)(),[m,x]=(0,r.useState)(!1),f=(0,a.usePathname)().startsWith("/create"),g=!m&&f;(0,r.useEffect)(()=>{!f&&m&&x(!1)},[f,m]);let b=(0,r.useCallback)(()=>{h.push("/")},[h]),v=(0,r.useCallback)(e=>{x(!0),h.push("/"),i(e).then(t=>{t.error?s.toast.error(t.error):window.dispatchEvent(new CustomEvent("shep:feature-created",{detail:{featureId:t.feature.id,name:t.feature.name,description:t.feature.description,repositoryPath:t.feature.repositoryPath,parentId:e.parentId}}))}).catch(()=>{s.toast.error("Failed to create feature"),x(!1)})},[h]);return(0,t.jsx)(L,{open:g,onClose:b,onSubmit:v,repositoryPath:e,features:l,repositories:d,workflowDefaults:c,initialParentId:o,initialDescription:n,isSubmitting:m,currentAgentType:p,currentModel:u})}e.s(["CreateDrawerClient",()=>$],15203)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,10714,99105,e=>{"use strict";var t=e.i(3645);let r=(0,t.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",()=>r],10714);let a=(0,t.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>a],99105)},33548,e=>{"use strict";let t=(0,e.i(3645).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",()=>t],33548)},95812,35e3,e=>{"use strict";let t=(0,e.i(3645).default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["Circle",()=>t],95812);var r=e.i(80986);e.s(["CheckCircle2",()=>r.default],35e3)},19933,e=>{"use strict";let t=(0,e.i(3645).default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);e.s(["FolderOpen",()=>t],19933)},8986,2498,50715,87779,e=>{"use strict";let t=(0,e.i(3645).default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);e.s(["Code2",()=>t],8986);var r=e.i(21023);let a=(0,r.createServerReference)("4004191493fea09e4c72b66e46ee89650162715df0",r.callServer,void 0,r.findSourceMapURL,"openIde");e.s(["openIde",()=>a],2498);let l=(0,r.createServerReference)("405e2c723e302c4cafa45f987cf1b81734a7893d75",r.callServer,void 0,r.findSourceMapURL,"openShell");e.s(["openShell",()=>l],50715);let c=(0,r.createServerReference)("40794e90ddb0248b290296a4511be5188334c24ad9",r.callServer,void 0,r.findSourceMapURL,"openFolder");e.s(["openFolder",()=>c],87779)},53360,e=>{"use strict";let t=(0,e.i(3645).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);e.s(["Zap",()=>t],53360)},23405,e=>{"use strict";var t=e.i(79054);function r(e){let r=t.useRef({value:e,previous:e});return t.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}e.s(["usePrevious",()=>r])},76016,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],76016)},11345,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",()=>t],11345)},97667,e=>{"use strict";var t=e.i(1012);e.s(["CheckIcon",()=>t.default])},23925,1012,e=>{"use strict";let t=(0,e.i(3645).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],1012),e.s(["Check",()=>t],23925)},30702,e=>{"use strict";let t=(0,e.i(3645).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],30702)},38573,e=>{"use strict";let t=(0,e.i(3645).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],38573)},1650,e=>{"use strict";e.i(11495),e.s([])},54793,7729,e=>{"use strict";var t=e.i(20314),r=e.i(31777);function a({icon:e,title:a,description:l,action:c,className:s,...u}){return(0,t.jsxs)("div",{className:(0,r.cn)("flex flex-col items-center gap-4 px-4 py-12 text-center",s),...u,children:[e?(0,t.jsx)("div",{className:"text-muted-foreground",children:e}):null,(0,t.jsx)("h3",{className:"text-lg font-semibold",children:a}),l?(0,t.jsx)("p",{className:"text-muted-foreground max-w-md text-sm",children:l}):null,c?(0,t.jsx)("div",{className:"mt-2",children:c}):null]})}e.s(["EmptyState",()=>a],7729),e.s([],54793)},65271,6345,e=>{"use strict";var t=e.i(21023);let r=(0,t.createServerReference)("004d2c7ce0096e23001095e71b130034d7095aeb8c",t.callServer,void 0,t.findSourceMapURL,"getAllAgentModels");e.s(["getAllAgentModels",()=>r],65271);let a=(0,t.createServerReference)("60ac46cbce3a9a19dd0ccd4bec3925e6e45500e031",t.callServer,void 0,t.findSourceMapURL,"updateAgentAndModel");e.s(["updateAgentAndModel",()=>a],6345)},82222,e=>{"use strict";var t=e.i(21023);let r=(0,t.createServerReference)("40a72ab85d72fcad36d99ca52132a4b5241794d555",t.callServer,void 0,t.findSourceMapURL,"addRepository");e.s(["addRepository",()=>r])},76852,e=>{"use strict";var t=e.i(79054),r=e.i(2498),a=e.i(50715),l=e.i(87779),c=e.i(21023);let s=(0,c.createServerReference)("40ef99d265f9777a6a4b9a62fc1c9bfac3ee1fdaae",c.callServer,void 0,c.findSourceMapURL,"syncRepository");function u(e){let[c,u]=(0,t.useState)(!1),[n,i]=(0,t.useState)(!1),[d,o]=(0,t.useState)(!1),[p,f]=(0,t.useState)(!1),[h,v]=(0,t.useState)(null),[y,m]=(0,t.useState)(null),[S,k]=(0,t.useState)(null),[x,R]=(0,t.useState)(null),b=(0,t.useRef)(null),g=(0,t.useRef)(null),M=(0,t.useRef)(null),C=(0,t.useRef)(null);(0,t.useEffect)(()=>()=>{b.current&&clearTimeout(b.current),g.current&&clearTimeout(g.current),M.current&&clearTimeout(M.current),C.current&&clearTimeout(C.current)},[]);let A=(0,t.useCallback)(async(t,r,a,l,c)=>{if(e&&!c){l.current&&clearTimeout(l.current),r(!0),a(null);try{let e=await t();if(!e.success){let t=e.error??"An unexpected error occurred";a(t),l.current=setTimeout(()=>a(null),5e3)}}catch(e){a(e instanceof Error?e.message:"An unexpected error occurred"),l.current=setTimeout(()=>a(null),5e3)}finally{r(!1)}}},[e]);return{openInIde:(0,t.useCallback)(()=>A(()=>(0,r.openIde)({repositoryPath:e.repositoryPath}),u,v,b,c),[A,c,e]),openInShell:(0,t.useCallback)(()=>A(()=>(0,a.openShell)({repositoryPath:e.repositoryPath}),i,m,g,n),[A,n,e]),openFolder:(0,t.useCallback)(()=>A(()=>(0,l.openFolder)(e.repositoryPath),o,k,M,d),[A,d,e]),syncMain:(0,t.useCallback)(()=>A(()=>s(e.repositoryId??""),f,R,C,p),[A,p,e]),ideLoading:c,shellLoading:n,folderLoading:d,syncLoading:p,ideError:h,shellError:y,folderError:S,syncError:x}}e.s(["useRepositoryActions",()=>u],76852)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58860,44229,e=>{"use strict";let t=(0,e.i(3645).default)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);e.s(["Timer",()=>t],58860);var r=e.i(93752);e.s(["Code",()=>r.default],44229)},10714,99105,e=>{"use strict";var t=e.i(3645);let r=(0,t.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["default",()=>r],10714);let o=(0,t.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>o],99105)},38573,e=>{"use strict";let t=(0,e.i(3645).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],38573)},30702,e=>{"use strict";let t=(0,e.i(3645).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],30702)},23925,1012,e=>{"use strict";let t=(0,e.i(3645).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],1012),e.s(["Check",()=>t],23925)},23405,e=>{"use strict";var t=e.i(79054);function r(e){let r=t.useRef({value:e,previous:e});return t.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}e.s(["usePrevious",()=>r])},11345,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",()=>t],11345)},76016,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],76016)},93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},83902,e=>{"use strict";let t=(0,e.i(3645).default)("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);e.s(["Rocket",()=>t],83902)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),o=e.i(91967),a=e.i(5978),n=e.i(22528),s=e.i(53532),i=e.i(41687),l=e.i(56720),c=e.i(13123),d=e.i(52740),u=e.i(39979),p=e.i(85995),h=e.i(87620),f=e.i(86874),m=e.i(36589),v=e.i(73772),x=e.i(13044),g="Popover",[b,y]=(0,n.createContextScope)(g,[d.createPopperScope]),k=(0,d.createPopperScope)(),[w,j]=b(g),C=e=>{let{__scopePopover:o,children:a,open:n,defaultOpen:s,onOpenChange:i,modal:l=!1}=e,u=k(o),p=r.useRef(null),[h,f]=r.useState(!1),[v,x]=(0,m.useControllableState)({prop:n,defaultProp:s??!1,onChange:i,caller:g});return(0,t.jsx)(d.Root,{...u,children:(0,t.jsx)(w,{scope:o,contentId:(0,c.useId)(),triggerRef:p,open:v,onOpenChange:x,onOpenToggle:r.useCallback(()=>x(e=>!e),[x]),hasCustomAnchor:h,onCustomAnchorAdd:r.useCallback(()=>f(!0),[]),onCustomAnchorRemove:r.useCallback(()=>f(!1),[]),modal:l,children:a})})};C.displayName=g;var P="PopoverAnchor",R=r.forwardRef((e,o)=>{let{__scopePopover:a,...n}=e,s=j(P,a),i=k(a),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return r.useEffect(()=>(l(),()=>c()),[l,c]),(0,t.jsx)(d.Anchor,{...i,...n,ref:o})});R.displayName=P;var N="PopoverTrigger",A=r.forwardRef((e,r)=>{let{__scopePopover:n,...s}=e,i=j(N,n),l=k(n),c=(0,a.useComposedRefs)(r,i.triggerRef),u=(0,t.jsx)(h.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":U(i.open),...s,ref:c,onClick:(0,o.composeEventHandlers)(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?u:(0,t.jsx)(d.Anchor,{asChild:!0,...l,children:u})});A.displayName=N;var S="PopoverPortal",[T,M]=b(S,{forceMount:void 0}),E=e=>{let{__scopePopover:r,forceMount:o,children:a,container:n}=e,s=j(S,r);return(0,t.jsx)(T,{scope:r,forceMount:o,children:(0,t.jsx)(p.Presence,{present:o||s.open,children:(0,t.jsx)(u.Portal,{asChild:!0,container:n,children:a})})})};E.displayName=S;var F="PopoverContent",O=r.forwardRef((e,r)=>{let o=M(F,e.__scopePopover),{forceMount:a=o.forceMount,...n}=e,s=j(F,e.__scopePopover);return(0,t.jsx)(p.Presence,{present:a||s.open,children:s.modal?(0,t.jsx)(D,{...n,ref:r}):(0,t.jsx)(I,{...n,ref:r})})});O.displayName=F;var z=(0,f.createSlot)("PopoverContent.RemoveScroll"),D=r.forwardRef((e,n)=>{let s=j(F,e.__scopePopover),i=r.useRef(null),l=(0,a.useComposedRefs)(n,i),c=r.useRef(!1);return r.useEffect(()=>{let e=i.current;if(e)return(0,v.hideOthers)(e)},[]),(0,t.jsx)(x.RemoveScroll,{as:z,allowPinchZoom:!0,children:(0,t.jsx)(q,{...e,ref:l,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),c.current||s.triggerRef.current?.focus()}),onPointerDownOutside:(0,o.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;c.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,o.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),I=r.forwardRef((e,o)=>{let a=j(F,e.__scopePopover),n=r.useRef(!1),s=r.useRef(!1);return(0,t.jsx)(q,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(n.current||a.triggerRef.current?.focus(),t.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(s.current=!0));let r=t.target;a.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),q=r.forwardRef((e,r)=>{let{__scopePopover:o,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,...v}=e,x=j(F,o),g=k(o);return(0,i.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:c,children:(0,t.jsx)(s.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:m,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:f,onDismiss:()=>x.onOpenChange(!1),children:(0,t.jsx)(d.Content,{"data-state":U(x.open),role:"dialog",id:x.contentId,...g,...v,ref:r,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),H="PopoverClose",L=r.forwardRef((e,r)=>{let{__scopePopover:a,...n}=e,s=j(H,a);return(0,t.jsx)(h.Primitive.button,{type:"button",...n,ref:r,onClick:(0,o.composeEventHandlers)(e.onClick,()=>s.onOpenChange(!1))})});L.displayName=H;var _=r.forwardRef((e,r)=>{let{__scopePopover:o,...a}=e,n=k(o);return(0,t.jsx)(d.Arrow,{...n,...a,ref:r})});function U(e){return e?"open":"closed"}_.displayName="PopoverArrow",e.s(["Anchor",()=>R,"Arrow",()=>_,"Close",()=>L,"Content",()=>O,"Popover",()=>C,"PopoverAnchor",()=>R,"PopoverArrow",()=>_,"PopoverClose",()=>L,"PopoverContent",()=>O,"PopoverPortal",()=>E,"PopoverTrigger",()=>A,"Portal",()=>E,"Root",()=>C,"Trigger",()=>A,"createPopoverScope",()=>y],89920);var B=e.i(89920),B=B,K=e.i(31777);let X=B.Root,G=B.Trigger;B.Anchor;let V=r.forwardRef(({className:e,align:r="center",sideOffset:o=4,...a},n)=>(0,t.jsx)(B.Portal,{children:(0,t.jsx)(B.Content,{ref:n,align:r,sideOffset:o,className:(0,K.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...a})}));V.displayName=B.Content.displayName,e.s(["Popover",()=>X,"PopoverContent",()=>V,"PopoverTrigger",()=>G],90382)},65271,6345,e=>{"use strict";var t=e.i(21023);let r=(0,t.createServerReference)("004d2c7ce0096e23001095e71b130034d7095aeb8c",t.callServer,void 0,t.findSourceMapURL,"getAllAgentModels");e.s(["getAllAgentModels",()=>r],65271);let o=(0,t.createServerReference)("60ac46cbce3a9a19dd0ccd4bec3925e6e45500e031",t.callServer,void 0,t.findSourceMapURL,"updateAgentAndModel");e.s(["updateAgentAndModel",()=>o],6345)},51911,41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),o=e.i(91967),a=e.i(5978),n=e.i(22528),s=e.i(36589),i=e.i(23405),l=e.i(77624),c=e.i(87620),d="Switch",[u,p]=(0,n.createContextScope)(d),[h,f]=u(d),m=r.forwardRef((e,n)=>{let{__scopeSwitch:i,name:l,checked:u,defaultChecked:p,required:f,disabled:m,value:v="on",onCheckedChange:x,form:y,...k}=e,[w,j]=r.useState(null),C=(0,a.useComposedRefs)(n,e=>j(e)),P=r.useRef(!1),R=!w||y||!!w.closest("form"),[N,A]=(0,s.useControllableState)({prop:u,defaultProp:p??!1,onChange:x,caller:d});return(0,t.jsxs)(h,{scope:i,checked:N,disabled:m,children:[(0,t.jsx)(c.Primitive.button,{type:"button",role:"switch","aria-checked":N,"aria-required":f,"data-state":b(N),"data-disabled":m?"":void 0,disabled:m,value:v,...k,ref:C,onClick:(0,o.composeEventHandlers)(e.onClick,e=>{A(e=>!e),R&&(P.current=e.isPropagationStopped(),P.current||e.stopPropagation())})}),R&&(0,t.jsx)(g,{control:w,bubbles:!P.current,name:l,value:v,checked:N,required:f,disabled:m,form:y,style:{transform:"translateX(-100%)"}})]})});m.displayName=d;var v="SwitchThumb",x=r.forwardRef((e,r)=>{let{__scopeSwitch:o,...a}=e,n=f(v,o);return(0,t.jsx)(c.Primitive.span,{"data-state":b(n.checked),"data-disabled":n.disabled?"":void 0,...a,ref:r})});x.displayName=v;var g=r.forwardRef(({__scopeSwitch:e,control:o,checked:n,bubbles:s=!0,...c},d)=>{let u=r.useRef(null),p=(0,a.useComposedRefs)(u,d),h=(0,i.usePrevious)(n),f=(0,l.useSize)(o);return r.useEffect(()=>{let e=u.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(h!==n&&t){let r=new Event("click",{bubbles:s});t.call(e,n),e.dispatchEvent(r)}},[h,n,s]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...c,tabIndex:-1,ref:p,style:{...c.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function b(e){return e?"checked":"unchecked"}g.displayName="SwitchBubbleInput",e.s(["Root",()=>m,"Switch",()=>m,"SwitchThumb",()=>x,"Thumb",()=>x,"createSwitchScope",()=>p],95291);var y=e.i(95291),y=y,k=e.i(31777);function w({className:e,size:r="default",...o}){return(0,t.jsx)(y.Root,{"data-slot":"switch","data-size":r,className:(0,k.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...o,children:(0,t.jsx)(y.Thumb,{"data-slot":"switch-thumb",className:(0,k.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>w],51911);var j=e.i(23925),C=e.i(11345),P=e.i(76016),R=e.i(65271),N=e.i(6345),A=e.i(86782),S=e.i(29847),T=e.i(35364),M=e.i(90382);function E({initialAgentType:e,initialModel:o,onAgentModelChange:a,disabled:n,className:s,mode:i}){let[l,c]=r.useState(!1),[d,u]=r.useState([]),[p,h]=r.useState(!0),[f,m]=r.useState(e),[v,x]=r.useState(o),[g,b]=r.useState(null),[y,w]=r.useState(0),[E,F]=r.useState(null);r.useEffect(()=>{(0,R.getAllAgentModels)().then(u).finally(()=>h(!1))},[]),r.useEffect(()=>{if(!l){let e=setTimeout(()=>{w(0),F(null)},150);return()=>clearTimeout(e)}},[l]);let O=async(e,t)=>{if(c(!1),e!==f||t!==v){if("override"===i){m(e),x(t),a?.(e,t);return}m(e),x(t),a?.(e,t),b(null);try{let r=await (0,N.updateAgentAndModel)(e,t||null);r.ok||(m(f),x(v),a?.(f,v),b(r.error??"Failed to save"))}catch{m(f),x(v),a?.(f,v),b("Failed to save")}}},z=(0,A.getAgentTypeIcon)(f),D=d.find(e=>e.agentType===f)?.label??f,I=v?(0,S.getModelMeta)(v).displayName||v:null,q=E?d.find(e=>e.agentType===E):null;return(0,t.jsxs)("div",{className:(0,k.cn)("flex flex-col gap-1",s),children:[(0,t.jsxs)(M.Popover,{open:l,onOpenChange:c,children:[(0,t.jsx)(M.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(T.Button,{variant:"outline",role:"combobox","aria-expanded":l,disabled:(n??!1)||p,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(z,{className:"h-4 w-4 shrink-0"}),p?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:D}),I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:I})]}):null]})]})})}),(0,t.jsx)(M.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===y?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),d.map(e=>{let r=(0,A.getAgentTypeIcon)(e.agentType),o=f===e.agentType,a=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,k.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",o&&"bg-accent/50"),onClick:()=>{a?(F(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>w(1))})):O(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),o&&!a?(0,t.jsx)(j.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,a?(0,t.jsx)(P.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{w(0),setTimeout(()=>F(null),220)},children:[(0,t.jsx)(C.ChevronLeft,{className:"h-3.5 w-3.5"}),q.label]}),q.models.map(e=>{let r=f===q.agentType&&v===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,k.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>O(q.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(j.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!g&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:g})]})}e.s(["AgentModelPicker",()=>E],41413)}]);
|
|
File without changes
|