@snagset/server 0.1.39 → 0.1.41

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 (117) hide show
  1. package/dist/app.js +79 -2
  2. package/dist/app.js.map +1 -1
  3. package/dist/config.generated.js +3 -1
  4. package/dist/config.generated.js.map +1 -1
  5. package/dist/db/migrations/0014_password_resets.sql +69 -0
  6. package/dist/email.js +29 -0
  7. package/dist/email.js.map +1 -0
  8. package/dist/instance/settings.js +30 -2
  9. package/dist/instance/settings.js.map +1 -1
  10. package/dist/jobs/reaper.js +13 -6
  11. package/dist/jobs/reaper.js.map +1 -1
  12. package/dist/orgs.js +42 -12
  13. package/dist/orgs.js.map +1 -1
  14. package/dist/routes/assignees.js +2 -1
  15. package/dist/routes/assignees.js.map +1 -1
  16. package/dist/routes/instance.js +50 -1
  17. package/dist/routes/instance.js.map +1 -1
  18. package/dist/routes/integrations.js +2 -1
  19. package/dist/routes/integrations.js.map +1 -1
  20. package/dist/routes/invites.js +3 -3
  21. package/dist/routes/invites.js.map +1 -1
  22. package/dist/routes/orgs.js +8 -3
  23. package/dist/routes/orgs.js.map +1 -1
  24. package/dist/routes/owner.js +52 -9
  25. package/dist/routes/owner.js.map +1 -1
  26. package/dist/routes/passwordReset.js +302 -0
  27. package/dist/routes/passwordReset.js.map +1 -0
  28. package/package.json +4 -4
  29. package/static/dashboard/assets/CompositeItem-B_Ebe9qQ.js +1 -0
  30. package/static/dashboard/assets/CompositeList-CDAPQTbv.js +1 -0
  31. package/static/dashboard/assets/{ConfirmDialog-D6hyhISD.js → ConfirmDialog-D1II2uNE.js} +1 -1
  32. package/static/dashboard/assets/{CopyButton-hyiQh1Zr.js → CopyButton-qbA2ZHWn.js} +1 -1
  33. package/static/dashboard/assets/{FieldItemContext-Gb3Lo5Ci.js → FieldItemContext-BM_KzVUj.js} +1 -1
  34. package/static/dashboard/assets/InstallTag-DTpNoMn9.js +1 -0
  35. package/static/dashboard/assets/InstanceRows-B1z-L92-.js +1 -0
  36. package/static/dashboard/assets/McpTokens-DE2t0iiS.js +1 -0
  37. package/static/dashboard/assets/{SaveState-CmcJ4unZ.js → SaveState-QQHqDSgx.js} +1 -1
  38. package/static/dashboard/assets/_app-B_DiSFIt.js +61 -0
  39. package/static/dashboard/assets/{_app-Dsd1bbNv.js → _app-CaDt6CPJ.js} +1 -1
  40. package/static/dashboard/assets/{activity-DG1e6z-2.js → activity-CzEy_J8-.js} +1 -1
  41. package/static/dashboard/assets/{arrow-left-CWiSdgA-.js → arrow-left-RqdORgcq.js} +1 -1
  42. package/static/dashboard/assets/avatar-D8S5EME4.js +1 -0
  43. package/static/dashboard/assets/{badge-DEvpNOzs.js → badge-anHWhPFa.js} +1 -1
  44. package/static/dashboard/assets/{card--8RLEIGP.js → card-C01exIzZ.js} +1 -1
  45. package/static/dashboard/assets/{check-XHwuM5zg.js → check-Gm9Xu4rH.js} +1 -1
  46. package/static/dashboard/assets/chevron-down-C-pVPOKU.js +6 -0
  47. package/static/dashboard/assets/{chevron-right-CG2rSUns.js → chevron-right-BQmYcugl.js} +1 -1
  48. package/static/dashboard/assets/{copy-eakuUTpI.js → copy-Ckk__4oN.js} +1 -1
  49. package/static/dashboard/assets/{dialog-D0b9dX2m.js → dialog-D5G50pSW.js} +2 -2
  50. package/static/dashboard/assets/dropdown-menu-Bm_opJ2p.js +11 -0
  51. package/static/dashboard/assets/forgot-R7JqXxs5.js +1 -0
  52. package/static/dashboard/assets/{image-off-DZOyJVTM.js → image-off-BtbHLgOM.js} +1 -1
  53. package/static/dashboard/assets/index-CoiIx5MR.css +1 -0
  54. package/static/dashboard/assets/index-p-qD6BlY.js +162 -0
  55. package/static/dashboard/assets/invite-9eotNL9V.js +1 -0
  56. package/static/dashboard/assets/label-CuvYMIVd.js +1 -0
  57. package/static/dashboard/assets/{labels-CUVq_Uf0.js → labels-DLMjYGNJ.js} +1 -1
  58. package/static/dashboard/assets/{layout-grid-BXWirugp.js → layout-grid-D5ek58h7.js} +1 -1
  59. package/static/dashboard/assets/{parts-B46j7QJi.js → parts-CN1uQywE.js} +1 -1
  60. package/static/dashboard/assets/{plus-yZPLf0r6.js → plus-BsxOLtMA.js} +1 -1
  61. package/static/dashboard/assets/reset-8K76tpdp.js +1 -0
  62. package/static/dashboard/assets/s._site-egkPDOj9.js +1 -0
  63. package/static/dashboard/assets/s._site.comments-DmrtKLHb.js +49 -0
  64. package/static/dashboard/assets/s._site.reviewers-CGKj-NQo.js +1 -0
  65. package/static/dashboard/assets/s._site.settings-DvWbfMac.js +1 -0
  66. package/static/dashboard/assets/serializeValue-DRMAHja_.js +1 -0
  67. package/static/dashboard/assets/{setup-CefvYWGy.js → setup-BDZJmgIB.js} +1 -1
  68. package/static/dashboard/assets/sign-in-BmweKwDv.js +1 -0
  69. package/static/dashboard/assets/{sign-up-nsUll0Gy.js → sign-up-C06mQl-c.js} +1 -1
  70. package/static/dashboard/assets/sites-CkGgns1o.js +1 -0
  71. package/static/dashboard/assets/studio-BHpeuJSq.js +1 -0
  72. package/static/dashboard/assets/studio-CG1QMBSK.js +1 -0
  73. package/static/dashboard/assets/studio.index-BOkmM7I5.js +1 -0
  74. package/static/dashboard/assets/studio.integrations-BBik3DdK.js +1 -0
  75. package/static/dashboard/assets/studio.members-CEKrbJHp.js +11 -0
  76. package/static/dashboard/assets/studio.plan-CkOzUaJM.js +1 -0
  77. package/static/dashboard/assets/{sun-Djjj3CUF.js → sun-DXwtJyi5.js} +1 -1
  78. package/static/dashboard/assets/{switch-WMRF6OK1.js → switch-cgJL6ATv.js} +1 -1
  79. package/static/dashboard/assets/{table-CgakQRAC.js → table-B8VTYpZO.js} +1 -1
  80. package/static/dashboard/assets/{useAriaLabelledBy-obWCIEg1.js → useAriaLabelledBy-BT5NtL2E.js} +1 -1
  81. package/static/dashboard/assets/{useBaseQuery-DG87f6yY.js → useBaseQuery-DaFWLbWu.js} +1 -1
  82. package/static/dashboard/assets/useQuery-D-9vXtOo.js +1 -0
  83. package/static/dashboard/assets/useRender-BBzDGtxq.js +1 -0
  84. package/static/dashboard/assets/{useValueChanged-CHzVruZ0.js → useValueChanged-cwqHWzY1.js} +1 -1
  85. package/static/dashboard/assets/{users-BvfczmcS.js → users-CGY0g3mg.js} +1 -1
  86. package/static/dashboard/assets/{welcome-D5mKF-J3.js → welcome-CNtwDQMd.js} +3 -3
  87. package/static/dashboard/assets/{widget-signin-BmCBYJgF.js → widget-signin-BOUMPGXt.js} +1 -1
  88. package/static/dashboard/assets/you-DH4QMiND.js +1 -0
  89. package/static/dashboard/assets/{zod-D7wsVto4.js → zod-DfHlfdUJ.js} +1 -1
  90. package/static/dashboard/index.html +2 -2
  91. package/static/widget/build.json +2 -2
  92. package/static/widget/snag.js +1 -1
  93. package/static/widget/snag.runtime.js +1 -1
  94. package/static/dashboard/assets/CompositeItem-Yi3wWYM7.js +0 -1
  95. package/static/dashboard/assets/InstallTag-BRvgfS91.js +0 -1
  96. package/static/dashboard/assets/McpTokens--C1TeZqq.js +0 -1
  97. package/static/dashboard/assets/_app-CBnYJfLp.js +0 -56
  98. package/static/dashboard/assets/avatar-nrKPMD7A.js +0 -1
  99. package/static/dashboard/assets/dropdown-menu-BMIst4Wj.js +0 -11
  100. package/static/dashboard/assets/index-COORBw3J.js +0 -169
  101. package/static/dashboard/assets/index-CpG77B7f.css +0 -1
  102. package/static/dashboard/assets/invite-Df7qdHBL.js +0 -1
  103. package/static/dashboard/assets/label-Ds2CYKth.js +0 -1
  104. package/static/dashboard/assets/s._site-BQiiE9w4.js +0 -1
  105. package/static/dashboard/assets/s._site.comments-CQYkPWo4.js +0 -54
  106. package/static/dashboard/assets/s._site.reviewers-BCQWB5GA.js +0 -1
  107. package/static/dashboard/assets/s._site.settings-D9Qix9dj.js +0 -1
  108. package/static/dashboard/assets/sign-in-Q4AWMmvk.js +0 -1
  109. package/static/dashboard/assets/sites-BKsg9Pla.js +0 -1
  110. package/static/dashboard/assets/studio-CSGo60dt.js +0 -1
  111. package/static/dashboard/assets/studio-ytRb_WCk.js +0 -1
  112. package/static/dashboard/assets/studio.index-Cul4Sj15.js +0 -1
  113. package/static/dashboard/assets/studio.integrations-CC61jGXL.js +0 -1
  114. package/static/dashboard/assets/studio.members-DEM1MjLy.js +0 -6
  115. package/static/dashboard/assets/useQuery-DT3w11tR.js +0 -1
  116. package/static/dashboard/assets/useRender-Bu6Vyu1g.js +0 -1
  117. package/static/dashboard/assets/you-Dsp9kUVS.js +0 -1
