lua-cli 3.17.4 → 3.18.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.
@@ -12,7 +12,7 @@ import { ZodType } from 'zod';
12
12
  *
13
13
  * Intentionally a narrow, safe subset of the public `ChatMessageDto` — omits
14
14
  * sandbox-only overrides (`skillOverride`, `preprocessorOverride`, etc.),
15
- * webhook payloads, navigation hints, and persona override.
15
+ * navigation hints, and persona override.
16
16
  *
17
17
  * Either `prompt` or `messages` must be provided. When `prompt` is given, it is
18
18
  * converted into a single `{ role: 'user', content: [{ type: 'text', text: prompt }] }`
@@ -48,6 +48,13 @@ declare interface AgentInvocationInput {
48
48
  * a user-authenticated turn — the turn's user is always used, no impersonation.
49
49
  */
50
50
  userId?: string;
51
+ /**
52
+ * Raw payload from the trigger source (webhook body, trigger envelope).
53
+ * Surfaces on the invoked agent's `runtimeContext` as `webhookPayload` and
54
+ * flows to tool executions — turn-scoped, not persisted to memory. Listed in
55
+ * the original BAC-107 spec; wired through as part of PRO-186.
56
+ */
57
+ webhookPayload?: unknown;
51
58
  }
52
59
 
53
60
  /**
@@ -688,6 +695,158 @@ export declare const CDN: {
688
695
  */
689
696
  export declare type Channel = 'web' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'front' | 'messagebird' | 'api' | 'dev' | 'email' | string;
690
697
 
