lua-cli 3.39.4 → 3.40.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.
@@ -44,18 +44,6 @@ declare interface AgentInvocationEffects {
44
44
  blocker?: TaskRunBlocker;
45
45
  }
46
46
 
47
- /**
48
- * Wire-format input for sandbox `Agents.invoke` / `POST /chat/generate/:agentId`
49
- * when triggered programmatically by another agent/skill/tool.
50
- *
51
- * Intentionally a narrow, safe subset of the public `ChatMessageDto` — omits
52
- * sandbox-only overrides (`skillOverride`, `preprocessorOverride`, etc.),
53
- * navigation hints, and persona override.
54
- *
55
- * Either `prompt` or `messages` must be provided. When `prompt` is given, it is
56
- * converted into a single `{ role: 'user', content: [{ type: 'text', text: prompt }] }`
57
- * message downstream.
58
- */
59
47
  declare interface AgentInvocationInput {
60
48
  /** Shortcut: plain-text prompt. Mutually exclusive with `messages`. */
61
49
  prompt?: string;
@@ -364,6 +352,87 @@ export declare interface AgentsApi {
364
352
  * ```
365
353
  */
366
354
  invoke(targetAgentId: string, input: AgentInvocationInput): Promise<AgentInvocationOutput>;
355
+ /** Agents of your organization, with the supervision actions you hold on each. */
356
+ list(): Promise<SupervisedAgentSummary[]>;
357
+ /** One agent of your organization. */
358
+ get(agentId: string): Promise<SupervisedAgentSummary & {
359
+ personaVersion?: number;
360
+ }>;
361
+ /** Recent execution logs of a supervised agent (`supervision:observe`). No user ids; message bodies only with `supervision:observe-content`. */
362
+ logs(agentId: string, opts?: {
363
+ since?: string | number;
364
+ limit?: number;
365
+ level?: 'debug' | 'info' | 'warn' | 'error';
366
+ logSource?: string;
367
+ }): Promise<SupervisionLogRow[]>;
368
+ /** Workflow run metadata (no inputs/outputs) (`supervision:observe`). */
369
+ runs(agentId: string): {
370
+ list(opts?: {
371
+ limit?: number;
372
+ status?: string;
373
+ workflowId?: string;
374
+ }): Promise<SupervisionRunSummary[]>;
375
+ get(runId: string): Promise<SupervisionRunSummary>;
376
+ };
377
+ /** Read-only Data — only the collections the org admin named on the grant (`supervision:observe`). */
378
+ data(agentId: string): {
379
+ get(collection: string, entryId: string): Promise<unknown>;
380
+ query(collection: string, filter?: Record<string, unknown>, opts?: {
381
+ page?: number;
382
+ limit?: number;
383
+ }): Promise<unknown>;
384
+ };
385
+ versions(agentId: string): {
386
+ list(opts?: {
387
+ limit?: number;
388
+ }): Promise<unknown>;
389
+ get(version: number): Promise<unknown>;
390
+ diff(from: number, to: number): Promise<unknown>;
391
+ /** Chat staged `version` (`supervision:preview`). No tools run unless `toolScope.skillIds` allowlists them. */
392
+ preview(version: number, prompt: string, opts?: {
393
+ toolScope?: {
394
+ skillIds?: string[];
395
+ };
396
+ }): Promise<{
397
+ version: number;
398
+ text: string;
399
+ toolsUsed: string[];
400
+ finishReason?: string;
401
+ }>;
402
+ /**
403
+ * Make `version` live (`supervision:release`; only from a workflow step whose workflow the grant names).
404
+ * Compare-and-swap: refused (409 `PROMOTE_CONFLICT`) unless `expectActive` is the live version.
405
+ */
406
+ promote(version: number, opts: {
407
+ expectActive: number | null;
408
+ }): Promise<unknown>;
409
+ };
410
+ persona(agentId: string): {
411
+ versions(): Promise<unknown>;
412
+ /** Serve persona `version` (`supervision:release`). CAS on the served persona version. */
413
+ activate(version: number, opts: {
414
+ expectActive: number | null;
415
+ }): Promise<unknown>;
416
+ };
417
+ /** The source backup (`supervision:observe`). */
418
+ source(agentId: string): {
419
+ list(): Promise<{
420
+ files: {
421
+ path: string;
422
+ size?: number;
423
+ }[];
424
+ }>;
425
+ get(path: string): Promise<{
426
+ path: string;
427
+ content: string;
428
+ }>;
429
+ };
430
+ /** Environment variable NAMES only — values are never returned (`supervision:observe`). */
431
+ env(agentId: string): {
432
+ keys(): Promise<{
433
+ keys: string[];
434
+ }>;
435
+ };
367
436
  }
368
437
 
369
438
  export declare interface AgentStepOptions {
@@ -396,6 +465,22 @@ export declare interface AgentStepOptions {
396
465
  */
397
466
  maxMessages?: number;
398
467
  maxInputTokens?: number;
468
+ /**
469
+ * Claude Code plugins a tier:'job' coding turn loads (EM-WS3). Platform allowlist only — today
470
+ * `'lua-agent-builder'` (the lua-cli playbooks). Needs the claude-code harness (an Anthropic model) and the `shell`
471
+ * job tool; the turn then reaches the Lua API through a platform proxy pinned to THIS workflow's agent that allows
472
+ * staging only (compile, push of skills/jobs/webhooks/triggers/processors/backup, `version create`, status, logs)
473
+ * and refuses every deploy, promote, publish, activate, env, chat and runtime call.
474
+ */
475
+ plugins?: WorkflowJobPluginId[];
476
+ /**
477
+ * EM-WS3: pin a plugin step's Lua-API proxy (and its key) to ANOTHER agent instead of this workflow's own. Legal only
478
+ * beside `plugins`. Refused at run time (`target_not_granted`) unless the platform's plugin-target switch is on AND
479
+ * this workflow's agent holds a `supervision:act` or `supervision:release` grant on the target.
480
+ */
481
+ target?: {
482
+ agentId: string;
483
+ };
399
484
  /**
400
485
  * What this step DOES: `classify` | `extract` | `transform` | `draft` | `research` | `reason` | `code` |
401
486
  * `judge`. On a PUSHED definition it must come with a `model` — a static `taskClass` with none is refused
@@ -1913,7 +1998,9 @@ export declare function defineDeviceTrigger(config: LuaDeviceTriggerConfig): Lua
1913
1998
  * });
1914
1999
  * ```
1915
2000
  */
1916
- export declare function defineTrigger<T = any>(config: LuaTriggerConfig<T>): LuaTrigger<T>;
2001
+ export declare function defineTrigger<S extends ZodType = ZodType<any>>(config: Omit<LuaTriggerConfig<z.infer<S>>, 'inputSchema'> & {
2002
+ inputSchema?: S;
2003
+ }): LuaTrigger<z.infer<S>>;
1917
2004
 
1918
2005
  /**
1919
2006
  * Function-style LuaVoice definition. Equivalent to `new LuaVoice(config)`,
@@ -2445,8 +2532,8 @@ declare abstract class HttpClient {
2445
2532
  * Use this only when a successful response contains a one-time secret that
2446
2533
  * cannot be recovered after an ambiguous network or server failure.
2447
2534
  */
2448
- protected httpPostOnce<T>(url: string, data?: any, headers?: Record<string, string>): Promise<ApiResponse<T>>;
2449
- protected httpPostCoreDrainRetry<T>(url: string, data?: any, headers?: Record<string, string>): Promise<ApiResponse<T>>;
2535
+ protected httpPostOnce<T>(url: string, data?: any, headers?: Record<string, string>, overrides?: RequestOverrides): Promise<ApiResponse<T>>;
2536
+ protected httpPostCoreDrainRetry<T>(url: string, data?: any, headers?: Record<string, string>, overrides?: RequestOverrides): Promise<ApiResponse<T>>;
2450
2537
  /**
2451
2538
  * Performs an HTTP PUT request
2452
2539
  * @param url - The relative URL path to request (will be appended to baseUrl)
@@ -2678,6 +2765,26 @@ export declare interface IntegrationsApi {
2678
2765
  passthrough(integrationType: string, request: IntegrationPassthroughRequest): Promise<IntegrationPassthroughResponse>;
2679
2766
  }
2680
2767
 
2768
+ /**
2769
+ * Who invoked this turn, when another agent created it through `Agents.invoke`.
2770
+ * Verified server-side from the invocation token; never caller-supplied.
2771
+ *
2772
+ * Treat any turn that carries `invokedBy` as agent-initiated: a mutating tool
2773
+ * should refuse it unless `supervisor` is true (the caller holds `supervision:act`
2774
+ * on this agent) and the tool's own supervisor allowlist admits the change. A
2775
+ * `delegatedUserId` NEVER grants owner rights.
2776
+ */
2777
+ export declare interface InvokedBy {
2778
+ /** The calling agent's id. */
2779
+ agentId: string;
2780
+ /** True only when an org admin granted the caller `supervision:act` on this agent. */
2781
+ supervisor: boolean;
2782
+ /** The caller's supervision scopes on this agent (e.g. `supervision:act`); `[]` on preview turns. */
2783
+ scopes: string[];
2784
+ /** Set when the caller passed `input.userId` to `Agents.invoke` (a delegated turn). */
2785
+ delegatedUserId?: string;
2786
+ }
2787
+
2681
2788
  /**
2682
2789
  * Job with versions array
2683
2790
  * Matches JobDto and job.schema.ts
@@ -3625,6 +3732,7 @@ export declare class LuaJob {
3625
3732
  private readonly timeout;
3626
3733
  private readonly retry?;
3627
3734
  private readonly metadata?;
3735
+ private readonly health?;
3628
3736
  private readonly executeFunction;
3629
3737
  /**
3630
3738
  * Creates a new LuaJob instance.
@@ -3666,6 +3774,10 @@ export declare class LuaJob {
3666
3774
  * Gets the job metadata.
3667
3775
  */
3668
3776
  getMetadata(): Record<string, any> | undefined;
3777
+ /**
3778
+ * Gets the schedule-health declaration (EM-WS10), if any.
3779
+ */
3780
+ getHealth(): ScheduleHealthConfig | undefined;
3669
3781
  /**
3670
3782
  * Executes the job with the provided job instance.
3671
3783
  * @param job - Job instance with metadata and context
@@ -3703,6 +3815,16 @@ export declare interface LuaJobConfig {
3703
3815
  * Sent to server and accessible during execution.
3704
3816
  */
3705
3817
  metadata?: Record<string, any>;
3818
+ /**
3819
+ * Schedule health — a dead-man for this job, watched by the platform. The job's owner (its creator, else the
3820
+ * org admins) gets ONE notice per incident — inbox card plus `notify` ('app' push, 'email', or 'emailApp', the
3821
+ * default) — when, while the job is active:
3822
+ * - `maxSilenceMinutes` (5..43200): no run has completed successfully for that long (needs a recurring schedule);
3823
+ * - `alertAfterConsecutiveFailures` (1..50): that many runs failed in a row;
3824
+ * and the notice resolves in place when the job is healthy again. Every transition is also an agent log line, so
3825
+ * a log drain routes it to Better Stack / Datadog. Takes effect when the version is published.
3826
+ */
3827
+ health?: ScheduleHealthConfig;
3706
3828
  }
3707
3829
 
3708
3830
  /**
@@ -3864,6 +3986,12 @@ export declare interface LuaRequest {
3864
3986
  * current speaker. Undefined on 1:1 turns and on non-chat executions.
3865
3987
  */
3866
3988
  conversation?: ConversationRef;
3989
+ /**
3990
+ * Present only when ANOTHER agent created this turn via `Agents.invoke`
3991
+ * (absent on user, channel, job, webhook and self-invoked turns, and offline in
3992
+ * `lua test`). Read it defensively — older runtimes do not set it.
3993
+ */
3994
+ invokedBy?: InvokedBy;
3867
3995
  }
