@alvera-ai/platform-sdk 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/.agent/account_management.md +31 -0
  2. package/.agent/action_status_updaters.md +174 -25
  3. package/.agent/ai_sandbox.md +4 -2
  4. package/.agent/connected_apps.md +7 -2
  5. package/.agent/cookbook/action-status-updaters.md +73 -14
  6. package/.agent/cookbook/ai-agent-invoke.md +36 -0
  7. package/.agent/cookbook/appointment-review-sms-workflow.md +32 -0
  8. package/.agent/cookbook/birthday-greeting-sms-trigger.md +34 -0
  9. package/.agent/cookbook/bulk-ingest.md +48 -0
  10. package/.agent/cookbook/contact-us-triage-with-llm.md +35 -0
  11. package/.agent/cookbook/dunning-sms-for-delinquent.md +32 -0
  12. package/.agent/cookbook/generic-tables.md +40 -0
  13. package/.agent/cookbook/kyc-notification-on-account-activation.md +34 -0
  14. package/.agent/cookbook/marketing-campaign-send.md +35 -0
  15. package/.agent/cookbook/paginated-restapi-poller.md +329 -0
  16. package/.agent/cookbook/rest-fetch.md +27 -0
  17. package/.agent/cookbook/sanctions-screening-with-agent-review.md +34 -0
  18. package/.agent/cookbook/score-leads-with-llm-categorization.md +35 -0
  19. package/.agent/cookbook/system-templates.md +36 -0
  20. package/.agent/cookbook/talk-to-data.md +39 -0
  21. package/.agent/cookbook/triage-prospects-by-priority.md +32 -0
  22. package/.agent/cookbook/welcome-sms-for-customers.md +32 -0
  23. package/.agent/datalakes.md +24 -0
  24. package/.agent/interoperability_contracts.md +29 -0
  25. package/.agent/tool-call-configs.md +11 -0
  26. package/.agent/tools.md +103 -36
  27. package/.agent/type_naming.md +4 -0
  28. package/dist/index.d.mts +189 -19
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +3 -1
  31. package/dist/index.mjs.map +1 -1
  32. package/package.json +2 -2