698
+ /** Channels accepted by the v1 unified send. Warm-only channels (teams,
699
+ * instagram, messenger) require a prior inbound conversation. */
700
+ export declare const CHANNEL_SEND_CHANNELS: readonly ["whatsapp", "sms", "email", "webchat", "teams", "instagram", "messenger"];
701
+
702
+ export declare const Channels: ChannelsApi;
703
+
704
+ /**
705
+ * Channels API — send outbound messages over any supported channel from inside
706
+ * a job, webhook, or skill tool.
707
+ *
708
+ * Use `Channels.send` for text messages on whatsapp/sms/email/webchat and other
709
+ * channels. Use the nested namespaces for channel-specific payloads.
710
+ *
711
+ * A successful send with a failed persistence write returns `{ delivered: true,
712
+ * persisted: false, warning: '...' }` — this is HTTP 200 and is NOT thrown.
713
+ *
714
+ * @example
715
+ * ```typescript
716
+ * // Send a text message over WhatsApp
717
+ * await Channels.send({
718
+ * channel: 'whatsapp',
719
+ * to: { phoneNumber: '+15551234567' },
720
+ * text: 'Your order has shipped!',
721
+ * });
722
+ *
723
+ * // Send a WhatsApp template
724
+ * await Channels.whatsapp.sendTemplate({
725
+ * to: { phoneNumber: '+15551234567' },
726
+ * templateName: 'order_shipped',
727
+ * languageCode: 'en',
728
+ * });
729
+ *
730
+ * // Send an email
731
+ * await Channels.email.send({
732
+ * to: { email: 'customer@example.com' },
733
+ * subject: 'Your order',
734
+ * html: '<p>Thanks for your order!</p>',
735
+ * });
736
+ * ```
737
+ */
738
+ export declare interface ChannelsApi {
739
+ /**
740
+ * Send a text message on any supported channel.
741
+ * Returns `ChannelSendOutput` — check `persisted` if memory durability matters.
742
+ *
743
+ * @example
744
+ * ```typescript
745
+ * const result = await Channels.send({
746
+ * channel: 'email',
747
+ * to: { userId: 'u-42' },
748
+ * text: 'Hi from Lua!',
749
+ * });
750
+ * if (!result.persisted) console.warn(result.warning);
751
+ * ```
752
+ */
753
+ send(input: ChannelSendInput): Promise<ChannelSendOutput>;
754
+ /** WhatsApp-specific send operations. */
755
+ whatsapp: {
756
+ /**
757
+ * Send a pre-approved WhatsApp Business template.
758
+ *
759
+ * @example
760
+ * ```typescript
761
+ * await Channels.whatsapp.sendTemplate({
762
+ * to: { phoneNumber: '+447551166594' },
763
+ * templateName: 'order_update',
764
+ * languageCode: 'en',
765
+ * components: [{ type: 'body', parameters: [{ type: 'text', text: 'ORD-99' }] }],
766
+ * });
767
+ * ```
768
+ */
769
+ sendTemplate(input: WhatsAppTemplateSendInput): Promise<ChannelSendOutput>;
770
+ };
771
+ /** Email-specific send operations. */
772
+ email: {
773
+ /**
774
+ * Send an email to a user or address.
775
+ *
776
+ * @example
777
+ * ```typescript
778
+ * await Channels.email.send({
779
+ * to: { email: 'alice@example.com' },
780
+ * subject: 'Welcome!',
781
+ * html: '<h1>Hello, Alice</h1>',
782
+ * });
783
+ * ```
784
+ */
785
+ send(input: EmailSendInput): Promise<ChannelSendOutput>;
786
+ };
787
+ }
788
+
789
+ export declare type ChannelSendChannel = (typeof CHANNEL_SEND_CHANNELS)[number];
790
+
791
+ /** Body of POST /developer/agents/:agentId/channels/send */
792
+ export declare interface ChannelSendInput {
793
+ channel: ChannelSendChannel;
794
+ to: ChannelSendTarget;
795
+ /** Message text; may contain `::: marker` component blocks — each channel
796
+ * renders them through its existing component pipeline. */
797
+ text: string;
798
+ options?: ChannelSendOptions;
799
+ }
800
+
801
+ export declare interface ChannelSendOptions {
802
+ /** Pin a specific channel config (must belong to the sending agent). */
803
+ channelIdentifier?: string;
804
+ /** WhatsApp-specific send options. */
805
+ whatsapp?: {
806
+ /**
807
+ * Behavior when the 24h customer-service window is CLOSED (PRO-98):
808
+ * - 'queue' (default): send the system message-request template, queue the
809
+ * text, and deliver it once the user replies.
810
+ * - 'fail': reject with a 400 so the caller can send their own approved
811
+ * template via Channels.whatsapp.sendTemplate.
812
+ * Overrides the channel config's `autoMessageRequest` default.
813
+ */
814
+ onClosedWindow?: 'queue' | 'fail';
815
+ };
816
+ }
817
+
818
+ /**
819
+ * Send result. `delivered` and `persisted` are independent: a vendor-accepted
820
+ * send whose memory write failed returns 200 with `persisted: false` plus a
821
+ * `warning` — never an error status for a delivered message.
822
+ */
823
+ export declare interface ChannelSendOutput {
824
+ delivered: boolean;
825
+ persisted: boolean;
826
+ /**
827
+ * True when the send was deferred to the WhatsApp message-request queue
828
+ * because the 24h window was closed (PRO-98). `delivered` is false until the
829
+ * user replies and the queued text flushes; persistence happens at flush.
830
+ */
831
+ queued?: boolean;
832
+ /** Lua userId the message was recorded against (resolved when omitted). */
833
+ userId?: string;
834
+ /** Channel-native recipient identifier actually used (phone, email, PSID…). */
835
+ identifier?: string;
836
+ /** Vendor message id when the channel returns one (e.g. SES MessageId). */
837
+ messageId?: string;
838
+ warning?: string;
839
+ }
840
+
841
+ /** Recipient — exactly one of the fields must be set. userId works on every
842
+ * channel (resolved via the user's channel history); raw identifiers only on
843
+ * cold-start-capable channels (whatsapp/sms → phoneNumber, email → email). */
844
+ export declare interface ChannelSendTarget {
845
+ userId?: string;
846
+ phoneNumber?: string;
847
+ email?: string;
848
+ }
849
+
691
850
  /**
692
851
  * Wire-format types for `GET /chat/history/:agentId` and the VM-sandbox
693
852
  * `User.getChatHistory()` API. Both paths return the same shape.
@@ -1017,6 +1176,30 @@ export declare function defineDevice(config: LuaDeviceConfig): LuaDevice;
1017
1176
  */
