@memberjunction/ai-cli 2.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +358 -0
- package/bin/run +17 -0
- package/bin/run.js +5 -0
- package/dist/commands/actions/list.d.ts +11 -0
- package/dist/commands/actions/list.d.ts.map +1 -0
- package/dist/commands/actions/list.js +91 -0
- package/dist/commands/actions/list.js.map +1 -0
- package/dist/commands/actions/run.d.ts +16 -0
- package/dist/commands/actions/run.d.ts.map +1 -0
- package/dist/commands/actions/run.js +164 -0
- package/dist/commands/actions/run.js.map +1 -0
- package/dist/commands/agents/list.d.ts +11 -0
- package/dist/commands/agents/list.d.ts.map +1 -0
- package/dist/commands/agents/list.js +91 -0
- package/dist/commands/agents/list.js.map +1 -0
- package/dist/commands/agents/run.d.ts +17 -0
- package/dist/commands/agents/run.d.ts.map +1 -0
- package/dist/commands/agents/run.js +181 -0
- package/dist/commands/agents/run.js.map +1 -0
- package/dist/commands/prompts/list.d.ts +10 -0
- package/dist/commands/prompts/list.d.ts.map +1 -0
- package/dist/commands/prompts/list.js +40 -0
- package/dist/commands/prompts/list.js.map +1 -0
- package/dist/commands/prompts/run.d.ts +18 -0
- package/dist/commands/prompts/run.d.ts.map +1 -0
- package/dist/commands/prompts/run.js +101 -0
- package/dist/commands/prompts/run.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +42 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/console-manager.d.ts +24 -0
- package/dist/lib/console-manager.d.ts.map +1 -0
- package/dist/lib/console-manager.js +68 -0
- package/dist/lib/console-manager.js.map +1 -0
- package/dist/lib/execution-logger.d.ts +52 -0
- package/dist/lib/execution-logger.d.ts.map +1 -0
- package/dist/lib/execution-logger.js +185 -0
- package/dist/lib/execution-logger.js.map +1 -0
- package/dist/lib/mj-provider.d.ts +10 -0
- package/dist/lib/mj-provider.d.ts.map +1 -0
- package/dist/lib/mj-provider.js +155 -0
- package/dist/lib/mj-provider.js.map +1 -0
- package/dist/lib/output-formatter.d.ts +47 -0
- package/dist/lib/output-formatter.d.ts.map +1 -0
- package/dist/lib/output-formatter.js +314 -0
- package/dist/lib/output-formatter.js.map +1 -0
- package/dist/lib/text-formatter.d.ts +59 -0
- package/dist/lib/text-formatter.d.ts.map +1 -0
- package/dist/lib/text-formatter.js +173 -0
- package/dist/lib/text-formatter.js.map +1 -0
- package/dist/services/ActionService.d.ts +24 -0
- package/dist/services/ActionService.d.ts.map +1 -0
- package/dist/services/ActionService.js +393 -0
- package/dist/services/ActionService.js.map +1 -0
- package/dist/services/AgentService.d.ts +25 -0
- package/dist/services/AgentService.d.ts.map +1 -0
- package/dist/services/AgentService.js +387 -0
- package/dist/services/AgentService.js.map +1 -0
- package/dist/services/ConversationService.d.ts +27 -0
- package/dist/services/ConversationService.d.ts.map +1 -0
- package/dist/services/ConversationService.js +296 -0
- package/dist/services/ConversationService.js.map +1 -0
- package/dist/services/PromptService.d.ts +32 -0
- package/dist/services/PromptService.d.ts.map +1 -0
- package/dist/services/PromptService.js +221 -0
- package/dist/services/PromptService.js.map +1 -0
- package/dist/services/ValidationService.d.ts +9 -0
- package/dist/services/ValidationService.d.ts.map +1 -0
- package/dist/services/ValidationService.js +197 -0
- package/dist/services/ValidationService.js.map +1 -0
- package/oclif.manifest.json +387 -0
- package/package.json +88 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationService = void 0;
|
|
4
|
+
class ValidationService {
|
|
5
|
+
async validateAgentInput(agentName, prompt, chatMode) {
|
|
6
|
+
// If no agent name provided, we'll show the list (handled in command)
|
|
7
|
+
if (!agentName) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
// Validate agent name
|
|
11
|
+
if (typeof agentName !== 'string' || agentName.trim().length === 0) {
|
|
12
|
+
throw new Error(`❌ Invalid agent name
|
|
13
|
+
|
|
14
|
+
Problem: Agent name is empty or invalid
|
|
15
|
+
Provided: "${agentName}"
|
|
16
|
+
|
|
17
|
+
Next steps:
|
|
18
|
+
1. Provide a valid agent name with -a or --agent flag
|
|
19
|
+
2. Use 'mj-ai agents:list' to see available agents
|
|
20
|
+
3. Example: mj-ai agents:run -a "Demo Loop Agent" -p "Hello world"`);
|
|
21
|
+
}
|
|
22
|
+
// In chat mode, prompt is optional (can be provided later)
|
|
23
|
+
if (!chatMode && (!prompt || prompt.trim().length === 0)) {
|
|
24
|
+
throw new Error(`❌ Prompt required for agent execution
|
|
25
|
+
|
|
26
|
+
Problem: No prompt provided for non-interactive mode
|
|
27
|
+
Agent: ${agentName}
|
|
28
|
+
|
|
29
|
+
Next steps:
|
|
30
|
+
1. Provide a prompt with -p or --prompt flag
|
|
31
|
+
2. Or use --chat flag for interactive mode
|
|
32
|
+
3. Example: mj-ai agents:run -a "${agentName}" -p "Your prompt here"
|
|
33
|
+
4. Example: mj-ai agents:run -a "${agentName}" --chat`);
|
|
34
|
+
}
|
|
35
|
+
// Validate prompt length (reasonable limits)
|
|
36
|
+
if (prompt && prompt.length > 10000) {
|
|
37
|
+
throw new Error(`❌ Prompt too long
|
|
38
|
+
|
|
39
|
+
Problem: Prompt exceeds maximum length (10,000 characters)
|
|
40
|
+
Current length: ${prompt.length}
|
|
41
|
+
|
|
42
|
+
Next steps:
|
|
43
|
+
1. Shorten your prompt to under 10,000 characters
|
|
44
|
+
2. Break complex requests into multiple interactions
|
|
45
|
+
3. Use --chat mode for longer conversations`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async validateActionInput(actionName, parameters) {
|
|
49
|
+
// If no action name provided, we'll show the list (handled in command)
|
|
50
|
+
if (!actionName) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// Validate action name
|
|
54
|
+
if (typeof actionName !== 'string' || actionName.trim().length === 0) {
|
|
55
|
+
throw new Error(`❌ Invalid action name
|
|
56
|
+
|
|
57
|
+
Problem: Action name is empty or invalid
|
|
58
|
+
Provided: "${actionName}"
|
|
59
|
+
|
|
60
|
+
Next steps:
|
|
61
|
+
1. Provide a valid action name with -n or --name flag
|
|
62
|
+
2. Use 'mj-ai actions:list' to see available actions
|
|
63
|
+
3. Example: mj-ai actions:run -n "Get Weather" --param "Location=Boston"`);
|
|
64
|
+
}
|
|
65
|
+
// Validate parameters format
|
|
66
|
+
if (parameters) {
|
|
67
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
68
|
+
if (typeof key !== 'string' || key.trim().length === 0) {
|
|
69
|
+
throw new Error(`❌ Invalid parameter name
|
|
70
|
+
|
|
71
|
+
Problem: Parameter name is empty or invalid
|
|
72
|
+
Parameter: "${key}"
|
|
73
|
+
|
|
74
|
+
Next steps:
|
|
75
|
+
1. Ensure parameter names are non-empty strings
|
|
76
|
+
2. Use format: --param "ParameterName=value"
|
|
77
|
+
3. Example: --param "Location=Boston" --param "Units=metric"`);
|
|
78
|
+
}
|
|
79
|
+
// Check for potentially problematic values
|
|
80
|
+
if (typeof value === 'string' && value.length > 5000) {
|
|
81
|
+
throw new Error(`❌ Parameter value too long
|
|
82
|
+
|
|
83
|
+
Problem: Parameter "${key}" exceeds maximum length (5,000 characters)
|
|
84
|
+
Current length: ${value.length}
|
|
85
|
+
|
|
86
|
+
Next steps:
|
|
87
|
+
1. Shorten the parameter value
|
|
88
|
+
2. Consider using a file reference instead of inline data
|
|
89
|
+
3. Break large data into smaller parameters`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
validateTimeout(timeout) {
|
|
95
|
+
if (timeout < 1000) {
|
|
96
|
+
throw new Error(`❌ Invalid timeout value
|
|
97
|
+
|
|
98
|
+
Problem: Timeout too short (minimum 1 second)
|
|
99
|
+
Provided: ${timeout}ms
|
|
100
|
+
|
|
101
|
+
Next steps:
|
|
102
|
+
1. Use a timeout of at least 1000ms (1 second)
|
|
103
|
+
2. Recommended: 30000ms (30 seconds) for simple operations
|
|
104
|
+
3. For complex operations: 300000ms (5 minutes) or more`);
|
|
105
|
+
}
|
|
106
|
+
if (timeout > 1800000) { // 30 minutes
|
|
107
|
+
throw new Error(`❌ Invalid timeout value
|
|
108
|
+
|
|
109
|
+
Problem: Timeout too long (maximum 30 minutes)
|
|
110
|
+
Provided: ${timeout}ms
|
|
111
|
+
|
|
112
|
+
Next steps:
|
|
113
|
+
1. Use a timeout of at most 1800000ms (30 minutes)
|
|
114
|
+
2. For long-running operations, consider breaking into smaller tasks
|
|
115
|
+
3. Check if the operation can be optimized`);
|
|
116
|
+
}
|
|
117
|
+
return timeout;
|
|
118
|
+
}
|
|
119
|
+
validateOutputFormat(format) {
|
|
120
|
+
const validFormats = ['compact', 'json', 'table'];
|
|
121
|
+
if (!validFormats.includes(format)) {
|
|
122
|
+
throw new Error(`❌ Invalid output format
|
|
123
|
+
|
|
124
|
+
Problem: Unknown output format "${format}"
|
|
125
|
+
Valid formats: ${validFormats.join(', ')}
|
|
126
|
+
|
|
127
|
+
Next steps:
|
|
128
|
+
1. Use one of the supported formats: ${validFormats.join(', ')}
|
|
129
|
+
2. Example: --output compact
|
|
130
|
+
3. Example: --output json`);
|
|
131
|
+
}
|
|
132
|
+
return format;
|
|
133
|
+
}
|
|
134
|
+
parseParameters(paramStrings) {
|
|
135
|
+
const parameters = {};
|
|
136
|
+
for (const paramString of paramStrings) {
|
|
137
|
+
const equalIndex = paramString.indexOf('=');
|
|
138
|
+
if (equalIndex === -1) {
|
|
139
|
+
throw new Error(`❌ Invalid parameter format
|
|
140
|
+
|
|
141
|
+
Problem: Parameter missing '=' separator
|
|
142
|
+
Parameter: "${paramString}"
|
|
143
|
+
|
|
144
|
+
Next steps:
|
|
145
|
+
1. Use format: --param "ParameterName=value"
|
|
146
|
+
2. Example: --param "Location=Boston"
|
|
147
|
+
3. For values with spaces: --param "Message=Hello world"`);
|
|
148
|
+
}
|
|
149
|
+
const key = paramString.substring(0, equalIndex).trim();
|
|
150
|
+
const value = paramString.substring(equalIndex + 1);
|
|
151
|
+
if (key.length === 0) {
|
|
152
|
+
throw new Error(`❌ Invalid parameter format
|
|
153
|
+
|
|
154
|
+
Problem: Parameter name is empty
|
|
155
|
+
Parameter: "${paramString}"
|
|
156
|
+
|
|
157
|
+
Next steps:
|
|
158
|
+
1. Provide a parameter name before the '=' sign
|
|
159
|
+
2. Example: --param "Location=Boston"
|
|
160
|
+
3. Parameter names cannot be empty`);
|
|
161
|
+
}
|
|
162
|
+
// Try to parse JSON values, but fall back to string
|
|
163
|
+
try {
|
|
164
|
+
// Check if it looks like JSON (starts with { or [, or is a number/boolean)
|
|
165
|
+
const trimmedValue = value.trim();
|
|
166
|
+
if (trimmedValue.startsWith('{') || trimmedValue.startsWith('[') ||
|
|
167
|
+
trimmedValue === 'true' || trimmedValue === 'false' ||
|
|
168
|
+
trimmedValue === 'null' || !isNaN(Number(trimmedValue))) {
|
|
169
|
+
parameters[key] = JSON.parse(trimmedValue);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
parameters[key] = value;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
// Not JSON, treat as string
|
|
177
|
+
parameters[key] = value;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return parameters;
|
|
181
|
+
}
|
|
182
|
+
validateDryRun(isDryRun, hasRequiredParams) {
|
|
183
|
+
if (isDryRun && !hasRequiredParams) {
|
|
184
|
+
throw new Error(`❌ Dry run validation failed
|
|
185
|
+
|
|
186
|
+
Problem: Cannot validate without required parameters
|
|
187
|
+
Dry run: true
|
|
188
|
+
|
|
189
|
+
Next steps:
|
|
190
|
+
1. Provide all required parameters for validation
|
|
191
|
+
2. Or remove --dry-run flag to see parameter requirements
|
|
192
|
+
3. Use 'list' commands to see parameter requirements`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.ValidationService = ValidationService;
|
|
197
|
+
//# sourceMappingURL=ValidationService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationService.js","sourceRoot":"","sources":["../../src/services/ValidationService.ts"],"names":[],"mappings":";;;AAAA,MAAa,iBAAiB;IAE5B,KAAK,CAAC,kBAAkB,CAAC,SAAkB,EAAE,MAAe,EAAE,QAAkB;QAC9E,sEAAsE;QACtE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,sBAAsB;QACtB,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC;;;aAGT,SAAS;;;;;mEAK6C,CAAC,CAAC;QACjE,CAAC;QAED,2DAA2D;QAC3D,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,KAAK,CAAC;;;SAGb,SAAS;;;;;mCAKiB,SAAS;mCACT,SAAS,UAAU,CAAC,CAAC;QACpD,CAAC;QAED,6CAA6C;QAC7C,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC;;;kBAGJ,MAAM,CAAC,MAAM;;;;;4CAKa,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,UAAmB,EAAE,UAAgC;QAC7E,uEAAuE;QACvE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO;QACT,CAAC;QAED,uBAAuB;QACvB,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,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,GAAG,KAAK,CAAC;gBAC1B,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,4BAA4B;gBAC5B,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,cAAc,CAAC,QAAiB,EAAE,iBAA0B;QAC1D,IAAI,QAAQ,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC;;;;;;;;qDAQ+B,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;CACF;AAnND,8CAmNC"}
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
{
|
|
2
|
+
"commands": {
|
|
3
|
+
"actions:list": {
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"args": {},
|
|
6
|
+
"description": "List available actions",
|
|
7
|
+
"examples": [
|
|
8
|
+
"<%= config.bin %> <%= command.id %>",
|
|
9
|
+
"<%= config.bin %> <%= command.id %> --output=json",
|
|
10
|
+
"<%= config.bin %> <%= command.id %> --output=table"
|
|
11
|
+
],
|
|
12
|
+
"flags": {
|
|
13
|
+
"output": {
|
|
14
|
+
"description": "Output format",
|
|
15
|
+
"name": "output",
|
|
16
|
+
"default": "table",
|
|
17
|
+
"hasDynamicHelp": false,
|
|
18
|
+
"multiple": false,
|
|
19
|
+
"options": [
|
|
20
|
+
"compact",
|
|
21
|
+
"json",
|
|
22
|
+
"table"
|
|
23
|
+
],
|
|
24
|
+
"type": "option"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"hasDynamicHelp": false,
|
|
28
|
+
"hiddenAliases": [],
|
|
29
|
+
"id": "actions:list",
|
|
30
|
+
"pluginAlias": "@memberjunction/ai-cli",
|
|
31
|
+
"pluginName": "@memberjunction/ai-cli",
|
|
32
|
+
"pluginType": "core",
|
|
33
|
+
"strict": true,
|
|
34
|
+
"enableJsonFlag": false,
|
|
35
|
+
"isESM": false,
|
|
36
|
+
"relativePath": [
|
|
37
|
+
"dist",
|
|
38
|
+
"commands",
|
|
39
|
+
"actions",
|
|
40
|
+
"list.js"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"actions:run": {
|
|
44
|
+
"aliases": [],
|
|
45
|
+
"args": {},
|
|
46
|
+
"description": "Execute individual actions directly",
|
|
47
|
+
"examples": [
|
|
48
|
+
"<%= config.bin %> <%= command.id %> -n \"Get Weather\" --param \"Location=Boston\"",
|
|
49
|
+
"<%= config.bin %> <%= command.id %> -n \"Send Email\" --param \"To=user@example.com\" --param \"Subject=Test\"",
|
|
50
|
+
"<%= config.bin %> <%= command.id %> --output=json",
|
|
51
|
+
"<%= config.bin %> <%= command.id %> -n \"Calculate\" --param \"Numbers=[1,2,3]\" --verbose"
|
|
52
|
+
],
|
|
53
|
+
"flags": {
|
|
54
|
+
"name": {
|
|
55
|
+
"char": "n",
|
|
56
|
+
"description": "Name of the action to execute",
|
|
57
|
+
"name": "name",
|
|
58
|
+
"required": false,
|
|
59
|
+
"hasDynamicHelp": false,
|
|
60
|
+
"multiple": false,
|
|
61
|
+
"type": "option"
|
|
62
|
+
},
|
|
63
|
+
"param": {
|
|
64
|
+
"description": "Action parameter (key=value format, can be used multiple times)",
|
|
65
|
+
"name": "param",
|
|
66
|
+
"default": [],
|
|
67
|
+
"hasDynamicHelp": false,
|
|
68
|
+
"multiple": true,
|
|
69
|
+
"type": "option"
|
|
70
|
+
},
|
|
71
|
+
"verbose": {
|
|
72
|
+
"char": "v",
|
|
73
|
+
"description": "Show detailed execution information",
|
|
74
|
+
"name": "verbose",
|
|
75
|
+
"allowNo": false,
|
|
76
|
+
"type": "boolean"
|
|
77
|
+
},
|
|
78
|
+
"timeout": {
|
|
79
|
+
"description": "Override default timeout (milliseconds)",
|
|
80
|
+
"name": "timeout",
|
|
81
|
+
"default": 300000,
|
|
82
|
+
"hasDynamicHelp": false,
|
|
83
|
+
"multiple": false,
|
|
84
|
+
"type": "option"
|
|
85
|
+
},
|
|
86
|
+
"dry-run": {
|
|
87
|
+
"description": "Validate without executing",
|
|
88
|
+
"name": "dry-run",
|
|
89
|
+
"allowNo": false,
|
|
90
|
+
"type": "boolean"
|
|
91
|
+
},
|
|
92
|
+
"output": {
|
|
93
|
+
"description": "Output format",
|
|
94
|
+
"name": "output",
|
|
95
|
+
"default": "compact",
|
|
96
|
+
"hasDynamicHelp": false,
|
|
97
|
+
"multiple": false,
|
|
98
|
+
"options": [
|
|
99
|
+
"compact",
|
|
100
|
+
"json",
|
|
101
|
+
"table"
|
|
102
|
+
],
|
|
103
|
+
"type": "option"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"hasDynamicHelp": false,
|
|
107
|
+
"hiddenAliases": [],
|
|
108
|
+
"id": "actions:run",
|
|
109
|
+
"pluginAlias": "@memberjunction/ai-cli",
|
|
110
|
+
"pluginName": "@memberjunction/ai-cli",
|
|
111
|
+
"pluginType": "core",
|
|
112
|
+
"strict": true,
|
|
113
|
+
"enableJsonFlag": false,
|
|
114
|
+
"isESM": false,
|
|
115
|
+
"relativePath": [
|
|
116
|
+
"dist",
|
|
117
|
+
"commands",
|
|
118
|
+
"actions",
|
|
119
|
+
"run.js"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
"agents:list": {
|
|
123
|
+
"aliases": [],
|
|
124
|
+
"args": {},
|
|
125
|
+
"description": "List available AI agents",
|
|
126
|
+
"examples": [
|
|
127
|
+
"<%= config.bin %> <%= command.id %>",
|
|
128
|
+
"<%= config.bin %> <%= command.id %> --output=json",
|
|
129
|
+
"<%= config.bin %> <%= command.id %> --output=table"
|
|
130
|
+
],
|
|
131
|
+
"flags": {
|
|
132
|
+
"output": {
|
|
133
|
+
"description": "Output format",
|
|
134
|
+
"name": "output",
|
|
135
|
+
"default": "table",
|
|
136
|
+
"hasDynamicHelp": false,
|
|
137
|
+
"multiple": false,
|
|
138
|
+
"options": [
|
|
139
|
+
"compact",
|
|
140
|
+
"json",
|
|
141
|
+
"table"
|
|
142
|
+
],
|
|
143
|
+
"type": "option"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"hasDynamicHelp": false,
|
|
147
|
+
"hiddenAliases": [],
|
|
148
|
+
"id": "agents:list",
|
|
149
|
+
"pluginAlias": "@memberjunction/ai-cli",
|
|
150
|
+
"pluginName": "@memberjunction/ai-cli",
|
|
151
|
+
"pluginType": "core",
|
|
152
|
+
"strict": true,
|
|
153
|
+
"enableJsonFlag": false,
|
|
154
|
+
"isESM": false,
|
|
155
|
+
"relativePath": [
|
|
156
|
+
"dist",
|
|
157
|
+
"commands",
|
|
158
|
+
"agents",
|
|
159
|
+
"list.js"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"agents:run": {
|
|
163
|
+
"aliases": [],
|
|
164
|
+
"args": {},
|
|
165
|
+
"description": "Execute AI agents with custom prompts",
|
|
166
|
+
"examples": [
|
|
167
|
+
"<%= config.bin %> <%= command.id %> -a \"Demo Loop Agent\" -p \"Hello world\"",
|
|
168
|
+
"<%= config.bin %> <%= command.id %> -a \"Demo Loop Agent\" --chat",
|
|
169
|
+
"<%= config.bin %> <%= command.id %> -a \"Demo Loop Agent\" -p \"Get weather\" --verbose",
|
|
170
|
+
"<%= config.bin %> <%= command.id %> --output=json"
|
|
171
|
+
],
|
|
172
|
+
"flags": {
|
|
173
|
+
"agent": {
|
|
174
|
+
"char": "a",
|
|
175
|
+
"description": "Name of the AI agent to execute",
|
|
176
|
+
"name": "agent",
|
|
177
|
+
"required": false,
|
|
178
|
+
"hasDynamicHelp": false,
|
|
179
|
+
"multiple": false,
|
|
180
|
+
"type": "option"
|
|
181
|
+
},
|
|
182
|
+
"prompt": {
|
|
183
|
+
"char": "p",
|
|
184
|
+
"description": "Prompt text to send to the agent",
|
|
185
|
+
"name": "prompt",
|
|
186
|
+
"hasDynamicHelp": false,
|
|
187
|
+
"multiple": false,
|
|
188
|
+
"type": "option"
|
|
189
|
+
},
|
|
190
|
+
"chat": {
|
|
191
|
+
"char": "c",
|
|
192
|
+
"description": "Start interactive conversation mode",
|
|
193
|
+
"name": "chat",
|
|
194
|
+
"allowNo": false,
|
|
195
|
+
"type": "boolean"
|
|
196
|
+
},
|
|
197
|
+
"verbose": {
|
|
198
|
+
"char": "v",
|
|
199
|
+
"description": "Show detailed execution information",
|
|
200
|
+
"name": "verbose",
|
|
201
|
+
"allowNo": false,
|
|
202
|
+
"type": "boolean"
|
|
203
|
+
},
|
|
204
|
+
"timeout": {
|
|
205
|
+
"description": "Override default timeout (milliseconds)",
|
|
206
|
+
"name": "timeout",
|
|
207
|
+
"default": 300000,
|
|
208
|
+
"hasDynamicHelp": false,
|
|
209
|
+
"multiple": false,
|
|
210
|
+
"type": "option"
|
|
211
|
+
},
|
|
212
|
+
"dry-run": {
|
|
213
|
+
"description": "Validate without executing",
|
|
214
|
+
"name": "dry-run",
|
|
215
|
+
"allowNo": false,
|
|
216
|
+
"type": "boolean"
|
|
217
|
+
},
|
|
218
|
+
"output": {
|
|
219
|
+
"description": "Output format",
|
|
220
|
+
"name": "output",
|
|
221
|
+
"default": "compact",
|
|
222
|
+
"hasDynamicHelp": false,
|
|
223
|
+
"multiple": false,
|
|
224
|
+
"options": [
|
|
225
|
+
"compact",
|
|
226
|
+
"json",
|
|
227
|
+
"table"
|
|
228
|
+
],
|
|
229
|
+
"type": "option"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"hasDynamicHelp": false,
|
|
233
|
+
"hiddenAliases": [],
|
|
234
|
+
"id": "agents:run",
|
|
235
|
+
"pluginAlias": "@memberjunction/ai-cli",
|
|
236
|
+
"pluginName": "@memberjunction/ai-cli",
|
|
237
|
+
"pluginType": "core",
|
|
238
|
+
"strict": true,
|
|
239
|
+
"enableJsonFlag": false,
|
|
240
|
+
"isESM": false,
|
|
241
|
+
"relativePath": [
|
|
242
|
+
"dist",
|
|
243
|
+
"commands",
|
|
244
|
+
"agents",
|
|
245
|
+
"run.js"
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
"prompts:list": {
|
|
249
|
+
"aliases": [],
|
|
250
|
+
"args": {},
|
|
251
|
+
"description": "List available models for prompt execution",
|
|
252
|
+
"examples": [
|
|
253
|
+
"<%= config.bin %> <%= command.id %>"
|
|
254
|
+
],
|
|
255
|
+
"flags": {
|
|
256
|
+
"verbose": {
|
|
257
|
+
"char": "v",
|
|
258
|
+
"description": "Show detailed model information",
|
|
259
|
+
"name": "verbose",
|
|
260
|
+
"allowNo": false,
|
|
261
|
+
"type": "boolean"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"hasDynamicHelp": false,
|
|
265
|
+
"hiddenAliases": [],
|
|
266
|
+
"id": "prompts:list",
|
|
267
|
+
"pluginAlias": "@memberjunction/ai-cli",
|
|
268
|
+
"pluginName": "@memberjunction/ai-cli",
|
|
269
|
+
"pluginType": "core",
|
|
270
|
+
"strict": true,
|
|
271
|
+
"enableJsonFlag": false,
|
|
272
|
+
"isESM": false,
|
|
273
|
+
"relativePath": [
|
|
274
|
+
"dist",
|
|
275
|
+
"commands",
|
|
276
|
+
"prompts",
|
|
277
|
+
"list.js"
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
"prompts:run": {
|
|
281
|
+
"aliases": [],
|
|
282
|
+
"args": {},
|
|
283
|
+
"description": "Execute a direct prompt with an AI model",
|
|
284
|
+
"examples": [
|
|
285
|
+
"<%= config.bin %> <%= command.id %> -p \"Explain quantum computing in simple terms\"",
|
|
286
|
+
"<%= config.bin %> <%= command.id %> -p \"Write a Python function to sort a list\" --model \"gpt-4\"",
|
|
287
|
+
"<%= config.bin %> <%= command.id %> -p \"Translate to French: Hello world\" --temperature 0.3",
|
|
288
|
+
"<%= config.bin %> <%= command.id %> -p \"Generate a haiku\" --system \"You are a poet\" --max-tokens 100"
|
|
289
|
+
],
|
|
290
|
+
"flags": {
|
|
291
|
+
"prompt": {
|
|
292
|
+
"char": "p",
|
|
293
|
+
"description": "The prompt to execute",
|
|
294
|
+
"name": "prompt",
|
|
295
|
+
"required": true,
|
|
296
|
+
"hasDynamicHelp": false,
|
|
297
|
+
"multiple": false,
|
|
298
|
+
"type": "option"
|
|
299
|
+
},
|
|
300
|
+
"model": {
|
|
301
|
+
"char": "m",
|
|
302
|
+
"description": "AI model to use (e.g., gpt-4, claude-3-opus)",
|
|
303
|
+
"name": "model",
|
|
304
|
+
"hasDynamicHelp": false,
|
|
305
|
+
"multiple": false,
|
|
306
|
+
"type": "option"
|
|
307
|
+
},
|
|
308
|
+
"system": {
|
|
309
|
+
"char": "s",
|
|
310
|
+
"description": "System prompt to set context",
|
|
311
|
+
"name": "system",
|
|
312
|
+
"hasDynamicHelp": false,
|
|
313
|
+
"multiple": false,
|
|
314
|
+
"type": "option"
|
|
315
|
+
},
|
|
316
|
+
"temperature": {
|
|
317
|
+
"char": "t",
|
|
318
|
+
"description": "Temperature for response creativity (0.0-2.0)",
|
|
319
|
+
"name": "temperature",
|
|
320
|
+
"hasDynamicHelp": false,
|
|
321
|
+
"multiple": false,
|
|
322
|
+
"type": "option"
|
|
323
|
+
},
|
|
324
|
+
"max-tokens": {
|
|
325
|
+
"description": "Maximum tokens for the response",
|
|
326
|
+
"name": "max-tokens",
|
|
327
|
+
"hasDynamicHelp": false,
|
|
328
|
+
"multiple": false,
|
|
329
|
+
"type": "option"
|
|
330
|
+
},
|
|
331
|
+
"configuration": {
|
|
332
|
+
"char": "c",
|
|
333
|
+
"description": "AI Configuration ID to use",
|
|
334
|
+
"name": "configuration",
|
|
335
|
+
"hasDynamicHelp": false,
|
|
336
|
+
"multiple": false,
|
|
337
|
+
"type": "option"
|
|
338
|
+
},
|
|
339
|
+
"output": {
|
|
340
|
+
"char": "o",
|
|
341
|
+
"description": "Output format",
|
|
342
|
+
"name": "output",
|
|
343
|
+
"default": "compact",
|
|
344
|
+
"hasDynamicHelp": false,
|
|
345
|
+
"multiple": false,
|
|
346
|
+
"options": [
|
|
347
|
+
"compact",
|
|
348
|
+
"json",
|
|
349
|
+
"table"
|
|
350
|
+
],
|
|
351
|
+
"type": "option"
|
|
352
|
+
},
|
|
353
|
+
"verbose": {
|
|
354
|
+
"char": "v",
|
|
355
|
+
"description": "Show detailed execution information",
|
|
356
|
+
"name": "verbose",
|
|
357
|
+
"allowNo": false,
|
|
358
|
+
"type": "boolean"
|
|
359
|
+
},
|
|
360
|
+
"timeout": {
|
|
361
|
+
"description": "Execution timeout in milliseconds",
|
|
362
|
+
"name": "timeout",
|
|
363
|
+
"default": 300000,
|
|
364
|
+
"hasDynamicHelp": false,
|
|
365
|
+
"multiple": false,
|
|
366
|
+
"type": "option"
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
"hasDynamicHelp": false,
|
|
370
|
+
"hiddenAliases": [],
|
|
371
|
+
"id": "prompts:run",
|
|
372
|
+
"pluginAlias": "@memberjunction/ai-cli",
|
|
373
|
+
"pluginName": "@memberjunction/ai-cli",
|
|
374
|
+
"pluginType": "core",
|
|
375
|
+
"strict": true,
|
|
376
|
+
"enableJsonFlag": false,
|
|
377
|
+
"isESM": false,
|
|
378
|
+
"relativePath": [
|
|
379
|
+
"dist",
|
|
380
|
+
"commands",
|
|
381
|
+
"prompts",
|
|
382
|
+
"run.js"
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"version": "2.78.0"
|
|
387
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@memberjunction/ai-cli",
|
|
3
|
+
"version": "2.78.0",
|
|
4
|
+
"description": "MemberJunction AI agent, prompt and action execution CLI, integrated with the main MJ CLI.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"oclif",
|
|
7
|
+
"ai",
|
|
8
|
+
"agents",
|
|
9
|
+
"actions"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/MemberJunction/MJ",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/MemberJunction/MJ/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/MemberJunction/MJ.git"
|
|
18
|
+
},
|
|
19
|
+
"license": "ISC",
|
|
20
|
+
"author": "MemberJunction",
|
|
21
|
+
"main": "dist/index.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
|
+
"bin": {
|
|
24
|
+
"mj-ai": "bin/run.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"/bin",
|
|
28
|
+
"/dist",
|
|
29
|
+
"/oclif.manifest.json"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -b",
|
|
33
|
+
"prepack": "npm run build && oclif manifest && oclif readme",
|
|
34
|
+
"postpack": "rimraf oclif.manifest.json",
|
|
35
|
+
"version": "oclif readme && git add README.md"
|
|
36
|
+
},
|
|
37
|
+
"oclif": {
|
|
38
|
+
"bin": "mj-ai",
|
|
39
|
+
"commands": "./dist/commands",
|
|
40
|
+
"dirname": "mj-ai",
|
|
41
|
+
"plugins": [
|
|
42
|
+
"@oclif/plugin-help",
|
|
43
|
+
"@oclif/plugin-warn-if-update-available",
|
|
44
|
+
"@oclif/plugin-version"
|
|
45
|
+
],
|
|
46
|
+
"warn-if-update-available": {
|
|
47
|
+
"timeoutInDays": 1
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@inquirer/prompts": "^5.0.1",
|
|
52
|
+
"@memberjunction/actions": "2.78.0",
|
|
53
|
+
"@memberjunction/ai": "2.78.0",
|
|
54
|
+
"@memberjunction/ai-groq": "2.78.0",
|
|
55
|
+
"@memberjunction/ai-openai": "2.78.0",
|
|
56
|
+
"@memberjunction/ai-cerebras": "2.78.0",
|
|
57
|
+
"@memberjunction/ai-anthropic": "2.78.0",
|
|
58
|
+
"@memberjunction/ai-betty-bot": "2.78.0",
|
|
59
|
+
"@memberjunction/ai-mistral": "2.78.0",
|
|
60
|
+
"@memberjunction/ai-agents": "2.78.0",
|
|
61
|
+
"@memberjunction/ai-prompts": "2.78.0",
|
|
62
|
+
"@memberjunction/core": "2.78.0",
|
|
63
|
+
"@memberjunction/core-actions": "2.78.0",
|
|
64
|
+
"@memberjunction/core-entities": "2.78.0",
|
|
65
|
+
"@memberjunction/core-entities-server": "2.78.0",
|
|
66
|
+
"@memberjunction/sqlserver-dataprovider": "2.78.0",
|
|
67
|
+
"@oclif/core": "^3",
|
|
68
|
+
"@oclif/plugin-help": "^6",
|
|
69
|
+
"@oclif/plugin-version": "^2.0.17",
|
|
70
|
+
"@oclif/plugin-warn-if-update-available": "^3.0.16",
|
|
71
|
+
"cosmiconfig": "9.0.0",
|
|
72
|
+
"dotenv": "16.4.5",
|
|
73
|
+
"chalk": "^4.1.2",
|
|
74
|
+
"ora-classic": "^5.4.2",
|
|
75
|
+
"readline": "^1.3.0",
|
|
76
|
+
"table": "^6.8.1"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@oclif/prettier-config": "^0.2.1",
|
|
80
|
+
"oclif": "^4",
|
|
81
|
+
"rimraf": "5.0.7",
|
|
82
|
+
"ts-node": "^10.9.2",
|
|
83
|
+
"typescript": "^5.4.5"
|
|
84
|
+
},
|
|
85
|
+
"engines": {
|
|
86
|
+
"node": ">=20.0.0"
|
|
87
|
+
}
|
|
88
|
+
}
|