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.
@@ -157,6 +157,7 @@ declare class LuaVoice {
157
157
  readonly preemptiveGeneration: LuaVoiceConfig['preemptiveGeneration'];
158
158
  readonly interruption: LuaVoiceConfig['interruption'];
159
159
  readonly sttLanguage: LuaVoiceConfig['sttLanguage'];
160
+ readonly excludeTools: LuaVoiceConfig['excludeTools'];
160
161
  readonly tools: ReadonlyArray<LuaTool<any> | LuaVoiceTool<any>>;
161
162
  readonly onEnter?: LuaVoiceConfig_2['onEnter'];
162
163
  readonly onUserTurnCompleted?: LuaVoiceConfig_2['onUserTurnCompleted'];
@@ -557,6 +558,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
557
558
  pronunciations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
558
559
  persistTranscript: z.ZodOptional<z.ZodBoolean>;
559
560
  onToolFailureSay: z.ZodOptional<z.ZodString>;
561
+ excludeTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
560
562
  }, "strip", z.ZodTypeAny, {
561
563
  vad?: string;
562
564
  stt?: {
@@ -650,6 +652,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
650
652
  pronunciations?: Record<string, string>;
651
653
  persistTranscript?: boolean;
652
654
  onToolFailureSay?: string;
655
+ excludeTools?: string[];
653
656
  }, {
654
657
  vad?: string;
655
658
  stt?: {
@@ -743,6 +746,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
743
746
  pronunciations?: Record<string, string>;
744
747
  persistTranscript?: boolean;
745
748
  onToolFailureSay?: string;
749
+ excludeTools?: string[];
746
750
  }>, {
747
751
  vad?: string;
748
752
  stt?: {
@@ -836,6 +840,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
836
840
  pronunciations?: Record<string, string>;
837
841
  persistTranscript?: boolean;
838
842
  onToolFailureSay?: string;
843
+ excludeTools?: string[];
839
844
  }, {
840
845
  vad?: string;
841
846
  stt?: {
@@ -929,6 +934,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
929
934
  pronunciations?: Record<string, string>;
930
935
  persistTranscript?: boolean;
931
936
  onToolFailureSay?: string;
937
+ excludeTools?: string[];
932
938
  }>;
933
939
 
934
940
  /**
@@ -1002,10 +1008,10 @@ declare interface LuaVoiceToolConfig<TInput extends ZodType = ZodType> {
1002
1008
  * its second `execute` arg whether it runs over chat or voice; this
1003
1009
  * extension just adds the Phase-5 fields (currently optional + experimental).
1004
1010
  *
1005
- * `say()` is wired today and delegates to the active LiveKit `voice.AgentSession`.
1006
- * `disallowInterruptions()` and `handoff()` are optional placeholders for
1007
- * Phase 5 (BAC-213, the LuaVoice handoffs + test framework ticket).
1008
- * Marked optional both because they aren't implemented yet AND so this
1011
+ * `say()`, `transferToHuman()`, `endCall()` and `handoff()` are wired today
1012
+ * and delegate to the active LiveKit `voice.AgentSession`.
1013
+ * `disallowInterruptions()` is an optional placeholder the barge-in lock
1014
+ * plumbing isn't implemented yet. The delegates are marked optional so this
1009
1015
  * type stays structurally compatible with `LuaToolCtx` — that
1010
1016
  * compatibility is what lets a `LuaVoiceTool` (which extends `LuaTool`)
1011
1017
  * present `(ctx?: LuaVoiceToolCtx)` while satisfying the parent's
@@ -1067,9 +1073,24 @@ declare interface LuaVoiceToolCtx {
1067
1073
  */
1068
1074
  disallowInterruptions?(): void;
1069
1075
  /**
1070
- * @experimental Reserved for Phase 5 (BAC-213). Optional because
1071
- * unimplemented handoffs require `chatCtx.copy(exclude_instructions=True)`
1072
- * + `update_agent` plumbing that's part of the multi-LuaVoice flow ticket.
1076
+ * Hand the live call to another LuaVoice on the same agent,
1077
+ * addressed by its `name`. The caller stays in the same room; only
1078
+ * the agent identity flips the receiving voice starts cold from
1079
+ * its own persona + greeting (no conversation history carries
1080
+ * over). Pass `context` to surface a structured payload to the
1081
+ * receiving voice on its first turn.
1082
+ *
1083
+ * In `lua voice test`, register reachable voices via
1084
+ * `runVoice({ handoffTargets })`; in production, any voice pushed
1085
+ * on the same agent is reachable. An unknown name degrades
1086
+ * in-call (spoken fallback, no crash).
1087
+ *
1088
+ * @example
1089
+ * ```typescript
1090
+ * await ctx.voice?.handoff('billing-line', {
1091
+ * context: { reason: 'invoice question', orderId: input.orderId },
1092
+ * });
1093
+ * ```
1073
1094
  */
1074
1095
  handoff?(otherVoiceName: string, opts?: {
1075
1096
  context?: Record<string, unknown>;
@@ -3832,7 +3832,7 @@ ZodNaN.create = (params) => {
3832
3832
  ...processCreateParams(params)
3833
3833
  });
3834
3834
  };
3835
- var BRAND = Symbol("zod_brand");
3835
+ var BRAND = /* @__PURE__ */ Symbol("zod_brand");
3836
3836
  var ZodBranded = class extends ZodType {
3837
3837
  _parse(input) {
3838
3838
  const { ctx } = this._processInputParams(input);
@@ -4046,7 +4046,7 @@ var coerce = {
4046
4046
  var NEVER = INVALID;
4047
4047
 
4048
4048
  // ../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
4049
- var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
4049
+ var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
4050
4050
  var defaultOptions = {
4051
4051
  name: void 0,
4052
4052
  $refStrategy: "root",
@@ -36,6 +36,7 @@ import { User, Products, Data, Jobs, AI } from 'lua-cli';
36
36
  - [AI API](#ai-api) - AI text generation
37
37
  - [Templates API](#templates-api) - WhatsApp templates
38
38
  - [CDN API](#cdn-api) - File upload/download
39
+ - [Channels API](#channels-api) - Outbound channel sends
39
40
 
40
41
  ### Utilities
41
42
  - [env()](#env) - Environment variables
@@ -71,7 +72,8 @@ import {
71
72
 
72
73
  // Utilities
73
74
  env,
74
- Lua
75
+ Lua,
76
+ Channels,
75
77
  } from 'lua-cli';
76
78
  ```
77
79
 
@@ -584,6 +586,51 @@ const url = await CDN.get(result.fileId);
584
586
 
585
587
  ---
586
588
 
589
+ ### Channels API
590
+
591
+ Send outbound messages over any supported channel (WhatsApp, SMS, email, webchat, and more)
592
+ from inside a job, webhook, or skill tool.
593
+
594
+ A successful send with a memory write failure returns `{ delivered: true, persisted: false, warning: '...' }` —
595
+ this is HTTP 200 and is never thrown as an error.
596
+
597
+ **Methods:**
598
+ - `Channels.send(input)` - Send a text message on any channel
599
+ - `Channels.whatsapp.sendTemplate(input)` - Send a WhatsApp Business template
600
+ - `Channels.email.send(input)` - Send an email
601
+
602
+ **Examples:**
603
+ ```typescript
604
+ import { Channels } from 'lua-cli';
605
+
606
+ // Send a text message over WhatsApp
607
+ await Channels.send({
608
+ channel: 'whatsapp',
609
+ to: { phoneNumber: '+15551234567' },
610
+ text: 'Your order has shipped!',
611
+ });
612
+
613
+ // Send a WhatsApp Business template
614
+ await Channels.whatsapp.sendTemplate({
615
+ to: { phoneNumber: '+447551166594' },
616
+ templateName: 'order_update',
617
+ languageCode: 'en',
618
+ components: [{ type: 'body', parameters: [{ type: 'text', text: 'ORD-99' }] }],
619
+ });
620
+
621
+ // Send an email
622
+ const result = await Channels.email.send({
623
+ to: { email: 'alice@example.com' },
624
+ subject: 'Your order is ready',
625
+ html: '<p>Hello, Alice!</p>',
626
+ });
627
+ if (!result.persisted) {
628
+ console.warn('Delivered but not stored in memory:', result.warning);
629
+ }
630
+ ```
631
+
632
+ ---
633
+
587
634
  ## Utilities
588
635
 
589
636
  ### env()
package/docs/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # lua-cli v3.16.2
1
+ # lua-cli v3.18.0
2
2
 
3
3
  Welcome to the comprehensive API documentation for lua-cli v3.16.2. This guide covers every API, class, and function exported by the package.
4
4
 
@@ -107,7 +107,7 @@ Sends a template message to one or more phone numbers.
107
107
  - `data` (object)
108
108
  - `phoneNumbers` (string[]) - Array of phone numbers (E.164 format)
109
109
  - `values` (object, optional) - Template variable values
110
- - `header` (object) - Header variables (key-value pairs)
110
+ - `header` (object) - Header variables (key-value pairs). For media-header templates, pass the media URL instead: `image_url` (IMAGE), `video_url` (VIDEO), or `document_url` + optional `document_filename` (DOCUMENT). URLs must be publicly reachable over HTTPS.
111
111
  - `body` (object) - Body variables (key-value pairs)
112
112
  - `buttons` (array) - Button values
113
113
 
@@ -137,6 +137,23 @@ console.log(`Sent ${response.totalProcessed} messages`);
137
137
  console.log(`Errors: ${response.totalErrors}`);
138
138
  ```
139
139
 
140
+ **Example (media header):**
141
+ ```typescript
142
+ // Template approved with an IMAGE header — pass the image to display via image_url.
143
+ // VIDEO headers take video_url; DOCUMENT headers take document_url (+ optional document_filename).
144
+ const response = await Templates.whatsapp.send(
145
+ 'channel_123',
146
+ 'promo_template',
147
+ {
148
+ phoneNumbers: ['+1234567890'],
149
+ values: {
150
+ header: { image_url: 'https://example.com/promo.jpg' },
151
+ body: { discount: '20%' }
152
+ }
153
+ }
154
+ );
155
+ ```
156
+
140
157
  ## Template Structure
141
158
 
142
159
  ### Template Components
@@ -153,8 +170,9 @@ interface WhatsAppTemplate {
153
170
  components: [
154
171
  {
155
172
  type: 'HEADER';
156
- format: 'TEXT';
157
- text: string;
173
+ // TEXT headers carry `text`; media headers (IMAGE/VIDEO/DOCUMENT) have no text
174
+ format: 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT';
175
+ text?: string;
158
176
  },
159
177
  {
160
178
  type: 'BODY';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "3.17.4",
3
+ "version": "3.18.0",
4
4
  "description": "Build, test, and deploy AI agents with custom tools, webhooks, and scheduled jobs. Features LuaAgent unified configuration, streaming chat, and batch deployment.",
5
5
  "readmeFilename": "README.md",
6
6
  "main": "dist/api-exports.js",
@@ -80,7 +80,7 @@
80
80
  "commander": "^14.0.1",
81
81
  "diff": "^8.0.2",
82
82
  "dotenv": "^17.2.3",
83
- "esbuild": "^0.25.10",
83
+ "esbuild": "^0.28.1",
84
84
  "inquirer": "^12.9.6",
85
85
  "js-yaml": "^4.1.0",
86
86
  "open": "^10.1.0",
@@ -20,7 +20,7 @@
20
20
  "inquirer": "^12.9.6",
21
21
  "stripe": "^17.5.0",
22
22
  "js-yaml": "^4.1.0",
23
- "lua-cli": "^3.17.4",
23
+ "lua-cli": "^3.18.0",
24
24
  "openai": "^5.23.0",
25
25
  "uuid": "^13.0.0",
26
26
  "zod": "^3.24.1"