@meistrari/chat-nuxt 4.5.0-rc.3 → 4.5.0-rc.5
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.vue +2 -2
- package/dist/runtime/files/vault-links.js +6 -7
- package/dist/runtime/messages/components/reasoning/chat-reasoning-message.vue +4 -3
- package/dist/runtime/messages/tool-registry.d.ts +6 -1
- package/dist/runtime/messages/tool-registry.js +23 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -629,7 +629,7 @@ async function dispatchMessage(outbound, files, resolvedAgentInputs) {
|
|
|
629
629
|
agentWake?.consume();
|
|
630
630
|
return sent;
|
|
631
631
|
}
|
|
632
|
-
if (agentWake) {
|
|
632
|
+
if (agentWake && !chatApi.conversationV2Enabled) {
|
|
633
633
|
watch(
|
|
634
634
|
[outboundOccupied, agentWake.state],
|
|
635
635
|
async ([occupied, wakeState]) => {
|
|
@@ -677,7 +677,7 @@ async function handleRetry(messageId) {
|
|
|
677
677
|
selectedModel.value,
|
|
678
678
|
(value) => persistConversationModel(conversation, value, false)
|
|
679
679
|
);
|
|
680
|
-
if (!agentWake)
|
|
680
|
+
if (!agentWake || chatApi.conversationV2Enabled)
|
|
681
681
|
return;
|
|
682
682
|
if (conversation.threadSessionId) {
|
|
683
683
|
const wake = await agentWake.ensureReady(conversation.threadSessionId, selectedModel.value);
|
|
@@ -2,7 +2,9 @@ const URL_CHAR_CLASS = "[^\\s\"'<>`\\[\\]()*_~]+";
|
|
|
2
2
|
export const VAULT_REGEX = /(?<!\]\()vault:\/\/[^\s"'<>`\[\]()*_~]+/gi;
|
|
3
3
|
export const URL_REGEX = /(?<!\]\(|<)https?:\/\/[^\s"'<>`\[\]()*_~]+/gi;
|
|
4
4
|
export const VAULT_PATTERN = new RegExp(`vault://${URL_CHAR_CLASS}`, "gi");
|
|
5
|
-
|
|
5
|
+
const TELA_DOMAIN_PATTERN = "(?:tela\\.com|telastaging\\.com|fornin\\.com)";
|
|
6
|
+
export const VAULT_PERMALINK_PATTERN = new RegExp(`https://(?:[a-z0-9-]+\\.)*(?:vault|vault-api|api)\\.${TELA_DOMAIN_PATTERN}/(?:[a-z0-9_-]+/)*permalinks/${URL_CHAR_CLASS}`, "gi");
|
|
7
|
+
const GATEWAY_PERMALINK_RE = new RegExp(`^https://api\\.(${TELA_DOMAIN_PATTERN})/(?:_services/vault/)?permalinks/`);
|
|
6
8
|
export function stripTrailingPunctuation(url) {
|
|
7
9
|
return url.replace(/[.,:;!?]+$/, "");
|
|
8
10
|
}
|
|
@@ -13,19 +15,16 @@ export function isVaultS3Url(url) {
|
|
|
13
15
|
return url.includes("vault-staging-permanentstorage.s3") || url.includes("vault-prod-permanentstorage.s3");
|
|
14
16
|
}
|
|
15
17
|
export function normalizeVaultPermalinkUrl(url) {
|
|
16
|
-
return url.replace(
|
|
17
|
-
/^(https:\/\/(?:[a-z0-9-]+\.)*api\.tela(?:staging)?\.com)\/(permalinks\/)/,
|
|
18
|
-
"$1/_services/vault/$2"
|
|
19
|
-
);
|
|
18
|
+
return url.replace(GATEWAY_PERMALINK_RE, "https://vault-api.$1/permalinks/");
|
|
20
19
|
}
|
|
21
20
|
export function isVaultPermalink(url) {
|
|
22
21
|
try {
|
|
23
22
|
const parsed = new URL(url);
|
|
24
23
|
const host = parsed.host;
|
|
25
|
-
const isTelaHost = host === "vault.tela.com" || host.endsWith(".vault.tela.com") || host === "vault-api.tela.com" || host === "vault-api.telastaging.com" || host === "api.tela.com" || host.endsWith(".api.tela.com") || host === "api.telastaging.com" || host.endsWith(".api.telastaging.com");
|
|
24
|
+
const isTelaHost = host === "vault.tela.com" || host.endsWith(".vault.tela.com") || host === "vault-api.tela.com" || host === "vault-api.telastaging.com" || host === "vault-api.fornin.com" || host === "api.tela.com" || host.endsWith(".api.tela.com") || host === "api.telastaging.com" || host.endsWith(".api.telastaging.com") || host === "api.fornin.com";
|
|
26
25
|
return isTelaHost && /(?:^|\/)permalinks\//.test(parsed.pathname);
|
|
27
26
|
} catch {
|
|
28
|
-
return
|
|
27
|
+
return new RegExp(`^https://(?:[a-z0-9-]+\\.)*(?:vault|vault-api|api)\\.${TELA_DOMAIN_PATTERN}/(?:[a-z0-9_-]+/)*permalinks/`).test(url);
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
export function parseVaultHashParams(url) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { resolveToolDisplay, resolveToolMeta, resolveToolTitle } from "../../tool-registry";
|
|
2
|
+
import { resolveToolDisplay, resolveToolMeta, resolveToolTitle, withReportedToolInput } from "../../tool-registry";
|
|
3
3
|
import ChatBashWidget from "../widgets/chat-bash-widget.vue";
|
|
4
4
|
import ChatDocSdkWidget from "../widgets/chat-doc-sdk-widget.vue";
|
|
5
5
|
import ChatGenericToolWidget from "../widgets/chat-generic-tool-widget.vue";
|
|
@@ -27,6 +27,7 @@ const TOOL_WIDGETS = {
|
|
|
27
27
|
"grep": ChatGrepWidget,
|
|
28
28
|
"generic": ChatGenericToolWidget
|
|
29
29
|
};
|
|
30
|
+
const displayToolUse = computed(() => typeof props.step === "string" ? null : withReportedToolInput(props.step.toolUse, props.step.toolResult));
|
|
30
31
|
const toolDisplay = computed(() => {
|
|
31
32
|
if (typeof props.step === "string")
|
|
32
33
|
return null;
|
|
@@ -38,7 +39,7 @@ const stepWasExecuted = computed(
|
|
|
38
39
|
const stepMeta = computed(() => {
|
|
39
40
|
if (typeof props.step === "string")
|
|
40
41
|
return null;
|
|
41
|
-
return resolveToolMeta(
|
|
42
|
+
return resolveToolMeta(displayToolUse.value);
|
|
42
43
|
});
|
|
43
44
|
const stepTitle = computed(() => {
|
|
44
45
|
if (typeof props.step === "string")
|
|
@@ -72,7 +73,7 @@ const stepTitle = computed(() => {
|
|
|
72
73
|
:is="TOOL_WIDGETS[toolDisplay.widgetId]"
|
|
73
74
|
v-if="step.type === 'tool_group' && toolDisplay"
|
|
74
75
|
class="chat-reasoning-tool-detail"
|
|
75
|
-
:tool-use="
|
|
76
|
+
:tool-use="displayToolUse"
|
|
76
77
|
:tool-result="step.toolResult"
|
|
77
78
|
:is-active="isActive"
|
|
78
79
|
v-bind="toolDisplay.widgetProps"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolUse } from './reasoning.js';
|
|
1
|
+
import type { ToolUse, ToolResult } from './reasoning.js';
|
|
2
2
|
export type ToolWidgetId = 'web-search' | 'doc-sdk' | 'workstation-query' | 'tela-skill' | 'bash' | 'write' | 'read' | 'grep' | 'generic';
|
|
3
3
|
export interface ToolLabels {
|
|
4
4
|
active: string;
|
|
@@ -14,3 +14,8 @@ export declare const TOOL_ICON_SAFELIST: string[];
|
|
|
14
14
|
export declare function resolveToolDisplay(toolUse: ToolUse): ToolDisplay;
|
|
15
15
|
export declare function resolveToolTitle(toolUse: ToolUse, wasExecuted: boolean): string;
|
|
16
16
|
export declare function resolveToolMeta(toolUse: ToolUse): string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Responses providers report the executed search action in output, not call input.
|
|
19
|
+
* Project it for display only; keep persisted inputs and provider replay untouched.
|
|
20
|
+
*/
|
|
21
|
+
export declare function withReportedToolInput(toolUse: ToolUse, toolResult?: ToolResult): ToolUse;
|
|
@@ -4,6 +4,11 @@ const TOOL_REGISTRY = {
|
|
|
4
4
|
widgetId: "web-search",
|
|
5
5
|
labels: { active: "Pesquisando na web", executed: "Pesquisou na web" }
|
|
6
6
|
},
|
|
7
|
+
"web_search": {
|
|
8
|
+
icon: "i-ph-globe",
|
|
9
|
+
widgetId: "generic",
|
|
10
|
+
labels: { active: "Pesquisando na web", executed: "Pesquisou na web" }
|
|
11
|
+
},
|
|
7
12
|
"WebFetch": {
|
|
8
13
|
icon: "i-ph-browser",
|
|
9
14
|
widgetId: "generic",
|
|
@@ -120,6 +125,8 @@ export const TOOL_ICON_SAFELIST = [.../* @__PURE__ */ new Set([
|
|
|
120
125
|
"i-ph-wrench"
|
|
121
126
|
])];
|
|
122
127
|
export function resolveToolDisplay(toolUse) {
|
|
128
|
+
if (toolUse.name === "Execute")
|
|
129
|
+
return resolveToolDisplay({ ...toolUse, name: "Bash" });
|
|
123
130
|
const qualifier = toolQualifier(toolUse);
|
|
124
131
|
if (qualifier) {
|
|
125
132
|
const qualified = TOOL_REGISTRY[`${toolUse.name}:${qualifier}`];
|
|
@@ -155,11 +162,25 @@ export function resolveToolMeta(toolUse) {
|
|
|
155
162
|
}
|
|
156
163
|
if (toolUse.name === "Grep")
|
|
157
164
|
return stringInput(toolUse, "pattern", "query");
|
|
158
|
-
if (
|
|
165
|
+
if (["WebSearch", "WebFetch", "web_search"].includes(toolUse.name))
|
|
159
166
|
return stringInput(toolUse, "query", "url");
|
|
160
|
-
if (toolUse.name === "Bash")
|
|
167
|
+
if (toolUse.name === "Bash" || toolUse.name === "Execute")
|
|
161
168
|
return stringInput(toolUse, "description", "command");
|
|
162
169
|
if (toolUse.name === "Skill")
|
|
163
170
|
return stringInput(toolUse, "skill");
|
|
164
171
|
return toolUse.description?.trim() || null;
|
|
165
172
|
}
|
|
173
|
+
export function withReportedToolInput(toolUse, toolResult) {
|
|
174
|
+
if (toolUse.name !== "web_search" || Object.keys(toolUse.input ?? {}).length || !toolResult || toolResult.isError)
|
|
175
|
+
return toolUse;
|
|
176
|
+
try {
|
|
177
|
+
const output = JSON.parse(toolResult.output);
|
|
178
|
+
if (!output || typeof output !== "object" || !("action" in output))
|
|
179
|
+
return toolUse;
|
|
180
|
+
const action = output.action;
|
|
181
|
+
if (action && typeof action === "object" && !Array.isArray(action))
|
|
182
|
+
return { ...toolUse, input: action };
|
|
183
|
+
} catch {
|
|
184
|
+
}
|
|
185
|
+
return toolUse;
|
|
186
|
+
}
|