lua-cli 3.39.2 → 3.39.4

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.
@@ -1927,6 +1927,37 @@ export declare function defineTrigger<T = any>(config: LuaTriggerConfig<T>): Lua
1927
1927
  */
1928
1928
  export declare function defineVoice(config: LuaVoiceConfig): LuaVoice;
1929
1929
 
1930
+ /**
1931
+ * Define a web app on the agent.
1932
+ *
1933
+ * @example
1934
+ * ```typescript
1935
+ * import { defineWebApp, route, json } from 'lua-cli';
1936
+ * import { z } from 'zod';
1937
+ *
1938
+ * export default defineWebApp({
1939
+ * name: 'ops-dashboard',
1940
+ * description: 'Open tickets per shop',
1941
+ * pages: { root: './web', nav: [{ path: '/', label: 'Overview' }] },
1942
+ * routes: {
1943
+ * 'GET /tickets': route({
1944
+ * query: z.object({ status: z.enum(['open', 'closed']).default('open') }),
1945
+ * handler: async ({ query }) => ({ items: (await Data.get('tickets', { filter: { status: query.status } })).data }),
1946
+ * }),
1947
+ * 'POST /tickets/:id/close': route({
1948
+ * params: z.object({ id: z.string() }),
1949
+ * body: z.object({ note: z.string().max(500) }),
1950
+ * handler: async ({ params, body, auth }) => {
1951
+ * await Data.patch('tickets', params.id, { set: { status: 'closed', closedBy: auth.userId, note: body.note } });
1952
+ * return json(undefined, 204);
1953
+ * },
1954
+ * }),
1955
+ * },
1956
+ * });
1957
+ * ```
1958
+ */
1959
+ export declare function defineWebApp(config: LuaWebAppConfig): LuaWebApp;
1960
+
1930
1961
  export declare function defineWorkflow(cfg: LuaWorkflowConfig, build: (wf: LuaWorkflowBuilder) => LuaWorkflow): LuaWorkflow;
1931
1962
 
1932
1963
  /**
@@ -3125,6 +3156,11 @@ declare interface JobVersion {
3125
3156
  metadata?: Record<string, any>;
3126
3157
  }
3127
3158
 
3159
+ /**
3160
+ * Build a JSON `Response`. `json(undefined, 204)` answers with no body.
3161
+ */
3162
+ export declare function json(data: unknown, status?: number, headers?: Record<string, string>): Response;
3163
+
3128
3164
  export { JsonSchema }
3129
3165
 
3130
3166
  export { KnowledgeBindingSpec }
@@ -3394,6 +3430,9 @@ export declare interface LuaAgentConfig {
3394
3430
  */
3395
3431
  export declare type LuaAgentModel = string | ((request: LuaRequest) => string | Promise<string>);
3396
3432
 
3433
+ /** The signed-in person a route runs for (never an API key, never anonymous). */
3434
+ export declare type LuaAuth = WebRouteAuth;
3435
+
3397
3436
  /**
3398
3437
  * LuaDevice class — represents an external device that an agent can communicate with.
3399
3438
  *
@@ -4201,14 +4240,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4201
4240
  */
4202
4241
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4203
4242
  }, "strip", z.ZodTypeAny, {
4243
+ voice?: string;
4204
4244
  kind?: "inference";
4205
4245
  options?: Record<string, unknown>;
4206
- voice?: string;
4207
4246
  model?: string;
4208
4247
  }, {
4248
+ voice?: string;
4209
4249
  kind?: "inference";
4210
4250
  options?: Record<string, unknown>;
4211
- voice?: string;
4212
4251
  model?: string;
4213
4252
  }>, z.ZodObject<{
4214
4253
  kind: z.ZodLiteral<"plugin">;
@@ -4222,15 +4261,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4222
4261
  */
4223
4262
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4224
4263
  }, "strip", z.ZodTypeAny, {
4264
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4265
+ provider?: "deepgram" | "elevenlabs";
4225
4266
  kind?: "plugin";
4226
4267
  options?: Record<string, unknown>;
4227
- provider?: "deepgram" | "elevenlabs";
4228
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4229
4268
  }, {
4269
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4270
+ provider?: "deepgram" | "elevenlabs";
4230
4271
  kind?: "plugin";
4231
4272
  options?: Record<string, unknown>;
4232
- provider?: "deepgram" | "elevenlabs";
4233
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4234
4273
  }>, z.ZodObject<{
4235
4274
  kind: z.ZodLiteral<"realtime">;
4236
4275
  provider: z.ZodEnum<["openai", "google", "xai"]>;
@@ -4242,13 +4281,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4242
4281
  */
4243
4282
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4244
4283
  }, "strip", z.ZodTypeAny, {
4284
+ provider?: "google" | "xai" | "openai";
4245
4285
  kind?: "realtime";
4246
4286
  options?: Record<string, unknown>;
4247
- provider?: "google" | "xai" | "openai";
4248
4287
  }, {
4288
+ provider?: "google" | "xai" | "openai";
4249
4289
  kind?: "realtime";
4250
4290
  options?: Record<string, unknown>;
4251
- provider?: "google" | "xai" | "openai";
4252
4291
  }>]>;
