lua-cli 3.29.0 → 3.30.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.
@@ -934,6 +934,31 @@ export declare interface ChannelsApi {
934
934
  */
935
935
  send(input: EmailSendInput): Promise<ChannelSendOutput>;
936
936
  };
937
+ /**
938
+ * Read the delivery status of one outbound message.
939
+ *
940
+ * Pass the `deliveryId` any send returned. The record moves
941
+ * `queued -> accepted -> sent -> delivered -> read`, or terminates on
942
+ * `failed`, and a failure carries a canonical `error.category`, the vendor
943
+ * code and a remediation link.
944
+ *
945
+ * @example
946
+ * ```typescript
947
+ * const sent = await Channels.send({ channel: 'whatsapp', to: { phoneNumber: '+15551234567' }, text: 'Hi' });
948
+ * const delivery = await Channels.getStatus(sent.deliveryId);
949
+ * if (delivery.status === 'failed') console.error(delivery.error?.category, delivery.error?.title);
950
+ * ```
951
+ */
952
+ getStatus(deliveryId: string): Promise<DeliveryView>;
953
+ /**
954
+ * List the agent's recent deliveries, newest first.
955
+ *
956
+ * @example
957
+ * ```typescript
958
+ * const failures = await Channels.listDeliveries({ status: 'failed', since: '2026-09-01T00:00:00Z', limit: 50 });
959
+ * ```
960
+ */
961
+ listDeliveries(filter?: DeliveryListFilter): Promise<DeliveryView[]>;
937
962
  }
938
963
 
939
964
  export declare type ChannelSendChannel = (typeof CHANNEL_SEND_CHANNELS)[number];
