@snagset/server 0.1.16 → 0.1.19

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 (201) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +9 -10
  3. package/dist/app.js +51 -47
  4. package/dist/app.js.map +1 -1
  5. package/dist/bin.js +31 -32
  6. package/dist/bin.js.map +1 -1
  7. package/dist/boot.js +21 -21
  8. package/dist/boot.js.map +1 -1
  9. package/dist/config.generated.js +5 -8
  10. package/dist/config.generated.js.map +1 -1
  11. package/dist/config.js +14 -14
  12. package/dist/config.js.map +1 -1
  13. package/dist/crypto.js +1 -1
  14. package/dist/crypto.js.map +1 -1
  15. package/dist/db/connect.js +1 -1
  16. package/dist/db/migrate.js +11 -11
  17. package/dist/db/migrations/0010_round_archive.sql +23 -0
  18. package/dist/db/rls.js +3 -3
  19. package/dist/db/rls.js.map +1 -1
  20. package/dist/domain.js +73 -5
  21. package/dist/domain.js.map +1 -1
  22. package/dist/explain.js +1 -1
  23. package/dist/instance/address.js +3 -3
  24. package/dist/instance/address.js.map +1 -1
  25. package/dist/instance/settings.js +1 -1
  26. package/dist/integrations/github.js +3 -3
  27. package/dist/integrations/github.js.map +1 -1
  28. package/dist/integrations/inbound.js +3 -3
  29. package/dist/integrations/inbound.js.map +1 -1
  30. package/dist/integrations/linear.js +1 -1
  31. package/dist/integrations/linear.js.map +1 -1
  32. package/dist/integrations/outbox.js +4 -4
  33. package/dist/integrations/outbox.js.map +1 -1
  34. package/dist/integrations/slack.js +2 -2
  35. package/dist/integrations/slack.js.map +1 -1
  36. package/dist/jobs/index.js +3 -3
  37. package/dist/jobs/reaper.js +11 -11
  38. package/dist/jobs/reaper.js.map +1 -1
  39. package/dist/jobs/set.js +3 -3
  40. package/dist/jobs/set.js.map +1 -1
  41. package/dist/jobs/soon.js +3 -3
  42. package/dist/keys.js +3 -3
  43. package/dist/keys.js.map +1 -1
  44. package/dist/listen.js +3 -3
  45. package/dist/listen.js.map +1 -1
  46. package/dist/mail/assigned.js +10 -10
  47. package/dist/mail/assigned.js.map +1 -1
  48. package/dist/mail/digest.js +3 -3
  49. package/dist/mail/digest.js.map +1 -1
  50. package/dist/mail/index.js +2 -2
  51. package/dist/mail/links.js +5 -5
  52. package/dist/mail/mailer.js +2 -2
  53. package/dist/mail/notify.js +22 -22
  54. package/dist/mail/notify.js.map +1 -1
  55. package/dist/mail/resend.js +1 -1
  56. package/dist/mail/resolve.js +1 -1
  57. package/dist/mail/resolve.js.map +1 -1
  58. package/dist/mail/smtp.js +1 -1
  59. package/dist/mail/unsubscribe.js +1 -1
  60. package/dist/net/publicFetch.js +1 -1
  61. package/dist/orgs.js +5 -5
  62. package/dist/orgs.js.map +1 -1
  63. package/dist/plan.js +1 -1
  64. package/dist/projects.js +4 -4
  65. package/dist/projects.js.map +1 -1
  66. package/dist/routes/account.js +1 -1
  67. package/dist/routes/account.js.map +1 -1
  68. package/dist/routes/activity.js +1 -1
  69. package/dist/routes/anchorReports.js +9 -9
  70. package/dist/routes/anchorReports.js.map +1 -1
  71. package/dist/routes/assignees.js +4 -4
  72. package/dist/routes/assignees.js.map +1 -1
  73. package/dist/routes/attachments.js +6 -6
  74. package/dist/routes/attachments.js.map +1 -1
  75. package/dist/routes/auth.js +4 -4
  76. package/dist/routes/bodyLimit.js +5 -5
  77. package/dist/routes/bodyLimit.js.map +1 -1
  78. package/dist/routes/commentEdit.js +5 -5
  79. package/dist/routes/commentEdit.js.map +1 -1
  80. package/dist/routes/comments.js +24 -24
  81. package/dist/routes/comments.js.map +1 -1
  82. package/dist/routes/cors.js +33 -15
  83. package/dist/routes/cors.js.map +1 -1
  84. package/dist/routes/instance.js +3 -3
  85. package/dist/routes/instance.js.map +1 -1
  86. package/dist/routes/integrations.js +14 -11
  87. package/dist/routes/integrations.js.map +1 -1
  88. package/dist/routes/invites.js +7 -7
  89. package/dist/routes/invites.js.map +1 -1
  90. package/dist/routes/mcpAuth.js +13 -13
  91. package/dist/routes/mcpAuth.js.map +1 -1
  92. package/dist/routes/mcpToken.js +4 -4
  93. package/dist/routes/mcpToken.js.map +1 -1
  94. package/dist/routes/mcpTokens.js +27 -14
  95. package/dist/routes/mcpTokens.js.map +1 -1
  96. package/dist/routes/members.js +9 -5
  97. package/dist/routes/members.js.map +1 -1
  98. package/dist/routes/owner.js +13 -13
  99. package/dist/routes/owner.js.map +1 -1
  100. package/dist/routes/reviewLinks.js +4 -4
  101. package/dist/routes/reviewLinks.js.map +1 -1
  102. package/dist/routes/rounds.js +131 -38
  103. package/dist/routes/rounds.js.map +1 -1
  104. package/dist/routes/sessions.js +190 -73
  105. package/dist/routes/sessions.js.map +1 -1
  106. package/dist/routes/sites.js +9 -9
  107. package/dist/routes/sites.js.map +1 -1
  108. package/dist/routes/threads.js +298 -141
  109. package/dist/routes/threads.js.map +1 -1
  110. package/dist/routes/widget.js +5 -5
  111. package/dist/routes/widget.js.map +1 -1
  112. package/dist/serverless.js +4 -4
  113. package/dist/serverless.js.map +1 -1
  114. package/dist/session.js +8 -8
  115. package/dist/session.js.map +1 -1
  116. package/dist/storage/bucket.js +4 -4
  117. package/dist/storage/bucket.js.map +1 -1
  118. package/dist/storage/settings.js +4 -4
  119. package/dist/storage/settings.js.map +1 -1
  120. package/dist/studioReviewers.js +4 -4
  121. package/dist/vendor/adapters/outbound/fence.js +2 -2
  122. package/dist/vendor/adapters/outbound/sanitise.js +14 -14
  123. package/dist/vendor/mcp/bin.js +4 -4
  124. package/dist/vendor/mcp/client.js +3 -3
  125. package/dist/vendor/mcp/server.js +3 -3
  126. package/dist/vendor/mcp/source.js +13 -13
  127. package/dist/vendor/mcp/view.js +15 -15
  128. package/dist/vendor/types/brief.js +2 -2
  129. package/dist/vendor/types/index.js +1 -1
  130. package/dist/vendor/types/names.js +20 -18
  131. package/dist/vendor/widget/object.js +3 -3
  132. package/dist/vendor/widget/predicates.js +38 -39
  133. package/package.json +1 -5
  134. package/static/dashboard/assets/{CompositeItem-DP7FLsIz.js → CompositeItem-wqcRki5s.js} +1 -1
  135. package/static/dashboard/assets/{ConfirmDialog-B-mNmk6U.js → ConfirmDialog-BqK5eJxB.js} +1 -1
  136. package/static/dashboard/assets/{CopyButton-bsaLPvqU.js → CopyButton-Cc4nF6JB.js} +1 -1
  137. package/static/dashboard/assets/{FieldItemContext-Cz9anwiZ.js → FieldItemContext-DVLVe_H8.js} +1 -1
  138. package/static/dashboard/assets/{InstallTag-DDMHFPFi.js → InstallTag-DCRj1B-Z.js} +1 -1
  139. package/static/dashboard/assets/{SaveState-rgq6rRHH.js → SaveState-B5TIvzLh.js} +1 -1
  140. package/static/dashboard/assets/{_app-B--Q2p1D.js → _app-BOhhOcC-.js} +1 -1
  141. package/static/dashboard/assets/{_app-C5aeP_jI.js → _app-DdvP8iZf.js} +1 -1
  142. package/static/dashboard/assets/{activity-CmpMwfWp.js → activity-CaCW3Nql.js} +1 -1
  143. package/static/dashboard/assets/{arrow-left-BN3lUG8m.js → arrow-left-B5Z7SkRz.js} +1 -1
  144. package/static/dashboard/assets/{avatar-4OkpxHzf.js → avatar-CFgdRtiV.js} +1 -1
  145. package/static/dashboard/assets/{badge-BGUQxxes.js → badge-BIVx2feC.js} +1 -1
  146. package/static/dashboard/assets/{card-BX32udhB.js → card-HwCaU_bv.js} +1 -1
  147. package/static/dashboard/assets/{check-DjkY9Lhe.js → check-CMqBU0e3.js} +1 -1
  148. package/static/dashboard/assets/{chevron-right-w26JMtvi.js → chevron-right-CY_sUg3i.js} +1 -1
  149. package/static/dashboard/assets/{copy-BtOpNPn3.js → copy-Cn6p0txj.js} +1 -1
  150. package/static/dashboard/assets/{dialog-Ca351GqX.js → dialog-_GPHTnXl.js} +2 -2
  151. package/static/dashboard/assets/{dropdown-menu-BdM8D0_i.js → dropdown-menu-BEcLmKR6.js} +1 -1
  152. package/static/dashboard/assets/{image-off-DBc5pfc8.js → image-off-CyXpcTZd.js} +1 -1
  153. package/static/dashboard/assets/{index-Bvmz5Xph.js → index-BZAfm4kX.js} +14 -14
  154. package/static/dashboard/assets/index-BzWDSuyB.css +1 -0
  155. package/static/dashboard/assets/{invite-b1vVPR4n.js → invite-iirWwB3z.js} +1 -1
  156. package/static/dashboard/assets/{label-CeHVAC98.js → label-C9GdL6JP.js} +1 -1
  157. package/static/dashboard/assets/{layout-grid-BJUJgcuD.js → layout-grid-3hfjyzci.js} +1 -1
  158. package/static/dashboard/assets/me-Bgw9jS9F.js +1 -0
  159. package/static/dashboard/assets/{parts-BU_5BLga.js → parts-BOtvDu_v.js} +1 -1
  160. package/static/dashboard/assets/{plus-DW3meZh8.js → plus-CTKInfcq.js} +1 -1
  161. package/static/dashboard/assets/s._site-Bi7roN7x.js +1 -0
  162. package/static/dashboard/assets/s._site.comments-DZBq2FkM.js +54 -0
  163. package/static/dashboard/assets/s._site.reviewers-YfizOkhz.js +1 -0
  164. package/static/dashboard/assets/s._site.settings-Dbua1pYa.js +1 -0
  165. package/static/dashboard/assets/{setup-B5fdtoM-.js → setup-4E2PxysX.js} +1 -1
  166. package/static/dashboard/assets/{sign-in-D9Bhw619.js → sign-in-Nda93fWo.js} +1 -1
  167. package/static/dashboard/assets/{sign-up-CK-LWLzn.js → sign-up-kWIqmM8W.js} +1 -1
  168. package/static/dashboard/assets/{sites-CLB6RzU6.js → sites-DbhDznKA.js} +1 -1
  169. package/static/dashboard/assets/studio-MNEmZ3n7.js +1 -0
  170. package/static/dashboard/assets/{studio-CVFUbJQb.js → studio-ml7KCROJ.js} +1 -1
  171. package/static/dashboard/assets/{studio.index-CUtMjh5_.js → studio.index-CZXgB0jx.js} +1 -1
  172. package/static/dashboard/assets/studio.integrations-OprNYBrJ.js +1 -0
  173. package/static/dashboard/assets/{studio.members-BcVrAT7r.js → studio.members-DT93LEwF.js} +1 -1
  174. package/static/dashboard/assets/{sun-BzCBfLxA.js → sun--lA9pLT9.js} +1 -1
  175. package/static/dashboard/assets/{switch-Djsy8JA6.js → switch-BCNx3nDC.js} +1 -1
  176. package/static/dashboard/assets/{table-Cnpowiv-.js → table-B1e35-OI.js} +1 -1
  177. package/static/dashboard/assets/{useAriaLabelledBy-D35XdVIh.js → useAriaLabelledBy-BLgC8mE_.js} +1 -1
  178. package/static/dashboard/assets/{useBaseQuery-DztMyAqa.js → useBaseQuery-CZkDX1tZ.js} +1 -1
  179. package/static/dashboard/assets/useQuery-C0BVsxqZ.js +1 -0
  180. package/static/dashboard/assets/useRender-P5Wj_Sbt.js +1 -0
  181. package/static/dashboard/assets/{useValueChanged-DY7n1sYE.js → useValueChanged-CCRl5Bf5.js} +1 -1
  182. package/static/dashboard/assets/{users-CR2o4PsB.js → users-DCeMsa2g.js} +1 -1
  183. package/static/dashboard/assets/{welcome-DJ_8xHTE.js → welcome-Il9zYmvM.js} +1 -1
  184. package/static/dashboard/assets/{widget-signin-BOulktuR.js → widget-signin-BLNsOS5K.js} +1 -1
  185. package/static/dashboard/assets/{you-DJGezimL.js → you-B2lWBXCD.js} +1 -1
  186. package/static/dashboard/assets/{zod-4RphBaVj.js → zod-DG4VLz0r.js} +1 -1
  187. package/static/dashboard/index.html +2 -2
  188. package/static/widget/snag.capture.js +1 -1
  189. package/static/widget/snag.dock.js +2 -2
  190. package/static/widget/snag.panels.js +2 -2
  191. package/static/widget/snag.runtime.js +2 -2
  192. package/static/dashboard/assets/index-DAgnfv_E.css +0 -1
  193. package/static/dashboard/assets/me-zNn3-t75.js +0 -1
  194. package/static/dashboard/assets/s._site-DP3hLlXp.js +0 -1
  195. package/static/dashboard/assets/s._site.comments-CyIqVrl3.js +0 -54
  196. package/static/dashboard/assets/s._site.reviewers-muaVzTtT.js +0 -1
  197. package/static/dashboard/assets/s._site.settings-Bow6VdXW.js +0 -1
  198. package/static/dashboard/assets/studio-CuiXjnSt.js +0 -1
  199. package/static/dashboard/assets/studio.integrations-CiQ83f7Q.js +0 -1
  200. package/static/dashboard/assets/useQuery-DCEPkmeo.js +0 -1
  201. package/static/dashboard/assets/useRender-C2NyqaXd.js +0 -1