1018
1177
  export declare function defineDeviceTrigger(config: LuaDeviceTriggerConfig): LuaDeviceTrigger;
1019
1178
 
1179
+ /**
1180
+ * Define an SDK trigger primitive (PRO-95).
1181
+ *
1182
+ * A trigger wakes the agent on an external webhook event with declarative
1183
+ * verify → filter → transform shaping and no `execute`. Compiled, versioned,
1184
+ * and pushed like other code primitives; deploys via `lua push`.
1185
+ *
1186
+ * @example
1187
+ * ```typescript
1188
+ * import { defineTrigger } from 'lua-cli';
1189
+ * import { z } from 'zod';
1190
+ *
1191
+ * export const stripeTrigger = defineTrigger({
1192
+ * name: 'stripe-payments',
1193
+ * description: 'Fires on a successful Stripe payment',
1194
+ * inputSchema: z.object({ type: z.string() }),
1195
+ * verify: (ctx) => verifyStripeSignature(ctx.rawBody, ctx.headers['stripe-signature']),
1196
+ * filter: (ctx) => ctx.body.type === 'payment_intent.succeeded',
1197
+ * transform: (ctx) => `Payment received: ${ctx.body.data.object.amount}`,
1198
+ * });
1199
+ * ```
1200
+ */
1201
+ export declare function defineTrigger<T = any>(config: LuaTriggerConfig<T>): LuaTrigger<T>;
1202
+
1020
1203
  /**
1021
1204
  * Function-style LuaVoice definition. Equivalent to `new LuaVoice(config)`,
1022
1205
  * detected by the compiler via the `defineVoice(...)` AST pattern.
@@ -1085,6 +1268,29 @@ export declare interface DeviceTriggerConfig {
1085
1268
  }) => Promise<any>;
1086
1269
  }
1087
1270
 
1271
+ /** A single email attachment, referenced by URL — lua-email fetches the bytes
1272
+ * server-side and attaches them, keeping large files off the SDK→API hops. */
1273
+ declare interface EmailAttachmentInput {
1274
+ filename: string;
1275
+ contentType: string;
1276
+ url: string;
1277
+ }
1278
+
1279
+ /** Body of POST /developer/agents/:agentId/channels/email/send */
1280
+ export declare interface EmailSendInput {
1281
+ to: {
1282
+ userId?: string;
1283
+ email?: string;
1284
+ };
1285
+ subject?: string;
1286
+ text?: string;
1287
+ html?: string;
1288
+ cc?: string[];
1289
+ bcc?: string[];
1290
+ attachments?: EmailAttachmentInput[];
1291
+ options?: ChannelSendOptions;
1292
+ }
1293
+
1088
1294
  /**
1089
1295
  * Safe environment variable access function.
1090
1296
  * Gets injected at runtime with skill-specific environment variables.
@@ -1149,7 +1355,17 @@ declare interface GetJobsResponseData {
1149
1355
  */
