lua-cli 3.47.0 → 3.48.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.
@@ -374,6 +374,8 @@ declare interface AgentInvocationMeter {
374
374
  * to force the heavy tier (`hasDocProcessingTool`), so the workflow price must see them too.
375
375
  */
376
376
  toolNames?: string[];
377
+ /** The per-step prompt components the usage event's `contextSteps` carries — the prompt-size tier reads them. */
378
+ contextSteps?: LlmContextStep[];
377
379
  byok?: boolean;
378
380
  chargedCredits?: boolean;
379
381
  /**
@@ -2398,6 +2400,8 @@ export declare interface ChatHistoryMessage {
2398
2400
  agentId: string;
2399
2401
  name?: string;
2400
2402
  };
2403
+ /** On a user message: the id the client gave the turn when it sent it, so it can tell which of its sends arrived. */
2404
+ clientTurnId?: string;
2401
2405
  /**
2402
2406
  * Permanent recording for a voice-note turn (Lua Desktop). Populated by the
2403
2407
  * admin threads history endpoint from the row's `content.metadata.audio` — a
@@ -2419,6 +2423,20 @@ export declare type ChatMessage = TextMessage | ImageMessage | FileMessage;
2419
2423
  /** wave 2 U33 — the typed refusal `Integrations.checkAsUser` raises outside a live chat turn. */
2420
2424
  export declare function checkAsUserRequiresUser(): Error;
2421
2425
 
2426
+ export declare interface ChoiceAnswer<L extends string = string> {
2427
+ type: 'choice';
2428
+ choice: L;
2429
+ confidence: number;
2430
+ probabilities: Record<L, number>;
2431
+ uncertain: boolean;
2432
+ }
2433
+
2434
+ export declare interface ChoiceQuestion<L extends string = string> {
2435
+ type: 'choice';
2436
+ instructions: string;
2437
+ options: Record<L, string>;
2438
+ }
2439
+
2422
2440
  /**
2423
2441
  * U6 (wave 2) — connection inspection, account pinning and capability checks; U33 — the same checks run
2424
2442
  * with the CONVERSATION USER's principal. Owner: U6 (catalogue, list, pin, check, cleanup); U33 owns only
@@ -3013,6 +3031,137 @@ export declare class DataEntryInstance {
3013
3031
 
3014
3032
  export { DatasetRef }
3015
3033
 
3034
+ declare const DECISION_ERROR_CODES: {
3035
+ readonly INVALID: "decision_invalid";
3036
+ readonly TIMEOUT: "decision_timeout";
3037
+ readonly REJECTED: "decision_rejected";
3038
+ readonly UNAVAILABLE: "decision_unavailable";
3039
+ readonly DISABLED: "decision_disabled";
3040
+ readonly INSUFFICIENT_CREDITS: "decision_insufficient_credits";
3041
+ readonly NOT_FOUND: "decision_not_found";
3042
+ };
3043
+
3044
+ declare const DECISION_PROVIDERS: readonly ["jev", "openai"];
3045
+
3046
+ declare const DECISION_ROUTING_RULES: readonly ["pinned", "images", "region", "zero_retention", "default", "fallback"];
3047
+
3048
+ export declare type DecisionAnswer = OddsAnswer | ChoiceAnswer | ScoreAnswer | RefusedAnswer;
3049
+
3050
+ export declare type DecisionAnswerFor<Q extends DecisionQuestion> = Q extends ChoiceQuestion<infer L> ? ChoiceAnswer<L> | RefusedAnswer : Q extends ScoreQuestion ? ScoreAnswer | RefusedAnswer : OddsAnswer | RefusedAnswer;
3051
+
3052
+ export declare type DecisionAnswers<Q extends DecisionQuestions> = {
3053
+ [K in keyof Q]: DecisionAnswerFor<Q[K]>;
3054
+ };
3055
+
3056
+ export declare interface DecisionDefinition<Q extends DecisionQuestions = DecisionQuestions> extends DecisionOptions {
3057
+ name: string;
3058
+ description?: string;
3059
+ questions: Q;
3060
+ }
3061
+
3062
+ export declare interface DecisionError extends Error {
3063
+ readonly code: DecisionErrorFields['code'];
3064
+ readonly provider?: DecisionProvider;
3065
+ readonly upstreamStatus?: number;
3066
+ }
3067
+
3068
+ export declare const DecisionError: new (message: string, fields: DecisionErrorFields) => DecisionError;
3069
+
3070
+ export declare type DecisionErrorCode = (typeof DECISION_ERROR_CODES)[keyof typeof DECISION_ERROR_CODES];
3071
+
3072
+ export declare interface DecisionErrorFields {
3073
+ code: DecisionErrorCode | (string & {});
3074
+ provider?: DecisionProvider;
3075
+ upstreamStatus?: number;
3076
+ }
3077
+
3078
+ declare type DecisionFallback = DecisionProvider | 'none';
3079
+
3080
+ declare interface DecisionFallbackInfo {
3081
+ from: DecisionProvider;
3082
+ reason: string;
3083
+ }
3084
+
3085
+ declare interface DecisionImage {
3086
+ data: string;
3087
+ mimeType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
3088
+ }
3089
+
3090
+ declare type DecisionLogState = 'summary' | 'full' | 'none';
3091
+
3092
+ export declare interface DecisionOptions {
3093
+ provider?: DecisionProviderChoice;
3094
+ model?: string;
3095
+ fallback?: DecisionFallback;
3096
+ region?: DecisionRegion;
3097
+ zeroRetention?: boolean;
3098
+ minConfidence?: number;
3099
+ timeoutMs?: number;
3100
+ cache?: {
3101
+ ttlSeconds: number;
3102
+ };
3103
+ logState?: DecisionLogState;
3104
+ }
3105
+
3106
+ export declare type DecisionProvider = (typeof DECISION_PROVIDERS)[number];
3107
+
3108
+ declare type DecisionProviderChoice = DecisionProvider | 'auto';
3109
+
3110
+ export declare type DecisionQuestion = OddsQuestion | ChoiceQuestion | ScoreQuestion;
3111
+
3112
+ export declare type DecisionQuestions = Record<string, DecisionQuestion>;
3113
+
3114
+ declare type DecisionRegion = 'eu';
3115
+
3116
+ export declare interface DecisionRequest<Q extends DecisionQuestions = DecisionQuestions> extends DecisionOptions {
3117
+ state: DecisionState;
3118
+ images?: DecisionImage[];
3119
+ questions: Q;
3120
+ }
3121
+
3122
+ export declare interface DecisionResult<Q extends DecisionQuestions = DecisionQuestions> {
3123
+ decisionId: string;
3124
+ answers: DecisionAnswers<Q>;
3125
+ provider: DecisionProvider;
3126
+ model: string;
3127
+ rule: DecisionRoutingRule;
3128
+ usage: DecisionUsage;
3129
+ durationMs: number;
3130
+ cached: boolean;
3131
+ fallback?: DecisionFallbackInfo;
3132
+ }
3133
+
3134
+ declare type DecisionRoutingRule = (typeof DECISION_ROUTING_RULES)[number];
3135
+
3136
+ export declare type DecisionRunOptions = Omit<DecisionRunRequest, 'name' | 'state'>;
3137
+
3138
+ declare interface DecisionRunRequest extends DecisionOptions {
3139
+ name: string;
3140
+ state: DecisionState;
3141
+ images?: DecisionImage[];
3142
+ }
3143
+
3144
+ export declare const Decisions: DecisionsApi;
3145
+
3146
+ export declare interface DecisionsApi {
3147
+ ask<Q extends DecisionQuestions>(request: DecisionRequest<Q>): Promise<DecisionResult<Q>>;
3148
+ ask<Q extends DecisionQuestion>(state: DecisionState, question: Q, options?: DecisionOptions): Promise<DecisionAnswerFor<Q>>;
3149
+ run<Q extends DecisionQuestions = DecisionQuestions>(name: string, state: DecisionState, options?: DecisionRunOptions): Promise<DecisionResult<Q>>;
3150
+ odds(instructions: string, criteria?: OddsQuestion['criteria']): OddsQuestion;
3151
+ choice<L extends string>(instructions: string, options: Record<L, string>): ChoiceQuestion<L>;
3152
+ score(instructions: string, levels: ReadonlyArray<string | ScoreLevel>): ScoreQuestion;
3153
+ }
3154
+
3155
+ export declare type DecisionState = string | string[] | {
3156
+ [key: string]: unknown;
3157
+ };
3158
+
3159
+ declare interface DecisionUsage {
3160
+ inputTokens: number | null;
3161
+ }
3162
+
3163
+ export declare function defineDecision<Q extends DecisionQuestions>(config: LuaDecisionConfig<Q>): LuaDecision<Q>;
3164
+
3016
3165
  /**
3017
3166
  * Define a device that an agent can communicate with.
3018
3167
  *
@@ -3941,6 +4090,11 @@ declare abstract class HttpClient {
3941
4090
  * @protected
3942
4091
  */
3943
4092
  protected httpDelete<T>(url: string, headers?: Record<string, string>, overrides?: RequestOverrides): Promise<ApiResponse<T>>;
4093
+ /**
4094
+ * A DELETE with a JSON body, sent once (no retries): for a destructive call that carries a
4095
+ * single-use secret (a confirmation code), where a blind retry could only spend it again.
4096
+ */
4097
+ protected httpDeleteOnce<T>(url: string, data?: any, headers?: Record<string, string>, overrides?: RequestOverrides): Promise<ApiResponse<T>>;
3944
4098
  /**
3945
4099
  * Performs an HTTP PATCH request
3946
4100
  * @param url - The relative URL path to request (will be appended to baseUrl)
@@ -4379,6 +4533,8 @@ declare interface Job {
4379
4533
  updatedAt: string;
4380
4534
  dynamic?: boolean;
4381
4535
  userId?: string;
4536
+ /** The full chat thread id (base[:suffix]) the job was created in, set by the platform when Jobs.create ran inside a chat turn. Read-only; absent for jobs created outside a chat turn and for every earlier job. */
4537
+ originThreadId?: string;
4382
4538
  metadata?: Record<string, any>;
4383
4539
  versions: JobVersion[];
4384
4540
  lastExecution?: JobExecution;
@@ -4866,6 +5022,42 @@ export declare const lit: <const V extends string | number | boolean | null>(v:
4866
5022
 
4867
5023
  export { Literal }
4868
5024
 
5025
+ /**
5026
+ * LUA-724 (PR 7) — the billed turn's pricing inputs, exactly as chat's settlement event carries
5027
+ * them (`chat.service.trackLlmInferenceUsage`): the model that ACTUALLY served the turn (the
5028
+ * resolver's code, not the caller's pin), the de-paged `contextInputTokens` (largest single
5029
+ * step's prompt — never the whole-turn sum), the tool-call COUNT, and whether the turn ran on
5030
+ * the org's own key. `chargedCredits` echoes the gate's answer (true ⇒ the legacy pool deducted
5031
+ * in real time; false ⇒ seat org / free turn — settlement meters it).
5032
+ *
5033
+ * Stamped by the serving pod ONLY on internal-auth turns that carry a billing `operationId`
5034
+ * (the workflow agent-step loopback), as the enumerable `luaMeter` top-level field of the
5035
+ * generate envelope — never on a Bearer turn, so the public wire is byte-identical. The
5036
+ * workflow executor prices the step's `run.budget.spent` from it with `priceModelCall`.
5037
+ */
5038
+ /**
5039
+ * WJB-B1 (BAC-668, decision D1) — one ReAct step's prompt components, as the provider reported them:
5040
+ * `inputTokens` the step's UNCACHED prompt, `cacheReadTokens` the tokens served from cache,
5041
+ * `cacheCreationTokens` the flat write total with `cacheCreationTokens5m` / `cacheCreationTokens1h` its TTL
5042
+ * split when the provider exposed one (the streaming chat path usually does not — a weighted chat step then
5043
+ * weights READS alone). Names mirror `LlmUsageData`'s turn-level members, so one vocabulary describes the
5044
+ * turn and its steps.
5045
+ *
5046
+ * DECLARED HERE, not in `@lua/shared-schemas`, deliberately. The chat hot-path util that builds these
5047
+ * (`lua-core/src/utils/turn-signals.util.ts`) must not take a Nest-bearing runtime import: shared-schemas'
5048
+ * dist requires `@nestjs/mongoose` at load, and nine `chat.controller.*.spec.ts` suites partially mock
5049
+ * `@nestjs/common`, so importing the VALUE below from there turned them into
5050
+ * `common_1.Module is not a function`. `@lua/shared-types` requires no Nest at all; shared-schemas
5051
+ * re-exports both members, so `LlmUsageData.contextSteps` still reads as a member of that file.
5052
+ */
5053
+ declare interface LlmContextStep {
5054
+ inputTokens: number;
5055
+ cacheReadTokens?: number;
5056
+ cacheCreationTokens?: number;
5057
+ cacheCreationTokens5m?: number;
5058
+ cacheCreationTokens1h?: number;
5059
+ }
5060
+
4869
5061
  /**
4870
5062
  * Structured logging: `log.debug/info/warn/error(message, fields?)`.
4871
5063
  *
@@ -4993,6 +5185,7 @@ export declare class LuaAgent {
4993
5185
  private readonly devices;
4994
5186
  private readonly deviceTriggers;
4995
5187
  private readonly voices?;
5188
+ private readonly decisions;
4996
5189
  private readonly batching?;
4997
5190
  private readonly governance?;
4998
5191
  private readonly browser?;
@@ -5033,6 +5226,7 @@ export declare class LuaAgent {
5033
5226
  getBatching(): BatchingConfig | undefined;
5034
5227
  getDevices(): LuaDevice[];
5035
5228
  getVoices(): LuaVoice[] | undefined;
5229
+ getDecisions(): LuaDecision[];
5036
5230
  }
5037
5231
 
5038
5232
  export declare interface LuaAgentConfig {
@@ -5090,6 +5284,7 @@ export declare interface LuaAgentConfig {
5090
5284
  * single-element array — `voices: [supportVoice]`.
5091
5285
  */
5092
5286
  voices?: LuaVoice[];
5287
+ decisions?: LuaDecision[];
5093
5288
  /** Per-agent message batching/debounce configuration. Overrides platform env var defaults. */
5094
5289
  batching?: BatchingConfig;
5095
5290
  /** Governance policy configuration. When set, tool calls, preprocessors, and postprocessors are governed. */
@@ -5128,6 +5323,26 @@ export declare type LuaAgentModel = string | ((request: LuaRequest) => string |
5128
5323
  /** The signed-in person a route runs for (never an API key, never anonymous). */
5129
5324
  export declare type LuaAuth = WebRouteAuth;
5130
5325
 
5326
+ export declare class LuaDecision<Q extends DecisionQuestions = DecisionQuestions> {
5327
+ readonly name: string;
5328
+ readonly description?: string;
5329
+ readonly questions: Q;
5330
+ readonly provider?: DecisionProviderChoice;
5331
+ readonly model?: string;
5332
+ readonly fallback?: DecisionFallback;
5333
+ readonly region?: DecisionRegion;
5334
+ readonly zeroRetention?: boolean;
5335
+ readonly minConfidence?: number;
5336
+ readonly timeoutMs?: number;
5337
+ readonly cache?: {
5338
+ ttlSeconds: number;
5339
+ };
5340
+ readonly logState?: DecisionLogState;
5341
+ constructor(config: LuaDecisionConfig<Q>);
5342
+ }
5343
+
5344
+ export declare type LuaDecisionConfig<Q extends DecisionQuestions = DecisionQuestions> = DecisionDefinition<Q>;
5345
+
5131
5346
  /**
5132
5347
  * LuaDevice class — represents an external device that an agent can communicate with.
5133
5348
  *
@@ -5970,13 +6185,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
5970
6185
  */
5971
6186
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5972
6187
  }, "strip", z.ZodTypeAny, {
5973
- kind: "inference";
5974
6188
  model: string;
6189
+ kind: "inference";
5975
6190
  voice?: string | undefined;
5976
6191
  options?: Record<string, unknown> | undefined;
5977
6192
  }, {
5978
- kind: "inference";
5979
6193
  model: string;
6194
+ kind: "inference";
5980
6195
  voice?: string | undefined;
5981
6196
  options?: Record<string, unknown> | undefined;
5982
6197
  }>, z.ZodObject<{
@@ -5991,15 +6206,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
5991
6206
  */
5992
6207
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
5993
6208
  }, "strip", z.ZodTypeAny, {
5994
- kind: "plugin";
6209
+ options: Record<string, unknown>;
5995
6210
  provider: "deepgram" | "elevenlabs";
6211
+ kind: "plugin";
5996
6212
  class: "LLM" | "STT" | "STTv2" | "TTS";
5997
- options: Record<string, unknown>;
5998
6213
  }, {
5999
- kind: "plugin";
6214
+ options: Record<string, unknown>;
6000
6215
  provider: "deepgram" | "elevenlabs";
6216
+ kind: "plugin";
6001
6217
  class: "LLM" | "STT" | "STTv2" | "TTS";
6002
- options: Record<string, unknown>;
6003
6218
  }>, z.ZodObject<{
6004
6219
  kind: z.ZodLiteral<"realtime">;
6005
6220
  provider: z.ZodEnum<["openai", "google", "xai"]>;
@@ -6011,13 +6226,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6011
6226
  */
6012
6227
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6013
6228
  }, "strip", z.ZodTypeAny, {
6014
- kind: "realtime";
6015
- provider: "openai" | "google" | "xai";
6016
6229
  options: Record<string, unknown>;
6017
- }, {
6018
- kind: "realtime";
6019
6230
  provider: "openai" | "google" | "xai";
6231
+ kind: "realtime";
6232
+ }, {
6020
6233
  options: Record<string, unknown>;
6234
+ provider: "openai" | "google" | "xai";
6235
+ kind: "realtime";
6021
6236
  }>]>;
6022
6237
  stt: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
6023
6238
  kind: z.ZodLiteral<"inference">;
@@ -6036,13 +6251,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6036
6251
  */
6037
6252
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
6038
6253
  }, "strip", z.ZodTypeAny, {
6039
- kind: "inference";
6040
6254
  model: string;
6255
+ kind: "inference";
6041
6256
  voice?: string | undefined;
6042
6257
  options?: Record<string, unknown> | undefined;
6043
6258
  }, {
6044
- kind: "inference";
6045
6259
  model: string;
6260
+ kind: "inference";
6046
6261
  voice?: string | undefined;
6047
6262
  options?: Record<string, unknown> | undefined;
6048
6263
  }>, z.ZodObject<{
@@ -6057,15 +6272,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6057
6272
  */
6058
6273
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6059
6274
  }, "strip", z.ZodTypeAny, {
6060
- kind: "plugin";
6275
+ options: Record<string, unknown>;
6061
6276
  provider: "deepgram" | "elevenlabs";
6277
+ kind: "plugin";
6062
6278
  class: "LLM" | "STT" | "STTv2" | "TTS";
6063
- options: Record<string, unknown>;
6064
6279
  }, {
6065
- kind: "plugin";
6280
+ options: Record<string, unknown>;
6066
6281
  provider: "deepgram" | "elevenlabs";
6282
+ kind: "plugin";
6067
6283
  class: "LLM" | "STT" | "STTv2" | "TTS";
6068
- options: Record<string, unknown>;
6069
6284
  }>, z.ZodObject<{
6070
6285
  kind: z.ZodLiteral<"realtime">;
6071
6286
  provider: z.ZodEnum<["openai", "google", "xai"]>;
@@ -6077,13 +6292,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6077
6292
  */
6078
6293
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6079
6294
  }, "strip", z.ZodTypeAny, {
6080
- kind: "realtime";
6081
- provider: "openai" | "google" | "xai";
6082
6295
  options: Record<string, unknown>;
6083
- }, {
6084
- kind: "realtime";
6085
6296
  provider: "openai" | "google" | "xai";
6297
+ kind: "realtime";
6298
+ }, {
6086
6299
  options: Record<string, unknown>;
6300
+ provider: "openai" | "google" | "xai";
6301
+ kind: "realtime";
6087
6302
  }>]>>;
