@hearsay-tools/squawk 0.19.0-pr4622.9211 → 0.19.0-pr4622.9212

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.
Files changed (84) hide show
  1. package/dist/server/project-settings-routes.d.ts +107 -107
  2. package/dist/server/provider-sign-in-routes.d.ts +2 -2
  3. package/dist/server/runner-install-routes.d.ts +10 -10
  4. package/dist/server/runs-routes.d.ts +16 -16
  5. package/dist/server/server.d.ts +1170 -1170
  6. package/dist/server/workspace-identity-routes.d.ts +5 -5
  7. package/package.json +4 -4
  8. package/web/dist/assets/{accounts-section-CKWqAxEQ.js → accounts-section-BinzShaf.js} +1 -1
  9. package/web/dist/assets/{activity-motion-BlhXAVnS.js → activity-motion-BvqTKSqo.js} +1 -1
  10. package/web/dist/assets/{activity-route-BfsOrdeD.js → activity-route-DPk44gEy.js} +1 -1
  11. package/web/dist/assets/{agent-accounts-DKK4W3xn.js → agent-accounts-ChU4vfBl.js} +1 -1
  12. package/web/dist/assets/{agent-config-section-BY92FMFf.js → agent-config-section-CcQAu9b7.js} +2 -2
  13. package/web/dist/assets/{agent-defaults-section-DGYwfnYh.js → agent-defaults-section-CSqx1479.js} +1 -1
  14. package/web/dist/assets/{appearance-BGjaVf7D.js → appearance-DH-VN7Hg.js} +1 -1
  15. package/web/dist/assets/{archive-on-merge-field-BrS2zm1g.js → archive-on-merge-field-CqTj_p3K.js} +1 -1
  16. package/web/dist/assets/{ask-card-Dc1pCn2B.js → ask-card-Dn7OYHTC.js} +2 -2
  17. package/web/dist/assets/{automations-route-B1B7zQgr.js → automations-route-DWfE1BUv.js} +2 -2
  18. package/web/dist/assets/{commit-list-BaoYb5Dt.js → commit-list-CqWkVSfv.js} +1 -1
  19. package/web/dist/assets/{diff-CGZaTysl.js → diff-CO4Md6Jv.js} +2 -2
  20. package/web/dist/assets/{diff-controls-DulaH3EF.js → diff-controls-C-wQd4Ib.js} +1 -1
  21. package/web/dist/assets/{diff-view-DCCWqI57.js → diff-view-KejwMx_e.js} +1 -1
  22. package/web/dist/assets/{discard-changes-dialog-BXaM9RmZ.js → discard-changes-dialog-DJcvcxDg.js} +1 -1
  23. package/web/dist/assets/{file-preview-BvtY-4m2.js → file-preview-BSAsYRmQ.js} +1 -1
  24. package/web/dist/assets/{folder-browser-BztgyA2p.js → folder-browser-BvE0XQDC.js} +1 -1
  25. package/web/dist/assets/{git-toolbar-bhQ7aTtR.js → git-toolbar-BoP7hEiL.js} +1 -1
  26. package/web/dist/assets/github-Brwd2u17.js +1 -0
  27. package/web/dist/assets/{global-activity-route-FJwugmwm.js → global-activity-route-ylRv5i0B.js} +1 -1
  28. package/web/dist/assets/hosts-BIgzlJ2i.js +1 -0
  29. package/web/dist/assets/index-Cf0HK2YW.js +21 -0
  30. package/web/dist/assets/label-D6E1lpRI.js +1 -0
  31. package/web/dist/assets/{markdown-WuLAJnyd.js → markdown-_RWbSoHA.js} +1 -1
  32. package/web/dist/assets/{open-in-menu-CYVvplCT.js → open-in-menu-zrukT4IK.js} +1 -1
  33. package/web/dist/assets/{option-select-7AnGvvB1.js → option-select-BtavcdtM.js} +1 -1
  34. package/web/dist/assets/{preferences-section-BcGAVrXN.js → preferences-section-DBoTeoB0.js} +1 -1
  35. package/web/dist/assets/{preview-pane-connected-CNSFmeOm.js → preview-pane-connected-CqZ7qR53.js} +1 -1
  36. package/web/dist/assets/{project-location-CevhmYtx.js → project-location-DQob1g0E.js} +1 -1
  37. package/web/dist/assets/projects-section-ClWFVviV.js +1 -0
  38. package/web/dist/assets/{prompt-templates-section-CBvPHVqL.js → prompt-templates-section-C32HXWo3.js} +2 -2
  39. package/web/dist/assets/queries-CNjDebHy.js +1 -0
  40. package/web/dist/assets/{read-state-D9a4i8-k.js → read-state-B1VLxOM6.js} +1 -1
  41. package/web/dist/assets/{reference-chip-CW8i_sq3.js → reference-chip-Bj_PKUc4.js} +1 -1
  42. package/web/dist/assets/{remote-settings-notice-BR81Cf35.js → remote-settings-notice-C8VV_iw0.js} +1 -1
  43. package/web/dist/assets/{repo-git-D2lw4Jb0.js → repo-git-CjUQ0g26.js} +1 -1
  44. package/web/dist/assets/{report-reader-BDPP4dVK.js → report-reader-C_yAYPmW.js} +1 -1
  45. package/web/dist/assets/{report-selection-CJ-q2Dc5.js → report-selection-D-asrNb1.js} +1 -1
  46. package/web/dist/assets/{reports-Ber7rhF2.js → reports-DtdpSXDD.js} +1 -1
  47. package/web/dist/assets/{resources-section-DfPp8Jln.js → resources-section-PEx4v01N.js} +1 -1
  48. package/web/dist/assets/{review-notes-drafts-DFiWzQLc.js → review-notes-drafts-C2MYGz6Z.js} +1 -1
  49. package/web/dist/assets/{review-panel-BZY9n7NK.js → review-panel-I3KgOMmg.js} +1 -1
  50. package/web/dist/assets/{review-strip-DsmIhl6m.js → review-strip-OOHBg4No.js} +1 -1
  51. package/web/dist/assets/{run-detail-refresh-u-eY7R4u.js → run-detail-refresh-CoCrbq8v.js} +1 -1
  52. package/web/dist/assets/{run-diff-6l-f4FRx.js → run-diff-DlyvdCr9.js} +1 -1
  53. package/web/dist/assets/{run-header-CZkXDDXM.js → run-header-CC-99Rq_.js} +2 -2
  54. package/web/dist/assets/{select-BXM-MFR0.js → select-DaeMMrqM.js} +1 -1
  55. package/web/dist/assets/{session-context-section-JsdhWEPi.js → session-context-section-DkPFGHH0.js} +1 -1
  56. package/web/dist/assets/{settings-agent-picker-DcPaMYPH.js → settings-agent-picker-wN3FpFa5.js} +1 -1
  57. package/web/dist/assets/{settings-save-bar-D0m7WuMo.js → settings-save-bar-PHQFfhCk.js} +1 -1
  58. package/web/dist/assets/{settings-shell-DQmyZ9hT.js → settings-shell-Z0rNc1xx.js} +1 -1
  59. package/web/dist/assets/{sidebar-section-Bs-cg8z3.js → sidebar-section-BE5SSKrX.js} +1 -1
  60. package/web/dist/assets/{skills-B3Isk2OO.js → skills-Dm5hGdd8.js} +1 -1
  61. package/web/dist/assets/{task-changes-DOjyd1uO.js → task-changes-CS1uSQfH.js} +2 -2
  62. package/web/dist/assets/{task-commits-B-0XCAhO.js → task-commits-DCbUyMTZ.js} +1 -1
  63. package/web/dist/assets/{task-file-scope-jCHWm0DC.js → task-file-scope-CcmDJfUC.js} +1 -1
  64. package/web/dist/assets/{task-files-Dhui8MYu.js → task-files-CO9gRC8O.js} +1 -1
  65. package/web/dist/assets/{task-github-item-BLQQTXu-.js → task-github-item-C7Qtl-R4.js} +1 -1
  66. package/web/dist/assets/{task-groups-D4siwI6y.js → task-groups-1B3qWNle.js} +1 -1
  67. package/web/dist/assets/task-thread-BXPhkg3D.js +2 -0
  68. package/web/dist/assets/{thread-state-B8eN7DGY.js → thread-state-Co15rrhn.js} +1 -1
  69. package/web/dist/assets/{use-finish-run-DEFzV087.js → use-finish-run-BAu374MO.js} +1 -1
  70. package/web/dist/assets/{use-hand-to-agent-state-CEXvipNt.js → use-hand-to-agent-state-BO7f9Vja.js} +1 -1
  71. package/web/dist/assets/use-path-bases-DQnmY-WP.js +1 -0
  72. package/web/dist/assets/{use-workspace-config-save-DmWYyw7u.js → use-workspace-config-save-y-EQHm5n.js} +1 -1
  73. package/web/dist/assets/{workflows-DQviiLA5.js → workflows-Bawt8WPJ.js} +2 -2
  74. package/web/dist/assets/{workspace-tools-CYG6A_wz.js → workspace-tools-Bjxxd-mY.js} +1 -1
  75. package/web/dist/assets/{worktrees-section-GOAfXLaQ.js → worktrees-section-CqdaU9Rf.js} +4 -4
  76. package/web/dist/index.html +12 -12
  77. package/web/dist/assets/github-ByGLDkz7.js +0 -1
  78. package/web/dist/assets/hosts-D9Mbe3-s.js +0 -1
  79. package/web/dist/assets/index-C_yV_XCP.js +0 -21
  80. package/web/dist/assets/label-B7NZNRTj.js +0 -1
  81. package/web/dist/assets/projects-section-BQamIjAJ.js +0 -1
  82. package/web/dist/assets/queries-CAsaqjt8.js +0 -1
  83. package/web/dist/assets/task-thread-Qla6wJW_.js +0 -2
  84. package/web/dist/assets/use-path-bases-De5S6oTw.js +0 -1
