heyhank 0.1.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/README.md +40 -0
- package/bin/cli.ts +168 -0
- package/bin/ctl.ts +528 -0
- package/bin/generate-token.ts +28 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/AgentsPage-BPhirnCe.js +7 -0
- package/dist/assets/AssistantPage-DJ-cMQfb.js +1 -0
- package/dist/assets/CronManager-DDbz-yiT.js +1 -0
- package/dist/assets/HelpPage-DMfkzERp.js +1 -0
- package/dist/assets/IntegrationsPage-CrOitCmJ.js +1 -0
- package/dist/assets/MediaPage-CE5rdvkC.js +1 -0
- package/dist/assets/PlatformDashboard-Do6F0O2p.js +1 -0
- package/dist/assets/Playground-Fc5cdc5p.js +109 -0
- package/dist/assets/ProcessPanel-CslEiZkI.js +2 -0
- package/dist/assets/PromptsPage-D2EhsdNO.js +4 -0
- package/dist/assets/RunsPage-C5BZF5Rx.js +1 -0
- package/dist/assets/SandboxManager-a1AVI5q2.js +8 -0
- package/dist/assets/SettingsPage-DirhjQrJ.js +51 -0
- package/dist/assets/SocialMediaPage-DBuM28vD.js +1 -0
- package/dist/assets/TailscalePage-CHiFhZXF.js +1 -0
- package/dist/assets/TelephonyPage-x0VV0fOo.js +1 -0
- package/dist/assets/TerminalPage-Drwyrnfd.js +1 -0
- package/dist/assets/gemini-audio-t-TSU-To.js +17 -0
- package/dist/assets/gemini-live-client-C7rqAW7G.js +166 -0
- package/dist/assets/index-C8M_PUmX.css +32 -0
- package/dist/assets/index-CEqZnThB.js +204 -0
- package/dist/assets/sw-register-LSSpj6RU.js +1 -0
- package/dist/assets/time-ago-B6r_l9u1.js +1 -0
- package/dist/assets/workbox-window.prod.es5-BIl4cyR9.js +2 -0
- package/dist/favicon-32-original.png +0 -0
- package/dist/favicon-32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/favicon.svg +8 -0
- package/dist/fonts/MesloLGSNerdFontMono-Bold.woff2 +0 -0
- package/dist/fonts/MesloLGSNerdFontMono-Regular.woff2 +0 -0
- package/dist/heyhank-mascot-poster.png +0 -0
- package/dist/heyhank-mascot.mp4 +0 -0
- package/dist/heyhank-mascot.webm +0 -0
- package/dist/icon-192-original.png +0 -0
- package/dist/icon-192.png +0 -0
- package/dist/icon-512-original.png +0 -0
- package/dist/icon-512.png +0 -0
- package/dist/index.html +21 -0
- package/dist/logo-192.png +0 -0
- package/dist/logo-512.png +0 -0
- package/dist/logo-codex.svg +14 -0
- package/dist/logo-docker.svg +4 -0
- package/dist/logo-original.png +0 -0
- package/dist/logo.png +0 -0
- package/dist/logo.svg +14 -0
- package/dist/manifest.json +24 -0
- package/dist/push-sw.js +34 -0
- package/dist/sw.js +1 -0
- package/dist/workbox-d2a0910a.js +1 -0
- package/package.json +109 -0
- package/server/agent-cron-migrator.ts +85 -0
- package/server/agent-executor.ts +357 -0
- package/server/agent-store.ts +185 -0
- package/server/agent-timeout.ts +107 -0
- package/server/agent-types.ts +122 -0
- package/server/ai-validation-settings.ts +37 -0
- package/server/ai-validator.ts +181 -0
- package/server/anthropic-provider-migration.ts +48 -0
- package/server/assistant-store.ts +272 -0
- package/server/auth-manager.ts +150 -0
- package/server/auto-approve.ts +153 -0
- package/server/auto-namer.ts +36 -0
- package/server/backend-adapter.ts +54 -0
- package/server/cache-headers.ts +61 -0
- package/server/calendar-service.ts +434 -0
- package/server/claude-adapter.ts +889 -0
- package/server/claude-container-auth.ts +30 -0
- package/server/claude-session-discovery.ts +157 -0
- package/server/claude-session-history.ts +410 -0
- package/server/cli-launcher.ts +1303 -0
- package/server/codex-adapter.ts +3027 -0
- package/server/codex-container-auth.ts +24 -0
- package/server/codex-home.ts +27 -0
- package/server/codex-ws-proxy.cjs +226 -0
- package/server/commands-discovery.ts +81 -0
- package/server/constants.ts +7 -0
- package/server/container-manager.ts +1053 -0
- package/server/cost-tracker.ts +222 -0
- package/server/cron-scheduler.ts +243 -0
- package/server/cron-store.ts +148 -0
- package/server/cron-types.ts +63 -0
- package/server/email-service.ts +354 -0
- package/server/env-manager.ts +161 -0
- package/server/event-bus-types.ts +75 -0
- package/server/event-bus.ts +124 -0
- package/server/execution-store.ts +170 -0
- package/server/federation/node-connection.ts +190 -0
- package/server/federation/node-manager.ts +366 -0
- package/server/federation/node-store.ts +86 -0
- package/server/federation/node-types.ts +121 -0
- package/server/fs-utils.ts +15 -0
- package/server/git-utils.ts +421 -0
- package/server/github-pr.ts +379 -0
- package/server/google-media.ts +342 -0
- package/server/image-pull-manager.ts +279 -0
- package/server/index.ts +491 -0
- package/server/internal-ai.ts +237 -0
- package/server/kill-switch.ts +99 -0
- package/server/llm-providers.ts +342 -0
- package/server/logger.ts +259 -0
- package/server/mcp-registry.ts +401 -0
- package/server/message-bus.ts +271 -0
- package/server/message-delivery.ts +128 -0
- package/server/metrics-collector.ts +350 -0
- package/server/metrics-types.ts +108 -0
- package/server/middleware/managed-auth.ts +195 -0
- package/server/novnc-proxy.ts +99 -0
- package/server/path-resolver.ts +186 -0
- package/server/paths.ts +13 -0
- package/server/pr-poller.ts +162 -0
- package/server/prompt-manager.ts +211 -0
- package/server/protocol/claude-upstream/README.md +19 -0
- package/server/protocol/claude-upstream/sdk.d.ts.txt +1943 -0
- package/server/protocol/codex-upstream/ClientNotification.ts.txt +5 -0
- package/server/protocol/codex-upstream/ClientRequest.ts.txt +60 -0
- package/server/protocol/codex-upstream/README.md +18 -0
- package/server/protocol/codex-upstream/ServerNotification.ts.txt +41 -0
- package/server/protocol/codex-upstream/ServerRequest.ts.txt +16 -0
- package/server/protocol/codex-upstream/v2/DynamicToolCallParams.ts.txt +6 -0
- package/server/protocol/codex-upstream/v2/DynamicToolCallResponse.ts.txt +6 -0
- package/server/protocol-monitor.ts +50 -0
- package/server/provider-manager.ts +111 -0
- package/server/provider-registry.ts +393 -0
- package/server/push-notifications.ts +221 -0
- package/server/recorder.ts +374 -0
- package/server/recording-hub/compat-validator.ts +284 -0
- package/server/recording-hub/diagnostics.ts +299 -0
- package/server/recording-hub/hub-config.ts +19 -0
- package/server/recording-hub/hub-routes.ts +236 -0
- package/server/recording-hub/hub-store.ts +265 -0
- package/server/recording-hub/replay-adapter.ts +207 -0
- package/server/relay-client.ts +320 -0
- package/server/reminder-scheduler.ts +38 -0
- package/server/replay.ts +78 -0
- package/server/routes/agent-routes.ts +264 -0
- package/server/routes/assistant-routes.ts +90 -0
- package/server/routes/cron-routes.ts +103 -0
- package/server/routes/env-routes.ts +95 -0
- package/server/routes/federation-routes.ts +76 -0
- package/server/routes/fs-routes.ts +622 -0
- package/server/routes/git-routes.ts +97 -0
- package/server/routes/llm-routes.ts +166 -0
- package/server/routes/media-routes.ts +135 -0
- package/server/routes/metrics-routes.ts +13 -0
- package/server/routes/platform-routes.ts +1379 -0
- package/server/routes/prompt-routes.ts +67 -0
- package/server/routes/provider-routes.ts +109 -0
- package/server/routes/sandbox-routes.ts +127 -0
- package/server/routes/settings-routes.ts +285 -0
- package/server/routes/skills-routes.ts +100 -0
- package/server/routes/socialmedia-routes.ts +208 -0
- package/server/routes/system-routes.ts +228 -0
- package/server/routes/tailscale-routes.ts +22 -0
- package/server/routes/telephony-routes.ts +259 -0
- package/server/routes.ts +1379 -0
- package/server/sandbox-manager.ts +168 -0
- package/server/service.ts +718 -0
- package/server/session-creation-service.ts +457 -0
- package/server/session-git-info.ts +104 -0
- package/server/session-names.ts +67 -0
- package/server/session-orchestrator.ts +824 -0
- package/server/session-state-machine.ts +207 -0
- package/server/session-store.ts +146 -0
- package/server/session-types.ts +511 -0
- package/server/settings-manager.ts +149 -0
- package/server/shared-context.ts +157 -0
- package/server/socialmedia/adapter.ts +15 -0
- package/server/socialmedia/adapters/ayrshare-adapter.ts +169 -0
- package/server/socialmedia/adapters/buffer-adapter.ts +299 -0
- package/server/socialmedia/adapters/postiz-adapter.ts +298 -0
- package/server/socialmedia/manager.ts +227 -0
- package/server/socialmedia/store.ts +98 -0
- package/server/socialmedia/types.ts +89 -0
- package/server/tailscale-manager.ts +451 -0
- package/server/telephony/audio-bridge.ts +331 -0
- package/server/telephony/call-manager.ts +457 -0
- package/server/telephony/call-types.ts +108 -0
- package/server/telephony/telephony-store.ts +119 -0
- package/server/terminal-manager.ts +240 -0
- package/server/update-checker.ts +192 -0
- package/server/usage-limits.ts +225 -0
- package/server/web-push.d.ts +51 -0
- package/server/worktree-tracker.ts +84 -0
- package/server/ws-auth.ts +41 -0
- package/server/ws-bridge-browser-ingest.ts +72 -0
- package/server/ws-bridge-browser.ts +112 -0
- package/server/ws-bridge-cli-ingest.ts +81 -0
- package/server/ws-bridge-codex.ts +266 -0
- package/server/ws-bridge-controls.ts +20 -0
- package/server/ws-bridge-persist.ts +66 -0
- package/server/ws-bridge-publish.ts +79 -0
- package/server/ws-bridge-replay.ts +61 -0
- package/server/ws-bridge-types.ts +121 -0
- package/server/ws-bridge.ts +1240 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as l,j as e,y as be,v as ve,w as je,z as ye,b as E,F as we,u as Ne}from"./index-CEqZnThB.js";import{t as pe}from"./time-ago-B6r_l9u1.js";const me="heyhank_public_url_dismissed";function ke({publicUrl:s}){const[o,x]=l.useState(()=>localStorage.getItem(me)==="1");return s||o?null:e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-400 text-xs flex items-start justify-between gap-3",role:"alert",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"No public URL configured."})," ","Webhook URLs currently use your browser address, which external services may not be able to reach."," ",e.jsx("a",{href:"#/settings",className:"underline hover:text-amber-300",children:"Set your public URL in Settings"}),"."]}),e.jsx("button",{onClick:()=>{localStorage.setItem(me,"1"),x(!0)},className:"text-amber-400 hover:text-amber-200 transition-colors cursor-pointer flex-shrink-0","aria-label":"Dismiss public URL banner",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]})}const Ce=["bot","terminal","pencil","search","shield","chart","flask","rocket","wrench","clipboard","lightbulb","code","globe","zap","database","git-branch","mail","cpu"];function ae({icon:s,className:o="w-5 h-5"}){const n={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:`${o} shrink-0`,role:"img","aria-label":s||"bot"};switch(s){case"bot":return e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),e.jsx("circle",{cx:"9",cy:"16",r:"1"}),e.jsx("circle",{cx:"15",cy:"16",r:"1"}),e.jsx("path",{d:"M12 2v4"}),e.jsx("path",{d:"M8 7h8"}),e.jsx("circle",{cx:"12",cy:"2",r:"1"})]});case"terminal":return e.jsxs("svg",{...n,children:[e.jsx("polyline",{points:"4 17 10 11 4 5"}),e.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]});case"pencil":return e.jsx("svg",{...n,children:e.jsx("path",{d:"M17 3a2.83 2.83 0 114 4L7.5 20.5 2 22l1.5-5.5Z"})});case"search":return e.jsxs("svg",{...n,children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]});case"shield":return e.jsx("svg",{...n,children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})});case"chart":return e.jsxs("svg",{...n,children:[e.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),e.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),e.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]});case"flask":return e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M9 3h6V8l5 10a1 1 0 01-.9 1.4H4.9A1 1 0 014 18L9 8V3z"}),e.jsx("line",{x1:"9",y1:"3",x2:"15",y2:"3"})]});case"rocket":return e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 00-2.91-.09z"}),e.jsx("path",{d:"M12 15l-3-3a22 22 0 012-3.95A12.88 12.88 0 0122 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 01-4 2z"}),e.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]});case"wrench":return e.jsx("svg",{...n,children:e.jsx("path",{d:"M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"})});case"clipboard":return e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M16 4h2a2 2 0 012 2v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2h2"}),e.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"})]});case"lightbulb":return e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M9 18h6"}),e.jsx("path",{d:"M10 22h4"}),e.jsx("path",{d:"M12 2a7 7 0 00-3 13.33V17h6v-1.67A7 7 0 0012 2z"})]});case"code":return e.jsxs("svg",{...n,children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]});case"globe":return e.jsxs("svg",{...n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e.jsx("path",{d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})]});case"zap":return e.jsx("svg",{...n,children:e.jsx("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})});case"database":return e.jsxs("svg",{...n,children:[e.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),e.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]});case"git-branch":return e.jsxs("svg",{...n,children:[e.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),e.jsx("circle",{cx:"18",cy:"6",r:"3"}),e.jsx("circle",{cx:"6",cy:"18",r:"3"}),e.jsx("path",{d:"M18 9a9 9 0 01-9 9"})]});case"mail":return e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("polyline",{points:"22 7 12 13 2 7"})]});case"cpu":return e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),e.jsx("rect",{x:"9",y:"9",width:"6",height:"6"}),e.jsx("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),e.jsx("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),e.jsx("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),e.jsx("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),e.jsx("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),e.jsx("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),e.jsx("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),e.jsx("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]});default:return s?e.jsx("span",{className:o,children:s}):e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),e.jsx("circle",{cx:"9",cy:"16",r:"1"}),e.jsx("circle",{cx:"15",cy:"16",r:"1"}),e.jsx("path",{d:"M12 2v4"}),e.jsx("path",{d:"M8 7h8"}),e.jsx("circle",{cx:"12",cy:"2",r:"1"})]})}}function Ae({agent:s,copiedWebhook:o,onEdit:x,onDelete:n,onToggle:h,onExport:S,onCopyWebhook:p,onRegenerateSecret:v}){var z,N;const[g,b]=l.useState(!1),a=l.useRef(null);l.useEffect(()=>{if(!g)return;function m(k){a.current&&!a.current.contains(k.target)&&b(!1)}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[g]),l.useEffect(()=>{if(!g)return;function m(k){k.key==="Escape"&&b(!1)}return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[g]);const f=(N=(z=s.triggers)==null?void 0:z.webhook)==null?void 0:N.enabled;function w(m){b(!1),m()}return e.jsxs("div",{className:"relative",ref:a,children:[e.jsx("button",{onClick:()=>b(!g),className:"p-1.5 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"More actions","aria-label":"More actions","aria-expanded":g,"aria-haspopup":"true",children:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[e.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),e.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),e.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),g&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-cc-card border border-cc-border rounded-xl shadow-lg z-20 py-1 origin-top-right",style:{animation:"menu-appear 120ms ease-out"},role:"menu",children:[e.jsxs("button",{onClick:()=>w(x),className:"w-full px-3 py-2 text-xs text-left text-cc-fg hover:bg-cc-hover transition-colors flex items-center gap-2.5 cursor-pointer",role:"menuitem",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:e.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25c.081-.286.235-.547.445-.758l8.61-8.61z"})}),"Edit"]}),e.jsxs("button",{onClick:()=>w(S),className:"w-full px-3 py-2 text-xs text-left text-cc-fg hover:bg-cc-hover transition-colors flex items-center gap-2.5 cursor-pointer",role:"menuitem",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:e.jsx("path",{d:"M3.5 13a.5.5 0 01-.5-.5V11h1v1h8v-1h1v1.5a.5.5 0 01-.5.5h-9zM8 2a.5.5 0 01.5.5v6.793l2.146-2.147a.5.5 0 01.708.708l-3 3a.5.5 0 01-.708 0l-3-3a.5.5 0 01.708-.708L7.5 9.293V2.5A.5.5 0 018 2z"})}),"Export JSON"]}),f&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-1 border-t border-cc-border/40",role:"separator"}),e.jsxs("button",{onClick:()=>w(p),className:"w-full px-3 py-2 text-xs text-left text-cc-fg hover:bg-cc-hover transition-colors flex items-center gap-2.5 cursor-pointer",role:"menuitem",children:[e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:[e.jsx("path",{d:"M4.715 6.542L3.343 7.914a3 3 0 104.243 4.243l1.828-1.829A3 3 0 008.586 5.5L8 6.086a1 1 0 00-.154.199 2 2 0 01.861 3.337L6.88 11.45a2 2 0 11-2.83-2.83l.793-.792a4.018 4.018 0 01-.128-1.287z"}),e.jsx("path",{d:"M11.285 9.458l1.372-1.372a3 3 0 10-4.243-4.243L6.586 5.671A3 3 0 007.414 10.5l.586-.586a1 1 0 00.154-.199 2 2 0 01-.861-3.337L9.12 4.55a2 2 0 112.83 2.83l-.793.792c.112.42.155.855.128 1.287z"})]}),o===s.id?"Copied!":"Copy Webhook URL"]}),e.jsxs("button",{onClick:()=>w(v),className:"w-full px-3 py-2 text-xs text-left text-cc-fg hover:bg-cc-hover transition-colors flex items-center gap-2.5 cursor-pointer",role:"menuitem",children:[e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:[e.jsx("path",{d:"M11.534 7h3.932a.25.25 0 01.192.41l-1.966 2.36a.25.25 0 01-.384 0l-1.966-2.36a.25.25 0 01.192-.41zm-7 2H.602a.25.25 0 01-.192-.41l1.966-2.36a.25.25 0 01.384 0l1.966 2.36a.25.25 0 01-.192.41z"}),e.jsx("path",{d:"M8 3a5 5 0 014.546 2.914.5.5 0 00.908-.418A6 6 0 002 8c0 .088.002.176.006.264l-.058-.024a.5.5 0 00-.394.908l2 1a.5.5 0 00.668-.17L5.59 7.864a.5.5 0 00-.274-.846l-.09-.016A4 4 0 018 3zm.002 10a4 4 0 002.49-4.002l.09.016a.5.5 0 00.274.846l-1.367 2.114a.5.5 0 01-.668.17l-2-1a.5.5 0 01.394-.908l.058.024A5.972 5.972 0 008.002 13a5 5 0 01-4.546-2.914.5.5 0 00-.908.418A6 6 0 008.002 13z"})]}),"Regenerate Secret"]})]}),e.jsx("div",{className:"my-1 border-t border-cc-border/40",role:"separator"}),e.jsxs("button",{onClick:()=>w(h),className:"w-full px-3 py-2 text-xs text-left text-cc-fg hover:bg-cc-hover transition-colors flex items-center gap-2.5 cursor-pointer",role:"menuitem",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:s.enabled?e.jsx("path",{d:"M5 3a5 5 0 000 10h6a5 5 0 000-10H5zm6 3a2 2 0 110 4 2 2 0 010-4z"}):e.jsx("path",{d:"M11 3a5 5 0 010 10H5A5 5 0 015 3h6zM5 6a2 2 0 100 4 2 2 0 000-4z"})}),s.enabled?"Disable":"Enable"]}),e.jsx("div",{className:"my-1 border-t border-cc-border/40",role:"separator"}),e.jsxs("button",{onClick:()=>w(n),className:"w-full px-3 py-2 text-xs text-left text-cc-error hover:bg-cc-error/10 transition-colors flex items-center gap-2.5 cursor-pointer",role:"menuitem",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M5.5 5.5a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm-7-3A1.5 1.5 0 015 1h6a1.5 1.5 0 011.5 1.5H14a.5.5 0 010 1h-.554L12.2 14.118A1.5 1.5 0 0110.706 15H5.294a1.5 1.5 0 01-1.494-.882L2.554 3.5H2a.5.5 0 010-1h1.5z"})}),"Delete"]})]})]})}function Se(s,o){if(!o)return"One-time";const x=s.trim().split(/\s+/);if(x.length!==5)return s;const[n,h,,,S]=x;if(s==="* * * * *")return"Every minute";if(h==="*"&&n.startsWith("*/")){const p=parseInt(n.slice(2),10);return p===1?"Every minute":`Every ${p} minutes`}if(n==="0"&&h==="*")return"Every hour";if(n==="0"&&h.startsWith("*/")){const p=parseInt(h.slice(2),10);return p===1?"Every hour":`Every ${p} hours`}if(n!=="*"&&h!=="*"&&!h.includes("/")&&!h.includes(",")){const p=parseInt(h,10),v=parseInt(n,10);if(!isNaN(p)&&!isNaN(v)){const g=p>=12?"PM":"AM",b=p===0?12:p>12?p-12:p,a=v.toString().padStart(2,"0"),f=`${b}:${a} ${g}`;if(S==="*")return`Daily at ${f}`;if(S==="1-5")return`Weekdays at ${f}`}}return s}function Me(s,o){var n,h;return`${o||window.location.origin}/api/agents/${encodeURIComponent(s.id)}/webhook/${((h=(n=s.triggers)==null?void 0:n.webhook)==null?void 0:h.secret)||""}`}function Ee({agent:s,publicUrl:o,onEdit:x,onDelete:n,onToggle:h,onRun:S,onExport:p,onCopyWebhook:v,onRegenerateSecret:g,copiedWebhook:b}){var f,w,z,N;const a=["Manual"];return(w=(f=s.triggers)==null?void 0:f.webhook)!=null&&w.enabled&&a.push("Webhook"),(N=(z=s.triggers)==null?void 0:z.schedule)!=null&&N.enabled&&a.push(Se(s.triggers.schedule.expression,s.triggers.schedule.recurring)),e.jsxs("div",{className:`
|
|
2
|
+
group relative rounded-xl border bg-cc-card p-4
|
|
3
|
+
transition-all duration-150
|
|
4
|
+
${s.enabled?"border-cc-border hover:border-cc-primary/30 hover:shadow-[0_2px_12px_rgba(217,119,87,0.06)]":"border-cc-border/60 opacity-75 hover:opacity-100"}
|
|
5
|
+
`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("div",{className:`${s.enabled?"text-cc-primary":"text-cc-muted"} transition-colors`,children:e.jsx(ae,{icon:s.icon||"bot",className:"w-5 h-5"})}),e.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full ring-2 ring-cc-card ${s.enabled?"bg-cc-success":"bg-cc-muted/50"}`,title:s.enabled?"Enabled":"Disabled","data-testid":"status-dot"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("h3",{className:"text-sm font-medium text-cc-fg truncate",children:s.name}),e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded-full bg-cc-hover text-cc-muted font-medium leading-none",children:s.backendType==="codex"?"Codex":"Claude"})]}),s.description&&e.jsx("p",{className:"text-xs text-cc-muted mt-0.5 truncate max-w-md",children:s.description})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("button",{onClick:S,className:"px-2.5 py-1 text-xs font-medium rounded-lg bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",title:"Run agent",children:"Run"}),e.jsx(Ae,{agent:s,copiedWebhook:b,onEdit:x,onDelete:n,onToggle:h,onExport:p,onCopyWebhook:v,onRegenerateSecret:g})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-3 pt-3 border-t border-cc-border/40",children:[e.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:a.map((m,k)=>e.jsx("span",{className:"px-2 py-0.5 text-[10px] rounded-full bg-cc-hover text-cc-muted",children:m},k))}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-cc-muted",children:[s.totalRuns>0&&e.jsxs("span",{children:[s.totalRuns," run",s.totalRuns!==1?"s":""]}),s.lastRunAt&&e.jsxs("span",{children:["Last: ",pe(s.lastRunAt)]}),s.nextRunAt&&e.jsxs("span",{className:"text-cc-primary font-medium",children:["Next: ",pe(s.nextRunAt)]})]})]})]})}const ne={name:"",description:"",icon:"",backendType:"claude",model:ve("claude"),permissionMode:be("claude"),cwd:"",prompt:"",envSlug:"",env:[],codexInternetAccess:!1,branch:"",createBranch:!1,useWorktree:!1,mcpServers:{},skills:[],allowedTools:[],webhookEnabled:!1,scheduleEnabled:!1,scheduleExpression:"0 8 * * *",scheduleRecurring:!0},ze=[{label:"Every hour",value:"0 * * * *"},{label:"Every day at 8am",value:"0 8 * * *"},{label:"Every day at noon",value:"0 12 * * *"},{label:"Weekdays at 9am",value:"0 9 * * 1-5"},{label:"Every Monday at 8am",value:"0 8 * * 1"},{label:"Every 30 minutes",value:"*/30 * * * *"}];function xe(s){let o=0;return Object.keys(s.mcpServers).length>0&&o++,s.skills.length>0&&o++,s.allowedTools.length>0&&o++,s.env.length>0&&o++,o}function Re({form:s,setForm:o,editingId:x,publicUrl:n,error:h,saving:S,onSave:p,onCancel:v}){const g=je(s.backendType),b=ye(s.backendType),[a,f]=l.useState(!1),[w,z]=l.useState(()=>xe(s)>0),[N,m]=l.useState(!1),[k,H]=l.useState(""),[y,R]=l.useState({type:"stdio",command:"",args:"",url:"",env:""}),[Q,Z]=l.useState([]),[L,le]=l.useState([]),[T,M]=l.useState(""),[P,V]=l.useState(!1),[$,O]=l.useState(!1),[U,B]=l.useState(!1),[oe,W]=l.useState(!!s.branch),[X,F]=l.useState(!1),_=l.useRef(null),Y=l.useRef(null),J=l.useRef(null),G=l.useRef(null);l.useEffect(()=>{E.listSkills().then(Z).catch(()=>{}),E.listEnvs().then(le).catch(()=>{})},[]);function d(t,r){o(A=>({...A,[t]:r}))}function c(t){o(r=>({...r,backendType:t,model:ve(t),permissionMode:be(t)}))}function i(){o(t=>({...t,env:[...t.env,{key:"",value:""}]}))}function u(t,r,A){o(re=>{const de=[...re.env];return de[t]={...de[t],[r]:A},{...re,env:de}})}function j(t){o(r=>({...r,env:r.env.filter((A,re)=>re!==t)}))}function C(){if(!k.trim())return;const t={type:y.type};if(y.type==="stdio"?(t.command=y.command,t.args=y.args?y.args.split(" ").filter(Boolean):void 0):t.url=y.url,y.env.trim())try{t.env=JSON.parse(y.env)}catch{}o(r=>({...r,mcpServers:{...r.mcpServers,[k.trim()]:t}})),H(""),R({type:"stdio",command:"",args:"",url:"",env:""}),m(!1)}function ee(t){o(r=>{const A={...r.mcpServers};return delete A[t],{...r,mcpServers:A}})}function te(t){o(r=>({...r,skills:r.skills.includes(t)?r.skills.filter(A=>A!==t):[...r.skills,t]}))}function se(t){if(t.key==="Enter"&&T.trim()){t.preventDefault();const r=T.trim();s.allowedTools.includes(r)||d("allowedTools",[...s.allowedTools,r]),M("")}}function ce(t){d("allowedTools",s.allowedTools.filter(r=>r!==t))}l.useEffect(()=>{function t(r){Y.current&&!Y.current.contains(r.target)&&V(!1),J.current&&!J.current.contains(r.target)&&O(!1),G.current&&!G.current.contains(r.target)&&B(!1),_.current&&!_.current.contains(r.target)&&F(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const D=g.find(t=>t.value===s.model)||g[0],K=b.find(t=>t.value===s.permissionMode)||b[0],ie=L.find(t=>t.slug===s.envSlug),fe=s.cwd?s.cwd.split("/").pop()||s.cwd:"temp",ue=n||(typeof window<"u"?window.location.origin:""),he="flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer",I=`${he} text-cc-muted hover:text-cc-fg hover:bg-cc-hover`,q=`${he} text-cc-primary bg-cc-primary/10 hover:bg-cc-primary/15`;return e.jsx("div",{className:"h-full overflow-y-auto bg-cc-bg",children:e.jsxs("div",{className:"max-w-3xl mx-auto p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:v,className:"p-1.5 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:e.jsx("path",{d:"M11 2L5 8l6 6",stroke:"currentColor",strokeWidth:"2",fill:"none"})})}),e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:x?"Edit Agent":"New Agent"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:v,className:"px-3 py-1.5 text-xs rounded-lg border border-cc-border text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:p,disabled:S||!s.name.trim()||!s.prompt.trim(),className:"px-3 py-1.5 text-xs rounded-lg bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed",children:S?"Saving...":x?"Save":"Create"})]})]}),h&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/30 text-cc-error text-xs",children:h}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsxs("div",{ref:_,className:"relative flex-shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>F(!X),className:"w-10 h-10 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg flex items-center justify-center hover:border-cc-primary/50 focus:outline-none focus:ring-1 focus:ring-cc-primary transition-colors","aria-label":"Choose agent icon",children:e.jsx(ae,{icon:s.icon||"bot",className:"w-5 h-5"})}),X&&e.jsx("div",{className:"absolute top-12 left-0 z-50 bg-cc-card border border-cc-border rounded-lg shadow-lg p-2 grid grid-cols-6 gap-1 w-[216px]",children:Ce.map(t=>e.jsx("button",{type:"button",onClick:()=>{d("icon",t),F(!1)},className:`w-8 h-8 rounded-md flex items-center justify-center transition-colors ${s.icon===t?"bg-cc-primary/20 ring-1 ring-cc-primary":"hover:bg-cc-hover"}`,title:t,children:e.jsx(ae,{icon:t,className:"w-4 h-4 text-cc-fg"})},t))})]}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("input",{value:s.name,onChange:t=>d("name",t.target.value),placeholder:"Agent name *",className:"w-full px-3 py-2 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-sm focus:outline-none focus:ring-1 focus:ring-cc-primary"}),e.jsx("input",{value:s.description,onChange:t=>d("description",t.target.value),placeholder:"Short description (optional)",className:"w-full px-3 py-1.5 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-xs focus:outline-none focus:ring-1 focus:ring-cc-primary"})]})]}),e.jsxs("div",{children:[e.jsx("textarea",{value:s.prompt,onChange:t=>d("prompt",t.target.value),placeholder:`System prompt *
|
|
6
|
+
Write the agent's instructions here.
|
|
7
|
+
Use {{input}} as a placeholder for trigger-provided input.`,className:"w-full px-3 py-2 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-sm resize-none h-40 font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"}),e.jsxs("p",{className:"text-[10px] text-cc-muted mt-1",children:["Use ",e.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-hover",children:"{{input}}"})," where trigger input should be inserted."]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 flex-wrap","data-testid":"controls-row",children:[e.jsxs("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:[e.jsx("button",{onClick:()=>c("claude"),className:`flex items-center gap-1 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${s.backendType==="claude"?"bg-cc-card text-cc-fg font-medium shadow-sm":"text-cc-muted hover:text-cc-fg"}`,children:"Claude"}),e.jsx("button",{onClick:()=>c("codex"),className:`flex items-center gap-1 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${s.backendType==="codex"?"bg-cc-card text-cc-fg font-medium shadow-sm":"text-cc-muted hover:text-cc-fg"}`,children:"Codex"})]}),e.jsxs("div",{className:"relative",ref:Y,children:[e.jsxs("button",{onClick:()=>{V(!P),O(!1),B(!1)},"aria-expanded":P,className:I,children:[e.jsx("span",{children:D==null?void 0:D.icon}),e.jsx("span",{children:D==null?void 0:D.label}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),P&&e.jsx("div",{className:"absolute left-0 top-full mt-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:g.map(t=>e.jsxs("button",{onClick:()=>{d("model",t.value),V(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${t.value===s.model?"text-cc-primary font-medium":"text-cc-fg"}`,children:[e.jsx("span",{children:t.icon}),t.label]},t.value))})]}),e.jsxs("div",{className:"relative",ref:J,children:[e.jsxs("button",{onClick:()=>{O(!$),V(!1),B(!1)},"aria-expanded":$,className:I,children:[e.jsx("span",{children:K==null?void 0:K.label}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),$&&e.jsx("div",{className:"absolute left-0 top-full mt-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:b.map(t=>e.jsx("button",{onClick:()=>{d("permissionMode",t.value),O(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${t.value===s.permissionMode?"text-cc-primary font-medium":"text-cc-fg"}`,children:t.label},t.value))})]}),e.jsxs("button",{onClick:()=>f(!0),className:s.cwd?q:I,title:s.cwd||"Temporary directory",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.879a1.5 1.5 0 011.06.44l1.122 1.12A1.5 1.5 0 009.62 4H13.5A1.5 1.5 0 0115 5.5v7a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),e.jsx("span",{className:"max-w-[120px] sm:max-w-[200px] truncate font-mono-code",children:fe}),s.cwd&&e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50 hover:opacity-100",onClick:t=>{t.stopPropagation(),d("cwd","")},children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]}),s.cwd&&(oe?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted opacity-60",children:e.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 113 2.122V6.5A2.5 2.5 0 0110 9H6a1 1 0 00-1 1v1.128a2.251 2.251 0 11-1.5 0V5.372a2.25 2.25 0 111.5 0v1.836A2.492 2.492 0 016 7h4a1 1 0 001-1v-.878A2.25 2.25 0 019.5 3.25z"})}),e.jsx("input",{value:s.branch,onChange:t=>d("branch",t.target.value),placeholder:"branch name",className:"w-28 px-1.5 py-1 text-xs rounded-md bg-cc-input-bg border border-cc-border text-cc-fg font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary",autoFocus:!0,onBlur:()=>{s.branch||W(!1)}}),s.branch&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center gap-1 text-[10px] text-cc-muted cursor-pointer",title:"Create branch if it doesn't exist",children:[e.jsx("input",{type:"checkbox",checked:s.createBranch,onChange:t=>d("createBranch",t.target.checked),className:"rounded w-3 h-3"}),"create"]}),e.jsxs("label",{className:"flex items-center gap-1 text-[10px] text-cc-muted cursor-pointer",title:"Use git worktree",children:[e.jsx("input",{type:"checkbox",checked:s.useWorktree,onChange:t=>d("useWorktree",t.target.checked),className:"rounded w-3 h-3"}),"worktree"]})]})]}):e.jsxs("button",{onClick:()=>W(!0),className:I,title:"Set a git branch",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 113 2.122V6.5A2.5 2.5 0 0110 9H6a1 1 0 00-1 1v1.128a2.251 2.251 0 11-1.5 0V5.372a2.25 2.25 0 111.5 0v1.836A2.492 2.492 0 016 7h4a1 1 0 001-1v-.878A2.25 2.25 0 019.5 3.25z"})}),e.jsx("span",{children:"branch"})]})),e.jsxs("div",{className:"relative",ref:G,children:[e.jsxs("button",{onClick:()=>{B(!U),V(!1),O(!1)},"aria-expanded":U,className:s.envSlug?q:I,children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M8 1a2 2 0 012 2v4H6V3a2 2 0 012-2zm3.5 6V3a3.5 3.5 0 10-7 0v4A1.5 1.5 0 003 8.5v5A1.5 1.5 0 004.5 15h7a1.5 1.5 0 001.5-1.5v-5A1.5 1.5 0 0011.5 7z"})}),e.jsx("span",{children:(ie==null?void 0:ie.name)||"None"}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),U&&e.jsxs("div",{className:"absolute left-0 top-full mt-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:[e.jsx("button",{onClick:()=>{d("envSlug",""),B(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${s.envSlug?"text-cc-fg":"text-cc-primary font-medium"}`,children:"None"}),L.map(t=>e.jsx("button",{onClick:()=>{d("envSlug",t.slug),B(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${s.envSlug===t.slug?"text-cc-primary font-medium":"text-cc-fg"}`,children:t.name},t.slug))]})]}),s.backendType==="codex"&&e.jsxs("button",{onClick:()=>d("codexInternetAccess",!s.codexInternetAccess),className:s.codexInternetAccess?q:I,title:"Allow internet access (Codex)",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M0 8a8 8 0 1116 0A8 8 0 010 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 005.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 01.64-1.539 6.7 6.7 0 01.597-.933A6.504 6.504 0 002.536 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.51 6.51 0 00-.656 2.5h2.49zM4.847 5a12.5 12.5 0 00-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 00-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 00.337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 01-.597-.933A9.268 9.268 0 014.09 12H2.536a6.504 6.504 0 002.79 2.472zM3.82 11a13.652 13.652 0 01-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A6.504 6.504 0 0013.464 12H11.91a9.27 9.27 0 01-.64 1.539 6.688 6.688 0 01-.597.933zM8.5 14.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5v2.923zm3.68-3.923c.174-.782.282-1.623.312-2.5H15c-.094.89-.323 1.733-.656 2.5h-2.163zM12.18 8.5c-.03-.877-.138-1.718-.312-2.5h2.158c.365.767.594 1.61.656 2.5H12.18zm-1.508-4.5h2.792a6.504 6.504 0 00-2.79-2.472c.218.284.418.598.597.933.226.423.424.896.59 1.539z"})}),e.jsx("span",{children:"Internet"})]})]}),a&&e.jsx(we,{initialPath:s.cwd||"",onSelect:t=>{d("cwd",t),f(!1)},onClose:()=>f(!1)}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xs text-cc-muted mb-2",children:"Triggers"}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{onClick:()=>d("webhookEnabled",!s.webhookEnabled),className:s.webhookEnabled?q:I,children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M8.543 2.232a.75.75 0 00-1.085 0l-5.25 5.5A.75.75 0 002.75 9H4v4a1 1 0 001 1h6a1 1 0 001-1V9h1.25a.75.75 0 00.543-1.268l-5.25-5.5z"})}),"Webhook"]}),e.jsxs("button",{onClick:()=>d("scheduleEnabled",!s.scheduleEnabled),className:s.scheduleEnabled?q:I,children:[e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:[e.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),e.jsx("path",{d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),"Schedule"]})]}),s.webhookEnabled&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsxs("p",{className:"text-[10px] text-cc-muted",children:["A unique URL will be generated after saving. POST to it with ",e.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-hover",children:'{"input": "..."}'}),"."]}),ue&&e.jsxs("p",{className:"text-[10px] text-cc-muted",children:["Base URL: ",e.jsx("span",{className:"font-mono-code",children:ue})]})]}),s.scheduleEnabled&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-cc-muted cursor-pointer",children:[e.jsx("input",{type:"radio",checked:s.scheduleRecurring,onChange:()=>d("scheduleRecurring",!0)}),"Recurring"]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-cc-muted cursor-pointer",children:[e.jsx("input",{type:"radio",checked:!s.scheduleRecurring,onChange:()=>d("scheduleRecurring",!1)}),"One-time"]})]}),s.scheduleRecurring?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex flex-wrap gap-1",children:ze.map(t=>e.jsx("button",{onClick:()=>d("scheduleExpression",t.value),className:`px-2 py-1 text-[10px] rounded-lg border transition-colors cursor-pointer ${s.scheduleExpression===t.value?"border-cc-primary text-cc-primary":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:t.label},t.value))}),e.jsx("input",{value:s.scheduleExpression,onChange:t=>d("scheduleExpression",t.target.value),placeholder:"Cron expression (e.g. 0 8 * * *)",className:"w-full px-3 py-2 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-sm font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"})]}):e.jsx("input",{type:"datetime-local",value:s.scheduleExpression,onChange:t=>d("scheduleExpression",t.target.value),className:"w-full px-3 py-2 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-sm focus:outline-none focus:ring-1 focus:ring-cc-primary"})]})]}),e.jsxs("section",{children:[e.jsxs("button",{onClick:()=>z(!w),className:"flex items-center gap-2 text-xs text-cc-muted cursor-pointer hover:text-cc-fg transition-colors w-full",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 transition-transform ${w?"rotate-90":""}`,children:e.jsx("path",{d:"M6 3l5 5-5 5V3z"})}),"Advanced",xe(s)>0&&e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded-full bg-cc-primary/15 text-cc-primary font-normal",children:xe(s)})]}),w&&e.jsxs("div",{className:"mt-4 space-y-6 pl-5 border-l-2 border-cc-border/30",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-medium text-cc-muted",children:"MCP Servers"}),e.jsx("button",{onClick:()=>m(!N),className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:N?"Cancel":"+ Add Server"})]}),Object.keys(s.mcpServers).length===0&&!N&&e.jsx("p",{className:"text-[10px] text-cc-muted",children:"No MCP servers configured."}),Object.entries(s.mcpServers).map(([t,r])=>e.jsxs("div",{className:"flex items-center justify-between py-1.5 px-2 rounded-lg bg-cc-hover/50 mb-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-cc-fg font-mono-code",children:t}),e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded bg-cc-border text-cc-muted",children:r.type})]}),e.jsx("button",{onClick:()=>ee(t),className:"text-cc-muted hover:text-cc-error transition-colors cursor-pointer p-0.5",title:"Remove server",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]},t)),N&&e.jsxs("div",{className:"rounded-lg border border-cc-border p-3 mt-2 space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] text-cc-muted mb-0.5",children:"Server Name"}),e.jsx("input",{value:k,onChange:t=>H(t.target.value),placeholder:"e.g., my-server",className:"w-full px-2 py-1.5 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-xs font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] text-cc-muted mb-0.5",children:"Type"}),e.jsx("div",{className:"flex rounded-lg border border-cc-border overflow-hidden",children:["stdio","sse","http"].map(t=>e.jsx("button",{onClick:()=>R(r=>({...r,type:t})),className:`flex-1 px-2 py-1 text-[10px] transition-colors cursor-pointer ${y.type===t?"bg-cc-primary text-white":"bg-cc-input-bg text-cc-muted hover:text-cc-fg"}`,children:t},t))})]}),y.type==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] text-cc-muted mb-0.5",children:"Command"}),e.jsx("input",{value:y.command,onChange:t=>R(r=>({...r,command:t.target.value})),placeholder:"e.g., npx -y @some/mcp-server",className:"w-full px-2 py-1.5 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-xs font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] text-cc-muted mb-0.5",children:"Args (space-separated)"}),e.jsx("input",{value:y.args,onChange:t=>R(r=>({...r,args:t.target.value})),placeholder:"--port 3000",className:"w-full px-2 py-1.5 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-xs font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"})]})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] text-cc-muted mb-0.5",children:"URL"}),e.jsx("input",{value:y.url,onChange:t=>R(r=>({...r,url:t.target.value})),placeholder:"https://example.com/mcp",className:"w-full px-2 py-1.5 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-xs font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"})]}),e.jsx("button",{onClick:C,disabled:!k.trim(),className:"px-3 py-1.5 text-xs rounded-lg bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed",children:"Add Server"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-medium text-cc-muted mb-2",children:"Skills"}),Q.length===0?e.jsx("p",{className:"text-[10px] text-cc-muted",children:"No skills found in ~/.claude/skills/"}):e.jsx("div",{className:"space-y-1.5",children:Q.map(t=>e.jsxs("label",{className:"flex items-start gap-2 text-sm text-cc-fg cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.skills.includes(t.slug),onChange:()=>te(t.slug),className:"rounded mt-0.5"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs",children:t.name}),t.description&&e.jsx("p",{className:"text-[10px] text-cc-muted",children:t.description})]})]},t.slug))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-medium text-cc-muted mb-2",children:"Allowed Tools"}),e.jsxs("div",{className:"space-y-2",children:[s.allowedTools.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.allowedTools.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-mono-code rounded-lg bg-cc-hover text-cc-fg",children:[t,e.jsx("button",{onClick:()=>ce(t),className:"text-cc-muted hover:text-cc-error transition-colors cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]},t))}),e.jsx("input",{value:T,onChange:t=>M(t.target.value),onKeyDown:se,placeholder:"Type tool name and press Enter",className:"w-full px-2 py-1.5 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-xs font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"}),e.jsx("p",{className:"text-[10px] text-cc-muted",children:"Leave empty to allow all tools."})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-medium text-cc-muted",children:"Environment Variables"}),e.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add Variable"})]}),s.env.length===0?e.jsx("p",{className:"text-[10px] text-cc-muted",children:"No extra variables set."}):e.jsx("div",{className:"space-y-1.5",children:s.env.map((t,r)=>e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("input",{value:t.key,onChange:A=>u(r,"key",A.target.value),placeholder:"KEY",className:"w-1/3 px-2 py-1.5 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-xs font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"}),e.jsx("input",{value:t.value,onChange:A=>u(r,"value",A.target.value),placeholder:"value",className:"flex-1 px-2 py-1.5 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-xs font-mono-code focus:outline-none focus:ring-1 focus:ring-cc-primary"}),e.jsx("button",{onClick:()=>j(r),className:"text-cc-muted hover:text-cc-error transition-colors cursor-pointer p-1",title:"Remove variable",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]},r))})]})]})]})]})]})})}const ge={all:"All",scheduled:"Scheduled",webhook:"Webhook"};function Ie({route:s}){const o=Ne(c=>c.publicUrl),[x,n]=l.useState([]),[h,S]=l.useState(!0),[p,v]=l.useState("list"),[g,b]=l.useState(null),[a,f]=l.useState(ne),[w,z]=l.useState(!1),[N,m]=l.useState(""),[k,H]=l.useState(null),[y,R]=l.useState(""),[Q,Z]=l.useState(null),[L,le]=l.useState("all"),T=l.useRef(null),M=l.useCallback(async()=>{try{const c=await E.listAgents();n(c)}catch{}finally{S(!1)}},[]);l.useEffect(()=>{M()},[M]),l.useEffect(()=>{if(s.page==="agent-detail"&&"agentId"in s){const c=x.find(i=>i.id===s.agentId);c&&$(c)}},[s,x]);function P(){b(null),f(ne),m(""),v("pick-template")}function V(c){b(null),f(c),m(""),v("edit")}function $(c){var i,u,j,C,ee,te,se,ce;b(c.id),f({name:c.name,description:c.description,icon:c.icon||"",backendType:c.backendType,model:c.model,permissionMode:c.permissionMode,cwd:c.cwd==="temp"?"":c.cwd,prompt:c.prompt,envSlug:c.envSlug||"",env:c.env?Object.entries(c.env).map(([D,K])=>({key:D,value:K})):[],codexInternetAccess:c.codexInternetAccess??!1,branch:c.branch||"",createBranch:c.createBranch??!1,useWorktree:c.useWorktree??!1,mcpServers:c.mcpServers||{},skills:c.skills||[],allowedTools:c.allowedTools||[],webhookEnabled:((u=(i=c.triggers)==null?void 0:i.webhook)==null?void 0:u.enabled)??!1,scheduleEnabled:((C=(j=c.triggers)==null?void 0:j.schedule)==null?void 0:C.enabled)??!1,scheduleExpression:((te=(ee=c.triggers)==null?void 0:ee.schedule)==null?void 0:te.expression)||"0 8 * * *",scheduleRecurring:((ce=(se=c.triggers)==null?void 0:se.schedule)==null?void 0:ce.recurring)??!0}),m(""),v("edit")}function O(){v("list"),b(null),m(""),window.location.hash="#/agents"}async function U(){z(!0),m("");try{const c={};for(const{key:u,value:j}of a.env)u.trim()&&(c[u.trim()]=j);const i={version:1,name:a.name,description:a.description,icon:a.icon||void 0,backendType:a.backendType,model:a.model,permissionMode:a.permissionMode,cwd:a.cwd||"temp",prompt:a.prompt,envSlug:a.envSlug||void 0,env:Object.keys(c).length>0?c:void 0,codexInternetAccess:a.backendType==="codex"?a.codexInternetAccess:void 0,branch:a.branch||void 0,createBranch:a.branch?a.createBranch:void 0,useWorktree:a.branch?a.useWorktree:void 0,mcpServers:Object.keys(a.mcpServers).length>0?a.mcpServers:void 0,skills:a.skills.length>0?a.skills:void 0,allowedTools:a.allowedTools.length>0?a.allowedTools:void 0,enabled:!0,triggers:{webhook:{enabled:a.webhookEnabled,secret:""},schedule:{enabled:a.scheduleEnabled,expression:a.scheduleExpression,recurring:a.scheduleRecurring}}};g?await E.updateAgent(g,i):await E.createAgent(i),await M(),v("list"),b(null),window.location.hash="#/agents"}catch(c){m(c instanceof Error?c.message:String(c))}finally{z(!1)}}async function B(c){if(confirm("Delete this agent?"))try{await E.deleteAgent(c),await M()}catch{}}async function oe(c){try{await E.toggleAgent(c),await M()}catch{}}async function W(c,i){try{await E.runAgent(c.id,i),H(null),R(""),await M()}catch{}}function X(c){c.prompt.includes("{{input}}")?(H(c),R("")):W(c)}async function F(c){try{const i=await E.exportAgent(c.id),u=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),j=URL.createObjectURL(u),C=document.createElement("a");C.href=j,C.download=`${c.id}.agent.json`,C.click(),URL.revokeObjectURL(j)}catch{}}async function _(c){var u;const i=(u=c.target.files)==null?void 0:u[0];if(i){try{const j=await i.text(),C=JSON.parse(j);await E.importAgent(C),await M()}catch(j){m(j instanceof Error?j.message:"Failed to import agent")}T.current&&(T.current.value="")}}function Y(c){const i=Me(c,o);navigator.clipboard.writeText(i).then(()=>{Z(c.id),setTimeout(()=>Z(null),2e3)})}async function J(c){if(confirm("Regenerate webhook secret? The old URL will stop working."))try{await E.regenerateAgentWebhookSecret(c),await M()}catch{}}if(p==="pick-template")return e.jsx(Te,{onSelect:V,onBlank:()=>{f(ne),v("edit")},onCancel:()=>v("list")});if(p==="edit")return e.jsx(Re,{form:a,setForm:f,editingId:g,publicUrl:o,error:N,saving:w,onSave:U,onCancel:O});const G={all:x.length,scheduled:x.filter(c=>{var i,u;return(u=(i=c.triggers)==null?void 0:i.schedule)==null?void 0:u.enabled}).length,webhook:x.filter(c=>{var i,u;return(u=(i=c.triggers)==null?void 0:i.webhook)==null?void 0:u.enabled}).length},d=x.filter(c=>{var i,u,j,C;switch(L){case"scheduled":return((u=(i=c.triggers)==null?void 0:i.schedule)==null?void 0:u.enabled)===!0;case"webhook":return((C=(j=c.triggers)==null?void 0:j.webhook)==null?void 0:C.enabled)===!0;default:return!0}});return e.jsxs("div",{className:"h-full overflow-y-auto bg-cc-bg",children:[e.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Agents"}),e.jsx("p",{className:"text-xs text-cc-muted mt-0.5",children:"Reusable autonomous session configs. Run manually, via webhook, or on a schedule."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:T,type:"file",accept:".json",onChange:_,className:"hidden"}),e.jsx("button",{onClick:()=>{var c;return(c=T.current)==null?void 0:c.click()},className:"px-3 py-1.5 text-xs rounded-lg border border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Import"}),e.jsx("button",{onClick:P,className:"px-3 py-1.5 text-xs rounded-lg bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:"+ New Agent"})]})]}),N&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/30 text-cc-error text-xs",children:N}),e.jsx(ke,{publicUrl:o}),!h&&x.length>0&&e.jsx("div",{className:"flex items-center gap-1 mb-4","data-testid":"filter-tabs",children:["all","scheduled","webhook"].map(c=>e.jsxs("button",{onClick:()=>le(c),className:`text-xs px-2.5 py-1 rounded-full transition-colors cursor-pointer ${L===c?"bg-cc-fg text-cc-bg":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:[ge[c]," (",G[c],")"]},c))}),h?e.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."}):x.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"mb-3 flex justify-center text-cc-muted",children:e.jsx(ae,{icon:"bot",className:"w-8 h-8"})}),e.jsx("p",{className:"text-sm text-cc-muted",children:"No agents yet"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Create an agent to get started, or import a shared JSON config."})]}):d.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsxs("p",{className:"text-sm text-cc-muted",children:["No ",ge[L].toLowerCase()," agents"]}),e.jsxs("p",{className:"text-xs text-cc-muted mt-1",children:[L==="scheduled"&&"Create an agent with a schedule trigger to see it here.",L==="webhook"&&"Create an agent with a webhook trigger to see it here."]})]}):e.jsx("div",{className:"space-y-3",children:d.map(c=>e.jsx(Ee,{agent:c,publicUrl:o,onEdit:()=>$(c),onDelete:()=>B(c.id),onToggle:()=>oe(c.id),onRun:()=>X(c),onExport:()=>F(c),onCopyWebhook:()=>Y(c),onRegenerateSecret:()=>J(c.id),copiedWebhook:Q},c.id))})]}),k&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>H(null),children:e.jsxs("div",{className:"bg-cc-card rounded-[14px] shadow-2xl p-6 w-full max-w-lg border border-cc-border",onClick:c=>c.stopPropagation(),children:[e.jsxs("h3",{className:"text-sm font-medium text-cc-fg mb-1",children:["Run ",k.name]}),e.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This agent's prompt uses ","{{input}}"," — provide the input below."]}),e.jsx("textarea",{value:y,onChange:c=>R(c.target.value),placeholder:"Enter input for the agent...",className:"w-full px-3 py-2 rounded-lg bg-cc-input-bg border border-cc-border text-cc-fg text-sm resize-none h-24 focus:outline-none focus:ring-1 focus:ring-cc-primary",autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-2 mt-3",children:[e.jsx("button",{onClick:()=>H(null),className:"px-3 py-1.5 text-xs rounded-lg border border-cc-border text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:()=>W(k,y),className:"px-3 py-1.5 text-xs rounded-lg bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:"Run"})]})]})})]})}const Le=[{name:"Coding Agent",icon:"code",description:"Develops features, fixes bugs, writes tests. Full file and terminal access.",color:"text-blue-400",form:{name:"Coding Agent",description:"Develops features, fixes bugs, writes tests",icon:"code",prompt:"You are a coding agent. Help the user with software development tasks: writing code, fixing bugs, refactoring, writing tests, and code reviews. Be thorough and follow best practices.",permissionMode:"acceptEdits"}},{name:"Monitoring Agent",icon:"activity",description:"Checks server health: CPU, RAM, disk, Docker, PM2. Great for cron schedules.",color:"text-green-400",form:{name:"Monitoring Agent",description:"Checks server health and reports issues",icon:"activity",prompt:"You are a monitoring agent. Check server health: CPU usage, RAM, disk space, running processes (PM2, Docker), and network status. Report any issues found. Be concise and actionable.",permissionMode:"plan"}},{name:"Content Agent",icon:"pen-tool",description:"Creates social media posts, generates images and videos via Gemini.",color:"text-pink-400",form:{name:"Content Agent",description:"Creates social media content, images, and videos",icon:"pen-tool",prompt:"You are a content creation agent. Help create social media posts, marketing copy, blog articles, and visual content. You can generate images with Imagen and videos with Veo. Be creative and on-brand."}},{name:"Research Agent",icon:"search",description:"Researches topics, summarizes findings, gathers competitive intelligence.",color:"text-purple-400",form:{name:"Research Agent",description:"Researches topics and summarizes findings",icon:"search",prompt:"You are a research agent. Help the user research topics thoroughly: gather information, analyze data, compare options, and provide well-structured summaries with sources. Be objective and comprehensive."}},{name:"DevOps Agent",icon:"server",description:"Manages deployments, CI/CD, Docker, Nginx, SSL certificates.",color:"text-orange-400",form:{name:"DevOps Agent",description:"Manages deployments, infrastructure, and CI/CD",icon:"server",prompt:"You are a DevOps agent. Help with server management, deployments, CI/CD pipelines, Docker, Nginx configuration, SSL certificates, and infrastructure automation. Prioritize security and reliability.",permissionMode:"acceptEdits"}},{name:"Data Agent",icon:"database",description:"Analyzes data, writes SQL queries, creates reports and visualizations.",color:"text-yellow-400",form:{name:"Data Agent",description:"Analyzes data and creates reports",icon:"database",prompt:"You are a data analysis agent. Help with SQL queries, data analysis, creating reports, and data visualization. Be precise with numbers and provide clear insights."}}];function Te({onSelect:s,onBlank:o,onCancel:x}){return e.jsx("div",{className:"h-full overflow-auto",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-6 py-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold text-cc-fg",children:"New Agent"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Start from a template or create from scratch."})]}),e.jsx("button",{onClick:x,className:"px-3 py-1.5 text-xs rounded-lg border border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Cancel"})]}),e.jsx("button",{onClick:o,className:"w-full mb-4 p-4 rounded-xl border-2 border-dashed border-cc-border hover:border-cc-primary/50 bg-cc-card hover:bg-cc-hover transition-colors text-left group",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-cc-hover flex items-center justify-center text-cc-muted group-hover:text-cc-fg",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-5 h-5",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-cc-fg",children:"Blank Agent"}),e.jsx("div",{className:"text-xs text-cc-muted",children:"Start with an empty configuration"})]})]})}),e.jsx("h2",{className:"text-xs font-semibold text-cc-muted uppercase tracking-wider mb-3",children:"Templates"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Le.map(n=>e.jsxs("button",{onClick:()=>s({...ne,...n.form}),className:"p-4 rounded-xl border border-cc-border bg-cc-card hover:bg-cc-hover hover:border-cc-primary/30 transition-colors text-left",children:[e.jsx("div",{className:`text-sm font-medium ${n.color}`,children:n.name}),e.jsx("div",{className:"text-xs text-cc-muted mt-1 line-clamp-2",children:n.description})]},n.name))})]})})}export{Ie as AgentsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as c,j as e,b as m}from"./index-CEqZnThB.js";const M={high:"text-red-400 bg-red-500/10 border-red-500/20",medium:"text-yellow-400 bg-yellow-500/10 border-yellow-500/20",low:"text-green-400 bg-green-500/10 border-green-500/20"};function z(o){const d=Date.now()-new Date(o).getTime(),n=Math.floor(d/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const l=Math.floor(n/60);if(l<24)return`${l}h ago`;const u=Math.floor(l/24);return u<7?`${u}d ago`:new Date(o).toLocaleDateString()}function V(o){return new Date(o).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function O(){const[o,d]=c.useState("todos"),[n,l]=c.useState(0);function u(){l(a=>a+1)}const h=[{id:"todos",label:"Todos"},{id:"notes",label:"Notes"},{id:"reminders",label:"Reminders"}];return e.jsxs("div",{className:"h-full flex flex-col bg-cc-bg overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 border-b border-cc-border px-4 sm:px-6 py-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Assistant"}),e.jsx("p",{className:"text-xs text-cc-muted mt-0.5",children:"Personal todos, notes & reminders — managed by Gemini Live"})]})}),e.jsx("div",{className:"flex gap-1 mt-3",children:h.map(a=>e.jsx("button",{type:"button",onClick:()=>d(a.id),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${o===a.id?"bg-cc-accent text-white":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:a.label},a.id))})]}),e.jsxs("div",{className:"flex-1 overflow-auto",children:[o==="todos"&&e.jsx(H,{refreshKey:n,onRefresh:u}),o==="notes"&&e.jsx(B,{refreshKey:n,onRefresh:u}),o==="reminders"&&e.jsx(P,{refreshKey:n,onRefresh:u})]})]})}function H({refreshKey:o,onRefresh:d}){const[n,l]=c.useState([]),[u,h]=c.useState(!0),[a,E]=c.useState("all"),[i,j]=c.useState(""),[b,p]=c.useState("medium"),[x,v]=c.useState(""),[S,y]=c.useState(!1),[T,g]=c.useState(null),[f,N]=c.useState(""),w=c.useCallback(async()=>{h(!0);try{const t={};a==="active"&&(t.done=!1),a==="done"&&(t.done=!0);const L=await m.listTodos(t);l(L.todos)}catch{}h(!1)},[a]);c.useEffect(()=>{w()},[w,o]);async function k(t){if(t.preventDefault(),!!i.trim()){y(!0);try{await m.addTodo({text:i.trim(),priority:b,category:x.trim()||void 0}),j(""),v(""),d()}catch{}y(!1)}}async function D(t){try{await m.updateTodo(t.id,{done:!t.done}),d()}catch{}}async function s(t){try{await m.deleteTodo(t),d()}catch{}}async function A(t){if(f.trim())try{await m.updateTodo(t,{text:f.trim()}),g(null),d()}catch{}}const r=n.filter(t=>!t.done),C=n.filter(t=>t.done),$=a==="all"?[...r,...C]:n;return e.jsxs("div",{className:"p-4 sm:p-6 space-y-4 max-w-3xl",children:[e.jsxs("form",{onSubmit:k,className:"flex flex-col sm:flex-row gap-2",children:[e.jsx("input",{type:"text",value:i,onChange:t=>j(t.target.value),placeholder:"Add a todo...",className:"flex-1 px-3 py-2 text-sm bg-cc-input border border-cc-border rounded-md text-cc-fg placeholder-cc-muted focus:outline-none focus:border-cc-accent"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{value:b,onChange:t=>p(t.target.value),className:"px-2 py-2 text-xs bg-cc-input border border-cc-border rounded-md text-cc-fg focus:outline-none cursor-pointer",children:[e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"low",children:"Low"})]}),e.jsx("input",{type:"text",value:x,onChange:t=>v(t.target.value),placeholder:"Category",className:"w-24 px-2 py-2 text-xs bg-cc-input border border-cc-border rounded-md text-cc-fg placeholder-cc-muted focus:outline-none"}),e.jsx("button",{type:"submit",disabled:S||!i.trim(),className:"px-4 py-2 text-xs font-medium rounded-md bg-cc-accent text-white hover:bg-cc-accent/80 disabled:opacity-50 cursor-pointer",children:"Add"})]})]}),e.jsx("div",{className:"flex gap-1",children:["all","active","done"].map(t=>e.jsx("button",{type:"button",onClick:()=>E(t),className:`px-2.5 py-1 text-xs rounded-md transition-colors cursor-pointer ${a===t?"bg-cc-hover text-cc-fg":"text-cc-muted hover:text-cc-fg"}`,children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),u?e.jsx("div",{className:"text-sm text-cc-muted py-8 text-center",children:"Loading..."}):$.length===0?e.jsx("div",{className:"text-sm text-cc-muted py-8 text-center",children:a==="done"?"No completed todos":a==="active"?"All done!":"No todos yet. Add one above or ask Gemini Live."}):e.jsx("div",{className:"space-y-1",children:$.map(t=>e.jsxs("div",{className:`group flex items-start gap-3 px-3 py-2.5 rounded-lg border transition-colors ${t.done?"bg-cc-bg border-cc-border/50 opacity-60":"bg-cc-card border-cc-border hover:border-cc-border-hover"}`,children:[e.jsx("button",{type:"button",onClick:()=>D(t),className:`mt-0.5 w-4 h-4 rounded border-2 shrink-0 flex items-center justify-center cursor-pointer transition-colors ${t.done?"bg-cc-accent border-cc-accent":"border-cc-muted hover:border-cc-accent"}`,children:t.done&&e.jsx("svg",{viewBox:"0 0 12 12",className:"w-2.5 h-2.5 text-white",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M2 6l3 3 5-5"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[T===t.id?e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:f,onChange:L=>N(L.target.value),onKeyDown:L=>{L.key==="Enter"&&A(t.id),L.key==="Escape"&&g(null)},className:"flex-1 px-2 py-1 text-sm bg-cc-input border border-cc-border rounded text-cc-fg focus:outline-none focus:border-cc-accent",autoFocus:!0}),e.jsx("button",{type:"button",onClick:()=>A(t.id),className:"text-xs text-cc-accent hover:underline cursor-pointer",children:"Save"}),e.jsx("button",{type:"button",onClick:()=>g(null),className:"text-xs text-cc-muted hover:underline cursor-pointer",children:"Cancel"})]}):e.jsx("span",{className:`text-sm ${t.done?"line-through text-cc-muted":"text-cc-fg"}`,onDoubleClick:()=>{g(t.id),N(t.text)},children:t.text}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border ${M[t.priority]}`,children:t.priority}),t.category&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-hover text-cc-muted",children:t.category}),e.jsx("span",{className:"text-[10px] text-cc-muted",children:z(t.createdAt)})]})]}),e.jsx("button",{type:"button",onClick:()=>s(t.id),className:"opacity-0 group-hover:opacity-100 text-cc-muted hover:text-red-400 transition-opacity cursor-pointer p-1",title:"Delete",children:e.jsxs("svg",{viewBox:"0 0 16 16",className:"w-3.5 h-3.5",fill:"currentColor",children:[e.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),e.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118z"})]})})]},t.id))})]})}function B({refreshKey:o,onRefresh:d}){const[n,l]=c.useState([]),[u,h]=c.useState(!0),[a,E]=c.useState(""),[i,j]=c.useState(null),[b,p]=c.useState(!1),[x,v]=c.useState(""),[S,y]=c.useState(""),[T,g]=c.useState(""),[f,N]=c.useState(!1),w=c.useCallback(async()=>{h(!0);try{const r=await m.listNotes(a||void 0);l(r.notes)}catch{}h(!1)},[a]);c.useEffect(()=>{w()},[w,o]);function k(){j(null),v(""),y(""),g(""),p(!0)}function D(r){j(r),v(r.title),y(r.content),g(r.tags.join(", ")),p(!0)}async function s(){if(!x.trim())return;N(!0);const r=T.split(",").map(C=>C.trim()).filter(Boolean);try{i?await m.updateNote(i.id,{title:x.trim(),content:S,tags:r}):await m.addNote({title:x.trim(),content:S,tags:r}),p(!1),d()}catch{}N(!1)}async function A(r){try{await m.deleteNote(r),(i==null?void 0:i.id)===r&&p(!1),d()}catch{}}return b?e.jsxs("div",{className:"p-4 sm:p-6 max-w-3xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{type:"button",onClick:()=>p(!1),className:"text-xs text-cc-muted hover:text-cc-fg cursor-pointer flex items-center gap-1",children:[e.jsx("svg",{viewBox:"0 0 16 16",className:"w-3 h-3",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M11.354 1.646a.5.5 0 010 .708L5.707 8l5.647 5.646a.5.5 0 01-.708.708l-6-6a.5.5 0 010-.708l6-6a.5.5 0 01.708 0z"})}),"Back"]}),e.jsx("span",{className:"text-xs text-cc-muted",children:i?"Edit Note":"New Note"})]}),e.jsx("input",{type:"text",value:x,onChange:r=>v(r.target.value),placeholder:"Title",className:"w-full px-3 py-2 text-sm bg-cc-input border border-cc-border rounded-md text-cc-fg placeholder-cc-muted focus:outline-none focus:border-cc-accent",autoFocus:!0}),e.jsx("textarea",{value:S,onChange:r=>y(r.target.value),placeholder:"Write your note...",rows:12,className:"w-full px-3 py-2 text-sm bg-cc-input border border-cc-border rounded-md text-cc-fg placeholder-cc-muted focus:outline-none focus:border-cc-accent resize-y font-mono"}),e.jsx("input",{type:"text",value:T,onChange:r=>g(r.target.value),placeholder:"Tags (comma separated)",className:"w-full px-2 py-1.5 text-xs bg-cc-input border border-cc-border rounded-md text-cc-fg placeholder-cc-muted focus:outline-none"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:s,disabled:f||!x.trim(),className:"px-4 py-2 text-xs font-medium rounded-md bg-cc-accent text-white hover:bg-cc-accent/80 disabled:opacity-50 cursor-pointer",children:f?"Saving...":"Save"}),e.jsx("button",{type:"button",onClick:()=>p(!1),className:"px-4 py-2 text-xs text-cc-muted hover:text-cc-fg rounded-md hover:bg-cc-hover cursor-pointer",children:"Cancel"})]})]}):e.jsxs("div",{className:"p-4 sm:p-6 space-y-4 max-w-3xl",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:a,onChange:r=>E(r.target.value),placeholder:"Search notes...",className:"flex-1 px-3 py-2 text-sm bg-cc-input border border-cc-border rounded-md text-cc-fg placeholder-cc-muted focus:outline-none focus:border-cc-accent"}),e.jsx("button",{type:"button",onClick:k,className:"px-4 py-2 text-xs font-medium rounded-md bg-cc-accent text-white hover:bg-cc-accent/80 cursor-pointer",children:"New Note"})]}),u?e.jsx("div",{className:"text-sm text-cc-muted py-8 text-center",children:"Loading..."}):n.length===0?e.jsx("div",{className:"text-sm text-cc-muted py-8 text-center",children:a?"No matching notes":"No notes yet. Create one or ask Gemini Live."}):e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:n.map(r=>e.jsxs("div",{className:"group p-4 rounded-lg border border-cc-border bg-cc-card hover:border-cc-border-hover transition-colors cursor-pointer",onClick:()=>D(r),children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-cc-fg truncate flex-1",children:r.title}),e.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),A(r.id)},className:"opacity-0 group-hover:opacity-100 text-cc-muted hover:text-red-400 transition-opacity cursor-pointer p-1 -mr-1 -mt-1",title:"Delete",children:e.jsx("svg",{viewBox:"0 0 16 16",className:"w-3 h-3",fill:"currentColor",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),r.content&&e.jsx("p",{className:"text-xs text-cc-muted mt-1 line-clamp-3",children:r.content}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[r.tags.map(C=>e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-hover text-cc-muted",children:C},C)),e.jsx("span",{className:"text-[10px] text-cc-muted ml-auto",children:z(r.updatedAt)})]})]},r.id))})]})}function P({refreshKey:o,onRefresh:d}){const[n,l]=c.useState([]),[u,h]=c.useState(!0),[a,E]=c.useState(!1),[i,j]=c.useState(""),[b,p]=c.useState(""),[x,v]=c.useState(""),[S,y]=c.useState(!1),T=c.useCallback(async()=>{h(!0);try{const s=await m.listReminders(a);l(s.reminders)}catch{}h(!1)},[a]);c.useEffect(()=>{T()},[T,o]);async function g(s){if(s.preventDefault(),!(!i.trim()||!b||!x)){y(!0);try{const A=new Date(`${b}T${x}`).toISOString();await m.addReminder({text:i.trim(),triggerAt:A}),j(""),p(""),v(""),d()}catch{}y(!1)}}async function f(s){try{await m.deleteReminder(s),d()}catch{}}const N=new Date,w=n.filter(s=>!s.fired&&new Date(s.triggerAt)>N),k=n.filter(s=>!s.fired&&new Date(s.triggerAt)<=N),D=n.filter(s=>s.fired);return e.jsxs("div",{className:"p-4 sm:p-6 space-y-4 max-w-3xl",children:[e.jsxs("form",{onSubmit:g,className:"flex flex-col sm:flex-row gap-2",children:[e.jsx("input",{type:"text",value:i,onChange:s=>j(s.target.value),placeholder:"Remind me to...",className:"flex-1 px-3 py-2 text-sm bg-cc-input border border-cc-border rounded-md text-cc-fg placeholder-cc-muted focus:outline-none focus:border-cc-accent"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"date",value:b,onChange:s=>p(s.target.value),className:"px-2 py-2 text-xs bg-cc-input border border-cc-border rounded-md text-cc-fg focus:outline-none"}),e.jsx("input",{type:"time",value:x,onChange:s=>v(s.target.value),className:"px-2 py-2 text-xs bg-cc-input border border-cc-border rounded-md text-cc-fg focus:outline-none"}),e.jsx("button",{type:"submit",disabled:S||!i.trim()||!b||!x,className:"px-4 py-2 text-xs font-medium rounded-md bg-cc-accent text-white hover:bg-cc-accent/80 disabled:opacity-50 cursor-pointer",children:"Add"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>E(!a),className:`text-xs cursor-pointer ${a?"text-cc-accent":"text-cc-muted hover:text-cc-fg"}`,children:a?"Hide fired":"Show all"})}),u?e.jsx("div",{className:"text-sm text-cc-muted py-8 text-center",children:"Loading..."}):n.length===0?e.jsx("div",{className:"text-sm text-cc-muted py-8 text-center",children:"No reminders yet. Add one above or ask Gemini Live."}):e.jsxs("div",{className:"space-y-4",children:[k.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-medium text-red-400 mb-2",children:"Overdue"}),e.jsx("div",{className:"space-y-1",children:k.map(s=>e.jsx(R,{reminder:s,onDelete:f,isOverdue:!0},s.id))})]}),w.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-medium text-cc-fg mb-2",children:"Upcoming"}),e.jsx("div",{className:"space-y-1",children:w.map(s=>e.jsx(R,{reminder:s,onDelete:f},s.id))})]}),a&&D.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-medium text-cc-muted mb-2",children:"Completed"}),e.jsx("div",{className:"space-y-1",children:D.map(s=>e.jsx(R,{reminder:s,onDelete:f,isFired:!0},s.id))})]})]})]})}function R({reminder:o,onDelete:d,isOverdue:n,isFired:l}){return e.jsxs("div",{className:`group flex items-center gap-3 px-3 py-2.5 rounded-lg border transition-colors ${l?"bg-cc-bg border-cc-border/50 opacity-60":n?"bg-red-500/5 border-red-500/20":"bg-cc-card border-cc-border hover:border-cc-border-hover"}`,children:[e.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${l?"bg-cc-muted":n?"bg-red-400 animate-pulse":"bg-cc-accent"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:`text-sm ${l?"line-through text-cc-muted":"text-cc-fg"}`,children:o.text}),e.jsx("div",{className:"text-[10px] text-cc-muted mt-0.5",children:V(o.triggerAt)})]}),e.jsx("button",{type:"button",onClick:()=>d(o.id),className:"opacity-0 group-hover:opacity-100 text-cc-muted hover:text-red-400 transition-opacity cursor-pointer p-1",title:"Delete",children:e.jsxs("svg",{viewBox:"0 0 16 16",className:"w-3.5 h-3.5",fill:"currentColor",children:[e.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),e.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118z"})]})})]})}export{O as AssistantPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,b as j,j as e,t as _,v as B,w as U,x as Y,F as q}from"./index-CEqZnThB.js";import{t as z}from"./time-ago-B6r_l9u1.js";function W(s,p,c=!0){a.useEffect(()=>{if(!c)return;function d(o){s.some(m=>m.current&&m.current.contains(o.target))||p()}return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[s,p,c])}function J(s){const p=s-Date.now();if(p<=0)return"now";const c=Math.floor(p/6e4);if(c<60)return`in ${c}m`;const d=Math.floor(c/60);return d<24?`in ${d}h`:`in ${Math.floor(d/24)}d`}function F(s,p){if(!p)return"One-time";const c=s.trim().split(/\s+/);if(c.length!==5)return s;const[d,o,g,m,x]=c;if(s==="* * * * *")return"Every minute";if(o==="*"&&g==="*"&&m==="*"&&x==="*"&&d.startsWith("*/")){const l=parseInt(d.slice(2),10);return l===1?"Every minute":`Every ${l} minutes`}if(d==="0"&&g==="*"&&m==="*"&&x==="*"){if(o==="*")return"Every hour";if(o.startsWith("*/")){const l=parseInt(o.slice(2),10);return l===1?"Every hour":`Every ${l} hours`}}if(g==="*"&&m==="*"&&d!=="*"&&o!=="*"&&!o.includes("/")&&!o.includes(",")){const l=parseInt(o,10),y=parseInt(d,10);if(!isNaN(l)&&!isNaN(y)){const u=l>=12?"PM":"AM",w=l===0?12:l>12?l-12:l,r=y.toString().padStart(2,"0"),v=`${w}:${r} ${u}`;if(x==="*")return`Every day at ${v}`;if(x==="1-5")return`Weekdays at ${v}`;if(x==="0,6")return`Weekends at ${v}`}}return s}const $={name:"",prompt:"",recurring:!0,schedule:"0 8 * * *",oneTimeDate:"",backendType:"claude",model:B("claude"),cwd:""},G=[{label:"Every hour",value:"0 * * * *"},{label:"Every day at 8am",value:"0 8 * * *"},{label:"Every 2 hours",value:"0 */2 * * *"},{label:"Weekdays at 9am",value:"0 9 * * 1-5"}];function ee({onClose:s,embedded:p=!1}){const[c,d]=a.useState([]),[o,g]=a.useState(!0),[m,x]=a.useState(""),[l,y]=a.useState(null),[u,w]=a.useState($),[r,v]=a.useState($),[h,M]=a.useState(!1),[f,S]=a.useState(!1),[k,E]=a.useState(new Set),n=a.useCallback(()=>{j.listCronJobs().then(d).catch(()=>{}).finally(()=>g(!1))},[]);a.useEffect(()=>{n();const t=setInterval(n,1e4);return()=>clearInterval(t)},[n]);async function C(){const t=r.name.trim(),i=r.prompt.trim();if(!t||!i)return;M(!0),x("");let N=r.schedule;!r.recurring&&r.oneTimeDate&&(N=new Date(r.oneTimeDate).toISOString());try{await j.createCronJob({name:t,prompt:i,schedule:N,recurring:r.recurring,backendType:r.backendType,model:r.model.trim()||void 0,cwd:r.cwd.trim()||void 0}),v($),S(!1),n()}catch(b){x(b instanceof Error?b.message:String(b))}finally{M(!1)}}function R(t){y(t.id),w({name:t.name,prompt:t.prompt,recurring:t.recurring,schedule:t.schedule,oneTimeDate:"",backendType:t.backendType,model:t.model,cwd:t.cwd}),x("")}function D(){y(null),x("")}async function L(){if(!l)return;const t=u.name.trim(),i=u.prompt.trim();if(!t||!i)return;let N=u.schedule;!u.recurring&&u.oneTimeDate&&(N=new Date(u.oneTimeDate).toISOString());try{await j.updateCronJob(l,{name:t,prompt:i,schedule:N,recurring:u.recurring,backendType:u.backendType,model:u.model.trim()||void 0,cwd:u.cwd.trim()||void 0}),y(null),x(""),n()}catch(b){x(b instanceof Error?b.message:String(b))}}async function A(t){try{await j.deleteCronJob(t),l===t&&y(null),n()}catch(i){x(i instanceof Error?i.message:String(i))}}async function I(t){try{await j.toggleCronJob(t),n()}catch(i){x(i instanceof Error?i.message:String(i))}}async function P(t){E(i=>new Set(i).add(t));try{await j.runCronJob(t),n()}catch(i){x(i instanceof Error?i.message:String(i))}finally{E(i=>{const N=new Set(i);return N.delete(t),N})}}if(p)return e.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Scheduled Tasks"}),e.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Run autonomous Claude Code or Codex sessions on a schedule."})]})}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[e.jsx("div",{className:"flex-1"}),e.jsxs("button",{onClick:()=>S(!f),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${f?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:f?e.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):e.jsx("path",{d:"M12 5v14M5 12h14"})}),e.jsx("span",{className:"hidden sm:inline",children:f?"Cancel":"New Task"})]})]}),f&&e.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[e.jsx(T,{form:r,onChange:v}),e.jsx("p",{className:"text-[10px] text-cc-muted",children:"Scheduled tasks run with full autonomy (bypassPermissions)"}),m&&f&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m}),e.jsx("div",{className:"flex items-center justify-end pt-1",children:e.jsx("button",{onClick:C,disabled:!r.name.trim()||!r.prompt.trim()||h,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${r.name.trim()&&r.prompt.trim()&&!h?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:h?"Creating...":"Create"})})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:[e.jsxs("span",{children:[c.length," task",c.length!==1?"s":""]}),c.filter(t=>t.enabled).length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:[c.filter(t=>t.enabled).length," active"]})]})]}),o?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading scheduled tasks..."}):c.length===0?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No scheduled tasks yet."}):e.jsx("div",{className:"space-y-1",children:c.map(t=>l===t.id?e.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[e.jsx(T,{form:u,onChange:w}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:D,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:()=>void L(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},t.id):e.jsx(K,{job:t,isRunning:k.has(t.id),onStartEdit:()=>R(t),onDelete:()=>void A(t.id),onToggle:()=>void I(t.id),onRunNow:()=>void P(t.id)},t.id))}),m&&!f&&e.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m})]})});const O=m&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m}),H=o?e.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading scheduled tasks..."}):c.length===0?e.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No scheduled tasks yet."}):e.jsx("div",{className:"space-y-3",children:c.map(t=>e.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1 truncate",children:t.name}),e.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${t.backendType==="codex"?"text-blue-500 bg-blue-500/10":"text-[#5BA8A0] bg-[#5BA8A0]/10"}`,children:t.backendType==="codex"?"Codex":"Claude"}),t.consecutiveFailures>0&&e.jsxs("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-error bg-cc-error/10",children:[t.consecutiveFailures," fail",t.consecutiveFailures!==1?"s":""]}),e.jsx("button",{onClick:()=>I(t.id),className:`relative w-10 h-6 rounded-full transition-colors cursor-pointer shrink-0 ${t.enabled?"bg-cc-primary":"bg-cc-border"}`,title:t.enabled?"Disable":"Enable",children:e.jsx("span",{className:`absolute top-[3px] w-[18px] h-[18px] rounded-full bg-white transition-transform ${t.enabled?"left-[19px]":"left-[3px]"}`})}),l===t.id?e.jsx("button",{onClick:D,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>P(t.id),disabled:k.has(t.id),className:`text-xs px-2 py-1.5 min-h-[44px] cursor-pointer ${k.has(t.id)?"text-cc-muted cursor-not-allowed":"text-cc-primary hover:text-cc-primary-hover"}`,children:k.has(t.id)?"Running...":"Run Now"}),e.jsx("button",{onClick:()=>R(t),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),e.jsx("button",{onClick:()=>A(t.id),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),l===t.id&&e.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[e.jsx(T,{form:u,onChange:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:L,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"}),e.jsx("button",{onClick:D,className:"px-3 py-2.5 min-h-[44px] text-sm font-medium text-cc-muted hover:text-cc-fg rounded-lg transition-colors cursor-pointer",children:"Cancel"})]})]}),l!==t.id&&e.jsxs("div",{className:"px-3 py-2.5 space-y-1.5",children:[e.jsx("div",{className:"text-xs text-cc-muted truncate",title:t.prompt,children:t.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-cc-muted",children:[e.jsx("span",{children:F(t.schedule,t.recurring)}),t.nextRunAt!=null&&t.enabled&&e.jsxs("span",{children:["Next: ",J(t.nextRunAt)]}),t.lastRunAt!=null&&e.jsxs("span",{className:"flex items-center gap-1",children:["Last: ",z(t.lastRunAt),t.consecutiveFailures===0?e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success",children:e.jsx("path",{d:"M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"})}):e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-error",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]}),t.totalRuns>0&&e.jsxs("span",{children:[t.totalRuns," run",t.totalRuns!==1?"s":""]}),t.cwd&&e.jsx("span",{className:"font-mono-code truncate max-w-[200px]",title:t.cwd,children:t.cwd})]})]})]},t.id))}),V=e.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[e.jsxs("button",{onClick:()=>S(!f),className:"w-full flex items-center gap-2 px-3 py-2.5 cursor-pointer hover:bg-cc-hover transition-colors",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`w-3 h-3 text-cc-muted transition-transform ${f?"rotate-90":""}`,children:e.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Scheduled Task"})]}),f&&e.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[e.jsx(T,{form:r,onChange:v}),e.jsx("div",{className:"text-[10px] text-cc-muted",children:"Scheduled tasks run with full autonomy (bypassPermissions)"}),e.jsx("button",{onClick:C,disabled:!r.name.trim()||!r.prompt.trim()||h,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${r.name.trim()&&r.prompt.trim()&&!h?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:h?"Creating...":"Create"})]})]}),Z=e.jsxs("div",{className:"w-full max-w-2xl max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Scheduled Tasks"}),e.jsx("p",{className:"text-xs text-cc-muted mt-0.5",children:"Run autonomous Claude Code or Codex sessions on a schedule"})]}),s&&e.jsx("button",{onClick:s,className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[O,H,V]})]});return _.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:s,children:Z}),document.body)}function K({job:s,isRunning:p,onStartEdit:c,onDelete:d,onToggle:o,onRunNow:g}){return e.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[e.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 6v6l4 2"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:s.name}),e.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${s.backendType==="codex"?"text-blue-500 bg-blue-500/10":"text-[#5BA8A0] bg-[#5BA8A0]/10"}`,children:s.backendType==="codex"?"Codex":"Claude"}),s.consecutiveFailures>0&&e.jsxs("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-error bg-cc-error/10",children:[s.consecutiveFailures," fail",s.consecutiveFailures!==1?"s":""]}),!s.enabled&&e.jsx("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-muted bg-cc-hover",children:"Paused"})]}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted line-clamp-1 leading-relaxed",children:s.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 mt-1 text-[11px] text-cc-muted",children:[e.jsx("span",{children:F(s.schedule,s.recurring)}),s.nextRunAt!=null&&s.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:["Next ",J(s.nextRunAt)]})]}),s.lastRunAt!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{className:"flex items-center gap-0.5",children:["Last ",z(s.lastRunAt),s.consecutiveFailures===0?e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-success",children:e.jsx("path",{d:"M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"})}):e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-error",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]})]}),s.totalRuns>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:[s.totalRuns," run",s.totalRuns!==1?"s":""]})]})]})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:o,className:`relative w-9 h-5 rounded-full transition-colors cursor-pointer shrink-0 ${s.enabled?"bg-cc-primary":"bg-cc-border"}`,title:s.enabled?"Disable":"Enable",children:e.jsx("span",{className:`absolute top-[2px] w-4 h-4 rounded-full bg-white transition-transform ${s.enabled?"left-[17px]":"left-[2px]"}`})}),e.jsx("button",{onClick:g,disabled:p,className:`p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md transition-colors cursor-pointer ${p?"text-cc-muted cursor-not-allowed":"text-cc-primary hover:bg-cc-primary/10"}`,"aria-label":"Run now",title:p?"Running...":"Run now",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M8 5v14l11-7z"})})}),e.jsx("button",{onClick:c,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),e.jsx("button",{onClick:d,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function T({form:s,onChange:p}){const c=n=>p({...s,...n}),[d,o]=a.useState(null),[g,m]=a.useState(!1),x=a.useRef(null),[l,y]=a.useState(!1),[u,w]=a.useState(!1),r=a.useRef(null),v=d||U(s.backendType),h=v.find(n=>n.value===s.model)||v[0];a.useEffect(()=>{o(null),s.backendType==="codex"&&j.getBackendModels(s.backendType).then(n=>{if(n.length>0){const C=Y(n);o(C),C.some(R=>R.value===s.model)||c({model:C[0].value})}}).catch(()=>{})},[s.backendType]),a.useEffect(()=>{s.model||c({model:B(s.backendType)})},[]);const M=a.useMemo(()=>[x],[]),f=a.useCallback(()=>m(!1),[]);W(M,f,g);const S=a.useMemo(()=>[r],[]),k=a.useCallback(()=>w(!1),[]);W(S,k,u);const E=s.cwd?s.cwd.split("/").pop()||s.cwd:"Select folder";return e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("input",{type:"text",value:s.name,onChange:n=>c({name:n.target.value}),placeholder:"Task name (e.g. Daily test suite)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsx("textarea",{value:s.prompt,onChange:n=>c({prompt:n.target.value}),placeholder:"Prompt for the session (e.g. Run the test suite and fix any failures)",rows:4,className:"w-full px-3 py-2.5 text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 resize-y transition-shadow",style:{minHeight:"100px"}}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c({recurring:!0}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-lg transition-colors cursor-pointer ${s.recurring?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:"Recurring"}),e.jsx("button",{onClick:()=>c({recurring:!1}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-lg transition-colors cursor-pointer ${s.recurring?"bg-cc-hover text-cc-muted hover:text-cc-fg":"bg-cc-primary text-white"}`,children:"One-time"})]}),s.recurring?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:G.map(n=>e.jsx("button",{onClick:()=>c({schedule:n.value}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-md transition-colors cursor-pointer ${s.schedule===n.value?"bg-cc-primary/20 text-cc-primary":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:n.label},n.value))}),e.jsx("input",{type:"text",value:s.schedule,onChange:n=>c({schedule:n.target.value}),placeholder:"Cron expression (e.g. 0 8 * * *)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsx("div",{className:"text-[10px] text-cc-muted",children:F(s.schedule,!0)})]}):e.jsx("input",{type:"datetime-local",value:s.oneTimeDate,onChange:n=>c({oneTimeDate:n.target.value}),className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("div",{className:"relative",ref:r,children:[e.jsxs("button",{onClick:()=>w(!u),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs font-medium text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("span",{children:s.backendType==="codex"?"Codex":"Claude Code"}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),u&&e.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card rounded-xl shadow-lg z-10 py-1",children:[{value:"claude",label:"Claude Code"},{value:"codex",label:"Codex"}].map(n=>e.jsx("button",{onClick:()=>{c({backendType:n.value,model:B(n.value)}),w(!1)},className:`w-full px-3 py-2.5 min-h-[44px] text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${n.value===s.backendType?"text-cc-primary font-medium":"text-cc-fg"}`,children:n.label},n.value))})]}),e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{onClick:()=>m(!g),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("span",{children:h==null?void 0:h.icon}),e.jsx("span",{children:h==null?void 0:h.label}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&e.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-52 bg-cc-card rounded-xl shadow-lg z-10 py-1",children:v.map(n=>e.jsxs("button",{onClick:()=>{c({model:n.value}),m(!1)},className:`w-full px-3 py-2.5 min-h-[44px] text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${n.value===s.model?"text-cc-primary font-medium":"text-cc-fg"}`,children:[e.jsx("span",{children:n.icon}),n.label]},n.value))})]}),e.jsxs("button",{onClick:()=>y(!0),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),e.jsx("span",{className:"max-w-[200px] truncate font-mono-code",children:E}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l&&e.jsx(q,{initialPath:s.cwd||"",onSelect:n=>c({cwd:n}),onClose:()=>y(!1)})]})]})}export{ee as CronManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as x}from"./index-CEqZnThB.js";function t({id:s,title:a,icon:r,children:c,defaultOpen:d=!1}){const[o,h]=x.useState(d);return e.jsxs("div",{id:s,className:"border border-cc-border rounded-xl overflow-hidden",children:[e.jsxs("button",{onClick:()=>h(!o),className:"w-full flex items-center gap-3 px-5 py-4 text-left hover:bg-cc-hover/50 transition-colors",children:[e.jsx("span",{className:"text-xl shrink-0",children:r}),e.jsx("span",{className:"text-sm font-semibold text-cc-fg flex-1",children:a}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-4 h-4 text-cc-muted transition-transform ${o?"rotate-180":""}`,children:e.jsx("path",{d:"M4.22 6.22a.75.75 0 011.06 0L8 8.94l2.72-2.72a.75.75 0 111.06 1.06l-3.25 3.25a.75.75 0 01-1.06 0L4.22 7.28a.75.75 0 010-1.06z"})})]}),o&&e.jsxs("div",{className:"px-5 pb-5 text-sm text-cc-muted leading-relaxed space-y-3 border-t border-cc-border/50",children:[e.jsx("div",{className:"pt-4"}),c]})]})}function l({children:s}){return e.jsx("kbd",{className:"inline-block px-1.5 py-0.5 rounded bg-cc-card border border-cc-border text-[11px] font-mono text-cc-fg",children:s})}function i({n:s,children:a}){return e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full bg-cc-primary/20 text-cc-primary text-xs font-bold flex items-center justify-center mt-0.5",children:s}),e.jsx("div",{className:"flex-1",children:a})]})}function n({children:s}){return e.jsx("code",{className:"text-xs bg-cc-card px-1 rounded",children:s})}function m(){const s=[{id:"overview",label:"Overview"},{id:"first-steps",label:"Getting Started"},{id:"gemini-live",label:"Gemini Live"},{id:"agents",label:"Agents"},{id:"sessions",label:"Sessions & Chat"},{id:"media",label:"Media Generation"},{id:"telephony",label:"Telephony"},{id:"federation",label:"Federation"},{id:"sidebar",label:"Sidebar & Navigation"},{id:"platform",label:"Platform Dashboard"},{id:"pwa",label:"PWA & Mobile"},{id:"keyboard",label:"Keyboard Shortcuts"},{id:"tailscale",label:"Tailscale Setup"},{id:"api",label:"API Reference"}];return e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(a=>e.jsx("a",{href:`#/help?s=${a.id}`,onClick:r=>{var c;r.preventDefault(),(c=document.getElementById(a.id))==null||c.scrollIntoView({behavior:"smooth",block:"start"})},className:"px-3 py-1.5 rounded-lg bg-cc-card border border-cc-border text-xs text-cc-muted hover:text-cc-fg hover:border-cc-primary/50 transition-colors",children:a.label},a.id))})}function p(){return e.jsx("div",{className:"h-full overflow-auto",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-6 py-8 space-y-6 pb-24",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-cc-fg",children:"HeyHank Help"}),e.jsx("p",{className:"text-sm text-cc-muted mt-1",children:"Self-hosted AI agent platform with voice assistant, telephony, media generation and multi-node federation."})]}),e.jsx(m,{}),e.jsxs(t,{id:"overview",title:"Overview",icon:"🏠",defaultOpen:!0,children:[e.jsx("p",{children:"HeyHank is your self-hosted AI agent platform. Create custom agents with any LLM backend, talk to them via Gemini Live voice, make phone calls through SIP, generate images and videos, and connect multiple HeyHank instances together."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Key Features"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 mt-1",children:[{name:"Custom Agents",desc:"Create unlimited agents",color:"text-blue-400"},{name:"Gemini Live",desc:"Voice assistant",color:"text-green-400"},{name:"Telephony",desc:"AI phone calls via SIP",color:"text-purple-400"},{name:"Media Gen",desc:"Images & videos",color:"text-pink-400"},{name:"Federation",desc:"Multi-node mesh",color:"text-yellow-400"},{name:"Multi-LLM",desc:"Claude, Gemini, Ollama",color:"text-orange-400"}].map(s=>e.jsxs("div",{className:"rounded-lg bg-cc-card p-3 border border-cc-border/50",children:[e.jsx("div",{className:`text-xs font-semibold ${s.color}`,children:s.name}),e.jsx("div",{className:"text-[11px] text-cc-muted mt-0.5",children:s.desc})]},s.name))}),e.jsxs("p",{className:"mt-2",children:[e.jsx("strong",{className:"text-cc-fg",children:"LLM Backends:"})," Claude Code CLI (Max subscription or API), Ollama (local, free), Gemini API, Codex CLI — configurable per agent."]})]}),e.jsxs(t,{id:"first-steps",title:"Getting Started",icon:"🚀",children:[e.jsx(i,{n:1,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Install"})," — ",e.jsx(n,{children:"npx heyhank"})," or ",e.jsx(n,{children:"bunx heyhank"}),". HeyHank starts on port 3100 by default."]})}),e.jsx(i,{n:2,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Log in"})," — Open the URL and enter the auth token shown in the terminal."]})}),e.jsx(i,{n:3,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Start a session"})," — Click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Session"})," in the sidebar. Choose a working directory and backend (Claude/Codex)."]})}),e.jsx(i,{n:4,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Chat"})," — Type your message and press ",e.jsx(l,{children:"Enter"}),". The agent responds with text, executes tools, and asks for permission when needed."]})}),e.jsx(i,{n:5,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Create an agent"})," — Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Agents"})," in the sidebar, click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Agent"}),". Give it a name, prompt, model, and working directory."]})}),e.jsx(i,{n:6,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Talk to Gemini"})," — Click the microphone button (bottom right) to start a voice conversation with Gemini Live. It can control your agents, make calls, and more."]})})]}),e.jsxs(t,{id:"gemini-live",title:"Gemini Live — Voice Assistant",icon:"🎙",children:[e.jsx("p",{children:"Gemini Live is your always-available voice interface. It uses Google's BidiGenerateContent API for real-time bidirectional audio streaming — you talk, it responds instantly with voice."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How to use"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click the ",e.jsx("strong",{className:"text-cc-fg",children:"microphone button"})," (floating, bottom right) to start."]}),e.jsxs("li",{children:["A draggable voice chat overlay appears. You can ",e.jsx("strong",{className:"text-cc-fg",children:"minimize"})," it (session stays alive) or ",e.jsx("strong",{className:"text-cc-fg",children:"close"})," it (ends session)."]}),e.jsx("li",{children:"Speak naturally — Gemini responds with voice in real-time."}),e.jsx("li",{children:"Drag the overlay anywhere on screen. On mobile, it stays accessible while you browse."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"What Gemini can do"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Run agents"}),' — "Start a coding agent on /my/project"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Send messages"}),' — "Tell session 3 to run the tests"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Create agents"}),' — "Create an agent called Monitor that checks server health"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Make phone calls"}),' — "Call +43 1 234 5678 and ask about the appointment" (requires SIP trunk)']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"List sessions"}),` — "What's running right now?"`]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Monitor agents"}),' — "What is the coding agent doing?"']})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Multimodal input"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Images"})," — Click the image icon to upload photos or documents for Gemini to analyze."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Camera"})," — Click the camera icon to stream your live camera feed. Gemini receives a frame every 2 seconds."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Videos"})," — Upload a video file; HeyHank extracts key frames and sends them to Gemini."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Requirements"}),e.jsxs("p",{children:["Requires a ",e.jsx(n,{children:"GEMINI_API_KEY"})," environment variable. Get one free at ",e.jsx("strong",{className:"text-cc-fg",children:"aistudio.google.com"}),"."]})]}),e.jsxs(t,{id:"agents",title:"Agents",icon:"🤖",children:[e.jsx("p",{children:"Agents are the core of HeyHank. Each agent is a configured AI session with its own name, system prompt, LLM model, working directory, and permission mode."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Create an agent"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Agents"})," in the sidebar."]}),e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Agent"}),"."]}),e.jsx("li",{children:"Configure: name, description, system prompt, model, backend, working directory."}),e.jsx("li",{children:"Optionally set triggers: cron schedule (e.g. run every hour) or webhook."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Run an agent"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"Run"})," on an agent card — starts a new session with the agent's prompt."]}),e.jsx("li",{children:"Some agents may ask for input before they start (configurable)."}),e.jsx("li",{children:'You can also ask Gemini Live: "Run the coding agent" or "Start monitor".'})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agent examples"}),e.jsx("div",{className:"space-y-1.5 mt-1",children:[{name:"Coding Agent",desc:"Develops features, fixes bugs, writes tests. Works in your project directory with full file and terminal access."},{name:"Monitoring Agent",desc:"Checks server health: CPU, RAM, disk, Docker, PM2. Runs on a cron schedule. Read-only mode recommended."},{name:"Content Agent",desc:"Creates social media posts, generates images with Imagen, produces videos with Veo."},{name:"Personal Agent",desc:"Email management, calendar, reminders. Connects via IMAP/SMTP."}].map(s=>e.jsxs("div",{className:"rounded-lg bg-cc-card p-3 border border-cc-border/50",children:[e.jsx("span",{className:"text-xs font-semibold text-cc-fg",children:s.name}),e.jsx("span",{className:"text-[11px] text-cc-muted ml-2",children:s.desc})]},s.name))}),e.jsx("p",{className:"text-[11px] mt-1",children:"These are just examples — create whatever agents you need for your workflow."})]}),e.jsxs(t,{id:"sessions",title:"Sessions & Chat",icon:"💬",children:[e.jsx("h4",{className:"font-semibold text-cc-fg",children:"Create a new session"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"+"})," in the sidebar or ",e.jsx("strong",{className:"text-cc-fg",children:"New Session"})," on the home page."]}),e.jsxs("li",{children:["Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"working directory"})," — this is where the agent operates."]}),e.jsxs("li",{children:["Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"backend"}),": Claude (recommended) or Codex."]}),e.jsxs("li",{children:["Choose the ",e.jsx("strong",{className:"text-cc-fg",children:"permission mode"}),": Accept Edits (default), Plan, Default."]}),e.jsxs("li",{children:["Optional: Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"git branch"})," as starting point."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"In the chat"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Composer"})," — Type a message, press ",e.jsx(l,{children:"Enter"})," to send."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"@-Mentions"})," — Type ",e.jsx(n,{children:"@"})," to reference files, folders or prompts."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"/Commands"})," — Type ",e.jsx(n,{children:"/"})," for available commands and skills."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Images"})," — Drag & drop or file upload in the composer."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Permission requests"})," — When the agent wants to use a tool, a yellow banner appears. Click Allow or Deny."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Streaming"})," — Responses are streamed in real time."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Session lifecycle"}),e.jsx("p",{children:"Sessions persist across page reloads and server restarts. Return to any session at any time — the full chat history is preserved."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Session tabs"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Chat"})," — The main conversation with the agent."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Diff"})," — Git changes the agent has made. Badge = changed file count."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Terminal"})," — Shell terminal within the session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Processes"})," — Running processes of the session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Editor"})," — File editor for direct editing."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Browser"})," — Embedded browser for web development."]})]})]}),e.jsxs(t,{id:"media",title:"Media Generation (Image & Video)",icon:"🎨",children:[e.jsx("p",{children:"Generate images and videos via Google AI APIs directly from agent sessions."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Image Generation (Imagen)"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Models: ",e.jsx(n,{children:"imagen-4.0-fast-generate-001"})," (fast), ",e.jsx(n,{children:"imagen-4.0-generate-001"})," (quality), ",e.jsx(n,{children:"imagen-4.0-ultra-generate-001"})]}),e.jsx("li",{children:"Aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4"}),e.jsx("li",{children:"Output: PNG file, saved and accessible via URL"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Video Generation (Veo)"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Models: ",e.jsx(n,{children:"veo-3.1-fast-generate-preview"})," (fast), ",e.jsx(n,{children:"veo-3.1-generate-preview"})," (best quality)"]}),e.jsx("li",{children:"Asynchronous generation — takes 1-3 minutes for a 5-8 second video."}),e.jsx("li",{children:"Output: MP4 file"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"View media"}),e.jsxs("p",{children:["All generated media is listed at ",e.jsx(n,{children:"/api/media"})," and can be opened directly in the browser."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Requirements"}),e.jsxs("p",{children:["Requires a ",e.jsx(n,{children:"GEMINI_API_KEY"})," with access to Imagen and Veo models."]})]}),e.jsxs(t,{id:"telephony",title:"Telephony — AI Phone Calls",icon:"📞",children:[e.jsx("p",{children:"HeyHank can make and receive phone calls using Gemini Live as the voice engine. Calls go through a SIP trunk connected to FreeSWITCH, with Gemini handling the conversation."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How it works"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"FreeSWITCH"})," handles the SIP connection to the phone network."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Gemini Live"})," acts as both speech-to-text, LLM, and text-to-speech — no separate STT/TTS services needed."]}),e.jsx("li",{children:"Audio is bridged in real-time: FreeSWITCH (8kHz PCM) is resampled to Gemini (16kHz) and back."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Setup"}),e.jsx(i,{n:1,children:e.jsx("p",{children:"Get a SIP trunk from a provider (e.g. peoplefone, sipgate, easybell)."})}),e.jsx(i,{n:2,children:e.jsxs("p",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Settings → Telephony"})," and add your SIP trunk credentials."]})}),e.jsx(i,{n:3,children:e.jsx("p",{children:"Start the FreeSWITCH Docker container (included in the HeyHank package)."})}),e.jsx(i,{n:4,children:e.jsx("p",{children:"Test the connection in Settings, then make calls via the Telephony page or Gemini voice command."})}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Making calls"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Telephony page"})," — Dial a number, describe the task, and start the call."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Gemini voice"}),' — "Call +43 1 234 5678 and ask about the delivery"']}),e.jsx("li",{children:"Live transcript is displayed in real-time during the call."}),e.jsx("li",{children:"Call history with summaries is saved automatically."})]})]}),e.jsxs(t,{id:"federation",title:"Federation — Multi-Node",icon:"🌐",children:[e.jsx("p",{children:"Connect multiple HeyHank instances together in a peer-to-peer mesh. Run HeyHank on your laptop, VPS, or both — all nodes see each other's sessions and agents."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How it works"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Each HeyHank instance is a ",e.jsx("strong",{className:"text-cc-fg",children:"node"})," with a unique ID."]}),e.jsx("li",{children:"Nodes connect to each other via WebSocket with shared-secret authentication."}),e.jsx("li",{children:"Sessions and agents are synced automatically — remote sessions appear in your sidebar with a node badge."}),e.jsx("li",{children:"Gemini on any node can see and control sessions across all connected nodes."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Setup"}),e.jsx(i,{n:1,children:e.jsxs("p",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Settings → Federation"})," on both nodes."]})}),e.jsx(i,{n:2,children:e.jsx("p",{children:"Copy the connection URL from Node B."})}),e.jsx(i,{n:3,children:e.jsxs("p",{children:["On Node A, click ",e.jsx("strong",{className:"text-cc-fg",children:"Add Node"})," and paste the URL + shared secret."]})}),e.jsx(i,{n:4,children:e.jsx("p",{children:"Both nodes now see each other's sessions. Gemini can control agents across both."})}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Offline handling"}),e.jsx("p",{children:"If a node goes offline, its sessions are marked as disconnected and disappear after 60 seconds. When the node comes back, auto-reconnect restores everything."})]}),e.jsxs(t,{id:"sidebar",title:"Sidebar — Navigation",icon:"📋",children:[e.jsx("p",{children:"The sidebar is your main navigation. On mobile, open it with the hamburger icon. On desktop, it's always visible."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Upper area: Sessions"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"+ Button"})," — Start a new chat session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Session list"})," — All active sessions, grouped by project. Click to open."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Right-click / 3-dots"})," — Rename, Archive, Delete."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Archived sessions"})," — Collapsible at the bottom, can be restored."]}),e.jsx("li",{children:"Status dots: green = connected, yellow = reconnecting, red = disconnected."}),e.jsx("li",{children:"Badge = open permission requests awaiting confirmation."}),e.jsx("li",{children:"Node badge = session is from a remote federated node."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Lower area: Pages"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Workbench:"})," Prompts, Integrations, Terminal"]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Workspace:"})," Environments, Agents, Telephony, Platform, Settings, Help"]})]})]}),e.jsxs(t,{id:"platform",title:"Platform Dashboard",icon:"📊",children:[e.jsx("p",{children:"The Platform page shows the overall state of your agent system."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Kill Switch"}),e.jsx("p",{children:"Emergency stop for all agents. Red KILL button stops everything immediately."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Cost Tracking"}),e.jsx("p",{children:"Total costs, token usage (in/out), and per-session cost breakdown with model info."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"LLM Providers"}),e.jsx("p",{children:"Status of all LLM backends: Claude, Gemini, Ollama, Codex. Green = available, yellow = needs API key."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agent Messages"}),e.jsx("p",{children:"Last 20 inter-agent messages — see how agents communicate with each other."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Shared Context"}),e.jsx("p",{children:"Shared knowledge files accessible by all agents. Click to read, edit to modify."})]}),e.jsxs(t,{id:"pwa",title:"PWA & Mobile",icon:"📱",children:[e.jsx("h4",{className:"font-semibold text-cc-fg",children:"Install as app"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"iPhone/iPad:"}),' Safari → Share → "Add to Home Screen"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Android:"}),' Chrome → Menu → "Install app"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Desktop:"})," Chrome/Edge → Address bar → Install icon"]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Push Notifications"}),e.jsx("p",{children:"HeyHank can send push notifications for agent alerts and monitoring warnings. Enable on first visit when the browser asks for permission."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Mobile tips"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsx("li",{children:"The Gemini Live voice overlay is draggable and collapsible — works well on small screens."}),e.jsx("li",{children:"Use the camera icon in voice chat to stream your phone camera to Gemini."}),e.jsx("li",{children:"The PWA caches static assets for fast loading. Agent interaction requires a connection."})]})]}),e.jsx(t,{id:"keyboard",title:"Keyboard Shortcuts",icon:"⌨",children:e.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-2",children:[e.jsx(l,{children:"Enter"}),e.jsx("span",{children:"Send message"}),e.jsx(l,{children:"Shift+Enter"}),e.jsx("span",{children:"New line in composer"}),e.jsx(l,{children:"Escape"}),e.jsx("span",{children:"Deny permission request / Interrupt"}),e.jsx(l,{children:"@"}),e.jsx("span",{children:"Reference file/folder/prompt"}),e.jsx(l,{children:"/"}),e.jsx("span",{children:"Commands and skills"}),e.jsx(l,{children:"Ctrl+`"}),e.jsx("span",{children:"Open/close quick terminal"})]})}),e.jsxs(t,{id:"tailscale",title:"Tailscale Setup",icon:"🌐",children:[e.jsx("p",{children:"Tailscale Funnel gives HeyHank a public HTTPS URL without port forwarding, firewall changes, or a reverse proxy. It works by routing traffic through Tailscale's network to your machine."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"1. Install Tailscale"}),e.jsxs("p",{children:["Download from ",e.jsx("a",{href:"https://tailscale.com/download",target:"_blank",rel:"noopener",className:"text-cc-accent hover:underline",children:"tailscale.com/download"})," or install via CLI:"]}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"curl -fsSL https://tailscale.com/install.sh | sh"}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"2. Connect to your Tailnet"}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"tailscale up"}),e.jsxs("p",{className:"mt-1",children:["Follow the login URL to authenticate. Your machine will get a DNS name like ",e.jsx(n,{children:"machine.tail1234.ts.net"}),"."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"3. Enable Funnel"}),e.jsxs("p",{children:["HeyHank manages Funnel automatically. Go to ",e.jsx("strong",{children:"Settings"})," and click ",e.jsx("strong",{children:"Enable Tailscale Funnel"}),". This exposes HeyHank over HTTPS at your Tailscale DNS name."]}),e.jsx("p",{className:"mt-1",children:"You can also enable it manually:"}),e.jsxs("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:["tailscale funnel --bg ","{port}"]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"4. Linux: Operator Mode"}),e.jsx("p",{children:"If running HeyHank as a non-root user on Linux, you need to set operator mode so HeyHank can manage Funnel without sudo:"}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"sudo tailscale set --operator=$USER"}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Troubleshooting"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"DNS not propagated:"})," After enabling Funnel, DNS may take a few minutes to propagate. HeyHank will show a warning until resolution succeeds."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Operator mode needed:"})," On Linux, if you see permission errors, run ",e.jsx(n,{children:"sudo tailscale set --operator=$USER"})," and restart HeyHank."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Binary not found:"})," Ensure ",e.jsx(n,{children:"tailscale"})," is on your PATH. HeyHank checks for it automatically on startup."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Funnel not working:"})," Make sure Funnel is enabled in your Tailscale admin console under the DNS tab (Access Controls)."]})]})]}),e.jsxs(t,{id:"api",title:"API Reference",icon:"🔧",children:[e.jsxs("p",{children:["All endpoints are available under ",e.jsx(n,{children:"/api/"}),". Authentication via bearer token."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Sessions"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/sessions — List all sessions"}),e.jsx("p",{children:"POST /api/sessions — Create new session"}),e.jsx("p",{children:"DELETE /api/sessions/:id — Delete session"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agents"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/agents — List all agents"}),e.jsx("p",{children:"POST /api/agents — Create agent"}),e.jsx("p",{children:"PUT /api/agents/:id — Update agent"}),e.jsx("p",{children:"DELETE /api/agents/:id — Delete agent"}),e.jsx("p",{children:"POST /api/agents/:id/run — Run agent"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Media"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"POST /api/media/generate-image — Generate image"}),e.jsx("p",{children:"POST /api/media/generate-video — Generate video"}),e.jsx("p",{children:"GET /api/media — List all media"}),e.jsx("p",{children:"GET /api/media/file/:filename — Get media file"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Telephony"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"POST /api/telephony/calls — Start a call"}),e.jsx("p",{children:"GET /api/telephony/calls — Active calls"}),e.jsx("p",{children:"DELETE /api/telephony/calls/:id — End call"}),e.jsx("p",{children:"GET /api/telephony/history — Call history"}),e.jsx("p",{children:"GET/PUT /api/telephony/settings — Telephony settings"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Federation"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/federation/identity — This node's identity"}),e.jsx("p",{children:"GET /api/federation/nodes — Connected nodes"}),e.jsx("p",{children:"POST /api/federation/nodes — Add node"}),e.jsx("p",{children:"DELETE /api/federation/nodes/:id — Remove node"}),e.jsx("p",{children:"GET /api/federation/remote-sessions — Sessions from other nodes"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Platform"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/costs/summary — Cost summary"}),e.jsx("p",{children:"GET/POST /api/kill-switch — Kill switch"}),e.jsx("p",{children:"GET /api/llm/providers — LLM provider status"}),e.jsx("p",{children:"GET /api/shared-context — Shared context files"}),e.jsx("p",{children:"POST /api/llm/chat — Direct LLM call"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Gemini"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /gemini/config — Voice assistant config + active sessions"}),e.jsx("p",{children:"POST /gemini/tool-call — Execute a Gemini tool call"})]})]}),e.jsxs("div",{className:"text-center text-xs text-cc-muted pt-4 pb-8 space-y-1",children:[e.jsx("p",{children:"HeyHank — Self-hosted AI Agent Platform"}),e.jsxs("p",{children:["Bugs or feature requests?"," ",e.jsx("a",{href:"https://github.com/heyhank-app/heyhank/issues",target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:"Open an issue on GitHub"})]})]})]})})}export{p as HelpPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,j as e,u as le,n as de,a as xe,b as Y}from"./index-CEqZnThB.js";const Z={browser:"Browser",search:"Search",productivity:"Productivity",development:"Development",database:"Database",communication:"Communication",ai:"AI",other:"Other"};function me(){const[l,t]=a.useState([]),[b,C]=a.useState([]),[A,f]=a.useState(!0),[d,x]=a.useState(""),[u,h]=a.useState(!1),[j,v]=a.useState(!1),[g,y]=a.useState("all"),[o,_]=a.useState(null),[Q,M]=a.useState(null),[$,B]=a.useState(null),[k,D]=a.useState({}),[L,O]=a.useState(null),[S,T]=a.useState(""),[W,V]=a.useState(""),[N,R]=a.useState("stdio"),[E,q]=a.useState(""),[P,G]=a.useState(""),[I,H]=a.useState(""),[U,z]=a.useState(!1),X=async()=>{try{const[r,c]=await Promise.all([fetch("/api/mcp/servers").then(s=>s.ok?s.json():{servers:[]}).catch(()=>({servers:[]})),fetch("/api/mcp/catalog").then(s=>s.ok?s.json():{catalog:[]}).catch(()=>({catalog:[]}))]);t(r.servers||[]),C(c.catalog||[])}catch(r){x(r instanceof Error?r.message:String(r))}finally{f(!1)}};a.useEffect(()=>{X()},[]);const ee=async r=>{try{const c=await fetch(`/api/mcp/servers/${r}/toggle`,{method:"POST"});if(!c.ok)throw new Error("Toggle failed");const s=await c.json();t(n=>n.map(i=>i.id===r?{...i,...s}:i))}catch(c){x(c instanceof Error?c.message:String(c))}},re=async r=>{try{if(!(await fetch(`/api/mcp/servers/${r}`,{method:"DELETE"})).ok)throw new Error("Delete failed");t(s=>s.filter(n=>n.id!==r)),M(null)}catch(c){x(c instanceof Error?c.message:String(c))}},te=async r=>{var c;B(r);try{const s=await fetch("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({catalogId:r})});if(!s.ok)throw new Error("Installation failed");const n=await s.json();t(i=>[...i,n]),(c=n.requiresAuth)!=null&&c.length&&(_(n.id),h(!1))}catch(s){x(s instanceof Error?s.message:String(s))}finally{B(null)}},se=async()=>{if(S.trim()){z(!0);try{const r={name:S.trim(),description:W.trim(),type:N};N==="stdio"?(r.command=E.trim(),r.args=P.trim()?P.trim().split(/\s+/):[]):r.url=I.trim();const c=await fetch("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!c.ok)throw new Error("Installation failed");const s=await c.json();t(n=>[...n,s]),v(!1),T(""),V(""),q(""),G(""),H(""),R("stdio")}catch(r){x(r instanceof Error?r.message:String(r))}finally{z(!1)}}},ce=async r=>{const c=k[r];if(c){O(r);try{const s=await fetch(`/api/mcp/servers/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({authValues:c})});if(!s.ok)throw new Error("Save failed");const n=await s.json();t(i=>i.map(m=>m.id===r?{...m,...n}:m)),D(i=>{const m={...i};return delete m[r],m})}catch(s){x(s instanceof Error?s.message:String(s))}finally{O(null)}}},ae=r=>{var c;return((c=r.requiresAuth)==null?void 0:c.length)&&(!r.authValues||r.requiresAuth.some(s=>{var n;return!((n=r.authValues)!=null&&n[s.field])}))},ne=Array.from(new Set(b.map(r=>r.category))).sort(),F=g==="all"?b:b.filter(r=>r.category===g),oe=new Set(l.map(r=>r.name)),K=r=>r==="stdio"?"border-blue-500/30 bg-blue-500/10 text-blue-400":r==="http"?"border-purple-500/30 bg-purple-500/10 text-purple-400":"border-amber-500/30 bg-amber-500/10 text-amber-400";return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 2v6m0 8v6M4.93 4.93l4.24 4.24m5.66 5.66l4.24 4.24M2 12h6m8 0h6M4.93 19.07l4.24-4.24m5.66-5.66l4.24-4.24"})}),e.jsx("span",{children:"MCP Server"}),e.jsx(p,{active:l.some(r=>r.enabled)})]})}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Model Context Protocol"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"MCP servers give agents access to external tools (GitHub, Playwright, Slack, etc.)."}),d&&e.jsxs("div",{className:"mt-3 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:[d,e.jsx("button",{onClick:()=>x(""),className:"ml-2 underline cursor-pointer",children:"OK"})]}),e.jsx("div",{className:"mt-4 space-y-2",children:A?e.jsx("div",{className:"py-4 text-center text-xs text-cc-muted animate-pulse",children:"Loading MCP servers..."}):l.length===0?e.jsx("div",{className:"py-3 text-center text-xs text-cc-muted border border-dashed border-cc-border rounded-lg",children:"No MCP servers installed"}):l.map(r=>{var c;return e.jsxs("div",{className:"rounded-xl border border-cc-border/70 bg-cc-bg/60 overflow-hidden transition-colors hover:border-cc-border",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-2.5",children:[e.jsx("button",{onClick:()=>_(o===r.id?null:r.id),className:"shrink-0 text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Details",children:e.jsx("svg",{className:`h-3.5 w-3.5 transition-transform ${o===r.id?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:r.name}),e.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider border ${K(r.type)}`,children:r.type}),ae(r)&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] border border-amber-500/30 bg-amber-500/10 text-amber-400",children:[e.jsxs("svg",{className:"h-2.5 w-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",x2:"12",y1:"9",y2:"13"}),e.jsx("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})]}),"Credentials missing"]})]}),r.description&&e.jsx("p",{className:"text-xs text-cc-muted truncate mt-0.5",children:r.description})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>ee(r.id),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors cursor-pointer ${r.enabled?"bg-cc-success":"bg-cc-muted/30"}`,title:r.enabled?"Disable":"Enable",children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${r.enabled?"translate-x-4":"translate-x-0.5"}`})}),Q===r.id?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>re(r.id),className:"px-2 py-1 text-[10px] rounded bg-cc-error/20 text-cc-error border border-cc-error/30 hover:bg-cc-error/30 cursor-pointer",children:"Yes, delete"}),e.jsx("button",{onClick:()=>M(null),className:"px-2 py-1 text-[10px] rounded bg-cc-hover text-cc-muted border border-cc-border hover:text-cc-fg cursor-pointer",children:"No"})]}):e.jsx("button",{onClick:()=>M(r.id),className:"inline-flex h-7 w-7 items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer",title:"Delete",children:e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),o===r.id&&e.jsxs("div",{className:"border-t border-cc-border/50 bg-cc-bg/40 px-3.5 py-3 space-y-3",children:[e.jsxs("div",{className:"text-xs text-cc-muted space-y-1",children:[r.command&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"Command:"})," ",e.jsxs("code",{className:"bg-black/20 px-1.5 py-0.5 rounded text-[11px]",children:[r.command," ",(c=r.args)==null?void 0:c.join(" ")]})]}),r.url&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"URL:"})," ",e.jsx("code",{className:"bg-black/20 px-1.5 py-0.5 rounded text-[11px]",children:r.url})]}),r.assignedAgents.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"Assigned agents:"})," ",r.assignedAgents.join(", ")]})]}),r.requiresAuth&&r.requiresAuth.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-cc-fg/80",children:"Credentials"}),r.requiresAuth.map(s=>{var i,m;const n=((i=k[r.id])==null?void 0:i[s.field])??((m=r.authValues)==null?void 0:m[s.field])??"";return e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:s.label}),e.jsx("input",{type:"password",value:n,placeholder:s.helpText,onChange:ie=>D(J=>({...J,[r.id]:{...J[r.id]||{},[s.field]:ie.target.value}})),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50"})]},s.field)}),k[r.id]&&Object.keys(k[r.id]).length>0&&e.jsx("button",{onClick:()=>ce(r.id),disabled:L===r.id,className:"px-3 py-1.5 text-xs rounded-lg bg-cc-primary/20 text-cc-primary border border-cc-primary/30 hover:bg-cc-primary/30 transition-colors cursor-pointer disabled:opacity-50",children:L===r.id?"Saving...":"Save credentials"})]})]})]},r.id)})}),e.jsxs("div",{className:"mt-4 flex gap-2 flex-wrap",children:[e.jsxs("button",{onClick:()=>{h(!u),v(!1)},className:"inline-flex items-center gap-1.5 px-3.5 py-2 text-xs font-medium rounded-lg border border-cc-primary/30 bg-cc-primary/12 text-cc-fg hover:bg-cc-primary/20 hover:border-cc-primary/50 transition-colors cursor-pointer",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",x2:"12",y1:"5",y2:"19"}),e.jsx("line",{x1:"5",x2:"19",y1:"12",y2:"12"})]}),u?"Close catalog":"Add MCP server"]}),e.jsxs("button",{onClick:()=>{v(!j),h(!1)},className:"inline-flex items-center gap-1.5 px-3.5 py-2 text-xs rounded-lg border border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),j?"Cancel":"Custom server"]})]}),j&&e.jsxs("div",{className:"mt-3 rounded-xl border border-cc-border/70 bg-cc-bg/60 p-4 space-y-3",children:[e.jsx("div",{className:"text-sm font-medium text-cc-fg",children:"Add custom MCP server"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Name *"}),e.jsx("input",{value:S,onChange:r=>T(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"e.g. my-mcp-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Type"}),e.jsxs("select",{value:N,onChange:r=>R(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg focus:outline-none focus:border-cc-primary/50 cursor-pointer",children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"http",children:"http"}),e.jsx("option",{value:"sse",children:"sse"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Description"}),e.jsx("input",{value:W,onChange:r=>V(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"What does this server do?"})]}),N==="stdio"?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Command *"}),e.jsx("input",{value:E,onChange:r=>q(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"npx / bun / python"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Arguments"}),e.jsx("input",{value:P,onChange:r=>G(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"-y @some/package"})]})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"URL *"}),e.jsx("input",{value:I,onChange:r=>H(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"https://..."})]}),e.jsx("button",{onClick:se,disabled:U||!S.trim()||(N==="stdio"?!E.trim():!I.trim()),className:"px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary/20 text-cc-primary border border-cc-primary/30 hover:bg-cc-primary/30 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:U?"Installing...":"Add server"})]}),u&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx("button",{onClick:()=>y("all"),className:`px-2.5 py-1 text-[11px] rounded-lg border transition-colors cursor-pointer ${g==="all"?"border-cc-primary/40 bg-cc-primary/15 text-cc-fg":"border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:"All"}),ne.map(r=>e.jsx("button",{onClick:()=>y(r),className:`px-2.5 py-1 text-[11px] rounded-lg border transition-colors cursor-pointer ${g===r?"border-cc-primary/40 bg-cc-primary/15 text-cc-fg":"border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:Z[r]||r},r))]}),F.length===0?e.jsx("div",{className:"py-4 text-center text-xs text-cc-muted",children:"No catalog entries found."}):e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:F.map(r=>{var s;const c=oe.has(r.name);return e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-cc-border/70 bg-cc-bg/60 p-3 transition-colors hover:border-cc-border",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:r.name}),e.jsx("span",{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider border ${K(r.type)}`,children:r.type}),e.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] border border-cc-border bg-cc-hover/50 text-cc-muted",children:Z[r.category]||r.category})]}),e.jsx("p",{className:"text-xs text-cc-muted mt-1 line-clamp-2",children:r.description}),(s=r.requiresAuth)!=null&&s.length?e.jsx("p",{className:"text-[10px] text-amber-400 mt-1",children:"Requires credentials"}):null]}),e.jsx("button",{onClick:()=>!c&&te(r.id),disabled:c||$===r.id,className:`shrink-0 px-3 py-1.5 text-xs rounded-lg border transition-colors cursor-pointer disabled:cursor-not-allowed ${c?"border-cc-success/30 bg-cc-success/10 text-cc-success disabled:opacity-70":"border-cc-primary/30 bg-cc-primary/12 text-cc-primary hover:bg-cc-primary/25 disabled:opacity-50"}`,children:$===r.id?"...":c?"Installed":"Install"})]},r.id)})})]})]})}function p({active:l}){return l?e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Active"}):e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-muted/40","aria-label":"Not configured"})}function w({section:l}){return e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/settings",requestAnimationFrame(()=>{setTimeout(()=>{var t;(t=document.getElementById(l))==null||t.scrollIntoView({behavior:"smooth",block:"start"})},100)})},"aria-label":"Open settings",title:"Configure",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})}function ue({embedded:l=!1}){const[t,b]=a.useState(null),[C,A]=a.useState("");return a.useEffect(()=>{(async()=>{try{const[d,x,u,h,j]=await Promise.all([Y.getSettings(),Y.listAgents(),fetch("/api/email-accounts").then(o=>o.ok?o.json():[]).catch(()=>[]),fetch("/api/calendar-accounts").then(o=>o.ok?o.json():[]).catch(()=>[]),fetch("/api/mcp/plugins").then(o=>o.ok?o.json():{plugins:[]}).catch(()=>({plugins:[]}))]),v=Array.isArray(u)?u.length:0,g=Array.isArray(h)?h.length:0;let y=0;try{const o=await fetch("/api/push/status");o.ok&&(y=(await o.json()).subscriptions??0)}catch{}b({emailAccounts:v,calendarAccounts:g,geminiConfigured:!!d.geminiApiKeyConfigured,pushSubscriptions:y,claudeAuth:!!d.claudeCliAuth,codexAuth:!!d.codexCliAuth,agents:x.length,mcpPlugins:j.plugins||[]})}catch(d){A(d instanceof Error?d.message:String(d))}})()},[]),e.jsx("div",{className:`${l?"h-full":"h-[100dvh]"} bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto`,children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-cc-fg",children:"Integrations"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Connected services and their status."})]}),!l&&e.jsx("button",{onClick:()=>{const f=le.getState().currentSessionId;f?de(f):xe()},className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Back"})]}),C&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:C}),e.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(59,130,246,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v4a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),e.jsx("path",{d:"M19 10v1a7 7 0 0 1-14 0v-1"}),e.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),e.jsx("span",{children:"Gemini Live"}),e.jsx(p,{active:(t==null?void 0:t.geminiConfigured)??!1})]}),e.jsx(w,{section:"gemini"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Voice Assistant"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Real-time voice control with Google Gemini. Controls agents, calendar, emails and todos by voice."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:t!=null&&t.geminiConfigured?"API key configured":"Not configured"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(251,146,60,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),e.jsx("span",{children:"Email"}),e.jsx(p,{active:((t==null?void 0:t.emailAccounts)??0)>0})]}),e.jsx(w,{section:"email"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"IMAP/SMTP Email"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Email accounts via IMAP/SMTP. Gemini can read, search, send and summarize emails."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.emailAccounts)??0)>0?`${t.emailAccounts} account${t.emailAccounts>1?"s":""} connected`:"No accounts"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(34,197,94,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("line",{x1:"16",x2:"16",y1:"2",y2:"6"}),e.jsx("line",{x1:"8",x2:"8",y1:"2",y2:"6"}),e.jsx("line",{x1:"3",x2:"21",y1:"10",y2:"10"})]}),e.jsx("span",{children:"Calendar"}),e.jsx(p,{active:((t==null?void 0:t.calendarAccounts)??0)>0})]}),e.jsx(w,{section:"calendar"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"CalDAV Calendar"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Google Calendar, iCloud, Outlook via CalDAV. View, create and manage events."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.calendarAccounts)??0)>0?`${t.calendarAccounts} account${t.calendarAccounts>1?"s":""} connected`:"No accounts"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(168,85,247,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),e.jsx("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]}),e.jsx("span",{children:"Push Notifications"}),e.jsx(p,{active:((t==null?void 0:t.pushSubscriptions)??0)>0})]}),e.jsx(w,{section:"notifications"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Agent Alerts"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Web push notifications when agents are done or need attention."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.pushSubscriptions)??0)>0?`${t.pushSubscriptions} subscription${t.pushSubscriptions>1?"s":""} active`:"Not enabled"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(234,179,8,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),e.jsx("polyline",{points:"7.5 4.21 12 6.81 16.5 4.21"}),e.jsx("polyline",{points:"7.5 19.79 7.5 14.6 3 12"}),e.jsx("polyline",{points:"21 12 16.5 14.6 16.5 19.79"}),e.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),e.jsx("line",{x1:"12",x2:"12",y1:"22.08",y2:"12"})]}),e.jsx("span",{children:"LLM Providers"}),e.jsx(p,{active:(t==null?void 0:t.claudeAuth)??!1})]}),e.jsx(w,{section:"providers"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Claude, Codex, Ollama"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"LLM backends for agent sessions. Claude Code CLI, OpenAI Codex, local Ollama."}),e.jsxs("div",{className:"mt-3 inline-flex items-center gap-3 text-xs text-cc-muted/95",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-lg border border-cc-border/80 bg-black/10 px-2.5 py-1.5 ${t!=null&&t.claudeAuth?"text-cc-success":""}`,children:["Claude ",t!=null&&t.claudeAuth?"OK":"--"]}),e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-lg border border-cc-border/80 bg-black/10 px-2.5 py-1.5 ${t!=null&&t.codexAuth?"text-cc-success":""}`,children:["Codex ",t!=null&&t.codexAuth?"OK":"--"]})]})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(236,72,153,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),e.jsx("line",{x1:"9",x2:"9.01",y1:"9",y2:"9"}),e.jsx("line",{x1:"15",x2:"15.01",y1:"9",y2:"9"})]}),e.jsx("span",{children:"Agents"}),e.jsx(p,{active:((t==null?void 0:t.agents)??0)>0})]}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/agents"},"aria-label":"Open agents",title:"Manage agents",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:e.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Agent Configuration"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Configured agents with custom system prompts, models and working directories."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.agents)??0)>0?`${t.agents} agent${t.agents>1?"s":""} configured`:"No agents"})]})]}),e.jsxs("section",{className:"sm:col-span-2 group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(16,185,129,0.10),transparent_52%)]"}),e.jsx("div",{className:"relative",children:e.jsx(me,{})})]})]})]})})}export{ue as IntegrationsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,b as d,j as e}from"./index-CEqZnThB.js";function m({embedded:r}){const[a,c]=t.useState([]),[i,l]=t.useState(!0);return t.useEffect(()=>{d.listMedia().then(s=>c(s.files)).catch(()=>{}).finally(()=>l(!1))},[]),e.jsx("div",{className:"h-full overflow-auto ",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-8 sm:px-6",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Media"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Images and files created by agents and Gemini Live."})]}),i?e.jsx("p",{className:"text-xs text-cc-muted",children:"Loading..."}):a.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-8 h-8 text-cc-muted/30 mx-auto mb-3",children:[e.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),e.jsx("circle",{cx:"5.5",cy:"5.5",r:"1"}),e.jsx("path",{d:"M2 11l3-3 2 2 3-4 4 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"currentColor",strokeWidth:"1",fill:"none"})]}),e.jsx("p",{className:"text-sm text-cc-muted",children:"No media files yet"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Generated images from agents and Gemini will appear here."})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:a.map((s,n)=>e.jsxs("a",{href:`/api/media/file/${encodeURIComponent(s.filename)}`,target:"_blank",rel:"noopener noreferrer",className:"group bg-cc-card border border-cc-border rounded-xl overflow-hidden hover:border-cc-primary/40 transition-colors",children:[e.jsx("img",{src:`/api/media/file/${encodeURIComponent(s.filename)}`,alt:s.filename,className:"w-full aspect-square object-cover",loading:"lazy"}),e.jsx("div",{className:"px-2.5 py-2",children:e.jsx("p",{className:"text-[11px] text-cc-muted truncate group-hover:text-cc-fg transition-colors",children:s.filename})})]},n))})]})})}export{m as MediaPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as a,b as n}from"./index-CEqZnThB.js";function y(){const[s,l]=a.useState(null),[t,m]=a.useState([]),[i,d]=a.useState(!0),o=a.useCallback(async()=>{try{const[c,x]=await Promise.all([n.getCostSummary(),n.getCosts(20)]);l(c),m(x)}catch{}finally{d(!1)}},[]);return a.useEffect(()=>{o()},[o]),i?e.jsx("div",{className:"text-cc-text-secondary text-sm",children:"Loading costs..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-cc-text-primary",children:"Cost Tracking"}),e.jsx("button",{onClick:o,className:"text-xs text-cc-text-secondary hover:text-cc-text-primary",children:"Refresh"})]}),s&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx(h,{label:"Total Cost",value:`$${s.allTimeCost.toFixed(4)}`}),e.jsx(h,{label:"Tokens In",value:u(s.allTimeTokensIn)}),e.jsx(h,{label:"Tokens Out",value:u(s.allTimeTokensOut)}),e.jsx(h,{label:"Records",value:String(s.totalRecords)})]}),t.length>0&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-cc-text-secondary border-b border-cc-border",children:[e.jsx("th",{className:"pb-2 text-left font-medium",children:"Agent"}),e.jsx("th",{className:"pb-2 text-left font-medium",children:"Model"}),e.jsx("th",{className:"pb-2 text-right font-medium",children:"Tokens"}),e.jsx("th",{className:"pb-2 text-right font-medium",children:"Cost"})]})}),e.jsx("tbody",{children:t.map(c=>e.jsxs("tr",{className:"border-b border-cc-border/50",children:[e.jsx("td",{className:"py-1.5 text-cc-text-primary",children:c.agentName}),e.jsx("td",{className:"py-1.5 text-cc-text-secondary",children:c.model}),e.jsx("td",{className:"py-1.5 text-right text-cc-text-secondary",children:u(c.tokensIn+c.tokensOut)}),e.jsxs("td",{className:"py-1.5 text-right text-cc-text-primary",children:["$",c.estimatedCost.toFixed(4)]})]},c.agentId))})]})})]})}function b(){const[s,l]=a.useState({killed:!1}),[t,m]=a.useState(""),[i,d]=a.useState(!1);a.useEffect(()=>{n.getKillSwitch().then(l).catch(()=>{})},[]);const o=async()=>{d(!0);try{const x=await n.activateKillSwitch(t||"Manual activation from dashboard");l(x),m("")}finally{d(!1)}},c=async()=>{d(!0);try{const x=await n.deactivateKillSwitch();l(x)}finally{d(!1)}};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-cc-text-primary",children:"Kill Switch"}),e.jsxs("div",{className:`rounded-lg p-3 text-sm ${s.killed?"bg-red-500/10 border border-red-500/30":"bg-green-500/10 border border-green-500/30"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full ${s.killed?"bg-red-500":"bg-green-500"}`}),e.jsx("span",{className:s.killed?"text-red-400 font-medium":"text-green-400",children:s.killed?"KILLED — All agents stopped":"Active — Agents running normally"})]}),s.killed&&s.reason&&e.jsxs("p",{className:"mt-1 text-xs text-red-300/70",children:["Reason: ",s.reason]}),s.killed&&s.activatedAt&&e.jsxs("p",{className:"mt-0.5 text-xs text-red-300/50",children:["Since: ",new Date(s.activatedAt).toLocaleString()]})]}),s.killed?e.jsx("button",{onClick:c,disabled:i,className:"rounded-lg bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-500 disabled:opacity-50",children:i?"Deactivating...":"Deactivate Kill Switch"}):e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:t,onChange:x=>m(x.target.value),placeholder:"Reason (optional)",className:"flex-1 rounded-lg border border-cc-border bg-cc-bg-secondary px-3 py-1.5 text-sm text-cc-text-primary"}),e.jsx("button",{onClick:o,disabled:i,className:"rounded-lg bg-red-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-red-500 disabled:opacity-50",children:i?"...":"KILL"})]})]})}function f(){const[s,l]=a.useState([]),[t,m]=a.useState(null),[i,d]=a.useState(""),[o,c]=a.useState(!1);a.useEffect(()=>{n.listSharedContext().then(l).catch(()=>{})},[]);const x=async r=>{try{const p=await n.getSharedContext(r);m(r),d(p.content),c(!1)}catch{}},g=async()=>{if(t)try{await n.writeSharedContext(t,i),c(!1);const r=await n.listSharedContext();l(r)}catch{}};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-cc-text-primary",children:"Shared Context"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(r=>e.jsx("button",{onClick:()=>x(r.filename),className:`rounded-md px-2.5 py-1 text-xs ${t===r.filename?"bg-cc-accent text-white":"bg-cc-bg-secondary text-cc-text-secondary hover:text-cc-text-primary"}`,children:r.filename},r.filename))}),t&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-cc-text-secondary",children:t}),e.jsx("div",{className:"flex gap-2",children:o?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:g,className:"text-xs text-green-400 hover:text-green-300",children:"Save"}),e.jsx("button",{onClick:()=>c(!1),className:"text-xs text-cc-text-secondary hover:text-cc-text-primary",children:"Cancel"})]}):e.jsx("button",{onClick:()=>c(!0),className:"text-xs text-cc-text-secondary hover:text-cc-text-primary",children:"Edit"})})]}),o?e.jsx("textarea",{value:i,onChange:r=>d(r.target.value),rows:10,className:"w-full rounded-lg border border-cc-border bg-cc-bg-secondary p-3 font-mono text-xs text-cc-text-primary"}):e.jsx("pre",{className:"max-h-64 overflow-auto rounded-lg bg-cc-bg-secondary p-3 text-xs text-cc-text-secondary",children:i})]})]})}function j(){const[s,l]=a.useState([]);return a.useEffect(()=>{n.listMessages({limit:20}).then(l).catch(()=>{})},[]),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-cc-text-primary",children:"Agent Messages"}),e.jsxs("span",{className:"text-xs text-cc-text-secondary",children:[s.length," messages"]})]}),s.length===0?e.jsx("p",{className:"text-xs text-cc-text-secondary",children:"No messages yet."}):e.jsx("div",{className:"space-y-2 max-h-64 overflow-auto",children:s.map(t=>e.jsxs("div",{className:"rounded-lg bg-cc-bg-secondary p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium text-cc-text-primary",children:[t.fromName||t.from," → ",t.to||"broadcast"]}),e.jsx("span",{className:"text-cc-text-secondary",children:new Date(t.createdAt).toLocaleTimeString()})]}),e.jsx("span",{className:`inline-block mt-1 rounded px-1.5 py-0.5 text-[10px] ${t.type==="task"?"bg-blue-500/20 text-blue-400":t.type==="result"?"bg-green-500/20 text-green-400":t.type==="interrupt"?"bg-red-500/20 text-red-400":"bg-cc-bg-tertiary text-cc-text-secondary"}`,children:t.type}),e.jsx("p",{className:"mt-1 text-cc-text-secondary line-clamp-2",children:t.content})]},t.id))})]})}function N(){const[s,l]=a.useState([]);return a.useEffect(()=>{n.getLLMProviders().then(t=>l(t.providers)).catch(()=>{})},[]),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-cc-text-primary",children:"LLM Providers"}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:s.map(t=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-cc-bg-secondary p-2.5",children:[e.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${t.status==="available"||t.status==="configured"?"bg-green-500":t.status==="needs_api_key"?"bg-yellow-500":"bg-red-500"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"text-xs font-medium text-cc-text-primary capitalize",children:t.name}),e.jsx("span",{className:"ml-2 text-[10px] text-cc-text-secondary",children:t.status})]}),t.models&&t.models.length>0&&e.jsxs("span",{className:"text-[10px] text-cc-text-secondary",children:[t.models.length," models"]})]},t.name))})]})}function h({label:s,value:l}){return e.jsxs("div",{className:"rounded-lg bg-cc-bg-secondary p-3",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-cc-text-secondary",children:s}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-cc-text-primary",children:l})]})}function u(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:String(s)}function S(){return e.jsxs("div",{className:"mx-auto max-w-4xl space-y-8 p-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-text-primary",children:"HeyHank Dashboard"}),e.jsx("p",{className:"text-xs text-cc-text-secondary",children:"Multi-Agent Platform"})]}),e.jsx(b,{}),e.jsx(y,{}),e.jsx(N,{}),e.jsx(j,{}),e.jsx(f,{})]})}export{S as default};
|