@notionhq/client 5.27.1 → 5.29.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 (65) hide show
  1. package/README.md +21 -0
  2. package/build/package.json +1 -1
  3. package/build/src/Client.d.ts +18 -181
  4. package/build/src/Client.d.ts.map +1 -1
  5. package/build/src/api-endpoint-methods.d.ts +6 -197
  6. package/build/src/api-endpoint-methods.d.ts.map +1 -1
  7. package/build/src/api-endpoints/agent-skills.d.ts +26 -0
  8. package/build/src/api-endpoints/agent-skills.d.ts.map +1 -1
  9. package/build/src/api-endpoints/agent-skills.js +12 -1
  10. package/build/src/api-endpoints/agent-skills.js.map +1 -1
  11. package/build/src/api-endpoints/agents.d.ts +2091 -2266
  12. package/build/src/api-endpoints/agents.d.ts.map +1 -1
  13. package/build/src/api-endpoints/agents.js +118 -118
  14. package/build/src/api-endpoints/agents.js.map +1 -1
  15. package/build/src/api-endpoints/async-tasks.d.ts +7 -4
  16. package/build/src/api-endpoints/async-tasks.d.ts.map +1 -1
  17. package/build/src/api-endpoints/async-tasks.js.map +1 -1
  18. package/build/src/api-endpoints/blocks.d.ts +7 -4
  19. package/build/src/api-endpoints/blocks.d.ts.map +1 -1
  20. package/build/src/api-endpoints/blocks.js +1 -1
  21. package/build/src/api-endpoints/blocks.js.map +1 -1
  22. package/build/src/api-endpoints/comments.d.ts +9 -3
  23. package/build/src/api-endpoints/comments.d.ts.map +1 -1
  24. package/build/src/api-endpoints/comments.js +2 -1
  25. package/build/src/api-endpoints/comments.js.map +1 -1
  26. package/build/src/api-endpoints/common.d.ts +168 -21
  27. package/build/src/api-endpoints/common.d.ts.map +1 -1
  28. package/build/src/api-endpoints/common.js.map +1 -1
  29. package/build/src/api-endpoints/data-sources.d.ts +5 -1
  30. package/build/src/api-endpoints/data-sources.d.ts.map +1 -1
  31. package/build/src/api-endpoints/data-sources.js +2 -1
  32. package/build/src/api-endpoints/data-sources.js.map +1 -1
  33. package/build/src/api-endpoints/databases.d.ts +5 -2
  34. package/build/src/api-endpoints/databases.d.ts.map +1 -1
  35. package/build/src/api-endpoints/databases.js +2 -0
  36. package/build/src/api-endpoints/databases.js.map +1 -1
  37. package/build/src/api-endpoints/file-uploads.d.ts.map +1 -1
  38. package/build/src/api-endpoints/file-uploads.js.map +1 -1
  39. package/build/src/api-endpoints/meeting-notes.d.ts +8 -106
  40. package/build/src/api-endpoints/meeting-notes.d.ts.map +1 -1
  41. package/build/src/api-endpoints/meeting-notes.js.map +1 -1
  42. package/build/src/api-endpoints/oauth.d.ts +1 -0
  43. package/build/src/api-endpoints/oauth.d.ts.map +1 -1
  44. package/build/src/api-endpoints/oauth.js.map +1 -1
  45. package/build/src/api-endpoints/pages.d.ts +10 -5
  46. package/build/src/api-endpoints/pages.d.ts.map +1 -1
  47. package/build/src/api-endpoints/pages.js +5 -1
  48. package/build/src/api-endpoints/pages.js.map +1 -1
  49. package/build/src/api-endpoints/search.d.ts +5 -2
  50. package/build/src/api-endpoints/search.d.ts.map +1 -1
  51. package/build/src/api-endpoints/search.js +1 -1
  52. package/build/src/api-endpoints/search.js.map +1 -1
  53. package/build/src/api-endpoints/views.d.ts +2 -1
  54. package/build/src/api-endpoints/views.d.ts.map +1 -1
  55. package/build/src/api-endpoints/views.js.map +1 -1
  56. package/build/src/api-endpoints/webhooks.d.ts +6 -0
  57. package/build/src/api-endpoints/webhooks.d.ts.map +1 -1
  58. package/build/src/api-endpoints/webhooks.js.map +1 -1
  59. package/build/src/helpers.d.ts.map +1 -1
  60. package/build/src/helpers.js +2 -1
  61. package/build/src/helpers.js.map +1 -1
  62. package/build/src/index.d.ts +1 -1
  63. package/build/src/index.d.ts.map +1 -1
  64. package/build/src/index.js.map +1 -1
  65. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { EmptyObject, IdRequest, IdResponse, PageIconResponse } from "./common";
1
+ import type { EmptyObject, IdRequest, IdResponse, PageIconResponse, SessionAgentIdFilter, SessionIdFilter, SessionNestedFilter, SessionStatusFilter, SessionTimestampFilter } from "./common";
2
2
  /**
3
3
  * Parameters for opening a session stream.
4
4
  */
@@ -290,534 +290,574 @@ export declare const updateSessionStream: {
290
290
  };
291
291
  readonly path: () => string;
