@macro-inc/sdk 0.4.0 → 0.5.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 (193) hide show
  1. package/CALLS.md +82 -0
  2. package/README.md +176 -7
  3. package/dist/chunk-2IVGAIGQ.js +80 -0
  4. package/dist/{chunk-PTX2RV2N.js → chunk-3SW6QVDV.js} +33 -0
  5. package/dist/{chunk-XFA7NCJ5.js → chunk-GT5EUYOR.js} +13 -15
  6. package/dist/{chunk-ZLBDES7U.js → chunk-HIW6KU2I.js} +490 -4
  7. package/dist/{chunk-AZJUIUIV.js → chunk-J2VK3NOR.js} +56 -0
  8. package/dist/{chunk-PZPTJI6F.js → chunk-UVJLWLSJ.js} +41 -2
  9. package/dist/generated/agent-fold/index.d.ts +8 -6
  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 +17 -1
  13. package/dist/generated/agent-harness/types.gen.d.ts +188 -3
  14. package/dist/generated/auth/index.js +1 -1
  15. package/dist/generated/auth/sdk.gen.d.ts +13 -15
  16. package/dist/generated/auth/types.gen.d.ts +36 -17
  17. package/dist/generated/cognition/index.d.ts +1 -1
  18. package/dist/generated/cognition/index.js +1 -1
  19. package/dist/generated/cognition/sdk.gen.d.ts +38 -1
  20. package/dist/generated/cognition/types.gen.d.ts +473 -4
  21. package/dist/generated/connection/types.gen.d.ts +1 -1
  22. package/dist/generated/notification/index.d.ts +1 -1
  23. package/dist/generated/notification/types.gen.d.ts +36 -1
  24. package/dist/generated/scheduled-action/index.d.ts +1 -1
  25. package/dist/generated/scheduled-action/index.js +1 -1
  26. package/dist/generated/scheduled-action/sdk.gen.d.ts +17 -2
  27. package/dist/generated/scheduled-action/types.gen.d.ts +642 -104
  28. package/dist/generated/storage/index.d.ts +1 -1
  29. package/dist/generated/storage/index.js +1 -1
  30. package/dist/generated/storage/sdk.gen.d.ts +204 -5
  31. package/dist/generated/storage/types.gen.d.ts +3969 -374
  32. package/dist/src/calls/browser.d.ts +14 -0
  33. package/dist/src/calls/browser.js +102 -0
  34. package/dist/src/calls/common.d.ts +18 -0
  35. package/dist/src/calls/node.d.ts +24 -0
  36. package/dist/src/calls/node.js +145 -0
  37. package/dist/src/calls/telemetry.d.ts +5 -0
  38. package/dist/src/entities/account-managers/grant.d.ts +28 -5
  39. package/dist/src/entities/account-managers/namespace.d.ts +15 -3
  40. package/dist/src/entities/activity/entity.d.ts +7 -0
  41. package/dist/src/entities/activity/namespace.d.ts +58 -0
  42. package/dist/src/entities/activity/namespace.test.d.ts +1 -0
  43. package/dist/src/entities/agent-sessions/activity.d.ts +10 -2
  44. package/dist/src/entities/agent-sessions/agent-session.d.ts +193 -18
  45. package/dist/src/entities/agent-sessions/code-execution.d.ts +15 -3
  46. package/dist/src/entities/agent-sessions/conversation.d.ts +46 -9
  47. package/dist/src/entities/agent-sessions/namespace.d.ts +71 -16
  48. package/dist/src/entities/agent-sessions/origin.d.ts +1 -1
  49. package/dist/src/entities/agent-sessions/queued-action.d.ts +17 -3
  50. package/dist/src/entities/agent-sessions/review.d.ts +55 -4
  51. package/dist/src/entities/agent-sessions/tool-approval.d.ts +5 -1
  52. package/dist/src/entities/agents/agent.d.ts +98 -3
  53. package/dist/src/entities/agents/namespace.d.ts +52 -8
  54. package/dist/src/entities/ai/namespace.d.ts +9 -1
  55. package/dist/src/entities/api-keys/api-key.d.ts +6 -1
  56. package/dist/src/entities/api-keys/namespace.d.ts +15 -3
  57. package/dist/src/entities/bots/bot.d.ts +38 -6
  58. package/dist/src/entities/bots/namespace.d.ts +13 -1
  59. package/dist/src/entities/bots/token.d.ts +6 -1
  60. package/dist/src/entities/calendar/booking-link.d.ts +7 -1
  61. package/dist/src/entities/calendar/booking-namespace.d.ts +13 -0
  62. package/dist/src/entities/calendar/booking.d.ts +15 -0
  63. package/dist/src/entities/calendar/calendar.d.ts +7 -1
  64. package/dist/src/entities/calendar/event.d.ts +59 -9
  65. package/dist/src/entities/calendar/namespace.d.ts +88 -10
  66. package/dist/src/entities/calendar/replacement.d.ts +19 -3
  67. package/dist/src/entities/calls/call-record.d.ts +90 -14
  68. package/dist/src/entities/calls/connection.d.ts +7 -1
  69. package/dist/src/entities/calls/message.d.ts +27 -5
  70. package/dist/src/entities/calls/namespace.d.ts +15 -3
  71. package/dist/src/entities/canvases/canvas.d.ts +324 -0
  72. package/dist/src/entities/channels/access-request.d.ts +10 -2
  73. package/dist/src/entities/channels/activity.d.ts +20 -4
  74. package/dist/src/entities/channels/channel.d.ts +130 -23
  75. package/dist/src/entities/channels/labels.d.ts +41 -7
  76. package/dist/src/entities/channels/message.d.ts +41 -7
  77. package/dist/src/entities/channels/namespace.d.ts +28 -3
  78. package/dist/src/entities/channels/post.test.d.ts +1 -0
  79. package/dist/src/entities/channels/thread.d.ts +19 -3
  80. package/dist/src/entities/chats/chat.d.ts +56 -6
  81. package/dist/src/entities/chats/generation.d.ts +11 -2
  82. package/dist/src/entities/chats/namespace.d.ts +10 -2
  83. package/dist/src/entities/connected-apps/connected-app.d.ts +14 -1
  84. package/dist/src/entities/connected-apps/connector.d.ts +3 -0
  85. package/dist/src/entities/connected-apps/namespace.d.ts +16 -0
  86. package/dist/src/entities/crm/company.d.ts +63 -15
  87. package/dist/src/entities/crm/contact.d.ts +60 -13
  88. package/dist/src/entities/crm/namespace.d.ts +85 -11
  89. package/dist/src/entities/crm/pipeline-entry.d.ts +102 -0
  90. package/dist/src/entities/crm/pipeline.d.ts +271 -27
  91. package/dist/src/entities/crm/pipelines.d.ts +39 -2
  92. package/dist/src/entities/databases/column.d.ts +54 -7
  93. package/dist/src/entities/databases/database.d.ts +126 -12
  94. package/dist/src/entities/databases/namespace.d.ts +16 -4
  95. package/dist/src/entities/databases/row.d.ts +2 -0
  96. package/dist/src/entities/databases/saved-query.d.ts +145 -0
  97. package/dist/src/entities/databases/table.d.ts +64 -10
  98. package/dist/src/entities/databases/view.d.ts +27 -5
  99. package/dist/src/entities/databases/webhook.d.ts +8 -1
  100. package/dist/src/entities/documents/ai-edit.d.ts +2 -0
  101. package/dist/src/entities/documents/anchor.d.ts +12 -2
  102. package/dist/src/entities/documents/comment.d.ts +29 -5
  103. package/dist/src/entities/documents/document.d.ts +243 -20
  104. package/dist/src/entities/documents/markdown.d.ts +25 -0
  105. package/dist/src/entities/documents/namespace.d.ts +132 -13
  106. package/dist/src/entities/documents/skills.test.d.ts +1 -0
  107. package/dist/src/entities/documents/system-skill.d.ts +21 -1
  108. package/dist/src/entities/documents/text-comment.d.ts +41 -0
  109. package/dist/src/entities/documents/text-comment.test.d.ts +1 -0
  110. package/dist/src/entities/documents/version.d.ts +5 -1
  111. package/dist/src/entities/email/attachment.d.ts +3 -0
  112. package/dist/src/entities/email/draft.d.ts +61 -9
  113. package/dist/src/entities/email/filter.d.ts +12 -2
  114. package/dist/src/entities/email/label.d.ts +7 -1
  115. package/dist/src/entities/email/link.d.ts +5 -1
  116. package/dist/src/entities/email/message.d.ts +55 -8
  117. package/dist/src/entities/email/namespace.d.ts +127 -21
  118. package/dist/src/entities/email/thread.d.ts +99 -16
  119. package/dist/src/entities/entity-mentions/mention.d.ts +6 -1
  120. package/dist/src/entities/entity-mentions/namespace.d.ts +5 -1
  121. package/dist/src/entities/entity.d.ts +56 -6
  122. package/dist/src/entities/external-chat/chat.d.ts +62 -11
  123. package/dist/src/entities/external-chat/message.d.ts +1 -1
  124. package/dist/src/entities/external-chat/namespace.d.ts +5 -1
  125. package/dist/src/entities/external-chat/send.d.ts +10 -2
  126. package/dist/src/entities/favorites/namespace.d.ts +20 -3
  127. package/dist/src/entities/foreign/foreign-entity.d.ts +5 -1
  128. package/dist/src/entities/foreign/namespace.d.ts +4 -0
  129. package/dist/src/entities/forms/form.d.ts +71 -13
  130. package/dist/src/entities/forms/namespace.d.ts +10 -2
  131. package/dist/src/entities/forms/question.d.ts +35 -7
  132. package/dist/src/entities/forms/response.d.ts +25 -5
  133. package/dist/src/entities/forms/section.d.ts +15 -3
  134. package/dist/src/entities/github-pull-requests/namespace.d.ts +5 -1
  135. package/dist/src/entities/github-pull-requests/pull-request.d.ts +15 -3
  136. package/dist/src/entities/harnesses/harness.d.ts +51 -3
  137. package/dist/src/entities/harnesses/namespace.d.ts +53 -7
  138. package/dist/src/entities/harnesses/pairing.d.ts +12 -2
  139. package/dist/src/entities/images/image.d.ts +16 -5
  140. package/dist/src/entities/images/namespace.d.ts +8 -1
  141. package/dist/src/entities/initiatives/initiative.d.ts +117 -3
  142. package/dist/src/entities/initiatives/initiative.test.d.ts +1 -0
  143. package/dist/src/entities/initiatives/namespace.d.ts +69 -7
  144. package/dist/src/entities/me/namespace.d.ts +27 -2
  145. package/dist/src/entities/meetings/meeting.d.ts +45 -8
  146. package/dist/src/entities/meetings/namespace.d.ts +20 -4
  147. package/dist/src/entities/memory/namespace.d.ts +49 -0
  148. package/dist/src/entities/memory/namespace.test.d.ts +1 -0
  149. package/dist/src/entities/messages/discussion.d.ts +84 -0
  150. package/dist/src/entities/messages/thread.d.ts +19 -5
  151. package/dist/src/entities/notifications/namespace.d.ts +40 -7
  152. package/dist/src/entities/notifications/notification.d.ts +29 -5
  153. package/dist/src/entities/pins/namespace.d.ts +23 -4
  154. package/dist/src/entities/projects/namespace.d.ts +29 -0
  155. package/dist/src/entities/projects/project.d.ts +47 -6
  156. package/dist/src/entities/properties/namespace.d.ts +67 -11
  157. package/dist/src/entities/properties/namespace.test.d.ts +1 -0
  158. package/dist/src/entities/properties/property-definition.d.ts +30 -5
  159. package/dist/src/entities/properties/property-option.d.ts +14 -2
  160. package/dist/src/entities/referrals/namespace.d.ts +8 -1
  161. package/dist/src/entities/routines/namespace.d.ts +128 -7
  162. package/dist/src/entities/routines/routine.d.ts +111 -25
  163. package/dist/src/entities/saved-views/namespace.d.ts +57 -0
  164. package/dist/src/entities/saved-views/saved-view.d.ts +78 -0
  165. package/dist/src/entities/search/namespace.d.ts +5 -1
  166. package/dist/src/entities/sharing/access.d.ts +50 -9
  167. package/dist/src/entities/spreadsheets/spreadsheet.d.ts +201 -0
  168. package/dist/src/entities/tasks/namespace.d.ts +13 -1
  169. package/dist/src/entities/tasks/task.d.ts +7 -1
  170. package/dist/src/entities/teams/invite.d.ts +3 -0
  171. package/dist/src/entities/teams/namespace.d.ts +10 -2
  172. package/dist/src/entities/teams/team.d.ts +7 -0
  173. package/dist/src/entities/unfurls/namespace.d.ts +12 -2
  174. package/dist/src/entities/users/namespace.d.ts +19 -1
  175. package/dist/src/entities/users/profile-picture.d.ts +29 -0
  176. package/dist/src/entities/users/profile-picture.test.d.ts +1 -0
  177. package/dist/src/entities/users/user.d.ts +52 -1
  178. package/dist/src/entities/web/namespace.d.ts +6 -0
  179. package/dist/src/entities/webhooks/namespace.d.ts +5 -0
  180. package/dist/src/entities/webhooks/webhook.d.ts +47 -7
  181. package/dist/src/entities/whatsapp/account.d.ts +5 -1
  182. package/dist/src/entities/whatsapp/chat.d.ts +9 -1
  183. package/dist/src/entities/whatsapp/namespace.d.ts +7 -1
  184. package/dist/src/entities/workspace/namespace.d.ts +7 -1
  185. package/dist/src/entities/workspace/query.d.ts +5 -1
  186. package/dist/src/events/hydrate/user.d.ts +14 -0
  187. package/dist/src/events/receiver.d.ts +2 -0
  188. package/dist/src/events/types.d.ts +2 -1
  189. package/dist/src/macro.d.ts +33 -5
  190. package/dist/src/macro.js +15635 -10132
  191. package/dist/src/utils/lazy.d.ts +7 -1
  192. package/package.json +32 -5
  193. package/dist/src/entities/crm/comment.d.ts +0 -64