@@ -2,7 +2,8 @@ import { Hono } from "hono";
2
2
  import { randomUUID, randomBytes, createHash, timingSafeEqual, scryptSync } from "node:crypto";
3
3
  import { DASHBOARD_SESSION_COOKIE, DASHBOARD_CSRF_COOKIE, HTTP_HEADER, ID_PREFIX } from "../vendor/types/names.js";
4
4
  import { usage } from "../plan.js";
5
- import { studiosOf } from "../orgs.js";
5
+ import { studiosIn } from "../orgs.js";
6
+ import { firstOrgIdIn } from "../instance/settings.js";
6
7
  import { inOrg, maintenance } from "../db/scope.js";
7
8
  import { effectiveWriteMode } from "./sessions.js";
8
9
  import { pendingMigrations } from "../db/migrate.js";
@@ -240,11 +241,42 @@ export function ownerRoutes(deps) {
240
241
  const token = randomBytes(32).toString("base64url");
241
242
  const csrf = randomBytes(32).toString("base64url");
242
243
  const expires = new Date(now().getTime() + ABSOLUTE_MS);
243
- await inOrg(sql, user.org_id, (tx) => tx `
244
- INSERT INTO user_sessions (id, org_id, user_id, token_hash, user_agent, expires_at)
245
- VALUES (${randomUUID()}, ${user.org_id}, ${user.id}, ${sha256(token)},
246
- ${(c.req.header("User-Agent") ?? "").slice(0, 400)}, ${expires})
247
- `);
244
+ /*
245
+ * The session is opened only if the password that was just verified is
246
+ * STILL the password, checked under a lock on the person's row.
247
+ *
248
+ * The hash above was read, then a tenth of a second of scrypt was spent
249
+ * on it, and until 2026-11-10 the session was then inserted without
250
+ * looking again. A password changed in that tenth of a second — by a
251
+ * mailed reset, by `snagset passwd`, on the account page — revokes the
252
+ * sessions that exist at that instant, and this one did not exist yet: it
253
+ * arrived a moment later and was good for thirty days. Whoever knew the
254
+ * old password only had to be signing in at the time, and an attacker who
255
+ * knows it can arrange to be, in a loop.
256
+ *
257
+ * FOR SHARE waits for a change in flight (every one of those takes this
258
+ * row for update first) and then reads what it committed; holding it to
259
+ * the INSERT makes a change that starts now wait for this session to
260
+ * exist, so its revoke finds it. Either order, nothing outlives the change.
261
+ */
262
+ const opened = await maintenance(sql, async (tx) => {
263
+ const [still] = await tx `
264
+ SELECT id FROM users
265
+ WHERE id = ${user.id} AND deleted_at IS NULL AND password_hash = ${user.password_hash}
266
+ FOR SHARE
267
+ `;
268
+ if (!still)
269
+ return false;
270
+ await tx `
271
+ INSERT INTO user_sessions (id, org_id, user_id, token_hash, user_agent, expires_at)
272
+ VALUES (${randomUUID()}, ${user.org_id}, ${user.id}, ${sha256(token)},
273
+ ${(c.req.header("User-Agent") ?? "").slice(0, 400)}, ${expires})
274
+ `;
275
+ return true;
276
+ });
277
+ // The one sentence, as for every other failure here: the password that was typed is no longer one.
278
+ if (!opened)
279
+ return fail(c, 401, "invalid_credentials", "That email address and password do not match an account.");
248
280
  setSessionCookies(c, token, csrf, deps.secure, Math.floor(ABSOLUTE_MS / 1000));
249
281
  // No id, for the reason `/api/v1/me` gives: nothing outside the database
250
282
  // needs it, and an internal id put on the wire because it was to hand is
@@ -338,8 +370,19 @@ export function ownerRoutes(deps) {
338
370
  // shown where a limit exists, silent where there is none.
339
371
  return { org, projects, used: await usage(tx, owner.orgId) };
340
372
  });
