lua-cli 3.32.5 → 3.33.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 +112 -18
- package/dist/api-exports.js +1160 -645
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +2275 -1291
- package/dist/index.js.map +1 -1
- package/dist/workflow-builder.d.ts +26 -8
- package/dist/workflow-builder.js +480 -260
- package/dist/workflow-builder.js.map +1 -1
- package/docs/CLI_REFERENCE.md +13 -11
- package/docs/README.md +2 -2
- package/docs/api/AI.md +9 -8
- package/docs/api/LuaAgent.md +5 -5
- package/docs/api/LuaWorkflow.md +16 -16
- package/docs/workflows/approvals.md +1 -1
- package/docs/workflows/artefacts-and-datasets.md +4 -0
- package/docs/workflows/workspaces-and-long-steps.md +2 -2
- package/package.json +5 -4
- package/template/examples/workflows/linear-ready.trigger.ts +20 -9
- package/template/package.json +1 -1
package/dist/api-exports.d.ts
CHANGED
|
@@ -582,6 +582,27 @@ declare interface ApiResponse<T = any> {
|
|
|
582
582
|
stepId?: string;
|
|
583
583
|
/** the live step status on 409 NOT_SUSPENDED (LUA-644) */
|
|
584
584
|
status?: string;
|
|
585
|
+
/** LUA-810 — 503 UPSTREAM_UNAVAILABLE: the internal Lua service behind the API that answered a fault or did
|
|
586
|
+
* not answer (`lua-agents`, `lua-core`, …), and the id on the server's matching error log line. */
|
|
587
|
+
upstream?: string;
|
|
588
|
+
requestId?: string;
|
|
589
|
+
/** LUA-812 — 503 VENDOR_UNAVAILABLE: the third-party vendor behind the API that failed (`unified` | `github` |
|
|
590
|
+
* `pusher` | `google`); `retryAfterSeconds` above is present only when a blind retry is safe. */
|
|
591
|
+
vendor?: string;
|
|
592
|
+
/** The vendor's own HTTP status when it answered (LUA-812); absent when nothing came back. */
|
|
593
|
+
vendorStatus?: number;
|
|
594
|
+
/** LUA-826 — on a 503 VENDOR_UNAVAILABLE from the GitHub token mint / the Unified.to passthrough: the code the
|
|
595
|
+
* site served before it moved to the shared one (`PROVIDER_ERROR` | `passthrough_upstream_error`) and its former
|
|
596
|
+
* line. One release, then gone — branch on `code`; these are for a script that still greps the old string. */
|
|
597
|
+
legacyCode?: string;
|
|
598
|
+
legacyMessage?: string;
|
|
599
|
+
/** LUA-820 — 424 PROVIDER_REJECTED: the model provider behind the agent refused the request (lua-core `provider-outcome.ts`):
|
|
600
|
+
* the provider's own status, the refusal reason (`invalid_api_key` | `forbidden` | `model_not_found` | `content_refused` |
|
|
601
|
+
* `quota_exhausted` | `bad_request`) and whose key it refused; `transient` is `false` — the mirror of a 503's `true`. */
|
|
602
|
+
providerStatus?: number;
|
|
603
|
+
reason?: string;
|
|
604
|
+
keyOwner?: 'platform' | 'byok';
|
|
605
|
+
transient?: boolean;
|
|
585
606
|
};
|
|
586
607
|
}
|
|
587
608
|
|
|
@@ -599,6 +620,11 @@ export declare interface ApprovalOptions {
|
|
|
599
620
|
/** default 'continue' (denial is data unless 'fail') */
|
|
600
621
|
onDeny?: WorkflowApprovalOnDeny;
|
|
601
622
|
businessHours?: WorkflowBusinessHours;
|
|
623
|
+
/**
|
|
624
|
+
* Optional — inferred `true` from a non-empty `editablePaths` (LUA-808 / LUA-825: the validator's `approvalEditable`
|
|
625
|
+
* rule, applied by the builder too); an explicit `false` beside paths is refused as contradictory. Absent with no
|
|
626
|
+
* paths ⇒ `false` (the approver decides, never edits).
|
|
627
|
+
*/
|
|
602
628
|
editable?: boolean;
|
|
603
629
|
/** grammar: `drafts`, `drafts[*]`, `drafts[*].body`, `drafts[3].body`, `summary.title` */
|
|
604
630
|
editablePaths?: string[];
|
|
@@ -2061,11 +2087,16 @@ declare type FileMessage_2 = {
|
|
|
2061
2087
|
};
|
|
2062
2088
|
|
|
2063
2089
|
export declare interface ForeachOptions {
|
|
2064
|
-
/**
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2090
|
+
/**
|
|
2091
|
+
* Cluster G (B34): PURE builder lowering — emits `{ type:'mapping', id:'<foreachId>_items', mapConfig:{'': items} }`
|
|
2092
|
+
* before the foreach entry. The lowering carries a typed path ref (`init('rows')` / `step(x).path('list')`), an
|
|
2093
|
+
* `initData` descriptor (`fromInit('rows')`; `path` optional = the whole input) or a single-step descriptor
|
|
2094
|
+
* (`fromStep(x, 'list')`). The slot admits the whole `MapDescriptor` union because that is what every descriptor
|
|
2095
|
+
* factory is declared to return (LUA-864) — the members the lowering does not carry (`value` / `template` /
|
|
2096
|
+
* `fromRequest` / `rows` / `fromKnowledge`, a fan-in `fromStep([…])`) are `invalid-envelope` at build:
|
|
2097
|
+
* `.map({ '': … }, { id })` before the foreach instead.
|
|
2098
|
+
*/
|
|
2099
|
+
items?: TypedRef<unknown[]> | MapDescriptor | {
|
|
2069
2100
|
initData: true;
|
|
2070
2101
|
path?: string;
|
|
2071
2102
|
};
|
|
@@ -2229,6 +2260,15 @@ declare abstract class HttpClient {
|
|
|
2229
2260
|
* @private
|
|
2230
2261
|
*/
|
|
2231
2262
|
private calculateBackoff;
|
|
2263
|
+
/**
|
|
2264
|
+
* The wait before the next attempt: the client's jittered exponential backoff, floored by the server's
|
|
2265
|
+
* `retryAfterSeconds` on a 429 (the limiter's word is final) and on an idempotent read (GET / HEAD). LUA-810: a
|
|
2266
|
+
* POST / PUT / PATCH / DELETE that met a 5xx keeps the client's own backoff — every 503 body carries
|
|
2267
|
+
* `retryAfterSeconds: 5` (`CONTROL_UNAVAILABLE`, `UPSTREAM_UNAVAILABLE`), which floored all three waits at 5 s:
|
|
2268
|
+
* a ≥15 s stall on a write that may already have landed, and retrying an ambiguous write harder does not make
|
|
2269
|
+
* it less ambiguous. The client's own schedule is ≤1 s + ≤2 s + ≤4 s.
|
|
2270
|
+
*/
|
|
2271
|
+
private retryDelayMs;
|
|
2232
2272
|
/**
|
|
2233
2273
|
* Wraps request with retry logic for transient failures
|
|
2234
2274
|
* @param url - The full URL to request
|
|
@@ -3794,8 +3834,11 @@ export declare interface LuaTriggerConfig<T = any> {
|
|
|
3794
3834
|
/** Skip invocation (HTTP 200, no agent run) when this returns false. */
|
|
3795
3835
|
filter?: (ctx: TriggerContext<T>) => boolean | Promise<boolean>;
|
|
3796
3836
|
/**
|
|
3797
|
-
* Shape the agent input. Return a `string` (the message)
|
|
3798
|
-
* `AgentInvocationInput` (you own the turn)
|
|
3837
|
+
* Shape the agent input. Return a `string` (the message), a full
|
|
3838
|
+
* `AgentInvocationInput` (you own the turn), or `{ startWorkflow: { name, … } }`
|
|
3839
|
+
* to start a workflow run instead of a chat turn (`TriggerStartWorkflow` — the
|
|
3840
|
+
* run is created in the delivery request, `trigger: 'webhook'`, and the
|
|
3841
|
+
* execution log row carries its `runId`). Returning null/undefined is an
|
|
3799
3842
|
* error — use `filter` to skip. Omit to use the default `body → message`,
|
|
3800
3843
|
* whose payload is capped at ~50k chars (like a no-code trigger); return a
|
|
3801
3844
|
* transform to forward larger or hand-picked fields as the message.
|
|
@@ -5083,8 +5126,16 @@ export declare interface LuaWorkflowConfig {
|
|
|
5083
5126
|
* for how many attempts the run may make.
|
|
5084
5127
|
*/
|
|
5085
5128
|
budget?: Pick<WorkflowDefinitionBudget, 'maxCredits' | 'maxSteps' | 'maxDurationSeconds'>;
|
|
5086
|
-
/**
|
|
5087
|
-
|
|
5129
|
+
/**
|
|
5130
|
+
* verbatim LuaJob union (D12) → Job{kind:'workflow'} on publish. `runAs` (LUA-779) governs the copy a
|
|
5131
|
+
* marketplace template freezes from this schedule: `'installer'` (the default when absent — every install's
|
|
5132
|
+
* fires run as the person who installed, who gets the run card in their inbox) or `'system'` (the frozen copy
|
|
5133
|
+
* runs user-less and unwatched — no inbox card for its runs; the install response says so). On this agent the
|
|
5134
|
+
* schedule runs as you either way.
|
|
5135
|
+
*/
|
|
5136
|
+
schedule?: JobSchedule & {
|
|
5137
|
+
runAs?: 'installer' | 'system';
|
|
5138
|
+
};
|
|
5088
5139
|
backfillOnEnable?: {
|
|
5089
5140
|
maxOccurrences?: number;
|
|
5090
5141
|
};
|
|
@@ -6573,9 +6624,25 @@ export declare interface TriggerContext<T = any> {
|
|
|
6573
6624
|
* `ctx.headers['x-hub-signature-256']`.
|
|
6574
6625
|
*/
|
|
6575
6626
|
/**
|
|
6576
|
-
* `transform` may start a workflow run instead of a chat turn (03 §3.7 / 07 — WF-205):
|
|
6577
|
-
* `{ startWorkflow: { name, input?, idempotencyKey?, correlationKey?, tags? } }`.
|
|
6578
|
-
*
|
|
6627
|
+
* `transform` may start a workflow run instead of a chat turn (03 §3.7 / 07 §7.2.1 — WF-205, LUA-875):
|
|
6628
|
+
* `{ startWorkflow: { name, input?, idempotencyKey?, notify?, correlationKey?, tags?, initialState?, replyTo?, onBehalfOf? } }`.
|
|
6629
|
+
*
|
|
6630
|
+
* The contract, the same on an HTTP trigger (`POST /trigger/:agentId/:token`) and a device trigger:
|
|
6631
|
+
* - the run is created synchronously in the delivery request — `200 { status: 'accepted', executionId, runId }` —
|
|
6632
|
+
* as the system principal (`trigger: 'webhook'`, the trigger's id on `run.triggerId`; no user connections are
|
|
6633
|
+
* mounted), and NO chat turn fires. A `prompt` / `messages` beside `startWorkflow` is ignored: the presence of
|
|
6634
|
+
* `startWorkflow` decides. A declared `tool` still wins over the whole transform (the both-declared rule).
|
|
6635
|
+
* - `idempotencyKey` is the ONE uniqueness key: a redelivery with the same key returns the SAME run (the
|
|
6636
|
+
* execution log row is `started_workflow` with that run's id). A webhook delivery has no key of its own —
|
|
6637
|
+
* set it from the vendor's delivery id (`linear:${issue.identifier}:ready-for-agent`, Stripe `event.id`,
|
|
6638
|
+
* GitHub `X-GitHub-Delivery`); without one every delivery starts a run.
|
|
6639
|
+
* - `notify` defaults to `'off'` (a system-principal run has no creator to notify); `replyTo` / `onBehalfOf`
|
|
6640
|
+
* make the run `principalKind: 'customer'`; `initialState` seeds the run's state (≤ 64 KB).
|
|
6641
|
+
* - a missing `name`, an unknown workflow, an input failing the workflow's `inputSchema`, or a
|
|
6642
|
+
* `concurrencyPolicy: 'forbid'` overlap is a typed row in `lua triggers logs` (`failed` / `skipped_overlap`)
|
|
6643
|
+
* on a `200` — the sender is never asked to retry a configuration error.
|
|
6644
|
+
* `name` is the agent-local workflow name (or its id — an id-or-name lookup, exactly what
|
|
6645
|
+
* `lua workflows describe <ref>` resolves); `correlationKey` accepts a literal or a
|
|
6579
6646
|
* `'${input.<field>}'` template the trigger fills.
|
|
6580
6647
|
*/
|
|
6581
6648
|
declare interface TriggerStartWorkflow {
|
|
@@ -6583,12 +6650,21 @@ declare interface TriggerStartWorkflow {
|
|
|
6583
6650
|
name: string;
|
|
6584
6651
|
input?: unknown;
|
|
6585
6652
|
idempotencyKey?: string;
|
|
6653
|
+
/** receipt delivery; default `'off'` — a trigger start runs as the system principal. */
|
|
6654
|
+
notify?: 'emailApp' | 'email' | 'app' | 'off';
|
|
6586
6655
|
correlationKey?: string;
|
|
6587
6656
|
tags?: string[];
|
|
6657
|
+
/** seeds the run's state (≤ 64 KB) instead of `{}`. */
|
|
6658
|
+
initialState?: Record<string, unknown>;
|
|
6588
6659
|
replyTo?: {
|
|
6589
6660
|
channel: string;
|
|
6590
6661
|
threadId: string;
|
|
6591
6662
|
};
|
|
6663
|
+
/** a customer principal without a reply channel. */
|
|
6664
|
+
onBehalfOf?: {
|
|
6665
|
+
kind: 'customer';
|
|
6666
|
+
externalId: string;
|
|
6667
|
+
};
|
|
6592
6668
|
};
|
|
6593
6669
|
}
|
|
6594
6670
|
|
|
@@ -7268,7 +7344,7 @@ declare type WorkflowJobHarness_2 = (typeof WORKFLOW_JOB_HARNESSES)[number];
|
|
|
7268
7344
|
|
|
7269
7345
|
declare type WorkflowJobResources = (typeof WORKFLOW_JOB_RESOURCES)[number];
|
|
7270
7346
|
|
|
7271
|
-
export declare type WorkflowJobToolId = 'shell' | 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'git' | 'gh' | 'fetch';
|
|
7347
|
+
export declare type WorkflowJobToolId = 'shell' | 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'git' | 'gh' | 'fetch' | 'ripwire';
|
|
7272
7348
|
|
|
7273
7349
|
export declare interface WorkflowMergePolicy {
|
|
7274
7350
|
strategy: 'rebase' | 'merge';
|
|
@@ -7277,6 +7353,27 @@ export declare interface WorkflowMergePolicy {
|
|
|
7277
7353
|
|
|
7278
7354
|
declare type WorkflowOnError = (typeof WORKFLOW_ON_ERROR)[number];
|
|
7279
7355
|
|
|
7356
|
+
/**
|
|
7357
|
+
* Matches WorkflowRunDto (R4 `fields:'summary'` — outputs are never inlined here).
|
|
7358
|
+
* The wire names the run `runId` (shared-types `WorkflowRunSummary`); `id` is the pre-R4 spelling some
|
|
7359
|
+
* envelopes still carry — read through `runIdOf()` (LUA-668: `status` printed "Run undefined").
|
|
7360
|
+
*/
|
|
7361
|
+
/**
|
|
7362
|
+
* LUA-877 — R4 `fields:'full'` / R5 `outputRef`: how to dereference an offloaded `{__cdnRef}` / `{__datasetRef}`
|
|
7363
|
+
* `output`. `GET url` is R32: a `cdn` ref answers a presigned download of the canonical JSON (+ `sha256`); a
|
|
7364
|
+
* `dataset` ref answers the presigned NDJSON plus the first page of rows (`?offset&limit`). Needs
|
|
7365
|
+
* `workflows:read-outputs` on the run. Absent beside an inline output and without the grant.
|
|
7366
|
+
*/
|
|
7367
|
+
declare interface WorkflowOutputRefDto {
|
|
7368
|
+
kind: 'cdn' | 'dataset';
|
|
7369
|
+
artefactId: string;
|
|
7370
|
+
url: string;
|
|
7371
|
+
size?: number;
|
|
7372
|
+
sha256?: string;
|
|
7373
|
+
rowCount?: number;
|
|
7374
|
+
contentType: string;
|
|
7375
|
+
}
|
|
7376
|
+
|
|
7280
7377
|
export declare interface WorkflowOutputVisibility {
|
|
7281
7378
|
roles: string[];
|
|
7282
7379
|
users?: string[];
|
|
@@ -7295,11 +7392,6 @@ declare interface WorkflowRetryPolicy {
|
|
|
7295
7392
|
maxBackoffSeconds?: number;
|
|
7296
7393
|
}
|
|
7297
7394
|
|
|
7298
|
-
/**
|
|
7299
|
-
* Matches WorkflowRunDto (R4 `fields:'summary'` — outputs are never inlined here).
|
|
7300
|
-
* The wire names the run `runId` (shared-types `WorkflowRunSummary`); `id` is the pre-R4 spelling some
|
|
7301
|
-
* envelopes still carry — read through `runIdOf()` (LUA-668: `status` printed "Run undefined").
|
|
7302
|
-
*/
|
|
7303
7395
|
declare interface WorkflowRun {
|
|
7304
7396
|
id?: string;
|
|
7305
7397
|
runId?: string;
|
|
@@ -7366,6 +7458,8 @@ declare interface WorkflowRun {
|
|
|
7366
7458
|
output?: unknown;
|
|
7367
7459
|
/** LUA-643: ≤ 2 KB preview beside an offloaded `output`. */
|
|
7368
7460
|
outputPreview?: string;
|
|
7461
|
+
/** LUA-877: the R32 route that dereferences an offloaded `output` (beside the ref; absent on an inline output). */
|
|
7462
|
+
outputRef?: WorkflowOutputRefDto;
|
|
7369
7463
|
/** LUA-643: every shape says whether a result exists; `--steps` (`fields:'full'`) serves it. */
|
|
7370
7464
|
hasOutput?: boolean;
|
|
7371
7465
|
/**
|