@notionhq/client 5.25.2 → 5.27.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 (54) hide show
  1. package/README.md +130 -129
  2. package/build/package.json +4 -3
  3. package/build/src/Client.d.ts +1901 -96
  4. package/build/src/Client.d.ts.map +1 -1
  5. package/build/src/Client.js +271 -427
  6. package/build/src/Client.js.map +1 -1
  7. package/build/src/api-endpoint-methods.d.ts +920 -0
  8. package/build/src/api-endpoint-methods.d.ts.map +1 -0
  9. package/build/src/api-endpoint-methods.js +171 -0
  10. package/build/src/api-endpoint-methods.js.map +1 -0
  11. package/build/src/api-endpoints/agent-skills.d.ts +68 -0
  12. package/build/src/api-endpoints/agent-skills.d.ts.map +1 -0
  13. package/build/src/api-endpoints/agent-skills.js +36 -0
  14. package/build/src/api-endpoints/agent-skills.js.map +1 -0
  15. package/build/src/api-endpoints/agents.d.ts +3268 -0
  16. package/build/src/api-endpoints/agents.d.ts.map +1 -0
  17. package/build/src/api-endpoints/agents.js +336 -0
  18. package/build/src/api-endpoints/agents.js.map +1 -0
  19. package/build/src/api-endpoints/data-sources.d.ts +1 -0
  20. package/build/src/api-endpoints/data-sources.d.ts.map +1 -1
  21. package/build/src/api-endpoints/data-sources.js.map +1 -1
  22. package/build/src/api-endpoints/databases.d.ts +3 -1
  23. package/build/src/api-endpoints/databases.d.ts.map +1 -1
  24. package/build/src/api-endpoints/databases.js +1 -0
  25. package/build/src/api-endpoints/databases.js.map +1 -1
  26. package/build/src/api-endpoints/file-uploads.d.ts.map +1 -1
  27. package/build/src/api-endpoints/file-uploads.js.map +1 -1
  28. package/build/src/api-endpoints/pages.d.ts.map +1 -1
  29. package/build/src/api-endpoints/pages.js.map +1 -1
  30. package/build/src/api-endpoints/users.d.ts.map +1 -1
  31. package/build/src/api-endpoints/users.js.map +1 -1
  32. package/build/src/api-endpoints.d.ts +2 -0
  33. package/build/src/api-endpoints.d.ts.map +1 -1
  34. package/build/src/api-endpoints.js +2 -0
  35. package/build/src/api-endpoints.js.map +1 -1
  36. package/build/src/errors.d.ts +11 -0
  37. package/build/src/errors.d.ts.map +1 -1
  38. package/build/src/errors.js +20 -1
  39. package/build/src/errors.js.map +1 -1
  40. package/build/src/fetch-types.d.ts +11 -0
  41. package/build/src/fetch-types.d.ts.map +1 -1
  42. package/build/src/fetch-types.js.map +1 -1
  43. package/build/src/helpers.d.ts +4 -4
  44. package/build/src/helpers.d.ts.map +1 -1
  45. package/build/src/helpers.js.map +1 -1
  46. package/build/src/index.d.ts +2 -2
  47. package/build/src/index.d.ts.map +1 -1
  48. package/build/src/index.js +2 -1
  49. package/build/src/index.js.map +1 -1
  50. package/build/src/webhooks.d.ts +12 -19
  51. package/build/src/webhooks.d.ts.map +1 -1
  52. package/build/src/webhooks.js +27 -35
  53. package/build/src/webhooks.js.map +1 -1
  54. package/package.json +4 -3
