Skip to content

Commit a6a23fd

Browse files
committed
fix(app): use v2 type scale in the permission dock
1 parent 6f96c9e commit a6a23fd

2 files changed

Lines changed: 27 additions & 13 deletions

File tree

‎packages/app/src/session/requests/session-permission-dock.tsx‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
import { Option, Schema } from "effect"
12
import { For, Show } from "solid-js"
23
import type { PermissionRequest } from "@opencode/client/promise"
34
import { Button } from "@opencode/ui/button"
45
import { DockPrompt } from "@opencode/session-ui/dock-prompt"
56
import { Icon } from "@opencode/ui/icon"
67
import { useLanguage } from "@/runtime/i18n/language"
78

9+
const decodeToolInput = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown))
10+
11+
const isString = Schema.is(Schema.String)
12+
813
export function SessionPermissionDock(props: {
914
request: PermissionRequest
1015
responding: boolean
@@ -14,20 +19,20 @@ export function SessionPermissionDock(props: {
1419

1520
const toolDescription = () => {
1621
const key = `settings.permissions.tool.${props.request.action}.description`
22+
// SAFETY: an action without a curated description returns the key itself, which the check below detects.
1723
const value = language.t(key as Parameters<typeof language.t>[0])
1824

1925
if (value === key) return ""
2026

2127
return value
2228
}
2329

24-
const input = () => {
25-
const value = props.request.metadata?.input
26-
if (!value || typeof value !== "object") return []
27-
return Object.entries(value).map(
28-
([key, item]) => `${key}: ${typeof item === "string" ? item : JSON.stringify(item)}`,
29-
)
30-
}
30+
const input = () =>
31+
Option.match(decodeToolInput(props.request.metadata?.input), {
32+
onNone: () => [],
33+
onSome: (value) =>
34+
Object.entries(value).map(([key, item]) => `${key}: ${isString(item) ? item : JSON.stringify(item)}`),
35+
})
3136

3237
return (
3338
<DockPrompt
@@ -64,7 +69,7 @@ export function SessionPermissionDock(props: {
6469
>
6570
<div data-slot="permission-row">
6671
<span data-slot="permission-spacer" aria-hidden="true" />
67-
<Show when={toolDescription()} fallback={<code data-slot="permission-hint">{props.request.action}</code>}>
72+
<Show when={toolDescription()} fallback={<code data-slot="permission-action">{props.request.action}</code>}>
6873
<div data-slot="permission-hint">{toolDescription()}</div>
6974
</Show>
7075
</div>

‎packages/session-ui/src/components/message-part.css‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,9 +1458,9 @@
14581458

14591459
[data-slot="permission-header-title"] {
14601460
font-family: var(--font-family-sans);
1461-
font-size: 14px;
1461+
font-size: 13px;
14621462
font-weight: var(--font-weight-medium);
1463-
line-height: var(--line-height-large);
1463+
line-height: var(--line-height-base);
14641464
color: var(--v2-text-text-base);
14651465
min-width: 0;
14661466
}
@@ -1475,13 +1475,22 @@
14751475

14761476
[data-slot="permission-hint"] {
14771477
font-family: var(--font-family-sans);
1478-
font-size: 14px;
1478+
font-size: 13px;
14791479
font-weight: var(--font-weight-regular);
1480-
line-height: var(--line-height-large);
1480+
line-height: var(--line-height-base);
14811481
color: var(--v2-text-text-muted);
14821482
padding: 0;
14831483
}
14841484

1485+
[data-slot="permission-action"] {
1486+
font-family: var(--v2-font-family-code);
1487+
font-size: 13px;
1488+
font-weight: 440;
1489+
line-height: var(--line-height-base);
1490+
letter-spacing: -0.04px;
1491+
color: var(--v2-text-text-base);
1492+
}
1493+
14851494
[data-slot="permission-input"] {
14861495
display: flex;
14871496
flex-direction: column;
@@ -1495,7 +1504,7 @@
14951504
font-size: 13px;
14961505
font-weight: 440;
14971506
letter-spacing: -0.04px;
1498-
line-height: var(--line-height-compact);
1507+
line-height: var(--line-height-base);
14991508
white-space: pre-wrap;
15001509
}
15011510
}

0 commit comments

Comments
 (0)