@open-mercato/ai-assistant 0.4.11-develop.1365.0acff7b08e → 0.4.11-develop.1383.aeb2d4cdb5
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.
|
@@ -8,7 +8,11 @@ function useMcpTools() {
|
|
|
8
8
|
setIsLoading(true);
|
|
9
9
|
setError(null);
|
|
10
10
|
try {
|
|
11
|
-
const response = await fetch("/api/ai_assistant/tools"
|
|
11
|
+
const response = await fetch("/api/ai_assistant/tools", {
|
|
12
|
+
headers: {
|
|
13
|
+
"x-om-forbidden-redirect": "0"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
12
16
|
if (!response.ok) {
|
|
13
17
|
throw new Error(`Failed to fetch tools: ${response.status}`);
|
|
14
18
|
}
|
|
@@ -26,7 +30,10 @@ function useMcpTools() {
|
|
|
26
30
|
try {
|
|
27
31
|
const response = await fetch("/api/ai_assistant/tools/execute", {
|
|
28
32
|
method: "POST",
|
|
29
|
-
headers: {
|
|
33
|
+
headers: {
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
"x-om-forbidden-redirect": "0"
|
|
36
|
+
},
|
|
30
37
|
body: JSON.stringify({ toolName, args })
|
|
31
38
|
});
|
|
32
39
|
const data = await response.json();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/frontend/hooks/useMcpTools.ts"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport { useState, useCallback, useEffect } from 'react'\nimport type { ToolInfo, ToolExecutionResult } from '../types'\n\nexport function useMcpTools() {\n const [tools, setTools] = useState<ToolInfo[]>([])\n const [isLoading, setIsLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n const fetchTools = useCallback(async () => {\n setIsLoading(true)\n setError(null)\n try {\n const response = await fetch('/api/ai_assistant/tools')\n if (!response.ok) {\n throw new Error(`Failed to fetch tools: ${response.status}`)\n }\n const data = await response.json()\n setTools(data.tools || [])\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load tools')\n setTools([])\n } finally {\n setIsLoading(false)\n }\n }, [])\n\n const executeTool = useCallback(\n async (toolName: string, args: Record<string, unknown> = {}): Promise<ToolExecutionResult> => {\n try {\n const response = await fetch('/api/ai_assistant/tools/execute', {\n method: 'POST',\n headers: {
|
|
5
|
-
"mappings": ";AAEA,SAAS,UAAU,aAAa,iBAAiB;AAG1C,SAAS,cAAc;AAC5B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAqB,CAAC,CAAC;AACjD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AAEtD,QAAM,aAAa,YAAY,YAAY;AACzC,iBAAa,IAAI;AACjB,aAAS,IAAI;AACb,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { useState, useCallback, useEffect } from 'react'\nimport type { ToolInfo, ToolExecutionResult } from '../types'\n\nexport function useMcpTools() {\n const [tools, setTools] = useState<ToolInfo[]>([])\n const [isLoading, setIsLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n const fetchTools = useCallback(async () => {\n setIsLoading(true)\n setError(null)\n try {\n const response = await fetch('/api/ai_assistant/tools', {\n headers: {\n 'x-om-forbidden-redirect': '0',\n },\n })\n if (!response.ok) {\n throw new Error(`Failed to fetch tools: ${response.status}`)\n }\n const data = await response.json()\n setTools(data.tools || [])\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load tools')\n setTools([])\n } finally {\n setIsLoading(false)\n }\n }, [])\n\n const executeTool = useCallback(\n async (toolName: string, args: Record<string, unknown> = {}): Promise<ToolExecutionResult> => {\n try {\n const response = await fetch('/api/ai_assistant/tools/execute', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'x-om-forbidden-redirect': '0',\n },\n body: JSON.stringify({ toolName, args }),\n })\n\n const data = await response.json()\n\n if (!response.ok) {\n return {\n success: false,\n error: data.error || `Tool execution failed: ${response.status}`,\n }\n }\n\n return {\n success: true,\n result: data.result,\n }\n } catch (err) {\n return {\n success: false,\n error: err instanceof Error ? err.message : 'Tool execution failed',\n }\n }\n },\n []\n )\n\n // Fetch tools on mount\n useEffect(() => {\n fetchTools()\n }, [fetchTools])\n\n return {\n tools,\n isLoading,\n error,\n fetchTools,\n executeTool,\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAEA,SAAS,UAAU,aAAa,iBAAiB;AAG1C,SAAS,cAAc;AAC5B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAqB,CAAC,CAAC;AACjD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AAEtD,QAAM,aAAa,YAAY,YAAY;AACzC,iBAAa,IAAI;AACjB,aAAS,IAAI;AACb,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,2BAA2B;AAAA,QACtD,SAAS;AAAA,UACP,2BAA2B;AAAA,QAC7B;AAAA,MACF,CAAC;AACD,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,IAAI,MAAM,0BAA0B,SAAS,MAAM,EAAE;AAAA,MAC7D;AACA,YAAM,OAAO,MAAM,SAAS,KAAK;AACjC,eAAS,KAAK,SAAS,CAAC,CAAC;AAAA,IAC3B,SAAS,KAAK;AACZ,eAAS,eAAe,QAAQ,IAAI,UAAU,sBAAsB;AACpE,eAAS,CAAC,CAAC;AAAA,IACb,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc;AAAA,IAClB,OAAO,UAAkB,OAAgC,CAAC,MAAoC;AAC5F,UAAI;AACF,cAAM,WAAW,MAAM,MAAM,mCAAmC;AAAA,UAC9D,QAAQ;AAAA,UACR,SAAS;AAAA,YACP,gBAAgB;AAAA,YAChB,2BAA2B;AAAA,UAC7B;AAAA,UACA,MAAM,KAAK,UAAU,EAAE,UAAU,KAAK,CAAC;AAAA,QACzC,CAAC;AAED,cAAM,OAAO,MAAM,SAAS,KAAK;AAEjC,YAAI,CAAC,SAAS,IAAI;AAChB,iBAAO;AAAA,YACL,SAAS;AAAA,YACT,OAAO,KAAK,SAAS,0BAA0B,SAAS,MAAM;AAAA,UAChE;AAAA,QACF;AAEA,eAAO;AAAA,UACL,SAAS;AAAA,UACT,QAAQ,KAAK;AAAA,QACf;AAAA,MACF,SAAS,KAAK;AACZ,eAAO;AAAA,UACL,SAAS;AAAA,UACT,OAAO,eAAe,QAAQ,IAAI,UAAU;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AAGA,YAAU,MAAM;AACd,eAAW;AAAA,EACb,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/ai-assistant",
|
|
3
|
-
"version": "0.4.11-develop.
|
|
3
|
+
"version": "0.4.11-develop.1383.aeb2d4cdb5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
"zod-to-json-schema": "^3.25.1"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@open-mercato/shared": "0.4.11-develop.
|
|
98
|
-
"@open-mercato/ui": "0.4.11-develop.
|
|
97
|
+
"@open-mercato/shared": "0.4.11-develop.1383.aeb2d4cdb5",
|
|
98
|
+
"@open-mercato/ui": "0.4.11-develop.1383.aeb2d4cdb5",
|
|
99
99
|
"zod": ">=3.23.0"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
|
-
"@open-mercato/cli": "0.4.11-develop.
|
|
102
|
+
"@open-mercato/cli": "0.4.11-develop.1383.aeb2d4cdb5",
|
|
103
103
|
"tsx": "^4.21.0"
|
|
104
104
|
},
|
|
105
105
|
"publishConfig": {
|
|
@@ -12,7 +12,11 @@ export function useMcpTools() {
|
|
|
12
12
|
setIsLoading(true)
|
|
13
13
|
setError(null)
|
|
14
14
|
try {
|
|
15
|
-
const response = await fetch('/api/ai_assistant/tools'
|
|
15
|
+
const response = await fetch('/api/ai_assistant/tools', {
|
|
16
|
+
headers: {
|
|
17
|
+
'x-om-forbidden-redirect': '0',
|
|
18
|
+
},
|
|
19
|
+
})
|
|
16
20
|
if (!response.ok) {
|
|
17
21
|
throw new Error(`Failed to fetch tools: ${response.status}`)
|
|
18
22
|
}
|
|
@@ -31,7 +35,10 @@ export function useMcpTools() {
|
|
|
31
35
|
try {
|
|
32
36
|
const response = await fetch('/api/ai_assistant/tools/execute', {
|
|
33
37
|
method: 'POST',
|
|
34
|
-
headers: {
|
|
38
|
+
headers: {
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
'x-om-forbidden-redirect': '0',
|
|
41
|
+
},
|
|
35
42
|
body: JSON.stringify({ toolName, args }),
|
|
36
43
|
})
|
|
37
44
|
|