@mastra/connect 1.0.1-alpha.1 → 1.0.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -72,7 +72,8 @@ async function extractProblemDetail(response) {
72
72
  for (const field of [
73
73
  "detail",
74
74
  "title",
75
- "error"
75
+ "error",
76
+ "message"
76
77
  ]) {
77
78
  const value = data[field];
78
79
  if (typeof value === "string" && value) return {
@@ -89,6 +90,14 @@ async function extractProblemDetail(response) {
89
90
  };
90
91
  }
91
92
  }
93
+ if (Array.isArray(data.errorMessages)) {
94
+ const message = data.errorMessages.find((entry) => typeof entry === "string" && entry);
95
+ if (typeof message === "string") return {
96
+ detail: truncate(message),
97
+ code,
98
+ isProblemJson
99
+ };
100
+ }
92
101
  if (Array.isArray(data.errors)) {
93
102
  const message = extractFirstArrayMessage(data.errors);
94
103
  if (message) return {
@@ -96,6 +105,13 @@ async function extractProblemDetail(response) {
96
105
  code,
97
106
  isProblemJson
98
107
  };
108
+ } else if (data.errors && typeof data.errors === "object") {
109
+ const entry = Object.entries(data.errors).find(([, value]) => typeof value === "string" && value);
110
+ if (entry) return {
111
+ detail: truncate(`${entry[0]}: ${entry[1]}`),
112
+ code,
113
+ isProblemJson
114
+ };
99
115
  }
100
116
  return {
101
117
  code,
@@ -5661,7 +5677,7 @@ const ProviderAuthorSchema$1 = zod.z.object({
5661
5677
  bot: zod.z.boolean().optional(),
5662
5678
  system: zod.z.boolean().optional()
5663
5679
  });
5664
- const ProviderAttachmentSchema$3 = zod.z.object({
5680
+ const ProviderAttachmentSchema$4 = zod.z.object({
5665
5681
  id: SnowflakeSchema,
5666
5682
  filename: zod.z.string(),
5667
5683
  content_type: zod.z.string().optional(),
@@ -5689,7 +5705,7 @@ const ProviderMessageSchema$7 = zod.z.object({
5689
5705
  mention_everyone: zod.z.boolean(),
5690
5706
  mentions: zod.z.array(ProviderAuthorSchema$1),
5691
5707
  mention_roles: zod.z.array(SnowflakeSchema),
5692
- attachments: zod.z.array(ProviderAttachmentSchema$3),
5708
+ attachments: zod.z.array(ProviderAttachmentSchema$4),
5693
5709
  embeds: zod.z.array(ProviderEmbedSchema),
5694
5710
  pinned: zod.z.boolean(),
5695
5711
  type: zod.z.number().int()
@@ -6883,7 +6899,7 @@ const AskFredMessageSchema$1 = zod.z.object({
6883
6899
  created_at: zod.z.string().optional()
6884
6900
  });
6885
6901
  const continueAskfredThreadOutputSchema = zod.z.object({ message: AskFredMessageSchema$1 });
6886
- const GraphQLResponseSchema$18 = zod.z.object({ data: zod.z.object({ continueAskFredThread: zod.z.object({ message: AskFredMessageSchema$1 }) }) });
6902
+ const GraphQLResponseSchema$19 = zod.z.object({ data: zod.z.object({ continueAskFredThread: zod.z.object({ message: AskFredMessageSchema$1 }) }) });
6887
6903
  function continueAskfredThreadTool(proxy) {
6888
6904
  return (0, _mastra_core_tools.createTool)({
6889
6905
  id: "fireflies_continue_askfred_thread",
@@ -6927,7 +6943,7 @@ function continueAskfredThreadTool(proxy) {
6927
6943
  type: "graphql_error",
6928
6944
  message: responseBody.errors[0].message
6929
6945
  });
6930
- return { message: GraphQLResponseSchema$18.parse(response.data).data.continueAskFredThread.message };
6946
+ return { message: GraphQLResponseSchema$19.parse(response.data).data.continueAskFredThread.message };
6931
6947
  }
6932
6948
  });
6933
6949
  }
@@ -7301,13 +7317,13 @@ function deleteAskfredThreadTool(proxy) {
7301
7317
  //#region src/providers/fireflies/tools/delete-transcript.ts
7302
7318
  const deleteTranscriptInputSchema = zod.z.object({ id: zod.z.string().describe("Transcript ID to delete. Example: \"abc123\"") });
7303
7319
  const deleteTranscriptOutputSchema = zod.z.object({ deleted: zod.z.boolean() });
7304
- const GraphQLErrorSchema$6 = zod.z.object({
7320
+ const GraphQLErrorSchema$9 = zod.z.object({
7305
7321
  message: zod.z.string(),
7306
7322
  code: zod.z.string().optional()
7307
7323
  });
7308
7324
  const ProviderResponseSchema$233 = zod.z.object({
7309
7325
  data: zod.z.object({ deleteTranscript: zod.z.object({ id: zod.z.string() }).optional() }).nullable().optional(),
7310
- errors: zod.z.array(GraphQLErrorSchema$6).optional()
7326
+ errors: zod.z.array(GraphQLErrorSchema$9).optional()
7311
7327
  });
7312
7328
  function deleteTranscriptTool(proxy) {
7313
7329
  return (0, _mastra_core_tools.createTool)({
@@ -7880,6 +7896,7 @@ const SummarySchema = zod.z.object({
7880
7896
  transcript_chapters: zod.z.array(zod.z.string()).nullish(),
7881
7897
  extended_sections: zod.z.array(SummarySectionSchema).nullish()
7882
7898
  });
7899
+ const ProviderSummarySchema$1 = SummarySchema.extend({ action_items: zod.z.union([zod.z.string(), zod.z.array(zod.z.string())]).nullish() });
7883
7900
  const SpeakerSchema = zod.z.object({
7884
7901
  id: zod.z.string().nullish(),
7885
7902
  name: zod.z.string().nullish()
@@ -7928,13 +7945,13 @@ const TranscriptSchema = zod.z.object({
7928
7945
  id: zod.z.string().nullish(),
7929
7946
  title: zod.z.string().nullish(),
7930
7947
  sentences: zod.z.array(SentenceSchema).nullish(),
7931
- summary: SummarySchema.nullable().optional(),
7948
+ summary: ProviderSummarySchema$1.nullable().optional(),
7932
7949
  speakers: zod.z.array(SpeakerSchema).nullish(),
7933
7950
  meeting_info: MeetingInfoSchema.nullable().optional(),
7934
7951
  meeting_attendees: zod.z.array(MeetingAttendeeSchema).nullish(),
7935
7952
  analytics: AnalyticsSchema.nullable().optional()
7936
7953
  });
7937
- const GraphQLResponseSchema$17 = zod.z.object({
7954
+ const GraphQLResponseSchema$18 = zod.z.object({
7938
7955
  data: zod.z.object({ transcript: TranscriptSchema.nullable().optional() }).optional(),
7939
7956
  errors: zod.z.array(zod.z.object({
7940
7957
  message: zod.z.string().nullish(),
@@ -7952,6 +7969,9 @@ const getTranscriptOutputSchema = zod.z.object({
7952
7969
  meeting_attendees: zod.z.array(MeetingAttendeeSchema).optional(),
7953
7970
  analytics: AnalyticsSchema.optional()
7954
7971
  });
7972
+ function normalizeActionItems$1(actionItems) {
7973
+ return Array.isArray(actionItems) ? actionItems.join("\n") : actionItems;
7974
+ }
7955
7975
  function getTranscriptTool(proxy) {
7956
7976
  return (0, _mastra_core_tools.createTool)({
7957
7977
  id: "fireflies_get_transcript",
@@ -8042,7 +8062,7 @@ function getTranscriptTool(proxy) {
8042
8062
  },
8043
8063
  retries: 3
8044
8064
  });
8045
- const parsed = GraphQLResponseSchema$17.parse(response.data);
8065
+ const parsed = GraphQLResponseSchema$18.parse(response.data);
8046
8066
  const firstError = parsed.errors?.[0];
8047
8067
  if (firstError) throw new platformProxy.ActionError({
8048
8068
  type: firstError.code ?? "graphql_error",
@@ -8058,7 +8078,10 @@ function getTranscriptTool(proxy) {
8058
8078
  id: transcript.id ?? void 0,
8059
8079
  title: transcript.title ?? void 0,
8060
8080
  sentences: transcript.sentences ?? void 0,
8061
- summary: transcript.summary ?? void 0,
8081
+ summary: transcript.summary ? {
8082
+ ...transcript.summary,
8083
+ action_items: transcript.summary.action_items != null ? normalizeActionItems$1(transcript.summary.action_items) : transcript.summary.action_items
8084
+ } : void 0,
8062
8085
  speakers: transcript.speakers ?? void 0,
8063
8086
  meeting_info: transcript.meeting_info ?? void 0,
8064
8087
  meeting_attendees: transcript.meeting_attendees ?? void 0,
@@ -8205,7 +8228,7 @@ const ActiveMeetingSchema = zod.z.object({
8205
8228
  state: zod.z.enum(["active", "paused"]).or(zod.z.string()).optional().describe("Current state of the meeting. Possible values: \"active\", \"paused\"")
8206
8229
  });
8207
8230
  const listActiveMeetingsOutputSchema = zod.z.object({ meetings: zod.z.array(ActiveMeetingSchema).describe("List of currently active/live meetings") });
8208
- const GraphQLResponseSchema$16 = zod.z.object({ data: zod.z.object({ active_meetings: zod.z.array(zod.z.unknown()) }) });
8231
+ const GraphQLResponseSchema$17 = zod.z.object({ data: zod.z.object({ active_meetings: zod.z.array(zod.z.unknown()) }) });
8209
8232
  function listActiveMeetingsTool(proxy) {
8210
8233
  return (0, _mastra_core_tools.createTool)({
8211
8234
  id: "fireflies_list_active_meetings",
@@ -8226,7 +8249,7 @@ function listActiveMeetingsTool(proxy) {
8226
8249
  },
8227
8250
  retries: 3
8228
8251
  });
8229
- const parsedResponse = GraphQLResponseSchema$16.safeParse(response.data);
8252
+ const parsedResponse = GraphQLResponseSchema$17.safeParse(response.data);
8230
8253
  if (!parsedResponse.success) throw new platformProxy.ActionError({
8231
8254
  type: "invalid_response",
8232
8255
  message: "Invalid response structure from Fireflies API",
@@ -8538,7 +8561,7 @@ const ProviderMeetingInfoSchema = zod.z.object({
8538
8561
  });
8539
8562
  const ProviderSummarySchema = zod.z.object({
8540
8563
  keywords: zod.z.array(zod.z.string()).nullish(),
8541
- action_items: zod.z.array(zod.z.string()).nullish(),
8564
+ action_items: zod.z.union([zod.z.array(zod.z.string()), zod.z.string()]).nullish(),
8542
8565
  short_summary: zod.z.string().nullish(),
8543
8566
  meeting_type: zod.z.string().nullish()
8544
8567
  });
@@ -8598,10 +8621,14 @@ const listTranscriptsOutputSchema = zod.z.object({
8598
8621
  })),
8599
8622
  next_skip: zod.z.number().optional()
8600
8623
  });
8601
- const GraphQLResponseSchema$15 = zod.z.object({
8624
+ const GraphQLResponseSchema$16 = zod.z.object({
8602
8625
  data: zod.z.object({ transcripts: zod.z.array(zod.z.unknown()).nullish() }).nullish(),
8603
8626
  errors: zod.z.array(zod.z.unknown()).nullish()
8604
8627
  });
8628
+ function normalizeActionItems(actionItems) {
8629
+ if (Array.isArray(actionItems)) return actionItems;
8630
+ return actionItems.split("\n").map((item) => item.trim()).filter((item) => item.length > 0);
8631
+ }
8605
8632
  function listTranscriptsTool(proxy) {
8606
8633
  return (0, _mastra_core_tools.createTool)({
8607
8634
  id: "fireflies_list_transcripts",
@@ -8704,7 +8731,7 @@ function listTranscriptsTool(proxy) {
8704
8731
  },
8705
8732
  retries: 3
8706
8733
  });
8707
- const parsedResponse = GraphQLResponseSchema$15.safeParse(response.data);
8734
+ const parsedResponse = GraphQLResponseSchema$16.safeParse(response.data);
8708
8735
  if (!parsedResponse.success) throw new platformProxy.ActionError({
8709
8736
  type: "invalid_response",
8710
8737
  message: "Failed to parse provider response."
@@ -8750,7 +8777,7 @@ function listTranscriptsTool(proxy) {
8750
8777
  } },
8751
8778
  ...providerTranscript.summary != null && { summary: {
8752
8779
  ...providerTranscript.summary.keywords != null && { keywords: providerTranscript.summary.keywords },
8753
- ...providerTranscript.summary.action_items != null && { action_items: providerTranscript.summary.action_items },
8780
+ ...providerTranscript.summary.action_items != null && { action_items: normalizeActionItems(providerTranscript.summary.action_items) },
8754
8781
  ...providerTranscript.summary.short_summary != null && { short_summary: providerTranscript.summary.short_summary },
8755
8782
  ...providerTranscript.summary.meeting_type != null && { meeting_type: providerTranscript.summary.meeting_type }
8756
8783
  } }
@@ -9098,7 +9125,7 @@ const updateMeetingPrivacyInputSchema = zod.z.object({
9098
9125
  privacy: PrivacyEnum.describe("Privacy setting. Example: \"teammates\"")
9099
9126
  });
9100
9127
  const updateMeetingPrivacyOutputSchema = zod.z.boolean();
9101
- const GraphQLResponseSchema$14 = zod.z.object({
9128
+ const GraphQLResponseSchema$15 = zod.z.object({
9102
9129
  data: zod.z.object({ updateMeetingPrivacy: zod.z.object({
9103
9130
  id: zod.z.string(),
9104
9131
  privacy: PrivacyEnumWidened
@@ -9131,7 +9158,7 @@ function updateMeetingPrivacyTool(proxy) {
9131
9158
  },
9132
9159
  retries: 10
9133
9160
  });
9134
- const parsed = GraphQLResponseSchema$14.parse(response.data);
9161
+ const parsed = GraphQLResponseSchema$15.parse(response.data);
9135
9162
  if (parsed.errors && parsed.errors.length > 0) throw new platformProxy.ActionError({
9136
9163
  type: "graphql_error",
9137
9164
  message: "GraphQL errors occurred during updateMeetingPrivacy.",
@@ -22812,7 +22839,7 @@ const getAttachmentInputSchema$1 = zod.z.object({
22812
22839
  attachmentId: zod.z.string().describe("The ID of the attachment to retrieve. Example: \"attachment_001\""),
22813
22840
  userId: zod.z.string().optional().describe("The user's email address or \"me\". Defaults to \"me\".")
22814
22841
  });
22815
- const ProviderAttachmentSchema$2 = zod.z.object({
22842
+ const ProviderAttachmentSchema$3 = zod.z.object({
22816
22843
  size: zod.z.number(),
22817
22844
  data: zod.z.string()
22818
22845
  });
@@ -22840,7 +22867,7 @@ function getAttachmentTool$1(proxy) {
22840
22867
  messageId,
22841
22868
  attachmentId
22842
22869
  });
22843
- const providerAttachment = ProviderAttachmentSchema$2.parse(response.data);
22870
+ const providerAttachment = ProviderAttachmentSchema$3.parse(response.data);
22844
22871
  return {
22845
22872
  size: providerAttachment.size,
22846
22873
  data: providerAttachment.data
@@ -37946,10 +37973,10 @@ const ProviderIssuePayloadSchema = zod.z.object({
37946
37973
  labelIds: zod.z.array(zod.z.string()).optional()
37947
37974
  }).optional()
37948
37975
  });
37949
- const GraphQLErrorSchema$5 = zod.z.object({ message: zod.z.string() });
37950
- const GraphQLResponseSchema$13 = zod.z.object({
37976
+ const GraphQLErrorSchema$8 = zod.z.object({ message: zod.z.string() });
37977
+ const GraphQLResponseSchema$14 = zod.z.object({
37951
37978
  data: zod.z.object({ issueAddLabel: zod.z.unknown().optional() }).nullable().optional(),
37952
- errors: zod.z.array(GraphQLErrorSchema$5).optional()
37979
+ errors: zod.z.array(GraphQLErrorSchema$8).optional()
37953
37980
  });
37954
37981
  const addIssueLabelOutputSchema = zod.z.object({
37955
37982
  success: zod.z.boolean(),
@@ -37991,7 +38018,7 @@ function addIssueLabelTool(proxy) {
37991
38018
  },
37992
38019
  retries: 10
37993
38020
  });
37994
- const rawBody = GraphQLResponseSchema$13.parse(response.data);
38021
+ const rawBody = GraphQLResponseSchema$14.parse(response.data);
37995
38022
  if (rawBody.errors && rawBody.errors.length > 0) throw new platformProxy.ActionError({
37996
38023
  type: "graphql_error",
37997
38024
  message: rawBody.errors.map((e) => e.message).join(", "),
@@ -38042,7 +38069,7 @@ const ProviderPayloadSchema$5 = zod.z.object({
38042
38069
  lastSyncId: zod.z.number().optional()
38043
38070
  });
38044
38071
  const GraphQlResponseSchema = zod.z.object({
38045
- data: zod.z.object({ cycleArchive: ProviderPayloadSchema$5 }).optional(),
38072
+ data: zod.z.object({ cycleArchive: ProviderPayloadSchema$5.nullable().optional() }).nullable().optional(),
38046
38073
  errors: zod.z.array(zod.z.unknown()).optional()
38047
38074
  });
38048
38075
  const archiveCycleOutputSchema = zod.z.object({
@@ -38224,7 +38251,7 @@ const createAttachmentInputSchema = zod.z.object({
38224
38251
  createAsUser: zod.z.string().optional().describe("Create attachment as a user with the provided name. This option is only available to OAuth applications creating attachments in actor=application mode."),
38225
38252
  commentBody: zod.z.string().optional().describe("Create a linked comment with markdown body.")
38226
38253
  });
38227
- const ProviderAttachmentSchema$1 = zod.z.object({
38254
+ const ProviderAttachmentSchema$2 = zod.z.object({
38228
38255
  id: zod.z.string(),
38229
38256
  url: zod.z.string(),
38230
38257
  title: zod.z.string(),
@@ -38233,7 +38260,7 @@ const ProviderAttachmentSchema$1 = zod.z.object({
38233
38260
  });
38234
38261
  const ProviderPayloadSchema$4 = zod.z.object({
38235
38262
  success: zod.z.boolean(),
38236
- attachment: ProviderAttachmentSchema$1.nullable().optional()
38263
+ attachment: ProviderAttachmentSchema$2.nullable().optional()
38237
38264
  });
38238
38265
  const createAttachmentOutputSchema = zod.z.object({
38239
38266
  id: zod.z.string(),
@@ -38462,10 +38489,13 @@ const CycleSchema = zod.z.object({
38462
38489
  progress: zod.z.number().optional(),
38463
38490
  team: TeamSchema$5.optional()
38464
38491
  });
38465
- const ProviderResponseSchema$145 = zod.z.object({ data: zod.z.object({ cycleCreate: zod.z.object({
38466
- success: zod.z.boolean(),
38467
- cycle: CycleSchema.nullable().optional()
38468
- }) }) });
38492
+ const ProviderResponseSchema$145 = zod.z.object({
38493
+ data: zod.z.object({ cycleCreate: zod.z.object({
38494
+ success: zod.z.boolean(),
38495
+ cycle: CycleSchema.nullable().optional()
38496
+ }).nullable().optional() }).nullable().optional(),
38497
+ errors: zod.z.array(zod.z.object({ message: zod.z.string() })).optional()
38498
+ });
38469
38499
  const createCycleOutputSchema = zod.z.object({
38470
38500
  id: zod.z.string(),
38471
38501
  name: zod.z.string(),
@@ -38527,11 +38557,19 @@ function createCycleTool(proxy) {
38527
38557
  },
38528
38558
  retries: 10
38529
38559
  });
38530
- const payload = ProviderResponseSchema$145.parse(response.data).data.cycleCreate;
38531
- if (!payload.success || !payload.cycle) throw new platformProxy.ActionError({
38560
+ const parsed = ProviderResponseSchema$145.parse(response.data);
38561
+ if (parsed.errors && parsed.errors.length > 0) {
38562
+ const firstError = parsed.errors[0];
38563
+ throw new platformProxy.ActionError({
38564
+ type: "graphql_error",
38565
+ message: firstError?.message ?? "GraphQL error occurred."
38566
+ });
38567
+ }
38568
+ const payload = parsed.data?.cycleCreate;
38569
+ if (!payload?.success || !payload.cycle) throw new platformProxy.ActionError({
38532
38570
  type: "creation_failed",
38533
38571
  message: "Cycle creation failed or returned no cycle.",
38534
- success: payload.success
38572
+ success: payload?.success ?? false
38535
38573
  });
38536
38574
  const cycle = payload.cycle;
38537
38575
  return {
@@ -38570,7 +38608,7 @@ const ResponseSchema$1 = zod.z.object({ data: zod.z.object({ issueLabelCreate: z
38570
38608
  success: zod.z.boolean(),
38571
38609
  issueLabel: IssueLabelSchema$2
38572
38610
  }) }) });
38573
- const GraphQLErrorSchema$4 = zod.z.object({
38611
+ const GraphQLErrorSchema$7 = zod.z.object({
38574
38612
  message: zod.z.string(),
38575
38613
  path: zod.z.array(zod.z.string()).optional()
38576
38614
  });
@@ -38621,7 +38659,7 @@ function createIssueLabelTool(proxy) {
38621
38659
  });
38622
38660
  const raw = zod.z.object({
38623
38661
  data: zod.z.unknown(),
38624
- errors: zod.z.array(GraphQLErrorSchema$4).optional()
38662
+ errors: zod.z.array(GraphQLErrorSchema$7).optional()
38625
38663
  }).parse(response.data);
38626
38664
  if (raw.errors && raw.errors.length > 0) throw new platformProxy.ActionError({
38627
38665
  type: "graphql_error",
@@ -39080,7 +39118,7 @@ function createProjectTool(proxy) {
39080
39118
  //#endregion
39081
39119
  //#region src/providers/linear/tools/delete-attachment.ts
39082
39120
  const deleteAttachmentInputSchema = zod.z.object({ attachmentId: zod.z.string().describe("The identifier of the attachment to delete. Example: \"f4485af5-5d5a-4baf-bb8f-d66cbf7254c8\"") });
39083
- const GraphQLResponseSchema$12 = zod.z.object({
39121
+ const GraphQLResponseSchema$13 = zod.z.object({
39084
39122
  data: zod.z.object({ attachmentDelete: zod.z.object({
39085
39123
  success: zod.z.boolean(),
39086
39124
  lastSyncId: zod.z.number().optional()
@@ -39121,7 +39159,7 @@ function deleteAttachmentTool(proxy) {
39121
39159
  type: "provider_error",
39122
39160
  message: "Unexpected empty response from provider."
39123
39161
  });
39124
- const body = GraphQLResponseSchema$12.parse(response.data);
39162
+ const body = GraphQLResponseSchema$13.parse(response.data);
39125
39163
  const firstError = body.errors?.find(() => true);
39126
39164
  if (firstError) throw new platformProxy.ActionError({
39127
39165
  type: "provider_error",
@@ -39273,7 +39311,7 @@ function deleteIssueRelationTool(proxy) {
39273
39311
  //#endregion
39274
39312
  //#region src/providers/linear/tools/delete-issue.ts
39275
39313
  const deleteIssueInputSchema = zod.z.object({ id: zod.z.string().describe("The identifier of the issue to delete. Example: \"3e03fa02-a23a-40ac-93f4-bbdfd6120caf\"") });
39276
- const GraphQLResponseSchema$11 = zod.z.object({
39314
+ const GraphQLResponseSchema$12 = zod.z.object({
39277
39315
  data: zod.z.object({ issueDelete: zod.z.object({
39278
39316
  success: zod.z.boolean(),
39279
39317
  lastSyncId: zod.z.number().optional()
@@ -39314,7 +39352,7 @@ function deleteIssueTool(proxy) {
39314
39352
  },
39315
39353
  retries: 3
39316
39354
  });
39317
- const parsed = GraphQLResponseSchema$11.safeParse(response.data);
39355
+ const parsed = GraphQLResponseSchema$12.safeParse(response.data);
39318
39356
  if (!parsed.success) throw new platformProxy.ActionError({
39319
39357
  type: "invalid_response",
39320
39358
  message: "Unexpected response from Linear API",
@@ -39347,14 +39385,14 @@ const IssueSchema$3 = zod.z.object({
39347
39385
  const UserSchema$14 = zod.z.object({
39348
39386
  id: zod.z.string(),
39349
39387
  name: zod.z.string().optional(),
39350
- email: zod.z.string().optional()
39388
+ email: zod.z.string().nullable().optional()
39351
39389
  });
39352
39390
  const ExternalUserSchema = zod.z.object({
39353
39391
  id: zod.z.string(),
39354
39392
  name: zod.z.string().optional(),
39355
- email: zod.z.string().optional()
39393
+ email: zod.z.string().nullable().optional()
39356
39394
  });
39357
- const ProviderAttachmentSchema = zod.z.object({
39395
+ const ProviderAttachmentSchema$1 = zod.z.object({
39358
39396
  id: zod.z.string(),
39359
39397
  title: zod.z.string(),
39360
39398
  subtitle: zod.z.string().nullable().optional(),
@@ -39406,13 +39444,13 @@ const getAttachmentOutputSchema = zod.z.object({
39406
39444
  email: zod.z.string().optional()
39407
39445
  }).optional()
39408
39446
  });
39409
- const GraphQLErrorSchema$3 = zod.z.object({
39447
+ const GraphQLErrorSchema$6 = zod.z.object({
39410
39448
  message: zod.z.string(),
39411
39449
  extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
39412
39450
  });
39413
- const GraphQLResponseSchema$10 = zod.z.object({
39414
- data: zod.z.object({ attachment: ProviderAttachmentSchema.nullable() }).nullable(),
39415
- errors: zod.z.array(GraphQLErrorSchema$3).optional()
39451
+ const GraphQLResponseSchema$11 = zod.z.object({
39452
+ data: zod.z.object({ attachment: ProviderAttachmentSchema$1.nullable() }).nullable(),
39453
+ errors: zod.z.array(GraphQLErrorSchema$6).optional()
39416
39454
  });
39417
39455
  function getAttachmentTool(proxy) {
39418
39456
  return (0, _mastra_core_tools.createTool)({
@@ -39471,7 +39509,7 @@ function getAttachmentTool(proxy) {
39471
39509
  type: "missing_response",
39472
39510
  message: "Provider returned an empty response."
39473
39511
  });
39474
- const payload = GraphQLResponseSchema$10.parse(response.data);
39512
+ const payload = GraphQLResponseSchema$11.parse(response.data);
39475
39513
  const firstError = payload.errors?.[0];
39476
39514
  if (firstError) throw new platformProxy.ActionError({
39477
39515
  type: "graphql_error",
@@ -39655,6 +39693,14 @@ const getCycleOutputSchema = zod.z.object({
39655
39693
  startsAt: zod.z.string().optional(),
39656
39694
  endsAt: zod.z.string().optional()
39657
39695
  });
39696
+ const GraphQLErrorSchema$5 = zod.z.object({
39697
+ message: zod.z.string(),
39698
+ extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
39699
+ });
39700
+ const GraphQLResponseSchema$10 = zod.z.object({
39701
+ data: zod.z.object({ cycle: ProviderCycleSchema$2.nullable() }).nullable().optional(),
39702
+ errors: zod.z.array(GraphQLErrorSchema$5).optional()
39703
+ });
39658
39704
  function getCycleTool(proxy) {
39659
39705
  return (0, _mastra_core_tools.createTool)({
39660
39706
  id: "linear_get_cycle",
@@ -39663,19 +39709,26 @@ function getCycleTool(proxy) {
39663
39709
  outputSchema: getCycleOutputSchema,
39664
39710
  execute: async (input, { requestContext }) => {
39665
39711
  const platformProxy = proxy.withRequestContext(requestContext);
39666
- const cycleData = (await platformProxy.post({
39712
+ const response = await platformProxy.post({
39667
39713
  endpoint: "/graphql",
39668
39714
  data: {
39669
39715
  query: "query Cycle($id: String!) { cycle(id: $id) { id team { id name } progress startsAt endsAt } }",
39670
39716
  variables: { id: input.id }
39671
39717
  },
39672
39718
  retries: 3
39673
- })).data?.data?.cycle;
39674
- if (!cycleData) throw new platformProxy.ActionError({
39719
+ });
39720
+ const payload = GraphQLResponseSchema$10.parse(response.data);
39721
+ const firstError = payload.errors?.[0];
39722
+ if (firstError) throw new platformProxy.ActionError({
39723
+ type: "graphql_error",
39724
+ message: firstError.message,
39725
+ errors: payload.errors
39726
+ });
39727
+ const providerCycle = payload.data?.cycle;
39728
+ if (!providerCycle) throw new platformProxy.ActionError({
39675
39729
  type: "not_found",
39676
39730
  message: `Cycle with id ${input.id} not found.`
39677
39731
  });
39678
- const providerCycle = ProviderCycleSchema$2.parse(cycleData);
39679
39732
  return {
39680
39733
  id: providerCycle.id,
39681
39734
  ...providerCycle.team != null && { team: {
@@ -40377,6 +40430,11 @@ const PageInfoSchema$7 = zod.z.object({
40377
40430
  hasNextPage: zod.z.boolean(),
40378
40431
  endCursor: zod.z.string().nullable().optional()
40379
40432
  });
40433
+ const CreatorSchema = zod.z.object({
40434
+ id: zod.z.string(),
40435
+ name: zod.z.string(),
40436
+ email: zod.z.string().optional()
40437
+ });
40380
40438
  const AttachmentSchema$1 = zod.z.object({
40381
40439
  id: zod.z.string(),
40382
40440
  createdAt: zod.z.string(),
@@ -40389,16 +40447,8 @@ const AttachmentSchema$1 = zod.z.object({
40389
40447
  metadata: zod.z.record(zod.z.string(), zod.z.unknown()),
40390
40448
  groupBySource: zod.z.boolean(),
40391
40449
  bodyData: zod.z.string().nullable().optional(),
40392
- creator: zod.z.object({
40393
- id: zod.z.string(),
40394
- name: zod.z.string(),
40395
- email: zod.z.string()
40396
- }).nullable().optional(),
40397
- externalUserCreator: zod.z.object({
40398
- id: zod.z.string(),
40399
- name: zod.z.string(),
40400
- email: zod.z.string()
40401
- }).nullable().optional(),
40450
+ creator: CreatorSchema.nullable().optional(),
40451
+ externalUserCreator: CreatorSchema.nullable().optional(),
40402
40452
  issue: zod.z.object({
40403
40453
  id: zod.z.string(),
40404
40454
  identifier: zod.z.string(),
@@ -40410,6 +40460,18 @@ const AttachmentSchema$1 = zod.z.object({
40410
40460
  title: zod.z.string()
40411
40461
  }).nullable().optional()
40412
40462
  });
40463
+ const ProviderCreatorSchema = CreatorSchema.extend({ email: zod.z.string().nullable().optional() });
40464
+ const ProviderAttachmentSchema = AttachmentSchema$1.extend({
40465
+ creator: ProviderCreatorSchema.nullable().optional(),
40466
+ externalUserCreator: ProviderCreatorSchema.nullable().optional()
40467
+ });
40468
+ function toOutputCreator(creator) {
40469
+ return {
40470
+ id: creator.id,
40471
+ name: creator.name,
40472
+ ...creator.email != null && { email: creator.email }
40473
+ };
40474
+ }
40413
40475
  const listAttachmentsOutputSchema = zod.z.object({
40414
40476
  items: zod.z.array(AttachmentSchema$1),
40415
40477
  pageInfo: PageInfoSchema$7,
@@ -40507,7 +40569,14 @@ function listAttachmentsTool(proxy) {
40507
40569
  });
40508
40570
  const parsedPageInfo = PageInfoSchema$7.parse(pageInfo);
40509
40571
  return {
40510
- items: nodes.map((node) => AttachmentSchema$1.parse(node)),
40572
+ items: nodes.map((node) => {
40573
+ const { creator, externalUserCreator, ...raw } = ProviderAttachmentSchema.parse(node);
40574
+ return {
40575
+ ...raw,
40576
+ ...creator !== void 0 && { creator: creator === null ? null : toOutputCreator(creator) },
40577
+ ...externalUserCreator !== void 0 && { externalUserCreator: externalUserCreator === null ? null : toOutputCreator(externalUserCreator) }
40578
+ };
40579
+ }),
40511
40580
  pageInfo: parsedPageInfo,
40512
40581
  ...parsedPageInfo.endCursor != null && parsedPageInfo.hasNextPage && { nextCursor: parsedPageInfo.endCursor }
40513
40582
  };
@@ -40655,10 +40724,17 @@ const PageInfoSchema$5 = zod.z.object({
40655
40724
  hasNextPage: zod.z.boolean(),
40656
40725
  endCursor: zod.z.string().nullable().optional()
40657
40726
  });
40658
- const ProviderCyclesResponseSchema = zod.z.object({ data: zod.z.object({ cycles: zod.z.object({
40659
- nodes: zod.z.array(zod.z.unknown()),
40660
- pageInfo: PageInfoSchema$5
40661
- }) }) });
40727
+ const GraphQLErrorSchema$4 = zod.z.object({
40728
+ message: zod.z.string(),
40729
+ extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
40730
+ });
40731
+ const ProviderCyclesResponseSchema = zod.z.object({
40732
+ data: zod.z.object({ cycles: zod.z.object({
40733
+ nodes: zod.z.array(zod.z.unknown()),
40734
+ pageInfo: PageInfoSchema$5
40735
+ }).nullable().optional() }).nullable().optional(),
40736
+ errors: zod.z.array(GraphQLErrorSchema$4).optional()
40737
+ });
40662
40738
  const OutputCycleSchema = zod.z.object({
40663
40739
  id: zod.z.string(),
40664
40740
  name: zod.z.string().optional(),
@@ -40725,7 +40801,17 @@ function listCyclesTool(proxy) {
40725
40801
  message: "Unexpected response structure from Linear API",
40726
40802
  details: parsed.error.message
40727
40803
  });
40728
- const cyclesData = parsed.data.data.cycles;
40804
+ const firstError = parsed.data.errors?.[0];
40805
+ if (firstError) throw new platformProxy.ActionError({
40806
+ type: "graphql_error",
40807
+ message: firstError.message,
40808
+ errors: parsed.data.errors
40809
+ });
40810
+ const cyclesData = parsed.data.data?.cycles;
40811
+ if (!cyclesData) throw new platformProxy.ActionError({
40812
+ type: "invalid_response",
40813
+ message: "Linear API returned no cycles data."
40814
+ });
40729
40815
  const nodes = cyclesData.nodes;
40730
40816
  const pageInfo = cyclesData.pageInfo;
40731
40817
  return {
@@ -40904,13 +40990,13 @@ const listIssuesOutputSchema = zod.z.object({
40904
40990
  pageInfo: PageInfoSchema$3,
40905
40991
  nextCursor: zod.z.string().optional().describe("Convenience field matching pageInfo.endCursor when hasNextPage is true")
40906
40992
  });
40907
- const GraphQLErrorSchema$2 = zod.z.object({ message: zod.z.string() });
40993
+ const GraphQLErrorSchema$3 = zod.z.object({ message: zod.z.string() });
40908
40994
  const GraphQLResponseSchema$5 = zod.z.object({
40909
40995
  data: zod.z.object({ issues: zod.z.object({
40910
40996
  nodes: zod.z.array(zod.z.unknown()),
40911
40997
  pageInfo: PageInfoSchema$3
40912
40998
  }) }).optional(),
40913
- errors: zod.z.array(GraphQLErrorSchema$2).optional()
40999
+ errors: zod.z.array(GraphQLErrorSchema$3).optional()
40914
41000
  });
40915
41001
  function listIssuesTool(proxy) {
40916
41002
  return (0, _mastra_core_tools.createTool)({
@@ -41045,7 +41131,7 @@ const listProjectsOutputSchema$1 = zod.z.object({
41045
41131
  projects: zod.z.array(ProjectSchema$1),
41046
41132
  nextCursor: zod.z.string().optional()
41047
41133
  });
41048
- const RawLeadSchema = LeadSchema.nullable();
41134
+ const RawLeadSchema = LeadSchema.extend({ email: zod.z.string().nullable().optional() }).nullable();
41049
41135
  const RawProjectSchema = zod.z.object({
41050
41136
  id: zod.z.string(),
41051
41137
  name: zod.z.string(),
@@ -41067,7 +41153,8 @@ function listProjectsTool$1(proxy) {
41067
41153
  inputSchema: listProjectsInputSchema$1,
41068
41154
  outputSchema: listProjectsOutputSchema$1,
41069
41155
  execute: async (input, { requestContext }) => {
41070
- const response = await proxy.withRequestContext(requestContext).post({
41156
+ const platformProxy = proxy.withRequestContext(requestContext);
41157
+ const response = await platformProxy.post({
41071
41158
  endpoint: "/graphql",
41072
41159
  data: {
41073
41160
  query: `
@@ -41113,15 +41200,32 @@ function listProjectsTool$1(proxy) {
41113
41200
  },
41114
41201
  retries: 3
41115
41202
  });
41116
- const responseData = zod.z.object({ data: zod.z.object({ projects: zod.z.object({
41117
- nodes: zod.z.array(zod.z.unknown()),
41118
- pageInfo: zod.z.object({
41119
- hasNextPage: zod.z.boolean(),
41120
- endCursor: zod.z.string().nullable()
41121
- })
41122
- }) }) }).parse(response.data);
41123
- const nodes = responseData.data.projects.nodes;
41124
- const pageInfo = responseData.data.projects.pageInfo;
41203
+ const responseData = zod.z.object({
41204
+ data: zod.z.object({ projects: zod.z.object({
41205
+ nodes: zod.z.array(zod.z.unknown()),
41206
+ pageInfo: zod.z.object({
41207
+ hasNextPage: zod.z.boolean(),
41208
+ endCursor: zod.z.string().nullable()
41209
+ })
41210
+ }).nullable().optional() }).nullable().optional(),
41211
+ errors: zod.z.array(zod.z.object({
41212
+ message: zod.z.string(),
41213
+ extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
41214
+ })).optional()
41215
+ }).parse(response.data);
41216
+ const firstError = responseData.errors?.[0];
41217
+ if (firstError) throw new platformProxy.ActionError({
41218
+ type: "graphql_error",
41219
+ message: firstError.message,
41220
+ errors: responseData.errors
41221
+ });
41222
+ const projectsData = responseData.data?.projects;
41223
+ if (!projectsData) throw new platformProxy.ActionError({
41224
+ type: "invalid_response",
41225
+ message: "Linear API returned no projects data."
41226
+ });
41227
+ const nodes = projectsData.nodes;
41228
+ const pageInfo = projectsData.pageInfo;
41125
41229
  const projects = [];
41126
41230
  for (const node of nodes) {
41127
41231
  const raw = RawProjectSchema.parse(node);
@@ -41136,7 +41240,11 @@ function listProjectsTool$1(proxy) {
41136
41240
  ...raw.createdAt !== null && { createdAt: raw.createdAt },
41137
41241
  ...raw.updatedAt !== null && { updatedAt: raw.updatedAt },
41138
41242
  ...raw.url !== null && { url: raw.url },
41139
- ...raw.lead !== null && { lead: raw.lead },
41243
+ ...raw.lead !== null && { lead: {
41244
+ id: raw.lead.id,
41245
+ ...raw.lead.name !== void 0 && { name: raw.lead.name },
41246
+ ...raw.lead.email != null && { email: raw.lead.email }
41247
+ } },
41140
41248
  ...raw.teams !== null && { teams: raw.teams }
41141
41249
  };
41142
41250
  projects.push(project);
@@ -41251,7 +41359,7 @@ const listUsersInputSchema$5 = zod.z.object({
41251
41359
  filter: zod.z.object({ active: zod.z.boolean().optional().describe("Filter by user active state. Example: true") }).optional().describe("Filter options for users"),
41252
41360
  includeDisabled: zod.z.boolean().optional().describe("Include disabled/suspended users (default: false). Example: true")
41253
41361
  });
41254
- const GraphQLErrorSchema$1 = zod.z.object({ message: zod.z.string() }).passthrough();
41362
+ const GraphQLErrorSchema$2 = zod.z.object({ message: zod.z.string() }).passthrough();
41255
41363
  const GraphQLResponseSchema$3 = zod.z.object({
41256
41364
  data: zod.z.object({ users: zod.z.object({
41257
41365
  nodes: zod.z.array(zod.z.unknown()),
@@ -41260,7 +41368,7 @@ const GraphQLResponseSchema$3 = zod.z.object({
41260
41368
  endCursor: zod.z.string().nullable().optional()
41261
41369
  })
41262
41370
  }).optional() }).optional(),
41263
- errors: zod.z.array(GraphQLErrorSchema$1).optional()
41371
+ errors: zod.z.array(GraphQLErrorSchema$2).optional()
41264
41372
  });
41265
41373
  const UserNodeSchema = zod.z.object({
41266
41374
  id: zod.z.string(),
@@ -41817,11 +41925,18 @@ const ProviderProjectSchema$3 = zod.z.object({
41817
41925
  updatedAt: zod.z.string(),
41818
41926
  url: zod.z.string().optional()
41819
41927
  });
41820
- const ProviderResponseSchema$137 = zod.z.object({ data: zod.z.object({ projectUnarchive: zod.z.object({
41821
- success: zod.z.boolean(),
41822
- lastSyncId: zod.z.number(),
41823
- entity: ProviderProjectSchema$3.nullable()
41824
- }) }) });
41928
+ const GraphQLErrorSchema$1 = zod.z.object({
41929
+ message: zod.z.string(),
41930
+ extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
41931
+ });
41932
+ const ProviderResponseSchema$137 = zod.z.object({
41933
+ data: zod.z.object({ projectUnarchive: zod.z.object({
41934
+ success: zod.z.boolean(),
41935
+ lastSyncId: zod.z.number(),
41936
+ entity: ProviderProjectSchema$3.nullable()
41937
+ }).nullable().optional() }).nullable().optional(),
41938
+ errors: zod.z.array(GraphQLErrorSchema$1).optional()
41939
+ });
41825
41940
  const unarchiveProjectOutputSchema = zod.z.object({
41826
41941
  id: zod.z.string(),
41827
41942
  name: zod.z.string(),
@@ -41865,7 +41980,14 @@ function unarchiveProjectTool(proxy) {
41865
41980
  },
41866
41981
  retries: 3
41867
41982
  });
41868
- const project = ProviderResponseSchema$137.parse(response.data).data.projectUnarchive.entity;
41983
+ const providerResponse = ProviderResponseSchema$137.parse(response.data);
41984
+ const firstError = providerResponse.errors?.[0];
41985
+ if (firstError) throw new platformProxy.ActionError({
41986
+ type: "graphql_error",
41987
+ message: firstError.message,
41988
+ errors: providerResponse.errors
41989
+ });
41990
+ const project = providerResponse.data?.projectUnarchive?.entity;
41869
41991
  if (!project) throw new platformProxy.ActionError({
41870
41992
  type: "not_found",
41871
41993
  message: "Project not found or was deleted",