@macro-inc/sdk 0.4.1 → 0.6.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.
Files changed (228) hide show
  1. package/README.md +316 -21
  2. package/dist/{chunk-PTX2RV2N.js → chunk-4MI52GWV.js} +93 -1
  3. package/dist/{chunk-XFA7NCJ5.js → chunk-HO75UE4Z.js} +146 -15
  4. package/dist/{chunk-P4DTO6VD.js → chunk-MCSQNZ4E.js} +6 -0
  5. package/dist/{chunk-ZLBDES7U.js → chunk-SJ6S2GAT.js} +1271 -87
  6. package/dist/{chunk-AZJUIUIV.js → chunk-SK5CMXRV.js} +100 -14
  7. package/dist/{chunk-PZPTJI6F.js → chunk-TMTYN2UK.js} +229 -2
  8. package/dist/{chunk-PPR7IWZ7.js → chunk-ZYBAKW25.js} +2 -1
  9. package/dist/generated/agent-fold/index.d.ts +202 -14
  10. package/dist/generated/agent-harness/index.d.ts +1 -1
  11. package/dist/generated/agent-harness/index.js +1 -1
  12. package/dist/generated/agent-harness/sdk.gen.d.ts +49 -2
  13. package/dist/generated/agent-harness/types.gen.d.ts +527 -9
  14. package/dist/generated/agent-reviews/index.d.ts +11 -9
  15. package/dist/generated/auth/index.d.ts +1 -1
  16. package/dist/generated/auth/index.js +1 -1
  17. package/dist/generated/auth/sdk.gen.d.ts +82 -16
  18. package/dist/generated/auth/types.gen.d.ts +768 -18
  19. package/dist/generated/calendar/types.gen.d.ts +10 -3
  20. package/dist/generated/cognition/index.d.ts +1 -1
  21. package/dist/generated/cognition/index.js +1 -1
  22. package/dist/generated/cognition/sdk.gen.d.ts +60 -6
  23. package/dist/generated/cognition/types.gen.d.ts +663 -106
  24. package/dist/generated/connection/types.gen.d.ts +1 -1
  25. package/dist/generated/contacts/index.d.ts +1 -1
  26. package/dist/generated/contacts/index.js +1 -1
  27. package/dist/generated/contacts/sdk.gen.d.ts +5 -1
  28. package/dist/generated/contacts/types.gen.d.ts +56 -0
  29. package/dist/generated/email/types.gen.d.ts +8 -2
  30. package/dist/generated/notification/index.d.ts +1 -1
  31. package/dist/generated/notification/index.js +1 -1
  32. package/dist/generated/notification/sdk.gen.d.ts +2 -1
  33. package/dist/generated/notification/types.gen.d.ts +174 -1
  34. package/dist/generated/scheduled-action/index.d.ts +1 -1
  35. package/dist/generated/scheduled-action/index.js +1 -1
  36. package/dist/generated/scheduled-action/sdk.gen.d.ts +107 -2
  37. package/dist/generated/scheduled-action/types.gen.d.ts +2451 -479
  38. package/dist/generated/search/index.d.ts +1 -1
  39. package/dist/generated/search/types.gen.d.ts +50 -11
  40. package/dist/generated/storage/index.d.ts +1 -1
  41. package/dist/generated/storage/index.js +1 -1
  42. package/dist/generated/storage/sdk.gen.d.ts +511 -18
  43. package/dist/generated/storage/types.gen.d.ts +18528 -11395
  44. package/dist/src/entities/account-managers/grant.d.ts +28 -5
  45. package/dist/src/entities/account-managers/namespace.d.ts +15 -3
  46. package/dist/src/entities/activity/entity.d.ts +7 -0
  47. package/dist/src/entities/activity/namespace.d.ts +58 -0
  48. package/dist/src/entities/activity/namespace.test.d.ts +1 -0
  49. package/dist/src/entities/agent-sessions/activity.d.ts +12 -3
  50. package/dist/src/entities/agent-sessions/agent-session.d.ts +209 -22
  51. package/dist/src/entities/agent-sessions/code-execution.d.ts +15 -3
  52. package/dist/src/entities/agent-sessions/conversation.d.ts +46 -9
  53. package/dist/src/entities/agent-sessions/namespace.d.ts +72 -16
  54. package/dist/src/entities/agent-sessions/origin.d.ts +1 -1
  55. package/dist/src/entities/agent-sessions/queued-action.d.ts +17 -3
  56. package/dist/src/entities/agent-sessions/review.d.ts +56 -5
  57. package/dist/src/entities/agent-sessions/tool-approval.d.ts +5 -1
  58. package/dist/src/entities/agents/agent.d.ts +98 -3
  59. package/dist/src/entities/agents/namespace.d.ts +52 -8
  60. package/dist/src/entities/ai/namespace.d.ts +10 -2
  61. package/dist/src/entities/api-keys/api-key.d.ts +6 -1
  62. package/dist/src/entities/api-keys/namespace.d.ts +18 -3
  63. package/dist/src/entities/bots/bot.d.ts +44 -9
  64. package/dist/src/entities/bots/namespace.d.ts +13 -1
  65. package/dist/src/entities/bots/token.d.ts +6 -1
  66. package/dist/src/entities/calendar/booking-link.d.ts +7 -1
  67. package/dist/src/entities/calendar/booking-namespace.d.ts +14 -1
  68. package/dist/src/entities/calendar/booking.d.ts +15 -0
  69. package/dist/src/entities/calendar/calendar.d.ts +10 -3
  70. package/dist/src/entities/calendar/event.d.ts +68 -9
  71. package/dist/src/entities/calendar/namespace.d.ts +91 -12
  72. package/dist/src/entities/calendar/replacement.d.ts +19 -3
  73. package/dist/src/entities/calls/call-record.d.ts +107 -17
  74. package/dist/src/entities/calls/connection.d.ts +7 -1
  75. package/dist/src/entities/calls/message.d.ts +27 -5
  76. package/dist/src/entities/calls/namespace.d.ts +15 -3
  77. package/dist/src/entities/canvases/canvas.d.ts +329 -0
  78. package/dist/src/entities/channels/access-request.d.ts +10 -2
  79. package/dist/src/entities/channels/activity.d.ts +20 -4
  80. package/dist/src/entities/channels/channel.d.ts +154 -27
  81. package/dist/src/entities/channels/labels.d.ts +41 -7
  82. package/dist/src/entities/channels/message.d.ts +105 -8
  83. package/dist/src/entities/channels/message.test.d.ts +1 -0
  84. package/dist/src/entities/channels/namespace.d.ts +37 -7
  85. package/dist/src/entities/channels/post.d.ts +13 -7
  86. package/dist/src/entities/channels/post.test.d.ts +1 -0
  87. package/dist/src/entities/channels/share.d.ts +9 -0
  88. package/dist/src/entities/channels/share.test.d.ts +1 -0
  89. package/dist/src/entities/channels/thread.d.ts +24 -4
  90. package/dist/src/entities/chats/chat.d.ts +57 -7
  91. package/dist/src/entities/chats/generation.d.ts +11 -2
  92. package/dist/src/entities/chats/namespace.d.ts +10 -2
  93. package/dist/src/entities/connected-apps/connected-app.d.ts +16 -2
  94. package/dist/src/entities/connected-apps/connector.d.ts +3 -0
  95. package/dist/src/entities/connected-apps/namespace.d.ts +18 -0
  96. package/dist/src/entities/crm/company.d.ts +64 -16
  97. package/dist/src/entities/crm/contact.d.ts +102 -14
  98. package/dist/src/entities/crm/namespace.d.ts +113 -22
  99. package/dist/src/entities/crm/pipeline-entry.d.ts +109 -0
  100. package/dist/src/entities/crm/pipeline.d.ts +292 -29
  101. package/dist/src/entities/crm/pipelines.d.ts +69 -4
  102. package/dist/src/entities/crm-email-privacy/email-privacy.d.ts +238 -0
  103. package/dist/src/entities/crm-email-privacy/email-rule-preview.d.ts +55 -0
  104. package/dist/src/entities/crm-email-privacy/email-rule-revision.d.ts +27 -0
  105. package/dist/src/entities/crm-email-privacy/email-rules.d.ts +32 -0
  106. package/dist/src/entities/databases/column.d.ts +54 -7
  107. package/dist/src/entities/databases/database.d.ts +160 -18
  108. package/dist/src/entities/databases/namespace.d.ts +40 -8
  109. package/dist/src/entities/databases/row.d.ts +2 -0
  110. package/dist/src/entities/databases/saved-query.d.ts +151 -0
  111. package/dist/src/entities/databases/table.d.ts +73 -10
  112. package/dist/src/entities/databases/view.d.ts +37 -5
  113. package/dist/src/entities/databases/webhook.d.ts +8 -1
  114. package/dist/src/entities/documents/ai-edit.d.ts +2 -0
  115. package/dist/src/entities/documents/anchor.d.ts +12 -2
  116. package/dist/src/entities/documents/comment.d.ts +29 -5
  117. package/dist/src/entities/documents/create.test.d.ts +1 -0
  118. package/dist/src/entities/documents/document.d.ts +284 -26
  119. package/dist/src/entities/documents/markdown.d.ts +25 -0
  120. package/dist/src/entities/documents/namespace.d.ts +146 -13
  121. package/dist/src/entities/documents/skills.test.d.ts +1 -0
  122. package/dist/src/entities/documents/system-skill.d.ts +21 -1
  123. package/dist/src/entities/documents/text-comment.d.ts +41 -0
  124. package/dist/src/entities/documents/text-comment.test.d.ts +1 -0
  125. package/dist/src/entities/documents/version.d.ts +5 -1
  126. package/dist/src/entities/email/attachment.d.ts +3 -0
  127. package/dist/src/entities/email/draft.d.ts +61 -9
  128. package/dist/src/entities/email/filter.d.ts +12 -2
  129. package/dist/src/entities/email/label.d.ts +7 -1
  130. package/dist/src/entities/email/link.d.ts +5 -1
  131. package/dist/src/entities/email/message.d.ts +72 -14
  132. package/dist/src/entities/email/namespace.d.ts +134 -24
  133. package/dist/src/entities/email/thread.d.ts +124 -18
  134. package/dist/src/entities/entity-mentions/mention.d.ts +6 -1
  135. package/dist/src/entities/entity-mentions/namespace.d.ts +5 -1
  136. package/dist/src/entities/entity.d.ts +65 -6
  137. package/dist/src/entities/external-chat/chat.d.ts +80 -12
  138. package/dist/src/entities/external-chat/message.d.ts +1 -1
  139. package/dist/src/entities/external-chat/namespace.d.ts +5 -1
  140. package/dist/src/entities/external-chat/send.d.ts +10 -2
  141. package/dist/src/entities/favorites/namespace.d.ts +20 -3
  142. package/dist/src/entities/foreign/foreign-entity.d.ts +5 -1
  143. package/dist/src/entities/foreign/namespace.d.ts +5 -1
  144. package/dist/src/entities/forms/form.d.ts +91 -14
  145. package/dist/src/entities/forms/namespace.d.ts +10 -2
  146. package/dist/src/entities/forms/question.d.ts +35 -7
  147. package/dist/src/entities/forms/response.d.ts +25 -5
  148. package/dist/src/entities/forms/section.d.ts +15 -3
  149. package/dist/src/entities/github-pull-requests/namespace.d.ts +5 -1
  150. package/dist/src/entities/github-pull-requests/pull-request.d.ts +15 -3
  151. package/dist/src/entities/harnesses/harness.d.ts +51 -3
  152. package/dist/src/entities/harnesses/namespace.d.ts +54 -8
  153. package/dist/src/entities/harnesses/pairing.d.ts +13 -2
  154. package/dist/src/entities/images/image.d.ts +16 -5
  155. package/dist/src/entities/images/namespace.d.ts +8 -1
  156. package/dist/src/entities/imports/entry.d.ts +65 -0
  157. package/dist/src/entities/imports/namespace.d.ts +103 -0
  158. package/dist/src/entities/imports/namespace.test.d.ts +1 -0
  159. package/dist/src/entities/initiatives/initiative.d.ts +128 -4
  160. package/dist/src/entities/initiatives/initiative.test.d.ts +1 -0
  161. package/dist/src/entities/initiatives/namespace.d.ts +71 -7
  162. package/dist/src/entities/me/namespace.d.ts +28 -3
  163. package/dist/src/entities/meetings/meeting.d.ts +46 -8
  164. package/dist/src/entities/meetings/namespace.d.ts +20 -4
  165. package/dist/src/entities/memory/namespace.d.ts +49 -0
  166. package/dist/src/entities/memory/namespace.test.d.ts +1 -0
  167. package/dist/src/entities/messages/discussion.d.ts +84 -0
  168. package/dist/src/entities/messages/thread.d.ts +19 -5
  169. package/dist/src/entities/notifications/namespace.d.ts +41 -7
  170. package/dist/src/entities/notifications/notification.d.ts +31 -6
  171. package/dist/src/entities/passwords/item.d.ts +118 -0
  172. package/dist/src/entities/passwords/namespace.d.ts +45 -0
  173. package/dist/src/entities/pins/namespace.d.ts +23 -4
  174. package/dist/src/entities/projects/namespace.d.ts +29 -0
  175. package/dist/src/entities/projects/project.d.ts +58 -7
  176. package/dist/src/entities/properties/namespace.d.ts +67 -11
  177. package/dist/src/entities/properties/namespace.test.d.ts +1 -0
  178. package/dist/src/entities/properties/property-definition.d.ts +30 -5
  179. package/dist/src/entities/properties/property-option.d.ts +14 -2
  180. package/dist/src/entities/referrals/namespace.d.ts +8 -1
  181. package/dist/src/entities/routines/namespace.d.ts +198 -14
  182. package/dist/src/entities/routines/routine.d.ts +174 -27
  183. package/dist/src/entities/routines/suggestion.d.ts +38 -0
  184. package/dist/src/entities/saved-views/namespace.d.ts +58 -0
  185. package/dist/src/entities/saved-views/saved-view.d.ts +78 -0
  186. package/dist/src/entities/search/exclusions.d.ts +6 -0
  187. package/dist/src/entities/search/namespace.d.ts +9 -3
  188. package/dist/src/entities/search/options.d.ts +3 -2
  189. package/dist/src/entities/sharing/access.d.ts +50 -9
  190. package/dist/src/entities/spreadsheets/spreadsheet.d.ts +201 -0
  191. package/dist/src/entities/suggestions/namespace.d.ts +118 -0
  192. package/dist/src/entities/suggestions/suggestion.d.ts +172 -0
  193. package/dist/src/entities/suggestions/suggestion.test.d.ts +1 -0
  194. package/dist/src/entities/tasks/namespace.d.ts +18 -5
  195. package/dist/src/entities/tasks/task.d.ts +21 -3
  196. package/dist/src/entities/teams/invite.d.ts +3 -0
  197. package/dist/src/entities/teams/namespace.d.ts +10 -2
  198. package/dist/src/entities/teams/team.d.ts +22 -2
  199. package/dist/src/entities/ui/app-link.d.ts +24 -0
  200. package/dist/src/entities/ui/namespace.d.ts +75 -0
  201. package/dist/src/entities/unfurls/namespace.d.ts +12 -2
  202. package/dist/src/entities/users/namespace.d.ts +26 -4
  203. package/dist/src/entities/users/profile-picture.d.ts +29 -0
  204. package/dist/src/entities/users/profile-picture.test.d.ts +1 -0
  205. package/dist/src/entities/users/user.d.ts +52 -1
  206. package/dist/src/entities/web/namespace.d.ts +6 -0
  207. package/dist/src/entities/webhooks/namespace.d.ts +5 -0
  208. package/dist/src/entities/webhooks/webhook.d.ts +47 -7
  209. package/dist/src/entities/whatsapp/account.d.ts +5 -1
  210. package/dist/src/entities/whatsapp/chat.d.ts +9 -1
  211. package/dist/src/entities/whatsapp/namespace.d.ts +7 -1
  212. package/dist/src/entities/workspace/namespace.d.ts +12 -4
  213. package/dist/src/entities/workspace/query.d.ts +5 -1
  214. package/dist/src/entities/workspace/query.test.d.ts +1 -0
  215. package/dist/src/events/hydrate/document.d.ts +5 -0
  216. package/dist/src/events/hydrate/user.d.ts +14 -0
  217. package/dist/src/events/receiver.d.ts +2 -0
  218. package/dist/src/events/types.d.ts +2 -1
  219. package/dist/src/macro.d.ts +59 -6
  220. package/dist/src/macro.js +18710 -10355
  221. package/dist/src/utils/activity.d.ts +2 -0
  222. package/dist/src/utils/index.d.ts +1 -1
  223. package/dist/src/utils/lazy.d.ts +20 -1
  224. package/dist/src/utils/options.d.ts +7 -0
  225. package/dist/src/utils/pagination.d.ts +16 -0
  226. package/dist/src/utils/verbs.d.ts +3 -0
  227. package/package.json +1 -1
  228. package/dist/src/entities/crm/comment.d.ts +0 -64
