lua-cli 3.22.0 → 3.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-exports.d.ts +120 -14
- package/dist/api-exports.js +220 -25
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +337 -74
- package/dist/index.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/api/Jobs.md +1 -2
- package/docs/api/LuaJob.md +1 -1
- package/package.json +3 -3
- package/template/examples/jobs/DataMigrationJob.ts +2 -2
- package/template/package.json +1 -1
package/dist/api-exports.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { CallWarning } from 'ai';
|
|
2
2
|
import { FinishReason } from 'ai';
|
|
3
3
|
import { LanguageModelUsage } from 'ai';
|
|
4
|
+
import { ModelMessage } from 'ai';
|
|
4
5
|
import { ReasoningOutput } from 'ai';
|
|
5
6
|
import { UserContent } from 'ai';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
import { ZodType } from 'zod';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Narrowed, wire-safe output for `Agents.invoke`. A slice of the internal
|
|
12
|
+
* `FullOutput` shape — raw Mastra steps / tripwire payloads are intentionally
|
|
13
|
+
* not exposed to skill code.
|
|
14
|
+
*/
|
|
15
|
+
declare interface AgentInvocationEffects {
|
|
16
|
+
reviewDraftsCreated: number;
|
|
17
|
+
storage: 'lua_inbox';
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
/**
|
|
10
21
|
* Wire-format input for sandbox `Agents.invoke` / `POST /chat/generate/:agentId`
|
|
11
22
|
* when triggered programmatically by another agent/skill/tool.
|
|
@@ -62,13 +73,22 @@ declare interface AgentInvocationInput {
|
|
|
62
73
|
/** Per-call timeout in ms. Absent ⇒ the client default (120s). Set by scheduled agent jobs
|
|
63
74
|
* to 180s so the cloud tier cuts off at the same point the desktop's local runner does. */
|
|
64
75
|
timeoutMs?: number;
|
|
76
|
+
/** Per-request model override ("provider/model" code). Unknown codes fall back per
|
|
77
|
+
* approved-models policy server-side. */
|
|
78
|
+
model?: string;
|
|
79
|
+
/** Task 14 (tasks-redesign) — per-task connector + skill scoping. See `AgentToolScope`. */
|
|
80
|
+
toolScope?: AgentToolScope;
|
|
81
|
+
/**
|
|
82
|
+
* PRO-979 (A3) — cooperative mid-run cancellation. Honored where the
|
|
83
|
+
* transport boundary supports it (the loopback HTTP call is aborted); the
|
|
84
|
+
* in-flight server-side turn is NOT hard-killed — callers that abort must
|
|
85
|
+
* treat still-landing side effects as possible and record them (the job
|
|
86
|
+
* runner's ledger does, via postFence). NOT serialized on the wire — this
|
|
87
|
+
* field exists only on in-process invocations.
|
|
88
|
+
*/
|
|
89
|
+
signal?: AbortSignal;
|
|
65
90
|
}
|
|
66
91
|
|
|
67
|
-
/**
|
|
68
|
-
* Narrowed, wire-safe output for `Agents.invoke`. A slice of the internal
|
|
69
|
-
* `FullOutput` shape — raw Mastra steps / tripwire payloads are intentionally
|
|
70
|
-
* not exposed to skill code.
|
|
71
|
-
*/
|
|
72
92
|
declare interface AgentInvocationOutput {
|
|
73
93
|
/** Final response text (post-processor-modified, if applicable). */
|
|
74
94
|
text: string;
|
|
@@ -84,6 +104,10 @@ declare interface AgentInvocationOutput {
|
|
|
84
104
|
};
|
|
85
105
|
/** Names of tools invoked during generation. */
|
|
86
106
|
toolsUsed?: string[];
|
|
107
|
+
/** Trusted effects emitted by Lua-owned tool wrappers. This is intentionally
|
|
108
|
+
* a small aggregate, not raw tool output: unattended task receipts use it
|
|
109
|
+
* to report what happened without trusting model-authored prose. */
|
|
110
|
+
effects?: AgentInvocationEffects;
|
|
87
111
|
/**
|
|
88
112
|
* Echoes back the `threadId` suffix the caller passed in (if any). When the
|
|
89
113
|
* caller omitted `threadId`, this is undefined — the invocation ran in the
|
|
@@ -175,6 +199,23 @@ export declare interface AgentsApi {
|
|
|
175
199
|
invoke(targetAgentId: string, input: AgentInvocationInput): Promise<AgentInvocationOutput>;
|
|
176
200
|
}
|
|
177
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Task 14 (tasks-redesign) — per-task connector + skill scoping for a scheduled
|
|
204
|
+
* agent run. Non-empty `connectionIds` restricts the turn's MCP servers to the
|
|
205
|
+
* listed agent connections; non-empty `skillIds` restricts the turn's skills.
|
|
206
|
+
* Absent field or empty array ⇒ no filtering (the agent's full toolset).
|
|
207
|
+
*
|
|
208
|
+
* SECURITY: only honored on internally-authenticated invocations (the
|
|
209
|
+
* `X-Internal-Auth` agent-invoke path used by the server-side job runner) —
|
|
210
|
+
* lua-core drops it from any client-authenticated `/chat/*` request.
|
|
211
|
+
*/
|
|
212
|
+
declare interface AgentToolScope {
|
|
213
|
+
/** Allowlisted agent connection ids (UnifiedTo `unifiedId`s). */
|
|
214
|
+
connectionIds?: string[];
|
|
215
|
+
/** Allowlisted skill ids (from the agent's `subAgent.skills`). */
|
|
216
|
+
skillIds?: string[];
|
|
217
|
+
}
|
|
218
|
+
|
|
178
219
|
export declare const AI: AiApi;
|
|
179
220
|
|
|
180
221
|
/**
|
|
@@ -219,13 +260,13 @@ export declare interface AiApi {
|
|
|
219
260
|
/**
|
|
220
261
|
* Wire-format input for sandbox `AI.generate` / `POST .../generate` (JSON-serializable).
|
|
221
262
|
* Serializable subset of AI SDK `generateText` parameters.
|
|
222
|
-
* `messages` is untyped over HTTP; callers typically send AI SDK `ModelMessage[]`.
|
|
223
263
|
*/
|
|
224
264
|
export declare interface AiGenerateInput {
|
|
225
265
|
model?: string;
|
|
226
266
|
system?: string;
|
|
227
267
|
prompt?: string;
|
|
228
|
-
|
|
268
|
+
/** AI SDK `ModelMessage[]`. Server-validated; malformed messages are rejected with 400. */
|
|
269
|
+
messages?: ModelMessage[];
|
|
229
270
|
temperature?: number;
|
|
230
271
|
maxOutputTokens?: number;
|
|
231
272
|
/**
|
|
@@ -1064,7 +1105,7 @@ declare interface CustomDataAPI {
|
|
|
1064
1105
|
* @param limit - Items per page
|
|
1065
1106
|
* @returns Promise resolving to paginated entries
|
|
1066
1107
|
*/
|
|
1067
|
-
get(collectionName: string, filter?:
|
|
1108
|
+
get(collectionName: string, filter?: LuaQuery, page?: number, limit?: number): Promise<GetCustomDataResponse>;
|
|
1068
1109
|
/**
|
|
1069
1110
|
* Gets a specific entry by ID.
|
|
1070
1111
|
* @param collectionName - Collection name
|
|
@@ -1081,6 +1122,12 @@ declare interface CustomDataAPI {
|
|
|
1081
1122
|
* @returns Promise resolving to update response
|
|
1082
1123
|
*/
|
|
1083
1124
|
update(collectionName: string, entryId: string, data: Record<string, any>, searchText?: string): Promise<UpdateCustomDataResponse>;
|
|
1125
|
+
/** Atomically sets and removes top-level entry fields and optionally changes search text. */
|
|
1126
|
+
patch(collectionName: string, entryId: string, mutation: {
|
|
1127
|
+
set?: Record<string, any>;
|
|
1128
|
+
unset?: string[];
|
|
1129
|
+
searchText?: string | null;
|
|
1130
|
+
}): Promise<UpdateCustomDataResponse>;
|
|
1084
1131
|
/**
|
|
1085
1132
|
* Performs vector search on a collection.
|
|
1086
1133
|
* @param collectionName - Collection name
|
|
@@ -1139,7 +1186,7 @@ export declare const Data: {
|
|
|
1139
1186
|
* @param limit - Items per page (default: 10)
|
|
1140
1187
|
* @returns Promise resolving to array of entries
|
|
1141
1188
|
*/
|
|
1142
|
-
get(collectionName: string, filter?:
|
|
1189
|
+
get(collectionName: string, filter?: LuaQuery, page?: number, limit?: number): Promise<GetCustomDataResponse>;
|
|
1143
1190
|
/**
|
|
1144
1191
|
* Retrieves a specific entry by ID.
|
|
1145
1192
|
*
|
|
@@ -1211,6 +1258,12 @@ export declare class DataEntryInstance {
|
|
|
1211
1258
|
* @throws Error if the update fails
|
|
1212
1259
|
*/
|
|
1213
1260
|
update(data: Record<string, any>, searchText?: string): Promise<Record<string, any>>;
|
|
1261
|
+
patch(mutation: {
|
|
1262
|
+
set?: Record<string, any>;
|
|
1263
|
+
unset?: string[];
|
|
1264
|
+
searchText?: string | null;
|
|
1265
|
+
}): Promise<Record<string, any>>;
|
|
1266
|
+
unset(...fields: string[]): Promise<Record<string, any>>;
|
|
1214
1267
|
/**
|
|
1215
1268
|
* Deletes the custom data entry
|
|
1216
1269
|
* @returns Promise resolving to true if deletion was successful
|
|
@@ -1543,6 +1596,18 @@ declare interface GovernanceConfig {
|
|
|
1543
1596
|
/** SDK mode — local in-memory policy rules layered on top of any `preset`. */
|
|
1544
1597
|
rules?: {
|
|
1545
1598
|
blockTools?: string[];
|
|
1599
|
+
/**
|
|
1600
|
+
* Tool names that require human approval before executing. Matched against
|
|
1601
|
+
* the runtime tool name on each tool_call (the SDK's `requireToolApproval`
|
|
1602
|
+
* preset). Canonical key — writers use this.
|
|
1603
|
+
*/
|
|
1604
|
+
requireToolApproval?: string[];
|
|
1605
|
+
/**
|
|
1606
|
+
* @deprecated Legacy key for `requireToolApproval`. Historically fed into the
|
|
1607
|
+
* SDK's `requireApproval(actions)` preset, which matches action CATEGORIES —
|
|
1608
|
+
* so tool names stored here never matched at runtime (PRO-257). Read-compat
|
|
1609
|
+
* only: accepted on read when `requireToolApproval` is absent; never written.
|
|
1610
|
+
*/
|
|
1546
1611
|
requireApproval?: string[];
|
|
1547
1612
|
tokenBudget?: number;
|
|
1548
1613
|
};
|
|
@@ -1875,7 +1940,11 @@ declare interface JobExecution {
|
|
|
1875
1940
|
retryCount?: number;
|
|
1876
1941
|
}
|
|
1877
1942
|
|
|
1878
|
-
|
|
1943
|
+
/** The complete persisted vocabulary (shared-schemas job.execution.schema.ts
|
|
1944
|
+
* is the source of truth): PRO-979 added the explicit cancellation/ownership
|
|
1945
|
+
* lifecycle; claimed/killed/cancelled predate it. Additive — existing
|
|
1946
|
+
* consumers narrowing on the old five values keep compiling. */
|
|
1947
|
+
declare type JobExecutionStatus = 'pending' | 'claimed' | 'running' | 'cancellation_requested' | 'completed' | 'failed' | 'timeout' | 'killed' | 'cancelled' | 'abandoned' | 'reaped';
|
|
1879
1948
|
|
|
1880
1949
|
/**
|
|
1881
1950
|
* Job Instance class.
|
|
@@ -2546,7 +2615,7 @@ export declare class LuaJob {
|
|
|
2546
2615
|
* @param config.name - Job name (required; non-empty string)
|
|
2547
2616
|
* @param config.description - Short description of what the job does (1-2 sentences)
|
|
2548
2617
|
* @param config.schedule - Schedule configuration (cron, once, or interval)
|
|
2549
|
-
* @param config.timeout - Optional timeout in seconds (default: 300)
|
|
2618
|
+
* @param config.timeout - Optional timeout in seconds (default: 300, supported range: 1-600)
|
|
2550
2619
|
* @param config.retry - Optional retry configuration
|
|
2551
2620
|
* @param config.metadata - Optional metadata for the job
|
|
2552
2621
|
* @param config.execute - Function that processes the job (receives job instance as parameter)
|
|
@@ -2603,7 +2672,7 @@ export declare interface LuaJobConfig {
|
|
|
2603
2672
|
* Receives metadata as parameter for accessing job configuration.
|
|
2604
2673
|
*/
|
|
2605
2674
|
execute: (job: JobInstance) => Promise<any>;
|
|
2606
|
-
/** Optional timeout in seconds (default: 300) */
|
|
2675
|
+
/** Optional timeout in seconds (default: 300, supported range: 1-600) */
|
|
2607
2676
|
timeout?: number;
|
|
2608
2677
|
/** Optional retry configuration */
|
|
2609
2678
|
retry?: {
|
|
@@ -2675,6 +2744,33 @@ export declare class LuaMCPServer {
|
|
|
2675
2744
|
*/
|
|
2676
2745
|
export declare type LuaMCPServerConfig = MCPSSEServerConfig | MCPStreamableHttpServerConfig;
|
|
2677
2746
|
|
|
2747
|
+
/**
|
|
2748
|
+
* The entity-independent, bounded Mongo-style filter accepted by Lua APIs.
|
|
2749
|
+
* Root `$and`/`$or` branches and nested data fields share this recursive shape;
|
|
2750
|
+
* the runtime compiler performs the stricter placement and resource checks.
|
|
2751
|
+
*/
|
|
2752
|
+
export declare interface LuaQuery {
|
|
2753
|
+
[fieldOrLogicalOperator: string]: LuaQueryValue;
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
/** Field-level operators shared by every Lua platform Query surface. */
|
|
2757
|
+
export declare interface LuaQueryFieldOperators {
|
|
2758
|
+
$eq?: LuaQueryScalar;
|
|
2759
|
+
$ne?: LuaQueryScalar;
|
|
2760
|
+
$gt?: LuaQueryScalar;
|
|
2761
|
+
$gte?: LuaQueryScalar;
|
|
2762
|
+
$lt?: LuaQueryScalar;
|
|
2763
|
+
$lte?: LuaQueryScalar;
|
|
2764
|
+
$in?: readonly LuaQueryScalar[];
|
|
2765
|
+
$nin?: readonly LuaQueryScalar[];
|
|
2766
|
+
$exists?: boolean;
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
/** JSON scalar accepted by the bounded Lua Query language. */
|
|
2770
|
+
export declare type LuaQueryScalar = string | number | boolean | null;
|
|
2771
|
+
|
|
2772
|
+
declare type LuaQueryValue = LuaQueryScalar | readonly LuaQueryScalar[] | LuaQueryFieldOperators | LuaQuery | readonly LuaQuery[];
|
|
2773
|
+
|
|
2678
2774
|
/**
|
|
2679
2775
|
* Lua request context.
|
|
2680
2776
|
* Contains information about the current request.
|
|
@@ -4631,7 +4727,7 @@ declare interface ProductAPI {
|
|
|
4631
4727
|
get(options?: {
|
|
4632
4728
|
page?: number;
|
|
4633
4729
|
limit?: number;
|
|
4634
|
-
filter?:
|
|
4730
|
+
filter?: LuaQuery;
|
|
4635
4731
|
}): Promise<any>;
|
|
4636
4732
|
/**
|
|
4637
4733
|
* Creates a new product.
|
|
@@ -4684,7 +4780,7 @@ declare interface ProductAPI {
|
|
|
4684
4780
|
declare interface ProductFilterOptions {
|
|
4685
4781
|
page?: number;
|
|
4686
4782
|
limit?: number;
|
|
4687
|
-
filter?:
|
|
4783
|
+
filter?: LuaQuery;
|
|
4688
4784
|
}
|
|
4689
4785
|
|
|
4690
4786
|
/**
|
|
@@ -5402,6 +5498,11 @@ declare interface UserDataAPI {
|
|
|
5402
5498
|
* @returns Promise resolving to updated user data
|
|
5403
5499
|
*/
|
|
5404
5500
|
update(data: Record<string, any>): Promise<any>;
|
|
5501
|
+
/** Atomically sets and removes top-level user data fields. */
|
|
5502
|
+
patch(mutation: {
|
|
5503
|
+
set?: Record<string, any>;
|
|
5504
|
+
unset?: string[];
|
|
5505
|
+
}): Promise<any>;
|
|
5405
5506
|
/**
|
|
5406
5507
|
* Clears user data.
|
|
5407
5508
|
* @returns Promise resolving when data is cleared
|
|
@@ -5452,6 +5553,11 @@ export declare class UserDataInstance {
|
|
|
5452
5553
|
* @throws Error if the update fails
|
|
5453
5554
|
*/
|
|
5454
5555
|
update(data: Record<string, any>): Promise<any>;
|
|
5556
|
+
patch(mutation: {
|
|
5557
|
+
set?: Record<string, any>;
|
|
5558
|
+
unset?: string[];
|
|
5559
|
+
}): Promise<any>;
|
|
5560
|
+
unset(...fields: string[]): Promise<any>;
|
|
5455
5561
|
/**
|
|
5456
5562
|
* Clears all user data for the current user
|
|
5457
5563
|
* @returns Promise resolving to true if clearing was successful
|