mixdog 0.8.1 → 0.9.0
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 +47 -23
- package/package.json +33 -27
- package/scripts/_test-folder-dialog.mjs +30 -0
- package/scripts/agent-parallel-smoke.mjs +388 -0
- package/scripts/agent-tag-reuse-smoke.mjs +183 -0
- package/scripts/background-task-meta-smoke.mjs +38 -0
- package/scripts/boot-smoke.mjs +52 -9
- package/scripts/build-runtime-linux.sh +348 -0
- package/scripts/build-runtime-macos.sh +217 -0
- package/scripts/build-runtime-windows.ps1 +242 -0
- package/scripts/compact-active-turn-test.mjs +68 -0
- package/scripts/compact-smoke.mjs +859 -129
- package/scripts/compact-trigger-migration-smoke.mjs +187 -0
- package/scripts/fix-brief-fn.mjs +35 -0
- package/scripts/fix-format-tool-surface.mjs +24 -0
- package/scripts/fix-tool-exec-visible.mjs +42 -0
- package/scripts/generate-runtime-manifest.mjs +166 -0
- package/scripts/hook-bus-test.mjs +330 -0
- package/scripts/lead-workflow-smoke.mjs +33 -39
- package/scripts/live-worker-smoke.mjs +43 -37
- package/scripts/llm-trace-summary.mjs +315 -0
- package/scripts/memory-meta-concurrency-test.mjs +20 -0
- package/scripts/output-style-smoke.mjs +56 -15
- package/scripts/parent-abort-link-test.mjs +44 -0
- package/scripts/patch-agent-brief.mjs +48 -0
- package/scripts/patch-app.mjs +21 -0
- package/scripts/patch-app2.mjs +18 -0
- package/scripts/patch-dist-brief.mjs +96 -0
- package/scripts/patch-tool-exec.mjs +70 -0
- package/scripts/pretool-ask-runtime-test.mjs +54 -0
- package/scripts/provider-toolcall-test.mjs +376 -0
- package/scripts/reactive-compact-persist-smoke.mjs +124 -0
- package/scripts/sanitize-tool-pairs-test.mjs +260 -0
- package/scripts/session-context-bench.mjs +205 -33
- package/scripts/session-ingest-smoke.mjs +177 -0
- package/scripts/set-effort-config-test.mjs +41 -0
- package/scripts/smoke-runtime-negative.ps1 +106 -0
- package/scripts/smoke-runtime-negative.sh +97 -0
- package/scripts/smoke.mjs +25 -0
- package/scripts/tool-result-hook-test.mjs +48 -0
- package/scripts/tool-smoke.mjs +1222 -90
- package/scripts/toolcall-args-test.mjs +150 -0
- package/scripts/tui-background-failure-smoke.mjs +73 -0
- package/scripts/usage-metrics-epoch-smoke.mjs +114 -0
- package/src/agents/debugger/AGENT.md +8 -0
- package/src/agents/explore/AGENT.md +4 -0
- package/src/agents/heavy-worker/AGENT.md +9 -3
- package/src/agents/maintainer/AGENT.md +4 -0
- package/src/agents/reviewer/AGENT.md +8 -0
- package/src/agents/scheduler-task/AGENT.md +12 -0
- package/src/agents/scheduler-task/agent.json +6 -0
- package/src/agents/webhook-handler/AGENT.md +12 -0
- package/src/agents/webhook-handler/agent.json +6 -0
- package/src/agents/worker/AGENT.md +9 -3
- package/src/app.mjs +77 -3
- package/src/defaults/hidden-roles.json +17 -12
- package/src/headless-role.mjs +117 -0
- package/src/help.mjs +30 -0
- package/src/hooks/lib/permission-evaluator.cjs +11 -475
- package/src/lib/keychain-cjs.cjs +9 -1
- package/src/lib/mixdog-debug.cjs +0 -7
- package/src/lib/rules-builder.cjs +240 -96
- package/src/lib/text-utils.cjs +1 -1
- package/src/mixdog-session-runtime.mjs +2212 -446
- package/src/output-styles/default.md +12 -28
- package/src/output-styles/extreme-simple.md +9 -6
- package/src/output-styles/simple.md +22 -9
- package/src/repl.mjs +110 -59
- package/src/rules/agent/00-common.md +15 -0
- package/src/rules/{bridge → agent}/20-skip-protocol.md +1 -2
- package/src/rules/agent/30-explorer.md +22 -0
- package/src/rules/{bridge → agent}/40-cycle1-agent.md +7 -0
- package/src/rules/{bridge → agent}/41-cycle2-agent.md +7 -0
- package/src/rules/{bridge → agent}/42-cycle3-agent.md +7 -0
- package/src/rules/lead/01-general.md +9 -5
- package/src/rules/lead/04-workflow.md +51 -12
- package/src/rules/lead/lead-tool.md +6 -0
- package/src/rules/shared/01-tool.md +12 -1
- package/src/runtime/agent/orchestrator/activity-bus.mjs +7 -18
- package/src/runtime/agent/orchestrator/agent-owner.mjs +11 -0
- package/src/runtime/agent/orchestrator/{smart-bridge/bridge-llm.mjs → agent-runtime/agent-dispatch.mjs} +138 -111
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +94 -0
- package/src/runtime/agent/orchestrator/{smart-bridge → agent-runtime}/cache-strategy.mjs +32 -23
- package/src/runtime/agent/orchestrator/{smart-bridge → agent-runtime}/session-builder.mjs +33 -27
- package/src/runtime/agent/orchestrator/{bridge-trace.mjs → agent-trace.mjs} +132 -81
- package/src/runtime/agent/orchestrator/cache-mtime.mjs +0 -21
- package/src/runtime/agent/orchestrator/config.mjs +174 -55
- package/src/runtime/agent/orchestrator/context/collect.mjs +195 -487
- package/src/runtime/agent/orchestrator/dispatch-persist.mjs +1 -1
- package/src/runtime/agent/orchestrator/internal-roles.mjs +76 -28
- package/src/runtime/agent/orchestrator/internal-tools.mjs +5 -6
- package/src/runtime/agent/orchestrator/mcp/client.mjs +15 -9
- package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +7 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +377 -243
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +146 -93
- package/src/runtime/agent/orchestrator/providers/api-usage.mjs +236 -4
- package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +49 -0
- package/src/runtime/agent/orchestrator/providers/gemini.mjs +58 -13
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +67 -149
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +132 -2
- package/src/runtime/agent/orchestrator/providers/model-catalog.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +45 -0
- package/src/runtime/agent/orchestrator/providers/oauth-usage.mjs +61 -116
- package/src/runtime/agent/orchestrator/providers/openai-compat-presets.mjs +25 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +79 -255
- package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +221 -70
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +477 -147
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +343 -496
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/registry.mjs +88 -51
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +31 -11
- package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +41 -8
- package/src/runtime/agent/orchestrator/session/compact.mjs +1173 -267
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +199 -36
- package/src/runtime/agent/orchestrator/session/loop.mjs +840 -612
- package/src/runtime/agent/orchestrator/session/manager.mjs +1574 -459
- package/src/runtime/agent/orchestrator/session/manager.reactive-persist.test.mjs +107 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +67 -29
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +2 -2
- package/src/runtime/agent/orchestrator/stall-policy.mjs +31 -16
- package/src/runtime/agent/orchestrator/tool-loop-guard.mjs +3 -219
- package/src/runtime/agent/orchestrator/tools/bash-session.mjs +34 -7
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +19 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +9 -9
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +60 -37
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +21 -2
- package/src/runtime/agent/orchestrator/tools/builtin/device-paths.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/diagnostics-tool.mjs +0 -7
- package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +1 -3
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +36 -12
- package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +2 -0
- package/src/runtime/agent/orchestrator/tools/builtin/read-constants.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +5 -12
- package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-tool.mjs +4 -36
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +2 -40
- package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +148 -27
- package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +43 -75
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +90 -20
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +59 -5
- package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +86 -0
- package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +11 -11
- package/src/runtime/agent/orchestrator/tools/code-graph.mjs +4106 -4019
- package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +33 -4
- package/src/runtime/agent/orchestrator/tools/patch.mjs +90 -6
- package/src/runtime/agent/orchestrator/tools/progress-message.mjs +6 -4
- package/src/runtime/agent/orchestrator/tools/result-compression.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +8 -1
- package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +4 -4
- package/src/runtime/channels/index.mjs +152 -24
- package/src/runtime/channels/lib/scheduler.mjs +18 -14
- package/src/runtime/channels/lib/session-discovery.mjs +3 -2
- package/src/runtime/channels/lib/transcript-discovery.mjs +3 -2
- package/src/runtime/channels/lib/webhook.mjs +1 -1
- package/src/runtime/channels/tool-defs.mjs +29 -29
- package/src/runtime/memory/index.mjs +520 -98
- package/src/runtime/memory/lib/agent-ipc.mjs +29 -12
- package/src/runtime/memory/lib/core-memory-store.mjs +2 -2
- package/src/runtime/memory/lib/embedding-model-config.mjs +55 -0
- package/src/runtime/memory/lib/embedding-provider.mjs +31 -4
- package/src/runtime/memory/lib/embedding-worker.mjs +19 -10
- package/src/runtime/memory/lib/memory-cycle1.mjs +28 -7
- package/src/runtime/memory/lib/memory-cycle2.mjs +4 -5
- package/src/runtime/memory/lib/memory-cycle3.mjs +2 -2
- package/src/runtime/memory/lib/memory-ops-policy.mjs +2 -1
- package/src/runtime/memory/lib/memory-session-merge.mjs +38 -0
- package/src/runtime/memory/lib/memory.mjs +88 -9
- package/src/runtime/memory/lib/model-profile.mjs +1 -1
- package/src/runtime/memory/lib/pg/adapter.mjs +1 -1
- package/src/runtime/memory/lib/pg/supervisor.mjs +12 -0
- package/src/runtime/memory/lib/runtime-fetcher.mjs +37 -3
- package/src/runtime/memory/lib/session-ingest.mjs +194 -0
- package/src/runtime/memory/lib/trace-store.mjs +96 -51
- package/src/runtime/memory/tool-defs.mjs +46 -37
- package/src/runtime/search/index.mjs +102 -466
- package/src/runtime/search/lib/web-tools.mjs +45 -25
- package/src/runtime/search/tool-defs.mjs +16 -23
- package/src/runtime/shared/abort-controller.mjs +1 -1
- package/src/runtime/shared/atomic-file.mjs +4 -3
- package/src/runtime/shared/background-tasks.mjs +122 -11
- package/src/runtime/shared/child-spawn-gate.mjs +145 -0
- package/src/runtime/shared/config.mjs +7 -4
- package/src/runtime/shared/err-text.mjs +131 -4
- package/src/runtime/shared/llm/cost.mjs +2 -2
- package/src/runtime/shared/llm/http-agent.mjs +23 -7
- package/src/runtime/shared/llm/index.mjs +34 -11
- package/src/runtime/shared/llm/usage-log.mjs +4 -4
- package/src/runtime/shared/markdown-frontmatter.mjs +56 -0
- package/src/runtime/shared/singleton-owner.mjs +104 -0
- package/src/runtime/shared/tool-execution-contract.mjs +199 -20
- package/src/runtime/shared/tool-execution-contract.test.mjs +183 -0
- package/src/runtime/shared/tool-surface.mjs +624 -95
- package/src/runtime/shared/user-data-guard.mjs +0 -2
- package/src/standalone/agent-task-status.mjs +203 -0
- package/src/standalone/agent-task-status.test.mjs +76 -0
- package/src/standalone/agent-tool.mjs +1913 -0
- package/src/standalone/channel-worker.mjs +370 -14
- package/src/standalone/explore-tool.mjs +165 -70
- package/src/standalone/folder-dialog.mjs +314 -0
- package/src/standalone/hook-bus.mjs +898 -22
- package/src/standalone/memory-runtime-proxy.mjs +320 -0
- package/src/standalone/projects.mjs +226 -0
- package/src/standalone/provider-admin.mjs +41 -24
- package/src/standalone/seeds.mjs +2 -69
- package/src/standalone/usage-dashboard.mjs +96 -8
- package/src/tui/App.jsx +4788 -2151
- package/src/tui/components/AnsiText.jsx +39 -28
- package/src/tui/components/ContextPanel.jsx +14 -4
- package/src/tui/components/Markdown.jsx +43 -77
- package/src/tui/components/MarkdownTable.jsx +9 -184
- package/src/tui/components/Message.jsx +28 -11
- package/src/tui/components/Picker.jsx +95 -56
- package/src/tui/components/PromptInput.jsx +367 -239
- package/src/tui/components/QueuedCommands.jsx +1 -1
- package/src/tui/components/SlashCommandPalette.jsx +27 -21
- package/src/tui/components/Spinner.jsx +67 -38
- package/src/tui/components/StatusLine.jsx +606 -38
- package/src/tui/components/TextEntryPanel.jsx +128 -9
- package/src/tui/components/ToolExecution.jsx +592 -362
- package/src/tui/components/TurnDone.jsx +3 -3
- package/src/tui/components/UsagePanel.jsx +3 -5
- package/src/tui/components/tool-output-format.mjs +365 -0
- package/src/tui/components/tool-output-format.test.mjs +220 -0
- package/src/tui/dist/index.mjs +8826 -2390
- package/src/tui/engine-runtime-notification.test.mjs +115 -0
- package/src/tui/engine-tool-result-text.test.mjs +75 -0
- package/src/tui/engine.mjs +1455 -279
- package/src/tui/figures.mjs +21 -40
- package/src/tui/index.jsx +75 -31
- package/src/tui/input-editing.mjs +25 -0
- package/src/tui/markdown/format-token.mjs +511 -68
- package/src/tui/markdown/format-token.test.mjs +216 -0
- package/src/tui/markdown/render-ansi.mjs +94 -0
- package/src/tui/markdown/render-ansi.test.mjs +108 -0
- package/src/tui/markdown/stream-fence.mjs +34 -0
- package/src/tui/markdown/stream-fence.test.mjs +26 -0
- package/src/tui/markdown/table-layout.mjs +250 -0
- package/src/tui/paste-attachments.mjs +0 -7
- package/src/tui/spinner-verbs.mjs +1 -2
- package/src/tui/statusline-ansi-bridge.mjs +172 -0
- package/src/tui/statusline-ansi-bridge.test.mjs +159 -0
- package/src/tui/theme.mjs +746 -24
- package/src/tui/time-format.mjs +1 -1
- package/src/tui/transcript-tool-failures.mjs +67 -0
- package/src/tui/transcript-tool-failures.test.mjs +111 -0
- package/src/ui/ansi.mjs +1 -2
- package/src/ui/markdown.mjs +85 -26
- package/src/ui/markdown.test.mjs +70 -0
- package/src/ui/model-display.mjs +121 -0
- package/src/ui/session-stats.mjs +44 -0
- package/src/ui/statusline-context-label.test.mjs +15 -0
- package/src/ui/statusline.mjs +386 -178
- package/src/ui/tool-card.mjs +2 -13
- package/src/vendor/statusline/bin/statusline-lib.mjs +8 -4
- package/src/vendor/statusline/bin/statusline-route.mjs +169 -37
- package/src/vendor/statusline/bin/statusline-route.test.mjs +80 -0
- package/src/vendor/statusline/scripts/lib/gateway-settings.mjs +3 -3
- package/src/vendor/statusline/src/gateway/claude-current.mjs +1 -1
- package/src/vendor/statusline/src/gateway/route-meta.mjs +44 -6
- package/src/vendor/statusline/src/gateway/session-routes.mjs +1 -1
- package/src/workflows/default/WORKFLOW.md +12 -5
- package/src/workflows/default/workflow.json +0 -1
- package/src/workflows/solo/WORKFLOW.md +15 -0
- package/src/workflows/solo/workflow.json +7 -0
- package/vendor/ink/build/output.js +6 -1
- package/src/agents/scheduler-task.md +0 -3
- package/src/agents/web-researcher/AGENT.md +0 -3
- package/src/agents/web-researcher/agent.json +0 -6
- package/src/agents/webhook-handler.md +0 -3
- package/src/rules/bridge/00-common.md +0 -5
- package/src/rules/bridge/30-explorer.md +0 -4
- package/src/rules/lead/00-tool-lead.md +0 -5
- package/src/rules/shared/00-language.md +0 -3
- package/src/runtime/agent/orchestrator/tools/builtin/native-edit-runner.mjs +0 -110
- package/src/runtime/agent/orchestrator/tools/mutation-content-cache.mjs +0 -67
- package/src/runtime/memory/lib/bridge-trace-queries.mjs +0 -120
- package/src/runtime/shared/llm/pid-cleanup.mjs +0 -27
- package/src/standalone/bridge-tool.mjs +0 -1414
- package/src/tui/runtime/shared/process-shutdown.mjs +0 -1
|
@@ -1,199 +1,63 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* components/ToolExecution.jsx — a tool call + its result.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* components/ToolExecution.jsx — a tool call + its result.
|
|
3
|
+
*
|
|
4
|
+
* Tool call + result layout:
|
|
5
5
|
* - The call line: `● Tool Name(summary)` where the dot is BLACK_CIRCLE
|
|
6
6
|
* (2-wide gutter), the tool name is the user-facing label and the argument
|
|
7
7
|
* summary sits in muted parentheses. NOT raw MCP/internal names.
|
|
8
|
-
* - The result hangs under a single dim ` ⎿ ` gutter — the gutter is placed
|
|
9
|
-
* once, not repeated per wrapped line
|
|
10
|
-
*/
|
|
11
|
-
import React, { useEffect,
|
|
8
|
+
* - The result hangs under a single dim ` ⎿ ` gutter — the gutter is placed
|
|
9
|
+
* once, not repeated per wrapped line.
|
|
10
|
+
*/
|
|
11
|
+
import React, { useEffect, useState } from 'react';
|
|
12
12
|
import { Box, Text } from 'ink';
|
|
13
13
|
import stringWidth from 'string-width';
|
|
14
|
-
import { theme, TURN_MARKER, RESULT_GUTTER } from '../theme.mjs';
|
|
14
|
+
import { theme, TURN_MARKER, RESULT_GUTTER, RESULT_GUTTER_CONT } from '../theme.mjs';
|
|
15
15
|
import { formatElapsed } from '../time-format.mjs';
|
|
16
16
|
import { BULLET_OPERATOR } from '../figures.mjs';
|
|
17
17
|
import {
|
|
18
18
|
displayToolName as surfaceDisplayToolName,
|
|
19
19
|
formatToolSurface,
|
|
20
|
-
summarizeToolArgs as surfaceSummarizeToolArgs,
|
|
21
20
|
summarizeToolResult as surfaceSummarizeToolResult,
|
|
22
21
|
formatAggregateHeader,
|
|
22
|
+
formatToolActionHeader,
|
|
23
|
+
displayModelName,
|
|
24
|
+
summarizeAgentSurfaceBrief,
|
|
25
|
+
AGENT_SURFACE_BRIEF_MAX,
|
|
23
26
|
} from '../../runtime/shared/tool-surface.mjs';
|
|
27
|
+
import { backgroundTaskFailureStatusLabel, isBackgroundErrorOnlyBody } from '../../runtime/shared/err-text.mjs';
|
|
28
|
+
import { formatExpandedResult, wrapExpandedResultLines } from './tool-output-format.mjs';
|
|
24
29
|
|
|
25
30
|
const MIN_RESULT_LINE_CHARS = 24;
|
|
26
31
|
// Hard cap for the parenthesized header arg summary so a long path/query does
|
|
27
32
|
// not eat the whole header line; anything longer is truncated with an ellipsis.
|
|
28
33
|
const SUMMARY_MAX_CHARS = 48;
|
|
34
|
+
const HEADER_FAILURE_STATUS_MAX = 32;
|
|
29
35
|
|
|
30
36
|
export function displayToolName(name, args) {
|
|
31
37
|
return surfaceDisplayToolName(name, args);
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
/** Claude Code-style one-line renderToolUseMessage summary. */
|
|
35
|
-
export function summarizeArgs(name, args) {
|
|
36
|
-
return surfaceSummarizeToolArgs(name, args);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const MAX_RESULT_LINES = 8;
|
|
40
40
|
const TOOL_BLINK_MS = 500;
|
|
41
41
|
const TOOL_BLINK_LIMIT_MS = 3000;
|
|
42
42
|
const TOOL_PENDING_SHOW_DELAY_MS = 1000;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const COUNT_TWEEN_FRAME_MS = 70;
|
|
43
|
+
// Read `theme.subtle` at use-time (not captured here) so a live `/theme`
|
|
44
|
+
// switch re-tones the tool hints. `theme` is mutated in-place on switch.
|
|
46
45
|
|
|
47
46
|
function normalizeCount(value) {
|
|
48
47
|
const n = Number(value || 0);
|
|
49
48
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n)) : 0;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
function baselineCount(value) {
|
|
53
|
-
return normalizeCount(value) > 0 ? 1 : 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function easeOutCubic(t) {
|
|
57
|
-
const clamped = Math.max(0, Math.min(1, Number(t) || 0));
|
|
58
|
-
return 1 - Math.pow(1 - clamped, 3);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function tweenCount(from, to, progress) {
|
|
62
|
-
const start = normalizeCount(from);
|
|
63
|
-
const end = normalizeCount(to);
|
|
64
|
-
if (end <= start) return end;
|
|
65
|
-
const clamped = Math.max(0, Math.min(1, Number(progress) || 0));
|
|
66
|
-
if (clamped >= 1) return end;
|
|
67
|
-
return Math.min(end - 1, Math.max(start, Math.floor(start + ((end - start) * easeOutCubic(clamped)))));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function useCountUp(target, enabled = true) {
|
|
71
|
-
const normalized = normalizeCount(target);
|
|
72
|
-
const initial = enabled ? normalized : baselineCount(normalized);
|
|
73
|
-
const [display, setDisplay] = useState(initial);
|
|
74
|
-
const displayRef = useRef(initial);
|
|
75
|
-
const timerRef = useRef(null);
|
|
76
|
-
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
if (timerRef.current) {
|
|
79
|
-
clearInterval(timerRef.current);
|
|
80
|
-
timerRef.current = null;
|
|
81
|
-
}
|
|
82
|
-
if (!enabled) {
|
|
83
|
-
const baseline = baselineCount(normalized);
|
|
84
|
-
displayRef.current = baseline;
|
|
85
|
-
setDisplay(baseline);
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
const from = normalizeCount(displayRef.current);
|
|
89
|
-
const to = normalized;
|
|
90
|
-
if (to <= from) {
|
|
91
|
-
displayRef.current = to;
|
|
92
|
-
setDisplay(to);
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
const started = Date.now();
|
|
96
|
-
const tick = () => {
|
|
97
|
-
const progress = Math.min(1, (Date.now() - started) / COUNT_TWEEN_MS);
|
|
98
|
-
const next = tweenCount(from, to, progress);
|
|
99
|
-
displayRef.current = next;
|
|
100
|
-
setDisplay(next);
|
|
101
|
-
if (progress >= 1 && timerRef.current) {
|
|
102
|
-
clearInterval(timerRef.current);
|
|
103
|
-
timerRef.current = null;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
displayRef.current = from;
|
|
107
|
-
setDisplay(from);
|
|
108
|
-
const timer = setInterval(tick, COUNT_TWEEN_FRAME_MS);
|
|
109
|
-
timerRef.current = timer;
|
|
110
|
-
timer.unref?.();
|
|
111
|
-
return () => {
|
|
112
|
-
clearInterval(timer);
|
|
113
|
-
if (timerRef.current === timer) timerRef.current = null;
|
|
114
|
-
};
|
|
115
|
-
}, [normalized, enabled]);
|
|
116
|
-
|
|
117
|
-
return display;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
51
|
function normalizeCountMap(value = {}) {
|
|
121
52
|
const out = {};
|
|
122
|
-
for (const [key, raw] of Object.entries(value || {}))
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const out = {};
|
|
128
|
-
for (const [key, raw] of Object.entries(value || {})) out[key] = baselineCount(raw);
|
|
129
|
-
return out;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function countMapSignature(value = {}) {
|
|
133
|
-
return Object.keys(value || {})
|
|
134
|
-
.sort()
|
|
135
|
-
.map((key) => `${key}:${normalizeCount(value[key])}`)
|
|
136
|
-
.join('|');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function useCountUpMap(targets = {}, enabled = true) {
|
|
140
|
-
const normalizedTargets = normalizeCountMap(targets);
|
|
141
|
-
const signature = countMapSignature(normalizedTargets);
|
|
142
|
-
const initial = enabled ? normalizedTargets : baselineCountMap(normalizedTargets);
|
|
143
|
-
const [display, setDisplay] = useState(initial);
|
|
144
|
-
const displayRef = useRef(initial);
|
|
145
|
-
const timerRef = useRef(null);
|
|
146
|
-
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
if (timerRef.current) {
|
|
149
|
-
clearInterval(timerRef.current);
|
|
150
|
-
timerRef.current = null;
|
|
151
|
-
}
|
|
152
|
-
if (!enabled) {
|
|
153
|
-
const baseline = baselineCountMap(normalizedTargets);
|
|
154
|
-
displayRef.current = baseline;
|
|
155
|
-
setDisplay(baseline);
|
|
156
|
-
return undefined;
|
|
157
|
-
}
|
|
158
|
-
const from = {};
|
|
159
|
-
let needsTween = false;
|
|
160
|
-
for (const [key, to] of Object.entries(normalizedTargets)) {
|
|
161
|
-
const current = normalizeCount(displayRef.current?.[key]);
|
|
162
|
-
from[key] = current;
|
|
163
|
-
if (to > current) needsTween = true;
|
|
164
|
-
}
|
|
165
|
-
if (!needsTween) {
|
|
166
|
-
displayRef.current = normalizedTargets;
|
|
167
|
-
setDisplay(normalizedTargets);
|
|
168
|
-
return undefined;
|
|
53
|
+
for (const [key, raw] of Object.entries(value || {})) {
|
|
54
|
+
if (raw && typeof raw === 'object') {
|
|
55
|
+
out[key] = { ...raw, count: normalizeCount(raw.count) };
|
|
56
|
+
} else {
|
|
57
|
+
out[key] = normalizeCount(raw);
|
|
169
58
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const progress = Math.min(1, (Date.now() - started) / COUNT_TWEEN_MS);
|
|
173
|
-
const next = {};
|
|
174
|
-
for (const [key, to] of Object.entries(normalizedTargets)) {
|
|
175
|
-
const start = normalizeCount(from[key]);
|
|
176
|
-
next[key] = tweenCount(start, to, progress);
|
|
177
|
-
}
|
|
178
|
-
displayRef.current = next;
|
|
179
|
-
setDisplay(next);
|
|
180
|
-
if (progress >= 1 && timerRef.current) {
|
|
181
|
-
clearInterval(timerRef.current);
|
|
182
|
-
timerRef.current = null;
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
displayRef.current = from;
|
|
186
|
-
setDisplay(from);
|
|
187
|
-
const timer = setInterval(tick, COUNT_TWEEN_FRAME_MS);
|
|
188
|
-
timerRef.current = timer;
|
|
189
|
-
timer.unref?.();
|
|
190
|
-
return () => {
|
|
191
|
-
clearInterval(timer);
|
|
192
|
-
if (timerRef.current === timer) timerRef.current = null;
|
|
193
|
-
};
|
|
194
|
-
}, [signature, enabled]);
|
|
195
|
-
|
|
196
|
-
return display;
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
197
61
|
}
|
|
198
62
|
|
|
199
63
|
function deltaColor(token) {
|
|
@@ -225,89 +89,126 @@ function renderDeltaText(text) {
|
|
|
225
89
|
));
|
|
226
90
|
}
|
|
227
91
|
|
|
92
|
+
// Shared multi-line result body: `└` on the first row, `│` continuation rail on
|
|
93
|
+
// every following row, body text in one flex column so wrapping stays aligned
|
|
94
|
+
// under the head gutter.
|
|
95
|
+
//
|
|
96
|
+
// Two render paths:
|
|
97
|
+
// - COLLAPSED (raw=false): a single fitted summary line, diff(+/-) colored via
|
|
98
|
+
// renderDeltaText.
|
|
99
|
+
// - EXPANDED (raw=true): formatExpandedResult then wrapExpandedResultLines so
|
|
100
|
+
// each physical row fits the body width before render (rail rows stay 1:1;
|
|
101
|
+
// ink does not re-wrap).
|
|
102
|
+
function ResultBody({ lines, rawText, pathArg = '', isShell = false, columns, color, raw }) {
|
|
103
|
+
const renderLines = raw
|
|
104
|
+
? wrapExpandedResultLines(formatExpandedResult(rawText, { pathArg, isShell }), columns)
|
|
105
|
+
: (lines || []);
|
|
106
|
+
if (!renderLines || renderLines.length === 0) return null;
|
|
107
|
+
return (
|
|
108
|
+
<Box flexDirection="row">
|
|
109
|
+
<Box flexShrink={0} flexDirection="column">
|
|
110
|
+
{renderLines.map((_, i) => (
|
|
111
|
+
<Text key={i} color={theme.subtle}>{i === 0 ? RESULT_GUTTER : RESULT_GUTTER_CONT}</Text>
|
|
112
|
+
))}
|
|
113
|
+
</Box>
|
|
114
|
+
<Box flexDirection="column" flexShrink={1} flexGrow={1}>
|
|
115
|
+
{renderLines.map((line, i) => (
|
|
116
|
+
<Text key={i} color={raw ? undefined : color} wrap="truncate">
|
|
117
|
+
{raw
|
|
118
|
+
? (line || ' ')
|
|
119
|
+
: renderDeltaText(fitResultLine(line || ' ', columns))}
|
|
120
|
+
</Text>
|
|
121
|
+
))}
|
|
122
|
+
</Box>
|
|
123
|
+
</Box>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
228
127
|
function plural(count, singular, pluralText = `${singular}s`) {
|
|
229
128
|
return count === 1 ? singular : pluralText;
|
|
230
129
|
}
|
|
231
130
|
|
|
232
|
-
function
|
|
131
|
+
function isShellTool(normalizedName, label = '') {
|
|
233
132
|
const n = String(normalizedName || '').toLowerCase();
|
|
234
133
|
const l = String(label || '').toLowerCase();
|
|
134
|
+
return n === 'shell' || n === 'bash' || n === 'bash_session' || n === 'shell_command' || n === 'job_wait' || l === 'run';
|
|
135
|
+
}
|
|
235
136
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
};
|
|
137
|
+
function shellResultStatus(value) {
|
|
138
|
+
const match = String(value || '').match(/(?:^|\b)status:\s*(running|pending|queued|completed|failed|cancelled|canceled)\b/im);
|
|
139
|
+
return match ? String(match[1] || '').toLowerCase() : '';
|
|
140
|
+
}
|
|
241
141
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
142
|
+
function normalizeTerminalStatus(value) {
|
|
143
|
+
const raw = String(value || '').trim().toLowerCase();
|
|
144
|
+
if (!raw) return '';
|
|
145
|
+
if (/^(running|pending|queued|in_progress|in-progress)$/.test(raw)) return 'running';
|
|
146
|
+
if (/^(completed|complete|done|success|succeeded|ok)$/.test(raw)) return 'completed';
|
|
147
|
+
if (/^(failed|fail|error|errored|timeout|timed_out|killed)$/.test(raw)) return 'failed';
|
|
148
|
+
if (/^(cancelled|canceled|cancel)$/.test(raw)) return 'cancelled';
|
|
149
|
+
return '';
|
|
150
|
+
}
|
|
247
151
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
if (l === 'agent') return copyTarget('Calling', 'Called', 'agent');
|
|
303
|
-
return copy('Calling', 'Called', 'tool');
|
|
304
|
-
}
|
|
152
|
+
function displayTerminalStatus(value) {
|
|
153
|
+
const status = normalizeTerminalStatus(value);
|
|
154
|
+
if (status === 'running') return 'Running';
|
|
155
|
+
if (status === 'completed') return 'Finished';
|
|
156
|
+
if (status === 'failed') return 'Failed';
|
|
157
|
+
if (status === 'cancelled') return 'Cancelled';
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function resultTerminalStatus(value) {
|
|
162
|
+
const text = String(value || '');
|
|
163
|
+
const tagged = text.match(/<status[^>]*>([\s\S]*?)<\/status>/i)?.[1]?.trim();
|
|
164
|
+
if (tagged) return normalizeTerminalStatus(tagged);
|
|
165
|
+
const bracketed = text.match(/^\[status:\s*([^\]]*)\]/mi)?.[1]?.trim();
|
|
166
|
+
if (bracketed) return normalizeTerminalStatus(bracketed);
|
|
167
|
+
const inline = text.match(/^(?:status|state):\s*([^\s·,;]+)/mi)?.[1]?.trim();
|
|
168
|
+
return normalizeTerminalStatus(inline);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function shellDisplayStatus({ pending = false, failedCount = 0, isError = false, result = '' } = {}) {
|
|
172
|
+
const status = shellResultStatus(result);
|
|
173
|
+
if (pending || /^(running|pending|queued)$/.test(status)) return 'running';
|
|
174
|
+
if (/^cancel/.test(status)) return 'cancelled';
|
|
175
|
+
if (/^(failed|error|killed|timeout)$/.test(status) || isError || failedCount > 0) return 'failed';
|
|
176
|
+
return 'completed';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function shellHeader(status, count = 1) {
|
|
180
|
+
const n = Math.max(1, Number(count) || 1);
|
|
181
|
+
const object = `${n} ${plural(n, 'command')}`;
|
|
182
|
+
if (status === 'running') return `Running ${object}`;
|
|
183
|
+
return `Ran ${object}`;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function shellDetail(status, elapsed = '') {
|
|
187
|
+
const label = displayTerminalStatus(status) || status;
|
|
188
|
+
return elapsed ? `${elapsed} · ${label}` : label;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function shellResultElapsed(value) {
|
|
192
|
+
const match = String(value || '').match(/^\[elapsed:\s*(\d+)\s*ms\]/mi);
|
|
193
|
+
if (!match) return '';
|
|
194
|
+
const elapsedMs = Number(match[1]);
|
|
195
|
+
return Number.isFinite(elapsedMs) && elapsedMs >= 1000 ? formatElapsed(elapsedMs) : '';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function statusCopy(name, label, count, doneCount, pending, isError, args = {}) {
|
|
199
|
+
// No stableVerbWidth padding: it padded the done verb to the active ("-ing")
|
|
200
|
+
// width, which Ink trims at the line END (vendor output trimEnd) so it never
|
|
201
|
+
// stabilized the pending→done flip — it only left an UGLY mid-header gap
|
|
202
|
+
// ("Searched 1 pattern", "Read 1 file"). The header is wrap="truncate"
|
|
203
|
+
// behind a fixed gutter and the fullscreen full-clear repaints the row, so
|
|
204
|
+
// dropping the pad just normalizes the spacing.
|
|
205
|
+
return formatToolActionHeader(name, args, { pending, count });
|
|
305
206
|
}
|
|
306
207
|
|
|
307
208
|
function fitResultLine(line, columns) {
|
|
308
209
|
const max = Math.max(MIN_RESULT_LINE_CHARS, Number(columns || 80) - 7);
|
|
309
210
|
const text = String(line ?? '');
|
|
310
|
-
return text
|
|
211
|
+
return stringWidth(text) > max ? truncateToWidth(text, max) : text;
|
|
311
212
|
}
|
|
312
213
|
|
|
313
214
|
/** Trim text from the end (by display width) so it fits maxWidth, appending '…'. */
|
|
@@ -325,16 +226,19 @@ function truncateToWidth(text, maxWidth) {
|
|
|
325
226
|
}
|
|
326
227
|
|
|
327
228
|
function isAgentTool(normalizedName) {
|
|
328
|
-
return normalizedName === '
|
|
229
|
+
return normalizedName === 'agent';
|
|
329
230
|
}
|
|
330
231
|
|
|
232
|
+
const SKILL_SURFACE_NAMES = new Set([
|
|
233
|
+
'skill', 'skill_execute', 'skill_view', 'skills_list', 'use_skill',
|
|
234
|
+
]);
|
|
235
|
+
|
|
331
236
|
function isBackgroundTaskTool(normalizedName) {
|
|
332
237
|
return new Set(['explore', 'search', 'shell', 'bash', 'bash_session', 'shell_command', 'task']).has(String(normalizedName || '').toLowerCase());
|
|
333
238
|
}
|
|
334
239
|
|
|
335
240
|
const AGENT_DISPLAY_NAMES = new Map([
|
|
336
241
|
['explore', 'Explore'],
|
|
337
|
-
['web-researcher', 'Web Researcher'],
|
|
338
242
|
['maintainer', 'Maintainer'],
|
|
339
243
|
['worker', 'Worker'],
|
|
340
244
|
['heavy-worker', 'Heavy Worker'],
|
|
@@ -355,19 +259,60 @@ function titleizeAgentName(value) {
|
|
|
355
259
|
.join(' ');
|
|
356
260
|
}
|
|
357
261
|
|
|
262
|
+
function agentModelLabel(args) {
|
|
263
|
+
const a = args && typeof args === 'object' ? args : {};
|
|
264
|
+
const provider = String(a.provider || a.providerId || a.provider_id || '').trim();
|
|
265
|
+
const model = String(a.model || '').trim();
|
|
266
|
+
const displayHint = String(a.modelDisplay || a.model_display || a.displayModel || '').trim();
|
|
267
|
+
return displayModelName(model, provider, displayHint);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function withModel(label, args) {
|
|
271
|
+
const model = agentModelLabel(args);
|
|
272
|
+
return model ? `${label} (${model})` : label;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function agentTagLabel(args) {
|
|
276
|
+
// The real spawn tag (engine fills parsedArgs.tag from the envelope target).
|
|
277
|
+
// Never fall back to task_id — only the human-meaningful spawn tag belongs in
|
|
278
|
+
// the header parentheses.
|
|
279
|
+
return String(args?.tag || '').trim();
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function withModelAndTag(label, args) {
|
|
283
|
+
const model = agentModelLabel(args);
|
|
284
|
+
const tag = agentTagLabel(args);
|
|
285
|
+
const inner = [model, tag].filter(Boolean).join(', ');
|
|
286
|
+
return inner ? `${label} (${inner})` : label;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Append a role name to a base action word without leaving a trailing space
|
|
290
|
+
// when the role is unknown (no generic "Agent" fallback).
|
|
291
|
+
function joinActionRole(action, role) {
|
|
292
|
+
return role ? `${action} ${role}` : action;
|
|
293
|
+
}
|
|
294
|
+
|
|
358
295
|
function agentResponseTitle(args) {
|
|
359
296
|
const name = titleizeAgentName(args?.agent || args?.role || args?.subagent_type || args?.name || '');
|
|
360
|
-
|
|
297
|
+
// The agent role + model identify the responder; the response summary itself
|
|
298
|
+
// is hidden in the collapsed card (ctrl+o expand still shows the full body).
|
|
299
|
+
// No generic "Agent" fallback — render just "Response" when the role is empty.
|
|
300
|
+
return withModelAndTag(joinActionRole('Response', name), args);
|
|
361
301
|
}
|
|
362
302
|
|
|
363
303
|
function agentActionTitle(args) {
|
|
364
304
|
const name = titleizeAgentName(args?.agent || args?.role || args?.subagent_type || args?.name || '');
|
|
365
|
-
const agent = name || 'Agent';
|
|
366
305
|
const action = String(args?.type || args?.action || '').toLowerCase();
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (action === '
|
|
306
|
+
// Fixed action verbs regardless of running/completed status. No generic
|
|
307
|
+
// "Agent" fallback for the role: when the role is unknown render the action
|
|
308
|
+
// word alone ("Spawn") instead of "Spawn Agent".
|
|
309
|
+
if (action === 'spawn') return withModelAndTag(joinActionRole('Spawn', name), args);
|
|
310
|
+
if (action === 'send') return withModelAndTag(joinActionRole('Send', name), args);
|
|
311
|
+
if (action === 'list') return 'Agent status';
|
|
312
|
+
if (action === 'cancel') return withModelAndTag(joinActionRole('Cancel', name), args);
|
|
313
|
+
if (action === 'close') return withModelAndTag(joinActionRole('Close', name), args);
|
|
314
|
+
if (action === 'cleanup') return withModelAndTag(joinActionRole('Cleanup', name), args);
|
|
315
|
+
if (action === 'read' || action === 'status') return withModelAndTag(joinActionRole('Status', name), args);
|
|
371
316
|
return '';
|
|
372
317
|
}
|
|
373
318
|
|
|
@@ -376,15 +321,26 @@ function agentActionSummary(args, summary) {
|
|
|
376
321
|
if (!text) return '';
|
|
377
322
|
const name = titleizeAgentName(args?.agent || args?.role || args?.subagent_type || args?.name || '');
|
|
378
323
|
if (name && text === name) return '';
|
|
379
|
-
|
|
380
|
-
|
|
324
|
+
let rest = name && text.startsWith(`${name} · `) ? text.slice(name.length + 3).trim() : text;
|
|
325
|
+
// The role/model/tag surface summary ("Heavy Worker · Opus 4.8") is now folded
|
|
326
|
+
// into the header label itself ("Spawn Heavy Worker (Opus 4.8, tag)"), so drop
|
|
327
|
+
// the model and tag tokens from the parenthesized summary to avoid showing
|
|
328
|
+
// them twice.
|
|
329
|
+
const model = agentModelLabel(args);
|
|
330
|
+
if (model && rest === model) return '';
|
|
331
|
+
const tag = agentTagLabel(args);
|
|
332
|
+
if (tag && rest === tag) return '';
|
|
333
|
+
return rest;
|
|
381
334
|
}
|
|
382
335
|
|
|
383
336
|
function hasAgentResponseResult(value) {
|
|
384
337
|
const text = String(value || '').trim();
|
|
385
338
|
if (!text) return false;
|
|
339
|
+
if (/^(?:undefined|null)$/i.test(text)) return false;
|
|
386
340
|
if (/^status:\s*(?:running|pending|queued|completed|failed|cancelled|canceled)(?:\s*·\s*task_id:\s*\S+)?$/i.test(text)) return false;
|
|
387
|
-
const isBridgeEnvelope = /^(?:
|
|
341
|
+
const isBridgeEnvelope = /^(?:agent task:|background task\b|agent message queued\b|agent close:)/i.test(text)
|
|
342
|
+
|| /^(?:agents|tasks):\s*\d/i.test(text)
|
|
343
|
+
|| /^\(no agents or tasks\)$/i.test(text)
|
|
388
344
|
|| (/^task_id:\s*\S+/mi.test(text) && /^(?:surface|operation|status):\s*/mi.test(text));
|
|
389
345
|
if (!isBridgeEnvelope) return true;
|
|
390
346
|
let sawBlank = false;
|
|
@@ -394,10 +350,12 @@ function hasAgentResponseResult(value) {
|
|
|
394
350
|
sawBlank = true;
|
|
395
351
|
continue;
|
|
396
352
|
}
|
|
397
|
-
if (/^
|
|
353
|
+
if (/^agent result\b/i.test(trimmed)) continue;
|
|
354
|
+
if (/^(?:undefined|null)$/i.test(trimmed)) continue;
|
|
398
355
|
if (/^<\/?(?:final-answer|task-notification|task-id|tool-use-id|output-file|result|status|summary|usage|total_tokens|tool_uses|duration_ms|worktree|worktreePath|worktreeBranch)[^>]*>$/i.test(trimmed)) continue;
|
|
399
|
-
if (!sawBlank && /^(?:
|
|
400
|
-
if (!sawBlank && /^(?:
|
|
356
|
+
if (!sawBlank && /^(?:agent task|background task|agent message queued\b|agent close:|task_id|surface|operation|label|status|type|target|role|agent|preset|model|effort|fast|limits|started|finished|error|notification|queueDepth):?\s*/i.test(trimmed)) continue;
|
|
357
|
+
if (!sawBlank && /^(?:agents|tasks):\s*/i.test(trimmed)) continue;
|
|
358
|
+
if (/^\(no agents or tasks\)$/i.test(trimmed)) continue;
|
|
401
359
|
if (!sawBlank && /^-\s+\S+/i.test(trimmed)) continue;
|
|
402
360
|
return true;
|
|
403
361
|
}
|
|
@@ -420,17 +378,82 @@ function parseBackgroundTaskResult(value) {
|
|
|
420
378
|
if (match) fields[match[1].toLowerCase()] = match[2].trim();
|
|
421
379
|
}
|
|
422
380
|
const status = String(fields.status || '').toLowerCase();
|
|
381
|
+
const error = fields.error || '';
|
|
423
382
|
return {
|
|
424
383
|
taskId: fields.task_id || fields.taskid || '',
|
|
425
384
|
surface: fields.surface || '',
|
|
426
385
|
operation: fields.operation || '',
|
|
427
386
|
label: fields.label || '',
|
|
428
387
|
status,
|
|
388
|
+
startedAt: fields.started || fields.startedat || '',
|
|
389
|
+
finishedAt: fields.finished || fields.finishedat || '',
|
|
429
390
|
body,
|
|
430
|
-
|
|
391
|
+
error,
|
|
392
|
+
hasResponse: Boolean(body) && !isBackgroundErrorOnlyBody(body, error) && !/^(running|pending|queued)$/i.test(status),
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function backgroundTaskMetaFromArgs(args = {}) {
|
|
397
|
+
const taskId = String(args.task_id || args.taskId || '').trim();
|
|
398
|
+
if (!taskId) return null;
|
|
399
|
+
return {
|
|
400
|
+
taskId,
|
|
401
|
+
surface: args.surface || '',
|
|
402
|
+
operation: args.operation || '',
|
|
403
|
+
label: args.label || '',
|
|
404
|
+
status: String(args.status || '').toLowerCase(),
|
|
405
|
+
startedAt: args.startedAt || args.started || '',
|
|
406
|
+
finishedAt: args.finishedAt || args.finished || '',
|
|
407
|
+
error: args.error || '',
|
|
408
|
+
body: '',
|
|
409
|
+
hasResponse: false,
|
|
431
410
|
};
|
|
432
411
|
}
|
|
433
412
|
|
|
413
|
+
function resolveBackgroundTaskMeta(parsedArgs = {}, resultText = '') {
|
|
414
|
+
const parsed = parseBackgroundTaskResult(resultText);
|
|
415
|
+
if (parsed) {
|
|
416
|
+
if (!parsed.error && parsedArgs?.error) parsed.error = parsedArgs.error;
|
|
417
|
+
if (!parsed.status && parsedArgs?.status) parsed.status = String(parsedArgs.status).toLowerCase();
|
|
418
|
+
if (!parsed.surface && parsedArgs?.surface) parsed.surface = parsedArgs.surface;
|
|
419
|
+
return parsed;
|
|
420
|
+
}
|
|
421
|
+
return backgroundTaskMetaFromArgs(parsedArgs);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function backgroundTaskElapsed(meta = {}, fallback = '') {
|
|
425
|
+
const startedMs = Date.parse(meta.startedAt || '');
|
|
426
|
+
const finishedMs = Date.parse(meta.finishedAt || '');
|
|
427
|
+
if (Number.isFinite(startedMs) && Number.isFinite(finishedMs) && finishedMs >= startedMs) {
|
|
428
|
+
const elapsedMs = finishedMs - startedMs;
|
|
429
|
+
return elapsedMs >= 1000 ? formatElapsed(elapsedMs) : '';
|
|
430
|
+
}
|
|
431
|
+
return fallback || '';
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function prefixElapsed(detail, elapsed = '') {
|
|
435
|
+
const text = String(detail || '').trim();
|
|
436
|
+
const time = String(elapsed || '').trim();
|
|
437
|
+
if (!time) return text;
|
|
438
|
+
return text ? `${time} · ${text}` : time;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function mergeTerminalDetail(status, detail = '') {
|
|
442
|
+
const label = displayTerminalStatus(status);
|
|
443
|
+
const text = String(detail || '').trim();
|
|
444
|
+
if (!label) return text;
|
|
445
|
+
if (label === 'Finished' && text) return text;
|
|
446
|
+
if (!text) return label;
|
|
447
|
+
if (text.toLowerCase().startsWith(label.toLowerCase())) return text;
|
|
448
|
+
return `${label} · ${text}`;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function shouldPrefixSyncElapsed(normalizedName, label) {
|
|
452
|
+
const n = String(normalizedName || '').toLowerCase();
|
|
453
|
+
const l = String(label || '').toLowerCase();
|
|
454
|
+
return n === 'explore' || l === 'explore' || n === 'search' || l === 'search' || l === 'web search';
|
|
455
|
+
}
|
|
456
|
+
|
|
434
457
|
function backgroundTaskDisplayName(normalizedName, meta = {}) {
|
|
435
458
|
const surface = String(meta.surface || normalizedName || '').toLowerCase();
|
|
436
459
|
if (surface === 'explore') return 'Explore';
|
|
@@ -453,20 +476,29 @@ function backgroundTaskActionTitle(normalizedName, meta = {}) {
|
|
|
453
476
|
return `${display} status`;
|
|
454
477
|
}
|
|
455
478
|
|
|
456
|
-
function
|
|
479
|
+
function backgroundTaskFailureDetail(meta = {}, parsedArgs = {}) {
|
|
480
|
+
const status = meta.status || parsedArgs?.status;
|
|
481
|
+
const error = meta.error || parsedArgs?.error;
|
|
482
|
+
if (!error) return '';
|
|
483
|
+
const surface = meta.surface || parsedArgs?.surface || '';
|
|
484
|
+
return backgroundTaskFailureStatusLabel(status, error, { surface });
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function backgroundTaskDetail(meta = {}, elapsed = '', parsedArgs = {}) {
|
|
457
488
|
const parts = [];
|
|
458
|
-
|
|
489
|
+
const status = displayTerminalStatus(meta.status);
|
|
490
|
+
if (status) parts.push(status);
|
|
459
491
|
if (meta.taskId) parts.push(`task_id: ${meta.taskId}`);
|
|
460
492
|
const firstBodyLine = String(meta.body || '').split('\n').map((line) => line.trim()).find(Boolean) || '';
|
|
461
493
|
if (firstBodyLine && /^(running|pending|queued)$/i.test(meta.status || '')) parts.push(firstBodyLine);
|
|
462
|
-
return parts.join(' · ');
|
|
494
|
+
return prefixElapsed(parts.join(' · '), elapsed);
|
|
463
495
|
}
|
|
464
496
|
|
|
465
497
|
function isBackgroundTaskResponseArgs(normalizedName, args = {}) {
|
|
466
498
|
if (!isBackgroundTaskTool(normalizedName)) return false;
|
|
467
499
|
const type = String(args?.type || args?.action || '').toLowerCase();
|
|
468
500
|
const status = String(args?.status || '').toLowerCase();
|
|
469
|
-
return type === 'result' || type === 'completion' || (/^(completed|
|
|
501
|
+
return type === 'result' || type === 'completion' || (/^(completed|cancelled|canceled)$/i.test(status) && Boolean(args?.task_id));
|
|
470
502
|
}
|
|
471
503
|
|
|
472
504
|
function isOutputDetailTool(normalizedName, label) {
|
|
@@ -475,26 +507,14 @@ function isOutputDetailTool(normalizedName, label) {
|
|
|
475
507
|
return new Set([
|
|
476
508
|
'shell', 'bash', 'bash_session', 'shell_command', 'job_wait',
|
|
477
509
|
'read', 'view_image', 'read_mcp_resource',
|
|
478
|
-
'grep', 'glob', 'search', 'search_query', 'image_query', 'web_search', 'web_search_call', '
|
|
510
|
+
'grep', 'glob', 'search', 'search_query', 'image_query', 'web_search', 'web_search_call', 'explore', 'web_fetch', 'fetch', 'download_attachment',
|
|
479
511
|
'list', 'ls', 'code_graph',
|
|
480
512
|
'recall', 'recall_memory', 'search_memories', 'remember', 'save_memory', 'update_memory',
|
|
481
513
|
]).has(n) || l === 'read' || l === 'search' || l === 'web search' || l === 'run';
|
|
482
514
|
}
|
|
483
515
|
|
|
484
516
|
function progressDetail({ normalizedName, label, elapsed }) {
|
|
485
|
-
|
|
486
|
-
const l = String(label || '').toLowerCase();
|
|
487
|
-
const suffix = elapsed ? ` - ${elapsed}` : '';
|
|
488
|
-
if (isAgentTool(n) || l === 'agent') return `Calling Agent${suffix}`;
|
|
489
|
-
if (n === 'shell' || n === 'bash' || n === 'bash_session' || n === 'shell_command' || n === 'job_wait' || l === 'run') return `Running${suffix}`;
|
|
490
|
-
if (n === 'search' || n === 'search_query' || n === 'image_query' || n === 'web_search' || n === 'web_search_call' || n === 'firecrawl_search' || n === 'web_fetch' || n === 'fetch' || n === 'download_attachment' || l === 'web search') return `Researching Web${suffix}`;
|
|
491
|
-
if (n === 'explore' || l === 'explore') return `Exploring${suffix}`;
|
|
492
|
-
if (n === 'grep' || n === 'glob' || n === 'list' || n === 'ls' || l === 'search') return `Searching${suffix}`;
|
|
493
|
-
if (n === 'read' || n === 'view_image' || n === 'read_mcp_resource' || l === 'read') return `Reading${suffix}`;
|
|
494
|
-
if (n === 'apply_patch' || l === 'update') return `Editing${suffix}`;
|
|
495
|
-
if (n === 'recall' || n === 'recall_memory' || n === 'search_memories' || l === 'memory') return `Checking Memory${suffix}`;
|
|
496
|
-
if (l === 'setup') return `Setting Up${suffix}`;
|
|
497
|
-
return `Working${suffix}`;
|
|
517
|
+
return elapsed ? `${elapsed} elapsed` : '';
|
|
498
518
|
}
|
|
499
519
|
|
|
500
520
|
function genericCompletedDetail({ normalizedName, label, hasResult, firstResultLine, isError }) {
|
|
@@ -502,7 +522,7 @@ function genericCompletedDetail({ normalizedName, label, hasResult, firstResultL
|
|
|
502
522
|
const l = String(label || '').toLowerCase();
|
|
503
523
|
if (isError) return hasResult ? firstResultLine : 'Failed';
|
|
504
524
|
if (n === 'shell' || n === 'bash' || n === 'bash_session' || n === 'shell_command' || n === 'job_wait') {
|
|
505
|
-
return
|
|
525
|
+
return '';
|
|
506
526
|
}
|
|
507
527
|
if (isOutputDetailTool(n, l)) {
|
|
508
528
|
return hasResult ? firstResultLine : '';
|
|
@@ -510,7 +530,29 @@ function genericCompletedDetail({ normalizedName, label, hasResult, firstResultL
|
|
|
510
530
|
return '';
|
|
511
531
|
}
|
|
512
532
|
|
|
513
|
-
function
|
|
533
|
+
function toolSearchLoadedSummary(resultText) {
|
|
534
|
+
let parsed;
|
|
535
|
+
try {
|
|
536
|
+
parsed = JSON.parse(String(resultText || ''));
|
|
537
|
+
} catch {
|
|
538
|
+
return '';
|
|
539
|
+
}
|
|
540
|
+
const tools = parsed?.selected?.tools;
|
|
541
|
+
if (!tools || typeof tools !== 'object') return '';
|
|
542
|
+
const names = [
|
|
543
|
+
...(Array.isArray(tools.added) ? tools.added : []),
|
|
544
|
+
...(Array.isArray(tools.already) ? tools.already : []),
|
|
545
|
+
]
|
|
546
|
+
.map((name) => String(name || '').trim())
|
|
547
|
+
.filter(Boolean);
|
|
548
|
+
return [...new Set(names)].join(', ');
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function agentTerminalDetail(status, isError, elapsed, error = '') {
|
|
552
|
+
const failureDetail = isError && error
|
|
553
|
+
? backgroundTaskFailureStatusLabel(status, error, { surface: 'agent' })
|
|
554
|
+
: '';
|
|
555
|
+
if (failureDetail) return failureDetail;
|
|
514
556
|
const s = String(status || '').toLowerCase();
|
|
515
557
|
const word = /cancel/.test(s)
|
|
516
558
|
? 'Cancelled'
|
|
@@ -528,17 +570,21 @@ function clampFailureCount(errorCount, groupCount, isError) {
|
|
|
528
570
|
return isError ? groupCount : 0;
|
|
529
571
|
}
|
|
530
572
|
|
|
531
|
-
function toolStatusColor({ pending, groupCount, failedCount }) {
|
|
532
|
-
if (pending) return theme.
|
|
573
|
+
function toolStatusColor({ pending, groupCount, failedCount, terminalStatus = '' }) {
|
|
574
|
+
if (pending) return theme.success;
|
|
575
|
+
const status = normalizeTerminalStatus(terminalStatus);
|
|
576
|
+
if (status === 'failed') return theme.error;
|
|
577
|
+
if (status === 'cancelled') return theme.warning || theme.mixdogOrange || theme.subtle;
|
|
533
578
|
if (failedCount <= 0) return theme.success;
|
|
534
579
|
if (groupCount > 1 && failedCount < groupCount) return theme.mixdogOrange || theme.warning;
|
|
535
580
|
return theme.error;
|
|
536
581
|
}
|
|
537
582
|
|
|
538
|
-
export function ToolExecution({ name, args, result, rawResult, isError, errorCount, expanded, globalExpanded = false, columns = 80, attached = false, count = 1, completedCount = 0, startedAt = 0, completedAt = 0, aggregate = false, categories = {}, headerFinalized = true }) {
|
|
583
|
+
export function ToolExecution({ name, args, result, rawResult, isError, errorCount, expanded, globalExpanded = false, columns = 80, attached = false, count = 1, completedCount = 0, startedAt = 0, completedAt = 0, aggregate = false, categories = {}, headerFinalized = true, deferredDisplayReady = false }) {
|
|
539
584
|
const [blinkOn, setBlinkOn] = useState(true);
|
|
540
585
|
const [blinkExpired, setBlinkExpired] = useState(false);
|
|
541
586
|
const [pendingDelayElapsed, setPendingDelayElapsed] = useState(false);
|
|
587
|
+
const [, setElapsedTick] = useState(0);
|
|
542
588
|
const groupCount = Math.max(1, Number(count || 1));
|
|
543
589
|
const doneCount = Math.max(0, Math.min(groupCount, Number(completedCount || (result == null ? 0 : groupCount))));
|
|
544
590
|
const rt = result == null ? null : String(result).replace(/\s+$/, '');
|
|
@@ -547,18 +593,30 @@ export function ToolExecution({ name, args, result, rawResult, isError, errorCou
|
|
|
547
593
|
const startedAtMs = Number(startedAt || 0);
|
|
548
594
|
const completedAtMs = Number(completedAt || 0);
|
|
549
595
|
const pendingAgeMs = pending && startedAtMs ? Math.max(0, Date.now() - startedAtMs) : 0;
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
596
|
+
// A card that is still pending but already has something to paint (a result
|
|
597
|
+
// landed, or at least one of an aggregate's parallel calls completed) must
|
|
598
|
+
// SKIP the blank placeholder: it was pushed early (engine ensureVisible on a
|
|
599
|
+
// result before the push-delay) so its startedAt is recent and pendingAgeMs <
|
|
600
|
+
// delay, but it has real header counts + a summary to show. Rendering the
|
|
601
|
+
// placeholder instead made an empty card scroll up first and only fill in as
|
|
602
|
+
// each parallel result arrived. Treating "has visible content" as ready lets
|
|
603
|
+
// the card appear already populated and simply grow taller as more results
|
|
604
|
+
// land — no empty band.
|
|
605
|
+
const hasVisibleProgress = doneCount > 0 || Boolean(String(rt || '').trim());
|
|
606
|
+
const pendingDisplayReady = !pending || !startedAtMs || pendingDelayElapsed || pendingAgeMs >= TOOL_PENDING_SHOW_DELAY_MS || hasVisibleProgress || deferredDisplayReady;
|
|
607
|
+
// Keep the action verb in its active form until the engine explicitly seals
|
|
608
|
+
// the tool block. Fast tool batches often complete before the next provider
|
|
609
|
+
// iteration decides whether to call more tools or emit assistant text; flipping
|
|
610
|
+
// "Finding" -> "Found" -> "Finding" during that gap makes the transcript jump.
|
|
611
|
+
const headerPending = pending || headerFinalized === false;
|
|
553
612
|
const hasResult = result != null && Boolean(String(rt || '').trim());
|
|
554
613
|
const hasRawResult = rawResult != null && Boolean(String(rawRt || '').trim());
|
|
555
614
|
const elapsedMs = startedAtMs ? Math.max(0, (pending ? Date.now() : (completedAtMs || Date.now())) - startedAtMs) : 0;
|
|
556
615
|
const elapsed = elapsedMs >= 1000 ? formatElapsed(elapsedMs) : '';
|
|
557
616
|
const failedCount = clampFailureCount(errorCount, groupCount, isError);
|
|
558
617
|
const statusColor = toolStatusColor({ pending, groupCount, failedCount });
|
|
559
|
-
const
|
|
560
|
-
const
|
|
561
|
-
const displayCategories = useCountUpMap(categories || {}, aggregate === true && countsVisible);
|
|
618
|
+
const displayGroupCount = groupCount;
|
|
619
|
+
const displayCategories = normalizeCountMap(categories || {});
|
|
562
620
|
|
|
563
621
|
useEffect(() => {
|
|
564
622
|
if (!pending) {
|
|
@@ -605,7 +663,36 @@ export function ToolExecution({ name, args, result, rawResult, isError, errorCou
|
|
|
605
663
|
return () => clearTimeout(timer);
|
|
606
664
|
}, [pending, pendingDisplayReady, startedAt]);
|
|
607
665
|
|
|
608
|
-
|
|
666
|
+
useEffect(() => {
|
|
667
|
+
if (!pending || !pendingDisplayReady || !startedAtMs) return undefined;
|
|
668
|
+
const timer = setInterval(() => setElapsedTick((tick) => (tick + 1) % 1000000), 1000);
|
|
669
|
+
return () => clearInterval(timer);
|
|
670
|
+
}, [pending, pendingDisplayReady, startedAtMs]);
|
|
671
|
+
|
|
672
|
+
// While a freshly-started tool is still inside its pending-show delay we used
|
|
673
|
+
// to `return null` (0 rendered rows). But estimateTranscriptItemRows() in
|
|
674
|
+
// App.jsx counts a collapsed tool item from the moment it is pushed (1 row for
|
|
675
|
+
// a skill surface, 2 rows otherwise), so the scroll/window math reserved that
|
|
676
|
+
// height while the component painted 0. The moment the delay elapsed (or the
|
|
677
|
+
// tool completed) the real card popped in, the rendered transcript grew and
|
|
678
|
+
// shoved the content above it — the "new tool card jumps up/down as it
|
|
679
|
+
// settles" bug. Reserve the SAME height the estimator predicts with blank
|
|
680
|
+
// content instead, so the card occupies a constant height for its whole
|
|
681
|
+
// lifecycle and nothing reflows when the real header/detail fill in place.
|
|
682
|
+
if (pending && !pendingDisplayReady) {
|
|
683
|
+
// Mirror estimateTranscriptItemRows: a non-aggregate skill surface collapses
|
|
684
|
+
// to a single header row; everything else reserves header + one detail row.
|
|
685
|
+
const placeholderNormalizedName = String(formatToolSurface(name, args)?.normalizedName || '').toLowerCase();
|
|
686
|
+
// Skill surfaces collapse to a single header row; agent surfaces reserve
|
|
687
|
+
// header + one brief detail row (see estimateTranscriptItemRows).
|
|
688
|
+
const placeholderSingleRow = !aggregate && SKILL_SURFACE_NAMES.has(placeholderNormalizedName);
|
|
689
|
+
return (
|
|
690
|
+
<Box flexDirection="column" marginTop={attached ? 0 : 1}>
|
|
691
|
+
<Text> </Text>
|
|
692
|
+
{placeholderSingleRow ? null : <Text> </Text>}
|
|
693
|
+
</Box>
|
|
694
|
+
);
|
|
695
|
+
}
|
|
609
696
|
|
|
610
697
|
// ── Aggregate card ──────────────────────────────────────────────
|
|
611
698
|
if (aggregate) {
|
|
@@ -613,28 +700,64 @@ export function ToolExecution({ name, args, result, rawResult, isError, errorCou
|
|
|
613
700
|
// bounce between "Reading 1 item" and "Reading 4 items". Final counts and
|
|
614
701
|
// result summaries appear only after completion.
|
|
615
702
|
const headerOrder = Array.isArray(args?.categoryOrder) ? args.categoryOrder : null;
|
|
703
|
+
// No stableVerbWidth: see statusCopy — the padding only left a mid-header
|
|
704
|
+
// gap ("Searched 1 pattern, Read 1 file") since Ink trims trailing
|
|
705
|
+
// spaces and never stabilized the flip.
|
|
616
706
|
const headerText = formatAggregateHeader(displayCategories || {}, { pending: headerPending, order: headerOrder });
|
|
617
707
|
let detailText;
|
|
618
708
|
if (hasResult) {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
709
|
+
// The aggregate card reserves EXACTLY ONE detail row when it is not
|
|
710
|
+
// expanded-with-raw (App.jsx estimateTranscriptItemRows counts
|
|
711
|
+
// margin + header + 1 detail row for the no-raw aggregate case). The
|
|
712
|
+
// summary `rt` can be multiline; a single <Text> containing '\n' renders
|
|
713
|
+
// MULTIPLE terminal rows, which desyncs the estimate and makes the card
|
|
714
|
+
// "settle" taller than reserved. Collapse to a single logical line
|
|
715
|
+
// (whitespace-normalized); fitResultLine below trims it to the column
|
|
716
|
+
// width so it can never exceed one terminal row.
|
|
717
|
+
detailText = String(rt).replace(/\s+/g, ' ').trim();
|
|
622
718
|
} else {
|
|
623
719
|
detailText = '';
|
|
624
720
|
}
|
|
625
721
|
|
|
626
|
-
const dotColor = statusColor;
|
|
722
|
+
const dotColor = !hasResult && !pending ? theme.subtle : statusColor;
|
|
627
723
|
const dotText = pending && !blinkExpired && !blinkOn ? ' ' : TURN_MARKER;
|
|
628
724
|
const gutter = 2;
|
|
629
725
|
const showHeaderExpandHint = hasRawResult;
|
|
630
|
-
const hintLabel =
|
|
631
|
-
const hintText =
|
|
632
|
-
const
|
|
726
|
+
const hintLabel = `ctrl+o ${expanded ? 'collapse' : 'expand'}`;
|
|
727
|
+
const hintText = ` ${BULLET_OPERATOR} ${hintLabel}`;
|
|
728
|
+
const headerMetaText = pending && elapsed ? ` (${elapsed} elapsed)` : '';
|
|
729
|
+
// Reserve the expand-hint slot for the card's whole lifecycle so the header
|
|
730
|
+
// body never reflows when the hint appears on completion. During pending the
|
|
731
|
+
// elapsed meta shares this same right region; reserving the wider of the two
|
|
732
|
+
// keeps `avail` (and the header clip point) fixed, so nothing "appears then
|
|
733
|
+
// shrinks back" on the right edge as counts/results land.
|
|
734
|
+
const rightReserve = Math.max(stringWidth(hintText), stringWidth(headerMetaText));
|
|
735
|
+
const avail = Math.max(1, (Number(columns) || 80) - 1 - gutter - rightReserve);
|
|
736
|
+
const trailingText = headerMetaText || (showHeaderExpandHint ? hintText : '');
|
|
737
|
+
const trailingColor = theme.subtle;
|
|
633
738
|
const clippedHeader = stringWidth(headerText) > avail
|
|
634
739
|
? truncateToWidth(headerText, avail)
|
|
635
740
|
: headerText;
|
|
636
|
-
|
|
637
|
-
|
|
741
|
+
// Trailing content (elapsed while pending, ctrl+o hint when done) always
|
|
742
|
+
// sits immediately after the header body — no fixed right-edge pin — so it
|
|
743
|
+
// never jumps to the right edge and snaps back on the pending→done flip.
|
|
744
|
+
// Keep the aggregate card at a fixed height (header + one detail row) for
|
|
745
|
+
// its whole lifecycle. Pending cards have no result yet, so reserve the
|
|
746
|
+
// detail row up front instead of growing from 1→2 rows when the summary
|
|
747
|
+
// lands on completion — that late row push is the "줄 튐" jump. The empty
|
|
748
|
+
// placeholder renders as a blank line under the ⎿ gutter; the final summary
|
|
749
|
+
// simply fills it in place. This matches estimateTranscriptItemRows (always
|
|
750
|
+
// 2 + resultRows), so windowing/scroll stay in lockstep too.
|
|
751
|
+
// When there is no summary yet (pending) or none could be derived, fill the
|
|
752
|
+
// reserved detail row with a status word instead of a blank line so the area
|
|
753
|
+
// under the ⎿ gutter never looks empty. Real summaries keep the normal text
|
|
754
|
+
// color; the status placeholder is rendered dim.
|
|
755
|
+
const isPlaceholderDetail = !(expanded && hasRawResult) && !detailText;
|
|
756
|
+
const showRawAggregate = expanded && hasRawResult;
|
|
757
|
+
const detailLines = showRawAggregate
|
|
758
|
+
? rawRt.split('\n')
|
|
759
|
+
: (detailText ? [detailText] : [headerPending ? 'Running' : 'Finished']);
|
|
760
|
+
const aggregateDetailColor = isPlaceholderDetail ? theme.subtle : theme.text;
|
|
638
761
|
return (
|
|
639
762
|
<Box flexDirection="column" marginTop={attached ? 0 : 1}>
|
|
640
763
|
<Box flexDirection="row">
|
|
@@ -643,93 +766,180 @@ export function ToolExecution({ name, args, result, rawResult, isError, errorCou
|
|
|
643
766
|
</Box>
|
|
644
767
|
<Text wrap="truncate">
|
|
645
768
|
<Text bold color={theme.text}>{clippedHeader}</Text>
|
|
646
|
-
{
|
|
769
|
+
{trailingText ? <Text color={trailingColor}>{trailingText}</Text> : null}
|
|
647
770
|
</Text>
|
|
648
771
|
</Box>
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
<Text key={i} color={aggregateDetailColor}>
|
|
657
|
-
{renderDeltaText(fitResultLine(line || ' ', columns))}
|
|
658
|
-
</Text>
|
|
659
|
-
))}
|
|
660
|
-
</Box>
|
|
661
|
-
</Box>
|
|
662
|
-
) : null}
|
|
772
|
+
<ResultBody
|
|
773
|
+
lines={detailLines}
|
|
774
|
+
rawText={rawRt || ''}
|
|
775
|
+
columns={columns}
|
|
776
|
+
color={aggregateDetailColor}
|
|
777
|
+
raw={showRawAggregate}
|
|
778
|
+
/>
|
|
663
779
|
</Box>
|
|
664
780
|
);
|
|
665
781
|
}
|
|
666
782
|
|
|
667
783
|
// ── Normal (non-aggregate) tool card ────────────────────────────
|
|
668
784
|
const { label, summary, normalizedName, args: parsedArgs } = formatToolSurface(name, args);
|
|
669
|
-
const
|
|
670
|
-
|
|
785
|
+
const isShellSurface = isShellTool(normalizedName, label);
|
|
786
|
+
const isSkillSurface = SKILL_SURFACE_NAMES.has(String(normalizedName || '').toLowerCase());
|
|
787
|
+
const backgroundMeta = !pending && isBackgroundTaskTool(normalizedName)
|
|
788
|
+
? resolveBackgroundTaskMeta(parsedArgs, rt || '')
|
|
671
789
|
: null;
|
|
790
|
+
const backgroundError = backgroundMeta?.error || parsedArgs?.error || '';
|
|
791
|
+
const errorOnlyResult = Boolean(rt) && isBackgroundErrorOnlyBody(rt, backgroundError);
|
|
672
792
|
const backgroundResultText = backgroundMeta?.hasResponse ? backgroundMeta.body : '';
|
|
673
|
-
const displayedResultText = backgroundResultText || rt;
|
|
793
|
+
const displayedResultText = backgroundResultText || (errorOnlyResult ? '' : (rt || ''));
|
|
794
|
+
const hasDisplayResult = Boolean(String(displayedResultText || '').trim());
|
|
674
795
|
const lines = displayedResultText ? displayedResultText.split('\n') : [];
|
|
675
796
|
const totalLines = lines.length;
|
|
676
797
|
// Semantic one-line summary derived purely from name/args/result text.
|
|
677
798
|
// Shown in the collapsed, non-error view in place of the raw result block.
|
|
678
799
|
// Grouped cards ("Searched N files" / "Read N files") get the same treatment
|
|
679
800
|
// as single calls: a one-line semantic summary stands in for the raw block.
|
|
680
|
-
const resultSummary = !pending &&
|
|
801
|
+
const resultSummary = !pending && hasDisplayResult
|
|
681
802
|
? surfaceSummarizeToolResult(name, args, displayedResultText, isError)
|
|
682
803
|
: null;
|
|
683
804
|
// Same fit budget fitResultLine() uses, to detect a line that will be clipped.
|
|
684
805
|
const maxResultChars = Math.max(MIN_RESULT_LINE_CHARS, Number(columns || 80) - 7);
|
|
685
806
|
const resultColor = theme.text;
|
|
686
|
-
const firstResultLine =
|
|
687
|
-
const firstResultLineClipped =
|
|
688
|
-
const hasHiddenDetail = !pending &&
|
|
807
|
+
const firstResultLine = hasDisplayResult ? String(lines[0] ?? '') : '';
|
|
808
|
+
const firstResultLineClipped = hasDisplayResult && stringWidth(firstResultLine) > maxResultChars;
|
|
809
|
+
const hasHiddenDetail = !pending && hasDisplayResult && (totalLines > 1 || firstResultLineClipped || Boolean(resultSummary));
|
|
810
|
+
const shellStatus = isShellSurface ? shellDisplayStatus({ pending, failedCount, isError, result: displayedResultText }) : '';
|
|
811
|
+
const shellElapsed = isShellSurface ? (shellResultElapsed(displayedResultText) || elapsed) : '';
|
|
812
|
+
const shellStatusDetail = isShellSurface ? shellDetail(shellStatus, shellElapsed) : '';
|
|
813
|
+
const backgroundElapsed = backgroundMeta
|
|
814
|
+
? backgroundTaskElapsed(backgroundMeta, elapsed)
|
|
815
|
+
: (isBackgroundTaskTool(normalizedName) ? backgroundTaskElapsed(parsedArgs, elapsed) : '');
|
|
689
816
|
|
|
690
817
|
const toolArgPath = parsedArgs?.path ?? parsedArgs?.file_path ?? parsedArgs?.file ?? '';
|
|
691
818
|
const imageDetail = normalizedName === 'view_image' && toolArgPath ? String(toolArgPath) : '';
|
|
692
|
-
const
|
|
693
|
-
|
|
819
|
+
const isBackgroundResult = !pending && isBackgroundTaskTool(normalizedName) && Boolean(backgroundMeta);
|
|
820
|
+
const isBackgroundResponse = isBackgroundResult && (backgroundMeta?.hasResponse || isBackgroundTaskResponseArgs(normalizedName, parsedArgs));
|
|
821
|
+
const isBackgroundMetadataResult = isBackgroundResult && !isBackgroundResponse && Boolean(backgroundMeta);
|
|
822
|
+
const backgroundMetadataFailureLabel = isBackgroundMetadataResult
|
|
823
|
+
? backgroundTaskFailureDetail(backgroundMeta, parsedArgs)
|
|
694
824
|
: '';
|
|
695
|
-
const
|
|
696
|
-
?
|
|
825
|
+
const backgroundMetadataHeaderFailure = Boolean(backgroundMetadataFailureLabel) && !hasDisplayResult
|
|
826
|
+
? backgroundMetadataFailureLabel
|
|
827
|
+
: '';
|
|
828
|
+
const agentHeaderFailure = !pending && isAgentTool(normalizedName) && isError && parsedArgs?.error && !hasDisplayResult
|
|
829
|
+
? backgroundTaskFailureStatusLabel(parsedArgs?.status, parsedArgs?.error, { surface: 'agent' })
|
|
697
830
|
: '';
|
|
698
|
-
const
|
|
699
|
-
|
|
831
|
+
const headerFailureStatus = backgroundMetadataHeaderFailure || agentHeaderFailure || '';
|
|
832
|
+
const agentCompletionDetail = !pending && isAgentTool(normalizedName) && !agentHeaderFailure
|
|
833
|
+
? agentTerminalDetail(parsedArgs?.status, isError, elapsed, parsedArgs?.error)
|
|
700
834
|
: '';
|
|
701
|
-
const
|
|
835
|
+
const agentDetail = !pending && isAgentTool(normalizedName) && !hasDisplayResult
|
|
836
|
+
? agentCompletionDetail
|
|
837
|
+
: '';
|
|
838
|
+
const genericDetail = !pending && !isShellSurface && !agentDetail && !imageDetail && !resultSummary
|
|
702
839
|
? genericCompletedDetail({ normalizedName, label, hasResult, firstResultLine, isError })
|
|
703
840
|
: '';
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
const backgroundMetadataDetail = isBackgroundMetadataResult
|
|
841
|
+
const terminalStatus = pending
|
|
842
|
+
? 'running'
|
|
843
|
+
: (shellStatus || normalizeTerminalStatus(backgroundMeta?.status) || normalizeTerminalStatus(parsedArgs?.status) || resultTerminalStatus(displayedResultText) || (isError || failedCount > 0 ? 'failed' : 'completed'));
|
|
844
|
+
const backgroundMetadataDetail = isBackgroundMetadataResult && !backgroundMetadataHeaderFailure
|
|
845
|
+
? backgroundTaskDetail(backgroundMeta, backgroundElapsed, parsedArgs)
|
|
846
|
+
: '';
|
|
847
|
+
const backgroundResponseDetail = isBackgroundResponse && resultSummary
|
|
848
|
+
? prefixElapsed(resultSummary, backgroundElapsed)
|
|
849
|
+
: resultSummary;
|
|
850
|
+
const syncElapsedDetail = !isBackgroundResponse && shouldPrefixSyncElapsed(normalizedName, label)
|
|
851
|
+
? prefixElapsed(backgroundResponseDetail, elapsed)
|
|
852
|
+
: backgroundResponseDetail;
|
|
853
|
+
const nonShellDetail = backgroundMetadataDetail || (/^(Cancelled|Failed|Finished)$/i.test(resultSummary || '') && agentCompletionDetail
|
|
854
|
+
? agentCompletionDetail
|
|
855
|
+
: syncElapsedDetail) || agentDetail || imageDetail || genericDetail;
|
|
856
|
+
// A pending non-aggregate tool used to drop its detail row entirely
|
|
857
|
+
// (collapsedDetail = ''), so the card rendered as a single header row. But
|
|
858
|
+
// estimateTranscriptItemRows() in App.jsx reserves 2 rows for a collapsed
|
|
859
|
+
// non-aggregate tool (1 only for skill surfaces). That left a 1-row gap that
|
|
860
|
+
// closed the instant the result landed — the surviving "튐". Reserve the same
|
|
861
|
+
// dim placeholder detail row the aggregate card uses (`Running`) for the whole
|
|
862
|
+
// pending lifecycle so the height stays fixed at header + one detail row and
|
|
863
|
+
// the final summary just fills in place. Skill surfaces collapse to a single
|
|
864
|
+
// row in BOTH the estimate and the render (visibleDetailLines drops the row
|
|
865
|
+
// for isSkillSurface below), so they get no placeholder.
|
|
866
|
+
const pendingDetailPlaceholder = pending && !isSkillSurface ? 'Running' : '';
|
|
867
|
+
const shellCollapsedSummary = isShellSurface && !pending && hasDisplayResult
|
|
868
|
+
? (resultSummary || truncateToWidth(firstResultLine, Math.min(120, maxResultChars)))
|
|
869
|
+
: resultSummary;
|
|
708
870
|
const collapsedDetail = pending
|
|
709
|
-
?
|
|
710
|
-
:
|
|
711
|
-
?
|
|
712
|
-
:
|
|
713
|
-
const
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
871
|
+
? pendingDetailPlaceholder
|
|
872
|
+
: isShellSurface
|
|
873
|
+
? mergeTerminalDetail(shellStatus, shellCollapsedSummary)
|
|
874
|
+
: mergeTerminalDetail(terminalStatus, nonShellDetail);
|
|
875
|
+
const backgroundMetadataExpandable = isBackgroundMetadataResult && hasRawResult && !pending;
|
|
876
|
+
const showRawResult = expanded && (hasDisplayResult || hasRawResult)
|
|
877
|
+
&& (!isBackgroundMetadataResult || hasRawResult);
|
|
878
|
+
const detailLines = showRawResult
|
|
879
|
+
? (hasDisplayResult ? lines : (rawRt ? rawRt.split('\n') : []))
|
|
880
|
+
: (collapsedDetail ? [collapsedDetail] : []);
|
|
881
|
+
const isPendingPlaceholderDetail = !showRawResult && Boolean(pendingDetailPlaceholder);
|
|
882
|
+
const detailColor = isPendingPlaceholderDetail ? theme.subtle : theme.text;
|
|
883
|
+
|
|
884
|
+
const isAgentResult = !isBackgroundResult && !pending && isAgentTool(normalizedName) && hasDisplayResult;
|
|
719
885
|
const isAgentResponse = isAgentResult && hasAgentResponseResult(rt);
|
|
720
|
-
const
|
|
721
|
-
const
|
|
886
|
+
const isAgentSurfaceCard = isAgentTool(normalizedName);
|
|
887
|
+
const agentSurfaceBriefRaw = isAgentSurfaceCard && !showRawResult
|
|
888
|
+
? summarizeAgentSurfaceBrief(name, parsedArgs, displayedResultText || '', { isError, isResponse: isAgentResponse })
|
|
889
|
+
: '';
|
|
890
|
+
const agentSurfaceBrief = agentSurfaceBriefRaw
|
|
891
|
+
? truncateToWidth(agentSurfaceBriefRaw, Math.min(AGENT_SURFACE_BRIEF_MAX, maxResultChars))
|
|
892
|
+
: '';
|
|
893
|
+
// Skill loads carry the skill name in the header already
|
|
894
|
+
// ("Loaded 1 skill (name)"); the collapsed detail row just repeats it, so
|
|
895
|
+
// drop it and keep the card a single line. Expanding (ctrl+o) still shows the
|
|
896
|
+
// full skill body via the raw-result path.
|
|
897
|
+
// Agent spawn/send/response cards show a tight brief under the ⎿ gutter when
|
|
898
|
+
// collapsed; ctrl+o expand still surfaces the full body.
|
|
899
|
+
let visibleDetailLines = detailLines;
|
|
900
|
+
if (isSkillSurface && !showRawResult) {
|
|
901
|
+
visibleDetailLines = [];
|
|
902
|
+
} else if (isBackgroundMetadataResult && backgroundMetadataHeaderFailure && !showRawResult) {
|
|
903
|
+
visibleDetailLines = [];
|
|
904
|
+
} else if (isAgentSurfaceCard && !showRawResult) {
|
|
905
|
+
const agentDetailFallback = collapsedDetail
|
|
906
|
+
|| (pending ? (pendingDetailPlaceholder || 'Running') : 'Finished');
|
|
907
|
+
const agentDetailLine = agentSurfaceBrief
|
|
908
|
+
|| truncateToWidth(String(agentDetailFallback), Math.min(AGENT_SURFACE_BRIEF_MAX, maxResultChars));
|
|
909
|
+
visibleDetailLines = agentHeaderFailure && !agentSurfaceBrief ? [] : [agentDetailLine];
|
|
910
|
+
}
|
|
911
|
+
const finalStatusColor = toolStatusColor({ pending, groupCount, failedCount, terminalStatus });
|
|
912
|
+
const dotColor = finalStatusColor;
|
|
722
913
|
const dotText = pending && !blinkExpired && !blinkOn ? ' ' : TURN_MARKER;
|
|
723
914
|
let labelText;
|
|
724
915
|
if (isAgentResponse) labelText = agentResponseTitle(parsedArgs);
|
|
725
916
|
else if (isBackgroundResponse) labelText = backgroundTaskResultTitle(normalizedName, backgroundMeta || parsedArgs);
|
|
726
917
|
else if (isBackgroundMetadataResult) labelText = backgroundTaskActionTitle(normalizedName, backgroundMeta);
|
|
727
|
-
else
|
|
918
|
+
else if (isShellSurface) labelText = shellHeader(shellStatus, displayGroupCount);
|
|
919
|
+
else labelText = (isAgentTool(normalizedName) ? agentActionTitle(parsedArgs) : '') || statusCopy(name, label, displayGroupCount, doneCount, headerPending, isError, parsedArgs);
|
|
728
920
|
// Show the parenthesized arg summary for grouped cards too, matching single
|
|
729
921
|
// calls so the header carries the same context.
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
922
|
+
const toolSearchSummary = !pending && normalizedName === 'tool_search' && hasResult
|
|
923
|
+
? toolSearchLoadedSummary(displayedResultText)
|
|
924
|
+
: '';
|
|
925
|
+
const summaryText = isAgentResponse || isBackgroundResponse
|
|
926
|
+
? ''
|
|
927
|
+
: toolSearchSummary || (isAgentTool(normalizedName) ? agentActionSummary(parsedArgs, summary) : summary);
|
|
928
|
+
// Agent cards hide their collapsed body but still expose ctrl+o expand only
|
|
929
|
+
// when expanding would actually reveal something: an agent response body, or a
|
|
930
|
+
// multiline / clipped raw result (e.g. the "agents: N …" worker list). A
|
|
931
|
+
// status-only single-line metadata result has nothing extra to show, so it
|
|
932
|
+
// gets no hint.
|
|
933
|
+
const agentHasExpandableBody = isAgentSurfaceCard && !pending && hasResult
|
|
934
|
+
&& (isAgentResponse || totalLines > 1 || firstResultLineClipped);
|
|
935
|
+
// Agent cards gate the hint solely on agentHasExpandableBody — never on
|
|
936
|
+
// hasHiddenDetail, which goes true for any single-line resultSummary and would
|
|
937
|
+
// wrongly show ctrl+o on a status-only one-liner that has nothing to expand.
|
|
938
|
+
const shellHasExpandableBody = isShellSurface && !pending && hasDisplayResult
|
|
939
|
+
&& (totalLines > 1 || firstResultLineClipped || Boolean(shellCollapsedSummary && shellCollapsedSummary !== firstResultLine));
|
|
940
|
+
const showHeaderExpandHint = (isShellSurface ? shellHasExpandableBody : (isAgentSurfaceCard ? agentHasExpandableBody : (hasHiddenDetail || backgroundMetadataExpandable)))
|
|
941
|
+
&& normalizedName !== 'tool_search';
|
|
942
|
+
const expandHintColor = theme.subtle;
|
|
733
943
|
|
|
734
944
|
// Build a single-line header that never wraps: reserve width for the fixed
|
|
735
945
|
// trailing expand hint plus the dot gutter and a 1-col Windows last-column
|
|
@@ -739,10 +949,25 @@ export function ToolExecution({ name, args, result, rawResult, isError, errorCou
|
|
|
739
949
|
const gutter = 2;
|
|
740
950
|
const hintLabel = showHeaderExpandHint ? `ctrl+o ${expanded ? 'collapse' : 'expand'}` : '';
|
|
741
951
|
const hintText = hintLabel ? ` ${BULLET_OPERATOR} ${hintLabel}` : '';
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
952
|
+
const headerMetaText = pending && elapsed ? ` (${elapsed} elapsed)` : '';
|
|
953
|
+
// The expand hint (post-completion) and the elapsed meta (pending) occupy the
|
|
954
|
+
// SAME trailing region but never at the same time. Subtracting both widths
|
|
955
|
+
// made `avail` shrink/grow across the pending→completed transition, so the
|
|
956
|
+
// label/summary clip point shifted and the header text "jumped out then
|
|
957
|
+
// snapped back" right as a tool finished or cards merged. Reserve the wider of
|
|
958
|
+
// the two for the whole lifecycle (matching the aggregate card's rightReserve)
|
|
959
|
+
// so `avail` stays fixed and nothing reflows. The hint slot is reserved even
|
|
960
|
+
// while pending so its later appearance does not push the body either.
|
|
961
|
+
const hintReserveLabel = `ctrl+o ${expanded ? 'collapse' : 'expand'}`;
|
|
962
|
+
const hintReserveText = ` ${BULLET_OPERATOR} ${hintReserveLabel}`;
|
|
963
|
+
const headerFailureText = headerFailureStatus
|
|
964
|
+
? truncateToWidth(headerFailureStatus, HEADER_FAILURE_STATUS_MAX)
|
|
965
|
+
: '';
|
|
966
|
+
const inlineFailureText = headerFailureText ? ` ${BULLET_OPERATOR} ${headerFailureText}` : '';
|
|
967
|
+
const rightReserve = Math.max(stringWidth(hintReserveText), stringWidth(headerMetaText)) + stringWidth(inlineFailureText);
|
|
968
|
+
const avail = Math.max(1, (Number(columns) || 80) - 1 - gutter - rightReserve);
|
|
969
|
+
const trailingText = headerMetaText || (showHeaderExpandHint ? hintText : '');
|
|
970
|
+
const trailingColor = headerMetaText ? theme.subtle : expandHintColor;
|
|
746
971
|
let labelOut;
|
|
747
972
|
let summaryOut;
|
|
748
973
|
if (stringWidth(labelText) >= avail) {
|
|
@@ -759,33 +984,38 @@ export function ToolExecution({ name, args, result, rawResult, isError, errorCou
|
|
|
759
984
|
: '';
|
|
760
985
|
summaryOut = truncatedSummary ? ` (${truncatedSummary})` : '';
|
|
761
986
|
}
|
|
987
|
+
// Keep trailing content (pending elapsed / completed ctrl+o hint) attached
|
|
988
|
+
// directly after the body for the whole lifecycle. The fixed-column pin
|
|
989
|
+
// previously used for elapsed is what made the trailing text jump to the right
|
|
990
|
+
// edge and snap back on the pending→done flip, so there is no pad. `avail`
|
|
991
|
+
// stays reserved (rightReserve) so the body clip point never reflows.
|
|
762
992
|
return (
|
|
763
993
|
<Box flexDirection="column" marginTop={attached ? 0 : 1}>
|
|
764
|
-
<Box flexDirection="row">
|
|
765
|
-
<Box flexShrink={
|
|
766
|
-
<
|
|
994
|
+
<Box flexDirection="row" width="100%">
|
|
995
|
+
<Box flexShrink={1} flexGrow={1} overflow="hidden" minWidth={0}>
|
|
996
|
+
<Box flexDirection="row">
|
|
997
|
+
<Box flexShrink={0} minWidth={2}>
|
|
998
|
+
<Text color={dotColor}>{dotText}</Text>
|
|
999
|
+
</Box>
|
|
1000
|
+
<Text wrap="truncate">
|
|
1001
|
+
<Text bold color={theme.text}>{labelOut}</Text>
|
|
1002
|
+
{summaryOut ? <Text color={theme.text}>{summaryOut}</Text> : null}
|
|
1003
|
+
{inlineFailureText ? <Text color={theme.error}>{inlineFailureText}</Text> : null}
|
|
1004
|
+
{trailingText ? <Text color={trailingColor}>{trailingText}</Text> : null}
|
|
1005
|
+
</Text>
|
|
1006
|
+
</Box>
|
|
767
1007
|
</Box>
|
|
768
|
-
<Text wrap="truncate">
|
|
769
|
-
<Text bold color={theme.text}>{labelOut}</Text>
|
|
770
|
-
{summaryOut ? <Text color={theme.text}>{summaryOut}</Text> : null}
|
|
771
|
-
{showHeaderExpandHint ? <Text color={expandHintColor}>{hintText}</Text> : null}
|
|
772
|
-
</Text>
|
|
773
1008
|
</Box>
|
|
774
1009
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
</Box>
|
|
788
|
-
) : null}
|
|
789
|
-
</Box>
|
|
790
|
-
);
|
|
791
|
-
}
|
|
1010
|
+
<ResultBody
|
|
1011
|
+
lines={visibleDetailLines}
|
|
1012
|
+
rawText={hasDisplayResult ? displayedResultText : (rawRt || '')}
|
|
1013
|
+
pathArg={toolArgPath}
|
|
1014
|
+
isShell={isShellSurface}
|
|
1015
|
+
columns={columns}
|
|
1016
|
+
color={showRawResult ? resultColor : detailColor}
|
|
1017
|
+
raw={showRawResult}
|
|
1018
|
+
/>
|
|
1019
|
+
</Box>
|
|
1020
|
+
);
|
|
1021
|
+
}
|