@vite-hub/comments 0.0.0 → 0.1.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 (59) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +243 -0
  3. package/dist/anchor.d.ts +40 -0
  4. package/dist/anchor.js +128 -0
  5. package/dist/client.d.ts +101 -0
  6. package/dist/client.js +553 -0
  7. package/dist/console-BIz9t2cO.d.ts +243 -0
  8. package/dist/database/postgres.d.ts +1011 -0
  9. package/dist/database/postgres.js +60 -0
  10. package/dist/database-BSnVrwHn.js +60 -0
  11. package/dist/database-C-ktS9Do.js +95 -0
  12. package/dist/database-Cb2xjC1V.d.ts +1096 -0
  13. package/dist/database.d.ts +104 -0
  14. package/dist/database.js +3 -0
  15. package/dist/define-BzW2Ychn.d.ts +46 -0
  16. package/dist/define-Cbhl6QVJ.js +32 -0
  17. package/dist/errors-BAQYcy3_.d.ts +89 -0
  18. package/dist/errors-DeD6wTCl.js +77 -0
  19. package/dist/h3-v1-request-DDGXJ9E7.js +166 -0
  20. package/dist/identity-3qtVC4rF.js +34 -0
  21. package/dist/index-DklG2Etf.d.ts +111 -0
  22. package/dist/index.d.ts +7 -0
  23. package/dist/index.js +5 -0
  24. package/dist/operations-0B0QTVWX.d.ts +138 -0
  25. package/dist/operations-NZG5dB8y.js +732 -0
  26. package/dist/operations.d.ts +7 -0
  27. package/dist/operations.js +2 -0
  28. package/dist/overlay/overlay.js +195 -0
  29. package/dist/page/loader.js +22 -0
  30. package/dist/page-BtXADR6d.d.ts +21 -0
  31. package/dist/page-BuroSMXO.js +38 -0
  32. package/dist/page-tools-shared-D-amu6sx.js +53 -0
  33. package/dist/plugin-QElKQYkA.js +725 -0
  34. package/dist/realtime.d.ts +18 -0
  35. package/dist/realtime.js +48 -0
  36. package/dist/request-DVc3M_AG.js +14 -0
  37. package/dist/rpc.d.ts +29 -0
  38. package/dist/rpc.js +75 -0
  39. package/dist/runtime/auth.d.ts +6 -0
  40. package/dist/runtime/auth.js +15 -0
  41. package/dist/runtime/connect/node.d.ts +1 -0
  42. package/dist/runtime/connect/node.js +2 -0
  43. package/dist/runtime/connect.d.ts +1 -0
  44. package/dist/runtime/connect.js +2 -0
  45. package/dist/runtime/console.d.ts +5 -0
  46. package/dist/runtime/console.js +59 -0
  47. package/dist/runtime/index.d.ts +222 -0
  48. package/dist/runtime/index.js +665 -0
  49. package/dist/server-BomGg3Gb.js +63 -0
  50. package/dist/server.d.ts +94 -0
  51. package/dist/server.js +326 -0
  52. package/dist/src-CRTwnaEG.js +1362 -0
  53. package/dist/testing.d.ts +30 -0
  54. package/dist/testing.js +175 -0
  55. package/dist/types-Cj8K7Vx7.d.ts +176 -0
  56. package/dist/types-Un2dcJWD.d.ts +288 -0
  57. package/dist/vite.d.ts +304 -0
  58. package/dist/vite.js +1921 -0
  59. package/package.json +156 -4
