@credal/actions 0.2.140 → 0.2.141

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.
@@ -7973,6 +7973,26 @@ export const googlemailSearchGmailMessagesDefinition = {
7973
7973
  type: "string",
7974
7974
  description: "The body of the message",
7975
7975
  },
7976
+ from: {
7977
+ type: "string",
7978
+ description: "The from header of the message",
7979
+ },
7980
+ to: {
7981
+ type: "string",
7982
+ description: "The to header of the message",
7983
+ },
7984
+ subject: {
7985
+ type: "string",
7986
+ description: "The subject header of the message",
7987
+ },
7988
+ cc: {
7989
+ type: "string",
7990
+ description: "The cc header of the message",
7991
+ },
7992
+ bcc: {
7993
+ type: "string",
7994
+ description: "The bcc header of the message",
7995
+ },
7976
7996
  },
7977
7997
  },
7978
7998
  },
@@ -5065,20 +5065,35 @@ export declare const googlemailSearchGmailMessagesOutputSchema: z.ZodObject<{
5065
5065
  labelIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5066
5066
  internalDate: z.ZodOptional<z.ZodString>;
5067
5067
  emailBody: z.ZodOptional<z.ZodString>;
5068
+ from: z.ZodOptional<z.ZodString>;
5069
+ to: z.ZodOptional<z.ZodString>;
5070
+ subject: z.ZodOptional<z.ZodString>;
5071
+ cc: z.ZodOptional<z.ZodString>;
5072
+ bcc: z.ZodOptional<z.ZodString>;
5068
5073
  }, "strip", z.ZodTypeAny, {
5069
5074
  id: string;
5070
5075
  threadId: string;
5076
+ subject?: string | undefined;
5077
+ to?: string | undefined;
5071
5078
  snippet?: string | undefined;
5072
5079
  labelIds?: string[] | undefined;
5073
5080
  internalDate?: string | undefined;
5074
5081
  emailBody?: string | undefined;
5082
+ cc?: string | undefined;
5083
+ bcc?: string | undefined;
5084
+ from?: string | undefined;
5075
5085
  }, {
5076
5086
  id: string;
5077
5087
  threadId: string;
5088
+ subject?: string | undefined;
5089
+ to?: string | undefined;
5078
5090
  snippet?: string | undefined;
5079
5091
  labelIds?: string[] | undefined;
5080
5092
  internalDate?: string | undefined;
5081
5093
  emailBody?: string | undefined;
5094
+ cc?: string | undefined;
5095
+ bcc?: string | undefined;
5096
+ from?: string | undefined;
5082
5097
  }>, "many">;
5083
5098
  error: z.ZodOptional<z.ZodString>;
