@mcpjam/inspector 0.2.0 → 0.2.2
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/client/dist/assets/{OAuthCallback-Bn78Q1TF.js → OAuthCallback-B9WXxW14.js} +1 -1
- package/client/dist/assets/{OAuthDebugCallback-BqpNnC48.js → OAuthDebugCallback-Dypsoomr.js} +1 -1
- package/client/dist/assets/{index-DJQtmX5A.js → index-BwJsKGKK.js} +1080 -530
- package/client/dist/assets/{index-CGJXsF8q.css → index-C9Kqkwaq.css} +258 -58
- package/client/dist/claude_logo.png +0 -0
- package/client/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OAuthCallback-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OAuthCallback-B9WXxW14.js","assets/oauthUtils-DTcoXpSP.js","assets/OAuthDebugCallback-Dypsoomr.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -11845,18 +11845,6 @@ var errorUtil;
|
|
|
11845
11845
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
11846
11846
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message == null ? void 0 : message.message;
|
|
11847
11847
|
})(errorUtil || (errorUtil = {}));
|
|
11848
|
-
var __classPrivateFieldGet$1 = function(receiver, state, kind, f) {
|
|
11849
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
11850
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11851
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11852
|
-
};
|
|
11853
|
-
var __classPrivateFieldSet$1 = function(receiver, state, value, kind, f) {
|
|
11854
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11855
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
11856
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11857
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
11858
|
-
};
|
|
11859
|
-
var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
11860
11848
|
class ParseInputLazyPath {
|
|
11861
11849
|
constructor(parent, value, path2, key) {
|
|
11862
11850
|
this._cachedPath = [];
|
|
@@ -14578,10 +14566,6 @@ function createZodEnum(values, params) {
|
|
|
14578
14566
|
});
|
|
14579
14567
|
}
|
|
14580
14568
|
class ZodEnum extends ZodType {
|
|
14581
|
-
constructor() {
|
|
14582
|
-
super(...arguments);
|
|
14583
|
-
_ZodEnum_cache.set(this, void 0);
|
|
14584
|
-
}
|
|
14585
14569
|
_parse(input) {
|
|
14586
14570
|
if (typeof input.data !== "string") {
|
|
14587
14571
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -14593,10 +14577,10 @@ class ZodEnum extends ZodType {
|
|
|
14593
14577
|
});
|
|
14594
14578
|
return INVALID;
|
|
14595
14579
|
}
|
|
14596
|
-
if (!
|
|
14597
|
-
|
|
14580
|
+
if (!this._cache) {
|
|
14581
|
+
this._cache = new Set(this._def.values);
|
|
14598
14582
|
}
|
|
14599
|
-
if (!
|
|
14583
|
+
if (!this._cache.has(input.data)) {
|
|
14600
14584
|
const ctx = this._getOrReturnCtx(input);
|
|
14601
14585
|
const expectedValues = this._def.values;
|
|
14602
14586
|
addIssueToContext(ctx, {
|
|
@@ -14645,13 +14629,8 @@ class ZodEnum extends ZodType {
|
|
|
14645
14629
|
});
|
|
14646
14630
|
}
|
|
14647
14631
|
}
|
|
14648
|
-
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
14649
14632
|
ZodEnum.create = createZodEnum;
|
|
14650
14633
|
class ZodNativeEnum extends ZodType {
|
|
14651
|
-
constructor() {
|
|
14652
|
-
super(...arguments);
|
|
14653
|
-
_ZodNativeEnum_cache.set(this, void 0);
|
|
14654
|
-
}
|
|
14655
14634
|
_parse(input) {
|
|
14656
14635
|
const nativeEnumValues = util$1.getValidEnumValues(this._def.values);
|
|
14657
14636
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -14664,10 +14643,10 @@ class ZodNativeEnum extends ZodType {
|
|
|
14664
14643
|
});
|
|
14665
14644
|
return INVALID;
|
|
14666
14645
|
}
|
|
14667
|
-
if (!
|
|
14668
|
-
|
|
14646
|
+
if (!this._cache) {
|
|
14647
|
+
this._cache = new Set(util$1.getValidEnumValues(this._def.values));
|
|
14669
14648
|
}
|
|
14670
|
-
if (!
|
|
14649
|
+
if (!this._cache.has(input.data)) {
|
|
14671
14650
|
const expectedValues = util$1.objectValues(nativeEnumValues);
|
|
14672
14651
|
addIssueToContext(ctx, {
|
|
14673
14652
|
received: ctx.data,
|
|
@@ -14682,7 +14661,6 @@ class ZodNativeEnum extends ZodType {
|
|
|
14682
14661
|
return this._def.values;
|
|
14683
14662
|
}
|
|
14684
14663
|
}
|
|
14685
|
-
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
14686
14664
|
ZodNativeEnum.create = (values, params) => {
|
|
14687
14665
|
return new ZodNativeEnum({
|
|
14688
14666
|
values,
|
|
@@ -14823,7 +14801,7 @@ class ZodEffects extends ZodType {
|
|
|
14823
14801
|
parent: ctx
|
|
14824
14802
|
});
|
|
14825
14803
|
if (!isValid(base))
|
|
14826
|
-
return
|
|
14804
|
+
return INVALID;
|
|
14827
14805
|
const result = effect.transform(base.value, checkCtx);
|
|
14828
14806
|
if (result instanceof Promise) {
|
|
14829
14807
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -14832,7 +14810,7 @@ class ZodEffects extends ZodType {
|
|
|
14832
14810
|
} else {
|
|
14833
14811
|
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
14834
14812
|
if (!isValid(base))
|
|
14835
|
-
return
|
|
14813
|
+
return INVALID;
|
|
14836
14814
|
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
14837
14815
|
status: status.value,
|
|
14838
14816
|
value: result
|
|
@@ -16134,6 +16112,15 @@ const Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "
|
|
|
16134
16112
|
const ChevronDown = createLucideIcon("ChevronDown", [
|
|
16135
16113
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
16136
16114
|
]);
|
|
16115
|
+
/**
|
|
16116
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16117
|
+
*
|
|
16118
|
+
* This source code is licensed under the ISC license.
|
|
16119
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16120
|
+
*/
|
|
16121
|
+
const ChevronLeft = createLucideIcon("ChevronLeft", [
|
|
16122
|
+
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
16123
|
+
]);
|
|
16137
16124
|
/**
|
|
16138
16125
|
* @license lucide-react v0.447.0 - ISC
|
|
16139
16126
|
*
|
|
@@ -16204,6 +16191,16 @@ const CircleHelp = createLucideIcon("CircleHelp", [
|
|
|
16204
16191
|
const Circle = createLucideIcon("Circle", [
|
|
16205
16192
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
16206
16193
|
]);
|
|
16194
|
+
/**
|
|
16195
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16196
|
+
*
|
|
16197
|
+
* This source code is licensed under the ISC license.
|
|
16198
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16199
|
+
*/
|
|
16200
|
+
const Clock = createLucideIcon("Clock", [
|
|
16201
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
16202
|
+
["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
|
|
16203
|
+
]);
|
|
16207
16204
|
/**
|
|
16208
16205
|
* @license lucide-react v0.447.0 - ISC
|
|
16209
16206
|
*
|
|
@@ -16578,6 +16575,23 @@ const Trash2 = createLucideIcon("Trash2", [
|
|
|
16578
16575
|
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
16579
16576
|
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
16580
16577
|
]);
|
|
16578
|
+
/**
|
|
16579
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16580
|
+
*
|
|
16581
|
+
* This source code is licensed under the ISC license.
|
|
16582
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16583
|
+
*/
|
|
16584
|
+
const TriangleAlert = createLucideIcon("TriangleAlert", [
|
|
16585
|
+
[
|
|
16586
|
+
"path",
|
|
16587
|
+
{
|
|
16588
|
+
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
|
|
16589
|
+
key: "wmoenq"
|
|
16590
|
+
}
|
|
16591
|
+
],
|
|
16592
|
+
["path", { d: "M12 9v4", key: "juzpu7" }],
|
|
16593
|
+
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
16594
|
+
]);
|
|
16581
16595
|
/**
|
|
16582
16596
|
* @license lucide-react v0.447.0 - ISC
|
|
16583
16597
|
*
|
|
@@ -16615,6 +16629,21 @@ const Wifi = createLucideIcon("Wifi", [
|
|
|
16615
16629
|
["path", { d: "M5 12.859a10 10 0 0 1 14 0", key: "1x1e6c" }],
|
|
16616
16630
|
["path", { d: "M8.5 16.429a5 5 0 0 1 7 0", key: "1bycff" }]
|
|
16617
16631
|
]);
|
|
16632
|
+
/**
|
|
16633
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16634
|
+
*
|
|
16635
|
+
* This source code is licensed under the ISC license.
|
|
16636
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16637
|
+
*/
|
|
16638
|
+
const Wrench = createLucideIcon("Wrench", [
|
|
16639
|
+
[
|
|
16640
|
+
"path",
|
|
16641
|
+
{
|
|
16642
|
+
d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",
|
|
16643
|
+
key: "cbrjhi"
|
|
16644
|
+
}
|
|
16645
|
+
]
|
|
16646
|
+
]);
|
|
16618
16647
|
/**
|
|
16619
16648
|
* @license lucide-react v0.447.0 - ISC
|
|
16620
16649
|
*
|
|
@@ -16778,6 +16807,38 @@ const DEFAULT_INSPECTOR_CONFIG = {
|
|
|
16778
16807
|
value: ""
|
|
16779
16808
|
}
|
|
16780
16809
|
};
|
|
16810
|
+
const CLAUDE_MODELS = [
|
|
16811
|
+
{
|
|
16812
|
+
id: "claude-opus-4-0",
|
|
16813
|
+
name: "Claude Opus 4",
|
|
16814
|
+
description: "Latest and most powerful model for complex reasoning"
|
|
16815
|
+
},
|
|
16816
|
+
{
|
|
16817
|
+
id: "claude-sonnet-4-0",
|
|
16818
|
+
name: "Claude Sonnet 4",
|
|
16819
|
+
description: "Next generation balanced model with enhanced capabilities"
|
|
16820
|
+
},
|
|
16821
|
+
{
|
|
16822
|
+
id: "claude-3-7-sonnet-latest",
|
|
16823
|
+
name: "Claude Sonnet 3.7",
|
|
16824
|
+
description: "Most intelligent model with extended thinking"
|
|
16825
|
+
},
|
|
16826
|
+
{
|
|
16827
|
+
id: "claude-3-5-sonnet-latest",
|
|
16828
|
+
name: "Claude Sonnet 3.5",
|
|
16829
|
+
description: "High level of intelligence and capability"
|
|
16830
|
+
},
|
|
16831
|
+
{
|
|
16832
|
+
id: "claude-3-5-haiku-latest",
|
|
16833
|
+
name: "Claude Haiku 3.5",
|
|
16834
|
+
description: "Fastest model - intelligence at blazing speeds"
|
|
16835
|
+
},
|
|
16836
|
+
{
|
|
16837
|
+
id: "claude-3-opus-latest",
|
|
16838
|
+
name: "Claude Opus 3",
|
|
16839
|
+
description: "Top-level intelligence, fluency, and understanding"
|
|
16840
|
+
}
|
|
16841
|
+
];
|
|
16781
16842
|
class InspectorOAuthClientProvider {
|
|
16782
16843
|
constructor(serverUrl) {
|
|
16783
16844
|
this.serverUrl = serverUrl;
|
|
@@ -18086,7 +18147,8 @@ function useDraggablePane(initialHeight) {
|
|
|
18086
18147
|
}
|
|
18087
18148
|
const HistoryAndNotifications = ({
|
|
18088
18149
|
requestHistory,
|
|
18089
|
-
toolResult
|
|
18150
|
+
toolResult,
|
|
18151
|
+
onClearHistory
|
|
18090
18152
|
}) => {
|
|
18091
18153
|
const [expandedRequests, setExpandedRequests] = reactExports.useState({});
|
|
18092
18154
|
const [isHistoryCollapsed, setIsHistoryCollapsed] = reactExports.useState(true);
|
|
@@ -18178,10 +18240,21 @@ const HistoryAndNotifications = ({
|
|
|
18178
18240
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "All Activity" })
|
|
18179
18241
|
] }),
|
|
18180
18242
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
18181
|
-
requestHistory.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
18182
|
-
|
|
18183
|
-
|
|
18184
|
-
|
|
18243
|
+
requestHistory.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
18244
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-muted-foreground bg-muted/50 px-3 py-1 rounded-full", children: [
|
|
18245
|
+
requestHistory.length,
|
|
18246
|
+
" request",
|
|
18247
|
+
requestHistory.length !== 1 ? "s" : ""
|
|
18248
|
+
] }),
|
|
18249
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18250
|
+
"button",
|
|
18251
|
+
{
|
|
18252
|
+
onClick: onClearHistory,
|
|
18253
|
+
className: "p-2 rounded-lg hover:bg-destructive/10 hover:text-destructive transition-all duration-200 group",
|
|
18254
|
+
title: "Clear all activity",
|
|
18255
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trash2, { className: "w-4 h-4 text-muted-foreground group-hover:text-destructive" })
|
|
18256
|
+
}
|
|
18257
|
+
)
|
|
18185
18258
|
] }),
|
|
18186
18259
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18187
18260
|
"button",
|
|
@@ -19045,6 +19118,9 @@ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
|
19045
19118
|
var availableScroll = 0;
|
|
19046
19119
|
var availableScrollTop = 0;
|
|
19047
19120
|
do {
|
|
19121
|
+
if (!target) {
|
|
19122
|
+
break;
|
|
19123
|
+
}
|
|
19048
19124
|
var _a2 = getScrollVariables(axis, target), position = _a2[0], scroll_1 = _a2[1], capacity = _a2[2];
|
|
19049
19125
|
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
19050
19126
|
if (position || elementScroll) {
|
|
@@ -19053,7 +19129,8 @@ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
|
19053
19129
|
availableScrollTop += position;
|
|
19054
19130
|
}
|
|
19055
19131
|
}
|
|
19056
|
-
|
|
19132
|
+
var parent_1 = target.parentNode;
|
|
19133
|
+
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
19057
19134
|
} while (
|
|
19058
19135
|
// portaled content
|
|
19059
19136
|
!targetInLock && target !== document.body || // self content
|
|
@@ -20527,10 +20604,10 @@ const flip$2 = function(options) {
|
|
|
20527
20604
|
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
20528
20605
|
const nextPlacement = placements[nextIndex];
|
|
20529
20606
|
if (nextPlacement) {
|
|
20530
|
-
var _overflowsData$;
|
|
20531
20607
|
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
20532
|
-
|
|
20533
|
-
|
|
20608
|
+
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
20609
|
+
// overflows the main axis.
|
|
20610
|
+
overflowsData.every((d) => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
|
|
20534
20611
|
return {
|
|
20535
20612
|
data: {
|
|
20536
20613
|
index: nextIndex,
|
|
@@ -21664,7 +21741,10 @@ const computePosition = (reference, floating, options) => {
|
|
|
21664
21741
|
platform: platformWithCache
|
|
21665
21742
|
});
|
|
21666
21743
|
};
|
|
21667
|
-
var
|
|
21744
|
+
var isClient = typeof document !== "undefined";
|
|
21745
|
+
var noop$2 = function noop() {
|
|
21746
|
+
};
|
|
21747
|
+
var index = isClient ? reactExports.useLayoutEffect : noop$2;
|
|
21668
21748
|
function deepEqual(a, b) {
|
|
21669
21749
|
if (a === b) {
|
|
21670
21750
|
return true;
|
|
@@ -26729,6 +26809,300 @@ const ToolsTab = ({
|
|
|
26729
26809
|
};
|
|
26730
26810
|
const McpClientContext = reactExports.createContext(null);
|
|
26731
26811
|
const useMcpClient = () => reactExports.useContext(McpClientContext);
|
|
26812
|
+
const ToolCallMessage = ({
|
|
26813
|
+
toolCall
|
|
26814
|
+
}) => {
|
|
26815
|
+
const { type: type2, toolName, args, error, message } = toolCall;
|
|
26816
|
+
const getIcon = () => {
|
|
26817
|
+
switch (type2) {
|
|
26818
|
+
case "tool_call":
|
|
26819
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Wrench, { className: "w-3 h-3" });
|
|
26820
|
+
case "tool_error":
|
|
26821
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleAlert, { className: "w-3 h-3" });
|
|
26822
|
+
case "tool_warning":
|
|
26823
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Clock, { className: "w-3 h-3" });
|
|
26824
|
+
default:
|
|
26825
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Wrench, { className: "w-3 h-3" });
|
|
26826
|
+
}
|
|
26827
|
+
};
|
|
26828
|
+
const getColors = () => {
|
|
26829
|
+
switch (type2) {
|
|
26830
|
+
case "tool_call":
|
|
26831
|
+
return "bg-blue-50 dark:bg-blue-950/30 border-blue-200 dark:border-blue-800 text-blue-800 dark:text-blue-300";
|
|
26832
|
+
case "tool_error":
|
|
26833
|
+
return "bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-800 text-red-800 dark:text-red-300";
|
|
26834
|
+
case "tool_warning":
|
|
26835
|
+
return "bg-yellow-50 dark:bg-yellow-950/30 border-yellow-200 dark:border-yellow-800 text-yellow-800 dark:text-yellow-300";
|
|
26836
|
+
default:
|
|
26837
|
+
return "bg-gray-50 dark:bg-gray-950/30 border-gray-200 dark:border-gray-800 text-gray-800 dark:text-gray-300";
|
|
26838
|
+
}
|
|
26839
|
+
};
|
|
26840
|
+
const formatArgs = (args2) => {
|
|
26841
|
+
if (typeof args2 === "string") return args2;
|
|
26842
|
+
if (args2 === null || args2 === void 0) return String(args2);
|
|
26843
|
+
try {
|
|
26844
|
+
return JSON.stringify(args2, null, 2);
|
|
26845
|
+
} catch {
|
|
26846
|
+
return String(args2);
|
|
26847
|
+
}
|
|
26848
|
+
};
|
|
26849
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
26850
|
+
"div",
|
|
26851
|
+
{
|
|
26852
|
+
className: cn(
|
|
26853
|
+
"rounded-lg border p-3 mb-2 text-xs font-mono",
|
|
26854
|
+
getColors()
|
|
26855
|
+
),
|
|
26856
|
+
children: [
|
|
26857
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
26858
|
+
getIcon(),
|
|
26859
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-semibold", children: [
|
|
26860
|
+
type2 === "tool_call" && `Calling ${toolName}`,
|
|
26861
|
+
type2 === "tool_error" && `${toolName} failed`,
|
|
26862
|
+
type2 === "tool_warning" && "Warning"
|
|
26863
|
+
] })
|
|
26864
|
+
] }),
|
|
26865
|
+
type2 === "tool_call" && args && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
|
|
26866
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs opacity-75 mb-1", children: "Arguments:" }),
|
|
26867
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "text-xs bg-black/10 dark:bg-white/10 rounded p-2 overflow-x-auto whitespace-pre-wrap", children: formatArgs(args) })
|
|
26868
|
+
] }),
|
|
26869
|
+
type2 === "tool_error" && error && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
|
|
26870
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs opacity-75 mb-1", children: "Error:" }),
|
|
26871
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "text-xs bg-black/10 dark:bg-white/10 rounded p-2 overflow-x-auto whitespace-pre-wrap", children: error })
|
|
26872
|
+
] }),
|
|
26873
|
+
type2 === "tool_warning" && message && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs bg-black/10 dark:bg-white/10 rounded p-2", children: message }) })
|
|
26874
|
+
]
|
|
26875
|
+
}
|
|
26876
|
+
);
|
|
26877
|
+
};
|
|
26878
|
+
const parseToolCallContent = (content) => {
|
|
26879
|
+
const toolCalls = [];
|
|
26880
|
+
let cleanText = content;
|
|
26881
|
+
const toolCallPattern = /\[Calling tool (\w+) with args (.*?)\]/g;
|
|
26882
|
+
let match;
|
|
26883
|
+
while ((match = toolCallPattern.exec(content)) !== null) {
|
|
26884
|
+
const [fullMatch, toolName, argsStr] = match;
|
|
26885
|
+
try {
|
|
26886
|
+
const args = JSON.parse(argsStr);
|
|
26887
|
+
toolCalls.push({
|
|
26888
|
+
type: "tool_call",
|
|
26889
|
+
toolName,
|
|
26890
|
+
args
|
|
26891
|
+
});
|
|
26892
|
+
} catch {
|
|
26893
|
+
toolCalls.push({
|
|
26894
|
+
type: "tool_call",
|
|
26895
|
+
toolName,
|
|
26896
|
+
args: argsStr
|
|
26897
|
+
});
|
|
26898
|
+
}
|
|
26899
|
+
cleanText = cleanText.replace(fullMatch, "").trim();
|
|
26900
|
+
}
|
|
26901
|
+
const toolErrorPattern = /\[Tool (\w+) failed: ([\s\S]*?)\](?=\s*(?:\n|$|\[(?:Tool|Warning|Calling)))/g;
|
|
26902
|
+
while ((match = toolErrorPattern.exec(content)) !== null) {
|
|
26903
|
+
const [fullMatch, toolName, error] = match;
|
|
26904
|
+
toolCalls.push({
|
|
26905
|
+
type: "tool_error",
|
|
26906
|
+
toolName,
|
|
26907
|
+
error: error.trim()
|
|
26908
|
+
});
|
|
26909
|
+
cleanText = cleanText.replace(fullMatch, "").trim();
|
|
26910
|
+
}
|
|
26911
|
+
const warningPattern = /\[Warning: (.*?)\]/g;
|
|
26912
|
+
while ((match = warningPattern.exec(content)) !== null) {
|
|
26913
|
+
const [fullMatch, message] = match;
|
|
26914
|
+
toolCalls.push({
|
|
26915
|
+
type: "tool_warning",
|
|
26916
|
+
toolName: "system",
|
|
26917
|
+
message
|
|
26918
|
+
});
|
|
26919
|
+
cleanText = cleanText.replace(fullMatch, "").trim();
|
|
26920
|
+
}
|
|
26921
|
+
return {
|
|
26922
|
+
text: cleanText,
|
|
26923
|
+
toolCalls
|
|
26924
|
+
};
|
|
26925
|
+
};
|
|
26926
|
+
const ClaudeLogo = ({
|
|
26927
|
+
className = "",
|
|
26928
|
+
size: size2 = 32
|
|
26929
|
+
}) => {
|
|
26930
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
26931
|
+
"img",
|
|
26932
|
+
{
|
|
26933
|
+
src: "/claude_logo.png",
|
|
26934
|
+
alt: "Claude Logo",
|
|
26935
|
+
width: size2,
|
|
26936
|
+
height: size2,
|
|
26937
|
+
className,
|
|
26938
|
+
style: {
|
|
26939
|
+
width: size2,
|
|
26940
|
+
height: size2,
|
|
26941
|
+
objectFit: "contain"
|
|
26942
|
+
}
|
|
26943
|
+
}
|
|
26944
|
+
);
|
|
26945
|
+
};
|
|
26946
|
+
const createMessage = (role, content) => ({
|
|
26947
|
+
role,
|
|
26948
|
+
content,
|
|
26949
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
26950
|
+
});
|
|
26951
|
+
const getClaudeApiKey = (mcpClient) => {
|
|
26952
|
+
return mcpClient && typeof mcpClient === "object" && mcpClient !== null && "anthropic" in mcpClient && mcpClient.anthropic ? mcpClient.anthropic.apiKey || "" : "";
|
|
26953
|
+
};
|
|
26954
|
+
const validateSendConditions = (input, mcpClient, claudeApiKey, loading) => {
|
|
26955
|
+
return {
|
|
26956
|
+
isDisabled: loading || !claudeApiKey,
|
|
26957
|
+
isSendDisabled: loading || !claudeApiKey || !input.trim(),
|
|
26958
|
+
canSend: input.trim() && mcpClient && claudeApiKey && !loading
|
|
26959
|
+
};
|
|
26960
|
+
};
|
|
26961
|
+
const handleTextareaResize = (target) => {
|
|
26962
|
+
target.style.height = "auto";
|
|
26963
|
+
target.style.height = Math.min(target.scrollHeight, 128) + "px";
|
|
26964
|
+
};
|
|
26965
|
+
const createSyntheticFormEvent = (preventDefault) => {
|
|
26966
|
+
const formEvent = new Event("submit", {
|
|
26967
|
+
bubbles: true,
|
|
26968
|
+
cancelable: true
|
|
26969
|
+
});
|
|
26970
|
+
Object.defineProperty(formEvent, "preventDefault", {
|
|
26971
|
+
value: preventDefault,
|
|
26972
|
+
writable: false
|
|
26973
|
+
});
|
|
26974
|
+
return formEvent;
|
|
26975
|
+
};
|
|
26976
|
+
const LoadingDots = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1 py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex space-x-1", children: [
|
|
26977
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1 h-1 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:-0.3s]" }),
|
|
26978
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1 h-1 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:-0.15s]" }),
|
|
26979
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1 h-1 bg-muted-foreground/40 rounded-full animate-bounce" })
|
|
26980
|
+
] }) });
|
|
26981
|
+
const MessageBubble = ({ message }) => {
|
|
26982
|
+
const isUser = message.role === "user";
|
|
26983
|
+
const parsedContent = parseToolCallContent(message.content);
|
|
26984
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
26985
|
+
"div",
|
|
26986
|
+
{
|
|
26987
|
+
className: cn(
|
|
26988
|
+
"flex gap-3 px-6 py-4",
|
|
26989
|
+
isUser ? "justify-end" : "justify-start"
|
|
26990
|
+
),
|
|
26991
|
+
children: [
|
|
26992
|
+
!isUser && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
26993
|
+
ClaudeLogo,
|
|
26994
|
+
{
|
|
26995
|
+
className: "text-slate-600 dark:text-slate-300",
|
|
26996
|
+
size: 20
|
|
26997
|
+
}
|
|
26998
|
+
) }),
|
|
26999
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
27000
|
+
"div",
|
|
27001
|
+
{
|
|
27002
|
+
className: cn(
|
|
27003
|
+
"max-w-[75%] rounded-xl px-4 py-3 break-words",
|
|
27004
|
+
isUser ? "bg-slate-900 dark:bg-slate-100 text-white dark:text-slate-900" : "bg-slate-50 dark:bg-slate-800/50 text-slate-900 dark:text-slate-100"
|
|
27005
|
+
),
|
|
27006
|
+
children: [
|
|
27007
|
+
parsedContent.text && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm leading-relaxed whitespace-pre-wrap", children: parsedContent.text }),
|
|
27008
|
+
parsedContent.toolCalls.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3", children: parsedContent.toolCalls.map((toolCall, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(ToolCallMessage, { toolCall }, index2)) }),
|
|
27009
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27010
|
+
"div",
|
|
27011
|
+
{
|
|
27012
|
+
className: cn(
|
|
27013
|
+
"text-xs mt-2 opacity-50",
|
|
27014
|
+
isUser ? "text-white/60 dark:text-slate-900/60" : "text-slate-500 dark:text-slate-400"
|
|
27015
|
+
),
|
|
27016
|
+
children: message.timestamp.toLocaleTimeString([], {
|
|
27017
|
+
hour: "2-digit",
|
|
27018
|
+
minute: "2-digit"
|
|
27019
|
+
})
|
|
27020
|
+
}
|
|
27021
|
+
)
|
|
27022
|
+
]
|
|
27023
|
+
}
|
|
27024
|
+
),
|
|
27025
|
+
isUser && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 rounded-full bg-slate-200 dark:bg-slate-700 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(User, { className: "w-3 h-3 text-slate-600 dark:text-slate-300" }) })
|
|
27026
|
+
]
|
|
27027
|
+
}
|
|
27028
|
+
);
|
|
27029
|
+
};
|
|
27030
|
+
const ModelSelector = ({
|
|
27031
|
+
selectedModel,
|
|
27032
|
+
showModelSelector,
|
|
27033
|
+
loading,
|
|
27034
|
+
onToggle,
|
|
27035
|
+
onModelSelect,
|
|
27036
|
+
modelSelectorRef
|
|
27037
|
+
}) => {
|
|
27038
|
+
var _a2;
|
|
27039
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", ref: modelSelectorRef, children: [
|
|
27040
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
27041
|
+
"button",
|
|
27042
|
+
{
|
|
27043
|
+
onClick: onToggle,
|
|
27044
|
+
className: "flex items-center gap-2 px-3 py-1.5 text-sm bg-slate-50 dark:bg-slate-800/50 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors border border-slate-200 dark:border-slate-700",
|
|
27045
|
+
disabled: loading,
|
|
27046
|
+
children: [
|
|
27047
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-slate-700 dark:text-slate-200 font-medium", children: ((_a2 = CLAUDE_MODELS.find((m2) => m2.id === selectedModel)) == null ? void 0 : _a2.name) || selectedModel }),
|
|
27048
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "w-3 h-3 text-slate-400" })
|
|
27049
|
+
]
|
|
27050
|
+
}
|
|
27051
|
+
),
|
|
27052
|
+
showModelSelector && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute right-0 top-full mt-2 w-72 bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-xl shadow-lg z-50", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-2", children: CLAUDE_MODELS.map((model) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
27053
|
+
"button",
|
|
27054
|
+
{
|
|
27055
|
+
onClick: () => onModelSelect(model.id),
|
|
27056
|
+
className: cn(
|
|
27057
|
+
"w-full px-4 py-3 text-left hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors",
|
|
27058
|
+
selectedModel === model.id && "bg-slate-50 dark:bg-slate-800"
|
|
27059
|
+
),
|
|
27060
|
+
children: [
|
|
27061
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium text-slate-900 dark:text-slate-100", children: model.name }),
|
|
27062
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-slate-500 dark:text-slate-400 mt-0.5", children: model.description })
|
|
27063
|
+
]
|
|
27064
|
+
},
|
|
27065
|
+
model.id
|
|
27066
|
+
)) }) })
|
|
27067
|
+
] });
|
|
27068
|
+
};
|
|
27069
|
+
const ApiKeyRequiredState = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full p-8", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center max-w-sm space-y-4", children: [
|
|
27070
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-12 h-12 mx-auto rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Key, { className: "w-5 h-5 text-slate-400" }) }),
|
|
27071
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
27072
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium text-slate-900 dark:text-slate-100", children: "API Key Required" }),
|
|
27073
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-slate-500 dark:text-slate-400", children: "Configure your Claude API key to start chatting" })
|
|
27074
|
+
] })
|
|
27075
|
+
] }) });
|
|
27076
|
+
const EmptyChatsState = ({ onSuggestionClick }) => {
|
|
27077
|
+
const suggestions = [
|
|
27078
|
+
"Hello! How can you help me?",
|
|
27079
|
+
"Help me write some code",
|
|
27080
|
+
"Explain a concept to me",
|
|
27081
|
+
"Help me with writing"
|
|
27082
|
+
];
|
|
27083
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full p-8", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center max-w-md space-y-6", children: [
|
|
27084
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-12 h-12 mx-auto rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27085
|
+
ClaudeLogo,
|
|
27086
|
+
{
|
|
27087
|
+
className: "text-slate-600 dark:text-slate-300",
|
|
27088
|
+
size: 20
|
|
27089
|
+
}
|
|
27090
|
+
) }),
|
|
27091
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
27092
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium text-slate-900 dark:text-slate-100", children: "Start chatting with Claude" }),
|
|
27093
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-slate-500 dark:text-slate-400", children: "Ask me anything - I'm here to help!" })
|
|
27094
|
+
] }),
|
|
27095
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-2 pt-2", children: suggestions.map((suggestion) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27096
|
+
"button",
|
|
27097
|
+
{
|
|
27098
|
+
onClick: () => onSuggestionClick(suggestion),
|
|
27099
|
+
className: "px-4 py-2 text-sm bg-slate-50 dark:bg-slate-800/50 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors border border-slate-200 dark:border-slate-700 text-slate-700 dark:text-slate-200",
|
|
27100
|
+
children: suggestion
|
|
27101
|
+
},
|
|
27102
|
+
suggestion
|
|
27103
|
+
)) })
|
|
27104
|
+
] }) });
|
|
27105
|
+
};
|
|
26732
27106
|
const ChatTab = () => {
|
|
26733
27107
|
const mcpClient = useMcpClient();
|
|
26734
27108
|
const [input, setInput] = reactExports.useState("");
|
|
@@ -26736,62 +27110,60 @@ const ChatTab = () => {
|
|
|
26736
27110
|
const [loading, setLoading] = reactExports.useState(false);
|
|
26737
27111
|
const [error, setError] = reactExports.useState(null);
|
|
26738
27112
|
const [tools, setTools] = reactExports.useState([]);
|
|
27113
|
+
const [selectedModel, setSelectedModel] = reactExports.useState(
|
|
27114
|
+
"claude-3-5-sonnet-latest"
|
|
27115
|
+
);
|
|
27116
|
+
const [showModelSelector, setShowModelSelector] = reactExports.useState(false);
|
|
26739
27117
|
const chatEndRef = reactExports.useRef(null);
|
|
26740
27118
|
const inputRef = reactExports.useRef(null);
|
|
26741
|
-
const
|
|
26742
|
-
|
|
26743
|
-
|
|
26744
|
-
|
|
26745
|
-
|
|
26746
|
-
|
|
26747
|
-
|
|
26748
|
-
|
|
26749
|
-
|
|
26750
|
-
|
|
26751
|
-
|
|
26752
|
-
|
|
27119
|
+
const modelSelectorRef = reactExports.useRef(null);
|
|
27120
|
+
const claudeApiKey = getClaudeApiKey(mcpClient);
|
|
27121
|
+
const { isDisabled, isSendDisabled, canSend } = validateSendConditions(
|
|
27122
|
+
input,
|
|
27123
|
+
mcpClient,
|
|
27124
|
+
claudeApiKey,
|
|
27125
|
+
loading
|
|
27126
|
+
);
|
|
27127
|
+
const fetchTools = async () => {
|
|
27128
|
+
if (!mcpClient) return;
|
|
27129
|
+
try {
|
|
27130
|
+
const response = await mcpClient.listTools();
|
|
27131
|
+
setTools(response.tools || []);
|
|
27132
|
+
} catch (e) {
|
|
27133
|
+
const errorMessage = e instanceof Error ? e.message : "Failed to fetch tools";
|
|
27134
|
+
setError(errorMessage);
|
|
26753
27135
|
}
|
|
26754
|
-
|
|
26755
|
-
|
|
26756
|
-
|
|
26757
|
-
|
|
26758
|
-
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
|
|
26762
|
-
|
|
26763
|
-
reactExports.useEffect(() => {
|
|
26764
|
-
if (claudeApiKey && inputRef.current) {
|
|
26765
|
-
inputRef.current.focus();
|
|
27136
|
+
};
|
|
27137
|
+
const addMessageToChat = (message) => {
|
|
27138
|
+
setChat((prev) => [...prev, message]);
|
|
27139
|
+
};
|
|
27140
|
+
const processUserQuery = async (userMessage) => {
|
|
27141
|
+
if (!mcpClient || !("processQuery" in mcpClient) || typeof mcpClient.processQuery !== "function") {
|
|
27142
|
+
throw new Error(
|
|
27143
|
+
"Chat functionality is not available. Please ensure you have a valid API key and the server is connected."
|
|
27144
|
+
);
|
|
26766
27145
|
}
|
|
26767
|
-
|
|
27146
|
+
await mcpClient.processQuery(
|
|
27147
|
+
userMessage,
|
|
27148
|
+
tools,
|
|
27149
|
+
(content) => {
|
|
27150
|
+
const assistantMessage = createMessage("assistant", content);
|
|
27151
|
+
addMessageToChat(assistantMessage);
|
|
27152
|
+
},
|
|
27153
|
+
selectedModel
|
|
27154
|
+
);
|
|
27155
|
+
};
|
|
26768
27156
|
const handleSend = async (e) => {
|
|
26769
27157
|
e.preventDefault();
|
|
26770
27158
|
setError(null);
|
|
26771
|
-
if (!
|
|
27159
|
+
if (!canSend) return;
|
|
26772
27160
|
const userMessage = input.trim();
|
|
26773
|
-
const newMessage =
|
|
26774
|
-
|
|
26775
|
-
content: userMessage,
|
|
26776
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
26777
|
-
};
|
|
26778
|
-
setChat((prev) => [...prev, newMessage]);
|
|
27161
|
+
const newMessage = createMessage("user", userMessage);
|
|
27162
|
+
addMessageToChat(newMessage);
|
|
26779
27163
|
setInput("");
|
|
26780
27164
|
setLoading(true);
|
|
26781
27165
|
try {
|
|
26782
|
-
|
|
26783
|
-
const response = await mcpClient.processQuery(userMessage, tools);
|
|
26784
|
-
const assistantMessage = {
|
|
26785
|
-
role: "assistant",
|
|
26786
|
-
content: response,
|
|
26787
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
26788
|
-
};
|
|
26789
|
-
setChat((prev) => [...prev, assistantMessage]);
|
|
26790
|
-
} else {
|
|
26791
|
-
throw new Error(
|
|
26792
|
-
"Chat functionality is not available. Please ensure you have a valid API key and the server is connected."
|
|
26793
|
-
);
|
|
26794
|
-
}
|
|
27166
|
+
await processUserQuery(userMessage);
|
|
26795
27167
|
} catch (e2) {
|
|
26796
27168
|
const errorMessage = e2 instanceof Error ? e2.message : "Error sending message";
|
|
26797
27169
|
setError(errorMessage);
|
|
@@ -26803,142 +27175,126 @@ const ChatTab = () => {
|
|
|
26803
27175
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
26804
27176
|
e.preventDefault();
|
|
26805
27177
|
if (!isSendDisabled) {
|
|
26806
|
-
const formEvent =
|
|
26807
|
-
bubbles: true,
|
|
26808
|
-
cancelable: true
|
|
26809
|
-
});
|
|
26810
|
-
Object.defineProperty(formEvent, "preventDefault", {
|
|
26811
|
-
value: () => e.preventDefault(),
|
|
26812
|
-
writable: false
|
|
26813
|
-
});
|
|
27178
|
+
const formEvent = createSyntheticFormEvent(() => e.preventDefault());
|
|
26814
27179
|
handleSend(formEvent);
|
|
26815
27180
|
}
|
|
26816
27181
|
}
|
|
26817
27182
|
};
|
|
26818
|
-
const
|
|
26819
|
-
|
|
26820
|
-
|
|
26821
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce [animation-delay:-0.3s]" }),
|
|
26822
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce [animation-delay:-0.15s]" }),
|
|
26823
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce" })
|
|
26824
|
-
] }) });
|
|
26825
|
-
const MessageBubble = ({ message }) => {
|
|
26826
|
-
const isUser = message.role === "user";
|
|
26827
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
26828
|
-
"div",
|
|
26829
|
-
{
|
|
26830
|
-
className: cn(
|
|
26831
|
-
"flex gap-3 px-4 py-3",
|
|
26832
|
-
isUser ? "justify-end" : "justify-start"
|
|
26833
|
-
),
|
|
26834
|
-
children: [
|
|
26835
|
-
!isUser && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-7 h-7 rounded-full bg-gradient-to-br from-purple-500 to-blue-600 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bot, { className: "w-4 h-4 text-white" }) }),
|
|
26836
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
26837
|
-
"div",
|
|
26838
|
-
{
|
|
26839
|
-
className: cn(
|
|
26840
|
-
"max-w-[80%] rounded-2xl px-4 py-2.5 break-words",
|
|
26841
|
-
isUser ? "bg-primary text-primary-foreground ml-auto" : "bg-muted text-foreground"
|
|
26842
|
-
),
|
|
26843
|
-
children: [
|
|
26844
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm leading-relaxed whitespace-pre-wrap", children: message.content }),
|
|
26845
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
26846
|
-
"div",
|
|
26847
|
-
{
|
|
26848
|
-
className: cn(
|
|
26849
|
-
"text-xs mt-1 opacity-70",
|
|
26850
|
-
isUser ? "text-primary-foreground/70" : "text-muted-foreground"
|
|
26851
|
-
),
|
|
26852
|
-
children: message.timestamp.toLocaleTimeString([], {
|
|
26853
|
-
hour: "2-digit",
|
|
26854
|
-
minute: "2-digit"
|
|
26855
|
-
})
|
|
26856
|
-
}
|
|
26857
|
-
)
|
|
26858
|
-
]
|
|
26859
|
-
}
|
|
26860
|
-
),
|
|
26861
|
-
isUser && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-7 h-7 rounded-full bg-primary flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(User, { className: "w-4 h-4 text-primary-foreground" }) })
|
|
26862
|
-
]
|
|
26863
|
-
}
|
|
26864
|
-
);
|
|
27183
|
+
const handleInputChange = (e) => {
|
|
27184
|
+
setInput(e.target.value);
|
|
27185
|
+
handleTextareaResize(e.target);
|
|
26865
27186
|
};
|
|
26866
|
-
|
|
26867
|
-
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
|
|
26876
|
-
|
|
26877
|
-
|
|
26878
|
-
|
|
26879
|
-
|
|
26880
|
-
|
|
26881
|
-
|
|
26882
|
-
|
|
26883
|
-
|
|
26884
|
-
|
|
26885
|
-
|
|
26886
|
-
|
|
26887
|
-
|
|
26888
|
-
|
|
26889
|
-
|
|
26890
|
-
|
|
26891
|
-
|
|
26892
|
-
|
|
26893
|
-
|
|
27187
|
+
const handleModelSelect = (modelId) => {
|
|
27188
|
+
setSelectedModel(modelId);
|
|
27189
|
+
setShowModelSelector(false);
|
|
27190
|
+
};
|
|
27191
|
+
const toggleModelSelector = () => {
|
|
27192
|
+
setShowModelSelector(!showModelSelector);
|
|
27193
|
+
};
|
|
27194
|
+
reactExports.useEffect(() => {
|
|
27195
|
+
let mounted = true;
|
|
27196
|
+
const initializeTools = async () => {
|
|
27197
|
+
if (mounted) {
|
|
27198
|
+
await fetchTools();
|
|
27199
|
+
}
|
|
27200
|
+
};
|
|
27201
|
+
initializeTools();
|
|
27202
|
+
return () => {
|
|
27203
|
+
mounted = false;
|
|
27204
|
+
};
|
|
27205
|
+
}, [mcpClient]);
|
|
27206
|
+
reactExports.useEffect(() => {
|
|
27207
|
+
var _a2;
|
|
27208
|
+
(_a2 = chatEndRef.current) == null ? void 0 : _a2.scrollIntoView({ behavior: "smooth" });
|
|
27209
|
+
}, [chat]);
|
|
27210
|
+
reactExports.useEffect(() => {
|
|
27211
|
+
if (claudeApiKey && inputRef.current) {
|
|
27212
|
+
inputRef.current.focus();
|
|
27213
|
+
}
|
|
27214
|
+
}, [claudeApiKey]);
|
|
27215
|
+
reactExports.useEffect(() => {
|
|
27216
|
+
const handleClickOutside = (event) => {
|
|
27217
|
+
if (modelSelectorRef.current && !modelSelectorRef.current.contains(event.target)) {
|
|
27218
|
+
setShowModelSelector(false);
|
|
27219
|
+
}
|
|
27220
|
+
};
|
|
27221
|
+
if (showModelSelector) {
|
|
27222
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
27223
|
+
}
|
|
27224
|
+
return () => {
|
|
27225
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
27226
|
+
};
|
|
27227
|
+
}, [showModelSelector]);
|
|
27228
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full bg-white dark:bg-slate-950", children: [
|
|
27229
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 border-b border-slate-200 dark:border-slate-800", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
27230
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
27231
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-8 h-8 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27232
|
+
ClaudeLogo,
|
|
26894
27233
|
{
|
|
26895
|
-
|
|
26896
|
-
|
|
26897
|
-
|
|
26898
|
-
|
|
26899
|
-
|
|
26900
|
-
|
|
26901
|
-
|
|
27234
|
+
className: "text-slate-600 dark:text-slate-300",
|
|
27235
|
+
size: 20
|
|
27236
|
+
}
|
|
27237
|
+
) }),
|
|
27238
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
27239
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-base font-semibold text-slate-900 dark:text-slate-100", children: "Claude" }),
|
|
27240
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-slate-500 dark:text-slate-400", children: claudeApiKey ? "Ready to help" : "API key required" })
|
|
27241
|
+
] })
|
|
27242
|
+
] }),
|
|
27243
|
+
claudeApiKey && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27244
|
+
ModelSelector,
|
|
27245
|
+
{
|
|
27246
|
+
selectedModel,
|
|
27247
|
+
showModelSelector,
|
|
27248
|
+
loading,
|
|
27249
|
+
onToggle: toggleModelSelector,
|
|
27250
|
+
onModelSelect: handleModelSelect,
|
|
27251
|
+
modelSelectorRef
|
|
27252
|
+
}
|
|
27253
|
+
)
|
|
27254
|
+
] }) }) }),
|
|
27255
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto", children: [
|
|
27256
|
+
!claudeApiKey ? /* @__PURE__ */ jsxRuntimeExports.jsx(ApiKeyRequiredState, {}) : chat.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyChatsState, { onSuggestionClick: setInput }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-2", children: [
|
|
26902
27257
|
chat.map((message, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(MessageBubble, { message }, idx)),
|
|
26903
|
-
loading && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-3 px-
|
|
26904
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-
|
|
26905
|
-
|
|
27258
|
+
loading && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-3 px-6 py-4", children: [
|
|
27259
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27260
|
+
ClaudeLogo,
|
|
27261
|
+
{
|
|
27262
|
+
className: "text-slate-600 dark:text-slate-300",
|
|
27263
|
+
size: 20
|
|
27264
|
+
}
|
|
27265
|
+
) }),
|
|
27266
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-slate-50 dark:bg-slate-800/50 rounded-xl px-4 py-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingDots, {}) })
|
|
26906
27267
|
] })
|
|
26907
27268
|
] }),
|
|
26908
27269
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: chatEndRef })
|
|
26909
27270
|
] }),
|
|
26910
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 px-
|
|
27271
|
+
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 px-6 py-3 bg-red-50 dark:bg-red-950/50 border-t border-red-200 dark:border-red-800", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-red-700 dark:text-red-300 text-sm", children: [
|
|
26911
27272
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: "⚠️" }),
|
|
26912
27273
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: error })
|
|
26913
27274
|
] }) }),
|
|
26914
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 border-t border-border
|
|
26915
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex items-end gap-
|
|
27275
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 border-t border-slate-200 dark:border-slate-800", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: handleSend, className: "relative", children: [
|
|
27276
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex items-end gap-3", children: [
|
|
26916
27277
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
26917
27278
|
"textarea",
|
|
26918
27279
|
{
|
|
26919
27280
|
ref: inputRef,
|
|
26920
27281
|
value: input,
|
|
26921
|
-
onChange:
|
|
27282
|
+
onChange: handleInputChange,
|
|
26922
27283
|
onKeyDown: handleKeyDown,
|
|
26923
|
-
placeholder: !claudeApiKey ? "API key required..." : loading ? "Claude is
|
|
27284
|
+
placeholder: !claudeApiKey ? "API key required..." : loading ? "Claude is thinking..." : "Message Claude...",
|
|
26924
27285
|
disabled: isDisabled,
|
|
26925
27286
|
rows: 1,
|
|
26926
27287
|
className: cn(
|
|
26927
|
-
"flex-1 px-4 py-
|
|
26928
|
-
"focus:outline-none focus:ring-
|
|
26929
|
-
"placeholder:text-
|
|
26930
|
-
"min-h-[
|
|
26931
|
-
!claudeApiKey && "opacity-
|
|
27288
|
+
"flex-1 px-4 py-3 rounded-xl border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 resize-none",
|
|
27289
|
+
"focus:outline-none focus:ring-2 focus:ring-slate-400 dark:focus:ring-slate-500 focus:border-transparent",
|
|
27290
|
+
"placeholder:text-slate-400 dark:placeholder:text-slate-500 text-sm",
|
|
27291
|
+
"min-h-[48px] max-h-32 overflow-y-auto",
|
|
27292
|
+
!claudeApiKey && "opacity-50 cursor-not-allowed"
|
|
26932
27293
|
),
|
|
26933
27294
|
style: {
|
|
26934
27295
|
height: "auto",
|
|
26935
|
-
minHeight: "
|
|
27296
|
+
minHeight: "48px",
|
|
26936
27297
|
maxHeight: "128px"
|
|
26937
|
-
},
|
|
26938
|
-
onInput: (e) => {
|
|
26939
|
-
const target = e.target;
|
|
26940
|
-
target.style.height = "auto";
|
|
26941
|
-
target.style.height = Math.min(target.scrollHeight, 128) + "px";
|
|
26942
27298
|
}
|
|
26943
27299
|
}
|
|
26944
27300
|
),
|
|
@@ -26948,14 +27304,14 @@ const ChatTab = () => {
|
|
|
26948
27304
|
type: "submit",
|
|
26949
27305
|
disabled: isSendDisabled,
|
|
26950
27306
|
className: cn(
|
|
26951
|
-
"flex-shrink-0 w-
|
|
26952
|
-
isSendDisabled ? "bg-
|
|
27307
|
+
"flex-shrink-0 w-10 h-10 rounded-xl flex items-center justify-center transition-colors",
|
|
27308
|
+
isSendDisabled ? "bg-slate-100 dark:bg-slate-800 text-slate-400 cursor-not-allowed" : "bg-slate-900 dark:bg-slate-100 text-white dark:text-slate-900 hover:bg-slate-800 dark:hover:bg-slate-200"
|
|
26953
27309
|
),
|
|
26954
27310
|
children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Send, { className: "w-4 h-4" })
|
|
26955
27311
|
}
|
|
26956
27312
|
)
|
|
26957
27313
|
] }),
|
|
26958
|
-
claudeApiKey && !loading && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-
|
|
27314
|
+
claudeApiKey && !loading && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-slate-400 dark:text-slate-500 mt-3 px-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden sm:inline", children: "Press Enter to send • Shift+Enter for new line" }) })
|
|
26959
27315
|
] }) }) })
|
|
26960
27316
|
] });
|
|
26961
27317
|
};
|
|
@@ -28253,7 +28609,7 @@ const useTheme = () => {
|
|
|
28253
28609
|
[theme, setThemeWithSideEffect]
|
|
28254
28610
|
);
|
|
28255
28611
|
};
|
|
28256
|
-
const version$1 = "0.2.
|
|
28612
|
+
const version$1 = "0.2.2";
|
|
28257
28613
|
var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
|
|
28258
28614
|
createPopperScope
|
|
28259
28615
|
]);
|
|
@@ -28745,7 +29101,9 @@ const Sidebar = ({
|
|
|
28745
29101
|
onDisconnectServer,
|
|
28746
29102
|
onCreateClient,
|
|
28747
29103
|
onEditClient,
|
|
28748
|
-
updateTrigger
|
|
29104
|
+
updateTrigger,
|
|
29105
|
+
isExpanded,
|
|
29106
|
+
onToggleExpanded
|
|
28749
29107
|
}) => {
|
|
28750
29108
|
const [theme, setTheme] = useTheme();
|
|
28751
29109
|
const serverConnections = React.useMemo(() => {
|
|
@@ -28787,7 +29145,6 @@ const Sidebar = ({
|
|
|
28787
29145
|
return "text-gray-500 dark:text-gray-400";
|
|
28788
29146
|
}
|
|
28789
29147
|
};
|
|
28790
|
-
const shouldShowCreatePrompt = serverConnections.length === 0;
|
|
28791
29148
|
const shouldDisableConnection = (connection) => {
|
|
28792
29149
|
if (!mcpAgent || connection.connectionStatus === "connected") {
|
|
28793
29150
|
return false;
|
|
@@ -28806,165 +29163,282 @@ const Sidebar = ({
|
|
|
28806
29163
|
}
|
|
28807
29164
|
return "Connect to this server";
|
|
28808
29165
|
};
|
|
28809
|
-
|
|
28810
|
-
|
|
28811
|
-
|
|
28812
|
-
|
|
29166
|
+
const getConnectionDisplayText = (connection) => {
|
|
29167
|
+
var _a2;
|
|
29168
|
+
if (connection.config.transportType === "stdio" && "command" in connection.config) {
|
|
29169
|
+
return `${connection.config.command} ${((_a2 = connection.config.args) == null ? void 0 : _a2.join(" ")) || ""}`;
|
|
29170
|
+
}
|
|
29171
|
+
if ("url" in connection.config && connection.config.url) {
|
|
29172
|
+
return connection.config.url.toString();
|
|
29173
|
+
}
|
|
29174
|
+
return "Unknown configuration";
|
|
29175
|
+
};
|
|
29176
|
+
const renderHeader = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center space-y-2", children: [
|
|
29177
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29178
|
+
"img",
|
|
29179
|
+
{
|
|
29180
|
+
src: getLogoSrc(),
|
|
29181
|
+
alt: "MCP Jam",
|
|
29182
|
+
className: "h-6 w-auto object-contain transition-opacity duration-200",
|
|
29183
|
+
onError: (e) => {
|
|
29184
|
+
console.warn("Failed to load MCP Jam logo");
|
|
29185
|
+
e.currentTarget.style.display = "none";
|
|
29186
|
+
}
|
|
29187
|
+
}
|
|
29188
|
+
) }),
|
|
29189
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs text-muted-foreground opacity-70", children: [
|
|
29190
|
+
"v",
|
|
29191
|
+
version$1
|
|
29192
|
+
] }) })
|
|
29193
|
+
] }) });
|
|
29194
|
+
const renderConnectionsHeader = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 border-b border-border/50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
29195
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
29196
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Server, { className: "w-4 h-4 text-muted-foreground" }),
|
|
29197
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium text-foreground", children: "Connections" }),
|
|
29198
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-muted-foreground bg-muted px-1.5 py-0.5 rounded", children: serverConnections.length })
|
|
29199
|
+
] }),
|
|
29200
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
29201
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29202
|
+
Button,
|
|
28813
29203
|
{
|
|
28814
|
-
|
|
28815
|
-
|
|
28816
|
-
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
|
|
28820
|
-
}
|
|
29204
|
+
onClick: onCreateClient,
|
|
29205
|
+
size: "sm",
|
|
29206
|
+
variant: "ghost",
|
|
29207
|
+
className: "h-7 w-7 p-0 hover:bg-primary/20 hover:text-primary",
|
|
29208
|
+
title: "Create new client",
|
|
29209
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "w-4 h-4" })
|
|
28821
29210
|
}
|
|
28822
29211
|
) }),
|
|
28823
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28824
|
-
|
|
28825
|
-
|
|
28826
|
-
|
|
28827
|
-
|
|
28828
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
|
|
28832
|
-
|
|
28833
|
-
|
|
29212
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: (mcpAgent == null ? void 0 : mcpAgent.hasConnectedRemoteServer()) ? "Note: Creating a remote client will disconnect the current remote connection" : "Create new client" })
|
|
29213
|
+
] })
|
|
29214
|
+
] }) });
|
|
29215
|
+
const renderEmptyState = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-8", children: [
|
|
29216
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Server, { className: "w-12 h-12 text-muted-foreground mx-auto mb-4" }),
|
|
29217
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium mb-2", children: "No clients connected" }),
|
|
29218
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground mb-4", children: "Create your first MCP client to get started" }),
|
|
29219
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { onClick: onCreateClient, size: "sm", className: "w-full", children: [
|
|
29220
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "w-4 h-4 mr-2" }),
|
|
29221
|
+
"Create Client"
|
|
29222
|
+
] })
|
|
29223
|
+
] }) });
|
|
29224
|
+
const renderConnectionActions = (connection) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex space-x-1", children: [
|
|
29225
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29226
|
+
Button,
|
|
29227
|
+
{
|
|
29228
|
+
onClick: (e) => {
|
|
29229
|
+
e.stopPropagation();
|
|
29230
|
+
onEditClient(connection.name);
|
|
29231
|
+
},
|
|
29232
|
+
size: "sm",
|
|
29233
|
+
variant: "ghost",
|
|
29234
|
+
className: "h-6 w-6 p-0",
|
|
29235
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Pen, { className: "w-3 h-3" })
|
|
29236
|
+
}
|
|
29237
|
+
),
|
|
29238
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29239
|
+
Button,
|
|
29240
|
+
{
|
|
29241
|
+
onClick: (e) => {
|
|
29242
|
+
e.stopPropagation();
|
|
29243
|
+
onRemoveServer(connection.name);
|
|
29244
|
+
},
|
|
29245
|
+
size: "sm",
|
|
29246
|
+
variant: "ghost",
|
|
29247
|
+
className: "h-6 w-6 p-0 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-950",
|
|
29248
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trash2, { className: "w-3 h-3" })
|
|
29249
|
+
}
|
|
29250
|
+
)
|
|
29251
|
+
] });
|
|
29252
|
+
const renderConnectionButton = (connection) => {
|
|
29253
|
+
if (connection.connectionStatus === "connected") {
|
|
29254
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29255
|
+
Button,
|
|
29256
|
+
{
|
|
29257
|
+
onClick: (e) => {
|
|
29258
|
+
e.stopPropagation();
|
|
29259
|
+
onDisconnectServer(connection.name);
|
|
29260
|
+
},
|
|
29261
|
+
size: "sm",
|
|
29262
|
+
variant: "outline",
|
|
29263
|
+
className: "h-6 text-xs px-2",
|
|
29264
|
+
children: "Disconnect"
|
|
29265
|
+
}
|
|
29266
|
+
);
|
|
29267
|
+
}
|
|
29268
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
29269
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "inline-block", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29270
|
+
Button,
|
|
29271
|
+
{
|
|
29272
|
+
onClick: (e) => {
|
|
29273
|
+
e.stopPropagation();
|
|
29274
|
+
onConnectServer(connection.name);
|
|
29275
|
+
onServerSelect(connection.name);
|
|
29276
|
+
},
|
|
29277
|
+
size: "sm",
|
|
29278
|
+
className: "h-6 text-xs px-2",
|
|
29279
|
+
disabled: shouldDisableConnection(connection),
|
|
29280
|
+
children: "Connect"
|
|
29281
|
+
}
|
|
29282
|
+
) }) }),
|
|
29283
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: getConnectTooltipMessage(connection) })
|
|
29284
|
+
] });
|
|
29285
|
+
};
|
|
29286
|
+
const renderConnectionItem = (connection) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29287
|
+
"div",
|
|
29288
|
+
{
|
|
29289
|
+
className: `p-3 rounded-lg border cursor-pointer transition-all hover:bg-muted/50 ${selectedServerName === connection.name ? "border-primary bg-primary/10" : "border-border"}`,
|
|
29290
|
+
onClick: () => onServerSelect(connection.name),
|
|
29291
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
29292
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
29293
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
29294
|
+
getConnectionStatusIcon(connection.connectionStatus),
|
|
29295
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
29296
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium text-sm", children: connection.name }),
|
|
29297
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: getConnectionDisplayText(connection) })
|
|
29298
|
+
] })
|
|
29299
|
+
] }),
|
|
29300
|
+
renderConnectionActions(connection)
|
|
29301
|
+
] }),
|
|
29302
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
29303
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29304
|
+
"span",
|
|
29305
|
+
{
|
|
29306
|
+
className: `text-xs capitalize ${getConnectionStatusColor(connection.connectionStatus)}`,
|
|
29307
|
+
children: connection.connectionStatus
|
|
29308
|
+
}
|
|
29309
|
+
),
|
|
29310
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex space-x-1", children: renderConnectionButton(connection) })
|
|
29311
|
+
] })
|
|
29312
|
+
] })
|
|
29313
|
+
},
|
|
29314
|
+
connection.name
|
|
29315
|
+
);
|
|
29316
|
+
const renderThemeSelector = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-t", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
29317
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
28834
29318
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
28835
29319
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28836
29320
|
Button,
|
|
28837
29321
|
{
|
|
28838
|
-
onClick:
|
|
29322
|
+
onClick: () => window.open("https://github.com/MCPJam/inspector", "_blank"),
|
|
28839
29323
|
size: "sm",
|
|
28840
29324
|
variant: "ghost",
|
|
28841
29325
|
className: "h-7 w-7 p-0 hover:bg-primary/20 hover:text-primary",
|
|
28842
|
-
|
|
28843
|
-
|
|
29326
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29327
|
+
"svg",
|
|
29328
|
+
{
|
|
29329
|
+
className: "w-4 h-4",
|
|
29330
|
+
viewBox: "0 0 24 24",
|
|
29331
|
+
fill: "currentColor",
|
|
29332
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" })
|
|
29333
|
+
}
|
|
29334
|
+
)
|
|
28844
29335
|
}
|
|
28845
29336
|
) }),
|
|
28846
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children:
|
|
28847
|
-
] })
|
|
28848
|
-
|
|
28849
|
-
|
|
28850
|
-
shouldShowCreatePrompt && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-8", children: [
|
|
28851
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Server, { className: "w-12 h-12 text-muted-foreground mx-auto mb-4" }),
|
|
28852
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium mb-2", children: "No clients connected" }),
|
|
28853
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground mb-4", children: "Create your first MCP client to get started" }),
|
|
28854
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
29337
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "⭐ Star us on GitHub" })
|
|
29338
|
+
] }),
|
|
29339
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
29340
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28855
29341
|
Button,
|
|
28856
29342
|
{
|
|
28857
|
-
onClick:
|
|
29343
|
+
onClick: () => window.open("https://discord.gg/JEnDtz8X6z", "_blank"),
|
|
28858
29344
|
size: "sm",
|
|
28859
|
-
|
|
28860
|
-
|
|
28861
|
-
|
|
28862
|
-
"
|
|
28863
|
-
|
|
29345
|
+
variant: "ghost",
|
|
29346
|
+
className: "h-7 w-7 p-0 hover:bg-primary/20 hover:text-primary",
|
|
29347
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29348
|
+
"svg",
|
|
29349
|
+
{
|
|
29350
|
+
className: "w-4 h-4",
|
|
29351
|
+
viewBox: "0 0 24 24",
|
|
29352
|
+
fill: "currentColor",
|
|
29353
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0952.2517-.1915.3718-.2892a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.0977.246.1967.3728.2900a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419-.0002 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z" })
|
|
29354
|
+
}
|
|
29355
|
+
)
|
|
28864
29356
|
}
|
|
28865
|
-
)
|
|
28866
|
-
|
|
28867
|
-
|
|
28868
|
-
|
|
28869
|
-
|
|
29357
|
+
) }),
|
|
29358
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Join Discord" })
|
|
29359
|
+
] })
|
|
29360
|
+
] }),
|
|
29361
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
29362
|
+
Select,
|
|
29363
|
+
{
|
|
29364
|
+
value: theme,
|
|
29365
|
+
onValueChange: (value) => setTheme(value),
|
|
29366
|
+
children: [
|
|
29367
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-[100px]", id: "theme-select", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
|
|
29368
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
29369
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "system", children: "System" }),
|
|
29370
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "light", children: "Light" }),
|
|
29371
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "dark", children: "Dark" })
|
|
29372
|
+
] })
|
|
29373
|
+
]
|
|
29374
|
+
}
|
|
29375
|
+
)
|
|
29376
|
+
] }) });
|
|
29377
|
+
const renderToggleExpandedButton = () => {
|
|
29378
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29379
|
+
Button,
|
|
29380
|
+
{
|
|
29381
|
+
onClick: onToggleExpanded,
|
|
29382
|
+
size: "sm",
|
|
29383
|
+
variant: "outline",
|
|
29384
|
+
className: "absolute top-1/2 -translate-y-1/2 -right-4 h-8 w-8 p-0 bg-background border border-border rounded-full shadow-md hover:shadow-lg z-10 transition-all duration-200",
|
|
29385
|
+
children: isExpanded ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeft, { className: "w-4 h-4" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "w-4 h-4" })
|
|
29386
|
+
}
|
|
29387
|
+
);
|
|
29388
|
+
};
|
|
29389
|
+
const renderExpandedContent = () => {
|
|
29390
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
29391
|
+
renderHeader(),
|
|
29392
|
+
renderConnectionsHeader(),
|
|
29393
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-hidden flex flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto", children: [
|
|
29394
|
+
shouldShowCreatePrompt && renderEmptyState(),
|
|
29395
|
+
serverConnections.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 space-y-2", children: serverConnections.map(renderConnectionItem) })
|
|
29396
|
+
] }) }) }),
|
|
29397
|
+
renderThemeSelector()
|
|
29398
|
+
] });
|
|
29399
|
+
};
|
|
29400
|
+
const renderCollapsedContent = () => {
|
|
29401
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 flex flex-col items-center pt-4 space-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
29402
|
+
serverConnections.slice(0, 5).map((connection) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
29403
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28870
29404
|
"div",
|
|
28871
29405
|
{
|
|
28872
|
-
className: `
|
|
29406
|
+
className: `w-8 h-8 rounded-full border-2 flex items-center justify-center cursor-pointer transition-colors ${selectedServerName === connection.name ? "border-primary bg-primary/10" : "border-border bg-muted/50"}`,
|
|
28873
29407
|
onClick: () => onServerSelect(connection.name),
|
|
28874
|
-
children:
|
|
28875
|
-
|
|
28876
|
-
|
|
28877
|
-
|
|
28878
|
-
|
|
28879
|
-
|
|
28880
|
-
|
|
28881
|
-
|
|
28882
|
-
|
|
28883
|
-
|
|
28884
|
-
|
|
28885
|
-
|
|
28886
|
-
|
|
28887
|
-
|
|
28888
|
-
|
|
28889
|
-
|
|
28890
|
-
|
|
28891
|
-
|
|
28892
|
-
|
|
28893
|
-
|
|
28894
|
-
|
|
28895
|
-
|
|
28896
|
-
|
|
28897
|
-
|
|
28898
|
-
|
|
28899
|
-
|
|
28900
|
-
|
|
28901
|
-
|
|
28902
|
-
|
|
28903
|
-
|
|
28904
|
-
|
|
28905
|
-
|
|
28906
|
-
|
|
28907
|
-
|
|
28908
|
-
}
|
|
28909
|
-
)
|
|
28910
|
-
] })
|
|
28911
|
-
] }),
|
|
28912
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
28913
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-xs capitalize ${getConnectionStatusColor(connection.connectionStatus)}`, children: connection.connectionStatus }),
|
|
28914
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex space-x-1", children: connection.connectionStatus === "connected" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28915
|
-
Button,
|
|
28916
|
-
{
|
|
28917
|
-
onClick: (e) => {
|
|
28918
|
-
e.stopPropagation();
|
|
28919
|
-
onDisconnectServer(connection.name);
|
|
28920
|
-
},
|
|
28921
|
-
size: "sm",
|
|
28922
|
-
variant: "outline",
|
|
28923
|
-
className: "h-6 text-xs px-2",
|
|
28924
|
-
children: "Disconnect"
|
|
28925
|
-
}
|
|
28926
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
28927
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "inline-block", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28928
|
-
Button,
|
|
28929
|
-
{
|
|
28930
|
-
onClick: (e) => {
|
|
28931
|
-
e.stopPropagation();
|
|
28932
|
-
onConnectServer(connection.name);
|
|
28933
|
-
},
|
|
28934
|
-
size: "sm",
|
|
28935
|
-
className: "h-6 text-xs px-2",
|
|
28936
|
-
disabled: shouldDisableConnection(connection),
|
|
28937
|
-
children: "Connect"
|
|
28938
|
-
}
|
|
28939
|
-
) }) }),
|
|
28940
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: getConnectTooltipMessage(connection) })
|
|
28941
|
-
] }) })
|
|
28942
|
-
] })
|
|
28943
|
-
] })
|
|
28944
|
-
},
|
|
28945
|
-
connection.name
|
|
28946
|
-
);
|
|
28947
|
-
}) })
|
|
28948
|
-
] }) }) }),
|
|
28949
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-t", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
28950
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-muted-foreground", children: "Theme" }),
|
|
28951
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
28952
|
-
Select,
|
|
28953
|
-
{
|
|
28954
|
-
value: theme,
|
|
28955
|
-
onValueChange: (value) => setTheme(value),
|
|
28956
|
-
children: [
|
|
28957
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-[100px]", id: "theme-select", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
|
|
28958
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
28959
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "system", children: "System" }),
|
|
28960
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "light", children: "Light" }),
|
|
28961
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "dark", children: "Dark" })
|
|
28962
|
-
] })
|
|
28963
|
-
]
|
|
28964
|
-
}
|
|
28965
|
-
)
|
|
28966
|
-
] }) })
|
|
28967
|
-
] });
|
|
29408
|
+
children: getConnectionStatusIcon(connection.connectionStatus)
|
|
29409
|
+
}
|
|
29410
|
+
) }),
|
|
29411
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs", children: [
|
|
29412
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: connection.name }),
|
|
29413
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-muted-foreground capitalize", children: connection.connectionStatus })
|
|
29414
|
+
] }) })
|
|
29415
|
+
] }, connection.name)),
|
|
29416
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
29417
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
29418
|
+
Button,
|
|
29419
|
+
{
|
|
29420
|
+
onClick: onCreateClient,
|
|
29421
|
+
size: "sm",
|
|
29422
|
+
variant: "ghost",
|
|
29423
|
+
className: "w-8 h-8 p-0 rounded-full",
|
|
29424
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "w-4 h-4" })
|
|
29425
|
+
}
|
|
29426
|
+
) }),
|
|
29427
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: "Create new client" })
|
|
29428
|
+
] })
|
|
29429
|
+
] }) });
|
|
29430
|
+
};
|
|
29431
|
+
const shouldShowCreatePrompt = serverConnections.length === 0;
|
|
29432
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
29433
|
+
"div",
|
|
29434
|
+
{
|
|
29435
|
+
className: `${isExpanded ? "w-80" : "w-16"} bg-card border-r border-border flex flex-col h-full transition-all duration-300 ease-in-out relative`,
|
|
29436
|
+
children: [
|
|
29437
|
+
renderToggleExpandedButton(),
|
|
29438
|
+
isExpanded ? renderExpandedContent() : renderCollapsedContent()
|
|
29439
|
+
]
|
|
29440
|
+
}
|
|
29441
|
+
);
|
|
28968
29442
|
};
|
|
28969
29443
|
const Tabs = ({
|
|
28970
29444
|
currentPage,
|
|
@@ -30243,7 +30717,7 @@ class Protocol {
|
|
|
30243
30717
|
request(request, resultSchema, options) {
|
|
30244
30718
|
const { relatedRequestId, resumptionToken, onresumptiontoken } = options !== null && options !== void 0 ? options : {};
|
|
30245
30719
|
return new Promise((resolve, reject) => {
|
|
30246
|
-
var _a2, _b, _c, _d, _e2;
|
|
30720
|
+
var _a2, _b, _c, _d, _e2, _f;
|
|
30247
30721
|
if (!this._transport) {
|
|
30248
30722
|
reject(new Error("Not connected"));
|
|
30249
30723
|
return;
|
|
@@ -30262,7 +30736,10 @@ class Protocol {
|
|
|
30262
30736
|
this._progressHandlers.set(messageId, options.onprogress);
|
|
30263
30737
|
jsonrpcRequest.params = {
|
|
30264
30738
|
...request.params,
|
|
30265
|
-
_meta: {
|
|
30739
|
+
_meta: {
|
|
30740
|
+
...((_c = request.params) === null || _c === void 0 ? void 0 : _c._meta) || {},
|
|
30741
|
+
progressToken: messageId
|
|
30742
|
+
}
|
|
30266
30743
|
};
|
|
30267
30744
|
}
|
|
30268
30745
|
const cancel = (reason) => {
|
|
@@ -30295,13 +30772,13 @@ class Protocol {
|
|
|
30295
30772
|
reject(error);
|
|
30296
30773
|
}
|
|
30297
30774
|
});
|
|
30298
|
-
(
|
|
30775
|
+
(_d = options === null || options === void 0 ? void 0 : options.signal) === null || _d === void 0 ? void 0 : _d.addEventListener("abort", () => {
|
|
30299
30776
|
var _a3;
|
|
30300
30777
|
cancel((_a3 = options === null || options === void 0 ? void 0 : options.signal) === null || _a3 === void 0 ? void 0 : _a3.reason);
|
|
30301
30778
|
});
|
|
30302
|
-
const timeout = (
|
|
30779
|
+
const timeout = (_e2 = options === null || options === void 0 ? void 0 : options.timeout) !== null && _e2 !== void 0 ? _e2 : DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
30303
30780
|
const timeoutHandler = () => cancel(new McpError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
|
|
30304
|
-
this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (
|
|
30781
|
+
this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (_f = options === null || options === void 0 ? void 0 : options.resetTimeoutOnProgress) !== null && _f !== void 0 ? _f : false);
|
|
30305
30782
|
this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => {
|
|
30306
30783
|
this._cleanupTimeout(messageId);
|
|
30307
30784
|
reject(error);
|
|
@@ -36397,7 +36874,7 @@ function requireAjv() {
|
|
|
36397
36874
|
function setLogger(self2) {
|
|
36398
36875
|
var logger = self2._opts.logger;
|
|
36399
36876
|
if (logger === false) {
|
|
36400
|
-
self2.logger = { log:
|
|
36877
|
+
self2.logger = { log: noop3, warn: noop3, error: noop3 };
|
|
36401
36878
|
} else {
|
|
36402
36879
|
if (logger === void 0) logger = console;
|
|
36403
36880
|
if (!(typeof logger == "object" && logger.log && logger.warn && logger.error))
|
|
@@ -36405,7 +36882,7 @@ function requireAjv() {
|
|
|
36405
36882
|
self2.logger = logger;
|
|
36406
36883
|
}
|
|
36407
36884
|
}
|
|
36408
|
-
function
|
|
36885
|
+
function noop3() {
|
|
36409
36886
|
}
|
|
36410
36887
|
return ajv;
|
|
36411
36888
|
}
|
|
@@ -36877,7 +37354,7 @@ const formatRequestDetails = (details) => {
|
|
|
36877
37354
|
}
|
|
36878
37355
|
return details;
|
|
36879
37356
|
};
|
|
36880
|
-
const VERSION = "0.
|
|
37357
|
+
const VERSION = "0.53.0";
|
|
36881
37358
|
const isRunningInBrowser = () => {
|
|
36882
37359
|
return (
|
|
36883
37360
|
// @ts-ignore
|
|
@@ -36925,10 +37402,10 @@ const getPlatformProperties = () => {
|
|
|
36925
37402
|
return {
|
|
36926
37403
|
"X-Stainless-Lang": "js",
|
|
36927
37404
|
"X-Stainless-Package-Version": VERSION,
|
|
36928
|
-
"X-Stainless-OS": normalizePlatform(globalThis.process.platform),
|
|
36929
|
-
"X-Stainless-Arch": normalizeArch(globalThis.process.arch),
|
|
37405
|
+
"X-Stainless-OS": normalizePlatform(globalThis.process.platform ?? "unknown"),
|
|
37406
|
+
"X-Stainless-Arch": normalizeArch(globalThis.process.arch ?? "unknown"),
|
|
36930
37407
|
"X-Stainless-Runtime": "node",
|
|
36931
|
-
"X-Stainless-Runtime-Version": globalThis.process.version
|
|
37408
|
+
"X-Stainless-Runtime-Version": globalThis.process.version ?? "unknown"
|
|
36932
37409
|
};
|
|
36933
37410
|
}
|
|
36934
37411
|
const browserInfo = getBrowserInfo();
|
|
@@ -38470,6 +38947,9 @@ const tokenize = (input) => {
|
|
|
38470
38947
|
}, partialParse = (input) => JSON.parse(generate(unstrip(strip(tokenize(input)))));
|
|
38471
38948
|
var _BetaMessageStream_instances, _BetaMessageStream_currentMessageSnapshot, _BetaMessageStream_connectedPromise, _BetaMessageStream_resolveConnectedPromise, _BetaMessageStream_rejectConnectedPromise, _BetaMessageStream_endPromise, _BetaMessageStream_resolveEndPromise, _BetaMessageStream_rejectEndPromise, _BetaMessageStream_listeners, _BetaMessageStream_ended, _BetaMessageStream_errored, _BetaMessageStream_aborted, _BetaMessageStream_catchingPromiseCreated, _BetaMessageStream_response, _BetaMessageStream_request_id, _BetaMessageStream_getFinalMessage, _BetaMessageStream_getFinalText, _BetaMessageStream_handleError, _BetaMessageStream_beginRequest, _BetaMessageStream_addStreamEvent, _BetaMessageStream_endRequest, _BetaMessageStream_accumulateMessage;
|
|
38472
38949
|
const JSON_BUF_PROPERTY$1 = "__json_buf";
|
|
38950
|
+
function tracksToolInput$1(content) {
|
|
38951
|
+
return content.type === "tool_use" || content.type === "server_tool_use" || content.type === "mcp_tool_use";
|
|
38952
|
+
}
|
|
38473
38953
|
class BetaMessageStream {
|
|
38474
38954
|
constructor() {
|
|
38475
38955
|
_BetaMessageStream_instances.add(this);
|
|
@@ -38805,7 +39285,7 @@ class BetaMessageStream {
|
|
|
38805
39285
|
break;
|
|
38806
39286
|
}
|
|
38807
39287
|
case "input_json_delta": {
|
|
38808
|
-
if ((content
|
|
39288
|
+
if (tracksToolInput$1(content) && content.input) {
|
|
38809
39289
|
this._emit("inputJson", event.delta.partial_json, content.input);
|
|
38810
39290
|
}
|
|
38811
39291
|
break;
|
|
@@ -38903,7 +39383,7 @@ class BetaMessageStream {
|
|
|
38903
39383
|
break;
|
|
38904
39384
|
}
|
|
38905
39385
|
case "input_json_delta": {
|
|
38906
|
-
if (
|
|
39386
|
+
if (snapshotContent && tracksToolInput$1(snapshotContent)) {
|
|
38907
39387
|
let jsonBuf = snapshotContent[JSON_BUF_PROPERTY$1] || "";
|
|
38908
39388
|
jsonBuf += event.delta.partial_json;
|
|
38909
39389
|
Object.defineProperty(snapshotContent, JSON_BUF_PROPERTY$1, {
|
|
@@ -39103,6 +39583,9 @@ class Completions extends APIResource {
|
|
|
39103
39583
|
}
|
|
39104
39584
|
var _MessageStream_instances, _MessageStream_currentMessageSnapshot, _MessageStream_connectedPromise, _MessageStream_resolveConnectedPromise, _MessageStream_rejectConnectedPromise, _MessageStream_endPromise, _MessageStream_resolveEndPromise, _MessageStream_rejectEndPromise, _MessageStream_listeners, _MessageStream_ended, _MessageStream_errored, _MessageStream_aborted, _MessageStream_catchingPromiseCreated, _MessageStream_response, _MessageStream_request_id, _MessageStream_getFinalMessage, _MessageStream_getFinalText, _MessageStream_handleError, _MessageStream_beginRequest, _MessageStream_addStreamEvent, _MessageStream_endRequest, _MessageStream_accumulateMessage;
|
|
39105
39585
|
const JSON_BUF_PROPERTY = "__json_buf";
|
|
39586
|
+
function tracksToolInput(content) {
|
|
39587
|
+
return content.type === "tool_use" || content.type === "server_tool_use";
|
|
39588
|
+
}
|
|
39106
39589
|
class MessageStream {
|
|
39107
39590
|
constructor() {
|
|
39108
39591
|
_MessageStream_instances.add(this);
|
|
@@ -39438,7 +39921,7 @@ class MessageStream {
|
|
|
39438
39921
|
break;
|
|
39439
39922
|
}
|
|
39440
39923
|
case "input_json_delta": {
|
|
39441
|
-
if (content
|
|
39924
|
+
if (tracksToolInput(content) && content.input) {
|
|
39442
39925
|
this._emit("inputJson", event.delta.partial_json, content.input);
|
|
39443
39926
|
}
|
|
39444
39927
|
break;
|
|
@@ -39535,7 +40018,7 @@ class MessageStream {
|
|
|
39535
40018
|
break;
|
|
39536
40019
|
}
|
|
39537
40020
|
case "input_json_delta": {
|
|
39538
|
-
if (
|
|
40021
|
+
if (snapshotContent && tracksToolInput(snapshotContent)) {
|
|
39539
40022
|
let jsonBuf = snapshotContent[JSON_BUF_PROPERTY] || "";
|
|
39540
40023
|
jsonBuf += event.delta.partial_json;
|
|
39541
40024
|
Object.defineProperty(snapshotContent, JSON_BUF_PROPERTY, {
|
|
@@ -40001,7 +40484,7 @@ class BaseAnthropic {
|
|
|
40001
40484
|
const defaultTimeout = 10 * 60;
|
|
40002
40485
|
const expectedTimeout = 60 * 60 * maxTokens / 128e3;
|
|
40003
40486
|
if (expectedTimeout > defaultTimeout) {
|
|
40004
|
-
throw new AnthropicError("Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-
|
|
40487
|
+
throw new AnthropicError("Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");
|
|
40005
40488
|
}
|
|
40006
40489
|
return defaultTimeout * 1e3;
|
|
40007
40490
|
}
|
|
@@ -40326,7 +40809,7 @@ Anthropic.Models = Models2;
|
|
|
40326
40809
|
Anthropic.Beta = Beta;
|
|
40327
40810
|
const { HUMAN_PROMPT, AI_PROMPT } = Anthropic;
|
|
40328
40811
|
const readline = {};
|
|
40329
|
-
const version = "0.2.
|
|
40812
|
+
const version = "0.2.2";
|
|
40330
40813
|
const packageJson = {
|
|
40331
40814
|
version
|
|
40332
40815
|
};
|
|
@@ -40417,14 +40900,14 @@ class ParseError extends Error {
|
|
|
40417
40900
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
40418
40901
|
}
|
|
40419
40902
|
}
|
|
40420
|
-
function
|
|
40903
|
+
function noop2(_arg) {
|
|
40421
40904
|
}
|
|
40422
40905
|
function createParser(callbacks) {
|
|
40423
40906
|
if (typeof callbacks == "function")
|
|
40424
40907
|
throw new TypeError(
|
|
40425
40908
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
40426
40909
|
);
|
|
40427
|
-
const { onEvent =
|
|
40910
|
+
const { onEvent = noop2, onError = noop2, onRetry = noop2, onComment } = callbacks;
|
|
40428
40911
|
let incompleteLine = "", isFirstChunk = true, id, data2 = "", eventType = "";
|
|
40429
40912
|
function feed(newChunk) {
|
|
40430
40913
|
const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
|
|
@@ -40813,7 +41296,8 @@ class SSEClientTransport {
|
|
|
40813
41296
|
return await this._startOrAuth();
|
|
40814
41297
|
}
|
|
40815
41298
|
async _commonHeaders() {
|
|
40816
|
-
|
|
41299
|
+
var _a2;
|
|
41300
|
+
const headers = { ...(_a2 = this._requestInit) === null || _a2 === void 0 ? void 0 : _a2.headers };
|
|
40817
41301
|
if (this._authProvider) {
|
|
40818
41302
|
const tokens = await this._authProvider.tokens();
|
|
40819
41303
|
if (tokens) {
|
|
@@ -41262,6 +41746,61 @@ const StdErrNotificationSchema = NotificationSchema.extend({
|
|
|
41262
41746
|
ClientNotificationSchema.or(
|
|
41263
41747
|
StdErrNotificationSchema
|
|
41264
41748
|
).or(ServerNotificationSchema).or(NotificationSchema);
|
|
41749
|
+
const sanitizeSchema = (schema) => {
|
|
41750
|
+
if (!schema || typeof schema !== "object") return schema;
|
|
41751
|
+
if (Array.isArray(schema)) {
|
|
41752
|
+
return schema.map((item) => sanitizeSchema(item));
|
|
41753
|
+
}
|
|
41754
|
+
const schemaObj = schema;
|
|
41755
|
+
const sanitized = {};
|
|
41756
|
+
for (const [key, value] of Object.entries(schemaObj)) {
|
|
41757
|
+
if (key === "properties" && value && typeof value === "object" && !Array.isArray(value)) {
|
|
41758
|
+
const propertiesObj = value;
|
|
41759
|
+
const sanitizedProps = {};
|
|
41760
|
+
const keyMapping = {};
|
|
41761
|
+
for (const [propKey, propValue] of Object.entries(propertiesObj)) {
|
|
41762
|
+
const sanitizedKey = propKey.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
41763
|
+
keyMapping[propKey] = sanitizedKey;
|
|
41764
|
+
sanitizedProps[sanitizedKey] = sanitizeSchema(propValue);
|
|
41765
|
+
}
|
|
41766
|
+
sanitized[key] = sanitizedProps;
|
|
41767
|
+
if ("required" in schemaObj && Array.isArray(schemaObj.required)) {
|
|
41768
|
+
sanitized.required = schemaObj.required.map(
|
|
41769
|
+
(req) => keyMapping[req] || req
|
|
41770
|
+
);
|
|
41771
|
+
}
|
|
41772
|
+
} else {
|
|
41773
|
+
sanitized[key] = sanitizeSchema(value);
|
|
41774
|
+
}
|
|
41775
|
+
}
|
|
41776
|
+
return sanitized;
|
|
41777
|
+
};
|
|
41778
|
+
const mappedTools = (tools) => {
|
|
41779
|
+
return tools.map((tool) => {
|
|
41780
|
+
let inputSchema;
|
|
41781
|
+
if (tool.input_schema) {
|
|
41782
|
+
inputSchema = JSON.parse(JSON.stringify(tool.input_schema));
|
|
41783
|
+
} else {
|
|
41784
|
+
inputSchema = {
|
|
41785
|
+
type: "object",
|
|
41786
|
+
properties: {},
|
|
41787
|
+
required: []
|
|
41788
|
+
};
|
|
41789
|
+
}
|
|
41790
|
+
if (!inputSchema.type) {
|
|
41791
|
+
inputSchema.type = "object";
|
|
41792
|
+
}
|
|
41793
|
+
if (inputSchema.type === "object" && !inputSchema.properties) {
|
|
41794
|
+
inputSchema.properties = {};
|
|
41795
|
+
}
|
|
41796
|
+
const sanitizedSchema = sanitizeSchema(inputSchema);
|
|
41797
|
+
return {
|
|
41798
|
+
name: tool.name,
|
|
41799
|
+
description: tool.description,
|
|
41800
|
+
input_schema: sanitizedSchema
|
|
41801
|
+
};
|
|
41802
|
+
});
|
|
41803
|
+
};
|
|
41265
41804
|
class MCPJamClient extends Client {
|
|
41266
41805
|
constructor(serverConfig, config, addRequestHistory, bearerToken, headerName, onStdErrNotification, claudeApiKey, onPendingRequest, getRoots) {
|
|
41267
41806
|
super(
|
|
@@ -41637,163 +42176,174 @@ class MCPJamClient extends Client {
|
|
|
41637
42176
|
async setServerCapabilities(capabilities) {
|
|
41638
42177
|
this.serverCapabilities = capabilities;
|
|
41639
42178
|
}
|
|
41640
|
-
async processQuery(query, tools) {
|
|
42179
|
+
async processQuery(query, tools, onUpdate, model = "claude-3-5-sonnet-latest") {
|
|
41641
42180
|
if (!this.anthropic) {
|
|
41642
42181
|
throw new Error("Anthropic client not initialized");
|
|
41643
42182
|
}
|
|
41644
|
-
const
|
|
41645
|
-
|
|
41646
|
-
|
|
41647
|
-
|
|
41648
|
-
|
|
41649
|
-
|
|
41650
|
-
|
|
41651
|
-
|
|
41652
|
-
|
|
41653
|
-
|
|
41654
|
-
|
|
41655
|
-
if (Array.isArray(schema)) {
|
|
41656
|
-
return schema.map((item) => sanitizeSchema(item));
|
|
41657
|
-
}
|
|
41658
|
-
const schemaObj = schema;
|
|
41659
|
-
const sanitized = {};
|
|
41660
|
-
for (const [key, value] of Object.entries(schemaObj)) {
|
|
41661
|
-
if (key === "properties" && value && typeof value === "object" && !Array.isArray(value)) {
|
|
41662
|
-
const propertiesObj = value;
|
|
41663
|
-
const sanitizedProps = {};
|
|
41664
|
-
const keyMapping = {};
|
|
41665
|
-
for (const [propKey, propValue] of Object.entries(propertiesObj)) {
|
|
41666
|
-
const sanitizedKey = propKey.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
41667
|
-
keyMapping[propKey] = sanitizedKey;
|
|
41668
|
-
sanitizedProps[sanitizedKey] = sanitizeSchema(propValue);
|
|
41669
|
-
}
|
|
41670
|
-
sanitized[key] = sanitizedProps;
|
|
41671
|
-
if ("required" in schemaObj && Array.isArray(schemaObj.required)) {
|
|
41672
|
-
sanitized.required = schemaObj.required.map(
|
|
41673
|
-
(req) => keyMapping[req] || req
|
|
41674
|
-
);
|
|
41675
|
-
}
|
|
41676
|
-
} else {
|
|
41677
|
-
sanitized[key] = sanitizeSchema(value);
|
|
41678
|
-
}
|
|
41679
|
-
}
|
|
41680
|
-
return sanitized;
|
|
42183
|
+
const context = this.initializeQueryContext(query, tools, model);
|
|
42184
|
+
const response = await this.makeInitialApiCall(context);
|
|
42185
|
+
return this.processIterations(response, context, onUpdate);
|
|
42186
|
+
}
|
|
42187
|
+
initializeQueryContext(query, tools, model) {
|
|
42188
|
+
return {
|
|
42189
|
+
messages: [{ role: "user", content: query }],
|
|
42190
|
+
finalText: [],
|
|
42191
|
+
sanitizedTools: mappedTools(tools),
|
|
42192
|
+
model,
|
|
42193
|
+
MAX_ITERATIONS: 5
|
|
41681
42194
|
};
|
|
41682
|
-
|
|
41683
|
-
|
|
41684
|
-
|
|
41685
|
-
|
|
41686
|
-
} else {
|
|
41687
|
-
inputSchema = {
|
|
41688
|
-
type: "object",
|
|
41689
|
-
properties: {},
|
|
41690
|
-
required: []
|
|
41691
|
-
};
|
|
41692
|
-
}
|
|
41693
|
-
if (!inputSchema.type) {
|
|
41694
|
-
inputSchema.type = "object";
|
|
41695
|
-
}
|
|
41696
|
-
if (inputSchema.type === "object" && !inputSchema.properties) {
|
|
41697
|
-
inputSchema.properties = {};
|
|
41698
|
-
}
|
|
41699
|
-
const sanitizedSchema = sanitizeSchema(inputSchema);
|
|
41700
|
-
return {
|
|
41701
|
-
name: tool.name,
|
|
41702
|
-
description: tool.description,
|
|
41703
|
-
input_schema: sanitizedSchema
|
|
41704
|
-
};
|
|
41705
|
-
});
|
|
41706
|
-
let response = await this.anthropic.messages.create({
|
|
41707
|
-
model: "claude-3-haiku-20240307",
|
|
42195
|
+
}
|
|
42196
|
+
async makeInitialApiCall(context) {
|
|
42197
|
+
return this.anthropic.messages.create({
|
|
42198
|
+
model: context.model,
|
|
41708
42199
|
max_tokens: 1e3,
|
|
41709
|
-
messages,
|
|
41710
|
-
tools:
|
|
42200
|
+
messages: context.messages,
|
|
42201
|
+
tools: context.sanitizedTools
|
|
41711
42202
|
});
|
|
41712
|
-
|
|
42203
|
+
}
|
|
42204
|
+
async processIterations(initialResponse, context, onUpdate) {
|
|
42205
|
+
let response = initialResponse;
|
|
42206
|
+
let iteration = 0;
|
|
42207
|
+
while (iteration < context.MAX_ITERATIONS) {
|
|
41713
42208
|
iteration++;
|
|
41714
|
-
|
|
41715
|
-
|
|
41716
|
-
|
|
41717
|
-
if (content.type === "text") {
|
|
41718
|
-
finalText.push(content.text);
|
|
41719
|
-
assistantContent.push(content);
|
|
41720
|
-
} else if (content.type === "tool_use") {
|
|
41721
|
-
hasToolUse = true;
|
|
41722
|
-
assistantContent.push(content);
|
|
41723
|
-
try {
|
|
41724
|
-
const toolName = content.name;
|
|
41725
|
-
const toolArgs = content.input;
|
|
41726
|
-
const result = await this.callTool({
|
|
41727
|
-
name: toolName,
|
|
41728
|
-
arguments: toolArgs
|
|
41729
|
-
});
|
|
41730
|
-
finalText.push(
|
|
41731
|
-
`[Calling tool ${toolName} with args ${JSON.stringify(toolArgs)}]`
|
|
41732
|
-
);
|
|
41733
|
-
if (assistantContent.length > 0) {
|
|
41734
|
-
messages.push({
|
|
41735
|
-
role: "assistant",
|
|
41736
|
-
content: assistantContent
|
|
41737
|
-
});
|
|
41738
|
-
}
|
|
41739
|
-
messages.push({
|
|
41740
|
-
role: "user",
|
|
41741
|
-
content: [
|
|
41742
|
-
{
|
|
41743
|
-
type: "tool_result",
|
|
41744
|
-
tool_use_id: content.id,
|
|
41745
|
-
content: result.content
|
|
41746
|
-
}
|
|
41747
|
-
]
|
|
41748
|
-
});
|
|
41749
|
-
} catch (error) {
|
|
41750
|
-
console.error(`Tool ${content.name} failed:`, error);
|
|
41751
|
-
finalText.push(`[Tool ${content.name} failed: ${error}]`);
|
|
41752
|
-
messages.push({
|
|
41753
|
-
role: "assistant",
|
|
41754
|
-
content: assistantContent
|
|
41755
|
-
});
|
|
41756
|
-
messages.push({
|
|
41757
|
-
role: "user",
|
|
41758
|
-
content: [
|
|
41759
|
-
{
|
|
41760
|
-
type: "tool_result",
|
|
41761
|
-
tool_use_id: content.id,
|
|
41762
|
-
content: `Error: ${error}`,
|
|
41763
|
-
is_error: true
|
|
41764
|
-
}
|
|
41765
|
-
]
|
|
41766
|
-
});
|
|
41767
|
-
}
|
|
41768
|
-
}
|
|
41769
|
-
}
|
|
41770
|
-
if (!hasToolUse) {
|
|
42209
|
+
const iterationResult = await this.processIteration(response, context);
|
|
42210
|
+
this.sendIterationUpdate(iterationResult.content, onUpdate);
|
|
42211
|
+
if (!iterationResult.hasToolUse) {
|
|
41771
42212
|
break;
|
|
41772
42213
|
}
|
|
41773
42214
|
try {
|
|
41774
|
-
response = await this.
|
|
41775
|
-
model: "claude-3-5-sonnet-20241022",
|
|
41776
|
-
max_tokens: 1e3,
|
|
41777
|
-
messages,
|
|
41778
|
-
tools: mappedTools
|
|
41779
|
-
});
|
|
42215
|
+
response = await this.makeFollowUpApiCall(context);
|
|
41780
42216
|
} catch (error) {
|
|
41781
|
-
|
|
41782
|
-
finalText.push(
|
|
42217
|
+
const errorMessage = `[API Error: ${error}]`;
|
|
42218
|
+
context.finalText.push(errorMessage);
|
|
42219
|
+
this.sendIterationUpdate(errorMessage, onUpdate);
|
|
41783
42220
|
break;
|
|
41784
42221
|
}
|
|
41785
42222
|
}
|
|
42223
|
+
this.handleMaxIterationsWarning(iteration, context, onUpdate);
|
|
42224
|
+
return context.finalText.join("\n");
|
|
42225
|
+
}
|
|
42226
|
+
async processIteration(response, context) {
|
|
42227
|
+
const iterationContent = [];
|
|
42228
|
+
const assistantContent = [];
|
|
42229
|
+
let hasToolUse = false;
|
|
41786
42230
|
for (const content of response.content) {
|
|
41787
42231
|
if (content.type === "text") {
|
|
41788
|
-
|
|
42232
|
+
this.handleTextContent(
|
|
42233
|
+
content,
|
|
42234
|
+
iterationContent,
|
|
42235
|
+
context.finalText,
|
|
42236
|
+
assistantContent
|
|
42237
|
+
);
|
|
42238
|
+
} else if (content.type === "tool_use") {
|
|
42239
|
+
hasToolUse = true;
|
|
42240
|
+
await this.handleToolUse(
|
|
42241
|
+
content,
|
|
42242
|
+
iterationContent,
|
|
42243
|
+
context,
|
|
42244
|
+
assistantContent
|
|
42245
|
+
);
|
|
41789
42246
|
}
|
|
41790
42247
|
}
|
|
41791
|
-
|
|
41792
|
-
|
|
41793
|
-
|
|
42248
|
+
return {
|
|
42249
|
+
content: iterationContent,
|
|
42250
|
+
hasToolUse
|
|
42251
|
+
};
|
|
42252
|
+
}
|
|
42253
|
+
handleTextContent(content, iterationContent, finalText, assistantContent) {
|
|
42254
|
+
iterationContent.push(content.text);
|
|
42255
|
+
finalText.push(content.text);
|
|
42256
|
+
assistantContent.push(content);
|
|
42257
|
+
}
|
|
42258
|
+
async handleToolUse(content, iterationContent, context, assistantContent) {
|
|
42259
|
+
assistantContent.push(content);
|
|
42260
|
+
const toolMessage = this.createToolMessage(content.name, content.input);
|
|
42261
|
+
iterationContent.push(toolMessage);
|
|
42262
|
+
context.finalText.push(toolMessage);
|
|
42263
|
+
try {
|
|
42264
|
+
await this.executeToolAndUpdateMessages(
|
|
42265
|
+
content,
|
|
42266
|
+
context,
|
|
42267
|
+
assistantContent
|
|
42268
|
+
);
|
|
42269
|
+
} catch (error) {
|
|
42270
|
+
this.handleToolError(
|
|
42271
|
+
error,
|
|
42272
|
+
content,
|
|
42273
|
+
iterationContent,
|
|
42274
|
+
context,
|
|
42275
|
+
assistantContent
|
|
41794
42276
|
);
|
|
41795
42277
|
}
|
|
41796
|
-
|
|
42278
|
+
}
|
|
42279
|
+
createToolMessage(toolName, toolArgs) {
|
|
42280
|
+
return `[Calling tool ${toolName} with args ${JSON.stringify(toolArgs)}]`;
|
|
42281
|
+
}
|
|
42282
|
+
async executeToolAndUpdateMessages(content, context, assistantContent) {
|
|
42283
|
+
const result = await this.callTool({
|
|
42284
|
+
name: content.name,
|
|
42285
|
+
arguments: content.input
|
|
42286
|
+
});
|
|
42287
|
+
this.addMessagesToContext(
|
|
42288
|
+
context,
|
|
42289
|
+
assistantContent,
|
|
42290
|
+
content.id,
|
|
42291
|
+
result.content
|
|
42292
|
+
);
|
|
42293
|
+
}
|
|
42294
|
+
handleToolError(error, content, iterationContent, context, assistantContent) {
|
|
42295
|
+
console.error(`Tool ${content.name} failed:`, error);
|
|
42296
|
+
const errorMessage = `[Tool ${content.name} failed: ${error}]`;
|
|
42297
|
+
iterationContent.push(errorMessage);
|
|
42298
|
+
context.finalText.push(errorMessage);
|
|
42299
|
+
this.addMessagesToContext(
|
|
42300
|
+
context,
|
|
42301
|
+
assistantContent,
|
|
42302
|
+
content.id,
|
|
42303
|
+
`Error: ${error}`,
|
|
42304
|
+
true
|
|
42305
|
+
);
|
|
42306
|
+
}
|
|
42307
|
+
addMessagesToContext(context, assistantContent, toolUseId, resultContent, isError = false) {
|
|
42308
|
+
if (assistantContent.length > 0) {
|
|
42309
|
+
context.messages.push({
|
|
42310
|
+
role: "assistant",
|
|
42311
|
+
content: assistantContent
|
|
42312
|
+
});
|
|
42313
|
+
}
|
|
42314
|
+
context.messages.push({
|
|
42315
|
+
role: "user",
|
|
42316
|
+
content: [
|
|
42317
|
+
{
|
|
42318
|
+
type: "tool_result",
|
|
42319
|
+
tool_use_id: toolUseId,
|
|
42320
|
+
content: resultContent,
|
|
42321
|
+
...isError && { is_error: true }
|
|
42322
|
+
}
|
|
42323
|
+
]
|
|
42324
|
+
});
|
|
42325
|
+
}
|
|
42326
|
+
async makeFollowUpApiCall(context) {
|
|
42327
|
+
return this.anthropic.messages.create({
|
|
42328
|
+
model: context.model,
|
|
42329
|
+
max_tokens: 1e3,
|
|
42330
|
+
messages: context.messages,
|
|
42331
|
+
tools: context.sanitizedTools
|
|
42332
|
+
});
|
|
42333
|
+
}
|
|
42334
|
+
sendIterationUpdate(content, onUpdate) {
|
|
42335
|
+
if (!onUpdate) return;
|
|
42336
|
+
const message = Array.isArray(content) ? content.join("\n") : content;
|
|
42337
|
+
if (message.length > 0) {
|
|
42338
|
+
onUpdate(message);
|
|
42339
|
+
}
|
|
42340
|
+
}
|
|
42341
|
+
handleMaxIterationsWarning(iteration, context, onUpdate) {
|
|
42342
|
+
if (iteration >= context.MAX_ITERATIONS) {
|
|
42343
|
+
const warningMessage = `[Warning: Reached maximum iterations (${context.MAX_ITERATIONS}). Stopping to prevent excessive API usage.]`;
|
|
42344
|
+
context.finalText.push(warningMessage);
|
|
42345
|
+
this.sendIterationUpdate(warningMessage, onUpdate);
|
|
42346
|
+
}
|
|
41797
42347
|
}
|
|
41798
42348
|
async chatLoop(tools) {
|
|
41799
42349
|
const rl = readline.createInterface({
|
|
@@ -42692,6 +43242,9 @@ const useMCPOperations = () => {
|
|
|
42692
43242
|
const getRequestHistory = reactExports.useCallback(() => {
|
|
42693
43243
|
return requestHistory;
|
|
42694
43244
|
}, [requestHistory]);
|
|
43245
|
+
const clearRequestHistory = reactExports.useCallback(() => {
|
|
43246
|
+
setRequestHistory([]);
|
|
43247
|
+
}, []);
|
|
42695
43248
|
return {
|
|
42696
43249
|
// State
|
|
42697
43250
|
resources,
|
|
@@ -42751,7 +43304,8 @@ const useMCPOperations = () => {
|
|
|
42751
43304
|
handleApproveSampling,
|
|
42752
43305
|
handleRejectSampling,
|
|
42753
43306
|
addRequestHistory,
|
|
42754
|
-
getRequestHistory
|
|
43307
|
+
getRequestHistory,
|
|
43308
|
+
clearRequestHistory
|
|
42755
43309
|
};
|
|
42756
43310
|
};
|
|
42757
43311
|
const CONFIG_LOCAL_STORAGE_KEY = "inspectorConfig_v1";
|
|
@@ -42781,10 +43335,6 @@ const useConfigState = () => {
|
|
|
42781
43335
|
}
|
|
42782
43336
|
return "";
|
|
42783
43337
|
});
|
|
42784
|
-
const [currentPage, setCurrentPage] = reactExports.useState(() => {
|
|
42785
|
-
const hash = window.location.hash.slice(1);
|
|
42786
|
-
return hash || "tools";
|
|
42787
|
-
});
|
|
42788
43338
|
const [authState, setAuthState] = reactExports.useState({
|
|
42789
43339
|
isInitiatingAuth: false,
|
|
42790
43340
|
oauthTokens: null,
|
|
@@ -42822,16 +43372,6 @@ const useConfigState = () => {
|
|
|
42822
43372
|
reactExports.useEffect(() => {
|
|
42823
43373
|
localStorage.setItem("lastHeaderName", headerName);
|
|
42824
43374
|
}, [headerName]);
|
|
42825
|
-
reactExports.useEffect(() => {
|
|
42826
|
-
const handleHashChange = () => {
|
|
42827
|
-
const hash = window.location.hash.slice(1);
|
|
42828
|
-
if (hash) {
|
|
42829
|
-
setCurrentPage(hash);
|
|
42830
|
-
}
|
|
42831
|
-
};
|
|
42832
|
-
window.addEventListener("hashchange", handleHashChange);
|
|
42833
|
-
return () => window.removeEventListener("hashchange", handleHashChange);
|
|
42834
|
-
}, []);
|
|
42835
43375
|
reactExports.useEffect(() => {
|
|
42836
43376
|
if (!window.location.hash) {
|
|
42837
43377
|
window.location.hash = "tools";
|
|
@@ -42846,8 +43386,6 @@ const useConfigState = () => {
|
|
|
42846
43386
|
setHeaderName,
|
|
42847
43387
|
claudeApiKey,
|
|
42848
43388
|
updateClaudeApiKey,
|
|
42849
|
-
currentPage,
|
|
42850
|
-
setCurrentPage,
|
|
42851
43389
|
authState,
|
|
42852
43390
|
updateAuthState,
|
|
42853
43391
|
validateClaudeApiKey
|
|
@@ -42901,6 +43439,21 @@ const App = () => {
|
|
|
42901
43439
|
const configState = useConfigState();
|
|
42902
43440
|
const rootsRef = reactExports.useRef(mcpOperations.roots);
|
|
42903
43441
|
const nextRequestId = reactExports.useRef(0);
|
|
43442
|
+
const [currentPage, setCurrentPage] = reactExports.useState(() => {
|
|
43443
|
+
const hash = window.location.hash.slice(1);
|
|
43444
|
+
return hash || "tools";
|
|
43445
|
+
});
|
|
43446
|
+
const [isSidebarExpanded, setIsSidebarExpanded] = reactExports.useState(true);
|
|
43447
|
+
reactExports.useEffect(() => {
|
|
43448
|
+
const handleHashChange = () => {
|
|
43449
|
+
const hash = window.location.hash.slice(1);
|
|
43450
|
+
if (hash) {
|
|
43451
|
+
setCurrentPage(hash);
|
|
43452
|
+
}
|
|
43453
|
+
};
|
|
43454
|
+
window.addEventListener("hashchange", handleHashChange);
|
|
43455
|
+
return () => window.removeEventListener("hashchange", handleHashChange);
|
|
43456
|
+
}, []);
|
|
42904
43457
|
const onStdErrNotification = reactExports.useCallback(
|
|
42905
43458
|
(notification) => {
|
|
42906
43459
|
mcpOperations.setStdErrNotifications((prev) => [...prev, notification]);
|
|
@@ -43255,7 +43808,7 @@ const App = () => {
|
|
|
43255
43808
|
}, []);
|
|
43256
43809
|
if (window.location.pathname === "/oauth/callback") {
|
|
43257
43810
|
const OAuthCallback = React.lazy(
|
|
43258
|
-
() => __vitePreload(() => import("./OAuthCallback-
|
|
43811
|
+
() => __vitePreload(() => import("./OAuthCallback-B9WXxW14.js"), true ? __vite__mapDeps([0,1]) : void 0)
|
|
43259
43812
|
);
|
|
43260
43813
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43261
43814
|
reactExports.Suspense,
|
|
@@ -43270,7 +43823,7 @@ const App = () => {
|
|
|
43270
43823
|
}
|
|
43271
43824
|
if (window.location.pathname === "/oauth/callback/debug") {
|
|
43272
43825
|
const OAuthDebugCallback = React.lazy(
|
|
43273
|
-
() => __vitePreload(() => import("./OAuthDebugCallback-
|
|
43826
|
+
() => __vitePreload(() => import("./OAuthDebugCallback-Dypsoomr.js"), true ? __vite__mapDeps([2,1]) : void 0)
|
|
43274
43827
|
);
|
|
43275
43828
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43276
43829
|
reactExports.Suspense,
|
|
@@ -43339,7 +43892,7 @@ const App = () => {
|
|
|
43339
43892
|
};
|
|
43340
43893
|
const renderCurrentPage = () => {
|
|
43341
43894
|
var _a3;
|
|
43342
|
-
switch (
|
|
43895
|
+
switch (currentPage) {
|
|
43343
43896
|
case "resources":
|
|
43344
43897
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43345
43898
|
ResourcesTab,
|
|
@@ -43530,19 +44083,13 @@ const App = () => {
|
|
|
43530
44083
|
const currentConfig = serverState.serverConfigs[serverState.selectedServerName];
|
|
43531
44084
|
return currentConfig && "url" in currentConfig && currentConfig.url ? currentConfig.url.toString() : "";
|
|
43532
44085
|
})(),
|
|
43533
|
-
onBack: () =>
|
|
44086
|
+
onBack: () => setCurrentPage("resources"),
|
|
43534
44087
|
authState: configState.authState,
|
|
43535
44088
|
updateAuthState: configState.updateAuthState
|
|
43536
44089
|
}
|
|
43537
44090
|
);
|
|
43538
44091
|
case "settings":
|
|
43539
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43540
|
-
SettingsTab,
|
|
43541
|
-
{
|
|
43542
|
-
onApiKeyChange: handleApiKeyChange,
|
|
43543
|
-
disabled: connectionStatus !== "connected" && connectionStatus !== "disconnected"
|
|
43544
|
-
}
|
|
43545
|
-
);
|
|
44092
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsTab, { onApiKeyChange: handleApiKeyChange });
|
|
43546
44093
|
default:
|
|
43547
44094
|
return null;
|
|
43548
44095
|
}
|
|
@@ -43561,15 +44108,17 @@ const App = () => {
|
|
|
43561
44108
|
onDisconnectServer: connectionState.disconnectServer,
|
|
43562
44109
|
onCreateClient: serverState.handleCreateClient,
|
|
43563
44110
|
onEditClient: handleEditClient,
|
|
43564
|
-
updateTrigger: connectionState.sidebarUpdateTrigger
|
|
44111
|
+
updateTrigger: connectionState.sidebarUpdateTrigger,
|
|
44112
|
+
isExpanded: isSidebarExpanded,
|
|
44113
|
+
onToggleExpanded: () => setIsSidebarExpanded(!isSidebarExpanded)
|
|
43565
44114
|
}
|
|
43566
44115
|
),
|
|
43567
44116
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex flex-col overflow-hidden", children: [
|
|
43568
44117
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43569
44118
|
Tabs,
|
|
43570
44119
|
{
|
|
43571
|
-
currentPage
|
|
43572
|
-
onPageChange:
|
|
44120
|
+
currentPage,
|
|
44121
|
+
onPageChange: setCurrentPage,
|
|
43573
44122
|
serverCapabilities,
|
|
43574
44123
|
pendingSampleRequests: mcpOperations.pendingSampleRequests,
|
|
43575
44124
|
shouldDisableAll: !connectionState.mcpAgent
|
|
@@ -43580,7 +44129,8 @@ const App = () => {
|
|
|
43580
44129
|
HistoryAndNotifications,
|
|
43581
44130
|
{
|
|
43582
44131
|
requestHistory,
|
|
43583
|
-
toolResult: mcpOperations.toolResult
|
|
44132
|
+
toolResult: mcpOperations.toolResult,
|
|
44133
|
+
onClearHistory: mcpOperations.clearRequestHistory
|
|
43584
44134
|
}
|
|
43585
44135
|
)
|
|
43586
44136
|
] })
|