@@ -0,0 +1,7 @@
1
+ import { D as ReplyOptions, E as ReplyInput, S as CreateCommentThreadInput, T as ListCommentThreadsOptions, _ as CommentsForgeTarget, a as CommentComponent, b as CommentsPeopleContext, c as CommentForgeLink, d as CommentThread$1, f as CommentThreadStatus, g as CommentsForgeOptions, h as CommentsErrorCode, i as CommentBuild, l as CommentMention, n as CommentAnchor$1, o as CommentContext, p as CommentsAction, r as CommentAuthor, s as CommentCreatedEvent, t as Comment, u as CommentMetadata, v as CommentsGitHubAccess, w as EditCommentInput, x as CommentsUser, y as CommentsIdentifyContext } from "./types-Un2dcJWD.js";
2
+ import { C as TextAnchor, S as PageAnchor, _ as CommentUser, a as CommentDeleteInput, b as ElementAnchor, c as CommentGetInput, d as CommentMessage, f as CommentReplyInput, g as CommentThread, h as CommentSubject, i as CommentCreateInput, m as CommentStatusInput, n as CommentActor, o as CommentEditInput, p as CommentStatus, r as CommentAnchor, s as CommentEvent, t as AreaAnchor, u as CommentListQuery, v as CommentUsersInput, x as ImageAnchor, y as CommentsTransport } from "./types-Cj8K7Vx7.js";
3
+ import { t as commentsErrorDiagnostics } from "./errors-BAQYcy3_.js";
4
+ import { c as defineCommentSubject, i as CommentsAuthorize, n as CommentMentionEvent, o as CommentsDefinition, r as CommentSubjectDefinition, s as builtinCommentSubjects, t as CommentAction } from "./define-BzW2Ychn.js";
5
+ import { a as describeCommentContext, c as DefineCommentsOptions, i as installComments, n as defaultPolicy, r as defineComments, s as CommentsAuthorizeContext, t as Comments } from "./index-DklG2Etf.js";
6
+ import { i as commentsRoute, n as commentsPageScope, o as normalizeCommentPage, r as commentsRealtimeDefinition, t as commentRoom } from "./page-BtXADR6d.js";
7
+ export { type AreaAnchor, type CommentAnchor as ClientCommentAnchor, type CommentThread as ClientCommentThread, type Comment, type CommentAction, type CommentActor, type CommentAnchor$1 as CommentAnchor, type CommentAuthor, type CommentBuild, type CommentComponent, type CommentContext, type CommentCreateInput, type CommentCreatedEvent, type CommentDeleteInput, type CommentEditInput, type CommentEvent, type CommentForgeLink, type CommentGetInput, type CommentListQuery, type CommentMention, type CommentMentionEvent, type CommentMessage, type CommentMetadata, type CommentReplyInput, type CommentStatus, type CommentStatusInput, type CommentSubject, type CommentSubjectDefinition, type CommentThread$1 as CommentThread, type CommentThreadStatus, type CommentUser, type CommentUsersInput, Comments, type CommentsAction, type CommentsAuthorize, type CommentsAuthorizeContext, type CommentsDefinition, type CommentsErrorCode, type CommentsForgeOptions, type CommentsForgeTarget, type CommentsGitHubAccess, type CommentsIdentifyContext, type CommentsPeopleContext, type CommentsTransport, type CommentsUser, type CreateCommentThreadInput, type DefineCommentsOptions, type EditCommentInput, type ElementAnchor, type ImageAnchor, type ListCommentThreadsOptions, type PageAnchor, type ReplyInput, type ReplyOptions, type TextAnchor, builtinCommentSubjects, commentRoom, commentsErrorDiagnostics, commentsPageScope, commentsRealtimeDefinition, commentsRoute, defaultPolicy, defineCommentSubject, defineComments, describeCommentContext, installComments, normalizeCommentPage };
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { t as commentsErrorDiagnostics } from "./errors-DeD6wTCl.js";
2
+ import { n as defineCommentSubject, t as builtinCommentSubjects } from "./define-Cbhl6QVJ.js";
3
+ import { n as defineComments, o as describeCommentContext, r as installComments, t as defaultPolicy } from "./src-CRTwnaEG.js";
4
+ import { i as commentsRoute, n as commentsPageScope, o as normalizeCommentPage, r as commentsRealtimeDefinition, t as commentRoom } from "./page-BuroSMXO.js";
5
+ export { builtinCommentSubjects, commentRoom, commentsErrorDiagnostics, commentsPageScope, commentsRealtimeDefinition, commentsRoute, defaultPolicy, defineCommentSubject, defineComments, describeCommentContext, installComments, normalizeCommentPage };
@@ -0,0 +1,138 @@
1
+ import { StandardSchemaV1 } from "@standard-schema/spec";
2
+ //#region ../internal/src/operations.d.ts
3
+ /** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
4
+ type OperationKind = "read" | "write" | "destructive";
5
+ /** The signed-in user of a call. */
6
+ interface OperationUser {
7
+ id: string;
8
+ name?: string;
9
+ email?: string;
10
+ image?: string;
11
+ [key: string]: unknown;
12
+ }
13
+ /** The Agent Actor when an agent calls through a capability or MCP on behalf of a user. */
14
+ interface OperationActor {
15
+ id: string;
16
+ kind?: string;
17
+ label?: string;
18
+ meta?: object;
19
+ }
20
+ /** The checked Console access of a call. `vite-hub` issues it. `ConsoleAccess` has this shape. */
21
+ interface OperationAccess {
22
+ readonly mode: string;
23
+ /**
24
+ * The sections that the call may use. `"all"` when no section filter applies. An entry is a section id (`"kv"`, every
25
+ * operation of the section) or `"<section>:read"` (only the operations that read).
26
+ */
27
+ readonly sections: "all" | readonly string[];
28
+ readonly user?: OperationUser;
29
+ }
30
+ interface OperationContext {
31
+ /** The checked Console access of the call. */
32
+ access: OperationAccess;
33
+ /** The signed-in user, or null. */
34
+ user: OperationUser | null;
35
+ /** The Agent Actor when an agent calls on behalf of `user`. */
36
+ actor?: OperationActor;
37
+ surface: "console" | "cli" | "mcp" | "agent";
38
+ /** Set by the host from generated build identity, never from request input or runtime NODE_ENV. */
39
+ development?: boolean;
40
+ env?: Record<string, unknown>;
41
+ waitUntil?: (task: Promise<unknown>) => void;
42
+ request?: Request;
43
+ /** Operations set a success status here, such as 202 for an accepted call. */
44
+ response?: {
45
+ status?: number;
46
+ };
47
+ /**
48
+ * An agent or an MCP client may pass `lease: "override"` to `content.save`, `content.remove`, and `content.restore`
49
+ * only when the developer allowed it. Defaults to false, so a model cannot take over a document that a person is editing.
50
+ */
51
+ overrideLeases?: boolean;
52
+ /**
53
+ * What an Agent may read of the Channel conversations, set by `operations({ conversations })`. `participant`: only the
54
+ * threads that the Actor takes part in. `all`: every thread. Unset: none.
55
+ */
56
+ conversations?: "all" | "participant";
57
+ }
58
+ interface OperationDefinition<Input, Output> {
59
+ /** `<section>.<verb>`, such as `content.publish`. Unique per app. */
60
+ name: string;
61
+ /** One sentence. Becomes the CLI help line and the MCP tool description. */
62
+ description: string;
63
+ /**
64
+ * Console section that grants access, such as `content`. `false`: any Console user. A function reads the section
65
+ * from the input, for operations that serve several sections.
66
+ */
67
+ section: string | false | ((input: Input) => string | undefined);
68
+ /** `read` never changes state. `write` changes state. `destructive` deletes or publishes; the CLI asks for `--yes`, MCP marks `destructiveHint`, agents require approval by default. */
69
+ kind: OperationKind;
70
+ /** Standard Schema (valibot in this repo). Its Standard JSON Schema builds CLI flags and the MCP input schema. */
71
+ input: StandardSchemaV1<unknown, Input>;
72
+ output?: StandardSchemaV1<unknown, Output>;
73
+ cli?: {
74
+ /** Defaults: namespace = section, command = verb. */
75
+ namespace?: string;
76
+ command?: string;
77
+ /** Input keys read from positional arguments, in order. */
78
+ positional?: string[];
79
+ /** Human output, written verbatim. Without it the CLI prints JSON. `--json` always prints JSON. */
80
+ format?: (output: Output) => string;
81
+ /** `vitehub <namespace>` runs this command when no command is named, such as `vitehub usage`. */
82
+ default?: boolean;
83
+ /**
84
+ * Route of the app that takes a signed dispatch of this operation, such as `/_vitehub/schedules/run`. With `--url`
85
+ * and a dispatch key in the environment (`VITEHUB_DISPATCH_KEY`), the command signs the input and posts it there, so
86
+ * a CI job needs no Console credentials. Without a key it calls the RPC.
87
+ */
88
+ dispatch?: string;
89
+ };
90
+ /** Largest request body in bytes. It can raise the 64 KiB default but not lower it. */
91
+ maxRequestBytes?: number;
92
+ /**
93
+ * Returns true when this call only reads, such as a dry run of a `destructive` operation. The CLI then skips the
94
+ * confirmation, and agents run it without approval. Without it, every call of a `destructive` operation asks.
95
+ */
96
+ readOnlyWhen?: (input: Input) => boolean;
97
+ /** `false`: MCP does not offer the operation as a tool, such as an editor transport that only the Console uses. */
98
+ mcp?: false;
99
+ /** `false`: the operation never reads `context.user`, so the Console skips the session lookup for it. */
100
+ user?: false;
101
+ /**
102
+ * The operation runs code of the app, such as a workflow, a job, a task, or a schedule. The Console registers it only
103
+ * when `console.invoke` is on, which is the default in development and off in a production build.
104
+ */
105
+ invoke?: true;
106
+ run: (input: Input, context: OperationContext) => Output | Promise<Output>;
107
+ }
108
+ /** An operation of any input and output, as a registry holds it. */
109
+ interface AnyOperation extends Omit<OperationDefinition<unknown, unknown>, "cli" | "input" | "output" | "readOnlyWhen" | "run" | "section"> {
110
+ readOnlyWhen?: (input: never) => boolean;
111
+ cli?: {
112
+ namespace?: string;
113
+ command?: string;
114
+ default?: boolean;
115
+ dispatch?: string;
116
+ positional?: string[];
117
+ format?: (output: never) => string;
118
+ };
119
+ input: StandardSchemaV1;
120
+ output?: StandardSchemaV1;
121
+ run: (input: never, context: OperationContext) => unknown;
122
+ section: string | false | ((input: never) => string | undefined);
123
+ }
124
+ /** The contribution of one plugin: operations, or a module that exports them. */
125
+ interface OperationContributionEntry {
126
+ /** Module the app imports, such as `@vite-hub/content/operations`. */
127
+ module: string;
128
+ /** Named export that holds an operation or an array of operations. Defaults to `default`. */
129
+ export?: string;
130
+ /** Loads the export in the tool process, for a module that the tool cannot resolve by name. */
131
+ load?: () => Promise<unknown>;
132
+ /** `false`: the app already has these operations at runtime. Only tools such as the CLI and `vitehub inspect` read the entry. */
133
+ runtime?: false;
134
+ }
135
+ /** The contribution of a plugin: a list, or a function that returns it, for a plugin that reads the project first. */
136
+ type OperationContributions = readonly OperationContributionEntry[] | (() => readonly OperationContributionEntry[] | Promise<readonly OperationContributionEntry[]>);
137
+ //#endregion
138
+ export { OperationContributions as n, AnyOperation as t };