1150
1356
  declare interface GovernanceConfig {
1151
1357
  mode: 'sdk' | 'api';
1152
- /** SDK mode — local in-memory policy rules */
1358
+ /**
1359
+ * SDK mode — a named governance-sdk preset composed as the base rule set. The platform builder
1360
+ * maps this to the SDK's preset factories (e.g. `securityBaseline()`), then layers any explicit
1361
+ * `rules`/`injection` on top. `'security'` = block dangerous tools + requireLevel(2).
1362
+ */
1363
+ preset?: 'security';
1364
+ /** SDK mode — prompt-injection scan on inputs (maps to the SDK's `createInjectionGuard`). */
1365
+ injection?: {
1366
+ threshold: number;
1367
+ };
1368
+ /** SDK mode — local in-memory policy rules layered on top of any `preset`. */
1153
1369
  rules?: {
1154
1370
  blockTools?: string[];
1155
1371
  requireApproval?: string[];
@@ -1829,6 +2045,7 @@ export declare class LuaAgent {
1829
2045
  private readonly modelSettings?;
1830
2046
  private readonly skills;
1831
2047
  private readonly webhooks;
2048
+ private readonly triggers;
1832
2049
  private readonly jobs;
1833
2050
  private readonly preProcessors;
1834
2051
  private readonly postProcessors;
@@ -1861,6 +2078,7 @@ export declare class LuaAgent {
1861
2078
  getModelSettings(): AgentModelSettings | undefined;
1862
2079
  getSkills(): LuaSkill[];
1863
2080
  getWebhooks(): LuaWebhook[];
2081
+ getTriggers(): LuaTrigger[];
1864
2082
  getJobs(): LuaJob[];
1865
2083
  getPreProcessors(): PreProcessor[];
1866
2084
  getPostProcessors(): PostProcessor[];
@@ -1890,6 +2108,8 @@ export declare interface LuaAgentConfig {
1890
2108
  skills?: LuaSkill[];
1891
2109
  /** Array of webhooks */
1892
2110
  webhooks?: LuaWebhook[];
2111
+ /** Array of SDK triggers (defineTrigger) — wake the agent on external events with verify/filter/transform */
2112
+ triggers?: LuaTrigger[];
1893
2113
  /** Array of scheduled jobs */
1894
2114
  jobs?: LuaJob[];
1895
2115
  /** Array of preprocessors (run before messages reach the agent) */
@@ -2417,6 +2637,74 @@ declare interface LuaToolCtx {
2417
2637
  };
2418
2638
  }
2419
2639
 
2640
+ /**
2641
+ * Lua Trigger class (PRO-95). Wakes an agent on an external webhook event with
2642
+ * declarative verify → filter → transform shaping and no `execute`.
2643
+ *
2644
+ * @example
2645
+ * ```typescript
2646
+ * import { LuaTrigger } from 'lua-cli';
2647
+ * import { z } from 'zod';
2648
+ *
2649
+ * export default new LuaTrigger({
2650
+ * name: 'stripe-payments',
2651
+ * description: 'Fires on a successful Stripe payment',
2652
+ * inputSchema: z.object({ type: z.string() }),
2653
+ * verify: (ctx) => verifyStripeSignature(ctx.rawBody, ctx.headers['stripe-signature']),
2654
+ * filter: (ctx) => ctx.body.type === 'payment_intent.succeeded',
2655
+ * transform: (ctx) => `Payment received: ${ctx.body.data.object.amount}`,
2656
+ * });
2657
+ * ```
2658
+ */
2659
+ export declare class LuaTrigger<T = any> {
2660
+ readonly name: string;
2661
+ readonly description: string;
2662
+ readonly source: 'webhook';
2663
+ readonly inputSchema?: ZodType;
2664
+ readonly verify?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
2665
+ readonly filter?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
2666
+ readonly transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | Promise<string | AgentInvocationInput>;
2667
+ constructor(config: LuaTriggerConfig<T>);
2668
+ getName(): string;
2669
+ getDescription(): string;
2670
+ }
2671
+
2672
+ /**
2673
+ * Lua Trigger configuration (PRO-95).
2674
+ *
2675
+ * A trigger wakes an agent on an external event with declarative shaping. It has
2676
+ * NO `execute` function — that's the defining feature. The only customization
2677
+ * surface is the three optional slots, run server-side per request:
2678
+ * - `verify` — false ⇒ HTTP 401, no invocation (put HMAC checks here)
2679
+ * - `filter` — false ⇒ HTTP 200, no invocation (intentionally ignore the event)
2680
+ * - `transform` — shapes the agent input; default is `body → message`
2681
+ *
2682
+ * For full request/response control (a custom HTTP response, side effects),
2683
+ * reach for `LuaWebhook` instead.
2684
+ */
2685
+ export declare interface LuaTriggerConfig<T = any> {
2686
+ /** Trigger name (required; used as the server-side identifier). */
2687
+ name: string;
2688
+ /** Short description (a dashboard note; NOT sent to the agent). */
2689
+ description: string;
2690
+ /** Event source discriminator. Only 'webhook' in v1; 'cron'/'event' are future. */
2691
+ source?: 'webhook';
2692
+ /** Optional Zod schema for the event body (types `ctx.body`). */
2693
+ inputSchema?: ZodType;
2694
+ /** Reject the event with HTTP 401 when this returns false. */
2695
+ verify?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
2696
+ /** Skip invocation (HTTP 200, no agent run) when this returns false. */
2697
+ filter?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
2698
+ /**
2699
+ * Shape the agent input. Return a `string` (the message) or a full
2700
+ * `AgentInvocationInput` (you own the turn). Returning null/undefined is an
2701
+ * error — use `filter` to skip. Omit to use the default `body → message`,
2702
+ * whose payload is capped at ~50k chars (like a no-code trigger); return a
2703
+ * transform to forward larger or hand-picked fields as the message.
2704
+ */
2705
+ transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | Promise<string | AgentInvocationInput>;
2706
+ }
2707
+
2420
2708
  /**
2421
2709
  * Code-defined voice agent. Pushed via `lua push`, attached to channels through
2422
2710
  * the owning `LuaAgent.voice` field. Auto-dispatched into LiveKit rooms when a
@@ -2466,6 +2754,7 @@ export declare class LuaVoice {
2466
2754
  readonly preemptiveGeneration: LuaVoiceConfig_2['preemptiveGeneration'];
2467
2755
  readonly interruption: LuaVoiceConfig_2['interruption'];
2468
2756
  readonly sttLanguage: LuaVoiceConfig_2['sttLanguage'];
2757
+ readonly excludeTools: LuaVoiceConfig_2['excludeTools'];
2469
2758
  readonly tools: ReadonlyArray<LuaTool<any> | LuaVoiceTool<any>>;
2470
2759
  readonly onEnter?: LuaVoiceConfig['onEnter'];
2471
2760
  readonly onUserTurnCompleted?: LuaVoiceConfig['onUserTurnCompleted'];
@@ -2866,6 +3155,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
2866
3155
  pronunciations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2867
3156
  persistTranscript: z.ZodOptional<z.ZodBoolean>;
2868
3157
  onToolFailureSay: z.ZodOptional<z.ZodString>;
3158
+ excludeTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2869
3159
  }, "strip", z.ZodTypeAny, {
2870
3160
  vad?: string;
2871
3161
  stt?: {
@@ -2959,6 +3249,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
2959
3249
  pronunciations?: Record<string, string>;
2960
3250
  persistTranscript?: boolean;
2961
3251
  onToolFailureSay?: string;
3252
+ excludeTools?: string[];
2962
3253
  }, {
2963
3254
  vad?: string;
2964
3255
  stt?: {
@@ -3052,6 +3343,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3052
3343
  pronunciations?: Record<string, string>;
3053
3344
  persistTranscript?: boolean;
3054
3345
  onToolFailureSay?: string;
3346
+ excludeTools?: string[];
3055
3347
  }>, {
3056
3348
  vad?: string;
3057
3349
  stt?: {
@@ -3145,6 +3437,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3145
3437
  pronunciations?: Record<string, string>;
3146
3438
  persistTranscript?: boolean;
3147
3439
  onToolFailureSay?: string;
3440
+ excludeTools?: string[];
3148
3441
  }, {
3149
3442
  vad?: string;
3150
3443
  stt?: {
@@ -3238,6 +3531,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3238
3531
  pronunciations?: Record<string, string>;
3239
3532
  persistTranscript?: boolean;
3240
3533
  onToolFailureSay?: string;
3534
+ excludeTools?: string[];
3241
3535
  }>;
3242
3536
 
3243
3537
  /**
@@ -3311,10 +3605,10 @@ export declare interface LuaVoiceToolConfig<TInput extends ZodType = ZodType> {
3311
3605
  * its second `execute` arg whether it runs over chat or voice; this
3312
3606
  * extension just adds the Phase-5 fields (currently optional + experimental).
3313
3607
  *
3314
- * `say()` is wired today and delegates to the active LiveKit `voice.AgentSession`.
3315
- * `disallowInterruptions()` and `handoff()` are optional placeholders for
3316
- * Phase 5 (BAC-213, the LuaVoice handoffs + test framework ticket).
3317
- * Marked optional both because they aren't implemented yet AND so this
3608
+ * `say()`, `transferToHuman()`, `endCall()` and `handoff()` are wired today
3609
+ * and delegate to the active LiveKit `voice.AgentSession`.
3610
+ * `disallowInterruptions()` is an optional placeholder the barge-in lock
3611
+ * plumbing isn't implemented yet. The delegates are marked optional so this
3318
3612
  * type stays structurally compatible with `LuaToolCtx` — that
3319
3613
  * compatibility is what lets a `LuaVoiceTool` (which extends `LuaTool`)
3320
3614
  * present `(ctx?: LuaVoiceToolCtx)` while satisfying the parent's
@@ -3376,9 +3670,24 @@ export declare interface LuaVoiceToolCtx {
3376
3670
  */
3377
3671
  disallowInterruptions?(): void;
3378
3672
  /**
3379
- * @experimental Reserved for Phase 5 (BAC-213). Optional because
3380
- * unimplemented handoffs require `chatCtx.copy(exclude_instructions=True)`
3381
- * + `update_agent` plumbing that's part of the multi-LuaVoice flow ticket.
3673
+ * Hand the live call to another LuaVoice on the same agent,
3674
+ * addressed by its `name`. The caller stays in the same room; only
3675
+ * the agent identity flips the receiving voice starts cold from
3676
+ * its own persona + greeting (no conversation history carries
3677
+ * over). Pass `context` to surface a structured payload to the
3678
+ * receiving voice on its first turn.
3679
+ *
3680
+ * In `lua voice test`, register reachable voices via
3681
+ * `runVoice({ handoffTargets })`; in production, any voice pushed
3682
+ * on the same agent is reachable. An unknown name degrades
3683
+ * in-call (spoken fallback, no crash).
3684
+ *
3685
+ * @example
3686
+ * ```typescript
3687
+ * await ctx.voice?.handoff('billing-line', {
3688
+ * context: { reason: 'invoice question', orderId: input.orderId },
3689
+ * });
3690
+ * ```
3382
3691
  */
3383
3692
  handoff?(otherVoiceName: string, opts?: {
3384
3693
  context?: Record<string, unknown>;
@@ -4513,7 +4822,12 @@ export declare interface SendTemplateResponse {
4513
4822
  }
4514
4823
 
4515
4824
  export declare interface SendTemplateValues {
4516
- header?: Record<string, string>;
4825
+ header?: Record<string, string> & {
4826
+ image_url?: string;
4827
+ video_url?: string;
4828
+ document_url?: string;
4829
+ document_filename?: string;
4830
+ };
4517
4831
  body?: Record<string, string>;
4518
4832
  buttons?: SendTemplateButtonValue[];
4519
4833
  }
@@ -4684,6 +4998,30 @@ export declare enum ToolFlag {
4684
4998
  DISALLOW_INTERRUPTION = "disallow_interruption"
4685
4999
  }
4686
5000
 
5001
+ /**
5002
+ * Context delivered to a trigger's verify / filter / transform slots.
5003
+ *
5004
+ * Unlike a webhook event, `rawBody` carries the EXACT unparsed request bytes
5005
+ * (utf8) — HMAC signature schemes (Stripe `t=…,v1=…`, GitHub `sha256=…`, Slack
5006
+ * `v0:…`) are computed over the wire bytes, which `JSON.stringify(body)` does
5007
+ * not reproduce. `headers` keys arrive lowercased (Express), e.g.
5008
+ * `ctx.headers['x-hub-signature-256']`.
5009
+ */
5010
+ export declare interface TriggerContext<T = any> {
5011
+ /** Parsed request body (typed by `inputSchema` when provided). */
5012
+ body: T;
5013
+ /** Exact unparsed request bytes as a utf8 string — for HMAC signature checks. */
5014
+ rawBody?: string;
5015
+ /** Request headers (lowercased keys). */
5016
+ headers: Record<string, any>;
5017
+ /** Parsed query-string parameters. */
5018
+ query: Record<string, any>;
5019
+ /** This trigger's name. */
5020
+ triggerName: string;
5021
+ /** Event source discriminator ('webhook' in v1). */
5022
+ source: string;
5023
+ }
5024
+
4687
5025
  /**
4688
5026
  * Response from updating custom data entry.
4689
5027
  */
@@ -4911,6 +5249,18 @@ export declare interface VoiceApi {
4911
5249
  * ```
4912
5250
  */
4913
5251
  call(input: VoiceDispatchInput): Promise<VoiceDispatchOutput>;
5252
+ /**
5253
+ * Create a voice room + client access token for your own frontend
5254
+ * (standard livekit-client). The session runs under a synthetic identity;
5255
+ * pass `userId` to scope conversation memory + transcript to your end user.
5256
+ *
5257
+ * @example
5258
+ * ```typescript
5259
+ * const { url, roomName, token } = await Voice.createSession({ userId: 'u-42' });
5260
+ * // hand url + token to livekit-client's room.connect(url, token)
5261
+ * ```
5262
+ */
5263
+ createSession(input?: VoiceSessionInput): Promise<VoiceSessionOutput>;
4914
5264
  }
4915
5265
 
4916
5266
  /**
@@ -5022,6 +5372,28 @@ string | {
5022
5372
  returnToken?: boolean;
5023
5373
  };
5024
5374
 
5375
+ /** Input for creating a developer voice room (custom frontend). */
5376
+ declare interface VoiceSessionInput {
5377
+ /** Voice channel for the session. Defaults to 'web'. */
5378
+ channel?: string;
5379
+ /** External end-user id, for conversation-memory + transcript scoping. */
5380
+ userId?: string;
5381
+ /** LuaVoice id to run, overriding the agent's channel-bound voice. */
5382
+ voiceId?: string;
5383
+ displayName?: string;
5384
+ }
5385
+
5386
+ /** Room + client token a livekit-client frontend connects with. */
5387
+ declare interface VoiceSessionOutput {
5388
+ /** LiveKit server URL (wss://). */
5389
+ url: string;
5390
+ roomName: string;
5391
+ /** Client access token (LiveKit AccessToken JWT). */
5392
+ token: string;
5393
+ participantIdentity: string;
5394
+ agentName: string;
5395
+ }
5396
+
5025
5397
  /**
5026
5398
  * Webhook request information from channel integrations.
5027
5399
  * Contains the raw webhook payload from the channel provider.
@@ -5085,13 +5457,14 @@ declare interface WhatsAppTemplateFooterComponent {
5085
5457
 
5086
5458
  declare interface WhatsAppTemplateHeaderComponent {
5087
5459
  type: 'HEADER';
5088
- format: 'TEXT';
5089
- text: string;
5460
+ format: 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT';
5461
+ text?: string;
5090
5462
  example?: {
5091
- header_text_named_params: Array<{
5463
+ header_text_named_params?: Array<{
5092
5464
  param_name: string;
5093
5465
  example: string;
5094
5466
  }>;
5467
+ header_handle?: string[];
5095
5468
  };
5096
5469
  }
5097
5470
 
@@ -5106,6 +5479,21 @@ declare interface WhatsAppTemplateQuickReplyButton {
5106
5479
  text: string;
5107
5480
  }
5108
5481
 
5482
+ /** Body of POST /developer/agents/:agentId/channels/whatsapp/template */
5483
+ export declare interface WhatsAppTemplateSendInput {
5484
+ to: {
5485
+ userId?: string;
5486
+ phoneNumber?: string;
5487
+ };
5488
+ templateName: string;
5489
+ languageCode?: string;
5490
+ /** Meta template components (header/body/buttons parameter values). */
5491
+ components?: Array<Record<string, unknown>>;
5492
+ /** Text persisted to the agent's memory as what this template said. */
5493
+ messageContext?: string;
5494
+ options?: ChannelSendOptions;
5495
+ }
5496
+
5109
5497
  export declare type WhatsAppTemplateStatus = 'APPROVED' | 'REJECTED' | 'PENDING';
5110
5498
 
5111
5499
  declare interface WhatsAppTemplateUrlButton {