hive-am 1.4.0 → 1.6.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 +52 -1
- package/README.md +6 -9
- package/bin/hive-am.mjs +242 -31
- package/bin/run.mjs +135 -0
- package/package.json +1 -1
- package/server/dist/connections/format.js +26 -0
- package/server/dist/connections/index.js +2 -0
- package/server/dist/connections/manager.js +18 -6
- package/server/dist/connections/router.js +43 -13
- package/server/dist/connections/secrets.js +9 -1
- package/server/dist/connections/slack.js +488 -0
- package/server/dist/connections/store.js +2 -0
- package/server/dist/db/migrations.js +80 -0
- package/server/dist/db.js +26 -13
- package/server/dist/dispatches.js +126 -0
- package/server/dist/efforts.js +105 -0
- package/server/dist/http/routes/agents.js +4 -3
- package/server/dist/http/routes/meta.js +12 -0
- package/server/dist/http/routes/notebook.js +10 -2
- package/server/dist/http/routes/orchestration.js +13 -2
- package/server/dist/http/routes/resources.js +3 -0
- package/server/dist/http/routes/types.js +18 -1
- package/server/dist/http/validate.js +27 -4
- package/server/dist/index.js +6 -1
- package/server/dist/instructions.js +11 -3
- package/server/dist/objects/agent-db.js +258 -0
- package/server/dist/objects/database.js +496 -34
- package/server/dist/objects/index.js +16 -8
- package/server/dist/providers/kiro.js +7 -1
- package/server/dist/providers/opencode-server.js +11 -1
- package/server/dist/providers/opencode.js +4 -3
- package/server/dist/providers/spawn.js +38 -4
- package/server/dist/retention.js +52 -0
- package/server/dist/runtime.js +69 -27
- package/server/dist/services/agents.js +53 -1
- package/server/dist/services/connections.js +18 -3
- package/server/dist/services/notebook.js +7 -3
- package/server/dist/skills/defaults.js +41 -5
- package/server/dist/skills/notebook.js +57 -13
- package/server/dist/watch.js +1 -1
- package/server/mcp/dispatch.mjs +116 -5
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/app-build-manifest.json +98 -82
- package/web/.next/app-path-routes-manifest.json +7 -7
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +51 -51
- 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 +3 -3
- 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 +21 -18
- package/web/.next/server/app/chat/page.js +2 -2
- package/web/.next/server/app/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/chat.html +1 -1
- package/web/.next/server/app/chat.rsc +4 -4
- 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 +4 -4
- package/web/.next/server/app/index.html +1 -1
- package/web/.next/server/app/index.rsc +4 -4
- 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 +4 -4
- package/web/.next/server/app/resources/[id]/page.js +2 -2
- package/web/.next/server/app/resources/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/resources/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/resources/page.js +2 -2
- package/web/.next/server/app/resources/page.js.nft.json +1 -1
- package/web/.next/server/app/resources/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/resources.html +1 -1
- package/web/.next/server/app/resources.rsc +4 -4
- package/web/.next/server/app/schedules/page.js +2 -2
- package/web/.next/server/app/schedules/page.js.nft.json +1 -1
- package/web/.next/server/app/schedules/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/schedules.html +1 -1
- package/web/.next/server/app/schedules.rsc +4 -4
- 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 +4 -4
- 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 +4 -4
- 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 +4 -4
- package/web/.next/server/app-paths-manifest.json +7 -7
- package/web/.next/server/chunks/{505.js → 111.js} +1 -1
- package/web/.next/server/chunks/143.js +1 -1
- package/web/.next/server/chunks/213.js +1 -1
- package/web/.next/server/chunks/368.js +1 -1
- package/web/.next/server/chunks/403.js +1 -1
- package/web/.next/server/chunks/612.js +1 -1
- package/web/.next/server/chunks/741.js +2 -0
- package/web/.next/server/chunks/837.js +1 -0
- package/web/.next/server/chunks/{435.js → 939.js} +3 -3
- 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/162-68ba190086f5ad39.js +1 -0
- package/web/.next/static/chunks/214-35b88db02113ae02.js +1 -0
- package/web/.next/static/chunks/281-4506bc98b7111729.js +1 -0
- package/web/.next/static/chunks/491-196bcb3dd11bb460.js +1 -0
- package/web/.next/static/chunks/517-8f2db464d10a4624.js +1 -0
- package/web/.next/static/chunks/{586-f7017d585a84738d.js → 586-4f67b823df060b46.js} +1 -1
- package/web/.next/static/chunks/587-3c53d91a1c4f99d6.js +1 -0
- package/web/.next/static/chunks/606-14fb5aaa4d0ff22d.js +1 -0
- package/web/.next/static/chunks/642-dc874c8caf203ee1.js +1 -0
- package/web/.next/static/chunks/{705-f81face97b1bb1af.js → 705-ce86175dea00e6a9.js} +1 -1
- package/web/.next/static/chunks/757-03361e7a97a605a2.js +1 -0
- package/web/.next/static/chunks/771-db19da9b1a24820c.js +1 -0
- package/web/.next/static/chunks/app/agents/[id]/page-803d53aedd10c8e5.js +1 -0
- package/web/.next/static/chunks/app/agents/layout-71dd98d696935e29.js +1 -0
- package/web/.next/static/chunks/app/agents/page-9da499db6d22731f.js +1 -0
- package/web/.next/static/chunks/app/chat/{page-5261b12b7d50f5d1.js → page-383bc24e72dab7fa.js} +1 -1
- package/web/.next/static/chunks/app/connections/page-b0ea2eae62cef74e.js +1 -0
- package/web/.next/static/chunks/app/layout-cb5af29b0742c513.js +1 -0
- package/web/.next/static/chunks/app/page-5e547e87de23d9fa.js +1 -0
- package/web/.next/static/chunks/app/relations/page-02710fe1f8a670a9.js +1 -0
- package/web/.next/static/chunks/app/resources/[id]/page-1e2afddcb1f04884.js +1 -0
- package/web/.next/static/chunks/app/resources/{page-61cccd8fdcc2f6c8.js → page-195b0af83b8ace0d.js} +1 -1
- package/web/.next/static/chunks/app/sessions/page-85638705fdc18174.js +1 -0
- package/web/.next/static/chunks/app/types/page-c4c2b2217c4667e8.js +1 -0
- package/web/.next/static/css/c7faf690373117bb.css +1 -0
- package/web/.next/trace +30 -30
- package/web/.next/types/routes.d.ts +2 -1
- package/web/.next/types/validator.ts +9 -0
- package/web/.next/server/chunks/274.js +0 -1
- package/web/.next/static/chunks/281-113274e705940a55.js +0 -1
- package/web/.next/static/chunks/316-26da9cc233ba7557.js +0 -1
- package/web/.next/static/chunks/391-18768499e741112e.js +0 -1
- package/web/.next/static/chunks/517-373a80c8ba432bdc.js +0 -1
- package/web/.next/static/chunks/562-7c2e33d838e869bf.js +0 -1
- package/web/.next/static/chunks/587-8e4d2be01ba7d48f.js +0 -1
- package/web/.next/static/chunks/606-c9a19918b02a98d0.js +0 -1
- package/web/.next/static/chunks/656-f537149fe28f79aa.js +0 -1
- package/web/.next/static/chunks/app/agents/[id]/page-6ed6edb3e74b0ebe.js +0 -1
- package/web/.next/static/chunks/app/agents/page-9bb8cba69776c719.js +0 -1
- package/web/.next/static/chunks/app/connections/page-eb11cfb1ffeab3ca.js +0 -1
- package/web/.next/static/chunks/app/layout-fad968a635f9a4b3.js +0 -1
- package/web/.next/static/chunks/app/page-99e0351e6ccaa384.js +0 -1
- package/web/.next/static/chunks/app/relations/page-a44fd515a3b0525e.js +0 -1
- package/web/.next/static/chunks/app/resources/[id]/page-fc494e85b01e8cb7.js +0 -1
- package/web/.next/static/chunks/app/sessions/page-a7534ebd90e982d6.js +0 -1
- package/web/.next/static/chunks/app/types/page-ebd37e220f77c1f3.js +0 -1
- package/web/.next/static/css/582723fcea1f9887.css +0 -1
- /package/web/.next/static/{YT6HM6qmegMJaBMX5QvuP → tdnUXVa01m25EjOobxVd1}/_buildManifest.js +0 -0
- /package/web/.next/static/{YT6HM6qmegMJaBMX5QvuP → tdnUXVa01m25EjOobxVd1}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[771],{2432:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},3414:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},6673:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},7991:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},8089:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]])},12384:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("ChevronsDownUp",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]])},15145:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]])},17395:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])},17557:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]])},23132:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]])},26701:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).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"}]])},29416:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},32335:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]])},33691:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("UserPlus",[["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"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]])},33974:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]])},34265:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).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"}]])},34978:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]])},37104:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]])},37870:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},45385:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]])},46838:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]])},47405:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},50703:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},55362:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},64883:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]])},66654:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},66826:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},70283:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]])},73784:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).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"}]])},73885:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]])},75014:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]])},75063:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]])},77841:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]])},78330:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]])},83372:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},89075:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},94726:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},96914:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]])},97318:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]])},97356:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).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"}]])},98392:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]])},98759:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},99381:(e,y,a)=>{a.d(y,{A:()=>t});let t=(0,a(74955).A)("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]])}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[969],{4249:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>sN});var a=t(94799),n=t(20422),l=t(89128),i=t(34023),c=t(41463),r=t.n(c),o=t(43624),d=t(75406),h=t(32098),u=t(68449),m=t(97541),g=t(48538),x=t(3749),p=t(47890),j=t(54609),b=t(77021),f=t(61748),v=t(51705),N=t(44738),y=t(14214),k=t(84611),w=t(29718),C=t(8089),S=t(50352),A=t(12349),z=t(56072),E=t(69654);function M(e){var s,t,n,l,c,r,o,d,h,u;let{agent:m,session:p}=e,{t:j}=(0,E.s9)(),{finished:b,live:f}=(0,g.o0)(),[v,M]=(0,i.useState)(null),[F,R]=(0,i.useState)(!1),P=null!=(s=b[m.id])?s:0,_=f[m.id];if((0,i.useEffect)(()=>{if(!m.session_id&&!p)return void M(null);x.FH.get("/agents/".concat(m.id,"/stats").concat(p?"?session=".concat(encodeURIComponent(p)):"")).then(M).catch(()=>void 0)},[m.id,m.session_id,p,P]),!v||0===v.turns&&!_)return null;let L=null==_?void 0:_.usage,H=(0,z.RP)(v.usage)+(L?(0,z.RP)({input:null!=(t=L.input)?t:0,output:null!=(n=L.output)?n:0,cacheRead:null!=(l=L.cacheRead)?l:0,cacheWrite:null!=(c=L.cacheWrite)?c:0}):0),I=(null!=(r=v.cost)?r:0)+(null!=(o=null==_?void 0:_.cost)?o:0),U=(null!=(d=v.usage.credits)?d:0)+(null!=(h=null==L?void 0:L.credits)?h:0),D=null!=(u=null==L?void 0:L.contextPct)?u:v.contextPct,T=null!==v.cost||(null==_?void 0:_.cost)!==void 0,K=v.usage,W=Math.max(1,K.input+K.output+K.cacheRead+K.cacheWrite),O=Math.max(1,...v.tools.map(e=>e.count)),$=Math.max(1,...v.timeline.map(e=>e.tokens));return(0,a.jsxs)("div",{className:"stats-wrap",children:[(0,a.jsxs)("button",{className:"statsbar",onClick:()=>R(e=>!e),"aria-expanded":F,children:[(0,a.jsxs)("span",{className:"sb",title:"".concat(j("stats.contextTitle")," \xb7 ").concat((0,z.yj)(v.lastContext)).concat(v.contextWindow?" / ".concat((0,z.yj)(v.contextWindow)):""),children:[(0,a.jsx)(N.A,{size:14}),(0,a.jsx)("b",{children:null!==D?"".concat(D.toFixed(+(D<10)),"%"):(0,z.yj)(v.lastContext)}),j("stats.context")]}),(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(y.A,{size:14}),(0,a.jsx)("b",{children:(0,z.yj)(H)}),j("stats.tokens")]}),U>0&&(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(k.A,{size:14}),(0,a.jsx)("b",{children:U.toFixed(2)}),j("stats.credits")]}),T&&(0,a.jsxs)("span",{className:"sb",title:v.costEstimated?j("stats.costEstimated"):j("stats.costReported"),children:[(0,a.jsx)(k.A,{size:14}),(0,a.jsxs)("b",{children:[v.costEstimated?"≈ ":"",(0,z.F0)(I)]})]}),(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(w.A,{size:14}),(0,a.jsx)("b",{children:v.turns}),j("stats.turns",{count:v.turns})]}),(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(C.A,{size:14}),(0,a.jsx)("b",{children:v.toolCalls}),j("stats.toolCalls",{count:v.toolCalls}),v.toolErrors>0&&(0,a.jsxs)("em",{className:"tbad",children:[" \xb7 ",j("stats.failed",{count:v.toolErrors})]})]}),v.durationMs>0&&(0,a.jsxs)("span",{className:"sb",children:[(0,a.jsx)(S.A,{size:14}),(0,a.jsx)("b",{children:(0,z.nc)(v.durationMs)}),j("stats.working")]}),(0,a.jsx)(A.A,{size:15,className:"chev2 ".concat(F?"open":"")})]}),F&&(0,a.jsxs)("div",{className:"statspanel",children:[(0,a.jsxs)("section",{children:[(0,a.jsx)("div",{className:"eyebrow",children:j("stats.mix")}),(0,a.jsxs)("div",{className:"mixbar",role:"img","aria-label":j("stats.mix"),children:[(0,a.jsx)("i",{className:"fa-c-cr",style:{width:"".concat(K.cacheRead/W*100,"%")}}),(0,a.jsx)("i",{className:"fa-c-cw",style:{width:"".concat(K.cacheWrite/W*100,"%")}}),(0,a.jsx)("i",{className:"fa-c-in",style:{width:"".concat(K.input/W*100,"%")}}),(0,a.jsx)("i",{className:"fa-c-out",style:{width:"".concat(K.output/W*100,"%")}})]}),(0,a.jsxs)("dl",{className:"legend",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("i",{className:"fa-c-cr"}),(0,a.jsx)("dt",{children:j("stats.cacheRead")}),(0,a.jsx)("dd",{children:(0,z.yj)(K.cacheRead)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("i",{className:"fa-c-cw"}),(0,a.jsx)("dt",{children:j("stats.cacheWrite")}),(0,a.jsx)("dd",{children:(0,z.yj)(K.cacheWrite)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("i",{className:"fa-c-in"}),(0,a.jsx)("dt",{children:j("stats.input")}),(0,a.jsx)("dd",{children:(0,z.yj)(K.input)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("i",{className:"fa-c-out"}),(0,a.jsx)("dt",{children:j("stats.output")}),(0,a.jsxs)("dd",{children:[(0,z.yj)(K.output),K.reasoning>0&&(0,a.jsxs)("span",{className:"muted",children:[" (",j("stats.thinking",{tokens:(0,z.yj)(K.reasoning)}),")"]})]})]})]}),v.models.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"eyebrow mt-m",children:j("stats.models")}),v.models.map(e=>(0,a.jsxs)("div",{className:"row small between",children:[(0,a.jsx)("span",{className:"mono",children:e.model}),(0,a.jsx)("span",{className:"muted",children:j("stats.modelLine",{count:e.messages,out:(0,z.yj)(e.output)})})]},e.model))]})]}),(0,a.jsxs)("section",{children:[(0,a.jsxs)("div",{className:"eyebrow",children:[j("stats.toolsUsed")," ",v.toolTimeMs>0&&(0,a.jsxs)("span",{className:"muted",children:["\xb7 ",j("stats.totalTime",{time:(0,z.nc)(v.toolTimeMs)})]})]}),0===v.tools.length?(0,a.jsx)("p",{className:"muted small m0 mt-s",children:j("stats.noTools")}):v.tools.slice(0,9).map(e=>(0,a.jsxs)("div",{className:"toolrow",title:j("stats.toolTitle",{count:e.count,time:(0,z.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/O*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,z.nc)(e.totalMs/e.count):""})]},e.name))]}),(0,a.jsxs)("section",{className:"fa-span",children:[(0,a.jsx)("div",{className:"eyebrow",children:j("stats.perTurn")}),(0,a.jsx)("div",{className:"tbars",role:"list",children:v.timeline.slice(-40).map((e,s)=>(0,a.jsx)("div",{className:"sbar",role:"listitem",title:"".concat(e.prompt||j("stats.promptFallback"),"\n").concat(j("stats.turnLine",{tokens:(0,z.yj)(e.tokens),tools:e.tools,time:(0,z.nc)(e.durationMs)})).concat(null!==e.cost?" \xb7 ".concat((0,z.F0)(e.cost)):""),children:(0,a.jsx)("i",{style:{height:"".concat(Math.max(4,e.tokens/$*100),"%")}})},s))})]})]})]})}var F=t(29416),R=t(59959),P=t(83372),_=t(47405),L=t(6673),H=t(7991),I=t(31606),U=t(74988),D=t(52974),T=t(10804);let K=["error","starting","running","ready","stopped","unknown"];function W(e){let{agent:s}=e,{t}=(0,E.s9)(),{objects:n}=(0,g.o0)(),l=(0,T.dj)(),[c,o]=(0,b.ud)("hive-am.chat.resources",!1),[d,h]=(0,b.ud)("hive-am.chat.resources.scope","mine"),[u,m]=(0,i.useState)(null);if(0===n.length)return null;let p=n.filter(e=>{var t,a;return e.manager_id===s.id||(null!=(t=e.colony_id)?t:null)===(null!=(a=s.colony_id)?a:null)}),j="all"===d||0===p.length,f=j?n:p,v=e=>f.filter(s=>s.state.status===e).length,N=async(e,s)=>{m("".concat(e.id,":").concat(s));try{await x.FH.post("/objects/".concat(e.id,"/action"),{action:s})}catch(e){l("".concat(t("obj.act.failed",{action:t("obj.act.".concat(s))}),": ").concat(e instanceof Error?e.message:""),"err")}finally{m(null)}};return(0,a.jsxs)("div",{className:"cres",children:[(0,a.jsxs)("button",{type:"button",className:"cres-head","aria-expanded":c,onClick:()=>o(!c),children:[(0,a.jsx)(F.A,{size:15,"aria-hidden":!0}),(0,a.jsx)("b",{children:t("cres.title")}),(0,a.jsx)("span",{className:"cres-sum",children:K.filter(e=>v(e)>0).map(e=>(0,a.jsxs)("span",{className:"cres-n ".concat(U.Wy[e]),children:[(0,a.jsx)(I.md,{status:e}),v(e)," ",(0,a.jsx)("em",{children:t("cres.n.".concat(e))})]},e))}),(0,a.jsx)(A.A,{size:15,className:"chev2 ".concat(c?"open":""),"aria-hidden":!0})]}),c&&(0,a.jsxs)("div",{className:"cres-body",children:[p.length>0&&p.length<n.length&&(0,a.jsxs)("div",{className:"seg cres-scope",role:"group","aria-label":t("cres.scope"),children:[(0,a.jsx)("button",{type:"button","aria-pressed":!j,onClick:()=>h("mine"),children:t("cres.mine",{a1:String(p.length)})}),(0,a.jsx)("button",{type:"button","aria-pressed":j,onClick:()=>h("all"),children:t("cres.all",{a1:String(n.length)})})]}),0===p.length&&(0,a.jsx)("p",{className:"muted small cres-note",children:t("cres.none")}),(0,a.jsx)("ul",{className:"cres-grid",children:f.map(e=>{var s;let n=U.Nd[e.kind].icon,l=e.state.status,i="running"===l||"starting"===l,c=D.no.includes(e.kind),o=null!=(s=null==u?void 0:u.startsWith("".concat(e.id,":")))&&s,d=(0,U.HS)(t,e.state.detail);return(0,a.jsxs)("li",{className:"cres-card ".concat(U.Wy[l]),children:[(0,a.jsx)("span",{className:"cres-ico",style:{"--c":U.Nd[e.kind].color},children:(0,a.jsx)(n,{size:16,"aria-hidden":!0})}),(0,a.jsxs)("div",{className:"cres-info",children:[(0,a.jsx)(r(),{className:"cres-name",href:"/resources/".concat(e.id),title:t("obj.open"),children:e.name}),(0,a.jsxs)("span",{className:"cres-st ".concat(U.Wy[l]),title:d||void 0,children:[(0,a.jsx)(I.md,{status:l}),t("obj.status.".concat(l)),d&&"error"===l?(0,a.jsx)("em",{children:d}):null]})]}),(0,a.jsxs)("div",{className:"cres-act",children:[o&&(0,a.jsx)(R.A,{size:14,className:"spin muted","aria-hidden":!0}),c&&(i?(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:!!u,onClick:()=>void N(e,"stop"),"aria-label":t("obj.act.stop"),title:t("obj.act.stop"),children:(0,a.jsx)(P.A,{size:14})}):(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:!!u,onClick:()=>void N(e,"start"),"aria-label":t("obj.act.start"),title:t("obj.act.start"),children:(0,a.jsx)(_.A,{size:14})})),c&&(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:!!u,onClick:()=>void N(e,"restart"),"aria-label":t("obj.act.restart"),title:t("obj.act.restart"),children:(0,a.jsx)(L.A,{size:14})}),(0,a.jsx)(r(),{className:"btn ghost icon sm",href:"/resources/".concat(e.id),"aria-label":t("obj.open"),title:t("obj.open"),children:(0,a.jsx)(H.A,{size:14})})]})]},e.id)})})]})]})}var O=t(10969),$=t(94227),q=t(89075),B=t(10776),G=t(79141),J=t(12582),Q=t(58311),X=t(25661),Z=t(68979),Y=t(76844);function V(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}function ee(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}var es=t(39696),et=t(78060),ea=t(61),en=t(80306),el=t(6458),ei=t(53983);let ec=/\.(png|jpe?g|gif|webp|svg|ico|bmp|avif)$/i,er=/\.(md|markdown|mdx)$/i;var eo=t(32480),ed=t(70665);function eh(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 eu=e=>{var s,t;return null!=(t=null==(s=/^(@@ [^@]+@@)/.exec(e))?void 0:s[1])?t:e};var em=t(3218),eg=t(97254),ex=t(55267),ep=t(69962),ej=t(58099);let eb=(0,i.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,E.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)(J.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)(ex.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)(J.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)(eg.SH,{text:e.text,path:h,ws:u})})]})}let{left:j,right:b}=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)(eg.SH,{text:j.text,path:h,ws:u}):null}),(0,a.jsx)("div",{className:"vl-ln ".concat(null!=(c=null==b?void 0:b.kind)?c:"void"),children:null!=(r=null==b?void 0:b.newNo)?r:""}),(0,a.jsx)("div",{className:"vl-cd ".concat(null!=(o=null==b?void 0:b.kind)?o:"void"),title:b&&b.text.length>60?b.text:void 0,children:b?(0,a.jsx)(eg.SH,{text:b.text,path:h,ws:u}):null})]})});function ef(e){let{parsed:s,layout:t,path:n,cutOff:l=!1,firstIndex:c=0,onDiscardHunk:r,onDiscardLines:o}=e,{whitespace:d}=(0,es.Wx)(),h=(0,i.useMemo)(()=>(function(e,s,t){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=[],l=(0,ep.KJ)(t);return e.hunks.forEach((e,t)=>{n.push({t:"hunk",idx:t+a,header:eu(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,i.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,i.useRef)(null),x=(0,i.useRef)(null),[p,j]=(0,i.useState)({max:0,track:0});(0,i.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,i.useEffect)(()=>{var e;x.current&&(x.current.scrollLeft=0),null==(e=g.current)||e.style.setProperty("--hx","0px")},[s,t]),(0,i.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[b,f]=(0,i.useState)(null);(0,i.useEffect)(()=>{f(null)},[s,t]);let v=e=>f(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=>f({hunk:e,picked:new Set}),stopPicking:()=>f(null),pickAll:(e,s)=>f({hunk:e,picked:new Set(Array.from({length:s},(e,s)=>s))}),discardPicked:(e,s)=>{if(b&&o){let t=[...b.picked].sort((e,s)=>e-s);f(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)(ej.T,{count:h.length,width:m,render:e=>{let t=h[e],i="line"===t.t&&(null==b?void 0:b.hunk)===t.hunk;return(0,a.jsx)(eb,{row:t,path:n,ws:d,actions:"hunk"!==t.t||l&&t.idx===s.hunks.length-1?void 0:N,picking:"hunk"===t.t||i?b:void 0,onPick:i?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}})})]})}function ev(e){let{path:s,hunk:t,index:n,total:l,extent:c,onClose:r,onGo:o}=e,{t:d}=(0,E.s9)(),h=(0,i.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:eu(t.header)}),(0,a.jsx)("span",{className:"small muted",children:d("git.peek.count",{n:n+1,total:l})}),(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)(eo.A,{size:15})}),(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:n>=l-1,onClick:()=>o(n+1),"aria-label":d("git.peek.next"),title:"".concat(d("git.peek.next")," (Alt+↓)"),children:(0,a.jsx)(A.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)(ed.A,{size:14})})]}),(0,a.jsx)("div",{className:"vl-peek-body",style:{height:Math.min(u*ej.U+4,260)},children:(0,a.jsx)(ef,{parsed:h,layout:"unified",path:s,firstIndex:n})})]})}function eN(e){var s,t;let{f:n,agent:l,blame:c,onOpenCommit:r,marks:o,allNew:d,focusLine:h}=e,u=null!=(s=null==o?void 0:o.groups)?s:[],[m,g]=(0,i.useState)(null),j=(0,i.useMemo)(()=>{let e=n.content.split("\n").length;return u.map(s=>({from:Math.min(s.from,e),to:Math.min(s.to,e)}))},[u,n.content]),b=m&&null!=(t=j[m.block])?t:null,[f,v]=(0,i.useState)(),N=(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)*ej.U},y=e=>34+Math.min((e.view.lines.length+1)*ej.U+4,260)+14,k=e=>{let s=j[e];if(!s)return;let t=Math.max(0,s.from-1);g({row:t,block:e}),v({top:t*ej.U,bottom:N(u[e],t)+y(u[e]),key:Date.now()})};(0,i.useEffect)(()=>{g(null)},[n.path,o]),(0,i.useEffect)(()=>{if(!m)return;let e=e=>{if("Escape"===e.key)g(null);else if(e.altKey&&("ArrowDown"===e.key||"ArrowUp"===e.key)){e.preventDefault();let s=m.block+("ArrowDown"===e.key?1:-1);s>=0&&s<u.length&&k(s)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[m]);let{t:w}=(0,E.s9)(),{whitespace:C}=(0,es.Wx)(),[S,A]=(0,i.useState)(null),[M,F]=(0,i.useState)(null),R=(0,em.Z)(n.content,n.path),P=(0,i.useMemo)(()=>R.length&&""===R[R.length-1]?R.slice(0,-1):R,[R]),_=(0,i.useMemo)(()=>n.content.split("\n").reduce((e,s)=>Math.max(e,s.length),0),[n.content]);(0,i.useEffect)(()=>{if(!c||"worktree"!==n.source){A(null),F(null);return}let e=!1;return x.FH.get("/agents/".concat(l.id,"/git/blame?path=").concat(encodeURIComponent(n.path))).then(s=>{e||(A(s),F(null))}).catch(s=>!e&&F(s instanceof Error?s.message:w("git.loadError"))),()=>{e=!0}},[c,l.id,n.path,n.source]);let L=(0,i.useMemo)(()=>{if(!S)return null;let e=-1;return S.lines.map((s,t)=>{let a=s!==S.lines[t-1];return a&&e++,{first:a,g:e%2}})},[S]);if(n.binary)return(0,a.jsx)("p",{className:"gx-note",children:w("git.file.binary")});if(0===P.length)return(0,a.jsx)("p",{className:"gx-note",children:w("git.file.empty")});let H=210*!!S;return(0,a.jsxs)("div",{className:"vf",children:["head"===n.source&&(0,a.jsx)("div",{className:"gx-banner",children:w("git.file.deleted")}),n.truncated&&(0,a.jsx)("div",{className:"gx-banner",children:w("git.file.truncated")}),M&&(0,a.jsx)("div",{className:"gx-banner",children:M}),(null==S?void 0:S.truncated)&&(0,a.jsx)("div",{className:"gx-banner",children:w("git.blame.truncated",{count:S.lines.length})}),(0,a.jsx)("div",{className:"vf-main",style:{"--vl-left":"".concat(H,"px")},children:(0,a.jsx)(ej.T,{count:P.length,width:"calc(".concat(H,"px + ").concat(6,"ch + ").concat(_,"ch + 40px)"),overlay:m&&u[m.block]?{top:N(u[m.block],m.row),node:(0,a.jsx)(ev,{path:n.path,hunk:u[m.block].view,index:m.block,extent:b,onClose:()=>g(null),total:u.length,onGo:k})}:void 0,reveal:h?{top:Math.max(0,h.line-4)*ej.U,bottom:(h.line+2)*ej.U,key:h.key}:f,render:e=>{var s;let t=null==S?void 0:S.lines[e],l=t?S.commits[t]:void 0,i=null==L?void 0:L[e],c="worktree"===n.source?d?"add":null==o?void 0:o.lines.get(e+1):void 0,x=!!o&&o.removedBefore.has(e+1),j=!!o&&e===P.length-1&&o.removedBefore.has(P.length+1),f=o&&"worktree"===n.source?null!=(s=o.blockOfLine.get(e+1))?s:x?o.blockOfRemoval.get(e+1):j?o.blockOfRemoval.get(P.length+1):void 0:void 0;return(0,a.jsxs)("div",{className:"vl-row ".concat(h&&e+1===h.line?"m-hit":""," ").concat(i?"bl-g".concat(i.g):""," ").concat(c?"m-".concat(c):""," ").concat(x?"m-delb":j?"m-dela":""," ").concat(void 0!==f?"has-peek":""," ").concat(b&&e+1>=b.from&&e+1<=b.to?"in-peek":""),onClick:void 0!==f?s=>{var t;if(!s.target.closest(".bl-btn")&&(s.target.closest(".vl-ln")||(null==(t=window.getSelection())?void 0:t.isCollapsed))){if((null==m?void 0:m.row)===e)return void g(null);g({row:e,block:f}),v({top:e*ej.U,bottom:N(u[f],e)+y(u[f]),key:Date.now()})}}:void 0,title:void 0!==f?w("git.peek.hint"):void 0,children:[S&&(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:w("git.blame.uncommitted")}):(0,a.jsxs)("button",{type:"button",className:"bl-btn",title:"".concat(l.summary,"\n").concat(l.author," \xb7 ").concat((0,z.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,p.KN)(l.time)})]}))}),(0,a.jsx)("div",{className:"vl-ln",children:e+1}),(0,a.jsx)("div",{className:"vl-cd",children:(0,a.jsx)(eg.Yr,{html:P[e],ws:C})})]},e)}})})]})}function ey(e){let{agent:s,gitRef:t,path:n,toolbar:l=!0}=e,{t:c}=(0,E.s9)(),[r,o]=(0,i.useState)(null),[d,h]=(0,i.useState)(""),[u,m]=(0,i.useState)("preview"),g=ec.test(n),p=er.test(n);return(0,i.useEffect)(()=>{let e=!1;if(o(null),h(""),m("preview"),!g)return x.FH.get("/agents/".concat(s.id,"/git/ref-file?ref=").concat(encodeURIComponent(t),"&path=").concat(encodeURIComponent(n))).then(s=>!e&&o(s)).catch(s=>!e&&h(s instanceof Error&&/not found/i.test(s.message)?c("git.file.missingAt",{ref:t}):s instanceof Error?s.message:c("git.loadError"))),()=>{e=!0}},[s.id,t,n]),(0,a.jsxs)(a.Fragment,{children:[l&&(0,a.jsxs)("div",{className:"gx-ptools",style:{padding:"6px 14px"},children:[(0,a.jsx)("span",{className:"mono small grow",title:n,style:{overflow:"hidden",textOverflow:"ellipsis"},children:n}),r&&(0,a.jsx)("span",{className:"muted small",children:(0,z.zi)(r.size)}),p&&r&&!r.binary&&(0,a.jsx)(T.$q,{value:u,onChange:m,options:[{id:"preview",label:c("git.view.preview")},{id:"source",label:c("git.view.source")}]}),(0,a.jsx)(O.WQ,{text:n,label:c("git.copyPath")})]}),(0,a.jsx)("div",{className:"gx-body",children:d?(0,a.jsx)("p",{className:"gx-note",children:d}):g?(0,a.jsx)("div",{className:"gx-image",children:(0,a.jsx)("img",{src:"/api/agents/".concat(s.id,"/git/raw-at?ref=").concat(encodeURIComponent(t),"&path=").concat(encodeURIComponent(n)),alt:n,onError:()=>h(c("git.file.missingAt",{ref:t}))})}):r?r.binary?(0,a.jsx)("p",{className:"gx-note",children:c("git.file.binary")}):p&&"preview"===u?(0,a.jsxs)("div",{className:"gx-md md",children:[r.truncated&&(0,a.jsx)("div",{className:"gx-banner",children:c("git.diff.truncated")}),(0,a.jsx)(el.oz,{remarkPlugins:[ei.A],components:{a:e=>(0,a.jsx)("a",{...e,target:"_blank",rel:"noreferrer"})},children:r.content})]}):(0,a.jsx)(eN,{f:r,agent:s,blame:!1,onOpenCommit:()=>void 0,marks:null,allNew:!1}):(0,a.jsx)("p",{className:"gx-note",children:c("git.loading")})})]})}let ek={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflict:"!",typechange:"T"};function ew(e){let{status:s,titled:t=!1}=e,{t:n}=(0,E.s9)();return(0,a.jsx)("span",{className:"stl st-".concat(s),title:t?n("git.status.".concat(s)):void 0,children:ek[s]})}function eC(e){let{agent:s,gitRef:t,path:n,label:l}=e,[c,r]=(0,i.useState)(!0);return((0,i.useEffect)(()=>{r(!0)},[t,n]),c)?(0,a.jsxs)("figure",{className:"gx-pic",children:[(0,a.jsx)("figcaption",{className:"muted small",children:l}),(0,a.jsx)("div",{className:"gx-image",children:(0,a.jsx)("img",{src:"/api/agents/".concat(s.id,"/git/raw-at?ref=").concat(encodeURIComponent(t),"&path=").concat(encodeURIComponent(n)),alt:n,onError:()=>r(!1)})})]}):null}function eS(e){var s;let{agent:t,detailUrl:n,diffUrl:l,header:c,focus:r,embedded:o=!1,before:d,after:h,label:u}=e,{t:m}=(0,E.s9)(),[g,p]=(0,i.useState)(null),[j,b]=(0,i.useState)(null),[f,v]=(0,i.useState)(null),[N,y]=(0,i.useState)("unified"),[k,w]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!1;return p(null),b(null),v(null),w(null),x.FH.get(n).then(s=>{var t,a;e||(p(s),b(null!=(a=r&&s.files.some(e=>e.path===r)?r:null==(t=s.files[0])?void 0:t.path)?a:null))}).catch(s=>!e&&w(s instanceof Error?s.message:m("git.loadError"))),()=>{e=!0}},[t.id,n,r]);let C=null==g?void 0:g.files.find(e=>e.path===j);(0,i.useEffect)(()=>{if(!C)return void v(null);let e=!1;return v(null),x.FH.get(l(C)).then(s=>!e&&v(s)).catch(s=>!e&&w(s instanceof Error?s.message:m("git.loadError"))),()=>{e=!0}},[t.id,n,null==C?void 0:C.path,null==C?void 0:C.oldPath]);let S=(0,i.useMemo)(()=>f&&C&&f.path===C.path?eh(f.diff):null,[f,C]);if(k)return(0,a.jsx)("section",{className:"gx-preview",children:(0,a.jsx)("p",{className:"gx-note err",children:k})});if(!g)return(0,a.jsx)("section",{className:"gx-preview",children:(0,a.jsx)("p",{className:"gx-note",children:m("git.loading")})});let A=!!C&&ec.test(C.path);return(0,a.jsxs)("section",{className:"gx-preview gx-commitview ".concat(o?"embedded":""),"aria-label":u,children:[(0,a.jsx)("header",{className:"gx-chead",children:c(g)}),0===g.files.length?(0,a.jsx)("p",{className:"gx-note",children:m("git.cmp.nofiles")}):(0,a.jsx)("div",{className:"gx-cfilelist",role:"listbox",children:g.files.map(e=>{var s,t;return(0,a.jsxs)("button",{role:"option","aria-selected":j===e.path,className:"gx-cfile ".concat(j===e.path?"sel":""),onClick:()=>b(e.path),title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:[(0,a.jsx)(ew,{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)})}),C&&(0,a.jsxs)(a.Fragment,{children:[!A&&(0,a.jsx)("div",{className:"gx-ptools",style:{padding:"6px 14px"},children:(0,a.jsx)(T.$q,{value:N,onChange:y,options:[{id:"unified",label:m("git.layout.unified")},{id:"split",label:m("git.layout.split")}]})}),(0,a.jsx)("div",{className:"gx-body",children:A?(0,a.jsxs)("div",{className:"gx-picpair",children:["added"!==C.status&&(0,a.jsx)(eC,{agent:t,gitRef:d,path:null!=(s=C.oldPath)?s:C.path,label:m("git.img.before")}),"deleted"!==C.status&&(0,a.jsx)(eC,{agent:t,gitRef:h,path:C.path,label:m("git.img.after")})]}):S?S.binary?(0,a.jsx)("p",{className:"gx-note",children:m("git.diff.binary")}):0===S.hunks.length?(0,a.jsx)("p",{className:"gx-note",children:m("git.diff.empty")}):(0,a.jsxs)(a.Fragment,{children:[(null==f?void 0:f.truncated)&&(0,a.jsx)("div",{className:"gx-banner",children:m("git.diff.truncated")}),(0,a.jsx)(ef,{parsed:S,layout:N,path:C.path})]}):(0,a.jsx)("p",{className:"gx-note",children:m("git.loading")})})]})]})}function eA(e){let{agent:s,sha:t,embedded:n=!1,focus:l}=e,{t:i}=(0,E.s9)();return(0,a.jsx)(eS,{agent:s,detailUrl:"/agents/".concat(s.id,"/git/commit?sha=").concat(t),embedded:n,focus:l,before:"".concat(t,"^"),after:t,label:t,diffUrl:e=>"/agents/".concat(s.id,"/git/commit-diff?sha=").concat(t,"&path=").concat(encodeURIComponent(e.path)).concat(e.oldPath?"&old=".concat(encodeURIComponent(e.oldPath)):""),header:e=>{let[s,...t]=e.message.split("\n"),n=t.join("\n").trim();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{children:s}),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:e.sha.slice(0,10)}),(0,a.jsx)(O.WQ,{text:e.sha,label:i("git.info.copySha"),compact:!0}),(0,a.jsxs)("span",{children:["\xb7 ",e.author," \xb7 ",(0,z.v7)(e.date)]}),(0,a.jsxs)("span",{children:["\xb7 ",i("git.hist.files",{count:e.files.length})]})]})]})}})}function ez(e){let{agent:s,sel:t,onSelect:n,onLoaded:l}=e,{t:c}=(0,E.s9)(),[r,o]=(0,i.useState)(null),[d,h]=(0,i.useState)(!1),[u,m]=(0,i.useState)(""),[g,j]=(0,i.useState)("");(0,i.useEffect)(()=>{let e=!1;return o(null),j(""),x.FH.get("/agents/".concat(s.id,"/git/tags")).then(s=>{e||(o(s.tags),h(s.truncated),null==l||l(s.tags))}).catch(s=>!e&&j(s instanceof Error?s.message:"error")),()=>{e=!0}},[s.id]);let b=(0,i.useMemo)(()=>(null!=r?r:[]).filter(e=>!u||"".concat(e.name," ").concat(e.subject).toLowerCase().includes(u.toLowerCase())),[r,u]);return g?(0,a.jsx)("p",{className:"gx-note err",children:g}):r?r.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"gx-filter",children:(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(Q.A,{size:14}),(0,a.jsx)("input",{className:"input",placeholder:c("git.tags.search"),value:u,onChange:e=>m(e.target.value),"aria-label":c("git.tags.search")})]})}),(0,a.jsxs)("div",{className:"gx-hist",role:"listbox","aria-label":c("git.tab.tags"),children:[b.map(e=>(0,a.jsxs)("button",{role:"option","aria-selected":t===e.name,className:"gx-commit ".concat(t===e.name?"sel":""),onClick:()=>n(e),children:[(0,a.jsxs)("span",{className:"subj",children:[(0,a.jsx)(ea.A,{size:13,style:{verticalAlign:"-2px",marginRight:5}}),e.name]}),(0,a.jsx)("span",{className:"meta",children:e.subject||"—"}),(0,a.jsxs)("span",{className:"meta",children:[(0,a.jsx)("span",{className:"mono sha",children:e.sha.slice(0,8)})," \xb7 ",(0,p.KN)(Date.parse(e.date))]})]},e.name)),!b.length&&(0,a.jsx)("p",{className:"gx-note",children:c("git.noMatch",{query:u})}),d&&(0,a.jsx)("p",{className:"gx-note",children:c("git.tags.truncated",{count:r.length})})]})]}):(0,a.jsx)("p",{className:"gx-note",children:c("git.tags.empty")}):(0,a.jsx)("p",{className:"gx-note",children:c("git.loading")})}function eE(e){var s;let{agent:t,tag:n,onChanged:l}=e,{t:c}=(0,E.s9)(),r=(0,T.dj)(),[o,d]=(0,i.useState)(null),[h,u]=(0,i.useState)(""),m=!!o&&/^[\w./-]+$/.test(o)&&!o.startsWith("-")&&!o.endsWith("/")&&!o.includes(".."),g=async()=>{if(o&&m)try{await x.FH.post("/agents/".concat(t.id,"/git/branch-create"),{branch:o,from:n.name}),r(c("git.tags.branchCreated",{branch:o})),d(null),u(""),null==l||l()}catch(e){u(e instanceof Error?e.message:"error")}},[p,j]=(0,i.useState)("files"),[b,f]=(0,i.useState)(null),[v,N]=(0,i.useState)(!1),[y,k]=(0,i.useState)(new Set),[w,C]=(0,i.useState)(""),[S,M]=(0,i.useState)(null),[F,R]=(0,i.useState)("");(0,i.useEffect)(()=>{j("files"),M(null),C(""),k(new Set)},[n.name]),(0,i.useEffect)(()=>{let e=!1;return f(null),R(""),x.FH.get("/agents/".concat(t.id,"/git/tag-tree?tag=").concat(encodeURIComponent(n.name))).then(s=>{e||(f(s.files),N(s.truncated),k(new Set(s.files.length<=40?s.files.flatMap(e=>e.split("/").slice(0,-1).map((e,s,t)=>t.slice(0,s+1).join("/"))):[])))}).catch(s=>!e&&R(s instanceof Error?s.message:c("git.loadError"))),()=>{e=!0}},[t.id,n.name]);let P=(0,i.useMemo)(()=>b?V(b,[]):null,[b]),_=(0,i.useMemo)(()=>P?ee(P,y,{query:w,onlyChanged:!1}).slice(0,3e3):[],[P,y,w]);return(0,a.jsxs)("section",{className:"gx-preview gx-tagview","aria-label":n.name,children:[(0,a.jsxs)("header",{className:"gx-chead",children:[(0,a.jsxs)("h3",{children:[(0,a.jsx)(ea.A,{size:16,style:{verticalAlign:"-2px",marginRight:6}}),n.name]}),n.subject&&(0,a.jsx)("div",{children:n.subject}),(0,a.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,a.jsx)("span",{className:"gx-chip soft",children:n.annotated?c("git.tags.annotated"):c("git.tags.lightweight")}),(0,a.jsx)("span",{className:"mono",children:n.sha.slice(0,10)}),(0,a.jsx)(O.WQ,{text:n.sha,label:c("git.info.copySha"),compact:!0}),(0,a.jsxs)("span",{children:["\xb7 ",(0,z.v7)(n.date)]}),b&&(0,a.jsxs)("span",{children:["\xb7 ",c("git.tags.nfiles",{count:b.length})]})]}),(0,a.jsx)("div",{className:"row gap-s wrap",style:{marginTop:8},children:null===o?(0,a.jsxs)("button",{className:"btn sm",onClick:()=>d(""),children:[(0,a.jsx)(B.A,{size:14}),c("git.tags.newBranch")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{className:"input mono",style:{maxWidth:240},autoFocus:!0,placeholder:c("git.tags.branchName"),value:o,onChange:e=>{d(e.target.value.trim()),u("")},"aria-label":c("git.tags.branchName"),onKeyDown:e=>{"Enter"===e.key&&g(),"Escape"===e.key&&d(null)}}),(0,a.jsx)("button",{className:"btn primary sm",disabled:!m,onClick:()=>void g(),children:c("git.tags.createBranch")}),(0,a.jsx)("button",{className:"btn ghost sm",onClick:()=>{d(null),u("")},children:c("common.cancel")})]})}),h&&(0,a.jsx)("p",{className:"gx-note err",style:{margin:0},children:h}),(0,a.jsx)("div",{style:{marginTop:4},children:(0,a.jsx)(T.$q,{value:p,onChange:j,options:[{id:"files",label:c("git.tags.files")},{id:"changes",label:c("git.tags.changes")}]})})]}),"changes"===p?(0,a.jsx)(eA,{agent:t,sha:n.sha,embedded:!0},n.sha):F?(0,a.jsx)("p",{className:"gx-note err",children:F}):P?(0,a.jsxs)("div",{className:"gx-tagfiles",children:[(0,a.jsxs)("div",{className:"gx-tagtree",children:[(0,a.jsx)("div",{className:"gx-filter",children:(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(Q.A,{size:14}),(0,a.jsx)("input",{className:"input",placeholder:c("git.filterPlaceholder"),value:w,onChange:e=>C(e.target.value),"aria-label":c("git.filterPlaceholder")})]})}),(0,a.jsxs)("div",{className:"gx-list",role:"tree",children:[0===_.length?(0,a.jsx)("p",{className:"gx-note",children:w?c("git.noMatch",{query:w}):c("git.noFiles")}):_.map(e=>{let{node:s,depth:t}=e,n="dir"===s.type,l=n&&(!!w||y.has(s.path));return(0,a.jsxs)("button",{type:"button",role:"treeitem","aria-level":t+1,"aria-expanded":n?l:void 0,"aria-selected":!n&&S===s.path,className:"gx-row ".concat(n?"dir":"file"," ").concat(n||S!==s.path?"":"sel"),style:{paddingLeft:8+14*t},title:s.path,onClick:()=>{let e;return n?(e=s.path,k(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})):M(s.path)},children:[(0,a.jsx)("span",{className:"chev",children:n?l?(0,a.jsx)(A.A,{size:14}):(0,a.jsx)(G.A,{size:14}):null}),(0,a.jsx)("span",{className:"ico",children:n?l?(0,a.jsx)(en.A,{size:15}):(0,a.jsx)($.A,{size:15}):(0,a.jsx)(X.A,{size:15})}),(0,a.jsx)("span",{className:"nm",children:s.name})]},s.path)}),v&&(0,a.jsx)("p",{className:"gx-note",children:c("git.treeTruncated",{count:null!=(s=null==b?void 0:b.length)?s:0})})]})]}),(0,a.jsx)("div",{className:"gx-tagfile",children:S?(0,a.jsx)(ey,{agent:t,gitRef:n.name,path:S}):(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:c("git.tags.pick")})})})]}):(0,a.jsx)("p",{className:"gx-note",children:c("git.loading")})]})}var eM=t(71857),eF=t(72705),eR=t(21018);function eP(e){var s,t,n,l;let{refs:c,value:r,onChange:o,label:d,extra:h,icon:u=!0,compact:m=!1}=e,{t:g}=(0,E.s9)(),[x,j]=(0,i.useState)(!1),[b,f]=(0,i.useState)(""),v=(0,i.useRef)(null);(0,eR.s)(x,v,()=>j(!1)),(0,i.useEffect)(()=>{x&&f("")},[x]);let N=e=>!b||"".concat(e.name," ").concat(e.subject).toLowerCase().includes(b.toLowerCase()),y=(0,i.useMemo)(()=>{var e;return(null!=(e=null==c?void 0:c.branches)?e:[]).filter(N)},[c,b]),k=(0,i.useMemo)(()=>{var e;return(null!=(e=null==c?void 0:c.remotes)?e:[]).filter(N)},[c,b]),w=(0,i.useMemo)(()=>{var e;return(null!=(e=null==c?void 0:c.tags)?e:[]).filter(N)},[c,b]),C=b.trim(),S=/^([0-9a-f]{7,40}|HEAD([~^]\d*)*)$/i.test(C)&&![...null!=(t=null==c?void 0:c.branches)?t:[],...null!=(n=null==c?void 0:c.tags)?n:[]].some(e=>e.name===C),z=e=>{o(e),j(!1)},M=(e,s)=>(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":r===e.name,className:"gx-refrow ".concat(r===e.name?"sel":""),onClick:()=>z(e.name),title:e.subject,children:[(0,a.jsxs)("span",{className:"nm",children:[r===e.name?(0,a.jsx)(eF.A,{size:13}):"tag"===s?(0,a.jsx)(ea.A,{size:13}):(0,a.jsx)(B.A,{size:13}),e.name]}),(0,a.jsxs)("span",{className:"sub",children:[e.subject||"—"," \xb7 ",(0,p.KN)(Date.parse(e.date))]})]},"".concat(s,":").concat(e.name));return(0,a.jsxs)("div",{className:"gx-brmenu gx-refpick",ref:v,children:[m?(0,a.jsxs)("button",{type:"button",className:"btn sm ".concat(r?"primary gx-refbtn":"ghost icon"),"aria-expanded":x,"aria-haspopup":"listbox","aria-label":d,title:d,onClick:()=>j(e=>!e),children:[(0,a.jsx)(B.A,{size:14}),r&&(0,a.jsx)("span",{className:"nm mono",children:r})]}):(0,a.jsxs)("button",{type:"button",className:"btn sm gx-refbtn","aria-expanded":x,"aria-haspopup":"listbox",title:d,onClick:()=>j(e=>!e),children:[u&&(0,a.jsx)(B.A,{size:14}),(0,a.jsx)("span",{className:"nm mono",children:null!=(l=null==h||null==(s=h.find(e=>e.value===r))?void 0:s.label)?l:r||g("git.ref.pick")}),(0,a.jsx)(A.A,{size:13})]}),x&&(0,a.jsxs)("div",{className:"gx-pop",role:"listbox",children:[(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(Q.A,{size:14}),(0,a.jsx)("input",{className:"input",autoFocus:!0,placeholder:g("git.ref.search"),value:b,onChange:e=>f(e.target.value),"aria-label":g("git.ref.search"),onKeyDown:e=>{"Enter"===e.key&&S&&z(C)}})]}),(0,a.jsxs)("div",{className:"gx-brlist",children:[!b&&(null==h?void 0:h.map(e=>(0,a.jsx)("button",{type:"button",role:"option","aria-selected":r===e.value,className:"gx-refrow ".concat(r===e.value?"sel":""),onClick:()=>z(e.value),children:(0,a.jsxs)("span",{className:"nm",children:[r===e.value&&(0,a.jsx)(eF.A,{size:13}),e.label]})},e.value))),S&&(0,a.jsx)("button",{type:"button",className:"gx-refrow",onClick:()=>z(C),children:(0,a.jsx)("span",{className:"nm mono",children:g("git.ref.useCommit",{ref:C.slice(0,12)})})}),y.length>0&&(0,a.jsx)("div",{className:"gx-brhead",children:g("git.ref.branches")}),y.map(e=>M(e,"branch")),w.length>0&&(0,a.jsx)("div",{className:"gx-brhead",children:g("git.ref.tags")}),w.slice(0,200).map(e=>M(e,"tag")),k.length>0&&(0,a.jsx)("div",{className:"gx-brhead",children:g("git.ref.remotes")}),k.slice(0,200).map(e=>M(e,"branch")),c&&!y.length&&!w.length&&!k.length&&!S&&(0,a.jsx)("p",{className:"gx-note",children:g("git.ref.none")})]})]})]})}function e_(e){let{refs:s,sel:t,onChange:n}=e,{t:l}=(0,E.s9)();return(0,a.jsxs)("div",{className:"gx-cmpside",children:[(0,a.jsx)("label",{className:"label",children:l("git.cmp.base")}),(0,a.jsx)(eP,{refs:s,value:t.base,onChange:e=>n({...t,base:e})}),(0,a.jsx)("div",{className:"row",style:{justifyContent:"center"},children:(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>n({base:t.head,head:t.base}),disabled:!t.base&&!t.head,"aria-label":l("git.cmp.swap"),title:l("git.cmp.swap"),children:(0,a.jsx)(eM.A,{size:15,style:{transform:"rotate(90deg)"}})})}),(0,a.jsx)("label",{className:"label",children:l("git.cmp.head")}),(0,a.jsx)(eP,{refs:s,value:t.head,onChange:e=>n({...t,head:e})}),(!t.base||!t.head)&&(0,a.jsx)("p",{className:"muted small",children:l("git.cmp.pick")})]})}function eL(e){let{agent:s,sel:t}=e,{t:n}=(0,E.s9)();if(!(t.base&&t.head))return(0,a.jsx)("div",{className:"gx-preview",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:n("git.cmp.pick")})})});let l="base=".concat(encodeURIComponent(t.base),"&head=").concat(encodeURIComponent(t.head));return(0,a.jsx)(eS,{agent:s,detailUrl:"/agents/".concat(s.id,"/git/compare?").concat(l),before:t.base,after:t.head,label:"".concat(t.base," → ").concat(t.head),diffUrl:e=>"/agents/".concat(s.id,"/git/compare-diff?").concat(l,"&path=").concat(encodeURIComponent(e.path)).concat(e.oldPath?"&old=".concat(encodeURIComponent(e.oldPath)):""),header:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("h3",{children:[(0,a.jsx)("span",{className:"mono",children:t.base})," → ",(0,a.jsx)("span",{className:"mono",children:t.head})]}),e.base.sha===e.head.sha?(0,a.jsx)("p",{className:"muted small",style:{margin:0},children:n("git.cmp.same")}):(0,a.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,a.jsx)("span",{children:n("git.cmp.summary",{ahead:e.ahead,behind:e.behind})}),(0,a.jsxs)("span",{children:["\xb7 ",n("git.hist.files",{count:e.files.length})]})]}),e.commits.length>0&&(0,a.jsxs)("details",{className:"gx-cmpcommits",children:[(0,a.jsx)("summary",{children:n("git.cmp.commits",{count:e.ahead})}),(0,a.jsx)("ul",{children:e.commits.map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("span",{className:"mono sha",children:e.short})," ",e.subject," ",(0,a.jsxs)("span",{className:"muted",children:["\xb7 ",e.author," \xb7 ",(0,p.KN)(Date.parse(e.date))]})]},e.sha))}),e.commitsTruncated&&(0,a.jsx)("p",{className:"muted small",children:n("git.cmp.more",{count:e.commits.length})})]})]})})}function eH(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 eI(e,s,t){let a=eH(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")}var eU=t(96213);function eD(e){let{agent:s,path:t,state:n,a:l,onResolved:c}=e,{t:r}=(0,E.s9)(),[o,h]=(0,i.useState)(null),[u,m]=(0,i.useState)(""),[g,p]=(0,i.useState)(null),[j,b]=(0,i.useState)(0);(0,i.useEffect)(()=>{let e=!1;return h(null),p(null),x.FH.get("/agents/".concat(s.id,"/git/file?path=").concat(encodeURIComponent(t))).then(s=>{e||(h(s),m(s.content))}).catch(s=>!e&&p(s instanceof Error?s.message:r("git.loadError"))),()=>{e=!0}},[s.id,t,j]);let f=(0,i.useMemo)(()=>eH(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=!!l.busy,S=async e=>{await l.run("resolve",r("git.res.done"),"resolve-side",{path:t,side:N(e)})&&c()},A=async()=>{await l.run("resolve",r("git.res.done"),"resolve",{path:t,content:u})&&c()},z=async()=>{await l.run("unresolve",r("git.res.restored"),"unresolve",{path:t})&&b(e=>e+1)},M=t.lastIndexOf("/"),F=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:F}),(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:f.length>0?r("git.res.left",{count:f.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)(O.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:[f.length>0&&(0,a.jsx)("div",{className:"gx-rblocks",children:f.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:f.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)(eg.Cy,{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=>eI(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=>eI(e,s,y("both-mine"))),children:r("git.res.bothMine")}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>m(e=>eI(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)(eU.B,{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 eT(e){let{agent:s,plan:t,a:n,onClose:l,onGo:i}=e,{t:c}=(0,E.s9)();return(0,a.jsxs)(T.TM,{title:c("git.sw.title",{branch:t.to}),confirmLabel:c("git.sw.anyway"),onConfirm:()=>{n.busy||i()},onClose:l,children:[t.carried>0&&(0,a.jsx)("p",{className:"confirm-body",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(", ")})})]})]})}var eK=t(43380),eW=t(24328),eO=t(97356);function e$(e){let{stashes:s,sel:t,onSelect:n,onSave:l,canSave:i}=e,{t:c}=(0,E.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)(eK.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,p.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 eq(e){let{a:s,onClose:t}=e,{t:n}=(0,E.s9)(),[l,c]=(0,i.useState)(""),r=async()=>{t(),await s.run("stash",n("git.stash.saved"),"stash-save",{message:l})};return(0,a.jsxs)(T.aF,{title:n("git.stash.save"),onClose:t,children:[(0,a.jsx)("p",{className:"confirm-body",children:n("git.stash.save.body")}),(0,a.jsx)("input",{className:"input",autoFocus:!0,value:l,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 confirm-actions",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 eB(e){var s,t;let{agent:n,stash:l,a:c}=e,{t:r}=(0,E.s9)(),[o,d]=(0,i.useState)(null),[h,u]=(0,i.useState)(null),[m,g]=(0,i.useState)(null),[j,b]=(0,i.useState)(null),[f,v]=(0,i.useState)(!1),[N,y]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!1;return d(null),u(null),g(null),b(null),y(null),Promise.all([x.FH.get("/agents/".concat(n.id,"/git/stash?sha=").concat(l.sha)),x.FH.get("/agents/".concat(n.id,"/git/commit?sha=").concat(l.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,l.sha]),(0,i.useEffect)(()=>{if(!m||!o)return void b(null);let e=m.untracked?o.untrackedSha:l.sha;if(!e)return;let s=!1;return b(null),x.FH.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&&b(e)).catch(e=>!s&&y(e instanceof Error?e.message:r("git.loadError"))),()=>{s=!0}},[n.id,l.sha,o,null==m?void 0:m.path,null==m?void 0:m.untracked]);let k=(0,i.useMemo)(()=>j?eh(j.diff):null,[j]),w=!!c.busy,C=e=>void c.run("stash",e?r("git.stash.popped"):r("git.stash.applied"),"stash-apply",{sha:l.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":l.message,children:[(0,a.jsxs)("header",{className:"gx-chead",children:[(0,a.jsx)("h3",{children:l.message||"—"}),(0,a.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,a.jsxs)("span",{children:[l.branch&&"".concat(l.branch," \xb7 "),(0,p.KN)(Date.parse(l.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)(eW.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)(eO.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)(ew,{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)(ew,{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)(ef,{parsed:k,layout:"unified",path:m.path,cutOff:!!(null==j?void 0:j.truncated)}):(0,a.jsx)("p",{className:"gx-note",children:r("git.loading")})}),f&&(0,a.jsx)(T.TM,{danger:!0,title:r("git.stash.drop.title"),body:r("git.stash.drop.body",{name:l.message||"—"}),confirmLabel:r("git.stash.drop"),onClose:()=>v(!1),onConfirm:()=>{w||c.run("stash",r("git.stash.dropped"),"stash-drop",{sha:l.sha})},children:(0,a.jsx)("p",{className:"gx-lost",children:r("git.discard.all.warn")})})]})}var eG=t(6819),eJ=t(50703),eQ=t(75014),eX=t(10216);function eZ(e){let{a:s}=e,{t}=(0,E.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)(ed.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 eY(e){let{a:s,ahead:t,behind:n,detached:l,changeCount:i,onCommit:c}=e,{t:r}=(0,E.s9)(),o=!!s.busy;return(0,a.jsxs)("div",{className:"gx-acts",role:"group","aria-label":r("git.act.group"),children:[(0,a.jsx)("button",{className:"btn sm",disabled:o,title:"".concat(r("git.act.fetch"),": ").concat(r("git.act.fetch.hint")),"aria-label":r("git.act.fetch"),onClick:()=>void s.run("fetch",r("git.done.fetch"),"fetch"),children:"fetch"===s.busy?(0,a.jsx)(R.A,{size:14,className:"spin"}):(0,a.jsx)(eG.A,{size:14})}),(0,a.jsxs)("button",{className:"btn sm",disabled:o,title:"".concat(r("git.act.pull"),": ").concat(r("git.act.pull.hint")),"aria-label":r("git.act.pull"),onClick:()=>void s.run("pull",r("git.done.pull"),"pull"),children:["pull"===s.busy?(0,a.jsx)(R.A,{size:14,className:"spin"}):(0,a.jsx)(eJ.A,{size:14}),n>0&&(0,a.jsx)("span",{className:"ct",children:n})]}),(0,a.jsxs)("button",{className:"btn sm",disabled:o||l,title:"".concat(r("git.act.push"),": ").concat(r("git.act.push.hint")),"aria-label":r("git.act.push"),onClick:()=>void s.run("push",r("git.done.push"),"push"),children:["push"===s.busy?(0,a.jsx)(R.A,{size:14,className:"spin"}):(0,a.jsx)(eQ.A,{size:14}),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)(R.A,{size:14,className:"spin"}):(0,a.jsx)(eX.A,{size:14}),r("git.act.commit"),i>0&&(0,a.jsx)("span",{className:"ct",children:i})]})]})}var eV=t(92947),e0=t(67384);function e1(e){let{agent:s,a:t,current:n,onSwitch:l}=e,{t:c}=(0,E.s9)(),[r,o]=(0,i.useState)(!1),[d,h]=(0,i.useState)(null),[u,m]=(0,i.useState)(""),[g,j]=(0,i.useState)(""),[b,f]=(0,i.useState)(null),[v,N]=(0,i.useState)(null),[y,k]=(0,i.useState)(""),w=(0,i.useRef)(null);(0,eR.s)(r,w,()=>o(!1)),(0,i.useEffect)(()=>{r&&(k(""),f(null),x.FH.get("/agents/".concat(s.id,"/git/branches")).then(h).catch(e=>k(e instanceof Error?e.message:"error")))},[r,s.id]);let C=(0,i.useMemo)(()=>{var e;return(null!=(e=null==d?void 0:d.local)?e:[]).filter(e=>e.name.toLowerCase().includes(u.toLowerCase()))},[d,u]),S=(0,i.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]),z=async(e,s,a,n)=>{o(!1),await t.run(e,s,a,n)},M=/^[\w./-]+$/.test(g)&&!g.startsWith("-")&&!g.endsWith("/")&&!g.includes("..");return(0,a.jsxs)("div",{className:"gx-brmenu",ref:w,children:[(0,a.jsxs)("button",{type:"button",className:"btn sm","aria-expanded":r,"aria-haspopup":"dialog",onClick:()=>o(e=>!e),children:[(0,a.jsx)(B.A,{size:14}),c("git.act.branches"),(0,a.jsx)(A.A,{size:13})]}),r&&(0,a.jsxs)("div",{className:"gx-pop",role:"dialog","aria-label":c("git.act.branches"),children:[(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(Q.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=>j(e.target.value.trim()),"aria-label":c("git.br.new",{branch:null!=n?n:""}),onKeyDown:e=>{"Enter"===e.key&&M&&z("switch",c("git.done.switch",{branch:g}),"switch",{branch:g,create:!0})}}),(0,a.jsxs)("button",{className:"btn sm",disabled:!M||!!t.busy,title:c("git.br.new",{branch:null!=n?n:"…"}),onClick:()=>void z("switch",c("git.done.switch",{branch:g}),"switch",{branch:g,create:!0}),children:[(0,a.jsx)(eV.A,{size:14}),c("git.br.create")]})]}),y&&(0,a.jsx)("p",{className:"gx-note err",children:y}),(0,a.jsxs)("div",{className:"gx-brlist",children:[C.length>0&&(0,a.jsx)("div",{className:"gx-brhead",children:c("git.br.local")}),C.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),l(e.name)},title:c("git.br.switchTo",{branch:e.name}),children:[(0,a.jsxs)("span",{className:"nm",children:[e.name===n&&(0,a.jsx)(eF.A,{size:13}),e.name]}),(0,a.jsxs)("span",{className:"sub",children:[e.subject," \xb7 ",(0,p.KN)(Date.parse(e.date))]})]}),e.name!==n&&(0,a.jsx)("button",{className:"btn ghost icon sm",disabled:!!t.busy,onClick:()=>f(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)(e0.A,{size:14})}),e.name!==n&&(0,a.jsx)("button",{className:"btn ghost icon sm",disabled:!!t.busy,onClick:()=>{t.setNotice(null),N(e.name),o(!1)},"aria-label":c("git.br.delete",{branch:e.name}),title:c("git.br.delete",{branch:e.name}),children:(0,a.jsx)(eO.A,{size:14})})]},e.name)),S.length>0&&(0,a.jsx)("div",{className:"gx-brhead",children:c("git.br.remote")}),S.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),l(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,p.KN)(Date.parse(e.date))]})]}),(0,a.jsx)("button",{className:"btn ghost icon sm",disabled:!!t.busy,onClick:()=>f(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)(e0.A,{size:14})})]},e.name)),d&&!C.length&&!S.length&&(0,a.jsx)("p",{className:"gx-note",children:c("git.br.none")})]}),b&&(0,a.jsxs)("div",{className:"gx-mergeask",children:[(0,a.jsx)("span",{children:c("git.br.mergeAsk",{from:b,into:null!=n?n:""})}),(0,a.jsxs)("div",{className:"row gap-s",children:[(0,a.jsx)("button",{className:"btn ghost sm",onClick:()=>f(null),children:c("common.cancel")}),(0,a.jsx)("button",{className:"btn primary sm",disabled:!!t.busy,onClick:()=>void z("merge",c("git.done.merge",{branch:b}),"merge",{branch:b}),children:c("git.br.mergeGo")})]})]})]}),v&&(0,a.jsxs)(T.aF,{title:c("git.br.delete",{branch:v}),onClose:()=>N(null),children:[(0,a.jsx)("p",{className:"confirm-body",children:c("git.br.deleteAsk",{branch:v})}),t.notice&&(0,a.jsx)("pre",{className:"gx-notice err gx-prewrap",children:t.notice.text}),(0,a.jsxs)("div",{className:"row confirm-actions",children:[(0,a.jsx)("button",{className:"btn ghost",onClick:()=>N(null),children:c("common.cancel")}),t.notice&&/not fully merged/i.test(t.notice.text)?(0,a.jsx)("button",{className:"btn danger",disabled:!!t.busy,onClick:async()=>{await t.run("branch-delete",c("git.done.branchDelete"),"branch-delete",{branch:v,force:!0})&&N(null)},children:c("git.br.deleteForce")}):(0,a.jsx)("button",{className:"btn danger",disabled:!!t.busy,onClick:async()=>{await t.run("branch-delete",c("git.done.branchDelete"),"branch-delete",{branch:v})&&N(null)},children:c("git.br.deleteGo")})]})]})]})}function e4(e){let{changes:s,a:t,onClose:n,initialMessage:l=""}=e,{t:c}=(0,E.s9)(),[r,o]=(0,i.useState)(()=>new Set(s.map(e=>e.path))),[d,h]=(0,i.useState)(l),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)(T.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)(ew,{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 confirm-actions",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 e9(e){let{agent:s,head:t,sel:n,onSelect:l,refs:c,path:r,onClearPath:o}=e,{t:d}=(0,E.s9)(),[h,u]=(0,i.useState)(null),[m,g]=(0,i.useState)(!1),[j,b]=(0,i.useState)(!1),[f,v]=(0,i.useState)(""),[N,y]=(0,i.useState)(""),[k,w]=(0,i.useState)("message"),[C,S]=(0,i.useState)(""),[A,z]=(0,i.useState)("");(0,i.useEffect)(()=>{let e=setTimeout(()=>z(N.trim()),350);return()=>clearTimeout(e)},[N]);let M=!!(A||r||C),F=async e=>{b(!0);try{let t="skip=".concat(e).concat(A?"&q=".concat(encodeURIComponent(A),"&by=").concat(k):"").concat(r?"&path=".concat(encodeURIComponent(r)):"").concat(C?"&ref=".concat(encodeURIComponent(C)):""),a=await x.FH.get("/agents/".concat(s.id,"/git/log?").concat(t));return u(s=>0===e?a.commits:[...null!=s?s:[],...a.commits]),g(a.hasMore),v(""),a.commits}catch(e){return v(e instanceof Error?e.message:"error"),null}finally{b(!1)}},R=(0,i.useRef)("");return(0,i.useEffect)(()=>{let e="".concat(A,"|").concat(k,"|").concat(null!=r?r:"","|").concat(C),s=e!==R.current;R.current=e,F(0).then(e=>{e&&e.length&&(s||!n)&&l(e[0].sha)})},[s.id,t,A,k,r,C]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"gx-hfilter",children:[(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(Q.A,{size:14}),(0,a.jsx)("input",{className:"input",placeholder:d("git.hist.search"),value:N,onChange:e=>y(e.target.value),"aria-label":d("git.hist.search"),title:"content"===k?d("git.hist.by.hint"):void 0})]}),(0,a.jsxs)("div",{className:"row gap-s",children:[(0,a.jsxs)("select",{className:"input",value:k,onChange:e=>w(e.target.value),"aria-label":d("git.hist.search"),title:d("git.hist.by.hint"),children:[(0,a.jsx)("option",{value:"message",children:d("git.hist.by.message")}),(0,a.jsx)("option",{value:"author",children:d("git.hist.by.author")}),(0,a.jsx)("option",{value:"content",children:d("git.hist.by.content")})]}),(0,a.jsx)(eP,{refs:c,value:C,onChange:S,extra:[{value:"",label:d("git.hist.branchCurrent")},{value:"all",label:d("git.hist.branchAll")}]})]}),r&&(0,a.jsxs)("div",{className:"gx-chip soft gx-pathchip",children:[(0,a.jsx)("span",{className:"mono nm",title:r,children:d("git.hist.file",{path:r})}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:o,"aria-label":d("git.hist.clearFile"),title:d("git.hist.clearFile"),children:(0,a.jsx)(ed.A,{size:13})})]})]}),f?(0,a.jsx)("p",{className:"gx-note err",children:f}):h?h.length?(0,a.jsxs)("div",{className:"gx-hist",role:"listbox","aria-label":d("git.tab.history"),children:[h.map(e=>(0,a.jsxs)("button",{role:"option","aria-selected":n===e.sha,className:"gx-commit ".concat(n===e.sha?"sel":""),onClick:()=>l(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,p.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:d("git.hist.merge")}),e.refs.slice(0,3).map(e=>(0,a.jsx)("i",{className:"ref",children:e},e))]})]},e.sha)),m&&(0,a.jsx)("button",{className:"btn sm gx-more",disabled:j,onClick:()=>void F(h.length),children:j?d("git.loading"):d("git.hist.more")})]}):(0,a.jsx)("p",{className:"gx-note",children:M?d("git.hist.noMatch"):d("git.hist.empty")}):(0,a.jsx)("p",{className:"gx-note",children:d("git.loading")})]})}function e3(e){let{files:s,all:t,summary:n,file:l,onConfirm:i,onClose:c}=e,{t:r}=(0,E.s9)(),o=(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:r("hover.more",{count:s.length-8})})]});if(!t&&l&&!s.length){var d;let e=l.add||l.del?" (+".concat(l.add," −").concat(l.del,")"):"";return(0,a.jsxs)(T.TM,{danger:!0,title:r("git.discard.file.title"),confirmLabel:r("git.discard.file.go"),onConfirm:i,onClose:c,children:[(0,a.jsx)("p",{className:"gx-file-eff mono",children:l.path}),(0,a.jsx)("p",{className:"confirm-body",children:"deleted"===l.status?r("git.discard.file.deleted"):"renamed"===l.status?r("git.discard.file.renamed",{from:null!=(d=l.oldPath)?d:""}):r("git.discard.file.modified",{lines:e})}),(0,a.jsx)("p",{className:"gx-lost",children:r("git.discard.all.warn")})]})}return t?(0,a.jsxs)(T.TM,{danger:!0,title:r("git.discard.all.title"),confirmLabel:r("git.discard.all.go"),onConfirm:i,onClose:c,children:[(0,a.jsxs)("ul",{className:"gx-effects",children:[n&&n.restore>0&&(0,a.jsx)("li",{children:r("git.discard.all.restore",{count:n.restore})}),s.length>0&&(0,a.jsxs)("li",{className:"bad",children:[(0,a.jsx)("b",{children:r("git.discard.all.delete",{count:s.length})}),o]})]}),n&&(0,a.jsx)("p",{className:"muted small confirm-body",children:r("git.discard.all.lines",{add:n.add,del:n.del})}),(0,a.jsx)("p",{className:"gx-lost",children:r("git.discard.all.warn")})]}):(0,a.jsx)(T.TM,{danger:!0,title:r("git.discard.confirm.title"),body:r("git.discard.confirm.body",{count:s.length}),confirmLabel:r("git.discard.confirm.go"),onConfirm:i,onClose:c,children:o})}var e2=t(8591);function e6(e){var s,t;let{agent:n,path:l,ignored:c=!1,change:r,stamp:o,refs:d,focusLine:h,onHistory:m,onOpenCommit:g,onDiscard:p,onDiscardHunk:j,onDiscardLines:b}=e,{t:f}=(0,E.s9)(),[v,N]=(0,i.useState)(!1),y=!!r&&!ec.test(l),k=er.test(l),w=h?"file":y?"diff":k?"preview":"file",[C,S]=(0,i.useState)(w),[A,M]=(0,i.useState)("unified"),[F,R]=(0,i.useState)(null),[P,_]=(0,i.useState)(null),[L,H]=(0,i.useState)(null),[I,U]=(0,i.useState)(!1),[D,K]=(0,i.useState)(!1),W=ec.test(l),[$,q]=(0,i.useState)(null);(0,i.useEffect)(()=>{q(null)},[l]),(0,i.useEffect)(()=>{S(w),K(!1)},[l,y]),(0,i.useEffect)(()=>{let e=!1;H(null);let s="path=".concat(encodeURIComponent(l));return U(!0),("diff"===C&&r?x.FH.get("/agents/".concat(n.id,"/git/diff?").concat(s).concat(r.oldPath?"&old=".concat(encodeURIComponent(r.oldPath)):"")).then(s=>!e&&R(s)):W?Promise.resolve():x.FH.get("/agents/".concat(n.id,"/git/file?").concat(s)).then(s=>!e&&_(s))).catch(s=>!e&&H(s instanceof Error?s.message:f("git.loadError"))).finally(()=>!e&&U(!1)),()=>{e=!0}},[n.id,l,C,null==r?void 0:r.status,null==r?void 0:r.oldPath,o]);let B=(0,i.useMemo)(()=>F&&F.path===l?eh(F.diff):null,[F,l]),[G,Q]=(0,i.useState)(null),X=(null==r?void 0:r.status)==="untracked"||(null==r?void 0:r.status)==="added"&&!r.oldPath;(0,i.useEffect)(()=>{if(Q(null),"file"!==C||!r||W||X||"deleted"===r.status||"conflict"===r.status)return;let e=!1;return x.FH.get("/agents/".concat(n.id,"/git/diff?path=").concat(encodeURIComponent(l)).concat(r.oldPath?"&old=".concat(encodeURIComponent(r.oldPath)):"")).then(s=>!e&&Q(s)).catch(()=>void 0),()=>{e=!0}},[n.id,l,C,null==r?void 0:r.status,null==r?void 0:r.oldPath,o]);let Z=(0,i.useMemo)(()=>G&&G.path===l?eh(G.diff):null,[G,l]),Y=(0,i.useMemo)(()=>Z?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 b=c;for(let s=0;s<3&&b<e.length-1&&"ctx"===e[b+1].kind;s++)b++;let f=e.slice(j,b+1),v=f.filter(e=>void 0!==e.oldNo),N=f.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:f}})}}return{lines:s,removedBefore:t,blockOfLine:a,blockOfRemoval:n,groups:l}}(Z):null,[Z]),V=l.lastIndexOf("/"),ee=V>=0?l.slice(0,V+1):"",es=l.slice(V+1);return(0,a.jsxs)("section",{className:"gx-preview","aria-label":l,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:l,children:[(0,a.jsx)("span",{className:"dir",children:ee}),(0,a.jsx)("b",{children:es})]}),c&&(0,a.jsx)("span",{className:"gx-chip soft",title:f("git.ignored.hint"),children:f("git.ignored.chip")}),r&&(0,a.jsx)("span",{className:"gx-chip st-".concat(r.status),children:f("git.status.".concat(r.status))}),(null==r?void 0:r.staged)&&(0,a.jsx)("span",{className:"gx-chip soft",children:f("git.staged")}),(null==r?void 0:r.unstaged)&&"untracked"!==r.status&&(0,a.jsx)("span",{className:"gx-chip soft",children:f("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]})]}),P&&!r&&(0,a.jsx)("span",{className:"muted small",children:(0,z.zi)(P.size)})]}),(0,a.jsxs)("div",{className:"gx-ptr",children:[(null==r?void 0:r.status)!=="untracked"&&!c&&(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",title:f("git.file.history"),"aria-label":f("git.file.history"),onClick:()=>m(l),children:(0,a.jsx)(u.A,{size:15})}),(null==r?void 0:r.status)!=="untracked"&&!c&&(0,a.jsx)(eP,{refs:d,value:null!=$?$:"",onChange:q,compact:!0,label:f("git.file.viewAt"),extra:[{value:"",label:f("git.file.viewAt")}]}),!W&&!c&&!$&&(null==r?void 0:r.status)!=="deleted"&&(null==r?void 0:r.status)!=="untracked"&&(null==r?void 0:r.status)!=="conflict"&&(()=>{let e=v&&"file"===C;return(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm ".concat(e?"on":""),"aria-pressed":e,"aria-label":f("git.blame"),title:"".concat(f("git.blame"),": ").concat(f("git.blame.hint")),onClick:()=>{"file"!==C?(S("file"),N(!0)):N(e=>!e)},children:(0,a.jsx)(e2.A,{size:15})})})(),(0,a.jsx)(O.WQ,{text:l,label:f("git.copyPath"),compact:!0}),r&&"conflict"!==r.status&&(0,a.jsxs)("button",{type:"button",className:"btn sm",title:f("git.discard.hint"),onClick:()=>p(r),children:[(0,a.jsx)(J.A,{size:14}),f("git.discard")]})]}),(0,a.jsx)("div",{className:"gx-ptools",children:(0,a.jsxs)("div",{className:"gx-ptl",children:[(r||k)&&(0,a.jsx)(T.$q,{value:C,onChange:S,options:[...r?[{id:"diff",label:f("git.view.diff")}]:[],...k?[{id:"preview",label:f("git.view.preview")}]:[],{id:"file",label:f(k?"git.view.source":"git.view.file")}]}),"diff"===C&&r&&(0,a.jsx)(T.$q,{value:A,onChange:M,options:[{id:"unified",label:f("git.layout.unified")},{id:"split",label:f("git.layout.split")}]})]})})]}),(null==r?void 0:r.oldPath)&&(0,a.jsx)("div",{className:"gx-banner",children:f("git.renamedFrom",{path:r.oldPath})}),$&&(0,a.jsxs)("div",{className:"gx-banner row gap-s",children:[(0,a.jsx)("span",{className:"grow",children:f("git.file.atRef",{ref:$})}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>q(null),children:f("git.file.backToCurrent")})]}),$?(0,a.jsx)(ey,{agent:n,gitRef:$,path:(null==r?void 0:r.oldPath)&&$?r.oldPath:l,toolbar:!1}):(0,a.jsx)("div",{className:"gx-body",children:L?(0,a.jsx)("p",{className:"gx-note err",children:L}):!I||B||P?"diff"===C&&r?B?B.binary?(0,a.jsx)("p",{className:"gx-note",children:f("git.diff.binary")}):0===B.hunks.length?(0,a.jsx)("p",{className:"gx-note",children:f("git.diff.empty")}):(0,a.jsxs)(a.Fragment,{children:[(null==F?void 0:F.truncated)&&(0,a.jsx)("div",{className:"gx-banner",children:f("git.diff.truncated")}),(0,a.jsx)(ef,{parsed:B,layout:A,path:l,cutOff:!!(null==F?void 0:F.truncated),onDiscardHunk:(null==r?void 0:r.status)==="modified"?(e,s)=>j(l,e,s):void 0,onDiscardLines:(null==r?void 0:r.status)==="modified"?(e,s,t)=>b(l,e,s,t):void 0})]}):null:W&&!D&&(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(l),"&v=").concat(o),alt:es,onError:()=>K(!0)})}):"preview"===C&&P&&P.path===l?(0,a.jsxs)("div",{className:"gx-md md",children:[P.truncated&&(0,a.jsx)("div",{className:"gx-banner",children:f("git.diff.truncated")}),(0,a.jsx)(el.oz,{remarkPlugins:[ei.A],components:{a:e=>(0,a.jsx)("a",{...e,target:"_blank",rel:"noreferrer"})},children:P.content})]}):P&&P.path===l?(0,a.jsx)(eN,{f:P,agent:n,blame:v,onOpenCommit:g,marks:Y,allNew:X,focusLine:h}):W&&D?(0,a.jsx)("p",{className:"gx-note",children:f("git.file.binary")}):null:(0,a.jsx)("p",{className:"gx-note",children:f("git.loading")})})]})}var e5=t(43249),e8=t(19431),e7=t(63745);function se(e){let{name:s}=e;return ec.test(s)?(0,a.jsx)(e5.A,{size:15}):/\.(md|mdx|txt|rst)$/i.test(s)?(0,a.jsx)(e8.A,{size:15}):(0,ep.eX)(s)?(0,a.jsx)(e7.A,{size:15}):(0,a.jsx)(X.A,{size:15})}let ss=(0,i.memo)(function(e){var s,t;let{rows:n,expanded:l,forceOpen:c,sel:r,onToggle:o,onSelect:d,label:h}=e,{t:u}=(0,E.s9)(),m=(0,i.useRef)(null),[g,x]=(0,i.useState)(null),p=e=>"".concat(e.ignored?"i:":"").concat(e.path),j=n.some(e=>p(e.node)===g)?g:null!=(t=null==(s=n.find(e=>e.node.path===r&&!e.node.ignored))?void 0:s.node.path)?t:n[0]?p(n[0].node):null,b=(0,i.useCallback)(e=>{var s,t;let a=[...null!=(t=null==(s=m.current)?void 0:s.querySelectorAll("[data-row]"))?t:[]],n=a.indexOf(document.activeElement),l=s=>{var t;e.preventDefault(),null==(t=a[Math.max(0,Math.min(a.length-1,s))])||t.focus()};if("ArrowDown"===e.key)l(n+1);else if("ArrowUp"===e.key)l(n-1);else if("Home"===e.key)l(0);else if("End"===e.key)l(a.length-1);else if(n>=0&&("ArrowRight"===e.key||"ArrowLeft"===e.key)){let s=a[n],t="1"===s.dataset.dir,i="true"===s.getAttribute("aria-expanded");if("ArrowRight"===e.key)t&&!i?(e.preventDefault(),s.click()):t&&i&&l(n+1);else if(t&&i)e.preventDefault(),s.click();else{let e=Number(s.getAttribute("aria-level"));for(let s=n-1;s>=0;s--)if(Number(a[s].getAttribute("aria-level"))<e){l(s);break}}}},[]);return(0,a.jsx)("div",{className:"gx-tree-rows",ref:m,onKeyDown:b,role:"tree","aria-label":h,children:n.map(e=>{var s,t;let{node:n,depth:i}=e,h="dir"===n.type,m=h&&(c||l.has(n.path)),g=n.change,b=p(n);return(0,a.jsxs)("button",{"data-row":!0,"data-dir":h?"1":"0","data-path":n.path,type:"button",role:"treeitem","aria-level":i+1,"aria-expanded":h?!!m:void 0,"aria-selected":!h&&r===n.path,tabIndex:j===b?0:-1,onFocus:()=>x(b),className:"gx-row ".concat(h?"dir":"file"," ").concat(n.ignored?"ignored":""," ").concat(g?"changed st-".concat(g.status):""," ").concat(!h&&r===n.path?"sel":""," ").concat(h&&n.changed?"has-changes":""),style:{paddingLeft:8+14*i},title:n.ignored?"".concat(n.path,": ").concat(u("git.ignored.hint")):n.path,onClick:()=>h?o(n):d(n.path),children:[(0,a.jsx)("span",{className:"chev",children:h?m?(0,a.jsx)(A.A,{size:14}):(0,a.jsx)(G.A,{size:14}):null}),(0,a.jsx)("span",{className:"ico",children:h?m?(0,a.jsx)(en.A,{size:15}):(0,a.jsx)($.A,{size:15}):(0,a.jsx)(se,{name:n.name})}),(0,a.jsx)("span",{className:"nm",children:n.name}),h&&n.changed>0&&(0,a.jsx)("span",{className:"dirdot",title:u("git.dirChanged",{count:n.changed}),children:n.changed}),g&&(0,a.jsxs)("span",{className:"meta",children:[(null!==g.additions||null!==g.deletions)&&(0,a.jsxs)("span",{className:"gx-counts sm",children:[(0,a.jsxs)("i",{className:"add",children:["+",null!=(s=g.additions)?s:0]}),(0,a.jsxs)("i",{className:"del",children:["−",null!=(t=g.deletions)?t:0]})]}),(0,a.jsx)(ew,{status:g.status,titled:!0})]})]},b)})})});var st=t(32898),sa=t(61904),sn=t(2507);let sl=["files","history","tags","compare","stashes"],si={files:st.A,history:u.A,tags:ea.A,compare:sa.A,stashes:sn.A},sc=e=>"gx-tab-".concat(e),sr="gx-side-panel";function so(e){let{mode:s,onChange:t,stashCount:n,label:l}=e,{t:i}=(0,E.s9)(),c=e=>"".concat(i("git.tab.".concat(e))).concat("stashes"===e&&n?" \xb7 ".concat(n):"");return(0,a.jsx)("div",{className:"gx-tabs",role:"tablist","aria-label":l,onKeyDown:e=>{let a=sl.indexOf(s),n=null;"ArrowRight"===e.key||"ArrowDown"===e.key?n=(a+1)%sl.length:"ArrowLeft"===e.key||"ArrowUp"===e.key?n=(a-1+sl.length)%sl.length:"Home"===e.key?n=0:"End"===e.key&&(n=sl.length-1),null!==n&&(e.preventDefault(),t(sl[n]),requestAnimationFrame(()=>{var e;return null==(e=document.getElementById(sc(sl[n])))?void 0:e.focus()}))},children:sl.map((e,n)=>{let l=si[e];return(0,a.jsxs)("button",{id:sc(e),type:"button",role:"tab","aria-selected":s===e,"aria-controls":sr,tabIndex:s===e?0:-1,"aria-label":c(e),title:"".concat(c(e)," (Alt+").concat(n+1,")"),className:"gx-tab ".concat(s===e?"on":""),onClick:()=>t(e),children:[(0,a.jsx)(l,{size:15}),s===e&&(0,a.jsx)("span",{children:c(e)})]},e)})})}function sd(e){var s,t,n,l,c,r,o,d,h,u;let{agent:m,git:g}=e,{t:j}=(0,E.s9)(),{status:f,tree:v,loading:N,error:y,refresh:k}=g,[w,C]=(0,i.useState)(null),[S,M]=(0,i.useState)(new Set),[F,R]=(0,i.useState)(""),[P,_]=(0,i.useState)(!1),[L,H]=(0,i.useState)(!1),[I,U]=(0,i.useState)("files"),[D,K]=(0,i.useState)(null),[W,ea]=(0,i.useState)({base:"",head:""}),[en,el]=(0,i.useState)(!1),[ei,ec]=(0,i.useState)(null),[er,eo]=(0,i.useState)(),ed=(0,i.useRef)(null),[eh,eu]=(0,i.useState)(null),[em,eg]=(0,i.useState)(null),[ex,ep]=(0,i.useState)(null),[ej,eb]=(0,i.useState)(!1),[ef,ev]=(0,i.useState)(null),[eN,ey]=(0,i.useState)(!1),[ek,ew]=(0,i.useState)(null),[eC,eS]=(0,i.useState)(!1),eM=function(e,s){let{t}=(0,E.s9)(),a=(0,T.dj)(),[n,l]=(0,i.useState)(null),[c,r]=(0,i.useState)(null),o=async function(n,i,c){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};l(n),r(null);try{var d,h,u;let n=await x.FH.post("/agents/".concat(e.id,"/git/").concat(c),o),l=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(i,": ").concat(r):l&&l.length<90?"".concat(i,": ").concat(l):i),await s(),!0}catch(a){let e=a instanceof Error?a.message:"error";return r({title:t("git.notice.failed",{action:i}),text:e,diverged:/fast-forward|divergent/i.test(e)}),await s(),!1}finally{l(null)}};return{busy:n,notice:c,setNotice:r,run:o}}(m,()=>k()),[eF,eR]=(0,i.useState)(null),eP=(0,es.Wx)(),eH=(0,i.useRef)(new Set),eI=f&&f.isRepo?f:null,eU=function(e,s){let[t,a]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let s=!1;return x.FH.get("/agents/".concat(e.id,"/git/refs")).then(e=>!s&&a(e)).catch(()=>!s&&a({current:null,branches:[],remotes:[],tags:[]})),()=>{s=!0}},[e.id,s]),t}(m,null==eI||null==(s=eI.head)?void 0:s.sha),eK=v&&v.isRepo?v.files:null,eW=v&&v.isRepo?v.ignored:null,[eO,eG]=(0,i.useState)({});(0,i.useEffect)(()=>{eG({})},[m.id,m.effective.cwd]);let eJ=(0,i.useMemo)(()=>eI&&eK?V(eK,eI.changes,eP.showIgnored&&null!=eW?eW:[],eO):null,[eI,eK,eW,eO,eP.showIgnored]),eQ=(0,i.useMemo)(()=>{let e=(null!=eW?eW:[]).map(e=>e.replace(/\/$/,""));return s=>e.some(e=>s===e||s.startsWith("".concat(e,"/")))},[eW]),eX=(0,i.useMemo)(()=>{var e;return new Map((null!=(e=null==eI?void 0:eI.changes)?e:[]).map(e=>[e.path,e]))},[eI]),eV=(0,i.useMemo)(()=>{var e;return(null!=(e=null==eI?void 0:eI.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})},[eI]);(0,i.useEffect)(()=>{if(!eJ)return;let e=new Set,s=t=>{for(let n of t.children)if("dir"===n.type){var a;!eH.current.has(n.path)&&(n.changed>0||0===eH.current.size&&(null!=(a=null==eK?void 0:eK.length)?a:0)<=40)&&e.add(n.path),s(n)}};s(eJ);let t=e=>{for(let s of e.children)"dir"===s.type&&(eH.current.add(s.path),t(s))};t(eJ),e.size&&M(s=>new Set([...s,...e]))},[eJ]);let e0="hive-am.git.where.".concat(m.id),[e2,e5]=(0,i.useState)(!1),e8=(0,i.useRef)(null);(0,i.useEffect)(()=>{var e,s,t;if(!eJ||e2)return;let a=(0,b.CL)(e0,{}),n=e=>!!e&&(!!(null==eK?void 0:eK.includes(e))||!!(null==eI?void 0:eI.changes.some(s=>s.path===e))),l=n(a.file)?a.file:null!=(t=null==(e=null!=(s=null==eI?void 0:eI.changes.find(e=>"conflict"===e.status))?s:null==eI?void 0:eI.changes[0])?void 0:e.path)?t:null;l&&C(l);let i=[...Array.isArray(a.dirs)?a.dirs.filter(e=>"string"==typeof e):[],...n(a.file)?function(e){let s=e.split("/");return s.pop(),s.map((e,t)=>s.slice(0,t+1).join("/"))}(a.file):[]];i.length&&M(e=>new Set([...e,...i])),a.mode&&sl.includes(a.mode)&&U(a.mode),"string"==typeof a.hist&&K(a.hist),"string"==typeof a.commit&&ew(a.commit),a.cmp&&"string"==typeof a.cmp.base&&"string"==typeof a.cmp.head&&ea(a.cmp),"string"==typeof a.stash&&ep(a.stash),"string"==typeof a.tag&&(e8.current=a.tag),e5(!0)},[eJ]),(0,i.useEffect)(()=>{var e,s;e2&&(0,b.zS)(e0,{file:null!=w?w:void 0,dirs:[...S].slice(0,200),mode:I,hist:null!=D?D:void 0,commit:null!=ek?ek:void 0,cmp:W.base||W.head?W:void 0,stash:null!=ex?ex:void 0,tag:null!=(s=null!=(e=null==eh?void 0:eh.name)?e:e8.current)?s:void 0})},[e2,e0,w,S,I,D,ek,W,ex,eh]),(0,i.useEffect)(()=>{let e=!1;return x.FH.get("/agents/".concat(m.id,"/git/stashes")).then(s=>{e||(eg(s),ep(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}},[m.id,null==eI?void 0:eI.generatedAt]),(0,i.useEffect)(()=>{let e=F.trim();if(!en||e.length<2)return void ec(null);let s=!1,t=setTimeout(()=>x.FH.get("/agents/".concat(m.id,"/git/grep?q=").concat(encodeURIComponent(e))).then(t=>!s&&ec({q:e,...t})).catch(()=>!s&&ec({q:e,hits:[],truncated:!1})),350);return()=>{s=!0,clearTimeout(t)}},[m.id,en,F,null==eI?void 0:eI.generatedAt]),(0,i.useEffect)(()=>{let e=e=>{let s=e.target,t=!!s&&("INPUT"===s.tagName||"TEXTAREA"===s.tagName||"SELECT"===s.tagName||s.isContentEditable);"/"!==e.key||t||e.ctrlKey||e.metaKey||e.altKey?e.altKey&&!e.ctrlKey&&!e.metaKey&&/^[1-5]$/.test(e.key)&&(e.preventDefault(),U(sl[Number(e.key)-1])):(e.preventDefault(),U("files"),setTimeout(()=>{var e;return null==(e=ed.current)?void 0:e.focus()},0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let e7=(0,i.useMemo)(()=>eJ?ee(eJ,S,{query:F,onlyChanged:P}):[],[eJ,S,F,P]),se=(0,i.useMemo)(()=>e7.slice(0,2e3),[e7]),st=(0,i.useRef)(eO);st.current=eO;let sa=(0,i.useCallback)(e=>{let s;s=e.path,M(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t}),!e.ignored||!e.lazy||e.path in st.current||x.FH.get("/agents/".concat(m.id,"/git/ls?path=").concat(encodeURIComponent(e.path))).then(s=>eG(t=>({...t,[e.path]:s.entries}))).catch(()=>eG(s=>({...s,[e.path]:[]})))},[m.id]),sn=(0,i.useCallback)(e=>{eo(void 0),C(e)},[]);if(y&&!f)return(0,a.jsx)("div",{className:"gx",children:(0,a.jsxs)("div",{className:"gx-empty",children:[(0,a.jsx)("h3",{children:j("git.error.title")}),(0,a.jsx)("p",{children:y}),(0,a.jsx)("button",{className:"btn",onClick:()=>void k(),children:j("git.refresh")})]})});if(!f)return(0,a.jsx)("div",{className:"gx",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:j("git.loading")})})});if(!f.isRepo)return(0,a.jsx)("div",{className:"gx",children:(0,a.jsxs)("div",{className:"gx-empty",children:[(0,a.jsx)($.A,{size:26,className:"muted"}),(0,a.jsx)("h3",{children:"not-repo"===f.reason?j("git.notRepo.title"):"no-git"===f.reason?j("git.noGit.title"):j("git.error.title")}),(0,a.jsx)("p",{children:"not-repo"===f.reason?j("git.notRepo.body",{path:f.cwd.replace(/^\/home\/[^/]+/,"~")}):"no-git"===f.reason?j("git.noGit.body"):f.message}),(0,a.jsxs)("button",{className:"btn",onClick:()=>void k(),children:[(0,a.jsx)(q.A,{size:14}),j("git.refresh")]})]})});let si=w?eX.get(w):void 0,sd=e=>eM.run("switch",e.carried?j("git.done.switchCarried",{branch:e.to,count:e.carried}):j("git.done.switch",{branch:e.to}),e.overlap.length||e.collisions.length?"switch-smart":"switch",{branch:e.to}),sh=async e=>{try{let s=await x.FH.get("/agents/".concat(m.id,"/git/switch-plan?branch=").concat(encodeURIComponent(e)));s.others.length||s.selfRunning?ev(s):await sd(s)}catch(s){eM.setNotice({title:j("git.notice.failed",{action:j("git.done.switch",{branch:e})}),text:s instanceof Error?s.message:"error",diverged:!1})}},su=e=>e.filter(e=>"untracked"===e.status||"added"===e.status&&!e.oldPath).map(e=>e.path),sm=(0,z.Xd)(f.generatedAt);return(0,a.jsxs)("div",{className:"gx","data-gx-theme":eP.theme,style:{"--g-tab":eP.tabSize},children:[(0,a.jsxs)("div",{className:"gx-bar",children:[(0,a.jsxs)("button",{type:"button",className:"gx-branch","aria-expanded":L,"aria-controls":"gx-info",title:j("git.info.toggle"),onClick:()=>H(e=>!e),children:[(0,a.jsx)(B.A,{size:14}),(0,a.jsx)("span",{className:"bn",children:null!=(c=f.branch)?c:f.head?"".concat(j("git.detached")," ").concat(f.head.sha):j("git.noCommitsBranch")}),f.head&&(0,a.jsx)("span",{className:"sha",children:f.head.sha}),f.upstream&&(f.upstream.ahead>0||f.upstream.behind>0)&&(0,a.jsxs)("span",{className:"ab",title:j("git.upstream"),children:[f.upstream.ahead>0&&"↑".concat(f.upstream.ahead),f.upstream.ahead>0&&f.upstream.behind>0&&" ",f.upstream.behind>0&&"↓".concat(f.upstream.behind)]}),L?(0,a.jsx)(A.A,{size:14}):(0,a.jsx)(G.A,{size:14})]}),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("span",{className:"gx-sum",children:0===f.changes.length?(0,a.jsx)("span",{className:"muted",children:j("git.clean")}):(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("span",{title:j("git.summary",{count:f.changes.length}),"aria-label":j("git.summary",{count:f.changes.length}),children:[(0,a.jsx)("b",{children:f.changes.length})," ",(0,a.jsx)("span",{className:"muted",children:j("git.files.short")})," ",(0,a.jsxs)("i",{className:"add",children:["+",(0,z._E)(eV.add)]})," ",(0,a.jsxs)("i",{className:"del",children:["−",(0,z._E)(eV.del)]})]})})}),(0,a.jsx)(e1,{agent:m,a:eM,current:f.branch,onSwitch:e=>void sh(e)}),(0,a.jsx)(eY,{a:eM,ahead:null!=(r=null==(t=f.upstream)?void 0:t.ahead)?r:0,behind:null!=(o=null==(n=f.upstream)?void 0:n.behind)?o:0,detached:!f.branch,changeCount:f.changes.length,onCommit:()=>eS(!0)}),(0,a.jsx)("button",{className:"btn ghost icon sm",disabled:!!eM.busy||0===f.changes.length||!!f.state,onClick:()=>{let e=su(f.changes);eR({files:e,all:!0,summary:{restore:f.changes.length-e.length,add:eV.add,del:eV.del},go:async()=>{let e=await eM.run("discard-all",j("git.done.discard"),"discard-all");return e&&C(null),e}})},"aria-label":j("git.discard.all"),title:f.state?j("git.discard.all.blocked"):j("git.discard.all"),children:(0,a.jsx)(J.A,{size:15})}),(0,a.jsx)(et.i,{}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>void k(),"aria-label":j("git.refresh"),title:"".concat(j("git.refresh")," \xb7 ").concat(j("git.updated",{time:sm})),children:(0,a.jsx)(q.A,{size:15,className:N?"spin":""})})]}),L&&(0,a.jsxs)("dl",{id:"gx-info",className:"gx-info",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:j("git.info.branch")}),(0,a.jsxs)("dd",{className:"mono",children:[null!=(d=f.branch)?d:f.head?"".concat(j("git.detached")," ").concat(f.head.sha):j("git.noCommitsBranch"),f.branch&&(0,a.jsx)(O.WQ,{text:f.branch,label:j("git.info.copyBranch")})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:j("git.info.upstreamLabel")}),(0,a.jsx)("dd",{children:f.upstream?0===f.upstream.ahead&&0===f.upstream.behind?j("git.info.inSync"):j("git.info.upstreamStatus",{ahead:f.upstream.ahead,behind:f.upstream.behind}):(0,a.jsx)("span",{className:"muted",children:j("git.info.noUpstream")})})]}),f.head?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:j("git.info.commit")}),(0,a.jsxs)("dd",{className:"mono",children:[f.head.sha,(0,a.jsx)(O.WQ,{text:f.head.sha,label:j("git.info.copySha")})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:j("git.info.message")}),(0,a.jsx)("dd",{className:"msg",children:f.head.subject||(0,a.jsx)("span",{className:"muted",children:"—"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:j("git.info.author")}),(0,a.jsx)("dd",{children:f.head.author})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:j("git.info.when")}),(0,a.jsxs)("dd",{children:[(0,z.v7)(f.head.when)," ",(0,a.jsxs)("span",{className:"muted",children:["\xb7 ",(0,p.KN)(Date.parse(f.head.when))]})]})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)("dt",{children:j("git.info.commit")}),(0,a.jsx)("dd",{className:"muted",children:j("git.noCommits")})]})]}),"running"===m.status&&(0,a.jsx)("div",{className:"gx-warn",children:j("git.warn.running",{name:m.name})}),f.state&&(()=>{let e=f.changes.filter(e=>"conflict"===e.status),s="merge"===f.state?j("git.state.merge"):"rebase"===f.state?j("git.state.rebase"):j("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"===f.state&&f.stash&&(0,a.jsxs)(a.Fragment,{children:[j("git.state.stash.hint",{from:f.stash.from,to:f.stash.to})," \xb7 "]}),e.length>0?j("git.state.conflicts",{count:e.length}):j("git.state.ready")]}),0===e.length&&("merge"===f.state?(0,a.jsx)("button",{className:"btn primary sm",disabled:!!eM.busy,onClick:()=>eS(!0),children:j("git.state.finishMerge")}):"rebase"===f.state?(0,a.jsx)("button",{className:"btn primary sm",disabled:!!eM.busy,onClick:()=>void eM.run("continue",j("git.done.rebaseContinue"),"rebase-continue"),children:j("git.state.continueRebase")}):(0,a.jsx)("button",{className:"btn primary sm",disabled:!!eM.busy,onClick:()=>void eM.run("smart",j("git.done.smartFinish"),"smart-finish"),children:j("git.state.finishStash")})),"stash"===f.state?(0,a.jsx)("button",{className:"btn sm danger",disabled:!!eM.busy,onClick:()=>ey(!0),children:j("git.state.cancelStash")}):(0,a.jsx)("button",{className:"btn sm danger",disabled:!!eM.busy,onClick:()=>void eM.run("abort",j("git.done.mergeAbort"),"merge-abort"),children:"merge"===f.state?j("git.state.abortMerge"):j("git.state.abortRebase")})]})})(),(0,a.jsx)(eZ,{a:eM}),f.scope&&(0,a.jsx)("div",{className:"gx-scope",children:j("git.scope",{path:f.scope})}),(0,a.jsxs)("div",{className:"gx-main",children:[(0,a.jsxs)("aside",{className:"gx-tree","aria-label":j("git.filesLabel"),children:[(0,a.jsx)(so,{mode:I,onChange:U,stashCount:null!=(h=null==em?void 0:em.length)?h:0,label:j("git.filesLabel")}),(0,a.jsx)("div",{className:"gx-sidepanel",id:sr,role:"tabpanel","aria-labelledby":sc(I),children:"stashes"===I?(0,a.jsx)(e$,{stashes:em,sel:ex,onSelect:ep,onSave:()=>eb(!0),canSave:f.changes.length>0&&!f.state}):"tags"===I?(0,a.jsx)(ez,{agent:m,sel:null!=(u=null==eh?void 0:eh.name)?u:null,onSelect:eu,onLoaded:e=>{var s;let t=e8.current;e8.current=null,t&&!eh&&eu(null!=(s=e.find(e=>e.name===t))?s:null)}}):"compare"===I?(0,a.jsx)(e_,{refs:eU,sel:W,onChange:ea}):"history"===I?(0,a.jsx)(e9,{agent:m,head:null==(l=f.head)?void 0:l.sha,sel:ek,onSelect:ew,refs:eU,path:D,onClearPath:()=>K(null)}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"gx-filter",children:[(0,a.jsxs)("div",{className:"search",children:[(0,a.jsx)(Q.A,{size:14}),(0,a.jsx)("input",{ref:ed,className:"input",placeholder:en?j("git.search.placeholder"):j("git.filterPlaceholder"),value:F,onChange:e=>R(e.target.value),"aria-label":j("git.filterPlaceholder")})]}),(0,a.jsxs)("div",{className:"seg icons",role:"group","aria-label":j("git.search.name"),children:[(0,a.jsx)("button",{type:"button","aria-pressed":!en,title:j("git.search.name"),"aria-label":j("git.search.name"),onClick:()=>el(!1),children:(0,a.jsx)(X.A,{size:14})}),(0,a.jsx)("button",{type:"button","aria-pressed":en,title:j("git.search.content"),"aria-label":j("git.search.content"),onClick:()=>el(!0),children:(0,a.jsx)(Z.A,{size:14})})]}),!en&&(0,a.jsxs)("button",{type:"button",className:"btn sm gx-onlych ".concat(P?"primary":""),"aria-pressed":P,title:j("git.filter.changed"),onClick:()=>_(e=>!e),children:[(0,a.jsx)(Y.A,{size:14}),f.changes.length>0&&(0,a.jsx)("span",{className:"ct",children:f.changes.length})]})]}),en?(0,a.jsx)("div",{className:"gx-list gx-hits",children:F.trim().length<2?(0,a.jsx)("p",{className:"gx-note",children:j("git.search.min")}):ei&&ei.q===F.trim()?0===ei.hits.length?(0,a.jsx)("p",{className:"gx-note",children:j("git.search.none",{query:ei.q})}):(0,a.jsxs)(a.Fragment,{children:[ei.hits.map((e,s)=>(0,a.jsxs)("button",{type:"button",className:"gx-hit ".concat(w===e.path&&(null==er?void 0:er.line)===e.line?"sel":""),onClick:()=>{C(e.path),eo({line:e.line,key:Date.now()})},title:"".concat(e.path,":").concat(e.line),children:[(0,a.jsxs)("span",{className:"mono nm",children:[e.path,(0,a.jsxs)("i",{children:[":",e.line]})]}),(0,a.jsx)("span",{className:"mono tx",children:e.text.trim()})]},"".concat(e.path,":").concat(e.line,":").concat(s))),ei.truncated&&(0,a.jsx)("p",{className:"gx-note",children:j("git.search.capped",{count:ei.hits.length})})]}):(0,a.jsx)("p",{className:"gx-note",children:j("git.search.searching")})}):(0,a.jsxs)("div",{className:"gx-list",children:[eJ?0===se.length?(0,a.jsx)("p",{className:"gx-note",children:F?j("git.noMatch",{query:F}):P?j("git.clean"):j("git.noFiles")}):(0,a.jsx)(ss,{rows:se,expanded:S,forceOpen:!!(F||P),sel:w,onToggle:sa,onSelect:sn,label:j("git.filesLabel")}):(0,a.jsx)("p",{className:"gx-note",children:j("git.loading")}),e7.length>se.length&&(0,a.jsx)("p",{className:"gx-note",children:j("git.rowsCapped",{count:se.length})}),(null==v?void 0:v.isRepo)&&v.truncated&&(0,a.jsx)("p",{className:"gx-note",children:j("git.treeTruncated",{count:v.files.length})})]})]})})]}),"stashes"===I?(null==em?void 0:em.find(e=>e.sha===ex))?(0,a.jsx)(eB,{agent:m,stash:em.find(e=>e.sha===ex),a:eM},ex):(0,a.jsx)("div",{className:"gx-preview",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:j("git.stash.empty")})})}):"compare"===I?(0,a.jsx)(eL,{agent:m,sel:W}):"tags"===I?eh?(0,a.jsx)(eE,{agent:m,tag:eh,onChanged:()=>void k()},eh.name):(0,a.jsx)("div",{className:"gx-preview",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:j("git.tags.select")})})}):"history"===I?ek?(0,a.jsx)(eA,{agent:m,sha:ek,focus:null!=D?D:void 0},"".concat(ek,"|").concat(null!=D?D:"")):(0,a.jsx)("div",{className:"gx-preview",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:j("git.hist.select")})})}):w&&(null==si?void 0:si.status)==="conflict"?(0,a.jsx)(eD,{agent:m,path:w,state:f.state,a:eM,onResolved:()=>{k()}},w):w?(0,a.jsx)(e6,{agent:m,path:w,ignored:eQ(w),change:si,stamp:f.generatedAt,refs:eU,focusLine:er,onHistory:e=>{K(e),ew(null),U("history")},onOpenCommit:e=>{ew(e),U("history")},onDiscard:e=>{var s,t;return eR({files:su([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 eM.run("discard",j("git.done.discard"),"discard",{path:e.path,oldPath:e.oldPath});return s&&su([e]).length&&C(null),s}})},onDiscardHunk:(e,s,t)=>void eM.run("discard-hunk",j("git.done.discard"),"discard-hunk",{path:e,index:s,header:t}),onDiscardLines:(e,s,t,a)=>void eM.run("discard-lines",j("git.done.discard"),"discard-lines",{path:e,index:s,header:t,lines:a})},w):(0,a.jsx)("div",{className:"gx-preview",children:(0,a.jsx)("div",{className:"gx-empty",children:(0,a.jsx)("p",{children:j("git.select")})})})]}),ef&&(0,a.jsx)(eT,{agent:m,plan:ef,a:eM,onClose:()=>ev(null),onGo:()=>{ev(null),sd(ef)}}),ej&&(0,a.jsx)(eq,{a:eM,onClose:()=>eb(!1)}),eN&&f.stash&&(0,a.jsx)(T.TM,{danger:!0,title:j("git.state.cancelStash.title"),body:j("git.state.cancelStash.body",{from:f.stash.from}),confirmLabel:j("git.state.cancelStash.go"),onClose:()=>ey(!1),onConfirm:()=>{eM.busy||eM.run("smart",j("git.done.smartCancel"),"smart-cancel")}}),eF&&(0,a.jsx)(e3,{files:eF.files,all:eF.all,summary:eF.summary,file:eF.file,onClose:()=>eR(null),onConfirm:()=>{eF.go()}}),eC&&(0,a.jsx)(e4,{changes:f.changes,a:eM,initialMessage:f.mergeMsg,onClose:()=>eS(!1)})]})}var sh=t(37064),su=t(5300),sm=t(26701),sg=t(65920),sx=t(48180),sp=t(66477),sj=t(12646);function sb(e){var s;let{agent:t}=e,{t:n}=(0,E.s9)(),{refresh:l}=(0,g.o0)(),c=(0,T.dj)(),[r,o]=(0,i.useState)(null),[d,h]=(0,i.useState)(""),[u,m]=(0,i.useState)(""),[j,b]=(0,i.useState)(!1),[f,v]=(0,i.useState)(!1),[N,y]=(0,i.useState)(!1),k=(0,i.useRef)(""),w=!!r&&d!==k.current,C=(0,i.useRef)(!1);C.current=w;let S=(0,i.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let s=await x.FH.get("/agents/".concat(t.id,"/notebook"));o(e=>e&&e.version===s.version&&e.enabled===s.enabled&&JSON.stringify(e.shared_with)===JSON.stringify(s.shared_with)?e:s),(e||!C.current)&&(k.current=s.content,h(s.content))}catch(e){m(e instanceof Error?e.message:String(e))}},[t.id]);(0,i.useEffect)(()=>{o(null),m(""),S(!0)},[t.id,S]),(0,i.useEffect)(()=>{let e=setInterval(()=>{"visible"===document.visibilityState&&S()},4e3);return()=>clearInterval(e)},[S]);let A=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d;if(r){b(!0),m("");try{let s=await x.FH.put("/agents/".concat(t.id,"/notebook"),{content:e,version:r.version});o({...r,...s}),k.current=s.content,h(s.content),c(n("notebook.saved"))}catch(e){m(e instanceof Error?e.message:String(e))}b(!1)}},z=async()=>{y(!1),m("");try{await x.FH.post("/agents/".concat(t.id,"/notebook/separate")),c(n("notebook.separated")),await S(!0),await l(["agents"])}catch(e){m(e instanceof Error?e.message:String(e))}},M=async()=>{try{await x.FH.patch("/agents/".concat(t.id),{skill_ids:[...new Set([...t.skill_ids,r.skill_id])]}),await l(["agents"]),await S(!0)}catch(e){m(e instanceof Error?e.message:String(e))}};if(!r)return(0,a.jsx)("div",{className:"pane",children:(0,a.jsx)("p",{className:"hint",children:u||n("git.loading")})});let F=d.length,R=F>r.max,P=F>.8*r.max,_=null!=(s=r.shared_with)?s:[];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"pane",children:[(0,a.jsx)("p",{className:"hint",style:{margin:0},children:n("notebook.intro")}),_.length>0&&(0,a.jsxs)("div",{className:"banner",children:[(0,a.jsx)(sm.A,{size:16}),(0,a.jsx)("div",{className:"grow",children:n("notebook.sharedWith",{names:_.map(e=>e.name).join(", ")})}),(0,a.jsxs)("button",{className:"btn sm",onClick:()=>y(!0),children:[(0,a.jsx)(sg.A,{size:13}),n("notebook.separate")]})]}),!r.enabled&&(0,a.jsxs)("div",{className:"banner honey",children:[(0,a.jsx)(sx.A,{size:16}),(0,a.jsx)("div",{className:"grow",children:n("notebook.off")}),(0,a.jsx)("button",{className:"btn sm",onClick:M,children:n("notebook.on")})]}),u&&(0,a.jsxs)("div",{className:"banner err",children:[(0,a.jsx)(sx.A,{size:16}),(0,a.jsx)("div",{className:"grow",children:u}),(0,a.jsxs)("button",{className:"btn sm",onClick:()=>{m(""),S(!0)},children:[(0,a.jsx)(q.A,{size:13}),n("notebook.reload")]})]}),(0,a.jsxs)("div",{className:"row small muted",style:{justifyContent:"space-between"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)(sp.A,{size:12,style:{verticalAlign:"-1px"}})," ",r.updated_at?n("notebook.updated",{who:n("user"===r.updated_by?"notebook.by.you":"notebook.by.agent"),when:(0,p.KN)(r.updated_at)}):n("notebook.never")]}),(0,a.jsxs)("span",{style:{color:R?"var(--danger, #c0392b)":P?"var(--honey)":void 0},children:[F.toLocaleString()," / ",r.max.toLocaleString()]})]}),(0,a.jsx)(sj.n,{value:d,onChange:h,placeholder:n("notebook.placeholder"),defaultView:"write",minHeight:320})]}),(0,a.jsxs)("div",{className:"savebar col",children:[(0,a.jsx)("span",{className:"muted small",children:w?n("agent.unsavedChanges"):n("agent.allSaved")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("button",{className:"btn danger sm",style:{marginRight:"auto"},disabled:!d.trim()||j,onClick:()=>v(!0),children:[(0,a.jsx)(eO.A,{size:14}),n("notebook.clear")]}),w&&(0,a.jsx)("button",{className:"btn ghost sm",onClick:()=>h(k.current),children:n("common.discard")}),(0,a.jsx)("button",{className:"btn primary sm",disabled:!w||j||R,onClick:()=>void A(),children:n("notebook.save")})]})]}),f&&(0,a.jsxs)(T.aF,{title:n("notebook.clear.title"),onClose:()=>v(!1),children:[(0,a.jsx)("p",{style:{margin:0},className:"muted",children:_.length?n("notebook.clear.shared",{names:_.map(e=>e.name).join(", ")}):n("notebook.clear.confirm")}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:()=>v(!1),children:n("common.cancel")}),(0,a.jsx)("button",{className:"btn danger",onClick:()=>{v(!1),A("")},children:n("notebook.clear")})]})]}),N&&(0,a.jsxs)(T.aF,{title:n("notebook.separate.title"),onClose:()=>y(!1),children:[(0,a.jsx)("p",{style:{margin:0},className:"muted",children:n("notebook.separate.confirm",{name:t.name,names:_.map(e=>e.name).join(", ")})}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:()=>y(!1),children:n("common.cancel")}),(0,a.jsx)("button",{className:"btn primary",onClick:()=>void z(),children:n("notebook.separate")})]})]})]})}var sf=t(15426);let sv=["config","notebook","sessions"];function sN(e){let{params:s}=e,{id:t}=(0,i.use)(s);return(0,a.jsx)(sy,{id:t},t)}function sy(e){var s;let{id:t}=e,{t:c}=(0,E.s9)(),{ready:N,error:y,retry:k,refresh:w}=(0,g.q5)(),C=(0,g.fJ)(t),S=(0,o.useRouter)(),A=(0,T.dj)(),[z,F]=(0,f.Z)("tab",""),[R,P]=(0,i.useState)("config"),_=sv.includes(z)?z:R,L=""!==z,[H,I]=(0,i.useState)(!1),[U,D]=(0,i.useState)([]),[K,$]=(0,i.useState)(void 0),[q,B]=(0,i.useState)(null),[G,J]=(0,i.useState)("chat"),Q=function(e,s){var t,a,n;let{finished:l}=(0,g.o0)(),c=null!=(t=null==e?void 0:e.id)?t:"",r=null!=(a=l[c])?a:0,[o,d]=(0,i.useState)(null),[h,u]=(0,i.useState)(null),[m,p]=(0,i.useState)(!1),[j,b]=(0,i.useState)(null),f=(0,i.useRef)(0),v=null!=(n=null==e?void 0:e.effective.cwd)?n:"",N=(null==e?void 0:e.status)==="running",y=(0,i.useCallback)(async e=>{if(!c)return;let s=++f.current;p(!0);try{let[t,a]=await Promise.all([x.FH.get("/agents/".concat(c,"/git/status")),e?x.FH.get("/agents/".concat(c,"/git/tree")):Promise.resolve(null)]);if(s!==f.current)return;d(t),a&&u(a),b(null)}catch(e){s===f.current&&b(e instanceof Error?e.message:"error")}finally{s===f.current&&p(!1)}},[c]);return(0,i.useEffect)(()=>{u(null),d(null)},[v]),(0,i.useEffect)(()=>{y(s)},[y,s,r,v]),(0,sh.n)(()=>y(!0),5e3,{enabled:s&&N,immediate:!1}),{status:o,tree:h,loading:m,error:j,refresh:(0,i.useCallback)(()=>y(!0),[y])}}(C,"changes"===G),X=Q.status&&Q.status.isRepo?Q.status.changes.length:0,Z=(e,s)=>{let t=null!=s?s:_;P(t),F(e?t:"")},Y=(0,l.A)(C,{onDeleted:()=>S.push("/agents"),onCloned:e=>S.push("/agents/".concat(e.id))}),{draft:V,setDraft:ee,errors:es,dirty:et}=Y,ea=()=>{et?I(!0):Z(!1)};if((0,i.useEffect)(()=>{L&&"sessions"===_&&x.FH.get("/agents/".concat(t,"/sessions")).then(D).catch(()=>void 0)},[L,_,t,null==C?void 0:C.session_id]),(0,i.useEffect)(()=>{C&&(0,b.zS)(j.O,C.id)},[C]),!C)return(0,a.jsx)("div",{className:"page",children:!N&&y?(0,a.jsxs)(T.lZ,{kind:"err",children:[(0,a.jsx)("span",{children:y})," ",(0,a.jsx)("button",{type:"button",className:"btn sm",onClick:()=>void k(),children:c("fa.retry")})]}):N?(0,a.jsx)(T.pp,{title:c("agent.missing.title"),body:c("agent.missing.body"),action:(0,a.jsx)(r(),{className:"btn",href:"/agents",children:c("agent.missing.back")})}):null});let en=async e=>{await x.FH.post("/agents/".concat(t,"/resume-session"),{session_id:e}),$(void 0),A(c("agent.resumed"))},el=U.filter(e=>"delegation"!==e.kind),ei=U.filter(e=>"delegation"===e.kind),ec=(null==(s=U.find(e=>e.session_id===K))?void 0:s.kind)==="delegation",er=[...K?[{id:"make-current",label:c("agent.makeCurrent"),onClick:()=>void en(K).catch(e=>A(e instanceof Error?e.message:String(e),"err")),disabled:ec},{id:"back-current",label:c("agent.backToCurrent"),onClick:()=>$(void 0)}]:[],{id:"new-conv",label:c("agent.newConversation"),icon:(0,a.jsx)(d.A,{size:14}),onClick:()=>B("new"),disabled:!C.session_id||"running"===C.status}];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("section",{className:"ws-chat",children:[(0,a.jsx)(T.DS,{back:{href:"/",label:c("agent.backToColony")},avatar:(0,a.jsx)(T._h,{agent:C}),title:C.name,meta:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.PW,{role:C.role}),(0,a.jsx)(T.dJ,{provider:C.provider}),(0,a.jsx)("span",{className:"small",children:C.model||c("model.cliDefault")}),(0,a.jsx)(T.P5,{status:C.status}),(0,a.jsx)(sf.IX,{agent:C,link:!0}),(0,a.jsx)(sf.R4,{agent:C})]}),actions:er,primary:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"seg",role:"group","aria-label":c("git.tab.label"),children:[(0,a.jsx)("button",{type:"button","aria-pressed":"chat"===G,onClick:()=>J("chat"),children:c("git.tab.chat")}),(0,a.jsxs)("button",{type:"button","aria-pressed":"changes"===G,onClick:()=>J("changes"),children:[c("git.tab.changes"),X>0&&(0,a.jsx)("span",{className:"tabcount",children:X})]})]}),(0,a.jsx)(n.N,{spec:{agentId:t},title:c("dock.agent")}),(0,a.jsxs)("button",{type:"button",className:"btn sm ".concat(L?"primary":""),onClick:()=>L?ea():Z(!0),"aria-expanded":L,"aria-label":c("colony.agentSettings"),children:[(0,a.jsx)(h.A,{size:14}),c("agent.settings"),et&&(0,a.jsx)("i",{className:"dot run",title:c("agent.unsaved")})]})]})}),(0,a.jsxs)("div",{className:"chat-pane",hidden:"chat"!==G,children:[C.permission_stale&&!K&&(0,a.jsxs)(T.lZ,{kind:"warn",action:(0,a.jsx)("button",{type:"button",className:"btn sm",onClick:()=>B("new"),children:c("agent.permStale.action")}),children:[(0,a.jsx)("b",{children:c("agent.permStale.title")})," ",c("agent.permStale.body",{a1:(0,p.Ck)(C.effective.permission)})]}),(0,a.jsx)(W,{agent:C}),(0,a.jsx)(M,{agent:C,session:K}),(0,a.jsx)(v.ry,{agent:C,sessionOverride:K})]}),"changes"===G&&(0,a.jsx)(sd,{agent:C,git:Q})]}),L&&(0,a.jsx)(T._s,{title:C.name,subtitle:"".concat(c("role.".concat(C.role))," \xb7 ").concat(p.xq[C.provider].label),onClose:ea,footer:"config"===_&&V?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{className:"muted small grow",children:[et?c("agent.unsavedChanges"):c("agent.allSaved"),et&&"running"===C.status?" ".concat(c("agent.appliesNextTurn")):""]}),Y.actions({size:"sm"})]}):void 0,children:(0,a.jsxs)("div",{className:"agent-config",children:[(0,a.jsx)(T.tU,{idPrefix:"cfg",label:c("fa.cfg.tabs"),value:_,onChange:e=>Z(!0,e),tabs:[{id:"config",label:c("agent.tab.config")},{id:"notebook",label:c("agent.tab.notebook")},{id:"sessions",label:c("nav.sessions")}]}),(0,a.jsx)(T.Kp,{id:"config",value:_,idPrefix:"cfg",children:V&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"pane",children:(0,a.jsx)(su.SU,{draft:V,onChange:ee,errors:es,selfId:t})})})}),(0,a.jsx)(T.Kp,{id:"notebook",value:_,idPrefix:"cfg",children:(0,a.jsx)(sb,{agent:C})}),(0,a.jsx)(T.Kp,{id:"sessions",value:_,idPrefix:"cfg",children:(0,a.jsxs)("div",{className:"pane",children:[(0,a.jsx)("p",{className:"hint m0",children:c("agent.sessions.intro",{path:(0,p._1)(C.effective.cwd)})}),(0,a.jsx)("div",{className:"eyebrow",children:c("agent.sessions.conversations")}),0===el.length?(0,a.jsx)(T.pp,{compact:!0,icon:(0,a.jsx)(u.A,{size:22}),title:c("agent.sessions.empty")}):el.map(e=>{let s=e.session_id===C.session_id;return(0,a.jsxs)("div",{className:"card card-pad col fa-sess ".concat(K===e.session_id?"on":""),children:[(0,a.jsxs)("div",{className:"row gap-xs",children:[(0,a.jsx)("span",{className:"mono grow sess-id",children:e.session_id}),(0,a.jsx)(O.WQ,{compact:!0,text:e.session_id,label:c("agent.sessions.copyId")}),s&&(0,a.jsx)("span",{className:"chip honey",children:c("sessions.current")})]}),(0,a.jsx)("span",{className:"muted small",children:c("agent.sessions.started",{started:(0,p.KN)(e.first_seen),last:(0,p.KN)(e.last_seen)})}),(0,a.jsxs)("div",{className:"row gap-s",children:[(0,a.jsx)("button",{className:"btn sm",onClick:()=>{$(s?void 0:e.session_id),Z(!1)},children:K===e.session_id?c("agent.sessions.viewing"):c("agent.sessions.read")}),!s&&(0,a.jsx)("button",{className:"btn sm",onClick:()=>en(e.session_id).then(()=>Z(!1)).catch(e=>A(e instanceof Error?e.message:String(e),"err")),children:c("agent.sessions.resume")})]})]},e.session_id)}),ei.length>0&&(0,a.jsx)("div",{className:"eyebrow mt-s",children:c("agent.sessions.delegated")}),ei.map(e=>{var s;return(0,a.jsxs)("div",{className:"card card-pad col fa-sess ".concat(K===e.session_id?"on":""),children:[(0,a.jsxs)("div",{className:"row gap-s",children:[(0,a.jsx)(m.A,{size:14,className:"muted"}),(0,a.jsx)("b",{className:"grow",children:c("agent.sessions.from",{name:null!=(s=e.from_name)?s:c("chat.anOrchestrator")})}),(0,a.jsx)("span",{className:"muted small",children:(0,p.KN)(e.last_seen)})]}),e.task&&(0,a.jsx)("span",{className:"small fa-clamp3",children:e.task}),(0,a.jsxs)("div",{className:"row gap-xs",children:[(0,a.jsx)("span",{className:"mono muted small grow sess-id",children:e.session_id}),(0,a.jsx)(O.WQ,{compact:!0,text:e.session_id,label:c("agent.sessions.copyId")})]}),(0,a.jsx)("div",{className:"row gap-s",children:(0,a.jsx)("button",{className:"btn sm",onClick:()=>{$(K===e.session_id?void 0:e.session_id),Z(!1)},children:K===e.session_id?c("agent.sessions.viewing"):c("agent.sessions.read")})})]},e.session_id)})]})})]})}),Y.deleteModal,Y.cloneModal,H&&(0,a.jsx)(T.TM,{danger:!0,title:c("fa.unsaved.title"),body:c("fa.unsaved.body"),confirmLabel:c("fa.unsaved.discard"),cancelLabel:c("fa.unsaved.keep"),onClose:()=>I(!1),onConfirm:()=>{Y.discard(),Z(!1)}}),"new"===q&&(0,a.jsx)(T.TM,{title:c("agent.newConvTitle"),body:c("agent.newConvBody"),confirmLabel:c("agent.newConvStart"),onClose:()=>B(null),onConfirm:async()=>{await x.FH.post("/agents/".concat(t,"/new-session")),await w(["agents"]),A(c("agent.newConvStarted"))}})]})}},16054:(e,s,t)=>{Promise.resolve().then(t.bind(t,4249))},48776:(e,s,t)=>{"use strict";t.d(s,{G:()=>o});var a=t(94799),n=t(34023),l=t(10804),i=t(48538),c=t(3749),r=t(69654);function o(e){let{agent:s,onClose:t,onDeleted:o}=e,{t:d}=(0,r.s9)(),{refresh:h}=(0,i.zd)(),u=(0,l.dj)(),[m,g]=(0,n.useState)([]);return(0,n.useEffect)(()=>{let e=!1;return c.FH.get("/agents/".concat(s.id,"/notebook")).then(s=>{var t;e||g((null!=(t=s.shared_with)?t:[]).map(e=>e.name))}).catch(()=>void 0),()=>{e=!0}},[s.id]),(0,a.jsx)(l.TM,{title:d("agent.deleteTitle",{name:s.name}),body:m.length?d("agent.deleteBody.shared",{names:m.join(", ")}):d("agent.deleteBody"),danger:!0,confirmLabel:d("agent.delete"),cancelLabel:d("agent.keep"),onClose:t,onConfirm:async()=>{await c.FH.del("/agents/".concat(s.id)),await h(["agents","colonies"]),u(d("agent.deleted")),null==o||o()}})}},54609:(e,s,t)=>{"use strict";t.d(s,{O:()=>a});let a="hive-am.lastChat"},80696:(e,s,t)=>{"use strict";t.d(s,{y:()=>d});var a=t(94799),n=t(34023),l=t(494),i=t(3749),c=t(48538),r=t(69654),o=t(10804);function d(e){var s;let{agent:t,onClose:d,onCloned:h}=e,{t:u}=(0,r.s9)(),{agents:m,colonies:g}=(0,c.q5)(),{refresh:x}=(0,c.zd)(),p=(0,o.dj)(),[j,b]=(0,n.useState)(()=>((e,s)=>{for(let t=2;;t++){let a="".concat(e," ").concat(t);if(!s.has(a.toLowerCase()))return a}})(t.name,new Set(m.map(e=>e.name.toLowerCase())))),[f,v]=(0,n.useState)(null!=(s=t.colony_id)?s:""),[N,y]=(0,n.useState)(!1),[k,w]=(0,n.useState)(""),C=m.some(e=>e.name.toLowerCase()===j.trim().toLowerCase()),S=async()=>{y(!0),w("");try{let e=await i.FH.post("/agents/".concat(t.id,"/clone"),{name:j.trim(),colony_id:f||null});await x(["agents","colonies"]),p(u("agent.cloned",{name:e.name})),null==h||h(e),d()}catch(e){w(e instanceof Error?e.message:String(e)),y(!1)}};return(0,a.jsxs)(o.aF,{title:u("agent.clone.title",{name:t.name}),onClose:d,children:[(0,a.jsx)(o.D0,{label:u("agent.clone.name"),error:C?u("agent.clone.taken"):k,children:(0,a.jsx)("input",{className:"input",value:j,autoFocus:!0,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j.trim()&&!C&&!N&&S()}})}),(0,a.jsx)(o.D0,{label:u("form.colony"),children:(0,a.jsxs)("select",{className:"select",value:f,onChange:e=>v(e.target.value),children:[(0,a.jsx)("option",{value:"",children:u("common.noColony")}),g.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,a.jsxs)("ul",{className:"muted small clone-facts",children:[(0,a.jsx)("li",{children:u("agent.clone.parallel",{name:t.name})}),(0,a.jsx)("li",{children:u("agent.clone.config")}),(0,a.jsx)("li",{children:u("agent.clone.notebook",{name:t.name})}),(0,a.jsx)("li",{children:u("agent.clone.notBring",{name:t.name})})]}),(0,a.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,a.jsx)("button",{className:"btn ghost",onClick:d,children:u("common.cancel")}),(0,a.jsxs)("button",{className:"btn primary",disabled:!j.trim()||C||N,onClick:()=>void S(),children:[(0,a.jsx)(l.A,{size:14}),N?u("agent.clone.working"):u("agent.clone")]})]})]})}},89128:(e,s,t)=>{"use strict";t.d(s,{A:()=>x});var a=t(94799),n=t(34023),l=t(97356),i=t(494),c=t(10804),r=t(5300),o=t(48776),d=t(80696),h=t(48538),u=t(73506),m=t(3749),g=t(69654);function x(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{t}=(0,g.s9)(),{agents:x,colonies:p,objects:j,refresh:b}=(0,h.q5)(),f=(0,c.dj)(),v=(0,n.useMemo)(()=>e?j.filter(s=>s.manager_id===e.id).map(e=>e.id).sort():[],[j,null==e?void 0:e.id]),N=(0,n.useMemo)(()=>e?JSON.stringify((0,r.TN)(e,v)):"",[e,v]),[y,k]=(0,n.useState)(()=>e?(0,r.TN)(e,v):null),[w,C]=(0,n.useState)(!1),[S,A]=(0,n.useState)(!1),[z,E]=(0,n.useState)(!1);(0,n.useEffect)(()=>{k(e?(0,r.TN)(e,v):null)},[N]);let M=y&&e?(0,r.tf)(y,x,e.id,p):{},F=!!y&&JSON.stringify(y)!==N;(0,u.h)(F);let R=async()=>{if(y&&e){if(Object.keys(M).length)return void f(t("edit.fixFields"),"err");C(!0);try{var a;let{type_id:n,object_ids:l,...i}=y;await m.FH.patch("/agents/".concat(e.id),i),JSON.stringify([...l].sort())!==JSON.stringify(v)&&await m.FH.put("/agents/".concat(e.id,"/resources"),{object_ids:l}),await b(["agents","colonies","objects"]),f(t("edit.saved",{name:y.name.trim()})),null==(a=s.onSaved)||a.call(s)}catch(e){f(e instanceof Error?e.message:t("edit.saveFailed"),"err")}C(!1)}},P=()=>{e&&k((0,r.TN)(e,v))};return{draft:y,setDraft:k,errors:M,dirty:F,saving:w,save:R,discard:P,actions:function(){var e,s,n,c,r;let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.jsxs)("span",{className:"foot-actions push-r",children:[(0,a.jsxs)("span",{className:"row gap-s",children:[(0,a.jsxs)("button",{className:"btn danger ".concat(null!=(e=o.size)?e:""),onClick:()=>A(!0),children:[(0,a.jsx)(l.A,{size:o.size?14:15}),t("agent.delete")]}),(0,a.jsx)("button",{className:"btn icon ".concat(null!=(s=o.size)?s:""),onClick:()=>E(!0),title:t("agent.clone.hint"),"aria-label":t("agent.clone"),children:(0,a.jsx)(i.A,{size:o.size?14:15})})]}),o.onCancel?(0,a.jsx)("button",{className:"btn ghost ".concat(null!=(n=o.size)?n:""),onClick:o.onCancel,children:t("common.cancel")}):(0,a.jsx)("button",{className:"btn ghost ".concat(null!=(c=o.size)?c:""),disabled:!F,onClick:P,children:t("common.discard")}),(0,a.jsx)("button",{className:"btn primary ".concat(null!=(r=o.size)?r:""),disabled:!F||w,onClick:R,children:w?t("common.saving"):t("common.saveChanges")})]})},deleteModal:S&&e?(0,a.jsx)(o.G,{agent:e,onClose:()=>A(!1),onDeleted:s.onDeleted}):null,cloneModal:z&&e?(0,a.jsx)(d.y,{agent:e,onClose:()=>E(!1),onCloned:s.onCloned}):null}}}},e=>{e.O(0,[586,706,642,837,214,281,517,350,606,30,705,408,89,358],()=>e(e.s=16054)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[726],{5372:(e,n,t)=>{"use strict";t.d(n,{kh:()=>p,rs:()=>f,z6:()=>m});var s=t(94799),r=t(34023),a=t(56742),i=t(48538),l=t(69654),c=t(47890),o=t(72942),d=t(10804),u=t(15426);function m(){let[e,n]=(0,r.useState)(null),t=(0,r.useRef)(void 0),i=(0,r.useRef)(!1);i.current=!!e;let l=(0,r.useCallback)((e,s,r)=>{clearTimeout(t.current);let a=()=>n({id:e,rect:s.getBoundingClientRect()});r||i.current?a():t.current=setTimeout(a,280)},[]),c=(0,r.useCallback)(()=>{clearTimeout(t.current),n(null)},[]);return(0,r.useEffect)(()=>{if(!e)return;let n=e=>{"Escape"===e.key&&c()};return window.addEventListener("keydown",n),window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{window.removeEventListener("keydown",n),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[e,c]),(0,r.useEffect)(()=>()=>clearTimeout(t.current),[]),{bind:(0,r.useCallback)(e=>({onMouseEnter:n=>l(e,n.currentTarget,!1),onMouseLeave:c,onFocus:n=>{n.currentTarget.matches(":focus-visible")&&l(e,n.currentTarget,!0)},onBlur:c,onClick:c}),[l,c]),node:e&&"undefined"!=typeof document?(0,a.createPortal)((0,s.jsx)(x,{anchor:e}),document.body):null}}function h(e){let{label:n,children:t}=e;return(0,s.jsxs)("div",{className:"ap-row",children:[(0,s.jsx)("dt",{children:n}),(0,s.jsx)("dd",{children:t})]})}function p(e){let{agent:n,hideColony:t=!1}=e,{t:r}=(0,l.s9)(),a=(0,i.Tu)(e=>e.agents),m=(0,i.Tu)(e=>e.colonies).find(e=>e.id===n.colony_id),p=(0,o.E)((0,i.M_)(n.id)),f=n.worker_ids.map(e=>{var n;return null==(n=a.find(n=>n.id===e))?void 0:n.name}).filter(Boolean),x=a.filter(e=>"orchestrator"===e.role&&e.worker_ids.includes(n.id)).map(e=>e.name),g=e=>e.length>4?"".concat(e.slice(0,4).join(", ")," ").concat(r("hover.more",{count:e.length-4})):e.join(", ");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"ap-head",children:[(0,s.jsx)(d._h,{agent:n}),(0,s.jsxs)("div",{className:"grow",children:[(0,s.jsx)("b",{className:"ap-name",children:n.name}),(0,s.jsxs)("div",{className:"row gap-s wrap mt-s",children:[(0,s.jsx)(d.PW,{role:n.role}),(0,s.jsx)(d.P5,{status:n.status}),(0,s.jsx)(u.IX,{agent:n}),(0,s.jsx)(u.R4,{agent:n})]})]})]}),(0,s.jsx)("p",{className:"ap-desc ".concat(n.description?"":"muted"),children:n.description||r("switcher.noDescription")}),p&&(0,s.jsxs)("div",{className:"ap-now",children:[(0,s.jsx)("i",{className:"dot run"}),p]}),(0,s.jsxs)("dl",{className:"ap-rows",children:[(0,s.jsxs)(h,{label:r("form.provider"),children:[c.xq[n.provider].label,n.model?" \xb7 ".concat(n.model):" \xb7 ".concat(r("model.cliDefault"))]}),(0,s.jsx)(h,{label:r("inherit.permissions"),children:(0,c.Ck)(n.effective.permission)}),(0,s.jsxs)(h,{label:r("colony.folder"),children:[(0,s.jsx)("span",{className:"mono",children:(0,c._1)(n.effective.cwd)}),n.effective.inherited.includes("cwd")&&(0,s.jsxs)("span",{className:"muted",children:[" \xb7 ",r("colony.fromColony")]})]}),!t&&(0,s.jsx)(h,{label:r("form.colony"),children:m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("i",{className:"cdot",style:{background:m.color||"var(--honey)"}}),m.name]}):(0,s.jsx)("span",{className:"muted",children:r("common.noColony")})}),"orchestrator"===n.role?(0,s.jsx)(h,{label:r("form.team"),children:f.length?g(f):(0,s.jsx)("span",{className:"muted",children:r("colony.noWorkers")})}):(0,s.jsx)(h,{label:r("rel.directedBy"),children:x.length?g(x):(0,s.jsx)("span",{className:"muted",children:r("hover.noOrchestrator")})}),(0,s.jsx)(h,{label:r("colony.session"),children:(0,s.jsx)("span",{className:"mono",children:n.session_id?"".concat(n.session_id.slice(0,12),"…"):r("colony.noSession")})}),(0,s.jsxs)(h,{label:r("agents.col.updated"),children:[(0,c.KN)(n.updated_at),!!n.queued&&n.queued>0&&(0,s.jsxs)("span",{className:"muted",children:[" \xb7 ",r("queue.count",{count:n.queued})]})]})]})]})}function f(e){var n,t,i;let{target:l,width:c=310,pinned:o=!1,onClose:d,children:u,label:m}=e,h=(0,r.useRef)(null),[p,f]=(0,r.useState)(null),x=(0,r.useCallback)(()=>{var e,n;if(!l)return;let t=null!=(n=null==(e=h.current)?void 0:e.offsetHeight)?n:0,s=l instanceof DOMRect?l:l.getBoundingClientRect(),r=s.right+12+c+8<=window.innerWidth?"right":"left",a="right"===r?s.right+12:Math.max(8,s.left-12-c),i=Math.min(Math.max(8,s.top+s.height/2-t/2),Math.max(8,window.innerHeight-t-8));f(e=>e&&e.left===a&&e.top===i&&e.side===r?e:{left:a,top:i,side:r})},[l,c]);return((0,r.useLayoutEffect)(x),(0,r.useEffect)(()=>{if(!o)return;window.addEventListener("scroll",x,!0),window.addEventListener("resize",x);let e="undefined"!=typeof ResizeObserver&&h.current?new ResizeObserver(x):null;e&&h.current&&e.observe(h.current);let n=e=>{var n;let t=e.target;(null==(n=h.current)?void 0:n.contains(t))||t.closest('.cell, [role="dialog"], .modal, .drawer, .scrim, .menu-pop')||null==d||d()};return document.addEventListener("pointerdown",n),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x),null==e||e.disconnect(),document.removeEventListener("pointerdown",n)}},[o,x,d]),l&&"undefined"!=typeof document)?(0,a.createPortal)((0,s.jsx)("div",{ref:h,className:"ap-card ".concat(o?"pinned":""," ").concat(null!=(n=null==p?void 0:p.side)?n:"right"),role:o?"complementary":"tooltip","aria-label":m,style:{left:null!=(t=null==p?void 0:p.left)?t:-9999,top:null!=(i=null==p?void 0:p.top)?i:-9999,width:c,visibility:p?"visible":"hidden"},children:u}),document.body):null}function x(e){let{anchor:n}=e,t=(0,i.fJ)(n.id);return t?(0,s.jsx)(f,{target:n.rect,children:(0,s.jsx)(p,{agent:t})}):null}},15426:(e,n,t)=>{"use strict";t.d(n,{IX:()=>u,R4:()=>m});var s=t(94799),r=t(41463),a=t.n(r),i=t(34023),l=t(494),c=t(48538),o=t(69654);function d(e){let n=(0,c.Tu)(e=>e.agents);return(0,i.useMemo)(()=>({of:e.cloned_from?n.find(n=>n.id===e.cloned_from):void 0,clones:n.filter(n=>n.cloned_from===e.id)}),[n,e.id,e.cloned_from])}function u(e){let{agent:n,link:t=!1,className:r=""}=e,{t:i}=(0,o.s9)(),{of:c}=d(n);if(!c)return null;let u=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.A,{size:11,"aria-hidden":!0}),c.name]}),m=i("agent.cloneOf",{name:c.name});return t?(0,s.jsx)(a(),{className:"chip clone ".concat(r),href:"/agents/".concat(c.id),title:m,onClick:e=>e.stopPropagation(),children:u}):(0,s.jsx)("span",{className:"chip clone ".concat(r),title:m,children:u})}function m(e){let{agent:n}=e,{t}=(0,o.s9)(),{clones:r}=d(n);return r.length?(0,s.jsxs)("span",{className:"chip clone",title:t("agent.clonesList",{names:r.map(e=>e.name).join(", ")}),children:[(0,s.jsx)(l.A,{size:11,"aria-hidden":!0}),t("agent.clones.count",{count:r.length})]}):null}},33974:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});let s=(0,t(74955).A)("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]])},34237:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>N});var s=t(94799),r=t(34023),a=t(43624),i=t(41463),l=t.n(i),c=t(33974),o=t(78330),d=t(92947),u=t(79141),m=t(58311),h=t(48538),p=t(77021),f=t(47890),x=t(69654),g=t(72942),j=t(5372),v=t(10804),w=t(1517),y=t(494);function b(e){let{activeId:n,collapsed:t=!1,onToggle:a}=e,{t:i}=(0,x.s9)(),{agents:b,colonies:N,live:k,ready:_}=(0,h.o0)(),C=(0,j.z6)(),[E,A]=(0,r.useState)(""),[z,L]=(0,r.useState)(!1),[T,q]=(0,p.ud)("hive-am.switcher.folded",[]),R=Array.isArray(T)?T:[],M=e=>q(n=>{let t=(Array.isArray(n)?n:[]).filter(e=>"free"===e||N.some(n=>n.id===e));return t.includes(e)?t.filter(n=>n!==e):[...t,e]}),B=(0,r.useMemo)(()=>{let e=e=>!E||"".concat(e.name," ").concat(e.description," ").concat(e.provider," ").concat(e.model).toLowerCase().includes(E.toLowerCase()),n=N.map(n=>({key:n.id,name:n.name,color:n.color||"var(--honey)",items:b.filter(t=>t.colony_id===n.id&&e(t))}));for(let t of(n.push({key:"free",name:i("common.noColony"),color:null,items:b.filter(n=>(!n.colony_id||!N.some(e=>e.id===n.colony_id))&&e(n))}),n))t.items.sort((e,n)=>Number("orchestrator"===n.role)-Number("orchestrator"===e.role));return n.filter(e=>e.items.length)},[b,N,E,i]),S=e=>!!E||!R.includes(e),O=e=>e.filter(e=>"running"===e.status).length,P=(e,t)=>t?e:e.filter(e=>e.id===n),F=(0,r.useRef)(null),I=(0,r.useRef)("");(0,r.useEffect)(()=>{let e=F.current,s=null==e?void 0:e.querySelector(".sw-item[aria-current]"),r="".concat(n,":").concat(t);if(!e||!s||I.current===r)return;I.current=r;let a=e.getBoundingClientRect(),i=s.getBoundingClientRect();i.top<a.top?e.scrollTop-=a.top-i.top:i.bottom>a.bottom&&(e.scrollTop+=i.bottom-a.bottom)});let D=a&&(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:a,"aria-label":t?i("switcher.expand"):i("switcher.collapse"),title:t?i("switcher.expand"):i("switcher.collapse"),"aria-expanded":!t,children:t?(0,s.jsx)(c.A,{size:17}):(0,s.jsx)(o.A,{size:17})});if(t)return(0,s.jsxs)("aside",{className:"switcher mini","aria-label":i("nav.agents"),children:[(0,s.jsxs)("div",{className:"switcher-head",children:[D,(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:()=>L(!0),"aria-label":i("newAgent.title"),title:i("newAgent.title"),children:(0,s.jsx)(d.A,{size:16})})]}),(0,s.jsx)("div",{className:"switcher-list",ref:F,children:B.map(e=>{let t=S(e.key),r=t?0:O(e.items),a=[i("switcher.groupSize",{name:e.name,count:e.items.length}),r>0&&i("switcher.groupBusy",{count:r})].filter(Boolean).join(", ");return(0,s.jsxs)("div",{className:"mini-group",children:[(0,s.jsxs)("button",{type:"button",className:"mini-sep","aria-expanded":t,disabled:!!E,onClick:()=>M(e.key),"aria-label":a,title:"".concat(a,"\n").concat(t?i("switcher.groupFold",{name:e.name}):i("switcher.groupUnfold",{name:e.name})),style:e.color?{"--c":e.color}:void 0,children:[(0,s.jsx)(u.A,{size:10,className:"chev","aria-hidden":!0}),(0,s.jsx)("span",{className:"ms-abbr","aria-hidden":!0,children:function(e){var n;let t=e.trim().split(/[\s_-]+/).filter(Boolean),s=e=>"function"==typeof Intl.Segmenter?Array.from(new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e),e=>e.segment):Array.from(e);return(t.length>1?s(t[0])[0]+s(t[1])[0]:s(null!=(n=t[0])?n:"").slice(0,2).join("")).toLocaleUpperCase()}(e.name)}),(0,s.jsx)("span",{className:"ms-count","aria-hidden":!0,children:e.items.length}),r>0&&(0,s.jsx)("i",{className:"pip","aria-hidden":!0})]}),P(e.items,t).map(e=>(0,s.jsx)(l(),{href:"/agents/".concat(e.id),className:"sw-item mini","aria-current":e.id===n?"page":void 0,"aria-label":e.cloned_from&&b.some(n=>n.id===e.cloned_from)?"".concat(e.name,", ").concat(i("agent.cloneOf",{name:b.find(n=>n.id===e.cloned_from).name})):e.name,...C.bind(e.id),children:(0,s.jsxs)("span",{className:"sw-av",children:[(0,s.jsx)(v._h,{agent:e}),"idle"!==e.status&&(0,s.jsx)("i",{className:"pip ".concat("error"===e.status?"err":"")})]})},e.id))]},e.key)})}),z&&(0,s.jsx)(w.bC,{onClose:()=>L(!1)}),C.node]});let U=e=>{let t=(0,g.E)(k[e.id]);return(0,s.jsxs)(l(),{href:"/agents/".concat(e.id),className:"sw-item","aria-current":e.id===n?"page":void 0,...C.bind(e.id),children:[(0,s.jsxs)("span",{className:"sw-av",children:[(0,s.jsx)(v._h,{agent:e}),"idle"!==e.status&&(0,s.jsx)("i",{className:"pip ".concat("error"===e.status?"err":"")})]}),(0,s.jsxs)("span",{className:"sw-body",children:[(0,s.jsxs)("span",{className:"sw-top",children:[(0,s.jsx)("b",{children:e.name}),"orchestrator"===e.role&&(0,s.jsx)("em",{children:i("role.orchestrator")}),e.cloned_from&&b.some(n=>n.id===e.cloned_from)&&(0,s.jsxs)("em",{className:"clone",title:i("agent.cloneOf",{name:b.find(n=>n.id===e.cloned_from).name}),children:[(0,s.jsx)(y.A,{size:9,"aria-hidden":!0}),b.find(n=>n.id===e.cloned_from).name]})]}),(0,s.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,s.jsxs)("span",{className:"sw-meta",children:[(0,s.jsx)("i",{style:{background:f.xq[e.provider].color}}),f.xq[e.provider].short,e.model?" \xb7 ".concat(e.model):"",(0,s.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)};return(0,s.jsxs)("aside",{className:"switcher","aria-label":i("nav.agents"),children:[(0,s.jsxs)("div",{className:"switcher-head",children:[(0,s.jsxs)("div",{className:"row",children:[(0,s.jsx)("b",{style:{fontFamily:"var(--font-display)",fontSize:16},className:"grow",children:i("nav.agents")}),D,(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:()=>L(!0),"aria-label":i("newAgent.title"),children:(0,s.jsx)(d.A,{size:16})})]}),(0,s.jsxs)("div",{className:"search",children:[(0,s.jsx)(m.A,{size:15}),(0,s.jsx)("input",{className:"input",placeholder:i("switcher.find"),value:E,onChange:e=>A(e.target.value),"aria-label":i("switcher.find")})]})]}),(0,s.jsxs)("div",{className:"switcher-list",ref:F,children:[0===B.length&&(E||_)&&(0,s.jsx)("p",{className:"muted small",style:{padding:16},children:E?i("switcher.noMatch",{query:E}):i("switcher.empty")}),B.map(e=>{let n=S(e.key),t=O(e.items);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("button",{type:"button",className:"switcher-group","aria-expanded":n,disabled:!!E,onClick:()=>M(e.key),title:n?i("switcher.groupFold",{name:e.name}):i("switcher.groupUnfold",{name:e.name}),children:[(0,s.jsx)(u.A,{size:13,className:"chev","aria-hidden":!0}),e.color&&(0,s.jsx)("i",{className:"cdot",style:{background:e.color}}),(0,s.jsx)("span",{className:"sg-name",children:e.name}),!n&&t>0&&(0,s.jsx)("i",{className:"pip",role:"img","aria-label":i("switcher.groupBusy",{count:t})}),(0,s.jsx)("span",{className:"sg-count",children:e.items.length})]}),P(e.items,n).map(U)]},e.key)})]}),z&&(0,s.jsx)(w.bC,{onClose:()=>L(!1)}),C.node]})}function N(e){let{children:n}=e,{id:t}=(0,a.useParams)(),[i,l]=(0,p.ud)("hive-switcher-collapsed",0),c=1===i,[o,d]=(0,r.useState)(!1);return t?(0,s.jsxs)("div",{className:"ws ".concat(c?"sw-collapsed":""," ").concat(o?"sw-anim":""),children:[(0,s.jsx)(b,{activeId:t,collapsed:c,onToggle:()=>{d(!0),l(+!c)}}),n]}):(0,s.jsx)(s.Fragment,{children:n})}},40993:(e,n,t)=>{Promise.resolve().then(t.bind(t,34237))},72942:(e,n,t)=>{"use strict";t.d(n,{E:()=>a});var s=t(68419),r=t(10969);function a(e){if(!e)return null;let n=e.blocks[e.blocks.length-1],t="dispatch"===e.source?(0,s.Tl)("activity.delegated"):"";if(!n)return"".concat(t).concat((0,s.Tl)("activity.starting"));if("tool"===n.type){let e=(0,r.q0)(n),a="".concat(e.label).concat(e.summary?" ".concat(e.summary):"");return"".concat(t).concat(void 0===n.output?(0,s.Tl)("activity.running",{tool:a}):(0,s.Tl)("activity.ran",{tool:a}))}return"".concat(t).concat("thinking"===n.type?(0,s.Tl)("activity.thinking"):(0,s.Tl)("activity.writing"))}},78330:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});let s=(0,t(74955).A)("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]])}},e=>{e.O(0,[586,706,642,281,517,350,408,89,358],()=>e(e.s=40993)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[165],{494:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},3492:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).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"}]])},10452:(e,s,t)=>{Promise.resolve().then(t.bind(t,47857))},15426:(e,s,t)=>{"use strict";t.d(s,{IX:()=>h,R4:()=>x});var a=t(94799),l=t(41463),n=t.n(l),i=t(34023),d=t(494),c=t(48538),r=t(69654);function o(e){let s=(0,c.Tu)(e=>e.agents);return(0,i.useMemo)(()=>({of:e.cloned_from?s.find(s=>s.id===e.cloned_from):void 0,clones:s.filter(s=>s.cloned_from===e.id)}),[s,e.id,e.cloned_from])}function h(e){let{agent:s,link:t=!1,className:l=""}=e,{t:i}=(0,r.s9)(),{of:c}=o(s);if(!c)return null;let h=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{size:11,"aria-hidden":!0}),c.name]}),x=i("agent.cloneOf",{name:c.name});return t?(0,a.jsx)(n(),{className:"chip clone ".concat(l),href:"/agents/".concat(c.id),title:x,onClick:e=>e.stopPropagation(),children:h}):(0,a.jsx)("span",{className:"chip clone ".concat(l),title:x,children:h})}function x(e){let{agent:s}=e,{t}=(0,r.s9)(),{clones:l}=o(s);return l.length?(0,a.jsxs)("span",{className:"chip clone",title:t("agent.clonesList",{names:l.map(e=>e.name).join(", ")}),children:[(0,a.jsx)(d.A,{size:11,"aria-hidden":!0}),t("agent.clones.count",{count:l.length})]}):null}},20555:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).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"}]])},47857:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>j});var a=t(94799),l=t(41463),n=t.n(l),i=t(43624),d=t(34023),c=t(92947),r=t(48538),o=t(77021),h=t(47890),x=t(10804),p=t(1517),m=t(15426),u=t(69654);function j(){let{t:e}=(0,u.s9)(),{agents:s,colonies:t,ready:l,error:j,retry:y}=(0,r.q5)(),k=(0,i.useRouter)(),[g,v]=(0,o.ud)("hive-am.agents.q",""),[b,f]=(0,o.ud)("hive-am.agents.role","all"),[N,A]=(0,o.ud)("hive-am.agents.provider","all"),[M,w]=(0,d.useState)(!1),C=(0,d.useMemo)(()=>s.filter(e=>("all"===b||e.role===b)&&("all"===N||e.provider===N)&&(!g||"".concat(e.name," ").concat(e.description," ").concat(e.cwd).toLowerCase().includes(g.toLowerCase()))),[s,g,b,N]);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:()=>w(!0),children:[(0,a.jsx)(c.A,{size:16}),e("newAgent.title")]})]}),!l&&j&&(0,a.jsx)(x.lZ,{kind:"err",children:(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsxs)("span",{className:"grow",children:[e("cx.loadFailed")," ",j]}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>void y(),children:e("cx.retry")})]})}),(0,a.jsxs)("div",{className:"row wrap agents-filters",children:[(0,a.jsx)(x.DO,{className:"grow",value:g,onChange:v,placeholder:e("agents.searchPlaceholder"),label:e("agents.searchLabel")}),(0,a.jsx)(x.$q,{value:b,onChange:f,options:[{id:"all",label:e("common.all")},{id:"orchestrator",label:e("agents.filter.orchestrators")},{id:"worker",label:e("agents.filter.workers")}]}),(0,a.jsx)(x.$q,{value:N,onChange:A,options:[{id:"all",label:e("agents.filter.anyProvider")},...Object.keys(h.xq).map(e=>({id:e,label:h.xq[e].short}))]})]}),l&&0===s.length?(0,a.jsx)(x.pp,{icon:(0,a.jsx)(x._h,{size:"lg",queen:!0,label:"+"}),title:e("agents.empty.title"),body:e("agents.empty.body"),action:(0,a.jsxs)("button",{className:"btn primary",onClick:()=>w(!0),children:[(0,a.jsx)(c.A,{size:16}),e("newAgent.create")]})}):l?0===C.length?(0,a.jsx)(x.pp,{title:e("agents.noMatch.title"),body:e("agents.noMatch.body"),action:(0,a.jsx)("button",{className:"btn",onClick:()=>{v(""),f("all"),A("all")},children:e("common.clearFilters")})}):(0,a.jsx)("div",{className:"card table-scroll",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:C.map(s=>{let l=()=>k.push("/agents/".concat(s.id)),i=t.find(e=>e.id===s.colony_id);return(0,a.jsxs)("tr",{className:"row-link",tabIndex:0,"aria-label":e("cx.openAgent",{name:s.name}),onClick:l,onKeyDown:e=>{e.target===e.currentTarget&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),l())},children:[(0,a.jsx)("td",{children:(0,a.jsxs)("div",{className:"name-cell",children:[(0,a.jsx)(x._h,{agent:s}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("b",{children:[(0,a.jsx)(n(),{href:"/agents/".concat(s.id),onClick:e=>e.stopPropagation(),children:s.name})," ",(0,a.jsx)(m.IX,{agent:s,link:!0}),(0,a.jsx)(m.R4,{agent:s})]}),(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",{className:"fw-600",children:h.xq[s.provider].label}),(0,a.jsx)("span",{className:"muted small",children:s.model||e("model.cliDefault")})]}),(0,a.jsx)("td",{children:i?(0,a.jsxs)("span",{className:"chip",children:[(0,a.jsx)("i",{className:"cdot cx-chip-dot",style:{background:i.color||"var(--honey)"}}),i.name]}):(0,a.jsx)("span",{className:"muted small",children:"—"})}),(0,a.jsxs)("td",{className:"mono muted small",children:[(0,h._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)(x.PW,{role:s.role}),(0,a.jsx)(x.P5,{status:s.status})]})}),(0,a.jsx)("td",{className:"muted small",children:(0,h.KN)(s.updated_at)})]},s.id)})})]})}):(0,a.jsxs)("div",{className:"card comb-skel",role:"status","aria-label":e("cx.loading"),children:[(0,a.jsx)("div",{className:"skel",style:{width:"100%",height:48}}),(0,a.jsx)("div",{className:"skel",style:{width:"100%",height:48}}),(0,a.jsx)("div",{className:"skel",style:{width:"100%",height:48}})]}),M&&(0,a.jsx)(p.bC,{onClose:()=>w(!1)})]})}},52263:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).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"}]])},55712:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).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"}]])},55838:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},71529:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},91833:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).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"}]])},92947:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},98148:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).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"}]])},98938:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).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"}]])},99579:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).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,[586,706,281,517,408,89,358],()=>e(e.s=10452)),_N_E=e.O()}]);
|
package/web/.next/static/chunks/app/chat/{page-5261b12b7d50f5d1.js → page-383bc24e72dab7fa.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[457],{3492:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},20555:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},52263:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},54609:(e,t,a)=>{"use strict";a.d(t,{O:()=>s});let s="hive-am.lastChat"},55712:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},55838:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).A)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},69925:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>u});var s=a(94799),d=a(34023),h=a(43624),i=a(87454),l=a(92947),c=a(48538),r=a(77021),y=a(54609),n=a(10804),p=a(1517),k=a(69654);function u(){let{t:e}=(0,k.s9)(),{agents:t,ready:a,error:u,retry:o}=(0,c.q5)(),x=(0,h.useRouter)(),[A,M]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{if(!a||0===t.length)return;let e=(0,r.CL)(y.O,"");x.replace("/agents/".concat(t.some(t=>t.id===e)?e:t[0].id))},[a,t,x]),(0,s.jsxs)("div",{className:"page",children:[(0,s.jsx)("div",{className:"page-head",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{children:e("nav.chat")}),(0,s.jsx)("p",{children:e("chat.home.subtitle")})]})}),!a&&u&&(0,s.jsx)(n.lZ,{kind:"err",children:(0,s.jsxs)("div",{className:"row gap-s wrap",children:[(0,s.jsxs)("span",{className:"grow",children:[e("cx.loadFailed")," ",u]}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>void o(),children:e("cx.retry")})]})}),a&&0===t.length&&(0,s.jsx)(n.pp,{icon:(0,s.jsx)(i.A,{size:28}),title:e("chat.home.empty.title"),body:e("chat.home.empty.body"),action:(0,s.jsxs)("button",{className:"btn primary",onClick:()=>M(!0),children:[(0,s.jsx)(l.A,{size:16}),e("newAgent.create")]})}),A&&(0,s.jsx)(p.
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[457],{3492:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},20555:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},52263:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},54609:(e,t,a)=>{"use strict";a.d(t,{O:()=>s});let s="hive-am.lastChat"},55712:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},55838:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).A)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},69925:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>u});var s=a(94799),d=a(34023),h=a(43624),i=a(87454),l=a(92947),c=a(48538),r=a(77021),y=a(54609),n=a(10804),p=a(1517),k=a(69654);function u(){let{t:e}=(0,k.s9)(),{agents:t,ready:a,error:u,retry:o}=(0,c.q5)(),x=(0,h.useRouter)(),[A,M]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{if(!a||0===t.length)return;let e=(0,r.CL)(y.O,"");x.replace("/agents/".concat(t.some(t=>t.id===e)?e:t[0].id))},[a,t,x]),(0,s.jsxs)("div",{className:"page",children:[(0,s.jsx)("div",{className:"page-head",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{children:e("nav.chat")}),(0,s.jsx)("p",{children:e("chat.home.subtitle")})]})}),!a&&u&&(0,s.jsx)(n.lZ,{kind:"err",children:(0,s.jsxs)("div",{className:"row gap-s wrap",children:[(0,s.jsxs)("span",{className:"grow",children:[e("cx.loadFailed")," ",u]}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>void o(),children:e("cx.retry")})]})}),a&&0===t.length&&(0,s.jsx)(n.pp,{icon:(0,s.jsx)(i.A,{size:28}),title:e("chat.home.empty.title"),body:e("chat.home.empty.body"),action:(0,s.jsxs)("button",{className:"btn primary",onClick:()=>M(!0),children:[(0,s.jsx)(l.A,{size:16}),e("newAgent.create")]})}),A&&(0,s.jsx)(p.bC,{onClose:()=>M(!1)})]})}},70732:(e,t,a)=>{Promise.resolve().then(a.bind(a,69925))},71529:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},87454:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).A)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},91833:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},92947:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},98148:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},98938:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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"}]])},99579:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(74955).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,[586,706,281,517,408,89,358],()=>e(e.s=70732)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[572],{494:(e,n,s)=>{"use strict";s.d(n,{A:()=>a});let a=(0,s(74955).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},1553:(e,n,s)=>{Promise.resolve().then(s.bind(s,87286))},7697:(e,n,s)=>{"use strict";s.d(n,{A:()=>a});let a=(0,s(74955).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"}]])},15223:(e,n,s)=>{"use strict";s.d(n,{A:()=>a});let a=(0,s(74955).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"}]])},37064:(e,n,s)=>{"use strict";s.d(n,{n:()=>t});var a=s(34023);function t(e,n){let{enabled:s=!0,pauseHidden:t=!0,immediate:l=!0,onError:c}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(0,a.useRef)(e);i.current=e;let o=(0,a.useRef)(c);o.current=c,(0,a.useEffect)(()=>{let e;if(!s)return;let a=!1,c=0,r=!1,d=()=>{clearTimeout(e),a||(e=setTimeout(()=>void h(),n*Math.min(6,2**c)))},h=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!a&&!r){if(!e&&t&&"undefined"!=typeof document&&"hidden"===document.visibilityState)return void d();r=!0;try{await i.current(),c=0}catch(e){var n;0==c++&&(null==(n=o.current)||n.call(o,e))}finally{r=!1,d()}}},m=()=>{"visible"!==document.visibilityState||r||(clearTimeout(e),h())};return l?h(!0):d(),t&&document.addEventListener("visibilitychange",m),()=>{a=!0,clearTimeout(e),document.removeEventListener("visibilitychange",m)}},[n,s,t,l])}},38950:(e,n,s)=>{"use strict";s.d(n,{A:()=>a});let a=(0,s(74955).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"}]])},73506:(e,n,s)=>{"use strict";s.d(n,{h:()=>t});var a=s(34023);function t(e){(0,a.useEffect)(()=>{if(!e)return;let n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[e])}},79141:(e,n,s)=>{"use strict";s.d(n,{A:()=>a});let a=(0,s(74955).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},87286:(e,n,s)=>{"use strict";s.r(n),s.d(n,{default:()=>z});var a=s(94799),t=s(34023),l=s(92947),c=s(15223);let i=(0,s(74955).A)("Slack",[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]]);var o=s(7697),r=s(48538),d=s(37064),h=s(47890),m=s(69654),u=s(10804),p=s(97356),x=s(70665),j=s(38950),v=s(92720),g=s(3749),k=s(66843),b=s(79141),f=s(72705),y=s(494);let w=[["app_mentions:read","conn.slack.scope.mentions"],["channels:history","conn.slack.scope.channelsHistory"],["groups:history","conn.slack.scope.groupsHistory"],["im:history","conn.slack.scope.imHistory"],["mpim:history","conn.slack.scope.mpimHistory"],["chat:write","conn.slack.scope.chatWrite"],["reactions:write","conn.slack.scope.reactions"],["files:read","conn.slack.scope.filesRead"],["files:write","conn.slack.scope.filesWrite"],["users:read","conn.slack.scope.users"],["channels:read","conn.slack.scope.channelsRead"],["groups:read","conn.slack.scope.groupsRead"]],N=["app_mention","message.channels","message.groups","message.im","message.mpim"];function C(e){let{name:n,open:s}=e,{t:l}=(0,m.s9)(),[c,i]=(0,t.useState)(!1),o=async()=>{try{await navigator.clipboard.writeText(function(e){let n=(e.trim()||"hive-am").slice(0,35);return JSON.stringify({display_information:{name:n,description:"A hive-am agent"},features:{app_home:{home_tab_enabled:!1,messages_tab_enabled:!0,messages_tab_read_only_enabled:!1},bot_user:{display_name:n,always_online:!0},slash_commands:[{command:"/hive",description:"hive-am: status, stop, new, mute, unmute, help, id",usage_hint:"status",should_escape:!1}]},oauth_config:{scopes:{bot:w.map(e=>{let[n]=e;return n})}},settings:{event_subscriptions:{bot_events:N},interactivity:{is_enabled:!1},org_deploy_enabled:!1,socket_mode_enabled:!0,token_rotation_enabled:!1}},null,2)}(n)),i(!0),setTimeout(()=>i(!1),1500)}catch(e){}};return(0,a.jsxs)("details",{className:"fold slack-setup",open:s,children:[(0,a.jsxs)("summary",{children:[l("conn.slack.setup.title"),(0,a.jsx)(b.A,{size:14,className:"chev"})]}),(0,a.jsxs)("div",{className:"ss-body stack-s",children:[(0,a.jsx)("p",{className:"hint m0",children:l("conn.slack.setup.intro")}),(0,a.jsx)("div",{children:(0,a.jsxs)("button",{type:"button",className:"btn sm",onClick:o,children:[c?(0,a.jsx)(f.A,{size:14}):(0,a.jsx)(y.A,{size:14}),l(c?"conn.slack.setup.copied":"conn.slack.setup.copy")]})}),(0,a.jsx)("p",{className:"hint m0",children:l("conn.slack.setup.manifestHint")}),(0,a.jsx)("div",{className:"eyebrow",children:l("conn.slack.setup.socket")}),(0,a.jsx)("p",{className:"hint m0",children:l("conn.slack.setup.socketHint")}),(0,a.jsx)("div",{className:"eyebrow",children:l("conn.slack.setup.scopes")}),(0,a.jsx)("ul",{className:"ss-list",children:w.map(e=>{let[n,s]=e;return(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:n}),(0,a.jsx)("span",{className:"hint",children:l(s)})]},n)})}),(0,a.jsx)("div",{className:"eyebrow",children:l("conn.slack.setup.events")}),(0,a.jsxs)("p",{className:"hint m0",children:[N.map((e,n)=>(0,a.jsxs)("span",{children:[n?", ":"",(0,a.jsx)("code",{children:e})]},e)),". ",l("conn.slack.setup.eventsHint")]}),(0,a.jsx)("div",{className:"eyebrow",children:l("conn.slack.setup.more")}),(0,a.jsxs)("ul",{className:"ss-list",children:[(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:"/hive"}),(0,a.jsx)("span",{className:"hint",children:l("conn.slack.setup.command")})]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:"App Home"}),(0,a.jsx)("span",{className:"hint",children:l("conn.slack.setup.home")})]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:"/invite"}),(0,a.jsx)("span",{className:"hint",children:l("conn.slack.setup.invite")})]})]}),(0,a.jsx)("p",{className:"hint m0",children:(0,a.jsx)("b",{children:l("conn.slack.setup.reinstall")})})]})]})}var _=s(73506);function A(e){var n,s,c,i,o,d,b,f,y;let{connection:w,onClose:N}=e,{t:A}=(0,m.s9)(),{agents:S,refresh:z}=(0,r.o0)(),M=(0,u.dj)(),H=!!w,[D,E]=(0,t.useState)((null==w?void 0:w.kind)==="slack"?"slack":"telegram"),q="slack"===D,[T,F]=(0,t.useState)(null!=(n=null==w?void 0:w.name)?n:""),[V,L]=(0,t.useState)(null!=(s=null==w?void 0:w.agent_id)?s:""),[$,R]=(0,t.useState)(""),[Z,O]=(0,t.useState)(""),[P,B]=(0,t.useState)(null!=(c=null==w?void 0:w.allowed)?c:[]),[K,J]=(0,t.useState)((null==w?void 0:w.config.lang)==="en"?"en":"es"),[U,W]=(0,t.useState)(null!=(i=null==w?void 0:w.config.on_silent)?i:"notice"),[X,G]=(0,t.useState)(null!=(o=null==w?void 0:w.config.effort)?o:""),[I,Q]=(0,t.useState)((null==w?void 0:w.config.group_mode)==="open"?"open":"mention"),[Y,ee]=(0,t.useState)(null!=(d=null==w?void 0:w.config.chats)?d:[]),[en,es]=(0,t.useState)((null!=(b=null==w?void 0:w.config.aliases)?b:[]).join(", ")),[ea,et]=(0,t.useState)((null==w?void 0:w.config.files)!==!1),[el,ec]=(0,t.useState)(null!=(f=null==w?void 0:w.config.vision)?f:null),[ei,eo]=(0,t.useState)(null==(y=null==w?void 0:w.enabled)||y),[er,ed]=(0,t.useState)(!1),[eh,em]=(0,t.useState)(""),[eu,ep]=(0,t.useState)({}),[ex,ej]=(0,t.useState)([]),[ev,eg]=(0,t.useState)(!1),[ek,eb]=(0,t.useState)(!1),ef=JSON.stringify([D,T,V,$,Z,P,K,U,X,I,Y,en,ea,el,ei]),ey=(0,t.useRef)(ef),ew=ef!==ey.current;(0,_.h)(ew);let eN=()=>{ew?eb(!0):N()},eC=S.find(e=>e.id===V),e_=null==eC?void 0:eC.effective.permission,eA=e=>{var n;return(null==w||null==(n=w.config[e])?void 0:n.set)?w.config[e].hint:""},eS=eA(q?"bot_token":"token"),ez=eA("app_token"),eM=e=>q?e.toUpperCase().replace(/[^A-Z0-9]/g,""):e.replace(/\D/g,"");(0,t.useEffect)(()=>{w&&g.FH.get("/connections/".concat(w.id,"/threads")).then(ej).catch(()=>void 0)},[w]);let eH=(0,t.useMemo)(()=>[...S].sort((e,n)=>e.name.localeCompare(n.name)),[S]),eD=(e,n)=>B(s=>s.map((s,a)=>a===e?{...s,...n}:s)),eE=(e,n)=>ee(s=>s.map((s,a)=>a===e?{...s,...n}:s)),eq=(e,n)=>ee(s=>s.map((s,a)=>{var t;return a===e?{...s,members:n(null!=(t=s.members)?t:[])}:s})),eT=async e=>{try{await g.FH.patch("/connections/".concat(w.id,"/threads/").concat(e.id),{muted:!e.muted}),ej(n=>n.map(n=>n.id===e.id?{...n,muted:!e.muted}:n))}catch(e){M(e instanceof Error?e.message:String(e),"err")}},eF=async()=>{if(eC)try{let e=eC.effective.inherited.includes("permission")?[...new Set([...eC.overrides,"permission"])]:eC.overrides;await g.FH.patch("/agents/".concat(eC.id),{permission:"acceptEdits",overrides:e}),await z(["agents"]),M(A("conn.perm.fixed",{name:eC.name}))}catch(e){em(e instanceof Error?e.message:String(e))}},eV=async()=>{let e={};if(T.trim()||(e.name=A("conn.err.name")),V||(e.agent=A("conn.err.agent")),H||$.trim()||(e.token=A("conn.err.token")),H||!q||Z.trim()||(e.appToken=A("conn.err.appToken")),ep(e),em(""),Object.keys(e).length)return;ed(!0);let n=q?{...$.trim()?{bot_token:$.trim()}:{},...Z.trim()?{app_token:Z.trim()}:{}}:{...$.trim()?{token:$.trim()}:{}},s={kind:D,name:T.trim(),agent_id:V,enabled:ei,allowed:P.filter(e=>e.id.trim()),config:{...n,lang:K,on_silent:U,effort:X,group_mode:I,files:ea,vision:el,chats:Y.filter(e=>e.id.trim()).map(e=>e.members?{...e,members:e.members.filter(e=>e.id.trim())}:e),aliases:en.split(",").map(e=>e.trim()).filter(Boolean)}};try{w?await g.FH.patch("/connections/".concat(w.id),s):await g.FH.post("/connections",s),await z(["connections","agents"]),M(A(H?"conn.saved":"conn.created")),N()}catch(e){em(e instanceof Error?e.message:String(e))}finally{ed(!1)}},eL=async()=>{try{let e=await g.FH.post("/connections/".concat(w.id,"/test"));M(A("conn.test.ok",{detail:e.detail}))}catch(e){M(e instanceof Error?e.message:A("conn.test.failed"),"err")}},e$=async()=>{await g.FH.del("/connections/".concat(w.id)),await z(["connections","agents"]),M(A("conn.deleted")),N()};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(u._s,{title:A(H?"conn.edit":"conn.new"),subtitle:A("conn.shared"),onClose:eN,footer:(0,a.jsxs)(a.Fragment,{children:[H&&(0,a.jsxs)("button",{className:"btn danger push-r",onClick:()=>eg(!0),children:[(0,a.jsx)(p.A,{size:15}),A("conn.delete")]}),H&&(0,a.jsx)("button",{className:"btn",onClick:eL,disabled:!ei,children:A("conn.test")}),(0,a.jsx)("button",{className:"btn ghost",onClick:eN,children:A("common.cancel")}),(0,a.jsx)("button",{className:"btn primary",onClick:eV,disabled:er,children:A(H?"conn.save":"conn.create")})]}),children:[eh&&(0,a.jsx)(u.lZ,{kind:"err",children:eh}),(0,a.jsxs)(u.D0,{label:A("conn.kind"),children:[(0,a.jsx)(u.$q,{value:D,onChange:E,options:[{id:"telegram",label:A("conn.kind.telegram"),disabled:H&&q},{id:"slack",label:A("conn.kind.slack"),disabled:H&&!q}]}),H&&(0,a.jsx)("p",{className:"hint m0",children:A("conn.kind.fixed")})]}),q&&(0,a.jsx)(C,{name:T,open:!H}),(0,a.jsx)(u.D0,{label:A("conn.name"),hint:A("conn.name.hint"),error:eu.name,children:(0,a.jsx)("input",{className:"input",value:T,onChange:e=>F(e.target.value),placeholder:A("conn.name.placeholder"),autoFocus:!H})}),(0,a.jsx)(u.D0,{label:A("conn.agent"),hint:A("conn.agent.hint"),error:eu.agent,children:(0,a.jsxs)("select",{className:"input",value:V,onChange:e=>L(e.target.value),children:[(0,a.jsx)("option",{value:"",children:A("conn.agent.pick")}),eH.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})}),eC&&"plan"===e_&&(0,a.jsxs)(u.lZ,{kind:"err",children:[A("conn.perm.plan",{name:eC.name})," ",(0,a.jsx)("button",{type:"button",className:"btn sm",onClick:eF,children:A("conn.perm.fix")})]}),eC&&"bypassPermissions"===e_&&(0,a.jsx)(u.lZ,{kind:"honey",children:A("conn.perm.full",{name:eC.name})}),eC&&"opencode"===eC.provider&&(0,a.jsx)("p",{className:"hint m0",children:A("conn.perm.opencode")}),(0,a.jsx)(u.D0,{label:A("conn.token"),hint:A(q?"conn.token.hint.slack":"conn.token.hint"),error:eu.token,children:(0,a.jsx)(k.y,{autoComplete:"off",value:$,onChange:e=>R(e.target.value),placeholder:eS?A("conn.token.keep",{hint:eS}):q?"xoxb-…":"123456:ABC…"})}),q&&(0,a.jsx)(u.D0,{label:A("conn.appToken"),hint:A("conn.appToken.hint"),error:eu.appToken,children:(0,a.jsx)(k.y,{autoComplete:"off",value:Z,onChange:e=>O(e.target.value),placeholder:ez?A("conn.token.keep",{hint:ez}):"xapp-…"})}),(0,a.jsx)(u.D0,{label:A("conn.allowed"),hint:A(q?"conn.allowed.hint.slack":"conn.allowed.hint"),children:(0,a.jsxs)("div",{className:"stack-s",children:[0===P.length&&(0,a.jsx)("p",{className:"hint m0",children:A("conn.allowed.empty")}),P.map((e,n)=>{var s;return(0,a.jsxs)("div",{className:"row gap-s wrap fa-idrow",children:[(0,a.jsx)("input",{className:"input mono fa-w150",value:e.id,onChange:e=>eD(n,{id:eM(e.target.value)}),placeholder:A(q?"conn.allowed.id.slack":"conn.allowed.id"),"aria-label":A(q?"conn.allowed.id.slack":"conn.allowed.id")}),(0,a.jsx)("input",{className:"input grow",value:null!=(s=e.name)?s:"",onChange:e=>eD(n,{name:e.target.value}),placeholder:A("conn.allowed.name"),"aria-label":A("conn.allowed.name")}),(0,a.jsx)("span",{title:A("conn.allowed.adminHint"),className:"nowrap",children:(0,a.jsx)(u.Tl,{checked:!!e.admin,onChange:e=>eD(n,{admin:e}),label:A("conn.allowed.admin")})}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>B(e=>e.filter((e,s)=>s!==n)),"aria-label":A("conn.allowed.remove"),title:A("conn.allowed.remove"),children:(0,a.jsx)(x.A,{size:15})})]},n)}),(0,a.jsx)("div",{children:(0,a.jsxs)("button",{className:"btn sm",onClick:()=>B(e=>[...e,{id:""}]),children:[(0,a.jsx)(l.A,{size:14}),A("conn.allowed.add")]})}),(0,a.jsx)("p",{className:"hint m0",children:A(q?"conn.allowed.howto.slack":"conn.allowed.howto")})]})}),(0,a.jsx)(u.D0,{label:A(q?"conn.groups.slack":"conn.groups"),children:(0,a.jsxs)("div",{className:"stack-s fa-gap10",children:[(0,a.jsx)("p",{className:"hint m0",children:A(q?"conn.groups.hint.slack":"conn.groups.hint")}),(0,a.jsx)(u.$q,{value:I,onChange:Q,options:[{id:"mention",label:A("conn.mode.mention")},{id:"open",label:A("conn.mode.open")}]}),(0,a.jsx)("p",{className:"hint m0",children:A(q?"conn.mode.".concat(I,".hint.slack"):"conn.mode.".concat(I,".hint"))}),(0,a.jsx)(u.D0,{label:A("conn.aliases"),hint:A(q?"conn.aliases.hint.slack":"conn.aliases.hint"),children:(0,a.jsx)("input",{className:"input",value:en,onChange:e=>es(e.target.value),placeholder:A("conn.aliases.placeholder")})})]})}),(0,a.jsx)(u.D0,{label:A(q?"conn.chats.slack":"conn.chats"),hint:A(q?"conn.chats.hint.slack":"conn.chats.hint"),children:(0,a.jsxs)("div",{className:"stack-s fa-gap10",children:[0===Y.length&&(0,a.jsx)("p",{className:"hint m0",children:A(q?"conn.chats.empty.slack":"conn.chats.empty")}),Y.map((e,n)=>{var s,t;let c="members"===e.mode?"members":"everyone",i=null!=(s=e.members)?s:[],o=A(q?"conn.chats.member.id.slack":"conn.chats.member.id");return(0,a.jsxs)("div",{className:"stack-s fa-chat",children:[(0,a.jsxs)("div",{className:"row gap-s wrap fa-idrow",children:[(0,a.jsx)("input",{className:"input mono fa-w190",value:e.id,onChange:e=>{let s;return eE(n,{id:(s=e.target.value,q?s.toUpperCase().replace(/[^A-Z0-9]/g,""):s.replace(/[^\d-]/g,""))})},placeholder:A(q?"conn.chats.id.slack":"conn.chats.id"),"aria-label":A(q?"conn.chats.id.slack":"conn.chats.id")}),(0,a.jsx)("input",{className:"input grow",value:null!=(t=e.name)?t:"",onChange:e=>eE(n,{name:e.target.value}),placeholder:A("conn.chats.name"),"aria-label":A("conn.chats.name")}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>ee(e=>e.filter((e,s)=>s!==n)),"aria-label":A("conn.chats.remove"),title:A("conn.chats.remove"),children:(0,a.jsx)(x.A,{size:15})})]}),(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsx)("span",{className:"hint m0",children:A("conn.chats.mode")}),(0,a.jsx)(u.$q,{value:c,onChange:e=>eE(n,{mode:e}),options:[{id:"everyone",label:A("conn.chats.mode.everyone")},{id:"members",label:A("conn.chats.mode.members")}]})]}),(0,a.jsx)("p",{className:"hint m0",children:A(q?"conn.chats.mode.".concat(c,".hint.slack"):"conn.chats.mode.".concat(c,".hint"))}),"members"===c&&(0,a.jsxs)(a.Fragment,{children:[!i.some(e=>e.id.trim())&&(0,a.jsx)("p",{className:"hint warn m0",children:A(q?"conn.chats.mode.members.empty.slack":"conn.chats.mode.members.empty")}),i.map((e,s)=>{var t;return(0,a.jsxs)("div",{className:"row gap-s wrap fa-idrow",children:[(0,a.jsx)("input",{className:"input mono fa-w150",value:e.id,onChange:e=>eq(n,n=>n.map((n,a)=>a===s?{...n,id:eM(e.target.value)}:n)),placeholder:o,"aria-label":o}),(0,a.jsx)("input",{className:"input grow",value:null!=(t=e.name)?t:"",onChange:e=>eq(n,n=>n.map((n,a)=>a===s?{...n,name:e.target.value}:n)),placeholder:A("conn.chats.member.name"),"aria-label":A("conn.chats.member.name")}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>eq(n,e=>e.filter((e,n)=>n!==s)),"aria-label":A("conn.chats.member.remove"),title:A("conn.chats.member.remove"),children:(0,a.jsx)(x.A,{size:15})})]},s)}),(0,a.jsx)("div",{children:(0,a.jsxs)("button",{className:"btn sm",onClick:()=>eq(n,e=>[...e,{id:""}]),children:[(0,a.jsx)(l.A,{size:14}),A("conn.chats.member.add")]})})]})]},n)}),(0,a.jsx)("div",{children:(0,a.jsxs)("button",{className:"btn sm",onClick:()=>ee(e=>[...e,{id:""}]),children:[(0,a.jsx)(l.A,{size:14}),A(q?"conn.chats.add.slack":"conn.chats.add")]})}),(0,a.jsx)("p",{className:"hint m0",children:A(q?"conn.chats.howto.slack":"conn.chats.howto")})]})}),(0,a.jsx)(u.D0,{label:A("conn.files"),hint:A("conn.files.hint"),children:(0,a.jsx)(u.$q,{value:ea?"on":"off",onChange:e=>et("on"===e),options:[{id:"on",label:A("common.yes")},{id:"off",label:A("conn.files.off")}]})}),ea&&(0,a.jsx)(u.D0,{label:A("conn.vision"),hint:A(el?"conn.vision.hint.other":"conn.vision.hint.agent"),children:(0,a.jsxs)("div",{className:"stack-s",children:[(0,a.jsx)(u.$q,{value:el?"other":"agent",onChange:e=>ec("other"===e?{provider:"claude",model:"haiku"}:null),options:[{id:"agent",label:A("conn.vision.agent")},{id:"other",label:A("conn.vision.other")}]}),el&&(0,a.jsxs)("div",{className:"stack-s",children:[(0,a.jsx)("select",{className:"input",value:el.provider,onChange:e=>ec({provider:e.target.value,model:""}),"aria-label":A("form.provider"),children:["claude","opencode","kiro"].map(e=>(0,a.jsx)("option",{value:e,children:"claude"===e?"Claude Code":"opencode"===e?"OpenCode":"Kiro"},e))}),(0,a.jsx)(u.CD,{provider:el.provider,value:el.model,onChange:e=>ec({...el,model:e})})]})]})}),(0,a.jsx)(u.D0,{label:A("conn.lang"),children:(0,a.jsx)(u.$q,{value:K,onChange:J,options:[{id:"es",label:A("conn.lang.es")},{id:"en",label:A("conn.lang.en")}]})}),(0,a.jsx)(u.D0,{label:A("conn.silent"),children:(0,a.jsx)(u.$q,{value:U,onChange:W,options:["notice","send_text","ignore"].map(e=>({id:e,label:A("conn.silent.".concat(e))}))})}),(0,a.jsx)(u.D0,{label:A("conn.effort"),hint:A("conn.effort.hint"),children:(0,a.jsx)(u.$q,{value:X,onChange:G,options:[{id:"",label:A("conn.effort.default")},{id:"low",label:A("conn.effort.low")},{id:"medium",label:A("conn.effort.medium")},{id:"high",label:A("conn.effort.high")},{id:"xhigh",label:A("conn.effort.xhigh")},{id:"max",label:A("conn.effort.max")}]})}),(0,a.jsx)(u.D0,{label:A("conn.enabled"),hint:A("conn.enabled.hint"),children:(0,a.jsx)(u.$q,{value:ei?"on":"off",onChange:e=>eo("on"===e),options:[{id:"on",label:A("common.yes")},{id:"off",label:A("conn.status.stopped")}]})}),H&&(0,a.jsxs)("div",{className:"stack-s",children:[(0,a.jsx)("div",{className:"eyebrow",children:A("conn.threads.title")}),0===ex.length?(0,a.jsx)("p",{className:"hint m0",children:A("conn.threads.empty")}):ex.map(e=>(0,a.jsxs)("div",{className:"row gap-s small between",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("b",{children:e.title||e.external_key})," ",(0,a.jsx)("span",{className:"muted mono",children:e.external_key})]}),(0,a.jsxs)("span",{className:"row gap-s muted",children:[e.muted&&(0,a.jsx)("span",{className:"gx-chip soft",children:A("conn.threads.muted")}),e.last_user?A("conn.threads.last",{user:e.last_user})+" \xb7 ":"",(0,h.KN)(e.last_activity),(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:()=>eT(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,a.jsx)(j.A,{size:14}):(0,a.jsx)(v.A,{size:14})})]})]},e.id))]})]}),ev&&(0,a.jsx)(u.TM,{danger:!0,title:A("conn.deleteTitle",{name:w.name}),body:A("conn.deleteBody"),confirmLabel:A("conn.delete"),onConfirm:e$,onClose:()=>eg(!1)}),ek&&(0,a.jsx)(u.TM,{danger:!0,title:A("fa.unsaved.title"),body:A("fa.unsaved.body"),confirmLabel:A("fa.unsaved.discard"),cancelLabel:A("fa.unsaved.keep"),onClose:()=>eb(!1),onConfirm:N})]})}let S={connected:"ok",connecting:"run",error:"err",stopped:""};function z(){let{t:e}=(0,m.s9)(),{connections:n,agents:s,ready:p,refresh:x,error:j,retry:v}=(0,r.q5)(),[g,k]=(0,t.useState)(null);return(0,d.n)(()=>x(["connections"]),5e3,{immediate:!1}),(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.connections")}),(0,a.jsx)("p",{children:e("conn.subtitle")})]}),(0,a.jsxs)("button",{className:"btn primary",onClick:()=>k("new"),children:[(0,a.jsx)(l.A,{size:16}),e("conn.new")]})]}),j&&(0,a.jsxs)(u.lZ,{kind:"err",children:[(0,a.jsx)("span",{children:j})," ",(0,a.jsx)("button",{type:"button",className:"btn sm",onClick:()=>void v(),children:e("fa.retry")})]}),p&&0===n.length?(0,a.jsx)(u.pp,{icon:(0,a.jsx)(c.A,{size:28}),title:e("conn.empty.title"),body:e("conn.empty.body"),action:(0,a.jsxs)("button",{className:"btn primary",onClick:()=>k("new"),children:[(0,a.jsx)(l.A,{size:16}),e("conn.new")]})}):(0,a.jsx)("div",{className:"conn-grid",children:n.map(n=>{let t=s.find(e=>e.id===n.agent_id);return(0,a.jsxs)("button",{type:"button",className:"card card-pad conncard",onClick:()=>k(n),children:[(0,a.jsxs)("div",{className:"row gap-s",children:["slack"===n.kind?(0,a.jsx)(i,{size:16,"aria-hidden":!0}):(0,a.jsx)(o.A,{size:16,"aria-hidden":!0}),(0,a.jsx)("b",{className:"grow tl",children:n.name}),(0,a.jsxs)("span",{className:"chip",children:[(0,a.jsx)("i",{className:"dot ".concat(S[n.status.state])}),e("conn.status.".concat(n.enabled?n.status.state:"stopped"))]})]}),"error"===n.status.state&&n.enabled&&(0,a.jsx)("p",{className:"small m0 tl fa-err",children:n.status.detail}),(0,a.jsx)("div",{className:"row gap-s",children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u._h,{agent:t,size:"sm"}),(0,a.jsx)("span",{children:t.name})]}):(0,a.jsx)("span",{className:"muted small",children:e("conn.noAgent")})}),(0,a.jsxs)("div",{className:"muted small tl",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,h.KN)(n.status.lastEventAt)})):""]})]},n.id)})}),g&&(0,a.jsx)(A,{connection:"new"===g?void 0:g,onClose:()=>k(null)})]})}},92720:(e,n,s)=>{"use strict";s.d(n,{A:()=>a});let a=(0,s(74955).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"}]])},92947:(e,n,s)=>{"use strict";s.d(n,{A:()=>a});let a=(0,s(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,n,s)=>{"use strict";s.d(n,{A:()=>a});let a=(0,s(74955).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"}]])}},e=>{e.O(0,[586,281,408,89,358],()=>e(e.s=1553)),_N_E=e.O()}]);
|