@macro-inc/sdk 0.3.0 → 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 +45 -0
- package/dist/{chunk-Y4HQV7EL.js → chunk-AZJUIUIV.js} +26 -0
- package/dist/{chunk-KPR5JIGY.js → chunk-G43PLP2U.js} +95 -0
- package/dist/{chunk-IIICUUWY.js → chunk-PPR7IWZ7.js} +51 -51
- package/dist/{chunk-PTMBRVEK.js → chunk-PTX2RV2N.js} +84 -0
- package/dist/{chunk-OEHZOKGE.js → chunk-PZPTJI6F.js} +16 -0
- package/dist/{chunk-HR32RQGP.js → chunk-ZLBDES7U.js} +307 -1
- package/dist/generated/agent-fold/index.d.ts +6 -1
- 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 +44 -1
- package/dist/generated/agent-harness/types.gen.d.ts +699 -0
- 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 +41 -1
- package/dist/generated/calendar/types.gen.d.ts +904 -2
- 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 +9 -1
- package/dist/generated/cognition/types.gen.d.ts +79 -0
- package/dist/generated/email/types.gen.d.ts +11 -1
- package/dist/generated/notification/index.js +1 -1
- package/dist/generated/notification/sdk.gen.d.ts +20 -20
- package/dist/generated/notification/types.gen.d.ts +77 -72
- 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 +4 -1
- package/dist/generated/scheduled-action/types.gen.d.ts +388 -7
- 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 +151 -1
- package/dist/generated/storage/types.gen.d.ts +3888 -139
- 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 +42 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +7 -1
- package/dist/src/entities/agent-sessions/origin.d.ts +94 -0
- package/dist/src/entities/ai/namespace.d.ts +1 -1
- package/dist/src/entities/bots/bot.d.ts +108 -0
- package/dist/src/entities/bots/namespace.d.ts +15 -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/create-confirmed.test.d.ts +1 -0
- package/dist/src/entities/calendar/namespace.d.ts +63 -15
- package/dist/src/entities/calls/call-record.d.ts +25 -3
- 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 +19 -2
- package/dist/src/entities/calls/participant.d.ts +22 -0
- package/dist/src/entities/channels/channel.d.ts +21 -3
- package/dist/src/entities/channels/namespace.d.ts +3 -3
- package/dist/src/entities/channels/post.d.ts +10 -2
- package/dist/src/entities/channels/thread.d.ts +4 -0
- package/dist/src/entities/chats/chat.d.ts +1 -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 +1 -1
- package/dist/src/entities/crm/pipeline.d.ts +1 -1
- package/dist/src/entities/documents/document.d.ts +156 -7
- package/dist/src/entities/documents/namespace.d.ts +41 -2
- package/dist/src/entities/documents/office-files.d.ts +47 -0
- package/dist/src/entities/email/draft.d.ts +26 -4
- package/dist/src/entities/email/message.d.ts +91 -1
- package/dist/src/entities/email/namespace.d.ts +26 -3
- package/dist/src/entities/email/namespace.test.d.ts +1 -0
- package/dist/src/entities/email/thread.d.ts +7 -2
- package/dist/src/entities/external-chat/namespace.d.ts +2 -0
- package/dist/src/entities/favorites/namespace.d.ts +1 -1
- package/dist/src/entities/harnesses/namespace.d.ts +5 -1
- package/dist/src/entities/images/namespace.d.ts +5 -1
- package/dist/src/entities/me/namespace.d.ts +5 -1
- package/dist/src/entities/meetings/meeting.d.ts +5 -0
- package/dist/src/entities/messages/thread.d.ts +1 -1
- package/dist/src/entities/pins/namespace.d.ts +1 -1
- package/dist/src/entities/projects/namespace.d.ts +1 -1
- package/dist/src/entities/projects/project.d.ts +1 -1
- package/dist/src/entities/search/namespace.d.ts +65 -0
- package/dist/src/entities/search/options.d.ts +29 -0
- package/dist/src/entities/search/types.d.ts +90 -0
- package/dist/src/entities/tasks/namespace.d.ts +1 -1
- package/dist/src/entities/tasks/task.d.ts +4 -3
- package/dist/src/entities/users/namespace.d.ts +1 -1
- package/dist/src/entities/whatsapp/namespace.d.ts +2 -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/call.d.ts +101 -0
- package/dist/src/events/types.d.ts +2 -1
- package/dist/src/macro.d.ts +33 -1
- package/dist/src/macro.js +6423 -4265
- package/dist/src/utils/activity.d.ts +23 -2
- package/package.json +1 -1
- package/dist/src/entities/search.d.ts +0 -53
|
@@ -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. */
|
|
@@ -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 {
|
|
@@ -26,6 +26,12 @@ export interface InboxOptions {
|
|
|
26
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
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
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.
|
|
29
35
|
*/
|
|
30
36
|
export declare class EmailNamespace {
|
|
31
37
|
private readonly client;
|
|
@@ -69,8 +75,25 @@ export declare class EmailNamespace {
|
|
|
69
75
|
/** Recover a draft move using its original operation UUID; never starts a new move.
|
|
70
76
|
* An empty committed result fences the old move so it cannot commit later. */
|
|
71
77
|
recoverDraftTransfer(operationId: string): Promise<TransferRecoveryResponse>;
|
|
72
|
-
/**
|
|
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
|
+
*/
|
|
73
82
|
send(opts: SendEmailOptions): Promise<EmailMessage | undefined>;
|
|
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>;
|
|
74
97
|
/**
|
|
75
98
|
* Search email threads by subject and content. To find a person's emails,
|
|
76
99
|
* search for their quoted email address, not their name: a name only
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -130,7 +130,12 @@ export declare class EmailThread extends PropertiedEntity<ThreadDetail> {
|
|
|
130
130
|
}): Promise<EmailMessage[]>;
|
|
131
131
|
/** The attachments across this thread's first 100 messages, pre-seeded from the thread detail. */
|
|
132
132
|
attachments(): Promise<EmailAttachment[]>;
|
|
133
|
-
/**
|
|
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
|
+
*/
|
|
134
139
|
reply(opts: ReplyEmailOptions): Promise<EmailMessage | undefined>;
|
|
135
140
|
/** Archive the thread (or unarchive with `false`). */
|
|
136
141
|
archive(archived?: boolean): Promise<void>;
|
|
@@ -152,6 +157,6 @@ export declare class EmailThread extends PropertiedEntity<ThreadDetail> {
|
|
|
152
157
|
/** Attach the thread to a project, or clear the project with `null`. */
|
|
153
158
|
moveToProject(project: Project | null): Promise<void>;
|
|
154
159
|
/** Search email threads by subject and content, most relevant first, auto-paginated. */
|
|
155
|
-
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>;
|
|
156
161
|
}
|
|
157
162
|
export {};
|
|
@@ -4,6 +4,8 @@ import { ExternalChat } from './chat';
|
|
|
4
4
|
* Chats from external messaging providers (WhatsApp today) that someone added
|
|
5
5
|
* to Macro: read, share and send in them. Find and add a provider's chats
|
|
6
6
|
* through its own namespace, such as `macro.whatsapp.chats()`.
|
|
7
|
+
*
|
|
8
|
+
* @routing Use when reading, sharing or sending in an external chat, such as a WhatsApp chat, already added to Macro; not Macro channels, or finding chats to add (`macro.whatsapp`).
|
|
7
9
|
*/
|
|
8
10
|
export declare class ExternalChatsNamespace {
|
|
9
11
|
private readonly client;
|
|
@@ -17,7 +17,7 @@ export type FavoritesFilter = {
|
|
|
17
17
|
/**
|
|
18
18
|
* The user's favorites: a manually ordered collection of entity references.
|
|
19
19
|
*
|
|
20
|
-
* @routing Use when adding or removing the user's favorites; not pins.
|
|
20
|
+
* @routing Use when adding or removing the user's favorites; not pins (`macro.pins`).
|
|
21
21
|
*/
|
|
22
22
|
export declare class FavoritesNamespace {
|
|
23
23
|
private readonly client;
|
|
@@ -4,7 +4,11 @@ import { AgentSession } from '../agent-sessions/agent-session';
|
|
|
4
4
|
import { Agent } from '../agents/agent';
|
|
5
5
|
import { Harness } from './harness';
|
|
6
6
|
import { DevicePairing, HarnessPairing } from './pairing';
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Hosts and device pairing. Self operations require host credentials.
|
|
9
|
+
*
|
|
10
|
+
* @routing Use when listing, pairing or removing the machines (hosts) that run the user's agents; not changing an agent persona's setup (`macro.agents`).
|
|
11
|
+
*/
|
|
8
12
|
export declare class HarnessNamespace {
|
|
9
13
|
private readonly client;
|
|
10
14
|
constructor(client: MacroClient);
|
|
@@ -23,7 +23,11 @@ export interface GenerateImageOptions {
|
|
|
23
23
|
*/
|
|
24
24
|
referenceImages?: (Document | StaticImage)[];
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Image generation, charged to the acting user's AI allowance.
|
|
28
|
+
*
|
|
29
|
+
* @routing Use when generating an image; not structured output or classification (`macro.ai`).
|
|
30
|
+
*/
|
|
27
31
|
export declare class ImagesNamespace {
|
|
28
32
|
private readonly client;
|
|
29
33
|
constructor(client: MacroClient);
|
|
@@ -14,7 +14,11 @@ export interface UpdateMeOptions {
|
|
|
14
14
|
/** An image from {@link MeNamespace.uploadProfilePicture}. */
|
|
15
15
|
profilePicture?: StaticImage;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The authenticated user's own profile.
|
|
19
|
+
*
|
|
20
|
+
* @routing Use when changing the user's own name or profile picture; not looking up other people (`macro.users`).
|
|
21
|
+
*/
|
|
18
22
|
export declare class MeNamespace {
|
|
19
23
|
private readonly client;
|
|
20
24
|
constructor(client: MacroClient);
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { Meeting as MeetingRecord, UpdateMeetingRequest } from '../../../generated/storage/types.gen';
|
|
2
2
|
import type { MacroClient } from '../../utils/client';
|
|
3
3
|
import { CallRecord } from '../calls/call-record';
|
|
4
|
+
import { CallConnection, type JoinOptions } from '../calls/connection';
|
|
4
5
|
import { Channel } from '../channels/channel';
|
|
5
6
|
import { MacroEntity } from '../entity';
|
|
6
7
|
import type { User } from '../users/user';
|
|
7
8
|
/** A meeting's schedule and invitation link. */
|
|
8
9
|
export declare class Meeting extends MacroEntity<MeetingRecord> {
|
|
10
|
+
/** Join this meeting as the current account; always send a program join body. */
|
|
11
|
+
join(opts?: JoinOptions): Promise<CallConnection>;
|
|
12
|
+
/** Join the link as a named guest. */
|
|
13
|
+
joinAsGuest(name: string): Promise<CallConnection>;
|
|
9
14
|
private lookupToken?;
|
|
10
15
|
private constructor();
|
|
11
16
|
/** Construct a lazy meeting handle. */
|
|
@@ -57,7 +57,7 @@ export declare class MessageThread extends MacroEntity<ThreadState> {
|
|
|
57
57
|
readonly parent: MessageParent;
|
|
58
58
|
/** Serialize identity with its owning resource. */
|
|
59
59
|
toJSON(): {
|
|
60
|
-
parentType: "
|
|
60
|
+
parentType: "call" | "channel" | "document" | "crm_company" | "crm_contact";
|
|
61
61
|
parentId: string;
|
|
62
62
|
id: string;
|
|
63
63
|
detail?: ThreadState | undefined;
|
|
@@ -5,7 +5,7 @@ export type { PinnedItem, ReorderPinRequest };
|
|
|
5
5
|
/**
|
|
6
6
|
* The user's pins: items pinned to fixed slots in the home view.
|
|
7
7
|
*
|
|
8
|
-
* @routing Use when pinning or unpinning items; not favorites.
|
|
8
|
+
* @routing Use when pinning or unpinning items; not favorites (`macro.favorites`).
|
|
9
9
|
*/
|
|
10
10
|
export declare class PinsNamespace {
|
|
11
11
|
private readonly client;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MacroClient } from '../../utils/client';
|
|
2
|
-
import type { SearchOpts } from '../search';
|
|
2
|
+
import type { SearchOpts } from '../search/options';
|
|
3
3
|
import { Project } from './project';
|
|
4
4
|
/**
|
|
5
5
|
* @routing Use when organizing items into projects (folders); not initiatives, which group tasks.
|
|
@@ -52,6 +52,6 @@ export declare class Project extends PropertiedEntity<ProjectDetail> {
|
|
|
52
52
|
/** Restore a soft-deleted project. */
|
|
53
53
|
restore(): Promise<void>;
|
|
54
54
|
/** Search projects by name and content, most relevant first, auto-paginated. */
|
|
55
|
-
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<Project, any, any>;
|
|
55
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search/options").SearchOpts) => AsyncGenerator<Project, any, any>;
|
|
56
56
|
}
|
|
57
57
|
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { SearchOptions, SearchPage, SearchPageOptions, SearchResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Search the user's Macro content across every kind of item in one call:
|
|
5
|
+
* documents and tasks, email, channels and their messages, projects, call
|
|
6
|
+
* transcripts, calendar events, agent session transcripts, AI chats, and CRM
|
|
7
|
+
* companies when asked for. Results come most relevant first, as typed entity
|
|
8
|
+
* handles, with the same filters as the per-type searches and more: exact
|
|
9
|
+
* matching, tags, one inbox and agent session transcripts.
|
|
10
|
+
*
|
|
11
|
+
* @routing Use when finding or looking up the user's own Macro content by keyword, across types or in one; not browsing recent items (`macro.workspace`), the web, or one item already in context.
|
|
12
|
+
*
|
|
13
|
+
* @agent
|
|
14
|
+
* Search is keyword search, not semantic: pass 1-3 words that would literally appear in the item, not the user's description. Whitespace-separated terms are ANDed; for documents and email each word is a prefix and terms may match different passages, while for other kinds the query is one adjacent phrase prefix, so long phrases match nothing. Quote a multi-word phrase; use matchType 'exact' for a whole word, identifier or email address. Search a person and a topic separately. To find someone's email, search their quoted address, not their name.
|
|
15
|
+
*
|
|
16
|
+
* Use macro.search.all(query) when the request does not name one kind of item, and keep any scope the user gives (types, inbox, tags) on follow-ups and retries. Per-type searches remain for one kind: macro.documents.search returns document handles, macro.email.search email threads, macro.tasks.search tasks. SearchOpts and SearchOptions select searchOn: 'name', 'content', or 'name_content'. These iterators auto-paginate; bound the work explicitly and record when you stop before exhaustion.
|
|
17
|
+
*
|
|
18
|
+
* For activity rather than keywords ("what happened today", "catch me up", my recent or favorite items, tasks updated this week), browse with macro.workspace.page or macro.workspace.list, filtered by type, time, tags or inbox; for a sample of several kinds, fetch one small page per type concurrently. Read an AI chat's messages with macro.chats.byId(id).history(), or chat.history() on a search or workspace result.
|
|
19
|
+
*
|
|
20
|
+
* ```javascript
|
|
21
|
+
* export async function main({macro}) {
|
|
22
|
+
* const queries = ['launch decision', 'release readiness'];
|
|
23
|
+
* const outcomes = await Promise.allSettled(queries.map(async query => {
|
|
24
|
+
* const evidence = [];
|
|
25
|
+
* let stoppedEarly = false;
|
|
26
|
+
* for await (const result of macro.search.all(query, {searchOn:'content'})) {
|
|
27
|
+
* if (evidence.length === 5) { stoppedEarly = true; break; }
|
|
28
|
+
* evidence.push({type:result.type, id:result.entity.id, name:result.hit.name,
|
|
29
|
+
* text: result.type === 'document' ? (await result.entity.content()).slice(0,3000) : undefined});
|
|
30
|
+
* }
|
|
31
|
+
* return {query,evidence,stoppedEarly};
|
|
32
|
+
* }));
|
|
33
|
+
* return {data: outcomes.map((item,index) => item.status === 'fulfilled'
|
|
34
|
+
* ? item.value : {query:queries[index],error:String(item.reason)}), reviews:[]};
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
* Preserve useful evidence from each query. A short sample cannot establish corpus-wide completeness or absence. Use precise terms, metadata and relevant reads before expanding breadth. Do not swallow rejected branches. Normal for/while/for-await with break and sequential dependent calls are supported.
|
|
38
|
+
*
|
|
39
|
+
* Skills are documents. When a request names a skill that is not attached, find it by name with macro.documents.search(name, {searchOn:'name'}), read its instructions with content() before doing the task, and follow them for that request only. Built-in system skills (macro.documents.systemSkills()) have no document; read them with the ReadSkill tool.
|
|
40
|
+
*
|
|
41
|
+
* @example Find a contract across email and documents, in one inbox
|
|
42
|
+
* ```js
|
|
43
|
+
* const page = await macro.search.page('"master services agreement"', {
|
|
44
|
+
* types: ['email', 'document'], inbox: 'me@example.com', matchType: 'exact',
|
|
45
|
+
* });
|
|
46
|
+
* return {data: page.results.map(r => ({type: r.type, id: r.entity.id, tags: r.tags})),
|
|
47
|
+
* hasMore: page.hasMore};
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare class SearchNamespace {
|
|
51
|
+
private readonly client;
|
|
52
|
+
constructor(client: MacroClient);
|
|
53
|
+
/**
|
|
54
|
+
* One bounded page of matches across every kind of item, most relevant
|
|
55
|
+
* first; resume with `nextCursor` and the same options.
|
|
56
|
+
*/
|
|
57
|
+
page(query: string, options?: SearchPageOptions): Promise<SearchPage>;
|
|
58
|
+
/**
|
|
59
|
+
* Every match across every kind of item, most relevant first, auto-paginated.
|
|
60
|
+
* Break a `for await` loop to stop; no further page is fetched.
|
|
61
|
+
*/
|
|
62
|
+
all(query: string, options?: SearchOptions): AsyncGenerator<SearchResult>;
|
|
63
|
+
private request;
|
|
64
|
+
private fetch;
|
|
65
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-type search: the options every entity's own `search()` takes, and the
|
|
3
|
+
* helper that builds one. Cross-type search is `macro.search`.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import type { EntityFilters, UnifiedSearchResponseItem } from '../../../generated/search/types.gen';
|
|
8
|
+
import type { MacroClient } from '../../utils/client';
|
|
9
|
+
type Hit = UnifiedSearchResponseItem;
|
|
10
|
+
export type SearchOn = 'name' | 'content' | 'name_content';
|
|
11
|
+
export interface SearchOpts {
|
|
12
|
+
searchOn?: SearchOn;
|
|
13
|
+
pageSize?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Build a `search(client, query, opts?)` function for one entity type: unified
|
|
17
|
+
* search hits narrowed to `type`, each mapped through `make`.
|
|
18
|
+
* Most relevant first, auto-paginated.
|
|
19
|
+
*/
|
|
20
|
+
export declare function entitySearch<T, K extends Hit['type']>(opts: {
|
|
21
|
+
filters?: EntityFilters;
|
|
22
|
+
type: K;
|
|
23
|
+
make: (client: MacroClient, hit: Extract<Hit, {
|
|
24
|
+
type: K;
|
|
25
|
+
}>) => T;
|
|
26
|
+
/** Opt in to CRM results (off by default server-side; required for company hits). */
|
|
27
|
+
includeCrm?: boolean;
|
|
28
|
+
}): (client: MacroClient, query: string, searchOpts?: SearchOpts) => AsyncGenerator<T>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { CalendarEventSearchScope, UnifiedSearchResponseItem } from '../../../generated/search/types.gen';
|
|
2
|
+
import type { AgentSession } from '../agent-sessions/agent-session';
|
|
3
|
+
import type { CalendarEvent } from '../calendar/event';
|
|
4
|
+
import type { CallRecord } from '../calls/call-record';
|
|
5
|
+
import type { Channel } from '../channels/channel';
|
|
6
|
+
import type { Message } from '../channels/message';
|
|
7
|
+
import type { Chat } from '../chats/chat';
|
|
8
|
+
import type { Company } from '../crm/company';
|
|
9
|
+
import type { Document } from '../documents/document';
|
|
10
|
+
import type { EmailThread } from '../email/thread';
|
|
11
|
+
import type { Project } from '../projects/project';
|
|
12
|
+
import type { TagFilter } from '../workspace/query';
|
|
13
|
+
import type { WorkspaceTag } from '../workspace/types';
|
|
14
|
+
import type { SearchOn } from './options';
|
|
15
|
+
/**
|
|
16
|
+
* The kinds of item one search can reach. `document` includes tasks;
|
|
17
|
+
* `channel` covers channel names and the messages posted in them; `company`
|
|
18
|
+
* is CRM, searched only when named.
|
|
19
|
+
*/
|
|
20
|
+
export type SearchType = 'document' | 'email' | 'channel' | 'project' | 'call' | 'calendar_event' | 'agent_session' | 'chat' | 'company';
|
|
21
|
+
/** Options shared by {@link SearchNamespace.page} and {@link SearchNamespace.all}. */
|
|
22
|
+
export type SearchOptions = {
|
|
23
|
+
/**
|
|
24
|
+
* Which kinds of item to search. Omit to search every kind but `company`;
|
|
25
|
+
* set it only when the user scopes the request, and keep that scope on
|
|
26
|
+
* follow-ups and retries.
|
|
27
|
+
*/
|
|
28
|
+
types?: SearchType[];
|
|
29
|
+
/** Match names, content or both (the default). Projects and calendar events have only names. */
|
|
30
|
+
searchOn?: SearchOn;
|
|
31
|
+
/**
|
|
32
|
+
* `partial` (the default) matches each word as a prefix, so `scri` matches
|
|
33
|
+
* `script`; `exact` matches whole tokens or a quoted phrase, for an exact
|
|
34
|
+
* word, identifier or email address.
|
|
35
|
+
*/
|
|
36
|
+
matchType?: 'partial' | 'exact';
|
|
37
|
+
/**
|
|
38
|
+
* Only items carrying these tags, by case-insensitive label; set `scope`
|
|
39
|
+
* only when the user tells personal and team tags apart. An unknown label
|
|
40
|
+
* fails with the available tags. Only documents, email, projects, calls and
|
|
41
|
+
* calendar events carry tags.
|
|
42
|
+
*/
|
|
43
|
+
tags?: TagFilter[];
|
|
44
|
+
/** `any` (the default) or `all` of `tags`; `all` rejects a label both scopes share. */
|
|
45
|
+
tagsMatch?: 'any' | 'all';
|
|
46
|
+
/** Restrict email results to one connected inbox, by its address. Omit for every accessible inbox. */
|
|
47
|
+
inbox?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Search only these agent sessions' transcripts, and nothing else; `types`
|
|
50
|
+
* is then ignored. Pass your own session to find the exact words of
|
|
51
|
+
* something said earlier in it.
|
|
52
|
+
*/
|
|
53
|
+
agentSessions?: AgentSession[];
|
|
54
|
+
/**
|
|
55
|
+
* `own` (the default): events on the caller's own and delegated calendars.
|
|
56
|
+
* `shared_with_you`: only events shared to a channel they are in that are
|
|
57
|
+
* on none of their calendars.
|
|
58
|
+
*/
|
|
59
|
+
calendarScope?: CalendarEventSearchScope;
|
|
60
|
+
/** Results per request, default 50. Iteration may fetch many pages. */
|
|
61
|
+
pageSize?: number;
|
|
62
|
+
};
|
|
63
|
+
/** Resume a page with its opaque cursor and the same options. */
|
|
64
|
+
export type SearchPageOptions = SearchOptions & {
|
|
65
|
+
cursor?: string;
|
|
66
|
+
};
|
|
67
|
+
type Hit = UnifiedSearchResponseItem;
|
|
68
|
+
type Entry<Kind extends Hit['type'], Type extends string, Entity> = {
|
|
69
|
+
type: Type;
|
|
70
|
+
/** A handle to the matching item, for reads and mutations; nothing is fetched yet. */
|
|
71
|
+
entity: Entity;
|
|
72
|
+
/** The search hit: name, highlights, matching passages and metadata, readable without another request. */
|
|
73
|
+
hit: Extract<Hit, {
|
|
74
|
+
type: Kind;
|
|
75
|
+
}>;
|
|
76
|
+
/** The caller-visible tags on the item. */
|
|
77
|
+
tags: WorkspaceTag[];
|
|
78
|
+
};
|
|
79
|
+
/** One match, discriminated by `type`. */
|
|
80
|
+
export type SearchResult = Entry<'document', 'document', Document> | Entry<'email', 'email', EmailThread> | Entry<'channel', 'channel', Channel> | (Entry<'channelMessage', 'channel_message', Message> & {
|
|
81
|
+
/** The channel the message was posted in. */
|
|
82
|
+
channel: Channel;
|
|
83
|
+
}) | Entry<'project', 'project', Project> | Entry<'call', 'call', CallRecord> | Entry<'calendarEvent', 'calendar_event', CalendarEvent> | Entry<'agentSession', 'agent_session', AgentSession> | Entry<'chat', 'chat', Chat> | Entry<'company', 'company', Company>;
|
|
84
|
+
/** A bounded page. A cursor means more results exist, not an exact total count. */
|
|
85
|
+
export type SearchPage = {
|
|
86
|
+
results: SearchResult[];
|
|
87
|
+
nextCursor?: string | null;
|
|
88
|
+
hasMore: boolean;
|
|
89
|
+
};
|
|
90
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MacroClient } from '../../utils/client';
|
|
2
2
|
import type { Initiative } from '../initiatives/initiative';
|
|
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 type { User } from '../users/user';
|
|
7
7
|
import { type SimilarTask, Task, type TaskSummary } from './task';
|
|
@@ -22,8 +22,9 @@ export interface SimilarTask {
|
|
|
22
22
|
similarity: number;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* A Macro task: a document with sub-type `task
|
|
26
|
-
*
|
|
25
|
+
* A Macro task: a document with sub-type `task`, so every `Document` method
|
|
26
|
+
* works on it, including `content` and `edit` for its body. Inherits the full
|
|
27
|
+
* document surface ({@link Document.rename}, move, delete, restore, events)
|
|
27
28
|
* and adds task-specific state.
|
|
28
29
|
*/
|
|
29
30
|
export declare class Task extends Document {
|
|
@@ -76,5 +77,5 @@ export declare class Task extends Document {
|
|
|
76
77
|
/** The task's URL in the Macro web app. */
|
|
77
78
|
webUrl(): string;
|
|
78
79
|
/** Search tasks by name and content, most relevant first, auto-paginated. */
|
|
79
|
-
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<Task, any, any>;
|
|
80
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search/options").SearchOpts) => AsyncGenerator<Task, any, any>;
|
|
80
81
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MacroClient } from '../../utils/client';
|
|
2
2
|
import { User } from './user';
|
|
3
3
|
/**
|
|
4
|
-
* @routing Use when looking up people or their profiles, or changing the user's own
|
|
4
|
+
* @routing Use when looking up people or their profiles; not team membership, or changing the user's own profile (`macro.me`).
|
|
5
5
|
*/
|
|
6
6
|
export declare class UserNamespace {
|
|
7
7
|
private readonly client;
|
|
@@ -5,6 +5,8 @@ import { WhatsAppChat } from './chat';
|
|
|
5
5
|
* The current user's WhatsApp account, paired through the Macro app, and its
|
|
6
6
|
* chat list. Added chats are external chats: read and send in them through
|
|
7
7
|
* `macro.externalChats`.
|
|
8
|
+
*
|
|
9
|
+
* @routing Use when checking the user's paired WhatsApp account or listing its chats to add to Macro; not reading or sending in an added chat (`macro.externalChats`).
|
|
8
10
|
*/
|
|
9
11
|
export declare class WhatsAppNamespace {
|
|
10
12
|
private readonly client;
|
|
@@ -3,5 +3,12 @@ import type { MacroClient } from '../../utils/client';
|
|
|
3
3
|
import type { WorkspaceItem, WorkspaceTag } from './types';
|
|
4
4
|
/** @internal */
|
|
5
5
|
export declare function properties(item: SoupApiItem): SoupProperty[];
|
|
6
|
+
/**
|
|
7
|
+
* The caller-visible labels of an item's tag properties, deduplicated; option
|
|
8
|
+
* ids outside the caller's tag sets are left out.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function visibleTags(properties: readonly Pick<SoupProperty, 'definition' | 'value'>[], tagMap: Map<string, WorkspaceTag>): WorkspaceTag[];
|
|
6
13
|
/** @internal */
|
|
7
14
|
export declare function workspaceItem(client: MacroClient, item: SoupApiItem, tagMap: Map<string, WorkspaceTag>): WorkspaceItem;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { MacroClient } from '../../utils/client';
|
|
2
2
|
import type { WorkspaceItem, WorkspaceListOptions, WorkspacePage, WorkspacePageOptions } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Browse recent workspace documents (including tasks),
|
|
5
|
-
* channels, message threads, calls, calendar events and
|
|
6
|
-
* Queries run with the caller's normal access permissions.
|
|
7
|
-
* to find specific names/content; use this namespace for
|
|
4
|
+
* Browse recent workspace documents (including tasks), agent sessions, AI chats,
|
|
5
|
+
* projects, email, channels, message threads, calls, calendar events and
|
|
6
|
+
* foreign entities. Queries run with the caller's normal access permissions.
|
|
7
|
+
* Use `macro.search` to find specific names/content; use this namespace for
|
|
8
|
+
* activity and filtered lists.
|
|
8
9
|
*
|
|
9
10
|
* Each item has an existing `entity` handle plus a generated API `snapshot` for
|
|
10
11
|
* reading metadata without another request. Calendar snapshots contain event time
|
|
@@ -64,17 +65,21 @@ import type { WorkspaceItem, WorkspaceListOptions, WorkspacePage, WorkspacePageO
|
|
|
64
65
|
* `ft`, `id`, `pid`, and `ca`/`ua` timestamp bounds. `ef` supports `Sender`,
|
|
65
66
|
* `Recipient`, `Read`, `ThreadId`, `ca`/`ua`/`va`; `chanf` supports `ChannelId`,
|
|
66
67
|
* `Sender`, `IsParticipant`; `cthf` supports `ChannelId`/`ThreadId`; `callf`
|
|
67
|
-
* supports `CallId`/`ChannelId`/`Speaker`/`Attended
|
|
68
|
-
*
|
|
69
|
-
* and
|
|
68
|
+
* supports `CallId`/`ChannelId`/`Speaker`/`Attended`; `asf` supports `id`, `o`
|
|
69
|
+
* (owner principal), `src` and `vis`. Filters remain server-validated.
|
|
70
|
+
* CRM, initiatives and database rows have their own namespaces and are not
|
|
71
|
+
* included in this browsing surface.
|
|
72
|
+
*
|
|
73
|
+
* @routing Use when browsing the user's recent or filtered workspace items, such as what changed today; not keyword search (`macro.search`).
|
|
70
74
|
*/
|
|
71
75
|
export declare class WorkspaceNamespace {
|
|
72
76
|
private readonly client;
|
|
73
77
|
constructor(client: MacroClient);
|
|
74
|
-
/** One bounded page
|
|
78
|
+
/** One bounded page of recent items, newest first by default; resume using nextCursor and the same options. */
|
|
75
79
|
page(options?: WorkspacePageOptions): Promise<WorkspacePage>;
|
|
76
80
|
/**
|
|
77
|
-
*
|
|
81
|
+
* Every matching item, newest first by default, auto-paginated. `limit` is a
|
|
82
|
+
* page size, not a total result limit.
|
|
78
83
|
* Break a `for await` loop to stop; no speculative next page is fetched.
|
|
79
84
|
* Tag/inbox resolution is reused within this iterator.
|
|
80
85
|
*/
|