@mcinteerj/openclaw-gmail 1.7.0 → 1.7.1
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/package.json +1 -1
- package/src/api-client.ts +26 -6
- package/src/channel.ts +1 -0
- package/src/quoting.ts +11 -2
package/package.json
CHANGED
package/src/api-client.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { gmail as gmailApi, type gmail_v1 } from "@googleapis/gmail";
|
|
|
2
2
|
import type { OAuth2Client } from "google-auth-library";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import type { GmailClient } from "./gmail-client.js";
|
|
5
|
-
import type { ThreadResponse, GogRawMessage } from "./quoting.js";
|
|
5
|
+
import type { ThreadResponse, GogRawMessage, GogRawMessagePart } from "./quoting.js";
|
|
6
6
|
import type { GogSearchMessage } from "./inbound.js";
|
|
7
7
|
import { buildMimeMessage } from "./mime.js";
|
|
8
8
|
import { parseEmailAddresses } from "./outbound-check.js";
|
|
@@ -346,6 +346,23 @@ function mapApiMessage(msg: gmail_v1.Schema$Message): GogRawMessage {
|
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
+
function mapPart(p: gmail_v1.Schema$MessagePart): GogRawMessagePart {
|
|
350
|
+
return {
|
|
351
|
+
partId: p.partId ?? undefined,
|
|
352
|
+
mimeType: p.mimeType!,
|
|
353
|
+
filename: p.filename ?? undefined,
|
|
354
|
+
headers: p.headers?.map((h) => ({ name: h.name!, value: h.value! })),
|
|
355
|
+
body: p.body
|
|
356
|
+
? {
|
|
357
|
+
size: p.body.size ?? undefined,
|
|
358
|
+
data: p.body.data ?? undefined,
|
|
359
|
+
attachmentId: p.body.attachmentId ?? undefined,
|
|
360
|
+
}
|
|
361
|
+
: undefined,
|
|
362
|
+
parts: p.parts?.map(mapPart),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
349
366
|
function mapPayload(
|
|
350
367
|
p: gmail_v1.Schema$MessagePart,
|
|
351
368
|
): GogRawMessage["payload"] {
|
|
@@ -354,11 +371,14 @@ function mapPayload(
|
|
|
354
371
|
name: h.name!,
|
|
355
372
|
value: h.value!,
|
|
356
373
|
})),
|
|
357
|
-
parts: p.parts?.map(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
374
|
+
parts: p.parts?.map(mapPart),
|
|
375
|
+
body: p.body
|
|
376
|
+
? {
|
|
377
|
+
size: p.body.size ?? undefined,
|
|
378
|
+
data: p.body.data ?? undefined,
|
|
379
|
+
attachmentId: p.body.attachmentId ?? undefined,
|
|
380
|
+
}
|
|
381
|
+
: undefined,
|
|
362
382
|
};
|
|
363
383
|
}
|
|
364
384
|
|
package/src/channel.ts
CHANGED
|
@@ -319,6 +319,7 @@ export const gmailPlugin: ChannelPlugin<ResolvedGmailAccount> = {
|
|
|
319
319
|
"- Work silently; send ONE reply when complete. For long-running tasks, notify before starting or after completing.",
|
|
320
320
|
"",
|
|
321
321
|
"### Gmail Messaging",
|
|
322
|
+
"- **Reactions**: Gmail emoji reactions (e.g. 👍, ❤️) appear as emails but generally don't need a reply. Unless the context clearly warrants a response, you can skip replying to reaction-only messages.",
|
|
322
323
|
"- To reply to this email, just write your response normally as text in your turn. This will Reply All to everyone on the thread.",
|
|
323
324
|
"- Your Markdown response is automatically converted to a rich HTML email using the `marked` library.",
|
|
324
325
|
"- Headings, tables, and code blocks are fully supported.",
|
package/src/quoting.ts
CHANGED
|
@@ -36,6 +36,15 @@ export interface GogThreadOutput {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
export interface GogRawMessagePart {
|
|
40
|
+
partId?: string;
|
|
41
|
+
mimeType: string;
|
|
42
|
+
filename?: string;
|
|
43
|
+
headers?: { name: string; value: string }[];
|
|
44
|
+
body?: { size?: number; data?: string; attachmentId?: string };
|
|
45
|
+
parts?: GogRawMessagePart[];
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
export interface GogRawMessage {
|
|
40
49
|
id: string;
|
|
41
50
|
threadId: string;
|
|
@@ -43,8 +52,8 @@ export interface GogRawMessage {
|
|
|
43
52
|
labelIds: string[];
|
|
44
53
|
payload: {
|
|
45
54
|
headers: { name: string; value: string }[];
|
|
46
|
-
parts?:
|
|
47
|
-
body?: { data?: string };
|
|
55
|
+
parts?: GogRawMessagePart[];
|
|
56
|
+
body?: { size?: number; data?: string; attachmentId?: string };
|
|
48
57
|
};
|
|
49
58
|
}
|
|
50
59
|
|