@@ -0,0 +1,3268 @@
1
+ import type { EmptyObject, IdRequest, IdResponse, PageIconResponse } from "./common";
2
+ /**
3
+ * Parameters for opening a session stream.
4
+ */
5
+ export type UpdateSessionStreamParameters = {
6
+ message: string;
7
+ agent_id?: string | "notion_ai" | "33333333-3333-3333-3333-333333333333";
8
+ session_id?: string;
9
+ attachments?: Array<{
10
+ file_upload: {
11
+ id: string;
12
+ };
13
+ /**
14
+ * Always `file_upload`
15
+ */
16
+ type?: "file_upload";
17
+ name?: string;
18
+ }>;
19
+ metadata?: Record<string, string>;
20
+ prompt_context?: string;
21
+ } | {
22
+ session_id: string;
23
+ actions: Array<{
24
+ action_id: string;
25
+ /**
26
+ * One of: `approve`, `reject`
27
+ */
28
+ option_id: "approve" | "reject";
29
+ }>;
30
+ metadata?: Record<string, string>;
31
+ } | {
32
+ session_id: string;
33
+ continue_from: string;
34
+ };
35
+ /**
36
+ * An event emitted by a session stream.
37
+ */
38
+ export type UpdateSessionStreamResponse = {
39
+ /**
40
+ * Always `session.snapshot`
41
+ */
42
+ type: "session.snapshot";
43
+ session: {
44
+ /**
45
+ * Always `session`
46
+ */
47
+ object: "session";
48
+ id: string;
49
+ agent_id: string;
50
+ title: string;
51
+ /**
52
+ * One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`
53
+ */
54
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
55
+ created_at: string;
56
+ updated_at: string;
57
+ required_actions?: Array<{
58
+ action_id: string;
59
+ title: string;
60
+ options: Array<{
61
+ /**
62
+ * One of: `approve`, `reject`
63
+ */
64
+ id: "approve" | "reject";
65
+ label: string;
66
+ }>;
67
+ }>;
68
+ error?: {
69
+ code: string;
70
+ message: string;
71
+ retryable: boolean;
72
+ };
73
+ };
74
+ } | {
75
+ /**
76
+ * Always `event.provisional`
77
+ */
78
+ type: "event.provisional";
79
+ event: {
80
+ /**
81
+ * Always `session_event`
82
+ */
83
+ object: "session_event";
84
+ id: string;
85
+ session_id: string;
86
+ created_at: string;
87
+ /**
88
+ * Always `agent.message`
89
+ */
90
+ type: "agent.message";
91
+ content: Array<{
92
+ /**
93
+ * Always `text`
94
+ */
95
+ type: "text";
96
+ text: string;
97
+ }>;
98
+ } | {
99
+ /**
100
+ * Always `session_event`
101
+ */
102
+ object: "session_event";
103
+ id: string;
104
+ session_id: string;
105
+ created_at: string;
106
+ /**
107
+ * Always `agent.tool_use`
108
+ */
109
+ type: "agent.tool_use";
110
+ tool_name: string;
111
+ };
112
+ } | {
113
+ /**
114
+ * Always `event.committed`
115
+ */
116
+ type: "event.committed";
117
+ event: {
118
+ /**
119
+ * Always `session_event`
120
+ */
121
+ object: "session_event";
122
+ id: string;
123
+ session_id: string;
124
+ sequence: number;
125
+ created_at: string;
126
+ /**
127
+ * Always `user.message`
128
+ */
129
+ type: "user.message";
130
+ content: Array<{
131
+ /**
132
+ * Always `text`
133
+ */
134
+ type: "text";
135
+ text: string;
136
+ } | {
137
+ /**
138
+ * Always `file`
139
+ */
140
+ type: "file";
141
+ file_id: string;
142
+ }>;
143
+ metadata?: Record<string, string>;
144
+ } | {
145
+ /**
146
+ * Always `session_event`
147
+ */
148
+ object: "session_event";
149
+ id: string;
150
+ session_id: string;
151
+ sequence: number;
152
+ created_at: string;
153
+ /**
154
+ * Always `agent.message`
155
+ */
156
+ type: "agent.message";
157
+ content: Array<{
158
+ /**
159
+ * Always `text`
160
+ */
161
+ type: "text";
162
+ text: string;
163
+ }>;
164
+ } | {
165
+ /**
166
+ * Always `session_event`
167
+ */
168
+ object: "session_event";
169
+ id: string;
170
+ session_id: string;
171
+ sequence: number;
172
+ created_at: string;
173
+ /**
174
+ * Always `agent.tool_use`
175
+ */
176
+ type: "agent.tool_use";
177
+ tool_name: string;
178
+ } | {
179
+ /**
180
+ * Always `session_event`
181
+ */
182
+ object: "session_event";
183
+ id: string;
184
+ session_id: string;
185
+ sequence: number;
186
+ created_at: string;
187
+ /**
188
+ * Always `agent.tool_result`
189
+ */
190
+ type: "agent.tool_result";
191
+ tool_use_id: string;
192
+ tool_name: string;
193
+ is_error: boolean;
194
+ } | {
195
+ /**
196
+ * Always `session_event`
197
+ */
198
+ object: "session_event";
199
+ id: string;
200
+ session_id: string;
201
+ sequence: number;
202
+ created_at: string;
203
+ /**
204
+ * Always `session.status`
205
+ */
206
+ type: "session.status";
207
+ /**
208
+ * One of: `queued`, `in_progress`, `requires_action`, `completed`, `failed`, `canceled`, `terminated`
209
+ */
210
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
211
+ required_actions?: Array<{
212
+ action_id: string;
213
+ title: string;
214
+ options: Array<{
215
+ /**
216
+ * One of: `approve`, `reject`
217
+ */
218
+ id: "approve" | "reject";
219
+ label: string;
220
+ }>;
221
+ }>;
222
+ error?: {
223
+ code: string;
224
+ message: string;
225
+ retryable: boolean;
226
+ };
227
+ usage?: {
228
+ total_tokens: number;
229
+ input_tokens?: number;
230
+ output_tokens?: number;
231
+ };
232
+ artifacts?: Array<{
233
+ /**
234
+ * Always `page`
235
+ */
236
+ type: "page";
237
+ url: string;
238
+ title: string;
239
+ } | {
240
+ /**
241
+ * Always `html_artifact`
242
+ */
243
+ type: "html_artifact";
244
+ url: string;
245
+ page_url: string;
246
+ }>;
247
+ };
248
+ } | {
249
+ /**
250
+ * Always `stream.timeout`
251
+ */
252
+ type: "stream.timeout";
253
+ session_id: string;
254
+ message: string;
255
+ } | {
256
+ /**
257
+ * Always `stream.end`
258
+ */
259
+ type: "stream.end";
260
+ session_id: string;
261
+ /**
262
+ * One of: `requires_action`, `completed`, `failed`, `canceled`, `terminated`
263
+ */
264
+ status: "requires_action" | "completed" | "failed" | "canceled" | "terminated";
265
+ } | {
266
+ /**
267
+ * Always `stream.error`
268
+ */
269
+ type: "stream.error";
270
+ error: {
271
+ code: string;
272
+ message: string;
273
+ /**
274
+ * One of: `true`, `false`
275
+ */
276
+ retryable: true | false;
277
+ };
278
+ session_id?: string;
279
+ };
280
+ /**
281
+ * Open a session stream.
282
+ */
283
+ export declare const updateSessionStream: {
284
+ readonly method: "post";
285
+ readonly pathParams: readonly [];
286
+ readonly queryParams: readonly [];
287
+ readonly bodyParams: readonly ["message", "agent_id", "session_id", "attachments", "metadata", "prompt_context", "actions", "continue_from"];
288
+ readonly headers: {
289
+ readonly Accept: "text/event-stream";
290
+ };
291
+ readonly path: () => string;
292
+ };
293
+ type AgentBatchBodyParameters = {
294
+ operations: Array<{
295
+ action: "update_status";
296
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
297
+ fields: {
298
+ status: "active" | "disabled";
299
+ };
300
+ } | {
301
+ action: "update_credit_limit";
302
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
303
+ fields: {
304
+ credit_limit: number | null;
305
+ };
306
+ } | {
307
+ action: "delete";
308
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
309
+ }>;
310
+ };
311
+ export type AgentBatchParameters = AgentBatchBodyParameters;
312
+ export type AgentBatchResponse = {
313
+ object: "async_task";
314
+ id: string;
315
+ status_url: string;
316
+ created_time: string;
317
+ operation: {
318
+ surface: "rest" | "mcp";
319
+ name: string;
320
+ };
321
+ status: "queued" | "running" | "retrying";
322
+ poll_after_seconds: number;
323
+ };
324
+ /**
325
+ * Apply many agent operations
326
+ */
327
+ export declare const agentBatch: {
328
+ readonly method: "post";
329
+ readonly pathParams: readonly [];
330
+ readonly queryParams: readonly [];
331
+ readonly bodyParams: readonly ["operations"];
332
+ readonly path: () => string;
333
+ };
334
+ type CancelSessionPathParameters = {
335
+ session_id: IdRequest;
336
+ };
337
+ type CancelSessionBodyParameters = {
338
+ event_id?: string;
339
+ };
340
+ export type CancelSessionParameters = CancelSessionPathParameters & CancelSessionBodyParameters;
341
+ export type CancelSessionResponse = {
342
+ object: "session";
343
+ id: string;
344
+ agent_id: string;
345
+ title: string;
346
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
347
+ created_at: string;
348
+ updated_at: string;
349
+ required_actions?: Array<{
350
+ action_id: string;
351
+ title: string;
352
+ options: Array<{
353
+ id: "approve" | "reject";
354
+ label: string;
355
+ }>;
356
+ }>;
357
+ error?: {
358
+ code: string;
359
+ message: string;
360
+ retryable: boolean;
361
+ };
362
+ };
363
+ /**
364
+ * Cancel a session
365
+ */
366
+ export declare const cancelSession: {
367
+ readonly method: "post";
368
+ readonly pathParams: readonly ["session_id"];
369
+ readonly queryParams: readonly [];
370
+ readonly bodyParams: readonly ["event_id"];
371
+ readonly path: (p: CancelSessionPathParameters) => string;
372
+ };
373
+ type ChatWithAgentPathParameters = {
374
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
375
+ };
376
+ type ChatWithAgentQueryParameters = {
377
+ verbose?: boolean;
378
+ };
379
+ type ChatWithAgentBodyParameters = {
380
+ message?: string;
381
+ attachments?: Array<{
382
+ file_upload: {
383
+ id: string;
384
+ };
385
+ type?: "file_upload";
386
+ name?: string;
387
+ }>;
388
+ metadata?: Record<string, string>;
389
+ prompt_context?: string;
390
+ /** @deprecated */
391
+ thread_id?: IdRequest;
392
+ };
393
+ export type ChatWithAgentParameters = ChatWithAgentPathParameters & ChatWithAgentQueryParameters & ChatWithAgentBodyParameters;
394
+ export type ChatWithAgentResponse = {
395
+ object: "chat.invocation";
396
+ agent_id: string;
397
+ thread_id: string;
398
+ invocation_id: string;
399
+ status: "pending";
400
+ };
401
+ /**
402
+ * Chat with agent
403
+ */
404
+ export declare const chatWithAgent: {
405
+ readonly method: "post";
406
+ readonly pathParams: readonly ["agent_id"];
407
+ readonly queryParams: readonly ["verbose"];
408
+ readonly bodyParams: readonly ["message", "attachments", "metadata", "prompt_context", "thread_id"];
409
+ readonly path: (p: ChatWithAgentPathParameters) => string;
410
+ };
411
+ type ContinueThreadPathParameters = {
412
+ thread_id: IdRequest;
413
+ };
414
+ type ContinueThreadBodyParameters = {
415
+ action_id: IdRequest;
416
+ option_id: "approve" | "reject";
417
+ } | {
418
+ action_id: IdRequest;
419
+ option_id: "use_connection";
420
+ input: {
421
+ connection_id: IdRequest;
422
+ };
423
+ };
424
+ export type ContinueThreadParameters = ContinueThreadPathParameters & ContinueThreadBodyParameters;
425
+ export type ContinueThreadResponse = {
426
+ object: "chat.invocation";
427
+ agent_id: string;
428
+ thread_id: string;
429
+ invocation_id: string;
430
+ status: "pending";
431
+ };
432
+ /**
433
+ * Continue a thread
434
+ */
435
+ export declare const continueThread: {
436
+ readonly method: "post";
437
+ readonly pathParams: readonly ["thread_id"];
438
+ readonly queryParams: readonly [];
439
+ readonly bodyParams: readonly ["action_id", "option_id", "input"];
440
+ readonly path: (p: ContinueThreadPathParameters) => string;
441
+ };
442
+ type CreateExternalAgentStubVaultPathParameters = {
443
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
444
+ };
445
+ type CreateExternalAgentStubVaultBodyParameters = {
446
+ name: string;
447
+ credential: {
448
+ value: string;
449
+ expires_at: string;
450
+ };
451
+ target: {
452
+ type: "mcp_server";
453
+ server_url: string;
454
+ authorization: {
455
+ type: "bearer";
456
+ };
457
+ };
458
+ };
459
+ export type CreateExternalAgentStubVaultParameters = CreateExternalAgentStubVaultPathParameters & CreateExternalAgentStubVaultBodyParameters;
460
+ export type CreateExternalAgentStubVaultResponse = {
461
+ id: string;
462
+ name: string;
463
+ credential: {
464
+ expires_at: string;
465
+ };
466
+ target: {
467
+ type: "mcp_server";
468
+ server_url: string;
469
+ authorization: {
470
+ type: "bearer";
471
+ };
472
+ };
473
+ status: "active" | "expired";
474
+ version: number;
475
+ created_at: string;
476
+ updated_at: string;
477
+ };
478
+ /**
479
+ * Create external agent stub vault
480
+ */
481
+ export declare const createExternalAgentStubVault: {
482
+ readonly method: "post";
483
+ readonly pathParams: readonly ["agent_id"];
484
+ readonly queryParams: readonly [];
485
+ readonly bodyParams: readonly ["name", "credential", "target"];
486
+ readonly path: (p: CreateExternalAgentStubVaultPathParameters) => string;
487
+ };
488
+ type DeleteAgentPathParameters = {
489
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
490
+ };
491
+ export type DeleteAgentParameters = DeleteAgentPathParameters;
492
+ export type DeleteAgentResponse = {
493
+ agent_id: IdResponse;
494
+ status: "deleted";
495
+ deleted_at: string;
496
+ };
497
+ /**
498
+ * Delete agent
499
+ */
500
+ export declare const deleteAgent: {
501
+ readonly method: "delete";
502
+ readonly pathParams: readonly ["agent_id"];
503
+ readonly queryParams: readonly [];
504
+ readonly bodyParams: readonly [];
505
+ readonly path: (p: DeleteAgentPathParameters) => string;
506
+ };
507
+ type GetAgentPathParameters = {
508
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
509
+ };
510
+ type GetAgentQueryParameters = {
511
+ verbose?: boolean;
512
+ };
513
+ export type GetAgentParameters = GetAgentPathParameters & GetAgentQueryParameters;
514
+ export type GetAgentResponse = {
515
+ object: "agent";
516
+ id: IdResponse | "notion_ai";
517
+ agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent" | "external";
518
+ name: string;
519
+ description: string | null;
520
+ instructions_page_id: IdResponse | null;
521
+ icon: PageIconResponse | {
522
+ type: "custom_agent_avatar";
523
+ custom_agent_avatar: {
524
+ static_url: string;
525
+ animated_url: string;
526
+ };
527
+ } | null;
528
+ model: {
529
+ mode: "auto";
530
+ } | {
531
+ mode: "pinned";
532
+ id: string | null;
533
+ };
534
+ connections: Array<{
535
+ type: "notion";
536
+ name: string;
537
+ account: null;
538
+ permissions: Array<{
539
+ target: {
540
+ type: "page";
541
+ id: string;
542
+ } | {
543
+ type: "database_property";
544
+ data_source_id: string;
545
+ property_id: string;
546
+ } | {
547
+ type: "agent";
548
+ id: string;
549
+ } | {
550
+ type: "workspace";
551
+ } | {
552
+ type: "owner_private_pages";
553
+ } | {
554
+ type: "web_search";
555
+ allowed_domains: Array<string> | null;
556
+ } | {
557
+ type: "notion_help_docs_search";
558
+ };
559
+ scopes: Array<string>;
560
+ }>;
561
+ } | {
562
+ type: "slack";
563
+ name: string;
564
+ account: {
565
+ type: "slack_workspace";
566
+ team_id: string;
567
+ } | "hidden" | null;
568
+ permissions: Array<{
569
+ target: {
570
+ type: "slack_channel";
571
+ id: string;
572
+ } | {
573
+ type: "slack_all_public_channels";
574
+ } | {
575
+ type: "slack_all_channels";
576
+ };
577
+ scopes: Array<string>;
578
+ }>;
579
+ } | {
580
+ type: "discord";
581
+ name: string;
582
+ account: {
583
+ type: "discord_server";
584
+ id: string;
585
+ } | "hidden" | null;
586
+ permissions: Array<{
587
+ target: {
588
+ type: "discord_channel";
589
+ id: string;
590
+ } | {
591
+ type: "discord_all_channels";
592
+ };
593
+ scopes: Array<string>;
594
+ }>;
595
+ } | {
596
+ type: "mcp_server";
597
+ name: string;
598
+ account: {
599
+ type: "mcp_server";
600
+ server_host: string;
601
+ } | "hidden" | null;
602
+ enabled_tools: Array<{
603
+ name: string;
604
+ title: string | null;
605
+ }> | "hidden" | null;
606
+ run_tools_automatically: {
607
+ read: boolean;
608
+ write: boolean;
609
+ };
610
+ } | {
611
+ type: "custom_mcp_server";
612
+ name: string;
613
+ account: {
614
+ type: "mcp_server";
615
+ server_host: string;
616
+ } | "hidden" | null;
617
+ enabled_tools: Array<{
618
+ name: string;
619
+ title: string | null;
620
+ }> | "hidden" | null;
621
+ run_tools_automatically: {
622
+ read: boolean;
623
+ write: boolean;
624
+ };
625
+ } | {
626
+ type: "asana" | "box" | "browser" | "calendar" | "computer" | "confluence" | "cursor" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
627
+ name: string;
628
+ account: string | null;
629
+ permissions: Array<{
630
+ target: {
631
+ type: string;
632
+ id: string;
633
+ };
634
+ scopes: Array<string>;
635
+ }>;
636
+ }>;
637
+ status: "active" | "disabled" | "deleted";
638
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
639
+ created_by: {
640
+ object: "user";
641
+ type: "user";
642
+ id: IdResponse;
643
+ } | null;
644
+ version: {
645
+ id: IdResponse;
646
+ number: number;
647
+ published_at: string;
648
+ } | null;
649
+ agent_version: {
650
+ id: IdResponse;
651
+ number: number;
652
+ published_at: string;
653
+ } | null;
654
+ has_unpublished_changes: boolean | "hidden";
655
+ last_run_time: string | "hidden" | null;
656
+ last_run_at: string | "hidden" | null;
657
+ credit_limit: number | "hidden" | null;
658
+ triggers: Array<{
659
+ type: string;
660
+ enabled: boolean;
661
+ schedule?: {
662
+ frequency: string;
663
+ interval: number;
664
+ weekdays?: Array<string>;
665
+ monthdays?: Array<number>;
666
+ week_numbers?: Array<number>;
667
+ hour?: number;
668
+ minute?: number;
669
+ timezone?: string;
670
+ start_date?: string;
671
+ end?: {
672
+ type: "date";
673
+ end_at: string;
674
+ } | {
675
+ type: "count";
676
+ occurrences: number;
677
+ };
678
+ };
679
+ config?: Record<string, Record<string, never>>;
680
+ }>;
681
+ created_time?: string;
682
+ last_edited_time?: string;
683
+ instructions?: string | null;
684
+ };
685
+ /**
686
+ * Get agent
687
+ */
688
+ export declare const getAgent: {
689
+ readonly method: "get";
690
+ readonly pathParams: readonly ["agent_id"];
691
+ readonly queryParams: readonly ["verbose"];
692
+ readonly bodyParams: readonly [];
693
+ readonly path: (p: GetAgentPathParameters) => string;
694
+ };
695
+ type DeleteExternalAgentStubVaultPathParameters = {
696
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
697
+ vault_id: string;
698
+ };
699
+ export type DeleteExternalAgentStubVaultParameters = DeleteExternalAgentStubVaultPathParameters;
700
+ export type DeleteExternalAgentStubVaultResponse = EmptyObject;
701
+ /**
702
+ * Delete external agent stub vault
703
+ */
704
+ export declare const deleteExternalAgentStubVault: {
705
+ readonly method: "delete";
706
+ readonly pathParams: readonly ["agent_id", "vault_id"];
707
+ readonly queryParams: readonly [];
708
+ readonly bodyParams: readonly [];
709
+ readonly path: (p: DeleteExternalAgentStubVaultPathParameters) => string;
710
+ };
711
+ type UpdateExternalAgentStubVaultPathParameters = {
712
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
713
+ vault_id: string;
714
+ };
715
+ type UpdateExternalAgentStubVaultBodyParameters = {
716
+ expected_version: number;
717
+ credential: {
718
+ value: string;
719
+ expires_at: string;
720
+ };
721
+ };
722
+ export type UpdateExternalAgentStubVaultParameters = UpdateExternalAgentStubVaultPathParameters & UpdateExternalAgentStubVaultBodyParameters;
723
+ export type UpdateExternalAgentStubVaultResponse = {
724
+ id: string;
725
+ name: string;
726
+ credential: {
727
+ expires_at: string;
728
+ };
729
+ target: {
730
+ type: "mcp_server";
731
+ server_url: string;
732
+ authorization: {
733
+ type: "bearer";
734
+ };
735
+ };
736
+ status: "active" | "expired";
737
+ version: number;
738
+ created_at: string;
739
+ updated_at: string;
740
+ };
741
+ /**
742
+ * Update external agent stub vault
743
+ */
744
+ export declare const updateExternalAgentStubVault: {
745
+ readonly method: "patch";
746
+ readonly pathParams: readonly ["agent_id", "vault_id"];
747
+ readonly queryParams: readonly [];
748
+ readonly bodyParams: readonly ["expected_version", "credential"];
749
+ readonly path: (p: UpdateExternalAgentStubVaultPathParameters) => string;
750
+ };
751
+ type GetInsightsPathParameters = {
752
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
753
+ };
754
+ type GetInsightsQueryParameters = {
755
+ start_time?: number;
756
+ end_time?: number;
757
+ };
758
+ export type GetInsightsParameters = GetInsightsPathParameters & GetInsightsQueryParameters;
759
+ export type GetInsightsResponse = {
760
+ object: "agent_insights";
761
+ id: IdResponse | "notion_ai";
762
+ name: string;
763
+ agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent";
764
+ status: "active" | "disabled" | "deleted";
765
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
766
+ created_by: {
767
+ id: string;
768
+ type: "user" | "bot";
769
+ } | null;
770
+ total_credits_used: number;
771
+ credit_limit: number | "hidden" | null;
772
+ runs_completed: number;
773
+ };
774
+ /**
775
+ * Get agent insights
776
+ */
777
+ export declare const getInsights: {
778
+ readonly method: "get";
779
+ readonly pathParams: readonly ["agent_id"];
780
+ readonly queryParams: readonly ["start_time", "end_time"];
781
+ readonly bodyParams: readonly [];
782
+ readonly path: (p: GetInsightsPathParameters) => string;
783
+ };
784
+ type ListAgentsQueryParameters = {
785
+ name?: string;
786
+ agent_type?: Array<"notion_ai" | "custom_agent" | "autofill_custom_agent" | "external">;
787
+ agent_ids?: Array<IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333">;
788
+ created_by?: Array<IdRequest | "me">;
789
+ start_cursor?: string | null;
790
+ page_size?: number;
791
+ verbose?: boolean;
792
+ };
793
+ export type ListAgentsParameters = ListAgentsQueryParameters;
794
+ export type ListAgentsResponse = {
795
+ object: "list";
796
+ type: "agent";
797
+ results: Array<{
798
+ object: "agent";
799
+ id: IdResponse | "notion_ai";
800
+ agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent" | "external";
801
+ name: string;
802
+ description: string | null;
803
+ instructions_page_id: IdResponse | null;
804
+ icon: PageIconResponse | {
805
+ type: "custom_agent_avatar";
806
+ custom_agent_avatar: {
807
+ static_url: string;
808
+ animated_url: string;
809
+ };
810
+ } | null;
811
+ version: {
812
+ id: IdResponse;
813
+ number: number;
814
+ published_at: string;
815
+ } | null;
816
+ agent_version: {
817
+ id: IdResponse;
818
+ number: number;
819
+ published_at: string;
820
+ } | null;
821
+ model: {
822
+ mode: "auto";
823
+ } | {
824
+ mode: "pinned";
825
+ id: string | null;
826
+ };
827
+ connections: Array<{
828
+ type: "notion";
829
+ name: string;
830
+ account: null;
831
+ permissions: Array<{
832
+ target: {
833
+ type: "page";
834
+ id: string;
835
+ } | {
836
+ type: "database_property";
837
+ data_source_id: string;
838
+ property_id: string;
839
+ } | {
840
+ type: "agent";
841
+ id: string;
842
+ } | {
843
+ type: "workspace";
844
+ } | {
845
+ type: "owner_private_pages";
846
+ } | {
847
+ type: "web_search";
848
+ allowed_domains: Array<string> | null;
849
+ } | {
850
+ type: "notion_help_docs_search";
851
+ };
852
+ scopes: Array<string>;
853
+ }>;
854
+ } | {
855
+ type: "slack";
856
+ name: string;
857
+ account: {
858
+ type: "slack_workspace";
859
+ team_id: string;
860
+ } | "hidden" | null;
861
+ permissions: Array<{
862
+ target: {
863
+ type: "slack_channel";
864
+ id: string;
865
+ } | {
866
+ type: "slack_all_public_channels";
867
+ } | {
868
+ type: "slack_all_channels";
869
+ };
870
+ scopes: Array<string>;
871
+ }>;
872
+ } | {
873
+ type: "discord";
874
+ name: string;
875
+ account: {
876
+ type: "discord_server";
877
+ id: string;
878
+ } | "hidden" | null;
879
+ permissions: Array<{
880
+ target: {
881
+ type: "discord_channel";
882
+ id: string;
883
+ } | {
884
+ type: "discord_all_channels";
885
+ };
886
+ scopes: Array<string>;
887
+ }>;
888
+ } | {
889
+ type: "mcp_server";
890
+ name: string;
891
+ account: {
892
+ type: "mcp_server";
893
+ server_host: string;
894
+ } | "hidden" | null;
895
+ enabled_tools: Array<{
896
+ name: string;
897
+ title: string | null;
898
+ }> | "hidden" | null;
899
+ run_tools_automatically: {
900
+ read: boolean;
901
+ write: boolean;
902
+ };
903
+ } | {
904
+ type: "custom_mcp_server";
905
+ name: string;
906
+ account: {
907
+ type: "mcp_server";
908
+ server_host: string;
909
+ } | "hidden" | null;
910
+ enabled_tools: Array<{
911
+ name: string;
912
+ title: string | null;
913
+ }> | "hidden" | null;
914
+ run_tools_automatically: {
915
+ read: boolean;
916
+ write: boolean;
917
+ };
918
+ } | {
919
+ type: "asana" | "box" | "browser" | "calendar" | "computer" | "confluence" | "cursor" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
920
+ name: string;
921
+ account: string | null;
922
+ permissions: Array<{
923
+ target: {
924
+ type: string;
925
+ id: string;
926
+ };
927
+ scopes: Array<string>;
928
+ }>;
929
+ }>;
930
+ status: "active" | "disabled" | "deleted";
931
+ created_by: {
932
+ object: "user";
933
+ type: "user";
934
+ id: IdResponse;
935
+ } | null;
936
+ created_time: string | null;
937
+ last_edited_time: string | null;
938
+ last_run_time: string | "hidden" | null;
939
+ last_run_at: string | "hidden" | null;
940
+ instructions?: string | null;
941
+ }>;
942
+ has_more: boolean;
943
+ next_cursor: string | null;
944
+ };
945
+ /**
946
+ * List agents
947
+ */
948
+ export declare const listAgents: {
949
+ readonly method: "get";
950
+ readonly pathParams: readonly [];
951
+ readonly queryParams: readonly ["name", "agent_type", "agent_ids", "created_by", "start_cursor", "page_size", "verbose"];
952
+ readonly bodyParams: readonly [];
953
+ readonly path: () => string;
954
+ };
955
+ type ListExternalAgentStubSessionEventsPathParameters = {
956
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
957
+ session_id: IdRequest;
958
+ };
959
+ type ListExternalAgentStubSessionEventsQueryParameters = {
960
+ cursor?: string;
961
+ };
962
+ export type ListExternalAgentStubSessionEventsParameters = ListExternalAgentStubSessionEventsPathParameters & ListExternalAgentStubSessionEventsQueryParameters;
963
+ export type ListExternalAgentStubSessionEventsResponse = {
964
+ events: Array<{
965
+ type: "assistant.thinking";
966
+ text: string;
967
+ } | {
968
+ type: "assistant.message";
969
+ text: string;
970
+ } | {
971
+ type: "tool.started";
972
+ tool_call_id: string;
973
+ tool_name?: string;
974
+ input?: Record<string, never>;
975
+ } | {
976
+ type: "tool.output";
977
+ tool_call_id: string;
978
+ output?: Record<string, never>;
979
+ is_error?: boolean;
980
+ } | {
981
+ type: "error";
982
+ error: {
983
+ code: string;
984
+ message: string;
985
+ retryable: boolean;
986
+ additional_data?: Record<string, string | Array<string>>;
987
+ };
988
+ }>;
989
+ is_running: boolean;
990
+ next_cursor?: string;
991
+ };
992
+ /**
993
+ * List external agent stub session events
994
+ */
995
+ export declare const listExternalAgentStubSessionEvents: {
996
+ readonly method: "get";
997
+ readonly pathParams: readonly ["agent_id", "session_id"];
998
+ readonly queryParams: readonly ["cursor"];
999
+ readonly bodyParams: readonly [];
1000
+ readonly path: (p: ListExternalAgentStubSessionEventsPathParameters) => string;
1001
+ };
1002
+ type ListThreadMessagesPathParameters = {
1003
+ thread_id: IdRequest;
1004
+ };
1005
+ type ListThreadMessagesQueryParameters = {
1006
+ verbose?: boolean;
1007
+ role?: "user" | "agent";
1008
+ start_cursor?: string | null;
1009
+ page_size?: number;
1010
+ };
1011
+ export type ListThreadMessagesParameters = ListThreadMessagesPathParameters & ListThreadMessagesQueryParameters;
1012
+ export type ListThreadMessagesResponse = {
1013
+ object: "list";
1014
+ type: "thread_message";
1015
+ results: Array<{
1016
+ object: "thread_message";
1017
+ id: IdResponse;
1018
+ role: "user" | "agent";
1019
+ content: string;
1020
+ created_time: string;
1021
+ parent: {
1022
+ type: "thread";
1023
+ id: IdResponse;
1024
+ };
1025
+ attachments?: Array<{
1026
+ name: string;
1027
+ content_type: string;
1028
+ url: string;
1029
+ expiry_time?: string;
1030
+ }>;
1031
+ content_parts?: Array<{
1032
+ type: "text";
1033
+ text: string;
1034
+ } | {
1035
+ type: "thinking";
1036
+ text: string;
1037
+ } | {
1038
+ type: "tool_call";
1039
+ tool_call_id: string | null;
1040
+ tool_name: string;
1041
+ results?: Array<{
1042
+ id: IdResponse;
1043
+ agent_step_id: IdResponse | null;
1044
+ tool_call_id: string | null;
1045
+ tool_name: string;
1046
+ tool_type: string;
1047
+ state: string;
1048
+ started_at: number;
1049
+ finished_at: number | null;
1050
+ duration_ms: number | null;
1051
+ }>;
1052
+ } | {
1053
+ type: "follow_ups";
1054
+ follow_ups: Array<{
1055
+ label: string;
1056
+ message: string;
1057
+ }>;
1058
+ } | {
1059
+ type: "custom_agent_template_picker";
1060
+ }>;
1061
+ pending_user_actions?: Array<{
1062
+ id: IdResponse;
1063
+ type: "tool_confirmation";
1064
+ title: string;
1065
+ requirements: Array<{
1066
+ type: "general";
1067
+ } | {
1068
+ type: "manage_workers";
1069
+ } | {
1070
+ type: "url_safety";
1071
+ urls: Array<string>;
1072
+ required_by_workspace_policy?: boolean;
1073
+ } | {
1074
+ type: "permission_escalation";
1075
+ destination_title?: string;
1076
+ source_titles?: Array<string>;
1077
+ } | {
1078
+ type: "delete_content";
1079
+ page_count: number;
1080
+ database_count: number;
1081
+ meeting_notes_block_count?: number;
1082
+ } | {
1083
+ type: "connect_integration";
1084
+ integration_type: string;
1085
+ integration_name: string;
1086
+ handoff_url: string;
1087
+ } | {
1088
+ type: "admin_mode";
1089
+ explanation?: string;
1090
+ }>;
1091
+ options: Array<{
1092
+ id: "approve";
1093
+ label: string;
1094
+ } | {
1095
+ id: "reject";
1096
+ label: string;
1097
+ } | {
1098
+ id: "use_connection";
1099
+ label: string;
1100
+ input: {
1101
+ type: "connection_id";
1102
+ required: true;
1103
+ };
1104
+ }>;
1105
+ }>;
1106
+ }>;
1107
+ has_more: boolean;
1108
+ next_cursor: string | null;
1109
+ };
1110
+ /**
1111
+ * List thread messages
1112
+ */
1113
+ export declare const listThreadMessages: {
1114
+ readonly method: "get";
1115
+ readonly pathParams: readonly ["thread_id"];
1116
+ readonly queryParams: readonly ["verbose", "role", "start_cursor", "page_size"];
1117
+ readonly bodyParams: readonly [];
1118
+ readonly path: (p: ListThreadMessagesPathParameters) => string;
1119
+ };
1120
+ type SendThreadMessagePathParameters = {
1121
+ thread_id: IdRequest;
1122
+ };
1123
+ type SendThreadMessageBodyParameters = {
1124
+ message?: string;
1125
+ attachments?: Array<{
1126
+ file_upload: {
1127
+ id: string;
1128
+ };
1129
+ type?: "file_upload";
1130
+ name?: string;
1131
+ }>;
1132
+ metadata?: Record<string, string>;
1133
+ prompt_context?: string;
1134
+ };
1135
+ export type SendThreadMessageParameters = SendThreadMessagePathParameters & SendThreadMessageBodyParameters;
1136
+ export type SendThreadMessageResponse = {
1137
+ object: "chat.invocation";
1138
+ agent_id: string;
1139
+ thread_id: string;
1140
+ invocation_id: string;
1141
+ status: "pending";
1142
+ };
1143
+ /**
1144
+ * Send a thread message
1145
+ */
1146
+ export declare const sendThreadMessage: {
1147
+ readonly method: "post";
1148
+ readonly pathParams: readonly ["thread_id"];
1149
+ readonly queryParams: readonly [];
1150
+ readonly bodyParams: readonly ["message", "attachments", "metadata", "prompt_context"];
1151
+ readonly path: (p: SendThreadMessagePathParameters) => string;
1152
+ };
1153
+ type ListThreadsPathParameters = {
1154
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1155
+ };
1156
+ type ListThreadsQueryParameters = {
1157
+ id?: IdRequest;
1158
+ title?: string;
1159
+ status?: "pending" | "requires_action" | "completed" | "failed" | "canceled";
1160
+ activity?: "all" | "pending" | "in_progress" | "failed" | "success";
1161
+ created_by?: Array<IdRequest | "me">;
1162
+ last_used_by?: Array<IdRequest | "me">;
1163
+ sort_by?: "created_time" | "last_used_time";
1164
+ sort_direction?: "ascending" | "descending";
1165
+ start_cursor?: string | null;
1166
+ page_size?: number;
1167
+ };
1168
+ export type ListThreadsParameters = ListThreadsPathParameters & ListThreadsQueryParameters;
1169
+ export type ListThreadsResponse = {
1170
+ object: "list";
1171
+ type: "thread";
1172
+ results: Array<{
1173
+ object: "thread";
1174
+ id: IdResponse;
1175
+ title: string;
1176
+ status: "pending" | "requires_action" | "completed" | "canceled" | "failed";
1177
+ created_time: string;
1178
+ last_edited_time: string;
1179
+ created_by: {
1180
+ id: IdResponse;
1181
+ type: "bot" | "user";
1182
+ };
1183
+ agent_version: {
1184
+ id: IdResponse;
1185
+ number: number;
1186
+ published_at: string;
1187
+ } | null;
1188
+ models: {
1189
+ type: "auto";
1190
+ } | {
1191
+ type: "pinned";
1192
+ ids: Array<string | null>;
1193
+ };
1194
+ error?: string;
1195
+ trigger_type?: string;
1196
+ type_labels?: Array<string> | null;
1197
+ chat_user_emails?: Array<string> | null;
1198
+ tool_types?: Array<string> | null;
1199
+ tool_call_count?: number | null;
1200
+ credits_used?: number | null;
1201
+ runs_completed?: number | null;
1202
+ pending_user_actions?: Array<{
1203
+ id: IdResponse;
1204
+ type: "tool_confirmation";
1205
+ title: string;
1206
+ requirements: Array<{
1207
+ type: "general";
1208
+ } | {
1209
+ type: "manage_workers";
1210
+ } | {
1211
+ type: "url_safety";
1212
+ urls: Array<string>;
1213
+ required_by_workspace_policy?: boolean;
1214
+ } | {
1215
+ type: "permission_escalation";
1216
+ destination_title?: string;
1217
+ source_titles?: Array<string>;
1218
+ } | {
1219
+ type: "delete_content";
1220
+ page_count: number;
1221
+ database_count: number;
1222
+ meeting_notes_block_count?: number;
1223
+ } | {
1224
+ type: "connect_integration";
1225
+ integration_type: string;
1226
+ integration_name: string;
1227
+ handoff_url: string;
1228
+ } | {
1229
+ type: "admin_mode";
1230
+ explanation?: string;
1231
+ }>;
1232
+ options: Array<{
1233
+ id: "approve";
1234
+ label: string;
1235
+ } | {
1236
+ id: "reject";
1237
+ label: string;
1238
+ } | {
1239
+ id: "use_connection";
1240
+ label: string;
1241
+ input: {
1242
+ type: "connection_id";
1243
+ required: true;
1244
+ };
1245
+ }>;
1246
+ }>;
1247
+ }>;
1248
+ has_more: boolean;
1249
+ next_cursor: string | null;
1250
+ };
1251
+ /**
1252
+ * List threads
1253
+ */
1254
+ export declare const listThreads: {
1255
+ readonly method: "get";
1256
+ readonly pathParams: readonly ["agent_id"];
1257
+ readonly queryParams: readonly ["id", "title", "status", "activity", "created_by", "last_used_by", "sort_by", "sort_direction", "start_cursor", "page_size"];
1258
+ readonly bodyParams: readonly [];
1259
+ readonly path: (p: ListThreadsPathParameters) => string;
1260
+ };
1261
+ type QueryAgentsBodyParameters = {
1262
+ query?: string;
1263
+ filter?: {
1264
+ property: "id";
1265
+ id: {
1266
+ equals: string;
1267
+ };
1268
+ } | {
1269
+ property: "agent_type";
1270
+ string: {
1271
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1272
+ };
1273
+ } | {
1274
+ property: "created_by";
1275
+ people: {
1276
+ contains: string;
1277
+ };
1278
+ } | {
1279
+ property: "created_time";
1280
+ date: {
1281
+ after?: string;
1282
+ before?: string;
1283
+ };
1284
+ } | {
1285
+ property: "favorited";
1286
+ checkbox: {
1287
+ equals: boolean;
1288
+ };
1289
+ } | {
1290
+ property: "connections";
1291
+ mcp_server: {
1292
+ contains: string;
1293
+ };
1294
+ } | {
1295
+ property: "status";
1296
+ status: {
1297
+ in: Array<"active" | "disabled" | "deleted">;
1298
+ };
1299
+ } | {
1300
+ property: "model_mode";
1301
+ select: {
1302
+ equals: "auto" | "pinned";
1303
+ };
1304
+ } | {
1305
+ property: "agent_version";
1306
+ number: {
1307
+ equals: number;
1308
+ };
1309
+ } | {
1310
+ property: "last_run_at";
1311
+ date: {
1312
+ after?: string;
1313
+ before?: string;
1314
+ };
1315
+ } | {
1316
+ and: Array<{
1317
+ property: "id";
1318
+ id: {
1319
+ equals: string;
1320
+ };
1321
+ } | {
1322
+ property: "agent_type";
1323
+ string: {
1324
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1325
+ };
1326
+ } | {
1327
+ property: "created_by";
1328
+ people: {
1329
+ contains: string;
1330
+ };
1331
+ } | {
1332
+ property: "created_time";
1333
+ date: {
1334
+ after?: string;
1335
+ before?: string;
1336
+ };
1337
+ } | {
1338
+ property: "favorited";
1339
+ checkbox: {
1340
+ equals: boolean;
1341
+ };
1342
+ } | {
1343
+ property: "connections";
1344
+ mcp_server: {
1345
+ contains: string;
1346
+ };
1347
+ } | {
1348
+ property: "status";
1349
+ status: {
1350
+ in: Array<"active" | "disabled" | "deleted">;
1351
+ };
1352
+ } | {
1353
+ property: "model_mode";
1354
+ select: {
1355
+ equals: "auto" | "pinned";
1356
+ };
1357
+ } | {
1358
+ property: "agent_version";
1359
+ number: {
1360
+ equals: number;
1361
+ };
1362
+ } | {
1363
+ property: "last_run_at";
1364
+ date: {
1365
+ after?: string;
1366
+ before?: string;
1367
+ };
1368
+ } | {
1369
+ and: Array<{
1370
+ property: "id";
1371
+ id: {
1372
+ equals: string;
1373
+ };
1374
+ } | {
1375
+ property: "agent_type";
1376
+ string: {
1377
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1378
+ };
1379
+ } | {
1380
+ property: "created_by";
1381
+ people: {
1382
+ contains: string;
1383
+ };
1384
+ } | {
1385
+ property: "created_time";
1386
+ date: {
1387
+ after?: string;
1388
+ before?: string;
1389
+ };
1390
+ } | {
1391
+ property: "favorited";
1392
+ checkbox: {
1393
+ equals: boolean;
1394
+ };
1395
+ } | {
1396
+ property: "connections";
1397
+ mcp_server: {
1398
+ contains: string;
1399
+ };
1400
+ } | {
1401
+ property: "status";
1402
+ status: {
1403
+ in: Array<"active" | "disabled" | "deleted">;
1404
+ };
1405
+ } | {
1406
+ property: "model_mode";
1407
+ select: {
1408
+ equals: "auto" | "pinned";
1409
+ };
1410
+ } | {
1411
+ property: "agent_version";
1412
+ number: {
1413
+ equals: number;
1414
+ };
1415
+ } | {
1416
+ property: "last_run_at";
1417
+ date: {
1418
+ after?: string;
1419
+ before?: string;
1420
+ };
1421
+ }>;
1422
+ } | {
1423
+ or: Array<{
1424
+ property: "id";
1425
+ id: {
1426
+ equals: string;
1427
+ };
1428
+ } | {
1429
+ property: "agent_type";
1430
+ string: {
1431
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1432
+ };
1433
+ } | {
1434
+ property: "created_by";
1435
+ people: {
1436
+ contains: string;
1437
+ };
1438
+ } | {
1439
+ property: "created_time";
1440
+ date: {
1441
+ after?: string;
1442
+ before?: string;
1443
+ };
1444
+ } | {
1445
+ property: "favorited";
1446
+ checkbox: {
1447
+ equals: boolean;
1448
+ };
1449
+ } | {
1450
+ property: "connections";
1451
+ mcp_server: {
1452
+ contains: string;
1453
+ };
1454
+ } | {
1455
+ property: "status";
1456
+ status: {
1457
+ in: Array<"active" | "disabled" | "deleted">;
1458
+ };
1459
+ } | {
1460
+ property: "model_mode";
1461
+ select: {
1462
+ equals: "auto" | "pinned";
1463
+ };
1464
+ } | {
1465
+ property: "agent_version";
1466
+ number: {
1467
+ equals: number;
1468
+ };
1469
+ } | {
1470
+ property: "last_run_at";
1471
+ date: {
1472
+ after?: string;
1473
+ before?: string;
1474
+ };
1475
+ }>;
1476
+ }>;
1477
+ } | {
1478
+ or: Array<{
1479
+ property: "id";
1480
+ id: {
1481
+ equals: string;
1482
+ };
1483
+ } | {
1484
+ property: "agent_type";
1485
+ string: {
1486
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1487
+ };
1488
+ } | {
1489
+ property: "created_by";
1490
+ people: {
1491
+ contains: string;
1492
+ };
1493
+ } | {
1494
+ property: "created_time";
1495
+ date: {
1496
+ after?: string;
1497
+ before?: string;
1498
+ };
1499
+ } | {
1500
+ property: "favorited";
1501
+ checkbox: {
1502
+ equals: boolean;
1503
+ };
1504
+ } | {
1505
+ property: "connections";
1506
+ mcp_server: {
1507
+ contains: string;
1508
+ };
1509
+ } | {
1510
+ property: "status";
1511
+ status: {
1512
+ in: Array<"active" | "disabled" | "deleted">;
1513
+ };
1514
+ } | {
1515
+ property: "model_mode";
1516
+ select: {
1517
+ equals: "auto" | "pinned";
1518
+ };
1519
+ } | {
1520
+ property: "agent_version";
1521
+ number: {
1522
+ equals: number;
1523
+ };
1524
+ } | {
1525
+ property: "last_run_at";
1526
+ date: {
1527
+ after?: string;
1528
+ before?: string;
1529
+ };
1530
+ } | {
1531
+ and: Array<{
1532
+ property: "id";
1533
+ id: {
1534
+ equals: string;
1535
+ };
1536
+ } | {
1537
+ property: "agent_type";
1538
+ string: {
1539
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1540
+ };
1541
+ } | {
1542
+ property: "created_by";
1543
+ people: {
1544
+ contains: string;
1545
+ };
1546
+ } | {
1547
+ property: "created_time";
1548
+ date: {
1549
+ after?: string;
1550
+ before?: string;
1551
+ };
1552
+ } | {
1553
+ property: "favorited";
1554
+ checkbox: {
1555
+ equals: boolean;
1556
+ };
1557
+ } | {
1558
+ property: "connections";
1559
+ mcp_server: {
1560
+ contains: string;
1561
+ };
1562
+ } | {
1563
+ property: "status";
1564
+ status: {
1565
+ in: Array<"active" | "disabled" | "deleted">;
1566
+ };
1567
+ } | {
1568
+ property: "model_mode";
1569
+ select: {
1570
+ equals: "auto" | "pinned";
1571
+ };
1572
+ } | {
1573
+ property: "agent_version";
1574
+ number: {
1575
+ equals: number;
1576
+ };
1577
+ } | {
1578
+ property: "last_run_at";
1579
+ date: {
1580
+ after?: string;
1581
+ before?: string;
1582
+ };
1583
+ }>;
1584
+ } | {
1585
+ or: Array<{
1586
+ property: "id";
1587
+ id: {
1588
+ equals: string;
1589
+ };
1590
+ } | {
1591
+ property: "agent_type";
1592
+ string: {
1593
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1594
+ };
1595
+ } | {
1596
+ property: "created_by";
1597
+ people: {
1598
+ contains: string;
1599
+ };
1600
+ } | {
1601
+ property: "created_time";
1602
+ date: {
1603
+ after?: string;
1604
+ before?: string;
1605
+ };
1606
+ } | {
1607
+ property: "favorited";
1608
+ checkbox: {
1609
+ equals: boolean;
1610
+ };
1611
+ } | {
1612
+ property: "connections";
1613
+ mcp_server: {
1614
+ contains: string;
1615
+ };
1616
+ } | {
1617
+ property: "status";
1618
+ status: {
1619
+ in: Array<"active" | "disabled" | "deleted">;
1620
+ };
1621
+ } | {
1622
+ property: "model_mode";
1623
+ select: {
1624
+ equals: "auto" | "pinned";
1625
+ };
1626
+ } | {
1627
+ property: "agent_version";
1628
+ number: {
1629
+ equals: number;
1630
+ };
1631
+ } | {
1632
+ property: "last_run_at";
1633
+ date: {
1634
+ after?: string;
1635
+ before?: string;
1636
+ };
1637
+ }>;
1638
+ }>;
1639
+ };
1640
+ sorts?: Array<{
1641
+ property: "created_time" | "last_run_at";
1642
+ direction: "ascending" | "descending";
1643
+ }>;
1644
+ start_cursor?: string | null;
1645
+ page_size?: number;
1646
+ verbose?: boolean;
1647
+ include_deleted?: boolean;
1648
+ };
1649
+ export type QueryAgentsParameters = QueryAgentsBodyParameters;
1650
+ export type QueryAgentsResponse = {
1651
+ object: "list";
1652
+ type: "agent";
1653
+ results: Array<{
1654
+ object: "agent";
1655
+ id: IdResponse;
1656
+ agent_type: "custom_agent" | "autofill_custom_agent";
1657
+ name: string;
1658
+ description: string | null;
1659
+ instructions_page_id: IdResponse | null;
1660
+ icon: PageIconResponse | {
1661
+ type: "custom_agent_avatar";
1662
+ custom_agent_avatar: {
1663
+ static_url: string;
1664
+ animated_url: string;
1665
+ };
1666
+ } | null;
1667
+ model: {
1668
+ mode: "auto";
1669
+ } | {
1670
+ mode: "pinned";
1671
+ id: string | null;
1672
+ };
1673
+ connections: Array<{
1674
+ type: "notion";
1675
+ name: string;
1676
+ account: null;
1677
+ permissions: Array<{
1678
+ target: {
1679
+ type: "page";
1680
+ id: string;
1681
+ } | {
1682
+ type: "database_property";
1683
+ data_source_id: string;
1684
+ property_id: string;
1685
+ } | {
1686
+ type: "agent";
1687
+ id: string;
1688
+ } | {
1689
+ type: "workspace";
1690
+ } | {
1691
+ type: "owner_private_pages";
1692
+ } | {
1693
+ type: "web_search";
1694
+ allowed_domains: Array<string> | null;
1695
+ } | {
1696
+ type: "notion_help_docs_search";
1697
+ };
1698
+ scopes: Array<string>;
1699
+ }>;
1700
+ } | {
1701
+ type: "slack";
1702
+ name: string;
1703
+ account: {
1704
+ type: "slack_workspace";
1705
+ team_id: string;
1706
+ } | "hidden" | null;
1707
+ permissions: Array<{
1708
+ target: {
1709
+ type: "slack_channel";
1710
+ id: string;
1711
+ } | {
1712
+ type: "slack_all_public_channels";
1713
+ } | {
1714
+ type: "slack_all_channels";
1715
+ };
1716
+ scopes: Array<string>;
1717
+ }>;
1718
+ } | {
1719
+ type: "discord";
1720
+ name: string;
1721
+ account: {
1722
+ type: "discord_server";
1723
+ id: string;
1724
+ } | "hidden" | null;
1725
+ permissions: Array<{
1726
+ target: {
1727
+ type: "discord_channel";
1728
+ id: string;
1729
+ } | {
1730
+ type: "discord_all_channels";
1731
+ };
1732
+ scopes: Array<string>;
1733
+ }>;
1734
+ } | {
1735
+ type: "mcp_server";
1736
+ name: string;
1737
+ account: {
1738
+ type: "mcp_server";
1739
+ server_host: string;
1740
+ } | "hidden" | null;
1741
+ enabled_tools: Array<{
1742
+ name: string;
1743
+ title: string | null;
1744
+ }> | "hidden" | null;
1745
+ run_tools_automatically: {
1746
+ read: boolean;
1747
+ write: boolean;
1748
+ };
1749
+ } | {
1750
+ type: "custom_mcp_server";
1751
+ name: string;
1752
+ account: {
1753
+ type: "mcp_server";
1754
+ server_host: string;
1755
+ } | "hidden" | null;
1756
+ enabled_tools: Array<{
1757
+ name: string;
1758
+ title: string | null;
1759
+ }> | "hidden" | null;
1760
+ run_tools_automatically: {
1761
+ read: boolean;
1762
+ write: boolean;
1763
+ };
1764
+ } | {
1765
+ type: "asana" | "box" | "browser" | "calendar" | "computer" | "confluence" | "cursor" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
1766
+ name: string;
1767
+ account: string | null;
1768
+ permissions: Array<{
1769
+ target: {
1770
+ type: string;
1771
+ id: string;
1772
+ };
1773
+ scopes: Array<string>;
1774
+ }>;
1775
+ }>;
1776
+ status: "active" | "disabled" | "deleted";
1777
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
1778
+ created_by: {
1779
+ type: "user" | "bot";
1780
+ id: IdResponse;
1781
+ } | null;
1782
+ agent_version: {
1783
+ id: IdResponse;
1784
+ number: number;
1785
+ published_at: string;
1786
+ } | null;
1787
+ created_time: string;
1788
+ last_edited_time: string;
1789
+ last_run_at: string | "hidden" | null;
1790
+ credit_limit: number | "hidden" | null;
1791
+ triggers: Array<{
1792
+ type: string;
1793
+ enabled: boolean;
1794
+ schedule?: {
1795
+ frequency: string;
1796
+ interval: number;
1797
+ weekdays?: Array<string>;
1798
+ monthdays?: Array<number>;
1799
+ week_numbers?: Array<number>;
1800
+ hour?: number;
1801
+ minute?: number;
1802
+ timezone?: string;
1803
+ start_date?: string;
1804
+ end?: {
1805
+ type: "date";
1806
+ end_at: string;
1807
+ } | {
1808
+ type: "count";
1809
+ occurrences: number;
1810
+ };
1811
+ };
1812
+ config?: Record<string, Record<string, never>>;
1813
+ }>;
1814
+ instructions?: string | null;
1815
+ } | {
1816
+ object: "agent";
1817
+ id: "notion_ai";
1818
+ agent_type: "notion_ai";
1819
+ name: string;
1820
+ description: null;
1821
+ instructions_page_id: null;
1822
+ icon: PageIconResponse | {
1823
+ type: "custom_agent_avatar";
1824
+ custom_agent_avatar: {
1825
+ static_url: string;
1826
+ animated_url: string;
1827
+ };
1828
+ };
1829
+ model: {
1830
+ mode: "auto";
1831
+ } | {
1832
+ mode: "pinned";
1833
+ id: string | null;
1834
+ };
1835
+ connections: Array<{
1836
+ type: "notion";
1837
+ name: string;
1838
+ account: null;
1839
+ permissions: Array<{
1840
+ target: {
1841
+ type: "page";
1842
+ id: string;
1843
+ } | {
1844
+ type: "database_property";
1845
+ data_source_id: string;
1846
+ property_id: string;
1847
+ } | {
1848
+ type: "agent";
1849
+ id: string;
1850
+ } | {
1851
+ type: "workspace";
1852
+ } | {
1853
+ type: "owner_private_pages";
1854
+ } | {
1855
+ type: "web_search";
1856
+ allowed_domains: Array<string> | null;
1857
+ } | {
1858
+ type: "notion_help_docs_search";
1859
+ };
1860
+ scopes: Array<string>;
1861
+ }>;
1862
+ } | {
1863
+ type: "slack";
1864
+ name: string;
1865
+ account: {
1866
+ type: "slack_workspace";
1867
+ team_id: string;
1868
+ } | "hidden" | null;
1869
+ permissions: Array<{
1870
+ target: {
1871
+ type: "slack_channel";
1872
+ id: string;
1873
+ } | {
1874
+ type: "slack_all_public_channels";
1875
+ } | {
1876
+ type: "slack_all_channels";
1877
+ };
1878
+ scopes: Array<string>;
1879
+ }>;
1880
+ } | {
1881
+ type: "discord";
1882
+ name: string;
1883
+ account: {
1884
+ type: "discord_server";
1885
+ id: string;
1886
+ } | "hidden" | null;
1887
+ permissions: Array<{
1888
+ target: {
1889
+ type: "discord_channel";
1890
+ id: string;
1891
+ } | {
1892
+ type: "discord_all_channels";
1893
+ };
1894
+ scopes: Array<string>;
1895
+ }>;
1896
+ } | {
1897
+ type: "mcp_server";
1898
+ name: string;
1899
+ account: {
1900
+ type: "mcp_server";
1901
+ server_host: string;
1902
+ } | "hidden" | null;
1903
+ enabled_tools: Array<{
1904
+ name: string;
1905
+ title: string | null;
1906
+ }> | "hidden" | null;
1907
+ run_tools_automatically: {
1908
+ read: boolean;
1909
+ write: boolean;
1910
+ };
1911
+ } | {
1912
+ type: "custom_mcp_server";
1913
+ name: string;
1914
+ account: {
1915
+ type: "mcp_server";
1916
+ server_host: string;
1917
+ } | "hidden" | null;
1918
+ enabled_tools: Array<{
1919
+ name: string;
1920
+ title: string | null;
1921
+ }> | "hidden" | null;
1922
+ run_tools_automatically: {
1923
+ read: boolean;
1924
+ write: boolean;
1925
+ };
1926
+ } | {
1927
+ type: "asana" | "box" | "browser" | "calendar" | "computer" | "confluence" | "cursor" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
1928
+ name: string;
1929
+ account: string | null;
1930
+ permissions: Array<{
1931
+ target: {
1932
+ type: string;
1933
+ id: string;
1934
+ };
1935
+ scopes: Array<string>;
1936
+ }>;
1937
+ }>;
1938
+ status: "active";
1939
+ pause_reason: null;
1940
+ created_by: null;
1941
+ agent_version: null;
1942
+ created_time: null;
1943
+ last_edited_time: null;
1944
+ last_run_at: null;
1945
+ credit_limit: null;
1946
+ triggers: Array<{
1947
+ type: string;
1948
+ enabled: boolean;
1949
+ schedule?: {
1950
+ frequency: string;
1951
+ interval: number;
1952
+ weekdays?: Array<string>;
1953
+ monthdays?: Array<number>;
1954
+ week_numbers?: Array<number>;
1955
+ hour?: number;
1956
+ minute?: number;
1957
+ timezone?: string;
1958
+ start_date?: string;
1959
+ end?: {
1960
+ type: "date";
1961
+ end_at: string;
1962
+ } | {
1963
+ type: "count";
1964
+ occurrences: number;
1965
+ };
1966
+ };
1967
+ config?: Record<string, Record<string, never>>;
1968
+ }>;
1969
+ }>;
1970
+ has_more: boolean;
1971
+ next_cursor: string | null;
1972
+ };
1973
+ /**
1974
+ * Query agents
1975
+ */
1976
+ export declare const queryAgents: {
1977
+ readonly method: "post";
1978
+ readonly pathParams: readonly [];
1979
+ readonly queryParams: readonly [];
1980
+ readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size", "verbose", "include_deleted"];
1981
+ readonly path: () => string;
1982
+ };
1983
+ type QuerySessionEventsPathParameters = {
1984
+ session_id: IdRequest;
1985
+ };
1986
+ type QuerySessionEventsBodyParameters = {
1987
+ filter?: {
1988
+ property: "id";
1989
+ string: {
1990
+ equals: string;
1991
+ };
1992
+ } | {
1993
+ property: "type";
1994
+ event_type: {
1995
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1996
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1997
+ };
1998
+ } | {
1999
+ property: "sequence";
2000
+ number: {
2001
+ greater_than?: number;
2002
+ greater_than_or_equal_to?: number;
2003
+ less_than?: number;
2004
+ less_than_or_equal_to?: number;
2005
+ };
2006
+ } | {
2007
+ property: "created_at";
2008
+ timestamp: {
2009
+ equals?: string;
2010
+ before?: string;
2011
+ after?: string;
2012
+ on_or_before?: string;
2013
+ on_or_after?: string;
2014
+ };
2015
+ } | {
2016
+ and: Array<{
2017
+ property: "id";
2018
+ string: {
2019
+ equals: string;
2020
+ };
2021
+ } | {
2022
+ property: "type";
2023
+ event_type: {
2024
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2025
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2026
+ };
2027
+ } | {
2028
+ property: "sequence";
2029
+ number: {
2030
+ greater_than?: number;
2031
+ greater_than_or_equal_to?: number;
2032
+ less_than?: number;
2033
+ less_than_or_equal_to?: number;
2034
+ };
2035
+ } | {
2036
+ property: "created_at";
2037
+ timestamp: {
2038
+ equals?: string;
2039
+ before?: string;
2040
+ after?: string;
2041
+ on_or_before?: string;
2042
+ on_or_after?: string;
2043
+ };
2044
+ } | {
2045
+ and: Array<{
2046
+ property: "id";
2047
+ string: {
2048
+ equals: string;
2049
+ };
2050
+ } | {
2051
+ property: "type";
2052
+ event_type: {
2053
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2054
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2055
+ };
2056
+ } | {
2057
+ property: "sequence";
2058
+ number: {
2059
+ greater_than?: number;
2060
+ greater_than_or_equal_to?: number;
2061
+ less_than?: number;
2062
+ less_than_or_equal_to?: number;
2063
+ };
2064
+ } | {
2065
+ property: "created_at";
2066
+ timestamp: {
2067
+ equals?: string;
2068
+ before?: string;
2069
+ after?: string;
2070
+ on_or_before?: string;
2071
+ on_or_after?: string;
2072
+ };
2073
+ } | {
2074
+ and: Array<{
2075
+ property: "id";
2076
+ string: {
2077
+ equals: string;
2078
+ };
2079
+ } | {
2080
+ property: "type";
2081
+ event_type: {
2082
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2083
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2084
+ };
2085
+ } | {
2086
+ property: "sequence";
2087
+ number: {
2088
+ greater_than?: number;
2089
+ greater_than_or_equal_to?: number;
2090
+ less_than?: number;
2091
+ less_than_or_equal_to?: number;
2092
+ };
2093
+ } | {
2094
+ property: "created_at";
2095
+ timestamp: {
2096
+ equals?: string;
2097
+ before?: string;
2098
+ after?: string;
2099
+ on_or_before?: string;
2100
+ on_or_after?: string;
2101
+ };
2102
+ }>;
2103
+ } | {
2104
+ or: Array<{
2105
+ property: "id";
2106
+ string: {
2107
+ equals: string;
2108
+ };
2109
+ } | {
2110
+ property: "type";
2111
+ event_type: {
2112
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2113
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2114
+ };
2115
+ } | {
2116
+ property: "sequence";
2117
+ number: {
2118
+ greater_than?: number;
2119
+ greater_than_or_equal_to?: number;
2120
+ less_than?: number;
2121
+ less_than_or_equal_to?: number;
2122
+ };
2123
+ } | {
2124
+ property: "created_at";
2125
+ timestamp: {
2126
+ equals?: string;
2127
+ before?: string;
2128
+ after?: string;
2129
+ on_or_before?: string;
2130
+ on_or_after?: string;
2131
+ };
2132
+ }>;
2133
+ }>;
2134
+ } | {
2135
+ or: Array<{
2136
+ property: "id";
2137
+ string: {
2138
+ equals: string;
2139
+ };
2140
+ } | {
2141
+ property: "type";
2142
+ event_type: {
2143
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2144
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2145
+ };
2146
+ } | {
2147
+ property: "sequence";
2148
+ number: {
2149
+ greater_than?: number;
2150
+ greater_than_or_equal_to?: number;
2151
+ less_than?: number;
2152
+ less_than_or_equal_to?: number;
2153
+ };
2154
+ } | {
2155
+ property: "created_at";
2156
+ timestamp: {
2157
+ equals?: string;
2158
+ before?: string;
2159
+ after?: string;
2160
+ on_or_before?: string;
2161
+ on_or_after?: string;
2162
+ };
2163
+ } | {
2164
+ and: Array<{
2165
+ property: "id";
2166
+ string: {
2167
+ equals: string;
2168
+ };
2169
+ } | {
2170
+ property: "type";
2171
+ event_type: {
2172
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2173
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2174
+ };
2175
+ } | {
2176
+ property: "sequence";
2177
+ number: {
2178
+ greater_than?: number;
2179
+ greater_than_or_equal_to?: number;
2180
+ less_than?: number;
2181
+ less_than_or_equal_to?: number;
2182
+ };
2183
+ } | {
2184
+ property: "created_at";
2185
+ timestamp: {
2186
+ equals?: string;
2187
+ before?: string;
2188
+ after?: string;
2189
+ on_or_before?: string;
2190
+ on_or_after?: string;
2191
+ };
2192
+ }>;
2193
+ } | {
2194
+ or: Array<{
2195
+ property: "id";
2196
+ string: {
2197
+ equals: string;
2198
+ };
2199
+ } | {
2200
+ property: "type";
2201
+ event_type: {
2202
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2203
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2204
+ };
2205
+ } | {
2206
+ property: "sequence";
2207
+ number: {
2208
+ greater_than?: number;
2209
+ greater_than_or_equal_to?: number;
2210
+ less_than?: number;
2211
+ less_than_or_equal_to?: number;
2212
+ };
2213
+ } | {
2214
+ property: "created_at";
2215
+ timestamp: {
2216
+ equals?: string;
2217
+ before?: string;
2218
+ after?: string;
2219
+ on_or_before?: string;
2220
+ on_or_after?: string;
2221
+ };
2222
+ }>;
2223
+ }>;
2224
+ }>;
2225
+ } | {
2226
+ or: Array<{
2227
+ property: "id";
2228
+ string: {
2229
+ equals: string;
2230
+ };
2231
+ } | {
2232
+ property: "type";
2233
+ event_type: {
2234
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2235
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2236
+ };
2237
+ } | {
2238
+ property: "sequence";
2239
+ number: {
2240
+ greater_than?: number;
2241
+ greater_than_or_equal_to?: number;
2242
+ less_than?: number;
2243
+ less_than_or_equal_to?: number;
2244
+ };
2245
+ } | {
2246
+ property: "created_at";
2247
+ timestamp: {
2248
+ equals?: string;
2249
+ before?: string;
2250
+ after?: string;
2251
+ on_or_before?: string;
2252
+ on_or_after?: string;
2253
+ };
2254
+ } | {
2255
+ and: Array<{
2256
+ property: "id";
2257
+ string: {
2258
+ equals: string;
2259
+ };
2260
+ } | {
2261
+ property: "type";
2262
+ event_type: {
2263
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2264
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2265
+ };
2266
+ } | {
2267
+ property: "sequence";
2268
+ number: {
2269
+ greater_than?: number;
2270
+ greater_than_or_equal_to?: number;
2271
+ less_than?: number;
2272
+ less_than_or_equal_to?: number;
2273
+ };
2274
+ } | {
2275
+ property: "created_at";
2276
+ timestamp: {
2277
+ equals?: string;
2278
+ before?: string;
2279
+ after?: string;
2280
+ on_or_before?: string;
2281
+ on_or_after?: string;
2282
+ };
2283
+ } | {
2284
+ and: Array<{
2285
+ property: "id";
2286
+ string: {
2287
+ equals: string;
2288
+ };
2289
+ } | {
2290
+ property: "type";
2291
+ event_type: {
2292
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2293
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2294
+ };
2295
+ } | {
2296
+ property: "sequence";
2297
+ number: {
2298
+ greater_than?: number;
2299
+ greater_than_or_equal_to?: number;
2300
+ less_than?: number;
2301
+ less_than_or_equal_to?: number;
2302
+ };
2303
+ } | {
2304
+ property: "created_at";
2305
+ timestamp: {
2306
+ equals?: string;
2307
+ before?: string;
2308
+ after?: string;
2309
+ on_or_before?: string;
2310
+ on_or_after?: string;
2311
+ };
2312
+ }>;
2313
+ } | {
2314
+ or: Array<{
2315
+ property: "id";
2316
+ string: {
2317
+ equals: string;
2318
+ };
2319
+ } | {
2320
+ property: "type";
2321
+ event_type: {
2322
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2323
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2324
+ };
2325
+ } | {
2326
+ property: "sequence";
2327
+ number: {
2328
+ greater_than?: number;
2329
+ greater_than_or_equal_to?: number;
2330
+ less_than?: number;
2331
+ less_than_or_equal_to?: number;
2332
+ };
2333
+ } | {
2334
+ property: "created_at";
2335
+ timestamp: {
2336
+ equals?: string;
2337
+ before?: string;
2338
+ after?: string;
2339
+ on_or_before?: string;
2340
+ on_or_after?: string;
2341
+ };
2342
+ }>;
2343
+ }>;
2344
+ } | {
2345
+ or: Array<{
2346
+ property: "id";
2347
+ string: {
2348
+ equals: string;
2349
+ };
2350
+ } | {
2351
+ property: "type";
2352
+ event_type: {
2353
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2354
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2355
+ };
2356
+ } | {
2357
+ property: "sequence";
2358
+ number: {
2359
+ greater_than?: number;
2360
+ greater_than_or_equal_to?: number;
2361
+ less_than?: number;
2362
+ less_than_or_equal_to?: number;
2363
+ };
2364
+ } | {
2365
+ property: "created_at";
2366
+ timestamp: {
2367
+ equals?: string;
2368
+ before?: string;
2369
+ after?: string;
2370
+ on_or_before?: string;
2371
+ on_or_after?: string;
2372
+ };
2373
+ } | {
2374
+ and: Array<{
2375
+ property: "id";
2376
+ string: {
2377
+ equals: string;
2378
+ };
2379
+ } | {
2380
+ property: "type";
2381
+ event_type: {
2382
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2383
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2384
+ };
2385
+ } | {
2386
+ property: "sequence";
2387
+ number: {
2388
+ greater_than?: number;
2389
+ greater_than_or_equal_to?: number;
2390
+ less_than?: number;
2391
+ less_than_or_equal_to?: number;
2392
+ };
2393
+ } | {
2394
+ property: "created_at";
2395
+ timestamp: {
2396
+ equals?: string;
2397
+ before?: string;
2398
+ after?: string;
2399
+ on_or_before?: string;
2400
+ on_or_after?: string;
2401
+ };
2402
+ }>;
2403
+ } | {
2404
+ or: Array<{
2405
+ property: "id";
2406
+ string: {
2407
+ equals: string;
2408
+ };
2409
+ } | {
2410
+ property: "type";
2411
+ event_type: {
2412
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
2413
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
2414
+ };
2415
+ } | {
2416
+ property: "sequence";
2417
+ number: {
2418
+ greater_than?: number;
2419
+ greater_than_or_equal_to?: number;
2420
+ less_than?: number;
2421
+ less_than_or_equal_to?: number;
2422
+ };
2423
+ } | {
2424
+ property: "created_at";
2425
+ timestamp: {
2426
+ equals?: string;
2427
+ before?: string;
2428
+ after?: string;
2429
+ on_or_before?: string;
2430
+ on_or_after?: string;
2431
+ };
2432
+ }>;
2433
+ }>;
2434
+ }>;
2435
+ };
2436
+ sorts?: Array<{
2437
+ property: "sequence" | "created_at";
2438
+ direction: "ascending" | "descending";
2439
+ }>;
2440
+ start_cursor?: string | null;
2441
+ page_size?: number;
2442
+ };
2443
+ export type QuerySessionEventsParameters = QuerySessionEventsPathParameters & QuerySessionEventsBodyParameters;
2444
+ export type QuerySessionEventsResponse = {
2445
+ object: "list";
2446
+ type: "session_event";
2447
+ session_event: Record<string, never>;
2448
+ results: Array<{
2449
+ object: "session_event";
2450
+ id: string;
2451
+ session_id: string;
2452
+ sequence: number;
2453
+ created_at: string;
2454
+ type: "user.message";
2455
+ content: Array<{
2456
+ type: "text";
2457
+ text: string;
2458
+ } | {
2459
+ type: "file";
2460
+ name: string;
2461
+ content_type: string;
2462
+ url: string;
2463
+ expiry_time?: string;
2464
+ }>;
2465
+ created_by: {
2466
+ id: string;
2467
+ type: "user" | "bot";
2468
+ } | null;
2469
+ metadata: Record<string, string> | null;
2470
+ } | {
2471
+ object: "session_event";
2472
+ id: string;
2473
+ session_id: string;
2474
+ sequence: number;
2475
+ created_at: string;
2476
+ type: "agent.message";
2477
+ content: Array<{
2478
+ type: "text";
2479
+ text: string;
2480
+ } | {
2481
+ type: "file";
2482
+ name: string;
2483
+ content_type: string;
2484
+ url: string;
2485
+ expiry_time?: string;
2486
+ }>;
2487
+ created_by: {
2488
+ id: string;
2489
+ type: "user" | "bot";
2490
+ } | null;
2491
+ metadata: {
2492
+ model: string;
2493
+ } | null;
2494
+ } | {
2495
+ object: "session_event";
2496
+ id: string;
2497
+ session_id: string;
2498
+ sequence: number;
2499
+ created_at: string;
2500
+ type: "agent.thinking";
2501
+ content: Array<{
2502
+ type: "text";
2503
+ text: string;
2504
+ }>;
2505
+ } | {
2506
+ object: "session_event";
2507
+ id: string;
2508
+ session_id: string;
2509
+ sequence: number;
2510
+ created_at: string;
2511
+ type: "agent.tool_use";
2512
+ tool_name: string;
2513
+ } | {
2514
+ object: "session_event";
2515
+ id: string;
2516
+ session_id: string;
2517
+ sequence: number;
2518
+ created_at: string;
2519
+ type: "agent.tool_result";
2520
+ tool_use_id: string;
2521
+ tool_name: string;
2522
+ is_error: boolean;
2523
+ } | {
2524
+ object: "session_event";
2525
+ id: string;
2526
+ session_id: string;
2527
+ sequence: number;
2528
+ created_at: string;
2529
+ type: "session.status";
2530
+ status: "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2531
+ required_actions?: Array<{
2532
+ action_id: string;
2533
+ title: string;
2534
+ options: Array<{
2535
+ id: "approve" | "reject";
2536
+ label: string;
2537
+ }>;
2538
+ }>;
2539
+ error?: {
2540
+ code: string;
2541
+ message: string;
2542
+ retryable: boolean;
2543
+ };
2544
+ }>;
2545
+ has_more: boolean;
2546
+ next_cursor: string | null;
2547
+ };
2548
+ /**
2549
+ * Query session events
2550
+ */
2551
+ export declare const querySessionEvents: {
2552
+ readonly method: "post";
2553
+ readonly pathParams: readonly ["session_id"];
2554
+ readonly queryParams: readonly [];
2555
+ readonly bodyParams: readonly ["filter", "sorts", "start_cursor", "page_size"];
2556
+ readonly path: (p: QuerySessionEventsPathParameters) => string;
2557
+ };
2558
+ type QuerySessionsBodyParameters = {
2559
+ query?: string;
2560
+ filter?: {
2561
+ property: "id";
2562
+ string: {
2563
+ equals: string;
2564
+ };
2565
+ } | {
2566
+ property: "agent_id";
2567
+ string: {
2568
+ equals: string;
2569
+ };
2570
+ } | {
2571
+ property: "status";
2572
+ status: {
2573
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2574
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2575
+ };
2576
+ } | {
2577
+ property: "created_at" | "updated_at";
2578
+ timestamp: {
2579
+ before?: string;
2580
+ after?: string;
2581
+ on_or_before?: string;
2582
+ on_or_after?: string;
2583
+ };
2584
+ } | {
2585
+ and: Array<{
2586
+ property: "id";
2587
+ string: {
2588
+ equals: string;
2589
+ };
2590
+ } | {
2591
+ property: "agent_id";
2592
+ string: {
2593
+ equals: string;
2594
+ };
2595
+ } | {
2596
+ property: "status";
2597
+ status: {
2598
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2599
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2600
+ };
2601
+ } | {
2602
+ property: "created_at" | "updated_at";
2603
+ timestamp: {
2604
+ before?: string;
2605
+ after?: string;
2606
+ on_or_before?: string;
2607
+ on_or_after?: string;
2608
+ };
2609
+ } | {
2610
+ and: Array<{
2611
+ property: "id";
2612
+ string: {
2613
+ equals: string;
2614
+ };
2615
+ } | {
2616
+ property: "agent_id";
2617
+ string: {
2618
+ equals: string;
2619
+ };
2620
+ } | {
2621
+ property: "status";
2622
+ status: {
2623
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2624
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2625
+ };
2626
+ } | {
2627
+ property: "created_at" | "updated_at";
2628
+ timestamp: {
2629
+ before?: string;
2630
+ after?: string;
2631
+ on_or_before?: string;
2632
+ on_or_after?: string;
2633
+ };
2634
+ }>;
2635
+ } | {
2636
+ or: Array<{
2637
+ property: "id";
2638
+ string: {
2639
+ equals: string;
2640
+ };
2641
+ } | {
2642
+ property: "agent_id";
2643
+ string: {
2644
+ equals: string;
2645
+ };
2646
+ } | {
2647
+ property: "status";
2648
+ status: {
2649
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2650
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2651
+ };
2652
+ } | {
2653
+ property: "created_at" | "updated_at";
2654
+ timestamp: {
2655
+ before?: string;
2656
+ after?: string;
2657
+ on_or_before?: string;
2658
+ on_or_after?: string;
2659
+ };
2660
+ }>;
2661
+ }>;
2662
+ } | {
2663
+ or: Array<{
2664
+ property: "id";
2665
+ string: {
2666
+ equals: string;
2667
+ };
2668
+ } | {
2669
+ property: "agent_id";
2670
+ string: {
2671
+ equals: string;
2672
+ };
2673
+ } | {
2674
+ property: "status";
2675
+ status: {
2676
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2677
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2678
+ };
2679
+ } | {
2680
+ property: "created_at" | "updated_at";
2681
+ timestamp: {
2682
+ before?: string;
2683
+ after?: string;
2684
+ on_or_before?: string;
2685
+ on_or_after?: string;
2686
+ };
2687
+ } | {
2688
+ and: Array<{
2689
+ property: "id";
2690
+ string: {
2691
+ equals: string;
2692
+ };
2693
+ } | {
2694
+ property: "agent_id";
2695
+ string: {
2696
+ equals: string;
2697
+ };
2698
+ } | {
2699
+ property: "status";
2700
+ status: {
2701
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2702
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2703
+ };
2704
+ } | {
2705
+ property: "created_at" | "updated_at";
2706
+ timestamp: {
2707
+ before?: string;
2708
+ after?: string;
2709
+ on_or_before?: string;
2710
+ on_or_after?: string;
2711
+ };
2712
+ }>;
2713
+ } | {
2714
+ or: Array<{
2715
+ property: "id";
2716
+ string: {
2717
+ equals: string;
2718
+ };
2719
+ } | {
2720
+ property: "agent_id";
2721
+ string: {
2722
+ equals: string;
2723
+ };
2724
+ } | {
2725
+ property: "status";
2726
+ status: {
2727
+ equals?: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2728
+ in?: Array<"queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated">;
2729
+ };
2730
+ } | {
2731
+ property: "created_at" | "updated_at";
2732
+ timestamp: {
2733
+ before?: string;
2734
+ after?: string;
2735
+ on_or_before?: string;
2736
+ on_or_after?: string;
2737
+ };
2738
+ }>;
2739
+ }>;
2740
+ };
2741
+ sorts?: Array<{
2742
+ property: "created_at" | "updated_at";
2743
+ direction: "ascending" | "descending";
2744
+ }>;
2745
+ start_cursor?: string | null;
2746
+ page_size?: number;
2747
+ };
2748
+ export type QuerySessionsParameters = QuerySessionsBodyParameters;
2749
+ export type QuerySessionsResponse = {
2750
+ object: "list";
2751
+ type: "session";
2752
+ session: Record<string, never>;
2753
+ results: Array<{
2754
+ object: "session";
2755
+ id: string;
2756
+ agent_id: string;
2757
+ title: string;
2758
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2759
+ created_by: {
2760
+ id: string;
2761
+ type: "user" | "bot";
2762
+ };
2763
+ agent_version: {
2764
+ id: string;
2765
+ number: number;
2766
+ published_at: string;
2767
+ } | null;
2768
+ models: {
2769
+ type: "auto";
2770
+ } | {
2771
+ type: "pinned";
2772
+ ids: Array<string | null>;
2773
+ };
2774
+ created_at: string;
2775
+ updated_at: string;
2776
+ required_actions?: Array<{
2777
+ action_id: string;
2778
+ title: string;
2779
+ options: Array<{
2780
+ id: "approve" | "reject";
2781
+ label: string;
2782
+ }>;
2783
+ }>;
2784
+ error?: {
2785
+ code: string;
2786
+ message: string;
2787
+ retryable: boolean;
2788
+ };
2789
+ trigger_type?: string;
2790
+ type_labels?: Array<string> | null;
2791
+ chat_user_emails?: Array<string> | null;
2792
+ tool_types?: Array<string> | null;
2793
+ tool_call_count?: number | null;
2794
+ credits_used?: number | null;
2795
+ runs_completed?: number | null;
2796
+ message_count?: number | null;
2797
+ }>;
2798
+ has_more: boolean;
2799
+ next_cursor: string | null;
2800
+ };
2801
+ /**
2802
+ * Query sessions
2803
+ */
2804
+ export declare const querySessions: {
2805
+ readonly method: "post";
2806
+ readonly pathParams: readonly [];
2807
+ readonly queryParams: readonly [];
2808
+ readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size"];
2809
+ readonly path: () => string;
2810
+ };
2811
+ type QueryThreadMessagesPathParameters = {
2812
+ thread_id: IdRequest;
2813
+ };
2814
+ type QueryThreadMessagesBodyParameters = {
2815
+ verbose?: boolean;
2816
+ start_cursor?: string | null;
2817
+ page_size?: number;
2818
+ };
2819
+ export type QueryThreadMessagesParameters = QueryThreadMessagesPathParameters & QueryThreadMessagesBodyParameters;
2820
+ export type QueryThreadMessagesResponse = {
2821
+ object: "list";
2822
+ type: "thread_message";
2823
+ results: Array<{
2824
+ object: "thread_message";
2825
+ id: IdResponse;
2826
+ role: "user" | "agent";
2827
+ content: string;
2828
+ created_time: string;
2829
+ parent: {
2830
+ type: "thread";
2831
+ id: IdResponse;
2832
+ };
2833
+ attachments?: Array<{
2834
+ name: string;
2835
+ content_type: string;
2836
+ url: string;
2837
+ expiry_time?: string;
2838
+ }>;
2839
+ content_parts?: Array<{
2840
+ type: "text";
2841
+ text: string;
2842
+ } | {
2843
+ type: "thinking";
2844
+ text: string;
2845
+ } | {
2846
+ type: "tool_call";
2847
+ tool_call_id: string | null;
2848
+ tool_name: string;
2849
+ results?: Array<{
2850
+ id: IdResponse;
2851
+ agent_step_id: IdResponse | null;
2852
+ tool_call_id: string | null;
2853
+ tool_name: string;
2854
+ tool_type: string;
2855
+ state: string;
2856
+ started_at: number;
2857
+ finished_at: number | null;
2858
+ duration_ms: number | null;
2859
+ }>;
2860
+ } | {
2861
+ type: "follow_ups";
2862
+ follow_ups: Array<{
2863
+ label: string;
2864
+ message: string;
2865
+ }>;
2866
+ } | {
2867
+ type: "custom_agent_template_picker";
2868
+ }>;
2869
+ pending_user_actions?: Array<{
2870
+ id: IdResponse;
2871
+ type: "tool_confirmation";
2872
+ title: string;
2873
+ requirements: Array<{
2874
+ type: "general";
2875
+ } | {
2876
+ type: "manage_workers";
2877
+ } | {
2878
+ type: "url_safety";
2879
+ urls: Array<string>;
2880
+ required_by_workspace_policy?: boolean;
2881
+ } | {
2882
+ type: "permission_escalation";
2883
+ destination_title?: string;
2884
+ source_titles?: Array<string>;
2885
+ } | {
2886
+ type: "delete_content";
2887
+ page_count: number;
2888
+ database_count: number;
2889
+ meeting_notes_block_count?: number;
2890
+ } | {
2891
+ type: "connect_integration";
2892
+ integration_type: string;
2893
+ integration_name: string;
2894
+ handoff_url: string;
2895
+ } | {
2896
+ type: "admin_mode";
2897
+ explanation?: string;
2898
+ }>;
2899
+ options: Array<{
2900
+ id: "approve";
2901
+ label: string;
2902
+ } | {
2903
+ id: "reject";
2904
+ label: string;
2905
+ } | {
2906
+ id: "use_connection";
2907
+ label: string;
2908
+ input: {
2909
+ type: "connection_id";
2910
+ required: true;
2911
+ };
2912
+ }>;
2913
+ }>;
2914
+ }>;
2915
+ has_more: boolean;
2916
+ next_cursor: string | null;
2917
+ };
2918
+ /**
2919
+ * Query thread messages
2920
+ */
2921
+ export declare const queryThreadMessages: {
2922
+ readonly method: "post";
2923
+ readonly pathParams: readonly ["thread_id"];
2924
+ readonly queryParams: readonly [];
2925
+ readonly bodyParams: readonly ["verbose", "start_cursor", "page_size"];
2926
+ readonly path: (p: QueryThreadMessagesPathParameters) => string;
2927
+ };
2928
+ type QueryThreadsPathParameters = {
2929
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
2930
+ };
2931
+ type QueryThreadsBodyParameters = {
2932
+ query?: string;
2933
+ filter?: {
2934
+ id?: IdRequest;
2935
+ status?: Array<"all" | "pending" | "in_progress" | "failed" | "success">;
2936
+ created_by?: Array<IdRequest | "me">;
2937
+ last_used_by?: Array<IdRequest | "me">;
2938
+ message_time?: {
2939
+ start?: string;
2940
+ end?: string;
2941
+ };
2942
+ };
2943
+ sorts?: Array<{
2944
+ timestamp: "created_time" | "last_used_time";
2945
+ direction: "ascending" | "descending";
2946
+ }>;
2947
+ start_cursor?: string | null;
2948
+ page_size?: number;
2949
+ };
2950
+ export type QueryThreadsParameters = QueryThreadsPathParameters & QueryThreadsBodyParameters;
2951
+ export type QueryThreadsResponse = {
2952
+ object: "list";
2953
+ type: "thread";
2954
+ results: Array<{
2955
+ object: "thread";
2956
+ id: IdResponse;
2957
+ title: string;
2958
+ status: "pending" | "requires_action" | "completed" | "canceled" | "failed";
2959
+ created_time: string;
2960
+ last_edited_time: string;
2961
+ created_by: {
2962
+ id: IdResponse;
2963
+ type: "bot" | "user";
2964
+ };
2965
+ agent_version: {
2966
+ id: IdResponse;
2967
+ number: number;
2968
+ published_at: string;
2969
+ } | null;
2970
+ models: {
2971
+ type: "auto";
2972
+ } | {
2973
+ type: "pinned";
2974
+ ids: Array<string | null>;
2975
+ };
2976
+ error?: string;
2977
+ trigger_type?: string;
2978
+ type_labels?: Array<string> | null;
2979
+ chat_user_emails?: Array<string> | null;
2980
+ tool_types?: Array<string> | null;
2981
+ tool_call_count?: number | null;
2982
+ credits_used?: number | null;
2983
+ runs_completed?: number | null;
2984
+ pending_user_actions?: Array<{
2985
+ id: IdResponse;
2986
+ type: "tool_confirmation";
2987
+ title: string;
2988
+ requirements: Array<{
2989
+ type: "general";
2990
+ } | {
2991
+ type: "manage_workers";
2992
+ } | {
2993
+ type: "url_safety";
2994
+ urls: Array<string>;
2995
+ required_by_workspace_policy?: boolean;
2996
+ } | {
2997
+ type: "permission_escalation";
2998
+ destination_title?: string;
2999
+ source_titles?: Array<string>;
3000
+ } | {
3001
+ type: "delete_content";
3002
+ page_count: number;
3003
+ database_count: number;
3004
+ meeting_notes_block_count?: number;
3005
+ } | {
3006
+ type: "connect_integration";
3007
+ integration_type: string;
3008
+ integration_name: string;
3009
+ handoff_url: string;
3010
+ } | {
3011
+ type: "admin_mode";
3012
+ explanation?: string;
3013
+ }>;
3014
+ options: Array<{
3015
+ id: "approve";
3016
+ label: string;
3017
+ } | {
3018
+ id: "reject";
3019
+ label: string;
3020
+ } | {
3021
+ id: "use_connection";
3022
+ label: string;
3023
+ input: {
3024
+ type: "connection_id";
3025
+ required: true;
3026
+ };
3027
+ }>;
3028
+ }>;
3029
+ }>;
3030
+ has_more: boolean;
3031
+ next_cursor: string | null;
3032
+ };
3033
+ /**
3034
+ * Query threads
3035
+ */
3036
+ export declare const queryThreads: {
3037
+ readonly method: "post";
3038
+ readonly pathParams: readonly ["agent_id"];
3039
+ readonly queryParams: readonly [];
3040
+ readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size"];
3041
+ readonly path: (p: QueryThreadsPathParameters) => string;
3042
+ };
3043
+ type RetrieveSessionPathParameters = {
3044
+ session_id: IdRequest;
3045
+ };
3046
+ export type RetrieveSessionParameters = RetrieveSessionPathParameters;
3047
+ export type RetrieveSessionResponse = {
3048
+ object: "session";
3049
+ id: string;
3050
+ agent_id: string;
3051
+ title: string;
3052
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
3053
+ created_at: string;
3054
+ updated_at: string;
3055
+ created_by: {
3056
+ id: string;
3057
+ type: "user" | "bot";
3058
+ };
3059
+ agent_version: {
3060
+ id: string;
3061
+ number: number;
3062
+ published_at: string;
3063
+ } | null;
3064
+ models: {
3065
+ type: "auto";
3066
+ } | {
3067
+ type: "pinned";
3068
+ ids: Array<string | null>;
3069
+ };
3070
+ required_actions?: Array<{
3071
+ action_id: string;
3072
+ title: string;
3073
+ options: Array<{
3074
+ id: "approve" | "reject";
3075
+ label: string;
3076
+ }>;
3077
+ }>;
3078
+ error?: {
3079
+ code: string;
3080
+ message: string;
3081
+ retryable: boolean;
3082
+ };
3083
+ trigger_type?: string;
3084
+ type_labels?: Array<string> | null;
3085
+ chat_user_emails?: Array<string> | null;
3086
+ tool_types?: Array<string> | null;
3087
+ tool_call_count?: number | null;
3088
+ credits_used?: number | null;
3089
+ runs_completed?: number | null;
3090
+ message_count?: number | null;
3091
+ };
3092
+ /**
3093
+ * Retrieve a session
3094
+ */
3095
+ export declare const retrieveSession: {
3096
+ readonly method: "get";
3097
+ readonly pathParams: readonly ["session_id"];
3098
+ readonly queryParams: readonly [];
3099
+ readonly bodyParams: readonly [];
3100
+ readonly path: (p: RetrieveSessionPathParameters) => string;
3101
+ };
3102
+ type SendExternalAgentStubSessionMessagePathParameters = {
3103
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
3104
+ session_id: IdRequest;
3105
+ };
3106
+ type SendExternalAgentStubSessionMessageBodyParameters = {
3107
+ message: string;
3108
+ client_message_id?: string;
3109
+ };
3110
+ export type SendExternalAgentStubSessionMessageParameters = SendExternalAgentStubSessionMessagePathParameters & SendExternalAgentStubSessionMessageBodyParameters;
3111
+ export type SendExternalAgentStubSessionMessageResponse = {
3112
+ accepted: boolean;
3113
+ run_id?: string;
3114
+ };
3115
+ /**
3116
+ * Send external agent stub session message
3117
+ */
3118
+ export declare const sendExternalAgentStubSessionMessage: {
3119
+ readonly method: "post";
3120
+ readonly pathParams: readonly ["agent_id", "session_id"];
3121
+ readonly queryParams: readonly [];
3122
+ readonly bodyParams: readonly ["message", "client_message_id"];
3123
+ readonly path: (p: SendExternalAgentStubSessionMessagePathParameters) => string;
3124
+ };
3125
+ type StartExternalAgentStubSessionPathParameters = {
3126
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
3127
+ };
3128
+ type StartExternalAgentStubSessionBodyParameters = {
3129
+ spec_version?: "v1";
3130
+ client_reference_id?: string;
3131
+ configs?: {
3132
+ mcp_servers: Array<{
3133
+ name: string;
3134
+ server_url: string;
3135
+ credential: {
3136
+ type: "vault";
3137
+ vault_id: string;
3138
+ } | {
3139
+ type: "none";
3140
+ };
3141
+ }>;
3142
+ };
3143
+ model?: string;
3144
+ cwd?: string;
3145
+ locale?: string;
3146
+ system_prompt?: string;
3147
+ };
3148
+ export type StartExternalAgentStubSessionParameters = StartExternalAgentStubSessionPathParameters & StartExternalAgentStubSessionBodyParameters;
3149
+ export type StartExternalAgentStubSessionResponse = {
3150
+ session_id: string;
3151
+ model?: string;
3152
+ cwd?: string;
3153
+ last_active_at?: string;
3154
+ };
3155
+ /**
3156
+ * Start external agent stub session
3157
+ */
3158
+ export declare const startExternalAgentStubSession: {
3159
+ readonly method: "post";
3160
+ readonly pathParams: readonly ["agent_id"];
3161
+ readonly queryParams: readonly [];
3162
+ readonly bodyParams: readonly ["spec_version", "client_reference_id", "configs", "model", "cwd", "locale", "system_prompt"];
3163
+ readonly path: (p: StartExternalAgentStubSessionPathParameters) => string;
3164
+ };
3165
+ type UpdateAgentCreditLimitPathParameters = {
3166
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
3167
+ };
3168
+ type UpdateAgentCreditLimitBodyParameters = {
3169
+ credit_limit: number | null;
3170
+ };
3171
+ export type UpdateAgentCreditLimitParameters = UpdateAgentCreditLimitPathParameters & UpdateAgentCreditLimitBodyParameters;
3172
+ export type UpdateAgentCreditLimitResponse = {
3173
+ agent_id: IdResponse;
3174
+ credit_limit: number | null;
3175
+ last_edited_time: string;
3176
+ };
3177
+ /**
3178
+ * Update agent credit limit
3179
+ */
3180
+ export declare const updateAgentCreditLimit: {
3181
+ readonly method: "patch";
3182
+ readonly pathParams: readonly ["agent_id"];
3183
+ readonly queryParams: readonly [];
3184
+ readonly bodyParams: readonly ["credit_limit"];
3185
+ readonly path: (p: UpdateAgentCreditLimitPathParameters) => string;
3186
+ };
3187
+ type UpdateAgentStatusPathParameters = {
3188
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
3189
+ };
3190
+ type UpdateAgentStatusBodyParameters = {
3191
+ status: "active" | "disabled";
3192
+ };
3193
+ export type UpdateAgentStatusParameters = UpdateAgentStatusPathParameters & UpdateAgentStatusBodyParameters;
3194
+ export type UpdateAgentStatusResponse = {
3195
+ agent_id: IdResponse;
3196
+ status: "active" | "disabled" | "deleted";
3197
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_api" | "disabled_from_agent_settings" | "disabled_due_to_no_members_with_access" | "disabled_due_to_lack_of_editors" | "disabled_by_notion" | "internal_error" | "needs_user_review" | "tool_unavailable" | null;
3198
+ last_edited_time: string;
3199
+ };
3200
+ /**
3201
+ * Update agent status
3202
+ */
3203
+ export declare const updateAgentStatus: {
3204
+ readonly method: "patch";
3205
+ readonly pathParams: readonly ["agent_id"];
3206
+ readonly queryParams: readonly [];
3207
+ readonly bodyParams: readonly ["status"];
3208
+ readonly path: (p: UpdateAgentStatusPathParameters) => string;
3209
+ };
3210
+ type UpdateSessionBodyParameters = {
3211
+ message: string;
3212
+ agent_id?: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
3213
+ session_id?: IdRequest;
3214
+ attachments?: Array<{
3215
+ file_upload: {
3216
+ id: string;
3217
+ };
3218
+ type?: "file_upload";
3219
+ name?: string;
3220
+ }>;
3221
+ metadata?: Record<string, string>;
3222
+ prompt_context?: string;
3223
+ } | {
3224
+ session_id: IdRequest;
3225
+ actions: Array<{
3226
+ action_id: IdRequest;
3227
+ option_id: "approve" | "reject";
3228
+ }>;
3229
+ metadata?: Record<string, string>;
3230
+ } | {
3231
+ session_id: IdRequest;
3232
+ continue_from: string;
3233
+ };
3234
+ export type UpdateSessionParameters = UpdateSessionBodyParameters;
3235
+ export type UpdateSessionResponse = {
3236
+ object: "session";
3237
+ id: string;
3238
+ agent_id: string;
3239
+ title: string;
3240
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
3241
+ created_at: string;
3242
+ updated_at: string;
3243
+ required_actions?: Array<{
3244
+ action_id: string;
3245
+ title: string;
3246
+ options: Array<{
3247
+ id: "approve" | "reject";
3248
+ label: string;
3249
+ }>;
3250
+ }>;
3251
+ error?: {
3252
+ code: string;
3253
+ message: string;
3254
+ retryable: boolean;
3255
+ };
3256
+ };
3257
+ /**
3258
+ * Update a session
3259
+ */
3260
+ export declare const updateSession: {
3261
+ readonly method: "post";
3262
+ readonly pathParams: readonly [];
3263
+ readonly queryParams: readonly [];
3264
+ readonly bodyParams: readonly ["message", "agent_id", "session_id", "attachments", "metadata", "prompt_context", "actions", "continue_from"];
3265
+ readonly path: () => string;
3266
+ };
3267
+ export {};
3268
+ //# sourceMappingURL=agents.d.ts.map