6088
6303
  tts: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
6089
6304
  kind: z.ZodLiteral<"inference">;
@@ -6102,13 +6317,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6102
6317
  */
6103
6318
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
6104
6319
  }, "strip", z.ZodTypeAny, {
6105
- kind: "inference";
6106
6320
  model: string;
6321
+ kind: "inference";
6107
6322
  voice?: string | undefined;
6108
6323
  options?: Record<string, unknown> | undefined;
6109
6324
  }, {
6110
- kind: "inference";
6111
6325
  model: string;
6326
+ kind: "inference";
6112
6327
  voice?: string | undefined;
6113
6328
  options?: Record<string, unknown> | undefined;
6114
6329
  }>, z.ZodObject<{
@@ -6123,15 +6338,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6123
6338
  */
6124
6339
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6125
6340
  }, "strip", z.ZodTypeAny, {
6126
- kind: "plugin";
6341
+ options: Record<string, unknown>;
6127
6342
  provider: "deepgram" | "elevenlabs";
6343
+ kind: "plugin";
6128
6344
  class: "LLM" | "STT" | "STTv2" | "TTS";
6129
- options: Record<string, unknown>;
6130
6345
  }, {
6131
- kind: "plugin";
6346
+ options: Record<string, unknown>;
6132
6347
  provider: "deepgram" | "elevenlabs";
6348
+ kind: "plugin";
6133
6349
  class: "LLM" | "STT" | "STTv2" | "TTS";
6134
- options: Record<string, unknown>;
6135
6350
  }>, z.ZodObject<{
6136
6351
  kind: z.ZodLiteral<"realtime">;
6137
6352
  provider: z.ZodEnum<["openai", "google", "xai"]>;
@@ -6143,13 +6358,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6143
6358
  */
6144
6359
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6145
6360
  }, "strip", z.ZodTypeAny, {
6146
- kind: "realtime";
6147
- provider: "openai" | "google" | "xai";
6148
6361
  options: Record<string, unknown>;
6149
- }, {
6150
- kind: "realtime";
6151
6362
  provider: "openai" | "google" | "xai";
6363
+ kind: "realtime";
6364
+ }, {
6152
6365
  options: Record<string, unknown>;
6366
+ provider: "openai" | "google" | "xai";
6367
+ kind: "realtime";
6153
6368
  }>]>>;
