lua-cli 3.30.0 → 3.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-exports.d.ts +1020 -41
- package/dist/api-exports.js +4984 -137
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +25539 -14391
- package/dist/index.js.map +1 -1
- package/dist/voice/test/index.d.ts +4 -4
- package/dist/workflow-builder.d.ts +766 -0
- package/dist/workflow-builder.js +5732 -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 +73 -0
- package/docs/api/Workflows.md +110 -0
- package/docs/workflows/approvals.md +28 -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 +9 -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 +11 -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 +28 -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 +11 -0
- package/docs/workflows/script-form.md +50 -0
- package/docs/workflows/testing-offline.md +46 -0
- package/docs/workflows/workspace-backends.md +11 -0
- package/docs/workflows/workspaces-and-long-steps.md +27 -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 +24 -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 +38 -0
- package/template/examples/workflows/provision-tenant.ts +18 -0
- package/template/examples/workflows/refund-approval.ts +44 -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 +44 -0
- package/template/examples/workflows/ticket-to-pr.ts +65 -0
- package/template/examples/workflows/vendor-invoices.ts +30 -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
|
/**
|
|
@@ -104,21 +122,66 @@ declare interface AgentInvocationInput {
|
|
|
104
122
|
* approved-models policy server-side. */
|
|
105
123
|
model?: string;
|
|
106
124
|
/** Task 14 (tasks-redesign) — per-task connector + skill scoping. See `AgentToolScope`. */
|
|
107
|
-
toolScope?:
|
|
108
|
-
/**
|
|
109
|
-
* PRO-979 (A3) — cooperative mid-run cancellation.
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
125
|
+
toolScope?: AgentToolScope_2;
|
|
126
|
+
/**
|
|
127
|
+
* PRO-979 (A3) — cooperative mid-run cancellation. Aborting tears down the
|
|
128
|
+
* loopback HTTP call AND propagates to the server-side turn: the serving
|
|
129
|
+
* pod's `ActiveChatTurnRegistry` sees the socket close and aborts the turn
|
|
130
|
+
* signal (`'client_disconnected'`), which flows through
|
|
131
|
+
* `ChatRequest.clientAbortSignal` into Mastra's
|
|
132
|
+
* `agent.generate({ abortSignal })` loop, so the in-flight turn stops
|
|
133
|
+
* generating (the D4 abort chain, pinned by the Phase-0
|
|
134
|
+
* `chat-generate-abort.contract` spec). Propagation is asynchronous:
|
|
135
|
+
* callers that abort must still treat side effects already dispatched at
|
|
136
|
+
* abort time (e.g. an in-flight tool call) as possible and record them (the
|
|
137
|
+
* job runner's ledger does, via postFence). NOT serialized on the wire —
|
|
138
|
+
* this field exists only on in-process invocations.
|
|
115
139
|
*/
|
|
116
140
|
signal?: AbortSignal;
|
|
141
|
+
/**
|
|
142
|
+
* Workflows D10 (WF-003) — JSON Schema for a typed structured output on
|
|
143
|
+
* this turn. Honored server-side ONLY on internally-authenticated turns
|
|
144
|
+
* (`X-Internal-Auth`): `ChatService.buildChatRequest` copies it onto the
|
|
145
|
+
* `ChatRequest` and `AgentService.generate` forwards it as Mastra
|
|
146
|
+
* `structuredOutput`, so the result carries a schema-shaped `object`. A
|
|
147
|
+
* Bearer client's value is dropped before it can reach the model — same
|
|
148
|
+
* posture as `toolScope`.
|
|
149
|
+
*/
|
|
150
|
+
outputSchema?: Record<string, unknown>;
|
|
151
|
+
/**
|
|
152
|
+
* Workflows D11 (WF-003) — retry-stable billing identity for the turn
|
|
153
|
+
* (e.g. `wf:<runId>:<stepId>:<billingEpoch>`), letting the credit deduction
|
|
154
|
+
* be idempotent across step retries. Internal-auth-only, same posture as
|
|
155
|
+
* `outputSchema`/`toolScope`; a Bearer client's value is dropped.
|
|
156
|
+
*/
|
|
157
|
+
operationId?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Workflows D25 (WF-216, 04 §4.2.7 runtime 3) — the ephemeral specialist's
|
|
160
|
+
* additive role for THIS turn: `name` (the role name; attribution key
|
|
161
|
+
* `luaWorkflowRole`), `block` (the rendered `<lua-workflow-role>` block
|
|
162
|
+
* `PromptService` appends AFTER the owner's own persona/instructions) and
|
|
163
|
+
* `tools` (the explicit tool-id allowlist `DynamicToolService` intersects
|
|
164
|
+
* with the owner's toolset). Internal-auth-only, same posture as
|
|
165
|
+
* `outputSchema`/`toolScope`: a Bearer client's value is dropped. Never a
|
|
166
|
+
* `systemPrompt` — the persona is the owner's.
|
|
167
|
+
*/
|
|
168
|
+
workflowRole?: {
|
|
169
|
+
name: string;
|
|
170
|
+
block: string;
|
|
171
|
+
tools: string[];
|
|
172
|
+
};
|
|
117
173
|
}
|
|
118
174
|
|
|
119
175
|
declare interface AgentInvocationOutput {
|
|
120
176
|
/** Final response text (post-processor-modified, if applicable). */
|
|
121
177
|
text: string;
|
|
178
|
+
/**
|
|
179
|
+
* Workflows D10 (WF-003/WF-108) — the schema-shaped structured result of a
|
|
180
|
+
* turn that carried `outputSchema`. Present ONLY when the turn ran with
|
|
181
|
+
* Mastra `structuredOutput` (internal-auth-only, so Bearer callers can never
|
|
182
|
+
* receive it); absent otherwise — legacy outputs are byte-identical.
|
|
183
|
+
*/
|
|
184
|
+
object?: unknown;
|
|
122
185
|
/** AI SDK `FinishReason` (or `'preprocessor_blocked'` / `'governance_blocked'`). */
|
|
123
186
|
finishReason?: string;
|
|
124
187
|
/** Token usage summary. */
|
|
@@ -226,6 +289,34 @@ export declare interface AgentsApi {
|
|
|
226
289
|
invoke(targetAgentId: string, input: AgentInvocationInput): Promise<AgentInvocationOutput>;
|
|
227
290
|
}
|
|
228
291
|
|
|
292
|
+
export declare interface AgentStepOptions {
|
|
293
|
+
agentId: string | EnvRefBinding;
|
|
294
|
+
prompt: TemplateLike;
|
|
295
|
+
outputSchema?: ZodType;
|
|
296
|
+
model?: string;
|
|
297
|
+
toolScope?: AgentToolScope & {
|
|
298
|
+
jobTools?: WorkflowJobToolId[];
|
|
299
|
+
};
|
|
300
|
+
timeoutSeconds?: number;
|
|
301
|
+
retry?: RetryPolicy;
|
|
302
|
+
onError?: 'fail' | 'continue' | 'park';
|
|
303
|
+
requiredConnections?: string[];
|
|
304
|
+
/** static-only persona override (§11 S3) */
|
|
305
|
+
systemPrompt?: string;
|
|
306
|
+
tier?: 'job';
|
|
307
|
+
workspace?: WorkflowStepWorkspace;
|
|
308
|
+
jobResources?: 'small' | 'medium' | 'large';
|
|
309
|
+
harness?: WorkflowJobHarness;
|
|
310
|
+
/** Coding-turn cap for a tier:'job' step (1..500); absent ⇒ the platform default. A monorepo change needs more than the default. */
|
|
311
|
+
maxTurns?: number;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export declare interface AgentToolScope {
|
|
315
|
+
connectionIds?: string[];
|
|
316
|
+
skillIds?: string[];
|
|
317
|
+
toolIds?: string[];
|
|
318
|
+
}
|
|
319
|
+
|
|
229
320
|
/**
|
|
230
321
|
* Task 14 (tasks-redesign) — per-task connector + skill scoping for a scheduled
|
|
231
322
|
* agent run. Non-empty `connectionIds` restricts the turn's MCP servers to the
|
|
@@ -236,7 +327,7 @@ export declare interface AgentsApi {
|
|
|
236
327
|
* `X-Internal-Auth` agent-invoke path used by the server-side job runner) —
|
|
237
328
|
* lua-core drops it from any client-authenticated `/chat/*` request.
|
|
238
329
|
*/
|
|
239
|
-
declare interface
|
|
330
|
+
declare interface AgentToolScope_2 {
|
|
240
331
|
/** Allowlisted agent connection ids (UnifiedTo `unifiedId`s). */
|
|
241
332
|
connectionIds?: string[];
|
|
242
333
|
/** Allowlisted skill ids (from the agent's `subAgent.skills`). */
|
|
@@ -384,6 +475,8 @@ export declare interface AiGenerateToolResult {
|
|
|
384
475
|
isError?: boolean;
|
|
385
476
|
}
|
|
386
477
|
|
|
478
|
+
export declare const and: (...args: LuaPredicate[]) => LuaPredicate;
|
|
479
|
+
|
|
387
480
|
/**
|
|
388
481
|
* Common Interfaces
|
|
389
482
|
* Shared interfaces used across multiple modules
|
|
@@ -422,6 +515,33 @@ declare interface ApiResponse<T = any> {
|
|
|
422
515
|
};
|
|
423
516
|
}
|
|
424
517
|
|
|
518
|
+
export declare interface ApprovalOptions {
|
|
519
|
+
title: string;
|
|
520
|
+
details?: TemplateBinding;
|
|
521
|
+
/** default 'creator' */
|
|
522
|
+
approver?: WorkflowApproverSpec;
|
|
523
|
+
excludeInitiator?: boolean;
|
|
524
|
+
fourEyes?: WorkflowFourEyes;
|
|
525
|
+
/** default 168; a binding is resolved at suspend time and must yield 1..720 */
|
|
526
|
+
timeoutHours?: number | TemplateBinding;
|
|
527
|
+
/** 'deny' (default) | 'cancel-run' | 'fail' | a chain of ≤ 3 hops ending in one terminal member */
|
|
528
|
+
onTimeout?: WorkflowSuspendTimeoutChain;
|
|
529
|
+
/** default 'continue' (denial is data unless 'fail') */
|
|
530
|
+
onDeny?: 'fail' | 'continue';
|
|
531
|
+
businessHours?: WorkflowBusinessHours;
|
|
532
|
+
editable?: boolean;
|
|
533
|
+
/** grammar: `drafts`, `drafts[*]`, `drafts[*].body`, `drafts[3].body`, `summary.title` */
|
|
534
|
+
editablePaths?: string[];
|
|
535
|
+
editedPayloadSchema?: ZodType;
|
|
536
|
+
itemsPath?: string;
|
|
537
|
+
itemApprover?: WorkflowApproverSpec | {
|
|
538
|
+
fromItem: string;
|
|
539
|
+
};
|
|
540
|
+
itemTimeout?: WorkflowSuspendOnTimeout;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export { ArtefactRef }
|
|
544
|
+
|
|
425
545
|
/**
|
|
426
546
|
* Complete basket entity.
|
|
427
547
|
* Full basket object as stored in the database.
|
|
@@ -748,6 +868,26 @@ declare interface BrowserSwitchConfig {
|
|
|
748
868
|
maxSessionMinutes?: number;
|
|
749
869
|
}
|
|
750
870
|
|
|
871
|
+
/** What `.commit()` hands to `LuaWorkflow` — internal; never `new LuaWorkflow({...})` by users. */
|
|
872
|
+
declare interface BuiltWorkflow {
|
|
873
|
+
config: LuaWorkflowConfig;
|
|
874
|
+
graph: WorkflowGraphEntry[];
|
|
875
|
+
steps: Record<string, LuaWorkflowStep<any, any, any>>;
|
|
876
|
+
warnings: LuaWorkflowBuildWarning[];
|
|
877
|
+
envTemplateKeys: string[];
|
|
878
|
+
nestedRefs: Array<{
|
|
879
|
+
id: string;
|
|
880
|
+
name: string;
|
|
881
|
+
}>;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/** R11 — `CancelRunVerdict` (PRO-979 vocabulary). */
|
|
885
|
+
declare interface CancelRunVerdict {
|
|
886
|
+
status: WorkflowRunStatus;
|
|
887
|
+
nextAction: string;
|
|
888
|
+
forceAvailableAt?: string;
|
|
889
|
+
}
|
|
890
|
+
|
|
751
891
|
/**
|
|
752
892
|
* CDN API
|
|
753
893
|
* Upload and retrieve files from the Lua CDN
|
|
@@ -1142,6 +1282,9 @@ export declare interface ChatHistoryMessage {
|
|
|
1142
1282
|
*/
|
|
1143
1283
|
export declare type ChatMessage = TextMessage | ImageMessage | FileMessage;
|
|
1144
1284
|
|
|
1285
|
+
/** A container arm: a `StepRef`, or (B14 — lands with WF-509) the two-element chain `[mapConfig, stepRef]`. */
|
|
1286
|
+
export declare type ContainerArm = StepRef | [LuaMapConfig, StepRef];
|
|
1287
|
+
|
|
1145
1288
|
/**
|
|
1146
1289
|
* Options for creating a custom data entry.
|
|
1147
1290
|
*/
|
|
@@ -1196,6 +1339,10 @@ declare interface CreateOrderRequest {
|
|
|
1196
1339
|
};
|
|
1197
1340
|
}
|
|
1198
1341
|
|
|
1342
|
+
export declare function createStep<TIn extends ZodType, TOut extends ZodType, TResume extends ZodType = ZodType>(s: LuaWorkflowStep<TIn, TOut, TResume>): LuaWorkflowStep<TIn, TOut, TResume>;
|
|
1343
|
+
|
|
1344
|
+
export declare function createWorkflow(cfg: LuaWorkflowConfig): LuaWorkflowBuilder;
|
|
1345
|
+
|
|
1199
1346
|
/**
|
|
1200
1347
|
* Custom Data API contract.
|
|
1201
1348
|
* Defines operations for managing custom data collections with vector search.
|
|
@@ -1459,6 +1606,8 @@ export declare class DataEntryInstance {
|
|
|
1459
1606
|
save(searchText?: string): Promise<boolean>;
|
|
1460
1607
|
}
|
|
1461
1608
|
|
|
1609
|
+
export { DatasetRef }
|
|
1610
|
+
|
|
1462
1611
|
/**
|
|
1463
1612
|
* Define a device that an agent can communicate with.
|
|
1464
1613
|
*
|
|
@@ -1556,6 +1705,8 @@ export declare function defineTrigger<T = any>(config: LuaTriggerConfig<T>): Lua
|
|
|
1556
1705
|
*/
|
|
1557
1706
|
export declare function defineVoice(config: LuaVoiceConfig): LuaVoice;
|
|
1558
1707
|
|
|
1708
|
+
export declare function defineWorkflow(cfg: LuaWorkflowConfig, build: (wf: LuaWorkflowBuilder) => LuaWorkflow): LuaWorkflow;
|
|
1709
|
+
|
|
1559
1710
|
/**
|
|
1560
1711
|
* Response from deleting custom data entry.
|
|
1561
1712
|
*/
|
|
@@ -1672,6 +1823,8 @@ export declare interface DeliveryView {
|
|
|
1672
1823
|
failedAt?: string;
|
|
1673
1824
|
}
|
|
1674
1825
|
|
|
1826
|
+
declare type Depth = [never, 0, 1, 2, 3, 4];
|
|
1827
|
+
|
|
1675
1828
|
/** Configuration for a single device command (agent → device) */
|
|
1676
1829
|
export declare interface DeviceCommandConfig {
|
|
1677
1830
|
/** Description of what this command does */
|
|
@@ -1735,6 +1888,11 @@ export declare interface DirectoryTarget {
|
|
|
1735
1888
|
validated: boolean;
|
|
1736
1889
|
}
|
|
1737
1890
|
|
|
1891
|
+
/** Template-literal walk of T's object keys, depth ≤ 4 (P1-21). */
|
|
1892
|
+
export declare type DotPath<T, D extends number = 4> = [D] extends [never] ? never : T extends readonly unknown[] ? never : T extends object ? {
|
|
1893
|
+
[K in keyof T & string]: NonNullable<T[K]> extends object ? K | `${K}.${DotPath<NonNullable<T[K]>, Depth[D]>}` : K;
|
|
1894
|
+
}[keyof T & string] : never;
|
|
1895
|
+
|
|
1738
1896
|
/** A single email attachment, referenced by URL — lua-email fetches the bytes
|
|
1739
1897
|
* server-side and attaches them, keeping large files off the SDK→API hops. */
|
|
1740
1898
|
declare interface EmailAttachmentInput {
|
|
@@ -1781,21 +1939,31 @@ export declare interface EmailSendInput {
|
|
|
1781
1939
|
}
|
|
1782
1940
|
|
|
1783
1941
|
/**
|
|
1784
|
-
*
|
|
1785
|
-
* Gets injected at runtime with skill-specific environment variables.
|
|
1786
|
-
*
|
|
1787
|
-
* Checks process environment variables (.env file)
|
|
1788
|
-
*
|
|
1789
|
-
* @param key - The environment variable key to retrieve
|
|
1790
|
-
* @returns The environment variable value or undefined if not found
|
|
1942
|
+
* Read a sub-agent env key.
|
|
1791
1943
|
*
|
|
1792
|
-
*
|
|
1793
|
-
*
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1797
|
-
|
|
1798
|
-
|
|
1944
|
+
* Workflows (03 §3.1, WF-201): at MODULE TOP LEVEL of a workflow file the
|
|
1945
|
+
* compiler's tier-1 sandbox replaces this with a stub that returns `''` and
|
|
1946
|
+
* records the key into `ManifestWorkflow.envKeys[]`; inside `execute` it is
|
|
1947
|
+
* `ctx.env[key]`. `env.template(KEY)` (Cluster K — B33) returns the
|
|
1948
|
+
* `{ __envRef: KEY }` placeholder legal wherever a `template(...)` binding is —
|
|
1949
|
+
* never a value at construction time — and `lua push` resolves it from the
|
|
1950
|
+
* TARGET agent env into the version's `envOverlay`.
|
|
1951
|
+
*/
|
|
1952
|
+
export declare const env: ((key: string, opts?: {
|
|
1953
|
+
manifest?: boolean;
|
|
1954
|
+
}) => string | undefined) & {
|
|
1955
|
+
template: (key: string) => {
|
|
1956
|
+
__envRef: string;
|
|
1957
|
+
};
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1960
|
+
export { EnvRefBinding }
|
|
1961
|
+
|
|
1962
|
+
export declare const eq: <T>(l: TypedRef<T>, r: TypedRef<T> | Literal<T>) => LuaPredicate;
|
|
1963
|
+
|
|
1964
|
+
export declare const exists: (ref: TypedRef<unknown>) => LuaPredicate;
|
|
1965
|
+
|
|
1966
|
+
export declare const falsy: (ref: TypedRef<unknown>) => LuaPredicate;
|
|
1799
1967
|
|
|
1800
1968
|
export declare interface FileMessage {
|
|
1801
1969
|
type: 'file';
|
|
@@ -1809,6 +1977,37 @@ declare type FileMessage_2 = {
|
|
|
1809
1977
|
mediaType: string;
|
|
1810
1978
|
};
|
|
1811
1979
|
|
|
1980
|
+
export declare interface ForeachOptions {
|
|
1981
|
+
/** Cluster G (B34): PURE builder lowering — emits `{ type:'mapping', id:'<foreachId>_items', mapConfig:{'': items} }` before the foreach entry. */
|
|
1982
|
+
items?: TypedRef<unknown[]> | {
|
|
1983
|
+
step: string;
|
|
1984
|
+
path: string;
|
|
1985
|
+
} | {
|
|
1986
|
+
initData: true;
|
|
1987
|
+
path?: string;
|
|
1988
|
+
};
|
|
1989
|
+
/** default 4, max 16 */
|
|
1990
|
+
concurrency?: number;
|
|
1991
|
+
/** default 256 — a FAIL-FAST bound at runtime, never a truncation (P0-6). */
|
|
1992
|
+
maxItems?: number;
|
|
1993
|
+
chunk?: {
|
|
1994
|
+
size: number;
|
|
1995
|
+
};
|
|
1996
|
+
rateLimit?: {
|
|
1997
|
+
perSecond?: number;
|
|
1998
|
+
perMinute?: number;
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
export declare const fromInit: (path: string) => MapDescriptor;
|
|
2003
|
+
|
|
2004
|
+
export declare const fromKnowledge: typeof fromKnowledge_2;
|
|
2005
|
+
|
|
2006
|
+
export declare const fromRequest: (path: string) => MapDescriptor;
|
|
2007
|
+
|
|
2008
|
+
/** path default '' = whole output */
|
|
2009
|
+
export declare const fromStep: (s: LuaWorkflowStep<any, any, any> | string | Array<LuaWorkflowStep<any, any, any> | string>, path?: string) => MapDescriptor;
|
|
2010
|
+
|
|
1812
2011
|
/**
|
|
1813
2012
|
* Response from getting custom data entries.
|
|
1814
2013
|
* Includes pagination information.
|
|
@@ -1887,6 +2086,10 @@ declare interface GovernanceConfig {
|
|
|
1887
2086
|
serverUrl?: string;
|
|
1888
2087
|
}
|
|
1889
2088
|
|
|
2089
|
+
export declare const gt: (l: TypedRef<number> | number, r: TypedRef<number> | Literal<number> | number) => LuaPredicate;
|
|
2090
|
+
|
|
2091
|
+
export declare const gte: (l: TypedRef<number> | number, r: TypedRef<number> | Literal<number> | number) => LuaPredicate;
|
|
2092
|
+
|
|
1890
2093
|
/**
|
|
1891
2094
|
* Function type for resolving headers at runtime.
|
|
1892
2095
|
* Use env() inside to access agent environment variables.
|
|
@@ -1920,6 +2123,13 @@ declare abstract class HttpClient {
|
|
|
1920
2123
|
* @private
|
|
1921
2124
|
*/
|
|
1922
2125
|
private request;
|
|
2126
|
+
/**
|
|
2127
|
+
* Non-2xx classification shared by `request` and `httpStream` (WF-204): 401s become
|
|
2128
|
+
* `AuthenticationError` (ownership vs credential), 403s throw, everything else returns the
|
|
2129
|
+
* `{ success:false, error }` envelope with the server body spread in.
|
|
2130
|
+
* @private
|
|
2131
|
+
*/
|
|
2132
|
+
private classifyErrorResponse;
|
|
1923
2133
|
/**
|
|
1924
2134
|
* Checks if an HTTP status code is retryable
|
|
1925
2135
|
* @param statusCode - The HTTP status code (0 for network errors)
|
|
@@ -1961,7 +2171,7 @@ declare abstract class HttpClient {
|
|
|
1961
2171
|
* @returns Promise resolving to an ApiResponse with typed data
|
|
1962
2172
|
* @protected
|
|
1963
2173
|
*/
|
|
1964
|
-
protected httpPost<T>(url: string, data?: any, headers?: Record<string, string
|
|
2174
|
+
protected httpPost<T>(url: string, data?: any, headers?: Record<string, string>, overrides?: RequestOverrides): Promise<ApiResponse<T>>;
|
|
1965
2175
|
/**
|
|
1966
2176
|
* Performs one HTTP POST attempt.
|
|
1967
2177
|
*
|
|
@@ -1996,6 +2206,25 @@ declare abstract class HttpClient {
|
|
|
1996
2206
|
* @protected
|
|
1997
2207
|
*/
|
|
1998
2208
|
protected httpPatch<T>(url: string, data?: any, headers?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
2209
|
+
/**
|
|
2210
|
+
* Opens a Server-Sent Events stream (WF-204 — 03 §3.10 `watch`; 09 §9.10 `watchEvents`).
|
|
2211
|
+
*
|
|
2212
|
+
* The ONLY deliberately timeout-free request in the client: an SSE tail lives as long as
|
|
2213
|
+
* the run (the server heartbeats every 15 s). Cancellation is the caller's `signal`.
|
|
2214
|
+
* Non-2xx responses go through the same 401/403 classification as `request` — a 401 is
|
|
2215
|
+
* an `AuthenticationError`, a 403 throws — and every other status resolves the returned
|
|
2216
|
+
* `ApiResponse` with `success:false` (no retry: the caller decides whether to reconnect,
|
|
2217
|
+
* passing `Last-Event-ID` for a resume).
|
|
2218
|
+
*
|
|
2219
|
+
* @param url - relative URL path (appended to baseUrl)
|
|
2220
|
+
* @param headers - headers (auth); `Last-Event-ID` when resuming
|
|
2221
|
+
* @param opts.signal - abort to close the stream
|
|
2222
|
+
* @returns `{ success:true, data: AsyncIterable<SseFrame> }` or the error envelope
|
|
2223
|
+
* @protected
|
|
2224
|
+
*/
|
|
2225
|
+
protected httpStream(url: string, headers?: Record<string, string>, opts?: {
|
|
2226
|
+
signal?: AbortSignal;
|
|
2227
|
+
}): Promise<ApiResponse<AsyncIterable<SseFrame>>>;
|
|
1999
2228
|
}
|
|
2000
2229
|
|
|
2001
2230
|
/**
|
|
@@ -2094,6 +2323,10 @@ declare interface InboxPushReceipt {
|
|
|
2094
2323
|
reason?: string;
|
|
2095
2324
|
}
|
|
2096
2325
|
|
|
2326
|
+
export declare const init: <T = unknown>(path: string) => TypedRef<T>;
|
|
2327
|
+
|
|
2328
|
+
export declare const inSet: <T extends string | number | boolean | null>(v: TypedRef<T>, set: T[]) => LuaPredicate;
|
|
2329
|
+
|
|
2097
2330
|
/** HTTP methods the passthrough relay accepts. */
|
|
2098
2331
|
declare const INTEGRATION_PASSTHROUGH_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"];
|
|
2099
2332
|
|
|
@@ -2656,12 +2889,31 @@ declare interface JobVersion {
|
|
|
2656
2889
|
metadata?: Record<string, any>;
|
|
2657
2890
|
}
|
|
2658
2891
|
|
|
2892
|
+
export { JsonSchema }
|
|
2893
|
+
|
|
2894
|
+
export { KnowledgeBindingSpec }
|
|
2895
|
+
|
|
2659
2896
|
export declare interface ListTemplatesOptions {
|
|
2660
2897
|
page?: number;
|
|
2661
2898
|
limit?: number;
|
|
2662
2899
|
search?: string;
|
|
2663
2900
|
}
|
|
2664
2901
|
|
|
2902
|
+
export declare const lit: <const V extends string | number | boolean | null>(v: V) => Literal<V>;
|
|
2903
|
+
|
|
2904
|
+
export { Literal }
|
|
2905
|
+
|
|
2906
|
+
export declare interface LoopOptions {
|
|
2907
|
+
/** default 100 */
|
|
2908
|
+
maxIterations?: number;
|
|
2909
|
+
/** engine timer between iterations, 1..86 400 (B24) */
|
|
2910
|
+
intervalSeconds?: number;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
export declare const lt: (l: TypedRef<number> | number, r: TypedRef<number> | Literal<number> | number) => LuaPredicate;
|
|
2914
|
+
|
|
2915
|
+
export declare const lte: (l: TypedRef<number> | number, r: TypedRef<number> | Literal<number> | number) => LuaPredicate;
|
|
2916
|
+
|
|
2665
2917
|
/**
|
|
2666
2918
|
* Lua Runtime API
|
|
2667
2919
|
* Access request-level runtime information in your tools, conditions, and processors.
|
|
@@ -2723,6 +2975,7 @@ export declare class LuaAgent {
|
|
|
2723
2975
|
private readonly webhooks;
|
|
2724
2976
|
private readonly triggers;
|
|
2725
2977
|
private readonly jobs;
|
|
2978
|
+
private readonly workflows;
|
|
2726
2979
|
private readonly preProcessors;
|
|
2727
2980
|
private readonly postProcessors;
|
|
2728
2981
|
private readonly mcpServers;
|
|
@@ -2761,6 +3014,7 @@ export declare class LuaAgent {
|
|
|
2761
3014
|
getWebhooks(): LuaWebhook[];
|
|
2762
3015
|
getTriggers(): LuaTrigger[];
|
|
2763
3016
|
getJobs(): LuaJob[];
|
|
3017
|
+
getWorkflows(): LuaWorkflow[];
|
|
2764
3018
|
getPreProcessors(): PreProcessor[];
|
|
2765
3019
|
getPostProcessors(): PostProcessor[];
|
|
2766
3020
|
getMCPServers(): LuaMCPServer[];
|
|
@@ -2803,6 +3057,8 @@ export declare interface LuaAgentConfig {
|
|
|
2803
3057
|
triggers?: LuaTrigger[];
|
|
2804
3058
|
/** Array of scheduled jobs */
|
|
2805
3059
|
jobs?: LuaJob[];
|
|
3060
|
+
/** Array of workflows (createWorkflow / defineWorkflow) — 03 §3.1; resolved by the compiler traverser, dropped from the agent bundle */
|
|
3061
|
+
workflows?: LuaWorkflow[];
|
|
2806
3062
|
/** Array of preprocessors (run before messages reach the agent) */
|
|
2807
3063
|
preProcessors?: PreProcessor[];
|
|
2808
3064
|
/** Array of postprocessors (run after agent generates responses) */
|
|
@@ -3127,6 +3383,8 @@ export declare interface LuaJobConfig {
|
|
|
3127
3383
|
metadata?: Record<string, any>;
|
|
3128
3384
|
}
|
|
3129
3385
|
|
|
3386
|
+
export { LuaMapConfig }
|
|
3387
|
+
|
|
3130
3388
|
/**
|
|
3131
3389
|
* LuaMCPServer class.
|
|
3132
3390
|
* Defines an MCP (Model Context Protocol) server connection.
|
|
@@ -3184,6 +3442,8 @@ export declare class LuaMCPServer {
|
|
|
3184
3442
|
*/
|
|
3185
3443
|
export declare type LuaMCPServerConfig = MCPSSEServerConfig | MCPStreamableHttpServerConfig;
|
|
3186
3444
|
|
|
3445
|
+
export { LuaPredicate }
|
|
3446
|
+
|
|
3187
3447
|
/**
|
|
3188
3448
|
* The entity-independent, bounded Mongo-style filter accepted by Lua APIs.
|
|
3189
3449
|
* Root `$and`/`$or` branches and nested data fields share this recursive shape;
|
|
@@ -3414,7 +3674,7 @@ export declare class LuaTrigger<T = any> {
|
|
|
3414
3674
|
readonly inputSchema?: ZodType;
|
|
3415
3675
|
readonly verify?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
|
|
3416
3676
|
readonly filter?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
|
|
3417
|
-
readonly transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | Promise<string | AgentInvocationInput>;
|
|
3677
|
+
readonly transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | TriggerStartWorkflow | Promise<string | AgentInvocationInput | TriggerStartWorkflow>;
|
|
3418
3678
|
readonly tool?: {
|
|
3419
3679
|
name: string;
|
|
3420
3680
|
input?: (ctx: TriggerContext<T>) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
@@ -3457,7 +3717,7 @@ export declare interface LuaTriggerConfig<T = any> {
|
|
|
3457
3717
|
* whose payload is capped at ~50k chars (like a no-code trigger); return a
|
|
3458
3718
|
* transform to forward larger or hand-picked fields as the message.
|
|
3459
3719
|
*/
|
|
3460
|
-
transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | Promise<string | AgentInvocationInput>;
|
|
3720
|
+
transform?: (ctx: TriggerContext<T>) => string | AgentInvocationInput | TriggerStartWorkflow | Promise<string | AgentInvocationInput | TriggerStartWorkflow>;
|
|
3461
3721
|
/**
|
|
3462
3722
|
* Direct tool binding: after `verify`/`filter` pass, the platform executes
|
|
3463
3723
|
* this named skill tool DIRECTLY — no chat turn, no LLM, no visible
|
|
@@ -3984,7 +4244,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3984
4244
|
prefixPaddingDuration?: number;
|
|
3985
4245
|
activationThreshold?: number;
|
|
3986
4246
|
};
|
|
3987
|
-
turnDetection?: "
|
|
4247
|
+
turnDetection?: "manual" | "multilingual" | "english" | "vad" | "stt";
|
|
3988
4248
|
greeting?: string;
|
|
3989
4249
|
maxToolSteps?: number;
|
|
3990
4250
|
userAwayTimeout?: number;
|
|
@@ -4078,7 +4338,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
4078
4338
|
prefixPaddingDuration?: number;
|
|
4079
4339
|
activationThreshold?: number;
|
|
4080
4340
|
};
|
|
4081
|
-
turnDetection?: "
|
|
4341
|
+
turnDetection?: "manual" | "multilingual" | "english" | "vad" | "stt";
|
|
4082
4342
|
greeting?: string;
|
|
4083
4343
|
maxToolSteps?: number;
|
|
4084
4344
|
userAwayTimeout?: number;
|
|
@@ -4172,7 +4432,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
4172
4432
|
prefixPaddingDuration?: number;
|
|
4173
4433
|
activationThreshold?: number;
|
|
4174
4434
|
};
|
|
4175
|
-
turnDetection?: "
|
|
4435
|
+
turnDetection?: "manual" | "multilingual" | "english" | "vad" | "stt";
|
|
4176
4436
|
greeting?: string;
|
|
4177
4437
|
maxToolSteps?: number;
|
|
4178
4438
|
userAwayTimeout?: number;
|
|
@@ -4266,7 +4526,7 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
4266
4526
|
prefixPaddingDuration?: number;
|
|
4267
4527
|
activationThreshold?: number;
|
|
4268
4528
|
};
|
|
4269
|
-
turnDetection?: "
|
|
4529
|
+
turnDetection?: "manual" | "multilingual" | "english" | "vad" | "stt";
|
|
4270
4530
|
greeting?: string;
|
|
4271
4531
|
maxToolSteps?: number;
|
|
4272
4532
|
userAwayTimeout?: number;
|
|
@@ -4621,6 +4881,144 @@ declare interface LuaWebhookEvent {
|
|
|
4621
4881
|
timestamp: string;
|
|
4622
4882
|
}
|
|
4623
4883
|
|
|
4884
|
+
export declare class LuaWorkflow {
|
|
4885
|
+
private readonly built;
|
|
4886
|
+
constructor(built: BuiltWorkflow);
|
|
4887
|
+
getName(): string;
|
|
4888
|
+
getConfig(): LuaWorkflowConfig;
|
|
4889
|
+
getSteps(): Record<string, LuaWorkflowStep<any, any, any>>;
|
|
4890
|
+
/** Builder warnings (`map-id-required`, `hitl-duration-defaulted`, `schedule-input-*`) — the compiler prints them. */
|
|
4891
|
+
getBuildWarnings(): LuaWorkflowBuildWarning[];
|
|
4892
|
+
/** Every `env.template(KEY)` placeholder key the graph carries (sorted, deduped) — `ManifestWorkflow.envTemplateKeys`. */
|
|
4893
|
+
getEnvTemplateKeys(): string[];
|
|
4894
|
+
/** `.workflow(id, ref)` targets by name — `ManifestWorkflow.workflowRefs`. */
|
|
4895
|
+
getNestedWorkflowRefs(): Array<{
|
|
4896
|
+
id: string;
|
|
4897
|
+
name: string;
|
|
4898
|
+
}>;
|
|
4899
|
+
/** Pure: no I/O, no env, no time. Called by the compiler in the VM tier and by `lua test`. */
|
|
4900
|
+
__serializeGraph(): SerializedWorkflowGraph;
|
|
4901
|
+
}
|
|
4902
|
+
|
|
4903
|
+
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' | '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';
|
|
4904
|
+
|
|
4905
|
+
export declare interface LuaWorkflowBuilder {
|
|
4906
|
+
then(step: StepRef): this;
|
|
4907
|
+
/** 2..16 arms; output = { [stepId]: output } */
|
|
4908
|
+
parallel(steps: ContainerArm[], opts?: {
|
|
4909
|
+
merge?: WorkflowMergePolicy;
|
|
4910
|
+
}): this;
|
|
4911
|
+
/** all-true arms run (Mastra); exclusive:true ≡ switch() */
|
|
4912
|
+
branch(arms: Array<[LuaPredicate, StepRef]>, opts?: {
|
|
4913
|
+
exclusive?: boolean;
|
|
4914
|
+
}): this;
|
|
4915
|
+
/** first true arm only ⇒ conditional{ exclusive:true, otherwise } */
|
|
4916
|
+
switch(arms: Array<[LuaPredicate, StepRef]>, otherwise?: StepRef): this;
|
|
4917
|
+
foreach(step: ContainerArm, opts?: ForeachOptions): this;
|
|
4918
|
+
dowhile(step: ContainerArm, predicate: LuaPredicate, opts?: LoopOptions): this;
|
|
4919
|
+
dountil(step: ContainerArm, predicate: LuaPredicate, opts?: LoopOptions): this;
|
|
4920
|
+
/** top-level only. `id` is REQUIRED once the workflow has ≥ 2 maps (`map-id-required`). */
|
|
4921
|
+
map(mapping: LuaMapConfig, opts?: {
|
|
4922
|
+
id?: string;
|
|
4923
|
+
}): this;
|
|
4924
|
+
/** literal only; engine-side wait, no lease */
|
|
4925
|
+
sleep(ms: number, opts?: {
|
|
4926
|
+
id?: string;
|
|
4927
|
+
businessHours?: WorkflowBusinessHours;
|
|
4928
|
+
}): this;
|
|
4929
|
+
/** a TemplateBinding lowers to `<id>_at` mapping + `sleepUntil{dateFrom}` (D6-r1) */
|
|
4930
|
+
sleepUntil(iso: string | TemplateBinding, opts?: {
|
|
4931
|
+
id?: string;
|
|
4932
|
+
businessHours?: WorkflowBusinessHours;
|
|
4933
|
+
round?: 'next-open' | 'next-close';
|
|
4934
|
+
}): this;
|
|
4935
|
+
agentStep(id: string, opts: AgentStepOptions): this;
|
|
4936
|
+
/** D25 ephemeral specialist: runs AS THE OWNING AGENT (`agentId:'$self'`) with an additive role block. */
|
|
4937
|
+
specialistStep(id: string, opts: SpecialistStepOptions): this;
|
|
4938
|
+
toolStep(id: string, tool: LuaTool<any>, opts?: ToolStepOptions): this;
|
|
4939
|
+
approval(id: string, opts: ApprovalOptions): this;
|
|
4940
|
+
waitForSignal(id: string, opts: WaitForSignalOptions): this;
|
|
4941
|
+
/** nested run; depth ≤ 3 */
|
|
4942
|
+
workflow(id: string, ref: LuaWorkflow | string, input?: LuaMapConfig, opts?: {
|
|
4943
|
+
workspace?: 'inherit';
|
|
4944
|
+
}): this;
|
|
4945
|
+
commit(): LuaWorkflow;
|
|
4946
|
+
}
|
|
4947
|
+
|
|
4948
|
+
export declare class LuaWorkflowBuildError extends Error {
|
|
4949
|
+
readonly code: LuaWorkflowBuildCode;
|
|
4950
|
+
readonly hint?: string | undefined;
|
|
4951
|
+
constructor(code: LuaWorkflowBuildCode, message: string, hint?: string | undefined);
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
export declare interface LuaWorkflowBuildWarning {
|
|
4955
|
+
code: LuaWorkflowBuildCode;
|
|
4956
|
+
message: string;
|
|
4957
|
+
stepId?: string;
|
|
4958
|
+
}
|
|
4959
|
+
|
|
4960
|
+
export declare interface LuaWorkflowConfig {
|
|
4961
|
+
/** /^[a-z][a-z0-9-_]*$/ — server identifier */
|
|
4962
|
+
name: string;
|
|
4963
|
+
description?: string;
|
|
4964
|
+
inputSchema: ZodType;
|
|
4965
|
+
outputSchema?: ZodType;
|
|
4966
|
+
/** types `ctx.state`; ≤ 64KB at runtime */
|
|
4967
|
+
stateSchema?: ZodType;
|
|
4968
|
+
/** 'forbid' = jobs-style overlap guard per workflow (D21-r1) — every start path gets 409 `RUNS_IN_FLIGHT`. */
|
|
4969
|
+
concurrencyPolicy?: 'allow' | 'forbid';
|
|
4970
|
+
/** Who may READ this workflow's run outputs beyond `workflows:read-outputs` holders (B44). Envelope member outside `graphHash`. */
|
|
4971
|
+
outputVisibility?: WorkflowOutputVisibility;
|
|
4972
|
+
/** `maxDurationSeconds` default 604 800; 2 592 000 when the graph contains an approval / waitForSignal / suspend-capable step (P1-4). */
|
|
4973
|
+
budget?: {
|
|
4974
|
+
maxCredits?: number;
|
|
4975
|
+
maxSteps?: number;
|
|
4976
|
+
maxDurationSeconds?: number;
|
|
4977
|
+
};
|
|
4978
|
+
/** verbatim LuaJob union (D12) → Job{kind:'workflow'} on publish */
|
|
4979
|
+
schedule?: JobSchedule;
|
|
4980
|
+
backfillOnEnable?: {
|
|
4981
|
+
maxOccurrences?: number;
|
|
4982
|
+
};
|
|
4983
|
+
/** Literal JSON passed as run input on every scheduled fire; must validate against `inputSchema` (P0-5e). */
|
|
4984
|
+
scheduleInput?: Record<string, unknown>;
|
|
4985
|
+
goal?: WorkflowGoalEnvelope;
|
|
4986
|
+
/** NEVER set by hand — the compiler derives it from the source file. */
|
|
4987
|
+
form?: 'graph' | 'script';
|
|
4988
|
+
workspace?: WorkspaceSpec;
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
export declare interface LuaWorkflowStep<TIn extends ZodType = ZodType, TOut extends ZodType = ZodType, TResume extends ZodType = ZodType> {
|
|
4992
|
+
/** /^[a-z][a-zA-Z0-9_-]{0,63}$/ — unique per workflow; `[`, `#`, `.`, `:` reserved. */
|
|
4993
|
+
id: string;
|
|
4994
|
+
description?: string;
|
|
4995
|
+
inputSchema: TIn;
|
|
4996
|
+
outputSchema: TOut;
|
|
4997
|
+
suspendSchema?: ZodType;
|
|
4998
|
+
resumeSchema?: TResume;
|
|
4999
|
+
execute: (ctx: WorkflowStepContext<z.infer<TIn>, z.infer<TResume>>) => Promise<z.infer<TOut>>;
|
|
5000
|
+
/** 1..600 (D19); default 300 — on `tier:'job'` 1..86 400, default 3600. */
|
|
5001
|
+
timeoutSeconds?: number;
|
|
5002
|
+
/** Run this step as a k8s Job (hours tier). Implied by `workspace`. */
|
|
5003
|
+
tier?: 'job';
|
|
5004
|
+
workspace?: WorkflowStepWorkspace;
|
|
5005
|
+
jobResources?: 'small' | 'medium' | 'large';
|
|
5006
|
+
jobTools?: WorkflowJobToolId[];
|
|
5007
|
+
/** default { maxAttempts: 1 } */
|
|
5008
|
+
retry?: RetryPolicy;
|
|
5009
|
+
/** default 'none'; 'external' ⇒ park on platform-fault reclaim. */
|
|
5010
|
+
sideEffects?: 'none' | 'external';
|
|
5011
|
+
/** What the FINAL failure of this step does to the run (default 'fail'). */
|
|
5012
|
+
onError?: 'fail' | 'continue' | 'park';
|
|
5013
|
+
requiredConnections?: string[];
|
|
5014
|
+
/** Deadline for a `ctx.suspend()` suspension; default 168, max 720. */
|
|
5015
|
+
resumeTimeoutHours?: number;
|
|
5016
|
+
businessHours?: WorkflowBusinessHours;
|
|
5017
|
+
onSuspendTimeout?: 'fail' | 'cancel-run';
|
|
5018
|
+
}
|
|
5019
|
+
|
|
5020
|
+
export { MapDescriptor }
|
|
5021
|
+
|
|
4624
5022
|
/**
|
|
4625
5023
|
* Base configuration for all MCP servers.
|
|
4626
5024
|
*/
|
|
@@ -4732,6 +5130,16 @@ export declare type MCPTransport = 'sse' | 'streamable-http';
|
|
|
4732
5130
|
|
|
4733
5131
|
declare type Message = TextMessage_2 | ImageMessage_2 | FileMessage_2;
|
|
4734
5132
|
|
|
5133
|
+
export declare const ne: <T>(l: TypedRef<T>, r: TypedRef<T> | Literal<T>) => LuaPredicate;
|
|
5134
|
+
|
|
5135
|
+
export declare const not: (arg: LuaPredicate) => LuaPredicate;
|
|
5136
|
+
|
|
5137
|
+
export declare const notExists: (ref: TypedRef<unknown>) => LuaPredicate;
|
|
5138
|
+
|
|
5139
|
+
export declare const notIn: <T extends string | number | boolean | null>(v: TypedRef<T>, set: T[]) => LuaPredicate;
|
|
5140
|
+
|
|
5141
|
+
export declare const or: (...args: LuaPredicate[]) => LuaPredicate;
|
|
5142
|
+
|
|
4735
5143
|
/**
|
|
4736
5144
|
* Order API contract.
|
|
4737
5145
|
* Defines operations for managing orders.
|
|
@@ -4984,6 +5392,11 @@ declare interface Pagination {
|
|
|
4984
5392
|
prevPage: number | null;
|
|
4985
5393
|
}
|
|
4986
5394
|
|
|
5395
|
+
export { PathOrLiteral }
|
|
5396
|
+
|
|
5397
|
+
/** P split on '.' walked into T; `unknown` past depth 4 or through an index. */
|
|
5398
|
+
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;
|
|
5399
|
+
|
|
4987
5400
|
/**
|
|
4988
5401
|
* Polymorphic shape used by `LuaAgent.persona`. String form is the legacy
|
|
4989
5402
|
* single-channel persona; object form lets the customer split prose per
|
|
@@ -5593,6 +6006,8 @@ declare const REASONING_EFFORT_VALUES: readonly ["off", "minimal", "low", "mediu
|
|
|
5593
6006
|
|
|
5594
6007
|
declare type ReasoningEffort = (typeof REASONING_EFFORT_VALUES)[number];
|
|
5595
6008
|
|
|
6009
|
+
export declare type ReplyChannel = 'whatsapp' | 'sms' | 'email' | 'webchat' | 'slack';
|
|
6010
|
+
|
|
5596
6011
|
declare interface RequestCredential {
|
|
5597
6012
|
readonly descriptor: RequestCredentialDescriptor;
|
|
5598
6013
|
bearer(): Promise<string>;
|
|
@@ -5609,6 +6024,47 @@ declare type RequestCredentialDescriptor = {
|
|
|
5609
6024
|
|
|
5610
6025
|
declare type RequestCredentialInput = string | RequestCredential;
|
|
5611
6026
|
|
|
6027
|
+
/**
|
|
6028
|
+
* Optional per-request overrides (WF-202, 03 §3.7 client-deadline rule). Today only
|
|
6029
|
+
* `timeoutMs`: `WorkflowApi.startRun` long-polls with `waitSeconds ≤ 55` and raises
|
|
6030
|
+
* its deadline to `(waitSeconds + 10) s` so the 30 s default abort never races the
|
|
6031
|
+
* server. Every other call site is untouched (undefined ⇒ the 30 s default).
|
|
6032
|
+
*/
|
|
6033
|
+
declare interface RequestOverrides {
|
|
6034
|
+
timeoutMs?: number;
|
|
6035
|
+
}
|
|
6036
|
+
|
|
6037
|
+
declare type ResumeStepResult = {
|
|
6038
|
+
resumed: true;
|
|
6039
|
+
runStatus: WorkflowRunStatus;
|
|
6040
|
+
} | {
|
|
6041
|
+
resumed: false;
|
|
6042
|
+
reason: 'already_resumed';
|
|
6043
|
+
recorded: {
|
|
6044
|
+
at: number;
|
|
6045
|
+
by?: {
|
|
6046
|
+
kind: string;
|
|
6047
|
+
id?: string;
|
|
6048
|
+
};
|
|
6049
|
+
};
|
|
6050
|
+
runStatus: WorkflowRunStatus;
|
|
6051
|
+
};
|
|
6052
|
+
|
|
6053
|
+
export declare interface RetryPolicy {
|
|
6054
|
+
maxAttempts: number;
|
|
6055
|
+
/** delay before attempt 2 (default 0 = immediate) */
|
|
6056
|
+
backoffSeconds?: number;
|
|
6057
|
+
/** 'fixed' (default) | 'exponential' — an engine timer, never a sleep inside the step VM (P1-10). */
|
|
6058
|
+
backoff?: 'fixed' | 'exponential';
|
|
6059
|
+
/** default 3600; only meaningful with 'exponential' (`backoff-invalid` otherwise). */
|
|
6060
|
+
maxBackoffSeconds?: number;
|
|
6061
|
+
}
|
|
6062
|
+
|
|
6063
|
+
export declare const rows: (s: LuaWorkflowStep<any, any, any> | string, path: string, page: {
|
|
6064
|
+
offset: number;
|
|
6065
|
+
limit: number;
|
|
6066
|
+
}) => MapDescriptor;
|
|
6067
|
+
|
|
5612
6068
|
/**
|
|
5613
6069
|
* Additive field on primitive publish responses. When the agent is under
|
|
5614
6070
|
* versioning the server performs a scoped promote and returns the newly
|
|
@@ -5660,6 +6116,18 @@ export declare interface SendTemplateValues {
|
|
|
5660
6116
|
buttons?: SendTemplateButtonValue[];
|
|
5661
6117
|
}
|
|
5662
6118
|
|
|
6119
|
+
export { SerializedWorkflowGraph }
|
|
6120
|
+
|
|
6121
|
+
/** R14 — 202 `{ accepted:true, signalId, consumed, stepId? }` · 200 `{ accepted:true, duplicate:true }` · 202 `{ accepted:false, reason }`. */
|
|
6122
|
+
declare interface SignalRunResult {
|
|
6123
|
+
accepted: boolean;
|
|
6124
|
+
signalId?: string;
|
|
6125
|
+
consumed?: boolean;
|
|
6126
|
+
stepId?: string;
|
|
6127
|
+
duplicate?: boolean;
|
|
6128
|
+
reason?: string;
|
|
6129
|
+
}
|
|
6130
|
+
|
|
5663
6131
|
/**
|
|
5664
6132
|
* Same shape as `PersonaText`, exported separately because skill `context`
|
|
5665
6133
|
* and agent `persona` play different semantic roles. Sharing the structural
|
|
@@ -5671,6 +6139,77 @@ declare type SkillContextText = string | {
|
|
|
5671
6139
|
text?: string;
|
|
5672
6140
|
};
|
|
5673
6141
|
|
|
6142
|
+
export declare interface SpecialistStepOptions {
|
|
6143
|
+
role: WorkflowSpecialistRole | {
|
|
6144
|
+
ref: string;
|
|
6145
|
+
};
|
|
6146
|
+
prompt: TemplateLike;
|
|
6147
|
+
outputSchema?: ZodType;
|
|
6148
|
+
model?: string;
|
|
6149
|
+
toolScope?: AgentToolScope;
|
|
6150
|
+
timeoutSeconds?: number;
|
|
6151
|
+
retry?: RetryPolicy;
|
|
6152
|
+
onError?: 'fail' | 'continue' | 'park';
|
|
6153
|
+
requiredConnections?: string[];
|
|
6154
|
+
}
|
|
6155
|
+
|
|
6156
|
+
/** One parsed SSE frame (`id:` / `event:` / `data:` — `data` JSON-parsed when it parses, else the raw string). */
|
|
6157
|
+
declare interface SseFrame {
|
|
6158
|
+
id?: string;
|
|
6159
|
+
event: string;
|
|
6160
|
+
data: unknown;
|
|
6161
|
+
}
|
|
6162
|
+
|
|
6163
|
+
/** R8 — 202 `{ runId, status:'queued'|'gated', watchHint, idempotentReplay? }`, or 200 the run detail when `waitSeconds` elapsed on a terminal/suspended run. */
|
|
6164
|
+
declare interface StartWorkflowRunResult {
|
|
6165
|
+
runId: string;
|
|
6166
|
+
status: WorkflowRunStatus;
|
|
6167
|
+
watchHint?: string;
|
|
6168
|
+
idempotentReplay?: boolean;
|
|
6169
|
+
output?: unknown;
|
|
6170
|
+
}
|
|
6171
|
+
|
|
6172
|
+
export declare const state: <T = unknown>(path: string) => TypedRef<T>;
|
|
6173
|
+
|
|
6174
|
+
/** `step(x).path('confidence')` is `TypedRef<number>` when `x.outputSchema` says so; a string id yields `TypedRef<unknown>`. */
|
|
6175
|
+
export declare function step<TOut extends ZodType>(s: LuaWorkflowStep<any, TOut, any>): StepPathRef<z.infer<TOut>>;
|
|
6176
|
+
|
|
6177
|
+
export declare function step(id: string): {
|
|
6178
|
+
path(p: string): TypedRef<unknown>;
|
|
6179
|
+
};
|
|
6180
|
+
|
|
6181
|
+
/** Typed string ref for `agentStep`/`toolStep` ids: `stepOf<typeof angle>('techAngle').path('confidence')`. */
|
|
6182
|
+
export declare function stepOf<TOut extends ZodType>(id: string): StepPathRef<z.infer<TOut>>;
|
|
6183
|
+
|
|
6184
|
+
export declare interface StepPathRef<TOut> {
|
|
6185
|
+
path<P extends DotPath<TOut>>(p: P): TypedRef<PathValue<TOut, P>>;
|
|
6186
|
+
}
|
|
6187
|
+
|
|
6188
|
+
/** 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). */
|
|
6189
|
+
export declare type StepRef = LuaWorkflowStep<any, any, any> | string;
|
|
6190
|
+
|
|
6191
|
+
/**
|
|
6192
|
+
* Why an unattended run could not finish, reported by the agent itself instead
|
|
6193
|
+
* of being guessed from its prose. The platform — not the agent — writes every
|
|
6194
|
+
* user-facing string from this; `whatWouldUnblock` and `detail` are agent text
|
|
6195
|
+
* and never reach a headline, preview, push body or email subject.
|
|
6196
|
+
*/
|
|
6197
|
+
declare const TASK_RUN_BLOCKER_KINDS: readonly ["missing_connection", "resource_not_found", "needs_input", "permission_denied", "other"];
|
|
6198
|
+
|
|
6199
|
+
declare interface TaskRunBlocker {
|
|
6200
|
+
kind: TaskRunBlockerKind;
|
|
6201
|
+
/** Catalog slug when known ('googlemail', 'asana'). Never a guess. */
|
|
6202
|
+
integrationType?: string;
|
|
6203
|
+
/** What it was reaching for, in the user's words ('the agent-all-west repo'). */
|
|
6204
|
+
resourceLabel?: string;
|
|
6205
|
+
/** One sentence, the agent's own: what would make this run work next time. */
|
|
6206
|
+
whatWouldUnblock: string;
|
|
6207
|
+
/** Longer technical account. Expandable detail only — never a headline. */
|
|
6208
|
+
detail?: string;
|
|
6209
|
+
}
|
|
6210
|
+
|
|
6211
|
+
declare type TaskRunBlockerKind = (typeof TASK_RUN_BLOCKER_KINDS)[number];
|
|
6212
|
+
|
|
5674
6213
|
export declare const Team: TeamApi;
|
|
5675
6214
|
|
|
5676
6215
|
/**
|
|
@@ -5698,6 +6237,14 @@ export declare interface TeamApi {
|
|
|
5698
6237
|
findMember(name: string): Promise<DirectoryResolveResult>;
|
|
5699
6238
|
}
|
|
5700
6239
|
|
|
6240
|
+
/** placeholders: ${initData.*} ${stepResults.<id>.*} ${state.*} */
|
|
6241
|
+
export declare const template: (s: string) => TemplateBinding;
|
|
6242
|
+
|
|
6243
|
+
export { TemplateBinding }
|
|
6244
|
+
|
|
6245
|
+
/** A prompt / literal slot: a string, a `template(...)` binding, or an `env.template(KEY)` placeholder (B33). */
|
|
6246
|
+
export declare type TemplateLike = string | TemplateBinding | EnvRefBinding;
|
|
6247
|
+
|
|
5701
6248
|
/**
|
|
5702
6249
|
* Templates API
|
|
5703
6250
|
*
|
|
@@ -5853,15 +6400,15 @@ export declare enum ToolFlag {
|
|
|
5853
6400
|
DISALLOW_INTERRUPTION = "disallow_interruption"
|
|
5854
6401
|
}
|
|
5855
6402
|
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
6403
|
+
export declare interface ToolStepOptions {
|
|
6404
|
+
input?: LuaMapConfig;
|
|
6405
|
+
timeoutSeconds?: number;
|
|
6406
|
+
retry?: RetryPolicy;
|
|
6407
|
+
sideEffects?: 'none' | 'external';
|
|
6408
|
+
onError?: 'fail' | 'continue' | 'park';
|
|
6409
|
+
requiredConnections?: string[];
|
|
6410
|
+
}
|
|
6411
|
+
|
|
5865
6412
|
export declare interface TriggerContext<T = any> {
|
|
5866
6413
|
/** Parsed request body (typed by `inputSchema` when provided). */
|
|
5867
6414
|
body: T;
|
|
@@ -5877,6 +6424,39 @@ export declare interface TriggerContext<T = any> {
|
|
|
5877
6424
|
source: string;
|
|
5878
6425
|
}
|
|
5879
6426
|
|
|
6427
|
+
/**
|
|
6428
|
+
* Context delivered to a trigger's verify / filter / transform slots.
|
|
6429
|
+
*
|
|
6430
|
+
* Unlike a webhook event, `rawBody` carries the EXACT unparsed request bytes
|
|
6431
|
+
* (utf8) — HMAC signature schemes (Stripe `t=…,v1=…`, GitHub `sha256=…`, Slack
|
|
6432
|
+
* `v0:…`) are computed over the wire bytes, which `JSON.stringify(body)` does
|
|
6433
|
+
* not reproduce. `headers` keys arrive lowercased (Express), e.g.
|
|
6434
|
+
* `ctx.headers['x-hub-signature-256']`.
|
|
6435
|
+
*/
|
|
6436
|
+
/**
|
|
6437
|
+
* `transform` may start a workflow run instead of a chat turn (03 §3.7 / 07 — WF-205):
|
|
6438
|
+
* `{ startWorkflow: { name, input?, idempotencyKey?, correlationKey?, tags? } }`.
|
|
6439
|
+
* `name` is the agent-local workflow name; `correlationKey` accepts a literal or a
|
|
6440
|
+
* `'${input.<field>}'` template the trigger fills.
|
|
6441
|
+
*/
|
|
6442
|
+
declare interface TriggerStartWorkflow {
|
|
6443
|
+
startWorkflow: {
|
|
6444
|
+
name: string;
|
|
6445
|
+
input?: unknown;
|
|
6446
|
+
idempotencyKey?: string;
|
|
6447
|
+
correlationKey?: string;
|
|
6448
|
+
tags?: string[];
|
|
6449
|
+
replyTo?: {
|
|
6450
|
+
channel: string;
|
|
6451
|
+
threadId: string;
|
|
6452
|
+
};
|
|
6453
|
+
};
|
|
6454
|
+
}
|
|
6455
|
+
|
|
6456
|
+
export declare const truthy: (ref: TypedRef<unknown>) => LuaPredicate;
|
|
6457
|
+
|
|
6458
|
+
export { TypedRef }
|
|
6459
|
+
|
|
5880
6460
|
/**
|
|
5881
6461
|
* Response from updating custom data entry.
|
|
5882
6462
|
*/
|
|
@@ -6096,6 +6676,8 @@ export declare interface UserLookupOptions {
|
|
|
6096
6676
|
phone?: string;
|
|
6097
6677
|
}
|
|
6098
6678
|
|
|
6679
|
+
export declare const value: (v: unknown) => MapDescriptor;
|
|
6680
|
+
|
|
6099
6681
|
export declare const Voice: VoiceApi;
|
|
6100
6682
|
|
|
6101
6683
|
/**
|
|
@@ -6274,6 +6856,17 @@ declare interface VoiceSessionOutput {
|
|
|
6274
6856
|
agentName: string;
|
|
6275
6857
|
}
|
|
6276
6858
|
|
|
6859
|
+
export declare interface WaitForSignalOptions {
|
|
6860
|
+
signal: string;
|
|
6861
|
+
schema?: ZodType;
|
|
6862
|
+
timeoutHours?: number | TemplateBinding;
|
|
6863
|
+
/** default 'fail'; 'continue' ⇒ output {received:false,timedOut:true} */
|
|
6864
|
+
onTimeout?: 'fail' | 'continue';
|
|
6865
|
+
businessHours?: WorkflowBusinessHours;
|
|
6866
|
+
/** default ['webhook','api','user'] */
|
|
6867
|
+
acceptedSources?: Array<'webhook' | 'api' | 'user' | 'agent'>;
|
|
6868
|
+
}
|
|
6869
|
+
|
|
6277
6870
|
/**
|
|
6278
6871
|
* Webhook request information from channel integrations.
|
|
6279
6872
|
* Contains the raw webhook payload from the channel provider.
|
|
@@ -6397,4 +6990,390 @@ declare interface WhatsAppTemplateUrlButton {
|
|
|
6397
6990
|
example?: string | string[];
|
|
6398
6991
|
}
|
|
6399
6992
|
|
|
6993
|
+
export declare type WorkflowApproverSpec = 'creator' | 'org-admins' | {
|
|
6994
|
+
users: string[] | TemplateBinding;
|
|
6995
|
+
} | {
|
|
6996
|
+
role: string | TemplateBinding | MapDescriptor;
|
|
6997
|
+
} | {
|
|
6998
|
+
group: string | TemplateBinding;
|
|
6999
|
+
} | {
|
|
7000
|
+
governance: {
|
|
7001
|
+
policyId: string;
|
|
7002
|
+
};
|
|
7003
|
+
};
|
|
7004
|
+
|
|
7005
|
+
export declare interface WorkflowArtefactMeta {
|
|
7006
|
+
artefactId: string;
|
|
7007
|
+
name: string;
|
|
7008
|
+
contentType: string;
|
|
7009
|
+
bytes: number;
|
|
7010
|
+
kind: 'file' | 'dataset' | 'image' | 'document';
|
|
7011
|
+
datasetSchema?: JsonSchema;
|
|
7012
|
+
rowCount?: number;
|
|
7013
|
+
producer: {
|
|
7014
|
+
stepId: string;
|
|
7015
|
+
attempt: number;
|
|
7016
|
+
source: 'turn' | 'ctx' | 'input';
|
|
7017
|
+
};
|
|
7018
|
+
previewCdnRef?: string;
|
|
7019
|
+
title?: string;
|
|
7020
|
+
source?: {
|
|
7021
|
+
kind: 'step' | 'input' | 'url' | 'connection' | 'upload';
|
|
7022
|
+
ref?: string;
|
|
7023
|
+
};
|
|
7024
|
+
}
|
|
7025
|
+
|
|
7026
|
+
export declare interface WorkflowBusinessHours {
|
|
7027
|
+
tz: string;
|
|
7028
|
+
calendar?: 'mon-fri' | {
|
|
7029
|
+
days: number[];
|
|
7030
|
+
start: string;
|
|
7031
|
+
end: string;
|
|
7032
|
+
holidays?: string[];
|
|
7033
|
+
};
|
|
7034
|
+
}
|
|
7035
|
+
|
|
7036
|
+
export declare interface WorkflowFourEyes {
|
|
7037
|
+
edit: WorkflowApproverSpec;
|
|
7038
|
+
approve: WorkflowApproverSpec;
|
|
7039
|
+
}
|
|
7040
|
+
|
|
7041
|
+
export declare interface WorkflowGoalEnvelope {
|
|
7042
|
+
objective: string;
|
|
7043
|
+
judge: {
|
|
7044
|
+
agentId: string | '$self';
|
|
7045
|
+
role?: WorkflowSpecialistRole;
|
|
7046
|
+
schema: ZodType;
|
|
7047
|
+
};
|
|
7048
|
+
cadence: JobSchedule[];
|
|
7049
|
+
maxRuns: number;
|
|
7050
|
+
budget?: LuaWorkflowConfig['budget'];
|
|
7051
|
+
maxTotalCredits?: number;
|
|
7052
|
+
initialState?: Record<string, unknown>;
|
|
7053
|
+
}
|
|
7054
|
+
|
|
7055
|
+
export declare type WorkflowJobHarness = 'claude-code' | 'generic';
|
|
7056
|
+
|
|
7057
|
+
export declare type WorkflowJobToolId = 'shell' | 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'git' | 'gh' | 'fetch';
|
|
7058
|
+
|
|
7059
|
+
export declare interface WorkflowMergePolicy {
|
|
7060
|
+
strategy: 'rebase' | 'merge';
|
|
7061
|
+
onConflict: 'fail' | 'agent';
|
|
7062
|
+
}
|
|
7063
|
+
|
|
7064
|
+
export declare interface WorkflowOutputVisibility {
|
|
7065
|
+
roles: string[];
|
|
7066
|
+
users?: string[];
|
|
7067
|
+
ownerBypass?: boolean;
|
|
7068
|
+
}
|
|
7069
|
+
|
|
7070
|
+
/** Matches WorkflowRunDto (R4 `fields:'summary'` — outputs are never inlined here). */
|
|
7071
|
+
declare interface WorkflowRun {
|
|
7072
|
+
id: string;
|
|
7073
|
+
workflowId: string;
|
|
7074
|
+
workflowVersionId: string;
|
|
7075
|
+
agentId: string;
|
|
7076
|
+
orgId: string;
|
|
7077
|
+
status: WorkflowRunStatus;
|
|
7078
|
+
trigger: 'chat' | 'sdk' | 'api' | 'schedule' | 'webhook' | 'template' | 'workflow' | 'device';
|
|
7079
|
+
graphHash: string;
|
|
7080
|
+
lineageId?: string;
|
|
7081
|
+
parentRunId?: string;
|
|
7082
|
+
correlationKey?: string;
|
|
7083
|
+
tags?: string[];
|
|
7084
|
+
gate?: {
|
|
7085
|
+
kind: string;
|
|
7086
|
+
reason?: string;
|
|
7087
|
+
since?: string;
|
|
7088
|
+
};
|
|
7089
|
+
failureReason?: string;
|
|
7090
|
+
restricted?: boolean;
|
|
7091
|
+
output?: unknown;
|
|
7092
|
+
createdAt: string;
|
|
7093
|
+
startedAt?: string;
|
|
7094
|
+
completedAt?: string;
|
|
7095
|
+
updatedAt: string;
|
|
7096
|
+
}
|
|
7097
|
+
|
|
7098
|
+
/** §02 §2.4 run statuses (one union across every section). */
|
|
7099
|
+
declare type WorkflowRunStatus = 'queued' | 'running' | 'cancellation_requested' | 'gated' | 'suspended' | 'waiting' | 'completed' | 'failed' | 'cancelled' | 'abandoned' | 'timed_out';
|
|
7100
|
+
|
|
7101
|
+
export declare type WorkflowRunTrigger = 'chat' | 'sdk' | 'api' | 'schedule' | 'webhook' | 'template' | 'workflow' | 'device';
|
|
7102
|
+
|
|
7103
|
+
/**
|
|
7104
|
+
* @example
|
|
7105
|
+
* ```typescript
|
|
7106
|
+
* const { runId, status } = await Workflows.start('outreach', { leads }, { idempotencyKey: `outreach:${batchId}` });
|
|
7107
|
+
* const run = await Workflows.get(runId);
|
|
7108
|
+
* await Workflows.signal(runId, 'review', { approved: true });
|
|
7109
|
+
* ```
|
|
7110
|
+
*/
|
|
7111
|
+
export declare const Workflows: WorkflowsApi;
|
|
7112
|
+
|
|
7113
|
+
/**
|
|
7114
|
+
* Workflows API — start, inspect and steer workflow runs from tools, jobs, webhooks,
|
|
7115
|
+
* triggers, other workflows' code steps and scripts.
|
|
7116
|
+
*
|
|
7117
|
+
* - `start` is ALWAYS fire-and-return: it never awaits execution. `waitSeconds` (≤ 55) is
|
|
7118
|
+
* a server long-poll that returns early terminal state when the run finishes inside the
|
|
7119
|
+
* window — it changes the response, never the execution model. From a code step,
|
|
7120
|
+
* `start` creates a DETACHED run; use the `workflow()` node to wait on a nested run.
|
|
7121
|
+
* - A `concurrencyPolicy:'forbid'` workflow with a run in flight throws
|
|
7122
|
+
* `WorkflowApiError{ code:'RUNS_IN_FLIGHT', blockingRunId }` — never a 429, never a gate.
|
|
7123
|
+
* - `status:'gated'` from `start` means the run holds no org slot (quota/billing/consent).
|
|
7124
|
+
* - `nameOrId` resolves the agent-local `workflow.name` first, then a workflow id.
|
|
7125
|
+
* - `get`/`list` honour output ACLs: a restricted run comes back with `restricted:true`
|
|
7126
|
+
* and no `output` — never an error.
|
|
7127
|
+
*
|
|
7128
|
+
* `startBatch`, `signalByKey`, `raiseBudget`, `setGoal` and `goals.*` are part of the
|
|
7129
|
+
* frozen member list and throw `WORKFLOWS_API_UNAVAILABLE` until their routes ship.
|
|
7130
|
+
*/
|
|
7131
|
+
export declare interface WorkflowsApi {
|
|
7132
|
+
start(nameOrId: string, input?: unknown, opts?: {
|
|
7133
|
+
idempotencyKey?: string;
|
|
7134
|
+
budget?: {
|
|
7135
|
+
maxCredits?: number;
|
|
7136
|
+
maxSteps?: number;
|
|
7137
|
+
maxDurationSeconds?: number;
|
|
7138
|
+
};
|
|
7139
|
+
waitSeconds?: number;
|
|
7140
|
+
initialState?: Record<string, unknown>;
|
|
7141
|
+
correlationKey?: string;
|
|
7142
|
+
tags?: string[];
|
|
7143
|
+
replyTo?: {
|
|
7144
|
+
channel: string;
|
|
7145
|
+
threadId: string;
|
|
7146
|
+
};
|
|
7147
|
+
onBehalfOf?: {
|
|
7148
|
+
userId: string;
|
|
7149
|
+
};
|
|
7150
|
+
workflowVersionId?: string;
|
|
7151
|
+
}): Promise<StartWorkflowRunResult>;
|
|
7152
|
+
get(runId: string): Promise<WorkflowRun>;
|
|
7153
|
+
list(opts?: {
|
|
7154
|
+
limit?: number;
|
|
7155
|
+
status?: WorkflowRunStatus | string;
|
|
7156
|
+
workflow?: string;
|
|
7157
|
+
correlationKey?: string;
|
|
7158
|
+
tags?: string[];
|
|
7159
|
+
sort?: string;
|
|
7160
|
+
}): Promise<WorkflowRun[]>;
|
|
7161
|
+
cancel(runId: string, opts?: {
|
|
7162
|
+
mode?: 'request' | 'force';
|
|
7163
|
+
reason?: string;
|
|
7164
|
+
}): Promise<CancelRunVerdict>;
|
|
7165
|
+
resume(runId: string, stepId: string, resumeData: unknown): Promise<ResumeStepResult>;
|
|
7166
|
+
signal(runId: string, name: string, payload?: unknown, opts?: {
|
|
7167
|
+
dedupeKey?: string;
|
|
7168
|
+
}): Promise<SignalRunResult>;
|
|
7169
|
+
signalByKey(nameOrId: string, correlationKey: string, name: string, payload?: unknown, opts?: {
|
|
7170
|
+
dedupeKey?: string;
|
|
7171
|
+
allowMultiple?: boolean;
|
|
7172
|
+
}): Promise<{
|
|
7173
|
+
runIds: string[];
|
|
7174
|
+
delivered: number;
|
|
7175
|
+
}>;
|
|
7176
|
+
startBatch(nameOrId: string, items: Array<{
|
|
7177
|
+
input: unknown;
|
|
7178
|
+
idempotencyKey: string;
|
|
7179
|
+
budget?: {
|
|
7180
|
+
maxCredits?: number;
|
|
7181
|
+
maxSteps?: number;
|
|
7182
|
+
maxDurationSeconds?: number;
|
|
7183
|
+
};
|
|
7184
|
+
tags?: string[];
|
|
7185
|
+
correlationKey?: string;
|
|
7186
|
+
initialState?: Record<string, unknown>;
|
|
7187
|
+
}>, opts?: {
|
|
7188
|
+
mode?: 'reject' | 'gate';
|
|
7189
|
+
budget?: {
|
|
7190
|
+
maxCredits?: number;
|
|
7191
|
+
maxSteps?: number;
|
|
7192
|
+
maxDurationSeconds?: number;
|
|
7193
|
+
};
|
|
7194
|
+
}): Promise<{
|
|
7195
|
+
batchId: string;
|
|
7196
|
+
accepted: number;
|
|
7197
|
+
items: Array<{
|
|
7198
|
+
idempotencyKey: string;
|
|
7199
|
+
runId?: string;
|
|
7200
|
+
status: 'queued' | 'gated' | 'replayed' | 'rejected';
|
|
7201
|
+
code?: string;
|
|
7202
|
+
}>;
|
|
7203
|
+
}>;
|
|
7204
|
+
raiseBudget(runId: string, patch: {
|
|
7205
|
+
maxCredits?: number;
|
|
7206
|
+
maxSteps?: number;
|
|
7207
|
+
maxJobSeconds?: number;
|
|
7208
|
+
maxDurationSeconds?: number;
|
|
7209
|
+
note?: string;
|
|
7210
|
+
}): Promise<{
|
|
7211
|
+
raised: true;
|
|
7212
|
+
budget: Record<string, number>;
|
|
7213
|
+
runStatus: WorkflowRunStatus;
|
|
7214
|
+
resumed: boolean;
|
|
7215
|
+
} | {
|
|
7216
|
+
raised: false;
|
|
7217
|
+
reason: 'already_raised';
|
|
7218
|
+
}>;
|
|
7219
|
+
setGoal(agentId: string, goal: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
7220
|
+
goals: {
|
|
7221
|
+
list(agentId: string, opts?: {
|
|
7222
|
+
status?: 'active' | 'paused' | 'done' | 'closed';
|
|
7223
|
+
workflowId?: string;
|
|
7224
|
+
}): Promise<Record<string, unknown>[]>;
|
|
7225
|
+
get(agentId: string, goalId: string): Promise<Record<string, unknown>>;
|
|
7226
|
+
pause(agentId: string, goalId: string): Promise<Record<string, unknown>>;
|
|
7227
|
+
resume(agentId: string, goalId: string): Promise<Record<string, unknown>>;
|
|
7228
|
+
close(agentId: string, goalId: string, opts?: {
|
|
7229
|
+
note?: string;
|
|
7230
|
+
}): Promise<Record<string, unknown>>;
|
|
7231
|
+
};
|
|
7232
|
+
}
|
|
7233
|
+
|
|
7234
|
+
export declare interface WorkflowSpecialistRole {
|
|
7235
|
+
name: string;
|
|
7236
|
+
instructions: string;
|
|
7237
|
+
tools: string[];
|
|
7238
|
+
}
|
|
7239
|
+
|
|
7240
|
+
export declare interface WorkflowStepContext<TIn = unknown, TResume = unknown, TState = Record<string, unknown>> {
|
|
7241
|
+
runId: string;
|
|
7242
|
+
workflowId: string;
|
|
7243
|
+
workflowVersionId: string;
|
|
7244
|
+
stepId: string;
|
|
7245
|
+
attempt: number;
|
|
7246
|
+
/** `${lineageId}:${stepId}` — stable across retries, resumes, `retry-step` AND repair runs. THE key for side-effect dedup. */
|
|
7247
|
+
occurrenceId: string;
|
|
7248
|
+
/** The run's recovery lineage: the first run's id in a repair chain; `=== runId` for a non-repair run. */
|
|
7249
|
+
lineageId: string;
|
|
7250
|
+
/** Resolved bindings snapshot (mapping descriptors applied by the advancer). Plain JSON. */
|
|
7251
|
+
inputData: TIn;
|
|
7252
|
+
/** Present only when re-invoked after resume. `execute` RE-RUNS FROM THE TOP (Mastra semantics). */
|
|
7253
|
+
resumeData?: TResume;
|
|
7254
|
+
/** What the prior invocation passed to `suspend()`. */
|
|
7255
|
+
suspendData?: unknown;
|
|
7256
|
+
getInitData<T = unknown>(): T;
|
|
7257
|
+
/** Output of an UPSTREAM step. Throws `WorkflowStepResultError{ code:'STEP_RESULT_NOT_ANCESTOR' }` for a non-ancestor. */
|
|
7258
|
+
getStepResult<T = unknown>(stepId: string): T;
|
|
7259
|
+
/** Run-scoped KV, ledger-backed, ≤ 64KB total. `set` is durable when the step terminalizes. */
|
|
7260
|
+
state: {
|
|
7261
|
+
get<K extends keyof TState>(k: K): TState[K] | undefined;
|
|
7262
|
+
set<K extends keyof TState>(k: K, v: TState[K]): Promise<void>;
|
|
7263
|
+
};
|
|
7264
|
+
/** Terminal for this invocation → step `suspended` kind:'input'. Never returns. */
|
|
7265
|
+
suspend(payload: unknown): Promise<never>;
|
|
7266
|
+
/** Early successful exit with `result` as the step output. Never returns. */
|
|
7267
|
+
bail<T>(result: T): never;
|
|
7268
|
+
/** Early successful exit for the WHOLE RUN (Cluster G, B8). Never returns. */
|
|
7269
|
+
bailRun<T>(output: T): never;
|
|
7270
|
+
/** → `step.progress` event (≤ 1000 per attempt; 1KB each). */
|
|
7271
|
+
log(message: string): void;
|
|
7272
|
+
/** Aborts on run cancel and on the sandbox wall. */
|
|
7273
|
+
signal: AbortSignal;
|
|
7274
|
+
/** Sub-agent env, exactly as jobs receive it. */
|
|
7275
|
+
env: Record<string, string>;
|
|
7276
|
+
/** EXACTLY-ONCE effect keyed on `{occurrenceId, key}` (P1-18). Claim → run `fn` → settle. */
|
|
7277
|
+
once<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
7278
|
+
/** Job-tier steps only: the mounted run workspace. */
|
|
7279
|
+
workspace?: {
|
|
7280
|
+
path: string;
|
|
7281
|
+
mount: 'rw' | 'ro';
|
|
7282
|
+
branch?: string;
|
|
7283
|
+
baseSha?: string;
|
|
7284
|
+
arm?: string;
|
|
7285
|
+
backend?: WorkflowWorkspaceBackend;
|
|
7286
|
+
};
|
|
7287
|
+
/** The run artefact store (P1-8). */
|
|
7288
|
+
artefacts: {
|
|
7289
|
+
put(name: string, data: Uint8Array | string | ReadableStream, opts: {
|
|
7290
|
+
contentType: string;
|
|
7291
|
+
kind?: 'file' | 'dataset' | 'image' | 'document';
|
|
7292
|
+
datasetSchema?: JsonSchema;
|
|
7293
|
+
title?: string;
|
|
7294
|
+
source?: {
|
|
7295
|
+
kind: 'step' | 'input' | 'url' | 'connection' | 'upload';
|
|
7296
|
+
ref?: string;
|
|
7297
|
+
};
|
|
7298
|
+
}): Promise<{
|
|
7299
|
+
artefactId: string;
|
|
7300
|
+
}>;
|
|
7301
|
+
get(artefactId: string): Promise<{
|
|
7302
|
+
url: string;
|
|
7303
|
+
meta: WorkflowArtefactMeta;
|
|
7304
|
+
stream(opts?: {
|
|
7305
|
+
range?: {
|
|
7306
|
+
start: number;
|
|
7307
|
+
end?: number;
|
|
7308
|
+
};
|
|
7309
|
+
}): Promise<ReadableStream>;
|
|
7310
|
+
rows(page: {
|
|
7311
|
+
offset: number;
|
|
7312
|
+
limit: number;
|
|
7313
|
+
}): Promise<{
|
|
7314
|
+
rows: unknown[];
|
|
7315
|
+
rowCount: number;
|
|
7316
|
+
nextOffset?: number;
|
|
7317
|
+
}>;
|
|
7318
|
+
}>;
|
|
7319
|
+
list(): Promise<WorkflowArtefactMeta[]>;
|
|
7320
|
+
};
|
|
7321
|
+
/** Stamped by the executor for observability; read-only. */
|
|
7322
|
+
runtime: {
|
|
7323
|
+
trigger: WorkflowRunTrigger;
|
|
7324
|
+
parentRunId?: string;
|
|
7325
|
+
agentVersion?: number;
|
|
7326
|
+
traceparent?: string;
|
|
7327
|
+
correlationKey?: string;
|
|
7328
|
+
tags?: string[];
|
|
7329
|
+
principalKind: 'user' | 'service' | 'customer';
|
|
7330
|
+
replyTo?: {
|
|
7331
|
+
channel: ReplyChannel;
|
|
7332
|
+
threadId: string;
|
|
7333
|
+
};
|
|
7334
|
+
};
|
|
7335
|
+
}
|
|
7336
|
+
|
|
7337
|
+
/** Thrown by `ctx.getStepResult` for a non-ancestor / unknown id — never `undefined` (03 §3.1). */
|
|
7338
|
+
export declare interface WorkflowStepResultError extends Error {
|
|
7339
|
+
code: 'STEP_RESULT_NOT_ANCESTOR';
|
|
7340
|
+
stepId: string;
|
|
7341
|
+
}
|
|
7342
|
+
|
|
7343
|
+
export declare interface WorkflowStepWorkspace {
|
|
7344
|
+
mount: 'rw' | 'ro';
|
|
7345
|
+
isolation?: 'shared' | 'worktree';
|
|
7346
|
+
}
|
|
7347
|
+
|
|
7348
|
+
export declare interface WorkflowSuspendOnTimeout {
|
|
7349
|
+
timeoutHours: number | TemplateBinding;
|
|
7350
|
+
}
|
|
7351
|
+
|
|
7352
|
+
export declare type WorkflowSuspendTimeoutChain = WorkflowSuspendTimeoutChainMember | WorkflowSuspendTimeoutChainMember[];
|
|
7353
|
+
|
|
7354
|
+
export declare type WorkflowSuspendTimeoutChainMember = 'deny' | 'cancel-run' | 'fail' | 'continue' | {
|
|
7355
|
+
escalateTo: WorkflowApproverSpec;
|
|
7356
|
+
timeoutHours: number;
|
|
7357
|
+
};
|
|
7358
|
+
|
|
7359
|
+
export declare type WorkflowWorkspaceBackend = 'ebs' | 'efs' | 's3';
|
|
7360
|
+
|
|
7361
|
+
export declare type WorkspaceSpec = {
|
|
7362
|
+
kind: 'git';
|
|
7363
|
+
repo: string | TemplateBinding;
|
|
7364
|
+
ref?: string | TemplateBinding;
|
|
7365
|
+
credentialsRef?: string;
|
|
7366
|
+
sizeGb?: number;
|
|
7367
|
+
ttlHours?: number;
|
|
7368
|
+
verify?: string;
|
|
7369
|
+
keepArtefacts?: boolean;
|
|
7370
|
+
backend?: WorkflowWorkspaceBackend;
|
|
7371
|
+
} | {
|
|
7372
|
+
kind: 'empty';
|
|
7373
|
+
sizeGb?: number;
|
|
7374
|
+
ttlHours?: number;
|
|
7375
|
+
keepArtefacts?: boolean;
|
|
7376
|
+
backend?: WorkflowWorkspaceBackend;
|
|
7377
|
+
};
|
|
7378
|
+
|
|
6400
7379
|
export { }
|