@sentry/junior-google 0.297.0 → 0.299.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.
@@ -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" | "item" | "message" | "person" | "task";
19
19
  title: string;
20
20
  url: string | null;
21
21
  description?: string | undefined;
@@ -40,6 +40,7 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
40
40
  changedFiles?: number | undefined;
41
41
  additions?: number | undefined;
42
42
  deletions?: number | undefined;
43
+ previewImageUrls?: string[] | undefined;
43
44
  } | {
44
45
  type: "task";
45
46
  assignees?: string[] | undefined;
@@ -58,6 +59,21 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
58
59
  type: "calendar_event";
59
60
  when?: string | undefined;
60
61
  attendees?: string[] | undefined;
62
+ } | {
63
+ type: "conversation";
64
+ participants?: string[] | undefined;
65
+ lastActivityAt?: string | undefined;
66
+ } | {
67
+ type: "message";
68
+ channel?: string | undefined;
69
+ author?: string | undefined;
70
+ sentAt?: string | undefined;
71
+ } | {
72
+ type: "person";
73
+ email?: string | undefined;
74
+ slackHandle?: string | undefined;
75
+ githubHandle?: string | undefined;
76
+ avatarUrl?: string | undefined;
61
77
  } | undefined;
62
78
  }[] | undefined;
63
79
  reply?: {
@@ -92,7 +108,7 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
92
108
  kind: "object";
93
109
  key: string;
94
110
  label: string;
95
- objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
111
+ objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "item" | "message" | "person" | "task";
96
112
  title: string;
97
113
  url: string | null;
98
114
  description?: string | undefined;
@@ -117,6 +133,7 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
117
133
  changedFiles?: number | undefined;
118
134
  additions?: number | undefined;
119
135
  deletions?: number | undefined;
136
+ previewImageUrls?: string[] | undefined;
120
137
  } | {
121
138
  type: "task";
122
139
  assignees?: string[] | undefined;
@@ -135,6 +152,21 @@ export declare function createCancelCalendarEventTool(ctx: GoogleToolContext): i
135
152
  type: "calendar_event";
136
153
  when?: string | undefined;
137
154
  attendees?: string[] | undefined;
155
+ } | {
156
+ type: "conversation";
157
+ participants?: string[] | undefined;
158
+ lastActivityAt?: string | undefined;
159
+ } | {
160
+ type: "message";
161
+ channel?: string | undefined;
162
+ author?: string | undefined;
163
+ sentAt?: string | undefined;
164
+ } | {
165
+ type: "person";
166
+ email?: string | undefined;
167
+ slackHandle?: string | undefined;
168
+ githubHandle?: string | undefined;
169
+ avatarUrl?: string | undefined;
138
170
  } | undefined;
139
171
  }[] | undefined;