@@ -21,19 +21,42 @@ export declare class AccountManagerGrant extends MacroEntity<AccountManagerGrant
21
21
  readonly claimedAt: () => Promise<string | undefined>;
22
22
  /** When the token was last used, to the minute. */
23
23
  readonly lastUsedAt: () => Promise<string | undefined>;
24
- /** The account being managed. */
24
+ /**
25
+ * The account being managed.
26
+ *
27
+ * @readonly
28
+ */
25
29
  managed(): Promise<User>;
26
- /** The agent account doing the managing. */
30
+ /**
31
+ * The agent account doing the managing.
32
+ *
33
+ * @readonly
34
+ */
27
35
  manager(): Promise<User>;
28
- /** Approve a request you didn't make. Only the side that didn't ask can. */
36
+ /**
37
+ * Approve a request you didn't make. Only the side that didn't ask can.
38
+ *
39
+ * @destructive
40
+ */
29
41
  approve(): Promise<void>;
30
- /** Decline a request you didn't make. Only the side that didn't ask can. */
42
+ /**
43
+ * Decline a request you didn't make. Only the side that didn't ask can.
44
+ *
45
+ * @destructive
46
+ */
31
47
  decline(): Promise<void>;
32
48
  /**
33
49
  * Get the token for the managed account. Only the manager can, and only once:
34
50
  * save it now. Use it as the SDK's `token` to act as the managed account.
51
+ *
52
+ * @destructive
35
53
  */