4253
4292
  stt: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4254
4293
  kind: z.ZodLiteral<"inference">;
@@ -4267,14 +4306,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4267
4306
  */
4268
4307
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4269
4308
  }, "strip", z.ZodTypeAny, {
4309
+ voice?: string;
4270
4310
  kind?: "inference";
4271
4311
  options?: Record<string, unknown>;
4272
- voice?: string;
4273
4312
  model?: string;
4274
4313
  }, {
4314
+ voice?: string;
4275
4315
  kind?: "inference";
4276
4316
  options?: Record<string, unknown>;
4277
- voice?: string;
4278
4317
  model?: string;
4279
4318
  }>, z.ZodObject<{
4280
4319
  kind: z.ZodLiteral<"plugin">;
@@ -4288,15 +4327,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4288
4327
  */
4289
4328
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4290
4329
  }, "strip", z.ZodTypeAny, {
4330
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4331
+ provider?: "deepgram" | "elevenlabs";
4291
4332
  kind?: "plugin";
4292
4333
  options?: Record<string, unknown>;
4293
- provider?: "deepgram" | "elevenlabs";
4294
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4295
4334
  }, {
4335
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4336
+ provider?: "deepgram" | "elevenlabs";
4296
4337
  kind?: "plugin";
4297
4338
  options?: Record<string, unknown>;
4298
- provider?: "deepgram" | "elevenlabs";
4299
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4300
4339
  }>, z.ZodObject<{
4301
4340
  kind: z.ZodLiteral<"realtime">;
4302
4341
  provider: z.ZodEnum<["openai", "google", "xai"]>;
@@ -4308,13 +4347,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4308
4347
  */
4309
4348
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4310
4349
  }, "strip", z.ZodTypeAny, {
4350
+ provider?: "google" | "xai" | "openai";
4311
4351
  kind?: "realtime";
4312
4352
  options?: Record<string, unknown>;
4313
- provider?: "google" | "xai" | "openai";
4314
4353
  }, {
4354
+ provider?: "google" | "xai" | "openai";
4315
4355
  kind?: "realtime";
4316
4356
  options?: Record<string, unknown>;
4317
- provider?: "google" | "xai" | "openai";
4318
4357
  }>]>>;
4319
4358
  tts: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4320
4359
  kind: z.ZodLiteral<"inference">;
@@ -4333,14 +4372,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4333
4372
  */
