@emseepea/feedback 0.2.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/LICENSE +21 -0
- package/README.md +220 -0
- package/dist/deadline.d.ts +4 -0
- package/dist/deadline.d.ts.map +1 -0
- package/dist/deadline.js +41 -0
- package/dist/deadline.js.map +1 -0
- package/dist/firestore.d.ts +48 -0
- package/dist/firestore.d.ts.map +1 -0
- package/dist/firestore.js +296 -0
- package/dist/firestore.js.map +1 -0
- package/dist/github.d.ts +12 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +275 -0
- package/dist/github.js.map +1 -0
- package/dist/http.d.ts +8 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +59 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +328 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +255 -0
- package/dist/index.js.map +1 -0
- package/dist/postgres.d.ts +32 -0
- package/dist/postgres.d.ts.map +1 -0
- package/dist/postgres.js +352 -0
- package/dist/postgres.js.map +1 -0
- package/dist/testing-server.d.ts +2 -0
- package/dist/testing-server.d.ts.map +1 -0
- package/dist/testing-server.js +46 -0
- package/dist/testing-server.js.map +1 -0
- package/dist/webhooks.d.ts +22 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +142 -0
- package/dist/webhooks.js.map +1 -0
- package/dist/zendesk.d.ts +12 -0
- package/dist/zendesk.d.ts.map +1 -0
- package/dist/zendesk.js +286 -0
- package/dist/zendesk.js.map +1 -0
- package/package.json +71 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { type EmseepeaTool, type Principal } from "@emseepea/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const feedbackObservationSchema: z.ZodEnum<{
|
|
4
|
+
error: "error";
|
|
5
|
+
friction: "friction";
|
|
6
|
+
annoyance: "annoyance";
|
|
7
|
+
unnecessary_difficulty: "unnecessary_difficulty";
|
|
8
|
+
confusion: "confusion";
|
|
9
|
+
repetition: "repetition";
|
|
10
|
+
unexpected_good_result: "unexpected_good_result";
|
|
11
|
+
unexpected_bad_result: "unexpected_bad_result";
|
|
12
|
+
capability_mismatch: "capability_mismatch";
|
|
13
|
+
suggestion: "suggestion";
|
|
14
|
+
notable_success: "notable_success";
|
|
15
|
+
}>;
|
|
16
|
+
export declare const feedbackMessageSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
threadId: z.ZodString;
|
|
19
|
+
sequence: z.ZodNumber;
|
|
20
|
+
author: z.ZodEnum<{
|
|
21
|
+
user: "user";
|
|
22
|
+
system: "system";
|
|
23
|
+
team: "team";
|
|
24
|
+
}>;
|
|
25
|
+
kind: z.ZodEnum<{
|
|
26
|
+
status: "status";
|
|
27
|
+
comment: "comment";
|
|
28
|
+
question: "question";
|
|
29
|
+
}>;
|
|
30
|
+
body: z.ZodString;
|
|
31
|
+
createdAt: z.ZodISODateTime;
|
|
32
|
+
offeredToClientAt: z.ZodOptional<z.ZodISODateTime>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export declare const feedbackThreadSchema: z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
subject: z.ZodString;
|
|
37
|
+
status: z.ZodString;
|
|
38
|
+
createdAt: z.ZodISODateTime;
|
|
39
|
+
updatedAt: z.ZodISODateTime;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
export declare const feedbackConversationSchema: z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
subject: z.ZodString;
|
|
44
|
+
status: z.ZodString;
|
|
45
|
+
createdAt: z.ZodISODateTime;
|
|
46
|
+
updatedAt: z.ZodISODateTime;
|
|
47
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
threadId: z.ZodString;
|
|
50
|
+
sequence: z.ZodNumber;
|
|
51
|
+
author: z.ZodEnum<{
|
|
52
|
+
user: "user";
|
|
53
|
+
system: "system";
|
|
54
|
+
team: "team";
|
|
55
|
+
}>;
|
|
56
|
+
kind: z.ZodEnum<{
|
|
57
|
+
status: "status";
|
|
58
|
+
comment: "comment";
|
|
59
|
+
question: "question";
|
|
60
|
+
}>;
|
|
61
|
+
body: z.ZodString;
|
|
62
|
+
createdAt: z.ZodISODateTime;
|
|
63
|
+
offeredToClientAt: z.ZodOptional<z.ZodISODateTime>;
|
|
64
|
+
}, z.core.$strict>>;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
export type FeedbackObservation = z.output<typeof feedbackObservationSchema>;
|
|
67
|
+
export type FeedbackMessage = z.output<typeof feedbackMessageSchema>;
|
|
68
|
+
export type FeedbackThread = z.output<typeof feedbackThreadSchema>;
|
|
69
|
+
export type FeedbackConversation = z.output<typeof feedbackConversationSchema>;
|
|
70
|
+
export interface FeedbackAdapterContext {
|
|
71
|
+
readonly scope: string;
|
|
72
|
+
readonly signal: AbortSignal;
|
|
73
|
+
readonly deadlineMs: number;
|
|
74
|
+
}
|
|
75
|
+
export declare const feedbackEventSchema: z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
type: z.ZodEnum<{
|
|
78
|
+
"feedback.thread.created": "feedback.thread.created";
|
|
79
|
+
"feedback.message.added": "feedback.message.added";
|
|
80
|
+
"feedback.status.changed": "feedback.status.changed";
|
|
81
|
+
"feedback.message.offered-to-client": "feedback.message.offered-to-client";
|
|
82
|
+
}>;
|
|
83
|
+
occurredAt: z.ZodISODateTime;
|
|
84
|
+
scope: z.ZodString;
|
|
85
|
+
threadId: z.ZodString;
|
|
86
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
87
|
+
author: z.ZodOptional<z.ZodEnum<{
|
|
88
|
+
user: "user";
|
|
89
|
+
system: "system";
|
|
90
|
+
team: "team";
|
|
91
|
+
}>>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
export type FeedbackEvent = z.output<typeof feedbackEventSchema>;
|
|
94
|
+
export type FeedbackEventHook = (event: Readonly<FeedbackEvent>, context: Readonly<{
|
|
95
|
+
signal: AbortSignal;
|
|
96
|
+
deadlineMs: number;
|
|
97
|
+
}>) => void | Promise<void>;
|
|
98
|
+
export interface FeedbackSubmissionBackend<Context = undefined> {
|
|
99
|
+
submit(command: Readonly<{
|
|
100
|
+
observation: FeedbackObservation;
|
|
101
|
+
detail: string;
|
|
102
|
+
context: Context;
|
|
103
|
+
}>, context: FeedbackAdapterContext): FeedbackSubmissionResult | Promise<FeedbackSubmissionResult>;
|
|
104
|
+
}
|
|
105
|
+
declare const backendEventSchema: z.ZodObject<{
|
|
106
|
+
type: z.ZodEnum<{
|
|
107
|
+
"feedback.thread.created": "feedback.thread.created";
|
|
108
|
+
"feedback.message.added": "feedback.message.added";
|
|
109
|
+
"feedback.status.changed": "feedback.status.changed";
|
|
110
|
+
"feedback.message.offered-to-client": "feedback.message.offered-to-client";
|
|
111
|
+
}>;
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
threadId: z.ZodString;
|
|
114
|
+
author: z.ZodOptional<z.ZodEnum<{
|
|
115
|
+
user: "user";
|
|
116
|
+
system: "system";
|
|
117
|
+
team: "team";
|
|
118
|
+
}>>;
|
|
119
|
+
occurredAt: z.ZodISODateTime;
|
|
120
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
export type FeedbackBackendEvent = z.input<typeof backendEventSchema>;
|
|
123
|
+
declare const submissionResultSchema: z.ZodObject<{
|
|
124
|
+
id: z.ZodString;
|
|
125
|
+
recordedAt: z.ZodISODateTime;
|
|
126
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
127
|
+
type: z.ZodEnum<{
|
|
128
|
+
"feedback.thread.created": "feedback.thread.created";
|
|
129
|
+
"feedback.message.added": "feedback.message.added";
|
|
130
|
+
"feedback.status.changed": "feedback.status.changed";
|
|
131
|
+
"feedback.message.offered-to-client": "feedback.message.offered-to-client";
|
|
132
|
+
}>;
|
|
133
|
+
id: z.ZodString;
|
|
134
|
+
threadId: z.ZodString;
|
|
135
|
+
author: z.ZodOptional<z.ZodEnum<{
|
|
136
|
+
user: "user";
|
|
137
|
+
system: "system";
|
|
138
|
+
team: "team";
|
|
139
|
+
}>>;
|
|
140
|
+
occurredAt: z.ZodISODateTime;
|
|
141
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, z.core.$strict>>>;
|
|
143
|
+
}, z.core.$strict>;
|
|
144
|
+
export type FeedbackSubmissionResult = z.input<typeof submissionResultSchema>;
|
|
145
|
+
export interface FeedbackSubmissionOptions<ContextSchema extends z.ZodType = z.ZodUndefined> {
|
|
146
|
+
readonly access: "public" | "protected";
|
|
147
|
+
readonly requiredScopes?: readonly string[];
|
|
148
|
+
readonly scope?: string | ((principal: Principal | undefined) => string);
|
|
149
|
+
readonly contextSchema?: ContextSchema;
|
|
150
|
+
readonly backend: FeedbackSubmissionBackend<z.output<ContextSchema>>;
|
|
151
|
+
readonly hooks?: readonly FeedbackEventHook[];
|
|
152
|
+
}
|
|
153
|
+
export declare function defineFeedbackSubmission<ContextSchema extends z.ZodType = z.ZodUndefined>(options: FeedbackSubmissionOptions<ContextSchema>): EmseepeaTool;
|
|
154
|
+
declare const createThreadCommandSchema: z.ZodObject<{
|
|
155
|
+
subject: z.ZodString;
|
|
156
|
+
message: z.ZodString;
|
|
157
|
+
}, z.core.$strict>;
|
|
158
|
+
declare const appendMessageCommandSchema: z.ZodObject<{
|
|
159
|
+
threadId: z.ZodString;
|
|
160
|
+
message: z.ZodString;
|
|
161
|
+
}, z.core.$strict>;
|
|
162
|
+
declare const listThreadsQuerySchema: z.ZodObject<{
|
|
163
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
164
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
declare const getThreadQuerySchema: z.ZodObject<{
|
|
167
|
+
threadId: z.ZodString;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
declare const createThreadResultSchema: z.ZodObject<{
|
|
170
|
+
conversation: z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
subject: z.ZodString;
|
|
173
|
+
status: z.ZodString;
|
|
174
|
+
createdAt: z.ZodISODateTime;
|
|
175
|
+
updatedAt: z.ZodISODateTime;
|
|
176
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
threadId: z.ZodString;
|
|
179
|
+
sequence: z.ZodNumber;
|
|
180
|
+
author: z.ZodEnum<{
|
|
181
|
+
user: "user";
|
|
182
|
+
system: "system";
|
|
183
|
+
team: "team";
|
|
184
|
+
}>;
|
|
185
|
+
kind: z.ZodEnum<{
|
|
186
|
+
status: "status";
|
|
187
|
+
comment: "comment";
|
|
188
|
+
question: "question";
|
|
189
|
+
}>;
|
|
190
|
+
body: z.ZodString;
|
|
191
|
+
createdAt: z.ZodISODateTime;
|
|
192
|
+
offeredToClientAt: z.ZodOptional<z.ZodISODateTime>;
|
|
193
|
+
}, z.core.$strict>>;
|
|
194
|
+
}, z.core.$strict>;
|
|
195
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
196
|
+
type: z.ZodEnum<{
|
|
197
|
+
"feedback.thread.created": "feedback.thread.created";
|
|
198
|
+
"feedback.message.added": "feedback.message.added";
|
|
199
|
+
"feedback.status.changed": "feedback.status.changed";
|
|
200
|
+
"feedback.message.offered-to-client": "feedback.message.offered-to-client";
|
|
201
|
+
}>;
|
|
202
|
+
id: z.ZodString;
|
|
203
|
+
threadId: z.ZodString;
|
|
204
|
+
author: z.ZodOptional<z.ZodEnum<{
|
|
205
|
+
user: "user";
|
|
206
|
+
system: "system";
|
|
207
|
+
team: "team";
|
|
208
|
+
}>>;
|
|
209
|
+
occurredAt: z.ZodISODateTime;
|
|
210
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
211
|
+
}, z.core.$strict>>>;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
declare const appendMessageResultSchema: z.ZodObject<{
|
|
214
|
+
message: z.ZodObject<{
|
|
215
|
+
id: z.ZodString;
|
|
216
|
+
threadId: z.ZodString;
|
|
217
|
+
sequence: z.ZodNumber;
|
|
218
|
+
author: z.ZodEnum<{
|
|
219
|
+
user: "user";
|
|
220
|
+
system: "system";
|
|
221
|
+
team: "team";
|
|
222
|
+
}>;
|
|
223
|
+
kind: z.ZodEnum<{
|
|
224
|
+
status: "status";
|
|
225
|
+
comment: "comment";
|
|
226
|
+
question: "question";
|
|
227
|
+
}>;
|
|
228
|
+
body: z.ZodString;
|
|
229
|
+
createdAt: z.ZodISODateTime;
|
|
230
|
+
offeredToClientAt: z.ZodOptional<z.ZodISODateTime>;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
233
|
+
type: z.ZodEnum<{
|
|
234
|
+
"feedback.thread.created": "feedback.thread.created";
|
|
235
|
+
"feedback.message.added": "feedback.message.added";
|
|
236
|
+
"feedback.status.changed": "feedback.status.changed";
|
|
237
|
+
"feedback.message.offered-to-client": "feedback.message.offered-to-client";
|
|
238
|
+
}>;
|
|
239
|
+
id: z.ZodString;
|
|
240
|
+
threadId: z.ZodString;
|
|
241
|
+
author: z.ZodOptional<z.ZodEnum<{
|
|
242
|
+
user: "user";
|
|
243
|
+
system: "system";
|
|
244
|
+
team: "team";
|
|
245
|
+
}>>;
|
|
246
|
+
occurredAt: z.ZodISODateTime;
|
|
247
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strict>>>;
|
|
249
|
+
}, z.core.$strict>;
|
|
250
|
+
declare const listThreadsResultSchema: z.ZodObject<{
|
|
251
|
+
page: z.ZodObject<{
|
|
252
|
+
threads: z.ZodArray<z.ZodObject<{
|
|
253
|
+
id: z.ZodString;
|
|
254
|
+
subject: z.ZodString;
|
|
255
|
+
status: z.ZodString;
|
|
256
|
+
createdAt: z.ZodISODateTime;
|
|
257
|
+
updatedAt: z.ZodISODateTime;
|
|
258
|
+
}, z.core.$strict>>;
|
|
259
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
260
|
+
}, z.core.$strict>;
|
|
261
|
+
}, z.core.$strict>;
|
|
262
|
+
declare const getThreadResultSchema: z.ZodObject<{
|
|
263
|
+
conversation: z.ZodObject<{
|
|
264
|
+
id: z.ZodString;
|
|
265
|
+
subject: z.ZodString;
|
|
266
|
+
status: z.ZodString;
|
|
267
|
+
createdAt: z.ZodISODateTime;
|
|
268
|
+
updatedAt: z.ZodISODateTime;
|
|
269
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
270
|
+
id: z.ZodString;
|
|
271
|
+
threadId: z.ZodString;
|
|
272
|
+
sequence: z.ZodNumber;
|
|
273
|
+
author: z.ZodEnum<{
|
|
274
|
+
user: "user";
|
|
275
|
+
system: "system";
|
|
276
|
+
team: "team";
|
|
277
|
+
}>;
|
|
278
|
+
kind: z.ZodEnum<{
|
|
279
|
+
status: "status";
|
|
280
|
+
comment: "comment";
|
|
281
|
+
question: "question";
|
|
282
|
+
}>;
|
|
283
|
+
body: z.ZodString;
|
|
284
|
+
createdAt: z.ZodISODateTime;
|
|
285
|
+
offeredToClientAt: z.ZodOptional<z.ZodISODateTime>;
|
|
286
|
+
}, z.core.$strict>>;
|
|
287
|
+
}, z.core.$strict>;
|
|
288
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
289
|
+
type: z.ZodEnum<{
|
|
290
|
+
"feedback.thread.created": "feedback.thread.created";
|
|
291
|
+
"feedback.message.added": "feedback.message.added";
|
|
292
|
+
"feedback.status.changed": "feedback.status.changed";
|
|
293
|
+
"feedback.message.offered-to-client": "feedback.message.offered-to-client";
|
|
294
|
+
}>;
|
|
295
|
+
id: z.ZodString;
|
|
296
|
+
threadId: z.ZodString;
|
|
297
|
+
author: z.ZodOptional<z.ZodEnum<{
|
|
298
|
+
user: "user";
|
|
299
|
+
system: "system";
|
|
300
|
+
team: "team";
|
|
301
|
+
}>>;
|
|
302
|
+
occurredAt: z.ZodISODateTime;
|
|
303
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
304
|
+
}, z.core.$strict>>>;
|
|
305
|
+
}, z.core.$strict>;
|
|
306
|
+
export type CreateFeedbackThreadCommand = z.output<typeof createThreadCommandSchema>;
|
|
307
|
+
export type AppendFeedbackMessageCommand = z.output<typeof appendMessageCommandSchema>;
|
|
308
|
+
export type ListFeedbackThreadsQuery = z.output<typeof listThreadsQuerySchema>;
|
|
309
|
+
export type GetFeedbackThreadQuery = z.output<typeof getThreadQuerySchema>;
|
|
310
|
+
export type CreateFeedbackThreadResult = z.input<typeof createThreadResultSchema>;
|
|
311
|
+
export type AppendFeedbackMessageResult = z.input<typeof appendMessageResultSchema>;
|
|
312
|
+
export type ListFeedbackThreadsResult = z.input<typeof listThreadsResultSchema>;
|
|
313
|
+
export type GetFeedbackThreadResult = z.input<typeof getThreadResultSchema>;
|
|
314
|
+
export interface FeedbackConversationBackend {
|
|
315
|
+
createThread(command: CreateFeedbackThreadCommand, context: FeedbackAdapterContext): CreateFeedbackThreadResult | Promise<CreateFeedbackThreadResult>;
|
|
316
|
+
appendMessage(command: AppendFeedbackMessageCommand, context: FeedbackAdapterContext): AppendFeedbackMessageResult | Promise<AppendFeedbackMessageResult>;
|
|
317
|
+
listThreads(query: ListFeedbackThreadsQuery, context: FeedbackAdapterContext): ListFeedbackThreadsResult | Promise<ListFeedbackThreadsResult>;
|
|
318
|
+
getThread(query: GetFeedbackThreadQuery, context: FeedbackAdapterContext): GetFeedbackThreadResult | Promise<GetFeedbackThreadResult>;
|
|
319
|
+
}
|
|
320
|
+
export interface FeedbackConversationOptions {
|
|
321
|
+
readonly requiredScopes: readonly string[];
|
|
322
|
+
readonly scope?: (principal: Principal | undefined) => string;
|
|
323
|
+
readonly backend: FeedbackConversationBackend;
|
|
324
|
+
readonly hooks?: readonly FeedbackEventHook[];
|
|
325
|
+
}
|
|
326
|
+
export declare function defineFeedbackConversation(options: FeedbackConversationOptions): readonly EmseepeaTool[];
|
|
327
|
+
export {};
|
|
328
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,EAEf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAYuB,CAAC;AAE9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;kBAWhC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;kBAM/B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;kBAIrC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC7E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACrE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACnE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAQD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;kBAQ9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CA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C,CAAC;AACpF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAChF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE5E,MAAM,WAAW,2BAA2B;IAC1C,YAAY,CACV,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,sBAAsB,GAC9B,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACpE,aAAa,CACX,OAAO,EAAE,4BAA4B,EACrC,OAAO,EAAE,sBAAsB,GAC9B,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACtE,WAAW,CACT,KAAK,EAAE,wBAAwB,EAC/B,OAAO,EAAE,sBAAsB,GAC9B,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAClE,SAAS,CACP,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,sBAAsB,GAC9B,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,KAAK,MAAM,CAAC;IAC9D,QAAQ,CAAC,OAAO,EAAE,2BAA2B,CAAC;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC/C;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,2BAA2B,GAAG,SAAS,YAAY,EAAE,CAkFxG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { defineTool, } from "@emseepea/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { beforeDeadline, deadlineSignal } from "./deadline.js";
|
|
4
|
+
const identifier = z.string().min(1).max(240);
|
|
5
|
+
const timestamp = z.iso.datetime({ offset: true });
|
|
6
|
+
const body = z.string().min(1).max(4_000);
|
|
7
|
+
export const feedbackObservationSchema = z.enum([
|
|
8
|
+
"error",
|
|
9
|
+
"friction",
|
|
10
|
+
"annoyance",
|
|
11
|
+
"unnecessary_difficulty",
|
|
12
|
+
"confusion",
|
|
13
|
+
"repetition",
|
|
14
|
+
"unexpected_good_result",
|
|
15
|
+
"unexpected_bad_result",
|
|
16
|
+
"capability_mismatch",
|
|
17
|
+
"suggestion",
|
|
18
|
+
"notable_success",
|
|
19
|
+
]).describe("The single notable observation being recorded.");
|
|
20
|
+
export const feedbackMessageSchema = z.strictObject({
|
|
21
|
+
id: identifier.describe("Stable message identifier."),
|
|
22
|
+
threadId: identifier.describe("Stable identifier of the containing feedback thread."),
|
|
23
|
+
sequence: z.number().int().positive().describe("Stable one-based position in the thread."),
|
|
24
|
+
author: z.enum(["user", "team", "system"]).describe("Who authored the message."),
|
|
25
|
+
kind: z.enum(["comment", "question", "status"]).describe("Purpose of the message."),
|
|
26
|
+
body: body.describe("Message text that is safe to present in the feedback conversation."),
|
|
27
|
+
createdAt: timestamp.describe("When the message was created."),
|
|
28
|
+
offeredToClientAt: timestamp.optional().describe("When this team message was first included in a tool result. This does not prove human attention or comprehension."),
|
|
29
|
+
});
|
|
30
|
+
export const feedbackThreadSchema = z.strictObject({
|
|
31
|
+
id: identifier.describe("Stable feedback thread identifier."),
|
|
32
|
+
subject: z.string().min(1).max(200).describe("Short description of the feedback topic."),
|
|
33
|
+
status: z.string().min(1).max(80).describe("Current backend or support-system status."),
|
|
34
|
+
createdAt: timestamp.describe("When the thread was created."),
|
|
35
|
+
updatedAt: timestamp.describe("When the thread last changed."),
|
|
36
|
+
});
|
|
37
|
+
export const feedbackConversationSchema = feedbackThreadSchema.extend({
|
|
38
|
+
messages: z.array(feedbackMessageSchema).max(200).describe("Messages in stable sequence order. Private support notes are excluded."),
|
|
39
|
+
});
|
|
40
|
+
const feedbackEventTypeSchema = z.enum([
|
|
41
|
+
"feedback.thread.created",
|
|
42
|
+
"feedback.message.added",
|
|
43
|
+
"feedback.status.changed",
|
|
44
|
+
"feedback.message.offered-to-client",
|
|
45
|
+
]);
|
|
46
|
+
export const feedbackEventSchema = z.strictObject({
|
|
47
|
+
id: identifier,
|
|
48
|
+
type: feedbackEventTypeSchema,
|
|
49
|
+
occurredAt: timestamp,
|
|
50
|
+
scope: identifier,
|
|
51
|
+
threadId: identifier,
|
|
52
|
+
messageId: identifier.optional(),
|
|
53
|
+
author: z.enum(["user", "team", "system"]).optional(),
|
|
54
|
+
});
|
|
55
|
+
const backendEventSchema = feedbackEventSchema.omit({ scope: true });
|
|
56
|
+
const backendEventsSchema = z.array(backendEventSchema).max(100).optional();
|
|
57
|
+
const submissionNextAction = "Start your final response by answering every part of the user's original request from earlier tool results. A response that only discusses feedback is incomplete. Then tell the user, \"I recorded feedback about ...\", with a brief, specific summary of the observation.";
|
|
58
|
+
const submissionResultSchema = z.strictObject({
|
|
59
|
+
id: identifier.describe("Stable feedback submission identifier."),
|
|
60
|
+
recordedAt: timestamp.describe("When the feedback was durably recorded."),
|
|
61
|
+
events: backendEventsSchema,
|
|
62
|
+
});
|
|
63
|
+
export function defineFeedbackSubmission(options) {
|
|
64
|
+
const inputSchema = z.strictObject({
|
|
65
|
+
observation: feedbackObservationSchema,
|
|
66
|
+
detail: body.describe("What happened, what helped or failed, what was harder than it should have been, or what was surprising."),
|
|
67
|
+
...(options.contextSchema ? {
|
|
68
|
+
context: options.contextSchema.optional().describe("Application-declared structured context. Do not include chat history, credentials, raw tool data, or personal information."),
|
|
69
|
+
} : {}),
|
|
70
|
+
});
|
|
71
|
+
const outputSchema = submissionResultSchema.omit({ events: true }).extend({
|
|
72
|
+
nextAction: z.literal(submissionNextAction).describe("What the AI should do after the feedback was durably recorded."),
|
|
73
|
+
});
|
|
74
|
+
const common = {
|
|
75
|
+
name: "submit-feedback",
|
|
76
|
+
title: "Record Detailed Feedback",
|
|
77
|
+
description: "Record one notable observation about an error, friction, annoyance, unnecessary difficulty, confusion, repetition, an unexpected result, a capability mismatch, a suggestion, or a notable success. " +
|
|
78
|
+
"Call this tool when another tool result or the user's message reveals notable friction or another qualifying observation. Use it without asking a separate permission question. After it succeeds, fully answer the user's original request. Then briefly state the specific observation you recorded. Do not let feedback replace the requested answer. A tool that works as designed, returns structured data, or takes only the expected steps is ordinary operation. Do not record these outcomes as feedback. Do not record expected empty results, session opening or closing, duplicate observations, or anything after the user objects. Never include surrounding conversation, credentials, raw tool data, or personal information.",
|
|
79
|
+
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: true },
|
|
80
|
+
inputSchema,
|
|
81
|
+
outputSchema,
|
|
82
|
+
};
|
|
83
|
+
const execute = async (input, toolContext) => {
|
|
84
|
+
const adapterContext = createAdapterContext(options.scope, toolContext);
|
|
85
|
+
const result = await submissionResultSchema.parseAsync(await options.backend.submit({
|
|
86
|
+
observation: input.observation,
|
|
87
|
+
detail: input.detail,
|
|
88
|
+
context: ("context" in input ? input.context : undefined),
|
|
89
|
+
}, adapterContext));
|
|
90
|
+
await dispatchHooks(options.hooks, result.events ?? [], adapterContext);
|
|
91
|
+
return {
|
|
92
|
+
data: {
|
|
93
|
+
id: result.id,
|
|
94
|
+
recordedAt: result.recordedAt,
|
|
95
|
+
nextAction: submissionNextAction,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
if (options.access === "public") {
|
|
100
|
+
if (options.requiredScopes !== undefined) {
|
|
101
|
+
throw new Error("Public feedback submissions cannot declare requiredScopes");
|
|
102
|
+
}
|
|
103
|
+
return defineTool({ ...common, access: "public", handler: execute });
|
|
104
|
+
}
|
|
105
|
+
if (!options.requiredScopes?.length) {
|
|
106
|
+
throw new Error("Protected feedback submissions require at least one scope");
|
|
107
|
+
}
|
|
108
|
+
return defineTool({
|
|
109
|
+
...common,
|
|
110
|
+
access: "protected",
|
|
111
|
+
requiredScopes: options.requiredScopes,
|
|
112
|
+
handler: execute,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const createThreadCommandSchema = z.strictObject({
|
|
116
|
+
subject: z.string().min(1).max(200).describe("Short description of the feedback topic."),
|
|
117
|
+
message: body.describe("Detailed first message for the support team."),
|
|
118
|
+
});
|
|
119
|
+
const appendMessageCommandSchema = z.strictObject({
|
|
120
|
+
threadId: identifier.describe("Exact feedback thread identifier returned by this server."),
|
|
121
|
+
message: body.describe("New user message to append to the existing support conversation."),
|
|
122
|
+
});
|
|
123
|
+
const listThreadsQuerySchema = z.strictObject({
|
|
124
|
+
cursor: z.string().min(1).max(1_000).optional().describe("Opaque cursor from the previous page."),
|
|
125
|
+
limit: z.number().int().min(1).max(50).default(20).describe("Maximum threads to return."),
|
|
126
|
+
});
|
|
127
|
+
const getThreadQuerySchema = z.strictObject({
|
|
128
|
+
threadId: identifier.describe("Exact feedback thread identifier returned by this server."),
|
|
129
|
+
});
|
|
130
|
+
const threadPageSchema = z.strictObject({
|
|
131
|
+
threads: z.array(feedbackThreadSchema).max(50).describe("Feedback threads visible in this scope."),
|
|
132
|
+
nextCursor: z.string().min(1).max(1_000).optional().describe("Cursor for the next page, when more threads exist."),
|
|
133
|
+
});
|
|
134
|
+
const createThreadResultSchema = z.strictObject({
|
|
135
|
+
conversation: feedbackConversationSchema,
|
|
136
|
+
events: backendEventsSchema,
|
|
137
|
+
});
|
|
138
|
+
const appendMessageResultSchema = z.strictObject({
|
|
139
|
+
message: feedbackMessageSchema,
|
|
140
|
+
events: backendEventsSchema,
|
|
141
|
+
});
|
|
142
|
+
const listThreadsResultSchema = z.strictObject({
|
|
143
|
+
page: threadPageSchema,
|
|
144
|
+
});
|
|
145
|
+
const getThreadResultSchema = z.strictObject({
|
|
146
|
+
conversation: feedbackConversationSchema,
|
|
147
|
+
events: backendEventsSchema,
|
|
148
|
+
});
|
|
149
|
+
export function defineFeedbackConversation(options) {
|
|
150
|
+
const access = { access: "protected", requiredScopes: options.requiredScopes };
|
|
151
|
+
const contextFor = (context) => createAdapterContext(options.scope ?? ((principal) => principal?.clientId ?? ""), context);
|
|
152
|
+
const createThread = defineTool({
|
|
153
|
+
name: "create-feedback-thread",
|
|
154
|
+
...access,
|
|
155
|
+
title: "Start Feedback Conversation",
|
|
156
|
+
description: "Start a durable support conversation for detailed feedback. Use one thread for one observation and openly tell the user it was created. Do not include unrelated chat history, credentials, or raw tool payloads.",
|
|
157
|
+
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: true },
|
|
158
|
+
inputSchema: createThreadCommandSchema,
|
|
159
|
+
outputSchema: feedbackConversationSchema,
|
|
160
|
+
async handler(input, toolContext) {
|
|
161
|
+
const context = contextFor(toolContext);
|
|
162
|
+
const result = await createThreadResultSchema.parseAsync(await options.backend.createThread(input, context));
|
|
163
|
+
await dispatchHooks(options.hooks, result.events ?? [], context);
|
|
164
|
+
return { data: result.conversation };
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
const appendMessage = defineTool({
|
|
168
|
+
name: "reply-to-feedback-thread",
|
|
169
|
+
...access,
|
|
170
|
+
title: "Reply to Feedback Conversation",
|
|
171
|
+
description: "Append the user's new message to the exact existing feedback thread. Do not repeat an earlier message or invent a thread identifier.",
|
|
172
|
+
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: true },
|
|
173
|
+
inputSchema: appendMessageCommandSchema,
|
|
174
|
+
outputSchema: feedbackMessageSchema,
|
|
175
|
+
async handler(input, toolContext) {
|
|
176
|
+
const context = contextFor(toolContext);
|
|
177
|
+
const result = await appendMessageResultSchema.parseAsync(await options.backend.appendMessage(input, context));
|
|
178
|
+
await dispatchHooks(options.hooks, result.events ?? [], context);
|
|
179
|
+
return { data: result.message };
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
const listThreads = defineTool({
|
|
183
|
+
name: "list-feedback-threads",
|
|
184
|
+
...access,
|
|
185
|
+
title: "List Feedback Conversations",
|
|
186
|
+
description: "List feedback conversations for this authenticated client scope.",
|
|
187
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
188
|
+
inputSchema: listThreadsQuerySchema,
|
|
189
|
+
outputSchema: threadPageSchema,
|
|
190
|
+
async handler(input, toolContext) {
|
|
191
|
+
const context = contextFor(toolContext);
|
|
192
|
+
const result = await listThreadsResultSchema.parseAsync(await options.backend.listThreads(input, context));
|
|
193
|
+
return { data: result.page };
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
const getThread = defineTool({
|
|
197
|
+
name: "get-feedback-thread",
|
|
198
|
+
...access,
|
|
199
|
+
title: "Read Feedback Conversation",
|
|
200
|
+
description: "Read one feedback conversation and present the meaning of any new team reply to the user. Reading may record that a team reply was offered to this AI client. It does not prove the user saw or understood it.",
|
|
201
|
+
annotations: { readOnlyHint: false, idempotentHint: true, openWorldHint: true },
|
|
202
|
+
inputSchema: getThreadQuerySchema,
|
|
203
|
+
outputSchema: feedbackConversationSchema,
|
|
204
|
+
async handler(input, toolContext) {
|
|
205
|
+
const context = contextFor(toolContext);
|
|
206
|
+
const result = await getThreadResultSchema.parseAsync(await options.backend.getThread(input, context));
|
|
207
|
+
await dispatchHooks(options.hooks, result.events ?? [], context);
|
|
208
|
+
return { data: result.conversation };
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
return Object.freeze([createThread, appendMessage, listThreads, getThread]);
|
|
212
|
+
}
|
|
213
|
+
function createAdapterContext(scopeOption, context) {
|
|
214
|
+
const scope = typeof scopeOption === "function"
|
|
215
|
+
? scopeOption(context.principal)
|
|
216
|
+
: scopeOption ?? context.principal?.clientId ?? "public";
|
|
217
|
+
const checkedScope = identifier.parse(scope);
|
|
218
|
+
return Object.freeze({
|
|
219
|
+
scope: checkedScope,
|
|
220
|
+
signal: context.signal,
|
|
221
|
+
deadlineMs: context.deadlineMs,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async function dispatchHooks(hooks, events, context) {
|
|
225
|
+
if (!hooks?.length || events.length === 0)
|
|
226
|
+
return;
|
|
227
|
+
const hookDeadlineMs = context.deadlineMs - 25;
|
|
228
|
+
for (const uncheckedEvent of events) {
|
|
229
|
+
if (context.signal.aborted || Date.now() >= hookDeadlineMs)
|
|
230
|
+
return;
|
|
231
|
+
const event = Object.freeze(feedbackEventSchema.parse({
|
|
232
|
+
...uncheckedEvent,
|
|
233
|
+
scope: context.scope,
|
|
234
|
+
}));
|
|
235
|
+
for (const hook of hooks) {
|
|
236
|
+
if (context.signal.aborted || Date.now() >= hookDeadlineMs)
|
|
237
|
+
return;
|
|
238
|
+
try {
|
|
239
|
+
const hookContext = {
|
|
240
|
+
signal: context.signal,
|
|
241
|
+
deadlineMs: hookDeadlineMs,
|
|
242
|
+
};
|
|
243
|
+
const signal = deadlineSignal(hookContext);
|
|
244
|
+
await beforeDeadline(Promise.resolve(hook(event, Object.freeze({
|
|
245
|
+
signal,
|
|
246
|
+
deadlineMs: hookContext.deadlineMs,
|
|
247
|
+
}))), hookContext);
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
// Feedback is already durable. Best-effort hooks cannot change the MCP result.
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAIX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/D,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC9C,MAAM,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,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YACnE,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG;oBAClB,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,UAAU,EAAE,cAAc;iBAC3B,CAAC;gBACF,MAAM,MAAM,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;gBAC3C,MAAM,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;oBAC7D,MAAM;oBACN,UAAU,EAAE,WAAW,CAAC,UAAU;iBACnC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;YACrB,CAAC;YAAC,MAAM,CAAC;gBACP,+EAA+E;YACjF,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FeedbackConversationBackend, FeedbackSubmissionBackend } from "./index.js";
|
|
2
|
+
interface QueryResult<Row> {
|
|
3
|
+
readonly rows: readonly Row[];
|
|
4
|
+
readonly rowCount: number | null;
|
|
5
|
+
}
|
|
6
|
+
export interface PostgresFeedbackClient {
|
|
7
|
+
query<Row extends Record<string, unknown> = Record<string, unknown>>(text: string, values?: readonly unknown[]): Promise<QueryResult<Row>>;
|
|
8
|
+
release(): void;
|
|
9
|
+
}
|
|
10
|
+
export interface PostgresFeedbackPool {
|
|
11
|
+
connect(): Promise<PostgresFeedbackClient>;
|
|
12
|
+
query<Row extends Record<string, unknown> = Record<string, unknown>>(text: string, values?: readonly unknown[]): Promise<QueryResult<Row>>;
|
|
13
|
+
}
|
|
14
|
+
export declare const postgresFeedbackSchema = "\nCREATE TABLE IF NOT EXISTS emseepea_feedback_threads (\n scope text NOT NULL,\n id text NOT NULL,\n subject text NOT NULL,\n status text NOT NULL,\n created_at timestamptz NOT NULL,\n updated_at timestamptz NOT NULL,\n PRIMARY KEY (scope, id)\n);\nCREATE TABLE IF NOT EXISTS emseepea_feedback_messages (\n scope text NOT NULL,\n thread_id text NOT NULL,\n id text NOT NULL,\n sequence integer NOT NULL CHECK (sequence > 0),\n author text NOT NULL CHECK (author IN ('user', 'team', 'system')),\n kind text NOT NULL CHECK (kind IN ('comment', 'question', 'status')),\n body text NOT NULL,\n created_at timestamptz NOT NULL,\n offered_to_client_at timestamptz,\n PRIMARY KEY (scope, id),\n UNIQUE (scope, thread_id, sequence),\n FOREIGN KEY (scope, thread_id) REFERENCES emseepea_feedback_threads(scope, id)\n);\nCREATE INDEX IF NOT EXISTS emseepea_feedback_threads_page\n ON emseepea_feedback_threads(scope, updated_at DESC, id DESC);\nCREATE TABLE IF NOT EXISTS emseepea_feedback_submissions (\n scope text NOT NULL,\n id text NOT NULL,\n observation text NOT NULL,\n detail text NOT NULL,\n context jsonb,\n recorded_at timestamptz NOT NULL,\n PRIMARY KEY (scope, id)\n);\nCREATE TABLE IF NOT EXISTS emseepea_feedback_outbox (\n event_id text PRIMARY KEY,\n event_type text NOT NULL,\n occurred_at timestamptz NOT NULL,\n scope text NOT NULL,\n thread_id text NOT NULL,\n message_id text,\n author text,\n dispatched_at timestamptz\n);";
|
|
15
|
+
export declare function migratePostgresFeedback(pool: PostgresFeedbackPool): Promise<void>;
|
|
16
|
+
export interface PostgresFeedbackOptions {
|
|
17
|
+
readonly pool: PostgresFeedbackPool;
|
|
18
|
+
readonly outbox?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function createPostgresFeedbackSubmissionBackend<Context = undefined>(options: PostgresFeedbackOptions): FeedbackSubmissionBackend<Context>;
|
|
21
|
+
export declare function createPostgresFeedbackBackend(options: PostgresFeedbackOptions): FeedbackConversationBackend;
|
|
22
|
+
export declare function appendPostgresTeamReply(options: PostgresFeedbackOptions, command: Readonly<{
|
|
23
|
+
scope: string;
|
|
24
|
+
threadId: string;
|
|
25
|
+
message: string;
|
|
26
|
+
status?: string;
|
|
27
|
+
}>, context: Readonly<{
|
|
28
|
+
signal: AbortSignal;
|
|
29
|
+
deadlineMs: number;
|
|
30
|
+
}>): Promise<void>;
|
|
31
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