@sentry/junior-google 0.238.1 → 0.240.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.
@@ -3,16 +3,21 @@ import { z } from "zod";
3
3
  import { type GoogleOperation } from "../credentials";
4
4
  /** Runtime capabilities the Calendar tools use. */
5
5
  export interface GoogleToolContext {
6
+ /** The Workspace account Junior acts as, in lowercase. */
7
+ accountEmail: string;
6
8
  allowedDomains: string[];
7
9
  egress: PluginEgress;
8
10
  users: {
9
11
  resolveActor(): Promise<{
10
12
  user?: User;
11
13
  } | undefined>;
14
+ resolveTimezone(): Promise<string>;
12
15
  };
13
16
  }
14
17
  export declare const emailListSchema: (max: number) => z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>;
15
- export declare const timeZoneSchema: z.ZodString;
18
+ export declare const timeZoneSchema: z.ZodOptional<z.ZodString>;
19
+ /** True when the runtime knows this IANA time zone. */
20
+ export declare function isTimeZone(value: string): boolean;
16
21
  /** Reject people outside the domains Junior may look up or invite. */
17
22
  export declare function requireAllowedEmails(emails: string[], allowedDomains: string[]): void;
18
23
  /** Return the requester's email in lowercase, when Junior knows it. */
@@ -41,32 +46,124 @@ export declare function googleApiError(operation: GoogleOperation, response: {
41
46
  export declare function formatInterval(startMs: number, endMs: number, timeZone: string): string;
42
47
  /** Longest event Junior may create or move an event to. */
43
48
  export declare const MAX_EVENT_MS: number;
49
+ /** Google attendee fields that tools read and return. */
50
+ export declare const googleAttendeeSchema: z.ZodObject<{
51
+ displayName: z.ZodOptional<z.ZodString>;
52
+ email: z.ZodString;
53
+ optional: z.ZodOptional<z.ZodBoolean>;
54
+ resource: z.ZodOptional<z.ZodBoolean>;
55
+ responseStatus: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$loose>;
57
+ /** One attendee in a tool result. */
58
+ export declare const attendeeOutputSchema: z.ZodObject<{
59
+ email: z.ZodString;
60
+ optional: z.ZodOptional<z.ZodBoolean>;
61
+ response: z.ZodOptional<z.ZodEnum<{
62
+ accepted: "accepted";
63
+ declined: "declined";
64
+ tentative: "tentative";
65
+ needsAction: "needsAction";
66
+ }>>;
67
+ }, z.core.$strip>;
68
+ /** Shape Google attendees for a tool result. Room resources are left out. */
69
+ export declare function attendeeResults(attendees: Array<z.infer<typeof googleAttendeeSchema>> | undefined): Array<z.infer<typeof attendeeOutputSchema>>;
44
70
  /** Event fields that Junior reads back from its own calendar. */
45
71
  export declare const ownEventSchema: z.ZodObject<{
46
72
  attendees: z.ZodOptional<z.ZodArray<z.ZodObject<{
73
+ displayName: z.ZodOptional<z.ZodString>;
47
74
  email: z.ZodString;
75
+ optional: z.ZodOptional<z.ZodBoolean>;
76
+ resource: z.ZodOptional<z.ZodBoolean>;
48
77
  responseStatus: z.ZodOptional<z.ZodString>;
49
78
  }, z.core.$loose>>>;
79
+ description: z.ZodOptional<z.ZodString>;
50
80
  end: z.ZodObject<{
51
81
  dateTime: z.ZodString;
52
82
  }, z.core.$strip>;
53
83
  hangoutLink: z.ZodOptional<z.ZodString>;
54
84
  htmlLink: z.ZodOptional<z.ZodString>;
55
85
  id: z.ZodString;
86
+ location: z.ZodOptional<z.ZodString>;
56
87
  organizer: z.ZodOptional<z.ZodObject<{
57
88
  self: z.ZodOptional<z.ZodBoolean>;
58
89
  }, z.core.$strip>>;
90
+ recurrence: z.ZodOptional<z.ZodArray<z.ZodString>>;
91
+ recurringEventId: z.ZodOptional<z.ZodString>;
59
92
  start: z.ZodObject<{
60
93
  dateTime: z.ZodString;
61
94
  }, z.core.$strip>;
62
95
  summary: z.ZodOptional<z.ZodString>;
96
+ updated: z.ZodOptional<z.ZodString>;
63
97
  }, z.core.$strip>;
64
- /** Shape one event on Junior's calendar for a tool result. */
65
- export declare function ownEventResult(event: z.infer<typeof ownEventSchema>, timeZone: string): {
98
+ export type OwnEvent = z.infer<typeof ownEventSchema>;
99
+ /**
100
+ * Shape one event on Junior's calendar for a tool result.
101
+ *
102
+ * Core saves the Calendar event annotation and shows its card with the next
103
+ * reply. The event id is the key, so a change replaces the saved card. The
104
+ * label is the short date for the sidebar; the card shows the full time.
105
+ */
106
+ export declare function ownEventResult(event: OwnEvent, timeZone: string): {
66
107
  videoCallUrl?: string | undefined;
67
108
  url?: string | undefined;
109
+ seriesEventId?: string | undefined;
110
+ repeats?: boolean | undefined;
111
+ location?: string | undefined;
68
112
  title?: string | undefined;
69
- attendees: string[];
113
+ objectAnnotations: {
114
+ kind: "object";
115
+ key: string;
116
+ label: string;
117
+ objectType: "code_change" | "task" | "deployment" | "calendar_event" | "automation" | "item";
118
+ title: string;
119
+ url: string | null;
120
+ description?: string | undefined;
121
+ status?: string | undefined;
122
+ trigger?: string | undefined;
123
+ warning?: string | undefined;
124
+ displayType?: string | undefined;
125
+ sourceUpdatedAt?: string | undefined;
126
+ facts?: {
127
+ type: "code_change";
128
+ author?: string | undefined;
129
+ sourceBranch?: string | undefined;
130
+ targetBranch?: string | undefined;
131
+ reviewers?: string[] | undefined;
132
+ review?: "required" | "approved" | "changes_requested" | undefined;
133
+ checks?: {
134
+ passed: number;
135
+ failed: number;
136
+ pending: number;
137
+ } | undefined;
138
+ mergeable?: boolean | undefined;
139
+ changedFiles?: number | undefined;
140
+ additions?: number | undefined;
141
+ deletions?: number | undefined;
142
+ } | {
143
+ type: "task";
144
+ assignees?: string[] | undefined;
145
+ priority?: string | undefined;
146
+ project?: string | undefined;
147
+ cycle?: string | undefined;
148
+ dueDate?: string | undefined;
149
+ labels?: string[] | undefined;
150
+ } | {
151
+ type: "deployment";
152
+ project?: string | undefined;
153
+ environment?: string | undefined;
154
+ revision?: string | undefined;
155
+ branch?: string | undefined;
156
+ } | {
157
+ type: "calendar_event";
158
+ when?: string | undefined;
159
+ attendees?: string[] | undefined;
160
+ } | undefined;
161
+ }[];
162
+ attendees: {
163
+ email: string;
164
+ optional?: boolean | undefined;
165
+ response?: "accepted" | "declined" | "tentative" | "needsAction" | undefined;
166
+ }[];
70
167
  end: string;
71
168
  eventId: string;
72
169
  label: string;
@@ -74,12 +171,54 @@ export declare function ownEventResult(event: z.infer<typeof ownEventSchema>, ti
74
171
  };
75
172
  /** Output fields shared by the tools that create or change Junior's events. */
76
173
  export declare const ownEventOutputFields: {
77
- attendees: z.ZodArray<z.ZodString>;
174
+ attendees: z.ZodArray<z.ZodObject<{
175
+ email: z.ZodString;
176
+ optional: z.ZodOptional<z.ZodBoolean>;
177
+ response: z.ZodOptional<z.ZodEnum<{
178
+ accepted: "accepted";
179
+ declined: "declined";
180
+ tentative: "tentative";
181
+ needsAction: "needsAction";
182
+ }>>;
183
+ }, z.core.$strip>>;
78
184
  end: z.ZodString;
79
185
  eventId: z.ZodString;
80
186
  label: z.ZodString;
187
+ location: z.ZodOptional<z.ZodString>;
188
+ repeats: z.ZodOptional<z.ZodBoolean>;
189
+ seriesEventId: z.ZodOptional<z.ZodString>;
81
190
  start: z.ZodString;
82
191
  title: z.ZodOptional<z.ZodString>;
83
192
  url: z.ZodOptional<z.ZodString>;
84
193
  videoCallUrl: z.ZodOptional<z.ZodString>;
85
194
  };
195
+ /** Event id or link input for tools that act on an event Junior organizes. */
196
+ export declare const ownEventIdSchema: z.ZodString;
197
+ /**
198
+ * Return the event id from an id or a Google Calendar event link.
199
+ *
200
+ * A link's `eid` value is base64 for `<eventId> <calendar email>`.
201
+ */
202
+ export declare function parseEventId(value: string): string;
203
+ /** Result of reading an event that Junior organizes. */
204
+ export type OwnEventRead = {
205
+ event: OwnEvent;
206
+ eventId: string;
207
+ path: string;
208
+ status: "active";
209
+ } | {
210
+ eventId: string;
211
+ path: string;
212
+ status: "cancelled";
213
+ };
214
+ /**
215
+ * Read an event that Junior organizes, for a requester who is invited to it.
216
+ *
217
+ * Only invited people may change or cancel an event. This keeps one requester
218
+ * from moving or cancelling a meeting that Junior set up for others.
219
+ *
220
+ * A deleted event on Junior's calendar comes back as `cancelled`. Google
221
+ * returns it as HTTP 410, or as a stub with only `id` and `status`, so it has
222
+ * no organizer or attendees to check. Callers must not change it.
223
+ */
224
+ export declare function readOwnEventForRequester(ctx: GoogleToolContext, eventIdOrLink: string, action: "change" | "cancel"): Promise<OwnEventRead>;
@@ -2,21 +2,27 @@ import { type GoogleToolContext } from "./shared";
2
2
  /**
3
3
  * Change an event that Junior organizes and email the attendees.
4
4
  *
5
- * Only people already invited to the event may change it. This keeps one
6
- * requester from moving or rewriting a meeting that Junior set up for others.
5
+ * Only people already invited to the event may change it.
7
6
  */
8
7
  export declare function createUpdateCalendarEventTool(ctx: GoogleToolContext): import("@sentry/junior-plugin-api").PluginToolDefinition<{
9
8
  eventId: string;
10
- timeZone: string;
11
9
  addAttendees: string[];
10
+ addOptionalAttendees: string[];
12
11
  removeAttendees: string[];
13
12
  title?: string | undefined;
14
13
  description?: string | undefined;
15
14
  start?: string | undefined;
16
15
  end?: string | undefined;
16
+ timeZone?: string | undefined;
17
+ location?: string | undefined;
18
+ addVideoCall?: true | undefined;
17
19
  }, {
18
20
  [x: string]: unknown;
19
- attendees: string[];
21
+ attendees: {
22
+ email: string;
23
+ optional?: boolean | undefined;
24
+ response?: "accepted" | "declined" | "tentative" | "needsAction" | undefined;
25
+ }[];
20
26
  end: string;
21
27
  eventId: string;
22
28
  label: string;
@@ -26,7 +32,7 @@ export declare function createUpdateCalendarEventTool(ctx: GoogleToolContext): i
26
32
  kind: "object";
27
33
  key: string;
28
34
  label: string;
29
- objectType: "code_change" | "task" | "deployment" | "automation" | "item";
35
+ objectType: "code_change" | "task" | "deployment" | "calendar_event" | "automation" | "item";
30
36
  title: string;
31
37
  url: string | null;
32
38
  description?: string | undefined;
@@ -65,6 +71,10 @@ export declare function createUpdateCalendarEventTool(ctx: GoogleToolContext): i
65
71
  environment?: string | undefined;
66
72
  revision?: string | undefined;
67
73
  branch?: string | undefined;
74
+ } | {
75
+ type: "calendar_event";
76
+ when?: string | undefined;
77
+ attendees?: string[] | undefined;
68
78
  } | undefined;
69
79
  }[] | undefined;
70
80
  truncated?: boolean | undefined;
@@ -72,12 +82,19 @@ export declare function createUpdateCalendarEventTool(ctx: GoogleToolContext): i
72
82
  arguments: Record<string, unknown>;
73
83
  reason?: string | undefined;
74
84
  } | undefined;
85
+ location?: string | undefined;
86
+ repeats?: boolean | undefined;
87
+ seriesEventId?: string | undefined;
75
88
  title?: string | undefined;
76
89
  url?: string | undefined;
77
90
  videoCallUrl?: string | undefined;
78
91
  }, {
79
92
  [x: string]: unknown;
80
- attendees: string[];
93
+ attendees: {
94
+ email: string;
95
+ optional?: boolean | undefined;
96
+ response?: "accepted" | "declined" | "tentative" | "needsAction" | undefined;
97
+ }[];
81
98
  end: string;
82
99
  eventId: string;
83
100
  label: string;
@@ -87,7 +104,7 @@ export declare function createUpdateCalendarEventTool(ctx: GoogleToolContext): i
87
104
  kind: "object";
88
105
  key: string;
89
106
  label: string;
90
- objectType: "code_change" | "task" | "deployment" | "automation" | "item";
107
+ objectType: "code_change" | "task" | "deployment" | "calendar_event" | "automation" | "item";
91
108
  title: string;
92
109
  url: string | null;
93
110
  description?: string | undefined;
@@ -126,6 +143,10 @@ export declare function createUpdateCalendarEventTool(ctx: GoogleToolContext): i
126
143
  environment?: string | undefined;
127
144
  revision?: string | undefined;
128
145
  branch?: string | undefined;
146
+ } | {
147
+ type: "calendar_event";
148
+ when?: string | undefined;
149
+ attendees?: string[] | undefined;
129
150
  } | undefined;
130
151
  }[] | undefined;
131
152
  truncated?: boolean | undefined;
@@ -133,6 +154,9 @@ export declare function createUpdateCalendarEventTool(ctx: GoogleToolContext): i
133
154
  arguments: Record<string, unknown>;
134
155
  reason?: string | undefined;
135
156
  } | undefined;
157
+ location?: string | undefined;
158
+ repeats?: boolean | undefined;
159
+ seriesEventId?: string | undefined;
136
160
  title?: string | undefined;
137
161
  url?: string | undefined;
138
162
  videoCallUrl?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-google",
3
- "version": "0.238.1",
3
+ "version": "0.240.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,7 +25,7 @@
25
25
  "commander": "^14.0.3",
26
26
  "drizzle-orm": "^0.45.2",
27
27
  "zod": "^4.5.4",
28
- "@sentry/junior-plugin-api": "0.238.1"
28
+ "@sentry/junior-plugin-api": "0.240.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@oxlint/plugins": "1.79.0",