6154
6369
  vad: z.ZodOptional<z.ZodString>;
6155
6370
  vadOptions: z.ZodOptional<z.ZodObject<{
@@ -6308,52 +6523,52 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6308
6523
  excludeTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6309
6524
  }, "strip", z.ZodTypeAny, {
6310
6525
  llm: {
6311
- kind: "inference";
6312
6526
  model: string;
6527
+ kind: "inference";
6313
6528
  voice?: string | undefined;
6314
6529
  options?: Record<string, unknown> | undefined;
6315
6530
  } | {
6316
- kind: "plugin";
6531
+ options: Record<string, unknown>;
6317
6532
  provider: "deepgram" | "elevenlabs";
6533
+ kind: "plugin";
6318
6534
  class: "LLM" | "STT" | "STTv2" | "TTS";
6319
- options: Record<string, unknown>;
6320
6535
  } | {
6321
- kind: "realtime";
6322
- provider: "openai" | "google" | "xai";
6323
6536
  options: Record<string, unknown>;
6537
+ provider: "openai" | "google" | "xai";
6538
+ kind: "realtime";
6324
6539
  };
6325
6540
  name?: string | undefined;
6326
6541
  vad?: string | undefined;
6327
6542
  stt?: {
6328
- kind: "inference";
6329
6543
  model: string;
6544
+ kind: "inference";
6330
6545
  voice?: string | undefined;
6331
6546
  options?: Record<string, unknown> | undefined;
6332
6547
  } | {
6333
- kind: "plugin";
6548
+ options: Record<string, unknown>;
6334
6549
  provider: "deepgram" | "elevenlabs";
6550
+ kind: "plugin";
6335
6551
  class: "LLM" | "STT" | "STTv2" | "TTS";
6336
- options: Record<string, unknown>;
6337
6552
  } | {
6338
- kind: "realtime";
6339
- provider: "openai" | "google" | "xai";
6340
6553
  options: Record<string, unknown>;
6554
+ provider: "openai" | "google" | "xai";
6555
+ kind: "realtime";
6341
6556
  } | undefined;
6342
6557
  volume?: number | undefined;
6343
6558
  tts?: {
6344
- kind: "inference";
6345
6559
  model: string;
6560
+ kind: "inference";
6346
6561
  voice?: string | undefined;
6347
6562
  options?: Record<string, unknown> | undefined;
6348
6563
  } | {
6349
- kind: "plugin";
6564
+ options: Record<string, unknown>;
6350
6565
  provider: "deepgram" | "elevenlabs";
6566
+ kind: "plugin";
6351
6567
  class: "LLM" | "STT" | "STTv2" | "TTS";
6352
- options: Record<string, unknown>;
6353
6568
  } | {
6354
- kind: "realtime";
6355
- provider: "openai" | "google" | "xai";
6356
6569
  options: Record<string, unknown>;
6570
+ provider: "openai" | "google" | "xai";
6571
+ kind: "realtime";
6357
6572
  } | undefined;
6358
6573
  vadOptions?: {
6359
6574
  minSpeechDuration?: number | undefined;
@@ -6402,52 +6617,52 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6402
6617
  excludeTools?: string[] | undefined;
6403
6618
  }, {
6404
6619
  llm: {
6405
- kind: "inference";
6406
6620
  model: string;
6621
+ kind: "inference";
6407
6622
  voice?: string | undefined;
6408
6623
  options?: Record<string, unknown> | undefined;
6409
6624
  } | {
6410
- kind: "plugin";
6625
+ options: Record<string, unknown>;
6411
6626
  provider: "deepgram" | "elevenlabs";
6627
+ kind: "plugin";
6412
6628
  class: "LLM" | "STT" | "STTv2" | "TTS";
6413
- options: Record<string, unknown>;
6414
6629
  } | {
6415
- kind: "realtime";
6416
- provider: "openai" | "google" | "xai";
6417
6630
  options: Record<string, unknown>;
6631
+ provider: "openai" | "google" | "xai";
6632
+ kind: "realtime";
6418
6633
  };
6419
6634
  name?: string | undefined;
6420
6635
  vad?: string | undefined;
6421
6636
  stt?: {
6422
- kind: "inference";
6423
6637
  model: string;
6638
+ kind: "inference";
6424
6639
  voice?: string | undefined;
6425
6640
  options?: Record<string, unknown> | undefined;
6426
6641
  } | {
6427
- kind: "plugin";
6642
+ options: Record<string, unknown>;
6428
6643
  provider: "deepgram" | "elevenlabs";
6644
+ kind: "plugin";
6429
6645
  class: "LLM" | "STT" | "STTv2" | "TTS";
6430
- options: Record<string, unknown>;
6431
6646
  } | {
6432
- kind: "realtime";
6433
- provider: "openai" | "google" | "xai";
6434
6647
  options: Record<string, unknown>;
6648
+ provider: "openai" | "google" | "xai";
6649
+ kind: "realtime";
6435
6650
  } | undefined;
6436
6651
  volume?: number | undefined;
6437
6652
  tts?: {
6438
- kind: "inference";
6439
6653
  model: string;
6654
+ kind: "inference";
6440
6655
  voice?: string | undefined;
6441
6656
  options?: Record<string, unknown> | undefined;
6442
6657
  } | {
6443
- kind: "plugin";
6658
+ options: Record<string, unknown>;
6444
6659
  provider: "deepgram" | "elevenlabs";
6660
+ kind: "plugin";
6445
6661
  class: "LLM" | "STT" | "STTv2" | "TTS";
6446
- options: Record<string, unknown>;
6447
6662
  } | {
6448
- kind: "realtime";
6449
- provider: "openai" | "google" | "xai";
6450
6663
  options: Record<string, unknown>;
6664
+ provider: "openai" | "google" | "xai";
6665
+ kind: "realtime";
6451
6666
  } | undefined;
6452
6667
  vadOptions?: {
6453
6668
  minSpeechDuration?: number | undefined;
@@ -6496,52 +6711,52 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6496
6711
  excludeTools?: string[] | undefined;
6497
6712
  }>, {
6498
6713
  llm: {
6499
- kind: "inference";
6500
6714
  model: string;
6715
+ kind: "inference";
6501
6716
  voice?: string | undefined;
6502
6717
  options?: Record<string, unknown> | undefined;
6503
6718
  } | {
6504
- kind: "plugin";
6719
+ options: Record<string, unknown>;
6505
6720
  provider: "deepgram" | "elevenlabs";
6721
+ kind: "plugin";
6506
6722
  class: "LLM" | "STT" | "STTv2" | "TTS";
6507
- options: Record<string, unknown>;
6508
6723
  } | {
6509
- kind: "realtime";
6510
- provider: "openai" | "google" | "xai";
6511
6724
  options: Record<string, unknown>;
6725
+ provider: "openai" | "google" | "xai";
6726
+ kind: "realtime";
6512
6727
  };
6513
6728
  name?: string | undefined;
6514
6729
  vad?: string | undefined;
6515
6730
  stt?: {
6516
- kind: "inference";
6517
6731
  model: string;
6732
+ kind: "inference";
6518
6733
  voice?: string | undefined;
6519
6734
  options?: Record<string, unknown> | undefined;
6520
6735
  } | {
6521
- kind: "plugin";
6736
+ options: Record<string, unknown>;
6522
6737
  provider: "deepgram" | "elevenlabs";
6738
+ kind: "plugin";
6523
6739
  class: "LLM" | "STT" | "STTv2" | "TTS";
6524
- options: Record<string, unknown>;
6525
6740
  } | {
6526
- kind: "realtime";
6527
- provider: "openai" | "google" | "xai";
6528
6741
  options: Record<string, unknown>;
6742
+ provider: "openai" | "google" | "xai";
6743
+ kind: "realtime";
6529
6744
  } | undefined;
6530
6745
  volume?: number | undefined;
6531
6746
  tts?: {
6532
- kind: "inference";
6533
6747
  model: string;
6748
+ kind: "inference";
6534
6749
  voice?: string | undefined;
6535
6750
  options?: Record<string, unknown> | undefined;
6536
6751
  } | {
6537
- kind: "plugin";
6752
+ options: Record<string, unknown>;
6538
6753
  provider: "deepgram" | "elevenlabs";
6754
+ kind: "plugin";
6539
6755
  class: "LLM" | "STT" | "STTv2" | "TTS";
6540
- options: Record<string, unknown>;
6541
6756
  } | {
6542
- kind: "realtime";
6543
- provider: "openai" | "google" | "xai";
6544
6757
  options: Record<string, unknown>;
6758
+ provider: "openai" | "google" | "xai";
6759
+ kind: "realtime";
6545
6760
  } | undefined;
6546
6761
  vadOptions?: {
6547
6762
  minSpeechDuration?: number | undefined;
@@ -6590,52 +6805,52 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6590
6805
  excludeTools?: string[] | undefined;
6591
6806
  }, {
6592
6807
  llm: {
6593
- kind: "inference";
6594
6808
  model: string;
6809
+ kind: "inference";
6595
6810
  voice?: string | undefined;
6596
6811
  options?: Record<string, unknown> | undefined;
6597
6812
  } | {
6598
- kind: "plugin";
6813
+ options: Record<string, unknown>;
6599
6814
  provider: "deepgram" | "elevenlabs";
6815
+ kind: "plugin";
6600
6816
  class: "LLM" | "STT" | "STTv2" | "TTS";
6601
- options: Record<string, unknown>;
6602
6817
  } | {
6603
- kind: "realtime";
6604
- provider: "openai" | "google" | "xai";
6605
6818
  options: Record<string, unknown>;
6819
+ provider: "openai" | "google" | "xai";
6820
+ kind: "realtime";
6606
6821
  };
6607
6822
  name?: string | undefined;
6608
6823
  vad?: string | undefined;
6609
6824
  stt?: {
6610
- kind: "inference";
6611
6825
  model: string;
6826
+ kind: "inference";
6612
6827
  voice?: string | undefined;
6613
6828
  options?: Record<string, unknown> | undefined;
6614
6829
  } | {
6615
- kind: "plugin";
6830
+ options: Record<string, unknown>;
6616
6831
  provider: "deepgram" | "elevenlabs";
6832
+ kind: "plugin";
6617
6833
  class: "LLM" | "STT" | "STTv2" | "TTS";
6618
- options: Record<string, unknown>;
6619
6834
  } | {
6620
- kind: "realtime";
6621
- provider: "openai" | "google" | "xai";
6622
6835
  options: Record<string, unknown>;
6836
+ provider: "openai" | "google" | "xai";
6837
+ kind: "realtime";
6623
6838
  } | undefined;
6624
6839
  volume?: number | undefined;
6625
6840
  tts?: {
6626
- kind: "inference";
6627
6841
  model: string;
6842
+ kind: "inference";
6628
6843
  voice?: string | undefined;
6629
6844
  options?: Record<string, unknown> | undefined;
6630
6845
  } | {
6631
- kind: "plugin";
6846
+ options: Record<string, unknown>;
6632
6847
  provider: "deepgram" | "elevenlabs";
6848
+ kind: "plugin";
6633
6849
  class: "LLM" | "STT" | "STTv2" | "TTS";
6634
- options: Record<string, unknown>;
6635
6850
  } | {
6636
- kind: "realtime";
6637
- provider: "openai" | "google" | "xai";
6638
6851
  options: Record<string, unknown>;
6852
+ provider: "openai" | "google" | "xai";
6853
+ kind: "realtime";
6639
6854
  } | undefined;
6640
6855
  vadOptions?: {
6641
6856
  minSpeechDuration?: number | undefined;
@@ -7463,6 +7678,20 @@ export declare const notExists: (ref: TypedRef<unknown>) => LuaPredicate;
7463
7678
 
7464
7679
  export declare const notIn: <T extends string | number | boolean | null>(v: TypedRef<T>, set: T[]) => LuaPredicate;
7465
7680
 
7681
+ export declare interface OddsAnswer {
7682
+ type: 'odds';
7683
+ odds: number;
7684
+ }
7685
+
7686
+ export declare interface OddsQuestion {
7687
+ type: 'odds';
7688
+ instructions: string;
7689
+ criteria?: {
7690
+ yes?: string;
7691
+ no?: string;
7692
+ };
7693
+ }
7694
+
7466
7695
  export declare const or: (...args: LuaPredicate[]) => LuaPredicate;
7467
7696
 
7468
7697
  /**
@@ -8447,6 +8676,10 @@ declare const REASONING_EFFORT_VALUES: readonly ["off", "minimal", "low", "mediu
8447
8676
 
8448
8677
  declare type ReasoningEffort = (typeof REASONING_EFFORT_VALUES)[number];
8449
8678
 
8679
+ export declare interface RefusedAnswer {
8680
+ type: 'refused';
8681
+ }
8682
+
8450
8683
  export declare type ReplyChannel = 'whatsapp' | 'sms' | 'email' | 'webchat' | 'slack';
8451
8684
 
8452
8685
  declare interface RequestCredential {
@@ -8580,6 +8813,26 @@ declare interface ScopedPromoteFields {
8580
8813
  agentVersion?: number;
8581
8814
  }
8582
8815
 
8816
+ export declare interface ScoreAnswer {
8817
+ type: 'score';
8818
+ score: number;
8819
+ level: string;
8820
+ confidence: number;
8821
+ probabilities: Record<string, number>;
8822
+ uncertain: boolean;
8823
+ }
8824
+
8825
+ export declare interface ScoreLevel {
8826
+ label: string;
8827
+ description: string;
8828
+ }
8829
+
8830
+ export declare interface ScoreQuestion {
8831
+ type: 'score';
8832
+ instructions: string;
8833
+ levels: ReadonlyArray<string | ScoreLevel>;
8834
+ }
8835
+
8583
8836
  /**
8584
8837
  * Response from product search.
8585
8838
  */
@@ -9393,7 +9646,7 @@ export declare const Templates: {
9393
9646
  };
9394
9647
 
9395
9648
  /** Recorded effect kinds (DOC2 §7 seam table; `fetch` is sandbox egress record mode, §9.1). */
9396
- declare const TEST_EFFECT_KINDS: readonly ["channel.send", "whatsapp.template", "whatsapp.reaction", "whatsapp.phone_request", "email.send", "inbox.push", "voice.call", "passthrough", "mcp.tool", "supervision.write", "user.update_name", "browser.action", "jobs.create", "fetch", "refused", "metrics.record", "threads.open", "threads.follow_up", "secrets.request", "connection_request.create", "connection_request.reconnect", "connection_request.cancel", "ai.generate"];
9649
+ declare const TEST_EFFECT_KINDS: readonly ["channel.send", "whatsapp.template", "whatsapp.reaction", "whatsapp.phone_request", "email.send", "inbox.push", "voice.call", "passthrough", "mcp.tool", "supervision.write", "user.update_name", "browser.action", "jobs.create", "fetch", "refused", "metrics.record", "threads.open", "threads.follow_up", "secrets.request", "connection_request.create", "connection_request.reconnect", "connection_request.cancel", "ai.generate", "decisions.ask"];
9397
9650
 
9398
9651
  declare type TestEffectKind = (typeof TEST_EFFECT_KINDS)[number];
9399
9652