@vite-hub/comments 0.3.1 → 0.5.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 (67) hide show
  1. package/README.md +37 -15
  2. package/dist/anchor.d.ts +2 -2
  3. package/dist/{client-diagnostics-CcFpkbAk.js → client-diagnostics-Bubm7Shd.js} +20 -5
  4. package/dist/client-files-CJZl5Kc4.js +53 -0
  5. package/dist/client.d.ts +567 -13
  6. package/dist/client.js +1209 -34
  7. package/dist/{console-h4KlhIik.d.ts → console-D1lwNMZn.d.ts} +2 -0
  8. package/dist/{migrate-BDQ8xqUs.js → database-6hXRnqDE.js} +47 -2
  9. package/dist/database-CTo7mx6t.d.ts +575 -0
  10. package/dist/database.d.ts +2 -1
  11. package/dist/database.js +2 -2
  12. package/dist/{define-43mMR39K.js → define-BMBSVbD9.js} +1 -1
  13. package/dist/{define-B3TF9zzn.d.ts → define-CmIFU96x.d.ts} +8 -4
  14. package/dist/{errors-4gelGVmK.js → errors-BJTZ9iyv.js} +24 -0
  15. package/dist/{errors-C6qptPoG.js → errors-Dq4AHjza.js} +23 -3
  16. package/dist/index-RiHzmV16.d.ts +194 -0
  17. package/dist/index.d.ts +6 -7
  18. package/dist/index.js +57 -9
  19. package/dist/{install-W9ghhGoh.d.ts → install-BGGQKbQ4.d.ts} +9 -3
  20. package/dist/{install-BcMPgPk_.js → install-DrAse1Fa.js} +912 -60
  21. package/dist/{installed-B-PfERBU.js → installed-C3EoqJEY.js} +7 -6
  22. package/dist/{operations-GLeOqgMt.d.ts → operations-BKhUWYkb.d.ts} +10 -5
  23. package/dist/{operations-D4A1Fcgf.d.ts → operations-VyyNZusz.d.ts} +13 -2
  24. package/dist/{operations-DMMIfYPW.js → operations-lsVKE0GH.js} +312 -219
  25. package/dist/operations.d.ts +2 -2
  26. package/dist/operations.js +2 -2
  27. package/dist/overlay/client-DBmJ4C1M.js +4 -0
  28. package/dist/overlay/overlay.js +41 -65
  29. package/dist/page/loader.js +39 -47
  30. package/dist/{page-DtbMOEMd.d.ts → page-Bzj0CszG.d.ts} +1 -10
  31. package/dist/{page-B41ozN63.js → page-DRz_sDY4.js} +1 -1
  32. package/dist/{page-tools-shared-NHUjKI8E.js → page-tools-shared-BNnuPK93.js} +6 -3
  33. package/dist/{plugin-PS8PMYus.js → plugin-DRsNaJaK.js} +34 -8
  34. package/dist/realtime.d.ts +2 -2
  35. package/dist/realtime.js +2 -2
  36. package/dist/reply-id-P_bSuEng.js +12 -0
  37. package/dist/request-log-Dj9Vw7qG.js +105 -0
  38. package/dist/request-origin-CFU0TQ7E.js +49 -0
  39. package/dist/{rpc-RKPAusHp.js → rpc-BQqYx8kb.js} +23 -7
  40. package/dist/{rpc-HBcWtg0T.d.ts → rpc-CuJ5GLIz.d.ts} +1 -1
  41. package/dist/rpc.d.ts +1 -1
  42. package/dist/rpc.js +1 -1
  43. package/dist/runtime/auth.d.ts +2 -2
  44. package/dist/runtime/auth.js +2 -2
  45. package/dist/runtime/console.d.ts +1 -1
  46. package/dist/runtime/console.js +3 -3
  47. package/dist/runtime/index.d.ts +42 -13
  48. package/dist/runtime/index.js +224 -22
  49. package/dist/{server-D8k-0GXe.js → server-Yk610niJ.js} +1 -1
  50. package/dist/server.d.ts +6 -5
  51. package/dist/server.js +6 -6
  52. package/dist/service-Bj-Mg63c.d.ts +73 -0
  53. package/dist/{service-GHhhyQj4.js → service-DA5BwfPQ.js} +71 -14
  54. package/dist/{session-DVx-1Tym.d.ts → session-DUcEor2W.d.ts} +3 -3
  55. package/dist/{session-EkudzUmm.js → session-X_g9dnU5.js} +27 -30
  56. package/dist/{service-CFVm23k7.d.ts → store-CsUNfC1w.d.ts} +11 -72
  57. package/dist/table-names-B9LlRC0B.js +16 -0
  58. package/dist/testing.d.ts +1 -1
  59. package/dist/testing.js +38 -5
  60. package/dist/{types-CZujrMFd.d.ts → types-BLaYh0_f.d.ts} +48 -4
  61. package/dist/{types-BIS0hCEl.d.ts → types-C35INXIs.d.ts} +88 -4
  62. package/dist/vite.d.ts +24 -7
  63. package/dist/vite.js +322 -173
  64. package/package.json +9 -9
  65. package/dist/errors-CyQyKAvy.d.ts +0 -185
  66. package/dist/index-DNhy69Wt.d.ts +0 -83
  67. package/dist/overlay/client-DmsSMOzi.js +0 -4