341
- // Every studio this person belongs to, for the switcher; the current one is marked.
342
- const studios = await studiosOf(sql, owner.userId);
373
+ // Two questions that cross studios, so one transaction under the
374
+ // maintenance claim. Every studio this person belongs to, for the
375
+ // switcher; the current one is marked. And whether the current one is the
376
+ // operator's, the studio the instance's settings belong to: Studio ›
377
+ // General draws the address, Storage and Mail only then, because from any
378
+ // other studio the instance routes answer 403 (routes/instance.ts) and a
379
+ // page that asked would be drawing a refusal. Together, because this
380
+ // route is asked on every load and again after most writes, and a
381
+ // transaction of its own for the second would be four more round trips.
382
+ const { studios, operator } = await maintenance(sql, async (tx) => ({
383
+ studios: await studiosIn(tx, owner.userId),
384
+ operator: (await firstOrgIdIn(tx)) === owner.orgId,
385
+ }));
343
386
  const l = await deps.limits(owner.orgId);
344
387
  return c.json({
345
388
  limits: {
@@ -356,7 +399,7 @@ export function ownerRoutes(deps) {
356
399
  // id put on the wire because it was to hand is how the first one always
357
400
  // gets out.
358
401
  user: { email: owner.email, name: owner.name, role: owner.role },
359
- org: { name: org?.name ?? "", slug: org?.slug ?? "" },
402
+ org: { name: org?.name ?? "", slug: org?.slug ?? "", operator },
360
403
  orgs: studios.map((s) => ({ slug: s.slug, name: s.name, role: s.role, current: s.id === owner.orgId })),
361
404
  signupOpen: deps.signupOpen?.() ?? false,
362
405
  // The migrations this build ships that the database has not run
@@ -1 +1 @@
1
- {"version":3,"file":"owner.js","sourceRoot":"","sources":["../../src/routes/owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAwC,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/G,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAkErD,2DAA2D;AAC3D,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7C,MAAM,OAA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CAAC;YACvE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC7B,GAAG,EAAE,CAAC,CAAC,GAAG;gBACV,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,SAAS,EAAE,CAAC,CAAC,UAAU;gBACvB,gEAAgE;gBAChE,qEAAqE;gBACrE,iEAAiE;gBACjE,SAAS,EAAE,kBAAkB,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC;gBAC5C,4DAA4D;gBAC5D,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,8DAA8D;gBAC9D,qBAAqB,EAAE,CAAC,CAAC,iBAAiB;gBAC1C,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,UAAU,EAAE,CAAC,CAAC,UAAU;gBACxB,kEAAkE;gBAClE,oEAAoE;gBACpE,uDAAuD;gBACvD,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,uBAAuB,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI;gBACvF,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI;gBACtE,oEAAoE;gBACpE,iEAAiE;gBACjE,SAAS,EAAE,CAAC,CAAC,SAAS;gBACtB,uEAAuE;gBACvE,wDAAwD;gBACxD,YAAY,EAAE,CAAC,CAAC,aAAa;aAC9B,CAAC,CAAC;SACJ,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,302 @@
1
+ import { Hono } from "hono";
2
+ import { randomUUID, randomBytes, createHash } from "node:crypto";
3
+ import { hashPassword, setSessionCookies } from "./owner.js";
4
+ import { openSession, SESSION_S } from "../orgs.js";
5
+ import { maintenance } from "../db/scope.js";
6
+ import { isConfigured } from "../mail/index.js";
7
+ import { firstOrgId } from "../instance/settings.js";
8
+ import { looksLikeEmail } from "../email.js";
9
+ /** An hour: long enough to find the mail, short enough that a mailbox read later is not a way in. */
10
+ export const RESET_TTL_MIN = 60;
11
+ const WINDOW_MS = 60 * 60 * 1000;
12
+ const CALLER_PER_WINDOW = 10;
13
+ const MAILBOX_PER_WINDOW = 3;
14
+ const ATTEMPTS_PER_WINDOW = 20;
15
+ const sha256 = (s) => createHash("sha256").update(s, "utf8").digest();
16
+ function fail(c, status, code, message, details) {
17
+ return c.json({ error: { code, message, ...(details ? { details } : {}), requestId: c.get("requestId") } }, status);
18
+ }
19
+ /** The link. One function, so the mail and a test cannot point at different places. */
20
+ export function resetUrl(base, token) {
21
+ return `${base.replace(/\/+$/, "")}/reset#${token}`;
22
+ }
23
+ /** Ordered so the more useful sentence wins: a used link that has since expired was USED. */
24
+ function gone(r, at) {
25
+ if (r.used_at)
26
+ return "link_used";
27
+ if (r.expires_at <= at)
28
+ return "link_expired";
29
+ return null;
30
+ }
31
+ const SENTENCE = {
32
+ link_not_found: "This reset link is not valid. Check that you copied all of it, or ask for a new one.",
33
+ link_used: "This reset link has already been used. Sign in with the password you chose, or ask for a new link.",
34
+ link_expired: "This reset link has expired. They last an hour. Ask for a new one.",
35
+ };
36
+ /** Why a link cannot be used, as the status and the sentence a route answers with. */
37
+ class Refused extends Error {
38
+ status;
39
+ code;
40
+ constructor(why) {
41
+ super(SENTENCE[why]);
42
+ // 404 for a token nobody minted, 410 for one that existed and no longer
43
+ // works: the page can tell "typo" from "too late", as an invite's does.
44
+ this.status = why === "link_not_found" ? 404 : 410;
45
+ this.code = why;
46
+ }
47
+ }
48
+ /** A link that can still be used, or the refusal that says why not. The maintenance claim: whose it is, is what this finds out. */
49
+ async function liveLink(sql, token, at) {
50
+ const [row] = token
51
+ ? await maintenance(sql, (tx) => tx `
52
+ SELECT id, email, user_id, expires_at, used_at FROM password_resets WHERE token_hash = ${sha256(token)}
53
+ `)
54
+ : [];
55
+ if (!row)
56
+ throw new Refused("link_not_found");
57
+ const why = gone(row, at);
58
+ if (why)
59
+ throw new Refused(why);
60
+ return row;
61
+ }
62
+ /**
63
+ * Bump one hourly counter under the instance's first studio, and say whether
64
+ * it is past its limit. The same statement the mail and MCP budgets run.
65
+ */
66
+ async function over(sql, anchor, key, limit, nowMs) {
67
+ const now = new Date(nowMs);
68
+ const windowStart = new Date(nowMs - WINDOW_MS);
69
+ const expires = new Date(nowMs + WINDOW_MS);
70
+ const [row] = await maintenance(sql, (tx) => tx `
71
+ INSERT INTO rate_counters (org_id, bucket_key, window_start, count, expires_at)
72
+ VALUES (${anchor}::uuid, ${key}, ${now}, 1, ${expires})
73
+ ON CONFLICT (org_id, bucket_key) DO UPDATE
74
+ SET count = CASE WHEN rate_counters.window_start < ${windowStart} THEN 1 ELSE rate_counters.count + 1 END,
75
+ window_start = CASE WHEN rate_counters.window_start < ${windowStart} THEN ${now} ELSE rate_counters.window_start END,
76
+ expires_at = CASE WHEN rate_counters.window_start < ${windowStart} THEN ${expires} ELSE rate_counters.expires_at END
77
+ RETURNING count::text
78
+ `);
79
+ return !!row && Number(row.count) > limit;
80
+ }
81
+ const callerOf = (c) => c.req.header("x-forwarded-for")?.split(",")[0]?.trim() || c.req.header("x-real-ip")?.trim() || "local";
82
+ const bucket = (what, value) => `reset:${what}:${sha256(value).toString("base64url")}`;
83
+ /**
84
+ * The inbox an address delivers to, for COUNTING only — never for identity,
85
+ * where `a+x@` and `a@` stay two accounts.
86
+ *
87
+ * Folded only where two spellings are KNOWN to be one inbox, which is Gmail:
88
+ * a tag after `+`, and dots anywhere. There one inbox with several accounts
89
+ * would otherwise be as many mailboxes as it has spellings. A tag is a
90
+ * provider's feature and not a rule of mail, and folding it everywhere was a
91
+ * way to lock somebody out: where `victim+1@corp` is not delivered to
92
+ * `victim@corp`, whoever held an account spelled that way spent the other
93
+ * person's three an hour on mail that person never saw.
94
+ */
95
+ export function mailboxOf(email) {
96
+ const at = email.lastIndexOf("@");
97
+ let local = email.slice(0, at);
98
+ let domain = email.slice(at + 1);
99
+ if (domain === "googlemail.com")
100
+ domain = "gmail.com";
101
+ if (domain === "gmail.com") {
102
+ const plus = local.indexOf("+");
103
+ if (plus > 0)
104
+ local = local.slice(0, plus);
105
+ local = local.replace(/\./g, "");
106
+ }
107
+ return `${local}@${domain}`;
108
+ }
109
+ const NO_MAIL = "This instance cannot send mail, so it cannot mail a reset link. Whoever runs it can set a new password on the server: snagset passwd you@example.com";
110
+ const TOO_MANY = "Too many attempts from this address. Try again in an hour.";
111
+ export function passwordResetRoutes(deps) {
112
+ const { sql } = deps;
113
+ const now = deps.now ?? (() => Date.now());
114
+ const app = new Hono();
115
+ const attempts = new Map();
116
+ /** invites.ts's limiter, the same shape: the lookup and the confirm, in this process's memory. */
117
+ const overAttempts = (c) => {
118
+ const who = callerOf(c);
119
+ const t = now();
120
+ const recent = (attempts.get(who) ?? []).filter((at) => t - at < WINDOW_MS);
121
+ recent.push(t);
122
+ attempts.set(who, recent);
123
+ if (attempts.size > 10_000)
124
+ attempts.clear();
125
+ return recent.length > ATTEMPTS_PER_WINDOW;
126
+ };
127
+ /** `/auth/login`'s origin rule: a cross-site page must not be able to start any of this in a visitor's name. */
128
+ const foreign = (c) => {
129
+ const origin = c.req.header("Origin");
130
+ const host = c.req.header("Host");
131
+ const ours = new Set([deps.origin, host ? `http://${host}` : "", host ? `https://${host}` : ""]);
132
+ return !!origin && !ours.has(origin);
133
+ };
134
+ /**
135
+ * Hand the address-dependent half of a request to the platform. It never
136
+ * becomes an unhandled rejection: the caller has been told 202, and what
137
+ * went wrong is the operator's to read.
138
+ */
139
+ const afterwards = async (work) => {
140
+ const quiet = work().then(() => undefined, (e) => console.error("password reset: the mail did not go —", e instanceof Error ? e.message : e));
141
+ const wait = deps.later ? deps.later(quiet) : undefined;
142
+ if (wait)
143
+ await wait;
144
+ };
145
+ // Bodies here are a token or a password. Never logged, as the invite routes' are not.
146
+ app.use("/auth/reset/*", async (c, next) => {
147
+ c.set("noBodyLogging", true);
148
+ await next();
149
+ });
150
+ app.post("/auth/reset/request", async (c) => {
151
+ if (foreign(c))
152
+ return fail(c, 403, "forbidden", "That request came from another site.");
153
+ const mailer = await deps.mailer();
154
+ if (!isConfigured(mailer))
155
+ return fail(c, 409, "integration_not_configured", NO_MAIL);
156
+ const body = (await c.req.json().catch(() => null));
157
+ const email = typeof body?.email === "string" ? body.email.trim().toLowerCase() : "";
158
+ if (!looksLikeEmail(email)) {
159
+ return fail(c, 400, "validation_failed", "That does not look like an email address.", { field: "email" });
160
+ }
161
+ // No studio means no account to reset, and nowhere to count; the answer is the same.
162
+ const anchor = await firstOrgId(sql);
163
+ if (!anchor)
164
+ return c.json({ ok: true }, 202);
165
+ if (await over(sql, anchor, bucket("from", callerOf(c)), CALLER_PER_WINDOW, now()))
166
+ return fail(c, 429, "quota_exceeded", TOO_MANY);
167
+ // From here on nothing is awaited that knows whose address this is: the
168
+ // answer below is already decided, and it is the same for all of them.
169
+ await afterwards(async () => {
170
+ const [user] = await maintenance(sql, (tx) => tx `
171
+ SELECT id, org_id FROM users WHERE email = ${email} AND deleted_at IS NULL
172
+ `);
173
+ if (!user)
174
+ return;
175
+ if (await over(sql, anchor, bucket("to", mailboxOf(email)), MAILBOX_PER_WINDOW, now()))
176
+ return;
177
+ const token = randomBytes(32).toString("base64url");
178
+ await maintenance(sql, (tx) => tx `
179
+ INSERT INTO password_resets (id, org_id, user_id, token_hash, email, expires_at)
180
+ VALUES (${randomUUID()}, ${user.org_id}::uuid, ${user.id}::uuid, ${sha256(token)}, ${email}, ${new Date(now() + RESET_TTL_MIN * 60_000)})
181
+ `);
182
+ const base = await deps.address();
183
+ await mailer.send({
184
+ to: email,
185
+ subject: "Reset your Snagset password",
186
+ text: `Somebody asked to reset the password for ${email} on ${hostOf(base)}.\n\n` +
187
+ `Open this link to choose a new one:\n${resetUrl(base, token)}\n\n` +
188
+ `It works once and expires in an hour. ` +
189
+ `If that was not you, ignore this email: nothing changes unless the link is used.\n`,
190
+ });
191
+ });
192
+ // One answer for an account, for no account, and for a mailbox over its cap.
193
+ return c.json({ ok: true }, 202);
194
+ });
195
+ app.post("/auth/reset/lookup", async (c) => {
196
+ if (overAttempts(c))
197
+ return fail(c, 429, "quota_exceeded", TOO_MANY);
198
+ const body = (await c.req.json().catch(() => null));
199
+ const token = typeof body?.token === "string" ? body.token.trim() : "";
200
+ try {
201
+ const link = await liveLink(sql, token, new Date(now()));
202
+ return c.json({ email: link.email, expiresAt: link.expires_at.toISOString() });
203
+ }
204
+ catch (e) {
205
+ if (e instanceof Refused)
206
+ return fail(c, e.status, e.code, e.message);
207
+ throw e;
208
+ }
209
+ });
210
+ app.post("/auth/reset/confirm", async (c) => {
211
+ if (foreign(c))
212
+ return fail(c, 403, "forbidden", "That request came from another site.");
213
+ if (overAttempts(c))
214
+ return fail(c, 429, "quota_exceeded", TOO_MANY);
215
+ const body = (await c.req.json().catch(() => null));
216
+ const token = typeof body?.token === "string" ? body.token.trim() : "";
217
+ const password = typeof body?.password === "string" ? body.password : "";
218
+ let link;
219
+ try {
220
+ link = await liveLink(sql, token, new Date(now()));
221
+ }
222
+ catch (e) {
223
+ if (e instanceof Refused)
224
+ return fail(c, e.status, e.code, e.message);
225
+ throw e;
226
+ }
227
+ // Twelve, no composition rules — said as setup, sign-up and the account page say it.
228
+ if (password.length < 12) {
229
+ return fail(c, 400, "validation_failed", "The password must be at least 12 characters. A short phrase of real words is fine.", { field: "password" });
230
+ }
231
+ // scrypt before the transaction, as the invite accept does: a tenth of a
232
+ // second of work is not done holding a row lock a racing confirm waits on.
233
+ const passwordHash = hashPassword(password);
234
+ let out;
235
+ try {
236
+ out = await sql.begin(async (tx) => {
237
+ await tx `SET LOCAL app.maintenance = 'on'`;
238
+ // The PERSON's row first, held to the end, and every confirm for
239
+ // them in that order. Two links for one account confirmed together
240
+ // used to take their locks crosswise — each its own link, then the
241
+ // other's — and Postgres ended one as a deadlock, a 500. Queued on
242
+ // this row, the second finds its link already spent and says so.
243
+ // `/auth/login` waits on the same row (owner.ts), which is what
244
+ // stops a sign-in already in flight from outliving the reset.
245
+ const [held] = await tx `SELECT id FROM users WHERE id = ${link.user_id} AND deleted_at IS NULL FOR UPDATE`;
246
+ // Removed from the instance after the link was sent: there is nothing to reset.
247
+ if (!held)
248
+ throw new Refused("link_not_found");
249
+ // THE consume. One statement on the whole live predicate: a link is
250
+ // never used twice, and anything that fails below rolls it back, so
251
+ // it is never spent on nothing.
252
+ const [won] = await tx `
253
+ UPDATE password_resets SET used_at = now()
254
+ WHERE id = ${link.id} AND used_at IS NULL AND expires_at > now()
255
+ RETURNING id
256
+ `;
257
+ if (!won) {
258
+ const [again] = await tx `SELECT used_at, expires_at FROM password_resets WHERE id = ${link.id}`;
259
+ throw new Refused(again ? gone(again, new Date()) ?? "link_used" : "link_used");
260
+ }
261
+ // The mailbox is proven by the link having arrived, whatever the column said before.
262
+ const [user] = await tx `
263
+ UPDATE users SET password_hash = ${passwordHash}, email_verified = true, updated_at = now()
264
+ WHERE id = ${link.user_id} AND deleted_at IS NULL
265
+ RETURNING id, org_id, email, name
266
+ `;
267
+ if (!user)
268
+ throw new Refused("link_not_found");
269
+ // What `snagset passwd` does: whoever knew the old password is signed out everywhere.
270
+ await tx `UPDATE user_sessions SET revoked_at = now() WHERE user_id = ${user.id} AND revoked_at IS NULL`;
271
+ // Everywhere includes the widget. A member's widget session was minted
272
+ // from a dashboard session and refreshes on its own for twelve hours;
273
+ // this is the per-identity sign-out a removal uses (members.ts), so
274
+ // one minted before this instant is refused at its next request.
275
+ await tx `UPDATE reviewers SET identity_valid_after = now() WHERE user_id = ${user.id}`;
276
+ // And every other reset link still out for this person dies with the password it would have replaced.
277
+ await tx `UPDATE password_resets SET used_at = now() WHERE user_id = ${user.id} AND used_at IS NULL`;
278
+ // Signed in exactly as `/auth/login` signs in, to the home studio.
279
+ const session = await openSession(tx, { orgId: user.org_id, userId: user.id, userAgent: c.req.header("User-Agent") ?? "" });
280
+ return { email: user.email, name: user.name, session };
281
+ });
282
+ }
283
+ catch (e) {
284
+ if (e instanceof Refused)
285
+ return fail(c, e.status, e.code, e.message);
286
+ throw e;
287
+ }
288
+ setSessionCookies(c, out.session.token, out.session.csrf, deps.secure, SESSION_S);
289
+ return c.json({ user: { email: out.email, name: out.name }, csrfToken: out.session.csrf });
290
+ });
291
+ return app;
292
+ }
293
+ /** The instance's name in a mail: its host, which is what the person typed to get here. */
294
+ function hostOf(base) {
295
+ try {
296
+ return new URL(base).host;
297
+ }
298
+ catch {
299
+ return base;
300
+ }
301
+ }
302
+ //# sourceMappingURL=passwordReset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passwordReset.js","sourceRoot":"","sources":["../../src/routes/passwordReset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAoB,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAqB,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAuF7C,qGAAqG;AACrG,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACjC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,mBAAmB,G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AAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC5H,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,OAAO;gBAAE,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;YACtE,MAAM,CAAC,CAAC;QACV,CAAC;QACD,iBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAClF,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,2FAA2F;AAC3F,SAAS,MAAM,CAAC,IAAY;IAC1B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snagset/server",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The Snagset server: API, dashboard and widget in one package. Node and Postgres, or Vercel.",
@@ -24,14 +24,14 @@
24
24
  "postpack": "node ../../tools/publish-manifest.mjs restore"
25
25
  },
26
26
  "dependencies": {
27
- "@hono/node-server": "2.1.1",
27
+ "@hono/node-server": "2.1.6",
28
28
  "@modelcontextprotocol/sdk": "1.32.1",
29
29
  "aws4fetch": "1.0.20",
30
30
  "drizzle-orm": "0.45.2",
31
- "hono": "4.13.13",
31
+ "hono": "4.13.16",
32
32
  "jose": "6.2.8",
33
33
  "postgres": "3.4.9",
34
- "zod": "4.4.3"
34
+ "zod": "4.6.7"
35
35
  },
36
36
  "main": "./dist/app.js",
37
37
  "exports": {
@@ -0,0 +1 @@
1
+ import{aG as g,r as l,aa as h,E as R,a9 as d,k as C}from"./index-p-qD6BlY.js";import{a as x}from"./CompositeList-CDAPQTbv.js";function I(s={}){const{highlightItemOnHover:m,highlightedIndex:c,onHighlightedIndexChange:p}=g(),{ref:r,index:t}=x(s),o=c===t,i=l.useRef(null),n=h(r,i);return{compositeProps:{tabIndex:o?0:-1,onFocus(){p(t)},onMouseMove(){const e=i.current;if(!m||!e)return;const a=e.hasAttribute("disabled")||e.ariaDisabled==="true";!o&&!a&&e.focus()}},compositeRef:n,index:t}}function M(s){const{render:m,className:c,style:p,state:r=R,props:t=d,refs:o=d,metadata:i,stateAttributesMapping:n,tag:u="div",...e}=s,{compositeProps:a,compositeRef:f}=I({metadata:i});return C(u,s,{state:r,ref:[f,...o],props:[a,...t,e],stateAttributesMapping:n})}export{M as C};
@@ -0,0 +1 @@
1
+ import{r as c,e as L,f as g,a8 as S,j}from"./index-p-qD6BlY.js";const k=c.createContext(void 0);function F(){return c.useContext(k)?.direction??"ltr"}const y=c.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function T(){return c.useContext(y)}function G(u={}){const{guess:o,label:e,metadata:s,textRef:p,index:t}=u,{register:i,unregister:a,subscribeMapChange:m,nextIndexRef:R}=T(),f=c.useRef(-1),[v,b]=c.useState(t==null&&o?()=>{if(f.current===-1){const l=R.current;R.current+=1,f.current=l}return f.current}:-1),I=t??v,h=c.useRef(null),E=c.useCallback(l=>{const C=h.current;C&&a(C),h.current=l,l&&i(l,{metadata:s??null,index:t??null,label:e,textRef:p})},[t,i,a,s,e,p]);return L(()=>{if(t==null)return m(l=>{const C=h.current?l.get(h.current)?.index:null;C!=null&&b(C)})},[t,m]),{ref:E,index:I}}function V(u){const{children:o,elementsRef:e,labelsRef:s,onMapChange:p}=u,t=g(p),[,i]=c.useState(!1),a=S(U).current,m=S(A).current,R=c.useRef(0),f=c.useRef(!0),v=c.useRef([]),b=c.useRef(null),I=g(()=>{f.current||(f.current=!0,i(n=>!n))}),h=g((n,d)=>{m.set(n,d),I()}),E=g(n=>{m.delete(n),I()}),l=g(n=>{const d=new Map;return e.current.length=0,s&&(s.current.length=0),n.forEach(r=>{d.set(r.element,{...r.registration.metadata??{},index:r.index}),e.current[r.index]=r.element,s&&(s.current[r.index]=r.registration.label!==void 0?r.registration.label:r.registration.textRef?.current?.textContent??r.element.textContent)}),R.current=e.current.length,d});function C(n){if(b.current?.disconnect(),b.current=null,typeof MutationObserver!="function"||n.length<2)return;const d=new MutationObserver(x=>{if(!z(x))return;let M=null;for(const w of n)if(w.isConnected){if(M&&D(M,w)>0){d.disconnect(),I();return}M=w}});b.current=d;const r=new Set;for(let x=1;x<n.length;x+=1){const M=_(n[x-1],n[x]);M&&r.add(M)}r.forEach(x=>d.observe(x,{childList:!0}))}const N=g(()=>{const[n,d]=W(m),r=l(n);C(d),v.current=n,f.current=!1,a.forEach(x=>x(r)),t(r)});L(()=>(f.current||l(v.current),()=>{e.current=[],s&&(s.current=[])}),[e,s,l]),L(()=>{f.current&&N()}),L(()=>()=>{b.current?.disconnect(),f.current=!0},[]);const O=g(n=>(a.add(n),()=>{a.delete(n)})),P=c.useMemo(()=>({register:h,unregister:E,subscribeMapChange:O,nextIndexRef:R}),[h,E,O,R]);return j.jsx(y.Provider,{value:P,children:o})}function A(){return new Map}function U(){return new Set}function W(u){const o=new Set,e=[],s=[];u.forEach((t,i)=>{if(!i.isConnected)return;const a=t.index,m={index:a??-1,element:i,registration:t};a===null?s.push(m):a>=0&&(o.add(a),e.push(m))});let p=0;return s.sort((t,i)=>D(t.element,i.element)),s.forEach(t=>{for(;o.has(p);)p+=1;t.index=p,e.push(t),p+=1}),o.size>0&&e.sort((t,i)=>t.index-i.index),[e,s.map(t=>t.element)]}function _(u,o){let e=u.parentElement;for(;e&&!e.contains(o);)e=e.parentElement;return e}function z(u){for(const o of u)for(let e=0;e<o.removedNodes.length;e+=1)if(o.removedNodes[e].isConnected)return!0;return!1}function D(u,o){return u.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}export{V as C,G as a,F as u};
@@ -1 +1 @@
1
- import{r as i,j as e,B as x}from"./index-COORBw3J.js";import{E as u,G as g,I as C,H as D,J as v,K as b}from"./dialog-D0b9dX2m.js";import{L as E,I}from"./label-Ds2CYKth.js";function T({open:t,onOpenChange:o,title:m,description:r,children:h,confirmLabel:j,confirmWord:l,busy:s=!1,onConfirm:p}){const[n,c]=i.useState(""),d=i.useId();i.useEffect(()=>{t&&c("")},[t]);const f=!l||n.trim()===l;return e.jsx(u,{open:t,onOpenChange:a=>{!a&&s||o(a)},children:e.jsx(g,{showCloseButton:!1,children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:a=>{a.preventDefault(),f&&!s&&p()},children:[e.jsxs(C,{children:[e.jsx(D,{children:m}),r&&e.jsx(v,{children:r})]}),h,l&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(E,{htmlFor:d,children:["Type ",e.jsx("b",{className:"font-semibold text-foreground",children:l})," to confirm"]}),e.jsx(I,{id:d,value:n,autoComplete:"off",spellCheck:!1,disabled:s,onChange:a=>c(a.target.value)})]}),e.jsxs(b,{children:[e.jsx(x,{type:"button",variant:"outline",disabled:s,onClick:()=>o(!1),children:"Cancel"}),e.jsx(x,{type:"submit",variant:"destructive",loading:s,disabled:!f,children:s?"Working…":j})]})]})})})}export{T as C};
1
+ import{r as i,j as e,B as x}from"./index-p-qD6BlY.js";import{E as u,G as g,I as C,H as D,J as v,K as b}from"./dialog-D5G50pSW.js";import{L as E,I}from"./label-CuvYMIVd.js";function T({open:t,onOpenChange:o,title:m,description:r,children:h,confirmLabel:j,confirmWord:l,busy:s=!1,onConfirm:p}){const[n,c]=i.useState(""),d=i.useId();i.useEffect(()=>{t&&c("")},[t]);const f=!l||n.trim()===l;return e.jsx(u,{open:t,onOpenChange:a=>{!a&&s||o(a)},children:e.jsx(g,{showCloseButton:!1,children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:a=>{a.preventDefault(),f&&!s&&p()},children:[e.jsxs(C,{children:[e.jsx(D,{children:m}),r&&e.jsx(v,{children:r})]}),h,l&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(E,{htmlFor:d,children:["Type ",e.jsx("b",{className:"font-semibold text-foreground",children:l})," to confirm"]}),e.jsx(I,{id:d,value:n,autoComplete:"off",spellCheck:!1,disabled:s,onChange:a=>c(a.target.value)})]}),e.jsxs(b,{children:[e.jsx(x,{type:"button",variant:"outline",disabled:s,onClick:()=>o(!1),children:"Cancel"}),e.jsx(x,{type:"submit",variant:"destructive",loading:s,disabled:!f,children:s?"Working…":j})]})]})})})}export{T as C};
@@ -1 +1 @@
1
- import{r as n,j as t,B as c}from"./index-COORBw3J.js";import{C}from"./check-XHwuM5zg.js";import{C as m}from"./copy-eakuUTpI.js";function l({text:r,label:e="Copy",withText:s=!1,size:a="icon-sm",className:p}){const[o,i]=n.useState(!1);return t.jsxs(c,{type:"button",variant:"outline",size:s?"sm":a,className:p,"aria-label":o?"Copied":e,onClick:()=>{navigator.clipboard?.writeText(r).catch(()=>{}),i(!0),setTimeout(()=>i(!1),1500)},children:[o?t.jsx(C,{}):t.jsx(m,{}),s&&(o?"Copied":e)]})}export{l as C};
1
+ import{r as n,j as t,B as c}from"./index-p-qD6BlY.js";import{C}from"./check-Gm9Xu4rH.js";import{C as m}from"./copy-Ckk__4oN.js";function l({text:r,label:e="Copy",withText:s=!1,size:a="icon-sm",className:p}){const[o,i]=n.useState(!1);return t.jsxs(c,{type:"button",variant:"outline",size:s?"sm":a,className:p,"aria-label":o?"Copied":e,onClick:()=>{navigator.clipboard?.writeText(r).catch(()=>{}),i(!0),setTimeout(()=>i(!1),1500)},children:[o?t.jsx(C,{}):t.jsx(m,{}),s&&(o?"Copied":e)]})}export{l as C};
@@ -1 +1 @@
1
- import{r as t}from"./index-COORBw3J.js";const e=t.createContext({disabled:!1});function r(){return t.useContext(e)}export{r as u};
1
+ import{r as t}from"./index-p-qD6BlY.js";const e=t.createContext({disabled:!1});function r(){return t.useContext(e)}export{r as u};
@@ -0,0 +1 @@
1
+ import{r as o,j as e,B as i,b2 as n}from"./index-p-qD6BlY.js";import{C as c}from"./check-Gm9Xu4rH.js";import{C as l}from"./copy-Ckk__4oN.js";function p(t){return`<script src="${location.origin}/snag.js" ${n("site")}="${t}" defer><\/script>`}function g({uid:t}){const[r,s]=o.useState(!1),a=p(t);return e.jsxs("div",{className:"relative rounded-md border border-border bg-background px-3 py-2.5 pr-11 font-mono text-[12.5px] leading-relaxed",children:[e.jsx("code",{className:"whitespace-pre-wrap break-all",children:a}),e.jsx(i,{variant:"ghost",size:"icon-sm",className:"absolute right-1.5 top-1.5","aria-label":r?"Copied":"Copy the tag",onClick:()=>{navigator.clipboard?.writeText(a),s(!0),setTimeout(()=>s(!1),1500)},children:r?e.jsx(c,{}):e.jsx(l,{})})]})}export{g as I};
@@ -0,0 +1 @@
1
+ import{d as U,r as f,a4 as y,s as v,a5 as j,a1 as S,j as e,B as x,z as w,A as M}from"./index-p-qD6BlY.js";import{u as L}from"./useQuery-D-9vXtOo.js";import{E as B,G as K,I,H as R,J as E,K as P}from"./dialog-D5G50pSW.js";import{L as k,I as C}from"./label-CuvYMIVd.js";import{C as z}from"./ConfirmDialog-D1II2uNE.js";import{a as N}from"./parts-CN1uQywE.js";import{b as A,u as _}from"./labels-DLMjYGNJ.js";function Z({owner:t}){const r=L(w.instance()),l=U(),s=()=>l.invalidateQueries({queryKey:w.instance().queryKey}),[g,m]=f.useState(!1),[b,p]=f.useState(!1),[h,u]=f.useState(null),d=y({mutationFn:v.disconnectStorage,onSuccess:()=>void s(),onError:c=>j.error(S(c))}),n=y({mutationFn:v.disconnectMail,onSuccess:()=>void s(),onError:c=>j.error(S(c))}),i=y({mutationFn:v.testMail,onSuccess:c=>j.success(`Sent to ${c.to}`),onError:c=>j.error(S(c))}),a=r.data?.storage,o=r.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(N,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!r.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:r.isError?"Could not read it.":"Reading…"}),a&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{tone:a.connected?"ok":a.unreadable?"bad":"off",text:a.connected?`Connected · ${a.bucket} at ${(a.endpoint??"").replace(/^https?:\/\//,"")}${a.connectedAt?` · since ${A(a.connectedAt)}`:""}`:a.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),e.jsx(G,{}),a.source==="env"?e.jsx($,{what:"SNAGSET_STORAGE_S3_*"}):t?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{variant:"outline",size:"sm",onClick:()=>m(!0),children:a.connected||a.unreadable?"Replace…":"Connect a bucket…"}),(a.connected||a.unreadable)&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(N,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${A(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx($,{what:"SNAGSET_MAIL_URL"}):t?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(x,{variant:"outline",size:"sm",onClick:()=>p(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(x,{variant:"outline",size:"sm",loading:i.isPending,onClick:()=>i.mutate(),children:i.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&t===!1,null)]})}),e.jsx(O,{open:g,onOpenChange:m,onDone:()=>void s()}),e.jsx(q,{open:b,onOpenChange:p,onDone:()=>void s()}),e.jsx(z,{open:h!==null,onOpenChange:c=>!c&&u(null),title:h==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:h==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:d.isPending||n.isPending,onConfirm:async()=>{h==="storage"?await d.mutateAsync():await n.mutateAsync(),u(null)}})]})}function T(){const{storage:t}=_().limits;return t.limit===null?null:`${F(t.used)} of ${F(t.limit)} used across the studio's sites.`}function G(){const t=T();return t===null?null:e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:t})}function ee(){const t=T();return t===null?null:e.jsx(N,{title:"Storage",description:"Screenshots and files, against the studio's plan.",children:e.jsx("p",{className:"m-0 text-[13px]",children:t})})}function D({tone:t,text:r}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${t==="ok"?"bg-ok":t==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:r})]})}function $({what:t}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:t}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function O({open:t,onOpenChange:r,onDone:l}){const[s,g]=f.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[m,b]=f.useState(""),p=y({mutationFn:v.connectStorage}),h=n=>i=>g({...s,[n]:i.target.value}),u=async n=>{n.preventDefault(),b("");try{await p.mutateAsync({endpoint:s.endpoint.trim(),bucket:s.bucket.trim(),accessKeyId:s.accessKeyId.trim(),secretAccessKey:s.secretAccessKey,...s.region.trim()?{region:s.region.trim()}:{},...s.publicBaseUrl.trim()?{publicBaseUrl:s.publicBaseUrl.trim()}:{}}),g({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),r(!1),l(),j.success("Bucket connected — screenshots are on")}catch(i){b(i instanceof M?i.message:"Could not reach the server.")}},d=(n,i,a,o="text",c)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:`st-${n}`,children:i}),e.jsx(C,{id:`st-${n}`,type:o,placeholder:a,value:s[n],onChange:h(n),autoComplete:"off"}),c&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c})]});return e.jsx(B,{open:t,onOpenChange:r,children:e.jsx(K,{children:e.jsxs("form",{onSubmit:n=>void u(n),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(I,{children:[e.jsx(R,{children:"Connect a bucket"}),e.jsx(E,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),m&&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:m}),d("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),d("bucket","Bucket","snagset"),d("region","Region","auto","text","Leave empty for providers that do not use one."),d("accessKeyId","Access key ID",""),d("secretAccessKey","Secret access key","","password"),d("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(P,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:p.isPending,children:p.isPending?"Probing…":"Connect"})]})]})})})}function q({open:t,onOpenChange:r,onDone:l}){const[s,g]=f.useState(""),[m,b]=f.useState(""),[p,h]=f.useState(""),u=y({mutationFn:v.connectMail}),d=async n=>{n.preventDefault(),h("");try{await u.mutateAsync({url:s.trim(),from:m.trim()}),g(""),b(""),r(!1),l(),j.success("Transport connected — send a test email to be sure")}catch(i){h(i instanceof M?i.message:"Could not reach the server.")}};return e.jsx(B,{open:t,onOpenChange:r,children:e.jsx(K,{children:e.jsxs("form",{onSubmit:n=>void d(n),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(I,{children:[e.jsx(R,{children:"Connect a mail transport"}),e.jsx(E,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),p&&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:p}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"mail-url",children:"Transport"}),e.jsx(C,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:s,onChange:n=>g(n.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"mail-from",children:"From"}),e.jsx(C,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:m,onChange:n=>b(n.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(P,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:u.isPending,disabled:!s.trim()||!m.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function F(t){const r=["B","KB","MB","GB","TB"];let l=t,s=0;for(;l>=1024&&s<r.length-1;)l/=1024,s+=1;return`${s===0?l:l.toFixed(l>=10?0:1)} ${r[s]}`}export{Z as I,ee as S,F as b};
@@ -0,0 +1 @@
1
+ import{d as L,r as x,a4 as R,j as e,_ as J,B as N,a5 as A,a1 as D,z as E,s as T,a7 as K,A as Q}from"./index-p-qD6BlY.js";import{u as z}from"./useQuery-D-9vXtOo.js";import{B as M}from"./badge-anHWhPFa.js";import{E as O,G as _,I as F,H as B,J as $,K as I}from"./dialog-D5G50pSW.js";import{L as S,I as G}from"./label-CuvYMIVd.js";import{S as H}from"./switch-cgJL6ATv.js";import{C as W}from"./ConfirmDialog-D1II2uNE.js";import{C}from"./CopyButton-qbA2ZHWn.js";import{a as U}from"./parts-CN1uQywE.js";import{b as Y}from"./labels-DLMjYGNJ.js";function ce({owner:n,instanceOwner:l,sites:g,mine:f=!1}){const c=L(),a=z(E.mcpTokens()),[u,d]=x.useState(!1),[j,o]=x.useState(null),[r,m]=x.useState(null),v=R({mutationFn:t=>T.revokeMcpToken(t),onSuccess:()=>{m(null),c.invalidateQueries({queryKey:["mcp-tokens"]})},onError:t=>A.error(D(t))}),y=a.data?.data??[],w=y.filter(t=>!t.revokedAt),i=a.data?.http??null,k=R({mutationFn:t=>T.setMcpHttp(t),onSuccess:(t,p)=>{c.setQueryData(E.instance().queryKey,t),c.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(p?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:t=>A.error(D(t))}),b=t=>{const p=new Set(t),s=p.has("comments:write")||p.has("threads:write");return!s&&!p.has("context:read")?"Read-only":s?`Writes: ${[p.has("comments:write")?"reply":"",p.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(U,{title:f?"Your agent tokens":"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:[a.isPending&&e.jsx(J,{rows:2}),i&&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(S,{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:[i.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:i.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:i.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),i.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":""]})]}),e.jsx(H,{id:"mcp-http-on","aria-label":"Remote transport",checked:i.enabled,disabled:!l||i.source==="env"||k.isPending,onCheckedChange:t=>k.mutate(t)})]}),a.isSuccess&&w.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(M,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:f?"You have no agent tokens yet.":"No agent can read this studio yet."})]}),y.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:y.map(t=>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] ${t.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[t.prefix,"…"]}),e.jsx(M,{variant:"outline",className:t.revokedAt?"":"border-ok text-ok",children:t.revokedAt?"Revoked":b(t.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[t.site?t.site.name:"All sites"," · ",t.lastUsedAt?`last used ${Y(t.lastUsedAt)}`:"never used",t.expiresAt&&!t.revokedAt?` · expires ${new Date(t.expiresAt).toLocaleDateString()}`:"",t.createdBy?` · by ${t.createdBy}`:""]}),t.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>m(t),children:"Revoke"})})]},t.id))}),n&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"New token…"})}),e.jsx(V,{open:u,onOpenChange:d,sites:g,http:a.data?.http??null,onDone:t=>{c.invalidateQueries({queryKey:["mcp-tokens"]}),o(t)}}),e.jsx(X,{state:j,http:a.data?.http??null,onClose:()=>o(null)}),e.jsx(W,{open:r!==null,onOpenChange:t=>!t&&m(null),title:`Revoke “${r?.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:v.isPending,onConfirm:async()=>{r&&await v.mutateAsync(r.id)}})]})}function V({open:n,onOpenChange:l,sites:g,http:f,onDone:c}){const[a,u]=x.useState(""),[d,j]=x.useState(""),[o,r]=x.useState(["threads:read","source:map"]),[m,v]=x.useState(""),[y,w]=x.useState(!1),[i,k]=x.useState(""),b=R({mutationFn:()=>T.mintMcpToken({name:a.trim(),...d?{site:d}:{},scopes:o,...m?{expiresInDays:Number(m)}:{},...y?{allowRemoteWrites:!0}:{}})}),t=(s,h)=>r(P=>h?[...new Set([...P,s])]:P.filter(q=>q!==s)),p=async s=>{s.preventDefault(),k("");try{const h=await b.mutateAsync();u(""),j(""),r(["threads:read","source:map"]),v(""),w(!1),l(!1),c(h)}catch(h){k(h instanceof Q?h.message:"Could not reach the server.")}};return e.jsx(O,{open:n,onOpenChange:l,children:e.jsx(_,{children:e.jsxs("form",{onSubmit:s=>void p(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(F,{children:[e.jsx(B,{children:"New agent token"}),e.jsx($,{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."})]}),i&&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:i}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"mcp-name",children:"Name"}),e.jsx(G,{id:"mcp-name",placeholder:"Claude Code",value:a,onChange:s=>u(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(S,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:d,onChange:s=>j(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"}),g.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"}),K.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:o.includes(s.scope),onChange:h=>t(s.scope,h.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&&(o.includes("comments:write")||o.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:y,onChange:s=>w(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(S,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:m,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(I,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:b.isPending,disabled:!a.trim()||o.length===0,children:b.isPending?"Minting…":"Create token"})]})]})})})}function X({state:n,http:l,onClose:g}){const f=typeof location<"u"?location.origin:"",c={SNAGSET_MCP_TOKEN:n?.secret??"",SNAGSET_MCP_HOST:f,...n?.token.site?{SNAGSET_MCP_PROJECT:n.token.site.uid}:{}},a=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:c}}},null,2),u=["claude mcp add snagset",...Object.entries(c).map(([r,m])=>`-e ${r}=${m}`),"--","npx -y @snagset/mcp"].join(" "),d=`Bearer ${n?.secret??""}`,j=["claude mcp add","--transport http","snagset",l?.url??"",`--header "Authorization: ${d}"`].join(" "),o=JSON.stringify({mcpServers:{snagset:{type:"http",url:l?.url??"",headers:{Authorization:d}}}},null,2);return e.jsx(O,{open:n!==null,onOpenChange:r=>!r&&g(),children:e.jsxs(_,{className:"sm:max-w-xl",children:[e.jsxs(F,{children:[e.jsxs(B,{children:["Token for “",n?.token.name??"","”"]}),e.jsx($,{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."})]}),n&&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:n.secret}),e.jsx(C,{text:n.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(C,{text:u,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:u})]}),l?.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(C,{text:o,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:j}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:o}),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(C,{text:a,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:a}),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(I,{children:e.jsx(N,{type:"button",onClick:g,children:"Done"})})]})})}export{ce as M};
@@ -1 +1 @@
1
- import{r,j as e,aW as o}from"./index-COORBw3J.js";function l({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{l as S};
1
+ import{r,j as e,b1 as o}from"./index-p-qD6BlY.js";function l({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{l as S};