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,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CLI command: repo-map
|
|
4
|
+
* Repository structure visualization and symbol extraction
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.execute = execute;
|
|
8
|
+
const repo_map_1 = require("../features/repo-map");
|
|
9
|
+
async function execute(args, options) {
|
|
10
|
+
const subcommand = args[0] || 'tree';
|
|
11
|
+
const isJson = Boolean(options.output === 'json' || options.json);
|
|
12
|
+
switch (subcommand) {
|
|
13
|
+
case 'tree':
|
|
14
|
+
await handleTree(args.slice(1), options, isJson);
|
|
15
|
+
break;
|
|
16
|
+
case 'symbols':
|
|
17
|
+
await handleSymbols(args.slice(1), options, isJson);
|
|
18
|
+
break;
|
|
19
|
+
case 'help':
|
|
20
|
+
default:
|
|
21
|
+
if (subcommand !== 'help' && !subcommand.startsWith('-')) {
|
|
22
|
+
// Treat as path for tree command
|
|
23
|
+
await handleTree([subcommand, ...args.slice(1)], options, isJson);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
showHelp(isJson);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function handleTree(args, options, isJson) {
|
|
31
|
+
const rootPath = args[0] || process.cwd();
|
|
32
|
+
const maxDepth = options.depth || 5;
|
|
33
|
+
const includeSymbols = Boolean(options.symbols);
|
|
34
|
+
const map = (0, repo_map_1.createRepoMap)({
|
|
35
|
+
rootPath,
|
|
36
|
+
maxDepth,
|
|
37
|
+
includeSymbols
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
const result = await map.generate();
|
|
41
|
+
if (isJson) {
|
|
42
|
+
console.log(JSON.stringify({
|
|
43
|
+
success: true,
|
|
44
|
+
root: result.root,
|
|
45
|
+
totalFiles: result.totalFiles,
|
|
46
|
+
totalDirectories: result.totalDirectories,
|
|
47
|
+
symbolCount: result.symbols.length
|
|
48
|
+
}, null, 2));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
console.log(result.summary);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (isJson) {
|
|
56
|
+
console.log(JSON.stringify({ success: false, error: error.message }));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
console.error(`Error: ${error.message}`);
|
|
60
|
+
}
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function handleSymbols(args, options, isJson) {
|
|
65
|
+
const rootPath = args[0] || process.cwd();
|
|
66
|
+
const maxDepth = options.depth || 5;
|
|
67
|
+
const map = (0, repo_map_1.createRepoMap)({
|
|
68
|
+
rootPath,
|
|
69
|
+
maxDepth,
|
|
70
|
+
includeSymbols: true
|
|
71
|
+
});
|
|
72
|
+
try {
|
|
73
|
+
const result = await map.generate();
|
|
74
|
+
if (isJson) {
|
|
75
|
+
console.log(JSON.stringify({
|
|
76
|
+
success: true,
|
|
77
|
+
symbols: result.symbols,
|
|
78
|
+
count: result.symbols.length
|
|
79
|
+
}, null, 2));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.log(`Symbols in ${rootPath}:\n`);
|
|
83
|
+
const byType = {};
|
|
84
|
+
for (const sym of result.symbols) {
|
|
85
|
+
if (!byType[sym.type])
|
|
86
|
+
byType[sym.type] = [];
|
|
87
|
+
byType[sym.type].push(sym);
|
|
88
|
+
}
|
|
89
|
+
for (const [type, symbols] of Object.entries(byType)) {
|
|
90
|
+
console.log(`${type}s (${symbols.length}):`);
|
|
91
|
+
for (const sym of symbols.slice(0, 20)) {
|
|
92
|
+
const exported = sym.exported ? ' [exported]' : '';
|
|
93
|
+
console.log(` ${sym.name}${exported} (line ${sym.line})`);
|
|
94
|
+
}
|
|
95
|
+
if (symbols.length > 20) {
|
|
96
|
+
console.log(` ... and ${symbols.length - 20} more`);
|
|
97
|
+
}
|
|
98
|
+
console.log();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (isJson) {
|
|
104
|
+
console.log(JSON.stringify({ success: false, error: error.message }));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.error(`Error: ${error.message}`);
|
|
108
|
+
}
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function showHelp(isJson) {
|
|
113
|
+
const help = {
|
|
114
|
+
command: 'repo-map',
|
|
115
|
+
description: 'Repository structure visualization and symbol extraction',
|
|
116
|
+
subcommands: {
|
|
117
|
+
tree: 'Show repository tree structure',
|
|
118
|
+
symbols: 'Extract and list code symbols'
|
|
119
|
+
},
|
|
120
|
+
flags: {
|
|
121
|
+
'--depth': 'Maximum directory depth (default: 5)',
|
|
122
|
+
'--symbols': 'Include symbols in tree output',
|
|
123
|
+
'--json': 'Output in JSON format'
|
|
124
|
+
},
|
|
125
|
+
examples: [
|
|
126
|
+
'praisonai-ts repo-map',
|
|
127
|
+
'praisonai-ts repo-map tree ./src',
|
|
128
|
+
'praisonai-ts repo-map tree --depth 3',
|
|
129
|
+
'praisonai-ts repo-map symbols ./src',
|
|
130
|
+
'praisonai-ts repo-map tree --symbols'
|
|
131
|
+
]
|
|
132
|
+
};
|
|
133
|
+
if (isJson) {
|
|
134
|
+
console.log(JSON.stringify(help, null, 2));
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
console.log('Repo Map - Repository visualization\n');
|
|
138
|
+
console.log('Subcommands:');
|
|
139
|
+
for (const [cmd, desc] of Object.entries(help.subcommands)) {
|
|
140
|
+
console.log(` ${cmd.padEnd(12)} ${desc}`);
|
|
141
|
+
}
|
|
142
|
+
console.log('\nFlags:');
|
|
143
|
+
for (const [flag, desc] of Object.entries(help.flags)) {
|
|
144
|
+
console.log(` ${flag.padEnd(12)} ${desc}`);
|
|
145
|
+
}
|
|
146
|
+
console.log('\nExamples:');
|
|
147
|
+
for (const ex of help.examples) {
|
|
148
|
+
console.log(` ${ex}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reranker command - Document reranking
|
|
3
|
+
*/
|
|
4
|
+
export interface RerankerOptions {
|
|
5
|
+
verbose?: boolean;
|
|
6
|
+
output?: 'json' | 'text' | 'pretty';
|
|
7
|
+
json?: boolean;
|
|
8
|
+
provider?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function execute(args: string[], options: RerankerOptions): Promise<void>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Reranker command - Document reranking
|
|
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 json_1 = require("../output/json");
|
|
41
|
+
const pretty = __importStar(require("../output/pretty"));
|
|
42
|
+
const cli_spec_1 = require("../spec/cli-spec");
|
|
43
|
+
const errors_1 = require("../output/errors");
|
|
44
|
+
async function execute(args, options) {
|
|
45
|
+
const action = args[0] || 'help';
|
|
46
|
+
const outputFormat = options.json ? 'json' : (options.output || 'pretty');
|
|
47
|
+
try {
|
|
48
|
+
switch (action) {
|
|
49
|
+
case 'providers':
|
|
50
|
+
await listProviders(outputFormat);
|
|
51
|
+
break;
|
|
52
|
+
case 'info':
|
|
53
|
+
await showInfo(outputFormat);
|
|
54
|
+
break;
|
|
55
|
+
case 'help':
|
|
56
|
+
default:
|
|
57
|
+
await showHelp(outputFormat);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (outputFormat === 'json') {
|
|
63
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
await pretty.error(error instanceof Error ? error.message : String(error));
|
|
67
|
+
}
|
|
68
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function showInfo(outputFormat) {
|
|
72
|
+
const info = {
|
|
73
|
+
feature: 'Reranker',
|
|
74
|
+
description: 'Rerank search results for improved relevance',
|
|
75
|
+
providers: [
|
|
76
|
+
{ name: 'CohereReranker', description: 'Cohere reranking API' },
|
|
77
|
+
{ name: 'CrossEncoderReranker', description: 'Cross-encoder model reranking' },
|
|
78
|
+
{ name: 'LLMReranker', description: 'LLM-based reranking' }
|
|
79
|
+
],
|
|
80
|
+
capabilities: [
|
|
81
|
+
'Rerank search results by relevance',
|
|
82
|
+
'Improve RAG retrieval quality',
|
|
83
|
+
'Multiple reranking strategies',
|
|
84
|
+
'Configurable top-k selection'
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
if (outputFormat === 'json') {
|
|
88
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)(info));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
await pretty.heading('Reranker');
|
|
92
|
+
await pretty.plain(info.description);
|
|
93
|
+
await pretty.newline();
|
|
94
|
+
await pretty.plain('Providers:');
|
|
95
|
+
for (const p of info.providers) {
|
|
96
|
+
await pretty.plain(` • ${p.name}: ${p.description}`);
|
|
97
|
+
}
|
|
98
|
+
await pretty.newline();
|
|
99
|
+
await pretty.plain('Capabilities:');
|
|
100
|
+
for (const cap of info.capabilities) {
|
|
101
|
+
await pretty.plain(` • ${cap}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function listProviders(outputFormat) {
|
|
106
|
+
const providers = [
|
|
107
|
+
{ name: 'cohere', description: 'Cohere reranking API', available: true },
|
|
108
|
+
{ name: 'cross-encoder', description: 'Cross-encoder model', available: true },
|
|
109
|
+
{ name: 'llm', description: 'LLM-based reranking', available: true }
|
|
110
|
+
];
|
|
111
|
+
if (outputFormat === 'json') {
|
|
112
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({ providers }));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
await pretty.heading('Reranker Providers');
|
|
116
|
+
for (const p of providers) {
|
|
117
|
+
const status = p.available ? '✓' : '✗';
|
|
118
|
+
await pretty.plain(` ${status} ${p.name.padEnd(15)} ${p.description}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function showHelp(outputFormat) {
|
|
123
|
+
const help = {
|
|
124
|
+
command: 'reranker',
|
|
125
|
+
description: 'Document reranking for improved search relevance',
|
|
126
|
+
subcommands: [
|
|
127
|
+
{ name: 'info', description: 'Show reranker feature information' },
|
|
128
|
+
{ name: 'providers', description: 'List available reranker providers' },
|
|
129
|
+
{ name: 'help', description: 'Show this help' }
|
|
130
|
+
]
|
|
131
|
+
};
|
|
132
|
+
if (outputFormat === 'json') {
|
|
133
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)(help));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
await pretty.heading('Reranker Command');
|
|
137
|
+
await pretty.plain(help.description);
|
|
138
|
+
await pretty.newline();
|
|
139
|
+
await pretty.plain('Subcommands:');
|
|
140
|
+
for (const cmd of help.subcommands) {
|
|
141
|
+
await pretty.plain(` ${cmd.name.padEnd(20)} ${cmd.description}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Research command - Deep research agent
|
|
3
|
+
*/
|
|
4
|
+
export interface ResearchOptions {
|
|
5
|
+
model?: string;
|
|
6
|
+
verbose?: boolean;
|
|
7
|
+
output?: 'json' | 'text' | 'pretty';
|
|
8
|
+
json?: boolean;
|
|
9
|
+
depth?: number;
|
|
10
|
+
maxSources?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function execute(args: string[], options: ResearchOptions): Promise<void>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Research command - Deep research agent
|
|
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 research_1 = require("../../agent/research");
|
|
41
|
+
const resolve_1 = require("../config/resolve");
|
|
42
|
+
const json_1 = require("../output/json");
|
|
43
|
+
const pretty = __importStar(require("../output/pretty"));
|
|
44
|
+
const cli_spec_1 = require("../spec/cli-spec");
|
|
45
|
+
const errors_1 = require("../output/errors");
|
|
46
|
+
async function execute(args, options) {
|
|
47
|
+
const query = args.join(' ');
|
|
48
|
+
const outputFormat = options.json ? 'json' : (options.output || 'pretty');
|
|
49
|
+
const config = (0, resolve_1.resolveConfig)(options);
|
|
50
|
+
if (!query) {
|
|
51
|
+
if (outputFormat === 'json') {
|
|
52
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide a research query'));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
await pretty.error('Please provide a research query');
|
|
56
|
+
await pretty.dim('Usage: praisonai-ts research "What are the latest AI trends?"');
|
|
57
|
+
}
|
|
58
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
59
|
+
}
|
|
60
|
+
const startTime = Date.now();
|
|
61
|
+
try {
|
|
62
|
+
if (outputFormat !== 'json') {
|
|
63
|
+
await pretty.info(`Researching: "${query}"`);
|
|
64
|
+
}
|
|
65
|
+
const agent = (0, research_1.createDeepResearchAgent)({
|
|
66
|
+
llm: config.model,
|
|
67
|
+
verbose: options.verbose,
|
|
68
|
+
maxIterations: options.depth
|
|
69
|
+
});
|
|
70
|
+
const result = await agent.research(query);
|
|
71
|
+
const duration = Date.now() - startTime;
|
|
72
|
+
if (outputFormat === 'json') {
|
|
73
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
74
|
+
query,
|
|
75
|
+
answer: result.answer,
|
|
76
|
+
citations: result.citations,
|
|
77
|
+
reasoning: result.reasoning,
|
|
78
|
+
confidence: result.confidence
|
|
79
|
+
}, {
|
|
80
|
+
duration_ms: duration,
|
|
81
|
+
model: config.model
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
await pretty.heading('Research Results');
|
|
86
|
+
await pretty.newline();
|
|
87
|
+
await pretty.plain(result.answer);
|
|
88
|
+
if (result.citations && result.citations.length > 0) {
|
|
89
|
+
await pretty.newline();
|
|
90
|
+
await pretty.plain('Citations:');
|
|
91
|
+
for (const citation of result.citations) {
|
|
92
|
+
await pretty.dim(` • ${citation.title || citation.url}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
await pretty.newline();
|
|
96
|
+
await pretty.success(`Completed in ${duration}ms`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (outputFormat === 'json') {
|
|
101
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
await pretty.error(error instanceof Error ? error.message : String(error));
|
|
105
|
+
}
|
|
106
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router command - Route requests to appropriate agents
|
|
3
|
+
*/
|
|
4
|
+
export interface RouterOptions {
|
|
5
|
+
model?: string;
|
|
6
|
+
verbose?: boolean;
|
|
7
|
+
output?: 'json' | 'text' | 'pretty';
|
|
8
|
+
json?: boolean;
|
|
9
|
+
routes?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function execute(args: string[], options: RouterOptions): Promise<void>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Router command - Route requests to appropriate agents
|
|
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 json_1 = require("../output/json");
|
|
41
|
+
const pretty = __importStar(require("../output/pretty"));
|
|
42
|
+
const cli_spec_1 = require("../spec/cli-spec");
|
|
43
|
+
const errors_1 = require("../output/errors");
|
|
44
|
+
async function execute(args, options) {
|
|
45
|
+
const action = args[0] || 'help';
|
|
46
|
+
const actionArgs = args.slice(1);
|
|
47
|
+
const outputFormat = options.json ? 'json' : (options.output || 'pretty');
|
|
48
|
+
try {
|
|
49
|
+
switch (action) {
|
|
50
|
+
case 'analyze':
|
|
51
|
+
await analyzeInput(actionArgs, outputFormat);
|
|
52
|
+
break;
|
|
53
|
+
case 'help':
|
|
54
|
+
default:
|
|
55
|
+
await showHelp(outputFormat);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (outputFormat === 'json') {
|
|
61
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.UNKNOWN, error instanceof Error ? error.message : String(error)));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
await pretty.error(error instanceof Error ? error.message : String(error));
|
|
65
|
+
}
|
|
66
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function analyzeInput(args, outputFormat) {
|
|
70
|
+
const input = args.join(' ');
|
|
71
|
+
if (!input) {
|
|
72
|
+
if (outputFormat === 'json') {
|
|
73
|
+
(0, json_1.outputJson)((0, json_1.formatError)(errors_1.ERROR_CODES.MISSING_ARG, 'Please provide input to analyze'));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
await pretty.error('Please provide input to analyze');
|
|
77
|
+
}
|
|
78
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
79
|
+
}
|
|
80
|
+
const startTime = Date.now();
|
|
81
|
+
if (outputFormat !== 'json') {
|
|
82
|
+
await pretty.info(`Analyzing routing for: "${input}"`);
|
|
83
|
+
}
|
|
84
|
+
// Simple rule-based routing analysis
|
|
85
|
+
const routes = [
|
|
86
|
+
{ name: 'greeting', pattern: /\b(hello|hi|hey|greetings)\b/i, priority: 1 },
|
|
87
|
+
{ name: 'question', pattern: /\?$/, priority: 2 },
|
|
88
|
+
{ name: 'code', pattern: /\b(code|function|class|implement|debug)\b/i, priority: 3 },
|
|
89
|
+
{ name: 'research', pattern: /\b(research|analyze|investigate|study)\b/i, priority: 3 },
|
|
90
|
+
{ name: 'creative', pattern: /\b(write|create|generate|compose)\b/i, priority: 2 },
|
|
91
|
+
{ name: 'general', pattern: /.*/, priority: 0 }
|
|
92
|
+
];
|
|
93
|
+
const matches = routes
|
|
94
|
+
.filter(r => r.pattern.test(input))
|
|
95
|
+
.sort((a, b) => b.priority - a.priority);
|
|
96
|
+
const selectedRoute = matches[0]?.name || 'general';
|
|
97
|
+
const confidence = matches[0]?.priority ? Math.min(0.5 + matches[0].priority * 0.15, 0.95) : 0.5;
|
|
98
|
+
const duration = Date.now() - startTime;
|
|
99
|
+
if (outputFormat === 'json') {
|
|
100
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
101
|
+
input,
|
|
102
|
+
selectedRoute,
|
|
103
|
+
confidence,
|
|
104
|
+
matchedRoutes: matches.map(m => m.name)
|
|
105
|
+
}, {
|
|
106
|
+
duration_ms: duration
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
await pretty.heading('Routing Analysis');
|
|
111
|
+
await pretty.plain(`Input: "${input}"`);
|
|
112
|
+
await pretty.plain(`Selected Route: ${selectedRoute}`);
|
|
113
|
+
await pretty.plain(`Confidence: ${(confidence * 100).toFixed(1)}%`);
|
|
114
|
+
await pretty.plain(`Matched Routes: ${matches.map(m => m.name).join(', ')}`);
|
|
115
|
+
await pretty.newline();
|
|
116
|
+
await pretty.success(`Analyzed in ${duration}ms`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function showHelp(outputFormat) {
|
|
120
|
+
const help = {
|
|
121
|
+
command: 'router',
|
|
122
|
+
description: 'Route requests to appropriate agents based on content analysis',
|
|
123
|
+
subcommands: [
|
|
124
|
+
{ name: 'analyze <input>', description: 'Analyze input and suggest routing' },
|
|
125
|
+
{ name: 'help', description: 'Show this help' }
|
|
126
|
+
],
|
|
127
|
+
usage: 'For programmatic routing with actual agents, use the RouterAgent SDK class'
|
|
128
|
+
};
|
|
129
|
+
if (outputFormat === 'json') {
|
|
130
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)(help));
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
await pretty.heading('Router Command');
|
|
134
|
+
await pretty.plain('Route requests to appropriate agents\n');
|
|
135
|
+
await pretty.plain('Subcommands:');
|
|
136
|
+
for (const cmd of help.subcommands) {
|
|
137
|
+
await pretty.plain(` ${cmd.name.padEnd(25)} ${cmd.description}`);
|
|
138
|
+
}
|
|
139
|
+
await pretty.newline();
|
|
140
|
+
await pretty.dim('Note: For full routing with agents, use the RouterAgent SDK class');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run command - Run an agent with a task
|
|
3
|
+
*/
|
|
4
|
+
export interface RunOptions {
|
|
5
|
+
agent?: string;
|
|
6
|
+
tools?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
verbose?: boolean;
|
|
9
|
+
profile?: string;
|
|
10
|
+
config?: string;
|
|
11
|
+
output?: 'json' | 'text' | 'pretty';
|
|
12
|
+
json?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function execute(args: string[], options: RunOptions): Promise<void>;
|