@@ -971,6 +996,18 @@ export declare interface ChannelSendOptions {
971
996
  * `warning` — never an error status for a delivered message.
972
997
  */
973
998
  export declare interface ChannelSendOutput {
999
+ /** Delivery record id. Stable across the send's whole lifecycle; query it for status. */
1000
+ deliveryId: string;
1001
+ /**
1002
+ * Where the delivery stands the moment the send returns. `queued` means the
1003
+ * WhatsApp window was closed and the text flushes when the user replies.
1004
+ * Receipts move it further (delivered, read, failed) after this call.
1005
+ *
1006
+ * A live send returns `queued`, `accepted` or `sent`. Replaying an
1007
+ * `X-Idempotency-Key` returns wherever the first send's delivery has since
1008
+ * got to, so any status is possible there.
1009
+ */
1010
+ status: DeliveryStatus;
974
1011
  delivered: boolean;
975
1012
  /** False for conversation-scoped sends: a shared conversation has no single
976
1013
  * user to attribute the message to, so nothing is written to agent memory. */
@@ -1543,6 +1580,98 @@ declare interface DeleteProductResponse {
1543
1580
  deleted: boolean;
1544
1581
  }
1545
1582
 
1583
+ /** Canonical, cross-vendor failure reason. Vendor codes map onto these. */
1584
+ declare const DELIVERY_ERROR_CATEGORIES: readonly ["window_closed", "unreachable", "billing", "opted_out", "throttled", "auth", "template", "media", "invalid_request", "compliance", "experiment", "provider", "unknown"];
1585
+
1586
+ declare const DELIVERY_ORIGINS: readonly ["agent_reply", "channels_send", "template", "system_template", "queued_flush", "admin_template", "notification", "unknown"];
1587
+
1588
+ declare const DELIVERY_PROVIDERS: readonly ["meta", "vonage", "bird", "ses", "agentmail", "slack", "front", "teams", "pusher"];
1589
+
1590
+ /**
1591
+ * Outbound delivery record contracts.
1592
+ *
1593
+ * One outbound message is one delivery document moving through a monotone
1594
+ * status rank with a single terminal failure. Vendor callbacks are normalised
1595
+ * into `ProviderStatusUpdate` by a per-provider mapper, so vendor vocabulary
1596
+ * stops at the mapper and everything downstream speaks these types.
1597
+ */
1598
+ declare const DELIVERY_STATUSES: readonly ["queued", "accepted", "sent", "delivered", "read", "failed", "expired"];
1599
+
1600
+ export declare interface DeliveryError {
1601
+ category: DeliveryErrorCategory;
1602
+ provider: DeliveryProvider;
1603
+ /** Vendor code as a string. '131042', '1240', 'Permanent/General'. */
1604
+ code: string;
1605
+ title: string;
1606
+ detail?: string;
1607
+ href?: string;
1608
+ retryable: boolean;
1609
+ owner: DeliveryErrorOwner;
1610
+ }
1611
+
1612
+ export declare type DeliveryErrorCategory = (typeof DELIVERY_ERROR_CATEGORIES)[number];
1613
+
1614
+ /** Who has to act on a failure. Drives the operator surface, not retry logic. */
1615
+ declare type DeliveryErrorOwner = 'customer' | 'recipient' | 'lua' | 'vendor';
1616
+
1617
+ declare type DeliveryEventSource = 'send' | 'callback' | 'sweep';
1618
+
1619
+ declare interface DeliveryEventView {
1620
+ status: DeliveryStatus;
1621
+ at: string;
1622
+ source: DeliveryEventSource;
1623
+ }
1624
+
1625
+ /** Query filter accepted by the delivery list read APIs. */
1626
+ export declare interface DeliveryListFilter {
1627
+ userId?: string;
1628
+ status?: DeliveryStatus;
1629
+ channel?: string;
1630
+ /** Only deliveries created at or after this instant. */
1631
+ since?: string | Date;
1632
+ /** 1..200, defaults to 50. */
1633
+ limit?: number;
1634
+ }
1635
+
1636
+ declare type DeliveryOrigin = (typeof DELIVERY_ORIGINS)[number];
1637
+
1638
+ /** Vendor-reported cost metadata. Meta only today. */
1639
+ declare interface DeliveryPricing {
1640
+ billable: boolean;
1641
+ category?: string;
1642
+ model?: string;
1643
+ }
1644
+
1645
+ declare type DeliveryProvider = (typeof DELIVERY_PROVIDERS)[number];
1646
+
1647
+ export declare type DeliveryStatus = (typeof DELIVERY_STATUSES)[number];
1648
+
1649
+ /** Wire shape of a delivery as returned by read APIs (dates as ISO strings). */
1650
+ export declare interface DeliveryView {
1651
+ id: string;
1652
+ agentId: string;
1653
+ userId?: string;
1654
+ /** `ChannelSendChannel | 'rcs' | 'messagebird' | 'slack' | 'front' | 'webchat' | 'sms'`. */
1655
+ channel: string;
1656
+ provider: DeliveryProvider;
1657
+ channelIdentifier: string;
1658
+ recipient: string;
1659
+ providerMessageId?: string;
1660
+ conversationMessageId?: string;
1661
+ origin: DeliveryOrigin;
1662
+ templateName?: string;
1663
+ idempotencyKey?: string;
1664
+ status: DeliveryStatus;
1665
+ error?: DeliveryError;
1666
+ events: DeliveryEventView[];
1667
+ pricing?: DeliveryPricing;
1668
+ createdAt: string;
1669
+ updatedAt: string;
1670
+ deliveredAt?: string;
1671
+ readAt?: string;
1672
+ failedAt?: string;
1673
+ }
1674
+
1546
1675
  /** Configuration for a single device command (agent → device) */
1547
1676
  export declare interface DeviceCommandConfig {
1548
1677
  /** Description of what this command does */
@@ -1840,6 +1969,7 @@ declare abstract class HttpClient {
1840
1969
  * cannot be recovered after an ambiguous network or server failure.
1841
1970
  */
1842
1971
  protected httpPostOnce<T>(url: string, data?: any, headers?: Record<string, string>): Promise<ApiResponse<T>>;
1972
+ protected httpPostCoreDrainRetry<T>(url: string, data?: any, headers?: Record<string, string>): Promise<ApiResponse<T>>;
1843
1973
  /**
1844
1974
  * Performs an HTTP PUT request
1845
1975
  * @param url - The relative URL path to request (will be appended to baseUrl)
@@ -3484,14 +3614,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3484
3614
  */
3485
3615
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3486
3616
  }, "strip", z.ZodTypeAny, {
3617
+ provider?: "deepgram" | "elevenlabs";
3487
3618
  options?: Record<string, unknown>;
3488
3619
  kind?: "plugin";
3489
- provider?: "deepgram" | "elevenlabs";
3490
3620
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3491
3621
  }, {
3622
+ provider?: "deepgram" | "elevenlabs";
3492
3623
  options?: Record<string, unknown>;
3493
3624
  kind?: "plugin";
3494
- provider?: "deepgram" | "elevenlabs";
3495
3625
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3496
3626
  }>, z.ZodObject<{
3497
3627
  kind: z.ZodLiteral<"realtime">;
@@ -3504,13 +3634,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3504
3634
  */
3505
3635
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3506
3636
  }, "strip", z.ZodTypeAny, {
3637
+ provider?: "google" | "xai" | "openai";
3507
3638
  options?: Record<string, unknown>;
3508
3639
  kind?: "realtime";
3509
- provider?: "google" | "xai" | "openai";
3510
3640
  }, {
3641
+ provider?: "google" | "xai" | "openai";
3511
3642
  options?: Record<string, unknown>;
3512
3643
  kind?: "realtime";
3513
- provider?: "google" | "xai" | "openai";
3514
3644
  }>]>;
3515
3645
  stt: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3516
3646
  kind: z.ZodLiteral<"inference">;
@@ -3550,14 +3680,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3550
3680
  */
3551
3681
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3552
3682
  }, "strip", z.ZodTypeAny, {
3683
+ provider?: "deepgram" | "elevenlabs";
3553
3684
  options?: Record<string, unknown>;
3554
3685
  kind?: "plugin";
3555
- provider?: "deepgram" | "elevenlabs";
3556
3686
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3557
3687
  }, {
3688
+ provider?: "deepgram" | "elevenlabs";
3558
3689
  options?: Record<string, unknown>;
3559
3690
  kind?: "plugin";
3560
- provider?: "deepgram" | "elevenlabs";
3561
3691
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3562
3692
  }>, z.ZodObject<{
3563
3693
  kind: z.ZodLiteral<"realtime">;
@@ -3570,13 +3700,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3570
3700
  */
3571
3701
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3572
3702
  }, "strip", z.ZodTypeAny, {
3703
+ provider?: "google" | "xai" | "openai";
3573
3704
  options?: Record<string, unknown>;
3574
3705
  kind?: "realtime";
3575
- provider?: "google" | "xai" | "openai";
3576
3706
  }, {
3707
+ provider?: "google" | "xai" | "openai";
3577
3708
  options?: Record<string, unknown>;
3578
3709
  kind?: "realtime";
3579
- provider?: "google" | "xai" | "openai";
3580
3710
  }>]>>;
