@macro-inc/sdk 0.0.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/README.md +177 -0
- package/dist/chunk-5HAKQN23.js +1263 -0
- package/dist/chunk-77EI4LSQ.js +2492 -0
- package/dist/chunk-CTKR64MY.js +1436 -0
- package/dist/chunk-JXIQT5TH.js +1467 -0
- package/dist/chunk-P4DTO6VD.js +830 -0
- package/dist/chunk-PAAFJYGO.js +967 -0
- package/dist/chunk-QNUS5BC5.js +913 -0
- package/dist/chunk-SGAHIERJ.js +1235 -0
- package/dist/chunk-V45LUJDI.js +838 -0
- package/dist/chunk-YRUXFEZM.js +1044 -0
- package/dist/generated/agent-harness/client/client.gen.d.ts +2 -0
- package/dist/generated/agent-harness/client/index.d.ts +10 -0
- package/dist/generated/agent-harness/client/types.gen.d.ts +120 -0
- package/dist/generated/agent-harness/client/utils.gen.d.ts +37 -0
- package/dist/generated/agent-harness/client.gen.d.ts +12 -0
- package/dist/generated/agent-harness/core/auth.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/params.gen.d.ts +43 -0
- package/dist/generated/agent-harness/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/agent-harness/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/agent-harness/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/agent-harness/core/types.gen.d.ts +83 -0
- package/dist/generated/agent-harness/core/utils.gen.d.ts +19 -0
- package/dist/generated/agent-harness/index.d.ts +2 -0
- package/dist/generated/agent-harness/index.js +6 -0
- package/dist/generated/agent-harness/sdk.gen.d.ts +84 -0
- package/dist/generated/agent-harness/types.gen.d.ts +539 -0
- package/dist/generated/auth/client/client.gen.d.ts +2 -0
- package/dist/generated/auth/client/index.d.ts +10 -0
- package/dist/generated/auth/client/types.gen.d.ts +120 -0
- package/dist/generated/auth/client/utils.gen.d.ts +37 -0
- package/dist/generated/auth/client.gen.d.ts +12 -0
- package/dist/generated/auth/core/auth.gen.d.ts +25 -0
- package/dist/generated/auth/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/auth/core/params.gen.d.ts +43 -0
- package/dist/generated/auth/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/auth/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/auth/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/auth/core/types.gen.d.ts +83 -0
- package/dist/generated/auth/core/utils.gen.d.ts +19 -0
- package/dist/generated/auth/index.d.ts +2 -0
- package/dist/generated/auth/index.js +6 -0
- package/dist/generated/auth/sdk.gen.d.ts +383 -0
- package/dist/generated/auth/types.gen.d.ts +2175 -0
- package/dist/generated/cognition/client/client.gen.d.ts +2 -0
- package/dist/generated/cognition/client/index.d.ts +10 -0
- package/dist/generated/cognition/client/types.gen.d.ts +120 -0
- package/dist/generated/cognition/client/utils.gen.d.ts +37 -0
- package/dist/generated/cognition/client.gen.d.ts +12 -0
- package/dist/generated/cognition/core/auth.gen.d.ts +25 -0
- package/dist/generated/cognition/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/cognition/core/params.gen.d.ts +43 -0
- package/dist/generated/cognition/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/cognition/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/cognition/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/cognition/core/types.gen.d.ts +83 -0
- package/dist/generated/cognition/core/utils.gen.d.ts +19 -0
- package/dist/generated/cognition/index.d.ts +2 -0
- package/dist/generated/cognition/index.js +6 -0
- package/dist/generated/cognition/sdk.gen.d.ts +224 -0
- package/dist/generated/cognition/types.gen.d.ts +2484 -0
- package/dist/generated/connection/client/client.gen.d.ts +2 -0
- package/dist/generated/connection/client/index.d.ts +10 -0
- package/dist/generated/connection/client/types.gen.d.ts +120 -0
- package/dist/generated/connection/client/utils.gen.d.ts +37 -0
- package/dist/generated/connection/client.gen.d.ts +12 -0
- package/dist/generated/connection/core/auth.gen.d.ts +25 -0
- package/dist/generated/connection/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/connection/core/params.gen.d.ts +43 -0
- package/dist/generated/connection/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/connection/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/connection/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/connection/core/types.gen.d.ts +83 -0
- package/dist/generated/connection/core/utils.gen.d.ts +19 -0
- package/dist/generated/connection/index.d.ts +2 -0
- package/dist/generated/connection/index.js +839 -0
- package/dist/generated/connection/sdk.gen.d.ts +38 -0
- package/dist/generated/connection/types.gen.d.ts +235 -0
- package/dist/generated/contacts/client/client.gen.d.ts +2 -0
- package/dist/generated/contacts/client/index.d.ts +10 -0
- package/dist/generated/contacts/client/types.gen.d.ts +120 -0
- package/dist/generated/contacts/client/utils.gen.d.ts +37 -0
- package/dist/generated/contacts/client.gen.d.ts +12 -0
- package/dist/generated/contacts/core/auth.gen.d.ts +25 -0
- package/dist/generated/contacts/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/contacts/core/params.gen.d.ts +43 -0
- package/dist/generated/contacts/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/contacts/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/contacts/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/contacts/core/types.gen.d.ts +83 -0
- package/dist/generated/contacts/core/utils.gen.d.ts +19 -0
- package/dist/generated/contacts/index.d.ts +2 -0
- package/dist/generated/contacts/index.js +6 -0
- package/dist/generated/contacts/sdk.gen.d.ts +43 -0
- package/dist/generated/contacts/types.gen.d.ts +52 -0
- package/dist/generated/email/client/client.gen.d.ts +2 -0
- package/dist/generated/email/client/index.d.ts +10 -0
- package/dist/generated/email/client/types.gen.d.ts +120 -0
- package/dist/generated/email/client/utils.gen.d.ts +37 -0
- package/dist/generated/email/client.gen.d.ts +12 -0
- package/dist/generated/email/core/auth.gen.d.ts +25 -0
- package/dist/generated/email/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/email/core/params.gen.d.ts +43 -0
- package/dist/generated/email/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/email/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/email/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/email/core/types.gen.d.ts +83 -0
- package/dist/generated/email/core/utils.gen.d.ts +19 -0
- package/dist/generated/email/index.d.ts +2 -0
- package/dist/generated/email/index.js +6 -0
- package/dist/generated/email/sdk.gen.d.ts +254 -0
- package/dist/generated/email/types.gen.d.ts +2614 -0
- package/dist/generated/notification/client/client.gen.d.ts +2 -0
- package/dist/generated/notification/client/index.d.ts +10 -0
- package/dist/generated/notification/client/types.gen.d.ts +120 -0
- package/dist/generated/notification/client/utils.gen.d.ts +37 -0
- package/dist/generated/notification/client.gen.d.ts +12 -0
- package/dist/generated/notification/core/auth.gen.d.ts +25 -0
- package/dist/generated/notification/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/notification/core/params.gen.d.ts +43 -0
- package/dist/generated/notification/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/notification/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/notification/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/notification/core/types.gen.d.ts +83 -0
- package/dist/generated/notification/core/utils.gen.d.ts +19 -0
- package/dist/generated/notification/index.d.ts +2 -0
- package/dist/generated/notification/index.js +6 -0
- package/dist/generated/notification/sdk.gen.d.ts +118 -0
- package/dist/generated/notification/types.gen.d.ts +1352 -0
- package/dist/generated/properties/client/client.gen.d.ts +2 -0
- package/dist/generated/properties/client/index.d.ts +10 -0
- package/dist/generated/properties/client/types.gen.d.ts +120 -0
- package/dist/generated/properties/client/utils.gen.d.ts +37 -0
- package/dist/generated/properties/client.gen.d.ts +12 -0
- package/dist/generated/properties/core/auth.gen.d.ts +25 -0
- package/dist/generated/properties/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/properties/core/params.gen.d.ts +43 -0
- package/dist/generated/properties/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/properties/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/properties/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/properties/core/types.gen.d.ts +83 -0
- package/dist/generated/properties/core/utils.gen.d.ts +19 -0
- package/dist/generated/properties/index.d.ts +2 -0
- package/dist/generated/properties/index.js +6 -0
- package/dist/generated/properties/sdk.gen.d.ts +158 -0
- package/dist/generated/properties/types.gen.d.ts +1288 -0
- package/dist/generated/scheduled-action/client/client.gen.d.ts +2 -0
- package/dist/generated/scheduled-action/client/index.d.ts +10 -0
- package/dist/generated/scheduled-action/client/types.gen.d.ts +120 -0
- package/dist/generated/scheduled-action/client/utils.gen.d.ts +37 -0
- package/dist/generated/scheduled-action/client.gen.d.ts +12 -0
- package/dist/generated/scheduled-action/core/auth.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/params.gen.d.ts +43 -0
- package/dist/generated/scheduled-action/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/scheduled-action/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/scheduled-action/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/scheduled-action/core/types.gen.d.ts +83 -0
- package/dist/generated/scheduled-action/core/utils.gen.d.ts +19 -0
- package/dist/generated/scheduled-action/index.d.ts +2 -0
- package/dist/generated/scheduled-action/index.js +845 -0
- package/dist/generated/scheduled-action/sdk.gen.d.ts +42 -0
- package/dist/generated/scheduled-action/types.gen.d.ts +241 -0
- package/dist/generated/search/client/client.gen.d.ts +2 -0
- package/dist/generated/search/client/index.d.ts +10 -0
- package/dist/generated/search/client/types.gen.d.ts +120 -0
- package/dist/generated/search/client/utils.gen.d.ts +37 -0
- package/dist/generated/search/client.gen.d.ts +12 -0
- package/dist/generated/search/core/auth.gen.d.ts +25 -0
- package/dist/generated/search/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/search/core/params.gen.d.ts +43 -0
- package/dist/generated/search/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/search/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/search/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/search/core/types.gen.d.ts +83 -0
- package/dist/generated/search/core/utils.gen.d.ts +19 -0
- package/dist/generated/search/index.d.ts +2 -0
- package/dist/generated/search/index.js +6 -0
- package/dist/generated/search/sdk.gen.d.ts +44 -0
- package/dist/generated/search/types.gen.d.ts +2194 -0
- package/dist/generated/static-files/client/client.gen.d.ts +2 -0
- package/dist/generated/static-files/client/index.d.ts +10 -0
- package/dist/generated/static-files/client/types.gen.d.ts +120 -0
- package/dist/generated/static-files/client/utils.gen.d.ts +37 -0
- package/dist/generated/static-files/client.gen.d.ts +12 -0
- package/dist/generated/static-files/core/auth.gen.d.ts +25 -0
- package/dist/generated/static-files/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/static-files/core/params.gen.d.ts +43 -0
- package/dist/generated/static-files/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/static-files/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/static-files/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/static-files/core/types.gen.d.ts +83 -0
- package/dist/generated/static-files/core/utils.gen.d.ts +19 -0
- package/dist/generated/static-files/index.d.ts +2 -0
- package/dist/generated/static-files/index.js +842 -0
- package/dist/generated/static-files/sdk.gen.d.ts +43 -0
- package/dist/generated/static-files/types.gen.d.ts +214 -0
- package/dist/generated/storage/client/client.gen.d.ts +2 -0
- package/dist/generated/storage/client/index.d.ts +10 -0
- package/dist/generated/storage/client/types.gen.d.ts +120 -0
- package/dist/generated/storage/client/utils.gen.d.ts +37 -0
- package/dist/generated/storage/client.gen.d.ts +12 -0
- package/dist/generated/storage/core/auth.gen.d.ts +25 -0
- package/dist/generated/storage/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/storage/core/params.gen.d.ts +43 -0
- package/dist/generated/storage/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/storage/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/storage/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/storage/core/types.gen.d.ts +83 -0
- package/dist/generated/storage/core/utils.gen.d.ts +19 -0
- package/dist/generated/storage/index.d.ts +2 -0
- package/dist/generated/storage/index.js +6 -0
- package/dist/generated/storage/sdk.gen.d.ts +858 -0
- package/dist/generated/storage/types.gen.d.ts +12105 -0
- package/dist/generated/unfurl/client/client.gen.d.ts +2 -0
- package/dist/generated/unfurl/client/index.d.ts +10 -0
- package/dist/generated/unfurl/client/types.gen.d.ts +120 -0
- package/dist/generated/unfurl/client/utils.gen.d.ts +37 -0
- package/dist/generated/unfurl/client.gen.d.ts +12 -0
- package/dist/generated/unfurl/core/auth.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/params.gen.d.ts +43 -0
- package/dist/generated/unfurl/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/unfurl/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/unfurl/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/unfurl/core/types.gen.d.ts +83 -0
- package/dist/generated/unfurl/core/utils.gen.d.ts +19 -0
- package/dist/generated/unfurl/index.d.ts +2 -0
- package/dist/generated/unfurl/index.js +835 -0
- package/dist/generated/unfurl/sdk.gen.d.ts +47 -0
- package/dist/generated/unfurl/types.gen.d.ts +125 -0
- package/dist/src/config.d.ts +51 -0
- package/dist/src/entities/agent-sessions/agent-session.d.ts +45 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +18 -0
- package/dist/src/entities/bots/namespace.d.ts +25 -0
- package/dist/src/entities/calls/call-record.d.ts +55 -0
- package/dist/src/entities/calls/namespace.d.ts +9 -0
- package/dist/src/entities/channels/channel.d.ts +88 -0
- package/dist/src/entities/channels/message.d.ts +64 -0
- package/dist/src/entities/channels/namespace.d.ts +30 -0
- package/dist/src/entities/channels/post.d.ts +20 -0
- package/dist/src/entities/channels/thread.d.ts +30 -0
- package/dist/src/entities/chats/chat.d.ts +55 -0
- package/dist/src/entities/chats/namespace.d.ts +14 -0
- package/dist/src/entities/crm/comment.d.ts +43 -0
- package/dist/src/entities/crm/company.d.ts +70 -0
- package/dist/src/entities/crm/contact.d.ts +48 -0
- package/dist/src/entities/crm/namespace.d.ts +22 -0
- package/dist/src/entities/documents/comment.d.ts +41 -0
- package/dist/src/entities/documents/document.d.ts +130 -0
- package/dist/src/entities/documents/namespace.d.ts +43 -0
- package/dist/src/entities/documents/system-skill.d.ts +16 -0
- package/dist/src/entities/email/attachment.d.ts +36 -0
- package/dist/src/entities/email/label.d.ts +31 -0
- package/dist/src/entities/email/link.d.ts +29 -0
- package/dist/src/entities/email/message.d.ts +58 -0
- package/dist/src/entities/email/namespace.d.ts +49 -0
- package/dist/src/entities/email/thread.d.ts +88 -0
- package/dist/src/entities/entity.d.ts +101 -0
- package/dist/src/entities/favorites/namespace.d.ts +19 -0
- package/dist/src/entities/foreign/foreign-entity.d.ts +30 -0
- package/dist/src/entities/foreign/namespace.d.ts +7 -0
- package/dist/src/entities/notifications/namespace.d.ts +29 -0
- package/dist/src/entities/notifications/notification.d.ts +50 -0
- package/dist/src/entities/pins/namespace.d.ts +19 -0
- package/dist/src/entities/projects/namespace.d.ts +13 -0
- package/dist/src/entities/projects/project.d.ts +42 -0
- package/dist/src/entities/properties/namespace.d.ts +47 -0
- package/dist/src/entities/properties/property-definition.d.ts +45 -0
- package/dist/src/entities/properties/property-option.d.ts +32 -0
- package/dist/src/entities/search.d.ts +23 -0
- package/dist/src/entities/tasks/namespace.d.ts +21 -0
- package/dist/src/entities/tasks/task.d.ts +34 -0
- package/dist/src/entities/teams/namespace.d.ts +12 -0
- package/dist/src/entities/teams/team.d.ts +40 -0
- package/dist/src/entities/users/namespace.d.ts +10 -0
- package/dist/src/entities/users/user.d.ts +43 -0
- package/dist/src/entities/webhooks/namespace.d.ts +31 -0
- package/dist/src/entities/webhooks/webhook.d.ts +88 -0
- package/dist/src/events/hydrate/channel.d.ts +85 -0
- package/dist/src/events/hydrate/document.d.ts +54 -0
- package/dist/src/events/receiver.d.ts +51 -0
- package/dist/src/events/types.d.ts +40 -0
- package/dist/src/events/verify.d.ts +13 -0
- package/dist/src/local-portmap.d.ts +8 -0
- package/dist/src/macro.d.ts +62 -0
- package/dist/src/macro.js +4215 -0
- package/dist/src/mentions.d.ts +37 -0
- package/dist/src/raw.d.ts +12 -0
- package/dist/src/utils/client.d.ts +53 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/lazy.d.ts +18 -0
- package/dist/src/utils/pagination.d.ts +7 -0
- package/dist/src/utils/unwrap.d.ts +23 -0
- package/package.json +49 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { GetChatHistoryHandlerResponses, GetChatResponses } from '../../../generated/cognition/types.gen';
|
|
2
|
+
import { type Mentionable, type MentionPart } from '../../mentions';
|
|
3
|
+
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import { PropertiedEntity } from '../entity';
|
|
5
|
+
import { Project } from '../projects/project';
|
|
6
|
+
type ChatDetail = GetChatResponses[200]['chat'];
|
|
7
|
+
type ChatHistory = GetChatHistoryHandlerResponses[200]['conversation'];
|
|
8
|
+
/** A Macro AI chat. */
|
|
9
|
+
export declare class Chat extends PropertiedEntity<ChatDetail> implements Mentionable {
|
|
10
|
+
/** Favorites identify chats as `chat`. */
|
|
11
|
+
readonly entityType = "chat";
|
|
12
|
+
/** The properties service identifies chats as `CHAT`. */
|
|
13
|
+
protected readonly propertyEntityType = "CHAT";
|
|
14
|
+
protected fetch(): Promise<ChatDetail>;
|
|
15
|
+
/** A handle to a chat by id. Details load on first access. */
|
|
16
|
+
static byId(client: MacroClient, id: string): Chat;
|
|
17
|
+
/** Create a chat, optionally named and attached to a project. */
|
|
18
|
+
static create(client: MacroClient, opts?: {
|
|
19
|
+
name?: string;
|
|
20
|
+
project?: Project;
|
|
21
|
+
}): Promise<Chat>;
|
|
22
|
+
/** The chat's display name. */
|
|
23
|
+
readonly name: () => Promise<string>;
|
|
24
|
+
/** The model used to generate the chat (`provider/model` id), if set. */
|
|
25
|
+
readonly model: () => Promise<string | undefined>;
|
|
26
|
+
/** The project this chat belongs to, if any. */
|
|
27
|
+
readonly project: () => Promise<Project | undefined>;
|
|
28
|
+
/** When the chat was created. */
|
|
29
|
+
readonly createdAt: () => Promise<string | undefined>;
|
|
30
|
+
/** When the chat was last updated. */
|
|
31
|
+
readonly updatedAt: () => Promise<string | undefined>;
|
|
32
|
+
/** The messages in the chat, with their attachments. */
|
|
33
|
+
readonly messages: () => Promise<import("../../../generated/cognition").ChatMessageWithAttachments[]>;
|
|
34
|
+
/** Rename the chat. */
|
|
35
|
+
rename(name: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete the chat. Soft by default (reversible with {@link restore});
|
|
38
|
+
* pass `permanent: true` to delete irreversibly.
|
|
39
|
+
*/
|
|
40
|
+
delete(opts?: {
|
|
41
|
+
permanent?: boolean;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
/** Copy the chat, returning a handle to the new copy. */
|
|
44
|
+
copy(): Promise<Chat>;
|
|
45
|
+
/** Restore a soft-deleted chat. */
|
|
46
|
+
restore(): Promise<void>;
|
|
47
|
+
/** The chat's conversation history: titled records of messages with attachment ids. */
|
|
48
|
+
history(): Promise<ChatHistory>;
|
|
49
|
+
/** The chat's URL in the Macro web app. */
|
|
50
|
+
webUrl(): string;
|
|
51
|
+
/** Search chats by name and content, most relevant first, auto-paginated. */
|
|
52
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<Chat, any, any>;
|
|
53
|
+
toMention(): MentionPart;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { Project } from '../projects/project';
|
|
3
|
+
import type { SearchOpts } from '../search';
|
|
4
|
+
import { Chat } from './chat';
|
|
5
|
+
export declare class ChatNamespace {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: MacroClient);
|
|
8
|
+
byId(id: string): Chat;
|
|
9
|
+
create(opts?: {
|
|
10
|
+
name?: string;
|
|
11
|
+
project?: Project;
|
|
12
|
+
}): Promise<Chat>;
|
|
13
|
+
search(query: string, opts?: SearchOpts): AsyncGenerator<Chat>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CrmComment as CrmCommentRecord, CrmThread, DeleteCrmCommentResult } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
/** A CRM comment thread with its comments, as returned for a company or contact. */
|
|
4
|
+
export interface CrmThreadWithComments {
|
|
5
|
+
/** The thread. */
|
|
6
|
+
thread: CrmThread;
|
|
7
|
+
/** The thread's comments, oldest first. */
|
|
8
|
+
comments: CrmComment[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A comment on a CRM company or contact. Shared by both entity types, since
|
|
12
|
+
* the underlying API and record shape are already unified across them.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CrmComment {
|
|
15
|
+
private readonly client;
|
|
16
|
+
readonly id: string;
|
|
17
|
+
private record;
|
|
18
|
+
private constructor();
|
|
19
|
+
/** Wrap a record already in hand (e.g. from a list or create response). */
|
|
20
|
+
static from(client: MacroClient, record: CrmCommentRecord): CrmComment;
|
|
21
|
+
/** The comment body (markdown). */
|
|
22
|
+
get text(): string;
|
|
23
|
+
/** The id of the thread this comment belongs to. */
|
|
24
|
+
get threadId(): string;
|
|
25
|
+
/** Macro user id of the comment author. */
|
|
26
|
+
get owner(): string;
|
|
27
|
+
/** Macro user id of the actual sender, when distinct from {@link owner}. */
|
|
28
|
+
get sender(): string | undefined;
|
|
29
|
+
/** Explicit ordering within the thread, if set. */
|
|
30
|
+
get order(): number | undefined;
|
|
31
|
+
/** Arbitrary client metadata attached to the comment. */
|
|
32
|
+
get metadata(): unknown;
|
|
33
|
+
/** When the comment was created. */
|
|
34
|
+
get createdAt(): string;
|
|
35
|
+
/** When the comment was last updated. */
|
|
36
|
+
get updatedAt(): string;
|
|
37
|
+
/** When the comment was soft-deleted, if ever. */
|
|
38
|
+
get deletedAt(): string | undefined;
|
|
39
|
+
/** Replace this comment's text (markdown). */
|
|
40
|
+
edit(text: string): Promise<this>;
|
|
41
|
+
/** Soft-delete this comment; the thread goes too when it was the last live one. */
|
|
42
|
+
delete(): Promise<DeleteCrmCommentResult>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { CreateCrmCommentRequest, DeleteCrmCommentResult, GetCompanyResponses } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { PropertiedEntity } from '../entity';
|
|
4
|
+
import { Team } from '../teams/team';
|
|
5
|
+
import { CrmComment, type CrmThreadWithComments } from './comment';
|
|
6
|
+
import { Contact } from './contact';
|
|
7
|
+
type CompanyDetail = GetCompanyResponses[200];
|
|
8
|
+
/** A CRM company: an organization the team has interacted with. */
|
|
9
|
+
export declare class Company extends PropertiedEntity<CompanyDetail> {
|
|
10
|
+
/** Favorites identify CRM companies as `crm_company`. */
|
|
11
|
+
readonly entityType = "crm_company";
|
|
12
|
+
/** The properties service identifies CRM companies as `COMPANY`. */
|
|
13
|
+
protected readonly propertyEntityType = "COMPANY";
|
|
14
|
+
protected fetch(): Promise<CompanyDetail>;
|
|
15
|
+
/** A handle to a CRM company by id. Details load on first access. */
|
|
16
|
+
static byId(client: MacroClient, id: string): Company;
|
|
17
|
+
/** Build a company from an API record (pre-seeded, no fetch). */
|
|
18
|
+
static from(client: MacroClient, data: CompanyDetail): Company;
|
|
19
|
+
/** The company's display name, if resolved. */
|
|
20
|
+
readonly name: () => Promise<string | undefined>;
|
|
21
|
+
/** The company's display description, if any. */
|
|
22
|
+
readonly description: () => Promise<string | undefined>;
|
|
23
|
+
/** Whether the company is hidden from CRM listings. */
|
|
24
|
+
readonly hidden: () => Promise<boolean>;
|
|
25
|
+
/** Whether email sync is enabled for this company. */
|
|
26
|
+
readonly emailSync: () => Promise<boolean>;
|
|
27
|
+
/** The team that owns this company. */
|
|
28
|
+
readonly team: () => Promise<Team>;
|
|
29
|
+
/** When the company was first created in the CRM. */
|
|
30
|
+
readonly createdAt: () => Promise<string>;
|
|
31
|
+
/** When the company was last updated. */
|
|
32
|
+
readonly updatedAt: () => Promise<string>;
|
|
33
|
+
/** The company's primary domain (e.g. `acme.com`), if any. */
|
|
34
|
+
domain(): Promise<string | undefined>;
|
|
35
|
+
/** All domains associated with the company, primary first. */
|
|
36
|
+
domains(): Promise<string[]>;
|
|
37
|
+
/** The contacts attached to this company (hidden ones filtered for non-admins). */
|
|
38
|
+
contacts(): Promise<Contact[]>;
|
|
39
|
+
/** Search CRM companies by name/domain, most relevant first, auto-paginated. */
|
|
40
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<Company, any, any>;
|
|
41
|
+
/**
|
|
42
|
+
* Hide the company from CRM listings: disables email sync and soft-hides
|
|
43
|
+
* its contacts. Reversible with {@link unhide}.
|
|
44
|
+
*/
|
|
45
|
+
hide(): Promise<void>;
|
|
46
|
+
/** Un-hide the company, restoring it and its contacts to CRM listings. */
|
|
47
|
+
unhide(): Promise<void>;
|
|
48
|
+
private setHidden;
|
|
49
|
+
/**
|
|
50
|
+
* Enable or disable team-wide email sync for this company. Rejects with 409
|
|
51
|
+
* when enabling on a hidden company — {@link unhide} first.
|
|
52
|
+
*/
|
|
53
|
+
setEmailSync(enabled: boolean): Promise<void>;
|
|
54
|
+
/** Rename the company for the caller's current team. */
|
|
55
|
+
rename(name: string): Promise<void>;
|
|
56
|
+
/** Create a contact under this company. */
|
|
57
|
+
createContact(opts: {
|
|
58
|
+
email: string;
|
|
59
|
+
name: string;
|
|
60
|
+
}): Promise<Contact>;
|
|
61
|
+
/** The comment threads attached to this company, with comments oldest first. */
|
|
62
|
+
comments(): Promise<CrmThreadWithComments[]>;
|
|
63
|
+
/** Add a comment: starts a new thread unless `body.threadId` targets an existing one. */
|
|
64
|
+
comment(body: CreateCrmCommentRequest): Promise<CrmComment>;
|
|
65
|
+
/** Replace a comment's text (markdown). */
|
|
66
|
+
editComment(comment: CrmComment, text: string): Promise<CrmComment>;
|
|
67
|
+
/** Soft-delete a comment; the thread goes too when it was the last live one. */
|
|
68
|
+
deleteComment(comment: CrmComment): Promise<DeleteCrmCommentResult>;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CreateCrmCommentRequest, DeleteCrmCommentResult, GetContactResponses } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { FavoritableEntity } from '../entity';
|
|
4
|
+
import { CrmComment, type CrmThreadWithComments } from './comment';
|
|
5
|
+
import { Company } from './company';
|
|
6
|
+
type ContactDetail = GetContactResponses[200];
|
|
7
|
+
/** A CRM contact: a person observed interacting with the team. */
|
|
8
|
+
export declare class Contact extends FavoritableEntity<ContactDetail> {
|
|
9
|
+
/** Favorites identify CRM contacts as `crm_contact`. */
|
|
10
|
+
readonly entityType = "crm_contact";
|
|
11
|
+
protected fetch(): Promise<ContactDetail>;
|
|
12
|
+
/** A handle to a CRM contact by id. Details load on first access. */
|
|
13
|
+
static byId(client: MacroClient, id: string): Contact;
|
|
14
|
+
/** Build a contact from an API record (pre-seeded, no fetch). */
|
|
15
|
+
static from(client: MacroClient, data: ContactDetail): Contact;
|
|
16
|
+
/** The contact's display name, if one has been observed. */
|
|
17
|
+
readonly name: () => Promise<string | undefined>;
|
|
18
|
+
/** The contact's email address. */
|
|
19
|
+
readonly email: () => Promise<string>;
|
|
20
|
+
/** The CRM company this contact belongs to. */
|
|
21
|
+
readonly company: () => Promise<Company>;
|
|
22
|
+
/** Whether the contact is hidden from CRM listings. */
|
|
23
|
+
readonly hidden: () => Promise<boolean>;
|
|
24
|
+
/** When the contact was first created in the CRM. */
|
|
25
|
+
readonly createdAt: () => Promise<string>;
|
|
26
|
+
/** When the contact was last updated. */
|
|
27
|
+
readonly updatedAt: () => Promise<string>;
|
|
28
|
+
/** When the team first interacted with this contact. */
|
|
29
|
+
readonly firstInteraction: () => Promise<string>;
|
|
30
|
+
/** When the team last interacted with this contact. */
|
|
31
|
+
readonly lastInteraction: () => Promise<string>;
|
|
32
|
+
/** Hide the contact from CRM listings. Display-only; reversible with {@link unhide}. */
|
|
33
|
+
hide(): Promise<void>;
|
|
34
|
+
/** Un-hide the contact, restoring it to CRM listings. */
|
|
35
|
+
unhide(): Promise<void>;
|
|
36
|
+
private setHidden;
|
|
37
|
+
/** Rename the contact for the caller's current team. */
|
|
38
|
+
rename(name: string): Promise<void>;
|
|
39
|
+
/** The comment threads attached to this contact, with comments oldest first. */
|
|
40
|
+
comments(): Promise<CrmThreadWithComments[]>;
|
|
41
|
+
/** Add a comment: starts a new thread unless `body.threadId` targets an existing one. */
|
|
42
|
+
comment(body: CreateCrmCommentRequest): Promise<CrmComment>;
|
|
43
|
+
/** Replace a comment's text (markdown). */
|
|
44
|
+
editComment(comment: CrmComment, text: string): Promise<CrmComment>;
|
|
45
|
+
/** Soft-delete a comment; the thread goes too when it was the last live one. */
|
|
46
|
+
deleteComment(comment: CrmComment): Promise<DeleteCrmCommentResult>;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CreateCrmCompanyRequest, CrmTeamSettingsResponse, UpdateCrmTeamSettingsRequest } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Company } from './company';
|
|
4
|
+
import { Contact } from './contact';
|
|
5
|
+
export declare class CrmNamespace {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: MacroClient);
|
|
8
|
+
/** A handle to a CRM company by id. */
|
|
9
|
+
companyById(id: string): Company;
|
|
10
|
+
/** A handle to a CRM contact by id. */
|
|
11
|
+
contactById(id: string): Contact;
|
|
12
|
+
/** Resolve a CRM contact by email in the caller's current team, if present. */
|
|
13
|
+
contactByEmail(email: string): Promise<Contact | undefined>;
|
|
14
|
+
/** Create a CRM company for the caller's current team. */
|
|
15
|
+
createCompany(opts: CreateCrmCompanyRequest): Promise<Company>;
|
|
16
|
+
/** The caller's current team's CRM settings. */
|
|
17
|
+
settings(): Promise<CrmTeamSettingsResponse>;
|
|
18
|
+
/** Partially update the caller's current team's CRM settings. */
|
|
19
|
+
updateSettings(settings: UpdateCrmTeamSettingsRequest): Promise<CrmTeamSettingsResponse>;
|
|
20
|
+
/** Search CRM companies by name/domain, most relevant first, auto-paginated. */
|
|
21
|
+
searchCompanies(query: string): AsyncGenerator<Company>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Comment as CommentRecord } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
import { User } from '../users/user';
|
|
5
|
+
import type { Document } from './document';
|
|
6
|
+
/**
|
|
7
|
+
* A comment on a document. Compound-keyed by `(documentId, commentId)`:
|
|
8
|
+
* comment ids are numeric and only unique per document, so the numeric id is
|
|
9
|
+
* kept as {@link commentId} and its string form backs the base class `id`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Comment extends MacroEntity<CommentRecord> {
|
|
12
|
+
/** The document this comment belongs to. */
|
|
13
|
+
readonly documentId: string;
|
|
14
|
+
/** The comment's numeric id, as the API uses it. */
|
|
15
|
+
readonly commentId: number;
|
|
16
|
+
private constructor();
|
|
17
|
+
/**
|
|
18
|
+
* There is no single-comment GET, so a fetch loads the document's comment
|
|
19
|
+
* threads and finds this comment in them.
|
|
20
|
+
*/
|
|
21
|
+
protected fetch(): Promise<CommentRecord>;
|
|
22
|
+
/** Build a comment from a comment-thread record (pre-seeded, no fetch). */
|
|
23
|
+
static from(client: MacroClient, document: Document, record: CommentRecord): Comment;
|
|
24
|
+
/** The comment's text. */
|
|
25
|
+
readonly text: () => Promise<string>;
|
|
26
|
+
/** The id of the thread this comment belongs to. */
|
|
27
|
+
readonly threadId: () => Promise<number>;
|
|
28
|
+
/** When the comment was created. */
|
|
29
|
+
readonly createdAt: () => Promise<string | undefined>;
|
|
30
|
+
/** When the comment was last updated. */
|
|
31
|
+
readonly updatedAt: () => Promise<string | undefined>;
|
|
32
|
+
/** The user who wrote this comment. */
|
|
33
|
+
author(): Promise<User>;
|
|
34
|
+
/**
|
|
35
|
+
* Replace the comment's text. The endpoint requires the thread id in the
|
|
36
|
+
* body, which is resolved from the comment's own record.
|
|
37
|
+
*/
|
|
38
|
+
edit(text: string): Promise<this>;
|
|
39
|
+
/** Delete this comment. */
|
|
40
|
+
delete(): Promise<void>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { PropertyTargetEntityType as PropertyEntityType } from '../../../generated/properties/types.gen';
|
|
2
|
+
import type { Thread as CommentThreadRecord, DocumentTeamShareResponse, GetDocumentResponses, GithubPullRequest } from '../../../generated/storage/types.gen';
|
|
3
|
+
import { type Mentionable, type MentionPart } from '../../mentions';
|
|
4
|
+
import type { MacroClient } from '../../utils/client';
|
|
5
|
+
import { PropertiedEntity } from '../entity';
|
|
6
|
+
import { Project } from '../projects/project';
|
|
7
|
+
import { User } from '../users/user';
|
|
8
|
+
import { Comment } from './comment';
|
|
9
|
+
type DocumentDetail = GetDocumentResponses[200]['data']['documentMetadata'];
|
|
10
|
+
/** One of a document's comment threads: the thread record and its comments. */
|
|
11
|
+
export interface CommentThread {
|
|
12
|
+
/** The thread record: id, resolved state, owner, timestamps. */
|
|
13
|
+
thread: CommentThreadRecord;
|
|
14
|
+
/** The thread's comments, in order. */
|
|
15
|
+
comments: Comment[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A Macro document. Can be dropped into a {@link msg} template to render an
|
|
19
|
+
* inline link to the document.
|
|
20
|
+
*/
|
|
21
|
+
export declare class Document extends PropertiedEntity<DocumentDetail> implements Mentionable {
|
|
22
|
+
protected fetch(): Promise<DocumentDetail>;
|
|
23
|
+
/** A handle to a document by id. Details load on first access. */
|
|
24
|
+
static byId(client: MacroClient, id: string): Document;
|
|
25
|
+
/** Create a markdown document. */
|
|
26
|
+
static create(client: MacroClient, opts: {
|
|
27
|
+
name: string;
|
|
28
|
+
markdown?: string;
|
|
29
|
+
project?: Project;
|
|
30
|
+
}): Promise<Document>;
|
|
31
|
+
/**
|
|
32
|
+
* Create a snippet: a reusable markdown document that can be inserted into
|
|
33
|
+
* any markdown area.
|
|
34
|
+
*/
|
|
35
|
+
static createSnippet(client: MacroClient, opts: {
|
|
36
|
+
name: string;
|
|
37
|
+
markdown?: string;
|
|
38
|
+
project?: Project;
|
|
39
|
+
}): Promise<Document>;
|
|
40
|
+
/**
|
|
41
|
+
* Create a skill: a markdown document containing instructions that AI reads
|
|
42
|
+
* and follows when the skill is referenced in an AI input.
|
|
43
|
+
*/
|
|
44
|
+
static createSkill(client: MacroClient, opts: {
|
|
45
|
+
name: string;
|
|
46
|
+
markdown?: string;
|
|
47
|
+
project?: Project;
|
|
48
|
+
}): Promise<Document>;
|
|
49
|
+
/** The user's recent documents, most recent first, auto-paginated. */
|
|
50
|
+
static recent(client: MacroClient, opts?: {
|
|
51
|
+
pageSize?: number;
|
|
52
|
+
fileType?: string;
|
|
53
|
+
}): AsyncGenerator<Document>;
|
|
54
|
+
/**
|
|
55
|
+
* The user's recently soft-deleted documents. The underlying endpoint also
|
|
56
|
+
* returns deleted chats and projects; those are filtered out here.
|
|
57
|
+
*/
|
|
58
|
+
static recentlyDeleted(client: MacroClient): Promise<Document[]>;
|
|
59
|
+
/** Favorites identify documents as `document`. */
|
|
60
|
+
readonly entityType = "document";
|
|
61
|
+
/** The properties service identifies documents as `DOCUMENT`. */
|
|
62
|
+
protected readonly propertyEntityType: PropertyEntityType;
|
|
63
|
+
/** The document's display name. */
|
|
64
|
+
readonly name: () => Promise<string>;
|
|
65
|
+
/** The document's file type (e.g. `md`, `pdf`, `docx`). */
|
|
66
|
+
readonly fileType: () => Promise<string | undefined>;
|
|
67
|
+
/** The project this document belongs to, if any. */
|
|
68
|
+
readonly project: () => Promise<Project | undefined>;
|
|
69
|
+
/** The user who owns the document. */
|
|
70
|
+
readonly owner: () => Promise<User>;
|
|
71
|
+
/** The document this one was branched from, if any. */
|
|
72
|
+
readonly branchedFrom: () => Promise<Document | undefined>;
|
|
73
|
+
/** When the document was created. */
|
|
74
|
+
readonly createdAt: () => Promise<string | undefined>;
|
|
75
|
+
/** When the document was last updated. */
|
|
76
|
+
readonly updatedAt: () => Promise<string | undefined>;
|
|
77
|
+
/** When the document was deleted, if it has been. */
|
|
78
|
+
readonly deletedAt: () => Promise<string | undefined>;
|
|
79
|
+
/**
|
|
80
|
+
* The document's raw content (markdown source for markdown documents),
|
|
81
|
+
* downloaded via a presigned export URL.
|
|
82
|
+
*/
|
|
83
|
+
content(): Promise<string>;
|
|
84
|
+
/** Rename the document. */
|
|
85
|
+
rename(name: string): Promise<void>;
|
|
86
|
+
/** Move the document into a project (or out of one, with `null`). */
|
|
87
|
+
move(project: Project | null): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Delete the document. Soft by default (reversible with {@link restore});
|
|
90
|
+
* pass `permanent: true` to delete irreversibly.
|
|
91
|
+
*/
|
|
92
|
+
delete(opts?: {
|
|
93
|
+
permanent?: boolean;
|
|
94
|
+
}): Promise<void>;
|
|
95
|
+
/** Restore a soft-deleted document. */
|
|
96
|
+
restore(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Copy the document under a new name, optionally from a specific version.
|
|
99
|
+
* Returns a handle to the new document.
|
|
100
|
+
*/
|
|
101
|
+
copy(opts: {
|
|
102
|
+
name: string;
|
|
103
|
+
versionId?: number;
|
|
104
|
+
}): Promise<Document>;
|
|
105
|
+
/** The document's comment threads, each with its comments. */
|
|
106
|
+
comments(): Promise<CommentThread[]>;
|
|
107
|
+
/**
|
|
108
|
+
* Add a comment. Starts a new unanchored thread, or replies to an existing
|
|
109
|
+
* one when `threadId` is given. Returns the created comment.
|
|
110
|
+
*/
|
|
111
|
+
comment(text: string, opts?: {
|
|
112
|
+
threadId?: number;
|
|
113
|
+
}): Promise<Comment>;
|
|
114
|
+
/** The document's short id (used in compact links and branch names). */
|
|
115
|
+
shortId(): Promise<string>;
|
|
116
|
+
/** Whether the document is shared with the owner's team, and which team. */
|
|
117
|
+
teamShare(): Promise<DocumentTeamShareResponse>;
|
|
118
|
+
/** Share the document with the owner's team, or unshare it. */
|
|
119
|
+
setTeamShare(shared: boolean): Promise<void>;
|
|
120
|
+
/** GitHub pull requests associated with the document. */
|
|
121
|
+
githubPullRequests(): Promise<GithubPullRequest[]>;
|
|
122
|
+
/** The git branch name derived for the document (task documents). */
|
|
123
|
+
branchName(): Promise<string>;
|
|
124
|
+
/** The document's URL in the Macro web app. */
|
|
125
|
+
webUrl(): string;
|
|
126
|
+
/** Search documents by name and content, most relevant first, auto-paginated. */
|
|
127
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<Document, any, any>;
|
|
128
|
+
toMention(): MentionPart;
|
|
129
|
+
}
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { Project } from '../projects/project';
|
|
3
|
+
import type { SearchOpts } from '../search';
|
|
4
|
+
import { Document } from './document';
|
|
5
|
+
import { SystemSkill } from './system-skill';
|
|
6
|
+
export declare class DocumentNamespace {
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(client: MacroClient);
|
|
9
|
+
/** A handle to a document by id. Details load on first access. */
|
|
10
|
+
byId(id: string): Document;
|
|
11
|
+
/** Create a markdown document. */
|
|
12
|
+
create(opts: {
|
|
13
|
+
name: string;
|
|
14
|
+
markdown?: string;
|
|
15
|
+
project?: Project;
|
|
16
|
+
}): Promise<Document>;
|
|
17
|
+
/** Create a snippet: a reusable markdown document. */
|
|
18
|
+
createSnippet(opts: {
|
|
19
|
+
name: string;
|
|
20
|
+
markdown?: string;
|
|
21
|
+
project?: Project;
|
|
22
|
+
}): Promise<Document>;
|
|
23
|
+
/** Create a skill: markdown instructions that AI reads and follows. */
|
|
24
|
+
createSkill(opts: {
|
|
25
|
+
name: string;
|
|
26
|
+
markdown?: string;
|
|
27
|
+
project?: Project;
|
|
28
|
+
}): Promise<Document>;
|
|
29
|
+
/**
|
|
30
|
+
* The built-in system skills: static AI instructions with no document
|
|
31
|
+
* behind them. Unlike user skills they cannot be opened or edited.
|
|
32
|
+
*/
|
|
33
|
+
systemSkills(): Promise<SystemSkill[]>;
|
|
34
|
+
/** Search documents by name and content, most relevant first, auto-paginated. */
|
|
35
|
+
search(query: string, opts?: SearchOpts): AsyncGenerator<Document>;
|
|
36
|
+
/** The user's recent documents, most recent first, auto-paginated. */
|
|
37
|
+
recent(opts?: {
|
|
38
|
+
pageSize?: number;
|
|
39
|
+
fileType?: string;
|
|
40
|
+
}): AsyncGenerator<Document>;
|
|
41
|
+
/** The user's recently soft-deleted documents. */
|
|
42
|
+
recentlyDeleted(): Promise<Document[]>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
/**
|
|
3
|
+
* A built-in system skill: static, code-defined AI instructions that surface
|
|
4
|
+
* to AI like skill documents but have no document behind them. System skills
|
|
5
|
+
* cannot be opened, edited, or deleted; reference them in AI inputs by id the
|
|
6
|
+
* same way as skill documents.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SystemSkill {
|
|
9
|
+
/** The well-known id the skill is referenced by in mentions and AI tools. */
|
|
10
|
+
readonly id: string;
|
|
11
|
+
/** The skill's display name. */
|
|
12
|
+
readonly name: string;
|
|
13
|
+
private constructor();
|
|
14
|
+
/** The built-in system skills, in display order. */
|
|
15
|
+
static list(client: MacroClient): Promise<SystemSkill[]>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GetAttachmentResponses } from '../../../generated/email/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Document } from '../documents/document';
|
|
4
|
+
import { MacroEntity } from '../entity';
|
|
5
|
+
/** The API's representation of an email attachment (`Attachment`). */
|
|
6
|
+
export type EmailAttachmentData = GetAttachmentResponses[200]['attachment'];
|
|
7
|
+
/**
|
|
8
|
+
* A file attached to an email message. A thin handle keyed by attachment id;
|
|
9
|
+
* the record loads lazily on first field access.
|
|
10
|
+
*/
|
|
11
|
+
export declare class EmailAttachment extends MacroEntity<EmailAttachmentData> {
|
|
12
|
+
protected fetch(): Promise<EmailAttachmentData>;
|
|
13
|
+
/** A handle to an attachment by id. Fields load on first access. */
|
|
14
|
+
static byId(client: MacroClient, id: string): EmailAttachment;
|
|
15
|
+
/** Build an attachment from an already-fetched record (pre-seeded, no fetch). */
|
|
16
|
+
static from(client: MacroClient, data: EmailAttachmentData): EmailAttachment;
|
|
17
|
+
/** The attachment's original filename. */
|
|
18
|
+
readonly filename: () => Promise<string | undefined>;
|
|
19
|
+
/** The attachment's MIME type. */
|
|
20
|
+
readonly mimeType: () => Promise<string | undefined>;
|
|
21
|
+
/** The attachment's size in bytes. */
|
|
22
|
+
readonly size: () => Promise<number | undefined>;
|
|
23
|
+
/** A URL to the attachment's raw data, when available. */
|
|
24
|
+
readonly dataUrl: () => Promise<string | undefined>;
|
|
25
|
+
/** The attachment's static-file-service id, when it has been stored there. */
|
|
26
|
+
readonly sfsId: () => Promise<string | undefined>;
|
|
27
|
+
/** The attachment's Content-ID header value (for inline attachments). */
|
|
28
|
+
readonly contentId: () => Promise<string | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* The Macro document holding this attachment's content. Get-or-create: the
|
|
31
|
+
* server returns the existing document's id, or downloads the attachment
|
|
32
|
+
* from the provider and uploads it as a new document first (deduplicated
|
|
33
|
+
* behind a server-side lock).
|
|
34
|
+
*/
|
|
35
|
+
toDocument(): Promise<Document>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ApiLabel } from '../../../generated/email/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
/**
|
|
5
|
+
* An email label. A free-to-construct handle: there is no single-label GET,
|
|
6
|
+
* so the detail record loads lazily on first field access by listing all
|
|
7
|
+
* labels and finding this one (mirroring {@link Link}).
|
|
8
|
+
*/
|
|
9
|
+
export declare class Label extends MacroEntity<ApiLabel> {
|
|
10
|
+
protected fetch(): Promise<ApiLabel>;
|
|
11
|
+
/** A handle to a label by id. Details load on first access. */
|
|
12
|
+
static byId(client: MacroClient, id: string): Label;
|
|
13
|
+
/** All labels across the user's inboxes. */
|
|
14
|
+
static list(client: MacroClient): Promise<Label[]>;
|
|
15
|
+
/** Create a user label. */
|
|
16
|
+
static create(client: MacroClient, name: string): Promise<Label>;
|
|
17
|
+
/** Delete this label. */
|
|
18
|
+
delete(): Promise<void>;
|
|
19
|
+
/** The label's display name. */
|
|
20
|
+
readonly name: () => Promise<string>;
|
|
21
|
+
/** The inbox (email link) this label belongs to. */
|
|
22
|
+
readonly linkId: () => Promise<string>;
|
|
23
|
+
/** Whether this is a system label or a user-created one. */
|
|
24
|
+
readonly type: () => Promise<import("../../../generated/email").ApiLabelType>;
|
|
25
|
+
/** When the label was created. */
|
|
26
|
+
readonly createdAt: () => Promise<string>;
|
|
27
|
+
/** Whether the label is shown in the label list. */
|
|
28
|
+
readonly labelListVisibility: () => Promise<import("../../../generated/email").ApiLabelListVisibility>;
|
|
29
|
+
/** Whether the label is shown in the message list. */
|
|
30
|
+
readonly messageListVisibility: () => Promise<import("../../../generated/email").ApiMessageListVisibility>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Link as LinkRecord } from '../../../generated/email/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
/**
|
|
5
|
+
* An email link: a connected inbox (e.g. a Gmail account) that threads and
|
|
6
|
+
* messages sync through. A free-to-construct handle, resolved from the
|
|
7
|
+
* caller's connected links.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Link extends MacroEntity<LinkRecord> {
|
|
10
|
+
protected fetch(): Promise<LinkRecord>;
|
|
11
|
+
/** A handle to an email link by id. Details load on first access. */
|
|
12
|
+
static byId(client: MacroClient, id: string): Link;
|
|
13
|
+
/** The caller's connected email links. */
|
|
14
|
+
static list(client: MacroClient): Promise<Link[]>;
|
|
15
|
+
/** The inbox's email address. */
|
|
16
|
+
readonly emailAddress: () => Promise<string>;
|
|
17
|
+
/** The email provider (e.g. `GMAIL`). */
|
|
18
|
+
readonly provider: () => Promise<"GMAIL">;
|
|
19
|
+
/** Whether this is the user's primary inbox. */
|
|
20
|
+
readonly isPrimary: () => Promise<boolean>;
|
|
21
|
+
/** Whether syncing is currently active for this inbox. */
|
|
22
|
+
readonly isSyncActive: () => Promise<boolean>;
|
|
23
|
+
/** The inbox's sync status. */
|
|
24
|
+
readonly syncStatus: () => Promise<import("../../../generated/email").SyncStatus>;
|
|
25
|
+
/** Whether the inbox needs to be re-authenticated. */
|
|
26
|
+
readonly needsReauth: () => Promise<boolean>;
|
|
27
|
+
/** The inbox's avatar URL, if any. */
|
|
28
|
+
readonly photoUrl: () => Promise<string | undefined>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ApiDraftContactInfo, GetMessageResponses } from '../../../generated/email/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
import type { Label } from './label';
|
|
5
|
+
import { Link } from './link';
|
|
6
|
+
import { EmailThread } from './thread';
|
|
7
|
+
/** The API's representation of an email message (`ParsedMessage`). */
|
|
8
|
+
export type EmailMessageData = GetMessageResponses[200];
|
|
9
|
+
/** Options for sending a fresh email message. */
|
|
10
|
+
export interface SendEmailOptions {
|
|
11
|
+
/** Recipients. */
|
|
12
|
+
to: ApiDraftContactInfo[];
|
|
13
|
+
/** Cc recipients. */
|
|
14
|
+
cc?: ApiDraftContactInfo[];
|
|
15
|
+
/** Bcc recipients. */
|
|
16
|
+
bcc?: ApiDraftContactInfo[];
|
|
17
|
+
/** Subject line. */
|
|
18
|
+
subject: string;
|
|
19
|
+
/** Plain-text body. */
|
|
20
|
+
bodyText: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A message in an email thread. A thin handle keyed by message id; the
|
|
24
|
+
* record loads lazily on first field access.
|
|
25
|
+
*/
|
|
26
|
+
export declare class EmailMessage extends MacroEntity<EmailMessageData> {
|
|
27
|
+
protected fetch(): Promise<EmailMessageData>;
|
|
28
|
+
/** A handle to a message by id. Fields load on first access. */
|
|
29
|
+
static byId(client: MacroClient, id: string): EmailMessage;
|
|
30
|
+
/** Build a message from an already-fetched record (pre-seeded, no fetch). */
|
|
31
|
+
static from(client: MacroClient, data: EmailMessageData): EmailMessage;
|
|
32
|
+
/** Send a new email message. Returns a handle when the API reports the created message's id. */
|
|
33
|
+
static send(client: MacroClient, opts: SendEmailOptions): Promise<EmailMessage | undefined>;
|
|
34
|
+
/** The message's subject line. */
|
|
35
|
+
readonly subject: () => Promise<string | undefined>;
|
|
36
|
+
/** The sender. */
|
|
37
|
+
readonly from: () => Promise<import("../../../generated/email").ContactInfo | undefined>;
|
|
38
|
+
/** The To recipients. */
|
|
39
|
+
readonly to: () => Promise<import("../../../generated/email").ContactInfo[]>;
|
|
40
|
+
/** The Cc recipients. */
|
|
41
|
+
readonly cc: () => Promise<import("../../../generated/email").ContactInfo[]>;
|
|
42
|
+
/** The Bcc recipients. */
|
|
43
|
+
readonly bcc: () => Promise<import("../../../generated/email").ContactInfo[]>;
|
|
44
|
+
/** The parsed message body, as the API returns it. */
|
|
45
|
+
readonly body: () => Promise<string | undefined>;
|
|
46
|
+
/** The provider-internal date of the message. */
|
|
47
|
+
readonly sentAt: () => Promise<string | undefined>;
|
|
48
|
+
/** Labels on this message. */
|
|
49
|
+
readonly labels: () => Promise<import("../../../generated/email").LabelInfo[]>;
|
|
50
|
+
/** The inbox (email link) this message belongs to. */
|
|
51
|
+
readonly link: () => Promise<Link>;
|
|
52
|
+
/** Add a label to this message. */
|
|
53
|
+
addLabel(label: Label): Promise<void>;
|
|
54
|
+
/** Remove a label from this message. */
|
|
55
|
+
removeLabel(label: Label): Promise<void>;
|
|
56
|
+
/** The thread this message belongs to. */
|
|
57
|
+
thread(): Promise<EmailThread>;
|
|
58
|
+
}
|