36
54
  claimToken(): Promise<string>;
37
- /** End the grant, stopping its token immediately. Either side can. */
55
+ /**
56
+ * End the grant, stopping its token immediately. Either side can.
57
+ *
58
+ * @destructive
59
+ * @idempotent
60
+ */
38
61
  revoke(): Promise<void>;
39
62
  }
@@ -7,11 +7,23 @@ export declare class AccountManagerNamespace {
7
7
  constructor(client: MacroClient);
8
8
  /** Construct a lazy grant handle. */
9
9
  byId(id: string): AccountManagerGrant;
10
- /** List the approved and active managers of the caller's account. */
10
+ /**
11
+ * List the approved and active managers of the caller's account.
12
+ *
13
+ * @readonly
14
+ */
11
15
  list(): Promise<AccountManagerGrant[]>;
12
- /** Ask to manage `user`'s account, in your DM. The caller must be an agent account and `user` a person. */
16
+ /**
17
+ * Ask to manage `user`'s account, in your DM. The caller must be an agent account and `user` a person.
18
+ *
19
+ * @write
20
+ */
13
21
  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. */
22
+ /**
23
+ * Ask `user`, an agent account, to manage the caller's account, in your DM. The caller must be a person.
24
+ *
25
+ * @write
26
+ */
15
27
  askToBeManagedBy(user: User): Promise<AccountManagerGrant>;
16
28
  private request;
17
29
  }
