lua-cli 3.0.3 â 3.1.0-alpha.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/README.md +8 -1
- package/dist/api/job.api.service.d.ts +3 -1
- package/dist/api/job.api.service.js +7 -2
- package/dist/api/logs.api.service.d.ts +11 -13
- package/dist/api/logs.api.service.js +20 -17
- package/dist/api/marketplace.api.service.d.ts +25 -0
- package/dist/api/marketplace.api.service.js +105 -0
- package/dist/api/user.data.api.service.js +7 -2
- package/dist/cli/command-definitions.d.ts +6 -0
- package/dist/cli/command-definitions.js +25 -1
- package/dist/commands/env.d.ts +11 -0
- package/dist/commands/env.js +1 -79
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/logs.js +128 -68
- package/dist/commands/marketplace.d.ts +12 -0
- package/dist/commands/marketplace.js +1593 -0
- package/dist/commands/persona.js +9 -4
- package/dist/common/job.instance.js +1 -3
- package/dist/common/user.instance.d.ts +5 -2
- package/dist/common/user.instance.js +55 -21
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/constants.js +5 -1
- package/dist/index.js +6 -4
- package/dist/interfaces/index.d.ts +5 -4
- package/dist/interfaces/marketplace.d.ts +99 -0
- package/dist/interfaces/marketplace.js +2 -0
- package/dist/interfaces/user.d.ts +19 -0
- package/dist/interfaces/user.js +1 -0
- package/dist/types/compile.types.d.ts +48 -41
- package/dist/types/compile.types.js +1 -0
- package/dist/utils/env-loader.utils.d.ts +9 -0
- package/dist/utils/env-loader.utils.js +88 -0
- package/dist/utils/job-management.d.ts +3 -3
- package/dist/utils/postprocessor-management.d.ts +3 -3
- package/dist/utils/preprocessor-management.d.ts +3 -3
- package/dist/utils/semver.d.ts +27 -0
- package/dist/utils/semver.js +75 -0
- package/dist/utils/skill-management.d.ts +4 -4
- package/dist/utils/webhook-management.d.ts +3 -3
- package/dist/web/app.js +3 -3
- package/package.json +1 -1
- package/template/README.md +13 -0
package/dist/commands/logs.js
CHANGED
|
@@ -9,6 +9,11 @@ import { readSkillConfig } from "../utils/files.js";
|
|
|
9
9
|
import { withErrorHandling, writeSuccess, writeInfo, writeError, clearPromptLines } from "../utils/cli.js";
|
|
10
10
|
import LogsApi from '../api/logs.api.service.js';
|
|
11
11
|
import { BASE_URLS } from '../config/constants.js';
|
|
12
|
+
import SkillApi from "../api/skills.api.service.js";
|
|
13
|
+
import JobApi from "../api/job.api.service.js";
|
|
14
|
+
import WebhookApi from "../api/webhook.api.service.js";
|
|
15
|
+
import PreprocessorApi from "../api/preprocessor.api.service.js";
|
|
16
|
+
import PostprocessorApi from "../api/postprocessor.api.service.js";
|
|
12
17
|
/**
|
|
13
18
|
* Main logs command - displays agent/skill logs with navigation
|
|
14
19
|
*
|
|
@@ -45,102 +50,147 @@ export async function logsCommand() {
|
|
|
45
50
|
message: "What logs do you want to view?",
|
|
46
51
|
choices: [
|
|
47
52
|
{ name: "đ All agent logs", value: "all" },
|
|
48
|
-
{ name: "
|
|
49
|
-
]
|
|
50
|
-
}
|
|
53
|
+
{ name: "đ Filter logs", value: "filter" },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
51
56
|
]);
|
|
52
57
|
clearPromptLines(2);
|
|
53
58
|
if (viewType === "all") {
|
|
54
59
|
await viewAgentLogs(logsApi, agentId);
|
|
55
60
|
}
|
|
56
61
|
else {
|
|
57
|
-
await
|
|
62
|
+
await filterAndShowLogs(logsApi, agentId, apiKey);
|
|
58
63
|
}
|
|
59
64
|
}, "logs viewing");
|
|
60
65
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
async function filterAndShowLogs(logsApi, agentId, apiKey) {
|
|
67
|
+
const apiServices = {
|
|
68
|
+
skill: new SkillApi(BASE_URLS.API, apiKey, agentId),
|
|
69
|
+
job: new JobApi(BASE_URLS.API, apiKey, agentId),
|
|
70
|
+
webhook: new WebhookApi(BASE_URLS.API, apiKey, agentId),
|
|
71
|
+
preprocessor: new PreprocessorApi(BASE_URLS.API, apiKey, agentId),
|
|
72
|
+
postprocessor: new PostprocessorApi(BASE_URLS.API, apiKey, agentId),
|
|
73
|
+
};
|
|
74
|
+
let keepFiltering = true;
|
|
75
|
+
while (keepFiltering) {
|
|
76
|
+
const { filterType } = await inquirer.prompt([
|
|
77
|
+
{
|
|
78
|
+
type: "list",
|
|
79
|
+
name: "filterType",
|
|
80
|
+
message: "Filter by:",
|
|
81
|
+
choices: [
|
|
82
|
+
{ name: "đ All logs", value: "all" },
|
|
83
|
+
new inquirer.Separator(),
|
|
84
|
+
{ name: "Skills", value: "skill" },
|
|
85
|
+
{ name: "Jobs", value: "job" },
|
|
86
|
+
{ name: "Webhooks", value: "webhook" },
|
|
87
|
+
{ name: "Preprocessors", value: "preprocessor" },
|
|
88
|
+
{ name: "Postprocessors", value: "postprocessor" },
|
|
89
|
+
new inquirer.Separator(),
|
|
90
|
+
{ name: "â Back", value: "back" },
|
|
91
|
+
new inquirer.Separator(),
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
]);
|
|
95
|
+
if (filterType === "all") {
|
|
96
|
+
await viewAgentLogs(logsApi, agentId);
|
|
97
|
+
return; // Exit to main command menu
|
|
73
98
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
if (filterType === "back") {
|
|
100
|
+
await logsCommand();
|
|
101
|
+
return; // Exit to main command menu
|
|
102
|
+
}
|
|
103
|
+
const primitiveType = filterType;
|
|
104
|
+
const capitalizedType = primitiveType.charAt(0).toUpperCase() + primitiveType.slice(1);
|
|
105
|
+
let response;
|
|
106
|
+
let items = [];
|
|
107
|
+
switch (primitiveType) {
|
|
108
|
+
case "skill":
|
|
109
|
+
response = await apiServices.skill.getSkills();
|
|
110
|
+
items = response.data?.skills || [];
|
|
111
|
+
break;
|
|
112
|
+
case "job":
|
|
113
|
+
response = await apiServices.job.getJobs({ includeDynamic: true });
|
|
114
|
+
items = response.data?.jobs || [];
|
|
115
|
+
break;
|
|
116
|
+
case "webhook":
|
|
117
|
+
response = await apiServices.webhook.getWebhooks();
|
|
118
|
+
items = response.data?.webhooks || [];
|
|
119
|
+
break;
|
|
120
|
+
case "preprocessor":
|
|
121
|
+
response = await apiServices.preprocessor.getPreProcessors();
|
|
122
|
+
items = response.data?.preprocessors || [];
|
|
123
|
+
break;
|
|
124
|
+
case "postprocessor":
|
|
125
|
+
response = await apiServices.postprocessor.getPostProcessors();
|
|
126
|
+
items = response.data?.postprocessors || [];
|
|
127
|
+
break;
|
|
128
|
+
default:
|
|
129
|
+
writeError("â Invalid filter type selected.");
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (!response || !response.success || !response.data) {
|
|
133
|
+
writeError(`â Could not fetch ${primitiveType}s from the API.`);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (items.length === 0) {
|
|
137
|
+
writeInfo(`âšī¸ No ${primitiveType}s found for this agent.\n`);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const { selectedId } = await inquirer.prompt([
|
|
78
141
|
{
|
|
79
142
|
type: "list",
|
|
80
|
-
name: "
|
|
81
|
-
message:
|
|
82
|
-
choices:
|
|
83
|
-
|
|
143
|
+
name: "selectedId",
|
|
144
|
+
message: `Select a ${primitiveType}:`,
|
|
145
|
+
choices: [
|
|
146
|
+
{ name: `All ${capitalizedType}s`, value: "all" },
|
|
147
|
+
new inquirer.Separator(),
|
|
148
|
+
...items.map((item) => ({
|
|
149
|
+
name: item.name,
|
|
150
|
+
value: item.id,
|
|
151
|
+
})),
|
|
152
|
+
new inquirer.Separator(),
|
|
153
|
+
{ name: "â Back", value: "back" },
|
|
154
|
+
new inquirer.Separator(),
|
|
155
|
+
],
|
|
156
|
+
},
|
|
84
157
|
]);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
158
|
+
if (selectedId === "back") {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
const filters = {
|
|
162
|
+
primitiveType,
|
|
163
|
+
};
|
|
164
|
+
if (selectedId !== "all") {
|
|
165
|
+
filters.primitiveId = selectedId;
|
|
166
|
+
}
|
|
167
|
+
await viewAgentLogs(logsApi, agentId, filters);
|
|
168
|
+
return;
|
|
89
169
|
}
|
|
90
170
|
}
|
|
91
171
|
/**
|
|
92
|
-
* View logs for
|
|
172
|
+
* View all logs for an agent with pagination
|
|
93
173
|
*/
|
|
94
|
-
async function
|
|
95
|
-
// Get skills from config
|
|
96
|
-
const skills = config?.skills || [];
|
|
97
|
-
if (skills.length === 0) {
|
|
98
|
-
writeError("â No skills found in lua.skill.yaml");
|
|
99
|
-
writeInfo("đĄ Run 'lua push' to deploy skills first.\n");
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
// Let user select a skill
|
|
103
|
-
const skillChoices = skills.map((skill) => ({
|
|
104
|
-
name: `${skill.name} (${skill.skillId || 'No ID'})`,
|
|
105
|
-
value: skill.skillId
|
|
106
|
-
}));
|
|
107
|
-
skillChoices.push({
|
|
108
|
-
name: 'â Back to main menu',
|
|
109
|
-
value: null
|
|
110
|
-
});
|
|
111
|
-
const { skillId } = await inquirer.prompt([
|
|
112
|
-
{
|
|
113
|
-
type: "list",
|
|
114
|
-
name: "skillId",
|
|
115
|
-
message: "Select a skill:",
|
|
116
|
-
choices: skillChoices
|
|
117
|
-
}
|
|
118
|
-
]);
|
|
119
|
-
if (!skillId) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
clearPromptLines(2);
|
|
174
|
+
async function viewAgentLogs(logsApi, agentId, filters = {}) {
|
|
123
175
|
let currentPage = 1;
|
|
124
176
|
const limit = 20;
|
|
125
177
|
let keepViewing = true;
|
|
126
|
-
const selectedSkill = skills.find((s) => s.skillId === skillId);
|
|
127
|
-
const skillName = selectedSkill?.name || skillId;
|
|
128
178
|
while (keepViewing) {
|
|
129
|
-
const response = await logsApi.
|
|
179
|
+
const response = await logsApi.getAgentLogs(agentId, limit, currentPage, filters);
|
|
130
180
|
if (!response.success) {
|
|
131
181
|
writeError(`â Error: ${response.error?.message || 'Unknown error'}`);
|
|
132
182
|
process.exit(1);
|
|
133
183
|
}
|
|
134
184
|
const data = response.data;
|
|
135
|
-
displayLogs(data.logs, data.pagination,
|
|
185
|
+
displayLogs(data.logs, data.pagination, "All Agent Logs");
|
|
136
186
|
// Navigation menu
|
|
137
187
|
const { action } = await inquirer.prompt([
|
|
138
188
|
{
|
|
139
189
|
type: "list",
|
|
140
190
|
name: "action",
|
|
141
191
|
message: "Navigation:",
|
|
142
|
-
choices: getNavigationChoices(data.pagination)
|
|
143
|
-
}
|
|
192
|
+
choices: getNavigationChoices(data.pagination),
|
|
193
|
+
},
|
|
144
194
|
]);
|
|
145
195
|
clearPromptLines(2);
|
|
146
196
|
keepViewing = await handleNavigation(action, data.pagination, (page) => {
|
|
@@ -167,11 +217,21 @@ function displayLogs(logs, pagination, title) {
|
|
|
167
217
|
const icon = getLogIcon(log.subType);
|
|
168
218
|
const color = getLogColor(log.subType);
|
|
169
219
|
console.log(color(`${icon} [${timestamp}] ${log.subType.toUpperCase()}`));
|
|
170
|
-
|
|
171
|
-
|
|
220
|
+
const { primitiveType, primitiveId, primitiveName, toolName, toolId } = log.metadata;
|
|
221
|
+
const capitalizedType = primitiveType
|
|
222
|
+
? primitiveType.charAt(0).toUpperCase() + primitiveType.slice(1)
|
|
223
|
+
: "Item";
|
|
224
|
+
if (primitiveName) {
|
|
225
|
+
console.log(chalk.gray(` ${capitalizedType} Name: ${primitiveName}`));
|
|
172
226
|
}
|
|
173
|
-
if (
|
|
174
|
-
console.log(chalk.gray(`
|
|
227
|
+
if (primitiveId) {
|
|
228
|
+
console.log(chalk.gray(` ${capitalizedType} ID: ${primitiveId}`));
|
|
229
|
+
}
|
|
230
|
+
// Only show tool information for skills
|
|
231
|
+
if (primitiveType === "skill") {
|
|
232
|
+
if (toolName) {
|
|
233
|
+
console.log(chalk.gray(` Tool Name: ${toolName}`));
|
|
234
|
+
}
|
|
175
235
|
}
|
|
176
236
|
if (log.duration !== undefined) {
|
|
177
237
|
console.log(chalk.gray(` Duration: ${log.duration}ms`));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main marketplace command - interactive menu.
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Role selection (Creator or Installer)
|
|
6
|
+
* - Creator: List, publish, update, unlist skills, manage versions
|
|
7
|
+
* - Installer: Browse, search, install, and manage marketplace skills
|
|
8
|
+
*
|
|
9
|
+
* @param role - Optional role argument ('create', 'creator', 'install', or 'installer')
|
|
10
|
+
* @returns Promise that resolves when command completes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function marketplaceCommand(role?: string): Promise<void>;
|