3581
3711
  tts: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3582
3712
  kind: z.ZodLiteral<"inference">;
@@ -3616,14 +3746,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3616
3746
  */
3617
3747
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3618
3748
  }, "strip", z.ZodTypeAny, {
3749
+ provider?: "deepgram" | "elevenlabs";
3619
3750
  options?: Record<string, unknown>;
3620
3751
  kind?: "plugin";
3621
- provider?: "deepgram" | "elevenlabs";
3622
3752
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3623
3753
  }, {
3754
+ provider?: "deepgram" | "elevenlabs";
3624
3755
  options?: Record<string, unknown>;
3625
3756
  kind?: "plugin";
3626
- provider?: "deepgram" | "elevenlabs";
3627
3757
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3628
3758
  }>, z.ZodObject<{
3629
3759
  kind: z.ZodLiteral<"realtime">;
@@ -3636,13 +3766,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3636
3766
  */
3637
3767
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3638
3768
  }, "strip", z.ZodTypeAny, {
3769
+ provider?: "google" | "xai" | "openai";
3639
3770
  options?: Record<string, unknown>;
3640
3771
  kind?: "realtime";
3641
- provider?: "google" | "xai" | "openai";
3642
3772
  }, {
3773
+ provider?: "google" | "xai" | "openai";
3643
3774
  options?: Record<string, unknown>;
3644
3775
  kind?: "realtime";
3645
- provider?: "google" | "xai" | "openai";
3646
3776
  }>]>>;
3647
3777
  vad: z.ZodOptional<z.ZodString>;