5084
5099
  }, "strip", z.ZodTypeAny, {
@@ -5086,10 +5101,15 @@ export declare const googlemailSearchGmailMessagesOutputSchema: z.ZodObject<{
5086
5101
  messages: {
5087
5102
  id: string;
5088
5103
  threadId: string;
5104
+ subject?: string | undefined;
5105
+ to?: string | undefined;
5089
5106
  snippet?: string | undefined;
5090
5107
  labelIds?: string[] | undefined;
5091
5108
  internalDate?: string | undefined;
5092
5109
  emailBody?: string | undefined;
5110
+ cc?: string | undefined;
5111
+ bcc?: string | undefined;
5112
+ from?: string | undefined;
5093
5113
  }[];
5094
5114
  error?: string | undefined;
5095
5115
  }, {
@@ -5097,10 +5117,15 @@ export declare const googlemailSearchGmailMessagesOutputSchema: z.ZodObject<{
5097
5117
  messages: {
5098
5118
  id: string;
5099
5119
  threadId: string;
5120
+ subject?: string | undefined;
5121
+ to?: string | undefined;
5100
5122
  snippet?: string | undefined;
5101
5123
  labelIds?: string[] | undefined;
5102
5124
  internalDate?: string | undefined;
5103
5125
  emailBody?: string | undefined;
5126
+ cc?: string | undefined;
5127
+ bcc?: string | undefined;
5128
+ from?: string | undefined;
5104
5129
  }[];
5105
5130
  error?: string | undefined;
5106
5131
  }>;
@@ -2946,6 +2946,11 @@ export const googlemailSearchGmailMessagesOutputSchema = z.object({
2946
2946
  labelIds: z.array(z.string()).describe("Labels on the message").optional(),
2947
2947
  internalDate: z.string().describe("Internal timestamp of the message").optional(),
2948
2948
  emailBody: z.string().describe("The body of the message").optional(),
2949
+ from: z.string().describe("The from header of the message").optional(),
2950
+ to: z.string().describe("The to header of the message").optional(),
2951
+ subject: z.string().describe("The subject header of the message").optional(),
2952
+ cc: z.string().describe("The cc header of the message").optional(),
2953
+ bcc: z.string().describe("The bcc header of the message").optional(),
2949
2954
  }))
2950
2955
  .describe("List of matching Gmail messages"),
2951
2956
  error: z.string().describe("Error message if search failed").optional(),
@@ -1,4 +1,9 @@
1
- interface GmailMessage {
1
+ export interface GmailMessage {
2
+ id: string;
3
+ threadId: string;
4
+ snippet: string;
5
+ labelIds: string[] | undefined;
6
+ internalDate: string;
2
7
  payload: {
3
8
  mimeType: string;
4
9
  body?: {
@@ -13,6 +18,10 @@ interface GmailMessage {
13
18
  };
14
19
  parts?: GmailMessagePart[];
15
20
  }>;
21
+ headers: {
22
+ name: string;
23
+ value: string;
24
+ }[];
16
25
  };
17
26
  }
18
27
  interface GmailMessagePart {
@@ -66,10 +66,28 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
66
66
  headers: { Authorization: `Bearer ${authParams.authToken}` },
67
67
  validateStatus: () => true,
68
68
  });
69
- const { id, threadId, snippet, labelIds, internalDate } = msgRes.data;
69
+ const { id, threadId, snippet, labelIds, internalDate, payload } = msgRes.data;
70
+ // Find the "From" header
71
+ const fromHeader = payload.headers.find(h => h.name.toLowerCase() === "from");
72
+ const toHeader = payload.headers.find(h => h.name.toLowerCase() === "to");
73
+ const subjectHeader = payload.headers.find(h => h.name.toLowerCase() === "subject");
74
+ const ccHeader = payload.headers.find(h => h.name.toLowerCase() === "cc");
75
+ const bccHeader = payload.headers.find(h => h.name.toLowerCase() === "bcc");
70
76
  const rawBody = getEmailContent(msgRes.data) || "";
71
77
  const emailBody = cleanAndTruncateEmail(rawBody);
72
- return { id, threadId, snippet, labelIds, internalDate, emailBody };
78
+ return {
79
+ id,
80
+ threadId,
81
+ snippet,
82
+ labelIds,
83
+ internalDate,
84
+ emailBody,
85
+ from: fromHeader === null || fromHeader === void 0 ? void 0 : fromHeader.value,
86
+ to: toHeader === null || toHeader === void 0 ? void 0 : toHeader.value,
87
+ subject: subjectHeader === null || subjectHeader === void 0 ? void 0 : subjectHeader.value,
88
+ cc: ccHeader === null || ccHeader === void 0 ? void 0 : ccHeader.value,
89
+ bcc: bccHeader === null || bccHeader === void 0 ? void 0 : bccHeader.value,
90
+ };
73
91
  }
74
92
  catch (err) {
75
93
  const errorMessage = err instanceof Error ? err.message : "Failed to fetch message details";
@@ -82,6 +100,11 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
82
100
  internalDate: "",
83
101
  emailBody: "",
84
102
  error: errorMessage,
103
+ from: "",
104
+ to: "",
105
+ subject: "",
106
+ cc: "",
107
+ bcc: "",
85
108
  };
86
109
  }
87
110
  })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.140",
3
+ "version": "0.2.141",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,