lua-cli 3.46.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
  /**
@@ -1884,10 +1886,37 @@ export declare enum BasketStatus {
1884
1886
  * Overrides platform-wide env var defaults for this specific agent.
1885
1887
  */
1886
1888
  export declare interface BatchingConfig {
1887
- /** Hold first message N ms before processing, to allow rapid follow-ups to batch together. 0 = disabled. */
1889
+ /**
1890
+ * Fixed hold applied to the first message of a turn before processing, so rapid
1891
+ * follow-ups can join it. 0 = disabled.
1892
+ *
1893
+ * This is a tax on EVERY turn, including single-message ones: `10000` delays every
1894
+ * reply by 10s whether or not the user sends a second message. Keep it small
1895
+ * (a few hundred ms to ~2s) unless your users routinely send bursts.
1896
+ */
1888
1897
  firstMessageDelayMs?: number;
1889
- /** Window to collect subsequent messages while one is in-flight (ms). 0 = batching disabled. */
1898
+ /**
1899
+ * Quiet period (ms) that collects subsequent messages while one is in-flight. 0 = batching disabled.
1900
+ *
1901
+ * The window SLIDES: every new message in the batch restarts it, so the reply goes out
1902
+ * `debounceWindowMs` after the user's LAST message. `30000` means a user who keeps typing
1903
+ * waits 30s after their final message. Larger values batch long bursts better but add
1904
+ * latency; pair a large value with `maxWaitMs` to bound the wait.
1905
+ */
1890
1906
  debounceWindowMs?: number;
1907
+ /**
1908
+ * Hard cap (ms) on how long a sliding debounce batch can be held, measured from batch
1909
+ * creation (the arrival of the message that formed the batch, not from the
1910
+ * `firstMessageDelayMs` hold). The batch fires on the quiet period OR this cap, whichever
1911
+ * comes first, so a continuous stream of messages cannot postpone the reply indefinitely.
1912
+ *
1913
+ * Optional; absent or 0 = no cap (the window slides until `maxBatchMessages` or silence).
1914
+ * If smaller than `debounceWindowMs`, the cap still applies from batch creation.
1915
+ * Per-agent only, no platform-wide default. Bounds the debounce wait only; the serialize-mode
1916
+ * wait for an in-flight turn is not covered. Measure the effect with
1917
+ * `lua_chat_stage_duration_seconds{stage="batch_wait"}`.
1918
+ */
1919
+ maxWaitMs?: number;
1891
1920
  /** Maximum messages collected in a single batch. */
1892
1921
  maxBatchMessages?: number;
1893
1922
  /**
@@ -2371,6 +2400,8 @@ export declare interface ChatHistoryMessage {
2371
2400
  agentId: string;
2372
2401
  name?: string;
2373
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;
2374
2405
  /**
2375
2406
  * Permanent recording for a voice-note turn (Lua Desktop). Populated by the
2376
2407
  * admin threads history endpoint from the row's `content.metadata.audio` — a
@@ -2392,6 +2423,20 @@ export declare type ChatMessage = TextMessage | ImageMessage | FileMessage;
2392
2423
  /** wave 2 U33 — the typed refusal `Integrations.checkAsUser` raises outside a live chat turn. */
2393
2424
  export declare function checkAsUserRequiresUser(): Error;
2394
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
+
2395
2440
  /**
2396
2441
  * U6 (wave 2) — connection inspection, account pinning and capability checks; U33 — the same checks run
2397
2442
  * with the CONVERSATION USER's principal. Owner: U6 (catalogue, list, pin, check, cleanup); U33 owns only
@@ -2986,6 +3031,137 @@ export declare class DataEntryInstance {
2986
3031
 
2987
3032
  export { DatasetRef }
2988
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
+
2989
3165
  /**
2990
3166
  * Define a device that an agent can communicate with.
2991
3167
  *
@@ -3914,6 +4090,11 @@ declare abstract class HttpClient {
3914
4090
  * @protected
3915
4091
  */
3916
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>>;
3917
4098
  /**
3918
4099
  * Performs an HTTP PATCH request
3919
4100
  * @param url - The relative URL path to request (will be appended to baseUrl)
@@ -4352,6 +4533,8 @@ declare interface Job {
4352
4533
  updatedAt: string;
4353
4534
  dynamic?: boolean;
4354
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;
4355
4538
  metadata?: Record<string, any>;
4356
4539
  versions: JobVersion[];
4357
4540
  lastExecution?: JobExecution;
@@ -4839,6 +5022,42 @@ export declare const lit: <const V extends string | number | boolean | null>(v:
4839
5022
 
4840
5023
  export { Literal }
4841
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
+
4842
5061
  /**
4843
5062
  * Structured logging: `log.debug/info/warn/error(message, fields?)`.
4844
5063
  *
@@ -4966,6 +5185,7 @@ export declare class LuaAgent {
4966
5185
  private readonly devices;
4967
5186
  private readonly deviceTriggers;
4968
5187
  private readonly voices?;
5188
+ private readonly decisions;
4969
5189
  private readonly batching?;
4970
5190
  private readonly governance?;
4971
5191
  private readonly browser?;
@@ -5006,6 +5226,7 @@ export declare class LuaAgent {
5006
5226
  getBatching(): BatchingConfig | undefined;
5007
5227
  getDevices(): LuaDevice[];
5008
5228
  getVoices(): LuaVoice[] | undefined;
5229
+ getDecisions(): LuaDecision[];
5009
5230
  }
5010
5231
 
5011
5232
  export declare interface LuaAgentConfig {
@@ -5063,6 +5284,7 @@ export declare interface LuaAgentConfig {
5063
5284
  * single-element array — `voices: [supportVoice]`.
5064
5285
  */
5065
5286
  voices?: LuaVoice[];
5287
+ decisions?: LuaDecision[];
5066
5288
  /** Per-agent message batching/debounce configuration. Overrides platform env var defaults. */
5067
5289
  batching?: BatchingConfig;
5068
5290
  /** Governance policy configuration. When set, tool calls, preprocessors, and postprocessors are governed. */
@@ -5101,6 +5323,26 @@ export declare type LuaAgentModel = string | ((request: LuaRequest) => string |
5101
5323
  /** The signed-in person a route runs for (never an API key, never anonymous). */
5102
5324
  export declare type LuaAuth = WebRouteAuth;
5103
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
+
5104
5346
  /**
5105
5347
  * LuaDevice class — represents an external device that an agent can communicate with.
5106
5348
  *
@@ -5943,15 +6185,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
5943
6185
  */
5944
6186
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5945
6187
  }, "strip", z.ZodTypeAny, {
5946
- kind: "inference";
5947
6188
  model: string;
5948
- options?: Record<string, unknown> | undefined;
6189
+ kind: "inference";
5949
6190
  voice?: string | undefined;
6191
+ options?: Record<string, unknown> | undefined;
5950
6192
  }, {
5951
- kind: "inference";
5952
6193
  model: string;
5953
- options?: Record<string, unknown> | undefined;
6194
+ kind: "inference";
5954
6195
  voice?: string | undefined;
6196
+ options?: Record<string, unknown> | undefined;
5955
6197
  }>, z.ZodObject<{
5956
6198
  kind: z.ZodLiteral<"plugin">;
5957
6199
  provider: z.ZodEnum<["deepgram", "elevenlabs"]>;
@@ -5964,14 +6206,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
5964
6206
  */
5965
6207
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
5966
6208
  }, "strip", z.ZodTypeAny, {
5967
- kind: "plugin";
5968
6209
  options: Record<string, unknown>;
5969
6210
  provider: "deepgram" | "elevenlabs";
6211
+ kind: "plugin";
5970
6212
  class: "LLM" | "STT" | "STTv2" | "TTS";
5971
6213
  }, {
5972
- kind: "plugin";
5973
6214
  options: Record<string, unknown>;
5974
6215
  provider: "deepgram" | "elevenlabs";
6216
+ kind: "plugin";
5975
6217
  class: "LLM" | "STT" | "STTv2" | "TTS";
5976
6218
  }>, z.ZodObject<{
5977
6219
  kind: z.ZodLiteral<"realtime">;
@@ -5984,13 +6226,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
5984
6226
  */
5985
6227
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
5986
6228
  }, "strip", z.ZodTypeAny, {
5987
- kind: "realtime";
5988
6229
  options: Record<string, unknown>;
5989
6230
  provider: "openai" | "google" | "xai";
5990
- }, {
5991
6231
  kind: "realtime";
6232
+ }, {
5992
6233
  options: Record<string, unknown>;
5993
6234
  provider: "openai" | "google" | "xai";
6235
+ kind: "realtime";
5994
6236
  }>]>;