3648
3778
  vadOptions: z.ZodOptional<z.ZodObject<{
@@ -3808,14 +3938,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3808
3938
  kind?: "inference";
3809
3939
  model?: string;
3810
3940
  } | {
3941
+ provider?: "deepgram" | "elevenlabs";
3811
3942
  options?: Record<string, unknown>;
3812
3943
  kind?: "plugin";
3813
- provider?: "deepgram" | "elevenlabs";
3814
3944
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3815
3945
  } | {
3946
+ provider?: "google" | "xai" | "openai";
3816
3947
  options?: Record<string, unknown>;
3817
3948
  kind?: "realtime";
3818
- provider?: "google" | "xai" | "openai";
3819
3949
  };
3820
3950
  volume?: number;
3821
3951
  llm?: {
@@ -3824,14 +3954,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3824
3954
  kind?: "inference";
3825
3955
  model?: string;
3826
3956
  } | {
3957
+ provider?: "deepgram" | "elevenlabs";
3827
3958
  options?: Record<string, unknown>;
3828
3959
  kind?: "plugin";
3829
- provider?: "deepgram" | "elevenlabs";
3830
3960
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3831
3961
  } | {
3962
+ provider?: "google" | "xai" | "openai";
3832
3963
  options?: Record<string, unknown>;
3833
3964
  kind?: "realtime";
3834
- provider?: "google" | "xai" | "openai";
3835
3965
  };
3836
3966
  tts?: {
3837
3967
  voice?: string;
@@ -3839,14 +3969,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3839
3969
  kind?: "inference";
3840
3970
  model?: string;
3841
3971
  } | {
3972
+ provider?: "deepgram" | "elevenlabs";
3842
3973
  options?: Record<string, unknown>;
3843
3974
  kind?: "plugin";
3844
- provider?: "deepgram" | "elevenlabs";
3845
3975
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3846
3976
  } | {
3977
+ provider?: "google" | "xai" | "openai";
3847
3978
  options?: Record<string, unknown>;
3848
3979
  kind?: "realtime";
3849
- provider?: "google" | "xai" | "openai";
3850
3980
  };
3851
3981
  vadOptions?: {
3852
3982
  minSpeechDuration?: number;
@@ -3902,14 +4032,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3902
4032
  kind?: "inference";
3903
4033
  model?: string;
3904
4034
  } | {
4035
+ provider?: "deepgram" | "elevenlabs";
3905
4036
  options?: Record<string, unknown>;
3906
4037
  kind?: "plugin";
3907
- provider?: "deepgram" | "elevenlabs";
3908
4038
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3909
4039
  } | {
4040
+ provider?: "google" | "xai" | "openai";
3910
4041
  options?: Record<string, unknown>;
3911
4042
  kind?: "realtime";
3912
- provider?: "google" | "xai" | "openai";
3913
4043
  };
3914
4044
  volume?: number;
3915
4045
  llm?: {
@@ -3918,14 +4048,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3918
4048
  kind?: "inference";
3919
4049
  model?: string;
3920
4050
  } | {
4051
+ provider?: "deepgram" | "elevenlabs";
3921
4052
  options?: Record<string, unknown>;
3922
4053
  kind?: "plugin";
3923
- provider?: "deepgram" | "elevenlabs";
3924
4054
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3925
4055
  } | {
4056
+ provider?: "google" | "xai" | "openai";
3926
4057
  options?: Record<string, unknown>;
3927
4058
  kind?: "realtime";
3928
- provider?: "google" | "xai" | "openai";
3929
4059
  };
3930
4060
  tts?: {
3931
4061
  voice?: string;
@@ -3933,14 +4063,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3933
4063
  kind?: "inference";
3934
4064
  model?: string;
3935
4065
  } | {
4066
+ provider?: "deepgram" | "elevenlabs";
3936
4067
  options?: Record<string, unknown>;
3937
4068
  kind?: "plugin";
3938
- provider?: "deepgram" | "elevenlabs";
3939
4069
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3940
4070
  } | {
4071
+ provider?: "google" | "xai" | "openai";
3941
4072
  options?: Record<string, unknown>;
3942
4073
  kind?: "realtime";
3943
- provider?: "google" | "xai" | "openai";
3944
4074
  };
