lua-cli 3.30.0 → 3.32.1
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.
- package/dist/api-exports.d.ts +1096 -41
- package/dist/api-exports.js +5544 -137
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +21255 -8412
- package/dist/index.js.map +1 -1
- package/dist/voice/test/index.d.ts +4 -4
- package/dist/workflow-builder.d.ts +800 -0
- package/dist/workflow-builder.js +6273 -0
- package/dist/workflow-builder.js.map +1 -0
- package/docs/API_INDEX.md +2 -0
- package/docs/README.md +27 -9
- package/docs/api/Jobs.md +10 -10
- package/docs/api/LuaWorkflow.md +89 -0
- package/docs/api/Workflows.md +111 -0
- package/docs/workflows/approvals.md +41 -0
- package/docs/workflows/artefacts-and-datasets.md +19 -0
- package/docs/workflows/coding-harness.md +12 -0
- package/docs/workflows/compliance-gates.md +16 -0
- package/docs/workflows/connections-in-coding-turns.md +10 -0
- package/docs/workflows/correlation-keys.md +11 -0
- package/docs/workflows/env-overlays.md +12 -0
- package/docs/workflows/evidence-bundles.md +11 -0
- package/docs/workflows/exports.md +5 -0
- package/docs/workflows/external-content-and-toolscope.md +11 -0
- package/docs/workflows/git-credentials.md +32 -0
- package/docs/workflows/goals.md +46 -0
- package/docs/workflows/knowledge-bindings.md +13 -0
- package/docs/workflows/limits.md +11 -0
- package/docs/workflows/long-steps-and-checkpoints.md +13 -0
- package/docs/workflows/migrating-cloud-tasks.md +9 -0
- package/docs/workflows/migrating-runs.md +13 -0
- package/docs/workflows/output-visibility.md +9 -0
- package/docs/workflows/per-item-approvals.md +9 -0
- package/docs/workflows/private-network-sources.md +12 -0
- package/docs/workflows/recovery.md +32 -0
- package/docs/workflows/replay-local.md +35 -0
- package/docs/workflows/reply-channels.md +11 -0
- package/docs/workflows/retention-and-archival.md +82 -0
- package/docs/workflows/roles.md +12 -0
- package/docs/workflows/schedules.md +26 -0
- package/docs/workflows/script-form.md +50 -0
- package/docs/workflows/testing-offline.md +49 -0
- package/docs/workflows/workspace-backends.md +11 -0
- package/docs/workflows/workspaces-and-long-steps.md +29 -0
- package/package.json +8 -3
- package/scripts/run-api-extractor.mjs +1 -1
- package/template/.gitignore +2 -0
- package/template/examples/workflows/CLAUDE.md +27 -0
- package/template/examples/workflows/adversarial-verify.workflow.script.js +48 -0
- package/template/examples/workflows/github-review.webhook.ts +19 -0
- package/template/examples/workflows/linear-ready.trigger.ts +21 -0
- package/template/examples/workflows/outreach.ts +55 -0
- package/template/examples/workflows/pr-review-round.ts +75 -0
- package/template/examples/workflows/provision-tenant.ts +35 -0
- package/template/examples/workflows/refund-approval.ts +57 -0
- package/template/examples/workflows/research-brief.ts +42 -0
- package/template/examples/workflows/reviewed-brief.ts +19 -0
- package/template/examples/workflows/support-triage.ts +81 -0
- package/template/examples/workflows/ticket-to-pr.ts +137 -0
- package/template/examples/workflows/vendor-invoices.ts +83 -0
- package/template/lua.skill.yaml +1 -0
- package/template/package.json +1 -1
package/dist/api-exports.d.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
+
import { ArtefactRef } from '@lua/workflow-graph';
|
|
1
2
|
import { CallWarning } from 'ai';
|
|
3
|
+
import { DatasetRef } from '@lua/workflow-graph';
|
|
4
|
+
import { EnvRefBinding } from '@lua/workflow-graph';
|
|
2
5
|
import { FinishReason } from 'ai';
|
|
6
|
+
import { fromKnowledge as fromKnowledge_2 } from '@lua/workflow-graph';
|
|
7
|
+
import { JsonSchema } from '@lua/workflow-graph';
|
|
8
|
+
import { KnowledgeBindingSpec } from '@lua/workflow-graph';
|
|
3
9
|
import { LanguageModelUsage } from 'ai';
|
|
10
|
+
import { Literal } from '@lua/workflow-graph';
|
|
11
|
+
import { LuaMapConfig } from '@lua/workflow-graph';
|
|
12
|
+
import { LuaPredicate } from '@lua/workflow-graph';
|
|
13
|
+
import { MapDescriptor } from '@lua/workflow-graph';
|
|
4
14
|
import { ModelMessage } from 'ai';
|
|
15
|
+
import { PathOrLiteral } from '@lua/workflow-graph';
|
|
5
16
|
import { ReasoningOutput } from 'ai';
|
|
17
|
+
import { SerializedWorkflowGraph } from '@lua/workflow-graph';
|
|
18
|
+
import { TemplateBinding } from '@lua/workflow-graph';
|
|
19
|
+
import { TypedRef } from '@lua/workflow-graph';
|
|
6
20
|
import { UserContent } from 'ai';
|
|
21
|
+
import { WorkflowGraphEntry } from '@lua/workflow-graph';
|
|
7
22
|
import { z } from 'zod';
|
|
8
23
|
import { ZodType } from 'zod';
|
|
9
24
|
|
|
@@ -13,8 +28,11 @@ import { ZodType } from 'zod';
|
|
|
13
28
|
* not exposed to skill code.
|
|
14
29
|
*/
|
|
15
30
|
declare interface AgentInvocationEffects {
|
|
16
|
-
reviewDraftsCreated
|
|
17
|
-
storage
|
|
31
|
+
reviewDraftsCreated?: number;
|
|
32
|
+
storage?: 'lua_inbox';
|
|
33
|
+
/** Set once per run when the agent reported it could not finish. Trusted
|
|
34
|
+
* side channel: the run's own account of why, not a regex over its prose. */
|
|
35
|
+
blocker?: TaskRunBlocker;
|
|
18
36
|
}
|
|
19
37
|
|
|
20
38
|
/**
|
|
@@ -103,22 +121,75 @@ declare interface AgentInvocationInput {
|
|
|
103
121
|
/** Per-request model override ("provider/model" code). Unknown codes fall back per
|
|
104
122
|
* approved-models policy server-side. */
|
|
105
123
|
model?: string;
|
|
106
|
-
/** Task 14 (tasks-redesign) — per-task connector + skill scoping. See `AgentToolScope`. */
|
|
107
|
-
toolScope?: AgentToolScope;
|
|
108
124
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
|
|
125
|
+
* LUA-655 (review M2) — a platform re-ask the customer must not pay for: the workflow executor's
|
|
126
|
+
* output-repair turns. Honoured server-side ONLY on internally-authenticated turns
|
|
127
|
+
* (`buildChatRequest` drops a Bearer client's value): it rides `handleBilling` → lua-api's
|
|
128
|
+
* `deduct-credits` as `skipCredits`, which skips the legacy credit deduction (the seat gate and
|
|
129
|
+
* the settlement usage event still run, the skill-override posture).
|
|
130
|
+
*/
|
|
131
|
+
skipCredits?: boolean;
|
|
132
|
+
/** Task 14 (tasks-redesign) — per-task connector + skill scoping. See `AgentToolScope`. */
|
|
133
|
+
toolScope?: AgentToolScope_2;
|
|
134
|
+
/**
|
|
135
|
+
* PRO-979 (A3) — cooperative mid-run cancellation. Aborting tears down the
|
|
136
|
+
* loopback HTTP call AND propagates to the server-side turn: the serving
|
|
137
|
+
* pod's `ActiveChatTurnRegistry` sees the socket close and aborts the turn
|
|
138
|
+
* signal (`'client_disconnected'`), which flows through
|
|
139
|
+
* `ChatRequest.clientAbortSignal` into Mastra's
|
|
140
|
+
* `agent.generate({ abortSignal })` loop, so the in-flight turn stops
|
|
141
|
+
* generating (the D4 abort chain, pinned by the Phase-0
|
|
142
|
+
* `chat-generate-abort.contract` spec). Propagation is asynchronous:
|
|
143
|
+
* callers that abort must still treat side effects already dispatched at
|
|
144
|
+
* abort time (e.g. an in-flight tool call) as possible and record them (the
|
|
145
|
+
* job runner's ledger does, via postFence). NOT serialized on the wire —
|
|
146
|
+
* this field exists only on in-process invocations.
|
|
115
147
|
*/
|
|
116
148
|
signal?: AbortSignal;
|
|
149
|
+
/**
|
|
150
|
+
* Workflows D10 (WF-003) — JSON Schema for a typed structured output on
|
|
151
|
+
* this turn. Honored server-side ONLY on internally-authenticated turns
|
|
152
|
+
* (`X-Internal-Auth`): `ChatService.buildChatRequest` copies it onto the
|
|
153
|
+
* `ChatRequest` and `AgentService.generate` forwards it as Mastra
|
|
154
|
+
* `structuredOutput`, so the result carries a schema-shaped `object`. A
|
|
155
|
+
* Bearer client's value is dropped before it can reach the model — same
|
|
156
|
+
* posture as `toolScope`.
|
|
157
|
+
*/
|
|
158
|
+
outputSchema?: Record<string, unknown>;
|
|
159
|
+
/**
|
|
160
|
+
* Workflows D11 (WF-003) — retry-stable billing identity for the turn
|
|
161
|
+
* (e.g. `wf:<runId>:<stepId>:<billingEpoch>`), letting the credit deduction
|
|
162
|
+
* be idempotent across step retries. Internal-auth-only, same posture as
|
|
163
|
+
* `outputSchema`/`toolScope`; a Bearer client's value is dropped.
|
|
164
|
+
*/
|
|
165
|
+
operationId?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Workflows D25 (WF-216, 04 §4.2.7 runtime 3) — the ephemeral specialist's
|
|
168
|
+
* additive role for THIS turn: `name` (the role name; attribution key
|
|
169
|
+
* `luaWorkflowRole`), `block` (the rendered `<lua-workflow-role>` block
|
|
170
|
+
* `PromptService` appends AFTER the owner's own persona/instructions) and
|
|
171
|
+
* `tools` (the explicit tool-id allowlist `DynamicToolService` intersects
|
|
172
|
+
* with the owner's toolset). Internal-auth-only, same posture as
|
|
173
|
+
* `outputSchema`/`toolScope`: a Bearer client's value is dropped. Never a
|
|
174
|
+
* `systemPrompt` — the persona is the owner's.
|
|
175
|
+
*/
|
|
176
|
+
workflowRole?: {
|
|
177
|
+
name: string;
|
|
178
|
+
block: string;
|
|
179
|
+
tools: string[];
|
|
180
|
+
};
|
|
117
181
|
}
|
|
118
182
|
|
|
119
183
|
declare interface AgentInvocationOutput {
|
|
120
184
|
/** Final response text (post-processor-modified, if applicable). */
|
|
121
185
|
text: string;
|
|
186
|
+
/**
|
|
187
|
+
* Workflows D10 (WF-003/WF-108) — the schema-shaped structured result of a
|
|
188
|
+
* turn that carried `outputSchema`. Present ONLY when the turn ran with
|
|
189
|
+
* Mastra `structuredOutput` (internal-auth-only, so Bearer callers can never
|
|
190
|
+
* receive it); absent otherwise — legacy outputs are byte-identical.
|
|
191
|
+
*/
|
|
192
|
+
object?: unknown;
|
|
122
193
|
/** AI SDK `FinishReason` (or `'preprocessor_blocked'` / `'governance_blocked'`). */
|
|
123
194
|
finishReason?: string;
|
|
124
195
|
/** Token usage summary. */
|
|
@@ -226,6 +297,43 @@ export declare interface AgentsApi {
|
|
|
226
297
|
invoke(targetAgentId: string, input: AgentInvocationInput): Promise<AgentInvocationOutput>;
|
|
227
298
|
}
|
|
228
299
|
|
|
300
|
+
export declare interface AgentStepOptions {
|
|
301
|
+
agentId: string | EnvRefBinding;
|
|
302
|
+
prompt: TemplateLike;
|
|
303
|
+
outputSchema?: ZodType;
|
|
304
|
+
model?: string;
|
|
305
|
+
toolScope?: AgentToolScope & {
|
|
306
|
+
jobTools?: WorkflowJobToolId[];
|
|
307
|
+
};
|
|
308
|
+
timeoutSeconds?: number;
|
|
309
|
+
retry?: RetryPolicy;
|
|
310
|
+
onError?: 'fail' | 'continue' | 'park';
|
|
311
|
+
requiredConnections?: string[];
|
|
312
|
+
/** static-only persona override (§11 S3) */
|
|
313
|
+
systemPrompt?: string;
|
|
314
|
+
tier?: 'job';
|
|
315
|
+
workspace?: WorkflowStepWorkspace;
|
|
316
|
+
jobResources?: 'small' | 'medium' | 'large';
|
|
317
|
+
harness?: WorkflowJobHarness;
|
|
318
|
+
/** Coding-turn cap for a tier:'job' step (1..500); absent ⇒ the platform default. A monorepo change needs more than the default. */
|
|
319
|
+
maxTurns?: number;
|
|
320
|
+
/**
|
|
321
|
+
* Per-ATTEMPT ceilings for a tier:'job' step (LUA-636): `maxTurns` bounds one harness query; these bound the whole
|
|
322
|
+
* attempt (every pass and resumed segment). Crossing one checkpoints the workspace and ends the attempt
|
|
323
|
+
* `attempt_budget_exhausted` — retryable, so the step's `retry` policy continues from that tree with a fresh
|
|
324
|
+
* 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).
|
|
326
|
+
*/
|
|
327
|
+
maxMessages?: number;
|
|
328
|
+
maxInputTokens?: number;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export declare interface AgentToolScope {
|
|
332
|
+
connectionIds?: string[];
|
|
333
|
+
skillIds?: string[];
|
|
334
|
+
toolIds?: string[];
|
|
335
|
+
}
|
|
336
|
+
|
|
229
337
|
/**
|
|
230
338
|
* Task 14 (tasks-redesign) — per-task connector + skill scoping for a scheduled
|
|
231
339
|
* agent run. Non-empty `connectionIds` restricts the turn's MCP servers to the
|
|
@@ -236,7 +344,7 @@ export declare interface AgentsApi {
|
|
|
236
344
|
* `X-Internal-Auth` agent-invoke path used by the server-side job runner) —
|
|
237
345
|
* lua-core drops it from any client-authenticated `/chat/*` request.
|
|
238
346
|
*/
|
|
239
|
-
declare interface
|
|
347
|
+
declare interface AgentToolScope_2 {
|
|
240
348
|
/** Allowlisted agent connection ids (UnifiedTo `unifiedId`s). */
|
|
241
349
|
connectionIds?: string[];
|
|
242
350
|
/** Allowlisted skill ids (from the agent's `subAgent.skills`). */
|
|
@@ -384,6 +492,8 @@ export declare interface AiGenerateToolResult {
|
|
|
384
492
|
isError?: boolean;
|
|
385
493
|
}
|
|
386
494
|
|
|
495
|
+
export declare const and: (...args: LuaPredicate[]) => LuaPredicate;
|
|
496
|
+
|
|
387
497
|
/**
|
|
388
498
|
* Common Interfaces
|
|
389
499
|
* Shared interfaces used across multiple modules
|
|
@@ -419,9 +529,45 @@ declare interface ApiResponse<T = any> {
|
|
|
419
529
|
error?: string;
|
|
420
530
|
oldAccountLabel?: string;
|
|
421
531
|
newAccountLabel?: string;
|
|
532
|
+
/** Workflow envelope detail (09 §9.11 `{ statusCode, message, code, ...detail }` is spread top-level). */
|
|
533
|
+
issues?: Array<{
|
|
534
|
+
path?: string;
|
|
535
|
+
message?: string;
|
|
536
|
+
code?: string;
|
|
537
|
+
}>;
|
|
538
|
+
stepId?: string;
|
|
539
|
+
/** the live step status on 409 NOT_SUSPENDED (LUA-644) */
|
|
540
|
+
status?: string;
|
|
422
541
|
};
|
|
423
542
|
}
|
|
424
543
|
|
|
544
|
+
export declare interface ApprovalOptions {
|
|
545
|
+
title: string;
|
|
546
|
+
details?: TemplateBinding;
|
|
547
|
+
/** default 'creator' */
|
|
548
|
+
approver?: WorkflowApproverSpec;
|
|
549
|
+
excludeInitiator?: boolean;
|
|
550
|
+
fourEyes?: WorkflowFourEyes;
|
|
551
|
+
/** default 168; a binding is resolved at suspend time and must yield 1..720 */
|
|
552
|
+
timeoutHours?: number | TemplateBinding;
|
|
553
|
+
/** 'deny' (default) | 'cancel-run' | 'fail' | a chain of ≤ 3 hops ending in one terminal member */
|
|
554
|
+
onTimeout?: WorkflowSuspendTimeoutChain;
|
|
555
|
+
/** default 'continue' (denial is data unless 'fail') */
|
|
556
|
+
onDeny?: 'fail' | 'continue';
|
|
557
|
+
businessHours?: WorkflowBusinessHours;
|
|
558
|
+
editable?: boolean;
|
|
559
|
+
/** grammar: `drafts`, `drafts[*]`, `drafts[*].body`, `drafts[3].body`, `summary.title` */
|
|
560
|
+
editablePaths?: string[];
|
|
561
|
+
editedPayloadSchema?: ZodType;
|
|
562
|
+
itemsPath?: string;
|
|
563
|
+
itemApprover?: WorkflowApproverSpec | {
|
|
564
|
+
fromItem: string;
|
|
565
|
+
};
|
|
566
|
+
itemTimeout?: WorkflowSuspendOnTimeout;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export { ArtefactRef }
|
|
570
|
+
|
|
425
571
|
/**
|
|
426
572
|
* Complete basket entity.
|
|
427
573
|
* Full basket object as stored in the database.
|
|
@@ -748,6 +894,28 @@ declare interface BrowserSwitchConfig {
|
|
|
748
894
|
maxSessionMinutes?: number;
|
|
749
895
|
}
|
|
750
896
|
|
|
897
|
+
/** What `.commit()` hands to `LuaWorkflow` — internal; never `new LuaWorkflow({...})` by users. */
|
|
898
|
+
declare interface BuiltWorkflow {
|
|
899
|
+
config: LuaWorkflowConfig;
|
|
900
|
+
graph: WorkflowGraphEntry[];
|
|
901
|
+
steps: Record<string, LuaWorkflowStep<any, any, any>>;
|
|
902
|
+
warnings: LuaWorkflowBuildWarning[];
|
|
903
|
+
envTemplateKeys: string[];
|
|
904
|
+
/** `.workflow(id, ref, …, { workspace })` targets; `workspace:'inherit'` marks an inherit child — the compiler defers `workspace-not-declared` for it (03 §3.1). */
|
|
905
|
+
nestedRefs: Array<{
|
|
906
|
+
id: string;
|
|
907
|
+
name: string;
|
|
908
|
+
workspace?: 'inherit';
|
|
909
|
+
}>;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/** R11 — `CancelRunVerdict` (PRO-979 vocabulary). */
|
|
913
|
+
declare interface CancelRunVerdict {
|
|
914
|
+
status: WorkflowRunStatus;
|
|
915
|
+
nextAction: string;
|
|
916
|
+
forceAvailableAt?: string;
|
|
917
|
+
}
|
|
918
|
+
|
|
751
919
|
/**
|
|
752
920
|
* CDN API
|
|
753
921
|
* Upload and retrieve files from the Lua CDN
|
|
@@ -1142,6 +1310,9 @@ export declare interface ChatHistoryMessage {
|
|
|
1142
1310
|
*/
|
|
1143
1311
|
export declare type ChatMessage = TextMessage | ImageMessage | FileMessage;
|
|
1144
1312
|
|
|
1313
|
+
/** A container arm: a `StepRef`, or (B14 — lands with WF-509) the two-element chain `[mapConfig, stepRef]`. */
|
|
1314
|
+
export declare type ContainerArm = StepRef | [LuaMapConfig, StepRef];
|
|
1315
|
+
|
|
1145
1316
|
/**
|
|
1146
1317
|
* Options for creating a custom data entry.
|
|
1147
1318
|
*/
|
|
@@ -1196,6 +1367,10 @@ declare interface CreateOrderRequest {
|
|
|
1196
1367
|
};
|
|
1197
1368
|
}
|
|
1198
1369
|
|
|
1370
|
+
export declare function createStep<TIn extends ZodType, TOut extends ZodType, TResume extends ZodType = ZodType>(s: LuaWorkflowStep<TIn, TOut, TResume>): LuaWorkflowStep<TIn, TOut, TResume>;
|
|
1371
|
+
|
|
1372
|
+
export declare function createWorkflow(cfg: LuaWorkflowConfig): LuaWorkflowBuilder;
|
|
1373
|
+
|
|
1199
1374
|
/**
|
|
1200
1375
|
* Custom Data API contract.
|
|
1201
1376
|
* Defines operations for managing custom data collections with vector search.
|
|
@@ -1459,6 +1634,8 @@ export declare class DataEntryInstance {
|
|
|
1459
1634
|
save(searchText?: string): Promise<boolean>;
|
|
1460
1635
|
}
|
|
1461
1636
|
|
|
1637
|
+
export { DatasetRef }
|
|
1638
|
+
|
|
1462
1639
|
/**
|
|
1463
1640
|
* Define a device that an agent can communicate with.
|
|
1464
1641
|
*
|
|
@@ -1556,6 +1733,8 @@ export declare function defineTrigger<T = any>(config: LuaTriggerConfig<T>): Lua
|
|
|
1556
1733
|
*/
|
|
1557
1734
|
export declare function defineVoice(config: LuaVoiceConfig): LuaVoice;
|
|
1558
1735
|
|
|
1736
|
+
export declare function defineWorkflow(cfg: LuaWorkflowConfig, build: (wf: LuaWorkflowBuilder) => LuaWorkflow): LuaWorkflow;
|
|
1737
|
+
|
|
1559
1738
|
/**
|
|
1560
1739
|
* Response from deleting custom data entry.
|
|
1561
1740
|
*/
|
|
@@ -1672,6 +1851,8 @@ export declare interface DeliveryView {
|
|
|
1672
1851
|
failedAt?: string;
|
|
1673
1852
|
}
|
|
1674
1853
|
|
|
1854
|
+
declare type Depth = [never, 0, 1, 2, 3, 4];
|
|
1855
|
+
|
|
1675
1856
|
/** Configuration for a single device command (agent → device) */
|
|
1676
1857
|
export declare interface DeviceCommandConfig {
|
|
1677
1858
|
/** Description of what this command does */
|
|
@@ -1735,6 +1916,11 @@ export declare interface DirectoryTarget {
|
|
|
1735
1916
|
validated: boolean;
|
|
1736
1917
|
}
|
|
1737
1918
|
|
|
1919
|
+
/** Template-literal walk of T's object keys, depth ≤ 4 (P1-21). */
|
|
1920
|
+
export declare type DotPath<T, D extends number = 4> = [D] extends [never] ? never : T extends readonly unknown[] ? never : T extends object ? {
|
|
1921
|
+
[K in keyof T & string]: NonNullable<T[K]> extends object ? K | `${K}.${DotPath<NonNullable<T[K]>, Depth[D]>}` : K;
|
|
1922
|
+
}[keyof T & string] : never;
|
|
1923
|
+
|
|
1738
1924
|
/** A single email attachment, referenced by URL — lua-email fetches the bytes
|
|
1739
1925
|
* server-side and attaches them, keeping large files off the SDK→API hops. */
|
|
1740
1926
|
declare interface EmailAttachmentInput {
|
|
@@ -1781,21 +1967,31 @@ export declare interface EmailSendInput {
|
|
|
1781
1967
|
}
|
|
1782
1968
|
|
|
1783
1969
|
/**
|
|
1784
|
-
*
|
|
1785
|
-
* Gets injected at runtime with skill-specific environment variables.
|
|
1786
|
-
*
|
|
1787
|
-
* Checks process environment variables (.env file)
|
|
1970
|
+
* Read a sub-agent env key.
|
|
1788
1971
|
*
|
|
1789
|
-
*
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
1792
|
-
*
|
|
1793
|
-
*
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1972
|
+
* Workflows (03 §3.1, WF-201): at MODULE TOP LEVEL of a workflow file the
|
|
1973
|
+
* compiler's tier-1 sandbox replaces this with a stub that returns `''` and
|
|
1974
|
+
* records the key into `ManifestWorkflow.envKeys[]`; inside `execute` it is
|
|
1975
|
+
* `ctx.env[key]`. `env.template(KEY)` (Cluster K — B33) returns the
|
|
1976
|
+
* `{ __envRef: KEY }` placeholder legal wherever a `template(...)` binding is —
|
|
1977
|
+
* never a value at construction time — and `lua push` resolves it from the
|
|
1978
|
+
* TARGET agent env into the version's `envOverlay`.
|
|
1979
|
+
*/
|
|
1980
|
+
export declare const env: ((key: string, opts?: {
|
|
1981
|
+
manifest?: boolean;
|
|
1982
|
+
}) => string | undefined) & {
|
|
1983
|
+
template: (key: string) => {
|
|
1984
|
+
__envRef: string;
|
|
1985
|
+
};
|
|
1986
|
+
};
|
|
1987
|
+
|
|
1988
|
+
export { EnvRefBinding }
|
|
1989
|
+
|
|
1990
|
+
export declare const eq: <T>(l: TypedRef<T>, r: TypedRef<T> | Literal<T>) => LuaPredicate;
|
|
1991
|
+
|
|
1992
|
+
export declare const exists: (ref: TypedRef<unknown>) => LuaPredicate;
|
|
1993
|
+
|
|
1994
|
+
export declare const falsy: (ref: TypedRef<unknown>) => LuaPredicate;
|
|
1799
1995
|
|
|
1800
1996
|
export declare interface FileMessage {
|
|
1801
1997
|
type: 'file';
|
|
@@ -1809,6 +2005,37 @@ declare type FileMessage_2 = {
|
|
|
1809
2005
|
mediaType: string;
|
|
1810
2006
|
};
|
|
1811
2007
|
|
|
2008
|
+
export declare interface ForeachOptions {
|
|
2009
|
+
/** Cluster G (B34): PURE builder lowering — emits `{ type:'mapping', id:'<foreachId>_items', mapConfig:{'': items} }` before the foreach entry. */
|
|
2010
|
+
items?: TypedRef<unknown[]> | {
|
|
2011
|
+
step: string;
|
|
2012
|
+
path: string;
|
|
2013
|
+
} | {
|
|
2014
|
+
initData: true;
|
|
2015
|
+
path?: string;
|
|
2016
|
+
};
|
|
2017
|
+
/** default 4, max 16 */
|
|
2018
|
+
concurrency?: number;
|
|
2019
|
+
/** default 256 — a FAIL-FAST bound at runtime, never a truncation (P0-6). */
|
|
2020
|
+
maxItems?: number;
|
|
2021
|
+
chunk?: {
|
|
2022
|
+
size: number;
|
|
2023
|
+
};
|
|
2024
|
+
rateLimit?: {
|
|
2025
|
+
perSecond?: number;
|
|
2026
|
+
perMinute?: number;
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
export declare const fromInit: (path: string) => MapDescriptor;
|
|
2031
|
+
|
|
2032
|
+
export declare const fromKnowledge: typeof fromKnowledge_2;
|
|
2033
|
+
|
|
2034
|
+
export declare const fromRequest: (path: string) => MapDescriptor;
|
|
2035
|
+
|
|
2036
|
+
/** path default '' = whole output */
|
|
2037
|
+
export declare const fromStep: (s: LuaWorkflowStep<any, any, any> | string | Array<LuaWorkflowStep<any, any, any> | string>, path?: string) => MapDescriptor;
|
|
2038
|
+
|
|
1812
2039
|
/**
|
|
1813
2040
|
* Response from getting custom data entries.
|
|
1814
2041
|
* Includes pagination information.
|
|
@@ -1887,6 +2114,10 @@ declare interface GovernanceConfig {
|
|
|
1887
2114
|
serverUrl?: string;
|
|
1888
2115
|
}
|
|
1889
2116
|
|
|
2117
|
+
export declare const gt: (l: TypedRef<number> | number, r: TypedRef<number> | Literal<number> | number) => LuaPredicate;
|
|
2118
|
+
|
|
2119
|
+
export declare const gte: (l: TypedRef<number> | number, r: TypedRef<number> | Literal<number> | number) => LuaPredicate;
|
|
2120
|
+
|
|
1890
2121
|
/**
|
|
1891
2122
|
* Function type for resolving headers at runtime.
|
|
1892
2123
|
* Use env() inside to access agent environment variables.
|
|
@@ -1920,6 +2151,13 @@ declare abstract class HttpClient {
|
|
|
1920
2151
|
* @private
|
|
1921
2152
|
*/
|
|
1922
2153
|
private request;
|
|
2154
|
+
/**
|
|
2155
|
+
* Non-2xx classification shared by `request` and `httpStream` (WF-204): 401s become
|
|
2156
|
+
* `AuthenticationError` (ownership vs credential), 403s throw, everything else returns the
|
|
2157
|
+
* `{ success:false, error }` envelope with the server body spread in.
|
|
2158
|
+
* @private
|
|
2159
|
+
*/
|
|
2160
|
+
private classifyErrorResponse;
|
|
1923
2161
|
/**
|
|
1924
2162
|
* Checks if an HTTP status code is retryable
|
|
1925
2163
|
* @param statusCode - The HTTP status code (0 for network errors)
|
|
@@ -1961,7 +2199,7 @@ declare abstract class HttpClient {
|
|
|
1961
2199
|
* @returns Promise resolving to an ApiResponse with typed data
|
|
1962
2200
|
* @protected
|
|
1963
2201
|
*/
|
|
1964
|
-
protected httpPost<T>(url: string, data?: any, headers?: Record<string, string
|
|
2202
|
+
protected httpPost<T>(url: string, data?: any, headers?: Record<string, string>, overrides?: RequestOverrides): Promise<ApiResponse<T>>;
|
|
1965
2203
|
/**
|
|
1966
2204
|
* Performs one HTTP POST attempt.
|
|
1967
2205
|
*
|
|
@@ -1996,6 +2234,25 @@ declare abstract class HttpClient {
|
|
|
1996
2234
|
* @protected
|
|
1997
2235
|
*/
|
|
1998
2236
|
protected httpPatch<T>(url: string, data?: any, headers?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
2237
|
+
/**
|
|
2238
|
+
* Opens a Server-Sent Events stream (WF-204 — 03 §3.10 `watch`; 09 §9.10 `watchEvents`).
|
|
2239
|
+
*
|
|
2240
|
+
* The ONLY deliberately timeout-free request in the client: an SSE tail lives as long as
|
|
2241
|
+
* the run (the server heartbeats every 15 s). Cancellation is the caller's `signal`.
|
|
2242
|
+
* Non-2xx responses go through the same 401/403 classification as `request` — a 401 is
|
|
2243
|
+
* an `AuthenticationError`, a 403 throws — and every other status resolves the returned
|
|
2244
|
+
* `ApiResponse` with `success:false` (no retry: the caller decides whether to reconnect,
|
|
2245
|
+
* passing `Last-Event-ID` for a resume).
|
|
2246
|
+
*
|
|
2247
|
+
* @param url - relative URL path (appended to baseUrl)
|
|
2248
|
+
* @param headers - headers (auth); `Last-Event-ID` when resuming
|
|
2249
|
+
* @param opts.signal - abort to close the stream
|
|
2250
|
+
* @returns `{ success:true, data: AsyncIterable<SseFrame> }` or the error envelope
|
|
2251
|
+
* @protected
|
|
2252
|
+
*/
|
|
2253
|
+
protected httpStream(url: string, headers?: Record<string, string>, opts?: {
|
|
2254
|
+
signal?: AbortSignal;
|
|
2255
|
+
}): Promise<ApiResponse<AsyncIterable<SseFrame>>>;
|
|
1999
2256
|
}
|
|
2000
2257
|
|
|
2001
2258
|
/**
|
|
@@ -2094,6 +2351,10 @@ declare interface InboxPushReceipt {
|
|
|
2094
2351
|
reason?: string;
|
|
2095
2352
|
}
|
|
2096
2353
|
|
|
2354
|
+
export declare const init: <T = unknown>(path: string) => TypedRef<T>;
|
|
2355
|
+
|
|
2356
|
+
export declare const inSet: <T extends string | number | boolean | null>(v: TypedRef<T>, set: T[]) => LuaPredicate;
|
|
2357
|
+
|
|
2097
2358
|
/** HTTP methods the passthrough relay accepts. */
|
|
2098
2359
|
declare const INTEGRATION_PASSTHROUGH_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"];
|
|
2099
2360
|
|
|
@@ -2656,12 +2917,31 @@ declare interface JobVersion {
|
|
|
2656
2917
|
metadata?: Record<string, any>;
|
|
2657
2918
|
}
|
|
2658
2919
|
|
|
2920
|
+
export { JsonSchema }
|
|
2921
|
+
|
|
2922
|
+
export { KnowledgeBindingSpec }
|
|
2923
|
+
|
|
2659
2924
|
export declare interface ListTemplatesOptions {
|
|
2660
2925
|
page?: number;
|
|
2661
2926
|
limit?: number;
|
|
2662
2927
|
search?: string;
|
|
2663
2928
|
}
|
|
2664
2929
|
|
|
2930
|
+
export declare const lit: <const V extends string | number | boolean | null>(v: V) => Literal<V>;
|
|
2931
|
+
|
|
2932
|
+
export { Literal }
|
|
2933
|
+
|
|
2934
|
+
export declare interface LoopOptions {
|
|
2935
|
+
/** default 100 */
|
|
2936
|
+
maxIterations?: number;
|
|
2937
|
+
/** engine timer between iterations, 1..86 400 (B24) */
|
|
2938
|
+
intervalSeconds?: number;
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
export declare const lt: (l: TypedRef<number> | number, r: TypedRef<number> | Literal<number> | number) => LuaPredicate;
|
|
2942
|
+
|
|
2943
|
+
export declare const lte: (l: TypedRef<number> | number, r: TypedRef<number> | Literal<number> | number) => LuaPredicate;
|
|
2944
|
+
|
|
2665
2945
|
/**
|
|
2666
2946
|
* Lua Runtime API
|
|
2667
2947
|
* Access request-level runtime information in your tools, conditions, and processors.
|
|
@@ -2723,6 +3003,7 @@ export declare class LuaAgent {
|
|
|
2723
3003
|
private readonly webhooks;
|
|
2724
3004
|
private readonly triggers;
|
|
2725
3005
|
private readonly jobs;
|
|
3006
|
+
private readonly workflows;
|
|
2726
3007
|
private readonly preProcessors;
|
|
2727
3008
|
private readonly postProcessors;
|
|
2728
3009
|
private readonly mcpServers;
|
|
@@ -2761,6 +3042,7 @@ export declare class LuaAgent {
|
|
|
2761
3042
|
getWebhooks(): LuaWebhook[];
|
|
2762
3043
|
getTriggers(): LuaTrigger[];
|
|
2763
3044
|
getJobs(): LuaJob[];
|
|
3045
|
+
getWorkflows(): LuaWorkflow[];
|
|
2764
3046
|
getPreProcessors(): PreProcessor[];
|
|
2765
3047
|
getPostProcessors(): PostProcessor[];
|
|
2766
3048
|
getMCPServers(): LuaMCPServer[];
|
|
@@ -2803,6 +3085,8 @@ export declare interface LuaAgentConfig {
|
|
|
2803
3085
|
triggers?: LuaTrigger[];
|
|
2804
3086
|
/** Array of scheduled jobs */
|
|
2805
3087
|
jobs?: LuaJob[];
|
|
3088
|
+
/** Array of workflows (createWorkflow / defineWorkflow) — 03 §3.1; resolved by the compiler traverser, dropped from the agent bundle */
|
|
3089
|
+
workflows?: LuaWorkflow[];
|
|
2806
3090
|
/** Array of preprocessors (run before messages reach the agent) */
|
|
2807
3091
|
preProcessors?: PreProcessor[];
|
|
2808
3092
|
/** Array of postprocessors (run after agent generates responses) */
|
|
@@ -3127,6 +3411,8 @@ export declare interface LuaJobConfig {
|
|
|
3127
3411
|
metadata?: Record<string, any>;
|
|
3128
3412
|
}
|
|
3129
3413
|
|
|
3414
|
+
export { LuaMapConfig }
|
|
3415
|
+
|
|
3130
3416
|
/**
|
|
3131
3417
|
* LuaMCPServer class.
|
|
3132
3418
|
* Defines an MCP (Model Context Protocol) server connection.
|
|
@@ -3184,6 +3470,8 @@ export declare class LuaMCPServer {
|
|
|
3184
3470
|
*/
|
|
3185
3471
|
export declare type LuaMCPServerConfig = MCPSSEServerConfig | MCPStreamableHttpServerConfig;
|
|
3186
3472
|
|
|
3473
|
+
export { LuaPredicate }
|
|
3474
|
+
|
|
3187
3475
|
/**
|
|
3188
3476
|
* The entity-independent, bounded Mongo-style filter accepted by Lua APIs.
|
|
3189
3477
|
* Root `$and`/`$or` branches and nested data fields share this recursive shape;
|
|
@@ -3414,7 +3702,7 @@ export declare class LuaTrigger<T = any> {
|
|
|
3414
3702
|
readonly inputSchema?: ZodType;
|
|
3415
3703
|
readonly verify?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
|
|
3416
3704
|
readonly filter?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
|
|
3417
|
-
readonly transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | Promise<string | AgentInvocationInput>;
|
|
3705
|
+
readonly transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | TriggerStartWorkflow | Promise<string | AgentInvocationInput | TriggerStartWorkflow>;
|
|
3418
3706
|
readonly tool?: {
|
|
3419
3707
|
name: string;
|
|
3420
3708
|
input?: (ctx: TriggerContext<T>) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
@@ -3457,7 +3745,7 @@ export declare interface LuaTriggerConfig<T = any> {
|
|
|
3457
3745
|
* whose payload is capped at ~50k chars (like a no-code trigger); return a
|
|
3458
3746
|
* transform to forward larger or hand-picked fields as the message.
|
|
3459
3747
|
*/
|
|
3460
|
-
transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | Promise<string | AgentInvocationInput>;
|
|
3748
|
+
transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | TriggerStartWorkflow | Promise<string | AgentInvocationInput | TriggerStartWorkflow>;
|
|
3461
3749
|
/**
|
|
3462
3750
|
* Direct tool binding: after `verify`/`filter` pass, the platform executes
|
|
3463
3751
|
* this named skill tool DIRECTLY — no chat turn, no LLM, no visible
|
|
@@ -3984,7 +4272,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3984
4272
|
prefixPaddingDuration?: number;
|
|
3985
4273
|
activationThreshold?: number;
|
|
3986
4274
|
};
|
|
3987
|
-
turnDetection?: "
|
|
4275
|
+
turnDetection?: "manual" | "multilingual" | "english" | "vad" | "stt";
|
|
3988
4276
|
greeting?: string;
|
|
3989
4277
|
maxToolSteps?: number;
|
|
3990
4278
|
userAwayTimeout?: number;
|
|
@@ -4078,7 +4366,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
4078
4366
|
prefixPaddingDuration?: number;
|
|
4079
4367
|
activationThreshold?: number;
|
|
4080
4368
|
};
|
|
4081
|
-
turnDetection?: "
|
|
4369
|
+
turnDetection?: "manual" | "multilingual" | "english" | "vad" | "stt";
|
|
4082
4370
|
greeting?: string;
|
|
4083
4371
|
maxToolSteps?: number;
|
|
4084
4372
|
userAwayTimeout?: number;
|
|
@@ -4172,7 +4460,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
4172
4460
|
prefixPaddingDuration?: number;
|
|
4173
4461
|
activationThreshold?: number;
|
|
4174
4462
|
};
|
|
4175
|
-
turnDetection?: "
|
|
4463
|
+
turnDetection?: "manual" | "multilingual" | "english" | "vad" | "stt";
|
|
4176
4464
|
greeting?: string;
|
|
4177
4465
|
maxToolSteps?: number;
|
|
4178
4466
|
userAwayTimeout?: number;
|
|
@@ -4266,7 +4554,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
4266
4554
|
prefixPaddingDuration?: number;
|
|
4267
4555
|
activationThreshold?: number;
|
|
4268
4556
|
};
|
|
4269
|
-
turnDetection?: "
|
|
4557
|
+
turnDetection?: "manual" | "multilingual" | "english" | "vad" | "stt";
|
|
4270
4558
|
greeting?: string;
|
|
4271
4559
|
maxToolSteps?: number;
|
|
4272
4560
|
userAwayTimeout?: number;
|
|
@@ -4621,6 +4909,158 @@ declare interface LuaWebhookEvent {
|
|
|
4621
4909
|
timestamp: string;
|
|
4622
4910
|
}
|
|
4623
4911
|
|
|
4912
|
+
export declare class LuaWorkflow {
|
|
4913
|
+
private readonly built;
|
|
4914
|
+
constructor(built: BuiltWorkflow);
|
|
4915
|
+
getName(): string;
|
|
4916
|
+
getConfig(): LuaWorkflowConfig;
|
|
4917
|
+
getSteps(): Record<string, LuaWorkflowStep<any, any, any>>;
|
|
4918
|
+
/** Builder warnings (`map-id-required`, `hitl-duration-defaulted`, `schedule-input-*`) — the compiler prints them. */
|
|
4919
|
+
getBuildWarnings(): LuaWorkflowBuildWarning[];
|
|
4920
|
+
/** Every `env.template(KEY)` placeholder key the graph carries (sorted, deduped) — `ManifestWorkflow.envTemplateKeys`. */
|
|
4921
|
+
getEnvTemplateKeys(): string[];
|
|
4922
|
+
/** `.workflow(id, ref)` targets by name — `ManifestWorkflow.workflowRefs`; `workspace:'inherit'` marks the inherit children the compiler defers `workspace-not-declared` for. */
|
|
4923
|
+
getNestedWorkflowRefs(): Array<{
|
|
4924
|
+
id: string;
|
|
4925
|
+
name: string;
|
|
4926
|
+
workspace?: 'inherit';
|
|
4927
|
+
}>;
|
|
4928
|
+
/** Pure: no I/O, no env, no time. Called by the compiler in the VM tier and by `lua test`. */
|
|
4929
|
+
__serializeGraph(): SerializedWorkflowGraph;
|
|
4930
|
+
}
|
|
4931
|
+
|
|
4932
|
+
export declare type LuaWorkflowBuildCode = 'duplicate-step-id' | 'unknown-step-ref' | 'map-id-required' | 'closure-predicate' | 'closure-binding' | 'timeout-out-of-range' | 'timeout-exceeds-tier' | 'job-timeout-exceeds-cap' | 'long-job-requires-workspace' | 'workspace-requires-job-tier'
|
|
4933
|
+
/**
|
|
4934
|
+
* @deprecated LUA-635 — the builder no longer throws it: a mount with no envelope `workspace` is the SHARED validator's
|
|
4935
|
+
* verdict (deferred for an inherit child, 03 §3.1 table). Kept for one minor so a consumer switching on the union still
|
|
4936
|
+
* compiles; removed in the next.
|
|
4937
|
+
*/
|
|
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';
|
|
4939
|
+
|
|
4940
|
+
export declare interface LuaWorkflowBuilder {
|
|
4941
|
+
then(step: StepRef): this;
|
|
4942
|
+
/** 2..16 arms; output = { [stepId]: output } */
|
|
4943
|
+
parallel(steps: ContainerArm[], opts?: {
|
|
4944
|
+
merge?: WorkflowMergePolicy;
|
|
4945
|
+
}): this;
|
|
4946
|
+
/** all-true arms run (Mastra); exclusive:true ≡ switch() */
|
|
4947
|
+
branch(arms: Array<[LuaPredicate, StepRef]>, opts?: {
|
|
4948
|
+
exclusive?: boolean;
|
|
4949
|
+
}): this;
|
|
4950
|
+
/** first true arm only ⇒ conditional{ exclusive:true, otherwise } */
|
|
4951
|
+
switch(arms: Array<[LuaPredicate, StepRef]>, otherwise?: StepRef): this;
|
|
4952
|
+
foreach(step: ContainerArm, opts?: ForeachOptions): this;
|
|
4953
|
+
dowhile(step: ContainerArm, predicate: LuaPredicate, opts?: LoopOptions): this;
|
|
4954
|
+
dountil(step: ContainerArm, predicate: LuaPredicate, opts?: LoopOptions): this;
|
|
4955
|
+
/** top-level only. `id` is REQUIRED once the workflow has ≥ 2 maps (`map-id-required`). */
|
|
4956
|
+
map(mapping: LuaMapConfig, opts?: {
|
|
4957
|
+
id?: string;
|
|
4958
|
+
}): this;
|
|
4959
|
+
/** literal only; engine-side wait, no lease */
|
|
4960
|
+
sleep(ms: number, opts?: {
|
|
4961
|
+
id?: string;
|
|
4962
|
+
businessHours?: WorkflowBusinessHours;
|
|
4963
|
+
}): this;
|
|
4964
|
+
/** a TemplateBinding lowers to `<id>_at` mapping + `sleepUntil{dateFrom}` (D6-r1) */
|
|
4965
|
+
sleepUntil(iso: string | TemplateBinding, opts?: {
|
|
4966
|
+
id?: string;
|
|
4967
|
+
businessHours?: WorkflowBusinessHours;
|
|
4968
|
+
round?: 'next-open' | 'next-close';
|
|
4969
|
+
}): this;
|
|
4970
|
+
agentStep(id: string, opts: AgentStepOptions): this;
|
|
4971
|
+
/** D25 ephemeral specialist: runs AS THE OWNING AGENT (`agentId:'$self'`) with an additive role block. */
|
|
4972
|
+
specialistStep(id: string, opts: SpecialistStepOptions): this;
|
|
4973
|
+
toolStep(id: string, tool: LuaTool<any>, opts?: ToolStepOptions): this;
|
|
4974
|
+
approval(id: string, opts: ApprovalOptions): this;
|
|
4975
|
+
waitForSignal(id: string, opts: WaitForSignalOptions): this;
|
|
4976
|
+
/** 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;
|
|
4980
|
+
commit(): LuaWorkflow;
|
|
4981
|
+
}
|
|
4982
|
+
|
|
4983
|
+
export declare class LuaWorkflowBuildError extends Error {
|
|
4984
|
+
readonly code: LuaWorkflowBuildCode;
|
|
4985
|
+
readonly hint?: string | undefined;
|
|
4986
|
+
constructor(code: LuaWorkflowBuildCode, message: string, hint?: string | undefined);
|
|
4987
|
+
}
|
|
4988
|
+
|
|
4989
|
+
export declare interface LuaWorkflowBuildWarning {
|
|
4990
|
+
code: LuaWorkflowBuildCode;
|
|
4991
|
+
message: string;
|
|
4992
|
+
stepId?: string;
|
|
4993
|
+
}
|
|
4994
|
+
|
|
4995
|
+
export declare interface LuaWorkflowConfig {
|
|
4996
|
+
/** /^[a-z][a-z0-9-_]*$/ — server identifier */
|
|
4997
|
+
name: string;
|
|
4998
|
+
description?: string;
|
|
4999
|
+
inputSchema: ZodType;
|
|
5000
|
+
outputSchema?: ZodType;
|
|
5001
|
+
/** types `ctx.state`; ≤ 64KB at runtime */
|
|
5002
|
+
stateSchema?: ZodType;
|
|
5003
|
+
/** 'forbid' = jobs-style overlap guard per workflow (D21-r1) — every start path gets 409 `RUNS_IN_FLIGHT`. */
|
|
5004
|
+
concurrencyPolicy?: 'allow' | 'forbid';
|
|
5005
|
+
/** Who may READ this workflow's run outputs beyond `workflows:read-outputs` holders (B44). Envelope member outside `graphHash`. */
|
|
5006
|
+
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
|
+
};
|
|
5013
|
+
/** verbatim LuaJob union (D12) → Job{kind:'workflow'} on publish */
|
|
5014
|
+
schedule?: JobSchedule;
|
|
5015
|
+
backfillOnEnable?: {
|
|
5016
|
+
maxOccurrences?: number;
|
|
5017
|
+
};
|
|
5018
|
+
/** Literal JSON passed as run input on every scheduled fire; must validate against `inputSchema` (P0-5e). */
|
|
5019
|
+
scheduleInput?: Record<string, unknown>;
|
|
5020
|
+
goal?: WorkflowGoalEnvelope;
|
|
5021
|
+
/** NEVER set by hand — the compiler derives it from the source file. */
|
|
5022
|
+
form?: 'graph' | 'script';
|
|
5023
|
+
workspace?: WorkspaceSpec;
|
|
5024
|
+
/**
|
|
5025
|
+
* Declared connection keys. `workspace.credentialsRef` and a step's `requiredConnections` may name a
|
|
5026
|
+
* `key` instead of a connection id; the engine resolves it against the owner agent's own connections
|
|
5027
|
+
* at run time (agent-scoped first, then org-scoped — never a user's), so the same definition runs on
|
|
5028
|
+
* a template install, a hand-built agent and a duplicate without a frozen id.
|
|
5029
|
+
*/
|
|
5030
|
+
connections?: WorkflowConnectionDeclaration[];
|
|
5031
|
+
}
|
|
5032
|
+
|
|
5033
|
+
export declare interface LuaWorkflowStep<TIn extends ZodType = ZodType, TOut extends ZodType = ZodType, TResume extends ZodType = ZodType> {
|
|
5034
|
+
/** /^[a-z][a-zA-Z0-9_-]{0,63}$/ — unique per workflow; `[`, `#`, `.`, `:` reserved. */
|
|
5035
|
+
id: string;
|
|
5036
|
+
description?: string;
|
|
5037
|
+
inputSchema: TIn;
|
|
5038
|
+
outputSchema: TOut;
|
|
5039
|
+
suspendSchema?: ZodType;
|
|
5040
|
+
resumeSchema?: TResume;
|
|
5041
|
+
execute: (ctx: WorkflowStepContext<z.infer<TIn>, z.infer<TResume>>) => Promise<z.infer<TOut>>;
|
|
5042
|
+
/** 1..600 (D19); default 300 — on `tier:'job'` 1..86 400, default 3600. */
|
|
5043
|
+
timeoutSeconds?: number;
|
|
5044
|
+
/** Run this step as a k8s Job (hours tier). Implied by `workspace`. */
|
|
5045
|
+
tier?: 'job';
|
|
5046
|
+
workspace?: WorkflowStepWorkspace;
|
|
5047
|
+
jobResources?: 'small' | 'medium' | 'large';
|
|
5048
|
+
jobTools?: WorkflowJobToolId[];
|
|
5049
|
+
/** default { maxAttempts: 1 } */
|
|
5050
|
+
retry?: RetryPolicy;
|
|
5051
|
+
/** default 'none'; 'external' ⇒ park on platform-fault reclaim. */
|
|
5052
|
+
sideEffects?: 'none' | 'external';
|
|
5053
|
+
/** What the FINAL failure of this step does to the run (default 'fail'). */
|
|
5054
|
+
onError?: 'fail' | 'continue' | 'park';
|
|
5055
|
+
requiredConnections?: string[];
|
|
5056
|
+
/** Deadline for a `ctx.suspend()` suspension; default 168, max 720. */
|
|
5057
|
+
resumeTimeoutHours?: number;
|
|
5058
|
+
businessHours?: WorkflowBusinessHours;
|
|
5059
|
+
onSuspendTimeout?: 'fail' | 'cancel-run';
|
|
5060
|
+
}
|
|
5061
|
+
|
|
5062
|
+
export { MapDescriptor }
|
|
5063
|
+
|
|
4624
5064
|
/**
|
|
4625
5065
|
* Base configuration for all MCP servers.
|
|
4626
5066
|
*/
|
|
@@ -4732,6 +5172,16 @@ export declare type MCPTransport = 'sse' | 'streamable-http';
|
|
|
4732
5172
|
|
|
4733
5173
|
declare type Message = TextMessage_2 | ImageMessage_2 | FileMessage_2;
|
|
4734
5174
|
|
|
5175
|
+
export declare const ne: <T>(l: TypedRef<T>, r: TypedRef<T> | Literal<T>) => LuaPredicate;
|
|
5176
|
+
|
|
5177
|
+
export declare const not: (arg: LuaPredicate) => LuaPredicate;
|
|
5178
|
+
|
|
5179
|
+
export declare const notExists: (ref: TypedRef<unknown>) => LuaPredicate;
|
|
5180
|
+
|
|
5181
|
+
export declare const notIn: <T extends string | number | boolean | null>(v: TypedRef<T>, set: T[]) => LuaPredicate;
|
|
5182
|
+
|
|
5183
|
+
export declare const or: (...args: LuaPredicate[]) => LuaPredicate;
|
|
5184
|
+
|
|
4735
5185
|
/**
|
|
4736
5186
|
* Order API contract.
|
|
4737
5187
|
* Defines operations for managing orders.
|
|
@@ -4984,6 +5434,11 @@ declare interface Pagination {
|
|
|
4984
5434
|
prevPage: number | null;
|
|
4985
5435
|
}
|
|
4986
5436
|
|
|
5437
|
+
export { PathOrLiteral }
|
|
5438
|
+
|
|
5439
|
+
/** P split on '.' walked into T; `unknown` past depth 4 or through an index. */
|
|
5440
|
+
export declare type PathValue<T, P extends string> = P extends `${infer H}.${infer R}` ? H extends keyof T ? PathValue<NonNullable<T[H]>, R> : unknown : P extends keyof T ? T[P] : unknown;
|
|
5441
|
+
|
|
4987
5442
|
/**
|
|
4988
5443
|
* Polymorphic shape used by `LuaAgent.persona`. String form is the legacy
|
|
4989
5444
|
* single-channel persona; object form lets the customer split prose per
|
|
@@ -5593,6 +6048,8 @@ declare const REASONING_EFFORT_VALUES: readonly ["off", "minimal", "low", "mediu
|
|
|
5593
6048
|
|
|
5594
6049
|
declare type ReasoningEffort = (typeof REASONING_EFFORT_VALUES)[number];
|
|
5595
6050
|
|
|
6051
|
+
export declare type ReplyChannel = 'whatsapp' | 'sms' | 'email' | 'webchat' | 'slack';
|
|
6052
|
+
|
|
5596
6053
|
declare interface RequestCredential {
|
|
5597
6054
|
readonly descriptor: RequestCredentialDescriptor;
|
|
5598
6055
|
bearer(): Promise<string>;
|
|
@@ -5609,6 +6066,47 @@ declare type RequestCredentialDescriptor = {
|
|
|
5609
6066
|
|
|
5610
6067
|
declare type RequestCredentialInput = string | RequestCredential;
|
|
5611
6068
|
|
|
6069
|
+
/**
|
|
6070
|
+
* Optional per-request overrides (WF-202, 03 §3.7 client-deadline rule). Today only
|
|
6071
|
+
* `timeoutMs`: `WorkflowApi.startRun` long-polls with `waitSeconds ≤ 55` and raises
|
|
6072
|
+
* its deadline to `(waitSeconds + 10) s` so the 30 s default abort never races the
|
|
6073
|
+
* server. Every other call site is untouched (undefined ⇒ the 30 s default).
|
|
6074
|
+
*/
|
|
6075
|
+
declare interface RequestOverrides {
|
|
6076
|
+
timeoutMs?: number;
|
|
6077
|
+
}
|
|
6078
|
+
|
|
6079
|
+
declare type ResumeStepResult = {
|
|
6080
|
+
resumed: true;
|
|
6081
|
+
runStatus: WorkflowRunStatus;
|
|
6082
|
+
} | {
|
|
6083
|
+
resumed: false;
|
|
6084
|
+
reason: 'already_resumed';
|
|
6085
|
+
recorded: {
|
|
6086
|
+
at: number;
|
|
6087
|
+
by?: {
|
|
6088
|
+
kind: string;
|
|
6089
|
+
id?: string;
|
|
6090
|
+
};
|
|
6091
|
+
};
|
|
6092
|
+
runStatus: WorkflowRunStatus;
|
|
6093
|
+
};
|
|
6094
|
+
|
|
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
|
+
}
|
|
6104
|
+
|
|
6105
|
+
export declare const rows: (s: LuaWorkflowStep<any, any, any> | string, path: string, page: {
|
|
6106
|
+
offset: number;
|
|
6107
|
+
limit: number;
|
|
6108
|
+
}) => MapDescriptor;
|
|
6109
|
+
|
|
5612
6110
|
/**
|
|
5613
6111
|
* Additive field on primitive publish responses. When the agent is under
|
|
5614
6112
|
* versioning the server performs a scoped promote and returns the newly
|
|
@@ -5660,6 +6158,18 @@ export declare interface SendTemplateValues {
|
|
|
5660
6158
|
buttons?: SendTemplateButtonValue[];
|
|
5661
6159
|
}
|
|
5662
6160
|
|
|
6161
|
+
export { SerializedWorkflowGraph }
|
|
6162
|
+
|
|
6163
|
+
/** R14 — 202 `{ accepted:true, signalId, consumed, stepId? }` · 200 `{ accepted:true, duplicate:true }` · 202 `{ accepted:false, reason }`. */
|
|
6164
|
+
declare interface SignalRunResult {
|
|
6165
|
+
accepted: boolean;
|
|
6166
|
+
signalId?: string;
|
|
6167
|
+
consumed?: boolean;
|
|
6168
|
+
stepId?: string;
|
|
6169
|
+
duplicate?: boolean;
|
|
6170
|
+
reason?: string;
|
|
6171
|
+
}
|
|
6172
|
+
|
|
5663
6173
|
/**
|
|
5664
6174
|
* Same shape as `PersonaText`, exported separately because skill `context`
|
|
5665
6175
|
* and agent `persona` play different semantic roles. Sharing the structural
|
|
@@ -5671,6 +6181,77 @@ declare type SkillContextText = string | {
|
|
|
5671
6181
|
text?: string;
|
|
5672
6182
|
};
|
|
5673
6183
|
|
|
6184
|
+
export declare interface SpecialistStepOptions {
|
|
6185
|
+
role: WorkflowSpecialistRole | {
|
|
6186
|
+
ref: string;
|
|
6187
|
+
};
|
|
6188
|
+
prompt: TemplateLike;
|
|
6189
|
+
outputSchema?: ZodType;
|
|
6190
|
+
model?: string;
|
|
6191
|
+
toolScope?: AgentToolScope;
|
|
6192
|
+
timeoutSeconds?: number;
|
|
6193
|
+
retry?: RetryPolicy;
|
|
6194
|
+
onError?: 'fail' | 'continue' | 'park';
|
|
6195
|
+
requiredConnections?: string[];
|
|
6196
|
+
}
|
|
6197
|
+
|
|
6198
|
+
/** One parsed SSE frame (`id:` / `event:` / `data:` — `data` JSON-parsed when it parses, else the raw string). */
|
|
6199
|
+
declare interface SseFrame {
|
|
6200
|
+
id?: string;
|
|
6201
|
+
event: string;
|
|
6202
|
+
data: unknown;
|
|
6203
|
+
}
|
|
6204
|
+
|
|
6205
|
+
/** R8 — 202 `{ runId, status:'queued'|'gated', watchHint, idempotentReplay? }`, or 200 the run detail when `waitSeconds` elapsed on a terminal/suspended run. */
|
|
6206
|
+
declare interface StartWorkflowRunResult {
|
|
6207
|
+
runId: string;
|
|
6208
|
+
status: WorkflowRunStatus;
|
|
6209
|
+
watchHint?: string;
|
|
6210
|
+
idempotentReplay?: boolean;
|
|
6211
|
+
output?: unknown;
|
|
6212
|
+
}
|
|
6213
|
+
|
|
6214
|
+
export declare const state: <T = unknown>(path: string) => TypedRef<T>;
|
|
6215
|
+
|
|
6216
|
+
/** `step(x).path('confidence')` is `TypedRef<number>` when `x.outputSchema` says so; a string id yields `TypedRef<unknown>`. */
|
|
6217
|
+
export declare function step<TOut extends ZodType>(s: LuaWorkflowStep<any, TOut, any>): StepPathRef<z.infer<TOut>>;
|
|
6218
|
+
|
|
6219
|
+
export declare function step(id: string): {
|
|
6220
|
+
path(p: string): TypedRef<unknown>;
|
|
6221
|
+
};
|
|
6222
|
+
|
|
6223
|
+
/** Typed string ref for `agentStep`/`toolStep` ids: `stepOf<typeof angle>('techAngle').path('confidence')`. */
|
|
6224
|
+
export declare function stepOf<TOut extends ZodType>(id: string): StepPathRef<z.infer<TOut>>;
|
|
6225
|
+
|
|
6226
|
+
export declare interface StepPathRef<TOut> {
|
|
6227
|
+
path<P extends DotPath<TOut>>(p: P): TypedRef<PathValue<TOut, P>>;
|
|
6228
|
+
}
|
|
6229
|
+
|
|
6230
|
+
/** 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). */
|
|
6231
|
+
export declare type StepRef = LuaWorkflowStep<any, any, any> | string;
|
|
6232
|
+
|
|
6233
|
+
/**
|
|
6234
|
+
* Why an unattended run could not finish, reported by the agent itself instead
|
|
6235
|
+
* of being guessed from its prose. The platform — not the agent — writes every
|
|
6236
|
+
* user-facing string from this; `whatWouldUnblock` and `detail` are agent text
|
|
6237
|
+
* and never reach a headline, preview, push body or email subject.
|
|
6238
|
+
*/
|
|
6239
|
+
declare const TASK_RUN_BLOCKER_KINDS: readonly ["missing_connection", "resource_not_found", "needs_input", "permission_denied", "other"];
|
|
6240
|
+
|
|
6241
|
+
declare interface TaskRunBlocker {
|
|
6242
|
+
kind: TaskRunBlockerKind;
|
|
6243
|
+
/** Catalog slug when known ('googlemail', 'asana'). Never a guess. */
|
|
6244
|
+
integrationType?: string;
|
|
6245
|
+
/** What it was reaching for, in the user's words ('the agent-all-west repo'). */
|
|
6246
|
+
resourceLabel?: string;
|
|
6247
|
+
/** One sentence, the agent's own: what would make this run work next time. */
|
|
6248
|
+
whatWouldUnblock: string;
|
|
6249
|
+
/** Longer technical account. Expandable detail only — never a headline. */
|
|
6250
|
+
detail?: string;
|
|
6251
|
+
}
|
|
6252
|
+
|
|
6253
|
+
declare type TaskRunBlockerKind = (typeof TASK_RUN_BLOCKER_KINDS)[number];
|
|
6254
|
+
|
|
5674
6255
|
export declare const Team: TeamApi;
|
|
5675
6256
|
|
|
5676
6257
|
/**
|
|
@@ -5698,6 +6279,14 @@ export declare interface TeamApi {
|
|
|
5698
6279
|
findMember(name: string): Promise<DirectoryResolveResult>;
|
|
5699
6280
|
}
|
|
5700
6281
|
|
|
6282
|
+
/** placeholders: ${initData.*} ${stepResults.<id>.*} ${state.*} */
|
|
6283
|
+
export declare const template: (s: string) => TemplateBinding;
|
|
6284
|
+
|
|
6285
|
+
export { TemplateBinding }
|
|
6286
|
+
|
|
6287
|
+
/** A prompt / literal slot: a string, a `template(...)` binding, or an `env.template(KEY)` placeholder (B33). */
|
|
6288
|
+
export declare type TemplateLike = string | TemplateBinding | EnvRefBinding;
|
|
6289
|
+
|
|
5701
6290
|
/**
|
|
5702
6291
|
* Templates API
|
|
5703
6292
|
*
|
|
@@ -5853,15 +6442,15 @@ export declare enum ToolFlag {
|
|
|
5853
6442
|
DISALLOW_INTERRUPTION = "disallow_interruption"
|
|
5854
6443
|
}
|
|
5855
6444
|
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
6445
|
+
export declare interface ToolStepOptions {
|
|
6446
|
+
input?: LuaMapConfig;
|
|
6447
|
+
timeoutSeconds?: number;
|
|
6448
|
+
retry?: RetryPolicy;
|
|
6449
|
+
sideEffects?: 'none' | 'external';
|
|
6450
|
+
onError?: 'fail' | 'continue' | 'park';
|
|
6451
|
+
requiredConnections?: string[];
|
|
6452
|
+
}
|
|
6453
|
+
|
|
5865
6454
|
export declare interface TriggerContext<T = any> {
|
|
5866
6455
|
/** Parsed request body (typed by `inputSchema` when provided). */
|
|
5867
6456
|
body: T;
|
|
@@ -5877,6 +6466,39 @@ export declare interface TriggerContext<T = any> {
|
|
|
5877
6466
|
source: string;
|
|
5878
6467
|
}
|
|
5879
6468
|
|
|
6469
|
+
/**
|
|
6470
|
+
* Context delivered to a trigger's verify / filter / transform slots.
|
|
6471
|
+
*
|
|
6472
|
+
* Unlike a webhook event, `rawBody` carries the EXACT unparsed request bytes
|
|
6473
|
+
* (utf8) — HMAC signature schemes (Stripe `t=…,v1=…`, GitHub `sha256=…`, Slack
|
|
6474
|
+
* `v0:…`) are computed over the wire bytes, which `JSON.stringify(body)` does
|
|
6475
|
+
* not reproduce. `headers` keys arrive lowercased (Express), e.g.
|
|
6476
|
+
* `ctx.headers['x-hub-signature-256']`.
|
|
6477
|
+
*/
|
|
6478
|
+
/**
|
|
6479
|
+
* `transform` may start a workflow run instead of a chat turn (03 §3.7 / 07 — WF-205):
|
|
6480
|
+
* `{ startWorkflow: { name, input?, idempotencyKey?, correlationKey?, tags? } }`.
|
|
6481
|
+
* `name` is the agent-local workflow name; `correlationKey` accepts a literal or a
|
|
6482
|
+
* `'${input.<field>}'` template the trigger fills.
|
|
6483
|
+
*/
|
|
6484
|
+
declare interface TriggerStartWorkflow {
|
|
6485
|
+
startWorkflow: {
|
|
6486
|
+
name: string;
|
|
6487
|
+
input?: unknown;
|
|
6488
|
+
idempotencyKey?: string;
|
|
6489
|
+
correlationKey?: string;
|
|
6490
|
+
tags?: string[];
|
|
6491
|
+
replyTo?: {
|
|
6492
|
+
channel: string;
|
|
6493
|
+
threadId: string;
|
|
6494
|
+
};
|
|
6495
|
+
};
|
|
6496
|
+
}
|
|
6497
|
+
|
|
6498
|
+
export declare const truthy: (ref: TypedRef<unknown>) => LuaPredicate;
|
|
6499
|
+
|
|
6500
|
+
export { TypedRef }
|
|
6501
|
+
|
|
5880
6502
|
/**
|
|
5881
6503
|
* Response from updating custom data entry.
|
|
5882
6504
|
*/
|
|
@@ -6096,6 +6718,8 @@ export declare interface UserLookupOptions {
|
|
|
6096
6718
|
phone?: string;
|
|
6097
6719
|
}
|
|
6098
6720
|
|
|
6721
|
+
export declare const value: (v: unknown) => MapDescriptor;
|
|
6722
|
+
|
|
6099
6723
|
export declare const Voice: VoiceApi;
|
|
6100
6724
|
|
|
6101
6725
|
/**
|
|
@@ -6274,6 +6898,17 @@ declare interface VoiceSessionOutput {
|
|
|
6274
6898
|
agentName: string;
|
|
6275
6899
|
}
|
|
6276
6900
|
|
|
6901
|
+
export declare interface WaitForSignalOptions {
|
|
6902
|
+
signal: string;
|
|
6903
|
+
schema?: ZodType;
|
|
6904
|
+
timeoutHours?: number | TemplateBinding;
|
|
6905
|
+
/** default 'fail'; 'continue' ⇒ output {received:false,timedOut:true} */
|
|
6906
|
+
onTimeout?: 'fail' | 'continue';
|
|
6907
|
+
businessHours?: WorkflowBusinessHours;
|
|
6908
|
+
/** default ['webhook','api','user'] */
|
|
6909
|
+
acceptedSources?: Array<'webhook' | 'api' | 'user' | 'agent'>;
|
|
6910
|
+
}
|
|
6911
|
+
|
|
6277
6912
|
/**
|
|
6278
6913
|
* Webhook request information from channel integrations.
|
|
6279
6914
|
* Contains the raw webhook payload from the channel provider.
|
|
@@ -6397,4 +7032,424 @@ declare interface WhatsAppTemplateUrlButton {
|
|
|
6397
7032
|
example?: string | string[];
|
|
6398
7033
|
}
|
|
6399
7034
|
|
|
7035
|
+
export declare type WorkflowApproverSpec = 'creator' | 'org-admins' | {
|
|
7036
|
+
users: string[] | TemplateBinding;
|
|
7037
|
+
} | {
|
|
7038
|
+
role: string | TemplateBinding | MapDescriptor;
|
|
7039
|
+
} | {
|
|
7040
|
+
group: string | TemplateBinding;
|
|
7041
|
+
} | {
|
|
7042
|
+
governance: {
|
|
7043
|
+
policyId: string;
|
|
7044
|
+
};
|
|
7045
|
+
};
|
|
7046
|
+
|
|
7047
|
+
export declare interface WorkflowArtefactMeta {
|
|
7048
|
+
artefactId: string;
|
|
7049
|
+
name: string;
|
|
7050
|
+
contentType: string;
|
|
7051
|
+
bytes: number;
|
|
7052
|
+
kind: 'file' | 'dataset' | 'image' | 'document';
|
|
7053
|
+
datasetSchema?: JsonSchema;
|
|
7054
|
+
rowCount?: number;
|
|
7055
|
+
producer: {
|
|
7056
|
+
stepId: string;
|
|
7057
|
+
attempt: number;
|
|
7058
|
+
source: 'turn' | 'ctx' | 'input';
|
|
7059
|
+
};
|
|
7060
|
+
previewCdnRef?: string;
|
|
7061
|
+
title?: string;
|
|
7062
|
+
source?: {
|
|
7063
|
+
kind: 'step' | 'input' | 'url' | 'connection' | 'upload';
|
|
7064
|
+
ref?: string;
|
|
7065
|
+
};
|
|
7066
|
+
}
|
|
7067
|
+
|
|
7068
|
+
export declare interface WorkflowBusinessHours {
|
|
7069
|
+
tz: string;
|
|
7070
|
+
calendar?: 'mon-fri' | {
|
|
7071
|
+
days: number[];
|
|
7072
|
+
start: string;
|
|
7073
|
+
end: string;
|
|
7074
|
+
holidays?: string[];
|
|
7075
|
+
};
|
|
7076
|
+
}
|
|
7077
|
+
|
|
7078
|
+
declare interface WorkflowConnectionDeclaration {
|
|
7079
|
+
/** /^[a-z][a-z0-9_-]{0,63}$/ — unique per workflow. */
|
|
7080
|
+
key: string;
|
|
7081
|
+
/** Catalog integration type (`'github'`, `'linear'`, …). */
|
|
7082
|
+
integrationType: string;
|
|
7083
|
+
required?: boolean;
|
|
7084
|
+
description?: string;
|
|
7085
|
+
}
|
|
7086
|
+
|
|
7087
|
+
export declare interface WorkflowFourEyes {
|
|
7088
|
+
edit: WorkflowApproverSpec;
|
|
7089
|
+
approve: WorkflowApproverSpec;
|
|
7090
|
+
}
|
|
7091
|
+
|
|
7092
|
+
export declare interface WorkflowGoalEnvelope {
|
|
7093
|
+
objective: string;
|
|
7094
|
+
judge: {
|
|
7095
|
+
agentId: string | '$self';
|
|
7096
|
+
role?: WorkflowSpecialistRole;
|
|
7097
|
+
schema: ZodType;
|
|
7098
|
+
};
|
|
7099
|
+
cadence: JobSchedule[];
|
|
7100
|
+
maxRuns: number;
|
|
7101
|
+
budget?: LuaWorkflowConfig['budget'];
|
|
7102
|
+
maxTotalCredits?: number;
|
|
7103
|
+
initialState?: Record<string, unknown>;
|
|
7104
|
+
}
|
|
7105
|
+
|
|
7106
|
+
export declare type WorkflowJobHarness = 'claude-code' | 'generic';
|
|
7107
|
+
|
|
7108
|
+
export declare type WorkflowJobToolId = 'shell' | 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'git' | 'gh' | 'fetch';
|
|
7109
|
+
|
|
7110
|
+
export declare interface WorkflowMergePolicy {
|
|
7111
|
+
strategy: 'rebase' | 'merge';
|
|
7112
|
+
onConflict: 'fail' | 'agent';
|
|
7113
|
+
}
|
|
7114
|
+
|
|
7115
|
+
export declare interface WorkflowOutputVisibility {
|
|
7116
|
+
roles: string[];
|
|
7117
|
+
users?: string[];
|
|
7118
|
+
ownerBypass?: boolean;
|
|
7119
|
+
}
|
|
7120
|
+
|
|
7121
|
+
/**
|
|
7122
|
+
* Matches WorkflowRunDto (R4 `fields:'summary'` — outputs are never inlined here).
|
|
7123
|
+
* The wire names the run `runId` (shared-types `WorkflowRunSummary`); `id` is the pre-R4 spelling some
|
|
7124
|
+
* envelopes still carry — read through `runIdOf()` (LUA-668: `status` printed "Run undefined").
|
|
7125
|
+
*/
|
|
7126
|
+
declare interface WorkflowRun {
|
|
7127
|
+
id?: string;
|
|
7128
|
+
runId?: string;
|
|
7129
|
+
workflowId: string;
|
|
7130
|
+
workflowVersionId: string;
|
|
7131
|
+
agentId: string;
|
|
7132
|
+
orgId: string;
|
|
7133
|
+
status: WorkflowRunStatus;
|
|
7134
|
+
trigger: 'chat' | 'sdk' | 'api' | 'schedule' | 'webhook' | 'template' | 'workflow' | 'device';
|
|
7135
|
+
graphHash: string;
|
|
7136
|
+
lineageId?: string;
|
|
7137
|
+
parentRunId?: string;
|
|
7138
|
+
correlationKey?: string;
|
|
7139
|
+
tags?: string[];
|
|
7140
|
+
gate?: {
|
|
7141
|
+
kind: string;
|
|
7142
|
+
reason?: string;
|
|
7143
|
+
since?: string;
|
|
7144
|
+
};
|
|
7145
|
+
failureReason?: string;
|
|
7146
|
+
restricted?: boolean;
|
|
7147
|
+
/** LUA-623: the keys the run's version declares, and what each resolved to on its agent (`connection.resolved` rows). */
|
|
7148
|
+
connections?: {
|
|
7149
|
+
declared: Array<{
|
|
7150
|
+
key: string;
|
|
7151
|
+
integrationType: string;
|
|
7152
|
+
required?: boolean;
|
|
7153
|
+
}>;
|
|
7154
|
+
resolved: Array<{
|
|
7155
|
+
key: string;
|
|
7156
|
+
connectionId: string;
|
|
7157
|
+
integrationType: string;
|
|
7158
|
+
scope: 'agent' | 'org';
|
|
7159
|
+
at: number;
|
|
7160
|
+
}>;
|
|
7161
|
+
};
|
|
7162
|
+
/** R4 `fields:'full'` only: the payload inline, else the `{__cdnRef}` it was offloaded under (LUA-643). */
|
|
7163
|
+
output?: unknown;
|
|
7164
|
+
/** LUA-643: ≤ 2 KB preview beside an offloaded `output`. */
|
|
7165
|
+
outputPreview?: string;
|
|
7166
|
+
/** LUA-643: every shape says whether a result exists; `--steps` (`fields:'full'`) serves it. */
|
|
7167
|
+
hasOutput?: boolean;
|
|
7168
|
+
createdAt: string;
|
|
7169
|
+
startedAt?: string;
|
|
7170
|
+
completedAt?: string;
|
|
7171
|
+
updatedAt: string;
|
|
7172
|
+
}
|
|
7173
|
+
|
|
7174
|
+
/** §02 §2.4 run statuses (one union across every section). */
|
|
7175
|
+
declare type WorkflowRunStatus = 'queued' | 'running' | 'cancellation_requested' | 'gated' | 'suspended' | 'waiting' | 'completed' | 'failed' | 'cancelled' | 'abandoned' | 'timed_out';
|
|
7176
|
+
|
|
7177
|
+
export declare type WorkflowRunTrigger = 'chat' | 'sdk' | 'api' | 'schedule' | 'webhook' | 'template' | 'workflow' | 'device';
|
|
7178
|
+
|
|
7179
|
+
/**
|
|
7180
|
+
* @example
|
|
7181
|
+
* ```typescript
|
|
7182
|
+
* const { runId, status } = await Workflows.start('outreach', { leads }, { idempotencyKey: `outreach:${batchId}` });
|
|
7183
|
+
* const run = await Workflows.get(runId);
|
|
7184
|
+
* await Workflows.signal(runId, 'review', { approved: true });
|
|
7185
|
+
* ```
|
|
7186
|
+
*/
|
|
7187
|
+
export declare const Workflows: WorkflowsApi;
|
|
7188
|
+
|
|
7189
|
+
/**
|
|
7190
|
+
* Workflows API — start, inspect and steer workflow runs from tools, jobs, webhooks,
|
|
7191
|
+
* triggers, other workflows' code steps and scripts.
|
|
7192
|
+
*
|
|
7193
|
+
* - `start` is ALWAYS fire-and-return: it never awaits execution. `waitSeconds` (≤ 55) is
|
|
7194
|
+
* a server long-poll that returns early terminal state when the run finishes inside the
|
|
7195
|
+
* window — it changes the response, never the execution model. From a code step,
|
|
7196
|
+
* `start` creates a DETACHED run; use the `workflow()` node to wait on a nested run.
|
|
7197
|
+
* - A `concurrencyPolicy:'forbid'` workflow with a run in flight throws
|
|
7198
|
+
* `WorkflowApiError{ code:'RUNS_IN_FLIGHT', blockingRunId }` — never a 429, never a gate.
|
|
7199
|
+
* - `status:'gated'` from `start` means the run holds no org slot (quota/billing/consent).
|
|
7200
|
+
* - `nameOrId` resolves the agent-local `workflow.name` first, then a workflow id.
|
|
7201
|
+
* - `get`/`list` honour output ACLs: a restricted run comes back with `restricted:true`
|
|
7202
|
+
* and no `output` — never an error.
|
|
7203
|
+
*
|
|
7204
|
+
* `startBatch`, `signalByKey`, `raiseBudget`, `setGoal` and `goals.*` are part of the
|
|
7205
|
+
* frozen member list and throw `WORKFLOWS_API_UNAVAILABLE` until their routes ship.
|
|
7206
|
+
*/
|
|
7207
|
+
export declare interface WorkflowsApi {
|
|
7208
|
+
start(nameOrId: string, input?: unknown, opts?: {
|
|
7209
|
+
idempotencyKey?: string;
|
|
7210
|
+
budget?: {
|
|
7211
|
+
maxCredits?: number;
|
|
7212
|
+
maxSteps?: number;
|
|
7213
|
+
maxDurationSeconds?: number;
|
|
7214
|
+
};
|
|
7215
|
+
waitSeconds?: number;
|
|
7216
|
+
initialState?: Record<string, unknown>;
|
|
7217
|
+
correlationKey?: string;
|
|
7218
|
+
tags?: string[];
|
|
7219
|
+
replyTo?: {
|
|
7220
|
+
channel: string;
|
|
7221
|
+
threadId: string;
|
|
7222
|
+
};
|
|
7223
|
+
onBehalfOf?: {
|
|
7224
|
+
userId: string;
|
|
7225
|
+
};
|
|
7226
|
+
workflowVersionId?: string;
|
|
7227
|
+
}): Promise<StartWorkflowRunResult>;
|
|
7228
|
+
get(runId: string): Promise<WorkflowRun>;
|
|
7229
|
+
list(opts?: {
|
|
7230
|
+
limit?: number;
|
|
7231
|
+
status?: WorkflowRunStatus | string;
|
|
7232
|
+
workflow?: string;
|
|
7233
|
+
correlationKey?: string;
|
|
7234
|
+
tags?: string[];
|
|
7235
|
+
sort?: string;
|
|
7236
|
+
}): Promise<WorkflowRun[]>;
|
|
7237
|
+
cancel(runId: string, opts?: {
|
|
7238
|
+
mode?: 'request' | 'force';
|
|
7239
|
+
reason?: string;
|
|
7240
|
+
}): Promise<CancelRunVerdict>;
|
|
7241
|
+
resume(runId: string, stepId: string, resumeData: unknown): Promise<ResumeStepResult>;
|
|
7242
|
+
signal(runId: string, name: string, payload?: unknown, opts?: {
|
|
7243
|
+
dedupeKey?: string;
|
|
7244
|
+
}): Promise<SignalRunResult>;
|
|
7245
|
+
signalByKey(nameOrId: string, correlationKey: string, name: string, payload?: unknown, opts?: {
|
|
7246
|
+
dedupeKey?: string;
|
|
7247
|
+
allowMultiple?: boolean;
|
|
7248
|
+
}): Promise<{
|
|
7249
|
+
runIds: string[];
|
|
7250
|
+
delivered: number;
|
|
7251
|
+
}>;
|
|
7252
|
+
startBatch(nameOrId: string, items: Array<{
|
|
7253
|
+
input: unknown;
|
|
7254
|
+
idempotencyKey: string;
|
|
7255
|
+
budget?: {
|
|
7256
|
+
maxCredits?: number;
|
|
7257
|
+
maxSteps?: number;
|
|
7258
|
+
maxDurationSeconds?: number;
|
|
7259
|
+
};
|
|
7260
|
+
tags?: string[];
|
|
7261
|
+
correlationKey?: string;
|
|
7262
|
+
initialState?: Record<string, unknown>;
|
|
7263
|
+
}>, opts?: {
|
|
7264
|
+
mode?: 'reject' | 'gate';
|
|
7265
|
+
budget?: {
|
|
7266
|
+
maxCredits?: number;
|
|
7267
|
+
maxSteps?: number;
|
|
7268
|
+
maxDurationSeconds?: number;
|
|
7269
|
+
};
|
|
7270
|
+
}): Promise<{
|
|
7271
|
+
batchId: string;
|
|
7272
|
+
accepted: number;
|
|
7273
|
+
items: Array<{
|
|
7274
|
+
idempotencyKey: string;
|
|
7275
|
+
runId?: string;
|
|
7276
|
+
status: 'queued' | 'gated' | 'replayed' | 'rejected';
|
|
7277
|
+
code?: string;
|
|
7278
|
+
}>;
|
|
7279
|
+
}>;
|
|
7280
|
+
raiseBudget(runId: string, patch: {
|
|
7281
|
+
maxCredits?: number;
|
|
7282
|
+
maxSteps?: number;
|
|
7283
|
+
maxJobSeconds?: number;
|
|
7284
|
+
maxDurationSeconds?: number;
|
|
7285
|
+
note?: string;
|
|
7286
|
+
}): Promise<{
|
|
7287
|
+
raised: true;
|
|
7288
|
+
budget: Record<string, number>;
|
|
7289
|
+
runStatus: WorkflowRunStatus;
|
|
7290
|
+
resumed: boolean;
|
|
7291
|
+
} | {
|
|
7292
|
+
raised: false;
|
|
7293
|
+
reason: 'already_raised';
|
|
7294
|
+
}>;
|
|
7295
|
+
setGoal(agentId: string, goal: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
7296
|
+
goals: {
|
|
7297
|
+
list(agentId: string, opts?: {
|
|
7298
|
+
status?: 'active' | 'paused' | 'done' | 'closed';
|
|
7299
|
+
workflowId?: string;
|
|
7300
|
+
}): Promise<Record<string, unknown>[]>;
|
|
7301
|
+
get(agentId: string, goalId: string): Promise<Record<string, unknown>>;
|
|
7302
|
+
pause(agentId: string, goalId: string): Promise<Record<string, unknown>>;
|
|
7303
|
+
resume(agentId: string, goalId: string): Promise<Record<string, unknown>>;
|
|
7304
|
+
close(agentId: string, goalId: string, opts?: {
|
|
7305
|
+
note?: string;
|
|
7306
|
+
}): Promise<Record<string, unknown>>;
|
|
7307
|
+
};
|
|
7308
|
+
}
|
|
7309
|
+
|
|
7310
|
+
export declare interface WorkflowSpecialistRole {
|
|
7311
|
+
name: string;
|
|
7312
|
+
instructions: string;
|
|
7313
|
+
tools: string[];
|
|
7314
|
+
}
|
|
7315
|
+
|
|
7316
|
+
export declare interface WorkflowStepContext<TIn = unknown, TResume = unknown, TState = Record<string, unknown>> {
|
|
7317
|
+
runId: string;
|
|
7318
|
+
workflowId: string;
|
|
7319
|
+
workflowVersionId: string;
|
|
7320
|
+
stepId: string;
|
|
7321
|
+
attempt: number;
|
|
7322
|
+
/** `${lineageId}:${stepId}` — stable across retries, resumes, `retry-step` AND repair runs. THE key for side-effect dedup. */
|
|
7323
|
+
occurrenceId: string;
|
|
7324
|
+
/** The run's recovery lineage: the first run's id in a repair chain; `=== runId` for a non-repair run. */
|
|
7325
|
+
lineageId: string;
|
|
7326
|
+
/** Resolved bindings snapshot (mapping descriptors applied by the advancer). Plain JSON. */
|
|
7327
|
+
inputData: TIn;
|
|
7328
|
+
/** Present only when re-invoked after resume. `execute` RE-RUNS FROM THE TOP (Mastra semantics). */
|
|
7329
|
+
resumeData?: TResume;
|
|
7330
|
+
/** What the prior invocation passed to `suspend()`. */
|
|
7331
|
+
suspendData?: unknown;
|
|
7332
|
+
getInitData<T = unknown>(): T;
|
|
7333
|
+
/** Output of an UPSTREAM step. Throws `WorkflowStepResultError{ code:'STEP_RESULT_NOT_ANCESTOR' }` for a non-ancestor. */
|
|
7334
|
+
getStepResult<T = unknown>(stepId: string): T;
|
|
7335
|
+
/** Run-scoped KV, ledger-backed, ≤ 64KB total. `set` is durable when the step terminalizes. */
|
|
7336
|
+
state: {
|
|
7337
|
+
get<K extends keyof TState>(k: K): TState[K] | undefined;
|
|
7338
|
+
set<K extends keyof TState>(k: K, v: TState[K]): Promise<void>;
|
|
7339
|
+
};
|
|
7340
|
+
/** Terminal for this invocation → step `suspended` kind:'input'. Never returns. */
|
|
7341
|
+
suspend(payload: unknown): Promise<never>;
|
|
7342
|
+
/** Early successful exit with `result` as the step output. Never returns. */
|
|
7343
|
+
bail<T>(result: T): never;
|
|
7344
|
+
/** Early successful exit for the WHOLE RUN (Cluster G, B8). Never returns. */
|
|
7345
|
+
bailRun<T>(output: T): never;
|
|
7346
|
+
/** → `step.progress` event (≤ 1000 per attempt; 1KB each). */
|
|
7347
|
+
log(message: string): void;
|
|
7348
|
+
/** Aborts on run cancel and on the sandbox wall. */
|
|
7349
|
+
signal: AbortSignal;
|
|
7350
|
+
/** Sub-agent env, exactly as jobs receive it. */
|
|
7351
|
+
env: Record<string, string>;
|
|
7352
|
+
/** EXACTLY-ONCE effect keyed on `{occurrenceId, key}` (P1-18). Claim → run `fn` → settle. */
|
|
7353
|
+
once<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
7354
|
+
/** Job-tier steps only: the mounted run workspace. */
|
|
7355
|
+
workspace?: {
|
|
7356
|
+
path: string;
|
|
7357
|
+
mount: 'rw' | 'ro';
|
|
7358
|
+
branch?: string;
|
|
7359
|
+
baseSha?: string;
|
|
7360
|
+
arm?: string;
|
|
7361
|
+
backend?: WorkflowWorkspaceBackend;
|
|
7362
|
+
};
|
|
7363
|
+
/** The run artefact store (P1-8). */
|
|
7364
|
+
artefacts: {
|
|
7365
|
+
put(name: string, data: Uint8Array | string | ReadableStream, opts: {
|
|
7366
|
+
contentType: string;
|
|
7367
|
+
kind?: 'file' | 'dataset' | 'image' | 'document';
|
|
7368
|
+
datasetSchema?: JsonSchema;
|
|
7369
|
+
title?: string;
|
|
7370
|
+
source?: {
|
|
7371
|
+
kind: 'step' | 'input' | 'url' | 'connection' | 'upload';
|
|
7372
|
+
ref?: string;
|
|
7373
|
+
};
|
|
7374
|
+
}): Promise<{
|
|
7375
|
+
artefactId: string;
|
|
7376
|
+
}>;
|
|
7377
|
+
get(artefactId: string): Promise<{
|
|
7378
|
+
url: string;
|
|
7379
|
+
meta: WorkflowArtefactMeta;
|
|
7380
|
+
stream(opts?: {
|
|
7381
|
+
range?: {
|
|
7382
|
+
start: number;
|
|
7383
|
+
end?: number;
|
|
7384
|
+
};
|
|
7385
|
+
}): Promise<ReadableStream>;
|
|
7386
|
+
rows(page: {
|
|
7387
|
+
offset: number;
|
|
7388
|
+
limit: number;
|
|
7389
|
+
}): Promise<{
|
|
7390
|
+
rows: unknown[];
|
|
7391
|
+
rowCount: number;
|
|
7392
|
+
nextOffset?: number;
|
|
7393
|
+
}>;
|
|
7394
|
+
}>;
|
|
7395
|
+
list(): Promise<WorkflowArtefactMeta[]>;
|
|
7396
|
+
};
|
|
7397
|
+
/** Stamped by the executor for observability; read-only. */
|
|
7398
|
+
runtime: {
|
|
7399
|
+
trigger: WorkflowRunTrigger;
|
|
7400
|
+
parentRunId?: string;
|
|
7401
|
+
agentVersion?: number;
|
|
7402
|
+
traceparent?: string;
|
|
7403
|
+
correlationKey?: string;
|
|
7404
|
+
tags?: string[];
|
|
7405
|
+
principalKind: 'user' | 'service' | 'customer';
|
|
7406
|
+
replyTo?: {
|
|
7407
|
+
channel: ReplyChannel;
|
|
7408
|
+
threadId: string;
|
|
7409
|
+
};
|
|
7410
|
+
};
|
|
7411
|
+
}
|
|
7412
|
+
|
|
7413
|
+
/** Thrown by `ctx.getStepResult` for a non-ancestor / unknown id — never `undefined` (03 §3.1). */
|
|
7414
|
+
export declare interface WorkflowStepResultError extends Error {
|
|
7415
|
+
code: 'STEP_RESULT_NOT_ANCESTOR';
|
|
7416
|
+
stepId: string;
|
|
7417
|
+
}
|
|
7418
|
+
|
|
7419
|
+
export declare interface WorkflowStepWorkspace {
|
|
7420
|
+
mount: 'rw' | 'ro';
|
|
7421
|
+
isolation?: 'shared' | 'worktree';
|
|
7422
|
+
}
|
|
7423
|
+
|
|
7424
|
+
export declare interface WorkflowSuspendOnTimeout {
|
|
7425
|
+
timeoutHours: number | TemplateBinding;
|
|
7426
|
+
}
|
|
7427
|
+
|
|
7428
|
+
export declare type WorkflowSuspendTimeoutChain = WorkflowSuspendTimeoutChainMember | WorkflowSuspendTimeoutChainMember[];
|
|
7429
|
+
|
|
7430
|
+
export declare type WorkflowSuspendTimeoutChainMember = 'deny' | 'cancel-run' | 'fail' | 'continue' | {
|
|
7431
|
+
escalateTo: WorkflowApproverSpec;
|
|
7432
|
+
timeoutHours: number;
|
|
7433
|
+
};
|
|
7434
|
+
|
|
7435
|
+
export declare type WorkflowWorkspaceBackend = 'ebs' | 'efs' | 's3';
|
|
7436
|
+
|
|
7437
|
+
export declare type WorkspaceSpec = {
|
|
7438
|
+
kind: 'git';
|
|
7439
|
+
repo: string | TemplateBinding;
|
|
7440
|
+
ref?: string | TemplateBinding;
|
|
7441
|
+
credentialsRef?: string;
|
|
7442
|
+
sizeGb?: number;
|
|
7443
|
+
ttlHours?: number;
|
|
7444
|
+
verify?: string;
|
|
7445
|
+
keepArtefacts?: boolean;
|
|
7446
|
+
backend?: WorkflowWorkspaceBackend;
|
|
7447
|
+
} | {
|
|
7448
|
+
kind: 'empty';
|
|
7449
|
+
sizeGb?: number;
|
|
7450
|
+
ttlHours?: number;
|
|
7451
|
+
keepArtefacts?: boolean;
|
|
7452
|
+
backend?: WorkflowWorkspaceBackend;
|
|
7453
|
+
};
|
|
7454
|
+
|
|
6400
7455
|
export { }
|