lua-cli 3.49.1 → 3.50.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.
@@ -30,6 +30,7 @@ import { WorkflowShellFn as WorkflowShell } from '@lua/shared-types/workflow-exe
30
30
  import { WorkflowShellValue } from '@lua/shared-types/workflow-exec';
31
31
  import { z } from 'zod';
32
32
  import { ZodType } from 'zod';
33
+ import type { ZodTypeDef } from 'zod';
33
34
 
34
35
  /**
35
36
  * `auto` (default, today's behaviour): every user-owned connection of the agent's creator auto-mounts on
@@ -707,9 +708,16 @@ export declare interface AgentsApi {
707
708
  }): Promise<unknown>;
708
709
  };
709
710
  versions(agentId: string): {
710
- list(opts?: {
711
- limit?: number;
712
- }): Promise<unknown>;
711
+ /**
712
+ * The target's agent versions, newest first (`supervision:observe`). `limit` is 1–50 (default 20). Optional:
713
+ * `status` keeps only those statuses (one, or a list); `offset` skips that many rows of the (filtered) list, so
714
+ * `{ limit: 50, offset: 50 }` is the second page. Page until a page is shorter than `limit`.
715
+ *
716
+ * Feature-detect: a platform older than these options ignores them and answers the newest `limit` rows of every
717
+ * status. Check that each row's `status` is one you asked for, and that an `offset` page starts BELOW the
718
+ * previous page's last `version`; if not, the platform does not support them yet.
719
+ */
720
+ list(opts?: SupervisionVersionsListOptions): Promise<unknown>;
713
721
  get(version: number): Promise<unknown>;
714
722
  diff(from: number, to: number): Promise<unknown>;
715
723
  /** Chat staged `version` (`supervision:preview`). No tools run unless `toolScope.skillIds` allowlists them. */
@@ -740,9 +748,11 @@ export declare interface AgentsApi {
740
748
  expectActive: number;
741
749
  }): Promise<unknown>;
742
750
  /**
743
- * Soft-delete `version` (`supervision:release`; only from a named workflow step). Refused
744
- * (409 `supervision_version_not_superseded`) unless the version is `superseded` — never the
745
- * active version, never the last one.
751
+ * Soft-delete `version` (`supervision:release`; only from a named workflow step): a `superseded`
752
+ * version, or a `staged` one that was never active, is over 24 hours old and is not the newest
753
+ * staged version. Never the active version, never the last one. Refusals (409):
754
+ * `supervision_version_not_superseded` (active, deleted), `supervision_version_staged_was_active`,
755
+ * `supervision_version_staged_too_recent`, `supervision_version_staged_newest`.
746
756
  */
