@macro-inc/sdk 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -3
- package/dist/{chunk-OGE7WXJE.js → chunk-AZJUIUIV.js} +177 -23
- package/dist/{chunk-PRUFPW3B.js → chunk-G43PLP2U.js} +144 -0
- package/dist/{chunk-7LVVPVNT.js → chunk-K4G5VO4P.js} +76 -1
- package/dist/{chunk-PAAFJYGO.js → chunk-PPR7IWZ7.js} +77 -51
- package/dist/{chunk-QVBNNMQS.js → chunk-PTX2RV2N.js} +169 -20
- package/dist/{chunk-SUINKDXF.js → chunk-PZPTJI6F.js} +42 -0
- package/dist/{chunk-7YJ6Y7HJ.js → chunk-XFA7NCJ5.js} +207 -0
- package/dist/{chunk-ZQXOHNDB.js → chunk-ZLBDES7U.js} +789 -12
- package/dist/generated/agent-fold/index.d.ts +4332 -0
- package/dist/generated/agent-fold/index.js +0 -0
- package/dist/generated/agent-harness/index.d.ts +1 -1
- package/dist/generated/agent-harness/index.js +1 -1
- package/dist/generated/agent-harness/sdk.gen.d.ts +83 -9
- package/dist/generated/agent-harness/types.gen.d.ts +1504 -160
- package/dist/generated/agent-reviews/index.d.ts +893 -0
- package/dist/generated/agent-reviews/index.js +0 -0
- package/dist/generated/auth/index.d.ts +1 -1
- package/dist/generated/auth/index.js +1 -1
- package/dist/generated/auth/sdk.gen.d.ts +108 -2
- package/dist/generated/auth/types.gen.d.ts +799 -6
- package/dist/generated/calendar/index.d.ts +1 -1
- package/dist/generated/calendar/index.js +1 -1
- package/dist/generated/calendar/sdk.gen.d.ts +63 -1
- package/dist/generated/calendar/types.gen.d.ts +1234 -5
- package/dist/generated/cognition/index.d.ts +1 -1
- package/dist/generated/cognition/index.js +1 -1
- package/dist/generated/cognition/sdk.gen.d.ts +85 -20
- package/dist/generated/cognition/types.gen.d.ts +1040 -121
- package/dist/generated/connection/index.d.ts +1 -1
- package/dist/generated/connection/index.js +15 -0
- package/dist/generated/connection/sdk.gen.d.ts +6 -1
- package/dist/generated/connection/types.gen.d.ts +18 -1
- package/dist/generated/email/index.d.ts +1 -1
- package/dist/generated/email/index.js +1 -1
- package/dist/generated/email/sdk.gen.d.ts +44 -2
- package/dist/generated/email/types.gen.d.ts +475 -10
- package/dist/generated/notification/index.d.ts +1 -1
- package/dist/generated/notification/index.js +1 -1
- package/dist/generated/notification/sdk.gen.d.ts +29 -21
- package/dist/generated/notification/types.gen.d.ts +267 -73
- package/dist/generated/properties/index.d.ts +1 -1
- package/dist/generated/properties/types.gen.d.ts +21 -1
- package/dist/generated/scheduled-action/index.d.ts +1 -1
- package/dist/generated/scheduled-action/index.js +1 -1
- package/dist/generated/scheduled-action/sdk.gen.d.ts +8 -1
- package/dist/generated/scheduled-action/types.gen.d.ts +669 -19
- package/dist/generated/search/index.d.ts +1 -1
- package/dist/generated/search/types.gen.d.ts +87 -7
- package/dist/generated/static-files/types.gen.d.ts +6 -0
- package/dist/generated/storage/index.d.ts +1 -1
- package/dist/generated/storage/index.js +1 -1
- package/dist/generated/storage/sdk.gen.d.ts +376 -13
- package/dist/generated/storage/types.gen.d.ts +12038 -5562
- package/dist/src/entities/account-managers/grant.d.ts +39 -0
- package/dist/src/entities/account-managers/namespace.d.ts +17 -0
- package/dist/src/entities/agent-sessions/activity.d.ts +39 -0
- package/dist/src/entities/agent-sessions/agent-session.d.ts +148 -6
- package/dist/src/entities/agent-sessions/code-execution.d.ts +5 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +54 -4
- package/dist/src/entities/agent-sessions/origin.d.ts +94 -0
- package/dist/src/entities/agent-sessions/review.d.ts +18 -62
- package/dist/src/entities/agent-sessions/view.d.ts +11 -0
- package/dist/src/entities/agents/namespace.d.ts +11 -2
- package/dist/src/entities/ai/namespace.d.ts +5 -1
- package/dist/src/entities/api-keys/namespace.d.ts +5 -1
- package/dist/src/entities/bots/bot.d.ts +108 -0
- package/dist/src/entities/bots/namespace.d.ts +17 -4
- package/dist/src/entities/bots/token.d.ts +34 -0
- package/dist/src/entities/calendar/booking-link.d.ts +49 -0
- package/dist/src/entities/calendar/booking-namespace.d.ts +130 -0
- package/dist/src/entities/calendar/booking-namespace.test.d.ts +1 -0
- package/dist/src/entities/calendar/booking.d.ts +77 -0
- package/dist/src/entities/calendar/calendar.d.ts +11 -4
- package/dist/src/entities/calendar/create-confirmed.test.d.ts +1 -0
- package/dist/src/entities/calendar/event.d.ts +104 -3
- package/dist/src/entities/calendar/namespace.d.ts +151 -7
- package/dist/src/entities/calendar/namespace.test.d.ts +1 -0
- package/dist/src/entities/calls/call-record.d.ts +34 -4
- package/dist/src/entities/calls/connection.d.ts +53 -0
- package/dist/src/entities/calls/errors.d.ts +15 -0
- package/dist/src/entities/calls/namespace.d.ts +21 -1
- package/dist/src/entities/calls/participant.d.ts +22 -0
- package/dist/src/entities/channels/access-request.d.ts +34 -0
- package/dist/src/entities/channels/channel.d.ts +47 -1
- package/dist/src/entities/channels/namespace.d.ts +21 -5
- package/dist/src/entities/channels/namespace.test.d.ts +1 -0
- package/dist/src/entities/channels/post.d.ts +14 -3
- package/dist/src/entities/channels/thread.d.ts +10 -1
- package/dist/src/entities/chats/chat.d.ts +7 -1
- package/dist/src/entities/chats/namespace.d.ts +14 -1
- package/dist/src/entities/connected-apps/connected-app.d.ts +107 -0
- package/dist/src/entities/connected-apps/connector.d.ts +56 -0
- package/dist/src/entities/connected-apps/namespace.d.ts +74 -0
- package/dist/src/entities/crm/company.d.ts +7 -3
- package/dist/src/entities/crm/contact.d.ts +4 -4
- package/dist/src/entities/crm/namespace.d.ts +34 -1
- package/dist/src/entities/crm/pipeline.d.ts +43 -2
- package/dist/src/entities/databases/database.d.ts +17 -0
- package/dist/src/entities/databases/namespace.d.ts +56 -0
- package/dist/src/entities/documents/ai-edit.d.ts +52 -0
- package/dist/src/entities/documents/document.d.ts +244 -5
- package/dist/src/entities/documents/namespace.d.ts +89 -4
- package/dist/src/entities/documents/office-files.d.ts +47 -0
- package/dist/src/entities/email/draft.d.ts +36 -7
- package/dist/src/entities/email/message.d.ts +99 -3
- package/dist/src/entities/email/namespace.d.ts +47 -4
- package/dist/src/entities/email/namespace.test.d.ts +1 -0
- package/dist/src/entities/email/thread.d.ts +55 -3
- package/dist/src/entities/entity-mentions/namespace.d.ts +5 -1
- package/dist/src/entities/external-chat/chat.d.ts +105 -0
- package/dist/src/entities/external-chat/message.d.ts +54 -0
- package/dist/src/entities/external-chat/namespace.d.ts +18 -0
- package/dist/src/entities/external-chat/participant.d.ts +28 -0
- package/dist/src/entities/external-chat/send.d.ts +32 -0
- package/dist/src/entities/external-chat/upload.d.ts +25 -0
- package/dist/src/entities/favorites/namespace.d.ts +5 -1
- package/dist/src/entities/foreign/namespace.d.ts +3 -0
- package/dist/src/entities/forms/form.d.ts +17 -2
- package/dist/src/entities/forms/namespace.d.ts +5 -1
- package/dist/src/entities/github-pull-requests/namespace.d.ts +5 -1
- package/dist/src/entities/harnesses/harness.d.ts +9 -0
- package/dist/src/entities/harnesses/namespace.d.ts +5 -1
- package/dist/src/entities/images/image.d.ts +77 -0
- package/dist/src/entities/images/namespace.d.ts +48 -0
- package/dist/src/entities/images/namespace.test.d.ts +1 -0
- package/dist/src/entities/initiatives/initiative.d.ts +12 -1
- package/dist/src/entities/initiatives/namespace.d.ts +15 -2
- package/dist/src/entities/me/namespace.d.ts +43 -0
- package/dist/src/entities/meetings/meeting.d.ts +5 -0
- package/dist/src/entities/meetings/namespace.d.ts +5 -1
- package/dist/src/entities/messages/thread.d.ts +1 -1
- package/dist/src/entities/notifications/namespace.d.ts +3 -0
- package/dist/src/entities/pins/namespace.d.ts +5 -1
- package/dist/src/entities/projects/namespace.d.ts +4 -1
- package/dist/src/entities/projects/project.d.ts +9 -1
- package/dist/src/entities/properties/namespace.d.ts +2 -0
- package/dist/src/entities/referrals/namespace.d.ts +33 -0
- package/dist/src/entities/routines/namespace.d.ts +42 -2
- package/dist/src/entities/routines/routine.d.ts +84 -5
- package/dist/src/entities/search/namespace.d.ts +65 -0
- package/dist/src/entities/{search.d.ts → search/options.d.ts} +8 -2
- package/dist/src/entities/search/types.d.ts +90 -0
- package/dist/src/entities/sharing/access.d.ts +14 -0
- package/dist/src/entities/tasks/namespace.d.ts +42 -3
- package/dist/src/entities/tasks/task.d.ts +47 -6
- package/dist/src/entities/teams/invite.d.ts +30 -0
- package/dist/src/entities/teams/namespace.d.ts +3 -0
- package/dist/src/entities/teams/team.d.ts +37 -0
- package/dist/src/entities/unfurls/namespace.d.ts +5 -1
- package/dist/src/entities/users/namespace.d.ts +9 -0
- package/dist/src/entities/users/user.d.ts +8 -0
- package/dist/src/entities/web/namespace.d.ts +61 -0
- package/dist/src/entities/web/namespace.test.d.ts +1 -0
- package/dist/src/entities/webhooks/namespace.d.ts +2 -0
- package/dist/src/entities/whatsapp/account.d.ts +20 -0
- package/dist/src/entities/whatsapp/chat.d.ts +54 -0
- package/dist/src/entities/whatsapp/namespace.d.ts +23 -0
- package/dist/src/entities/workspace/items.d.ts +7 -0
- package/dist/src/entities/workspace/namespace.d.ts +14 -9
- package/dist/src/entities/workspace/query.d.ts +23 -0
- package/dist/src/entities/workspace/types.d.ts +6 -3
- package/dist/src/events/hydrate/agentSession.d.ts +1 -1
- package/dist/src/events/hydrate/call.d.ts +101 -0
- package/dist/src/events/hydrate/channel.d.ts +8 -1
- package/dist/src/events/hydrate/document.d.ts +1 -1
- package/dist/src/events/hydrate/message.d.ts +1 -1
- package/dist/src/events/types.d.ts +2 -1
- package/dist/src/macro.d.ts +73 -4
- package/dist/src/macro.js +8235 -3701
- package/dist/src/mentions.d.ts +6 -1
- package/dist/src/utils/activity.d.ts +23 -2
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/unwrap.d.ts +27 -2
- package/package.json +2 -2
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AccountManagerGrant as AccountManagerGrantRecord } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
import { User } from '../users/user';
|
|
5
|
+
/** A request for an agent account to manage a person's account, and what became of it. */
|
|
6
|
+
export declare class AccountManagerGrant extends MacroEntity<AccountManagerGrantRecord> {
|
|
7
|
+
/** Construct a lazy grant handle. */
|
|
8
|
+
static byId(client: MacroClient, id: string): AccountManagerGrant;
|
|
9
|
+
/** Seed from a fetched grant. */
|
|
10
|
+
static from(client: MacroClient, record: AccountManagerGrantRecord): AccountManagerGrant;
|
|
11
|
+
protected fetch(): Promise<AccountManagerGrantRecord>;
|
|
12
|
+
/** Where the grant is: `pending`, `approved`, `active`, `declined`, `revoked`, or `expired`. */
|
|
13
|
+
readonly status: () => Promise<import("../../../generated/storage").AccountManagerGrantStatus>;
|
|
14
|
+
/** The side that asked: `managed` or `manager`. */
|
|
15
|
+
readonly requestedBy: () => Promise<import("../../../generated/storage").AccountManagerRole>;
|
|
16
|
+
/** When the request was made. */
|
|
17
|
+
readonly createdAt: () => Promise<string>;
|
|
18
|
+
/** When the pending request or unclaimed approval stops being usable. */
|
|
19
|
+
readonly expiresAt: () => Promise<string | undefined>;
|
|
20
|
+
/** When the manager claimed the token. */
|
|
21
|
+
readonly claimedAt: () => Promise<string | undefined>;
|
|
22
|
+
/** When the token was last used, to the minute. */
|
|
23
|
+
readonly lastUsedAt: () => Promise<string | undefined>;
|
|
24
|
+
/** The account being managed. */
|
|
25
|
+
managed(): Promise<User>;
|
|
26
|
+
/** The agent account doing the managing. */
|
|
27
|
+
manager(): Promise<User>;
|
|
28
|
+
/** Approve a request you didn't make. Only the side that didn't ask can. */
|
|
29
|
+
approve(): Promise<void>;
|
|
30
|
+
/** Decline a request you didn't make. Only the side that didn't ask can. */
|
|
31
|
+
decline(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Get the token for the managed account. Only the manager can, and only once:
|
|
34
|
+
* save it now. Use it as the SDK's `token` to act as the managed account.
|
|
35
|
+
*/
|
|
36
|
+
claimToken(): Promise<string>;
|
|
37
|
+
/** End the grant, stopping its token immediately. Either side can. */
|
|
38
|
+
revoke(): Promise<void>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { User } from '../users/user';
|
|
3
|
+
import { AccountManagerGrant } from './grant';
|
|
4
|
+
/** Account managers: an agent account's full access to a person's account. */
|
|
5
|
+
export declare class AccountManagerNamespace {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: MacroClient);
|
|
8
|
+
/** Construct a lazy grant handle. */
|
|
9
|
+
byId(id: string): AccountManagerGrant;
|
|
10
|
+
/** List the approved and active managers of the caller's account. */
|
|
11
|
+
list(): Promise<AccountManagerGrant[]>;
|
|
12
|
+
/** Ask to manage `user`'s account, in your DM. The caller must be an agent account and `user` a person. */
|
|
13
|
+
askToManage(user: User): Promise<AccountManagerGrant>;
|
|
14
|
+
/** Ask `user`, an agent account, to manage the caller's account, in your DM. The caller must be a person. */
|
|
15
|
+
askToBeManagedBy(user: User): Promise<AccountManagerGrant>;
|
|
16
|
+
private request;
|
|
17
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ActivityWireRow } from '../../../generated/agent-harness/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { AgentSession } from './agent-session';
|
|
4
|
+
/** Page options for recorded session activity, newest first. */
|
|
5
|
+
export type AgentActivityOptions = {
|
|
6
|
+
/** Page size, from 1 to 100; defaults to 50. */
|
|
7
|
+
limit?: number;
|
|
8
|
+
/** Restrict to one code-mode invocation belonging to this session. */
|
|
9
|
+
invocation?: AgentInvocation;
|
|
10
|
+
};
|
|
11
|
+
/** A code-mode invocation, identified independently of its runtime or retries. */
|
|
12
|
+
export declare class AgentInvocation {
|
|
13
|
+
private readonly client;
|
|
14
|
+
private readonly parent;
|
|
15
|
+
readonly id: string;
|
|
16
|
+
private constructor();
|
|
17
|
+
/** Construct a handle without making a request. */
|
|
18
|
+
static byId(client: MacroClient, session: AgentSession, id: string): AgentInvocation;
|
|
19
|
+
/** The session that owns this invocation. */
|
|
20
|
+
session(): AgentSession;
|
|
21
|
+
/** Recorded activity caused by this invocation, lazily paginated. */
|
|
22
|
+
activity(options?: Omit<AgentActivityOptions, 'invocation'>): AsyncGenerator<AgentActivity, any, any>;
|
|
23
|
+
/** Safe identity without an authenticated client. */
|
|
24
|
+
toJSON(): {
|
|
25
|
+
id: string;
|
|
26
|
+
session: {
|
|
27
|
+
id: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** An original activity-history row attributed to a session. */
|
|
32
|
+
export type AgentActivity = {
|
|
33
|
+
/** The originating invocation; absent on legacy rows. */
|
|
34
|
+
invocation?: AgentInvocation;
|
|
35
|
+
/** Original recorded metadata. Action tags and payloads are forward-compatible. */
|
|
36
|
+
snapshot: ActivityWireRow;
|
|
37
|
+
};
|
|
38
|
+
/** Iterate recorded mutations; reads and failed requests do not create history. */
|
|
39
|
+
export declare function sessionActivity(client: MacroClient, session: AgentSession, options?: AgentActivityOptions): AsyncGenerator<AgentActivity>;
|
|
@@ -1,14 +1,61 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FoldedMessage } from '../../../generated/agent-fold';
|
|
2
|
+
import type { AgentAction, AgentMode, AgentSessionChangesResponse, AgentSessionLogResponse, AgentSessionResponse, ArchiveCause, AutoArchivePreferencesBody, CodingPreferencesBody, ControlResponse, PromptAttachment, PullRequestLinkSource, SandboxSize, SessionBot } from '../../../generated/agent-harness/types.gen';
|
|
2
3
|
import type { MacroClient } from '../../utils/client';
|
|
4
|
+
import type { Agent } from '../agents/agent';
|
|
3
5
|
import { MacroEntity } from '../entity';
|
|
4
6
|
import { EntityAccess } from '../sharing/access';
|
|
5
7
|
import { type SharePermissionOptions } from '../sharing/permissions';
|
|
6
8
|
import { User } from '../users/user';
|
|
9
|
+
import { type AgentActivityOptions, AgentInvocation } from './activity';
|
|
7
10
|
import { CodeExecution } from './code-execution';
|
|
11
|
+
import { type SessionOrigin } from './origin';
|
|
8
12
|
import { QueuedAction } from './queued-action';
|
|
9
13
|
import { type CreateReviewOptions, SessionReview } from './review';
|
|
10
14
|
import { ToolApproval } from './tool-approval';
|
|
15
|
+
import { type SessionView } from './view';
|
|
16
|
+
export type { ArchiveCause };
|
|
17
|
+
/**
|
|
18
|
+
* One session's auto-archive choices. A trigger left `undefined` follows the
|
|
19
|
+
* owner's default.
|
|
20
|
+
*/
|
|
21
|
+
export type AutoArchiveOverrides = {
|
|
22
|
+
/** Archive once every linked pull request is closed and at least one merged. */
|
|
23
|
+
onPullRequestMerged?: boolean;
|
|
24
|
+
/** Archive once the runtime session backing it is deliberately closed. */
|
|
25
|
+
onRuntimeClosed?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** A session's auto-archive settings, and when a trigger archived it. */
|
|
28
|
+
export type SessionAutoArchive = {
|
|
29
|
+
/** The session's own choices. */
|
|
30
|
+
overrides: AutoArchiveOverrides;
|
|
31
|
+
/** The owner's defaults, which apply where the session has no choice. */
|
|
32
|
+
defaults: AutoArchivePreferencesBody;
|
|
33
|
+
/**
|
|
34
|
+
* When a trigger first archived the session, if one did. It stays after the
|
|
35
|
+
* session is unarchived, since a session archives itself at most once.
|
|
36
|
+
*/
|
|
37
|
+
autoArchivedAt?: string;
|
|
38
|
+
};
|
|
39
|
+
/** A session's history folded into readable messages, oldest first. */
|
|
40
|
+
export type FoldedAgentSessionLog = {
|
|
41
|
+
/** The agent that sent every agent message. */
|
|
42
|
+
bot: SessionBot;
|
|
43
|
+
/**
|
|
44
|
+
* Prompts and replies with their tool calls, results, plans, permission
|
|
45
|
+
* requests and how each turn ended.
|
|
46
|
+
*/
|
|
47
|
+
messages: FoldedMessage[];
|
|
48
|
+
};
|
|
11
49
|
/** A GitHub pull request linked to a session. */
|
|
50
|
+
/** An agent session an account registered as its work. */
|
|
51
|
+
export type RegisteredWork = {
|
|
52
|
+
/** The session registered. */
|
|
53
|
+
session: AgentSession;
|
|
54
|
+
/** The account whose work this is. */
|
|
55
|
+
account: User;
|
|
56
|
+
/** When the account registered it. */
|
|
57
|
+
registeredAt: string;
|
|
58
|
+
};
|
|
12
59
|
export type SessionPullRequest = {
|
|
13
60
|
/** The pull request's `owner/repo/pull/number` key. */
|
|
14
61
|
githubKey: string;
|
|
@@ -33,9 +80,20 @@ export type SelectableRepository = {
|
|
|
33
80
|
};
|
|
34
81
|
/** What a managed session is created with. */
|
|
35
82
|
export type CreateManagedSessionOptions = {
|
|
83
|
+
/**
|
|
84
|
+
* Persona the session runs as, from {@link AgentNamespace.list} or
|
|
85
|
+
* {@link Agent.byId}. The caller must be able to use it. Omitted, the
|
|
86
|
+
* deployment's default coding persona, or Cursor when `repoUrl` is set.
|
|
87
|
+
* Its harness, instructions and model apply unless `instructions` or
|
|
88
|
+
* `model` override them.
|
|
89
|
+
*/
|
|
90
|
+
agent?: Agent;
|
|
36
91
|
/** First prompt to deliver once the session is running. */
|
|
37
92
|
prompt?: string;
|
|
38
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Instructions the session's runtime works under, fixed for its life.
|
|
95
|
+
* Outranks the persona's when both are set.
|
|
96
|
+
*/
|
|
39
97
|
instructions?: string;
|
|
40
98
|
/**
|
|
41
99
|
* The model the session runs on, instead of its persona's. The session's
|
|
@@ -45,7 +103,8 @@ export type CreateManagedSessionOptions = {
|
|
|
45
103
|
/**
|
|
46
104
|
* The repository the session works on, as one of the URLs
|
|
47
105
|
* {@link AgentSession.repositories} lists for the caller. Omitted, the
|
|
48
|
-
* runtime chooses from the prompt. Honored for Cursor sessions
|
|
106
|
+
* runtime chooses from the prompt. Honored for Cursor sessions; omit
|
|
107
|
+
* `agent` and the session starts as Cursor.
|
|
49
108
|
*/
|
|
50
109
|
repoUrl?: string;
|
|
51
110
|
/**
|
|
@@ -64,9 +123,24 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
|
|
|
64
123
|
sharePermissions(): Promise<import("../../../generated/agent-harness").SharePermissionV2>;
|
|
65
124
|
/** Replace sharing grants. */
|
|
66
125
|
updateSharePermissions(options: SharePermissionOptions): Promise<import("../../../generated/agent-harness").SharePermissionV2>;
|
|
126
|
+
/** The session's URL in the Macro web app; hand it to users as the link. */
|
|
127
|
+
webUrl(): string;
|
|
128
|
+
/** Identity, loaded detail and {@link webUrl}, so serialized handles carry their link. */
|
|
129
|
+
toJSON(): {
|
|
130
|
+
url: string;
|
|
131
|
+
id: string;
|
|
132
|
+
detail?: AgentSessionResponse | undefined;
|
|
133
|
+
};
|
|
67
134
|
/** A handle to an agent session by id. Details load on first access. */
|
|
68
135
|
static byId(client: MacroClient, id: string): AgentSession;
|
|
69
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Create a managed session as `agent` when one is named, otherwise the
|
|
138
|
+
* deployment's default coding persona. List personas with
|
|
139
|
+
* {@link AgentNamespace.list} and construct one with {@link Agent.byId}.
|
|
140
|
+
* Unknown or inaccessible personas fail. `model` and `instructions`
|
|
141
|
+
* outrank the persona's. `repoUrl` is honored for Cursor; omit `agent`
|
|
142
|
+
* and it starts as Cursor.
|
|
143
|
+
*/
|
|
70
144
|
static createManaged(client: MacroClient, opts?: CreateManagedSessionOptions): Promise<AgentSession>;
|
|
71
145
|
/**
|
|
72
146
|
* The GitHub repositories the caller can hand a managed session: every
|
|
@@ -82,11 +156,29 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
|
|
|
82
156
|
* lists.
|
|
83
157
|
*/
|
|
84
158
|
static repositoryBranches(client: MacroClient, repoUrl: string): Promise<string[]>;
|
|
159
|
+
/**
|
|
160
|
+
* Whether `prompt` needs a chat agent or a coding agent, as the app's Auto
|
|
161
|
+
* mode decides before starting a session. Rejects when Auto mode is not
|
|
162
|
+
* enabled for the caller, the classifier is unavailable or slow, or the
|
|
163
|
+
* caller is out of AI quota.
|
|
164
|
+
*/
|
|
165
|
+
static chooseMode(client: MacroClient, prompt: string): Promise<AgentMode>;
|
|
85
166
|
protected fetch(): Promise<AgentSessionResponse>;
|
|
86
167
|
/** The session's user-facing display name. */
|
|
87
168
|
readonly name: () => Promise<string>;
|
|
88
|
-
/**
|
|
89
|
-
|
|
169
|
+
/**
|
|
170
|
+
* What opened the session: who or what started it, and what it is about.
|
|
171
|
+
* Readable by anyone who can view the session, including other agents.
|
|
172
|
+
*/
|
|
173
|
+
origin(): Promise<SessionOrigin>;
|
|
174
|
+
/**
|
|
175
|
+
* Who archived the session, making it read-only: `'user'`,
|
|
176
|
+
* `'pull_request_merged'` or `'runtime_closed'`. `undefined` while it is not
|
|
177
|
+
* archived.
|
|
178
|
+
*/
|
|
179
|
+
readonly archivedBy: () => Promise<NonNullable<ArchiveCause | null | undefined> | undefined>;
|
|
180
|
+
/** When the session was archived (RFC 3339), or `undefined` while it is not. */
|
|
181
|
+
readonly archivedAt: () => Promise<string | undefined>;
|
|
90
182
|
/** The model currently configured for the session. */
|
|
91
183
|
readonly model: () => Promise<string>;
|
|
92
184
|
/** The agent harness implementation serving the session. */
|
|
@@ -128,8 +220,35 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
|
|
|
128
220
|
* request the session's agent opened stays linked.
|
|
129
221
|
*/
|
|
130
222
|
unlinkPullRequest(url: string): Promise<void>;
|
|
223
|
+
/** This session's auto-archive settings, and when a trigger archived it. */
|
|
224
|
+
autoArchive(): Promise<SessionAutoArchive>;
|
|
225
|
+
/**
|
|
226
|
+
* Replace this session's auto-archive choices. Owner only; a trigger left
|
|
227
|
+
* `undefined` follows the owner's default.
|
|
228
|
+
*/
|
|
229
|
+
setAutoArchive(overrides: AutoArchiveOverrides): Promise<void>;
|
|
131
230
|
/** Rename this session. */
|
|
132
231
|
rename(name: string): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Register this session as the caller's work, so it shows as what the caller
|
|
234
|
+
* is working on. Requires edit access. Registering again changes nothing.
|
|
235
|
+
*
|
|
236
|
+
* Registering does not share the session: a viewer who cannot open it does
|
|
237
|
+
* not see it, so share it too with {@link AgentSession.updateSharePermissions}.
|
|
238
|
+
*
|
|
239
|
+
* The registration ends on its own when the session's pull requests finish,
|
|
240
|
+
* when it is archived, after a day without work, or after a week blocked on
|
|
241
|
+
* input. A later turn does not register it again.
|
|
242
|
+
*/
|
|
243
|
+
registerAsWork(): Promise<RegisteredWork>;
|
|
244
|
+
/**
|
|
245
|
+
* End the caller's registration of this session as its work. Doing it again
|
|
246
|
+
* changes nothing. The session itself is untouched.
|
|
247
|
+
*/
|
|
248
|
+
unregisterAsWork(): Promise<void>;
|
|
249
|
+
/** The caller's active registrations, newest first. */
|
|
250
|
+
static listRegisteredWork(client: MacroClient): Promise<RegisteredWork[]>;
|
|
251
|
+
private static registeredWork;
|
|
133
252
|
/** Archive this session, making it read-only until unarchived. */
|
|
134
253
|
archive(): Promise<void>;
|
|
135
254
|
/** Restore an archived session so it can be edited and prompted again. */
|
|
@@ -143,6 +262,10 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
|
|
|
143
262
|
static setDefaultSandboxSize(client: MacroClient, size: SandboxSize): Promise<SandboxSize>;
|
|
144
263
|
/** What the caller's new coding sessions are told to do beyond their assignment. */
|
|
145
264
|
static codingPreferences(client: MacroClient): Promise<CodingPreferencesBody>;
|
|
265
|
+
/** Which triggers archive the caller's sessions by default; each is off unless chosen. */
|
|
266
|
+
static autoArchivePreferences(client: MacroClient): Promise<AutoArchivePreferencesBody>;
|
|
267
|
+
/** Replace which triggers archive the caller's sessions by default. */
|
|
268
|
+
static setAutoArchivePreferences(client: MacroClient, preferences: AutoArchivePreferencesBody): Promise<AutoArchivePreferencesBody>;
|
|
146
269
|
/** Replace the caller's coding preferences. */
|
|
147
270
|
static setCodingPreferences(client: MacroClient, preferences: CodingPreferencesBody): Promise<CodingPreferencesBody>;
|
|
148
271
|
/**
|
|
@@ -173,6 +296,15 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
|
|
|
173
296
|
changesPatch(): Promise<string>;
|
|
174
297
|
/** Request a fresh capture and return the current state while it runs. */
|
|
175
298
|
refreshChanges(): Promise<AgentSessionChangesResponse>;
|
|
299
|
+
/**
|
|
300
|
+
* Read this session's whole history as the conversation the app renders:
|
|
301
|
+
* each user prompt and agent reply, oldest first, with tool calls and their
|
|
302
|
+
* results, plans, permission requests and how each turn ended. Works on any
|
|
303
|
+
* session the caller can view, live or finished, so it is the way to read
|
|
304
|
+
* what another agent session did. Prefer it to {@link log}, which returns
|
|
305
|
+
* raw protocol frames.
|
|
306
|
+
*/
|
|
307
|
+
foldedLog(): Promise<FoldedAgentSessionLog>;
|
|
176
308
|
/** Read the complete raw protocol log for this session. */
|
|
177
309
|
log(): Promise<AgentSessionLogResponse>;
|
|
178
310
|
/** Persisted reviews scoped to this session, with or without a code execution. */
|
|
@@ -180,10 +312,20 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
|
|
|
180
312
|
create: (input: CreateReviewOptions) => Promise<SessionReview>;
|
|
181
313
|
byId: (id: string) => SessionReview;
|
|
182
314
|
};
|
|
315
|
+
/** Views shown in this session at once, with nothing saved. */
|
|
316
|
+
readonly views: {
|
|
317
|
+
present: (view: SessionView) => Promise<void>;
|
|
318
|
+
};
|
|
183
319
|
/** Saved code executions scoped to this session. Handle construction makes no request. */
|
|
184
320
|
readonly codeExecutions: {
|
|
185
321
|
byId: (id: string) => CodeExecution;
|
|
186
322
|
};
|
|
323
|
+
/** Recorded activity caused by this session, lazily paginated newest first. */
|
|
324
|
+
activity(options?: AgentActivityOptions): AsyncGenerator<import("./activity").AgentActivity, any, any>;
|
|
325
|
+
/** Code-mode invocation handles, distinct from saved code executions. */
|
|
326
|
+
readonly invocations: {
|
|
327
|
+
byId: (id: string) => AgentInvocation;
|
|
328
|
+
};
|
|
187
329
|
/** Delete this session and any live resources it owns. */
|
|
188
330
|
delete(): Promise<void>;
|
|
189
331
|
}
|
|
@@ -3,6 +3,7 @@ import type { MacroClient } from '../../utils/client';
|
|
|
3
3
|
import { MacroEntity } from '../entity';
|
|
4
4
|
import type { AgentSession } from './agent-session';
|
|
5
5
|
import { type CreateReviewOptions, SessionReview } from './review';
|
|
6
|
+
import { type SessionView } from './view';
|
|
6
7
|
/** A saved code execution belonging to one agent session. */
|
|
7
8
|
export declare class CodeExecution extends MacroEntity<ExecutionRecord> {
|
|
8
9
|
private readonly parent;
|
|
@@ -15,6 +16,10 @@ export declare class CodeExecution extends MacroEntity<ExecutionRecord> {
|
|
|
15
16
|
create: (input: CreateReviewOptions) => Promise<SessionReview>;
|
|
16
17
|
list: () => Promise<SessionReview[]>;
|
|
17
18
|
};
|
|
19
|
+
/** Views: shown to the user at once, with nothing saved. */
|
|
20
|
+
readonly views: {
|
|
21
|
+
present: (view: SessionView) => Promise<void>;
|
|
22
|
+
};
|
|
18
23
|
/** The session this execution belongs to. */
|
|
19
24
|
session(): AgentSession;
|
|
20
25
|
/** Saved execution state. Call refresh to observe subsequent changes. */
|
|
@@ -1,14 +1,60 @@
|
|
|
1
|
-
import type { CodingPreferencesBody, SandboxSize } from '../../../generated/agent-harness/types.gen';
|
|
1
|
+
import type { AgentMode, AutoArchivePreferencesBody, CodingPreferencesBody, SandboxSize } from '../../../generated/agent-harness/types.gen';
|
|
2
2
|
import type { MacroClient } from '../../utils/client';
|
|
3
|
-
import { AgentSession, type CreateManagedSessionOptions, type SelectableRepository } from './agent-session';
|
|
4
|
-
/**
|
|
3
|
+
import { AgentSession, type CreateManagedSessionOptions, type RegisteredWork, type SelectableRepository } from './agent-session';
|
|
4
|
+
/**
|
|
5
|
+
* Entry point for coding-agent sessions.
|
|
6
|
+
*
|
|
7
|
+
* @routing Use when work happens in a code repository or with a coding agent: writing code, fixing a bug, opening or changing a pull request, or reading an agent session's history; not changes to Macro databases or documents.
|
|
8
|
+
*
|
|
9
|
+
* @agent
|
|
10
|
+
* ## Starting agent sessions
|
|
11
|
+
*
|
|
12
|
+
* Do repository and coding work yourself when you can. Start another agent session only when the user asks for one, or the work needs a repository runtime you do not have.
|
|
13
|
+
*
|
|
14
|
+
* Start sessions from ExecuteCode. macro.agents.list() returns the user's own configurable agents; choose by name and instructions, preferring an agent the user named, and pass it as `agent` to macro.agentSessions.createManaged. Never invent an agent or construct one by id. To use the default persona instead, omit `agent`. Read AgentSessionNamespace.createManaged with ReadCodeDocs before the first call.
|
|
15
|
+
*
|
|
16
|
+
* ```javascript
|
|
17
|
+
* export async function main({macro}) {
|
|
18
|
+
* const agents = await macro.agents.list();
|
|
19
|
+
* const names = await Promise.all(agents.map((agent) => agent.name()));
|
|
20
|
+
* const agent = agents[names.indexOf('Web maintainer')];
|
|
21
|
+
* if (!agent) return {data: {error: 'No agent named Web maintainer', available: names}};
|
|
22
|
+
* const session = await macro.agentSessions.createManaged({
|
|
23
|
+
* agent,
|
|
24
|
+
* repoUrl: 'https://github.com/acme/web',
|
|
25
|
+
* prompt: 'Fix the login redirect loop in acme/web. ...',
|
|
26
|
+
* });
|
|
27
|
+
* return {data: {sessionId: session.id}};
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The prompt must be self-contained: the task, repository, relevant findings and links, constraints, and expected outcome. The new session does not receive this conversation. When the outcome is a pull request, require it to be ready for review, not a draft, with CI passing before the agent finishes. Create once per task and do not retry automatically after an uncertain failure. Link the session in your reply with its id. To check on it later, create a routine; never wait or poll inside an execution.
|
|
32
|
+
*/
|
|
5
33
|
export declare class AgentSessionNamespace {
|
|
6
34
|
private readonly client;
|
|
7
35
|
constructor(client: MacroClient);
|
|
8
36
|
/** A handle to an agent session by id. Details load on first access. */
|
|
9
37
|
byId(id: string): AgentSession;
|
|
10
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Create a managed session as `agent` when one is named, otherwise the
|
|
40
|
+
* deployment's default coding persona. List personas with
|
|
41
|
+
* {@link AgentNamespace.list} and construct one with {@link Agent.byId}.
|
|
42
|
+
* Unknown or inaccessible personas fail. `model` and `instructions`
|
|
43
|
+
* outrank the persona's. `repoUrl` is honored for Cursor; omit `agent`
|
|
44
|
+
* and it starts as Cursor.
|
|
45
|
+
*/
|
|
11
46
|
createManaged(opts?: CreateManagedSessionOptions): Promise<AgentSession>;
|
|
47
|
+
/**
|
|
48
|
+
* The sessions the caller registered as its work with
|
|
49
|
+
* {@link AgentSession.registerAsWork} and can still view, newest first.
|
|
50
|
+
* Ended registrations and archived sessions are left out.
|
|
51
|
+
*/
|
|
52
|
+
registeredWork(): Promise<RegisteredWork[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Whether `prompt` needs a chat agent (`'chat'`) or a coding agent
|
|
55
|
+
* (`'code'`), as the app's Auto mode decides before starting a session.
|
|
56
|
+
*/
|
|
57
|
+
chooseMode(prompt: string): Promise<AgentMode>;
|
|
12
58
|
/**
|
|
13
59
|
* The GitHub repositories the caller can hand a managed session, with the
|
|
14
60
|
* branch each one's sessions start on by default.
|
|
@@ -31,6 +77,10 @@ export declare class AgentSessionNamespace {
|
|
|
31
77
|
setDefaultSandboxSize(size: SandboxSize): Promise<SandboxSize>;
|
|
32
78
|
/** What the caller's new coding sessions are told to do beyond their assignment. */
|
|
33
79
|
codingPreferences(): Promise<CodingPreferencesBody>;
|
|
80
|
+
/** Which triggers archive the caller's sessions by default; each is off unless chosen. */
|
|
81
|
+
autoArchivePreferences(): Promise<AutoArchivePreferencesBody>;
|
|
82
|
+
/** Replace which triggers archive the caller's sessions by default. */
|
|
83
|
+
setAutoArchivePreferences(preferences: AutoArchivePreferencesBody): Promise<AutoArchivePreferencesBody>;
|
|
34
84
|
/** Replace the caller's coding preferences. */
|
|
35
85
|
setCodingPreferences(preferences: CodingPreferencesBody): Promise<CodingPreferencesBody>;
|
|
36
86
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { TriggerOrigin } from '../../../generated/agent-harness/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Agent } from '../agents/agent';
|
|
4
|
+
import { Message } from '../channels/message';
|
|
5
|
+
import { Initiative } from '../initiatives/initiative';
|
|
6
|
+
import { Routine } from '../routines/routine';
|
|
7
|
+
import { Task } from '../tasks/task';
|
|
8
|
+
import { User } from '../users/user';
|
|
9
|
+
import { AgentSession } from './agent-session';
|
|
10
|
+
/** The first non-agent cause of an agent's work. */
|
|
11
|
+
export type SessionOriginRoot = {
|
|
12
|
+
type: 'person';
|
|
13
|
+
user: User;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'routine';
|
|
16
|
+
routine: Routine;
|
|
17
|
+
};
|
|
18
|
+
/** Where an acting agent's own work came from. */
|
|
19
|
+
export type SessionOriginLineage = {
|
|
20
|
+
type: 'session';
|
|
21
|
+
/** The session the agent acted from. */
|
|
22
|
+
session: AgentSession;
|
|
23
|
+
/** Where the chain of agents started. */
|
|
24
|
+
root: SessionOriginRoot;
|
|
25
|
+
}
|
|
26
|
+
/** An agent acted, but its session was not captured. */
|
|
27
|
+
| {
|
|
28
|
+
type: 'unattributed';
|
|
29
|
+
};
|
|
30
|
+
/** Who did something that opened a session. */
|
|
31
|
+
export type SessionOriginCaller = {
|
|
32
|
+
type: 'person';
|
|
33
|
+
user: User;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'agent';
|
|
36
|
+
/** The agent that acted. */
|
|
37
|
+
agent: Agent;
|
|
38
|
+
/** The person it acted for. */
|
|
39
|
+
onBehalfOf: User;
|
|
40
|
+
/** Where the agent's own work came from. */
|
|
41
|
+
lineage: SessionOriginLineage;
|
|
42
|
+
};
|
|
43
|
+
/** What opened a session. */
|
|
44
|
+
export type SessionOrigin =
|
|
45
|
+
/** A message mentioned the agent. `message` is set for channel messages. */
|
|
46
|
+
{
|
|
47
|
+
kind: 'mentioned';
|
|
48
|
+
by: SessionOriginCaller;
|
|
49
|
+
message?: Message;
|
|
50
|
+
}
|
|
51
|
+
/** A person wrote in their private conversation with the agent. */
|
|
52
|
+
| {
|
|
53
|
+
kind: 'conversation';
|
|
54
|
+
by: User;
|
|
55
|
+
message?: Message;
|
|
56
|
+
}
|
|
57
|
+
/** The agent was added to a task's assignees. */
|
|
58
|
+
| {
|
|
59
|
+
kind: 'task_assigned';
|
|
60
|
+
by: SessionOriginCaller;
|
|
61
|
+
task: Task;
|
|
62
|
+
}
|
|
63
|
+
/** The task joined a project, and inherited the project's agents. */
|
|
64
|
+
| {
|
|
65
|
+
kind: 'project_inherited';
|
|
66
|
+
by: SessionOriginCaller;
|
|
67
|
+
task: Task;
|
|
68
|
+
project: Initiative;
|
|
69
|
+
}
|
|
70
|
+
/** A person opened the session directly, from the composer. */
|
|
71
|
+
| {
|
|
72
|
+
kind: 'requested';
|
|
73
|
+
by: User;
|
|
74
|
+
}
|
|
75
|
+
/** A tool handed the agent work, under this user's authority. */
|
|
76
|
+
| {
|
|
77
|
+
kind: 'dispatched';
|
|
78
|
+
onBehalfOf: User;
|
|
79
|
+
}
|
|
80
|
+
/** A routine fired. */
|
|
81
|
+
| {
|
|
82
|
+
kind: 'routine';
|
|
83
|
+
routine: Routine;
|
|
84
|
+
firing: 'scheduled' | 'manual' | 'event';
|
|
85
|
+
}
|
|
86
|
+
/** Nothing recorded it: an older session, or an unclaimed warm one. */
|
|
87
|
+
| {
|
|
88
|
+
kind: 'unknown';
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* A session's origin as handles. A message handle needs its channel, which is
|
|
92
|
+
* the session's own thread channel; other parents leave `message` unset.
|
|
93
|
+
*/
|
|
94
|
+
export declare function sessionOrigin(client: MacroClient, origin: TriggerOrigin, channelId: string | undefined): SessionOrigin;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CreateCalendarEvent_Deserialize, ReviewDraft_Deserialize, ReviewDrafts_Deserialize, ReviewRecord_Serialize, ReviewTitle, SendEmail } from '../../../generated/agent-reviews';
|
|
2
2
|
import type { MacroClient } from '../../utils/client';
|
|
3
3
|
import { MacroEntity } from '../entity';
|
|
4
4
|
import type { AgentSession } from './agent-session';
|
|
5
5
|
import type { CodeExecution } from './code-execution';
|
|
6
|
+
type ReviewRecord = ReviewRecord_Serialize;
|
|
6
7
|
/** A persistent review remains actionable after the code execution ends. */
|
|
7
8
|
export declare class SessionReview extends MacroEntity<ReviewRecord> {
|
|
8
9
|
private readonly parent;
|
|
@@ -15,7 +16,7 @@ export declare class SessionReview extends MacroEntity<ReviewRecord> {
|
|
|
15
16
|
static list(client: MacroClient, execution: CodeExecution): Promise<SessionReview[]>;
|
|
16
17
|
protected fetch(): Promise<ReviewRecord>;
|
|
17
18
|
readonly title: () => Promise<string>;
|
|
18
|
-
readonly kind: () => Promise<import
|
|
19
|
+
readonly kind: () => Promise<"email" | "calendar" | "import">;
|
|
19
20
|
session(): AgentSession;
|
|
20
21
|
/** Compact reference for main()'s returned reviews array. */
|
|
21
22
|
reference(): Promise<{
|
|
@@ -35,73 +36,28 @@ export declare class ReviewItem {
|
|
|
35
36
|
private readonly snapshot;
|
|
36
37
|
private readonly actions;
|
|
37
38
|
constructor(snapshot: ReviewRecord['items'][number], actions: {
|
|
38
|
-
edit: (draft:
|
|
39
|
+
edit: (draft: ReviewDraft) => Promise<void>;
|
|
39
40
|
submit: () => Promise<void>;
|
|
40
41
|
dismiss: () => Promise<void>;
|
|
41
42
|
});
|
|
42
43
|
get id(): string;
|
|
43
44
|
get status(): ReviewRecord['items'][number]['status'];
|
|
44
|
-
get draft():
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
get draft(): ReviewRecord['items'][number]['draft'];
|
|
46
|
+
/** The action's confirmed response, `null` until it completes. */
|
|
47
|
+
get result(): ReviewRecord['items'][number]['result'];
|
|
48
|
+
/** Replace this pending draft; `kind` must match the review's. */
|
|
49
|
+
edit(draft: ReviewDraft): Promise<void>;
|
|
47
50
|
submit(): Promise<void>;
|
|
48
51
|
dismiss(): Promise<void>;
|
|
49
52
|
}
|
|
53
|
+
/** A replacement draft keyed by its review's kind. */
|
|
54
|
+
export type ReviewDraft = ReviewDraft_Deserialize;
|
|
50
55
|
/** Markdown is rendered by the ordinary email action; the UI can edit each draft. */
|
|
51
|
-
export type ReviewEmailDraft =
|
|
52
|
-
subject: string;
|
|
53
|
-
body: string;
|
|
54
|
-
to: Array<{
|
|
55
|
-
email: string;
|
|
56
|
-
name?: string | null;
|
|
57
|
-
}>;
|
|
58
|
-
cc?: Array<{
|
|
59
|
-
email: string;
|
|
60
|
-
name?: string | null;
|
|
61
|
-
}>;
|
|
62
|
-
bcc?: Array<{
|
|
63
|
-
email: string;
|
|
64
|
-
name?: string | null;
|
|
65
|
-
}>;
|
|
66
|
-
replyingToId?: string | null;
|
|
67
|
-
includeSignature?: boolean | null;
|
|
68
|
-
attachments?: Array<{
|
|
69
|
-
documentId: string;
|
|
70
|
-
}>;
|
|
71
|
-
};
|
|
72
|
-
export type CreateReviewOptions = {
|
|
73
|
-
kind: 'email';
|
|
74
|
-
title: string;
|
|
75
|
-
drafts: ReviewEmailDraft[];
|
|
76
|
-
} | {
|
|
77
|
-
kind: 'calendar';
|
|
78
|
-
title: string;
|
|
79
|
-
drafts: ReviewCalendarDraft[];
|
|
80
|
-
};
|
|
56
|
+
export type ReviewEmailDraft = SendEmail;
|
|
81
57
|
/** Calendar drafts use the existing calendar composer and creation action. */
|
|
82
|
-
export type ReviewCalendarDraft =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
email: string;
|
|
89
|
-
isOptional?: boolean;
|
|
90
|
-
}>;
|
|
91
|
-
calendarId?: string | null;
|
|
92
|
-
recurrenceLines?: string[];
|
|
93
|
-
addMacroCall?: boolean;
|
|
94
|
-
addGoogleMeet?: boolean;
|
|
95
|
-
reminders?: {
|
|
96
|
-
useDefault: boolean;
|
|
97
|
-
overrides?: Array<{
|
|
98
|
-
method: string;
|
|
99
|
-
minutes: number;
|
|
100
|
-
}>;
|
|
101
|
-
} | null;
|
|
102
|
-
eventType?: 'default' | 'out_of_office';
|
|
103
|
-
outOfOffice?: {
|
|
104
|
-
autoDeclineMode?: 'decline_none' | 'decline_all' | 'decline_new_only';
|
|
105
|
-
declineMessage?: string | null;
|
|
106
|
-
} | null;
|
|
107
|
-
};
|
|
58
|
+
export type ReviewCalendarDraft = CreateCalendarEvent_Deserialize;
|
|
59
|
+
/** A review's kind and its drafts; the execution is attached by the handle. */
|
|
60
|
+
export type CreateReviewOptions = {
|
|
61
|
+
title: ReviewTitle;
|
|
62
|
+
} & ReviewDrafts_Deserialize;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PresentView } from '../../../generated/agent-harness/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { AgentSession } from './agent-session';
|
|
4
|
+
import type { CodeExecution } from './code-execution';
|
|
5
|
+
/** A dynamic-UI view, in the format of the PresentView schema in ExecuteCode's description. */
|
|
6
|
+
export type SessionView = PresentView['view'];
|
|
7
|
+
/**
|
|
8
|
+
* Present a view in a session: a review with nothing saved. The view is
|
|
9
|
+
* checked and drawn at once; one that does not match throws with what to fix.
|
|
10
|
+
*/
|
|
11
|
+
export declare function presentView(client: MacroClient, session: AgentSession, view: SessionView, execution?: CodeExecution): Promise<void>;
|