3868
3996
 
3869
3997
  /**
@@ -4113,7 +4241,9 @@ export declare interface LuaTriggerConfig<T = any> {
4113
4241
  * compiler carries it into the trigger version as declared metadata.
4114
4242
  * `input` maps the trigger context to the tool's arguments and runs in the
4115
4243
  * same server-side slot sandbox (15s budget shared with verify/filter) —
4116
- * it CANNOT call platform APIs. Omit `input` to execute with `{}`.
4244
+ * it CAN call platform APIs (Data, Products, Baskets, Orders, User, AI,
4245
+ * Agents, Jobs, …), same as a tool or webhook, since all three build their
4246
+ * VM context through the same sandbox factory. Omit `input` to execute with `{}`.
4117
4247
  *
4118
4248
  * Declaring BOTH `tool` and `transform` runs the tool; the transform is
4119
4249
  * ignored (the compiler warns). Approval-gated tools are refused server-
@@ -4163,8 +4293,8 @@ export declare class LuaVoice {
4163
4293
  readonly name: string;
4164
4294
  readonly description?: string;
4165
4295
  readonly llm: LuaVoiceModelInput;
4166
- readonly stt: LuaVoiceModelInput;
4167
- readonly tts: LuaVoiceModelInput;
4296
+ readonly stt?: LuaVoiceModelInput;
4297
+ readonly tts?: LuaVoiceModelInput;
4168
4298
  readonly vad: LuaVoiceConfig_2['vad'];
4169
4299
  readonly vadOptions: LuaVoiceConfig_2['vadOptions'];
4170
4300
  readonly turnDetection: LuaVoiceConfig_2['turnDetection'];
@@ -4191,11 +4321,22 @@ export declare class LuaVoice {
4191
4321
  * pass either a string descriptor or a plugin class instance. The wire schema
4192
4322
  * (validated server-side) is the discriminated union in `@lua/shared-types`;
4193
4323
  * the compiler is what bridges the two.
4194
- */
4195
- export declare interface LuaVoiceConfig extends Omit<LuaVoiceConfig_2, 'llm' | 'stt' | 'tts'> {
4324
+ *
4325
+ * `stt`/`tts` are unconditionally optional here at the type level — a
4326
+ * realtime `llm` legitimately omits both. The realtime-vs-cascaded
4327
+ * requirement (cascaded needs both) is enforced by the compiler's zod
4328
+ * `superRefine` in `@lua/shared-types`, not by this type. `name` is
4329
+ * deliberately required here (unlike `@lua/shared-types`'s wire schema,
4330
+ * which leaves it optional for its own unrelated server-side
4331
+ * placeholder-name use case) since the `LuaVoice` constructor throws
4332
+ * without it and a nameless voice is otherwise silently dropped from the
4333
+ * compiled manifest.
4334
+ */
4335
+ export declare interface LuaVoiceConfig extends Omit<LuaVoiceConfig_2, 'llm' | 'stt' | 'tts' | 'name'> {
4336
+ name: string;
4196
4337
  llm: LuaVoiceModelInput;
4197
- stt: LuaVoiceModelInput;
4198
- tts: LuaVoiceModelInput;
4338
+ stt?: LuaVoiceModelInput;
4339
+ tts?: LuaVoiceModelInput;
4199
4340
  /** Optional human-readable description (surfaced in manifest + admin listings). */
4200
4341
  description?: string;
4201
4342
  /** Voice-only tools, in addition to skills attached to the owning agent. */
@@ -5325,7 +5466,9 @@ export declare type LuaWorkflowBuildCode = 'duplicate-step-id' | 'unknown-step-r
5325
5466
  * verdict (deferred for an inherit child, 03 §3.1 table). Kept for one minor so a consumer switching on the union still
5326
5467
  * compiles; removed in the next.
5327
5468
  */
5328
- | 'workspace-not-declared' | 'workspace-inherit-without-parent-workspace' | 'workspace-inherit-conflict' | 'harness-requires-job-tier' | 'max-turns-requires-job-tier' | 'max-turns-invalid' | 'cap-exceeded' | 'chunk-size-invalid' | 'rate-limit-invalid' | 'backoff-invalid' | 'loop-interval-out-of-range' | 'mapping-placement' | 'container-arm-empty'
5469
+ | 'workspace-not-declared' | 'workspace-inherit-without-parent-workspace' | 'workspace-inherit-conflict' | 'harness-requires-job-tier' | 'max-turns-requires-job-tier' | 'max-turns-invalid'
5470
+ /** EM-WS3: a step's `plugins` outside the allowlist, repeated, or off the Job tier. */
5471
+ | 'plugins-invalid' | 'cap-exceeded' | 'chunk-size-invalid' | 'rate-limit-invalid' | 'backoff-invalid' | 'loop-interval-out-of-range' | 'mapping-placement' | 'container-arm-empty'
5329
5472
  /**
5330
5473
  * @deprecated LUA-684 — the builder no longer throws it: an `approval` / `waitForSignal` IS a container arm
5331
5474
  * (`parallel(['approve', …])`). Where the engine cannot run one — a `loop` body, the step of a `[map, step]`
@@ -5431,6 +5574,18 @@ export declare interface LuaWorkflowConfig {
5431
5574
  backfillOnEnable?: {
5432
5575
  maxOccurrences?: number;
5433
5576
  };
5577
+ /**
5578
+ * Schedule health — a dead-man for this schedule, watched by the platform (no heartbeat service to wire up).
5579
+ * The agent's owner (the schedule's creator, else the org admins) gets ONE notice per incident — inbox card plus
5580
+ * `notify` ('app' push, 'email', or 'emailApp', the default) — when, while the schedule is active:
5581
+ * - `maxSilenceMinutes` (5..43200): no scheduled run has COMPLETED successfully for that long;
5582
+ * - `alertAfterConsecutiveFailures` (1..3): that many scheduled runs failed in a row (the platform turns a
5583
+ * schedule off after 3, which always alerts);
5584
+ * and the notice resolves in place when the schedule is healthy again. Every transition is also an agent log
5585
+ * line (`lua logs`), so a log drain routes it to Better Stack / Datadog. Needs `schedule`; silence needs a
5586
+ * recurring one. See docs/workflows/schedule-health.md.
5587
+ */
5588
+ health?: ScheduleHealthConfig;
5434
5589
  /** Literal JSON passed as run input on every scheduled fire; must validate against `inputSchema` (P0-5e). */
5435
5590
  scheduleInput?: Record<string, unknown>;
5436
5591
  goal?: WorkflowGoalEnvelope;
@@ -5483,6 +5638,8 @@ export { MapDescriptor }
5483
5638
  export declare interface MCPServerBaseConfig {
5484
5639
  /** Unique identifier for this MCP server */
5485
5640
  name: string;
5641
+ /** Optional description of this MCP server */
5642
+ description?: string;
5486
5643
  /** Optional timeout in milliseconds (default: 60000) */
5487
5644
  timeout?: number;
5488
5645
  }
@@ -6467,6 +6624,12 @@ declare interface PushJobVersionDTO {
6467
6624
  code?: string;
6468
6625
  codeS3Hash?: string;
6469
6626
  metadata?: Record<string, any>;
6627
+ /** EM-WS10 — `LuaJob({ health })`; sent only when declared. */
6628
+ health?: {
6629
+ maxSilenceMinutes?: number;
6630
+ alertAfterConsecutiveFailures?: number;
6631
+ notify?: 'app' | 'email' | 'emailApp';
6632
+ };
6470
6633
  }
6471
6634
 
6472
6635
  /**
@@ -6583,6 +6746,24 @@ export declare const rows: (s: LuaWorkflowStep<any, any, any> | string, path: st
6583
6746
  limit: number;
6584
6747
  }) => MapDescriptor;
6585
6748
 
6749
+ /** Where an incident notice goes beyond the inbox card (which always lands). */
6750
+ declare const SCHEDULE_HEALTH_NOTIFY_CHANNELS: readonly ["app", "email", "emailApp"];
6751
+
6752
+ /** The declaration an author writes. At least one threshold is required. */
6753
+ declare interface ScheduleHealthConfig {
6754
+ /** Alert when no scheduled run has completed successfully for this many minutes (5..43200). */
6755
+ maxSilenceMinutes?: number;
6756
+ /**
6757
+ * Alert when this many scheduled runs in a row failed. Workflows and agent tasks are parked by the
6758
+ * platform after 3 consecutive failures, so for them the value is 1..3; code jobs accept 1..50.
6759
+ */
6760
+ alertAfterConsecutiveFailures?: number;
6761
+ /** Out-of-inbox routing for the notice: 'app' (push), 'email', or 'emailApp' (both). Default 'emailApp'. */
6762
+ notify?: ScheduleHealthNotify;
6763
+ }
6764
+
6765
+ declare type ScheduleHealthNotify = (typeof SCHEDULE_HEALTH_NOTIFY_CHANNELS)[number];
6766
+
6586
6767
  /**
6587
6768
  * Additive field on primitive publish responses. When the agent is under
6588
6769
  * versioning the server performs a scoped promote and returns the newly
@@ -6723,6 +6904,35 @@ export declare interface StepPathRef<TOut> {
6723
6904
  /** An inline step object, or a string naming an entry declared by an `agentStep`/`specialistStep`/`toolStep`/`map` call in the same chain (03 §3.2.0). */
6724
6905
  export declare type StepRef = LuaWorkflowStep<any, any, any> | string;
6725
6906
 
6907
+ declare interface SupervisedAgentSummary {
6908
+ agentId: string;
6909
+ name?: string;
6910
+ /** The supervision actions the CALLER holds on this agent (explicit grant rows only). */
6911
+ actions: string[];
6912
+ }
6913
+
6914
+ declare interface SupervisionLogRow {
6915
+ timestamp: string | number | Date;
6916
+ level?: string;
6917
+ /** Present only when the caller holds `supervision:observe-content` on the target. */
6918
+ message?: string;
6919
+ logSource?: string;
6920
+ primitiveName?: string;
6921
+ toolName?: string;
6922
+ }
6923
+
6924
+ declare interface SupervisionRunSummary {
6925
+ runId: string;
6926
+ workflowId?: string;
6927
+ workflowName?: string;
6928
+ status: string;
6929
+ reason?: string;
6930
+ trigger?: string;
6931
+ createdAt?: number;
6932
+ startedAt?: number;
6933
+ completedAt?: number;
6934
+ }
6935
+
6726
6936
  /**
6727
6937
  * Why an unattended run could not finish, reported by the agent itself instead
6728
6938
  * of being guessed from its prose. The platform — not the agent — writes every
@@ -7824,6 +8034,9 @@ export declare type WorkflowJobHarness = WorkflowJobHarness_2;
7824
8034
 
7825
8035
  declare type WorkflowJobHarness_2 = (typeof WORKFLOW_JOB_HARNESSES)[number];
7826
8036
 
8037
+ /** EM-WS3: the Job-tier plugin allowlist — a structural twin of the registry's id, parity-checked below. */
8038
+ declare type WorkflowJobPluginId = 'lua-agent-builder';
8039
+
7827
8040
  declare type WorkflowJobResources = (typeof WORKFLOW_JOB_RESOURCES)[number];
7828
8041
 
7829
8042
  export declare type WorkflowJobToolId = 'shell' | 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'git' | 'gh' | 'fetch' | 'ripwire';