lua-cli 3.23.0 → 3.23.2
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 +71 -10
- package/dist/api-exports.js +46 -5
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +139 -29
- package/dist/index.js.map +1 -1
- package/docs/README.md +2 -2
- package/package.json +1 -1
- package/template/package.json +1 -1
package/dist/api-exports.d.ts
CHANGED
|
@@ -7,6 +7,16 @@ import { UserContent } from 'ai';
|
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { ZodType } from 'zod';
|
|
9
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
|
+
|
|
10
20
|
/**
|
|
11
21
|
* Wire-format input for sandbox `Agents.invoke` / `POST /chat/generate/:agentId`
|
|
12
22
|
* when triggered programmatically by another agent/skill/tool.
|
|
@@ -68,13 +78,17 @@ declare interface AgentInvocationInput {
|
|
|
68
78
|
model?: string;
|
|
69
79
|
/** Task 14 (tasks-redesign) — per-task connector + skill scoping. See `AgentToolScope`. */
|
|
70
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;
|
|
71
90
|
}
|
|
72
91
|
|
|
73
|
-
/**
|
|
74
|
-
* Narrowed, wire-safe output for `Agents.invoke`. A slice of the internal
|
|
75
|
-
* `FullOutput` shape — raw Mastra steps / tripwire payloads are intentionally
|
|
76
|
-
* not exposed to skill code.
|
|
77
|
-
*/
|
|
78
92
|
declare interface AgentInvocationOutput {
|
|
79
93
|
/** Final response text (post-processor-modified, if applicable). */
|
|
80
94
|
text: string;
|
|
@@ -90,6 +104,10 @@ declare interface AgentInvocationOutput {
|
|
|
90
104
|
};
|
|
91
105
|
/** Names of tools invoked during generation. */
|
|
92
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;
|
|
93
111
|
/**
|
|
94
112
|
* Echoes back the `threadId` suffix the caller passed in (if any). When the
|
|
95
113
|
* caller omitted `threadId`, this is undefined — the invocation ran in the
|
|
@@ -1087,7 +1105,7 @@ declare interface CustomDataAPI {
|
|
|
1087
1105
|
* @param limit - Items per page
|
|
1088
1106
|
* @returns Promise resolving to paginated entries
|
|
1089
1107
|
*/
|
|
1090
|
-
get(collectionName: string, filter?:
|
|
1108
|
+
get(collectionName: string, filter?: LuaQuery, page?: number, limit?: number): Promise<GetCustomDataResponse>;
|
|
1091
1109
|
/**
|
|
1092
1110
|
* Gets a specific entry by ID.
|
|
1093
1111
|
* @param collectionName - Collection name
|
|
@@ -1168,7 +1186,7 @@ export declare const Data: {
|
|
|
1168
1186
|
* @param limit - Items per page (default: 10)
|
|
1169
1187
|
* @returns Promise resolving to array of entries
|
|
1170
1188
|
*/
|
|
1171
|
-
get(collectionName: string, filter?:
|
|
1189
|
+
get(collectionName: string, filter?: LuaQuery, page?: number, limit?: number): Promise<GetCustomDataResponse>;
|
|
1172
1190
|
/**
|
|
1173
1191
|
* Retrieves a specific entry by ID.
|
|
1174
1192
|
*
|
|
@@ -1578,6 +1596,18 @@ declare interface GovernanceConfig {
|
|
|
1578
1596
|
/** SDK mode — local in-memory policy rules layered on top of any `preset`. */
|
|
1579
1597
|
rules?: {
|
|
1580
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
|
+
*/
|
|
1581
1611
|
requireApproval?: string[];
|
|
1582
1612
|
tokenBudget?: number;
|
|
1583
1613
|
};
|
|
@@ -1910,7 +1940,11 @@ declare interface JobExecution {
|
|
|
1910
1940
|
retryCount?: number;
|
|
1911
1941
|
}
|
|
1912
1942
|
|
|
1913
|
-
|
|
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';
|
|
1914
1948
|
|
|
1915
1949
|
/**
|
|
1916
1950
|
* Job Instance class.
|
|
@@ -2710,6 +2744,33 @@ export declare class LuaMCPServer {
|
|
|
2710
2744
|
*/
|
|
2711
2745
|
export declare type LuaMCPServerConfig = MCPSSEServerConfig | MCPStreamableHttpServerConfig;
|
|
2712
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
|
+
|
|
2713
2774
|
/**
|
|
2714
2775
|
* Lua request context.
|
|
2715
2776
|
* Contains information about the current request.
|
|
@@ -4666,7 +4727,7 @@ declare interface ProductAPI {
|
|
|
4666
4727
|
get(options?: {
|
|
4667
4728
|
page?: number;
|
|
4668
4729
|
limit?: number;
|
|
4669
|
-
filter?:
|
|
4730
|
+
filter?: LuaQuery;
|
|
4670
4731
|
}): Promise<any>;
|
|
4671
4732
|
/**
|
|
4672
4733
|
* Creates a new product.
|
|
@@ -4719,7 +4780,7 @@ declare interface ProductAPI {
|
|
|
4719
4780
|
declare interface ProductFilterOptions {
|
|
4720
4781
|
page?: number;
|
|
4721
4782
|
limit?: number;
|
|
4722
|
-
filter?:
|
|
4783
|
+
filter?: LuaQuery;
|
|
4723
4784
|
}
|
|
4724
4785
|
|
|
4725
4786
|
/**
|
package/dist/api-exports.js
CHANGED
|
@@ -101,9 +101,13 @@ function isMcpDraftCreateTool(tool) {
|
|
|
101
101
|
return tokens[0] === "draft" || tokens.some((t) => MCP_DRAFT_CREATE_VERBS.has(t));
|
|
102
102
|
}
|
|
103
103
|
function mcpSendSiblingForDraftTool(tool, availableToolIds) {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
const candidates = [
|
|
105
|
+
...availableToolIds
|
|
106
|
+
].filter((id) => id.endsWith(REVIEWABLE_MCP_SEND_TOOL_SUFFIX)).map((id) => ({
|
|
107
|
+
id,
|
|
108
|
+
serverName: id.slice(0, -REVIEWABLE_MCP_SEND_TOOL_SUFFIX.length)
|
|
109
|
+
})).filter(({ serverName }) => tool.startsWith(`${serverName}_`)).sort((a, b) => b.serverName.length - a.serverName.length);
|
|
110
|
+
return candidates[0]?.id;
|
|
107
111
|
}
|
|
108
112
|
function isReviewableExecuteTool(tool) {
|
|
109
113
|
return isAllowedReviewableExecuteTool(tool) || isReviewableMcpSendTool(tool);
|
|
@@ -341,6 +345,20 @@ function foldRichPartsIntoMessages(messages, records, makeMessage, sameTurnGroup
|
|
|
341
345
|
while (next < synthetic.length) combined.push(synthetic[next++].message);
|
|
342
346
|
return mergeRichPartMirrorMessages(combined, sameTurnGroup);
|
|
343
347
|
}
|
|
348
|
+
function isDesktopFileCommandName(value) {
|
|
349
|
+
return typeof value === "string" && DESKTOP_FILE_COMMAND_SET.has(value);
|
|
350
|
+
}
|
|
351
|
+
function isDesktopFileSessionId(value) {
|
|
352
|
+
return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
353
|
+
}
|
|
354
|
+
function resolveRequireToolApproval(rules) {
|
|
355
|
+
const raw = rules?.requireToolApproval ?? rules?.requireApproval;
|
|
356
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
357
|
+
const list = Array.isArray(raw) ? raw : [
|
|
358
|
+
raw
|
|
359
|
+
];
|
|
360
|
+
return list.filter((t) => typeof t === "string");
|
|
361
|
+
}
|
|
344
362
|
function buildDefaultPersona(agentName) {
|
|
345
363
|
return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || "My Agent");
|
|
346
364
|
}
|
|
@@ -360,7 +378,7 @@ function normalizeLuaJobExecutionTimeoutSeconds(timeout) {
|
|
|
360
378
|
}
|
|
361
379
|
return Math.min(Math.max(timeout, LUA_JOB_MIN_TIMEOUT_SECONDS), LUA_JOB_MAX_TIMEOUT_SECONDS);
|
|
362
380
|
}
|
|
363
|
-
var __defProp2, __name2, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, REASONING_EFFORT_VALUES, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS;
|
|
381
|
+
var __defProp2, __name2, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, REASONING_EFFORT_VALUES, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS;
|
|
364
382
|
var init_dist = __esm({
|
|
365
383
|
"../shared-types/dist/index.mjs"() {
|
|
366
384
|
"use strict";
|
|
@@ -403,7 +421,7 @@ var init_dist = __esm({
|
|
|
403
421
|
REVIEWABLE_MCP_SEND_TOOL_SUFFIX = "_create_messaging_message";
|
|
404
422
|
__name(isReviewableMcpSendTool, "isReviewableMcpSendTool");
|
|
405
423
|
__name2(isReviewableMcpSendTool, "isReviewableMcpSendTool");
|
|
406
|
-
MCP_TOOL_READ_VERB_RE =
|
|
424
|
+
MCP_TOOL_READ_VERB_RE = /(?:^|_)(list|get|search|read|fetch|find|query|describe|count|retrieve|lookup|show|view)(_|[A-Z0-9]|$)/;
|
|
407
425
|
__name(mcpActionTokens, "mcpActionTokens");
|
|
408
426
|
__name2(mcpActionTokens, "mcpActionTokens");
|
|
409
427
|
__name(isReviewableMcpDraftTool, "isReviewableMcpDraftTool");
|
|
@@ -654,6 +672,27 @@ var init_dist = __esm({
|
|
|
654
672
|
}
|
|
655
673
|
];
|
|
656
674
|
BROWSER_COMMAND_NAMES = BROWSER_COMMANDS.map((c) => c.name);
|
|
675
|
+
DESKTOP_FILE_COMMANDS = [
|
|
676
|
+
"files_roots",
|
|
677
|
+
"files_stat",
|
|
678
|
+
"files_list",
|
|
679
|
+
"files_read",
|
|
680
|
+
"files_search",
|
|
681
|
+
"files_write",
|
|
682
|
+
"files_mkdir",
|
|
683
|
+
"files_move",
|
|
684
|
+
"files_delete",
|
|
685
|
+
"files_undo",
|
|
686
|
+
"files_transfer_prepare",
|
|
687
|
+
"files_transfer_upload",
|
|
688
|
+
"files_watch_start",
|
|
689
|
+
"files_watch_cancel"
|
|
690
|
+
];
|
|
691
|
+
DESKTOP_FILE_COMMAND_SET = new Set(DESKTOP_FILE_COMMANDS);
|
|
692
|
+
__name(isDesktopFileCommandName, "isDesktopFileCommandName");
|
|
693
|
+
__name2(isDesktopFileCommandName, "isDesktopFileCommandName");
|
|
694
|
+
__name(isDesktopFileSessionId, "isDesktopFileSessionId");
|
|
695
|
+
__name2(isDesktopFileSessionId, "isDesktopFileSessionId");
|
|
657
696
|
REASONING_EFFORT_VALUES = [
|
|
658
697
|
"off",
|
|
659
698
|
"minimal",
|
|
@@ -662,6 +701,8 @@ var init_dist = __esm({
|
|
|
662
701
|
"high",
|
|
663
702
|
"max"
|
|
664
703
|
];
|
|
704
|
+
__name(resolveRequireToolApproval, "resolveRequireToolApproval");
|
|
705
|
+
__name2(resolveRequireToolApproval, "resolveRequireToolApproval");
|
|
665
706
|
AGENT_NAME_TOKEN = "[Your Agent Name]";
|
|
666
707
|
DEFAULT_PERSONA_GUIDE = `# ${AGENT_NAME_TOKEN} - Persona
|
|
667
708
|
|