@stigmer/react 0.0.52 → 0.0.54
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/ArtifactCard.d.ts +11 -1
- package/execution/ArtifactCard.d.ts.map +1 -1
- package/execution/ArtifactCard.js +22 -3
- package/execution/ArtifactCard.js.map +1 -1
- package/execution/ArtifactPreviewModal.d.ts.map +1 -1
- package/execution/ArtifactPreviewModal.js +1 -1
- package/execution/ArtifactPreviewModal.js.map +1 -1
- package/execution/ArtifactsWidget.d.ts +26 -19
- package/execution/ArtifactsWidget.d.ts.map +1 -1
- package/execution/ArtifactsWidget.js +24 -26
- package/execution/ArtifactsWidget.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/MessageThread.d.ts +10 -1
- package/execution/MessageThread.d.ts.map +1 -1
- package/execution/MessageThread.js +19 -17
- package/execution/MessageThread.js.map +1 -1
- package/execution/SandboxContext.d.ts +32 -0
- package/execution/SandboxContext.d.ts.map +1 -0
- package/execution/SandboxContext.js +26 -0
- package/execution/SandboxContext.js.map +1 -0
- package/execution/ToolArgsView.d.ts +41 -0
- package/execution/ToolArgsView.d.ts.map +1 -0
- package/execution/ToolArgsView.js +134 -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 +32 -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 +13 -3
- package/execution/ToolCallItem.js.map +1 -1
- package/execution/WriteBackCard.d.ts +34 -0
- package/execution/WriteBackCard.d.ts.map +1 -0
- package/execution/WriteBackCard.js +75 -0
- package/execution/WriteBackCard.js.map +1 -0
- package/execution/WriteBacksWidget.d.ts +49 -0
- package/execution/WriteBacksWidget.d.ts.map +1 -0
- package/execution/WriteBacksWidget.js +44 -0
- package/execution/WriteBacksWidget.js.map +1 -0
- package/execution/__tests__/file-path-resolver.test.d.ts +2 -0
- package/execution/__tests__/file-path-resolver.test.d.ts.map +1 -0
- package/execution/__tests__/file-path-resolver.test.js +180 -0
- package/execution/__tests__/file-path-resolver.test.js.map +1 -0
- package/execution/file-path-resolver.d.ts +3 -3
- package/execution/file-path-resolver.d.ts.map +1 -1
- package/execution/file-path-resolver.js +23 -12
- package/execution/file-path-resolver.js.map +1 -1
- package/execution/index.d.ts +16 -1
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js +9 -1
- package/execution/index.js.map +1 -1
- package/execution/sandbox-path-normalizer.d.ts +46 -0
- package/execution/sandbox-path-normalizer.d.ts.map +1 -0
- package/execution/sandbox-path-normalizer.js +73 -0
- package/execution/sandbox-path-normalizer.js.map +1 -0
- 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/execution/useArtifactContent.d.ts +5 -1
- package/execution/useArtifactContent.d.ts.map +1 -1
- package/execution/useArtifactContent.js +6 -2
- package/execution/useArtifactContent.js.map +1 -1
- package/execution/useWorkspaceWriteBacks.d.ts +40 -0
- package/execution/useWorkspaceWriteBacks.d.ts.map +1 -0
- package/execution/useWorkspaceWriteBacks.js +41 -0
- package/execution/useWorkspaceWriteBacks.js.map +1 -0
- package/github/GitHubRepoPicker.d.ts +5 -2
- package/github/GitHubRepoPicker.d.ts.map +1 -1
- package/github/GitHubRepoPicker.js +133 -36
- package/github/GitHubRepoPicker.js.map +1 -1
- package/github/index.d.ts +1 -0
- package/github/index.d.ts.map +1 -1
- package/github/index.js +1 -0
- package/github/index.js.map +1 -1
- package/github/useGitHubSearch.d.ts +20 -0
- package/github/useGitHubSearch.d.ts.map +1 -0
- package/github/useGitHubSearch.js +127 -0
- package/github/useGitHubSearch.js.map +1 -0
- package/index.d.ts +9 -6
- package/index.d.ts.map +1 -1
- package/index.js +7 -3
- 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/session/index.d.ts +4 -0
- package/session/index.d.ts.map +1 -1
- package/session/index.js +2 -0
- package/session/index.js.map +1 -1
- package/session/useSessionArtifacts.d.ts +73 -0
- package/session/useSessionArtifacts.d.ts.map +1 -0
- package/session/useSessionArtifacts.js +95 -0
- package/session/useSessionArtifacts.js.map +1 -0
- package/session/useSessionWriteBacks.d.ts +56 -0
- package/session/useSessionWriteBacks.d.ts.map +1 -0
- package/session/useSessionWriteBacks.js +56 -0
- package/session/useSessionWriteBacks.js.map +1 -0
- package/src/deployment-mode.ts +46 -0
- package/src/execution/ApprovalCard.tsx +130 -283
- package/src/execution/ArtifactCard.tsx +40 -0
- package/src/execution/ArtifactPreviewModal.tsx +2 -0
- package/src/execution/ArtifactsWidget.tsx +51 -43
- package/src/execution/McpToolDetail.tsx +283 -0
- package/src/execution/MessageThread.tsx +18 -0
- package/src/execution/SandboxContext.ts +47 -0
- package/src/execution/ToolArgsView.tsx +279 -0
- package/src/execution/ToolCallDetail.tsx +54 -220
- package/src/execution/ToolCallGroup.tsx +3 -2
- package/src/execution/ToolCallItem.tsx +21 -3
- package/src/execution/WriteBackCard.tsx +210 -0
- package/src/execution/WriteBacksWidget.tsx +82 -0
- package/src/execution/__tests__/file-path-resolver.test.ts +295 -0
- package/src/execution/file-path-resolver.ts +24 -12
- package/src/execution/index.ts +38 -0
- package/src/execution/sandbox-path-normalizer.ts +80 -0
- package/src/execution/tool-categories.ts +89 -9
- package/src/execution/tool-rendering-primitives.tsx +253 -0
- package/src/execution/useArtifactContent.ts +6 -1
- package/src/execution/useWorkspaceWriteBacks.ts +56 -0
- package/src/github/GitHubRepoPicker.tsx +413 -108
- package/src/github/index.ts +5 -0
- package/src/github/useGitHubSearch.ts +162 -0
- package/src/index.ts +27 -0
- package/src/internal/CloudFeatureNotice.tsx +60 -0
- package/src/mcp-server/McpServerDetailView.tsx +24 -2
- package/src/provider.tsx +18 -2
- package/src/session/index.ts +12 -0
- package/src/session/useSessionArtifacts.ts +143 -0
- package/src/session/useSessionWriteBacks.ts +94 -0
- package/styles.css +1 -1
|
@@ -2,10 +2,15 @@ import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexe
|
|
|
2
2
|
import type { ApplyResourceResult } from "../library/useApplyResource";
|
|
3
3
|
export interface ArtifactsWidgetProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* All executions for the current session — both completed and
|
|
6
|
+
* actively streaming. The widget aggregates artifacts across every
|
|
7
|
+
* execution, deduplicates by `sandbox_path` (latest wins), and
|
|
8
|
+
* sorts alphabetically by name.
|
|
9
|
+
*
|
|
10
|
+
* Renders nothing when the list is empty or no execution has
|
|
11
|
+
* artifacts.
|
|
7
12
|
*/
|
|
8
|
-
readonly
|
|
13
|
+
readonly executions: readonly AgentExecution[];
|
|
9
14
|
/** Organization slug for the "Apply to [org]" CTA in the preview modal. */
|
|
10
15
|
readonly org: string;
|
|
11
16
|
/**
|
|
@@ -19,24 +24,22 @@ export interface ArtifactsWidgetProps {
|
|
|
19
24
|
readonly className?: string;
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
22
|
-
* Right-sidebar widget that surfaces
|
|
23
|
-
*
|
|
27
|
+
* Right-sidebar widget that surfaces all artifacts produced during a
|
|
28
|
+
* session as a unified, alphabetically-sorted file listing.
|
|
29
|
+
*
|
|
30
|
+
* Artifacts from multiple executions are aggregated and deduplicated
|
|
31
|
+
* by `sandbox_path` (latest execution wins), presenting the user with
|
|
32
|
+
* a file-explorer-like view of the conversation's output — no
|
|
33
|
+
* execution/turn concepts are exposed.
|
|
24
34
|
*
|
|
25
35
|
* Composes {@link ArtifactCard} (summary + detection badges) with
|
|
26
36
|
* {@link ArtifactPreviewModal} (full content review + Apply/Push CTA).
|
|
27
37
|
* The card's "Preview" action opens the modal; the modal is the sole
|
|
28
38
|
* location for Apply/Push actions (review-before-apply pattern).
|
|
29
39
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* - **Terminal phase**: derived via {@link isTerminalPhase} — controls
|
|
34
|
-
* whether the Apply CTA in the modal is enabled
|
|
35
|
-
* - **Execution ID**: read from `execution.metadata.id`
|
|
36
|
-
*
|
|
37
|
-
* Returns `null` when the execution is `null` or has no artifacts,
|
|
38
|
-
* matching the conditional-render pattern of {@link ExecutionProgress}
|
|
39
|
-
* and {@link ExecutionCostSummary}.
|
|
40
|
+
* Returns `null` when the executions list is empty or no execution
|
|
41
|
+
* has artifacts, matching the conditional-render pattern of
|
|
42
|
+
* {@link ExecutionProgress} and {@link ExecutionCostSummary}.
|
|
40
43
|
*
|
|
41
44
|
* Renders without card chrome — each {@link ArtifactCard} provides its
|
|
42
45
|
* own border and padding. The consumer controls the container styling
|
|
@@ -46,10 +49,13 @@ export interface ArtifactsWidgetProps {
|
|
|
46
49
|
*
|
|
47
50
|
* @example
|
|
48
51
|
* ```tsx
|
|
49
|
-
* const
|
|
52
|
+
* const conv = useSessionConversation(sessionId, org);
|
|
50
53
|
*
|
|
51
54
|
* <ArtifactsWidget
|
|
52
|
-
*
|
|
55
|
+
* executions={[
|
|
56
|
+
* ...conv.completedExecutions,
|
|
57
|
+
* ...(conv.activeStreamExecution ? [conv.activeStreamExecution] : []),
|
|
58
|
+
* ]}
|
|
53
59
|
* org={activeOrg}
|
|
54
60
|
* onApplied={(result) => toast(`${result.kind} applied`)}
|
|
55
61
|
* />
|
|
@@ -57,7 +63,8 @@ export interface ArtifactsWidgetProps {
|
|
|
57
63
|
*
|
|
58
64
|
* @see {@link ArtifactCard} — compact summary card per artifact
|
|
59
65
|
* @see {@link ArtifactPreviewModal} — full preview with Apply/Push CTA
|
|
60
|
-
* @see {@link
|
|
66
|
+
* @see {@link useSessionArtifacts} — headless session-level artifact aggregation hook
|
|
67
|
+
* @see {@link useExecutionArtifacts} — headless single-execution artifact extraction hook
|
|
61
68
|
*/
|
|
62
|
-
export declare function ArtifactsWidget({
|
|
69
|
+
export declare function ArtifactsWidget({ executions, org, onApplied, className, }: ArtifactsWidgetProps): import("react/jsx-runtime").JSX.Element | null;
|
|
63
70
|
//# sourceMappingURL=ArtifactsWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactsWidget.d.ts","sourceRoot":"","sources":["../../src/execution/ArtifactsWidget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAQlG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACnC
|
|
1
|
+
{"version":3,"file":"ArtifactsWidget.d.ts","sourceRoot":"","sources":["../../src/execution/ArtifactsWidget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAQlG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;IAC/C,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC3D,mDAAmD;IACnD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,GAAG,EACH,SAAS,EACT,SAAS,GACV,EAAE,oBAAoB,kDAkDtB"}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
5
4
|
import { cn } from "@stigmer/theme";
|
|
6
|
-
import {
|
|
7
|
-
import { isTerminalPhase } from "./execution-phases";
|
|
5
|
+
import { useSessionArtifacts, } from "../session/useSessionArtifacts";
|
|
8
6
|
import { ArtifactCard } from "./ArtifactCard";
|
|
9
7
|
import { ArtifactPreviewModal } from "./ArtifactPreviewModal";
|
|
10
8
|
/**
|
|
11
|
-
* Right-sidebar widget that surfaces
|
|
12
|
-
*
|
|
9
|
+
* Right-sidebar widget that surfaces all artifacts produced during a
|
|
10
|
+
* session as a unified, alphabetically-sorted file listing.
|
|
11
|
+
*
|
|
12
|
+
* Artifacts from multiple executions are aggregated and deduplicated
|
|
13
|
+
* by `sandbox_path` (latest execution wins), presenting the user with
|
|
14
|
+
* a file-explorer-like view of the conversation's output — no
|
|
15
|
+
* execution/turn concepts are exposed.
|
|
13
16
|
*
|
|
14
17
|
* Composes {@link ArtifactCard} (summary + detection badges) with
|
|
15
18
|
* {@link ArtifactPreviewModal} (full content review + Apply/Push CTA).
|
|
16
19
|
* The card's "Preview" action opens the modal; the modal is the sole
|
|
17
20
|
* location for Apply/Push actions (review-before-apply pattern).
|
|
18
21
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* - **Terminal phase**: derived via {@link isTerminalPhase} — controls
|
|
23
|
-
* whether the Apply CTA in the modal is enabled
|
|
24
|
-
* - **Execution ID**: read from `execution.metadata.id`
|
|
25
|
-
*
|
|
26
|
-
* Returns `null` when the execution is `null` or has no artifacts,
|
|
27
|
-
* matching the conditional-render pattern of {@link ExecutionProgress}
|
|
28
|
-
* and {@link ExecutionCostSummary}.
|
|
22
|
+
* Returns `null` when the executions list is empty or no execution
|
|
23
|
+
* has artifacts, matching the conditional-render pattern of
|
|
24
|
+
* {@link ExecutionProgress} and {@link ExecutionCostSummary}.
|
|
29
25
|
*
|
|
30
26
|
* Renders without card chrome — each {@link ArtifactCard} provides its
|
|
31
27
|
* own border and padding. The consumer controls the container styling
|
|
@@ -35,10 +31,13 @@ import { ArtifactPreviewModal } from "./ArtifactPreviewModal";
|
|
|
35
31
|
*
|
|
36
32
|
* @example
|
|
37
33
|
* ```tsx
|
|
38
|
-
* const
|
|
34
|
+
* const conv = useSessionConversation(sessionId, org);
|
|
39
35
|
*
|
|
40
36
|
* <ArtifactsWidget
|
|
41
|
-
*
|
|
37
|
+
* executions={[
|
|
38
|
+
* ...conv.completedExecutions,
|
|
39
|
+
* ...(conv.activeStreamExecution ? [conv.activeStreamExecution] : []),
|
|
40
|
+
* ]}
|
|
42
41
|
* org={activeOrg}
|
|
43
42
|
* onApplied={(result) => toast(`${result.kind} applied`)}
|
|
44
43
|
* />
|
|
@@ -46,16 +45,15 @@ import { ArtifactPreviewModal } from "./ArtifactPreviewModal";
|
|
|
46
45
|
*
|
|
47
46
|
* @see {@link ArtifactCard} — compact summary card per artifact
|
|
48
47
|
* @see {@link ArtifactPreviewModal} — full preview with Apply/Push CTA
|
|
49
|
-
* @see {@link
|
|
48
|
+
* @see {@link useSessionArtifacts} — headless session-level artifact aggregation hook
|
|
49
|
+
* @see {@link useExecutionArtifacts} — headless single-execution artifact extraction hook
|
|
50
50
|
*/
|
|
51
|
-
export function ArtifactsWidget({
|
|
52
|
-
const { artifacts, hasArtifacts, artifactCount } =
|
|
53
|
-
const [
|
|
51
|
+
export function ArtifactsWidget({ executions, org, onApplied, className, }) {
|
|
52
|
+
const { artifacts, hasArtifacts, artifactCount } = useSessionArtifacts(executions);
|
|
53
|
+
const [previewEntry, setPreviewEntry] = useState(null);
|
|
54
|
+
const handlePreview = useCallback((entry) => setPreviewEntry(entry), []);
|
|
54
55
|
if (!hasArtifacts)
|
|
55
56
|
return null;
|
|
56
|
-
|
|
57
|
-
const isTerminal = isTerminalPhase(phase);
|
|
58
|
-
const executionId = execution?.metadata?.id ?? "";
|
|
59
|
-
return (_jsxs("section", { "aria-label": "Execution artifacts", className: cn(className), children: [_jsxs("div", { className: "mb-2 flex items-center gap-2", children: [_jsx("h3", { className: "text-sm font-medium text-foreground", children: "Artifacts" }), _jsx("span", { className: "inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-muted px-1.5 text-xs tabular-nums text-muted-foreground", children: artifactCount })] }), _jsx("div", { role: "list", className: "space-y-2", children: artifacts.map((artifact) => (_jsx("div", { role: "listitem", children: _jsx(ArtifactCard, { artifact: artifact, executionId: executionId, org: org, onPreview: setPreviewArtifact }) }, artifact.storageKey))) }), previewArtifact && (_jsx(ArtifactPreviewModal, { artifact: previewArtifact, executionId: executionId, org: org, isTerminal: isTerminal, open: true, onClose: () => setPreviewArtifact(null), onApplied: onApplied }))] }));
|
|
57
|
+
return (_jsxs("section", { "aria-label": "Artifacts", className: cn(className), children: [_jsxs("div", { className: "mb-2 flex items-center gap-2", children: [_jsx("h3", { className: "text-sm font-medium text-foreground", children: "Artifacts" }), _jsx("span", { className: "inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-muted px-1.5 text-xs tabular-nums text-muted-foreground", children: artifactCount })] }), _jsx("div", { role: "list", className: "space-y-2", children: artifacts.map((entry) => (_jsx("div", { role: "listitem", children: _jsx(ArtifactCard, { artifact: entry.artifact, executionId: entry.executionId, org: org, hasNameCollision: entry.hasNameCollision, onPreview: () => handlePreview(entry) }) }, entry.artifact.storageKey))) }), previewEntry && (_jsx(ArtifactPreviewModal, { artifact: previewEntry.artifact, executionId: previewEntry.executionId, org: org, isTerminal: previewEntry.isTerminal, open: true, onClose: () => setPreviewEntry(null), onApplied: onApplied }))] }));
|
|
60
58
|
}
|
|
61
59
|
//# sourceMappingURL=ArtifactsWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactsWidget.js","sourceRoot":"","sources":["../../src/execution/ArtifactsWidget.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ArtifactsWidget.js","sourceRoot":"","sources":["../../src/execution/ArtifactsWidget.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,mBAAmB,GAEpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,M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AAY,CAAC,WAAW,EACrC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,YAAY,CAAC,UAAU,EACnC,IAAI,QACJ,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EACpC,SAAS,EAAE,SAAS,GACpB,CACH,IACO,CACX,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,Q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CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9D,CAAC;AAED,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E,SAAS,YAAY,CAAC,GAAW;IAC/B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,GAAW;IACnC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,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"}
|
|
@@ -60,6 +60,15 @@ export interface MessageThreadProps {
|
|
|
60
60
|
* navigation instead of the default open-URL / copy-to-clipboard.
|
|
61
61
|
*/
|
|
62
62
|
readonly onFilePathClick?: (path: string, resolved: ResolvedPathAction) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Absolute sandbox workspace root (e.g. `/home/daytona/workspace`).
|
|
65
|
+
* When provided, shell commands and tool output normalize absolute
|
|
66
|
+
* sandbox paths to workspace-relative display paths.
|
|
67
|
+
*
|
|
68
|
+
* Pass an empty string or omit for local sessions where paths are
|
|
69
|
+
* the user's own filesystem (no normalization needed).
|
|
70
|
+
*/
|
|
71
|
+
readonly sandboxWorkspaceRoot?: string;
|
|
63
72
|
}
|
|
64
73
|
/**
|
|
65
74
|
* Renders a continuous conversation thread from one or more
|
|
@@ -84,5 +93,5 @@ export interface MessageThreadProps {
|
|
|
84
93
|
* />
|
|
85
94
|
* ```
|
|
86
95
|
*/
|
|
87
|
-
export declare function MessageThread({ executions, activeStreamExecution, pendingUserMessage, className, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, dismissedApprovalIds, workspaceEntries, onFilePathClick, }: MessageThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
96
|
+
export declare function MessageThread({ executions, activeStreamExecution, pendingUserMessage, className, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, dismissedApprovalIds, workspaceEntries, onFilePathClick, sandboxWorkspaceRoot, }: MessageThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
88
97
|
//# sourceMappingURL=MessageThread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageThread.d.ts","sourceRoot":"","sources":["../../src/execution/MessageThread.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,KAAK,EAAgB,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAI9G,OAAO,EACL,cAAc,EAGf,MAAM,8DAA8D,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AASjG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageThread.d.ts","sourceRoot":"","sources":["../../src/execution/MessageThread.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,KAAK,EAAgB,QAAQ,EAAE,MAAM,iEAAiE,CAAC;AAI9G,OAAO,EACL,cAAc,EAGf,MAAM,8DAA8D,CAAC;AACtE,OA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B,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,EAAE,kBAAkB,2CAiHpB"}
|
|
@@ -12,6 +12,7 @@ import { ExecutionPhaseBadge } from "./ExecutionPhaseBadge";
|
|
|
12
12
|
import { SetupProgress } from "./SetupProgress";
|
|
13
13
|
import { ApprovalCard } from "./ApprovalCard";
|
|
14
14
|
import { FilePathContext } from "./FilePathContext";
|
|
15
|
+
import { SandboxContext } from "./SandboxContext";
|
|
15
16
|
const AUTO_SCROLL_THRESHOLD_PX = 80;
|
|
16
17
|
function hasAiMessages(execution) {
|
|
17
18
|
const messages = execution.status?.messages;
|
|
@@ -132,7 +133,7 @@ function buildThreadItems(executions, activeStreamExecution, pendingUserMessage,
|
|
|
132
133
|
* />
|
|
133
134
|
* ```
|
|
134
135
|
*/
|
|
135
|
-
export function MessageThread({ executions, activeStreamExecution, pendingUserMessage, className, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, dismissedApprovalIds, workspaceEntries, onFilePathClick, }) {
|
|
136
|
+
export function MessageThread({ executions, activeStreamExecution, pendingUserMessage, className, formatToolCallSummary, onApprovalSubmit, submittingApprovalIds, dismissedApprovalIds, workspaceEntries, onFilePathClick, sandboxWorkspaceRoot, }) {
|
|
136
137
|
const scrollRef = useRef(null);
|
|
137
138
|
const isNearBottomRef = useRef(true);
|
|
138
139
|
const includeApprovals = onApprovalSubmit != null;
|
|
@@ -156,21 +157,22 @@ export function MessageThread({ executions, activeStreamExecution, pendingUserMe
|
|
|
156
157
|
workspaceEntries: workspaceEntries ?? [],
|
|
157
158
|
onFilePathClick,
|
|
158
159
|
}), [workspaceEntries, onFilePathClick]);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
160
|
+
const sandboxCtx = useMemo(() => ({ sandboxWorkspaceRoot: sandboxWorkspaceRoot ?? "" }), [sandboxWorkspaceRoot]);
|
|
161
|
+
return (_jsx("div", { ref: scrollRef, role: "log", "aria-live": "polite", "aria-relevant": "additions", onScroll: handleScroll, className: cn("flex flex-col gap-4 overflow-y-auto pt-6 pb-4", "[scrollbar-width:thin] [scrollbar-color:var(--color-border)_transparent]", "[&::-webkit-scrollbar]:w-1.5", "[&::-webkit-scrollbar-track]:bg-transparent", "[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border/40", className), children: _jsx(SandboxContext.Provider, { value: sandboxCtx, children: _jsx(FilePathContext.Provider, { value: filePathCtx, children: items.map((item) => {
|
|
162
|
+
switch (item.kind) {
|
|
163
|
+
case "message":
|
|
164
|
+
return _jsx(MessageEntry, { message: item.message }, item.key);
|
|
165
|
+
case "tool-group":
|
|
166
|
+
return (_jsx(ToolCallGroup, { toolCalls: item.toolCalls, subAgentExecutions: item.subAgentExecutions, formatSummary: formatToolCallSummary, className: "mx-4" }, item.key));
|
|
167
|
+
case "phase-badge":
|
|
168
|
+
return (_jsx("div", { className: "flex justify-center py-3", children: _jsx(ExecutionPhaseBadge, { phase: item.phase }) }, item.key));
|
|
169
|
+
case "approval-request":
|
|
170
|
+
return (_jsx(ApprovalCard, { pendingApproval: item.pendingApproval, onSubmit: (action, comment) => onApprovalSubmit(item.pendingApproval.toolCallId, action, comment), isSubmitting: submittingApprovalIds?.has(item.pendingApproval.toolCallId) ?? false, className: "mx-4" }, item.key));
|
|
171
|
+
case "setup-progress":
|
|
172
|
+
return (_jsx(SetupProgress, { workspaceEntries: item.workspaceEntries }, item.key));
|
|
173
|
+
case "pending-message":
|
|
174
|
+
return (_jsx("div", { role: "article", "aria-label": "Sending message", className: "ms-[20%] rounded-lg bg-muted/50 px-4 py-3 opacity-70", children: _jsx("p", { className: "text-sm text-foreground whitespace-pre-wrap", children: item.content }) }, item.key));
|
|
175
|
+
}
|
|
176
|
+
}) }) }) }));
|
|
175
177
|
}
|
|
176
178
|
//# sourceMappingURL=MessageThread.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageThread.js","sourceRoot":"","sources":["../../src/execution/MessageThread.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iEAAiE,CAAC;AAGrG,OAAO,EAEL,cAAc,EACd,WAAW,GACZ,MAAM,8DAA8D,CAAC;AAEtE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAA6B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageThread.js","sourceRoot":"","sources":["../../src/execution/MessageThread.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iEAAiE,CAAC;AAGrG,OAAO,EAEL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IADlC,IAAI,CAAC,GAAG,CAEb,CACH,CAAC;wBACJ,KAAK,iBAAiB;4BACpB,OAAO,CACL,cAEE,IAAI,EAAC,SAAS,gBACH,iBAAiB,EAC5B,SAAS,EAAC,sDAAsD,YAEhE,YAAG,SAAS,EAAC,6CAA6C,YACvD,IAAI,CAAC,OAAO,GACX,IAPC,IAAI,CAAC,GAAG,CAQT,CACP,CAAC;oBACN,CAAC;gBACH,CAAC,CAAC,GACuB,GACD,GACtB,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context value that carries the sandbox workspace root for display-time
|
|
3
|
+
* path normalization.
|
|
4
|
+
*
|
|
5
|
+
* Provided by {@link MessageThread} (or a platform builder's custom
|
|
6
|
+
* wrapper). When no provider is present, path normalization is a no-op.
|
|
7
|
+
*/
|
|
8
|
+
export interface SandboxContextValue {
|
|
9
|
+
/**
|
|
10
|
+
* Absolute sandbox workspace root (e.g. `/home/daytona/workspace`).
|
|
11
|
+
* Empty string disables normalization (local mode, backward compat).
|
|
12
|
+
*/
|
|
13
|
+
readonly sandboxWorkspaceRoot: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const SandboxContext: import("react").Context<SandboxContextValue>;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a stable normalizer function that replaces absolute sandbox
|
|
18
|
+
* paths in the given text with workspace-relative display paths.
|
|
19
|
+
*
|
|
20
|
+
* When `sandboxWorkspaceRoot` is empty (no provider or local mode),
|
|
21
|
+
* returns the identity function — zero overhead.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* function ShellCommand({ command }: { command: string }) {
|
|
26
|
+
* const normalize = useSandboxNormalize();
|
|
27
|
+
* return <code>{normalize(command)}</code>;
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useSandboxNormalize(): (text: string) => string;
|
|
32
|
+
//# sourceMappingURL=SandboxContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SandboxContext.d.ts","sourceRoot":"","sources":["../../src/execution/SandboxContext.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC;AAMD,eAAO,MAAM,cAAc,8CACwB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAM9D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createContext, useCallback, useContext } from "react";
|
|
2
|
+
import { normalizeSandboxPaths } from "./sandbox-path-normalizer";
|
|
3
|
+
const DEFAULT_VALUE = {
|
|
4
|
+
sandboxWorkspaceRoot: "",
|
|
5
|
+
};
|
|
6
|
+
export const SandboxContext = createContext(DEFAULT_VALUE);
|
|
7
|
+
/**
|
|
8
|
+
* Returns a stable normalizer function that replaces absolute sandbox
|
|
9
|
+
* paths in the given text with workspace-relative display paths.
|
|
10
|
+
*
|
|
11
|
+
* When `sandboxWorkspaceRoot` is empty (no provider or local mode),
|
|
12
|
+
* returns the identity function — zero overhead.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* function ShellCommand({ command }: { command: string }) {
|
|
17
|
+
* const normalize = useSandboxNormalize();
|
|
18
|
+
* return <code>{normalize(command)}</code>;
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function useSandboxNormalize() {
|
|
23
|
+
const { sandboxWorkspaceRoot } = useContext(SandboxContext);
|
|
24
|
+
return useCallback((text) => normalizeSandboxPaths(text, sandboxWorkspaceRoot), [sandboxWorkspaceRoot]);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=SandboxContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SandboxContext.js","sourceRoot":"","sources":["../../src/execution/SandboxContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAiBlE,MAAM,aAAa,GAAwB;IACzC,oBAAoB,EAAE,EAAE;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GACzB,aAAa,CAAsB,aAAa,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,EAAE,oBAAoB,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC5D,OAAO,WAAW,CAChB,CAAC,IAAY,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,oBAAoB,CAAC,EACnE,CAAC,oBAAoB,CAAC,CACvB,CAAC;AACJ,CAAC"}
|