4334
4373
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4335
4374
  }, "strip", z.ZodTypeAny, {
4375
+ voice?: string;
4336
4376
  kind?: "inference";
4337
4377
  options?: Record<string, unknown>;
4338
- voice?: string;
4339
4378
  model?: string;
4340
4379
  }, {
4380
+ voice?: string;
4341
4381
  kind?: "inference";
4342
4382
  options?: Record<string, unknown>;
4343
- voice?: string;
4344
4383
  model?: string;
4345
4384
  }>, z.ZodObject<{
4346
4385
  kind: z.ZodLiteral<"plugin">;
@@ -4354,15 +4393,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4354
4393
  */
4355
4394
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4356
4395
  }, "strip", z.ZodTypeAny, {
4396
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4397
+ provider?: "deepgram" | "elevenlabs";
4357
4398
  kind?: "plugin";
4358
4399
  options?: Record<string, unknown>;
4359
- provider?: "deepgram" | "elevenlabs";
4360
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4361
4400
  }, {
4401
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4402
+ provider?: "deepgram" | "elevenlabs";
4362
4403
  kind?: "plugin";
4363
4404
  options?: Record<string, unknown>;
4364
- provider?: "deepgram" | "elevenlabs";
4365
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4366
4405
  }>, z.ZodObject<{
4367
4406
  kind: z.ZodLiteral<"realtime">;
4368
4407
  provider: z.ZodEnum<["openai", "google", "xai"]>;
@@ -4374,13 +4413,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4374
4413
  */
4375
4414
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4376
4415
  }, "strip", z.ZodTypeAny, {
4416
+ provider?: "google" | "xai" | "openai";
4377
4417
  kind?: "realtime";
4378
4418
  options?: Record<string, unknown>;
4379
- provider?: "google" | "xai" | "openai";
4380
4419
  }, {
4420
+ provider?: "google" | "xai" | "openai";
4381
4421
  kind?: "realtime";
4382
4422
  options?: Record<string, unknown>;
4383
- provider?: "google" | "xai" | "openai";
4384
4423
  }>]>>;
4385
4424
  vad: z.ZodOptional<z.ZodString>;
