@rymi/node 1.0.0 → 2.0.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.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Agent } from '@rymi/sdk-types';
1
+ import { Agent, CampaignAttempt, Campaign, CampaignMember, CampaignReport, CampaignStatus, CampaignType, CampaignGoal, CampaignCompliancePolicy, Contact } from '@rymi/sdk-types';
2
2
  export * from '@rymi/sdk-types';
3
3
 
4
4
  interface ClientOptions {
@@ -10,6 +10,11 @@ interface ClientOptions {
10
10
  * The base URL for the API. Defaults to `https://api.rymi.live/v1`
11
11
  */
12
12
  baseURL?: string;
13
+ /**
14
+ * Custom fetch implementation. Lets embedders route requests without a
15
+ * network socket (e.g. Fastify app.inject). Defaults to global fetch.
16
+ */
17
+ fetch?: typeof globalThis.fetch;
13
18
  }
14
19
  declare class RymiError extends Error {
15
20
  status?: number;
@@ -19,6 +24,7 @@ declare class RymiError extends Error {
19
24
  declare class RymiClient {
20
25
  private apiKey;
21
26
  private baseURL;
27
+ private fetchImpl;
22
28
  constructor(options?: ClientOptions);
23
29
  private request;
24
30
  get<T>(path: string): Promise<T>;
@@ -56,7 +62,6 @@ interface CreateAgentParams {
56
62
  custom_voice_url?: string | null;
57
63
  custom_voice_mode?: 'rymi' | 'openai-compat';
58
64
  custom_transcriber_url?: string | null;
59
- agent_role?: 'operator' | 'specialist' | 'executive' | 'concierge';
60
65
  language?: string | null;
61
66
  /** All BCP-47 languages the agent should handle, e.g. ["hi-IN","en-US"] for a bilingual agent. */
62
67
  supported_languages?: string[];
@@ -90,7 +95,6 @@ interface UpdateAgentParams {
90
95
  custom_voice_url?: string | null;
91
96
  custom_voice_mode?: 'rymi' | 'openai-compat';
92
97
  custom_transcriber_url?: string | null;
93
- agent_role?: 'operator' | 'specialist' | 'executive' | 'concierge';
94
98
  language?: string | null;
95
99
  /** All BCP-47 languages the agent should handle, e.g. ["hi-IN","en-US"] for a bilingual agent. */
96
100
  supported_languages?: string[];
@@ -121,6 +125,26 @@ interface ValidatePublishParams {
121
125
  post_call?: any;
122
126
  [key: string]: any;
123
127
  }
128
+ interface PublishValidationIssue {
129
+ severity?: string;
130
+ section?: string;
131
+ title?: string;
132
+ detail?: string;
133
+ [key: string]: any;
134
+ }
135
+ interface PublishAgentResponse {
136
+ published: boolean;
137
+ agent_id?: string;
138
+ /** Present when published — the frozen snapshot id and timestamp. */
139
+ snapshot_id?: string | null;
140
+ published_at?: string | null;
141
+ /** Present when published: false because of unresolved blockers. */
142
+ reason?: string;
143
+ blockers?: PublishValidationIssue[];
144
+ warnings?: PublishValidationIssue[];
145
+ error?: string;
146
+ details?: string;
147
+ }
124
148
  interface ChangeEntry {
125
149
  key: string;
126
150
  value: any;
@@ -147,9 +171,6 @@ interface EnrichCompanyResponse {
147
171
  error?: string;
148
172
  }
149
173
  interface PreviewStackParams {
150
- /** Cost/capability role. `concierge` is not supported by this endpoint. */
151
- agent_role?: 'operator' | 'specialist' | 'executive';
152
- role?: 'operator' | 'specialist' | 'executive';
153
174
  language?: string | null;
154
175
  /** Required, non-empty list of BCP-47 languages to resolve a stack for. */
155
176
  supported_languages: string[];
@@ -245,6 +266,13 @@ declare class AgentsResource {
245
266
  * Pass agent_id to merge with an existing persisted agent, or supply fields directly.
246
267
  */
247
268
  validatePublish(params: ValidatePublishParams): Promise<Record<string, any>>;
269
+ /**
270
+ * Publish an agent: validate its persisted config and freeze it into the
271
+ * published snapshot the harness/review pipeline reads as the baseline.
272
+ * Returns `{ published: false, blockers }` (HTTP 200) when blockers remain —
273
+ * inspect `blockers` rather than relying on a thrown error.
274
+ */
275
+ publish(agentId: string): Promise<PublishAgentResponse>;
248
276
  /**
249
277
  * Validate and apply a flat-diff change-set against the AgentConfig field registry.
250
278
  * Does NOT persist — callers must follow up with update().
@@ -256,9 +284,8 @@ declare class AgentsResource {
256
284
  enrichCompany(params: EnrichCompanyParams): Promise<EnrichCompanyResponse>;
257
285
  /**
258
286
  * Preview the resolved per-language model stack (STT/LLM/TTS), blockers,
259
- * warnings, model diffs, and any required role upgrades for a set of
260
- * supported languages — without persisting anything. Note: the concierge
261
- * (realtime) role is not supported by this endpoint.
287
+ * warnings, and model diffs for a set of supported languages — without
288
+ * persisting anything.
262
289
  */
263
290
  previewStack(params: PreviewStackParams): Promise<Record<string, any>>;
264
291
  /**
@@ -299,6 +326,19 @@ declare class AgentsResource {
299
326
  */
300
327
  runEvals(agentId: string, params?: {
301
328
  mode?: 'synthetic' | 'live';
329
+ judge?: boolean;
330
+ }): Promise<Record<string, any>>;
331
+ /**
332
+ * Run the eval SUITE across many agents at once (agents × seeded scenarios),
333
+ * bounded by the optional concurrency cap. One eval run is persisted per
334
+ * agent; the aggregate EvalSuiteReport is returned. Pass `judge: true` to
335
+ * supplement the heuristics with the opt-in LLM judge (needs a Gemini key).
336
+ */
337
+ runEvalSuite(params: {
338
+ agentIds: string[];
339
+ scenarioIds?: string[];
340
+ concurrency?: number;
341
+ judge?: boolean;
302
342
  }): Promise<Record<string, any>>;
303
343
  /**
304
344
  * List previous evaluation runs for an agent.
@@ -377,6 +417,26 @@ interface BatchCallParams {
377
417
  variables?: Record<string, any>;
378
418
  post_call?: Record<string, any>;
379
419
  }
420
+ interface FanoutCallParams {
421
+ agent_id: string;
422
+ to?: string[];
423
+ recipients?: Array<{
424
+ to?: string;
425
+ identity?: string;
426
+ phone?: string;
427
+ phone_number?: string;
428
+ from_number?: string;
429
+ metadata?: Record<string, any>;
430
+ }>;
431
+ from_number?: string;
432
+ /** Preferred tracking id for this fanout. Falls back to batch_id, then auto-generated. */
433
+ fanout_id?: string;
434
+ /** Compatibility alias for fanout_id. */
435
+ batch_id?: string;
436
+ metadata?: Record<string, any>;
437
+ variables?: Record<string, any>;
438
+ post_call?: Record<string, any>;
439
+ }
380
440
  interface CreateCallResponse {
381
441
  id: string;
382
442
  room_name: string;
@@ -418,7 +478,18 @@ declare class CallsResource {
418
478
  */
419
479
  create(data: CreateCallParams): Promise<CreateCallResponse>;
420
480
  /**
421
- * Queue up to 500 outbound PSTN recipients in one request.
481
+ * Group call fanout: dial up to 500 PSTN participants into a single call room.
482
+ * Every recipient joins the same call. For independent per-recipient attempts,
483
+ * retries, and reports, use `campaigns` instead.
484
+ */
485
+ fanout(data: FanoutCallParams): Promise<CreateCallResponse & {
486
+ fanout_id: string;
487
+ batch_id: string;
488
+ queued: number;
489
+ }>;
490
+ /**
491
+ * Compatibility alias for {@link fanout}. Creates one call room with multiple
492
+ * PSTN participants. Queue up to 500 outbound PSTN recipients in one request.
422
493
  */
423
494
  batch(data: BatchCallParams): Promise<CreateCallResponse & {
424
495
  batch_id: string;
@@ -508,13 +579,26 @@ interface NumberRecord {
508
579
  id?: string;
509
580
  number?: string;
510
581
  phone_number?: string;
511
- provider?: 'plivo' | 'twilio' | 'vonage';
582
+ provider?: 'plivo' | 'twilio' | 'vonage' | 'telnyx';
512
583
  capabilities?: string[];
513
584
  price?: string | number;
514
585
  monthly_price?: number;
515
586
  agent_id?: string | null;
516
587
  assigned_agent_id?: string | null;
517
588
  created_at?: string;
589
+ /** Carrier inbound-webhook provisioning state (set once an agent is attached). */
590
+ webhook_status?: 'configured' | 'manual_required' | 'failed' | null;
591
+ webhook_url?: string | null;
592
+ webhook_error?: string | null;
593
+ last_inbound_at?: string | null;
594
+ }
595
+ /** Outcome of carrier inbound-webhook auto-provisioning. */
596
+ interface WebhookProvisionResult {
597
+ status: 'configured' | 'manual_required' | 'failed' | 'no_carrier';
598
+ provider: string | null;
599
+ webhookUrl: string | null;
600
+ verified: boolean;
601
+ error?: string;
518
602
  }
519
603
  declare class NumbersResource {
520
604
  private client;
@@ -537,11 +621,23 @@ declare class NumbersResource {
537
621
  status: 'registered';
538
622
  number: string;
539
623
  agent_id: string | null;
624
+ webhook: WebhookProvisionResult | null;
540
625
  }>;
541
626
  attach(number: string, agentId: string): Promise<{
542
627
  status: 'attached';
543
628
  agent_id: string;
544
629
  number: string;
630
+ webhook: WebhookProvisionResult | null;
631
+ }>;
632
+ /** Clear the agent association without deregistering the number. */
633
+ detach(number: string): Promise<{
634
+ status: 'detached';
635
+ number: string;
636
+ }>;
637
+ /** Re-run carrier inbound-webhook auto-provisioning for a number. */
638
+ provisionWebhook(number: string): Promise<{
639
+ number: string;
640
+ webhook: WebhookProvisionResult;
545
641
  }>;
546
642
  remove(number: string): Promise<{
547
643
  status: 'removed';
@@ -641,7 +737,7 @@ declare class KeysResource {
641
737
  }>;
642
738
  }
643
739
 
644
- type TelephonyProvider = 'plivo' | 'twilio' | 'vonage';
740
+ type TelephonyProvider = 'plivo' | 'twilio' | 'vonage' | 'telnyx';
645
741
  interface ConnectTelephonyParams {
646
742
  provider: TelephonyProvider;
647
743
  auth_id?: string;
@@ -649,6 +745,8 @@ interface ConnectTelephonyParams {
649
745
  api_key?: string;
650
746
  api_secret?: string;
651
747
  signature_secret?: string;
748
+ /** Telnyx Ed25519 webhook signing secret (optional). */
749
+ auth_secret?: string;
652
750
  }
653
751
  declare class TelephonyResource {
654
752
  private client;
@@ -700,9 +798,11 @@ declare class BillingResource {
700
798
  * MINUTES (the customer-facing unit), not dollars.
701
799
  */
702
800
  usageSummary(): Promise<UsageSummary>;
703
- /** Estimate the cost of a call for a given tier and duration. */
801
+ /** Estimate the cost of a call for a custom model stack and duration. */
704
802
  estimate(data?: {
705
- tier?: 'operator' | 'specialist' | 'executive' | 'concierge';
803
+ stt_model?: string;
804
+ llm_model?: string;
805
+ tts_model?: string;
706
806
  duration_seconds?: number;
707
807
  }): Promise<Record<string, any>>;
708
808
  /** Configure auto-recharge. Server rejects (400) if enabled && pack_usd <= threshold_usd. */
@@ -746,6 +846,450 @@ declare class TemplatesResource {
746
846
  }>;
747
847
  }
748
848
 
849
+ interface ListCampaignsParams {
850
+ limit?: number;
851
+ offset?: number;
852
+ status?: CampaignStatus;
853
+ type?: CampaignType;
854
+ agent_id?: string;
855
+ }
856
+ interface CampaignListResponse {
857
+ campaigns: Campaign[];
858
+ total: number;
859
+ offset: number;
860
+ limit: number;
861
+ }
862
+ interface CreateCampaignParams {
863
+ agent_id: string;
864
+ type: CampaignType;
865
+ name: string;
866
+ goal?: CampaignGoal;
867
+ schedule_policy?: Record<string, unknown>;
868
+ retry_policy?: Record<string, unknown>;
869
+ concurrency_policy?: Record<string, unknown>;
870
+ automation_policy?: Record<string, unknown>;
871
+ reporting_policy?: Record<string, unknown>;
872
+ compliance_policy?: CampaignCompliancePolicy;
873
+ metadata?: Record<string, unknown>;
874
+ }
875
+ interface UpdateCampaignParams {
876
+ name?: string;
877
+ goal?: CampaignGoal;
878
+ schedule_policy?: Record<string, unknown>;
879
+ retry_policy?: Record<string, unknown>;
880
+ concurrency_policy?: Record<string, unknown>;
881
+ automation_policy?: Record<string, unknown>;
882
+ reporting_policy?: Record<string, unknown>;
883
+ compliance_policy?: CampaignCompliancePolicy;
884
+ post_call_config_override?: Record<string, unknown>;
885
+ metadata?: Record<string, unknown>;
886
+ }
887
+ interface LaunchBlocker {
888
+ code: string;
889
+ ok: boolean;
890
+ detail?: string;
891
+ }
892
+ interface LaunchCampaignResponse {
893
+ campaign: Campaign;
894
+ blockers: LaunchBlocker[];
895
+ }
896
+ /**
897
+ * GET /campaigns/:id/report response. Extends the shared CampaignReport with
898
+ * the report-endpoint-only derived fields (top failure reasons + cost per
899
+ * success) that the API adds on top of the persisted shape.
900
+ */
901
+ interface CampaignReportResponse extends CampaignReport {
902
+ distributions: CampaignReport['distributions'] & {
903
+ top_failure_reasons: Array<{
904
+ reason: string;
905
+ count: number;
906
+ }>;
907
+ cost_per_success_credits: number;
908
+ };
909
+ }
910
+ interface ListCampaignMembersParams {
911
+ limit?: number;
912
+ offset?: number;
913
+ status?: string;
914
+ }
915
+ interface CampaignMemberListResponse {
916
+ members: CampaignMember[];
917
+ total: number;
918
+ offset: number;
919
+ limit: number;
920
+ }
921
+ interface AddCampaignMembersParams {
922
+ contact_ids: string[];
923
+ variables_override?: Record<string, string>;
924
+ }
925
+ interface ImportCampaignMembersParams {
926
+ contacts?: Array<Record<string, unknown>>;
927
+ csv?: string;
928
+ }
929
+ interface ImportCampaignMembersResponse {
930
+ created: number;
931
+ merged: number;
932
+ /** Members attached to the campaign in this import. */
933
+ attached: number;
934
+ invalid: Array<{
935
+ row: number;
936
+ reason: string;
937
+ }>;
938
+ }
939
+ interface UpdateCampaignMemberParams {
940
+ status?: string;
941
+ variables_override?: Record<string, string>;
942
+ next_attempt_at?: string;
943
+ }
944
+ declare class CampaignMembersResource {
945
+ private client;
946
+ constructor(client: RymiClient);
947
+ /** List a campaign's members, paginated. */
948
+ list(campaignId: string, params?: ListCampaignMembersParams): Promise<CampaignMemberListResponse>;
949
+ /** Attach existing contacts to a campaign as members. */
950
+ add(campaignId: string, data: AddCampaignMembersParams): Promise<{
951
+ members: CampaignMember[];
952
+ }>;
953
+ /** Import inline contact rows (JSON or CSV): creates/merges contacts and attaches members in one call. */
954
+ import(campaignId: string, data: ImportCampaignMembersParams): Promise<ImportCampaignMembersResponse>;
955
+ /** Update a campaign member (status, variables, next attempt time). */
956
+ update(campaignId: string, memberId: string, data: UpdateCampaignMemberParams): Promise<{
957
+ member: CampaignMember;
958
+ }>;
959
+ /** Remove a member from a campaign. */
960
+ remove(campaignId: string, memberId: string): Promise<{
961
+ status: 'deleted';
962
+ id: string;
963
+ }>;
964
+ }
965
+ interface CampaignRoute {
966
+ id: string;
967
+ tenant_id: string;
968
+ campaign_id: string;
969
+ phone_number: string;
970
+ schedule: Record<string, unknown>;
971
+ active: boolean;
972
+ created_at: string;
973
+ updated_at: string;
974
+ }
975
+ interface ListCampaignRoutesParams {
976
+ limit?: number;
977
+ offset?: number;
978
+ }
979
+ interface CampaignRouteListResponse {
980
+ routes: CampaignRoute[];
981
+ total: number;
982
+ offset: number;
983
+ limit: number;
984
+ }
985
+ interface CreateCampaignRouteParams {
986
+ phone_number: string;
987
+ schedule?: Record<string, unknown>;
988
+ active?: boolean;
989
+ }
990
+ interface UpdateCampaignRouteParams {
991
+ schedule?: Record<string, unknown>;
992
+ active?: boolean;
993
+ }
994
+ declare class CampaignRoutesResource {
995
+ private client;
996
+ constructor(client: RymiClient);
997
+ /** List a campaign's inbound routing rules. */
998
+ list(campaignId: string, params?: ListCampaignRoutesParams): Promise<CampaignRouteListResponse>;
999
+ /** Bind an owned phone number to this campaign for inbound routing. Only one active route per number is allowed. */
1000
+ create(campaignId: string, data: CreateCampaignRouteParams): Promise<{
1001
+ route: CampaignRoute;
1002
+ }>;
1003
+ /** Update an inbound route's schedule or active flag. */
1004
+ update(campaignId: string, routeId: string, data: UpdateCampaignRouteParams): Promise<{
1005
+ route: CampaignRoute;
1006
+ }>;
1007
+ /** Delete an inbound route. */
1008
+ delete(campaignId: string, routeId: string): Promise<{
1009
+ status: 'deleted';
1010
+ id: string;
1011
+ }>;
1012
+ }
1013
+ interface ListCampaignAttemptsParams {
1014
+ limit?: number;
1015
+ offset?: number;
1016
+ status?: string;
1017
+ }
1018
+ interface CampaignAttemptListResponse {
1019
+ attempts: CampaignAttempt[];
1020
+ total: number;
1021
+ offset: number;
1022
+ limit: number;
1023
+ }
1024
+ interface ListCampaignBatchesParams {
1025
+ limit?: number;
1026
+ offset?: number;
1027
+ }
1028
+ interface CampaignBatch {
1029
+ id: string;
1030
+ tenant_id: string;
1031
+ campaign_id: string;
1032
+ batch_key: string;
1033
+ status: string;
1034
+ selected_count: number;
1035
+ queued_count: number;
1036
+ completed_count: number;
1037
+ failed_count: number;
1038
+ started_at?: string | null;
1039
+ completed_at?: string | null;
1040
+ created_at: string;
1041
+ }
1042
+ interface CampaignBatchListResponse {
1043
+ batches: CampaignBatch[];
1044
+ total: number;
1045
+ offset: number;
1046
+ limit: number;
1047
+ }
1048
+ interface ListCampaignFollowupsParams {
1049
+ limit?: number;
1050
+ offset?: number;
1051
+ status?: string;
1052
+ }
1053
+ interface CampaignFollowupJob {
1054
+ id: string;
1055
+ tenant_id: string;
1056
+ campaign_id: string;
1057
+ campaign_attempt_id?: string | null;
1058
+ campaign_member_id?: string | null;
1059
+ kind: string;
1060
+ status: string;
1061
+ scheduled_at: string;
1062
+ consent_checked: boolean;
1063
+ capability_checked: boolean;
1064
+ idempotency_key: string;
1065
+ payload: Record<string, unknown>;
1066
+ result?: Record<string, unknown> | null;
1067
+ created_at: string;
1068
+ updated_at: string;
1069
+ }
1070
+ interface CampaignFollowupListResponse {
1071
+ followups: CampaignFollowupJob[];
1072
+ total: number;
1073
+ offset: number;
1074
+ limit: number;
1075
+ }
1076
+ interface CampaignSuggestion {
1077
+ id: string;
1078
+ tenant_id: string;
1079
+ campaign_id: string;
1080
+ category: string;
1081
+ evidence: Record<string, unknown>;
1082
+ proposal: Record<string, unknown>;
1083
+ status: 'proposed' | 'accepted' | 'dismissed';
1084
+ created_by_model?: string | null;
1085
+ created_at: string;
1086
+ updated_at: string;
1087
+ }
1088
+ interface ImproveCampaignResponse {
1089
+ suggestions: CampaignSuggestion[];
1090
+ }
1091
+ interface ListCampaignSuggestionsParams {
1092
+ limit?: number;
1093
+ offset?: number;
1094
+ status?: string;
1095
+ }
1096
+ interface CampaignSuggestionListResponse {
1097
+ suggestions: CampaignSuggestion[];
1098
+ total: number;
1099
+ offset: number;
1100
+ limit: number;
1101
+ }
1102
+ declare class CampaignsResource {
1103
+ private client;
1104
+ members: CampaignMembersResource;
1105
+ routes: CampaignRoutesResource;
1106
+ constructor(client: RymiClient);
1107
+ /** List campaigns for the authenticated tenant, paginated. */
1108
+ list(params?: ListCampaignsParams): Promise<CampaignListResponse>;
1109
+ /** Create a new campaign in draft status against a published agent. */
1110
+ create(data: CreateCampaignParams): Promise<{
1111
+ campaign: Campaign;
1112
+ }>;
1113
+ /** Retrieve a single campaign by id. */
1114
+ get(campaignId: string): Promise<{
1115
+ campaign: Campaign;
1116
+ }>;
1117
+ /** Update campaign policy/goal fields. Status and lifecycle fields are not writable here. */
1118
+ update(campaignId: string, data: UpdateCampaignParams): Promise<{
1119
+ campaign: Campaign;
1120
+ }>;
1121
+ /**
1122
+ * Launch a campaign: validates launch blockers, then stamps
1123
+ * `launched_at` + `agent_snapshot_id`, flips members to `ready`, and
1124
+ * transitions status to `running`.
1125
+ */
1126
+ launch(campaignId: string): Promise<LaunchCampaignResponse>;
1127
+ /** Evaluate launch blockers without launching (dry run). Safe from any status. */
1128
+ launchBlockers(campaignId: string): Promise<{
1129
+ blockers: LaunchBlocker[];
1130
+ launchable: boolean;
1131
+ }>;
1132
+ /** Pause a running campaign. In-flight calls finish naturally. */
1133
+ pause(campaignId: string): Promise<{
1134
+ campaign: Campaign;
1135
+ }>;
1136
+ /** Resume a paused campaign. */
1137
+ resume(campaignId: string): Promise<{
1138
+ campaign: Campaign;
1139
+ }>;
1140
+ /** Archive a campaign. Terminal — the scheduler never selects work for it again. */
1141
+ archive(campaignId: string): Promise<{
1142
+ campaign: Campaign;
1143
+ }>;
1144
+ /** Read the campaign report: `stat_*` summary counters + outcome/sentiment/hourly/snapshot distributions. */
1145
+ report(campaignId: string): Promise<CampaignReportResponse>;
1146
+ /** List a campaign's dial attempts, paginated. */
1147
+ attempts(campaignId: string, params?: ListCampaignAttemptsParams): Promise<CampaignAttemptListResponse>;
1148
+ /** List a campaign's sweep-claim batches, paginated. */
1149
+ batches(campaignId: string, params?: ListCampaignBatchesParams): Promise<CampaignBatchListResponse>;
1150
+ /** List a campaign's follow-up jobs, paginated. */
1151
+ followups(campaignId: string, params?: ListCampaignFollowupsParams): Promise<CampaignFollowupListResponse>;
1152
+ /** Run the improve engine: detectors gate an LLM proposal writer, persisting new `campaign_suggestions`. */
1153
+ improve(campaignId: string): Promise<ImproveCampaignResponse>;
1154
+ /** List a campaign's improvement suggestions, paginated. */
1155
+ suggestions(campaignId: string, params?: ListCampaignSuggestionsParams): Promise<CampaignSuggestionListResponse>;
1156
+ /** Accept a suggestion: agent-editing suggestions create an agent-changes draft; campaign-policy suggestions patch the campaign. */
1157
+ acceptSuggestion(campaignId: string, suggestionId: string): Promise<{
1158
+ suggestion: CampaignSuggestion;
1159
+ }>;
1160
+ /** Dismiss a suggestion without applying it. */
1161
+ dismissSuggestion(campaignId: string, suggestionId: string): Promise<{
1162
+ suggestion: CampaignSuggestion;
1163
+ }>;
1164
+ }
1165
+
1166
+ interface ListContactsParams {
1167
+ limit?: number;
1168
+ offset?: number;
1169
+ }
1170
+ interface ContactListResponse {
1171
+ contacts: Contact[];
1172
+ total: number;
1173
+ offset: number;
1174
+ limit: number;
1175
+ }
1176
+ interface CreateContactParams {
1177
+ phone?: string;
1178
+ email?: string;
1179
+ name?: string;
1180
+ timezone?: string;
1181
+ language?: string;
1182
+ tags?: string[];
1183
+ custom_fields?: Record<string, unknown>;
1184
+ consent?: Record<string, boolean>;
1185
+ source?: string;
1186
+ }
1187
+ interface CreateContactResponse {
1188
+ contact: Contact;
1189
+ deduped: boolean;
1190
+ }
1191
+ interface UpdateContactParams {
1192
+ phone?: string;
1193
+ email?: string | null;
1194
+ name?: string | null;
1195
+ timezone?: string | null;
1196
+ language?: string | null;
1197
+ tags?: string[];
1198
+ custom_fields?: Record<string, unknown>;
1199
+ consent?: Record<string, boolean>;
1200
+ source?: string | null;
1201
+ }
1202
+ interface ImportContactsParams {
1203
+ contacts?: Array<Record<string, unknown>>;
1204
+ csv?: string;
1205
+ }
1206
+ interface ImportContactsResponse {
1207
+ created: number;
1208
+ merged: number;
1209
+ invalid: Array<{
1210
+ row: number;
1211
+ reason: string;
1212
+ }>;
1213
+ }
1214
+ interface SetConsentParams {
1215
+ channel: 'voice' | 'sms' | 'whatsapp' | 'telegram';
1216
+ granted: boolean;
1217
+ source?: string;
1218
+ method?: string;
1219
+ }
1220
+ interface SetConsentResponse {
1221
+ contact_id: string;
1222
+ channel: string;
1223
+ consent: {
1224
+ granted: boolean;
1225
+ at: string;
1226
+ source: string;
1227
+ method: string;
1228
+ };
1229
+ }
1230
+ declare class ContactsResource {
1231
+ private client;
1232
+ constructor(client: RymiClient);
1233
+ /** List tenant-level contacts, paginated. */
1234
+ list(params?: ListContactsParams): Promise<ContactListResponse>;
1235
+ /**
1236
+ * Create a tenant-level contact. If a contact with the same
1237
+ * (tenant, phone) already exists, the existing row is returned instead
1238
+ * of creating a duplicate — check `deduped` in the response.
1239
+ */
1240
+ create(data: CreateContactParams): Promise<CreateContactResponse>;
1241
+ /** Retrieve a single tenant-scoped contact by id. */
1242
+ get(contactId: string): Promise<{
1243
+ contact: Contact;
1244
+ }>;
1245
+ /** Update an existing tenant-scoped contact. Only provided fields change. */
1246
+ update(contactId: string, data: UpdateContactParams): Promise<{
1247
+ contact: Contact;
1248
+ }>;
1249
+ /** Delete a tenant-scoped contact. */
1250
+ delete(contactId: string): Promise<{
1251
+ status: 'deleted';
1252
+ id: string;
1253
+ }>;
1254
+ /**
1255
+ * Bulk import contacts from JSON rows or CSV text. Each row's phone is
1256
+ * normalized to E.164 and upserted on (tenant_id, phone); rows with
1257
+ * unparseable phones are skipped and reported in `invalid`.
1258
+ */
1259
+ import(data: ImportContactsParams): Promise<ImportContactsResponse>;
1260
+ /** Record a consent grant or revoke for one channel, with evidence. Also
1261
+ * appends an immutable row to the consent_events proof log. */
1262
+ setConsent(contactId: string, data: SetConsentParams): Promise<SetConsentResponse>;
1263
+ }
1264
+
1265
+ interface AttestParams {
1266
+ kind: 'dnc_external_scrub' | 'ai_disclosure';
1267
+ note?: string;
1268
+ }
1269
+ interface Attestation {
1270
+ id: string;
1271
+ tenant_id: string;
1272
+ kind: string;
1273
+ attested_by: string | null;
1274
+ note: string | null;
1275
+ created_at: string;
1276
+ }
1277
+ interface AttestResponse {
1278
+ attestation: Attestation;
1279
+ }
1280
+ interface ListAttestationsResponse {
1281
+ attestations: Attestation[];
1282
+ }
1283
+ declare class ComplianceResource {
1284
+ private client;
1285
+ constructor(client: RymiClient);
1286
+ /** Record a compliance attestation (append-only). Campaign launch blockers
1287
+ * in `attested` mode read the most recent one of the matching `kind`. */
1288
+ attest(data: AttestParams): Promise<AttestResponse>;
1289
+ /** List the tenant's 50 most recent compliance attestations, newest first. */
1290
+ listAttestations(): Promise<ListAttestationsResponse>;
1291
+ }
1292
+
749
1293
  declare class Rymi {
750
1294
  private client;
751
1295
  agents: AgentsResource;
@@ -757,7 +1301,10 @@ declare class Rymi {
757
1301
  telephony: TelephonyResource;
758
1302
  billing: BillingResource;
759
1303
  templates: TemplatesResource;
1304
+ campaigns: CampaignsResource;
1305
+ contacts: ContactsResource;
1306
+ compliance: ComplianceResource;
760
1307
  constructor(options?: ClientOptions);
761
1308
  }
762
1309
 
763
- export { type AddKnowledgeSourceParams, type AgentCallListResponse, type AgentChange, type AgentKnowledgeSource, type AgentListResponse, type AgentTemplateSummary, AgentsResource, type ApplyChangesParams, type ApplyChangesResponse, type BatchCallParams, BillingResource, type CallListResponse, type CallRecord, CallsResource, type ChangeEntry, type ClientOptions, type ConnectTelephonyParams, type CreateAgentParams, type CreateCallParams, type CreateCallResponse, type CreatePublishableKeyParams, type DncCheckResult, type DncEntry, type DncListResponse, DncResource, type EnrichCompanyParams, type EnrichCompanyResponse, KeysResource, type ListCallsParams, type NumberRecord, NumbersResource, type PreviewStackParams, type PublishableKeyRecord, Rymi, RymiClient, RymiError, type TelephonyProvider, TelephonyResource, TemplatesResource, type UpdateAgentParams, type UsageSummary, type ValidatePublishParams, type WebhookRecord, WebhooksResource, Rymi as default };
1310
+ export { type AddCampaignMembersParams, type AddKnowledgeSourceParams, type AgentCallListResponse, type AgentChange, type AgentKnowledgeSource, type AgentListResponse, type AgentTemplateSummary, AgentsResource, type ApplyChangesParams, type ApplyChangesResponse, type AttestParams, type AttestResponse, type Attestation, type BatchCallParams, BillingResource, type CallListResponse, type CallRecord, CallsResource, type CampaignAttemptListResponse, type CampaignBatch, type CampaignBatchListResponse, type CampaignFollowupJob, type CampaignFollowupListResponse, type CampaignListResponse, type CampaignMemberListResponse, type CampaignReportResponse, type CampaignRoute, type CampaignRouteListResponse, type CampaignSuggestion, type CampaignSuggestionListResponse, CampaignsResource, type ChangeEntry, type ClientOptions, ComplianceResource, type ConnectTelephonyParams, type ContactListResponse, ContactsResource, type CreateAgentParams, type CreateCallParams, type CreateCallResponse, type CreateCampaignParams, type CreateCampaignRouteParams, type CreateContactParams, type CreateContactResponse, type CreatePublishableKeyParams, type DncCheckResult, type DncEntry, type DncListResponse, DncResource, type EnrichCompanyParams, type EnrichCompanyResponse, type FanoutCallParams, type ImportCampaignMembersParams, type ImportCampaignMembersResponse, type ImportContactsParams, type ImportContactsResponse, type ImproveCampaignResponse, KeysResource, type LaunchBlocker, type LaunchCampaignResponse, type ListAttestationsResponse, type ListCallsParams, type ListCampaignAttemptsParams, type ListCampaignBatchesParams, type ListCampaignFollowupsParams, type ListCampaignMembersParams, type ListCampaignRoutesParams, type ListCampaignSuggestionsParams, type ListCampaignsParams, type ListContactsParams, type NumberRecord, NumbersResource, type PreviewStackParams, type PublishAgentResponse, type PublishValidationIssue, type PublishableKeyRecord, Rymi, RymiClient, RymiError, type SetConsentParams, type SetConsentResponse, type TelephonyProvider, TelephonyResource, TemplatesResource, type UpdateAgentParams, type UpdateCampaignMemberParams, type UpdateCampaignParams, type UpdateCampaignRouteParams, type UpdateContactParams, type UsageSummary, type ValidatePublishParams, type WebhookProvisionResult, type WebhookRecord, WebhooksResource, Rymi as default };