@sowonai/crewx-sdk 0.1.0-dev.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/LICENSE +201 -0
- package/README.md +558 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +18 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/timeout.config.d.ts +14 -0
- package/dist/config/timeout.config.js +34 -0
- package/dist/config/timeout.config.js.map +1 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +8 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +18 -0
- package/dist/constants.js.map +1 -0
- package/dist/conversation/conversation-config.d.ts +9 -0
- package/dist/conversation/conversation-config.js +22 -0
- package/dist/conversation/conversation-config.js.map +1 -0
- package/dist/conversation/conversation-history.interface.d.ts +25 -0
- package/dist/conversation/conversation-history.interface.js +3 -0
- package/dist/conversation/conversation-history.interface.js.map +1 -0
- package/dist/conversation/conversation-storage.service.d.ts +16 -0
- package/dist/conversation/conversation-storage.service.js +213 -0
- package/dist/conversation/conversation-storage.service.js.map +1 -0
- package/dist/conversation/index.d.ts +3 -0
- package/dist/conversation/index.js +20 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/core/agent/agent-factory.d.ts +30 -0
- package/dist/core/agent/agent-factory.js +31 -0
- package/dist/core/agent/agent-factory.js.map +1 -0
- package/dist/core/agent/agent-runtime.d.ts +36 -0
- package/dist/core/agent/agent-runtime.js +96 -0
- package/dist/core/agent/agent-runtime.js.map +1 -0
- package/dist/core/agent/event-bus.d.ts +44 -0
- package/dist/core/agent/event-bus.js +43 -0
- package/dist/core/agent/event-bus.js.map +1 -0
- package/dist/core/agent/index.d.ts +3 -0
- package/dist/core/agent/index.js +11 -0
- package/dist/core/agent/index.js.map +1 -0
- package/dist/core/providers/ai-provider.interface.d.ts +50 -0
- package/dist/core/providers/ai-provider.interface.js +23 -0
- package/dist/core/providers/ai-provider.interface.js.map +1 -0
- package/dist/core/providers/base-ai.provider.d.ts +67 -0
- package/dist/core/providers/base-ai.provider.js +624 -0
- package/dist/core/providers/base-ai.provider.js.map +1 -0
- package/dist/core/providers/claude.provider.d.ts +24 -0
- package/dist/core/providers/claude.provider.js +361 -0
- package/dist/core/providers/claude.provider.js.map +1 -0
- package/dist/core/providers/codex.provider.d.ts +17 -0
- package/dist/core/providers/codex.provider.js +99 -0
- package/dist/core/providers/codex.provider.js.map +1 -0
- package/dist/core/providers/copilot.provider.d.ts +24 -0
- package/dist/core/providers/copilot.provider.js +266 -0
- package/dist/core/providers/copilot.provider.js.map +1 -0
- package/dist/core/providers/dynamic-provider.factory.d.ts +55 -0
- package/dist/core/providers/dynamic-provider.factory.js +587 -0
- package/dist/core/providers/dynamic-provider.factory.js.map +1 -0
- package/dist/core/providers/gemini.provider.d.ts +21 -0
- package/dist/core/providers/gemini.provider.js +147 -0
- package/dist/core/providers/gemini.provider.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +6 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/knowledge/DocumentManager.d.ts +4 -0
- package/dist/knowledge/DocumentManager.js +119 -0
- package/dist/knowledge/DocumentManager.js.map +1 -0
- package/dist/knowledge/index.d.ts +1 -0
- package/dist/knowledge/index.js +18 -0
- package/dist/knowledge/index.js.map +1 -0
- package/dist/types/agent.types.d.ts +117 -0
- package/dist/types/agent.types.js +16 -0
- package/dist/types/agent.types.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +18 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/error-utils.d.ts +3 -0
- package/dist/utils/error-utils.js +27 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/math-utils.d.ts +3 -0
- package/dist/utils/math-utils.js +10 -0
- package/dist/utils/math-utils.js.map +1 -0
- package/dist/utils/mention-parser.d.ts +18 -0
- package/dist/utils/mention-parser.js +136 -0
- package/dist/utils/mention-parser.js.map +1 -0
- package/dist/utils/string-utils.d.ts +1 -0
- package/dist/utils/string-utils.js +10 -0
- package/dist/utils/string-utils.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +20 -0
- package/dist/utils.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +17 -0
- package/dist/version.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const ProviderNamespace: {
|
|
2
|
+
readonly CLI: "cli";
|
|
3
|
+
readonly PLUGIN: "plugin";
|
|
4
|
+
readonly API: "api";
|
|
5
|
+
readonly REMOTE: "remote";
|
|
6
|
+
};
|
|
7
|
+
export type ProviderNamespaceType = typeof ProviderNamespace[keyof typeof ProviderNamespace];
|
|
8
|
+
export declare const BuiltInProviders: {
|
|
9
|
+
readonly CLAUDE: "cli/claude";
|
|
10
|
+
readonly GEMINI: "cli/gemini";
|
|
11
|
+
readonly COPILOT: "cli/copilot";
|
|
12
|
+
readonly CODEX: "cli/codex";
|
|
13
|
+
};
|
|
14
|
+
export interface AIQueryOptions {
|
|
15
|
+
timeout?: number;
|
|
16
|
+
workingDirectory?: string;
|
|
17
|
+
additionalArgs?: string[];
|
|
18
|
+
taskId?: string;
|
|
19
|
+
model?: string;
|
|
20
|
+
securityKey?: string;
|
|
21
|
+
agentId?: string;
|
|
22
|
+
messages?: Array<{
|
|
23
|
+
text: string;
|
|
24
|
+
isAssistant: boolean;
|
|
25
|
+
metadata?: Record<string, any>;
|
|
26
|
+
}>;
|
|
27
|
+
pipedContext?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AIResponse {
|
|
30
|
+
content: string;
|
|
31
|
+
provider: string;
|
|
32
|
+
command: string;
|
|
33
|
+
success: boolean;
|
|
34
|
+
error?: string;
|
|
35
|
+
taskId?: string;
|
|
36
|
+
toolCall?: {
|
|
37
|
+
toolName: string;
|
|
38
|
+
toolInput: any;
|
|
39
|
+
toolResult: any;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface AIProvider {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
isAvailable(): Promise<boolean>;
|
|
45
|
+
query(prompt: string, options?: AIQueryOptions): Promise<AIResponse>;
|
|
46
|
+
getToolPath(): Promise<string | null>;
|
|
47
|
+
}
|
|
48
|
+
export declare class ProviderNotAvailableError extends Error {
|
|
49
|
+
constructor(providerName: string);
|
|
50
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderNotAvailableError = exports.BuiltInProviders = exports.ProviderNamespace = void 0;
|
|
4
|
+
exports.ProviderNamespace = {
|
|
5
|
+
CLI: 'cli',
|
|
6
|
+
PLUGIN: 'plugin',
|
|
7
|
+
API: 'api',
|
|
8
|
+
REMOTE: 'remote',
|
|
9
|
+
};
|
|
10
|
+
exports.BuiltInProviders = {
|
|
11
|
+
CLAUDE: 'cli/claude',
|
|
12
|
+
GEMINI: 'cli/gemini',
|
|
13
|
+
COPILOT: 'cli/copilot',
|
|
14
|
+
CODEX: 'cli/codex',
|
|
15
|
+
};
|
|
16
|
+
class ProviderNotAvailableError extends Error {
|
|
17
|
+
constructor(providerName) {
|
|
18
|
+
super(`AI Provider '${providerName}' is not available or not installed`);
|
|
19
|
+
this.name = 'ProviderNotAvailableError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ProviderNotAvailableError = ProviderNotAvailableError;
|
|
23
|
+
//# sourceMappingURL=ai-provider.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-provider.interface.js","sourceRoot":"","sources":["../../../src/core/providers/ai-provider.interface.ts"],"names":[],"mappings":";;;AAGa,QAAA,iBAAiB,GAAG;IAC/B,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;CACR,CAAC;AAIE,QAAA,gBAAgB,GAAG;IAC9B,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,WAAW;CACV,CAAC;AAmCX,MAAa,yBAA0B,SAAQ,KAAK;IAClD,YAAY,YAAoB;QAC9B,KAAK,CAAC,gBAAgB,YAAY,qCAAqC,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AALD,8DAKC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import { AIProvider, AIQueryOptions, AIResponse } from './ai-provider.interface';
|
|
3
|
+
export interface Tool {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
input_schema: {
|
|
7
|
+
type: 'object';
|
|
8
|
+
properties: Record<string, any>;
|
|
9
|
+
required?: string[];
|
|
10
|
+
};
|
|
11
|
+
output_schema?: {
|
|
12
|
+
type: 'object';
|
|
13
|
+
properties: Record<string, any>;
|
|
14
|
+
required?: string[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface ToolCallService {
|
|
18
|
+
list(): Tool[];
|
|
19
|
+
execute(toolName: string, toolInput: any): Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
export declare abstract class BaseAIProvider implements AIProvider {
|
|
22
|
+
abstract readonly name: string;
|
|
23
|
+
protected readonly logger: Logger;
|
|
24
|
+
protected toolCallService?: ToolCallService;
|
|
25
|
+
private readonly logsDir;
|
|
26
|
+
private cachedPath;
|
|
27
|
+
protected readonly timeoutConfig: import("../../config/timeout.config").TimeoutConfig;
|
|
28
|
+
constructor(loggerContext: string);
|
|
29
|
+
protected abstract getCliCommand(): string;
|
|
30
|
+
protected abstract getDefaultArgs(): string[];
|
|
31
|
+
protected abstract getExecuteArgs(): string[];
|
|
32
|
+
protected abstract getNotInstalledMessage(): string;
|
|
33
|
+
protected getPromptInArgs(): boolean;
|
|
34
|
+
protected getDefaultQueryTimeout(): number;
|
|
35
|
+
protected getDefaultExecuteTimeout(): number;
|
|
36
|
+
protected getDefaultModel(): string | null;
|
|
37
|
+
protected getEnv(): Record<string, string>;
|
|
38
|
+
protected substituteModelPlaceholders(args: string[], model: string): string[];
|
|
39
|
+
protected setToolCallService(toolCallService: ToolCallService): void;
|
|
40
|
+
protected parseToolUse(content: string): {
|
|
41
|
+
isToolUse: boolean;
|
|
42
|
+
toolName?: string;
|
|
43
|
+
toolInput?: any;
|
|
44
|
+
};
|
|
45
|
+
protected parseToolUseProviderSpecific(parsed: any): {
|
|
46
|
+
isToolUse: boolean;
|
|
47
|
+
toolName?: string;
|
|
48
|
+
toolInput?: any;
|
|
49
|
+
};
|
|
50
|
+
protected filterToolUseFromResponse(content: string): string;
|
|
51
|
+
parseProviderError(stderr: string, stdout: string): {
|
|
52
|
+
error: boolean;
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
getToolPath(): Promise<string | null>;
|
|
56
|
+
protected wrapUserQueryWithSecurity(userQuery: string, securityKey: string): string;
|
|
57
|
+
protected extractUserQuery(wrappedQuery: string, securityKey: string): string;
|
|
58
|
+
isAvailable(): Promise<boolean>;
|
|
59
|
+
private createTaskLogFile;
|
|
60
|
+
private appendTaskLog;
|
|
61
|
+
query(prompt: string, options?: AIQueryOptions): Promise<AIResponse>;
|
|
62
|
+
execute(prompt: string, options?: AIQueryOptions): Promise<AIResponse>;
|
|
63
|
+
protected shouldPipeContext(_options?: AIQueryOptions): boolean;
|
|
64
|
+
private buildPipedContext;
|
|
65
|
+
protected isStructuredPayload(value: string): boolean;
|
|
66
|
+
protected createStructuredPayload(prompt: string, context: string | null, options?: AIQueryOptions): string;
|
|
67
|
+
}
|