dorkos 0.98.0 → 0.101.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 +43 -13
- package/dist/bin/cli.js +10649 -8676
- package/dist/browser/fresh-verifier.mjs +3 -2
- package/dist/browser/native/darwin-journal-worker.mjs +2244 -0
- package/dist/browser/native/darwin-process-observer +0 -0
- package/dist/browser/native/darwin-process-observer.c +252 -0
- package/dist/browser/native/darwin-process-observer.h +37 -0
- package/dist/browser/native/darwin-process-observer.manifest.json +1 -0
- package/dist/browser/native/darwin-supervisor-worker.mjs +1996 -0
- package/dist/browser/native/package-manifest.json +1 -0
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-DqTcRYx5.js → AboutPage-CwxCTicf.js} +1 -1
- package/dist/client/assets/ActivityRow-D0QQ0SFu.js +1 -0
- package/dist/client/assets/AdapterIcon-CL-MyyKy.js +1 -0
- package/dist/client/assets/AdapterSetupWizard-C8HOvHLF.js +2 -0
- package/dist/client/assets/AgentRequestCard-BLLmoAES.js +12 -0
- package/dist/client/assets/AppearancePage-GqrWckTQ.js +1 -0
- package/dist/client/assets/AttentionSignalRow-sEhnIPBB.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Bmlsorom.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BXjzhT_D.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-BBW7iNEC.js → BlintzCanvas-CXi0fvcM.js} +1 -1
- package/dist/client/assets/{CanvasCsvContent-D6qWSQm4.js → CanvasCsvContent-QhDSf8Pd.js} +2 -2
- package/dist/client/assets/CanvasFileContent-ZZhdofR4.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-DMMMZh4o.js +2 -0
- package/dist/client/assets/{CodeMirrorDiff-DsOh9sIB.js → CodeMirrorDiff-BMG7DBg2.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BxIWDXqr.js → CodeMirrorEditor-BYdz0ipX.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-PW1uzcGU.js +1 -0
- package/dist/client/assets/{ConnectionsPage-DvxSfsfG.js → ConnectionsPage-EwitZwOE.js} +3 -3
- package/dist/client/assets/ConventionPage-y-Zq3Klp.js +11 -0
- package/dist/client/assets/ExtensionPageRoute-gZKKPhaj.js +6 -0
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BCrkUo51.js → FloatingTanStackRouterDevtools-CqogiFob-CbKIa11X.js} +1 -1
- package/dist/client/assets/HandlePage-CL3_n1CI.js +1 -0
- package/dist/client/assets/{LexicalField-mvJHHMqo.js → LexicalField-Ceoa9flp.js} +13 -13
- package/dist/client/assets/{ManagesPage-DScJn5uY.js → ManagesPage-Dcqdm6I8.js} +1 -1
- package/dist/client/assets/Marketplace-DsU-q1ZZ.js +36 -0
- package/dist/client/assets/MarketplaceSourcesView-D72YoKNR.js +1 -0
- package/dist/client/assets/McpAppFrame-B1ThSf2U.js +6 -0
- package/dist/client/assets/McpSigninBody-Btg3PnYN.js +1 -0
- package/dist/client/assets/{Model3dViewer-BYNxJNRV.js → Model3dViewer-DlcQ3-LS.js} +1 -1
- package/dist/client/assets/NamePage-Bzqj4Eob.js +1 -0
- package/dist/client/assets/NewDirectMessageMenu-89yeGqvy.js +1 -0
- package/dist/client/assets/{NotificationsPage-CU6oIOwb.js → NotificationsPage-CQQIdLtI.js} +1 -1
- package/dist/client/assets/OperatorIdentityForm-BhiB9tQp.js +1 -0
- package/dist/client/assets/{PermissionsPage-BIatOhyg.js → PermissionsPage-TX-d7aVQ.js} +1 -1
- package/dist/client/assets/PersonalityPicker-C_9JVOva.js +1 -0
- package/dist/client/assets/PersonalityPopover-BoTED73t.js +1 -0
- package/dist/client/assets/PhotoPage-C3fMlebQ.js +1 -0
- package/dist/client/assets/PreviewRefusedNotice-ChCgdKWN.js +1 -0
- package/dist/client/assets/PromptSuggestionChips-B_oUtFMI.js +1 -0
- package/dist/client/assets/RoomSurface-CgtNuYhl.js +39 -0
- package/dist/client/assets/RoomsPage-zOjjpHdA.js +1 -0
- package/dist/client/assets/RunsOnPopover-JTm1cYuw.js +1 -0
- package/dist/client/assets/SessionsPage-D4kyvHQf.js +6 -0
- package/dist/client/assets/SkillsPage-KYUVzuVa.js +1 -0
- package/dist/client/assets/TasksPage-BZapA_v6.js +1 -0
- package/dist/client/assets/{ToolsPage-BMW27c-X.js → ToolsPage-CWpHMlrR.js} +2 -2
- package/dist/client/assets/{TopologyGraph-u-ihEvQa.js → TopologyGraph-BMcPxZsA.js} +3 -3
- package/dist/client/assets/TourHost-VY1-sy1Y.js +1 -0
- package/dist/client/assets/UnlinkDialog-3p38G_9q.js +1 -0
- package/dist/client/assets/UnreadDivider-KSqqcHKN.js +1 -0
- package/dist/client/assets/_shell-DAjwimLg.js +93 -0
- package/dist/client/assets/_shell._home-Bp_p1VUv.js +1 -0
- package/dist/client/assets/_shell._home.activity-tk-XApvX.js +1 -0
- package/dist/client/assets/_shell._home.index-BNVhSN0y.js +3 -0
- package/dist/client/assets/_shell._home.tasks-BsBH_4tZ.js +1 -0
- package/dist/client/assets/_shell._home.workspaces-DuXnjQh0.js +1 -0
- package/dist/client/assets/_shell.channels-DWAHkDPV.js +10 -0
- package/dist/client/assets/_shell.connections-DIm3mUHy.js +6 -0
- package/dist/client/assets/_shell.feedback-requests-Hjv640j9.js +2 -0
- package/dist/client/assets/_shell.marketplace-DF6Y7mc0.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-Do8cm7kq.js +1 -0
- package/dist/client/assets/_shell.session-DlN8iOl-.js +43 -0
- package/dist/client/assets/_shell.team-ctLQztjw.js +28 -0
- package/dist/client/assets/_shell.x._extensionId-0Q1rJtud.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-0Q1rJtud.js +1 -0
- package/dist/client/assets/agent-attention-Dn__3LQE.js +5 -0
- package/dist/client/assets/{agent-browser-Bn5EG403.js → agent-browser-CCN16ZOz.js} +1 -1
- package/dist/client/assets/banner-DOm9_4l-.js +6 -0
- package/dist/client/assets/composer-insert-BpyATrmR.js +1 -0
- package/dist/client/assets/dorkbot-templates-cu4wApxb.js +1 -0
- package/dist/client/assets/file-drag-GDx2qhdk.js +1 -0
- package/dist/client/assets/file-exclamation-point-BKzL0QhY.js +6 -0
- package/dist/client/assets/format-duration-BCr6uzby.js +1 -0
- package/dist/client/assets/hand-DLUdsiuR.js +6 -0
- package/dist/client/assets/{highlighted-body-KPVGNVTW-CL9x-9e4.js → highlighted-body-KPVGNVTW-DTxMTVdP.js} +1 -1
- package/dist/client/assets/hover-card-qzuFUCaR.js +1 -0
- package/dist/client/assets/{index-nEOi__50.js → index-3lQkXKcq.js} +1 -1
- package/dist/client/assets/{index-CpJvQdyn.js → index-B-z7hA9x.js} +1 -1
- package/dist/client/assets/{index-C-wQjAlh.js → index-BIMClIrX.js} +1 -1
- package/dist/client/assets/{index-lrzDDn8S.js → index-BMOfHKE0.js} +1 -1
- package/dist/client/assets/{index-CK35WFBO.js → index-BPcwoJoz.js} +1 -1
- package/dist/client/assets/{index-CsQv_9cY.js → index-BW5ce4t8.js} +1 -1
- package/dist/client/assets/{index-C2L0bOg6.js → index-BaB-skF0.js} +3 -3
- package/dist/client/assets/{index-DAXybyxB.js → index-Bk98IpMn.js} +1 -1
- package/dist/client/assets/{index-62aJQhJd.js → index-C3XnoXTY.js} +1 -1
- package/dist/client/assets/{index-tY8nAJmx.js → index-C7B2uRgo.js} +2 -2
- package/dist/client/assets/index-C8ZMfyGc.js +1 -0
- package/dist/client/assets/{index-BSl_jWtK.js → index-CDTumWMC.js} +1 -1
- package/dist/client/assets/{index-DuWGfUC7.js → index-CF9fqPef.js} +5 -5
- package/dist/client/assets/{index-DEYZcwYZ.js → index-CIPHHziB.js} +1 -1
- package/dist/client/assets/{index-DOVEs6Rq.js → index-CIfwPLXd.js} +1 -1
- package/dist/client/assets/{index-DnjFcJhW.js → index-CLhD0Bno.js} +36 -36
- package/dist/client/assets/index-CQWqpw_G.js +1 -0
- package/dist/client/assets/index-CScfHuKF.js +1 -0
- package/dist/client/assets/index-CTXNRyRE.js +1 -0
- package/dist/client/assets/{index-C3fr7zOo.js → index-CTai_TxZ.js} +1 -1
- package/dist/client/assets/{index-CniKYwdp.js → index-CVl132_4.js} +1 -1
- package/dist/client/assets/index-CejezM4U.js +1 -0
- package/dist/client/assets/{index-Bc9XDEj8.js → index-CmlaXay_.js} +1 -1
- package/dist/client/assets/{index-KIOfBCox.js → index-CtOB9fS3.js} +1 -1
- package/dist/client/assets/{index-DyFf2nbN.js → index-D3DXMH4x.js} +1 -1
- package/dist/client/assets/index-D5uYwabS.js +1 -0
- package/dist/client/assets/{index-CaEda4s3.js → index-DA-i3I4q.js} +1 -1
- package/dist/client/assets/index-DFMDv6qR.js +1 -0
- package/dist/client/assets/index-DMYBI16t.js +1252 -0
- package/dist/client/assets/{index-DzBsotRj.js → index-DOxEmnH2.js} +1 -1
- package/dist/client/assets/{index-Dxkj6c9m.js → index-DR1JT9Uz.js} +12 -12
- package/dist/client/assets/{index-BO-CpekL.js → index-DT_v3O-B.js} +1 -1
- package/dist/client/assets/index-DbbZNAKk.js +5 -0
- package/dist/client/assets/{index-BBz-vkiB.js → index-Dcs6e-U_.js} +1 -1
- package/dist/client/assets/{index-BE54c4kA.js → index-DgH_dl1a.js} +2 -2
- package/dist/client/assets/{index-DPGgujWh.js → index-DgtF-nBt.js} +1 -1
- package/dist/client/assets/{index-BlbBz069.js → index-DwzSdOh3.js} +1 -1
- package/dist/client/assets/index-IgIVF9T_.js +1 -0
- package/dist/client/assets/{index-aFkVVlMJ.js → index-WjW-NUCp.js} +1 -1
- package/dist/client/assets/layers-CJHXSEKK.js +6 -0
- package/dist/client/assets/lightbulb-DWjxw7lb.js +6 -0
- package/dist/client/assets/mention-pill-akMU3IVs.js +1 -0
- package/dist/client/assets/message-square-off-DEagHpQY.js +6 -0
- package/dist/client/assets/owner-notice-CLsx0s7q.js +1 -0
- package/dist/client/assets/page-container-W7byjRmk.js +1 -0
- package/dist/client/assets/primer-trigger-DuM9vVnV.js +3 -0
- package/dist/client/assets/radio-B8Ozjv9U.js +6 -0
- package/dist/client/assets/{room-files-source-BXJ2jlgd.js → room-files-source-Bsc3YA91.js} +2 -2
- package/dist/client/assets/rotate-ccw-clock-CNcDcTvq.js +6 -0
- package/dist/client/assets/rotate-cw-xvfipJLN.js +6 -0
- package/dist/client/assets/scroll-area-C95q3ss7.js +1 -0
- package/dist/client/assets/search-x-C6SAxw7a.js +6 -0
- package/dist/client/assets/session-strategy-labels-C7Wduch3.js +1 -0
- package/dist/client/assets/shield-x-DxOGc0dW.js +6 -0
- package/dist/client/assets/{soul-file-11avkxYV.js → soul-file-pg0ShYy3.js} +1 -1
- package/dist/client/assets/untrusted-text-1hXdPgLA.js +1 -0
- package/dist/client/assets/use-delete-binding-CZVeHqn0.js +1 -0
- package/dist/client/assets/use-dev-links-Df2WkCic.js +1 -0
- package/dist/client/assets/use-external-adapter-catalog-B0gcY-k7.js +1 -0
- package/dist/client/assets/use-full-activity-feed-SYcgdMZu.js +1 -0
- package/dist/client/assets/use-is-below-desktop-C5_YenEp.js +1 -0
- package/dist/client/assets/use-jump-back-in-DWUPb1gi.js +11 -0
- package/dist/client/assets/use-mesh-topology-HLzZIgis.js +1 -0
- package/dist/client/assets/use-pending-read-BuJknrxG.js +1 -0
- package/dist/client/assets/{use-personality-commit-PCN2Kh8p.js → use-personality-commit-OH7d0xl_.js} +1 -1
- package/dist/client/assets/use-promo-activation-BgdGasXE.js +11 -0
- package/dist/client/assets/use-pulse-freshness-BlD-dM_g.js +1 -0
- package/dist/client/assets/use-rename-session-D3MuyK-F.js +1 -0
- package/dist/client/assets/use-room-follow-claim-CyjhzbRJ.js +1 -0
- package/dist/client/assets/use-roving-tab-list-Be60AWK3.js +1 -0
- package/dist/client/assets/use-session-canvas-Bqs6IQO7.js +64 -0
- package/dist/client/assets/use-session-diagnostics-CfKdB2iY.js +16 -0
- package/dist/client/assets/use-unclaimed-chats-lqMhotUB.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/client/manifest.webmanifest +1 -1
- package/dist/drizzle/20261005194144_connector_auth_flow_failure_code.sql +1 -0
- package/dist/drizzle/20261005230915_task_run_occurrence.sql +2 -0
- package/dist/drizzle/20261006231015_audit_events.sql +63 -0
- package/dist/drizzle/20261007230701_private_session_identity.sql +15 -0
- package/dist/drizzle/meta/20261005194144_snapshot.json +12238 -0
- package/dist/drizzle/meta/20261005230915_snapshot.json +12252 -0
- package/dist/drizzle/meta/20261006231015_snapshot.json +12519 -0
- package/dist/drizzle/meta/20261007230701_snapshot.json +12611 -0
- package/dist/drizzle/meta/_journal.json +28 -0
- package/dist/server/index.js +161811 -97213
- package/dist/server/index.js.map +2 -2
- package/package.json +5 -5
- package/dist/client/assets/AdapterIcon-CiK683Vv.js +0 -1
- package/dist/client/assets/AppearancePage-CBq2_KUY.js +0 -1
- package/dist/client/assets/CanvasFileContent-jV63reY5.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-DzvsEWGD.js +0 -2
- package/dist/client/assets/ConnectionAccessLists-BWuegEtZ.js +0 -1
- package/dist/client/assets/ConventionPage-CYV7X_nF.js +0 -11
- package/dist/client/assets/HandlePage-CJpRpaLw.js +0 -1
- package/dist/client/assets/NamePage-KoYyo25o.js +0 -1
- package/dist/client/assets/PersonalityPopover-CFRYfO5E.js +0 -1
- package/dist/client/assets/PhotoPage-DkGyFlWQ.js +0 -1
- package/dist/client/assets/RoomsPage-ClT030eV.js +0 -1
- package/dist/client/assets/RunsOnPopover-CNCO9sZk.js +0 -1
- package/dist/client/assets/SessionsPage-5xEcQImi.js +0 -6
- package/dist/client/assets/SkillsPage-ic4TDV4I.js +0 -1
- package/dist/client/assets/TasksPage-C_GFpRgB.js +0 -1
- package/dist/client/assets/index-6COO_Ljw.js +0 -1
- package/dist/client/assets/index-BKl9b2dT.js +0 -1
- package/dist/client/assets/index-BVtk6Sb_.js +0 -1
- package/dist/client/assets/index-Bxrxl2HH.js +0 -1
- package/dist/client/assets/index-C6uVMs3w.js +0 -1
- package/dist/client/assets/index-DEvFAO8t.js +0 -1
- package/dist/client/assets/index-DpSk7iO1.js +0 -1680
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":1,"controllerSHA256":"66c573dd94fd4e2a0a63ecf57642106e58ed36441286ffa92e72d81181a13fbf","nativeManifestSHA256":"19fb0607902e9c30bc693f3a8f7e80601f6ccfd090ffa412a5a38614e6eb7c00","platform":"darwin","arch":"arm64","availability":"available","workers":[{"name":"darwin-journal-worker.mjs","sha256":"739958b3515b48dda8cf40366aa6e34cf65366662c96dba1c951f38bc2f97603","bytes":88486},{"name":"darwin-supervisor-worker.mjs","sha256":"83b9b1e6d8969f5f909b43ebcf2d3ae6830601908bd2e4e4b2747d9ee7e55b77","bytes":74686}]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion":1,"controllerSHA256":"
|
|
1
|
+
{"schemaVersion":1,"controllerSHA256":"66c573dd94fd4e2a0a63ecf57642106e58ed36441286ffa92e72d81181a13fbf","verifierSHA256":"5cb8f248a264a0602757ad2c0971c1b1e84bcf3185a2b8d706230d2cfac0703c"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as N,d as v,j as e,e as w,r as d,X as C,I as k,B as D,f as S}from"./index-DMYBI16t.js";function j({children:i}){return e.jsx("div",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:i})}function A({agent:i,onUpdate:t}){const[a,l]=d.useState(!1),[o,u]=d.useState(""),n=i.capabilities??[];function c(){const s=o.trim();s&&!n.includes(s)&&t({capabilities:[...n,s]}),u(""),l(!1)}return e.jsxs("div",{className:"space-y-1",children:[e.jsx(j,{children:"Capabilities"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.map(s=>e.jsxs("span",{className:"bg-accent text-accent-foreground inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs",children:[s,e.jsx("button",{type:"button",onClick:()=>t({capabilities:n.filter(p=>p!==s)}),className:"hover:text-destructive transition-colors","aria-label":`Remove capability ${s}`,children:e.jsx(C,{"aria-hidden":!0,className:"size-3"})})]},s)),a?e.jsx(k,{autoFocus:!0,value:o,onChange:s=>u(s.target.value),onBlur:c,onKeyDown:s=>{s.key==="Enter"&&c(),s.key==="Escape"&&l(!1)},className:"h-6 w-28 text-xs",placeholder:"Capability name","aria-label":"New capability"}):e.jsxs(D,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground h-auto gap-0.5 px-1 py-0 text-xs",children:[e.jsx(S,{"aria-hidden":!0,className:"size-3"})," Add"]})]})]})}function b({label:i,value:t,placeholder:a,multiline:l,testId:o,onCommit:u}){const[n,c]=d.useState(t),[s,p]=d.useState(t),[m,f]=d.useState(null);s!==t&&(p(t),c(t));function x(){const r=n.trim();if(r===t.trim())return;const g=u(r);if(typeof g!="string")return f(null);c(t),f(g)}const h="border-input bg-background placeholder:text-muted-foreground focus-visible:ring-ring w-full rounded-md border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:outline-none",y=m?e.jsx("p",{role:"status",className:"text-destructive text-xs",children:m}):null;return e.jsxs("div",{className:"space-y-1",children:[e.jsx(j,{children:i}),l?e.jsx("textarea",{value:n,rows:4,"data-testid":o,"aria-label":i,placeholder:a,onChange:r=>{f(null),c(r.target.value)},onBlur:x,onKeyDown:r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),x())},className:h}):e.jsx("input",{value:n,"data-testid":o,"aria-label":i,placeholder:a,onChange:r=>{f(null),c(r.target.value)},onBlur:x,onKeyDown:r=>{r.key==="Enter"&&x()},className:h}),y]})}function R({member:i,roster:t}){const{agent:a,isPending:l,update:o}=N(i),u=v(i,t)==="managed";return l?e.jsx(w,{className:"h-16 w-full"}):!u||!a?e.jsx(E,{member:i,agent:a}):e.jsxs("div",{className:"flex flex-col gap-4","data-slot":"profile-about",children:[e.jsx(b,{label:"Name",value:a.displayName??a.name,placeholder:"What you call this agent",testId:"agent-name-field",onCommit:n=>{if(!n)return"A name can’t be empty, so the old one was kept.";o({displayName:n})}}),e.jsx(b,{multiline:!0,label:"Description",value:a.description??"",placeholder:"What is this agent for?",testId:"agent-description-field",onCommit:n=>o({description:n})}),e.jsx(A,{agent:a,onUpdate:o})]})}function E({member:i,agent:t}){var l;const a=(l=t==null?void 0:t.description)==null?void 0:l.trim();return a?e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:a}):e.jsxs("p",{className:"text-muted-foreground text-sm",children:[i.displayName," has no description yet."]})}export{R as AboutPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aW as x,cX as d,j as e,a3 as u,aa as l,bM as m,cY as g,cZ as h,c_ as o,B as p}from"./index-DMYBI16t.js";const k={tasks:{text:"text-purple-500",bg:"bg-purple-500/10",label:"Schedules"},relay:{text:"text-teal-500",bg:"bg-teal-500/10",label:"Messages"},agent:{text:"text-indigo-500",bg:"bg-indigo-500/10",label:"Agent"},config:{text:"text-amber-500",bg:"bg-amber-500/10",label:"Settings"},system:{text:"text-neutral-500",bg:"bg-neutral-500/10",label:"System"},permissions:{text:"text-sky-500",bg:"bg-sky-500/10",label:"Permissions"}},f={user:{text:"text-muted-foreground"},agent:{text:"text-foreground"},system:{icon:d,text:"text-neutral-500"},tasks:{icon:x,text:"text-purple-500"}};function b({actorType:a,actorLabel:i,agentColor:s,className:n}){const t=f[a],r=t.icon;return a==="user"?e.jsx(u,{shape:"pill",variant:"outline",className:l("text-muted-foreground",n),children:i}):a==="agent"?e.jsxs("span",{"data-slot":"actor-badge",className:l("inline-flex items-center gap-1.5 text-xs font-medium",t.text,n),children:[e.jsx("span",{className:"size-2 shrink-0 rounded-full",style:s?{backgroundColor:s}:void 0,"aria-hidden":!0}),e.jsx("span",{className:"truncate",children:i})]}):e.jsxs("span",{"data-slot":"actor-badge",className:l("inline-flex items-center gap-1 text-xs font-medium",t.text,n),children:[r&&e.jsx(r,{className:"size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:i})]})}function y(a,i=new Date){const s=new Date(a),n=new Date(i);n.setHours(0,0,0,0);const t=new Date(n);t.setDate(t.getDate()-1);const r=new Date(n);r.setDate(r.getDate()-r.getDay());const c=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return s>=n?c:s>=t?`Yesterday ${c}`:s>=r?`${s.toLocaleDateString("en-US",{weekday:"long"})} ${c}`:s.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function v({item:a,className:i}){const s=m(),n=y(a.occurredAt),t=a.linkPath?g(a.linkPath):null;return e.jsxs(h,{"data-slot":"activity-row","data-activity-row":t?"":void 0,tabIndex:t?0:void 0,onKeyDown:t?r=>{r.key==="Enter"&&s({href:t,replace:!1})}:void 0,className:l(t?"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none":"hover:bg-transparent",i),children:[e.jsx(o,{className:"w-28 py-1.5 pr-0 pl-2 max-sm:hidden",children:e.jsx("span",{className:"text-muted-foreground text-xs tabular-nums",children:n})}),e.jsx(o,{className:"w-24 py-1.5 pr-0 max-sm:hidden",children:e.jsx(b,{actorType:a.actorType,actorLabel:a.actorLabel})}),e.jsx(o,{className:"max-w-0 py-1.5 max-sm:pl-2",children:e.jsxs("span",{className:"text-foreground/80 block truncate text-sm",children:[e.jsx("span",{className:"text-muted-foreground mr-1 text-xs font-medium sm:hidden",children:a.actorLabel}),a.summary]})}),e.jsx(o,{className:"w-16 py-1.5 pr-2 text-right max-sm:w-10",children:t&&e.jsx(p,{variant:"ghost",size:"sm",className:"h-6 min-h-[44px] px-2 text-xs sm:min-h-0",onClick:()=>s({href:t,replace:!1}),children:"Open →"})})]})}export{v as A,k as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{be as n,bf as r,j as c,bg as s,ab as g}from"./index-DMYBI16t.js";const T={connected:n.success,disconnected:n.neutral,error:n.error,starting:`${n.warning} ${r}`,stopping:`${n.warning} ${r}`,reconnecting:`${n.warning} ${r}`},_={connected:"Connected",disconnected:"Ready",error:"Error",starting:"Connecting…",stopping:"Stopping…",reconnecting:"Reconnecting…"};function d({iconId:i,adapterType:a,size:t=16,className:e}){const o=s[i??""]??s[a??""];return o?c.jsx(o,{size:t,className:e}):c.jsx(g,{className:e,style:{width:t,height:t}})}export{d as A,T as a,_ as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Q as be,R as Ne,U as ze,a7 as qe,j as e,cw as Ee,cx as Te,r as m,cy as ie,gh as Me,cz as oe,gi as le,a6 as We,cA as ce,cB as de,gj as ue,dG as he,cC as pe,ft as I,bd as Y,O as J,gk as me,gl as $e,aa as U,dH as X,dI as Z,dJ as ee,dK as se,dL as te,I as re,eq as xe,aF as Ve,bc as De,B as k,gm as Se,er as Pe,ep as ae,aU as ke,a$ as Re,a_ as Oe,am as Le,fY as ge,gn as _e,go as Ge,gp as Ue,gq as Ie,gr as He,gs as Qe,gt as Ke,gu as Ye,fU as Je,d7 as Xe,gv as Ze,W as G,eJ as es,eK as ss,eL as ts,eM as rs,eN as as,eO as ns,gw as fe,gx as Q}from"./index-DMYBI16t.js";function ks(s={}){const t=be(),a=Ne();return ze({mutationFn:({id:r,updates:l})=>t.updateBinding(r,l),onSuccess:()=>{a.invalidateQueries({queryKey:[...qe]})},meta:s.suppressErrorToast?{suppressErrorToast:!0}:{errorLabel:s.errorLabel??"Couldn’t update that connection"}})}function is({field:s,value:t,onChange:a,error:r,allValues:l}){const[i,n]=m.useState("");if(s.showWhen&&l[s.showWhen.field]!==s.showWhen.equals)return null;const o=`config-field-${s.key}`,v=s.type==="select"&&s.displayAs==="radio-cards",h=t!=null?String(t):"",x=h==="***",y=()=>{if(x){n("");return}if(s.pattern&&h&&!new RegExp(s.pattern).test(h)){n(s.patternMessage??"Check the format");return}n("")},d=r??i;if(s.type==="boolean")return e.jsxs("div",{children:[e.jsxs(ie,{orientation:"horizontal",className:"items-center justify-between gap-4",children:[e.jsxs(Me,{className:"min-w-0",children:[e.jsxs(oe,{htmlFor:o,className:"text-sm font-medium",children:[s.label,s.required&&e.jsx("span",{"aria-hidden":"true",className:"text-destructive ml-0.5",children:"*"})]}),s.description&&e.jsx(le,{className:"text-xs",children:s.description})]}),e.jsx(We,{id:o,checked:!!t,onCheckedChange:N=>a(s.key,N)})]}),s.helpMarkdown&&e.jsxs(ce,{children:[e.jsxs(de,{className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ue,{className:"size-3"}),"Where do I find this?",e.jsx(he,{className:"size-3 transition-transform [[data-state=open]_&]:rotate-180"})]}),e.jsx(pe,{children:e.jsx("div",{className:"bg-muted/50 mt-2 rounded-md border p-3",children:e.jsx(I,{content:s.helpMarkdown,className:"text-xs"})})})]}),e.jsx(Y,{children:d&&e.jsx(J.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.15},className:"overflow-hidden",children:e.jsx(me,{className:"mt-1.5",children:d})})})]});const b=()=>{var N,C;switch(s.type){case"text":case"url":return e.jsx(re,{id:o,type:s.type==="url"?"url":"text",value:h,onChange:c=>a(s.key,c.target.value),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"password":return x?e.jsx(xe,{id:o,value:h,showPassword:!1,onChange:c=>{a(s.key,c.target.value.trim()),i&&n("")},onFocus:()=>a(s.key,""),onBlur:y,placeholder:"Saved · type to replace"}):e.jsx(xe,{id:o,value:h,visibleByDefault:s.visibleByDefault??!1,onChange:c=>{a(s.key,c.target.value.trim()),i&&n("")},onBlur:y,onPaste:()=>setTimeout(y,0),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"number":return e.jsx(re,{id:o,type:"number",value:h,onChange:c=>a(s.key,c.target.value?Number(c.target.value):void 0),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"select":return s.displayAs==="radio-cards"?e.jsx("div",{className:"grid grid-cols-2 gap-3",role:"radiogroup","aria-labelledby":`${o}-label`,"aria-required":s.required||void 0,children:(N=s.options)==null?void 0:N.map(c=>e.jsxs("button",{type:"button",role:"radio","aria-checked":h===c.value,onClick:()=>a(s.key,c.value),className:U("hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-ring flex flex-col items-start rounded-md border p-3 text-left transition outline-none focus-visible:ring-[3px]",h===c.value&&"border-primary ring-primary bg-accent/30 ring-1"),children:[e.jsx("span",{className:"text-sm font-medium",children:c.label}),c.description&&e.jsx("span",{className:"text-muted-foreground mt-1 text-xs",children:c.description})]},c.value))}):e.jsxs(X,{value:h,onValueChange:c=>a(s.key,c),children:[e.jsx(Z,{id:o,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0,children:e.jsx(ee,{placeholder:s.placeholder??"Select…"})}),e.jsx(se,{children:(C=s.options)==null?void 0:C.map(c=>e.jsx(te,{value:c.value,children:c.label},c.value))})]});case"textarea":return e.jsx($e,{id:o,value:h,onChange:c=>a(s.key,c.target.value),placeholder:s.placeholder,rows:3,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});default:return null}};return e.jsxs(ie,{children:[e.jsxs(oe,{id:`${o}-label`,htmlFor:v?void 0:o,children:[s.label,s.required&&!x&&e.jsx("span",{"aria-hidden":"true",className:"text-destructive ml-0.5",children:"*"})]}),b(),s.description&&e.jsx(le,{className:"text-xs",children:s.description}),s.helpMarkdown&&e.jsxs(ce,{children:[e.jsxs(de,{className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ue,{className:"size-3"}),"Where do I find this?",e.jsx(he,{className:"size-3 transition-transform [[data-state=open]_&]:rotate-180"})]}),e.jsx(pe,{children:e.jsx("div",{className:"bg-muted/50 mt-2 rounded-md border p-3",children:e.jsx(I,{content:s.helpMarkdown,className:"text-xs"})})})]}),e.jsx(Y,{children:d&&e.jsx(J.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.15},className:"overflow-hidden",children:e.jsx(me,{children:d})})})]})}function os(s,t){return s.showWhen?t[s.showWhen.field]===s.showWhen.equals:!0}function ls({fields:s,allValues:t,renderField:a}){const r=new Map;for(const l of s){const i=l.section;r.has(i)||r.set(i,[]),r.get(i).push(l)}return e.jsx("div",{className:"space-y-6",children:Array.from(r.entries()).map(([l,i])=>{const n=i.filter(o=>os(o,t));return n.length===0?null:e.jsxs("div",{className:"space-y-3",children:[l&&e.jsx("h4",{className:"text-sm font-semibold",children:l}),e.jsx(Ee,{children:e.jsx(Te,{children:n.map(o=>a(o))})})]},l??"__default")})})}const je=["agent","configure","test","confirm"],cs={agent:"Agent",configure:"Set up",test:"Check",confirm:"Review"};function ds({current:s,showAgentStep:t}){const a=t?je:je.filter(l=>l!=="agent"),r=a.indexOf(s);return e.jsx("div",{className:"flex items-start justify-between px-1",role:"navigation","aria-label":"Setup steps",children:a.map((l,i)=>{const n=i<r,o=i===r,v=i>r;return e.jsxs(m.Fragment,{children:[i>0&&e.jsx("div",{className:U("mt-3 h-px flex-1",n||o?"bg-primary":"border-muted-foreground/40 border-t border-dashed")}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:U("flex size-6 items-center justify-center rounded-full text-xs font-medium",n&&"bg-primary text-primary-foreground",o&&"bg-primary text-primary-foreground ring-primary/30 ring-2",v&&"border-muted-foreground text-muted-foreground border"),"aria-current":o?"step":void 0,children:n?e.jsx(Ve,{className:"size-3"}):i+1}),e.jsx("span",{className:U("text-3xs",o?"text-foreground font-medium":"text-muted-foreground"),children:cs[l]})]})]},l)})})}function us({manifest:s,label:t,onLabelChange:a,fields:r,form:l,currentSetupStep:i,hasSetupGuide:n,onOpenGuide:o}){const{Subscribe:v,AppField:h}=l;return e.jsxs("div",{className:"space-y-4",children:[s.setupInstructions&&e.jsxs("div",{className:"flex gap-2 rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200",children:[e.jsx(De,{className:"mt-0.5 size-4 shrink-0"}),e.jsx(I,{content:s.setupInstructions,className:"text-sm text-blue-800 dark:text-blue-200"})]}),(s.actionButton||n)&&e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n&&e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:o,children:[e.jsx(Se,{className:"mr-1.5 size-3.5"}),"Setup guide"]}),s.actionButton&&e.jsx(k,{asChild:!0,type:"button",variant:"outline",size:"sm",children:e.jsx(Pe,{href:s.actionButton.url,children:s.actionButton.label})})]}),i&&e.jsx("h4",{className:"text-sm font-medium",children:i.title}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"adapter-label",children:"Name (optional)"}),e.jsx(re,{id:"adapter-label",placeholder:s.displayName,value:t,onChange:x=>a(x.target.value)}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Helps you tell this connection apart."})]}),e.jsx(v,{selector:x=>x.values,children:x=>e.jsx(ls,{fields:r,allValues:x,renderField:y=>e.jsx(h,{name:y.key,children:d=>{var b;return e.jsx(is,{field:y,value:d.state.value,onChange:(N,C)=>d.handleChange(C),onBlur:d.handleBlur,error:d.state.meta.isTouched?(b=d.state.meta.errors[0])==null?void 0:b.toString():void 0,allValues:x})}},y.key)})})]})}function hs({isPending:s,isSuccess:t,isError:a,errorMessage:r,botUsername:l,onRetry:i}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{size:"lg",className:"text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Trying to reach it…"})]}),t&&e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(Re,{className:"text-status-success size-8"}),e.jsx("p",{className:"text-status-success-fg text-sm",children:"Reachable"}),l&&e.jsx("div",{className:"flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:e.jsxs("span",{className:"font-mono",children:["@",l]})})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Oe,{className:"text-destructive size-8"}),e.jsx("p",{className:"text-destructive text-sm",children:"Not reachable"}),r&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-xs text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300",children:[e.jsx(Le,{className:"mt-0.5 size-3 shrink-0"}),e.jsx("span",{children:r})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:i,children:"Retry"})]})]})}function ps(s){return s.length>8?"•••• "+s.slice(-4):"•••"}function ms({manifest:s,adapterId:t,isEditMode:a,values:r,botUsername:l,agentName:i}){return e.jsxs("div",{className:"space-y-3",children:[!a&&i&&e.jsxs("p",{className:"bg-accent/30 rounded-md border px-3 py-2 text-sm",children:["Messages here go to ",e.jsx("span",{className:"font-medium",children:i}),"."]}),!a&&e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Connection ID"}),e.jsx("span",{className:"font-mono",children:t})]}),s.configFields.map(n=>{if(n.showWhen&&r[n.showWhen.field]!==n.showWhen.equals)return null;const o=String(r[n.key]??""),v=n.type==="password"?ps(o):o;return e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:n.label}),e.jsx("span",{className:"max-w-[200px] truncate font-mono",children:v})]},n.key)}),l&&s.type==="telegram"&&e.jsxs("a",{href:`https://t.me/${l}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex items-center gap-1.5 text-sm underline-offset-4 hover:underline",children:["Message @",l," in Telegram"]})]})}const ye=[{value:"per-chat",label:"One conversation per chat",hint:"Everyone in a chat shares the same thread of memory."},{value:"per-user",label:"One conversation per person",hint:"Each person gets their own thread, even in a shared chat."},{value:"stateless",label:"A fresh start every message",hint:"Nothing carries over from the message before."}];function xs({agentOptions:s,agentId:t,onAgentIdChange:a,strategy:r,onStrategyChange:l}){var n;const i=s.length===1?s[0]:void 0;return m.useEffect(()=>{i&&!t&&a(i.id)},[i,t,a]),s.length===0?e.jsx("p",{role:"alert",className:"text-muted-foreground rounded-md border border-dashed px-4 py-6 text-center text-sm",children:"No agents yet. Add one from the Team page first."}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Messages here go to this agent."}),i?e.jsxs("div",{className:"bg-accent/30 rounded-md border px-4 py-3 text-sm",children:[e.jsx("span",{className:"font-medium",children:ge(i)})," will answer."]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"wizard-agent",children:"Who should answer?"}),e.jsxs(X,{value:t,onValueChange:a,children:[e.jsx(Z,{id:"wizard-agent",className:"w-full",children:e.jsx(ee,{placeholder:"Pick an agent"})}),e.jsx(se,{children:s.map(o=>e.jsx(te,{value:o.id,children:ge(o)},o.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"wizard-memory",children:"How the agent remembers"}),e.jsxs(X,{value:r,onValueChange:o=>l(o),children:[e.jsx(Z,{id:"wizard-memory",className:"w-full",children:e.jsx(ee,{})}),e.jsx(se,{children:ye.map(o=>e.jsx(te,{value:o.value,children:o.label},o.value))})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:(n=ye.find(o=>o.value===r))==null?void 0:n.hint})]})]})}function gs({open:s,onOpenChange:t,title:a,content:r}){return e.jsx(_e,{open:s,onOpenChange:t,children:e.jsxs(Ge,{side:"right",className:"w-[480px] overflow-y-auto sm:max-w-lg",children:[e.jsxs(Ue,{children:[e.jsxs(Ie,{className:"flex items-center gap-2",children:[e.jsx(Se,{className:"size-4"}),a," setup guide"]}),e.jsx(He,{children:"Step-by-step setup instructions."})]}),e.jsx("div",{className:"mt-4 px-4",children:e.jsx(I,{content:r})})]})})}function we(s){const t=s.setupSteps;if(!t||t.length===0)return[];const a=new Set(t.flatMap(r=>r.fields));return s.configFields.filter(r=>!a.has(r.key))}function fs(s,t){return typeof t=="string"||t===void 0||t===null?t:s.valueShape==="id-list"?Array.isArray(t)?t.join(`
|
|
2
|
+
`):t:s.valueShape==="json-object"&&typeof t=="object"?JSON.stringify(t,null,2):t}function js(s,t){const a=s.setupSteps;if(!a||a.length===0)return s.configFields;const r=a[t];if(!r)return s.configFields;const l=s.configFields.filter(i=>r.fields.includes(i.key));return t!==a.length-1?l:[...l,...we(s)]}const ys="Advanced";function K(s){const t={};for(const[a,r]of Object.entries(s)){const l=a.split(".");let i=t;for(let n=0;n<l.length-1;n++){const o=l[n];(!(o in i)||typeof i[o]!="object"||i[o]===null)&&(i[o]={}),i=i[o]}i[l[l.length-1]]=r}return t}function ve(s,t){const a=t.split(".");let r=s;for(const l of a){if(r==null||typeof r!="object")return;r=r[l]}return r}function vs(s,t){const a={};for(const r of s.configFields){const l=t?ve(t,r.key):void 0;l!==void 0&&r.type!=="password"?a[r.key]=fs(r,l):r.type==="password"&&t&&ve(t,r.key)!==void 0?a[r.key]="***":r.default!==void 0?a[r.key]=r.default:a[r.key]=r.type==="boolean"?!1:""}return a}function bs(s,t=[]){const a=s.type;if(!t.includes(a))return a;let r=2;for(;t.includes(`${a}-${r}`);)r++;return`${a}-${r}`}function Ns({manifest:s,existingInstance:t,existingAdapterIds:a=[],onOpenChange:r}){const l=!!t,[i,n]=m.useState(t?"configure":"agent"),[o,v]=m.useState(!1),[h]=m.useState(()=>(t==null?void 0:t.id)??bs(s,a)),[x,y]=m.useState(()=>{var p;return((p=t==null?void 0:t.config)==null?void 0:p.label)??""}),[d,b]=m.useState(0),[N,C]=m.useState(""),[c,P]=m.useState(""),[M,R]=m.useState("per-chat"),E=Qe(),z=Ke(),S=Ye(),W=Je(),{data:F}=Xe(),w=be(),q=Ne(),T=(F==null?void 0:F.agents)??[],B=s.setupSteps&&s.setupSteps.length>0,j=Ze({defaultValues:vs(s,t==null?void 0:t.config),validators:{onSubmit:({value:p})=>{const g={};for(const u of s.configFields)if(!(u.showWhen&&p[u.showWhen.field]!==u.showWhen.equals)&&u.required){const f=p[u.key];(f==null||f==="")&&(g[u.key]=`${u.label} is required`)}return Object.keys(g).length>0?{fields:g}:void 0}},onSubmit:async()=>{}}),$=m.useMemo(()=>{const p=new Set(we(s).map(g=>g.key));return js(s,d).map(g=>p.has(g.key)&&!g.section?{...g,section:ys}:g)},[s,d]),O=m.useCallback(()=>{const p=j.state.values;let g=!0;for(const u of $)if(!(u.showWhen&&p[u.showWhen.field]!==u.showWhen.equals)&&u.required){const f=p[u.key];(f==null||f==="")&&(j.setFieldMeta(u.key,A=>({...A,isTouched:!0,errors:[`${u.label} is required`],errorMap:{onSubmit:`${u.label} is required`}})),g=!1)}return g},[j,$]),L=m.useCallback(()=>{if(i==="agent"){if(!c)return;n("configure");return}if(i==="configure"){if(!O())return;if(B&&s.setupSteps&&d<s.setupSteps.length-1){b(u=>u+1);return}const g=j.state.values;n("test"),S.mutate({type:s.type,config:K(g)},{onSuccess:u=>{u.botUsername&&(C(u.botUsername),x||y(`@${u.botUsername}`))}})}else i==="test"&&n("confirm")},[i,c,B,s,d,O,j,S,x]),V=m.useCallback(()=>{i==="test"?(n("configure"),S.reset()):i==="confirm"?n("test"):i==="configure"&&(B&&d>0?b(p=>p-1):l||n("agent"))},[i,B,d,S,l]),D=m.useCallback(async p=>{try{return await w.removeRelayAdapter(p),!0}catch{return!1}finally{q.invalidateQueries({queryKey:["relay"]})}},[w,q]),H=m.useCallback(()=>{const p=j.state.values,g=K(p),u=x?{...g,label:x}:g;if(l&&t){z.mutate({id:t.id,config:u},{onSuccess:()=>r(!1)});return}if(!c){n("agent");return}E.mutate({type:s.type,id:h,config:u},{onSuccess:()=>{W.mutate({adapterId:h,agentId:c,sessionStrategy:M,label:""},{onSuccess:()=>{var A;const f=((A=T.find(_=>_.id===c))==null?void 0:A.name)??c;G.success(`${s.displayName} is connected`,{description:`Messages here go to ${f}.`}),r(!1)},onError:f=>{n("agent"),D(h).then(A=>{A?G.error("Nothing was set up",{description:`${s.displayName} couldn’t be linked to an agent, so it wasn’t saved. ${f.message}`}):G.error("Couldn’t finish undoing",{description:`${s.displayName} was added with no agent to answer it. Remove it from Messaging. ${f.message}`})})}})},onError:f=>{var A,_,ne;(A=f.message)!=null&&A.includes("timed out")?G.error(`Couldn’t reach ${s.displayName}`,{description:"Check your token and network, then try again."}):((_=f.message)!=null&&_.includes("duplicate")||(ne=f.message)!=null&&ne.includes("exists"))&&(n("configure"),b(0))}})},[j,l,t,z,E,W,s,h,x,c,M,T,D,r]),Ce=m.useCallback(p=>{p||(n(l?"configure":"agent"),b(0),y(""),C(""),P(""),R("per-chat"),v(!1),j.reset(),S.reset()),r(p)},[r,j,S,l]),Ae=m.useCallback(()=>{S.mutate({type:s.type,config:K(j.state.values)})},[S,s.type,j]),Fe=E.isPending||z.isPending||W.isPending,Be=B&&s.setupSteps?s.setupSteps[d]:void 0;return{step:i,isEditMode:l,adapterId:h,label:x,setLabel:y,botUsername:N,guideOpen:o,setGuideOpen:v,form:j,visibleFields:$,bindAgentId:c,setBindAgentId:P,bindStrategy:M,setBindStrategy:R,agentOptions:T,isSaving:Fe,hasSetupSteps:B,setupStepIndex:d,currentSetupStep:Be,testConnection:S,handleContinue:L,handleBack:V,handleSave:H,handleOpenChange:Ce,handleRetryTest:Ae}}function ws({open:s,onOpenChange:t,manifest:a,existingInstance:r,existingAdapterIds:l=[]}){var L;const i=Ns({manifest:a,existingInstance:r,existingAdapterIds:l,onOpenChange:t}),{step:n,isEditMode:o,adapterId:v,label:h,setLabel:x,botUsername:y,guideOpen:d,setGuideOpen:b,form:N,visibleFields:C,bindAgentId:c,setBindAgentId:P,bindStrategy:M,setBindStrategy:R,agentOptions:E,isSaving:z,hasSetupSteps:S,setupStepIndex:W,currentSetupStep:F,testConnection:w,handleContinue:q,handleBack:T,handleSave:B,handleOpenChange:j,handleRetryTest:$}=i,O={agent:"Pick who answers messages here.",configure:(F==null?void 0:F.description)??"Fill in the settings this needs.",test:"Checking the connection…",confirm:"Check it over, then save."}[n];return e.jsxs(m.Fragment,{children:[e.jsx(es,{open:s,onOpenChange:j,children:e.jsxs(ss,{className:"flex max-h-[85vh] max-w-lg flex-col",children:[e.jsxs(ts,{children:[e.jsx(rs,{children:o?`Edit ${a.displayName}`:`Add ${a.displayName}`}),e.jsx(as,{children:O})]}),e.jsxs("div",{className:"min-h-0 space-y-4 overflow-y-auto py-2",children:[e.jsx(ds,{current:n,showAgentStep:!o}),e.jsx(Y,{mode:"wait",children:e.jsxs(J.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[n==="agent"&&e.jsx(xs,{agentOptions:E,agentId:c,onAgentIdChange:P,strategy:M,onStrategyChange:R}),n==="configure"&&e.jsx(us,{manifest:a,label:h,onLabelChange:x,fields:C,form:N,currentSetupStep:F,hasSetupGuide:!!a.setupGuide,onOpenGuide:()=>b(!0)}),n==="test"&&e.jsx(hs,{isPending:w.isPending,isSuccess:w.isSuccess,isError:w.isError,errorMessage:(L=w.error)==null?void 0:L.message,botUsername:y,onRetry:$}),n==="confirm"&&e.jsx(N.Subscribe,{selector:V=>V.values,children:V=>{var D;return e.jsx(ms,{manifest:a,adapterId:v,isEditMode:o,values:V,botUsername:y,agentName:((D=E.find(H=>H.id===c))==null?void 0:D.name)||c})}})]},n)})]}),e.jsxs(ns,{className:"flex items-center justify-between sm:justify-between",children:[e.jsxs("div",{children:[(n==="test"||n==="confirm")&&e.jsxs(k,{variant:"ghost",onClick:T,disabled:z,children:[e.jsx(fe,{className:"mr-1 size-4"}),"Back"]}),n==="configure"&&(S?W>0:!o)&&e.jsxs(k,{variant:"ghost",onClick:T,children:[e.jsx(fe,{className:"mr-1 size-4"}),"Back"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),n==="agent"&&e.jsxs(k,{onClick:q,disabled:!c,children:["Continue",e.jsx(Q,{className:"ml-1 size-4"})]}),n==="configure"&&e.jsxs(k,{onClick:q,children:["Continue",e.jsx(Q,{className:"ml-1 size-4"})]}),n==="test"&&!w.isPending&&!w.isSuccess&&e.jsx(k,{variant:"ghost",onClick:q,children:"Skip"}),n==="test"&&w.isSuccess&&e.jsxs(k,{onClick:q,children:["Continue",e.jsx(Q,{className:"ml-1 size-4"})]}),n==="confirm"&&e.jsxs(k,{onClick:B,disabled:z,children:[z&&e.jsx(ke,{className:"mr-2"}),o?"Save changes":"Connect"]})]})]})]})}),a.setupGuide&&e.jsx(gs,{open:d,onOpenChange:b,title:a.displayName,content:a.setupGuide})]})}export{ws as A,ks as u};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{Y as De,Q as _,ai as Oe,jv as A,ad as W,R as z,U as M,r as v,jw as re,jx as Ke,jy as Q,jz as un,j as n,$ as U,hM as pe,B as k,jA as gn,jB as hn,e as K,aa as D,dk as ze,cA as Me,cB as Be,C as mn,cC as Ve,a1 as xn,hG as oe,e6 as le,aF as ve,jC as We,jD as Qe,jE as he,ep as q,iA as Ue,a3 as fn,am as Se,d7 as yn,jF as pn,jG as vn,jH as me,jI as jn,i as Nn,fT as Cn,hD as kn,dH as J,dI as Y,dJ as Z,dK as X,dL as V,I as xe,jJ as bn,jK as Sn,jL as wn,jM as In,jN as An,er as Ge,es as He,jO as Rn,a0 as En,l as $n,jP as _n,jQ as Fn,jR as Ln,jS as we,jT as Tn,dG as qn,jU as Je,a5 as Pn,a4 as Dn,a2 as On}from"./index-DMYBI16t.js";/**
|
|
2
|
+
* @license lucide-react v1.48.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ye={name:"clock-3",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]};Ye.node;const Ze=De(Ye);/**
|
|
7
|
+
* @license lucide-react v1.48.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Xe={name:"shield-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]};Xe.node;const Kn=De(Xe);function zn(e,t=!0){const s=_();return Oe({queryKey:A.eventDefinitions(e??""),queryFn:({pageParam:a})=>s.listConnectionEventDefinitions(e??"",a),initialPageParam:void 0,getNextPageParam:a=>a.nextCursor,enabled:t&&!!e})}function ns(e,t=!0){const s=_();return Oe({queryKey:A.eventSubscriptions(e??""),queryFn:({pageParam:a})=>s.listConnectionEventSubscriptions(e??"",a),initialPageParam:void 0,getNextPageParam:a=>a.nextCursor,enabled:t&&!!e,refetchInterval:a=>{var i;return(i=a.state.data)!=null&&i.pages.some(o=>o.subscriptions.some(c=>c.state==="pending"))?2e3:!1}})}function ts(){const e=_(),t=z();return M({mutationFn:({connectionId:s,input:a})=>e.createConnectionEventSubscription(s,a),meta:{suppressErrorToast:!0},onSuccess:(s,{connectionId:a})=>{t.invalidateQueries({queryKey:A.eventSubscriptions(a)}),t.invalidateQueries({queryKey:A.connection(a)})}})}function ss(){const e=_(),t=z();return M({mutationFn:({connectionId:s,subscriptionId:a})=>e.deleteConnectionEventSubscription(s,a),meta:{suppressErrorToast:!0},onSettled:async(s,a,{connectionId:i})=>{await t.invalidateQueries({queryKey:A.eventSubscriptions(i)}),await t.invalidateQueries({queryKey:A.connection(i)})}})}function Mn(e,t){const s=_();return W({queryKey:A.eventSource(e??""),queryFn:()=>s.getConnectionEventSource(e??""),enabled:!!e})}function Bn(){const e=_(),t=z();return M({mutationFn:({connectionId:s,input:a})=>e.configureConnectionEventSource(s,a),meta:{suppressErrorToast:!0},onSuccess:(s,{connectionId:a})=>{t.setQueryData(A.eventSource(a),s),t.invalidateQueries({queryKey:A.connection(a)}),t.invalidateQueries({queryKey:A.eventDefinitions(a)}),t.invalidateQueries({queryKey:A.eventSubscriptions(a)})}})}function as(e){const t=_();return W({queryKey:A.reviewList(e),queryFn:()=>t.getConnectorManagementReviews(e)})}function is(e){const t=_();return W({queryKey:A.review(e??""),queryFn:()=>t.getConnectorManagementReview(e??""),enabled:e!==null&&e!==""})}function os(e){const t=_();return W({queryKey:A.agentRequestList(e),queryFn:()=>t.getConnectorAgentRequests(e),meta:{suppressErrorToast:!0}})}function rs(e){const t=_();return W({queryKey:A.sessionAgentRequests(e??""),queryFn:()=>t.getConnectorAgentRequests(void 0,e??""),enabled:!!e,meta:{suppressErrorToast:!0}})}function cs(e){const t=_();return W({queryKey:A.agentRequest(e??""),queryFn:()=>t.getConnectorAgentRequest(e??""),enabled:e!==null&&e!==""})}function Vn(){const e=_(),t=z();return M({mutationFn:({requestId:s,decision:a})=>e.resolveConnectorAgentRequest(s,a),meta:{suppressErrorToast:!0},onSuccess:(s,{requestId:a})=>{t.setQueryData(A.agentRequest(a),s),t.invalidateQueries({queryKey:A.agentRequests(),predicate:i=>i.queryKey[3]!==a}),t.invalidateQueries({queryKey:A.connections()})}})}function Wn(e){const t=_();return M({mutationFn:s=>t.startConnectorAgentRequestAuthentication(e??"",s),meta:{suppressErrorToast:!0}})}function Qn(e,t){var o;const s=_(),a=z(),i=W({queryKey:A.agentRequestAuthentication(e??"",t??""),queryFn:()=>s.pollConnectorAgentRequestAuthentication(e??"",t??""),enabled:!!(e&&t),refetchInterval:c=>{var l;const d=(l=c.state.data)==null?void 0:l.state;return d==="starting"||d==="pending"?2e3:!1},staleTime:0,meta:{suppressErrorToast:!0}});return v.useEffect(()=>{var d;const c=(d=i.data)==null?void 0:d.state;!c||!e||(c==="connected"&&a.invalidateQueries({queryKey:A.connections()}),(c==="connected"||c==="failed"||c==="expired"||c==="start_unknown")&&a.invalidateQueries({queryKey:A.agentRequests(),predicate:l=>l.queryKey[4]!=="authentication-flow"}))},[(o=i.data)==null?void 0:o.state,a,e]),i}function ds(){const e=_(),t=z();return M({mutationFn:({reviewRequestId:s,decision:a})=>e.resolveConnectorManagementReview(s,{decision:a}),meta:{suppressErrorToast:!0},onSuccess:(s,{reviewRequestId:a})=>{t.setQueryData(A.review(a),s.review),t.invalidateQueries({queryKey:A.reviewList("pending")}),t.invalidateQueries({queryKey:A.reviewList("resolved")}),t.invalidateQueries({queryKey:A.connections()})}})}function Un(){const e=_();return M({mutationFn:({connectionId:t})=>e.previewConnectorReconciliation({connectionId:t}),meta:{suppressErrorToast:!0}})}function Gn(){const e=_(),t=z();return M({mutationFn:s=>e.applyConnectorReconciliation(s),meta:{suppressErrorToast:!0},onSuccess:()=>{t.invalidateQueries({queryKey:A.connections()})}})}function Hn(){const e=_(),t=z();return M({mutationFn:({connectionId:s})=>e.stopSharingConnectorWithEveryAgent(s),meta:{suppressErrorToast:!0},onSuccess:()=>{t.invalidateQueries({queryKey:A.connections()})}})}function ls(e,t){var o;const s=_(),a=z(),i=W({queryKey:A.authenticationFlow(e??""),queryFn:()=>s.pollConnectorAuthentication(e??""),enabled:t&&e!==null&&e!=="",refetchInterval:c=>{var l;const d=(l=c.state.data)==null?void 0:l.state;return d==="starting"||d==="pending"?2e3:!1},staleTime:0,gcTime:0,meta:{suppressErrorToast:!0}});return v.useEffect(()=>{var c;((c=i.data)==null?void 0:c.state)==="connected"&&a.invalidateQueries({queryKey:A.connections()})},[(o=i.data)==null?void 0:o.state,a]),i}const Ie={cloud_link_required:{title:"This computer isn’t linked to DorkOS",description:"Link your DorkOS account again. Nothing changed.",action:"relink"},cloud_link_needs_update:{title:"This computer’s link needs updating",description:"Link your DorkOS account again to update it. Nothing changed.",action:"relink"},cloud_unavailable:{title:"DorkOS’s servers aren’t answering",description:"Nothing changed. Try again in a few minutes."},cloud_refused:{title:"DorkOS’s servers couldn’t finish this",description:"Nothing changed. Try again later."}};function en(e){const t=typeof e=="object"&&e!==null&&"code"in e?e.code:void 0;return typeof t=="string"&&Object.hasOwn(Ie,t)?Ie[t]:null}function se(e){if(e)return e.logo??null}function G(e){return Object.fromEntries(e.agents.map(t=>{const s=e.currentGrants.find(a=>a.agentId===t.agentId);return[t.agentId,{operationRevisionIds:[...(s==null?void 0:s.operationRevisionIds)??[]].sort(),...(s==null?void 0:s.level)&&{level:s.level}}]}))}function nn(e,t){const s=[...(e==null?void 0:e.operationRevisionIds)??[]].sort(),a=[...(t==null?void 0:t.operationRevisionIds)??[]].sort();return(e==null?void 0:e.level)===(t==null?void 0:t.level)&&s.length===a.length&&s.every((i,o)=>i===a[o])}function us(e,t){const s=G(e);return e.agents.flatMap(a=>{const i=t[a.agentId];return nn(s[a.agentId],i)?[]:[{agentId:a.agentId,operationRevisionIds:[...(i==null?void 0:i.operationRevisionIds)??[]].sort(),...(i==null?void 0:i.level)&&{level:i.level}}]})}const Jn=5;function P(e){var t;return(((t=e==null?void 0:e.operationRevisionIds)==null?void 0:t.length)??0)===0?"none":(e==null?void 0:e.level)??"custom"}function fe(e){const t=new Set(e.filter(s=>s==="read"||s==="read-write"));return t.size===0?"read":t.size===1?[...t][0]:null}function Yn(e,{preferredAgentIds:t=[],systemAgentIds:s=[]}={}){const a=G(e),i=o=>{if(P(a[o])!=="none")return 0;const c=t.indexOf(o);return c>=0?1+c/(t.length+1):s.includes(o)?2:3};return e.agents.map((o,c)=>({agent:o,index:c,rank:i(o.agentId)})).sort((o,c)=>o.rank-c.rank||o.index-c.index).map(({agent:o})=>o)}function Zn(e,{scope:t,picked:s,level:a,levelTouched:i,allowDowngrade:o=!0}){const c=G(e),d=a?{operationRevisionIds:re(e.candidates,a),level:a}:null,l=new Set(t),h=[],x=[],g=[];let m=!1;for(const j of e.agents){if(!l.has(j.agentId))continue;const f=c[j.agentId]??{operationRevisionIds:[]},u=P(f);let y;s.has(j.agentId)?u==="none"?(d||(m=!0),y=d??f):u==="custom"||!i||!d?y=f:u==="read-write"&&a==="read"?(y=o?d:f,o&&g.push(j.agentId)):y=d:(y={operationRevisionIds:[]},u!=="none"&&x.push(j.agentId)),nn(f,y)||h.push({agentId:j.agentId,...y})}return{changes:h,removedAgentIds:x,downgradedAgentIds:g,needsLevel:m}}function Xn(e){return e.everyAgent.operationRevisionIds.length>0?"every":"picked"}function et(e,{who:t,level:s,levelTouched:a}){if(!e.everyAgent.available)return{needsLevel:!1};const i=P(e.everyAgent);if(t==="picked")return i!=="none"?{everyAgent:{operationRevisionIds:[]},needsLevel:!1}:{needsLevel:!1};if(i==="custom"&&!a)return{needsLevel:!1};if(!s)return{needsLevel:i==="none"};const o=re(e.candidates,s);return i===s||o.length===0?{needsLevel:!1}:{everyAgent:{operationRevisionIds:o,level:s},needsLevel:!1}}function nt(e){const t=P(e.everyAgent);return t==="custom"?null:fe([t])}function tt(e,t){if(t)return t==="read-write";const s=new Set(e.everyAgent.operationRevisionIds);return e.candidates.some(a=>s.has(a.operationRevisionId)&&a.capabilityClassification!=="read")}function st(e,t){if(t)return!1;const s=new Set(e.everyAgent.operationRevisionIds);return e.candidates.some(a=>s.has(a.operationRevisionId)&&a.capabilityClassification==="destructive")}function ce(e,t,s=!0){const a=P(G(e)[t]),i=s&&e.everyAgent.available?P(e.everyAgent):"none";return a==="none"?i:i==="none"?a:a==="custom"||i==="custom"?"custom":a==="read-write"||i==="read-write"?"read-write":"read"}function Ae(e,t){const s=a=>a.map(i=>({agentId:i.agentId,operationRevisionIds:[...i.operationRevisionIds].sort(),level:i.level??null})).sort((i,o)=>i.agentId.localeCompare(o.agentId));return JSON.stringify(s(e))===JSON.stringify(s(t))}function Re(e,t){return e===void 0||t===void 0?e===t:JSON.stringify([...e].sort())===JSON.stringify([...t].sort())}function at({connectionId:e,active:t,onPreview:s}){const a=Un(),i=Gn(),o=Ke(e,!1),[c,d]=v.useState(!1),[l,h]=v.useState(null),x=v.useRef(s);v.useEffect(()=>{x.current=s});const g=()=>{e&&(a.reset(),i.reset(),a.mutate({connectionId:e},{onSuccess:N=>{var p;return(p=x.current)==null?void 0:p.call(x,N)}}))};v.useEffect(()=>{!t||!e||g()},[t,e]);const m=a.data,j=()=>{d(!1),h(null),g()},f=(N,p,R={})=>{if(!(!m||N.length===0&&!p&&!R.confirm)){if(Date.parse(m.expiresAt)<=Date.now()){d(!0);return}i.mutate({previewId:m.previewId,grants:N,...p&&{everyAgent:p}},{onSuccess:w=>{var E;if(w.connectionId!==m.connection.connectionId||!Ae(N,w.grants)||!Re(p==null?void 0:p.operationRevisionIds,(E=w.everyAgent)==null?void 0:E.operationRevisionIds)){d(!0),a.reset();return}h(w)},onError:()=>{d(!0),a.reset()}})}},u=()=>{o.refetch().then(N=>{var $,T;if(!N.data||!l||!e)return;const p=l.grants,R=p.map(C=>{var b;return{agentId:C.agentId,operationRevisionIds:((b=N.data.agents.find(O=>O.agentId===C.agentId))==null?void 0:b.operationRevisionIds)??[],...C.level&&{level:C.level}}});if(N.data.connection.connectionId!==e||l.connectionId!==e||!Ae(p,R)||l.everyAgent!==void 0&&!Re(l.everyAgent.operationRevisionIds,(($=N.data.connection.everyAgent)==null?void 0:$.operationRevisionIds)??[])){d(!0),h(null),a.reset();return}const w=p.flatMap(C=>{const b=N.data.agents.find(O=>O.agentId===C.agentId);return b?[b]:[]}),E=N.data.connection.reconciliationStatus!=="ready"?N.data.connection.reconciliationStatus:((T=w.find(C=>C.reconciliationStatus!=="ready"))==null?void 0:T.reconciliationStatus)??"ready",L=[N.data.connection.authoritySync,...w.map(C=>C.authoritySync)],I=L.find(C=>C.status==="failed")??(L.some(C=>C.status==="pending")?{status:"pending"}:{status:"ready"});h({...l,reconciliationStatus:E,authoritySync:I})})},y=(l==null?void 0:l.reconciliationStatus)==="ready"&&l.authoritySync.status==="ready",S=l!==null&&l.reconciliationStatus!=="ready";return{preview:m,isLoading:a.isPending,loadFailed:a.isError,loadError:a.error,isSaving:i.isPending,needsRefresh:c,saveOutcome:l,saved:y,needsReconciliation:S,isCheckingSync:o.isFetching,syncCheckFailed:o.isError,refresh:j,apply:f,checkSync:u}}const it=6;function ye(e){return e==="read"?"look":"change"}function je(e,t){var i;const s=(i=e.displayName)==null?void 0:i.trim();return s?s.split(/\s+/u).map((o,c)=>c===0?`${o.charAt(0).toUpperCase()}${o.slice(1)}`:/[A-Z]/u.test(o.slice(1))?o:o.toLowerCase()).join(" "):un(e.operationSlug,t)}function ot(e,t){const s=new Map((t??[]).map((o,c)=>[o.operationSlug,{action:o,index:c}])),a=new Set,i=[];return e.forEach((o,c)=>{if(!o.supported)return;const d=`${o.operationSlug}
|
|
12
|
+
${o.capabilityClassification}`;if(a.has(d))return;a.add(d);const l=s.get(o.operationSlug);i.push({action:{operationSlug:o.operationSlug,...(l==null?void 0:l.action.displayName)!==void 0&&{displayName:l.action.displayName},capabilityClassification:o.capabilityClassification,important:(l==null?void 0:l.action.important)??!1},order:l?l.index:s.size+c})}),i.sort((o,c)=>o.order-c.order).map(({action:o})=>o)}function rt(e){return[...e.filter(t=>t.important),...e.filter(t=>!t.important)]}function ct(e,t){const s=rt(e),a=s.filter(o=>ye(o.capabilityClassification)==="look"),i=s.filter(o=>ye(o.capabilityClassification)==="change");return t===null?{look:a,change:i,addedByReadWrite:[],outsideLevels:[]}:{look:a.filter(o=>Q(o.capabilityClassification,t)),change:i.filter(o=>Q(o.capabilityClassification,t)),addedByReadWrite:i.filter(o=>!Q(o.capabilityClassification,t)&&Q(o.capabilityClassification,"read-write")),outsideLevels:i.filter(o=>!Q(o.capabilityClassification,"read-write"))}}function dt(e){return e.some(t=>Q(t.capabilityClassification,"read-write")&&!Q(t.capabilityClassification,"read"))}function Ee(e,t){const s=e.slice(0,2).map(i=>lt(je(i,t))),a=e.length-s.length;return a>0?`${s.join(", ")} and ${a} more`:s.join(" and ")}function lt(e){const t=e.split(" ")[0]??"";return/[A-Z]/u.test(t.slice(1))?e:`${e.charAt(0).toLowerCase()}${e.slice(1)}`}const de={read:"Read","read-write":"Read and write"},$e={...de,custom:"Exact actions"};function ue(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}const ut={gmail:"send email",outlook:"send email",slack:"send messages",googlecalendar:"change your calendar",google_calendar:"change your calendar",calendar:"change your calendar",googledrive:"change your files",google_drive:"change your files",notion:"change your pages",github:"make changes on GitHub",linear:"change your issues"};function gt(e,t,s=!1){return`Every agent, even future ones, could ${ut[e.toLowerCase()]??`make changes in ${t}`} as you${s?", including high-risk actions":""}.`}function ht({error:e,title:t,description:s,...a}){const i=en(e);return n.jsxs("div",{className:"space-y-2",children:[n.jsx(U,{title:(i==null?void 0:i.title)??t,description:(i==null?void 0:i.description)??s,...a}),(i==null?void 0:i.action)==="relink"&&n.jsx(tn,{variant:"outline",size:"sm"})]})}function tn(e){const t=pe();return n.jsx(k,{...e,onClick:()=>t.open("account",gn),children:"Link my DorkOS account again"})}const sn={look:"Look",change:"Change"};function mt({toolkit:e,appName:t,providerInstanceId:s,grant:a}){var g;const i=v.useId(),o=hn(e,s),c=((g=o.data)==null?void 0:g.status)==="listed"?o.data:null,d=a&&a.candidates.length>0?a:null,l=(d==null?void 0:d.level)??null,h=l?`With “${de[l]}”, agents can`:`What ${t} offers agents`;let x;if(d)x=s&&o.isPending?n.jsx(_e,{}):n.jsx(Fe,{actions:ot(d.candidates,c==null?void 0:c.actions),completeness:"complete",toolkit:e,appName:t,level:l});else if(!s||xt(o.error))x=n.jsxs("p",{className:"text-muted-foreground text-sm",children:["Shows once DorkOS can reach ",t,"."]});else if(o.isPending)x=n.jsx(_e,{});else if(o.isError){const m=en(o.error);x=n.jsxs("p",{className:"text-muted-foreground flex flex-wrap items-center gap-x-2 text-sm",children:[m?`${m.title}. ${m.description}`:`Couldn’t load what ${t} offers agents.`,n.jsx(k,{variant:"link",size:"xs",className:"h-auto p-0",onClick:()=>void o.refetch(),disabled:o.isFetching,children:"Try again"}),(m==null?void 0:m.action)==="relink"&&n.jsx(tn,{variant:"link",size:"xs",className:"h-auto p-0"})]})}else c?x=n.jsx(Fe,{actions:c.actions,completeness:c.completeness,toolkit:e,appName:t,level:null}):x=n.jsxs("p",{className:"text-muted-foreground text-sm",children:["DorkOS can’t list ",t,"’s actions. Everything agents do in ",t," counts as a change."]});return n.jsxs("section",{"aria-labelledby":i,className:"space-y-2.5","data-testid":"app-actions",children:[n.jsx("p",{id:i,className:"text-muted-foreground text-xs font-medium",children:h}),x]})}function _e(){return n.jsxs(n.Fragment,{children:[n.jsx(K,{className:"h-16 rounded-lg"}),n.jsx("span",{className:"sr-only",children:"Loading what agents can do"})]})}function xt(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="provider_not_found"}function Fe({actions:e,completeness:t,toolkit:s,appName:a,level:i}){if(e.length===0)return n.jsxs("p",{className:"text-muted-foreground text-sm",children:[a," offers no actions."]});const o=ct(e,i),c=o.outsideLevels,d=[];if(i==="read-write"&&o.change.length>0&&d.push("Pick “Read” and only Look stays."),i==="read"&&o.addedByReadWrite.length>0&&d.push(`Pick “Read and write” to also let agents ${Ee(o.addedByReadWrite,s)}.`),i!==null&&c.length>0){const l=c.length>1;d.push(`${yt(Ee(c,s))} ${l?"aren’t":"isn’t"} part of ${dt(e)?"either level":"“Read”"}. To allow ${l?"them":"it"}, choose exact actions.`)}return t==="too_large"?d.push(`Showing the first ${e.length}. ${a} has more.`):t==="interrupted"&&d.push(`Showing the first ${e.length}. The rest didn’t load this time.`),n.jsxs("div",{className:"space-y-3",children:[o.look.length===0&&o.change.length===0?n.jsx("p",{className:"text-sm",children:"Nothing at this level."}):n.jsxs(n.Fragment,{children:[n.jsx(Le,{kind:"look",actions:o.look,toolkit:s}),n.jsx(Le,{kind:"change",actions:o.change,toolkit:s})]}),d.map(l=>n.jsx("p",{className:"text-muted-foreground text-xs",children:l},l)),n.jsx(ft,{actions:e,complete:t==="complete",toolkit:s})]})}function Le({kind:e,actions:t,toolkit:s}){if(t.length===0)return null;const a=t.slice(0,it),i=t.length-a.length;return n.jsxs("div",{className:"space-y-1.5","data-testid":`app-actions-${e}`,children:[n.jsx("p",{className:"text-sm font-medium",children:sn[e]}),n.jsxs("ul",{className:"flex flex-wrap gap-1.5",children:[a.map(o=>n.jsx("li",{className:D("rounded-full px-2.5 py-0.5 text-xs",e==="look"?"bg-muted text-foreground":ze.warning),children:je(o,s)},`${o.operationSlug}-${o.capabilityClassification}`)),i>0&&n.jsxs("li",{className:"text-muted-foreground px-1 py-0.5 text-xs",children:["+",i," more"]})]})]})}function ft({actions:e,complete:t,toolkit:s}){const a=`${e.length} ${e.length===1?"action":"actions"}`;return n.jsxs(Me,{children:[n.jsxs(Be,{className:"group/all text-primary focus-ring flex items-center gap-0.5 rounded-sm text-xs font-medium hover:underline",children:[t?`See all ${a}`:`See the first ${a}`,n.jsx(mn,{className:"size-3.5 transition-transform group-data-[state=open]/all:rotate-90","aria-hidden":!0})]}),n.jsx(Ve,{children:n.jsx("ul",{className:"border-border mt-2 max-h-72 divide-y overflow-y-auto rounded-lg border","data-testid":"app-actions-all",children:e.map(i=>{const o=ye(i.capabilityClassification);return n.jsxs("li",{className:"flex items-start justify-between gap-3 px-3 py-1.5 text-sm",children:[n.jsx("span",{className:"min-w-0 break-words",children:je(i,s)}),n.jsx("span",{className:D("mt-0.5 shrink-0 rounded-full px-2 py-0 text-xs",o==="look"?"bg-muted text-muted-foreground":ze.warning),children:sn[o]})]},`${i.operationSlug}-${i.capabilityClassification}`)})})})]})}function yt(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function ee({titleId:e,toolkit:t,serviceName:s,logo:a,title:i,subtitle:o,variant:c="card",className:d,children:l}){const h=c==="embedded";return n.jsxs("section",{"aria-labelledby":e,"data-testid":"connection-access-card",className:D(h?"space-y-3":"bg-card space-y-4 rounded-xl border p-4",d),children:[n.jsxs("header",{className:"flex items-start gap-3",children:[!h&&n.jsx(xn,{iconKey:t??"",displayName:s,logo:a,className:"size-9 rounded-lg"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{id:e,className:"text-sm font-semibold",children:i}),o&&n.jsx("div",{className:"text-muted-foreground mt-0.5 text-xs",children:o})]})]}),l]})}function pt({access:e,savedDetail:t="Ready for the agents you changed."}){const{saveOutcome:s}=e,a=s==null?void 0:s.grants.some(c=>c.operationRevisionIds.length>0),i=s==null?void 0:s.grants.some(c=>c.operationRevisionIds.length===0),o=e.syncCheckFailed&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t check if the change is done. Nothing was sent twice."});return e.needsRefresh?n.jsxs("div",{className:"border-destructive/30 bg-destructive/5 space-y-3 rounded-lg border p-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(oe,{className:"text-destructive mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("p",{role:"alert",className:"text-sm font-medium",children:"Couldn’t confirm access was saved"}),n.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"Reload access before another change."})]})]}),n.jsxs(k,{size:"sm",variant:"secondary",className:"h-auto min-h-9 whitespace-normal",onClick:e.refresh,children:[n.jsx(le,{className:"size-4","aria-hidden":!0}),"Reload current access"]})]}):e.saved?n.jsxs("div",{className:"border-status-success/30 bg-status-success/5 flex items-start gap-3 rounded-lg border p-4",children:[n.jsx(ve,{className:"text-status-success mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("p",{"data-testid":"connector-access-outcome",className:"text-sm font-medium",children:"Access updated"}),n.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:t})]})]}):e.needsReconciliation?n.jsxs("div",{className:"border-status-warning/30 bg-status-warning/5 flex items-start gap-3 rounded-lg border p-4",children:[n.jsx(oe,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("p",{"data-testid":"connector-access-outcome",className:"text-sm font-medium",children:"Access needs review"}),n.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"Available actions changed. Reload access before another change."})]})]}):(s==null?void 0:s.authoritySync.status)==="pending"?n.jsxs("div",{className:"border-status-warning/30 bg-status-warning/5 space-y-3 rounded-lg border p-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Ze,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("p",{"data-testid":"connector-access-outcome",className:"text-sm font-medium",children:"Access update pending"}),n.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:a&&i?"Removed access has ended. New access works once DorkOS finishes.":i?"Removed access has ended here. DorkOS is still removing it at the service.":"New access is saved. It works once DorkOS finishes."})]})]}),o]}):(s==null?void 0:s.authoritySync.status)==="failed"?n.jsxs("div",{className:"border-destructive/30 bg-destructive/5 space-y-3 rounded-lg border p-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(oe,{className:"text-destructive mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{children:[n.jsx("p",{"data-testid":"connector-access-outcome",role:"alert",className:"text-sm font-medium",children:"Access didn’t update"}),n.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[s.authoritySync.reason," Agents can’t use this yet. Check your account, then try again."]})]})]}),o]}):null}function an(e,t){return e.filter(s=>s.toolkit===t&&(s.readiness.state==="ready"||s.readiness.reason==="access_updating"))}function vt({props:e,renderAccess:t}){var m;const s=v.useId(),a=We(),i=an(((m=a.data)==null?void 0:m.connections)??[],e.toolkit),[o,c]=v.useState(null),[d,l]=v.useState(null),h=i.length===1?i[0].connectionId:null,x=d??(h?{id:h,picked:!1}:null);if(v.useEffect(()=>{!d&&h&&l({id:h,picked:!1})},[d,h]),x)return t(x.id,x.picked?()=>l(null):void 0);const g=`Which ${e.serviceName} account?`;return n.jsxs(ee,{titleId:s,toolkit:e.toolkit,serviceName:e.serviceName,logo:e.logo,title:g,className:e.className,children:[a.isPending?n.jsx(K,{className:"h-16 rounded-lg","aria-label":"Loading accounts"}):a.isError?n.jsx(U,{title:"Couldn’t load your accounts",description:"Nothing changed. Try again.",onRetry:()=>void a.refetch(),isRetrying:a.isFetching}):i.length===0?n.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",e.serviceName," account is ready yet."]}):n.jsx(Qe,{"aria-labelledby":s,value:o??"",onValueChange:c,className:"gap-2",children:i.map(j=>{const f=`${s}-${j.connectionId}`;return n.jsxs("div",{className:"bg-muted/40 flex min-h-11 items-center gap-3 rounded-lg px-3",children:[n.jsx(he,{id:f,value:j.connectionId}),n.jsxs(q,{htmlFor:f,className:"min-w-0 flex-1 cursor-pointer flex-col items-start gap-0.5 py-2 leading-snug font-normal",children:[n.jsx("span",{className:"block max-w-full truncate text-sm font-medium",children:j.label}),j.identityHint&&n.jsx("span",{className:"text-muted-foreground block max-w-full truncate text-xs",children:j.identityHint})]})]},j.connectionId)})}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.onSkip&&n.jsx(k,{variant:"ghost",onClick:e.onSkip,children:"Not now"}),i.length>1&&n.jsx(k,{disabled:!o,onClick:()=>o&&l({id:o,picked:!0}),children:"Continue"})]})]})}function jt({preview:e,serviceName:t,preferredAgentIds:s,systemAgentIds:a,picked:i,setPicked:o,decision:c,showAll:d,setShowAll:l}){const h=v.useId(),x=G(e),g=Yn(e,{preferredAgentIds:s,systemAgentIds:a}),m=d?g:g.filter((f,u)=>u<Jn||i.has(f.agentId)||P(x[f.agentId])!=="none"),j=f=>{var u;return(u=e.agents.find(y=>y.agentId===f))==null?void 0:u.displayName};return n.jsxs("fieldset",{className:"space-y-1",children:[n.jsxs("legend",{className:"sr-only",children:["Agents that can use ",t]}),m.map(f=>{const u=`${h}-${f.agentId}`,y=P(x[f.agentId]),S=c.removedAgentIds.includes(f.agentId)||c.downgradedAgentIds.includes(f.agentId);return n.jsxs("div",{className:"hover:bg-muted/60 flex min-h-11 items-center gap-3 rounded-md px-2",children:[n.jsx(Ue,{id:u,"aria-describedby":S?`${u}-loss`:void 0,checked:i.has(f.agentId),onCheckedChange:N=>{const p=new Set(i);N===!0?p.add(f.agentId):p.delete(f.agentId),o(p)}}),n.jsx(q,{htmlFor:u,className:"min-w-0 flex-1 cursor-pointer py-2 font-normal",children:n.jsx("span",{className:"truncate",children:f.displayName})}),y!=="none"&&n.jsx(fn,{size:"xs",variant:"secondary","aria-label":`Now: ${$e[y]}`,children:$e[y]})]},f.agentId)}),m.length<g.length&&n.jsxs(k,{variant:"ghost",size:"sm",onClick:()=>l(!0),children:["Show all ",g.length]}),n.jsxs("div",{"aria-live":"polite",className:"space-y-1",children:[c.removedAgentIds.map(f=>n.jsxs("p",{id:`${h}-${f}-loss`,className:"text-foreground flex items-start gap-1.5 px-2 text-xs",children:[n.jsx(Se,{className:"text-status-warning-dot mt-0.5 size-3 shrink-0","aria-hidden":!0}),j(f)," will lose access to ",t,"."]},f)),c.downgradedAgentIds.map(f=>n.jsxs("p",{id:`${h}-${f}-loss`,className:"text-foreground flex items-start gap-1.5 px-2 text-xs",children:[n.jsx(Se,{className:"text-status-warning-dot mt-0.5 size-3 shrink-0","aria-hidden":!0}),j(f)," will lose write access."]},f))]})]})}function Nt({preview:e,level:t,serviceName:s}){return tt(e,t)?n.jsxs("p",{role:"note","data-testid":"every-agent-warning",className:"border-status-warning-border bg-status-warning-bg text-foreground flex items-start gap-2 rounded-lg border px-3 py-2 text-xs",children:[n.jsx(oe,{className:"text-status-warning-dot mt-0.5 size-3.5 shrink-0","aria-hidden":!0}),gt(e.connection.toolkit,s,st(e,t))]}):null}const Ct={read:e=>`It wants to read ${e}.`,"read-write":e=>`It wants to read and change things in ${e}.`};function kt({agentName:e,serviceName:t,reason:s,access:a,level:i}){return n.jsxs("div",{className:"bg-muted/40 space-y-1.5 rounded-lg p-3 text-sm","data-testid":"requested-access",children:[n.jsxs("p",{children:[n.jsxs("span",{className:"text-muted-foreground",children:[e," asked: "]}),s]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:Ct[a](t)}),a==="read-write"&&i==="read"&&n.jsxs("p",{className:"text-xs",role:"status",children:["With Read, ",e," can’t change ",t,"."]})]})}function Te(e,t,s){return t==="read-write"?`${e} can read and write in ${s}.`:`${e} can read ${s}.`}function bt(e){var x;const{preview:t,serviceName:s,decision:a,level:i}=e,o=g=>{var m;return((m=t.agents.find(j=>j.agentId===g))==null?void 0:m.displayName)??"The agent"};if(e.mode==="agent")return Te(o(e.agentId??""),i,s);if(e.who==="every")return Te("Every agent",i,s);const c=t.agents.filter(g=>e.picked.has(g.agentId)).map(g=>g.displayName),d=[c.length>0?`${ue(c)} can use ${s}.`:`No agent can use ${s}.`];((x=e.every.everyAgent)==null?void 0:x.operationRevisionIds.length)===0&&d.push(`${s} is no longer shared with every agent.`);const l=a.downgradedAgentIds.map(o);l.length>0&&d.push(`${ue(l)} can now only read.`);const h=a.removedAgentIds.map(o);return h.length>0&&d.push(`${ue(h)} can no longer use it.`),d.join(" ")}function St({connectionId:e,serviceName:t}){var i;const s=Ke(e,!0),a=Hn();return a.isSuccess?n.jsxs("p",{role:"status",className:"text-sm",children:["Stopped sharing ",t," with every agent."]}):(i=s.data)!=null&&i.connection.everyAgent?n.jsxs("div",{className:"bg-muted/40 flex flex-wrap items-center justify-between gap-2 rounded-lg p-3 text-sm",children:[n.jsxs("span",{children:["Every agent can use ",t," now."]}),n.jsx(k,{size:"sm",variant:"secondary",disabled:a.isPending,onClick:()=>a.mutate({connectionId:e}),children:"Stop sharing with every agent"}),a.isError&&n.jsx("p",{role:"alert",className:"text-destructive w-full text-xs",children:"Couldn’t stop sharing. Try again."})]}):null}function wt({value:e,onChange:t,everyAgentAvailable:s}){const a=v.useId();return n.jsxs(Qe,{value:e,onValueChange:i=>t(i),"aria-label":"Who can use it",className:"gap-1.5",children:[n.jsxs("div",{className:"flex min-h-11 items-center gap-3 rounded-md px-2",children:[n.jsx(he,{value:"picked",id:`${a}-picked`}),n.jsx(q,{htmlFor:`${a}-picked`,className:"flex-1 cursor-pointer py-2 font-normal",children:"Only agents you pick"})]}),n.jsxs("div",{className:"flex min-h-11 items-start gap-3 rounded-md px-2 py-2",children:[n.jsx(he,{value:"every",id:`${a}-every`,disabled:!s,"aria-describedby":s?void 0:`${a}-every-unavailable`,className:"mt-0.5"}),n.jsxs(q,{htmlFor:`${a}-every`,className:"flex-1 cursor-pointer flex-col items-start gap-0.5 font-normal",children:[n.jsx("span",{children:"Every agent"}),n.jsx("span",{className:"text-muted-foreground text-xs",children:"Including agents you add later"}),!s&&n.jsx("span",{id:`${a}-every-unavailable`,className:"text-muted-foreground text-xs",children:"Not available here. Pick agents one by one."})]})]})]})}function It(e){return e.mode==="agent"&&!e.connectionId?n.jsx(vt,{props:e,renderAccess:(t,s)=>n.jsx(qe,{...e,connectionId:t,onChangeAccount:s},t)}):n.jsx(qe,{...e,connectionId:e.connectionId},e.connectionId)}function qe(e){var C;const t=v.useId(),[s,a]=v.useState(new Set),[i,o]=v.useState("read"),[c,d]=v.useState("picked"),[l,h]=v.useState(!1),[x,g]=v.useState(!1),{data:m}=yn(void 0,e.mode==="page"),[j,f]=v.useState(null),u=at({connectionId:e.connectionId,active:!0,onPreview:b=>{f(b.connection);const O=G(b),ne=e.mode==="agent"?[e.agentId]:b.agents.map(B=>B.agentId).filter(B=>P(O[B])!=="none");a(new Set(e.mode==="agent"?[e.agentId]:ne));const ae=e.mode==="page"?Xn(b):"picked";d(ae);const te=ae==="every"?nt(b):e.mode==="agent"?fe([ce(b,e.agentId,!!e.onAllowed)]):fe(ne.map(B=>P(O[B]))),ie=e.mode==="agent"&&e.request?e.request.access:null;o(ie==="read-write"||te==="read-write"?"read-write":te),h(!1)}}),{preview:y}=u,S=e.mode==="agent"?e.agentId:null,N=v.useMemo(()=>y?Zn(y,{scope:S?[S]:c==="every"?[]:y.agents.map(b=>b.agentId),picked:s,level:i,levelTouched:S!==null||l,allowDowngrade:S===null}):{changes:[],removedAgentIds:[],downgradedAgentIds:[],needsLevel:!1},[y,s,i,l,S,c]),p=v.useMemo(()=>y&&S===null?et(y,{who:c,level:i,levelTouched:l}):{needsLevel:!1},[y,S,c,i,l]),R=y&&S?ce(y,S,e.mode==="agent"&&!!e.onAllowed):"none",w=e.mode==="agent"?e.onAllowed:void 0,E=w!==void 0&&y!==void 0&&(N.changes.length===0||R===i||R==="read-write")&&!N.needsLevel&&R!=="none"&&y.agents.some(b=>b.agentId===S),L=v.useRef(!1);v.useEffect(()=>{!u.saved||!w||L.current||(L.current=!0,w(e.connectionId))},[u.saveOutcome,u.saved,w,e.connectionId]);const r=e.mode==="agent"?(C=y==null?void 0:y.agents.find(b=>b.agentId===e.agentId))==null?void 0:C.displayName:void 0,I=e.mode==="page"?`Who can use ${e.serviceName}?`:`Let ${r??"this agent"} use ${e.serviceName}?`,$=u.needsRefresh||u.saveOutcome!==null,T=(j||e.onChangeAccount)&&n.jsxs("span",{className:"flex flex-wrap items-center gap-x-2",children:[j&&n.jsx("span",{className:"truncate",children:j.label}),e.onChangeAccount&&!$&&n.jsx(k,{variant:"link",size:"xs",className:"h-auto p-0",onClick:e.onChangeAccount,children:"Change account"})]});return n.jsxs(ee,{titleId:t,toolkit:(j==null?void 0:j.toolkit)??(e.mode==="agent"?e.toolkit:void 0),serviceName:e.serviceName,logo:e.logo,title:I,subtitle:e.variant==="embedded"?void 0:T,variant:e.variant,className:e.className,children:[u.isLoading?n.jsxs("div",{className:"space-y-2","aria-label":"Loading access",children:[n.jsx(K,{className:"h-10 rounded-lg"}),n.jsx(K,{className:"h-8 rounded-lg"})]}):u.loadFailed?n.jsxs("div",{className:"space-y-2",children:[n.jsx(ht,{error:u.loadError,title:"Couldn’t load who can use it",description:"Nothing changed. Try again.",onRetry:u.refresh,isRetrying:u.isLoading}),e.mode==="page"&&n.jsx(St,{connectionId:e.connectionId,serviceName:e.serviceName}),e.onEditExactActions&&n.jsx(on,{onClick:()=>{var b;return(b=e.onEditExactActions)==null?void 0:b.call(e,e.connectionId)}})]}):$?n.jsx(pt,{access:u,savedDetail:y?bt({mode:e.mode,...e.mode==="agent"&&{agentId:e.agentId},serviceName:e.serviceName,preview:y,picked:s,level:i,decision:N,who:c,every:p}):void 0}):y?n.jsx(At,{props:e,preview:y,picked:s,setPicked:a,who:c,setWho:d,decision:N,level:i,setLevel:b=>{o(b),h(!0)},showAll:x,setShowAll:g,systemAgentIds:((m==null?void 0:m.agents)??[]).filter(b=>b.isSystem).map(b=>b.id)}):null,n.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[u.needsReconciliation?n.jsx(k,{variant:"secondary",onClick:u.refresh,children:"Reload current access"}):u.saveOutcome&&!u.saved?n.jsxs(k,{variant:"secondary",onClick:u.checkSync,disabled:u.isCheckingSync,children:[n.jsx(le,{className:"size-4","aria-hidden":!0}),u.isCheckingSync?"Checking…":"Check if it’s done"]}):null,$?e.onFinished?n.jsx(k,{variant:u.saved?"default":"ghost",onClick:e.onFinished,children:u.saved?"Done":"Close"}):u.saveOutcome&&n.jsx(k,{variant:"ghost",onClick:u.refresh,children:"Edit again"}):y&&n.jsxs(n.Fragment,{children:[e.onSkip&&n.jsx(k,{variant:"ghost",onClick:e.onSkip,children:e.mode==="page"?"Skip":"Not now"}),n.jsx(k,{onClick:()=>E?w==null?void 0:w(e.connectionId):u.apply(N.changes,p.everyAgent),disabled:!E&&(N.changes.length===0&&!p.everyAgent||N.needsLevel||p.needsLevel||u.isSaving),children:u.isSaving?"Saving…":e.mode==="page"?"Save":"Allow"})]})]})]})}function At({props:e,preview:t,picked:s,setPicked:a,who:i,setWho:o,decision:c,level:d,setLevel:l,showAll:h,setShowAll:x,systemAgentIds:g}){var L;const m=v.useId(),j=G(t),f=re(t.candidates,"read"),u=re(t.candidates,"read-write"),y=u.length>f.length?["read","read-write"]:["read"],S=e.mode==="agent"&&ce(t,e.agentId,!!e.onAllowed)==="read-write"?y.filter(r=>r==="read-write"):y,N=u.length===0,p=e.onEditExactActions&&n.jsx(on,{onClick:()=>{var r;return(r=e.onEditExactActions)==null?void 0:r.call(e,e.connectionId)}});let R;if(e.mode==="agent"){const r=t.agents.find(C=>C.agentId===e.agentId),I=P(j[e.agentId]),$=ce(t,e.agentId,!!e.onAllowed);R=r?I==="custom"?n.jsxs("p",{className:"text-muted-foreground text-sm",children:[r.displayName," already has exact actions here."," ",e.onEditExactActions?"Choose exact actions to change them.":"Change them on the Connections page."]}):I===d?n.jsxs("p",{className:"text-muted-foreground text-sm",children:[r.displayName," can already do this."]}):$===d||$==="read-write"&&d==="read"?n.jsxs("p",{className:"text-muted-foreground text-sm",children:[r.displayName," already can, like every agent."]}):null:n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"This agent isn’t registered here, so it can’t get access."})}else i==="every"?R=null:t.agents.length===0?R=n.jsx("p",{className:"text-muted-foreground text-sm",children:"No agents yet. Add one first."}):R=n.jsx(jt,{preview:t,serviceName:e.serviceName,preferredAgentIds:e.preferredAgentIds,systemAgentIds:g,picked:s,setPicked:a,decision:c,showAll:h,setShowAll:x});const w=e.mode==="agent"&&!t.agents.some(r=>r.agentId===e.agentId),E=e.mode==="agent"&&P(j[e.agentId])==="custom";return n.jsxs("div",{className:"space-y-4",children:[e.mode==="page"&&n.jsx(wt,{value:i,onChange:o,everyAgentAvailable:t.everyAgent.available}),e.mode==="agent"&&e.request&&n.jsx(kt,{agentName:((L=t.agents.find(r=>r.agentId===e.agentId))==null?void 0:L.displayName)??"The agent",serviceName:e.serviceName,reason:e.request.reason,access:e.request.access,level:d}),R,N?n.jsxs("p",{className:"text-muted-foreground text-sm",children:[e.serviceName," has no actions for agents yet."]}):!w&&!E&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("p",{id:`${m}-level`,className:"text-muted-foreground text-xs font-medium",children:e.mode==="page"?"They can":"It can"}),S.length>1?n.jsx(pn,{"aria-labelledby":`${m}-level`,value:d??"",onValueChange:r=>l(r),children:S.map(r=>n.jsx(vn,{value:r,className:"min-h-9",children:de[r]},r))}):n.jsx("p",{className:"text-sm",children:de[S[0]]}),d===null&&n.jsx("p",{className:"text-muted-foreground text-xs",children:i==="every"?t.everyAgent.operationRevisionIds.length>0?"Every agent has exact actions now. Pick a level to replace them.":"Pick what every agent can do.":"Your agents have different access. Pick one for every ticked agent."}),e.mode==="page"&&i==="every"&&n.jsx(Nt,{preview:t,level:d,serviceName:e.serviceName})]}),e.mode==="page"&&e.appActions&&n.jsx(mt,{toolkit:e.appActions.toolkit,appName:e.serviceName,providerInstanceId:e.appActions.providerInstanceId,grant:{candidates:t.candidates,level:N?null:d}}),(e.mode==="page"||p)&&n.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center justify-between gap-2 text-xs",children:[e.mode==="page"&&i==="picked"&&n.jsx("span",{children:"Others can still ask you in chat."}),p]})]})}function on({onClick:e}){return n.jsx(k,{variant:"link",size:"xs",className:"h-auto p-0",onClick:e,children:"Choose exact actions"})}function ge(e=""){return{definitionId:"",agentId:e,destinationKind:"agent",destinationId:"",filterValues:{}}}function Rt(e){if(e.deliveryMode==="webhook")return"Sent the moment it happens";if(e.deliveryMode==="unknown")return"Delivery timing unknown";if(e.expectedCadenceSeconds===null)return"Check timing unknown";if(e.expectedCadenceSeconds<60)return`Checks about every ${e.expectedCadenceSeconds} seconds`;const t=Math.round(e.expectedCadenceSeconds/60);return`Checks about every ${t} ${t===1?"minute":"minutes"}`}function Et({connectionId:e,definitions:t,draft:s}){const a=t.find(d=>d.id===s.definitionId);if(!a||!s.agentId)return null;const i=me(a.filterSchema);if(!i)return null;const o=jn(i,s.filterValues);if(!o)return null;const c=s.destinationKind==="agent"?s.agentId:s.destinationId;return c?{connectionId:e,definitionId:a.id,filter:o,agentId:s.agentId,destination:{kind:s.destinationKind,id:c}}:null}function $t({idPrefix:e,definitions:t,draft:s,onChange:a,agents:i,fixedAgent:o,sourceStatus:c}){var E,L;const d=(o==null?void 0:o.id)??s.agentId,l=t.find(r=>r.id===s.definitionId),h=l?me(l.filterSchema):[],x=Nn(d||null,{enabled:s.destinationKind==="room"}),g=Cn(),m=kn(s.destinationKind==="channel"),j=v.useMemo(()=>new Set((m.data??[]).filter(r=>r.config.enabled).map(r=>r.config.id)),[m.data]),f=v.useMemo(()=>(g.data??[]).filter(r=>r.agentId===d&&r.enabled&&r.canInitiate&&!!r.chatId&&j.has(r.adapterId)),[d,g.data,j]),u=r=>{a({...s,...r,...o?{agentId:o.id}:{}})},y=r=>{if(r===s.definitionId)return;const I=t.find(T=>T.id===r),$=I?me(I.filterSchema):[];u({definitionId:r,filterValues:bn($??[])})},S=`${e}-event`,N=`${e}-agent`,p=`${e}-destination-kind`,R=`${e}-room`,w=`${e}-channel`;return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{htmlFor:S,children:"Account activity"}),n.jsxs(J,{value:s.definitionId,onValueChange:y,children:[n.jsx(Y,{id:S,"aria-label":"Account activity",children:n.jsx(Z,{placeholder:"Choose activity"})}),n.jsx(X,{children:t.map(r=>n.jsx(V,{value:r.id,children:r.displayName},r.id))})]}),l&&n.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(l)})]}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsx("div",{className:"space-y-1",children:o?n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium",children:"Agent"}),n.jsx("p",{id:N,className:"bg-muted/40 mt-1 rounded-md px-3 py-2 text-sm",children:o.displayName})]}):n.jsxs(n.Fragment,{children:[n.jsx(q,{htmlFor:N,children:"Agent"}),n.jsxs(J,{value:s.agentId,onValueChange:r=>u({agentId:r,destinationId:""}),children:[n.jsx(Y,{id:N,"aria-label":"Agent",children:n.jsx(Z,{placeholder:"Choose agent"})}),n.jsx(X,{children:(i??[]).map(r=>n.jsx(V,{value:r.id,children:r.displayName},r.id))})]})]})}),n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{htmlFor:p,children:"Send to"}),n.jsxs(J,{value:s.destinationKind,onValueChange:r=>u({destinationKind:r,destinationId:""}),children:[n.jsx(Y,{id:p,"aria-label":"Send to",children:n.jsx(Z,{})}),n.jsxs(X,{children:[n.jsx(V,{value:"agent",children:"Agent"}),n.jsx(V,{value:"room",children:"Room"}),n.jsx(V,{value:"channel",children:"Messaging channel"})]})]})]})]}),s.destinationKind==="room"&&d&&n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{htmlFor:R,children:"Room"}),n.jsxs(J,{value:s.destinationId,onValueChange:r=>u({destinationId:r}),children:[n.jsx(Y,{id:R,"aria-label":"Room",children:n.jsx(Z,{placeholder:"Choose a room"})}),n.jsx(X,{children:(((E=x.data)==null?void 0:E.rooms)??[]).map(r=>n.jsx(V,{value:r.id,children:r.slug?`#${r.slug}`:r.name},r.id))})]}),x.isError?n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t load this agent’s rooms."}),n.jsx(k,{type:"button",size:"sm",variant:"ghost",onClick:()=>void x.refetch(),children:"Try again"})]}):!x.isPending&&(((L=x.data)==null?void 0:L.rooms.length)??0)===0?n.jsx("p",{className:"text-muted-foreground text-xs",children:"This agent isn’t in any rooms."}):null]}),s.destinationKind==="channel"&&d&&n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{htmlFor:w,children:"Messaging channel"}),n.jsxs(J,{value:s.destinationId,onValueChange:r=>u({destinationId:r}),children:[n.jsx(Y,{id:w,"aria-label":"Messaging channel",children:n.jsx(Z,{placeholder:"Choose a channel"})}),n.jsx(X,{children:f.map(r=>n.jsx(V,{value:r.id,children:r.label||r.chatId},r.id))})]}),g.isError||m.isError?n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t load this agent’s messaging channels."}),n.jsx(k,{type:"button",size:"sm",variant:"ghost",onClick:()=>{g.refetch(),m.refetch()},children:"Try again"})]}):!g.isPending&&!m.isPending&&f.length===0?n.jsx("p",{className:"text-muted-foreground text-xs",children:"No channels this agent can start."}):null]}),l&&h===null&&n.jsx("p",{role:"alert",className:"text-muted-foreground rounded-md border p-3 text-sm",children:"This notification’s filters can’t be shown yet."}),(l==null?void 0:l.deliveryMode)==="unknown"&&n.jsx("p",{className:"text-muted-foreground rounded-md border p-3 text-sm",children:"This service hasn’t shared its timing. Setup may stay pending."}),(c==null?void 0:c.setupMode)==="byo_webhook"&&!c.configured&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Save delivery setup above first."}),h==null?void 0:h.map(r=>{var T;const I=`${e}-filter-${r.name}`,$=(T=r.examples)!=null&&T.length?`${I}-examples`:void 0;return n.jsxs("div",{className:"space-y-1",children:[r.type==="boolean"?n.jsxs("div",{className:"flex min-h-11 items-center gap-2",children:[n.jsx(Ue,{id:I,"aria-describedby":$,checked:s.filterValues[r.name]===!0,onCheckedChange:C=>u({filterValues:{...s.filterValues,[r.name]:C===!0}})}),n.jsx(q,{htmlFor:I,children:r.label})]}):r.options?n.jsxs(n.Fragment,{children:[n.jsx(q,{htmlFor:I,children:r.label}),n.jsxs(J,{value:typeof s.filterValues[r.name]=="string"?String(r.options.indexOf(String(s.filterValues[r.name]))):"",onValueChange:C=>u({filterValues:{...s.filterValues,[r.name]:r.options[Number(C)]}}),children:[n.jsx(Y,{id:I,"aria-label":r.label,"aria-describedby":$,children:n.jsx(Z,{placeholder:`Choose ${r.label.toLowerCase()}`})}),n.jsx(X,{children:r.options.map((C,b)=>n.jsx(V,{value:String(b),children:C===""?"Leave blank":C},C))})]})]}):n.jsxs(n.Fragment,{children:[n.jsx(q,{htmlFor:I,children:r.label}),n.jsx(xe,{id:I,type:r.type==="string"?"text":"number","aria-describedby":$,required:(r.required||r.defaultValue!==void 0)&&r.type!=="string",step:r.type==="integer"?1:"any",value:typeof s.filterValues[r.name]=="string"?String(s.filterValues[r.name]):"",onChange:C=>u({filterValues:{...s.filterValues,[r.name]:C.target.value}})})]}),$&&n.jsxs("p",{id:$,className:"text-muted-foreground text-xs break-words",children:["Examples (not selected):"," ",r.examples.map(C=>JSON.stringify(C)).join(", ")]})]},r.name)})]})}function _t(e){try{const t=new URL(e);return t.protocol==="https:"&&t.username===""&&t.password===""&&t.pathname==="/"&&t.search===""&&t.hash===""}catch{return!1}}function Ft(e){return e.setupMode==="managed"||e.setupMode==="byo_webhook"&&e.configured}function Lt({connectionId:e,status:t,idPrefix:s="notification"}){const a=Bn(),[i,o]=v.useState(""),[c,d]=v.useState(""),l=a.data??t;if(l.setupMode==="managed")return null;if(l.setupMode==="unavailable")return n.jsx("p",{className:"text-muted-foreground bg-muted/40 rounded-lg p-3 text-sm",children:l.reason??"Notification setup isn’t available for this account."});const h=`${s}-public-origin`,x=`${s}-webhook-secret`;return n.jsxs("div",{className:"space-y-3 rounded-lg border p-3","data-testid":"notification-source-setup",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium",children:"Service delivery"}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Add your public DorkOS address and Composio’s signing secret."}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"The secret is sent once and never shown again."})]}),l.configured&&l.endpoint&&n.jsxs("div",{className:"bg-muted/40 rounded-md p-2.5",children:[n.jsx("p",{className:"text-muted-foreground text-xs",children:"Webhook endpoint"}),n.jsx("p",{className:"mt-1 font-mono text-xs break-all",children:l.endpoint})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{htmlFor:h,children:"Public DorkOS address"}),n.jsx(xe,{id:h,type:"url",placeholder:"https://your-dorkos.example",value:i,onChange:g=>o(g.target.value)})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx(q,{htmlFor:x,children:"Signing secret"}),n.jsx(xe,{id:x,type:"password",autoComplete:"off",value:c,onChange:g=>d(g.target.value)})]}),a.isError&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t save delivery setup. Enter the signing secret again."}),n.jsx(k,{type:"button",size:"sm",variant:"secondary",disabled:a.isPending||c.length<16||!_t(i.trim()),onClick:()=>{const g=c;d(""),a.mutate({connectionId:e,input:{publicOrigin:i.trim(),webhookSecret:g}})},children:a.isPending?"Saving…":l.configured?"Update setup":"Save setup"})]})}function Tt(e){return(e.split(".").at(-1)??e).replaceAll("_"," ").replace(/\b\w/g,s=>s.toUpperCase())}function qt({connectionId:e,requestedEvents:t,agent:s,onChange:a}){const i=zn(e),o=Mn(e),c=v.useMemo(()=>[...new Set(t)],[t]),[d,l]=v.useState(()=>Object.fromEntries(c.map(g=>[g,ge(s.id)]))),h=v.useMemo(()=>{var g;return((g=i.data)==null?void 0:g.pages.flatMap(m=>m.definitions))??[]},[i.data]),x=v.useMemo(()=>{if(!o.data||!Ft(o.data))return null;const g=c.map(m=>Et({connectionId:e,definitions:h.filter(j=>j.eventType===m),draft:d[m]??ge(s.id)}));return g.every(m=>m!==null)?g:null},[s.id,e,h,d,c,o.data]);return v.useEffect(()=>a(x),[a,x]),n.jsxs("fieldset",{className:"space-y-3","data-testid":"agent-request-event-scopes",children:[n.jsx("legend",{className:"text-sm font-medium",children:"Notifications"}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Pick where this agent gets each kind of activity."}),o.isPending?n.jsx(K,{className:"h-20 rounded-lg","aria-label":"Loading delivery setup"}):o.isError?n.jsx(U,{title:"Couldn’t load delivery setup",description:"No access changed. Try again.",onRetry:()=>void o.refetch(),isRetrying:o.isFetching}):o.data?n.jsx(Lt,{connectionId:e,status:o.data,idPrefix:"agent-request-source"}):null,i.isPending?n.jsx(K,{className:"h-28 rounded-lg","aria-label":"Loading notification choices"}):i.isError?n.jsx(U,{title:"Couldn’t load notification choices",description:"Nothing changed. Try again.",onRetry:()=>void i.refetch(),isRetrying:i.isFetching}):n.jsxs("div",{className:"space-y-3",children:[c.map((g,m)=>{const j=h.filter(f=>f.eventType===g);return n.jsxs("section",{"aria-labelledby":`agent-request-event-${m}`,className:"bg-muted/30 space-y-3 rounded-lg p-3",children:[n.jsx("div",{children:n.jsx("h3",{id:`agent-request-event-${m}`,className:"text-sm font-medium",children:Tt(g)})}),j.length===0?n.jsx("p",{className:"text-muted-foreground text-sm",children:i.hasNextPage?"Load more options to finish.":"This account doesn’t offer this now."}):n.jsx($t,{idPrefix:`agent-request-event-${m}`,definitions:j,draft:d[g]??ge(s.id),onChange:f=>l(u=>({...u,[g]:f})),fixedAgent:s,sourceStatus:o.data})]},g)}),i.hasNextPage&&n.jsx(k,{type:"button",size:"sm",variant:"ghost",disabled:i.isFetchingNextPage,onClick:()=>void i.fetchNextPage(),children:i.isFetchingNextPage?"Loading…":"Load more notification options"})]})]})}const Pt=new Set(["failed","expired","start_unknown"]);function Dt({account:e,serviceName:t,logo:s,agentName:a,onDecline:i,deciding:o,onConnectAgain:c}){var R,w,E;const d=v.useId(),l=pe(),h=Sn(),x=wn(),g=In(),[m,j]=v.useState(null),f=An(m),u=(R=f.data)==null?void 0:R.state,y=u!==void 0&&Pt.has(u),S=((w=f.data)==null?void 0:w.state)==="pending"?f.data.authorizeUrl:void 0,N=h.isError||x.isError||y,p=(E=e.readiness.fix)==null?void 0:E.action;return n.jsxs(ee,{titleId:d,toolkit:e.toolkit,serviceName:t,logo:s,title:`Let ${a} use ${t}?`,subtitle:e.label,className:"max-w-xl",children:[n.jsx("p",{className:"text-sm","data-testid":"account-attention","data-reason":e.readiness.reason,children:e.readiness.copy.owner}),S&&n.jsx(k,{asChild:!0,className:"w-full sm:w-auto",children:n.jsxs(Ge,{href:S,children:["Sign in to ",t,n.jsx(He,{className:"size-4","aria-hidden":!0})]})}),m&&!S&&!y&&u!=="connected"&&n.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[n.jsx(le,{className:"size-4 animate-spin motion-reduce:animate-none","aria-hidden":!0}),"Getting the sign-in page ready…"]}),N&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t finish that. Nothing changed. Try again."}),n.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[n.jsx(k,{variant:"ghost",onClick:i,disabled:o,children:"Not now"}),p==="resume"&&n.jsx(k,{onClick:()=>h.mutate({connectionId:e.connectionId,input:void 0}),disabled:h.isPending,children:h.isPending?"Resuming…":"Resume"}),p==="sign_in_again"&&(!m||y)&&n.jsx(k,{onClick:()=>x.mutate({connectionId:e.connectionId},{onSuccess:L=>j(L.flowId)}),disabled:x.isPending,children:"Sign in again"}),p==="retry"&&n.jsx(k,{variant:"secondary",onClick:()=>g.mutate(),disabled:g.isPending,children:g.isPending?"Checking…":"Check again"}),p==="fix_key"&&n.jsx(k,{variant:"secondary",onClick:()=>l.open("connections","ways"),children:"Fix the key"}),p==="connect_new"&&n.jsxs(k,{onClick:c,children:["Connect ",t," again"]}),p==="review_access"&&n.jsx(k,{asChild:!0,variant:"secondary",children:n.jsxs(Rn,{...$n.connections(),search:{app:e.connectionId},children:["Open Connections",n.jsx(En,{className:"size-4","aria-hidden":!0})]})})]})]})}function rn(e){var t;return((t=e==null?void 0:e.intents.find(s=>s.kind==="account"))==null?void 0:t.routes)??[]}function Ot(e,t){const s=e.filter(i=>i.capabilities.authentication.status==="available");return((t==null?void 0:t.status)==="ready"?s.find(i=>i.providerInstanceId===t.way.providerInstanceId):void 0)??s.find(i=>i.mode==="managed")??s.find(i=>i.mode==="byo")??null}function Kt(e){const t=e==null?void 0:e.intents.find(s=>s.kind==="account");return(t==null?void 0:t.kind)==="account"&&!t.routes.some(s=>s.capabilities.authentication.status==="available")}function zt(e){var t;return((e==null?void 0:e.warnings.length)??0)>0&&((t=e==null?void 0:e.appConnections)==null?void 0:t.newApps.status)==="ready"}function cn(e){return _n(e.kind==="dorkos_account"?"dorkos-managed":e.type)}function Mt(e,t){return!(e!=null&&e.signInThrough)||e.authKind!=="oauth2"||!t?null:`${t.signInName??t.displayName} will ask you to allow ${e.signInThrough}. DorkOS connects through it.`}function Bt(e,t){const s=(t==null?void 0:t.displayName)??"this app",a=rn(t).map(o=>o.capabilities.authentication).find(o=>o.status==="unsupported");if((a==null?void 0:a.status)==="unsupported")return a.reason;const i=e==null?void 0:e.newApps;if(!i)return null;if(i.status==="ready")return`${cn(i.way)} can’t reach ${s} yet.`;switch(i.reason){case"dorkos_account_unavailable":return"Your DorkOS account is linked, but it can’t connect apps right now.";case"dorkos_account_unlinked":return"Your DorkOS account isn’t linked anymore.";case"own_key_unavailable":return"Your saved key didn’t work at the last check.";case"nothing_set_up":return null}}function Vt({reason:e,onLeave:t}){var g;const s=Fn(),a=Ln(),i=pe(),[o,c]=v.useState(!1);if(s.isPending)return n.jsx(K,{className:"h-24 rounded-lg","aria-label":"Loading setup options"});if(s.isError)return n.jsx(U,{title:"Couldn’t load the setup options",description:"Try again. Nothing was changed.",onRetry:()=>void s.refetch(),isRetrying:s.isFetching});const d=Pe(s.data,"composio"),l=Pe(s.data,"nango"),h=(g=a.data)==null?void 0:g.newApps,x=(h==null?void 0:h.status)==="setup_needed"&&h.reason==="dorkos_account_unlinked";return n.jsxs("div",{"data-testid":"first-connect-step",className:"space-y-4",children:[e&&n.jsx("p",{role:"status",className:"bg-muted/40 rounded-lg p-3 text-sm",children:e}),x&&n.jsx(k,{size:"lg",variant:"outline",className:"w-full",onClick:()=>{t==null||t(),i.open("account")},children:"Link my DorkOS account again"}),d&&(o?n.jsx(we,{status:d}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs(k,{size:"lg",variant:x?"outline":"default",className:"w-full",onClick:()=>c(!0),children:[n.jsx(Tn,{className:"size-4","aria-hidden":!0}),"Use my Composio key"]}),n.jsx("p",{className:"text-muted-foreground text-center text-xs",children:"Have a Composio account? Paste its key."})]})),l&&n.jsxs(Me,{children:[n.jsxs(Be,{className:"text-muted-foreground hover:text-foreground focus-ring group flex items-center gap-1 rounded-md text-sm font-medium",children:["Other ways",n.jsx(qn,{className:"size-4 transition-transform group-data-[state=open]:rotate-180","aria-hidden":!0})]}),n.jsxs(Ve,{className:"space-y-2 pt-3",children:[n.jsx("p",{className:"text-muted-foreground text-xs",children:"Your own Nango server. Sign-ins stay in your database."}),n.jsx(we,{status:l})]})]})]})}function Pe(e,t){return e==null?void 0:e.find(s=>s.type===t)}function Wt({request:e,serviceName:t,service:s,onConnected:a,onDecline:i,deciding:o,className:c}){var $;const d=v.useId(),[l,h]=v.useState(null),[x,g]=v.useState(!1),m=Wn(e.requestId),j=Qn(e.requestId,l),f=Je(e.serviceSlug),u=($=f.data)==null?void 0:$.pages[0],y=u==null?void 0:u.appConnections,S=rn(s),N=Ot(S,y==null?void 0:y.newApps),p=j.data??m.data,R=!p&&Kt(s),w=Mt(N,s),E=(p==null?void 0:p.state)==="connected"?p.connectionId:null;v.useEffect(()=>{E&&a(E)},[E,a]);const L=()=>{if(R){g(!0);return}N&&m.mutate({providerInstanceId:N.providerInstanceId},{onSuccess:T=>h(T.flowId)})},r=(p==null?void 0:p.state)==="starting"||(p==null?void 0:p.state)==="pending";let I;return f.isPending&&!s?I=n.jsx(K,{className:"h-10 rounded-lg","aria-label":`Loading ${t}`}):R&&x?I=S.length===0&&zt(u)&&(y==null?void 0:y.newApps.status)==="ready"?n.jsx(U,{title:`Couldn’t reach ${t} just now`,description:`${cn(y.newApps.way)} didn’t answer. Try again soon.`,onRetry:()=>void f.refetch(),isRetrying:f.isFetching}):n.jsx(Vt,{reason:Bt(y,s)}):r?I=n.jsxs("div",{className:"space-y-3",children:[w&&n.jsx("p",{className:"text-sm",children:w}),p.state==="pending"&&p.authorizeUrl?n.jsx(k,{asChild:!0,className:"w-full sm:w-auto",children:n.jsxs(Ge,{href:p.authorizeUrl,children:["Sign in to ",t,n.jsx(He,{className:"size-4","aria-hidden":!0})]})}):null,n.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[n.jsx(le,{className:"size-4 animate-spin motion-reduce:animate-none","aria-hidden":!0}),p.state==="starting"?"Getting the sign-in page ready…":`Finish signing in to ${t}…`]})]}):I=n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{className:"text-sm",children:[n.jsxs("span",{className:"text-muted-foreground",children:[e.agent.displayName," asked: "]}),e.reason]}),w&&n.jsx("p",{className:"text-muted-foreground text-xs",children:w}),m.isError&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t start sign-in. Try again."})]}),n.jsxs(ee,{titleId:d,toolkit:e.serviceSlug,serviceName:t,logo:se(s),title:`Connect ${t}`,subtitle:`So ${e.agent.displayName} can use it`,className:c,children:[I,n.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[n.jsx(k,{variant:"ghost",onClick:i,disabled:o,children:"Not now"}),!r&&!(R&&x)&&n.jsx(k,{onClick:L,disabled:m.isPending||o||!R&&!N,children:m.isPending?"Starting…":`Connect ${t}`})]})]})}function Qt(e,t){const s=e.agent.displayName;switch(e.status){case"granted":return`Allowed ${s} to use ${t}`;case"access_pending":return`Giving ${s} access to ${t}…`;case"denied":return`${s} wasn’t given ${t}`;case"expired":return`Request for ${t} timed out. ${s} can ask again.`;case"authentication_failed":return`Signing in to ${t} didn’t finish. Nothing was shared.`;case"target_deleted":return`Request for ${t} closed. The agent or its chat is gone.`;case"awaiting_owner":return`${s} is waiting for ${t}`}}function Ut({request:e,serviceName:t,className:s}){const a=e.status==="granted",i=e.status==="access_pending",o=a?ve:i?Ze:Kn;return n.jsxs("p",{role:"status","data-testid":"agent-request-receipt","data-status":e.status,className:D("bg-muted/40 text-muted-foreground flex items-start gap-2 rounded-lg px-3 py-2 text-sm",s),children:[n.jsx(o,{className:D("mt-0.5 size-4 shrink-0",a&&"text-status-success"),"aria-hidden":!0}),n.jsx("span",{className:D("min-w-0",a&&"text-foreground"),children:Qt(e,t)})]})}const Gt="Couldn’t save your answer. Nothing changed. Try again.";function Ht(e){return(e==null?void 0:e.code)==="session_access_off"}const Jt="Couldn’t turn it on for this chat. Nothing changed. Try again.";function Yt(e,t,s){switch(e==null?void 0:e.code){case"session_access_off":return{reason:`This chat has ${s} turned off for ${t}.`,fix:"turn_on"};case"request_already_resolved":return{reason:`It was answered somewhere else. Ask ${t} again if it still needs this.`,fix:null};case"request_expired":return{reason:`The request ran out of time. Ask ${t} again.`,fix:null};case"request_not_found":return{reason:"The request is no longer open.",fix:null};case"authority_sync_failed":return{reason:"The access is still being set up.",fix:"retry"};case"event_selection_unavailable":case"review_conflict":case"destination_unavailable":case"definition_changed":case"invalid_filter":return{reason:"The updates you picked can’t be set up. Pick again, or answer without them.",fix:"updates"};case"selection_invalid":return{reason:"That account isn’t ready for it yet.",fix:"retry"};default:return{reason:"The answer didn’t reach DorkOS.",fix:"retry"}}}function gs({request:e,onEditExactActions:t,className:s}){var ie,B,Ne,Ce,ke;const a=Vn(),i=Pn(e.sessionId),o=Ht(a.error)?e.sessionId:null,c=Dn(o),d=We(),h=((ie=Je(e.serviceSlug,e.status==="awaiting_owner").data)==null?void 0:ie.pages.flatMap(F=>F.services).find(F=>F.serviceSlug===e.serviceSlug))??null,x=(h==null?void 0:h.displayName)??On(e.serviceSlug),g=e.agent.displayName,[m,j]=v.useState(null),[f,u]=v.useState(null),[y,S]=v.useState([]),[N,p]=v.useState(!1),[R,w]=v.useState(!1),[E,L]=v.useState(null),r=v.useCallback(()=>{u(null),a.mutate({requestId:e.requestId,decision:{decision:"denied"}})},[a,e.requestId]),I=v.useCallback((F,H=[])=>{u(F),S(H),a.mutate({requestId:e.requestId,decision:{decision:"current_access",connectionId:F,eventScopes:H}})},[a,e.requestId]),$=e.requestedEvents.length>0,T=v.useCallback(F=>$?L(F):I(F),[I,$]),C=D("max-w-xl",s);if(f&&a.isError){const{reason:F,fix:H}=Yt(a.error,g,x),dn=H==="updates"&&E!==null,be=H==="turn_on"&&((Ce=(Ne=(B=c.data)==null?void 0:B.connections.find(ln=>ln.connectionId===f))==null?void 0:Ne.readiness.fix)==null?void 0:Ce.action)==="turn_on_for_this_chat";return n.jsxs(ee,{titleId:`agent-request-unanswered-${e.requestId}`,toolkit:e.serviceSlug,serviceName:x,logo:se(h),title:`${g} can now use ${x}`,className:C,children:[n.jsxs("div",{role:"alert",className:"space-y-1 text-sm","data-testid":"agent-request-unanswered",children:[n.jsxs("p",{children:[n.jsx(ve,{className:"text-status-success mr-1.5 inline size-4 align-text-bottom","aria-hidden":!0}),"Access saved, but ",g,"’s request wasn’t answered."]}),n.jsxs("p",{children:[F,be&&" Turning it on only affects this chat."]})]}),dn?n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx(k,{variant:"ghost",onClick:()=>I(f,[]),disabled:a.isPending,children:"Answer without updates"}),n.jsx(k,{onClick:()=>a.reset(),disabled:a.isPending,children:"Pick updates again"})]}):H==="retry"&&n.jsx("div",{className:"flex justify-end",children:n.jsx(k,{onClick:()=>I(f,y),disabled:a.isPending,children:a.isPending?"Sending…":"Try again"})}),be&&n.jsxs(n.Fragment,{children:[i.isError&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Jt}),n.jsx("div",{className:"flex justify-end",children:n.jsx(k,{onClick:()=>i.mutate({connectionId:f,on:!0},{onSuccess:()=>I(f,y)}),disabled:i.isPending||a.isPending,children:i.isPending||a.isPending?"Turning on…":"Turn on for this chat"})})]})]})}if(e.status!=="awaiting_owner")return n.jsx(Ut,{request:e,serviceName:x,className:C});const b=a.isError&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Gt});if(E)return n.jsx(Xt,{request:e,connectionId:E,serviceName:x,logo:se(h),onAnswer:F=>I(E,F),deciding:a.isPending,className:C},E);if(d.isPending)return n.jsx(K,{className:D("h-28 rounded-xl",C),"aria-label":"Loading accounts"});if(d.isError)return n.jsx("div",{className:C,children:n.jsx(U,{title:"Couldn’t load your accounts",description:"Nothing changed. Try again.",onRetry:()=>void d.refetch(),isRetrying:d.isFetching})});const O=((ke=d.data)==null?void 0:ke.connections)??[],ne=O.filter(F=>F.toolkit===e.serviceSlug&&F.readiness.state!=="gone"),ae=an(O,e.serviceSlug),te=N||!!m||ae.length>0;if(!te&&(ne.length===0||R))return n.jsxs("div",{className:D("space-y-2",C),children:[n.jsx(Wt,{request:e,serviceName:x,service:h,onConnected:j,onDecline:r,deciding:a.isPending}),b]});if(!te){const F=ne[0];return n.jsxs("div",{className:D("space-y-2",C),children:[n.jsx(Dt,{account:F,serviceName:x,logo:se(h),agentName:g,onDecline:r,deciding:a.isPending,onConnectAgain:()=>w(!0)}),b]})}return n.jsx(Zt,{onShown:p,children:n.jsxs("div",{className:D("space-y-2",C),"data-testid":"agent-request-access",children:[n.jsx(It,{mode:"agent",agentId:e.agent.id,toolkit:e.serviceSlug,serviceName:x,logo:se(h),...m?{connectionId:m}:{},request:{reason:e.reason,access:e.access},...t?{onEditExactActions:t}:{},onSkip:r,onAllowed:T}),b]})})}function Zt({onShown:e,children:t}){return v.useEffect(()=>e(!0),[e]),n.jsx(n.Fragment,{children:t})}function Xt({request:e,connectionId:t,serviceName:s,logo:a,onAnswer:i,deciding:o,className:c}){const[d,l]=v.useState(null);return n.jsxs(ee,{titleId:`agent-request-updates-${e.requestId}`,toolkit:e.serviceSlug,serviceName:s,logo:a,title:`Send ${e.agent.displayName} updates from ${s}?`,subtitle:`${e.agent.displayName} can now use ${s}`,className:c,children:[n.jsx(qt,{connectionId:t,requestedEvents:e.requestedEvents,agent:e.agent,onChange:l}),n.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[n.jsx(k,{variant:"ghost",onClick:()=>i([]),disabled:o,children:"No updates"}),n.jsx(k,{onClick:()=>d&&i(d),disabled:o||!d,children:o?"Sending…":"Send updates"})]})]})}export{gs as A,Bt as B,Lt as C,mt as D,at as E,Vt as F,G,us as H,pt as I,rs as J,ht as L,tn as R,zn as a,ns as b,ts as c,ss as d,ge as e,Et as f,$t as g,Rt as h,Ft as i,Hn as j,ue as k,It as l,os as m,as as n,cs as o,is as p,ds as q,ls as r,se as s,rn as t,Mn as u,Ot as v,Kt as w,Mt as x,zt as y,cn as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,cp as F,cq as U,aa as v,O as f,bd as b,cr as $,cs as B,ct as G,aF as D,r as u,cu as E,B as W,X as V,cv as q,b as J,e as K,t as X,g as Y}from"./index-DMYBI16t.js";import{P as Z}from"./PersonalityPicker-C_9JVOva.js";import{u as Q}from"./use-personality-commit-OH7d0xl_.js";import"./dorkbot-templates-cu4wApxb.js";import"./soul-file-pg0ShYy3.js";const H={hidden:{},visible:{transition:{staggerChildren:.04}}},I={hidden:{opacity:0,scale:.5},visible:{opacity:1,scale:1,transition:{type:"spring",stiffness:500,damping:25}}};function O(){return e.jsx(f.span,{className:"pointer-events-none absolute inset-0 flex items-center justify-center",initial:{scale:0,opacity:1},animate:{scale:1,opacity:0},transition:{duration:.6,ease:[.34,1.56,.64,1]},"aria-hidden":!0,children:e.jsx(D,{className:"size-4 text-white drop-shadow-md",strokeWidth:3})})}function _({celebratory:s,className:t,children:a}){return s?e.jsx(f.div,{className:t,variants:H,initial:"hidden",animate:"visible",children:a}):e.jsx("div",{className:t,children:a})}function A({celebratory:s,children:t}){return s?e.jsx(f.div,{variants:I,children:t}):t}const ee=e.jsx("span",{className:"text-3xs leading-none font-bold",children:"A"}),te="ring-muted-foreground/50 ring-dashed ring-2 ring-offset-2",se="Select default color";function ae({value:s,autoColor:t,onSelect:a,onHoverChange:i,justSelectedKey:o,celebratory:n=!1,autoIcon:r=ee,autoActiveRing:c=te,autoLabel:d=se}){const x=s!=null;return e.jsxs(_,{celebratory:n,className:"flex flex-wrap items-center gap-2",children:[e.jsx(A,{celebratory:n,children:e.jsx(T,{active:!x,activeRing:c,color:t,label:d,tooltip:"Unique, derived from agent name",onClick:()=>a(null),onHoverChange:i,justSelected:o==="auto",celebratory:n,children:r})}),e.jsx("div",{className:"bg-border mx-0.5 h-5 w-px"}),F.map(l=>e.jsx(A,{celebratory:n,children:e.jsx(T,{active:s===l.hex,activeRing:"ring-foreground ring-2 ring-offset-2",color:l.hex,label:`Select ${l.name}`,tooltip:l.name,onClick:()=>a(l.hex),onHoverChange:i,justSelected:o===l.hex,celebratory:n})},l.hex))]})}function T({active:s,activeRing:t,color:a,label:i,tooltip:o,tooltipSide:n="bottom",onClick:r,onHoverChange:c,justSelected:d,celebratory:x,children:l}){const h=e.jsxs("button",{type:"button",onClick:r,onMouseEnter:()=>c==null?void 0:c(a),onMouseLeave:()=>c==null?void 0:c(null),className:v("group/swatch relative size-8 rounded-full transition-[scale,box-shadow] duration-150",s?t:"hover:scale-110"),style:{backgroundColor:a},"aria-label":i,children:[l&&e.jsx("span",{className:"bg-background/80 text-foreground absolute inset-0 flex items-center justify-center rounded-full",children:l}),x&&e.jsx("span",{className:"absolute inset-[-4px] -z-10 rounded-full opacity-0 blur-md transition-opacity duration-200 group-hover/swatch:opacity-50",style:{backgroundColor:a},"aria-hidden":!0}),e.jsx(b,{children:d&&e.jsx(O,{})})]});return x?e.jsxs($,{children:[e.jsx(B,{asChild:!0,children:h}),e.jsx(G,{side:n,className:"text-3xs",children:o})]}):h}function ne({value:s,autoEmoji:t,hasOverride:a,onSelect:i,justSelectedKey:o,celebratory:n=!1}){return e.jsx(_,{celebratory:n,className:"grid grid-cols-6 gap-1.5",children:U.map(r=>{const c=r===s,d=r===t&&!a,x=v("relative flex size-9 items-center justify-center rounded-md text-lg transition-colors duration-150",c?v(d?"bg-accent ring-muted-foreground/50 ring-1":"bg-accent ring-foreground ring-1",d&&!n&&"ring-dashed"):"hover:bg-accent/50 active:scale-90");return e.jsx(ie,{celebratory:n,onClick:()=>i(r),className:x,ariaLabel:`Select icon ${r}`,justSelected:o===`emoji-${r}`,children:r},r)})})}function ie({celebratory:s,onClick:t,className:a,ariaLabel:i,justSelected:o,children:n}){const r=e.jsx(b,{children:o&&e.jsx(O,{})});return s?e.jsxs(f.button,{type:"button",onClick:t,className:a,"aria-label":i,variants:I,whileHover:{scale:1.25},whileTap:{scale:.85},transition:{type:"spring",stiffness:500,damping:20},children:[n,r]}):e.jsxs("button",{type:"button",onClick:t,className:a,"aria-label":i,children:[n,r]})}const re=e.jsx(q,{className:"size-3"}),oe="ring-muted-foreground/50 ring-2 ring-offset-2",ce="Select unique auto-generated color",C="dorkos:avatar-first-customization",le={hidden:{},visible:{transition:{staggerChildren:.04}}},w={hidden:{opacity:0,y:4},visible:{opacity:1,y:0,transition:{duration:.2,ease:"easeOut"}}};function ue(){const[s]=u.useState(()=>Array.from({length:14},(a,i)=>{const o=Math.PI*2*i/14,n=28+Math.random()*20,r=360*i/14;return{x:Math.cos(o)*n,y:Math.sin(o)*n,size:3+Math.random()*3,hue:r,delay:i*.02}}));return e.jsx("div",{className:"pointer-events-none absolute inset-0 z-50 overflow-visible","aria-hidden":!0,children:s.map((t,a)=>e.jsx(f.span,{className:"absolute top-1/2 left-1/2 rounded-full",style:{width:t.size,height:t.size,background:`hsl(${t.hue}, 80%, 70%)`,boxShadow:`0 0 6px hsl(${t.hue}, 80%, 70%)`},initial:{x:"-50%",y:"-50%",scale:0,opacity:1},animate:{x:t.x,y:t.y,scale:1,opacity:0},transition:{duration:.6,ease:"easeOut",delay:t.delay}},a))})}function de({agent:s,onUpdate:t,onPreviewColor:a,title:i,onClose:o}){const n=u.useMemo(()=>E(s.id),[s.id]),r=n.color,c=n.icon,d=s.icon??c,x=s.color!=null,l=s.icon!=null,h=x||l,[y,S]=u.useState(null),p=u.useRef(null),[z,k]=u.useState(!1),N=u.useRef(!1);u.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const g=u.useCallback(()=>{if(!N.current){try{if(localStorage.getItem(C))return;localStorage.setItem(C,"true")}catch{return}N.current=!0,k(!0),setTimeout(()=>k(!1),800)}},[]),j=u.useCallback(m=>{p.current&&clearTimeout(p.current),S(m),p.current=setTimeout(()=>S(null),600)},[]),R=u.useCallback(()=>{t({color:null,icon:null})},[t]),P=u.useCallback(m=>{t({color:m}),a(null),j(m??"auto"),g()},[t,a,j,g]),L=u.useCallback(m=>{t({icon:m===c?null:m}),j(`emoji-${m}`),g()},[t,c,j,g]),M=u.useCallback(m=>{a(m)},[a]);return e.jsxs("div",{className:"flex flex-1 flex-col overflow-auto","data-testid":"avatar-picker-panel",children:[(i||o||h)&&e.jsxs("div",{className:v("flex items-center justify-between px-4 py-2",(i||o)&&"border-b"),children:[i&&e.jsx("span",{className:"text-xs font-semibold",children:i}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[e.jsx(b,{children:h&&e.jsx(f.button,{type:"button",onClick:R,className:"text-muted-foreground hover:text-foreground text-3xs transition-colors",initial:{opacity:0,x:8},animate:{opacity:1,x:0},exit:{opacity:0,x:8},transition:{duration:.2},children:"Reset to defaults"})}),o&&e.jsx(W,{variant:"ghost",size:"icon-md",className:"size-6",onClick:o,"aria-label":"Close appearance picker",children:e.jsx(V,{className:"size-3.5"})})]})]}),e.jsxs(f.div,{className:"space-y-5 p-4",variants:le,initial:"hidden",animate:"visible",children:[e.jsxs(f.div,{variants:w,children:[e.jsx("div",{className:"text-muted-foreground text-3xs mb-2 font-medium tracking-wider uppercase",children:"Color"}),e.jsx(ae,{value:s.color,autoColor:r,onSelect:P,onHoverChange:M,justSelectedKey:y,celebratory:!0,autoIcon:re,autoActiveRing:oe,autoLabel:ce})]}),e.jsxs(f.div,{variants:w,children:[e.jsx("div",{className:"text-muted-foreground text-3xs mb-2 font-medium tracking-wider uppercase",children:"Icon"}),e.jsx(ne,{value:d,autoEmoji:c,hasOverride:l,onSelect:L,justSelectedKey:y,celebratory:!0})]})]}),e.jsx(b,{children:z&&e.jsx(ue,{})})]})}function xe({children:s}){return e.jsx("h3",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:s})}function ve({member:s}){const{agent:t,isPending:a,update:i}=J(s),o=Q(t,i),[n,r]=u.useState(null);if(a)return e.jsx(K,{className:"h-64 w-full"});if(!t)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s appearance."});const c=X(s),d=E(t.id),x=n??t.color??d.color,l=t.icon??d.icon;return e.jsxs("div",{className:"flex flex-col gap-5","data-slot":"profile-appearance",children:[e.jsx("div",{className:"flex justify-center pt-1",children:e.jsx(Y,{size:"lg",kind:c.kind,color:x,emoji:l,fallback:c.fallback,origin:c.origin})}),e.jsx(de,{agent:t,onUpdate:i,onPreviewColor:r}),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx(xe,{children:"Personality"}),e.jsx(Z,{traits:o.traits,onTraitsChange:o.onTraitsChange,compact:!0})]})]})}export{ve as AppearancePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ak as r,al as n,j as e,O as i,am as o,B as d}from"./index-DMYBI16t.js";const c={initial:{opacity:0,y:8},animate:{opacity:1,y:0}};function l({signal:t}){const a=r(),s=n(t.since);return e.jsxs(i.div,{variants:c,"data-slot":"attention-signal-row",className:"hover:bg-accent/50 flex min-w-0 items-center gap-2.5 rounded-md px-2 py-1 transition-colors",children:[e.jsx("span",{className:"bg-status-error size-1.5 shrink-0 rounded-full","aria-hidden":!0}),e.jsx(o,{className:"text-status-error/70 size-3.5 shrink-0","aria-hidden":!0}),e.jsxs("span",{className:"text-foreground/90 min-w-0 flex-1 truncate text-xs",children:[t.primary,t.secondary!==void 0&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",t.secondary]})]}),e.jsx("span",{className:"text-muted-foreground shrink-0 text-xs tabular-nums",children:s}),e.jsx(d,{variant:"ghost",size:"sm",className:"relative h-6 shrink-0 px-2 text-xs after:absolute after:-inset-3 md:after:hidden","aria-label":`Open ${t.primary}`,onClick:()=>void a.navigate({href:t.deepLink}),children:"Open →"})]})}export{l as A};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as _t,c as Q,a as Te,b as U,s as ht,m as Je,i as g,k as Ft,e as w,f as s,d as S,l as L,M as He,j as le,F as zt,S as Et,n as pt,t as E,o as It,p as mt,q as Bt,r as $t,v as Ke}from"./index-
|
|
1
|
+
import{u as _t,c as Q,a as Te,b as U,s as ht,m as Je,i as g,k as Ft,e as w,f as s,d as S,l as L,M as He,j as le,F as zt,S as Et,n as pt,t as E,o as It,p as mt,q as Bt,r as $t,v as Ke}from"./index-DgH_dl1a.js";import{cj as Dt,ck as be,aC as V,cl as st,cm as Tt,cn as At,co as Rt}from"./index-DMYBI16t.js";let Mt={data:""},Pt=r=>{if(typeof window=="object"){let e=(r?r.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return e.nonce=window.__nonce__,e.parentNode||(r||document.head).appendChild(e),e.firstChild}return r||Mt},Lt=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Ot=/\/\*[^]*?\*\/| +/g,lt=/\n+/g,ae=(r,e)=>{let i="",t="",c="";for(let a in r){let l=r[a];a[0]=="@"?a[1]=="i"?i=a+" "+l+";":t+=a[1]=="f"?ae(l,a):a+"{"+ae(l,a[1]=="k"?"":e)+"}":typeof l=="object"?t+=ae(l,e?e.replace(/([^,])+/g,v=>a.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,v):v?v+" "+u:u)):a):l!=null&&(a=a[1]=="-"?a:a.replace(/[A-Z]/g,"-$&").toLowerCase(),c+=ae.p?ae.p(a,l):a+":"+l+";")}return i+(e&&c?e+"{"+c+"}":c)+t},ne={},bt=r=>{if(typeof r=="object"){let e="";for(let i in r)e+=i+bt(r[i]);return e}return r},jt=(r,e,i,t,c)=>{let a=bt(r),l=ne[a]||(ne[a]=(u=>{let o=0,n=11;for(;o<u.length;)n=101*n+u.charCodeAt(o++)>>>0;return"go"+n})(a));if(!ne[l]){let u=a!==r?r:(o=>{let n,k,m=[{}];for(;n=Lt.exec(o.replace(Ot,""));)n[4]?m.shift():n[3]?(k=n[3].replace(lt," ").trim(),m.unshift(m[0][k]=m[0][k]||{})):m[0][n[1]]=n[2].replace(lt," ").trim();return m[0]})(r);ne[l]=ae(c?{["@keyframes "+l]:u}:u,i?"":"."+l)}let v=i&&ne.g;return i&&(ne.g=ne[l]),((u,o,n,k)=>{k?o.data=o.data.replace(k,u):o.data.indexOf(u)===-1&&(o.data=n?u+o.data:o.data+u)})(ne[l],e,t,v),l},Ht=(r,e,i)=>r.reduce((t,c,a)=>{let l=e[a];if(l&&l.call){let v=l(i),u=v&&v.props&&v.props.className||/^go/.test(v)&&v;l=u?"."+u:v&&typeof v=="object"?v.props?"":ae(v,""):v===!1?"":v}return t+c+(l??"")},"");function ue(r){let e=this||{},i=r.call?r(e.p):r;return jt(i.unshift?i.raw?Ht(i,[].slice.call(arguments,1),e.p):i.reduce((t,c)=>Object.assign(t,c&&c.call?c(e.p):c),{}):i,Pt(e.target),e.g,e.o,e.k)}ue.bind({g:1});ue.bind({k:1});var D={colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000000",white:"#ffffff",neutral:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},darkGray:{50:"#525c7a",100:"#49536e",200:"#414962",300:"#394056",400:"#313749",500:"#292e3d",600:"#212530",700:"#191c24",800:"#111318",900:"#0b0d10"},gray:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},blue:{25:"#F5FAFF",50:"#EFF8FF",100:"#D1E9FF",200:"#B2DDFF",300:"#84CAFF",400:"#53B1FD",500:"#2E90FA",600:"#1570EF",700:"#175CD3",800:"#1849A9",900:"#194185"},green:{25:"#F6FEF9",50:"#ECFDF3",100:"#D1FADF",200:"#A6F4C5",300:"#6CE9A6",400:"#32D583",500:"#12B76A",600:"#039855",700:"#027A48",800:"#05603A",900:"#054F31"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},yellow:{25:"#FFFCF5",50:"#FFFAEB",100:"#FEF0C7",200:"#FEDF89",300:"#FEC84B",400:"#FDB022",500:"#F79009",600:"#DC6803",700:"#B54708",800:"#93370D",900:"#7A2E0E"},purple:{25:"#FAFAFF",50:"#F4F3FF",100:"#EBE9FE",200:"#D9D6FE",300:"#BDB4FE",400:"#9B8AFB",500:"#7A5AF8",600:"#6938EF",700:"#5925DC",800:"#4A1FB8",900:"#3E1C96"},teal:{25:"#F6FEFC",50:"#F0FDF9",100:"#CCFBEF",200:"#99F6E0",300:"#5FE9D0",400:"#2ED3B7",500:"#15B79E",600:"#0E9384",700:"#107569",800:"#125D56",900:"#134E48"},pink:{25:"#fdf2f8",50:"#fce7f3",100:"#fbcfe8",200:"#f9a8d4",300:"#f472b6",400:"#ec4899",500:"#db2777",600:"#be185d",700:"#9d174d",800:"#831843",900:"#500724"},cyan:{25:"#ecfeff",50:"#cffafe",100:"#a5f3fc",200:"#67e8f9",300:"#22d3ee",400:"#06b6d4",500:"#0891b2",600:"#0e7490",700:"#155e75",800:"#164e63",900:"#083344"}},alpha:{90:"e5",70:"b3",20:"33"},font:{size:{"2xs":"calc(var(--tsrd-font-size) * 0.625)",xs:"calc(var(--tsrd-font-size) * 0.75)",sm:"calc(var(--tsrd-font-size) * 0.875)",md:"var(--tsrd-font-size)"},lineHeight:{xs:"calc(var(--tsrd-font-size) * 1)",sm:"calc(var(--tsrd-font-size) * 1.25)"},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},fontFamily:{sans:"ui-sans-serif, Inter, system-ui, sans-serif, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"}},border:{radius:{xs:"calc(var(--tsrd-font-size) * 0.125)",sm:"calc(var(--tsrd-font-size) * 0.25)",md:"calc(var(--tsrd-font-size) * 0.375)",full:"9999px"}},size:{0:"0px",.5:"calc(var(--tsrd-font-size) * 0.125)",1:"calc(var(--tsrd-font-size) * 0.25)",1.5:"calc(var(--tsrd-font-size) * 0.375)",2:"calc(var(--tsrd-font-size) * 0.5)",2.5:"calc(var(--tsrd-font-size) * 0.625)",3:"calc(var(--tsrd-font-size) * 0.75)",3.5:"calc(var(--tsrd-font-size) * 0.875)",4:"calc(var(--tsrd-font-size) * 1)",5:"calc(var(--tsrd-font-size) * 1.25)",8:"calc(var(--tsrd-font-size) * 2)"}},Gt=r=>{const{colors:e,font:i,size:t,alpha:c,border:a}=D,{fontFamily:l,lineHeight:v,size:u}=i,o=r?ue.bind({target:r}):ue;return{devtoolsPanelContainer:o`
|
|
2
2
|
direction: ltr;
|
|
3
3
|
position: fixed;
|
|
4
4
|
bottom: 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var qy=Object.defineProperty;var Em=r=>{throw TypeError(r)};var _y=(r,e,t)=>e in r?qy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var we=(r,e,t)=>_y(r,typeof e!="symbol"?e+"":e,t),Du=(r,e,t)=>e.has(r)||Em("Cannot "+t);var C=(r,e,t)=>(Du(r,e,"read from private field"),t?t.call(r):e.get(r)),P=(r,e,t)=>e.has(r)?Em("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),I=(r,e,t,n)=>(Du(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),mi=(r,e,t)=>(Du(r,e,"access private method"),t);import{
|
|
1
|
+
var qy=Object.defineProperty;var Em=r=>{throw TypeError(r)};var _y=(r,e,t)=>e in r?qy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var we=(r,e,t)=>_y(r,typeof e!="symbol"?e+"":e,t),Du=(r,e,t)=>e.has(r)||Em("Cannot "+t);var C=(r,e,t)=>(Du(r,e,"read from private field"),t?t.call(r):e.get(r)),P=(r,e,t)=>e.has(r)?Em("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),I=(r,e,t,n)=>(Du(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),mi=(r,e,t)=>(Du(r,e,"access private method"),t);import{nL as Dm,nM as $y,nN as jy,nO as Rd,nP as Vy,nQ as Wy,nR as Uy,r as B,i7 as z4,et as Fl,nS as Od,nT as Id,nU as no,nV as Rm,nW as Ky,nX as Gy,nY as Kh,nZ as Xi,n_ as qr,eF as Yy,n$ as g0,o0 as wr,o1 as Jy,o2 as Xy,o3 as Om,o4 as Js,o5 as Zy,o6 as y0,j as L,aE as Qy,aa as e7}from"./index-DMYBI16t.js";import{aw as t7,ax as r7,ab as n7,ac as i7,ad as o7,ae as s7,af as a7,ag as L4,ah as l7,q as q0,ai as c7,aj as B4,ar as u7,ak as d7,al as h7,am as f7,an as p7,ao as m7,ap as g7,aq as y7,Z as Gh,a4 as v7,a5 as P4,a6 as b7,a7 as w7,a8 as x7,a9 as k7,aa as S7,E as na,as as C7,t as nt,at as M7,n as T7,C as Im}from"./index-DR1JT9Uz.js";const A7={}.hasOwnProperty;function F4(r,e){let t=-1,n;if(e.extensions)for(;++t<e.extensions.length;)F4(r,e.extensions[t]);for(n in e)if(A7.call(e,n))switch(n){case"extensions":break;case"unsafe":{zm(r[n],e[n]);break}case"join":{zm(r[n],e[n]);break}case"handlers":{N7(r[n],e[n]);break}default:r.options[n]=e[n]}return r}function zm(r,e){e&&r.push(...e)}function N7(r,e){e&&Object.assign(r,e)}const E7=[D7];function D7(r,e,t,n){if(e.type==="code"&&Dm(e,n)&&(r.type==="list"||r.type===e.type&&Dm(r,n)))return!1;if("spread"in t&&typeof t.spread=="boolean")return r.type==="paragraph"&&(r.type===e.type||e.type==="definition"||e.type==="heading"&&$y(e,n))?void 0:t.spread?1:0}const gi=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],R7=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
|
2
2
|
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:gi},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
|
3
3
|
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:gi},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
|
4
4
|
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:gi},{atBreak:!0,character:"+",after:`(?:[ \r
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{eF as Ee,Q as xe,aD as Re,r as ve,ad as Se,j,aa as Ce}from"./index-DMYBI16t.js";import{u as Oe}from"./index-CejezM4U.js";import{r as Te}from"./use-session-canvas-Bqs6IQO7.js";import"./rotate-cw-xvfipJLN.js";import"./McpAppFrame-B1ThSf2U.js";var he={exports:{}};/* @license
|
|
2
2
|
Papa Parse
|
|
3
3
|
v5.7.0
|
|
4
4
|
https://github.com/mholt/PapaParse
|
|
@@ -12,4 +12,4 @@ License: MIT
|
|
|
12
12
|
`&&(r=`
|
|
13
13
|
`);var u=0,D=!1;this.parse=function(l,d,i){if(typeof l!="string")throw new Error("Input must be a string");var F=l.length,k=e.length,x=r.length,M=s.length,p=E(n),f=[],b=[],a=[],R=u=0;if(!l)return T();if(I||I!==!1&&l.indexOf(w)===-1){for(var O=l.split(r),_=0;_<O.length;_++){if(a=O[_],u+=a.length,_!==O.length-1)u+=r.length;else if(i)return T();if(!s||a.substring(0,M)!==s){if(p){if(f=[],Z(a.split(e)),K(),D)return T()}else Z(a.split(e));if(g&&g<=_)return f=f.slice(0,g),T(!0)}}return T()}for(var y=l.indexOf(e,u),c=l.indexOf(r,u),q=new RegExp(ie(A)+ie(w),"g"),h=l.indexOf(w,u);;)if(l[u]===w)for(h=u,u++;;){if((h=l.indexOf(w,h+1))===-1)return i||b.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:f.length,index:u}),B();if(h===F-1)return B(l.substring(u,h).replace(q,w));if(w===A&&l[h+1]===A)h++;else if(w===A||h===0||l[h-1]!==A){y!==-1&&y<h+1&&(y=l.indexOf(e,h+1));var v=ee((c=c!==-1&&c<h+1?l.indexOf(r,h+1):c)===-1?y:Math.min(y,c));if(l.substr(h+1+v,k)===e){a.push(l.substring(u,h).replace(q,w)),l[u=h+1+v+k]!==w&&(h=l.indexOf(w,u)),y=l.indexOf(e,u),c=l.indexOf(r,u);break}if(v=ee(c),l.substring(h+1+v,h+1+v+x)===r){if(a.push(l.substring(u,h).replace(q,w)),se(h+1+v+x),y=l.indexOf(e,u),h=l.indexOf(w,u),p&&(K(),D))return T();if(g&&f.length>=g)return T(!0);break}b.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:f.length,index:u}),h++}}else if(s&&a.length===0&&l.substring(u,u+M)===s){if(c===-1)return T();u=c+x,c=l.indexOf(r,u),y=l.indexOf(e,u)}else if(y!==-1&&(y<c||c===-1))a.push(l.substring(u,y)),u=y+k,y=l.indexOf(e,u);else{if(c===-1)break;if(a.push(l.substring(u,c)),se(c+x),p&&(K(),D))return T();if(g&&f.length>=g)return T(!0)}return B();function Z(S){f.push(S),R=u}function ee(S){var L=0;return L=S!==-1&&(S=l.substring(h+1,S))&&S.trim()===""?S.length:L}function B(S){return i||(S===void 0&&(S=l.substring(u)),a.push(S),u=F,Z(a),p&&K()),T()}function se(S){u=S,Z(a),a=[],c=l.indexOf(r,u)}function T(S){if(t.header&&!d&&f.length&&!Q){var L=f[0],V=Object.create(null),fe=new Set(L);let me=!1;for(let te=0;te<L.length;te++){let W=P(L[te]);if(V[W=E(t.transformHeader)?t.transformHeader(W,te):W]){let ae,ye=V[W];for(;ae=W+"_"+ye,ye++,fe.has(ae););fe.add(ae),L[te]=ae,V[W]++,me=!0,(U=U===null?{}:U)[ae]=W}else V[W]=1,L[te]=W;fe.add(W)}me&&console.warn("Duplicate headers found and renamed."),Q=!0}return{data:f,errors:b,meta:{delimiter:e,linebreak:r,aborted:D,truncated:!!S,cursor:R+(d||0),renamedHeaders:U}}}function K(){n(T()),f=[],b=[]}},this.abort=function(){D=!0},this.getCharIndex=function(){return u}}function be(t){var e=t.data,r=G[e.workerId],s=!1;if(e.error)r.userError(e.error,e.file);else if(e.results&&e.results.data){var n={abort:function(){s=!0,ge(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_e,resume:_e};if(E(r.userStep)){for(var g=0;g<e.results.data.length&&(r.userStep({data:e.results.data[g],errors:e.results.errors,meta:e.results.meta},n),!s);g++);delete e.results}else E(r.userChunk)&&(r.userChunk(e.results,n,e.file),delete e.results)}e.finished&&!s&&ge(e.workerId,e.results)}function ge(t,e){var r=G[t];E(r.userComplete)&&r.userComplete(e),r.terminate(),delete G[t]}function _e(){throw new Error("Not implemented.")}function de(t){if(typeof t!="object"||t===null)return t;var e,r=Array.isArray(t)?[]:{};for(e in t)r[e]=de(t[e]);return r}function $(t,e){return function(){t.apply(e,arguments)}}function E(t){return typeof t=="function"}return o.parse=function(t,e){var r=(e=e||{}).dynamicTyping||!1;if(E(r)&&(e.dynamicTypingFunction=r,r={}),e.dynamicTyping=r,e.transform=!!E(e.transform)&&e.transform,e.downloadTimeout!==void 0){var r=parseInt(e.downloadTimeout);if(isNaN(r))throw new Error("Config downloadTimeout value ("+e.downloadTimeout+") not parsable by parseInt(val).");e.downloadTimeout=r}if(!e.worker||!o.WORKERS_SUPPORTED)return r=null,o.NODE_STREAM_INPUT,typeof t=="string"?(t=P(t),r=new(e.download?re:ne)(e)):t.readable===!0&&E(t.read)&&E(t.on)?r=new ue(e):(m.File&&t instanceof File||t instanceof Object)&&(r=new oe(e)),r.stream(t);(r=(()=>{var s;return!!o.WORKERS_SUPPORTED&&(s=(()=>{var n=m.URL||m.webkitURL||null,g=J.toString();return o.BLOB_URL||(o.BLOB_URL=n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",g,")();"],{type:"text/javascript"})))})(),(s=new m.Worker(s)).onmessage=be,s.id=Y++,G[s.id]=s)})()).userStep=e.step,r.userChunk=e.chunk,r.userComplete=e.complete,r.userError=e.error,e.step=E(e.step),e.chunk=E(e.chunk),e.complete=E(e.complete),e.error=E(e.error),delete e.worker,r.postMessage({input:t,config:e,workerId:r.id})},o.unparse=function(t,e){var r=!1,s=!0,n=",",g=`\r
|
|
14
14
|
`,I='"',U=I+I,Q=!1,w=null,A=!1,u=((()=>{if(typeof e=="object"){if(typeof e.delimiter!="string"||o.BAD_DELIMITERS.filter(function(d){return e.delimiter.indexOf(d)!==-1}).length||(n=e.delimiter),typeof e.quotes!="boolean"&&typeof e.quotes!="function"&&!Array.isArray(e.quotes)||(r=e.quotes),typeof e.skipEmptyLines!="boolean"&&typeof e.skipEmptyLines!="string"||(Q=e.skipEmptyLines),typeof e.newline=="string"&&(g=e.newline),typeof e.quoteChar=="string"&&(I=e.quoteChar,U=I+I),typeof e.header=="boolean"&&(s=e.header),Array.isArray(e.columns)){if(e.columns.length===0)throw new Error("Option columns is empty");w=e.columns}e.escapeChar!==void 0&&(U=e.escapeChar+I),e.escapeFormulae instanceof RegExp?A=e.escapeFormulae:typeof e.escapeFormulae=="boolean"&&e.escapeFormulae&&(A=/^[=+\-@\t\r].*$/)}})(),new RegExp(ie(I),"g"));if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return D(null,t,Q);if(typeof t[0]=="object")return D(w||Object.keys(t[0]),t,Q)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||w),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:typeof t.data[0]=="object"?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||typeof t.data[0]=="object"||(t.data=[t.data])),D(t.fields||[],t.data||[],Q);throw new Error("Unable to serialize unrecognized input");function D(d,i,F){var k="",x=(typeof d=="string"&&(d=JSON.parse(d)),typeof i=="string"&&(i=JSON.parse(i)),Array.isArray(d)&&0<d.length),M=!Array.isArray(i[0]);if(x&&s){for(var p=0;p<d.length;p++)0<p&&(k+=n),k+=l(d[p],p);0<i.length&&(k+=g)}for(var f=0;f<i.length;f++){var b=(x?d:i[f]).length,a=!1,R=x?Object.keys(i[f]).length===0:i[f].length===0;if(F&&!x&&(a=F==="greedy"?i[f].join("").trim()==="":i[f].length===1&&i[f][0].length===0),F==="greedy"&&x){for(var O=[],_=0;_<b;_++){var y=M?d[_]:_;O.push(i[f][y])}a=O.join("").trim()===""}if(!a){for(var c=0;c<b;c++){0<c&&!R&&(k+=n);var q=x&&M?d[c]:c;k+=l(i[f][q],c)}f<i.length-1&&(!F||0<b&&!R)&&(k+=g)}}return k}function l(d,i){var F,k,x;return d==null?"":d.constructor===Date?isNaN(d.getTime())?"":d.toISOString():(x=!1,A&&typeof d=="string"&&A.test(d)&&(d="'"+d,x=!0),k=(F=d.toString()).replace(u,U),(x=x||r===!0||typeof r=="function"&&r(d,i)||Array.isArray(r)&&r[i]||((M,p)=>{for(var f=0;f<p.length;f++)if(-1<M.indexOf(p[f]))return!0;return!1})(k,o.BAD_DELIMITERS)||-1<k.indexOf(n)||-1<F.indexOf(I)||k.charAt(0)===" "||k.charAt(k.length-1)===" ")?I+k+I:k)}},o.RECORD_SEP="",o.UNIT_SEP="",o.BYTE_ORDER_MARK="\uFEFF",o.BAD_DELIMITERS=["\r",`
|
|
15
|
-
`,'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!C&&!!m.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=le,o.ParserHandle=pe,o.NetworkStreamer=re,o.FileStreamer=oe,o.StringStreamer=ne,o.ReadableStreamStreamer=ue,N&&(m.onmessage=function(t){t=t.data,o.WORKER_ID===void 0&&t&&(o.WORKER_ID=t.workerId),typeof t.input=="string"?m.postMessage({workerId:o.WORKER_ID,results:o.parse(t.input,t.config),finished:!0}):(m.File&&t.input instanceof File||t.input instanceof Object)&&(t=o.parse(t.input,t.config))&&m.postMessage({workerId:o.WORKER_ID,results:t,finished:!0})}),(re.prototype=Object.create(z.prototype)).constructor=re,(oe.prototype=Object.create(z.prototype)).constructor=oe,(ne.prototype=Object.create(ne.prototype)).constructor=ne,(ue.prototype=Object.create(z.prototype)).constructor=ue,o})})(he)),he.exports}var De=Ae();const Le=Ee(De),we=32;function
|
|
15
|
+
`,'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!C&&!!m.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=le,o.ParserHandle=pe,o.NetworkStreamer=re,o.FileStreamer=oe,o.StringStreamer=ne,o.ReadableStreamStreamer=ue,N&&(m.onmessage=function(t){t=t.data,o.WORKER_ID===void 0&&t&&(o.WORKER_ID=t.workerId),typeof t.input=="string"?m.postMessage({workerId:o.WORKER_ID,results:o.parse(t.input,t.config),finished:!0}):(m.File&&t.input instanceof File||t.input instanceof Object)&&(t=o.parse(t.input,t.config))&&m.postMessage({workerId:o.WORKER_ID,results:t,finished:!0})}),(re.prototype=Object.create(z.prototype)).constructor=re,(oe.prototype=Object.create(z.prototype)).constructor=oe,(ne.prototype=Object.create(ne.prototype)).constructor=ne,(ue.prototype=Object.create(z.prototype)).constructor=ue,o})})(he)),he.exports}var De=Ae();const Le=Ee(De),we=32;function Pe({content:H}){const X=xe(),J=Re(P=>P.selectedCwd),m=ve.useMemo(()=>Te(H.src,P=>X.mediaUrl(J??"",P)),[H.src,X,J]),{data:C,error:N,isLoading:G}=Se({queryKey:["canvas-csv",m.url],enabled:m.url!==null,queryFn:async()=>{const P=await fetch(m.url);if(!P.ok)throw new Error(`Failed to load CSV (${P.status})`);const z=await P.text();return Le.parse(z.trim(),{skipEmptyLines:!0}).data},staleTime:6e4,retry:!1});if(m.url===null)return j.jsx(ce,{children:"This CSV source can’t be displayed here."});if(G)return j.jsx(ce,{children:"Loading CSV…"});if(N||!C||C.length===0)return j.jsx(ce,{children:"This CSV couldn’t be loaded."});const[Y,...o]=C;return j.jsx(je,{header:Y,rows:o})}function je({header:H,rows:X}){const J=ve.useRef(null),m=Oe({count:X.length,getScrollElement:()=>J.current,estimateSize:()=>we,overscan:12});return j.jsx("div",{ref:J,className:"h-full overflow-auto",children:j.jsxs("table",{className:"w-full border-collapse text-sm",children:[j.jsx("thead",{className:"bg-muted sticky top-0 z-10",children:j.jsx("tr",{children:H.map((C,N)=>j.jsx("th",{className:"text-muted-foreground border-b px-3 py-1.5 text-left font-medium whitespace-nowrap",children:C},N))})}),j.jsx("tbody",{style:{height:m.getTotalSize(),position:"relative"},children:m.getVirtualItems().map(C=>{const N=X[C.index];return j.jsx("tr",{className:Ce("absolute flex w-full",C.index%2===1&&"bg-muted/30"),style:{transform:`translateY(${C.start}px)`,height:we},children:H.map((G,Y)=>j.jsx("td",{className:"flex-1 truncate border-b px-3 py-1.5 whitespace-nowrap",title:N[Y]??"",children:N[Y]??""},Y))},C.key)})})]})})}function ce({children:H}){return j.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:j.jsx("p",{children:H})})}export{Pe as CanvasCsvContent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-BYdz0ipX.js","assets/index-DMYBI16t.js","assets/index-Dgp1LmEk.css","assets/index-D3DXMH4x.js","assets/index-DR1JT9Uz.js","assets/BlintzCanvas-CXi0fvcM.js","assets/BlintzCanvas-GgiCXV7C.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Q as H,aD as b,aE as q,ad as K,r,j as t,R as V,aa as $,B as R,aF as G,aG as U,aH as F}from"./index-DMYBI16t.js";import{u as Y}from"./use-session-canvas-Bqs6IQO7.js";import{R as I}from"./rotate-cw-xvfipJLN.js";import"./McpAppFrame-B1ThSf2U.js";const J=r.lazy(()=>F(()=>import("./CodeMirrorEditor-BYdz0ipX.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),W=r.lazy(()=>F(()=>import("./BlintzCanvas-CXi0fvcM.js"),__vite__mapDeps([5,1,2,4,6])).then(e=>({default:e.BlintzCanvas}))),X=500;function w(e,o){return["canvas-file",e,o]}function Z(e,o){return o==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function ee(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function te(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function ie({content:e,documentId:o}){const m=H(),i=b(s=>s.selectedCwd),C=b(s=>s.setDocumentEditing),a=b(s=>{var f;return((f=s.openDocuments.find(j=>j.id===o))==null?void 0:f.editing)??!1}),h=q(),{data:c,error:x,isLoading:T}=K({queryKey:w(i,e.sourcePath),enabled:i!==null,queryFn:()=>m.readFileContent(i,e.sourcePath),staleTime:3e4,retry:!1}),[d,v]=r.useState(null),p=s=>{v(s&&c?{pinnedHash:c.hash}:null)};if(i===null)return t.jsx(k,{children:"Open a session to view files."});if(T)return t.jsx(k,{children:"Loading file…"});if(x||!c)return t.jsx(k,{children:ee(x)});const u=d!==null&&a,n=(u?d==null?void 0:d.pinnedHash:null)??c.hash;return t.jsx(se,{content:e,documentId:o,cwd:i,loaded:c.content,theme:h,isEditing:u,onEditingChange:p,setDocumentEditing:C},`${e.sourcePath}:${n}`)}function se({content:e,documentId:o,cwd:m,loaded:i,theme:C,isEditing:a,onEditingChange:h,setDocumentEditing:c}){const x=e.readOnly!==!0,T=Z(e.sourcePath,e.language),d=V(),[v,p]=r.useState(i),u=Y({sourcePath:e.sourcePath,cwd:m,loadedContent:i}),n=r.useRef(null),s=r.useRef(v),f=r.useRef(0),j=r.useRef(0),g=r.useRef(u.save),E=r.useRef(h);r.useEffect(()=>{s.current=v,g.current=u.save,E.current=h});const P=r.useCallback(l=>{f.current+=1,s.current=l,p(l),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,g.current(s.current)},X)},[]),L=()=>{f.current+=1,s.current=i,p(i),h(!0),c(o,!0)},S=async()=>{n.current&&(clearTimeout(n.current),n.current=null);const l=s.current,Q=f.current,B=++j.current,y=await g.current(l);if(y.status!=="changed"&&y.status!=="no_op"||f.current!==Q||j.current!==B||y.confirmed.content!==l)return;const N=y.confirmed;N.content===s.current&&d.setQueryData(w(m,e.sourcePath),_=>_&&{..._,content:N.content,hash:N.hash}),h(!1),c(o,!1)},A=()=>{d.invalidateQueries({queryKey:w(m,e.sourcePath)})};r.useEffect(()=>{a||!n.current||(clearTimeout(n.current),n.current=null)},[a]),r.useEffect(()=>()=>{n.current&&(clearTimeout(n.current),g.current(s.current)),c(o,!1),E.current(!1)},[o,c]);const D=()=>{const l=u.adoptDisk();l!=null&&p(l)},M=()=>{u.overwrite(s.current)},z=te(u.status),O=a?v:i;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[x&&z&&t.jsx("span",{className:$("mt-3 text-xs",u.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:z}),!a&&t.jsx(R,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:A,"aria-label":"Refresh from disk",children:t.jsx(I,{className:"size-4"})}),x&&t.jsx(R,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:a?()=>void S():L,"aria-label":a?"Finish editing":"Edit file",children:a?t.jsx(G,{className:"size-4"}):t.jsx(U,{className:"size-4"})})]}),u.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(R,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:D,children:"Reload"}),t.jsx(R,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:M,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:T?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(W,{value:O,editable:a,onChange:a?P:void 0})}):t.jsx(J,{value:O,editable:a,filename:e.sourcePath,languageHint:e.language,theme:C,onChange:a?P:void 0})})})]})}function k({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{ie as CanvasFileContent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-DlcQ3-LS.js","assets/index-DMYBI16t.js","assets/index-Dgp1LmEk.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Q as n,aD as u,r as l,j as t,aH as d}from"./index-DMYBI16t.js";import{r as f}from"./use-session-canvas-Bqs6IQO7.js";import"./rotate-cw-xvfipJLN.js";import"./McpAppFrame-B1ThSf2U.js";const c=l.lazy(()=>d(()=>import("./Model3dViewer-DlcQ3-LS.js"),__vite__mapDeps([0,1,2])).then(r=>({default:r.Model3dViewer})));function m(r){var s;const e=(s=r.split(".").pop())==null?void 0:s.toLowerCase();return e==="glb"||e==="gltf"?"gltf":e==="stl"?"stl":e==="obj"?"obj":e==="3mf"?"3mf":e==="ply"?"ply":e==="fbx"?"fbx":e==="dae"?"dae":null}function v({content:r}){const e=n(),s=u(o=>o.selectedCwd),a=l.useMemo(()=>f(r.src,o=>e.mediaUrl(s??"",o)),[r.src,e,s]),i=l.useMemo(()=>m(r.src),[r.src]);return a.url===null||i===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(l.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(c,{url:a.url,format:i,label:r.title??"Canvas 3D model"})})})}export{v as CanvasModel3dContent,m as formatOf};
|