@@ -233,6 +245,7 @@ export function ToolCallPart({ part, onFileClick, onChildSessionClick }: ToolCal
✓
$
{command}
+ {sandboxIndicator}
{part.state.status === 'completed' && part.state.time && (
{((part.state.time.end - part.state.time.start) / 1000).toFixed(2)}s
@@ -274,6 +287,7 @@ export function ToolCallPart({ part, onFileClick, onChildSessionClick }: ToolCal
>
{getStatusIcon()}
{part.tool}
+ {sandboxIndicator}
{previewText && isFileTool ? (
Command:
@@ -363,12 +377,12 @@ export function ToolCallPart({ part, onFileClick, onChildSessionClick }: ToolCal
- $ {typeof part.state.input?.command === 'string' ? part.state.input.command : ''}
+ $ {displayCommand ?? ''}
) : (
diff --git a/shared/src/utils/index.ts b/shared/src/utils/index.ts
index adcbed0e..6e4c1fd7 100644
--- a/shared/src/utils/index.ts
+++ b/shared/src/utils/index.ts
@@ -1,2 +1,3 @@
export * from './jsonc'
export * from './repo'
+export * from './sandbox-command'
diff --git a/shared/src/utils/sandbox-command.ts b/shared/src/utils/sandbox-command.ts
new file mode 100644
index 00000000..453d4bda
--- /dev/null
+++ b/shared/src/utils/sandbox-command.ts
@@ -0,0 +1,8 @@
+const SANDBOX_EXEC_WRAPPER_PATTERN = /^'(?:[^']|'\\'')*' exec [A-Za-z0-9_-]+ --no-tty -q -u '(?:[^']|'\\'')*' -w '(?:[^']|'\\'')*' --timeout \d+s -- sh -c '((?:[^']|'\\'')*)'$/
+const SINGLE_QUOTE_ESCAPE_PATTERN = /'\\''/g
+
+export function unwrapSandboxExecCommand(command: string): string {
+ const match = SANDBOX_EXEC_WRAPPER_PATTERN.exec(command)
+ if (match === null) return command
+ return match[1]!.replace(SINGLE_QUOTE_ESCAPE_PATTERN, "'")
+}