@meistrari/chat-nuxt 3.17.0-rc.2 → 3.17.0-rc.4
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 +1 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/embed/components/chat-embed.vue +4 -1
- package/dist/runtime/embed/components/meistrari-chat-embed.vue +2 -0
- package/dist/runtime/embed/types.d.ts +2 -0
- package/dist/runtime/server/utils/chat-api-proxy.js +5 -1
- package/dist/runtime/shared/composables/chat-api.js +4 -0
- package/dist/runtime/shared/composables/chat-request-context.d.ts +2 -0
- package/dist/runtime/shared/composables/chat-request-context.js +4 -0
- package/dist/runtime/types/schemas/chat/chat-config.d.ts +1 -0
- package/dist/runtime/types/schemas/chat/chat-config.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,6 +59,7 @@ Declared in `src/runtime/embed/types.ts`; prop, feature-flag, and event payload
|
|
|
59
59
|
| `conversationCreatorFilter` | `'all' \| 'mine'` | — | Controlled sidebar creator filter; use with `v-model:conversation-creator-filter` when the host changes it at runtime |
|
|
60
60
|
| `hideConversationCreatorFilter` | `boolean` | `false` | Hide the creator selector without changing the active filter |
|
|
61
61
|
| `telaAgentId` | `string` | — | Use Tela agent mode for this embed |
|
|
62
|
+
| `telaAgentBranch` | `string` | Published version | Repository branch to use for new agent sessions |
|
|
62
63
|
| `telaAgentInputs` | `TelaAgentExecutionInput[] \| null` | `undefined` | Inputs sent with each Tela agent run; hides the variables panel when non-null |
|
|
63
64
|
| `workspaceSettings` | `WorkspaceSettings \| null` | `null` | Override settings from host app; not accepted in Tela agent mode |
|
|
64
65
|
| `user` | `ChatActor \| null` | `null` | Override current user display info; not accepted in Tela agent mode |
|
package/dist/module.d.mts
CHANGED
|
@@ -34,6 +34,13 @@ interface ChatNuxtModuleOptions {
|
|
|
34
34
|
* `NUXT_CHAT_NUXT_SECRETLESS_EXECUTION`.
|
|
35
35
|
*/
|
|
36
36
|
secretlessExecution?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Opt this deployment into the experimental agent-api v5 snapshot path: the
|
|
39
|
+
* server proxy adds `"agent-api-v5": true` to the `x-chat-config` header, so
|
|
40
|
+
* wake and execute prefer the published snapshot (with v4 fallback). Defaults
|
|
41
|
+
* to `false`; also settable via `NUXT_CHAT_NUXT_AGENT_API_V5`.
|
|
42
|
+
*/
|
|
43
|
+
agentApiV5?: boolean;
|
|
37
44
|
}
|
|
38
45
|
declare const _default: any;
|
|
39
46
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -451,7 +451,8 @@ const module$1 = defineNuxtModule({
|
|
|
451
451
|
authTokenCookie: hostAuthComposablePath ? options.authTokenCookie || existingChatNuxtRuntimeConfig?.authTokenCookie : void 0,
|
|
452
452
|
// Explicit boolean default keeps the key in runtime config so the
|
|
453
453
|
// NUXT_CHAT_NUXT_SECRETLESS_EXECUTION env override can apply.
|
|
454
|
-
secretlessExecution: options.secretlessExecution ?? existingChatNuxtRuntimeConfig?.secretlessExecution ?? false
|
|
454
|
+
secretlessExecution: options.secretlessExecution ?? existingChatNuxtRuntimeConfig?.secretlessExecution ?? false,
|
|
455
|
+
agentApiV5: options.agentApiV5 ?? existingChatNuxtRuntimeConfig?.agentApiV5 ?? false
|
|
455
456
|
};
|
|
456
457
|
if (hostAuthComposablePath && !rc.chatNuxt.authTokenCookie) {
|
|
457
458
|
console.warn(
|
|
@@ -9,6 +9,7 @@ import { provideEmbedConfig, useEmbedConfig } from "../composables/embed-config"
|
|
|
9
9
|
import { normalizeConversationScope, normalizeTelaAgentId, resolveConversationScopeKeySegment } from "../../conversations/scope";
|
|
10
10
|
import ChatEmbedInner from "./chat-embed-inner.vue";
|
|
11
11
|
const props = defineProps({
|
|
12
|
+
telaAgentBranch: { type: [String, null], required: false },
|
|
12
13
|
conversationId: { type: [String, null], required: false },
|
|
13
14
|
conversationEvents: { type: [Array, null], required: false },
|
|
14
15
|
composerDisabled: { type: Boolean, required: false },
|
|
@@ -44,6 +45,7 @@ const parentEmbedConfig = useEmbedConfig();
|
|
|
44
45
|
const { activeOrganization } = useChatAuth();
|
|
45
46
|
const workspaceId = computed(() => activeOrganization.value?.id?.trim() ?? "");
|
|
46
47
|
const normalizedTelaAgentId = computed(() => normalizeTelaAgentId(props.telaAgentId));
|
|
48
|
+
const telaAgentBranch = computed(() => props.telaAgentBranch?.trim() || null);
|
|
47
49
|
const normalizedConversationScope = computed(() => normalizeConversationScope(props.conversationScope));
|
|
48
50
|
const hideSettings = computed(() => props.hideSettings ?? false);
|
|
49
51
|
const ignoredPropsWarningKey = ref(null);
|
|
@@ -74,6 +76,7 @@ provideEmbedConfig({
|
|
|
74
76
|
provideChatRequestContext({
|
|
75
77
|
workspaceId,
|
|
76
78
|
telaAgentId: normalizedTelaAgentId,
|
|
79
|
+
telaAgentBranch,
|
|
77
80
|
conversationScope: normalizedConversationScope
|
|
78
81
|
}, { syncGlobal: !parentEmbedConfig });
|
|
79
82
|
if (import.meta.dev) {
|
|
@@ -109,7 +112,7 @@ provideChatMessageTerminal((payload) => {
|
|
|
109
112
|
<template>
|
|
110
113
|
<ChatEmbedInner
|
|
111
114
|
v-if="workspaceId"
|
|
112
|
-
:key="`${workspaceId}:${normalizedTelaAgentId ?? 'default-chat'}:scope:${resolveConversationScopeKeySegment(normalizedConversationScope)}`"
|
|
115
|
+
:key="`${workspaceId}:${normalizedTelaAgentId ?? 'default-chat'}:branch:${telaAgentBranch ?? ''}:scope:${resolveConversationScopeKeySegment(normalizedConversationScope)}`"
|
|
113
116
|
:conversation-id="conversationId"
|
|
114
117
|
:conversation-events="conversationEvents"
|
|
115
118
|
:composer-disabled="composerDisabled"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, ref, watch } from "vue";
|
|
3
3
|
import { provideConversationCreatorFilterState } from "../../conversations/composables/conversation-creator-filter-state";
|
|
4
4
|
const { hideSidebar = void 0, ...props } = defineProps({
|
|
5
|
+
telaAgentBranch: { type: [String, null], required: false },
|
|
5
6
|
conversationId: { type: [String, null], required: false },
|
|
6
7
|
conversationEvents: { type: [Array, null], required: false },
|
|
7
8
|
composerDisabled: { type: Boolean, required: false },
|
|
@@ -61,6 +62,7 @@ function startWidgetConversation() {
|
|
|
61
62
|
handleWidgetConversationIdChange(null);
|
|
62
63
|
}
|
|
63
64
|
const sharedEmbedProps = computed(() => ({
|
|
65
|
+
telaAgentBranch: props.telaAgentBranch,
|
|
64
66
|
conversationId: props.conversationId,
|
|
65
67
|
conversationEvents: props.conversationEvents,
|
|
66
68
|
composerDisabled: props.composerDisabled,
|
|
@@ -41,6 +41,8 @@ export type ChatSidebarConfig = {
|
|
|
41
41
|
defaultCollapsed?: boolean;
|
|
42
42
|
};
|
|
43
43
|
export type ChatEmbedSharedProps = {
|
|
44
|
+
/** Optional repository branch for new agent sessions. Omit to use the published version. */
|
|
45
|
+
telaAgentBranch?: string | null;
|
|
44
46
|
/** Controlled conversation id. Use with `v-model:conversation-id` when the host owns active conversation state. */
|
|
45
47
|
conversationId?: string | null;
|
|
46
48
|
/** Controlled audit events rendered chronologically between conversation messages. */
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { PREPARED_AGENT_RUNTIME_CONFIG_KEY, SECRETLESS_EXECUTION_CONFIG_KEY } from "../../types/schemas/chat/chat-config.js";
|
|
1
|
+
import { AGENT_API_V5_CONFIG_KEY, PREPARED_AGENT_RUNTIME_CONFIG_KEY, SECRETLESS_EXECUTION_CONFIG_KEY } from "../../types/schemas/chat/chat-config.js";
|
|
2
2
|
import { createError, defineEventHandler, getHeader, getRequestURL, getRouterParam, proxyRequest } from "h3";
|
|
3
3
|
import { useRuntimeConfig } from "nitropack/runtime";
|
|
4
4
|
import { resolveAuthToken } from "./auth-token.js";
|
|
5
5
|
const CHAT_COMPAT_HEADERS = [
|
|
6
6
|
"x-chat-workspace-id",
|
|
7
7
|
"x-chat-tela-agent-id",
|
|
8
|
+
"x-chat-tela-agent-branch",
|
|
8
9
|
"x-chat-conversation-scope"
|
|
9
10
|
];
|
|
10
11
|
function normalizeProxyPath(path) {
|
|
@@ -63,6 +64,9 @@ function buildProxyHeaders(event) {
|
|
|
63
64
|
if (config.chatNuxt?.secretlessExecution) {
|
|
64
65
|
chatConfig[SECRETLESS_EXECUTION_CONFIG_KEY] = true;
|
|
65
66
|
}
|
|
67
|
+
if (config.chatNuxt?.agentApiV5) {
|
|
68
|
+
chatConfig[AGENT_API_V5_CONFIG_KEY] = true;
|
|
69
|
+
}
|
|
66
70
|
const headers = {
|
|
67
71
|
"authorization": `Bearer ${token}`,
|
|
68
72
|
"x-chat-client": "chat-nuxt",
|
|
@@ -15,6 +15,10 @@ export function useChatApi() {
|
|
|
15
15
|
if (telaAgentId) {
|
|
16
16
|
mergedHeaders["x-chat-tela-agent-id"] = telaAgentId;
|
|
17
17
|
}
|
|
18
|
+
const telaAgentBranch = requestContext?.telaAgentBranch?.value?.trim();
|
|
19
|
+
if (telaAgentBranch) {
|
|
20
|
+
mergedHeaders["x-chat-tela-agent-branch"] = telaAgentBranch;
|
|
21
|
+
}
|
|
18
22
|
const conversationScope = requestContext?.conversationScope.value?.trim();
|
|
19
23
|
if (conversationScope) {
|
|
20
24
|
mergedHeaders["x-chat-conversation-scope"] = conversationScope;
|
|
@@ -2,11 +2,13 @@ import type { MaybeRefOrGetter, Ref } from 'vue';
|
|
|
2
2
|
export type ChatRequestContext = {
|
|
3
3
|
workspaceId: Ref<string>;
|
|
4
4
|
telaAgentId: Ref<string | null>;
|
|
5
|
+
telaAgentBranch: Ref<string | null>;
|
|
5
6
|
conversationScope: Ref<string | null>;
|
|
6
7
|
};
|
|
7
8
|
type ChatRequestContextInput = {
|
|
8
9
|
workspaceId: MaybeRefOrGetter<string | null | undefined>;
|
|
9
10
|
telaAgentId?: MaybeRefOrGetter<string | null | undefined>;
|
|
11
|
+
telaAgentBranch?: MaybeRefOrGetter<string | null | undefined>;
|
|
10
12
|
conversationScope?: MaybeRefOrGetter<string | null | undefined>;
|
|
11
13
|
};
|
|
12
14
|
type ProvideChatRequestContextOptions = {
|
|
@@ -8,6 +8,7 @@ function useGlobalChatRequestContextState() {
|
|
|
8
8
|
provided: useState("chat-request-context-provided", () => false),
|
|
9
9
|
workspaceId: useState("chat-request-context-workspace-id", () => ""),
|
|
10
10
|
telaAgentId: useState("chat-request-context-tela-agent-id", () => null),
|
|
11
|
+
telaAgentBranch: useState("chat-request-context-tela-agent-branch", () => null),
|
|
11
12
|
conversationScope: useState("chat-request-context-conversation-scope", () => null)
|
|
12
13
|
};
|
|
13
14
|
}
|
|
@@ -15,6 +16,7 @@ export function provideChatRequestContext(input, options = {}) {
|
|
|
15
16
|
const context = {
|
|
16
17
|
workspaceId: computed(() => normalizeOptionalHeaderValue(toValue(input.workspaceId)) ?? ""),
|
|
17
18
|
telaAgentId: computed(() => normalizeOptionalHeaderValue(toValue(input.telaAgentId))),
|
|
19
|
+
telaAgentBranch: computed(() => normalizeOptionalHeaderValue(toValue(input.telaAgentBranch))),
|
|
18
20
|
conversationScope: computed(() => normalizeOptionalHeaderValue(toValue(input.conversationScope)))
|
|
19
21
|
};
|
|
20
22
|
const globalContext = useGlobalChatRequestContextState();
|
|
@@ -23,6 +25,7 @@ export function provideChatRequestContext(input, options = {}) {
|
|
|
23
25
|
globalContext.provided.value = true;
|
|
24
26
|
globalContext.workspaceId.value = context.workspaceId.value;
|
|
25
27
|
globalContext.telaAgentId.value = context.telaAgentId.value;
|
|
28
|
+
globalContext.telaAgentBranch.value = context.telaAgentBranch.value;
|
|
26
29
|
globalContext.conversationScope.value = context.conversationScope.value;
|
|
27
30
|
});
|
|
28
31
|
}
|
|
@@ -38,6 +41,7 @@ export function useChatRequestContext() {
|
|
|
38
41
|
return {
|
|
39
42
|
workspaceId: computed(() => globalContext.workspaceId.value),
|
|
40
43
|
telaAgentId: computed(() => globalContext.telaAgentId.value),
|
|
44
|
+
telaAgentBranch: computed(() => globalContext.telaAgentBranch.value),
|
|
41
45
|
conversationScope: computed(() => globalContext.conversationScope.value)
|
|
42
46
|
};
|
|
43
47
|
}
|