lua-cli 3.53.0 → 3.54.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.
@@ -189,6 +189,17 @@ declare interface AgentDirectoryEntry {
189
189
  callerActions: string[];
190
190
  }
191
191
 
192
+ /**
193
+ * A fresh agent identity assertion (ADR 0025): a 60-second, single-use, platform-signed proof that the call comes
194
+ * from a live execution of this agent.
195
+ */
196
+ export declare interface AgentIdentityAssertion {
197
+ /** Send as the `X-Lua-Agent-Assertion` header on ONE call to the system named by `audience`. */
198
+ token: string;
199
+ /** ISO-8601 instant the token expires (60 s after it was minted). */
200
+ expiresAt: string;
201
+ }
202
+
192
203
  /**
193
204
  * Narrowed, wire-safe output for `Agents.invoke`. A slice of the internal
194
205
  * `FullOutput` shape — raw Mastra steps / tripwire payloads are intentionally
@@ -3870,6 +3881,10 @@ export declare function defineVoice(config: LuaVoiceConfig): LuaVoice;
3870
3881
  /**
3871
3882
  * Define a web app on the agent.
3872
3883
  *
3884
+ * `GET` routes must only read. People a view was shared with view-only (`auth.accessLevel === 'view_only'`) can call
3885
+ * every `GET` route with the agent's own data and connections, and nothing else; any change belongs in a
3886
+ * `POST`, `PUT`, `PATCH` or `DELETE` route, which only people with full access reach.
3887
+ *
3873
3888
  * @example
3874
3889
  * ```typescript
3875
3890
  * import { defineWebApp, route, json } from 'lua-cli';
@@ -5946,7 +5961,14 @@ export declare interface LuaAgentConfig {
5946
5961
  */
5947
5962
  export declare type LuaAgentModel = string | ((request: LuaRequest) => string | Promise<string>);
5948
5963
 
5949
- /** The signed-in person a route runs for (never an API key, never anonymous). */
5964
+ /**
5965
+ * The signed-in person a route runs for (never an API key, never anonymous).
5966
+ *
5967
+ * `auth.accessLevel` says how much of the app they may use: `'full'` when they can read the app's agent, or
5968
+ * `'view_only'` when someone shared just this view with them (or it is org-wide in their workspace) — then only
5969
+ * `GET` routes reach your handlers, `roles` and `scopes` are empty, and the agent pane is off. A `GET` route must
5970
+ * therefore only read: never create, change or delete anything in one.
5971
+ */
5950
5972
  export declare type LuaAuth = WebRouteAuth;
5951
5973
 
5952
5974
  export declare class LuaBrowser {
@@ -6122,6 +6144,29 @@ export declare interface LuaDeviceTriggerConfig {
6122
6144
  execute: (payload: any, context: DeviceTriggerContext) => Promise<any>;
6123
6145
  }
6124
6146
 
6147
+ /**
6148
+ * The agent's own identity, proven by the platform (ADR 0025).
6149
+ */
6150
+ export declare interface LuaIdentity {
6151
+ /**
6152
+ * Mint a fresh agent identity assertion for `audience`. Only platform-allowlisted audiences are minted; today
6153
+ * that is `'lua-api:staff'` (Lua's staff API, for an agent enrolled as a staff service principal).
6154
+ *
6155
+ * Throws an `AgentIdentityError` (`err.code`):
6156
+ * - `agent_identity_requires_live_execution` outside a live execution (always in `lua test` / `lua dev`);
6157
+ * - `agent_identity_audience_not_allowed` for any other audience;
6158
+ * - `agent_identity_input_invalid` when `audience` is missing;
6159
+ * - `agent_identity_unavailable` when the platform cannot mint one right now.
6160
+ *
6161
+ * Inside a test session it throws a `TestSessionError` with `test_session_tier_unsupported` instead.
6162
+ *
6163
+ * Mint one per call. A token is single-use, so never cache or reuse it.
6164
+ */
6165
+ assertion(input: {
6166
+ audience: string;
6167
+ }): Promise<AgentIdentityAssertion>;
6168
+ }
6169
+
6125
6170
  /**
6126
6171
  * Lua Job class.
6127
6172
  * Main class for building scheduled jobs (cron jobs, one-time tasks, intervals).
@@ -6469,6 +6514,11 @@ export declare interface LuaRequest {
6469
6514
  export declare interface LuaRuntime {
6470
6515
  /** Request context information */
6471
6516
  request: LuaRequest;
6517
+ /**
6518
+ * The agent's platform-proven identity (ADR 0025). Optional because older runtimes do not provide it, so read it
6519
+ * defensively: `Lua.identity?.assertion`.
6520
+ */
6521
+ identity?: LuaIdentity;
6472
6522
  }
6473
6523
 
6474
6524
  /**
@@ -6584,6 +6634,25 @@ export declare interface LuaTool<TInput extends ZodType = ZodType> {
6584
6634
  name: string;
6585
6635
  /** Description of what the tool does */
6586
6636
  description: string;
6637
+ /**
6638
+ * Optional text the chat shows to the user while this tool runs and after it
6639
+ * finishes, instead of the tool's name. Either one text for both moments, or
6640
+ * one for each:
6641
+ *
6642
+ * ```ts
6643
+ * label = { running: 'Creating a ticket for {subject}', done: 'Created a ticket for {subject}' };
6644
+ * label = 'Checked stock';
6645
+ * ```
6646
+ *
6647
+ * `{argName}` is replaced with that argument's value from the call (string
6648
+ * and number arguments only). Don't end the text with "…": the chat adds it
6649
+ * while the tool runs. Each text is a string literal (or a const holding one)
6650
+ * of at most 80 characters; `lua compile` ignores a computed label.
6651
+ */
6652
+ label?: string | {
6653
+ running: string;
6654
+ done: string;
6655
+ };
6587
6656
  /** Zod schema for input validation */
6588
6657
  inputSchema: TInput;
6589
6658
  /**
@@ -11251,6 +11320,9 @@ export declare interface WebhookRequest {
11251
11320
  payload: any;
11252
11321
  }
11253
11322
 
11323
+ /** LUA-1353 — see {@link WebRouteAuth.accessLevel}. */
11324
+ declare type WebRouteAccessLevel = 'full' | 'view_only';
11325
+
11254
11326
  /** The app the handler belongs to, for `ctx.app` and log correlation. */
11255
11327
  declare interface WebRouteApp {
11256
11328
  id: string;
@@ -11281,6 +11353,14 @@ declare interface WebRouteAuth {
11281
11353
  email?: string;
11282
11354
  /** ISO timestamp the session token expires at, when known. */
11283
11355
  expiresAt?: string;
11356
+ /**
11357
+ * LUA-1353 — how much of the app the caller may use. `full`: they can read the app's agent (every route, the
11358
+ * agent pane). `view_only`: the app was shared with them, or is org-wide in their workspace, without access to
11359
+ * the agent — only `GET` routes reach a handler, `roles` and `scopes` are empty, and the agent pane is off. A
11360
+ * `GET` handler must therefore never change anything. Absent only from a gateway older than LUA-1353 (read it
11361
+ * as `full`).
11362
+ */
11363
+ accessLevel?: WebRouteAccessLevel;
11284
11364
  }
11285
11365
 
11286
11366
  declare type WebRouteMethod = (typeof WEB_ROUTE_METHODS)[number];