@happyvertical/smrt-chat 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +35 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +163 -0
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/chunks/ChatService-Dpzc1Pa5.js +2044 -0
- package/dist/chunks/ChatService-Dpzc1Pa5.js.map +1 -0
- package/dist/collections/AgentSessionCollection.d.ts +57 -0
- package/dist/collections/AgentSessionCollection.d.ts.map +1 -0
- package/dist/collections/ChatMessageCollection.d.ts +79 -0
- package/dist/collections/ChatMessageCollection.d.ts.map +1 -0
- package/dist/collections/ChatParticipantCollection.d.ts +26 -0
- package/dist/collections/ChatParticipantCollection.d.ts.map +1 -0
- package/dist/collections/ChatReactionCollection.d.ts +23 -0
- package/dist/collections/ChatReactionCollection.d.ts.map +1 -0
- package/dist/collections/ChatRoomCollection.d.ts +43 -0
- package/dist/collections/ChatRoomCollection.d.ts.map +1 -0
- package/dist/collections/ChatThreadCollection.d.ts +9 -0
- package/dist/collections/ChatThreadCollection.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/agent-runtime.d.ts +16 -0
- package/dist/internal/agent-runtime.d.ts.map +1 -0
- package/dist/internal/agent-runtime.js +5 -0
- package/dist/internal/agent-runtime.js.map +1 -0
- package/dist/manifest.json +2811 -0
- package/dist/models/AgentSession.d.ts +70 -0
- package/dist/models/AgentSession.d.ts.map +1 -0
- package/dist/models/ChatMessage.d.ts +55 -0
- package/dist/models/ChatMessage.d.ts.map +1 -0
- package/dist/models/ChatParticipant.d.ts +32 -0
- package/dist/models/ChatParticipant.d.ts.map +1 -0
- package/dist/models/ChatReaction.d.ts +19 -0
- package/dist/models/ChatReaction.d.ts.map +1 -0
- package/dist/models/ChatRoom.d.ts +44 -0
- package/dist/models/ChatRoom.d.ts.map +1 -0
- package/dist/models/ChatThread.d.ts +24 -0
- package/dist/models/ChatThread.d.ts.map +1 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/playground.d.ts +2 -0
- package/dist/playground.d.ts.map +1 -0
- package/dist/playground.js +166 -0
- package/dist/playground.js.map +1 -0
- package/dist/services/ChatService.d.ts +390 -0
- package/dist/services/ChatService.d.ts.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +1507 -0
- package/dist/svelte/components/agent/AgentChat.svelte +542 -0
- package/dist/svelte/components/agent/AgentChat.svelte.d.ts +21 -0
- package/dist/svelte/components/agent/AgentChat.svelte.d.ts.map +1 -0
- package/dist/svelte/components/agent/AgentSelector.svelte +175 -0
- package/dist/svelte/components/agent/AgentSelector.svelte.d.ts +11 -0
- package/dist/svelte/components/agent/AgentSelector.svelte.d.ts.map +1 -0
- package/dist/svelte/components/agent/AgentSessionPanel.svelte +322 -0
- package/dist/svelte/components/agent/AgentSessionPanel.svelte.d.ts +15 -0
- package/dist/svelte/components/agent/AgentSessionPanel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/agent/ToolCallDisplay.svelte +335 -0
- package/dist/svelte/components/agent/ToolCallDisplay.svelte.d.ts +9 -0
- package/dist/svelte/components/agent/ToolCallDisplay.svelte.d.ts.map +1 -0
- package/dist/svelte/components/agent/message-blocks.d.ts +12 -0
- package/dist/svelte/components/agent/message-blocks.d.ts.map +1 -0
- package/dist/svelte/components/agent/message-blocks.js +41 -0
- package/dist/svelte/components/agent/message-blocks.test.js +31 -0
- package/dist/svelte/components/dialogs/RoomCreateDialog.svelte +403 -0
- package/dist/svelte/components/dialogs/RoomCreateDialog.svelte.d.ts +16 -0
- package/dist/svelte/components/dialogs/RoomCreateDialog.svelte.d.ts.map +1 -0
- package/dist/svelte/components/dialogs/SearchMessages.svelte +457 -0
- package/dist/svelte/components/dialogs/SearchMessages.svelte.d.ts +17 -0
- package/dist/svelte/components/dialogs/SearchMessages.svelte.d.ts.map +1 -0
- package/dist/svelte/components/layout/ChatLayout.svelte +150 -0
- package/dist/svelte/components/layout/ChatLayout.svelte.d.ts +18 -0
- package/dist/svelte/components/layout/ChatLayout.svelte.d.ts.map +1 -0
- package/dist/svelte/components/layout/MemberList.svelte +389 -0
- package/dist/svelte/components/layout/MemberList.svelte.d.ts +11 -0
- package/dist/svelte/components/layout/MemberList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/layout/RoomHeader.svelte +241 -0
- package/dist/svelte/components/layout/RoomHeader.svelte.d.ts +15 -0
- package/dist/svelte/components/layout/RoomHeader.svelte.d.ts.map +1 -0
- package/dist/svelte/components/layout/RoomList.svelte +471 -0
- package/dist/svelte/components/layout/RoomList.svelte.d.ts +15 -0
- package/dist/svelte/components/layout/RoomList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/messages/MessageInput.svelte +232 -0
- package/dist/svelte/components/messages/MessageInput.svelte.d.ts +20 -0
- package/dist/svelte/components/messages/MessageInput.svelte.d.ts.map +1 -0
- package/dist/svelte/components/messages/MessageItem.svelte +431 -0
- package/dist/svelte/components/messages/MessageItem.svelte.d.ts +19 -0
- package/dist/svelte/components/messages/MessageItem.svelte.d.ts.map +1 -0
- package/dist/svelte/components/messages/MessageList.svelte +129 -0
- package/dist/svelte/components/messages/MessageList.svelte.d.ts +17 -0
- package/dist/svelte/components/messages/MessageList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/messages/ThreadPanel.svelte +156 -0
- package/dist/svelte/components/messages/ThreadPanel.svelte.d.ts +17 -0
- package/dist/svelte/components/messages/ThreadPanel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/messages/__tests__/MessageInput.test.js +38 -0
- package/dist/svelte/components/shared/Avatar.svelte +30 -0
- package/dist/svelte/components/shared/Avatar.svelte.d.ts +14 -0
- package/dist/svelte/components/shared/Avatar.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/FileUpload.svelte +382 -0
- package/dist/svelte/components/shared/FileUpload.svelte.d.ts +14 -0
- package/dist/svelte/components/shared/FileUpload.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/LinkPreview.svelte +108 -0
- package/dist/svelte/components/shared/LinkPreview.svelte.d.ts +18 -0
- package/dist/svelte/components/shared/LinkPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/MentionAutocomplete.svelte +168 -0
- package/dist/svelte/components/shared/MentionAutocomplete.svelte.d.ts +18 -0
- package/dist/svelte/components/shared/MentionAutocomplete.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/MessageBubble.svelte +81 -0
- package/dist/svelte/components/shared/MessageBubble.svelte.d.ts +16 -0
- package/dist/svelte/components/shared/MessageBubble.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/ReactionPicker.svelte +103 -0
- package/dist/svelte/components/shared/ReactionPicker.svelte.d.ts +10 -0
- package/dist/svelte/components/shared/ReactionPicker.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/ReadReceipts.svelte +127 -0
- package/dist/svelte/components/shared/ReadReceipts.svelte.d.ts +13 -0
- package/dist/svelte/components/shared/ReadReceipts.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/TypingIndicator.svelte +90 -0
- package/dist/svelte/components/shared/TypingIndicator.svelte.d.ts +12 -0
- package/dist/svelte/components/shared/TypingIndicator.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/UserPresence.svelte +65 -0
- package/dist/svelte/components/shared/UserPresence.svelte.d.ts +13 -0
- package/dist/svelte/components/shared/UserPresence.svelte.d.ts.map +1 -0
- package/dist/svelte/components/shared/__tests__/Avatar.test.js +20 -0
- package/dist/svelte/components/shared/__tests__/LinkPreview.test.js +29 -0
- package/dist/svelte/components/shared/__tests__/MessageBubble.test.js +21 -0
- package/dist/svelte/components/shared/__tests__/ReactionPicker.test.js +35 -0
- package/dist/svelte/components/shared/__tests__/ReadReceipts.test.js +28 -0
- package/dist/svelte/components/shared/__tests__/TypingIndicator.test.js +27 -0
- package/dist/svelte/components/shared/__tests__/UserPresence.test.js +23 -0
- package/dist/svelte/components/tabs/ChatTab.svelte +240 -0
- package/dist/svelte/components/tabs/ChatTab.svelte.d.ts +21 -0
- package/dist/svelte/components/tabs/ChatTab.svelte.d.ts.map +1 -0
- package/dist/svelte/components/tabs/ChatTabList.svelte +158 -0
- package/dist/svelte/components/tabs/ChatTabList.svelte.d.ts +13 -0
- package/dist/svelte/components/tabs/ChatTabList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/tabs/ChatTabs.svelte +88 -0
- package/dist/svelte/components/tabs/ChatTabs.svelte.d.ts +21 -0
- package/dist/svelte/components/tabs/ChatTabs.svelte.d.ts.map +1 -0
- package/dist/svelte/components/tabs/MiniChat.svelte +253 -0
- package/dist/svelte/components/tabs/MiniChat.svelte.d.ts +15 -0
- package/dist/svelte/components/tabs/MiniChat.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +51 -0
- package/dist/svelte/i18n.d.ts.map +1 -0
- package/dist/svelte/i18n.js +72 -0
- package/dist/svelte/i18n.messages.d.ts +50 -0
- package/dist/svelte/i18n.messages.d.ts.map +1 -0
- package/dist/svelte/i18n.messages.js +69 -0
- package/dist/svelte/index.d.ts +48 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +117 -0
- package/dist/svelte/playground.d.ts +171 -0
- package/dist/svelte/playground.d.ts.map +1 -0
- package/dist/svelte/playground.js +161 -0
- package/dist/svelte/types.d.ts +116 -0
- package/dist/svelte/types.d.ts.map +1 -0
- package/dist/svelte/types.js +1 -0
- package/dist/types.d.ts +99 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui.d.ts +4 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +92 -0
- package/dist/ui.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
+
import { AgentSessionOptions, AgentSessionStatus } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Agent conversation session. Internal model — sessions must be created via
|
|
5
|
+
* {@link ChatService.createAgentSession} and their security-relevant config
|
|
6
|
+
* (`allowedTools` / `systemPrompt` / `chatRoomId` / `participantProfileId`)
|
|
7
|
+
* mutated only via the owner-checked {@link ChatService.updateAgentSessionConfig}
|
|
8
|
+
* (S5 #1392). The generated CRUD surface is read-only (`get`/`list`);
|
|
9
|
+
* `create`/`update`/`delete` are NOT generated, otherwise a `PUT` could rewrite
|
|
10
|
+
* the tool allow-list or system prompt and bypass the owner check.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AgentSession extends SmrtObject {
|
|
13
|
+
/**
|
|
14
|
+
* Reserved `sessionContext` key that scopes a session's identity to a caller-
|
|
15
|
+
* supplied conversation subject (e.g. a content id) (S5 #1392).
|
|
16
|
+
*
|
|
17
|
+
* `createAgentSession`'s reuse path keys on `(agentId, participantProfileId,
|
|
18
|
+
* tenantId)`; without a discriminator a session opened for subject A would be
|
|
19
|
+
* reused (and its context rewritten) for a request about subject B, returning
|
|
20
|
+
* A's room/threads on B's route. Storing the key here lets the reuse lookup
|
|
21
|
+
* require an exact match so distinct subjects get distinct sessions.
|
|
22
|
+
*/
|
|
23
|
+
static readonly SESSION_KEY_CONTEXT_FIELD = "__sessionKey";
|
|
24
|
+
tenantId: string | null;
|
|
25
|
+
agentId: string;
|
|
26
|
+
participantProfileId: string;
|
|
27
|
+
chatRoomId: string | null;
|
|
28
|
+
status: AgentSessionStatus;
|
|
29
|
+
/** JSON array of tool names the consuming app has allowed for this session */
|
|
30
|
+
allowedTools: string;
|
|
31
|
+
/** Conversation context/memory for multi-turn state (JSON string) */
|
|
32
|
+
sessionContext: string;
|
|
33
|
+
/** System prompt override for this session */
|
|
34
|
+
systemPrompt: string;
|
|
35
|
+
messageCount: number;
|
|
36
|
+
totalTokensUsed: number;
|
|
37
|
+
maxTokens: number;
|
|
38
|
+
maxMessages: number;
|
|
39
|
+
lastMessageAt: Date | null;
|
|
40
|
+
expiresAt: Date | null;
|
|
41
|
+
closedAt: Date | null;
|
|
42
|
+
constructor(options?: AgentSessionOptions);
|
|
43
|
+
getAllowedTools(): string[];
|
|
44
|
+
setAllowedTools(tools: string[]): void;
|
|
45
|
+
/**
|
|
46
|
+
* Fail-closed authorization check for an agent tool call (S5 #1392).
|
|
47
|
+
*
|
|
48
|
+
* A tool may only be invoked when it appears in this session's allow-list.
|
|
49
|
+
* If the allow-list is empty or unparseable, NO tools are permitted. This is
|
|
50
|
+
* deliberately conservative: an empty whitelist means "no tools", never
|
|
51
|
+
* "all tools".
|
|
52
|
+
*/
|
|
53
|
+
isToolAllowed(toolName: string): boolean;
|
|
54
|
+
isActive(): boolean;
|
|
55
|
+
isExpired(): boolean;
|
|
56
|
+
close(): Promise<void>;
|
|
57
|
+
expire(): Promise<void>;
|
|
58
|
+
getSessionContext(): Record<string, unknown>;
|
|
59
|
+
setSessionContext(ctx: Record<string, unknown>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Stable identity key that scopes this session to a conversation subject
|
|
62
|
+
* (S5 #1392). Returns `null` when the session is not subject-scoped. Used by
|
|
63
|
+
* the reuse lookup so a session opened for one subject is never reused for a
|
|
64
|
+
* request about a different subject.
|
|
65
|
+
*/
|
|
66
|
+
getSessionKey(): string | null;
|
|
67
|
+
updateSessionContext(updates: Record<string, unknown>): Promise<void>;
|
|
68
|
+
recordMessage(tokensUsed?: number): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=AgentSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentSession.d.ts","sourceRoot":"","sources":["../../src/models/AgentSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAEX,MAAM,0BAA0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,CAAC,GAAG,IAAI;IAIrD;;;;;OAKG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAMxB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMrE,aAAa,CAAC,UAAU,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAM3D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
+
import { ChatMessageOptions, ChatMessageRole, ChatMessageType } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Chat message. Internal model — all mutations must go through the
|
|
5
|
+
* membership-checked {@link ChatService} (S5 #1392). The generated CRUD surface
|
|
6
|
+
* is read-only (`get`/`list`); `create`/`update`/`delete` are intentionally NOT
|
|
7
|
+
* generated so an authenticated caller cannot write into an arbitrary room via
|
|
8
|
+
* the raw collection routes, bypassing the room-membership authorization in
|
|
9
|
+
* {@link ChatService.sendMessage}.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ChatMessage extends SmrtObject {
|
|
12
|
+
tenantId: string;
|
|
13
|
+
roomId: string;
|
|
14
|
+
threadId: string | null;
|
|
15
|
+
senderProfileId: string;
|
|
16
|
+
agentSessionId: string | null;
|
|
17
|
+
content: string;
|
|
18
|
+
messageType: ChatMessageType;
|
|
19
|
+
role: ChatMessageRole;
|
|
20
|
+
isEdited: boolean;
|
|
21
|
+
editedAt: Date | null;
|
|
22
|
+
isDeleted: boolean;
|
|
23
|
+
replyToMessageId: string | null;
|
|
24
|
+
metadata: string;
|
|
25
|
+
toolCallData: string | null;
|
|
26
|
+
attachments: string;
|
|
27
|
+
constructor(options?: ChatMessageOptions);
|
|
28
|
+
getAttachments(): Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
filename: string;
|
|
31
|
+
contentType: string;
|
|
32
|
+
size: number;
|
|
33
|
+
url?: string;
|
|
34
|
+
}>;
|
|
35
|
+
setAttachments(items: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
filename: string;
|
|
38
|
+
contentType: string;
|
|
39
|
+
size: number;
|
|
40
|
+
url?: string;
|
|
41
|
+
}>): void;
|
|
42
|
+
getMetadata(): Record<string, unknown>;
|
|
43
|
+
setMetadata(data: Record<string, unknown>): void;
|
|
44
|
+
getToolCallData(): Record<string, unknown> | null;
|
|
45
|
+
setToolCallData(data: Record<string, unknown> | null): void;
|
|
46
|
+
hasAttachments(): boolean;
|
|
47
|
+
isToolCall(): boolean;
|
|
48
|
+
isToolResult(): boolean;
|
|
49
|
+
isFromAgent(): boolean;
|
|
50
|
+
isSystemMessage(): boolean;
|
|
51
|
+
edit(newContent: string): Promise<void>;
|
|
52
|
+
softDelete(): Promise<void>;
|
|
53
|
+
getPreview(maxLength?: number): string;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=ChatMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessage.d.ts","sourceRoot":"","sources":["../../src/models/ChatMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB;;;;;;;GAOG;AACH,qBAOa,WAAY,SAAQ,UAAU;IAEzC,QAAQ,EAAE,MAAM,CAAM;IAGtB,MAAM,EAAE,MAAM,CAAM;IAEpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE/B,eAAe,EAAE,MAAM,CAAM;IAE7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGrC,OAAO,EAAE,MAAM,CAAM;IAErB,WAAW,EAAE,eAAe,CAAU;IAEtC,IAAI,EAAE,eAAe,CAAU;IAG/B,QAAQ,EAAE,OAAO,CAAS;IAE1B,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE7B,SAAS,E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
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
+
import { ChatParticipantOptions, ChatParticipantRole, ChatParticipantStatus, OnlineStatus } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Room membership row. Internal model — membership must be established and
|
|
5
|
+
* mutated only through the membership/owner-checked {@link ChatService}
|
|
6
|
+
* (S5 #1392). The generated CRUD surface is read-only (`get`/`list`);
|
|
7
|
+
* `create`/`update`/`delete` are NOT generated, otherwise an authenticated
|
|
8
|
+
* caller could POST a ChatParticipant to forge their own membership of any room
|
|
9
|
+
* (privilege escalation) and bypass every downstream membership check.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ChatParticipant extends SmrtObject {
|
|
12
|
+
tenantId: string;
|
|
13
|
+
roomId: string;
|
|
14
|
+
profileId: string;
|
|
15
|
+
role: ChatParticipantRole;
|
|
16
|
+
status: ChatParticipantStatus;
|
|
17
|
+
onlineStatus: OnlineStatus;
|
|
18
|
+
lastReadMessageId: string | null;
|
|
19
|
+
lastSeenAt: Date | null;
|
|
20
|
+
joinedAt: Date | null;
|
|
21
|
+
nickname: string;
|
|
22
|
+
isMuted: boolean;
|
|
23
|
+
isPinned: boolean;
|
|
24
|
+
constructor(options?: ChatParticipantOptions);
|
|
25
|
+
isActive(): boolean;
|
|
26
|
+
isOwner(): boolean;
|
|
27
|
+
isAdmin(): boolean;
|
|
28
|
+
markRead(messageId: string): Promise<void>;
|
|
29
|
+
leave(): Promise<void>;
|
|
30
|
+
setOnline(status: OnlineStatus): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ChatParticipant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatParticipant.d.ts","sourceRoot":"","sources":["../../src/models/ChatParticipant.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACb,MAAM,aAAa,CAAC;AAErB;;;;;;;GAOG;AACH,qBAOa,eAAgB,SAAQ,UAAU;IAE7C,QAAQ,EAAE,MAAM,CAAM;IAGtB,MAAM,EAAE,MAAM,CAAM;IAEpB,SAAS,EAAE,MAAM,CAAM;IAEvB,IAAI,EAAE,mBAAmB,CAAY;IAErC,MAAM,EAAE,qBAAqB,CAAY;IAEzC,YAAY,EAAE,YAAY,CAAa;IAEvC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAExC,UAAU,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE/B,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE7B,QAAQ,EAAE,MAAM,CAAM;IAEtB,OAAO,EAAE,OAAO,CAAS;IAEzB,QAAQ,EAAE,OAAO,CAAS;gBAEd,OAAO,GAAE,sBAA2B;IAkBhD,QAAQ,IAAI,OAAO;IAInB,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,OAAO;IAIZ,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAKrD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
+
import { ChatReactionOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Message reaction. Internal model — reactions must be added/removed only
|
|
5
|
+
* through the membership-checked {@link ChatService} (S5 #1392). The generated
|
|
6
|
+
* CRUD surface is read-only (`list`); `create`/`update`/`delete` are NOT
|
|
7
|
+
* generated, otherwise a caller could POST a reaction (forging a `profileId`)
|
|
8
|
+
* onto a message in a room they do not belong to, or DELETE another member's
|
|
9
|
+
* reaction, via the raw collection routes — bypassing the room-membership
|
|
10
|
+
* authorization in {@link ChatService.addReaction}/{@link ChatService.removeReaction}.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ChatReaction extends SmrtObject {
|
|
13
|
+
tenantId: string;
|
|
14
|
+
messageId: string;
|
|
15
|
+
profileId: string;
|
|
16
|
+
emoji: string;
|
|
17
|
+
constructor(options?: ChatReactionOptions);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ChatReaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatReaction.d.ts","sourceRoot":"","sources":["../../src/models/ChatReaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;;;;;GAQG;AACH,qBAOa,YAAa,SAAQ,UAAU;IAE1C,QAAQ,EAAE,MAAM,CAAM;IAGtB,SAAS,EAAE,MAAM,CAAM;IAEvB,SAAS,EAAE,MAAM,CAAM;IAEvB,KAAK,EAAE,MAAM,CAAM;gBAEP,OAAO,GAAE,mBAAwB;CAO9C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
+
import { ChatRoomOptions, ChatRoomStatus, ChatRoomType } from '../types.js';
|
|
3
|
+
type ChatRoomMetadata = Record<string, unknown>;
|
|
4
|
+
/**
|
|
5
|
+
* Chat room supporting public channels, private groups, DMs, and agent conversations.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Room types: `public`, `private`, `dm`, `agent`. Agent rooms are auto-created by
|
|
9
|
+
* {@link ChatService.createAgentSession} with `maxParticipants: 2`. DM rooms are
|
|
10
|
+
* found-or-created via {@link ChatService.getOrCreateDM}. Threads are tracked via
|
|
11
|
+
* {@link ChatThread} linked by `roomId`. Tenant-scoped (required).
|
|
12
|
+
*
|
|
13
|
+
* Internal model — room creation and mutation must go through the
|
|
14
|
+
* membership/owner-checked {@link ChatService} (S5 #1392). The generated CRUD
|
|
15
|
+
* surface is read-only (`get`/`list`); `create`/`update`/`delete` are NOT
|
|
16
|
+
* generated, so a caller cannot forge a room or mutate room state via the raw
|
|
17
|
+
* collection routes, skipping the ChatService authorization paths.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ChatRoom extends SmrtObject {
|
|
20
|
+
tenantId: string;
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
roomType: ChatRoomType;
|
|
24
|
+
status: ChatRoomStatus;
|
|
25
|
+
topic: string;
|
|
26
|
+
avatarUrl: string;
|
|
27
|
+
isArchived: boolean;
|
|
28
|
+
maxParticipants: number;
|
|
29
|
+
metadata: string;
|
|
30
|
+
createdByProfileId: string;
|
|
31
|
+
lastMessageAt: Date | null;
|
|
32
|
+
constructor(options?: ChatRoomOptions);
|
|
33
|
+
getMetadata(): ChatRoomMetadata;
|
|
34
|
+
setMetadata(data: ChatRoomMetadata): void;
|
|
35
|
+
updateMetadata(updates: ChatRoomMetadata): void;
|
|
36
|
+
isDM(): boolean;
|
|
37
|
+
isAgentRoom(): boolean;
|
|
38
|
+
isPublic(): boolean;
|
|
39
|
+
isActive(): boolean;
|
|
40
|
+
archive(): Promise<void>;
|
|
41
|
+
unarchive(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=ChatRoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatRoom.d.ts","sourceRoot":"","sources":["../../src/models/ChatRoom.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,KAAK,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,qBAOa,QAAS,SAAQ,UAAU;IAEtC,QAAQ,EAAE,MAAM,CAAM;IAGtB,IAAI,EAAE,MAAM,CAAM;IAElB,WAAW,EAAE,MAAM,CAAM;IAEzB,QAAQ,EAAE,YAAY,CAAY;IAElC,MAAM,EAAE,cAAc,CAAY;IAElC,KAAK,EAAE,MAAM,CAAM;IAEnB,SAAS,EAAE,MAAM,CAAM;IAEvB,UAAU,EAAE,OAAO,CAAS;IAE5B,eAAe,EAAE,MAAM,CAAK;IAE5B,QAAQ,EAAE,MAAM,CAAQ;IAExB,kBAAkB,EAAE,MAAM,CAAM;IAEhC,aAAa,EAAE,IAAI,GAAG,IAAI,CAAQ;gBAEtB,OAAO,GAAE,eAAoB;IAwBzC,WAAW,IAAI,gBAAgB;IAQ/B,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAIzC,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAK/C,IAAI,IAAI,OAAO;IAIf,WAAW,IAAI,OAAO;IAItB,QAAQ,IAAI,OAAO;IAInB,QAAQ,IAAI,OAAO;IAIb,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAKjC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
2
|
+
import { ChatThreadOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Conversation thread. Internal model — threads must be created/mutated only
|
|
5
|
+
* through the membership-checked {@link ChatService} (S5 #1392). The generated
|
|
6
|
+
* CRUD surface is read-only (`get`/`list`); `create`/`update`/`delete` are NOT
|
|
7
|
+
* generated, otherwise a caller could POST a thread rooted in an arbitrary room
|
|
8
|
+
* (or mutate `messageCount`/`isResolved`) via the raw collection routes,
|
|
9
|
+
* bypassing the room-membership authorization in {@link ChatService.startThread}.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ChatThread extends SmrtObject {
|
|
12
|
+
tenantId: string;
|
|
13
|
+
roomId: string;
|
|
14
|
+
rootMessageId: string | null;
|
|
15
|
+
title: string;
|
|
16
|
+
isResolved: boolean;
|
|
17
|
+
messageCount: number;
|
|
18
|
+
lastMessageAt: Date | null;
|
|
19
|
+
participantCount: number;
|
|
20
|
+
constructor(options?: ChatThreadOptions);
|
|
21
|
+
resolve(): Promise<void>;
|
|
22
|
+
reopen(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ChatThread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatThread.d.ts","sourceRoot":"","sources":["../../src/models/ChatThread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;GAOG;AACH,qBAOa,UAAW,SAAQ,UAAU;IAExC,QAAQ,EAAE,MAAM,CAAM;IAGtB,MAAM,EAAE,MAAM,CAAM;IAMpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEpC,KAAK,EAAE,MAAM,CAAM;IAEnB,UAAU,EAAE,OAAO,CAAS;IAE5B,YAAY,EAAE,MAAM,CAAK;IAEzB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAQ;IAElC,gBAAgB,EAAE,MAAM,CAAK;gBAEjB,OAAO,GAAE,iBAAsB;IAgBrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAI9B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AgentSession } from './AgentSession.js';
|
|
2
|
+
export { ChatMessage } from './ChatMessage.js';
|
|
3
|
+
export { ChatParticipant } from './ChatParticipant.js';
|
|
4
|
+
export { ChatReaction } from './ChatReaction.js';
|
|
5
|
+
export { ChatRoom } from './ChatRoom.js';
|
|
6
|
+
export { ChatThread } from './ChatThread.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { CHAT_MODULE_META } from "./ui.js";
|
|
2
|
+
const noop = () => {
|
|
3
|
+
};
|
|
4
|
+
const sampleRooms = [
|
|
5
|
+
{
|
|
6
|
+
id: "room-editorial",
|
|
7
|
+
name: "Editorial Ops",
|
|
8
|
+
description: "Daily coordination room",
|
|
9
|
+
roomType: "public",
|
|
10
|
+
topic: "Launch readiness and governance",
|
|
11
|
+
participantCount: 8,
|
|
12
|
+
unreadCount: 4,
|
|
13
|
+
lastMessageAt: "2026-03-21T16:08:00.000Z",
|
|
14
|
+
lastMessage: {
|
|
15
|
+
id: "room-editorial-last",
|
|
16
|
+
roomId: "room-editorial",
|
|
17
|
+
senderProfileId: "profile-taylor",
|
|
18
|
+
senderName: "Taylor Rowan",
|
|
19
|
+
content: "Content QA is clear for tonight’s rollout.",
|
|
20
|
+
messageType: "text",
|
|
21
|
+
role: "user",
|
|
22
|
+
isEdited: false,
|
|
23
|
+
isDeleted: false,
|
|
24
|
+
reactions: [],
|
|
25
|
+
attachments: [],
|
|
26
|
+
createdAt: "2026-03-21T16:08:00.000Z"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "room-governance",
|
|
31
|
+
name: "Governance",
|
|
32
|
+
description: "Policy review",
|
|
33
|
+
roomType: "agent",
|
|
34
|
+
topic: "Publication profile monitoring",
|
|
35
|
+
participantCount: 3,
|
|
36
|
+
unreadCount: 1,
|
|
37
|
+
isPinned: true,
|
|
38
|
+
lastMessageAt: "2026-03-21T15:55:00.000Z"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "room-jordan",
|
|
42
|
+
name: "Jordan Lee",
|
|
43
|
+
description: "Direct message",
|
|
44
|
+
roomType: "dm",
|
|
45
|
+
topic: "",
|
|
46
|
+
participantCount: 2,
|
|
47
|
+
unreadCount: 0,
|
|
48
|
+
lastMessageAt: "2026-03-21T14:12:00.000Z"
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
const sampleMessages = [
|
|
52
|
+
{
|
|
53
|
+
id: "chat-message-1",
|
|
54
|
+
roomId: "room-editorial",
|
|
55
|
+
senderProfileId: "profile-taylor",
|
|
56
|
+
senderName: "Taylor Rowan",
|
|
57
|
+
content: "The root playground is showing the content previews correctly now.",
|
|
58
|
+
messageType: "text",
|
|
59
|
+
role: "user",
|
|
60
|
+
isEdited: false,
|
|
61
|
+
isDeleted: false,
|
|
62
|
+
replyTo: null,
|
|
63
|
+
reactions: [
|
|
64
|
+
{
|
|
65
|
+
emoji: "✅",
|
|
66
|
+
count: 2,
|
|
67
|
+
reacted: true,
|
|
68
|
+
profileIds: ["profile-taylor", "profile-jordan"]
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
attachments: [],
|
|
72
|
+
createdAt: "2026-03-21T15:52:00.000Z"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "chat-message-2",
|
|
76
|
+
roomId: "room-editorial",
|
|
77
|
+
senderProfileId: "profile-jordan",
|
|
78
|
+
senderName: "Jordan Lee",
|
|
79
|
+
content: "Next up is broadening the package rollout from the content reference implementation.",
|
|
80
|
+
messageType: "text",
|
|
81
|
+
role: "user",
|
|
82
|
+
isEdited: false,
|
|
83
|
+
isDeleted: false,
|
|
84
|
+
replyTo: {
|
|
85
|
+
id: "chat-message-1",
|
|
86
|
+
senderName: "Taylor Rowan",
|
|
87
|
+
content: "The root playground is showing the content previews correctly now."
|
|
88
|
+
},
|
|
89
|
+
reactions: [],
|
|
90
|
+
attachments: [],
|
|
91
|
+
createdAt: "2026-03-21T15:58:00.000Z"
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
const loadMessageInput = () => import("./svelte/components/messages/MessageInput.svelte");
|
|
95
|
+
const loadMessageList = () => import("./svelte/components/messages/MessageList.svelte");
|
|
96
|
+
const loadRoomList = () => import("./svelte/components/layout/RoomList.svelte");
|
|
97
|
+
const playground = {
|
|
98
|
+
packageName: "@happyvertical/smrt-chat",
|
|
99
|
+
displayName: CHAT_MODULE_META.displayName,
|
|
100
|
+
description: CHAT_MODULE_META.description,
|
|
101
|
+
moduleMeta: CHAT_MODULE_META,
|
|
102
|
+
entries: [
|
|
103
|
+
{
|
|
104
|
+
id: "room-list",
|
|
105
|
+
title: "Room List",
|
|
106
|
+
description: "Sidebar navigation for rooms, DMs, and agent conversations with unread state.",
|
|
107
|
+
loadComponent: loadRoomList,
|
|
108
|
+
order: 1,
|
|
109
|
+
props: {
|
|
110
|
+
rooms: sampleRooms,
|
|
111
|
+
currentRoomId: "room-editorial",
|
|
112
|
+
onselectroom: noop,
|
|
113
|
+
oncreateroom: noop
|
|
114
|
+
},
|
|
115
|
+
modes: {
|
|
116
|
+
mock: {
|
|
117
|
+
label: "Mock"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "message-list",
|
|
123
|
+
title: "Message List",
|
|
124
|
+
description: "Grouped chat transcript with replies and reactions for a conversation thread.",
|
|
125
|
+
loadComponent: loadMessageList,
|
|
126
|
+
order: 2,
|
|
127
|
+
props: {
|
|
128
|
+
messages: sampleMessages,
|
|
129
|
+
currentProfileId: "profile-taylor",
|
|
130
|
+
onreply: noop,
|
|
131
|
+
onreact: noop
|
|
132
|
+
},
|
|
133
|
+
modes: {
|
|
134
|
+
mock: {
|
|
135
|
+
label: "Mock"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "message-input",
|
|
141
|
+
title: "Message Input",
|
|
142
|
+
description: "Chat composer with reply context and keyboard send affordance.",
|
|
143
|
+
loadComponent: loadMessageInput,
|
|
144
|
+
order: 3,
|
|
145
|
+
props: {
|
|
146
|
+
onsend: noop,
|
|
147
|
+
placeholder: "Reply to the rollout thread…",
|
|
148
|
+
replyTo: {
|
|
149
|
+
id: "chat-message-1",
|
|
150
|
+
senderName: "Taylor Rowan",
|
|
151
|
+
content: "The root playground is showing the content previews correctly now."
|
|
152
|
+
},
|
|
153
|
+
oncancelreply: noop
|
|
154
|
+
},
|
|
155
|
+
modes: {
|
|
156
|
+
mock: {
|
|
157
|
+
label: "Mock"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
export {
|
|
164
|
+
playground as default
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=playground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.js","sources":["../src/svelte/playground.ts"],"sourcesContent":["import { CHAT_MODULE_META } from '../ui.js';\n\nconst noop = () => {};\n\nconst sampleRooms = [\n {\n id: 'room-editorial',\n name: 'Editorial Ops',\n description: 'Daily coordination room',\n roomType: 'public',\n topic: 'Launch readiness and governance',\n participantCount: 8,\n unreadCount: 4,\n lastMessageAt: '2026-03-21T16:08:00.000Z',\n lastMessage: {\n id: 'room-editorial-last',\n roomId: 'room-editorial',\n senderProfileId: 'profile-taylor',\n senderName: 'Taylor Rowan',\n content: 'Content QA is clear for tonight’s rollout.',\n messageType: 'text',\n role: 'user',\n isEdited: false,\n isDeleted: false,\n reactions: [],\n attachments: [],\n createdAt: '2026-03-21T16:08:00.000Z',\n },\n },\n {\n id: 'room-governance',\n name: 'Governance',\n description: 'Policy review',\n roomType: 'agent',\n topic: 'Publication profile monitoring',\n participantCount: 3,\n unreadCount: 1,\n isPinned: true,\n lastMessageAt: '2026-03-21T15:55:00.000Z',\n },\n {\n id: 'room-jordan',\n name: 'Jordan Lee',\n description: 'Direct message',\n roomType: 'dm',\n topic: '',\n participantCount: 2,\n unreadCount: 0,\n lastMessageAt: '2026-03-21T14:12:00.000Z',\n },\n];\n\nconst sampleMessages = [\n {\n id: 'chat-message-1',\n roomId: 'room-editorial',\n senderProfileId: 'profile-taylor',\n senderName: 'Taylor Rowan',\n content:\n 'The root playground is showing the content previews correctly now.',\n messageType: 'text',\n role: 'user',\n isEdited: false,\n isDeleted: false,\n replyTo: null,\n reactions: [\n {\n emoji: '✅',\n count: 2,\n reacted: true,\n profileIds: ['profile-taylor', 'profile-jordan'],\n },\n ],\n attachments: [],\n createdAt: '2026-03-21T15:52:00.000Z',\n },\n {\n id: 'chat-message-2',\n roomId: 'room-editorial',\n senderProfileId: 'profile-jordan',\n senderName: 'Jordan Lee',\n content:\n 'Next up is broadening the package rollout from the content reference implementation.',\n messageType: 'text',\n role: 'user',\n isEdited: false,\n isDeleted: false,\n replyTo: {\n id: 'chat-message-1',\n senderName: 'Taylor Rowan',\n content:\n 'The root playground is showing the content previews correctly now.',\n },\n reactions: [],\n attachments: [],\n createdAt: '2026-03-21T15:58:00.000Z',\n },\n];\n\nconst loadMessageInput = () =>\n import('./components/messages/MessageInput.svelte');\nconst loadMessageList = () =>\n import('./components/messages/MessageList.svelte');\nconst loadRoomList = () => import('./components/layout/RoomList.svelte');\n\nexport default {\n packageName: '@happyvertical/smrt-chat',\n displayName: CHAT_MODULE_META.displayName,\n description: CHAT_MODULE_META.description,\n moduleMeta: CHAT_MODULE_META,\n entries: [\n {\n id: 'room-list',\n title: 'Room List',\n description:\n 'Sidebar navigation for rooms, DMs, and agent conversations with unread state.',\n loadComponent: loadRoomList,\n order: 1,\n props: {\n rooms: sampleRooms,\n currentRoomId: 'room-editorial',\n onselectroom: noop,\n oncreateroom: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n {\n id: 'message-list',\n title: 'Message List',\n description:\n 'Grouped chat transcript with replies and reactions for a conversation thread.',\n loadComponent: loadMessageList,\n order: 2,\n props: {\n messages: sampleMessages,\n currentProfileId: 'profile-taylor',\n onreply: noop,\n onreact: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n {\n id: 'message-input',\n title: 'Message Input',\n description:\n 'Chat composer with reply context and keyboard send affordance.',\n loadComponent: loadMessageInput,\n order: 3,\n props: {\n onsend: noop,\n placeholder: 'Reply to the rollout thread…',\n replyTo: {\n id: 'chat-message-1',\n senderName: 'Taylor Rowan',\n content:\n 'The root playground is showing the content previews correctly now.',\n },\n oncancelreply: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n ],\n};\n"],"names":[],"mappings":";AAEA,MAAM,OAAO,MAAM;AAAC;AAEpB,MAAM,cAAc;AAAA,EAClB;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,MACX,IAAI;AAAA,MACJ,QAAQ;AAAA,MACR,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM;AAAA,MACN,UAAU;AAAA,MACV,WAAW;AAAA,MACX,WAAW,CAAA;AAAA,MACX,aAAa,CAAA;AAAA,MACb,WAAW;AAAA,IAAA;AAAA,EACb;AAAA,EAEF;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,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