@sowonai/crewx-sdk 0.1.0-dev.5 → 0.1.0-dev.6
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/core/providers/dynamic-provider.factory.d.ts +64 -0
- package/dist/core/providers/dynamic-provider.factory.js +533 -0
- package/dist/core/providers/dynamic-provider.factory.js.map +1 -0
- package/dist/core/providers/index.d.ts +1 -0
- package/dist/core/providers/index.js +3 -1
- package/dist/core/providers/index.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/types/agent.types.d.ts +6 -1
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BaseAIProvider } from './base-ai.provider';
|
|
2
|
+
import type { LoggerLike } from './base-ai.types';
|
|
3
|
+
export interface PluginProviderConfig {
|
|
4
|
+
id: string;
|
|
5
|
+
type: 'plugin';
|
|
6
|
+
cli_command: string;
|
|
7
|
+
display_name?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
default_model?: string;
|
|
10
|
+
query_args: string[];
|
|
11
|
+
execute_args: string[];
|
|
12
|
+
prompt_in_args: boolean;
|
|
13
|
+
timeout?: {
|
|
14
|
+
query: number;
|
|
15
|
+
execute: number;
|
|
16
|
+
};
|
|
17
|
+
error_patterns?: Array<{
|
|
18
|
+
pattern: string;
|
|
19
|
+
type: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}>;
|
|
22
|
+
not_installed_message?: string;
|
|
23
|
+
env?: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
export interface RemoteProviderConfig {
|
|
26
|
+
id: string;
|
|
27
|
+
type: 'remote';
|
|
28
|
+
location: string;
|
|
29
|
+
external_agent_id: string;
|
|
30
|
+
display_name?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
default_model?: string;
|
|
33
|
+
auth?: {
|
|
34
|
+
type: 'bearer' | 'api_key' | 'none';
|
|
35
|
+
token?: string;
|
|
36
|
+
};
|
|
37
|
+
timeout?: {
|
|
38
|
+
query: number;
|
|
39
|
+
execute: number;
|
|
40
|
+
};
|
|
41
|
+
headers?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
export type DynamicProviderConfig = PluginProviderConfig | RemoteProviderConfig;
|
|
44
|
+
export interface DynamicProviderFactoryOptions {
|
|
45
|
+
logger?: LoggerLike;
|
|
46
|
+
}
|
|
47
|
+
export declare class BaseDynamicProviderFactory {
|
|
48
|
+
protected readonly logger: LoggerLike;
|
|
49
|
+
protected readonly timeoutConfig: import("../../config/timeout.config").TimeoutConfig;
|
|
50
|
+
constructor(options?: DynamicProviderFactoryOptions);
|
|
51
|
+
createProvider(config: DynamicProviderConfig): BaseAIProvider;
|
|
52
|
+
validateConfig(config: unknown): config is DynamicProviderConfig;
|
|
53
|
+
protected createPluginProvider(config: PluginProviderConfig): BaseAIProvider;
|
|
54
|
+
protected createRemoteProvider(config: RemoteProviderConfig): BaseAIProvider;
|
|
55
|
+
protected validateCliCommand(cliCommand: string): void;
|
|
56
|
+
protected validateCliArgs(args: string[]): void;
|
|
57
|
+
protected validateErrorPatterns(patterns?: Array<{
|
|
58
|
+
pattern: string;
|
|
59
|
+
type: string;
|
|
60
|
+
message: string;
|
|
61
|
+
}>): void;
|
|
62
|
+
protected validateEnv(env?: Record<string, string>): void;
|
|
63
|
+
protected validateRemoteConfig(config: RemoteProviderConfig): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.BaseDynamicProviderFactory = void 0;
|
|
37
|
+
const base_ai_provider_1 = require("./base-ai.provider");
|
|
38
|
+
const ai_provider_interface_1 = require("./ai-provider.interface");
|
|
39
|
+
const timeout_config_1 = require("../../config/timeout.config");
|
|
40
|
+
class ConsoleLogger {
|
|
41
|
+
constructor(context) {
|
|
42
|
+
this.context = context;
|
|
43
|
+
}
|
|
44
|
+
log(message, ...optionalParams) {
|
|
45
|
+
console.log(`[${this.context}]`, message, ...optionalParams);
|
|
46
|
+
}
|
|
47
|
+
warn(message, ...optionalParams) {
|
|
48
|
+
console.warn(`[${this.context}]`, message, ...optionalParams);
|
|
49
|
+
}
|
|
50
|
+
error(message, ...optionalParams) {
|
|
51
|
+
const resolved = message instanceof Error ? message.message : message;
|
|
52
|
+
console.error(`[${this.context}]`, resolved, ...optionalParams);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class BaseDynamicProviderFactory {
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this.timeoutConfig = (0, timeout_config_1.getTimeoutConfig)();
|
|
58
|
+
this.logger = options.logger ?? new ConsoleLogger('DynamicProviderFactory');
|
|
59
|
+
}
|
|
60
|
+
createProvider(config) {
|
|
61
|
+
this.logger.log(`Creating dynamic provider: ${config.id}`);
|
|
62
|
+
if (config.type === 'plugin') {
|
|
63
|
+
return this.createPluginProvider(config);
|
|
64
|
+
}
|
|
65
|
+
if (config.type === 'remote') {
|
|
66
|
+
return this.createRemoteProvider(config);
|
|
67
|
+
}
|
|
68
|
+
throw new Error(`Unknown provider type: ${config.type}`);
|
|
69
|
+
}
|
|
70
|
+
validateConfig(config) {
|
|
71
|
+
if (!config || typeof config !== 'object') {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const base = config;
|
|
75
|
+
if (!base.id || typeof base.id !== 'string') {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
if (base.type === 'plugin') {
|
|
79
|
+
return (typeof base.cli_command === 'string' &&
|
|
80
|
+
Array.isArray(base.query_args) &&
|
|
81
|
+
Array.isArray(base.execute_args) &&
|
|
82
|
+
typeof base.prompt_in_args === 'boolean');
|
|
83
|
+
}
|
|
84
|
+
if (base.type === 'remote') {
|
|
85
|
+
return (typeof base.location === 'string' &&
|
|
86
|
+
typeof base.external_agent_id === 'string');
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
createPluginProvider(config) {
|
|
91
|
+
this.validateCliCommand(config.cli_command);
|
|
92
|
+
this.validateCliArgs(config.query_args);
|
|
93
|
+
this.validateCliArgs(config.execute_args);
|
|
94
|
+
this.validateErrorPatterns(config.error_patterns);
|
|
95
|
+
this.validateEnv(config.env);
|
|
96
|
+
const factory = this;
|
|
97
|
+
class DynamicAIProvider extends base_ai_provider_1.BaseAIProvider {
|
|
98
|
+
constructor() {
|
|
99
|
+
super(`DynamicProvider:${ai_provider_interface_1.ProviderNamespace.PLUGIN}/${config.id}`);
|
|
100
|
+
this.name = `${ai_provider_interface_1.ProviderNamespace.PLUGIN}/${config.id}`;
|
|
101
|
+
}
|
|
102
|
+
getCliCommand() {
|
|
103
|
+
return config.cli_command;
|
|
104
|
+
}
|
|
105
|
+
getDefaultArgs() {
|
|
106
|
+
return config.query_args || [];
|
|
107
|
+
}
|
|
108
|
+
getExecuteArgs() {
|
|
109
|
+
return config.execute_args || [];
|
|
110
|
+
}
|
|
111
|
+
getDefaultModel() {
|
|
112
|
+
return config.default_model || 'default';
|
|
113
|
+
}
|
|
114
|
+
getPromptInArgs() {
|
|
115
|
+
return config.prompt_in_args ?? false;
|
|
116
|
+
}
|
|
117
|
+
shouldPipeContext() {
|
|
118
|
+
if (this.getPromptInArgs()) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return super.shouldPipeContext();
|
|
122
|
+
}
|
|
123
|
+
getNotInstalledMessage() {
|
|
124
|
+
return (config.not_installed_message ||
|
|
125
|
+
`${config.display_name || config.id} CLI is not installed.`);
|
|
126
|
+
}
|
|
127
|
+
getDefaultQueryTimeout() {
|
|
128
|
+
return config.timeout?.query ?? 600000;
|
|
129
|
+
}
|
|
130
|
+
getDefaultExecuteTimeout() {
|
|
131
|
+
return config.timeout?.execute ?? factory.timeoutConfig.parallel;
|
|
132
|
+
}
|
|
133
|
+
getEnv() {
|
|
134
|
+
return config.env || {};
|
|
135
|
+
}
|
|
136
|
+
async isAvailable() {
|
|
137
|
+
const cliCommand = this.getCliCommand();
|
|
138
|
+
if (cliCommand.includes('/') || cliCommand.includes('\\')) {
|
|
139
|
+
try {
|
|
140
|
+
const { access } = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
141
|
+
const { constants } = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
142
|
+
const { resolve } = await Promise.resolve().then(() => __importStar(require('path')));
|
|
143
|
+
const absolutePath = resolve(process.cwd(), cliCommand);
|
|
144
|
+
await access(absolutePath, constants.X_OK);
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return super.isAvailable();
|
|
152
|
+
}
|
|
153
|
+
parseProviderError(stderr, stdout) {
|
|
154
|
+
if (!config.error_patterns) {
|
|
155
|
+
return super.parseProviderError(stderr, stdout);
|
|
156
|
+
}
|
|
157
|
+
const combinedOutput = stderr || stdout;
|
|
158
|
+
for (const errorPattern of config.error_patterns) {
|
|
159
|
+
if (combinedOutput.includes(errorPattern.pattern)) {
|
|
160
|
+
return {
|
|
161
|
+
error: true,
|
|
162
|
+
message: errorPattern.message,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return super.parseProviderError(stderr, stdout);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return new DynamicAIProvider();
|
|
170
|
+
}
|
|
171
|
+
createRemoteProvider(config) {
|
|
172
|
+
this.logger.log(`Creating remote provider: ${config.id}`);
|
|
173
|
+
this.validateRemoteConfig(config);
|
|
174
|
+
const factory = this;
|
|
175
|
+
class RemoteAIProvider extends base_ai_provider_1.BaseAIProvider {
|
|
176
|
+
constructor() {
|
|
177
|
+
super(`RemoteProvider:${ai_provider_interface_1.ProviderNamespace.REMOTE}/${config.id}`);
|
|
178
|
+
this.name = `${ai_provider_interface_1.ProviderNamespace.REMOTE}/${config.id}`;
|
|
179
|
+
}
|
|
180
|
+
getCliCommand() {
|
|
181
|
+
if (config.location.startsWith('file://')) {
|
|
182
|
+
return 'crewx';
|
|
183
|
+
}
|
|
184
|
+
return 'curl';
|
|
185
|
+
}
|
|
186
|
+
getDefaultArgs() {
|
|
187
|
+
if (config.location.startsWith('file://')) {
|
|
188
|
+
const configPath = config.location.replace('file://', '');
|
|
189
|
+
return [
|
|
190
|
+
'query',
|
|
191
|
+
'--raw',
|
|
192
|
+
`--config=${configPath}`,
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
const args = [
|
|
196
|
+
'-X', 'POST',
|
|
197
|
+
`${config.location}/mcp/query`,
|
|
198
|
+
'-H', 'Content-Type: application/json',
|
|
199
|
+
];
|
|
200
|
+
const authHeader = this.getAuthHeader();
|
|
201
|
+
if (authHeader) {
|
|
202
|
+
args.push('-H', `Authorization: ${authHeader}`);
|
|
203
|
+
}
|
|
204
|
+
return args;
|
|
205
|
+
}
|
|
206
|
+
getExecuteArgs() {
|
|
207
|
+
if (config.location.startsWith('file://')) {
|
|
208
|
+
const configPath = config.location.replace('file://', '');
|
|
209
|
+
return [
|
|
210
|
+
'execute',
|
|
211
|
+
'--raw',
|
|
212
|
+
`--config=${configPath}`,
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
const args = [
|
|
216
|
+
'-X', 'POST',
|
|
217
|
+
`${config.location}/mcp/execute`,
|
|
218
|
+
'-H', 'Content-Type: application/json',
|
|
219
|
+
];
|
|
220
|
+
const authHeader = this.getAuthHeader();
|
|
221
|
+
if (authHeader) {
|
|
222
|
+
args.push('-H', `Authorization: ${authHeader}`);
|
|
223
|
+
}
|
|
224
|
+
return args;
|
|
225
|
+
}
|
|
226
|
+
getDefaultModel() {
|
|
227
|
+
return config.default_model || 'default';
|
|
228
|
+
}
|
|
229
|
+
getPromptInArgs() {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
getNotInstalledMessage() {
|
|
233
|
+
if (config.location.startsWith('file://')) {
|
|
234
|
+
const configPath = config.location.replace('file://', '');
|
|
235
|
+
return `Remote CrewX configuration not found: ${configPath}`;
|
|
236
|
+
}
|
|
237
|
+
return `Remote CrewX server not accessible: ${config.location}`;
|
|
238
|
+
}
|
|
239
|
+
getDefaultQueryTimeout() {
|
|
240
|
+
return config.timeout?.query ?? 300000;
|
|
241
|
+
}
|
|
242
|
+
getDefaultExecuteTimeout() {
|
|
243
|
+
return config.timeout?.execute ?? 600000;
|
|
244
|
+
}
|
|
245
|
+
getAuthHeader() {
|
|
246
|
+
if (!config.auth || config.auth.type === 'none') {
|
|
247
|
+
return '';
|
|
248
|
+
}
|
|
249
|
+
if (config.auth.type === 'bearer' && config.auth.token) {
|
|
250
|
+
return `Bearer ${config.auth.token}`;
|
|
251
|
+
}
|
|
252
|
+
if (config.auth.type === 'api_key' && config.auth.token) {
|
|
253
|
+
return `Api-Key ${config.auth.token}`;
|
|
254
|
+
}
|
|
255
|
+
return '';
|
|
256
|
+
}
|
|
257
|
+
getAuthHeaders() {
|
|
258
|
+
const headers = {};
|
|
259
|
+
if (!config.auth || config.auth.type === 'none') {
|
|
260
|
+
return headers;
|
|
261
|
+
}
|
|
262
|
+
if (config.auth.token) {
|
|
263
|
+
if (config.auth.type === 'bearer') {
|
|
264
|
+
headers['Authorization'] = `Bearer ${config.auth.token}`;
|
|
265
|
+
}
|
|
266
|
+
else if (config.auth.type === 'api_key') {
|
|
267
|
+
headers['Api-Key'] = config.auth.token;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return headers;
|
|
271
|
+
}
|
|
272
|
+
async isAvailable() {
|
|
273
|
+
if (config.location.startsWith('file://')) {
|
|
274
|
+
try {
|
|
275
|
+
const { access } = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
276
|
+
const { constants } = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
277
|
+
const configPath = config.location.replace('file://', '');
|
|
278
|
+
await access(configPath, constants.R_OK);
|
|
279
|
+
const cliAvailable = await super.isAvailable();
|
|
280
|
+
return cliAvailable;
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
287
|
+
const controller = new AbortController();
|
|
288
|
+
const timeoutId = setTimeout(() => controller.abort(), 5000);
|
|
289
|
+
const healthHeaders = {
|
|
290
|
+
...(config.headers || {}),
|
|
291
|
+
...this.getAuthHeaders(),
|
|
292
|
+
};
|
|
293
|
+
const response = await fetch(`${config.location}/health`, {
|
|
294
|
+
method: 'GET',
|
|
295
|
+
signal: controller.signal,
|
|
296
|
+
headers: healthHeaders,
|
|
297
|
+
});
|
|
298
|
+
clearTimeout(timeoutId);
|
|
299
|
+
return response.ok;
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
async query(prompt, options) {
|
|
306
|
+
if (config.location.startsWith('http')) {
|
|
307
|
+
return this.httpQuery(prompt, options);
|
|
308
|
+
}
|
|
309
|
+
const validated = await this.ensureFileConfigExists(options);
|
|
310
|
+
if (!validated.ok) {
|
|
311
|
+
return validated.response;
|
|
312
|
+
}
|
|
313
|
+
const userQuery = this.parseUserQueryForRemote(prompt);
|
|
314
|
+
const formattedPrompt = userQuery
|
|
315
|
+
? `@${config.external_agent_id} ${userQuery}`
|
|
316
|
+
: `@${config.external_agent_id}`;
|
|
317
|
+
const structuredPayload = this.normalizeStructuredPayload(prompt, options);
|
|
318
|
+
const extendedOptions = {
|
|
319
|
+
...options,
|
|
320
|
+
};
|
|
321
|
+
if (structuredPayload) {
|
|
322
|
+
extendedOptions.pipedContext = structuredPayload;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
delete extendedOptions.pipedContext;
|
|
326
|
+
}
|
|
327
|
+
return super.query(formattedPrompt, extendedOptions);
|
|
328
|
+
}
|
|
329
|
+
async execute(prompt, options) {
|
|
330
|
+
if (config.location.startsWith('http')) {
|
|
331
|
+
return super.execute(prompt, options);
|
|
332
|
+
}
|
|
333
|
+
const validated = await this.ensureFileConfigExists(options);
|
|
334
|
+
if (!validated.ok) {
|
|
335
|
+
return validated.response;
|
|
336
|
+
}
|
|
337
|
+
const userQuery = this.parseUserQueryForRemote(prompt);
|
|
338
|
+
const formattedPrompt = userQuery
|
|
339
|
+
? `@${config.external_agent_id} ${userQuery}`
|
|
340
|
+
: `@${config.external_agent_id}`;
|
|
341
|
+
const structuredPayload = this.normalizeStructuredPayload(prompt, options);
|
|
342
|
+
const extendedOptions = {
|
|
343
|
+
...options,
|
|
344
|
+
};
|
|
345
|
+
if (structuredPayload) {
|
|
346
|
+
extendedOptions.pipedContext = structuredPayload;
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
delete extendedOptions.pipedContext;
|
|
350
|
+
}
|
|
351
|
+
return super.execute(formattedPrompt, extendedOptions);
|
|
352
|
+
}
|
|
353
|
+
async httpQuery(prompt, options) {
|
|
354
|
+
const requestBody = {
|
|
355
|
+
prompt,
|
|
356
|
+
agent_id: config.external_agent_id,
|
|
357
|
+
task_id: options?.taskId,
|
|
358
|
+
model: options?.model || this.getDefaultModel(),
|
|
359
|
+
working_directory: options?.workingDirectory,
|
|
360
|
+
};
|
|
361
|
+
const structuredPayload = this.normalizeStructuredPayload(prompt, options);
|
|
362
|
+
if (structuredPayload) {
|
|
363
|
+
requestBody.structured_payload = structuredPayload;
|
|
364
|
+
}
|
|
365
|
+
if (options?.messages && options.messages.length > 0) {
|
|
366
|
+
requestBody.messages = options.messages;
|
|
367
|
+
}
|
|
368
|
+
if (options?.pipedContext) {
|
|
369
|
+
const trimmed = options.pipedContext.trim();
|
|
370
|
+
if (!this.isStructuredPayload(trimmed)) {
|
|
371
|
+
requestBody.context = trimmed;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
const controller = new AbortController();
|
|
376
|
+
const timeoutMs = options?.timeout || this.getDefaultQueryTimeout();
|
|
377
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
378
|
+
const response = await fetch(`${config.location}/mcp/query`, {
|
|
379
|
+
method: 'POST',
|
|
380
|
+
headers: {
|
|
381
|
+
'Content-Type': 'application/json',
|
|
382
|
+
...this.getAuthHeaders(),
|
|
383
|
+
...(config.headers || {}),
|
|
384
|
+
},
|
|
385
|
+
body: JSON.stringify(requestBody),
|
|
386
|
+
signal: controller.signal,
|
|
387
|
+
});
|
|
388
|
+
clearTimeout(timeoutId);
|
|
389
|
+
if (!response.ok) {
|
|
390
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
391
|
+
}
|
|
392
|
+
const result = await response.json();
|
|
393
|
+
return {
|
|
394
|
+
content: result.content,
|
|
395
|
+
provider: this.name,
|
|
396
|
+
command: `remote query to ${config.location}`,
|
|
397
|
+
success: result.success !== false,
|
|
398
|
+
error: result.error,
|
|
399
|
+
taskId: result.task_id,
|
|
400
|
+
toolCall: result.tool_call,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
catch (error) {
|
|
404
|
+
return {
|
|
405
|
+
content: '',
|
|
406
|
+
provider: this.name,
|
|
407
|
+
command: `remote query to ${config.location}`,
|
|
408
|
+
success: false,
|
|
409
|
+
error: error.message,
|
|
410
|
+
taskId: options?.taskId,
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
parseUserQueryForRemote(prompt) {
|
|
415
|
+
if (!prompt) {
|
|
416
|
+
return '';
|
|
417
|
+
}
|
|
418
|
+
const match = prompt.match(/<user_query key="[^"]+">\s*([\s\S]*?)\s*<\/user_query>/i);
|
|
419
|
+
if (match && match[1]) {
|
|
420
|
+
return match[1].trim();
|
|
421
|
+
}
|
|
422
|
+
return prompt.trim();
|
|
423
|
+
}
|
|
424
|
+
normalizeStructuredPayload(prompt, options) {
|
|
425
|
+
const existing = options?.pipedContext?.trim();
|
|
426
|
+
if (existing) {
|
|
427
|
+
if (this.isStructuredPayload(existing)) {
|
|
428
|
+
return existing;
|
|
429
|
+
}
|
|
430
|
+
return this.createStructuredPayload(prompt, existing, options);
|
|
431
|
+
}
|
|
432
|
+
if (options?.messages && options.messages.length > 0) {
|
|
433
|
+
return this.createStructuredPayload(prompt, null, options);
|
|
434
|
+
}
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
async ensureFileConfigExists(options) {
|
|
438
|
+
if (!config.location.startsWith('file://')) {
|
|
439
|
+
return { ok: true };
|
|
440
|
+
}
|
|
441
|
+
const configPath = config.location.replace('file://', '');
|
|
442
|
+
try {
|
|
443
|
+
const { access } = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
444
|
+
const { constants } = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
445
|
+
await access(configPath, constants.R_OK);
|
|
446
|
+
return { ok: true };
|
|
447
|
+
}
|
|
448
|
+
catch {
|
|
449
|
+
return {
|
|
450
|
+
ok: false,
|
|
451
|
+
response: {
|
|
452
|
+
content: `Remote CrewX configuration not found: ${configPath}`,
|
|
453
|
+
provider: this.name,
|
|
454
|
+
command: `crewx --config=${configPath}`,
|
|
455
|
+
success: false,
|
|
456
|
+
error: `Remote CrewX configuration not found: ${configPath}`,
|
|
457
|
+
taskId: options?.taskId,
|
|
458
|
+
},
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return new RemoteAIProvider();
|
|
464
|
+
}
|
|
465
|
+
validateCliCommand(cliCommand) {
|
|
466
|
+
if (!cliCommand || typeof cliCommand !== 'string') {
|
|
467
|
+
throw new Error('Plugin provider requires a CLI command');
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
validateCliArgs(args) {
|
|
471
|
+
if (!Array.isArray(args)) {
|
|
472
|
+
throw new Error('CLI arguments must be an array');
|
|
473
|
+
}
|
|
474
|
+
for (const arg of args) {
|
|
475
|
+
if (typeof arg !== 'string') {
|
|
476
|
+
throw new Error('CLI argument must be a string');
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
validateErrorPatterns(patterns) {
|
|
481
|
+
if (!patterns) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
for (const { pattern } of patterns) {
|
|
485
|
+
try {
|
|
486
|
+
new RegExp(pattern);
|
|
487
|
+
}
|
|
488
|
+
catch (error) {
|
|
489
|
+
throw new Error(`Invalid regex pattern '${pattern}': ${error.message}`);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
validateEnv(env) {
|
|
494
|
+
if (!env) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
for (const [key, value] of Object.entries(env)) {
|
|
498
|
+
if (typeof key !== 'string' || typeof value !== 'string') {
|
|
499
|
+
throw new Error('Environment variables must be string key/value pairs');
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
validateRemoteConfig(config) {
|
|
504
|
+
if (!config.location) {
|
|
505
|
+
throw new Error('Remote provider requires a location (file:// or http(s):// URL)');
|
|
506
|
+
}
|
|
507
|
+
if (!config.external_agent_id) {
|
|
508
|
+
throw new Error('Remote provider requires an external_agent_id');
|
|
509
|
+
}
|
|
510
|
+
if (!config.location.startsWith('file://') &&
|
|
511
|
+
!config.location.startsWith('http://') &&
|
|
512
|
+
!config.location.startsWith('https://')) {
|
|
513
|
+
throw new Error('Remote location must start with file://, http://, or https://');
|
|
514
|
+
}
|
|
515
|
+
if (config.location.startsWith('file://')) {
|
|
516
|
+
const filePath = config.location.replace('file://', '');
|
|
517
|
+
if (filePath.includes('..')) {
|
|
518
|
+
throw new Error('Path traversal (..) is not allowed in remote file locations');
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (config.auth) {
|
|
522
|
+
const validAuthTypes = ['bearer', 'api_key', 'none'];
|
|
523
|
+
if (!validAuthTypes.includes(config.auth.type)) {
|
|
524
|
+
throw new Error(`Invalid auth type: ${config.auth.type}. Must be one of: ${validAuthTypes.join(', ')}`);
|
|
525
|
+
}
|
|
526
|
+
if (config.auth.type !== 'none' && !config.auth.token) {
|
|
527
|
+
throw new Error(`Auth type '${config.auth.type}' requires a token`);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
exports.BaseDynamicProviderFactory = BaseDynamicProviderFactory;
|
|
533
|
+
//# sourceMappingURL=dynamic-provider.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-provider.factory.js","sourceRoot":"","sources":["../../../src/core/providers/dynamic-provider.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAoD;AACpD,mEAIiC;AACjC,gEAA+D;AAG/D,MAAM,aAAa;IACjB,YAA6B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAEhD,GAAG,CAAC,OAAe,EAAE,GAAG,cAAqB;QAC3C,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAG,cAAqB;QAC5C,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,OAAuB,EAAE,GAAG,cAAqB;QACrD,MAAM,QAAQ,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QACtE,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,GAAG,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC,CAAC;IAClE,CAAC;CACF;AAuDD,MAAa,0BAA0B;IAIrC,YAAY,UAAyC,EAAE;QAFpC,kBAAa,GAAG,IAAA,iCAAgB,GAAE,CAAC;QAGpD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,aAAa,CAAC,wBAAwB,CAAC,CAAC;IAC9E,CAAC;IAKD,cAAc,CAAC,MAA6B;QAC1C,IAAI,CAAC,M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AAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/C,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,CAAC,IAAI,CAAC,IAAI,qBAAqB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC1G,CAAC;YAED,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACtD,MAAM,IAAI,KAAK,CAAC,cAAc,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;IACH,CAAC;CACF;AApnBD,gEAonBC"}
|
|
@@ -3,3 +3,4 @@ export { ClaudeProvider } from './claude.provider';
|
|
|
3
3
|
export { GeminiProvider } from './gemini.provider';
|
|
4
4
|
export { CopilotProvider } from './copilot.provider';
|
|
5
5
|
export { CodexProvider } from './codex.provider';
|
|
6
|
+
export { BaseDynamicProviderFactory, type PluginProviderConfig, type RemoteProviderConfig, type DynamicProviderConfig, type DynamicProviderFactoryOptions, } from './dynamic-provider.factory';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CodexProvider = exports.CopilotProvider = exports.GeminiProvider = exports.ClaudeProvider = exports.BaseAIProvider = void 0;
|
|
3
|
+
exports.BaseDynamicProviderFactory = exports.CodexProvider = exports.CopilotProvider = exports.GeminiProvider = exports.ClaudeProvider = exports.BaseAIProvider = void 0;
|
|
4
4
|
var base_ai_provider_1 = require("./base-ai.provider");
|
|
5
5
|
Object.defineProperty(exports, "BaseAIProvider", { enumerable: true, get: function () { return base_ai_provider_1.BaseAIProvider; } });
|
|
6
6
|
var claude_provider_1 = require("./claude.provider");
|
|
@@ -11,4 +11,6 @@ var copilot_provider_1 = require("./copilot.provider");
|
|
|
11
11
|
Object.defineProperty(exports, "CopilotProvider", { enumerable: true, get: function () { return copilot_provider_1.CopilotProvider; } });
|
|
12
12
|
var codex_provider_1 = require("./codex.provider");
|
|
13
13
|
Object.defineProperty(exports, "CodexProvider", { enumerable: true, get: function () { return codex_provider_1.CodexProvider; } });
|
|
14
|
+
var dynamic_provider_factory_1 = require("./dynamic-provider.factory");
|
|
15
|
+
Object.defineProperty(exports, "BaseDynamicProviderFactory", { enumerable: true, get: function () { return dynamic_provider_factory_1.BaseDynamicProviderFactory; } });
|
|
14
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/providers/index.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/providers/index.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,uEAMoC;AALlC,sIAAA,0BAA0B,OAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,9 @@ export { DocumentManager } from './knowledge/DocumentManager';
|
|
|
8
8
|
export { ProviderNamespace, BuiltInProviders, ProviderNotAvailableError, } from './core/providers/ai-provider.interface';
|
|
9
9
|
export type { ProviderNamespaceType, AIProvider, AIQueryOptions, AIResponse, } from './core/providers/ai-provider.interface';
|
|
10
10
|
export { BaseAIProvider } from './core/providers/base-ai.provider';
|
|
11
|
-
export { ClaudeProvider, GeminiProvider, CopilotProvider, CodexProvider, } from './core/providers';
|
|
11
|
+
export { ClaudeProvider, GeminiProvider, CopilotProvider, CodexProvider, BaseDynamicProviderFactory, } from './core/providers';
|
|
12
12
|
export type { BaseAIProviderOptions, LoggerLike, AIProviderConfig, } from './core/providers/base-ai.types';
|
|
13
|
+
export type { PluginProviderConfig, RemoteProviderConfig, DynamicProviderConfig, DynamicProviderFactoryOptions, } from './core/providers/dynamic-provider.factory';
|
|
13
14
|
export type { Tool, ToolExecutionContext, ToolExecutionResult, ToolCallHandler, } from './core/providers/tool-call.types';
|
|
14
15
|
export type { AgentAction, AgentConfig, AgentsConfig, AgentInfo, AgentQueryOptions, AgentResponse, RemoteAgentConfigInput, RemoteAgentInfo, } from './types/agent.types';
|
|
15
16
|
export { ExecutionMode, SecurityLevel } from './types/agent.types';
|
|
@@ -26,5 +27,6 @@ export { ParallelRunner, ParallelRunnerTimeoutError, createDefaultParallelRunner
|
|
|
26
27
|
export type { ParallelRunnerMetrics, ParallelRunnerOptions, Task, TaskResult, TaskCallbacks, TaskExecutionContext, ParallelConfig, HelperResult, RetryPolicy, } from './core/parallel';
|
|
27
28
|
export { PropsValidator, type ValidationMode, } from './services/props-validator.service';
|
|
28
29
|
export type { PropSchema, ValidationResult as PropsValidationResult, ValidationError as PropsValidationDetail, } from './types/layout.types';
|
|
30
|
+
export { LayoutLoader } from './services/layout-loader.service';
|
|
29
31
|
export { LayoutRenderer, PropsValidationError, type RenderOptions, } from './services/layout-renderer.service';
|
|
30
|
-
export type { RenderContext, LayoutDefinition, ValidationResult, ValidationError, } from './types/layout.types';
|
|
32
|
+
export type { RenderContext, LayoutDefinition, ValidationResult, ValidationError, LoaderOptions, LayoutLoadError, InlineLayoutSpec, } from './types/layout.types';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PropsValidationError = exports.LayoutRenderer = exports.PropsValidator = exports.runExecutesParallel = exports.runQueriesParallel = exports.createDefaultParallelRunner = exports.ParallelRunnerTimeoutError = exports.ParallelRunner = exports.MockRemoteTransport = exports.FetchRemoteTransport = exports.RemoteAgentManager = exports.loadAgentConfigFromFile = exports.loadAgentConfigFromYaml = exports.createCrewxAgent = exports.createStructuredPayload = exports.parseStructuredPayload = exports.isStructuredPayload = exports.DefaultMessageFormatter = exports.BaseMessageFormatter = exports.loadAvailableAgents = exports.MentionParser = exports.isError = exports.getErrorStack = exports.getErrorMessage = exports.SecurityLevel = exports.ExecutionMode = exports.CodexProvider = exports.CopilotProvider = exports.GeminiProvider = exports.ClaudeProvider = exports.BaseAIProvider = exports.ProviderNotAvailableError = exports.BuiltInProviders = exports.ProviderNamespace = exports.DocumentManager = exports.getConversationConfig = exports.DEFAULT_CONVERSATION_CONFIG = exports.getDefaultTimeoutConfig = exports.getTimeoutConfig = exports.DEFAULT_MAX_FILES = exports.DEFAULT_MAX_FILE_SIZE = exports.PREFIX_TOOL_NAME = exports.SERVER_NAME = void 0;
|
|
3
|
+
exports.PropsValidationError = exports.LayoutRenderer = exports.LayoutLoader = exports.PropsValidator = exports.runExecutesParallel = exports.runQueriesParallel = exports.createDefaultParallelRunner = exports.ParallelRunnerTimeoutError = exports.ParallelRunner = exports.MockRemoteTransport = exports.FetchRemoteTransport = exports.RemoteAgentManager = exports.loadAgentConfigFromFile = exports.loadAgentConfigFromYaml = exports.createCrewxAgent = exports.createStructuredPayload = exports.parseStructuredPayload = exports.isStructuredPayload = exports.DefaultMessageFormatter = exports.BaseMessageFormatter = exports.loadAvailableAgents = exports.MentionParser = exports.isError = exports.getErrorStack = exports.getErrorMessage = exports.SecurityLevel = exports.ExecutionMode = exports.BaseDynamicProviderFactory = exports.CodexProvider = exports.CopilotProvider = exports.GeminiProvider = exports.ClaudeProvider = exports.BaseAIProvider = exports.ProviderNotAvailableError = exports.BuiltInProviders = exports.ProviderNamespace = exports.DocumentManager = exports.getConversationConfig = exports.DEFAULT_CONVERSATION_CONFIG = exports.getDefaultTimeoutConfig = exports.getTimeoutConfig = exports.DEFAULT_MAX_FILES = exports.DEFAULT_MAX_FILE_SIZE = exports.PREFIX_TOOL_NAME = exports.SERVER_NAME = void 0;
|
|
4
4
|
var constants_1 = require("./constants");
|
|
5
5
|
Object.defineProperty(exports, "SERVER_NAME", { enumerable: true, get: function () { return constants_1.SERVER_NAME; } });
|
|
6
6
|
Object.defineProperty(exports, "PREFIX_TOOL_NAME", { enumerable: true, get: function () { return constants_1.PREFIX_TOOL_NAME; } });
|
|
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "ClaudeProvider", { enumerable: true, get: functi
|
|
|
25
25
|
Object.defineProperty(exports, "GeminiProvider", { enumerable: true, get: function () { return providers_1.GeminiProvider; } });
|
|
26
26
|
Object.defineProperty(exports, "CopilotProvider", { enumerable: true, get: function () { return providers_1.CopilotProvider; } });
|
|
27
27
|
Object.defineProperty(exports, "CodexProvider", { enumerable: true, get: function () { return providers_1.CodexProvider; } });
|
|
28
|
+
Object.defineProperty(exports, "BaseDynamicProviderFactory", { enumerable: true, get: function () { return providers_1.BaseDynamicProviderFactory; } });
|
|
28
29
|
var agent_types_1 = require("./types/agent.types");
|
|
29
30
|
Object.defineProperty(exports, "ExecutionMode", { enumerable: true, get: function () { return agent_types_1.ExecutionMode; } });
|
|
30
31
|
Object.defineProperty(exports, "SecurityLevel", { enumerable: true, get: function () { return agent_types_1.SecurityLevel; } });
|
|
@@ -58,6 +59,8 @@ Object.defineProperty(exports, "runQueriesParallel", { enumerable: true, get: fu
|
|
|
58
59
|
Object.defineProperty(exports, "runExecutesParallel", { enumerable: true, get: function () { return parallel_1.runExecutesParallel; } });
|
|
59
60
|
var props_validator_service_1 = require("./services/props-validator.service");
|
|
60
61
|
Object.defineProperty(exports, "PropsValidator", { enumerable: true, get: function () { return props_validator_service_1.PropsValidator; } });
|
|
62
|
+
var layout_loader_service_1 = require("./services/layout-loader.service");
|
|
63
|
+
Object.defineProperty(exports, "LayoutLoader", { enumerable: true, get: function () { return layout_loader_service_1.LayoutLoader; } });
|
|
61
64
|
var layout_renderer_service_1 = require("./services/layout-renderer.service");
|
|
62
65
|
Object.defineProperty(exports, "LayoutRenderer", { enumerable: true, get: function () { return layout_renderer_service_1.LayoutRenderer; } });
|
|
63
66
|
Object.defineProperty(exports, "PropsValidationError", { enumerable: true, get: function () { return layout_renderer_service_1.PropsValidationError; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAMA,yCAKqB;AAJnB,wGAAA,WAAW,OAAA;AACX,6GAAA,gBAAgB,OAAA;AAChB,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AAKnB,0DAAoF;AAA3E,kHAAA,gBAAgB,OAAA;AAAE,yHAAA,uBAAuB,OAAA;AAUlD,0EAG4C;AAF1C,kIAAA,2BAA2B,OAAA;AAC3B,4HAAA,qBAAqB,OAAA;AAIvB,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AAGxB,gFAIgD;AAH9C,0HAAA,iBAAiB,OAAA;AACjB,yHAAA,gBAAgB,OAAA;AAChB,kIAAA,yBAAyB,OAAA;AAQ3B,sEAAmE;AAA1D,kHAAA,cAAc,OAAA;AACvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAMA,yCAKqB;AAJnB,wGAAA,WAAW,OAAA;AACX,6GAAA,gBAAgB,OAAA;AAChB,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AAKnB,0DAAoF;AAA3E,kHAAA,gBAAgB,OAAA;AAAE,yHAAA,uBAAuB,OAAA;AAUlD,0EAG4C;AAF1C,kIAAA,2BAA2B,OAAA;AAC3B,4HAAA,qBAAqB,OAAA;AAIvB,+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8 +110,13 @@ export interface AgentInfo {
|
|
|
110
110
|
inline?: {
|
|
111
111
|
type: 'agent';
|
|
112
112
|
provider: 'claude' | 'gemini' | 'copilot';
|
|
113
|
-
system_prompt
|
|
113
|
+
system_prompt?: string;
|
|
114
|
+
prompt?: string;
|
|
114
115
|
model?: string;
|
|
116
|
+
layout?: string | {
|
|
117
|
+
id: string;
|
|
118
|
+
props?: Record<string, any>;
|
|
119
|
+
};
|
|
115
120
|
};
|
|
116
121
|
remote?: RemoteAgentInfo;
|
|
117
122
|
}
|