@@ -0,0 +1,7 @@
1
+ import type { MacroClient } from '../../utils/client';
2
+ import type { EntityReference } from '../reference';
3
+ /**
4
+ * @internal A handle for an activity row's entity, or `undefined` for kinds
5
+ * addressed by more than their own id (channel messages, database rows).
6
+ */
7
+ export declare function activityEntity(client: MacroClient, type: string, id: string): EntityReference | undefined;
@@ -0,0 +1,58 @@
1
+ import type { ToolActivityAction } from '../../../generated/cognition/types.gen';
2
+ import type { MacroClient } from '../../utils/client';
3
+ import type { EntityReference } from '../reference';
4
+ import { User } from '../users/user';
5
+ /** What an activity event did; property changes carry readable `propertyName` and option labels. */
6
+ export type ActivityAction = ToolActivityAction;
7
+ /** One action attributed to the acting user. */
8
+ export interface ActivityEvent {
9
+ /** Who mechanically acted: the user, or an agent acting for them. */
10
+ actor: User;
11
+ /** The kind of item acted on, e.g. `document`, `channel`, `email_thread`. */
12
+ entityType: string;
13
+ /** The item acted on; `undefined` for kinds without a standalone handle (channel messages, database rows). */
14
+ entity: EntityReference | undefined;
15
+ /** What was done. */
16
+ action: ActivityAction;
17
+ /** When it happened, RFC 3339. */
18
+ occurredAt: string;
19
+ }
20
+ /** A bounded slice of the acting user's activity. */
21
+ export interface ActivityRange {
22
+ /** Matching events, newest first, at most 100. */
23
+ activities: ActivityEvent[];
24
+ /** More than 100 events matched; narrow the range to see the rest. */
25
+ truncated: boolean;
26
+ }
27
+ /**
28
+ * The acting user's own action history across Macro.
29
+ *
30
+ * @routing Use when reading what the user did, opened, edited or sent in a time range, or a teammate's or project's history; not everything that changed in the workspace (`macro.workspace`).
31
+ *
32
+ * @agent `macro.activity.mine` lists the user's own raw actions (opened,
33
+ * edited, sent), including actions agents took for them; `User.activity`
34
+ * reads privacy-reviewed daily, weekly and monthly summaries of the user's
35
+ * or a teammate's work; `Initiative.activity` reads one project's history.
36
+ * Answer with item names and readable property labels, never ids:
37
+ * read names through the returned handles. A range returns at most 100
38
+ * events; when `truncated` is true, split the range and read each part.
39
+ */
40
+ export declare class ActivityNamespace {
41
+ private readonly client;
42
+ constructor(client: MacroClient);
43
+ /**
44
+ * The acting user's actions in `[from, to)`, newest first, at most 100; when
45
+ * `truncated` is true, split the range and read each part.
46
+ *
47
+ * @example
48
+ * const to = new Date();
49
+ * const from = new Date(to.getTime() - 7 * 24 * 60 * 60 * 1000);
50
+ * const { activities, truncated } = await macro.activity.mine({ from, to });
51
+ *
52
+ * @readonly
53
+ */
54
+ mine(range: {
55
+ from: Date | string;
56
+ to: Date | string;
57
+ }): Promise<ActivityRange>;
58
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,9 @@
1
1
  import type { ActivityWireRow } from '../../../generated/agent-harness/types.gen';
2
+ import { type IterationOptions } from '../../utils';
2
3
  import type { MacroClient } from '../../utils/client';
3
4
  import type { AgentSession } from './agent-session';
4
5
  /** Page options for recorded session activity, newest first. */
5
- export type AgentActivityOptions = {
6
+ export type AgentActivityOptions = IterationOptions & {
6
7
  /** Page size, from 1 to 100; defaults to 50. */
7
8
  limit?: number;
8
9
  /** Restrict to one code-mode invocation belonging to this session. */
@@ -16,9 +17,17 @@ export declare class AgentInvocation {
16
17
  private constructor();
17
18
  /** Construct a handle without making a request. */
18
19
  static byId(client: MacroClient, session: AgentSession, id: string): AgentInvocation;
19
- /** The session that owns this invocation. */
20
+ /**
21
+ * The session that owns this invocation.
22
+ *
23
+ * @readonly
24
+ */
20
25
  session(): AgentSession;
21
- /** Recorded activity caused by this invocation, lazily paginated. */
26
+ /**
27
+ * Recorded activity caused by this invocation, lazily paginated; `maxItems` caps the total.
28
+ *
29
+ * @readonly
30
+ */
22
31
  activity(options?: Omit<AgentActivityOptions, 'invocation'>): AsyncGenerator<AgentActivity, any, any>;
23
32
  /** Safe identity without an authenticated client. */
24
33
  toJSON(): {
@@ -1,10 +1,12 @@
1
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
+ import type { AgentAction, AgentMode, AgentSessionChangesResponse, AgentSessionLogResponse, AgentSessionResponse, AgentUpdateKind, ArchiveCause, AutoArchivePreferencesBody, CodingPreferencesBody, ControlResponse, PromptAttachment, PullRequestLinkSource, SandboxSize, SessionBot } from '../../../generated/agent-harness/types.gen';
3
3
  import type { MacroClient } from '../../utils/client';
4
4
  import type { Agent } from '../agents/agent';
5
+ import type { Channel } from '../channels/channel';
5
6
  import { MacroEntity } from '../entity';
6
7
  import { EntityAccess } from '../sharing/access';
7
8
  import { type SharePermissionOptions } from '../sharing/permissions';
9
+ import { Task } from '../tasks/task';
8
10
  import { User } from '../users/user';
9
11
  import { type AgentActivityOptions, AgentInvocation } from './activity';
10
12
  import { CodeExecution } from './code-execution';
@@ -68,6 +70,60 @@ export type SessionPullRequest = {
68
70
  /** When it was linked. */
69
71
  createdAt: string;
70
72
  };
73
+ /** A request a session is waiting on its owner to answer, or a session gone quiet. */
74
+ export type AgentSessionUpdate = {
75
+ /** The session. */
76
+ session: AgentSession;
77
+ /** The session's name. */
78
+ sessionName: string;
79
+ /** The runtime the session runs on. */
80
+ harness: string;
81
+ /** The session's pull request, if it has one. */
82
+ pullRequestUrl?: string;
83
+ /**
84
+ * What the session waits for: `permission` to run a tool, an `elicitation`
85
+ * question, a held `tool_approval`, or `stalled` with no activity for over
86
+ * 20 minutes.
87
+ */
88
+ kind: AgentUpdateKind;
89
+ /** What is asked, or why the session looks stalled. */
90
+ summary: string;
91
+ /** When the request was made, or the session's last activity. */
92
+ since: string;
93
+ /** The choices a permission request offers; empty for other kinds. */
94
+ options: string[];
95
+ };
96
+ /** The caller's sessions waiting for them, newest activity first. */
97
+ export type AgentSessionUpdates = {
98
+ /** One entry per pending request or stalled session. */
99
+ items: AgentSessionUpdate[];
100
+ /** Whether sessions beyond the 25 most recent were left out. */
101
+ truncated: boolean;
102
+ /** Says what was left out, when truncated. */
103
+ truncationNotice?: string;
104
+ };
105
+ /** A tool call the session's runtime holds until its owner answers. */
106
+ export type PendingToolApproval = {
107
+ /** Answer it with {@link ToolApproval.answer}. */
108
+ approval: ToolApproval;
109
+ /** What a person calls the server the tool is on. */
110
+ serverName: string;
111
+ /** The tool called. */
112
+ toolName: string;
113
+ /** What it was called with. */
114
+ arguments: unknown;
115
+ /** Who prompted the turn; absent for a bot on nobody's behalf. */
116
+ requestedBy?: User;
117
+ };
118
+ /** The task a session is linked to. */
119
+ export type LinkedTask = {
120
+ /** The task. */
121
+ task: Task;
122
+ /** Put this in the pull request description so GitHub activity reaches the task. */
123
+ reference: string;
124
+ /** The session's pull request, now linked to the task, if it has one. */
125
+ pullRequestUrl?: string;
126
+ };
71
127
  /** A GitHub repository the caller can point a managed session at. */
72
128
  export type SelectableRepository = {
73
129
  /** The canonical `https://github.com/owner/name` URL, as `createManaged` takes it. */
@@ -81,8 +137,8 @@ export type SelectableRepository = {
81
137
  /** What a managed session is created with. */
82
138
  export type CreateManagedSessionOptions = {
83
139
  /**
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
140
+ * Persona the session runs as, from {@link AgentNamespace.coding} or
141
+ * {@link AgentNamespace.list}. The caller must be able to use it. Omitted, the
86
142
  * deployment's default coding persona, or Cursor when `repoUrl` is set.
87
143
  * Its harness, instructions and model apply unless `instructions` or
88
144
  * `model` override them.
@@ -117,13 +173,39 @@ export type CreateManagedSessionOptions = {
117
173
  export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
118
174
  /** Access requests and direct user grants. */
119
175
  readonly access: EntityAccess;
120
- /** Construct an approval handle scoped to this session. */
176
+ /**
177
+ * Share this agent session with a channel's current members, as posting it in the
178
+ * channel does. The caller must be in the channel and able to share the
179
+ * agent session; sharing again changes nothing.
180
+ *
181
+ * @write
182
+ * @idempotent
183
+ */
184
+ shareWithChannel(channel: Channel): Promise<void>;
185
+ /**
186
+ * Construct an approval handle scoped to this session.
187
+ *
188
+ * @readonly
189
+ */
121
190
  toolApprovalById(id: string): ToolApproval;
122
- /** Sharing configuration. */
191
+ /**
192
+ * Sharing configuration.
193
+ *
194
+ * @readonly
195
+ */
123
196
  sharePermissions(): Promise<import("../../../generated/agent-harness").SharePermissionV2>;
124
- /** Replace sharing grants. */
197
+ /**
198
+ * Replace sharing grants.
199
+ *
200
+ * @write
201
+ * @idempotent
202
+ */
125
203
  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. */
204
+ /**
205
+ * The session's URL in the Macro web app; hand it to users as the link.
206
+ *
207
+ * @readonly
208
+ */
127
209
  webUrl(): string;
128
210
  /** Identity, loaded detail and {@link webUrl}, so serialized handles carry their link. */
129
211
  toJSON(): {
@@ -143,8 +225,9 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
143
225
  */
144
226
  static createManaged(client: MacroClient, opts?: CreateManagedSessionOptions): Promise<AgentSession>;
145
227
  /**
146
- * The GitHub repositories the caller can hand a managed session: every
147
- * repository under an installation of Macro's GitHub App they or their
228
+ * List repositories available for managed sessions.
229
+ *
230
+ * Includes every repository under an installation of Macro's GitHub App they or their
148
231
  * teams made, sorted by `owner/name`. Empty when the App is installed
149
232
  * nowhere they reach.
150
233
  */
@@ -169,6 +252,8 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
169
252
  /**
170
253
  * What opened the session: who or what started it, and what it is about.
171
254
  * Readable by anyone who can view the session, including other agents.
255
+ *
256
+ * @readonly
172
257
  */
173
258
  origin(): Promise<SessionOrigin>;
174
259
  /**
@@ -205,29 +290,72 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
205
290
  * can view, oldest link first.
206
291
  */
207
292
  static forPullRequest(client: MacroClient, url: string): Promise<AgentSession[]>;
293
+ /**
294
+ * The caller's coding sessions waiting for an answer from them, or stalled
295
+ * for over 20 minutes, newest activity first. Only the 25 most recent such
296
+ * sessions are inspected.
297
+ */
298
+ static updates(client: MacroClient): Promise<AgentSessionUpdates>;
299
+ /**
300
+ * Tool calls this session's runtime holds until its owner approves them,
301
+ * oldest first. Answer each with {@link ToolApproval.answer}; only the
302
+ * owner may approve or decline. Permission requests and questions from the
303
+ * agent itself are answered with {@link control}.
304
+ *
305
+ * @readonly
306
+ */
307
+ pendingApprovals(): Promise<PendingToolApproval[]>;
308
+ /**
309
+ * Link this session to the task it works on, replacing any earlier link.
310
+ * Only the session's owner can link it, to a task they can view. The
311
+ * session's pull request, now or later, is linked to the task too.
312
+ *
313
+ * @write
314
+ */
315
+ linkTask(task: Task): Promise<LinkedTask>;
208
316
  /**
209
317
  * The GitHub pull requests linked to this session: the one its agent
210
318
  * opened and any a person linked, oldest first.
319
+ *
320
+ * @readonly
211
321
  */
212
322
  pullRequests(): Promise<SessionPullRequest[]>;
213
323
  /**
214
324
  * Link the GitHub pull request at `url` to this session. Linking one that
215
325
  * is already linked changes nothing.
326
+ *
327
+ * @write
328
+ * @idempotent
216
329
  */
217
330
  linkPullRequest(url: string): Promise<void>;
218
331
  /**
219
332
  * Unlink a GitHub pull request a person linked to this session. The pull
220
333
  * request the session's agent opened stays linked.
334
+ *
335
+ * @write
336
+ * @idempotent
221
337
  */
222
338
  unlinkPullRequest(url: string): Promise<void>;
223
- /** This session's auto-archive settings, and when a trigger archived it. */
339
+ /**
340
+ * This session's auto-archive settings, and when a trigger archived it.
341
+ *
342
+ * @readonly
343
+ */
224
344
  autoArchive(): Promise<SessionAutoArchive>;
225
345
  /**
226
346
  * Replace this session's auto-archive choices. Owner only; a trigger left
227
347
  * `undefined` follows the owner's default.
348
+ *
349
+ * @write
350
+ * @idempotent
228
351
  */
229
352
  setAutoArchive(overrides: AutoArchiveOverrides): Promise<void>;
230
- /** Rename this session. */
353
+ /**
354
+ * Rename this session.
355
+ *
356
+ * @write
357
+ * @idempotent
358
+ */
231
359
  rename(name: string): Promise<void>;
232
360
  /**
233
361
  * Register this session as the caller's work, so it shows as what the caller
@@ -239,22 +367,43 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
239
367
  * The registration ends on its own when the session's pull requests finish,
240
368
  * when it is archived, after a day without work, or after a week blocked on
241
369
  * input. A later turn does not register it again.
370
+ *
371
+ * @write
372
+ * @idempotent
242
373
  */
243
374
  registerAsWork(): Promise<RegisteredWork>;
244
375
  /**
245
376
  * End the caller's registration of this session as its work. Doing it again
246
377
  * changes nothing. The session itself is untouched.
378
+ *
379
+ * @write
380
+ * @idempotent
247
381
  */
248
382
  unregisterAsWork(): Promise<void>;
249
383
  /** The caller's active registrations, newest first. */
250
384
  static listRegisteredWork(client: MacroClient): Promise<RegisteredWork[]>;
251
385
  private static registeredWork;
252
- /** Archive this session, making it read-only until unarchived. */
386
+ /**
387
+ * Archive this session, making it read-only until unarchived.
388
+ *
389
+ * @write
390
+ * @idempotent
391
+ */
253
392
  archive(): Promise<void>;
254
- /** Restore an archived session so it can be edited and prompted again. */
393
+ /**
394
+ * Restore an archived session so it can be edited and prompted again.
395
+ *
396
+ * @write
397
+ * @idempotent
398
+ */
255
399
  unarchive(): Promise<void>;
256
400
  private setArchived;
257
- /** Resize this session's sandbox and remember the size as the owner's default. */
401
+ /**
402
+ * Resize this session's sandbox and remember the size as the owner's default.
403
+ *
404
+ * @write
405
+ * @idempotent
406
+ */
258
407
  setSandboxSize(size: SandboxSize): Promise<SandboxSize>;
259
408
  /** The caller's default sandbox size for new `@coder` sessions. */
260
409
  static defaultSandboxSize(client: MacroClient): Promise<SandboxSize>;
@@ -275,6 +424,9 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
275
424
  * action derives once it dispatches. A `queued` status means a turn was
276
425
  * running: the action waits in the session's queue ({@link queue}) and
277
426
  * dispatches when that turn ends.
427
+ *
428
+ * @destructive
429
+ * @openworld
278
430
  */
279
431
  control(action: AgentAction): Promise<ControlResponse>;
280
432
  /**
@@ -283,29 +435,55 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
283
435
  * `attachments` are files the prompt refers to, each by a URL the agent
284
436
  * can fetch (a static file service URL in practice); they reach the agent
285
437
  * as ACP `resource_link` blocks after the text.
438
+ *
439
+ * @destructive
440
+ * @openworld
286
441
  */
287
442
  prompt(text: string, attachments?: PromptAttachment[]): Promise<ControlResponse>;
288
443
  /**
289
444
  * The actions waiting to dispatch in this session, oldest first. Each can
290
445
  * be edited or removed until it dispatches.
446
+ *
447
+ * @readonly
291
448
  */
292
449
  queue(): Promise<QueuedAction[]>;
293
- /** Read the latest captured GitHub pull request changes and capture status. */
450
+ /**
451
+ * Read the latest captured GitHub pull request changes and capture status.
452
+ *
453
+ * @readonly
454
+ */
294
455
  changes(): Promise<AgentSessionChangesResponse>;
295
- /** Read the unified diff of the latest captured changeset. */
456
+ /**
457
+ * Read the unified diff of the latest captured changeset.
458
+ *
459
+ * @readonly
460
+ */
296
461
  changesPatch(): Promise<string>;
297
- /** Request a fresh capture and return the current state while it runs. */
462
+ /**
463
+ * Request a fresh capture and return the current state while it runs.
464
+ *
465
+ * @write
466
+ * @idempotent
467
+ * @openworld
468
+ */
298
469
  refreshChanges(): Promise<AgentSessionChangesResponse>;
299
470
  /**
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
471
+ * Read this session's full conversation as the app renders it.
472
+ *
473
+ * Includes each user prompt and agent reply, oldest first, with tool calls and their
302
474
  * results, plans, permission requests and how each turn ended. Works on any
303
475
  * session the caller can view, live or finished, so it is the way to read
304
476
  * what another agent session did. Prefer it to {@link log}, which returns
305
477
  * raw protocol frames.
478
+ *
479
+ * @readonly
306
480
  */
307
481
  foldedLog(): Promise<FoldedAgentSessionLog>;
308
- /** Read the complete raw protocol log for this session. */
482
+ /**
483
+ * Read the complete raw protocol log for this session.
484
+ *
485
+ * @readonly
486
+ */
309
487
  log(): Promise<AgentSessionLogResponse>;
310
488
  /** Persisted reviews scoped to this session, with or without a code execution. */
311
489
  readonly reviews: {
@@ -320,12 +498,21 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
320
498
  readonly codeExecutions: {
321
499
  byId: (id: string) => CodeExecution;
322
500
  };
323
- /** Recorded activity caused by this session, lazily paginated newest first. */
501
+ /**
502
+ * Recorded activity caused by this session, lazily paginated newest first; `maxItems` caps the total.
503
+ *
504
+ * @readonly
505
+ */
324
506
  activity(options?: AgentActivityOptions): AsyncGenerator<import("./activity").AgentActivity, any, any>;
325
507
  /** Code-mode invocation handles, distinct from saved code executions. */
326
508
  readonly invocations: {
327
509
  byId: (id: string) => AgentInvocation;
328
510
  };
329
- /** Delete this session and any live resources it owns. */
511
+ /**
512
+ * Delete this session and any live resources it owns.
513
+ *
514
+ * @destructive
515
+ * @idempotent
516
+ */
330
517
  delete(): Promise<void>;
331
518
  }
@@ -20,7 +20,11 @@ export declare class CodeExecution extends MacroEntity<ExecutionRecord> {
20
20
  readonly views: {
21
21
  present: (view: SessionView) => Promise<void>;
22
22
  };
23
- /** The session this execution belongs to. */
23
+ /**
24
+ * The session this execution belongs to.
25
+ *
26
+ * @readonly
27
+ */
24
28
  session(): AgentSession;
25
29
  /** Saved execution state. Call refresh to observe subsequent changes. */
26
30
  readonly status: () => Promise<import("../../../generated/agent-harness").ExecutionStatus>;
@@ -30,9 +34,17 @@ export declare class CodeExecution extends MacroEntity<ExecutionRecord> {
30
34
  readonly calls: () => Promise<import("../../../generated/agent-harness").RecordedToolCall[]>;
31
35
  /** Execution failure text, when present. */
32
36
  readonly error: () => Promise<string | undefined>;
33
- /** The program's returned JSON; preserves an explicit null result. */
37
+ /**
38
+ * The program's returned JSON; preserves an explicit null result.
39
+ *
40
+ * @readonly
41
+ */
34
42
  result(): Promise<unknown>;
35
- /** Reload the saved state, for example after a running execution completes. */
43
+ /**
44
+ * Reload the saved state, for example after a running execution completes.
45
+ *
46
+ * @readonly
47
+ */
36
48
  refresh(): Promise<this>;
37
49
  }
38
50
  /** JSON data returned to the model, plus references to independently saved UI. */
@@ -4,7 +4,11 @@ import { Agent } from '../agents/agent';
4
4
  import type { Channel } from '../channels/channel';
5
5
  import { Message } from '../channels/message';
6
6
  import { AgentSession } from './agent-session';
7
- /** An agent's conversation in one channel. */
7
+ /**
8
+ * An agent's conversation in one channel.
9
+ *
10
+ * @mcp-exclude Built from a listing record; no id-only reference an MCP call can pass.
11
+ */
8
12
  export declare class AgentConversation {
9
13
  private readonly client;
10
14
  /** Parent channel. */
@@ -13,17 +17,33 @@ export declare class AgentConversation {
13
17
  constructor(client: MacroClient,
14
18
  /** Parent channel. */
15
19
  channel: Channel, record: AgentConversationDto);
16
- /** The agent taking part. */
20
+ /**
21
+ * The agent taking part.
22
+ *
23
+ * @readonly
24
+ */
17
25
  agent(): Agent;
18
- /** Conversation sessions with their current flag. */
26
+ /**
27
+ * Conversation sessions with their current flag.
28
+ *
29
+ * @readonly
30
+ */
19
31
  sessions(): {
20
32
  session: AgentSession;
21
33
  isCurrent: boolean;
22
34
  createdAt: string;
23
35
  }[];
24
- /** Recorded conversation turns. */
36
+ /**
37
+ * Recorded conversation turns.
38
+ *
39
+ * @readonly
40
+ */
25
41
  turns(): ConversationTurn[];
26
- /** Start a fresh conversation from one of its sessions. */
42
+ /**
43
+ * Start a fresh conversation from one of its sessions.
44
+ *
45
+ * @write
46
+ */
27
47
  startFresh(session: AgentSession): Promise<void>;
28
48
  /** Serialize scoped identity. */
29
49
  toJSON(): {
@@ -31,7 +51,11 @@ export declare class AgentConversation {
31
51
  agentId: string;
32
52
  };
33
53
  }
34
- /** One agent conversation turn, identified by its source message. */
54
+ /**
55
+ * One agent conversation turn, identified by its source message.
56
+ *
57
+ * @mcp-exclude Built from a listing record; no id-only reference an MCP call can pass.
58
+ */
35
59
  export declare class ConversationTurn {
36
60
  private readonly client;
37
61
  /** Parent conversation. */
@@ -40,11 +64,24 @@ export declare class ConversationTurn {
40
64
  constructor(client: MacroClient,
41
65
  /** Parent conversation. */
42
66
  conversation: AgentConversation, record: AgentConversationTurnDto);
43
- /** Originating message. */
67
+ /**
68
+ * Originating message.
69
+ *
70
+ * @readonly
71
+ */
44
72
  source(): Message;
45
- /** Session that handled this turn. */
73
+ /**
74
+ * Session that handled this turn.
75
+ *
76
+ * @readonly
77
+ */
46
78
  session(): AgentSession;
47
- /** Retry with a caller persisted action nonce. Never retries automatically. */
79
+ /**
80
+ * Retry with a caller persisted action nonce. Never retries automatically.
81
+ *
82
+ * @write
83
+ * @idempotent
84
+ */
48
85
  retry(actionId: string): Promise<void>;
49
86
  /** Serialize scoped identity. */
50
87
  toJSON(): {