@stigmer/react 0.0.51 → 0.0.53
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/deployment-mode.d.ts +35 -0
- package/deployment-mode.d.ts.map +1 -0
- package/deployment-mode.js +41 -0
- package/deployment-mode.js.map +1 -0
- package/execution/ApprovalCard.d.ts +8 -6
- package/execution/ApprovalCard.d.ts.map +1 -1
- package/execution/ApprovalCard.js +34 -96
- package/execution/ApprovalCard.js.map +1 -1
- package/execution/McpToolDetail.d.ts +48 -0
- package/execution/McpToolDetail.d.ts.map +1 -0
- package/execution/McpToolDetail.js +159 -0
- package/execution/McpToolDetail.js.map +1 -0
- package/execution/ToolArgsView.d.ts +41 -0
- package/execution/ToolArgsView.d.ts.map +1 -0
- package/execution/ToolArgsView.js +132 -0
- package/execution/ToolArgsView.js.map +1 -0
- package/execution/ToolCallDetail.d.ts +11 -4
- package/execution/ToolCallDetail.d.ts.map +1 -1
- package/execution/ToolCallDetail.js +30 -101
- package/execution/ToolCallDetail.js.map +1 -1
- package/execution/ToolCallGroup.d.ts.map +1 -1
- package/execution/ToolCallGroup.js +3 -2
- package/execution/ToolCallGroup.js.map +1 -1
- package/execution/ToolCallItem.d.ts +2 -0
- package/execution/ToolCallItem.d.ts.map +1 -1
- package/execution/ToolCallItem.js +6 -2
- package/execution/ToolCallItem.js.map +1 -1
- package/execution/index.d.ts +7 -1
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js +4 -1
- package/execution/index.js.map +1 -1
- package/execution/tool-categories.d.ts +35 -8
- package/execution/tool-categories.d.ts.map +1 -1
- package/execution/tool-categories.js +76 -10
- package/execution/tool-categories.js.map +1 -1
- package/execution/tool-rendering-primitives.d.ts +61 -0
- package/execution/tool-rendering-primitives.d.ts.map +1 -0
- package/execution/tool-rendering-primitives.js +106 -0
- package/execution/tool-rendering-primitives.js.map +1 -0
- package/index.d.ts +5 -2
- package/index.d.ts.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/internal/CloudFeatureNotice.d.ts +19 -0
- package/internal/CloudFeatureNotice.d.ts.map +1 -0
- package/internal/CloudFeatureNotice.js +21 -0
- package/internal/CloudFeatureNotice.js.map +1 -0
- package/mcp-server/McpServerDetailView.d.ts +15 -1
- package/mcp-server/McpServerDetailView.d.ts.map +1 -1
- package/mcp-server/McpServerDetailView.js +11 -3
- package/mcp-server/McpServerDetailView.js.map +1 -1
- package/package.json +4 -4
- package/provider.d.ts +14 -2
- package/provider.d.ts.map +1 -1
- package/provider.js +3 -2
- package/provider.js.map +1 -1
- package/src/deployment-mode.ts +46 -0
- package/src/execution/ApprovalCard.tsx +130 -283
- package/src/execution/McpToolDetail.tsx +283 -0
- package/src/execution/ToolArgsView.tsx +277 -0
- package/src/execution/ToolCallDetail.tsx +51 -219
- package/src/execution/ToolCallGroup.tsx +3 -2
- package/src/execution/ToolCallItem.tsx +14 -2
- package/src/execution/index.ts +25 -0
- package/src/execution/tool-categories.ts +89 -9
- package/src/execution/tool-rendering-primitives.tsx +253 -0
- package/src/index.ts +13 -0
- package/src/internal/CloudFeatureNotice.tsx +60 -0
- package/src/mcp-server/McpServerDetailView.tsx +24 -2
- package/src/provider.tsx +18 -2
- package/styles.css +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DeploymentMode } from "@stigmer/sdk";
|
|
2
|
+
import { ApiResourceKind } from "@stigmer/sdk";
|
|
3
|
+
/**
|
|
4
|
+
* React context for the current deployment mode.
|
|
5
|
+
*
|
|
6
|
+
* Separated from the provider to mirror the `StigmerContext` / `context.ts`
|
|
7
|
+
* pattern and avoid circular imports.
|
|
8
|
+
*
|
|
9
|
+
* Defaults to `"cloud"` so existing consumers who don't pass
|
|
10
|
+
* `deploymentMode` to `StigmerProvider` see all features enabled.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DeploymentModeContext: import("react").Context<DeploymentMode>;
|
|
13
|
+
/**
|
|
14
|
+
* Read the deployment mode from the nearest `StigmerProvider`.
|
|
15
|
+
*
|
|
16
|
+
* Returns `"local"` when connected to the local Go CLI server (OSS)
|
|
17
|
+
* and `"cloud"` when connected to Stigmer Cloud.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useDeploymentMode(): DeploymentMode;
|
|
20
|
+
/**
|
|
21
|
+
* Check whether a given {@link ApiResourceKind} is available in the
|
|
22
|
+
* current deployment mode.
|
|
23
|
+
*
|
|
24
|
+
* Combines the deployment mode from context with the proto-derived
|
|
25
|
+
* tier metadata via {@link isResourceAvailable}.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const available = useResourceAvailable(ApiResourceKind.api_key);
|
|
30
|
+
* if (!available) return <CloudFeatureNotice>...</CloudFeatureNotice>;
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useResourceAvailable(kind: ApiResourceKind): boolean;
|
|
34
|
+
export { type DeploymentMode, ApiResourceKind };
|
|
35
|
+
//# sourceMappingURL=deployment-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-mode.d.ts","sourceRoot":"","sources":["../src/deployment-mode.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAuB,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpE;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,yCAAyC,CAAC;AAE5E;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAElD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAGnE;AAED,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { isResourceAvailable, ApiResourceKind } from "@stigmer/sdk";
|
|
4
|
+
/**
|
|
5
|
+
* React context for the current deployment mode.
|
|
6
|
+
*
|
|
7
|
+
* Separated from the provider to mirror the `StigmerContext` / `context.ts`
|
|
8
|
+
* pattern and avoid circular imports.
|
|
9
|
+
*
|
|
10
|
+
* Defaults to `"cloud"` so existing consumers who don't pass
|
|
11
|
+
* `deploymentMode` to `StigmerProvider` see all features enabled.
|
|
12
|
+
*/
|
|
13
|
+
export const DeploymentModeContext = createContext("cloud");
|
|
14
|
+
/**
|
|
15
|
+
* Read the deployment mode from the nearest `StigmerProvider`.
|
|
16
|
+
*
|
|
17
|
+
* Returns `"local"` when connected to the local Go CLI server (OSS)
|
|
18
|
+
* and `"cloud"` when connected to Stigmer Cloud.
|
|
19
|
+
*/
|
|
20
|
+
export function useDeploymentMode() {
|
|
21
|
+
return useContext(DeploymentModeContext);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check whether a given {@link ApiResourceKind} is available in the
|
|
25
|
+
* current deployment mode.
|
|
26
|
+
*
|
|
27
|
+
* Combines the deployment mode from context with the proto-derived
|
|
28
|
+
* tier metadata via {@link isResourceAvailable}.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* const available = useResourceAvailable(ApiResourceKind.api_key);
|
|
33
|
+
* if (!available) return <CloudFeatureNotice>...</CloudFeatureNotice>;
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function useResourceAvailable(kind) {
|
|
37
|
+
const mode = useDeploymentMode();
|
|
38
|
+
return isResourceAvailable(kind, mode);
|
|
39
|
+
}
|
|
40
|
+
export { ApiResourceKind };
|
|
41
|
+
//# sourceMappingURL=deployment-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-mode.js","sourceRoot":"","sources":["../src/deployment-mode.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAiB,OAAO,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAqB;IACxD,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;IACjC,OAAO,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,OAAO,EAAuB,eAAe,EAAE,CAAC"}
|
|
@@ -14,13 +14,15 @@ export interface ApprovalCardProps {
|
|
|
14
14
|
readonly className?: string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Renders a pending tool-call approval request
|
|
18
|
-
*
|
|
17
|
+
* Renders a pending tool-call approval request with the same visual
|
|
18
|
+
* structure as an expanded {@link ToolCallItem} in the history list.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* The compact header row matches the ToolCallItem layout:
|
|
21
|
+
* [CategoryIcon] Label primaryArg [⏳ waiting Xm]
|
|
22
|
+
*
|
|
23
|
+
* Arguments are rendered through the shared {@link ToolArgsView}
|
|
24
|
+
* dispatch, ensuring pixel-level parity between the approval
|
|
25
|
+
* preview and the post-execution detail view.
|
|
24
26
|
*
|
|
25
27
|
* @example
|
|
26
28
|
* ```tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApprovalCard.d.ts","sourceRoot":"","sources":["../../src/execution/ApprovalCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;
|
|
1
|
+
{"version":3,"file":"ApprovalCard.d.ts","sourceRoot":"","sources":["../../src/execution/ApprovalCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kEAAkE,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAS9F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,mEAAmE;IACnE,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,eAAe,EACf,QAAQ,EACR,YAAoB,EACpB,SAAS,GACV,EAAE,iBAAiB,2CAsJnB"}
|
|
@@ -4,16 +4,18 @@ import { useCallback, useEffect, useMemo, useState } from "react";
|
|
|
4
4
|
import { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
5
5
|
import { cn } from "@stigmer/theme";
|
|
6
6
|
import { resolveToolCategory, extractPrimaryArgFromPreview, } from "./tool-categories";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { CATEGORY_ICON } from "./ToolCallItem";
|
|
8
|
+
import { ToolArgsView } from "./ToolArgsView";
|
|
9
9
|
/**
|
|
10
|
-
* Renders a pending tool-call approval request
|
|
11
|
-
*
|
|
10
|
+
* Renders a pending tool-call approval request with the same visual
|
|
11
|
+
* structure as an expanded {@link ToolCallItem} in the history list.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* The compact header row matches the ToolCallItem layout:
|
|
14
|
+
* [CategoryIcon] Label primaryArg [⏳ waiting Xm]
|
|
15
|
+
*
|
|
16
|
+
* Arguments are rendered through the shared {@link ToolArgsView}
|
|
17
|
+
* dispatch, ensuring pixel-level parity between the approval
|
|
18
|
+
* preview and the post-execution detail view.
|
|
17
19
|
*
|
|
18
20
|
* @example
|
|
19
21
|
* ```tsx
|
|
@@ -35,86 +37,31 @@ export function ApprovalCard({ pendingApproval, onSubmit, isSubmitting = false,
|
|
|
35
37
|
setActiveAction(null);
|
|
36
38
|
}
|
|
37
39
|
}, [isSubmitting]);
|
|
38
|
-
const categoryInfo = resolveToolCategory(pendingApproval.toolName);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
header: "Sub-agent approval required",
|
|
50
|
-
headerIcon: _jsx(ShieldIcon, {}),
|
|
51
|
-
borderClass: "border-warning/30 bg-warning/5",
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
switch (category) {
|
|
55
|
-
case "shell":
|
|
56
|
-
return {
|
|
57
|
-
header: "Execute command",
|
|
58
|
-
headerIcon: _jsx(TerminalApprovalIcon, {}),
|
|
59
|
-
borderClass: "border-warning/30 bg-warning/5",
|
|
60
|
-
};
|
|
61
|
-
case "delete":
|
|
62
|
-
return {
|
|
63
|
-
header: "Delete file",
|
|
64
|
-
headerIcon: _jsx(ShieldIcon, {}),
|
|
65
|
-
borderClass: "border-destructive/30 bg-destructive/5",
|
|
66
|
-
};
|
|
67
|
-
default:
|
|
68
|
-
return {
|
|
69
|
-
header: "Approval required",
|
|
70
|
-
headerIcon: _jsx(ShieldIcon, {}),
|
|
71
|
-
borderClass: "border-warning/30 bg-warning/5",
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// ---------------------------------------------------------------------------
|
|
76
|
-
// Category-specific args preview
|
|
77
|
-
// ---------------------------------------------------------------------------
|
|
78
|
-
function CategoryArgsPreview({ category, primaryArg, argsPreview, }) {
|
|
79
|
-
if (category === "shell" && primaryArg) {
|
|
80
|
-
return _jsx(ShellArgsPreview, { command: primaryArg });
|
|
81
|
-
}
|
|
82
|
-
if ((category === "read" || category === "write" || category === "edit" || category === "delete") && primaryArg) {
|
|
83
|
-
return _jsx(FileArgsPreview, { path: primaryArg, argsPreview: argsPreview });
|
|
84
|
-
}
|
|
85
|
-
if ((category === "search" || category === "list") && primaryArg) {
|
|
86
|
-
return _jsx(SearchArgsPreview, { pattern: primaryArg });
|
|
87
|
-
}
|
|
88
|
-
if (!argsPreview)
|
|
89
|
-
return null;
|
|
90
|
-
return _jsx(GenericArgsPreview, { content: argsPreview });
|
|
91
|
-
}
|
|
92
|
-
function ShellArgsPreview({ command }) {
|
|
93
|
-
return (_jsx("div", { className: "rounded-md border border-border bg-[var(--stgm-terminal-bg,#1a1a2e)] p-2.5", children: _jsxs("pre", { className: "whitespace-pre-wrap break-words font-mono text-xs text-[var(--stgm-terminal-fg,#e0e0e0)]", children: [_jsx("span", { className: "select-none text-[var(--stgm-terminal-prompt,#6b7280)]", children: "$ " }), command] }) }));
|
|
94
|
-
}
|
|
95
|
-
function FileArgsPreview({ path, argsPreview, }) {
|
|
96
|
-
return (_jsxs("div", { className: "space-y-1.5", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [_jsx(FilePathIcon, {}), _jsx(FilePathLink, { path: path, className: "text-xs" })] }), argsPreview && _jsx(GenericArgsPreview, { content: argsPreview })] }));
|
|
97
|
-
}
|
|
98
|
-
function SearchArgsPreview({ pattern }) {
|
|
99
|
-
return (_jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [_jsx("span", { className: "text-muted-foreground", children: "Pattern:" }), _jsx("code", { className: "rounded bg-muted px-1.5 py-0.5 font-mono text-foreground", children: pattern })] }));
|
|
100
|
-
}
|
|
101
|
-
function GenericArgsPreview({ content }) {
|
|
102
|
-
const formatted = useMemo(() => {
|
|
40
|
+
const categoryInfo = resolveToolCategory(pendingApproval.toolName, pendingApproval.mcpServerSlug);
|
|
41
|
+
const CategoryIcon = CATEGORY_ICON[categoryInfo.category];
|
|
42
|
+
const primaryArg = useMemo(() => extractPrimaryArgFromPreview(pendingApproval.toolName, pendingApproval.argsPreview, pendingApproval.mcpServerSlug), [
|
|
43
|
+
pendingApproval.toolName,
|
|
44
|
+
pendingApproval.argsPreview,
|
|
45
|
+
pendingApproval.mcpServerSlug,
|
|
46
|
+
]);
|
|
47
|
+
const parsedArgs = useMemo(() => {
|
|
48
|
+
if (!pendingApproval.argsPreview)
|
|
49
|
+
return null;
|
|
103
50
|
try {
|
|
104
|
-
const parsed = JSON.parse(
|
|
105
|
-
|
|
51
|
+
const parsed = JSON.parse(pendingApproval.argsPreview);
|
|
52
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
53
|
+
return parsed;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
106
56
|
}
|
|
107
57
|
catch {
|
|
108
|
-
return
|
|
58
|
+
return null;
|
|
109
59
|
}
|
|
110
|
-
}, [
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
? lines.slice(0, TRUNCATION_LINE_LIMIT).join("\n") + "\n\u2026"
|
|
116
|
-
: formatted;
|
|
117
|
-
return (_jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Arguments" }), _jsx("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md border border-border bg-muted/40 p-2 font-mono text-xs text-foreground", children: displayContent }), needsTruncation && (_jsx("button", { type: "button", onClick: () => setIsExpanded((v) => !v), className: "text-xs font-medium text-primary transition-colors hover:text-primary/80", children: isExpanded ? "Show less" : `Show all ${lines.length} lines` }))] }));
|
|
60
|
+
}, [pendingApproval.argsPreview]);
|
|
61
|
+
const borderClass = categoryInfo.category === "delete"
|
|
62
|
+
? "border-destructive/30 bg-destructive/5"
|
|
63
|
+
: "border-warning/30 bg-warning/5";
|
|
64
|
+
return (_jsxs("div", { role: "alert", "aria-label": `Approval required for ${pendingApproval.toolName}`, className: cn("rounded-lg border", borderClass, className), children: [_jsxs("div", { className: cn("flex items-center gap-2 px-2.5 py-1.5 text-xs", "border-b border-border/30"), children: [_jsx("span", { className: "shrink-0 text-warning", "aria-hidden": "true", children: _jsx(CategoryIcon, {}) }), _jsxs("span", { className: "min-w-0 flex-1 flex items-baseline gap-1.5 overflow-hidden", children: [_jsx("span", { className: "shrink-0 font-medium text-foreground", children: categoryInfo.label }), primaryArg && (_jsx("span", { className: "min-w-0 truncate font-mono text-muted-foreground", children: primaryArg }))] }), _jsx(WaitingDuration, { requestedAt: pendingApproval.requestedAt }), _jsx("span", { className: "shrink-0 text-warning", "aria-hidden": "true", children: _jsx(ClockIcon, {}) })] }), _jsxs("div", { className: "px-3 py-2.5 space-y-2", children: [pendingApproval.fromSubAgent && pendingApproval.subAgentName && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Sub-agent", " ", _jsx("span", { className: "font-medium text-foreground", children: pendingApproval.subAgentName }), " ", "wants to execute this tool"] })), pendingApproval.message && (_jsx("p", { className: "text-xs text-foreground", children: pendingApproval.message })), parsedArgs && (_jsx(ToolArgsView, { toolName: pendingApproval.toolName, args: parsedArgs, mcpServerSlug: pendingApproval.mcpServerSlug })), _jsxs("div", { className: "flex items-center gap-2 pt-1", children: [_jsx(ActionButton, { label: "Approve", action: ApprovalAction.APPROVE, activeAction: activeAction, isSubmitting: isSubmitting, onClick: handleAction, variant: "approve" }), _jsx(ActionButton, { label: "Skip", action: ApprovalAction.SKIP, activeAction: activeAction, isSubmitting: isSubmitting, onClick: handleAction, variant: "skip" }), _jsx(ActionButton, { label: "Reject", action: ApprovalAction.REJECT, activeAction: activeAction, isSubmitting: isSubmitting, onClick: handleAction, variant: "reject" })] })] })] }));
|
|
118
65
|
}
|
|
119
66
|
// ---------------------------------------------------------------------------
|
|
120
67
|
// Internal sub-components
|
|
@@ -129,9 +76,6 @@ function ActionButton({ label, action, activeAction, isSubmitting, onClick, vari
|
|
|
129
76
|
};
|
|
130
77
|
return (_jsxs("button", { type: "button", disabled: disabled, onClick: () => onClick(action), "aria-label": label, className: cn("inline-flex items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "disabled:cursor-not-allowed", variantClasses[variant]), children: [isActive && isSubmitting ? _jsx(SpinnerIcon, {}) : null, label] }));
|
|
131
78
|
}
|
|
132
|
-
/**
|
|
133
|
-
* Live-ticking elapsed time since the approval was requested.
|
|
134
|
-
*/
|
|
135
79
|
function WaitingDuration({ requestedAt }) {
|
|
136
80
|
const startMs = useMemo(() => {
|
|
137
81
|
if (!requestedAt)
|
|
@@ -153,7 +97,7 @@ function WaitingDuration({ requestedAt }) {
|
|
|
153
97
|
}, [startMs]);
|
|
154
98
|
if (elapsed === null)
|
|
155
99
|
return null;
|
|
156
|
-
return (
|
|
100
|
+
return (_jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: formatElapsed(elapsed) }));
|
|
157
101
|
}
|
|
158
102
|
function formatElapsed(ms) {
|
|
159
103
|
if (ms < 1000)
|
|
@@ -177,14 +121,8 @@ function formatElapsed(ms) {
|
|
|
177
121
|
// ---------------------------------------------------------------------------
|
|
178
122
|
// Inline SVG icons
|
|
179
123
|
// ---------------------------------------------------------------------------
|
|
180
|
-
function
|
|
181
|
-
return (_jsxs("svg", { width: "
|
|
182
|
-
}
|
|
183
|
-
function TerminalApprovalIcon() {
|
|
184
|
-
return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("rect", { x: "1", y: "2", width: "12", height: "10", rx: "2" }), _jsx("path", { d: "M4 5.5L6 7.5L4 9.5" }), _jsx("path", { d: "M7.5 9.5H10" })] }));
|
|
185
|
-
}
|
|
186
|
-
function FilePathIcon() {
|
|
187
|
-
return (_jsxs("svg", { width: "10", height: "10", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", className: "shrink-0 text-muted-foreground", "aria-hidden": "true", children: [_jsx("path", { d: "M7 1H3C2.45 1 2 1.45 2 2V10C2 10.55 2.45 11 3 11H9C9.55 11 10 10.55 10 10V4L7 1Z" }), _jsx("path", { d: "M7 1V4H10" })] }));
|
|
124
|
+
function ClockIcon() {
|
|
125
|
+
return (_jsxs("svg", { width: "10", height: "10", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "6", cy: "6", r: "4.5" }), _jsx("path", { d: "M6 3.5V6L7.5 7.5" })] }));
|
|
188
126
|
}
|
|
189
127
|
function SpinnerIcon() {
|
|
190
128
|
return (_jsx("svg", { width: "10", height: "10", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", className: "animate-spin", "aria-hidden": "true", children: _jsx("path", { d: "M6 1.5A4.5 4.5 0 1 1 1.5 6", strokeLinecap: "round" }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApprovalCard.js","sourceRoot":"","sources":["../../src/execution/ApprovalCard.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,
|
|
1
|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CAAC;IACpB,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACvC,MAAM,gBAAgB,GAAG,OAAO,GAAG,EAAE,CAAC;IACtC,OAAO,gBAAgB,GAAG,CAAC;QACzB,CAAC,CAAC,GAAG,KAAK,KAAK,gBAAgB,GAAG;QAClC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;AAClB,CAAC;AAED,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,SAAS,SAAS;IAChB,OAAO,CACL,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,aAEtB,iBAAQ,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,CAAC,EAAC,KAAK,GAAG,EAChC,eAAM,CAAC,EAAC,kBAAkB,GAAG,IACzB,CACP,CAAC;AACJ,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,CACL,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,SAAS,EAAC,cAAc,iBACZ,MAAM,YAElB,eAAM,CAAC,EAAC,4BAA4B,EAAC,aAAa,EAAC,OAAO,GAAG,GACzD,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ToolCall } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
|
|
2
|
+
export interface McpToolDetailProps {
|
|
3
|
+
readonly toolCall: ToolCall;
|
|
4
|
+
readonly className?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* MCP-aware detail renderer for tool calls originating from an MCP
|
|
8
|
+
* server.
|
|
9
|
+
*
|
|
10
|
+
* Replaces the generic "dump args + result as raw JSON" fallback
|
|
11
|
+
* with structured formatting:
|
|
12
|
+
*
|
|
13
|
+
* - **Arguments** are rendered as a labelled key-value list.
|
|
14
|
+
* Scalars display inline; objects/arrays collapse into formatted
|
|
15
|
+
* JSON blocks.
|
|
16
|
+
* - **Results** are parsed through {@link parseMcpResult} which
|
|
17
|
+
* handles MCP content-block arrays, embedded JSON, and Python
|
|
18
|
+
* repr artefacts before rendering.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <McpToolDetail toolCall={toolCall} />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function McpToolDetail({ toolCall, className }: McpToolDetailProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function McpMetadataRow({ mcpServerSlug, toolName, duration, }: {
|
|
27
|
+
mcpServerSlug: string;
|
|
28
|
+
toolName: string;
|
|
29
|
+
duration: string | null;
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
31
|
+
export declare function McpArgsView({ args }: {
|
|
32
|
+
args: Record<string, unknown>;
|
|
33
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
34
|
+
/**
|
|
35
|
+
* Extracts human-readable content from an MCP tool result string.
|
|
36
|
+
*
|
|
37
|
+
* Handles three common formats that arrive from the backend:
|
|
38
|
+
*
|
|
39
|
+
* 1. **MCP content-block array** — `[{"type":"text","text":"..."}]`.
|
|
40
|
+
* Text parts are extracted and, if they are themselves valid
|
|
41
|
+
* JSON, pretty-printed.
|
|
42
|
+
* 2. **Python repr** — `[{'type': 'text', 'text': '...'}]`. Single
|
|
43
|
+
* quotes are normalised to double quotes before parsing.
|
|
44
|
+
* 3. **Plain JSON / text** — returned formatted when valid JSON,
|
|
45
|
+
* or as-is otherwise.
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseMcpResult(result: string): string;
|
|
48
|
+
//# sourceMappingURL=McpToolDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpToolDetail.d.ts","sourceRoot":"","sources":["../../src/execution/McpToolDetail.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAahG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,kBAAkB,2CAoBxE;AAMD,wBAAgB,cAAc,CAAC,EAC7B,aAAa,EACb,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,kDAiBA;AAMD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,kDAoCtE;AA2CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAoBrD"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@stigmer/theme";
|
|
4
|
+
import { formatDuration } from "./ToolCallDetail";
|
|
5
|
+
import { humanizeToolName } from "./tool-categories";
|
|
6
|
+
import { CollapsiblePre, CollapsibleJsonBlock, McpServerIcon, formatJson, isScalar, humanizeArgKey, } from "./tool-rendering-primitives";
|
|
7
|
+
/**
|
|
8
|
+
* MCP-aware detail renderer for tool calls originating from an MCP
|
|
9
|
+
* server.
|
|
10
|
+
*
|
|
11
|
+
* Replaces the generic "dump args + result as raw JSON" fallback
|
|
12
|
+
* with structured formatting:
|
|
13
|
+
*
|
|
14
|
+
* - **Arguments** are rendered as a labelled key-value list.
|
|
15
|
+
* Scalars display inline; objects/arrays collapse into formatted
|
|
16
|
+
* JSON blocks.
|
|
17
|
+
* - **Results** are parsed through {@link parseMcpResult} which
|
|
18
|
+
* handles MCP content-block arrays, embedded JSON, and Python
|
|
19
|
+
* repr artefacts before rendering.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <McpToolDetail toolCall={toolCall} />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function McpToolDetail({ toolCall, className }) {
|
|
27
|
+
const duration = formatDuration(toolCall.startedAt, toolCall.completedAt);
|
|
28
|
+
return (_jsxs("div", { className: cn("space-y-3 text-xs", className), children: [_jsx(McpMetadataRow, { mcpServerSlug: toolCall.mcpServerSlug, toolName: toolCall.name, duration: duration }), toolCall.args && Object.keys(toolCall.args).length > 0 && (_jsx(McpArgsView, { args: toolCall.args })), toolCall.result && (_jsx(McpResultView, { result: toolCall.result }))] }));
|
|
29
|
+
}
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Metadata
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
export function McpMetadataRow({ mcpServerSlug, toolName, duration, }) {
|
|
34
|
+
const hasMetadata = mcpServerSlug || duration;
|
|
35
|
+
if (!hasMetadata)
|
|
36
|
+
return null;
|
|
37
|
+
return (_jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground", children: [mcpServerSlug && (_jsxs("span", { className: "inline-flex items-center gap-1.5 rounded bg-muted px-1.5 py-0.5 font-mono", children: [_jsx(McpServerIcon, {}), mcpServerSlug, _jsx("span", { className: "text-muted-foreground/60", children: "/" }), _jsx("span", { className: "text-foreground", children: humanizeToolName(toolName) })] })), duration && _jsx("span", { children: duration })] }));
|
|
38
|
+
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Arguments — structured key-value rendering
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
export function McpArgsView({ args }) {
|
|
43
|
+
const entries = Object.entries(args);
|
|
44
|
+
if (entries.length === 0)
|
|
45
|
+
return null;
|
|
46
|
+
const scalars = [];
|
|
47
|
+
const complex = [];
|
|
48
|
+
for (const [key, value] of entries) {
|
|
49
|
+
if (isScalar(value)) {
|
|
50
|
+
scalars.push([key, String(value)]);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
complex.push([key, value]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return (_jsxs("div", { className: "space-y-2", children: [_jsx("span", { className: "font-medium text-muted-foreground", children: "Arguments" }), scalars.length > 0 && (_jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 rounded-md border border-border bg-muted/30 px-2.5 py-2", children: scalars.map(([key, value]) => (_jsx(ScalarRow, { label: key, value: value }, key))) })), complex.map(([key, value]) => (_jsx(CollapsibleJsonBlock, { label: humanizeArgKey(key), content: formatJson(value) }, key)))] }));
|
|
57
|
+
}
|
|
58
|
+
function ScalarRow({ label, value }) {
|
|
59
|
+
const isMultiline = value.includes("\n");
|
|
60
|
+
return (_jsxs(_Fragment, { children: [_jsx("dt", { className: "whitespace-nowrap font-mono text-muted-foreground", children: humanizeArgKey(label) }), isMultiline ? (_jsx("dd", { className: "min-w-0", children: _jsx("pre", { className: "whitespace-pre-wrap break-words rounded border border-border bg-muted/40 px-2 py-1 font-mono text-foreground", children: value }) })) : (_jsx("dd", { className: "min-w-0 truncate font-mono text-foreground", title: value, children: value }))] }));
|
|
61
|
+
}
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Result — intelligent parsing
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
function McpResultView({ result }) {
|
|
66
|
+
const parsed = parseMcpResult(result);
|
|
67
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-muted-foreground", children: "Result" }), _jsx(CollapsiblePre, { content: parsed, className: "max-h-80 overflow-auto rounded-md border border-border bg-muted/40 p-2 text-foreground" })] }));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Extracts human-readable content from an MCP tool result string.
|
|
71
|
+
*
|
|
72
|
+
* Handles three common formats that arrive from the backend:
|
|
73
|
+
*
|
|
74
|
+
* 1. **MCP content-block array** — `[{"type":"text","text":"..."}]`.
|
|
75
|
+
* Text parts are extracted and, if they are themselves valid
|
|
76
|
+
* JSON, pretty-printed.
|
|
77
|
+
* 2. **Python repr** — `[{'type': 'text', 'text': '...'}]`. Single
|
|
78
|
+
* quotes are normalised to double quotes before parsing.
|
|
79
|
+
* 3. **Plain JSON / text** — returned formatted when valid JSON,
|
|
80
|
+
* or as-is otherwise.
|
|
81
|
+
*/
|
|
82
|
+
export function parseMcpResult(result) {
|
|
83
|
+
const trimmed = result.trim();
|
|
84
|
+
// Fast path: try standard JSON parse first.
|
|
85
|
+
const jsonParsed = tryParseJson(trimmed);
|
|
86
|
+
if (jsonParsed !== undefined) {
|
|
87
|
+
const extracted = tryExtractContentBlocks(jsonParsed);
|
|
88
|
+
if (extracted !== null)
|
|
89
|
+
return extracted;
|
|
90
|
+
return JSON.stringify(jsonParsed, null, 2);
|
|
91
|
+
}
|
|
92
|
+
// Attempt to fix Python repr (single-quoted dicts/lists).
|
|
93
|
+
const fixed = tryFixPythonRepr(trimmed);
|
|
94
|
+
if (fixed !== undefined) {
|
|
95
|
+
const extracted = tryExtractContentBlocks(fixed);
|
|
96
|
+
if (extracted !== null)
|
|
97
|
+
return extracted;
|
|
98
|
+
return JSON.stringify(fixed, null, 2);
|
|
99
|
+
}
|
|
100
|
+
return trimmed;
|
|
101
|
+
}
|
|
102
|
+
function isMcpContentBlockArray(val) {
|
|
103
|
+
if (!Array.isArray(val))
|
|
104
|
+
return false;
|
|
105
|
+
if (val.length === 0)
|
|
106
|
+
return false;
|
|
107
|
+
return val.every((item) => typeof item === "object" &&
|
|
108
|
+
item !== null &&
|
|
109
|
+
"type" in item &&
|
|
110
|
+
typeof item.type === "string");
|
|
111
|
+
}
|
|
112
|
+
function tryExtractContentBlocks(parsed) {
|
|
113
|
+
if (!isMcpContentBlockArray(parsed))
|
|
114
|
+
return null;
|
|
115
|
+
const textParts = [];
|
|
116
|
+
for (const block of parsed) {
|
|
117
|
+
if (block.type === "text" && typeof block.text === "string") {
|
|
118
|
+
const innerJson = tryParseJson(block.text.trim());
|
|
119
|
+
if (innerJson !== undefined) {
|
|
120
|
+
textParts.push(JSON.stringify(innerJson, null, 2));
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
textParts.push(block.text);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return textParts.length > 0 ? textParts.join("\n\n") : null;
|
|
128
|
+
}
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
// JSON / Python repr helpers
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
function tryParseJson(str) {
|
|
133
|
+
try {
|
|
134
|
+
return JSON.parse(str);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Attempts to convert a Python repr string (single-quoted
|
|
142
|
+
* dicts/lists with True/False/None) into a parsed JS value.
|
|
143
|
+
*
|
|
144
|
+
* This is intentionally conservative: it only handles the
|
|
145
|
+
* most common patterns and bails on ambiguity.
|
|
146
|
+
*/
|
|
147
|
+
function tryFixPythonRepr(str) {
|
|
148
|
+
if (!str.startsWith("[") && !str.startsWith("{"))
|
|
149
|
+
return undefined;
|
|
150
|
+
let fixed = str
|
|
151
|
+
.replace(/'/g, '"')
|
|
152
|
+
.replace(/\bTrue\b/g, "true")
|
|
153
|
+
.replace(/\bFalse\b/g, "false")
|
|
154
|
+
.replace(/\bNone\b/g, "null");
|
|
155
|
+
// Handle trailing commas before ] or } (common in Python repr).
|
|
156
|
+
fixed = fixed.replace(/,\s*([}\]])/g, "$1");
|
|
157
|
+
return tryParseJson(fixed);
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=McpToolDetail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpToolDetail.js","sourceRoot":"","sources":["../../src/execution/McpToolDetail.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,UAAU,EACV,QAAQ,EACR,cAAc,GACf,MAAM,6BAA6B,CAAC;AAOrC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAsB;IACvE,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE1E,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,aAChD,KAAC,cAAc,IACb,aAAa,EAAE,QAAQ,CAAC,aAAa,EACrC,QAAQ,EAAE,QAAQ,CAAC,IAAI,EACvB,QAAQ,EAAE,QAAQ,GAClB,EAED,QAAQ,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CACzD,KAAC,WAAW,IAAC,IAAI,EAAE,QAAQ,CAAC,IAA+B,GAAI,CAChE,EAEA,QAAQ,CAAC,MAAM,IA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GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAEnE,IAAI,KAAK,GAAG,GAAG;SACZ,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;SAC5B,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;SAC9B,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAEhC,gEAAgE;IAChE,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IAE5C,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface ToolArgsViewProps {
|
|
2
|
+
/**
|
|
3
|
+
* Raw tool name as it appears on the ToolCall or PendingApproval.
|
|
4
|
+
* Used for category resolution and MCP metadata display.
|
|
5
|
+
*/
|
|
6
|
+
readonly toolName: string;
|
|
7
|
+
/**
|
|
8
|
+
* Parsed tool arguments — either from `ToolCall.args` or
|
|
9
|
+
* `JSON.parse(PendingApproval.argsPreview)`.
|
|
10
|
+
*/
|
|
11
|
+
readonly args: Record<string, unknown> | null;
|
|
12
|
+
/** MCP server slug for MCP tool classification and metadata. */
|
|
13
|
+
readonly mcpServerSlug?: string;
|
|
14
|
+
readonly className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Unified tool-arguments renderer used by both {@link ApprovalCard}
|
|
18
|
+
* (pre-execution) and {@link ToolCallDetail} (post-execution).
|
|
19
|
+
*
|
|
20
|
+
* Resolves the tool category from `toolName` + `mcpServerSlug`,
|
|
21
|
+
* extracts the relevant primary argument, and dispatches to the
|
|
22
|
+
* appropriate category-specific view:
|
|
23
|
+
*
|
|
24
|
+
* - **Shell** — terminal-style command block
|
|
25
|
+
* - **File (read/write/edit/delete)** — file icon + path + optional content
|
|
26
|
+
* - **Search / List** — pattern display
|
|
27
|
+
* - **MCP** — metadata row + scalar key-value grid + collapsible JSON
|
|
28
|
+
* - **Generic / Unknown** — formatted JSON args
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // In approval card (from argsPreview string):
|
|
33
|
+
* const args = JSON.parse(pendingApproval.argsPreview);
|
|
34
|
+
* <ToolArgsView toolName={toolName} args={args} mcpServerSlug={slug} />
|
|
35
|
+
*
|
|
36
|
+
* // In detail view (from ToolCall):
|
|
37
|
+
* <ToolArgsView toolName={tc.name} args={tc.args} mcpServerSlug={tc.mcpServerSlug} />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function ToolArgsView({ toolName, args, mcpServerSlug, className, }: ToolArgsViewProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
//# sourceMappingURL=ToolArgsView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolArgsView.d.ts","sourceRoot":"","sources":["../../src/execution/ToolArgsView.tsx"],"names":[],"mappings":"AAqBA,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9C,gEAAgE;IAChE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,SAAS,GACV,EAAE,iBAAiB,2CAsBnB"}
|