lua-cli 3.32.2 → 3.32.4
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 +87 -11
- package/dist/api-exports.js +1554 -756
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +3512 -1459
- package/dist/index.js.map +1 -1
- package/dist/workflow-builder.d.ts +16 -10
- package/dist/workflow-builder.js +1216 -702
- package/dist/workflow-builder.js.map +1 -1
- package/docs/CLI_REFERENCE.md +126 -4
- package/docs/README.md +2 -2
- package/docs/api/LuaWorkflow.md +1 -1
- package/docs/workflows/approvals.md +26 -6
- package/docs/workflows/goals.md +2 -2
- package/docs/workflows/recovery.md +1 -1
- package/docs/workflows/replay-local.md +9 -3
- package/docs/workflows/schedules.md +13 -4
- package/docs/workflows/script-form.md +4 -4
- package/docs/workflows/testing-offline.md +33 -21
- package/package.json +4 -3
- package/template/examples/workflows/CLAUDE.md +17 -11
- package/template/examples/workflows/adversarial-verify.workflow.script.js +20 -16
- package/template/examples/workflows/outreach.ts +31 -15
- package/template/examples/workflows/refund-approval.ts +26 -12
- package/template/examples/workflows/research-brief.ts +29 -16
- package/template/package.json +1 -1
package/dist/api-exports.d.ts
CHANGED
|
@@ -189,6 +189,34 @@ declare interface AgentInvocationInput {
|
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
/**
|
|
193
|
+
* LUA-724 (PR 7) — the billed turn's pricing inputs, exactly as chat's settlement event carries
|
|
194
|
+
* them (`chat.service.trackLlmInferenceUsage`): the model that ACTUALLY served the turn (the
|
|
195
|
+
* resolver's code, not the caller's pin), the de-paged `contextInputTokens` (largest single
|
|
196
|
+
* step's prompt — never the whole-turn sum), the tool-call COUNT, and whether the turn ran on
|
|
197
|
+
* the org's own key. `chargedCredits` echoes the gate's answer (true ⇒ the legacy pool deducted
|
|
198
|
+
* in real time; false ⇒ seat org / free turn — settlement meters it).
|
|
199
|
+
*
|
|
200
|
+
* Stamped by the serving pod ONLY on internal-auth turns that carry a billing `operationId`
|
|
201
|
+
* (the workflow agent-step loopback), as the enumerable `luaMeter` top-level field of the
|
|
202
|
+
* generate envelope — never on a Bearer turn, so the public wire is byte-identical. The
|
|
203
|
+
* workflow executor prices the step's `run.budget.spent` from it with `priceModelCall`.
|
|
204
|
+
*/
|
|
205
|
+
declare interface AgentInvocationMeter {
|
|
206
|
+
model?: string;
|
|
207
|
+
contextInputTokens?: number;
|
|
208
|
+
/** Tool-call COUNT (`toolNames.length`) — the tier's tool signal. */
|
|
209
|
+
toolsFired?: number;
|
|
210
|
+
/**
|
|
211
|
+
* The tool names fired, one entry per call (repeats kept), exactly as the usage event's
|
|
212
|
+
* `toolNames` — settlement intersects them with the pricing config's `docProcessingToolNames`
|
|
213
|
+
* to force the heavy tier (`hasDocProcessingTool`), so the workflow price must see them too.
|
|
214
|
+
*/
|
|
215
|
+
toolNames?: string[];
|
|
216
|
+
byok?: boolean;
|
|
217
|
+
chargedCredits?: boolean;
|
|
218
|
+
}
|
|
219
|
+
|
|
192
220
|
declare interface AgentInvocationOutput {
|
|
193
221
|
/** Final response text (post-processor-modified, if applicable). */
|
|
194
222
|
text: string;
|
|
@@ -211,6 +239,12 @@ declare interface AgentInvocationOutput {
|
|
|
211
239
|
};
|
|
212
240
|
/** Names of tools invoked during generation. */
|
|
213
241
|
toolsUsed?: string[];
|
|
242
|
+
/**
|
|
243
|
+
* LUA-724 (PR 7) — the turn's pricing inputs (see `AgentInvocationMeter`). Present only when
|
|
244
|
+
* the serving pod stamped `luaMeter` (an `operationId`-bearing internal-auth turn); absent
|
|
245
|
+
* otherwise — legacy outputs are byte-identical.
|
|
246
|
+
*/
|
|
247
|
+
meter?: AgentInvocationMeter;
|
|
214
248
|
/** Trusted effects emitted by Lua-owned tool wrappers. This is intentionally
|
|
215
249
|
* a small aggregate, not raw tool output: unattended task receipts use it
|
|
216
250
|
* to report what happened without trusting model-authored prose. */
|
|
@@ -919,11 +953,14 @@ declare interface BuiltWorkflow {
|
|
|
919
953
|
}>;
|
|
920
954
|
}
|
|
921
955
|
|
|
922
|
-
/** R11 — `CancelRunVerdict` (PRO-979 vocabulary). */
|
|
956
|
+
/** R11 — `CancelRunVerdict` (PRO-979 vocabulary; §9.5.2 — a terminal run answers `state:'terminal'`, never an error). */
|
|
923
957
|
declare interface CancelRunVerdict {
|
|
924
958
|
status: WorkflowRunStatus;
|
|
925
959
|
nextAction: string;
|
|
926
960
|
forceAvailableAt?: string;
|
|
961
|
+
cancelRequested?: boolean;
|
|
962
|
+
state?: 'running' | 'cancellation_requested' | 'abandoned' | 'terminal';
|
|
963
|
+
transitioned?: boolean;
|
|
927
964
|
}
|
|
928
965
|
|
|
929
966
|
/**
|
|
@@ -1323,9 +1360,11 @@ export declare type ChatMessage = TextMessage | ImageMessage | FileMessage;
|
|
|
1323
1360
|
/**
|
|
1324
1361
|
* A container arm: a `StepRef` — a `createStep` object, or a string naming an entry declared elsewhere in the chain
|
|
1325
1362
|
* (`agentStep` / `specialistStep` / `toolStep` / `workflow`, and since LUA-684 `approval` / `waitForSignal`, so an
|
|
1326
|
-
* approval can run concurrently with another row) — or
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1363
|
+
* approval can run concurrently with another row) — or the two-element pair `[mapConfig, stepRef]`: the step runs
|
|
1364
|
+
* with the map as its own `input` (LUA-780 — a `parallel` arm only; a `foreach` / `loop` body receives its item /
|
|
1365
|
+
* the previous output and refuses the pair, `mapping-placement`, unless the target is a `.workflow()` node, whose
|
|
1366
|
+
* `input` is the child run's). A HITL arm takes the previous output as its payload, so it never heads a
|
|
1367
|
+
* `[map, step]` pair, and a `loop` body cannot be one until the engine proves it (`node-type-unsupported-in-container`).
|
|
1329
1368
|
*/
|
|
1330
1369
|
export declare type ContainerArm = StepRef | [LuaMapConfig, StepRef];
|
|
1331
1370
|
|
|
@@ -5031,13 +5070,17 @@ export declare interface LuaWorkflowConfig {
|
|
|
5031
5070
|
* `maxDurationSeconds` default 604 800; 2 592 000 when the graph contains an approval / waitForSignal / suspend-capable
|
|
5032
5071
|
* step (P1-4). The three members the SDK forwards, spelled by the ONE definition budget (`WorkflowDefinitionBudget`).
|
|
5033
5072
|
*
|
|
5034
|
-
* `maxCredits`
|
|
5035
|
-
* completes, a `tier:'job'` attempt a flat 4 at its first
|
|
5036
|
-
*
|
|
5037
|
-
*
|
|
5038
|
-
*
|
|
5039
|
-
*
|
|
5040
|
-
*
|
|
5073
|
+
* `maxCredits` never meters tokens (LUA-708). Flat metering (every run while `LUA_WORKFLOWS_METERING_V2` is off):
|
|
5074
|
+
* an inline agent step settles a flat 1 credit when it completes, a `tier:'job'` attempt a flat 4 at its first
|
|
5075
|
+
* claim (a retry is a new attempt) — so `maxCredits: 40` buys ten Job-tier attempts, and a value under 4 never
|
|
5076
|
+
* dispatches one. Priced metering (LUA-724, the flag on): an inline agent step settles what chat charged for the
|
|
5077
|
+
* turn — one credit per model call on the legacy plan, `tier × model multiplier` actions on a seat plan (then the
|
|
5078
|
+
* cap is compared in actions) — and `lua workflows status` says which mode a run used (`usage.metering`). Either
|
|
5079
|
+
* way the run parks on a budget gate (`nextAction:'raise_budget'`, `lua workflows raise-budget`) when what remains
|
|
5080
|
+
* is under the next agent step's reserve. Each Job-tier attempt then runs to its own wall (`timeoutSeconds`),
|
|
5081
|
+
* `maxInputTokens` (default 4M ≈ $1–13 on a Sonnet-class model), `maxMessages` and `maxTurns`; nothing meters its
|
|
5082
|
+
* tokens against the credits mid-attempt. Size `maxInputTokens` for what one attempt may cost and `maxCredits`
|
|
5083
|
+
* for how many attempts the run may make.
|
|
5041
5084
|
*/
|
|
5042
5085
|
budget?: Pick<WorkflowDefinitionBudget, 'maxCredits' | 'maxSteps' | 'maxDurationSeconds'>;
|
|
5043
5086
|
/** verbatim LuaJob union (D12) → Job{kind:'workflow'} on publish */
|
|
@@ -7315,6 +7358,39 @@ declare interface WorkflowRun {
|
|
|
7315
7358
|
outputPreview?: string;
|
|
7316
7359
|
/** LUA-643: every shape says whether a result exists; `--steps` (`fields:'full'`) serves it. */
|
|
7317
7360
|
hasOutput?: boolean;
|
|
7361
|
+
/**
|
|
7362
|
+
* §08 §8.1 `usage` — the settled spend and, LUA-724 (PR 8), how it was metered: `metering` `'flat'` (1 credit per
|
|
7363
|
+
* inline agent step, 4 per Job-tier attempt — every run while `LUA_WORKFLOWS_METERING_V2` is off) or `'priced'`
|
|
7364
|
+
* (charged like chat: a credit per model call on the legacy plan, `tier × model multiplier` actions on a seat
|
|
7365
|
+
* plan — then `engine` names the plan and `actionsUsed` carries a seat run's actions).
|
|
7366
|
+
*/
|
|
7367
|
+
usage?: {
|
|
7368
|
+
creditsUsed?: number;
|
|
7369
|
+
actionsEstimate?: number;
|
|
7370
|
+
actionsUsed?: number;
|
|
7371
|
+
metering?: 'flat' | 'priced';
|
|
7372
|
+
engine?: 'legacy' | 'seat';
|
|
7373
|
+
steps?: number;
|
|
7374
|
+
inputTokens?: number;
|
|
7375
|
+
outputTokens?: number;
|
|
7376
|
+
};
|
|
7377
|
+
/**
|
|
7378
|
+
* R4: the run's caps and settled spend. `maxCredits` and `remaining` are both absent on an uncapped run (`0` = unset);
|
|
7379
|
+
* `remaining` is the engine's pre-dispatch subtraction (priced actions and claimed-step holds count), floored at 0.
|
|
7380
|
+
*/
|
|
7381
|
+
budget?: {
|
|
7382
|
+
maxCredits?: number;
|
|
7383
|
+
maxSteps?: number;
|
|
7384
|
+
maxDurationSeconds?: number;
|
|
7385
|
+
unit?: 'credits' | 'actions';
|
|
7386
|
+
spent?: {
|
|
7387
|
+
credits?: number;
|
|
7388
|
+
actionsEstimate?: number;
|
|
7389
|
+
steps?: number;
|
|
7390
|
+
};
|
|
7391
|
+
reserved?: number;
|
|
7392
|
+
remaining?: number;
|
|
7393
|
+
};
|
|
7318
7394
|
createdAt: string;
|
|
7319
7395
|
startedAt?: string;
|
|
7320
7396
|
completedAt?: string;
|