package/dist/index.d.mts CHANGED
@@ -361,6 +361,8 @@ type ManualToolInvocationResponse = {
361
361
  tool_call?: ({
362
362
  tool_call_type: 'sms_request';
363
363
  } & ManualToolInvocationSmsCallResponse) | ({
364
+ tool_call_type: 'mms_request';
365
+ } & ManualToolInvocationMmsCallResponse) | ({
364
366
  tool_call_type: 'email_request';
365
367
  } & ManualToolInvocationEmailCallResponse) | ({
366
368
  tool_call_type: 'restapi_request';
@@ -524,7 +526,7 @@ type S3CallResponse = {
524
526
  * Action Status Updater — automated polling for delivery status updates.
525
527
  */
526
528
  type ActionStatusUpdaterResponse = {
527
- action_log_config?: SimpleTemplateConfigResponse | null;
529
+ action_log_config: SimpleTemplateConfigResponse | null;
528
530
  /**
529
531
  * SHA-256 drift fingerprint over authored fields (server-computed)
530
532
  */
@@ -538,7 +540,7 @@ type ActionStatusUpdaterResponse = {
538
540
  */
539
541
  datalake_id: string;
540
542
  /**
541
- * JSON Schema the rendered events_template output is validated against on every poll (required for restapi updaters)
543
+ * JSON Schema the rendered events_template output is validated against on every poll (required for restapi updaters). FLOOR: it must describe an array whose items are objects listing "external_id" in "required" — every event has to name the message it reconciles, so the events_template maps the provider's own id (messageId / id / sid) into external_id. Add whatever else your provider guarantees on top; the platform only enforces the floor.
542
544
  */
543
545
  events_output_schema?: {
544
546
  [key: string]: unknown;
@@ -556,7 +558,7 @@ type ActionStatusUpdaterResponse = {
556
558
  */
557
559
  readonly last_run_at?: string | null;
558
560
  /**
559
- * Why the last poll run failed; null when it succeeded
561
+ * Why the last poll run failed, or why a `partial` run was truncated; null when the run completed and read its whole window
560
562
  */
561
563
  readonly last_run_error?: string | null;
562
564
  /**
@@ -564,16 +566,16 @@ type ActionStatusUpdaterResponse = {
564
566
  */
565
567
  readonly last_run_events_found?: number | null;
566
568
  /**
567
- * Outcome of the last poll run
569
+ * Outcome of the last poll run. `partial` means the run completed but its provider fetch was truncated, so the window was not fully read and the newest events may be missing — read `last_run_error` for detail.
568
570
  */
569
- readonly last_run_status?: 'ok' | 'error';
571
+ readonly last_run_status?: 'ok' | 'partial' | 'error';
570
572
  message_config: SimpleTemplateConfigResponse;
571
573
  /**
572
574
  * Updater name
573
575
  */
574
576
  name: string;
575
577
  /**
576
- * JSON Schema the rendered pagination_context_template output is validated against on every poll requires has_next plus any provider cursor keys (required for restapi updaters)
578
+ * JSON Schema the rendered pagination_context_template output is validated against on every poll (required for restapi updaters). FLOOR: it must describe an object listing "has_next" in "required" — that key is what ends the page loop. Add the provider's cursor keys on top; the platform only enforces the floor.
577
579
  */
578
580
  pagination_context_output_schema?: {
579
581
  [key: string]: unknown;
@@ -582,6 +584,10 @@ type ActionStatusUpdaterResponse = {
582
584
  * IDs of sender tools whose messages this updater monitors
583
585
  */
584
586
  sender_tool_ids?: Array<string> | null;
587
+ /**
588
+ * Whether this updater may poll. The server sets cycle_detected when a run re-reads events it has already handled, and every later job then fails without calling the provider. Set it back to active to resume polling — nothing else clears it.
589
+ */
590
+ status?: 'active' | 'cycle_detected';
585
591
  /**
586
592
  * Tenant ID
587
593
  */
@@ -624,6 +630,7 @@ type IngestRequest = {
624
630
  */
625
631
  declare enum ToolIntent {
626
632
  SMS = "sms",
633
+ MMS = "mms",
627
634
  EMAIL = "email",
628
635
  EXPORT = "export",
629
636
  VOICE = "voice",
@@ -827,7 +834,7 @@ type ResolvePageResponse = {
827
834
  /**
828
835
  * Message channel
829
836
  */
830
- channel: 'sms' | 'email' | 'voice' | 'web_form' | 'push';
837
+ channel: 'sms' | 'mms' | 'email' | 'voice' | 'web_form' | 'push';
831
838
  /**
832
839
  * When delivery was confirmed
833
840
  */
@@ -877,7 +884,11 @@ type ResolvePageResponse = {
877
884
  /**
878
885
  * Delivery status
879
886
  */
880
- status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed' | 'received' | 'clicked';
887
+ status: 'pending' | 'queued' | 'sent' | 'delivered' | 'read' | 'opened' | 'clicked' | 'form_submitted' | 'failed' | 'invalidated' | 'customer_rejected' | 'dry_run' | 'received';
888
+ /**
889
+ * Human-readable detail behind the current status, rendered from the delivery provider's event (e.g. the mailgun event name, or a bounce reason on failure)
890
+ */
891
+ status_description?: string | null;
881
892
  /**
882
893
  * Raw email subject line (null for SMS)
883
894
  */
@@ -907,6 +918,7 @@ type ResolvePageResponse = {
907
918
  */
908
919
  declare enum ActionType {
909
920
  SMS = "sms",
921
+ MMS = "mms",
910
922
  EMAIL = "email",
911
923
  VOICE = "voice",
912
924
  DATA_EXCHANGE = "data_exchange",
@@ -1078,7 +1090,7 @@ type ActionResponse = {
1078
1090
  */
1079
1091
  action_window_start?: number | null;
1080
1092
  /**
1081
- * Optional connected app — only valid for :sms and :email action types
1093
+ * Optional connected app — when set, the executor mints a per-recipient connected_app_form_url template variable; connected_app_route is required
1082
1094
  */
1083
1095
  connected_app_id?: string | null;
1084
1096
  /**
@@ -1113,6 +1125,8 @@ type ActionResponse = {
1113
1125
  tool_call: ({
1114
1126
  tool_call_type: 'sms_request';
1115
1127
  } & ActionSmsCallResponse) | ({
1128
+ tool_call_type: 'mms_request';
1129
+ } & ActionMmsCallResponse) | ({
1116
1130
  tool_call_type: 'email_request';
1117
1131
  } & ActionEmailCallResponse) | ({
1118
1132
  tool_call_type: 'sql_query';
@@ -1293,6 +1307,10 @@ type UpdatePageRequest = {
1293
1307
  * Puid token extracted from the short URL
1294
1308
  */
1295
1309
  short_path: string;
1310
+ /**
1311
+ * Engagement status reported by the connected app — typically "opened", "clicked", or "form_submitted". Applied through the monotonic status guard, so it only ever advances the message and never regresses it.
1312
+ */
1313
+ status?: string | null;
1296
1314
  };
1297
1315
  /**
1298
1316
  * InvitationResponse
@@ -1762,6 +1780,19 @@ type GenericTableListResponse = {
1762
1780
  data: Array<GenericTableResponse>;
1763
1781
  meta: PaginationMeta;
1764
1782
  };
1783
+ /**
1784
+ * MMSCallResponse
1785
+ *
1786
+ * MMS tool-call config — Liquid-templated recipient and body, plain public media URL.
1787
+ */
1788
+ type MmsCallResponse = {
1789
+ body: SimpleTemplateConfigResponse;
1790
+ /**
1791
+ * Public http(s) URL of the media to attach — fetched and re-staged into the tool's S3 media bucket
1792
+ */
1793
+ media_url: string;
1794
+ to: SimpleTemplateConfigResponse;
1795
+ };
1765
1796
  /**
1766
1797
  * ManualToolInvocationEmailCallResponse
1767
1798
  */
@@ -1796,6 +1827,10 @@ type UpdatePageResponse = {
1796
1827
  * When the page was opened by the recipient
1797
1828
  */
1798
1829
  opened_at?: string | null;
1830
+ /**
1831
+ * Message status after applying the update through the monotonic guard
1832
+ */
1833
+ status?: 'pending' | 'queued' | 'sent' | 'delivered' | 'read' | 'opened' | 'clicked' | 'form_submitted' | 'failed' | 'invalidated' | 'customer_rejected' | 'dry_run' | 'received';
1799
1834
  };
1800
1835
  };
1801
1836
  /**
@@ -1854,6 +1889,12 @@ type ManualToolInvocationSmsCallResponse = SmsCallResponse & {
1854
1889
  type ActionStatusUpdaterCloudWatchQueryResponse = CloudWatchQueryResponse & {
1855
1890
  updater_body_type: 'cloud_watch_request';
1856
1891
  };
1892
+ /**
1893
+ * ActionMMSCallResponse
1894
+ */
1895
+ type ActionMmsCallResponse = MmsCallResponse & {
1896
+ tool_call_type: 'mms_request';
1897
+ };
1857
1898
  /**
1858
1899
  * ToolSQLDatabaseResponse
1859
1900
  */
@@ -2106,6 +2147,54 @@ type DatasetSearchResponse = {
2106
2147
  type ActionAwsLambdaCallResponse = AwsLambdaCallResponse & {
2107
2148
  tool_call_type: 'aws_lambda_request';
2108
2149
  };
2150
+ /**
2151
+ * EndUserMessagingResponse
2152
+ *
2153
+ * AWS End User Messaging tool configuration for sending MMS via the SendMediaMessage API.
2154
+ */
2155
+ type EndUserMessagingResponse = {
2156
+ /**
2157
+ * AWS access key ID (used when auth_method is access_key)
2158
+ */
2159
+ access_key_id?: string | null;
2160
+ /**
2161
+ * IAM role ARN to assume in the customer's AWS account (used when auth_method is assume_role)
2162
+ */
2163
+ assume_role_arn?: string | null;
2164
+ /**
2165
+ * External ID for the STS AssumeRole call, unique per customer (auto-generated when auth_method is assume_role)
2166
+ */
2167
+ assume_role_external_id?: string | null;
2168
+ /**
2169
+ * AWS authentication method
2170
+ */
2171
+ auth_method: 'access_key' | 'iam_role' | 'assume_role';
2172
+ base_message?: ComplexTemplateConfigResponse | null;
2173
+ /**
2174
+ * AWS End User Messaging configuration set that routes delivery events to CloudWatch
2175
+ */
2176
+ configuration_set_name: string;
2177
+ /**
2178
+ * Custom sms-voice endpoint URL (e.g. http://localhost:8080 for the WireMock stub); leave blank for real AWS
2179
+ */
2180
+ endpoint_url?: string | null;
2181
+ /**
2182
+ * S3 bucket (same region as the sending number) where author media is re-staged for SendMediaMessage
2183
+ */
2184
+ media_bucket: string;
2185
+ /**
2186
+ * Custom S3 endpoint URL for media staging (e.g. http://localhost:4566 for LocalStack); leave blank for AWS S3 in the tool's region
2187
+ */
2188
+ media_endpoint_url?: string | null;
2189
+ /**
2190
+ * Origination phone number or identity in E.164 format (e.g., +15551234567); must be MMS-capable
2191
+ */
2192
+ phone_number: string;
2193
+ /**
2194
+ * AWS region (e.g., us-west-2)
2195
+ */
2196
+ region: string;
2197
+ };
2109
2198
  /**
2110
2199
  * ToolS3Response
2111
2200
  */
@@ -2721,6 +2810,8 @@ type ToolResponse = {
2721
2810
  } & ToolEmailResponse) | ({
2722
2811
  tool_body_type: 'sns';
2723
2812
  } & ToolSnsResponse) | ({
2813
+ tool_body_type: 'end_user_messaging';
2814
+ } & ToolEndUserMessagingResponse) | ({
2724
2815
  tool_body_type: 'rest_api';
2725
2816
  } & ToolRestapiResponse) | ({
2726
2817
  tool_body_type: 's3';
@@ -3154,6 +3245,12 @@ type EmailResponse = {
3154
3245
  */
3155
3246
  smtp_username?: string;
3156
3247
  };
3248
+ /**
3249
+ * ManualToolInvocationMMSCallResponse
3250
+ */
3251
+ type ManualToolInvocationMmsCallResponse = MmsCallResponse & {
3252
+ tool_call_type: 'mms_request';
3253
+ };
3157
3254
  /**
3158
3255
  * WorkflowLogResponse
3159
3256
  *
@@ -3529,7 +3626,7 @@ type ToolCloudWatchLogGroupResponse = CloudWatchLogGroupResponse & {
3529
3626
  */
3530
3627
  type CloudWatchQueryRequest = {
3531
3628
  /**
3532
- * Liquid template for the poll window end time, rendered with `{{ now }}` in unix milliseconds (e.g., "{{ now }}")
3629
+ * Liquid template for the poll window end time, rendered with `{{ now_msec }}` in unix milliseconds (e.g., "{{ now_msec }}")
3533
3630
  */
3534
3631
  end_time: string;
3535
3632
  /**
@@ -3537,7 +3634,7 @@ type CloudWatchQueryRequest = {
3537
3634
  */
3538
3635
  log_group_name: string;
3539
3636
  /**
3540
- * Liquid template for the poll window start time, rendered with `{{ now }}` in unix milliseconds (e.g., "{{ now | minutes_ago: 45 }}")
3637
+ * Liquid template for the poll window start time, rendered with `{{ now }}` in unix milliseconds (e.g., "{{ now_msec | minutes_ago: 45 }}")
3541
3638
  */
3542
3639
  start_time: string;
3543
3640
  };
@@ -3612,6 +3709,12 @@ type InteroperabilityContractListResponse = {
3612
3709
  data: Array<InteroperabilityContractResponse>;
3613
3710
  meta: PaginationMeta;
3614
3711
  };
3712
+ /**
3713
+ * ToolEndUserMessagingResponse
3714
+ */
3715
+ type ToolEndUserMessagingResponse = EndUserMessagingResponse & {
3716
+ tool_body_type: 'end_user_messaging';
3717
+ };
3615
3718
  /**
3616
3719
  * ActionStatusUpdaterListResponse
3617
3720
  *
@@ -3863,7 +3966,7 @@ type GenericTableColumnRequest = {
3863
3966
  */
3864
3967
  type CloudWatchQueryResponse = {
3865
3968
  /**
3866
- * Liquid template for the poll window end time, rendered with `{{ now }}` in unix milliseconds (e.g., "{{ now }}")
3969
+ * Liquid template for the poll window end time, rendered with `{{ now_msec }}` in unix milliseconds (e.g., "{{ now_msec }}")
3867
3970
  */
3868
3971
  end_time: string;
3869
3972
  /**
@@ -3871,7 +3974,7 @@ type CloudWatchQueryResponse = {
3871
3974
  */
3872
3975
  log_group_name: string;
3873
3976
  /**
3874
- * Liquid template for the poll window start time, rendered with `{{ now }}` in unix milliseconds (e.g., "{{ now | minutes_ago: 45 }}")
3977
+ * Liquid template for the poll window start time, rendered with `{{ now }}` in unix milliseconds (e.g., "{{ now_msec | minutes_ago: 45 }}")
3875
3978
  */
3876
3979
  start_time: string;
3877
3980
  };
@@ -4383,7 +4486,7 @@ type ActionResponseWritable = {
4383
4486
  */
4384
4487
  action_window_start?: number | null;
4385
4488
  /**
4386
- * Optional connected app — only valid for :sms and :email action types
4489
+ * Optional connected app — when set, the executor mints a per-recipient connected_app_form_url template variable; connected_app_route is required
4387
4490
  */
4388
4491
  connected_app_id?: string | null;
4389
4492
  /**
@@ -4419,6 +4522,58 @@ type ActionResponseWritable = {
4419
4522
  */
4420
4523
  trigger_template: string;
4421
4524
  };
4525
+ /**
4526
+ * EndUserMessagingRequest
4527
+ *
4528
+ * AWS End User Messaging tool configuration for sending MMS via the SendMediaMessage API. Request
4529
+ */
4530
+ type EndUserMessagingRequestWritable = {
4531
+ /**
4532
+ * AWS access key ID (used when auth_method is access_key)
4533
+ */
4534
+ access_key_id?: string | null;
4535
+ /**
4536
+ * IAM role ARN to assume in the customer's AWS account (used when auth_method is assume_role)
4537
+ */
4538
+ assume_role_arn?: string | null;
4539
+ /**
4540
+ * External ID for the STS AssumeRole call, unique per customer (auto-generated when auth_method is assume_role)
4541
+ */
4542
+ assume_role_external_id?: string | null;
4543
+ /**
4544
+ * AWS authentication method
4545
+ */
4546
+ auth_method: 'access_key' | 'iam_role' | 'assume_role';
4547
+ base_message?: ComplexTemplateConfigRequest;
4548
+ /**
4549
+ * AWS End User Messaging configuration set that routes delivery events to CloudWatch
4550
+ */
4551
+ configuration_set_name: string;
4552
+ /**
4553
+ * Custom sms-voice endpoint URL (e.g. http://localhost:8080 for the WireMock stub); leave blank for real AWS
4554
+ */
4555
+ endpoint_url?: string | null;
4556
+ /**
4557
+ * S3 bucket (same region as the sending number) where author media is re-staged for SendMediaMessage
4558
+ */
4559
+ media_bucket: string;
4560
+ /**
4561
+ * Custom S3 endpoint URL for media staging (e.g. http://localhost:4566 for LocalStack); leave blank for AWS S3 in the tool's region
4562
+ */
4563
+ media_endpoint_url?: string | null;
4564
+ /**
4565
+ * Origination phone number or identity in E.164 format (e.g., +15551234567); must be MMS-capable
4566
+ */
4567
+ phone_number: string;
4568
+ /**
4569
+ * AWS region (e.g., us-west-2)
4570
+ */
4571
+ region: string;
4572
+ /**
4573
+ * AWS secret access key (used when auth_method is access_key)
4574
+ */
4575
+ secret_access_key?: string | null;
4576
+ };
4422
4577
  /**
4423
4578
  * ToolSharePointRequest
4424
4579
  */
@@ -4436,6 +4591,8 @@ type ToolRequestWritable = {
4436
4591
  } & ToolEmailRequestWritable) | ({
4437
4592
  tool_body_type: 'sns';
4438
4593
  } & ToolSnsRequestWritable) | ({
4594
+ tool_body_type: 'end_user_messaging';
4595
+ } & ToolEndUserMessagingRequestWritable) | ({
4439
4596
  tool_body_type: 'rest_api';
4440
4597
  } & ToolRestapiRequestWritable) | ({
4441
4598
  tool_body_type: 's3';
@@ -5242,6 +5399,12 @@ type RunManuallyRequestWritable = {
5242
5399
  tool_call_type: 'DataActivationClientS3CallRequestWritable';
5243
5400
  } & DataActivationClientS3CallRequestWritable) | null;
5244
5401
  };
5402
+ /**
5403
+ * ToolEndUserMessagingRequest
5404
+ */
5405
+ type ToolEndUserMessagingRequestWritable = EndUserMessagingRequestWritable & {
5406
+ tool_body_type: 'end_user_messaging';
5407
+ };
5245
5408
  /**
5246
5409
  * DatalakeCloudStorageAwsRequest
5247
5410
  */
@@ -6430,7 +6593,7 @@ interface CreateActionStatusUpdaterRequest {
6430
6593
  datalake_id: string;
6431
6594
  sender_tool_ids?: string[] | null;
6432
6595
  message_config: TemplateConfig;
6433
- action_log_config?: TemplateConfig | null;
6596
+ action_log_config: TemplateConfig;
6434
6597
  events_output_schema?: Record<string, unknown> | null;
6435
6598
  pagination_context_output_schema?: Record<string, unknown> | null;
6436
6599
  updater_body: ActionStatusUpdaterCloudWatchQueryRequest | ActionStatusUpdaterRestCallRequest;
@@ -6565,15 +6728,22 @@ interface ApiDebugConfig {
6565
6728
  redactStrings?: readonly string[];
6566
6729
  }
6567
6730
  /**
6568
- * `sessionToken` and `apiKey` travel together on every request — Firebase's
6569
- * "API key + ID token" split, not an either/or. `apiKey` identifies the
6570
- * publishable client (and is what a server-side CORS check matches the
6731
+ * `sessionToken` and `apiKey` travel together on an authorized request —
6732
+ * Firebase's "API key + ID token" split, not an either/or. `apiKey` identifies
6733
+ * the publishable client (and is what a server-side CORS check matches the
6571
6734
  * request's `Origin` against); `sessionToken` (Bearer) is what actually
6572
6735
  * authorizes the call. Neither ever substitutes for the other.
6736
+ *
6737
+ * `sessionToken` is OPTIONAL: a key-only client — every deployed connected
6738
+ * app authenticating machine-to-machine on its tenant's publishable key —
6739
+ * constructs with just `{ baseUrl, apiKey }` and sends no `Authorization`
6740
+ * header at all (never a fabricated `Bearer ` with an empty token). It
6741
+ * reaches only the limited surface the publishable key permits; everything
6742
+ * else 401s server-side, which is the intended ceiling.
6573
6743
  */
6574
6744
  interface ApiConfig {
6575
6745
  baseUrl: string;
6576
- sessionToken: string;
6746
+ sessionToken?: string;
6577
6747
  apiKey: string;
6578
6748
  debug?: ApiDebugConfig;
6579
6749
  }