@@ -1,4 +1,4 @@
1
- import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-D8k-0GXe.js";
1
+ import { r as hasCommentsRuntime, t as commentsRuntime } from "./server-Yk610niJ.js";
2
2
  //#region src/installed.ts
3
3
  /** The runtime that `installComments()` connected to each definition. */
4
4
  const runtimes = /* @__PURE__ */ new WeakMap();
@@ -18,13 +18,14 @@ async function runtimeOf(comments) {
18
18
  const built = await commentsRuntime().catch(() => void 0);
19
19
  return built?.definition === comments.options ? built : void 0;
20
20
  }
21
- /** The runtime that `installComments()` connected, for the overlay API and the MCP tools. */
22
- function commentsRuntimeOf(comments) {
23
- return runtimes.get(comments)?.runtime;
24
- }
25
21
  /** The runtime of a definition, or the one that the generated Nitro plugin builds on first use, for the overlay API. */
26
22
  async function resolveCommentsRuntime(comments) {
27
23
  return runtimeOf(comments);
28
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
+ }
29
30
  //#endregion
30
- export { runtimeOf as a, runtimeBuilds as i, pendingKey as n, runtimes as o, resolveCommentsRuntime as r, commentsRuntimeOf as t };
31
+ export { runtimeOf as a, runtimeBuilds as i, pendingKey as n, runtimes as o, resolveCommentsRuntime as r, commentSendOf as t };
@@ -1,7 +1,7 @@
1
- import { C as CommentUploadInput, S as CommentThread, T as CommentUsersInput, b as CommentStatusInput, c as CommentCreateInput, g as CommentMessage, h as CommentListQuery, i as CommentAttachment, l as CommentDeleteInput, n as CommentActor, p as CommentGetInput, s as CommentContext, u as CommentEditInput, v as CommentReplyInput, w as CommentUser } from "./types-CZujrMFd.js";
2
- import { f as CommentsPolicyGate, g as CommentsUser } from "./define-B3TF9zzn.js";
3
- import { i as CommentsRuntime, t as CommentsAttachmentBody } from "./service-CFVm23k7.js";
4
- import { t as AnyOperation } from "./operations-D4A1Fcgf.js";
1
+ 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-BLaYh0_f.js";
2
+ import { f as CommentsPolicyGate, g as CommentsUser } from "./define-CmIFU96x.js";
3
+ import { i as CommentsRuntime, t as CommentsAttachmentBody } from "./service-Bj-Mg63c.js";
4
+ import { t as AnyOperation } from "./operations-VyyNZusz.js";
5
5
  import * as v from "valibot";
6
6
  //#region src/operations-core/operations.d.ts