@@ -1,10 +1,11 @@
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
5
  import { MacroEntity } from '../entity';
6
6
  import { EntityAccess } from '../sharing/access';
7
7
  import { type SharePermissionOptions } from '../sharing/permissions';
8
+ import { Task } from '../tasks/task';
8
9
  import { User } from '../users/user';
9
10
  import { type AgentActivityOptions, AgentInvocation } from './activity';
10
11
  import { CodeExecution } from './code-execution';
@@ -68,6 +69,60 @@ export type SessionPullRequest = {
68
69
  /** When it was linked. */
69
70
  createdAt: string;
70
71
  };
72
+ /** A request a session is waiting on its owner to answer, or a session gone quiet. */
73
+ export type AgentSessionUpdate = {
74
+ /** The session. */
75
+ session: AgentSession;
76
+ /** The session's name. */
77
+ sessionName: string;
78
+ /** The runtime the session runs on. */
79
+ harness: string;
80
+ /** The session's pull request, if it has one. */
81
+ pullRequestUrl?: string;
82
+ /**
83
+ * What the session waits for: `permission` to run a tool, an `elicitation`
84
+ * question, a held `tool_approval`, or `stalled` with no activity for over
85
+ * 20 minutes.
86
+ */
87
+ kind: AgentUpdateKind;
88
+ /** What is asked, or why the session looks stalled. */
89
+ summary: string;
90
+ /** When the request was made, or the session's last activity. */
91
+ since: string;
92
+ /** The choices a permission request offers; empty for other kinds. */
93
+ options: string[];
94
+ };
95
+ /** The caller's sessions waiting for them, newest activity first. */
96
+ export type AgentSessionUpdates = {
97
+ /** One entry per pending request or stalled session. */
98
+ items: AgentSessionUpdate[];
99
+ /** Whether sessions beyond the 25 most recent were left out. */
100
+ truncated: boolean;
101
+ /** Says what was left out, when truncated. */
102
+ truncationNotice?: string;
103
+ };
104
+ /** A tool call the session's runtime holds until its owner answers. */
105
+ export type PendingToolApproval = {
106
+ /** Answer it with {@link ToolApproval.answer}. */
107
+ approval: ToolApproval;
108
+ /** What a person calls the server the tool is on. */
109
+ serverName: string;
110
+ /** The tool called. */
111
+ toolName: string;
112
+ /** What it was called with. */
113
+ arguments: unknown;
114
+ /** Who prompted the turn; absent for a bot on nobody's behalf. */
115
+ requestedBy?: User;
116
+ };
117
+ /** The task a session is linked to. */
118
+ export type LinkedTask = {
119
+ /** The task. */
120
+ task: Task;
121
+ /** Put this in the pull request description so GitHub activity reaches the task. */
122
+ reference: string;
123
+ /** The session's pull request, now linked to the task, if it has one. */
124
+ pullRequestUrl?: string;
125
+ };
71
126
  /** A GitHub repository the caller can point a managed session at. */
