@macro-inc/sdk 0.0.1 → 0.2.2
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 +628 -21
- package/dist/{chunk-5HAKQN23.js → chunk-7LVVPVNT.js} +70 -57
- package/dist/{chunk-JXIQT5TH.js → chunk-7YJ6Y7HJ.js} +234 -16
- package/dist/chunk-LMJW65ML.js +836 -0
- package/dist/{chunk-SGAHIERJ.js → chunk-OGE7WXJE.js} +16 -0
- package/dist/chunk-PRUFPW3B.js +943 -0
- package/dist/{chunk-CTKR64MY.js → chunk-QVBNNMQS.js} +242 -367
- package/dist/{chunk-QNUS5BC5.js → chunk-SUINKDXF.js} +30 -84
- package/dist/{chunk-77EI4LSQ.js → chunk-ZQXOHNDB.js} +1518 -386
- 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 +174 -4
- package/dist/generated/agent-harness/types.gen.d.ts +2511 -189
- package/dist/generated/auth/index.d.ts +1 -1
- package/dist/generated/auth/index.js +1 -1
- package/dist/generated/auth/sdk.gen.d.ts +106 -8
- package/dist/generated/auth/types.gen.d.ts +1473 -116
- package/dist/generated/calendar/client/client.gen.d.ts +2 -0
- package/dist/generated/calendar/client/index.d.ts +10 -0
- package/dist/generated/calendar/client/types.gen.d.ts +120 -0
- package/dist/generated/calendar/client/utils.gen.d.ts +37 -0
- package/dist/generated/calendar/client.gen.d.ts +12 -0
- package/dist/generated/calendar/core/auth.gen.d.ts +25 -0
- package/dist/generated/calendar/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/calendar/core/params.gen.d.ts +43 -0
- package/dist/generated/calendar/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/calendar/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/calendar/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/calendar/core/types.gen.d.ts +83 -0
- package/dist/generated/calendar/core/utils.gen.d.ts +19 -0
- package/dist/generated/calendar/index.d.ts +2 -0
- package/dist/generated/calendar/index.js +6 -0
- package/dist/generated/calendar/sdk.gen.d.ts +95 -0
- package/dist/generated/calendar/types.gen.d.ts +1091 -0
- 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 +6 -1
- package/dist/generated/cognition/types.gen.d.ts +304 -36
- package/dist/generated/connection/types.gen.d.ts +1 -1
- package/dist/generated/email/index.d.ts +1 -1
- package/dist/generated/email/index.js +1 -1
- package/dist/generated/email/sdk.gen.d.ts +32 -27
- package/dist/generated/email/types.gen.d.ts +586 -409
- package/dist/generated/notification/index.d.ts +1 -1
- package/dist/generated/notification/types.gen.d.ts +384 -19
- package/dist/generated/properties/types.gen.d.ts +8 -5
- package/dist/generated/scheduled-action/index.d.ts +1 -1
- package/dist/generated/scheduled-action/index.js +3 -842
- package/dist/generated/scheduled-action/sdk.gen.d.ts +3 -1
- package/dist/generated/scheduled-action/types.gen.d.ts +277 -41
- package/dist/generated/search/index.d.ts +1 -1
- package/dist/generated/search/types.gen.d.ts +262 -43
- 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 +678 -107
- package/dist/generated/storage/types.gen.d.ts +14827 -5995
- package/dist/generated/unfurl/index.d.ts +1 -1
- package/dist/generated/unfurl/index.js +3 -832
- package/dist/generated/unfurl/types.gen.d.ts +20 -0
- package/dist/src/config.d.ts +33 -13
- package/dist/src/entities/agent-sessions/agent-session.d.ts +150 -6
- package/dist/src/entities/agent-sessions/code-execution.d.ts +43 -0
- package/dist/src/entities/agent-sessions/conversation.d.ts +54 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +23 -5
- package/dist/src/entities/agent-sessions/queued-action.d.ts +46 -0
- package/dist/src/entities/agent-sessions/review.d.ts +107 -0
- package/dist/src/entities/agent-sessions/tool-approval.d.ts +21 -0
- package/dist/src/entities/agents/agent.d.ts +47 -0
- package/dist/src/entities/agents/namespace.d.ts +13 -0
- package/dist/src/entities/ai/namespace.d.ts +24 -0
- package/dist/src/entities/api-keys/api-key.d.ts +17 -0
- package/dist/src/entities/api-keys/namespace.d.ts +18 -0
- package/dist/src/entities/calendar/calendar.d.ts +35 -0
- package/dist/src/entities/calendar/event.d.ts +123 -0
- package/dist/src/entities/calendar/event.test.d.ts +1 -0
- package/dist/src/entities/calendar/namespace.d.ts +111 -0
- package/dist/src/entities/calendar/replacement.d.ts +15 -0
- package/dist/src/entities/calls/call-record.d.ts +62 -6
- package/dist/src/entities/calls/message.d.ts +33 -0
- package/dist/src/entities/channels/activity.d.ts +24 -0
- package/dist/src/entities/channels/channel.d.ts +44 -3
- package/dist/src/entities/channels/labels.d.ts +39 -0
- package/dist/src/entities/channels/message.d.ts +9 -17
- package/dist/src/entities/channels/namespace.d.ts +6 -0
- package/dist/src/entities/channels/picture.d.ts +11 -0
- package/dist/src/entities/channels/post.d.ts +1 -1
- package/dist/src/entities/channels/thread.d.ts +5 -0
- package/dist/src/entities/chats/chat.d.ts +11 -1
- package/dist/src/entities/chats/generation.d.ts +46 -0
- package/dist/src/entities/crm/comment.d.ts +55 -34
- package/dist/src/entities/crm/company.d.ts +42 -10
- package/dist/src/entities/crm/contact.d.ts +42 -10
- package/dist/src/entities/crm/namespace.d.ts +18 -1
- package/dist/src/entities/crm/pipeline.d.ts +122 -0
- package/dist/src/entities/crm/pipelines.d.ts +14 -0
- package/dist/src/entities/databases/column.d.ts +75 -0
- package/dist/src/entities/databases/database.d.ts +272 -0
- package/dist/src/entities/databases/namespace.d.ts +21 -0
- package/dist/src/entities/databases/query.d.ts +86 -0
- package/dist/src/entities/databases/row.d.ts +27 -0
- package/dist/src/entities/databases/table.d.ts +61 -0
- package/dist/src/entities/databases/view.d.ts +40 -0
- package/dist/src/entities/databases/webhook.d.ts +32 -0
- package/dist/src/entities/documents/anchor.d.ts +29 -0
- package/dist/src/entities/documents/comment.d.ts +25 -22
- package/dist/src/entities/documents/document.d.ts +60 -12
- package/dist/src/entities/documents/namespace.d.ts +30 -0
- package/dist/src/entities/documents/version.d.ts +22 -0
- package/dist/src/entities/email/draft.d.ts +79 -0
- package/dist/src/entities/email/filter.d.ts +34 -0
- package/dist/src/entities/email/link.d.ts +6 -4
- package/dist/src/entities/email/message.d.ts +12 -1
- package/dist/src/entities/email/namespace.d.ts +34 -1
- package/dist/src/entities/email/thread.d.ts +23 -1
- package/dist/src/entities/entity-mentions/mention.d.ts +16 -0
- package/dist/src/entities/entity-mentions/namespace.d.ts +12 -0
- package/dist/src/entities/entity.d.ts +7 -0
- package/dist/src/entities/favorites/namespace.d.ts +14 -2
- package/dist/src/entities/foreign/foreign-entity.d.ts +2 -0
- package/dist/src/entities/foreign/namespace.d.ts +40 -0
- package/dist/src/entities/forms/form.d.ts +227 -0
- package/dist/src/entities/forms/namespace.d.ts +18 -0
- package/dist/src/entities/forms/question.d.ts +37 -0
- package/dist/src/entities/forms/response.d.ts +32 -0
- package/dist/src/entities/forms/section.d.ts +19 -0
- package/dist/src/entities/github-pull-requests/namespace.d.ts +12 -0
- package/dist/src/entities/github-pull-requests/pull-request.d.ts +52 -0
- package/dist/src/entities/harnesses/harness.d.ts +19 -0
- package/dist/src/entities/harnesses/namespace.d.ts +33 -0
- package/dist/src/entities/harnesses/pairing.d.ts +39 -0
- package/dist/src/entities/initiatives/initiative.d.ts +50 -0
- package/dist/src/entities/initiatives/namespace.d.ts +13 -0
- package/dist/src/entities/meetings/meeting.d.ts +38 -0
- package/dist/src/entities/meetings/namespace.d.ts +18 -0
- package/dist/src/entities/messages/thread.d.ts +101 -0
- package/dist/src/entities/notifications/notification.d.ts +6 -3
- package/dist/src/entities/notifications/notification.test.d.ts +1 -0
- package/dist/src/entities/projects/project.d.ts +7 -0
- package/dist/src/entities/reference.d.ts +82 -0
- package/dist/src/entities/routines/namespace.d.ts +15 -0
- package/dist/src/entities/routines/routine.d.ts +115 -0
- package/dist/src/entities/sharing/access.d.ts +65 -0
- package/dist/src/entities/sharing/permissions.d.ts +13 -0
- package/dist/src/entities/tasks/namespace.d.ts +4 -0
- package/dist/src/entities/tasks/task.d.ts +6 -0
- package/dist/src/entities/unfurls/namespace.d.ts +10 -0
- package/dist/src/entities/webhooks/webhook.d.ts +3 -1
- package/dist/src/entities/workspace/items.d.ts +7 -0
- package/dist/src/entities/workspace/namespace.d.ts +83 -0
- package/dist/src/entities/workspace/query.d.ts +12 -0
- package/dist/src/entities/workspace/types.d.ts +96 -0
- package/dist/src/events/hydrate/agentSession.d.ts +192 -0
- package/dist/src/events/hydrate/channel.d.ts +2 -39
- package/dist/src/events/hydrate/message.d.ts +70 -0
- package/dist/src/events/receiver.d.ts +57 -19
- package/dist/src/events/types.d.ts +3 -1
- package/dist/src/macro.d.ts +80 -3
- package/dist/src/macro.js +8832 -2784
- package/dist/src/utils/activity.d.ts +11 -0
- package/dist/src/utils/activity.test.d.ts +1 -0
- package/dist/src/utils/client.d.ts +10 -1
- package/dist/src/utils/concurrency.d.ts +5 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/pagination.d.ts +9 -4
- package/package.json +11 -3
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { MessageListItem, MessageTimelineQuery, ThreadState } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { CallRecord } from '../calls/call-record';
|
|
4
|
+
import type { CallMessage } from '../calls/message';
|
|
5
|
+
import type { Channel } from '../channels/channel';
|
|
6
|
+
import type { Message } from '../channels/message';
|
|
7
|
+
import type { CrmComment } from '../crm/comment';
|
|
8
|
+
import type { Company } from '../crm/company';
|
|
9
|
+
import type { Contact } from '../crm/contact';
|
|
10
|
+
import type { Comment } from '../documents/comment';
|
|
11
|
+
import type { Document } from '../documents/document';
|
|
12
|
+
import { MacroEntity } from '../entity';
|
|
13
|
+
import { User } from '../users/user';
|
|
14
|
+
/** A message handle accepted by a mixed timeline selector. */
|
|
15
|
+
export type TimelineMessage = Message | Comment | CrmComment | CallMessage;
|
|
16
|
+
/** Timeline selection with typed message references and camel case options. */
|
|
17
|
+
export interface TimelineOptions<TMessage extends TimelineMessage = TimelineMessage> {
|
|
18
|
+
/** Opaque continuation cursor from a previous page. */
|
|
19
|
+
cursor?: MessageTimelineQuery['cursor'];
|
|
20
|
+
/** Fetch around this message. */
|
|
21
|
+
around?: TMessage;
|
|
22
|
+
/** Restrict selection to these messages. */
|
|
23
|
+
messages?: TMessage[];
|
|
24
|
+
/** Inclusive activity lower bound. */
|
|
25
|
+
activityAfter?: string;
|
|
26
|
+
/** Exclusive activity upper bound. */
|
|
27
|
+
activityBefore?: string;
|
|
28
|
+
/** Select anchored threads. */
|
|
29
|
+
anchored?: boolean;
|
|
30
|
+
/** Page direction. */
|
|
31
|
+
direction?: MessageTimelineQuery['direction'];
|
|
32
|
+
/** Include deleted threads. */
|
|
33
|
+
includeDeletedThreads?: boolean;
|
|
34
|
+
/** Page size. */
|
|
35
|
+
limit?: number;
|
|
36
|
+
}
|
|
37
|
+
/** The typed parent of a shared message thread. */
|
|
38
|
+
export type MessageParent = {
|
|
39
|
+
type: 'channel';
|
|
40
|
+
entity: Channel;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'document';
|
|
43
|
+
entity: Document;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'crm_company';
|
|
46
|
+
entity: Company;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'crm_contact';
|
|
49
|
+
entity: Contact;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'call';
|
|
52
|
+
entity: CallRecord;
|
|
53
|
+
};
|
|
54
|
+
/** A shared message thread with resolution and deletion operations. */
|
|
55
|
+
export declare class MessageThread extends MacroEntity<ThreadState> {
|
|
56
|
+
/** The entity containing this thread. */
|
|
57
|
+
readonly parent: MessageParent;
|
|
58
|
+
/** Serialize identity with its owning resource. */
|
|
59
|
+
toJSON(): {
|
|
60
|
+
parentType: "channel" | "document" | "crm_company" | "crm_contact" | "call";
|
|
61
|
+
parentId: string;
|
|
62
|
+
id: string;
|
|
63
|
+
detail?: ThreadState | undefined;
|
|
64
|
+
};
|
|
65
|
+
private constructor();
|
|
66
|
+
/** Construct a scoped thread handle. */
|
|
67
|
+
static byId(client: MacroClient, parent: MessageParent, id: string): MessageThread;
|
|
68
|
+
private get path();
|
|
69
|
+
protected fetch(): Promise<ThreadState>;
|
|
70
|
+
/** Whether the thread is resolved. */
|
|
71
|
+
readonly resolved: () => Promise<boolean>;
|
|
72
|
+
/** Resolve the thread or detach its annotation anchor. */
|
|
73
|
+
update(options: {
|
|
74
|
+
resolved?: boolean;
|
|
75
|
+
detachAnchor?: boolean;
|
|
76
|
+
nonce?: string;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
/** Delete the entire thread, including replies. */
|
|
79
|
+
delete(nonce?: string): Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
/** A bounded mixed message/activity page with typed message handles. */
|
|
82
|
+
export declare function timeline<TMessage extends TimelineMessage>(client: MacroClient, parent: MessageParent, map: (record: MessageListItem) => TMessage, selection?: TimelineOptions<TMessage>): Promise<{
|
|
83
|
+
entries: ({
|
|
84
|
+
type: "activity";
|
|
85
|
+
activity: {
|
|
86
|
+
actor: User;
|
|
87
|
+
action: string;
|
|
88
|
+
actor_id: string;
|
|
89
|
+
id: string;
|
|
90
|
+
occurred_at: string;
|
|
91
|
+
payload?: unknown;
|
|
92
|
+
};
|
|
93
|
+
message?: undefined;
|
|
94
|
+
} | {
|
|
95
|
+
type: "message";
|
|
96
|
+
message: TMessage;
|
|
97
|
+
activity?: undefined;
|
|
98
|
+
})[];
|
|
99
|
+
nextCursor: import("../../../generated/storage").MessageCursor | undefined;
|
|
100
|
+
previousCursor: import("../../../generated/storage").MessageCursor | undefined;
|
|
101
|
+
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetTypedNotificationByIdResponses } from '../../../generated/notification/types.gen';
|
|
1
|
+
import type { GetTypedNotificationByIdResponses, NotificationState } from '../../../generated/notification/types.gen';
|
|
2
2
|
import type { MacroClient } from '../../utils/client';
|
|
3
3
|
import { MacroEntity } from '../entity';
|
|
4
4
|
import { User } from '../users/user';
|
|
@@ -15,6 +15,7 @@ export declare class Notification extends MacroEntity<NotificationDetail> {
|
|
|
15
15
|
/** The viewer's notification feed, most recent first, auto-paginated. */
|
|
16
16
|
static list(client: MacroClient, opts?: {
|
|
17
17
|
pageSize?: number;
|
|
18
|
+
states?: NotificationState[];
|
|
18
19
|
}): AsyncGenerator<Notification>;
|
|
19
20
|
/** The notification event type (e.g. `channel_mention`). */
|
|
20
21
|
readonly type: () => Promise<string>;
|
|
@@ -22,7 +23,9 @@ export declare class Notification extends MacroEntity<NotificationDetail> {
|
|
|
22
23
|
readonly createdAt: () => Promise<string>;
|
|
23
24
|
/** When the notification was last updated. */
|
|
24
25
|
readonly updatedAt: () => Promise<string>;
|
|
25
|
-
/**
|
|
26
|
+
/** The authoritative lifecycle state, independent of viewing timestamps. */
|
|
27
|
+
readonly state: () => Promise<NotificationState>;
|
|
28
|
+
/** Whether the notification is completed. */
|
|
26
29
|
readonly done: () => Promise<boolean>;
|
|
27
30
|
/** Whether the notification has been sent (delivered out of band). */
|
|
28
31
|
readonly sent: () => Promise<boolean>;
|
|
@@ -36,7 +39,7 @@ export declare class Notification extends MacroEntity<NotificationDetail> {
|
|
|
36
39
|
readonly sender: () => Promise<User | undefined>;
|
|
37
40
|
/** The typed notification payload (tagged by event type). */
|
|
38
41
|
readonly metadata: () => Promise<import("../../../generated/notification").NotifEvent>;
|
|
39
|
-
/** Whether the notification
|
|
42
|
+
/** Whether the notification is acknowledged (seen or done). */
|
|
40
43
|
seen(): Promise<boolean>;
|
|
41
44
|
/** Mark the notification as seen. */
|
|
42
45
|
markSeen(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { GetProjectContentHandlerResponses, GetProjectHandlerResponses } from '../../../generated/storage/types.gen';
|
|
2
2
|
import type { MacroClient } from '../../utils/client';
|
|
3
3
|
import { PropertiedEntity } from '../entity';
|
|
4
|
+
import { EntityAccess } from '../sharing/access';
|
|
4
5
|
type ProjectDetail = GetProjectHandlerResponses[200]['data']['projectMetadata'];
|
|
5
6
|
type ProjectItem = GetProjectContentHandlerResponses[200]['data'][number]['item'];
|
|
6
7
|
/** A Macro project: a folder-like container for documents, chats, and subprojects. */
|
|
7
8
|
export declare class Project extends PropertiedEntity<ProjectDetail> {
|
|
9
|
+
/** Read this project's sharing configuration. */
|
|
10
|
+
sharePermissions(): Promise<import("../../../generated/storage").SharePermissionV2>;
|
|
11
|
+
/** Read the caller's effective access level. */
|
|
12
|
+
accessLevel(): Promise<"view" | "comment" | "edit" | "owner">;
|
|
13
|
+
/** Access requests and direct user grants. */
|
|
14
|
+
readonly access: EntityAccess;
|
|
8
15
|
/** Favorites identify projects as `project`. */
|
|
9
16
|
readonly entityType = "project";
|
|
10
17
|
/** The properties service identifies projects as `PROJECT`. */
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { AgentSession } from './agent-sessions/agent-session';
|
|
2
|
+
import type { CalendarEvent } from './calendar/event';
|
|
3
|
+
import type { CallRecord } from './calls/call-record';
|
|
4
|
+
import type { Channel } from './channels/channel';
|
|
5
|
+
import type { Message } from './channels/message';
|
|
6
|
+
import type { Chat } from './chats/chat';
|
|
7
|
+
import type { Company } from './crm/company';
|
|
8
|
+
import type { Contact } from './crm/contact';
|
|
9
|
+
import type { CrmPipeline } from './crm/pipeline';
|
|
10
|
+
import type { Database } from './databases/database';
|
|
11
|
+
import type { DatabaseRow } from './databases/row';
|
|
12
|
+
import type { Document } from './documents/document';
|
|
13
|
+
import type { EmailThread } from './email/thread';
|
|
14
|
+
import type { ForeignEntity } from './foreign/foreign-entity';
|
|
15
|
+
import type { Form } from './forms/form';
|
|
16
|
+
import type { Initiative } from './initiatives/initiative';
|
|
17
|
+
import type { Project } from './projects/project';
|
|
18
|
+
import type { Routine } from './routines/routine';
|
|
19
|
+
import type { Team } from './teams/team';
|
|
20
|
+
import type { User } from './users/user';
|
|
21
|
+
/** Typed entity references accepted by cross-resource APIs. */
|
|
22
|
+
export type EntityReference = {
|
|
23
|
+
type: 'user';
|
|
24
|
+
entity: User;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'team';
|
|
27
|
+
entity: Team;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'document';
|
|
30
|
+
entity: Document;
|
|
31
|
+
} | {
|
|
32
|
+
type: 'chat';
|
|
33
|
+
entity: Chat;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'channel';
|
|
36
|
+
entity: Channel;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'channel_message';
|
|
39
|
+
entity: Message;
|
|
40
|
+
} | {
|
|
41
|
+
type: 'project';
|
|
42
|
+
entity: Project;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'email_thread';
|
|
45
|
+
entity: EmailThread;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'calendar_event';
|
|
48
|
+
entity: CalendarEvent;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'call';
|
|
51
|
+
entity: CallRecord;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'foreign_entity';
|
|
54
|
+
entity: ForeignEntity;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'crm_company';
|
|
57
|
+
entity: Company;
|
|
58
|
+
} | {
|
|
59
|
+
type: 'crm_contact';
|
|
60
|
+
entity: Contact;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'crm_pipeline';
|
|
63
|
+
entity: CrmPipeline;
|
|
64
|
+
} | {
|
|
65
|
+
type: 'agent_session';
|
|
66
|
+
entity: AgentSession;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'scheduled_action';
|
|
69
|
+
entity: Routine;
|
|
70
|
+
} | {
|
|
71
|
+
type: 'initiative';
|
|
72
|
+
entity: Initiative;
|
|
73
|
+
} | {
|
|
74
|
+
type: 'database';
|
|
75
|
+
entity: Database;
|
|
76
|
+
} | {
|
|
77
|
+
type: 'database_row';
|
|
78
|
+
entity: DatabaseRow;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'form';
|
|
81
|
+
entity: Form;
|
|
82
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import { Routine, type RoutineOptions } from './routine';
|
|
3
|
+
/** Scheduled and event-triggered routines. */
|
|
4
|
+
export declare class RoutineNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: MacroClient);
|
|
7
|
+
/** Construct a lazy routine handle. */
|
|
8
|
+
byId(id: string): Routine;
|
|
9
|
+
/** Create an agent routine. */
|
|
10
|
+
create(options: RoutineOptions): Promise<Routine>;
|
|
11
|
+
/** List routines, optionally including event triggers. */
|
|
12
|
+
list(options?: {
|
|
13
|
+
includeEvents?: boolean;
|
|
14
|
+
}): Promise<Routine[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { ActionTrigger, EventFilter, RoutineModelId, RoutineTrigger, ScheduledActionResponse } from '../../../generated/scheduled-action/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { AgentSession } from '../agent-sessions/agent-session';
|
|
4
|
+
import type { Agent } from '../agents/agent';
|
|
5
|
+
import { Chat } from '../chats/chat';
|
|
6
|
+
import { MacroEntity } from '../entity';
|
|
7
|
+
import type { EntityReference } from '../reference';
|
|
8
|
+
import { User } from '../users/user';
|
|
9
|
+
/** An event selector references resources by typed handles. */
|
|
10
|
+
export type RoutineEventFilter = Omit<EventFilter, 'ids' | 'condition'> & {
|
|
11
|
+
/** Resource selectors for these events. Omit to match all resources. */
|
|
12
|
+
entities?: EntityReference[];
|
|
13
|
+
/** Optional yes/no condition on the triggering content. */
|
|
14
|
+
condition?: string;
|
|
15
|
+
};
|
|
16
|
+
/** One schedule or set of event selectors. */
|
|
17
|
+
export type SingleRoutineTrigger = Extract<RoutineTrigger, {
|
|
18
|
+
type: 'cron';
|
|
19
|
+
}> | {
|
|
20
|
+
type: 'events';
|
|
21
|
+
filters: RoutineEventFilter[];
|
|
22
|
+
};
|
|
23
|
+
/** One or multiple routine triggers. */
|
|
24
|
+
export type RoutineTriggerOptions = SingleRoutineTrigger | {
|
|
25
|
+
type: 'multiple';
|
|
26
|
+
triggers: SingleRoutineTrigger[];
|
|
27
|
+
};
|
|
28
|
+
/** Configuration of an agent routine. */
|
|
29
|
+
export interface RoutineOptions {
|
|
30
|
+
/** Display name. */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Schedules or Macro events that start the routine. */
|
|
33
|
+
trigger: RoutineTriggerOptions;
|
|
34
|
+
/** Instructions delivered to the agent. */
|
|
35
|
+
prompt: string;
|
|
36
|
+
/** Original user instructions. */
|
|
37
|
+
userPrompt: string;
|
|
38
|
+
/** Model override. */
|
|
39
|
+
model?: RoutineModelId;
|
|
40
|
+
/** Agent to run the task. */
|
|
41
|
+
agent?: Agent;
|
|
42
|
+
/** Whether triggers can start executions. Defaults to true on creation. */
|
|
43
|
+
enabled?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** A scheduled or event-triggered agent task. */
|
|
46
|
+
export declare class Routine extends MacroEntity<ScheduledActionResponse> {
|
|
47
|
+
/** Construct a lazy routine handle. */
|
|
48
|
+
static byId(client: MacroClient, id: string): Routine;
|
|
49
|
+
/** Seed a handle from a server record. */
|
|
50
|
+
static from(client: MacroClient, record: ScheduledActionResponse): Routine;
|
|
51
|
+
protected fetch(): Promise<ScheduledActionResponse>;
|
|
52
|
+
/** Routine name. */
|
|
53
|
+
readonly name: () => Promise<string>;
|
|
54
|
+
/** Configured triggers. */
|
|
55
|
+
readonly trigger: () => Promise<ActionTrigger>;
|
|
56
|
+
/** Whether the routine is enabled. */
|
|
57
|
+
readonly enabled: () => Promise<boolean>;
|
|
58
|
+
/** Next scheduled execution. */
|
|
59
|
+
readonly nextRunAt: () => Promise<string | undefined>;
|
|
60
|
+
/** Configuration revision. */
|
|
61
|
+
readonly revision: () => Promise<number>;
|
|
62
|
+
/** Routine owner. */
|
|
63
|
+
readonly owner: () => Promise<User>;
|
|
64
|
+
/** Replace the routine's task and trigger configuration. */
|
|
65
|
+
update(options: RoutineOptions): Promise<void>;
|
|
66
|
+
/** Enable or disable triggering. */
|
|
67
|
+
setEnabled(enabled: boolean): Promise<void>;
|
|
68
|
+
/** Start an execution immediately and return its transcript handle if available. */
|
|
69
|
+
execute(): Promise<Chat | AgentSession | undefined>;
|
|
70
|
+
/** Completed executions, with their routine scoped identity. */
|
|
71
|
+
history(): Promise<RoutineExecution[]>;
|
|
72
|
+
/** Delete the routine. */
|
|
73
|
+
delete(): Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
/** A completed routine execution, as recorded by the service. */
|
|
76
|
+
export declare class RoutineExecution {
|
|
77
|
+
/** Parent routine. */
|
|
78
|
+
readonly routine: Routine;
|
|
79
|
+
/** Execution snapshot. */
|
|
80
|
+
readonly record: import('../../../generated/scheduled-action/types.gen').ActionExecutionRecord;
|
|
81
|
+
constructor(
|
|
82
|
+
/** Parent routine. */
|
|
83
|
+
routine: Routine,
|
|
84
|
+
/** Execution snapshot. */
|
|
85
|
+
record: import('../../../generated/scheduled-action/types.gen').ActionExecutionRecord);
|
|
86
|
+
/** Execution identity, when assigned. */
|
|
87
|
+
get id(): string | undefined;
|
|
88
|
+
/** Serialize without the authenticated client. */
|
|
89
|
+
toJSON(): {
|
|
90
|
+
action_id: string;
|
|
91
|
+
created_at: string;
|
|
92
|
+
end_time: string;
|
|
93
|
+
id?: string | null;
|
|
94
|
+
is_success: boolean;
|
|
95
|
+
resource_id?: string | null;
|
|
96
|
+
result: {
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
};
|
|
99
|
+
start_time: string;
|
|
100
|
+
routine: string;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/** Translate typed routine options into the generated wire contract. */
|
|
104
|
+
export declare function routineBody(options: RoutineOptions): {
|
|
105
|
+
kind: "Agent";
|
|
106
|
+
name: string;
|
|
107
|
+
enabled: boolean | undefined;
|
|
108
|
+
trigger: ActionTrigger;
|
|
109
|
+
task: {
|
|
110
|
+
agent?: null | import("../../../generated/scheduled-action").AgentTaskAgent;
|
|
111
|
+
model?: null | RoutineModelId;
|
|
112
|
+
prompt: string;
|
|
113
|
+
user_prompt: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { AccessLevel, AccessRequest as RequestRecord, ResolveRequest, ShareEntityType } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
import { User } from '../users/user';
|
|
5
|
+
/** Access requests and direct grants scoped to a shareable entity. */
|
|
6
|
+
export declare class EntityAccess {
|
|
7
|
+
private readonly client;
|
|
8
|
+
private readonly entityType;
|
|
9
|
+
private readonly entity;
|
|
10
|
+
constructor(client: MacroClient, entityType: ShareEntityType, entity: {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
});
|
|
13
|
+
private get path();
|
|
14
|
+
/** A page of access requests, including the caller's own request and review rights. */
|
|
15
|
+
state(offset?: number): Promise<{
|
|
16
|
+
accessLevel: AccessLevel | undefined;
|
|
17
|
+
canReview: boolean;
|
|
18
|
+
owner: User | undefined;
|
|
19
|
+
pendingCount: number;
|
|
20
|
+
supportedLevels: AccessLevel[];
|
|
21
|
+
nextOffset: number | undefined;
|
|
22
|
+
mine: AccessRequest | undefined;
|
|
23
|
+
requests: AccessRequest[];
|
|
24
|
+
}>;
|
|
25
|
+
/** Request access, optionally naming the revision of an earlier request. */
|
|
26
|
+
submit(requestedLevel: AccessLevel, revision?: number): Promise<AccessRequest>;
|
|
27
|
+
/** Cancel the caller's own request at its observed revision. */
|
|
28
|
+
cancel(revision: number): Promise<void>;
|
|
29
|
+
/** Direct grants expressed as user handles. */
|
|
30
|
+
direct(): Promise<{
|
|
31
|
+
user: User;
|
|
32
|
+
accessLevel: AccessLevel;
|
|
33
|
+
}[]>;
|
|
34
|
+
/** Grant direct access, or remove it by omitting the access level. */
|
|
35
|
+
grant(user: User, accessLevel?: AccessLevel): Promise<void>;
|
|
36
|
+
/** Remove one user's direct grant. */
|
|
37
|
+
remove(user: User): Promise<void>;
|
|
38
|
+
/** Resolve a request belonging to this entity at an observed revision. */
|
|
39
|
+
resolve(request: AccessRequest, resolution: ResolveRequest): Promise<RequestRecord>;
|
|
40
|
+
/** Serialize the entity reference without credentials. */
|
|
41
|
+
toJSON(): {
|
|
42
|
+
entity_type: ShareEntityType;
|
|
43
|
+
entity_id: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** One access request; resolutions preserve optimistic concurrency. */
|
|
47
|
+
export declare class AccessRequest extends MacroEntity<RequestRecord> {
|
|
48
|
+
/** Entity access surface owning the request. */
|
|
49
|
+
readonly access: EntityAccess;
|
|
50
|
+
private resolvedRecord?;
|
|
51
|
+
private constructor();
|
|
52
|
+
/** Seed a request from a state or submission response. */
|
|
53
|
+
static from(client: MacroClient, access: EntityAccess, record: RequestRecord): AccessRequest;
|
|
54
|
+
protected fetch(): Promise<RequestRecord>;
|
|
55
|
+
/** Request revision. */
|
|
56
|
+
readonly revision: () => Promise<number>;
|
|
57
|
+
/** Current request state. */
|
|
58
|
+
readonly status: () => Promise<import("../../../generated/storage").RequestStatus>;
|
|
59
|
+
/** Requested access. */
|
|
60
|
+
readonly requestedLevel: () => Promise<AccessLevel>;
|
|
61
|
+
/** Requesting user. */
|
|
62
|
+
readonly requester: () => Promise<User>;
|
|
63
|
+
/** Approve with an access level, or decline by omitting it. */
|
|
64
|
+
resolve(grantedLevel?: AccessLevel): Promise<void>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AccessLevel, UpdateChannelSharePermission, UpdateSharePermissionRequestV2 } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { Channel } from '../channels/channel';
|
|
3
|
+
/** Sharing updates reference channels by handle. Null clears the corresponding grant collection. */
|
|
4
|
+
export type SharePermissionOptions = Omit<UpdateSharePermissionRequestV2, 'channelSharePermissions'> & {
|
|
5
|
+
/** Channel grants to create or replace. */
|
|
6
|
+
channelSharePermissions?: {
|
|
7
|
+
channel: Channel;
|
|
8
|
+
accessLevel?: AccessLevel;
|
|
9
|
+
operation: UpdateChannelSharePermission['operation'];
|
|
10
|
+
}[] | null;
|
|
11
|
+
};
|
|
12
|
+
/** Convert sharing options into the generated backend contract. */
|
|
13
|
+
export declare function sharePermissionBody(options: SharePermissionOptions): UpdateSharePermissionRequestV2;
|
|
@@ -16,6 +16,10 @@ export declare class TaskNamespace {
|
|
|
16
16
|
team?: Team;
|
|
17
17
|
shareWithTeam?: boolean;
|
|
18
18
|
}): Promise<Task>;
|
|
19
|
+
/**
|
|
20
|
+
* The tasks the GitHub pull request at `url` references, oldest link first.
|
|
21
|
+
*/
|
|
22
|
+
forPullRequest(url: string): Promise<Task[]>;
|
|
19
23
|
/** Search tasks by name and content, most relevant first, auto-paginated. */
|
|
20
24
|
search(query: string, opts?: SearchOpts): AsyncGenerator<Task>;
|
|
21
25
|
}
|
|
@@ -22,6 +22,12 @@ export declare class Task extends Document {
|
|
|
22
22
|
team?: Team;
|
|
23
23
|
shareWithTeam?: boolean;
|
|
24
24
|
}): Promise<Task>;
|
|
25
|
+
/**
|
|
26
|
+
* The tasks the GitHub pull request at `url` references (as `MACRO-<id>` in
|
|
27
|
+
* its text, branch, or comments), oldest link first. Empty when the caller
|
|
28
|
+
* cannot see the pull request; tasks the caller cannot open still appear.
|
|
29
|
+
*/
|
|
30
|
+
static forPullRequest(client: MacroClient, url: string): Promise<Task[]>;
|
|
25
31
|
/**
|
|
26
32
|
* Whether the task is completed (its Status property is "Completed");
|
|
27
33
|
* `undefined` if the document is not a task.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
/** URL metadata lookup. */
|
|
3
|
+
export declare class UnfurlNamespace {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: MacroClient);
|
|
6
|
+
/** Read title, description and preview metadata for a URL. */
|
|
7
|
+
get(url: string): Promise<import("../../../generated/unfurl").GetUnfurlResponse>;
|
|
8
|
+
/** Read metadata for multiple URLs in one request. */
|
|
9
|
+
bulk(urls: string[]): Promise<import("../../../generated/unfurl").GetUnfurlBulkResponse>;
|
|
10
|
+
}
|
|
@@ -14,7 +14,9 @@ import { User } from '../users/user';
|
|
|
14
14
|
* The signing secret is only ever returned once, from {@link create}; it's
|
|
15
15
|
* exposed there as {@link Webhook.signingSecret}. Save it — patches, gets,
|
|
16
16
|
* and `byId` handles never carry it again — and pass it to
|
|
17
|
-
* `MacroOpts.webhookSecret` so `
|
|
17
|
+
* `MacroOpts.webhookSecret` so `macro.events.webhook()` can verify
|
|
18
|
+
* deliveries. Live SSE via `macro.events.listen()` does not use a
|
|
19
|
+
* persisted webhook or signing secret.
|
|
18
20
|
*/
|
|
19
21
|
export declare class Webhook extends MacroEntity<WebhookRecord> {
|
|
20
22
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SoupApiItem, SoupProperty } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { WorkspaceItem, WorkspaceTag } from './types';
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare function properties(item: SoupApiItem): SoupProperty[];
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function workspaceItem(client: MacroClient, item: SoupApiItem, tagMap: Map<string, WorkspaceTag>): WorkspaceItem;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { WorkspaceItem, WorkspaceListOptions, WorkspacePage, WorkspacePageOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Browse recent workspace documents (including tasks), chats, projects, email,
|
|
5
|
+
* channels, message threads, calls, calendar events and foreign entities.
|
|
6
|
+
* Queries run with the caller's normal access permissions. Use search namespaces
|
|
7
|
+
* to find specific names/content; use this namespace for activity and filtered lists.
|
|
8
|
+
*
|
|
9
|
+
* Each item has an existing `entity` handle plus a generated API `snapshot` for
|
|
10
|
+
* reading metadata without another request. Calendar snapshots contain event time
|
|
11
|
+
* and conference details; calendar handles support operations, but cannot fetch
|
|
12
|
+
* event details by ID. Use `snapshot.data` when the listing already has your data.
|
|
13
|
+
*
|
|
14
|
+
* @example Important emails from a particular accessible inbox
|
|
15
|
+
* ```js
|
|
16
|
+
* const page = await macro.workspace.page({
|
|
17
|
+
* emailPreset: 'signal', inbox: 'team@example.com', limit: 20,
|
|
18
|
+
* });
|
|
19
|
+
* const evidence = page.items.map(item => ({
|
|
20
|
+
* id: item.id, ...item.type === 'email' ? {
|
|
21
|
+
* subject: item.subject, snippet: item.snippet, sender: item.senderEmail,
|
|
22
|
+
* } : {},
|
|
23
|
+
* }));
|
|
24
|
+
* // Report page.hasMore; this bounded page is not exhaustive.
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Tasks assigned to me, completed and updated within a time window
|
|
28
|
+
* ```js
|
|
29
|
+
* const owner = await macro.myPrincipalId();
|
|
30
|
+
* const tasks = macro.workspace.list({
|
|
31
|
+
* includeTypes: ['document'],
|
|
32
|
+
* df: {'&': [{l: {dst: 'task'}}, {'&': [
|
|
33
|
+
* {l: {ua: {gte: '2026-10-14T00:00:00Z'}}},
|
|
34
|
+
* {l: {ua: {lt: '2026-10-15T00:00:00Z'}}},
|
|
35
|
+
* ]}]},
|
|
36
|
+
* propf: {'&': [
|
|
37
|
+
* {l: {pd: '00000001-0000-0000-0000-000000000002', et: 'TASK',
|
|
38
|
+
* v: {so: '00000001-0000-0000-0002-000000000004'}}},
|
|
39
|
+
* {l: {pd: '00000001-0000-0000-0000-000000000001', et: 'TASK',
|
|
40
|
+
* v: {er: owner}}},
|
|
41
|
+
* ]},
|
|
42
|
+
* });
|
|
43
|
+
* for await (const item of tasks) {
|
|
44
|
+
* if (item.type === 'document') console.log(item.id, item.name);
|
|
45
|
+
* }
|
|
46
|
+
* // updatedAt is not a completion timestamp; describe this scope accurately.
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example Personal and team tags, favorites, and early stopping
|
|
50
|
+
* ```js
|
|
51
|
+
* let count = 0;
|
|
52
|
+
* for await (const item of macro.workspace.list({
|
|
53
|
+
* favoritesOnly: true, sortBy: 'recently_viewed',
|
|
54
|
+
* tags: [{label: 'Launch', scope: 'team'}], tagsMatch: 'all',
|
|
55
|
+
* })) {
|
|
56
|
+
* console.log(item.type, item.id, item.tags);
|
|
57
|
+
* if (++count === 10) break; // No subsequent page is fetched.
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* A single filter is `{l: {dst: 'task'}}`; `&` and `|` require exactly two
|
|
62
|
+
* expressions, nested for larger combinations.
|
|
63
|
+
* Advanced filters use the normal API AST. `df` accepts `dst` (task/skill/snippet),
|
|
64
|
+
* `ft`, `id`, `pid`, and `ca`/`ua` timestamp bounds. `ef` supports `Sender`,
|
|
65
|
+
* `Recipient`, `Read`, `ThreadId`, `ca`/`ua`/`va`; `chanf` supports `ChannelId`,
|
|
66
|
+
* `Sender`, `IsParticipant`; `cthf` supports `ChannelId`/`ThreadId`; `callf`
|
|
67
|
+
* supports `CallId`/`ChannelId`/`Speaker`/`Attended`. Filters remain server-validated.
|
|
68
|
+
* CRM, agent sessions, initiatives and database rows have their own namespaces
|
|
69
|
+
* and are not included in this browsing surface.
|
|
70
|
+
*/
|
|
71
|
+
export declare class WorkspaceNamespace {
|
|
72
|
+
private readonly client;
|
|
73
|
+
constructor(client: MacroClient);
|
|
74
|
+
/** One bounded page. Resume using nextCursor and the same options. */
|
|
75
|
+
page(options?: WorkspacePageOptions): Promise<WorkspacePage>;
|
|
76
|
+
/**
|
|
77
|
+
* Lazy automatic pagination. `limit` is a page size, not a total result limit.
|
|
78
|
+
* Break a `for await` loop to stop; no speculative next page is fetched.
|
|
79
|
+
* Tag/inbox resolution is reused within this iterator.
|
|
80
|
+
*/
|
|
81
|
+
list(options?: WorkspaceListOptions): AsyncGenerator<WorkspaceItem>;
|
|
82
|
+
private fetch;
|
|
83
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PostSoupAstRequest } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { WorkspaceListOptions, WorkspaceTag } from './types';
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare class WorkspaceQuery {
|
|
6
|
+
private readonly client;
|
|
7
|
+
private tagSets?;
|
|
8
|
+
constructor(client: MacroClient);
|
|
9
|
+
private sets;
|
|
10
|
+
tagMap(): Promise<Map<string, WorkspaceTag>>;
|
|
11
|
+
body(options: WorkspaceListOptions): Promise<PostSoupAstRequest>;
|
|
12
|
+
}
|