140
172
  reply?: {
@@ -0,0 +1,176 @@
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" | "item" | "message" | "person" | "task";
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
+ author?: string | undefined;
32
+ sourceBranch?: string | undefined;
33
+ targetBranch?: string | undefined;
34
+ reviewers?: string[] | undefined;
35
+ review?: "approved" | "changes_requested" | "required" | undefined;
36
+ checks?: {
37
+ passed: number;
38
+ failed: number;
39
+ pending: number;
40
+ } | undefined;
41
+ mergeable?: boolean | undefined;
42
+ changedFiles?: number | undefined;
43
+ additions?: number | undefined;
44
+ deletions?: number | undefined;
45
+ previewImageUrls?: string[] | undefined;
46
+ } | {
47
+ type: "task";
48
+ assignees?: string[] | undefined;
49
+ priority?: string | undefined;
50
+ project?: string | undefined;
51
+ cycle?: string | undefined;
52
+ dueDate?: string | undefined;
53
+ labels?: string[] | undefined;
54
+ } | {
55
+ type: "deployment";
56
+ project?: string | undefined;
57
+ environment?: string | undefined;
58
+ revision?: string | undefined;
59
+ branch?: string | undefined;
60
+ } | {
61
+ type: "calendar_event";
62
+ when?: string | undefined;
63
+ attendees?: string[] | undefined;
64
+ } | {
65
+ type: "conversation";
66
+ participants?: string[] | undefined;
67
+ lastActivityAt?: string | undefined;
68
+ } | {
69
+ type: "message";
70
+ channel?: string | undefined;
71
+ author?: string | undefined;
72
+ sentAt?: string | undefined;
73
+ } | {
74
+ type: "person";
75
+ email?: string | undefined;
76
+ slackHandle?: string | undefined;
77
+ githubHandle?: string | undefined;
78
+ avatarUrl?: string | undefined;
79
+ } | undefined;
80
+ }[] | undefined;
81
+ reply?: {
82
+ text: string;
83
+ url?: string | undefined;
84
+ } | undefined;
85
+ truncated?: boolean | undefined;
86
+ continuation?: {
87
+ arguments: Record<string, unknown>;
88
+ reason?: string | undefined;
89
+ } | undefined;
90
+ document_id: string;
91
+ revision_id?: string | undefined;
92
+ title: string;
93
+ url: string;
94
+ target: "createGoogleDoc";
95
+ }, {
96
+ [x: string]: unknown;
97
+ objectAnnotations?: {
98
+ kind: "object";
99
+ key: string;
100
+ label: string;
101
+ objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "item" | "message" | "person" | "task";
102
+ title: string;
103
+ url: string | null;
104
+ description?: string | undefined;
105
+ status?: string | undefined;
106
+ trigger?: string | undefined;
107
+ warning?: string | undefined;
108
+ displayType?: string | undefined;
109
+ sourceUpdatedAt?: string | undefined;
110
+ facts?: {
111
+ type: "code_change";
112
+ author?: string | undefined;
113
+ sourceBranch?: string | undefined;
114
+ targetBranch?: string | undefined;
115
+ reviewers?: string[] | undefined;
116
+ review?: "approved" | "changes_requested" | "required" | undefined;
117
+ checks?: {
118
+ passed: number;
119
+ failed: number;
120
+ pending: number;
121
+ } | undefined;
122
+ mergeable?: boolean | undefined;
123
+ changedFiles?: number | undefined;
124
+ additions?: number | undefined;
125
+ deletions?: number | undefined;
126
+ previewImageUrls?: string[] | undefined;
127
+ } | {
128
+ type: "task";
129
+ assignees?: string[] | undefined;
130
+ priority?: string | undefined;
131
+ project?: string | undefined;
132
+ cycle?: string | undefined;
133
+ dueDate?: string | undefined;
134
+ labels?: string[] | undefined;
135
+ } | {
136
+ type: "deployment";
137
+ project?: string | undefined;
138
+ environment?: string | undefined;
139
+ revision?: string | undefined;
140
+ branch?: string | undefined;
141
+ } | {
142
+ type: "calendar_event";
143
+ when?: string | undefined;
144
+ attendees?: string[] | undefined;
145
+ } | {
146
+ type: "conversation";
147
+ participants?: string[] | undefined;
148
+ lastActivityAt?: string | undefined;
149
+ } | {
150
+ type: "message";
151
+ channel?: string | undefined;
152
+ author?: string | undefined;
153
+ sentAt?: string | undefined;
154
+ } | {
155
+ type: "person";
156
+ email?: string | undefined;
157
+ slackHandle?: string | undefined;
158
+ githubHandle?: string | undefined;
159
+ avatarUrl?: string | undefined;
160
+ } | undefined;
161
+ }[] | undefined;
162
+ reply?: {
163
+ text: string;
164
+ url?: string | undefined;
165
+ } | undefined;
166
+ truncated?: boolean | undefined;
167
+ continuation?: {
168
+ arguments: Record<string, unknown>;
169
+ reason?: string | undefined;
170
+ } | undefined;
171
+ document_id: string;
172
+ revision_id?: string | undefined;
173
+ title: string;
174
+ url: string;
175
+ target: "createGoogleDoc";
176
+ }>;
@@ -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" | "item" | "message" | "person" | "task";
44
44
  title: string;
45
45
  url: string | null;
46
46
  description?: string | undefined;
@@ -65,6 +65,7 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
65
65
  changedFiles?: number | undefined;
66
66
  additions?: number | undefined;
67
67
  deletions?: number | undefined;
68
+ previewImageUrls?: string[] | undefined;
68
69
  } | {
69
70
  type: "task";
70
71
  assignees?: string[] | undefined;
@@ -83,6 +84,21 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
83
84
  type: "calendar_event";
84
85
  when?: string | undefined;
85
86
  attendees?: string[] | undefined;
87
+ } | {
88
+ type: "conversation";
89
+ participants?: string[] | undefined;
90
+ lastActivityAt?: string | undefined;
91
+ } | {
92
+ type: "message";
93
+ channel?: string | undefined;
94
+ author?: string | undefined;
95
+ sentAt?: string | undefined;
96
+ } | {
97
+ type: "person";
98
+ email?: string | undefined;
99
+ slackHandle?: string | undefined;
100
+ githubHandle?: string | undefined;
101
+ avatarUrl?: string | undefined;
86
102
  } | undefined;
87
103
  }[] | undefined;
88
104
  reply?: {
@@ -117,7 +133,7 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
117
133
  kind: "object";
118
134
  key: string;
119
135
  label: string;
120
- objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
136
+ objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "item" | "message" | "person" | "task";
121
137
  title: string;
122
138
  url: string | null;
123
139
  description?: string | undefined;
@@ -142,6 +158,7 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
142
158
  changedFiles?: number | undefined;
143
159
  additions?: number | undefined;
144
160
  deletions?: number | undefined;
161
+ previewImageUrls?: string[] | undefined;
145
162
  } | {
146
163
  type: "task";
147
164
  assignees?: string[] | undefined;
@@ -160,6 +177,21 @@ export declare function createCreateCalendarEventTool(ctx: GoogleToolContext): i
160
177
  type: "calendar_event";
161
178
  when?: string | undefined;
162
179
  attendees?: string[] | undefined;
180
+ } | {
181
+ type: "conversation";
182
+ participants?: string[] | undefined;
183
+ lastActivityAt?: string | undefined;
184
+ } | {
185
+ type: "message";
186
+ channel?: string | undefined;
187
+ author?: string | undefined;
188
+ sentAt?: string | undefined;
189
+ } | {
190
+ type: "person";
191
+ email?: string | undefined;
192
+ slackHandle?: string | undefined;
193
+ githubHandle?: string | undefined;
194
+ avatarUrl?: string | undefined;
163
195
  } | undefined;