@@ -1,7 +1,7 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Jt as r,Vt as i,Xt as a,b as o,en as s,h as c,m as l,vt as u}from"./queries-CAsaqjt8.js";import{Cn as d,Ji as f,n as p}from"./toaster-Dglox5F-.js";import{o as m}from"./dist-CCX8mhHc.js";import{t as h}from"./button-BV_AiLj2.js";import{t as g}from"./badge-DAnkqD7i.js";import{t as _}from"./centered-state-N8vWM_Hw.js";import{F as v,Hn as y,Rn as b,br as x}from"./index-C_yV_XCP.js";import{n as S,r as C,t as w}from"./remote-settings-notice-BR81Cf35.js";import{t as T}from"./use-path-bases-De5S6oTw.js";import{t as E}from"./code-editor-DZMD1guX.js";import{t as D}from"./discard-changes-dialog-BXaM9RmZ.js";import{r as O}from"./settings-save-bar-D0m7WuMo.js";var k=e(t(),1);function A(e){return t=>t.runners.includes(e)}function j(e,t){let n=A(e);return e=>n(e)&&e.kind===t}function M(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:j(e.id,t)}))}}function N(e){return r(e).map(M)}var P=n();function F(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function I(){let e=l(),t=C(),n=u(),r=s(),i=r.data,o=(0,k.useMemo)(()=>N(i),[i]),c=(0,k.useMemo)(()=>n.data?v(n.data.checks,i):a(i),[n.data,i]);return r.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(x,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(x,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||i===void 0?(0,P.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,P.jsx)(L,{listing:e.data,descriptors:o,installed:c,onOpenFile:t})}function L({listing:e,descriptors:t,installed:n,onOpenFile:r}){let[i,a]=(0,k.useState)(`claude`),[o,s]=(0,k.useState)(null),[c,l]=(0,k.useState)(!1),[u,d]=(0,k.useState)(null),f=t.find(e=>e.id===i)??t[0];if(f===void 0)return null;let p=R(f,e),h=p.find(e=>e.id===o)??z(p),_=e=>{c?d(()=>e):e()},v=e=>{e!==f.id&&_(()=>{a(e),s(null)})};return(0,P.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,P.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,P.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,P.jsx)(`code`,{children:w}),`.`]}),(0,P.jsx)(S,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,P.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===f.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===f.id,onClick:()=>v(e.id),className:m(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===f.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),f.note&&(0,P.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:f.note}),(0,P.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,P.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,P.jsx)(V,{agent:f,listing:e,selectedId:h?.id??null,onSelect:e=>{if(e===h?.id){r();return}_(()=>{s(e),r()})}})}),(0,P.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:h?(0,P.jsx)(U,{file:h,onDirtyChange:l},h.id):(0,P.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]}),(0,P.jsx)(D,{open:u!==null,subject:h?.label??`this file`,onKeep:()=>d(null),onDiscard:()=>{let e=u;d(null),l(!1),e?.()}})]})}function R(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function z(e){return e.find(e=>e.scope===`project`)??e[0]??null}var B={project:`Project scope`,local:`Local scope`,user:`User scope`};function V({agent:e,listing:t,selectedId:n,onSelect:r}){let i=T();return(0,P.jsx)(P.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,P.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,P.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,P.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.note}),o.length===0&&a.empty&&(0,P.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:a.empty}),(0,P.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),title:e.label,className:m(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,P.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,P.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),s&&(0,P.jsx)(H,{userMcp:s,path:y(s.path,i)})]},a.id)})})}function H({userMcp:e,path:t}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,P.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,P.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,P.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function U({file:e,onDirtyChange:t}){let n=c(e.id),r=T(),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(!1),[l,u]=(0,k.useState)(null),d=n.data?.version??null,f=i??n.data?.content??``,p=n.data?f!==n.data.content:!1,m=e.writable,h=e.kind===`mcp`||e.holdsMcp,_=m&&p;(0,k.useEffect)(()=>{t?.(_)},[_,t]),(0,k.useEffect)(()=>()=>t?.(!1),[t]);let{save:v}=J({file:e,content:f,loadedVersion:d,setDraft:a,setConflict:s,setFormatError:u});return O({dirty:m&&p,save:v,discard:()=>a(null)}),(0,k.useEffect)(()=>{n.data&&(a(n.data.content),s(!1),u(null))},[n.data?.version,n.data]),(0,P.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,P.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:B[e.scope]})]}),(0,P.jsx)(b,{"data-slot":`agent-config-path`,value:e.path,bases:r,className:`text-xs text-foreground`}),(0,P.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,P.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,P.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,P.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,P.jsx)(`h3`,{children:h?`MCP configuration`:`File contents`}),h&&(0,P.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),n.isPending?(0,P.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):n.isError?(0,P.jsx)(`p`,{className:`text-[13px] text-destructive`,children:n.error.message}):(0,P.jsx)(W,{file:e,content:f,isMcp:h,onChange:a}),(0,P.jsx)(K,{formatError:l,conflict:o,onReload:()=>void n.refetch()}),m&&!e.exists&&!p?(0,P.jsx)(`p`,{"data-slot":`agent-config-save-cue`,className:`text-xs text-muted-foreground`,children:`Enter content above to create this file.`}):null,(0,P.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,P.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,P.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[F(e),e.hotReload?` ${e.hotReload}`:``]}),(0,P.jsx)(q,{reason:e.readOnlyReason})]})]})}function W({file:e,content:t,isMcp:n,onChange:r}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,P.jsx)(E,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,P.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-soft-foreground`,children:G(e,n)})]})}function G(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Jt as r,Kt as i,Qt as a,b as o,h as s,in as c,m as l,vt as u}from"./queries-CNjDebHy.js";import{Cn as d,Ji as f,n as p}from"./toaster-Dglox5F-.js";import{o as m}from"./dist-CCX8mhHc.js";import{t as h}from"./button-BV_AiLj2.js";import{t as g}from"./badge-DAnkqD7i.js";import{t as _}from"./centered-state-N8vWM_Hw.js";import{F as v,Hn as y,Rn as b,br as x}from"./index-Cf0HK2YW.js";import{n as S,r as C,t as w}from"./remote-settings-notice-C8VV_iw0.js";import{t as T}from"./use-path-bases-DQnmY-WP.js";import{t as E}from"./code-editor-DZMD1guX.js";import{t as D}from"./discard-changes-dialog-DJcvcxDg.js";import{r as O}from"./settings-save-bar-PHQFfhCk.js";var k=e(t(),1);function A(e){return t=>t.runners.includes(e)}function j(e,t){let n=A(e);return e=>n(e)&&e.kind===t}function M(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:j(e.id,t)}))}}function N(e){return i(e).map(M)}var P=n();function F(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function I(){let e=l(),t=C(),n=u(),i=a(),o=i.data,s=(0,k.useMemo)(()=>N(o),[o]),c=(0,k.useMemo)(()=>n.data?v(n.data.checks,o):r(o),[n.data,o]);return i.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(x,{}),tone:`danger`,title:`Runners did not load`,subtitle:i.error.message,heading:`h2`}):e.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(x,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||o===void 0?(0,P.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,P.jsx)(L,{listing:e.data,descriptors:s,installed:c,onOpenFile:t})}function L({listing:e,descriptors:t,installed:n,onOpenFile:r}){let[i,a]=(0,k.useState)(`claude`),[o,s]=(0,k.useState)(null),[c,l]=(0,k.useState)(!1),[u,d]=(0,k.useState)(null),f=t.find(e=>e.id===i)??t[0];if(f===void 0)return null;let p=R(f,e),h=p.find(e=>e.id===o)??z(p),_=e=>{c?d(()=>e):e()},v=e=>{e!==f.id&&_(()=>{a(e),s(null)})};return(0,P.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,P.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,P.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,P.jsx)(`code`,{children:w}),`.`]}),(0,P.jsx)(S,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,P.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===f.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===f.id,onClick:()=>v(e.id),className:m(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===f.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),f.note&&(0,P.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:f.note}),(0,P.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,P.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,P.jsx)(V,{agent:f,listing:e,selectedId:h?.id??null,onSelect:e=>{if(e===h?.id){r();return}_(()=>{s(e),r()})}})}),(0,P.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:h?(0,P.jsx)(U,{file:h,onDirtyChange:l},h.id):(0,P.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]}),(0,P.jsx)(D,{open:u!==null,subject:h?.label??`this file`,onKeep:()=>d(null),onDiscard:()=>{let e=u;d(null),l(!1),e?.()}})]})}function R(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function z(e){return e.find(e=>e.scope===`project`)??e[0]??null}var B={project:`Project scope`,local:`Local scope`,user:`User scope`};function V({agent:e,listing:t,selectedId:n,onSelect:r}){let i=T();return(0,P.jsx)(P.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,P.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,P.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,P.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.note}),o.length===0&&a.empty&&(0,P.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:a.empty}),(0,P.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),title:e.label,className:m(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,P.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,P.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),s&&(0,P.jsx)(H,{userMcp:s,path:y(s.path,i)})]},a.id)})})}function H({userMcp:e,path:t}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,P.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,P.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,P.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function U({file:e,onDirtyChange:t}){let n=s(e.id),r=T(),[i,a]=(0,k.useState)(null),[o,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(null),d=n.data?.version??null,f=i??n.data?.content??``,p=n.data?f!==n.data.content:!1,m=e.writable,h=e.kind===`mcp`||e.holdsMcp,_=m&&p;(0,k.useEffect)(()=>{t?.(_)},[_,t]),(0,k.useEffect)(()=>()=>t?.(!1),[t]);let{save:v}=J({file:e,content:f,loadedVersion:d,setDraft:a,setConflict:c,setFormatError:u});return O({dirty:m&&p,save:v,discard:()=>a(null)}),(0,k.useEffect)(()=>{n.data&&(a(n.data.content),c(!1),u(null))},[n.data?.version,n.data]),(0,P.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,P.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:B[e.scope]})]}),(0,P.jsx)(b,{"data-slot":`agent-config-path`,value:e.path,bases:r,className:`text-xs text-foreground`}),(0,P.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,P.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,P.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,P.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,P.jsx)(`h3`,{children:h?`MCP configuration`:`File contents`}),h&&(0,P.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),n.isPending?(0,P.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):n.isError?(0,P.jsx)(`p`,{className:`text-[13px] text-destructive`,children:n.error.message}):(0,P.jsx)(W,{file:e,content:f,isMcp:h,onChange:a}),(0,P.jsx)(K,{formatError:l,conflict:o,onReload:()=>void n.refetch()}),m&&!e.exists&&!p?(0,P.jsx)(`p`,{"data-slot":`agent-config-save-cue`,className:`text-xs text-muted-foreground`,children:`Enter content above to create this file.`}):null,(0,P.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,P.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,P.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[F(e),e.hotReload?` ${e.hotReload}`:``]}),(0,P.jsx)(q,{reason:e.readOnlyReason})]})]})}function W({file:e,content:t,isMcp:n,onChange:r}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,P.jsx)(E,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,P.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-soft-foreground`,children:G(e,n)})]})}function G(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
2
2
  "mcpServers": {}
3
3
  }`:`{
4
4
  "permissions": {}
5
5
  }`}`;case`markdown`:return`<!-- File not created yet — write instructions here -->`;case`toml`:return`# File not created yet — example:
6
6
  # key = "value"`;case`yaml`:return`# File not created yet — example:
7
- # key: value`}}function K({formatError:e,conflict:t,onReload:n}){return(0,P.jsxs)(P.Fragment,{children:[e&&(0,P.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:e}),t&&(0,P.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,P.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,P.jsx)(h,{size:`sm`,variant:`outline`,onClick:n,children:`Reload from disk`})]})]})}function q({reason:e}){return e&&(0,P.jsx)(`p`,{children:e})}function J({file:e,content:t,loadedVersion:n,setDraft:r,setConflict:a,setFormatError:s}){let c=o(e.id),l=f(),u=C();return{save:()=>(s(null),a(!1),c.mutateAsync({content:t,version:n},{onSuccess:()=>{r(null)},onError:e=>{e instanceof d&&e.status===409?u().then(()=>{l.getQueryData(i.health)?.capabilities.settingsAdmin===!1?p(e.message,{tone:`danger`}):a(!0)}):e instanceof d&&e.status===400?s(e.message):p(e.message,{tone:`danger`})}}))}}export{I as AgentConfigSection};
7
+ # key: value`}}function K({formatError:e,conflict:t,onReload:n}){return(0,P.jsxs)(P.Fragment,{children:[e&&(0,P.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:e}),t&&(0,P.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,P.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,P.jsx)(h,{size:`sm`,variant:`outline`,onClick:n,children:`Reload from disk`})]})]})}function q({reason:e}){return e&&(0,P.jsx)(`p`,{children:e})}function J({file:e,content:t,loadedVersion:n,setDraft:r,setConflict:i,setFormatError:a}){let s=o(e.id),l=f(),u=C();return{save:()=>(a(null),i(!1),s.mutateAsync({content:t,version:n},{onSuccess:()=>{r(null)},onError:e=>{e instanceof d&&e.status===409?u().then(()=>{l.getQueryData(c.health)?.capabilities.settingsAdmin===!1?p(e.message,{tone:`danger`}):i(!0)}):e instanceof d&&e.status===400?a(e.message):p(e.message,{tone:`danger`})}}))}}export{I as AgentConfigSection};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,En as i,Ht as a,Jt as o,S as s,St as c,Vt as l,Xt as u,en as d,g as f,kt as p,nn as m,qt as h,tn as g,ut as _,wt as v,xt as y}from"./queries-CAsaqjt8.js";import{Cn as b,I as x,Ji as S,Ln as C,Zt as ee,a as w,n as T,vn as E}from"./toaster-Dglox5F-.js";import{c as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./button-BV_AiLj2.js";import{t as k}from"./switch-B9OfOEzC.js";import{t as A}from"./status-dot-DuorWA5M.js";import{n as j}from"./agent-accounts-DKK4W3xn.js";import{t as M}from"./centered-state-N8vWM_Hw.js";import{I as N,Mn as P,P as F,R as I}from"./index-C_yV_XCP.js";import{t as te}from"./textarea-BGp28xFr.js";import{t as L}from"./option-select-7AnGvvB1.js";import{a as ne,i as R,n as z,r as B,t as V}from"./settings-agent-picker-DcPaMYPH.js";import{n as H,t as U}from"./save-cue-CpHgT93o.js";import{n as W}from"./settings-field-AyinSFR_.js";import{r as G}from"./settings-save-bar-D0m7WuMo.js";import{n as K}from"./saved-draft-BwzBc-_Y.js";var q=e(t(),1),J=n(),Y={connected:P(`connected`),disconnected:P(`disconnected`),"not-installed":P(`not-installed`),unknown:P(`unknown`)};function X(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function re(e,t){return e?Y[e]:t?{label:`Checking…`,tone:`neutral`}:Y.unknown}function ie(e,t){return e===`unknown`||t&&!e}function ae({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,J.jsx)(`code`,{children:e.loginCommand}),`.`]}):ie(t,r)?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function oe({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`,u=H();return(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{saved:u.saved}),(0,J.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t,u.flash)})]}),l?(0,J.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>T(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,J.jsx)(z,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>T(`${e.displayName} can be tried again.`),onError:e=>T(e.message,{tone:`danger`})}),children:`Try again`})]})}function se({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,J.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,J.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ce(){let e=d(),t=c(),n=v(),r=p(),s=S(),[l,u]=(0,q.useState)(null),f=(0,q.useRef)(Promise.resolve()),m=(0,q.useRef)({}),_=(0,q.useRef)({}),y=(0,q.useRef)(t.data);(0,q.useEffect)(()=>{l&&C(t.data,l.provider)?.status===`connected`&&u(null)},[l,t.data]),(0,q.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!y.current){y.current=t.data;return}y.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?C(y.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let x=(0,q.useCallback)((e,t,n)=>{let r=a.providerStatus,i=s.getQueryData(r);if(!i)return;y.current||=i;let o=X(i,e,t);_.current[e]=(_.current[e]??0)+1,s.setQueryData(r,o);let c=(m.current[e]??0)+1;m.current[e]=c,f.current=f.current.then(async()=>{try{let i=await E(e,t),a=C(i,e)?.enabled;if(a===void 0)return;if(y.current=X(y.current??i,e,a),c===m.current[e]){let t=s.getQueryData(r);s.setQueryData(r,t?X(t,e,a):i),n()}}catch(t){if(c===m.current[e]){let n=C(y.current,e)?.enabled,i=s.getQueryData(r);i&&n!==void 0?s.setQueryData(r,X(i,e,n)):y.current?s.setQueryData(r,y.current):s.removeQueries({queryKey:r,exact:!0}),T(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[s]),w=i({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{u(null),T(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await s.invalidateQueries({queryKey:a.providerStatus}),await g(s,t,`none`)},onError:(t,n)=>{if(t instanceof b&&t.command){let r=h(e.data,n);u({provider:n,label:r,message:t.message,command:t.command});return}T(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),T(`Command copied`)}catch{T(`Could not copy the command`,{tone:`danger`})}};return(0,J.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,J.jsxs)(`div`,{className:`mb-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,J.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:o(e.data).map(e=>{let i=C(t.data,e.id),a=i?.status,o=re(a,t.isPending),s=w.isPending&&w.variables===e.id,c=i?.authFailureId;return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{tone:o.tone,pulse:t.isPending}),(0,J.jsx)(`span`,{children:o.label}),i?.enabled===!1?(0,J.jsx)(`span`,{children:`Disabled`}):null]}),(0,J.jsx)(ae,{provider:e,state:a,current:i,statusIsError:t.isError})]}),(0,J.jsx)(oe,{provider:e,state:a,current:i,isConnecting:s,incidentId:c,refresh:n,connect:w,retry:r,queueToggle:x})]}),c===void 0?null:(0,J.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,J.jsx)(se,{manual:l,provider:e.id,connected:a===`connected`,onCopy:D})]},e.id)})})]})}var Z=2e4;function le(){let e=f(),t=d(),n=m(u(t.data)),r=c();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,J.jsx)(M,{icon:(0,J.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(ue,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function ue({config:e,catalogs:t,providerStatus:n,runners:r}){let a=s(),c=S(),u=i({mutationFn:e=>x(e),onSuccess:e=>{c.setQueryData(l.config,e),c.invalidateQueries({queryKey:l.health}),c.invalidateQueries({queryKey:l.repo})},onError:e=>T(e.message,{tone:`danger`})}),[d,f]=K(e.systemPrompt??``),p=d.trim(),m=p===(e.systemPrompt??``),h=p.length>Z;G({dirty:!m,invalid:h,busy:u.isPending,save:()=>u.mutateAsync({systemPrompt:p===``?null:p}),discard:()=>f(e.systemPrompt??``)});let g=H(),_=H(),v=H(),y=H(),b=H(),C=(e,t)=>u.mutate(e,{onSuccess:t});return(0,J.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,J.jsx)(Q,{defaultRunner:e.defaultRunner,providerStatus:n,saving:u.isPending,saved:g.saved,onSaved:g.flash,onPick:e=>C({defaultRunner:e},g.flash)}),(0,J.jsx)(W,{wide:!0,title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Runner default lets the runner decide per task.`,saved:e.modelsLocked?void 0:_.saved,children:(0,J.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:o(r).map(i=>{let{providerConnected:a,providerReason:o}=ne(n,i.id),s=t[i.id],c=N(i.id,r,s),l=I(i.id,r,s?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=l.find(e=>e.id===d)?.label??d??`Runner default`;return(0,J.jsxs)(`label`,{className:`settings-option-row`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,J.jsx)(`output`,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,J.jsx)(L,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:u.isPending||!a,onValueChange:e=>C({defaultModels:{[i.id]:e||null}},_.flash),className:`settings-select max-w-full bg-card`,options:[...l.map(e=>({value:e.id,label:e.label})),...c?[{value:F,label:c,disabled:!0}]:[]]})]},i.id)})})}),(0,J.jsxs)(W,{wide:!0,title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,J.jsx)(te,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:d,onChange:e=>f(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,J.jsx)(de,{length:p.length,overLimit:h})]}),(0,J.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,J.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,saved:v.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:u.isPending,onCheckedChange:e=>C({liveTitleUpdates:e},v.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,saved:y.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:u.isPending,onCheckedChange:e=>C({reviewGate:e},y.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,saved:b.saved,children:a.data?.info?(0,J.jsx)(L,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:u.isPending,onValueChange:e=>C({baseBranch:e||null},b.flash),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...a.data.branches.map(e=>({value:e,label:e}))]}):(0,J.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:a.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,J.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,J.jsx)(`summary`,{children:`Provider connections`}),(0,J.jsx)(ce,{})]})]})}function Q({defaultRunner:e,providerStatus:t,saving:n,saved:i,onSaved:a,onPick:o}){let c=_(),l=y(),u=w(),f=s(),p=r(),m=u.projectId??`default`,h=f.data?.info?.root,g=j(c.data,u.projectId,h),v=d().data,b=B(c.data?.profiles??[],v),x=R(b,v);return(0,J.jsxs)(W,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,saved:i,children:[(0,J.jsx)(V,{rows:b,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:p.isPending||l.data===void 0,onPick:(t,n,r)=>{t!==e&&o(t),r&&p.mutate({projectId:m,provider:t,profileId:n},{onSuccess:a,onError:e=>T(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&C(t.data,e)?.enabled===!1?(0,J.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,x?(0,J.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function $({title:e,hint:t,saved:n,children:r}){return(0,J.jsxs)(`section`,{className:`settings-option-row`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{children:e}),(0,J.jsxs)(`p`,{children:[t,` `,(0,J.jsx)(U,{saved:n})]})]}),r]})}function de({length:e,overLimit:t}){return(0,J.jsx)(J.Fragment,{children:t?(0,J.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Z.toLocaleString(),`.`]}):(0,J.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})})}export{le as AgentDefaultsSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,At as i,En as a,Gt as o,Jt as s,Kt as c,Qt as l,S as u,St as d,an as f,en as p,g as m,in as h,kt as g,ut as _,wt as v,xt as y}from"./queries-CNjDebHy.js";import{Cn as b,I as x,Ji as S,Ln as C,Zt as ee,a as w,n as T,vn as E}from"./toaster-Dglox5F-.js";import{c as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./button-BV_AiLj2.js";import{t as k}from"./switch-B9OfOEzC.js";import{t as A}from"./status-dot-DuorWA5M.js";import{n as j}from"./agent-accounts-ChU4vfBl.js";import{t as M}from"./centered-state-N8vWM_Hw.js";import{I as N,Mn as P,P as F,R as I}from"./index-Cf0HK2YW.js";import{t as te}from"./textarea-BGp28xFr.js";import{t as L}from"./option-select-BtavcdtM.js";import{a as ne,i as R,n as z,r as B,t as V}from"./settings-agent-picker-wN3FpFa5.js";import{n as H,t as U}from"./save-cue-CpHgT93o.js";import{n as W}from"./settings-field-AyinSFR_.js";import{r as G}from"./settings-save-bar-PHQFfhCk.js";import{n as K}from"./saved-draft-BwzBc-_Y.js";var q=e(t(),1),J=n(),Y={connected:P(`connected`),disconnected:P(`disconnected`),"not-installed":P(`not-installed`),unknown:P(`unknown`)};function X(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function re(e,t){return e?Y[e]:t?{label:`Checking…`,tone:`neutral`}:Y.unknown}function ie(e,t){return e===`unknown`||t&&!e}function ae({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,J.jsx)(`code`,{children:e.loginCommand}),`.`]}):ie(t,r)?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function oe({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`,u=H();return(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{saved:u.saved}),(0,J.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t,u.flash)})]}),l?(0,J.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>T(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,J.jsx)(z,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>T(`${e.displayName} can be tried again.`),onError:e=>T(e.message,{tone:`danger`})}),children:`Try again`})]})}function se({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,J.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,J.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ce(){let e=l(),t=d(),n=v(),i=g(),s=S(),[u,p]=(0,q.useState)(null),m=(0,q.useRef)(Promise.resolve()),h=(0,q.useRef)({}),_=(0,q.useRef)({}),y=(0,q.useRef)(t.data);(0,q.useEffect)(()=>{u&&C(t.data,u.provider)?.status===`connected`&&p(null)},[u,t.data]),(0,q.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!y.current){y.current=t.data;return}y.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?C(y.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let x=(0,q.useCallback)((e,t,n)=>{let r=f.providerStatus,i=s.getQueryData(r);if(!i)return;y.current||=i;let a=X(i,e,t);_.current[e]=(_.current[e]??0)+1,s.setQueryData(r,a);let o=(h.current[e]??0)+1;h.current[e]=o,m.current=m.current.then(async()=>{try{let i=await E(e,t),a=C(i,e)?.enabled;if(a===void 0)return;if(y.current=X(y.current??i,e,a),o===h.current[e]){let t=s.getQueryData(r);s.setQueryData(r,t?X(t,e,a):i),n()}}catch(t){if(o===h.current[e]){let n=C(y.current,e)?.enabled,i=s.getQueryData(r);i&&n!==void 0?s.setQueryData(r,X(i,e,n)):y.current?s.setQueryData(r,y.current):s.removeQueries({queryKey:r,exact:!0}),T(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[s]),w=a({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{p(null),T(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await s.invalidateQueries({queryKey:f.providerStatus}),await r(s,t,`none`)},onError:(t,n)=>{if(t instanceof b&&t.command){let r=o(e.data,n);p({provider:n,label:r,message:t.message,command:t.command});return}T(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),T(`Command copied`)}catch{T(`Could not copy the command`,{tone:`danger`})}};return(0,J.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,J.jsxs)(`div`,{className:`mb-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,J.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:c(e.data).map(e=>{let r=C(t.data,e.id),a=r?.status,o=re(a,t.isPending),s=w.isPending&&w.variables===e.id,c=r?.authFailureId;return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{tone:o.tone,pulse:t.isPending}),(0,J.jsx)(`span`,{children:o.label}),r?.enabled===!1?(0,J.jsx)(`span`,{children:`Disabled`}):null]}),(0,J.jsx)(ae,{provider:e,state:a,current:r,statusIsError:t.isError})]}),(0,J.jsx)(oe,{provider:e,state:a,current:r,isConnecting:s,incidentId:c,refresh:n,connect:w,retry:i,queueToggle:x})]}),c===void 0?null:(0,J.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,J.jsx)(se,{manual:u,provider:e.id,connected:a===`connected`,onCopy:D})]},e.id)})})]})}var Z=2e4;function le(){let e=m(),t=l(),n=p(s(t.data)),r=d();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,J.jsx)(M,{icon:(0,J.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(ue,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function ue({config:e,catalogs:t,providerStatus:n,runners:r}){let i=u(),o=S(),s=a({mutationFn:e=>x(e),onSuccess:e=>{o.setQueryData(h.config,e),o.invalidateQueries({queryKey:h.health}),o.invalidateQueries({queryKey:h.repo})},onError:e=>T(e.message,{tone:`danger`})}),[l,d]=K(e.systemPrompt??``),f=l.trim(),p=f===(e.systemPrompt??``),m=f.length>Z;G({dirty:!p,invalid:m,busy:s.isPending,save:()=>s.mutateAsync({systemPrompt:f===``?null:f}),discard:()=>d(e.systemPrompt??``)});let g=H(),_=H(),v=H(),y=H(),b=H(),C=(e,t)=>s.mutate(e,{onSuccess:t});return(0,J.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,J.jsx)(Q,{defaultRunner:e.defaultRunner,providerStatus:n,saving:s.isPending,saved:g.saved,onSaved:g.flash,onPick:e=>C({defaultRunner:e},g.flash)}),(0,J.jsx)(W,{wide:!0,title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Runner default lets the runner decide per task.`,saved:e.modelsLocked?void 0:_.saved,children:(0,J.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:c(r).map(i=>{let{providerConnected:a,providerReason:o}=ne(n,i.id),c=t[i.id],l=N(i.id,r,c),u=I(i.id,r,c?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`Runner default`;return(0,J.jsxs)(`label`,{className:`settings-option-row`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,J.jsx)(`output`,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,J.jsx)(L,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:s.isPending||!a,onValueChange:e=>C({defaultModels:{[i.id]:e||null}},_.flash),className:`settings-select max-w-full bg-card`,options:[...u.map(e=>({value:e.id,label:e.label})),...l?[{value:F,label:l,disabled:!0}]:[]]})]},i.id)})})}),(0,J.jsxs)(W,{wide:!0,title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,J.jsx)(te,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:l,onChange:e=>d(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,J.jsx)(de,{length:f.length,overLimit:m})]}),(0,J.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,J.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,saved:v.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:s.isPending,onCheckedChange:e=>C({liveTitleUpdates:e},v.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,saved:y.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:s.isPending,onCheckedChange:e=>C({reviewGate:e},y.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,saved:b.saved,children:i.data?.info?(0,J.jsx)(L,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:s.isPending,onValueChange:e=>C({baseBranch:e||null},b.flash),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...i.data.branches.map(e=>({value:e,label:e}))]}):(0,J.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:i.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,J.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,J.jsx)(`summary`,{children:`Provider connections`}),(0,J.jsx)(ce,{})]})]})}function Q({defaultRunner:e,providerStatus:t,saving:n,saved:r,onSaved:a,onPick:o}){let s=_(),c=y(),d=w(),f=u(),p=i(),m=d.projectId??`default`,h=f.data?.info?.root,g=j(s.data,d.projectId,h),v=l().data,b=B(s.data?.profiles??[],v),x=R(b,v);return(0,J.jsxs)(W,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,saved:r,children:[(0,J.jsx)(V,{rows:b,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:p.isPending||c.data===void 0,onPick:(t,n,r)=>{t!==e&&o(t),r&&p.mutate({projectId:m,provider:t,profileId:n},{onSuccess:a,onError:e=>T(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&C(t.data,e)?.enabled===!1?(0,J.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,x?(0,J.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function $({title:e,hint:t,saved:n,children:r}){return(0,J.jsxs)(`section`,{className:`settings-option-row`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{children:e}),(0,J.jsxs)(`p`,{children:[t,` `,(0,J.jsx)(U,{saved:n})]})]}),r]})}function de({length:e,overLimit:t}){return(0,J.jsx)(J.Fragment,{children:t?(0,J.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Z.toLocaleString(),`.`]}):(0,J.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})})}export{le as AgentDefaultsSection};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{xt as t}from"./queries-CAsaqjt8.js";import{o as n}from"./dist-CCX8mhHc.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-BV_AiLj2.js";import{En as s,_t as c,rr as l}from"./index-C_yV_XCP.js";import{n as u}from"./save-cue-CpHgT93o.js";import{n as d}from"./settings-field-AyinSFR_.js";var f=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),p=e(),m=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:f},{value:`dark`,label:`Dark`,icon:a}],h=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],g=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Ultra-compact`}],_=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function v({slot:e,label:t,value:r,options:i,onChange:a}){return(0,p.jsx)(`div`,{role:`radiogroup`,"aria-label":t,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-lg border border-border bg-muted/60 p-1 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let t=e.value===r;return(0,p.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>a(e.value),className:n(`flex min-h-11 items-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-[13px] font-medium transition-colors`,t?`border border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,p.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function y(){let e=t(),{order:n,canReorder:r,reset:i}=s();return!((e.data?.projects.length??0)>1)||n.length===0?null:(0,p.jsx)(d,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,p.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function b(){let{theme:e,setTheme:t}=l(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=c(),f=u(),b=u(),x=u(),S=u(),C=e=>t=>{t&&e()};return(0,p.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,p.jsx)(d,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,saved:f.saved,children:(0,p.jsx)(v,{slot:`appearance-theme`,label:`Theme`,value:e,options:m,onChange:e=>{t(e)&&f.flash()}})}),h.length>1?(0,p.jsx)(d,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,saved:b.saved,children:(0,p.jsx)(v,{slot:`appearance-accent`,label:`Accent`,value:n,options:h,onChange:e=>void a(e).then(C(b.flash))})}):null,(0,p.jsx)(d,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,saved:x.saved,children:(0,p.jsx)(v,{slot:`appearance-density`,label:`Density`,value:r,options:g,onChange:e=>void o(e).then(C(x.flash))})}),(0,p.jsx)(d,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,saved:S.saved,children:(0,p.jsx)(v,{slot:`appearance-width`,label:`Reading width`,value:i,options:_,onChange:e=>void s(e).then(C(S.flash))})}),(0,p.jsx)(y,{}),(0,p.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,p.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,p.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,p.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-border bg-card px-4 py-3 text-xs text-foreground shadow-xs`,children:`Open task`})]}),(0,p.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{b as AppearanceSection};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{xt as t}from"./queries-CNjDebHy.js";import{o as n}from"./dist-CCX8mhHc.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-BV_AiLj2.js";import{En as s,_t as c,rr as l}from"./index-Cf0HK2YW.js";import{n as u}from"./save-cue-CpHgT93o.js";import{n as d}from"./settings-field-AyinSFR_.js";var f=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),p=e(),m=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:f},{value:`dark`,label:`Dark`,icon:a}],h=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],g=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Ultra-compact`}],_=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function v({slot:e,label:t,value:r,options:i,onChange:a}){return(0,p.jsx)(`div`,{role:`radiogroup`,"aria-label":t,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-lg border border-border bg-muted/60 p-1 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let t=e.value===r;return(0,p.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>a(e.value),className:n(`flex min-h-11 items-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-[13px] font-medium transition-colors`,t?`border border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,p.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function y(){let e=t(),{order:n,canReorder:r,reset:i}=s();return!((e.data?.projects.length??0)>1)||n.length===0?null:(0,p.jsx)(d,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,p.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function b(){let{theme:e,setTheme:t}=l(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=c(),f=u(),b=u(),x=u(),S=u(),C=e=>t=>{t&&e()};return(0,p.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,p.jsx)(d,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,saved:f.saved,children:(0,p.jsx)(v,{slot:`appearance-theme`,label:`Theme`,value:e,options:m,onChange:e=>{t(e)&&f.flash()}})}),h.length>1?(0,p.jsx)(d,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,saved:b.saved,children:(0,p.jsx)(v,{slot:`appearance-accent`,label:`Accent`,value:n,options:h,onChange:e=>void a(e).then(C(b.flash))})}):null,(0,p.jsx)(d,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,saved:x.saved,children:(0,p.jsx)(v,{slot:`appearance-density`,label:`Density`,value:r,options:g,onChange:e=>void o(e).then(C(x.flash))})}),(0,p.jsx)(d,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,saved:S.saved,children:(0,p.jsx)(v,{slot:`appearance-width`,label:`Reading width`,value:i,options:_,onChange:e=>void s(e).then(C(S.flash))})}),(0,p.jsx)(y,{}),(0,p.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,p.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,p.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,p.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-border bg-card px-4 py-3 text-xs text-foreground shadow-xs`,children:`Open task`})]}),(0,p.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{b as AppearanceSection};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{En as r,Ft as i,Ht as a,Vt as o,g as s}from"./queries-CAsaqjt8.js";import{I as c,Ji as l,un as u}from"./toaster-Dglox5F-.js";import{t as d}from"./option-select-7AnGvvB1.js";import{n as f,t as p}from"./save-cue-CpHgT93o.js";var m=e(t(),1),h=n();function g(){let e=s();return e.isPending?(0,h.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`project`})}function _(){let e=i();return e.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`global`})}function v({config:e,scope:t}){let n=(0,m.useId)(),i=l(),s=f(),g=r({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):u({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?i.setQueryData(n,e):(i.setQueryData(a.config,e),i.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==a.config})),s.flash()}});return(0,h.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`settings-field flex min-w-0 flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,h.jsxs)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:[`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived. `,(0,h.jsx)(p,{saved:s.saved})]})]}),(0,h.jsx)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`settings-select w-64 max-w-full bg-background`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:g.isPending,onValueChange:e=>g.mutate({archiveOnMerge:e===`inherit`?null:e===`enabled`,projectKey:o.config}),options:[{value:`inherit`,label:t===`project`?`Inherit global setting`:`Use default`},{value:`enabled`,label:`Enabled`},{value:`disabled`,label:`Disabled`}]}),(0,h.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,h.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),g.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,g.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,g.error.message]}):null]})}export{_ as n,g as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{En as r,Ft as i,an as a,g as o,in as s}from"./queries-CNjDebHy.js";import{I as c,Ji as l,un as u}from"./toaster-Dglox5F-.js";import{t as d}from"./option-select-BtavcdtM.js";import{n as f,t as p}from"./save-cue-CpHgT93o.js";var m=e(t(),1),h=n();function g(){let e=o();return e.isPending?(0,h.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`project`})}function _(){let e=i();return e.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`global`})}function v({config:e,scope:t}){let n=(0,m.useId)(),i=l(),o=f(),g=r({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):u({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?i.setQueryData(n,e):(i.setQueryData(a.config,e),i.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==a.config})),o.flash()}});return(0,h.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`settings-field flex min-w-0 flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,h.jsxs)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:[`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived. `,(0,h.jsx)(p,{saved:o.saved})]})]}),(0,h.jsx)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`settings-select w-64 max-w-full bg-background`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:g.isPending,onValueChange:e=>g.mutate({archiveOnMerge:e===`inherit`?null:e===`enabled`,projectKey:s.config}),options:[{value:`inherit`,label:t===`project`?`Inherit global setting`:`Use default`},{value:`enabled`,label:`Enabled`},{value:`disabled`,label:`Disabled`}]}),(0,h.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,h.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),g.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,g.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,g.error.message]}):null]})}export{_ as n,g as t};
@@ -1,7 +1,7 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{N as r,en as i,qt as a}from"./queries-CAsaqjt8.js";import{g as o}from"./host-context-iTMFRMT5.js";import{ni as s}from"./toaster-Dglox5F-.js";import{m as c,n as l,p as u}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as d}from"./dist-CCX8mhHc.js";import{J as f,Q as p,V as m,c as h,d as g,f as _,mt as v,pt as y,st as b,u as x,y as S}from"./design-icons-QbNMZniQ.js";import{t as C}from"./createLucideIcon-BHp8sXmF.js";import{t as w}from"./check-OP-CVgZG.js";import{t as T}from"./chevron-right-BENZ-1ZN.js";import{n as ee}from"./smartphone-Lr8Ug2z_.js";import{t as E}from"./loader-circle-CPBhhDbB.js";import{t as te}from"./message-square-B-MD-8rD.js";import{n as D,t as ne}from"./tool-display-CTbToGmi.js";import{t as O}from"./square-terminal-B6RYYieR.js";import{t as k}from"./button-BV_AiLj2.js";import{n as A,r as j,t as M}from"./collapsible-D5i3hm2L.js";import{t as N}from"./project-router-CPgPVoBJ.js";import{a as re,c as ie,i as ae,l as oe,o as se,s as ce,t as le}from"./report-selection-CJ-q2Dc5.js";import{r as ue}from"./html-report-BX3msvci.js";import{S as de,pr as fe,un as pe,vr as P,wn as me,wr as he,x as ge}from"./index-C_yV_XCP.js";import{t as _e}from"./zoomable-image-DJ1lJEMc.js";import{t as F}from"./textarea-BGp28xFr.js";import{t as I}from"./markdown-WuLAJnyd.js";import{t as ve}from"./task-file-scope-jCHWm0DC.js";import{t as ye}from"./report-title-D4Mbu2Er.js";var be=C(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),xe=C(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Se=C(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ce=C(`locate-fixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),L=C(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),we=C(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),R=e(t(),1),z=n();function Te(e,t){if(e.length===1)return[t.replace(RegExp(`^${Ee(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function De(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var Oe=`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Gt as r,N as i,Qt as a}from"./queries-CNjDebHy.js";import{g as o}from"./host-context-iTMFRMT5.js";import{ni as s}from"./toaster-Dglox5F-.js";import{m as c,n as l,p as u}from"./chunk-KS7C4IRE-BdLLx37K.js";import{o as d}from"./dist-CCX8mhHc.js";import{J as f,Q as p,V as m,c as h,d as g,f as _,mt as v,pt as y,st as b,u as x,y as S}from"./design-icons-QbNMZniQ.js";import{t as C}from"./createLucideIcon-BHp8sXmF.js";import{t as w}from"./check-OP-CVgZG.js";import{t as T}from"./chevron-right-BENZ-1ZN.js";import{n as ee}from"./smartphone-Lr8Ug2z_.js";import{t as E}from"./loader-circle-CPBhhDbB.js";import{t as te}from"./message-square-B-MD-8rD.js";import{n as D,t as ne}from"./tool-display-CTbToGmi.js";import{t as O}from"./square-terminal-B6RYYieR.js";import{t as k}from"./button-BV_AiLj2.js";import{n as A,r as j,t as M}from"./collapsible-D5i3hm2L.js";import{t as N}from"./project-router-CPgPVoBJ.js";import{a as re,c as ie,i as ae,l as oe,o as se,s as ce,t as le}from"./report-selection-D-asrNb1.js";import{r as ue}from"./html-report-BX3msvci.js";import{S as de,pr as fe,un as pe,vr as P,wn as me,wr as he,x as ge}from"./index-Cf0HK2YW.js";import{t as _e}from"./zoomable-image-DJ1lJEMc.js";import{t as F}from"./textarea-BGp28xFr.js";import{t as I}from"./markdown-_RWbSoHA.js";import{t as ve}from"./task-file-scope-CcmDJfUC.js";import{t as ye}from"./report-title-D4Mbu2Er.js";var be=C(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),xe=C(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Se=C(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ce=C(`locate-fixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),L=C(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),we=C(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),R=e(t(),1),z=n();function Te(e,t){if(e.length===1)return[t.replace(RegExp(`^${Ee(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function De(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var Oe=`
2
2
 
3
3
  Additional comments:
4
- `;function ke(e){let t=e.indexOf(Oe);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function Ae({ask:e}){let t=e.answer===void 0?void 0:ke(e.answer),n=t===void 0?void 0:Te(e.questions,t.body);return(0,z.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=De(t,i),o=i!==void 0&&a.length===0;return(0,z.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,z.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,z.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,z.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,z.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,z.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,z.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,z.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,z.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,z.jsx)(B,{text:i}):null]})]}):i===void 0?null:(0,z.jsx)(B,{text:i})]},t.id??r)}),n&&t?.comment?(0,z.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,z.jsx)(B,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,z.jsx)(B,{text:e.answer}):null]})}function B({text:e}){return(0,z.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function V(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function je(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function Me({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:i,hasSheetContext:a,showContextButtonRef:o,onOpenContext:s,onShowOrigin:c,onFold:l}){let u=l!==void 0,f=a?(0,z.jsxs)(k,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,"aria-label":u?`Show context`:void 0,className:d(`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,u&&`ms-auto`),onClick:s,children:[(0,z.jsx)(P,{"aria-hidden":`true`,className:`size-3.5`}),u?`Context`:`Show context`]}):c&&u?(0,z.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`ask-show-origin`,"aria-label":`Show where it was asked`,title:`Show where it was asked`,className:`ms-auto shrink-0 text-link-foreground`,onClick:c,children:(0,z.jsx)(Ce,{"aria-hidden":`true`,className:`size-4`})}):c?(0,z.jsx)(Ve,{onShowOrigin:c}):null,p=r?(0,z.jsx)(Ne,{mode:t,onModeChange:n}):null;return u?(0,z.jsxs)(`div`,{"data-slot":`ask-header`,"data-compact":`true`,className:`flex shrink-0 items-center gap-1.5 border-b border-border/70 py-1 ps-1.5 pe-1`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:`Needs your answer`}),e&&t===`options`?(0,z.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`sr-only`,children:i}):null,p,f,(0,z.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`ask-fold`,"aria-label":`Fold the question`,"aria-expanded":`true`,className:d(`shrink-0 text-muted-foreground`,!f&&`ms-auto`),onClick:l,children:(0,z.jsx)(x,{"aria-hidden":`true`,className:`size-4`})})]}):(0,z.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,z.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:i}):null,(0,z.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[f,p]})]})}function Ne({mode:e,onModeChange:t}){return(0,z.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex shrink-0 items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,z.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":e===`options`,onClick:()=>t(`options`),className:d(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,e===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,z.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":e===`reply`,onClick:()=>t(`reply`),className:d(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,e===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]})}function Pe({tag:e,text:t,position:n,onOpen:r}){return(0,z.jsxs)(`button`,{type:`button`,"data-slot":`ask-folded-row`,"aria-expanded":`false`,onClick:r,className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl px-2.5 py-1.5 text-start focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,z.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:t}),n===void 0?null:(0,z.jsx)(`span`,{"data-slot":`ask-folded-position`,className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:n}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Open the question`}),(0,z.jsx)(_,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]})}function Fe({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:i,onSelectStep:a}){let o=e.length;return(0,z.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,i)=>{let o=t===i,s=V(i,n,r);return(0,z.jsxs)(`button`,{type:`button`,"aria-current":o?`step`:void 0,onClick:()=>a(i),className:d(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,o?`border-accent-strong bg-accent-strong/15 text-foreground`:s?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,z.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:s?(0,z.jsx)(w,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${i+1}.`}),(0,z.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??i)}),(0,z.jsxs)(`button`,{type:`button`,"aria-current":t===o?`step`:void 0,onClick:()=>a(o),className:d(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===o?`border-accent-strong bg-accent-strong/15 text-foreground`:i?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,z.jsx)(L,{"aria-hidden":`true`,className:`size-3`}),(0,z.jsx)(`span`,{children:`Comment`})]})]})}function Ie({questions:e,selections:t,otherAnswers:n,comment:r,disabled:i,onCommentChange:a,onJumpToQuestion:o}){let s=(0,R.useId)();return(0,z.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,z.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,z.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let i=V(r,t,n);return(0,z.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>o(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,z.jsx)(`span`,{className:d(`min-w-0 truncate text-end`,i?`text-foreground`:`text-semantic-red`),children:je(r,t,n)})]},e.id??r)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{htmlFor:s,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,z.jsx)(F,{id:s,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:i,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>a(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function Le({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,R.useId)();return r?(0,z.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,z.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,z.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,z.jsx)(F,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function Re({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:i,resuming:a,disabled:o,onBack:s,onNext:c,onOpenComment:l,onSend:u,questions:f,selections:p,otherAnswers:m,stopControl:h,compact:g=!1}){let _=e===t-1,v=e===t,y=a?`Send answer & reopen`:`Send answer`,b=a?(0,z.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,x=!_&&!v?(0,z.jsxs)(k,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:c,children:[`Next`,(0,z.jsx)(T,{"aria-hidden":`true`,className:`size-4`})]}):null,S=_?(0,z.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:l,children:i?`Edit comment`:`+ Comment`}):null,C=_||v||r?(0,z.jsx)(k,{type:`button`,size:`sm`,className:`px-3.5`,disabled:o||!r,onClick:u,children:y}):null;return(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,z.jsxs)(k,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:s,children:[(0,z.jsx)(he,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,z.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,i=V(n,p,m);return(0,z.jsx)(`span`,{className:d(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:i?`bg-success`:`bg-border`)},t.id??n)}),(0,z.jsx)(`span`,{className:d(`size-2 rounded-full motion-safe:transition-colors`,v?`bg-accent-strong`:i?`bg-success`:`bg-border/60`)})]}),(0,z.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),g?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{"data-slot":`ask-step-actions`,className:`ms-auto flex items-center gap-2`,children:[x,C]}),S||h?(0,z.jsxs)(`div`,{"data-slot":`ask-secondary-actions`,className:`ms-auto flex items-center gap-2`,children:[S,h]}):null,b]}):(0,z.jsxs)(z.Fragment,{children:[b,(0,z.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,x,S,C]})]})]})}function ze({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l,compact:u=!1}){return(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,z.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-add-comment`,className:`px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:s,children:[(0,z.jsx)(L,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,u&&!a?null:(0,z.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,z.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,z.jsx)(k,{type:`button`,size:`sm`,className:`px-3.5`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function Be({blockedBy:e,reason:t,error:n}){return(0,z.jsxs)(z.Fragment,{children:[t?(0,z.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,z.jsx)(N,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function Ve({onShowOrigin:e,className:t}){return(0,z.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:d(`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,t),children:`Show where it was asked`})}function He({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,R.useRef)(!1);return(0,z.jsx)(ae,{open:e,onOpenChange:t,children:(0,z.jsxs)(se,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,z.jsxs)(ie,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,z.jsx)(oe,{children:`Question context`}),(0,z.jsx)(ce,{children:`Your selections and drafts stay intact while you read.`}),(0,z.jsx)(re,{asChild:!0,children:(0,z.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2`,children:(0,z.jsx)(v,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,z.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,z.jsx)(ve,{runId:n,children:(0,z.jsx)(I,{breaks:!0,children:r})})}),i?(0,z.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,z.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function Ue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var We=/^[A-Za-z0-9_./:=+,@%-]+$/;function Ge(e){return e.replaceAll(`'`,`'\\''`)}function Ke(e){return e===``?`''`:We.test(e)?e:`\u0027${Ge(e)}\u0027`}function qe(e){if(!Ue(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(Ke).join(` `)}}function Je(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Ye(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Xe(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function H(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Ze(e){let t=Je(Ye(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))H(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){H(e[2])&&i.push({label:Xe(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:Xe(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&H(t)&&i.push({label:t,href:t})}return i}var Qe=(0,R.createContext)(void 0),U=(0,R.createContext)(void 0);function $e(e,t){let n=new Map;for(let r of Ze(e)){let e=de(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function W(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function et({text:e,messageKey:t}){let n=(0,R.useContext)(ge),r=(0,R.useContext)(U),i=t??r;if(!n||i===void 0)return null;let a=$e(e,n);return a.length===0?null:(0,z.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,z.jsx)(tt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function tt({reference:e,messageKey:t}){let{artifactId:n,runId:i,label:a,href:o}=e,s=(0,R.useContext)(Qe),d=(0,R.useContext)(le);(0,R.useLayoutEffect)(()=>d?.register(n,i),[d,n,i]);let f=r(i,n),p=u(),m=c();if(f.isError)return(0,z.jsx)(l,{id:W(t,n),"data-slot":`report-card-fallback`,to:o,state:{readerFrom:p.pathname+p.search},children:a});let h=f.data?.artifact;if(h&&!ue(h.name))return null;let g=new URLSearchParams(p.search);g.set(`report`,n),g.set(`card`,t);let _=new URLSearchParams(p.search).has(`report`)?p.state:null,v=new URLSearchParams(p.search);v.delete(`report`),v.delete(`card`);let y=`${p.pathname}${v.size?`?${v}`:``}`,b=window.navigation,x={reportCardEntry:!0,reportReturnTo:_?.reportReturnTo??y,reportReturnKey:_?.reportReturnKey??b?.currentEntry?.key,reportScrollTop:_?.reportScrollTop},S={pathname:p.pathname,search:`?${g}`,hash:new URL(o,`https://cockpit.invalid`).hash};return(0,z.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":i,"aria-busy":f.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,z.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:h?ye(h):a}),(0,z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,z.jsx)(l,{id:W(t,n),to:S,state:x,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),s?.(t);let n=x.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;m(S,{state:{...x,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${f.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var nt={message:!0,reasoning:!0,tool:!0,hook:!0};function rt(e){return Object.hasOwn(nt,e)&&nt[e]}var G=e=>e.kind===`tool`,it=e=>e.kind===`conversation`,at=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,ot=(e,t,n)=>`${e} ${e===1?t:n}`;function st(e,t){let n=[];return e>0&&n.push(ot(e,`file`,`files`)),t>0&&n.push(ot(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ct(e){return`${e} earlier tool call${e===1?``:`s`}`}var lt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function ut(e){for(let t of lt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var dt=new WeakMap;function ft(e){let t=dt.get(e);if(t)return t;let n=pt(e);return dt.set(e,n),n}function pt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(G).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=rt(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:st(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of mt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(it(e)){s(),c.push(e);continue}l(),G(e)&&at(e)&&!r.has(e.id)?o.push(e):(s(),G(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function mt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var K=new Map,ht=(0,R.createContext)(null);function q(){return(0,R.useContext)(ht)}function gt({runId:e,children:t}){let n=(0,R.useMemo)(()=>({get:t=>K.get(e)?.get(t),set:(t,n)=>{let r=K.get(e)??new Map;r.set(t,n),K.set(e,r)}}),[e]);return(0,z.jsx)(ht.Provider,{value:n,children:t})}function _t(e){return e.scrollTop<Math.max(600,e.clientHeight)}function vt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function yt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function bt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function xt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var St=new Map;function Ct(e,t){St.set(e,t)}function wt(e){return St.get(e)}var J=new Map;function Tt(e,t){J.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function Et(e){return J.get(e)}function Dt(e,t,n){let r=J.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var Ot=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),kt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),At=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),jt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Mt=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function X(e){let t=Y(e);return t===void 0?void 0:Ot.format(t)}function Nt(e){let t=Y(e);return t===void 0?void 0:kt.format(t)}var Z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Pt(e){let t=Y(e);return t===void 0?void 0:Z(t)}function Ft(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Z(n);return r===Z(t)?`Today`:r===Z(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?At:jt).format(n)}function It(e,t){let n=Y(e),r=Y(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Lt({ts:e}){let t=X(e);return t===void 0?null:(0,z.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Nt(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function Rt({startedAt:e,completedAt:t}){let n=X(t);if(n===void 0)return null;let r=It(e,t);return(0,z.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,z.jsx)(`time`,{dateTime:t,title:Nt(t),children:n}),r===void 0?null:(0,z.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function zt({ts:e}){let t=Ft(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=Mt.format(n);return(0,z.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,z.jsx)(`time`,{dateTime:Pt(e),title:r,children:t}),(0,z.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Bt={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function Vt({note:e}){return e.icon===`handoff`?(0,z.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,z.jsx)(fe,{className:`size-3`})}),(0,z.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,z.jsxs)(M,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,z.jsxs)(`div`,{className:d(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,z.jsxs)(j,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,z.jsx)(g,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,z.jsx)(A,{children:(0,z.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,z.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,z.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[Bt[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,z.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:d(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var Ht={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Q({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let o=Ht[e],s=r===void 0?void 0:X(r);return(0,z.jsxs)(`article`,{...a,"data-role":e,"aria-label":o.speaker,className:d(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,o.classes,n),children:[(0,z.jsxs)(`p`,{className:d(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,o.accent),children:[(0,z.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,z.jsx)(te,{"aria-hidden":`true`,className:`size-4 shrink-0`}),o.label]}),i]}),s===void 0?null:(0,z.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,z.jsx)(Lt,{ts:r})})]}),(0,z.jsx)(`div`,{className:d(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,o.body,`leading-[1.6]`),children:t})]})}var Ut=[],Wt=(0,R.memo)(function({text:e,imageCount:t=0,images:n=Ut,ts:r,onEdit:i,onRemove:a,editLabel:c=`Edit message`,removeLabel:l=`Remove message`,children:u}){let d=t-n.length,[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(e),[_,v]=(0,R.useState)(!1),[y,x]=(0,R.useState)(),S=()=>{g(e),x(void 0),m(!0)},C=async()=>{let t=h.trim();if(!t||t===e){m(!1);return}v(!0),x(void 0);try{await i?.(t),m(!1)}catch(e){x(e instanceof Error?e.message:`Could not save the message`)}finally{v(!1)}},w=async()=>{v(!0),x(void 0);try{await a?.()}catch(e){x(e instanceof Error?e.message:`Could not remove the message`)}finally{v(!1)}};return p?(0,z.jsxs)(Q,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,z.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),m(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,z.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>m(!1),disabled:_,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:_,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:_?(0,z.jsx)(E,{className:`size-3.5 animate-spin`}):`Save`})]}),y?(0,z.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:y}):null]}):(0,z.jsxs)(Q,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[i||a?(0,z.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,z.jsx)(`button`,{type:`button`,"aria-label":c,onClick:S,disabled:_,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,z.jsx)(we,{className:`size-3.5`})}):null,a?(0,z.jsx)(`button`,{type:`button`,"aria-label":l,onClick:()=>void w(),disabled:_,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,z.jsx)(b,{className:`size-3.5`})}):null]}):null,y?(0,z.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:y}):null,u??(0,z.jsx)(I,{breaks:!0,children:e}),n.length>0?(0,z.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>s(e.split(`/`).pop()??``)?(0,z.jsx)(_e,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,z.jsxs)(`a`,{href:o(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,z.jsx)(f,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,d>0?(0,z.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[d,` image`,d>1?`s`:``,` attached`]}):null]})}),Gt=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Kt=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function qt(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Kt).forEach(e=>e.remove());let r=Ze(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!H(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Jt(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=qt(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var Yt=(0,R.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,R.useRef)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(null),c=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Jt(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,z.jsxs)(Q,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,z.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,z.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Gt,children:[(0,z.jsx)(S,{className:`size-3.5`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,z.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Gt,children:[(0,z.jsx)(P,{className:`size-3.5`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,z.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,z.jsx)(`div`,{ref:r,children:(0,z.jsx)(I,{breaks:!0,children:e})}),(0,z.jsx)(et,{text:e,messageKey:n})]})});function Xt({incident:e}){let t=i().data;if(!t)return null;let n=a(t,e.provider);return(0,z.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,z.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,z.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,z.jsx)(N,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var Zt=(0,R.memo)(function({text:e}){let t=(0,R.useId)();if(e.trim()===``)return null;let n=e.split(`
4
+ `;function ke(e){let t=e.indexOf(Oe);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function Ae({ask:e}){let t=e.answer===void 0?void 0:ke(e.answer),n=t===void 0?void 0:Te(e.questions,t.body);return(0,z.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=De(t,i),o=i!==void 0&&a.length===0;return(0,z.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,z.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,z.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,z.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,z.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,z.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,z.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,z.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,z.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,z.jsx)(B,{text:i}):null]})]}):i===void 0?null:(0,z.jsx)(B,{text:i})]},t.id??r)}),n&&t?.comment?(0,z.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,z.jsx)(B,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,z.jsx)(B,{text:e.answer}):null]})}function B({text:e}){return(0,z.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function V(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function je(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function Me({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:i,hasSheetContext:a,showContextButtonRef:o,onOpenContext:s,onShowOrigin:c,onFold:l}){let u=l!==void 0,f=a?(0,z.jsxs)(k,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,"aria-label":u?`Show context`:void 0,className:d(`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,u&&`ms-auto`),onClick:s,children:[(0,z.jsx)(P,{"aria-hidden":`true`,className:`size-3.5`}),u?`Context`:`Show context`]}):c&&u?(0,z.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`ask-show-origin`,"aria-label":`Show where it was asked`,title:`Show where it was asked`,className:`ms-auto shrink-0 text-link-foreground`,onClick:c,children:(0,z.jsx)(Ce,{"aria-hidden":`true`,className:`size-4`})}):c?(0,z.jsx)(Ve,{onShowOrigin:c}):null,p=r?(0,z.jsx)(Ne,{mode:t,onModeChange:n}):null;return u?(0,z.jsxs)(`div`,{"data-slot":`ask-header`,"data-compact":`true`,className:`flex shrink-0 items-center gap-1.5 border-b border-border/70 py-1 ps-1.5 pe-1`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:`Needs your answer`}),e&&t===`options`?(0,z.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`sr-only`,children:i}):null,p,f,(0,z.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`ask-fold`,"aria-label":`Fold the question`,"aria-expanded":`true`,className:d(`shrink-0 text-muted-foreground`,!f&&`ms-auto`),onClick:l,children:(0,z.jsx)(x,{"aria-hidden":`true`,className:`size-4`})})]}):(0,z.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,z.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:i}):null,(0,z.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[f,p]})]})}function Ne({mode:e,onModeChange:t}){return(0,z.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex shrink-0 items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,z.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":e===`options`,onClick:()=>t(`options`),className:d(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,e===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,z.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":e===`reply`,onClick:()=>t(`reply`),className:d(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,e===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]})}function Pe({tag:e,text:t,position:n,onOpen:r}){return(0,z.jsxs)(`button`,{type:`button`,"data-slot":`ask-folded-row`,"aria-expanded":`false`,onClick:r,className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl px-2.5 py-1.5 text-start focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,z.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:t}),n===void 0?null:(0,z.jsx)(`span`,{"data-slot":`ask-folded-position`,className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:n}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Open the question`}),(0,z.jsx)(_,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]})}function Fe({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:i,onSelectStep:a}){let o=e.length;return(0,z.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,i)=>{let o=t===i,s=V(i,n,r);return(0,z.jsxs)(`button`,{type:`button`,"aria-current":o?`step`:void 0,onClick:()=>a(i),className:d(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,o?`border-accent-strong bg-accent-strong/15 text-foreground`:s?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,z.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:s?(0,z.jsx)(w,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${i+1}.`}),(0,z.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??i)}),(0,z.jsxs)(`button`,{type:`button`,"aria-current":t===o?`step`:void 0,onClick:()=>a(o),className:d(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===o?`border-accent-strong bg-accent-strong/15 text-foreground`:i?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,z.jsx)(L,{"aria-hidden":`true`,className:`size-3`}),(0,z.jsx)(`span`,{children:`Comment`})]})]})}function Ie({questions:e,selections:t,otherAnswers:n,comment:r,disabled:i,onCommentChange:a,onJumpToQuestion:o}){let s=(0,R.useId)();return(0,z.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,z.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,z.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let i=V(r,t,n);return(0,z.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>o(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,z.jsx)(`span`,{className:d(`min-w-0 truncate text-end`,i?`text-foreground`:`text-semantic-red`),children:je(r,t,n)})]},e.id??r)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`label`,{htmlFor:s,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,z.jsx)(F,{id:s,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:i,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>a(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function Le({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,R.useId)();return r?(0,z.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,z.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,z.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,z.jsx)(F,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function Re({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:i,resuming:a,disabled:o,onBack:s,onNext:c,onOpenComment:l,onSend:u,questions:f,selections:p,otherAnswers:m,stopControl:h,compact:g=!1}){let _=e===t-1,v=e===t,y=a?`Send answer & reopen`:`Send answer`,b=a?(0,z.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,x=!_&&!v?(0,z.jsxs)(k,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:c,children:[`Next`,(0,z.jsx)(T,{"aria-hidden":`true`,className:`size-4`})]}):null,S=_?(0,z.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:l,children:i?`Edit comment`:`+ Comment`}):null,C=_||v||r?(0,z.jsx)(k,{type:`button`,size:`sm`,className:`px-3.5`,disabled:o||!r,onClick:u,children:y}):null;return(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,z.jsxs)(k,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:s,children:[(0,z.jsx)(he,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,z.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,i=V(n,p,m);return(0,z.jsx)(`span`,{className:d(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:i?`bg-success`:`bg-border`)},t.id??n)}),(0,z.jsx)(`span`,{className:d(`size-2 rounded-full motion-safe:transition-colors`,v?`bg-accent-strong`:i?`bg-success`:`bg-border/60`)})]}),(0,z.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),g?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{"data-slot":`ask-step-actions`,className:`ms-auto flex items-center gap-2`,children:[x,C]}),S||h?(0,z.jsxs)(`div`,{"data-slot":`ask-secondary-actions`,className:`ms-auto flex items-center gap-2`,children:[S,h]}):null,b]}):(0,z.jsxs)(z.Fragment,{children:[b,(0,z.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,x,S,C]})]})]})}function ze({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l,compact:u=!1}){return(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,z.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-add-comment`,className:`px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:s,children:[(0,z.jsx)(L,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,u&&!a?null:(0,z.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,z.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,z.jsx)(k,{type:`button`,size:`sm`,className:`px-3.5`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function Be({blockedBy:e,reason:t,error:n}){return(0,z.jsxs)(z.Fragment,{children:[t?(0,z.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,z.jsx)(N,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function Ve({onShowOrigin:e,className:t}){return(0,z.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:d(`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,t),children:`Show where it was asked`})}function He({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,R.useRef)(!1);return(0,z.jsx)(ae,{open:e,onOpenChange:t,children:(0,z.jsxs)(se,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,z.jsxs)(ie,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,z.jsx)(oe,{children:`Question context`}),(0,z.jsx)(ce,{children:`Your selections and drafts stay intact while you read.`}),(0,z.jsx)(re,{asChild:!0,children:(0,z.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2`,children:(0,z.jsx)(v,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,z.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,z.jsx)(ve,{runId:n,children:(0,z.jsx)(I,{breaks:!0,children:r})})}),i?(0,z.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,z.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function Ue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var We=/^[A-Za-z0-9_./:=+,@%-]+$/;function Ge(e){return e.replaceAll(`'`,`'\\''`)}function Ke(e){return e===``?`''`:We.test(e)?e:`\u0027${Ge(e)}\u0027`}function qe(e){if(!Ue(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(Ke).join(` `)}}function Je(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Ye(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Xe(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function H(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Ze(e){let t=Je(Ye(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))H(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){H(e[2])&&i.push({label:Xe(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:Xe(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&H(t)&&i.push({label:t,href:t})}return i}var Qe=(0,R.createContext)(void 0),U=(0,R.createContext)(void 0);function $e(e,t){let n=new Map;for(let r of Ze(e)){let e=de(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function W(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function et({text:e,messageKey:t}){let n=(0,R.useContext)(ge),r=(0,R.useContext)(U),i=t??r;if(!n||i===void 0)return null;let a=$e(e,n);return a.length===0?null:(0,z.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,z.jsx)(tt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function tt({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:a,href:o}=e,s=(0,R.useContext)(Qe),d=(0,R.useContext)(le);(0,R.useLayoutEffect)(()=>d?.register(n,r),[d,n,r]);let f=i(r,n),p=u(),m=c();if(f.isError)return(0,z.jsx)(l,{id:W(t,n),"data-slot":`report-card-fallback`,to:o,state:{readerFrom:p.pathname+p.search},children:a});let h=f.data?.artifact;if(h&&!ue(h.name))return null;let g=new URLSearchParams(p.search);g.set(`report`,n),g.set(`card`,t);let _=new URLSearchParams(p.search).has(`report`)?p.state:null,v=new URLSearchParams(p.search);v.delete(`report`),v.delete(`card`);let y=`${p.pathname}${v.size?`?${v}`:``}`,b=window.navigation,x={reportCardEntry:!0,reportReturnTo:_?.reportReturnTo??y,reportReturnKey:_?.reportReturnKey??b?.currentEntry?.key,reportScrollTop:_?.reportScrollTop},S={pathname:p.pathname,search:`?${g}`,hash:new URL(o,`https://cockpit.invalid`).hash};return(0,z.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":f.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,z.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:h?ye(h):a}),(0,z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,z.jsx)(l,{id:W(t,n),to:S,state:x,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),s?.(t);let n=x.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;m(S,{state:{...x,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${f.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var nt={message:!0,reasoning:!0,tool:!0,hook:!0};function rt(e){return Object.hasOwn(nt,e)&&nt[e]}var G=e=>e.kind===`tool`,it=e=>e.kind===`conversation`,at=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,ot=(e,t,n)=>`${e} ${e===1?t:n}`;function st(e,t){let n=[];return e>0&&n.push(ot(e,`file`,`files`)),t>0&&n.push(ot(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ct(e){return`${e} earlier tool call${e===1?``:`s`}`}var lt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function ut(e){for(let t of lt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var dt=new WeakMap;function ft(e){let t=dt.get(e);if(t)return t;let n=pt(e);return dt.set(e,n),n}function pt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(G).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=rt(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:st(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of mt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(it(e)){s(),c.push(e);continue}l(),G(e)&&at(e)&&!r.has(e.id)?o.push(e):(s(),G(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function mt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var K=new Map,ht=(0,R.createContext)(null);function q(){return(0,R.useContext)(ht)}function gt({runId:e,children:t}){let n=(0,R.useMemo)(()=>({get:t=>K.get(e)?.get(t),set:(t,n)=>{let r=K.get(e)??new Map;r.set(t,n),K.set(e,r)}}),[e]);return(0,z.jsx)(ht.Provider,{value:n,children:t})}function _t(e){return e.scrollTop<Math.max(600,e.clientHeight)}function vt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function yt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function bt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function xt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var St=new Map;function Ct(e,t){St.set(e,t)}function wt(e){return St.get(e)}var J=new Map;function Tt(e,t){J.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function Et(e){return J.get(e)}function Dt(e,t,n){let r=J.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var Ot=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),kt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),At=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),jt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Mt=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function X(e){let t=Y(e);return t===void 0?void 0:Ot.format(t)}function Nt(e){let t=Y(e);return t===void 0?void 0:kt.format(t)}var Z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Pt(e){let t=Y(e);return t===void 0?void 0:Z(t)}function Ft(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Z(n);return r===Z(t)?`Today`:r===Z(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?At:jt).format(n)}function It(e,t){let n=Y(e),r=Y(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Lt({ts:e}){let t=X(e);return t===void 0?null:(0,z.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Nt(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function Rt({startedAt:e,completedAt:t}){let n=X(t);if(n===void 0)return null;let r=It(e,t);return(0,z.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,z.jsx)(`time`,{dateTime:t,title:Nt(t),children:n}),r===void 0?null:(0,z.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function zt({ts:e}){let t=Ft(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=Mt.format(n);return(0,z.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,z.jsx)(`time`,{dateTime:Pt(e),title:r,children:t}),(0,z.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Bt={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function Vt({note:e}){return e.icon===`handoff`?(0,z.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,z.jsx)(fe,{className:`size-3`})}),(0,z.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,z.jsxs)(M,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,z.jsxs)(`div`,{className:d(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,z.jsxs)(j,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,z.jsx)(g,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,z.jsx)(A,{children:(0,z.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,z.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,z.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[Bt[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,z.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:d(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var Ht={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Q({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let o=Ht[e],s=r===void 0?void 0:X(r);return(0,z.jsxs)(`article`,{...a,"data-role":e,"aria-label":o.speaker,className:d(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,o.classes,n),children:[(0,z.jsxs)(`p`,{className:d(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,o.accent),children:[(0,z.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,z.jsx)(te,{"aria-hidden":`true`,className:`size-4 shrink-0`}),o.label]}),i]}),s===void 0?null:(0,z.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,z.jsx)(Lt,{ts:r})})]}),(0,z.jsx)(`div`,{className:d(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,o.body,`leading-[1.6]`),children:t})]})}var Ut=[],Wt=(0,R.memo)(function({text:e,imageCount:t=0,images:n=Ut,ts:r,onEdit:i,onRemove:a,editLabel:c=`Edit message`,removeLabel:l=`Remove message`,children:u}){let d=t-n.length,[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(e),[_,v]=(0,R.useState)(!1),[y,x]=(0,R.useState)(),S=()=>{g(e),x(void 0),m(!0)},C=async()=>{let t=h.trim();if(!t||t===e){m(!1);return}v(!0),x(void 0);try{await i?.(t),m(!1)}catch(e){x(e instanceof Error?e.message:`Could not save the message`)}finally{v(!1)}},w=async()=>{v(!0),x(void 0);try{await a?.()}catch(e){x(e instanceof Error?e.message:`Could not remove the message`)}finally{v(!1)}};return p?(0,z.jsxs)(Q,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,z.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),m(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,z.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>m(!1),disabled:_,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:_,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:_?(0,z.jsx)(E,{className:`size-3.5 animate-spin`}):`Save`})]}),y?(0,z.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:y}):null]}):(0,z.jsxs)(Q,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[i||a?(0,z.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,z.jsx)(`button`,{type:`button`,"aria-label":c,onClick:S,disabled:_,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,z.jsx)(we,{className:`size-3.5`})}):null,a?(0,z.jsx)(`button`,{type:`button`,"aria-label":l,onClick:()=>void w(),disabled:_,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,z.jsx)(b,{className:`size-3.5`})}):null]}):null,y?(0,z.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:y}):null,u??(0,z.jsx)(I,{breaks:!0,children:e}),n.length>0?(0,z.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>s(e.split(`/`).pop()??``)?(0,z.jsx)(_e,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,z.jsxs)(`a`,{href:o(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,z.jsx)(f,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,d>0?(0,z.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[d,` image`,d>1?`s`:``,` attached`]}):null]})}),Gt=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Kt=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function qt(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Kt).forEach(e=>e.remove());let r=Ze(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!H(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Jt(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=qt(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var Yt=(0,R.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,R.useRef)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(null),c=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Jt(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,z.jsxs)(Q,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,z.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,z.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Gt,children:[(0,z.jsx)(S,{className:`size-3.5`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,z.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Gt,children:[(0,z.jsx)(P,{className:`size-3.5`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,z.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,z.jsx)(`div`,{ref:r,children:(0,z.jsx)(I,{breaks:!0,children:e})}),(0,z.jsx)(et,{text:e,messageKey:n})]})});function Xt({incident:e}){let t=a().data;if(!t)return null;let n=r(t,e.provider);return(0,z.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,z.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,z.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,z.jsx)(N,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var Zt=(0,R.memo)(function({text:e}){let t=(0,R.useId)();if(e.trim()===``)return null;let n=e.split(`
5
5
  `,1)[0]??``,r=n.length<e.length;return(0,z.jsxs)(M,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,z.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,z.jsx)(g,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,z.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,z.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground max-md:[&_*]:inline max-md:[&_*]:whitespace-nowrap`,children:(0,z.jsx)(I,{inline:!0,children:n})}),r?(0,z.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,z.jsx)(j,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,z.jsx)(A,{children:(0,z.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,z.jsx)(I,{children:e})})})]})});function Qt(){return(0,z.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,z.jsx)(E,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,z.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var $t={read:P,edit:we,delete:b,move:Se,search:p,execute:O,think:xe,fetch:ee,task:h,plan:m,other:y},en=e=>e.split(`
6
6
  `).length;function tn({text:e,streaming:t}){let[n,r]=(0,R.useState)(!1),i=(0,R.useRef)(null),a=(0,R.useRef)(!0);(0,R.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=en(e),s=!t&&!n&&o>12;return(0,z.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=bt(e.currentTarget)}:void 0,className:d(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,z.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,z.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,z.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function nn({diffs:e}){return(0,z.jsx)(z.Fragment,{children:e.map((e,t)=>(0,z.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,z.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-xs wrap-anywhere text-muted-foreground`,children:e.path}),(0,z.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...rn(e.oldText).map((e,t)=>(0,z.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...rn(e.newText).map((e,t)=>(0,z.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
7
7
  `).map((e,t)=>(0,z.jsx)(an,{text:e},t))})]},`${e.path}:${t}`))})}function rn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`