@vite-hub/comments 0.7.0 → 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.
- package/README.md +4 -10
- package/dist/anchor.d.ts +1 -1
- package/dist/client-request-B1DCz3a9.js +29 -0
- package/dist/client.d.ts +20 -240
- package/dist/client.js +3 -421
- package/dist/database.d.ts +1 -2
- package/dist/database.js +1 -1
- package/dist/{define-BqPcuDhf.js → define-C-LUOouq.js} +1 -1
- package/dist/{errors-C0VwRHiy.js → errors-C5utwZ5H.js} +0 -24
- package/dist/{errors-CBvIpwbo.js → errors-DeSEHzRf.js} +0 -12
- package/dist/hosted/hosted-comments/frame.js +4 -1
- package/dist/hosted/hosted-comments/tools.js +65 -74
- package/dist/hosted/hosted-comments.js +1 -1
- package/dist/{index-D1T7RJ4R.d.ts → index-d6NsDxu9.d.ts} +4 -112
- package/dist/index.d.ts +4 -5
- package/dist/index.js +6 -20
- package/dist/{install-CqBWFmU7.js → install-BueV_fJY.js} +7 -771
- package/dist/{install-9L4ASzUC.d.ts → install-F-_O7zDr.d.ts} +5 -11
- package/dist/{installed-wUYjqk_k.js → installed-BqQKo6WC.js} +2 -7
- package/dist/{database-BuSNVwTx.js → migrate-oseJAYbm.js} +2 -46
- package/dist/{operations-kMPw-Cyb.js → operations-0llC5kKO.js} +46 -47
- package/dist/{operations-Qt8ASQqW.d.ts → operations-jaihyWw2.d.ts} +35 -3
- package/dist/operations.d.ts +3 -3
- package/dist/operations.js +2 -2
- package/dist/overlay/client-ZBsUybIe.js +4 -0
- package/dist/overlay/overlay.js +47 -43
- package/dist/page/loader.js +31 -27
- package/dist/page-BgvzzsJb.d.ts +32 -0
- package/dist/{page-2NzFladc.js → page-CDhmXO-y.js} +24 -1
- package/dist/{page-tools-shared-BNw-aWEH.js → page-tools-shared-BCdvqA4S.js} +40 -2
- package/dist/{plugin-ChOHe7vq.js → plugin-DGUqlc3C.js} +9 -9
- package/dist/realtime.d.ts +6 -8
- package/dist/realtime.js +2 -4
- package/dist/runtime/auth.d.ts +1 -2
- package/dist/runtime/auth.js +1 -1
- package/dist/runtime/client-request-plugin.d.ts +2 -0
- package/dist/runtime/client-request-plugin.js +21 -0
- package/dist/runtime/console.js +2 -2
- package/dist/runtime/index.d.ts +5 -8
- package/dist/runtime/index.js +23 -151
- package/dist/{server-8o9u8leM.js → server-CAMs6viR.js} +1 -1
- package/dist/server.d.ts +11 -7
- package/dist/server.js +7 -6
- package/dist/{store-DvNTDNgn.d.ts → service-CMVA_Ryv.d.ts} +67 -1
- package/dist/{service-XT2A8YEF.js → service-DaMq8TBw.js} +35 -33
- package/dist/{session-DGdFKWDB.js → session-B7GDrqsK.js} +204 -39
- package/dist/{session-CN4irEqf.d.ts → session-EzQqBeE8.d.ts} +2 -3
- package/dist/{table-names-BIHjuEFK.js → table-names-DUmWROM4.js} +1 -3
- package/dist/testing.js +1 -1
- package/dist/{define-B1jLSPe9.d.ts → types-qzJKgWYS.d.ts} +157 -4
- package/dist/vite.d.ts +2 -19
- package/dist/vite.js +15 -51
- package/package.json +8 -8
- package/dist/database-CPua6Q6_.d.ts +0 -573
- package/dist/overlay/client-CrnKCZXc.js +0 -4
- package/dist/overlay/dist-yIZmvSaU.js +0 -1
- package/dist/page-DE71P_gQ.d.ts +0 -11
- package/dist/request-origin-B-CPVAVk.js +0 -53
- package/dist/service-IvgrI4XM.d.ts +0 -71
- package/dist/types-l6GOb_yc.d.ts +0 -206
package/dist/types-l6GOb_yc.d.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { g as CommentsUser, l as CommentsDefinition } from "./define-B1jLSPe9.js";
|
|
2
|
-
import { D as CommentUser, S as CommentStatus, T as CommentThread, _ as CommentListCursor, b as CommentMetadata, n as CommentActor, r as CommentAnchor, s as CommentContext, w as CommentSubject } from "./types-BX3vH18p.js";
|
|
3
|
-
import { ViteHubContext } from "@vite-hub/runtime";
|
|
4
|
-
interface CommentsForgeTarget {
|
|
5
|
-
repository: string;
|
|
6
|
-
pullRequest: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Posts each thread to the pull request of the build that served its page: one comment per message, and one summary
|
|
10
|
-
* comment that lists every thread. Credentials come from Server Env: a GitHub App (`VITEHUB_GITHUB_APP_ID` with
|
|
11
|
-
* `VITEHUB_GITHUB_PRIVATE_KEY`), else `VITEHUB_GITHUB_TOKEN`.
|
|
12
|
-
*/
|
|
13
|
-
interface CommentsForgeOptions {
|
|
14
|
-
/** Only GitHub for now. */
|
|
15
|
-
provider: "github";
|
|
16
|
-
/** `owner/name`. Default: the repository of the build that served the thread's page. */
|
|
17
|
-
repository?: string;
|
|
18
|
-
/**
|
|
19
|
-
* The pull request of a thread. Default: the one the build names, else the open pull request whose head is the
|
|
20
|
-
* build's branch. Return `undefined` to keep the thread off GitHub.
|
|
21
|
-
*/
|
|
22
|
-
pullRequest?: (thread: CommentThread) => number | undefined | Promise<number | undefined>;
|
|
23
|
-
/**
|
|
24
|
-
* The GitHub token of the person who wrote a message, such as the user token of their GitHub sign-in, so the
|
|
25
|
-
* comment posts as them. Without one, the GitHub App posts it with their name.
|
|
26
|
-
*/
|
|
27
|
-
token?: (author: CommentUser) => string | undefined | Promise<string | undefined>;
|
|
28
|
-
/** The heading of the summary comment. Default `"Preview comments"`. */
|
|
29
|
-
title?: string;
|
|
30
|
-
/** GitHub Enterprise API base. Default `https://api.github.com`. */
|
|
31
|
-
apiUrl?: string;
|
|
32
|
-
fetch?: typeof fetch;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* The request event of a Comments call: the Request of the Comments API, or the server event of an operation call.
|
|
36
|
-
* Read the request, its cookies, and the platform bindings from `event["~standard"]`. `context` is the H3 event
|
|
37
|
-
* context, when the call came through an H3 event.
|
|
38
|
-
*/
|
|
39
|
-
type CommentsRequestEvent = ViteHubContext<{
|
|
40
|
-
context?: Record<string, unknown>;
|
|
41
|
-
}>;
|
|
42
|
-
interface CommentsIdentifyContext {
|
|
43
|
-
event: CommentsRequestEvent;
|
|
44
|
-
}
|
|
45
|
-
interface CommentsPageContext {
|
|
46
|
-
/** The page URL: the origin of the request and the normalized path, without query and hash. */
|
|
47
|
-
url: URL;
|
|
48
|
-
event: CommentsRequestEvent;
|
|
49
|
-
}
|
|
50
|
-
/** The subject of a page, and the version of the subject that new threads start on. */
|
|
51
|
-
interface CommentsPageSubject extends CommentSubject {
|
|
52
|
-
revision?: number;
|
|
53
|
-
}
|
|
54
|
-
/** What `send.address` gets: the member who presses Send, and the subject of their page. */
|
|
55
|
-
interface CommentSendAddressContext {
|
|
56
|
-
user: CommentsUser;
|
|
57
|
-
subject: CommentSubject;
|
|
58
|
-
}
|
|
59
|
-
/** What `send.payload` gets: one send, before Comments delivers it. */
|
|
60
|
-
interface CommentSendPayloadContext {
|
|
61
|
-
/** The id of the send, as `send` of the delivered body. */
|
|
62
|
-
send: string;
|
|
63
|
-
/** The member who pressed Send. */
|
|
64
|
-
user: CommentsUser;
|
|
65
|
-
/** The subject of the page that the member sent from. */
|
|
66
|
-
subject: CommentSubject;
|
|
67
|
-
/** The threads of the send. `asks` and `quotes` split their ids. */
|
|
68
|
-
threads: readonly CommentThread[];
|
|
69
|
-
asks: readonly string[];
|
|
70
|
-
quotes: readonly string[];
|
|
71
|
-
}
|
|
72
|
-
/** What `send.prompt` gets: the values of one setup code, and the default prompt. */
|
|
73
|
-
interface CommentSendPromptContext {
|
|
74
|
-
/** The member who pressed Send. */
|
|
75
|
-
user: CommentsUser;
|
|
76
|
-
/** The subject of the page that the member pairs from. */
|
|
77
|
-
subject: CommentSubject;
|
|
78
|
-
/** The public origin of the app, such as `https://joyandmaxi.com`. */
|
|
79
|
-
origin: string;
|
|
80
|
-
/** The URL that the agent posts the code to: `{ code, url, thread }` for a T3 task, or `{ code, inbox }` for an inbox. */
|
|
81
|
-
pairUrl: string;
|
|
82
|
-
/** The setup code. It works once, for 10 minutes. */
|
|
83
|
-
code: string;
|
|
84
|
-
/** The secret that signs each delivery to a T3 webhook task. */
|
|
85
|
-
secret: string;
|
|
86
|
-
/** Whether each send carries a read token. `false` when `grant` is `false`. */
|
|
87
|
-
grant: boolean;
|
|
88
|
-
/** The default prompt: the steps that connect a T3 Code thread. */
|
|
89
|
-
prompt: string;
|
|
90
|
-
}
|
|
91
|
-
/** A JSON value, as the delivered body holds it. */
|
|
92
|
-
type CommentSendData = string | number | boolean | null | CommentSendData[] | {
|
|
93
|
-
[key: string]: CommentSendData;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Send: a member hands the threads that wait for an answer to their own agent, such as a T3 Code thread. Each member
|
|
97
|
-
* pairs their agent once, in the comment pill.
|
|
98
|
-
*/
|
|
99
|
-
interface CommentSendOptions {
|
|
100
|
-
/** Adds `data` to the delivered body, such as the id of a document that your own MCP reads. Default: `null`. */
|
|
101
|
-
payload?: (context: CommentSendPayloadContext) => CommentSendData | Promise<CommentSendData>;
|
|
102
|
-
/**
|
|
103
|
-
* The address of the agent that should get a send from this subject, such as the T3 thread link that wrote the
|
|
104
|
-
* document. A member who paired an agent from that thread sends there; otherwise to the agent they paired last.
|
|
105
|
-
* Default: none, so every send goes to the agent the member paired last.
|
|
106
|
-
*/
|
|
107
|
-
address?: (context: CommentSendAddressContext) => string | null | undefined | Promise<string | null | undefined>;
|
|
108
|
-
/**
|
|
109
|
-
* `false` sends no read token: the agent reads the threads through your own MCP server, as the member. Default: each
|
|
110
|
-
* send carries a token that reads its threads, as the member, for 24 hours.
|
|
111
|
-
*/
|
|
112
|
-
grant?: false;
|
|
113
|
-
/** The hosts that a paired agent URL may use. Default: `["relay.t3.codes"]`, the T3 Code relay. */
|
|
114
|
-
hosts?: readonly string[];
|
|
115
|
-
/**
|
|
116
|
-
* The setup prompt that Send copies, such as to add the steps of a Claude Code or Codex inbox, or to name the tools of
|
|
117
|
-
* your own MCP server. Default: `context.prompt`, the steps that connect a T3 Code thread.
|
|
118
|
-
*/
|
|
119
|
-
prompt?: (context: CommentSendPromptContext) => string | Promise<string>;
|
|
120
|
-
}
|
|
121
|
-
interface DefineCommentsOptions extends CommentsDefinition {
|
|
122
|
-
/**
|
|
123
|
-
* `true` turns on **Send** in the comment pill, for signed-in people who may write. It needs Webhooks and a SQLite
|
|
124
|
-
* Database: ViteHub adds the `vitehub_comment_sends` tables and the member endpoints of Webhooks. See
|
|
125
|
-
* https://vitehub.dev/docs/comments/send
|
|
126
|
-
*/
|
|
127
|
-
send?: boolean | CommentSendOptions;
|
|
128
|
-
/** Resolves the user of a request. Without it, Comments reads the ViteHub Auth session. Return `null` for anonymous. */
|
|
129
|
-
identify?: (context: CommentsIdentifyContext) => CommentsUser | null | undefined | Promise<CommentsUser | null | undefined>;
|
|
130
|
-
/** Name of the Database that stores comments. Defaults to the `default` Database, or the only one. */
|
|
131
|
-
database?: string;
|
|
132
|
-
/** Posts threads to the pull request that the page previews. */
|
|
133
|
-
forge?: CommentsForgeOptions;
|
|
134
|
-
/**
|
|
135
|
-
* The subject that the overlay comments on for a page, such as `{ kind: "drop", id, revision }`. The server decides:
|
|
136
|
-
* the overlay reads the subject from `/session`, and a new thread from the overlay must be on it. `authorize` still
|
|
137
|
-
* runs on the subject. Return `null` or `undefined` for the default, `{ kind: "page", id: url.pathname }`.
|
|
138
|
-
*/
|
|
139
|
-
page?: (context: CommentsPageContext) => CommentsPageSubject | null | undefined | Promise<CommentsPageSubject | null | undefined>;
|
|
140
|
-
}
|
|
141
|
-
interface ListCommentThreadsOptions {
|
|
142
|
-
subject?: CommentSubject;
|
|
143
|
-
/** Only threads about this kind of subject, across all its ids. */
|
|
144
|
-
subjectKind?: string;
|
|
145
|
-
/** An app path. The same as a `page` subject. */
|
|
146
|
-
page?: string;
|
|
147
|
-
/** Only the threads of this numbering scope, such as `site`. */
|
|
148
|
-
scope?: string;
|
|
149
|
-
status?: CommentStatus;
|
|
150
|
-
/** Only threads started on this version of the subject or an earlier one. */
|
|
151
|
-
revision?: {
|
|
152
|
-
lte: number;
|
|
153
|
-
};
|
|
154
|
-
/** Newest activity first. Default 200, at most 500. */
|
|
155
|
-
limit?: number;
|
|
156
|
-
/** Where the next page starts: the `updatedAt` and `id` of the last thread of the page before. */
|
|
157
|
-
before?: CommentListCursor;
|
|
158
|
-
}
|
|
159
|
-
interface CreateCommentThreadInput {
|
|
160
|
-
/** What the thread is about. Or set `page`. */
|
|
161
|
-
subject?: CommentSubject;
|
|
162
|
-
/** An app path, for a thread on a page. The same as `subject: { kind: "page", id: page }`. */
|
|
163
|
-
page?: string;
|
|
164
|
-
/** Default `{ kind: "page" }`. */
|
|
165
|
-
anchor?: CommentAnchor;
|
|
166
|
-
context?: CommentContext;
|
|
167
|
-
metadata?: CommentMetadata;
|
|
168
|
-
/** The version of the subject, such as a document version. */
|
|
169
|
-
revision?: number;
|
|
170
|
-
/** A retry key. A second create with the same key and author in the same scope returns the first thread. */
|
|
171
|
-
requestId?: string;
|
|
172
|
-
body: string;
|
|
173
|
-
author: CommentUser;
|
|
174
|
-
/** Ids of the people that `body` names with `@`. */
|
|
175
|
-
mentions?: string[];
|
|
176
|
-
attachments?: string[];
|
|
177
|
-
}
|
|
178
|
-
interface EditCommentInput {
|
|
179
|
-
body: string;
|
|
180
|
-
/** Replaces the mentions. Default: none. */
|
|
181
|
-
mentions?: string[];
|
|
182
|
-
}
|
|
183
|
-
interface ReplyInput {
|
|
184
|
-
body: string;
|
|
185
|
-
author: CommentUser;
|
|
186
|
-
/** The agent replying on behalf of the author. */
|
|
187
|
-
actor?: CommentActor;
|
|
188
|
-
mentions?: string[];
|
|
189
|
-
attachments?: string[];
|
|
190
|
-
/** A retry key. A second reply with the same key and author in the same thread returns the first message. */
|
|
191
|
-
requestId?: string;
|
|
192
|
-
}
|
|
193
|
-
interface FindCommentThreadInput {
|
|
194
|
-
/** The subject that the create named. Or set `page`. */
|
|
195
|
-
subject?: CommentSubject;
|
|
196
|
-
/** An app path, for a thread on a page. */
|
|
197
|
-
page?: string;
|
|
198
|
-
requestId: string;
|
|
199
|
-
}
|
|
200
|
-
interface ReplyOptions {
|
|
201
|
-
/** Reply to a resolved thread, and keep it resolved. Default `false`: the reply fails with `COMMENTS_RESOLVED`. */
|
|
202
|
-
allowResolved?: boolean;
|
|
203
|
-
}
|
|
204
|
-
/** Codes of the errors that Comments methods return in the `[error, data]` tuple. */
|
|
205
|
-
type CommentsErrorCode = "COMMENTS_NOT_INSTALLED" | "COMMENTS_NOT_FOUND" | "COMMENTS_INVALID_INPUT" | "COMMENTS_FORBIDDEN" | "COMMENTS_POLICY_MISSING" | "COMMENTS_RESOLVED" | "COMMENTS_CONTENT_MISSING" | "COMMENTS_FIELD_INVALID" | "COMMENTS_FIELD_NOT_EDITABLE" | "COMMENTS_FIELD_FORBIDDEN" | "COMMENTS_FIELD_CONFLICT" | "COMMENTS_FIELD_LOCKED" | "COMMENTS_SEND_OFF";
|
|
206
|
-
export { ListCommentThreadsOptions as _, CommentSendPromptContext as a, CommentsForgeTarget as c, CommentsPageSubject as d, CommentsRequestEvent as f, FindCommentThreadInput as g, EditCommentInput as h, CommentSendPayloadContext as i, CommentsIdentifyContext as l, DefineCommentsOptions as m, CommentSendData as n, CommentsErrorCode as o, CreateCommentThreadInput as p, CommentSendOptions as r, CommentsForgeOptions as s, CommentSendAddressContext as t, CommentsPageContext as u, ReplyInput as v, ReplyOptions as y };
|