@naturali/sdk 0.47.1 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -602,6 +602,272 @@ const createClient = (config = {}) => {
602
602
  const client = createClient(createConfig());
603
603
  //#endregion
604
604
  //#region src/generated/sdk.gen.ts
605
+ var Channels = class {
606
+ /**
607
+ * List addresses
608
+ */
609
+ static listAddresses(options) {
610
+ return (options.client ?? client).get({
611
+ url: "/v1/projects/{project_id}/addresses",
612
+ ...options
613
+ });
614
+ }
615
+ /**
616
+ * Erase an address
617
+ *
618
+ * Removes the address, its conversations, and its runtime actor and sessions.
619
+ *
620
+ */
621
+ static deleteAddress(options) {
622
+ return (options.client ?? client).delete({
623
+ url: "/v1/projects/{project_id}/addresses/{identifier}",
624
+ ...options
625
+ });
626
+ }
627
+ /**
628
+ * Get an address
629
+ */
630
+ static getAddress(options) {
631
+ return (options.client ?? client).get({
632
+ url: "/v1/projects/{project_id}/addresses/{identifier}",
633
+ ...options
634
+ });
635
+ }
636
+ /**
637
+ * Set or clear this address's own action
638
+ *
639
+ * Upserts the address and its `action` in one call. `action: null` forgets the exception and defers back to the route table; any other `action` requires the same fields a route or channel default would (`agent_id` for `agent`, `text` for `message`).
640
+ *
641
+ */
642
+ static setAddressAction(options) {
643
+ return (options.client ?? client).put({
644
+ url: "/v1/projects/{project_id}/addresses/{identifier}",
645
+ ...options,
646
+ headers: {
647
+ "Content-Type": "application/json",
648
+ ...options.headers
649
+ }
650
+ });
651
+ }
652
+ /**
653
+ * List an address's conversations
654
+ *
655
+ * Every conversation this address has had, across every channel it has ever messaged — an address is project-scoped, not channel-scoped.
656
+ *
657
+ */
658
+ static listAddressConversations(options) {
659
+ return (options.client ?? client).get({
660
+ url: "/v1/projects/{project_id}/addresses/{identifier}/conversations",
661
+ ...options
662
+ });
663
+ }
664
+ /**
665
+ * List channel kinds
666
+ *
667
+ * Every connectable kind, its surfaces, and the predicates its routes can match on (engine-wide ones like `address_known` plus its own, like Discord's `guild_id`).
668
+ *
669
+ */
670
+ static listChannelKinds(options) {
671
+ return (options?.client ?? client).get({
672
+ url: "/v1/channel-kinds",
673
+ ...options
674
+ });
675
+ }
676
+ /**
677
+ * List a channel's routes
678
+ */
679
+ static listChannelRoutes(options) {
680
+ return (options.client ?? client).get({
681
+ url: "/v1/projects/{project_id}/channels/{channel_id}/routes",
682
+ ...options
683
+ });
684
+ }
685
+ /**
686
+ * Create a route
687
+ *
688
+ * `action` is required; `agent_id` is required when it is `agent`, `text` when it is `message`; `repeat` is only valid alongside `action: message`. `surface`, when present, must be one this channel's kind serves (`GET /v1/channel-kinds`) — otherwise `400 unknown_surface`. `match` keys must be predicates that kind's registry declares — otherwise `400 unknown_predicate`. Writing a route for a surface whose transport mode is off (e.g. a Discord `guild_thread` route before `mention_threads` is enabled) still succeeds, with `unreachable_surface` in the response `warnings`.
689
+ *
690
+ */
691
+ static createChannelRoute(options) {
692
+ return (options.client ?? client).post({
693
+ url: "/v1/projects/{project_id}/channels/{channel_id}/routes",
694
+ ...options,
695
+ headers: {
696
+ "Content-Type": "application/json",
697
+ ...options.headers
698
+ }
699
+ });
700
+ }
701
+ /**
702
+ * Delete a route
703
+ */
704
+ static deleteChannelRoute(options) {
705
+ return (options.client ?? client).delete({
706
+ url: "/v1/projects/{project_id}/channels/{channel_id}/routes/{route_id}",
707
+ ...options
708
+ });
709
+ }
710
+ /**
711
+ * Get a route
712
+ */
713
+ static getChannelRoute(options) {
714
+ return (options.client ?? client).get({
715
+ url: "/v1/projects/{project_id}/channels/{channel_id}/routes/{route_id}",
716
+ ...options
717
+ });
718
+ }
719
+ /**
720
+ * Replace a route
721
+ *
722
+ * Full replace, the same validation as create.
723
+ */
724
+ static updateChannelRoute(options) {
725
+ return (options.client ?? client).patch({
726
+ url: "/v1/projects/{project_id}/channels/{channel_id}/routes/{route_id}",
727
+ ...options,
728
+ headers: {
729
+ "Content-Type": "application/json",
730
+ ...options.headers
731
+ }
732
+ });
733
+ }
734
+ /**
735
+ * Read the whole route table
736
+ *
737
+ * Every route across every channel in the project, one read — the table is small by construction (CHANNELS-ROUTING.md §3.6), so this is unpaginated.
738
+ *
739
+ */
740
+ static listProjectChannelRoutes(options) {
741
+ return (options.client ?? client).get({
742
+ url: "/v1/projects/{project_id}/channel-routes",
743
+ ...options
744
+ });
745
+ }
746
+ /**
747
+ * Open a conversation
748
+ *
749
+ * The outbound-first path (CHANNELS-ROUTING.md §3.11): open a conversation for `{ channel_id, identifier }` ahead of any inbound message, which falls out of making the identifier the unit rather than the message. Resolves the same three-layer action an inbound would (§3.6); a `409` when that does not land on an agent — there is nothing to open for a `message`/`silence` outcome.
750
+ *
751
+ */
752
+ static createConversation(options) {
753
+ return (options.client ?? client).post({
754
+ url: "/v1/projects/{project_id}/conversations",
755
+ ...options,
756
+ headers: {
757
+ "Content-Type": "application/json",
758
+ ...options.headers
759
+ }
760
+ });
761
+ }
762
+ /**
763
+ * List channels
764
+ *
765
+ * Lists the channels connected in the project.
766
+ */
767
+ static listChannels(options) {
768
+ return (options.client ?? client).get({
769
+ url: "/v1/projects/{project_id}/channels",
770
+ ...options
771
+ });
772
+ }
773
+ /**
774
+ * Connect a channel
775
+ *
776
+ * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
777
+ * **Discord** (`channel: discord`) — supply `application_id` and `bot_token`, plus the `modes` selecting which Gateway flows to serve (direct messages, and/or @mention-opens-a-thread). Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
778
+ * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
779
+ * * **BYOT** (`credential_source: byot`, default) — supply
780
+ * `phone_number_id` and `access_token` from your own Meta app.
781
+ *
782
+ * * **Embedded signup** (`credential_source: embedded_signup`) — supply
783
+ * `code` and `waba_id` (and optionally `pin`) from the Meta popup;
784
+ * naturali exchanges the `code` for the token and subscribes its app to
785
+ * the WABA, so the customer never hands over a token. Returns `501` on
786
+ * deployments where Meta App credentials are not configured.
787
+ *
788
+ */
789
+ static createChannel(options) {
790
+ return (options.client ?? client).post({
791
+ url: "/v1/projects/{project_id}/channels",
792
+ ...options,
793
+ headers: {
794
+ "Content-Type": "application/json",
795
+ ...options.headers
796
+ }
797
+ });
798
+ }
799
+ /**
800
+ * Delete a channel
801
+ *
802
+ * Deletes the channel and whatever it provisioned — the WhatsApp send tool and write-only credential secret, or the Discord channel's sealed bot token (dropped with the row, closing its gateway connection).
803
+ *
804
+ */
805
+ static deleteChannel(options) {
806
+ return (options.client ?? client).delete({
807
+ url: "/v1/projects/{project_id}/channels/{channel_id}",
808
+ ...options
809
+ });
810
+ }
811
+ /**
812
+ * Get a channel
813
+ */
814
+ static getChannel(options) {
815
+ return (options.client ?? client).get({
816
+ url: "/v1/projects/{project_id}/channels/{channel_id}",
817
+ ...options
818
+ });
819
+ }
820
+ /**
821
+ * Update a channel
822
+ *
823
+ * Rotate the credential, update the kind's config (`waba_id` / `credential_source` for WhatsApp, `modes` for Discord), or flip the naturali-side status. At least one field is required. Rotating a WhatsApp token stores a new write-only secret, repoints the send tool and deletes the old secret; rotating a Discord bot token reseals it and the gateway worker reconnects with it.
824
+ *
825
+ */
826
+ static updateChannel(options) {
827
+ return (options.client ?? client).patch({
828
+ url: "/v1/projects/{project_id}/channels/{channel_id}",
829
+ ...options,
830
+ headers: {
831
+ "Content-Type": "application/json",
832
+ ...options.headers
833
+ }
834
+ });
835
+ }
836
+ /**
837
+ * List the channel's conversations
838
+ *
839
+ * A cursor page of the channel's conversations, newest first. A conversation is one address's dialogue on the channel — the continuity anchor that resumes the same runtime session instead of starting fresh per message — so this is the read path for who has talked to the channel and which actor/session their dialogue resolved to.
840
+ * Conversations are created by the inbound path (the WhatsApp webhook, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
841
+ *
842
+ */
843
+ static listChannelConversations(options) {
844
+ return (options.client ?? client).get({
845
+ url: "/v1/projects/{project_id}/channels/{channel_id}/conversations",
846
+ ...options
847
+ });
848
+ }
849
+ /**
850
+ * Get a conversation
851
+ */
852
+ static getChannelConversation(options) {
853
+ return (options.client ?? client).get({
854
+ url: "/v1/projects/{project_id}/channels/{channel_id}/conversations/{conversation_id}",
855
+ ...options
856
+ });
857
+ }
858
+ /**
859
+ * Read a conversation's transcript
860
+ *
861
+ * The conversation's messages, oldest first. naturali stores no message bodies — the dialogue lives in the runtime session the conversation maps to, so this reads through to the runtime. Pagination is `limit`/`offset` rather than an opaque cursor because the upstream is offset-based over a stable `position` ordering.
862
+ *
863
+ */
864
+ static listChannelConversationMessages(options) {
865
+ return (options.client ?? client).get({
866
+ url: "/v1/projects/{project_id}/channels/{channel_id}/conversations/{conversation_id}/messages",
867
+ ...options
868
+ });
869
+ }
870
+ };
605
871
  var Agents = class {
606
872
  /**
607
873
  * List agents
@@ -950,150 +1216,6 @@ var Boards = class {
950
1216
  });
951
1217
  }
952
1218
  };
953
- var Channels = class {
954
- /**
955
- * List channels
956
- *
957
- * Lists the channels connected in the project.
958
- */
959
- static listChannels(options) {
960
- return (options.client ?? client).get({
961
- url: "/v1/projects/{project_id}/channels",
962
- ...options
963
- });
964
- }
965
- /**
966
- * Connect a channel
967
- *
968
- * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
969
- * **Discord** (`channel: discord`) — supply `application_id` and `bot_token`, plus the `modes` selecting which Gateway flows to serve (direct messages, and/or @mention-opens-a-thread). Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
970
- * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
971
- * * **BYOT** (`credential_source: byot`, default) — supply
972
- * `phone_number_id` and `access_token` from your own Meta app.
973
- *
974
- * * **Embedded signup** (`credential_source: embedded_signup`) — supply
975
- * `code` and `waba_id` (and optionally `pin`) from the Meta popup;
976
- * naturali exchanges the `code` for the token and subscribes its app to
977
- * the WABA, so the customer never hands over a token. Returns `501` on
978
- * deployments where Meta App credentials are not configured.
979
- *
980
- */
981
- static createChannel(options) {
982
- return (options.client ?? client).post({
983
- url: "/v1/projects/{project_id}/channels",
984
- ...options,
985
- headers: {
986
- "Content-Type": "application/json",
987
- ...options.headers
988
- }
989
- });
990
- }
991
- /**
992
- * Delete a channel
993
- *
994
- * Deletes the channel and whatever it provisioned — the WhatsApp send tool and write-only credential secret, or the Discord channel's sealed bot token (dropped with the row, closing its gateway connection).
995
- *
996
- */
997
- static deleteChannel(options) {
998
- return (options.client ?? client).delete({
999
- url: "/v1/projects/{project_id}/channels/{channel_id}",
1000
- ...options
1001
- });
1002
- }
1003
- /**
1004
- * Get a channel
1005
- */
1006
- static getChannel(options) {
1007
- return (options.client ?? client).get({
1008
- url: "/v1/projects/{project_id}/channels/{channel_id}",
1009
- ...options
1010
- });
1011
- }
1012
- /**
1013
- * Update a channel
1014
- *
1015
- * Rotate the credential, update the kind's config (`waba_id` / `credential_source` for WhatsApp, `modes` for Discord), or flip the naturali-side status. At least one field is required. Rotating a WhatsApp token stores a new write-only secret, repoints the send tool and deletes the old secret; rotating a Discord bot token reseals it and the gateway worker reconnects with it.
1016
- *
1017
- */
1018
- static updateChannel(options) {
1019
- return (options.client ?? client).patch({
1020
- url: "/v1/projects/{project_id}/channels/{channel_id}",
1021
- ...options,
1022
- headers: {
1023
- "Content-Type": "application/json",
1024
- ...options.headers
1025
- }
1026
- });
1027
- }
1028
- /**
1029
- * Unbind the channel
1030
- */
1031
- static deleteChannelBinding(options) {
1032
- return (options.client ?? client).delete({
1033
- url: "/v1/projects/{project_id}/channels/{channel_id}/binding",
1034
- ...options
1035
- });
1036
- }
1037
- /**
1038
- * Get the channel's binding
1039
- */
1040
- static getChannelBinding(options) {
1041
- return (options.client ?? client).get({
1042
- url: "/v1/projects/{project_id}/channels/{channel_id}/binding",
1043
- ...options
1044
- });
1045
- }
1046
- /**
1047
- * Set the channel's binding
1048
- *
1049
- * Create or replace the channel's agent binding (a channel has one binding in v1). `agent_id` is required and must be an agent owned in the project; `language` / `config` / `status` default to null / null / active when absent (full replace).
1050
- *
1051
- */
1052
- static setChannelBinding(options) {
1053
- return (options.client ?? client).put({
1054
- url: "/v1/projects/{project_id}/channels/{channel_id}/binding",
1055
- ...options,
1056
- headers: {
1057
- "Content-Type": "application/json",
1058
- ...options.headers
1059
- }
1060
- });
1061
- }
1062
- /**
1063
- * List the channel's conversations
1064
- *
1065
- * A cursor page of the channel's conversations, newest first. A conversation is one address's dialogue on the channel — the continuity anchor that resumes the same runtime session instead of starting fresh per message — so this is the read path for who has talked to the channel and which actor/session their dialogue resolved to.
1066
- * Conversations are created by the inbound path (the WhatsApp webhook, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
1067
- *
1068
- */
1069
- static listChannelConversations(options) {
1070
- return (options.client ?? client).get({
1071
- url: "/v1/projects/{project_id}/channels/{channel_id}/conversations",
1072
- ...options
1073
- });
1074
- }
1075
- /**
1076
- * Get a conversation
1077
- */
1078
- static getChannelConversation(options) {
1079
- return (options.client ?? client).get({
1080
- url: "/v1/projects/{project_id}/channels/{channel_id}/conversations/{conversation_id}",
1081
- ...options
1082
- });
1083
- }
1084
- /**
1085
- * Read a conversation's transcript
1086
- *
1087
- * The conversation's messages, oldest first. naturali stores no message bodies — the dialogue lives in the runtime session the conversation maps to, so this reads through to the runtime. Pagination is `limit`/`offset` rather than an opaque cursor because the upstream is offset-based over a stable `position` ordering.
1088
- *
1089
- */
1090
- static listChannelConversationMessages(options) {
1091
- return (options.client ?? client).get({
1092
- url: "/v1/projects/{project_id}/channels/{channel_id}/conversations/{conversation_id}/messages",
1093
- ...options
1094
- });
1095
- }
1096
- };
1097
1219
  var Generations = class {
1098
1220
  /**
1099
1221
  * List an agent's generations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.47.1",
3
+ "version": "0.48.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  "tsx": "^4.23.1",
38
38
  "typescript": "~6.0.3",
39
39
  "vitest": "^4.1.10",
40
- "@naturali/api": "0.47.1"
40
+ "@naturali/api": "0.48.0"
41
41
  },
42
42
  "scripts": {
43
43
  "generate": "tsx scripts/generate.ts",