164
196
  }[] | undefined;
165
197
  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 {};
@@ -41,8 +41,11 @@ export interface FileReference {
41
41
  * Older files shared by link also need the link's `resourcekey` value.
42
42
  */
43
43
  export declare function parseFileReference(value: string): FileReference;
44
+ /** Return the header that carries a file's resource key, when known. */
45
+ export declare function resourceKeyHeaders(file: FileReference): Record<string, string>;
44
46
  /** Call one Google operation on a file, with its resource key when known. */
45
47
  export declare function googleFileRequest(ctx: GoogleToolContext, file: FileReference, input: {
48
+ body?: unknown;
46
49
  headers?: Record<string, string>;
47
50
  operation: GoogleOperation;
48
51
  path: string;
@@ -58,6 +61,9 @@ export declare function googleFileRequest(ctx: GoogleToolContext, file: FileRefe
58
61
  * before it reads content or comments.
59
62
  */
60
63
  export declare function readGoogleFile(ctx: GoogleToolContext, file: FileReference, types: readonly GoogleFileType[]): Promise<{
64
+ capabilities?: {
65
+ canEdit?: boolean | undefined;
66
+ } | undefined;
61
67
  id: string;
62
68
  mimeType: string;
63
69
  modifiedTime?: string | undefined;
@@ -84,7 +84,7 @@ export declare function createFindMeetingTimesTool(ctx: GoogleToolContext): impo
84
84
  kind: "object";
85
85
  key: string;
86
86
  label: string;
87
- objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
87
+ objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "item" | "message" | "person" | "task";
88
88
  title: string;
89
89
  url: string | null;
90
90
  description?: string | undefined;
@@ -109,6 +109,7 @@ export declare function createFindMeetingTimesTool(ctx: GoogleToolContext): impo
109
109
  changedFiles?: number | undefined;
110
110
  additions?: number | undefined;
111
111
  deletions?: number | undefined;
112
+ previewImageUrls?: string[] | undefined;
112
113
  } | {
113
114
  type: "task";
114
115
  assignees?: string[] | undefined;
@@ -127,6 +128,21 @@ export declare function createFindMeetingTimesTool(ctx: GoogleToolContext): impo
127
128
  type: "calendar_event";
128
129
  when?: string | undefined;
129
130
  attendees?: string[] | undefined;
131
+ } | {
132
+ type: "conversation";
133
+ participants?: string[] | undefined;
134
+ lastActivityAt?: string | undefined;
135
+ } | {
136
+ type: "message";
137
+ channel?: string | undefined;
138
+ author?: string | undefined;
139
+ sentAt?: string | undefined;
140
+ } | {
141
+ type: "person";
142
+ email?: string | undefined;
143
+ slackHandle?: string | undefined;
144
+ githubHandle?: string | undefined;
145
+ avatarUrl?: string | undefined;
130
146
  } | undefined;
131
147
  }[] | undefined;
132
148
  reply?: {
@@ -161,7 +177,7 @@ export declare function createFindMeetingTimesTool(ctx: GoogleToolContext): impo
161
177
  kind: "object";
162
178
  key: string;
163
179
  label: string;
164
- objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
180
+ objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "item" | "message" | "person" | "task";
165
181
  title: string;
166
182
  url: string | null;
167
183
  description?: string | undefined;
@@ -186,6 +202,7 @@ export declare function createFindMeetingTimesTool(ctx: GoogleToolContext): impo
186
202
  changedFiles?: number | undefined;
187
203
  additions?: number | undefined;
188
204
  deletions?: number | undefined;
205
+ previewImageUrls?: string[] | undefined;
189
206
  } | {
190
207
  type: "task";
191
208
  assignees?: string[] | undefined;
@@ -204,6 +221,21 @@ export declare function createFindMeetingTimesTool(ctx: GoogleToolContext): impo
204
221
  type: "calendar_event";
205
222
  when?: string | undefined;
206
223
  attendees?: string[] | undefined;
224
+ } | {
225
+ type: "conversation";
226
+ participants?: string[] | undefined;
227
+ lastActivityAt?: string | undefined;
228
+ } | {
229
+ type: "message";
230
+ channel?: string | undefined;
231
+ author?: string | undefined;
232
+ sentAt?: string | undefined;
233
+ } | {
234
+ type: "person";
235
+ email?: string | undefined;
236
+ slackHandle?: string | undefined;
237
+ githubHandle?: string | undefined;
238
+ avatarUrl?: string | undefined;
207
239
  } | undefined;
208
240
  }[] | undefined;
209
241
  reply?: {