@rymi/node 1.0.1 → 2.1.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, AgentToolBinding, 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,11 +62,11 @@ 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[];
63
68
  provider_config?: any;
69
+ tools?: AgentToolBinding[];
64
70
  }
65
71
  interface UpdateAgentParams {
66
72
  name?: string;
@@ -90,12 +96,13 @@ interface UpdateAgentParams {
90
96
  custom_voice_url?: string | null;
91
97
  custom_voice_mode?: 'rymi' | 'openai-compat';
92
98
  custom_transcriber_url?: string | null;
93
- agent_role?: 'operator' | 'specialist' | 'executive' | 'concierge';
94
99
  language?: string | null;
95
100
  /** All BCP-47 languages the agent should handle, e.g. ["hi-IN","en-US"] for a bilingual agent. */
96
101
  supported_languages?: string[];
97
102
  chat_summary?: string | null;
98
103
  provider_config?: any;
104
+ /** Replaces the whole bindings array — build it from a fresh retrieve(). */
105
+ tools?: AgentToolBinding[];
99
106
  }
100
107
  interface AgentListResponse {
101
108
  agents: Agent[];
@@ -121,6 +128,26 @@ interface ValidatePublishParams {
121
128
  post_call?: any;
122
129
  [key: string]: any;
123
130
  }
131
+ interface PublishValidationIssue {
132
+ severity?: string;
133
+ section?: string;
134
+ title?: string;
135
+ detail?: string;
136
+ [key: string]: any;
137
+ }
138
+ interface PublishAgentResponse {
139
+ published: boolean;
140
+ agent_id?: string;
141
+ /** Present when published — the frozen snapshot id and timestamp. */
142
+ snapshot_id?: string | null;
143
+ published_at?: string | null;
144
+ /** Present when published: false because of unresolved blockers. */
145
+ reason?: string;
146
+ blockers?: PublishValidationIssue[];
147
+ warnings?: PublishValidationIssue[];
148
+ error?: string;
149
+ details?: string;
150
+ }
124
151
  interface ChangeEntry {
125
152
  key: string;
126
153
  value: any;
@@ -147,9 +174,6 @@ interface EnrichCompanyResponse {
147
174
  error?: string;
148
175
  }
149
176
  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
177
  language?: string | null;
154
178
  /** Required, non-empty list of BCP-47 languages to resolve a stack for. */
155
179
  supported_languages: string[];
@@ -173,6 +197,33 @@ type AddKnowledgeSourceParams = {
173
197
  title: string;
174
198
  url: string;
175
199
  };
200
+ /** A public share link: anyone with the URL can talk to the agent, billed to your workspace. */
201
+ interface AgentShareLink {
202
+ id: string;
203
+ url: string;
204
+ enabled: boolean;
205
+ minutes_limit: number;
206
+ minutes_used: number;
207
+ minutes_reserved: number;
208
+ minutes_remaining: number;
209
+ live_calls: number;
210
+ max_call_seconds: number;
211
+ max_concurrent: number;
212
+ calls_per_ip_hour: number;
213
+ minutes_requested_at: string | null;
214
+ }
215
+ /** All optional; omitted fields keep their current value (or the default on create). */
216
+ interface AgentShareLinkSettings {
217
+ enabled?: boolean;
218
+ /** Total talk-time pool for the link, 0–6000 minutes. */
219
+ minutes_limit?: number;
220
+ /** Per-call cap, 60–1800 seconds. */
221
+ max_call_seconds?: number;
222
+ /** Simultaneous calls, 1–10. */
223
+ max_concurrent?: number;
224
+ /** Calls per caller IP per hour, 1–30. */
225
+ calls_per_ip_hour?: number;
226
+ }
176
227
  interface AgentChange {
177
228
  change_id: string;
178
229
  field_path?: string;
@@ -245,6 +296,13 @@ declare class AgentsResource {
245
296
  * Pass agent_id to merge with an existing persisted agent, or supply fields directly.
246
297
  */
247
298
  validatePublish(params: ValidatePublishParams): Promise<Record<string, any>>;
299
+ /**
300
+ * Publish an agent: validate its persisted config and freeze it into the
301
+ * published snapshot the harness/review pipeline reads as the baseline.
302
+ * Returns `{ published: false, blockers }` (HTTP 200) when blockers remain —
303
+ * inspect `blockers` rather than relying on a thrown error.
304
+ */
305
+ publish(agentId: string): Promise<PublishAgentResponse>;
248
306
  /**
249
307
  * Validate and apply a flat-diff change-set against the AgentConfig field registry.
250
308
  * Does NOT persist — callers must follow up with update().
@@ -256,9 +314,8 @@ declare class AgentsResource {
256
314
  enrichCompany(params: EnrichCompanyParams): Promise<EnrichCompanyResponse>;
257
315
  /**
258
316
  * 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.
317
+ * warnings, and model diffs for a set of supported languages — without
318
+ * persisting anything.
262
319
  */
263
320
  previewStack(params: PreviewStackParams): Promise<Record<string, any>>;
264
321
  /**
@@ -275,6 +332,26 @@ declare class AgentsResource {
275
332
  * Delete a knowledge source from an agent.
276
333
  */
277
334
  deleteKnowledgeSource(agentId: string, sourceId: string): Promise<Record<string, any>>;
335
+ /**
336
+ * Get the agent's public share link, or `link: null` if none exists.
337
+ * `link_feature: false` means share links are disabled on this deployment.
338
+ */
339
+ getShareLink(agentId: string): Promise<{
340
+ link_feature: boolean;
341
+ link: AgentShareLink | null;
342
+ }>;
343
+ /**
344
+ * Create the agent's public share link, or update its settings if one exists.
345
+ */
346
+ setShareLink(agentId: string, settings?: AgentShareLinkSettings): Promise<{
347
+ link: AgentShareLink;
348
+ }>;
349
+ /**
350
+ * Issue a new URL for the share link. The old URL stops working immediately.
351
+ */
352
+ regenerateShareLink(agentId: string): Promise<{
353
+ link: AgentShareLink;
354
+ }>;
278
355
  /**
279
356
  * List the recorded configuration changes for an agent (most recent first).
280
357
  * Optionally pass an ISO timestamp to only return changes since then.
@@ -299,6 +376,19 @@ declare class AgentsResource {
299
376
  */
300
377
  runEvals(agentId: string, params?: {
301
378
  mode?: 'synthetic' | 'live';
379
+ judge?: boolean;
380
+ }): Promise<Record<string, any>>;
381
+ /**
382
+ * Run the eval SUITE across many agents at once (agents × seeded scenarios),
383
+ * bounded by the optional concurrency cap. One eval run is persisted per
384
+ * agent; the aggregate EvalSuiteReport is returned. Pass `judge: true` to
385
+ * supplement the heuristics with the opt-in LLM judge (needs a Gemini key).
386
+ */
387
+ runEvalSuite(params: {
388
+ agentIds: string[];
389
+ scenarioIds?: string[];
390
+ concurrency?: number;
391
+ judge?: boolean;
302
392
  }): Promise<Record<string, any>>;
303
393
  /**
304
394
  * List previous evaluation runs for an agent.
@@ -377,6 +467,26 @@ interface BatchCallParams {
377
467
  variables?: Record<string, any>;
378
468
  post_call?: Record<string, any>;
379
469
  }
470
+ interface FanoutCallParams {
471
+ agent_id: string;
472
+ to?: string[];
473
+ recipients?: Array<{
474
+ to?: string;
475
+ identity?: string;
476
+ phone?: string;
477
+ phone_number?: string;
478
+ from_number?: string;
479
+ metadata?: Record<string, any>;
480
+ }>;
481
+ from_number?: string;
482
+ /** Preferred tracking id for this fanout. Falls back to batch_id, then auto-generated. */
483
+ fanout_id?: string;
484
+ /** Compatibility alias for fanout_id. */
485
+ batch_id?: string;
486
+ metadata?: Record<string, any>;
487
+ variables?: Record<string, any>;
488
+ post_call?: Record<string, any>;
489
+ }
380
490
  interface CreateCallResponse {
381
491
  id: string;
382
492
  room_name: string;
@@ -418,7 +528,18 @@ declare class CallsResource {
418
528
  */
419
529
  create(data: CreateCallParams): Promise<CreateCallResponse>;
420
530
  /**
421
- * Queue up to 500 outbound PSTN recipients in one request.
531
+ * Group call fanout: dial up to 500 PSTN participants into a single call room.
532
+ * Every recipient joins the same call. For independent per-recipient attempts,
533
+ * retries, and reports, use `campaigns` instead.
534
+ */
535
+ fanout(data: FanoutCallParams): Promise<CreateCallResponse & {
536
+ fanout_id: string;
537
+ batch_id: string;
538
+ queued: number;
539
+ }>;
540
+ /**
541
+ * Compatibility alias for {@link fanout}. Creates one call room with multiple
542
+ * PSTN participants. Queue up to 500 outbound PSTN recipients in one request.
422
543
  */
423
544
  batch(data: BatchCallParams): Promise<CreateCallResponse & {
424
545
  batch_id: string;
@@ -508,13 +629,26 @@ interface NumberRecord {
508
629
  id?: string;
509
630
  number?: string;
510
631
  phone_number?: string;
511
- provider?: 'plivo' | 'twilio' | 'vonage';
632
+ provider?: 'plivo' | 'twilio' | 'vonage' | 'telnyx';
512
633
  capabilities?: string[];
513
634
  price?: string | number;
514
635
  monthly_price?: number;
515
636
  agent_id?: string | null;
516
637
  assigned_agent_id?: string | null;
517
638
  created_at?: string;
639
+ /** Carrier inbound-webhook provisioning state (set once an agent is attached). */
640
+ webhook_status?: 'configured' | 'manual_required' | 'failed' | null;
641
+ webhook_url?: string | null;
642
+ webhook_error?: string | null;
643
+ last_inbound_at?: string | null;
644
+ }
645
+ /** Outcome of carrier inbound-webhook auto-provisioning. */
646
+ interface WebhookProvisionResult {
647
+ status: 'configured' | 'manual_required' | 'failed' | 'no_carrier';
648
+ provider: string | null;
649
+ webhookUrl: string | null;
650
+ verified: boolean;
651
+ error?: string;
518
652
  }
519
653
  declare class NumbersResource {
520
654
  private client;
@@ -537,11 +671,23 @@ declare class NumbersResource {
537
671
  status: 'registered';
538
672
  number: string;
539
673
  agent_id: string | null;
674
+ webhook: WebhookProvisionResult | null;
540
675
  }>;
541
676
  attach(number: string, agentId: string): Promise<{
542
677
  status: 'attached';
543
678
  agent_id: string;
544
679
  number: string;
680
+ webhook: WebhookProvisionResult | null;
681
+ }>;
682
+ /** Clear the agent association without deregistering the number. */
683
+ detach(number: string): Promise<{
684
+ status: 'detached';
685
+ number: string;
686
+ }>;
687
+ /** Re-run carrier inbound-webhook auto-provisioning for a number. */
688
+ provisionWebhook(number: string): Promise<{
689
+ number: string;
690
+ webhook: WebhookProvisionResult;
545
691
  }>;
546
692
  remove(number: string): Promise<{
547
693
  status: 'removed';
@@ -641,7 +787,7 @@ declare class KeysResource {
641
787
  }>;
642
788
  }
643
789
 
644
- type TelephonyProvider = 'plivo' | 'twilio' | 'vonage';
790
+ type TelephonyProvider = 'plivo' | 'twilio' | 'vonage' | 'telnyx';
645
791
  interface ConnectTelephonyParams {
646
792
  provider: TelephonyProvider;
647
793
  auth_id?: string;
@@ -649,6 +795,8 @@ interface ConnectTelephonyParams {
649
795
  api_key?: string;
650
796
  api_secret?: string;
651
797
  signature_secret?: string;
798
+ /** Telnyx Ed25519 webhook signing secret (optional). */
799
+ auth_secret?: string;
652
800
  }
653
801
  declare class TelephonyResource {
654
802
  private client;
@@ -700,9 +848,11 @@ declare class BillingResource {
700
848
  * MINUTES (the customer-facing unit), not dollars.
701
849
  */
702
850
  usageSummary(): Promise<UsageSummary>;
703
- /** Estimate the cost of a call for a given tier and duration. */
851
+ /** Estimate the cost of a call for a custom model stack and duration. */
704
852
  estimate(data?: {
705
- tier?: 'operator' | 'specialist' | 'executive' | 'concierge';
853
+ stt_model?: string;
854
+ llm_model?: string;
855
+ tts_model?: string;
706
856
  duration_seconds?: number;
707
857
  }): Promise<Record<string, any>>;
708
858
  /** Configure auto-recharge. Server rejects (400) if enabled && pack_usd <= threshold_usd. */
@@ -746,6 +896,482 @@ declare class TemplatesResource {
746
896
  }>;
747
897
  }
748
898
 
899
+ interface ListCampaignsParams {
900
+ limit?: number;
901
+ offset?: number;
902
+ status?: CampaignStatus;
903
+ type?: CampaignType;
904
+ agent_id?: string;
905
+ }
906
+ interface CampaignListResponse {
907
+ campaigns: Campaign[];
908
+ total: number;
909
+ offset: number;
910
+ limit: number;
911
+ }
912
+ interface CreateCampaignParams {
913
+ agent_id: string;
914
+ type: CampaignType;
915
+ name: string;
916
+ goal?: CampaignGoal;
917
+ schedule_policy?: Record<string, unknown>;
918
+ retry_policy?: Record<string, unknown>;
919
+ concurrency_policy?: Record<string, unknown>;
920
+ automation_policy?: Record<string, unknown>;
921
+ reporting_policy?: Record<string, unknown>;
922
+ compliance_policy?: CampaignCompliancePolicy;
923
+ metadata?: Record<string, unknown>;
924
+ }
925
+ interface UpdateCampaignParams {
926
+ name?: string;
927
+ goal?: CampaignGoal;
928
+ schedule_policy?: Record<string, unknown>;
929
+ retry_policy?: Record<string, unknown>;
930
+ concurrency_policy?: Record<string, unknown>;
931
+ automation_policy?: Record<string, unknown>;
932
+ reporting_policy?: Record<string, unknown>;
933
+ compliance_policy?: CampaignCompliancePolicy;
934
+ post_call_config_override?: Record<string, unknown>;
935
+ metadata?: Record<string, unknown>;
936
+ }
937
+ interface LaunchBlocker {
938
+ code: string;
939
+ ok: boolean;
940
+ detail?: string;
941
+ }
942
+ interface LaunchCampaignResponse {
943
+ campaign: Campaign;
944
+ blockers: LaunchBlocker[];
945
+ }
946
+ /**
947
+ * GET /campaigns/:id/report response. Extends the shared CampaignReport with
948
+ * the report-endpoint-only derived fields (top failure reasons + cost per
949
+ * success) that the API adds on top of the persisted shape.
950
+ */
951
+ interface CampaignReportResponse extends CampaignReport {
952
+ distributions: CampaignReport['distributions'] & {
953
+ top_failure_reasons: Array<{
954
+ reason: string;
955
+ count: number;
956
+ }>;
957
+ cost_per_success_credits: number;
958
+ };
959
+ }
960
+ interface ListCampaignMembersParams {
961
+ limit?: number;
962
+ offset?: number;
963
+ status?: string;
964
+ }
965
+ interface CampaignMemberListResponse {
966
+ members: CampaignMember[];
967
+ total: number;
968
+ offset: number;
969
+ limit: number;
970
+ }
971
+ interface AddCampaignMembersParams {
972
+ contact_ids: string[];
973
+ variables_override?: Record<string, string>;
974
+ }
975
+ interface ImportCampaignMembersParams {
976
+ contacts?: Array<Record<string, unknown>>;
977
+ csv?: string;
978
+ }
979
+ interface ImportCampaignMembersResponse {
980
+ created: number;
981
+ merged: number;
982
+ /** Members attached to the campaign in this import. */
983
+ attached: number;
984
+ invalid: Array<{
985
+ row: number;
986
+ reason: string;
987
+ }>;
988
+ }
989
+ interface UpdateCampaignMemberParams {
990
+ status?: string;
991
+ variables_override?: Record<string, string>;
992
+ next_attempt_at?: string;
993
+ }
994
+ declare class CampaignMembersResource {
995
+ private client;
996
+ constructor(client: RymiClient);
997
+ /** List a campaign's members, paginated. */
998
+ list(campaignId: string, params?: ListCampaignMembersParams): Promise<CampaignMemberListResponse>;
999
+ /** Attach existing contacts to a campaign as members. */
1000
+ add(campaignId: string, data: AddCampaignMembersParams): Promise<{
1001
+ members: CampaignMember[];
1002
+ }>;
1003
+ /** Import inline contact rows (JSON or CSV): creates/merges contacts and attaches members in one call. */
1004
+ import(campaignId: string, data: ImportCampaignMembersParams): Promise<ImportCampaignMembersResponse>;
1005
+ /** Update a campaign member (status, variables, next attempt time). */
1006
+ update(campaignId: string, memberId: string, data: UpdateCampaignMemberParams): Promise<{
1007
+ member: CampaignMember;
1008
+ }>;
1009
+ /** Remove a member from a campaign. */
1010
+ remove(campaignId: string, memberId: string): Promise<{
1011
+ status: 'deleted';
1012
+ id: string;
1013
+ }>;
1014
+ }
1015
+ interface CampaignRoute {
1016
+ id: string;
1017
+ tenant_id: string;
1018
+ campaign_id: string;
1019
+ phone_number: string;
1020
+ schedule: Record<string, unknown>;
1021
+ active: boolean;
1022
+ created_at: string;
1023
+ updated_at: string;
1024
+ }
1025
+ interface ListCampaignRoutesParams {
1026
+ limit?: number;
1027
+ offset?: number;
1028
+ }
1029
+ interface CampaignRouteListResponse {
1030
+ routes: CampaignRoute[];
1031
+ total: number;
1032
+ offset: number;
1033
+ limit: number;
1034
+ }
1035
+ interface CreateCampaignRouteParams {
1036
+ phone_number: string;
1037
+ schedule?: Record<string, unknown>;
1038
+ active?: boolean;
1039
+ }
1040
+ interface UpdateCampaignRouteParams {
1041
+ schedule?: Record<string, unknown>;
1042
+ active?: boolean;
1043
+ }
1044
+ declare class CampaignRoutesResource {
1045
+ private client;
1046
+ constructor(client: RymiClient);
1047
+ /** List a campaign's inbound routing rules. */
1048
+ list(campaignId: string, params?: ListCampaignRoutesParams): Promise<CampaignRouteListResponse>;
1049
+ /** Bind an owned phone number to this campaign for inbound routing. Only one active route per number is allowed. */
1050
+ create(campaignId: string, data: CreateCampaignRouteParams): Promise<{
1051
+ route: CampaignRoute;
1052
+ }>;
1053
+ /** Update an inbound route's schedule or active flag. */
1054
+ update(campaignId: string, routeId: string, data: UpdateCampaignRouteParams): Promise<{
1055
+ route: CampaignRoute;
1056
+ }>;
1057
+ /** Delete an inbound route. */
1058
+ delete(campaignId: string, routeId: string): Promise<{
1059
+ status: 'deleted';
1060
+ id: string;
1061
+ }>;
1062
+ }
1063
+ interface ListCampaignAttemptsParams {
1064
+ limit?: number;
1065
+ offset?: number;
1066
+ status?: string;
1067
+ }
1068
+ interface CampaignAttemptListResponse {
1069
+ attempts: CampaignAttempt[];
1070
+ total: number;
1071
+ offset: number;
1072
+ limit: number;
1073
+ }
1074
+ interface ListCampaignBatchesParams {
1075
+ limit?: number;
1076
+ offset?: number;
1077
+ }
1078
+ interface CampaignBatch {
1079
+ id: string;
1080
+ tenant_id: string;
1081
+ campaign_id: string;
1082
+ batch_key: string;
1083
+ status: string;
1084
+ selected_count: number;
1085
+ queued_count: number;
1086
+ completed_count: number;
1087
+ failed_count: number;
1088
+ started_at?: string | null;
1089
+ completed_at?: string | null;
1090
+ created_at: string;
1091
+ }
1092
+ interface CampaignBatchListResponse {
1093
+ batches: CampaignBatch[];
1094
+ total: number;
1095
+ offset: number;
1096
+ limit: number;
1097
+ }
1098
+ interface ListCampaignFollowupsParams {
1099
+ limit?: number;
1100
+ offset?: number;
1101
+ status?: string;
1102
+ }
1103
+ interface CampaignFollowupJob {
1104
+ id: string;
1105
+ tenant_id: string;
1106
+ campaign_id: string;
1107
+ campaign_attempt_id?: string | null;
1108
+ campaign_member_id?: string | null;
1109
+ kind: string;
1110
+ status: string;
1111
+ scheduled_at: string;
1112
+ consent_checked: boolean;
1113
+ capability_checked: boolean;
1114
+ idempotency_key: string;
1115
+ payload: Record<string, unknown>;
1116
+ result?: Record<string, unknown> | null;
1117
+ created_at: string;
1118
+ updated_at: string;
1119
+ }
1120
+ interface CampaignFollowupListResponse {
1121
+ followups: CampaignFollowupJob[];
1122
+ total: number;
1123
+ offset: number;
1124
+ limit: number;
1125
+ }
1126
+ interface CampaignSuggestion {
1127
+ id: string;
1128
+ tenant_id: string;
1129
+ campaign_id: string;
1130
+ category: string;
1131
+ evidence: Record<string, unknown>;
1132
+ proposal: Record<string, unknown>;
1133
+ status: 'proposed' | 'accepted' | 'dismissed';
1134
+ created_by_model?: string | null;
1135
+ created_at: string;
1136
+ updated_at: string;
1137
+ }
1138
+ interface ImproveCampaignResponse {
1139
+ suggestions: CampaignSuggestion[];
1140
+ }
1141
+ interface ListCampaignSuggestionsParams {
1142
+ limit?: number;
1143
+ offset?: number;
1144
+ status?: string;
1145
+ }
1146
+ interface CampaignSuggestionListResponse {
1147
+ suggestions: CampaignSuggestion[];
1148
+ total: number;
1149
+ offset: number;
1150
+ limit: number;
1151
+ }
1152
+ declare class CampaignsResource {
1153
+ private client;
1154
+ members: CampaignMembersResource;
1155
+ routes: CampaignRoutesResource;
1156
+ constructor(client: RymiClient);
1157
+ /** List campaigns for the authenticated tenant, paginated. */
1158
+ list(params?: ListCampaignsParams): Promise<CampaignListResponse>;
1159
+ /** Create a new campaign in draft status against a published agent. */
1160
+ create(data: CreateCampaignParams): Promise<{
1161
+ campaign: Campaign;
1162
+ }>;
1163
+ /** Retrieve a single campaign by id. */
1164
+ get(campaignId: string): Promise<{
1165
+ campaign: Campaign;
1166
+ }>;
1167
+ /** Update campaign policy/goal fields. Status and lifecycle fields are not writable here. */
1168
+ update(campaignId: string, data: UpdateCampaignParams): Promise<{
1169
+ campaign: Campaign;
1170
+ }>;
1171
+ /**
1172
+ * Launch a campaign: validates launch blockers, then stamps
1173
+ * `launched_at` + `agent_snapshot_id`, flips members to `ready`, and
1174
+ * transitions status to `running`.
1175
+ */
1176
+ launch(campaignId: string): Promise<LaunchCampaignResponse>;
1177
+ /** Evaluate launch blockers without launching (dry run). Safe from any status. */
1178
+ launchBlockers(campaignId: string): Promise<{
1179
+ blockers: LaunchBlocker[];
1180
+ launchable: boolean;
1181
+ }>;
1182
+ /** Pause a running campaign. In-flight calls finish naturally. */
1183
+ pause(campaignId: string): Promise<{
1184
+ campaign: Campaign;
1185
+ }>;
1186
+ /** Resume a paused campaign. */
1187
+ resume(campaignId: string): Promise<{
1188
+ campaign: Campaign;
1189
+ }>;
1190
+ /** Archive a campaign. Terminal — the scheduler never selects work for it again. */
1191
+ archive(campaignId: string): Promise<{
1192
+ campaign: Campaign;
1193
+ }>;
1194
+ /** Read the campaign report: `stat_*` summary counters + outcome/sentiment/hourly/snapshot distributions. */
1195
+ report(campaignId: string): Promise<CampaignReportResponse>;
1196
+ /** List a campaign's dial attempts, paginated. */
1197
+ attempts(campaignId: string, params?: ListCampaignAttemptsParams): Promise<CampaignAttemptListResponse>;
1198
+ /** List a campaign's sweep-claim batches, paginated. */
1199
+ batches(campaignId: string, params?: ListCampaignBatchesParams): Promise<CampaignBatchListResponse>;
1200
+ /** List a campaign's follow-up jobs, paginated. */
1201
+ followups(campaignId: string, params?: ListCampaignFollowupsParams): Promise<CampaignFollowupListResponse>;
1202
+ /** Run the improve engine: detectors gate an LLM proposal writer, persisting new `campaign_suggestions`. */
1203
+ improve(campaignId: string): Promise<ImproveCampaignResponse>;
1204
+ /** List a campaign's improvement suggestions, paginated. */
1205
+ suggestions(campaignId: string, params?: ListCampaignSuggestionsParams): Promise<CampaignSuggestionListResponse>;
1206
+ /** Accept a suggestion: agent-editing suggestions create an agent-changes draft; campaign-policy suggestions patch the campaign. */
1207
+ acceptSuggestion(campaignId: string, suggestionId: string): Promise<{
1208
+ suggestion: CampaignSuggestion;
1209
+ }>;
1210
+ /** Dismiss a suggestion without applying it. */
1211
+ dismissSuggestion(campaignId: string, suggestionId: string): Promise<{
1212
+ suggestion: CampaignSuggestion;
1213
+ }>;
1214
+ }
1215
+
1216
+ interface ListContactsParams {
1217
+ limit?: number;
1218
+ offset?: number;
1219
+ }
1220
+ interface ContactListResponse {
1221
+ contacts: Contact[];
1222
+ total: number;
1223
+ offset: number;
1224
+ limit: number;
1225
+ }
1226
+ interface CreateContactParams {
1227
+ phone?: string;
1228
+ email?: string;
1229
+ name?: string;
1230
+ timezone?: string;
1231
+ language?: string;
1232
+ tags?: string[];
1233
+ custom_fields?: Record<string, unknown>;
1234
+ consent?: Record<string, boolean>;
1235
+ source?: string;
1236
+ }
1237
+ interface CreateContactResponse {
1238
+ contact: Contact;
1239
+ deduped: boolean;
1240
+ }
1241
+ interface UpdateContactParams {
1242
+ phone?: string;
1243
+ email?: string | null;
1244
+ name?: string | null;
1245
+ timezone?: string | null;
1246
+ language?: string | null;
1247
+ tags?: string[];
1248
+ custom_fields?: Record<string, unknown>;
1249
+ consent?: Record<string, boolean>;
1250
+ source?: string | null;
1251
+ }
1252
+ interface ImportContactsParams {
1253
+ contacts?: Array<Record<string, unknown>>;
1254
+ csv?: string;
1255
+ }
1256
+ interface ImportContactsResponse {
1257
+ created: number;
1258
+ merged: number;
1259
+ invalid: Array<{
1260
+ row: number;
1261
+ reason: string;
1262
+ }>;
1263
+ }
1264
+ interface SetConsentParams {
1265
+ channel: 'voice' | 'sms' | 'whatsapp' | 'telegram';
1266
+ granted: boolean;
1267
+ source?: string;
1268
+ method?: string;
1269
+ }
1270
+ interface SetConsentResponse {
1271
+ contact_id: string;
1272
+ channel: string;
1273
+ consent: {
1274
+ granted: boolean;
1275
+ at: string;
1276
+ source: string;
1277
+ method: string;
1278
+ };
1279
+ }
1280
+ declare class ContactsResource {
1281
+ private client;
1282
+ constructor(client: RymiClient);
1283
+ /** List tenant-level contacts, paginated. */
1284
+ list(params?: ListContactsParams): Promise<ContactListResponse>;
1285
+ /**
1286
+ * Create a tenant-level contact. If a contact with the same
1287
+ * (tenant, phone) already exists, the existing row is returned instead
1288
+ * of creating a duplicate — check `deduped` in the response.
1289
+ */
1290
+ create(data: CreateContactParams): Promise<CreateContactResponse>;
1291
+ /** Retrieve a single tenant-scoped contact by id. */
1292
+ get(contactId: string): Promise<{
1293
+ contact: Contact;
1294
+ }>;
1295
+ /** Update an existing tenant-scoped contact. Only provided fields change. */
1296
+ update(contactId: string, data: UpdateContactParams): Promise<{
1297
+ contact: Contact;
1298
+ }>;
1299
+ /** Delete a tenant-scoped contact. */
1300
+ delete(contactId: string): Promise<{
1301
+ status: 'deleted';
1302
+ id: string;
1303
+ }>;
1304
+ /**
1305
+ * Bulk import contacts from JSON rows or CSV text. Each row's phone is
1306
+ * normalized to E.164 and upserted on (tenant_id, phone); rows with
1307
+ * unparseable phones are skipped and reported in `invalid`.
1308
+ */
1309
+ import(data: ImportContactsParams): Promise<ImportContactsResponse>;
1310
+ /** Record a consent grant or revoke for one channel, with evidence. Also
1311
+ * appends an immutable row to the consent_events proof log. */
1312
+ setConsent(contactId: string, data: SetConsentParams): Promise<SetConsentResponse>;
1313
+ }
1314
+
1315
+ interface AttestParams {
1316
+ kind: 'dnc_external_scrub' | 'ai_disclosure';
1317
+ note?: string;
1318
+ }
1319
+ interface Attestation {
1320
+ id: string;
1321
+ tenant_id: string;
1322
+ kind: string;
1323
+ attested_by: string | null;
1324
+ note: string | null;
1325
+ created_at: string;
1326
+ }
1327
+ interface AttestResponse {
1328
+ attestation: Attestation;
1329
+ }
1330
+ interface ListAttestationsResponse {
1331
+ attestations: Attestation[];
1332
+ }
1333
+ declare class ComplianceResource {
1334
+ private client;
1335
+ constructor(client: RymiClient);
1336
+ /** Record a compliance attestation (append-only). Campaign launch blockers
1337
+ * in `attested` mode read the most recent one of the matching `kind`. */
1338
+ attest(data: AttestParams): Promise<AttestResponse>;
1339
+ /** List the tenant's 50 most recent compliance attestations, newest first. */
1340
+ listAttestations(): Promise<ListAttestationsResponse>;
1341
+ }
1342
+
1343
+ /** A stored API-tool secret. Values are write-only — never returned. */
1344
+ interface ToolSecretRecord {
1345
+ name: string;
1346
+ /** The only host this secret is ever sent to. */
1347
+ host: string | null;
1348
+ }
1349
+ /**
1350
+ * Tenant secrets referenced from call_webhook headers as `{{secrets.NAME}}`.
1351
+ * Each secret is pinned to one host and only interpolated into requests to it.
1352
+ */
1353
+ declare class ToolSecretsResource {
1354
+ private client;
1355
+ constructor(client: RymiClient);
1356
+ list(): Promise<{
1357
+ data: ToolSecretRecord[];
1358
+ }>;
1359
+ /** Create or replace. `name` is UPPER_SNAKE_CASE; `host` is a public hostname. */
1360
+ set(name: string, data: {
1361
+ value: string;
1362
+ host: string;
1363
+ }): Promise<{
1364
+ data: {
1365
+ name: string;
1366
+ };
1367
+ }>;
1368
+ delete(name: string): Promise<{
1369
+ data: {
1370
+ name: string;
1371
+ };
1372
+ }>;
1373
+ }
1374
+
749
1375
  declare class Rymi {
750
1376
  private client;
751
1377
  agents: AgentsResource;
@@ -757,7 +1383,11 @@ declare class Rymi {
757
1383
  telephony: TelephonyResource;
758
1384
  billing: BillingResource;
759
1385
  templates: TemplatesResource;
1386
+ campaigns: CampaignsResource;
1387
+ contacts: ContactsResource;
1388
+ compliance: ComplianceResource;
1389
+ toolSecrets: ToolSecretsResource;
760
1390
  constructor(options?: ClientOptions);
761
1391
  }
762
1392
 
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 };
1393
+ export { type AddCampaignMembersParams, type AddKnowledgeSourceParams, type AgentCallListResponse, type AgentChange, type AgentKnowledgeSource, type AgentListResponse, type AgentShareLink, type AgentShareLinkSettings, 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 ToolSecretRecord, ToolSecretsResource, type UpdateAgentParams, type UpdateCampaignMemberParams, type UpdateCampaignParams, type UpdateCampaignRouteParams, type UpdateContactParams, type UsageSummary, type ValidatePublishParams, type WebhookProvisionResult, type WebhookRecord, WebhooksResource, Rymi as default };