7
7
  declare const anchor: v.UnionSchema<[v.StrictObjectSchema<{
@@ -167,7 +167,7 @@ declare const commentInputSchemas: {
167
167
  readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
168
168
  }, undefined>;
169
169
  readonly get: v.UnionSchema<[v.StrictObjectSchema<{
170
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
170
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
171
171
  }, undefined>, v.StrictObjectSchema<{
172
172
  readonly n: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
173
173
  readonly scope: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
@@ -195,6 +195,7 @@ declare const commentInputSchemas: {
195
195
  readonly attachments: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 500, undefined>]>, undefined>, v.MaxLengthAction<string[], 10, undefined>]>, undefined>;
196
196
  readonly body: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 10000, undefined>]>;
197
197
  readonly mentions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>, undefined>, v.MaxLengthAction<string[], 20, undefined>]>, undefined>;
198
+ readonly requestId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
198
199
  readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 100, undefined>]>;
199
200
  }, undefined>;
200
201
  readonly status: v.StrictObjectSchema<{
@@ -241,6 +242,10 @@ declare const commentActions: {
241
242
  edit(input: CommentEditInput, who: CommentsCaller): Promise<CommentThread>;
242
243
  delete(input: CommentDeleteInput, who: CommentsCaller): Promise<CommentThread | null>;
243
244
  setStatus(input: CommentStatusInput, who: CommentsCaller, status: "open" | "resolved"): Promise<CommentThread>;
245
+ resolveThreads(input: readonly {
246
+ threadId: string;
247
+ reply?: string;
248
+ }[], who: CommentsCaller): Promise<CommentThread[]>;
244
249
  /** `minimum`: the shortest query that gets suggestions. The operations ask for two characters. */
245
250
  users(input: CommentUsersInput, who: CommentsCaller, options?: {
246
251
  minimum?: number;
@@ -28,6 +28,11 @@ interface OperationAccess {
28
28
  */
29
29
  readonly sections: "all" | readonly string[];
30
30
  readonly user?: OperationUser;
31
+ /**
32
+ * Who signed the call: `"console"` when the ViteHub Console signed it for a person, whose `user` is then a Console
33
+ * account and not an app user, or `"cli"` for a key. Not set for other calls.
34
+ */
35
+ readonly via?: "console" | "cli";
31
36
  }
32
37
  interface OperationContext {
33
38
  /** The checked Console access of the call. */
@@ -39,6 +44,11 @@ interface OperationContext {
39
44
  surface: "console" | "cli" | "mcp" | "agent";
40
45
  /** Set by the host from generated build identity, never from request input or runtime NODE_ENV. */
41
46
  development?: boolean;
47
+ /**
48
+ * The project root of a development server, for operations that read build files, such as `bundle.report`. Hosts set
49
+ * it only with `development`, so a deployed server never reads project files through it.
50
+ */
51
+ projectRoot?: string;
42
52
  env?: Record<string, unknown>;
43
53
  waitUntil?: (task: Promise<unknown>) => void;
44
54
  request?: Request;
@@ -85,7 +95,8 @@ interface OperationDefinition<Input, Output> {
85
95
  /** Standard Schema (valibot in this repo). Its Standard JSON Schema builds CLI flags and the MCP input schema. */
86
96
  input: StandardSchemaV1<unknown, Input>;
87
97
  output?: StandardSchemaV1<unknown, Output>;
88
- cli?: {
98
+ /** `false`: no `vitehub` command. The Console and MCP still call the operation. */
99
+ cli?: false | {
89
100
  /** Defaults: namespace = section, command = verb. */
90
101
  namespace?: string;
91
102
  /** A space groups commands: `jobs list` and `jobs show` run as `vitehub <namespace> jobs list` and `jobs show`. */
@@ -126,7 +137,7 @@ interface OperationDefinition<Input, Output> {
126
137
  /** An operation of any input and output, as a registry holds it. */
127
138
  interface AnyOperation extends Omit<OperationDefinition<unknown, unknown>, "cli" | "input" | "mcp" | "output" | "readOnlyWhen" | "run" | "scope" | "section"> {
128
139
  readOnlyWhen?: (input: never) => boolean;
129
- cli?: {
140
+ cli?: false | {
130
141
  namespace?: string;
131
142
  command?: string;
132
143
  default?: boolean;