@sentry/junior-google 0.312.0 → 0.314.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.
Files changed (2) hide show
  1. package/dist/index.js +123 -170
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { EgressPolicyDenied, PluginToolInputError, defineJuniorPlugin, definePluginTool, objectSummary, pluginToolOutputSchema, withToolContext } from "@sentry/junior-plugin-api";
1
+ import { EgressPolicyDenied, PluginToolInputError, defineJuniorPlugin, definePluginTool, objectSummary, parseMarkdown, pluginToolOutputSchema, withToolContext } from "@sentry/junior-plugin-api";
2
2
  import { createServer } from "node:http";
3
3
  import { userInfo } from "node:os";
4
4
  import { InvalidArgumentError } from "commander";
@@ -813,7 +813,7 @@ function requireFileType(metadata, types) {
813
813
  const type = googleFileType(metadata.mimeType);
814
814
  if (!type || !types.includes(type)) {
815
815
  const expected = types.map((item) => FILE_TYPES[item].label).join(" or ");
816
- throw new PluginToolInputError(`"${metadata.name}" is not a ${expected} (${metadata.mimeType}).`);
816
+ throw new PluginToolInputError(`"${metadata.name}" is not a ${expected} (${metadata.mimeType}). Use the link or file id of a ${expected}.`);
817
817
  }
818
818
  return {
819
819
  ...metadata,
@@ -865,7 +865,7 @@ const permissionsSchema = z.object({
865
865
  */
866
866
  async function requireRequesterCanEdit(ctx, ref, noun) {
867
867
  const requester = await requesterEmail(ctx);
868
- if (!requester) throw new PluginToolInputError(`The requester's email is unknown, so the tool cannot check that they may edit this ${noun}.`);
868
+ if (!requester) throw new PluginToolInputError(`The requester's email is unknown, so the tool cannot check that they may edit this ${noun}. No change to the call can fix this.`);
869
869
  const domain = emailDomain(requester);
870
870
  let pageToken;
871
871
  for (let page = 0; page < MAX_PERMISSION_PAGES; page += 1) {
@@ -941,7 +941,7 @@ function requireAllowedEmails(emails, allowedDomains) {
941
941
  const domain = emailDomain(email);
942
942
  return !domain || !allowedDomains.includes(domain);
943
943
  });
944
- if (outside.length > 0) throw new PluginToolInputError(`You can only schedule with people at ${allowedDomains.join(", ")}. Not allowed: ${outside.join(", ")}`);
944
+ if (outside.length > 0) throw new PluginToolInputError(`You can only schedule with people at ${allowedDomains.join(", ")}. Not allowed: ${outside.join(", ")}. Remove them and call the tool again.`);
945
945
  }
946
946
  /** Return the requester's email in lowercase, when Junior knows it. */
947
947
  async function requesterEmail(ctx) {
@@ -998,7 +998,7 @@ function googleApiError(operation, response) {
998
998
  if (response.status === 403 && error?.details?.some((detail) => detail.reason === "SERVICE_DISABLED")) return /* @__PURE__ */ new Error(`The Google API that ${operation} needs is not enabled for the connected Google Cloud project. An admin must enable it.`);
999
999
  const detail = error?.message;
1000
1000
  const message = `Google ${operation} failed with HTTP ${response.status}${detail ? `: ${detail}` : ""}`;
1001
- return response.status === 400 ? new PluginToolInputError(message) : new Error(message);
1001
+ return response.status === 400 ? new PluginToolInputError(`${message}. Fix the input that Google names and call the tool again.`) : new Error(message);
1002
1002
  }
1003
1003
  // src/calendar/events.ts
1004
1004
  /** Format one interval for people, in the requested time zone. */
@@ -1182,7 +1182,7 @@ const cancelledEventSchema$1 = z.object({ status: z.literal("cancelled") });
1182
1182
  async function readOwnEventForRequester(ctx, eventIdOrLink, action) {
1183
1183
  const eventId = parseEventId(eventIdOrLink);
1184
1184
  const requester = await requesterEmail(ctx);
1185
- if (!requester) throw new PluginToolInputError(`The requester's email is unknown, so the tool cannot check that they may ${action} this event.`);
1185
+ if (!requester) throw new PluginToolInputError(`The requester's email is unknown, so the tool cannot check that they may ${action} this event. No change to the call can fix this.`);
1186
1186
  const path = `/calendar/v3/calendars/primary/events/${eventId}`;
1187
1187
  const response = await googleApiRequest(ctx, {
1188
1188
  operation: "google.calendar.event.get",
@@ -1197,7 +1197,7 @@ async function readOwnEventForRequester(ctx, eventIdOrLink, action) {
1197
1197
  if (response.status !== 200) throw googleApiError("google.calendar.event.get", response);
1198
1198
  const event = ownEventSchema.parse(response.body);
1199
1199
  if (event.organizer?.self !== true) throw new PluginToolInputError(`You do not organize this event, so you cannot ${action} it. Ask the organizer instead.`);
1200
- if (!(event.attendees ?? []).some((attendee) => attendee.email.toLowerCase() === requester)) throw new PluginToolInputError(`Only people invited to this event can ask you to ${action} it.`);
1200
+ if (!(event.attendees ?? []).some((attendee) => attendee.email.toLowerCase() === requester)) throw new PluginToolInputError(`Only people invited to this event can ask you to ${action} it. No change to the call can fix this.`);
1201
1201
  return {
1202
1202
  event,
1203
1203
  eventId,
@@ -1475,7 +1475,7 @@ async function personCanOpenFile(ctx, email, file, allowedDomains) {
1475
1475
  async function readRequesterFile(ctx, ref, types) {
1476
1476
  const metadata = await readGoogleFileMetadata(ctx, ref);
1477
1477
  const requester = await requesterEmail(ctx);
1478
- if (!requester) throw new PluginToolInputError("The requester's email is unknown, so the tool cannot check that they may open this file.");
1478
+ if (!requester) throw new PluginToolInputError("The requester's email is unknown, so the tool cannot check that they may open this file. No change to the call can fix this.");
1479
1479
  if (!await personCanOpenFile(ctx, requester, {
1480
1480
  ...metadata,
1481
1481
  resourceKey: ref.resourceKey
@@ -1920,164 +1920,117 @@ const cancelCalendarEventTool = definePluginTool({
1920
1920
  }
1921
1921
  });
1922
1922
  // src/docs/markdown.ts
1923
- const LINK = /^\[([^\]\n]+)\]\(([^)\s]+)\)/;
1923
+ /**
1924
+ * Convert a small Markdown subset to Google Docs text and styles.
1925
+ *
1926
+ * The Docs API has no Markdown import for an existing Doc, so the edit tools
1927
+ * insert plain text and then apply styles by index. Supported: ATX headings,
1928
+ * paragraphs, bullet and numbered lists (nested by indent), fenced code,
1929
+ * bold, italic, inline code, and http, https, or mailto links. Other syntax,
1930
+ * such as tables and images, stays as plain text.
1931
+ */
1924
1932
  const SAFE_LINK_PREFIXES = [
1925
1933
  "https://",
1926
1934
  "http://",
1927
1935
  "mailto:"
1928
1936
  ];
1929
- const ESCAPABLE = /[\\`*_[\]()#+\-.!>|~]/;
1930
1937
  const DROPPED_CHARACTERS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uE000-\uF8FF\u{F0000}-\u{10FFFF}]/gu;
1931
- /** Parse inline Markdown into styled runs. */
1932
- function parseInline(text, style = {}) {
1933
- const runs = [];
1934
- let plain = "";
1935
- const flush = () => {
1936
- if (plain) runs.push({
1938
+ const MAX_LIST_LEVEL = 8;
1939
+ function sourceText(node, markdown) {
1940
+ const start = node.position?.start.offset ?? 0;
1941
+ const end = node.position?.end.offset ?? start;
1942
+ return markdown.slice(start, end).replaceAll("\n", " ");
1943
+ }
1944
+ function isSafeLink(url) {
1945
+ const lower = url.toLowerCase();
1946
+ return SAFE_LINK_PREFIXES.some((prefix) => lower.startsWith(prefix));
1947
+ }
1948
+ const EMPHASIS_STYLES = {
1949
+ emphasis: { italic: true },
1950
+ strong: { bold: true }
1951
+ };
1952
+ /** Read the inline children of a node into styled runs. */
1953
+ function inlineRuns(nodes, markdown, style = {}) {
1954
+ return nodes.flatMap((node) => {
1955
+ if (node.type === "text") return [{
1937
1956
  style,
1938
- text: plain
1939
- });
1940
- plain = "";
1941
- };
1942
- let i = 0;
1943
- while (i < text.length) {
1944
- const rest = text.slice(i);
1945
- const char = text[i];
1946
- if (char === "\\" && ESCAPABLE.test(text[i + 1] ?? "")) {
1947
- plain += text[i + 1];
1948
- i += 2;
1949
- continue;
1950
- }
1951
- if (char === "`") {
1952
- const close = text.indexOf("`", i + 1);
1953
- if (close > i + 1) {
1954
- flush();
1955
- runs.push({
1956
- style: {
1957
- ...style,
1958
- code: true
1959
- },
1960
- text: text.slice(i + 1, close)
1961
- });
1962
- i = close + 1;
1963
- continue;
1964
- }
1965
- }
1966
- const link = char === "[" ? LINK.exec(rest) : null;
1967
- if (link && SAFE_LINK_PREFIXES.some((prefix) => link[2].toLowerCase().startsWith(prefix))) {
1968
- flush();
1969
- runs.push(...parseInline(link[1], {
1970
- ...style,
1971
- link: link[2]
1972
- }));
1973
- i += link[0].length;
1974
- continue;
1975
- }
1976
- const bold = /^(\*\*|__)(?!\s)(.+?)(?<!\s)\1/.exec(rest);
1977
- if (bold && (char === "*" || !/\w/.test(text[i - 1] ?? ""))) {
1978
- flush();
1979
- runs.push(...parseInline(bold[2], {
1980
- ...style,
1981
- bold: true
1982
- }));
1983
- i += bold[0].length;
1984
- continue;
1985
- }
1986
- const italic = char === "*" ? /^\*(?![\s*])(.+?)(?<!\s)\*/.exec(rest) : char === "_" && !/\w/.test(text[i - 1] ?? "") ? /^_(?![\s_])(.+?)(?<!\s)_(?!\w)/.exec(rest) : null;
1987
- if (italic) {
1988
- flush();
1989
- runs.push(...parseInline(italic[1], {
1957
+ text: node.value.replaceAll("\n", " ")
1958
+ }];
1959
+ if (node.type === "break") return [{
1960
+ style,
1961
+ text: " "
1962
+ }];
1963
+ if (node.type === "inlineCode") return [{
1964
+ style: {
1990
1965
  ...style,
1991
- italic: true
1992
- }));
1993
- i += italic[0].length;
1994
- continue;
1995
- }
1996
- plain += char;
1997
- i += 1;
1998
- }
1999
- flush();
2000
- return runs;
1966
+ code: true
1967
+ },
1968
+ text: node.value
1969
+ }];
1970
+ if (node.type === "link" && isSafeLink(node.url)) return inlineRuns(node.children, markdown, {
1971
+ ...style,
1972
+ link: node.url
1973
+ });
1974
+ const added = EMPHASIS_STYLES[node.type];
1975
+ if (added && "children" in node) return inlineRuns(node.children, markdown, {
1976
+ ...style,
1977
+ ...added
1978
+ });
1979
+ return [{
1980
+ style,
1981
+ text: sourceText(node, markdown)
1982
+ }];
1983
+ });
2001
1984
  }
2002
- const HEADING = /^(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/;
2003
- const LIST_ITEM = /^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/;
2004
- const FENCE = /^\s*(```|~~~)/;
2005
- const RULE = /^\s*([-*_])(\s*\1){2,}\s*$/;
2006
- const MAX_LIST_LEVEL = 8;
2007
- /** Split Markdown into paragraph blocks. */
2008
- function parseBlocks(markdown) {
1985
+ const DROPPED_BLOCKS = /* @__PURE__ */ new Set(["definition", "thematicBreak"]);
1986
+ /** Read Markdown blocks into Docs paragraphs. */
1987
+ function parseBlocks(input) {
1988
+ const markdown = input.replace(/\r\n?/g, "\n").replace(DROPPED_CHARACTERS, "");
2009
1989
  const blocks = [];
2010
- let indents = [];
2011
- let fence;
2012
- let open = [];
2013
- const closeParagraph = () => {
2014
- if (open.length) blocks.push({
2015
- runs: parseInline(open.join(" ")),
2016
- style: "NORMAL_TEXT"
2017
- });
2018
- open = [];
1990
+ const paragraph = (runs, style = "NORMAL_TEXT") => blocks.push({
1991
+ runs,
1992
+ style
1993
+ });
1994
+ const visit = (nodes, level) => {
1995
+ for (const node of nodes) if (node.type === "heading") paragraph(inlineRuns(node.children, markdown), `HEADING_${node.depth}`);
1996
+ else if (node.type === "paragraph") paragraph(inlineRuns(node.children, markdown));
1997
+ else if (node.type === "code") for (const line of node.value.split("\n")) paragraph(line ? [{
1998
+ style: { code: true },
1999
+ text: line
2000
+ }] : []);
2001
+ else if (node.type === "blockquote") visit(node.children);
2002
+ else if (node.type === "list") {
2003
+ const itemLevel = Math.min(level === void 0 ? 0 : level + 1, MAX_LIST_LEVEL);
2004
+ for (const item of node.children) {
2005
+ const block = {
2006
+ level: itemLevel,
2007
+ ordered: node.ordered === true,
2008
+ runs: [],
2009
+ style: "NORMAL_TEXT"
2010
+ };
2011
+ blocks.push(block);
2012
+ for (const child of item.children) {
2013
+ if (child.type !== "paragraph") {
2014
+ visit([child], itemLevel);
2015
+ continue;
2016
+ }
2017
+ if (block.runs.length) block.runs.push({
2018
+ style: {},
2019
+ text: " "
2020
+ });
2021
+ block.runs.push(...inlineRuns(child.children, markdown));
2022
+ }
2023
+ if (typeof item.checked === "boolean") block.runs.unshift({
2024
+ style: {},
2025
+ text: item.checked ? "[x] " : "[ ] "
2026
+ });
2027
+ }
2028
+ } else if (!DROPPED_BLOCKS.has(node.type)) paragraph([{
2029
+ style: {},
2030
+ text: sourceText(node, markdown)
2031
+ }]);
2019
2032
  };
2020
- const lines = markdown.replace(/\r\n?/g, "\n").replace(DROPPED_CHARACTERS, "").split("\n");
2021
- for (const line of lines) {
2022
- const fenceMatch = FENCE.exec(line);
2023
- if (fence) {
2024
- if (fenceMatch?.[1] === fence) fence = void 0;
2025
- else blocks.push({
2026
- runs: line ? [{
2027
- style: { code: true },
2028
- text: line
2029
- }] : [],
2030
- style: "NORMAL_TEXT"
2031
- });
2032
- continue;
2033
- }
2034
- if (fenceMatch) {
2035
- closeParagraph();
2036
- indents = [];
2037
- fence = fenceMatch[1];
2038
- continue;
2039
- }
2040
- if (!line.trim() || RULE.test(line)) {
2041
- closeParagraph();
2042
- if (!line.trim()) continue;
2043
- indents = [];
2044
- continue;
2045
- }
2046
- const heading = HEADING.exec(line);
2047
- if (heading) {
2048
- closeParagraph();
2049
- indents = [];
2050
- blocks.push({
2051
- runs: parseInline(heading[2]),
2052
- style: `HEADING_${heading[1].length}`
2053
- });
2054
- continue;
2055
- }
2056
- const item = LIST_ITEM.exec(line);
2057
- if (item) {
2058
- closeParagraph();
2059
- const indent = item[1].replace(/\t/g, " ").length;
2060
- while (indents.length && indents.at(-1) > indent) indents.pop();
2061
- if (!indents.length || indents.at(-1) < indent) indents.push(indent);
2062
- blocks.push({
2063
- level: Math.min(indents.length - 1, MAX_LIST_LEVEL),
2064
- ordered: /\d/.test(item[2]),
2065
- runs: parseInline(item[3]),
2066
- style: "NORMAL_TEXT"
2067
- });
2068
- continue;
2069
- }
2070
- if (indents.length && /^\s/.test(line) && !open.length) {
2071
- blocks.at(-1).runs.push({
2072
- style: {},
2073
- text: " "
2074
- }, ...parseInline(line.trim()));
2075
- continue;
2076
- }
2077
- indents = [];
2078
- open.push(line.trim().replace(/^>\s?/, ""));
2079
- }
2080
- closeParagraph();
2033
+ visit(parseMarkdown(markdown).children);
2081
2034
  return blocks;
2082
2035
  }
2083
2036
  /**
@@ -2207,7 +2160,7 @@ function isEmptyParagraph(paragraph) {
2207
2160
  /** Convert tool Markdown, and refuse Markdown that writes no text. */
2208
2161
  function convertDocMarkdown(markdown) {
2209
2162
  const converted = convertMarkdown(markdown);
2210
- if (!converted.text.trim()) throw new PluginToolInputError("content has no text to write.");
2163
+ if (!converted.text.trim()) throw new PluginToolInputError("content has no text to write. Set content to Markdown that has text.");
2211
2164
  return converted;
2212
2165
  }
2213
2166
  const LINK_COLOR = { color: { rgbColor: {
@@ -2331,7 +2284,7 @@ const createGoogleDocTool = definePluginTool({
2331
2284
  async execute(input, _options, ctx) {
2332
2285
  const converted = input.content === void 0 ? void 0 : convertDocMarkdown(input.content);
2333
2286
  const requester = await requesterEmail(ctx);
2334
- if (!requester) throw new PluginToolInputError("The requester's email is unknown, so the Doc cannot be handed to them.");
2287
+ if (!requester) throw new PluginToolInputError("The requester's email is unknown, so the Doc cannot be handed to them. No change to the call can fix this.");
2335
2288
  requireAllowedEmails([requester], ctx.allowedDomains);
2336
2289
  const response = await googleApiRequest(ctx, {
2337
2290
  body: { title: input.title },
@@ -2464,7 +2417,7 @@ const createCalendarEventTool = definePluginTool({
2464
2417
  const startMs = Date.parse(input.start);
2465
2418
  const endMs = Date.parse(input.end);
2466
2419
  if (endMs <= startMs) throw new PluginToolInputError("end must be after start.");
2467
- if (endMs - startMs > 288e5) throw new PluginToolInputError("Events can be at most 8 hours long.");
2420
+ if (endMs - startMs > 288e5) throw new PluginToolInputError("Events can be at most 8 hours long. Set end at most 8 hours after start.");
2468
2421
  const attendees = await withRequester(ctx, input.attendees);
2469
2422
  const required = new Set(attendees);
2470
2423
  const optionalAttendees = [...new Set(input.optional_attendees)].filter((email) => !required.has(email));
@@ -2564,7 +2517,7 @@ const createGoogleSlidesTool = definePluginTool({
2564
2517
  outputSchema: outputSchema$13,
2565
2518
  async execute(input, _options, ctx) {
2566
2519
  const requester = await requesterEmail(ctx);
2567
- if (!requester) throw new PluginToolInputError("The requester's email is unknown, so the presentation cannot be handed to them.");
2520
+ if (!requester) throw new PluginToolInputError("The requester's email is unknown, so the presentation cannot be handed to them. No change to the call can fix this.");
2568
2521
  requireAllowedEmails([requester], ctx.allowedDomains);
2569
2522
  const response = await googleApiRequest(ctx, {
2570
2523
  body: { title: input.title },
@@ -3768,17 +3721,17 @@ function isInvited(event, email) {
3768
3721
  async function readInvitedEvent(ctx, eventIdOrLink) {
3769
3722
  const eventId = parseEventId(eventIdOrLink);
3770
3723
  const requester = await requesterEmail(ctx);
3771
- if (!requester) throw new PluginToolInputError("The requester's email is unknown, so the tool cannot check that they were invited to this meeting.");
3724
+ if (!requester) throw new PluginToolInputError("The requester's email is unknown, so the tool cannot check that they were invited to this meeting. No change to the call can fix this.");
3772
3725
  const response = await googleApiRequest(ctx, {
3773
3726
  operation: "google.calendar.event.get",
3774
3727
  path: `/calendar/v3/calendars/primary/events/${eventId}`
3775
3728
  });
3776
- if (response.status === 404) throw new PluginToolInputError(`Your calendar has no event ${eventId}. You can only read the transcript of a meeting you are invited to.`);
3777
- if (response.status === 410 || response.status === 200 && cancelledEventSchema.safeParse(response.body).success) throw new PluginToolInputError(`Event ${eventId} was cancelled.`);
3729
+ if (response.status === 404) throw new PluginToolInputError(`Your calendar has no event ${eventId}. Check event_id. You can only read the transcript of a meeting you are invited to.`);
3730
+ if (response.status === 410 || response.status === 200 && cancelledEventSchema.safeParse(response.body).success) throw new PluginToolInputError(`Event ${eventId} was cancelled. No change to the call can fix this.`);
3778
3731
  if (response.status !== 200) throw googleApiError("google.calendar.event.get", response);
3779
3732
  const event = eventSchema.parse(response.body);
3780
- if (!(event.organizer?.self === true || (event.attendees ?? []).some((attendee) => attendee.self === true) || isInvited(event, ctx.accountEmail))) throw new PluginToolInputError("You are not invited to this meeting, so you cannot read its transcript.");
3781
- if (!isInvited(event, requester)) throw new PluginToolInputError("Only people invited to this meeting can ask you for its transcript.");
3733
+ if (!(event.organizer?.self === true || (event.attendees ?? []).some((attendee) => attendee.self === true) || isInvited(event, ctx.accountEmail))) throw new PluginToolInputError("You are not invited to this meeting, so you cannot read its transcript. No change to the call can fix this.");
3734
+ if (!isInvited(event, requester)) throw new PluginToolInputError("Only people invited to this meeting can ask you for its transcript. No change to the call can fix this.");
3782
3735
  return {
3783
3736
  event,
3784
3737
  eventId
@@ -3921,8 +3874,8 @@ function sandboxImagePaths(requests) {
3921
3874
  async function readImage(ctx, path) {
3922
3875
  if (posix.normalize(path) !== path) throw new PluginToolInputError(`An image path must be a normalized absolute sandbox path, not ${path}.`);
3923
3876
  const bytes = await ctx.sandbox.readFile(path);
3924
- if (!bytes) throw new PluginToolInputError(`No sandbox file at ${path}.`);
3925
- if (!IMAGE_SIGNATURES.some((signature) => signature.every((byte, index) => bytes[index] === byte))) throw new PluginToolInputError(`${path} is not a PNG, JPEG, or GIF.`);
3877
+ if (!bytes) throw new PluginToolInputError(`No sandbox file at ${path}. Check the path, or create the image first.`);
3878
+ if (!IMAGE_SIGNATURES.some((signature) => signature.every((byte, index) => bytes[index] === byte))) throw new PluginToolInputError(`${path} is not a PNG, JPEG, or GIF. Convert it to PNG, or use another image.`);
3926
3879
  return bytes;
3927
3880
  }
3928
3881
  /**
@@ -4135,7 +4088,7 @@ const replaceGoogleDocTextTool = definePluginTool({
4135
4088
  })).body);
4136
4089
  requireRevision(doc, revisionId, input.revision_id);
4137
4090
  const tabId = tabs[0]?.tabProperties.tabId;
4138
- if (!tabId) throw new PluginToolInputError(`Google did not return the tabs of "${doc.title}", so the text was not replaced.`);
4091
+ if (!tabId) throw new PluginToolInputError(`Google did not return the tabs of "${doc.title}", so the text was not replaced. No change to the call can fix this.`);
4139
4092
  const reply = await batchUpdateDoc(ctx, doc, [{ replaceAllText: {
4140
4093
  containsText: {
4141
4094
  matchCase: input.match_case,
@@ -4418,7 +4371,7 @@ const updateCalendarEventTool = definePluginTool({
4418
4371
  if (input.start && input.end) {
4419
4372
  const durationMs = Date.parse(input.end) - Date.parse(input.start);
4420
4373
  if (durationMs <= 0) throw new PluginToolInputError("end must be after start.");
4421
- if (durationMs > 288e5) throw new PluginToolInputError("Events can be at most 8 hours long.");
4374
+ if (durationMs > 288e5) throw new PluginToolInputError("Events can be at most 8 hours long. Set end at most 8 hours after start.");
4422
4375
  }
4423
4376
  requireAllowedEmails([...input.add_attendees, ...input.add_optional_attendees], ctx.allowedDomains);
4424
4377
  const read = await readOwnEventForRequester(ctx, input.event_id, "change");
@@ -4734,10 +4687,10 @@ function snakeCaseKey(value) {
4734
4687
  async function requireReadableSources(ctx, requests) {
4735
4688
  const snakeCase = snakeCaseKey(requests);
4736
4689
  if (snakeCase) throw new PluginToolInputError(`Write Slides API field names in camelCase, not ${snakeCase}.`);
4737
- if (requests.some((request) => "refreshSheetsChart" in request)) throw new PluginToolInputError("refreshSheetsChart is not supported: you cannot check who can open the chart's Sheet.");
4690
+ if (requests.some((request) => "refreshSheetsChart" in request)) throw new PluginToolInputError("refreshSheetsChart is not supported: you cannot check who can open the chart's Sheet. Remove it from requests.");
4738
4691
  const sources = requests.map((request) => {
4739
4692
  const parsed = sourceSchema.safeParse(request);
4740
- if (!parsed.success) throw new PluginToolInputError(`Malformed ${Object.keys(request)[0]} request: ${parsed.error.issues[0]?.message ?? "invalid"}.`);
4693
+ if (!parsed.success) throw new PluginToolInputError(`Malformed ${Object.keys(request)[0]} request: ${parsed.error.issues[0]?.message ?? "invalid"}. Fix it to match the Slides API batchUpdate request.`);
4741
4694
  return parsed.data;
4742
4695
  });
4743
4696
  if (sources.some((source) => source.createVideo !== void 0 && source.createVideo.source !== "YOUTUBE")) throw new PluginToolInputError("Only YouTube videos can be added. You cannot check who can open a Drive video.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-google",
3
- "version": "0.312.0",
3
+ "version": "0.314.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,7 +22,7 @@
22
22
  "migrations"
23
23
  ],
24
24
  "dependencies": {
25
- "@sentry/junior-plugin-api": "0.312.0",
25
+ "@sentry/junior-plugin-api": "0.314.0",
26
26
  "commander": "^14.0.3",
27
27
  "drizzle-orm": "^0.45.4",
28
28
  "p-limit": "^7.3.3",