chat-flow-ardymalihi 1.0.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/LICENSE +21 -0
- package/README.md +266 -0
- package/dist/adapters/db/InMemorySessionRepository.js +15 -0
- package/dist/adapters/db/RedisSessionRepository.js +41 -0
- package/dist/adapters/intent/IntentMatcher.d.ts +25 -0
- package/dist/adapters/intent/IntentMatcher.d.ts.map +1 -0
- package/dist/adapters/intent/IntentMatcher.js +89 -0
- package/dist/adapters/intent/IntentMatcher.js.map +1 -0
- package/dist/adapters/intent/IntentService.d.ts +27 -0
- package/dist/adapters/intent/IntentService.d.ts.map +1 -0
- package/dist/adapters/intent/IntentService.js +59 -0
- package/dist/adapters/intent/IntentService.js.map +1 -0
- package/dist/adapters/intent/MockIntentAdapter.js +29 -0
- package/dist/adapters/llm/GeminiLLMAdapter.d.ts +10 -0
- package/dist/adapters/llm/GeminiLLMAdapter.d.ts.map +1 -0
- package/dist/adapters/llm/GeminiLLMAdapter.js +102 -0
- package/dist/adapters/llm/GeminiLLMAdapter.js.map +1 -0
- package/dist/adapters/llm/MockLLMAdapter.d.ts +5 -0
- package/dist/adapters/llm/MockLLMAdapter.d.ts.map +1 -0
- package/dist/adapters/llm/MockLLMAdapter.js +31 -0
- package/dist/adapters/llm/MockLLMAdapter.js.map +1 -0
- package/dist/adapters/memory/InMemorySessionRepository.js +15 -0
- package/dist/adapters/redis/RedisSessionRepository.js +41 -0
- package/dist/adapters/repository/InMemoryRepository.d.ts +15 -0
- package/dist/adapters/repository/InMemoryRepository.d.ts.map +1 -0
- package/dist/adapters/repository/InMemoryRepository.js +41 -0
- package/dist/adapters/repository/InMemoryRepository.js.map +1 -0
- package/dist/adapters/repository/IntentRepository.d.ts +15 -0
- package/dist/adapters/repository/IntentRepository.d.ts.map +1 -0
- package/dist/adapters/repository/IntentRepository.js +28 -0
- package/dist/adapters/repository/IntentRepository.js.map +1 -0
- package/dist/adapters/repository/RedisRepository.d.ts +16 -0
- package/dist/adapters/repository/RedisRepository.d.ts.map +1 -0
- package/dist/adapters/repository/RedisRepository.js +87 -0
- package/dist/adapters/repository/RedisRepository.js.map +1 -0
- package/dist/adapters/workflow/MockWorkflowAdapter.d.ts +5 -0
- package/dist/adapters/workflow/MockWorkflowAdapter.d.ts.map +1 -0
- package/dist/adapters/workflow/MockWorkflowAdapter.js +162 -0
- package/dist/adapters/workflow/MockWorkflowAdapter.js.map +1 -0
- package/dist/application/ConversationSession.d.ts +23 -0
- package/dist/application/ConversationSession.d.ts.map +1 -0
- package/dist/application/ConversationSession.js +83 -0
- package/dist/application/ConversationSession.js.map +1 -0
- package/dist/application/Message.d.ts +11 -0
- package/dist/application/Message.d.ts.map +1 -0
- package/dist/application/Message.js +30 -0
- package/dist/application/Message.js.map +1 -0
- package/dist/application/Orchestrator.d.ts +18 -0
- package/dist/application/Orchestrator.d.ts.map +1 -0
- package/dist/application/Orchestrator.js +80 -0
- package/dist/application/Orchestrator.js.map +1 -0
- package/dist/application/SessionState.js +2 -0
- package/dist/application/usecases/CreateSession.js +20 -0
- package/dist/application/usecases/HandleUserMessage.js +69 -0
- package/dist/config/ChatFlowConfig.d.ts +59 -0
- package/dist/config/ChatFlowConfig.d.ts.map +1 -0
- package/dist/config/ChatFlowConfig.js +49 -0
- package/dist/config/ChatFlowConfig.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/entities/ConversationSession.d.ts +23 -0
- package/dist/core/entities/ConversationSession.d.ts.map +1 -0
- package/dist/core/entities/ConversationSession.js +83 -0
- package/dist/core/entities/ConversationSession.js.map +1 -0
- package/dist/core/entities/Message.d.ts +11 -0
- package/dist/core/entities/Message.d.ts.map +1 -0
- package/dist/core/entities/Message.js +30 -0
- package/dist/core/entities/Message.js.map +1 -0
- package/dist/core/errors/ChatFlowError.d.ts +71 -0
- package/dist/core/errors/ChatFlowError.d.ts.map +1 -0
- package/dist/core/errors/ChatFlowError.js +108 -0
- package/dist/core/errors/ChatFlowError.js.map +1 -0
- package/dist/core/errors/index.d.ts +2 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/index.js +15 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/db/InMemoryRepository.d.ts +15 -0
- package/dist/db/InMemoryRepository.d.ts.map +1 -0
- package/dist/db/InMemoryRepository.js +41 -0
- package/dist/db/InMemoryRepository.js.map +1 -0
- package/dist/db/RedisRepository.d.ts +16 -0
- package/dist/db/RedisRepository.d.ts.map +1 -0
- package/dist/db/RedisRepository.js +87 -0
- package/dist/db/RedisRepository.js.map +1 -0
- package/dist/demo/cli-demo.d.ts +2 -0
- package/dist/demo/cli-demo.d.ts.map +1 -0
- package/dist/demo/cli-demo.js +142 -0
- package/dist/demo/cli-demo.js.map +1 -0
- package/dist/demo/console-chat.d.ts +2 -0
- package/dist/demo/console-chat.d.ts.map +1 -0
- package/dist/demo/console-chat.js +144 -0
- package/dist/demo/console-chat.js.map +1 -0
- package/dist/domain/conversation/ConversationSession.js +82 -0
- package/dist/domain/conversation/Message.js +33 -0
- package/dist/domain/conversation/SessionState.js +10 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/intent/IntentService.d.ts +17 -0
- package/dist/intent/IntentService.d.ts.map +1 -0
- package/dist/intent/IntentService.js +51 -0
- package/dist/intent/IntentService.js.map +1 -0
- package/dist/intent/MockIntentService.d.ts +6 -0
- package/dist/intent/MockIntentService.d.ts.map +1 -0
- package/dist/intent/MockIntentService.js +30 -0
- package/dist/intent/MockIntentService.js.map +1 -0
- package/dist/interfaces.d.ts +108 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +18 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/llm/GeminiLLMAdapter.d.ts +10 -0
- package/dist/llm/GeminiLLMAdapter.d.ts.map +1 -0
- package/dist/llm/GeminiLLMAdapter.js +102 -0
- package/dist/llm/GeminiLLMAdapter.js.map +1 -0
- package/dist/llm/MockLLMAdapter.d.ts +5 -0
- package/dist/llm/MockLLMAdapter.d.ts.map +1 -0
- package/dist/llm/MockLLMAdapter.js +31 -0
- package/dist/llm/MockLLMAdapter.js.map +1 -0
- package/dist/orchestrator/Orchestrator.d.ts +18 -0
- package/dist/orchestrator/Orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/Orchestrator.js +80 -0
- package/dist/orchestrator/Orchestrator.js.map +1 -0
- package/dist/ports/IIntentRepository.d.ts +27 -0
- package/dist/ports/IIntentRepository.d.ts.map +1 -0
- package/dist/ports/IIntentRepository.js +3 -0
- package/dist/ports/IIntentRepository.js.map +1 -0
- package/dist/ports/IntentPort.js +2 -0
- package/dist/ports/LLMPort.js +2 -0
- package/dist/ports/SessionRepository.js +2 -0
- package/dist/ports/WorkflowPort.js +2 -0
- package/dist/scripts/debug-redis.d.ts +2 -0
- package/dist/scripts/debug-redis.d.ts.map +1 -0
- package/dist/scripts/debug-redis.js +55 -0
- package/dist/scripts/debug-redis.js.map +1 -0
- package/dist/scripts/verify_memory_intents.d.ts +2 -0
- package/dist/scripts/verify_memory_intents.d.ts.map +1 -0
- package/dist/scripts/verify_memory_intents.js +45 -0
- package/dist/scripts/verify_memory_intents.js.map +1 -0
- package/dist/scripts/verify_redis_intents.d.ts +2 -0
- package/dist/scripts/verify_redis_intents.d.ts.map +1 -0
- package/dist/scripts/verify_redis_intents.js +50 -0
- package/dist/scripts/verify_redis_intents.js.map +1 -0
- package/dist/verify_memory_intents.js +44 -0
- package/dist/verify_redis_intents.js +49 -0
- package/dist/workflow/MockWorkflowAdapter.d.ts +5 -0
- package/dist/workflow/MockWorkflowAdapter.d.ts.map +1 -0
- package/dist/workflow/MockWorkflowAdapter.js +162 -0
- package/dist/workflow/MockWorkflowAdapter.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Role, Message as IMessage, MessageProps } from '../../interfaces';
|
|
2
|
+
export declare class Message implements IMessage {
|
|
3
|
+
readonly role: Role;
|
|
4
|
+
readonly content: string;
|
|
5
|
+
readonly timestamp: Date;
|
|
6
|
+
readonly metadata: Record<string, any>;
|
|
7
|
+
constructor(props: MessageProps);
|
|
8
|
+
static user(content: string, metadata?: Record<string, any>): Message;
|
|
9
|
+
static assistant(content: string, metadata?: Record<string, any>): Message;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/core/entities/Message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAI3E,qBAAa,OAAQ,YAAW,QAAQ;IACpC,SAAgB,IAAI,EAAE,IAAI,CAAC;IAC3B,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBAElC,KAAK,EAAE,YAAY;IAO/B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO;IASrE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO;CAQ7E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Message = void 0;
|
|
4
|
+
const interfaces_1 = require("../../interfaces");
|
|
5
|
+
class Message {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.role = props.role;
|
|
8
|
+
this.content = props.content;
|
|
9
|
+
this.timestamp = props.timestamp;
|
|
10
|
+
this.metadata = props.metadata || {};
|
|
11
|
+
}
|
|
12
|
+
static user(content, metadata) {
|
|
13
|
+
return new Message({
|
|
14
|
+
role: interfaces_1.Role.USER,
|
|
15
|
+
content,
|
|
16
|
+
timestamp: new Date(),
|
|
17
|
+
metadata
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
static assistant(content, metadata) {
|
|
21
|
+
return new Message({
|
|
22
|
+
role: interfaces_1.Role.ASSISTANT,
|
|
23
|
+
content,
|
|
24
|
+
timestamp: new Date(),
|
|
25
|
+
metadata
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Message = Message;
|
|
30
|
+
//# sourceMappingURL=Message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../../src/core/entities/Message.ts"],"names":[],"mappings":";;;AAAA,iDAA2E;AAI3E,MAAa,OAAO;IAMhB,YAAY,KAAmB;QAC3B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,QAA8B;QACvD,OAAO,IAAI,OAAO,CAAC;YACf,IAAI,EAAE,iBAAI,CAAC,IAAI;YACf,OAAO;YACP,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,QAAQ;SACX,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,OAAe,EAAE,QAA8B;QAC5D,OAAO,IAAI,OAAO,CAAC;YACf,IAAI,EAAE,iBAAI,CAAC,SAAS;YACpB,OAAO;YACP,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,QAAQ;SACX,CAAC,CAAC;IACP,CAAC;CACJ;AA9BD,0BA8BC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all Chat-Flow errors
|
|
3
|
+
*/
|
|
4
|
+
export declare class ChatFlowError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly statusCode: number;
|
|
7
|
+
readonly details?: Record<string, any> | undefined;
|
|
8
|
+
constructor(message: string, code: string, statusCode?: number, details?: Record<string, any> | undefined);
|
|
9
|
+
toJSON(): {
|
|
10
|
+
name: string;
|
|
11
|
+
message: string;
|
|
12
|
+
code: string;
|
|
13
|
+
statusCode: number;
|
|
14
|
+
details: Record<string, any> | undefined;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error thrown when a session is not found
|
|
19
|
+
*/
|
|
20
|
+
export declare class SessionNotFoundError extends ChatFlowError {
|
|
21
|
+
constructor(sessionId: string);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when session creation fails
|
|
25
|
+
*/
|
|
26
|
+
export declare class SessionCreationError extends ChatFlowError {
|
|
27
|
+
constructor(reason: string, details?: Record<string, any>);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown when intent detection fails
|
|
31
|
+
*/
|
|
32
|
+
export declare class IntentDetectionError extends ChatFlowError {
|
|
33
|
+
constructor(reason: string, details?: Record<string, any>);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Error thrown when intent is not found
|
|
37
|
+
*/
|
|
38
|
+
export declare class IntentNotFoundError extends ChatFlowError {
|
|
39
|
+
constructor(intentName: string);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Error thrown when workflow execution fails
|
|
43
|
+
*/
|
|
44
|
+
export declare class WorkflowExecutionError extends ChatFlowError {
|
|
45
|
+
constructor(workflowId: string, reason: string, details?: Record<string, any>);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Error thrown when LLM operations fail
|
|
49
|
+
*/
|
|
50
|
+
export declare class LLMError extends ChatFlowError {
|
|
51
|
+
constructor(reason: string, details?: Record<string, any>);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Error thrown when repository operations fail
|
|
55
|
+
*/
|
|
56
|
+
export declare class RepositoryError extends ChatFlowError {
|
|
57
|
+
constructor(operation: string, reason: string, details?: Record<string, any>);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Error thrown when validation fails
|
|
61
|
+
*/
|
|
62
|
+
export declare class ValidationError extends ChatFlowError {
|
|
63
|
+
constructor(field: string, reason: string);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Error thrown when configuration is invalid
|
|
67
|
+
*/
|
|
68
|
+
export declare class ConfigurationError extends ChatFlowError {
|
|
69
|
+
constructor(reason: string, details?: Record<string, any>);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=ChatFlowError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFlowError.d.ts","sourceRoot":"","sources":["../../../src/core/errors/ChatFlowError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;aAGhB,IAAI,EAAE,MAAM;aACZ,UAAU,EAAE,MAAM;aAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;gBAH7C,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,MAAY,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAA;IAOjD,MAAM;;;;;;;CAST;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;gBACvC,SAAS,EAAE,MAAM;CAQhC;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;gBACvC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAQ5D;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;gBACvC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAQ5D;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;gBACtC,UAAU,EAAE,MAAM;CAQjC;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,aAAa;gBACzC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAQhF;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAa;gBAC3B,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAQ5D;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;gBAClC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAQ/E;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;gBAClC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAQ5C;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;gBACrC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAQ5D"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationError = exports.ValidationError = exports.RepositoryError = exports.LLMError = exports.WorkflowExecutionError = exports.IntentNotFoundError = exports.IntentDetectionError = exports.SessionCreationError = exports.SessionNotFoundError = exports.ChatFlowError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base error class for all Chat-Flow errors
|
|
6
|
+
*/
|
|
7
|
+
class ChatFlowError extends Error {
|
|
8
|
+
constructor(message, code, statusCode = 500, details) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.statusCode = statusCode;
|
|
12
|
+
this.details = details;
|
|
13
|
+
this.name = this.constructor.name;
|
|
14
|
+
Error.captureStackTrace(this, this.constructor);
|
|
15
|
+
}
|
|
16
|
+
toJSON() {
|
|
17
|
+
return {
|
|
18
|
+
name: this.name,
|
|
19
|
+
message: this.message,
|
|
20
|
+
code: this.code,
|
|
21
|
+
statusCode: this.statusCode,
|
|
22
|
+
details: this.details
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ChatFlowError = ChatFlowError;
|
|
27
|
+
/**
|
|
28
|
+
* Error thrown when a session is not found
|
|
29
|
+
*/
|
|
30
|
+
class SessionNotFoundError extends ChatFlowError {
|
|
31
|
+
constructor(sessionId) {
|
|
32
|
+
super(`Session ${sessionId} not found`, 'SESSION_NOT_FOUND', 404, { sessionId });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.SessionNotFoundError = SessionNotFoundError;
|
|
36
|
+
/**
|
|
37
|
+
* Error thrown when session creation fails
|
|
38
|
+
*/
|
|
39
|
+
class SessionCreationError extends ChatFlowError {
|
|
40
|
+
constructor(reason, details) {
|
|
41
|
+
super(`Failed to create session: ${reason}`, 'SESSION_CREATION_FAILED', 500, details);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.SessionCreationError = SessionCreationError;
|
|
45
|
+
/**
|
|
46
|
+
* Error thrown when intent detection fails
|
|
47
|
+
*/
|
|
48
|
+
class IntentDetectionError extends ChatFlowError {
|
|
49
|
+
constructor(reason, details) {
|
|
50
|
+
super(`Intent detection failed: ${reason}`, 'INTENT_DETECTION_FAILED', 500, details);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.IntentDetectionError = IntentDetectionError;
|
|
54
|
+
/**
|
|
55
|
+
* Error thrown when intent is not found
|
|
56
|
+
*/
|
|
57
|
+
class IntentNotFoundError extends ChatFlowError {
|
|
58
|
+
constructor(intentName) {
|
|
59
|
+
super(`Intent ${intentName} not found`, 'INTENT_NOT_FOUND', 404, { intentName });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.IntentNotFoundError = IntentNotFoundError;
|
|
63
|
+
/**
|
|
64
|
+
* Error thrown when workflow execution fails
|
|
65
|
+
*/
|
|
66
|
+
class WorkflowExecutionError extends ChatFlowError {
|
|
67
|
+
constructor(workflowId, reason, details) {
|
|
68
|
+
super(`Workflow ${workflowId} execution failed: ${reason}`, 'WORKFLOW_EXECUTION_FAILED', 500, { workflowId, ...details });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.WorkflowExecutionError = WorkflowExecutionError;
|
|
72
|
+
/**
|
|
73
|
+
* Error thrown when LLM operations fail
|
|
74
|
+
*/
|
|
75
|
+
class LLMError extends ChatFlowError {
|
|
76
|
+
constructor(reason, details) {
|
|
77
|
+
super(`LLM operation failed: ${reason}`, 'LLM_OPERATION_FAILED', 500, details);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.LLMError = LLMError;
|
|
81
|
+
/**
|
|
82
|
+
* Error thrown when repository operations fail
|
|
83
|
+
*/
|
|
84
|
+
class RepositoryError extends ChatFlowError {
|
|
85
|
+
constructor(operation, reason, details) {
|
|
86
|
+
super(`Repository ${operation} failed: ${reason}`, 'REPOSITORY_OPERATION_FAILED', 500, { operation, ...details });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.RepositoryError = RepositoryError;
|
|
90
|
+
/**
|
|
91
|
+
* Error thrown when validation fails
|
|
92
|
+
*/
|
|
93
|
+
class ValidationError extends ChatFlowError {
|
|
94
|
+
constructor(field, reason) {
|
|
95
|
+
super(`Validation failed for ${field}: ${reason}`, 'VALIDATION_FAILED', 400, { field });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.ValidationError = ValidationError;
|
|
99
|
+
/**
|
|
100
|
+
* Error thrown when configuration is invalid
|
|
101
|
+
*/
|
|
102
|
+
class ConfigurationError extends ChatFlowError {
|
|
103
|
+
constructor(reason, details) {
|
|
104
|
+
super(`Configuration error: ${reason}`, 'CONFIGURATION_ERROR', 500, details);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.ConfigurationError = ConfigurationError;
|
|
108
|
+
//# sourceMappingURL=ChatFlowError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatFlowError.js","sourceRoot":"","sources":["../../../src/core/errors/ChatFlowError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IACpC,YACI,OAAe,EACC,IAAY,EACZ,aAAqB,GAAG,EACxB,OAA6B;QAE7C,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAc;QACxB,YAAO,GAAP,OAAO,CAAsB;QAG7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;QACF,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;SACxB,CAAC;IACN,CAAC;CACJ;AArBD,sCAqBC;AAED;;GAEG;AACH,MAAa,oBAAqB,SAAQ,aAAa;IACnD,YAAY,SAA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D,cAAc,SAAS,YAAY,MAAM,EAAE,EAC3C,6BAA6B,EAC7B,GAAG,EACH,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAC5B,CAAC;IACN,CAAC;CACJ;AATD,0CASC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,aAAa;IAC9C,YAAY,KAAa,EAAE,MAAc;QACrC,KAAK,CACD,yBAAyB,KAAK,KAAK,MAAM,EAAE,EAC3C,mBAAmB,EACnB,GAAG,EACH,EAAE,KAAK,EAAE,CACZ,CAAC;IACN,CAAC;CACJ;AATD,0CASC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,aAAa;IACjD,YAAY,MAAc,EAAE,OAA6B;QACrD,KAAK,CACD,wBAAwB,MAAM,EAAE,EAChC,qBAAqB,EACrB,GAAG,EACH,OAAO,CACV,CAAC;IACN,CAAC;CACJ;AATD,gDASC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,kBAAkB,EACrB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationError = exports.ValidationError = exports.RepositoryError = exports.LLMError = exports.WorkflowExecutionError = exports.IntentNotFoundError = exports.IntentDetectionError = exports.SessionCreationError = exports.SessionNotFoundError = exports.ChatFlowError = void 0;
|
|
4
|
+
var ChatFlowError_1 = require("./ChatFlowError");
|
|
5
|
+
Object.defineProperty(exports, "ChatFlowError", { enumerable: true, get: function () { return ChatFlowError_1.ChatFlowError; } });
|
|
6
|
+
Object.defineProperty(exports, "SessionNotFoundError", { enumerable: true, get: function () { return ChatFlowError_1.SessionNotFoundError; } });
|
|
7
|
+
Object.defineProperty(exports, "SessionCreationError", { enumerable: true, get: function () { return ChatFlowError_1.SessionCreationError; } });
|
|
8
|
+
Object.defineProperty(exports, "IntentDetectionError", { enumerable: true, get: function () { return ChatFlowError_1.IntentDetectionError; } });
|
|
9
|
+
Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return ChatFlowError_1.IntentNotFoundError; } });
|
|
10
|
+
Object.defineProperty(exports, "WorkflowExecutionError", { enumerable: true, get: function () { return ChatFlowError_1.WorkflowExecutionError; } });
|
|
11
|
+
Object.defineProperty(exports, "LLMError", { enumerable: true, get: function () { return ChatFlowError_1.LLMError; } });
|
|
12
|
+
Object.defineProperty(exports, "RepositoryError", { enumerable: true, get: function () { return ChatFlowError_1.RepositoryError; } });
|
|
13
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return ChatFlowError_1.ValidationError; } });
|
|
14
|
+
Object.defineProperty(exports, "ConfigurationError", { enumerable: true, get: function () { return ChatFlowError_1.ConfigurationError; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":";;;AAAA,iDAWyB;AAVrB,8GAAA,aAAa,OAAA;AACb,qHAAA,oBAAoB,OAAA;AACpB,qHAAA,oBAAoB,OAAA;AACpB,qHAAA,oBAAoB,OAAA;AACpB,oHAAA,mBAAmB,OAAA;AACnB,uHAAA,sBAAsB,OAAA;AACtB,yGAAA,QAAQ,OAAA;AACR,gHAAA,eAAe,OAAA;AACf,gHAAA,eAAe,OAAA;AACf,mHAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IRepository, Intent } from '../interfaces';
|
|
2
|
+
import { ConversationSession } from '../application/ConversationSession';
|
|
3
|
+
export declare class InMemoryRepository implements IRepository {
|
|
4
|
+
private sessions;
|
|
5
|
+
private intents;
|
|
6
|
+
saveSession(session: ConversationSession): Promise<void>;
|
|
7
|
+
findSessionById(sessionId: string): Promise<ConversationSession | null>;
|
|
8
|
+
saveIntent(intent: Intent): Promise<void>;
|
|
9
|
+
upsertIntents(intents: Intent[]): Promise<void>;
|
|
10
|
+
findIntentByName(name: string): Promise<Intent | null>;
|
|
11
|
+
getAllIntents(): Promise<Intent[]>;
|
|
12
|
+
deleteIntent(name: string): Promise<void>;
|
|
13
|
+
searchIntents(embedding: number[], topK?: number): Promise<Intent[]>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=InMemoryRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemoryRepository.d.ts","sourceRoot":"","sources":["../../src/db/InMemoryRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,qBAAa,kBAAmB,YAAW,WAAW;IAClD,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,OAAO,CAAkC;IAE3C,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAKvE,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/C,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAKtD,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIlC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAKjF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemoryRepository = void 0;
|
|
4
|
+
class InMemoryRepository {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.sessions = new Map();
|
|
7
|
+
this.intents = new Map();
|
|
8
|
+
}
|
|
9
|
+
async saveSession(session) {
|
|
10
|
+
this.sessions.set(session.sessionId, session);
|
|
11
|
+
}
|
|
12
|
+
async findSessionById(sessionId) {
|
|
13
|
+
return this.sessions.get(sessionId) || null;
|
|
14
|
+
}
|
|
15
|
+
// Intent Management
|
|
16
|
+
async saveIntent(intent) {
|
|
17
|
+
this.intents.set(intent.name, intent);
|
|
18
|
+
}
|
|
19
|
+
async upsertIntents(intents) {
|
|
20
|
+
for (const intent of intents) {
|
|
21
|
+
this.intents.set(intent.name, intent);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async findIntentByName(name) {
|
|
25
|
+
const intent = this.intents.get(name);
|
|
26
|
+
return intent || null;
|
|
27
|
+
}
|
|
28
|
+
async getAllIntents() {
|
|
29
|
+
return Array.from(this.intents.values());
|
|
30
|
+
}
|
|
31
|
+
async deleteIntent(name) {
|
|
32
|
+
this.intents.delete(name);
|
|
33
|
+
}
|
|
34
|
+
async searchIntents(embedding, topK = 10) {
|
|
35
|
+
// Naive mock implementation: return all intents up to topK
|
|
36
|
+
// Real implementation would use cosine similarity between embedding and intent.embedding
|
|
37
|
+
return Array.from(this.intents.values()).slice(0, topK);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.InMemoryRepository = InMemoryRepository;
|
|
41
|
+
//# sourceMappingURL=InMemoryRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InM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AE,OAAe,EAAE;QACtD,2DAA2D;QAC3D,yFAAyF;QACzF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;CACJ;AAzCD,gDAyCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IRepository as IRepository, Intent } from '../interfaces';
|
|
2
|
+
import { ConversationSession } from '../application/ConversationSession';
|
|
3
|
+
export declare class RedisRepository implements IRepository {
|
|
4
|
+
private client;
|
|
5
|
+
private readonly SESSION_TTL;
|
|
6
|
+
constructor(connectionString?: string);
|
|
7
|
+
saveSession(session: ConversationSession): Promise<void>;
|
|
8
|
+
findSessionById(sessionId: string): Promise<ConversationSession | null>;
|
|
9
|
+
saveIntent(intent: Intent): Promise<void>;
|
|
10
|
+
upsertIntents(intents: Intent[]): Promise<void>;
|
|
11
|
+
findIntentByName(name: string): Promise<Intent | null>;
|
|
12
|
+
deleteIntent(name: string): Promise<void>;
|
|
13
|
+
getAllIntents(): Promise<Intent[]>;
|
|
14
|
+
disconnect(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=RedisRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisRepository.d.ts","sourceRoot":"","sources":["../../src/db/RedisRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,qBAAa,eAAgB,YAAW,WAAW;IAC/C,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;gBAExB,gBAAgB,GAAE,MAAiC;IASzD,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxD,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAiBvE,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/C,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAOtD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzC,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAyBlC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RedisRepository = void 0;
|
|
7
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
8
|
+
const ConversationSession_1 = require("../application/ConversationSession");
|
|
9
|
+
class RedisRepository {
|
|
10
|
+
constructor(connectionString = 'redis://localhost:6379') {
|
|
11
|
+
this.SESSION_TTL = 3600; // 1 Hour
|
|
12
|
+
this.client = new ioredis_1.default(connectionString);
|
|
13
|
+
this.client.on('error', (err) => {
|
|
14
|
+
console.error('[Redis Error]', err);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
// Session Management (Existing)
|
|
18
|
+
async saveSession(session) {
|
|
19
|
+
const key = `session:${session.sessionId}`;
|
|
20
|
+
const data = JSON.stringify(session.toSnapshot());
|
|
21
|
+
await this.client.set(key, data, 'EX', this.SESSION_TTL);
|
|
22
|
+
}
|
|
23
|
+
async findSessionById(sessionId) {
|
|
24
|
+
const key = `session:${sessionId}`;
|
|
25
|
+
const data = await this.client.get(key);
|
|
26
|
+
if (!data)
|
|
27
|
+
return null;
|
|
28
|
+
try {
|
|
29
|
+
const parsed = JSON.parse(data);
|
|
30
|
+
return ConversationSession_1.ConversationSession.reconstitute(parsed);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
console.error(`Failed to reconstitute session ${sessionId}`, err);
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Intent Management (Data Access Only)
|
|
38
|
+
async saveIntent(intent) {
|
|
39
|
+
const key = `intent:${intent.name}`;
|
|
40
|
+
await this.client.call('JSON.SET', key, '$', JSON.stringify(intent));
|
|
41
|
+
}
|
|
42
|
+
async upsertIntents(intents) {
|
|
43
|
+
for (const intent of intents) {
|
|
44
|
+
// The embedding should be provided by the caller or handled externally
|
|
45
|
+
// This repository is now purely for data access.
|
|
46
|
+
await this.saveIntent(intent);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async findIntentByName(name) {
|
|
50
|
+
const key = `intent:${name}`;
|
|
51
|
+
const data = await this.client.call('JSON.GET', key);
|
|
52
|
+
if (!data)
|
|
53
|
+
return null;
|
|
54
|
+
return typeof data === 'string' ? JSON.parse(data) : data;
|
|
55
|
+
}
|
|
56
|
+
async deleteIntent(name) {
|
|
57
|
+
const key = `intent:${name}`;
|
|
58
|
+
await this.client.del(key);
|
|
59
|
+
}
|
|
60
|
+
async getAllIntents() {
|
|
61
|
+
// Scan for keys with intent prefix
|
|
62
|
+
const keys = await this.client.keys('intent:*');
|
|
63
|
+
if (keys.length === 0)
|
|
64
|
+
return [];
|
|
65
|
+
// Use JSON.MGET to fetch all
|
|
66
|
+
// Note: JSON.MGET might not be supported in all ioredis versions directly, but call works
|
|
67
|
+
// However, standard MGET doesn't work for JSON types in some versions depending on module loading
|
|
68
|
+
// Safer to loop or use pipeline
|
|
69
|
+
const pipeline = this.client.pipeline();
|
|
70
|
+
keys.forEach(key => pipeline.call('JSON.GET', key));
|
|
71
|
+
const results = await pipeline.exec();
|
|
72
|
+
if (!results)
|
|
73
|
+
return [];
|
|
74
|
+
return results
|
|
75
|
+
.map(([err, res]) => {
|
|
76
|
+
if (err || !res)
|
|
77
|
+
return null;
|
|
78
|
+
return typeof res === 'string' ? JSON.parse(res) : res;
|
|
79
|
+
})
|
|
80
|
+
.filter((i) => i !== null);
|
|
81
|
+
}
|
|
82
|
+
async disconnect() {
|
|
83
|
+
await this.client.quit();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.RedisRepository = RedisRepository;
|
|
87
|
+
//# sourceMappingURL=RedisRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisRepository.js","sourceRoot":"","sources":["../../src/db/RedisRepository.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA4B;AAE5B,4EAAyE;AAEzE,MAAa,eAAe;IAIxB,YAAY,mBAA2B,wBAAwB;QAF9C,gBAAW,GAAG,IAAI,CAAC,CAAC,SAAS;QAG1C,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAK,CAAC,gBAAgB,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAC5B,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACP,CAAC;IAED,gCAAgC;IAChC,KAAK,CAAC,WAAW,CAAC,OAA4B;QAC1C,MAAM,GAAG,GAAG,WAAW,OAAO,CAAC,SAAS,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,eAAe,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CAAC;IAC7B,CAAC;CACJ;AAzFD,0CAyFC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-demo.d.ts","sourceRoot":"","sources":["../../src/demo/cli-demo.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("dotenv/config"); // Load env vars
|
|
4
|
+
const Orchestrator_1 = require("../orchestrator/Orchestrator");
|
|
5
|
+
const InMemoryRepository_1 = require("../adapters/repository/InMemoryRepository");
|
|
6
|
+
const RedisRepository_1 = require("../adapters/repository/RedisRepository");
|
|
7
|
+
const MockLLMAdapter_1 = require("../adapters/llm/MockLLMAdapter");
|
|
8
|
+
const GeminiLLMAdapter_1 = require("../adapters/llm/GeminiLLMAdapter");
|
|
9
|
+
const MockIntentService_1 = require("../intent/MockIntentService");
|
|
10
|
+
const MockWorkflowAdapter_1 = require("../adapters/workflow/MockWorkflowAdapter");
|
|
11
|
+
const IntentService_1 = require("../intent/IntentService");
|
|
12
|
+
const interfaces_1 = require("../interfaces");
|
|
13
|
+
const uuid_1 = require("uuid");
|
|
14
|
+
async function runDemo() {
|
|
15
|
+
console.log('--- Chat-Flow Demo Start ---');
|
|
16
|
+
console.log(`[Env Check] VERSION: ${process.env.VERSION}`);
|
|
17
|
+
const redisUrl = process.env.REDIS_URL;
|
|
18
|
+
// 1. Initialize Adapters
|
|
19
|
+
const apiKey = process.env.GOOGLE_AI_API_KEY;
|
|
20
|
+
let llm;
|
|
21
|
+
if (apiKey) {
|
|
22
|
+
console.log(`[Init] Using Gemini Generative AI Adapter\n`);
|
|
23
|
+
llm = new GeminiLLMAdapter_1.GeminiLLMAdapter(apiKey);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
console.log(`[Init] Using Mock LLM Adapter (set GOOGLE_AI_API_KEY to use Gemini)\n`);
|
|
27
|
+
llm = new MockLLMAdapter_1.MockLLMAdapter();
|
|
28
|
+
}
|
|
29
|
+
let sessionRepo;
|
|
30
|
+
let intentAdapter;
|
|
31
|
+
if (redisUrl) {
|
|
32
|
+
console.log(`[Init] Using Redis Repository at ${redisUrl}\n`);
|
|
33
|
+
sessionRepo = new RedisRepository_1.RedisRepository(redisUrl);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
console.log(`[Init] Using In-Memory Repository (Set REDIS_URL to use Redis)\n`);
|
|
37
|
+
sessionRepo = new InMemoryRepository_1.InMemoryRepository();
|
|
38
|
+
}
|
|
39
|
+
// Setup Intent Adapter
|
|
40
|
+
// Only if we have Redis AND Gemini (for embeddings)
|
|
41
|
+
if (sessionRepo instanceof RedisRepository_1.RedisRepository && llm instanceof GeminiLLMAdapter_1.GeminiLLMAdapter) {
|
|
42
|
+
console.log(`[Init] Using Redis Repository for Real Intent Detection...`);
|
|
43
|
+
const intentSvc = new IntentService_1.IntentService(llm, sessionRepo);
|
|
44
|
+
// IntentService now IS the intent adapter (implements IIntentService)
|
|
45
|
+
intentAdapter = intentSvc;
|
|
46
|
+
// Seed Intents
|
|
47
|
+
const intentsToSeed = [
|
|
48
|
+
{
|
|
49
|
+
name: 'FLIGHTS_INQUIRY',
|
|
50
|
+
description: 'User wants to search for flights or check availability between cities',
|
|
51
|
+
required_fields: [
|
|
52
|
+
{ name: 'origin', type: 'string' },
|
|
53
|
+
{ name: 'destination', type: 'string' }
|
|
54
|
+
],
|
|
55
|
+
optional_fields: [
|
|
56
|
+
{ name: 'date', type: 'string' }
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'SELECT_FLIGHT',
|
|
61
|
+
description: 'User selects a specific flight option from a list',
|
|
62
|
+
required_fields: [
|
|
63
|
+
{ name: 'flight_id', type: 'string' }
|
|
64
|
+
],
|
|
65
|
+
optional_fields: []
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'BOOK_FLIGHT',
|
|
69
|
+
description: 'User provides passenger details to complete the booking',
|
|
70
|
+
required_fields: [
|
|
71
|
+
{ name: 'first_name', type: 'string' },
|
|
72
|
+
{ name: 'last_name', type: 'string' },
|
|
73
|
+
{ name: 'email', type: 'string' }
|
|
74
|
+
],
|
|
75
|
+
optional_fields: [],
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
console.log(`[Init] Seeding ${intentsToSeed.length} intents...`);
|
|
79
|
+
await intentSvc.upsertIntents(intentsToSeed);
|
|
80
|
+
console.log(`[Init] Intents seeded.\n`);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
console.log(`[Init] Database/LLM not ready for Real Intent Detection, using Mock Intent Adapter\n`);
|
|
84
|
+
intentAdapter = new MockIntentService_1.MockIntentService();
|
|
85
|
+
}
|
|
86
|
+
const workflow = new MockWorkflowAdapter_1.MockWorkflowAdapter();
|
|
87
|
+
// 2. Initialize Orchestrator
|
|
88
|
+
const orchestrator = new Orchestrator_1.Orchestrator(sessionRepo, llm, intentAdapter, workflow);
|
|
89
|
+
// 3. Create Session
|
|
90
|
+
const AIR_TRAVEL_PROMPT = `
|
|
91
|
+
You are 'SkyBot', a professional and friendly AI travel agent for 'AirConnect'.
|
|
92
|
+
Your goal is to help users book flights, check status, and manage reservations.
|
|
93
|
+
Always be polite, concise, and helpful.
|
|
94
|
+
|
|
95
|
+
IMPORTANT:
|
|
96
|
+
- If the system provides 'Workflow Results' (like available flights or booking confirmation), YOU MUST use that specific information to answer the user.
|
|
97
|
+
- Do not make up flight data. Only use what is provided by the system context.
|
|
98
|
+
- If you need more information (destination, dates), ask the user.
|
|
99
|
+
`.trim();
|
|
100
|
+
console.log('> Creating new session...');
|
|
101
|
+
const sessionId = (0, uuid_1.v4)();
|
|
102
|
+
const session = await orchestrator.createSession(sessionId, 'TEXT', AIR_TRAVEL_PROMPT);
|
|
103
|
+
console.log(`Session Created: ${session.sessionId}\n`);
|
|
104
|
+
// Helper to run turn
|
|
105
|
+
const runTurn = async (input) => {
|
|
106
|
+
console.log(`[User]: "${input}"`);
|
|
107
|
+
console.log(`... Processing ...`);
|
|
108
|
+
const { messages, metadata } = await orchestrator.handleMessage(session.sessionId, input);
|
|
109
|
+
// Show metadata if available (similar to console-chat logic)
|
|
110
|
+
if (metadata?.intent) {
|
|
111
|
+
console.log(`[Meta] Intent Detected: ${metadata.intent} (Conf: ${metadata.confidence})`);
|
|
112
|
+
}
|
|
113
|
+
if (metadata?.workflowExecuted) {
|
|
114
|
+
console.log(`[Meta] Workflow Executed: ${metadata.workflowExecuted}`);
|
|
115
|
+
}
|
|
116
|
+
messages.forEach(msg => {
|
|
117
|
+
if (msg.role === interfaces_1.Role.ASSISTANT) {
|
|
118
|
+
console.log(`[Assistant]: "${msg.content}"`);
|
|
119
|
+
}
|
|
120
|
+
else if (msg.role === interfaces_1.Role.USER && msg.content.includes("System Info")) {
|
|
121
|
+
console.log(`[System Log]: ${msg.content}`);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
console.log(''); // newline
|
|
125
|
+
};
|
|
126
|
+
// 4. Run Conversation Flow
|
|
127
|
+
// Turn 1: Handshake
|
|
128
|
+
await runTurn("Hello, I see you are a travel agent?");
|
|
129
|
+
// Turn 2: Intent Trigger
|
|
130
|
+
await runTurn("Yes, I want to book a flight to Paris");
|
|
131
|
+
// Turn 3: Follow up (Slot selection)
|
|
132
|
+
await runTurn("The morning flight at 10 AM looks good");
|
|
133
|
+
// Turn 4: Off-topic
|
|
134
|
+
await runTurn("Do you sell coffee?");
|
|
135
|
+
console.log('--- Chat-Flow Demo End ---');
|
|
136
|
+
// Cleanup Redis if used
|
|
137
|
+
if (sessionRepo instanceof RedisRepository_1.RedisRepository) {
|
|
138
|
+
await sessionRepo.disconnect();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
runDemo().catch(err => console.error(err));
|
|
142
|
+
//# sourceMappingURL=cli-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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