@@ -1 +0,0 @@
1
- import{t as z,r as i,Y as P,Z as A,X as J,p as T,_ as W,j as e,V as Q,B as N,y as U,$ as oe,A as K}from"./index-Bvmz5Xph.js";import{u as B}from"./useQuery-DCEPkmeo.js";import{B as G}from"./badge-BGUQxxes.js";import{E as $,G as E,I as O,H as D,J as L,K as R}from"./dialog-Ca351GqX.js";import{L as C,I as F}from"./label-CeHVAC98.js";import{S as ae}from"./switch-Djsy8JA6.js";import{C as V}from"./ConfirmDialog-B-mNmk6U.js";import{P as re,a as X}from"./parts-BU_5BLga.js";import{C as _}from"./CopyButton-bsaLPvqU.js";import{b as Y}from"./labels--UUyt9uB.js";import{u as ie}from"./me-zNn3-t75.js";import"./useBaseQuery-DztMyAqa.js";import"./useRender-C2NyqaXd.js";import"./useAriaLabelledBy-D35XdVIh.js";import"./useValueChanged-DY7n1sYE.js";import"./card-BX32udhB.js";import"./check-DjkY9Lhe.js";import"./copy-BtOpNPn3.js";const ce={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function De(){const r=ie(),c=r.user.role==="owner",u=B(U.integrations()),f=z(),g=()=>f.invalidateQueries({queryKey:["integrations"]}),[b,d]=i.useState(null),[m,h]=i.useState(null),[x,l]=i.useState(null),j=P({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},o)=>l({site:o,provider:"github",hook:t,fresh:!1}),onError:t=>A.error(J(t))}),v=P({mutationFn:({uid:t,provider:o})=>T.testTracker(t,o).then(a=>({...a,provider:o})),onSuccess:t=>{A[t.ok?"success":"error"](t.ok?`${W[t.provider]} can see ${t.target}`:t.detail??`${W[t.provider]} refused the token`),g()},onError:t=>A.error(J(t))}),p=P({mutationFn:({uid:t,provider:o})=>T.disconnectTracker(t,o),onSuccess:()=>{h(null),g()},onError:t=>A.error(J(t))}),k=u.data?.data??[],y=t=>k.filter(o=>o.provider===t),n=t=>r.projects.filter(o=>!y(t).some(a=>a.site===o.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(re,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const o=y(t),a=n(t);return e.jsxs(X,{title:W[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[u.isPending&&e.jsx(Q,{rows:2}),u.isSuccess&&o.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),o.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:o.map(s=>{const w=ce[s.health]??{label:s.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:s.siteName??s.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:s.provider==="github"?`${s.owner}/${s.repo}`:s.provider==="linear"?`${s.teamKey} · ${s.teamName}`:s.provider==="jira"?`${s.projectKey} · ${s.projectName}`:`#${s.channelName} · ${s.teamName}`}),e.jsx(G,{variant:"outline",className:w.tone==="ok"?"border-ok text-ok":w.tone==="bad"?"border-destructive text-destructive":"",children:w.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[s.provider==="slack"?s.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":s.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",s.provider==="github"&&s.labels.length?` · labels ${s.labels.join(", ")}`:"",s.provider!=="github"&&s.provider!=="slack"&&!s.hasWebhookSecret?` · no webhook secret yet, so ${W[s.provider]} cannot move comments here`:""," · ",Y(s.updatedAt)]}),s.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:s.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[s.provider==="github"?e.jsx(N,{variant:"ghost",size:"sm",loading:j.isPending,onClick:()=>j.mutate(s.site),children:"Webhook…"}):s.provider==="slack"?null:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>l({site:s.site,provider:s.provider,hook:{url:`${location.origin}/api/v1/integrations/${s.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(N,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate({uid:s.site,provider:s.provider}),children:"Test"}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>h(s),children:"Disconnect"})]})]},`${s.provider}:${s.site}`)})}),c&&a.length>0&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(t),children:"Connect a site…"})})]},t)}),e.jsx(xe,{owner:c,sites:r.projects}),e.jsx(le,{open:b==="github",onOpenChange:t=>!t&&d(null),sites:n("github"),onDone:(t,o)=>{g(),o&&l({site:t,provider:"github",hook:o,fresh:!0})}}),e.jsx(me,{open:b==="linear",onOpenChange:t=>!t&&d(null),sites:n("linear"),onDone:(t,o)=>{g(),l({site:t,provider:"linear",hook:o,fresh:!0})}}),e.jsx(he,{open:b==="jira",onOpenChange:t=>!t&&d(null),sites:n("jira"),onDone:(t,o)=>{g(),l({site:t,provider:"jira",hook:o,fresh:!0})}}),e.jsx(ue,{open:b==="slack",onOpenChange:t=>!t&&d(null),sites:n("slack"),onDone:()=>void g()}),e.jsx(de,{state:x,onClose:()=>l(null),siteName:t=>k.find(o=>o.site===t)?.siteName??"the site"}),e.jsx(V,{open:m!==null,onOpenChange:t=>!t&&h(null),title:`Disconnect ${m?.siteName??"this site"} from ${m?W[m.provider]:"the tracker"}?`,description:m?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:p.isPending,onConfirm:async()=>{m&&await p.mutateAsync({uid:m.site,provider:m.provider})}})]})}function le({open:r,onOpenChange:c,sites:u,onDone:f}){const[g,b]=i.useState(""),[d,m]=i.useState(""),[h,x]=i.useState(""),[l,j]=i.useState(""),[v,p]=i.useState(!1),[k,y]=i.useState(""),n=P({mutationFn:a=>T.connectTracker(a,"github",{repository:d.trim(),token:h.trim(),labels:l,createOn:v?"thread.created":"manual"})}),t=g||u[0]?.uid||"",o=async a=>{a.preventDefault(),y("");try{const s=await n.mutateAsync(t);m(""),x(""),j(""),p(!1),c(!1),f(t,s.webhook&&"secret"in s.webhook?s.webhook:void 0),A.success("GitHub connected")}catch(s){y(s instanceof K?s.message:"Could not reach the server.")}};return e.jsx($,{open:r,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:a=>void o(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(D,{children:"Connect a site to GitHub"}),e.jsxs(L,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),k&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:t,onChange:a=>b(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:u.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(F,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:a=>m(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(F,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:h,onChange:a=>x(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(F,{id:"gh-labels",placeholder:"review, bug",value:l,onChange:a=>j(a.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:a=>p(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(R,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!d.trim()||!h.trim()||!t,children:n.isPending?"Checking…":"Connect"})]})]})})})}function de({state:r,onClose:c,siteName:u}){const f=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx($,{open:r!==null,onOpenChange:g=>!g&&c(),children:e.jsxs(E,{children:[e.jsxs(O,{children:[e.jsx(D,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?u(r.site):"")}),e.jsx(L,{children:r?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":r?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${r?.fresh?"":", and the previous one has stopped working"}.`})]}),r&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:r.hook.url}),e.jsx(_,{text:r.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),f&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:f}),e.jsx(_,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:r.provider==="linear"?"Issues":r.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(R,{children:e.jsx(N,{type:"button",onClick:c,children:"Done"})})]})})}function me({open:r,onOpenChange:c,sites:u,onDone:f}){const[g,b]=i.useState(""),[d,m]=i.useState(""),[h,x]=i.useState(""),[l,j]=i.useState(""),[v,p]=i.useState(!1),[k,y]=i.useState(""),n=P({mutationFn:a=>T.connectTracker(a,"linear",{team:d.trim(),apiKey:h.trim(),...l.trim()?{webhookSecret:l.trim()}:{},createOn:v?"thread.created":"manual"})}),t=g||u[0]?.uid||"",o=async a=>{a.preventDefault(),y("");try{const s=await n.mutateAsync(t);m(""),x(""),j(""),p(!1),c(!1),f(t,s.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),A.success("Linear connected")}catch(s){y(s instanceof K?s.message:"Could not reach the server.")}};return e.jsx($,{open:r,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:a=>void o(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(D,{children:"Connect a site to Linear"}),e.jsx(L,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),k&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:t,onChange:a=>b(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:u.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(F,{id:"ln-team",placeholder:"ENG",value:d,onChange:a=>m(a.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(F,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:h,onChange:a=>x(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(F,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:l,onChange:a=>j(a.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:a=>p(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(R,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!d.trim()||!h.trim()||!t,children:n.isPending?"Checking…":"Connect"})]})]})})})}function he({open:r,onOpenChange:c,sites:u,onDone:f}){const[g,b]=i.useState(""),[d,m]=i.useState(""),[h,x]=i.useState(""),[l,j]=i.useState(""),[v,p]=i.useState(""),[k,y]=i.useState(""),[n,t]=i.useState(!1),[o,a]=i.useState(""),s=P({mutationFn:S=>T.connectTracker(S,"jira",{siteUrl:d.trim(),project:h.trim(),email:l.trim(),apiToken:v.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:n?"thread.created":"manual"})}),w=g||u[0]?.uid||"",H=async S=>{S.preventDefault(),a("");try{const M=await s.mutateAsync(w);x(""),p(""),y(""),t(!1),c(!1),f(w,M.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),A.success("Jira connected")}catch(M){a(M instanceof K?M.message:"Could not reach the server.")}},I=(S,M,Z,ee,te,se="text",q)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${S}`,children:M}),e.jsx(F,{id:`jr-${S}`,type:se,placeholder:te,value:Z,onChange:ne=>ee(ne.target.value),autoComplete:"off"}),q&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:q})]});return e.jsx($,{open:r,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:S=>void H(S),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(D,{children:"Connect a site to Jira"}),e.jsx(L,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),o&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:o}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:w,onChange:S=>b(S.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:u.map(S=>e.jsx("option",{value:S.uid,children:S.name},S.uid))})]}),I("url","Jira site",d,m,"https://kilnwork.atlassian.net"),I("project","Project key",h,x,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),I("email","Account email",l,j,"you@kilnwork.studio","email"),I("token","API token",v,p,"","password"),I("secret","Webhook secret",k,y,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:n,onChange:S=>t(S.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(R,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:s.isPending,disabled:!d.trim()||!h.trim()||!l.trim()||!v.trim()||!w,children:s.isPending?"Checking…":"Connect"})]})]})})})}function ue({open:r,onOpenChange:c,sites:u,onDone:f}){const[g,b]=i.useState(""),[d,m]=i.useState(""),[h,x]=i.useState(""),[l,j]=i.useState(!0),[v,p]=i.useState(""),k=B({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:r,staleTime:1/0}),y=P({mutationFn:o=>T.connectTracker(o,"slack",{channel:d.trim(),token:h.trim(),createOn:l?"thread.created":"manual"})}),n=g||u[0]?.uid||"",t=async o=>{o.preventDefault(),p("");try{await y.mutateAsync(n),m(""),x(""),j(!0),c(!1),f(n),A.success("Slack connected")}catch(a){p(a instanceof K?a.message:"Could not reach the server.")}};return e.jsx($,{open:r,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:o=>void t(o),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(D,{children:"Connect a site to Slack"}),e.jsx(L,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:n,onChange:o=>b(o.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:u.map(o=>e.jsx("option",{value:o.uid,children:o.name},o.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:!k.data,render:e.jsx("a",{href:k.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(F,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:h,onChange:o=>x(o.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(F,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:o=>m(o.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:l,onChange:o=>j(o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(R,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:y.isPending,disabled:!d.trim()||!h.trim()||!n,children:y.isPending?"Checking…":"Connect"})]})]})})})}function xe({owner:r,sites:c}){const u=z(),f=B(U.mcpTokens()),[g,b]=i.useState(!1),[d,m]=i.useState(null),[h,x]=i.useState(null),l=P({mutationFn:n=>T.revokeMcpToken(n),onSuccess:()=>{x(null),u.invalidateQueries({queryKey:["mcp-tokens"]})},onError:n=>A.error(J(n))}),j=f.data?.data??[],v=j.filter(n=>!n.revokedAt),p=f.data?.http??null,k=P({mutationFn:n=>T.setMcpHttp(n),onSuccess:(n,t)=>{u.setQueryData(U.instance().queryKey,n),u.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(t?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:n=>A.error(J(n))}),y=n=>{const t=new Set(n),o=t.has("comments:write")||t.has("threads:write");return!o&&!t.has("context:read")?"Read-only":o?`Writes: ${[t.has("comments:write")?"reply":"",t.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(X,{title:"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[f.isPending&&e.jsx(Q,{rows:2}),p&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[p.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:p.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:p.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),p.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":""]})]}),e.jsx(ae,{id:"mcp-http-on","aria-label":"Remote transport",checked:p.enabled,disabled:!r||p.source==="env"||k.isPending,onCheckedChange:n=>k.mutate(n)})]}),f.isSuccess&&v.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),j.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:j.map(n=>e.jsxs("li",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px] ${n.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[n.prefix,"…"]}),e.jsx(G,{variant:"outline",className:n.revokedAt?"":"border-ok text-ok",children:n.revokedAt?"Revoked":y(n.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.site?n.site.name:"All sites"," · ",n.lastUsedAt?`last used ${Y(n.lastUsedAt)}`:"never used",n.expiresAt&&!n.revokedAt?` · expires ${new Date(n.expiresAt).toLocaleDateString()}`:"",n.createdBy?` · by ${n.createdBy}`:""]}),r&&!n.revokedAt&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>x(n),children:"Revoke"})})]},n.id))}),r&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>b(!0),children:"New token…"})}),e.jsx(pe,{open:g,onOpenChange:b,sites:c,http:f.data?.http??null,onDone:n=>{u.invalidateQueries({queryKey:["mcp-tokens"]}),m(n)}}),e.jsx(fe,{state:d,http:f.data?.http??null,onClose:()=>m(null)}),e.jsx(V,{open:h!==null,onOpenChange:n=>!n&&x(null),title:`Revoke “${h?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:l.isPending,onConfirm:async()=>{h&&await l.mutateAsync(h.id)}})]})}function pe({open:r,onOpenChange:c,sites:u,http:f,onDone:g}){const[b,d]=i.useState(""),[m,h]=i.useState(""),[x,l]=i.useState(["threads:read","source:map"]),[j,v]=i.useState(""),[p,k]=i.useState(!1),[y,n]=i.useState(""),t=P({mutationFn:()=>T.mintMcpToken({name:b.trim(),...m?{site:m}:{},scopes:x,...j?{expiresInDays:Number(j)}:{},...p?{allowRemoteWrites:!0}:{}})}),o=(s,w)=>l(H=>w?[...new Set([...H,s])]:H.filter(I=>I!==s)),a=async s=>{s.preventDefault(),n("");try{const w=await t.mutateAsync();d(""),h(""),l(["threads:read","source:map"]),v(""),k(!1),c(!1),g(w)}catch(w){n(w instanceof K?w.message:"Could not reach the server.")}};return e.jsx($,{open:r,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:s=>void a(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(D,{children:"New agent token"}),e.jsx(L,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(F,{id:"mcp-name",placeholder:"Claude Code",value:b,onChange:s=>d(s.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:m,onChange:s=>h(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"All sites"}),u.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),oe.map(s=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:x.includes(s.scope),onChange:w=>o(s.scope,w.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:s.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:s.hint})]})]},s.scope))]}),f?.enabled&&(x.includes("comments:write")||x.includes("threads:write"))&&e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:p,onChange:s=>k(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:j,onChange:s=>v(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"Never"}),e.jsx("option",{value:"30",children:"In 30 days"}),e.jsx("option",{value:"90",children:"In 90 days"}),e.jsx("option",{value:"365",children:"In a year"})]})]}),e.jsxs(R,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:t.isPending,disabled:!b.trim()||x.length===0,children:t.isPending?"Minting…":"Create token"})]})]})})})}function fe({state:r,http:c,onClose:u}){const f=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:f,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},b=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),d=["claude mcp add snagset",...Object.entries(g).map(([l,j])=>`-e ${l}=${j}`),"--","npx -y @snagset/mcp"].join(" "),m=`Bearer ${r?.secret??""}`,h=["claude mcp add","--transport http","snagset",c?.url??"",`--header "Authorization: ${m}"`].join(" "),x=JSON.stringify({mcpServers:{snagset:{type:"http",url:c?.url??"",headers:{Authorization:m}}}},null,2);return e.jsx($,{open:r!==null,onOpenChange:l=>!l&&u(),children:e.jsxs(E,{className:"sm:max-w-xl",children:[e.jsxs(O,{children:[e.jsxs(D,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(L,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),r&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:r.secret}),e.jsx(_,{text:r.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(_,{text:d,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:d})]}),c?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(_,{text:x,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:h}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:x}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(_,{text:b,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:b}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(R,{children:e.jsx(N,{type:"button",onClick:u,children:"Done"})})]})})}export{De as component};
@@ -1 +0,0 @@
1
- import{u as r,Q as u}from"./useBaseQuery-DztMyAqa.js";function a(e,s){return r(e,u)}export{a as u};
@@ -1 +0,0 @@
1
- import{i as n}from"./index-Bvmz5Xph.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};