Files
CodeNomad/packages/ui/src/lib/i18n/messages/en/toolCall.ts
VooDisss 4f236ce36f Implement shared compact split and unified tool-call diff layout (#270)
# PR Title

Implement shared compact split and unified tool-call diff layout

---
Fixes #268 
# PR Description

## Summary

This PR makes tool-call diffs more compact in both `Unified` and `Split`
views by reducing wasted horizontal space in line-number gutters and
content indentation.

## What changed

- introduced a shared compact-diff framework for tool-call diffs
- kept mobile-specific policy limited to:
  - forcing unified mode below the breakpoint
  - enabling wrap only in mobile unified mode
- added mode-specific compact applicators in the diff viewer:
  - unified applicator
  - split applicator
- reduced gutter width waste by measuring rendered line-number text and
tightening column width around it
- removed unnecessary right-side content padding
- aligned `+` / `-` markers closer to the left edge across both views
- simplified cleanup after gatekeeper review by removing extra plumbing
and residue

## Screenshots

### Before

<img width="581" height="341" alt="image"
src="https://github.com/user-attachments/assets/ec47b256-749a-4afc-8879-aaf33f0b46b6"
/>

### After

<img width="470" height="586" alt="image"
src="https://github.com/user-attachments/assets/7258a5a2-47c4-408d-84bc-1b497761c7ad"
/>

## Architectural approach

This change intentionally uses:

- shared policy in
`packages/ui/src/components/tool-call/diff-render.tsx`
- shared helper/measurement logic in
`packages/ui/src/components/diff-viewer.tsx`
- mode-specific applicators where unified and split DOM differ
- CSS for shared visual spacing and alignment cleanup

The goal was to keep the implementation architecturally clean and avoid
building separate duplicated compact-diff features for:

- mobile vs desktop
- unified vs split

Instead, the feature shares one compact-diff concept and only diverges
where the upstream diff DOM requires separate handling.

## Files changed

- `packages/ui/src/components/tool-call/diff-render.tsx`
- `packages/ui/src/components/diff-viewer.tsx`
- `packages/ui/src/styles/messaging/tool-call.css`
- `packages/ui/src/types/message.ts`

## Validation

Manual validation was performed in the running UI.

Verified manually:

- compact unified gutters on mobile
- compact unified gutters on desktop
- compact split gutters on desktop
- tighter operator alignment in both modes

Also verified:

- `npm run typecheck` passes

## Notes

- This PR is intended to address the compact diff layout problem
described in the related issue.
- Diff-specific CSS still lives in `tool-call.css`; future extraction
into a smaller dedicated stylesheet is possible but not required for
this change.

---------

Co-authored-by: Shantur Rathore <i@shantur.com>
2026-04-01 23:13:32 +01:00

138 lines
6.7 KiB
TypeScript

export const toolCallMessages = {
"toolCall.pending.waitingToRun": "Waiting to run...",
"toolCall.error.label": "Error:",
"toolCall.header.copyTitle": "Copy tool call title",
"toolCall.header.copyAriaLabel": "Copy tool call title",
"toolCall.header.showInputTitle": "Show Tool Arguments",
"toolCall.header.showInputAriaLabel": "Show Tool Arguments",
"toolCall.header.hideInputTitle": "Hide Tool Arguments",
"toolCall.header.hideInputAriaLabel": "Hide Tool Arguments",
"toolCall.io.input": "Tool Input",
"toolCall.io.output": "Tool Output",
"toolCall.diff.label": "Diff",
"toolCall.diff.label.withPath": "Diff · {path}",
"toolCall.diff.viewMode.ariaLabel": "Diff view mode",
"toolCall.diff.viewMode.split": "Split",
"toolCall.diff.viewMode.unified": "Unified",
"toolCall.diff.switchToSplit": "Switch to split view",
"toolCall.diff.switchToUnified": "Switch to unified view",
"toolCall.diff.enableWordWrap": "Enable word wrap",
"toolCall.diff.disableWordWrap": "Disable word wrap",
"toolCall.diff.copyPatch": "Copy patch",
"toolCall.diagnostics.title": "Diagnostics",
"toolCall.diagnostics.ariaLabel": "Diagnostics",
"toolCall.diagnostics.ariaLabel.withLabel": "Diagnostics {label}",
"toolCall.diagnostics.severity.error.short": "ERR",
"toolCall.diagnostics.severity.warning.short": "WARN",
"toolCall.diagnostics.severity.info.short": "INFO",
"toolCall.renderer.toolName.shell": "Shell",
"toolCall.renderer.toolName.fetch": "Fetch",
"toolCall.renderer.toolName.invalid": "Invalid",
"toolCall.renderer.toolName.plan": "Plan",
"toolCall.renderer.toolName.applyPatch": "Apply patch",
"toolCall.renderer.action.working": "Working...",
"toolCall.renderer.action.writingCommand": "Writing command...",
"toolCall.renderer.action.preparingEdit": "Preparing edit...",
"toolCall.renderer.action.readingFile": "Reading file...",
"toolCall.renderer.action.preparingWrite": "Preparing write...",
"toolCall.renderer.action.preparingPatch": "Preparing patch...",
"toolCall.renderer.action.planning": "Planning...",
"toolCall.renderer.action.fetchingFromWeb": "Fetching from the web...",
"toolCall.renderer.action.findingFiles": "Finding files...",
"toolCall.renderer.action.searchingContent": "Searching content...",
"toolCall.renderer.action.listingDirectory": "Listing directory...",
"toolCall.renderer.bash.title.timeout": "Timeout: {timeout}",
"toolCall.renderer.read.detail.offset": "Offset: {offset}",
"toolCall.renderer.read.detail.limit": "Limit: {limit}",
"toolCall.renderer.todo.empty": "No plan items yet.",
"toolCall.renderer.todo.status.pending": "Pending",
"toolCall.renderer.todo.status.inProgress": "In progress",
"toolCall.renderer.todo.status.completed": "Completed",
"toolCall.renderer.todo.status.cancelled": "Cancelled",
"toolCall.renderer.todo.title.plan": "Plan",
"toolCall.renderer.todo.title.creating": "Creating plan",
"toolCall.renderer.todo.title.completing": "Completing plan",
"toolCall.renderer.todo.title.updating": "Updating plan",
"toolCall.permission.status.required": "Permission Required",
"toolCall.permission.status.queued": "Permission Queued",
"toolCall.permission.requestedDiff.label": "Requested diff",
"toolCall.permission.requestedDiff.withPath": "Requested diff · {path}",
"toolCall.permission.queuedText": "Waiting for earlier permission responses.",
"toolCall.permission.actions.allowOnce": "Allow Once",
"toolCall.permission.actions.alwaysAllow": "Always Allow",
"toolCall.permission.actions.deny": "Deny",
"toolCall.permission.shortcuts.allowOnce": "Allow once",
"toolCall.permission.shortcuts.alwaysAllow": "Always allow",
"toolCall.permission.shortcuts.deny": "Deny",
"toolCall.permission.errors.unableToUpdate": "Unable to update permission",
"permissionApproval.title": "Requests",
"permissionApproval.empty": "No pending requests.",
"permissionApproval.kind.permission": "Permission",
"permissionApproval.kind.question": "Question",
"permissionApproval.questionCount.one": "{count} question",
"permissionApproval.questionCount.other": "{count} questions",
"permissionApproval.status.active": "Active",
"permissionApproval.actions.closeAriaLabel": "Close",
"permissionApproval.actions.goToSession": "Go to Session",
"permissionApproval.actions.loadingSession": "Loading…",
"permissionApproval.actions.loadSession": "Load Session",
"permissionApproval.actions.allowOnce": "Allow Once",
"permissionApproval.actions.alwaysAllow": "Always Allow",
"permissionApproval.actions.deny": "Deny",
"permissionApproval.fallbackHint": "Load session for more information.",
"permissionApproval.errors.unableToUpdatePermission": "Unable to update permission",
"toolCall.question.status.required": "Question Required",
"toolCall.question.status.queued": "Question Queued",
"toolCall.question.status.questions": "Questions",
"toolCall.question.action.awaitingAnswers": "Awaiting answers...",
"toolCall.question.title.questions": "Questions",
"toolCall.question.title.askingQuestions": "Asking questions",
"toolCall.question.type.one": "Question",
"toolCall.question.type.other": "Questions",
"toolCall.question.number": "Q{number}:",
"toolCall.question.multiple": "Multiple",
"toolCall.question.custom.title": "Type a custom answer",
"toolCall.question.custom.label": "Custom answer",
"toolCall.question.custom.placeholder": "Type your own answer",
"toolCall.question.actions.submit": "Submit",
"toolCall.question.actions.dismiss": "Dismiss",
"toolCall.question.shortcuts.submit": "Submit",
"toolCall.question.shortcuts.dismiss": "Dismiss",
"toolCall.question.queuedText": "Waiting for earlier responses.",
"toolCall.question.validation.answerAll": "Please answer all questions before submitting.",
"toolCall.question.errors.unableToReply": "Unable to reply",
"toolCall.question.errors.unableToDismiss": "Unable to dismiss",
"toolCall.task.action.delegating": "Delegating...",
"toolCall.task.sections.prompt": "Prompt",
"toolCall.task.sections.steps": "Steps",
"toolCall.task.sections.output": "Output",
"toolCall.task.steps.count": "{count} steps",
"toolCall.task.meta.agentModel": "Agent: {agent} • Model: {model}",
"toolCall.task.meta.agent": "Agent: {agent}",
"toolCall.task.meta.model": "Model: {model}",
"toolCall.status.pending": "Pending",
"toolCall.status.running": "Running",
"toolCall.status.completed": "Completed",
"toolCall.status.error": "Error",
"toolCall.status.unknown": "Unknown",
"toolCall.applyPatch.action.preparing": "Preparing apply_patch...",
"toolCall.applyPatch.title.withFileCount.one": "{tool} ({count} file)",
"toolCall.applyPatch.title.withFileCount.other": "{tool} ({count} files)",
"toolCall.applyPatch.fileFallback": "File {number}",
} as const