@meistrari/chat-nuxt 3.4.0 → 3.5.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/dist/module.d.mts +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/conversations/composables/conversations.d.ts +2 -4
- package/dist/runtime/conversations/composables/conversations.js +5 -1
- package/dist/runtime/embed/components/chat-embed-inner.vue +36 -9
- package/dist/runtime/embed/components/chat-embed.d.vue.ts +3 -0
- package/dist/runtime/embed/components/chat-embed.vue +5 -1
- package/dist/runtime/embed/components/chat-embed.vue.d.ts +3 -0
- package/dist/runtime/embed/components/meistrari-chat-embed.d.vue.ts +7 -1
- package/dist/runtime/embed/components/meistrari-chat-embed.vue +3 -1
- package/dist/runtime/embed/components/meistrari-chat-embed.vue.d.ts +7 -1
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.d.vue.ts +3 -1
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue +4 -0
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue.d.ts +3 -1
- package/dist/runtime/embed/composables/tela-agent-metadata.d.ts +2 -2
- package/dist/runtime/messages/components/chat-message-input.d.vue.ts +3 -1
- package/dist/runtime/messages/components/chat-message-input.vue +27 -0
- package/dist/runtime/messages/components/chat-message-input.vue.d.ts +3 -1
- package/dist/runtime/messages/composables/chat-message-terminal.d.ts +17 -0
- package/dist/runtime/messages/composables/chat-message-terminal.js +42 -0
- package/dist/runtime/messages/composables/chat.d.ts +3 -0
- package/dist/runtime/messages/composables/chat.js +9 -4
- package/dist/runtime/messages/composables/mention-autocomplete.js +8 -2
- package/dist/runtime/types/embed.d.ts +3 -0
- package/dist/runtime/types/embed.js +1 -0
- package/dist/runtime/types/schemas/chat/conversations.d.ts +27 -0
- package/dist/runtime/types/schemas/chat/conversations.js +7 -0
- package/dist/runtime/types/schemas/chat/files.d.ts +3 -3
- package/dist/runtime/types/schemas/chat/messages.d.ts +31 -0
- package/dist/runtime/types/schemas/chat/messages.js +24 -0
- package/dist/runtime/types/schemas/chat/ui.d.ts +11 -1
- package/dist/runtime/types/schemas/chat/ui.js +3 -0
- package/dist/runtime/types/schemas/chat/usage.d.ts +1 -1
- package/dist/runtime/types/schemas/chat/workspace-agent.d.ts +14 -0
- package/dist/runtime/types/schemas/chat/workspace-agent.js +7 -0
- package/dist/runtime/types/schemas/integrations/agent-api.d.ts +1 -1
- package/dist/runtime/types/schemas/integrations/tela-agent-api.d.ts +68 -6
- package/dist/runtime/types/schemas/integrations/tela-agent-api.js +18 -0
- package/dist/runtime/workspace/composables/workspace-agent-summary.d.ts +6 -0
- package/dist/runtime/workspace/composables/workspace-agent-summary.js +54 -0
- package/dist/types.d.mts +3 -1
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ChatMessageStatus } from '../dist/runtime/messages/composables/chat-message-terminal.js';
|
|
2
|
+
export { ChatActionPayload, ChatActor, ChatEmbedSharedProps, ChatFeatureConfig, ChatMessageTerminalPayload, ChatSidebarConfig, DefaultChatEmbedProps, MeistrariChatEmbedProps, MessageFeedbackConfig, MessageFeedbackPayload, MessageFeedbackRating, MessageOverviewResponse, TelaAgentChatEmbedProps, TelaAgentExecutionInput } from '../dist/runtime/types/embed.js';
|
|
2
3
|
|
|
3
4
|
type ChatNuxtConfigValidationMode = false | 'warn' | 'error';
|
|
4
5
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, readFileSync, mkdirSync, symlinkSync } from 'node:fs';
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
4
|
import { defineNuxtModule, createResolver, addTemplate, addTypeTemplate, addPlugin, addImportsDir, addComponent, addComponentsDir } from 'nuxt/kit';
|
|
5
|
+
export { ChatMessageStatus } from '../dist/runtime/messages/composables/chat-message-terminal.js';
|
|
5
6
|
|
|
6
7
|
const localRequire = createRequire(import.meta.url);
|
|
7
8
|
const runtimeAliasPackages = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DeepReadonly } from 'vue';
|
|
2
|
-
import type { Conversation, ConversationWithMessages } from '../../types/schemas/chat/conversations.js';
|
|
2
|
+
import type { Conversation, ConversationWithMessages, CreateConversationRequest } from '../../types/schemas/chat/conversations.js';
|
|
3
3
|
export declare function mergeFetchedConversations(fetchedConversations: Conversation[], localConversations: readonly Conversation[], deletedConversationIds?: readonly string[], locallyMutatedConversationIds?: readonly string[]): Conversation[];
|
|
4
4
|
export declare function useConversations(): {
|
|
5
5
|
conversations: any;
|
|
@@ -8,9 +8,7 @@ export declare function useConversations(): {
|
|
|
8
8
|
fetchConversations: (options?: {
|
|
9
9
|
force?: boolean;
|
|
10
10
|
}) => Promise<void>;
|
|
11
|
-
createConversation: (input?:
|
|
12
|
-
model?: string | null;
|
|
13
|
-
}) => Promise<Conversation | null>;
|
|
11
|
+
createConversation: (input?: CreateConversationRequest) => Promise<Conversation | null>;
|
|
14
12
|
deleteConversation: (id: string) => Promise<boolean>;
|
|
15
13
|
renameConversation: (id: string, title: string) => Promise<boolean>;
|
|
16
14
|
updateConversationModel: (id: string, model: string | null) => Promise<boolean>;
|
|
@@ -315,11 +315,15 @@ export function useConversations() {
|
|
|
315
315
|
upsertConversationInLoadedBuckets(optimisticConversation, requestRuntimeScope);
|
|
316
316
|
updateConversationCounts(requestRuntimeScope, optimisticConversation, 1);
|
|
317
317
|
try {
|
|
318
|
+
const body = {
|
|
319
|
+
...input?.model !== void 0 ? { model: input.model } : {},
|
|
320
|
+
...input?.agentInputs !== void 0 ? { agentInputs: input.agentInputs } : {}
|
|
321
|
+
};
|
|
318
322
|
const conversation = await $fetch(
|
|
319
323
|
chatApi.path("/conversations"),
|
|
320
324
|
chatApi.withChatHeaders({
|
|
321
325
|
method: "POST",
|
|
322
|
-
|
|
326
|
+
body: Object.keys(body).length > 0 ? body : void 0
|
|
323
327
|
})
|
|
324
328
|
);
|
|
325
329
|
upsertConversationInLoadedBuckets(conversation, requestRuntimeScope, optimisticConversation.id);
|
|
@@ -8,7 +8,7 @@ import ChatMobileShell from "./mobile/chat-mobile-shell.vue";
|
|
|
8
8
|
import { normalizeConversationId } from "../../conversations/scope";
|
|
9
9
|
import { resolveChatFeatures } from "../feature-config";
|
|
10
10
|
import { resolveConversationCreator } from "../../conversations/creator";
|
|
11
|
-
import { useChat } from "../../messages/composables/chat";
|
|
11
|
+
import { resolveTelaAgentInputs, useChat } from "../../messages/composables/chat";
|
|
12
12
|
import { useChatAction } from "../../messages/composables/chat-action";
|
|
13
13
|
import { useChatApi } from "../../shared/composables/chat-api";
|
|
14
14
|
import { useConversationFiles } from "../../files/composables/conversation-files";
|
|
@@ -20,6 +20,7 @@ import { useFilePreviewPanel } from "../../files/composables/file-preview-panel"
|
|
|
20
20
|
import { usePendingConversationGroup } from "../../conversations/composables/pending-conversation-group";
|
|
21
21
|
import { useStatusToast } from "../../shared/composables/status-toast";
|
|
22
22
|
import { useTelaAgentMetadata } from "../composables/tela-agent-metadata";
|
|
23
|
+
import { useWorkspaceAgentSummary } from "../../workspace/composables/workspace-agent-summary";
|
|
23
24
|
import { useWorkspaceMembers } from "../../workspace/composables/workspace-members";
|
|
24
25
|
import { useWorkspaceSettings } from "../../workspace/composables/workspace-settings";
|
|
25
26
|
import { useWorkspaceSwitchModal } from "../../workspace/composables/workspace-switch-modal";
|
|
@@ -55,12 +56,23 @@ const statusToast = useStatusToast();
|
|
|
55
56
|
const { conversations, loading: conversationsLoading, fetchConversations, createConversation, deleteConversation, renameConversation, updateConversationModel, duplicateConversation, moveConversationToGroup, updateConversationInList } = useConversations();
|
|
56
57
|
const { settings: workspaceSettingsState, fetchSettings } = useWorkspaceSettings();
|
|
57
58
|
const { metadata: telaAgentMetadata, loading: telaAgentMetadataLoading, fetchAgentMetadata } = useTelaAgentMetadata();
|
|
59
|
+
const { summary: workspaceAgentSummary, fetchSummary: fetchWorkspaceAgentSummary } = useWorkspaceAgentSummary();
|
|
58
60
|
const isTelaAgentMode = computed(() => !!embedConfig?.telaAgentId.value);
|
|
59
61
|
const hasConfiguredTelaAgentInputs = computed(() => embedConfig?.telaAgentInputs?.value !== void 0 && embedConfig?.telaAgentInputs?.value !== null);
|
|
60
|
-
const shouldLoadTelaAgentMetadata = computed(() => isTelaAgentMode.value
|
|
62
|
+
const shouldLoadTelaAgentMetadata = computed(() => isTelaAgentMode.value);
|
|
61
63
|
const telaAgentInputSchema = computed(
|
|
62
64
|
() => hasConfiguredTelaAgentInputs.value ? null : isTelaAgentMode.value ? telaAgentMetadata.value?.inputSchema ?? [] : null
|
|
63
65
|
);
|
|
66
|
+
const agentSkills = computed(() => {
|
|
67
|
+
if (isTelaAgentMode.value)
|
|
68
|
+
return telaAgentMetadata.value?.skills ?? [];
|
|
69
|
+
return workspaceAgentSummary.value?.skills ?? [];
|
|
70
|
+
});
|
|
71
|
+
const agentContextFiles = computed(() => {
|
|
72
|
+
if (isTelaAgentMode.value)
|
|
73
|
+
return telaAgentMetadata.value?.contextFiles ?? [];
|
|
74
|
+
return workspaceAgentSummary.value?.contextFiles ?? [];
|
|
75
|
+
});
|
|
64
76
|
const effectiveWorkspaceSettings = computed(() => {
|
|
65
77
|
if (isTelaAgentMode.value)
|
|
66
78
|
return void 0;
|
|
@@ -141,7 +153,7 @@ const mobilePreviewFile = computed(() => {
|
|
|
141
153
|
};
|
|
142
154
|
});
|
|
143
155
|
const visibleTelaAgentInputSchema = computed(() => !hasMessages.value ? telaAgentInputSchema.value : null);
|
|
144
|
-
const visibleTelaAgentInputSchemaLoading = computed(() => !hasMessages.value &&
|
|
156
|
+
const visibleTelaAgentInputSchemaLoading = computed(() => !hasMessages.value && isTelaAgentMode.value && !hasConfiguredTelaAgentInputs.value && telaAgentMetadataLoading.value);
|
|
145
157
|
const visibleConversations = computed(
|
|
146
158
|
() => conversations.value.filter((conversation) => conversation.title || conversation.id === activeConversationId.value)
|
|
147
159
|
);
|
|
@@ -228,8 +240,11 @@ onMounted(async () => {
|
|
|
228
240
|
void fetchConversations();
|
|
229
241
|
if (shouldLoadTelaAgentMetadata.value) {
|
|
230
242
|
void fetchAgentMetadata();
|
|
231
|
-
} else
|
|
232
|
-
void
|
|
243
|
+
} else {
|
|
244
|
+
void fetchWorkspaceAgentSummary();
|
|
245
|
+
if (!effectiveWorkspaceSettings.value) {
|
|
246
|
+
void fetchSettings();
|
|
247
|
+
}
|
|
233
248
|
}
|
|
234
249
|
isReady.value = true;
|
|
235
250
|
if (activeConversationId.value) {
|
|
@@ -312,10 +327,12 @@ const conversationCreator = computed(
|
|
|
312
327
|
);
|
|
313
328
|
async function handleSend(content, files, agentInputs) {
|
|
314
329
|
let createdConversationId = null;
|
|
330
|
+
const resolvedAgentInputs = resolveTelaAgentInputs(agentInputs, embedConfig?.telaAgentInputs?.value);
|
|
315
331
|
if (!activeConversationId.value || !currentConversation.value) {
|
|
316
|
-
const conversation = await createConversation(
|
|
317
|
-
|
|
318
|
-
|
|
332
|
+
const conversation = await createConversation({
|
|
333
|
+
model: selectedModel.value,
|
|
334
|
+
...resolvedAgentInputs !== void 0 ? { agentInputs: resolvedAgentInputs } : {}
|
|
335
|
+
});
|
|
319
336
|
if (!conversation)
|
|
320
337
|
return;
|
|
321
338
|
const groupId = pendingConversationGroupId.value;
|
|
@@ -330,7 +347,7 @@ async function handleSend(content, files, agentInputs) {
|
|
|
330
347
|
}
|
|
331
348
|
if (!currentConversation.value)
|
|
332
349
|
return;
|
|
333
|
-
const sendPromise = sendMessage(content, files.length > 0 ? files : void 0,
|
|
350
|
+
const sendPromise = sendMessage(content, files.length > 0 ? files : void 0, resolvedAgentInputs);
|
|
334
351
|
if (createdConversationId) {
|
|
335
352
|
updateConversationId(createdConversationId);
|
|
336
353
|
}
|
|
@@ -561,6 +578,8 @@ async function handleDelete() {
|
|
|
561
578
|
:messages="messages"
|
|
562
579
|
:agent-input-schema="visibleTelaAgentInputSchema"
|
|
563
580
|
:agent-input-schema-loading="visibleTelaAgentInputSchemaLoading"
|
|
581
|
+
:agent-skills="agentSkills"
|
|
582
|
+
:agent-context-files="agentContextFiles"
|
|
564
583
|
:show-cancel-button="resolvedFeatures.showCancelButton"
|
|
565
584
|
:show-debug-option="resolvedFeatures.showDebugOption"
|
|
566
585
|
:show-outdated-badge="showOutdatedBadge"
|
|
@@ -627,6 +646,8 @@ async function handleDelete() {
|
|
|
627
646
|
:workspace-settings="effectiveWorkspaceSettings"
|
|
628
647
|
:agent-input-schema="visibleTelaAgentInputSchema"
|
|
629
648
|
:agent-input-schema-loading="visibleTelaAgentInputSchemaLoading"
|
|
649
|
+
:agent-skills="agentSkills"
|
|
650
|
+
:agent-context-files="agentContextFiles"
|
|
630
651
|
:show-cancel-button="resolvedFeatures.showCancelButton"
|
|
631
652
|
centered
|
|
632
653
|
@send="handleSend"
|
|
@@ -652,6 +673,8 @@ async function handleDelete() {
|
|
|
652
673
|
:workspace-settings="effectiveWorkspaceSettings"
|
|
653
674
|
:agent-input-schema="visibleTelaAgentInputSchema"
|
|
654
675
|
:agent-input-schema-loading="visibleTelaAgentInputSchemaLoading"
|
|
676
|
+
:agent-skills="agentSkills"
|
|
677
|
+
:agent-context-files="agentContextFiles"
|
|
655
678
|
:show-cancel-button="resolvedFeatures.showCancelButton"
|
|
656
679
|
has-disclaimer
|
|
657
680
|
@send="handleSend"
|
|
@@ -775,6 +798,8 @@ async function handleDelete() {
|
|
|
775
798
|
:workspace-settings="effectiveWorkspaceSettings"
|
|
776
799
|
:agent-input-schema="visibleTelaAgentInputSchema"
|
|
777
800
|
:agent-input-schema-loading="visibleTelaAgentInputSchemaLoading"
|
|
801
|
+
:agent-skills="agentSkills"
|
|
802
|
+
:agent-context-files="agentContextFiles"
|
|
778
803
|
:show-cancel-button="resolvedFeatures.showCancelButton"
|
|
779
804
|
centered
|
|
780
805
|
@send="handleSend"
|
|
@@ -801,6 +826,8 @@ async function handleDelete() {
|
|
|
801
826
|
:workspace-settings="effectiveWorkspaceSettings"
|
|
802
827
|
:agent-input-schema="visibleTelaAgentInputSchema"
|
|
803
828
|
:agent-input-schema-loading="visibleTelaAgentInputSchemaLoading"
|
|
829
|
+
:agent-skills="agentSkills"
|
|
830
|
+
:agent-context-files="agentContextFiles"
|
|
804
831
|
:show-cancel-button="resolvedFeatures.showCancelButton"
|
|
805
832
|
has-disclaimer
|
|
806
833
|
@send="handleSend"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ChatActionPayload } from '../../messages/composables/chat-action.js';
|
|
2
2
|
import { type MessageFeedbackPayload } from '../../messages/composables/chat-feedback.js';
|
|
3
|
+
import { type ChatMessageTerminalPayload } from '../../messages/composables/chat-message-terminal.js';
|
|
3
4
|
declare var __VLS_11: {};
|
|
4
5
|
type __VLS_Slots = {} & {
|
|
5
6
|
'sidebar-bottom'?: (props: typeof __VLS_11) => any;
|
|
@@ -8,10 +9,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("../types.js").De
|
|
|
8
9
|
"update:conversationId": (value: string | null) => any;
|
|
9
10
|
messageFeedback: (payload: MessageFeedbackPayload) => any;
|
|
10
11
|
action: (payload: ChatActionPayload) => any;
|
|
12
|
+
messageTerminal: (payload: ChatMessageTerminalPayload) => any;
|
|
11
13
|
}, string, import("vue").PublicProps, Readonly<import("../types.js").DefaultChatEmbedProps | import("../types.js").TelaAgentChatEmbedProps> & Readonly<{
|
|
12
14
|
"onUpdate:conversationId"?: ((value: string | null) => any) | undefined;
|
|
13
15
|
onMessageFeedback?: ((payload: MessageFeedbackPayload) => any) | undefined;
|
|
14
16
|
onAction?: ((payload: ChatActionPayload) => any) | undefined;
|
|
17
|
+
onMessageTerminal?: ((payload: ChatMessageTerminalPayload) => any) | undefined;
|
|
15
18
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
19
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
20
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useChatAuth } from "#chat-auth";
|
|
3
3
|
import { provideChatAction } from "../../messages/composables/chat-action";
|
|
4
4
|
import { provideMessageFeedback } from "../../messages/composables/chat-feedback";
|
|
5
|
+
import { provideChatMessageTerminal } from "../../messages/composables/chat-message-terminal";
|
|
5
6
|
import { provideChatRequestContext } from "../../shared/composables/chat-request-context";
|
|
6
7
|
import { provideEmbedConfig, useEmbedConfig } from "../composables/embed-config";
|
|
7
8
|
import { normalizeConversationScope, normalizeTelaAgentId, resolveConversationScopeKeySegment } from "../../conversations/scope";
|
|
@@ -26,7 +27,7 @@ const props = defineProps({
|
|
|
26
27
|
user: { type: null, required: false },
|
|
27
28
|
features: { type: Object, required: false }
|
|
28
29
|
});
|
|
29
|
-
const emit = defineEmits(["update:conversationId", "action", "messageFeedback"]);
|
|
30
|
+
const emit = defineEmits(["update:conversationId", "action", "messageFeedback", "messageTerminal"]);
|
|
30
31
|
const parentEmbedConfig = useEmbedConfig();
|
|
31
32
|
const { activeOrganization } = useChatAuth();
|
|
32
33
|
const workspaceId = computed(() => activeOrganization.value?.id?.trim() ?? "");
|
|
@@ -80,6 +81,9 @@ provideChatAction((payload) => {
|
|
|
80
81
|
provideMessageFeedback((payload) => {
|
|
81
82
|
emit("messageFeedback", payload);
|
|
82
83
|
});
|
|
84
|
+
provideChatMessageTerminal((payload) => {
|
|
85
|
+
emit("messageTerminal", payload);
|
|
86
|
+
});
|
|
83
87
|
</script>
|
|
84
88
|
|
|
85
89
|
<template>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ChatActionPayload } from '../../messages/composables/chat-action.js';
|
|
2
2
|
import { type MessageFeedbackPayload } from '../../messages/composables/chat-feedback.js';
|
|
3
|
+
import { type ChatMessageTerminalPayload } from '../../messages/composables/chat-message-terminal.js';
|
|
3
4
|
declare var __VLS_11: {};
|
|
4
5
|
type __VLS_Slots = {} & {
|
|
5
6
|
'sidebar-bottom'?: (props: typeof __VLS_11) => any;
|
|
@@ -8,10 +9,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("../types.js").De
|
|
|
8
9
|
"update:conversationId": (value: string | null) => any;
|
|
9
10
|
messageFeedback: (payload: MessageFeedbackPayload) => any;
|
|
10
11
|
action: (payload: ChatActionPayload) => any;
|
|
12
|
+
messageTerminal: (payload: ChatMessageTerminalPayload) => any;
|
|
11
13
|
}, string, import("vue").PublicProps, Readonly<import("../types.js").DefaultChatEmbedProps | import("../types.js").TelaAgentChatEmbedProps> & Readonly<{
|
|
12
14
|
"onUpdate:conversationId"?: ((value: string | null) => any) | undefined;
|
|
13
15
|
onMessageFeedback?: ((payload: MessageFeedbackPayload) => any) | undefined;
|
|
14
16
|
onAction?: ((payload: ChatActionPayload) => any) | undefined;
|
|
17
|
+
onMessageTerminal?: ((payload: ChatMessageTerminalPayload) => any) | undefined;
|
|
15
18
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
19
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
20
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { DefineSetupFnComponent, SlotsType } from 'vue';
|
|
2
2
|
import type { ChatActionPayload } from '../../messages/composables/chat-action.js';
|
|
3
|
+
import type { MessageFeedbackPayload } from '../../messages/composables/chat-feedback.js';
|
|
4
|
+
import type { ChatMessageTerminalPayload } from '../../messages/composables/chat-message-terminal.js';
|
|
3
5
|
import type { ChatFeatureConfig } from '../feature-config.js';
|
|
4
6
|
import type { ChatSidebarConfig, DefaultChatEmbedProps, MeistrariChatEmbedProps, TelaAgentChatEmbedProps } from '../types.js';
|
|
5
7
|
|
|
@@ -8,6 +10,10 @@ type MeistrariChatEmbedEmits = {
|
|
|
8
10
|
'update:conversationId': (value: string | null) => any;
|
|
9
11
|
/** Fired when an assistant message triggers a host-handled action. */
|
|
10
12
|
'action': (payload: ChatActionPayload) => any;
|
|
13
|
+
/** Fired when a user submits feedback for an assistant message. */
|
|
14
|
+
'messageFeedback': (payload: MessageFeedbackPayload) => any;
|
|
15
|
+
/** Fired after polling observes an assistant message reach a terminal status. */
|
|
16
|
+
'messageTerminal': (payload: ChatMessageTerminalPayload) => any;
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
type MeistrariChatEmbedSlots = SlotsType<{
|
|
@@ -44,4 +50,4 @@ type MeistrariChatEmbedSlots = SlotsType<{
|
|
|
44
50
|
declare const MeistrariChatEmbed: DefineSetupFnComponent<MeistrariChatEmbedProps, MeistrariChatEmbedEmits, MeistrariChatEmbedSlots>;
|
|
45
51
|
|
|
46
52
|
export default MeistrariChatEmbed;
|
|
47
|
-
export type { ChatActionPayload, ChatFeatureConfig, ChatSidebarConfig, DefaultChatEmbedProps, MeistrariChatEmbedProps, TelaAgentChatEmbedProps };
|
|
53
|
+
export type { ChatActionPayload, ChatFeatureConfig, ChatMessageTerminalPayload, ChatSidebarConfig, DefaultChatEmbedProps, MeistrariChatEmbedProps, MessageFeedbackPayload, TelaAgentChatEmbedProps };
|
|
@@ -20,7 +20,7 @@ const props = defineProps({
|
|
|
20
20
|
user: { type: null, required: false },
|
|
21
21
|
features: { type: Object, required: false }
|
|
22
22
|
});
|
|
23
|
-
defineEmits(["update:conversationId", "action", "messageFeedback"]);
|
|
23
|
+
defineEmits(["update:conversationId", "action", "messageFeedback", "messageTerminal"]);
|
|
24
24
|
defineSlots();
|
|
25
25
|
const hideSettings = computed(() => props.hideSettings ?? false);
|
|
26
26
|
</script>
|
|
@@ -47,6 +47,7 @@ const hideSettings = computed(() => props.hideSettings ?? false);
|
|
|
47
47
|
@update:conversation-id="$emit('update:conversationId', $event)"
|
|
48
48
|
@action="$emit('action', $event)"
|
|
49
49
|
@message-feedback="$emit('messageFeedback', $event)"
|
|
50
|
+
@message-terminal="$emit('messageTerminal', $event)"
|
|
50
51
|
>
|
|
51
52
|
<template v-if="$slots['sidebar-bottom']" #sidebar-bottom>
|
|
52
53
|
<slot name="sidebar-bottom" />
|
|
@@ -73,6 +74,7 @@ const hideSettings = computed(() => props.hideSettings ?? false);
|
|
|
73
74
|
@update:conversation-id="$emit('update:conversationId', $event)"
|
|
74
75
|
@action="$emit('action', $event)"
|
|
75
76
|
@message-feedback="$emit('messageFeedback', $event)"
|
|
77
|
+
@message-terminal="$emit('messageTerminal', $event)"
|
|
76
78
|
>
|
|
77
79
|
<template v-if="$slots['sidebar-bottom']" #sidebar-bottom>
|
|
78
80
|
<slot name="sidebar-bottom" />
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { DefineSetupFnComponent, SlotsType } from 'vue';
|
|
2
2
|
import type { ChatActionPayload } from '../../messages/composables/chat-action.js';
|
|
3
|
+
import type { MessageFeedbackPayload } from '../../messages/composables/chat-feedback.js';
|
|
4
|
+
import type { ChatMessageTerminalPayload } from '../../messages/composables/chat-message-terminal.js';
|
|
3
5
|
import type { ChatFeatureConfig } from '../feature-config.js';
|
|
4
6
|
import type { ChatSidebarConfig, DefaultChatEmbedProps, MeistrariChatEmbedProps, TelaAgentChatEmbedProps } from '../types.js';
|
|
5
7
|
|
|
@@ -8,6 +10,10 @@ type MeistrariChatEmbedEmits = {
|
|
|
8
10
|
'update:conversationId': (value: string | null) => any;
|
|
9
11
|
/** Fired when an assistant message triggers a host-handled action. */
|
|
10
12
|
'action': (payload: ChatActionPayload) => any;
|
|
13
|
+
/** Fired when a user submits feedback for an assistant message. */
|
|
14
|
+
'messageFeedback': (payload: MessageFeedbackPayload) => any;
|
|
15
|
+
/** Fired after polling observes an assistant message reach a terminal status. */
|
|
16
|
+
'messageTerminal': (payload: ChatMessageTerminalPayload) => any;
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
type MeistrariChatEmbedSlots = SlotsType<{
|
|
@@ -44,4 +50,4 @@ type MeistrariChatEmbedSlots = SlotsType<{
|
|
|
44
50
|
declare const MeistrariChatEmbed: DefineSetupFnComponent<MeistrariChatEmbedProps, MeistrariChatEmbedEmits, MeistrariChatEmbedSlots>;
|
|
45
51
|
|
|
46
52
|
export default MeistrariChatEmbed;
|
|
47
|
-
export type { ChatActionPayload, ChatFeatureConfig, ChatSidebarConfig, DefaultChatEmbedProps, MeistrariChatEmbedProps, TelaAgentChatEmbedProps };
|
|
53
|
+
export type { ChatActionPayload, ChatFeatureConfig, ChatMessageTerminalPayload, ChatSidebarConfig, DefaultChatEmbedProps, MeistrariChatEmbedProps, MessageFeedbackPayload, TelaAgentChatEmbedProps };
|
|
@@ -3,7 +3,7 @@ import type { Conversation, ConversationWithMessages, Message } from '../../../t
|
|
|
3
3
|
import type { ConversationFile } from '../../../types/schemas/chat/files.js';
|
|
4
4
|
import type { TopbarTab } from '../../../types/schemas/chat/ui.js';
|
|
5
5
|
import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../../../types/schemas/chat/workspace-settings.js';
|
|
6
|
-
import type { TelaAgentInputVariable } from '../../../types/schemas/integrations/tela-agent-api.js';
|
|
6
|
+
import type { TelaAgentContextFile, TelaAgentInputVariable, TelaAgentSkill } from '../../../types/schemas/integrations/tela-agent-api.js';
|
|
7
7
|
import type { ChatActor } from '../../types.js';
|
|
8
8
|
type __VLS_Props = {
|
|
9
9
|
currentConversation: DeepReadonly<ConversationWithMessages> | null;
|
|
@@ -14,6 +14,8 @@ type __VLS_Props = {
|
|
|
14
14
|
activeConversationId: string | null;
|
|
15
15
|
agentInputSchema?: readonly TelaAgentInputVariable[] | null;
|
|
16
16
|
agentInputSchemaLoading?: boolean;
|
|
17
|
+
agentSkills?: readonly TelaAgentSkill[] | null;
|
|
18
|
+
agentContextFiles?: readonly TelaAgentContextFile[] | null;
|
|
17
19
|
conversations: DeepReadonly<Conversation[]>;
|
|
18
20
|
conversationsLoading?: boolean;
|
|
19
21
|
conversationFiles: ConversationFile[];
|
|
@@ -19,6 +19,8 @@ const props = defineProps({
|
|
|
19
19
|
activeConversationId: { type: [String, null], required: true },
|
|
20
20
|
agentInputSchema: { type: [Array, null], required: false },
|
|
21
21
|
agentInputSchemaLoading: { type: Boolean, required: false },
|
|
22
|
+
agentSkills: { type: [Array, null], required: false },
|
|
23
|
+
agentContextFiles: { type: [Array, null], required: false },
|
|
22
24
|
conversations: { type: null, required: true },
|
|
23
25
|
conversationsLoading: { type: Boolean, required: false },
|
|
24
26
|
conversationFiles: { type: Array, required: true },
|
|
@@ -232,6 +234,8 @@ function startNewConversationFromOutdatedSettings() {
|
|
|
232
234
|
:workspace-settings="workspaceSettings"
|
|
233
235
|
:agent-input-schema="agentInputSchema"
|
|
234
236
|
:agent-input-schema-loading="agentInputSchemaLoading"
|
|
237
|
+
:agent-skills="agentSkills"
|
|
238
|
+
:agent-context-files="agentContextFiles"
|
|
235
239
|
:show-cancel-button="showCancelButton"
|
|
236
240
|
centered
|
|
237
241
|
@send="(content, files, agentInputs) => emit('send', content, files, agentInputs)"
|
|
@@ -3,7 +3,7 @@ import type { Conversation, ConversationWithMessages, Message } from '../../../t
|
|
|
3
3
|
import type { ConversationFile } from '../../../types/schemas/chat/files.js';
|
|
4
4
|
import type { TopbarTab } from '../../../types/schemas/chat/ui.js';
|
|
5
5
|
import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../../../types/schemas/chat/workspace-settings.js';
|
|
6
|
-
import type { TelaAgentInputVariable } from '../../../types/schemas/integrations/tela-agent-api.js';
|
|
6
|
+
import type { TelaAgentContextFile, TelaAgentInputVariable, TelaAgentSkill } from '../../../types/schemas/integrations/tela-agent-api.js';
|
|
7
7
|
import type { ChatActor } from '../../types.js';
|
|
8
8
|
type __VLS_Props = {
|
|
9
9
|
currentConversation: DeepReadonly<ConversationWithMessages> | null;
|
|
@@ -14,6 +14,8 @@ type __VLS_Props = {
|
|
|
14
14
|
activeConversationId: string | null;
|
|
15
15
|
agentInputSchema?: readonly TelaAgentInputVariable[] | null;
|
|
16
16
|
agentInputSchemaLoading?: boolean;
|
|
17
|
+
agentSkills?: readonly TelaAgentSkill[] | null;
|
|
18
|
+
agentContextFiles?: readonly TelaAgentContextFile[] | null;
|
|
17
19
|
conversations: DeepReadonly<Conversation[]>;
|
|
18
20
|
conversationsLoading?: boolean;
|
|
19
21
|
conversationFiles: ConversationFile[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TelaAgentSummary } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
2
2
|
export declare function useTelaAgentMetadata(): {
|
|
3
3
|
agentId: any;
|
|
4
4
|
metadata: any;
|
|
5
5
|
loading: any;
|
|
6
6
|
error: any;
|
|
7
|
-
fetchAgentMetadata: () => Promise<
|
|
7
|
+
fetchAgentMetadata: () => Promise<TelaAgentSummary | null>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import type { DeepReadonly } from 'vue';
|
|
|
2
2
|
import type { Message } from '../../types/schemas/chat/conversations.js';
|
|
3
3
|
import type { ConversationFile } from '../../types/schemas/chat/files.js';
|
|
4
4
|
import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../../types/schemas/chat/workspace-settings.js';
|
|
5
|
-
import type { TelaAgentInputVariable } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
5
|
+
import type { TelaAgentContextFile, TelaAgentInputVariable, TelaAgentSkill } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
6
6
|
type __VLS_Props = {
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
loading?: boolean;
|
|
@@ -16,6 +16,8 @@ type __VLS_Props = {
|
|
|
16
16
|
workspaceSettings?: DeepReadonly<WorkspaceSettings> | null;
|
|
17
17
|
agentInputSchema?: readonly TelaAgentInputVariable[] | null;
|
|
18
18
|
agentInputSchemaLoading?: boolean;
|
|
19
|
+
agentSkills?: readonly TelaAgentSkill[] | null;
|
|
20
|
+
agentContextFiles?: readonly TelaAgentContextFile[] | null;
|
|
19
21
|
showCancelButton?: boolean;
|
|
20
22
|
};
|
|
21
23
|
declare function addFiles(files: File[], inputName?: string): void;
|
|
@@ -19,6 +19,8 @@ const props = defineProps({
|
|
|
19
19
|
workspaceSettings: { type: null, required: false },
|
|
20
20
|
agentInputSchema: { type: [Array, null], required: false },
|
|
21
21
|
agentInputSchemaLoading: { type: Boolean, required: false },
|
|
22
|
+
agentSkills: { type: [Array, null], required: false },
|
|
23
|
+
agentContextFiles: { type: [Array, null], required: false },
|
|
22
24
|
showCancelButton: { type: Boolean, required: false }
|
|
23
25
|
});
|
|
24
26
|
const emit = defineEmits(["send", "cancel"]);
|
|
@@ -84,10 +86,35 @@ const fileItems = computed(() => {
|
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
if (props.agentContextFiles) {
|
|
90
|
+
for (const f of props.agentContextFiles) {
|
|
91
|
+
if (!items.some((i) => i.id === f.path)) {
|
|
92
|
+
items.push({
|
|
93
|
+
id: f.path,
|
|
94
|
+
label: f.name,
|
|
95
|
+
description: "Contexto do agente",
|
|
96
|
+
icon: getMimeIcon(),
|
|
97
|
+
category: "file",
|
|
98
|
+
idKind: "path"
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
87
103
|
return items;
|
|
88
104
|
});
|
|
89
105
|
const skillItems = computed(() => {
|
|
90
106
|
const items = [];
|
|
107
|
+
if (props.agentSkills) {
|
|
108
|
+
for (const s of props.agentSkills) {
|
|
109
|
+
items.push({
|
|
110
|
+
id: s.path,
|
|
111
|
+
label: s.name,
|
|
112
|
+
description: s.description,
|
|
113
|
+
icon: "i-ph-lightning",
|
|
114
|
+
category: "skill"
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
91
118
|
if (props.workspaceSettings?.externalSkills) {
|
|
92
119
|
for (const s of props.workspaceSettings.externalSkills) {
|
|
93
120
|
items.push({
|
|
@@ -2,7 +2,7 @@ import type { DeepReadonly } from 'vue';
|
|
|
2
2
|
import type { Message } from '../../types/schemas/chat/conversations.js';
|
|
3
3
|
import type { ConversationFile } from '../../types/schemas/chat/files.js';
|
|
4
4
|
import type { WorkspaceSettingsResponse as WorkspaceSettings } from '../../types/schemas/chat/workspace-settings.js';
|
|
5
|
-
import type { TelaAgentInputVariable } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
5
|
+
import type { TelaAgentContextFile, TelaAgentInputVariable, TelaAgentSkill } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
6
6
|
type __VLS_Props = {
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
loading?: boolean;
|
|
@@ -16,6 +16,8 @@ type __VLS_Props = {
|
|
|
16
16
|
workspaceSettings?: DeepReadonly<WorkspaceSettings> | null;
|
|
17
17
|
agentInputSchema?: readonly TelaAgentInputVariable[] | null;
|
|
18
18
|
agentInputSchemaLoading?: boolean;
|
|
19
|
+
agentSkills?: readonly TelaAgentSkill[] | null;
|
|
20
|
+
agentContextFiles?: readonly TelaAgentContextFile[] | null;
|
|
19
21
|
showCancelButton?: boolean;
|
|
20
22
|
};
|
|
21
23
|
declare function addFiles(files: File[], inputName?: string): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Message } from '../../types/schemas/chat/conversations.js';
|
|
2
|
+
export declare enum ChatMessageStatus {
|
|
3
|
+
Pending = "pending",
|
|
4
|
+
Completed = "completed",
|
|
5
|
+
Failed = "failed"
|
|
6
|
+
}
|
|
7
|
+
export type ChatMessageTerminalPayload = {
|
|
8
|
+
conversationId: string;
|
|
9
|
+
messageId: string;
|
|
10
|
+
status: ChatMessageStatus.Completed | ChatMessageStatus.Failed;
|
|
11
|
+
};
|
|
12
|
+
export type ChatMessageTerminalHandler = (payload: ChatMessageTerminalPayload) => void;
|
|
13
|
+
export declare function terminalMessageTransitions(previousMessages: readonly Message[], nextMessages: readonly Message[]): ChatMessageTerminalPayload[];
|
|
14
|
+
export declare function provideChatMessageTerminal(handler: ChatMessageTerminalHandler): void;
|
|
15
|
+
export declare function useChatMessageTerminal(): {
|
|
16
|
+
emit(payload: ChatMessageTerminalPayload): void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { inject, provide } from "vue";
|
|
2
|
+
export var ChatMessageStatus = /* @__PURE__ */ ((ChatMessageStatus2) => {
|
|
3
|
+
ChatMessageStatus2["Pending"] = "pending";
|
|
4
|
+
ChatMessageStatus2["Completed"] = "completed";
|
|
5
|
+
ChatMessageStatus2["Failed"] = "failed";
|
|
6
|
+
return ChatMessageStatus2;
|
|
7
|
+
})(ChatMessageStatus || {});
|
|
8
|
+
const CHAT_MESSAGE_TERMINAL_KEY = Symbol("chat-nuxt:message-terminal");
|
|
9
|
+
export function terminalMessageTransitions(previousMessages, nextMessages) {
|
|
10
|
+
const previousById = new Map(previousMessages.map((message) => [message.id, message]));
|
|
11
|
+
const transitions = [];
|
|
12
|
+
for (const message of nextMessages) {
|
|
13
|
+
const previous = previousById.get(message.id);
|
|
14
|
+
if (message.role !== "assistant" || previous?.status !== "pending" /* Pending */)
|
|
15
|
+
continue;
|
|
16
|
+
if (message.status === "completed" /* Completed */) {
|
|
17
|
+
transitions.push({
|
|
18
|
+
conversationId: message.conversationId,
|
|
19
|
+
messageId: message.id,
|
|
20
|
+
status: "completed" /* Completed */
|
|
21
|
+
});
|
|
22
|
+
} else if (message.status === "failed" /* Failed */) {
|
|
23
|
+
transitions.push({
|
|
24
|
+
conversationId: message.conversationId,
|
|
25
|
+
messageId: message.id,
|
|
26
|
+
status: "failed" /* Failed */
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return transitions;
|
|
31
|
+
}
|
|
32
|
+
export function provideChatMessageTerminal(handler) {
|
|
33
|
+
provide(CHAT_MESSAGE_TERMINAL_KEY, handler);
|
|
34
|
+
}
|
|
35
|
+
export function useChatMessageTerminal() {
|
|
36
|
+
const handler = inject(CHAT_MESSAGE_TERMINAL_KEY, null);
|
|
37
|
+
return {
|
|
38
|
+
emit(payload) {
|
|
39
|
+
handler?.(payload);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { DeepReadonly } from 'vue';
|
|
1
2
|
import type { Conversation, ConversationWithMessages, Message } from '../../types/schemas/chat/conversations.js';
|
|
2
3
|
import type { FileUploadInput } from '../../types/schemas/chat/files.js';
|
|
4
|
+
import type { SendMessageBody } from '../../types/schemas/chat/messages.js';
|
|
3
5
|
import type { TelaAgentExecutionInput } from '../../types/schemas/integrations/tela-agent-api.js';
|
|
6
|
+
export declare function resolveTelaAgentInputs(messageInputs: TelaAgentExecutionInput[] | undefined, configuredInputs: DeepReadonly<TelaAgentExecutionInput[]> | null | undefined): SendMessageBody['agentInputs'];
|
|
4
7
|
export declare function useChat(): {
|
|
5
8
|
currentConversation: any;
|
|
6
9
|
messages: any;
|
|
@@ -21,13 +21,15 @@ import { useChatApi } from "../../shared/composables/chat-api.js";
|
|
|
21
21
|
import { useConversationFileActions } from "../../files/composables/conversation-files.js";
|
|
22
22
|
import { useEmbedConfig } from "../../embed/composables/embed-config.js";
|
|
23
23
|
import { usePolling } from "../../shared/composables/polling.js";
|
|
24
|
+
import { terminalMessageTransitions, useChatMessageTerminal } from "./chat-message-terminal.js";
|
|
24
25
|
const WORKSPACE_AGENT_NOT_READY_TEXT = "O agente deste workspace ainda n\xE3o foi configurado no Tela. Abra as configura\xE7\xF5es do workspace para criar o agente.";
|
|
25
|
-
function resolveTelaAgentInputs(messageInputs, configuredInputs) {
|
|
26
|
-
const inputs = messageInputs ?? configuredInputs
|
|
27
|
-
return inputs
|
|
26
|
+
export function resolveTelaAgentInputs(messageInputs, configuredInputs) {
|
|
27
|
+
const inputs = messageInputs ?? configuredInputs;
|
|
28
|
+
return inputs === void 0 || inputs === null ? void 0 : inputs.map((input) => ({ ...input }));
|
|
28
29
|
}
|
|
29
30
|
export function useChat() {
|
|
30
31
|
const chatApi = useChatApi();
|
|
32
|
+
const chatMessageTerminal = useChatMessageTerminal();
|
|
31
33
|
const embedConfig = useEmbedConfig();
|
|
32
34
|
const { user: authUser, activeOrganization } = useChatAuth();
|
|
33
35
|
const { addFilesToConversation } = useConversationFileActions();
|
|
@@ -80,7 +82,10 @@ export function useChat() {
|
|
|
80
82
|
);
|
|
81
83
|
if (generation !== pollGeneration)
|
|
82
84
|
return;
|
|
85
|
+
const terminalMessages = terminalMessageTransitions(messages.value, response.messages);
|
|
83
86
|
messages.value = response.messages;
|
|
87
|
+
for (const terminalMessage of terminalMessages)
|
|
88
|
+
chatMessageTerminal.emit(terminalMessage);
|
|
84
89
|
if (response.newFiles && response.newFiles.length > 0) {
|
|
85
90
|
const lastAssistantMessage = response.messages.findLast((m) => m.role === "assistant");
|
|
86
91
|
if (lastAssistantMessage) {
|
|
@@ -211,7 +216,7 @@ export function useChat() {
|
|
|
211
216
|
const body = {
|
|
212
217
|
content,
|
|
213
218
|
files,
|
|
214
|
-
...resolvedAgentInputs ? { agentInputs: resolvedAgentInputs } : {}
|
|
219
|
+
...resolvedAgentInputs !== void 0 ? { agentInputs: resolvedAgentInputs } : {}
|
|
215
220
|
};
|
|
216
221
|
const response = await $fetch(
|
|
217
222
|
chatApi.path(`/conversations/${currentConversation.value.id}/messages`),
|
|
@@ -167,6 +167,8 @@ export function useMentionAutocomplete(options) {
|
|
|
167
167
|
span.dataset.mentionId = item.id;
|
|
168
168
|
span.dataset.mentionCategory = item.category;
|
|
169
169
|
span.dataset.mentionLabel = item.label;
|
|
170
|
+
if (item.idKind)
|
|
171
|
+
span.dataset.mentionIdKind = item.idKind;
|
|
170
172
|
if (item.description)
|
|
171
173
|
span.dataset.mentionDescription = item.description;
|
|
172
174
|
if (item.variables)
|
|
@@ -213,10 +215,14 @@ export function useMentionAutocomplete(options) {
|
|
|
213
215
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
214
216
|
const el = node;
|
|
215
217
|
if (el.contentEditable === "false" && el.dataset.mentionCategory) {
|
|
216
|
-
const { mentionCategory, mentionId, mentionLabel, mentionDescription } = el.dataset;
|
|
218
|
+
const { mentionCategory, mentionId, mentionLabel, mentionDescription, mentionIdKind } = el.dataset;
|
|
217
219
|
if (mentionCategory === "file") {
|
|
218
|
-
const urlAttr = mentionId ? ` url="${escapeAttr(mentionId)}"` : "";
|
|
219
220
|
accumulated = true;
|
|
221
|
+
if (mentionIdKind === "path") {
|
|
222
|
+
const pathAttr = mentionId ? ` path="${escapeAttr(mentionId)}"` : "";
|
|
223
|
+
return `<file_mention name="${escapeAttr(mentionLabel ?? "")}"${pathAttr}>Este arquivo est\xE1 no seu reposit\xF3rio de trabalho. Leia-o pelo caminho e foque nele na sua resposta.</file_mention>`;
|
|
224
|
+
}
|
|
225
|
+
const urlAttr = mentionId ? ` url="${escapeAttr(mentionId)}"` : "";
|
|
220
226
|
return `<file_mention name="${escapeAttr(mentionLabel ?? "")}"${urlAttr}>Foque neste arquivo espec\xEDfico na sua resposta.</file_mention>`;
|
|
221
227
|
}
|
|
222
228
|
if (mentionCategory === "canvas") {
|
|
@@ -2,4 +2,7 @@ export type { ChatFeatureConfig } from '../embed/feature-config.js';
|
|
|
2
2
|
export type { ChatActor, ChatEmbedSharedProps, ChatSidebarConfig, DefaultChatEmbedProps, MeistrariChatEmbedProps, TelaAgentChatEmbedProps, } from '../embed/types.js';
|
|
3
3
|
export type { ChatActionPayload } from '../messages/composables/chat-action.js';
|
|
4
4
|
export type { MessageFeedbackConfig, MessageFeedbackPayload, MessageFeedbackRating, } from '../messages/composables/chat-feedback.js';
|
|
5
|
+
export { ChatMessageStatus } from '../messages/composables/chat-message-terminal.js';
|
|
6
|
+
export type { ChatMessageTerminalPayload } from '../messages/composables/chat-message-terminal.js';
|
|
7
|
+
export type { MessageOverviewResponse } from './schemas/chat/messages.js';
|
|
5
8
|
export type { TelaAgentExecutionInput } from './schemas/integrations/tela-agent-api.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChatMessageStatus } from "../messages/composables/chat-message-terminal.js";
|
|
@@ -215,8 +215,35 @@ export declare const createConversationRequestSchema: z.ZodObject<{
|
|
|
215
215
|
"claude-sonnet-5": "claude-sonnet-5";
|
|
216
216
|
"claude-haiku-4-5": "claude-haiku-4-5";
|
|
217
217
|
}>>>;
|
|
218
|
+
agentInputs: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
219
|
+
type: z.ZodLiteral<"file">;
|
|
220
|
+
name: z.ZodString;
|
|
221
|
+
vaultRef: z.ZodString;
|
|
222
|
+
filename: z.ZodString;
|
|
223
|
+
metadata: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
225
|
+
type: z.ZodLiteral<"text">;
|
|
226
|
+
name: z.ZodString;
|
|
227
|
+
content: z.ZodString;
|
|
228
|
+
}, z.core.$strip>], "type">>>;
|
|
218
229
|
}, z.core.$strict>;
|
|
219
230
|
export type CreateConversationRequest = z.infer<typeof createConversationRequestSchema>;
|
|
231
|
+
export declare const conversationAgentInputsResponseSchema: z.ZodObject<{
|
|
232
|
+
agentInputs: z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"file">;
|
|
234
|
+
name: z.ZodString;
|
|
235
|
+
vaultRef: z.ZodString;
|
|
236
|
+
filename: z.ZodString;
|
|
237
|
+
metadata: z.ZodOptional<z.ZodString>;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
type: z.ZodLiteral<"text">;
|
|
240
|
+
name: z.ZodString;
|
|
241
|
+
content: z.ZodString;
|
|
242
|
+
}, z.core.$strip>], "type">>>;
|
|
243
|
+
configuredAt: z.ZodNullable<z.ZodDate>;
|
|
244
|
+
appliedAt: z.ZodNullable<z.ZodDate>;
|
|
245
|
+
}, z.core.$strip>;
|
|
246
|
+
export type ConversationAgentInputsResponse = z.infer<typeof conversationAgentInputsResponseSchema>;
|
|
220
247
|
export declare const updateConversationRequestSchema: z.ZodObject<{
|
|
221
248
|
title: z.ZodOptional<z.ZodString>;
|
|
222
249
|
model: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { telaAgentExecutionInputSchema } from '../integrations/tela-agent-api';
|
|
2
3
|
import { messageFileSchema } from './files';
|
|
3
4
|
import { chatModelSchema } from './models';
|
|
4
5
|
import { conversationCreatorFilterSchema, messageRoleSchema, messageStatusSchema, } from './primitives';
|
|
@@ -52,6 +53,12 @@ export const conversationWithMessagesSchema = conversationSchema.extend({
|
|
|
52
53
|
});
|
|
53
54
|
export const createConversationRequestSchema = z.strictObject({
|
|
54
55
|
model: chatModelSchema.nullable().optional(),
|
|
56
|
+
agentInputs: z.array(telaAgentExecutionInputSchema).optional(),
|
|
57
|
+
});
|
|
58
|
+
export const conversationAgentInputsResponseSchema = z.object({
|
|
59
|
+
agentInputs: z.array(telaAgentExecutionInputSchema).nullable(),
|
|
60
|
+
configuredAt: z.date().nullable(),
|
|
61
|
+
appliedAt: z.date().nullable(),
|
|
55
62
|
});
|
|
56
63
|
export const updateConversationRequestSchema = z.strictObject({
|
|
57
64
|
title: z.string().optional(),
|
|
@@ -53,8 +53,8 @@ export declare const permalinkMetadataResponseSchema: z.ZodObject<{
|
|
|
53
53
|
export type PermalinkMetadataResponse = z.infer<typeof permalinkMetadataResponseSchema>;
|
|
54
54
|
export declare const conversationFileSources: readonly ["context", "message"];
|
|
55
55
|
export declare const conversationFileSourceSchema: z.ZodEnum<{
|
|
56
|
-
context: "context";
|
|
57
56
|
message: "message";
|
|
57
|
+
context: "context";
|
|
58
58
|
}>;
|
|
59
59
|
export type ConversationFileSource = z.infer<typeof conversationFileSourceSchema>;
|
|
60
60
|
export declare const conversationFileSchema: z.ZodObject<{
|
|
@@ -64,8 +64,8 @@ export declare const conversationFileSchema: z.ZodObject<{
|
|
|
64
64
|
mimeType: z.ZodString;
|
|
65
65
|
vaultReference: z.ZodOptional<z.ZodString>;
|
|
66
66
|
source: z.ZodEnum<{
|
|
67
|
-
context: "context";
|
|
68
67
|
message: "message";
|
|
68
|
+
context: "context";
|
|
69
69
|
}>;
|
|
70
70
|
messageId: z.ZodOptional<z.ZodString>;
|
|
71
71
|
messageRole: z.ZodOptional<z.ZodEnum<{
|
|
@@ -84,8 +84,8 @@ export declare const conversationFilesResponseSchema: z.ZodObject<{
|
|
|
84
84
|
mimeType: z.ZodString;
|
|
85
85
|
vaultReference: z.ZodOptional<z.ZodString>;
|
|
86
86
|
source: z.ZodEnum<{
|
|
87
|
-
context: "context";
|
|
88
87
|
message: "message";
|
|
88
|
+
context: "context";
|
|
89
89
|
}>;
|
|
90
90
|
messageId: z.ZodOptional<z.ZodString>;
|
|
91
91
|
messageRole: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const messageOverviewResponseSchema: z.ZodObject<{
|
|
3
|
+
conversation: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
userId: z.ZodString;
|
|
6
|
+
model: z.ZodNullable<z.ZodString>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
message: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
conversationId: z.ZodString;
|
|
11
|
+
role: z.ZodEnum<{
|
|
12
|
+
user: "user";
|
|
13
|
+
assistant: "assistant";
|
|
14
|
+
}>;
|
|
15
|
+
status: z.ZodNullable<z.ZodEnum<{
|
|
16
|
+
pending: "pending";
|
|
17
|
+
completed: "completed";
|
|
18
|
+
failed: "failed";
|
|
19
|
+
}>>;
|
|
20
|
+
content: z.ZodString;
|
|
21
|
+
agentSessionId: z.ZodNullable<z.ZodString>;
|
|
22
|
+
agentSessionCursor: z.ZodNullable<z.ZodNumber>;
|
|
23
|
+
createdAt: z.ZodDate;
|
|
24
|
+
updatedAt: z.ZodNullable<z.ZodDate>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
previousUserMessage: z.ZodNullable<z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
content: z.ZodString;
|
|
29
|
+
createdAt: z.ZodDate;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export type MessageOverviewResponse = z.infer<typeof messageOverviewResponseSchema>;
|
|
2
33
|
export declare const sendMessageBodySchema: z.ZodObject<{
|
|
3
34
|
content: z.ZodString;
|
|
4
35
|
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -2,6 +2,30 @@ import { z } from 'zod';
|
|
|
2
2
|
import { telaAgentExecutionInputSchema } from '../integrations/tela-agent-api';
|
|
3
3
|
import { messageSchema } from './conversations';
|
|
4
4
|
import { fileUploadInputSchema, messageFileSchema } from './files';
|
|
5
|
+
import { messageRoleSchema, messageStatusSchema } from './primitives';
|
|
6
|
+
export const messageOverviewResponseSchema = z.strictObject({
|
|
7
|
+
conversation: z.strictObject({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
userId: z.string(),
|
|
10
|
+
model: z.string().nullable(),
|
|
11
|
+
}),
|
|
12
|
+
message: z.strictObject({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
conversationId: z.string(),
|
|
15
|
+
role: messageRoleSchema,
|
|
16
|
+
status: messageStatusSchema.nullable(),
|
|
17
|
+
content: z.string(),
|
|
18
|
+
agentSessionId: z.string().nullable(),
|
|
19
|
+
agentSessionCursor: z.number().int().nullable(),
|
|
20
|
+
createdAt: z.date(),
|
|
21
|
+
updatedAt: z.date().nullable(),
|
|
22
|
+
}),
|
|
23
|
+
previousUserMessage: z.strictObject({
|
|
24
|
+
id: z.string(),
|
|
25
|
+
content: z.string(),
|
|
26
|
+
createdAt: z.date(),
|
|
27
|
+
}).nullable(),
|
|
28
|
+
});
|
|
5
29
|
export const sendMessageBodySchema = z.strictObject({
|
|
6
30
|
content: z.string(),
|
|
7
31
|
files: z.array(fileUploadInputSchema).optional(),
|
|
@@ -52,8 +52,8 @@ export declare const chatModelOptions: readonly [{
|
|
|
52
52
|
}];
|
|
53
53
|
export declare const topbarTabs: readonly ["chat", "files", "usage"];
|
|
54
54
|
export declare const topbarTabSchema: z.ZodEnum<{
|
|
55
|
-
files: "files";
|
|
56
55
|
usage: "usage";
|
|
56
|
+
files: "files";
|
|
57
57
|
chat: "chat";
|
|
58
58
|
}>;
|
|
59
59
|
export type TopbarTab = z.infer<typeof topbarTabSchema>;
|
|
@@ -78,6 +78,12 @@ export declare const mentionItemVariableSchema: z.ZodObject<{
|
|
|
78
78
|
text: "text";
|
|
79
79
|
}>;
|
|
80
80
|
}, z.core.$strip>;
|
|
81
|
+
export declare const mentionItemIdKinds: readonly ["url", "path"];
|
|
82
|
+
export declare const mentionItemIdKindSchema: z.ZodEnum<{
|
|
83
|
+
path: "path";
|
|
84
|
+
url: "url";
|
|
85
|
+
}>;
|
|
86
|
+
export type MentionItemIdKind = z.infer<typeof mentionItemIdKindSchema>;
|
|
81
87
|
export declare const mentionItemSchema: z.ZodObject<{
|
|
82
88
|
id: z.ZodString;
|
|
83
89
|
label: z.ZodString;
|
|
@@ -88,6 +94,10 @@ export declare const mentionItemSchema: z.ZodObject<{
|
|
|
88
94
|
skill: "skill";
|
|
89
95
|
canvas: "canvas";
|
|
90
96
|
}>;
|
|
97
|
+
idKind: z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
path: "path";
|
|
99
|
+
url: "url";
|
|
100
|
+
}>>;
|
|
91
101
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
92
102
|
name: z.ZodString;
|
|
93
103
|
description: z.ZodString;
|
|
@@ -21,11 +21,14 @@ export const mentionItemVariableSchema = z.object({
|
|
|
21
21
|
description: z.string(),
|
|
22
22
|
type: mentionItemVariableTypeSchema,
|
|
23
23
|
});
|
|
24
|
+
export const mentionItemIdKinds = ['url', 'path'];
|
|
25
|
+
export const mentionItemIdKindSchema = z.enum(mentionItemIdKinds);
|
|
24
26
|
export const mentionItemSchema = z.object({
|
|
25
27
|
id: z.string(),
|
|
26
28
|
label: z.string(),
|
|
27
29
|
description: z.string().optional(),
|
|
28
30
|
icon: z.string(),
|
|
29
31
|
category: mentionItemCategorySchema,
|
|
32
|
+
idKind: mentionItemIdKindSchema.optional(),
|
|
30
33
|
variables: z.record(z.string(), mentionItemVariableSchema).optional(),
|
|
31
34
|
});
|
|
@@ -87,10 +87,10 @@ export type ConversationUsageResponse = z.infer<typeof conversationUsageResponse
|
|
|
87
87
|
export declare const workspaceUsageGroupByValues: readonly ["day", "week", "month", "user", "conversation"];
|
|
88
88
|
export declare const workspaceUsageGroupBySchema: z.ZodEnum<{
|
|
89
89
|
user: "user";
|
|
90
|
+
conversation: "conversation";
|
|
90
91
|
day: "day";
|
|
91
92
|
week: "week";
|
|
92
93
|
month: "month";
|
|
93
|
-
conversation: "conversation";
|
|
94
94
|
}>;
|
|
95
95
|
export type WorkspaceUsageGroupBy = z.infer<typeof workspaceUsageGroupBySchema>;
|
|
96
96
|
export declare const workspaceUsageRecordSchema: z.ZodObject<{
|
|
@@ -31,3 +31,17 @@ export declare const workspaceAgentStatusResponseSchema: z.ZodObject<{
|
|
|
31
31
|
}>>;
|
|
32
32
|
}, z.core.$strip>;
|
|
33
33
|
export type WorkspaceAgentStatusResponse = z.infer<typeof workspaceAgentStatusResponseSchema>;
|
|
34
|
+
export declare const workspaceAgentSummaryResponseSchema: z.ZodObject<{
|
|
35
|
+
workspaceId: z.ZodString;
|
|
36
|
+
telaAgentId: z.ZodNullable<z.ZodString>;
|
|
37
|
+
skills: z.ZodArray<z.ZodObject<{
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
description: z.ZodString;
|
|
40
|
+
path: z.ZodString;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
contextFiles: z.ZodArray<z.ZodObject<{
|
|
43
|
+
path: z.ZodString;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type WorkspaceAgentSummaryResponse = z.infer<typeof workspaceAgentSummaryResponseSchema>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { telaAgentContextFileSchema, telaAgentSkillSchema } from '../integrations/tela-agent-api';
|
|
2
3
|
export const workspaceAgentModes = ['default', 'custom', 'setup_required'];
|
|
3
4
|
export const workspaceAgentModeSchema = z.enum(workspaceAgentModes);
|
|
4
5
|
export const workspaceAgentCustomizations = ['system_message', 'context_files', 'canvas_tools', 'external_skills'];
|
|
@@ -10,3 +11,9 @@ export const workspaceAgentStatusResponseSchema = z.object({
|
|
|
10
11
|
telaAgentUrl: z.string().nullable(),
|
|
11
12
|
pendingCustomizations: z.array(workspaceAgentCustomizationSchema),
|
|
12
13
|
});
|
|
14
|
+
export const workspaceAgentSummaryResponseSchema = z.object({
|
|
15
|
+
workspaceId: z.string().min(1),
|
|
16
|
+
telaAgentId: z.string().nullable(),
|
|
17
|
+
skills: z.array(telaAgentSkillSchema),
|
|
18
|
+
contextFiles: z.array(telaAgentContextFileSchema),
|
|
19
|
+
});
|
|
@@ -186,9 +186,9 @@ export type AgentApiSession = z.infer<typeof agentApiSessionSchema>;
|
|
|
186
186
|
export declare const agentSessionStatuses: readonly ["pending", "running", "completed", "failed"];
|
|
187
187
|
export declare const agentSessionStatusSchema: z.ZodEnum<{
|
|
188
188
|
pending: "pending";
|
|
189
|
+
running: "running";
|
|
189
190
|
completed: "completed";
|
|
190
191
|
failed: "failed";
|
|
191
|
-
running: "running";
|
|
192
192
|
}>;
|
|
193
193
|
export type AgentSessionStatus = z.infer<typeof agentSessionStatusSchema>;
|
|
194
194
|
export type AgentApiChatPayload = {
|
|
@@ -58,6 +58,17 @@ export declare const telaAgentRunPayloadSchema: z.ZodObject<{
|
|
|
58
58
|
}, z.core.$strip>>>;
|
|
59
59
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
60
60
|
export type TelaAgentRunPayload = z.infer<typeof telaAgentRunPayloadSchema>;
|
|
61
|
+
export declare const telaAgentSkillSchema: z.ZodObject<{
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
description: z.ZodString;
|
|
64
|
+
path: z.ZodString;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type TelaAgentSkill = z.infer<typeof telaAgentSkillSchema>;
|
|
67
|
+
export declare const telaAgentContextFileSchema: z.ZodObject<{
|
|
68
|
+
path: z.ZodString;
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
export type TelaAgentContextFile = z.infer<typeof telaAgentContextFileSchema>;
|
|
61
72
|
export declare const telaAgentSchema: z.ZodObject<{
|
|
62
73
|
id: z.ZodString;
|
|
63
74
|
organizationName: z.ZodOptional<z.ZodString>;
|
|
@@ -89,8 +100,41 @@ export declare const telaAgentSchema: z.ZodObject<{
|
|
|
89
100
|
description?: string | null | undefined;
|
|
90
101
|
}[] | null | undefined>>;
|
|
91
102
|
isMultiturn: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
103
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
description: z.ZodString;
|
|
106
|
+
path: z.ZodString;
|
|
107
|
+
}, z.core.$strip>>>;
|
|
108
|
+
contextFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
|
+
path: z.ZodString;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
}, z.core.$strip>>>;
|
|
92
112
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
93
113
|
export type TelaAgent = z.infer<typeof telaAgentSchema>;
|
|
114
|
+
export declare const telaAgentSummarySchema: z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
inputSchema: z.ZodArray<z.ZodObject<{
|
|
117
|
+
id: z.ZodOptional<z.ZodString>;
|
|
118
|
+
name: z.ZodString;
|
|
119
|
+
type: z.ZodEnum<{
|
|
120
|
+
file: "file";
|
|
121
|
+
text: "text";
|
|
122
|
+
}>;
|
|
123
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
126
|
+
isMultiturn: z.ZodNullable<z.ZodBoolean>;
|
|
127
|
+
skills: z.ZodArray<z.ZodObject<{
|
|
128
|
+
name: z.ZodString;
|
|
129
|
+
description: z.ZodString;
|
|
130
|
+
path: z.ZodString;
|
|
131
|
+
}, z.core.$strip>>;
|
|
132
|
+
contextFiles: z.ZodArray<z.ZodObject<{
|
|
133
|
+
path: z.ZodString;
|
|
134
|
+
name: z.ZodString;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
export type TelaAgentSummary = z.infer<typeof telaAgentSummarySchema>;
|
|
94
138
|
export declare const telaAgentRunResponseSchema: z.ZodObject<{
|
|
95
139
|
sessionId: z.ZodString;
|
|
96
140
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
@@ -98,9 +142,9 @@ export type TelaAgentRunResponse = z.infer<typeof telaAgentRunResponseSchema>;
|
|
|
98
142
|
export declare const telaAgentSessionStatuses: readonly ["pending", "running", "completed", "failed", "waiting_messages", "cancelled"];
|
|
99
143
|
export declare const telaAgentSessionStatusSchema: z.ZodEnum<{
|
|
100
144
|
pending: "pending";
|
|
145
|
+
running: "running";
|
|
101
146
|
completed: "completed";
|
|
102
147
|
failed: "failed";
|
|
103
|
-
running: "running";
|
|
104
148
|
waiting_messages: "waiting_messages";
|
|
105
149
|
cancelled: "cancelled";
|
|
106
150
|
}>;
|
|
@@ -145,9 +189,9 @@ export declare const telaAgentSessionSchema: z.ZodObject<{
|
|
|
145
189
|
sessionId: z.ZodString;
|
|
146
190
|
status: z.ZodEnum<{
|
|
147
191
|
pending: "pending";
|
|
192
|
+
running: "running";
|
|
148
193
|
completed: "completed";
|
|
149
194
|
failed: "failed";
|
|
150
|
-
running: "running";
|
|
151
195
|
waiting_messages: "waiting_messages";
|
|
152
196
|
cancelled: "cancelled";
|
|
153
197
|
}>;
|
|
@@ -187,8 +231,8 @@ export declare const telaAgentV4SessionStatusEventSchema: z.ZodObject<{
|
|
|
187
231
|
sessionId: z.ZodString;
|
|
188
232
|
status: z.ZodEnum<{
|
|
189
233
|
pending: "pending";
|
|
190
|
-
failed: "failed";
|
|
191
234
|
running: "running";
|
|
235
|
+
failed: "failed";
|
|
192
236
|
cancelled: "cancelled";
|
|
193
237
|
}>;
|
|
194
238
|
error: z.ZodOptional<z.ZodString>;
|
|
@@ -200,9 +244,9 @@ export declare const telaAgentV4SessionStepsEventSchema: z.ZodObject<{
|
|
|
200
244
|
sessionId: z.ZodString;
|
|
201
245
|
status: z.ZodEnum<{
|
|
202
246
|
pending: "pending";
|
|
247
|
+
running: "running";
|
|
203
248
|
completed: "completed";
|
|
204
249
|
failed: "failed";
|
|
205
|
-
running: "running";
|
|
206
250
|
waiting_messages: "waiting_messages";
|
|
207
251
|
cancelled: "cancelled";
|
|
208
252
|
}>;
|
|
@@ -256,8 +300,8 @@ export declare const telaAgentV4SessionStreamEventSchema: z.ZodDiscriminatedUnio
|
|
|
256
300
|
sessionId: z.ZodString;
|
|
257
301
|
status: z.ZodEnum<{
|
|
258
302
|
pending: "pending";
|
|
259
|
-
failed: "failed";
|
|
260
303
|
running: "running";
|
|
304
|
+
failed: "failed";
|
|
261
305
|
cancelled: "cancelled";
|
|
262
306
|
}>;
|
|
263
307
|
error: z.ZodOptional<z.ZodString>;
|
|
@@ -268,9 +312,9 @@ export declare const telaAgentV4SessionStreamEventSchema: z.ZodDiscriminatedUnio
|
|
|
268
312
|
sessionId: z.ZodString;
|
|
269
313
|
status: z.ZodEnum<{
|
|
270
314
|
pending: "pending";
|
|
315
|
+
running: "running";
|
|
271
316
|
completed: "completed";
|
|
272
317
|
failed: "failed";
|
|
273
|
-
running: "running";
|
|
274
318
|
waiting_messages: "waiting_messages";
|
|
275
319
|
cancelled: "cancelled";
|
|
276
320
|
}>;
|
|
@@ -355,6 +399,15 @@ export declare const telaAgentApiResponseSchema: z.ZodObject<{
|
|
|
355
399
|
description?: string | null | undefined;
|
|
356
400
|
}[] | null | undefined>>;
|
|
357
401
|
isMultiturn: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
402
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
403
|
+
name: z.ZodString;
|
|
404
|
+
description: z.ZodString;
|
|
405
|
+
path: z.ZodString;
|
|
406
|
+
}, z.core.$strip>>>;
|
|
407
|
+
contextFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
408
|
+
path: z.ZodString;
|
|
409
|
+
name: z.ZodString;
|
|
410
|
+
}, z.core.$strip>>>;
|
|
358
411
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
359
412
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
360
413
|
export declare const telaAgentResolveApiResponseSchema: z.ZodObject<{
|
|
@@ -389,6 +442,15 @@ export declare const telaAgentResolveApiResponseSchema: z.ZodObject<{
|
|
|
389
442
|
description?: string | null | undefined;
|
|
390
443
|
}[] | null | undefined>>;
|
|
391
444
|
isMultiturn: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
445
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
446
|
+
name: z.ZodString;
|
|
447
|
+
description: z.ZodString;
|
|
448
|
+
path: z.ZodString;
|
|
449
|
+
}, z.core.$strip>>>;
|
|
450
|
+
contextFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
451
|
+
path: z.ZodString;
|
|
452
|
+
name: z.ZodString;
|
|
453
|
+
}, z.core.$strip>>>;
|
|
392
454
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
393
455
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
394
456
|
export declare const telaAgentEndSessionApiResponseSchema: z.ZodObject<{
|
|
@@ -32,6 +32,15 @@ export const telaAgentRunPayloadSchema = z.object({
|
|
|
32
32
|
inputSchema: z.array(telaAgentExecutionInputSchema).optional(),
|
|
33
33
|
attachments: z.array(telaAgentAttachmentSchema).optional(),
|
|
34
34
|
}).catchall(z.unknown());
|
|
35
|
+
export const telaAgentSkillSchema = z.object({
|
|
36
|
+
name: z.string(),
|
|
37
|
+
description: z.string(),
|
|
38
|
+
path: z.string(),
|
|
39
|
+
});
|
|
40
|
+
export const telaAgentContextFileSchema = z.object({
|
|
41
|
+
path: z.string(),
|
|
42
|
+
name: z.string(),
|
|
43
|
+
});
|
|
35
44
|
export const telaAgentSchema = z.object({
|
|
36
45
|
id: z.string(),
|
|
37
46
|
organizationName: z.string().optional(),
|
|
@@ -40,7 +49,16 @@ export const telaAgentSchema = z.object({
|
|
|
40
49
|
allowedCredentials: z.array(z.string()).nullable().optional(),
|
|
41
50
|
inputSchema: z.array(telaAgentInputVariableSchema).nullable().optional().transform(value => value ?? []),
|
|
42
51
|
isMultiturn: z.boolean().nullable().optional(),
|
|
52
|
+
skills: z.array(telaAgentSkillSchema).optional(),
|
|
53
|
+
contextFiles: z.array(telaAgentContextFileSchema).optional(),
|
|
43
54
|
}).catchall(z.unknown());
|
|
55
|
+
export const telaAgentSummarySchema = z.object({
|
|
56
|
+
id: z.string(),
|
|
57
|
+
inputSchema: z.array(telaAgentInputVariableSchema),
|
|
58
|
+
isMultiturn: z.boolean().nullable(),
|
|
59
|
+
skills: z.array(telaAgentSkillSchema),
|
|
60
|
+
contextFiles: z.array(telaAgentContextFileSchema),
|
|
61
|
+
});
|
|
44
62
|
export const telaAgentRunResponseSchema = z.object({
|
|
45
63
|
sessionId: z.string(),
|
|
46
64
|
}).catchall(z.unknown());
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/nuxt";
|
|
2
|
+
import { workspaceAgentSummaryResponseSchema } from "../../types/schemas/chat/workspace-agent.js";
|
|
3
|
+
import { useChatAuth } from "#chat-auth";
|
|
4
|
+
import { useChatApi } from "../../shared/composables/chat-api.js";
|
|
5
|
+
import { useEmbedConfig } from "../../embed/composables/embed-config.js";
|
|
6
|
+
export function useWorkspaceAgentSummary() {
|
|
7
|
+
const chatApi = useChatApi();
|
|
8
|
+
const embedConfig = useEmbedConfig();
|
|
9
|
+
const { activeOrganization } = useChatAuth();
|
|
10
|
+
const workspaceScope = computed(() => embedConfig?.workspaceId.value.trim() || activeOrganization.value?.id?.trim() || "default");
|
|
11
|
+
const summaryBuckets = useState("workspace-agent-summary", () => ({}));
|
|
12
|
+
const loadingBuckets = useState("workspace-agent-summary-loading", () => ({}));
|
|
13
|
+
const summary = computed(() => summaryBuckets.value[workspaceScope.value] ?? null);
|
|
14
|
+
const loading = computed(() => loadingBuckets.value[workspaceScope.value] ?? false);
|
|
15
|
+
function requestArgs() {
|
|
16
|
+
if (embedConfig !== null)
|
|
17
|
+
return [chatApi.path("/workspace/agent/summary"), chatApi.withChatHeaders()];
|
|
18
|
+
return ["/api/workspace/agent/summary", void 0];
|
|
19
|
+
}
|
|
20
|
+
async function fetchSummary() {
|
|
21
|
+
const scope = workspaceScope.value;
|
|
22
|
+
const cached = summaryBuckets.value[scope];
|
|
23
|
+
if (cached)
|
|
24
|
+
return cached;
|
|
25
|
+
loadingBuckets.value = {
|
|
26
|
+
...loadingBuckets.value,
|
|
27
|
+
[scope]: true
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
const [path, options] = requestArgs();
|
|
31
|
+
const parsed = workspaceAgentSummaryResponseSchema.safeParse(await $fetch(path, options));
|
|
32
|
+
if (!parsed.success)
|
|
33
|
+
throw new Error("Invalid workspace agent summary response");
|
|
34
|
+
summaryBuckets.value = {
|
|
35
|
+
...summaryBuckets.value,
|
|
36
|
+
[scope]: parsed.data
|
|
37
|
+
};
|
|
38
|
+
return parsed.data;
|
|
39
|
+
} catch (e) {
|
|
40
|
+
Sentry.captureException(e);
|
|
41
|
+
return null;
|
|
42
|
+
} finally {
|
|
43
|
+
loadingBuckets.value = {
|
|
44
|
+
...loadingBuckets.value,
|
|
45
|
+
[scope]: false
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
summary,
|
|
51
|
+
loading,
|
|
52
|
+
fetchSummary
|
|
53
|
+
};
|
|
54
|
+
}
|
package/dist/types.d.mts
CHANGED
|
@@ -4,7 +4,9 @@ import type { default as Module } from './module.mjs'
|
|
|
4
4
|
|
|
5
5
|
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { ChatMessageStatus } from '../dist/runtime/messages/composables/chat-message-terminal.js'
|
|
8
|
+
|
|
9
|
+
export { type ChatActionPayload, type ChatActor, type ChatEmbedSharedProps, type ChatFeatureConfig, type ChatMessageTerminalPayload, type ChatSidebarConfig, type DefaultChatEmbedProps, type MeistrariChatEmbedProps, type MessageFeedbackConfig, type MessageFeedbackPayload, type MessageFeedbackRating, type MessageOverviewResponse, type TelaAgentChatEmbedProps, type TelaAgentExecutionInput } from '../dist/runtime/types/embed.js'
|
|
8
10
|
|
|
9
11
|
export { default } from './module.mjs'
|
|
10
12
|
|