@meistrari/chat-nuxt 1.6.0 → 1.8.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/README.md +25 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +23 -2
- package/dist/runtime/components/MeistrariChatEmbed.vue +8 -1
- package/dist/runtime/components/chat/bash-widget.vue +3 -3
- package/dist/runtime/components/chat/doc-sdk-widget.vue +3 -3
- package/dist/runtime/components/chat/files-view.vue +3 -64
- package/dist/runtime/components/chat/generic-tool-widget.vue +3 -3
- package/dist/runtime/components/chat/grep-widget.vue +3 -3
- package/dist/runtime/components/chat/message-bubble.vue +1 -1
- package/dist/runtime/components/chat/message-input.d.vue.ts +2 -0
- package/dist/runtime/components/chat/message-input.vue +21 -5
- package/dist/runtime/components/chat/message-input.vue.d.ts +2 -0
- package/dist/runtime/components/chat/message-list.vue +1 -1
- package/dist/runtime/components/chat/mobile/files/file-preview.d.vue.ts +11 -0
- package/dist/runtime/components/chat/mobile/files/file-preview.vue +112 -0
- package/dist/runtime/components/chat/mobile/files/file-preview.vue.d.ts +11 -0
- package/dist/runtime/components/chat/mobile/files/files-view.d.vue.ts +10 -0
- package/dist/runtime/components/chat/mobile/files/files-view.vue +384 -0
- package/dist/runtime/components/chat/mobile/files/files-view.vue.d.ts +10 -0
- package/dist/runtime/components/chat/mobile/home/header.d.vue.ts +19 -0
- package/dist/runtime/components/chat/mobile/home/header.vue +55 -0
- package/dist/runtime/components/chat/mobile/home/header.vue.d.ts +19 -0
- package/dist/runtime/components/chat/mobile/home/recents.d.vue.ts +14 -0
- package/dist/runtime/components/chat/mobile/home/recents.vue +48 -0
- package/dist/runtime/components/chat/mobile/home/recents.vue.d.ts +14 -0
- package/dist/runtime/components/chat/mobile/home/suggestions.d.vue.ts +7 -0
- package/dist/runtime/components/chat/mobile/home/suggestions.vue +31 -0
- package/dist/runtime/components/chat/mobile/home/suggestions.vue.d.ts +7 -0
- package/dist/runtime/components/chat/mobile/primitives/bottom-sheet.d.vue.ts +21 -0
- package/dist/runtime/components/chat/mobile/primitives/bottom-sheet.vue +48 -0
- package/dist/runtime/components/chat/mobile/primitives/bottom-sheet.vue.d.ts +21 -0
- package/dist/runtime/components/chat/mobile/primitives/info-bubble.d.vue.ts +6 -0
- package/dist/runtime/components/chat/mobile/primitives/info-bubble.vue +50 -0
- package/dist/runtime/components/chat/mobile/primitives/info-bubble.vue.d.ts +6 -0
- package/dist/runtime/components/chat/mobile/shell/drawer.d.vue.ts +22 -0
- package/dist/runtime/components/chat/mobile/shell/drawer.vue +143 -0
- package/dist/runtime/components/chat/mobile/shell/drawer.vue.d.ts +22 -0
- package/dist/runtime/components/chat/mobile/shell/header.d.vue.ts +40 -0
- package/dist/runtime/components/chat/mobile/shell/header.vue +139 -0
- package/dist/runtime/components/chat/mobile/shell/header.vue.d.ts +40 -0
- package/dist/runtime/components/chat/mobile/shell/outdated-settings-sheet.d.vue.ts +14 -0
- package/dist/runtime/components/chat/mobile/shell/outdated-settings-sheet.vue +47 -0
- package/dist/runtime/components/chat/mobile/shell/outdated-settings-sheet.vue.d.ts +14 -0
- package/dist/runtime/components/chat/mobile/shell/shell.d.vue.ts +122 -0
- package/dist/runtime/components/chat/mobile/shell/shell.vue +283 -0
- package/dist/runtime/components/chat/mobile/shell/shell.vue.d.ts +122 -0
- package/dist/runtime/components/chat/mobile/shell/workspace-sheet.d.vue.ts +19 -0
- package/dist/runtime/components/chat/mobile/shell/workspace-sheet.vue +51 -0
- package/dist/runtime/components/chat/mobile/shell/workspace-sheet.vue.d.ts +19 -0
- package/dist/runtime/components/chat/mobile/usage/usage-view.d.vue.ts +8 -0
- package/dist/runtime/components/chat/mobile/usage/usage-view.vue +243 -0
- package/dist/runtime/components/chat/mobile/usage/usage-view.vue.d.ts +8 -0
- package/dist/runtime/components/chat/model-selector.vue +6 -0
- package/dist/runtime/components/chat/read-widget.vue +3 -3
- package/dist/runtime/components/chat/reasoning-step-item.vue +1 -1
- package/dist/runtime/components/chat/reasoning-steps.vue +1 -1
- package/dist/runtime/components/chat/reasoning-thought.vue +2 -3
- package/dist/runtime/components/chat/tela-skill-widget.vue +3 -3
- package/dist/runtime/components/chat/thinking-widget.vue +3 -3
- package/dist/runtime/components/chat/usage-view.vue +20 -101
- package/dist/runtime/components/chat/web-search-widget.vue +3 -3
- package/dist/runtime/components/chat/workstation-query-widget.vue +6 -6
- package/dist/runtime/components/chat/write-widget.vue +3 -3
- package/dist/runtime/composables/useChat.js +2 -1
- package/dist/runtime/composables/useChatApi.js +4 -0
- package/dist/runtime/composables/useConversationFileDownloads.d.ts +6 -0
- package/dist/runtime/composables/useConversationFileDownloads.js +50 -0
- package/dist/runtime/composables/useConversationUsage.d.ts +13 -0
- package/dist/runtime/composables/useConversationUsage.js +121 -0
- package/dist/runtime/composables/useConversations.js +3 -1
- package/dist/runtime/composables/useEmbedConfig.d.ts +4 -0
- package/dist/runtime/composables/useEmbedConfig.js +9 -0
- package/dist/runtime/composables/useMentionAutocomplete.d.ts +6 -0
- package/dist/runtime/composables/useMentionAutocomplete.js +71 -23
- package/dist/runtime/composables/useWorkspaceSwitchModal.d.ts +5 -0
- package/dist/runtime/composables/useWorkspaceSwitchModal.js +14 -0
- package/dist/runtime/embed/components/ChatConfigurationModal.vue +119 -13
- package/dist/runtime/embed/components/ChatEmbed.vue +9 -2
- package/dist/runtime/embed/components/ChatEmbedInner.d.vue.ts +2 -0
- package/dist/runtime/embed/components/ChatEmbedInner.vue +201 -11
- package/dist/runtime/embed/components/ChatEmbedInner.vue.d.ts +2 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationMobileShell.d.vue.ts +34 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationMobileShell.vue +95 -0
- package/dist/runtime/embed/components/configuration/ChatConfigurationMobileShell.vue.d.ts +34 -0
- package/dist/runtime/server/api/conversations/[id]/duplicate.post.js +1 -0
- package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.js +3 -1
- package/dist/runtime/server/api/conversations/[id]/messages/index.get.js +29 -5
- package/dist/runtime/server/api/conversations/index.post.js +1 -0
- package/dist/runtime/server/db/schema/conversations.d.ts +17 -0
- package/dist/runtime/server/db/schema/conversations.js +1 -0
- package/dist/runtime/server/utils/chat-context.d.ts +2 -0
- package/dist/runtime/server/utils/chat-context.js +15 -1
- package/dist/runtime/server/utils/conversation-message-sync.d.ts +8 -2
- package/dist/runtime/server/utils/conversation-message-sync.js +52 -6
- package/dist/runtime/server/utils/conversation-scope.js +2 -1
- package/dist/runtime/types/chat-auth.d.ts +9 -8
- package/dist/runtime/types/embed.d.ts +21 -0
- package/dist/runtime/utils/breakpoints.d.ts +1 -0
- package/dist/runtime/utils/breakpoints.js +1 -0
- package/dist/runtime/utils/tela-chat.d.ts +3 -1
- package/dist/runtime/utils/tela-chat.js +11 -2
- package/drizzle/0015_illegal_blindfold.sql +1 -0
- package/drizzle/meta/0015_snapshot.json +738 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +6 -1
|
@@ -6,9 +6,11 @@ export type ChatContext = {
|
|
|
6
6
|
};
|
|
7
7
|
export type ChatRuntimeContext = ChatContext & {
|
|
8
8
|
telaAgentId: string | null;
|
|
9
|
+
conversationScope: string | null;
|
|
9
10
|
};
|
|
10
11
|
export declare function resolveRequestedWorkspaceId(requestedWorkspaceId: string | null | undefined): string | null;
|
|
11
12
|
export declare function resolveRequestedTelaAgentId(requestedTelaAgentId: string | null | undefined): string | null;
|
|
13
|
+
export declare function resolveRequestedConversationScope(requestedConversationScope: string | null | undefined): string | null;
|
|
12
14
|
export declare function resolveChatContextFromSession(session: AppSession, requestedWorkspaceId?: string | null): ChatContext;
|
|
13
15
|
export declare function resolveChatContext(event: H3Event): ChatContext;
|
|
14
16
|
export declare function resolveChatRuntimeContext(event: H3Event): ChatRuntimeContext;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createError, getHeader } from "h3";
|
|
2
2
|
import { requireUser } from "#chat-runtime/server/utils/auth";
|
|
3
3
|
const TELA_AGENT_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
|
|
4
|
+
const CONVERSATION_SCOPE_PATTERN = /^[A-Za-z0-9._:/-]{1,200}$/;
|
|
4
5
|
export function resolveRequestedWorkspaceId(requestedWorkspaceId) {
|
|
5
6
|
const normalized = requestedWorkspaceId?.trim();
|
|
6
7
|
return normalized || null;
|
|
@@ -17,6 +18,18 @@ export function resolveRequestedTelaAgentId(requestedTelaAgentId) {
|
|
|
17
18
|
}
|
|
18
19
|
return normalized;
|
|
19
20
|
}
|
|
21
|
+
export function resolveRequestedConversationScope(requestedConversationScope) {
|
|
22
|
+
const normalized = requestedConversationScope?.trim();
|
|
23
|
+
if (!normalized)
|
|
24
|
+
return null;
|
|
25
|
+
if (!CONVERSATION_SCOPE_PATTERN.test(normalized)) {
|
|
26
|
+
throw createError({
|
|
27
|
+
statusCode: 400,
|
|
28
|
+
statusMessage: "Invalid conversation scope"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return normalized;
|
|
32
|
+
}
|
|
20
33
|
export function resolveChatContextFromSession(session, requestedWorkspaceId) {
|
|
21
34
|
const normalizedRequestedWorkspaceId = resolveRequestedWorkspaceId(requestedWorkspaceId);
|
|
22
35
|
if (normalizedRequestedWorkspaceId && normalizedRequestedWorkspaceId !== session.workspace.id) {
|
|
@@ -39,6 +52,7 @@ export function resolveChatRuntimeContext(event) {
|
|
|
39
52
|
const context = resolveChatContext(event);
|
|
40
53
|
return {
|
|
41
54
|
...context,
|
|
42
|
-
telaAgentId: resolveRequestedTelaAgentId(getHeader(event, "x-chat-tela-agent-id"))
|
|
55
|
+
telaAgentId: resolveRequestedTelaAgentId(getHeader(event, "x-chat-tela-agent-id")),
|
|
56
|
+
conversationScope: resolveRequestedConversationScope(getHeader(event, "x-chat-conversation-scope"))
|
|
43
57
|
};
|
|
44
58
|
}
|
|
@@ -17,9 +17,15 @@ type MessageUpdateResponse = {
|
|
|
17
17
|
messages: Message[];
|
|
18
18
|
newFiles?: MessageFile[];
|
|
19
19
|
};
|
|
20
|
+
export declare const PENDING_RESPONSE_GRACE_MS = 30000;
|
|
21
|
+
export declare const THREAD_SESSION_START_ERROR = "Erro: N\u00E3o foi poss\u00EDvel iniciar a sess\u00E3o de resposta. Tente enviar a mensagem novamente.";
|
|
22
|
+
export declare const SESSION_STATUS_CHECK_ERROR = "Erro: N\u00E3o foi poss\u00EDvel verificar o andamento da resposta. Tente enviar a mensagem novamente.";
|
|
23
|
+
export declare function hasPendingMessageExceededGraceWindow(pendingMessage: Pick<Message, 'createdAt'>, now?: Date): boolean;
|
|
24
|
+
export declare function buildFailedPendingMessageUpdate(content: string, now?: Date): MessageUpdate;
|
|
20
25
|
export declare function mapAgentApiSessionToMessageUpdate(agentSession: AgentApiSession, options: {
|
|
21
|
-
pendingMessage: Pick<Message, 'ttft' | 'createdAt'>;
|
|
22
|
-
lastAssistantMessage?: Pick<Message, 'externalUuid'> | null;
|
|
26
|
+
pendingMessage: Pick<Message, 'ttft' | 'createdAt' | 'updatedAt'>;
|
|
27
|
+
lastAssistantMessage?: Pick<Message, 'externalUuid' | 'content'> | null;
|
|
28
|
+
lastSyncedMessage?: Pick<Message, 'externalUuid'> | null;
|
|
23
29
|
userMessage?: Pick<Message, 'createdAt'> | null;
|
|
24
30
|
now?: Date;
|
|
25
31
|
}): MessageUpdate;
|
|
@@ -1,19 +1,53 @@
|
|
|
1
1
|
import { schema } from "#chat-runtime/server/db";
|
|
2
|
-
import { extractContentFromSession } from "#chat-runtime/server/utils/agent-api";
|
|
2
|
+
import { extractContentFromReasoning, extractContentFromSession } from "#chat-runtime/server/utils/agent-api";
|
|
3
3
|
import { logger } from "#chat-runtime/server/utils/logger";
|
|
4
|
+
const STALE_TERMINAL_CONTENT_GRACE_MS = 5e3;
|
|
5
|
+
const STALE_TERMINAL_CONTENT_ERROR = "Erro: O servi\xE7o retornou uma resposta final inconsistente. Tente enviar a mensagem novamente.";
|
|
6
|
+
export const PENDING_RESPONSE_GRACE_MS = 3e4;
|
|
7
|
+
export const THREAD_SESSION_START_ERROR = "Erro: N\xE3o foi poss\xEDvel iniciar a sess\xE3o de resposta. Tente enviar a mensagem novamente.";
|
|
8
|
+
export const SESSION_STATUS_CHECK_ERROR = "Erro: N\xE3o foi poss\xEDvel verificar o andamento da resposta. Tente enviar a mensagem novamente.";
|
|
9
|
+
const NO_RESULT_ERROR = "Erro: O servi\xE7o terminou sem retornar uma resposta. Tente enviar a mensagem novamente.";
|
|
4
10
|
function toMilliseconds(timestamp) {
|
|
5
11
|
if (typeof timestamp !== "number" || !Number.isFinite(timestamp))
|
|
6
12
|
return null;
|
|
7
13
|
return timestamp < 1e10 ? timestamp * 1e3 : timestamp;
|
|
8
14
|
}
|
|
15
|
+
function resolveTerminalContentForPendingMessage(agentSession, newReasoning, lastAssistantMessage) {
|
|
16
|
+
const sessionContent = extractContentFromSession(agentSession);
|
|
17
|
+
if (!newReasoning?.length)
|
|
18
|
+
return sessionContent === lastAssistantMessage?.content ? null : sessionContent;
|
|
19
|
+
const reasoningContent = extractContentFromReasoning(newReasoning);
|
|
20
|
+
const hasSessionResultContent = typeof agentSession.result?.content === "string";
|
|
21
|
+
if (hasSessionResultContent && reasoningContent && sessionContent !== reasoningContent)
|
|
22
|
+
return null;
|
|
23
|
+
if (hasSessionResultContent && !reasoningContent && sessionContent === lastAssistantMessage?.content)
|
|
24
|
+
return null;
|
|
25
|
+
return sessionContent || reasoningContent;
|
|
26
|
+
}
|
|
27
|
+
export function hasPendingMessageExceededGraceWindow(pendingMessage, now = /* @__PURE__ */ new Date()) {
|
|
28
|
+
return now.getTime() - pendingMessage.createdAt.getTime() >= PENDING_RESPONSE_GRACE_MS;
|
|
29
|
+
}
|
|
30
|
+
export function buildFailedPendingMessageUpdate(content, now = /* @__PURE__ */ new Date()) {
|
|
31
|
+
return {
|
|
32
|
+
content,
|
|
33
|
+
status: "failed",
|
|
34
|
+
updatedAt: now
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function resolveFailedSessionContent(error) {
|
|
38
|
+
if (error === "no_result")
|
|
39
|
+
return NO_RESULT_ERROR;
|
|
40
|
+
return `Error: ${error || "Agent execution failed"}`;
|
|
41
|
+
}
|
|
9
42
|
export function mapAgentApiSessionToMessageUpdate(agentSession, options) {
|
|
10
43
|
const updateData = {};
|
|
11
|
-
const
|
|
44
|
+
const lastSyncedMessage = options.lastSyncedMessage ?? options.lastAssistantMessage;
|
|
45
|
+
const lastSyncedUuid = lastSyncedMessage?.externalUuid;
|
|
12
46
|
const lastSyncedIndex = lastSyncedUuid ? agentSession.reasoning?.findIndex((item) => item.uuid === lastSyncedUuid) ?? -1 : -1;
|
|
13
47
|
const newReasoning = agentSession.reasoning?.slice(lastSyncedIndex + 1);
|
|
14
48
|
const hasNewReasoning = newReasoning && newReasoning.length > 0;
|
|
15
49
|
const sessionUpdatedAtMs = toMilliseconds(agentSession.updatedAt);
|
|
16
|
-
const terminalSessionBelongsToPendingMessage = hasNewReasoning ||
|
|
50
|
+
const terminalSessionBelongsToPendingMessage = hasNewReasoning || !!options.pendingMessage.updatedAt || !lastSyncedMessage || sessionUpdatedAtMs !== null && sessionUpdatedAtMs >= options.pendingMessage.createdAt.getTime();
|
|
17
51
|
if (hasNewReasoning) {
|
|
18
52
|
updateData.reasoningData = newReasoning;
|
|
19
53
|
const lastReasoningItem = newReasoning.at(-1);
|
|
@@ -27,13 +61,25 @@ export function mapAgentApiSessionToMessageUpdate(agentSession, options) {
|
|
|
27
61
|
}
|
|
28
62
|
if (agentSession.status === "completed" || agentSession.status === "waiting_messages") {
|
|
29
63
|
if (terminalSessionBelongsToPendingMessage) {
|
|
30
|
-
|
|
64
|
+
const content = resolveTerminalContentForPendingMessage(agentSession, newReasoning, options.lastAssistantMessage);
|
|
65
|
+
if (content === null) {
|
|
66
|
+
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
67
|
+
const staleSince = options.pendingMessage.updatedAt;
|
|
68
|
+
if (staleSince && now.getTime() - staleSince.getTime() >= STALE_TERMINAL_CONTENT_GRACE_MS) {
|
|
69
|
+
updateData.content = STALE_TERMINAL_CONTENT_ERROR;
|
|
70
|
+
updateData.status = "failed";
|
|
71
|
+
updateData.updatedAt = now;
|
|
72
|
+
} else if (!staleSince) {
|
|
73
|
+
updateData.updatedAt = now;
|
|
74
|
+
}
|
|
75
|
+
return updateData;
|
|
76
|
+
}
|
|
77
|
+
updateData.content = content;
|
|
31
78
|
updateData.status = "completed";
|
|
32
79
|
updateData.updatedAt = options.now ?? /* @__PURE__ */ new Date();
|
|
33
80
|
}
|
|
34
81
|
} else if (agentSession.status === "failed") {
|
|
35
|
-
|
|
36
|
-
updateData.content = `Error: ${errorContent}`;
|
|
82
|
+
updateData.content = resolveFailedSessionContent(agentSession.error);
|
|
37
83
|
updateData.status = "failed";
|
|
38
84
|
updateData.updatedAt = options.now ?? /* @__PURE__ */ new Date();
|
|
39
85
|
}
|
|
@@ -3,7 +3,8 @@ import { schema } from "#chat-runtime/server/db";
|
|
|
3
3
|
export function conversationScopeConditions(context, conversationId) {
|
|
4
4
|
const conditions = [
|
|
5
5
|
eq(schema.conversations.workspaceId, context.workspaceId),
|
|
6
|
-
context.telaAgentId ? eq(schema.conversations.telaAgentId, context.telaAgentId) : isNull(schema.conversations.telaAgentId)
|
|
6
|
+
context.telaAgentId ? eq(schema.conversations.telaAgentId, context.telaAgentId) : isNull(schema.conversations.telaAgentId),
|
|
7
|
+
context.conversationScope ? eq(schema.conversations.conversationScope, context.conversationScope) : isNull(schema.conversations.conversationScope)
|
|
7
8
|
];
|
|
8
9
|
if (conversationId) {
|
|
9
10
|
conditions.unshift(eq(schema.conversations.id, conversationId));
|
|
@@ -21,15 +21,16 @@ type ChatAuthMember = {
|
|
|
21
21
|
|
|
22
22
|
type ChatAuthOrganization = {
|
|
23
23
|
id: string
|
|
24
|
+
name?: string
|
|
25
|
+
logo?: string | null
|
|
24
26
|
members?: ChatAuthMember[]
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
29
|
+
export function useChatAuth(): {
|
|
30
|
+
user: Ref<ChatAuthUser | null>
|
|
31
|
+
activeOrganization: Ref<ChatAuthOrganization | null>
|
|
32
|
+
logout: () => Promise<void>
|
|
33
|
+
getToken: () => Promise<string | null | undefined>
|
|
34
|
+
getAvailableOrganizations: () => Promise<ChatAuthOrganization[]>
|
|
35
|
+
switchOrganization: (organizationId: string) => Promise<void>
|
|
35
36
|
}
|
|
@@ -4,26 +4,47 @@ import type { TelaAgentExecutionInput } from './tela-agent.js';
|
|
|
4
4
|
import type { ChatLoadingMessageMode } from '../utils/chat-loading-messages.js';
|
|
5
5
|
import type { ChatActor, ChatFeatureConfig } from '../utils/tela-chat.js';
|
|
6
6
|
export type ChatEmbedSharedProps = {
|
|
7
|
+
/** Controlled conversation id. Use with `v-model:conversation-id` when the host owns active conversation state. */
|
|
7
8
|
conversationId?: string | null;
|
|
9
|
+
/** Conversation id to open once on mount when `conversationId` is uncontrolled. */
|
|
8
10
|
initialConversationId?: string | null;
|
|
11
|
+
/** Technical scope that isolates conversation history within the current workspace and runtime. */
|
|
12
|
+
conversationScope?: string | null;
|
|
13
|
+
/** Hide the conversation list and render only the active chat surface. */
|
|
9
14
|
hideSidebar?: boolean;
|
|
15
|
+
/** Hide workspace settings actions while keeping the chat header and content unchanged. */
|
|
16
|
+
hideSettings?: boolean;
|
|
17
|
+
/** Custom pending-response messages shown while the assistant is working. */
|
|
10
18
|
loadingMessages?: readonly string[] | null;
|
|
19
|
+
/** How custom loading messages rotate. Defaults to ordered behavior when omitted. */
|
|
11
20
|
loadingMessagesMode?: ChatLoadingMessageMode | null;
|
|
21
|
+
/** Custom markdown component renderers keyed by markdown node or tag name. */
|
|
12
22
|
customComponents?: Record<string, Component>;
|
|
23
|
+
/** Extra HTML tags allowed by the markdown renderer. */
|
|
13
24
|
customHtmlTags?: readonly string[];
|
|
14
25
|
};
|
|
15
26
|
export type DefaultChatEmbedProps = ChatEmbedSharedProps & {
|
|
27
|
+
/** Omitted in default chat mode. Set this to switch to Tela agent mode. */
|
|
16
28
|
telaAgentId?: undefined;
|
|
29
|
+
/** Tela agent inputs are only accepted in Tela agent mode. */
|
|
17
30
|
telaAgentInputs?: undefined;
|
|
31
|
+
/** Optional host-provided workspace settings. When omitted, chat-nuxt loads workspace settings itself. */
|
|
18
32
|
workspaceSettings?: DeepReadonly<WorkspaceSettings> | WorkspaceSettings | null;
|
|
33
|
+
/** Optional display identity for messages created by the current user. */
|
|
19
34
|
user?: ChatActor | null;
|
|
35
|
+
/** Optional UI feature toggles for the default chat runtime. */
|
|
20
36
|
features?: Partial<ChatFeatureConfig>;
|
|
21
37
|
};
|
|
22
38
|
export type TelaAgentChatEmbedProps = ChatEmbedSharedProps & {
|
|
39
|
+
/** Tela agent id that switches the embed into Tela agent runtime mode. */
|
|
23
40
|
telaAgentId: string;
|
|
41
|
+
/** Inputs sent with each Tela agent run. Non-null values hide the variables panel. */
|
|
24
42
|
telaAgentInputs?: DeepReadonly<TelaAgentExecutionInput[]> | null;
|
|
43
|
+
/** Not accepted in Tela agent mode because the Tela agent owns runtime settings. */
|
|
25
44
|
workspaceSettings?: never;
|
|
45
|
+
/** Not accepted in Tela agent mode because execution identity comes from the Tela agent runtime. */
|
|
26
46
|
user?: never;
|
|
47
|
+
/** Optional UI feature toggles that are still supported in Tela agent mode. */
|
|
27
48
|
features?: Partial<ChatFeatureConfig>;
|
|
28
49
|
};
|
|
29
50
|
export type MeistrariChatEmbedProps = DefaultChatEmbedProps | TelaAgentChatEmbedProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CHAT_MOBILE_BREAKPOINT = 481;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CHAT_MOBILE_BREAKPOINT = 481;
|
|
@@ -17,7 +17,9 @@ export type ChatActor = {
|
|
|
17
17
|
};
|
|
18
18
|
export declare function normalizeConversationId(value: string | null | undefined): string | null;
|
|
19
19
|
export declare function normalizeTelaAgentId(value: string | null | undefined): string | null;
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function normalizeConversationScope(value: string | null | undefined): string | null;
|
|
21
|
+
export declare function resolveConversationScopeKeySegment(value: string | null | undefined): string;
|
|
22
|
+
export declare function resolveChatStateScope(workspaceId: string | null | undefined, telaAgentId: string | null | undefined, conversationScope?: string | null): string;
|
|
21
23
|
export declare function resolveChatFeatures(features?: Partial<ChatFeatureConfig>): ResolvedChatFeatureConfig;
|
|
22
24
|
export declare function resolveConversationCreator(conversationUserId: string | null | undefined, options: {
|
|
23
25
|
currentUser?: ChatActor | null;
|
|
@@ -9,10 +9,19 @@ export function normalizeTelaAgentId(value) {
|
|
|
9
9
|
const normalized = value?.trim();
|
|
10
10
|
return normalized || null;
|
|
11
11
|
}
|
|
12
|
-
export function
|
|
12
|
+
export function normalizeConversationScope(value) {
|
|
13
|
+
const normalized = value?.trim();
|
|
14
|
+
return normalized || null;
|
|
15
|
+
}
|
|
16
|
+
export function resolveConversationScopeKeySegment(value) {
|
|
17
|
+
const normalizedConversationScope = normalizeConversationScope(value);
|
|
18
|
+
return normalizedConversationScope ? `value:${normalizedConversationScope}` : "none";
|
|
19
|
+
}
|
|
20
|
+
export function resolveChatStateScope(workspaceId, telaAgentId, conversationScope) {
|
|
13
21
|
const normalizedWorkspaceId = workspaceId?.trim() || "default";
|
|
14
22
|
const normalizedTelaAgentId = normalizeTelaAgentId(telaAgentId);
|
|
15
|
-
|
|
23
|
+
const runtimeScope = normalizedTelaAgentId ? `${normalizedWorkspaceId}:tela-agent:${normalizedTelaAgentId}` : `${normalizedWorkspaceId}:default-chat`;
|
|
24
|
+
return `${runtimeScope}:scope:${resolveConversationScopeKeySegment(conversationScope)}`;
|
|
16
25
|
}
|
|
17
26
|
export function resolveChatFeatures(features) {
|
|
18
27
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "chat"."conversations" ADD COLUMN "conversation_scope" text;
|