@sentry/junior-google 0.302.0 → 0.304.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/dist/index.d.ts +2 -2
- package/dist/index.js +3639 -3892
- package/package.json +9 -12
- package/dist/cli.d.ts +0 -3
- package/dist/config.d.ts +0 -49
- package/dist/credentials.d.ts +0 -153
- package/dist/db/schema.d.ts +0 -98
- package/dist/links/calendar.d.ts +0 -11
- package/dist/links/files.d.ts +0 -47
- package/dist/links/summary.d.ts +0 -13
- package/dist/links/thumbnails.d.ts +0 -8
- package/dist/oauth.d.ts +0 -47
- package/dist/setup-routes.d.ts +0 -25
- package/dist/store.d.ts +0 -22
- package/dist/tools/cancel-event.d.ts +0 -316
- package/dist/tools/create-doc.d.ts +0 -294
- package/dist/tools/create-event.d.ts +0 -342
- package/dist/tools/doc-edits.d.ts +0 -84
- package/dist/tools/doc-markdown.d.ts +0 -40
- package/dist/tools/files.d.ts +0 -94
- package/dist/tools/find-meeting-times.d.ts +0 -386
- package/dist/tools/insert-doc-content.d.ts +0 -288
- package/dist/tools/list-events.d.ts +0 -329
- package/dist/tools/list-file-comments.d.ts +0 -310
- package/dist/tools/read-doc.d.ts +0 -19
- package/dist/tools/read-file.d.ts +0 -323
- package/dist/tools/read-meeting-transcript.d.ts +0 -306
- package/dist/tools/read-sheet.d.ts +0 -27
- package/dist/tools/read-slides.d.ts +0 -27
- package/dist/tools/replace-doc-content.d.ts +0 -287
- package/dist/tools/replace-doc-text.d.ts +0 -291
- package/dist/tools/search-files.d.ts +0 -300
- package/dist/tools/shared.d.ts +0 -323
- package/dist/tools/update-event.d.ts +0 -321
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { type GoogleToolContext } from "./shared";
|
|
3
|
-
declare const repeatSchema: z.ZodObject<{
|
|
4
|
-
frequency: z.ZodEnum<{
|
|
5
|
-
monthly: "monthly";
|
|
6
|
-
weekdays: "weekdays";
|
|
7
|
-
weekly: "weekly";
|
|
8
|
-
}>;
|
|
9
|
-
interval: z.ZodDefault<z.ZodNumber>;
|
|
10
|
-
count: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
}, z.core.$strict>;
|
|
12
|
-
type Repeat = z.infer<typeof repeatSchema>;
|
|
13
|
-
/** Build the Google recurrence rule for a repeating event. Exported for tests. */
|
|
14
|
-
export declare function recurrenceRule(repeat: Repeat): string;
|
|
15
|
-
/**
|
|
16
|
-
* Derive a stable Calendar event id from the tool call.
|
|
17
|
-
*
|
|
18
|
-
* Google accepts client ids in base32hex (`a-v`, `0-9`). Hex is a subset, so a
|
|
19
|
-
* retried tool call maps to the same event instead of a duplicate invite.
|
|
20
|
-
*/
|
|
21
|
-
export declare function calendarEventId(toolCallId: string | undefined): string;
|
|
22
|
-
/** Create an event on Junior's own calendar and invite the attendees. */
|
|
23
|
-
export declare const createCalendarEventTool: import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
24
|
-
title: string;
|
|
25
|
-
description?: string | undefined;
|
|
26
|
-
location?: string | undefined;
|
|
27
|
-
start: string;
|
|
28
|
-
end: string;
|
|
29
|
-
time_zone?: string | undefined;
|
|
30
|
-
attendees: string[];
|
|
31
|
-
optional_attendees: string[];
|
|
32
|
-
repeat?: {
|
|
33
|
-
frequency: "monthly" | "weekdays" | "weekly";
|
|
34
|
-
interval: number;
|
|
35
|
-
count?: number | undefined;
|
|
36
|
-
} | undefined;
|
|
37
|
-
}, {
|
|
38
|
-
[x: string]: unknown;
|
|
39
|
-
objectAnnotations?: {
|
|
40
|
-
kind: "object";
|
|
41
|
-
key: string;
|
|
42
|
-
label: string;
|
|
43
|
-
objectType: "automation" | "calendar_event" | "chart" | "code_change" | "conversation" | "deployment" | "document" | "event" | "item" | "message" | "person" | "task" | "trace" | "web_page";
|
|
44
|
-
title: string;
|
|
45
|
-
url: string | null;
|
|
46
|
-
description?: string | undefined;
|
|
47
|
-
status?: string | undefined;
|
|
48
|
-
trigger?: string | undefined;
|
|
49
|
-
warning?: string | undefined;
|
|
50
|
-
displayType?: string | undefined;
|
|
51
|
-
sourceUpdatedAt?: string | undefined;
|
|
52
|
-
facts?: {
|
|
53
|
-
type: "code_change";
|
|
54
|
-
summary?: string | undefined;
|
|
55
|
-
author?: string | undefined;
|
|
56
|
-
sourceBranch?: string | undefined;
|
|
57
|
-
targetBranch?: string | undefined;
|
|
58
|
-
reviewers?: string[] | undefined;
|
|
59
|
-
review?: "approved" | "changes_requested" | "required" | undefined;
|
|
60
|
-
checks?: {
|
|
61
|
-
passed: number;
|
|
62
|
-
failed: number;
|
|
63
|
-
pending: number;
|
|
64
|
-
} | undefined;
|
|
65
|
-
mergeable?: boolean | undefined;
|
|
66
|
-
changedFiles?: number | undefined;
|
|
67
|
-
additions?: number | undefined;
|
|
68
|
-
deletions?: number | undefined;
|
|
69
|
-
previewImageUrls?: string[] | undefined;
|
|
70
|
-
} | {
|
|
71
|
-
type: "task";
|
|
72
|
-
summary?: string | undefined;
|
|
73
|
-
assignees?: string[] | undefined;
|
|
74
|
-
priority?: string | undefined;
|
|
75
|
-
project?: string | undefined;
|
|
76
|
-
cycle?: string | undefined;
|
|
77
|
-
dueDate?: string | undefined;
|
|
78
|
-
labels?: string[] | undefined;
|
|
79
|
-
trend?: {
|
|
80
|
-
label: string;
|
|
81
|
-
points: number[];
|
|
82
|
-
} | undefined;
|
|
83
|
-
} | {
|
|
84
|
-
type: "deployment";
|
|
85
|
-
summary?: string | undefined;
|
|
86
|
-
project?: string | undefined;
|
|
87
|
-
environment?: string | undefined;
|
|
88
|
-
revision?: string | undefined;
|
|
89
|
-
branch?: string | undefined;
|
|
90
|
-
} | {
|
|
91
|
-
type: "calendar_event";
|
|
92
|
-
summary?: string | undefined;
|
|
93
|
-
when?: string | undefined;
|
|
94
|
-
attendees?: string[] | undefined;
|
|
95
|
-
} | {
|
|
96
|
-
type: "conversation";
|
|
97
|
-
summary?: string | undefined;
|
|
98
|
-
participants?: string[] | undefined;
|
|
99
|
-
lastActivityAt?: string | undefined;
|
|
100
|
-
} | {
|
|
101
|
-
type: "document";
|
|
102
|
-
summary?: string | undefined;
|
|
103
|
-
owner?: string | undefined;
|
|
104
|
-
modifiedAt?: string | undefined;
|
|
105
|
-
thumbnailUrl?: string | undefined;
|
|
106
|
-
} | {
|
|
107
|
-
type: "message";
|
|
108
|
-
summary?: string | undefined;
|
|
109
|
-
channel?: string | undefined;
|
|
110
|
-
author?: string | undefined;
|
|
111
|
-
sentAt?: string | undefined;
|
|
112
|
-
} | {
|
|
113
|
-
type: "web_page";
|
|
114
|
-
summary?: string | undefined;
|
|
115
|
-
siteName?: string | undefined;
|
|
116
|
-
author?: string | undefined;
|
|
117
|
-
media?: "image" | "video" | undefined;
|
|
118
|
-
thumbnailUrl?: string | undefined;
|
|
119
|
-
} | {
|
|
120
|
-
type: "chart";
|
|
121
|
-
summary?: string | undefined;
|
|
122
|
-
display: "area" | "bar" | "line";
|
|
123
|
-
yAxis: string;
|
|
124
|
-
range: string;
|
|
125
|
-
series: {
|
|
126
|
-
label: string;
|
|
127
|
-
points: number[];
|
|
128
|
-
}[];
|
|
129
|
-
} | {
|
|
130
|
-
type: "event";
|
|
131
|
-
summary?: string | undefined;
|
|
132
|
-
level?: string | undefined;
|
|
133
|
-
project?: string | undefined;
|
|
134
|
-
release?: string | undefined;
|
|
135
|
-
environment?: string | undefined;
|
|
136
|
-
occurredAt?: string | undefined;
|
|
137
|
-
} | {
|
|
138
|
-
type: "trace";
|
|
139
|
-
summary?: string | undefined;
|
|
140
|
-
rootOp?: string | undefined;
|
|
141
|
-
rootName?: string | undefined;
|
|
142
|
-
durationMs: number;
|
|
143
|
-
spanCount: number;
|
|
144
|
-
errorCount: number;
|
|
145
|
-
performanceIssueCount: number;
|
|
146
|
-
projects: string[];
|
|
147
|
-
spans: {
|
|
148
|
-
op?: string | undefined;
|
|
149
|
-
name: string;
|
|
150
|
-
startMs: number;
|
|
151
|
-
durationMs: number;
|
|
152
|
-
issue?: boolean | undefined;
|
|
153
|
-
}[];
|
|
154
|
-
} | {
|
|
155
|
-
type: "person";
|
|
156
|
-
summary?: string | undefined;
|
|
157
|
-
email?: string | undefined;
|
|
158
|
-
slackHandle?: string | undefined;
|
|
159
|
-
githubHandle?: string | undefined;
|
|
160
|
-
avatarUrl?: string | undefined;
|
|
161
|
-
} | undefined;
|
|
162
|
-
}[] | undefined;
|
|
163
|
-
reply?: {
|
|
164
|
-
text: string;
|
|
165
|
-
url?: string | undefined;
|
|
166
|
-
} | undefined;
|
|
167
|
-
truncated?: boolean | undefined;
|
|
168
|
-
continuation?: {
|
|
169
|
-
arguments: Record<string, unknown>;
|
|
170
|
-
reason?: string | undefined;
|
|
171
|
-
} | undefined;
|
|
172
|
-
attendees: {
|
|
173
|
-
email: string;
|
|
174
|
-
optional?: boolean | undefined;
|
|
175
|
-
response?: "accepted" | "declined" | "needsAction" | "tentative" | undefined;
|
|
176
|
-
}[];
|
|
177
|
-
end: string;
|
|
178
|
-
event_id: string;
|
|
179
|
-
label: string;
|
|
180
|
-
location?: string | undefined;
|
|
181
|
-
repeats?: boolean | undefined;
|
|
182
|
-
series_event_id?: string | undefined;
|
|
183
|
-
start: string;
|
|
184
|
-
title?: string | undefined;
|
|
185
|
-
url?: string | undefined;
|
|
186
|
-
video_call_url?: string | undefined;
|
|
187
|
-
target: "createCalendarEvent";
|
|
188
|
-
created: boolean;
|
|
189
|
-
}, {
|
|
190
|
-
[x: string]: unknown;
|
|
191
|
-
objectAnnotations?: {
|
|
192
|
-
kind: "object";
|
|
193
|
-
key: string;
|
|
194
|
-
label: string;
|
|
195
|
-
objectType: "automation" | "calendar_event" | "chart" | "code_change" | "conversation" | "deployment" | "document" | "event" | "item" | "message" | "person" | "task" | "trace" | "web_page";
|
|
196
|
-
title: string;
|
|
197
|
-
url: string | null;
|
|
198
|
-
description?: string | undefined;
|
|
199
|
-
status?: string | undefined;
|
|
200
|
-
trigger?: string | undefined;
|
|
201
|
-
warning?: string | undefined;
|
|
202
|
-
displayType?: string | undefined;
|
|
203
|
-
sourceUpdatedAt?: string | undefined;
|
|
204
|
-
facts?: {
|
|
205
|
-
type: "code_change";
|
|
206
|
-
summary?: string | undefined;
|
|
207
|
-
author?: string | undefined;
|
|
208
|
-
sourceBranch?: string | undefined;
|
|
209
|
-
targetBranch?: string | undefined;
|
|
210
|
-
reviewers?: string[] | undefined;
|
|
211
|
-
review?: "approved" | "changes_requested" | "required" | undefined;
|
|
212
|
-
checks?: {
|
|
213
|
-
passed: number;
|
|
214
|
-
failed: number;
|
|
215
|
-
pending: number;
|
|
216
|
-
} | undefined;
|
|
217
|
-
mergeable?: boolean | undefined;
|
|
218
|
-
changedFiles?: number | undefined;
|
|
219
|
-
additions?: number | undefined;
|
|
220
|
-
deletions?: number | undefined;
|
|
221
|
-
previewImageUrls?: string[] | undefined;
|
|
222
|
-
} | {
|
|
223
|
-
type: "task";
|
|
224
|
-
summary?: string | undefined;
|
|
225
|
-
assignees?: string[] | undefined;
|
|
226
|
-
priority?: string | undefined;
|
|
227
|
-
project?: string | undefined;
|
|
228
|
-
cycle?: string | undefined;
|
|
229
|
-
dueDate?: string | undefined;
|
|
230
|
-
labels?: string[] | undefined;
|
|
231
|
-
trend?: {
|
|
232
|
-
label: string;
|
|
233
|
-
points: number[];
|
|
234
|
-
} | undefined;
|
|
235
|
-
} | {
|
|
236
|
-
type: "deployment";
|
|
237
|
-
summary?: string | undefined;
|
|
238
|
-
project?: string | undefined;
|
|
239
|
-
environment?: string | undefined;
|
|
240
|
-
revision?: string | undefined;
|
|
241
|
-
branch?: string | undefined;
|
|
242
|
-
} | {
|
|
243
|
-
type: "calendar_event";
|
|
244
|
-
summary?: string | undefined;
|
|
245
|
-
when?: string | undefined;
|
|
246
|
-
attendees?: string[] | undefined;
|
|
247
|
-
} | {
|
|
248
|
-
type: "conversation";
|
|
249
|
-
summary?: string | undefined;
|
|
250
|
-
participants?: string[] | undefined;
|
|
251
|
-
lastActivityAt?: string | undefined;
|
|
252
|
-
} | {
|
|
253
|
-
type: "document";
|
|
254
|
-
summary?: string | undefined;
|
|
255
|
-
owner?: string | undefined;
|
|
256
|
-
modifiedAt?: string | undefined;
|
|
257
|
-
thumbnailUrl?: string | undefined;
|
|
258
|
-
} | {
|
|
259
|
-
type: "message";
|
|
260
|
-
summary?: string | undefined;
|
|
261
|
-
channel?: string | undefined;
|
|
262
|
-
author?: string | undefined;
|
|
263
|
-
sentAt?: string | undefined;
|
|
264
|
-
} | {
|
|
265
|
-
type: "web_page";
|
|
266
|
-
summary?: string | undefined;
|
|
267
|
-
siteName?: string | undefined;
|
|
268
|
-
author?: string | undefined;
|
|
269
|
-
media?: "image" | "video" | undefined;
|
|
270
|
-
thumbnailUrl?: string | undefined;
|
|
271
|
-
} | {
|
|
272
|
-
type: "chart";
|
|
273
|
-
summary?: string | undefined;
|
|
274
|
-
display: "area" | "bar" | "line";
|
|
275
|
-
yAxis: string;
|
|
276
|
-
range: string;
|
|
277
|
-
series: {
|
|
278
|
-
label: string;
|
|
279
|
-
points: number[];
|
|
280
|
-
}[];
|
|
281
|
-
} | {
|
|
282
|
-
type: "event";
|
|
283
|
-
summary?: string | undefined;
|
|
284
|
-
level?: string | undefined;
|
|
285
|
-
project?: string | undefined;
|
|
286
|
-
release?: string | undefined;
|
|
287
|
-
environment?: string | undefined;
|
|
288
|
-
occurredAt?: string | undefined;
|
|
289
|
-
} | {
|
|
290
|
-
type: "trace";
|
|
291
|
-
summary?: string | undefined;
|
|
292
|
-
rootOp?: string | undefined;
|
|
293
|
-
rootName?: string | undefined;
|
|
294
|
-
durationMs: number;
|
|
295
|
-
spanCount: number;
|
|
296
|
-
errorCount: number;
|
|
297
|
-
performanceIssueCount: number;
|
|
298
|
-
projects: string[];
|
|
299
|
-
spans: {
|
|
300
|
-
op?: string | undefined;
|
|
301
|
-
name: string;
|
|
302
|
-
startMs: number;
|
|
303
|
-
durationMs: number;
|
|
304
|
-
issue?: boolean | undefined;
|
|
305
|
-
}[];
|
|
306
|
-
} | {
|
|
307
|
-
type: "person";
|
|
308
|
-
summary?: string | undefined;
|
|
309
|
-
email?: string | undefined;
|
|
310
|
-
slackHandle?: string | undefined;
|
|
311
|
-
githubHandle?: string | undefined;
|
|
312
|
-
avatarUrl?: string | undefined;
|
|
313
|
-
} | undefined;
|
|
314
|
-
}[] | undefined;
|
|
315
|
-
reply?: {
|
|
316
|
-
text: string;
|
|
317
|
-
url?: string | undefined;
|
|
318
|
-
} | undefined;
|
|
319
|
-
truncated?: boolean | undefined;
|
|
320
|
-
continuation?: {
|
|
321
|
-
arguments: Record<string, unknown>;
|
|
322
|
-
reason?: string | undefined;
|
|
323
|
-
} | undefined;
|
|
324
|
-
attendees: {
|
|
325
|
-
email: string;
|
|
326
|
-
optional?: boolean | undefined;
|
|
327
|
-
response?: "accepted" | "declined" | "needsAction" | "tentative" | undefined;
|
|
328
|
-
}[];
|
|
329
|
-
end: string;
|
|
330
|
-
event_id: string;
|
|
331
|
-
label: string;
|
|
332
|
-
location?: string | undefined;
|
|
333
|
-
repeats?: boolean | undefined;
|
|
334
|
-
series_event_id?: string | undefined;
|
|
335
|
-
start: string;
|
|
336
|
-
title?: string | undefined;
|
|
337
|
-
url?: string | undefined;
|
|
338
|
-
video_call_url?: string | undefined;
|
|
339
|
-
target: "createCalendarEvent";
|
|
340
|
-
created: boolean;
|
|
341
|
-
}, GoogleToolContext>;
|
|
342
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { type ConvertedMarkdown } from "./doc-markdown";
|
|
3
|
-
import { type FileReference } from "./files";
|
|
4
|
-
import { type GoogleToolContext } from "./shared";
|
|
5
|
-
export declare const docReferenceSchema: z.ZodString;
|
|
6
|
-
export declare const markdownContentSchema: z.ZodString;
|
|
7
|
-
/** Output fields shared by the tools that write one Doc. */
|
|
8
|
-
export declare const docOutputFields: {
|
|
9
|
-
document_id: z.ZodString;
|
|
10
|
-
revision_id: z.ZodOptional<z.ZodString>;
|
|
11
|
-
title: z.ZodString;
|
|
12
|
-
url: z.ZodString;
|
|
13
|
-
};
|
|
14
|
-
/** The revision of the Doc that the agent read, required by each edit. */
|
|
15
|
-
export declare const revisionIdSchema: z.ZodString;
|
|
16
|
-
/**
|
|
17
|
-
* Refuse an edit when the Doc changed after the agent read it.
|
|
18
|
-
*
|
|
19
|
-
* The agent plans an edit from the text it read. If the Doc changed since,
|
|
20
|
-
* the edit can delete or rewrite text that the agent never saw.
|
|
21
|
-
*/
|
|
22
|
-
export declare function requireRevision(doc: {
|
|
23
|
-
title: string;
|
|
24
|
-
}, current: string, expected: string): void;
|
|
25
|
-
/** Return the editor link of a Doc. */
|
|
26
|
-
export declare function docUrl(documentId: string): string;
|
|
27
|
-
declare const docParagraphSchema: z.ZodObject<{
|
|
28
|
-
elements: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
29
|
-
textRun: z.ZodOptional<z.ZodObject<{
|
|
30
|
-
content: z.ZodString;
|
|
31
|
-
}, z.core.$strip>>;
|
|
32
|
-
}, z.core.$strip>>>;
|
|
33
|
-
}, z.core.$strip>;
|
|
34
|
-
type DocParagraph = z.infer<typeof docParagraphSchema>;
|
|
35
|
-
/** A Doc that the requester and Junior's account may both edit. */
|
|
36
|
-
interface EditableDoc {
|
|
37
|
-
ref: FileReference;
|
|
38
|
-
title: string;
|
|
39
|
-
url: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Check that Junior's account and the requester can both edit a Doc. Only the
|
|
43
|
-
* first tab of a Doc with tabs is edited.
|
|
44
|
-
*/
|
|
45
|
-
export declare function requireEditableDoc(ctx: GoogleToolContext, document: string): Promise<EditableDoc>;
|
|
46
|
-
/** Read the body layout that index-based edits need. */
|
|
47
|
-
export declare function readDocBody(ctx: GoogleToolContext, ref: FileReference): Promise<{
|
|
48
|
-
/** Index after the last character of the body, as Docs counts it. */
|
|
49
|
-
endIndex: number;
|
|
50
|
-
/** Undefined when the body starts with a table or another non-paragraph. */
|
|
51
|
-
first: DocParagraph | undefined;
|
|
52
|
-
last: DocParagraph | undefined;
|
|
53
|
-
revisionId: string;
|
|
54
|
-
}>;
|
|
55
|
-
/**
|
|
56
|
-
* True when a paragraph holds only its final newline. A paragraph with an
|
|
57
|
-
* image or another non-text element is not empty.
|
|
58
|
-
*/
|
|
59
|
-
export declare function isEmptyParagraph(paragraph: DocParagraph | undefined): boolean;
|
|
60
|
-
/** Convert tool Markdown, and refuse Markdown that writes no text. */
|
|
61
|
-
export declare function convertDocMarkdown(markdown: string): ConvertedMarkdown;
|
|
62
|
-
/**
|
|
63
|
-
* Build the Docs requests that insert converted Markdown at one index.
|
|
64
|
-
*
|
|
65
|
-
* Inserted text inherits the style and list of the paragraph it lands in, so
|
|
66
|
-
* the requests reset those. `prefix` and `suffix` are newlines that
|
|
67
|
-
* split the content from the paragraphs around it. List requests come last,
|
|
68
|
-
* from the end back: they remove the leading tabs that set nesting, which
|
|
69
|
-
* moves every later index.
|
|
70
|
-
*/
|
|
71
|
-
export declare function insertMarkdownRequests(converted: ConvertedMarkdown, input: {
|
|
72
|
-
index: number;
|
|
73
|
-
prefix: "" | "\n";
|
|
74
|
-
suffix: "" | "\n";
|
|
75
|
-
}): unknown[];
|
|
76
|
-
/** Return the revision of a Doc after a batch update, when Google sends it. */
|
|
77
|
-
export declare function revisionAfterUpdate(body: unknown): string | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Apply Docs requests. A known revision makes Google refuse the edit when
|
|
80
|
-
* someone changed the Doc after it was read, so the edit never lands on text
|
|
81
|
-
* that the agent did not see.
|
|
82
|
-
*/
|
|
83
|
-
export declare function batchUpdateDoc(ctx: GoogleToolContext, ref: FileReference, requests: unknown[], revisionId?: string): Promise<unknown>;
|
|
84
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a small Markdown subset to Google Docs text and styles.
|
|
3
|
-
*
|
|
4
|
-
* The Docs API has no Markdown import for an existing Doc, so the edit tools
|
|
5
|
-
* insert plain text and then apply styles by index. Supported: ATX headings,
|
|
6
|
-
* paragraphs, bullet and numbered lists (nested by indent), fenced code,
|
|
7
|
-
* bold, italic, inline code, and http, https, or mailto links. Other syntax,
|
|
8
|
-
* such as tables and images, stays as plain text.
|
|
9
|
-
*/
|
|
10
|
-
/** Docs named paragraph styles that the converter uses. */
|
|
11
|
-
type DocParagraphStyle = "NORMAL_TEXT" | "HEADING_1" | "HEADING_2" | "HEADING_3" | "HEADING_4" | "HEADING_5" | "HEADING_6";
|
|
12
|
-
/** A range of the converted text, in UTF-16 offsets as Docs counts them. */
|
|
13
|
-
interface Range {
|
|
14
|
-
end: number;
|
|
15
|
-
start: number;
|
|
16
|
-
}
|
|
17
|
-
interface DocTextStyle extends Range {
|
|
18
|
-
bold?: true;
|
|
19
|
-
code?: true;
|
|
20
|
-
italic?: true;
|
|
21
|
-
link?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface ConvertedMarkdown {
|
|
24
|
-
/** One list block each. Leading tabs in the text set the nesting level. */
|
|
25
|
-
lists: Array<Range & {
|
|
26
|
-
ordered: boolean;
|
|
27
|
-
}>;
|
|
28
|
-
paragraphs: Array<Range & {
|
|
29
|
-
style: DocParagraphStyle;
|
|
30
|
-
}>;
|
|
31
|
-
/** Paragraphs joined by `\n`, with no final newline. */
|
|
32
|
-
text: string;
|
|
33
|
-
textStyles: DocTextStyle[];
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Convert Markdown to Docs text, paragraph styles, text styles, and list
|
|
37
|
-
* blocks. Offsets are relative to the start of the returned text.
|
|
38
|
-
*/
|
|
39
|
-
export declare function convertMarkdown(markdown: string): ConvertedMarkdown;
|
|
40
|
-
export {};
|
package/dist/tools/files.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import type { GoogleOperation } from "../credentials";
|
|
3
|
-
import { type GoogleToolContext } from "./shared";
|
|
4
|
-
/** Google file types that the tools read, with their Drive MIME types. */
|
|
5
|
-
declare const FILE_TYPES: {
|
|
6
|
-
readonly document: {
|
|
7
|
-
readonly label: "Google Doc";
|
|
8
|
-
readonly linkRoot: "document";
|
|
9
|
-
readonly mimeType: "application/vnd.google-apps.document";
|
|
10
|
-
};
|
|
11
|
-
readonly presentation: {
|
|
12
|
-
readonly label: "Google Slides presentation";
|
|
13
|
-
readonly linkRoot: "presentation";
|
|
14
|
-
readonly mimeType: "application/vnd.google-apps.presentation";
|
|
15
|
-
};
|
|
16
|
-
readonly spreadsheet: {
|
|
17
|
-
readonly label: "Google Sheet";
|
|
18
|
-
readonly linkRoot: "spreadsheets";
|
|
19
|
-
readonly mimeType: "application/vnd.google-apps.spreadsheet";
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export type GoogleFileType = keyof typeof FILE_TYPES;
|
|
23
|
-
export declare const GOOGLE_FILE_TYPES: GoogleFileType[];
|
|
24
|
-
/** Return the Drive MIME type of one file type. */
|
|
25
|
-
export declare function googleFileMimeType(type: GoogleFileType): string;
|
|
26
|
-
/** Return the file type of a Drive MIME type, when the tools read it. */
|
|
27
|
-
export declare function googleFileType(mimeType: string): GoogleFileType | undefined;
|
|
28
|
-
/** Return the first path segment of a file type's links, such as `spreadsheets`. */
|
|
29
|
-
export declare function googleFileLinkRoot(type: GoogleFileType): string;
|
|
30
|
-
/**
|
|
31
|
-
* Return the file type that a Docs, Sheets, or Slides link names in its
|
|
32
|
-
* path, such as `/spreadsheets/d/<id>`. Other links name no type.
|
|
33
|
-
*/
|
|
34
|
-
export declare function googleLinkFileType(url: URL): GoogleFileType | undefined;
|
|
35
|
-
/** File id or link input for the tools that use one file. */
|
|
36
|
-
export declare function fileReferenceSchema(name: string): z.ZodString;
|
|
37
|
-
/** A Drive file id, as the file tools accept it. */
|
|
38
|
-
export declare const FILE_ID_PATTERN: RegExp;
|
|
39
|
-
/** One Drive file, and the resource key that a link-shared file can need. */
|
|
40
|
-
export interface FileReference {
|
|
41
|
-
fileId: string;
|
|
42
|
-
resourceKey?: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Return the file id and resource key from a file id or link.
|
|
46
|
-
*
|
|
47
|
-
* Links look like `docs.google.com/document/d/<id>/edit`,
|
|
48
|
-
* `docs.google.com/spreadsheets/d/<id>/edit`,
|
|
49
|
-
* `docs.google.com/presentation/d/<id>/edit`,
|
|
50
|
-
* `drive.google.com/file/d/<id>/view`, or `drive.google.com/open?id=<id>`.
|
|
51
|
-
* Older files shared by link also need the link's `resourcekey` value.
|
|
52
|
-
*/
|
|
53
|
-
export declare function parseFileReference(value: string): FileReference;
|
|
54
|
-
/** Return the header that carries a file's resource key, when known. */
|
|
55
|
-
export declare function resourceKeyHeaders(file: FileReference): Record<string, string>;
|
|
56
|
-
/** Call one Google operation on a file, with its resource key when known. */
|
|
57
|
-
export declare function googleFileRequest(ctx: GoogleToolContext, file: FileReference, input: {
|
|
58
|
-
body?: unknown;
|
|
59
|
-
headers?: Record<string, string>;
|
|
60
|
-
operation: GoogleOperation;
|
|
61
|
-
path: string;
|
|
62
|
-
query?: Record<string, string | string[]>;
|
|
63
|
-
}): Promise<{
|
|
64
|
-
body: unknown;
|
|
65
|
-
status: number;
|
|
66
|
-
}>;
|
|
67
|
-
/**
|
|
68
|
-
* Read the Drive metadata of one file, and require one of the given types.
|
|
69
|
-
*
|
|
70
|
-
* `drive.readonly` can read any Drive file, so each tool checks the type
|
|
71
|
-
* before it reads content or comments.
|
|
72
|
-
*/
|
|
73
|
-
export declare function readGoogleFileMetadata(ctx: GoogleToolContext, file: FileReference, types: readonly GoogleFileType[]): Promise<{
|
|
74
|
-
capabilities?: {
|
|
75
|
-
canEdit?: boolean | undefined;
|
|
76
|
-
} | undefined;
|
|
77
|
-
id: string;
|
|
78
|
-
mimeType: string;
|
|
79
|
-
modifiedTime?: string | undefined;
|
|
80
|
-
name: string;
|
|
81
|
-
webViewLink?: string | undefined;
|
|
82
|
-
type: "document" | "presentation" | "spreadsheet";
|
|
83
|
-
}>;
|
|
84
|
-
/** Optional output fields shared by the tools that read one file. */
|
|
85
|
-
export declare function fileOutputFields(file: {
|
|
86
|
-
modifiedTime?: string;
|
|
87
|
-
webViewLink?: string;
|
|
88
|
-
}): {
|
|
89
|
-
modified_at?: string | undefined;
|
|
90
|
-
url?: string | undefined;
|
|
91
|
-
};
|
|
92
|
-
/** Longest file text that one tool result returns. */
|
|
93
|
-
export declare const MAX_CONTENT_CHARS = 100000;
|
|
94
|
-
export {};
|