@sentry/junior-google 0.298.0 → 0.300.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 +39 -5
- package/dist/config.d.ts +8 -1
- package/dist/credentials.d.ts +51 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2088 -920
- package/dist/links/calendar.d.ts +11 -0
- package/dist/links/files.d.ts +11 -0
- package/dist/links/summary.d.ts +13 -0
- package/dist/tools/cancel-event.d.ts +70 -2
- package/dist/tools/create-doc.d.ts +212 -0
- package/dist/tools/create-event.d.ts +70 -2
- package/dist/tools/doc-edits.d.ts +84 -0
- package/dist/tools/doc-markdown.d.ts +40 -0
- package/dist/tools/files.d.ts +17 -1
- package/dist/tools/find-meeting-times.d.ts +70 -2
- package/dist/tools/insert-doc-content.d.ts +206 -0
- package/dist/tools/list-events.d.ts +70 -2
- package/dist/tools/list-file-comments.d.ts +70 -2
- package/dist/tools/read-doc.d.ts +12 -135
- package/dist/tools/read-file.d.ts +241 -0
- package/dist/tools/read-meeting-transcript.d.ts +70 -2
- package/dist/tools/read-sheet.d.ts +12 -138
- package/dist/tools/read-slides.d.ts +12 -137
- package/dist/tools/replace-doc-content.d.ts +205 -0
- package/dist/tools/replace-doc-text.d.ts +209 -0
- package/dist/tools/search-files.d.ts +78 -3
- package/dist/tools/shared.d.ts +36 -2
- package/dist/tools/update-event.d.ts +70 -2
- package/package.json +5 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link cards for Google Calendar events.
|
|
3
|
+
*
|
|
4
|
+
* Junior's own Google account reads the event from its own calendar, so the
|
|
5
|
+
* card shows only when the viewer organizes, created, or is invited to the
|
|
6
|
+
* event. Any unclear case gets no card. The card shows the title, the time,
|
|
7
|
+
* and the start of the description, never the guests.
|
|
8
|
+
*/
|
|
9
|
+
import type { PluginObjectLinkDefinition } from "@sentry/junior-plugin-api";
|
|
10
|
+
/** Google Calendar event links that resolve to Calendar event cards. */
|
|
11
|
+
export declare const googleCalendarLinks: PluginObjectLinkDefinition;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link cards for Google Docs, Sheets, and Slides.
|
|
3
|
+
*
|
|
4
|
+
* Junior's own Google account reads the file, so the card shows only when
|
|
5
|
+
* Drive says that the viewer can open it too. This is the rule of
|
|
6
|
+
* `searchGoogleFiles`. Any unclear case gets no card. A Doc card also shows
|
|
7
|
+
* its first paragraph.
|
|
8
|
+
*/
|
|
9
|
+
import type { PluginObjectLinkDefinition } from "@sentry/junior-plugin-api";
|
|
10
|
+
/** Docs, Sheets, and Slides links that resolve to document cards. */
|
|
11
|
+
export declare const googleFileLinks: PluginObjectLinkDefinition;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ObjectLinkContext } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { type FileReference } from "../tools/files";
|
|
3
|
+
/**
|
|
4
|
+
* Make a card summary from a Calendar event description. Calendar stores
|
|
5
|
+
* descriptions as HTML or plain text, so parse it and keep only the text.
|
|
6
|
+
*/
|
|
7
|
+
export declare function htmlSummary(html: string | undefined): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Read the first body paragraph of a Doc as a card summary. Call it only
|
|
10
|
+
* after the viewer may open the Doc. A Docs API failure gives no summary,
|
|
11
|
+
* so the card still shows.
|
|
12
|
+
*/
|
|
13
|
+
export declare function docSummary(ctx: ObjectLinkContext, file: FileReference): Promise<string | undefined>;
|
|
@@ -15,7 +15,7 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
15
15
|
kind: "object";
|
|
16
16
|
key: string;
|
|
17
17
|
label: string;
|
|
18
|
-
objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
|
|
18
|
+
objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "document" | "item" | "message" | "person" | "task" | "web_page";
|
|
19
19
|
title: string;
|
|
20
20
|
url: string | null;
|
|
21
21
|
description?: string | undefined;
|
|
@@ -26,6 +26,7 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
26
26
|
sourceUpdatedAt?: string | undefined;
|
|
27
27
|
facts?: {
|
|
28
28
|
type: "code_change";
|
|
29
|
+
summary?: string | undefined;
|
|
29
30
|
author?: string | undefined;
|
|
30
31
|
sourceBranch?: string | undefined;
|
|
31
32
|
targetBranch?: string | undefined;
|
|
@@ -40,8 +41,10 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
40
41
|
changedFiles?: number | undefined;
|
|
41
42
|
additions?: number | undefined;
|
|
42
43
|
deletions?: number | undefined;
|
|
44
|
+
previewImageUrls?: string[] | undefined;
|
|
43
45
|
} | {
|
|
44
46
|
type: "task";
|
|
47
|
+
summary?: string | undefined;
|
|
45
48
|
assignees?: string[] | undefined;
|
|
46
49
|
priority?: string | undefined;
|
|
47
50
|
project?: string | undefined;
|
|
@@ -50,14 +53,45 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
50
53
|
labels?: string[] | undefined;
|
|
51
54
|
} | {
|
|
52
55
|
type: "deployment";
|
|
56
|
+
summary?: string | undefined;
|
|
53
57
|
project?: string | undefined;
|
|
54
58
|
environment?: string | undefined;
|
|
55
59
|
revision?: string | undefined;
|
|
56
60
|
branch?: string | undefined;
|
|
57
61
|
} | {
|
|
58
62
|
type: "calendar_event";
|
|
63
|
+
summary?: string | undefined;
|
|
59
64
|
when?: string | undefined;
|
|
60
65
|
attendees?: string[] | undefined;
|
|
66
|
+
} | {
|
|
67
|
+
type: "conversation";
|
|
68
|
+
summary?: string | undefined;
|
|
69
|
+
participants?: string[] | undefined;
|
|
70
|
+
lastActivityAt?: string | undefined;
|
|
71
|
+
} | {
|
|
72
|
+
type: "document";
|
|
73
|
+
summary?: string | undefined;
|
|
74
|
+
owner?: string | undefined;
|
|
75
|
+
modifiedAt?: string | undefined;
|
|
76
|
+
} | {
|
|
77
|
+
type: "message";
|
|
78
|
+
summary?: string | undefined;
|
|
79
|
+
channel?: string | undefined;
|
|
80
|
+
author?: string | undefined;
|
|
81
|
+
sentAt?: string | undefined;
|
|
82
|
+
} | {
|
|
83
|
+
type: "web_page";
|
|
84
|
+
summary?: string | undefined;
|
|
85
|
+
siteName?: string | undefined;
|
|
86
|
+
author?: string | undefined;
|
|
87
|
+
thumbnailUrl?: string | undefined;
|
|
88
|
+
} | {
|
|
89
|
+
type: "person";
|
|
90
|
+
summary?: string | undefined;
|
|
91
|
+
email?: string | undefined;
|
|
92
|
+
slackHandle?: string | undefined;
|
|
93
|
+
githubHandle?: string | undefined;
|
|
94
|
+
avatarUrl?: string | undefined;
|
|
61
95
|
} | undefined;
|
|
62
96
|
}[] | undefined;
|
|
63
97
|
reply?: {
|
|
@@ -92,7 +126,7 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
92
126
|
kind: "object";
|
|
93
127
|
key: string;
|
|
94
128
|
label: string;
|
|
95
|
-
objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
|
|
129
|
+
objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "document" | "item" | "message" | "person" | "task" | "web_page";
|
|
96
130
|
title: string;
|
|
97
131
|
url: string | null;
|
|
98
132
|
description?: string | undefined;
|
|
@@ -103,6 +137,7 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
103
137
|
sourceUpdatedAt?: string | undefined;
|
|
104
138
|
facts?: {
|
|
105
139
|
type: "code_change";
|
|
140
|
+
summary?: string | undefined;
|
|
106
141
|
author?: string | undefined;
|
|
107
142
|
sourceBranch?: string | undefined;
|
|
108
143
|
targetBranch?: string | undefined;
|
|
@@ -117,8 +152,10 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
117
152
|
changedFiles?: number | undefined;
|
|
118
153
|
additions?: number | undefined;
|
|
119
154
|
deletions?: number | undefined;
|
|
155
|
+
previewImageUrls?: string[] | undefined;
|
|
120
156
|
} | {
|
|
121
157
|
type: "task";
|
|
158
|
+
summary?: string | undefined;
|
|
122
159
|
assignees?: string[] | undefined;
|
|
123
160
|
priority?: string | undefined;
|
|
124
161
|
project?: string | undefined;
|
|
@@ -127,14 +164,45 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
127
164
|
labels?: string[] | undefined;
|
|
128
165
|
} | {
|
|
129
166
|
type: "deployment";
|
|
167
|
+
summary?: string | undefined;
|
|
130
168
|
project?: string | undefined;
|
|
131
169
|
environment?: string | undefined;
|
|
132
170
|
revision?: string | undefined;
|
|
133
171
|
branch?: string | undefined;
|
|
134
172
|
} | {
|
|
135
173
|
type: "calendar_event";
|
|
174
|
+
summary?: string | undefined;
|
|
136
175
|
when?: string | undefined;
|
|
137
176
|
attendees?: string[] | undefined;
|
|
177
|
+
} | {
|
|
178
|
+
type: "conversation";
|
|
179
|
+
summary?: string | undefined;
|
|
180
|
+
participants?: string[] | undefined;
|
|
181
|
+
lastActivityAt?: string | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
type: "document";
|
|
184
|
+
summary?: string | undefined;
|
|
185
|
+
owner?: string | undefined;
|
|
186
|
+
modifiedAt?: string | undefined;
|
|
187
|
+
} | {
|
|
188
|
+
type: "message";
|
|
189
|
+
summary?: string | undefined;
|
|
190
|
+
channel?: string | undefined;
|
|
191
|
+
author?: string | undefined;
|
|
192
|
+
sentAt?: string | undefined;
|
|
193
|
+
} | {
|
|
194
|
+
type: "web_page";
|
|
195
|
+
summary?: string | undefined;
|
|
196
|
+
siteName?: string | undefined;
|
|
197
|
+
author?: string | undefined;
|
|
198
|
+
thumbnailUrl?: string | undefined;
|
|
199
|
+
} | {
|
|
200
|
+
type: "person";
|
|
201
|
+
summary?: string | undefined;
|
|
202
|
+
email?: string | undefined;
|
|
203
|
+
slackHandle?: string | undefined;
|
|
204
|
+
githubHandle?: string | undefined;
|
|
205
|
+
avatarUrl?: string | undefined;
|
|
138
206
|
} | undefined;
|
|
139
207
|
}[] | undefined;
|
|
140
208
|
reply?: {
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { type GoogleToolContext } from "./shared";
|
|
2
|
+
/**
|
|
3
|
+
* Create a Google Doc, write its content, then hand it to the requester.
|
|
4
|
+
*
|
|
5
|
+
* Junior's account creates the Doc, so it is the owner at first. Any file
|
|
6
|
+
* that account can open is readable through the read tools by anyone who
|
|
7
|
+
* talks to Junior. So the tool makes the requester the owner and then removes
|
|
8
|
+
* Junior's own access. Each failure after the create names the Doc and says
|
|
9
|
+
* who can still open it, so a Doc is never reported private when it is not.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createCreateGoogleDocTool(ctx: GoogleToolContext): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
12
|
+
title: string;
|
|
13
|
+
content?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
[x: string]: unknown;
|
|
16
|
+
objectAnnotations?: {
|
|
17
|
+
kind: "object";
|
|
18
|
+
key: string;
|
|
19
|
+
label: string;
|
|
20
|
+
objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "document" | "item" | "message" | "person" | "task" | "web_page";
|
|
21
|
+
title: string;
|
|
22
|
+
url: string | null;
|
|
23
|
+
description?: string | undefined;
|
|
24
|
+
status?: string | undefined;
|
|
25
|
+
trigger?: string | undefined;
|
|
26
|
+
warning?: string | undefined;
|
|
27
|
+
displayType?: string | undefined;
|
|
28
|
+
sourceUpdatedAt?: string | undefined;
|
|
29
|
+
facts?: {
|
|
30
|
+
type: "code_change";
|
|
31
|
+
summary?: string | undefined;
|
|
32
|
+
author?: string | undefined;
|
|
33
|
+
sourceBranch?: string | undefined;
|
|
34
|
+
targetBranch?: string | undefined;
|
|
35
|
+
reviewers?: string[] | undefined;
|
|
36
|
+
review?: "approved" | "changes_requested" | "required" | undefined;
|
|
37
|
+
checks?: {
|
|
38
|
+
passed: number;
|
|
39
|
+
failed: number;
|
|
40
|
+
pending: number;
|
|
41
|
+
} | undefined;
|
|
42
|
+
mergeable?: boolean | undefined;
|
|
43
|
+
changedFiles?: number | undefined;
|
|
44
|
+
additions?: number | undefined;
|
|
45
|
+
deletions?: number | undefined;
|
|
46
|
+
previewImageUrls?: string[] | undefined;
|
|
47
|
+
} | {
|
|
48
|
+
type: "task";
|
|
49
|
+
summary?: string | undefined;
|
|
50
|
+
assignees?: string[] | undefined;
|
|
51
|
+
priority?: string | undefined;
|
|
52
|
+
project?: string | undefined;
|
|
53
|
+
cycle?: string | undefined;
|
|
54
|
+
dueDate?: string | undefined;
|
|
55
|
+
labels?: string[] | undefined;
|
|
56
|
+
} | {
|
|
57
|
+
type: "deployment";
|
|
58
|
+
summary?: string | undefined;
|
|
59
|
+
project?: string | undefined;
|
|
60
|
+
environment?: string | undefined;
|
|
61
|
+
revision?: string | undefined;
|
|
62
|
+
branch?: string | undefined;
|
|
63
|
+
} | {
|
|
64
|
+
type: "calendar_event";
|
|
65
|
+
summary?: string | undefined;
|
|
66
|
+
when?: string | undefined;
|
|
67
|
+
attendees?: string[] | undefined;
|
|
68
|
+
} | {
|
|
69
|
+
type: "conversation";
|
|
70
|
+
summary?: string | undefined;
|
|
71
|
+
participants?: string[] | undefined;
|
|
72
|
+
lastActivityAt?: string | undefined;
|
|
73
|
+
} | {
|
|
74
|
+
type: "document";
|
|
75
|
+
summary?: string | undefined;
|
|
76
|
+
owner?: string | undefined;
|
|
77
|
+
modifiedAt?: string | undefined;
|
|
78
|
+
} | {
|
|
79
|
+
type: "message";
|
|
80
|
+
summary?: string | undefined;
|
|
81
|
+
channel?: string | undefined;
|
|
82
|
+
author?: string | undefined;
|
|
83
|
+
sentAt?: string | undefined;
|
|
84
|
+
} | {
|
|
85
|
+
type: "web_page";
|
|
86
|
+
summary?: string | undefined;
|
|
87
|
+
siteName?: string | undefined;
|
|
88
|
+
author?: string | undefined;
|
|
89
|
+
thumbnailUrl?: string | undefined;
|
|
90
|
+
} | {
|
|
91
|
+
type: "person";
|
|
92
|
+
summary?: string | undefined;
|
|
93
|
+
email?: string | undefined;
|
|
94
|
+
slackHandle?: string | undefined;
|
|
95
|
+
githubHandle?: string | undefined;
|
|
96
|
+
avatarUrl?: string | undefined;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}[] | undefined;
|
|
99
|
+
reply?: {
|
|
100
|
+
text: string;
|
|
101
|
+
url?: string | undefined;
|
|
102
|
+
} | undefined;
|
|
103
|
+
truncated?: boolean | undefined;
|
|
104
|
+
continuation?: {
|
|
105
|
+
arguments: Record<string, unknown>;
|
|
106
|
+
reason?: string | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
document_id: string;
|
|
109
|
+
revision_id?: string | undefined;
|
|
110
|
+
title: string;
|
|
111
|
+
url: string;
|
|
112
|
+
target: "createGoogleDoc";
|
|
113
|
+
}, {
|
|
114
|
+
[x: string]: unknown;
|
|
115
|
+
objectAnnotations?: {
|
|
116
|
+
kind: "object";
|
|
117
|
+
key: string;
|
|
118
|
+
label: string;
|
|
119
|
+
objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "document" | "item" | "message" | "person" | "task" | "web_page";
|
|
120
|
+
title: string;
|
|
121
|
+
url: string | null;
|
|
122
|
+
description?: string | undefined;
|
|
123
|
+
status?: string | undefined;
|
|
124
|
+
trigger?: string | undefined;
|
|
125
|
+
warning?: string | undefined;
|
|
126
|
+
displayType?: string | undefined;
|
|
127
|
+
sourceUpdatedAt?: string | undefined;
|
|
128
|
+
facts?: {
|
|
129
|
+
type: "code_change";
|
|
130
|
+
summary?: string | undefined;
|
|
131
|
+
author?: string | undefined;
|
|
132
|
+
sourceBranch?: string | undefined;
|
|
133
|
+
targetBranch?: string | undefined;
|
|
134
|
+
reviewers?: string[] | undefined;
|
|
135
|
+
review?: "approved" | "changes_requested" | "required" | undefined;
|
|
136
|
+
checks?: {
|
|
137
|
+
passed: number;
|
|
138
|
+
failed: number;
|
|
139
|
+
pending: number;
|
|
140
|
+
} | undefined;
|
|
141
|
+
mergeable?: boolean | undefined;
|
|
142
|
+
changedFiles?: number | undefined;
|
|
143
|
+
additions?: number | undefined;
|
|
144
|
+
deletions?: number | undefined;
|
|
145
|
+
previewImageUrls?: string[] | undefined;
|
|
146
|
+
} | {
|
|
147
|
+
type: "task";
|
|
148
|
+
summary?: string | undefined;
|
|
149
|
+
assignees?: string[] | undefined;
|
|
150
|
+
priority?: string | undefined;
|
|
151
|
+
project?: string | undefined;
|
|
152
|
+
cycle?: string | undefined;
|
|
153
|
+
dueDate?: string | undefined;
|
|
154
|
+
labels?: string[] | undefined;
|
|
155
|
+
} | {
|
|
156
|
+
type: "deployment";
|
|
157
|
+
summary?: string | undefined;
|
|
158
|
+
project?: string | undefined;
|
|
159
|
+
environment?: string | undefined;
|
|
160
|
+
revision?: string | undefined;
|
|
161
|
+
branch?: string | undefined;
|
|
162
|
+
} | {
|
|
163
|
+
type: "calendar_event";
|
|
164
|
+
summary?: string | undefined;
|
|
165
|
+
when?: string | undefined;
|
|
166
|
+
attendees?: string[] | undefined;
|
|
167
|
+
} | {
|
|
168
|
+
type: "conversation";
|
|
169
|
+
summary?: string | undefined;
|
|
170
|
+
participants?: string[] | undefined;
|
|
171
|
+
lastActivityAt?: string | undefined;
|
|
172
|
+
} | {
|
|
173
|
+
type: "document";
|
|
174
|
+
summary?: string | undefined;
|
|
175
|
+
owner?: string | undefined;
|
|
176
|
+
modifiedAt?: string | undefined;
|
|
177
|
+
} | {
|
|
178
|
+
type: "message";
|
|
179
|
+
summary?: string | undefined;
|
|
180
|
+
channel?: string | undefined;
|
|
181
|
+
author?: string | undefined;
|
|
182
|
+
sentAt?: string | undefined;
|
|
183
|
+
} | {
|
|
184
|
+
type: "web_page";
|
|
185
|
+
summary?: string | undefined;
|
|
186
|
+
siteName?: string | undefined;
|
|
187
|
+
author?: string | undefined;
|
|
188
|
+
thumbnailUrl?: string | undefined;
|
|
189
|
+
} | {
|
|
190
|
+
type: "person";
|
|
191
|
+
summary?: string | undefined;
|
|
192
|
+
email?: string | undefined;
|
|
193
|
+
slackHandle?: string | undefined;
|
|
194
|
+
githubHandle?: string | undefined;
|
|
195
|
+
avatarUrl?: string | undefined;
|
|
196
|
+
} | undefined;
|
|
197
|
+
}[] | undefined;
|
|
198
|
+
reply?: {
|
|
199
|
+
text: string;
|
|
200
|
+
url?: string | undefined;
|
|
201
|
+
} | undefined;
|
|
202
|
+
truncated?: boolean | undefined;
|
|
203
|
+
continuation?: {
|
|
204
|
+
arguments: Record<string, unknown>;
|
|
205
|
+
reason?: string | undefined;
|
|
206
|
+
} | undefined;
|
|
207
|
+
document_id: string;
|
|
208
|
+
revision_id?: string | undefined;
|
|
209
|
+
title: string;
|
|
210
|
+
url: string;
|
|
211
|
+
target: "createGoogleDoc";
|
|
212
|
+
}>;
|
|
@@ -40,7 +40,7 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
40
40
|
kind: "object";
|
|
41
41
|
key: string;
|
|
42
42
|
label: string;
|
|
43
|
-
objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
|
|
43
|
+
objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "document" | "item" | "message" | "person" | "task" | "web_page";
|
|
44
44
|
title: string;
|
|
45
45
|
url: string | null;
|
|
46
46
|
description?: string | undefined;
|
|
@@ -51,6 +51,7 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
51
51
|
sourceUpdatedAt?: string | undefined;
|
|
52
52
|
facts?: {
|
|
53
53
|
type: "code_change";
|
|
54
|
+
summary?: string | undefined;
|
|
54
55
|
author?: string | undefined;
|
|
55
56
|
sourceBranch?: string | undefined;
|
|
56
57
|
targetBranch?: string | undefined;
|
|
@@ -65,8 +66,10 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
65
66
|
changedFiles?: number | undefined;
|
|
66
67
|
additions?: number | undefined;
|
|
67
68
|
deletions?: number | undefined;
|
|
69
|
+
previewImageUrls?: string[] | undefined;
|
|
68
70
|
} | {
|
|
69
71
|
type: "task";
|
|
72
|
+
summary?: string | undefined;
|
|
70
73
|
assignees?: string[] | undefined;
|
|
71
74
|
priority?: string | undefined;
|
|
72
75
|
project?: string | undefined;
|
|
@@ -75,14 +78,45 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
75
78
|
labels?: string[] | undefined;
|
|
76
79
|
} | {
|
|
77
80
|
type: "deployment";
|
|
81
|
+
summary?: string | undefined;
|
|
78
82
|
project?: string | undefined;
|
|
79
83
|
environment?: string | undefined;
|
|
80
84
|
revision?: string | undefined;
|
|
81
85
|
branch?: string | undefined;
|
|
82
86
|
} | {
|
|
83
87
|
type: "calendar_event";
|
|
88
|
+
summary?: string | undefined;
|
|
84
89
|
when?: string | undefined;
|
|
85
90
|
attendees?: string[] | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
type: "conversation";
|
|
93
|
+
summary?: string | undefined;
|
|
94
|
+
participants?: string[] | undefined;
|
|
95
|
+
lastActivityAt?: string | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
type: "document";
|
|
98
|
+
summary?: string | undefined;
|
|
99
|
+
owner?: string | undefined;
|
|
100
|
+
modifiedAt?: string | undefined;
|
|
101
|
+
} | {
|
|
102
|
+
type: "message";
|
|
103
|
+
summary?: string | undefined;
|
|
104
|
+
channel?: string | undefined;
|
|
105
|
+
author?: string | undefined;
|
|
106
|
+
sentAt?: string | undefined;
|
|
107
|
+
} | {
|
|
108
|
+
type: "web_page";
|
|
109
|
+
summary?: string | undefined;
|
|
110
|
+
siteName?: string | undefined;
|
|
111
|
+
author?: string | undefined;
|
|
112
|
+
thumbnailUrl?: string | undefined;
|
|
113
|
+
} | {
|
|
114
|
+
type: "person";
|
|
115
|
+
summary?: string | undefined;
|
|
116
|
+
email?: string | undefined;
|
|
117
|
+
slackHandle?: string | undefined;
|
|
118
|
+
githubHandle?: string | undefined;
|
|
119
|
+
avatarUrl?: string | undefined;
|
|
86
120
|
} | undefined;
|
|
87
121
|
}[] | undefined;
|
|
88
122
|
reply?: {
|
|
@@ -117,7 +151,7 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
117
151
|
kind: "object";
|
|
118
152
|
key: string;
|
|
119
153
|
label: string;
|
|
120
|
-
objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
|
|
154
|
+
objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "document" | "item" | "message" | "person" | "task" | "web_page";
|
|
121
155
|
title: string;
|
|
122
156
|
url: string | null;
|
|
123
157
|
description?: string | undefined;
|
|
@@ -128,6 +162,7 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
128
162
|
sourceUpdatedAt?: string | undefined;
|
|
129
163
|
facts?: {
|
|
130
164
|
type: "code_change";
|
|
165
|
+
summary?: string | undefined;
|
|
131
166
|
author?: string | undefined;
|
|
132
167
|
sourceBranch?: string | undefined;
|
|
133
168
|
targetBranch?: string | undefined;
|
|
@@ -142,8 +177,10 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
142
177
|
changedFiles?: number | undefined;
|
|
143
178
|
additions?: number | undefined;
|
|
144
179
|
deletions?: number | undefined;
|
|
180
|
+
previewImageUrls?: string[] | undefined;
|
|
145
181
|
} | {
|
|
146
182
|
type: "task";
|
|
183
|
+
summary?: string | undefined;
|
|
147
184
|
assignees?: string[] | undefined;
|
|
148
185
|
priority?: string | undefined;
|
|
149
186
|
project?: string | undefined;
|
|
@@ -152,14 +189,45 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
|
|
|
152
189
|
labels?: string[] | undefined;
|
|
153
190
|
} | {
|
|
154
191
|
type: "deployment";
|
|
192
|
+
summary?: string | undefined;
|
|
155
193
|
project?: string | undefined;
|
|
156
194
|
environment?: string | undefined;
|
|
157
195
|
revision?: string | undefined;
|
|
158
196
|
branch?: string | undefined;
|
|
159
197
|
} | {
|
|
160
198
|
type: "calendar_event";
|
|
199
|
+
summary?: string | undefined;
|
|
161
200
|
when?: string | undefined;
|
|
162
201
|
attendees?: string[] | undefined;
|
|
202
|
+
} | {
|
|
203
|
+
type: "conversation";
|
|
204
|
+
summary?: string | undefined;
|
|
205
|
+
participants?: string[] | undefined;
|
|
206
|
+
lastActivityAt?: string | undefined;
|
|
207
|
+
} | {
|
|
208
|
+
type: "document";
|
|
209
|
+
summary?: string | undefined;
|
|
210
|
+
owner?: string | undefined;
|
|
211
|
+
modifiedAt?: string | undefined;
|
|
212
|
+
} | {
|
|
213
|
+
type: "message";
|
|
214
|
+
summary?: string | undefined;
|
|
215
|
+
channel?: string | undefined;
|
|
216
|
+
author?: string | undefined;
|
|
217
|
+
sentAt?: string | undefined;
|
|
218
|
+
} | {
|
|
219
|
+
type: "web_page";
|
|
220
|
+
summary?: string | undefined;
|
|
221
|
+
siteName?: string | undefined;
|
|
222
|
+
author?: string | undefined;
|
|
223
|
+
thumbnailUrl?: string | undefined;
|
|
224
|
+
} | {
|
|
225
|
+
type: "person";
|
|
226
|
+
summary?: string | undefined;
|
|
227
|
+
email?: string | undefined;
|
|
228
|
+
slackHandle?: string | undefined;
|
|
229
|
+
githubHandle?: string | undefined;
|
|
230
|
+
avatarUrl?: string | undefined;
|
|
163
231
|
} | undefined;
|
|
164
232
|
}[] | undefined;
|
|
165
233
|
reply?: {
|
|
@@ -0,0 +1,84 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,40 @@
|
|
|
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 {};
|