praisonai 1.2.2 → 1.2.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/dist/agent/simple.js +1 -1
- package/dist/cli/commands/auto.d.ts +12 -0
- package/dist/cli/commands/auto.js +109 -0
- package/dist/cli/commands/autonomy.d.ts +5 -0
- package/dist/cli/commands/autonomy.js +152 -0
- package/dist/cli/commands/cache.d.ts +9 -0
- package/dist/cli/commands/cache.js +143 -0
- package/dist/cli/commands/chat.d.ts +14 -0
- package/dist/cli/commands/chat.js +127 -0
- package/dist/cli/commands/checkpoints.d.ts +5 -0
- package/dist/cli/commands/checkpoints.js +236 -0
- package/dist/cli/commands/context.d.ts +11 -0
- package/dist/cli/commands/context.js +182 -0
- package/dist/cli/commands/cost.d.ts +5 -0
- package/dist/cli/commands/cost.js +146 -0
- package/dist/cli/commands/db.d.ts +9 -0
- package/dist/cli/commands/db.js +149 -0
- package/dist/cli/commands/eval.d.ts +17 -0
- package/dist/cli/commands/eval.js +247 -0
- package/dist/cli/commands/external-agents.d.ts +5 -0
- package/dist/cli/commands/external-agents.js +169 -0
- package/dist/cli/commands/fast-context.d.ts +5 -0
- package/dist/cli/commands/fast-context.js +126 -0
- package/dist/cli/commands/flow.d.ts +5 -0
- package/dist/cli/commands/flow.js +141 -0
- package/dist/cli/commands/git.d.ts +5 -0
- package/dist/cli/commands/git.js +178 -0
- package/dist/cli/commands/graph-rag.d.ts +9 -0
- package/dist/cli/commands/graph-rag.js +131 -0
- package/dist/cli/commands/guardrail.d.ts +11 -0
- package/dist/cli/commands/guardrail.js +156 -0
- package/dist/cli/commands/handoff.d.ts +9 -0
- package/dist/cli/commands/handoff.js +133 -0
- package/dist/cli/commands/help.d.ts +8 -0
- package/dist/cli/commands/help.js +167 -0
- package/dist/cli/commands/image.d.ts +13 -0
- package/dist/cli/commands/image.js +192 -0
- package/dist/cli/commands/interactive.d.ts +6 -0
- package/dist/cli/commands/interactive.js +79 -0
- package/dist/cli/commands/jobs.d.ts +5 -0
- package/dist/cli/commands/jobs.js +282 -0
- package/dist/cli/commands/knowledge.d.ts +9 -0
- package/dist/cli/commands/knowledge.js +226 -0
- package/dist/cli/commands/mcp.d.ts +9 -0
- package/dist/cli/commands/mcp.js +243 -0
- package/dist/cli/commands/memory.d.ts +10 -0
- package/dist/cli/commands/memory.js +198 -0
- package/dist/cli/commands/n8n.d.ts +5 -0
- package/dist/cli/commands/n8n.js +137 -0
- package/dist/cli/commands/observability.d.ts +9 -0
- package/dist/cli/commands/observability.js +145 -0
- package/dist/cli/commands/planning.d.ts +9 -0
- package/dist/cli/commands/planning.js +167 -0
- package/dist/cli/commands/prompt-expand.d.ts +11 -0
- package/dist/cli/commands/prompt-expand.js +100 -0
- package/dist/cli/commands/providers.d.ts +9 -0
- package/dist/cli/commands/providers.js +98 -0
- package/dist/cli/commands/query-rewrite.d.ts +12 -0
- package/dist/cli/commands/query-rewrite.js +102 -0
- package/dist/cli/commands/repo-map.d.ts +5 -0
- package/dist/cli/commands/repo-map.js +151 -0
- package/dist/cli/commands/reranker.d.ts +10 -0
- package/dist/cli/commands/reranker.js +144 -0
- package/dist/cli/commands/research.d.ts +12 -0
- package/dist/cli/commands/research.js +108 -0
- package/dist/cli/commands/router.d.ts +11 -0
- package/dist/cli/commands/router.js +142 -0
- package/dist/cli/commands/run.d.ts +14 -0
- package/dist/cli/commands/run.js +111 -0
- package/dist/cli/commands/sandbox.d.ts +5 -0
- package/dist/cli/commands/sandbox.js +135 -0
- package/dist/cli/commands/scheduler.d.ts +5 -0
- package/dist/cli/commands/scheduler.js +260 -0
- package/dist/cli/commands/session.d.ts +9 -0
- package/dist/cli/commands/session.js +238 -0
- package/dist/cli/commands/skills.d.ts +9 -0
- package/dist/cli/commands/skills.js +256 -0
- package/dist/cli/commands/telemetry.d.ts +9 -0
- package/dist/cli/commands/telemetry.js +146 -0
- package/dist/cli/commands/tools.d.ts +9 -0
- package/dist/cli/commands/tools.js +172 -0
- package/dist/cli/commands/vector.d.ts +10 -0
- package/dist/cli/commands/vector.js +171 -0
- package/dist/cli/commands/version.d.ts +8 -0
- package/dist/cli/commands/version.js +68 -0
- package/dist/cli/commands/voice.d.ts +10 -0
- package/dist/cli/commands/voice.js +162 -0
- package/dist/cli/commands/workflow.d.ts +13 -0
- package/dist/cli/commands/workflow.js +184 -0
- package/dist/cli/config/index.d.ts +6 -0
- package/dist/cli/config/index.js +22 -0
- package/dist/cli/config/load.d.ts +20 -0
- package/dist/cli/config/load.js +229 -0
- package/dist/cli/config/resolve.d.ts +28 -0
- package/dist/cli/config/resolve.js +70 -0
- package/dist/cli/config/schema.d.ts +15 -0
- package/dist/cli/config/schema.js +65 -0
- package/dist/cli/features/autonomy-mode.d.ts +98 -0
- package/dist/cli/features/autonomy-mode.js +266 -0
- package/dist/cli/features/background-jobs.d.ts +155 -0
- package/dist/cli/features/background-jobs.js +416 -0
- package/dist/cli/features/checkpoints.d.ts +126 -0
- package/dist/cli/features/checkpoints.js +288 -0
- package/dist/cli/features/cost-tracker.d.ts +101 -0
- package/dist/cli/features/cost-tracker.js +212 -0
- package/dist/cli/features/external-agents.d.ts +115 -0
- package/dist/cli/features/external-agents.js +294 -0
- package/dist/cli/features/fast-context.d.ts +126 -0
- package/dist/cli/features/fast-context.js +310 -0
- package/dist/cli/features/flow-display.d.ts +100 -0
- package/dist/cli/features/flow-display.js +254 -0
- package/dist/cli/features/git-integration.d.ts +138 -0
- package/dist/cli/features/git-integration.js +374 -0
- package/dist/cli/features/index.d.ts +17 -0
- package/dist/cli/features/index.js +102 -0
- package/dist/cli/features/interactive-tui.d.ts +114 -0
- package/dist/cli/features/interactive-tui.js +326 -0
- package/dist/cli/features/n8n-integration.d.ts +108 -0
- package/dist/cli/features/n8n-integration.js +296 -0
- package/dist/cli/features/repo-map.d.ts +101 -0
- package/dist/cli/features/repo-map.js +350 -0
- package/dist/cli/features/sandbox-executor.d.ts +89 -0
- package/dist/cli/features/sandbox-executor.js +314 -0
- package/dist/cli/features/scheduler.d.ts +111 -0
- package/dist/cli/features/scheduler.js +298 -0
- package/dist/cli/features/slash-commands.d.ts +77 -0
- package/dist/cli/features/slash-commands.js +316 -0
- package/dist/cli/index.d.ts +19 -15
- package/dist/cli/index.js +163 -123
- package/dist/cli/output/errors.d.ts +32 -0
- package/dist/cli/output/errors.js +72 -0
- package/dist/cli/output/index.d.ts +6 -0
- package/dist/cli/output/index.js +22 -0
- package/dist/cli/output/json.d.ts +17 -0
- package/dist/cli/output/json.js +54 -0
- package/dist/cli/output/pretty.d.ts +21 -0
- package/dist/cli/output/pretty.js +106 -0
- package/dist/cli/runtime/env.d.ts +12 -0
- package/dist/cli/runtime/env.js +49 -0
- package/dist/cli/runtime/exit.d.ts +11 -0
- package/dist/cli/runtime/exit.js +49 -0
- package/dist/cli/runtime/index.d.ts +6 -0
- package/dist/cli/runtime/index.js +22 -0
- package/dist/cli/runtime/lazy.d.ts +18 -0
- package/dist/cli/runtime/lazy.js +85 -0
- package/dist/cli/spec/cli-spec.d.ts +87 -0
- package/dist/cli/spec/cli-spec.js +478 -0
- package/dist/cli/spec/index.d.ts +4 -0
- package/dist/cli/spec/index.js +20 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +100 -7
- package/dist/memory/auto-memory.d.ts +136 -0
- package/dist/memory/auto-memory.js +301 -0
- package/dist/memory/file-memory.d.ts +88 -0
- package/dist/memory/file-memory.js +287 -0
- package/dist/memory/index.d.ts +2 -0
- package/dist/memory/index.js +11 -1
- package/dist/workflows/loop.d.ts +0 -0
- package/dist/workflows/loop.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Session command - Manage agent sessions
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.execute = execute;
|
|
40
|
+
const session_1 = require("../../session");
|
|
41
|
+
const json_1 = require("../output/json");
|
|
42
|
+
const pretty = __importStar(require("../output/pretty"));
|
|
43
|
+
const cli_spec_1 = require("../spec/cli-spec");
|
|
44
|
+
const errors_1 = require("../output/errors");
|
|
45
|
+
async function execute(args, options) {
|
|
46
|
+
const action = args[0] || 'list';
|
|
47
|
+
const actionArgs = args.slice(1);
|
|
48
|
+
const outputFormat = options.json ? 'json' : (options.output || 'pretty');
|
|
49
|
+
try {
|
|
50
|
+
const manager = (0, session_1.getSessionManager)();
|
|
51
|
+
switch (action) {
|
|
52
|
+
case 'list':
|
|
53
|
+
await listSessions(manager, outputFormat);
|
|
54
|
+
break;
|
|
55
|
+
case 'create':
|
|
56
|
+
await createSession(manager, actionArgs, outputFormat);
|
|
57
|
+
break;
|
|
58
|
+
case 'get':
|
|
59
|
+
await getSession(manager, actionArgs, outputFormat);
|
|
60
|
+
break;
|
|
61
|
+
case 'delete':
|
|
62
|
+
await deleteSession(manager, actionArgs, outputFormat);
|
|
63
|
+
break;
|
|
64
|
+
case 'export':
|
|
65
|
+
await exportSession(manager, actionArgs, outputFormat);
|
|
66
|
+
break;
|
|
67
|
+
case 'help':
|
|
68
|
+
default:
|
|
69
|
+
await showHelp(outputFormat);
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (outputFormat === 'json') {
|
|
75
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
await pretty.error(error instanceof Error ? error.message : String(error));
|
|
79
|
+
}
|
|
80
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function listSessions(manager, outputFormat) {
|
|
84
|
+
const sessions = manager.list();
|
|
85
|
+
if (outputFormat === 'json') {
|
|
86
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
87
|
+
sessions: sessions.map((s) => ({
|
|
88
|
+
id: s.id,
|
|
89
|
+
messageCount: s.messages.length,
|
|
90
|
+
createdAt: s.createdAt
|
|
91
|
+
})),
|
|
92
|
+
count: sessions.length
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
await pretty.heading('Sessions');
|
|
97
|
+
if (sessions.length === 0) {
|
|
98
|
+
await pretty.info('No sessions found');
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
for (const session of sessions) {
|
|
102
|
+
await pretty.plain(` • ${session.id}`);
|
|
103
|
+
await pretty.dim(` Messages: ${session.messages.length}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
await pretty.newline();
|
|
107
|
+
await pretty.info(`Total: ${sessions.length} sessions`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function createSession(manager, args, outputFormat) {
|
|
111
|
+
const sessionId = args[0];
|
|
112
|
+
const session = manager.create({ id: sessionId });
|
|
113
|
+
if (outputFormat === 'json') {
|
|
114
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
115
|
+
created: true,
|
|
116
|
+
sessionId: session.id
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
await pretty.success(`Session created: ${session.id}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function getSession(manager, args, outputFormat) {
|
|
124
|
+
const sessionId = args[0];
|
|
125
|
+
if (!sessionId) {
|
|
126
|
+
if (outputFormat === 'json') {
|
|
127
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide a session ID'));
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
await pretty.error('Please provide a session ID');
|
|
131
|
+
}
|
|
132
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
133
|
+
}
|
|
134
|
+
const session = manager.get(sessionId);
|
|
135
|
+
if (!session) {
|
|
136
|
+
if (outputFormat === 'json') {
|
|
137
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, `Session not found: ${sessionId}`));
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
await pretty.error(`Session not found: ${sessionId}`);
|
|
141
|
+
}
|
|
142
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
143
|
+
}
|
|
144
|
+
const messages = session.messages;
|
|
145
|
+
if (outputFormat === 'json') {
|
|
146
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
147
|
+
id: session.id,
|
|
148
|
+
messages,
|
|
149
|
+
messageCount: messages.length
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
await pretty.heading(`Session: ${session.id}`);
|
|
154
|
+
await pretty.plain(`Messages: ${messages.length}`);
|
|
155
|
+
await pretty.newline();
|
|
156
|
+
for (const msg of messages.slice(-10)) {
|
|
157
|
+
const content = msg.content || '';
|
|
158
|
+
await pretty.plain(` [${msg.role}] ${content.substring(0, 80)}${content.length > 80 ? '...' : ''}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function deleteSession(manager, args, outputFormat) {
|
|
163
|
+
const sessionId = args[0];
|
|
164
|
+
if (!sessionId) {
|
|
165
|
+
if (outputFormat === 'json') {
|
|
166
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide a session ID'));
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
await pretty.error('Please provide a session ID');
|
|
170
|
+
}
|
|
171
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
172
|
+
}
|
|
173
|
+
const deleted = manager.delete(sessionId);
|
|
174
|
+
if (outputFormat === 'json') {
|
|
175
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({ deleted, sessionId }));
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
if (deleted) {
|
|
179
|
+
await pretty.success(`Session deleted: ${sessionId}`);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
await pretty.warn(`Session not found: ${sessionId}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async function exportSession(manager, args, outputFormat) {
|
|
187
|
+
const sessionId = args[0];
|
|
188
|
+
if (!sessionId) {
|
|
189
|
+
if (outputFormat === 'json') {
|
|
190
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide a session ID'));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
await pretty.error('Please provide a session ID');
|
|
194
|
+
}
|
|
195
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
196
|
+
}
|
|
197
|
+
const session = manager.get(sessionId);
|
|
198
|
+
if (!session) {
|
|
199
|
+
if (outputFormat === 'json') {
|
|
200
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, `Session not found: ${sessionId}`));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
await pretty.error(`Session not found: ${sessionId}`);
|
|
204
|
+
}
|
|
205
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
206
|
+
}
|
|
207
|
+
const exported = session.toJSON();
|
|
208
|
+
if (outputFormat === 'json') {
|
|
209
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)(exported));
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
console.log(JSON.stringify(exported, null, 2));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async function showHelp(outputFormat) {
|
|
216
|
+
const help = {
|
|
217
|
+
command: 'session',
|
|
218
|
+
subcommands: [
|
|
219
|
+
{ name: 'list', description: 'List all sessions' },
|
|
220
|
+
{ name: 'create [id]', description: 'Create a new session' },
|
|
221
|
+
{ name: 'get <id>', description: 'Get session details' },
|
|
222
|
+
{ name: 'delete <id>', description: 'Delete a session' },
|
|
223
|
+
{ name: 'export <id>', description: 'Export session data' },
|
|
224
|
+
{ name: 'help', description: 'Show this help' }
|
|
225
|
+
]
|
|
226
|
+
};
|
|
227
|
+
if (outputFormat === 'json') {
|
|
228
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)(help));
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
await pretty.heading('Session Command');
|
|
232
|
+
await pretty.plain('Manage agent sessions\n');
|
|
233
|
+
await pretty.plain('Subcommands:');
|
|
234
|
+
for (const cmd of help.subcommands) {
|
|
235
|
+
await pretty.plain(` ${cmd.name.padEnd(20)} ${cmd.description}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Skills command - Manage agent skills
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.execute = execute;
|
|
40
|
+
const skills_1 = require("../../skills");
|
|
41
|
+
const json_1 = require("../output/json");
|
|
42
|
+
const pretty = __importStar(require("../output/pretty"));
|
|
43
|
+
const cli_spec_1 = require("../spec/cli-spec");
|
|
44
|
+
const errors_1 = require("../output/errors");
|
|
45
|
+
async function execute(args, options) {
|
|
46
|
+
const action = args[0] || 'list';
|
|
47
|
+
const actionArgs = args.slice(1);
|
|
48
|
+
const outputFormat = options.json ? 'json' : (options.output || 'pretty');
|
|
49
|
+
try {
|
|
50
|
+
const searchPath = actionArgs[0] || '.';
|
|
51
|
+
const manager = (0, skills_1.createSkillManager)({ paths: [searchPath] });
|
|
52
|
+
switch (action) {
|
|
53
|
+
case 'list':
|
|
54
|
+
await listSkills(manager, outputFormat);
|
|
55
|
+
break;
|
|
56
|
+
case 'discover':
|
|
57
|
+
await discoverSkills(manager, actionArgs, outputFormat);
|
|
58
|
+
break;
|
|
59
|
+
case 'validate':
|
|
60
|
+
await validateSkill(manager, actionArgs, outputFormat);
|
|
61
|
+
break;
|
|
62
|
+
case 'info':
|
|
63
|
+
await skillInfo(manager, actionArgs, outputFormat);
|
|
64
|
+
break;
|
|
65
|
+
case 'help':
|
|
66
|
+
default:
|
|
67
|
+
await showHelp(outputFormat);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (outputFormat === 'json') {
|
|
73
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
await pretty.error(error instanceof Error ? error.message : String(error));
|
|
77
|
+
}
|
|
78
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function listSkills(manager, outputFormat) {
|
|
82
|
+
const skills = manager.list();
|
|
83
|
+
if (outputFormat === 'json') {
|
|
84
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
85
|
+
skills: skills.map((s) => ({
|
|
86
|
+
name: s.metadata.name,
|
|
87
|
+
description: s.metadata.description,
|
|
88
|
+
path: s.path
|
|
89
|
+
})),
|
|
90
|
+
count: skills.length
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
await pretty.heading('Available Skills');
|
|
95
|
+
if (skills.length === 0) {
|
|
96
|
+
await pretty.info('No skills loaded');
|
|
97
|
+
await pretty.dim('Run "praisonai-ts skills discover <path>" to discover skills');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
for (const skill of skills) {
|
|
101
|
+
await pretty.plain(` • ${skill.metadata.name}`);
|
|
102
|
+
if (skill.metadata.description) {
|
|
103
|
+
await pretty.dim(` ${skill.metadata.description}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
await pretty.newline();
|
|
108
|
+
await pretty.info(`Total: ${skills.length} skills`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function discoverSkills(manager, args, outputFormat) {
|
|
112
|
+
const searchPath = args[0] || '.';
|
|
113
|
+
const discovered = await manager.discover();
|
|
114
|
+
if (outputFormat === 'json') {
|
|
115
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
116
|
+
discovered: discovered.map((s) => ({
|
|
117
|
+
name: s.metadata.name,
|
|
118
|
+
description: s.metadata.description,
|
|
119
|
+
path: s.path
|
|
120
|
+
})),
|
|
121
|
+
count: discovered.length,
|
|
122
|
+
searchPath
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
await pretty.heading(`Discovered Skills in: ${searchPath}`);
|
|
127
|
+
if (discovered.length === 0) {
|
|
128
|
+
await pretty.info('No skills found');
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
for (const skill of discovered) {
|
|
132
|
+
await pretty.plain(` • ${skill.metadata.name}`);
|
|
133
|
+
if (skill.metadata.description) {
|
|
134
|
+
await pretty.dim(` ${skill.metadata.description}`);
|
|
135
|
+
}
|
|
136
|
+
if (skill.path) {
|
|
137
|
+
await pretty.dim(` Path: ${skill.path}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
await pretty.newline();
|
|
142
|
+
await pretty.info(`Found: ${discovered.length} skills`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function validateSkill(manager, args, outputFormat) {
|
|
146
|
+
const skillPath = args[0];
|
|
147
|
+
if (!skillPath) {
|
|
148
|
+
if (outputFormat === 'json') {
|
|
149
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide a skill path'));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
await pretty.error('Please provide a skill path');
|
|
153
|
+
}
|
|
154
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
// Load the skill first, then validate
|
|
158
|
+
const skill = await manager.loadSkill(skillPath);
|
|
159
|
+
const result = manager.validate(skill);
|
|
160
|
+
if (outputFormat === 'json') {
|
|
161
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
162
|
+
valid: result.valid,
|
|
163
|
+
path: skillPath,
|
|
164
|
+
errors: result.errors || []
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
if (result.valid) {
|
|
169
|
+
await pretty.success(`Skill is valid: ${skillPath}`);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
await pretty.error(`Skill validation failed: ${skillPath}`);
|
|
173
|
+
if (result.errors) {
|
|
174
|
+
for (const err of result.errors) {
|
|
175
|
+
await pretty.plain(` ❌ ${err}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
if (outputFormat === 'json') {
|
|
183
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
await pretty.error(`Validation error: ${error instanceof Error ? error.message : String(error)}`);
|
|
187
|
+
}
|
|
188
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async function skillInfo(manager, args, outputFormat) {
|
|
192
|
+
const skillName = args[0];
|
|
193
|
+
if (!skillName) {
|
|
194
|
+
if (outputFormat === 'json') {
|
|
195
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide a skill name'));
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
await pretty.error('Please provide a skill name');
|
|
199
|
+
}
|
|
200
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
201
|
+
}
|
|
202
|
+
const skill = manager.get(skillName);
|
|
203
|
+
if (!skill) {
|
|
204
|
+
if (outputFormat === 'json') {
|
|
205
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, `Skill not found: ${skillName}`));
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
await pretty.error(`Skill not found: ${skillName}`);
|
|
209
|
+
}
|
|
210
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
211
|
+
}
|
|
212
|
+
if (outputFormat === 'json') {
|
|
213
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
214
|
+
name: skill.metadata.name,
|
|
215
|
+
description: skill.metadata.description,
|
|
216
|
+
path: skill.path,
|
|
217
|
+
metadata: skill.metadata
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
await pretty.heading(`Skill: ${skill.metadata.name}`);
|
|
222
|
+
await pretty.keyValue({
|
|
223
|
+
'Name': skill.metadata.name,
|
|
224
|
+
'Description': skill.metadata.description || 'No description',
|
|
225
|
+
'Path': skill.path || 'N/A'
|
|
226
|
+
});
|
|
227
|
+
if (skill.metadata.metadata && Object.keys(skill.metadata.metadata).length > 0) {
|
|
228
|
+
await pretty.newline();
|
|
229
|
+
await pretty.plain('Metadata:');
|
|
230
|
+
await pretty.plain(JSON.stringify(skill.metadata.metadata, null, 2));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async function showHelp(outputFormat) {
|
|
235
|
+
const help = {
|
|
236
|
+
command: 'skills',
|
|
237
|
+
subcommands: [
|
|
238
|
+
{ name: 'list', description: 'List loaded skills' },
|
|
239
|
+
{ name: 'discover <path>', description: 'Discover skills in directory' },
|
|
240
|
+
{ name: 'validate <path>', description: 'Validate a skill' },
|
|
241
|
+
{ name: 'info <name>', description: 'Show skill information' },
|
|
242
|
+
{ name: 'help', description: 'Show this help' }
|
|
243
|
+
]
|
|
244
|
+
};
|
|
245
|
+
if (outputFormat === 'json') {
|
|
246
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)(help));
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
await pretty.heading('Skills Command');
|
|
250
|
+
await pretty.plain('Manage agent skills\n');
|
|
251
|
+
await pretty.plain('Subcommands:');
|
|
252
|
+
for (const cmd of help.subcommands) {
|
|
253
|
+
await pretty.plain(` ${cmd.name.padEnd(20)} ${cmd.description}`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telemetry command - Usage monitoring and analytics
|
|
3
|
+
*/
|
|
4
|
+
export interface TelemetryOptions {
|
|
5
|
+
verbose?: boolean;
|
|
6
|
+
output?: 'json' | 'text' | 'pretty';
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function execute(args: string[], options: TelemetryOptions): Promise<void>;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Telemetry command - Usage monitoring and analytics
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.execute = execute;
|
|
40
|
+
const telemetry_1 = require("../../telemetry");
|
|
41
|
+
const json_1 = require("../output/json");
|
|
42
|
+
const pretty = __importStar(require("../output/pretty"));
|
|
43
|
+
const cli_spec_1 = require("../spec/cli-spec");
|
|
44
|
+
const errors_1 = require("../output/errors");
|
|
45
|
+
async function execute(args, options) {
|
|
46
|
+
const action = args[0] || 'status';
|
|
47
|
+
const outputFormat = options.json ? 'json' : (options.output || 'pretty');
|
|
48
|
+
try {
|
|
49
|
+
switch (action) {
|
|
50
|
+
case 'enable':
|
|
51
|
+
(0, telemetry_1.enableTelemetry)();
|
|
52
|
+
if (outputFormat === 'json') {
|
|
53
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({ enabled: true }));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
await pretty.success('Telemetry enabled');
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
case 'disable':
|
|
60
|
+
(0, telemetry_1.disableTelemetry)();
|
|
61
|
+
if (outputFormat === 'json') {
|
|
62
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({ enabled: false }));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
await pretty.success('Telemetry disabled');
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
case 'status':
|
|
69
|
+
await showStatus(outputFormat);
|
|
70
|
+
break;
|
|
71
|
+
case 'clear':
|
|
72
|
+
(0, telemetry_1.cleanupTelemetry)();
|
|
73
|
+
if (outputFormat === 'json') {
|
|
74
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({ cleared: true }));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
await pretty.success('Telemetry data cleared');
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
case 'export':
|
|
81
|
+
await exportTelemetry(outputFormat);
|
|
82
|
+
break;
|
|
83
|
+
case 'help':
|
|
84
|
+
default:
|
|
85
|
+
await showHelp(outputFormat);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (outputFormat === 'json') {
|
|
91
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
await pretty.error(error instanceof Error ? error.message : String(error));
|
|
95
|
+
}
|
|
96
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function showStatus(outputFormat) {
|
|
100
|
+
const telemetry = (0, telemetry_1.getTelemetry)();
|
|
101
|
+
if (outputFormat === 'json') {
|
|
102
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
103
|
+
enabled: telemetry.isEnabled()
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
await pretty.heading('Telemetry Status');
|
|
108
|
+
await pretty.plain(`Enabled: ${telemetry.isEnabled() ? 'Yes' : 'No'}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function exportTelemetry(outputFormat) {
|
|
112
|
+
const telemetry = (0, telemetry_1.getTelemetry)();
|
|
113
|
+
if (outputFormat === 'json') {
|
|
114
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
115
|
+
enabled: telemetry.isEnabled(),
|
|
116
|
+
exportedAt: new Date().toISOString()
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
await pretty.plain(`Telemetry enabled: ${telemetry.isEnabled()}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function showHelp(outputFormat) {
|
|
124
|
+
const help = {
|
|
125
|
+
command: 'telemetry',
|
|
126
|
+
subcommands: [
|
|
127
|
+
{ name: 'status', description: 'Show telemetry status' },
|
|
128
|
+
{ name: 'enable', description: 'Enable telemetry collection' },
|
|
129
|
+
{ name: 'disable', description: 'Disable telemetry collection' },
|
|
130
|
+
{ name: 'clear', description: 'Clear collected telemetry data' },
|
|
131
|
+
{ name: 'export', description: 'Export telemetry data' },
|
|
132
|
+
{ name: 'help', description: 'Show this help' }
|
|
133
|
+
]
|
|
134
|
+
};
|
|
135
|
+
if (outputFormat === 'json') {
|
|
136
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)(help));
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
await pretty.heading('Telemetry Command');
|
|
140
|
+
await pretty.plain('Usage monitoring and analytics\n');
|
|
141
|
+
await pretty.plain('Subcommands:');
|
|
142
|
+
for (const cmd of help.subcommands) {
|
|
143
|
+
await pretty.plain(` ${cmd.name.padEnd(15)} ${cmd.description}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|