lua-cli 3.32.1 → 3.32.2

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.
@@ -18,7 +18,16 @@ import { SerializedWorkflowGraph } from '@lua/workflow-graph';
18
18
  import { TemplateBinding } from '@lua/workflow-graph';
19
19
  import { TypedRef } from '@lua/workflow-graph';
20
20
  import { UserContent } from 'ai';
21
+ import { WorkflowExecFn as WorkflowExec } from '@lua/shared-types/workflow-exec';
22
+ import { WorkflowExecBinary } from '@lua/shared-types/workflow-exec';
23
+ import { WorkflowExecError } from '@lua/shared-types/workflow-exec';
24
+ import { WorkflowExecErrorCode } from '@lua/shared-types/workflow-exec';
25
+ import { WorkflowExecOptions } from '@lua/shared-types/workflow-exec';
26
+ import { WorkflowExecRefusalReason } from '@lua/shared-types/workflow-exec';
27
+ import { WorkflowExecOutcome as WorkflowExecResult } from '@lua/shared-types/workflow-exec';
21
28
  import { WorkflowGraphEntry } from '@lua/workflow-graph';
29
+ import { WorkflowShellFn as WorkflowShell } from '@lua/shared-types/workflow-exec';
30
+ import { WorkflowShellValue } from '@lua/shared-types/workflow-exec';
22
31
  import { z } from 'zod';
23
32
  import { ZodType } from 'zod';
24
33
 
@@ -307,13 +316,13 @@ export declare interface AgentStepOptions {
307
316
  };
308
317
  timeoutSeconds?: number;
309
318
  retry?: RetryPolicy;
310
- onError?: 'fail' | 'continue' | 'park';
319
+ onError?: WorkflowOnError;
311
320
  requiredConnections?: string[];
312
321
  /** static-only persona override (§11 S3) */
313
322
  systemPrompt?: string;
314
- tier?: 'job';
323
+ tier?: WorkflowTier;
315
324
  workspace?: WorkflowStepWorkspace;
316
- jobResources?: 'small' | 'medium' | 'large';
325
+ jobResources?: WorkflowJobResources;
317
326
  harness?: WorkflowJobHarness;
318
327
  /** Coding-turn cap for a tier:'job' step (1..500); absent ⇒ the platform default. A monorepo change needs more than the default. */
319
328
  maxTurns?: number;
@@ -322,7 +331,8 @@ export declare interface AgentStepOptions {
322
331
  * attempt (every pass and resumed segment). Crossing one checkpoints the workspace and ends the attempt
323
332
  * `attempt_budget_exhausted` — retryable, so the step's `retry` policy continues from that tree with a fresh
324
333
  * session. `maxMessages` counts harness messages (one per content block; 1..5000, default 400),
325
- * `maxInputTokens` the attempt's input-side tokens (prompt + cache; 1M..500M, default 30M).
334
+ * `maxInputTokens` the attempt's input-side tokens (prompt + cache; 1M..500M, default 4M — LUA-708: the per-attempt
335
+ * cost bound, since `budget.maxCredits` counts attempts, not tokens).
326
336
  */
327
337
  maxMessages?: number;
328
338
  maxInputTokens?: number;