3945
4075
  vadOptions?: {
3946
4076
  minSpeechDuration?: number;
@@ -3996,14 +4126,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3996
4126
  kind?: "inference";
3997
4127
  model?: string;
3998
4128
  } | {
4129
+ provider?: "deepgram" | "elevenlabs";
3999
4130
  options?: Record<string, unknown>;
4000
4131
  kind?: "plugin";
4001
- provider?: "deepgram" | "elevenlabs";
4002
4132
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4003
4133
  } | {
4134
+ provider?: "google" | "xai" | "openai";
4004
4135
  options?: Record<string, unknown>;
4005
4136
  kind?: "realtime";
4006
- provider?: "google" | "xai" | "openai";
4007
4137
  };
4008
4138
  volume?: number;
4009
4139
  llm?: {
@@ -4012,14 +4142,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4012
4142
  kind?: "inference";
4013
4143
  model?: string;
4014
4144
  } | {
4145
+ provider?: "deepgram" | "elevenlabs";
4015
4146
  options?: Record<string, unknown>;
4016
4147
  kind?: "plugin";
4017
- provider?: "deepgram" | "elevenlabs";
4018
4148
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4019
4149
  } | {
4150
+ provider?: "google" | "xai" | "openai";
4020
4151
  options?: Record<string, unknown>;
4021
4152
  kind?: "realtime";
4022
- provider?: "google" | "xai" | "openai";
4023
4153
  };
4024
4154
  tts?: {
4025
4155
  voice?: string;
@@ -4027,14 +4157,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4027
4157
  kind?: "inference";
4028
4158
  model?: string;
4029
4159
  } | {
4160
+ provider?: "deepgram" | "elevenlabs";
4030
4161
  options?: Record<string, unknown>;
4031
4162
  kind?: "plugin";
4032
- provider?: "deepgram" | "elevenlabs";
4033
4163
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4034
4164
  } | {
4165
+ provider?: "google" | "xai" | "openai";
4035
4166
  options?: Record<string, unknown>;
4036
4167
  kind?: "realtime";
4037
- provider?: "google" | "xai" | "openai";
4038
4168
  };
4039
4169
  vadOptions?: {
4040
4170
  minSpeechDuration?: number;
@@ -4090,14 +4220,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4090
4220
  kind?: "inference";
4091
4221
  model?: string;
4092
4222
  } | {
4223
+ provider?: "deepgram" | "elevenlabs";
4093
4224
  options?: Record<string, unknown>;
4094
4225
  kind?: "plugin";
4095
- provider?: "deepgram" | "elevenlabs";
4096
4226
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4097
4227
  } | {
4228
+ provider?: "google" | "xai" | "openai";
4098
4229
  options?: Record<string, unknown>;
4099
4230
  kind?: "realtime";
4100
- provider?: "google" | "xai" | "openai";
4101
4231
  };
4102
4232
  volume?: number;
4103
4233
  llm?: {
@@ -4106,14 +4236,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4106
4236
  kind?: "inference";
4107
4237
  model?: string;
4108
4238
  } | {
4239
+ provider?: "deepgram" | "elevenlabs";
4109
4240
  options?: Record<string, unknown>;
4110
4241
  kind?: "plugin";
4111
- provider?: "deepgram" | "elevenlabs";
4112
4242
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4113
4243
  } | {
4244
+ provider?: "google" | "xai" | "openai";
4114
4245
  options?: Record<string, unknown>;
4115
4246
  kind?: "realtime";
4116
- provider?: "google" | "xai" | "openai";
4117
4247
  };
4118
4248
  tts?: {
4119
4249
  voice?: string;
@@ -4121,14 +4251,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4121
4251
  kind?: "inference";
4122
4252
  model?: string;
4123
4253
  } | {
4254
+ provider?: "deepgram" | "elevenlabs";
4124
4255
  options?: Record<string, unknown>;
4125
4256
  kind?: "plugin";
4126
- provider?: "deepgram" | "elevenlabs";
4127
4257
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4128
4258
  } | {
4259
+ provider?: "google" | "xai" | "openai";
4129
4260
  options?: Record<string, unknown>;
4130
4261
  kind?: "realtime";
4131
- provider?: "google" | "xai" | "openai";
4132
4262
  };
4133
4263
  vadOptions?: {
4134
4264
  minSpeechDuration?: number;