292
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";
293
+ type QueryAgentsBodyParameters = {
294
+ query?: string;
295
+ filter?: {
296
+ property: "id";
297
+ id: {
298
+ equals: string;
299
299
  };
300
300
  } | {
301
- action: "update_credit_limit";
302
- agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
303
- fields: {
304
- credit_limit: number | null;
301
+ property: "agent_type";
302
+ string: {
303
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
305
304
  };
306
305
  } | {
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;
306
+ property: "created_by";
307
+ people: {
308
+ contains: string;
384
309
  };
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";
310
+ } | {
311
+ property: "created_time";
312
+ date: {
313
+ after?: string;
314
+ before?: string;
456
315
  };
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";
316
+ } | {
317
+ property: "favorited";
318
+ checkbox: {
319
+ equals: boolean;
471
320
  };
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;
321
+ } | {
322
+ property: "connections";
323
+ mcp_server: {
324
+ contains: string;
526
325
  };
527
- } | null;
528
- model: {
529
- mode: "auto";
530
326
  } | {
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;
327
+ property: "status";
328
+ status: {
329
+ in: Array<"active" | "disabled" | "deleted">;
330
+ };
331
+ } | {
332
+ property: "model_mode";
333
+ select: {
334
+ equals: "auto" | "pinned";
335
+ };
336
+ } | {
337
+ property: "agent_version";
338
+ number: {
339
+ equals: number;
340
+ };
341
+ } | {
342
+ property: "last_run_at";
343
+ date: {
344
+ after?: string;
345
+ before?: string;
346
+ };
347
+ } | {
348
+ and: Array<{
349
+ property: "id";
350
+ id: {
351
+ equals: string;
352
+ };
353
+ } | {
354
+ property: "agent_type";
355
+ string: {
356
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
357
+ };
358
+ } | {
359
+ property: "created_by";
360
+ people: {
361
+ contains: string;
362
+ };
363
+ } | {
364
+ property: "created_time";
365
+ date: {
366
+ after?: string;
367
+ before?: string;
368
+ };
369
+ } | {
370
+ property: "favorited";
371
+ checkbox: {
372
+ equals: boolean;
373
+ };
374
+ } | {
375
+ property: "connections";
376
+ mcp_server: {
377
+ contains: string;
378
+ };
379
+ } | {
380
+ property: "status";
381
+ status: {
382
+ in: Array<"active" | "disabled" | "deleted">;
383
+ };
384
+ } | {
385
+ property: "model_mode";
386
+ select: {
387
+ equals: "auto" | "pinned";
388
+ };
389
+ } | {
390
+ property: "agent_version";
391
+ number: {
392
+ equals: number;
393
+ };
394
+ } | {
395
+ property: "last_run_at";
396
+ date: {
397
+ after?: string;
398
+ before?: string;
399
+ };
400
+ } | {
401
+ and: Array<{
402
+ property: "id";
403
+ id: {
404
+ equals: string;
405
+ };
542
406
  } | {
543
- type: "database_property";
544
- data_source_id: string;
545
- property_id: string;
407
+ property: "agent_type";
408
+ string: {
409
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
410
+ };
546
411
  } | {
547
- type: "agent";
548
- id: string;
412
+ property: "created_by";
413
+ people: {
414
+ contains: string;
415
+ };
549
416
  } | {
550
- type: "workspace";
417
+ property: "created_time";
418
+ date: {
419
+ after?: string;
420
+ before?: string;
421
+ };
551
422
  } | {
552
- type: "owner_private_pages";
423
+ property: "favorited";
424
+ checkbox: {
425
+ equals: boolean;
426
+ };
553
427
  } | {
554
- type: "web_search";
555
- allowed_domains: Array<string> | null;
428
+ property: "connections";
429
+ mcp_server: {
430
+ contains: string;
431
+ };
556
432
  } | {
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;
433
+ property: "status";
434
+ status: {
435
+ in: Array<"active" | "disabled" | "deleted">;
436
+ };
572
437
  } | {
573
- type: "slack_all_public_channels";
438
+ property: "model_mode";
439
+ select: {
440
+ equals: "auto" | "pinned";
441
+ };
574
442
  } | {
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;
443
+ property: "agent_version";
444
+ number: {
445
+ equals: number;
446
+ };
590
447
  } | {
591
- type: "discord_all_channels";
592
- };
593
- scopes: Array<string>;
448
+ property: "last_run_at";
449
+ date: {
450
+ after?: string;
451
+ before?: string;
452
+ };
453
+ }>;
454
+ } | {
455
+ or: Array<{
456
+ property: "id";
457
+ id: {
458
+ equals: string;
459
+ };
460
+ } | {
461
+ property: "agent_type";
462
+ string: {
463
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
464
+ };
465
+ } | {
466
+ property: "created_by";
467
+ people: {
468
+ contains: string;
469
+ };
470
+ } | {
471
+ property: "created_time";
472
+ date: {
473
+ after?: string;
474
+ before?: string;
475
+ };
476
+ } | {
477
+ property: "favorited";
478
+ checkbox: {
479
+ equals: boolean;
480
+ };
481
+ } | {
482
+ property: "connections";
483
+ mcp_server: {
484
+ contains: string;
485
+ };
486
+ } | {
487
+ property: "status";
488
+ status: {
489
+ in: Array<"active" | "disabled" | "deleted">;
490
+ };
491
+ } | {
492
+ property: "model_mode";
493
+ select: {
494
+ equals: "auto" | "pinned";
495
+ };
496
+ } | {
497
+ property: "agent_version";
498
+ number: {
499
+ equals: number;
500
+ };
501
+ } | {
502
+ property: "last_run_at";
503
+ date: {
504
+ after?: string;
505
+ before?: string;
506
+ };
507
+ }>;
594
508
  }>;
595
509
  } | {
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;
510
+ or: Array<{
511
+ property: "id";
512
+ id: {
513
+ equals: string;
633
514
  };
634
- scopes: Array<string>;
515
+ } | {
516
+ property: "agent_type";
517
+ string: {
518
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
519
+ };
520
+ } | {
521
+ property: "created_by";
522
+ people: {
523
+ contains: string;
524
+ };
525
+ } | {
526
+ property: "created_time";
527
+ date: {
528
+ after?: string;
529
+ before?: string;
530
+ };
531
+ } | {
532
+ property: "favorited";
533
+ checkbox: {
534
+ equals: boolean;
535
+ };
536
+ } | {
537
+ property: "connections";
538
+ mcp_server: {
539
+ contains: string;
540
+ };
541
+ } | {
542
+ property: "status";
543
+ status: {
544
+ in: Array<"active" | "disabled" | "deleted">;
545
+ };
546
+ } | {
547
+ property: "model_mode";
548
+ select: {
549
+ equals: "auto" | "pinned";
550
+ };
551
+ } | {
552
+ property: "agent_version";
553
+ number: {
554
+ equals: number;
555
+ };
556
+ } | {
557
+ property: "last_run_at";
558
+ date: {
559
+ after?: string;
560
+ before?: string;
561
+ };
562
+ } | {
563
+ and: Array<{
564
+ property: "id";
565
+ id: {
566
+ equals: string;
567
+ };
568
+ } | {
569
+ property: "agent_type";
570
+ string: {
571
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
572
+ };
573
+ } | {
574
+ property: "created_by";
575
+ people: {
576
+ contains: string;
577
+ };
578
+ } | {
579
+ property: "created_time";
580
+ date: {
581
+ after?: string;
582
+ before?: string;
583
+ };
584
+ } | {
585
+ property: "favorited";
586
+ checkbox: {
587
+ equals: boolean;
588
+ };
589
+ } | {
590
+ property: "connections";
591
+ mcp_server: {
592
+ contains: string;
593
+ };
594
+ } | {
595
+ property: "status";
596
+ status: {
597
+ in: Array<"active" | "disabled" | "deleted">;
598
+ };
599
+ } | {
600
+ property: "model_mode";
601
+ select: {
602
+ equals: "auto" | "pinned";
603
+ };
604
+ } | {
605
+ property: "agent_version";
606
+ number: {
607
+ equals: number;
608
+ };
609
+ } | {
610
+ property: "last_run_at";
611
+ date: {
612
+ after?: string;
613
+ before?: string;
614
+ };
615
+ }>;
616
+ } | {
617
+ or: Array<{
618
+ property: "id";
619
+ id: {
620
+ equals: string;
621
+ };
622
+ } | {
623
+ property: "agent_type";
624
+ string: {
625
+ equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
626
+ };
627
+ } | {
628
+ property: "created_by";
629
+ people: {
630
+ contains: string;
631
+ };
632
+ } | {
633
+ property: "created_time";
634
+ date: {
635
+ after?: string;
636
+ before?: string;
637
+ };
638
+ } | {
639
+ property: "favorited";
640
+ checkbox: {
641
+ equals: boolean;
642
+ };
643
+ } | {
644
+ property: "connections";
645
+ mcp_server: {
646
+ contains: string;
647
+ };
648
+ } | {
649
+ property: "status";
650
+ status: {
651
+ in: Array<"active" | "disabled" | "deleted">;
652
+ };
653
+ } | {
654
+ property: "model_mode";
655
+ select: {
656
+ equals: "auto" | "pinned";
657
+ };
658
+ } | {
659
+ property: "agent_version";
660
+ number: {
661
+ equals: number;
662
+ };
663
+ } | {
664
+ property: "last_run_at";
665
+ date: {
666
+ after?: string;
667
+ before?: string;
668
+ };
669
+ }>;
635
670
  }>;
671
+ };
672
+ sorts?: Array<{
673
+ property: "created_time" | "last_run_at";
674
+ direction: "ascending" | "descending";
636
675
  }>;
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: {
676
+ start_cursor?: string | null;
677
+ page_size?: number;
678
+ verbose?: boolean;
679
+ include_deleted?: boolean;
680
+ };
681
+ export type QueryAgentsParameters = QueryAgentsBodyParameters;
682
+ export type QueryAgentsResponse = {
683
+ object: "list";
684
+ type: "agent";
685
+ results: Array<{
686
+ object: "agent";
650
687
  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;
688
+ agent_type: "custom_agent" | "autofill_custom_agent";
689
+ name: string;
690
+ description: string | null;
691
+ instructions_page_id: IdResponse | null;
692
+ icon: PageIconResponse | {
693
+ type: "custom_agent_avatar";
694
+ custom_agent_avatar: {
695
+ static_url: string;
696
+ animated_url: string;
677
697
  };
698
+ } | null;
699
+ model: {
700
+ mode: "auto";
701
+ } | {
702
+ mode: "pinned";
703
+ id: string | null;
678
704
  };
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;
705
+ connections: Array<{
706
+ type: "notion";
707
+ name: string;
708
+ account: null;
709
+ permissions: Array<{
710
+ target: {
711
+ type: "page";
712
+ id: string;
713
+ } | {
714
+ type: "database_property";
715
+ data_source_id: string;
716
+ property_id: string;
717
+ } | {
718
+ type: "agent";
719
+ id: string;
720
+ } | {
721
+ type: "workspace";
722
+ } | {
723
+ type: "owner_private_pages";
724
+ } | {
725
+ type: "web_search";
726
+ allowed_domains: Array<string> | null;
727
+ } | {
728
+ type: "notion_help_docs_search";
729
+ };
730
+ scopes: Array<string>;
731
+ }>;
732
+ } | {
733
+ type: "slack";
734
+ name: string;
735
+ account: {
736
+ type: "slack_workspace";
737
+ team_id: string;
738
+ } | "hidden" | null;
739
+ permissions: Array<{
740
+ target: {
741
+ type: "slack_channel";
742
+ id: string;
743
+ } | {
744
+ type: "slack_all_public_channels";
745
+ } | {
746
+ type: "slack_all_channels";
747
+ };
748
+ scopes: Array<string>;
749
+ }>;
750
+ } | {
751
+ type: "discord";
752
+ name: string;
753
+ account: {
754
+ type: "discord_server";
755
+ id: string;
756
+ } | "hidden" | null;
757
+ permissions: Array<{
758
+ target: {
759
+ type: "discord_channel";
760
+ id: string;
761
+ } | {
762
+ type: "discord_all_channels";
763
+ };
764
+ scopes: Array<string>;
765
+ }>;
766
+ } | {
767
+ type: "mcp_server";
768
+ name: string;
769
+ account: {
770
+ type: "mcp_server";
771
+ server_host: string;
772
+ } | "hidden" | null;
773
+ enabled_tools: Array<{
774
+ name: string;
775
+ title: string | null;
776
+ }> | "hidden" | null;
777
+ run_tools_automatically: {
778
+ read: boolean;
779
+ write: boolean;
809
780
  };
810
- } | null;
811
- version: {
781
+ } | {
782
+ type: "custom_mcp_server";
783
+ name: string;
784
+ account: {
785
+ type: "mcp_server";
786
+ server_host: string;
787
+ } | "hidden" | null;
788
+ enabled_tools: Array<{
789
+ name: string;
790
+ title: string | null;
791
+ }> | "hidden" | null;
792
+ run_tools_automatically: {
793
+ read: boolean;
794
+ write: boolean;
795
+ };
796
+ } | {
797
+ type: "asana" | "box" | "calendar" | "computer" | "confluence" | "cursor" | "feedback" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "microsoft_teams_oauth" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "sharepoint_oauth" | "shopify" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
798
+ name: string;
799
+ account: string | null;
800
+ permissions: Array<{
801
+ target: {
802
+ type: string;
803
+ id: string;
804
+ };
805
+ scopes: Array<string>;
806
+ }>;
807
+ }>;
808
+ status: "active" | "disabled" | "deleted";
809
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "owner_allowance_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_workspace_settings_but_resumable" | "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;
810
+ created_by: {
811
+ type: "user" | "bot";
812
812
  id: IdResponse;
813
- number: number;
814
- published_at: string;
815
813
  } | null;
816
814
  agent_version: {
817
815
  id: IdResponse;
818
816
  number: number;
819
817
  published_at: string;
820
818
  } | null;
819
+ created_time: string;
820
+ last_edited_time: string;
821
+ last_run_at: string | "hidden" | null;
822
+ credit_limit: number | "hidden" | null;
823
+ triggers: Array<{
824
+ type: string;
825
+ enabled: boolean;
826
+ schedule?: {
827
+ frequency: string;
828
+ interval: number;
829
+ weekdays?: Array<string>;
830
+ monthdays?: Array<number>;
831
+ week_numbers?: Array<number>;
832
+ hour?: number;
833
+ minute?: number;
834
+ timezone?: string;
835
+ start_date?: string;
836
+ end?: {
837
+ type: "date";
838
+ end_at: string;
839
+ } | {
840
+ type: "count";
841
+ occurrences: number;
842
+ };
843
+ };
844
+ config?: Record<string, Record<string, never>>;
845
+ }>;
846
+ instructions?: string | null;
847
+ } | {
848
+ object: "agent";
849
+ id: "notion_ai";
850
+ agent_type: "notion_ai";
851
+ name: string;
852
+ description: null;
853
+ instructions_page_id: null;
854
+ icon: PageIconResponse | {
855
+ type: "custom_agent_avatar";
856
+ custom_agent_avatar: {
857
+ static_url: string;
858
+ animated_url: string;
859
+ };
860
+ };
821
861
  model: {
822
862
  mode: "auto";
823
863
  } | {
@@ -916,7 +956,7 @@ export type ListAgentsResponse = {
916
956
  write: boolean;
917
957
  };
918
958
  } | {
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";
959
+ type: "asana" | "box" | "calendar" | "computer" | "confluence" | "cursor" | "feedback" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "microsoft_teams_oauth" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "sharepoint_oauth" | "shopify" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
920
960
  name: string;
921
961
  account: string | null;
922
962
  permissions: Array<{
@@ -927,271 +967,549 @@ export type ListAgentsResponse = {
927
967
  scopes: Array<string>;
928
968
  }>;
929
969
  }>;
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;
970
+ status: "active";
971
+ pause_reason: null;
972
+ created_by: null;
973
+ agent_version: null;
974
+ created_time: null;
975
+ last_edited_time: null;
976
+ last_run_at: null;
977
+ credit_limit: null;
978
+ triggers: Array<{
979
+ type: string;
980
+ enabled: boolean;
981
+ schedule?: {
982
+ frequency: string;
983
+ interval: number;
984
+ weekdays?: Array<string>;
985
+ monthdays?: Array<number>;
986
+ week_numbers?: Array<number>;
987
+ hour?: number;
988
+ minute?: number;
989
+ timezone?: string;
990
+ start_date?: string;
991
+ end?: {
992
+ type: "date";
993
+ end_at: string;
994
+ } | {
995
+ type: "count";
996
+ occurrences: number;
997
+ };
998
+ };
999
+ config?: Record<string, Record<string, never>>;
1000
+ }>;
941
1001
  }>;
942
1002
  has_more: boolean;
943
1003
  next_cursor: string | null;
944
1004
  };
945
1005
  /**
946
- * List agents
1006
+ * Query agents
947
1007
  */
948
- export declare const listAgents: {
949
- readonly method: "get";
1008
+ export declare const queryAgents: {
1009
+ readonly method: "post";
950
1010
  readonly pathParams: readonly [];
951
- readonly queryParams: readonly ["name", "agent_type", "agent_ids", "created_by", "start_cursor", "page_size", "verbose"];
952
- readonly bodyParams: readonly [];
1011
+ readonly queryParams: readonly [];
1012
+ readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size", "verbose", "include_deleted"];
953
1013
  readonly path: () => string;
954
1014
  };
955
- type ListExternalAgentStubSessionEventsPathParameters = {
956
- agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
957
- session_id: IdRequest;
1015
+ type GetAgentPathParameters = {
1016
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
958
1017
  };
959
- type ListExternalAgentStubSessionEventsQueryParameters = {
960
- cursor?: string;
1018
+ type GetAgentQueryParameters = {
1019
+ verbose?: boolean;
961
1020
  };
962
- export type ListExternalAgentStubSessionEventsParameters = ListExternalAgentStubSessionEventsPathParameters & ListExternalAgentStubSessionEventsQueryParameters;
963
- export type ListExternalAgentStubSessionEventsResponse = {
964
- events: Array<{
965
- type: "assistant.thinking";
966
- text: string;
1021
+ export type GetAgentParameters = GetAgentPathParameters & GetAgentQueryParameters;
1022
+ export type GetAgentResponse = {
1023
+ object: "agent";
1024
+ id: IdResponse | "notion_ai";
1025
+ agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent" | "external";
1026
+ name: string;
1027
+ description: string | null;
1028
+ instructions_page_id: IdResponse | null;
1029
+ icon: PageIconResponse | {
1030
+ type: "custom_agent_avatar";
1031
+ custom_agent_avatar: {
1032
+ static_url: string;
1033
+ animated_url: string;
1034
+ };
1035
+ } | null;
1036
+ model: {
1037
+ mode: "auto";
967
1038
  } | {
968
- type: "assistant.message";
969
- text: string;
1039
+ mode: "pinned";
1040
+ id: string | null;
1041
+ };
1042
+ connections: Array<{
1043
+ type: "notion";
1044
+ name: string;
1045
+ account: null;
1046
+ permissions: Array<{
1047
+ target: {
1048
+ type: "page";
1049
+ id: string;
1050
+ } | {
1051
+ type: "database_property";
1052
+ data_source_id: string;
1053
+ property_id: string;
1054
+ } | {
1055
+ type: "agent";
1056
+ id: string;
1057
+ } | {
1058
+ type: "workspace";
1059
+ } | {
1060
+ type: "owner_private_pages";
1061
+ } | {
1062
+ type: "web_search";
1063
+ allowed_domains: Array<string> | null;
1064
+ } | {
1065
+ type: "notion_help_docs_search";
1066
+ };
1067
+ scopes: Array<string>;
1068
+ }>;
970
1069
  } | {
971
- type: "tool.started";
972
- tool_call_id: string;
973
- tool_name?: string;
974
- input?: Record<string, never>;
1070
+ type: "slack";
1071
+ name: string;
1072
+ account: {
1073
+ type: "slack_workspace";
1074
+ team_id: string;
1075
+ } | "hidden" | null;
1076
+ permissions: Array<{
1077
+ target: {
1078
+ type: "slack_channel";
1079
+ id: string;
1080
+ } | {
1081
+ type: "slack_all_public_channels";
1082
+ } | {
1083
+ type: "slack_all_channels";
1084
+ };
1085
+ scopes: Array<string>;
1086
+ }>;
975
1087
  } | {
976
- type: "tool.output";
977
- tool_call_id: string;
978
- output?: Record<string, never>;
979
- is_error?: boolean;
1088
+ type: "discord";
1089
+ name: string;
1090
+ account: {
1091
+ type: "discord_server";
1092
+ id: string;
1093
+ } | "hidden" | null;
1094
+ permissions: Array<{
1095
+ target: {
1096
+ type: "discord_channel";
1097
+ id: string;
1098
+ } | {
1099
+ type: "discord_all_channels";
1100
+ };
1101
+ scopes: Array<string>;
1102
+ }>;
980
1103
  } | {
981
- type: "error";
982
- error: {
983
- code: string;
984
- message: string;
985
- retryable: boolean;
986
- additional_data?: Record<string, string | Array<string>>;
1104
+ type: "mcp_server";
1105
+ name: string;
1106
+ account: {
1107
+ type: "mcp_server";
1108
+ server_host: string;
1109
+ } | "hidden" | null;
1110
+ enabled_tools: Array<{
1111
+ name: string;
1112
+ title: string | null;
1113
+ }> | "hidden" | null;
1114
+ run_tools_automatically: {
1115
+ read: boolean;
1116
+ write: boolean;
1117
+ };
1118
+ } | {
1119
+ type: "custom_mcp_server";
1120
+ name: string;
1121
+ account: {
1122
+ type: "mcp_server";
1123
+ server_host: string;
1124
+ } | "hidden" | null;
1125
+ enabled_tools: Array<{
1126
+ name: string;
1127
+ title: string | null;
1128
+ }> | "hidden" | null;
1129
+ run_tools_automatically: {
1130
+ read: boolean;
1131
+ write: boolean;
1132
+ };
1133
+ } | {
1134
+ type: "asana" | "box" | "calendar" | "computer" | "confluence" | "cursor" | "feedback" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "microsoft_teams_oauth" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "sharepoint_oauth" | "shopify" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
1135
+ name: string;
1136
+ account: string | null;
1137
+ permissions: Array<{
1138
+ target: {
1139
+ type: string;
1140
+ id: string;
1141
+ };
1142
+ scopes: Array<string>;
1143
+ }>;
1144
+ }>;
1145
+ status: "active" | "disabled" | "deleted";
1146
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "owner_allowance_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_workspace_settings_but_resumable" | "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;
1147
+ created_by: {
1148
+ object: "user";
1149
+ type: "user";
1150
+ id: IdResponse;
1151
+ } | null;
1152
+ version: {
1153
+ id: IdResponse;
1154
+ number: number;
1155
+ published_at: string;
1156
+ } | null;
1157
+ agent_version: {
1158
+ id: IdResponse;
1159
+ number: number;
1160
+ published_at: string;
1161
+ } | null;
1162
+ has_unpublished_changes: boolean | "hidden";
1163
+ last_run_time: string | "hidden" | null;
1164
+ last_run_at: string | "hidden" | null;
1165
+ credit_limit: number | "hidden" | null;
1166
+ triggers: Array<{
1167
+ type: string;
1168
+ enabled: boolean;
1169
+ schedule?: {
1170
+ frequency: string;
1171
+ interval: number;
1172
+ weekdays?: Array<string>;
1173
+ monthdays?: Array<number>;
1174
+ week_numbers?: Array<number>;
1175
+ hour?: number;
1176
+ minute?: number;
1177
+ timezone?: string;
1178
+ start_date?: string;
1179
+ end?: {
1180
+ type: "date";
1181
+ end_at: string;
1182
+ } | {
1183
+ type: "count";
1184
+ occurrences: number;
1185
+ };
987
1186
  };
1187
+ config?: Record<string, Record<string, never>>;
988
1188
  }>;
989
- is_running: boolean;
990
- next_cursor?: string;
1189
+ is_favorited: boolean | null;
1190
+ created_time?: string;
1191
+ last_edited_time?: string;
1192
+ instructions?: string | null;
991
1193
  };
992
1194
  /**
993
- * List external agent stub session events
1195
+ * Get agent
994
1196
  */
995
- export declare const listExternalAgentStubSessionEvents: {
1197
+ export declare const getAgent: {
996
1198
  readonly method: "get";
997
- readonly pathParams: readonly ["agent_id", "session_id"];
998
- readonly queryParams: readonly ["cursor"];
1199
+ readonly pathParams: readonly ["agent_id"];
1200
+ readonly queryParams: readonly ["verbose"];
999
1201
  readonly bodyParams: readonly [];
1000
- readonly path: (p: ListExternalAgentStubSessionEventsPathParameters) => string;
1202
+ readonly path: (p: GetAgentPathParameters) => string;
1001
1203
  };
1002
- type ListThreadMessagesPathParameters = {
1003
- thread_id: IdRequest;
1204
+ type DeleteAgentPathParameters = {
1205
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1004
1206
  };
1005
- type ListThreadMessagesQueryParameters = {
1006
- verbose?: boolean;
1007
- role?: "user" | "agent";
1008
- start_cursor?: string | null;
1009
- page_size?: number;
1207
+ export type DeleteAgentParameters = DeleteAgentPathParameters;
1208
+ export type DeleteAgentResponse = {
1209
+ agent_id: IdResponse;
1210
+ status: "deleted";
1211
+ deleted_at: string;
1010
1212
  };
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;
1213
+ /**
1214
+ * Delete agent
1215
+ */
1216
+ export declare const deleteAgent: {
1217
+ readonly method: "delete";
1218
+ readonly pathParams: readonly ["agent_id"];
1219
+ readonly queryParams: readonly [];
1220
+ readonly bodyParams: readonly [];
1221
+ readonly path: (p: DeleteAgentPathParameters) => string;
1222
+ };
1223
+ type GetInsightsPathParameters = {
1224
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1225
+ };
1226
+ type GetInsightsQueryParameters = {
1227
+ start_time?: number;
1228
+ end_time?: number;
1229
+ };
1230
+ export type GetInsightsParameters = GetInsightsPathParameters & GetInsightsQueryParameters;
1231
+ export type GetInsightsResponse = {
1232
+ object: "agent_insights";
1233
+ id: IdResponse | "notion_ai";
1234
+ name: string;
1235
+ agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1236
+ status: "active" | "disabled" | "deleted";
1237
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "owner_allowance_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_workspace_settings_but_resumable" | "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;
1238
+ created_by: {
1239
+ id: string;
1240
+ type: "user" | "bot";
1241
+ } | null;
1242
+ total_credits_used: number;
1243
+ credit_limit: number | "hidden" | null;
1244
+ runs_completed: number;
1109
1245
  };
1110
1246
  /**
1111
- * List thread messages
1247
+ * Get agent insights
1112
1248
  */
1113
- export declare const listThreadMessages: {
1249
+ export declare const getInsights: {
1114
1250
  readonly method: "get";
1115
- readonly pathParams: readonly ["thread_id"];
1116
- readonly queryParams: readonly ["verbose", "role", "start_cursor", "page_size"];
1251
+ readonly pathParams: readonly ["agent_id"];
1252
+ readonly queryParams: readonly ["start_time", "end_time"];
1117
1253
  readonly bodyParams: readonly [];
1118
- readonly path: (p: ListThreadMessagesPathParameters) => string;
1254
+ readonly path: (p: GetInsightsPathParameters) => string;
1119
1255
  };
1120
- type SendThreadMessagePathParameters = {
1121
- thread_id: IdRequest;
1256
+ type UpdateAgentStatusPathParameters = {
1257
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1122
1258
  };
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;
1259
+ type UpdateAgentStatusBodyParameters = {
1260
+ status: "active" | "disabled";
1134
1261
  };
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";
1262
+ export type UpdateAgentStatusParameters = UpdateAgentStatusPathParameters & UpdateAgentStatusBodyParameters;
1263
+ export type UpdateAgentStatusResponse = {
1264
+ agent_id: IdResponse;
1265
+ status: "active" | "disabled" | "deleted";
1266
+ pause_reason: "run_limit" | "credit_limit" | "runaway_credit_usage" | "workspace_credit_limit" | "owner_allowance_limit" | "failure_limit" | "mark_session_failed_autopause" | "disabled_from_workspace_settings" | "disabled_from_workspace_settings_but_resumable" | "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;
1267
+ last_edited_time: string;
1142
1268
  };
1143
1269
  /**
1144
- * Send a thread message
1270
+ * Update agent status
1145
1271
  */
1146
- export declare const sendThreadMessage: {
1147
- readonly method: "post";
1148
- readonly pathParams: readonly ["thread_id"];
1272
+ export declare const updateAgentStatus: {
1273
+ readonly method: "patch";
1274
+ readonly pathParams: readonly ["agent_id"];
1149
1275
  readonly queryParams: readonly [];
1150
- readonly bodyParams: readonly ["message", "attachments", "metadata", "prompt_context"];
1151
- readonly path: (p: SendThreadMessagePathParameters) => string;
1276
+ readonly bodyParams: readonly ["status"];
1277
+ readonly path: (p: UpdateAgentStatusPathParameters) => string;
1152
1278
  };
1153
- type ListThreadsPathParameters = {
1279
+ type UpdateAgentCreditLimitPathParameters = {
1154
1280
  agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1155
1281
  };
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;
1282
+ type UpdateAgentCreditLimitBodyParameters = {
1283
+ credit_limit: number | null;
1167
1284
  };
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>;
1285
+ export type UpdateAgentCreditLimitParameters = UpdateAgentCreditLimitPathParameters & UpdateAgentCreditLimitBodyParameters;
1286
+ export type UpdateAgentCreditLimitResponse = {
1287
+ agent_id: IdResponse;
1288
+ credit_limit: number | null;
1289
+ last_edited_time: string;
1290
+ };
1291
+ /**
1292
+ * Update agent credit limit
1293
+ */
1294
+ export declare const updateAgentCreditLimit: {
1295
+ readonly method: "patch";
1296
+ readonly pathParams: readonly ["agent_id"];
1297
+ readonly queryParams: readonly [];
1298
+ readonly bodyParams: readonly ["credit_limit"];
1299
+ readonly path: (p: UpdateAgentCreditLimitPathParameters) => string;
1300
+ };
1301
+ type AgentBatchBodyParameters = {
1302
+ operations: Array<{
1303
+ action: "update_status";
1304
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1305
+ fields: {
1306
+ status: "active" | "disabled";
1307
+ };
1308
+ } | {
1309
+ action: "update_credit_limit";
1310
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1311
+ fields: {
1312
+ credit_limit: number | null;
1313
+ };
1314
+ } | {
1315
+ action: "delete";
1316
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1317
+ }>;
1318
+ };
1319
+ export type AgentBatchParameters = AgentBatchBodyParameters;
1320
+ export type AgentBatchResponse = {
1321
+ object: "async_task";
1322
+ id: string;
1323
+ status_url: string;
1324
+ created_time: string;
1325
+ operation: {
1326
+ surface: "rest" | "mcp";
1327
+ name: string;
1328
+ };
1329
+ status: "queued" | "running" | "retrying";
1330
+ poll_after_seconds: number;
1331
+ };
1332
+ /**
1333
+ * Apply many agent operations
1334
+ */
1335
+ export declare const agentBatch: {
1336
+ readonly method: "post";
1337
+ readonly pathParams: readonly [];
1338
+ readonly queryParams: readonly [];
1339
+ readonly bodyParams: readonly ["operations"];
1340
+ readonly path: () => string;
1341
+ };
1342
+ type UpdateSessionBodyParameters = {
1343
+ message: string;
1344
+ agent_id?: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
1345
+ session_id?: IdRequest;
1346
+ attachments?: Array<{
1347
+ file_upload: {
1348
+ id: string;
1349
+ };
1350
+ type?: "file_upload";
1351
+ name?: string;
1352
+ }>;
1353
+ metadata?: Record<string, string>;
1354
+ prompt_context?: string;
1355
+ } | {
1356
+ session_id: IdRequest;
1357
+ actions: Array<{
1358
+ action_id: IdRequest;
1359
+ option_id: "approve" | "reject";
1360
+ }>;
1361
+ metadata?: Record<string, string>;
1362
+ } | {
1363
+ session_id: IdRequest;
1364
+ continue_from: string;
1365
+ };
1366
+ export type UpdateSessionParameters = UpdateSessionBodyParameters;
1367
+ export type UpdateSessionResponse = {
1368
+ object: "session";
1369
+ id: string;
1370
+ agent_id: string;
1371
+ title: string;
1372
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
1373
+ created_at: string;
1374
+ updated_at: string;
1375
+ required_actions?: Array<{
1376
+ action_id: string;
1377
+ title: string;
1378
+ options: Array<{
1379
+ id: "approve" | "reject";
1380
+ label: string;
1381
+ }>;
1382
+ }>;
1383
+ error?: {
1384
+ code: string;
1385
+ message: string;
1386
+ retryable: boolean;
1387
+ };
1388
+ };
1389
+ /**
1390
+ * Update a session
1391
+ */
1392
+ export declare const updateSession: {
1393
+ readonly method: "post";
1394
+ readonly pathParams: readonly [];
1395
+ readonly queryParams: readonly [];
1396
+ readonly bodyParams: readonly ["message", "agent_id", "session_id", "attachments", "metadata", "prompt_context", "actions", "continue_from"];
1397
+ readonly path: () => string;
1398
+ };
1399
+ type RetrieveSessionPathParameters = {
1400
+ session_id: IdRequest;
1401
+ };
1402
+ export type RetrieveSessionParameters = RetrieveSessionPathParameters;
1403
+ export type RetrieveSessionResponse = {
1404
+ object: "session";
1405
+ id: string;
1406
+ agent_id: string;
1407
+ title: string;
1408
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
1409
+ created_at: string;
1410
+ updated_at: string;
1411
+ created_by: {
1412
+ id: string;
1413
+ type: "user" | "bot";
1414
+ };
1415
+ agent_version: {
1416
+ id: string;
1417
+ number: number;
1418
+ published_at: string;
1419
+ } | null;
1420
+ models: {
1421
+ type: "auto";
1422
+ } | {
1423
+ type: "pinned";
1424
+ ids: Array<string | null>;
1425
+ };
1426
+ required_actions?: Array<{
1427
+ action_id: string;
1428
+ title: string;
1429
+ options: Array<{
1430
+ id: "approve" | "reject";
1431
+ label: string;
1432
+ }>;
1433
+ }>;
1434
+ error?: {
1435
+ code: string;
1436
+ message: string;
1437
+ retryable: boolean;
1438
+ };
1439
+ trigger_type?: string;
1440
+ type_labels?: Array<string> | null;
1441
+ chat_user_emails?: Array<string> | null;
1442
+ tool_types?: Array<string> | null;
1443
+ tool_call_count?: number | null;
1444
+ credits_used?: number | null;
1445
+ runs_completed?: number | null;
1446
+ message_count?: number | null;
1447
+ };
1448
+ /**
1449
+ * Retrieve a session
1450
+ */
1451
+ export declare const retrieveSession: {
1452
+ readonly method: "get";
1453
+ readonly pathParams: readonly ["session_id"];
1454
+ readonly queryParams: readonly [];
1455
+ readonly bodyParams: readonly [];
1456
+ readonly path: (p: RetrieveSessionPathParameters) => string;
1457
+ };
1458
+ type QuerySessionsBodyParameters = {
1459
+ query?: string;
1460
+ filter?: SessionIdFilter | SessionAgentIdFilter | SessionStatusFilter | SessionTimestampFilter | {
1461
+ and: Array<SessionNestedFilter>;
1462
+ } | {
1463
+ or: Array<SessionNestedFilter>;
1464
+ };
1465
+ sorts?: Array<{
1466
+ property: "created_at" | "updated_at";
1467
+ direction: "ascending" | "descending";
1468
+ }>;
1469
+ start_cursor?: string | null;
1470
+ page_size?: number;
1471
+ };
1472
+ export type QuerySessionsParameters = QuerySessionsBodyParameters;
1473
+ export type QuerySessionsResponse = {
1474
+ object: "list";
1475
+ type: "session";
1476
+ session: Record<string, never>;
1477
+ results: Array<{
1478
+ object: "session";
1479
+ id: string;
1480
+ agent_id: string;
1481
+ title: string;
1482
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
1483
+ created_by: {
1484
+ id: string;
1485
+ type: "user" | "bot";
1486
+ };
1487
+ agent_version: {
1488
+ id: string;
1489
+ number: number;
1490
+ published_at: string;
1491
+ } | null;
1492
+ models: {
1493
+ type: "auto";
1494
+ } | {
1495
+ type: "pinned";
1496
+ ids: Array<string | null>;
1497
+ };
1498
+ created_at: string;
1499
+ updated_at: string;
1500
+ required_actions?: Array<{
1501
+ action_id: string;
1502
+ title: string;
1503
+ options: Array<{
1504
+ id: "approve" | "reject";
1505
+ label: string;
1506
+ }>;
1507
+ }>;
1508
+ error?: {
1509
+ code: string;
1510
+ message: string;
1511
+ retryable: boolean;
1193
1512
  };
1194
- error?: string;
1195
1513
  trigger_type?: string;
1196
1514
  type_labels?: Array<string> | null;
1197
1515
  chat_user_emails?: Array<string> | null;
@@ -1199,1569 +1517,1207 @@ export type ListThreadsResponse = {
1199
1517
  tool_call_count?: number | null;
1200
1518
  credits_used?: number | null;
1201
1519
  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
- }>;
1520
+ message_count?: number | null;
1247
1521
  }>;
1248
1522
  has_more: boolean;
1249
1523
  next_cursor: string | null;
1250
1524
  };
1251
1525
  /**
1252
- * List threads
1526
+ * Query sessions
1253
1527
  */
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;
1528
+ export declare const querySessions: {
1529
+ readonly method: "post";
1530
+ readonly pathParams: readonly [];
1531
+ readonly queryParams: readonly [];
1532
+ readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size"];
1533
+ readonly path: () => string;
1260
1534
  };
1261
- type QueryAgentsBodyParameters = {
1262
- query?: string;
1535
+ type QuerySessionEventsPathParameters = {
1536
+ session_id: IdRequest;
1537
+ };
1538
+ type QuerySessionEventsBodyParameters = {
1263
1539
  filter?: {
1264
1540
  property: "id";
1265
- id: {
1266
- equals: string;
1267
- };
1268
- } | {
1269
- property: "agent_type";
1270
1541
  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">;
1542
+ equals: string;
1298
1543
  };
1299
1544
  } | {
1300
- property: "model_mode";
1301
- select: {
1302
- equals: "auto" | "pinned";
1545
+ property: "type";
1546
+ event_type: {
1547
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1548
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1303
1549
  };
1304
1550
  } | {
1305
- property: "agent_version";
1551
+ property: "sequence";
1306
1552
  number: {
1307
- equals: number;
1553
+ greater_than?: number;
1554
+ greater_than_or_equal_to?: number;
1555
+ less_than?: number;
1556
+ less_than_or_equal_to?: number;
1308
1557
  };
1309
1558
  } | {
1310
- property: "last_run_at";
1311
- date: {
1312
- after?: string;
1559
+ property: "created_at";
1560
+ timestamp: {
1561
+ equals?: string;
1313
1562
  before?: string;
1563
+ after?: string;
1564
+ on_or_before?: string;
1565
+ on_or_after?: string;
1314
1566
  };
1315
1567
  } | {
1316
1568
  and: Array<{
1317
1569
  property: "id";
1318
- id: {
1319
- equals: string;
1320
- };
1321
- } | {
1322
- property: "agent_type";
1323
1570
  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">;
1571
+ equals: string;
1351
1572
  };
1352
1573
  } | {
1353
- property: "model_mode";
1354
- select: {
1355
- equals: "auto" | "pinned";
1574
+ property: "type";
1575
+ event_type: {
1576
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1577
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1356
1578
  };
1357
1579
  } | {
1358
- property: "agent_version";
1580
+ property: "sequence";
1359
1581
  number: {
1360
- equals: number;
1582
+ greater_than?: number;
1583
+ greater_than_or_equal_to?: number;
1584
+ less_than?: number;
1585
+ less_than_or_equal_to?: number;
1361
1586
  };
1362
1587
  } | {
1363
- property: "last_run_at";
1364
- date: {
1365
- after?: string;
1588
+ property: "created_at";
1589
+ timestamp: {
1590
+ equals?: string;
1366
1591
  before?: string;
1592
+ after?: string;
1593
+ on_or_before?: string;
1594
+ on_or_after?: string;
1367
1595
  };
1368
1596
  } | {
1369
1597
  and: Array<{
1370
1598
  property: "id";
1371
- id: {
1599
+ string: {
1372
1600
  equals: string;
1373
1601
  };
1374
1602
  } | {
1375
- property: "agent_type";
1376
- string: {
1377
- equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1603
+ property: "type";
1604
+ event_type: {
1605
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1606
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1378
1607
  };
1379
1608
  } | {
1380
- property: "created_by";
1381
- people: {
1382
- contains: string;
1609
+ property: "sequence";
1610
+ number: {
1611
+ greater_than?: number;
1612
+ greater_than_or_equal_to?: number;
1613
+ less_than?: number;
1614
+ less_than_or_equal_to?: number;
1383
1615
  };
1384
1616
  } | {
1385
- property: "created_time";
1386
- date: {
1387
- after?: string;
1617
+ property: "created_at";
1618
+ timestamp: {
1619
+ equals?: string;
1388
1620
  before?: string;
1621
+ after?: string;
1622
+ on_or_before?: string;
1623
+ on_or_after?: string;
1389
1624
  };
1390
1625
  } | {
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
- };
1626
+ and: Array<{
1627
+ property: "id";
1628
+ string: {
1629
+ equals: string;
1630
+ };
1631
+ } | {
1632
+ property: "type";
1633
+ event_type: {
1634
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1635
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1636
+ };
1637
+ } | {
1638
+ property: "sequence";
1639
+ number: {
1640
+ greater_than?: number;
1641
+ greater_than_or_equal_to?: number;
1642
+ less_than?: number;
1643
+ less_than_or_equal_to?: number;
1644
+ };
1645
+ } | {
1646
+ property: "created_at";
1647
+ timestamp: {
1648
+ equals?: string;
1649
+ before?: string;
1650
+ after?: string;
1651
+ on_or_before?: string;
1652
+ on_or_after?: string;
1653
+ };
1654
+ }>;
1415
1655
  } | {
1416
- property: "last_run_at";
1417
- date: {
1418
- after?: string;
1419
- before?: string;
1420
- };
1656
+ or: Array<{
1657
+ property: "id";
1658
+ string: {
1659
+ equals: string;
1660
+ };
1661
+ } | {
1662
+ property: "type";
1663
+ event_type: {
1664
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1665
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1666
+ };
1667
+ } | {
1668
+ property: "sequence";
1669
+ number: {
1670
+ greater_than?: number;
1671
+ greater_than_or_equal_to?: number;
1672
+ less_than?: number;
1673
+ less_than_or_equal_to?: number;
1674
+ };
1675
+ } | {
1676
+ property: "created_at";
1677
+ timestamp: {
1678
+ equals?: string;
1679
+ before?: string;
1680
+ after?: string;
1681
+ on_or_before?: string;
1682
+ on_or_after?: string;
1683
+ };
1684
+ }>;
1421
1685
  }>;
1422
1686
  } | {
1423
1687
  or: Array<{
1424
1688
  property: "id";
1425
- id: {
1426
- equals: string;
1427
- };
1428
- } | {
1429
- property: "agent_type";
1430
1689
  string: {
1431
- equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1690
+ equals: string;
1432
1691
  };
1433
1692
  } | {
1434
- property: "created_by";
1435
- people: {
1436
- contains: string;
1693
+ property: "type";
1694
+ event_type: {
1695
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1696
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1437
1697
  };
1438
1698
  } | {
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";
1699
+ property: "sequence";
1466
1700
  number: {
1467
- equals: number;
1701
+ greater_than?: number;
1702
+ greater_than_or_equal_to?: number;
1703
+ less_than?: number;
1704
+ less_than_or_equal_to?: number;
1468
1705
  };
1469
1706
  } | {
1470
- property: "last_run_at";
1471
- date: {
1472
- after?: string;
1707
+ property: "created_at";
1708
+ timestamp: {
1709
+ equals?: string;
1473
1710
  before?: string;
1711
+ after?: string;
1712
+ on_or_before?: string;
1713
+ on_or_after?: string;
1474
1714
  };
1715
+ } | {
1716
+ and: Array<{
1717
+ property: "id";
1718
+ string: {
1719
+ equals: string;
1720
+ };
1721
+ } | {
1722
+ property: "type";
1723
+ event_type: {
1724
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1725
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1726
+ };
1727
+ } | {
1728
+ property: "sequence";
1729
+ number: {
1730
+ greater_than?: number;
1731
+ greater_than_or_equal_to?: number;
1732
+ less_than?: number;
1733
+ less_than_or_equal_to?: number;
1734
+ };
1735
+ } | {
1736
+ property: "created_at";
1737
+ timestamp: {
1738
+ equals?: string;
1739
+ before?: string;
1740
+ after?: string;
1741
+ on_or_before?: string;
1742
+ on_or_after?: string;
1743
+ };
1744
+ }>;
1745
+ } | {
1746
+ or: Array<{
1747
+ property: "id";
1748
+ string: {
1749
+ equals: string;
1750
+ };
1751
+ } | {
1752
+ property: "type";
1753
+ event_type: {
1754
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1755
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1756
+ };
1757
+ } | {
1758
+ property: "sequence";
1759
+ number: {
1760
+ greater_than?: number;
1761
+ greater_than_or_equal_to?: number;
1762
+ less_than?: number;
1763
+ less_than_or_equal_to?: number;
1764
+ };
1765
+ } | {
1766
+ property: "created_at";
1767
+ timestamp: {
1768
+ equals?: string;
1769
+ before?: string;
1770
+ after?: string;
1771
+ on_or_before?: string;
1772
+ on_or_after?: string;
1773
+ };
1774
+ }>;
1475
1775
  }>;
1476
1776
  }>;
1477
1777
  } | {
1478
1778
  or: Array<{
1479
1779
  property: "id";
1480
- id: {
1481
- equals: string;
1482
- };
1483
- } | {
1484
- property: "agent_type";
1485
1780
  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">;
1781
+ equals: string;
1513
1782
  };
1514
1783
  } | {
1515
- property: "model_mode";
1516
- select: {
1517
- equals: "auto" | "pinned";
1784
+ property: "type";
1785
+ event_type: {
1786
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1787
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1518
1788
  };
1519
1789
  } | {
1520
- property: "agent_version";
1790
+ property: "sequence";
1521
1791
  number: {
1522
- equals: number;
1792
+ greater_than?: number;
1793
+ greater_than_or_equal_to?: number;
1794
+ less_than?: number;
1795
+ less_than_or_equal_to?: number;
1523
1796
  };
1524
1797
  } | {
1525
- property: "last_run_at";
1526
- date: {
1527
- after?: string;
1798
+ property: "created_at";
1799
+ timestamp: {
1800
+ equals?: string;
1528
1801
  before?: string;
1802
+ after?: string;
1803
+ on_or_before?: string;
1804
+ on_or_after?: string;
1529
1805
  };
1530
1806
  } | {
1531
1807
  and: Array<{
1532
1808
  property: "id";
1533
- id: {
1809
+ string: {
1534
1810
  equals: string;
1535
1811
  };
1536
1812
  } | {
1537
- property: "agent_type";
1538
- string: {
1539
- equals: "notion_ai" | "custom_agent" | "autofill_custom_agent";
1813
+ property: "type";
1814
+ event_type: {
1815
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1816
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1540
1817
  };
1541
1818
  } | {
1542
- property: "created_by";
1543
- people: {
1544
- contains: string;
1819
+ property: "sequence";
1820
+ number: {
1821
+ greater_than?: number;
1822
+ greater_than_or_equal_to?: number;
1823
+ less_than?: number;
1824
+ less_than_or_equal_to?: number;
1545
1825
  };
1546
1826
  } | {
1547
- property: "created_time";
1548
- date: {
1549
- after?: string;
1827
+ property: "created_at";
1828
+ timestamp: {
1829
+ equals?: string;
1550
1830
  before?: string;
1831
+ after?: string;
1832
+ on_or_before?: string;
1833
+ on_or_after?: string;
1551
1834
  };
1552
1835
  } | {
1553
- property: "favorited";
1554
- checkbox: {
1555
- equals: boolean;
1556
- };
1836
+ and: Array<{
1837
+ property: "id";
1838
+ string: {
1839
+ equals: string;
1840
+ };
1841
+ } | {
1842
+ property: "type";
1843
+ event_type: {
1844
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1845
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1846
+ };
1847
+ } | {
1848
+ property: "sequence";
1849
+ number: {
1850
+ greater_than?: number;
1851
+ greater_than_or_equal_to?: number;
1852
+ less_than?: number;
1853
+ less_than_or_equal_to?: number;
1854
+ };
1855
+ } | {
1856
+ property: "created_at";
1857
+ timestamp: {
1858
+ equals?: string;
1859
+ before?: string;
1860
+ after?: string;
1861
+ on_or_before?: string;
1862
+ on_or_after?: string;
1863
+ };
1864
+ }>;
1557
1865
  } | {
1558
- property: "connections";
1559
- mcp_server: {
1560
- contains: string;
1866
+ or: Array<{
1867
+ property: "id";
1868
+ string: {
1869
+ equals: string;
1870
+ };
1871
+ } | {
1872
+ property: "type";
1873
+ event_type: {
1874
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1875
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1876
+ };
1877
+ } | {
1878
+ property: "sequence";
1879
+ number: {
1880
+ greater_than?: number;
1881
+ greater_than_or_equal_to?: number;
1882
+ less_than?: number;
1883
+ less_than_or_equal_to?: number;
1884
+ };
1885
+ } | {
1886
+ property: "created_at";
1887
+ timestamp: {
1888
+ equals?: string;
1889
+ before?: string;
1890
+ after?: string;
1891
+ on_or_before?: string;
1892
+ on_or_after?: string;
1893
+ };
1894
+ }>;
1895
+ }>;
1896
+ } | {
1897
+ or: Array<{
1898
+ property: "id";
1899
+ string: {
1900
+ equals: string;
1561
1901
  };
1562
1902
  } | {
1563
- property: "status";
1564
- status: {
1565
- in: Array<"active" | "disabled" | "deleted">;
1566
- };
1567
- } | {
1568
- property: "model_mode";
1569
- select: {
1570
- equals: "auto" | "pinned";
1903
+ property: "type";
1904
+ event_type: {
1905
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1906
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1571
1907
  };
1572
1908
  } | {
1573
- property: "agent_version";
1909
+ property: "sequence";
1574
1910
  number: {
1575
- equals: number;
1911
+ greater_than?: number;
1912
+ greater_than_or_equal_to?: number;
1913
+ less_than?: number;
1914
+ less_than_or_equal_to?: number;
1576
1915
  };
1577
1916
  } | {
1578
- property: "last_run_at";
1579
- date: {
1580
- after?: string;
1917
+ property: "created_at";
1918
+ timestamp: {
1919
+ equals?: string;
1581
1920
  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
1921
  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";
1922
+ on_or_before?: string;
1923
+ on_or_after?: string;
1625
1924
  };
1626
1925
  } | {
1627
- property: "agent_version";
1628
- number: {
1629
- equals: number;
1630
- };
1926
+ and: Array<{
1927
+ property: "id";
1928
+ string: {
1929
+ equals: string;
1930
+ };
1931
+ } | {
1932
+ property: "type";
1933
+ event_type: {
1934
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1935
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1936
+ };
1937
+ } | {
1938
+ property: "sequence";
1939
+ number: {
1940
+ greater_than?: number;
1941
+ greater_than_or_equal_to?: number;
1942
+ less_than?: number;
1943
+ less_than_or_equal_to?: number;
1944
+ };
1945
+ } | {
1946
+ property: "created_at";
1947
+ timestamp: {
1948
+ equals?: string;
1949
+ before?: string;
1950
+ after?: string;
1951
+ on_or_before?: string;
1952
+ on_or_after?: string;
1953
+ };
1954
+ }>;
1631
1955
  } | {
1632
- property: "last_run_at";
1633
- date: {
1634
- after?: string;
1635
- before?: string;
1636
- };
1956
+ or: Array<{
1957
+ property: "id";
1958
+ string: {
1959
+ equals: string;
1960
+ };
1961
+ } | {
1962
+ property: "type";
1963
+ event_type: {
1964
+ equals?: "user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status";
1965
+ in?: Array<"user.message" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "session.status">;
1966
+ };
1967
+ } | {
1968
+ property: "sequence";
1969
+ number: {
1970
+ greater_than?: number;
1971
+ greater_than_or_equal_to?: number;
1972
+ less_than?: number;
1973
+ less_than_or_equal_to?: number;
1974
+ };
1975
+ } | {
1976
+ property: "created_at";
1977
+ timestamp: {
1978
+ equals?: string;
1979
+ before?: string;
1980
+ after?: string;
1981
+ on_or_before?: string;
1982
+ on_or_after?: string;
1983
+ };
1984
+ }>;
1637
1985
  }>;
1638
1986
  }>;
1639
1987
  };
1640
1988
  sorts?: Array<{
1641
- property: "created_time" | "last_run_at";
1989
+ property: "sequence" | "created_at";
1642
1990
  direction: "ascending" | "descending";
1643
1991
  }>;
1644
1992
  start_cursor?: string | null;
1645
1993
  page_size?: number;
1646
- verbose?: boolean;
1647
- include_deleted?: boolean;
1648
1994
  };
1649
- export type QueryAgentsParameters = QueryAgentsBodyParameters;
1650
- export type QueryAgentsResponse = {
1995
+ export type QuerySessionEventsParameters = QuerySessionEventsPathParameters & QuerySessionEventsBodyParameters;
1996
+ export type QuerySessionEventsResponse = {
1651
1997
  object: "list";
1652
- type: "agent";
1998
+ type: "session_event";
1999
+ session_event: Record<string, never>;
1653
2000
  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
- }>;
2001
+ object: "session_event";
2002
+ id: string;
2003
+ session_id: string;
2004
+ sequence: number;
2005
+ created_at: string;
2006
+ type: "user.message";
2007
+ content: Array<{
2008
+ type: "text";
2009
+ text: string;
1718
2010
  } | {
1719
- type: "discord";
2011
+ type: "file";
1720
2012
  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
- }>;
2013
+ content_type: string;
2014
+ url: string;
2015
+ expiry_time?: string;
2016
+ }>;
2017
+ created_by: {
2018
+ id: string;
2019
+ type: "user" | "bot";
2020
+ } | null;
2021
+ metadata: Record<string, string> | null;
2022
+ } | {
2023
+ object: "session_event";
2024
+ id: string;
2025
+ session_id: string;
2026
+ sequence: number;
2027
+ created_at: string;
2028
+ type: "agent.message";
2029
+ content: Array<{
2030
+ type: "text";
2031
+ text: string;
1734
2032
  } | {
1735
- type: "mcp_server";
2033
+ type: "file";
1736
2034
  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
- }>;
2035
+ content_type: string;
2036
+ url: string;
2037
+ expiry_time?: string;
1775
2038
  }>;
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
2039
  created_by: {
2040
+ id: string;
1779
2041
  type: "user" | "bot";
1780
- id: IdResponse;
1781
2042
  } | null;
1782
- agent_version: {
1783
- id: IdResponse;
1784
- number: number;
1785
- published_at: string;
2043
+ metadata: {
2044
+ model: string;
1786
2045
  } | 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>>;
2046
+ } | {
2047
+ object: "session_event";
2048
+ id: string;
2049
+ session_id: string;
2050
+ sequence: number;
2051
+ created_at: string;
2052
+ type: "agent.thinking";
2053
+ content: Array<{
2054
+ type: "text";
2055
+ text: string;
1813
2056
  }>;
1814
- instructions?: string | null;
1815
2057
  } | {
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>;
2058
+ object: "session_event";
2059
+ id: string;
2060
+ session_id: string;
2061
+ sequence: number;
2062
+ created_at: string;
2063
+ type: "agent.tool_use";
2064
+ tool_name: string;
2065
+ } | {
2066
+ object: "session_event";
2067
+ id: string;
2068
+ session_id: string;
2069
+ sequence: number;
2070
+ created_at: string;
2071
+ type: "agent.tool_result";
2072
+ tool_use_id: string;
2073
+ tool_name: string;
2074
+ is_error: boolean;
2075
+ } | {
2076
+ object: "session_event";
2077
+ id: string;
2078
+ session_id: string;
2079
+ sequence: number;
2080
+ created_at: string;
2081
+ type: "session.status";
2082
+ status: "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2083
+ required_actions?: Array<{
2084
+ action_id: string;
2085
+ title: string;
2086
+ options: Array<{
2087
+ id: "approve" | "reject";
2088
+ label: string;
1936
2089
  }>;
1937
2090
  }>;
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
- }>;
2091
+ error?: {
2092
+ code: string;
2093
+ message: string;
2094
+ retryable: boolean;
2095
+ };
1969
2096
  }>;
1970
2097
  has_more: boolean;
1971
2098
  next_cursor: string | null;
1972
2099
  };
1973
2100
  /**
1974
- * Query agents
2101
+ * Query session events
1975
2102
  */
1976
- export declare const queryAgents: {
2103
+ export declare const querySessionEvents: {
1977
2104
  readonly method: "post";
1978
- readonly pathParams: readonly [];
2105
+ readonly pathParams: readonly ["session_id"];
1979
2106
  readonly queryParams: readonly [];
1980
- readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size", "verbose", "include_deleted"];
1981
- readonly path: () => string;
2107
+ readonly bodyParams: readonly ["filter", "sorts", "start_cursor", "page_size"];
2108
+ readonly path: (p: QuerySessionEventsPathParameters) => string;
1982
2109
  };
1983
- type QuerySessionEventsPathParameters = {
2110
+ type CancelSessionPathParameters = {
1984
2111
  session_id: IdRequest;
1985
2112
  };
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">;
2113
+ type CancelSessionBodyParameters = {
2114
+ event_id?: string;
2115
+ };
2116
+ export type CancelSessionParameters = CancelSessionPathParameters & CancelSessionBodyParameters;
2117
+ export type CancelSessionResponse = {
2118
+ object: "session";
2119
+ id: string;
2120
+ agent_id: string;
2121
+ title: string;
2122
+ status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2123
+ created_at: string;
2124
+ updated_at: string;
2125
+ required_actions?: Array<{
2126
+ action_id: string;
2127
+ title: string;
2128
+ options: Array<{
2129
+ id: "approve" | "reject";
2130
+ label: string;
2131
+ }>;
2132
+ }>;
2133
+ error?: {
2134
+ code: string;
2135
+ message: string;
2136
+ retryable: boolean;
2137
+ };
2138
+ };
2139
+ /**
2140
+ * Cancel a session
2141
+ */
2142
+ export declare const cancelSession: {
2143
+ readonly method: "post";
2144
+ readonly pathParams: readonly ["session_id"];
2145
+ readonly queryParams: readonly [];
2146
+ readonly bodyParams: readonly ["event_id"];
2147
+ readonly path: (p: CancelSessionPathParameters) => string;
2148
+ };
2149
+ type ChatWithAgentPathParameters = {
2150
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
2151
+ };
2152
+ type ChatWithAgentQueryParameters = {
2153
+ verbose?: boolean;
2154
+ };
2155
+ type ChatWithAgentBodyParameters = {
2156
+ message?: string;
2157
+ attachments?: Array<{
2158
+ file_upload: {
2159
+ id: string;
1997
2160
  };
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;
2161
+ type?: "file_upload";
2162
+ name?: string;
2163
+ }>;
2164
+ metadata?: Record<string, string>;
2165
+ prompt_context?: string;
2166
+ /** @deprecated */
2167
+ thread_id?: IdRequest;
2168
+ };
2169
+ export type ChatWithAgentParameters = ChatWithAgentPathParameters & ChatWithAgentQueryParameters & ChatWithAgentBodyParameters;
2170
+ export type ChatWithAgentResponse = {
2171
+ object: "chat.invocation";
2172
+ agent_id: string;
2173
+ thread_id: string;
2174
+ invocation_id: string;
2175
+ status: "pending";
2176
+ };
2177
+ /**
2178
+ * Chat with agent
2179
+ */
2180
+ export declare const chatWithAgent: {
2181
+ readonly method: "post";
2182
+ readonly pathParams: readonly ["agent_id"];
2183
+ readonly queryParams: readonly ["verbose"];
2184
+ readonly bodyParams: readonly ["message", "attachments", "metadata", "prompt_context", "thread_id"];
2185
+ readonly path: (p: ChatWithAgentPathParameters) => string;
2186
+ };
2187
+ type ContinueThreadPathParameters = {
2188
+ thread_id: IdRequest;
2189
+ };
2190
+ type ContinueThreadBodyParameters = {
2191
+ action_id: IdRequest;
2192
+ option_id: "approve" | "reject";
2193
+ } | {
2194
+ action_id: IdRequest;
2195
+ option_id: "use_connection";
2196
+ input: {
2197
+ connection_id: IdRequest;
2198
+ };
2199
+ };
2200
+ export type ContinueThreadParameters = ContinueThreadPathParameters & ContinueThreadBodyParameters;
2201
+ export type ContinueThreadResponse = {
2202
+ object: "chat.invocation";
2203
+ agent_id: string;
2204
+ thread_id: string;
2205
+ invocation_id: string;
2206
+ status: "pending";
2207
+ };
2208
+ /**
2209
+ * Continue a thread
2210
+ */
2211
+ export declare const continueThread: {
2212
+ readonly method: "post";
2213
+ readonly pathParams: readonly ["thread_id"];
2214
+ readonly queryParams: readonly [];
2215
+ readonly bodyParams: readonly ["action_id", "option_id", "input"];
2216
+ readonly path: (p: ContinueThreadPathParameters) => string;
2217
+ };
2218
+ type CreateExternalAgentStubVaultPathParameters = {
2219
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
2220
+ };
2221
+ type CreateExternalAgentStubVaultBodyParameters = {
2222
+ name: string;
2223
+ credential: {
2224
+ value: string;
2225
+ expires_at: string;
2226
+ };
2227
+ target: {
2228
+ type: "mcp_server";
2229
+ server_url: string;
2230
+ authorization: {
2231
+ type: "bearer";
2005
2232
  };
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;
2233
+ };
2234
+ };
2235
+ export type CreateExternalAgentStubVaultParameters = CreateExternalAgentStubVaultPathParameters & CreateExternalAgentStubVaultBodyParameters;
2236
+ export type CreateExternalAgentStubVaultResponse = {
2237
+ id: string;
2238
+ name: string;
2239
+ credential: {
2240
+ expires_at: string;
2241
+ };
2242
+ target: {
2243
+ type: "mcp_server";
2244
+ server_url: string;
2245
+ authorization: {
2246
+ type: "bearer";
2014
2247
  };
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;
2248
+ };
2249
+ status: "active" | "expired";
2250
+ version: number;
2251
+ created_at: string;
2252
+ updated_at: string;
2253
+ };
2254
+ /**
2255
+ * Create external agent stub vault
2256
+ */
2257
+ export declare const createExternalAgentStubVault: {
2258
+ readonly method: "post";
2259
+ readonly pathParams: readonly ["agent_id"];
2260
+ readonly queryParams: readonly [];
2261
+ readonly bodyParams: readonly ["name", "credential", "target"];
2262
+ readonly path: (p: CreateExternalAgentStubVaultPathParameters) => string;
2263
+ };
2264
+ type DeleteExternalAgentStubVaultPathParameters = {
2265
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
2266
+ vault_id: string;
2267
+ };
2268
+ export type DeleteExternalAgentStubVaultParameters = DeleteExternalAgentStubVaultPathParameters;
2269
+ export type DeleteExternalAgentStubVaultResponse = EmptyObject;
2270
+ /**
2271
+ * Delete external agent stub vault
2272
+ */
2273
+ export declare const deleteExternalAgentStubVault: {
2274
+ readonly method: "delete";
2275
+ readonly pathParams: readonly ["agent_id", "vault_id"];
2276
+ readonly queryParams: readonly [];
2277
+ readonly bodyParams: readonly [];
2278
+ readonly path: (p: DeleteExternalAgentStubVaultPathParameters) => string;
2279
+ };
2280
+ type UpdateExternalAgentStubVaultPathParameters = {
2281
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
2282
+ vault_id: string;
2283
+ };
2284
+ type UpdateExternalAgentStubVaultBodyParameters = {
2285
+ expected_version: number;
2286
+ credential: {
2287
+ value: string;
2288
+ expires_at: string;
2289
+ };
2290
+ };
2291
+ export type UpdateExternalAgentStubVaultParameters = UpdateExternalAgentStubVaultPathParameters & UpdateExternalAgentStubVaultBodyParameters;
2292
+ export type UpdateExternalAgentStubVaultResponse = {
2293
+ id: string;
2294
+ name: string;
2295
+ credential: {
2296
+ expires_at: string;
2297
+ };
2298
+ target: {
2299
+ type: "mcp_server";
2300
+ server_url: string;
2301
+ authorization: {
2302
+ type: "bearer";
2303
+ };
2304
+ };
2305
+ status: "active" | "expired";
2306
+ version: number;
2307
+ created_at: string;
2308
+ updated_at: string;
2309
+ };
2310
+ /**
2311
+ * Update external agent stub vault
2312
+ */
2313
+ export declare const updateExternalAgentStubVault: {
2314
+ readonly method: "patch";
2315
+ readonly pathParams: readonly ["agent_id", "vault_id"];
2316
+ readonly queryParams: readonly [];
2317
+ readonly bodyParams: readonly ["expected_version", "credential"];
2318
+ readonly path: (p: UpdateExternalAgentStubVaultPathParameters) => string;
2319
+ };
2320
+ type ListAgentsQueryParameters = {
2321
+ name?: string;
2322
+ agent_type?: Array<"notion_ai" | "custom_agent" | "autofill_custom_agent" | "external">;
2323
+ agent_ids?: Array<IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333">;
2324
+ created_by?: Array<IdRequest | "me">;
2325
+ start_cursor?: string | null;
2326
+ page_size?: number;
2327
+ verbose?: boolean;
2328
+ };
2329
+ export type ListAgentsParameters = ListAgentsQueryParameters;
2330
+ export type ListAgentsResponse = {
2331
+ object: "list";
2332
+ type: "agent";
2333
+ results: Array<{
2334
+ object: "agent";
2335
+ id: IdResponse | "notion_ai";
2336
+ agent_type: "notion_ai" | "custom_agent" | "autofill_custom_agent" | "external";
2337
+ name: string;
2338
+ description: string | null;
2339
+ instructions_page_id: IdResponse | null;
2340
+ icon: PageIconResponse | {
2341
+ type: "custom_agent_avatar";
2342
+ custom_agent_avatar: {
2343
+ static_url: string;
2344
+ animated_url: string;
2253
2345
  };
2346
+ } | null;
2347
+ version: {
2348
+ id: IdResponse;
2349
+ number: number;
2350
+ published_at: string;
2351
+ } | null;
2352
+ agent_version: {
2353
+ id: IdResponse;
2354
+ number: number;
2355
+ published_at: string;
2356
+ } | null;
2357
+ model: {
2358
+ mode: "auto";
2254
2359
  } | {
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
- };
2360
+ mode: "pinned";
2361
+ id: string | null;
2362
+ };
2363
+ connections: Array<{
2364
+ type: "notion";
2365
+ name: string;
2366
+ account: null;
2367
+ permissions: Array<{
2368
+ target: {
2369
+ type: "page";
2370
+ id: string;
2289
2371
  } | {
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
- };
2372
+ type: "database_property";
2373
+ data_source_id: string;
2374
+ property_id: string;
2295
2375
  } | {
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
- };
2376
+ type: "agent";
2377
+ id: string;
2303
2378
  } | {
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
- };
2379
+ type: "workspace";
2319
2380
  } | {
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
- };
2381
+ type: "owner_private_pages";
2325
2382
  } | {
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
- };
2383
+ type: "web_search";
2384
+ allowed_domains: Array<string> | null;
2333
2385
  } | {
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
- }>;
2386
+ type: "notion_help_docs_search";
2387
+ };
2388
+ scopes: Array<string>;
2343
2389
  }>;
2344
2390
  } | {
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
- };
2391
+ type: "slack";
2392
+ name: string;
2393
+ account: {
2394
+ type: "slack_workspace";
2395
+ team_id: string;
2396
+ } | "hidden" | null;
2397
+ permissions: Array<{
2398
+ target: {
2399
+ type: "slack_channel";
2400
+ id: string;
2415
2401
  } | {
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
- };
2402
+ type: "slack_all_public_channels";
2423
2403
  } | {
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
- }>;
2404
+ type: "slack_all_channels";
2405
+ };
2406
+ scopes: Array<string>;
2433
2407
  }>;
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
2408
  } | {
2459
- type: "file";
2409
+ type: "discord";
2460
2410
  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;
2411
+ account: {
2412
+ type: "discord_server";
2413
+ id: string;
2414
+ } | "hidden" | null;
2415
+ permissions: Array<{
2416
+ target: {
2417
+ type: "discord_channel";
2418
+ id: string;
2419
+ } | {
2420
+ type: "discord_all_channels";
2421
+ };
2422
+ scopes: Array<string>;
2423
+ }>;
2480
2424
  } | {
2481
- type: "file";
2425
+ type: "mcp_server";
2482
2426
  name: string;
2483
- content_type: string;
2484
- url: string;
2485
- expiry_time?: string;
2427
+ account: {
2428
+ type: "mcp_server";
2429
+ server_host: string;
2430
+ } | "hidden" | null;
2431
+ enabled_tools: Array<{
2432
+ name: string;
2433
+ title: string | null;
2434
+ }> | "hidden" | null;
2435
+ run_tools_automatically: {
2436
+ read: boolean;
2437
+ write: boolean;
2438
+ };
2439
+ } | {
2440
+ type: "custom_mcp_server";
2441
+ name: string;
2442
+ account: {
2443
+ type: "mcp_server";
2444
+ server_host: string;
2445
+ } | "hidden" | null;
2446
+ enabled_tools: Array<{
2447
+ name: string;
2448
+ title: string | null;
2449
+ }> | "hidden" | null;
2450
+ run_tools_automatically: {
2451
+ read: boolean;
2452
+ write: boolean;
2453
+ };
2454
+ } | {
2455
+ type: "asana" | "box" | "calendar" | "computer" | "confluence" | "cursor" | "feedback" | "files" | "fs" | "github" | "gmail" | "google_calendar" | "google_drive" | "google_drive_oauth" | "gtm" | "helpdocs" | "images" | "jira" | "linear" | "mail" | "marketplace" | "memory" | "microsoft_teams" | "microsoft_teams_oauth" | "outlook" | "salesforce" | "search" | "security" | "sharepoint" | "sharepoint_oauth" | "shopify" | "skills" | "system" | "test" | "web" | "webhooks" | "worker" | "workers";
2456
+ name: string;
2457
+ account: string | null;
2458
+ permissions: Array<{
2459
+ target: {
2460
+ type: string;
2461
+ id: string;
2462
+ };
2463
+ scopes: Array<string>;
2464
+ }>;
2486
2465
  }>;
2466
+ status: "active" | "disabled" | "deleted";
2487
2467
  created_by: {
2488
- id: string;
2489
- type: "user" | "bot";
2490
- } | null;
2491
- metadata: {
2492
- model: string;
2468
+ object: "user";
2469
+ type: "user";
2470
+ id: IdResponse;
2493
2471
  } | null;
2472
+ created_time: string | null;
2473
+ last_edited_time: string | null;
2474
+ last_run_time: string | "hidden" | null;
2475
+ last_run_at: string | "hidden" | null;
2476
+ instructions?: string | null;
2477
+ }>;
2478
+ has_more: boolean;
2479
+ next_cursor: string | null;
2480
+ };
2481
+ /**
2482
+ * List agents
2483
+ */
2484
+ export declare const listAgents: {
2485
+ readonly method: "get";
2486
+ readonly pathParams: readonly [];
2487
+ readonly queryParams: readonly ["name", "agent_type", "agent_ids", "created_by", "start_cursor", "page_size", "verbose"];
2488
+ readonly bodyParams: readonly [];
2489
+ readonly path: () => string;
2490
+ };
2491
+ type ListExternalAgentStubSessionEventsPathParameters = {
2492
+ agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
2493
+ session_id: IdRequest;
2494
+ };
2495
+ type ListExternalAgentStubSessionEventsQueryParameters = {
2496
+ cursor?: string;
2497
+ };
2498
+ export type ListExternalAgentStubSessionEventsParameters = ListExternalAgentStubSessionEventsPathParameters & ListExternalAgentStubSessionEventsQueryParameters;
2499
+ export type ListExternalAgentStubSessionEventsResponse = {
2500
+ events: Array<{
2501
+ type: "assistant.thinking";
2502
+ text: string;
2494
2503
  } | {
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
- }>;
2504
+ type: "assistant.message";
2505
+ text: string;
2505
2506
  } | {
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;
2507
+ type: "tool.started";
2508
+ tool_call_id: string;
2509
+ tool_name?: string;
2510
+ input?: Record<string, never>;
2513
2511
  } | {
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;
2512
+ type: "tool.output";
2513
+ tool_call_id: string;
2514
+ output?: Record<string, never>;
2515
+ is_error?: boolean;
2523
2516
  } | {
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?: {
2517
+ type: "error";
2518
+ error: {
2540
2519
  code: string;
2541
2520
  message: string;
2542
2521
  retryable: boolean;
2522
+ additional_data?: Record<string, string | Array<string>>;
2543
2523
  };
2544
2524
  }>;
2545
- has_more: boolean;
2546
- next_cursor: string | null;
2525
+ is_running: boolean;
2526
+ next_cursor?: string;
2547
2527
  };
2548
2528
  /**
2549
- * Query session events
2529
+ * List external agent stub session events
2550
2530
  */
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;
2531
+ export declare const listExternalAgentStubSessionEvents: {
2532
+ readonly method: "get";
2533
+ readonly pathParams: readonly ["agent_id", "session_id"];
2534
+ readonly queryParams: readonly ["cursor"];
2535
+ readonly bodyParams: readonly [];
2536
+ readonly path: (p: ListExternalAgentStubSessionEventsPathParameters) => string;
2557
2537
  };
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;
2538
+ type ListThreadMessagesPathParameters = {
2539
+ thread_id: IdRequest;
2540
+ };
2541
+ type ListThreadMessagesQueryParameters = {
2542
+ verbose?: boolean;
2543
+ role?: "user" | "agent";
2544
+ start_cursor?: string | null;
2545
+ page_size?: number;
2546
+ };
2547
+ export type ListThreadMessagesParameters = ListThreadMessagesPathParameters & ListThreadMessagesQueryParameters;
2548
+ export type ListThreadMessagesResponse = {
2549
+ object: "list";
2550
+ type: "thread_message";
2551
+ results: Array<{
2552
+ object: "thread_message";
2553
+ id: IdResponse;
2554
+ role: "user" | "agent";
2555
+ content: string;
2556
+ created_time: string;
2557
+ parent: {
2558
+ type: "thread";
2559
+ id: IdResponse;
2583
2560
  };
2584
- } | {
2585
- and: Array<{
2586
- property: "id";
2587
- string: {
2588
- equals: string;
2589
- };
2590
- } | {
2591
- property: "agent_id";
2592
- string: {
2593
- equals: string;
2594
- };
2561
+ attachments?: Array<{
2562
+ name: string;
2563
+ content_type: string;
2564
+ url: string;
2565
+ expiry_time?: string;
2566
+ }>;
2567
+ content_parts?: Array<{
2568
+ type: "text";
2569
+ text: string;
2595
2570
  } | {
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
- };
2571
+ type: "thinking";
2572
+ text: string;
2601
2573
  } | {
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
- };
2574
+ type: "tool_call";
2575
+ tool_call_id: string | null;
2576
+ tool_name: string;
2577
+ results?: Array<{
2578
+ id: IdResponse;
2579
+ agent_step_id: IdResponse | null;
2580
+ tool_call_id: string | null;
2581
+ tool_name: string;
2582
+ tool_type: string;
2583
+ state: string;
2584
+ started_at: number;
2585
+ finished_at: number | null;
2586
+ duration_ms: number | null;
2587
+ }>;
2609
2588
  } | {
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
- };
2589
+ type: "follow_ups";
2590
+ follow_ups: Array<{
2591
+ label: string;
2592
+ message: string;
2634
2593
  }>;
2635
2594
  } | {
2636
- or: Array<{
2637
- property: "id";
2638
- string: {
2639
- equals: string;
2640
- };
2595
+ type: "custom_agent_template_picker";
2596
+ }>;
2597
+ pending_user_actions?: Array<{
2598
+ id: IdResponse;
2599
+ type: "tool_confirmation";
2600
+ title: string;
2601
+ requirements: Array<{
2602
+ type: "general";
2641
2603
  } | {
2642
- property: "agent_id";
2643
- string: {
2644
- equals: string;
2645
- };
2604
+ type: "manage_workers";
2646
2605
  } | {
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
- };
2606
+ type: "url_safety";
2607
+ urls: Array<string>;
2608
+ required_by_workspace_policy?: boolean;
2652
2609
  } | {
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
- };
2610
+ type: "permission_escalation";
2611
+ destination_title?: string;
2612
+ source_titles?: Array<string>;
2693
2613
  } | {
2694
- property: "agent_id";
2695
- string: {
2696
- equals: string;
2697
- };
2614
+ type: "delete_content";
2615
+ page_count: number;
2616
+ database_count: number;
2617
+ meeting_notes_block_count?: number;
2698
2618
  } | {
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
- };
2619
+ type: "connect_integration";
2620
+ integration_type: string;
2621
+ integration_name: string;
2622
+ handoff_url: string;
2704
2623
  } | {
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
- };
2624
+ type: "admin_mode";
2625
+ explanation?: string;
2712
2626
  }>;
2713
- } | {
2714
- or: Array<{
2715
- property: "id";
2716
- string: {
2717
- equals: string;
2718
- };
2719
- } | {
2720
- property: "agent_id";
2721
- string: {
2722
- equals: string;
2723
- };
2627
+ options: Array<{
2628
+ id: "approve";
2629
+ label: string;
2724
2630
  } | {
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
- };
2631
+ id: "reject";
2632
+ label: string;
2730
2633
  } | {
2731
- property: "created_at" | "updated_at";
2732
- timestamp: {
2733
- before?: string;
2734
- after?: string;
2735
- on_or_before?: string;
2736
- on_or_after?: string;
2634
+ id: "use_connection";
2635
+ label: string;
2636
+ input: {
2637
+ type: "connection_id";
2638
+ required: true;
2737
2639
  };
2738
2640
  }>;
2739
2641
  }>;
2740
- };
2741
- sorts?: Array<{
2742
- property: "created_at" | "updated_at";
2743
- direction: "ascending" | "descending";
2744
2642
  }>;
2643
+ has_more: boolean;
2644
+ next_cursor: string | null;
2645
+ };
2646
+ /**
2647
+ * List thread messages
2648
+ */
2649
+ export declare const listThreadMessages: {
2650
+ readonly method: "get";
2651
+ readonly pathParams: readonly ["thread_id"];
2652
+ readonly queryParams: readonly ["verbose", "role", "start_cursor", "page_size"];
2653
+ readonly bodyParams: readonly [];
2654
+ readonly path: (p: ListThreadMessagesPathParameters) => string;
2655
+ };
2656
+ type SendThreadMessagePathParameters = {
2657
+ thread_id: IdRequest;
2658
+ };
2659
+ type SendThreadMessageBodyParameters = {
2660
+ message?: string;
2661
+ attachments?: Array<{
2662
+ file_upload: {
2663
+ id: string;
2664
+ };
2665
+ type?: "file_upload";
2666
+ name?: string;
2667
+ }>;
2668
+ metadata?: Record<string, string>;
2669
+ prompt_context?: string;
2670
+ };
2671
+ export type SendThreadMessageParameters = SendThreadMessagePathParameters & SendThreadMessageBodyParameters;
2672
+ export type SendThreadMessageResponse = {
2673
+ object: "chat.invocation";
2674
+ agent_id: string;
2675
+ thread_id: string;
2676
+ invocation_id: string;
2677
+ status: "pending";
2678
+ };
2679
+ /**
2680
+ * Send a thread message
2681
+ */
2682
+ export declare const sendThreadMessage: {
2683
+ readonly method: "post";
2684
+ readonly pathParams: readonly ["thread_id"];
2685
+ readonly queryParams: readonly [];
2686
+ readonly bodyParams: readonly ["message", "attachments", "metadata", "prompt_context"];
2687
+ readonly path: (p: SendThreadMessagePathParameters) => string;
2688
+ };
2689
+ type ListThreadsPathParameters = {
2690
+ agent_id: IdRequest | "notion_ai" | "33333333-3333-3333-3333-333333333333";
2691
+ };
2692
+ type ListThreadsQueryParameters = {
2693
+ id?: IdRequest;
2694
+ title?: string;
2695
+ status?: "pending" | "requires_action" | "completed" | "failed" | "canceled";
2696
+ activity?: "all" | "pending" | "in_progress" | "failed" | "success";
2697
+ created_by?: Array<IdRequest | "me">;
2698
+ last_used_by?: Array<IdRequest | "me">;
2699
+ sort_by?: "created_time" | "last_used_time";
2700
+ sort_direction?: "ascending" | "descending";
2745
2701
  start_cursor?: string | null;
2746
2702
  page_size?: number;
2747
2703
  };
2748
- export type QuerySessionsParameters = QuerySessionsBodyParameters;
2749
- export type QuerySessionsResponse = {
2704
+ export type ListThreadsParameters = ListThreadsPathParameters & ListThreadsQueryParameters;
2705
+ export type ListThreadsResponse = {
2750
2706
  object: "list";
2751
- type: "session";
2752
- session: Record<string, never>;
2707
+ type: "thread";
2753
2708
  results: Array<{
2754
- object: "session";
2755
- id: string;
2756
- agent_id: string;
2709
+ object: "thread";
2710
+ id: IdResponse;
2757
2711
  title: string;
2758
- status: "queued" | "in_progress" | "requires_action" | "completed" | "failed" | "canceled" | "terminated";
2712
+ status: "pending" | "requires_action" | "completed" | "canceled" | "failed";
2713
+ created_time: string;
2714
+ last_edited_time: string;
2759
2715
  created_by: {
2760
- id: string;
2761
- type: "user" | "bot";
2716
+ id: IdResponse;
2717
+ type: "bot" | "user";
2762
2718
  };
2763
2719
  agent_version: {
2764
- id: string;
2720
+ id: IdResponse;
2765
2721
  number: number;
2766
2722
  published_at: string;
2767
2723
  } | null;
@@ -2771,21 +2727,7 @@ export type QuerySessionsResponse = {
2771
2727
  type: "pinned";
2772
2728
  ids: Array<string | null>;
2773
2729
  };
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
- };
2730
+ error?: string;
2789
2731
  trigger_type?: string;
2790
2732
  type_labels?: Array<string> | null;
2791
2733
  chat_user_emails?: Array<string> | null;
@@ -2793,20 +2735,64 @@ export type QuerySessionsResponse = {
2793
2735
  tool_call_count?: number | null;
2794
2736
  credits_used?: number | null;
2795
2737
  runs_completed?: number | null;
2796
- message_count?: number | null;
2738
+ pending_user_actions?: Array<{
2739
+ id: IdResponse;
2740
+ type: "tool_confirmation";
2741
+ title: string;
2742
+ requirements: Array<{
2743
+ type: "general";
2744
+ } | {
2745
+ type: "manage_workers";
2746
+ } | {
2747
+ type: "url_safety";
2748
+ urls: Array<string>;
2749
+ required_by_workspace_policy?: boolean;
2750
+ } | {
2751
+ type: "permission_escalation";
2752
+ destination_title?: string;
2753
+ source_titles?: Array<string>;
2754
+ } | {
2755
+ type: "delete_content";
2756
+ page_count: number;
2757
+ database_count: number;
2758
+ meeting_notes_block_count?: number;
2759
+ } | {
2760
+ type: "connect_integration";
2761
+ integration_type: string;
2762
+ integration_name: string;
2763
+ handoff_url: string;
2764
+ } | {
2765
+ type: "admin_mode";
2766
+ explanation?: string;
2767
+ }>;
2768
+ options: Array<{
2769
+ id: "approve";
2770
+ label: string;
2771
+ } | {
2772
+ id: "reject";
2773
+ label: string;
2774
+ } | {
2775
+ id: "use_connection";
2776
+ label: string;
2777
+ input: {
2778
+ type: "connection_id";
2779
+ required: true;
2780
+ };
2781
+ }>;
2782
+ }>;
2797
2783
  }>;
2798
2784
  has_more: boolean;
2799
2785
  next_cursor: string | null;
2800
2786
  };
2801
2787
  /**
2802
- * Query sessions
2788
+ * List threads
2803
2789
  */
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;
2790
+ export declare const listThreads: {
2791
+ readonly method: "get";
2792
+ readonly pathParams: readonly ["agent_id"];
2793
+ readonly queryParams: readonly ["id", "title", "status", "activity", "created_by", "last_used_by", "sort_by", "sort_direction", "start_cursor", "page_size"];
2794
+ readonly bodyParams: readonly [];
2795
+ readonly path: (p: ListThreadsPathParameters) => string;
2810
2796
  };
2811
2797
  type QueryThreadMessagesPathParameters = {
2812
2798
  thread_id: IdRequest;
@@ -3040,65 +3026,6 @@ export declare const queryThreads: {
3040
3026
  readonly bodyParams: readonly ["query", "filter", "sorts", "start_cursor", "page_size"];
3041
3027
  readonly path: (p: QueryThreadsPathParameters) => string;
3042
3028
  };
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
3029
  type SendExternalAgentStubSessionMessagePathParameters = {
3103
3030
  agent_id: IdRequest | "33333333-3333-3333-3333-333333333333";
3104
3031
  session_id: IdRequest;
@@ -3162,107 +3089,5 @@ export declare const startExternalAgentStubSession: {
3162
3089
  readonly bodyParams: readonly ["spec_version", "client_reference_id", "configs", "model", "cwd", "locale", "system_prompt"];
3163
3090
  readonly path: (p: StartExternalAgentStubSessionPathParameters) => string;
3164
3091
  };
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
3092
  export {};
3268
3093
  //# sourceMappingURL=agents.d.ts.map