@meistrari/chat-nuxt 4.9.0 → 4.10.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/embed/components/chat-embed-inner.d.vue.ts +9 -9
- package/dist/runtime/embed/components/chat-embed-inner.vue +15 -3
- package/dist/runtime/embed/components/chat-embed-inner.vue.d.ts +9 -9
- package/dist/runtime/messages/composables/use-stick-to-bottom.d.ts +5 -0
- package/dist/runtime/messages/composables/use-stick-to-bottom.js +3 -0
- package/dist/runtime/types/schemas/chat/v3.d.ts +55 -0
- package/dist/runtime/types/schemas/chat/v3.js +37 -0
- package/dist/runtime/types/schemas/integrations/agent-events.d.ts +901 -0
- package/dist/runtime/types/schemas/integrations/agent-events.js +353 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -19,27 +19,27 @@ type __VLS_Props = {
|
|
|
19
19
|
user?: EmbedUser | null;
|
|
20
20
|
features?: Partial<ChatFeatureConfig>;
|
|
21
21
|
};
|
|
22
|
-
declare var __VLS_14: {}, __VLS_92: {},
|
|
22
|
+
declare var __VLS_14: {}, __VLS_92: {}, __VLS_107: {
|
|
23
23
|
message: useChatAuth;
|
|
24
|
-
},
|
|
24
|
+
}, __VLS_120: {}, __VLS_129: {}, __VLS_193: {}, __VLS_214: {
|
|
25
25
|
message: useChatAuth;
|
|
26
|
-
},
|
|
26
|
+
}, __VLS_227: {};
|
|
27
27
|
type __VLS_Slots = {} & {
|
|
28
28
|
'sidebar-bottom'?: (props: typeof __VLS_14) => any;
|
|
29
29
|
} & {
|
|
30
30
|
'composer-bottom'?: (props: typeof __VLS_92) => any;
|
|
31
31
|
} & {
|
|
32
|
-
'failed-message-actions'?: (props: typeof
|
|
32
|
+
'failed-message-actions'?: (props: typeof __VLS_107) => any;
|
|
33
33
|
} & {
|
|
34
|
-
'composer-bottom'?: (props: typeof
|
|
34
|
+
'composer-bottom'?: (props: typeof __VLS_120) => any;
|
|
35
35
|
} & {
|
|
36
|
-
'topbar-leading'?: (props: typeof
|
|
36
|
+
'topbar-leading'?: (props: typeof __VLS_129) => any;
|
|
37
37
|
} & {
|
|
38
|
-
'composer-bottom'?: (props: typeof
|
|
38
|
+
'composer-bottom'?: (props: typeof __VLS_193) => any;
|
|
39
39
|
} & {
|
|
40
|
-
'failed-message-actions'?: (props: typeof
|
|
40
|
+
'failed-message-actions'?: (props: typeof __VLS_214) => any;
|
|
41
41
|
} & {
|
|
42
|
-
'composer-bottom'?: (props: typeof
|
|
42
|
+
'composer-bottom'?: (props: typeof __VLS_227) => any;
|
|
43
43
|
};
|
|
44
44
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
45
45
|
"update:conversationId": (value: string | null) => any;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { inject, provide, useSlots } from "vue";
|
|
3
3
|
import { useChatHarnessAdapter } from "../composables/harness-adapter";
|
|
4
4
|
import ChatMessageList from "../../messages/components/chat-message-list.vue";
|
|
5
|
+
import { shouldScrollOnComposerResize } from "../../messages/composables/use-stick-to-bottom";
|
|
5
6
|
import { CHAT_COMPOSER_EXTENSION_KEY } from "../../types/composer";
|
|
6
7
|
import { CHAT_MESSAGE_SEND_KEY } from "../../types/messages";
|
|
7
8
|
import { useChatAuth } from "#chat-auth";
|
|
8
|
-
import { useBreakpoints } from "@vueuse/core";
|
|
9
|
+
import { useBreakpoints, useResizeObserver } from "@vueuse/core";
|
|
9
10
|
import { useCitationPanel } from "../../citations/composables/citation-panel";
|
|
10
11
|
import { exportConversationToMarkdown } from "../../conversations/export";
|
|
11
12
|
import { CHAT_MOBILE_BREAKPOINT } from "../../shared/breakpoints";
|
|
@@ -175,6 +176,15 @@ provide("chat-answer-target", answerTarget);
|
|
|
175
176
|
function setAnswerTarget(el) {
|
|
176
177
|
answerTarget.value = el instanceof HTMLElement ? el : null;
|
|
177
178
|
}
|
|
179
|
+
const messageListRef = ref(null);
|
|
180
|
+
const composerRef = ref(null);
|
|
181
|
+
let composerHeights = { composer: 0, dock: 0 };
|
|
182
|
+
useResizeObserver(composerRef, ([entry]) => {
|
|
183
|
+
const next = { composer: entry?.contentRect.height ?? 0, dock: answerTarget.value?.offsetHeight ?? 0 };
|
|
184
|
+
if (shouldScrollOnComposerResize(composerHeights, next, Boolean(messageListRef.value?.isPinned)))
|
|
185
|
+
requestAnimationFrame(() => messageListRef.value?.scrollToBottom());
|
|
186
|
+
composerHeights = next;
|
|
187
|
+
});
|
|
178
188
|
const messageInputRef = ref(null);
|
|
179
189
|
const PROMPT_INPUT_HINTS = [
|
|
180
190
|
{ icon: "i-ph-at-bold", label: "Para mencionar arquivos" },
|
|
@@ -1053,6 +1063,7 @@ async function handleDelete() {
|
|
|
1053
1063
|
|
|
1054
1064
|
<ChatMessageList
|
|
1055
1065
|
:key="currentConversation?.id ?? 'draft'"
|
|
1066
|
+
ref="messageListRef"
|
|
1056
1067
|
:messages="messages"
|
|
1057
1068
|
:events="displayConversationEvents"
|
|
1058
1069
|
:streaming-active-message-id="streamingActiveMessageId"
|
|
@@ -1069,7 +1080,7 @@ async function handleDelete() {
|
|
|
1069
1080
|
<slot name="failed-message-actions" v-bind="slotProps" />
|
|
1070
1081
|
</template>
|
|
1071
1082
|
</ChatMessageList>
|
|
1072
|
-
<div data-chat-composer flex="~ col" gap-12px min-h-0>
|
|
1083
|
+
<div ref="composerRef" data-chat-composer flex="~ col" gap-12px min-h-0>
|
|
1073
1084
|
<div :ref="setAnswerTarget" data-chat-answer-dock class="empty:hidden max-h-[50dvh] overflow-y-auto" />
|
|
1074
1085
|
<ChatMessageInput
|
|
1075
1086
|
ref="messageInputRef"
|
|
@@ -1266,6 +1277,7 @@ async function handleDelete() {
|
|
|
1266
1277
|
>
|
|
1267
1278
|
<ChatMessageList
|
|
1268
1279
|
:key="currentConversation?.id ?? 'draft'"
|
|
1280
|
+
ref="messageListRef"
|
|
1269
1281
|
:messages="messages"
|
|
1270
1282
|
:events="displayConversationEvents"
|
|
1271
1283
|
:streaming-active-message-id="streamingActiveMessageId"
|
|
@@ -1282,7 +1294,7 @@ async function handleDelete() {
|
|
|
1282
1294
|
<slot name="failed-message-actions" v-bind="slotProps" />
|
|
1283
1295
|
</template>
|
|
1284
1296
|
</ChatMessageList>
|
|
1285
|
-
<div data-chat-composer flex="~ col" gap-12px min-h-0>
|
|
1297
|
+
<div ref="composerRef" data-chat-composer flex="~ col" gap-12px min-h-0>
|
|
1286
1298
|
<div :ref="setAnswerTarget" data-chat-answer-dock class="empty:hidden max-h-[50dvh] overflow-y-auto" />
|
|
1287
1299
|
<ChatMessageInput
|
|
1288
1300
|
ref="messageInputRef"
|
|
@@ -19,27 +19,27 @@ type __VLS_Props = {
|
|
|
19
19
|
user?: EmbedUser | null;
|
|
20
20
|
features?: Partial<ChatFeatureConfig>;
|
|
21
21
|
};
|
|
22
|
-
declare var __VLS_14: {}, __VLS_92: {},
|
|
22
|
+
declare var __VLS_14: {}, __VLS_92: {}, __VLS_107: {
|
|
23
23
|
message: useChatAuth;
|
|
24
|
-
},
|
|
24
|
+
}, __VLS_120: {}, __VLS_129: {}, __VLS_193: {}, __VLS_214: {
|
|
25
25
|
message: useChatAuth;
|
|
26
|
-
},
|
|
26
|
+
}, __VLS_227: {};
|
|
27
27
|
type __VLS_Slots = {} & {
|
|
28
28
|
'sidebar-bottom'?: (props: typeof __VLS_14) => any;
|
|
29
29
|
} & {
|
|
30
30
|
'composer-bottom'?: (props: typeof __VLS_92) => any;
|
|
31
31
|
} & {
|
|
32
|
-
'failed-message-actions'?: (props: typeof
|
|
32
|
+
'failed-message-actions'?: (props: typeof __VLS_107) => any;
|
|
33
33
|
} & {
|
|
34
|
-
'composer-bottom'?: (props: typeof
|
|
34
|
+
'composer-bottom'?: (props: typeof __VLS_120) => any;
|
|
35
35
|
} & {
|
|
36
|
-
'topbar-leading'?: (props: typeof
|
|
36
|
+
'topbar-leading'?: (props: typeof __VLS_129) => any;
|
|
37
37
|
} & {
|
|
38
|
-
'composer-bottom'?: (props: typeof
|
|
38
|
+
'composer-bottom'?: (props: typeof __VLS_193) => any;
|
|
39
39
|
} & {
|
|
40
|
-
'failed-message-actions'?: (props: typeof
|
|
40
|
+
'failed-message-actions'?: (props: typeof __VLS_214) => any;
|
|
41
41
|
} & {
|
|
42
|
-
'composer-bottom'?: (props: typeof
|
|
42
|
+
'composer-bottom'?: (props: typeof __VLS_227) => any;
|
|
43
43
|
};
|
|
44
44
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
45
45
|
"update:conversationId": (value: string | null) => any;
|
|
@@ -16,6 +16,11 @@ interface ScrollSnapshot {
|
|
|
16
16
|
* user reading upwards, so it keeps whatever state was in place.
|
|
17
17
|
*/
|
|
18
18
|
export declare function resolvePinnedAfterScroll(pinned: boolean, previous: ScrollSnapshot, { scrollTop, scrollHeight, clientHeight }: ScrollMetrics, threshold: number): boolean;
|
|
19
|
+
interface ComposerHeights {
|
|
20
|
+
composer: number;
|
|
21
|
+
dock: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function shouldScrollOnComposerResize(previous: ComposerHeights, next: ComposerHeights, pinned: boolean): boolean;
|
|
19
24
|
export declare function useStickToBottom(scrollRoot: Ref<HTMLElement | null>, contentRoot: Ref<HTMLElement | null>): {
|
|
20
25
|
bottomPinned: Ref<boolean, boolean>;
|
|
21
26
|
hasRoomBelow: Ref<boolean, boolean>;
|
|
@@ -14,6 +14,9 @@ export function resolvePinnedAfterScroll(pinned, previous, { scrollTop, scrollHe
|
|
|
14
14
|
return true;
|
|
15
15
|
return pinned;
|
|
16
16
|
}
|
|
17
|
+
export function shouldScrollOnComposerResize(previous, next, pinned) {
|
|
18
|
+
return next.composer > previous.composer && (next.dock > previous.dock || pinned);
|
|
19
|
+
}
|
|
17
20
|
export function useStickToBottom(scrollRoot, contentRoot) {
|
|
18
21
|
const bottomPinned = ref(true);
|
|
19
22
|
const hasRoomBelow = ref(false);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Chat API v3 (`/v3/chat`): the conversational surface over agent-api v5 events-v1.
|
|
4
|
+
* The chat-api owns the conversation; agent-api owns the session and its history.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CHAT_V3_CONTRACT_VERSION = "events-v1";
|
|
7
|
+
/** Where the agent of the request stands in the v5 catalog. */
|
|
8
|
+
export declare const chatV3AgentStatusSchema: z.ZodEnum<{
|
|
9
|
+
ready: "ready";
|
|
10
|
+
not_requested: "not_requested";
|
|
11
|
+
not_in_catalog: "not_in_catalog";
|
|
12
|
+
not_published: "not_published";
|
|
13
|
+
}>;
|
|
14
|
+
export type ChatV3AgentStatus = z.infer<typeof chatV3AgentStatusSchema>;
|
|
15
|
+
export declare const chatV3AgentSchema: z.ZodObject<{
|
|
16
|
+
agentId: z.ZodString;
|
|
17
|
+
repository: z.ZodString;
|
|
18
|
+
harness: z.ZodNullable<z.ZodEnum<{
|
|
19
|
+
claude: "claude";
|
|
20
|
+
lightweight: "lightweight";
|
|
21
|
+
codex: "codex";
|
|
22
|
+
}>>;
|
|
23
|
+
model: z.ZodNullable<z.ZodString>;
|
|
24
|
+
publishedSnapshotId: z.ZodNullable<z.ZodString>;
|
|
25
|
+
publishedCommitSha: z.ZodNullable<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export type ChatV3Agent = z.infer<typeof chatV3AgentSchema>;
|
|
28
|
+
export declare const chatV3ConfigurationSchema: z.ZodObject<{
|
|
29
|
+
apiVersion: z.ZodLiteral<3>;
|
|
30
|
+
contractVersion: z.ZodLiteral<"events-v1">;
|
|
31
|
+
agentStatus: z.ZodEnum<{
|
|
32
|
+
ready: "ready";
|
|
33
|
+
not_requested: "not_requested";
|
|
34
|
+
not_in_catalog: "not_in_catalog";
|
|
35
|
+
not_published: "not_published";
|
|
36
|
+
}>;
|
|
37
|
+
agent: z.ZodNullable<z.ZodObject<{
|
|
38
|
+
agentId: z.ZodString;
|
|
39
|
+
repository: z.ZodString;
|
|
40
|
+
harness: z.ZodNullable<z.ZodEnum<{
|
|
41
|
+
claude: "claude";
|
|
42
|
+
lightweight: "lightweight";
|
|
43
|
+
codex: "codex";
|
|
44
|
+
}>>;
|
|
45
|
+
model: z.ZodNullable<z.ZodString>;
|
|
46
|
+
publishedSnapshotId: z.ZodNullable<z.ZodString>;
|
|
47
|
+
publishedCommitSha: z.ZodNullable<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
limits: z.ZodObject<{
|
|
50
|
+
messageTextChars: z.ZodNumber;
|
|
51
|
+
inlinePayloadBytes: z.ZodNumber;
|
|
52
|
+
eventsPerRequest: z.ZodNumber;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type ChatV3Configuration = z.infer<typeof chatV3ConfigurationSchema>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { v5HarnessSchema } from '../integrations/agent-events';
|
|
3
|
+
/**
|
|
4
|
+
* Chat API v3 (`/v3/chat`): the conversational surface over agent-api v5 events-v1.
|
|
5
|
+
* The chat-api owns the conversation; agent-api owns the session and its history.
|
|
6
|
+
*/
|
|
7
|
+
export const CHAT_V3_CONTRACT_VERSION = 'events-v1';
|
|
8
|
+
/** Where the agent of the request stands in the v5 catalog. */
|
|
9
|
+
export const chatV3AgentStatusSchema = z.enum([
|
|
10
|
+
/** No `telaAgentId` on the request: nothing to resolve yet. */
|
|
11
|
+
'not_requested',
|
|
12
|
+
/** Tela knows the agent, but the v5 catalog does not: Tela has to create it there. */
|
|
13
|
+
'not_in_catalog',
|
|
14
|
+
/** In the catalog without a publication: `POST /v5/agents/snapshots` first. */
|
|
15
|
+
'not_published',
|
|
16
|
+
/** Published: a session can start. */
|
|
17
|
+
'ready',
|
|
18
|
+
]);
|
|
19
|
+
export const chatV3AgentSchema = z.object({
|
|
20
|
+
agentId: z.string().uuid(),
|
|
21
|
+
repository: z.string(),
|
|
22
|
+
harness: v5HarnessSchema.nullable(),
|
|
23
|
+
model: z.string().nullable(),
|
|
24
|
+
publishedSnapshotId: z.string().uuid().nullable(),
|
|
25
|
+
publishedCommitSha: z.string().nullable(),
|
|
26
|
+
});
|
|
27
|
+
export const chatV3ConfigurationSchema = z.object({
|
|
28
|
+
apiVersion: z.literal(3),
|
|
29
|
+
contractVersion: z.literal(CHAT_V3_CONTRACT_VERSION),
|
|
30
|
+
agentStatus: chatV3AgentStatusSchema,
|
|
31
|
+
agent: chatV3AgentSchema.nullable(),
|
|
32
|
+
limits: z.object({
|
|
33
|
+
messageTextChars: z.number().int().positive(),
|
|
34
|
+
inlinePayloadBytes: z.number().int().positive(),
|
|
35
|
+
eventsPerRequest: z.number().int().positive(),
|
|
36
|
+
}),
|
|
37
|
+
});
|