5995
6237
  stt: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
5996
6238
  kind: z.ZodLiteral<"inference">;
@@ -6009,15 +6251,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6009
6251
  */
6010
6252
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
6011
6253
  }, "strip", z.ZodTypeAny, {
6012
- kind: "inference";
6013
6254
  model: string;
6014
- options?: Record<string, unknown> | undefined;
6255
+ kind: "inference";
6015
6256
  voice?: string | undefined;
6257
+ options?: Record<string, unknown> | undefined;
6016
6258
  }, {
6017
- kind: "inference";
6018
6259
  model: string;
6019
- options?: Record<string, unknown> | undefined;
6260
+ kind: "inference";
6020
6261
  voice?: string | undefined;
6262
+ options?: Record<string, unknown> | undefined;
6021
6263
  }>, z.ZodObject<{
6022
6264
  kind: z.ZodLiteral<"plugin">;
6023
6265
  provider: z.ZodEnum<["deepgram", "elevenlabs"]>;
@@ -6030,14 +6272,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6030
6272
  */
6031
6273
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6032
6274
  }, "strip", z.ZodTypeAny, {
6033
- kind: "plugin";
6034
6275
  options: Record<string, unknown>;
6035
6276
  provider: "deepgram" | "elevenlabs";
6277
+ kind: "plugin";
6036
6278
  class: "LLM" | "STT" | "STTv2" | "TTS";
6037
6279
  }, {
6038
- kind: "plugin";
6039
6280
  options: Record<string, unknown>;
6040
6281
  provider: "deepgram" | "elevenlabs";
6282
+ kind: "plugin";
6041
6283
  class: "LLM" | "STT" | "STTv2" | "TTS";
6042
6284
  }>, z.ZodObject<{
6043
6285
  kind: z.ZodLiteral<"realtime">;
@@ -6050,13 +6292,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6050
6292
  */
6051
6293
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6052
6294
  }, "strip", z.ZodTypeAny, {
6053
- kind: "realtime";
6054
6295
  options: Record<string, unknown>;
6055
6296
  provider: "openai" | "google" | "xai";
6056
- }, {
6057
6297
  kind: "realtime";
6298
+ }, {
6058
6299
  options: Record<string, unknown>;
6059
6300
  provider: "openai" | "google" | "xai";
6301
+ kind: "realtime";
6060
6302
  }>]>>;
