hive-am 1.0.0 → 1.2.0
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/CHANGELOG.md +114 -1
- package/README.md +34 -4
- package/package.json +13 -2
- package/server/dist/api.js +42 -677
- package/server/dist/connections/addressing.js +87 -0
- package/server/dist/connections/channel-skill.js +62 -0
- package/server/dist/connections/fake.js +1 -0
- package/server/dist/connections/files.js +45 -1
- package/server/dist/connections/format.js +9 -1
- package/server/dist/connections/manager.js +60 -3
- package/server/dist/connections/outbound.js +2 -1
- package/server/dist/connections/prompt.js +12 -3
- package/server/dist/connections/rate.js +20 -0
- package/server/dist/connections/router.js +55 -22
- package/server/dist/connections/secrets.js +52 -0
- package/server/dist/connections/store.js +6 -43
- package/server/dist/connections/telegram.js +105 -14
- package/server/dist/cron.js +138 -0
- package/server/dist/db/json.js +16 -0
- package/server/dist/db/migrations.js +199 -0
- package/server/dist/db.js +98 -196
- package/server/dist/errors.js +11 -0
- package/server/dist/git/browse.js +99 -0
- package/server/dist/git/ops.js +136 -19
- package/server/dist/git/repo.js +2 -1
- package/server/dist/history/claude.js +33 -20
- package/server/dist/history/index.js +17 -9
- package/server/dist/history/kiro.js +17 -12
- package/server/dist/history/lines.js +12 -0
- package/server/dist/history/opencode.js +18 -1
- package/server/dist/http/body.js +46 -0
- package/server/dist/http/errors.js +21 -0
- package/server/dist/http/guards.js +44 -0
- package/server/dist/http/router.js +24 -0
- package/server/dist/http/routes/agents.js +103 -0
- package/server/dist/http/routes/channel.js +16 -0
- package/server/dist/http/routes/colonies.js +9 -0
- package/server/dist/http/routes/connections.js +36 -0
- package/server/dist/http/routes/fs.js +22 -0
- package/server/dist/http/routes/git.js +90 -0
- package/server/dist/http/routes/meta.js +11 -0
- package/server/dist/http/routes/notebook.js +34 -0
- package/server/dist/http/routes/orchestration.js +32 -0
- package/server/dist/http/routes/resources.js +68 -0
- package/server/dist/http/routes/schedules.js +40 -0
- package/server/dist/http/routes/skills.js +47 -0
- package/server/dist/http/routes/terminals.js +18 -0
- package/server/dist/http/routes/types.js +36 -0
- package/server/dist/http/validate.js +65 -0
- package/server/dist/index.js +74 -4
- package/server/dist/instructions.js +23 -11
- package/server/dist/objects/agent.js +49 -0
- package/server/dist/objects/database.js +451 -0
- package/server/dist/objects/db-history.js +79 -0
- package/server/dist/objects/docker-info.js +75 -0
- package/server/dist/objects/docker.js +285 -0
- package/server/dist/objects/driver-props.js +196 -0
- package/server/dist/objects/exec.js +16 -0
- package/server/dist/objects/http-history.js +44 -0
- package/server/dist/objects/http-script.js +644 -0
- package/server/dist/objects/http.js +735 -0
- package/server/dist/objects/index.js +445 -0
- package/server/dist/objects/model.js +250 -0
- package/server/dist/objects/runner.js +211 -0
- package/server/dist/objects/stats.js +106 -0
- package/server/dist/objects/store.js +115 -0
- package/server/dist/objects/supervisor.js +111 -0
- package/server/dist/objects/templates.js +67 -0
- package/server/dist/providers/claude.js +5 -13
- package/server/dist/providers/index.js +7 -1
- package/server/dist/providers/kiro.js +4 -5
- package/server/dist/providers/opencode-server.js +164 -0
- package/server/dist/providers/opencode.js +60 -37
- package/server/dist/providers/preamble.js +2 -0
- package/server/dist/providers/spawn.js +31 -3
- package/server/dist/runtime.js +10 -7
- package/server/dist/schedules.js +222 -0
- package/server/dist/seed.js +15 -11
- package/server/dist/services/agents.js +90 -0
- package/server/dist/services/colonies.js +38 -0
- package/server/dist/services/connections.js +76 -0
- package/server/dist/services/notebook.js +22 -0
- package/server/dist/services/providers.js +27 -0
- package/server/dist/services/schedules.js +18 -0
- package/server/dist/sessions-summary.js +51 -0
- package/server/dist/skills/defaults.js +120 -0
- package/server/dist/skills/notebook.js +3 -8
- package/server/dist/terminals.js +177 -0
- package/server/dist/wake.js +149 -0
- package/server/dist/watch.js +201 -0
- package/server/mcp/dispatch.mjs +169 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/app-build-manifest.json +145 -85
- package/web/.next/app-path-routes-manifest.json +5 -2
- package/web/.next/build-manifest.json +14 -14
- package/web/.next/prerender-manifest.json +85 -37
- package/web/.next/react-loadable-manifest.json +26 -1
- package/web/.next/required-server-files.json +13 -1
- package/web/.next/routes-manifest.json +32 -0
- package/web/.next/server/app/_not-found/page.js +2 -2
- package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/server/app/_not-found.rsc +12 -11
- package/web/.next/server/app/agents/[id]/page.js +4 -4
- package/web/.next/server/app/agents/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agents/page.js +2 -2
- package/web/.next/server/app/agents/page.js.nft.json +1 -1
- package/web/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agents.html +1 -1
- package/web/.next/server/app/agents.rsc +14 -13
- package/web/.next/server/app/connections/page.js +2 -2
- package/web/.next/server/app/connections/page.js.nft.json +1 -1
- package/web/.next/server/app/connections/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/connections.html +1 -1
- package/web/.next/server/app/connections.rsc +14 -13
- package/web/.next/server/app/index.html +1 -1
- package/web/.next/server/app/index.rsc +14 -13
- package/web/.next/server/app/page.js +2 -2
- package/web/.next/server/app/page.js.nft.json +1 -1
- package/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/relations/page.js +2 -2
- package/web/.next/server/app/relations/page.js.nft.json +1 -1
- package/web/.next/server/app/relations/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/relations.html +1 -1
- package/web/.next/server/app/relations.rsc +14 -13
- package/web/.next/server/app/resources/[id]/page.js +2 -0
- package/web/.next/server/app/resources/[id]/page.js.nft.json +1 -0
- package/web/.next/server/app/resources/[id]/page_client-reference-manifest.js +1 -0
- package/web/.next/server/app/resources/page.js +2 -0
- package/web/.next/server/app/resources/page.js.nft.json +1 -0
- package/web/.next/server/app/resources/page_client-reference-manifest.js +1 -0
- package/web/.next/server/app/resources.html +1 -0
- package/web/.next/server/app/resources.meta +15 -0
- package/web/.next/server/app/resources.rsc +25 -0
- package/web/.next/server/app/schedules/page.js +2 -0
- package/web/.next/server/app/schedules/page.js.nft.json +1 -0
- package/web/.next/server/app/schedules/page_client-reference-manifest.js +1 -0
- package/web/.next/server/app/schedules.html +1 -0
- package/web/.next/server/app/schedules.meta +15 -0
- package/web/.next/server/app/schedules.rsc +25 -0
- package/web/.next/server/app/sessions/page.js +2 -2
- package/web/.next/server/app/sessions/page.js.nft.json +1 -1
- package/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/sessions.html +1 -1
- package/web/.next/server/app/sessions.rsc +14 -13
- package/web/.next/server/app/skills/page.js +2 -2
- 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/skills.html +1 -1
- package/web/.next/server/app/skills.rsc +14 -13
- package/web/.next/server/app/types/page.js +2 -2
- package/web/.next/server/app/types/page.js.nft.json +1 -1
- package/web/.next/server/app/types/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/types.html +1 -1
- package/web/.next/server/app/types.rsc +14 -13
- package/web/.next/server/app-paths-manifest.json +5 -2
- package/web/.next/server/chunks/143.js +1 -1
- package/web/.next/server/chunks/274.js +1 -0
- package/web/.next/server/chunks/306.js +1 -0
- package/web/.next/server/chunks/423.js +1 -0
- package/web/.next/server/chunks/505.js +6 -0
- package/web/.next/server/chunks/555.js +1 -0
- package/web/.next/server/chunks/612.js +1 -0
- package/web/.next/server/chunks/638.js +1 -0
- package/web/.next/server/chunks/692.js +18 -0
- package/web/.next/server/chunks/716.js +2 -0
- package/web/.next/server/chunks/790.js +11 -0
- package/web/.next/server/chunks/802.js +1 -0
- package/web/.next/server/chunks/890.js +1 -1
- package/web/.next/server/chunks/919.js +1 -0
- package/web/.next/server/chunks/950.js +6 -0
- package/web/.next/server/middleware-build-manifest.js +1 -1
- package/web/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/web/.next/server/next-font-manifest.js +1 -1
- package/web/.next/server/next-font-manifest.json +1 -1
- package/web/.next/server/pages/404.html +1 -1
- package/web/.next/server/pages/500.html +1 -1
- package/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/static/chunks/0937d497-114a2a3de515565e.js +1 -0
- package/web/.next/static/chunks/176-aeaf907a6ea5627d.js +1 -0
- package/web/.next/static/chunks/291-efae53ea5f7ee92d.js +1 -0
- package/web/.next/static/chunks/2b9ff8ee-969e65cc354b2150.js +1 -0
- package/web/.next/static/chunks/30-9adcbe92b15a6815.js +1 -0
- package/web/.next/static/chunks/316-26da9cc233ba7557.js +1 -0
- package/web/.next/static/chunks/350-56599dc3bf06066d.js +1 -0
- package/web/.next/static/chunks/486-13e08542f3a1cbac.js +1 -0
- package/web/.next/static/chunks/491-6b4e6201f5110dff.js +1 -0
- package/web/.next/static/chunks/517-ccaf8cc5c733cbd8.js +1 -0
- package/web/.next/static/chunks/545.bfbd92b7632c09de.js +1 -0
- package/web/.next/static/chunks/{805-d946ebedb7e85f73.js → 562-7c2e33d838e869bf.js} +1 -1
- package/web/.next/static/chunks/581-3ad5c4343dad3f50.js +1 -0
- package/web/.next/static/chunks/586-f7017d585a84738d.js +1 -0
- package/web/.next/static/chunks/657.b4c39e676c3e20dc.js +1 -0
- package/web/.next/static/chunks/701.6abcaf5e60463eef.js +6 -0
- package/web/.next/static/chunks/705-a16e1fe09be1ac7f.js +1 -0
- package/web/.next/static/chunks/706-fa2be0f10ffebe6a.js +1 -0
- package/web/.next/static/chunks/837-33c7480524f48577.js +1 -0
- package/web/.next/static/chunks/839-23c5508622fae942.js +1 -0
- package/web/.next/static/chunks/844-fe55292e0701f436.js +1 -0
- package/web/.next/static/chunks/89-b194fcffe5120c44.js +1 -0
- package/web/.next/static/chunks/97.594543c2196de524.js +1 -0
- package/web/.next/static/chunks/app/_not-found/page-238a7b80bda6b4ae.js +1 -0
- package/web/.next/static/chunks/app/agents/[id]/page-4af6c246c4ca7a97.js +1 -0
- package/web/.next/static/chunks/app/agents/page-f4c4c80f955f3967.js +1 -0
- package/web/.next/static/chunks/app/connections/page-0936beaf02d863c6.js +1 -0
- package/web/.next/static/chunks/app/layout-87ebb70bd9cb8443.js +1 -0
- package/web/.next/static/chunks/app/page-a7f292117b7d76bf.js +1 -0
- package/web/.next/static/chunks/app/relations/page-fba25393c8688714.js +1 -0
- package/web/.next/static/chunks/app/resources/[id]/page-d110d89bb8b5fca7.js +1 -0
- package/web/.next/static/chunks/app/resources/page-bbd0b450d3f3131d.js +1 -0
- package/web/.next/static/chunks/app/schedules/page-a1124397fc760413.js +1 -0
- package/web/.next/static/chunks/app/sessions/page-0e322811b0cde724.js +1 -0
- package/web/.next/static/chunks/app/skills/page-22ea0ef89d9f7a13.js +1 -0
- package/web/.next/static/chunks/app/types/page-18c4e1db2724d41d.js +1 -0
- package/web/.next/static/chunks/fcafe1ac.366e4950d3b0d4b7.js +18 -0
- package/web/.next/static/chunks/framework-bbac72adbbe2d328.js +1 -0
- package/web/.next/static/chunks/main-app-6086068e5fb5eacd.js +1 -0
- package/web/.next/static/chunks/main-c15f3fee674e0303.js +1 -0
- package/web/.next/static/chunks/pages/_app-d1670a2c6ce392fc.js +1 -0
- package/web/.next/static/chunks/pages/_error-95aac014d202fa7a.js +1 -0
- package/web/.next/static/chunks/webpack-ef515e41a83a16ac.js +1 -0
- package/web/.next/static/css/945795da867f5250.css +1 -0
- package/web/.next/static/css/dd4e32c285f75776.css +1 -0
- package/web/.next/static/p4S3i9kvO359GW91DQiHu/_buildManifest.js +1 -0
- package/web/.next/trace +29 -23
- package/web/.next/types/app/resources/[id]/page.ts +84 -0
- package/web/.next/types/app/resources/page.ts +84 -0
- package/web/.next/types/app/schedules/page.ts +84 -0
- package/web/.next/types/routes.d.ts +7 -2
- package/web/.next/types/validator.ts +27 -0
- package/web/next.config.mjs +4 -0
- package/web/.next/server/chunks/149.js +0 -11
- package/web/.next/server/chunks/247.js +0 -1
- package/web/.next/server/chunks/851.js +0 -1
- package/web/.next/server/chunks/932.js +0 -2
- package/web/.next/static/84BpRSahg2BTwk3mX6AG8/_buildManifest.js +0 -1
- package/web/.next/static/chunks/0937d497-44abb0f9355ace92.js +0 -1
- package/web/.next/static/chunks/2b9ff8ee-c3b61ac1e608c57d.js +0 -1
- package/web/.next/static/chunks/351-65da8c1a6e25f93b.js +0 -1
- package/web/.next/static/chunks/463-6ae35cdefdc59169.js +0 -1
- package/web/.next/static/chunks/493-92266798be872b8f.js +0 -1
- package/web/.next/static/chunks/517-eb26c72f6059aa26.js +0 -1
- package/web/.next/static/chunks/657.f1e03b7b65eba1d9.js +0 -1
- package/web/.next/static/chunks/687-3a4205f51be38602.js +0 -1
- package/web/.next/static/chunks/837-fd7623601dc78ed8.js +0 -1
- package/web/.next/static/chunks/850-318f32484989dd59.js +0 -1
- package/web/.next/static/chunks/89-ace2e1aa63babfdf.js +0 -1
- package/web/.next/static/chunks/951-e250b541b67da7ce.js +0 -1
- package/web/.next/static/chunks/app/_not-found/page-bbd54d7b9a55d7ae.js +0 -1
- package/web/.next/static/chunks/app/agents/[id]/page-5eaf094fec246f1b.js +0 -1
- package/web/.next/static/chunks/app/agents/page-e9b17f1c3439ef98.js +0 -1
- package/web/.next/static/chunks/app/connections/page-c6afd90abd82d47a.js +0 -1
- package/web/.next/static/chunks/app/layout-c415d5a847cd94b3.js +0 -1
- package/web/.next/static/chunks/app/page-6fc87fc5a128a204.js +0 -1
- package/web/.next/static/chunks/app/relations/page-0355a93a8eb67989.js +0 -1
- package/web/.next/static/chunks/app/sessions/page-beae9a74a07d69e0.js +0 -1
- package/web/.next/static/chunks/app/skills/page-4f839ac913e26d32.js +0 -1
- package/web/.next/static/chunks/app/types/page-4f6b99af3232f861.js +0 -1
- package/web/.next/static/chunks/framework-0e68884e76d9a8d3.js +0 -1
- package/web/.next/static/chunks/main-app-d6f73ccd41f325c5.js +0 -1
- package/web/.next/static/chunks/main-cd22509db15764e2.js +0 -1
- package/web/.next/static/chunks/pages/_app-0f75d689c738a6fc.js +0 -1
- package/web/.next/static/chunks/pages/_error-d481f6d49fb4455d.js +0 -1
- package/web/.next/static/chunks/webpack-d40de72e52f65f79.js +0 -1
- package/web/.next/static/css/abe1a6216491f944.css +0 -1
- /package/web/.next/static/{84BpRSahg2BTwk3mX6AG8 → p4S3i9kvO359GW91DQiHu}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[969],{6054:(e,s,t)=>{Promise.resolve().then(t.bind(t,7464))},7464:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>sQ});var a=t(4799),n=t(9128),l=t(4023),i=t(1463),c=t.n(i),r=t(3624),o=t(6534),d=t(5406),h=t(2098),u=t(8228),m=t(4910),g=t(8449),x=t(7541),p=t(8538),j=t(3749),f=t(7890),b=t(6458),v=t(3983),N=t(4214),y=t(4611),k=t(8089),w=t(352),C=t(6325),S=t(9141),A=t(991),z=t(5014),M=t(8180),E=t(632),F=t(969),R=t(7697),P=t(8853),_=t(4713);let T=/^\[hive:channel\] (.+?) · Place: (.+?) · Thread: (.+?) · From: (.+?)((?: · (?:Addressed|Muted): \w+)*)\nMessage:\n([\s\S]*)$/,I="\n\n[hive:context]\n",L="\n\n[hive:files]\n";var D=t(9654);function W(e){let{text:s}=e,{t}=(0,D.s9)(),n=function(e){let s=T.exec(e);if(!s)return null;let[t,...a]=s[6].split(I),[n,...l]=t.split(L),i=l.join(L).split("\n").flatMap(e=>{let s=/^- (.+) \(([^()]*)\)$/.exec(e);return s?[{path:s[1],name:s[1].replace(/^.*[\\/]/,"").replace(/^\d+-\d+-/,""),detail:s[2]}]:[]});return{platform:s[1],place:s[2],thread:s[3],from:s[4],body:n,files:i,overheard:/Addressed: no/.test(s[5]),muted:/Muted: yes/.test(s[5]),context:a.join(I)}}(s);return n?(0,a.jsx)("div",{className:"msg user",children:(0,a.jsxs)("div",{className:"bubble channel",children:[(0,a.jsxs)("div",{className:"chhead",children:[(0,a.jsx)(R.A,{size:12,"aria-hidden":!0}),(0,a.jsx)("b",{children:n.platform}),(0,a.jsx)("span",{children:n.place}),n.overheard&&(0,a.jsxs)("span",{className:"chtag",title:t("chat.channel.overheard.hint"),children:[(0,a.jsx)(P.A,{size:11,"aria-hidden":!0}),t("chat.channel.overheard")]}),(0,a.jsx)("span",{className:"chfrom",children:n.from.replace(/\s*\(.*\)$/,"")})]}),(0,a.jsx)("div",{className:"chbody",children:n.body}),n.files.length>0&&(0,a.jsx)("div",{className:"chfiles",children:n.files.map(e=>(0,a.jsxs)("span",{className:"chfile",title:e.path,children:[(0,a.jsx)(_.A,{size:11,"aria-hidden":!0}),e.name,(0,a.jsx)("i",{children:e.detail.split(", ").pop()})]},e.path))}),n.context&&(0,a.jsxs)("details",{className:"chctx",children:[(0,a.jsx)("summary",{children:t("chat.channel.context",{n:n.context.split("\n").filter(e=>e.startsWith("- ")).length})}),(0,a.jsx)("pre",{children:n.context.replace(/^[^\n]*\n/,"")})]})]})}):(0,a.jsx)("div",{className:"msg user",children:(0,a.jsx)("div",{className:"bubble",children:s})})}var O=t(6072);function q(e){var s,t,n;let{m:l}=e,{t:i}=(0,D.s9)(),c=null==(s=l.meta)?void 0:s.usage,r=l.blocks.filter(e=>"tool"===e.type).length;if(!c&&!l.durationMs&&!r)return null;let o=(0,O.RP)(c);return(0,a.jsxs)("div",{className:"replymeta",children:[(null==(t=l.meta)?void 0:t.model)&&(0,a.jsx)("span",{className:"mono",children:l.meta.model.replace(/^claude-/,"").replace(/-\d{8}$/,"")}),o>0&&(0,a.jsxs)("span",{title:c?i("chat.tokenDetail",{input:c.input,output:c.output,cacheRead:c.cacheRead,cacheWrite:c.cacheWrite}):"",children:[(0,a.jsx)(N.A,{size:12}),i("chat.inOut",{in:(0,O.yj)(c.input+c.cacheRead+c.cacheWrite),out:(0,O.yj)(c.output)})]}),(null==c?void 0:c.credits)?(0,a.jsxs)("span",{children:[(0,a.jsx)(y.A,{size:12}),i("chat.credits",{value:c.credits.toFixed(2)})]}):null,(null==(n=l.meta)?void 0:n.cost)!==void 0&&(0,a.jsxs)("span",{title:i(l.meta.costEstimated?"stats.costEstimated":"stats.costReported"),children:[(0,a.jsx)(y.A,{size:12}),l.meta.costEstimated?"≈ ":"",(0,O.F0)(l.meta.cost)]}),r>0&&(0,a.jsxs)("span",{children:[(0,a.jsx)(k.A,{size:12}),i("chat.tools",{count:r})]}),l.durationMs?(0,a.jsxs)("span",{children:[(0,a.jsx)(w.A,{size:12}),(0,O.nc)(l.durationMs)]}):null]})}function K(e){var s,t,n,i,c;let{turn:r}=e,{t:o}=(0,D.s9)(),[,d]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=setInterval(()=>d(e=>e+1),500);return()=>clearInterval(e)},[]);let h=r.usage,u=r.blocks.filter(e=>"tool"===e.type).length;return(0,a.jsxs)("div",{className:"replymeta live",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)(w.A,{size:12}),(0,O.nc)(Date.now()-r.startedAt)]}),u>0&&(0,a.jsxs)("span",{children:[(0,a.jsx)(k.A,{size:12}),o("chat.tools",{count:u})]}),h&&(null!=(s=h.output)?s:0)>0&&(0,a.jsxs)("span",{children:[(0,a.jsx)(N.A,{size:12}),o("chat.inOut",{in:(0,O.yj)((null!=(t=h.input)?t:0)+(null!=(n=h.cacheRead)?n:0)+(null!=(i=h.cacheWrite)?i:0)),out:(0,O.yj)(null!=(c=h.output)?c:0)})]}),(null==h?void 0:h.contextPct)!==void 0&&(0,a.jsx)("span",{children:o("chat.contextPct",{pct:h.contextPct.toFixed(1)})})]})}let U=(0,l.memo)(function(e){let{text:s}=e;return(0,a.jsx)("div",{className:"md",children:(0,a.jsx)(b.oz,{remarkPlugins:[v.A],children:s})})}),$=(0,l.memo)(function(e){let{blocks:s,streaming:t}=e,{t:n}=(0,D.s9)();return(0,a.jsxs)(a.Fragment,{children:[s.map((e,l)=>"text"===e.type?(0,a.jsx)(U,{text:e.text},l):"thinking"===e.type?(0,a.jsxs)("details",{className:"fold think",children:[(0,a.jsxs)("summary",{children:[(0,a.jsx)(C.A,{size:14}),t&&l===s.length-1?n("activity.thinking"):n("chat.thought"),(0,a.jsx)(S.A,{size:14,className:"chev"})]}),(0,a.jsx)("pre",{children:e.text})]},l):(0,a.jsx)(F.Dm,{tool:e,streaming:t},l)),(0,a.jsx)(F.Kt,{blocks:s})]})}),H=(0,l.memo)(function(e){let{msgs:s,agent:t}=e;(0,D.s9)();let n=(0,l.useMemo)(()=>(function(e){let s=[],t=null;for(let n of e){var a;let e;if("user"===n.role){t=n.ts,s.push(n);continue}let l=s[s.length-1],i=(e,s)=>{var t,a,n,l,i,c,r;if(!e)return s;if(!s)return e;let o=e.usage,d=s.usage;return{model:null!=(t=s.model)?t:e.model,endTs:null!=(a=s.endTs)?a:e.endTs,cost:void 0!==e.cost||void 0!==s.cost?(null!=(n=e.cost)?n:0)+(null!=(l=s.cost)?l:0):void 0,costEstimated:e.costEstimated||s.costEstimated,usage:o&&d?{input:o.input+d.input,output:o.output+d.output,cacheRead:o.cacheRead+d.cacheRead,cacheWrite:o.cacheWrite+d.cacheWrite,reasoning:o.reasoning+d.reasoning,credits:(null!=(i=o.credits)?i:0)+(null!=(c=d.credits)?c:0)||void 0,contextPct:null!=(r=d.contextPct)?r:o.contextPct}:null!=o?o:d}};(null==l?void 0:l.role)==="assistant"?(e={...l,blocks:[...l.blocks,...n.blocks],meta:i(l.meta,n.meta)},s[s.length-1]=e):(e={...n},s.push(e));let c=null==(a=e.meta)?void 0:a.endTs;e.durationMs=t&&c?Math.max(0,c-t):void 0}return s})(s),[s]);return(0,a.jsx)(a.Fragment,{children:n.map(e=>"user"===e.role?(0,a.jsx)(W,{text:e.blocks.map(e=>"text"===e.type?e.text:"").join("")},e.id):(0,a.jsxs)("div",{className:"msg assistant",children:[(0,a.jsxs)("div",{className:"who",children:[(0,a.jsx)(E._h,{agent:t,size:"sm"}),t.name,(0,a.jsx)("span",{className:"stamp",children:e.ts?(0,f.KN)(e.ts):""})]}),(0,a.jsx)($,{blocks:e.blocks}),(0,a.jsx)(q,{m:e})]},e.id))})},(e,s)=>e.msgs===s.msgs&&e.agent.name===s.agent.name&&e.agent.provider===s.agent.provider&&e.agent.role===s.agent.role),B=(0,l.memo)(function(e){let{name:s,running:t,queued:n,readOnly:i,onSend:c,onStop:r,toolsOpen:o,onToggleTools:d}=e,{t:h}=(0,D.s9)(),[u,m]=(0,l.useState)(""),g=(0,l.useRef)(null),x=()=>{let e=g.current;e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")},p=async()=>{let e=u.trim();e&&(m(""),requestAnimationFrame(x),await c(e)||(m(e),requestAnimationFrame(x)))};return(0,a.jsxs)("div",{className:"composer",children:[i?(0,a.jsx)("div",{className:"composer-box",style:{justifyContent:"space-between",alignItems:"center"},children:(0,a.jsx)("span",{className:"muted",children:h("chat.readOnly")})}):(0,a.jsxs)("div",{className:"composer-box",children:[(0,a.jsx)("textarea",{ref:g,rows:1,value:u,placeholder:t?h("chat.queuePlaceholder"):h("chat.placeholder",{name:s}),"aria-label":h("chat.messageLabel"),onChange:e=>{m(e.target.value),x()},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),p())}}),t&&(0,a.jsxs)("button",{className:"btn",onClick:r,"aria-label":h("chat.stop"),children:[(0,a.jsx)(A.A,{size:14,fill:"currentColor"}),h("chat.stop")]}),(0,a.jsx)("button",{className:"btn primary icon",onClick:()=>void p(),disabled:!u.trim(),"aria-label":h("chat.send"),children:(0,a.jsx)(z.A,{size:18})})]}),(0,a.jsxs)("div",{className:"composer-meta",children:[(0,a.jsx)("span",{children:h("chat.keys")}),(0,a.jsx)("button",{type:"button",className:"linkbtn",onClick:d,children:h(o?"chat.collapseTools":"chat.expandTools")}),n>0&&(0,a.jsx)("span",{children:h("queue.count",{count:n})})]})]})});function G(e){var s,t,n,i;let{agent:c,sessionOverride:r}=e,{t:o}=(0,D.s9)(),{live:d,finished:h,clearLive:u,agents:m}=(0,p.o0)(),g=(0,E.dj)(),[f,b]=(0,l.useState)([]),[v,N]=(0,l.useState)(!1),[y,k]=(0,l.useState)(null),[w,C]=(0,l.useState)(null),S=(0,l.useRef)(null),A=(0,l.useRef)(!0),z=d[c.id],R="running"===c.status||!!z,P=void 0!==r&&r!==c.session_id,_=(0,l.useCallback)(()=>{let e=P?r:c.session_id;return e?j.F.get("/agents/".concat(c.id,"/history?session=").concat(encodeURIComponent(e))).then(e=>{b(e.messages),N(!0)}).catch(e=>{g(e.message,"err"),N(!0)}):(b([]),N(!0),Promise.resolve())},[c.id,c.session_id,P,r,g]);(0,l.useEffect)(()=>{N(!1),_()},[_]);let T=null!=(t=h[c.id])?t:0;(0,l.useEffect)(()=>{T&&_().then(()=>k(null))},[T]),(0,l.useEffect)(()=>{let e=S.current,s=null==e?void 0:e.firstElementChild;if(!e||!s)return;let t=()=>{A.current&&(e.scrollTop=e.scrollHeight)},a=new ResizeObserver(t);return a.observe(s),t(),()=>a.disconnect()},[v,c.id]);let I=(0,l.useCallback)(async e=>{if(P)return!1;k(e),A.current=!0;try{return await j.F.post("/agents/".concat(c.id,"/messages"),{prompt:e}),!0}catch(e){return k(null),g(e instanceof Error?e.message:o("chat.sendFailed"),"err"),!1}},[c.id,P,g,o]),L=(0,l.useCallback)(()=>{j.F.post("/agents/".concat(c.id,"/stop")).catch(()=>void 0)},[c.id]),O=(0,l.useCallback)(()=>C(e=>!e),[]),q=y&&!f.some(e=>"user"===e.role&&e.blocks.some(e=>"text"===e.type&&e.text.trim()===y)),U=v&&!f.length&&!z&&!y;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(F.Qh.Provider,{value:w,children:(0,a.jsx)("div",{className:"thread",ref:S,onWheel:e=>{e.deltaY<0&&(A.current=!1)},onScroll:e=>{let s=e.currentTarget;s.scrollHeight-s.scrollTop-s.clientHeight<40&&(A.current=!0)},children:(0,a.jsxs)("div",{className:"thread-inner",children:[U&&(0,a.jsxs)("div",{className:"empty",style:{marginTop:40},children:[(0,a.jsx)(E._h,{agent:c,size:"lg"}),(0,a.jsx)("h3",{children:o("chat.empty.title",{name:c.name})}),(0,a.jsx)("p",{children:"orchestrator"===c.role?o("chat.empty.orchestrator"):o("chat.empty.worker")})]}),(0,a.jsx)(H,{msgs:f,agent:c}),q&&!(null==z?void 0:z.prompt)&&(0,a.jsx)(W,{text:null!=y?y:""}),z&&(0,a.jsxs)(a.Fragment,{children:["dispatch"===z.source?(0,a.jsxs)("div",{className:"delegation-card",children:[(0,a.jsxs)("div",{className:"head",children:[(0,a.jsx)(x.A,{size:14}),o("chat.delegatedFrom",{name:null!=(n=null==(s=m.find(e=>e.id===z.from))?void 0:s.name)?n:o("chat.anOrchestrator")})]}),(0,a.jsx)("p",{children:z.prompt}),(0,a.jsx)("span",{className:"hint",children:o("chat.delegatedNote")})]}):!f.some(e=>"user"===e.role&&e.blocks.some(e=>"text"===e.type&&e.text.trim()===z.prompt.trim()))&&(0,a.jsx)(W,{text:z.prompt}),(0,a.jsxs)("div",{className:"msg assistant",children:[(0,a.jsxs)("div",{className:"who",children:[(0,a.jsx)(E._h,{agent:c,size:"sm"}),c.name]}),(0,a.jsx)($,{blocks:z.blocks,streaming:!0}),!z.error&&(0,a.jsxs)("span",{className:"typing","aria-label":o("common.working"),children:[(0,a.jsx)("i",{}),(0,a.jsx)("i",{}),(0,a.jsx)("i",{})]}),(0,a.jsx)(K,{turn:z}),z.error&&(0,a.jsxs)("div",{className:"banner err",children:[(0,a.jsx)(M.A,{size:16}),(0,a.jsx)("div",{className:"grow",children:(0,D.YF)(z.error)}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>u(c.id),children:o("common.dismiss")})]})]})]})]})})}),(0,a.jsx)(B,{name:c.name,running:R,queued:null!=(i=c.queued)?i:0,readOnly:P,onSend:I,onStop:L,toolsOpen:w,onToggleTools:O})]})}var Q=t(4738),Y=t(9718),J=t(2349);function X(e){var s,t,n,i,c,r,o,d,h,u,m;let{agent:g,session:x}=e,{t:f}=(0,D.s9)(),{finished:b,live:v}=(0,p.o0)(),[C,S]=(0,l.useState)(null),[A,z]=(0,l.useState)(!1),M=null!=(s=b[g.id])?s:0,E=v[g.id];if((0,l.useEffect)(()=>{if(!g.session_id&&!x)return void S(null);j.F.get("/agents/".concat(g.id,"/stats").concat(x?"?session=".concat(encodeURIComponent(x)):"")).then(S).catch(()=>void 0)},[g.id,g.session_id,x,M]),!C||0===C.turns&&!E)return null;let F=null==E?void 0:E.usage,R=(0,O.RP)(C.usage)+(F?(0,O.RP)({input:null!=(t=F.input)?t:0,output:null!=(n=F.output)?n:0,cacheRead:null!=(i=F.cacheRead)?i:0,cacheWrite:null!=(c=F.cacheWrite)?c:0}):0),P=(null!=(r=C.cost)?r:0)+(null!=(o=null==E?void 0:E.cost)?o:0),_=(null!=(d=C.usage.credits)?d:0)+(null!=(h=null==F?void 0:F.credits)?h:0),T=null!=(m=null!=(u=null==F?void 0:F.contextPct)?u:C.contextPct)?m:C.lastContext?Math.min(100,C.lastContext/2e5*100):null,I=null!==C.cost||(null==E?void 0:E.cost)!==void 0,L=C.usage,W=Math.max(1,L.input+L.output+L.cacheRead+L.cacheWrite),q=Math.max(1,...C.tools.map(e=>e.count)),K=Math.max(1,...C.timeline.map(e=>e.tokens));return(0,a.jsxs)("div",{className:"stats-wrap",children:[(0,a.jsxs)("button",{className:"statsbar",onClick:()=>z(e=>!e),"aria-expanded":A,children:[(0,a.jsxs)("span",{className:"sb",title:f("stats.contextTitle"),children:[(0,a.jsx)(Q.A,{size:14}),(0,a.jsx)("b",{children:null!==T?"".concat(T.toFixed(+(T<10)),"%"):(0,O.yj)(C.lastContext)}),f("stats.context")]}),(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(N.A,{size:14}),(0,a.jsx)("b",{children:(0,O.yj)(R)}),f("stats.tokens")]}),_>0&&(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(y.A,{size:14}),(0,a.jsx)("b",{children:_.toFixed(2)}),f("stats.credits")]}),I&&(0,a.jsxs)("span",{className:"sb",title:C.costEstimated?f("stats.costEstimated"):f("stats.costReported"),children:[(0,a.jsx)(y.A,{size:14}),(0,a.jsxs)("b",{children:[C.costEstimated?"≈ ":"",(0,O.F0)(P)]})]}),(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(Y.A,{size:14}),(0,a.jsx)("b",{children:C.turns}),f("stats.turns",{count:C.turns})]}),(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(k.A,{size:14}),(0,a.jsx)("b",{children:C.toolCalls}),f("stats.toolCalls",{count:C.toolCalls}),C.toolErrors>0&&(0,a.jsxs)("em",{className:"tbad",children:[" \xb7 ",f("stats.failed",{count:C.toolErrors})]})]}),C.durationMs>0&&(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(w.A,{size:14}),(0,a.jsx)("b",{children:(0,O.nc)(C.durationMs)}),f("stats.working")]}),(0,a.jsx)(J.A,{size:15,className:"chev2 ".concat(A?"open":"")})]}),A&&(0,a.jsxs)("div",{className:"statspanel",children:[(0,a.jsxs)("section",{children:[(0,a.jsx)("div",{className:"eyebrow",children:f("stats.mix")}),(0,a.jsxs)("div",{className:"mixbar",role:"img","aria-label":f("stats.mix"),children:[(0,a.jsx)("i",{style:{width:"".concat(L.cacheRead/W*100,"%"),background:"var(--p-opencode)"}}),(0,a.jsx)("i",{style:{width:"".concat(L.cacheWrite/W*100,"%"),background:"var(--p-kiro)"}}),(0,a.jsx)("i",{style:{width:"".concat(L.input/W*100,"%"),background:"var(--honey)"}}),(0,a.jsx)("i",{style:{width:"".concat(L.output/W*100,"%"),background:"var(--p-claude)"}})]}),(0,a.jsxs)("dl",{className:"legend",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("i",{style:{background:"var(--p-opencode)"}}),(0,a.jsx)("dt",{children:f("stats.cacheRead")}),(0,a.jsx)("dd",{children:(0,O.yj)(L.cacheRead)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("i",{style:{background:"var(--p-kiro)"}}),(0,a.jsx)("dt",{children:f("stats.cacheWrite")}),(0,a.jsx)("dd",{children:(0,O.yj)(L.cacheWrite)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("i",{style:{background:"var(--honey)"}}),(0,a.jsx)("dt",{children:f("stats.input")}),(0,a.jsx)("dd",{children:(0,O.yj)(L.input)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("i",{style:{background:"var(--p-claude)"}}),(0,a.jsx)("dt",{children:f("stats.output")}),(0,a.jsxs)("dd",{children:[(0,O.yj)(L.output),L.reasoning>0&&(0,a.jsxs)("span",{className:"muted",children:[" (",f("stats.thinking",{tokens:(0,O.yj)(L.reasoning)}),")"]})]})]})]}),C.models.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"eyebrow",style:{marginTop:14},children:f("stats.models")}),C.models.map(e=>(0,a.jsxs)("div",{className:"row small",style:{justifyContent:"space-between"},children:[(0,a.jsx)("span",{className:"mono",children:e.model}),(0,a.jsx)("span",{className:"muted",children:f("stats.modelLine",{count:e.messages,out:(0,O.yj)(e.output)})})]},e.model))]})]}),(0,a.jsxs)("section",{children:[(0,a.jsxs)("div",{className:"eyebrow",children:[f("stats.toolsUsed")," ",C.toolTimeMs>0&&(0,a.jsxs)("span",{className:"muted",children:["\xb7 ",f("stats.totalTime",{time:(0,O.nc)(C.toolTimeMs)})]})]}),0===C.tools.length?(0,a.jsx)("p",{className:"muted small",style:{margin:"6px 0 0"},children:f("stats.noTools")}):C.tools.slice(0,9).map(e=>(0,a.jsxs)("div",{className:"toolrow",title:f("stats.toolTitle",{count:e.count,time:(0,O.nc)(e.totalMs)}),children:[(0,a.jsx)("span",{className:"mono tn",children:e.name.replace(/^mcp__/,"").replace("__"," \xb7 ")}),(0,a.jsx)("span",{className:"tbar",children:(0,a.jsx)("i",{style:{width:"".concat(e.count/q*100,"%")}})}),(0,a.jsxs)("span",{className:"tc",children:[e.count,e.errors>0&&(0,a.jsxs)("em",{className:"tbad",children:[" (",e.errors,"✗)"]})]}),(0,a.jsx)("span",{className:"td muted",children:e.totalMs?(0,O.nc)(e.totalMs/e.count):""})]},e.name))]}),(0,a.jsxs)("section",{style:{gridColumn:"1 / -1"},children:[(0,a.jsx)("div",{className:"eyebrow",children:f("stats.perTurn")}),(0,a.jsx)("div",{className:"spark",role:"list",children:C.timeline.slice(-40).map((e,s)=>(0,a.jsx)("div",{className:"sbar",role:"listitem",title:"".concat(e.prompt||f("stats.promptFallback"),"\n").concat(f("stats.turnLine",{tokens:(0,O.yj)(e.tokens),tools:e.tools,time:(0,O.nc)(e.durationMs)})).concat(null!==e.cost?" \xb7 ".concat((0,O.F0)(e.cost)):""),children:(0,a.jsx)("i",{style:{height:"".concat(Math.max(4,e.tokens/K*100),"%")}})},s))})]})]})]})}var V=t(3974),Z=t(8330),ee=t(2947),es=t(8311),et=t(2942),ea=t(5372),en=t(1517);function el(e){let{activeId:s,collapsed:t=!1,onToggle:n}=e,{t:i}=(0,D.s9)(),{agents:r,colonies:o,live:d}=(0,p.o0)(),h=(0,ea.z)(),[u,m]=(0,l.useState)(""),[g,x]=(0,l.useState)(!1),j=(0,l.useMemo)(()=>{let e=e=>!u||"".concat(e.name," ").concat(e.description," ").concat(e.provider," ").concat(e.model).toLowerCase().includes(u.toLowerCase()),s=o.map(s=>({key:s.id,name:s.name,color:s.color||"var(--honey)",items:r.filter(t=>t.colony_id===s.id&&e(t))}));return s.push({key:"free",name:i("common.noColony"),color:null,items:r.filter(s=>(!s.colony_id||!o.some(e=>e.id===s.colony_id))&&e(s))}),s.filter(e=>e.items.length)},[r,o,u,i]),b=n&&(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:n,"aria-label":t?i("switcher.expand"):i("switcher.collapse"),title:t?i("switcher.expand"):i("switcher.collapse"),"aria-expanded":!t,children:t?(0,a.jsx)(V.A,{size:17}):(0,a.jsx)(Z.A,{size:17})});return t?(0,a.jsxs)("aside",{className:"switcher mini","aria-label":i("nav.agents"),children:[(0,a.jsxs)("div",{className:"switcher-head",children:[b,(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>x(!0),"aria-label":i("newAgent.title"),title:i("newAgent.title"),children:(0,a.jsx)(ee.A,{size:16})})]}),(0,a.jsx)("div",{className:"switcher-list",children:j.map(e=>(0,a.jsxs)("div",{className:"mini-group",children:[(0,a.jsx)("div",{className:"mini-sep",title:"".concat(e.name," \xb7 ").concat(e.items.length),style:e.color?{"--c":e.color}:void 0}),e.items.map(e=>(0,a.jsx)(c(),{href:"/agents/".concat(e.id),className:"sw-item mini","aria-current":e.id===s?"page":void 0,"aria-label":e.name,...h.bind(e.id),children:(0,a.jsxs)("span",{className:"sw-av",children:[(0,a.jsx)(E._h,{agent:e}),"idle"!==e.status&&(0,a.jsx)("i",{className:"pip ".concat("error"===e.status?"err":"")})]})},e.id))]},e.key))}),g&&(0,a.jsx)(en.b,{onClose:()=>x(!1)}),h.node]}):(0,a.jsxs)("aside",{className:"switcher","aria-label":i("nav.agents"),children:[(0,a.jsxs)("div",{className:"switcher-head",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("b",{style:{fontFamily:"var(--font-display)",fontSize:16},className:"grow",children:i("nav.agents")}),b,(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>x(!0),"aria-label":i("newAgent.title"),children:(0,a.jsx)(ee.A,{size:16})})]}),(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(es.A,{size:15}),(0,a.jsx)("input",{className:"input",placeholder:i("switcher.find"),value:u,onChange:e=>m(e.target.value),"aria-label":i("switcher.find")})]})]}),(0,a.jsxs)("div",{className:"switcher-list",children:[0===j.length&&(0,a.jsx)("p",{className:"muted small",style:{padding:16},children:i("switcher.noMatch",{query:u})}),j.map(e=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"switcher-group",children:[e.color&&(0,a.jsx)("i",{className:"cdot",style:{background:e.color}}),e.name,(0,a.jsx)("span",{children:e.items.length})]}),e.items.map(e=>{let t=(0,et.E)(d[e.id]);return(0,a.jsxs)(c(),{href:"/agents/".concat(e.id),className:"sw-item","aria-current":e.id===s?"page":void 0,...h.bind(e.id),children:[(0,a.jsxs)("span",{className:"sw-av",children:[(0,a.jsx)(E._h,{agent:e}),"idle"!==e.status&&(0,a.jsx)("i",{className:"pip ".concat("error"===e.status?"err":"")})]}),(0,a.jsxs)("span",{className:"sw-body",children:[(0,a.jsxs)("span",{className:"sw-top",children:[(0,a.jsx)("b",{children:e.name}),"orchestrator"===e.role&&(0,a.jsx)("em",{children:i("role.orchestrator")})]}),(0,a.jsx)("span",{className:"sw-sub ".concat(t?"live":e.description?"":"blank"),children:null!=t?t:"error"===e.status?i("status.error"):e.description||i("switcher.noDescription")}),(0,a.jsxs)("span",{className:"sw-meta",children:[(0,a.jsx)("i",{style:{background:f.xq[e.provider].color}}),f.xq[e.provider].short,e.model?" \xb7 ".concat(e.model):"",(0,a.jsx)("span",{className:"sw-ago",children:e.queued&&e.queued>0?i("queue.count",{count:e.queued}):(0,f.KN)(e.updated_at)})]})]})]},e.id)})]},e.key))]}),g&&(0,a.jsx)(en.b,{onClose:()=>x(!1)}),h.node]})}var ei=t(3249),ec=t(9431),er=t(3745),eo=t(5661),ed=t(2480),eh=t(665),eu=t(2582),em=t(4227),eg=t(9075),ex=t(776),ep=t(306);function ej(e){let s={meta:[],hunks:[],binary:!1},t=null,a=0,n=0;for(let i of e.split("\n")){let e=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@ ?(.*)$/.exec(i);if(e){var l;a=Number(e[1]),n=Number(e[2]),t={header:i,section:null!=(l=e[3])?l:"",lines:[]},s.hunks.push(t);continue}if(!t){/^Binary files .* differ$/.test(i)||i.startsWith("GIT binary patch")?s.binary=!0:(/^(rename|copy) (from|to) /.test(i)||/^(new|deleted) file mode/.test(i)||/^similarity index/.test(i))&&s.meta.push(i);continue}let c=i[0];if("+"===c)t.lines.push({kind:"add",newNo:n++,text:i.slice(1)});else if("-"===c)t.lines.push({kind:"del",oldNo:a++,text:i.slice(1)});else if(" "===c)t.lines.push({kind:"ctx",oldNo:a++,newNo:n++,text:i.slice(1)});else if("\\"===c){let e=t.lines[t.lines.length-1];e&&(e.noEol=!0)}}return s}let ef=e=>{var s,t;return null!=(t=null==(s=/^(@@ [^@]+@@)/.exec(e))?void 0:s[1])?t:e};var eb=t(8094),ev=t(1243),eN=t(5306),ey=t(3690),ek=t(2670),ew=t(6788),eC=t(9322),eS=t(1059),eA=t(4644),ez=t(6517),eM=t(4922),eE=t(5894),eF=t(3807),eR=t(3908),eP=t(9793),e_=t(4628),eT=t(176),eI=t(399),eL=t(8451),eD=t(9597),eW=t(1131),eO=t(9129),eq=t(1811),eK=t(2484),eU=t(5502),e$=t(3362),eH=t(6206);for(let[e,s]of Object.entries({bash:ev.A,c:eN.A,cpp:ey.A,csharp:ek.A,css:ew.A,diff:eC.A,dockerfile:eS.A,go:eA.A,ini:ez.A,java:eM.A,javascript:eE.A,json:eF.A,kotlin:eR.A,makefile:eP.A,markdown:e_.A,perl:eT.A,php:eI.A,python:eL.A,ruby:eD.A,rust:eW.A,scss:eO.A,sql:eq.A,swift:eK.A,typescript:eU.A,xml:e$.A,yaml:eH.A}))eb.A.registerLanguage(e,s);let eB={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",json:"json",css:"css",scss:"scss",html:"xml",htm:"xml",xml:"xml",svg:"xml",vue:"xml",svelte:"xml",md:"markdown",mdx:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",php:"php",pl:"perl",pm:"perl",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",toml:"ini",ini:"ini",conf:"ini",cfg:"ini",sql:"sql",diff:"diff",patch:"diff",mk:"makefile"};function eG(e){var s;let t=e.slice(e.lastIndexOf("/")+1).toLowerCase();return"dockerfile"===t?"dockerfile":"makefile"===t?"makefile":null!=(s=eB[t.includes(".")?t.slice(t.lastIndexOf(".")+1):""])?s:null}let eQ=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function eY(e,s){let t,a,n=eG(s);if(!n||e.length>12e5)t=eQ(e);else try{t=eb.A.highlight(e,{language:n,ignoreIllegals:!0}).value}catch(s){t=eQ(e)}let l=[],i=[],c="",r=/<span [^>]*>|<\/span>|\n|[^<\n]+/g;for(;a=r.exec(t);){let e=a[0];"\n"===e?(l.push(c+"</span>".repeat(i.length)),c=i.join("")):(e.startsWith("<span")?i.push(e):"</span>"===e&&i.pop(),c+=e)}return l.push(c+"</span>".repeat(i.length)),l}function eJ(e){return e.replace(/(^|>)([^<]+)/g,(e,s,t)=>s+t.replace(/[\t ]/g,e=>" "===e?'<i class="ws-t"> </i>':'<i class="ws-s"> </i>'))}let eX=null,eV=0,eZ=new Map;function e0(e,s){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e.length<=15e3,i=(0,l.useMemo)(()=>n?eY(e,s):null,[n,e,s]),c=(0,l.useMemo)(()=>n?[]:e.split("\n"),[n,e]),[r,o]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(n)return;let l=!0,i=setTimeout(()=>{new Promise(a=>{if("undefined"==typeof Worker)return void setTimeout(()=>a(eY(e,s)),0);eX||((eX=new Worker(t.tu(new URL(t.p+t.u(657),t.b)),{type:void 0})).onmessage=e=>{var s;null==(s=eZ.get(e.data.id))||s(e.data.lines),eZ.delete(e.data.id)},eX.onerror=()=>{eX=null});let n=++eV;eZ.set(n,a),eX.postMessage({id:n,code:e,path:s})}).then(t=>{l&&o({path:s,raws:e.split("\n"),html:t})})},a);return()=>{l=!1,clearTimeout(i)}},[n,e,s,a]),(0,l.useMemo)(()=>{if(i)return i;if(!r||r.path!==s)return c.map(eQ);let e=r.raws,t=0;for(;t<c.length&&t<e.length&&c[t]===e[t];)t++;let a=0;for(;a<c.length-t&&a<e.length-t&&c[c.length-1-a]===e[e.length-1-a];)a++;return c.map((s,n)=>n<t?r.html[n]:n>=c.length-a?r.html[e.length-(c.length-n)]:eQ(s))},[i,r,s,c])}let e1=[{id:"app",label:"Hive",dark:!1,swatch:["#f6f4ee","#9a6a00","#2f8f5b","#2f5bea"]},{id:"gitlab-light",label:"GitLab Light",dark:!1,swatch:["#ffffff","#a31515","#0451a5","#6f42c1"]},{id:"gitlab-dark",label:"GitLab Dark",dark:!0,swatch:["#1f1e24","#ff7b72","#a5d6ff","#d2a8ff"]},{id:"solarized-light",label:"Solarized Light",dark:!1,swatch:["#fdf6e3","#859900","#2aa198","#268bd2"]},{id:"solarized-dark",label:"Solarized Dark",dark:!0,swatch:["#002b36","#859900","#2aa198","#268bd2"]},{id:"monokai",label:"Monokai",dark:!0,swatch:["#272822","#f92672","#e6db74","#66d9ef"]},{id:"dracula",label:"Dracula",dark:!0,swatch:["#282a36","#ff79c6","#f1fa8c","#8be9fd"]}],e2="hive-git-view",e4={theme:"app",whitespace:!1,tabSize:4,showIgnored:!0},e9=e4,e3=!1,e6=new Set;function e8(){if(!e3){e3=!0;try{let e=localStorage.getItem(e2);if(e){let s=JSON.parse(e);e9={...e4,...s,theme:e1.some(e=>e.id===s.theme)?s.theme:"app"}}}catch(e){}}}function e5(e){e8(),e9={...e9,...e};try{localStorage.setItem(e2,JSON.stringify(e9))}catch(e){}e6.forEach(e=>e())}function e7(){return(0,l.useSyncExternalStore)(e=>(e6.add(e),()=>e6.delete(e)),()=>(e8(),e9),()=>e4)}var se=t(7841),ss=t(2705),st=t(1018);function sa(){let{t:e}=(0,D.s9)(),s=e7(),[t,n]=(0,l.useState)(!1),i=(0,l.useRef)(null);return(0,st.s)(t,i,()=>n(!1)),(0,a.jsxs)("div",{className:"gx-brmenu gx-set",ref:i,children:[(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm","aria-expanded":t,"aria-haspopup":"dialog","aria-label":e("git.set.title"),title:e("git.set.title"),onClick:()=>n(e=>!e),children:(0,a.jsx)(se.A,{size:15})}),t&&(0,a.jsxs)("div",{className:"gx-pop gx-setpop",role:"dialog","aria-label":e("git.set.title"),children:[(0,a.jsx)("div",{className:"gx-brhead",style:{padding:"0 2px"},children:e("git.set.theme")}),(0,a.jsx)("div",{className:"gx-themes",role:"radiogroup","aria-label":e("git.set.theme"),children:e1.map(t=>(0,a.jsxs)("button",{type:"button",role:"radio","aria-checked":s.theme===t.id,className:"gx-theme ".concat(s.theme===t.id?"on":""),onClick:()=>e5({theme:t.id}),children:[(0,a.jsxs)("span",{className:"sw",style:{background:t.swatch[0]},children:[(0,a.jsx)("i",{style:{background:t.swatch[1]}}),(0,a.jsx)("i",{style:{background:t.swatch[2]}}),(0,a.jsx)("i",{style:{background:t.swatch[3]}})]}),(0,a.jsx)("span",{className:"nm",children:"app"===t.id?e("git.set.themeApp"):t.label}),s.theme===t.id&&(0,a.jsx)(ss.A,{size:14})]},t.id))}),(0,a.jsxs)("label",{className:"gx-opt",children:[(0,a.jsx)("input",{type:"checkbox",checked:s.whitespace,onChange:e=>e5({whitespace:e.target.checked})}),(0,a.jsxs)("span",{children:[(0,a.jsx)("b",{children:e("git.set.whitespace")}),(0,a.jsx)("small",{children:e("git.set.whitespace.hint")})]})]}),(0,a.jsxs)("label",{className:"gx-opt",children:[(0,a.jsx)("input",{type:"checkbox",checked:s.showIgnored,onChange:e=>e5({showIgnored:e.target.checked})}),(0,a.jsxs)("span",{children:[(0,a.jsx)("b",{children:e("git.set.ignored")}),(0,a.jsx)("small",{children:e("git.set.ignored.hint")})]})]}),(0,a.jsxs)("div",{className:"gx-opt",children:[(0,a.jsx)("span",{children:(0,a.jsx)("b",{children:e("git.set.tab")})}),(0,a.jsx)("div",{className:"seg",role:"group",children:[2,4,8].map(e=>(0,a.jsx)("button",{type:"button","aria-pressed":s.tabSize===e,onClick:()=>e5({tabSize:e}),children:e},e))})]}),(0,a.jsx)("p",{className:"small muted",style:{margin:0},children:e("git.set.note")})]})]})}function sn(e){let{html:s}=e,{whitespace:t}=e7(),n=(0,l.useMemo)(()=>t?eJ(s):s,[s,t]);return(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:n||" "}})}let sl=(0,l.memo)(function(e){let{html:s,ws:t}=e,n=(0,l.useMemo)(()=>t?eJ(s):s,[s,t]);return(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:n||" "}})});function si(e){let{text:s,path:t}=e,n=(0,l.useMemo)(()=>eY(s,t).join("\n"),[s,t]);return(0,a.jsx)(sn,{html:n})}let sc=(0,l.memo)(function(e){let{text:s,path:t,ws:n}=e,i=(0,l.useMemo)(()=>{var e;return null!=(e=eY(s,t)[0])?e:""},[s,t]);return(0,a.jsx)(sl,{html:i,ws:n})});var sr=t(5267);function so(e){let{count:s,width:t,render:n,overscan:i=20,overlay:c,reveal:r}=e,o=(0,l.useRef)(null),d=(0,l.useRef)(0),[h,u]=(0,l.useState)({top:0,h:800,w:900}),m=(0,l.useCallback)(()=>{cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{let e=o.current;e&&u(s=>s.top===e.scrollTop&&s.h===e.clientHeight&&s.w===e.clientWidth?s:{top:e.scrollTop,h:e.clientHeight,w:e.clientWidth})})},[]);(0,l.useEffect)(()=>{let e=o.current;if(!e)return;let s=new ResizeObserver(m);return s.observe(e),m(),()=>{s.disconnect(),cancelAnimationFrame(d.current)}},[m]),(0,l.useEffect)(()=>{let e=o.current;if(!e||!r)return;let s=e.clientHeight,t=e.scrollTop;r.bottom-r.top+48>s||r.top-24<t?t=r.top-24:r.bottom+24>t+s&&(t=r.bottom+24-s),e.scrollTop=Math.max(0,t)},[null==r?void 0:r.key]),(0,l.useEffect)(()=>{let e=o.current;e&&e.scrollTop>20*s&&(e.scrollTop=0,m())},[s,m]);let g=Math.max(0,Math.floor(h.top/20)-i),x=Math.min(s,Math.ceil((h.top+h.h)/20)+i),p=[];for(let e=g;e<x;e++)p.push(n(e));return(0,a.jsx)("div",{className:"vl",ref:o,onScroll:m,style:{"--vl-vw":"".concat(h.w,"px")},children:(0,a.jsxs)("div",{className:"vl-space",style:{height:20*s,minWidth:t},children:[(0,a.jsx)("div",{className:"vl-win",style:{top:20*g},children:p}),c&&(0,a.jsx)("div",{className:"vl-peekwrap",style:{top:c.top},children:c.node})]})})}let sd=(0,l.memo)(function(e){var s,t,n,l,i,c,r,o;let{row:d,path:h,ws:u,actions:m,picking:g,onPick:x}=e,{t:p}=(0,D.s9)();if("hunk"===d.t)return(0,a.jsxs)("div",{className:"vl-row hunk",children:[(0,a.jsx)("div",{className:"vl-ln",style:{left:0},children:"⋯"}),(0,a.jsx)("div",{className:"vl-ln",style:{left:"calc(6ch + 16px)"},children:"⋯"}),(0,a.jsxs)("div",{className:"vl-hl",children:[(0,a.jsx)("span",{className:"rng mono",children:d.header}),d.section&&(0,a.jsx)("span",{className:"hs",title:d.section,children:d.section}),m&&(null==g?void 0:g.hunk)===d.idx?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"hk-btn on",onClick:()=>m.pickAll(d.idx,d.changed),children:p("git.discard.lines.all")}),(0,a.jsxs)("button",{type:"button",className:"hk-btn danger on",disabled:!g.picked.size,onClick:()=>m.discardPicked(d.idx,d.header),children:[(0,a.jsx)(eu.A,{size:12}),p("git.discard.lines.go",{count:g.picked.size})]}),(0,a.jsx)("button",{type:"button",className:"hk-btn on",onClick:m.stopPicking,children:p("common.cancel")})]}):m&&(0,a.jsxs)(a.Fragment,{children:[d.changed>0&&m.canPick&&(0,a.jsxs)("button",{type:"button",className:"hk-btn",title:p("git.discard.lines.hint"),onClick:()=>m.startPicking(d.idx),children:[(0,a.jsx)(sr.A,{size:12}),p("git.discard.lines")]}),(0,a.jsxs)("button",{type:"button",className:"hk-btn",title:p("git.discard.hunk.hint"),onClick:()=>m.discardHunk(d.idx,d.header),children:[(0,a.jsx)(eu.A,{size:12}),p("git.discard.hunk")]})]})]})]});if("line"===d.t){let e=d.l;return(0,a.jsxs)("div",{className:"vl-row ".concat(e.kind," ").concat(x&&void 0!==d.k&&(null==g?void 0:g.picked.has(d.k))?"picked":""),onClick:x&&void 0!==d.k?()=>x(d.k):void 0,children:[(0,a.jsx)("div",{className:"vl-ln",style:{left:0},children:null!=(s=e.oldNo)?s:""}),(0,a.jsx)("div",{className:"vl-ln",style:{left:"calc(6ch + 16px)"},children:null!=(t=e.newNo)?t:""}),(0,a.jsx)("div",{className:"vl-sg",children:x&&void 0!==d.k?(0,a.jsx)("input",{type:"checkbox",checked:!!(null==g?void 0:g.picked.has(d.k)),onChange:()=>void 0,"aria-label":p("git.discard.lines.pick")}):"add"===e.kind?"+":"del"===e.kind?"−":""}),(0,a.jsx)("div",{className:"vl-cd",children:(0,a.jsx)(sc,{text:e.text,path:h,ws:u})})]})}let{left:j,right:f}=d.r;return(0,a.jsxs)("div",{className:"vl-row split",children:[(0,a.jsx)("div",{className:"vl-ln ".concat(null!=(n=null==j?void 0:j.kind)?n:"void"),style:{left:0},children:null!=(l=null==j?void 0:j.oldNo)?l:""}),(0,a.jsx)("div",{className:"vl-cd ".concat(null!=(i=null==j?void 0:j.kind)?i:"void"),title:j&&j.text.length>60?j.text:void 0,children:j?(0,a.jsx)(sc,{text:j.text,path:h,ws:u}):null}),(0,a.jsx)("div",{className:"vl-ln ".concat(null!=(c=null==f?void 0:f.kind)?c:"void"),children:null!=(r=null==f?void 0:f.newNo)?r:""}),(0,a.jsx)("div",{className:"vl-cd ".concat(null!=(o=null==f?void 0:f.kind)?o:"void"),title:f&&f.text.length>60?f.text:void 0,children:f?(0,a.jsx)(sc,{text:f.text,path:h,ws:u}):null})]})});function sh(e){let{parsed:s,layout:t,path:n,cutOff:i=!1,firstIndex:c=0,onDiscardHunk:r,onDiscardLines:o}=e,{whitespace:d}=e7(),h=(0,l.useMemo)(()=>(function(e,s,t){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=[],l=(e=>{let s=eG(e);return!!s&&!["markdown","yaml","json","ini","xml","diff","dockerfile","makefile"].includes(s)})(t);return e.hunks.forEach((e,t)=>{n.push({t:"hunk",idx:t+a,header:ef(e.header),section:l?e.section:"",changed:e.lines.filter(e=>"ctx"!==e.kind).length});let i=0;if("unified"===s)for(let s of e.lines)n.push({t:"line",l:s,hunk:t+a,k:"ctx"===s.kind?void 0:i++});else for(let s of function(e){let s=[];for(let t=0;t<e.length;){let a=e[t];if("ctx"===a.kind){s.push({left:a,right:a}),t++;continue}let n=[],l=[];for(;t<e.length&&"del"===e[t].kind;)n.push(e[t++]);for(;t<e.length&&"add"===e[t].kind;)l.push(e[t++]);for(let e=0;e<Math.max(n.length,l.length);e++)s.push({left:n[e],right:l[e]})}return s}(e.lines))n.push({t:"pair",r:s})}),n})(s,t,n,c),[s,t,n,c]),u=(0,l.useMemo)(()=>s.hunks.reduce((e,s)=>s.lines.reduce((e,s)=>Math.max(e,s.text.length),e),0),[s]),m="unified"===t?"calc(12ch + 32px + 18px + ".concat(u,"ch + 24px)"):void 0,g=(0,l.useRef)(null),x=(0,l.useRef)(null),[p,j]=(0,l.useState)({max:0,track:0});(0,l.useEffect)(()=>{let e=g.current;if(!e||"split"!==t)return void j({max:0,track:0});let s=()=>{let s=e.querySelector(".vl");if(!s)return;let t=document.createElement("canvas").getContext("2d");if(!t)return;t.font=getComputedStyle(s).font;let a=t.measureText("0").width,n=(e.clientWidth-2*(6*a+16))/2;j({max:Math.max(0,Math.ceil(u*a+24-n)),track:e.clientWidth})};s();let a=new ResizeObserver(s);return a.observe(e),()=>a.disconnect()},[t,u,h.length]),(0,l.useEffect)(()=>{var e;x.current&&(x.current.scrollLeft=0),null==(e=g.current)||e.style.setProperty("--hx","0px")},[s,t]),(0,l.useEffect)(()=>{let e=g.current;if(!e||"split"!==t)return;let s=e=>{let s=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.shiftKey?e.deltaY:0;s&&x.current&&(e.preventDefault(),x.current.scrollLeft+=s)};return e.addEventListener("wheel",s,{passive:!1}),()=>e.removeEventListener("wheel",s)},[t]);let[f,b]=(0,l.useState)(null);(0,l.useEffect)(()=>{b(null)},[s,t]);let v=e=>b(s=>{if(!s)return s;let t=new Set(s.picked);return t.has(e)?t.delete(e):t.add(e),{...s,picked:t}}),N=r?{canPick:"unified"===t&&!!o,discardHunk:r,startPicking:e=>b({hunk:e,picked:new Set}),stopPicking:()=>b(null),pickAll:(e,s)=>b({hunk:e,picked:new Set(Array.from({length:s},(e,s)=>s))}),discardPicked:(e,s)=>{if(f&&o){let t=[...f.picked].sort((e,s)=>e-s);b(null),o(e,s,t)}}}:void 0;return(0,a.jsxs)("div",{className:"vf is-".concat(t),ref:g,style:{"--vl-left":"0px","--hx":"0px"},children:[s.meta.length>0&&(0,a.jsx)("div",{className:"gx-meta",children:s.meta.join(" \xb7 ")}),(0,a.jsx)("div",{className:"vf-main",children:(0,a.jsx)(so,{count:h.length,width:m,render:e=>{let t=h[e],l="line"===t.t&&(null==f?void 0:f.hunk)===t.hunk;return(0,a.jsx)(sd,{row:t,path:n,ws:d,actions:"hunk"!==t.t||i&&t.idx===s.hunks.length-1?void 0:N,picking:"hunk"===t.t||l?f:void 0,onPick:l?v:void 0},e)}})}),"split"===t&&p.max>0&&(0,a.jsx)("div",{className:"hbar",ref:x,onScroll:e=>{var s;return null==(s=g.current)?void 0:s.style.setProperty("--hx","".concat(e.currentTarget.scrollLeft,"px"))},"aria-label":"Scroll sideways",children:(0,a.jsx)("div",{style:{width:p.track+p.max,height:1}})})]})}let su={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflict:"!",typechange:"T"};function sm(e){let{status:s,titled:t=!1}=e,{t:n}=(0,D.s9)();return(0,a.jsx)("span",{className:"stl st-".concat(s),title:t?n("git.status.".concat(s)):void 0,children:su[s]})}function sg(e){let s=e.split("\n"),t=[];for(let e=0;e<s.length;e++){if(!/^<{7}( |$)/.test(s[e]))continue;let a=-1,n=-1,l=-1;for(let t=e+1;t<s.length&&!/^<{7}( |$)/.test(s[t]);t++)if(/^\|{7}( |$)/.test(s[t])&&a<0)n=t;else if("======="===s[t]&&a<0)a=t;else if(/^>{7}( |$)/.test(s[t])&&a>=0){l=t;break}a<0||l<0||(t.push({start:e,end:l,ours:s.slice(e+1,n>=0?n:a),base:n>=0?s.slice(n+1,a):void 0,theirs:s.slice(a+1,l),oursLabel:s[e].slice(8).trim(),theirsLabel:s[l].slice(8).trim()}),e=l)}return t}function sx(e,s,t){let a=sg(e)[s];if(!a)return e;let n={ours:a.ours,theirs:a.theirs,"ours-theirs":[...a.ours,...a.theirs],"theirs-ours":[...a.theirs,...a.ours]}[t],l=e.split("\n");return l.splice(a.start,a.end-a.start+1,...n),l.join("\n")}function sp(e){let{value:s,onChange:t,path:n,id:i,label:c}=e,r=e7(),o=(0,l.useRef)(null),d=(0,l.useRef)(null),h=(0,l.useRef)(0),[u,m]=(0,l.useState)({top:0,h:600}),g=e0(s,n,150),x=(0,l.useMemo)(()=>s.split("\n"),[s]),p=(0,l.useMemo)(()=>x.reduce((e,s)=>Math.max(e,s.length),0),[x]),j=String(g.length).length+2,f=()=>{let e=o.current,s=d.current;e&&s&&(s.scrollTop=e.scrollTop,s.scrollLeft=e.scrollLeft,cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>m(s=>s.top===e.scrollTop&&s.h===e.clientHeight?s:{top:e.scrollTop,h:e.clientHeight})))};(0,l.useEffect)(()=>{let e=o.current;if(!e)return;let s=new ResizeObserver(f);return s.observe(e),f(),()=>{s.disconnect(),cancelAnimationFrame(h.current)}},[]);let b=Math.max(0,Math.floor(u.top/20)-20),v=Math.min(g.length,Math.ceil((u.top+u.h)/20)+20),N=[];for(let e=b;e<v;e++){var y;let s=null!=(y=x[e])?y:"",t=/^(<{7}|>{7})( |$)/.test(s)?"mk-edge":"======="===s?"mk-mid":"";N.push((0,a.jsxs)("div",{className:"ce-row ".concat(t),children:[(0,a.jsx)("span",{className:"ce-no",children:e+1}),(0,a.jsx)("span",{className:"ce-code",children:(0,a.jsx)(sl,{html:g[e],ws:r.whitespace})})]},e))}return(0,a.jsxs)("div",{className:"ce",style:{"--g-tab":r.tabSize,"--ce-gw":"".concat(j,"ch")},children:[(0,a.jsx)("div",{className:"ce-layer",ref:d,"aria-hidden":!0,children:(0,a.jsx)("div",{className:"ce-space",style:{height:20*x.length,minWidth:"calc(".concat(j,"ch + ").concat(p,"ch + 40px)")},children:(0,a.jsx)("div",{className:"ce-win",style:{top:20*b},children:N})})}),(0,a.jsx)("textarea",{ref:o,id:i,"aria-label":c,className:"ce-area",value:s,spellCheck:!1,wrap:"off",onChange:e=>t(e.target.value),onScroll:f,onKeyDown:e=>{if("Tab"!==e.key)return;e.preventDefault();let a=e.currentTarget,n=a.selectionStart,l=a.selectionEnd,i=" ".repeat(r.tabSize);if(n===l&&!e.shiftKey){t(s.slice(0,n)+i+s.slice(l)),requestAnimationFrame(()=>a.setSelectionRange(n+i.length,n+i.length));return}let c=s.lastIndexOf("\n",n-1)+1,o=s.indexOf("\n",l),d=-1===o?s.length:o,h=s.slice(c,d).split("\n").map(s=>e.shiftKey?s.replace(new RegExp("^ {1,".concat(r.tabSize,"}")),""):i+s).join("\n");t(s.slice(0,c)+h+s.slice(d)),requestAnimationFrame(()=>a.setSelectionRange(c,c+h.length))}})]})}function sj(e){let{agent:s,path:t,state:n,a:i,onResolved:c}=e,{t:r}=(0,D.s9)(),[o,h]=(0,l.useState)(null),[u,m]=(0,l.useState)(""),[g,x]=(0,l.useState)(null),[p,f]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=!1;return h(null),x(null),j.F.get("/agents/".concat(s.id,"/git/file?path=").concat(encodeURIComponent(t))).then(s=>{e||(h(s),m(s.content))}).catch(s=>!e&&x(s instanceof Error?s.message:r("git.loadError"))),()=>{e=!0}},[s.id,t,p]);let b=(0,l.useMemo)(()=>sg(u),[u]),v="rebase"!==n&&"stash"!==n,N=e=>"mine"===e===v?"ours":"theirs",y=e=>"both-mine"===e?v?"ours-theirs":"theirs-ours":"both-remote"===e?v?"theirs-ours":"ours-theirs":N(e),k=/^(<{7}|>{7})( |$)/m.test(u),w=!!o&&!o.binary&&!o.truncated,C=!!i.busy,S=async e=>{await i.run("resolve",r("git.res.done"),"resolve-side",{path:t,side:N(e)})&&c()},A=async()=>{await i.run("resolve",r("git.res.done"),"resolve",{path:t,content:u})&&c()},z=async()=>{await i.run("unresolve",r("git.res.restored"),"unresolve",{path:t})&&f(e=>e+1)},M=t.lastIndexOf("/"),E=M>=0?t.slice(0,M+1):"",R=t.slice(M+1);return(0,a.jsxs)("section",{className:"gx-preview gx-resolver","aria-label":t,children:[(0,a.jsxs)("header",{className:"gx-phead",children:[(0,a.jsxs)("div",{className:"gx-ptitle",children:[(0,a.jsxs)("span",{className:"gx-path mono",title:t,children:[(0,a.jsx)("span",{className:"dir",children:E}),(0,a.jsx)("b",{children:R})]}),(0,a.jsx)("span",{className:"gx-chip st-conflict",children:r("git.status.conflict")}),w&&(0,a.jsx)("span",{className:"muted small",children:b.length>0?r("git.res.left",{count:b.length}):r("git.res.none")})]}),(0,a.jsxs)("div",{className:"gx-ptools",children:[(0,a.jsx)("button",{className:"btn sm",disabled:C,title:r("git.res.allMine.hint"),onClick:()=>void S("mine"),children:r("git.res.allMine")}),(0,a.jsx)("button",{className:"btn sm",disabled:C,title:r("git.res.allRemote.hint"),onClick:()=>void S("remote"),children:r("git.res.allRemote")}),(0,a.jsx)(F.WQ,{text:t,label:r("git.copyPath")})]})]}),g?(0,a.jsx)("p",{className:"gx-note err",children:g}):o?w?(0,a.jsxs)("div",{className:"gx-rbody",children:[b.length>0&&(0,a.jsx)("div",{className:"gx-rblocks",children:b.map((e,s)=>(0,a.jsxs)("div",{className:"gx-rcard",children:[(0,a.jsxs)("div",{className:"gx-rtitle",children:[(0,a.jsx)("b",{children:r("git.res.block",{n:s+1,total:b.length})}),(0,a.jsx)("span",{className:"muted small",children:r("git.res.line",{n:e.start+1})})]}),(0,a.jsx)("div",{className:"gx-rsides",children:["mine","remote"].map(l=>{let i,c="ours"===N(l)?e.ours:e.theirs,o=!(i="ours"===N(l)?e.oursLabel:e.theirsLabel)||["HEAD","ours","theirs","Updated upstream","Stashed changes"].includes(i)?"":i;return(0,a.jsxs)("div",{className:"gx-rside ".concat(l),children:[(0,a.jsxs)("div",{className:"gx-rhead",children:[(0,a.jsx)("span",{children:"mine"===l?"stash"===n?r("git.res.mine.stash"):r("git.res.mine"):"stash"===n?r("git.res.remote.stash"):r("git.res.remote")}),o&&(0,a.jsx)("i",{className:"ref",children:o})]}),(0,a.jsx)("pre",{children:c.length?(0,a.jsx)(si,{text:c.join("\n"),path:t}):(0,a.jsx)("span",{className:"muted",children:r("git.res.empty")})}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>m(e=>sx(e,s,y(l))),children:"mine"===l?r("git.res.keepMine"):r("git.res.keepRemote")})]},l)})}),(0,a.jsxs)("div",{className:"gx-rboth",children:[(0,a.jsxs)("span",{className:"small muted",children:[r("git.res.both"),":"]}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>m(e=>sx(e,s,y("both-mine"))),children:r("git.res.bothMine")}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>m(e=>sx(e,s,y("both-remote"))),children:r("git.res.bothRemote")})]})]},"".concat(s,"-").concat(e.start)))}),(0,a.jsxs)("div",{className:"gx-rresult",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("label",{className:"label grow",htmlFor:"gx-result",children:r("git.res.result")}),(0,a.jsx)("span",{className:"small muted",children:r("git.res.editHint")})]}),(0,a.jsx)(sp,{id:"gx-result",label:r("git.res.result"),value:u,path:t,onChange:m})]}),(0,a.jsxs)("footer",{className:"gx-rfoot",children:[(0,a.jsxs)("button",{className:"btn ghost sm",disabled:C,onClick:()=>void z(),title:r("git.res.restore.hint"),children:[(0,a.jsx)(d.A,{size:14}),r("git.res.restore")]}),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("button",{className:"btn primary",disabled:C||k,onClick:()=>void A(),children:r("git.res.markResolved")})]})]}):(0,a.jsx)("p",{className:"gx-note",children:r("git.res.noEdit")}):(0,a.jsx)("p",{className:"gx-note",children:r("git.loading")})]})}function sf(e){let{agent:s,plan:t,a:n,onClose:l,onGo:i}=e,{t:c}=(0,D.s9)();return(0,a.jsxs)(E.aF,{title:c("git.sw.title",{branch:t.to}),onClose:l,children:[t.carried>0&&(0,a.jsx)("p",{className:"muted",style:{margin:0},children:c("git.sw.carried",{count:t.carried,from:t.from})}),(0,a.jsxs)("div",{className:"gx-sw-warn",role:"alert",children:[t.selfRunning&&(0,a.jsx)("div",{children:c("git.warn.running",{name:s.name})}),t.others.length>0&&(0,a.jsx)("div",{children:c("git.sw.others",{count:t.others.length,names:t.others.map(e=>e.name).join(", ")})})]}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:l,children:c("common.cancel")}),(0,a.jsx)("button",{className:"btn primary",disabled:!!n.busy,onClick:i,children:c("git.sw.anyway")})]})]})}var sb=t(999),sv=t(4328),sN=t(7356);function sy(e){let{stashes:s,sel:t,onSelect:n,onSave:l,canSave:i}=e,{t:c}=(0,D.s9)();return(0,a.jsxs)("div",{className:"gx-stashes",children:[(0,a.jsx)("div",{className:"gx-stash-head",children:(0,a.jsxs)("button",{className:"btn sm",disabled:!i,title:i?void 0:c("git.stash.nothing"),onClick:l,children:[(0,a.jsx)(sb.A,{size:14}),c("git.stash.save")]})}),s?0===s.length?(0,a.jsx)("p",{className:"gx-note",children:c("git.stash.empty")}):(0,a.jsx)("div",{className:"gx-hist",role:"listbox","aria-label":c("git.tab.stashes"),children:s.map(e=>(0,a.jsxs)("button",{role:"option","aria-selected":t===e.sha,className:"gx-commit ".concat(t===e.sha?"sel":""),onClick:()=>n(e.sha),children:[(0,a.jsx)("span",{className:"subj",children:e.message||"—"}),(0,a.jsxs)("span",{className:"meta",children:[e.branch&&(0,a.jsxs)(a.Fragment,{children:[e.branch," \xb7 "]}),(0,f.KN)(Date.parse(e.date))]}),e.smart&&(0,a.jsx)("span",{className:"refs",children:(0,a.jsx)("i",{className:"ref",children:c("git.stash.smart")})})]},e.sha))}):(0,a.jsx)("p",{className:"gx-note",children:c("git.loading")})]})}function sk(e){let{a:s,onClose:t}=e,{t:n}=(0,D.s9)(),[i,c]=(0,l.useState)(""),r=async()=>{t(),await s.run("stash",n("git.stash.saved"),"stash-save",{message:i})};return(0,a.jsxs)(E.aF,{title:n("git.stash.save"),onClose:t,children:[(0,a.jsx)("p",{className:"muted",style:{margin:0},children:n("git.stash.save.body")}),(0,a.jsx)("input",{className:"input",autoFocus:!0,value:i,maxLength:200,placeholder:n("git.stash.save.placeholder"),onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&r()},"aria-label":n("git.stash.save.placeholder")}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:t,children:n("common.cancel")}),(0,a.jsx)("button",{className:"btn primary",disabled:!!s.busy,onClick:()=>void r(),children:n("git.stash.save")})]})]})}function sw(e){var s,t;let{agent:n,stash:i,a:c}=e,{t:r}=(0,D.s9)(),[o,d]=(0,l.useState)(null),[h,u]=(0,l.useState)(null),[m,g]=(0,l.useState)(null),[x,p]=(0,l.useState)(null),[b,v]=(0,l.useState)(!1),[N,y]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=!1;return d(null),u(null),g(null),p(null),y(null),Promise.all([j.F.get("/agents/".concat(n.id,"/git/stash?sha=").concat(i.sha)),j.F.get("/agents/".concat(n.id,"/git/commit?sha=").concat(i.sha))]).then(s=>{let[t,a]=s;if(e)return;d(t),u(a);let n=a.files[0];g(n?{path:n.path,untracked:!1,oldPath:n.oldPath}:t.untracked[0]?{path:t.untracked[0],untracked:!0}:null)}).catch(s=>!e&&y(s instanceof Error?s.message:r("git.loadError"))),()=>{e=!0}},[n.id,i.sha]),(0,l.useEffect)(()=>{if(!m||!o)return void p(null);let e=m.untracked?o.untrackedSha:i.sha;if(!e)return;let s=!1;return p(null),j.F.get("/agents/".concat(n.id,"/git/commit-diff?sha=").concat(e,"&path=").concat(encodeURIComponent(m.path)).concat(m.oldPath?"&old=".concat(encodeURIComponent(m.oldPath)):"")).then(e=>!s&&p(e)).catch(e=>!s&&y(e instanceof Error?e.message:r("git.loadError"))),()=>{s=!0}},[n.id,i.sha,o,null==m?void 0:m.path,null==m?void 0:m.untracked]);let k=(0,l.useMemo)(()=>x?ej(x.diff):null,[x]),w=!!c.busy,C=e=>void c.run("stash",e?r("git.stash.popped"):r("git.stash.applied"),"stash-apply",{sha:i.sha,pop:e}),S=(null!=(s=null==h?void 0:h.files.length)?s:0)+(null!=(t=null==o?void 0:o.untracked.length)?t:0);return(0,a.jsxs)("section",{className:"gx-preview gx-commitview","aria-label":i.message,children:[(0,a.jsxs)("header",{className:"gx-chead",children:[(0,a.jsx)("h3",{children:i.message||"—"}),(0,a.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,a.jsxs)("span",{children:[i.branch&&"".concat(i.branch," \xb7 "),(0,f.KN)(Date.parse(i.date))]}),o&&(0,a.jsxs)("span",{children:["\xb7 ",r("git.hist.files",{count:S})]})]}),(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsxs)("button",{className:"btn sm",disabled:w,title:r("git.stash.apply.hint"),onClick:()=>C(!1),children:[(0,a.jsx)(sv.A,{size:14}),r("git.stash.apply")]}),(0,a.jsx)("button",{className:"btn sm primary",disabled:w,title:r("git.stash.pop.hint"),onClick:()=>C(!0),children:r("git.stash.pop")}),(0,a.jsxs)("button",{className:"btn sm danger",disabled:w,onClick:()=>v(!0),children:[(0,a.jsx)(sN.A,{size:14}),r("git.stash.drop")]})]})]}),N?(0,a.jsx)("p",{className:"gx-note err",children:N}):h&&o?0===S?(0,a.jsx)("p",{className:"gx-note",children:r("git.hist.noFiles")}):(0,a.jsxs)("div",{className:"gx-cfilelist",role:"listbox",children:[h.files.map(e=>{var s,t;return(0,a.jsxs)("button",{role:"option","aria-selected":(null==m?void 0:m.path)===e.path&&!m.untracked,className:"gx-cfile ".concat((null==m?void 0:m.path)!==e.path||m.untracked?"":"sel"),onClick:()=>g({path:e.path,untracked:!1,oldPath:e.oldPath}),children:[(0,a.jsx)(sm,{status:e.status}),(0,a.jsx)("span",{className:"mono nm",children:e.path}),(null!==e.additions||null!==e.deletions)&&(0,a.jsxs)("span",{className:"gx-counts sm",children:[(0,a.jsxs)("i",{className:"add",children:["+",null!=(s=e.additions)?s:0]}),(0,a.jsxs)("i",{className:"del",children:["−",null!=(t=e.deletions)?t:0]})]})]},"t-".concat(e.path))}),o.untracked.map(e=>(0,a.jsxs)("button",{role:"option","aria-selected":(null==m?void 0:m.path)===e&&m.untracked,className:"gx-cfile ".concat((null==m?void 0:m.path)===e&&m.untracked?"sel":""),onClick:()=>g({path:e,untracked:!0}),children:[(0,a.jsx)(sm,{status:"untracked"}),(0,a.jsx)("span",{className:"mono nm",children:e})]},"u-".concat(e)))]}):(0,a.jsx)("p",{className:"gx-note",children:r("git.loading")}),m&&(0,a.jsx)("div",{className:"gx-body",children:k?k.binary?(0,a.jsx)("p",{className:"gx-note",children:r("git.diff.binary")}):0===k.hunks.length?(0,a.jsx)("p",{className:"gx-note",children:r("git.diff.empty")}):(0,a.jsx)(sh,{parsed:k,layout:"unified",path:m.path,cutOff:!!(null==x?void 0:x.truncated)}):(0,a.jsx)("p",{className:"gx-note",children:r("git.loading")})}),b&&(0,a.jsxs)(E.aF,{title:r("git.stash.drop.title"),onClose:()=>v(!1),children:[(0,a.jsx)("p",{className:"muted",style:{margin:0},children:r("git.stash.drop.body",{name:i.message||"—"})}),(0,a.jsx)("p",{className:"gx-lost",children:r("git.discard.all.warn")}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:()=>v(!1),children:r("common.cancel")}),(0,a.jsx)("button",{className:"btn danger",disabled:w,onClick:()=>{v(!1),c.run("stash",r("git.stash.dropped"),"stash-drop",{sha:i.sha})},children:r("git.stash.drop")})]})]})]})}var sC=t(9959),sS=t(6819),sA=t(703),sz=t(216),sM=t(7384);function sE(e){let{a:s}=e,{t}=(0,D.s9)(),n=s.notice;return n?(0,a.jsxs)("div",{className:"gx-notice err",role:"alert",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("b",{className:"grow",children:n.title}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>s.setNotice(null),"aria-label":t("common.close"),children:(0,a.jsx)(eh.A,{size:14})})]}),(0,a.jsx)("pre",{children:n.text}),n.diverged&&(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsx)("span",{className:"small muted",children:t("git.notice.diverged")}),(0,a.jsx)("button",{className:"btn sm",disabled:!!s.busy,onClick:()=>void s.run("pull",t("git.done.pull"),"pull",{mode:"merge"}),children:t("git.pull.merge")}),(0,a.jsx)("button",{className:"btn sm",disabled:!!s.busy,onClick:()=>void s.run("pull",t("git.done.pull"),"pull",{mode:"rebase"}),children:t("git.pull.rebase")})]})]}):null}function sF(e){let{a:s,ahead:t,behind:n,detached:l,changeCount:i,onCommit:c}=e,{t:r}=(0,D.s9)(),o=!!s.busy;return(0,a.jsxs)("div",{className:"gx-acts",role:"group","aria-label":r("git.act.group"),children:[(0,a.jsxs)("button",{className:"btn sm",disabled:o,title:r("git.act.fetch.hint"),onClick:()=>void s.run("fetch",r("git.done.fetch"),"fetch"),children:["fetch"===s.busy?(0,a.jsx)(sC.A,{size:14,className:"spin"}):(0,a.jsx)(sS.A,{size:14}),r("git.act.fetch")]}),(0,a.jsxs)("button",{className:"btn sm",disabled:o,title:r("git.act.pull.hint"),onClick:()=>void s.run("pull",r("git.done.pull"),"pull"),children:["pull"===s.busy?(0,a.jsx)(sC.A,{size:14,className:"spin"}):(0,a.jsx)(sA.A,{size:14}),r("git.act.pull"),n>0&&(0,a.jsx)("span",{className:"ct",children:n})]}),(0,a.jsxs)("button",{className:"btn sm",disabled:o||l,title:r("git.act.push.hint"),onClick:()=>void s.run("push",r("git.done.push"),"push"),children:["push"===s.busy?(0,a.jsx)(sC.A,{size:14,className:"spin"}):(0,a.jsx)(z.A,{size:14}),r("git.act.push"),t>0&&(0,a.jsx)("span",{className:"ct",children:t})]}),(0,a.jsxs)("button",{className:"btn sm primary",disabled:o||0===i,title:0===i?r("git.commit.nothing"):void 0,onClick:c,children:["commit"===s.busy?(0,a.jsx)(sC.A,{size:14,className:"spin"}):(0,a.jsx)(sz.A,{size:14}),r("git.act.commit"),i>0&&(0,a.jsx)("span",{className:"ct",children:i})]})]})}function sR(e){let{agent:s,a:t,current:n,onSwitch:i}=e,{t:c}=(0,D.s9)(),[r,o]=(0,l.useState)(!1),[d,h]=(0,l.useState)(null),[u,m]=(0,l.useState)(""),[g,x]=(0,l.useState)(""),[p,b]=(0,l.useState)(null),[v,N]=(0,l.useState)(""),y=(0,l.useRef)(null);(0,st.s)(r,y,()=>o(!1)),(0,l.useEffect)(()=>{r&&(N(""),b(null),j.F.get("/agents/".concat(s.id,"/git/branches")).then(h).catch(e=>N(e instanceof Error?e.message:"error")))},[r,s.id]);let k=(0,l.useMemo)(()=>{var e;return(null!=(e=null==d?void 0:d.local)?e:[]).filter(e=>e.name.toLowerCase().includes(u.toLowerCase()))},[d,u]),w=(0,l.useMemo)(()=>{var e,s;let t=new Set((null!=(e=null==d?void 0:d.local)?e:[]).map(e=>e.name));return(null!=(s=null==d?void 0:d.remote)?s:[]).filter(e=>!t.has(e.name.split("/").slice(1).join("/"))&&e.name.toLowerCase().includes(u.toLowerCase()))},[d,u]),C=async(e,s,a,n)=>{o(!1),await t.run(e,s,a,n)},S=/^[\w./-]+$/.test(g)&&!g.startsWith("-")&&!g.endsWith("/")&&!g.includes("..");return(0,a.jsxs)("div",{className:"gx-brmenu",ref:y,children:[(0,a.jsxs)("button",{type:"button",className:"btn sm","aria-expanded":r,"aria-haspopup":"menu",onClick:()=>o(e=>!e),children:[(0,a.jsx)(ex.A,{size:14}),c("git.act.branches"),(0,a.jsx)(J.A,{size:13})]}),r&&(0,a.jsxs)("div",{className:"gx-pop",role:"menu",children:[(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(es.A,{size:14}),(0,a.jsx)("input",{className:"input",autoFocus:!0,placeholder:c("git.br.search"),value:u,onChange:e=>m(e.target.value),"aria-label":c("git.br.search")})]}),(0,a.jsxs)("div",{className:"gx-newbr",children:[(0,a.jsx)("input",{className:"input mono",placeholder:c("git.br.newPlaceholder"),value:g,onChange:e=>x(e.target.value.trim()),"aria-label":c("git.br.new",{branch:null!=n?n:""}),onKeyDown:e=>{"Enter"===e.key&&S&&C("switch",c("git.done.switch",{branch:g}),"switch",{branch:g,create:!0})}}),(0,a.jsxs)("button",{className:"btn sm",disabled:!S||!!t.busy,title:c("git.br.new",{branch:null!=n?n:"…"}),onClick:()=>void C("switch",c("git.done.switch",{branch:g}),"switch",{branch:g,create:!0}),children:[(0,a.jsx)(ee.A,{size:14}),c("git.br.create")]})]}),v&&(0,a.jsx)("p",{className:"gx-note err",children:v}),(0,a.jsxs)("div",{className:"gx-brlist",children:[k.length>0&&(0,a.jsx)("div",{className:"gx-brhead",children:c("git.br.local")}),k.map(e=>(0,a.jsxs)("div",{className:"gx-br ".concat(e.name===n?"cur":""),children:[(0,a.jsxs)("button",{className:"grow",disabled:e.name===n||!!t.busy,onClick:()=>{o(!1),i(e.name)},title:c("git.br.switchTo",{branch:e.name}),children:[(0,a.jsxs)("span",{className:"nm",children:[e.name===n&&(0,a.jsx)(ss.A,{size:13}),e.name]}),(0,a.jsxs)("span",{className:"sub",children:[e.subject," \xb7 ",(0,f.KN)(Date.parse(e.date))]})]}),e.name!==n&&(0,a.jsx)("button",{className:"btn ghost icon sm",disabled:!!t.busy,onClick:()=>b(e.name),"aria-label":c("git.br.merge",{branch:null!=n?n:""}),title:c("git.br.merge",{branch:null!=n?n:""}),children:(0,a.jsx)(sM.A,{size:14})})]},e.name)),w.length>0&&(0,a.jsx)("div",{className:"gx-brhead",children:c("git.br.remote")}),w.map(e=>(0,a.jsxs)("div",{className:"gx-br",children:[(0,a.jsxs)("button",{className:"grow",disabled:!!t.busy,onClick:()=>{let s=e.name.split("/").slice(1).join("/");o(!1),i(s)},title:c("git.br.switchTo",{branch:e.name}),children:[(0,a.jsx)("span",{className:"nm",children:e.name}),(0,a.jsxs)("span",{className:"sub",children:[e.subject," \xb7 ",(0,f.KN)(Date.parse(e.date))]})]}),(0,a.jsx)("button",{className:"btn ghost icon sm",disabled:!!t.busy,onClick:()=>b(e.name),"aria-label":c("git.br.merge",{branch:null!=n?n:""}),title:c("git.br.merge",{branch:null!=n?n:""}),children:(0,a.jsx)(sM.A,{size:14})})]},e.name)),d&&!k.length&&!w.length&&(0,a.jsx)("p",{className:"gx-note",children:c("git.br.none")})]}),p&&(0,a.jsxs)("div",{className:"gx-mergeask",children:[(0,a.jsx)("span",{children:c("git.br.mergeAsk",{from:p,into:null!=n?n:""})}),(0,a.jsxs)("div",{className:"row gap-s",children:[(0,a.jsx)("button",{className:"btn ghost sm",onClick:()=>b(null),children:c("common.cancel")}),(0,a.jsx)("button",{className:"btn primary sm",disabled:!!t.busy,onClick:()=>void C("merge",c("git.done.merge",{branch:p}),"merge",{branch:p}),children:c("git.br.mergeGo")})]})]})]})]})}function sP(e){let{changes:s,a:t,onClose:n,initialMessage:i=""}=e,{t:c}=(0,D.s9)(),[r,o]=(0,l.useState)(()=>new Set(s.map(e=>e.path))),[d,h]=(0,l.useState)(i),u=s.filter(e=>r.has(e.path)),m=u.flatMap(e=>e.oldPath?[e.path,e.oldPath]:[e.path]),g=!!d.trim()&&u.length>0&&!t.busy,x=async e=>{if(!await t.run("commit",c("git.done.commit"),"commit",{message:d,paths:m}))return void n();n(),e&&await t.run("push",c("git.done.push"),"push")};return(0,a.jsxs)(E.aF,{title:c("git.commit.title"),onClose:n,children:[(0,a.jsxs)("div",{className:"gx-cfiles",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("span",{className:"small muted grow",children:c("git.commit.selected",{n:u.length,total:s.length})}),(0,a.jsx)("button",{className:"btn ghost sm",onClick:()=>o(new Set(s.map(e=>e.path))),children:c("git.commit.all")}),(0,a.jsx)("button",{className:"btn ghost sm",onClick:()=>o(new Set),children:c("git.commit.none")})]}),(0,a.jsx)("div",{className:"gx-clist",children:s.map(e=>{var s,t;return(0,a.jsxs)("label",{className:"gx-crow",title:e.path,children:[(0,a.jsx)("input",{type:"checkbox",checked:r.has(e.path),onChange:()=>{let s;return s=e.path,o(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})}}),(0,a.jsx)(sm,{status:e.status}),(0,a.jsx)("span",{className:"mono nm",children:e.path}),(null!==e.additions||null!==e.deletions)&&(0,a.jsxs)("span",{className:"gx-counts sm",children:[(0,a.jsxs)("i",{className:"add",children:["+",null!=(s=e.additions)?s:0]}),(0,a.jsxs)("i",{className:"del",children:["−",null!=(t=e.deletions)?t:0]})]})]},e.path)})})]}),(0,a.jsxs)("div",{className:"field",children:[(0,a.jsx)("label",{children:c("git.commit.message")}),(0,a.jsx)("textarea",{className:"textarea",rows:4,autoFocus:!0,value:d,onChange:e=>h(e.target.value),placeholder:c("git.commit.placeholder"),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&g&&x(!1)}}),(0,a.jsx)("span",{className:"hint",children:c("git.commit.hint")})]}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:n,children:c("common.cancel")}),(0,a.jsx)("button",{className:"btn",disabled:!g,onClick:()=>void x(!1),children:"commit"===t.busy?c("git.commit.committing"):c("git.commit.go")}),(0,a.jsx)("button",{className:"btn primary",disabled:!g,onClick:()=>void x(!0),children:c("git.commit.goPush")})]})]})}function s_(e){let{agent:s,head:t,sel:n,onSelect:i}=e,{t:c}=(0,D.s9)(),[r,o]=(0,l.useState)(null),[d,h]=(0,l.useState)(!1),[u,m]=(0,l.useState)(!1),[g,x]=(0,l.useState)(""),p=async e=>{m(!0);try{let t=await j.F.get("/agents/".concat(s.id,"/git/log?skip=").concat(e));o(s=>0===e?t.commits:[...null!=s?s:[],...t.commits]),h(t.hasMore),x("")}catch(e){x(e instanceof Error?e.message:"error")}finally{m(!1)}};return((0,l.useEffect)(()=>{p(0)},[s.id,t]),(0,l.useEffect)(()=>{!n&&(null==r?void 0:r.length)&&i(r[0].sha)},[r]),g)?(0,a.jsx)("p",{className:"gx-note err",children:g}):r?r.length?(0,a.jsxs)("div",{className:"gx-hist",role:"listbox","aria-label":c("git.tab.history"),children:[r.map(e=>(0,a.jsxs)("button",{role:"option","aria-selected":n===e.sha,className:"gx-commit ".concat(n===e.sha?"sel":""),onClick:()=>i(e.sha),children:[(0,a.jsx)("span",{className:"subj",children:e.subject||"—"}),(0,a.jsxs)("span",{className:"meta",children:[(0,a.jsx)("span",{className:"mono sha",children:e.short})," \xb7 ",e.author," \xb7 ",(0,f.KN)(Date.parse(e.date))]}),(e.refs.length>0||e.merge)&&(0,a.jsxs)("span",{className:"refs",children:[e.merge&&(0,a.jsx)("i",{className:"ref",children:c("git.hist.merge")}),e.refs.slice(0,3).map(e=>(0,a.jsx)("i",{className:"ref",children:e},e))]})]},e.sha)),d&&(0,a.jsx)("button",{className:"btn sm",style:{margin:10},disabled:u,onClick:()=>void p(r.length),children:u?c("git.loading"):c("git.hist.more")})]}):(0,a.jsx)("p",{className:"gx-note",children:c("git.hist.empty")}):(0,a.jsx)("p",{className:"gx-note",children:c("git.loading")})}function sT(e){let{files:s,all:t,summary:n,file:l,busy:i,onConfirm:c,onClose:r}=e,{t:o}=(0,D.s9)(),d=(0,a.jsxs)("ul",{className:"gx-dlist",children:[s.slice(0,8).map(e=>(0,a.jsx)("li",{className:"mono",children:e},e)),s.length>8&&(0,a.jsx)("li",{className:"muted",children:o("hover.more",{count:s.length-8})})]});if(!t&&l&&!s.length){var h;let e=l.add||l.del?" (+".concat(l.add," −").concat(l.del,")"):"";return(0,a.jsxs)(E.aF,{title:o("git.discard.file.title"),onClose:r,children:[(0,a.jsx)("p",{className:"gx-file-eff mono",children:l.path}),(0,a.jsx)("p",{style:{margin:0},children:"deleted"===l.status?o("git.discard.file.deleted"):"renamed"===l.status?o("git.discard.file.renamed",{from:null!=(h=l.oldPath)?h:""}):o("git.discard.file.modified",{lines:e})}),(0,a.jsx)("p",{className:"gx-lost",children:o("git.discard.all.warn")}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:r,children:o("common.cancel")}),(0,a.jsx)("button",{className:"btn danger",disabled:i,onClick:c,children:o("git.discard.file.go")})]})]})}return t?(0,a.jsxs)(E.aF,{title:o("git.discard.all.title"),onClose:r,children:[(0,a.jsxs)("ul",{className:"gx-effects",children:[n&&n.restore>0&&(0,a.jsx)("li",{children:o("git.discard.all.restore",{count:n.restore})}),s.length>0&&(0,a.jsxs)("li",{className:"bad",children:[(0,a.jsx)("b",{children:o("git.discard.all.delete",{count:s.length})}),d]})]}),n&&(0,a.jsx)("p",{className:"muted small",style:{margin:0},children:o("git.discard.all.lines",{add:n.add,del:n.del})}),(0,a.jsx)("p",{className:"gx-lost",children:o("git.discard.all.warn")}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:r,children:o("common.cancel")}),(0,a.jsx)("button",{className:"btn danger",disabled:i,onClick:c,children:o("git.discard.all.go")})]})]}):(0,a.jsxs)(E.aF,{title:o("git.discard.confirm.title"),onClose:r,children:[(0,a.jsx)("p",{className:"muted",style:{margin:0},children:o("git.discard.confirm.body",{count:s.length})}),d,(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:r,children:o("common.cancel")}),(0,a.jsx)("button",{className:"btn danger",disabled:i,onClick:c,children:o("git.discard.confirm.go")})]})]})}let sI=/\.(png|jpe?g|gif|webp|svg|ico|bmp|avif)$/i;function sL(e){let{name:s}=e;return sI.test(s)?(0,a.jsx)(ei.A,{size:15}):/\.(md|mdx|txt|rst)$/i.test(s)?(0,a.jsx)(ec.A,{size:15}):eG(s)?(0,a.jsx)(er.A,{size:15}):(0,a.jsx)(eo.A,{size:15})}function sD(e){let{path:s,hunk:t,index:n,total:i,extent:c,onClose:r,onGo:o}=e,{t:d}=(0,D.s9)(),h=(0,l.useMemo)(()=>({meta:[],hunks:[t],binary:!1}),[t]),u=t.lines.length+1;return(0,a.jsxs)("div",{className:"vl-peek",role:"dialog","aria-label":d("git.peek.title"),onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"vl-peek-head",children:[(0,a.jsx)("b",{children:c?c.from===c.to?d("git.peek.line",{n:c.from}):d("git.peek.lines",{from:c.from,to:c.to}):d("git.peek.title")}),(0,a.jsx)("span",{className:"muted mono small grow",children:ef(t.header)}),(0,a.jsx)("span",{className:"small muted",children:d("git.peek.count",{n:n+1,total:i})}),(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:n<=0,onClick:()=>o(n-1),"aria-label":d("git.peek.prev"),title:"".concat(d("git.peek.prev")," (Alt+↑)"),children:(0,a.jsx)(ed.A,{size:15})}),(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:n>=i-1,onClick:()=>o(n+1),"aria-label":d("git.peek.next"),title:"".concat(d("git.peek.next")," (Alt+↓)"),children:(0,a.jsx)(J.A,{size:15})}),(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:r,"aria-label":d("common.close"),children:(0,a.jsx)(eh.A,{size:14})})]}),(0,a.jsx)("div",{className:"vl-peek-body",style:{height:Math.min(20*u+4,260)},children:(0,a.jsx)(sh,{parsed:h,layout:"unified",path:s,firstIndex:n})})]})}function sW(e){var s,t;let{f:n,agent:i,blame:c,onOpenCommit:r,marks:o,allNew:d}=e,h=null!=(s=null==o?void 0:o.groups)?s:[],[u,m]=(0,l.useState)(null),g=(0,l.useMemo)(()=>{let e=n.content.split("\n").length;return h.map(s=>({from:Math.min(s.from,e),to:Math.min(s.to,e)}))},[h,n.content]),x=u&&null!=(t=g[u.block])?t:null,[p,b]=(0,l.useState)(),v=(e,s)=>{let t={from:e.from,to:Math.min(e.to,n.content.split("\n").length)};return(t.to-(s+1)<=25?Math.max(t.to,s+1):s+1)*20},N=e=>34+Math.min((e.view.lines.length+1)*20+4,260)+14,y=e=>{let s=g[e];if(!s)return;let t=Math.max(0,s.from-1);m({row:t,block:e}),b({top:20*t,bottom:v(h[e],t)+N(h[e]),key:Date.now()})};(0,l.useEffect)(()=>{m(null)},[n.path,o]),(0,l.useEffect)(()=>{if(!u)return;let e=e=>{if("Escape"===e.key)m(null);else if(e.altKey&&("ArrowDown"===e.key||"ArrowUp"===e.key)){e.preventDefault();let s=u.block+("ArrowDown"===e.key?1:-1);s>=0&&s<h.length&&y(s)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[u]);let{t:k}=(0,D.s9)(),{whitespace:w}=e7(),[C,S]=(0,l.useState)(null),[A,z]=(0,l.useState)(null),M=e0(n.content,n.path),E=(0,l.useMemo)(()=>M.length&&""===M[M.length-1]?M.slice(0,-1):M,[M]),F=(0,l.useMemo)(()=>n.content.split("\n").reduce((e,s)=>Math.max(e,s.length),0),[n.content]);(0,l.useEffect)(()=>{if(!c||"worktree"!==n.source){S(null),z(null);return}let e=!1;return j.F.get("/agents/".concat(i.id,"/git/blame?path=").concat(encodeURIComponent(n.path))).then(s=>{e||(S(s),z(null))}).catch(s=>!e&&z(s instanceof Error?s.message:k("git.loadError"))),()=>{e=!0}},[c,i.id,n.path,n.source]);let R=(0,l.useMemo)(()=>{if(!C)return null;let e=-1;return C.lines.map((s,t)=>{let a=s!==C.lines[t-1];return a&&e++,{first:a,g:e%2}})},[C]);if(n.binary)return(0,a.jsx)("p",{className:"gx-note",children:k("git.file.binary")});if(0===E.length)return(0,a.jsx)("p",{className:"gx-note",children:k("git.file.empty")});let P=210*!!C;return(0,a.jsxs)("div",{className:"vf",children:["head"===n.source&&(0,a.jsx)("div",{className:"gx-banner",children:k("git.file.deleted")}),n.truncated&&(0,a.jsx)("div",{className:"gx-banner",children:k("git.file.truncated")}),A&&(0,a.jsx)("div",{className:"gx-banner",children:A}),(null==C?void 0:C.truncated)&&(0,a.jsx)("div",{className:"gx-banner",children:k("git.blame.truncated",{count:C.lines.length})}),(0,a.jsx)("div",{className:"vf-main",style:{"--vl-left":"".concat(P,"px")},children:(0,a.jsx)(so,{count:E.length,width:"calc(".concat(P,"px + ").concat(6,"ch + ").concat(F,"ch + 40px)"),overlay:u&&h[u.block]?{top:v(h[u.block],u.row),node:(0,a.jsx)(sD,{path:n.path,hunk:h[u.block].view,index:u.block,extent:x,onClose:()=>m(null),total:h.length,onGo:y})}:void 0,reveal:p,render:e=>{var s;let t=null==C?void 0:C.lines[e],l=t?C.commits[t]:void 0,i=null==R?void 0:R[e],c="worktree"===n.source?d?"add":null==o?void 0:o.lines.get(e+1):void 0,g=!!o&&o.removedBefore.has(e+1),p=!!o&&e===E.length-1&&o.removedBefore.has(E.length+1),j=o&&"worktree"===n.source?null!=(s=o.blockOfLine.get(e+1))?s:g?o.blockOfRemoval.get(e+1):p?o.blockOfRemoval.get(E.length+1):void 0:void 0;return(0,a.jsxs)("div",{className:"vl-row ".concat(i?"bl-g".concat(i.g):""," ").concat(c?"m-".concat(c):""," ").concat(g?"m-delb":p?"m-dela":""," ").concat(void 0!==j?"has-peek":""," ").concat(x&&e+1>=x.from&&e+1<=x.to?"in-peek":""),onClick:void 0!==j?s=>{var t;if(!s.target.closest(".bl-btn")&&(s.target.closest(".vl-ln")||(null==(t=window.getSelection())?void 0:t.isCollapsed))){if((null==u?void 0:u.row)===e)return void m(null);m({row:e,block:j}),b({top:20*e,bottom:v(h[j],e)+N(h[j]),key:Date.now()})}}:void 0,title:void 0!==j?k("git.peek.hint"):void 0,children:[C&&(0,a.jsx)("div",{className:"vl-bl ".concat((null==i?void 0:i.first)?"first":""),children:(null==i?void 0:i.first)&&l&&(l.uncommitted?(0,a.jsx)("span",{className:"muted",children:k("git.blame.uncommitted")}):(0,a.jsxs)("button",{type:"button",className:"bl-btn",title:"".concat(l.summary,"\n").concat(l.author," \xb7 ").concat((0,O.v7)(l.time)),onClick:()=>r(t),children:[(0,a.jsx)("span",{className:"mono sha",children:l.short}),(0,a.jsx)("span",{className:"who",children:l.author}),(0,a.jsx)("span",{className:"when",children:(0,f.KN)(l.time)})]}))}),(0,a.jsx)("div",{className:"vl-ln",children:e+1}),(0,a.jsx)("div",{className:"vl-cd",children:(0,a.jsx)(sl,{html:E[e],ws:w})})]},e)}})})]})}function sO(e){var s,t;let{agent:n,path:i,ignored:c=!1,change:r,stamp:o,onOpenCommit:d,onDiscard:h,onDiscardHunk:u,onDiscardLines:m}=e,{t:g}=(0,D.s9)(),[x,p]=(0,l.useState)(!1),f=!!r&&!sI.test(i),[b,v]=(0,l.useState)(f?"diff":"file"),[N,y]=(0,l.useState)("unified"),[k,w]=(0,l.useState)(null),[C,S]=(0,l.useState)(null),[A,z]=(0,l.useState)(null),[M,R]=(0,l.useState)(!1),[P,_]=(0,l.useState)(!1),T=sI.test(i);(0,l.useEffect)(()=>{v(f?"diff":"file"),_(!1)},[i,f]),(0,l.useEffect)(()=>{let e=!1;z(null);let s="path=".concat(encodeURIComponent(i));return R(!0),("diff"===b&&r?j.F.get("/agents/".concat(n.id,"/git/diff?").concat(s).concat(r.oldPath?"&old=".concat(encodeURIComponent(r.oldPath)):"")).then(s=>!e&&w(s)):T?Promise.resolve():j.F.get("/agents/".concat(n.id,"/git/file?").concat(s)).then(s=>!e&&S(s))).catch(s=>!e&&z(s instanceof Error?s.message:g("git.loadError"))).finally(()=>!e&&R(!1)),()=>{e=!0}},[n.id,i,b,null==r?void 0:r.status,null==r?void 0:r.oldPath,o]);let I=(0,l.useMemo)(()=>k&&k.path===i?ej(k.diff):null,[k,i]),[L,W]=(0,l.useState)(null),q=(null==r?void 0:r.status)==="untracked"||(null==r?void 0:r.status)==="added"&&!r.oldPath;(0,l.useEffect)(()=>{if(W(null),"file"!==b||!r||T||q||"deleted"===r.status||"conflict"===r.status)return;let e=!1;return j.F.get("/agents/".concat(n.id,"/git/diff?path=").concat(encodeURIComponent(i)).concat(r.oldPath?"&old=".concat(encodeURIComponent(r.oldPath)):"")).then(s=>!e&&W(s)).catch(()=>void 0),()=>{e=!0}},[n.id,i,b,null==r?void 0:r.status,null==r?void 0:r.oldPath,o]);let K=(0,l.useMemo)(()=>L&&L.path===i?ej(L.diff):null,[L,i]),U=(0,l.useMemo)(()=>K?function(e){let s=new Map,t=new Set,a=new Map,n=new Map,l=[];for(let m of e.hunks){var i,c,r,o,d,h,u;let e=m.lines,g=[],x=Number(null!=(c=null==(i=/\+(\d+)/.exec(m.header))?void 0:i[1])?c:1);for(let s=0;s<e.length;s++)g[s]=x,"del"!==e[s].kind&&(x=(null!=(r=e[s].newNo)?r:x)+1);let p=[];for(let s=0;s<e.length;){if("ctx"===e[s].kind){s++;continue}let t=s;for(;s<e.length&&"ctx"!==e[s].kind;)s++;p.push([t,s-1])}for(let[i,c]of p){let r=l.length,m=1/0,p=-1/0;for(let l=i;l<=c;){if("ctx"===e[l].kind){l++;continue}let i=[],o=[];for(;l<=c&&"del"===e[l].kind;)i.push(e[l++]);for(;l<=c&&"add"===e[l].kind;)o.push(e[l++]);o.forEach((e,t)=>{let n=e.newNo;s.set(n,t<i.length?"mod":"add"),a.set(n,r),m=Math.min(m,n),p=Math.max(p,n)});let d=o.length?o[o.length-1].newNo+1:l<e.length?g[l]:x;i.length>o.length&&(t.add(d),n.set(d,r),m=Math.min(m,d),p=Math.max(p,d))}let j=i;for(let s=0;s<3&&j>0&&"ctx"===e[j-1].kind;s++)j--;let f=c;for(let s=0;s<3&&f<e.length-1&&"ctx"===e[f+1].kind;s++)f++;let b=e.slice(j,f+1),v=b.filter(e=>void 0!==e.oldNo),N=b.filter(e=>void 0!==e.newNo);l.push({from:m,to:p,view:{header:"@@ -".concat(null!=(h=null==(o=v[0])?void 0:o.oldNo)?h:0,",").concat(v.length," +").concat(null!=(u=null==(d=N[0])?void 0:d.newNo)?u:0,",").concat(N.length," @@"),section:"",lines:b}})}}return{lines:s,removedBefore:t,blockOfLine:a,blockOfRemoval:n,groups:l}}(K):null,[K]),$=i.lastIndexOf("/"),H=$>=0?i.slice(0,$+1):"",B=i.slice($+1);return(0,a.jsxs)("section",{className:"gx-preview","aria-label":i,children:[(0,a.jsxs)("header",{className:"gx-phead",children:[(0,a.jsxs)("div",{className:"gx-ptitle",children:[(0,a.jsxs)("span",{className:"gx-path mono",title:i,children:[(0,a.jsx)("span",{className:"dir",children:H}),(0,a.jsx)("b",{children:B})]}),c&&(0,a.jsx)("span",{className:"gx-chip soft",title:g("git.ignored.hint"),children:g("git.ignored.chip")}),r&&(0,a.jsx)("span",{className:"gx-chip st-".concat(r.status),children:g("git.status.".concat(r.status))}),(null==r?void 0:r.staged)&&(0,a.jsx)("span",{className:"gx-chip soft",children:g("git.staged")}),(null==r?void 0:r.unstaged)&&"untracked"!==r.status&&(0,a.jsx)("span",{className:"gx-chip soft",children:g("git.unstaged")}),r&&(null!==r.additions||null!==r.deletions)&&(0,a.jsxs)("span",{className:"gx-counts",children:[(0,a.jsxs)("i",{className:"add",children:["+",null!=(s=r.additions)?s:0]}),(0,a.jsxs)("i",{className:"del",children:["−",null!=(t=r.deletions)?t:0]})]}),C&&!r&&(0,a.jsx)("span",{className:"muted small",children:(0,O.zi)(C.size)})]}),(0,a.jsxs)("div",{className:"gx-ptools",children:[r&&(0,a.jsx)(E.$q,{value:b,onChange:v,options:[{id:"diff",label:g("git.view.diff")},{id:"file",label:g("git.view.file")}]}),"diff"===b&&r&&(0,a.jsx)(E.$q,{value:N,onChange:y,options:[{id:"unified",label:g("git.layout.unified")},{id:"split",label:g("git.layout.split")}]}),!T&&!c&&(null==r?void 0:r.status)!=="deleted"&&(null==r?void 0:r.status)!=="untracked"&&(null==r?void 0:r.status)!=="conflict"&&(()=>{let e=x&&"file"===b;return(0,a.jsx)("button",{type:"button",className:"btn sm ".concat(e?"primary":""),"aria-pressed":e,title:g("git.blame.hint"),onClick:()=>{"file"!==b?(v("file"),p(!0)):p(e=>!e)},children:g("git.blame")})})(),r&&"conflict"!==r.status&&(0,a.jsxs)("button",{type:"button",className:"btn sm",title:g("git.discard.hint"),onClick:()=>h(r),children:[(0,a.jsx)(eu.A,{size:14}),g("git.discard")]}),(0,a.jsx)(F.WQ,{text:i,label:g("git.copyPath")})]})]}),(null==r?void 0:r.oldPath)&&(0,a.jsx)("div",{className:"gx-banner",children:g("git.renamedFrom",{path:r.oldPath})}),(0,a.jsx)("div",{className:"gx-body",children:A?(0,a.jsx)("p",{className:"gx-note err",children:A}):!M||I||C?"diff"===b&&r?I?I.binary?(0,a.jsx)("p",{className:"gx-note",children:g("git.diff.binary")}):0===I.hunks.length?(0,a.jsx)("p",{className:"gx-note",children:g("git.diff.empty")}):(0,a.jsxs)(a.Fragment,{children:[(null==k?void 0:k.truncated)&&(0,a.jsx)("div",{className:"gx-banner",children:g("git.diff.truncated")}),(0,a.jsx)(sh,{parsed:I,layout:N,path:i,cutOff:!!(null==k?void 0:k.truncated),onDiscardHunk:(null==r?void 0:r.status)==="modified"?(e,s)=>u(i,e,s):void 0,onDiscardLines:(null==r?void 0:r.status)==="modified"?(e,s,t)=>m(i,e,s,t):void 0})]}):null:T&&!P&&(null==r?void 0:r.status)!=="deleted"?(0,a.jsx)("div",{className:"gx-image",children:(0,a.jsx)("img",{src:"/api/agents/".concat(n.id,"/git/raw?path=").concat(encodeURIComponent(i),"&v=").concat(o),alt:B,onError:()=>_(!0)})}):C&&C.path===i?(0,a.jsx)(sW,{f:C,agent:n,blame:x,onOpenCommit:d,marks:U,allNew:q}):T&&P?(0,a.jsx)("p",{className:"gx-note",children:g("git.file.binary")}):null:(0,a.jsx)("p",{className:"gx-note",children:g("git.loading")})})]})}function sq(e){var s,t,n,i,c,r,o;let{agent:d,git:h}=e,{t:u}=(0,D.s9)(),{status:m,tree:g,loading:x,error:p,refresh:b}=h,[v,N]=(0,l.useState)(null),[y,k]=(0,l.useState)(new Set),[w,C]=(0,l.useState)(""),[A,z]=(0,l.useState)(!1),[M,R]=(0,l.useState)(!1),[P,_]=(0,l.useState)("files"),[T,I]=(0,l.useState)(null),[L,W]=(0,l.useState)(null),[q,K]=(0,l.useState)(!1),[U,$]=(0,l.useState)(null),[H,B]=(0,l.useState)(!1),[G,Q]=(0,l.useState)(null),[Y,X]=(0,l.useState)(!1),V=function(e,s){let{t}=(0,D.s9)(),a=(0,E.dj)(),[n,i]=(0,l.useState)(null),[c,r]=(0,l.useState)(null),o=async function(n,l,c){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};i(n),r(null);try{var d,h,u;let n=await j.F.post("/agents/".concat(e.id,"/git/").concat(c),o),i=null!=(u=(null!=(h=n.output)?h:"").split("\n").filter(Boolean).pop())?u:"",r=["conflicts"===n.pending?t("git.pending.conflicts"):"",(null==(d=n.kept)?void 0:d.length)?t("git.sw.kept",{count:n.kept.length,names:n.kept.slice(0,3).join(", ")}):""].filter(Boolean).join(" — ");return a(r?"".concat(l," — ").concat(r):i&&i.length<90?"".concat(l," — ").concat(i):l),await s(),!0}catch(a){let e=a instanceof Error?a.message:"error";return r({title:t("git.notice.failed",{action:l}),text:e,diverged:/fast-forward|divergent/i.test(e)}),await s(),!1}finally{i(null)}};return{busy:n,notice:c,setNotice:r,run:o}}(d,()=>b()),[Z,ee]=(0,l.useState)(null),et=e7(),ea=(0,l.useRef)(new Set),en=(0,l.useRef)(null),el=m&&m.isRepo?m:null,ei=g&&g.isRepo?g.files:null,ec=g&&g.isRepo?g.ignored:null,[er,eo]=(0,l.useState)({});(0,l.useEffect)(()=>{eo({})},[d.id,d.effective.cwd]);let ed=(0,l.useMemo)(()=>el&&ei?function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=new Map(s.map(e=>[e.path,e])),l=new Set(e);for(let e of s)l.add(e.path);let i={name:"",path:"",type:"dir",children:[],changed:0,additions:0,deletions:0},c=new Map([["",i]]),r=e=>{let s=c.get(e);if(s)return s;let t=e.lastIndexOf("/"),a=r(t<0?"":e.slice(0,t)),n={name:e.slice(t+1),path:e,type:"dir",children:[],changed:0,additions:0,deletions:0};return a.children.push(n),c.set(e,n),n};for(let e of l){var o,d,h,u;let s=e.lastIndexOf("/");r(s<0?"":e.slice(0,s)).children.push({name:e.slice(s+1),path:e,type:"file",children:[],change:n.get(e),changed:+!!n.has(e),additions:null!=(h=null==(o=n.get(e))?void 0:o.additions)?h:0,deletions:null!=(u=null==(d=n.get(e))?void 0:d.deletions)?u:0})}let m=(e,s,t)=>{var n;if(e.children.some(e=>e.path===s))return;let l={name:s.slice(s.lastIndexOf("/")+1),path:s,type:t?"dir":"file",children:[],ignored:!0,lazy:t&&!(s in a),changed:0,additions:0,deletions:0};if(e.children.push(l),t&&c.set(s,l),t)for(let e of null!=(n=a[s])?n:[])m(l,"".concat(s,"/").concat(e.name),e.dir)};for(let e of t){let s=e.endsWith("/"),t=s?e.slice(0,-1):e,a=t.lastIndexOf("/");m(r(a<0?"":t.slice(0,a)),t,s)}let g=e=>{for(let s of(e.children.sort((e,s)=>e.type===s.type?e.name.localeCompare(s.name):"dir"===e.type?-1:1),e.children))"dir"===s.type&&g(s),e.changed+=(s.type,s.changed),e.additions+=s.additions,e.deletions+=s.deletions;e.children=e.children.map(e=>{let s=e;for(;"dir"===s.type&&1===s.children.length&&"dir"===s.children[0].type;){let e=s.children[0];s={...e,name:"".concat(s.name,"/").concat(e.name)}}return s})};return g(i),i}(ei,el.changes,et.showIgnored&&null!=ec?ec:[],er):null,[el,ei,ec,er,et.showIgnored]),eh=(0,l.useMemo)(()=>{let e=(null!=ec?ec:[]).map(e=>e.replace(/\/$/,""));return s=>e.some(e=>s===e||s.startsWith("".concat(e,"/")))},[ec]),ej=(0,l.useMemo)(()=>{var e;return new Map((null!=(e=null==el?void 0:el.changes)?e:[]).map(e=>[e.path,e]))},[el]),ef=(0,l.useMemo)(()=>{var e;return(null!=(e=null==el?void 0:el.changes)?e:[]).reduce((e,s)=>{var t,a;return{add:e.add+(null!=(t=s.additions)?t:0),del:e.del+(null!=(a=s.deletions)?a:0)}},{add:0,del:0})},[el]);(0,l.useEffect)(()=>{if(!ed)return;let e=new Set,s=t=>{for(let n of t.children)if("dir"===n.type){var a;!ea.current.has(n.path)&&(n.changed>0||0===ea.current.size&&(null!=(a=null==ei?void 0:ei.length)?a:0)<=40)&&e.add(n.path),s(n)}};s(ed);let t=e=>{for(let s of e.children)"dir"===s.type&&(ea.current.add(s.path),t(s))};t(ed),e.size&&k(s=>new Set([...s,...e]))},[ed]),(0,l.useEffect)(()=>{var e;ed&&null===v&&(null==el?void 0:el.changes.length)&&N((null!=(e=el.changes.find(e=>"conflict"===e.status))?e:el.changes[0]).path)},[ed]),(0,l.useEffect)(()=>{let e=!1;return j.F.get("/agents/".concat(d.id,"/git/stashes")).then(s=>{e||(I(s),W(e=>{var t,a;return e&&s.some(s=>s.sha===e)?e:null!=(a=null==(t=s[0])?void 0:t.sha)?a:null}))}).catch(()=>void 0),()=>{e=!0}},[d.id,null==el?void 0:el.generatedAt]);let eb=(0,l.useMemo)(()=>ed?function(e,s,t){let a=t.query.trim().toLowerCase(),n=e=>(!t.onlyChanged||0!==e.changed)&&(!a||("file"===e.type?e.path.toLowerCase().includes(a):e.children.some(n))),l=[],i=(e,c)=>{for(let r of e.children)n(r)&&(l.push({node:r,depth:c}),"dir"===r.type&&(a||t.onlyChanged||s.has(r.path))&&i(r,c+1))};return i(e,0),l}(ed,y,{query:w,onlyChanged:A}):[],[ed,y,w,A]),ev=eb.slice(0,2e3);if(p&&!m)return(0,a.jsx)("div",{className:"gx",children:(0,a.jsxs)("div",{className:"gx-empty",children:[(0,a.jsx)("h3",{children:u("git.error.title")}),(0,a.jsx)("p",{children:p}),(0,a.jsx)("button",{className:"btn",onClick:()=>void b(),children:u("git.refresh")})]})});if(!m)return(0,a.jsx)("div",{className:"gx",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:u("git.loading")})})});if(!m.isRepo)return(0,a.jsx)("div",{className:"gx",children:(0,a.jsxs)("div",{className:"gx-empty",children:[(0,a.jsx)(em.A,{size:26,className:"muted"}),(0,a.jsx)("h3",{children:"not-repo"===m.reason?u("git.notRepo.title"):"no-git"===m.reason?u("git.noGit.title"):u("git.error.title")}),(0,a.jsx)("p",{children:"not-repo"===m.reason?u("git.notRepo.body",{path:m.cwd.replace(/^\/home\/[^/]+/,"~")}):"no-git"===m.reason?u("git.noGit.body"):m.message}),(0,a.jsxs)("button",{className:"btn",onClick:()=>void b(),children:[(0,a.jsx)(eg.A,{size:14}),u("git.refresh")]})]})});let eN=v?ej.get(v):void 0,ey=e=>V.run("switch",e.carried?u("git.done.switchCarried",{branch:e.to,count:e.carried}):u("git.done.switch",{branch:e.to}),e.overlap.length||e.collisions.length?"switch-smart":"switch",{branch:e.to}),ek=async e=>{try{let s=await j.F.get("/agents/".concat(d.id,"/git/switch-plan?branch=").concat(encodeURIComponent(e)));s.others.length||s.selfRunning?$(s):await ey(s)}catch(s){V.setNotice({title:u("git.notice.failed",{action:u("git.done.switch",{branch:e})}),text:s instanceof Error?s.message:"error",diverged:!1})}},ew=e=>e.filter(e=>"untracked"===e.status||"added"===e.status&&!e.oldPath).map(e=>e.path),eC=new Date(m.generatedAt).toLocaleTimeString((0,D.VR)());return(0,a.jsxs)("div",{className:"gx","data-gx-theme":et.theme,style:{"--g-tab":et.tabSize},children:[(0,a.jsxs)("div",{className:"gx-bar",children:[(0,a.jsxs)("button",{type:"button",className:"gx-branch","aria-expanded":M,"aria-controls":"gx-info",title:u("git.info.toggle"),onClick:()=>R(e=>!e),children:[(0,a.jsx)(ex.A,{size:14}),(0,a.jsx)("span",{className:"bn",children:null!=(i=m.branch)?i:m.head?"".concat(u("git.detached")," ").concat(m.head.sha):u("git.noCommitsBranch")}),m.head&&(0,a.jsx)("span",{className:"sha",children:m.head.sha}),m.upstream&&(m.upstream.ahead>0||m.upstream.behind>0)&&(0,a.jsxs)("span",{className:"ab",title:u("git.upstream"),children:[m.upstream.ahead>0&&"↑".concat(m.upstream.ahead),m.upstream.ahead>0&&m.upstream.behind>0&&" ",m.upstream.behind>0&&"↓".concat(m.upstream.behind)]}),M?(0,a.jsx)(J.A,{size:14}):(0,a.jsx)(S.A,{size:14})]}),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("span",{className:"gx-sum",children:0===m.changes.length?(0,a.jsx)("span",{className:"muted",children:u("git.clean")}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("b",{children:u("git.summary",{count:m.changes.length})})," ",(0,a.jsxs)("i",{className:"add",children:["+",(0,O._E)(ef.add)]})," ",(0,a.jsxs)("i",{className:"del",children:["−",(0,O._E)(ef.del)]})]})}),(0,a.jsx)(sR,{agent:d,a:V,current:m.branch,onSwitch:e=>void ek(e)}),(0,a.jsx)(sF,{a:V,ahead:null!=(c=null==(s=m.upstream)?void 0:s.ahead)?c:0,behind:null!=(r=null==(t=m.upstream)?void 0:t.behind)?r:0,detached:!m.branch,changeCount:m.changes.length,onCommit:()=>X(!0)}),(0,a.jsx)("button",{className:"btn ghost icon sm",disabled:!!V.busy||0===m.changes.length||!!m.state,onClick:()=>{let e=ew(m.changes);ee({files:e,all:!0,summary:{restore:m.changes.length-e.length,add:ef.add,del:ef.del},go:async()=>{let e=await V.run("discard-all",u("git.done.discard"),"discard-all");return e&&N(null),e}})},"aria-label":u("git.discard.all"),title:m.state?u("git.discard.all.blocked"):u("git.discard.all"),children:(0,a.jsx)(eu.A,{size:15})}),(0,a.jsx)(sa,{}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>void b(),"aria-label":u("git.refresh"),title:"".concat(u("git.refresh")," \xb7 ").concat(u("git.updated",{time:eC})),children:(0,a.jsx)(eg.A,{size:15,className:x?"spin":""})})]}),M&&(0,a.jsxs)("dl",{id:"gx-info",className:"gx-info",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:u("git.info.branch")}),(0,a.jsxs)("dd",{className:"mono",children:[null!=(o=m.branch)?o:m.head?"".concat(u("git.detached")," ").concat(m.head.sha):u("git.noCommitsBranch"),m.branch&&(0,a.jsx)(F.WQ,{text:m.branch,label:u("git.info.copyBranch")})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:u("git.info.upstreamLabel")}),(0,a.jsx)("dd",{children:m.upstream?0===m.upstream.ahead&&0===m.upstream.behind?u("git.info.inSync"):u("git.info.upstreamStatus",{ahead:m.upstream.ahead,behind:m.upstream.behind}):(0,a.jsx)("span",{className:"muted",children:u("git.info.noUpstream")})})]}),m.head?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:u("git.info.commit")}),(0,a.jsxs)("dd",{className:"mono",children:[m.head.sha,(0,a.jsx)(F.WQ,{text:m.head.sha,label:u("git.info.copySha")})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:u("git.info.message")}),(0,a.jsx)("dd",{className:"msg",children:m.head.subject||(0,a.jsx)("span",{className:"muted",children:"—"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:u("git.info.author")}),(0,a.jsx)("dd",{children:m.head.author})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:u("git.info.when")}),(0,a.jsxs)("dd",{children:[(0,O.v7)(m.head.when)," ",(0,a.jsxs)("span",{className:"muted",children:["\xb7 ",(0,f.KN)(Date.parse(m.head.when))]})]})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:u("git.info.commit")}),(0,a.jsx)("dd",{className:"muted",children:u("git.noCommits")})]})]}),"running"===d.status&&(0,a.jsx)("div",{className:"gx-warn",children:u("git.warn.running",{name:d.name})}),m.state&&(()=>{let e=m.changes.filter(e=>"conflict"===e.status),s="merge"===m.state?u("git.state.merge"):"rebase"===m.state?u("git.state.rebase"):u("git.state.stash");return(0,a.jsxs)("div",{className:"gx-state",role:"status",children:[(0,a.jsx)("b",{children:s}),(0,a.jsxs)("span",{className:"grow",children:["stash"===m.state&&m.stash&&(0,a.jsxs)(a.Fragment,{children:[u("git.state.stash.hint",{from:m.stash.from,to:m.stash.to})," \xb7 "]}),e.length>0?u("git.state.conflicts",{count:e.length}):u("git.state.ready")]}),0===e.length&&("merge"===m.state?(0,a.jsx)("button",{className:"btn primary sm",disabled:!!V.busy,onClick:()=>X(!0),children:u("git.state.finishMerge")}):"rebase"===m.state?(0,a.jsx)("button",{className:"btn primary sm",disabled:!!V.busy,onClick:()=>void V.run("continue",u("git.done.rebaseContinue"),"rebase-continue"),children:u("git.state.continueRebase")}):(0,a.jsx)("button",{className:"btn primary sm",disabled:!!V.busy,onClick:()=>void V.run("smart",u("git.done.smartFinish"),"smart-finish"),children:u("git.state.finishStash")})),"stash"===m.state?(0,a.jsx)("button",{className:"btn sm danger",disabled:!!V.busy,onClick:()=>B(!0),children:u("git.state.cancelStash")}):(0,a.jsx)("button",{className:"btn sm danger",disabled:!!V.busy,onClick:()=>void V.run("abort",u("git.done.mergeAbort"),"merge-abort"),children:"merge"===m.state?u("git.state.abortMerge"):u("git.state.abortRebase")})]})})(),(0,a.jsx)(sE,{a:V}),m.scope&&(0,a.jsx)("div",{className:"gx-scope",children:u("git.scope",{path:m.scope})}),(0,a.jsxs)("div",{className:"gx-main",children:[(0,a.jsxs)("aside",{className:"gx-tree","aria-label":u("git.filesLabel"),children:[(0,a.jsx)("div",{className:"gx-tabs",children:(0,a.jsx)(E.$q,{value:P,onChange:_,options:[{id:"files",label:u("git.tab.files")},{id:"history",label:u("git.tab.history")},{id:"stashes",label:"".concat(u("git.tab.stashes")).concat((null==T?void 0:T.length)?" \xb7 ".concat(T.length):"")}]})}),"stashes"===P?(0,a.jsx)(sy,{stashes:T,sel:L,onSelect:W,onSave:()=>K(!0),canSave:m.changes.length>0&&!m.state}):"history"===P?(0,a.jsx)(s_,{agent:d,head:null==(n=m.head)?void 0:n.sha,sel:G,onSelect:Q}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"gx-filter",children:[(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(es.A,{size:14}),(0,a.jsx)("input",{className:"input",placeholder:u("git.filterPlaceholder"),value:w,onChange:e=>C(e.target.value),"aria-label":u("git.filterPlaceholder")})]}),(0,a.jsx)(E.$q,{value:A?"changed":"all",onChange:e=>z("changed"===e),options:[{id:"all",label:u("git.filter.all")},{id:"changed",label:"".concat(u("git.filter.changed")).concat(m.changes.length?" \xb7 ".concat(m.changes.length):"")}]})]}),(0,a.jsxs)("div",{className:"gx-list",ref:en,onKeyDown:e=>{var s,t,a,n;let l=[...null!=(t=null==(s=en.current)?void 0:s.querySelectorAll("[data-row]"))?t:[]],i=l.indexOf(document.activeElement);if("ArrowDown"===e.key)e.preventDefault(),null==(a=l[Math.min(l.length-1,i+1)])||a.focus();else if("ArrowUp"===e.key)e.preventDefault(),null==(n=l[Math.max(0,i-1)])||n.focus();else if(i>=0&&("ArrowRight"===e.key||"ArrowLeft"===e.key)){let s=l[i];if("1"!==s.dataset.dir)return;let t="true"===s.getAttribute("aria-expanded");("ArrowRight"===e.key&&!t||"ArrowLeft"===e.key&&t)&&(e.preventDefault(),s.click())}},role:"tree",children:[ed?0===ev.length?(0,a.jsx)("p",{className:"gx-note",children:w?u("git.noMatch",{query:w}):A?u("git.clean"):u("git.noFiles")}):ev.map(e=>{var s,t;let{node:n,depth:l}=e,i="dir"===n.type,c=i&&(w||A||y.has(n.path)),r=n.change;return(0,a.jsxs)("button",{"data-row":!0,"data-dir":i?"1":"0","data-path":n.path,type:"button",role:"treeitem","aria-level":l+1,"aria-expanded":i?!!c:void 0,"aria-selected":!i&&v===n.path,className:"gx-row ".concat(i?"dir":"file"," ").concat(n.ignored?"ignored":""," ").concat(r?"changed st-".concat(r.status):""," ").concat(!i&&v===n.path?"sel":""," ").concat(i&&n.changed?"has-changes":""),style:{paddingLeft:8+14*l},title:n.ignored?"".concat(n.path," — ").concat(u("git.ignored.hint")):n.path,onClick:()=>{let e;return i?void(e=n.path,k(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t}),n.ignored&&n.lazy&&!(n.path in er)&&j.F.get("/agents/".concat(d.id,"/git/ls?path=").concat(encodeURIComponent(n.path))).then(e=>eo(s=>({...s,[n.path]:e.entries}))).catch(()=>eo(e=>({...e,[n.path]:[]})))):N(n.path)},children:[(0,a.jsx)("span",{className:"chev",children:i?c?(0,a.jsx)(J.A,{size:14}):(0,a.jsx)(S.A,{size:14}):null}),(0,a.jsx)("span",{className:"ico",children:i?c?(0,a.jsx)(ep.A,{size:15}):(0,a.jsx)(em.A,{size:15}):(0,a.jsx)(sL,{name:n.name})}),(0,a.jsx)("span",{className:"nm",children:n.name}),i&&n.changed>0&&(0,a.jsx)("span",{className:"dirdot",title:u("git.dirChanged",{count:n.changed}),children:n.changed}),r&&(0,a.jsxs)("span",{className:"meta",children:[(null!==r.additions||null!==r.deletions)&&(0,a.jsxs)("span",{className:"gx-counts sm",children:[(0,a.jsxs)("i",{className:"add",children:["+",null!=(s=r.additions)?s:0]}),(0,a.jsxs)("i",{className:"del",children:["−",null!=(t=r.deletions)?t:0]})]}),(0,a.jsx)(sm,{status:r.status,titled:!0})]})]},"".concat(n.ignored?"i:":"").concat(n.path))}):(0,a.jsx)("p",{className:"gx-note",children:u("git.loading")}),eb.length>ev.length&&(0,a.jsx)("p",{className:"gx-note",children:u("git.rowsCapped",{count:ev.length})}),(null==g?void 0:g.isRepo)&&g.truncated&&(0,a.jsx)("p",{className:"gx-note",children:u("git.treeTruncated",{count:g.files.length})})]})]})]}),"stashes"===P?(null==T?void 0:T.find(e=>e.sha===L))?(0,a.jsx)(sw,{agent:d,stash:T.find(e=>e.sha===L),a:V},L):(0,a.jsx)("div",{className:"gx-preview",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:u("git.stash.empty")})})}):"history"===P?G?(0,a.jsx)(sK,{agent:d,sha:G},G):(0,a.jsx)("div",{className:"gx-preview",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:u("git.hist.select")})})}):v&&(null==eN?void 0:eN.status)==="conflict"?(0,a.jsx)(sj,{agent:d,path:v,state:m.state,a:V,onResolved:()=>{b()}},v):v?(0,a.jsx)(sO,{agent:d,path:v,ignored:eh(v),change:eN,stamp:m.generatedAt,onOpenCommit:e=>{Q(e),_("history")},onDiscard:e=>{var s,t;return ee({files:ew([e]),all:!1,file:{path:e.path,status:e.status,oldPath:e.oldPath,add:null!=(s=e.additions)?s:0,del:null!=(t=e.deletions)?t:0},go:async()=>{let s=await V.run("discard",u("git.done.discard"),"discard",{path:e.path,oldPath:e.oldPath});return s&&ew([e]).length&&N(null),s}})},onDiscardHunk:(e,s,t)=>void V.run("discard-hunk",u("git.done.discard"),"discard-hunk",{path:e,index:s,header:t}),onDiscardLines:(e,s,t,a)=>void V.run("discard-lines",u("git.done.discard"),"discard-lines",{path:e,index:s,header:t,lines:a})},v):(0,a.jsx)("div",{className:"gx-preview",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:u("git.select")})})})]}),U&&(0,a.jsx)(sf,{agent:d,plan:U,a:V,onClose:()=>$(null),onGo:()=>{$(null),ey(U)}}),q&&(0,a.jsx)(sk,{a:V,onClose:()=>K(!1)}),H&&m.stash&&(0,a.jsxs)(E.aF,{title:u("git.state.cancelStash.title"),onClose:()=>B(!1),children:[(0,a.jsx)("p",{className:"muted",style:{margin:0},children:u("git.state.cancelStash.body",{from:m.stash.from})}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:()=>B(!1),children:u("common.cancel")}),(0,a.jsx)("button",{className:"btn danger",disabled:!!V.busy,onClick:()=>{B(!1),V.run("smart",u("git.done.smartCancel"),"smart-cancel")},children:u("git.state.cancelStash.go")})]})]}),Z&&(0,a.jsx)(sT,{files:Z.files,all:Z.all,summary:Z.summary,file:Z.file,busy:!!V.busy,onClose:()=>ee(null),onConfirm:async()=>{let e=Z.go;ee(null),await e()}}),Y&&(0,a.jsx)(sP,{changes:m.changes,a:V,initialMessage:m.mergeMsg,onClose:()=>X(!1)})]})}function sK(e){let{agent:s,sha:t}=e,{t:n}=(0,D.s9)(),[i,c]=(0,l.useState)(null),[r,o]=(0,l.useState)(null),[d,h]=(0,l.useState)(null),[u,m]=(0,l.useState)("unified"),[g,x]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=!1;return c(null),o(null),h(null),x(null),j.F.get("/agents/".concat(s.id,"/git/commit?sha=").concat(t)).then(s=>{var t,a;e||(c(s),o(null!=(a=null==(t=s.files[0])?void 0:t.path)?a:null))}).catch(s=>!e&&x(s instanceof Error?s.message:n("git.loadError"))),()=>{e=!0}},[s.id,t]);let p=null==i?void 0:i.files.find(e=>e.path===r);(0,l.useEffect)(()=>{if(!p)return void h(null);let e=!1;return h(null),j.F.get("/agents/".concat(s.id,"/git/commit-diff?sha=").concat(t,"&path=").concat(encodeURIComponent(p.path)).concat(p.oldPath?"&old=".concat(encodeURIComponent(p.oldPath)):"")).then(s=>!e&&h(s)).catch(s=>!e&&x(s instanceof Error?s.message:n("git.loadError"))),()=>{e=!0}},[s.id,t,null==p?void 0:p.path,null==p?void 0:p.oldPath]);let f=(0,l.useMemo)(()=>d&&p&&d.path===p.path?ej(d.diff):null,[d,p]);if(g)return(0,a.jsx)("section",{className:"gx-preview",children:(0,a.jsx)("p",{className:"gx-note err",children:g})});if(!i)return(0,a.jsx)("section",{className:"gx-preview",children:(0,a.jsx)("p",{className:"gx-note",children:n("git.loading")})});let[b,...v]=i.message.split("\n"),N=v.join("\n").trim();return(0,a.jsxs)("section",{className:"gx-preview gx-commitview","aria-label":b,children:[(0,a.jsxs)("header",{className:"gx-chead",children:[(0,a.jsx)("h3",{children:b}),N&&(0,a.jsx)("pre",{className:"gx-cbody",children:N}),(0,a.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,a.jsx)("span",{className:"mono",children:i.sha.slice(0,10)}),(0,a.jsx)(F.WQ,{text:i.sha,label:n("git.info.copySha")}),(0,a.jsxs)("span",{children:["\xb7 ",i.author," \xb7 ",(0,O.v7)(i.date)]}),(0,a.jsxs)("span",{children:["\xb7 ",n("git.hist.files",{count:i.files.length})]})]})]}),0===i.files.length?(0,a.jsx)("p",{className:"gx-note",children:n("git.hist.noFiles")}):(0,a.jsx)("div",{className:"gx-cfilelist",role:"listbox",children:i.files.map(e=>{var s,t;return(0,a.jsxs)("button",{role:"option","aria-selected":r===e.path,className:"gx-cfile ".concat(r===e.path?"sel":""),onClick:()=>o(e.path),title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:[(0,a.jsx)(sm,{status:e.status}),(0,a.jsx)("span",{className:"mono nm",children:e.path}),(null!==e.additions||null!==e.deletions)&&(0,a.jsxs)("span",{className:"gx-counts sm",children:[(0,a.jsxs)("i",{className:"add",children:["+",null!=(s=e.additions)?s:0]}),(0,a.jsxs)("i",{className:"del",children:["−",null!=(t=e.deletions)?t:0]})]})]},e.path)})}),p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"gx-ptools",style:{padding:"6px 14px"},children:(0,a.jsx)(E.$q,{value:u,onChange:m,options:[{id:"unified",label:n("git.layout.unified")},{id:"split",label:n("git.layout.split")}]})}),(0,a.jsx)("div",{className:"gx-body",children:f?f.binary?(0,a.jsx)("p",{className:"gx-note",children:n("git.diff.binary")}):0===f.hunks.length?(0,a.jsx)("p",{className:"gx-note",children:n("git.diff.empty")}):(0,a.jsxs)(a.Fragment,{children:[(null==d?void 0:d.truncated)&&(0,a.jsx)("div",{className:"gx-banner",children:n("git.diff.truncated")}),(0,a.jsx)(sh,{parsed:f,layout:u,path:p.path})]}):(0,a.jsx)("p",{className:"gx-note",children:n("git.loading")})})]})]})}var sU=t(5300),s$=t(6477),sH=t(2646);function sB(e){let{agent:s}=e,{t}=(0,D.s9)(),{refresh:n}=(0,p.o0)(),i=(0,E.dj)(),[c,r]=(0,l.useState)(null),[o,d]=(0,l.useState)(""),[h,u]=(0,l.useState)(""),[m,g]=(0,l.useState)(!1),[x,b]=(0,l.useState)(!1),v=(0,l.useRef)(""),N=!!c&&o!==v.current,y=(0,l.useRef)(!1);y.current=N;let k=(0,l.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await j.F.get("/agents/".concat(s.id,"/notebook"));r(e=>e&&e.version===t.version&&e.enabled===t.enabled?e:t),(e||!y.current)&&(v.current=t.content,d(t.content))}catch(e){u(e instanceof Error?e.message:String(e))}},[s.id]);(0,l.useEffect)(()=>{r(null),u(""),k(!0)},[s.id,k]),(0,l.useEffect)(()=>{let e=setInterval(()=>{"visible"===document.visibilityState&&k()},4e3);return()=>clearInterval(e)},[k]);let w=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o;if(c){g(!0),u("");try{let a=await j.F.put("/agents/".concat(s.id,"/notebook"),{content:e,version:c.version});r({...c,...a}),v.current=a.content,d(a.content),i(t("notebook.saved"))}catch(e){u(e instanceof Error?e.message:String(e))}g(!1)}},C=async()=>{try{await j.F.patch("/agents/".concat(s.id),{skill_ids:[...new Set([...s.skill_ids,c.skill_id])]}),await n(["agents"]),await k(!0)}catch(e){u(e instanceof Error?e.message:String(e))}};if(!c)return(0,a.jsx)("div",{className:"pane",children:(0,a.jsx)("p",{className:"hint",children:h||t("git.loading")})});let S=o.length,A=S>c.max,z=S>.8*c.max;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"pane",children:[(0,a.jsx)("p",{className:"hint",style:{margin:0},children:t("notebook.intro")}),!c.enabled&&(0,a.jsxs)("div",{className:"banner honey",children:[(0,a.jsx)(M.A,{size:16}),(0,a.jsx)("div",{className:"grow",children:t("notebook.off")}),(0,a.jsx)("button",{className:"btn sm",onClick:C,children:t("notebook.on")})]}),h&&(0,a.jsxs)("div",{className:"banner err",children:[(0,a.jsx)(M.A,{size:16}),(0,a.jsx)("div",{className:"grow",children:h}),(0,a.jsxs)("button",{className:"btn sm",onClick:()=>{u(""),k(!0)},children:[(0,a.jsx)(eg.A,{size:13}),t("notebook.reload")]})]}),(0,a.jsxs)("div",{className:"row small muted",style:{justifyContent:"space-between"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)(s$.A,{size:12,style:{verticalAlign:"-1px"}})," ",c.updated_at?t("notebook.updated",{who:t("user"===c.updated_by?"notebook.by.you":"notebook.by.agent"),when:(0,f.KN)(c.updated_at)}):t("notebook.never")]}),(0,a.jsxs)("span",{style:{color:A?"var(--danger, #c0392b)":z?"var(--honey)":void 0},children:[S.toLocaleString()," / ",c.max.toLocaleString()]})]}),(0,a.jsx)(sH.n,{value:o,onChange:d,placeholder:t("notebook.placeholder"),defaultView:"write",minHeight:320})]}),(0,a.jsxs)("div",{className:"savebar col",children:[(0,a.jsx)("span",{className:"muted small",children:N?t("agent.unsavedChanges"):t("agent.allSaved")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("button",{className:"btn danger sm",style:{marginRight:"auto"},disabled:!o.trim()||m,onClick:()=>b(!0),children:[(0,a.jsx)(sN.A,{size:14}),t("notebook.clear")]}),N&&(0,a.jsx)("button",{className:"btn ghost sm",onClick:()=>d(v.current),children:t("common.discard")}),(0,a.jsx)("button",{className:"btn primary sm",disabled:!N||m||A,onClick:()=>void w(),children:t("notebook.save")})]})]}),x&&(0,a.jsxs)(E.aF,{title:t("notebook.clear.title"),onClose:()=>b(!1),children:[(0,a.jsx)("p",{style:{margin:0},className:"muted",children:t("notebook.clear.confirm")}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:()=>b(!1),children:t("common.cancel")}),(0,a.jsx)("button",{className:"btn danger",onClick:()=>{b(!1),w("")},children:t("notebook.clear")})]})]})]})}let sG=()=>Math.max(340,window.innerWidth-80);function sQ(e){let{params:s}=e,{id:t}=(0,l.use)(s);return(0,a.jsx)(sY,{id:t},t)}function sY(e){var s;let{id:t}=e,{t:i}=(0,D.s9)(),{agent:b,agents:v,colonies:N,ready:y,refresh:k}=(0,p.o0)(),w=b(t),C=(0,r.useRouter)(),S=(0,E.dj)(),[A,z]=(0,l.useState)(!1),[M,F]=(0,l.useState)("config"),[R,P]=(0,l.useState)([]),[_,T]=(0,l.useState)(void 0),[I,L]=(0,l.useState)(null),[W,O]=(0,l.useState)("chat"),[q,K]=(0,l.useState)(!1);(0,l.useEffect)(()=>{try{K("1"===localStorage.getItem("hive-switcher-collapsed"))}catch(e){}},[]);let U=()=>K(e=>{try{localStorage.setItem("hive-switcher-collapsed",e?"0":"1")}catch(e){}return!e}),$=function(e,s){var t,a,n;let{finished:i}=(0,p.o0)(),c=null!=(t=null==e?void 0:e.id)?t:"",r=null!=(a=i[c])?a:0,[o,d]=(0,l.useState)(null),[h,u]=(0,l.useState)(null),[m,g]=(0,l.useState)(!1),[x,f]=(0,l.useState)(null),b=(0,l.useRef)(0),v=null!=(n=null==e?void 0:e.effective.cwd)?n:"",N=(null==e?void 0:e.status)==="running",y=(0,l.useCallback)(async e=>{if(!c)return;let s=++b.current;g(!0);try{let[t,a]=await Promise.all([j.F.get("/agents/".concat(c,"/git/status")),e?j.F.get("/agents/".concat(c,"/git/tree")):Promise.resolve(null)]);if(s!==b.current)return;d(t),a&&u(a),f(null)}catch(e){s===b.current&&f(e instanceof Error?e.message:"error")}finally{s===b.current&&g(!1)}},[c]);return(0,l.useEffect)(()=>{u(null),d(null)},[v]),(0,l.useEffect)(()=>{y(s)},[y,s,r,v]),(0,l.useEffect)(()=>{if(!s||!N)return;let e=setInterval(()=>void y(!0),5e3);return()=>clearInterval(e)},[s,N,y]),{status:o,tree:h,loading:m,error:x,refresh:(0,l.useCallback)(()=>y(!0),[y])}}(w,"changes"===W),H=$.status&&$.status.isRepo?$.status.changes.length:0;(0,l.useEffect)(()=>{try{z("1"===localStorage.getItem("hive-cfg-open"))}catch(e){}},[]);let[B,Q]=(0,l.useState)(400);(0,l.useEffect)(()=>{try{let e=Number(localStorage.getItem("hive-cfg-width"));e>=340&&Q(Math.min(e,sG()))}catch(e){}},[]);let Y=e=>{try{localStorage.setItem("hive-cfg-width",String(Math.round(e)))}catch(e){}},J=B>440,V=()=>{let e=J?400:Math.min(sG(),Math.round(window.innerWidth/2));Q(e),Y(e)},Z=(e,s)=>{z(e),s&&F(s);try{localStorage.setItem("hive-cfg-open",e?"1":"0")}catch(e){}},ee=(0,n.A)(w,{onDeleted:()=>C.push("/agents")}),{draft:es,setDraft:et,errors:ea,dirty:en,saving:ei}=ee;if((0,l.useEffect)(()=>{A&&"sessions"===M&&j.F.get("/agents/".concat(t,"/sessions")).then(P).catch(()=>void 0)},[A,M,t,null==w?void 0:w.session_id]),!w)return(0,a.jsxs)("div",{className:"ws ".concat(q?"sw-collapsed":""),children:[(0,a.jsx)(el,{activeId:t,collapsed:q,onToggle:U}),(0,a.jsx)("div",{className:"page",children:y?(0,a.jsxs)("div",{className:"empty",children:[(0,a.jsx)("h3",{children:i("agent.missing.title")}),(0,a.jsx)("p",{children:i("agent.missing.body")}),(0,a.jsx)(c(),{className:"btn",href:"/agents",children:i("agent.missing.back")})]}):null})]});let ec=async e=>{await j.F.post("/agents/".concat(t,"/resume-session"),{session_id:e}),T(void 0),S(i("agent.resumed"))},er=R.filter(e=>"delegation"!==e.kind),eo=R.filter(e=>"delegation"===e.kind);return(0,a.jsxs)("div",{className:"ws ".concat(A?"with-config":""," ").concat(q?"sw-collapsed":""),style:{"--cfg":"".concat(B,"px")},children:[(0,a.jsx)(el,{activeId:t,collapsed:q,onToggle:U}),(0,a.jsxs)("section",{className:"ws-chat",children:[(0,a.jsxs)("header",{className:"ws-head",children:[(0,a.jsx)(c(),{href:"/",className:"btn ghost icon","aria-label":i("agent.backToColony"),children:(0,a.jsx)(o.A,{size:18})}),(0,a.jsx)(E._h,{agent:w}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("h1",{children:w.name}),(0,a.jsxs)("div",{className:"row gap-s wrap",style:{marginTop:3},children:[(0,a.jsx)(E.PW,{role:w.role}),(0,a.jsx)(E.dJ,{provider:w.provider}),(0,a.jsx)("span",{className:"muted small",children:w.model||i("model.cliDefault")}),(0,a.jsx)(E.P5,{status:w.status})]})]}),(0,a.jsxs)("div",{className:"seg",role:"group","aria-label":i("git.tab.label"),children:[(0,a.jsx)("button",{type:"button","aria-pressed":"chat"===W,onClick:()=>O("chat"),children:i("git.tab.chat")}),(0,a.jsxs)("button",{type:"button","aria-pressed":"changes"===W,onClick:()=>O("changes"),children:[i("git.tab.changes"),H>0&&(0,a.jsx)("span",{className:"tabcount",children:H})]})]}),_&&(0,a.jsx)("button",{className:"btn primary sm",onClick:()=>ec(_),disabled:(null==(s=R.find(e=>e.session_id===_))?void 0:s.kind)==="delegation",children:i("agent.makeCurrent")}),_&&(0,a.jsx)("button",{className:"btn sm",onClick:()=>T(void 0),children:i("agent.backToCurrent")}),(0,a.jsxs)("button",{className:"btn sm",onClick:()=>L("new"),disabled:!w.session_id||"running"===w.status,children:[(0,a.jsx)(d.A,{size:14}),i("agent.newConversation")]}),(0,a.jsxs)("button",{className:"btn sm ".concat(A?"primary":""),onClick:()=>Z(!A),"aria-expanded":A,"aria-label":i("colony.agentSettings"),children:[(0,a.jsx)(h.A,{size:14}),i("agent.settings"),en&&(0,a.jsx)("i",{className:"dot run",title:i("agent.unsaved")})]})]}),(0,a.jsxs)("div",{className:"chat-pane",hidden:"chat"!==W,children:[(0,a.jsx)(X,{agent:w,session:_}),(0,a.jsx)(G,{agent:w,sessionOverride:_})]}),"changes"===W&&(0,a.jsx)(sq,{agent:w,git:$})]}),A&&(0,a.jsxs)("aside",{className:"ws-side",children:[(0,a.jsx)("div",{className:"ws-grip",onPointerDown:e=>{e.preventDefault();let s=e.currentTarget;s.setPointerCapture(e.pointerId);let t=B,a=e=>{Q(t=Math.min(sG(),Math.max(340,window.innerWidth-e.clientX)))},n=()=>{s.removeEventListener("pointermove",a),s.removeEventListener("pointerup",n),Y(t)};s.addEventListener("pointermove",a),s.addEventListener("pointerup",n)},onDoubleClick:V,role:"separator","aria-orientation":"vertical","aria-label":i("drawer.resize"),title:i("drawer.resize")}),(0,a.jsxs)("div",{className:"tabs",role:"tablist",style:{padding:"0 12px",position:"sticky",top:0,background:"var(--surface)",zIndex:2},children:[(0,a.jsx)("button",{className:"tab",role:"tab","aria-selected":"config"===M,onClick:()=>F("config"),children:i("agent.tab.config")}),(0,a.jsx)("button",{className:"tab",role:"tab","aria-selected":"notebook"===M,onClick:()=>F("notebook"),children:i("agent.tab.notebook")}),(0,a.jsx)("button",{className:"tab",role:"tab","aria-selected":"sessions"===M,onClick:()=>F("sessions"),children:i("nav.sessions")}),(0,a.jsx)("button",{className:"btn ghost icon sm",style:{marginLeft:"auto",alignSelf:"center"},onClick:V,"aria-label":J?i("drawer.shrink"):i("drawer.expand"),title:J?i("drawer.shrink"):i("drawer.expand"),children:J?(0,a.jsx)(u.A,{size:15}):(0,a.jsx)(m.A,{size:15})}),(0,a.jsx)("button",{className:"btn ghost sm",style:{alignSelf:"center"},onClick:()=>Z(!1),children:i("common.hide")})]}),"config"===M&&es&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"pane",children:(0,a.jsx)(sU.SU,{draft:es,onChange:et,errors:ea,selfId:t})}),(0,a.jsxs)("div",{className:"savebar col",children:[(0,a.jsxs)("span",{className:"muted small",children:[en?i("agent.unsavedChanges"):i("agent.allSaved"),en&&"running"===w.status?" ".concat(i("agent.appliesNextTurn")):""]}),(0,a.jsx)("div",{className:"row",children:ee.actions({size:"sm"})})]})]}),"notebook"===M&&(0,a.jsx)(sB,{agent:w}),"sessions"===M&&(0,a.jsxs)("div",{className:"pane",children:[(0,a.jsx)("p",{className:"hint",style:{margin:0},children:i("agent.sessions.intro",{path:(0,f._1)(w.effective.cwd)})}),(0,a.jsx)("div",{className:"eyebrow",children:i("agent.sessions.conversations")}),0===er.length?(0,a.jsxs)("div",{className:"empty",style:{padding:24},children:[(0,a.jsx)(g.A,{size:22}),(0,a.jsx)("p",{children:i("agent.sessions.empty")})]}):er.map(e=>{let s=e.session_id===w.session_id;return(0,a.jsxs)("div",{className:"card card-pad col",style:{gap:8,borderColor:_===e.session_id?"var(--honey)":void 0},children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("span",{className:"mono grow",children:[e.session_id.slice(0,18),"…"]}),s&&(0,a.jsx)("span",{className:"chip honey",children:i("sessions.current")})]}),(0,a.jsx)("span",{className:"muted small",children:i("agent.sessions.started",{started:(0,f.KN)(e.first_seen),last:(0,f.KN)(e.last_seen)})}),(0,a.jsxs)("div",{className:"row gap-s",children:[(0,a.jsx)("button",{className:"btn sm",onClick:()=>T(s?void 0:e.session_id),children:_===e.session_id?i("agent.sessions.viewing"):i("agent.sessions.read")}),!s&&(0,a.jsx)("button",{className:"btn sm",onClick:()=>ec(e.session_id),children:i("agent.sessions.resume")})]})]},e.session_id)}),eo.length>0&&(0,a.jsx)("div",{className:"eyebrow",style:{marginTop:6},children:i("agent.sessions.delegated")}),eo.map(e=>{var s;return(0,a.jsxs)("div",{className:"card card-pad col",style:{gap:8,borderColor:_===e.session_id?"var(--honey)":void 0},children:[(0,a.jsxs)("div",{className:"row gap-s",children:[(0,a.jsx)(x.A,{size:14,className:"muted"}),(0,a.jsx)("b",{className:"grow",children:i("agent.sessions.from",{name:null!=(s=e.from_name)?s:i("chat.anOrchestrator")})}),(0,a.jsx)("span",{className:"muted small",children:(0,f.KN)(e.last_seen)})]}),e.task&&(0,a.jsx)("span",{className:"small",style:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.task}),(0,a.jsx)("div",{className:"row gap-s",children:(0,a.jsx)("button",{className:"btn sm",onClick:()=>T(_===e.session_id?void 0:e.session_id),children:_===e.session_id?i("agent.sessions.viewing"):i("agent.sessions.read")})})]},e.session_id)})]})]}),ee.deleteModal,"new"===I&&(0,a.jsxs)(E.aF,{title:i("agent.newConvTitle"),onClose:()=>L(null),children:[(0,a.jsx)("p",{style:{margin:0},className:"muted",children:i("agent.newConvBody")}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:()=>L(null),children:i("common.cancel")}),(0,a.jsx)("button",{className:"btn primary",onClick:async()=>{await j.F.post("/agents/".concat(t,"/new-session")),await k(["agents"]),L(null),S(i("agent.newConvStarted"))},children:i("agent.newConvStart")})]})]})]})}}},e=>{e.O(0,[951,463,837,687,351,493,517,850,408,89,358],()=>e(e.s=6054)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[165],{452:(e,s,t)=>{Promise.resolve().then(t.bind(t,7857))},555:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]])},1529:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},1833:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]])},2263:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]])},2705:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},2947:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},3492:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]])},3624:(e,s,t)=>{"use strict";var a=t(6024);t.o(a,"usePathname")&&t.d(s,{usePathname:function(){return a.usePathname}}),t.o(a,"useRouter")&&t.d(s,{useRouter:function(){return a.useRouter}})},5712:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])},5838:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},7857:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>m});var a=t(4799),l=t(1463),d=t.n(l),n=t(3624),r=t(4023),i=t(2947),c=t(8311),h=t(8538),o=t(7890),u=t(632),p=t(1517),x=t(9654);function m(){let{t:e}=(0,x.s9)(),{agents:s,colonies:t,ready:l}=(0,h.o0)(),m=(0,n.useRouter)(),[y,j]=(0,r.useState)(""),[k,g]=(0,r.useState)("all"),[v,b]=(0,r.useState)("all"),[A,M]=(0,r.useState)(!1),f=(0,r.useMemo)(()=>s.filter(e=>("all"===k||e.role===k)&&("all"===v||e.provider===v)&&(!y||"".concat(e.name," ").concat(e.description," ").concat(e.cwd).toLowerCase().includes(y.toLowerCase()))),[s,y,k,v]);return(0,a.jsxs)("div",{className:"page",children:[(0,a.jsxs)("div",{className:"page-head",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{children:e("nav.agents")}),(0,a.jsx)("p",{children:e("agents.subtitle")})]}),(0,a.jsxs)("button",{className:"btn primary",onClick:()=>M(!0),children:[(0,a.jsx)(i.A,{size:16}),e("newAgent.title")]})]}),(0,a.jsxs)("div",{className:"row wrap",style:{marginBottom:16},children:[(0,a.jsxs)("div",{className:"search grow",style:{maxWidth:360},children:[(0,a.jsx)(c.A,{size:16}),(0,a.jsx)("input",{className:"input",placeholder:e("agents.searchPlaceholder"),value:y,onChange:e=>j(e.target.value),"aria-label":e("agents.searchLabel")})]}),(0,a.jsx)(u.$q,{value:k,onChange:g,options:[{id:"all",label:e("common.all")},{id:"orchestrator",label:e("agents.filter.orchestrators")},{id:"worker",label:e("agents.filter.workers")}]}),(0,a.jsx)(u.$q,{value:v,onChange:b,options:[{id:"all",label:e("agents.filter.anyProvider")},...Object.keys(o.xq).map(e=>({id:e,label:o.xq[e].short}))]})]}),l&&0===s.length?(0,a.jsxs)("div",{className:"empty",children:[(0,a.jsx)(u._h,{size:"lg",queen:!0,label:"+"}),(0,a.jsx)("h3",{children:e("agents.empty.title")}),(0,a.jsx)("p",{children:e("agents.empty.body")}),(0,a.jsxs)("button",{className:"btn primary",onClick:()=>M(!0),children:[(0,a.jsx)(i.A,{size:16}),e("newAgent.create")]})]}):0===f.length?(0,a.jsxs)("div",{className:"empty",children:[(0,a.jsx)("h3",{children:e("agents.noMatch.title")}),(0,a.jsx)("p",{children:e("agents.noMatch.body")}),(0,a.jsx)("button",{className:"btn",onClick:()=>{j(""),g("all"),b("all")},children:e("common.clearFilters")})]}):(0,a.jsx)("div",{className:"card",style:{overflow:"hidden"},children:(0,a.jsxs)("table",{className:"table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:e("agents.col.agent")}),(0,a.jsx)("th",{children:e("agents.col.providerModel")}),(0,a.jsx)("th",{children:e("form.colony")}),(0,a.jsx)("th",{children:e("colony.folder")}),(0,a.jsx)("th",{children:e("agents.col.status")}),(0,a.jsx)("th",{children:e("agents.col.updated")})]})}),(0,a.jsx)("tbody",{children:f.map(s=>(0,a.jsxs)("tr",{onClick:()=>m.push("/agents/".concat(s.id)),children:[(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"name-cell",children:[(0,a.jsx)(u._h,{agent:s}),(0,a.jsxs)("div",{children:[(0,a.jsx)("b",{children:(0,a.jsx)(d(),{href:"/agents/".concat(s.id),onClick:e=>e.stopPropagation(),children:s.name})}),(0,a.jsx)("span",{children:s.description||("orchestrator"===s.role?e("agents.orchestratorLine",{count:s.worker_ids.length}):e("role.worker"))})]})]})}),(0,a.jsxs)("td",{children:[(0,a.jsx)("div",{style:{fontWeight:600},children:o.xq[s.provider].label}),(0,a.jsx)("span",{className:"muted small",children:s.model||e("model.cliDefault")})]}),(0,a.jsx)("td",{children:(()=>{let e=t.find(e=>e.id===s.colony_id);return e?(0,a.jsxs)("span",{className:"chip",children:[(0,a.jsx)("i",{className:"cdot",style:{background:e.color||"var(--honey)",margin:0}}),e.name]}):(0,a.jsx)("span",{className:"muted small",children:"—"})})()}),(0,a.jsxs)("td",{className:"mono muted small",children:[(0,o._1)(s.effective.cwd),s.effective.inherited.includes("cwd")?" \xb7":"",s.effective.inherited.includes("cwd")&&(0,a.jsxs)("span",{className:"muted",children:[" ",e("agents.colonyWord")]})]}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsx)(u.PW,{role:s.role}),(0,a.jsx)(u.P5,{status:s.status})]})}),(0,a.jsx)("td",{className:"muted small",children:(0,o.KN)(s.updated_at)})]},s.id))})]})}),A&&(0,a.jsx)(p.b,{onClose:()=>M(!1)})]})}},8148:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]])},8938:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("CodeXml",[["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"}]])},9579:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(4955).A)("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]])}},e=>{e.O(0,[951,463,493,517,408,89,358],()=>e(e.s=452)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[572],{665:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},1553:(e,n,a)=>{Promise.resolve().then(a.bind(a,6269))},2720:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]])},2947:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},4227:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},4910:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]])},4955:(e,n,a)=>{"use strict";a.d(n,{A:()=>o});var t=a(4023);let s=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return n.filter((e,n,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===n).join(" ").trim()};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,t.forwardRef)((e,n)=>{let{color:a="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:r="",children:d,iconNode:h,...m}=e;return(0,t.createElement)("svg",{ref:n,...l,width:i,height:i,stroke:a,strokeWidth:c?24*Number(o)/Number(i):o,className:s("lucide",r),...m},[...h.map(e=>{let[n,a]=e;return(0,t.createElement)(n,a)}),...Array.isArray(d)?d:[d]])}),o=(e,n)=>{let a=(0,t.forwardRef)((a,l)=>{let{className:o,...c}=a;return(0,t.createElement)(i,{ref:l,iconNode:n,className:s("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),o),...c})});return a.displayName="".concat(e),a}},5223:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]])},6269:(e,n,a)=>{"use strict";a.r(n),a.d(n,{default:()=>k});var t=a(4799),s=a(4023),l=a(2947),i=a(5223),o=a(7697),c=a(8538),r=a(7890),d=a(9654),h=a(632),m=a(7356),u=a(8180),p=a(665),x=a(8950),g=a(2720),j=a(3749);function y(e){var n,a,i,o,y,v,k,b,f;let{connection:w,onClose:N}=e,{t:A}=(0,d.s9)(),{agents:C,refresh:S}=(0,c.o0)(),z=(0,h.dj)(),_=!!w,[M,E]=(0,s.useState)(null!=(a=null==w?void 0:w.name)?a:""),[D,q]=(0,s.useState)(null!=(i=null==w?void 0:w.agent_id)?i:""),[F,$]=(0,s.useState)(""),[V,I]=(0,s.useState)(null!=(o=null==w?void 0:w.allowed)?o:[]),[L,H]=(0,s.useState)((null==w?void 0:w.config.lang)==="en"?"en":"es"),[O,B]=(0,s.useState)(null!=(y=null==w?void 0:w.config.on_silent)?y:"notice"),[P,K]=(0,s.useState)((null==w?void 0:w.config.group_mode)==="open"?"open":"mention"),[R,T]=(0,s.useState)(null!=(v=null==w?void 0:w.config.chats)?v:[]),[Z,W]=(0,s.useState)((null!=(k=null==w?void 0:w.config.aliases)?k:[]).join(", ")),[X,G]=(0,s.useState)((null==w?void 0:w.config.files)!==!1),[J,Q]=(0,s.useState)(null!=(b=null==w?void 0:w.config.vision)?b:null),[U,Y]=(0,s.useState)(null==(f=null==w?void 0:w.enabled)||f),[ee,en]=(0,s.useState)(!1),[ea,et]=(0,s.useState)(""),[es,el]=(0,s.useState)({}),[ei,eo]=(0,s.useState)([]),[ec,er]=(0,s.useState)(!1),ed=C.find(e=>e.id===D),eh=null==ed?void 0:ed.effective.permission,em=(null==w||null==(n=w.config.token)?void 0:n.set)?w.config.token.hint:"";(0,s.useEffect)(()=>{w&&j.F.get("/connections/".concat(w.id,"/threads")).then(eo).catch(()=>void 0)},[w]);let eu=(0,s.useMemo)(()=>[...C].sort((e,n)=>e.name.localeCompare(n.name)),[C]),ep=(e,n)=>I(a=>a.map((a,t)=>t===e?{...a,...n}:a)),ex=(e,n)=>T(a=>a.map((a,t)=>t===e?{...a,...n}:a)),eg=async e=>{try{await j.F.patch("/connections/".concat(w.id,"/threads/").concat(e.id),{muted:!e.muted}),eo(n=>n.map(n=>n.id===e.id?{...n,muted:!e.muted}:n))}catch(e){z(e instanceof Error?e.message:String(e),"err")}},ej=async()=>{if(ed)try{let e=ed.effective.inherited.includes("permission")?[...new Set([...ed.overrides,"permission"])]:ed.overrides;await j.F.patch("/agents/".concat(ed.id),{permission:"acceptEdits",overrides:e}),await S(["agents"]),z(A("conn.perm.fixed",{name:ed.name}))}catch(e){et(e instanceof Error?e.message:String(e))}},ey=async()=>{let e={};if(M.trim()||(e.name=A("conn.err.name")),D||(e.agent=A("conn.err.agent")),_||F.trim()||(e.token=A("conn.err.token")),el(e),et(""),Object.keys(e).length)return;en(!0);let n={kind:"telegram",name:M.trim(),agent_id:D,enabled:U,allowed:V.filter(e=>e.id.trim()),config:{...F.trim()?{token:F.trim()}:{},lang:L,on_silent:O,group_mode:P,files:X,vision:J,chats:R.filter(e=>e.id.trim()),aliases:Z.split(",").map(e=>e.trim()).filter(Boolean)}};try{w?await j.F.patch("/connections/".concat(w.id),n):await j.F.post("/connections",n),await S(["connections","agents"]),z(A(_?"conn.saved":"conn.created")),N()}catch(e){et(e instanceof Error?e.message:String(e))}finally{en(!1)}},ev=async()=>{try{let e=await j.F.post("/connections/".concat(w.id,"/test"));z(A("conn.test.ok",{detail:e.detail}))}catch(e){z(e instanceof Error?e.message:A("conn.test.failed"),"err")}},ek=async()=>{try{await j.F.del("/connections/".concat(w.id)),await S(["connections","agents"]),z(A("conn.deleted")),N()}catch(e){z(e instanceof Error?e.message:String(e),"err")}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(h._s,{title:A(_?"conn.edit":"conn.new"),subtitle:A("conn.shared"),onClose:N,footer:(0,t.jsxs)(t.Fragment,{children:[_&&(0,t.jsxs)("button",{className:"btn danger",style:{marginRight:"auto"},onClick:()=>er(!0),children:[(0,t.jsx)(m.A,{size:15}),A("conn.delete")]}),_&&(0,t.jsx)("button",{className:"btn",onClick:ev,disabled:!U,children:A("conn.test")}),(0,t.jsx)("button",{className:"btn ghost",onClick:N,children:A("common.cancel")}),(0,t.jsx)("button",{className:"btn primary",onClick:ey,disabled:ee,children:A(_?"conn.save":"conn.create")})]}),children:[ea&&(0,t.jsxs)("div",{className:"banner err",children:[(0,t.jsx)(u.A,{size:16}),(0,t.jsx)("div",{className:"grow",children:ea})]}),(0,t.jsx)(h.D0,{label:A("conn.kind"),children:(0,t.jsx)(h.$q,{value:"telegram",onChange:()=>void 0,options:[{id:"telegram",label:A("conn.kind.telegram")},{id:"slack",label:A("conn.kind.soon"),disabled:!0}]})}),(0,t.jsx)(h.D0,{label:A("conn.name"),hint:A("conn.name.hint"),error:es.name,children:(0,t.jsx)("input",{className:"input",value:M,onChange:e=>E(e.target.value),placeholder:A("conn.name.placeholder"),autoFocus:!_})}),(0,t.jsx)(h.D0,{label:A("conn.agent"),hint:A("conn.agent.hint"),error:es.agent,children:(0,t.jsxs)("select",{className:"input",value:D,onChange:e=>q(e.target.value),children:[(0,t.jsx)("option",{value:"",children:A("conn.agent.pick")}),eu.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})}),ed&&"plan"===eh&&(0,t.jsxs)("div",{className:"banner err",children:[(0,t.jsx)(u.A,{size:16}),(0,t.jsx)("div",{className:"grow",children:A("conn.perm.plan",{name:ed.name})}),(0,t.jsx)("button",{className:"btn sm",onClick:ej,children:A("conn.perm.fix")})]}),ed&&"bypassPermissions"===eh&&(0,t.jsxs)("div",{className:"banner honey",children:[(0,t.jsx)(u.A,{size:16}),(0,t.jsx)("div",{className:"grow",children:A("conn.perm.full",{name:ed.name})})]}),ed&&"opencode"===ed.provider&&(0,t.jsx)("p",{className:"hint",style:{margin:0},children:A("conn.perm.opencode")}),(0,t.jsx)(h.D0,{label:A("conn.token"),hint:A("conn.token.hint"),error:es.token,children:(0,t.jsx)("input",{className:"input mono",type:"password",autoComplete:"off",value:F,onChange:e=>$(e.target.value),placeholder:em?A("conn.token.keep",{hint:em}):"123456:ABC…"})}),(0,t.jsx)(h.D0,{label:A("conn.allowed"),hint:A("conn.allowed.hint"),children:(0,t.jsxs)("div",{className:"col",style:{gap:8},children:[0===V.length&&(0,t.jsx)("p",{className:"hint",style:{margin:0},children:A("conn.allowed.empty")}),V.map((e,n)=>{var a;return(0,t.jsxs)("div",{className:"row gap-s",style:{alignItems:"center"},children:[(0,t.jsx)("input",{className:"input mono",style:{width:150},value:e.id,onChange:e=>ep(n,{id:e.target.value.replace(/\D/g,"")}),placeholder:A("conn.allowed.id"),"aria-label":A("conn.allowed.id")}),(0,t.jsx)("input",{className:"input grow",value:null!=(a=e.name)?a:"",onChange:e=>ep(n,{name:e.target.value}),placeholder:A("conn.allowed.name"),"aria-label":A("conn.allowed.name")}),(0,t.jsxs)("label",{className:"row gap-s small",title:A("conn.allowed.adminHint"),style:{whiteSpace:"nowrap"},children:[(0,t.jsx)("input",{type:"checkbox",checked:!!e.admin,onChange:e=>ep(n,{admin:e.target.checked})}),A("conn.allowed.admin")]}),(0,t.jsx)("button",{className:"btn ghost icon sm",onClick:()=>I(e=>e.filter((e,a)=>a!==n)),"aria-label":A("conn.allowed.remove"),title:A("conn.allowed.remove"),children:(0,t.jsx)(p.A,{size:15})})]},n)}),(0,t.jsx)("div",{children:(0,t.jsxs)("button",{className:"btn sm",onClick:()=>I(e=>[...e,{id:""}]),children:[(0,t.jsx)(l.A,{size:14}),A("conn.allowed.add")]})}),(0,t.jsx)("p",{className:"hint",style:{margin:0},children:A("conn.allowed.howto")})]})}),(0,t.jsx)(h.D0,{label:A("conn.groups"),children:(0,t.jsxs)("div",{className:"col",style:{gap:10},children:[(0,t.jsx)("p",{className:"hint",style:{margin:0},children:A("conn.groups.hint")}),(0,t.jsx)(h.$q,{value:P,onChange:K,options:[{id:"mention",label:A("conn.mode.mention")},{id:"open",label:A("conn.mode.open")}]}),(0,t.jsx)("p",{className:"hint",style:{margin:0},children:A("conn.mode.".concat(P,".hint"))}),(0,t.jsx)("div",{className:"eyebrow",children:A("conn.chats")}),0===R.length&&(0,t.jsx)("p",{className:"hint",style:{margin:0},children:A("conn.chats.empty")}),R.map((e,n)=>{var a;return(0,t.jsxs)("div",{className:"row gap-s",style:{alignItems:"center"},children:[(0,t.jsx)("input",{className:"input mono",style:{width:190},value:e.id,onChange:e=>ex(n,{id:e.target.value.replace(/[^\d-]/g,"")}),placeholder:A("conn.chats.id"),"aria-label":A("conn.chats.id")}),(0,t.jsx)("input",{className:"input grow",value:null!=(a=e.name)?a:"",onChange:e=>ex(n,{name:e.target.value}),placeholder:A("conn.chats.name"),"aria-label":A("conn.chats.name")}),(0,t.jsx)("button",{className:"btn ghost icon sm",onClick:()=>T(e=>e.filter((e,a)=>a!==n)),"aria-label":A("conn.chats.remove"),title:A("conn.chats.remove"),children:(0,t.jsx)(p.A,{size:15})})]},n)}),(0,t.jsx)("div",{children:(0,t.jsxs)("button",{className:"btn sm",onClick:()=>T(e=>[...e,{id:""}]),children:[(0,t.jsx)(l.A,{size:14}),A("conn.chats.add")]})}),(0,t.jsxs)("p",{className:"hint",style:{margin:0},children:[A("conn.chats.hint")," ",A("conn.chats.howto")]}),(0,t.jsx)(h.D0,{label:A("conn.aliases"),hint:A("conn.aliases.hint"),children:(0,t.jsx)("input",{className:"input",value:Z,onChange:e=>W(e.target.value),placeholder:A("conn.aliases.placeholder")})})]})}),(0,t.jsx)(h.D0,{label:A("conn.files"),hint:A("conn.files.hint"),children:(0,t.jsx)(h.$q,{value:X?"on":"off",onChange:e=>G("on"===e),options:[{id:"on",label:A("common.yes")},{id:"off",label:A("conn.files.off")}]})}),X&&(0,t.jsx)(h.D0,{label:A("conn.vision"),hint:A(J?"conn.vision.hint.other":"conn.vision.hint.agent"),children:(0,t.jsxs)("div",{className:"col",style:{gap:8},children:[(0,t.jsx)(h.$q,{value:J?"other":"agent",onChange:e=>Q("other"===e?{provider:"claude",model:"haiku"}:null),options:[{id:"agent",label:A("conn.vision.agent")},{id:"other",label:A("conn.vision.other")}]}),J&&(0,t.jsxs)("div",{className:"col",style:{gap:8},children:[(0,t.jsx)("select",{className:"input",value:J.provider,onChange:e=>Q({provider:e.target.value,model:""}),"aria-label":A("form.provider"),children:["claude","opencode","kiro"].map(e=>(0,t.jsx)("option",{value:e,children:"claude"===e?"Claude Code":"opencode"===e?"OpenCode":"Kiro"},e))}),(0,t.jsx)(h.CD,{provider:J.provider,value:J.model,onChange:e=>Q({...J,model:e})})]})]})}),(0,t.jsx)(h.D0,{label:A("conn.lang"),children:(0,t.jsx)(h.$q,{value:L,onChange:H,options:[{id:"es",label:A("conn.lang.es")},{id:"en",label:A("conn.lang.en")}]})}),(0,t.jsx)(h.D0,{label:A("conn.silent"),children:(0,t.jsx)(h.$q,{value:O,onChange:B,options:["notice","send_text","ignore"].map(e=>({id:e,label:A("conn.silent.".concat(e))}))})}),(0,t.jsx)(h.D0,{label:A("conn.enabled"),hint:A("conn.enabled.hint"),children:(0,t.jsx)(h.$q,{value:U?"on":"off",onChange:e=>Y("on"===e),options:[{id:"on",label:A("common.yes")},{id:"off",label:A("conn.status.stopped")}]})}),_&&(0,t.jsxs)("div",{className:"col",style:{gap:6},children:[(0,t.jsx)("div",{className:"eyebrow",children:A("conn.threads.title")}),0===ei.length?(0,t.jsx)("p",{className:"hint",style:{margin:0},children:A("conn.threads.empty")}):ei.map(e=>(0,t.jsxs)("div",{className:"row gap-s small",style:{justifyContent:"space-between"},children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("b",{children:e.title||e.external_key})," ",(0,t.jsx)("span",{className:"muted mono",children:e.external_key})]}),(0,t.jsxs)("span",{className:"row gap-s muted",style:{alignItems:"center"},children:[e.muted&&(0,t.jsx)("span",{className:"gx-chip soft",children:A("conn.threads.muted")}),e.last_user?A("conn.threads.last",{user:e.last_user})+" \xb7 ":"",(0,r.KN)(e.last_activity),(0,t.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:()=>eg(e),title:A(e.muted?"conn.threads.unmute":"conn.threads.mute"),"aria-label":A(e.muted?"conn.threads.unmute":"conn.threads.mute"),children:e.muted?(0,t.jsx)(x.A,{size:14}):(0,t.jsx)(g.A,{size:14})})]})]},e.id))]})]}),ec&&(0,t.jsxs)(h.aF,{title:A("conn.deleteTitle",{name:w.name}),onClose:()=>er(!1),children:[(0,t.jsx)("p",{style:{margin:0},className:"muted",children:A("conn.deleteBody")}),(0,t.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,t.jsx)("button",{className:"btn ghost",onClick:()=>er(!1),children:A("common.cancel")}),(0,t.jsx)("button",{className:"btn danger",onClick:ek,children:A("conn.delete")})]})]})]})}let v={connected:"ok",connecting:"run",error:"err",stopped:""};function k(){let{t:e}=(0,d.s9)(),{connections:n,agents:a,ready:m,refresh:u}=(0,c.o0)(),[p,x]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let e=setInterval(()=>void u(["connections"]),5e3);return()=>clearInterval(e)},[u]),(0,t.jsxs)("div",{className:"page",children:[(0,t.jsxs)("div",{className:"page-head",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{children:e("nav.connections")}),(0,t.jsx)("p",{children:e("conn.subtitle")})]}),(0,t.jsxs)("button",{className:"btn primary",onClick:()=>x("new"),children:[(0,t.jsx)(l.A,{size:16}),e("conn.new")]})]}),m&&0===n.length?(0,t.jsxs)("div",{className:"empty",children:[(0,t.jsx)(i.A,{size:28,"aria-hidden":!0}),(0,t.jsx)("h3",{children:e("conn.empty.title")}),(0,t.jsx)("p",{children:e("conn.empty.body")}),(0,t.jsxs)("button",{className:"btn primary",onClick:()=>x("new"),children:[(0,t.jsx)(l.A,{size:16}),e("conn.new")]})]}):(0,t.jsx)("div",{className:"conn-grid",children:n.map(n=>{let s=a.find(e=>e.id===n.agent_id);return(0,t.jsxs)("button",{type:"button",className:"card card-pad conncard",onClick:()=>x(n),children:[(0,t.jsxs)("div",{className:"row gap-s",style:{alignItems:"center"},children:[(0,t.jsx)(o.A,{size:16,"aria-hidden":!0}),(0,t.jsx)("b",{className:"grow",style:{textAlign:"left"},children:n.name}),(0,t.jsxs)("span",{className:"chip",children:[(0,t.jsx)("i",{className:"dot ".concat(v[n.status.state])}),e("conn.status.".concat(n.enabled?n.status.state:"stopped"))]})]}),"error"===n.status.state&&n.enabled&&(0,t.jsx)("p",{className:"small",style:{margin:0,color:"var(--err)",textAlign:"left"},children:n.status.detail}),(0,t.jsx)("div",{className:"row gap-s",style:{alignItems:"center"},children:s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h._h,{agent:s,size:"sm"}),(0,t.jsx)("span",{children:s.name})]}):(0,t.jsx)("span",{className:"muted small",children:e("conn.noAgent")})}),(0,t.jsxs)("div",{className:"muted small",style:{textAlign:"left"},children:["slack"===n.kind?e("conn.kind.slack"):e("conn.kind.telegram"),n.status.detail&&"connected"===n.status.state?" \xb7 ".concat(n.status.detail):""," \xb7 ",e("conn.threads",{count:n.thread_count}),n.status.lastEventAt?" \xb7 ".concat(e("conn.lastEvent",{when:(0,r.KN)(n.status.lastEventAt)})):""]})]},n.id)})}),p&&(0,t.jsx)(y,{connection:"new"===p?void 0:p,onClose:()=>x(null)})]})}},7356:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},7697:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},7756:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},8180:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},8228:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]])},8311:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},8950:(e,n,a)=>{"use strict";a.d(n,{A:()=>t});let t=(0,a(4955).A)("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]])}},e=>{e.O(0,[493,408,89,358],()=>e(e.s=1553)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{665:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},2605:(e,a,t)=>{Promise.resolve().then(t.bind(t,6085)),Promise.resolve().then(t.t.bind(t,9856,23)),Promise.resolve().then(t.t.bind(t,8682,23)),Promise.resolve().then(t.t.bind(t,5151,23)),Promise.resolve().then(t.t.bind(t,7968,23))},3624:(e,a,t)=>{"use strict";var s=t(6024);t.o(s,"usePathname")&&t.d(a,{usePathname:function(){return s.usePathname}}),t.o(s,"useRouter")&&t.d(a,{useRouter:function(){return s.useRouter}})},4227:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},4616:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},4910:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]])},4955:(e,a,t)=>{"use strict";t.d(a,{A:()=>i});var s=t(4023);let l=function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return a.filter((e,a,t)=>!!e&&""!==e.trim()&&t.indexOf(e)===a).join(" ").trim()};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let r=(0,s.forwardRef)((e,a)=>{let{color:t="currentColor",size:r=24,strokeWidth:i=2,absoluteStrokeWidth:d,className:h="",children:c,iconNode:o,...y}=e;return(0,s.createElement)("svg",{ref:a,...n,width:r,height:r,stroke:t,strokeWidth:d?24*Number(i)/Number(r):i,className:l("lucide",h),...y},[...o.map(e=>{let[a,t]=e;return(0,s.createElement)(a,t)}),...Array.isArray(c)?c:[c]])}),i=(e,a)=>{let t=(0,s.forwardRef)((t,n)=>{let{className:i,...d}=t;return(0,s.createElement)(r,{ref:n,iconNode:a,className:l("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),i),...d})});return t.displayName="".concat(e),t}},5151:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_4dc837",variable:"__variable_4dc837"}},5223:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]])},6085:(e,a,t)=>{"use strict";t.d(a,{Shell:()=>N});var s=t(4799),l=t(1463),n=t.n(l),r=t(3624),i=t(4023),d=t(4616),h=t(4955);let c=(0,h.A)("Hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]),o=(0,h.A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),y=(0,h.A)("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);var k=t(5223);let m=(0,h.A)("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]),v=(0,h.A)("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);var p=t(8449);let u=(0,h.A)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),x=(0,h.A)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);var g=t(8538),f=t(9654),j=t(632);function b(){return(0,s.jsx)("img",{src:"/icon.png",width:34,height:34,alt:"","aria-hidden":!0,className:"brand-mark"})}function A(){let{locale:e,setLocale:a,t}=(0,f.s9)();return(0,s.jsxs)("div",{className:"lang-row",role:"group","aria-label":t("lang.label"),children:[(0,s.jsx)(d.A,{size:15,"aria-hidden":!0}),(0,s.jsx)("div",{className:"seg",children:f.YZ.map(t=>(0,s.jsx)("button",{type:"button","aria-pressed":e===t.id,lang:t.id,title:t.name,"aria-label":t.name,onClick:()=>a(t.id),children:t.short},t.id))})]})}function M(){let e=(0,r.usePathname)(),{t:a}=(0,f.s9)(),{agents:t,types:l,skills:d,connections:h,connected:j}=(0,g.o0)(),[M,N]=(0,i.useState)(null);(0,i.useEffect)(()=>{try{let e=localStorage.getItem("hive-theme");e&&(N(e),document.documentElement.dataset.theme=e)}catch(e){}},[]);let w=t.filter(e=>"running"===e.status).length,z=(a,t,l,r)=>{let i="/"===a?"/"===e:e.startsWith(a);return(0,s.jsxs)(n(),{href:a,className:"nav","aria-current":i?"page":void 0,children:[l,(0,s.jsx)("span",{className:"t",children:t}),void 0!==r&&(0,s.jsx)("span",{className:"count",children:r})]},a)};return(0,s.jsxs)("nav",{className:"rail","aria-label":a("nav.main"),children:[(0,s.jsxs)("div",{className:"brand",children:[(0,s.jsx)(b,{}),(0,s.jsxs)("div",{children:["hive-am",(0,s.jsx)("small",{children:a("app.tagline")})]})]}),(0,s.jsx)(A,{}),z("/",a("nav.colony"),(0,s.jsx)(c,{size:18}),w||void 0),z("/agents",a("nav.agents"),(0,s.jsx)(o,{size:18}),t.length),z("/relations",a("nav.relations"),(0,s.jsx)(y,{size:18})),z("/connections",a("nav.connections"),(0,s.jsx)(k.A,{size:18}),h.length||void 0),(0,s.jsx)("div",{className:"nav-label",children:a("nav.library")}),z("/types",a("nav.types"),(0,s.jsx)(m,{size:18}),l.length),z("/skills",a("nav.skills"),(0,s.jsx)(v,{size:18}),d.length),(0,s.jsx)("div",{className:"nav-label",children:a("nav.history")}),z("/sessions",a("nav.sessions"),(0,s.jsx)(p.A,{size:18})),(0,s.jsxs)("div",{className:"rail-foot",children:[(0,s.jsxs)("div",{className:"conn",children:[(0,s.jsx)("i",{className:"dot ".concat(j?"ok":"err")}),a(j?"nav.connected":"nav.offline")]}),(0,s.jsxs)("button",{className:"btn ghost sm",onClick:()=>{let e=(M?"dark"===M:matchMedia("(prefers-color-scheme: dark)").matches)?"light":"dark";N(e),document.documentElement.dataset.theme=e;try{localStorage.setItem("hive-theme",e)}catch(e){}},style:{justifyContent:"flex-start"},children:["dark"===M?(0,s.jsx)(u,{size:15}):(0,s.jsx)(x,{size:15})," ",a("nav.switchTheme")]})]})]})}function N(e){let{children:a}=e;return(0,s.jsx)(f.CY,{children:(0,s.jsx)(g.Of,{children:(0,s.jsx)(j.l$,{children:(0,s.jsxs)("div",{className:"shell",children:[(0,s.jsx)(M,{}),(0,s.jsx)("main",{className:"main",children:a})]})})})})}},7756:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},7968:()=>{},8228:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]])},8311:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},8449:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(4955).A)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},8682:e=>{e.exports={style:{fontFamily:"'Hanken Grotesk', 'Hanken Grotesk Fallback'",fontStyle:"normal"},className:"__className_67a390",variable:"__variable_67a390"}},9856:e=>{e.exports={style:{fontFamily:"'Bricolage Grotesque', 'Bricolage Grotesque Fallback'",fontStyle:"normal"},className:"__className_23d1a5",variable:"__variable_23d1a5"}}},e=>{e.O(0,[91,463,493,408,89,358],()=>e(e.s=2605)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1722:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>I});var n=l(4799),t=l(1463),o=l.n(t),a=l(4023),i=l(2947),r=l(7841),c=l(2098),d=l(665),m=l(4955);let h=(0,m.A)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var u=l(7356),x=l(8538),y=l(3749),p=l(7890),j=l(632),g=l(1517),f=l(2646),v=l(2705),b=l(9654);let k=["#2f8f5b","#d4663f","#2f5bea","#7a4de0","#c0399a","#0f8f9e","#9a7400","#c2412d"],w=["cwd","permission","skills","prompt"];function N(e){let{colony:s,onClose:l}=e,{t}=(0,b.s9)(),{agents:o,skills:i,colonies:r,refresh:c}=(0,x.o0)(),d=(0,j.dj)(),[m,h]=(0,a.useState)(()=>s?{name:s.name,color:s.color,cwd:s.cwd,permission:s.permission,system_prompt:s.system_prompt,skill_ids:s.skill_ids,skill_loads:s.skill_loads,agent_ids:s.agent_ids,inherit:s.inherit}:{name:"",color:k[r.length%k.length],cwd:"",permission:"acceptEdits",system_prompt:"",skill_ids:[],skill_loads:{},agent_ids:[],inherit:{cwd:!0,permission:!0,skills:!0,prompt:!0}}),[p,g]=(0,a.useState)(""),[w,N]=(0,a.useState)(!1),[_,A]=(0,a.useState)(!1),[S,M]=(0,a.useState)(!1),z=(e,s)=>h(l=>({...l,[e]:s})),F=async e=>{M(!0);try{let n={...m,name:m.name.trim(),color:m.color.toLowerCase(),inherit:e};s?await y.F.patch("/colonies/".concat(s.id),n):await y.F.post("/colonies",n),await c(["agents","colonies"]),d(s?t("colony.saved"):t("colony.created")),l()}catch(e){N(!1),g(e instanceof Error?e.message:t("edit.saveFailed")),M(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(j._s,{title:s?t("colony.editTitle",{name:s.name}):t("colony.newTitle"),subtitle:t("colony.subtitle"),onClose:l,footer:(0,n.jsxs)(n.Fragment,{children:[s&&(0,n.jsxs)("button",{className:"btn danger",style:{marginRight:"auto"},onClick:()=>A(!0),children:[(0,n.jsx)(u.A,{size:15}),t("common.delete")]}),(0,n.jsx)("button",{className:"btn ghost",onClick:l,children:t("common.cancel")}),(0,n.jsx)("button",{className:"btn primary",onClick:()=>m.name.trim()?r.some(e=>e.id!==(null==s?void 0:s.id)&&e.name.toLowerCase()===m.name.trim().toLowerCase())?void g(t("colony.err.nameTaken")):/^#[0-9a-f]{6}$/i.test(m.color)?void(g(""),N(!0)):void g(t("colony.err.color")):void g(t("colony.err.name")),children:s?t("colony.save"):t("colony.create")})]}),children:[(0,n.jsx)(j.D0,{label:t("form.name"),error:p,children:(0,n.jsx)("input",{className:"input",value:m.name,onChange:e=>z("name",e.target.value),placeholder:t("colony.name.placeholder"),autoFocus:!0})}),(0,n.jsx)(j.D0,{label:t("colony.color"),children:(0,n.jsxs)("div",{className:"swatches",children:[k.map(e=>(0,n.jsx)("button",{type:"button",className:"swatch",style:{"--c":e},"aria-pressed":m.color.toLowerCase()===e,"aria-label":t("colony.colorOption",{color:e}),onClick:()=>z("color",e)},e)),(0,n.jsx)("label",{className:"swatch custom ".concat(k.includes(m.color.toLowerCase())?"":"on"),style:{"--c":/^#[0-9a-f]{6}$/i.test(m.color)?m.color:"transparent"},title:t("colony.colorCustom"),children:(0,n.jsx)("input",{type:"color",value:/^#[0-9a-f]{6}$/i.test(m.color)?m.color:"#2f8f5b",onChange:e=>z("color",e.target.value),"aria-label":t("colony.colorCustom")})}),(0,n.jsx)("input",{className:"input hex-input mono",value:m.color,maxLength:7,spellCheck:!1,"aria-label":t("colony.colorHex"),placeholder:"#2f8f5b",onChange:e=>{let s=e.target.value.trim();z("color",s.startsWith("#")||!s?s:"#".concat(s))}})]})}),(0,n.jsx)(j.dR,{value:m.cwd,onChange:e=>z("cwd",e)}),(0,n.jsx)(j.en,{value:m.permission,onChange:e=>z("permission",e)}),(0,n.jsx)(j.D0,{label:t("inherit.context"),hint:t("colony.context.hint"),children:(0,n.jsx)(f.n,{value:m.system_prompt,onChange:e=>z("system_prompt",e),placeholder:t("colony.context.placeholder"),defaultView:"write",minHeight:160})}),(0,n.jsx)(j.D0,{label:t("form.skills"),children:(0,n.jsx)(j.kV,{skills:i,value:m.skill_ids,loads:m.skill_loads,onChange:(e,s)=>h({...m,skill_ids:e,skill_loads:s})})}),(0,n.jsx)(j.D0,{label:t("colony.members"),hint:t("colony.members.hint"),children:0===o.length?(0,n.jsx)("p",{className:"hint",children:t("colony.members.empty")}):(0,n.jsx)("div",{className:"skillpick",children:o.map(e=>{let l=m.agent_ids.includes(e.id),o=e.colony_id&&e.colony_id!==(null==s?void 0:s.id)?r.find(s=>s.id===e.colony_id):null;return(0,n.jsxs)("button",{type:"button",className:"skillrow","aria-pressed":l,onClick:()=>z("agent_ids",l?m.agent_ids.filter(s=>s!==e.id):[...m.agent_ids,e.id]),children:[(0,n.jsx)("span",{className:"check",children:l&&(0,n.jsx)(v.A,{size:13,strokeWidth:3})}),(0,n.jsxs)("span",{children:[(0,n.jsx)("b",{style:{fontWeight:600},children:e.name}),(0,n.jsx)("span",{className:"hint",style:{display:"block"},children:o?t("colony.currentlyIn",{name:o.name}):e.description||t("role.".concat(e.role))})]})]},e.id)})})})]}),w&&(0,n.jsx)(C,{draft:m,colony:s,members:o.filter(e=>m.agent_ids.includes(e.id)),busy:S,onBack:()=>N(!1),onConfirm:F}),_&&s&&(0,n.jsxs)(j.aF,{title:t("colony.deleteTitle",{name:s.name}),onClose:()=>A(!1),children:[(0,n.jsx)("p",{style:{margin:0},className:"muted",children:t("colony.deleteBody",{count:s.agent_ids.length})}),(0,n.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,n.jsx)("button",{className:"btn ghost",onClick:()=>A(!1),children:t("colony.keep")}),(0,n.jsx)("button",{className:"btn danger",onClick:async()=>{await y.F.del("/colonies/".concat(s.id)),await c(["agents","colonies"]),d(t("colony.deleted")),l()},children:t("colony.delete")})]})]})]})}function C(e){let{draft:s,colony:l,members:t,busy:o,onBack:i,onConfirm:r}=e,{t:c}=(0,b.s9)(),d={cwd:!!s.cwd,permission:!0,skills:s.skill_ids.length>0,prompt:!!s.system_prompt.trim()},[m,h]=(0,a.useState)(()=>({cwd:(!l||l.inherit.cwd)&&d.cwd,permission:!l||l.inherit.permission,skills:(!l||l.inherit.skills)&&d.skills,prompt:(!l||l.inherit.prompt)&&d.prompt})),u=(0,a.useMemo)(()=>m.cwd&&s.cwd&&t.filter(e=>!e.overrides.includes("cwd")&&e.effective.cwd!==s.cwd).length,[m.cwd,s.cwd,t]);return(0,n.jsxs)(j.aF,{title:c("inheritAsk.title"),onClose:i,children:[(0,n.jsx)("p",{style:{margin:0},className:"muted small",children:c("inheritAsk.intro")}),(0,n.jsx)("div",{className:"col",style:{gap:8},children:w.map(e=>(0,n.jsxs)("label",{className:"checkrow ".concat(d[e]?"":"off"),children:[(0,n.jsx)("input",{type:"checkbox",disabled:!d[e],checked:m[e],onChange:s=>h(l=>({...l,[e]:s.target.checked}))}),(0,n.jsxs)("span",{children:[(0,n.jsxs)("b",{children:[c("inheritAsk.field.".concat(e)),"cwd"===e&&s.cwd?(0,n.jsxs)("span",{className:"muted mono",style:{fontWeight:400},children:[" \xb7 ",(0,p._1)(s.cwd)]}):null,"permission"===e?(0,n.jsxs)("span",{className:"muted",style:{fontWeight:400},children:[" \xb7 ",(0,p.Ck)(s.permission)]}):null]}),(0,n.jsx)("span",{className:"hint",children:d[e]?c("inheritAsk.hint.".concat(e)):c("inheritAsk.empty.".concat(e))})]})]},e))}),u?(0,n.jsx)("div",{className:"banner honey small",children:c("inheritAsk.folderMoves",{count:Number(u)})}):null,(0,n.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,n.jsx)("button",{className:"btn ghost",onClick:i,children:c("common.back")}),(0,n.jsx)("button",{className:"btn primary",disabled:o,onClick:()=>r(m),children:o?c("common.saving"):l?c("colony.save"):c("colony.create")})]})]})}var _=l(5300),A=l(9128);function S(e){let{agent:s,onClose:l}=e,{t}=(0,b.s9)(),o=(0,A.A)(s,{onSaved:l,onDeleted:l});return o.draft?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(j._s,{title:t("edit.title",{name:s.name}),subtitle:t("running"===s.status?"edit.subtitleRunning":"edit.subtitleIdle"),onClose:l,footer:o.actions({onCancel:l}),children:(0,n.jsx)(_.SU,{draft:o.draft,onChange:o.setDraft,errors:o.errors,selfId:s.id})}),o.deleteModal]}):null}var M=l(8776);let z=(0,m.A)("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var F=l(1018);function E(e){let{label:s,title:l,children:t}=e,[o,i]=(0,a.useState)(!1),r=(0,a.useRef)(null),c=(0,a.useRef)(null),d=(0,a.useId)();return(0,F.s)(o,r,()=>i(!1),()=>{var e;return null==(e=c.current)?void 0:e.focus()}),(0,n.jsxs)("span",{className:"help",ref:r,children:[(0,n.jsx)("button",{ref:c,type:"button",className:"help-btn","aria-label":s,title:s,"aria-expanded":o,"aria-controls":d,onClick:()=>i(e=>!e),children:(0,n.jsx)(z,{size:18})}),o&&(0,n.jsxs)("div",{id:d,role:"dialog","aria-label":l,className:"help-pop",children:[(0,n.jsx)("div",{className:"eyebrow",children:l}),(0,n.jsx)("p",{className:"muted small",children:t})]})]})}var L=l(5372);let W=74*Math.sqrt(3),T=[[1,0],[1,-1],[0,-1],[-1,0],[-1,1],[0,1]],q=e=>{let[s,l]=e;return{x:W*(s+l/2),y:111*l}},D=(e,s,l)=>Array.from({length:6},(n,t)=>{let o=(60*t-30)*Math.PI/180;return"".concat((e+l*Math.cos(o)).toFixed(1),",").concat((s+l*Math.sin(o)).toFixed(1))}).join(" ");function I(){var e,s;let{t:l}=(0,b.s9)(),{agents:t,colonies:m,ready:f,refresh:v}=(0,x.o0)(),k=(0,j.dj)(),[w,C]=(0,a.useState)(null),[_,A]=(0,a.useState)(null),z=(0,L.z)(),[F,I]=(0,a.useState)(null),[R,B]=(0,a.useState)(null),[O,H]=(0,a.useState)(null),[P,$]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=()=>y.F.get("/dispatches").then($).catch(()=>void 0);e();let s=setInterval(e,6e3);return()=>clearInterval(s)},[]);let{clusters:V,width:G,height:J}=(0,a.useMemo)(()=>(function(e,s){let l=s.map(s=>({key:s.id,colony:s,members:e.filter(e=>e.colony_id===s.id)}));l.push({key:"free",colony:null,members:e.filter(e=>!e.colony_id||!s.some(s=>s.id===e.colony_id))});let n=[],t=0,o=0,a=0,i=0;for(let s of l){if(!s.members.length&&!s.colony&&e.length>0)continue;let l=function(e){let s=e.filter(e=>"orchestrator"===e.role);for(let l of[...s])for(let n of l.worker_ids){let l=e.find(e=>e.id===n);l&&!s.includes(l)&&s.push(l)}for(let l of e)s.includes(l)||s.push(l);return s}(s.members),r=(function(e){let s=[[0,0]];for(let l=1;s.length<e;l++){let e=T[4][0]*l,n=T[4][1]*l;for(let t=0;t<6;t++)for(let o=0;o<l;o++)s.push([e,n]),e+=T[t][0],n+=T[t][1]}return s.slice(0,e)})(l.length+1).map(q),c=Math.min(...r.map(e=>e.x))-W/2,d=Math.max(...r.map(e=>e.x))+W/2,m=Math.min(...r.map(e=>e.y))-74,h=Math.max(...r.map(e=>e.y))+74,u=d-c+52,x=h-m+52+50;t>0&&t+u>880&&(t=0,o+=a+36,a=0);let y=r.map((e,s)=>{var n;return{agent:null!=(n=l[s])?n:null,x:t+(e.x-c)+26,y:o+(e.y-m)+26+50}});n.push({key:s.key,colony:s.colony,cells:y,x:t,y:o,w:u,h:x}),t+=u+36,a=Math.max(a,x),i=Math.max(i,t-36)}return{clusters:n,width:i,height:o+a}})(t,m),[t,m]),K=(0,a.useRef)(null),[U,Q]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=K.current;if(!e)return;let s=new ResizeObserver(()=>Q(e.clientWidth));return s.observe(e),Q(e.clientWidth),()=>s.disconnect()},[f,0===t.length]);let X=G+80,Y=J+80,Z=U?Math.min(1,(U-24)/X):1,ee=new Map;for(let e of V)for(let s of e.cells)s.agent&&ee.set(s.agent.id,{x:s.x+40,y:s.y+40});let[es,el]=(0,a.useState)(null),en=null!=(e=t.find(e=>e.id===w))?e:null;(0,a.useEffect)(()=>{if(!w)return;let e=e=>{"Escape"!==e.key||document.querySelector('[role="dialog"]')||C(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w]);let et=null!=_?_:w,eo=t.filter(e=>"orchestrator"===e.role).flatMap(e=>e.worker_ids.map(s=>({from:e.id,to:s}))),ea=new Set(et?[et,...eo.filter(e=>e.from===et||e.to===et).flatMap(e=>[e.from,e.to])]:[]),ei=e=>t.filter(s=>"orchestrator"===s.role&&s.worker_ids.includes(e)),er=t.filter(e=>"running"===e.status).length,ec=t.filter(e=>"orchestrator"===e.role).length,ed=e=>{var s,n;return null!=(n=null==(s=t.find(s=>s.id===e))?void 0:s.name)?n:l("colony.removedAgent")},em=en?m.find(e=>e.id===en.colony_id):void 0,eh=async(e,s)=>{try{var n,t;await y.F.patch("/agents/".concat(e.id),{colony_id:s||null,overrides:[]}),await v(["agents","colonies"]),k(s?l("colony.joined",{name:e.name,colony:null!=(t=null==(n=m.find(e=>e.id===s))?void 0:n.name)?t:""}):l("colony.left",{name:e.name}))}catch(e){k(e instanceof Error?e.message:l("colony.moveFailed"),"err")}};return(0,n.jsxs)("div",{className:"page",children:[(0,n.jsxs)("div",{className:"page-head",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"row gap-s",children:[(0,n.jsx)("h1",{children:l("nav.colony")}),(0,n.jsx)(E,{label:l("colony.helpLabel"),title:l("colony.howTitle"),children:l("colony.howBody")})]}),(0,n.jsx)("p",{children:l("colony.page.subtitle")})]}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("button",{className:"btn",onClick:()=>B("new"),children:[(0,n.jsx)(i.A,{size:16}),l("colony.newTitle")]}),(0,n.jsxs)("button",{className:"btn primary",onClick:()=>I({}),children:[(0,n.jsx)(i.A,{size:16}),l("newAgent.title")]})]})]}),(0,n.jsxs)("div",{className:"stats",children:[(0,n.jsxs)("div",{className:"card stat",children:[(0,n.jsx)("b",{children:t.length}),(0,n.jsx)("span",{children:l("stat.agents",{count:t.length})})]}),(0,n.jsxs)("div",{className:"card stat",children:[(0,n.jsx)("b",{children:m.length}),(0,n.jsx)("span",{children:l("stat.colonies",{count:m.length})})]}),(0,n.jsxs)("div",{className:"card stat",children:[(0,n.jsx)("b",{children:ec}),(0,n.jsx)("span",{children:l("stat.orchestrators",{count:ec})})]}),(0,n.jsxs)("div",{className:"card stat",children:[(0,n.jsx)("b",{children:er}),(0,n.jsx)("span",{children:l("stat.working")})]}),(0,n.jsxs)("div",{className:"card stat",children:[(0,n.jsx)("b",{children:P.filter(e=>"running"===e.status).length}),(0,n.jsx)("span",{children:l("stat.tasks")})]})]}),(0,n.jsxs)("div",{className:"colony",children:[(0,n.jsxs)("div",{className:"comb-wrap",ref:K,children:[f?0===t.length&&0===m.length?(0,n.jsxs)("div",{className:"empty",style:{border:0,minHeight:520,justifyContent:"center"},children:[(0,n.jsx)(j._h,{size:"lg",queen:!0,label:"+"}),(0,n.jsx)("h3",{children:l("colony.empty.title")}),(0,n.jsx)("p",{children:l("colony.empty.body")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("button",{className:"btn",onClick:()=>B("new"),children:[(0,n.jsx)(i.A,{size:16}),l("colony.empty.createColony")]}),(0,n.jsxs)("button",{className:"btn primary",onClick:()=>I({}),children:[(0,n.jsx)(i.A,{size:16}),l("colony.empty.createAgent")]})]})]}):(0,n.jsx)("div",{style:{width:X*Z,height:Y*Z,flex:"none"},children:(0,n.jsxs)("div",{className:"comb",style:{width:X,height:Y,transform:"scale(".concat(Z,")"),transformOrigin:"0 0","--w":"".concat(.9*W,"px"),"--h":"".concat(133.20000000000002,"px")},children:[(0,n.jsx)("svg",{className:"links",width:X,height:Y,children:V.filter(e=>e.colony).map(e=>{let s=e.colony.color||"var(--honey)";return(0,n.jsxs)("g",{children:[e.cells.map((e,l)=>(0,n.jsx)("polygon",{points:D(e.x+40,e.y+40,74),style:{fill:s,stroke:s},strokeWidth:44,strokeLinejoin:"round"},"o"+l)),e.cells.map((e,l)=>(0,n.jsx)("polygon",{points:D(e.x+40,e.y+40,74),style:{fill:"color-mix(in srgb, ".concat(s," 9%, var(--surface))"),stroke:"color-mix(in srgb, ".concat(s," 9%, var(--surface))")},strokeWidth:38,strokeLinejoin:"round"},"i"+l))]},e.key)})}),V.map(e=>(0,n.jsxs)("div",{children:[e.colony?(0,n.jsxs)("button",{className:"colony-label",style:{left:e.x+e.w/2+40,top:e.y+50-10+40,"--c":e.colony.color||"var(--honey)"},onClick:()=>B(e.colony),title:e.colony.cwd?l("colony.editHover",{path:(0,p._1)(e.colony.cwd)}):l("colony.editHoverShort"),children:[(0,n.jsx)("i",{className:"cdot"}),e.colony.name,(0,n.jsx)("small",{children:l("colony.agentCount",{count:e.cells.filter(e=>e.agent).length})}),(0,n.jsx)(r.A,{size:13,className:"muted"})]}):m.length>0&&e.cells.some(e=>e.agent)?(0,n.jsx)("span",{className:"colony-label",style:{left:e.x+e.w/2+40,top:e.y+50-10+40,"--c":"var(--line-strong)",boxShadow:"none",background:"transparent"},children:(0,n.jsx)("small",{children:l("common.noColony")})}):null,e.cells.map((s,t)=>{let o=s.agent,a={left:s.x+40,top:s.y+40};return o?(0,n.jsxs)("button",{className:"cell fill ".concat("orchestrator"===o.role?"queen":""," ").concat("running"===o.status?"running":""," ").concat(et&&!ea.has(o.id)?"dim":""," ").concat(et&&ea.has(o.id)&&o.id!==et?"linked":""),onMouseEnter:e=>{A(o.id),z.bind(o.id).onMouseEnter(e)},onMouseLeave:()=>{A(null),z.bind(o.id).onMouseLeave()},onFocus:e=>{A(o.id),z.bind(o.id).onFocus(e)},onBlur:()=>{A(null),z.bind(o.id).onBlur()},style:{...a,"--c":p.xq[o.provider].color},"aria-pressed":w===o.id,onClick:()=>C(o.id===w?null:o.id),"aria-label":"".concat(o.name,", ").concat(l("role.".concat(o.role)),", ").concat(p.xq[o.provider].short,", ").concat(l("status.".concat(o.status))),children:[(0,n.jsx)("span",{className:"shape"}),(0,n.jsxs)("span",{className:"label",children:[(0,n.jsx)("b",{children:o.name}),(0,n.jsx)("small",{children:p.xq[o.provider].short})]}),"idle"!==o.status&&(0,n.jsx)("span",{className:"pip ".concat("error"===o.status?"err":"")}),("orchestrator"===o.role?o.worker_ids.length>0:ei(o.id).length>0)&&(0,n.jsx)("span",{className:"ltag",title:"orchestrator"===o.role?l("colony.delegatesTo",{count:o.worker_ids.length}):l("colony.connectedTo",{names:ei(o.id).map(e=>e.name).join(", ")}),children:"orchestrator"===o.role?"↓ ".concat(o.worker_ids.length):"↑ ".concat(1===ei(o.id).length?ei(o.id)[0].name:ei(o.id).length)})]},o.id):(0,n.jsxs)("button",{className:"cell ghost",style:a,onClick:()=>{var s;return I({colonyId:null==(s=e.colony)?void 0:s.id})},"aria-label":e.colony?l("colony.addTo",{name:e.colony.name}):l("colony.addAgent"),children:[(0,n.jsx)("svg",{className:"ghost-hex",viewBox:"0 0 100 115",preserveAspectRatio:"none","aria-hidden":!0,children:(0,n.jsx)("polygon",{points:"50,2 98,29 98,86 50,113 2,86 2,29"})}),(0,n.jsxs)("span",{className:"label",children:[(0,n.jsx)(i.A,{size:18}),l("colony.addAgent")]})]},e.key+"g"+t)})]},e.key+"l")),(0,n.jsx)("svg",{className:"links top",width:X,height:Y,"aria-hidden":!0,children:eo.map(e=>{var s;let l=ee.get(e.from),o=ee.get(e.to);if(!l||!o)return null;let a=o.x-l.x,i=o.y-l.y,r=Math.hypot(a,i)||1,c=a/r,d=i/r,m=l.x+45.88*c,h=l.y+45.88*d,u=o.x-45.88*c,x=o.y-45.88*d,y=(null==(s=t.find(s=>s.id===e.to))?void 0:s.status)==="running",p=!!et&&(e.from===et||e.to===et),j=!!et&&!p;return(0,n.jsxs)("g",{opacity:j?.18:1,children:[(0,n.jsx)("line",{x1:m,y1:h,x2:u,y2:x,stroke:"var(--surface)",strokeWidth:p?8:5,strokeLinecap:"round",opacity:.85}),(0,n.jsx)("line",{x1:m,y1:h,x2:u,y2:x,stroke:"var(--honey)",strokeWidth:p?3.5:2.2,strokeDasharray:y?"7 6":p?void 0:"1 6",strokeLinecap:"round",children:y&&(0,n.jsx)("animate",{attributeName:"stroke-dashoffset",from:"26",to:"0",dur:"0.8s",repeatCount:"indefinite"})}),(0,n.jsx)("circle",{cx:u,cy:x,r:p?5.5:4,fill:"var(--honey)",stroke:"var(--surface)",strokeWidth:2})]},e.from+e.to)})})]})}):null,(0,n.jsxs)("div",{className:"comb-legend",children:[Object.keys(p.xq).map(e=>(0,n.jsxs)("span",{className:"pbadge",style:{"--c":p.xq[e].color},children:[(0,n.jsx)("i",{}),p.xq[e].short]},e)),(0,n.jsxs)("span",{className:"pbadge",style:{"--c":"var(--honey)"},children:[(0,n.jsx)("i",{}),l("role.orchestrator")]})]})]}),en?(0,n.jsxs)("aside",{className:"side-float card card-pad col",style:{gap:14},"aria-label":en.name,children:[(0,n.jsxs)("div",{className:"card-corner row gap-s",children:[(0,n.jsx)("button",{className:"btn ghost icon sm",onClick:()=>H(en.id),"aria-label":l("colony.settingsFor",{name:en.name}),title:l("colony.agentSettings"),children:(0,n.jsx)(c.A,{size:17})}),(0,n.jsx)("button",{className:"btn ghost icon sm",onClick:()=>C(null),"aria-label":l("common.close"),title:"".concat(l("common.close")," (Esc)"),children:(0,n.jsx)(d.A,{size:16})})]}),(0,n.jsxs)("div",{className:"row gap-l",style:{paddingRight:70},children:[(0,n.jsx)(j._h,{agent:en,size:"lg"}),(0,n.jsxs)("div",{className:"grow",children:[(0,n.jsx)("h2",{style:{fontSize:22},children:en.name}),(0,n.jsxs)("div",{className:"row gap-s wrap",style:{marginTop:6},children:[(0,n.jsx)(j.PW,{role:en.role}),(0,n.jsx)(j.P5,{status:en.status})]})]})]}),en.description&&(0,n.jsx)("p",{style:{margin:0},children:en.description}),(0,n.jsxs)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 14px",fontSize:13.5},children:[(0,n.jsx)("dt",{className:"muted",children:l("form.provider")}),(0,n.jsx)("dd",{style:{margin:0},children:(0,n.jsx)(j.dJ,{provider:en.provider})}),(0,n.jsx)("dt",{className:"muted",children:l("field.model")}),(0,n.jsx)("dd",{style:{margin:0},children:en.model||l("model.cliDefault")}),(0,n.jsx)("dt",{className:"muted",children:l("colony.folder")}),(0,n.jsxs)("dd",{className:"mono",style:{margin:0,wordBreak:"break-all"},children:[(0,p._1)(en.effective.cwd),en.effective.inherited.includes("cwd")&&(0,n.jsxs)("span",{className:"muted",children:[" \xb7 ",l("colony.fromColony")]})]}),(0,n.jsx)("dt",{className:"muted",children:l("colony.session")}),(0,n.jsx)("dd",{className:"mono",style:{margin:0},children:en.session_id?en.session_id.slice(0,13)+"…":l("colony.noSession")}),"orchestrator"===en.role&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("dt",{className:"muted",children:l("form.team")}),(0,n.jsx)("dd",{style:{margin:0},children:en.worker_ids.length?en.worker_ids.map(ed).join(", "):l("colony.noWorkers")})]})]}),(0,n.jsxs)("div",{className:"field",children:[(0,n.jsx)("label",{children:l("form.colony")}),(0,n.jsxs)("select",{className:"select",value:null!=(s=null==em?void 0:em.id)?s:"",onChange:e=>void eh(en,e.target.value),children:[(0,n.jsx)("option",{value:"",children:l("common.noColony")}),m.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)(o(),{className:"btn primary grow",href:"/agents/".concat(en.id),children:[l("colony.openChat")," ",(0,n.jsx)(h,{size:16})]}),(0,n.jsx)("button",{className:"btn danger icon",onClick:()=>el(en.id),"aria-label":l("agent.delete"),title:l("agent.delete"),children:(0,n.jsx)(u.A,{size:16})})]})]}):null]}),(0,n.jsxs)("div",{className:"card card-pad recent",children:[(0,n.jsx)("div",{className:"row",style:{marginBottom:6},children:(0,n.jsx)("div",{className:"eyebrow grow",children:l("colony.recent")})}),0===P.length?(0,n.jsx)("p",{className:"muted small",style:{margin:0},children:l("colony.recentEmpty")}):(0,n.jsx)("div",{className:"recent-grid",children:P.slice(0,6).map(e=>(0,n.jsxs)("div",{className:"feed-item",children:[(0,n.jsx)("i",{className:"dot ".concat("running"===e.status?"run":"done"===e.status?"ok":"err"),style:{marginTop:7}}),(0,n.jsxs)("div",{children:[(0,n.jsx)("b",{children:ed(e.from_id)})," → ",(0,n.jsx)("b",{children:ed(e.to_id)}),(0,n.jsx)("div",{className:"muted small",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.task}),(0,n.jsx)("div",{className:"muted",style:{fontSize:12},children:(0,p.KN)(e.created_at)})]})]},e.id))})]}),z.node,es&&t.find(e=>e.id===es)&&(0,n.jsx)(M.G,{agent:t.find(e=>e.id===es),onClose:()=>el(null),onDeleted:()=>C(null)}),F&&(0,n.jsx)(g.b,{presetColonyId:F.colonyId,onClose:()=>I(null),onCreated:e=>C(e)}),O&&t.find(e=>e.id===O)&&(0,n.jsx)(S,{agent:t.find(e=>e.id===O),onClose:()=>H(null)},O),R&&(0,n.jsx)(N,{colony:"new"===R?void 0:R,onClose:()=>B(null)})]})}},7701:(e,s,l)=>{Promise.resolve().then(l.bind(l,1722))}},e=>{e.O(0,[951,463,687,493,517,850,408,89,358],()=>e(e.s=7701)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[964],{6300:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>v});var l=t(4799),s=t(4023),a=t(831),n=t(5334);t(117);var i=t(665),o=t(964),d=t(8538),c=t(3749),u=t(7890),h=t(632),m=t(9654);let g=["#e8a317","#2f5bea","#c0399a","#0f8f9e","#7a4de0","#d4663f","#2f8f5b","#9a7400"],p="hive-rel-pos-v2",x={agent:function(e){let{data:r}=e,{t}=(0,m.s9)(),s=r.agent;return(0,l.jsxs)("div",{className:"rnode ".concat(r.dim?"dim":""," ").concat(r.active?"active":""),children:["worker"===s.role&&(0,l.jsx)(a.h7,{type:"target",position:n.yX.Top}),(0,l.jsx)(h._h,{agent:s}),(0,l.jsx)("b",{children:s.name}),(0,l.jsx)("small",{children:"orchestrator"===s.role?t("role.orchestrator"):u.xq[s.provider].short}),"orchestrator"===s.role&&(0,l.jsx)(a.h7,{type:"source",position:n.yX.Bottom})]})}},f={link:function(e){let{id:r,sourceX:t,sourceY:s,targetX:o,targetY:d,sourcePosition:c,targetPosition:u,data:h}=e,[m,g,p]=(0,n.Fp)({sourceX:t,sourceY:s,targetX:o,targetY:d,sourcePosition:c,targetPosition:u,curvature:.35});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.tE,{id:r,path:m,interactionWidth:26,style:{stroke:h.color,strokeWidth:h.active?4:2.5,opacity:h.dim?.15:1,transition:"opacity .15s, stroke-width .15s"}}),h.show&&(0,l.jsx)(a.rV,{children:(0,l.jsx)("button",{className:"edge-x nodrag nopan",style:{transform:"translate(-50%, -50%) translate(".concat(g,"px, ").concat(p,"px)")},onClick:h.onRemove,"aria-label":h.label,title:h.label,children:(0,l.jsx)(i.A,{size:13,strokeWidth:3})})})]})}};function v(){let{t:e,locale:r}=(0,m.s9)(),{agents:t,refresh:n,ready:u}=(0,d.o0)(),v=(0,h.dj)(),[j,k]=(0,s.useState)({}),[w,y]=(0,s.useState)([]),[b,N]=(0,s.useState)(null),[_,C]=(0,s.useState)(null),[S,E]=(0,s.useState)(null),[M,O]=(0,s.useState)(0),F=(0,s.useRef)(!1);(0,s.useEffect)(()=>{try{var e;k(JSON.parse(null!=(e=localStorage.getItem(p))?e:"{}"))}catch(e){}F.current=!0},[]);let W=(0,s.useMemo)(()=>(function(e){let r=e.filter(e=>"orchestrator"===e.role),t=e.filter(e=>"worker"===e.role),l=e=>r.find(r=>r.worker_ids.includes(e.id)),s={},a=0;for(let e of r){let r=t.filter(r=>{var t;return(null==(t=l(r))?void 0:t.id)===e.id}),n=Math.max(1,r.length);r.forEach((e,r)=>s[e.id]={x:a+190*r,y:280}),s[e.id]={x:a+(n-1)*190/2,y:0},a+=190*n+114}return t.filter(e=>!l(e)).forEach((e,r)=>s[e.id]={x:a+190*r,y:280}),s})(t),[t]);(0,s.useEffect)(()=>{y(t.map(e=>{var r,t;return{id:e.id,type:"agent",position:null!=(t=null!=(r=j[e.id])?r:W[e.id])?t:{x:0,y:0},data:{agent:e,dim:!1,active:!1}}}))},[t,W,j]);let A=(0,s.useMemo)(()=>new Map(t.filter(e=>"orchestrator"===e.role).map((e,r)=>[e.id,r])),[t]),z=null!=b?b:S,I=e=>{var r,l;return null!=(l=null==(r=t.find(r=>r.id===e))?void 0:r.name)?l:"?"},R=(0,s.useCallback)(async(r,t,l)=>{try{await c.F.put("/orchestrators/".concat(r,"/workers"),{worker_ids:t}),await n(["agents"]),v(l)}catch(r){v(r instanceof Error?r.message:e("rel.updateFailed"),"err")}},[n,v]),T=(0,s.useCallback)((r,l)=>{let s=t.find(e=>e.id===r);s&&R(r,s.worker_ids.filter(e=>e!==l),e("rel.disconnected",{worker:I(l),orchestrator:s.name}))},[t,R]),V=(0,s.useCallback)((r,l)=>{let s=t.find(e=>e.id===r);!s||s.worker_ids.includes(l)||R(r,[...s.worker_ids,l],e("rel.connected",{worker:I(l),orchestrator:s.name}))},[t,R]),L=(0,s.useMemo)(()=>t.filter(e=>"orchestrator"===e.role).flatMap(r=>r.worker_ids.map(l=>{var s,a;let n="".concat(r.id,">").concat(l),i=!!z&&(r.id===z||l===z);return{id:n,source:r.id,target:l,type:"link",animated:(null==(s=t.find(e=>e.id===l))?void 0:s.status)==="running",data:{color:g[(null!=(a=A.get(r.id))?a:0)%g.length],dim:!!z&&!i,active:i||_===n,show:i||_===n,label:e("rel.disconnectLabel",{worker:I(l),orchestrator:r.name}),onRemove:()=>T(r.id,l)}}})),[t,z,_,A,T,r]),B=(0,s.useMemo)(()=>{let e=new Set(z?[z]:[]);if(z)for(let r of L)(r.source===z||r.target===z)&&(e.add(r.source),e.add(r.target));return w.map(r=>({...r,selected:r.id===S,data:{...r.data,dim:!!z&&!e.has(r.id),active:r.id===z}}))},[w,L,z,S]),J=(0,s.useCallback)(e=>{y(r=>(0,a._0)(e,r));let r=e.filter(e=>"position"===e.type&&!e.dragging&&e.position);r.length&&k(e=>{let t={...e};for(let e of r)"position"===e.type&&e.position&&(t[e.id]=e.position);try{localStorage.setItem(p,JSON.stringify(t))}catch(e){}return t})},[]),P=t.find(e=>e.id===S),X=t.filter(e=>"orchestrator"===e.role),Z=t.filter(e=>"worker"===e.role);return(0,l.jsxs)("div",{className:"page full rel",children:[(0,l.jsxs)("div",{className:"rel-hud",children:[(0,l.jsx)("h1",{children:e("nav.relations")}),(0,l.jsx)("p",{children:e("rel.hud")})]}),(0,l.jsx)("div",{className:"rel-tools",children:(0,l.jsxs)("button",{className:"btn sm",onClick:()=>{k({});try{localStorage.removeItem(p)}catch(e){}O(e=>e+1),v(e("rel.layoutReset"))},children:[(0,l.jsx)(o.A,{size:14}),e("rel.autoArrange")]})}),u&&0===t.length?(0,l.jsxs)("div",{className:"empty",style:{margin:"140px auto",maxWidth:420,background:"var(--surface)"},children:[(0,l.jsx)("h3",{children:e("rel.empty.title")}),(0,l.jsx)("p",{children:e("rel.empty.body")})]}):(0,l.jsxs)(a.Gc,{nodes:B,edges:L,nodeTypes:x,edgeTypes:f,onNodesChange:J,onConnect:e=>{e.source&&e.target&&V(e.source,e.target)},onNodeMouseEnter:(e,r)=>N(r.id),onNodeMouseLeave:()=>N(null),onNodeClick:(e,r)=>E(e=>e===r.id?null:r.id),onPaneClick:()=>E(null),onEdgeMouseEnter:(e,r)=>C(r.id),onEdgeMouseLeave:()=>C(null),fitView:!0,fitViewOptions:{padding:.35,maxZoom:1.1},minZoom:.3,proOptions:{hideAttribution:!0},deleteKeyCode:null,nodesConnectable:!0,children:[(0,l.jsx)(a.VS,{gap:28,color:"var(--line-strong)"}),(0,l.jsx)(a.H2,{showInteractive:!1})]},M),P&&(0,l.jsxs)("aside",{className:"rel-panel card",children:[(0,l.jsxs)("div",{className:"row gap-l",children:[(0,l.jsx)(h._h,{agent:P}),(0,l.jsxs)("div",{className:"grow",children:[(0,l.jsx)("b",{style:{fontFamily:"var(--font-display)",fontSize:17},children:P.name}),(0,l.jsx)("div",{className:"muted small",children:e("role.".concat(P.role))})]}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>E(null),"aria-label":e("common.close"),children:(0,l.jsx)(i.A,{size:16})})]}),"orchestrator"===P.role?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"eyebrow",children:e("rel.delegatesTo",{count:P.worker_ids.length})}),0===P.worker_ids.length&&(0,l.jsx)("p",{className:"muted small",style:{margin:0},children:e("rel.noWorkers")}),P.worker_ids.map(r=>(0,l.jsxs)("div",{className:"relrow",children:[(0,l.jsx)("span",{className:"grow",children:I(r)}),(0,l.jsx)("button",{className:"btn sm",onClick:()=>T(P.id,r),children:e("rel.disconnect")})]},r)),(0,l.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&V(P.id,e.target.value),"aria-label":e("rel.connectWorker"),children:[(0,l.jsx)("option",{value:"",children:e("rel.connectWorker")}),Z.filter(e=>!P.worker_ids.includes(e.id)).map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"eyebrow",children:e("rel.directedBy")}),0===X.filter(e=>e.worker_ids.includes(P.id)).length&&(0,l.jsx)("p",{className:"muted small",style:{margin:0},children:e("rel.noOrchestrators")}),X.filter(e=>e.worker_ids.includes(P.id)).map(r=>{var t;return(0,l.jsxs)("div",{className:"relrow",children:[(0,l.jsx)("i",{className:"cdot",style:{background:g[(null!=(t=A.get(r.id))?t:0)%g.length],margin:0}}),(0,l.jsx)("span",{className:"grow",children:r.name}),(0,l.jsx)("button",{className:"btn sm",onClick:()=>T(r.id,P.id),children:e("rel.disconnect")})]},r.id)}),(0,l.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&V(e.target.value,P.id),"aria-label":e("rel.connectOrchestrator"),children:[(0,l.jsx)("option",{value:"",children:e("rel.connectOrchestrator")}),X.filter(e=>!e.worker_ids.includes(P.id)).map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]})]})}},7949:(e,r,t)=>{Promise.resolve().then(t.bind(t,6300))}},e=>{e.O(0,[48,986,805,493,408,89,358],()=>e(e.s=7949)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[898],{5065:(s,e,a)=>{Promise.resolve().then(a.bind(a,5382))},5382:(s,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>j});var l=a(4799),n=a(1463),i=a.n(n),t=a(4023),c=a(6458),d=a(3983),r=a(8311),o=a(3749),m=a(8538),h=a(7890),p=a(6072),x=a(632),u=a(9654);function j(){let{t:s,locale:e}=(0,u.s9)(),{agents:a}=(0,m.o0)(),[n,j]=(0,t.useState)(null),[g,v]=(0,t.useState)(""),[N,y]=(0,t.useState)("all"),[_,b]=(0,t.useState)(null),[f,w]=(0,t.useState)(null);(0,t.useEffect)(()=>{o.F.get("/sessions").then(j).catch(()=>j([]))},[]),(0,t.useEffect)(()=>{w(null),_&&o.F.get("/agents/".concat(_.agent_id,"/history?session=").concat(encodeURIComponent(_.session_id))).then(s=>w(s.messages)).catch(()=>w([]))},[_]);let k=(0,t.useMemo)(()=>(null!=n?n:[]).filter(s=>("all"===N||s.provider===N)&&(!g||"".concat(s.agent_name," ").concat(s.preview," ").concat(s.cwd).toLowerCase().includes(g.toLowerCase()))),[n,g,N]),C=(0,t.useMemo)(()=>{let s=new Map;for(let a of k){var e;let l=new Date(a.last_seen).toLocaleDateString((0,u.VR)(),{weekday:"long",day:"numeric",month:"short"});s.set(l,[...null!=(e=s.get(l))?e:[],a])}return[...s.entries()]},[k,e]),S=_&&a.find(s=>s.id===_.agent_id);return(0,l.jsxs)("div",{className:"page",children:[(0,l.jsx)("div",{className:"page-head",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{children:s("nav.sessions")}),(0,l.jsx)("p",{children:s("sessions.subtitle")})]})}),(0,l.jsxs)("div",{className:"row wrap",style:{marginBottom:16},children:[(0,l.jsxs)("div",{className:"search grow",style:{maxWidth:380},children:[(0,l.jsx)(r.A,{size:16}),(0,l.jsx)("input",{className:"input",placeholder:s("sessions.searchPlaceholder"),value:g,onChange:s=>v(s.target.value),"aria-label":s("sessions.searchLabel")})]}),(0,l.jsx)(x.$q,{value:N,onChange:y,options:[{id:"all",label:s("common.all")},...Object.keys(h.xq).map(s=>({id:s,label:h.xq[s].short}))]})]}),n&&!n.length?(0,l.jsxs)("div",{className:"empty",children:[(0,l.jsx)("h3",{children:s("sessions.empty.title")}),(0,l.jsx)("p",{children:s("sessions.empty.body")}),(0,l.jsx)(i(),{className:"btn primary",href:"/agents",children:s("sessions.empty.go")})]}):(0,l.jsxs)("div",{className:"sess-grid",children:[(0,l.jsxs)("div",{className:"card",style:{overflow:"hidden"},children:[null===n&&(0,l.jsx)("p",{className:"muted",style:{padding:20},children:s("sessions.reading")}),C.map(e=>{let[a,n]=e;return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"eyebrow",style:{padding:"12px 16px 6px",background:"var(--surface-2)"},children:a}),n.map(e=>{var a;return(0,l.jsxs)("button",{className:"sess","aria-current":(null==_?void 0:_.session_id)===e.session_id,onClick:()=>b(e),children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("b",{style:{fontFamily:"var(--font-display)"},children:e.agent_name}),(0,l.jsx)(x.dJ,{provider:e.provider}),e.current&&(0,l.jsx)("span",{className:"chip honey",children:s("sessions.current")}),"delegation"===e.kind&&(0,l.jsx)("span",{className:"chip",children:s("sessions.delegatedBy",{name:null!=(a=e.from_name)?a:s("chat.anOrchestrator")})}),(0,l.jsx)("span",{className:"grow"}),(0,l.jsx)("span",{className:"muted small",children:(0,h.KN)(e.last_seen)})]}),(0,l.jsx)("div",{className:"pv",children:e.preview||e.task||s("sessions.emptySession")}),(0,l.jsxs)("div",{className:"muted small mono",children:[(0,h._1)(e.cwd)," \xb7 ",s("sessions.messages",{count:e.message_count})]}),(0,l.jsxs)("div",{className:"sessmeta",children:[(0,p.RP)(e.usage)>0&&(0,l.jsxs)("span",{children:[(0,p.yj)((0,p.RP)(e.usage))," ",s("stats.tokens")]}),e.usage.credits?(0,l.jsxs)("span",{children:[e.usage.credits.toFixed(2)," ",s("stats.credits")]}):null,null!==e.cost&&(0,l.jsxs)("span",{children:["≈ ",(0,p.F0)(e.cost)]}),e.tool_calls>0&&(0,l.jsxs)("span",{children:[e.tool_calls," ",s("stats.toolCalls",{count:e.tool_calls})]}),e.model&&(0,l.jsx)("span",{className:"mono",children:e.model.replace(/^claude-/,"")})]})]},e.agent_id+e.session_id)})]},a)}),n&&n.length>0&&!k.length&&(0,l.jsx)("p",{className:"muted",style:{padding:20},children:s("sessions.noMatch")})]}),(0,l.jsx)("div",{className:"card",style:{position:"sticky",top:20,minHeight:300},children:_?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"row",style:{padding:"14px 20px",borderBottom:"1px solid var(--line)"},children:[(0,l.jsxs)("div",{className:"grow",children:[(0,l.jsx)("b",{style:{fontFamily:"var(--font-display)",fontSize:17},children:_.agent_name}),(0,l.jsx)("div",{className:"muted small mono",children:_.session_id})]}),S&&(0,l.jsx)(i(),{className:"btn sm primary",href:"/agents/".concat(S.id),children:s("sessions.openAgent")})]}),(0,l.jsx)("div",{className:"transcript col",style:{gap:16},children:null===f?(0,l.jsx)("p",{className:"muted",children:s("sessions.loading")}):0===f.length?(0,l.jsx)("p",{className:"muted",children:s("sessions.noMessages")}):f.map(s=>(0,l.jsx)("div",{className:"msg ".concat(s.role),children:"user"===s.role?(0,l.jsx)("div",{className:"bubble",children:s.blocks.map(s=>"text"===s.type?s.text:"").join("")}):s.blocks.filter(s=>"text"===s.type).map((s,e)=>(0,l.jsx)("div",{className:"md",children:(0,l.jsx)(c.oz,{remarkPlugins:[d.A],children:s.text})},e))},s.id))})]}):(0,l.jsx)("div",{className:"empty",style:{border:0},children:(0,l.jsx)("p",{children:s("sessions.select")})})})]})]})}}},s=>{s.O(0,[951,463,493,408,89,358],()=>s(s.s=5065)),_N_E=s.O()}]);
|