@meistrari/chat-nuxt 4.14.0-rc.8 → 4.14.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.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meistrari/chat-nuxt",
3
3
  "configKey": "chatNuxt",
4
- "version": "4.14.0-rc.8",
4
+ "version": "4.14.0-rc.10",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -314,7 +314,7 @@ function dropTargetClass(row) {
314
314
  Pastas
315
315
  </span>
316
316
  <TelaIconButton
317
- icon="i-ph-folder-plus"
317
+ icon="i-ph-plus"
318
318
  color="secondary"
319
319
  size="sm"
320
320
  button-class="p-3px! rounded-6px!"
@@ -10,12 +10,12 @@ type __VLS_Props = {
10
10
  userImage?: string;
11
11
  };
12
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
13
- select: (id: string) => any;
14
13
  close: () => any;
14
+ select: (id: string) => any;
15
15
  newConvo: (groupId?: string | null | undefined) => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
- onSelect?: ((id: string) => any) | undefined;
18
17
  onClose?: (() => any) | undefined;
18
+ onSelect?: ((id: string) => any) | undefined;
19
19
  onNewConvo?: ((groupId?: string | null | undefined) => any) | undefined;
20
20
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
21
  declare const _default: typeof __VLS_export;
@@ -10,12 +10,12 @@ type __VLS_Props = {
10
10
  userImage?: string;
11
11
  };
12
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
13
- select: (id: string) => any;
14
13
  close: () => any;
14
+ select: (id: string) => any;
15
15
  newConvo: (groupId?: string | null | undefined) => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
- onSelect?: ((id: string) => any) | undefined;
18
17
  onClose?: (() => any) | undefined;
18
+ onSelect?: ((id: string) => any) | undefined;
19
19
  onNewConvo?: ((groupId?: string | null | undefined) => any) | undefined;
20
20
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
21
  declare const _default: typeof __VLS_export;
@@ -67,11 +67,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
67
67
  "update:selectedReasoningEffort": (value: any) => any;
68
68
  } & {
69
69
  delete: () => any;
70
- cancel: () => any;
71
70
  rename: () => any;
72
71
  duplicate: () => any;
73
72
  export: () => any;
74
73
  copyLink: () => any;
74
+ cancel: () => any;
75
75
  debug: () => any;
76
76
  selectConversation: (id: string) => any;
77
77
  send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
@@ -89,11 +89,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
89
89
  "update:workspaceSheetOpen": (value: boolean) => any;
90
90
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
91
91
  onDelete?: (() => any) | undefined;
92
- onCancel?: (() => any) | undefined;
93
92
  onRename?: (() => any) | undefined;
94
93
  onDuplicate?: (() => any) | undefined;
95
94
  onExport?: (() => any) | undefined;
96
95
  onCopyLink?: (() => any) | undefined;
96
+ onCancel?: (() => any) | undefined;
97
97
  onDebug?: (() => any) | undefined;
98
98
  onSelectConversation?: ((id: string) => any) | undefined;
99
99
  onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
@@ -67,11 +67,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
67
67
  "update:selectedReasoningEffort": (value: any) => any;
68
68
  } & {
69
69
  delete: () => any;
70
- cancel: () => any;
71
70
  rename: () => any;
72
71
  duplicate: () => any;
73
72
  export: () => any;
74
73
  copyLink: () => any;
74
+ cancel: () => any;
75
75
  debug: () => any;
76
76
  selectConversation: (id: string) => any;
77
77
  send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
@@ -89,11 +89,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
89
89
  "update:workspaceSheetOpen": (value: boolean) => any;
90
90
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
91
91
  onDelete?: (() => any) | undefined;
92
- onCancel?: (() => any) | undefined;
93
92
  onRename?: (() => any) | undefined;
94
93
  onDuplicate?: (() => any) | undefined;
95
94
  onExport?: (() => any) | undefined;
96
95
  onCopyLink?: (() => any) | undefined;
96
+ onCancel?: (() => any) | undefined;
97
97
  onDebug?: (() => any) | undefined;
98
98
  onSelectConversation?: ((id: string) => any) | undefined;
99
99
  onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
@@ -695,11 +695,6 @@ defineExpose({
695
695
  @change="handleFileSelect"
696
696
  >
697
697
 
698
- <!-- Deliberately NOT position:relative — TelaChatBody pins
699
- [data-chat-prompt-input] with absolute left-0 right-0 against
700
- its nearest positioned ancestor; a positioned wrapper here
701
- would shrink the input. The dropdown positions itself fixed
702
- from the caret rect, so it needs no relative ancestor. -->
703
698
  <AnimatePresence mode="popLayout" :initial="false">
704
699
  <TelaChatAnimateEnter v-if="showStopRun" key="stop-run">
705
700
  <TelaChatStopRunButton
@@ -840,17 +835,19 @@ defineExpose({
840
835
  @select="emit('selectExecutionProfile', $event)"
841
836
  @click.stop
842
837
  />
843
- <ChatReasoningEffortSelector
844
- v-if="!hideReasoningEffortSelector"
845
- v-model="selectedReasoningEffort"
846
- :disabled="isLocked"
847
- @click.stop
848
- />
849
838
  <ChatModelSelector
850
839
  v-if="!hideModelSelector"
851
840
  v-model="selectedModel"
841
+ v-model:reasoning="selectedReasoningEffort"
842
+ :hide-reasoning="hideReasoningEffortSelector"
843
+ :disabled="isLocked"
844
+ @click.stop
845
+ />
846
+ <!-- Model picker hidden, effort choices kept: the effort on its own. -->
847
+ <ChatReasoningSelector
848
+ v-else-if="!hideReasoningEffortSelector"
849
+ v-model="selectedReasoningEffort"
852
850
  :disabled="isLocked"
853
- mr-4px
854
851
  @click.stop
855
852
  />
856
853
  <TelaChatPromptSubmitButton
@@ -1,14 +1,20 @@
1
+ import type { ChatReasoningEffort } from '../../types/schemas/chat/models.js';
1
2
  type __VLS_Props = {
2
3
  disabled?: boolean;
4
+ /** Hides the Reasoning row and leaves the effort untouched. */
5
+ hideReasoning?: boolean;
3
6
  };
4
7
  type __VLS_ModelProps = {
5
8
  modelValue?: string | null;
9
+ 'reasoning'?: ChatReasoningEffort | null;
6
10
  };
7
11
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
13
  "update:modelValue": (value: string | null) => any;
14
+ "update:reasoning": (value: any) => any;
10
15
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
16
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
17
+ "onUpdate:reasoning"?: ((value: any) => any) | undefined;
12
18
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
19
  declare const _default: typeof __VLS_export;
14
20
  export default _default;
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { chatModelTabs } from "../../types/schemas/chat/model-catalog.js";
2
+ import { chatReasoningEffortOptions } from "../../types/schemas/chat/ui.js";
3
3
  import { useEmbedConfig } from "../../embed/composables/embed-config";
4
4
  import { useChatModelCatalog } from "../composables/chat-model-catalog";
5
5
  import { useChatRequestContext } from "../../shared/composables/chat-request-context";
@@ -8,11 +8,23 @@ import { buildChatModelOptions } from "../../lightweight/messages/model-options"
8
8
  import { resolveAvailableChatModels } from "../model-availability";
9
9
  import TelaChatIconsAnthropic from "@meistrari/tela-build/components/tela/chat/icons/anthropic.vue";
10
10
  import TelaChatIconsGemini from "@meistrari/tela-build/components/tela/chat/icons/gemini.vue";
11
+ import TelaChatIconsGrok from "@meistrari/tela-build/components/tela/chat/icons/grok.vue";
12
+ import TelaChatIconsKimi from "@meistrari/tela-build/components/tela/chat/icons/kimi.vue";
11
13
  import TelaChatIconsOpenai from "@meistrari/tela-build/components/tela/chat/icons/openai.vue";
12
- defineProps({
13
- disabled: { type: Boolean, required: false }
14
+ const props = defineProps({
15
+ disabled: { type: Boolean, required: false },
16
+ hideReasoning: { type: Boolean, required: false }
14
17
  });
15
18
  const model = defineModel({ type: [String, null], ...{ default: null } });
19
+ const reasoning = defineModel("reasoning", { type: null, ...{ default: null } });
20
+ const reasoningOptions = computed(() => props.hideReasoning ? [] : chatReasoningEffortOptions.map((option) => ({ value: option.value, label: option.label })));
21
+ const boundReasoning = computed({
22
+ get: () => props.hideReasoning ? null : reasoning.value,
23
+ set: (value) => {
24
+ if (!props.hideReasoning)
25
+ reasoning.value = value;
26
+ }
27
+ });
16
28
  const embedConfig = useEmbedConfig();
17
29
  const isLightweight = useChatRequestContext()?.harness?.value === "lightweight";
18
30
  const lightweightCatalog = isLightweight ? useLightweightModelCatalog() : null;
@@ -21,20 +33,15 @@ const activeCatalog = lightweightCatalog ?? catalog;
21
33
  const providerIcons = {
22
34
  Anthropic: TelaChatIconsAnthropic,
23
35
  OpenAI: TelaChatIconsOpenai,
24
- Google: TelaChatIconsGemini
36
+ Google: TelaChatIconsGemini,
37
+ MoonshotAI: TelaChatIconsKimi,
38
+ xAI: TelaChatIconsGrok
25
39
  };
26
40
  function toOption(entry) {
27
41
  return {
28
42
  value: entry.id,
29
43
  label: entry.label,
30
- description: entry.description ?? void 0,
31
- group: entry.provider,
32
- icon: providerIcons[entry.provider],
33
- cost: entry.cost,
34
- maxInputTokens: entry.maxInputTokens,
35
- maxOutputTokens: entry.maxOutputTokens ?? void 0,
36
- isMultiModal: entry.isMultiModal,
37
- tabs: chatModelTabs(entry)
44
+ icon: providerIcons[entry.provider]
38
45
  };
39
46
  }
40
47
  const options = computed(() => {
@@ -52,15 +59,9 @@ const options = computed(() => {
52
59
  const optionIds = model.value && !availableModels.includes(model.value) ? [model.value, ...availableModels] : availableModels;
53
60
  return optionIds.map((id) => {
54
61
  const entry = catalog.models.value.find((candidate) => candidate.id === id);
55
- return entry ? toOption(entry) : { value: id, label: id, tabs: ["all"] };
62
+ return entry ? toOption(entry) : { value: id, label: id };
56
63
  });
57
64
  });
58
- const tabLabels = {
59
- all: "Todos",
60
- advanced: "Avan\xE7ados",
61
- cheap: "Econ\xF4micos",
62
- multimodal: "Multimodal"
63
- };
64
65
  watch(activeCatalog.scopeKey, () => {
65
66
  void activeCatalog.load();
66
67
  }, { immediate: true });
@@ -69,10 +70,15 @@ watch(activeCatalog.scopeKey, () => {
69
70
  <template>
70
71
  <TelaChatModelSelector
71
72
  v-model="model"
73
+ v-model:reasoning="boundReasoning"
74
+ data-testid="chat-model-selector"
72
75
  :options="options"
76
+ :reasoning-options="reasoningOptions"
73
77
  :disabled="disabled || options.length === 0"
74
78
  placeholder="Modelo"
75
- input-placeholder="Buscar modelo..."
76
- :tab-labels="tabLabels"
79
+ label-model="Modelo"
80
+ label-reasoning="Raciocínio"
81
+ label-reasoning-default="Padrão"
82
+ label-use-default="Usar padrão do agente"
77
83
  />
78
84
  </template>
@@ -1,14 +1,20 @@
1
+ import type { ChatReasoningEffort } from '../../types/schemas/chat/models.js';
1
2
  type __VLS_Props = {
2
3
  disabled?: boolean;
4
+ /** Hides the Reasoning row and leaves the effort untouched. */
5
+ hideReasoning?: boolean;
3
6
  };
4
7
  type __VLS_ModelProps = {
5
8
  modelValue?: string | null;
9
+ 'reasoning'?: ChatReasoningEffort | null;
6
10
  };
7
11
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
13
  "update:modelValue": (value: string | null) => any;
14
+ "update:reasoning": (value: any) => any;
10
15
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
16
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
17
+ "onUpdate:reasoning"?: ((value: any) => any) | undefined;
12
18
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
19
  declare const _default: typeof __VLS_export;
14
20
  export default _default;
@@ -0,0 +1,51 @@
1
+ <script setup>
2
+ import { chatReasoningEffortOptions } from "../../types/schemas/chat/ui.js";
3
+ defineProps({
4
+ disabled: { type: Boolean, required: false }
5
+ });
6
+ const effort = defineModel({ type: null, ...{ default: null } });
7
+ const DEFAULT_LABEL = "Racioc\xEDnio";
8
+ const selected = computed(() => chatReasoningEffortOptions.find((option) => option.value === effort.value) ?? null);
9
+ const APPLY_DELAY_MS = 120;
10
+ function choose(value) {
11
+ setTimeout(() => {
12
+ effort.value = value;
13
+ }, APPLY_DELAY_MS);
14
+ }
15
+ </script>
16
+
17
+ <template>
18
+ <TelaMenubarRoot class="flex" data-testid="chat-reasoning-selector">
19
+ <TelaMenubarMenu>
20
+ <TelaMenubarTrigger
21
+ :disabled="disabled"
22
+ :aria-label="`Racioc\xEDnio: ${selected?.label ?? 'Padr\xE3o do agente'}`"
23
+ class="group gap-6px rounded-8px py-7px pl-10px pr-8px duration-80 data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
24
+ >
25
+ <span class="whitespace-nowrap body-14-medium text-primary group-data-[state=open]:text-secondary">{{ selected?.label ?? DEFAULT_LABEL }}</span>
26
+ <TelaIcon
27
+ name="i-ph-caret-down"
28
+ size="15px"
29
+ color="icon-tertiary"
30
+ class="shrink-0 transition-transform ease-out duration-150 group-data-[state=open]:rotate-180"
31
+ />
32
+ </TelaMenubarTrigger>
33
+
34
+ <TelaMenubarContent side="top" align="end" :side-offset="6" class="!min-w-200px w-200px z-999">
35
+ <TelaMenubarItem
36
+ v-for="option in chatReasoningEffortOptions"
37
+ :key="option.value"
38
+ class="gap-8px px-8px py-7px"
39
+ @select="choose(option.value)"
40
+ >
41
+ <span class="min-w-0 flex-1 truncate">{{ option.label }}</span>
42
+ <TelaIcon v-if="option.value === effort" name="i-ph-check" size="14px" class="shrink-0 text-gray-400" />
43
+ </TelaMenubarItem>
44
+ <TelaMenubarSeparator class="mx-0 my-4px" />
45
+ <TelaMenubarItem class="gap-8px px-8px py-7px" :disabled="effort === null" @select="choose(null)">
46
+ <span class="min-w-0 flex-1 truncate">Usar padrão do agente</span>
47
+ </TelaMenubarItem>
48
+ </TelaMenubarContent>
49
+ </TelaMenubarMenu>
50
+ </TelaMenubarRoot>
51
+ </template>
@@ -10,7 +10,7 @@ export const credentialsSchema = z.strictObject({
10
10
  export const botCapabilities = ['thread_context', 'files', 'direct_messages', 'message_triggers', 'reaction_triggers', 'post_to_public_channels', 'member_email'];
11
11
  export const botCapabilitySchema = z.enum(botCapabilities);
12
12
  export const legacyBotCapabilities = ['thread_context', 'files'];
13
- export const botCapabilitiesSchema = z.array(botCapabilitySchema).max(botCapabilities.length).describe('`thread_context` (reads the thread of a mention), `files` (reads attachments), `direct_messages` (answers DMs as private conversations), `message_triggers` and `reaction_triggers` (reserved: subscribe to channel messages and reactions for configurable triggers), `post_to_public_channels` (`chat:write.public`), `member_email` (`users:read.email`).');
13
+ export const botCapabilitiesSchema = z.array(botCapabilitySchema).max(botCapabilities.length).describe('`thread_context` (reads the thread of a mention), `files` (reads attachments), `direct_messages` (answers DMs as private conversations, with native streaming and the thread context of a DM thread: `im:history`, `im:read`), `message_triggers` and `reaction_triggers` (allow configurable triggers of that type: the bot reads public channel messages or reactions), `post_to_public_channels` (`chat:write.public`), `member_email` (`users:read.email`).');
14
14
  const common = {
15
15
  appId: z.string().regex(/^A[A-Z0-9]+$/),
16
16
  teamId: z.string().regex(/^T[A-Z0-9]+$/),
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ export declare const botTriggerTypes: readonly ["message", "reaction"];
3
+ export declare const botTriggerTypeSchema: z.ZodEnum<{
4
+ message: "message";
5
+ reaction: "reaction";
6
+ }>;
7
+ export declare const botTriggerConnectionModes: readonly ["ignore", "prompt"];
8
+ export declare const botTriggerLimits: {
9
+ readonly triggers: 20;
10
+ readonly pattern: 500;
11
+ readonly instruction: 2000;
12
+ };
13
+ export declare const botTriggerInputSchema: z.ZodObject<{
14
+ id: z.ZodOptional<z.ZodUUID>;
15
+ type: z.ZodEnum<{
16
+ message: "message";
17
+ reaction: "reaction";
18
+ }>;
19
+ pattern: z.ZodString;
20
+ channelNamePattern: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
21
+ instruction: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
22
+ ifNotConnected: z.ZodDefault<z.ZodEnum<{
23
+ prompt: "prompt";
24
+ ignore: "ignore";
25
+ }>>;
26
+ }, z.core.$strip>;
27
+ export declare const botTriggerSchema: z.ZodObject<{
28
+ id: z.ZodUUID;
29
+ type: z.ZodEnum<{
30
+ message: "message";
31
+ reaction: "reaction";
32
+ }>;
33
+ pattern: z.ZodString;
34
+ channelNamePattern: z.ZodNullable<z.ZodString>;
35
+ instruction: z.ZodNullable<z.ZodString>;
36
+ ifNotConnected: z.ZodEnum<{
37
+ prompt: "prompt";
38
+ ignore: "ignore";
39
+ }>;
40
+ }, z.core.$strip>;
41
+ export declare const botTriggersChangeSchema: z.ZodObject<{
42
+ actorId: z.ZodString;
43
+ workspaceId: z.ZodUUID;
44
+ agentId: z.ZodUUID;
45
+ triggers: z.ZodArray<z.ZodObject<{
46
+ id: z.ZodOptional<z.ZodUUID>;
47
+ type: z.ZodEnum<{
48
+ message: "message";
49
+ reaction: "reaction";
50
+ }>;
51
+ pattern: z.ZodString;
52
+ channelNamePattern: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
53
+ instruction: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
54
+ ifNotConnected: z.ZodDefault<z.ZodEnum<{
55
+ prompt: "prompt";
56
+ ignore: "ignore";
57
+ }>>;
58
+ }, z.core.$strip>>;
59
+ }, z.core.$strip>;
60
+ export type BotTriggerInput = z.infer<typeof botTriggerInputSchema>;
61
+ export type BotTrigger = z.infer<typeof botTriggerSchema>;
62
+ export type BotTriggersChange = z.infer<typeof botTriggersChangeSchema> & {
63
+ botId: string;
64
+ };
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { botTargetSchema } from './apps';
3
+ // A trigger makes a dedicated bot run a turn without being mentioned: a channel message whose text matches its pattern, or a reaction
4
+ // whose name does. Patterns are RE2 regular expressions, matched anywhere in the text unless anchored; the service refuses one RE2 cannot
5
+ // compile (no backreferences or lookarounds).
6
+ export const botTriggerTypes = ['message', 'reaction'];
7
+ export const botTriggerTypeSchema = z.enum(botTriggerTypes);
8
+ export const botTriggerConnectionModes = ['ignore', 'prompt'];
9
+ export const botTriggerLimits = { triggers: 20, pattern: 500, instruction: 2000 };
10
+ const optionalText = (max) => z.string().max(max).nullish().transform(value => value?.trim() || null);
11
+ export const botTriggerInputSchema = z.object({
12
+ id: z.uuid().optional().describe('An existing trigger of this bot to keep its id; omitted for a new trigger.'),
13
+ type: botTriggerTypeSchema.describe('`message`: the pattern matches the text of a public channel message (Slack writes member mentions as `<@U…>`). `reaction`: the pattern matches a reaction name, without colons.'),
14
+ pattern: z.string().min(1).max(botTriggerLimits.pattern),
15
+ channelNamePattern: optionalText(botTriggerLimits.pattern).describe('Restricts the trigger to public channels whose name, without `#`, matches this RE2 pattern. Null or empty: every channel the bot is in.'),
16
+ instruction: optionalText(botTriggerLimits.instruction).describe('Sent to the agent as `gatilho.instrucao` of the request context. Null or empty: none.'),
17
+ ifNotConnected: z.enum(botTriggerConnectionModes).default('ignore').describe('A member without a connected Tela account: `ignore` drops the event without any message; `prompt` posts the usual connection card.'),
18
+ });
19
+ export const botTriggerSchema = z.object({
20
+ id: z.uuid(),
21
+ type: botTriggerTypeSchema,
22
+ pattern: z.string(),
23
+ channelNamePattern: z.string().nullable(),
24
+ instruction: z.string().nullable(),
25
+ ifNotConnected: z.enum(botTriggerConnectionModes),
26
+ });
27
+ // The whole ordered list replaces the bot's triggers; the first trigger that matches an event is the one that runs.
28
+ export const botTriggersChangeSchema = botTargetSchema.extend({
29
+ triggers: z.array(botTriggerInputSchema).max(botTriggerLimits.triggers).refine((triggers) => {
30
+ const ids = triggers.flatMap(trigger => trigger.id ? [trigger.id] : []);
31
+ return new Set(ids).size === ids.length;
32
+ }, 'Trigger ids must be unique'),
33
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/chat-nuxt",
3
- "version": "4.14.0-rc.8",
3
+ "version": "4.14.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -54,7 +54,7 @@
54
54
  "@meistrari/auth-nuxt": "3.31.0",
55
55
  "@meistrari/chat-ui-lang": "0.8.1",
56
56
  "@meistrari/logger": "^2.1.3",
57
- "@meistrari/tela-build": "^1.79.0",
57
+ "@meistrari/tela-build": "^1.106.0",
58
58
  "@openuidev/lang-core": "1.0.0",
59
59
  "@sentry/nuxt": "^10.0.0",
60
60
  "@vueuse/components": "^12.8.0",
@@ -1,168 +0,0 @@
1
- <script setup>
2
- import { chatReasoningEffortOptions } from "../../types/schemas/chat/ui.js";
3
- const props = defineProps({
4
- disabled: { type: Boolean, required: false }
5
- });
6
- const effort = defineModel({ type: null, ...{ default: null } });
7
- const DEFAULT_LABEL = "Racioc\xEDnio";
8
- const AGENT_DEFAULT_LABEL = "Padr\xE3o do agente";
9
- const AGENT_DEFAULT_DESCRIPTION = "Usa o esfor\xE7o configurado no agente";
10
- const options = chatReasoningEffortOptions;
11
- const lastIndex = options.length - 1;
12
- const open = ref(false);
13
- const trackRef = ref(null);
14
- const dragging = ref(false);
15
- const selectedIndex = computed(() => effort.value ? options.findIndex((option) => option.value === effort.value) : -1);
16
- const selectedOption = computed(() => selectedIndex.value >= 0 ? options[selectedIndex.value] : null);
17
- const triggerLabel = computed(() => selectedOption.value?.label ?? DEFAULT_LABEL);
18
- const fillPercent = computed(() => selectedIndex.value < 0 ? 0 : stopPercent(selectedIndex.value));
19
- function stopPercent(index) {
20
- return index / lastIndex * 100;
21
- }
22
- function select(index) {
23
- if (props.disabled)
24
- return;
25
- const clamped = Math.min(Math.max(index, 0), lastIndex);
26
- effort.value = options[clamped].value;
27
- }
28
- function reset() {
29
- effort.value = null;
30
- open.value = false;
31
- }
32
- function indexFromPointer(event) {
33
- const rect = trackRef.value?.getBoundingClientRect();
34
- if (!rect || rect.width === 0)
35
- return null;
36
- const ratio = (event.clientX - rect.left) / rect.width;
37
- return Math.round(Math.min(Math.max(ratio, 0), 1) * lastIndex);
38
- }
39
- function onPointerDown(event) {
40
- if (props.disabled || event.button !== 0)
41
- return;
42
- const index = indexFromPointer(event);
43
- if (index === null)
44
- return;
45
- dragging.value = true;
46
- trackRef.value?.setPointerCapture(event.pointerId);
47
- trackRef.value?.focus();
48
- select(index);
49
- }
50
- function onPointerMove(event) {
51
- if (!dragging.value)
52
- return;
53
- const index = indexFromPointer(event);
54
- if (index !== null && index !== selectedIndex.value)
55
- select(index);
56
- }
57
- function onPointerUp(event) {
58
- if (!dragging.value)
59
- return;
60
- dragging.value = false;
61
- if (trackRef.value?.hasPointerCapture(event.pointerId))
62
- trackRef.value.releasePointerCapture(event.pointerId);
63
- }
64
- function onKeydown(event) {
65
- const current = selectedIndex.value < 0 ? Math.floor(lastIndex / 2) : selectedIndex.value;
66
- const steps = {
67
- ArrowRight: selectedIndex.value < 0 ? current : current + 1,
68
- ArrowUp: selectedIndex.value < 0 ? current : current + 1,
69
- ArrowLeft: selectedIndex.value < 0 ? current : current - 1,
70
- ArrowDown: selectedIndex.value < 0 ? current : current - 1,
71
- Home: 0,
72
- End: lastIndex
73
- };
74
- const next = steps[event.key];
75
- if (next === void 0)
76
- return;
77
- event.preventDefault();
78
- select(next);
79
- }
80
- </script>
81
-
82
- <template>
83
- <TelaPopover v-model:open="open">
84
- <TelaPopoverTrigger as-child>
85
- <button
86
- type="button"
87
- class="group pl-10px pr-8px py-7px rounded-8px flex items-center gap-6px duration-80 text-primary hover:bg-muted data-[state=open]:text-secondary data-[state=open]:bg-muted"
88
- :disabled="disabled"
89
- :aria-label="`Esfor\xE7o de racioc\xEDnio: ${selectedOption?.label ?? AGENT_DEFAULT_LABEL}`"
90
- >
91
- <span body-14-medium whitespace-nowrap>{{ triggerLabel }}</span>
92
- <TelaIcon
93
- name="i-ph-caret-down-bold"
94
- size="15px"
95
- color="icon-tertiary"
96
- class="shrink-0 transition-transform ease-out duration-150 group-data-[state=open]:rotate-180"
97
- />
98
- </button>
99
- </TelaPopoverTrigger>
100
- <TelaPopoverContent
101
- side="top"
102
- align="end"
103
- :side-offset="3"
104
- class="popover-enter-exit origin-[var(--reka-popover-content-transform-origin)] w-260px p-16px rounded-12px! bg border-0.5px! border! [box-shadow:0_4px_16px_0_rgba(85,91,98,0.14)]!"
105
- >
106
- <div flex="~ col" gap-16px>
107
- <div flex="~ col" items-center gap-2px text-center>
108
- <span body-14-semibold text-primary>{{ selectedOption?.label ?? AGENT_DEFAULT_LABEL }}</span>
109
- <span body-12-regular text-secondary>{{ selectedOption?.description ?? AGENT_DEFAULT_DESCRIPTION }}</span>
110
- </div>
111
-
112
- <div
113
- ref="trackRef"
114
- class="effort-track"
115
- :class="{ 'effort-track--disabled': disabled }"
116
- role="slider"
117
- :tabindex="disabled ? -1 : 0"
118
- aria-valuemin="0"
119
- :aria-valuemax="lastIndex"
120
- :aria-valuenow="selectedIndex < 0 ? void 0 : selectedIndex"
121
- :aria-valuetext="selectedOption?.label ?? AGENT_DEFAULT_LABEL"
122
- :aria-disabled="disabled || void 0"
123
- @pointerdown="onPointerDown"
124
- @pointermove="onPointerMove"
125
- @pointerup="onPointerUp"
126
- @pointercancel="onPointerUp"
127
- @keydown="onKeydown"
128
- >
129
- <div class="effort-track-rail bg-muted">
130
- <div class="effort-track-fill bg-neutral-800" :style="{ width: `${fillPercent}%` }" />
131
- <span
132
- v-for="(option, index) in options"
133
- :key="option.value"
134
- class="effort-stop"
135
- :class="index <= selectedIndex ? 'bg-white' : 'bg-neutral-300'"
136
- :style="{ left: `${stopPercent(index)}%` }"
137
- :title="option.label"
138
- />
139
- </div>
140
- <div
141
- v-if="selectedIndex >= 0"
142
- class="effort-thumb bg border-0.5px border-strong"
143
- :class="{ 'effort-thumb--dragging': dragging }"
144
- :style="{ left: `${fillPercent}%` }"
145
- />
146
- </div>
147
-
148
- <div flex items-center justify-between>
149
- <span body-12-regular text-tertiary>{{ options[0].label }}</span>
150
- <button
151
- v-if="effort"
152
- type="button"
153
- class="effort-reset text-secondary hover:text-primary"
154
- body-12-medium
155
- @click="reset"
156
- >
157
- Usar padrão do agente
158
- </button>
159
- <span body-12-regular text-tertiary>{{ options[lastIndex].label }}</span>
160
- </div>
161
- </div>
162
- </TelaPopoverContent>
163
- </TelaPopover>
164
- </template>
165
-
166
- <style scoped>
167
- .effort-trigger{align-items:center;background:transparent;border:none;border-radius:8px;cursor:pointer;display:inline-flex;gap:6px;height:32px;padding:0 8px 0 10px;transition:background-color 80ms ease}.effort-trigger:disabled{opacity:.5;pointer-events:none}.effort-trigger:focus-visible{outline:2px solid rgba(85,91,98,.35);outline-offset:1px}.effort-trigger-caret{height:12px;width:12px}.effort-track{cursor:pointer;height:28px;margin:0 10px;outline:none;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.effort-track--disabled{cursor:not-allowed;opacity:.5}.effort-track:focus-visible .effort-track-rail{box-shadow:0 0 0 2px rgba(85,91,98,.35)}.effort-track-rail{height:6px;left:0;right:0;top:50%;transform:translateY(-50%);transition:box-shadow .12s ease}.effort-track-fill,.effort-track-rail{border-radius:9999px;position:absolute}.effort-track-fill{inset:0 auto 0 0;transition:width .12s cubic-bezier(.2,.8,.2,1)}.effort-stop{height:4px;transition:background-color .12s ease;width:4px}.effort-stop,.effort-thumb{border-radius:9999px;position:absolute;top:50%;transform:translate(-50%,-50%)}.effort-thumb{box-shadow:0 1px 2px rgba(0,0,0,.12),0 2px 6px rgba(0,0,0,.08);height:20px;pointer-events:none;transition:left .12s cubic-bezier(.2,.8,.2,1),transform .12s ease;width:20px}.effort-thumb--dragging{transform:translate(-50%,-50%) scale(1.08)}.effort-reset{background:transparent;border:none;cursor:pointer;padding:0;transition:color .12s ease}
168
- </style>