4386
4425
  vadOptions: z.ZodOptional<z.ZodObject<{
@@ -4541,50 +4580,50 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4541
4580
  name?: string;
4542
4581
  vad?: string;
4543
4582
  stt?: {
4583
+ voice?: string;
4544
4584
  kind?: "inference";
4545
4585
  options?: Record<string, unknown>;
4546
- voice?: string;
4547
4586
  model?: string;
4548
4587
  } | {
4588
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4589
+ provider?: "deepgram" | "elevenlabs";
4549
4590
  kind?: "plugin";
4550
4591
  options?: Record<string, unknown>;
4551
- provider?: "deepgram" | "elevenlabs";
4552
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4553
4592
  } | {
4593
+ provider?: "google" | "xai" | "openai";
4554
4594
  kind?: "realtime";
4555
4595
  options?: Record<string, unknown>;
4556
- provider?: "google" | "xai" | "openai";
4557
4596
  };
4558
4597
  volume?: number;
4559
4598
  llm?: {
4599
+ voice?: string;
4560
4600
  kind?: "inference";
4561
4601
  options?: Record<string, unknown>;
4562
- voice?: string;
4563
4602
  model?: string;
4564
4603
  } | {
4604
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4605
+ provider?: "deepgram" | "elevenlabs";
4565
4606
  kind?: "plugin";
4566
4607
  options?: Record<string, unknown>;
4567
- provider?: "deepgram" | "elevenlabs";
4568
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4569
4608
  } | {
4609
+ provider?: "google" | "xai" | "openai";
4570
4610
  kind?: "realtime";
4571
4611
  options?: Record<string, unknown>;
4572
- provider?: "google" | "xai" | "openai";
4573
4612
  };
4574
4613
  tts?: {
4614
+ voice?: string;
4575
4615
  kind?: "inference";
4576
4616
  options?: Record<string, unknown>;
4577
- voice?: string;
4578
4617
  model?: string;
4579
4618
  } | {
4619
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4620
+ provider?: "deepgram" | "elevenlabs";
4580
4621
  kind?: "plugin";
4581
4622
  options?: Record<string, unknown>;
4582
- provider?: "deepgram" | "elevenlabs";
4583
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4584
4623
  } | {
4624
+ provider?: "google" | "xai" | "openai";
4585
4625
  kind?: "realtime";
4586
4626
  options?: Record<string, unknown>;
4587
- provider?: "google" | "xai" | "openai";
4588
4627
  };
4589
4628
  vadOptions?: {
4590
4629
  minSpeechDuration?: number;
@@ -4635,50 +4674,50 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4635
4674
  name?: string;
4636
4675
  vad?: string;
4637
4676
  stt?: {
4677
+ voice?: string;
4638
4678
  kind?: "inference";
4639
4679
  options?: Record<string, unknown>;
4640
- voice?: string;
4641
4680
  model?: string;
4642
4681
  } | {
4682
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4683
+ provider?: "deepgram" | "elevenlabs";
4643
4684
  kind?: "plugin";
4644
4685
  options?: Record<string, unknown>;
4645
- provider?: "deepgram" | "elevenlabs";
4646
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4647
4686
  } | {
4687
+ provider?: "google" | "xai" | "openai";
4648
4688
  kind?: "realtime";
4649
4689
  options?: Record<string, unknown>;
4650
- provider?: "google" | "xai" | "openai";
4651
4690
  };
4652
4691
  volume?: number;
4653
4692
  llm?: {
4693
+ voice?: string;
4654
4694
  kind?: "inference";
4655
4695
  options?: Record<string, unknown>;
4656
- voice?: string;
4657
4696
  model?: string;
4658
4697
  } | {
4698
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4699
+ provider?: "deepgram" | "elevenlabs";
4659
4700
  kind?: "plugin";
4660
4701
  options?: Record<string, unknown>;
4661
- provider?: "deepgram" | "elevenlabs";
4662
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4663
4702
  } | {
4703
+ provider?: "google" | "xai" | "openai";
4664
4704
  kind?: "realtime";
4665
4705
  options?: Record<string, unknown>;
4666
- provider?: "google" | "xai" | "openai";
4667
4706
  };
4668
4707
  tts?: {
4708
+ voice?: string;
4669
4709
  kind?: "inference";
4670
4710
  options?: Record<string, unknown>;
4671
- voice?: string;
4672
4711
  model?: string;
4673
4712
  } | {
4713
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4714
+ provider?: "deepgram" | "elevenlabs";
4674
4715
  kind?: "plugin";
4675
4716
  options?: Record<string, unknown>;
4676
- provider?: "deepgram" | "elevenlabs";
4677
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4678
4717
  } | {
4718
+ provider?: "google" | "xai" | "openai";
4679
4719
  kind?: "realtime";
4680
4720
  options?: Record<string, unknown>;
4681
- provider?: "google" | "xai" | "openai";
4682
4721
  };
4683
4722
  vadOptions?: {
4684
4723
  minSpeechDuration?: number;
@@ -4729,50 +4768,50 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4729
4768
  name?: string;
4730
4769
  vad?: string;
4731
4770
  stt?: {
4771
+ voice?: string;
4732
4772
  kind?: "inference";
4733
4773
  options?: Record<string, unknown>;
4734
- voice?: string;
4735
4774
  model?: string;
4736
4775
  } | {
4776
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4777
+ provider?: "deepgram" | "elevenlabs";
4737
4778
  kind?: "plugin";
4738
4779
  options?: Record<string, unknown>;
4739
- provider?: "deepgram" | "elevenlabs";
4740
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4741
4780
  } | {
4781
+ provider?: "google" | "xai" | "openai";
4742
4782
  kind?: "realtime";
4743
4783
  options?: Record<string, unknown>;
4744
- provider?: "google" | "xai" | "openai";
4745
4784
  };
4746
4785
  volume?: number;
4747
4786
  llm?: {
4787
+ voice?: string;
4748
4788
  kind?: "inference";
4749
4789
  options?: Record<string, unknown>;
4750
- voice?: string;
4751
4790
  model?: string;
4752
4791
  } | {
4792
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4793
+ provider?: "deepgram" | "elevenlabs";
4753
4794
  kind?: "plugin";
4754
4795
  options?: Record<string, unknown>;
4755
- provider?: "deepgram" | "elevenlabs";
4756
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4757
4796
  } | {
4797
+ provider?: "google" | "xai" | "openai";
4758
4798
  kind?: "realtime";
4759
4799
  options?: Record<string, unknown>;
4760
- provider?: "google" | "xai" | "openai";
4761
4800
  };
4762
4801
  tts?: {
4802
+ voice?: string;
4763
4803
  kind?: "inference";
4764
4804
  options?: Record<string, unknown>;
4765
- voice?: string;
4766
4805
  model?: string;
4767
4806
  } | {
4807
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4808
+ provider?: "deepgram" | "elevenlabs";
4768
4809
  kind?: "plugin";
4769
4810
  options?: Record<string, unknown>;
4770
- provider?: "deepgram" | "elevenlabs";
4771
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4772
4811
  } | {
4812
+ provider?: "google" | "xai" | "openai";
4773
4813
  kind?: "realtime";
4774
4814
  options?: Record<string, unknown>;
4775
- provider?: "google" | "xai" | "openai";
4776
4815
  };
4777
4816
  vadOptions?: {
4778
4817
  minSpeechDuration?: number;
@@ -4823,50 +4862,50 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4823
4862
  name?: string;
4824
4863
  vad?: string;
4825
4864
  stt?: {
4865
+ voice?: string;
4826
4866
  kind?: "inference";
4827
4867
  options?: Record<string, unknown>;
4828
- voice?: string;
4829
4868
  model?: string;
4830
4869
  } | {
4870
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4871
+ provider?: "deepgram" | "elevenlabs";
4831
4872
  kind?: "plugin";
4832
4873
  options?: Record<string, unknown>;
4833
- provider?: "deepgram" | "elevenlabs";
4834
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4835
4874
  } | {
4875
+ provider?: "google" | "xai" | "openai";
4836
4876
  kind?: "realtime";
4837
4877
  options?: Record<string, unknown>;
4838
- provider?: "google" | "xai" | "openai";
4839
4878
  };
4840
4879
  volume?: number;
4841
4880
  llm?: {
4881
+ voice?: string;
4842
4882
  kind?: "inference";
4843
4883
  options?: Record<string, unknown>;
4844
- voice?: string;
4845
4884
  model?: string;
4846
4885
  } | {
4886
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4887
+ provider?: "deepgram" | "elevenlabs";
4847
4888
  kind?: "plugin";
4848
4889
  options?: Record<string, unknown>;
4849
- provider?: "deepgram" | "elevenlabs";
4850
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4851
4890
  } | {
4891
+ provider?: "google" | "xai" | "openai";
4852
4892
  kind?: "realtime";
4853
4893
  options?: Record<string, unknown>;
4854
- provider?: "google" | "xai" | "openai";
4855
4894
  };
4856
4895
  tts?: {
4896
+ voice?: string;
4857
4897
  kind?: "inference";
4858
4898
  options?: Record<string, unknown>;
4859
- voice?: string;
4860
4899
  model?: string;
4861
4900
  } | {
4901
+ class?: "LLM" | "STT" | "STTv2" | "TTS";
4902
+ provider?: "deepgram" | "elevenlabs";
4862
4903
  kind?: "plugin";
4863
4904
  options?: Record<string, unknown>;
4864
- provider?: "deepgram" | "elevenlabs";
4865
- class?: "LLM" | "STT" | "STTv2" | "TTS";
4866
4905
  } | {
4906
+ provider?: "google" | "xai" | "openai";
4867
4907
  kind?: "realtime";
4868
4908
  options?: Record<string, unknown>;
4869
- provider?: "google" | "xai" | "openai";
4870
4909
  };
4871
4910
  vadOptions?: {
4872
4911
  minSpeechDuration?: number;
@@ -5088,6 +5127,37 @@ export declare interface LuaVoiceTurnContext {
5088
5127
  }): void;
5089
5128
  }
5090
5129
 
5130
+ /**
5131
+ * Lua Web App — the class form of `defineWebApp` (consistent with
5132
+ * `LuaTrigger` / `defineTrigger`). Validates the definition eagerly so a
5133
+ * mistake fails at `lua compile`, not at first request.
5134
+ */
5135
+ export declare class LuaWebApp {
5136
+ private readonly config;
5137
+ constructor(config: LuaWebAppConfig);
5138
+ getName(): string;
5139
+ getDescription(): string | undefined;
5140
+ getPages(): WebAppPages;
5141
+ getBranding(): WebAppBranding | undefined;
5142
+ getRoutes(): Record<string, RouteDefinition<any, any, any>>;
5143
+ getFetch(): LuaWebAppConfig['fetch'];
5144
+ getConfig(): LuaWebAppConfig;
5145
+ }
5146
+
5147
+ export declare interface LuaWebAppConfig {
5148
+ /** URL-safe name: `^[a-z][a-z0-9-]*$`. The app's identifier on the agent. */
5149
+ name: string;
5150
+ description?: string;
5151
+ pages: WebAppPages;
5152
+ branding?: WebAppBranding;
5153
+ /** Typed route handlers keyed by `'<METHOD> /<path>'`. */
5154
+ routes?: Record<string, RouteDefinition<any, any, any>>;
5155
+ /** Escape hatch: a Web-standard `fetch` handler (Hono, itty-router, …) for
5156
+ * paths no route matches. Apps that use only `fetch` forgo manifest-driven
5157
+ * route access and the typed client. */
5158
+ fetch?: (request: Request) => Promise<Response> | Response;
5159
+ }
5160
+
5091
5161
  /**
5092
5162
  * Lua Webhook class.
5093
5163
  * Main class for building webhooks with validated inputs.
@@ -6468,6 +6538,46 @@ declare type ResumeStepResult = {
6468
6538
  * `maxBackoffSeconds` (default 3600) only meaningful with 'exponential' (`backoff-invalid` otherwise). */
6469
6539
  export declare type RetryPolicy = WorkflowRetryPolicy;
6470
6540
 
6541
+ /**
6542
+ * Declare a route. Identity at runtime; exists so the compiler can see the
6543
+ * schemas and the handler, and so `RouteContext` is inferred from them.
6544
+ */
6545
+ export declare function route<P = Record<string, string>, Q = Record<string, string | string[]>, B = unknown>(def: RouteDefinition<P, Q, B>): RouteDefinition<P, Q, B>;
6546
+
6547
+ /** What a route handler receives. `params`, `query` and `body` are already
6548
+ * validated by the route's schemas when those are declared. */
6549
+ export declare interface RouteContext<P = Record<string, string>, Q = Record<string, string | string[]>, B = unknown> {
6550
+ params: P;
6551
+ query: Q;
6552
+ body: B;
6553
+ /** Lower-cased, allow-listed request headers. */
6554
+ headers: Record<string, string>;
6555
+ method: WebRouteMethod;
6556
+ path: string;
6557
+ /** The matched route key. */
6558
+ route?: string;
6559
+ auth: LuaAuth;
6560
+ app: WebRouteApp;
6561
+ /** The Web `Request` the gateway received, for handlers that want it. */
6562
+ request: Request;
6563
+ }
6564
+
6565
+ export declare interface RouteDefinition<P = Record<string, string>, Q = Record<string, string | string[]>, B = unknown> {
6566
+ description?: string;
6567
+ /** Zod schema for path parameters; a failure answers 400 `VALIDATION`. */
6568
+ params?: ZodType<P>;
6569
+ /** Zod schema for query parameters; a failure answers 400 `VALIDATION`. */
6570
+ query?: ZodType<Q>;
6571
+ /** Zod schema for the request body; a failure answers 400 `VALIDATION`. */
6572
+ body?: ZodType<B>;
6573
+ /** Response schemas by status, for the typed client (not enforced at runtime). */
6574
+ responses?: Record<number, ZodType>;
6575
+ handler: (ctx: RouteContext<P, Q, B>) => Promise<RouteHandlerResult> | RouteHandlerResult;
6576
+ }
6577
+
6578
+ /** A handler returns a Web `Response`, `undefined` (→ 204) or any JSON value (→ 200). */
6579
+ export declare type RouteHandlerResult = Response | undefined | unknown;
6580
+
6471
6581
  export declare const rows: (s: LuaWorkflowStep<any, any, any> | string, path: string, page: {
6472
6582
  offset: number;
6473
6583
  limit: number;
@@ -7320,6 +7430,60 @@ export declare interface WaitForSignalOptions {
7320
7430
  acceptedSources?: Array<'webhook' | 'api' | 'user' | 'agent'>;
7321
7431
  }
7322
7432
 
7433
+ /**
7434
+ * Per-app additions to the gateway's strict Content-Security-Policy
7435
+ * (`defineWebApp({ pages: { csp } })`, PRD 7.10.11). This camelCase shape is
7436
+ * what lua-cli writes, what `webAppVersion.csp` stores and what the gateway
7437
+ * reads; the gateway alone maps each key to its directive (`scriptSrc` →
7438
+ * `script-src`, …). A key outside this list is ignored by the gateway.
7439
+ */
7440
+ declare const WEB_APP_CSP_KEYS: readonly ["scriptSrc", "styleSrc", "imgSrc", "connectSrc", "fontSrc", "frameSrc", "workerSrc"];
7441
+
7442
+ export declare const WEB_APP_NAME_PATTERN: RegExp;
7443
+
7444
+ declare const WEB_ROUTE_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
7445
+
7446
+ /** `defineWebApp({ branding })`, as lua-cli writes it and the version stores it. */
7447
+ export declare interface WebAppBranding {
7448
+ /** Display name in the shells; defaults to the app name. */
7449
+ name?: string;
7450
+ /** Path to a logo inside the pages project, shipped as an asset. */
7451
+ logo?: string;
7452
+ /** Accent color (any CSS color; OKLCH preferred). */
7453
+ accent?: string;
7454
+ }
7455
+
7456
+ /** Per-app additions to the gateway's strict Content-Security-Policy (PRD 7.10.11),
7457
+ * in the one camelCase shape lua-cli stores and the gateway reads. */
7458
+ export declare type WebAppCsp = WebAppCsp_2;
7459
+
7460
+ declare type WebAppCsp_2 = Partial<Record<WebAppCspKey, string[]>>;
7461
+
7462
+ declare type WebAppCspKey = (typeof WEB_APP_CSP_KEYS)[number];
7463
+
7464
+ /** One navigation entry of a web app (`defineWebApp({ pages: { nav } })`): drives the
7465
+ * app's nav rail and the shells' Apps tile. Written by lua-cli, stored on the version. */
7466
+ export declare interface WebAppNavItem {
7467
+ /** Client route path inside the app, e.g. `/tickets`. */
7468
+ path: string;
7469
+ label: string;
7470
+ /** An icon name from the design system's curated set. */
7471
+ icon?: string;
7472
+ }
7473
+
7474
+ export declare interface WebAppPages {
7475
+ /** The Vite project directory, relative to the app definition (usually `./web`). */
7476
+ root: string;
7477
+ /** Serve the entry HTML for every non-asset path (client-side routing). Default true. */
7478
+ spa?: boolean;
7479
+ /** Navigation the app and the shells agree on; drives the app's nav rail and the Apps hub tile. */
7480
+ nav?: WebAppNavItem[];
7481
+ csp?: WebAppCsp;
7482
+ }
7483
+
7484
+ /** Route keys are `'<METHOD> /<path>'`, e.g. `'POST /tickets/:id/close'`. */
7485
+ export declare type WebAppRouteKey = `${WebRouteMethod} /${string}`;
7486
+
7323
7487
  /**
7324
7488
  * Webhook request information from channel integrations.
7325
7489
  * Contains the raw webhook payload from the channel provider.
@@ -7329,6 +7493,40 @@ export declare interface WebhookRequest {
7329
7493
  payload: any;
7330
7494
  }
7331
7495
 
7496
+ /** The app the handler belongs to, for `ctx.app` and log correlation. */
7497
+ declare interface WebRouteApp {
7498
+ id: string;
7499
+ name: string;
7500
+ version: string;
7501
+ /** Monotonic deployment ordinal of the app version being executed. */
7502
+ deployment: number;
7503
+ /** The app origin, e.g. `https://ops-dashboard-7f3a.apps.heylua.ai`; the
7504
+ * wrapper builds the Web `Request` URL against it. */
7505
+ origin: string;
7506
+ /** True for preview/sandbox deployments (reserved; always false in the MVP). */
7507
+ preview: boolean;
7508
+ }
7509
+
7510
+ /** The caller, as the gateway resolved it. Mirrors the shells' principal:
7511
+ * a first-party Lua session, never an API key, never anonymous. `roles` and
7512
+ * `scopes` are the effective ones on the app's agent target. */
7513
+ declare interface WebRouteAuth {
7514
+ userId: string;
7515
+ orgId: string;
7516
+ agentId: string;
7517
+ subjectType: 'user';
7518
+ credentialType: 'firstPartySession';
7519
+ sessionId?: string;
7520
+ roles: string[];
7521
+ scopes: string[];
7522
+ name?: string;
7523
+ email?: string;
7524
+ /** ISO timestamp the session token expires at, when known. */
7525
+ expiresAt?: string;
7526
+ }
7527
+
7528
+ declare type WebRouteMethod = (typeof WEB_ROUTE_METHODS)[number];
7529
+
7332
7530
  /** Body of POST /developer/agents/:agentId/channels/whatsapp/reaction */
7333
7531
  export declare interface WhatsAppReactionSendInput {
7334
7532
  to: {