@mastra/connect 1.0.1 → 1.0.2

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