6061
6303
  tts: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
6062
6304
  kind: z.ZodLiteral<"inference">;
@@ -6075,15 +6317,15 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6075
6317
  */
6076
6318
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
6077
6319
  }, "strip", z.ZodTypeAny, {
6078
- kind: "inference";
6079
6320
  model: string;
6080
- options?: Record<string, unknown> | undefined;
6321
+ kind: "inference";
6081
6322
  voice?: string | undefined;
6323
+ options?: Record<string, unknown> | undefined;
6082
6324
  }, {
6083
- kind: "inference";
6084
6325
  model: string;
6085
- options?: Record<string, unknown> | undefined;
6326
+ kind: "inference";
6086
6327
  voice?: string | undefined;
6328
+ options?: Record<string, unknown> | undefined;
6087
6329
  }>, z.ZodObject<{
6088
6330
  kind: z.ZodLiteral<"plugin">;
6089
6331
  provider: z.ZodEnum<["deepgram", "elevenlabs"]>;
@@ -6096,14 +6338,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6096
6338
  */
6097
6339
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6098
6340
  }, "strip", z.ZodTypeAny, {
6099
- kind: "plugin";
6100
6341
  options: Record<string, unknown>;
6101
6342
  provider: "deepgram" | "elevenlabs";
6343
+ kind: "plugin";
6102
6344
  class: "LLM" | "STT" | "STTv2" | "TTS";
6103
6345
  }, {
6104
- kind: "plugin";
6105
6346
  options: Record<string, unknown>;
6106
6347
  provider: "deepgram" | "elevenlabs";
6348
+ kind: "plugin";
6107
6349
  class: "LLM" | "STT" | "STTv2" | "TTS";
6108
6350
  }>, z.ZodObject<{
6109
6351
  kind: z.ZodLiteral<"realtime">;
@@ -6116,13 +6358,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6116
6358
  */
6117
6359
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6118
6360
  }, "strip", z.ZodTypeAny, {
6119
- kind: "realtime";
6120
6361
  options: Record<string, unknown>;
6121
6362
  provider: "openai" | "google" | "xai";
6122
- }, {
6123
6363
  kind: "realtime";
6364
+ }, {
6124
6365
  options: Record<string, unknown>;
6125
6366
  provider: "openai" | "google" | "xai";
6367
+ kind: "realtime";
6126
6368
  }>]>>;