72
127
  export type SelectableRepository = {
73
128
  /** The canonical `https://github.com/owner/name` URL, as `createManaged` takes it. */
@@ -81,8 +136,8 @@ export type SelectableRepository = {
81
136
  /** What a managed session is created with. */
82
137
  export type CreateManagedSessionOptions = {
83
138
  /**
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
139
+ * Persona the session runs as, from {@link AgentNamespace.coding} or
140
+ * {@link AgentNamespace.list}. The caller must be able to use it. Omitted, the
86
141
  * deployment's default coding persona, or Cursor when `repoUrl` is set.
87
142
  * Its harness, instructions and model apply unless `instructions` or
88
143
  * `model` override them.
@@ -117,13 +172,30 @@ export type CreateManagedSessionOptions = {
117
172
  export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
118
173
  /** Access requests and direct user grants. */
119
174
  readonly access: EntityAccess;
120
- /** Construct an approval handle scoped to this session. */
175
+ /**
176
+ * Construct an approval handle scoped to this session.
177
+ *
178
+ * @readonly
179
+ */
121
180
  toolApprovalById(id: string): ToolApproval;
122
- /** Sharing configuration. */
181
+ /**
182
+ * Sharing configuration.
183
+ *
184
+ * @readonly
185
+ */
123
186
  sharePermissions(): Promise<import("../../../generated/agent-harness").SharePermissionV2>;
124
- /** Replace sharing grants. */
187
+ /**
188
+ * Replace sharing grants.
189
+ *
190
+ * @write
191
+ * @idempotent
192
+ */
125
193
  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. */
194
+ /**
195
+ * The session's URL in the Macro web app; hand it to users as the link.
196
+ *
197
+ * @readonly
198
+ */
127
199
  webUrl(): string;
128
200
  /** Identity, loaded detail and {@link webUrl}, so serialized handles carry their link. */
129
201
  toJSON(): {
@@ -169,6 +241,8 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
169
241
  /**
170
242
  * What opened the session: who or what started it, and what it is about.
171
243
  * Readable by anyone who can view the session, including other agents.
244
+ *
245
+ * @readonly
172
246
  */
173
247
  origin(): Promise<SessionOrigin>;
174
248
  /**
@@ -205,29 +279,72 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
205
279
  * can view, oldest link first.
206
280
  */
207
281
  static forPullRequest(client: MacroClient, url: string): Promise<AgentSession[]>;
282
+ /**
283
+ * The caller's coding sessions waiting for an answer from them, or stalled
284
+ * for over 20 minutes, newest activity first. Only the 25 most recent such
285
+ * sessions are inspected.
286
+ */
287
+ static updates(client: MacroClient): Promise<AgentSessionUpdates>;
288
+ /**
289
+ * Tool calls this session's runtime holds until its owner approves them,
290
+ * oldest first. Answer each with {@link ToolApproval.answer}; only the
291
+ * owner may approve or decline. Permission requests and questions from the
292
+ * agent itself are answered with {@link control}.
293
+ *
294
+ * @readonly
295
+ */
296
+ pendingApprovals(): Promise<PendingToolApproval[]>;
297
+ /**
298
+ * Link this session to the task it works on, replacing any earlier link.
299
+ * Only the session's owner can link it, to a task they can view. The
300
+ * session's pull request, now or later, is linked to the task too.
301
+ *
302
+ * @write
303
+ */
304
+ linkTask(task: Task): Promise<LinkedTask>;
208
305
  /**
209
306
  * The GitHub pull requests linked to this session: the one its agent
210
307
  * opened and any a person linked, oldest first.
308
+ *
309
+ * @readonly
211
310
  */
212
311
  pullRequests(): Promise<SessionPullRequest[]>;
213
312
  /**
214
313
  * Link the GitHub pull request at `url` to this session. Linking one that
215
314
  * is already linked changes nothing.
315
+ *
316
+ * @write
317
+ * @idempotent
216
318
  */
217
319
  linkPullRequest(url: string): Promise<void>;
218
320
  /**
219
321
  * Unlink a GitHub pull request a person linked to this session. The pull
220
322
  * request the session's agent opened stays linked.
323
+ *
324
+ * @write
325
+ * @idempotent
221
326
  */
222
327
  unlinkPullRequest(url: string): Promise<void>;
223
- /** This session's auto-archive settings, and when a trigger archived it. */
328
+ /**
329
+ * This session's auto-archive settings, and when a trigger archived it.
330
+ *
331
+ * @readonly
332
+ */
224
333
  autoArchive(): Promise<SessionAutoArchive>;
225
334
  /**
226
335
  * Replace this session's auto-archive choices. Owner only; a trigger left
227
336
  * `undefined` follows the owner's default.
337
+ *
338
+ * @write
339
+ * @idempotent
228
340
  */
229
341
  setAutoArchive(overrides: AutoArchiveOverrides): Promise<void>;
230
- /** Rename this session. */
342
+ /**
343
+ * Rename this session.
344
+ *
345
+ * @write
346
+ * @idempotent
347
+ */
231
348
  rename(name: string): Promise<void>;
232
349
  /**
233
350
  * Register this session as the caller's work, so it shows as what the caller
@@ -239,22 +356,43 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
239
356
  * The registration ends on its own when the session's pull requests finish,
240
357
  * when it is archived, after a day without work, or after a week blocked on
241
358
  * input. A later turn does not register it again.
359
+ *
360
+ * @write
361
+ * @idempotent
242
362
  */
243
363
  registerAsWork(): Promise<RegisteredWork>;
244
364
  /**
245
365
  * End the caller's registration of this session as its work. Doing it again
246
366
  * changes nothing. The session itself is untouched.
367
+ *
368
+ * @write
369
+ * @idempotent
247
370
  */
248
371
  unregisterAsWork(): Promise<void>;
249
372
  /** The caller's active registrations, newest first. */
250
373
  static listRegisteredWork(client: MacroClient): Promise<RegisteredWork[]>;
251
374
  private static registeredWork;
252
- /** Archive this session, making it read-only until unarchived. */
375
+ /**
376
+ * Archive this session, making it read-only until unarchived.
377
+ *
378
+ * @write
379
+ * @idempotent
380
+ */
253
381
  archive(): Promise<void>;
254
- /** Restore an archived session so it can be edited and prompted again. */
382
+ /**
383
+ * Restore an archived session so it can be edited and prompted again.
384
+ *
385
+ * @write
386
+ * @idempotent
387
+ */
255
388
  unarchive(): Promise<void>;
256
389
  private setArchived;
257
- /** Resize this session's sandbox and remember the size as the owner's default. */
390
+ /**
391
+ * Resize this session's sandbox and remember the size as the owner's default.
392
+ *
393
+ * @write
394
+ * @idempotent
395
+ */
258
396
  setSandboxSize(size: SandboxSize): Promise<SandboxSize>;
259
397
  /** The caller's default sandbox size for new `@coder` sessions. */
260
398
  static defaultSandboxSize(client: MacroClient): Promise<SandboxSize>;
@@ -275,6 +413,9 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
275
413
  * action derives once it dispatches. A `queued` status means a turn was
276
414
  * running: the action waits in the session's queue ({@link queue}) and
277
415
  * dispatches when that turn ends.
416
+ *
417
+ * @destructive
418
+ * @openworld
278
419
  */
279
420
  control(action: AgentAction): Promise<ControlResponse>;
280
421
  /**
@@ -283,18 +424,37 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
283
424
  * `attachments` are files the prompt refers to, each by a URL the agent
284
425
  * can fetch (a static file service URL in practice); they reach the agent
285
426
  * as ACP `resource_link` blocks after the text.
427
+ *
428
+ * @destructive
429
+ * @openworld
286
430
  */
287
431
  prompt(text: string, attachments?: PromptAttachment[]): Promise<ControlResponse>;
288
432
  /**
289
433
  * The actions waiting to dispatch in this session, oldest first. Each can
290
434
  * be edited or removed until it dispatches.
435
+ *
436
+ * @readonly
291
437
  */
292
438
  queue(): Promise<QueuedAction[]>;
293
- /** Read the latest captured GitHub pull request changes and capture status. */
439
+ /**
440
+ * Read the latest captured GitHub pull request changes and capture status.
441
+ *
442
+ * @readonly
443
+ */
294
444
  changes(): Promise<AgentSessionChangesResponse>;
295
- /** Read the unified diff of the latest captured changeset. */
445
+ /**
446
+ * Read the unified diff of the latest captured changeset.
447
+ *
448
+ * @readonly
449
+ */
296
450
  changesPatch(): Promise<string>;
297
- /** Request a fresh capture and return the current state while it runs. */
451
+ /**
452
+ * Request a fresh capture and return the current state while it runs.
453
+ *
454
+ * @write
455
+ * @idempotent
456
+ * @openworld
457
+ */
298
458
  refreshChanges(): Promise<AgentSessionChangesResponse>;
299
459
  /**
300
460
  * Read this session's whole history as the conversation the app renders:
@@ -303,9 +463,15 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
303
463
  * session the caller can view, live or finished, so it is the way to read
304
464
  * what another agent session did. Prefer it to {@link log}, which returns
305
465
  * raw protocol frames.
466
+ *
467
+ * @readonly
306
468
  */
307
469
  foldedLog(): Promise<FoldedAgentSessionLog>;
308
- /** Read the complete raw protocol log for this session. */
470
+ /**
471
+ * Read the complete raw protocol log for this session.
472
+ *
473
+ * @readonly
474
+ */
309
475
  log(): Promise<AgentSessionLogResponse>;
310
476
  /** Persisted reviews scoped to this session, with or without a code execution. */
311
477
  readonly reviews: {
@@ -320,12 +486,21 @@ export declare class AgentSession extends MacroEntity<AgentSessionResponse> {
320
486
  readonly codeExecutions: {
321
487
  byId: (id: string) => CodeExecution;
322
488
  };
323
- /** Recorded activity caused by this session, lazily paginated newest first. */
489
+ /**
490
+ * Recorded activity caused by this session, lazily paginated newest first.
491
+ *
492
+ * @readonly
493
+ */
324
494
  activity(options?: AgentActivityOptions): AsyncGenerator<import("./activity").AgentActivity, any, any>;
325
495
  /** Code-mode invocation handles, distinct from saved code executions. */
326
496
  readonly invocations: {
327
497
  byId: (id: string) => AgentInvocation;
328
498
  };
329
- /** Delete this session and any live resources it owns. */
499
+ /**
500
+ * Delete this session and any live resources it owns.
501
+ *
502
+ * @destructive
503
+ * @idempotent
504
+ */
330
505
  delete(): Promise<void>;
331
506
  }
@@ -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(): {
@@ -1,6 +1,6 @@
1
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 RegisteredWork, type SelectableRepository } from './agent-session';
3
+ import { AgentSession, type AgentSessionUpdates, type CreateManagedSessionOptions, type RegisteredWork, type SelectableRepository } from './agent-session';
4
4
  /**
5
5
  * Entry point for coding-agent sessions.
6
6
  *
@@ -11,16 +11,15 @@ import { AgentSession, type CreateManagedSessionOptions, type RegisteredWork, ty
11
11
  *
12
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
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.
14
+ * Start sessions from ExecuteCode. For coding work, macro.agents.coding() lists the coding personas the user can start right now, built-in ones such as Cursor included; for a chat agent, macro.agents.list() lists the user's configurable agents. Choose by name, description and instructions, preferring an agent the user named, and pass its `agent` handle to macro.agentSessions.createManaged. Never invent an agent or construct one by id. To use Macro's default persona instead, omit `agent`. Read AgentSessionNamespace.createManaged with ReadCodeDocs before the first call.
15
15
  *
16
16
  * ```javascript
17
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}};
18
+ * const coding = await macro.agents.coding();
19
+ * const chosen = coding.find((option) => option.name === 'Cursor');
20
+ * if (!chosen) return {data: {error: 'Cursor is not connected', available: coding.map((option) => option.name)}};
22
21
  * const session = await macro.agentSessions.createManaged({
23
- * agent,
22
+ * agent: chosen.agent,
24
23
  * repoUrl: 'https://github.com/acme/web',
25
24
  * prompt: 'Fix the login redirect loop in acme/web. ...',
26
25
  * });
@@ -29,6 +28,10 @@ import { AgentSession, type CreateManagedSessionOptions, type RegisteredWork, ty
29
28
  * ```
30
29
  *
31
30
  * 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.
31
+ *
32
+ * ## Sessions waiting for the user
33
+ *
34
+ * macro.agentSessions.updates() lists the user's sessions waiting on them (permission requests, questions, held tool approvals) or stalled. A session's held tool calls come from session.pendingApprovals(); approve or deny one only when the user said so for that call. session.linkTask(task) links a session the user owns to its Macro task, and the session's pull request with it.
32
35
  */
33
36
  export declare class AgentSessionNamespace {
34
37
  private readonly client;
@@ -37,50 +40,102 @@ export declare class AgentSessionNamespace {
37
40
  byId(id: string): AgentSession;
38
41
  /**
39
42
  * 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
+ * deployment's default persona. Take `agent` from
44
+ * {@link AgentNamespace.coding} (coding personas, Cursor included) or
45
+ * {@link AgentNamespace.list} (configurable agents); never construct one
46
+ * from an id. Unknown or inaccessible personas fail. `model` and `instructions`
43
47
  * outrank the persona's. `repoUrl` is honored for Cursor; omit `agent`
44
48
  * and it starts as Cursor.
49
+ *
50
+ * @write
51
+ * @openworld
45
52
  */
46
53
  createManaged(opts?: CreateManagedSessionOptions): Promise<AgentSession>;
47
54
  /**
48
55
  * The sessions the caller registered as its work with
49
56
  * {@link AgentSession.registerAsWork} and can still view, newest first.
50
57
  * Ended registrations and archived sessions are left out.
58
+ *
59
+ * @readonly
51
60
  */
52
61
  registeredWork(): Promise<RegisteredWork[]>;
53
62
  /**
54
63
  * Whether `prompt` needs a chat agent (`'chat'`) or a coding agent
55
64
  * (`'code'`), as the app's Auto mode decides before starting a session.
65
+ *
66
+ * @write
56
67
  */
57
68
  chooseMode(prompt: string): Promise<AgentMode>;
58
69
  /**
59
70
  * The GitHub repositories the caller can hand a managed session, with the
60
71
  * branch each one's sessions start on by default.
72
+ *
73
+ * @readonly
74
+ * @openworld
61
75
  */
62
76
  repositories(): Promise<SelectableRepository[]>;
63
77
  /**
64
78
  * Branch names on one repository the caller can start a managed session
65
79
  * from. `repoUrl` is one of the URLs {@link AgentSessionNamespace.repositories}
66
80
  * lists.
81
+ *
82
+ * @readonly
83
+ * @openworld
67
84
  */
68
85
  repositoryBranches(repoUrl: string): Promise<string[]>;
86
+ /**
87
+ * The caller's coding sessions waiting for them: permission requests,
88
+ * questions and held tool approvals to answer, and sessions stalled for
89
+ * over 20 minutes, newest activity first. Read a session's held approvals
90
+ * with {@link AgentSession.pendingApprovals}.
91
+ *
92
+ * @readonly
93
+ */
94
+ updates(): Promise<AgentSessionUpdates>;
69
95
  /**
70
96
  * The sessions linked to the GitHub pull request at `url` that the caller
71
97
  * can view.
98
+ *
99
+ * @readonly
72
100
  */
73
101
  forPullRequest(url: string): Promise<AgentSession[]>;
74
- /** The caller's default sandbox size for new `@coder` sessions. */
102
+ /**
103
+ * The caller's default sandbox size for new `@coder` sessions.
104
+ *
105
+ * @readonly
106
+ */
75
107
  defaultSandboxSize(): Promise<SandboxSize>;
76
- /** Set the caller's default sandbox size for the next `@coder` mention. */
108
+ /**
109
+ * Set the caller's default sandbox size for the next `@coder` mention.
110
+ *
111
+ * @write
112
+ * @idempotent
113
+ */
77
114
  setDefaultSandboxSize(size: SandboxSize): Promise<SandboxSize>;
78
- /** What the caller's new coding sessions are told to do beyond their assignment. */
115
+ /**
116
+ * What the caller's new coding sessions are told to do beyond their assignment.
117
+ *
118
+ * @readonly
119
+ */
79
120
  codingPreferences(): Promise<CodingPreferencesBody>;
80
- /** Which triggers archive the caller's sessions by default; each is off unless chosen. */
121
+ /**
122
+ * Which triggers archive the caller's sessions by default; each is off unless chosen.
123
+ *
124
+ * @readonly
125
+ */
81
126
  autoArchivePreferences(): Promise<AutoArchivePreferencesBody>;
82
- /** Replace which triggers archive the caller's sessions by default. */
127
+ /**
128
+ * Replace which triggers archive the caller's sessions by default.
129
+ *
130
+ * @write
131
+ * @idempotent
132
+ */
83
133
  setAutoArchivePreferences(preferences: AutoArchivePreferencesBody): Promise<AutoArchivePreferencesBody>;
84
- /** Replace the caller's coding preferences. */
134
+ /**
135
+ * Replace the caller's coding preferences.
136
+ *
137
+ * @write
138
+ * @idempotent
139
+ */
85
140
  setCodingPreferences(preferences: CodingPreferencesBody): Promise<CodingPreferencesBody>;
86
141
  }
@@ -67,7 +67,7 @@ export type SessionOrigin =
67
67
  task: Task;
68
68
  project: Initiative;
69
69
  }
70
- /** A person opened the session directly, from the composer. */
70
+ /** A person opened the session directly: from the composer, or by asking for a routine draft. */
71
71
  | {
72
72
  kind: 'requested';
73
73
  by: User;
@@ -8,8 +8,10 @@ import type { MacroClient } from '../../utils/client';
8
8
  *
9
9
  * List-sourced only - there is no per-action GET, only the queue snapshot -
10
10
  * so this wraps whatever DTO the caller already has, the same shape
11
- * `CrmComment` wraps a list-sourced record, rather than `MacroEntity`'s
11
+ * `DiscussionComment` wraps a list-sourced record, rather than `MacroEntity`'s
12
12
  * lazy-fetch-by-id.
13
+ *
14
+ * @mcp-exclude Built from a listing record; no id-only reference an MCP call can pass.
13
15
  */
14
16
  export declare class QueuedAction {
15
17
  private readonly client;
@@ -37,10 +39,22 @@ export declare class QueuedAction {
37
39
  * Replace this queued prompt's text before it dispatches. Returns this
38
40
  * handle for chaining; the edit endpoint answers 204, so `prompt` is
39
41
  * applied locally rather than reread from a response body.
42
+ *
43
+ * @write
44
+ * @idempotent
40
45
  */
41
46
  edit(prompt: string): Promise<this>;
42
- /** Move this action to the front and interrupt the current turn to run it next. */
47
+ /**
48
+ * Move this action to the front and interrupt the current turn to run it next.
49
+ *
50
+ * @destructive
51
+ */
43
52
  steer(): Promise<void>;
44
- /** Remove this action from the queue before it dispatches. */
53
+ /**
54
+ * Remove this action from the queue before it dispatches.
55
+ *
56
+ * @destructive
57
+ * @idempotent
58
+ */
45
59
  remove(): Promise<void>;
46
60
  }