@wabot-dev/framework 0.0.3 → 0.0.4
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/src/index.d.ts +445 -10
- package/dist/src/mindset/metadata/mindsets/@mindset.js +1 -1
- package/dist/src/server/runChannel.js +1 -1
- package/dist/src/server/runServer.js +1 -1
- package/package.json +5 -4
- package/dist/src/_virtual/_commonjsHelpers.js +0 -5
- package/dist/src/_virtual/main.js +0 -7
- package/dist/src/_virtual/main2.js +0 -3
- package/dist/src/ai/index.d.ts +0 -1
- package/dist/src/ai/openia/OpenaiChatBotAdapter.d.ts +0 -9
- package/dist/src/ai/openia/index.d.ts +0 -1
- package/dist/src/channels/cmd/CmdChannel.d.ts +0 -9
- package/dist/src/channels/cmd/index.d.ts +0 -1
- package/dist/src/channels/index.d.ts +0 -2
- package/dist/src/channels/telegram/@telegram.d.ts +0 -2
- package/dist/src/channels/telegram/TelegramChannel.d.ts +0 -12
- package/dist/src/channels/telegram/TelegramChannelConfig.d.ts +0 -7
- package/dist/src/channels/telegram/index.d.ts +0 -3
- package/dist/src/chatbot/ChatBot.d.ts +0 -11
- package/dist/src/chatbot/ChatBotAdapter.d.ts +0 -26
- package/dist/src/chatbot/IChatBot.d.ts +0 -4
- package/dist/src/chatbot/chat/Chat.d.ts +0 -23
- package/dist/src/chatbot/chat/IChatFunctionCall.d.ts +0 -6
- package/dist/src/chatbot/chat/IChatItem.d.ts +0 -19
- package/dist/src/chatbot/chat/index.d.ts +0 -4
- package/dist/src/chatbot/chat/repository/IChatMemory.d.ts +0 -9
- package/dist/src/chatbot/chat/repository/IChatRepository.d.ts +0 -12
- package/dist/src/chatbot/chat/repository/index.d.ts +0 -3
- package/dist/src/chatbot/chat/repository/ram/RamChatMemory.d.ts +0 -8
- package/dist/src/chatbot/chat/repository/ram/RamChatRepository.d.ts +0 -11
- package/dist/src/chatbot/chat/repository/ram/index.d.ts +0 -2
- package/dist/src/chatbot/index.d.ts +0 -5
- package/dist/src/chatbot/metadata/@chatBot.d.ts +0 -3
- package/dist/src/chatbot/metadata/ChatBotMetadataStore.d.ts +0 -6
- package/dist/src/chatbot/metadata/IChatBotMetadata.d.ts +0 -7
- package/dist/src/chatbot/metadata/index.d.ts +0 -3
- package/dist/src/context/IContext.d.ts +0 -18
- package/dist/src/context/index.d.ts +0 -1
- package/dist/src/controller/channel/ChatResolver.d.ts +0 -9
- package/dist/src/controller/channel/IChatChannel.d.ts +0 -5
- package/dist/src/controller/channel/IMessageContext.d.ts +0 -10
- package/dist/src/controller/channel/index.d.ts +0 -3
- package/dist/src/controller/index.d.ts +0 -2
- package/dist/src/controller/metadata/ControllerMetadataStore.d.ts +0 -12
- package/dist/src/controller/metadata/channel/IChannelMetadata.d.ts +0 -8
- package/dist/src/controller/metadata/channel/index.d.ts +0 -1
- package/dist/src/controller/metadata/controller/@chatController.d.ts +0 -3
- package/dist/src/controller/metadata/controller/IChatControllerConfig.d.ts +0 -2
- package/dist/src/controller/metadata/controller/IChatControllerMetadata.d.ts +0 -3
- package/dist/src/controller/metadata/controller/index.d.ts +0 -3
- package/dist/src/controller/metadata/index.d.ts +0 -3
- package/dist/src/injection/Container.d.ts +0 -18
- package/dist/src/injection/index.d.ts +0 -3
- package/dist/src/message/IChatDocument.d.ts +0 -2
- package/dist/src/message/IChatImage.d.ts +0 -2
- package/dist/src/message/IChatMessage.d.ts +0 -9
- package/dist/src/message/IChatSender.d.ts +0 -4
- package/dist/src/message/index.d.ts +0 -4
- package/dist/src/mindset/IMindset.d.ts +0 -17
- package/dist/src/mindset/MindsetOperator.d.ts +0 -25
- package/dist/src/mindset/index.d.ts +0 -3
- package/dist/src/mindset/metadata/IMindsetMetadata.d.ts +0 -28
- package/dist/src/mindset/metadata/MindsetMetadataStore.d.ts +0 -19
- package/dist/src/mindset/metadata/functions/@mindsetFunction.d.ts +0 -3
- package/dist/src/mindset/metadata/functions/IMindsetFunctionConfig.d.ts +0 -3
- package/dist/src/mindset/metadata/functions/IMindsetFunctionDecoration.d.ts +0 -7
- package/dist/src/mindset/metadata/functions/decoratorNames.d.ts +0 -1
- package/dist/src/mindset/metadata/functions/index.d.ts +0 -4
- package/dist/src/mindset/metadata/index.d.ts +0 -6
- package/dist/src/mindset/metadata/mindsets/@mindset.d.ts +0 -5
- package/dist/src/mindset/metadata/mindsets/IMindsetConfig.d.ts +0 -4
- package/dist/src/mindset/metadata/mindsets/IMindsetDecoration.d.ts +0 -6
- package/dist/src/mindset/metadata/mindsets/decoratorNames.d.ts +0 -1
- package/dist/src/mindset/metadata/mindsets/index.d.ts +0 -3
- package/dist/src/mindset/metadata/modules/@mindsetModule.d.ts +0 -4
- package/dist/src/mindset/metadata/modules/IMindsetModuleConfig.d.ts +0 -3
- package/dist/src/mindset/metadata/modules/IMindsetModuleDecoration.d.ts +0 -5
- package/dist/src/mindset/metadata/modules/decoratorNames.d.ts +0 -1
- package/dist/src/mindset/metadata/modules/index.d.ts +0 -4
- package/dist/src/mindset/metadata/params/@isOptional.d.ts +0 -2
- package/dist/src/mindset/metadata/params/@param.d.ts +0 -3
- package/dist/src/mindset/metadata/params/IParamConfig.d.ts +0 -4
- package/dist/src/mindset/metadata/params/IParamDecoration.d.ts +0 -7
- package/dist/src/mindset/metadata/params/decoratorNames.d.ts +0 -2
- package/dist/src/mindset/metadata/params/index.d.ts +0 -3
- package/dist/src/node_modules/dotenv/lib/main.js +0 -376
- package/dist/src/node_modules/dotenv/package.json.js +0 -5
- package/dist/src/server/index.d.ts +0 -3
- package/dist/src/server/prepareChatContainer.d.ts +0 -5
- package/dist/src/server/runChannel.d.ts +0 -12
- package/dist/src/server/runServer.d.ts +0 -8
- package/dist/src/shared/IConstructor.d.ts +0 -1
- package/dist/src/shared/index.d.ts +0 -1
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IChatMessage } from '../../message/IChatMessage';
|
|
2
|
-
import { IChatFunctionCall } from './IChatFunctionCall';
|
|
3
|
-
export type ISystemMessageItem = {
|
|
4
|
-
type: 'BOT_MESSAGE';
|
|
5
|
-
content: IChatMessage;
|
|
6
|
-
};
|
|
7
|
-
export type IUserMessageItem = {
|
|
8
|
-
type: 'USER_MESSAGE';
|
|
9
|
-
content: IChatMessage;
|
|
10
|
-
};
|
|
11
|
-
export type ISystemFunctionCallItem = {
|
|
12
|
-
type: 'FUNCTION_CALL';
|
|
13
|
-
content: IChatFunctionCall;
|
|
14
|
-
};
|
|
15
|
-
export type IChatItem = {
|
|
16
|
-
id: string;
|
|
17
|
-
createdAt: Date;
|
|
18
|
-
} & (ISystemMessageItem | IUserMessageItem | ISystemFunctionCallItem);
|
|
19
|
-
export type IChatItemType = IChatItem['type'];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IChatItem } from '../IChatItem';
|
|
2
|
-
export interface IChatMemory {
|
|
3
|
-
findLastItems(count: number): Promise<IChatItem[]>;
|
|
4
|
-
saveItem(item: IChatItem): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare class ChatMemory implements IChatMemory {
|
|
7
|
-
findLastItems(count: number): Promise<IChatItem[]>;
|
|
8
|
-
saveItem(item: IChatItem): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Chat, IChatConnection } from '../Chat';
|
|
2
|
-
import { IChatMemory } from './IChatMemory';
|
|
3
|
-
export interface IChatRepository {
|
|
4
|
-
create(chat: Chat): Promise<void>;
|
|
5
|
-
findByConnection(query: IChatConnection): Promise<Chat | null>;
|
|
6
|
-
findMemory(chatId: string): Promise<IChatMemory | null>;
|
|
7
|
-
}
|
|
8
|
-
export declare class ChatRepository implements IChatRepository {
|
|
9
|
-
create(chat: Chat): Promise<void>;
|
|
10
|
-
findByConnection(query: IChatConnection): Promise<Chat | null>;
|
|
11
|
-
findMemory(chatId: string): Promise<IChatMemory | null>;
|
|
12
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IChatItem } from "../../IChatItem";
|
|
2
|
-
import { IChatMemory } from "../IChatMemory";
|
|
3
|
-
export declare class RamChatMemory implements IChatMemory {
|
|
4
|
-
private memory;
|
|
5
|
-
findLastItems(count: number): Promise<IChatItem[]>;
|
|
6
|
-
saveItem(item: IChatItem): Promise<void>;
|
|
7
|
-
clearMemory(): Promise<void>;
|
|
8
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Chat, IChatConnection } from '../../Chat';
|
|
2
|
-
import { IChatRepository } from '../IChatRepository';
|
|
3
|
-
import { IChatMemory } from '../IChatMemory';
|
|
4
|
-
export declare class RamChatRepository implements IChatRepository {
|
|
5
|
-
private items;
|
|
6
|
-
private memories;
|
|
7
|
-
create(chat: Chat): Promise<void>;
|
|
8
|
-
findByConnection(query: IChatConnection): Promise<Chat | null>;
|
|
9
|
-
findMemory(chatId: string): Promise<IChatMemory | null>;
|
|
10
|
-
private getMemory;
|
|
11
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IChatMessage } from '@/message';
|
|
2
|
-
export interface IChatContext {
|
|
3
|
-
chatId: string;
|
|
4
|
-
message: IChatMessage;
|
|
5
|
-
reply: (message: IChatMessage) => void;
|
|
6
|
-
}
|
|
7
|
-
export interface IUserContext {
|
|
8
|
-
userId: string;
|
|
9
|
-
}
|
|
10
|
-
export interface IContext {
|
|
11
|
-
user?: IUserContext;
|
|
12
|
-
chat: IChatContext;
|
|
13
|
-
}
|
|
14
|
-
export declare class Context implements IContext {
|
|
15
|
-
chat: IChatContext;
|
|
16
|
-
user?: IUserContext | undefined;
|
|
17
|
-
constructor(chat: IChatContext, user?: IUserContext | undefined);
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './IContext';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Chat, ChatRepository } from '@/chatbot';
|
|
2
|
-
import { IMessageOrigin } from './IMessageContext';
|
|
3
|
-
export declare class ChatResolver {
|
|
4
|
-
private chatRepository;
|
|
5
|
-
constructor(chatRepository: ChatRepository);
|
|
6
|
-
resolve(origin: IMessageOrigin): Promise<Chat>;
|
|
7
|
-
private resolveGroupChat;
|
|
8
|
-
private resolvePrivateChat;
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IChatType } from '@/chatbot/chat';
|
|
2
|
-
import { IChatContext } from '@/context';
|
|
3
|
-
export interface IMessageOrigin {
|
|
4
|
-
chatId: string;
|
|
5
|
-
chatType: IChatType;
|
|
6
|
-
channelType: Function;
|
|
7
|
-
}
|
|
8
|
-
export interface IMessageContext extends IChatContext {
|
|
9
|
-
origin: IMessageOrigin;
|
|
10
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IChatControllerMetadata } from './controller/IChatControllerMetadata';
|
|
2
|
-
import { IChannelMetadata } from './channel/IChannelMetadata';
|
|
3
|
-
export declare class ControllerMetadataStore {
|
|
4
|
-
private channels;
|
|
5
|
-
private chatControllers;
|
|
6
|
-
saveChannelMetadata(channelMetadata: IChannelMetadata): void;
|
|
7
|
-
saveChatControllerMetadata(controllerMetadata: IChatControllerMetadata): void;
|
|
8
|
-
getChatControllerMetadata(controllerConstructor: Function): {
|
|
9
|
-
config: IChatControllerMetadata;
|
|
10
|
-
channels: IChannelMetadata[];
|
|
11
|
-
} | null;
|
|
12
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IConstructor } from '@/shared';
|
|
2
|
-
import { IChatChannel } from '../../channel/IChatChannel';
|
|
3
|
-
export interface IChannelMetadata {
|
|
4
|
-
controllerConstructor: IConstructor<any>;
|
|
5
|
-
functionName: string;
|
|
6
|
-
channelConstructor: IConstructor<IChatChannel>;
|
|
7
|
-
channelConfig: object;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './IChannelMetadata';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DependencyContainer, InjectionToken } from "tsyringe";
|
|
2
|
-
import { InterceptionOptions } from "tsyringe/dist/typings/types";
|
|
3
|
-
import { PostResolutionInterceptorCallback, PreResolutionInterceptorCallback } from "tsyringe/dist/typings/types/dependency-container";
|
|
4
|
-
export declare class Container implements DependencyContainer {
|
|
5
|
-
register(token: unknown, provider: unknown, options?: unknown): DependencyContainer;
|
|
6
|
-
registerSingleton(from: unknown, to?: unknown): DependencyContainer;
|
|
7
|
-
registerType<T>(from: InjectionToken<T>, to: InjectionToken<T>): DependencyContainer;
|
|
8
|
-
registerInstance<T>(token: InjectionToken<T>, instance: T): DependencyContainer;
|
|
9
|
-
resolve<T>(token: InjectionToken<T>): T;
|
|
10
|
-
resolveAll<T>(token: InjectionToken<T>): T[];
|
|
11
|
-
isRegistered<T>(token: InjectionToken<T>, recursive?: boolean): boolean;
|
|
12
|
-
reset(): void;
|
|
13
|
-
clearInstances(): void;
|
|
14
|
-
createChildContainer(): DependencyContainer;
|
|
15
|
-
beforeResolution<T>(token: InjectionToken<T>, callback: PreResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
|
|
16
|
-
afterResolution<T>(token: InjectionToken<T>, callback: PostResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
|
|
17
|
-
dispose(): Promise<void> | void;
|
|
18
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const injectable: typeof import("tsyringe").injectable, container: import("tsyringe").DependencyContainer, singleton: typeof import("tsyringe").singleton, inject: typeof import("tsyringe").inject;
|
|
2
|
-
export { Container } from './Container';
|
|
3
|
-
export type { DependencyContainer } from 'tsyringe';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IChatDocument } from './IChatDocument';
|
|
2
|
-
import { IChatImage } from './IChatImage';
|
|
3
|
-
import { IChatSender } from './IChatSender';
|
|
4
|
-
export interface IChatMessage {
|
|
5
|
-
sender: IChatSender;
|
|
6
|
-
text?: string;
|
|
7
|
-
documents?: IChatDocument[];
|
|
8
|
-
images?: IChatImage[];
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface IMindsetIdentity {
|
|
2
|
-
name: string;
|
|
3
|
-
language: string;
|
|
4
|
-
age?: number;
|
|
5
|
-
personality?: string;
|
|
6
|
-
emotions?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface IMindset {
|
|
9
|
-
identity(): Promise<IMindsetIdentity>;
|
|
10
|
-
skills(): Promise<string>;
|
|
11
|
-
limits(): Promise<string>;
|
|
12
|
-
}
|
|
13
|
-
export declare class Mindset implements IMindset {
|
|
14
|
-
identity(): Promise<IMindsetIdentity>;
|
|
15
|
-
skills(): Promise<string>;
|
|
16
|
-
limits(): Promise<string>;
|
|
17
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Container } from '@/injection';
|
|
2
|
-
import { IMindset, IMindsetIdentity, Mindset } from './IMindset';
|
|
3
|
-
import { MindsetMetadataStore } from './metadata/MindsetMetadataStore';
|
|
4
|
-
export declare class MindsetOperator implements IMindset {
|
|
5
|
-
private mindset;
|
|
6
|
-
private container;
|
|
7
|
-
private metadata;
|
|
8
|
-
constructor(mindset: Mindset, container: Container, metadataStore: MindsetMetadataStore);
|
|
9
|
-
identity(): Promise<IMindsetIdentity>;
|
|
10
|
-
skills(): Promise<string>;
|
|
11
|
-
limits(): Promise<string>;
|
|
12
|
-
callFunction(name: string, params: string): Promise<string>;
|
|
13
|
-
allFunctionsDescriptors(): Promise<{
|
|
14
|
-
readonly type: "function";
|
|
15
|
-
readonly name: string;
|
|
16
|
-
readonly description: string;
|
|
17
|
-
readonly parameters: {
|
|
18
|
-
readonly type: "object";
|
|
19
|
-
readonly properties: {};
|
|
20
|
-
readonly required: string[];
|
|
21
|
-
};
|
|
22
|
-
}[]>;
|
|
23
|
-
private functionDescriptor;
|
|
24
|
-
private toolParam;
|
|
25
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { IConstructor } from '@/shared';
|
|
2
|
-
import { IMindset } from '../IMindset';
|
|
3
|
-
import { IParamConfig } from './params/IParamConfig';
|
|
4
|
-
import { IMindsetFunctionConfig } from './functions/IMindsetFunctionConfig';
|
|
5
|
-
import { IMindsetModuleConfig } from './modules/IMindsetModuleConfig';
|
|
6
|
-
import { IMindsetConfig } from './mindsets/IMindsetConfig';
|
|
7
|
-
export interface IMindsetFunctionParamMetadata {
|
|
8
|
-
config: IParamConfig;
|
|
9
|
-
name: string;
|
|
10
|
-
type: Function;
|
|
11
|
-
}
|
|
12
|
-
export interface IMindsetFunctionMetadata {
|
|
13
|
-
moduleConstructor: Function;
|
|
14
|
-
requestConstructor?: Function;
|
|
15
|
-
name: string;
|
|
16
|
-
config: IMindsetFunctionConfig;
|
|
17
|
-
params: IMindsetFunctionParamMetadata[];
|
|
18
|
-
}
|
|
19
|
-
export interface IMindsetModuleMetadata {
|
|
20
|
-
constructor: Function;
|
|
21
|
-
config: IMindsetModuleConfig;
|
|
22
|
-
functions: IMindsetFunctionMetadata[];
|
|
23
|
-
}
|
|
24
|
-
export interface IMindsetMetadata {
|
|
25
|
-
constructor: IConstructor<IMindset>;
|
|
26
|
-
config: IMindsetConfig;
|
|
27
|
-
modules: IMindsetModuleMetadata[];
|
|
28
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IMindsetFunctionDecoration } from './functions/IMindsetFunctionDecoration';
|
|
2
|
-
import { IMindsetFunctionMetadata, IMindsetFunctionParamMetadata, IMindsetMetadata, IMindsetModuleMetadata } from './IMindsetMetadata';
|
|
3
|
-
import { IMindsetModuleDecoration } from './modules/IMindsetModuleDecoration';
|
|
4
|
-
import { IParamDecoration } from './params/IParamDecoration';
|
|
5
|
-
import { IMindsetDecoration } from './mindsets/IMindsetDecoration';
|
|
6
|
-
export declare class MindsetMetadataStore {
|
|
7
|
-
private readonly paramsDecorations;
|
|
8
|
-
private readonly functionsDecorations;
|
|
9
|
-
private readonly modulesDecorations;
|
|
10
|
-
private readonly mindsetsDecorations;
|
|
11
|
-
saveParamDecoration(paramDecoration: IParamDecoration): void;
|
|
12
|
-
saveFunctionDecoration(functionDecoration: IMindsetFunctionDecoration): void;
|
|
13
|
-
saveModuleDecoration(moduleDecoration: IMindsetModuleDecoration): void;
|
|
14
|
-
saveMindsetDecoration(mindsetDecoration: IMindsetDecoration): void;
|
|
15
|
-
getRequestParamsMetadata(requestConstructor: Function): IMindsetFunctionParamMetadata[];
|
|
16
|
-
getFunctionsMetadata(moduleConstructor: Function): IMindsetFunctionMetadata[];
|
|
17
|
-
getModuleMetadata(moduleConstructor: Function): IMindsetModuleMetadata;
|
|
18
|
-
getMindsetMetadata(ctor: Function): IMindsetMetadata;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const MINDSET_FUNCTION_DECORATION_FUNCTION = "mindsetFunction";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const MINDSET_DECORATION_MINDSET = "mindset";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const MINDSET_MODULE_DECORATION_MODULE = "mindsetModule";
|