@sowonai/crewx-sdk 0.1.0-dev.0 → 0.1.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +444 -0
- package/dist/config/yaml-loader.d.ts +8 -0
- package/dist/config/yaml-loader.js +137 -0
- package/dist/config/yaml-loader.js.map +1 -0
- package/dist/core/agent/agent-factory.d.ts +1 -1
- package/dist/core/agent/agent-factory.js +4 -6
- package/dist/core/agent/agent-factory.js.map +1 -1
- package/dist/core/agent/index.d.ts +1 -1
- package/dist/core/agent/index.js +2 -1
- package/dist/core/agent/index.js.map +1 -1
- package/dist/core/parallel/helpers.d.ts +27 -0
- package/dist/core/parallel/helpers.js +252 -0
- package/dist/core/parallel/helpers.js.map +1 -0
- package/dist/core/parallel/index.d.ts +4 -0
- package/dist/core/parallel/index.js +11 -0
- package/dist/core/parallel/index.js.map +1 -0
- package/dist/core/parallel/parallel-runner.d.ts +16 -0
- package/dist/core/parallel/parallel-runner.js +230 -0
- package/dist/core/parallel/parallel-runner.js.map +1 -0
- package/dist/core/parallel/types.d.ts +41 -0
- package/dist/core/parallel/types.js +3 -0
- package/dist/core/parallel/types.js.map +1 -0
- package/dist/core/providers/base-ai.provider.d.ts +12 -26
- package/dist/core/providers/base-ai.provider.js +37 -30
- package/dist/core/providers/base-ai.provider.js.map +1 -1
- package/dist/core/providers/base-ai.types.d.ts +15 -0
- package/dist/core/providers/base-ai.types.js +3 -0
- package/dist/core/providers/base-ai.types.js.map +1 -0
- package/dist/core/providers/claude.provider.d.ts +4 -3
- package/dist/core/providers/claude.provider.js +16 -33
- package/dist/core/providers/claude.provider.js.map +1 -1
- package/dist/core/providers/codex.provider.d.ts +2 -1
- package/dist/core/providers/codex.provider.js +4 -18
- package/dist/core/providers/codex.provider.js.map +1 -1
- package/dist/core/providers/copilot.provider.d.ts +4 -3
- package/dist/core/providers/copilot.provider.js +10 -28
- package/dist/core/providers/copilot.provider.js.map +1 -1
- package/dist/core/providers/gemini.provider.d.ts +4 -3
- package/dist/core/providers/gemini.provider.js +18 -36
- package/dist/core/providers/gemini.provider.js.map +1 -1
- package/dist/core/providers/index.d.ts +5 -0
- package/dist/core/providers/index.js +14 -0
- package/dist/core/providers/index.js.map +1 -0
- package/dist/core/providers/tool-call.types.d.ts +39 -0
- package/dist/core/providers/tool-call.types.js +3 -0
- package/dist/core/providers/tool-call.types.js.map +1 -0
- package/dist/core/remote/index.d.ts +3 -0
- package/dist/core/remote/index.js +20 -0
- package/dist/core/remote/index.js.map +1 -0
- package/dist/core/remote/remote-agent-manager.d.ts +24 -0
- package/dist/core/remote/remote-agent-manager.js +195 -0
- package/dist/core/remote/remote-agent-manager.js.map +1 -0
- package/dist/core/remote/remote-transport.d.ts +15 -0
- package/dist/core/remote/remote-transport.js +70 -0
- package/dist/core/remote/remote-transport.js.map +1 -0
- package/dist/core/remote/types.d.ts +79 -0
- package/dist/core/remote/types.js +3 -0
- package/dist/core/remote/types.js.map +1 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/types/structured-payload.types.d.ts +46 -0
- package/dist/types/structured-payload.types.js +65 -0
- package/dist/types/structured-payload.types.js.map +1 -0
- package/dist/utils/base-message-formatter.d.ts +32 -0
- package/dist/utils/base-message-formatter.js +170 -0
- package/dist/utils/base-message-formatter.js.map +1 -0
- package/package.json +4 -1
- package/dist/core/providers/dynamic-provider.factory.d.ts +0 -55
- package/dist/core/providers/dynamic-provider.factory.js +0 -587
- package/dist/core/providers/dynamic-provider.factory.js.map +0 -1
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -17
- package/dist/version.js.map +0 -1
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var _a;
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
exports.CopilotProvider = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
4
|
const base_ai_provider_1 = require("./base-ai.provider");
|
|
16
5
|
const ai_provider_interface_1 = require("./ai-provider.interface");
|
|
17
|
-
|
|
18
|
-
constructor(
|
|
19
|
-
super('CopilotProvider');
|
|
6
|
+
class CopilotProvider extends base_ai_provider_1.BaseAIProvider {
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
super('CopilotProvider', options);
|
|
20
9
|
this.name = ai_provider_interface_1.BuiltInProviders.COPILOT;
|
|
21
|
-
if (toolCallService) {
|
|
22
|
-
this.setToolCallService(toolCallService);
|
|
23
|
-
}
|
|
24
10
|
}
|
|
25
11
|
getCliCommand() {
|
|
26
12
|
return 'copilot';
|
|
@@ -38,11 +24,11 @@ let CopilotProvider = class CopilotProvider extends base_ai_provider_1.BaseAIPro
|
|
|
38
24
|
return 'GitHub Copilot CLI is not installed. Please refer to https://docs.github.com/copilot/how-tos/set-up/install-copilot-cli to install it.';
|
|
39
25
|
}
|
|
40
26
|
async execute(prompt, options = {}) {
|
|
41
|
-
if (this.
|
|
27
|
+
if (this.toolCallHandler) {
|
|
42
28
|
this.logger.log('CopilotProvider: Using queryWithTools in execute mode');
|
|
43
29
|
return this.queryWithTools(prompt, options);
|
|
44
30
|
}
|
|
45
|
-
this.logger.warn('CopilotProvider:
|
|
31
|
+
this.logger.warn('CopilotProvider: Tool call handler not available, falling back to base execute');
|
|
46
32
|
return super.execute(prompt, options);
|
|
47
33
|
}
|
|
48
34
|
parseProviderError(stderr, stdout) {
|
|
@@ -210,13 +196,13 @@ Please continue with your response based on this tool result.`;
|
|
|
210
196
|
return { isToolUse: false };
|
|
211
197
|
}
|
|
212
198
|
async queryWithTools(prompt, options = {}, maxTurns = 5) {
|
|
213
|
-
if (!this.
|
|
214
|
-
this.logger.warn('
|
|
199
|
+
if (!this.toolCallHandler) {
|
|
200
|
+
this.logger.warn('Tool call handler not available, falling back to regular query');
|
|
215
201
|
return this.query(prompt, options);
|
|
216
202
|
}
|
|
217
203
|
let turn = 0;
|
|
218
204
|
let currentPrompt = prompt;
|
|
219
|
-
const tools = this.
|
|
205
|
+
const tools = this.toolCallHandler.list();
|
|
220
206
|
currentPrompt = this.buildPromptWithTools(currentPrompt, tools);
|
|
221
207
|
while (turn < maxTurns) {
|
|
222
208
|
this.logger.log(`Tool call turn ${turn + 1}/${maxTurns}`);
|
|
@@ -231,7 +217,7 @@ Please continue with your response based on this tool result.`;
|
|
|
231
217
|
}
|
|
232
218
|
this.logger.log(`Executing tool: ${toolUse.toolName}`);
|
|
233
219
|
try {
|
|
234
|
-
const toolResult = await this.
|
|
220
|
+
const toolResult = await this.toolCallHandler.execute(toolUse.toolName, toolUse.toolInput);
|
|
235
221
|
currentPrompt = this.buildFollowUpPrompt(toolUse.toolName, toolUse.toolInput, toolResult);
|
|
236
222
|
turn++;
|
|
237
223
|
}
|
|
@@ -257,10 +243,6 @@ Please continue with your response based on this tool result.`;
|
|
|
257
243
|
taskId: options.taskId,
|
|
258
244
|
};
|
|
259
245
|
}
|
|
260
|
-
}
|
|
246
|
+
}
|
|
261
247
|
exports.CopilotProvider = CopilotProvider;
|
|
262
|
-
exports.CopilotProvider = CopilotProvider = __decorate([
|
|
263
|
-
(0, common_1.Injectable)(),
|
|
264
|
-
__metadata("design:paramtypes", [typeof (_a = typeof base_ai_provider_1.ToolCallService !== "undefined" && base_ai_provider_1.ToolCallService) === "function" ? _a : Object])
|
|
265
|
-
], CopilotProvider);
|
|
266
248
|
//# sourceMappingURL=copilot.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot.provider.js","sourceRoot":"","sources":["../../../src/core/providers/copilot.provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copilot.provider.js","sourceRoot":"","sources":["../../../src/core/providers/copilot.provider.ts"],"names":[],"mappings":";;;AACA,yDAAoD;AAEpD,mEAAiG;AAGjG,MAAa,eAAgB,SAAQ,iCAAc;IAGjD,YAAY,UAAiC,EAAE;QAC7C,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAH3B,SAAI,GAAG,wCAAgB,CAAC,OAAO,CAAC;IAIzC,CAAC;IAES,aAAa;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IAES,cAAc;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,cAAc;QAGtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,eAAe;QAEvB,OAAO,KAAK,CAAC;IACf,CAAC;IAES,sBAAsB;QAC9B,OAAO,wIAAwI,CAAC;IAClJ,CAAC;IAKD,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,UAA0B,EAAE;QACxD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;YACzE,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;QACnG,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAKM,kBAAkB,CACvB,MAAc,EACd,MAAc;QAGd,M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ACT,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBAG7D,OAAO;oBACL,OAAO,EAAE,EAAE;oBACX,QAAQ,EAAE,IAAI,CAAC,IAAI;oBACnB,OAAO,EAAE,QAAQ,CAAC,OAAO;oBACzB,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,0BAA0B,KAAK,CAAC,OAAO,EAAE;oBAChD,MAAM,EAAE,QAAQ,CAAC,MAAM;iBACxB,CAAC;YACJ,CAAC;QACH,CAAC;QAGD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,QAAQ,YAAY,CAAC,CAAC;QAChE,OAAO;YACL,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,OAAO,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,uBAAuB;YACvD,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,iCAAiC,QAAQ,YAAY;YAC5D,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;IACJ,CAAC;CACF;AAxVD,0CAwVC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BaseAIProvider
|
|
2
|
-
import {
|
|
1
|
+
import { BaseAIProvider } from './base-ai.provider';
|
|
2
|
+
import type { BaseAIProviderOptions } from './base-ai.types';
|
|
3
|
+
import { type AIQueryOptions, type AIResponse } from './ai-provider.interface';
|
|
3
4
|
export declare class GeminiProvider extends BaseAIProvider {
|
|
4
5
|
readonly name: "cli/gemini";
|
|
5
|
-
constructor(
|
|
6
|
+
constructor(options?: BaseAIProviderOptions);
|
|
6
7
|
protected getCliCommand(): string;
|
|
7
8
|
protected getDefaultArgs(): string[];
|
|
8
9
|
protected getExecuteArgs(): string[];
|
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var _a;
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
exports.GeminiProvider = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
4
|
const base_ai_provider_1 = require("./base-ai.provider");
|
|
16
5
|
const ai_provider_interface_1 = require("./ai-provider.interface");
|
|
17
|
-
|
|
18
|
-
constructor(
|
|
19
|
-
super('GeminiProvider');
|
|
6
|
+
class GeminiProvider extends base_ai_provider_1.BaseAIProvider {
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
super('GeminiProvider', options);
|
|
20
9
|
this.name = ai_provider_interface_1.BuiltInProviders.GEMINI;
|
|
21
|
-
if (toolCallService) {
|
|
22
|
-
this.setToolCallService(toolCallService);
|
|
23
|
-
}
|
|
24
10
|
}
|
|
25
11
|
getCliCommand() {
|
|
26
12
|
return 'gemini';
|
|
@@ -44,18 +30,18 @@ let GeminiProvider = class GeminiProvider extends base_ai_provider_1.BaseAIProvi
|
|
|
44
30
|
return prompt;
|
|
45
31
|
}
|
|
46
32
|
async query(prompt, options = {}) {
|
|
47
|
-
if (!this.
|
|
48
|
-
this.logger.warn('
|
|
33
|
+
if (!this.toolCallHandler) {
|
|
34
|
+
this.logger.warn('Tool call handler not available, falling back to regular query');
|
|
49
35
|
return super.query(prompt, options);
|
|
50
36
|
}
|
|
51
37
|
return this.queryWithTools(prompt, options);
|
|
52
38
|
}
|
|
53
39
|
async execute(prompt, options = {}) {
|
|
54
|
-
if (this.
|
|
40
|
+
if (this.toolCallHandler) {
|
|
55
41
|
this.logger.log('GeminiProvider: Using queryWithTools in execute mode');
|
|
56
42
|
return this.queryWithTools(prompt, options);
|
|
57
43
|
}
|
|
58
|
-
this.logger.warn('GeminiProvider:
|
|
44
|
+
this.logger.warn('GeminiProvider: Tool call handler not available, falling back to base execute');
|
|
59
45
|
return super.execute(prompt, options);
|
|
60
46
|
}
|
|
61
47
|
parseToolUseProviderSpecific(parsed) {
|
|
@@ -81,18 +67,18 @@ let GeminiProvider = class GeminiProvider extends base_ai_provider_1.BaseAIProvi
|
|
|
81
67
|
return { isToolUse: false };
|
|
82
68
|
}
|
|
83
69
|
async queryWithTools(prompt, options = {}, maxTurns = 5) {
|
|
84
|
-
if (!this.
|
|
85
|
-
this.logger.warn('
|
|
70
|
+
if (!this.toolCallHandler) {
|
|
71
|
+
this.logger.warn('Tool call handler not available, falling back to regular query');
|
|
86
72
|
return super.query(prompt, options);
|
|
87
73
|
}
|
|
88
74
|
let turn = 0;
|
|
89
75
|
let currentPrompt = prompt;
|
|
90
|
-
const tools = this.
|
|
76
|
+
const tools = this.toolCallHandler.list();
|
|
91
77
|
currentPrompt = this.buildPromptWithTools(currentPrompt, tools);
|
|
92
78
|
while (turn < maxTurns) {
|
|
93
79
|
this.logger.log(`Tool call turn ${turn + 1}/${maxTurns}`);
|
|
94
80
|
if (options.taskId) {
|
|
95
|
-
this
|
|
81
|
+
this.appendTaskLog(options.taskId, 'INFO', `--- Tool Call Turn ${turn + 1}/${maxTurns} ---`);
|
|
96
82
|
}
|
|
97
83
|
const response = await super.query(currentPrompt, options);
|
|
98
84
|
if (!response.success) {
|
|
@@ -101,20 +87,20 @@ let GeminiProvider = class GeminiProvider extends base_ai_provider_1.BaseAIProvi
|
|
|
101
87
|
const toolUse = this.parseToolUse(response.content);
|
|
102
88
|
if (!toolUse.isToolUse) {
|
|
103
89
|
if (options.taskId) {
|
|
104
|
-
this
|
|
90
|
+
this.appendTaskLog(options.taskId, 'INFO', `No tool use detected, returning final response`);
|
|
105
91
|
}
|
|
106
92
|
return response;
|
|
107
93
|
}
|
|
108
94
|
this.logger.log(`Executing tool: ${toolUse.toolName} with input ${JSON.stringify(toolUse.toolInput)}`);
|
|
109
95
|
if (options.taskId) {
|
|
110
|
-
this
|
|
111
|
-
this
|
|
96
|
+
this.appendTaskLog(options.taskId, 'INFO', `🔧 Gemini requested tool: ${toolUse.toolName}`);
|
|
97
|
+
this.appendTaskLog(options.taskId, 'INFO', `Tool input: ${JSON.stringify(toolUse.toolInput, null, 2)}`);
|
|
112
98
|
}
|
|
113
|
-
const toolResult = await this.
|
|
99
|
+
const toolResult = await this.toolCallHandler.execute(toolUse.toolName, toolUse.toolInput);
|
|
114
100
|
this.logger.log(`Tool result: ${JSON.stringify(toolResult)}`);
|
|
115
101
|
if (options.taskId) {
|
|
116
|
-
this
|
|
117
|
-
this
|
|
102
|
+
this.appendTaskLog(options.taskId, 'INFO', `✅ Tool executed successfully`);
|
|
103
|
+
this.appendTaskLog(options.taskId, 'INFO', `Tool result preview: ${JSON.stringify(toolResult).substring(0, 500)}...`);
|
|
118
104
|
}
|
|
119
105
|
currentPrompt = this.buildToolResultPrompt(toolUse.toolName, toolUse.toolInput, toolResult);
|
|
120
106
|
turn++;
|
|
@@ -138,10 +124,6 @@ ${JSON.stringify(resultData, null, 2)}
|
|
|
138
124
|
|
|
139
125
|
Based on the tool execution result above, please provide a clear, detailed, and user-friendly response to the user's original request. Present the information in an organized and easy-to-read format.`;
|
|
140
126
|
}
|
|
141
|
-
}
|
|
127
|
+
}
|
|
142
128
|
exports.GeminiProvider = GeminiProvider;
|
|
143
|
-
exports.GeminiProvider = GeminiProvider = __decorate([
|
|
144
|
-
(0, common_1.Injectable)(),
|
|
145
|
-
__metadata("design:paramtypes", [typeof (_a = typeof base_ai_provider_1.ToolCallService !== "undefined" && base_ai_provider_1.ToolCallService) === "function" ? _a : Object])
|
|
146
|
-
], GeminiProvider);
|
|
147
129
|
//# sourceMappingURL=gemini.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.provider.js","sourceRoot":"","sources":["../../../src/core/providers/gemini.provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gemini.provider.js","sourceRoot":"","sources":["../../../src/core/providers/gemini.provider.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AAEpD,mEAAiG;AAGjG,MAAa,cAAe,SAAQ,iCAAc;IAGhD,YAAY,UAAiC,EAAE;QAC7C,KAAK,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAH1B,SAAI,GAAG,wCAAgB,CAAC,MAAM,CAAC;IAIxC,CAAC;IAES,aAAa;QACrB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAES,cAAc;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,cAAc;QAGtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,eAAe;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAES,sBAAsB;QAC9B,OAAO,8BAA8B,CAAC;IACxC,CAAC;IAEO,oBAAoB,CAAC,MAAc,EAAE,KAAa;QACxD,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjC,OAAO,MAAM,CAAC;QAChB,CAAC;QAGD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,KAAK,CACT,MAAc,EACd,UAA0B,EAAE;QAE5B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,gEAAgE,CACjE,CAAC;YACF,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACtC,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AC,qBAAqB,CACxC,OAAO,CAAC,QAAS,EACjB,OAAO,CAAC,SAAS,EACjB,UAAU,CACX,CAAC;YAEF,IAAI,EAAE,CAAC;QACT,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QAC7D,OAAO;YACL,OAAO,EAAE,iEAAiE;YAC1E,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;IACJ,CAAC;IAEO,qBAAqB,CAAC,QAAgB,EAAE,SAAc,EAAE,UAAe;QAC7E,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;QAExF,OAAO,OAAO,QAAQ;;;EAGxB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;;;wMAGmK,CAAC;IACvM,CAAC;CACF;AA3LD,wCA2LC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodexProvider = exports.CopilotProvider = exports.GeminiProvider = exports.ClaudeProvider = exports.BaseAIProvider = void 0;
|
|
4
|
+
var base_ai_provider_1 = require("./base-ai.provider");
|
|
5
|
+
Object.defineProperty(exports, "BaseAIProvider", { enumerable: true, get: function () { return base_ai_provider_1.BaseAIProvider; } });
|
|
6
|
+
var claude_provider_1 = require("./claude.provider");
|
|
7
|
+
Object.defineProperty(exports, "ClaudeProvider", { enumerable: true, get: function () { return claude_provider_1.ClaudeProvider; } });
|
|
8
|
+
var gemini_provider_1 = require("./gemini.provider");
|
|
9
|
+
Object.defineProperty(exports, "GeminiProvider", { enumerable: true, get: function () { return gemini_provider_1.GeminiProvider; } });
|
|
10
|
+
var copilot_provider_1 = require("./copilot.provider");
|
|
11
|
+
Object.defineProperty(exports, "CopilotProvider", { enumerable: true, get: function () { return copilot_provider_1.CopilotProvider; } });
|
|
12
|
+
var codex_provider_1 = require("./codex.provider");
|
|
13
|
+
Object.defineProperty(exports, "CodexProvider", { enumerable: true, get: function () { return codex_provider_1.CodexProvider; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface Tool {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
input_schema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, any>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
output_schema?: {
|
|
10
|
+
type: 'object';
|
|
11
|
+
properties: Record<string, any>;
|
|
12
|
+
required?: string[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface ToolExecutionContext {
|
|
16
|
+
input: Record<string, any>;
|
|
17
|
+
runId?: string;
|
|
18
|
+
threadId?: string;
|
|
19
|
+
resourceId?: string;
|
|
20
|
+
agentId?: string;
|
|
21
|
+
tracingContext?: {
|
|
22
|
+
taskId?: string;
|
|
23
|
+
parentSpan?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface ToolExecutionResult<T = any> {
|
|
27
|
+
success: boolean;
|
|
28
|
+
data?: T;
|
|
29
|
+
error?: string;
|
|
30
|
+
metadata?: {
|
|
31
|
+
executionTime?: number;
|
|
32
|
+
toolName?: string;
|
|
33
|
+
runId?: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface ToolCallHandler {
|
|
37
|
+
list(): Tool[];
|
|
38
|
+
execute(name: string, input: Record<string, any>, context?: Partial<Omit<ToolExecutionContext, 'input'>>): Promise<ToolExecutionResult>;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-call.types.js","sourceRoot":"","sources":["../../../src/core/providers/tool-call.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./remote-transport"), exports);
|
|
19
|
+
__exportStar(require("./remote-agent-manager"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/remote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAMA,0CAAwB;AACxB,qDAAmC;AACnC,yDAAuC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RemoteAgentConfig, RemoteTransport, RemoteAgentQueryRequest, RemoteAgentExecuteRequest, RemoteAgentResponse, ToolNameMapping } from './types';
|
|
2
|
+
export interface RemoteAgentManagerOptions {
|
|
3
|
+
transport?: RemoteTransport;
|
|
4
|
+
logger?: (message: string, level?: 'debug' | 'info' | 'warn' | 'error') => void;
|
|
5
|
+
}
|
|
6
|
+
export declare class RemoteAgentManager {
|
|
7
|
+
private transport;
|
|
8
|
+
private logger;
|
|
9
|
+
private configs;
|
|
10
|
+
constructor(options?: RemoteAgentManagerOptions);
|
|
11
|
+
loadConfig(agentId: string, config: RemoteAgentConfig): void;
|
|
12
|
+
loadConfigs(configs: Map<string, RemoteAgentConfig> | Record<string, RemoteAgentConfig>): void;
|
|
13
|
+
getConfig(agentId: string): RemoteAgentConfig | undefined;
|
|
14
|
+
isRemoteAgent(agentId: string): boolean;
|
|
15
|
+
getRemoteAgentIds(): string[];
|
|
16
|
+
query(agentId: string, request: RemoteAgentQueryRequest): Promise<RemoteAgentResponse>;
|
|
17
|
+
execute(agentId: string, request: RemoteAgentExecuteRequest): Promise<RemoteAgentResponse>;
|
|
18
|
+
private callRemoteTool;
|
|
19
|
+
normalizeResponse(result: any): RemoteAgentResponse;
|
|
20
|
+
normalizeUrl(url: string): string;
|
|
21
|
+
mapToolNames(agentId: string, mapping: Partial<ToolNameMapping>): void;
|
|
22
|
+
private validateConfig;
|
|
23
|
+
clearConfigs(): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoteAgentManager = void 0;
|
|
4
|
+
const remote_transport_1 = require("./remote-transport");
|
|
5
|
+
class RemoteAgentManager {
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.configs = new Map();
|
|
8
|
+
this.transport = options.transport || new remote_transport_1.FetchRemoteTransport();
|
|
9
|
+
this.logger = options.logger || (() => { });
|
|
10
|
+
}
|
|
11
|
+
loadConfig(agentId, config) {
|
|
12
|
+
this.validateConfig(config);
|
|
13
|
+
this.configs.set(agentId, config);
|
|
14
|
+
this.logger(`Loaded remote agent config for: ${agentId}`, 'debug');
|
|
15
|
+
}
|
|
16
|
+
loadConfigs(configs) {
|
|
17
|
+
const configMap = configs instanceof Map ? configs : new Map(Object.entries(configs));
|
|
18
|
+
for (const [agentId, config] of configMap) {
|
|
19
|
+
this.loadConfig(agentId, config);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
getConfig(agentId) {
|
|
23
|
+
return this.configs.get(agentId);
|
|
24
|
+
}
|
|
25
|
+
isRemoteAgent(agentId) {
|
|
26
|
+
return this.configs.has(agentId);
|
|
27
|
+
}
|
|
28
|
+
getRemoteAgentIds() {
|
|
29
|
+
return Array.from(this.configs.keys());
|
|
30
|
+
}
|
|
31
|
+
async query(agentId, request) {
|
|
32
|
+
const config = this.getConfig(agentId);
|
|
33
|
+
if (!config) {
|
|
34
|
+
throw new Error(`Agent ${agentId} is not configured as a remote agent`);
|
|
35
|
+
}
|
|
36
|
+
const toolName = config.tools?.query ?? 'crewx_queryAgent';
|
|
37
|
+
const remoteAgentId = config.agentId ?? agentId;
|
|
38
|
+
const payload = {
|
|
39
|
+
agentId: remoteAgentId,
|
|
40
|
+
query: request.query,
|
|
41
|
+
};
|
|
42
|
+
if (request.context) {
|
|
43
|
+
payload.context = request.context;
|
|
44
|
+
}
|
|
45
|
+
if (request.model) {
|
|
46
|
+
payload.model = request.model;
|
|
47
|
+
}
|
|
48
|
+
if (request.platform) {
|
|
49
|
+
payload.platform = request.platform;
|
|
50
|
+
}
|
|
51
|
+
if (request.messages && request.messages.length > 0) {
|
|
52
|
+
payload.messages = request.messages;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const result = await this.callRemoteTool(config, toolName, payload);
|
|
56
|
+
return this.normalizeResponse(result);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
this.logger(`Remote query failed for agent ${agentId}: ${error.message}`, 'error');
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async execute(agentId, request) {
|
|
64
|
+
const config = this.getConfig(agentId);
|
|
65
|
+
if (!config) {
|
|
66
|
+
throw new Error(`Agent ${agentId} is not configured as a remote agent`);
|
|
67
|
+
}
|
|
68
|
+
const toolName = config.tools?.execute ?? 'crewx_executeAgent';
|
|
69
|
+
const remoteAgentId = config.agentId ?? agentId;
|
|
70
|
+
const payload = {
|
|
71
|
+
agentId: remoteAgentId,
|
|
72
|
+
task: request.task,
|
|
73
|
+
};
|
|
74
|
+
if (request.context) {
|
|
75
|
+
payload.context = request.context;
|
|
76
|
+
}
|
|
77
|
+
if (request.model) {
|
|
78
|
+
payload.model = request.model;
|
|
79
|
+
}
|
|
80
|
+
if (request.platform) {
|
|
81
|
+
payload.platform = request.platform;
|
|
82
|
+
}
|
|
83
|
+
if (request.messages && request.messages.length > 0) {
|
|
84
|
+
payload.messages = request.messages;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const result = await this.callRemoteTool(config, toolName, payload);
|
|
88
|
+
return this.normalizeResponse(result);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
this.logger(`Remote execute failed for agent ${agentId}: ${error.message}`, 'error');
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async callRemoteTool(config, toolName, args) {
|
|
96
|
+
const baseUrl = this.normalizeUrl(config.url);
|
|
97
|
+
const url = `${baseUrl}/mcp`;
|
|
98
|
+
const request = {
|
|
99
|
+
jsonrpc: '2.0',
|
|
100
|
+
id: `${toolName}-${Date.now()}`,
|
|
101
|
+
method: 'tools/call',
|
|
102
|
+
params: {
|
|
103
|
+
name: toolName,
|
|
104
|
+
arguments: args,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
const headers = {
|
|
108
|
+
...(config.headers || {}),
|
|
109
|
+
};
|
|
110
|
+
if (config.apiKey) {
|
|
111
|
+
headers['Authorization'] = `Bearer ${config.apiKey}`;
|
|
112
|
+
}
|
|
113
|
+
this.logger(`Calling remote MCP tool ${toolName} on ${baseUrl}`, 'debug');
|
|
114
|
+
const response = await this.transport.request(url, {
|
|
115
|
+
method: 'POST',
|
|
116
|
+
headers,
|
|
117
|
+
body: request,
|
|
118
|
+
timeoutMs: config.timeoutMs,
|
|
119
|
+
});
|
|
120
|
+
if (response.error) {
|
|
121
|
+
throw new Error(response.error.message || 'MCP server returned an error');
|
|
122
|
+
}
|
|
123
|
+
return response.result;
|
|
124
|
+
}
|
|
125
|
+
normalizeResponse(result) {
|
|
126
|
+
if (!result) {
|
|
127
|
+
return {
|
|
128
|
+
success: false,
|
|
129
|
+
content: [
|
|
130
|
+
{
|
|
131
|
+
type: 'text',
|
|
132
|
+
text: 'Remote agent returned no response.',
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (Array.isArray(result.content) && result.content.length > 0) {
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
const fallbackContent = result.response ?? result.implementation ?? result.message ?? result.output;
|
|
141
|
+
const text = typeof fallbackContent === 'string'
|
|
142
|
+
? fallbackContent
|
|
143
|
+
: JSON.stringify(fallbackContent ?? result, null, 2);
|
|
144
|
+
return {
|
|
145
|
+
...result,
|
|
146
|
+
content: [
|
|
147
|
+
{
|
|
148
|
+
type: 'text',
|
|
149
|
+
text,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
normalizeUrl(url) {
|
|
155
|
+
if (!url) {
|
|
156
|
+
return url;
|
|
157
|
+
}
|
|
158
|
+
const trimmed = url.trim();
|
|
159
|
+
if (!trimmed) {
|
|
160
|
+
return trimmed;
|
|
161
|
+
}
|
|
162
|
+
const withoutTrailingSlash = trimmed.replace(/\/+$/, '');
|
|
163
|
+
return withoutTrailingSlash.toLowerCase().endsWith('/mcp')
|
|
164
|
+
? withoutTrailingSlash.slice(0, -4)
|
|
165
|
+
: withoutTrailingSlash;
|
|
166
|
+
}
|
|
167
|
+
mapToolNames(agentId, mapping) {
|
|
168
|
+
const config = this.getConfig(agentId);
|
|
169
|
+
if (!config) {
|
|
170
|
+
throw new Error(`Agent ${agentId} is not configured as a remote agent`);
|
|
171
|
+
}
|
|
172
|
+
config.tools = {
|
|
173
|
+
query: mapping.query ?? config.tools?.query ?? 'crewx_queryAgent',
|
|
174
|
+
execute: mapping.execute ?? config.tools?.execute ?? 'crewx_executeAgent',
|
|
175
|
+
};
|
|
176
|
+
this.logger(`Updated tool name mapping for agent ${agentId}`, 'debug');
|
|
177
|
+
}
|
|
178
|
+
validateConfig(config) {
|
|
179
|
+
if (!config.url) {
|
|
180
|
+
throw new Error('Remote agent configuration requires a URL');
|
|
181
|
+
}
|
|
182
|
+
if (!config.url.startsWith('http://') && !config.url.startsWith('https://')) {
|
|
183
|
+
throw new Error('Remote agent URL must start with http:// or https://');
|
|
184
|
+
}
|
|
185
|
+
if (config.type !== 'mcp-http') {
|
|
186
|
+
throw new Error(`Unsupported remote agent type: ${config.type}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
clearConfigs() {
|
|
190
|
+
this.configs.clear();
|
|
191
|
+
this.logger('Cleared all remote agent configurations', 'debug');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
exports.RemoteAgentManager = RemoteAgentManager;
|
|
195
|
+
//# sourceMappingURL=remote-agent-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-agent-manager.js","sourceRoot":"","sources":["../../../src/core/remote/remote-agent-manager.ts"],"names":[],"mappings":";;;AAwBA,yDAA0D;AAkB1D,MAAa,kBAAkB;IAK7B,YAAY,UAAqC,EAAE;QAF3C,YAAO,GAAG,IAAI,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AG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,sCAAsC,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,CAAC,KAAK,GAAG;YACb,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,KAAK,IAAI,kBAAkB;YACjE,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,oBAAoB;SAC1E,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,uCAAuC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAMO,cAAc,CAAC,MAAyB;QAC9C,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5E,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAMD,YAAY;QACV,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,yCAAyC,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;CACF;AApTD,gDAoTC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RemoteTransport, RemoteTransportRequestOptions } from './types';
|
|
2
|
+
export declare class FetchRemoteTransport implements RemoteTransport {
|
|
3
|
+
request<T = any>(url: string, options: RemoteTransportRequestOptions): Promise<T>;
|
|
4
|
+
}
|
|
5
|
+
export declare class MockRemoteTransport implements RemoteTransport {
|
|
6
|
+
private mockResponses;
|
|
7
|
+
private requestLog;
|
|
8
|
+
setMockResponse(pattern: string | RegExp, response: any): void;
|
|
9
|
+
getRequestLog(): Array<{
|
|
10
|
+
url: string;
|
|
11
|
+
options: RemoteTransportRequestOptions;
|
|
12
|
+
}>;
|
|
13
|
+
clearRequestLog(): void;
|
|
14
|
+
request<T = any>(url: string, options: RemoteTransportRequestOptions): Promise<T>;
|
|
15
|
+
}
|