@dialgem/sdk 0.1.0-beta.1 → 0.1.0-beta.3

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.js CHANGED
@@ -104,10 +104,10 @@ function isErrorBody(body) {
104
104
  }
105
105
 
106
106
  // src/version.ts
107
- var VERSION = "0.1.0-beta.1";
107
+ var VERSION = "0.1.0-beta.3";
108
108
 
109
109
  // src/core/http.ts
110
- var RETRYABLE_METHODS = /* @__PURE__ */ new Set(["GET", "PATCH", "DELETE"]);
110
+ var RETRYABLE_METHODS = /* @__PURE__ */ new Set(["GET", "PUT", "PATCH", "DELETE"]);
111
111
  var MAX_RETRY_DELAY_MS = 6e4;
112
112
  var HttpClient = class {
113
113
  baseURL;
@@ -140,6 +140,9 @@ var HttpClient = class {
140
140
  postForm(path2, form, options) {
141
141
  return this.request("POST", path2, { body: form, options });
142
142
  }
143
+ put(path2, body, options) {
144
+ return this.request("PUT", path2, { body, options });
145
+ }
143
146
  patch(path2, body, options) {
144
147
  return this.request("PATCH", path2, { body, options });
145
148
  }
@@ -442,6 +445,13 @@ var AgentMCPServers = class extends APIResource {
442
445
  return this._client.delete(path`/v1/agents/${agentId}/mcp-servers/${serverId}`, options);
443
446
  }
444
447
  /** Connect to the server now, list its tools, and store the result as `last_status`. */
448
+ /**
449
+ * What the server offers right now, with each tool's description and argument schema. Connects live like
450
+ * `test`, but stores nothing. An unreachable server is not an error: `tools` is empty and `error` says why.
451
+ */
452
+ listTools(agentId, serverId, options) {
453
+ return this._client.get(path`/v1/agents/${agentId}/mcp-servers/${serverId}/tools`, void 0, options);
454
+ }
445
455
  test(agentId, serverId, options) {
446
456
  return this._client.post(path`/v1/agents/${agentId}/mcp-servers/${serverId}/test`, void 0, options);
447
457
  }
@@ -533,6 +543,20 @@ var Calls = class extends APIResource {
533
543
  delete(callId, options) {
534
544
  return this._client.delete(path`/v1/calls/${callId}`, options);
535
545
  }
546
+ /**
547
+ * Run a finished call's post-call analysis again, with the agent's *current* analysis
548
+ * settings, and return the updated call. Use it after changing the fields or the model
549
+ * and wanting an older call read the new way.
550
+ *
551
+ * It replaces `analysis`; it does not bill the call again and does not send `call_analyzed`
552
+ * again, so read the result from this response or from `retrieve`. The model call can take
553
+ * a while. `ConflictError` with `errCode` `call_in_progress` until the call has ended,
554
+ * `no_transcript` when there is nothing to analyze, `agent_deleted` if the agent is gone.
555
+ * Not retried by default.
556
+ */
557
+ rerunAnalysis(callId, options) {
558
+ return this._client.post(path`/v1/calls/${callId}/rerun-analysis`, void 0, options);
559
+ }
536
560
  /**
537
561
  * End an ongoing call now, as if the agent had hung up. The call becomes
538
562
  * `completed` with `disconnection_reason: "manual_stopped"` a moment later, and
@@ -629,6 +653,12 @@ var Voices = class extends APIResource {
629
653
  return this._client.delete(path`/v1/voices/${voiceId}`, options);
630
654
  }
631
655
  };
656
+ var ExtractionModels = class extends APIResource {
657
+ /** Models an agent may use for post-call analysis, with an estimated cost per session. */
658
+ list(options) {
659
+ return this._client.get("/v1/models/extraction", void 0, options);
660
+ }
661
+ };
632
662
  var FlowTemplates = class extends APIResource {
633
663
  /** Built-in conversation-flow templates (summaries, without `flow_config`). */
634
664
  list(params = {}, options) {
@@ -648,12 +678,308 @@ var PromptTemplates = class extends APIResource {
648
678
  }
649
679
  };
650
680
 
681
+ // src/resources/account.ts
682
+ var ApiKey = class extends APIResource {
683
+ /**
684
+ * Who this key is: your organization and the key's name, prefix, scopes, allowed addresses
685
+ * and expiry. It answers for any valid key whatever its scopes, so an integration can check
686
+ * what it was given. Never returns the secret.
687
+ *
688
+ * ```ts
689
+ * const { key } = await dialgem.apiKey.retrieve()
690
+ * if (key && !key.full_access) console.log("scoped to", key.scopes)
691
+ * ```
692
+ */
693
+ retrieve(options) {
694
+ return this._client.get("/v1/api-key-info", void 0, options);
695
+ }
696
+ };
697
+ var Sessions = class extends APIResource {
698
+ /**
699
+ * The calls your organization has in progress right now, with a `count`.
700
+ *
701
+ * Live state read from the service's own registry — use it for a
702
+ * concurrency check before placing a call. For finished calls use
703
+ * `calls.list`; a call whose teardown never arrived is not counted here.
704
+ */
705
+ list(options) {
706
+ return this._client.get("/v1/agent/sessions", void 0, options);
707
+ }
708
+ /**
709
+ * Change a live call's prompt and/or variables. It applies from the agent's **next turn**.
710
+ *
711
+ * `sessionId` is a session's `session_id` from `list`, or the call's own `call_id`. Only this call changes:
712
+ * the agent, its published versions and other calls are untouched, and the change is gone when the call ends.
713
+ * A turn already being spoken finishes as it was. `dynamic_variables` are merged over the call's variables;
714
+ * `system_prompt` replaces the prompt for the rest of the call.
715
+ *
716
+ * The call may be on any service instance. `NotFoundError` if it is not live (or is another organization's),
717
+ * `ConflictError` with `errCode` `session_ended` once it is over, `UnprocessableEntityError` with `errCode`
718
+ * `flow_agent_prompt` for a flow agent's prompt (its variables can still change). Not retried by default.
719
+ *
720
+ * ```ts
721
+ * await dialgem.sessions.update(callId, { dynamic_variables: { plan: "pro" } })
722
+ * ```
723
+ */
724
+ update(sessionId, body, options) {
725
+ return this._client.patch(path`/v1/agent/sessions/${sessionId}`, body, options);
726
+ }
727
+ /**
728
+ * Make the agent say `text` on a live call, in its own voice. Answers at once; the line plays behind what the
729
+ * agent is saying, or now with `interrupt: true`. The agent's conversation records it as something it said.
730
+ *
731
+ * Off unless the deployment enables live control: `ForbiddenError` with `errCode` `live_control_disabled`.
732
+ * `ConflictError` `human_has_call` while a human has taken the call. Owners, admins and API keys only.
733
+ * Not retried by default.
734
+ *
735
+ * ```ts
736
+ * await dialgem.sessions.say(callId, { text: "One moment while I check that." })
737
+ * ```
738
+ */
739
+ say(sessionId, body, options) {
740
+ return this._client.post(path`/v1/agent/sessions/${sessionId}/say`, body, options);
741
+ }
742
+ /**
743
+ * Hand a taken-over call back to the agent, for when the socket that took it is gone. The agent is told a
744
+ * human had the call and that it did not hear what was said. Same availability and limits as `say`.
745
+ * Listening in and taking over run over a WebSocket (`/v1/agent/sessions/{id}/live`), which this SDK does not wrap.
746
+ */
747
+ release(sessionId, options) {
748
+ return this._client.post(path`/v1/agent/sessions/${sessionId}/release`, void 0, options);
749
+ }
750
+ };
751
+
752
+ // src/resources/simulations.ts
753
+ var Simulations = class extends APIResource {
754
+ /** Make a suite for one of your agents. */
755
+ createSuite(body, options) {
756
+ return this._client.post("/v1/simulations/suites", body, options);
757
+ }
758
+ /** Your suites, newest first, each with its latest run. Pass `agent_id` for one agent's. */
759
+ listSuites(params = {}, options) {
760
+ return this._client.get("/v1/simulations/suites", params, options);
761
+ }
762
+ /** One suite with its cases. */
763
+ retrieveSuite(suiteId, options) {
764
+ return this._client.get(path`/v1/simulations/suites/${suiteId}`, void 0, options);
765
+ }
766
+ /**
767
+ * Rename a suite or set its publish gate: `off`, `warn` (publishing a version succeeds and lists the suites the draft
768
+ * has not passed) or `block` (publishing is refused with 409 `simulation_required` until it has).
769
+ */
770
+ updateSuite(suiteId, body, options) {
771
+ return this._client.patch(path`/v1/simulations/suites/${suiteId}`, body, options);
772
+ }
773
+ /** Delete a suite and its cases. Past runs are deleted with it. */
774
+ deleteSuite(suiteId, options) {
775
+ return this._client.delete(path`/v1/simulations/suites/${suiteId}`, options);
776
+ }
777
+ /** Add a case (up to 50 per suite). 422 `invalid_case` says what to fix. */
778
+ createCase(suiteId, body, options) {
779
+ return this._client.post(path`/v1/simulations/suites/${suiteId}/cases`, body, options);
780
+ }
781
+ /** Change a case. Fields you leave out keep their value. */
782
+ updateCase(caseId, body, options) {
783
+ return this._client.patch(path`/v1/simulations/cases/${caseId}`, body, options);
784
+ }
785
+ deleteCase(caseId, options) {
786
+ return this._client.delete(path`/v1/simulations/cases/${caseId}`, options);
787
+ }
788
+ /**
789
+ * Run every case of a suite against the draft, a published version or `"latest_published"`. Answers at once
790
+ * (`202`); the run happens in the background, so poll `retrieveRun` until `status` is `completed`.
791
+ *
792
+ * 409 `suite_empty`, 422 `agent_type_not_supported` (multi-prompt agents), 429 `too_many_runs` or
793
+ * `daily_run_limit`.
794
+ */
795
+ run(suiteId, body = {}, options) {
796
+ return this._client.post(path`/v1/simulations/suites/${suiteId}/runs`, body, options);
797
+ }
798
+ /** Runs, newest first. Pass `suite_id` for one suite's. */
799
+ listRuns(params = {}, options) {
800
+ return this._client.get("/v1/simulations/runs", params, options);
801
+ }
802
+ /** A run with every case's transcript, tool calls and check results. */
803
+ retrieveRun(runId, options) {
804
+ return this._client.get(path`/v1/simulations/runs/${runId}`, void 0, options);
805
+ }
806
+ /** Stop a run that has not finished. Cases already under way finish; the rest are skipped. */
807
+ cancelRun(runId, options) {
808
+ return this._client.post(path`/v1/simulations/runs/${runId}/cancel`, void 0, options);
809
+ }
810
+ };
811
+
812
+ // src/resources/web-calls.ts
813
+ var WebCalls = class extends APIResource {
814
+ /**
815
+ * Create a call for one visitor and get its access token.
816
+ *
817
+ * const { access_token } = await dialgem.webCalls.create({ agent_id, metadata: { visitor: "v_123" } })
818
+ *
819
+ * `metadata` and `dialgem_llm_dynamic_variables` are fixed here, by you, and cannot be changed by the page.
820
+ * 409 `web_origins_not_configured` until an origin is allowed; 402 if the organization cannot pay for calls;
821
+ * 429 when more than `limits.tokens_per_minute` calls are created in a minute.
822
+ */
823
+ create(body, options) {
824
+ return this._client.post("/v1/calls/web", body, options);
825
+ }
826
+ /** The origins browser calls may start from, and the limits that apply. */
827
+ retrieveSettings(options) {
828
+ return this._client.get("/v1/web-calls/settings", void 0, options);
829
+ }
830
+ /**
831
+ * Replace the allowed origins. Each is `scheme://host[:port]`; `https://*.example.com` allows any subdomain
832
+ * (not the bare domain) and `*` allows any website. Tokens already issued keep the list they were issued with.
833
+ */
834
+ updateSettings(body, options) {
835
+ return this._client.put("/v1/web-calls/settings", body, options);
836
+ }
837
+ };
838
+
839
+ // src/resources/contacts.ts
840
+ var Contacts = class extends APIResource {
841
+ /** Bulk import from CSV, with a dry-run preview. */
842
+ imports;
843
+ constructor(client) {
844
+ super(client);
845
+ this.imports = new ContactImports(client);
846
+ }
847
+ /**
848
+ * Add a contact. `phone` is any way of writing a valid number; without a leading `+`
849
+ * also pass `default_country` (`"US"`). A number that is already a contact answers 409
850
+ * with its `contact_id`.
851
+ */
852
+ create(body, options) {
853
+ return this._client.post("/v1/contacts", body, options);
854
+ }
855
+ /**
856
+ * Contacts, newest first. Await for one page, or iterate for every contact:
857
+ *
858
+ */
859
+ list(params = {}, options) {
860
+ const fetchPage = async (cursor) => {
861
+ const res = await this._client.get(
862
+ "/v1/contacts",
863
+ { ...params, cursor: cursor ?? void 0 },
864
+ options
865
+ );
866
+ return { data: res.contacts, has_more: res.next_cursor !== null, pagination_key: res.next_cursor };
867
+ };
868
+ return new PagePromise(fetchPage);
869
+ }
870
+ /**
871
+ * The contact with this phone number. The number is matched as E.164, so
872
+ * `("(212) 220-0001", { default_country: "US" })` finds `+12122200001`. Throws
873
+ * `NotFoundError` if you have no such contact, and `UnprocessableEntityError` if the text is
874
+ * not a phone number.
875
+ */
876
+ retrieveByPhone(phone, params = {}, options) {
877
+ return this._client.get(path`/v1/contacts/by-phone/${phone}`, params, options);
878
+ }
879
+ /** One contact, with its lists and how many calls it has had. */
880
+ retrieve(contactId, options) {
881
+ return this._client.get(path`/v1/contacts/${contactId}`, void 0, options);
882
+ }
883
+ /**
884
+ * Partial update: only the fields you send change, and `null` clears a field.
885
+ * `attributes` replaces the whole set, so send every field you want kept.
886
+ */
887
+ update(contactId, body, options) {
888
+ return this._client.patch(path`/v1/contacts/${contactId}`, body, options);
889
+ }
890
+ /**
891
+ * Erase a contact and its list memberships. Calls already made stay in the call log, and
892
+ * a do-not-call entry for the number stays too, so forgetting a person never makes a number
893
+ * that asked not to be called dialable again.
894
+ */
895
+ delete(contactId, options) {
896
+ return this._client.delete(path`/v1/contacts/${contactId}`, options);
897
+ }
898
+ /** Calls to or from the contact's number, newest first. Summaries, not transcripts. */
899
+ calls(contactId, params = {}, options) {
900
+ return this._client.get(path`/v1/contacts/${contactId}/calls`, params, options);
901
+ }
902
+ };
903
+ var ContactImports = class extends APIResource {
904
+ /** The file's headers, a guessed column mapping and a few rows. Imports nothing. */
905
+ inspect(csv, options) {
906
+ return this._client.post("/v1/contacts/imports/inspect", { csv }, options);
907
+ }
908
+ /**
909
+ * Start an import. Without `mapping` the columns are guessed from the headers. With
910
+ * `dry_run: true` nothing is written: the import only validates and reports.
911
+ */
912
+ create(body, options) {
913
+ return this._client.post("/v1/contacts/imports", body, options);
914
+ }
915
+ /** Recent imports, newest first. */
916
+ list(options) {
917
+ return this._client.get("/v1/contacts/imports", void 0, options);
918
+ }
919
+ /** Progress and counts. */
920
+ retrieve(importId, options) {
921
+ return this._client.get(path`/v1/contacts/imports/${importId}`, void 0, options);
922
+ }
923
+ /** The rows that were rejected, with the line, the reason and what each held. */
924
+ errors(importId, params = {}, options) {
925
+ return this._client.get(path`/v1/contacts/imports/${importId}/errors`, params, options);
926
+ }
927
+ /** Apply a previewed import: the file is read again, so what is applied is what was previewed. */
928
+ commit(importId, options) {
929
+ return this._client.post(path`/v1/contacts/imports/${importId}/commit`, void 0, options);
930
+ }
931
+ /** Stop an import that has not finished. Contacts a running import already wrote stay. */
932
+ cancel(importId, options) {
933
+ return this._client.delete(path`/v1/contacts/imports/${importId}`, options);
934
+ }
935
+ };
936
+ var ContactLists = class extends APIResource {
937
+ list(options) {
938
+ return this._client.get("/v1/contact-lists", void 0, options);
939
+ }
940
+ /** Names are unique within your organization, ignoring case. */
941
+ create(body, options) {
942
+ return this._client.post("/v1/contact-lists", body, options);
943
+ }
944
+ retrieve(listId, options) {
945
+ return this._client.get(path`/v1/contact-lists/${listId}`, void 0, options);
946
+ }
947
+ update(listId, body, options) {
948
+ return this._client.patch(path`/v1/contact-lists/${listId}`, body, options);
949
+ }
950
+ delete(listId, options) {
951
+ return this._client.delete(path`/v1/contact-lists/${listId}`, options);
952
+ }
953
+ /** Add up to 1000 of your contacts. Already-members are ignored; `added` says how many were new. */
954
+ addContacts(listId, contactIds, options) {
955
+ return this._client.post(path`/v1/contact-lists/${listId}/members`, { contact_ids: contactIds }, options);
956
+ }
957
+ removeContact(listId, contactId, options) {
958
+ return this._client.delete(path`/v1/contact-lists/${listId}/members/${contactId}`, options);
959
+ }
960
+ };
961
+
651
962
  // src/resources/phone-numbers.ts
652
963
  var PhoneNumbers = class extends APIResource {
653
964
  /** Register a number you own (`phone_number` in E.164) with Dialgem. */
654
965
  create(body, options) {
655
966
  return this._client.post("/v1/phone-numbers", body, options);
656
967
  }
968
+ /**
969
+ * Numbers that can be bought, with the monthly price. Throws `NotFoundError` (`number_purchase_disabled`) when the
970
+ * deployment has not switched buying on.
971
+ */
972
+ search(params, options) {
973
+ return this._client.get("/v1/phone-numbers/available", { ...params }, options);
974
+ }
975
+ /**
976
+ * Buy one of the numbers `search` returned. **Spends the organization's credit**: the first month is debited now and
977
+ * the rental renews monthly until the number is released. Throws on insufficient credit, or if the carrier no longer
978
+ * has the number; nothing is charged in either case.
979
+ */
980
+ buy(body, options) {
981
+ return this._client.post("/v1/phone-numbers/buy", body, options);
982
+ }
657
983
  /** Every active (not released) number in the organization, newest first. */
658
984
  list(options) {
659
985
  return this._client.get("/v1/phone-numbers", void 0, options);
@@ -687,15 +1013,159 @@ var PhoneNumbers = class extends APIResource {
687
1013
  assign(phoneNumberId, body, options) {
688
1014
  return this._client.patch(path`/v1/phone-numbers/${phoneNumberId}/assign`, body, options);
689
1015
  }
1016
+ /**
1017
+ * Send one signed test request to the number's inbound routing webhook and report what a real call would have done
1018
+ * with your answer: the status, how long you took against the time budget, and any field that would be ignored.
1019
+ * Throws a `ConflictError` (`inbound_webhook_not_set`) when the number has no `inbound_webhook_url`.
1020
+ */
1021
+ testInboundWebhook(phoneNumberId, options) {
1022
+ return this._client.post(path`/v1/phone-numbers/${phoneNumberId}/inbound-webhook/test`, void 0, options);
1023
+ }
1024
+ /**
1025
+ * Replace the inbound webhook's signing secret. The new secret is returned **once**, as `inbound_webhook_secret`
1026
+ * on the number; the old one stops working at once.
1027
+ */
1028
+ rotateInboundWebhookSecret(phoneNumberId, options) {
1029
+ return this._client.post(path`/v1/phone-numbers/${phoneNumberId}/inbound-webhook/rotate-secret`, void 0, options);
1030
+ }
690
1031
  /** Release the number from Dialgem. It stops routing calls and disappears from `list()`; your carrier account is untouched. */
691
1032
  delete(phoneNumberId, options) {
692
1033
  return this._client.delete(path`/v1/phone-numbers/${phoneNumberId}`, options);
693
1034
  }
694
1035
  };
695
1036
 
1037
+ // src/resources/chats.ts
1038
+ var Chats = class extends APIResource {
1039
+ /**
1040
+ * Start a chat. If the agent has a first message it is already in `messages`.
1041
+ *
1042
+ * `UnprocessableEntityError` with `errCode` `agent_type_not_supported` (flow agents) or `chat_requires_storage`.
1043
+ * Not retried by default.
1044
+ */
1045
+ create(body, options) {
1046
+ return this._client.post("/v1/chats", body, options);
1047
+ }
1048
+ /**
1049
+ * Chats, newest first. Await for one page, or iterate for every chat. Entries leave out `messages`;
1050
+ * `retrieve` a chat for them.
1051
+ */
1052
+ list(params = {}, options) {
1053
+ const fetchPage = async (paginationKey) => {
1054
+ const res = await this._client.get(
1055
+ "/v1/chats",
1056
+ { ...params, pagination_key: paginationKey ?? void 0 },
1057
+ options
1058
+ );
1059
+ return { data: res.chats, has_more: res.has_more, pagination_key: res.pagination_key };
1060
+ };
1061
+ return new PagePromise(fetchPage);
1062
+ }
1063
+ /** One chat with all its messages. */
1064
+ retrieve(chatId, options) {
1065
+ return this._client.get(path`/v1/chats/${chatId}`, void 0, options);
1066
+ }
1067
+ /** Replace the chat's `metadata` (the whole object). */
1068
+ update(chatId, body, options) {
1069
+ return this._client.patch(path`/v1/chats/${chatId}`, body, options);
1070
+ }
1071
+ /** Delete a chat and its messages. */
1072
+ delete(chatId, options) {
1073
+ return this._client.delete(path`/v1/chats/${chatId}`, options);
1074
+ }
1075
+ /**
1076
+ * Send the user's message and wait for the agent's reply. Returns only the new entries, in order: the user's
1077
+ * message, any tool use, the agent's reply.
1078
+ *
1079
+ * If the agent's model fails (`ServerError`, `errCode` `model_error`) nothing is stored and the same message
1080
+ * can be sent again. `ConflictError` with `errCode` `chat_busy` while another reply is in progress,
1081
+ * `chat_ended` after the end, `message_limit` at the cap. If the agent calls its end-call tool, the reply's
1082
+ * `chat_status` is `ended`.
1083
+ *
1084
+ * Not retried by default: a retry after an ambiguous failure could send the message twice.
1085
+ */
1086
+ sendMessage(chatId, content, options) {
1087
+ return this._client.post(path`/v1/chats/${chatId}/messages`, { content }, options);
1088
+ }
1089
+ /** End the chat. Ending twice is fine. The analysis arrives a moment later; read it with `retrieve`. */
1090
+ end(chatId, options) {
1091
+ return this._client.post(path`/v1/chats/${chatId}/end`, void 0, options);
1092
+ }
1093
+ /**
1094
+ * Analyse an ended chat again with the agent's current analysis settings and return it. `ConflictError` with
1095
+ * `errCode` `chat_in_progress` until it has ended, `no_transcript` when it has no messages.
1096
+ */
1097
+ rerunAnalysis(chatId, options) {
1098
+ return this._client.post(path`/v1/chats/${chatId}/rerun-analysis`, void 0, options);
1099
+ }
1100
+ };
1101
+
1102
+ // src/resources/flows.ts
1103
+ var Flows = class extends APIResource {
1104
+ /** Validate and save a flow. `UnprocessableEntityError` (`errCode` `flow_invalid`) lists every problem. Not retried by default. */
1105
+ create(body, options) {
1106
+ return this._client.post("/v1/flows", body, options);
1107
+ }
1108
+ /** Flows, newest first. Await for one page, or iterate for every flow. Entries leave out `flow_config`. */
1109
+ list(params = {}, options) {
1110
+ const fetchPage = async (paginationKey) => {
1111
+ const res = await this._client.get(
1112
+ "/v1/flows",
1113
+ { ...params, pagination_key: paginationKey ?? void 0 },
1114
+ options
1115
+ );
1116
+ return { data: res.flows, has_more: res.has_more, pagination_key: res.pagination_key };
1117
+ };
1118
+ return new PagePromise(fetchPage);
1119
+ }
1120
+ /** One flow with its `flow_config`. */
1121
+ retrieve(flowId, options) {
1122
+ return this._client.get(path`/v1/flows/${flowId}`, void 0, options);
1123
+ }
1124
+ /** Rename a flow and/or replace its `flow_config` (checked again). Agents it was attached to are not changed. */
1125
+ update(flowId, body, options) {
1126
+ return this._client.patch(path`/v1/flows/${flowId}`, body, options);
1127
+ }
1128
+ /** Delete a saved flow. Agents it was attached to keep their copy. */
1129
+ delete(flowId, options) {
1130
+ return this._client.delete(path`/v1/flows/${flowId}`, options);
1131
+ }
1132
+ };
1133
+
1134
+ // src/resources/llms.ts
1135
+ var LLMs = class extends APIResource {
1136
+ /** Save LLM settings. Anything left out takes the default a new agent gets. Not retried by default. */
1137
+ create(body, options) {
1138
+ return this._client.post("/v1/llms", body, options);
1139
+ }
1140
+ /** Saved LLMs, newest first. Await for one page, or iterate for every one. */
1141
+ list(params = {}, options) {
1142
+ const fetchPage = async (paginationKey) => {
1143
+ const res = await this._client.get(
1144
+ "/v1/llms",
1145
+ { ...params, pagination_key: paginationKey ?? void 0 },
1146
+ options
1147
+ );
1148
+ return { data: res.llms, has_more: res.has_more, pagination_key: res.pagination_key };
1149
+ };
1150
+ return new PagePromise(fetchPage);
1151
+ }
1152
+ retrieve(llmId, options) {
1153
+ return this._client.get(path`/v1/llms/${llmId}`, void 0, options);
1154
+ }
1155
+ /** Change the fields you send. Agents it was attached to are not changed. */
1156
+ update(llmId, body, options) {
1157
+ return this._client.patch(path`/v1/llms/${llmId}`, body, options);
1158
+ }
1159
+ /** Delete saved LLM settings. Agents they were attached to keep their copy. */
1160
+ delete(llmId, options) {
1161
+ return this._client.delete(path`/v1/llms/${llmId}`, options);
1162
+ }
1163
+ };
1164
+
696
1165
  // src/webhooks.ts
697
1166
  var WEBHOOK_SIGNATURE_HEADER = "x-dialgem-signature";
698
1167
  var WEBHOOK_EVENT_HEADER = "x-dialgem-event";
1168
+ var WEBHOOK_PREVIOUS_SIGNATURE_HEADER = "x-dialgem-signature-previous";
699
1169
  var WEBHOOK_DELIVERY_HEADER = "x-dialgem-delivery";
700
1170
  var DEFAULT_SIGNATURE_TOLERANCE_MS = 5 * 60 * 1e3;
701
1171
  var encoder = new TextEncoder();
@@ -814,9 +1284,31 @@ var Dialgem = class {
814
1284
  calls;
815
1285
  phoneNumbers;
816
1286
  voices;
1287
+ /** Models available for post-call analysis. */
1288
+ extractionModels;
817
1289
  flowTemplates;
818
1290
  promptTemplates;
1291
+ /** Calls in progress right now. */
1292
+ sessions;
1293
+ /** Text conversations with an agent. */
1294
+ chats;
1295
+ flows;
1296
+ llms;
1297
+ /** What this API key is and may do. */
1298
+ apiKey;
1299
+ /**
1300
+ * Verify what Dialgem sends you: `dialgem.webhooks.constructEvent(rawBody, signatureHeader, secret)`.
1301
+ */
819
1302
  webhooks = webhooks;
1303
+ /** The organization's webhook destinations: create, update, rotate the signing secret, test. */
1304
+ /** The people you call, with CSV import under `contacts.imports`. */
1305
+ contacts;
1306
+ /** Named groups of contacts. */
1307
+ contactLists;
1308
+ /** Browser calls: tokens for `@dialgem/client`, and the origins allowed to start them. */
1309
+ webCalls;
1310
+ /** Saved test conversations for an agent, run in text, with an optional publish gate. */
1311
+ simulations;
820
1312
  /** Always `https://api.dialgem.com`. */
821
1313
  baseURL = BASE_URL;
822
1314
  constructor(options = {}) {
@@ -853,8 +1345,18 @@ var Dialgem = class {
853
1345
  this.calls = new Calls(http);
854
1346
  this.phoneNumbers = new PhoneNumbers(http);
855
1347
  this.voices = new Voices(http);
1348
+ this.extractionModels = new ExtractionModels(http);
856
1349
  this.flowTemplates = new FlowTemplates(http);
857
1350
  this.promptTemplates = new PromptTemplates(http);
1351
+ this.sessions = new Sessions(http);
1352
+ this.chats = new Chats(http);
1353
+ this.flows = new Flows(http);
1354
+ this.llms = new LLMs(http);
1355
+ this.apiKey = new ApiKey(http);
1356
+ this.contacts = new Contacts(http);
1357
+ this.contactLists = new ContactLists(http);
1358
+ this.webCalls = new WebCalls(http);
1359
+ this.simulations = new Simulations(http);
858
1360
  }
859
1361
  };
860
1362
  function readEnv(name) {
@@ -874,6 +1376,6 @@ function defaultFetch() {
874
1376
  return (url, init) => f.call(globalThis, url, init);
875
1377
  }
876
1378
 
877
- export { APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, AuthenticationError, BASE_URL, BadRequestError, ConflictError, DEFAULT_SIGNATURE_TOLERANCE_MS, Dialgem, DialgemError, InternalServerError, NotFoundError, Page, PagePromise, PermissionDeniedError, RateLimitError, UnprocessableEntityError, VERSION, WEBHOOK_DELIVERY_HEADER, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WebhookVerificationError, Webhooks, webhooks };
1379
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, APIUserAbortError, AuthenticationError, BASE_URL, BadRequestError, ConflictError, DEFAULT_SIGNATURE_TOLERANCE_MS, Dialgem, DialgemError, InternalServerError, NotFoundError, Page, PagePromise, PermissionDeniedError, RateLimitError, UnprocessableEntityError, VERSION, WEBHOOK_DELIVERY_HEADER, WEBHOOK_EVENT_HEADER, WEBHOOK_PREVIOUS_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_HEADER, WebhookVerificationError, Webhooks, webhooks };
878
1380
  //# sourceMappingURL=index.js.map
879
1381
  //# sourceMappingURL=index.js.map