lua-cli 3.21.0 → 3.22.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 +29 -0
- package/dist/api-exports.js +24 -0
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +148 -25
- package/dist/index.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/api/Templates.md +24 -1
- package/package.json +3 -3
- package/template/package.json +1 -1
package/dist/api-exports.d.ts
CHANGED
|
@@ -2717,12 +2717,30 @@ export declare interface LuaRuntime {
|
|
|
2717
2717
|
* // Or add tools after construction
|
|
2718
2718
|
* skill.addTool(anotherTool);
|
|
2719
2719
|
* ```
|
|
2720
|
+
*
|
|
2721
|
+
* @example
|
|
2722
|
+
* ```typescript
|
|
2723
|
+
* // Skill with condition - the whole skill is hidden from non-premium users
|
|
2724
|
+
* class PremiumSkill extends LuaSkill {
|
|
2725
|
+
* name = "premium-skill";
|
|
2726
|
+
* description = "Advanced tools for premium users";
|
|
2727
|
+
* context = "Use these tools for premium workflows.";
|
|
2728
|
+
* tools = [premiumSearchTool];
|
|
2729
|
+
*
|
|
2730
|
+
* // Condition runs before the skill's tools and context reach the LLM
|
|
2731
|
+
* condition = async () => {
|
|
2732
|
+
* const user = await User.get();
|
|
2733
|
+
* return user.data?.isPremium === true;
|
|
2734
|
+
* };
|
|
2735
|
+
* }
|
|
2736
|
+
* ```
|
|
2720
2737
|
*/
|
|
2721
2738
|
export declare class LuaSkill {
|
|
2722
2739
|
private readonly tools;
|
|
2723
2740
|
private readonly name;
|
|
2724
2741
|
private readonly description;
|
|
2725
2742
|
private readonly context;
|
|
2743
|
+
private readonly condition?;
|
|
2726
2744
|
/**
|
|
2727
2745
|
* Creates a new LuaSkill instance.
|
|
2728
2746
|
*
|
|
@@ -2731,9 +2749,11 @@ export declare class LuaSkill {
|
|
|
2731
2749
|
* @param config.description - Short description of what the skill does (1-2 sentences)
|
|
2732
2750
|
* @param config.context - Detailed explanation of how the agent should use the tools
|
|
2733
2751
|
* @param config.tools - Optional array of tools to add immediately
|
|
2752
|
+
* @param config.condition - Optional async gate; false hides the skill's tools and context
|
|
2734
2753
|
*/
|
|
2735
2754
|
constructor(config: LuaSkillConfig);
|
|
2736
2755
|
getContext(): SkillContextText;
|
|
2756
|
+
getCondition(): (() => Promise<boolean>) | undefined;
|
|
2737
2757
|
/**
|
|
2738
2758
|
* Adds a single tool to the skill.
|
|
2739
2759
|
* Tool name is validated before being added.
|
|
@@ -2775,6 +2795,12 @@ declare interface LuaSkillConfig {
|
|
|
2775
2795
|
context: SkillContextText;
|
|
2776
2796
|
/** Optional array of tools to add during construction */
|
|
2777
2797
|
tools?: LuaTool<any>[];
|
|
2798
|
+
/**
|
|
2799
|
+
* Optional async function that determines if the whole skill should be
|
|
2800
|
+
* available. When it returns false the skill's tools are hidden AND the
|
|
2801
|
+
* skill's context is left out of the agent prompt.
|
|
2802
|
+
*/
|
|
2803
|
+
condition?: () => Promise<boolean>;
|
|
2778
2804
|
}
|
|
2779
2805
|
|
|
2780
2806
|
export declare interface LuaTool<TInput extends ZodType = ZodType> {
|
|
@@ -5038,6 +5064,9 @@ export declare interface SendTemplateValues {
|
|
|
5038
5064
|
image_url?: string;
|
|
5039
5065
|
video_url?: string;
|
|
5040
5066
|
document_url?: string;
|
|
5067
|
+
image_id?: string;
|
|
5068
|
+
video_id?: string;
|
|
5069
|
+
document_id?: string;
|
|
5041
5070
|
document_filename?: string;
|
|
5042
5071
|
};
|
|
5043
5072
|
body?: Record<string, string>;
|
package/dist/api-exports.js
CHANGED
|
@@ -2233,6 +2233,18 @@ var init_skill_handler = __esm({
|
|
|
2233
2233
|
return toolData;
|
|
2234
2234
|
}).filter(Boolean);
|
|
2235
2235
|
const sourceArchive = buildSourceArchive(archiveEntries);
|
|
2236
|
+
let condition;
|
|
2237
|
+
let conditionS3Hash;
|
|
2238
|
+
if (skill.hasCondition) {
|
|
2239
|
+
const skillCode = loadArtifact(skill, projectPath);
|
|
2240
|
+
if (bundleAccumulator) {
|
|
2241
|
+
const rawGzip = compressForPushRaw(skillCode);
|
|
2242
|
+
conditionS3Hash = hashBundle(rawGzip);
|
|
2243
|
+
bundleAccumulator.set(conditionS3Hash, rawGzip);
|
|
2244
|
+
} else {
|
|
2245
|
+
condition = compressForPush(skillCode);
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2236
2248
|
return {
|
|
2237
2249
|
name: skill.name,
|
|
2238
2250
|
description: skill.description,
|
|
@@ -2241,6 +2253,12 @@ var init_skill_handler = __esm({
|
|
|
2241
2253
|
context: skill.context
|
|
2242
2254
|
} : {},
|
|
2243
2255
|
tools,
|
|
2256
|
+
...condition ? {
|
|
2257
|
+
condition
|
|
2258
|
+
} : {},
|
|
2259
|
+
...conditionS3Hash ? {
|
|
2260
|
+
conditionS3Hash
|
|
2261
|
+
} : {},
|
|
2244
2262
|
...sourceArchive ? {
|
|
2245
2263
|
sourceArchive,
|
|
2246
2264
|
archiveSchemaVersion: SOURCE_ARCHIVE_SCHEMA_VERSION
|
|
@@ -5945,6 +5963,7 @@ var LuaSkill = class {
|
|
|
5945
5963
|
name;
|
|
5946
5964
|
description;
|
|
5947
5965
|
context;
|
|
5966
|
+
condition;
|
|
5948
5967
|
/**
|
|
5949
5968
|
* Creates a new LuaSkill instance.
|
|
5950
5969
|
*
|
|
@@ -5953,6 +5972,7 @@ var LuaSkill = class {
|
|
|
5953
5972
|
* @param config.description - Short description of what the skill does (1-2 sentences)
|
|
5954
5973
|
* @param config.context - Detailed explanation of how the agent should use the tools
|
|
5955
5974
|
* @param config.tools - Optional array of tools to add immediately
|
|
5975
|
+
* @param config.condition - Optional async gate; false hides the skill's tools and context
|
|
5956
5976
|
*/
|
|
5957
5977
|
constructor(config) {
|
|
5958
5978
|
if (!config.name || !config.name.trim()) {
|
|
@@ -5961,6 +5981,7 @@ var LuaSkill = class {
|
|
|
5961
5981
|
this.name = config.name;
|
|
5962
5982
|
this.description = config.description;
|
|
5963
5983
|
this.context = config.context;
|
|
5984
|
+
this.condition = config.condition;
|
|
5964
5985
|
if (typeof this.context === "object") {
|
|
5965
5986
|
if (!this.context.base && !this.context.voice && !this.context.text) {
|
|
5966
5987
|
throw new Error("Skill context object must have at least one of: base, voice, text");
|
|
@@ -5973,6 +5994,9 @@ var LuaSkill = class {
|
|
|
5973
5994
|
getContext() {
|
|
5974
5995
|
return this.context;
|
|
5975
5996
|
}
|
|
5997
|
+
getCondition() {
|
|
5998
|
+
return this.condition;
|
|
5999
|
+
}
|
|
5976
6000
|
/**
|
|
5977
6001
|
* Adds a single tool to the skill.
|
|
5978
6002
|
* Tool name is validated before being added.
|