@macro-inc/sdk 0.2.2 → 0.4.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/README.md +177 -3
- package/dist/{chunk-OGE7WXJE.js → chunk-AZJUIUIV.js} +177 -23
- package/dist/{chunk-PRUFPW3B.js → chunk-G43PLP2U.js} +144 -0
- package/dist/{chunk-7LVVPVNT.js → chunk-K4G5VO4P.js} +76 -1
- package/dist/{chunk-PAAFJYGO.js → chunk-PPR7IWZ7.js} +77 -51
- package/dist/{chunk-QVBNNMQS.js → chunk-PTX2RV2N.js} +169 -20
- package/dist/{chunk-SUINKDXF.js → chunk-PZPTJI6F.js} +42 -0
- package/dist/{chunk-7YJ6Y7HJ.js → chunk-XFA7NCJ5.js} +207 -0
- package/dist/{chunk-ZQXOHNDB.js → chunk-ZLBDES7U.js} +789 -12
- package/dist/generated/agent-fold/index.d.ts +4332 -0
- package/dist/generated/agent-fold/index.js +0 -0
- package/dist/generated/agent-harness/index.d.ts +1 -1
- package/dist/generated/agent-harness/index.js +1 -1
- package/dist/generated/agent-harness/sdk.gen.d.ts +83 -9
- package/dist/generated/agent-harness/types.gen.d.ts +1504 -160
- package/dist/generated/agent-reviews/index.d.ts +893 -0
- package/dist/generated/agent-reviews/index.js +0 -0
- package/dist/generated/auth/index.d.ts +1 -1
- package/dist/generated/auth/index.js +1 -1
- package/dist/generated/auth/sdk.gen.d.ts +108 -2
- package/dist/generated/auth/types.gen.d.ts +799 -6
- package/dist/generated/calendar/index.d.ts +1 -1
- package/dist/generated/calendar/index.js +1 -1
- package/dist/generated/calendar/sdk.gen.d.ts +63 -1
- package/dist/generated/calendar/types.gen.d.ts +1234 -5
- package/dist/generated/cognition/index.d.ts +1 -1
- package/dist/generated/cognition/index.js +1 -1
- package/dist/generated/cognition/sdk.gen.d.ts +85 -20
- package/dist/generated/cognition/types.gen.d.ts +1040 -121
- package/dist/generated/connection/index.d.ts +1 -1
- package/dist/generated/connection/index.js +15 -0
- package/dist/generated/connection/sdk.gen.d.ts +6 -1
- package/dist/generated/connection/types.gen.d.ts +18 -1
- package/dist/generated/email/index.d.ts +1 -1
- package/dist/generated/email/index.js +1 -1
- package/dist/generated/email/sdk.gen.d.ts +44 -2
- package/dist/generated/email/types.gen.d.ts +475 -10
- package/dist/generated/notification/index.d.ts +1 -1
- package/dist/generated/notification/index.js +1 -1
- package/dist/generated/notification/sdk.gen.d.ts +29 -21
- package/dist/generated/notification/types.gen.d.ts +267 -73
- package/dist/generated/properties/index.d.ts +1 -1
- package/dist/generated/properties/types.gen.d.ts +21 -1
- package/dist/generated/scheduled-action/index.d.ts +1 -1
- package/dist/generated/scheduled-action/index.js +1 -1
- package/dist/generated/scheduled-action/sdk.gen.d.ts +8 -1
- package/dist/generated/scheduled-action/types.gen.d.ts +669 -19
- package/dist/generated/search/index.d.ts +1 -1
- package/dist/generated/search/types.gen.d.ts +87 -7
- package/dist/generated/static-files/types.gen.d.ts +6 -0
- package/dist/generated/storage/index.d.ts +1 -1
- package/dist/generated/storage/index.js +1 -1
- package/dist/generated/storage/sdk.gen.d.ts +376 -13
- package/dist/generated/storage/types.gen.d.ts +12038 -5562
- package/dist/src/entities/account-managers/grant.d.ts +39 -0
- package/dist/src/entities/account-managers/namespace.d.ts +17 -0
- package/dist/src/entities/agent-sessions/activity.d.ts +39 -0
- package/dist/src/entities/agent-sessions/agent-session.d.ts +148 -6
- package/dist/src/entities/agent-sessions/code-execution.d.ts +5 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +54 -4
- package/dist/src/entities/agent-sessions/origin.d.ts +94 -0
- package/dist/src/entities/agent-sessions/review.d.ts +18 -62
- package/dist/src/entities/agent-sessions/view.d.ts +11 -0
- package/dist/src/entities/agents/namespace.d.ts +11 -2
- package/dist/src/entities/ai/namespace.d.ts +5 -1
- package/dist/src/entities/api-keys/namespace.d.ts +5 -1
- package/dist/src/entities/bots/bot.d.ts +108 -0
- package/dist/src/entities/bots/namespace.d.ts +17 -4
- package/dist/src/entities/bots/token.d.ts +34 -0
- package/dist/src/entities/calendar/booking-link.d.ts +49 -0
- package/dist/src/entities/calendar/booking-namespace.d.ts +130 -0
- package/dist/src/entities/calendar/booking-namespace.test.d.ts +1 -0
- package/dist/src/entities/calendar/booking.d.ts +77 -0
- package/dist/src/entities/calendar/calendar.d.ts +11 -4
- package/dist/src/entities/calendar/create-confirmed.test.d.ts +1 -0
- package/dist/src/entities/calendar/event.d.ts +104 -3
- package/dist/src/entities/calendar/namespace.d.ts +151 -7
- package/dist/src/entities/calendar/namespace.test.d.ts +1 -0
- package/dist/src/entities/calls/call-record.d.ts +34 -4
- package/dist/src/entities/calls/connection.d.ts +53 -0
- package/dist/src/entities/calls/errors.d.ts +15 -0
- package/dist/src/entities/calls/namespace.d.ts +21 -1
- package/dist/src/entities/calls/participant.d.ts +22 -0
- package/dist/src/entities/channels/access-request.d.ts +34 -0
- package/dist/src/entities/channels/channel.d.ts +47 -1
- package/dist/src/entities/channels/namespace.d.ts +21 -5
- package/dist/src/entities/channels/namespace.test.d.ts +1 -0
- package/dist/src/entities/channels/post.d.ts +14 -3
- package/dist/src/entities/channels/thread.d.ts +10 -1
- package/dist/src/entities/chats/chat.d.ts +7 -1
- package/dist/src/entities/chats/namespace.d.ts +14 -1
- package/dist/src/entities/connected-apps/connected-app.d.ts +107 -0
- package/dist/src/entities/connected-apps/connector.d.ts +56 -0
- package/dist/src/entities/connected-apps/namespace.d.ts +74 -0
- package/dist/src/entities/crm/company.d.ts +7 -3
- package/dist/src/entities/crm/contact.d.ts +4 -4
- package/dist/src/entities/crm/namespace.d.ts +34 -1
- package/dist/src/entities/crm/pipeline.d.ts +43 -2
- package/dist/src/entities/databases/database.d.ts +17 -0
- package/dist/src/entities/databases/namespace.d.ts +56 -0
- package/dist/src/entities/documents/ai-edit.d.ts +52 -0
- package/dist/src/entities/documents/document.d.ts +244 -5
- package/dist/src/entities/documents/namespace.d.ts +89 -4
- package/dist/src/entities/documents/office-files.d.ts +47 -0
- package/dist/src/entities/email/draft.d.ts +36 -7
- package/dist/src/entities/email/message.d.ts +99 -3
- package/dist/src/entities/email/namespace.d.ts +47 -4
- package/dist/src/entities/email/namespace.test.d.ts +1 -0
- package/dist/src/entities/email/thread.d.ts +55 -3
- package/dist/src/entities/entity-mentions/namespace.d.ts +5 -1
- package/dist/src/entities/external-chat/chat.d.ts +105 -0
- package/dist/src/entities/external-chat/message.d.ts +54 -0
- package/dist/src/entities/external-chat/namespace.d.ts +18 -0
- package/dist/src/entities/external-chat/participant.d.ts +28 -0
- package/dist/src/entities/external-chat/send.d.ts +32 -0
- package/dist/src/entities/external-chat/upload.d.ts +25 -0
- package/dist/src/entities/favorites/namespace.d.ts +5 -1
- package/dist/src/entities/foreign/namespace.d.ts +3 -0
- package/dist/src/entities/forms/form.d.ts +17 -2
- package/dist/src/entities/forms/namespace.d.ts +5 -1
- package/dist/src/entities/github-pull-requests/namespace.d.ts +5 -1
- package/dist/src/entities/harnesses/harness.d.ts +9 -0
- package/dist/src/entities/harnesses/namespace.d.ts +5 -1
- package/dist/src/entities/images/image.d.ts +77 -0
- package/dist/src/entities/images/namespace.d.ts +48 -0
- package/dist/src/entities/images/namespace.test.d.ts +1 -0
- package/dist/src/entities/initiatives/initiative.d.ts +12 -1
- package/dist/src/entities/initiatives/namespace.d.ts +15 -2
- package/dist/src/entities/me/namespace.d.ts +43 -0
- package/dist/src/entities/meetings/meeting.d.ts +5 -0
- package/dist/src/entities/meetings/namespace.d.ts +5 -1
- package/dist/src/entities/messages/thread.d.ts +1 -1
- package/dist/src/entities/notifications/namespace.d.ts +3 -0
- package/dist/src/entities/pins/namespace.d.ts +5 -1
- package/dist/src/entities/projects/namespace.d.ts +4 -1
- package/dist/src/entities/projects/project.d.ts +9 -1
- package/dist/src/entities/properties/namespace.d.ts +2 -0
- package/dist/src/entities/referrals/namespace.d.ts +33 -0
- package/dist/src/entities/routines/namespace.d.ts +42 -2
- package/dist/src/entities/routines/routine.d.ts +84 -5
- package/dist/src/entities/search/namespace.d.ts +65 -0
- package/dist/src/entities/{search.d.ts → search/options.d.ts} +8 -2
- package/dist/src/entities/search/types.d.ts +90 -0
- package/dist/src/entities/sharing/access.d.ts +14 -0
- package/dist/src/entities/tasks/namespace.d.ts +42 -3
- package/dist/src/entities/tasks/task.d.ts +47 -6
- package/dist/src/entities/teams/invite.d.ts +30 -0
- package/dist/src/entities/teams/namespace.d.ts +3 -0
- package/dist/src/entities/teams/team.d.ts +37 -0
- package/dist/src/entities/unfurls/namespace.d.ts +5 -1
- package/dist/src/entities/users/namespace.d.ts +9 -0
- package/dist/src/entities/users/user.d.ts +8 -0
- package/dist/src/entities/web/namespace.d.ts +61 -0
- package/dist/src/entities/web/namespace.test.d.ts +1 -0
- package/dist/src/entities/webhooks/namespace.d.ts +2 -0
- package/dist/src/entities/whatsapp/account.d.ts +20 -0
- package/dist/src/entities/whatsapp/chat.d.ts +54 -0
- package/dist/src/entities/whatsapp/namespace.d.ts +23 -0
- package/dist/src/entities/workspace/items.d.ts +7 -0
- package/dist/src/entities/workspace/namespace.d.ts +14 -9
- package/dist/src/entities/workspace/query.d.ts +23 -0
- package/dist/src/entities/workspace/types.d.ts +6 -3
- package/dist/src/events/hydrate/agentSession.d.ts +1 -1
- package/dist/src/events/hydrate/call.d.ts +101 -0
- package/dist/src/events/hydrate/channel.d.ts +8 -1
- package/dist/src/events/hydrate/document.d.ts +1 -1
- package/dist/src/events/hydrate/message.d.ts +1 -1
- package/dist/src/events/types.d.ts +2 -1
- package/dist/src/macro.d.ts +73 -4
- package/dist/src/macro.js +8235 -3701
- package/dist/src/mentions.d.ts +6 -1
- package/dist/src/utils/activity.d.ts +23 -2
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/unwrap.d.ts +27 -2
- package/package.json +2 -2
|
@@ -1,11 +1,43 @@
|
|
|
1
1
|
import type { MacroClient } from '../../utils/client';
|
|
2
2
|
import type { EmailAttachment } from '../email/attachment';
|
|
3
3
|
import type { Project } from '../projects/project';
|
|
4
|
-
import type { SearchOpts } from '../search';
|
|
4
|
+
import type { SearchOpts } from '../search/options';
|
|
5
5
|
import type { Team } from '../teams/team';
|
|
6
6
|
import { User } from '../users/user';
|
|
7
7
|
import { Document } from './document';
|
|
8
8
|
import { SystemSkill } from './system-skill';
|
|
9
|
+
/** A file's content: its bytes, or text stored as UTF-8. */
|
|
10
|
+
export type FileContent = Uint8Array<ArrayBuffer> | ArrayBuffer | Blob | string;
|
|
11
|
+
/**
|
|
12
|
+
* @routing Use when writing, creating, reading or editing a document of any kind, such as a brief, notes, a spec, a canvas, a spreadsheet or a deck; not databases, tasks or email.
|
|
13
|
+
*
|
|
14
|
+
* @agent
|
|
15
|
+
* ## Changing a document's text
|
|
16
|
+
*
|
|
17
|
+
* Change the text of an existing Markdown document or task body in place, with `document.edit(instructions)` in code or the `EditDocument` tool where code isn't available. Never recreate the document or upload its Markdown to change its text. PDF, Word and other uploaded files can't be edited this way.
|
|
18
|
+
*
|
|
19
|
+
* ## Uploaded Office and design files
|
|
20
|
+
*
|
|
21
|
+
* Edit an uploaded Word file with `readWord()` then `editWord(operations)`, and a PowerPoint deck with `readPresentation()` then `editPresentation(operations)` (or `copyPresentation()` for a new deck): both address paragraphs, slides and shapes by the ids the read reports. Read Figma, Photoshop and Illustrator files with `readDesign()`, `readPhotoshop()` and `readIllustrator()`; they can't be edited. Never rebuild these files from `bytes()`.
|
|
22
|
+
*
|
|
23
|
+
* ## Linking Macro items inside document content
|
|
24
|
+
*
|
|
25
|
+
* `CreateDocument` content (the `fileContent` argument) is rendered with the same Markdown parser used for chat responses, channel messages, and email bodies inside the Macro app — but only for Markdown (`.md`) documents. Non-Markdown documents (e.g. PDF, CSV, PNG, XLSX, DOCX, created by passing a non-`md` `file_extension`) are stored as raw file bytes and must never contain Markdown syntax or mention tags.
|
|
26
|
+
*
|
|
27
|
+
* For Markdown document content, link to other Macro documents, channels, chats, projects, tasks, or email threads using `<m-document-mention>` XML mention tags, e.g.:
|
|
28
|
+
*
|
|
29
|
+
* `<m-document-mention>{"documentId":"{id}","documentName":"","blockName":"md","blockParams":{}}</m-document-mention>`
|
|
30
|
+
*
|
|
31
|
+
* The same Markdown parser also renders the other in-app chip tags: `<m-date-mention>` for a day or time, `<m-agent-session-mention>` for an agent session (add `"expanded":true` for the card that follows the latest turn), `<m-user-mention>` / `<m-contact-mention>` / `<m-group-mention>` for people and groups, `<m-pr-mention>` for a pull request, and `<m-booking-link-mention>` for a booking link. Use those tags in document content the same way you would in a chat reply.
|
|
32
|
+
*
|
|
33
|
+
* Reference a GitHub pull request with a PR chip rather than a Markdown link or bare URL: `<m-pr-mention>{"url":"https://github.com/{owner}/{repo}/pull/{number}","label":""}</m-pr-mention>`. Put the PR's github.com URL in `url`; no Macro id is needed. This applies to Markdown document content and to `SendChannelMessage` content, which uses the same Markdown syntax. The chip shows the PR's number, title, and live status and opens it in Macro, so leave `label` empty and do not repeat the number or title beside it. Issues, commits, and other GitHub pages stay Markdown links. Your own chat replies to the MCP client still link pull requests as plain Markdown URLs.
|
|
34
|
+
*
|
|
35
|
+
* Reference a Macro booking link with a booking-link chip rather than a Markdown link or bare URL: `<m-booking-link-mention>{"profileId":"{profile_id}","slug":"{slug}","url":"https://macro.com/app/book/{profile_id}/{slug}","label":""}</m-booking-link-mention>` (`slug` optional when linking the profile page). Put the shareable URL in `url` and the path's profile id (and slug when present) in `profileId`/`slug`. Leave `label` empty. Your own chat replies to the MCP client still link booking pages as plain Markdown URLs.
|
|
36
|
+
*
|
|
37
|
+
* This holds true even when `CreateDocument` is called through the MCP server, where you are otherwise told to link items in your own chat replies as plain Markdown URLs — that rule is about your conversational responses to the MCP client, not about content you write into a Macro document. Do NOT use plain Markdown links or bare URLs to reference other Macro items inside document content; only `<m-document-mention>` tags (and the other chip tags above) render as working links there.
|
|
38
|
+
*
|
|
39
|
+
* The same applies to `EditDocument`: when its `instructions` ask for a mention chip (person, date/time, document, agent session, booking link, and so on) or a document-card, include the referenced item's ids and details so the editing worker can construct the correct in-app markup itself. Date chips need an ISO datetime and displayFormat; they do not need a looked-up id. Booking-link chips need profileId, url, and slug when the URL has one.
|
|
40
|
+
*/
|
|
9
41
|
export declare class DocumentNamespace {
|
|
10
42
|
private readonly client;
|
|
11
43
|
/** Resolve a team task reference such as ENG-42. */
|
|
@@ -18,7 +50,36 @@ export declare class DocumentNamespace {
|
|
|
18
50
|
expiresAt: number;
|
|
19
51
|
issuer: string;
|
|
20
52
|
}>;
|
|
21
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Upload a file as a new document, up to 25 MiB: generated output such as a
|
|
55
|
+
* CSV, a rendered PDF or an image, or bytes read with `Document.bytes()`.
|
|
56
|
+
* Use `create` for Markdown you want to edit in Macro.
|
|
57
|
+
*
|
|
58
|
+
* `name` is the filename with its extension, which sets the file type
|
|
59
|
+
* (`report.pdf`, `data.csv`). `content` is the file's bytes, or a string
|
|
60
|
+
* stored as UTF-8 text. Uploading into `project` needs edit access to it.
|
|
61
|
+
* The document is ready to read and attach when this resolves; its preview
|
|
62
|
+
* and search indexing finish shortly after.
|
|
63
|
+
*
|
|
64
|
+
* @example Upload a generated CSV and share it in a channel.
|
|
65
|
+
* ```js
|
|
66
|
+
* const rows = [['name', 'amount'], ['Acme', 1200]];
|
|
67
|
+
* const file = await macro.documents.upload({
|
|
68
|
+
* name: 'invoices.csv',
|
|
69
|
+
* content: rows.map((row) => row.join(',')).join('\n'),
|
|
70
|
+
* });
|
|
71
|
+
* await channel.send('Invoices attached.', { documents: [file] });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
upload(options: {
|
|
75
|
+
name: string;
|
|
76
|
+
content: FileContent;
|
|
77
|
+
project?: Project;
|
|
78
|
+
}): Promise<Document>;
|
|
79
|
+
/**
|
|
80
|
+
* Reserve a binary document and return a presigned URL to PUT its content
|
|
81
|
+
* to. The URL is outside the hosts code mode can reach; use `upload` there.
|
|
82
|
+
*/
|
|
22
83
|
createUpload(options: {
|
|
23
84
|
name: string;
|
|
24
85
|
sha: string;
|
|
@@ -44,21 +105,45 @@ export declare class DocumentNamespace {
|
|
|
44
105
|
markdown?: string;
|
|
45
106
|
project?: Project;
|
|
46
107
|
}): Promise<Document>;
|
|
108
|
+
/** Create a native Canvas with shared content ready for reading and editing. */
|
|
109
|
+
createCanvas(opts: {
|
|
110
|
+
name: string;
|
|
111
|
+
project?: Project;
|
|
112
|
+
}): Promise<Document>;
|
|
47
113
|
/** Create a snippet: a reusable markdown document. */
|
|
48
114
|
createSnippet(opts: {
|
|
49
115
|
name: string;
|
|
50
116
|
markdown?: string;
|
|
51
117
|
project?: Project;
|
|
52
118
|
}): Promise<Document>;
|
|
53
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Create a skill: markdown instructions that AI reads and follows.
|
|
121
|
+
*
|
|
122
|
+
* A skill is a markdown document, so read one with `content()`, by the id of
|
|
123
|
+
* a skill mention or of a search result:
|
|
124
|
+
*
|
|
125
|
+
* ```js
|
|
126
|
+
* const skill = macro.documents.byId(skillId);
|
|
127
|
+
* const instructions = await skill.content();
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* Read a skill the request names before doing the task, and follow it for
|
|
131
|
+
* that request only. `systemSkills()` lists the built-in skills, whose
|
|
132
|
+
* instructions have no document; read those with the ReadSkill tool.
|
|
133
|
+
*
|
|
134
|
+
* `description` says when to use the skill, in one line starting "Use when"
|
|
135
|
+
* (at most 300 characters); agents load the skill for requests it describes.
|
|
136
|
+
*/
|
|
54
137
|
createSkill(opts: {
|
|
55
138
|
name: string;
|
|
139
|
+
description: string;
|
|
56
140
|
markdown?: string;
|
|
57
141
|
project?: Project;
|
|
58
142
|
}): Promise<Document>;
|
|
59
143
|
/**
|
|
60
144
|
* The built-in system skills: static AI instructions with no document
|
|
61
|
-
* behind them. Unlike user skills they cannot be opened or edited
|
|
145
|
+
* behind them. Unlike user skills they cannot be opened or edited, and
|
|
146
|
+
* their instructions are read with the ReadSkill tool, not `content()`.
|
|
62
147
|
*/
|
|
63
148
|
systemSkills(): Promise<SystemSkill[]>;
|
|
64
149
|
/** Search documents by name and content, most relevant first, auto-paginated. */
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { CreatedItem, EditOp, WordDocumentOperation } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { Document } from './document';
|
|
3
|
+
/**
|
|
4
|
+
* One PowerPoint edit operation, discriminated by `op` (`setText`,
|
|
5
|
+
* `formatText`, `addShape`, `addSlide`, `setChartData`, `replaceText`, ...).
|
|
6
|
+
* Slides and shapes are addressed by the ids `readPresentation()` reports,
|
|
7
|
+
* positions and sizes are in points, and colors are RRGGBB hex or theme names.
|
|
8
|
+
*/
|
|
9
|
+
export type PresentationEditOperation = EditOp;
|
|
10
|
+
/**
|
|
11
|
+
* One Word edit operation, discriminated by `type` (`replaceText`, `setText`,
|
|
12
|
+
* `formatText`, `insertParagraph`, `delete`, `setStyle`, `addComment`).
|
|
13
|
+
* Paragraphs and blocks are addressed by the ids `readWord()` reports.
|
|
14
|
+
*/
|
|
15
|
+
export type WordEditOperation = WordDocumentOperation;
|
|
16
|
+
/** A slide, shape or section a presentation edit created. */
|
|
17
|
+
export type PresentationCreatedItem = CreatedItem;
|
|
18
|
+
/** What a presentation edit did. */
|
|
19
|
+
export interface PresentationEditResult {
|
|
20
|
+
/** Slides and shapes the operations created, in order. */
|
|
21
|
+
created: PresentationCreatedItem[];
|
|
22
|
+
/**
|
|
23
|
+
* Whether slides were added, removed or reordered, or the slide size or
|
|
24
|
+
* sections changed.
|
|
25
|
+
*/
|
|
26
|
+
structureChanged: boolean;
|
|
27
|
+
/** The changed slides as they now read. */
|
|
28
|
+
changedSlides: string;
|
|
29
|
+
}
|
|
30
|
+
/** An edited copy of a presentation, created as a new document. */
|
|
31
|
+
export interface PresentationCopy extends PresentationEditResult {
|
|
32
|
+
/** The new presentation. */
|
|
33
|
+
document: Document;
|
|
34
|
+
}
|
|
35
|
+
/** Options for `Document.editWord`. */
|
|
36
|
+
export interface WordEditOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Record the edits as tracked changes (`true`) or apply them directly
|
|
39
|
+
* (`false`). Omit to follow the document's own Track Changes setting.
|
|
40
|
+
*/
|
|
41
|
+
trackChanges?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Name the tracked changes and comments are attributed to. Omit to use the
|
|
44
|
+
* requesting user's name; pass one only when the user names someone else.
|
|
45
|
+
*/
|
|
46
|
+
author?: string;
|
|
47
|
+
}
|
|
@@ -4,7 +4,9 @@ import type { EmailAttachment } from './attachment';
|
|
|
4
4
|
import { EmailMessage } from './message';
|
|
5
5
|
import type { EmailThread } from './thread';
|
|
6
6
|
/** Draft content; relationships use message and thread handles. */
|
|
7
|
-
export type DraftOptions = Omit<ApiDraftInput, 'db_id' | 'provider_id' | 'provider_thread_id' | 'replying_to_id' | 'thread_db_id' | 'body_text' | 'body_html' | 'body_macro' | 'headers_json' | 'include_signature'> & {
|
|
7
|
+
export type DraftOptions = Omit<ApiDraftInput, 'db_id' | 'provider_id' | 'provider_thread_id' | 'replying_to_id' | 'thread_db_id' | 'body_text' | 'body_html' | 'body_macro' | 'headers_json' | 'include_signature' | 'draft_generation'> & {
|
|
8
|
+
/** Generation captured when editing began; defaults to the loaded draft. */
|
|
9
|
+
draftGeneration?: number;
|
|
8
10
|
/** Plain text body. */
|
|
9
11
|
bodyText?: string;
|
|
10
12
|
/** HTML body. */
|
|
@@ -20,19 +22,43 @@ export type DraftOptions = Omit<ApiDraftInput, 'db_id' | 'provider_id' | 'provid
|
|
|
20
22
|
/** Message being replied to. */
|
|
21
23
|
replyingTo?: EmailMessage;
|
|
22
24
|
};
|
|
25
|
+
/** Options for sending or scheduling a saved draft. */
|
|
26
|
+
export interface DraftSendOptions {
|
|
27
|
+
/** `false` leaves the inbox signature off this one email; omit for the inbox's default. */
|
|
28
|
+
includeSignature?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The user's own reply approving this send, quoted verbatim. Required from
|
|
31
|
+
* an agent's program; never the request that asked for the email.
|
|
32
|
+
*/
|
|
33
|
+
userConfirmation?: string;
|
|
34
|
+
}
|
|
23
35
|
/** A draft email. Sending remains an explicit separate operation. */
|
|
24
36
|
export declare class EmailDraft extends EmailMessage {
|
|
25
|
-
private
|
|
37
|
+
private draftContext;
|
|
26
38
|
/** Construct a lazy draft handle. */
|
|
27
39
|
static byId(client: MacroClient, id: string): EmailDraft;
|
|
40
|
+
/** Edit generation to capture with content before saving or transferring it. */
|
|
41
|
+
readonly draftGeneration: () => Promise<number | undefined>;
|
|
28
42
|
/** Replace draft content without changing its identity or sending it. */
|
|
29
43
|
update(options: DraftOptions): Promise<void>;
|
|
30
44
|
/** Delete the draft. */
|
|
31
45
|
delete(): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Schedule this draft for sending; an agent's program must quote the user's reply approving this send in `userConfirmation`, or it is refused (403).
|
|
48
|
+
*
|
|
49
|
+
* The draft goes out as saved, attachments included, at `sendTime` (ISO
|
|
50
|
+
* 8601, in the future). Write the draft out for the user and ask before
|
|
51
|
+
* scheduling it; the request that asked for the email is not the approval.
|
|
52
|
+
*/
|
|
53
|
+
schedule(sendTime: string, options?: DraftSendOptions): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Send this draft now, as saved; an agent's program must quote the user's reply approving this send in `userConfirmation`, or it is refused (403).
|
|
56
|
+
*
|
|
57
|
+
* The draft is handed to the scheduled sender, which delivers it within
|
|
58
|
+
* about a minute; until then {@link unschedule} still stops it. Write the
|
|
59
|
+
* draft out for the user and ask before sending it.
|
|
60
|
+
*/
|
|
61
|
+
send(options?: DraftSendOptions): Promise<void>;
|
|
36
62
|
/** Remove a scheduled send. */
|
|
37
63
|
unschedule(): Promise<void>;
|
|
38
64
|
/** Reserve an attachment upload. Upload to the returned URL, then call complete(). */
|
|
@@ -61,9 +87,11 @@ export declare class DraftAttachment {
|
|
|
61
87
|
readonly id: string;
|
|
62
88
|
/** Whether this attachment was forwarded. */
|
|
63
89
|
readonly forwarded: boolean;
|
|
90
|
+
/** Draft generation captured when the attachment was reserved. */
|
|
91
|
+
readonly draftGeneration: number;
|
|
64
92
|
private constructor();
|
|
65
93
|
/** Construct a draft scoped attachment handle. */
|
|
66
|
-
static byId(_client: MacroClient, draft: EmailDraft, id: string, forwarded?: boolean): DraftAttachment;
|
|
94
|
+
static byId(_client: MacroClient, draft: EmailDraft, id: string, forwarded?: boolean, draftGeneration?: number): DraftAttachment;
|
|
67
95
|
/** Complete verification after uploading the file. */
|
|
68
96
|
complete(): Promise<void>;
|
|
69
97
|
/** Remove this attachment from its draft. */
|
|
@@ -73,6 +101,7 @@ export declare class DraftAttachment {
|
|
|
73
101
|
id: string;
|
|
74
102
|
draftId: string;
|
|
75
103
|
forwarded: boolean;
|
|
104
|
+
draftGeneration: number;
|
|
76
105
|
};
|
|
77
106
|
}
|
|
78
107
|
/** Translate draft content to the generated contract. */
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { EmailRecipient, SendEmail } from '../../../generated/agent-reviews';
|
|
1
2
|
import type { ApiDraftContactInfo, GetMessageResponses, MessageOperationResponse, ResolveMessageOperationRequest, TransferDraftRequest, TransferDraftResponse } from '../../../generated/email/types.gen';
|
|
2
3
|
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import type { Document } from '../documents/document';
|
|
3
5
|
import { MacroEntity } from '../entity';
|
|
6
|
+
import { EmailAttachment } from './attachment';
|
|
4
7
|
import type { Label } from './label';
|
|
5
8
|
import { Link } from './link';
|
|
6
9
|
import { EmailThread } from './thread';
|
|
@@ -19,6 +22,63 @@ export interface SendEmailOptions {
|
|
|
19
22
|
/** Plain-text body. */
|
|
20
23
|
bodyText: string;
|
|
21
24
|
}
|
|
25
|
+
/** An email the user has approved in conversation, for `email.sendConfirmed`. */
|
|
26
|
+
export interface ConfirmedEmailOptions {
|
|
27
|
+
/** Recipients. */
|
|
28
|
+
to: EmailRecipient[];
|
|
29
|
+
/** Cc recipients. */
|
|
30
|
+
cc?: EmailRecipient[];
|
|
31
|
+
/** Bcc recipients. */
|
|
32
|
+
bcc?: EmailRecipient[];
|
|
33
|
+
/** Subject line. */
|
|
34
|
+
subject: string;
|
|
35
|
+
/** The body, written as Markdown; it is rendered to HTML on send. */
|
|
36
|
+
body: string;
|
|
37
|
+
/**
|
|
38
|
+
* The connected inbox to send from. Omit it unless you know which inbox is
|
|
39
|
+
* right: a reply then goes out from the inbox that received the message it
|
|
40
|
+
* answers, and a new email from the user's primary inbox.
|
|
41
|
+
*/
|
|
42
|
+
from?: Link;
|
|
43
|
+
/** The message this answers; the email is then sent as a reply in its thread. */
|
|
44
|
+
replyingTo?: EmailMessage;
|
|
45
|
+
/**
|
|
46
|
+
* Macro documents to attach as files: uploaded files (PDFs, images,
|
|
47
|
+
* spreadsheets, Word documents) the user can view, 18 MB together. An
|
|
48
|
+
* editor-native document has no file; link to it in the body instead.
|
|
49
|
+
*/
|
|
50
|
+
attachments?: Document[];
|
|
51
|
+
/** `false` leaves the inbox signature off this one email; omit for the inbox's default. */
|
|
52
|
+
includeSignature?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The user's own reply approving this specific email, quoted verbatim, such
|
|
55
|
+
* as their "yes, send it" after you wrote the email out for them. Never the
|
|
56
|
+
* request that asked you to write it, and never your own words.
|
|
57
|
+
*/
|
|
58
|
+
userConfirmation: string;
|
|
59
|
+
}
|
|
60
|
+
/** A forward the user has approved, for `EmailMessage.forwardDraft` and `forwardConfirmed`. */
|
|
61
|
+
export interface ForwardEmailOptions {
|
|
62
|
+
/** Recipients. */
|
|
63
|
+
to: EmailRecipient[];
|
|
64
|
+
/** Cc recipients. */
|
|
65
|
+
cc?: EmailRecipient[];
|
|
66
|
+
/** Bcc recipients. */
|
|
67
|
+
bcc?: EmailRecipient[];
|
|
68
|
+
/** A note above the forwarded message, written as Markdown. */
|
|
69
|
+
body?: string;
|
|
70
|
+
/** The connected inbox to send from; defaults to the inbox holding the message. */
|
|
71
|
+
from?: Link;
|
|
72
|
+
/** `false` leaves the inbox signature off this one email; omit for the inbox's default. */
|
|
73
|
+
includeSignature?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** A sent email: the message and the thread it belongs to. */
|
|
76
|
+
export interface SentEmail {
|
|
77
|
+
/** The sent message. */
|
|
78
|
+
message: EmailMessage;
|
|
79
|
+
/** The thread the message belongs to. */
|
|
80
|
+
thread: EmailThread;
|
|
81
|
+
}
|
|
22
82
|
/**
|
|
23
83
|
* A message in an email thread. A thin handle keyed by message id; the
|
|
24
84
|
* record loads lazily on first field access.
|
|
@@ -29,8 +89,38 @@ export declare class EmailMessage extends MacroEntity<EmailMessageData> {
|
|
|
29
89
|
static byId(client: MacroClient, id: string): EmailMessage;
|
|
30
90
|
/** Build a message from an already-fetched record (pre-seeded, no fetch). */
|
|
31
91
|
static from(client: MacroClient, data: EmailMessageData): EmailMessage;
|
|
32
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Send a new plain-text email; an agent's program is refused (403) and
|
|
94
|
+
* sends through a review or {@link EmailMessage.sendConfirmed} instead.
|
|
95
|
+
* Returns a handle when the API reports the created message's id.
|
|
96
|
+
*/
|
|
33
97
|
static send(client: MacroClient, opts: SendEmailOptions): Promise<EmailMessage | undefined>;
|
|
98
|
+
/** Send an email the user approved in conversation, quoting their approval; see `EmailNamespace.sendConfirmed`. */
|
|
99
|
+
static sendConfirmed(client: MacroClient, opts: ConfirmedEmailOptions): Promise<SentEmail>;
|
|
100
|
+
/** @internal Run the SendConfirmedEmail tool with a SendEmail draft and its approval. */
|
|
101
|
+
private static sendReviewedDraft;
|
|
102
|
+
/** The files attached to this message, from its thread's first 100 messages. */
|
|
103
|
+
attachments(): Promise<EmailAttachment[]>;
|
|
104
|
+
/**
|
|
105
|
+
* This message as a forward: a SendEmail draft with the note, the quoted
|
|
106
|
+
* message under the forwarded-message header, and its attachments as
|
|
107
|
+
* Macro documents. Pass it to `execution.reviews.create({kind: 'email'})`
|
|
108
|
+
* in a session; in a thread, use {@link forwardConfirmed}.
|
|
109
|
+
*/
|
|
110
|
+
forwardDraft(opts: ForwardEmailOptions): Promise<SendEmail>;
|
|
111
|
+
/**
|
|
112
|
+
* Forward this message, with its attachments, only after the user replied approving the forward, quoting that reply in `userConfirmation`.
|
|
113
|
+
*
|
|
114
|
+
* For a prompt from a channel or document thread: write the forward out
|
|
115
|
+
* (recipients and note), ask whether to send it, and call this in a later
|
|
116
|
+
* turn on the user's approving reply. In the agent session view, present
|
|
117
|
+
* `forwardDraft` as a review instead. The forward is a new email that
|
|
118
|
+
* quotes this message and carries its attachments; it takes effect at once
|
|
119
|
+
* and is never retried.
|
|
120
|
+
*/
|
|
121
|
+
forwardConfirmed(opts: ForwardEmailOptions & {
|
|
122
|
+
userConfirmation: string;
|
|
123
|
+
}): Promise<SentEmail>;
|
|
34
124
|
/** The message's subject line. */
|
|
35
125
|
readonly subject: () => Promise<string | undefined>;
|
|
36
126
|
/** The sender. */
|
|
@@ -54,8 +144,8 @@ export declare class EmailMessage extends MacroEntity<EmailMessageData> {
|
|
|
54
144
|
/** Resolve the displayed operation revision after the user chooses an action.
|
|
55
145
|
* Retrying an uncertain send requires explicit duplicate-risk acceptance. */
|
|
56
146
|
resolveOperation(request: ResolveMessageOperationRequest): Promise<void>;
|
|
57
|
-
/** Verify an uploaded draft
|
|
58
|
-
completeDraftAttachment(attachmentId: string): Promise<void>;
|
|
147
|
+
/** Verify an uploaded attachment using the draft generation captured when its upload began. */
|
|
148
|
+
completeDraftAttachment(attachmentId: string, draftGeneration?: number): Promise<void>;
|
|
59
149
|
/** Move a draft to another inbox using a caller-persisted operation UUID.
|
|
60
150
|
* Continue editing the returned message_id; the original identity is retired.
|
|
61
151
|
* On an interrupted response, use email.recoverDraftTransfer(operation_id). */
|
|
@@ -66,4 +156,10 @@ export declare class EmailMessage extends MacroEntity<EmailMessageData> {
|
|
|
66
156
|
removeLabel(label: Label): Promise<void>;
|
|
67
157
|
/** The thread this message belongs to. */
|
|
68
158
|
thread(): Promise<EmailThread>;
|
|
159
|
+
/**
|
|
160
|
+
* The message's original source, exactly as Gmail or Outlook holds it, as
|
|
161
|
+
* `message/rfc822` bytes for an `.eml` file. Drafts and messages still on
|
|
162
|
+
* their way have no source yet and fail with a 404.
|
|
163
|
+
*/
|
|
164
|
+
downloadEml(): Promise<Blob>;
|
|
69
165
|
}
|
|
@@ -2,13 +2,13 @@ import type { EmailConnectionProviders } from '../../../generated/auth/types.gen
|
|
|
2
2
|
import type { ApiSortMethod, TransferRecoveryResponse } from '../../../generated/email/types.gen';
|
|
3
3
|
import type { ListEmailRemindersData } from '../../../generated/storage/types.gen';
|
|
4
4
|
import type { MacroClient } from '../../utils/client';
|
|
5
|
-
import type { SearchOpts } from '../search';
|
|
5
|
+
import type { SearchOpts } from '../search/options';
|
|
6
6
|
import { EmailAttachment } from './attachment';
|
|
7
7
|
import { type DraftOptions, EmailDraft } from './draft';
|
|
8
8
|
import { EmailFilter, type EmailFilterOptions } from './filter';
|
|
9
9
|
import { Label } from './label';
|
|
10
10
|
import { Link } from './link';
|
|
11
|
-
import { EmailMessage, type SendEmailOptions } from './message';
|
|
11
|
+
import { type ConfirmedEmailOptions, EmailMessage, type SendEmailOptions, type SentEmail } from './message';
|
|
12
12
|
import { EmailThread } from './thread';
|
|
13
13
|
/** Options for listing inbox threads. */
|
|
14
14
|
export interface InboxOptions {
|
|
@@ -17,6 +17,22 @@ export interface InboxOptions {
|
|
|
17
17
|
/** Sort order. Defaults to `viewed_updated`. */
|
|
18
18
|
sort?: ApiSortMethod;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* @routing Use when reading, searching, labelling, drafting or sending email, or working across several inboxes; not channel messages or calendar invites.
|
|
22
|
+
*
|
|
23
|
+
* @agent
|
|
24
|
+
* ## Email inboxes
|
|
25
|
+
*
|
|
26
|
+
* - A user can have more than one inbox: their primary one, others they connected, and inboxes teammates delegated to them. `macro.email.links()` lists them; most users have one.
|
|
27
|
+
* - Searching and listing span every inbox the user can access unless you pass one. When the user means a specific mailbox ("my work inbox", "the shared inbox"), find it in `links()` and pass that link; never guess an address.
|
|
28
|
+
* - Labels are per inbox: a label from one inbox does not apply to a thread in another. Change a thread's labels with labels from the inbox that owns the thread.
|
|
29
|
+
*
|
|
30
|
+
* ## Sending email
|
|
31
|
+
*
|
|
32
|
+
* - Nothing leaves without the user seeing it. A program cannot call `send` or `EmailThread.reply`; they are refused, and so is a draft's `send` or `schedule` without `userConfirmation`.
|
|
33
|
+
* - In an agent session, present the email as a review: `execution.reviews.create({kind: 'email', title, drafts})`, each draft with the same fields as `sendConfirmed` (Markdown `body`, `to`/`cc`/`bcc`, `from` as the inbox's address, `replyingToId`, `attachments: [{documentId}]`), then return `reviews: [await review.reference()]`. The user sends it from the card. For a forward, `await message.forwardDraft({to, body})` is the draft.
|
|
34
|
+
* - For a prompt from a channel or document thread, where no card is seen: write the whole email into your reply, ask whether to send it, and stop. Only once the user replies approving that email, send it with their reply quoted in `userConfirmation`: `sendConfirmed` for a new email or a reply, `EmailMessage.forwardConfirmed` for a forward, `EmailDraft.send` or `EmailDraft.schedule` for a saved draft. Being asked to send an email is a request to draft one, never the approval.
|
|
35
|
+
*/
|
|
20
36
|
export declare class EmailNamespace {
|
|
21
37
|
private readonly client;
|
|
22
38
|
/** Create a draft without sending it; the inbox defaults to the caller's primary. */
|
|
@@ -59,9 +75,31 @@ export declare class EmailNamespace {
|
|
|
59
75
|
/** Recover a draft move using its original operation UUID; never starts a new move.
|
|
60
76
|
* An empty committed result fences the old move so it cannot commit later. */
|
|
61
77
|
recoverDraftTransfer(operationId: string): Promise<TransferRecoveryResponse>;
|
|
62
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Send a new plain-text email; an agent's program is refused (403) and
|
|
80
|
+
* sends through a review or {@link sendConfirmed} instead.
|
|
81
|
+
*/
|
|
63
82
|
send(opts: SendEmailOptions): Promise<EmailMessage | undefined>;
|
|
64
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Send an email only after the user replied approving it, quoting that reply in `userConfirmation`; never on the request that asked for the email.
|
|
85
|
+
*
|
|
86
|
+
* For a prompt from a channel or document thread: write the email out
|
|
87
|
+
* there, ask whether to send it, and call this in a later turn on the
|
|
88
|
+
* user's approving reply. In the agent session view, present a review
|
|
89
|
+
* (`execution.reviews.create({kind: 'email', ...})`) instead; its card is
|
|
90
|
+
* the confirmation. Takes what the SendEmail tool takes: a Markdown body,
|
|
91
|
+
* Cc/Bcc, the inbox to send from, the message to reply to (sent in its
|
|
92
|
+
* thread) and Macro documents to attach. The send takes effect at once and
|
|
93
|
+
* is never retried; on an error, look for the message in the thread before
|
|
94
|
+
* sending again.
|
|
95
|
+
*/
|
|
96
|
+
sendConfirmed(opts: ConfirmedEmailOptions): Promise<SentEmail>;
|
|
97
|
+
/**
|
|
98
|
+
* Search email threads by subject and content. To find a person's emails,
|
|
99
|
+
* search for their quoted email address, not their name: a name only
|
|
100
|
+
* matches where that display name appears. Resolve the address first, for
|
|
101
|
+
* example with `macro.users.search(name)`.
|
|
102
|
+
*/
|
|
65
103
|
search(query: string, opts?: SearchOpts): AsyncGenerator<EmailThread>;
|
|
66
104
|
/** The threads in the inbox, most recent first, auto-paginated. */
|
|
67
105
|
inbox(opts?: InboxOptions): AsyncGenerator<EmailThread>;
|
|
@@ -71,6 +109,11 @@ export declare class EmailNamespace {
|
|
|
71
109
|
labels(): Promise<Label[]>;
|
|
72
110
|
/** Create a user label. Returns the created label. */
|
|
73
111
|
createLabel(name: string): Promise<Label>;
|
|
112
|
+
/**
|
|
113
|
+
* Archive many threads (or unarchive with `false`). Resolves to the threads
|
|
114
|
+
* whose state could not change.
|
|
115
|
+
*/
|
|
116
|
+
archive(threads: EmailThread[], archived?: boolean): Promise<EmailThread[]>;
|
|
74
117
|
/** Delete a label. */
|
|
75
118
|
deleteLabel(label: Label): Promise<void>;
|
|
76
119
|
/** Block an email sender. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { ApiContactInfo, ApiDraftContactInfo, GetThreadResponses, MailboxOperation, UpdateThreadStateRequest } from '../../../generated/email/types.gen';
|
|
1
|
+
import type { ApiContactInfo, ApiDraftContactInfo, CalendarInvitation, GetThreadResponses, MailboxOperation, UpdateThreadStateRequest } from '../../../generated/email/types.gen';
|
|
2
2
|
import type { EmailFollowupCommand } from '../../../generated/storage/types.gen';
|
|
3
3
|
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import type { Calendar } from '../calendar/calendar';
|
|
5
|
+
import { CalendarEvent } from '../calendar/event';
|
|
4
6
|
import { PropertiedEntity } from '../entity';
|
|
5
7
|
import { Project } from '../projects/project';
|
|
6
8
|
import { EntityAccess } from '../sharing/access';
|
|
@@ -25,6 +27,17 @@ export interface ReplyEmailOptions {
|
|
|
25
27
|
/** The message being replied to. */
|
|
26
28
|
replyingTo?: EmailMessage;
|
|
27
29
|
}
|
|
30
|
+
/** Open tracking for one of the caller's sent messages. */
|
|
31
|
+
export interface EmailReadReceipt {
|
|
32
|
+
/** The tracked message. */
|
|
33
|
+
message: EmailMessage;
|
|
34
|
+
/** Counted pixel fetches; repeats within a few seconds count once. */
|
|
35
|
+
openCount: number;
|
|
36
|
+
/** When the first counted fetch happened, if any. */
|
|
37
|
+
firstOpenedAt?: string;
|
|
38
|
+
/** When the latest counted fetch happened, if any. */
|
|
39
|
+
lastOpenedAt?: string;
|
|
40
|
+
}
|
|
28
41
|
/**
|
|
29
42
|
* An email thread. A free-to-construct handle: the detail record (including
|
|
30
43
|
* up to the first 100 messages) loads lazily on first field access.
|
|
@@ -40,6 +53,27 @@ export declare class EmailThread extends PropertiedEntity<ThreadDetail> {
|
|
|
40
53
|
calendarInvitations(): Promise<{
|
|
41
54
|
[key: string]: import("../../../generated/email").InvitationResolution;
|
|
42
55
|
}>;
|
|
56
|
+
/** Add a shared event one of this thread's messages carries (a published
|
|
57
|
+
* `.ics`, such as one sent with Forward by email) to one of the
|
|
58
|
+
* requester's Google calendars, and return a handle to the synced
|
|
59
|
+
* snapshot. The event is read from the saved message, never from the
|
|
60
|
+
* caller, and lands the way {@link CalendarEvent.addToCalendar} adds a
|
|
61
|
+
* channel-shared one: the meeting's iCalendar UID and organizer, only the
|
|
62
|
+
* requester as a guest, no join link, nobody notified. Refused with
|
|
63
|
+
* `invalid_input` for an invitation, which is answered from the calendar
|
|
64
|
+
* instead, `already_on_calendar` when the meeting is already on one of
|
|
65
|
+
* their calendars, whichever calendar is named (it cannot be added to
|
|
66
|
+
* another of theirs either), and `copy_refused` when Google will not
|
|
67
|
+
* import it. */
|
|
68
|
+
addEventToCalendar(message: EmailMessage, invitation: CalendarInvitation, options?: {
|
|
69
|
+
calendar?: Calendar;
|
|
70
|
+
}): Promise<CalendarEvent>;
|
|
71
|
+
/**
|
|
72
|
+
* Opens recorded for messages sent from the caller's own or delegated
|
|
73
|
+
* inboxes with read receipts on, newest message first. Counts are
|
|
74
|
+
* approximate: some mail apps prefetch images and others block them.
|
|
75
|
+
*/
|
|
76
|
+
readReceipts(): Promise<EmailReadReceipt[]>;
|
|
43
77
|
/** Change project membership or share permissions for this thread. */
|
|
44
78
|
update(options: {
|
|
45
79
|
project?: Project | null;
|
|
@@ -50,6 +84,14 @@ export declare class EmailThread extends PropertiedEntity<ThreadDetail> {
|
|
|
50
84
|
/** The properties service identifies email threads as `THREAD`. */
|
|
51
85
|
protected readonly propertyEntityType = "THREAD";
|
|
52
86
|
protected fetch(): Promise<ThreadDetail>;
|
|
87
|
+
/** The thread's URL in the Macro web app; hand it to users as the link. */
|
|
88
|
+
webUrl(): string;
|
|
89
|
+
/** Identity, loaded detail and {@link webUrl}, so serialized handles carry their link. */
|
|
90
|
+
toJSON(): {
|
|
91
|
+
url: string;
|
|
92
|
+
id: string;
|
|
93
|
+
detail?: import("../../../generated/email").ApiThread | undefined;
|
|
94
|
+
};
|
|
53
95
|
/** A handle to a thread by id. Details load on first access. */
|
|
54
96
|
static byId(client: MacroClient, id: string): EmailThread;
|
|
55
97
|
/** When the thread was created. */
|
|
@@ -88,10 +130,20 @@ export declare class EmailThread extends PropertiedEntity<ThreadDetail> {
|
|
|
88
130
|
}): Promise<EmailMessage[]>;
|
|
89
131
|
/** The attachments across this thread's first 100 messages, pre-seeded from the thread detail. */
|
|
90
132
|
attachments(): Promise<EmailAttachment[]>;
|
|
91
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Send a plain-text reply in this thread; an agent's program is refused
|
|
135
|
+
* (403) and replies through a review or `email.sendConfirmed` with
|
|
136
|
+
* `replyingTo` instead. Returns a handle when the API reports the created
|
|
137
|
+
* message's id.
|
|
138
|
+
*/
|
|
92
139
|
reply(opts: ReplyEmailOptions): Promise<EmailMessage | undefined>;
|
|
93
140
|
/** Archive the thread (or unarchive with `false`). */
|
|
94
141
|
archive(archived?: boolean): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Archive many threads (or unarchive with `false`), sending one request per
|
|
144
|
+
* 100 threads. Resolves to the threads whose state could not change.
|
|
145
|
+
*/
|
|
146
|
+
static archiveMany(client: MacroClient, threads: EmailThread[], archived?: boolean): Promise<EmailThread[]>;
|
|
95
147
|
/** Update provider-neutral read, trash, spam, or star state. */
|
|
96
148
|
updateState(request: UpdateThreadStateRequest): Promise<void>;
|
|
97
149
|
/** Read pending or failed mailbox changes without initiating a retry. */
|
|
@@ -105,6 +157,6 @@ export declare class EmailThread extends PropertiedEntity<ThreadDetail> {
|
|
|
105
157
|
/** Attach the thread to a project, or clear the project with `null`. */
|
|
106
158
|
moveToProject(project: Project | null): Promise<void>;
|
|
107
159
|
/** Search email threads by subject and content, most relevant first, auto-paginated. */
|
|
108
|
-
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<EmailThread, any, any>;
|
|
160
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search/options").SearchOpts) => AsyncGenerator<EmailThread, any, any>;
|
|
109
161
|
}
|
|
110
162
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { MacroClient } from '../../utils/client';
|
|
2
2
|
import type { EntityReference } from '../reference';
|
|
3
3
|
import { EntityMention } from './mention';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Stored entity mention relationships.
|
|
6
|
+
*
|
|
7
|
+
* @routing Use when recording or removing a typed mention relationship between two Macro items; not writing mention tags into text.
|
|
8
|
+
*/
|
|
5
9
|
export declare class EntityMentionNamespace {
|
|
6
10
|
private readonly client;
|
|
7
11
|
constructor(client: MacroClient);
|