747
757
  delete(version: number): Promise<{
748
758
  deleted: true;
@@ -1149,6 +1159,18 @@ export declare interface AgentsApi {
1149
1159
  */
1150
1160
  secrets(agentId: string): {
1151
1161
  attach(requestIds: string[]): Promise<SecretAttachResult>;
1162
+ /**
1163
+ * Write ONE secret row into `agentId`'s own Data, from CODE (a workflow step or a job) so the secret never passes
1164
+ * through a model prompt: the row of `collection` whose `_pk` is `key` is replaced whole by `value` (flat fields:
1165
+ * string, finite number, boolean or null; at most 32 fields, 8 KB a string, 16 KB in all), or created. The agent
1166
+ * reads it with its own `Data.get(collection, { _pk: key })`. Needs `supervision:act` on `agentId` AND the
1167
+ * collection in the grant's `secretWriteCollections` (set only by an org admin; deny by default). The collection is
1168
+ * write-only for you: `Agents.data(agentId)` refuses it. Answers `{ ok, id, fingerprint }` and never the value;
1169
+ * the fingerprint is `sha256:` + the first 16 hex of SHA-256 over the stored row as JSON with sorted keys (`_pk`
1170
+ * included), so a token-free nudge carrying it tells the agent whether it already holds the row. Refused
1171
+ * `supervision_secret_write_not_granted` / `supervision_secret_bad_args`; not available offline.
1172
+ */
1173
+ put(collection: string, key: string, value: Record<string, string | number | boolean | null>): Promise<SupervisedSecretPutResult>;
1152
1174
  };
1153
1175
  }
1154
1176
 
@@ -2032,7 +2054,7 @@ declare const BROWSER_COMMANDS: readonly [{
2032
2054
  readonly description: "Upload local file(s) to a file input. Args: selector, files[].";
2033
2055
  }, {
2034
2056
  readonly name: "find";
2035
- readonly description: "Act by semantic locator. Args: by(role|text|label|placeholder|alt|title|testid), query, action(click|fill|type|hover|focus|check|uncheck|text), value?, name?, exact?.";
2057
+ readonly description: "Act by semantic locator. Args: by(role|text|label|placeholder|alt|title|testid), query, action(click|fill|hover|check|text), value?, name?, exact?.";
2036
2058
  }, {
2037
2059
  readonly name: "act";
2038
2060
  readonly description: "Act on the page: ref+action (deterministic) or natural-language instruction (engine AI). Args: ref?, action?, value?, instruction?.";
@@ -2041,7 +2063,7 @@ declare const BROWSER_COMMANDS: readonly [{
2041
2063
  readonly description: "Extract data by natural-language instruction (engine AI). Args: instruction.";
2042
2064
  }, {
2043
2065
  readonly name: "wait";
2044
- readonly description: "Wait for a condition. Provide one of: selector(+state), ms, text, url, load, fn.";
2066
+ readonly description: "Wait for a condition. Provide one of: selector (waits until it is visible), ms, text, url, load, fn.";
2045
2067
  }, {
2046
2068
  readonly name: "tab";
2047
2069
  readonly description: "Manage tabs. Args: action(list|new|switch|close), target?, url?, label?.";
@@ -2065,7 +2087,7 @@ declare const BROWSER_COMMANDS: readonly [{
2065
2087
  readonly description: "Manage web storage. Args: area(local|session), action(get|set|clear), key?, value?.";
2066
2088
  }, {
2067
2089
  readonly name: "set";
2068
- readonly description: "Configure the browser. Args: setting(viewport|device|geo|headers|credentials|media), args[].";
2090
+ readonly description: "Configure the browser. Args: setting(viewport|device|geo|headers|credentials|media|offline), args[].";
2069
2091
  }, {
2070
2092
  readonly name: "download";
2071
2093
  readonly description: "Download a file (click a selector to trigger, or wait for one). Args: selector?, path?.";
@@ -2095,7 +2117,7 @@ declare const BROWSER_COMMANDS: readonly [{
2095
2117
  readonly description: "Low-level mouse. Args: action(move|down|up|wheel), x?, y?, button?, dy?, dx?.";
2096
2118
  }, {
2097
2119
  readonly name: "keyboard";
2098
- readonly description: "Low-level keyboard at focus. Args: action(type|inserttext|keydown|keyup), text?, key?.";
2120
+ readonly description: "Low-level keyboard at focus. Args: action(type|inserttext), text. Use press for single keys and chords.";
2099
2121
  }, {
2100
2122
  readonly name: "state";
2101
2123
  readonly description: "Persist/restore storage+auth state to a file. Args: action(save|load|list|clear), path?.";
@@ -2193,7 +2215,7 @@ export declare interface BrowserCommandInputs {
2193
2215
  find: BrowserSessionInput & {
2194
2216
  by: 'role' | 'text' | 'label' | 'placeholder' | 'alt' | 'title' | 'testid';
2195
2217
  query: string;
2196
- action: 'click' | 'fill' | 'type' | 'hover' | 'focus' | 'check' | 'uncheck' | 'text';
2218
+ action: 'click' | 'fill' | 'hover' | 'check' | 'text';
2197
2219
  value?: string;
2198
2220
  name?: string;
2199
2221
  exact?: boolean;
@@ -2209,7 +2231,7 @@ export declare interface BrowserCommandInputs {
2209
2231
  };
2210
2232
  wait: BrowserSessionInput & {
2211
2233
  selector?: string;
2212
- state?: 'visible' | 'hidden';
2234
+ state?: 'visible';
2213
2235
  ms?: number;
2214
2236
  text?: string;
2215
2237
  url?: string;
@@ -2287,9 +2309,8 @@ export declare interface BrowserCommandInputs {
2287
2309
  dx?: number;
2288
2310
  };
2289
2311
  keyboard: BrowserSessionInput & {
2290
- action: 'type' | 'inserttext' | 'keydown' | 'keyup';
2291
- text?: string;
2292
- key?: string;
2312
+ action: 'type' | 'inserttext';
2313
+ text: string;
2293
2314
  };
2294
2315
  state: BrowserSessionInput & {
2295
2316
  action: 'save' | 'load' | 'list' | 'clear';
@@ -2926,8 +2947,10 @@ export declare interface ChatHistoryMessage {
2926
2947
  * to render a "Voice call" divider in the thread.
2927
2948
  */
2928
2949
  source?: 'voice' | 'chat';
2929
- /** Concrete model that served this assistant turn, persisted in content metadata. */
2950
+ /** The model the assistant turn requested (catalog code), persisted in content metadata. */
2930
2951
  model?: string;
2952
+ /** The catalog code of the model that served the turn's final step; differs from `model` when a fallback answered. */
2953
+ servedModel?: string;
2931
2954
  /** True when the turn reached that model through the Auto selector. */
2932
2955
  autoModelRequested?: boolean;
2933
2956
  author?: {
@@ -3280,6 +3303,14 @@ declare interface CustomDataAPI {
3280
3303
  * @returns Promise resolving to delete response
3281
3304
  */
3282
3305
  delete(collectionName: string, entryId: string): Promise<DeleteCustomDataResponse>;
3306
+ /**
3307
+ * An org-shared Data collection (namespace) an org admin created and granted this agent. Returns the same surface
3308
+ * as `Data`, scoped to that namespace: `Data.shared('fleet_map').get('repos', { tier: 1 })`. Readers may call
3309
+ * `collections`, `get`, `getEntry` and `search`; writers may also `create`, `update`, `patch`, `increment` and
3310
+ * `delete`. A call outside the ACL rejects with `code === 'shared_data_forbidden'` (403). Deployed agents only:
3311
+ * local runs reject with `code === 'shared_data_unavailable_offline'`.
3312
+ */
3313
+ shared(name: string): SharedDataAPI;
3283
3314
  }
3284
3315
 
3285
3316
  /** One collection in the agent's Data namespace, from Data.collections(). */
@@ -3500,6 +3531,29 @@ export declare const Data: {
3500
3531
  * @returns Promise resolving when deletion is complete
3501
3532
  */
3502
3533
  delete(collectionName: string, entryId: string): Promise<DeleteCustomDataResponse>;
3534
+ /**
3535
+ * An org-shared Data collection (namespace). An org admin creates it and names which agents of the org may read
3536
+ * and which may write it (`POST /admin/orgs/:orgId/shared-collections`); agents never create one. The handle has
3537
+ * the same methods as `Data`, scoped to the namespace, so a namespace can hold several collections:
3538
+ *
3539
+ * ```typescript
3540
+ * const map = Data.shared('fleet_map');
3541
+ * await map.create('repos', { repo: 'lua-core-services', tier: 1 }, { searchText: 'backend monorepo' }); // writers
3542
+ * const { data } = await map.get('repos', { tier: 1 }); // readers
3543
+ * const hits = await map.search('edges', 'who calls lua-agents', 10);
3544
+ * ```
3545
+ *
3546
+ * - Readers may `collections`, `get`, `getEntry`, `search`; writers may also `create`, `update`, `patch`,
3547
+ * `increment`, `delete` (a writer can read). Anything else rejects with `code === 'shared_data_forbidden'`
3548
+ * (403) — also when the name does not exist or belongs to another org.
3549
+ * - Same limits, filters, managed indexes, compare-and-swap and vector search as `Data`. Every write is audited
3550
+ * (agent, collection, entry id; never the value).
3551
+ * - A test session may read but not write (`shared_data_test_session_write_refused`, 409).
3552
+ * - Deployed agents only: under `lua test` every call rejects with `code === 'shared_data_unavailable_offline'`.
3553
+ *
3554
+ * @param name - The shared collection name the org admin created (1-128 of `[A-Za-z0-9_.-]`)
3555
+ */
3556
+ shared(name: string): SharedDataAPI;
3503
3557
  };
3504
3558
 
3505
3559
  /**
@@ -3583,7 +3637,9 @@ declare const DECISION_ERROR_CODES: {
3583
3637
  readonly CANCELLED: "decision_cancelled";
3584
3638
  };
3585
3639
 
3586
- declare const DECISION_PROVIDERS: readonly ["jev", "openai"];
3640
+ declare const DECISION_FALLBACK_PROVIDERS: readonly ["jev", "openai"];
3641
+
3642
+ declare const DECISION_PROVIDERS: readonly ["jev", "openai", "openrouter"];
3587
3643
 
3588
3644
  declare const DECISION_ROUTING_RULES: readonly ["pinned", "images", "region", "zero_retention", "default", "fallback"];
3589
3645
 
@@ -3619,13 +3675,15 @@ export declare interface DecisionErrorFields {
3619
3675
  decisionId?: string;
3620
3676
  }
3621
3677
 
3622
- declare type DecisionFallback = DecisionProvider | 'none';
3678
+ declare type DecisionFallback = DecisionFallbackProvider | 'none';
3623
3679
 
3624
3680
  declare interface DecisionFallbackInfo {
3625
3681
  from: DecisionProvider;
3626
3682
  reason: string;
3627
3683
  }
3628
3684
 
3685
+ declare type DecisionFallbackProvider = (typeof DECISION_FALLBACK_PROVIDERS)[number];
3686
+
3629
3687
  declare interface DecisionImage {
3630
3688
  data: string;
3631
3689
  mimeType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
@@ -3824,7 +3882,7 @@ export declare function defineVoice(config: LuaVoiceConfig): LuaVoice;
3824
3882
  * routes: {
3825
3883
  * 'GET /tickets': route({
3826
3884
  * query: z.object({ status: z.enum(['open', 'closed']).default('open') }),
3827
- * handler: async ({ query }) => ({ items: (await Data.get('tickets', { filter: { status: query.status } })).data }),
3885
+ * handler: async ({ query }) => ({ items: (await Data.get('tickets', { status: query.status })).data }),
3828
3886
  * }),
3829
3887
  * 'POST /tickets/:id/close': route({
3830
3888
  * params: z.object({ id: z.string() }),
@@ -5614,6 +5672,10 @@ declare interface LlmContextStep {
5614
5672
  reasoningTokens?: number;
5615
5673
  /** The model id the provider says served the step (a fallback leg names itself here). Cost only. */
5616
5674
  model?: string;
5675
+ /** The catalog code of the leg that served the step. Audit only: settlement never reads it. */
5676
+ servedModel?: string;
5677
+ /** The step was rejected by an output processor and re-run; its reply never reached the user. Audit only. */
5678
+ discarded?: boolean;
5617
5679
  }
5618
5680
 
5619
5681
  declare type LoadState = 'load' | 'domcontentloaded' | 'networkidle';
@@ -9322,6 +9384,29 @@ declare interface RequestOverrides {
9322
9384
  signal?: AbortSignal;
9323
9385
  }
9324
9386
 
9387
+ /**
9388
+ * R13 — `ResolveApprovalResult` (§9.5.3; matches shared-types). LUA-759 (#2582 review): the no-op's `decidedBy` is
9389
+ * the spec's `WorkflowActorRef` — lua-api projects lua-core's trimmed `{kind, id, at, via}` record onto it, as it
9390
+ * does R12 / R36 / R37's `recorded.by` — never a string (the old `string` declaration printed `[object Object]`).
9391
+ */
9392
+ declare type ResolveApprovalResult = {
9393
+ resolved: true;
9394
+ outcome: 'approved' | 'denied';
9395
+ runStatus: WorkflowRunStatus;
9396
+ stepId?: string;
9397
+ } | {
9398
+ resolved: false;
9399
+ outcome: 'noop';
9400
+ reason: 'already_resolved' | 'expired' | 'cancelled' | 'run_gone';
9401
+ decision?: 'approved' | 'denied' | 'expired';
9402
+ /** `approveResultLine` prints it as `<subjectId> via <source>`; an older lua-api's raw lua-core actor falls back to `actorLabel`. */
9403
+ decidedBy?: {
9404
+ subjectType: string;
9405
+ subjectId: string;
9406
+ source: string;
9407
+ };
9408
+ };
9409
+
9325
9410
  /**
9326
9411
  * R12 — `ResumeStepResult` (§9.5.3): the loser of a resume race gets the recorded outcome, never a 4xx. LUA-738
9327
9412
  * (desktop #1018): `recorded.by` is the spec's `WorkflowActorRef` — lua-api projects lua-core's `{ kind, id }` onto
@@ -9373,14 +9458,20 @@ export declare interface RouteContext<P = Record<string, string>, Q = Record<str
9373
9458
  request: Request;
9374
9459
  }
9375
9460
 
9461
+ /**
9462
+ * The handler sees what a schema OUTPUTS (after `.default()`, `.transform()`, coercion), so only the
9463
+ * output type is inferred; the input type is left open (`unknown`, not `any`). `ZodType<P>` alone would also pin the input
9464
+ * to `P`, and `z.enum([...]).default('open')` (input `T | undefined`) would then make the handler's
9465
+ * value `T | undefined`.
9466
+ */
9376
9467
  export declare interface RouteDefinition<P = Record<string, string>, Q = Record<string, string | string[]>, B = unknown> {
9377
9468
  description?: string;
9378
9469
  /** Zod schema for path parameters; a failure answers 400 `VALIDATION`. */
9379
- params?: ZodType<P>;
9470
+ params?: ZodType<P, ZodTypeDef, unknown>;
9380
9471
  /** Zod schema for query parameters; a failure answers 400 `VALIDATION`. */
9381
- query?: ZodType<Q>;
9472
+ query?: ZodType<Q, ZodTypeDef, unknown>;
9382
9473
  /** Zod schema for the request body; a failure answers 400 `VALIDATION`. */
9383
- body?: ZodType<B>;
9474
+ body?: ZodType<B, ZodTypeDef, unknown>;
9384
9475
  /** Response schemas by status, for the typed client (not enforced at runtime). */
9385
9476
  responses?: Record<number, ZodType>;
9386
9477
  handler: (ctx: RouteContext<P, Q, B>) => Promise<RouteHandlerResult> | RouteHandlerResult;
@@ -9687,6 +9778,16 @@ export declare interface SendTemplateValues {
9687
9778
 
9688
9779
  export { SerializedWorkflowGraph }
9689
9780
 
9781
+ /** `Data.shared(name)`: the `Data` surface on an org-shared namespace (it does not nest). */
9782
+ export declare type SharedDataAPI = Omit<CustomDataAPI, 'shared'>;
9783
+
9784
+ /** Thrown by `Data.shared(name)` outside a deployed agent. `code` is the stable part. */
9785
+ export declare class SharedDataError extends Error {
9786
+ readonly code: string;
9787
+ readonly name = "SharedDataError";
9788
+ constructor(code: string, message: string);
9789
+ }
9790
+
9690
9791
  /** R14 — 202 `{ accepted:true, signalId, consumed, stepId? }` · 200 `{ accepted:true, duplicate:true }` · 202 `{ accepted:false, reason }`. */
9691
9792
  declare interface SignalRunResult {
9692
9793
  accepted: boolean;
@@ -9801,6 +9902,15 @@ export declare interface SupervisedJobRegisterResult {
9801
9902
  registered: boolean;
9802
9903
  }
9803
9904
 
9905
+ /** What `secrets.put` answers: never the value. */
9906
+ declare interface SupervisedSecretPutResult {
9907
+ ok: true;
9908
+ /** The Data entry id of the row written (stable across later puts of the same key). */
9909
+ id: string;
9910
+ /** {@link SUPERVISED_SECRET_FINGERPRINT_DOC}. */
9911
+ fingerprint: string;
9912
+ }
9913
+
9804
9914
  /** `workflows.get` — metadata only: never the graph, script, code or tools. */
9805
9915
  declare interface SupervisedWorkflow {
9806
9916
  workflowId: string;
@@ -10126,6 +10236,19 @@ declare interface SupervisionRunSummary {
10126
10236
  completedAt?: number;
10127
10237
  }
10128
10238
 
10239
+ /** Options of `Agents.versions(id).list` (supervision `versions.list`). */
10240
+ export declare interface SupervisionVersionsListOptions {
10241
+ /** Page size, 1–50 (default 20; larger values are clamped to 50). */
10242
+ limit?: number;
10243
+ /** Keep only these statuses (one, or a non-empty list). Omitted = every status, soft-deleted included. */
10244
+ status?: SupervisionVersionStatus | SupervisionVersionStatus[];
10245
+ /** Rows of the (filtered) newest-first list to skip, 0–10000 — `limit: 50, offset: 50` is the second page. */
10246
+ offset?: number;
10247
+ }
10248
+
10249
+ /** An agent version's lifecycle status, as a supervision `versions.list` filter. */
10250
+ export declare type SupervisionVersionStatus = 'active' | 'staged' | 'superseded' | 'deleted';
10251
+
10129
10252
  /**
10130
10253
  * Why an unattended run could not finish, reported by the agent itself instead
10131
10254
  * of being guessed from its prose. The platform — not the agent — writes every
@@ -11971,6 +12094,41 @@ export declare interface WorkflowsApi {
11971
12094
  note?: string;
11972
12095
  }): Promise<Record<string, unknown>>;
11973
12096
  };
12097
+ /**
12098
+ * Act as the SIGNED-IN VIEWER of a web-app route, never as the agent: the decision is authorized and audited
12099
+ * exactly as if that person decided it themselves (agent access, approver / four-eyes / step-up rules,
12100
+ * `decidedBy` = the viewer). Available only inside a `defineWebApp` route handler for a POST, PUT, PATCH or
12101
+ * DELETE call; anywhere else it throws `WorkflowsApiError` code `viewer_unavailable`. Under `lua apps dev` /
12102
+ * `lua test webapp` the route runs as you, so the call is made with your own CLI credentials.
12103
+ *
12104
+ * An approval that demands step-up or a specific surface answers `STEP_UP_REQUIRED` / `APPROVAL_SURFACE_DENIED`:
12105
+ * decide those in the Inbox. Other refusals pass through with their own codes (`NOT_AN_APPROVER`,
12106
+ * `FOUR_EYES_REQUIRED`, `APPROVAL_NOT_FOUND`, `PAYLOAD_MISMATCH`, …).
12107
+ *
12108
+ * @example
12109
+ * ```typescript
12110
+ * 'POST /approvals/:runId/:approvalId': route({
12111
+ * handler: async ({ params, body }) =>
12112
+ * json(await Workflows.viewer.decideApproval(params.runId, params.approvalId, { decision: body.decision, note: body.note })),
12113
+ * }),
12114
+ * ```
12115
+ */
12116
+ viewer: {
12117
+ /**
12118
+ * R13 — approve or deny an approval as the viewer. `agentId` names the agent that owns the run (default: the
12119
+ * app's own agent); the viewer must be able to decide on that agent's runs, as in the Inbox.
12120
+ */
12121
+ decideApproval(runId: string, approvalId: string, decision: {
12122
+ decision: 'approve' | 'deny';
12123
+ note?: string;
12124
+ expectedFingerprint?: string;
12125
+ agentId?: string;
12126
+ }): Promise<ResolveApprovalResult>;
12127
+ /** R12 — answer a step waiting for input (`suspend` / ask) as the viewer; `opts.agentId` as for decideApproval. */
12128
+ resume(runId: string, stepId: string, resumeData: unknown, opts?: {
12129
+ agentId?: string;
12130
+ }): Promise<ResumeStepResult>;
12131
+ };
11974
12132
  }
11975
12133
 
11976
12134
  export { WorkflowShell }