@lssm/module.ai-chat 1.41.1 → 1.42.1
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 +3 -0
- package/dist/ai-chat.feature.d.ts +12 -0
- package/dist/ai-chat.feature.d.ts.map +1 -0
- package/dist/ai-chat.feature.js +95 -1
- package/dist/ai-chat.feature.js.map +1 -0
- package/dist/ai-chat.operations.d.ts +243 -0
- package/dist/ai-chat.operations.d.ts.map +1 -0
- package/dist/ai-chat.operations.js +174 -0
- package/dist/ai-chat.operations.js.map +1 -0
- package/dist/context/context-builder.d.ts +57 -0
- package/dist/context/context-builder.d.ts.map +1 -0
- package/dist/context/context-builder.js +148 -2
- package/dist/context/context-builder.js.map +1 -0
- package/dist/context/file-operations.d.ts +100 -0
- package/dist/context/file-operations.d.ts.map +1 -0
- package/dist/context/file-operations.js +175 -1
- package/dist/context/file-operations.js.map +1 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/index.js +5 -1
- package/dist/context/workspace-context.d.ts +117 -0
- package/dist/context/workspace-context.d.ts.map +1 -0
- package/dist/context/workspace-context.js +124 -2
- package/dist/context/workspace-context.js.map +1 -0
- package/dist/core/chat-service.d.ts +73 -0
- package/dist/core/chat-service.d.ts.map +1 -0
- package/dist/core/chat-service.js +215 -2
- package/dist/core/chat-service.js.map +1 -0
- package/dist/core/conversation-store.d.ts +74 -0
- package/dist/core/conversation-store.d.ts.map +1 -0
- package/dist/core/conversation-store.js +109 -1
- package/dist/core/conversation-store.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +4 -1
- package/dist/core/message-types.d.ts +150 -0
- package/dist/core/message-types.d.ts.map +1 -0
- package/dist/events.d.ts +115 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +100 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +23 -1
- package/dist/libs/schema/dist/EnumType.js +2 -0
- package/dist/libs/schema/dist/FieldType.js +50 -0
- package/dist/libs/schema/dist/FieldType.js.map +1 -0
- package/dist/libs/schema/dist/ScalarTypeEnum.js +237 -0
- package/dist/libs/schema/dist/ScalarTypeEnum.js.map +1 -0
- package/dist/libs/schema/dist/SchemaModel.js +40 -0
- package/dist/libs/schema/dist/SchemaModel.js.map +1 -0
- package/dist/libs/schema/dist/entity/defineEntity.js +1 -0
- package/dist/libs/schema/dist/entity/index.js +2 -0
- package/dist/libs/schema/dist/entity/types.js +1 -0
- package/dist/libs/schema/dist/index.js +6 -0
- package/dist/presentation/components/ChatContainer.d.ts +21 -0
- package/dist/presentation/components/ChatContainer.d.ts.map +1 -0
- package/dist/presentation/components/ChatContainer.js +63 -1
- package/dist/presentation/components/ChatContainer.js.map +1 -0
- package/dist/presentation/components/ChatInput.d.ts +35 -0
- package/dist/presentation/components/ChatInput.d.ts.map +1 -0
- package/dist/presentation/components/ChatInput.js +149 -1
- package/dist/presentation/components/ChatInput.js.map +1 -0
- package/dist/presentation/components/ChatMessage.d.ts +24 -0
- package/dist/presentation/components/ChatMessage.d.ts.map +1 -0
- package/dist/presentation/components/ChatMessage.js +136 -1
- package/dist/presentation/components/ChatMessage.js.map +1 -0
- package/dist/presentation/components/CodePreview.d.ts +40 -0
- package/dist/presentation/components/CodePreview.d.ts.map +1 -0
- package/dist/presentation/components/CodePreview.js +127 -2
- package/dist/presentation/components/CodePreview.js.map +1 -0
- package/dist/presentation/components/ContextIndicator.d.ts +26 -0
- package/dist/presentation/components/ContextIndicator.d.ts.map +1 -0
- package/dist/presentation/components/ContextIndicator.js +97 -1
- package/dist/presentation/components/ContextIndicator.js.map +1 -0
- package/dist/presentation/components/ModelPicker.d.ts +39 -0
- package/dist/presentation/components/ModelPicker.d.ts.map +1 -0
- package/dist/presentation/components/ModelPicker.js +202 -1
- package/dist/presentation/components/ModelPicker.js.map +1 -0
- package/dist/presentation/components/index.d.ts +7 -0
- package/dist/presentation/components/index.js +8 -1
- package/dist/presentation/hooks/index.d.ts +3 -0
- package/dist/presentation/hooks/index.js +4 -1
- package/dist/presentation/hooks/useChat.d.ts +67 -0
- package/dist/presentation/hooks/useChat.d.ts.map +1 -0
- package/dist/presentation/hooks/useChat.js +172 -1
- package/dist/presentation/hooks/useChat.js.map +1 -0
- package/dist/presentation/hooks/useProviders.d.ts +38 -0
- package/dist/presentation/hooks/useProviders.d.ts.map +1 -0
- package/dist/presentation/hooks/useProviders.js +41 -1
- package/dist/presentation/hooks/useProviders.js.map +1 -0
- package/dist/presentation/index.d.ts +11 -0
- package/dist/presentation/index.js +12 -1
- package/dist/providers/chat-utilities.d.ts +15 -0
- package/dist/providers/chat-utilities.d.ts.map +1 -0
- package/dist/providers/chat-utilities.js +17 -1
- package/dist/providers/chat-utilities.js.map +1 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +4 -1
- package/dist/schema.d.ts +222 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +102 -0
- package/dist/schema.js.map +1 -0
- package/package.json +29 -22
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-store.js","names":["fullConversation: ChatConversation","fullMessage: ChatMessage","results: ChatConversation[]"],"sources":["../../src/core/conversation-store.ts"],"sourcesContent":["/**\n * Conversation storage interface and implementations\n */\nimport type {\n ChatConversation,\n ChatMessage,\n ConversationStatus,\n} from './message-types';\n\n/**\n * Interface for conversation persistence\n */\nexport interface ConversationStore {\n /**\n * Get a conversation by ID\n */\n get(conversationId: string): Promise<ChatConversation | null>;\n\n /**\n * Create a new conversation\n */\n create(\n conversation: Omit<ChatConversation, 'id' | 'createdAt' | 'updatedAt'>\n ): Promise<ChatConversation>;\n\n /**\n * Update conversation properties\n */\n update(\n conversationId: string,\n updates: Partial<\n Pick<ChatConversation, 'title' | 'status' | 'summary' | 'metadata'>\n >\n ): Promise<ChatConversation | null>;\n\n /**\n * Append a message to a conversation\n */\n appendMessage(\n conversationId: string,\n message: Omit<\n ChatMessage,\n 'id' | 'conversationId' | 'createdAt' | 'updatedAt'\n >\n ): Promise<ChatMessage>;\n\n /**\n * Update a message in a conversation\n */\n updateMessage(\n conversationId: string,\n messageId: string,\n updates: Partial<ChatMessage>\n ): Promise<ChatMessage | null>;\n\n /**\n * Delete a conversation\n */\n delete(conversationId: string): Promise<boolean>;\n\n /**\n * List conversations with optional filters\n */\n list(options?: {\n status?: ConversationStatus;\n limit?: number;\n offset?: number;\n }): Promise<ChatConversation[]>;\n\n /**\n * Search conversations by content\n */\n search(query: string, limit?: number): Promise<ChatConversation[]>;\n}\n\n/**\n * Generate a unique ID\n */\nfunction generateId(prefix: string): string {\n return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;\n}\n\n/**\n * In-memory conversation store for development and testing\n */\nexport class InMemoryConversationStore implements ConversationStore {\n private readonly conversations = new Map<string, ChatConversation>();\n\n async get(conversationId: string): Promise<ChatConversation | null> {\n return this.conversations.get(conversationId) ?? null;\n }\n\n async create(\n conversation: Omit<ChatConversation, 'id' | 'createdAt' | 'updatedAt'>\n ): Promise<ChatConversation> {\n const now = new Date();\n const fullConversation: ChatConversation = {\n ...conversation,\n id: generateId('conv'),\n createdAt: now,\n updatedAt: now,\n };\n this.conversations.set(fullConversation.id, fullConversation);\n return fullConversation;\n }\n\n async update(\n conversationId: string,\n updates: Partial<\n Pick<ChatConversation, 'title' | 'status' | 'summary' | 'metadata'>\n >\n ): Promise<ChatConversation | null> {\n const conversation = this.conversations.get(conversationId);\n if (!conversation) return null;\n\n const updated = {\n ...conversation,\n ...updates,\n updatedAt: new Date(),\n };\n this.conversations.set(conversationId, updated);\n return updated;\n }\n\n async appendMessage(\n conversationId: string,\n message: Omit<\n ChatMessage,\n 'id' | 'conversationId' | 'createdAt' | 'updatedAt'\n >\n ): Promise<ChatMessage> {\n const conversation = this.conversations.get(conversationId);\n if (!conversation) {\n throw new Error(`Conversation ${conversationId} not found`);\n }\n\n const now = new Date();\n const fullMessage: ChatMessage = {\n ...message,\n id: generateId('msg'),\n conversationId,\n createdAt: now,\n updatedAt: now,\n };\n\n conversation.messages.push(fullMessage);\n conversation.updatedAt = now;\n return fullMessage;\n }\n\n async updateMessage(\n conversationId: string,\n messageId: string,\n updates: Partial<ChatMessage>\n ): Promise<ChatMessage | null> {\n const conversation = this.conversations.get(conversationId);\n if (!conversation) return null;\n\n const messageIndex = conversation.messages.findIndex(\n (m) => m.id === messageId\n );\n if (messageIndex === -1) return null;\n\n const message = conversation.messages[messageIndex];\n if (!message) return null;\n\n const updated = {\n ...message,\n ...updates,\n updatedAt: new Date(),\n };\n conversation.messages[messageIndex] = updated;\n conversation.updatedAt = new Date();\n return updated;\n }\n\n async delete(conversationId: string): Promise<boolean> {\n return this.conversations.delete(conversationId);\n }\n\n async list(options?: {\n status?: ConversationStatus;\n limit?: number;\n offset?: number;\n }): Promise<ChatConversation[]> {\n let results = Array.from(this.conversations.values());\n\n if (options?.status) {\n results = results.filter((c) => c.status === options.status);\n }\n\n // Sort by updatedAt descending\n results.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());\n\n const offset = options?.offset ?? 0;\n const limit = options?.limit ?? 100;\n return results.slice(offset, offset + limit);\n }\n\n async search(query: string, limit = 20): Promise<ChatConversation[]> {\n const lowerQuery = query.toLowerCase();\n const results: ChatConversation[] = [];\n\n for (const conversation of this.conversations.values()) {\n // Search in title\n if (conversation.title?.toLowerCase().includes(lowerQuery)) {\n results.push(conversation);\n continue;\n }\n\n // Search in messages\n const hasMatch = conversation.messages.some((m) =>\n m.content.toLowerCase().includes(lowerQuery)\n );\n if (hasMatch) {\n results.push(conversation);\n }\n\n if (results.length >= limit) break;\n }\n\n return results;\n }\n\n /**\n * Clear all conversations (for testing)\n */\n clear(): void {\n this.conversations.clear();\n }\n}\n\n/**\n * Create an in-memory conversation store\n */\nexport function createInMemoryConversationStore(): ConversationStore {\n return new InMemoryConversationStore();\n}\n"],"mappings":";;;;AA8EA,SAAS,WAAW,QAAwB;AAC1C,QAAO,GAAG,OAAO,GAAG,KAAK,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,GAAG,GAAG;;;;;AAM3E,IAAa,4BAAb,MAAoE;CAClE,AAAiB,gCAAgB,IAAI,KAA+B;CAEpE,MAAM,IAAI,gBAA0D;AAClE,SAAO,KAAK,cAAc,IAAI,eAAe,IAAI;;CAGnD,MAAM,OACJ,cAC2B;EAC3B,MAAM,sBAAM,IAAI,MAAM;EACtB,MAAMA,mBAAqC;GACzC,GAAG;GACH,IAAI,WAAW,OAAO;GACtB,WAAW;GACX,WAAW;GACZ;AACD,OAAK,cAAc,IAAI,iBAAiB,IAAI,iBAAiB;AAC7D,SAAO;;CAGT,MAAM,OACJ,gBACA,SAGkC;EAClC,MAAM,eAAe,KAAK,cAAc,IAAI,eAAe;AAC3D,MAAI,CAAC,aAAc,QAAO;EAE1B,MAAM,UAAU;GACd,GAAG;GACH,GAAG;GACH,2BAAW,IAAI,MAAM;GACtB;AACD,OAAK,cAAc,IAAI,gBAAgB,QAAQ;AAC/C,SAAO;;CAGT,MAAM,cACJ,gBACA,SAIsB;EACtB,MAAM,eAAe,KAAK,cAAc,IAAI,eAAe;AAC3D,MAAI,CAAC,aACH,OAAM,IAAI,MAAM,gBAAgB,eAAe,YAAY;EAG7D,MAAM,sBAAM,IAAI,MAAM;EACtB,MAAMC,cAA2B;GAC/B,GAAG;GACH,IAAI,WAAW,MAAM;GACrB;GACA,WAAW;GACX,WAAW;GACZ;AAED,eAAa,SAAS,KAAK,YAAY;AACvC,eAAa,YAAY;AACzB,SAAO;;CAGT,MAAM,cACJ,gBACA,WACA,SAC6B;EAC7B,MAAM,eAAe,KAAK,cAAc,IAAI,eAAe;AAC3D,MAAI,CAAC,aAAc,QAAO;EAE1B,MAAM,eAAe,aAAa,SAAS,WACxC,MAAM,EAAE,OAAO,UACjB;AACD,MAAI,iBAAiB,GAAI,QAAO;EAEhC,MAAM,UAAU,aAAa,SAAS;AACtC,MAAI,CAAC,QAAS,QAAO;EAErB,MAAM,UAAU;GACd,GAAG;GACH,GAAG;GACH,2BAAW,IAAI,MAAM;GACtB;AACD,eAAa,SAAS,gBAAgB;AACtC,eAAa,4BAAY,IAAI,MAAM;AACnC,SAAO;;CAGT,MAAM,OAAO,gBAA0C;AACrD,SAAO,KAAK,cAAc,OAAO,eAAe;;CAGlD,MAAM,KAAK,SAIqB;EAC9B,IAAI,UAAU,MAAM,KAAK,KAAK,cAAc,QAAQ,CAAC;AAErD,MAAI,SAAS,OACX,WAAU,QAAQ,QAAQ,MAAM,EAAE,WAAW,QAAQ,OAAO;AAI9D,UAAQ,MAAM,GAAG,MAAM,EAAE,UAAU,SAAS,GAAG,EAAE,UAAU,SAAS,CAAC;EAErE,MAAM,SAAS,SAAS,UAAU;EAClC,MAAM,QAAQ,SAAS,SAAS;AAChC,SAAO,QAAQ,MAAM,QAAQ,SAAS,MAAM;;CAG9C,MAAM,OAAO,OAAe,QAAQ,IAAiC;EACnE,MAAM,aAAa,MAAM,aAAa;EACtC,MAAMC,UAA8B,EAAE;AAEtC,OAAK,MAAM,gBAAgB,KAAK,cAAc,QAAQ,EAAE;AAEtD,OAAI,aAAa,OAAO,aAAa,CAAC,SAAS,WAAW,EAAE;AAC1D,YAAQ,KAAK,aAAa;AAC1B;;AAOF,OAHiB,aAAa,SAAS,MAAM,MAC3C,EAAE,QAAQ,aAAa,CAAC,SAAS,WAAW,CAC7C,CAEC,SAAQ,KAAK,aAAa;AAG5B,OAAI,QAAQ,UAAU,MAAO;;AAG/B,SAAO;;;;;CAMT,QAAc;AACZ,OAAK,cAAc,OAAO;;;;;;AAO9B,SAAgB,kCAAqD;AACnE,QAAO,IAAI,2BAA2B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ChatAttachment, ChatCodeBlock, ChatConversation, ChatMessage, ChatRole, ChatSource, ChatStreamChunk, ChatToolCall, ConversationStatus, MessageStatus, SendMessageOptions, SendMessageResult, StreamMessageResult } from "./message-types.js";
|
|
2
|
+
import { ConversationStore, InMemoryConversationStore, createInMemoryConversationStore } from "./conversation-store.js";
|
|
3
|
+
import { ChatService, ChatServiceConfig, createChatService } from "./chat-service.js";
|
|
4
|
+
export { ChatAttachment, ChatCodeBlock, ChatConversation, ChatMessage, ChatRole, ChatService, ChatServiceConfig, ChatSource, ChatStreamChunk, ChatToolCall, ConversationStatus, ConversationStore, InMemoryConversationStore, MessageStatus, SendMessageOptions, SendMessageResult, StreamMessageResult, createChatService, createInMemoryConversationStore };
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import{InMemoryConversationStore
|
|
1
|
+
import { InMemoryConversationStore, createInMemoryConversationStore } from "./conversation-store.js";
|
|
2
|
+
import { ChatService, createChatService } from "./chat-service.js";
|
|
3
|
+
|
|
4
|
+
export { ChatService, InMemoryConversationStore, createChatService, createInMemoryConversationStore };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
//#region src/core/message-types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Message and conversation types for AI Chat
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Role of a message participant
|
|
7
|
+
*/
|
|
8
|
+
type ChatRole = 'user' | 'assistant' | 'system';
|
|
9
|
+
/**
|
|
10
|
+
* Status of a message
|
|
11
|
+
*/
|
|
12
|
+
type MessageStatus = 'pending' | 'streaming' | 'completed' | 'error';
|
|
13
|
+
/**
|
|
14
|
+
* Attachment type for messages
|
|
15
|
+
*/
|
|
16
|
+
interface ChatAttachment {
|
|
17
|
+
id: string;
|
|
18
|
+
type: 'file' | 'image' | 'code' | 'spec';
|
|
19
|
+
name: string;
|
|
20
|
+
content?: string;
|
|
21
|
+
mimeType?: string;
|
|
22
|
+
size?: number;
|
|
23
|
+
path?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Code block within a message
|
|
27
|
+
*/
|
|
28
|
+
interface ChatCodeBlock {
|
|
29
|
+
id: string;
|
|
30
|
+
language: string;
|
|
31
|
+
code: string;
|
|
32
|
+
filename?: string;
|
|
33
|
+
startLine?: number;
|
|
34
|
+
endLine?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Tool call information
|
|
38
|
+
*/
|
|
39
|
+
interface ChatToolCall {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
args: Record<string, unknown>;
|
|
43
|
+
result?: unknown;
|
|
44
|
+
status: 'pending' | 'running' | 'completed' | 'error';
|
|
45
|
+
error?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Source/citation in a message
|
|
49
|
+
*/
|
|
50
|
+
interface ChatSource {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
url?: string;
|
|
54
|
+
snippet?: string;
|
|
55
|
+
type: 'file' | 'spec' | 'doc' | 'web';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A single chat message
|
|
59
|
+
*/
|
|
60
|
+
interface ChatMessage {
|
|
61
|
+
id: string;
|
|
62
|
+
conversationId: string;
|
|
63
|
+
role: ChatRole;
|
|
64
|
+
content: string;
|
|
65
|
+
status: MessageStatus;
|
|
66
|
+
createdAt: Date;
|
|
67
|
+
updatedAt: Date;
|
|
68
|
+
attachments?: ChatAttachment[];
|
|
69
|
+
codeBlocks?: ChatCodeBlock[];
|
|
70
|
+
toolCalls?: ChatToolCall[];
|
|
71
|
+
sources?: ChatSource[];
|
|
72
|
+
reasoning?: string;
|
|
73
|
+
usage?: {
|
|
74
|
+
inputTokens: number;
|
|
75
|
+
outputTokens: number;
|
|
76
|
+
};
|
|
77
|
+
error?: {
|
|
78
|
+
code: string;
|
|
79
|
+
message: string;
|
|
80
|
+
};
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Conversation status
|
|
85
|
+
*/
|
|
86
|
+
type ConversationStatus = 'active' | 'archived' | 'deleted';
|
|
87
|
+
/**
|
|
88
|
+
* A conversation containing multiple messages
|
|
89
|
+
*/
|
|
90
|
+
interface ChatConversation {
|
|
91
|
+
id: string;
|
|
92
|
+
title?: string;
|
|
93
|
+
status: ConversationStatus;
|
|
94
|
+
createdAt: Date;
|
|
95
|
+
updatedAt: Date;
|
|
96
|
+
provider: string;
|
|
97
|
+
model: string;
|
|
98
|
+
workspacePath?: string;
|
|
99
|
+
contextFiles?: string[];
|
|
100
|
+
messages: ChatMessage[];
|
|
101
|
+
summary?: string;
|
|
102
|
+
metadata?: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Options for sending a message
|
|
106
|
+
*/
|
|
107
|
+
interface SendMessageOptions {
|
|
108
|
+
conversationId?: string;
|
|
109
|
+
content: string;
|
|
110
|
+
attachments?: ChatAttachment[];
|
|
111
|
+
systemPrompt?: string;
|
|
112
|
+
maxTokens?: number;
|
|
113
|
+
temperature?: number;
|
|
114
|
+
stream?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Streaming chunk from AI response
|
|
118
|
+
*/
|
|
119
|
+
interface ChatStreamChunk {
|
|
120
|
+
type: 'text' | 'reasoning' | 'tool_call' | 'source' | 'error' | 'done';
|
|
121
|
+
content?: string;
|
|
122
|
+
toolCall?: ChatToolCall;
|
|
123
|
+
source?: ChatSource;
|
|
124
|
+
error?: {
|
|
125
|
+
code: string;
|
|
126
|
+
message: string;
|
|
127
|
+
};
|
|
128
|
+
usage?: {
|
|
129
|
+
inputTokens: number;
|
|
130
|
+
outputTokens: number;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Result of sending a message
|
|
135
|
+
*/
|
|
136
|
+
interface SendMessageResult {
|
|
137
|
+
message: ChatMessage;
|
|
138
|
+
conversation: ChatConversation;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Streaming result
|
|
142
|
+
*/
|
|
143
|
+
interface StreamMessageResult {
|
|
144
|
+
conversationId: string;
|
|
145
|
+
messageId: string;
|
|
146
|
+
stream: AsyncIterable<ChatStreamChunk>;
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
export { ChatAttachment, ChatCodeBlock, ChatConversation, ChatMessage, ChatRole, ChatSource, ChatStreamChunk, ChatToolCall, ConversationStatus, MessageStatus, SendMessageOptions, SendMessageResult, StreamMessageResult };
|
|
150
|
+
//# sourceMappingURL=message-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-types.d.ts","names":[],"sources":["../../src/core/message-types.ts"],"sourcesContent":[],"mappings":";;AAOA;AAKA;AAKA;AAaA;AAYA;AAYiB,KA/CL,QAAA,GA+Ce,MAAA,GAAA,WAAA,GAAA,QAAA;AAW3B;;;AAMa,KA3DD,aAAA,GA2DC,SAAA,GAAA,WAAA,GAAA,WAAA,GAAA,OAAA;;;;AAMC,UA5DG,cAAA,CA4DH;EACF,EAAA,EAAA,MAAA;EAkBC,IAAA,EAAA,MAAA,GAAA,OAAA,GAAA,MAAA,GAAA,MAAA;EAAM,IAAA,EAAA,MAAA;EAMP,OAAA,CAAA,EAAA,MAAA;EAKK,QAAA,CAAA,EAAA,MAAA;EAGP,IAAA,CAAA,EAAA,MAAA;EACG,IAAA,CAAA,EAAA,MAAA;;;;;AAwBI,UAzGA,aAAA,CAyGkB;EAalB,EAAA,EAAA,MAAA;EAYA,QAAA,EAAA,MAAA;EAQA,IAAA,EAAA,MAAA;;;;;;;;UA9HA,YAAA;;;QAGT;;;;;;;;UASS,UAAA;;;;;;;;;;UAWA,WAAA;;;QAGT;;UAEE;aACG;aACA;gBAGG;eACD;cACD;YACF;;;;;;;;;;aAkBC;;;;;KAMD,kBAAA;;;;UAKK,gBAAA;;;UAGP;aACG;aACA;;;;;YAWD;;aAMC;;;;;UAMI,kBAAA;;;gBAGD;;;;;;;;;UAUC,eAAA;;;aAGJ;WACF;;;;;;;;;;;;;UAQM,iBAAA;WACN;gBACK;;;;;UAMC,mBAAA;;;UAGP,cAAc"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as _lssm_lib_contracts0 from "@lssm/lib.contracts";
|
|
2
|
+
import * as _lssm_lib_schema0 from "@lssm/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/events.d.ts
|
|
5
|
+
declare const MessageSentEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
6
|
+
id: {
|
|
7
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
8
|
+
isOptional: false;
|
|
9
|
+
};
|
|
10
|
+
role: {
|
|
11
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
12
|
+
isOptional: false;
|
|
13
|
+
};
|
|
14
|
+
content: {
|
|
15
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
16
|
+
isOptional: false;
|
|
17
|
+
};
|
|
18
|
+
status: {
|
|
19
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
20
|
+
isOptional: false;
|
|
21
|
+
};
|
|
22
|
+
createdAt: {
|
|
23
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
24
|
+
isOptional: false;
|
|
25
|
+
};
|
|
26
|
+
}>>;
|
|
27
|
+
declare const MessageReceivedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
28
|
+
id: {
|
|
29
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
30
|
+
isOptional: false;
|
|
31
|
+
};
|
|
32
|
+
role: {
|
|
33
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
34
|
+
isOptional: false;
|
|
35
|
+
};
|
|
36
|
+
content: {
|
|
37
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
38
|
+
isOptional: false;
|
|
39
|
+
};
|
|
40
|
+
status: {
|
|
41
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
42
|
+
isOptional: false;
|
|
43
|
+
};
|
|
44
|
+
createdAt: {
|
|
45
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
46
|
+
isOptional: false;
|
|
47
|
+
};
|
|
48
|
+
}>>;
|
|
49
|
+
declare const ConversationCreatedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
50
|
+
id: {
|
|
51
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
52
|
+
isOptional: false;
|
|
53
|
+
};
|
|
54
|
+
title: {
|
|
55
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
56
|
+
isOptional: true;
|
|
57
|
+
};
|
|
58
|
+
status: {
|
|
59
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
60
|
+
isOptional: false;
|
|
61
|
+
};
|
|
62
|
+
messages: {
|
|
63
|
+
type: _lssm_lib_schema0.SchemaModel<{
|
|
64
|
+
id: {
|
|
65
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
66
|
+
isOptional: false;
|
|
67
|
+
};
|
|
68
|
+
role: {
|
|
69
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
70
|
+
isOptional: false;
|
|
71
|
+
};
|
|
72
|
+
content: {
|
|
73
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
74
|
+
isOptional: false;
|
|
75
|
+
};
|
|
76
|
+
status: {
|
|
77
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
78
|
+
isOptional: false;
|
|
79
|
+
};
|
|
80
|
+
createdAt: {
|
|
81
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
82
|
+
isOptional: false;
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
85
|
+
isArray: true;
|
|
86
|
+
isOptional: false;
|
|
87
|
+
};
|
|
88
|
+
provider: {
|
|
89
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
90
|
+
isOptional: false;
|
|
91
|
+
};
|
|
92
|
+
model: {
|
|
93
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
94
|
+
isOptional: false;
|
|
95
|
+
};
|
|
96
|
+
}>>;
|
|
97
|
+
declare const ConversationDeletedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
98
|
+
id: {
|
|
99
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
100
|
+
isOptional: false;
|
|
101
|
+
};
|
|
102
|
+
}>>;
|
|
103
|
+
declare const ChatErrorEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
104
|
+
code: {
|
|
105
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
106
|
+
isOptional: false;
|
|
107
|
+
};
|
|
108
|
+
message: {
|
|
109
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
110
|
+
isOptional: false;
|
|
111
|
+
};
|
|
112
|
+
}>>;
|
|
113
|
+
//#endregion
|
|
114
|
+
export { ChatErrorEvent, ConversationCreatedEvent, ConversationDeletedEvent, MessageReceivedEvent, MessageSentEvent };
|
|
115
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"sourcesContent":[],"mappings":";;;;cAIa,kBAAgB,oBAAA,CAAA,4BAAA;;UAU3B,iBAAA,CAAA;;EAVW,CAAA;EAUX,IAAA,EAAA;;;;;;gBAV2B,KAAA;EAAA,CAAA;EAAA,MAAA,EAAA;IAYhB,IAAA,6BAUX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;AAV+B,cAApB,oBAAoB,EAAA,oBAAA,CAAA,SAAA,mBAAA,WAAA,CAAA;EAAA,EAAA,EAAA;IAYpB,IAAA,EAFX,iBAAA,CAAA,SAYA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;gBAVmC,KAAA;EAAA,CAAA;EAAA,SAAA,EAAA;IAYxB,IAAA,6BAeX,KAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;CAfmC,CAAA,CAAA;AAAA,cAZxB,wBAYwB,EAZA,oBAAA,CAAA,SAYA,mBAZA,WAYA,CAAA;EAiBxB,EAAA,EAAA;IAgBX,IAAA,EAnCA,iBAAA,CAAA,SAmCA,CAAA,MAAA,EAAA,MAAA,CAAA;;;EAhByB,KAAA,EAAA;IAAA,IAAA,6BAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAjBd,0BAAwB,oBAAA,CAAA,4BAAA;;UAenC,iBAAA,CAAA;;;;cAEW,gBAAc,oBAAA,CAAA,4BAAA;;UAgBzB,iBAAA,CAAA"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ScalarTypeEnum } from "./libs/schema/dist/ScalarTypeEnum.js";
|
|
2
|
+
import { defineSchemaModel } from "./libs/schema/dist/SchemaModel.js";
|
|
3
|
+
import "./libs/schema/dist/index.js";
|
|
4
|
+
import { ChatConversationModel, ChatMessageModel } from "./schema.js";
|
|
5
|
+
import { defineEvent } from "@lssm/lib.contracts";
|
|
6
|
+
|
|
7
|
+
//#region src/events.ts
|
|
8
|
+
const MessageSentEvent = defineEvent({
|
|
9
|
+
meta: {
|
|
10
|
+
key: "ai-chat.message.sent",
|
|
11
|
+
version: 1,
|
|
12
|
+
description: "Message sent by user",
|
|
13
|
+
stability: "stable",
|
|
14
|
+
owners: ["@ai-chat"],
|
|
15
|
+
tags: [
|
|
16
|
+
"ai-chat",
|
|
17
|
+
"message",
|
|
18
|
+
"sent"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
payload: ChatMessageModel
|
|
22
|
+
});
|
|
23
|
+
const MessageReceivedEvent = defineEvent({
|
|
24
|
+
meta: {
|
|
25
|
+
key: "ai-chat.message.received",
|
|
26
|
+
version: 1,
|
|
27
|
+
description: "Message received from AI",
|
|
28
|
+
stability: "stable",
|
|
29
|
+
owners: ["@ai-chat"],
|
|
30
|
+
tags: [
|
|
31
|
+
"ai-chat",
|
|
32
|
+
"message",
|
|
33
|
+
"received"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
payload: ChatMessageModel
|
|
37
|
+
});
|
|
38
|
+
const ConversationCreatedEvent = defineEvent({
|
|
39
|
+
meta: {
|
|
40
|
+
key: "ai-chat.conversation.created",
|
|
41
|
+
version: 1,
|
|
42
|
+
description: "New conversation created",
|
|
43
|
+
stability: "stable",
|
|
44
|
+
owners: ["@ai-chat"],
|
|
45
|
+
tags: [
|
|
46
|
+
"ai-chat",
|
|
47
|
+
"conversation",
|
|
48
|
+
"created"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
payload: ChatConversationModel
|
|
52
|
+
});
|
|
53
|
+
const ConversationDeletedEvent = defineEvent({
|
|
54
|
+
meta: {
|
|
55
|
+
key: "ai-chat.conversation.deleted",
|
|
56
|
+
version: 1,
|
|
57
|
+
description: "Conversation deleted",
|
|
58
|
+
stability: "stable",
|
|
59
|
+
owners: ["@ai-chat"],
|
|
60
|
+
tags: [
|
|
61
|
+
"ai-chat",
|
|
62
|
+
"conversation",
|
|
63
|
+
"deleted"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
payload: defineSchemaModel({
|
|
67
|
+
name: "ConversationDeletedPayload",
|
|
68
|
+
fields: { id: {
|
|
69
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
70
|
+
isOptional: false
|
|
71
|
+
} }
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
const ChatErrorEvent = defineEvent({
|
|
75
|
+
meta: {
|
|
76
|
+
key: "ai-chat.error",
|
|
77
|
+
version: 1,
|
|
78
|
+
description: "Chat error occurred",
|
|
79
|
+
stability: "stable",
|
|
80
|
+
owners: ["@ai-chat"],
|
|
81
|
+
tags: ["ai-chat", "error"]
|
|
82
|
+
},
|
|
83
|
+
payload: defineSchemaModel({
|
|
84
|
+
name: "ChatErrorPayload",
|
|
85
|
+
fields: {
|
|
86
|
+
code: {
|
|
87
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
88
|
+
isOptional: false
|
|
89
|
+
},
|
|
90
|
+
message: {
|
|
91
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
92
|
+
isOptional: false
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
export { ChatErrorEvent, ConversationCreatedEvent, ConversationDeletedEvent, MessageReceivedEvent, MessageSentEvent };
|
|
100
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { defineEvent } from '@lssm/lib.contracts';\nimport { defineSchemaModel, ScalarTypeEnum } from '@lssm/lib.schema';\nimport { ChatMessageModel, ChatConversationModel } from './schema';\n\nexport const MessageSentEvent = defineEvent({\n meta: {\n key: 'ai-chat.message.sent',\n version: 1,\n description: 'Message sent by user',\n stability: 'stable',\n owners: ['@ai-chat'],\n tags: ['ai-chat', 'message', 'sent'],\n },\n payload: ChatMessageModel,\n});\n\nexport const MessageReceivedEvent = defineEvent({\n meta: {\n key: 'ai-chat.message.received',\n version: 1,\n description: 'Message received from AI',\n stability: 'stable',\n owners: ['@ai-chat'],\n tags: ['ai-chat', 'message', 'received'],\n },\n payload: ChatMessageModel,\n});\n\nexport const ConversationCreatedEvent = defineEvent({\n meta: {\n key: 'ai-chat.conversation.created',\n version: 1,\n description: 'New conversation created',\n stability: 'stable',\n owners: ['@ai-chat'],\n tags: ['ai-chat', 'conversation', 'created'],\n },\n payload: ChatConversationModel,\n});\n\nexport const ConversationDeletedEvent = defineEvent({\n meta: {\n key: 'ai-chat.conversation.deleted',\n version: 1,\n description: 'Conversation deleted',\n stability: 'stable',\n owners: ['@ai-chat'],\n tags: ['ai-chat', 'conversation', 'deleted'],\n },\n payload: defineSchemaModel({\n name: 'ConversationDeletedPayload',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n});\n\nexport const ChatErrorEvent = defineEvent({\n meta: {\n key: 'ai-chat.error',\n version: 1,\n description: 'Chat error occurred',\n stability: 'stable',\n owners: ['@ai-chat'],\n tags: ['ai-chat', 'error'],\n },\n payload: defineSchemaModel({\n name: 'ChatErrorPayload',\n fields: {\n code: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n message: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n});\n"],"mappings":";;;;;;;AAIA,MAAa,mBAAmB,YAAY;CAC1C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,WAAW;EACpB,MAAM;GAAC;GAAW;GAAW;GAAO;EACrC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,WAAW;EACpB,MAAM;GAAC;GAAW;GAAW;GAAW;EACzC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,2BAA2B,YAAY;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,WAAW;EACpB,MAAM;GAAC;GAAW;GAAgB;GAAU;EAC7C;CACD,SAAS;CACV,CAAC;AAEF,MAAa,2BAA2B,YAAY;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,WAAW;EACpB,MAAM;GAAC;GAAW;GAAgB;GAAU;EAC7C;CACD,SAAS,kBAAkB;EACzB,MAAM;EACN,QAAQ,EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO,EAClE;EACF,CAAC;CACH,CAAC;AAEF,MAAa,iBAAiB,YAAY;CACxC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,WAAW;EACpB,MAAM,CAAC,WAAW,QAAQ;EAC3B;CACD,SAAS,kBAAkB;EACzB,MAAM;EACN,QAAQ;GACN,MAAM;IAAE,MAAM,eAAe,iBAAiB;IAAE,YAAY;IAAO;GACnE,SAAS;IAAE,MAAM,eAAe,iBAAiB;IAAE,YAAY;IAAO;GACvE;EACF,CAAC;CACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FileInfo, SpecInfo, WorkspaceContext, WorkspaceContextConfig, WorkspaceSummary, createWorkspaceContext } from "./context/workspace-context.js";
|
|
2
|
+
import { BuiltContext, ContextBuilder, ContextBuilderOptions, ContextEntry, createContextBuilder } from "./context/context-builder.js";
|
|
3
|
+
import { FileOperation, FileOperationResult, FileOperations, FileReadResult, FileSystem, FileWriteResult, createNodeFileOperations } from "./context/file-operations.js";
|
|
4
|
+
import { AiChatFeature } from "./ai-chat.feature.js";
|
|
5
|
+
import { ChatContainer } from "./presentation/components/ChatContainer.js";
|
|
6
|
+
import { ChatMessage } from "./presentation/components/ChatMessage.js";
|
|
7
|
+
import { ChatInput } from "./presentation/components/ChatInput.js";
|
|
8
|
+
import { ModelPicker } from "./presentation/components/ModelPicker.js";
|
|
9
|
+
import { ContextIndicator } from "./presentation/components/ContextIndicator.js";
|
|
10
|
+
import { CodePreview } from "./presentation/components/CodePreview.js";
|
|
11
|
+
import "./presentation/components/index.js";
|
|
12
|
+
import { UseChatOptions, UseChatReturn, useChat } from "./presentation/hooks/useChat.js";
|
|
13
|
+
import { UseProvidersReturn, useProviders } from "./presentation/hooks/useProviders.js";
|
|
14
|
+
import "./presentation/hooks/index.js";
|
|
15
|
+
import "./presentation/index.js";
|
|
16
|
+
import { isStudioAvailable, supportsLocalMode } from "./providers/chat-utilities.js";
|
|
17
|
+
import { ChatModelInfo, ChatProvider, ChatProviderConfig, ChatProviderMode, ChatProviderName, DEFAULT_MODELS, MODELS, ModelCapabilities, ProviderAvailability, createProvider, createProviderFromEnv, getAvailableProviders, getDefaultModel, getEnvVarName, getModelInfo, getModelsForProvider, getRecommendedModels, hasCredentials, isOllamaRunning, listOllamaModels, validateProvider } from "./providers/index.js";
|
|
18
|
+
import { ChatConversationModel, ChatMessageModel, ListConversationsOutputModel, SendMessageInputModel, SendMessageOutputModel } from "./schema.js";
|
|
19
|
+
import { DeleteConversationContract, GetConversationContract, ListConversationsContract, ListProvidersContract, ScanContextContract, SendMessageContract, StreamMessageContract } from "./ai-chat.operations.js";
|
|
20
|
+
import { ChatErrorEvent, ConversationCreatedEvent, ConversationDeletedEvent, MessageReceivedEvent, MessageSentEvent } from "./events.js";
|
|
21
|
+
export { AiChatFeature, BuiltContext, ChatContainer, ChatConversationModel, ChatErrorEvent, ChatInput, ChatMessage, ChatMessage as ChatMessageComponent, ChatMessageModel, ChatModelInfo, ChatProvider, ChatProviderConfig, ChatProviderMode, ChatProviderName, CodePreview, ContextBuilder, ContextBuilderOptions, ContextEntry, ContextIndicator, ConversationCreatedEvent, ConversationDeletedEvent, DEFAULT_MODELS, DeleteConversationContract, FileInfo, FileOperation, FileOperationResult, FileOperations, FileReadResult, FileSystem, FileWriteResult, GetConversationContract, ListConversationsContract, ListConversationsOutputModel, ListProvidersContract, MODELS, MessageReceivedEvent, MessageSentEvent, ModelCapabilities, ModelPicker, ProviderAvailability, ScanContextContract, SendMessageContract, SendMessageInputModel, SendMessageOutputModel, SpecInfo, StreamMessageContract, UseChatOptions, UseChatReturn, UseProvidersReturn, WorkspaceContext, WorkspaceContextConfig, WorkspaceSummary, createContextBuilder, createNodeFileOperations, createProvider, createProviderFromEnv, createWorkspaceContext, getAvailableProviders, getDefaultModel, getEnvVarName, getModelInfo, getModelsForProvider, getRecommendedModels, hasCredentials, isOllamaRunning, isStudioAvailable, listOllamaModels, supportsLocalMode, useChat, useProviders, validateProvider };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
import{AiChatFeature
|
|
1
|
+
import { AiChatFeature } from "./ai-chat.feature.js";
|
|
2
|
+
import { ChatContainer } from "./presentation/components/ChatContainer.js";
|
|
3
|
+
import { CodePreview } from "./presentation/components/CodePreview.js";
|
|
4
|
+
import { ChatMessage } from "./presentation/components/ChatMessage.js";
|
|
5
|
+
import { ChatInput } from "./presentation/components/ChatInput.js";
|
|
6
|
+
import { ModelPicker } from "./presentation/components/ModelPicker.js";
|
|
7
|
+
import { ContextIndicator } from "./presentation/components/ContextIndicator.js";
|
|
8
|
+
import "./presentation/components/index.js";
|
|
9
|
+
import { useChat } from "./presentation/hooks/useChat.js";
|
|
10
|
+
import { useProviders } from "./presentation/hooks/useProviders.js";
|
|
11
|
+
import "./presentation/hooks/index.js";
|
|
12
|
+
import "./presentation/index.js";
|
|
13
|
+
import { isStudioAvailable, supportsLocalMode } from "./providers/chat-utilities.js";
|
|
14
|
+
import { DEFAULT_MODELS, MODELS, createProvider, createProviderFromEnv, getAvailableProviders, getDefaultModel, getEnvVarName, getModelInfo, getModelsForProvider, getRecommendedModels, hasCredentials, isOllamaRunning, listOllamaModels, validateProvider } from "./providers/index.js";
|
|
15
|
+
import { WorkspaceContext, createWorkspaceContext } from "./context/workspace-context.js";
|
|
16
|
+
import { ContextBuilder, createContextBuilder } from "./context/context-builder.js";
|
|
17
|
+
import { FileOperations, createNodeFileOperations } from "./context/file-operations.js";
|
|
18
|
+
import "./context/index.js";
|
|
19
|
+
import { ChatConversationModel, ChatMessageModel, ListConversationsOutputModel, SendMessageInputModel, SendMessageOutputModel } from "./schema.js";
|
|
20
|
+
import { DeleteConversationContract, GetConversationContract, ListConversationsContract, ListProvidersContract, ScanContextContract, SendMessageContract, StreamMessageContract } from "./ai-chat.operations.js";
|
|
21
|
+
import { ChatErrorEvent, ConversationCreatedEvent, ConversationDeletedEvent, MessageReceivedEvent, MessageSentEvent } from "./events.js";
|
|
22
|
+
|
|
23
|
+
export { AiChatFeature, ChatContainer, ChatConversationModel, ChatErrorEvent, ChatInput, ChatMessage, ChatMessage as ChatMessageComponent, ChatMessageModel, CodePreview, ContextBuilder, ContextIndicator, ConversationCreatedEvent, ConversationDeletedEvent, DEFAULT_MODELS, DeleteConversationContract, FileOperations, GetConversationContract, ListConversationsContract, ListConversationsOutputModel, ListProvidersContract, MODELS, MessageReceivedEvent, MessageSentEvent, ModelPicker, ScanContextContract, SendMessageContract, SendMessageInputModel, SendMessageOutputModel, StreamMessageContract, WorkspaceContext, createContextBuilder, createNodeFileOperations, createProvider, createProviderFromEnv, createWorkspaceContext, getAvailableProviders, getDefaultModel, getEnvVarName, getModelInfo, getModelsForProvider, getRecommendedModels, hasCredentials, isOllamaRunning, isStudioAvailable, listOllamaModels, supportsLocalMode, useChat, useProviders, validateProvider };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import "zod";
|
|
2
|
+
import { GraphQLScalarType } from "graphql";
|
|
3
|
+
|
|
4
|
+
//#region ../../libs/schema/dist/FieldType.js
|
|
5
|
+
/**
|
|
6
|
+
* GraphQL scalar wrapper that carries zod and JSON Schema metadata.
|
|
7
|
+
*
|
|
8
|
+
* TInternal is the runtime representation; TExternal is the GraphQL output.
|
|
9
|
+
*/
|
|
10
|
+
var FieldType = class extends GraphQLScalarType {
|
|
11
|
+
zodSchema;
|
|
12
|
+
jsonSchemaDef;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
15
|
+
this.zodSchema = config.zod;
|
|
16
|
+
this.jsonSchemaDef = config.jsonSchema;
|
|
17
|
+
}
|
|
18
|
+
/** Return the attached zod schema for validation. */
|
|
19
|
+
getZod() {
|
|
20
|
+
return this.zodSchema;
|
|
21
|
+
}
|
|
22
|
+
/** GraphQL scalar instance usable by Pothos or vanilla GraphQL. */
|
|
23
|
+
getPothos() {
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
/** Return the JSON Schema (evaluates factory if provided). */
|
|
27
|
+
getJson() {
|
|
28
|
+
return typeof this.jsonSchemaDef === "function" ? this.jsonSchemaDef() : this.jsonSchemaDef;
|
|
29
|
+
}
|
|
30
|
+
getJsonSchemaDef() {
|
|
31
|
+
return this.jsonSchemaDef;
|
|
32
|
+
}
|
|
33
|
+
getJsonSchema() {
|
|
34
|
+
const deepResolve = (v) => {
|
|
35
|
+
const value = typeof v === "function" ? v() : v;
|
|
36
|
+
if (Array.isArray(value)) return value.map((item) => deepResolve(item));
|
|
37
|
+
if (value && typeof value === "object") {
|
|
38
|
+
const obj = {};
|
|
39
|
+
for (const [k, val] of Object.entries(value)) obj[k] = deepResolve(val);
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
};
|
|
44
|
+
return deepResolve(this.getJson());
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { FieldType };
|
|
50
|
+
//# sourceMappingURL=FieldType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldType.js","names":[],"sources":["../../../../../../libs/schema/dist/FieldType.js"],"sourcesContent":["import \"zod\";\nimport { GraphQLScalarType } from \"graphql\";\n\n//#region src/FieldType.ts\n/**\n* GraphQL scalar wrapper that carries zod and JSON Schema metadata.\n*\n* TInternal is the runtime representation; TExternal is the GraphQL output.\n*/\nvar FieldType = class extends GraphQLScalarType {\n\tzodSchema;\n\tjsonSchemaDef;\n\tconstructor(config) {\n\t\tsuper(config);\n\t\tthis.zodSchema = config.zod;\n\t\tthis.jsonSchemaDef = config.jsonSchema;\n\t}\n\t/** Return the attached zod schema for validation. */\n\tgetZod() {\n\t\treturn this.zodSchema;\n\t}\n\t/** GraphQL scalar instance usable by Pothos or vanilla GraphQL. */\n\tgetPothos() {\n\t\treturn this;\n\t}\n\t/** Return the JSON Schema (evaluates factory if provided). */\n\tgetJson() {\n\t\treturn typeof this.jsonSchemaDef === \"function\" ? this.jsonSchemaDef() : this.jsonSchemaDef;\n\t}\n\tgetJsonSchemaDef() {\n\t\treturn this.jsonSchemaDef;\n\t}\n\tgetJsonSchema() {\n\t\tconst deepResolve = (v) => {\n\t\t\tconst value = typeof v === \"function\" ? v() : v;\n\t\t\tif (Array.isArray(value)) return value.map((item) => deepResolve(item));\n\t\t\tif (value && typeof value === \"object\") {\n\t\t\t\tconst obj = {};\n\t\t\t\tfor (const [k, val] of Object.entries(value)) obj[k] = deepResolve(val);\n\t\t\t\treturn obj;\n\t\t\t}\n\t\t\treturn value;\n\t\t};\n\t\treturn deepResolve(this.getJson());\n\t}\n};\n\n//#endregion\nexport { FieldType };\n//# sourceMappingURL=FieldType.js.map"],"mappings":";;;;;;;;;AASA,IAAI,YAAY,cAAc,kBAAkB;CAC/C;CACA;CACA,YAAY,QAAQ;AACnB,QAAM,OAAO;AACb,OAAK,YAAY,OAAO;AACxB,OAAK,gBAAgB,OAAO;;;CAG7B,SAAS;AACR,SAAO,KAAK;;;CAGb,YAAY;AACX,SAAO;;;CAGR,UAAU;AACT,SAAO,OAAO,KAAK,kBAAkB,aAAa,KAAK,eAAe,GAAG,KAAK;;CAE/E,mBAAmB;AAClB,SAAO,KAAK;;CAEb,gBAAgB;EACf,MAAM,eAAe,MAAM;GAC1B,MAAM,QAAQ,OAAO,MAAM,aAAa,GAAG,GAAG;AAC9C,OAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,KAAK,SAAS,YAAY,KAAK,CAAC;AACvE,OAAI,SAAS,OAAO,UAAU,UAAU;IACvC,MAAM,MAAM,EAAE;AACd,SAAK,MAAM,CAAC,GAAG,QAAQ,OAAO,QAAQ,MAAM,CAAE,KAAI,KAAK,YAAY,IAAI;AACvE,WAAO;;AAER,UAAO;;AAER,SAAO,YAAY,KAAK,SAAS,CAAC"}
|