@vite-hub/comments 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +8 -12
  2. package/dist/anchor.d.ts +1 -1
  3. package/dist/{client-diagnostics-D987sEK7.js → client-diagnostics-DoXqdnBd.js} +8 -0
  4. package/dist/client-request-B1DCz3a9.js +29 -0
  5. package/dist/client.d.ts +48 -223
  6. package/dist/client.js +232 -569
  7. package/dist/database.d.ts +1 -2
  8. package/dist/database.js +1 -1
  9. package/dist/{define-C2tnAtBU.js → define-C-LUOouq.js} +1 -1
  10. package/dist/{errors-C0VwRHiy.js → errors-C5utwZ5H.js} +0 -24
  11. package/dist/{errors-ByCRdInk.js → errors-DeSEHzRf.js} +1 -13
  12. package/dist/hosted/hosted-comments/frame.js +4 -1
  13. package/dist/hosted/hosted-comments/tools.js +362 -0
  14. package/dist/hosted/hosted-comments.js +1 -19
  15. package/dist/{index-D1T7RJ4R.d.ts → index-d6NsDxu9.d.ts} +4 -112
  16. package/dist/index.d.ts +4 -5
  17. package/dist/index.js +6 -20
  18. package/dist/{install-D6hXZaSN.js → install-BueV_fJY.js} +22 -780
  19. package/dist/{install-9L4ASzUC.d.ts → install-F-_O7zDr.d.ts} +5 -11
  20. package/dist/{installed-bPUnazFf.js → installed-BqQKo6WC.js} +2 -7
  21. package/dist/{database-Cguz3hZL.js → migrate-oseJAYbm.js} +2 -46
  22. package/dist/{operations-B1ALn4VS.js → operations-0llC5kKO.js} +49 -51
  23. package/dist/{operations-8hqTi0DH.d.ts → operations-DFLer1fR.d.ts} +1 -0
  24. package/dist/{operations-BkkrI8a3.d.ts → operations-jaihyWw2.d.ts} +36 -4
  25. package/dist/operations.d.ts +3 -3
  26. package/dist/operations.js +2 -2
  27. package/dist/overlay/client-ZBsUybIe.js +4 -0
  28. package/dist/overlay/overlay.js +68 -37
  29. package/dist/page/loader.js +36 -30
  30. package/dist/page-BgvzzsJb.d.ts +32 -0
  31. package/dist/{page-2NzFladc.js → page-CDhmXO-y.js} +24 -1
  32. package/dist/{page-tools-shared-fvmJQCrP.js → page-tools-shared-BCdvqA4S.js} +41 -6
  33. package/dist/{plugin-l4sPt5-n.js → plugin-DGUqlc3C.js} +9 -9
  34. package/dist/realtime.d.ts +10 -9
  35. package/dist/realtime.js +2 -4
  36. package/dist/{rpc-BYmbVkr8.js → rpc-kkxzQ3Qy.js} +1 -1
  37. package/dist/rpc.js +1 -1
  38. package/dist/runtime/auth.d.ts +1 -2
  39. package/dist/runtime/auth.js +1 -1
  40. package/dist/runtime/client-request-plugin.d.ts +2 -0
  41. package/dist/runtime/client-request-plugin.js +21 -0
  42. package/dist/runtime/console.js +2 -2
  43. package/dist/runtime/index.d.ts +6 -8
  44. package/dist/runtime/index.js +25 -153
  45. package/dist/{server-DvSehkPP.js → server-CAMs6viR.js} +1 -1
  46. package/dist/server.d.ts +11 -7
  47. package/dist/server.js +8 -7
  48. package/dist/{store-DvNTDNgn.d.ts → service-CMVA_Ryv.d.ts} +67 -1
  49. package/dist/{service-BIGe1Hpo.js → service-DaMq8TBw.js} +35 -33
  50. package/dist/{session-CCRLR9bf.js → session-B7GDrqsK.js} +207 -41
  51. package/dist/{session-CN4irEqf.d.ts → session-EzQqBeE8.d.ts} +2 -3
  52. package/dist/{table-names-BIHjuEFK.js → table-names-DUmWROM4.js} +1 -3
  53. package/dist/testing.js +1 -1
  54. package/dist/{define-B1jLSPe9.d.ts → types-qzJKgWYS.d.ts} +157 -4
  55. package/dist/vite.d.ts +3 -20
  56. package/dist/vite.js +20 -52
  57. package/package.json +9 -8
  58. package/dist/database-CPua6Q6_.d.ts +0 -573
  59. package/dist/hosted/hosted-comments/client-Czl2zu9P.js +0 -4
  60. package/dist/hosted/hosted-comments/dist-DyVmH21U.js +0 -14
  61. package/dist/hosted/hosted-comments/overlay-DpS0P-nd.js +0 -186
  62. package/dist/hosted/hosted-comments/protocol-DuB0Zhs-.js +0 -1
  63. package/dist/hosted/hosted-comments/rest-transport-CKZG_jZ4.js +0 -1
  64. package/dist/hosted/hosted-comments/tools-D8xg-kDW.js +0 -126
  65. package/dist/overlay/client-C7ftI-CB.js +0 -4
  66. package/dist/overlay/dist-yIZmvSaU.js +0 -1
  67. package/dist/page-DE71P_gQ.d.ts +0 -11
  68. package/dist/request-origin-YPzfE2eh.js +0 -48
  69. package/dist/service-IvgrI4XM.d.ts +0 -71
  70. package/dist/types-l6GOb_yc.d.ts +0 -206
