lua-cli 3.9.2 → 3.9.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/README.md +90 -2
- package/dist/api/agent.api.service.d.ts +8 -0
- package/dist/api/agent.api.service.d.ts.map +1 -1
- package/dist/api/agent.api.service.js +12 -0
- package/dist/api/agent.api.service.js.map +1 -1
- package/dist/cli/command-definitions.d.ts.map +1 -1
- package/dist/cli/command-definitions.js +25 -22
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +2 -11
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/apiKey.d.ts +1 -21
- package/dist/commands/apiKey.d.ts.map +1 -1
- package/dist/commands/apiKey.js +7 -25
- package/dist/commands/apiKey.js.map +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +11 -3
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/configure.d.ts +2 -2
- package/dist/commands/configure.js +2 -2
- package/dist/commands/destroy.d.ts +0 -24
- package/dist/commands/destroy.d.ts.map +1 -1
- package/dist/commands/destroy.js +8 -30
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +102 -39
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/jobs.js +29 -9
- package/dist/commands/jobs.js.map +1 -1
- package/dist/compiler/source-writer.d.ts.map +1 -1
- package/dist/compiler/source-writer.js +22 -1
- package/dist/compiler/source-writer.js.map +1 -1
- package/dist/config/constants.d.ts +7 -11
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +7 -11
- package/dist/config/constants.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/interfaces/agent.d.ts +11 -0
- package/dist/interfaces/agent.d.ts.map +1 -1
- package/dist/services/analytics.d.ts.map +1 -1
- package/dist/services/analytics.js +6 -2
- package/dist/services/analytics.js.map +1 -1
- package/dist/services/auth.d.ts +16 -26
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/auth.js +45 -101
- package/dist/services/auth.js.map +1 -1
- package/dist/types/skill.js.map +1 -1
- package/dist/utils/auth-flows.d.ts.map +1 -1
- package/dist/utils/auth-flows.js +8 -12
- package/dist/utils/auth-flows.js.map +1 -1
- package/dist/utils/cli.d.ts.map +1 -1
- package/dist/utils/cli.js +2 -3
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/command-utils.d.ts +4 -3
- package/dist/utils/command-utils.d.ts.map +1 -1
- package/dist/utils/command-utils.js +9 -20
- package/dist/utils/command-utils.js.map +1 -1
- package/dist/utils/init-agent.d.ts +30 -1
- package/dist/utils/init-agent.d.ts.map +1 -1
- package/dist/utils/init-agent.js +56 -1
- package/dist/utils/init-agent.js.map +1 -1
- package/dist/utils/init-helpers.d.ts +2 -1
- package/dist/utils/init-helpers.d.ts.map +1 -1
- package/dist/utils/init-helpers.js +3 -2
- package/dist/utils/init-helpers.js.map +1 -1
- package/dist/utils/init-prompts.d.ts +10 -0
- package/dist/utils/init-prompts.d.ts.map +1 -1
- package/dist/utils/init-prompts.js +42 -2
- package/dist/utils/init-prompts.js.map +1 -1
- package/dist/utils/sandbox-storage.d.ts +18 -18
- package/dist/utils/sandbox-storage.d.ts.map +1 -1
- package/dist/utils/sandbox-storage.js +77 -101
- package/dist/utils/sandbox-storage.js.map +1 -1
- package/docs/README.md +3 -3
- package/node_modules/@lua/shared-types/dist/index.d.mts +54 -1
- package/node_modules/@lua/shared-types/dist/index.d.ts +54 -1
- package/node_modules/@lua/shared-types/dist/index.js +114 -0
- package/node_modules/@lua/shared-types/dist/index.mjs +109 -0
- package/package.json +5 -7
- package/template/package.json +1 -1
- package/dist/utils/keytar-loader.d.ts +0 -20
- package/dist/utils/keytar-loader.d.ts.map +0 -1
- package/dist/utils/keytar-loader.js +0 -35
- package/dist/utils/keytar-loader.js.map +0 -1
|
@@ -17,9 +17,10 @@ export declare function getTemplateDir(): string;
|
|
|
17
17
|
* @param agentName - Optional agent name
|
|
18
18
|
* @param withExamples - Whether to include example skills, tools, jobs, etc. (default: false)
|
|
19
19
|
* @param skipSourceTemplates - Whether to skip src/ templates (if sources restored from backup)
|
|
20
|
+
* @param model - Optional LLM model code (e.g. 'openai/gpt-4o')
|
|
20
21
|
* @returns Current working directory
|
|
21
22
|
*/
|
|
22
|
-
export declare function initializeProject(agentId: string, orgId: string, persona?: string, agentName?: string, withExamples?: boolean, skipSourceTemplates?: boolean): string;
|
|
23
|
+
export declare function initializeProject(agentId: string, orgId: string, persona?: string, agentName?: string, withExamples?: boolean, skipSourceTemplates?: boolean, model?: string): string;
|
|
23
24
|
/**
|
|
24
25
|
* Installs npm dependencies for the project.
|
|
25
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/init-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED
|
|
1
|
+
{"version":3,"file":"init-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/init-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,GAAE,OAAe,EAC7B,mBAAmB,GAAE,OAAe,EACpC,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAwBR;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS3E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAI1D"}
|
|
@@ -27,9 +27,10 @@ export function getTemplateDir() {
|
|
|
27
27
|
* @param agentName - Optional agent name
|
|
28
28
|
* @param withExamples - Whether to include example skills, tools, jobs, etc. (default: false)
|
|
29
29
|
* @param skipSourceTemplates - Whether to skip src/ templates (if sources restored from backup)
|
|
30
|
+
* @param model - Optional LLM model code (e.g. 'openai/gpt-4o')
|
|
30
31
|
* @returns Current working directory
|
|
31
32
|
*/
|
|
32
|
-
export function initializeProject(agentId, orgId, persona, agentName, withExamples = false, skipSourceTemplates = false) {
|
|
33
|
+
export function initializeProject(agentId, orgId, persona, agentName, withExamples = false, skipSourceTemplates = false, model) {
|
|
33
34
|
const templateDir = getTemplateDir();
|
|
34
35
|
const currentDir = process.cwd();
|
|
35
36
|
copyTemplateFiles(templateDir, currentDir, withExamples, skipSourceTemplates);
|
|
@@ -37,7 +38,7 @@ export function initializeProject(agentId, orgId, persona, agentName, withExampl
|
|
|
37
38
|
updateYamlAgent(agentId, orgId);
|
|
38
39
|
// Update LuaAgent in index.ts with agent configuration (only if src/ was created)
|
|
39
40
|
if (!skipSourceTemplates) {
|
|
40
|
-
updateAgentConfig({ name: agentName, persona }, { projectDir: currentDir });
|
|
41
|
+
updateAgentConfig({ name: agentName, persona, model }, { projectDir: currentDir });
|
|
41
42
|
writeProgress("✅ Updated LuaAgent configuration");
|
|
42
43
|
}
|
|
43
44
|
writeProgress("✅ Created lua.skill.yaml");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-helpers.js","sourceRoot":"","sources":["../../src/utils/init-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3D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all interactive prompts for agent initialization
|
|
4
4
|
*/
|
|
5
5
|
import { AgentChoiceType, SelectedAgent, SelectedOrg, OrganizationData } from '../interfaces/init.js';
|
|
6
|
+
import { ApprovedModel } from '../interfaces/agent.js';
|
|
6
7
|
/**
|
|
7
8
|
* Prompts user to choose between existing or new agent.
|
|
8
9
|
*
|
|
@@ -37,6 +38,15 @@ export declare function promptMetadataCollection(requiredFields: string[]): Prom
|
|
|
37
38
|
* @returns Agent name
|
|
38
39
|
*/
|
|
39
40
|
export declare function promptAgentName(): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Prompts user to select an LLM model from the list of approved models.
|
|
43
|
+
* Presents a searchable list grouped by provider. The user can type to filter.
|
|
44
|
+
* Returns undefined if the user skips (uses platform default).
|
|
45
|
+
*
|
|
46
|
+
* @param models - Pre-fetched array of approved models from the API
|
|
47
|
+
* @returns Selected model code (e.g. 'openai/gpt-4o') or undefined if skipped
|
|
48
|
+
*/
|
|
49
|
+
export declare function promptModelSelection(models: ApprovedModel[]): Promise<string | undefined>;
|
|
40
50
|
/**
|
|
41
51
|
* Displays persona configuration instructions after agent creation.
|
|
42
52
|
* Guides user to configure persona in dashboard or code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-prompts.d.ts","sourceRoot":"","sources":["../../src/utils/init-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,eAAe,EACf,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"init-prompts.d.ts","sourceRoot":"","sources":["../../src/utils/init-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,eAAe,EACf,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,eAAe,CAAC,CAclE;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAgBhG;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAoBnF;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAgBrG;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAWvD;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoC/F;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CA6BjD"}
|
|
@@ -14,9 +14,9 @@ export async function promptAgentChoice() {
|
|
|
14
14
|
{
|
|
15
15
|
type: "list",
|
|
16
16
|
name: "agentChoice",
|
|
17
|
-
message: "How would you like to
|
|
17
|
+
message: "How would you like to set up your AI Agent?",
|
|
18
18
|
choices: [
|
|
19
|
-
{ name: "
|
|
19
|
+
{ name: "Use one of your existing agents", value: "existing" },
|
|
20
20
|
{ name: "Create a new agent", value: "create" }
|
|
21
21
|
]
|
|
22
22
|
}
|
|
@@ -106,6 +106,46 @@ export async function promptAgentName() {
|
|
|
106
106
|
]);
|
|
107
107
|
return agentName;
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Prompts user to select an LLM model from the list of approved models.
|
|
111
|
+
* Presents a searchable list grouped by provider. The user can type to filter.
|
|
112
|
+
* Returns undefined if the user skips (uses platform default).
|
|
113
|
+
*
|
|
114
|
+
* @param models - Pre-fetched array of approved models from the API
|
|
115
|
+
* @returns Selected model code (e.g. 'openai/gpt-4o') or undefined if skipped
|
|
116
|
+
*/
|
|
117
|
+
export async function promptModelSelection(models) {
|
|
118
|
+
if (models.length === 0) {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
const SKIP_VALUE = '__skip__';
|
|
122
|
+
// Group models by provider for display
|
|
123
|
+
const providers = [...new Set(models.map(m => m.provider))].sort();
|
|
124
|
+
const choices = [
|
|
125
|
+
{ name: 'Skip — use platform default', value: SKIP_VALUE },
|
|
126
|
+
];
|
|
127
|
+
for (const provider of providers) {
|
|
128
|
+
const providerModels = models.filter(m => m.provider === provider);
|
|
129
|
+
choices.push(new inquirer.Separator(` ── ${provider} ──`));
|
|
130
|
+
for (const m of providerModels) {
|
|
131
|
+
choices.push({
|
|
132
|
+
name: `${chalk.bold(m.code)} ${chalk.gray(m.description)}`,
|
|
133
|
+
value: m.code,
|
|
134
|
+
short: m.code,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const { selectedModel } = await inquirer.prompt([
|
|
139
|
+
{
|
|
140
|
+
type: 'list',
|
|
141
|
+
name: 'selectedModel',
|
|
142
|
+
message: 'LLM model: (type to filter)',
|
|
143
|
+
choices,
|
|
144
|
+
pageSize: 14,
|
|
145
|
+
}
|
|
146
|
+
]);
|
|
147
|
+
return selectedModel === SKIP_VALUE ? undefined : selectedModel;
|
|
148
|
+
}
|
|
109
149
|
/**
|
|
110
150
|
* Displays persona configuration instructions after agent creation.
|
|
111
151
|
* Guides user to configure persona in dashboard or code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-prompts.js","sourceRoot":"","sources":["../../src/utils/init-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"init-prompts.js","sourceRoot":"","sources":["../../src/utils/init-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAQh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andbox primitive IDs using a local JSON file
|
|
4
|
+
* at ~/.lua-cli/sandbox.json. Replaces the previous keytar-based implementation.
|
|
4
5
|
*/
|
|
5
6
|
import { SkillOverride } from '../interfaces/dev.js';
|
|
6
7
|
import { YamlConfig } from '../types/yaml.types.js';
|
|
7
8
|
/**
|
|
8
|
-
* Retrieves sandbox skill ID from
|
|
9
|
+
* Retrieves sandbox skill ID from local storage.
|
|
9
10
|
*
|
|
10
11
|
* @param skillName - Optional skill name for multi-skill projects
|
|
11
12
|
* @returns The sandbox skill ID or null if not found
|
|
12
13
|
*/
|
|
13
14
|
export declare function getSandboxSkillId(skillName?: string): Promise<string | null>;
|
|
14
15
|
/**
|
|
15
|
-
* Stores sandbox skill ID in
|
|
16
|
+
* Stores sandbox skill ID in local storage.
|
|
16
17
|
*
|
|
17
18
|
* @param sandboxId - The sandbox skill ID to store
|
|
18
19
|
* @param skillName - Optional skill name for multi-skill projects
|
|
@@ -20,50 +21,49 @@ export declare function getSandboxSkillId(skillName?: string): Promise<string |
|
|
|
20
21
|
export declare function setSandboxSkillId(sandboxId: string, skillName?: string): Promise<void>;
|
|
21
22
|
/**
|
|
22
23
|
* Retrieves all sandbox skill IDs for all skills in the project.
|
|
23
|
-
* Uses YAML config to get skill names and IDs.
|
|
24
24
|
*
|
|
25
25
|
* @param yamlConfig - The lua.skill.yaml config containing skill information
|
|
26
26
|
* @returns Array of skill overrides with skillId and sandboxId pairs
|
|
27
27
|
*/
|
|
28
28
|
export declare function getAllSandboxSkillIds(yamlConfig: YamlConfig): Promise<SkillOverride[]>;
|
|
29
29
|
/**
|
|
30
|
-
* Retrieves sandbox preprocessor ID from
|
|
30
|
+
* Retrieves sandbox preprocessor ID from local storage.
|
|
31
31
|
*
|
|
32
32
|
* @param preprocessorName - Preprocessor name
|
|
33
33
|
* @returns The sandbox preprocessor ID or null if not found
|
|
34
34
|
*/
|
|
35
35
|
export declare function getSandboxPreProcessorId(preprocessorName: string): Promise<string | null>;
|
|
36
36
|
/**
|
|
37
|
-
* Stores sandbox preprocessor ID in
|
|
37
|
+
* Stores sandbox preprocessor ID in local storage.
|
|
38
38
|
*
|
|
39
39
|
* @param sandboxId - The sandbox preprocessor ID to store
|
|
40
40
|
* @param preprocessorName - Preprocessor name
|
|
41
41
|
*/
|
|
42
42
|
export declare function setSandboxPreProcessorId(sandboxId: string, preprocessorName: string): Promise<void>;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Gets all sandbox preprocessor overrides for the current config.
|
|
45
|
+
*
|
|
46
|
+
* @param config - Configuration with preprocessors
|
|
47
|
+
* @returns Array of preprocessor overrides
|
|
48
|
+
*/
|
|
49
|
+
export declare function getAllSandboxPreProcessorIds(config: YamlConfig): Promise<Array<{
|
|
50
|
+
preprocessorId: string;
|
|
51
|
+
sandboxId: string;
|
|
52
|
+
}>>;
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves sandbox postprocessor ID from local storage.
|
|
45
55
|
*
|
|
46
56
|
* @param postprocessorName - Postprocessor name
|
|
47
57
|
* @returns The sandbox postprocessor ID or null if not found
|
|
48
58
|
*/
|
|
49
59
|
export declare function getSandboxPostProcessorId(postprocessorName: string): Promise<string | null>;
|
|
50
60
|
/**
|
|
51
|
-
* Stores sandbox postprocessor ID in
|
|
61
|
+
* Stores sandbox postprocessor ID in local storage.
|
|
52
62
|
*
|
|
53
63
|
* @param sandboxId - The sandbox postprocessor ID to store
|
|
54
64
|
* @param postprocessorName - Postprocessor name
|
|
55
65
|
*/
|
|
56
66
|
export declare function setSandboxPostProcessorId(sandboxId: string, postprocessorName: string): Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Gets all sandbox preprocessor overrides for the current config.
|
|
59
|
-
*
|
|
60
|
-
* @param config - Configuration with preprocessors
|
|
61
|
-
* @returns Array of preprocessor overrides
|
|
62
|
-
*/
|
|
63
|
-
export declare function getAllSandboxPreProcessorIds(config: YamlConfig): Promise<Array<{
|
|
64
|
-
preprocessorId: string;
|
|
65
|
-
sandboxId: string;
|
|
66
|
-
}>>;
|
|
67
67
|
/**
|
|
68
68
|
* Gets all sandbox postprocessor overrides for the current config.
|
|
69
69
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-storage.d.ts","sourceRoot":"","sources":["../../src/utils/sandbox-storage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sandbox-storage.d.ts","sourceRoot":"","sources":["../../src/utils/sandbox-storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAwCpD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAIlF;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK5F;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAmB5F;AAMD;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAG/F;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIzG;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAmBpI;AAMD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGjG;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3G;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAmBtI"}
|
|
@@ -1,53 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sandbox Storage Utilities
|
|
3
|
-
* Handles
|
|
3
|
+
* Handles storage and retrieval of sandbox primitive IDs using a local JSON file
|
|
4
|
+
* at ~/.lua-cli/sandbox.json. Replaces the previous keytar-based implementation.
|
|
4
5
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
7
|
+
import { dirname } from 'path';
|
|
8
|
+
import { SANDBOX_STORAGE_FILE } from '../config/constants.js';
|
|
7
9
|
import { skillHandler, preprocessorHandler, postprocessorHandler } from '../primitives/index.js';
|
|
10
|
+
function readStore() {
|
|
11
|
+
try {
|
|
12
|
+
const raw = readFileSync(SANDBOX_STORAGE_FILE, 'utf8');
|
|
13
|
+
const parsed = JSON.parse(raw);
|
|
14
|
+
return {
|
|
15
|
+
skills: parsed.skills ?? {},
|
|
16
|
+
preprocessors: parsed.preprocessors ?? {},
|
|
17
|
+
postprocessors: parsed.postprocessors ?? {},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return { skills: {}, preprocessors: {}, postprocessors: {} };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function writeStore(store) {
|
|
25
|
+
try {
|
|
26
|
+
mkdirSync(dirname(SANDBOX_STORAGE_FILE), { recursive: true });
|
|
27
|
+
writeFileSync(SANDBOX_STORAGE_FILE, JSON.stringify(store, null, 2), 'utf8');
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Silently ignore write failures — sandbox IDs are transient dev-time values
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// Skill sandbox IDs
|
|
35
|
+
// =============================================================================
|
|
8
36
|
/**
|
|
9
|
-
* Retrieves sandbox skill ID from
|
|
37
|
+
* Retrieves sandbox skill ID from local storage.
|
|
10
38
|
*
|
|
11
39
|
* @param skillName - Optional skill name for multi-skill projects
|
|
12
40
|
* @returns The sandbox skill ID or null if not found
|
|
13
41
|
*/
|
|
14
42
|
export async function getSandboxSkillId(skillName) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
const account = skillName
|
|
20
|
-
? `${SANDBOX_STORAGE.ACCOUNT}_${skillName}`
|
|
21
|
-
: SANDBOX_STORAGE.ACCOUNT;
|
|
22
|
-
return await keytar.getPassword(SANDBOX_STORAGE.SERVICE, account);
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
43
|
+
const store = readStore();
|
|
44
|
+
const key = skillName ?? '__default__';
|
|
45
|
+
return store.skills[key] ?? null;
|
|
27
46
|
}
|
|
28
47
|
/**
|
|
29
|
-
* Stores sandbox skill ID in
|
|
48
|
+
* Stores sandbox skill ID in local storage.
|
|
30
49
|
*
|
|
31
50
|
* @param sandboxId - The sandbox skill ID to store
|
|
32
51
|
* @param skillName - Optional skill name for multi-skill projects
|
|
33
52
|
*/
|
|
34
53
|
export async function setSandboxSkillId(sandboxId, skillName) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const account = skillName
|
|
40
|
-
? `${SANDBOX_STORAGE.ACCOUNT}_${skillName}`
|
|
41
|
-
: SANDBOX_STORAGE.ACCOUNT;
|
|
42
|
-
await keytar.setPassword(SANDBOX_STORAGE.SERVICE, account, sandboxId);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
// Ignore storage errors
|
|
46
|
-
}
|
|
54
|
+
const store = readStore();
|
|
55
|
+
const key = skillName ?? '__default__';
|
|
56
|
+
store.skills[key] = sandboxId;
|
|
57
|
+
writeStore(store);
|
|
47
58
|
}
|
|
48
59
|
/**
|
|
49
60
|
* Retrieves all sandbox skill IDs for all skills in the project.
|
|
50
|
-
* Uses YAML config to get skill names and IDs.
|
|
51
61
|
*
|
|
52
62
|
* @param yamlConfig - The lua.skill.yaml config containing skill information
|
|
53
63
|
* @returns Array of skill overrides with skillId and sandboxId pairs
|
|
@@ -56,15 +66,11 @@ export async function getAllSandboxSkillIds(yamlConfig) {
|
|
|
56
66
|
try {
|
|
57
67
|
const skills = skillHandler.getFromYaml(yamlConfig);
|
|
58
68
|
const skillOverrides = [];
|
|
59
|
-
// For each skill in YAML, get its sandbox ID
|
|
60
69
|
for (const skill of skills) {
|
|
61
70
|
if (skill.skillId && skill.name) {
|
|
62
71
|
const sandboxId = await getSandboxSkillId(skill.name);
|
|
63
72
|
if (sandboxId) {
|
|
64
|
-
skillOverrides.push({
|
|
65
|
-
skillId: skill.skillId,
|
|
66
|
-
sandboxId: sandboxId
|
|
67
|
-
});
|
|
73
|
+
skillOverrides.push({ skillId: skill.skillId, sandboxId });
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
76
|
}
|
|
@@ -75,77 +81,29 @@ export async function getAllSandboxSkillIds(yamlConfig) {
|
|
|
75
81
|
return [];
|
|
76
82
|
}
|
|
77
83
|
}
|
|
84
|
+
// =============================================================================
|
|
85
|
+
// Preprocessor sandbox IDs
|
|
86
|
+
// =============================================================================
|
|
78
87
|
/**
|
|
79
|
-
* Retrieves sandbox preprocessor ID from
|
|
88
|
+
* Retrieves sandbox preprocessor ID from local storage.
|
|
80
89
|
*
|
|
81
90
|
* @param preprocessorName - Preprocessor name
|
|
82
91
|
* @returns The sandbox preprocessor ID or null if not found
|
|
83
92
|
*/
|
|
84
93
|
export async function getSandboxPreProcessorId(preprocessorName) {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
return null;
|
|
88
|
-
try {
|
|
89
|
-
const account = `${SANDBOX_STORAGE.ACCOUNT}_preprocessor_${preprocessorName}`;
|
|
90
|
-
return await keytar.getPassword(SANDBOX_STORAGE.SERVICE, account);
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
94
|
+
const store = readStore();
|
|
95
|
+
return store.preprocessors[preprocessorName] ?? null;
|
|
95
96
|
}
|
|
96
97
|
/**
|
|
97
|
-
* Stores sandbox preprocessor ID in
|
|
98
|
+
* Stores sandbox preprocessor ID in local storage.
|
|
98
99
|
*
|
|
99
100
|
* @param sandboxId - The sandbox preprocessor ID to store
|
|
100
101
|
* @param preprocessorName - Preprocessor name
|
|
101
102
|
*/
|
|
102
103
|
export async function setSandboxPreProcessorId(sandboxId, preprocessorName) {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
const account = `${SANDBOX_STORAGE.ACCOUNT}_preprocessor_${preprocessorName}`;
|
|
108
|
-
await keytar.setPassword(SANDBOX_STORAGE.SERVICE, account, sandboxId);
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
// Ignore storage errors
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Retrieves sandbox postprocessor ID from secure storage.
|
|
116
|
-
*
|
|
117
|
-
* @param postprocessorName - Postprocessor name
|
|
118
|
-
* @returns The sandbox postprocessor ID or null if not found
|
|
119
|
-
*/
|
|
120
|
-
export async function getSandboxPostProcessorId(postprocessorName) {
|
|
121
|
-
const keytar = await getKeytar();
|
|
122
|
-
if (!keytar)
|
|
123
|
-
return null;
|
|
124
|
-
try {
|
|
125
|
-
const account = `${SANDBOX_STORAGE.ACCOUNT}_postprocessor_${postprocessorName}`;
|
|
126
|
-
return await keytar.getPassword(SANDBOX_STORAGE.SERVICE, account);
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Stores sandbox postprocessor ID in secure storage.
|
|
134
|
-
*
|
|
135
|
-
* @param sandboxId - The sandbox postprocessor ID to store
|
|
136
|
-
* @param postprocessorName - Postprocessor name
|
|
137
|
-
*/
|
|
138
|
-
export async function setSandboxPostProcessorId(sandboxId, postprocessorName) {
|
|
139
|
-
const keytar = await getKeytar();
|
|
140
|
-
if (!keytar)
|
|
141
|
-
return;
|
|
142
|
-
try {
|
|
143
|
-
const account = `${SANDBOX_STORAGE.ACCOUNT}_postprocessor_${postprocessorName}`;
|
|
144
|
-
await keytar.setPassword(SANDBOX_STORAGE.SERVICE, account, sandboxId);
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
// Ignore storage errors
|
|
148
|
-
}
|
|
104
|
+
const store = readStore();
|
|
105
|
+
store.preprocessors[preprocessorName] = sandboxId;
|
|
106
|
+
writeStore(store);
|
|
149
107
|
}
|
|
150
108
|
/**
|
|
151
109
|
* Gets all sandbox preprocessor overrides for the current config.
|
|
@@ -161,10 +119,7 @@ export async function getAllSandboxPreProcessorIds(config) {
|
|
|
161
119
|
if (preprocessor.preprocessorId && preprocessor.name) {
|
|
162
120
|
const sandboxId = await getSandboxPreProcessorId(preprocessor.name);
|
|
163
121
|
if (sandboxId) {
|
|
164
|
-
overrides.push({
|
|
165
|
-
preprocessorId: preprocessor.preprocessorId,
|
|
166
|
-
sandboxId: sandboxId
|
|
167
|
-
});
|
|
122
|
+
overrides.push({ preprocessorId: preprocessor.preprocessorId, sandboxId });
|
|
168
123
|
}
|
|
169
124
|
}
|
|
170
125
|
}
|
|
@@ -174,6 +129,30 @@ export async function getAllSandboxPreProcessorIds(config) {
|
|
|
174
129
|
}
|
|
175
130
|
return overrides;
|
|
176
131
|
}
|
|
132
|
+
// =============================================================================
|
|
133
|
+
// Postprocessor sandbox IDs
|
|
134
|
+
// =============================================================================
|
|
135
|
+
/**
|
|
136
|
+
* Retrieves sandbox postprocessor ID from local storage.
|
|
137
|
+
*
|
|
138
|
+
* @param postprocessorName - Postprocessor name
|
|
139
|
+
* @returns The sandbox postprocessor ID or null if not found
|
|
140
|
+
*/
|
|
141
|
+
export async function getSandboxPostProcessorId(postprocessorName) {
|
|
142
|
+
const store = readStore();
|
|
143
|
+
return store.postprocessors[postprocessorName] ?? null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Stores sandbox postprocessor ID in local storage.
|
|
147
|
+
*
|
|
148
|
+
* @param sandboxId - The sandbox postprocessor ID to store
|
|
149
|
+
* @param postprocessorName - Postprocessor name
|
|
150
|
+
*/
|
|
151
|
+
export async function setSandboxPostProcessorId(sandboxId, postprocessorName) {
|
|
152
|
+
const store = readStore();
|
|
153
|
+
store.postprocessors[postprocessorName] = sandboxId;
|
|
154
|
+
writeStore(store);
|
|
155
|
+
}
|
|
177
156
|
/**
|
|
178
157
|
* Gets all sandbox postprocessor overrides for the current config.
|
|
179
158
|
*
|
|
@@ -188,10 +167,7 @@ export async function getAllSandboxPostProcessorIds(config) {
|
|
|
188
167
|
if (postprocessor.postprocessorId && postprocessor.name) {
|
|
189
168
|
const sandboxId = await getSandboxPostProcessorId(postprocessor.name);
|
|
190
169
|
if (sandboxId) {
|
|
191
|
-
overrides.push({
|
|
192
|
-
postprocessorId: postprocessor.postprocessorId,
|
|
193
|
-
sandboxId: sandboxId
|
|
194
|
-
});
|
|
170
|
+
overrides.push({ postprocessorId: postprocessor.postprocessorId, sandboxId });
|
|
195
171
|
}
|
|
196
172
|
}
|
|
197
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-storage.js","sourceRoot":"","sources":["../../src/utils/sandb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comprehensive API documentation for lua-cli v3.
|
|
3
|
+
Welcome to the comprehensive API documentation for lua-cli v3.9.3. This guide covers every API, class, and function exported by the package.
|
|
4
4
|
|
|
5
5
|
## 📚 Documentation Index
|
|
6
6
|
|
|
@@ -245,8 +245,8 @@ Each API doc includes:
|
|
|
245
245
|
|
|
246
246
|
---
|
|
247
247
|
|
|
248
|
-
**Version:** 3.
|
|
249
|
-
**Last Updated:**
|
|
248
|
+
**Version:** 3.9.3
|
|
249
|
+
**Last Updated:** April 2026
|
|
250
250
|
|
|
251
251
|
---
|
|
252
252
|
|
|
@@ -89,4 +89,57 @@ interface AiGenerateOutput {
|
|
|
89
89
|
*/
|
|
90
90
|
declare function aiGenerateInputFromSimplified(prompt: string, content?: UserContent): AiGenerateInput;
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Sandbox contract: defines what every sandbox MUST expose.
|
|
94
|
+
* Both lua-cli and lua-core test against this contract.
|
|
95
|
+
* Update this file when adding new globals or primitives.
|
|
96
|
+
*/
|
|
97
|
+
declare const REQUIRED_PRIMITIVE_SHIMS: readonly ["LuaTool", "LuaSkill", "LuaJob", "LuaWebhook", "PreProcessor", "LuaPreprocessor", "PostProcessor", "LuaPostprocessor", "LuaMCPServer", "defineTool", "defineSkill", "defineJob", "defineWebhook", "definePreProcessor", "definePostProcessor", "defineMCPServer"];
|
|
98
|
+
declare const REQUIRED_PLATFORM_APIS: {
|
|
99
|
+
readonly User: readonly ["get", "getChatHistory"];
|
|
100
|
+
readonly Products: readonly ["get", "create", "delete", "search", "getById"];
|
|
101
|
+
readonly Baskets: readonly ["create", "get", "addItem", "removeItem", "clear", "updateStatus", "updateMetadata", "placeOrder", "getById"];
|
|
102
|
+
readonly Orders: readonly ["create", "updateStatus", "updateData", "get", "getById"];
|
|
103
|
+
readonly Data: readonly ["create", "get", "getEntry", "update", "search", "delete"];
|
|
104
|
+
readonly Jobs: readonly ["create", "getJob", "getAll"];
|
|
105
|
+
readonly AI: readonly ["generate"];
|
|
106
|
+
readonly CDN: readonly ["upload", "get"];
|
|
107
|
+
};
|
|
108
|
+
declare const REQUIRED_NESTED_APIS: {
|
|
109
|
+
readonly Templates: {
|
|
110
|
+
readonly whatsapp: readonly ["list", "get", "send"];
|
|
111
|
+
};
|
|
112
|
+
readonly Lua: {
|
|
113
|
+
readonly request: readonly ["channel"];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
declare const REQUIRED_ENUMS: {
|
|
117
|
+
readonly BasketStatus: readonly ["ACTIVE", "CHECKED_OUT", "ABANDONED", "EXPIRED"];
|
|
118
|
+
readonly OrderStatus: readonly ["PENDING", "CONFIRMED", "FULFILLED", "CANCELLED"];
|
|
119
|
+
};
|
|
120
|
+
declare const REQUIRED_UTILITIES: readonly ["env"];
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Shared type definitions for the model registry.
|
|
124
|
+
*
|
|
125
|
+
* Runtime data (provider configs, context windows, approved model list) lives
|
|
126
|
+
* exclusively in the MongoDB `approvedModels` collection. lua-core loads it at
|
|
127
|
+
* startup via initModelRegistry() in mastra/common/model-registry.ts.
|
|
128
|
+
*/
|
|
129
|
+
interface ApprovedModelDef {
|
|
130
|
+
provider: string;
|
|
131
|
+
/** Full user-facing model string, e.g. "zhipuai/glm-5". */
|
|
132
|
+
code: string;
|
|
133
|
+
/** Model ID portion for display, e.g. "glm-5". */
|
|
134
|
+
model: string;
|
|
135
|
+
description: string;
|
|
136
|
+
/** Advertised input token context window (raw, from provider docs). */
|
|
137
|
+
contextWindow?: number;
|
|
138
|
+
/** If set, route requests through a gateway instead of calling the provider directly. */
|
|
139
|
+
gateway?: {
|
|
140
|
+
via: string;
|
|
141
|
+
modelPrefix: string;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type ApprovedModelDef, type Channel, REQUIRED_ENUMS, REQUIRED_NESTED_APIS, REQUIRED_PLATFORM_APIS, REQUIRED_PRIMITIVE_SHIMS, REQUIRED_UTILITIES, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified };
|