@@ -553,7 +563,7 @@ export declare interface ApprovalOptions {
553
563
  /** 'deny' (default) | 'cancel-run' | 'fail' | a chain of ≤ 3 hops ending in one terminal member */
554
564
  onTimeout?: WorkflowSuspendTimeoutChain;
555
565
  /** default 'continue' (denial is data unless 'fail') */
556
- onDeny?: 'fail' | 'continue';
566
+ onDeny?: WorkflowApprovalOnDeny;
557
567
  businessHours?: WorkflowBusinessHours;
558
568
  editable?: boolean;
559
569
  /** grammar: `drafts`, `drafts[*]`, `drafts[*].body`, `drafts[3].body`, `summary.title` */
@@ -1310,7 +1320,13 @@ export declare interface ChatHistoryMessage {
1310
1320
  */
1311
1321
  export declare type ChatMessage = TextMessage | ImageMessage | FileMessage;
1312
1322
 
1313
- /** A container arm: a `StepRef`, or (B14 — lands with WF-509) the two-element chain `[mapConfig, stepRef]`. */
1323
+ /**
1324
+ * A container arm: a `StepRef` — a `createStep` object, or a string naming an entry declared elsewhere in the chain
1325
+ * (`agentStep` / `specialistStep` / `toolStep` / `workflow`, and since LUA-684 `approval` / `waitForSignal`, so an
1326
+ * approval can run concurrently with another row) — or (B14 — lands with WF-509) the two-element chain
1327
+ * `[mapConfig, stepRef]`. A HITL arm takes the previous output as its payload, so it never heads a `[map, step]`
1328
+ * chain, and a `loop` body cannot be one until the engine proves it (`node-type-unsupported-in-container`).
1329
+ */
1314
1330
  export declare type ContainerArm = StepRef | [LuaMapConfig, StepRef];
1315
1331
 
1316
1332
  /**
@@ -3882,13 +3898,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3882
3898
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3883
3899
  }, "strip", z.ZodTypeAny, {
3884
3900
  voice?: string;
3885
- options?: Record<string, unknown>;
3886
3901
  kind?: "inference";
3902
+ options?: Record<string, unknown>;
3887
3903
  model?: string;
3888
3904
  }, {
3889
3905
  voice?: string;
3890
- options?: Record<string, unknown>;
3891
3906
  kind?: "inference";
3907
+ options?: Record<string, unknown>;
3892
3908
  model?: string;
3893
3909
  }>, z.ZodObject<{
3894
3910
  kind: z.ZodLiteral<"plugin">;
@@ -3903,13 +3919,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3903
3919
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3904
3920
  }, "strip", z.ZodTypeAny, {
3905
3921
  provider?: "deepgram" | "elevenlabs";
3906
- options?: Record<string, unknown>;
3907
3922
  kind?: "plugin";
3923
+ options?: Record<string, unknown>;
3908
3924
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3909
3925
  }, {
3910
3926
  provider?: "deepgram" | "elevenlabs";
3911
- options?: Record<string, unknown>;
3912
3927
  kind?: "plugin";
3928
+ options?: Record<string, unknown>;
3913
3929
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3914
3930
  }>, z.ZodObject<{
3915
3931
  kind: z.ZodLiteral<"realtime">;
@@ -3923,12 +3939,12 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3923
3939
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3924
3940
  }, "strip", z.ZodTypeAny, {
3925
3941
  provider?: "google" | "xai" | "openai";
3926
- options?: Record<string, unknown>;
3927
3942
  kind?: "realtime";
3943
+ options?: Record<string, unknown>;
3928
3944
  }, {
3929
3945
  provider?: "google" | "xai" | "openai";
3930
- options?: Record<string, unknown>;
3931
3946
  kind?: "realtime";
3947
+ options?: Record<string, unknown>;
3932
3948
  }>]>;
3933
3949
  stt: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3934
3950
  kind: z.ZodLiteral<"inference">;
@@ -3948,13 +3964,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3948
3964
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3949
3965
  }, "strip", z.ZodTypeAny, {
3950
3966
  voice?: string;
3951
- options?: Record<string, unknown>;
3952
3967
  kind?: "inference";
3968
+ options?: Record<string, unknown>;
3953
3969
  model?: string;
3954
3970
  }, {
3955
3971
  voice?: string;
3956
- options?: Record<string, unknown>;
3957
3972
  kind?: "inference";
3973
+ options?: Record<string, unknown>;
3958
3974
  model?: string;
3959
3975
  }>, z.ZodObject<{
3960
3976
  kind: z.ZodLiteral<"plugin">;
@@ -3969,13 +3985,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3969
3985
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3970
3986
  }, "strip", z.ZodTypeAny, {
3971
3987
  provider?: "deepgram" | "elevenlabs";
3972
- options?: Record<string, unknown>;
3973
3988
  kind?: "plugin";
3989
+ options?: Record<string, unknown>;
3974
3990
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3975
3991
  }, {
3976
3992
  provider?: "deepgram" | "elevenlabs";
3977
- options?: Record<string, unknown>;
3978
3993
  kind?: "plugin";
3994
+ options?: Record<string, unknown>;
3979
3995
  class?: "LLM" | "STT" | "STTv2" | "TTS";
3980
3996
  }>, z.ZodObject<{
3981
3997
  kind: z.ZodLiteral<"realtime">;
@@ -3989,12 +4005,12 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
3989
4005
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3990
4006
  }, "strip", z.ZodTypeAny, {
3991
4007
  provider?: "google" | "xai" | "openai";
3992
- options?: Record<string, unknown>;
3993
4008
  kind?: "realtime";
4009
+ options?: Record<string, unknown>;
3994
4010
  }, {
3995
4011
  provider?: "google" | "xai" | "openai";
3996
- options?: Record<string, unknown>;
3997
4012
  kind?: "realtime";
4013
+ options?: Record<string, unknown>;
3998
4014
  }>]>>;
3999
4015
  tts: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4000
4016
  kind: z.ZodLiteral<"inference">;
@@ -4014,13 +4030,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4014
4030
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4015
4031
  }, "strip", z.ZodTypeAny, {
4016
4032
  voice?: string;
4017
- options?: Record<string, unknown>;
4018
4033
  kind?: "inference";
4034
+ options?: Record<string, unknown>;
4019
4035
  model?: string;
4020
4036
  }, {
4021
4037
  voice?: string;
4022
- options?: Record<string, unknown>;
4023
4038
  kind?: "inference";
4039
+ options?: Record<string, unknown>;
4024
4040
  model?: string;
4025
4041
  }>, z.ZodObject<{
4026
4042
  kind: z.ZodLiteral<"plugin">;
@@ -4035,13 +4051,13 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4035
4051
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4036
4052
  }, "strip", z.ZodTypeAny, {
4037
4053
  provider?: "deepgram" | "elevenlabs";
4038
- options?: Record<string, unknown>;
4039
4054
  kind?: "plugin";
4055
+ options?: Record<string, unknown>;
4040
4056
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4041
4057
  }, {
4042
4058
  provider?: "deepgram" | "elevenlabs";
4043
- options?: Record<string, unknown>;
4044
4059
  kind?: "plugin";
4060
+ options?: Record<string, unknown>;
4045
4061
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4046
4062
  }>, z.ZodObject<{
4047
4063
  kind: z.ZodLiteral<"realtime">;
@@ -4055,12 +4071,12 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4055
4071
  options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4056
4072
  }, "strip", z.ZodTypeAny, {
4057
4073
  provider?: "google" | "xai" | "openai";
4058
- options?: Record<string, unknown>;
4059
4074
  kind?: "realtime";
4075
+ options?: Record<string, unknown>;
4060
4076
  }, {
4061
4077
  provider?: "google" | "xai" | "openai";
4062
- options?: Record<string, unknown>;
4063
4078
  kind?: "realtime";
4079
+ options?: Record<string, unknown>;
4064
4080
  }>]>>;
4065
4081
  vad: z.ZodOptional<z.ZodString>;
4066
4082
  vadOptions: z.ZodOptional<z.ZodObject<{
@@ -4222,49 +4238,49 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4222
4238
  vad?: string;
4223
4239
  stt?: {
4224
4240
  voice?: string;
4225
- options?: Record<string, unknown>;
4226
4241
  kind?: "inference";
4242
+ options?: Record<string, unknown>;
4227
4243
  model?: string;
4228
4244
  } | {
4229
4245
  provider?: "deepgram" | "elevenlabs";
4230
- options?: Record<string, unknown>;
4231
4246
  kind?: "plugin";
4247
+ options?: Record<string, unknown>;
4232
4248
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4233
4249
  } | {
4234
4250
  provider?: "google" | "xai" | "openai";
4235
- options?: Record<string, unknown>;
4236
4251
  kind?: "realtime";
4252
+ options?: Record<string, unknown>;
4237
4253
  };
4238
4254
  volume?: number;
4239
4255
  llm?: {
4240
4256
  voice?: string;
4241
- options?: Record<string, unknown>;
4242
4257
  kind?: "inference";
4258
+ options?: Record<string, unknown>;
4243
4259
  model?: string;
4244
4260
  } | {
4245
4261
  provider?: "deepgram" | "elevenlabs";
4246
- options?: Record<string, unknown>;
4247
4262
  kind?: "plugin";
4263
+ options?: Record<string, unknown>;
4248
4264
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4249
4265
  } | {
4250
4266
  provider?: "google" | "xai" | "openai";
4251
- options?: Record<string, unknown>;
4252
4267
  kind?: "realtime";
4268
+ options?: Record<string, unknown>;
4253
4269
  };
4254
4270
  tts?: {
4255
4271
  voice?: string;
4256
- options?: Record<string, unknown>;
4257
4272
  kind?: "inference";
4273
+ options?: Record<string, unknown>;
4258
4274
  model?: string;
4259
4275
  } | {
4260
4276
  provider?: "deepgram" | "elevenlabs";
4261
- options?: Record<string, unknown>;
4262
4277
  kind?: "plugin";
4278
+ options?: Record<string, unknown>;
4263
4279
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4264
4280
  } | {
4265
4281
  provider?: "google" | "xai" | "openai";
4266
- options?: Record<string, unknown>;
4267
4282
  kind?: "realtime";
4283
+ options?: Record<string, unknown>;
4268
4284
  };
4269
4285
  vadOptions?: {
4270
4286
  minSpeechDuration?: number;
@@ -4316,49 +4332,49 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4316
4332
  vad?: string;
4317
4333
  stt?: {
4318
4334
  voice?: string;
4319
- options?: Record<string, unknown>;
4320
4335
  kind?: "inference";
4336
+ options?: Record<string, unknown>;
4321
4337
  model?: string;
4322
4338
  } | {
4323
4339
  provider?: "deepgram" | "elevenlabs";
4324
- options?: Record<string, unknown>;
4325
4340
  kind?: "plugin";
4341
+ options?: Record<string, unknown>;
4326
4342
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4327
4343
  } | {
4328
4344
  provider?: "google" | "xai" | "openai";
4329
- options?: Record<string, unknown>;
4330
4345
  kind?: "realtime";
4346
+ options?: Record<string, unknown>;
4331
4347
  };
4332
4348
  volume?: number;
4333
4349
  llm?: {
4334
4350
  voice?: string;
4335
- options?: Record<string, unknown>;
4336
4351
  kind?: "inference";
4352
+ options?: Record<string, unknown>;
4337
4353
  model?: string;
4338
4354
  } | {
4339
4355
  provider?: "deepgram" | "elevenlabs";
4340
- options?: Record<string, unknown>;
4341
4356
  kind?: "plugin";
4357
+ options?: Record<string, unknown>;
4342
4358
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4343
4359
  } | {
4344
4360
  provider?: "google" | "xai" | "openai";
4345
- options?: Record<string, unknown>;
4346
4361
  kind?: "realtime";
4362
+ options?: Record<string, unknown>;
4347
4363
  };
4348
4364
  tts?: {
4349
4365
  voice?: string;
4350
- options?: Record<string, unknown>;
4351
4366
  kind?: "inference";
4367
+ options?: Record<string, unknown>;
4352
4368
  model?: string;
4353
4369
  } | {
4354
4370
  provider?: "deepgram" | "elevenlabs";
4355
- options?: Record<string, unknown>;
4356
4371
  kind?: "plugin";
4372
+ options?: Record<string, unknown>;
4357
4373
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4358
4374
  } | {
4359
4375
  provider?: "google" | "xai" | "openai";
4360
- options?: Record<string, unknown>;
4361
4376
  kind?: "realtime";
4377
+ options?: Record<string, unknown>;
4362
4378
  };
4363
4379
  vadOptions?: {
4364
4380
  minSpeechDuration?: number;
@@ -4410,49 +4426,49 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4410
4426
  vad?: string;
4411
4427
  stt?: {
4412
4428
  voice?: string;
4413
- options?: Record<string, unknown>;
4414
4429
  kind?: "inference";
4430
+ options?: Record<string, unknown>;
4415
4431
  model?: string;
4416
4432
  } | {
4417
4433
  provider?: "deepgram" | "elevenlabs";
4418
- options?: Record<string, unknown>;
4419
4434
  kind?: "plugin";
4435
+ options?: Record<string, unknown>;
4420
4436
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4421
4437
  } | {
4422
4438
  provider?: "google" | "xai" | "openai";
4423
- options?: Record<string, unknown>;
4424
4439
  kind?: "realtime";
4440
+ options?: Record<string, unknown>;
4425
4441
  };
4426
4442
  volume?: number;
4427
4443
  llm?: {
4428
4444
  voice?: string;
4429
- options?: Record<string, unknown>;
4430
4445
  kind?: "inference";
4446
+ options?: Record<string, unknown>;
4431
4447
  model?: string;
4432
4448
  } | {
4433
4449
  provider?: "deepgram" | "elevenlabs";
4434
- options?: Record<string, unknown>;
4435
4450
  kind?: "plugin";
4451
+ options?: Record<string, unknown>;
4436
4452
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4437
4453
  } | {
4438
4454
  provider?: "google" | "xai" | "openai";
4439
- options?: Record<string, unknown>;
4440
4455
  kind?: "realtime";
4456
+ options?: Record<string, unknown>;
4441
4457
  };
4442
4458
  tts?: {
4443
4459
  voice?: string;
4444
- options?: Record<string, unknown>;
4445
4460
  kind?: "inference";
4461
+ options?: Record<string, unknown>;
4446
4462
  model?: string;
4447
4463
  } | {
4448
4464
  provider?: "deepgram" | "elevenlabs";
4449
- options?: Record<string, unknown>;
4450
4465
  kind?: "plugin";
4466
+ options?: Record<string, unknown>;
4451
4467
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4452
4468
  } | {
4453
4469
  provider?: "google" | "xai" | "openai";
4454
- options?: Record<string, unknown>;
4455
4470
  kind?: "realtime";
4471
+ options?: Record<string, unknown>;
4456
4472
  };
4457
4473
  vadOptions?: {
4458
4474
  minSpeechDuration?: number;
@@ -4504,49 +4520,49 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
4504
4520
  vad?: string;
4505
4521
  stt?: {
4506
4522
  voice?: string;
4507
- options?: Record<string, unknown>;
4508
4523
  kind?: "inference";
4524
+ options?: Record<string, unknown>;
4509
4525
  model?: string;
4510
4526
  } | {
4511
4527
  provider?: "deepgram" | "elevenlabs";
4512
- options?: Record<string, unknown>;
4513
4528
  kind?: "plugin";
4529
+ options?: Record<string, unknown>;
4514
4530
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4515
4531
  } | {
4516
4532
  provider?: "google" | "xai" | "openai";
4517
- options?: Record<string, unknown>;
4518
4533
  kind?: "realtime";
4534
+ options?: Record<string, unknown>;
4519
4535
  };
4520
4536
  volume?: number;
4521
4537
  llm?: {
4522
4538
  voice?: string;
4523
- options?: Record<string, unknown>;
4524
4539
  kind?: "inference";
4540
+ options?: Record<string, unknown>;
4525
4541
  model?: string;
4526
4542
  } | {
4527
4543
  provider?: "deepgram" | "elevenlabs";
4528
- options?: Record<string, unknown>;
4529
4544
  kind?: "plugin";
4545
+ options?: Record<string, unknown>;
4530
4546
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4531
4547
  } | {
4532
4548
  provider?: "google" | "xai" | "openai";
4533
- options?: Record<string, unknown>;
4534
4549
  kind?: "realtime";
4550
+ options?: Record<string, unknown>;
4535
4551
  };
4536
4552
  tts?: {
4537
4553
  voice?: string;
4538
- options?: Record<string, unknown>;
4539
4554
  kind?: "inference";
4555
+ options?: Record<string, unknown>;
4540
4556
  model?: string;
4541
4557
  } | {
4542
4558
  provider?: "deepgram" | "elevenlabs";
4543
- options?: Record<string, unknown>;
4544
4559
  kind?: "plugin";
4560
+ options?: Record<string, unknown>;
4545
4561
  class?: "LLM" | "STT" | "STTv2" | "TTS";
4546
4562
  } | {
4547
4563
  provider?: "google" | "xai" | "openai";
4548
- options?: Record<string, unknown>;
4549
4564
  kind?: "realtime";
4565
+ options?: Record<string, unknown>;
4550
4566
  };
4551
4567
  vadOptions?: {
4552
4568
  minSpeechDuration?: number;
@@ -4935,20 +4951,28 @@ export declare type LuaWorkflowBuildCode = 'duplicate-step-id' | 'unknown-step-r
4935
4951
  * verdict (deferred for an inherit child, 03 §3.1 table). Kept for one minor so a consumer switching on the union still
4936
4952
  * compiles; removed in the next.
4937
4953
  */
4938
- | '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' | 'approval-inside-container' | 'empty-graph' | 'ephemeral-role-too-long' | 'role-ref-and-inline' | 'approver-excludes-only-candidate' | 'four-eyes-requires-editable' | 'escalation-chain-not-terminal' | 'escalation-chain-too-long' | 'editable-path-invalid' | 'env-template-secret-key' | 'invalid-envelope' | 'invalid-step' | 'invalid-step-id' | 'invalid-workflow-name' | 'schedule-input-required' | 'schedule-input-invalid' | 'hitl-duration-defaulted' | 'WORKFLOW_UNPLACED_STEP';
4954
+ | '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'
4955
+ /**
4956
+ * @deprecated LUA-684 — the builder no longer throws it: an `approval` / `waitForSignal` IS a container arm
4957
+ * (`parallel(['approve', …])`). Where the engine cannot run one — a `loop` body, the step of a `[map, step]`
4958
+ * chain — the code is `node-type-unsupported-in-container`. Kept for one minor so a consumer switching on the
4959
+ * union still compiles; removed in the next.
4960
+ */
4961
+ | 'approval-inside-container' | 'node-type-unsupported-in-container' | 'empty-graph' | 'ephemeral-role-too-long' | 'role-ref-and-inline' | 'approver-excludes-only-candidate' | 'four-eyes-requires-editable' | 'escalation-chain-not-terminal' | 'escalation-chain-too-long' | 'editable-path-invalid' | 'env-template-secret-key' | 'invalid-envelope' | 'invalid-step' | 'invalid-step-id' | 'invalid-workflow-name' | 'schedule-input-required' | 'schedule-input-invalid' | 'hitl-duration-defaulted' | 'WORKFLOW_UNPLACED_STEP';
4939
4962
 
4940
4963
  export declare interface LuaWorkflowBuilder {
4941
4964
  then(step: StepRef): this;
4942
- /** 2..16 arms; output = { [stepId]: output } */
4965
+ /** 2..16 arms; output = { [stepId]: output }. An `approval` / `waitForSignal` arm (by id) parks beside its siblings. */
4943
4966
  parallel(steps: ContainerArm[], opts?: {
4944
4967
  merge?: WorkflowMergePolicy;
4945
4968
  }): this;
4946
- /** all-true arms run (Mastra); exclusive:true ≡ switch() */
4969
+ /** all-true arms run (Mastra); exclusive:true ≡ switch(). An arm may name a declared `approval` / `waitForSignal`. */
4947
4970
  branch(arms: Array<[LuaPredicate, StepRef]>, opts?: {
4948
4971
  exclusive?: boolean;
4949
4972
  }): this;
4950
4973
  /** first true arm only ⇒ conditional{ exclusive:true, otherwise } */
4951
4974
  switch(arms: Array<[LuaPredicate, StepRef]>, otherwise?: StepRef): this;
4975
+ /** one body run per item; an `approval` / `waitForSignal` body (by id) is one approval / wait per item */
4952
4976
  foreach(step: ContainerArm, opts?: ForeachOptions): this;
4953
4977
  dowhile(step: ContainerArm, predicate: LuaPredicate, opts?: LoopOptions): this;
4954
4978
  dountil(step: ContainerArm, predicate: LuaPredicate, opts?: LoopOptions): this;
@@ -4971,12 +4995,11 @@ export declare interface LuaWorkflowBuilder {
4971
4995
  /** D25 ephemeral specialist: runs AS THE OWNING AGENT (`agentId:'$self'`) with an additive role block. */
4972
4996
  specialistStep(id: string, opts: SpecialistStepOptions): this;
4973
4997
  toolStep(id: string, tool: LuaTool<any>, opts?: ToolStepOptions): this;
4998
+ /** a declaration like `agentStep` (LUA-684): placed where called unless a container claims the id — `parallel(['approve', …])` */
4974
4999
  approval(id: string, opts: ApprovalOptions): this;
4975
5000
  waitForSignal(id: string, opts: WaitForSignalOptions): this;
4976
5001
  /** nested run; depth ≤ 3 — declares `id`, so a container may place it by string ref (03 §3.2.0) */
4977
- workflow(id: string, ref: LuaWorkflow | string, input?: LuaMapConfig, opts?: {
4978
- workspace?: 'inherit';
4979
- }): this;
5002
+ workflow(id: string, ref: LuaWorkflow | string, input?: LuaMapConfig, opts?: NestedWorkflowOptions): this;
4980
5003
  commit(): LuaWorkflow;
4981
5004
  }
4982
5005
 
@@ -5004,12 +5027,19 @@ export declare interface LuaWorkflowConfig {
5004
5027
  concurrencyPolicy?: 'allow' | 'forbid';
5005
5028
  /** Who may READ this workflow's run outputs beyond `workflows:read-outputs` holders (B44). Envelope member outside `graphHash`. */
5006
5029
  outputVisibility?: WorkflowOutputVisibility;
5007
- /** `maxDurationSeconds` default 604 800; 2 592 000 when the graph contains an approval / waitForSignal / suspend-capable step (P1-4). */
5008
- budget?: {
5009
- maxCredits?: number;
5010
- maxSteps?: number;
5011
- maxDurationSeconds?: number;
5012
- };
5030
+ /**
5031
+ * `maxDurationSeconds` default 604 800; 2 592 000 when the graph contains an approval / waitForSignal / suspend-capable
5032
+ * step (P1-4). The three members the SDK forwards, spelled by the ONE definition budget (`WorkflowDefinitionBudget`).
5033
+ *
5034
+ * `maxCredits` counts agent steps, never tokens (LUA-708): an inline agent step settles a flat 1 credit when it
5035
+ * completes, a `tier:'job'` attempt a flat 4 at its first claim (a retry is a new attempt). The run parks on a
5036
+ * budget gate (`nextAction:'raise_budget'`, `lua workflows raise-budget`) when what remains is under the next agent
5037
+ * step's reserve — so `maxCredits: 40` buys ten Job-tier attempts, and a value under 4 never dispatches one. Each
5038
+ * attempt then runs to its own wall (`timeoutSeconds`), `maxInputTokens` (default 4M ≈ $1–13 on a Sonnet-class
5039
+ * model), `maxMessages` and `maxTurns`; nothing meters its tokens against the credits mid-attempt. Size
5040
+ * `maxInputTokens` for what one attempt may cost and `maxCredits` for how many attempts the run may make.
5041
+ */
5042
+ budget?: Pick<WorkflowDefinitionBudget, 'maxCredits' | 'maxSteps' | 'maxDurationSeconds'>;
5013
5043
  /** verbatim LuaJob union (D12) → Job{kind:'workflow'} on publish */
5014
5044
  schedule?: JobSchedule;
5015
5045
  backfillOnEnable?: {
@@ -5042,16 +5072,16 @@ export declare interface LuaWorkflowStep<TIn extends ZodType = ZodType, TOut ext
5042
5072
  /** 1..600 (D19); default 300 — on `tier:'job'` 1..86 400, default 3600. */
5043
5073
  timeoutSeconds?: number;
5044
5074
  /** Run this step as a k8s Job (hours tier). Implied by `workspace`. */
5045
- tier?: 'job';
5075
+ tier?: WorkflowTier;
5046
5076
  workspace?: WorkflowStepWorkspace;
5047
- jobResources?: 'small' | 'medium' | 'large';
5077
+ jobResources?: WorkflowJobResources;
5048
5078
  jobTools?: WorkflowJobToolId[];
5049
5079
  /** default { maxAttempts: 1 } */
5050
5080
  retry?: RetryPolicy;
5051
5081
  /** default 'none'; 'external' ⇒ park on platform-fault reclaim. */
5052
- sideEffects?: 'none' | 'external';
5082
+ sideEffects?: WorkflowSideEffects;
5053
5083
  /** What the FINAL failure of this step does to the run (default 'fail'). */
5054
- onError?: 'fail' | 'continue' | 'park';
5084
+ onError?: WorkflowOnError;
5055
5085
  requiredConnections?: string[];
5056
5086
  /** Deadline for a `ctx.suspend()` suspension; default 168, max 720. */
5057
5087
  resumeTimeoutHours?: number;
@@ -5174,6 +5204,18 @@ declare type Message = TextMessage_2 | ImageMessage_2 | FileMessage_2;
5174
5204
 
5175
5205
  export declare const ne: <T>(l: TypedRef<T>, r: TypedRef<T> | Literal<T>) => LuaPredicate;
5176
5206
 
5207
+ /** `.workflow(id, ref, input?, opts?)` — a nested run (a `subrun` row). */
5208
+ export declare interface NestedWorkflowOptions {
5209
+ /** Mount the PARENT's run workspace in the child (05 §5.17.5; LUA-650) — the parent must declare one. */
5210
+ workspace?: 'inherit';
5211
+ /**
5212
+ * LUA-669 (#2446): the same policy a code / agent / tool step carries — the row re-arms when the child run ends
5213
+ * `failed` or `timed_out` on its own (a child the parent side ended — cancelled, abandoned — is never retried),
5214
+ * behind the WF-222 backoff, and every attempt starts a FRESH child run. Default `{ maxAttempts: 1 }`.
5215
+ */
5216
+ retry?: RetryPolicy;
5217
+ }
5218
+
5177
5219
  export declare const not: (arg: LuaPredicate) => LuaPredicate;
5178
5220
 
5179
5221
  export declare const notExists: (ref: TypedRef<unknown>) => LuaPredicate;
@@ -6076,6 +6118,11 @@ declare interface RequestOverrides {
6076
6118
  timeoutMs?: number;
6077
6119
  }
6078
6120
 
6121
+ /**
6122
+ * R12 — `ResumeStepResult` (§9.5.3): the loser of a resume race gets the recorded outcome, never a 4xx. LUA-738
6123
+ * (desktop #1018): `recorded.by` is the spec's `WorkflowActorRef` — lua-api projects lua-core's `{ kind, id }` onto
6124
+ * it (`system:timed_out` for the timeout sweep, `system:<id>` with `source:'webhook'` for a webhook caller).
6125
+ */
6079
6126
  declare type ResumeStepResult = {
6080
6127
  resumed: true;
6081
6128
  runStatus: WorkflowRunStatus;
@@ -6085,22 +6132,18 @@ declare type ResumeStepResult = {
6085
6132
  recorded: {
6086
6133
  at: number;
6087
6134
  by?: {
6088
- kind: string;
6089
- id?: string;
6135
+ subjectType: string;
6136
+ subjectId: string;
6137
+ source: string;
6090
6138
  };
6091
6139
  };
6092
6140
  runStatus: WorkflowRunStatus;
6093
6141
  };
6094
6142
 
6095
- export declare interface RetryPolicy {
6096
- maxAttempts: number;
6097
- /** delay before attempt 2 (default 0 = immediate) */
6098
- backoffSeconds?: number;
6099
- /** 'fixed' (default) | 'exponential' — an engine timer, never a sleep inside the step VM (P1-10). */
6100
- backoff?: 'fixed' | 'exponential';
6101
- /** default 3600; only meaningful with 'exponential' (`backoff-invalid` otherwise). */
6102
- maxBackoffSeconds?: number;
6103
- }
6143
+ /** The ONE retry shape (`@lua/shared-types` `WorkflowRetryPolicy`): `maxAttempts` ≥ 1; `backoffSeconds` (default 0 =
6144
+ * immediate) — an engine timer, never a sleep inside the step VM (P1-10); `backoff` 'fixed' (default) | 'exponential';
6145
+ * `maxBackoffSeconds` (default 3600) only meaningful with 'exponential' (`backoff-invalid` otherwise). */
6146
+ export declare type RetryPolicy = WorkflowRetryPolicy;
6104
6147
 
6105
6148
  export declare const rows: (s: LuaWorkflowStep<any, any, any> | string, path: string, page: {
6106
6149
  offset: number;
@@ -6191,7 +6234,7 @@ export declare interface SpecialistStepOptions {
6191
6234
  toolScope?: AgentToolScope;
6192
6235
  timeoutSeconds?: number;
6193
6236
  retry?: RetryPolicy;
6194
- onError?: 'fail' | 'continue' | 'park';
6237
+ onError?: WorkflowOnError;
6195
6238
  requiredConnections?: string[];
6196
6239
  }
6197
6240
 
@@ -6202,12 +6245,23 @@ declare interface SseFrame {
6202
6245
  data: unknown;
6203
6246
  }
6204
6247
 
6205
- /** R8 — 202 `{ runId, status:'queued'|'gated', watchHint, idempotentReplay? }`, or 200 the run detail when `waitSeconds` elapsed on a terminal/suspended run. */
6248
+ /**
6249
+ * R8 — 202 `{ runId, status:'queued'|'gated', watchHint }`, 200 `{ …, idempotentReplay:true, deduplicated:true,
6250
+ * workflowId, workflowName, startedAt }` on an Idempotency-Key replay (LUA-739: the EXISTING run's identity,
6251
+ * real status and real start — no run was created), or 200 the run detail when `waitSeconds` elapsed on a
6252
+ * terminal/suspended run.
6253
+ */
6206
6254
  declare interface StartWorkflowRunResult {
6207
6255
  runId: string;
6208
6256
  status: WorkflowRunStatus;
6209
6257
  watchHint?: string;
6210
6258
  idempotentReplay?: boolean;
6259
+ /** `true` ⇒ no run was created — `workflowId` / `workflowName` / `startedAt` / `status` are the existing holder's. */
6260
+ deduplicated?: boolean;
6261
+ workflowId?: string;
6262
+ workflowName?: string;
6263
+ /** ISO — the existing run's creation time. */
6264
+ startedAt?: string;
6211
6265
  output?: unknown;
6212
6266
  }
6213
6267
 
@@ -6446,8 +6500,8 @@ export declare interface ToolStepOptions {
6446
6500
  input?: LuaMapConfig;
6447
6501
  timeoutSeconds?: number;
6448
6502
  retry?: RetryPolicy;
6449
- sideEffects?: 'none' | 'external';
6450
- onError?: 'fail' | 'continue' | 'park';
6503
+ sideEffects?: WorkflowSideEffects;
6504
+ onError?: WorkflowOnError;
6451
6505
  requiredConnections?: string[];
6452
6506
  }
6453
6507
 
@@ -6903,7 +6957,7 @@ export declare interface WaitForSignalOptions {
6903
6957
  schema?: ZodType;
6904
6958
  timeoutHours?: number | TemplateBinding;
6905
6959
  /** default 'fail'; 'continue' ⇒ output {received:false,timedOut:true} */
6906
- onTimeout?: 'fail' | 'continue';
6960
+ onTimeout?: WorkflowSignalOnTimeout;
6907
6961
  businessHours?: WorkflowBusinessHours;
6908
6962
  /** default ['webhook','api','user'] */
6909
6963
  acceptedSources?: Array<'webhook' | 'api' | 'user' | 'agent'>;
@@ -7032,6 +7086,32 @@ declare interface WhatsAppTemplateUrlButton {
7032
7086
  example?: string | string[];
7033
7087
  }
7034
7088
 
7089
+ /** `approval.onDeny` (§6.4.11 deny-as-data): `'fail'` fails the step on a denial; default `'continue'`. */
7090
+ declare const WORKFLOW_APPROVAL_ON_DENY: readonly ["fail", "continue"];
7091
+
7092
+ /** D19-r2 (B22; 05 §5.17.6 Harness row) — both behind one `CodingHarness { run(turn) }`. */
7093
+ declare const WORKFLOW_JOB_HARNESSES: readonly ["claude-code", "generic"];
7094
+
7095
+ /** `jobResources` (05 §5.17): the Job-tier pod size class. Default `'small'` at spawn. */
7096
+ declare const WORKFLOW_JOB_RESOURCES: readonly ["small", "medium", "large"];
7097
+
7098
+ /** What the FINAL failure of a step does to the run: `'park'` → the §06 §6.3.5 exception gate. Default `'fail'`. */
7099
+ declare const WORKFLOW_ON_ERROR: readonly ["fail", "continue", "park"];
7100
+
7101
+ /** `backoff` absent ⇒ `'fixed'`; `'exponential'` = backoffSeconds·2^(attempt−1) capped at `maxBackoffSeconds`. */
7102
+ declare const WORKFLOW_RETRY_BACKOFFS: readonly ["fixed", "exponential"];
7103
+
7104
+ /** `sideEffects` (03 §3.1): `'external'` ⇒ park on platform-fault reclaim instead of retrying. Default `'none'`. */
7105
+ declare const WORKFLOW_SIDE_EFFECTS: readonly ["none", "external"];
7106
+
7107
+ /** `waitForSignal.onTimeout`: default `'fail'`; `'continue'` ⇒ output `{received:false, timedOut:true}`. */
7108
+ declare const WORKFLOW_SIGNAL_ON_TIMEOUT: readonly ["fail", "continue"];
7109
+
7110
+ /** The only tier a node may DECLARE (`tier:'job'`, implied by `workspace`); the worker tier is the absence. */
7111
+ declare const WORKFLOW_TIERS: readonly ["job"];
7112
+
7113
+ declare type WorkflowApprovalOnDeny = (typeof WORKFLOW_APPROVAL_ON_DENY)[number];
7114
+
7035
7115
  export declare type WorkflowApproverSpec = 'creator' | 'org-admins' | {
7036
7116
  users: string[] | TemplateBinding;
7037
7117
  } | {
@@ -7075,15 +7155,51 @@ export declare interface WorkflowBusinessHours {
7075
7155
  };
7076
7156
  }
7077
7157
 
7078
- declare interface WorkflowConnectionDeclaration {
7158
+ /** The ONE `connections[]` declaration shape (`@lua/shared-types`): `key` /^[a-z][a-z0-9_-]{0,63}$/ unique per workflow,
7159
+ * `integrationType` the catalog type (`'github'`, `'linear'`, …), optional `required` / `description`. */
7160
+ declare type WorkflowConnectionDeclaration = WorkflowConnectionDeclaration_2;
7161
+
7162
+ declare interface WorkflowConnectionDeclaration_2 {
7079
7163
  /** /^[a-z][a-z0-9_-]{0,63}$/ — unique per workflow. */
7080
7164
  key: string;
7081
- /** Catalog integration type (`'github'`, `'linear'`, …). */
7165
+ /** Catalog integration type (`github`, `linear`, …) the key resolves within. */
7082
7166
  integrationType: string;
7083
7167
  required?: boolean;
7084
7168
  description?: string;
7085
7169
  }
7086
7170
 
7171
+ /** The declared budget (10 §10.7.1) — every member optional on the DEFINITION; the server resolves
7172
+ * `maxDurationSeconds` onto the version (`WorkflowVersion.budget`) and the run. */
7173
+ declare interface WorkflowDefinitionBudget {
7174
+ /**
7175
+ * The run's credit ceiling — it counts agent steps, never tokens (LUA-708). An inline agent step settles a flat
7176
+ * 1 credit when it completes; a `tier:'job'` attempt settles a flat 4 at its first claim (a retry is a new
7177
+ * attempt). The engine parks the run on a budget gate (`nextAction:'raise_budget'`) when what remains is under
7178
+ * the next agent step's reserve, so `maxCredits: 40` is ten Job-tier attempts and a value under 4 never
7179
+ * dispatches one. A Job-tier attempt's own spend is bounded by its wall / `maxInputTokens` / `maxMessages`.
7180
+ */
7181
+ maxCredits?: number;
7182
+ maxSteps?: number;
7183
+ /** Job-tier seconds across the run (05 §5.17). */
7184
+ maxJobSeconds?: number;
7185
+ /** default 604 800; 2 592 000 when the graph contains an approval / waitForSignal / suspend-capable step (P1-4). */
7186
+ maxDurationSeconds?: number;
7187
+ }
7188
+
7189
+ export { WorkflowExec }
7190
+
7191
+ export { WorkflowExecBinary }
7192
+
7193
+ export { WorkflowExecError }
7194
+
7195
+ export { WorkflowExecErrorCode }
7196
+
7197
+ export { WorkflowExecOptions }
7198
+
7199
+ export { WorkflowExecRefusalReason }
7200
+
7201
+ export { WorkflowExecResult }
7202
+
7087
7203
  export declare interface WorkflowFourEyes {
7088
7204
  edit: WorkflowApproverSpec;
7089
7205
  approve: WorkflowApproverSpec;
@@ -7103,7 +7219,11 @@ export declare interface WorkflowGoalEnvelope {
7103
7219
  initialState?: Record<string, unknown>;
7104
7220
  }
7105
7221
 
7106
- export declare type WorkflowJobHarness = 'claude-code' | 'generic';
7222
+ export declare type WorkflowJobHarness = WorkflowJobHarness_2;
7223
+
7224
+ declare type WorkflowJobHarness_2 = (typeof WORKFLOW_JOB_HARNESSES)[number];
7225
+
7226
+ declare type WorkflowJobResources = (typeof WORKFLOW_JOB_RESOURCES)[number];
7107
7227
 
7108
7228
  export declare type WorkflowJobToolId = 'shell' | 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'git' | 'gh' | 'fetch';
7109
7229
 
@@ -7112,12 +7232,26 @@ export declare interface WorkflowMergePolicy {
7112
7232
  onConflict: 'fail' | 'agent';
7113
7233
  }
7114
7234
 
7235
+ declare type WorkflowOnError = (typeof WORKFLOW_ON_ERROR)[number];
7236
+
7115
7237
  export declare interface WorkflowOutputVisibility {
7116
7238
  roles: string[];
7117
7239
  users?: string[];
7118
7240
  ownerBypass?: boolean;
7119
7241
  }
7120
7242
 
7243
+ declare type WorkflowRetryBackoff = (typeof WORKFLOW_RETRY_BACKOFFS)[number];
7244
+
7245
+ declare interface WorkflowRetryPolicy {
7246
+ maxAttempts: number;
7247
+ /** delay before attempt 2 (default 0 = immediate) — an engine timer, never a sleep inside the step VM (P1-10). */
7248
+ backoffSeconds?: number;
7249
+ /** `'fixed'` (default) | `'exponential'` */
7250
+ backoff?: WorkflowRetryBackoff;
7251
+ /** default 3600; only meaningful with `'exponential'` (`backoff-invalid` otherwise). */
7252
+ maxBackoffSeconds?: number;
7253
+ }
7254
+
7121
7255
  /**
7122
7256
  * Matches WorkflowRunDto (R4 `fields:'summary'` — outputs are never inlined here).
7123
7257
  * The wire names the run `runId` (shared-types `WorkflowRunSummary`); `id` is the pre-R4 spelling some
@@ -7142,8 +7276,24 @@ declare interface WorkflowRun {
7142
7276
  reason?: string;
7143
7277
  since?: string;
7144
7278
  };
7279
+ /**
7280
+ * The pending / audited cancel request (`runCancelView`): who asked and when; `wall` when it was the run wall's
7281
+ * own (LUA-686); LUA-704: `forcedBy` / `forcedAt` / `forceReason` on a forced terminal (`abandoned`, or
7282
+ * `timed_out` when the wall's request was forced) — the run's own reason is the terminal's.
7283
+ */
7284
+ cancel?: {
7285
+ requestedAt: number;
7286
+ requestedBy: string;
7287
+ forceAvailableAt: number;
7288
+ wall?: boolean;
7289
+ forcedAt?: number;
7290
+ forcedBy?: string;
7291
+ forceReason?: string;
7292
+ };
7145
7293
  failureReason?: string;
7146
7294
  restricted?: boolean;
7295
+ /** R4 `fields:'full'` only (§9.3.1): the caller may not read this run's payloads — `output` / step outputs are withheld. */
7296
+ outputsHidden?: 'read-outputs' | 'cloud-task';
7147
7297
  /** LUA-623: the keys the run's version declares, and what each resolved to on its agent (`connection.resolved` rows). */
7148
7298
  connections?: {
7149
7299
  declared: Array<{
@@ -7307,6 +7457,14 @@ export declare interface WorkflowsApi {
7307
7457
  };
7308
7458
  }
7309
7459
 
7460
+ export { WorkflowShell }
7461
+
7462
+ export { WorkflowShellValue }
7463
+
7464
+ declare type WorkflowSideEffects = (typeof WORKFLOW_SIDE_EFFECTS)[number];
7465
+
7466
+ declare type WorkflowSignalOnTimeout = (typeof WORKFLOW_SIGNAL_ON_TIMEOUT)[number];
7467
+
7310
7468
  export declare interface WorkflowSpecialistRole {
7311
7469
  name: string;
7312
7470
  instructions: string;
@@ -7330,7 +7488,11 @@ export declare interface WorkflowStepContext<TIn = unknown, TResume = unknown, T
7330
7488
  /** What the prior invocation passed to `suspend()`. */
7331
7489
  suspendData?: unknown;
7332
7490
  getInitData<T = unknown>(): T;
7333
- /** Output of an UPSTREAM step. Throws `WorkflowStepResultError{ code:'STEP_RESULT_NOT_ANCESTOR' }` for a non-ancestor. */
7491
+ /**
7492
+ * Output of an UPSTREAM step. Throws `WorkflowStepResultError` — `code:'STEP_RESULT_NOT_ANCESTOR'` for a
7493
+ * non-ancestor (or unknown) id, `'STEP_RESULT_TOO_LARGE'` / `'STEP_RESULT_OFFLOADED'` for an output the claim
7494
+ * could not carry (see the error's doc for `bytes` / `reason`) — never `undefined`, never a raw ref object.
7495
+ */
7334
7496
  getStepResult<T = unknown>(stepId: string): T;
7335
7497
  /** Run-scoped KV, ledger-backed, ≤ 64KB total. `set` is durable when the step terminalizes. */
7336
7498
  state: {
@@ -7349,17 +7511,65 @@ export declare interface WorkflowStepContext<TIn = unknown, TResume = unknown, T
7349
7511
  signal: AbortSignal;
7350
7512
  /** Sub-agent env, exactly as jobs receive it. */
7351
7513
  env: Record<string, string>;
7352
- /** EXACTLY-ONCE effect keyed on `{occurrenceId, key}` (P1-18). Claim → run `fn` → settle. */
7514
+ /**
7515
+ * EXACTLY-ONCE effect keyed on `{occurrenceId, key}` (P1-18). Claim → run `fn` → settle. Served on every tier:
7516
+ * worker-tier steps and the offline driver, and (LUA-722) Job-tier code steps — the pod relays the claim / settle
7517
+ * under its own attempt token, so the key is scoped to the step's run / row / attempt server-side. A replayed key
7518
+ * (a retried attempt, a repair run) returns the settled result without running `fn`; a key a previous attempt
7519
+ * claimed and never settled throws `EFFECT_IN_DOUBT` (fail closed — `fn` never runs on an unknown claim state).
7520
+ * The result is JSON-serialised on settle, exactly like a step output: a `Date` replays as its ISO string, a
7521
+ * `BigInt` (or a cycle) fails the settle — `EFFECT_SETTLE_FAILED`, the key stays claimed — and a result over the
7522
+ * platform's cap (32 KB) is `EFFECT_SETTLE_FAILED` naming `EFFECT_RESULT_TOO_LARGE`. Calling `once` again for the
7523
+ * same key while its `fn` is still running (re-entrantly) throws `EFFECT_KEY_INVALID` at once.
7524
+ */
7353
7525
  once<T>(key: string, fn: () => Promise<T>): Promise<T>;
7354
- /** Job-tier steps only: the mounted run workspace. */
7526
+ /**
7527
+ * Job-tier steps only: the mounted run workspace, exactly as the Job pod hands it to `execute` (`ctx.workspace` in
7528
+ * `packages/lua-workflow-job/src/code-step.ts`): `root` is the absolute directory of the checkout (`/workspace`),
7529
+ * `branch` the run branch it is on, `headSha` the commit it was restored at, `mount` this step's declared mount,
7530
+ * `isolation` whether the step got its own worktree. LUA-679: the name is `root` — the 3.32.1 type and both
7531
+ * `lua init` examples said `path`, the pod never served it, and a copied definition died `ENOENT /workspace/undefined`.
7532
+ */
7355
7533
  workspace?: {
7356
- path: string;
7534
+ root: string;
7357
7535
  mount: 'rw' | 'ro';
7358
7536
  branch?: string;
7537
+ headSha?: string;
7538
+ isolation?: 'shared' | 'worktree';
7539
+ /**
7540
+ * @deprecated LUA-679 — read `root`. The Job pod serves `path` as an alias (a getter that returns `root` and warns
7541
+ * once per step) for one minor after 3.32 and then removes it; it never appears on `Object.keys(ctx.workspace)`.
7542
+ */
7543
+ readonly path?: string;
7544
+ /**
7545
+ * The run workspace's stamps, served when the pod hands them to the step (LUA-706): `baseSha` is the commit the
7546
+ * run's base ref resolved to at provision (a git workspace — `headSha` is where THIS step's checkout is), `arm`
7547
+ * the worktree arm id when the step runs in its own worktree (`isolation:'worktree'`), `backend` the volume
7548
+ * backend. Absent on an `empty` workspace, a shared-mount step, or a pod that predates them.
7549
+ */
7359
7550
  baseSha?: string;
7360
7551
  arm?: string;
7361
7552
  backend?: WorkflowWorkspaceBackend;
7362
7553
  };
7554
+ /**
7555
+ * Job-tier steps only (LUA-682): run one of `WORKFLOW_EXEC_BINARIES` (`git`, `gh`, `pnpm`, `npm`, `npx`, `node`,
7556
+ * `yarn`, `python3`, `pytest`, `make`) in the workspace — `exec(['git', 'status'], { cwd?, timeoutMs?, env? })`.
7557
+ * Argv only, never a shell: no `&&`, pipes, globs or `$VAR`; `cwd` must stay inside the workspace; the timeout
7558
+ * (default 10 min) is capped by the step's remaining wall; stdout / stderr are kept to 1 MiB each (`truncated`);
7559
+ * one command at a time. A non-zero exit is RETURNED (`result.code`) — `exec.strict` throws `WorkflowExecError`.
7560
+ * The Job pod spawns the command itself with a scrubbed env (no token, no `LUA_WF_*`; git goes through the
7561
+ * credential proxy exactly as the coding turn's does); `child_process` is not available to a code step and fails
7562
+ * `lua compile` with `node-capability-unavailable`. Worker-tier steps have neither `exec` nor `$`. Offline,
7563
+ * `lua workflows run --workspace <dir>` provides both with the same allowlist against your own PATH.
7564
+ */
7565
+ exec?: WorkflowExec;
7566
+ /**
7567
+ * Job-tier steps only (LUA-682): `exec` as a tagged template — `$\`gh pr create --title ${title} --body ${body}\``.
7568
+ * Literal text splits on whitespace (with `'…'` / `"…"` quoting); every `${value}` is exactly ONE argument, never
7569
+ * re-parsed (a title with spaces, a body with newlines); an array spreads into one argument per item; `undefined`
7570
+ * is refused rather than stringified. `$.strict` throws on a non-zero exit.
7571
+ */
7572
+ $?: WorkflowShell;
7363
7573
  /** The run artefact store (P1-8). */
7364
7574
  artefacts: {
7365
7575
  put(name: string, data: Uint8Array | string | ReadableStream, opts: {
@@ -7394,7 +7604,12 @@ export declare interface WorkflowStepContext<TIn = unknown, TResume = unknown, T
7394
7604
  }>;
7395
7605
  list(): Promise<WorkflowArtefactMeta[]>;
7396
7606
  };
7397
- /** Stamped by the executor for observability; read-only. */
7607
+ /**
7608
+ * Stamped by the executor for observability; read-only (frozen). Served on both tiers from the run's stamps
7609
+ * (LUA-706): `trigger` / `principalKind`, plus `parentRunId` / `traceparent` / `correlationKey` / `tags` /
7610
+ * `replyTo` when the run carries them; `agentVersion` is not stamped today. A run created before the stamps
7611
+ * existed reads `{}`. Offline, `lua workflows run` serves `{ trigger:'sdk', principalKind:'user' }`.
7612
+ */
7398
7613
  runtime: {
7399
7614
  trigger: WorkflowRunTrigger;
7400
7615
  parentRunId?: string;
@@ -7410,10 +7625,26 @@ export declare interface WorkflowStepContext<TIn = unknown, TResume = unknown, T
7410
7625
  };
7411
7626
  }
7412
7627
 
7413
- /** Thrown by `ctx.getStepResult` for a non-ancestor / unknown id — never `undefined` (03 §3.1). */
7628
+ /**
7629
+ * Thrown by `ctx.getStepResult` — never `undefined`, never a raw ref object (03 §3.1). Check `err.code`, never
7630
+ * `instanceof` (a step runs in its own realm on every tier):
7631
+ * - `STEP_RESULT_NOT_ANCESTOR` — `stepId` is not an upstream step of this one (or is unknown);
7632
+ * - `STEP_RESULT_TOO_LARGE` — the ancestor's output could not ride the claim beside its siblings (the 4 MiB
7633
+ * `stepResults` wire budget, dropped largest-first); `bytes` is its serialized size;
7634
+ * - `STEP_RESULT_OFFLOADED` — the ledger holds the output offloaded (> 256 KB) and the claim could not carry it
7635
+ * hydrated; `bytes` is its size, `reason` why: `over_wire_cap` (it would break the budget), `hydrate_timeout`
7636
+ * (the per-claim hydration deadline passed), or the control plane's code (`CDN_REF_MISSING`, `CDN_REF_CORRUPT`,
7637
+ * `CDN_REF_FOREIGN`, …).
7638
+ * For the last two, bind the value through the step's input instead, or read it via `ctx.artefacts` /
7639
+ * `ctx.datasets`. The offline driver (`lua workflows execute`) only ever throws the first.
7640
+ */
7414
7641
  export declare interface WorkflowStepResultError extends Error {
7415
- code: 'STEP_RESULT_NOT_ANCESTOR';
7642
+ code: 'STEP_RESULT_NOT_ANCESTOR' | 'STEP_RESULT_TOO_LARGE' | 'STEP_RESULT_OFFLOADED';
7416
7643
  stepId: string;
7644
+ /** `STEP_RESULT_TOO_LARGE` / `STEP_RESULT_OFFLOADED`: the output's serialized size. */
7645
+ bytes?: number;
7646
+ /** `STEP_RESULT_OFFLOADED`: why the claim could not carry it. */
7647
+ reason?: string;
7417
7648
  }
7418
7649
 
7419
7650
  export declare interface WorkflowStepWorkspace {
@@ -7432,6 +7663,8 @@ export declare type WorkflowSuspendTimeoutChainMember = 'deny' | 'cancel-run' |
7432
7663
  timeoutHours: number;
7433
7664
  };
7434
7665
 
7666
+ declare type WorkflowTier = (typeof WORKFLOW_TIERS)[number];
7667
+
7435
7668
  export declare type WorkflowWorkspaceBackend = 'ebs' | 'efs' | 's3';
7436
7669
 
7437
7670
  export declare type WorkspaceSpec = {
@@ -7448,6 +7681,10 @@ export declare type WorkspaceSpec = {
7448
7681
  kind: 'empty';
7449
7682
  sizeGb?: number;
7450
7683
  ttlHours?: number;
7684
+ /**
7685
+ * Keep the volume after the run completes: held until `ttlHours` (24 h when undeclared), then expired. A kept
7686
+ * volume holds one of the organisation's workspace slots (`maxWorkspacesPerOrg`, 10 by default) until then.
7687
+ */
7451
7688
  keepArtefacts?: boolean;
7452
7689
  backend?: WorkflowWorkspaceBackend;
7453
7690
  };