lua-cli 3.32.2 → 3.32.3
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 +82 -8
- package/dist/api-exports.js +765 -304
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +2082 -549
- package/dist/index.js.map +1 -1
- package/dist/workflow-builder.d.ts +11 -7
- package/dist/workflow-builder.js +588 -244
- package/dist/workflow-builder.js.map +1 -1
- package/docs/CLI_REFERENCE.md +126 -4
- package/docs/README.md +2 -2
- package/docs/workflows/approvals.md +24 -6
- package/docs/workflows/goals.md +2 -2
- package/docs/workflows/replay-local.md +9 -3
- package/docs/workflows/schedules.md +1 -1
- 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/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
|
/**
|
|
@@ -5031,13 +5068,17 @@ export declare interface LuaWorkflowConfig {
|
|
|
5031
5068
|
* `maxDurationSeconds` default 604 800; 2 592 000 when the graph contains an approval / waitForSignal / suspend-capable
|
|
5032
5069
|
* step (P1-4). The three members the SDK forwards, spelled by the ONE definition budget (`WorkflowDefinitionBudget`).
|
|
5033
5070
|
*
|
|
5034
|
-
* `maxCredits`
|
|
5035
|
-
* completes, a `tier:'job'` attempt a flat 4 at its first
|
|
5036
|
-
*
|
|
5037
|
-
*
|
|
5038
|
-
*
|
|
5039
|
-
*
|
|
5040
|
-
*
|
|
5071
|
+
* `maxCredits` never meters tokens (LUA-708). Flat metering (every run while `LUA_WORKFLOWS_METERING_V2` is off):
|
|
5072
|
+
* an inline agent step settles a flat 1 credit when it completes, a `tier:'job'` attempt a flat 4 at its first
|
|
5073
|
+
* claim (a retry is a new attempt) — so `maxCredits: 40` buys ten Job-tier attempts, and a value under 4 never
|
|
5074
|
+
* dispatches one. Priced metering (LUA-724, the flag on): an inline agent step settles what chat charged for the
|
|
5075
|
+
* turn — one credit per model call on the legacy plan, `tier × model multiplier` actions on a seat plan (then the
|
|
5076
|
+
* cap is compared in actions) — and `lua workflows status` says which mode a run used (`usage.metering`). Either
|
|
5077
|
+
* way the run parks on a budget gate (`nextAction:'raise_budget'`, `lua workflows raise-budget`) when what remains
|
|
5078
|
+
* is under the next agent step's reserve. Each Job-tier attempt then runs to its own wall (`timeoutSeconds`),
|
|
5079
|
+
* `maxInputTokens` (default 4M ≈ $1–13 on a Sonnet-class model), `maxMessages` and `maxTurns`; nothing meters its
|
|
5080
|
+
* tokens against the credits mid-attempt. Size `maxInputTokens` for what one attempt may cost and `maxCredits`
|
|
5081
|
+
* for how many attempts the run may make.
|
|
5041
5082
|
*/
|
|
5042
5083
|
budget?: Pick<WorkflowDefinitionBudget, 'maxCredits' | 'maxSteps' | 'maxDurationSeconds'>;
|
|
5043
5084
|
/** verbatim LuaJob union (D12) → Job{kind:'workflow'} on publish */
|
|
@@ -7315,6 +7356,39 @@ declare interface WorkflowRun {
|
|
|
7315
7356
|
outputPreview?: string;
|
|
7316
7357
|
/** LUA-643: every shape says whether a result exists; `--steps` (`fields:'full'`) serves it. */
|
|
7317
7358
|
hasOutput?: boolean;
|
|
7359
|
+
/**
|
|
7360
|
+
* §08 §8.1 `usage` — the settled spend and, LUA-724 (PR 8), how it was metered: `metering` `'flat'` (1 credit per
|
|
7361
|
+
* inline agent step, 4 per Job-tier attempt — every run while `LUA_WORKFLOWS_METERING_V2` is off) or `'priced'`
|
|
7362
|
+
* (charged like chat: a credit per model call on the legacy plan, `tier × model multiplier` actions on a seat
|
|
7363
|
+
* plan — then `engine` names the plan and `actionsUsed` carries a seat run's actions).
|
|
7364
|
+
*/
|
|
7365
|
+
usage?: {
|
|
7366
|
+
creditsUsed?: number;
|
|
7367
|
+
actionsEstimate?: number;
|
|
7368
|
+
actionsUsed?: number;
|
|
7369
|
+
metering?: 'flat' | 'priced';
|
|
7370
|
+
engine?: 'legacy' | 'seat';
|
|
7371
|
+
steps?: number;
|
|
7372
|
+
inputTokens?: number;
|
|
7373
|
+
outputTokens?: number;
|
|
7374
|
+
};
|
|
7375
|
+
/**
|
|
7376
|
+
* R4: the run's caps and settled spend. `maxCredits` and `remaining` are both absent on an uncapped run (`0` = unset);
|
|
7377
|
+
* `remaining` is the engine's pre-dispatch subtraction (priced actions and claimed-step holds count), floored at 0.
|
|
7378
|
+
*/
|
|
7379
|
+
budget?: {
|
|
7380
|
+
maxCredits?: number;
|
|
7381
|
+
maxSteps?: number;
|
|
7382
|
+
maxDurationSeconds?: number;
|
|
7383
|
+
unit?: 'credits' | 'actions';
|
|
7384
|
+
spent?: {
|
|
7385
|
+
credits?: number;
|
|
7386
|
+
actionsEstimate?: number;
|
|
7387
|
+
steps?: number;
|
|
7388
|
+
};
|
|
7389
|
+
reserved?: number;
|
|
7390
|
+
remaining?: number;
|
|
7391
|
+
};
|
|
7318
7392
|
createdAt: string;
|
|
7319
7393
|
startedAt?: string;
|
|
7320
7394
|
completedAt?: string;
|