6127
6369
  vad: z.ZodOptional<z.ZodString>;
6128
6370
  vadOptions: z.ZodOptional<z.ZodObject<{
@@ -6281,52 +6523,52 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6281
6523
  excludeTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6282
6524
  }, "strip", z.ZodTypeAny, {
6283
6525
  llm: {
6284
- kind: "inference";
6285
6526
  model: string;
6286
- options?: Record<string, unknown> | undefined;
6527
+ kind: "inference";
6287
6528
  voice?: string | undefined;
6529
+ options?: Record<string, unknown> | undefined;
6288
6530
  } | {
6289
- kind: "plugin";
6290
6531
  options: Record<string, unknown>;
6291
6532
  provider: "deepgram" | "elevenlabs";
6533
+ kind: "plugin";
6292
6534
  class: "LLM" | "STT" | "STTv2" | "TTS";
6293
6535
  } | {
6294
- kind: "realtime";
6295
6536
  options: Record<string, unknown>;
6296
6537
  provider: "openai" | "google" | "xai";
6538
+ kind: "realtime";
6297
6539
  };
6298
6540
  name?: string | undefined;
6299
6541
  vad?: string | undefined;
6300
6542
  stt?: {
6301
- kind: "inference";
6302
6543
  model: string;
6303
- options?: Record<string, unknown> | undefined;
6544
+ kind: "inference";
6304
6545
  voice?: string | undefined;
6546
+ options?: Record<string, unknown> | undefined;
6305
6547
  } | {
6306
- kind: "plugin";
6307
6548
  options: Record<string, unknown>;
6308
6549
  provider: "deepgram" | "elevenlabs";
6550
+ kind: "plugin";
6309
6551
  class: "LLM" | "STT" | "STTv2" | "TTS";
6310
6552
  } | {
6311
- kind: "realtime";
6312
6553
  options: Record<string, unknown>;
6313
6554
  provider: "openai" | "google" | "xai";
6555
+ kind: "realtime";
6314
6556
  } | undefined;
6315
6557
  volume?: number | undefined;
6316
6558
  tts?: {
6317
- kind: "inference";
6318
6559
  model: string;
6319
- options?: Record<string, unknown> | undefined;
6560
+ kind: "inference";
6320
6561
  voice?: string | undefined;
6562
+ options?: Record<string, unknown> | undefined;
6321
6563
  } | {
6322
- kind: "plugin";
6323
6564
  options: Record<string, unknown>;
6324
6565
  provider: "deepgram" | "elevenlabs";
6566
+ kind: "plugin";
6325
6567
  class: "LLM" | "STT" | "STTv2" | "TTS";
6326
6568
  } | {
6327
- kind: "realtime";
6328
6569
  options: Record<string, unknown>;
6329
6570
  provider: "openai" | "google" | "xai";
6571
+ kind: "realtime";
6330
6572
  } | undefined;
6331
6573
  vadOptions?: {
6332
6574
  minSpeechDuration?: number | undefined;
@@ -6375,52 +6617,52 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6375
6617
  excludeTools?: string[] | undefined;
6376
6618
  }, {
6377
6619
  llm: {
6378
- kind: "inference";
6379
6620
  model: string;
6380
- options?: Record<string, unknown> | undefined;
6621
+ kind: "inference";
6381
6622
  voice?: string | undefined;
6623
+ options?: Record<string, unknown> | undefined;
6382
6624
  } | {
6383
- kind: "plugin";
6384
6625
  options: Record<string, unknown>;
6385
6626
  provider: "deepgram" | "elevenlabs";
6627
+ kind: "plugin";
6386
6628
  class: "LLM" | "STT" | "STTv2" | "TTS";
6387
6629
  } | {
6388
- kind: "realtime";
6389
6630
  options: Record<string, unknown>;
6390
6631
  provider: "openai" | "google" | "xai";
6632
+ kind: "realtime";
6391
6633
  };
6392
6634
  name?: string | undefined;
6393
6635
  vad?: string | undefined;
6394
6636
  stt?: {
6395
- kind: "inference";
6396
6637
  model: string;
6397
- options?: Record<string, unknown> | undefined;
6638
+ kind: "inference";
6398
6639
  voice?: string | undefined;
6640
+ options?: Record<string, unknown> | undefined;
6399
6641
  } | {
6400
- kind: "plugin";
6401
6642
  options: Record<string, unknown>;
6402
6643
  provider: "deepgram" | "elevenlabs";
6644
+ kind: "plugin";
6403
6645
  class: "LLM" | "STT" | "STTv2" | "TTS";
6404
6646
  } | {
6405
- kind: "realtime";
6406
6647
  options: Record<string, unknown>;
6407
6648
  provider: "openai" | "google" | "xai";
6649
+ kind: "realtime";
6408
6650
  } | undefined;
6409
6651
  volume?: number | undefined;
6410
6652
  tts?: {
6411
- kind: "inference";
6412
6653
  model: string;
6413
- options?: Record<string, unknown> | undefined;
6654
+ kind: "inference";
6414
6655
  voice?: string | undefined;
6656
+ options?: Record<string, unknown> | undefined;
6415
6657
  } | {
6416
- kind: "plugin";
6417
6658
  options: Record<string, unknown>;
6418
6659
  provider: "deepgram" | "elevenlabs";
6660
+ kind: "plugin";
6419
6661
  class: "LLM" | "STT" | "STTv2" | "TTS";
6420
6662
  } | {
6421
- kind: "realtime";
6422
6663
  options: Record<string, unknown>;
6423
6664
  provider: "openai" | "google" | "xai";
6665
+ kind: "realtime";
6424
6666
  } | undefined;
6425
6667
  vadOptions?: {
6426
6668
  minSpeechDuration?: number | undefined;
@@ -6469,52 +6711,52 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6469
6711
  excludeTools?: string[] | undefined;
6470
6712
  }>, {
6471
6713
  llm: {
6472
- kind: "inference";
6473
6714
  model: string;
6474
- options?: Record<string, unknown> | undefined;
6715
+ kind: "inference";
6475
6716
  voice?: string | undefined;
6717
+ options?: Record<string, unknown> | undefined;
6476
6718
  } | {
6477
- kind: "plugin";
6478
6719
  options: Record<string, unknown>;
6479
6720
  provider: "deepgram" | "elevenlabs";
6721
+ kind: "plugin";
6480
6722
  class: "LLM" | "STT" | "STTv2" | "TTS";
6481
6723
  } | {
6482
- kind: "realtime";
6483
6724
  options: Record<string, unknown>;
6484
6725
  provider: "openai" | "google" | "xai";
6726
+ kind: "realtime";
6485
6727
  };
6486
6728
  name?: string | undefined;
6487
6729
  vad?: string | undefined;
6488
6730
  stt?: {
6489
- kind: "inference";
6490
6731
  model: string;
6491
- options?: Record<string, unknown> | undefined;
6732
+ kind: "inference";
6492
6733
  voice?: string | undefined;
6734
+ options?: Record<string, unknown> | undefined;
6493
6735
  } | {
6494
- kind: "plugin";
6495
6736
  options: Record<string, unknown>;
6496
6737
  provider: "deepgram" | "elevenlabs";
6738
+ kind: "plugin";
6497
6739
  class: "LLM" | "STT" | "STTv2" | "TTS";
6498
6740
  } | {
6499
- kind: "realtime";
6500
6741
  options: Record<string, unknown>;
6501
6742
  provider: "openai" | "google" | "xai";
6743
+ kind: "realtime";
6502
6744
  } | undefined;
6503
6745
  volume?: number | undefined;
6504
6746
  tts?: {
6505
- kind: "inference";
6506
6747
  model: string;
6507
- options?: Record<string, unknown> | undefined;
6748
+ kind: "inference";
6508
6749
  voice?: string | undefined;
6750
+ options?: Record<string, unknown> | undefined;
6509
6751
  } | {
6510
- kind: "plugin";
6511
6752
  options: Record<string, unknown>;
6512
6753
  provider: "deepgram" | "elevenlabs";
6754
+ kind: "plugin";
6513
6755
  class: "LLM" | "STT" | "STTv2" | "TTS";
6514
6756
  } | {
6515
- kind: "realtime";
6516
6757
  options: Record<string, unknown>;
6517
6758
  provider: "openai" | "google" | "xai";
6759
+ kind: "realtime";
6518
6760
  } | undefined;
6519
6761
  vadOptions?: {
6520
6762
  minSpeechDuration?: number | undefined;
@@ -6563,52 +6805,52 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
6563
6805
  excludeTools?: string[] | undefined;
6564
6806
  }, {
6565
6807
  llm: {
6566
- kind: "inference";
6567
6808
  model: string;
6568
- options?: Record<string, unknown> | undefined;
6809
+ kind: "inference";
6569
6810
  voice?: string | undefined;
6811
+ options?: Record<string, unknown> | undefined;
6570
6812
  } | {
6571
- kind: "plugin";
6572
6813
  options: Record<string, unknown>;
6573
6814
  provider: "deepgram" | "elevenlabs";
6815
+ kind: "plugin";
6574
6816
  class: "LLM" | "STT" | "STTv2" | "TTS";
6575
6817
  } | {
6576
- kind: "realtime";
6577
6818
  options: Record<string, unknown>;
6578
6819
  provider: "openai" | "google" | "xai";
6820
+ kind: "realtime";
6579
6821
  };
6580
6822
  name?: string | undefined;
6581
6823
  vad?: string | undefined;
6582
6824
  stt?: {
6583
- kind: "inference";
6584
6825
  model: string;
6585
- options?: Record<string, unknown> | undefined;
6826
+ kind: "inference";
6586
6827
  voice?: string | undefined;
6828
+ options?: Record<string, unknown> | undefined;
6587
6829
  } | {
6588
- kind: "plugin";
6589
6830
  options: Record<string, unknown>;
6590
6831
  provider: "deepgram" | "elevenlabs";
6832
+ kind: "plugin";
6591
6833
  class: "LLM" | "STT" | "STTv2" | "TTS";
6592
6834
  } | {
6593
- kind: "realtime";
6594
6835
  options: Record<string, unknown>;
6595
6836
  provider: "openai" | "google" | "xai";
6837
+ kind: "realtime";
6596
6838
  } | undefined;
6597
6839
  volume?: number | undefined;
6598
6840
  tts?: {
6599
- kind: "inference";
6600
6841
  model: string;
6601
- options?: Record<string, unknown> | undefined;
6842
+ kind: "inference";
6602
6843
  voice?: string | undefined;
6844
+ options?: Record<string, unknown> | undefined;
6603
6845
  } | {
6604
- kind: "plugin";
6605
6846
  options: Record<string, unknown>;
6606
6847
  provider: "deepgram" | "elevenlabs";
6848
+ kind: "plugin";
6607
6849
  class: "LLM" | "STT" | "STTv2" | "TTS";
6608
6850
  } | {
6609
- kind: "realtime";
6610
6851
  options: Record<string, unknown>;
6611
6852
  provider: "openai" | "google" | "xai";
6853
+ kind: "realtime";
6612
6854
  } | undefined;
6613
6855
  vadOptions?: {
6614
6856
  minSpeechDuration?: number | undefined;
@@ -7436,6 +7678,20 @@ export declare const notExists: (ref: TypedRef<unknown>) => LuaPredicate;
7436
7678
 
7437
7679
  export declare const notIn: <T extends string | number | boolean | null>(v: TypedRef<T>, set: T[]) => LuaPredicate;
7438
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
+
7439
7695
  export declare const or: (...args: LuaPredicate[]) => LuaPredicate;
7440
7696
 
7441
7697
  /**
@@ -8420,6 +8676,10 @@ declare const REASONING_EFFORT_VALUES: readonly ["off", "minimal", "low", "mediu
8420
8676
 
8421
8677
  declare type ReasoningEffort = (typeof REASONING_EFFORT_VALUES)[number];
8422
8678
 
8679
+ export declare interface RefusedAnswer {
8680
+ type: 'refused';
8681
+ }
8682
+
8423
8683
  export declare type ReplyChannel = 'whatsapp' | 'sms' | 'email' | 'webchat' | 'slack';
8424
8684
 
8425
8685
  declare interface RequestCredential {
@@ -8553,6 +8813,26 @@ declare interface ScopedPromoteFields {
8553
8813
  agentVersion?: number;
8554
8814
  }
8555
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
+
8556
8836
  /**
8557
8837
  * Response from product search.
8558
8838
  */
@@ -9366,7 +9646,7 @@ export declare const Templates: {
9366
9646
  };
9367
9647
 
9368
9648
  /** Recorded effect kinds (DOC2 §7 seam table; `fetch` is sandbox egress record mode, §9.1). */
9369
- 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"];
9370
9650
 
9371
9651
  declare type TestEffectKind = (typeof TEST_EFFECT_KINDS)[number];
9372
9652
 
@@ -9827,6 +10107,10 @@ declare interface UserDataAPI {
9827
10107
  set?: Record<string, any>;
9828
10108
  unset?: string[];
9829
10109
  }): Promise<any>;
10110
+ /** Publishes the user's My work list (LUA-1028), replacing the previous one. */
10111
+ setWorkItems(items: WorkItem[]): Promise<any>;
10112
+ /** Removes the user's My work list. */
10113
+ clearWorkItems(): Promise<any>;
9830
10114
  /**
9831
10115
  * Clears user data.
9832
10116
  * @returns Promise resolving when data is cleared
@@ -9883,7 +10167,23 @@ export declare class UserDataInstance {
9883
10167
  }): Promise<any>;
9884
10168
  unset(...fields: string[]): Promise<any>;
9885
10169
  /**
9886
- * Clears all user data for the current user
10170
+ * Publishes this user's My work list (LUA-1028): the open work they see in Frontline's "My work",
10171
+ * replacing the previous list. Publish whenever the work changes, for everyone it affects.
10172
+ * @param items - At most 100 items; each `action` is the message sent when the user taps it
10173
+ * @throws Error naming the first invalid item (nothing is sent), or if the write fails
10174
+ *
10175
+ * @example
10176
+ * const technician = await User.get({ phone: '+254700000000' });
10177
+ * await technician?.setWorkItems([
10178
+ * { id: 'MNT-00123', title: 'MNT-00123 · Fryer not heating', group: 'Assigned to you',
10179
+ * status: 'In progress', updatedAt: new Date(), action: 'Show MNT-00123' },
10180
+ * ]);
10181
+ */
10182
+ setWorkItems(items: WorkItem[]): Promise<void>;
10183
+ /** Removes this user's My work list. */
10184
+ clearWorkItems(): Promise<void>;
10185
+ /**
10186
+ * Clears all user data for the current user (the My work list included)
9887
10187
  * @returns Promise resolving to `{ success: true }` if clearing was successful
9888
10188
  * @throws Error if the clear operation fails
9889
10189
  */
@@ -11267,6 +11567,27 @@ declare type WorkflowTier = (typeof WORKFLOW_TIERS)[number];
11267
11567
 
11268
11568
  export declare type WorkflowWorkspaceBackend = 'ebs' | 'efs' | 's3';
11269
11569
 
11570
+ /** One item as an agent publishes it. */
11571
+ export declare interface WorkItem {
11572
+ /** Stable id within the list (e.g. a ticket number). */
11573
+ id: string;
11574
+ /** One line the user recognises, e.g. "MNT-00123 · Fryer not heating". */
11575
+ title: string;
11576
+ /** Display group chosen by the agent, e.g. "Waiting on you", "Your tickets". */
11577
+ group: string;
11578
+ /** The user's own action is needed (a fix to confirm, an approval to give); listed first. */
11579
+ needsAction?: boolean;
11580
+ /** Short status label, e.g. "In progress". */
11581
+ status?: string;
11582
+ /** When the work last changed. */
11583
+ updatedAt: string | Date;
11584
+ /**
11585
+ * The message the user's client sends when the item is tapped. A show/open request
11586
+ * ("Show MNT-00123"), never a decision: decisions are made in the conversation.
11587
+ */
11588
+ action: string;
11589
+ }
11590
+
11270
11591
  export declare type WorkspaceSpec = {
11271
11592
  kind: 'git';
11272
11593
  repo: string | TemplateBinding;