@@ -1,11 +1,9 @@
1
1
  import { T as CommentThread } from "./types-BX3vH18p.js";
2
2
  import { o as commentsSchema } from "./database-DUs3c2al.js";
3
- import { i as CommentsRuntime, n as CommentsAttachmentStore, o as SharedRateLimit } from "./service-IvgrI4XM.js";
4
- import { c as CommentSendWebhooks, t as Comments } from "./index-D1T7RJ4R.js";
5
- import { d as CommentsPeople } from "./define-B1jLSPe9.js";
6
- import { r as CommentsTables, t as CommentsDatabase } from "./store-DvNTDNgn.js";
3
+ import { c as CommentsTables, i as CommentsRuntime, n as CommentsAttachmentStore, o as CommentsDatabase, u as SharedRateLimit } from "./service-CMVA_Ryv.js";
4
+ import { t as Comments } from "./index-d6NsDxu9.js";
5
+ import { T as CommentsPeople } from "./types-qzJKgWYS.js";
7
6
  import { r as CommentsSchemaOwner } from "./migrate-XjFeQppf.js";
8
- import "./types-l6GOb_yc.js";
9
7
  /** Options of `tenantCommentsStore()`. */
10
8
  interface TenantCommentsStoreOptions {
11
9
  /** The stored scope of every thread of the tenant, such as a project id. */
@@ -35,14 +33,10 @@ interface InstallCommentsOptions {
35
33
  schema?: CommentsSchemaOwner;
36
34
  /** The SQL dialect of `database`. Default `sqlite`: SQLite, libSQL, and D1. */
37
35
  dialect?: "sqlite" | "postgresql";
38
- /**
39
- * Loads `@vite-hub/webhooks`, for `defineComments({ send })`. The generated plugin passes it when `send` is on.
40
- * Without it, the Send routes answer `COMMENTS_SEND_OFF`.
41
- */
42
- webhooks?: () => Promise<CommentSendWebhooks>;
43
36
  /**
44
37
  * Loads `@vite-hub/comments/realtime`, when the app has the page presence rooms. After each change of a thread, it
45
- * tells the open pages of the thread to load their threads again. The generated plugin passes it.
38
+ * tells the open pages of the thread to load their threads again. The generated plugin passes it. With `tenant`, pass
39
+ * a notifier whose rooms belong to the tenant, such as the rooms of `hostedCommentNoticeRoom()`.
46
40
  */
47
41
  realtime?: () => Promise<{
48
42
  notifyCommentsChange: (thread: CommentThread) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-DvSehkPP.js";
1
+ import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-CAMs6viR.js";
2
2
  // src/installed.ts
3
3
  /** The runtime that `installComments()` connected to each definition. */
4
4
  const runtimes = /* @__PURE__ */ new WeakMap();
@@ -22,9 +22,4 @@ async function runtimeOf(comments) {
22
22
  async function resolveCommentsRuntime(comments) {
23
23
  return runtimeOf(comments);
24
24
  }
25
- /** The Send service of a definition, after the runtime is built. Undefined while Send is off. */
26
- async function commentSendOf(comments) {
27
- await runtimeOf(comments);
28
- return runtimes.get(comments)?.send;
29
- }
30
- export { runtimeOf as a, runtimeBuilds as i, pendingKey as n, runtimes as o, resolveCommentsRuntime as r, commentSendOf as t };
25
+ export { runtimes as a, runtimeOf as i, resolveCommentsRuntime as n, runtimeBuilds as r, pendingKey as t };
@@ -1,4 +1,4 @@
1
- import { t as commentsErrorDiagnostics } from "./errors-ByCRdInk.js";
1
+ import { t as commentsErrorDiagnostics } from "./errors-DeSEHzRf.js";
2
2
  import { sql } from "drizzle-orm";
3
3
  import { index, integer, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core";
4
4
  // src/operations-core/database.ts
@@ -299,48 +299,4 @@ function commentsSchemaGate(db, owner, options = {}) {
299
299
  return ready;
300
300
  };
301
301
  }
302
- // src/send/database.ts
303
- /**
304
- * One row for each send: the member, the threads it carried with the last message of each, and the read token. `threads`
305
- * holds JSON, `[{ id, message, role }]`, and `sender` the member as Comments knew them when they sent. The token is
306
- * kept as its SHA-256 hash.
307
- */
308
- const commentSends = sqliteTable("vitehub_comment_sends", {
309
- id: text("id").primaryKey(),
310
- member: text("member").notNull(),
311
- subjectKind: text("subject_kind").notNull(),
312
- subjectId: text("subject_id").notNull(),
313
- page: text("page").notNull(),
314
- threads: text("threads").notNull(),
315
- key: text("key").notNull(),
316
- state: text("state", { enum: [
317
- "pending",
318
- "sent",
319
- "working",
320
- "done",
321
- "failed"
322
- ] }).notNull(),
323
- delivery: text("delivery"),
324
- endpoint: text("endpoint"),
325
- thread: text("thread"),
326
- error: text("error"),
327
- sender: text("sender").notNull(),
328
- tokenHash: text("token_hash"),
329
- tokenExpiresAt: integer("token_expires_at"),
330
- createdAt: integer("created_at").notNull(),
331
- updatedAt: integer("updated_at").notNull()
332
- }, (table) => [
333
- index("vitehub_comment_sends_member").on(table.member, table.createdAt),
334
- index("vitehub_comment_sends_subject").on(table.subjectKind, table.subjectId, table.createdAt),
335
- uniqueIndex("vitehub_comment_sends_live_key").on(table.key).where(sql`${table.state} <> 'failed'`)
336
- ]);
337
- /** The tables of Send, for a Database contribution. Comments adds them only when `defineComments({ send })` is on. */
338
- const commentSendsSchema = { commentSends };
339
- /** `commentSendsSchema` as SQLite statements that are safe to run on every start. */
340
- const commentSendsTables = [
341
- "CREATE TABLE IF NOT EXISTS `vitehub_comment_sends` (`id` text PRIMARY KEY NOT NULL, `member` text NOT NULL, `subject_kind` text NOT NULL, `subject_id` text NOT NULL, `page` text NOT NULL, `threads` text NOT NULL, `key` text NOT NULL, `state` text NOT NULL, `delivery` text, `endpoint` text, `thread` text, `error` text, `sender` text NOT NULL, `token_hash` text, `token_expires_at` integer, `created_at` integer NOT NULL, `updated_at` integer NOT NULL)",
342
- "CREATE INDEX IF NOT EXISTS `vitehub_comment_sends_member` ON `vitehub_comment_sends` (`member`,`created_at`)",
343
- "CREATE INDEX IF NOT EXISTS `vitehub_comment_sends_subject` ON `vitehub_comment_sends` (`subject_kind`,`subject_id`,`created_at`)",
344
- "CREATE UNIQUE INDEX IF NOT EXISTS `vitehub_comment_sends_live_key` ON `vitehub_comment_sends` (`key`) WHERE `state` <> 'failed'"
345
- ];
346
- export { commentsSchemaGate as a, migrateComments as c, commentForge as d, commentMessages as f, commentsSqliteTables as h, commentsMigrationSql as i, commentsTables as l, commentsSchema as m, commentSendsSchema as n, commentsSchemaState as o, commentThreads as p, commentSendsTables as r, liveThreadsBackup as s, commentSends as t, commentCounters as u };
302
+ export { migrateComments as a, commentForge as c, commentsSchema as d, commentsSqliteTables as f, liveThreadsBackup as i, commentMessages as l, commentsSchemaGate as n, commentsTables as o, commentsSchemaState as r, commentCounters as s, commentsMigrationSql as t, commentThreads as u };
@@ -1,11 +1,11 @@
1
1
  import { n as outboxAccountHeader } from "./client-files-lC6X7XyS.js";
2
- import { t as commentsErrorDiagnostics } from "./errors-ByCRdInk.js";
3
2
  import { n as pagePathOf, t as isPagePath } from "./path-8yqMd8zR.js";
4
3
  import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
5
- import { C as threadChanged, E as createClientRateLimit, S as suggest, _ as requestIdSchema, a as createThread, c as earlierThread, d as maximumAttachmentBytes, f as maximumCommentBodyLength, g as replyToThread, h as readAttachment, l as editMessage, m as personOf, n as base64, o as deniedError, r as can, s as earlierReply, t as attachmentThread, u as fail, v as retried, w as clientAddressKey, x as storeAttachment, y as retriedReply } from "./service-BIGe1Hpo.js";
4
+ import { t as commentsErrorDiagnostics } from "./errors-DeSEHzRf.js";
5
+ import { C as threadChanged, E as createClientRateLimit, S as suggest, _ as requestIdSchema, a as createThread, c as earlierThread, d as maximumAttachmentBytes, f as maximumCommentBodyLength, g as replyToThread, h as readAttachment, l as editMessage, m as personOf, n as base64, o as deniedError, r as can, s as earlierReply, t as attachmentThread, u as fail, v as retried, w as clientAddressKey, x as storeAttachment, y as retriedReply } from "./service-DaMq8TBw.js";
6
6
  import { n as guestFromHeaders, t as authorOf } from "./identity-CT7-UGmS.js";
7
7
  import { t as describeCommentContext } from "./context-DbkBjITZ.js";
8
- import { t as commentsRuntime } from "./server-DvSehkPP.js";
8
+ import { t as commentsRuntime } from "./server-CAMs6viR.js";
9
9
  import { defineDiagnostics } from "nostics";
10
10
  import { toJsonSchema } from "@valibot/to-json-schema";
11
11
  import { getStandardContext } from "@vite-hub/runtime/internal/h3";
@@ -40,7 +40,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
40
40
  why: ({ message }) => message === void 0 ? "" : String(message)
41
41
  },
42
42
  INTERNAL_R0024: {
43
- fix: "Start the dev server with `vite dev`, or pass `--url <origin>` of a deployed app and set VITEHUB_CONSOLE_PRIVATE_KEY_<NAME> to a private key whose public key the app has in VITEHUB_CONSOLE_KEY_<NAME>.",
43
+ fix: "Start the dev server (`nuxt dev` or `vite dev`), or pass `--url <origin>` of a deployed app and set VITEHUB_CONSOLE_PRIVATE_KEY_<NAME> to a private key whose public key the app has in VITEHUB_CONSOLE_KEY_<NAME>.",
44
44
  why: ({ message }) => message === void 0 ? "" : String(message)
45
45
  },
46
46
  INTERNAL_R0023: {
@@ -156,7 +156,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
156
156
  fix: "Give a switch column `format: \"switch\"` and `switch: { operation, input }` with a registered operation name, or remove both."
157
157
  },
158
158
  INTERNAL_R0025: {
159
- fix: "Start `vite dev` in the project that you run the command from, or pass `--url` of that server.",
159
+ fix: "Start the dev server (`nuxt dev` or `vite dev`) in the project that you run the command from, or pass `--url` of that server.",
160
160
  why: ({ message }) => message === void 0 ? "" : String(message)
161
161
  },
162
162
  INTERNAL_R0026: {
@@ -177,7 +177,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
177
177
  },
178
178
  INTERNAL_R0002: {
179
179
  ...dynamicError,
180
- fix: "Stop using the feature that the message names, or set `host` in `vitehub()` to a host that provides it. For Blob, you can also set `blob: { driver: \"s3\" }` with a remote store."
180
+ fix: ({ fix }) => fix ?? "Build for a host that provides this capability, or set the option named in the message to `false`."
181
181
  },
182
182
  INTERNAL_R0004: {
183
183
  ...dynamicError,
@@ -415,7 +415,6 @@ function isSectionId(section) {
415
415
  function operationInputJsonSchema(operation) {
416
416
  return standardJsonSchema(operation.input, "input") ?? { type: "object" };
417
417
  }
418
- /** `"blob:media"` → `["blob:media", "blob"]`: a grant of the section covers each of its scopes. */
419
418
  function grantsFor(section) {
420
419
  const separator = section.indexOf(":");
421
420
  return separator === -1 ? [section] : [section, section.slice(0, separator)];
@@ -825,12 +824,54 @@ async function readableThreads(input, who) {
825
824
  hidden
826
825
  };
827
826
  }
827
+ const resolveNext = "After you make the change that a thread asks for, resolve it with comments.resolve and a reply that says what changed, such as the commit or a link. Resolve every thread that you handled in one call: { threads: [{ threadId, reply }] }. Open threads stay on the page.";
828
+ /** Threads that one search reads from the store at a time. */
829
+ const searchBatch = maximumLimit;
828
830
  /**
829
831
  * The comment actions behind every surface. The operations (RPC, CLI, MCP) and the overlay API call the same
830
832
  * functions, so one policy, one set of checks, and one set of errors serve them all. Each one checks `authorize` for
831
833
  * its caller; the input must have passed `commentInputSchemas`.
832
834
  */
833
835
  const commentActions = {
836
+ async threads(input, who) {
837
+ const status = input.status ?? "open";
838
+ const limit = input.limit ?? 25;
839
+ const search = input.search?.toLowerCase();
840
+ const batch = search ? searchBatch : limit;
841
+ const found = [];
842
+ let hidden = 0;
843
+ let before;
844
+ while (found.length < limit) {
845
+ const listed = await readableThreads({
846
+ limit: batch,
847
+ status,
848
+ subjectKind: "page",
849
+ ...input.page ? { page: input.page } : {},
850
+ ...before ? { before } : {}
851
+ }, who);
852
+ hidden += listed.hidden;
853
+ for (const thread of listed.threads) {
854
+ if (!search || thread.messages.some((message) => message.body.toLowerCase().includes(search))) found.push(thread);
855
+ if (found.length === limit) break;
856
+ }
857
+ if (listed.threads.length < batch) break;
858
+ before = cursorOf(listed.threads.at(-1));
859
+ }
860
+ const note = hiddenThreadsNote(hidden, {
861
+ authorize: Boolean(who.runtime.definition.authorize),
862
+ identify: Boolean(who.runtime.identify),
863
+ user: who.user !== null,
864
+ console: who.console === true
865
+ });
866
+ const next = status === "open" && found.length ? resolveNext : void 0;
867
+ return {
868
+ status,
869
+ threads: found.map(commentThreadSummary),
870
+ hidden,
871
+ ...note ? { note } : {},
872
+ ...next ? { next } : {}
873
+ };
874
+ },
834
875
  async list(input, who) {
835
876
  return (await readableThreads(input, who)).threads;
836
877
  },
@@ -917,7 +958,6 @@ const commentActions = {
917
958
  await allow(who, "resolve", { thread: found });
918
959
  const next = await who.runtime.store.setStatus(found.id, status, author(who), Date.now(), status === "resolved" ? who.actor : void 0);
919
960
  await threadChanged(who.runtime, next);
920
- if (status === "open") await who.runtime.reopened?.(next);
921
961
  return next;
922
962
  },
923
963
  async resolveThreads(input, who) {
@@ -1021,9 +1061,6 @@ const list = defineOperation({
1021
1061
  run: async (input, context) => commentActions.list(input, await caller(context)),
1022
1062
  section: "comments"
1023
1063
  });
1024
- const resolveNext = "After you make the change that a thread asks for, resolve it with comments.resolve and a reply that says what changed, such as the commit or a link. Resolve every thread that you handled in one call: { threads: [{ threadId, reply }] }. Open threads stay on the page.";
1025
- /** Threads that one search reads from the store at a time. */
1026
- const searchBatch = maximumLimit;
1027
1064
  /** The comment operations. The Console, the CLI, MCP, and the comments client call them. */
1028
1065
  const commentsOperations = [
1029
1066
  defineOperation({
@@ -1031,46 +1068,7 @@ const commentsOperations = [
1031
1068
  input: threadsInput,
1032
1069
  kind: "read",
1033
1070
  name: "comments.threads",
1034
- run: async (input, context) => {
1035
- const who = await caller(context);
1036
- const status = input.status ?? "open";
1037
- const limit = input.limit ?? 25;
1038
- const search = input.search?.toLowerCase();
1039
- const batch = search ? searchBatch : limit;
1040
- const found = [];
1041
- let hidden = 0;
1042
- let before;
1043
- while (found.length < limit) {
1044
- const listed = await readableThreads({
1045
- limit: batch,
1046
- status,
1047
- subjectKind: "page",
1048
- ...input.page ? { page: input.page } : {},
1049
- ...before ? { before } : {}
1050
- }, who);
1051
- hidden += listed.hidden;
1052
- for (const thread of listed.threads) {
1053
- if (!search || thread.messages.some((message) => message.body.toLowerCase().includes(search))) found.push(thread);
1054
- if (found.length === limit) break;
1055
- }
1056
- if (listed.threads.length < batch) break;
1057
- before = cursorOf(listed.threads.at(-1));
1058
- }
1059
- const note = hiddenThreadsNote(hidden, {
1060
- authorize: Boolean(who.runtime.definition.authorize),
1061
- identify: Boolean(who.runtime.identify),
1062
- user: who.user !== null,
1063
- console: who.console === true
1064
- });
1065
- const next = status === "open" && found.length ? resolveNext : void 0;
1066
- return {
1067
- status,
1068
- threads: found.map(commentThreadSummary),
1069
- hidden,
1070
- ...note ? { note } : {},
1071
- ...next ? { next } : {}
1072
- };
1073
- },
1071
+ run: async (input, context) => commentActions.threads(input, await caller(context)),
1074
1072
  mcp: {
1075
1073
  format: ({ status, threads, note }) => commentThreadsText(threads, status, note ?? ""),
1076
1074
  title: "List ViteHub Comments threads"
@@ -1,3 +1,4 @@
1
+ import { Diagnostic } from "nostics";
1
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
2
3
  /** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
3
4
  type OperationKind = "read" | "write" | "destructive";
@@ -1,8 +1,24 @@
1
- import { i as CommentsRuntime, t as CommentsAttachmentBody } from "./service-IvgrI4XM.js";
2
- import { t as AnyOperation } from "./operations-8hqTi0DH.js";
3
- import { f as CommentsPolicyGate, g as CommentsUser } from "./define-B1jLSPe9.js";
1
+ import { i as CommentsRuntime, t as CommentsAttachmentBody } from "./service-CMVA_Ryv.js";
2
+ import { t as AnyOperation } from "./operations-DFLer1fR.js";
3
+ import { D as CommentsPolicyGate, j as CommentsUser } from "./types-qzJKgWYS.js";
4
4
  import { C as CommentStatusInput, D as CommentUser, E as CommentUploadInput, O as CommentUsersInput, T as CommentThread, c as CommentCreateInput, f as CommentEditInput, g as CommentGetInput, i as CommentAttachment, l as CommentDeleteInput, n as CommentActor, s as CommentContext, v as CommentListQuery, x as CommentReplyInput, y as CommentMessage } from "./types-BX3vH18p.js";
5
5
  import * as v from "valibot";
6
+ /** The fields of a thread in a list, as JSON. */
7
+ interface CommentThreadSummary {
8
+ id: string;
9
+ n: number;
10
+ page: string;
11
+ status: CommentThread["status"];
12
+ /** What the comment points at, in words, such as `"Buy now"`, `the text "per month"`, or `the whole page`. */
13
+ anchor: string;
14
+ comment: string;
15
+ author: string;
16
+ replies: number;
17
+ /** The Vue components that render the element, outermost first. */
18
+ components: string[];
19
+ /** The last activity, in milliseconds since the epoch. */
20
+ updatedAt: number;
21
+ }
6
22
  declare const anchor: v.UnionSchema<[v.StrictObjectSchema<{
7
23
  readonly kind: v.LiteralSchema<"page", undefined>;
8
24
  }, undefined>, v.StrictObjectSchema<{
@@ -80,6 +96,12 @@ interface CommentsCaller {
80
96
  request?: Request;
81
97
  waitUntil?: (task: Promise<unknown>) => void;
82
98
  }
99
+ declare const threadsInput: v.StrictObjectSchema<{
100
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 100, undefined>]>, undefined>;
101
+ readonly page: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DescriptionAction<string, "A path such as /pricing, or a full URL of the page.">, v.TransformAction<string, string>, v.CheckAction<string, "A page is an app path that starts with one \"/\", such as \"/pricing\", without \"?\" or \"#\", or a full http(s) URL of the page.">, v.TransformAction<string, string>]>, undefined>;
102
+ readonly search: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
103
+ readonly status: v.OptionalSchema<v.PicklistSchema<["open", "resolved"], undefined>, undefined>;
104
+ }, undefined>;
83
105
  /** The inputs of the comment actions, for transports that read their input themselves, such as the overlay API. */
84
106
  declare const commentInputSchemas: {
85
107
  readonly attachment: v.StrictObjectSchema<{
@@ -219,12 +241,22 @@ declare const commentInputSchemas: {
219
241
  readonly threadId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>, undefined>;
220
242
  }, undefined>;
221
243
  };
244
+ /** A short list of page threads, for an Agent: `comments.threads`. */
245
+ interface CommentThreadsPage {
246
+ status: "open" | "resolved";
247
+ threads: CommentThreadSummary[];
248
+ /** The threads that `authorize` hid from the caller. */
249
+ hidden: number;
250
+ note?: string;
251
+ next?: string;
252
+ }
222
253
  /**
223
254
  * The comment actions behind every surface. The operations (RPC, CLI, MCP) and the overlay API call the same
224
255
  * functions, so one policy, one set of checks, and one set of errors serve them all. Each one checks `authorize` for
225
256
  * its caller; the input must have passed `commentInputSchemas`.
226
257
  */
227
258
  declare const commentActions: {
259
+ threads(input: v.InferOutput<typeof threadsInput>, who: CommentsCaller): Promise<CommentThreadsPage>;
228
260
  list(input: CommentListQuery, who: CommentsCaller): Promise<CommentThread[]>;
229
261
  get(input: CommentGetInput, who: CommentsCaller): Promise<CommentThread | null>;
230
262
  /** `context` is the page context that the overlay read and its transport checked. */
@@ -257,4 +289,4 @@ declare const commentActions: {
257
289
  };
258
290
  /** The comment operations. The Console, the CLI, MCP, and the comments client call them. */
259
291
  declare const commentsOperations: readonly AnyOperation[];
260
- export { commentsOperations as a, commentInputSchemas as i, commentActions as n, commentAnchorSchema as r, CommentsCaller as t };
292
+ export { commentInputSchemas as a, commentAnchorSchema as i, CommentsCaller as n, commentsOperations as o, commentActions as r, CommentThreadsPage as t };
@@ -1,3 +1,3 @@
1
- import { a as maximumCommentBodyLength } from "./service-IvgrI4XM.js";
2
- import { a as commentsOperations, i as commentInputSchemas, n as commentActions, r as commentAnchorSchema, t as CommentsCaller } from "./operations-BkkrI8a3.js";
3
- export { CommentsCaller, commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, maximumCommentBodyLength };
1
+ import { a as maximumCommentBodyLength } from "./service-CMVA_Ryv.js";
2
+ import { a as commentInputSchemas, i as commentAnchorSchema, n as CommentsCaller, o as commentsOperations, r as commentActions, t as CommentThreadsPage } from "./operations-jaihyWw2.js";
3
+ export { CommentThreadsPage, CommentsCaller, commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, maximumCommentBodyLength };
@@ -1,3 +1,3 @@
1
- import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-B1ALn4VS.js";
2
- import { f as maximumCommentBodyLength } from "./service-BIGe1Hpo.js";
1
+ import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-0llC5kKO.js";
2
+ import { f as maximumCommentBodyLength } from "./service-DaMq8TBw.js";
3
3
  export { commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, maximumCommentBodyLength };