Compare commits

..
Author SHA1 Message Date
monarchmaisuriya 9f80c5e1a0 fix(claude): settle the first tool call after a compaction
Claude Code now sends the compaction summary as a user message marked
isSynthetic. The synthetic check returned before the one-shot compacting
flag was cleared, so the flag stayed set and swallowed the next user
message: the first tool result after the compaction. That call stayed
running and was later shown as Canceled when the idle runtime was
collected.

Skip the summary by what it is (synthetic, or isCompactSummary in older
streams) instead of by position, and drop the compacting flag, which
nothing else reads.

Co-authored-by: monarchmaisuriya <monarchmaisuriya7600@gmail.com>
2026-11-29 08:16:26 +00:00
22 changed files with 172 additions and 483 deletions
+1 -1
View File
@@ -1 +1 @@
sha256-34bUBmRmjekbUSp93597GLTmSWKt23TCHaK3ViXG+iU=
sha256-aal9eR571blWuL7CZt1LR+KfA4QPJ0ivVl/GSTWy93o=
@@ -1,13 +0,0 @@
import {
expectBuiltinPluginSettings,
openBuiltinPluginSettings,
test,
} from "../support/helpers/builtin-plugin-settings";
test("a built-in plugin's settings link opens its screen", async ({
page,
builtinSettingsHost,
}) => {
await openBuiltinPluginSettings(page, builtinSettingsHost);
await expectBuiltinPluginSettings(page);
});
@@ -28,7 +28,6 @@ import {
} from "../support/helpers/composer";
import { openGlobalNewWorkspaceComposer } from "../support/helpers/new-workspace";
import { clickNewChat, clickNewTerminal, gotoWorkspace } from "../support/helpers/launcher";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { seedWorkspace } from "../support/helpers/seed-client";
const MOCK_PROVIDER_LABEL = "Mock Load Test";
@@ -345,18 +344,6 @@ test.describe("Cross-provider model search", () => {
expect(Math.abs(expandedBox!.y - collapsedBox!.y)).toBeLessThanOrEqual(1);
expect(Math.abs(expandedBox!.height - collapsedBox!.height)).toBeLessThanOrEqual(1);
// Search dock matches the collapsed provider card's outer rails, height, and text rail.
const searchContainer = page.getByTestId("model-search-all-input-container");
const searchInput = page.getByTestId("model-search-all-input");
const searchBox = await searchContainer.boundingBox();
const searchInputBox = await searchInput.boundingBox();
const collapsedCardBox = await readCollapsedCardGeometry(collapsedHeader);
expect(searchBox && searchInputBox && collapsedCardBox).toBeTruthy();
expect(Math.abs(searchBox!.x - collapsedCardBox!.cardX)).toBeLessThanOrEqual(1);
expect(Math.abs(searchBox!.width - collapsedCardBox!.cardWidth)).toBeLessThanOrEqual(1);
expect(Math.abs(searchBox!.height - collapsedCardBox!.cardHeight)).toBeLessThanOrEqual(1);
expect(Math.abs(searchInputBox!.x - collapsedCardBox!.labelX)).toBeLessThanOrEqual(2);
// Return Home, expand Profiles in place, and apply the profile.
await page.getByTestId("sheet-header-back").click();
await profilesToggle.click();
@@ -464,97 +451,8 @@ test.describe("Cross-provider model search", () => {
await provider.restore();
}
});
test("compact single-provider picker keeps its header fixed and scrolls to the last model row", async ({
page,
}) => {
const extraModels = Array.from({ length: 24 }, (_, index) => ({
id: `extra-scroll-${String(index).padStart(2, "0")}`,
label: `Extra scroll model ${String(index).padStart(2, "0")}`,
description: `Extra row ${index}`,
}));
const client = await connectDaemonClient<DaemonClient>({
clientIdPrefix: "single-provider-scroll",
});
const workspace = await seedMockAgentWorkspace({
repoPrefix: "single-provider-scroll-",
title: "Single provider scroll",
model: "ten-second-stream",
modeId: "load-test",
});
try {
await client.patchDaemonConfig({
providers: {
mock: {
additionalModels: extraModels,
},
},
});
await page.setViewportSize({ width: 390, height: 800 });
await openAgentRoute(page, workspace);
await expectComposerVisible(page);
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
await expect(page.getByTestId("agent-controls-model")).toBeVisible();
await page.getByTestId("agent-controls-model").click();
const list = page.getByTestId("compact-model-list");
await expect(list).toBeVisible();
const header = page.getByTestId("model-provider-section-mock");
await expect(header).toBeVisible();
const headerBox = await header.boundingBox();
expect(headerBox).toBeTruthy();
expect(headerBox!.height).toBeGreaterThanOrEqual(16);
// Scroll to the bottom of the lone provider's list and confirm the final row is fully in view.
await list.evaluate((node) => {
node.scrollTop = node.scrollHeight;
});
const lastRow = page.getByTestId("model-row-mock-extra-scroll-23");
await expect(lastRow).toBeVisible();
const listBox = await list.boundingBox();
const lastRowBox = await lastRow.boundingBox();
expect(listBox && lastRowBox).toBeTruthy();
expect(lastRowBox!.y + lastRowBox!.height).toBeLessThanOrEqual(
listBox!.y + listBox!.height + 1,
);
await lastRow.click();
await expect(page.getByTestId("agent-controls-model")).toContainText("Extra scroll model 23");
} finally {
await client
.patchDaemonConfig({
providers: {
mock: {
additionalModels: [],
},
},
})
.catch(() => undefined);
await client.close().catch(() => undefined);
await workspace.cleanup();
}
});
});
async function readCollapsedCardGeometry(collapsedHeader: ReturnType<Page["getByTestId"]>) {
return collapsedHeader.evaluate((node) => {
// Walk up from the press overlay to the SettingsCard container (2px taller for borders).
const header = node.parentElement;
const card = header?.parentElement?.parentElement;
const rect = card?.getBoundingClientRect();
const label = header?.querySelector('[dir="auto"]');
const labelRect = label?.getBoundingClientRect();
return rect && labelRect
? {
cardX: rect.x,
cardWidth: rect.width,
cardHeight: rect.height,
labelX: labelRect.x,
}
: null;
});
}
async function startScrollSampling(page: Page, listTestId: string): Promise<void> {
await page.evaluate((testId) => {
const samples: number[] = [];
@@ -1,34 +0,0 @@
import { BuiltinPluginLoader } from "../../../../server/src/server/plugins/builtin/index.js";
import { createTestPaseoDaemon } from "../../../../server/src/server/test-utils/paseo-daemon.js";
import { DaemonClient } from "../../../../server/src/server/test-utils/daemon-client.js";
import assert from "node:assert/strict";
import pino from "pino";
const [, , root, origin, paseoHomeRoot, daemonVersion] = process.argv;
const daemon = await createTestPaseoDaemon({
corsAllowedOrigins: [origin!],
paseoHomeRoot,
daemonVersion,
logger: pino({ level: "error" }),
builtinPlugins: new BuiltinPluginLoader(root, ["builtin-settings"]),
});
const client = new DaemonClient({
appVersion: daemonVersion,
url: `ws://127.0.0.1:${daemon.port}/ws`,
});
try {
await client.connect();
const plugin = (await client.getPluginCatalog()).find(({ id }) => id === "builtin-settings");
assert.ok(plugin?.clientBundle, JSON.stringify(await client.getPluginLogs("builtin-settings")));
assert.deepEqual(await client.listPlugins(), []);
process.send!({ serverId: client.getLastServerInfoMessage()!.serverId, port: daemon.port });
await new Promise<void>((resolve) => {
process.once("disconnect", resolve);
process.once("SIGTERM", resolve);
});
} finally {
await client.close();
await daemon.close();
}
@@ -627,8 +627,7 @@ export async function expectProfilesEditLink(page: Page): Promise<void> {
exact: true,
});
await expect(edit).toBeVisible();
await expect(edit).toHaveText("");
await expect(edit.locator("svg")).toBeVisible();
await expect(edit).toHaveText("Edit");
}
/** With no profiles, the Profiles entry offers to create one instead of listing any. */
@@ -1,77 +0,0 @@
import { mkdir, writeFile } from "node:fs/promises";
import path from "node:path";
import { once } from "node:events";
import { spawnTsx, killProcessTree } from "./spawn-node";
import appPackage from "../../../package.json";
import { expect, test as base, type Page } from "../fixtures";
import { gotoAppShell } from "./app";
import { addConnectedHostAndReload } from "./hosts";
import { pluginRequirements } from "./plugin-fixture";
const pluginId = "builtin-settings";
const screenId = "general";
const settingsText = "Built-in settings body";
export const test = base.extend<{ builtinSettingsHost: { serverId: string; port: number } }>({
builtinSettingsHost: async ({ baseURL }, provide, testInfo) => {
const root = testInfo.outputPath("builtin-plugins");
const directory = path.join(root, pluginId);
await mkdir(directory, { recursive: true });
await writeFile(
path.join(directory, "paseo-plugin.json"),
JSON.stringify({ id: pluginId, requirements: pluginRequirements }),
);
await writeFile(
path.join(directory, "index.client.tsx"),
`import React from "react";
import { Text } from "react-native";
export default function contribute(client) {
client.addSettingsScreen({
id: "${screenId}",
title: "General",
icon: "SlidersHorizontal",
Component: () => <Text>${settingsText}</Text>,
});
return () => {};
}`,
);
await writeFile(
path.join(directory, "index.server.ts"),
"export default function contribute() { return () => {}; }",
);
const daemon = spawnTsx(
path.resolve(__dirname, "../../fixtures/builtin-settings/daemon.mts"),
[root, new URL(baseURL!).origin, testInfo.outputPath("daemon"), appPackage.version],
{ stdio: ["ignore", "inherit", "inherit", "ipc"] },
);
try {
const [host] = await Promise.race([
once(daemon, "message") as Promise<[{ serverId: string; port: number }]>,
once(daemon, "exit").then(([code]) => {
throw new Error(`Built-in settings daemon exited with code ${code}`);
}),
]);
await provide(host);
} finally {
await killProcessTree(daemon);
}
},
});
export async function openBuiltinPluginSettings(
page: Page,
host: { serverId: string; port: number },
) {
await gotoAppShell(page);
await addConnectedHostAndReload(page, {
...host,
label: "Built-in settings host",
destination: `/settings/hosts/${host.serverId}/plugins/${pluginId}/${screenId}`,
});
}
export async function expectBuiltinPluginSettings(page: Page) {
await expect(page.getByText(settingsText, { exact: true })).toBeVisible();
await expect(page.getByRole("switch", { name: /: Disable$/ })).toHaveCount(0);
}
+4 -14
View File
@@ -76,24 +76,15 @@ export async function addOfflineHostsAndReload(
export async function addConnectedHostAndReload(
page: Page,
input: {
serverId: string;
label: string;
port: number;
primaryLabel?: string;
destination?: string;
},
input: { serverId: string; label: string; port: number; primaryLabel?: string },
): Promise<void> {
await addConnectedHostsAndReload(page, [input], {
primaryLabel: input.primaryLabel,
destination: input.destination,
});
await addConnectedHostsAndReload(page, [input], { primaryLabel: input.primaryLabel });
}
export async function addConnectedHostsAndReload(
page: Page,
inputs: Array<{ serverId: string; label: string; port: number }>,
options?: { primaryLabel?: string; destination?: string },
options?: { primaryLabel?: string },
): Promise<void> {
const connectedHosts = inputs.map((input) =>
buildSeededHost({
@@ -132,8 +123,7 @@ export async function addConnectedHostsAndReload(
},
);
if (options?.destination) await page.goto(options.destination);
else await page.reload();
await page.reload();
}
export async function waitForConnectedHost(
@@ -14,7 +14,6 @@ import {
import { ModelProviderGlyph, useSelectedModelLabels } from "@/components/model-browser";
import { DesktopModelPicker, type ModelPickerActions } from "@/components/model-browser-panes";
import {
getSheetSearchFooterStyle,
MobileModelPageView,
SheetSearchDock,
useMobileModelPage,
@@ -314,7 +313,6 @@ function CompactCombinedModelSelector({
snapPoints={SHEET_SNAP_POINTS}
scrollable={false}
footer={footer}
footerContainerStyle={getSheetSearchFooterStyle()}
keyboard={keyboard}
contentStyle={styles.sheetBody}
testID="model-selector-sheet"
@@ -2,7 +2,7 @@ import { useCallback, useMemo, useRef, useState, type ReactElement, type ReactNo
import { useTranslation } from "react-i18next";
import { FlatList, Text, View } from "react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { AlertTriangle, ChevronDown, Layers } from "lucide-react-native";
import { AlertTriangle, ChevronDown, Layers, Pencil } from "lucide-react-native";
import type { AgentProfilePickerRow } from "@/agent-profiles";
import {
IndependentScrollBoundary,
@@ -16,7 +16,6 @@ import {
} from "@/components/model-browser";
import {
CustomizeProviderButton,
EditProfilesButton,
ModelPickerItemRow,
type ModelPickerActions,
} from "@/components/model-browser-panes";
@@ -35,6 +34,7 @@ import {
type MobileProviderSection,
} from "@/components/mobile-model-page-view";
import { SettingsCard } from "@/components/settings";
import { Button } from "@/components/ui/button";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { PressHighlight } from "@/components/ui/press-highlight";
import {
@@ -46,7 +46,6 @@ import { SearchField } from "@/components/ui/search-field";
import { isNative, isWeb } from "@/constants/platform";
import type { ProviderSelectorProvider } from "@/provider-selection/provider-selection";
import { ICON_SIZE, type Theme } from "@/styles/theme";
import { settingsStyles } from "@/styles/settings";
import { inlineUnistylesStyle } from "@/styles/unistyles-inline-style";
/**
@@ -159,7 +158,6 @@ export function SheetSearchDock({
placeholder={placeholder}
clearAccessibilityLabel={t("providerCatalog.clearSearch")}
fullWidth
variant="card"
testID={testID}
clearTestID={testID ? `${testID}-clear` : undefined}
/>
@@ -265,21 +263,6 @@ export function MobileModelPageView({
),
[renderItem],
);
const singleProviderSection =
projection.kind === "browse" && !projection.showSectionHeaders
? projection.sections[0]
: undefined;
const singleProviderHeader = useMemo(
() =>
singleProviderSection?.kind === "provider" ? (
<ProviderSectionHeader
section={singleProviderSection}
serverId={serverId}
collapsible={false}
/>
) : undefined,
[serverId, singleProviderSection],
);
if (projection.kind === "noProviders") {
return (
@@ -313,8 +296,12 @@ export function MobileModelPageView({
);
}
if (!projection.showSectionHeaders) {
const section = projection.sections[0];
return (
<SheetListCard header={singleProviderHeader} testID="mobile-model-page">
<SheetListCard testID="mobile-model-page">
{section?.kind === "provider" ? (
<ProviderSectionHeader section={section} serverId={serverId} collapsible={false} />
) : null}
{projection.body ? (
<SectionBody
body={projection.body}
@@ -410,8 +397,18 @@ export function CollapsibleProfilesCard({
[],
);
const trailingAction = useMemo(
() => (expanded && onEditProfiles ? <EditProfilesButton onPress={onEditProfiles} /> : null),
[expanded, onEditProfiles],
() =>
expanded && onEditProfiles ? (
<Button
variant="ghost"
size="sm"
leftIcon={Pencil}
onPress={onEditProfiles}
accessibilityLabel={t("modelSelector.editProfilesLabel")}
testID="model-profiles-edit"
/>
) : null,
[expanded, onEditProfiles, t],
);
const viewportHeight = computeBoundedListHeight(items.length);
@@ -494,25 +491,12 @@ function AccordionSectionCard({
/**
* An inset card holding one sheet list, on the same rail as the browse sections' cards. It grows
* with the list, then the list scrolls inside it while its optional header stays fixed.
* with the list, then the list scrolls inside it.
*/
function SheetListCard({
header,
children,
testID,
}: {
header?: ReactNode;
children: ReactNode;
testID?: string;
}) {
function SheetListCard({ children, testID }: { children: ReactNode; testID?: string }) {
return (
<View style={styles.listCardPage} testID={testID}>
<View style={[settingsStyles.card, styles.listCard]}>
{header ? <View style={styles.listCardHeader}>{header}</View> : null}
<View style={[header ? settingsStyles.rowBorder : undefined, styles.listCardBody]}>
{children}
</View>
</View>
<SettingsCard shrink>{children}</SettingsCard>
</View>
);
}
@@ -607,8 +591,18 @@ function ProfilesSectionHeader({
[],
);
const trailing = useMemo(
() => (expanded && onEditProfiles ? <EditProfilesButton onPress={onEditProfiles} /> : null),
[expanded, onEditProfiles],
() =>
expanded && onEditProfiles ? (
<Button
variant="ghost"
size="sm"
leftIcon={Pencil}
onPress={onEditProfiles}
accessibilityLabel={t("modelSelector.editProfilesLabel")}
testID="model-profiles-edit"
/>
) : null,
[expanded, onEditProfiles, t],
);
return (
<CollapsibleSectionHeader
@@ -704,7 +698,7 @@ function SectionBody({
onRetryProvider: ModelPickerActions["onRetryProvider"];
isRetryingProvider: boolean;
}) {
const frameStyle = fill ? styles.fillState : styles.fixedViewport;
const frameStyle = fill ? styles.page : styles.fixedViewport;
if (body.kind === "providerLoading") {
return (
<View style={[frameStyle, styles.centered]}>
@@ -790,12 +784,8 @@ function SectionItemList({
return [styles.boundedViewport, inlineUnistylesStyle({ height: viewportHeight })];
}, [fill, viewportHeight]);
// A lone provider's list is the sheet's own scroller, so it must integrate with the bottom sheet
// gesture handler (SheetFlatList); an accordion list scrolls independently inside SheetScrollView.
const ListComponent = fill ? SheetFlatList : FlatList;
return (
<ListComponent
<FlatList
ref={listRef}
data={items}
renderItem={renderItem}
@@ -808,7 +798,7 @@ function SectionItemList({
keyboardShouldPersistTaps="handled"
keyboardDismissMode={KEYBOARD_DISMISS_MODE}
showsVerticalScrollIndicator
nestedScrollEnabled={!fill}
nestedScrollEnabled
testID={testID}
/>
);
@@ -826,20 +816,6 @@ const styles = StyleSheet.create((theme) => ({
paddingTop: theme.spacing[2],
paddingBottom: theme.spacing[2],
},
listCard: {
flexShrink: 1,
minHeight: 0,
},
listCardHeader: {
flexShrink: 0,
},
listCardBody: {
flexShrink: 1,
minHeight: 0,
},
fillState: {
minHeight: MOBILE_EXPANDED_PROVIDER_HEIGHT,
},
sections: {
paddingHorizontal: theme.spacing[4],
paddingTop: theme.spacing[2],
@@ -915,14 +891,4 @@ const styles = StyleSheet.create((theme) => ({
flex: 1,
flexDirection: "row",
},
searchFooter: {
// Matches the card inset (`styles.sections` / `styles.listCardPage`) so the search box shares
// its outer left and right rails with the provider cards above it.
paddingHorizontal: theme.spacing[4],
},
}));
/** Read at render time rather than module scope (docs/unistyles.md). */
export function getSheetSearchFooterStyle() {
return styles.searchFooter;
}
@@ -603,6 +603,7 @@ function ListPane({
onActivate: (key: string) => void;
actions: ModelPickerActions;
}) {
const { t } = useTranslation();
const { pane, activeKey } = projection;
const entries = useListEntries(pane);
const profiledLookup = useMemo(
@@ -628,7 +629,17 @@ function ListPane({
if (entry.kind === "heading") {
let headingAction: ReactNode = null;
if (entry.action?.kind === "editProfiles" && actions.onEditProfiles) {
headingAction = <EditProfilesButton onPress={actions.onEditProfiles} />;
headingAction = (
<Button
variant="ghost"
size="sm"
onPress={actions.onEditProfiles}
accessibilityLabel={t("modelSelector.editProfilesLabel")}
testID="model-profiles-edit"
>
{t("modelSelector.editProfiles")}
</Button>
);
} else if (entry.action?.kind === "customizeProvider" && serverId) {
headingAction = (
<CustomizeProviderButton
@@ -669,6 +680,7 @@ function ListPane({
selectedModel,
selectedProvider,
serverId,
t,
],
);
@@ -785,7 +797,17 @@ function ListPaneHeader({
<Text style={styles.paneTitle} numberOfLines={1}>
{t("modelSelector.profiles")}
</Text>
{onEditProfiles ? <EditProfilesButton onPress={onEditProfiles} /> : null}
{onEditProfiles ? (
<Button
variant="ghost"
size="sm"
onPress={onEditProfiles}
accessibilityLabel={t("modelSelector.editProfilesLabel")}
testID="model-profiles-edit"
>
{t("modelSelector.editProfiles")}
</Button>
) : null}
</View>
);
}
@@ -806,20 +828,6 @@ function ListPaneHeader({
);
}
export function EditProfilesButton({ onPress }: { onPress: () => void }) {
const { t } = useTranslation();
return (
<Button
variant="ghost"
size="sm"
leftIcon={Pencil}
onPress={onPress}
accessibilityLabel={t("modelSelector.editProfilesLabel")}
testID="model-profiles-edit"
/>
);
}
export function CustomizeProviderButton({
serverId,
providerId,
+15 -3
View File
@@ -56,13 +56,25 @@ interface AppSettingsRowProps extends Omit<SettingsRowProps, "hint">, AppRowExtr
hint?: ReactNode;
}
export function SettingsCard({ children, testID }: { children: ReactNode; testID?: string }) {
/** Lets a card and its rows shrink below their content, so a list inside can scroll. */
const SHRINK = { flexShrink: 1, minHeight: 0 } as const;
export function SettingsCard({
children,
testID,
shrink = false,
}: {
children: ReactNode;
testID?: string;
/** The card shrinks to fit a parent with a bounded height, and a list inside it scrolls. */
shrink?: boolean;
}) {
return (
<View style={settingsStyles.card} testID={testID}>
<View style={[settingsStyles.card, shrink && SHRINK]} testID={testID}>
{Children.toArray(children).map((child, index) => (
<View
key={isValidElement(child) ? child.key : index}
style={index ? settingsStyles.rowBorder : undefined}
style={[index ? settingsStyles.rowBorder : undefined, shrink && SHRINK]}
>
{child}
</View>
@@ -89,7 +89,9 @@ const styles = StyleSheet.create((theme: Theme) => ({
top: 0,
bottom: 0,
width: INDENT_GUIDE_WIDTH,
backgroundColor: theme.colors.treeGuide,
// Translucent ink, not `border`: a solid line that colour disappears into a hovered row's fill.
backgroundColor: theme.colors.foregroundExtraMuted,
opacity: theme.opacity[50],
},
chevron: {
width: WORKSPACE_TREE_ICON_SIZE,
@@ -7,7 +7,7 @@ import {
} from "react-native";
import { Search, X } from "lucide-react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { ICON_SIZE, type Theme } from "@/styles/theme";
import type { Theme } from "@/styles/theme";
import {
EditingTextInput as TextInput,
type EditingTextInputHandle,
@@ -35,11 +35,6 @@ export interface SearchFieldProps {
fullWidth?: boolean;
/** `sm` heads a list in tight chrome such as a sidebar pane. */
size?: "sm" | "md";
/**
* `card` matches a compact `SettingsCard` row's height, corner radius, horizontal inset, and
* leading glyph rail so a docked sheet search aligns with the cards above it.
*/
variant?: "default" | "card";
/** Escape empties the field. Off where Escape already closes the surface around it. */
clearOnEscape?: boolean;
testID?: string;
@@ -61,7 +56,6 @@ export function SearchField({
clearAccessibilityLabel,
fullWidth = false,
size = "md",
variant = "default",
clearOnEscape = false,
testID,
clearTestID,
@@ -85,21 +79,17 @@ export function SearchField({
if (value === "" && inputRef.current?.getText()) inputRef.current.replaceText("");
}, [value]);
const small = size === "sm";
const card = variant === "card";
const leadingIcon = <ThemedSearch size={ICON_SIZE.sm} uniProps={mutedColorMapping} />;
return (
<View
testID={testID ? `${testID}-container` : undefined}
style={[
styles.field,
small && styles.fieldSmall,
card && styles.fieldCard,
fullWidth && styles.fieldFullWidth,
isFocused && styles.fieldFocused,
]}
>
{card ? <View style={styles.leadingSlot}>{leadingIcon}</View> : leadingIcon}
<ThemedSearch size={14} uniProps={mutedColorMapping} />
<ThemedTextInput
testID={testID}
ref={inputRef}
@@ -122,9 +112,8 @@ export function SearchField({
accessibilityRole="button"
accessibilityLabel={clearAccessibilityLabel}
hitSlop={8}
style={card ? styles.clearSlot : undefined}
>
<ThemedX size={ICON_SIZE.sm} uniProps={mutedColorMapping} />
<ThemedX size={14} uniProps={mutedColorMapping} />
</Pressable>
) : null}
</View>
@@ -153,25 +142,6 @@ const styles = StyleSheet.create((theme) => ({
paddingVertical: 0,
paddingHorizontal: theme.spacing[1.5],
},
fieldCard: {
// Matches a collapsed SettingsCard row: 44pt inner row height + 1px top/bottom border = 46pt.
height: 46,
paddingVertical: 0,
paddingHorizontal: { xs: theme.spacing[4], md: theme.spacing[3] },
borderRadius: theme.borderRadius.lg,
},
leadingSlot: {
width: 16,
alignItems: "center",
justifyContent: "center",
},
clearSlot: {
width: ICON_SIZE.sm,
height: ICON_SIZE.sm,
marginRight: -theme.spacing[1],
alignItems: "center",
justifyContent: "center",
},
fieldFullWidth: {
maxWidth: "100%",
},
@@ -13,7 +13,6 @@ import { ModelProviderGlyph } from "@/components/model-browser";
import type { ModelPickerActions } from "@/components/model-browser-panes";
import {
CollapsibleProfilesCard,
getSheetSearchFooterStyle,
MobileModelPageView,
SheetSearchDock,
useMobileModelPage,
@@ -353,7 +352,6 @@ export function AgentSettingsDrawer({
snapPoints={SNAP_POINTS}
scrollable={false}
footer={footer}
footerContainerStyle={getSheetSearchFooterStyle()}
keyboard={keyboard}
contentStyle={styles.sheetBody}
contextBridge={contextBridge}
@@ -27,12 +27,8 @@ import { StatusBadge } from "@/components/ui/status-badge";
import { Switch } from "@/components/ui/switch";
import { useIsCompactFormFactor } from "@/constants/layout";
import { useToast } from "@/contexts/toast-api-context";
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
import {
useInstalledPlugin,
usePluginCatalogStatus,
usePluginEvaluationError,
} from "@/plugins/registry";
import { useHostRuntimeClient } from "@/runtime/host-runtime";
import { useInstalledPlugin, usePluginEvaluationError } from "@/plugins/registry";
import { pluginDisplayName } from "@/plugins/plugin-list";
import { PluginSettingsContent } from "@/plugins/settings";
import { usePluginActions, type PluginAction } from "./actions";
@@ -280,6 +276,8 @@ interface PluginPageModel {
error?: string;
/** Why the last update failed, while the update is still offered. The installed version keeps running. */
updateError?: string;
/** The plugin's own settings screen, shown inline. */
screenId?: string;
overview?: string;
}
@@ -303,10 +301,12 @@ function usePluginPageModel({
const directory = usePluginDirectory(serverId);
const meta = useListingMeta();
const pluginId = plugin?.id ?? "";
const installedPlugin = useInstalledPlugin(serverId, pluginId);
const evaluationError = usePluginEvaluationError(serverId, pluginId);
const pluginOperation = usePluginOperation(serverId, pluginId);
const updates = usePluginUpdates(serverId);
const text = listing ? listingText(listing, i18n.language) : undefined;
const requestedScreen = subject.kind === "installed" ? subject.screenId : undefined;
return {
name: plugin ? pluginDisplayName(plugin) : (text?.name ?? subjectId(subject)),
description: text?.description ?? plugin?.description,
@@ -316,22 +316,11 @@ function usePluginPageModel({
authorAvatar: listing && listingAuthorAvatar(listing),
error: plugin ? (evaluationError ?? plugin.error) : failedError(installOperation),
updateError: failedUpdateError(pluginOperation, updates.data, pluginId),
screenId: plugin ? (requestedScreen ?? installedPlugin?.settingsScreens[0]?.id) : undefined,
overview: detail && listingOverview(detail, i18n.language),
};
}
function usePluginPageSettings(
serverId: string,
subject: PluginPageSubject,
plugin: PluginListItem | undefined,
) {
const pluginId = subject.kind === "installed" ? subject.pluginId : (plugin?.id ?? "");
const installedPlugin = useInstalledPlugin(serverId, pluginId);
const requestedScreen = subject.kind === "installed" ? subject.screenId : undefined;
const screenId = requestedScreen ?? installedPlugin?.settingsScreens[0]?.id;
return (plugin || installedPlugin) && screenId ? { pluginId, screenId } : undefined;
}
function subjectId(subject: PluginPageSubject): string {
return subject.kind === "listing" ? subject.listingId : subject.pluginId;
}
@@ -419,9 +408,6 @@ export function PluginPage({
const { t } = useTranslation();
const compact = useIsCompactFormFactor();
const { plugin, listingId, listing, detail, loading } = useResolvedPlugin(serverId, subject);
const settings = usePluginPageSettings(serverId, subject, plugin);
const catalogStatus = usePluginCatalogStatus(serverId);
const connected = useHostRuntimeIsConnected(serverId);
const installOperation = usePluginOperation(serverId, listingId);
const model = usePluginPageModel({
serverId,
@@ -450,20 +436,14 @@ export function PluginPage({
<SettingsBackLink label={t("settings.plugins.screens.backToPlugins")} onPress={onBack} />
</View>
);
const waitingForSettings =
subject.kind === "installed" &&
!plugin &&
!settings &&
connected &&
catalogStatus === "loading";
if (loading || waitingForSettings)
if (loading)
return (
<View>
{back}
<PluginPageSkeleton />
</View>
);
if (!plugin && !listing && !settings)
if (!plugin && !listing)
return (
<Alert
size="sm"
@@ -506,7 +486,6 @@ export function PluginPage({
listing={listing}
overviewLoading={detail.isLoading}
model={model}
settings={settings}
/>
{installTarget ? (
<InstallPluginSheet serverId={serverId} target={installTarget} onClose={closeInstall} />
@@ -521,14 +500,12 @@ function PluginPageBody({
listing,
overviewLoading,
model,
settings,
}: {
serverId: string;
plugin?: PluginListItem;
listing?: PluginListing;
overviewLoading: boolean;
model: PluginPageModel;
settings?: { pluginId: string; screenId: string };
}) {
const { t } = useTranslation();
return (
@@ -546,9 +523,9 @@ function PluginPageBody({
</View>
) : null}
{listing ? <MediaStrip urls={listingImages(listing)} /> : null}
{settings ? (
{plugin && model.screenId ? (
// The plugin's settings screen brings its own sections.
<PluginSettingsContent serverId={serverId} {...settings} />
<PluginSettingsContent serverId={serverId} pluginId={plugin.id} screenId={model.screenId} />
) : null}
{model.overview || (listing && overviewLoading) ? (
<SettingsSection title={t("settings.plugins.gallery.sections.overview")}>
+1 -14
View File
@@ -10,7 +10,7 @@
* A ratio keeps the step equally visible on every base; a lightness delta disappears near black.
* The numbers come from the default themes: Paseo dark and Light.
*/
import { contrastRatio, mixHexColors, stepContrast, translucentStep } from "@/utils/color";
import { contrastRatio, mixHexColors, stepContrast } from "@/utils/color";
export type ColorScheme = "light" | "dark";
@@ -19,11 +19,6 @@ const SURFACE_STATE_STEPS = {
light: { hover: 1.15, selected: 1.35 },
} as const;
// The 1px line under each open folder in a tree, measured on the sidebar. It starts above the
// selected fill so a hovered row does not swallow it. Light needs the larger step to read as the
// same weight.
const TREE_GUIDE_STEPS = { dark: 1.35, light: 1.47 } as const;
// Fills for chips, bubbles, tracks and secondary buttons, as `surface3` and `surface4`.
const NEUTRAL_FILL_STEPS = {
dark: { surface3: 1.8, surface4: 2.5 },
@@ -58,14 +53,6 @@ export function deriveSurfaceStates(
};
}
/**
* Translucent, because trees also sit on the page, workspace panes and sheets. A solid color picked
* for the sidebar fades on those.
*/
export function deriveTreeGuide(sidebar: string, foreground: string, scheme: ColorScheme): string {
return translucentStep(sidebar, foreground, TREE_GUIDE_STEPS[scheme]);
}
/** The neutral fills that sit on the page background. */
export function deriveNeutralFills(
background: string,
+1 -28
View File
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import type { PluginThemeContribution } from "@getpaseo/plugin";
import { buildPluginTheme } from "@/plugins/themes";
import { contrastRatio, mixHexColors } from "@/utils/color";
import { contrastRatio } from "@/utils/color";
import { THEME_OPTIONS, type Theme } from "./theme";
// Palettes of the plugin themes users run into: Catppuccin (the e2e fixture) and
@@ -92,21 +92,10 @@ const SELECTED_TEXT_FLOOR = 2.5;
const NEUTRAL_FILL_STEP = 1.2;
const NEUTRAL_FILL_TEXT_FLOOR = 3;
const TERTIARY_TEXT_FLOOR = 2.5;
// A tree guide is one quiet line in every theme. Trees also sit on the page, a workspace pane and
// a hovered row, and the line has to stay a line on all of them.
const TREE_GUIDE_STEP = { dark: 1.35, light: 1.47 };
const TREE_GUIDE_FLOOR = 1.18;
// The bright hues are dim on a cream or white background by design; the floor only has to catch a
// color that disappears.
const TERMINAL_COLOR_FLOOR = 1.5;
/** The color a translucent `rgba()` token shows once painted over `surface`. */
function paintedOver(surface: string, token: string): string {
const [r, g, b, alpha] = (token.match(/[\d.]+/g) ?? []).map(Number);
const ink = `#${[r, g, b].map((channel) => channel.toString(16).padStart(2, "0")).join("")}`;
return mixHexColors(surface, ink, alpha);
}
it("keeps Solarized Dark's selected workspace timestamp readable", () => {
const { colors } = buildPluginTheme(SOLARIZED_DARK);
expect(
@@ -129,22 +118,6 @@ describe.each(themes)("$name", ({ theme }) => {
).toBeGreaterThanOrEqual(SELECTED_OVER_HOVER_STEP);
});
it("draws tree guides at the same strength on the sidebar", () => {
const painted = paintedOver(colors.surfaceSidebar, colors.treeGuide);
expect(contrastRatio(colors.surfaceSidebar, painted)).toBeCloseTo(
TREE_GUIDE_STEP[theme.colorScheme],
1,
);
});
it.each(["surfaceSidebarHover", "surface0", "surfaceWorkspace"] as const)(
"keeps tree guides visible on %s",
(surface) => {
const painted = paintedOver(colors[surface], colors.treeGuide);
expect(contrastRatio(colors[surface], painted)).toBeGreaterThanOrEqual(TREE_GUIDE_FLOOR);
},
);
it("keeps the selected row's title readable", () => {
const onSidebar = contrastRatio(colors.foreground, colors.surfaceSidebar);
const onSelected = contrastRatio(colors.foreground, colors.surfaceSidebarSelected);
+1 -3
View File
@@ -1,7 +1,7 @@
import { Platform, type ViewStyle } from "react-native";
import { isWeb } from "@/constants/platform";
import { darkHighlightColors, lightHighlightColors } from "@getpaseo/highlight";
import { deriveSurfaceStates, deriveTreeGuide } from "./derive-colors";
import { deriveSurfaceStates } from "./derive-colors";
export const baseColors = {
// Base colors
@@ -276,7 +276,6 @@ export function buildLightSemanticColors(tint: LightThemeConfig) {
surfaceSidebarSelected: tint.surfaceSidebarSelected ?? sidebarStates.selected,
foregroundSidebarHover: tint.foregroundSidebarHover ?? tint.foregroundExtraMuted,
foregroundSidebarSelected: tint.foregroundSidebarSelected ?? tint.foregroundExtraMuted,
treeGuide: deriveTreeGuide(tint.surfaceSidebar, tint.foreground, "light"),
surfaceWorkspace: tint.surface0,
interactionHighlight: "rgba(0, 0, 0, 0.06)",
@@ -405,7 +404,6 @@ export function buildDarkSemanticColors(tint: DarkThemeConfig) {
surfaceSidebarSelected: tint.surfaceSidebarSelected ?? sidebarStates.selected,
foregroundSidebarHover: tint.foregroundSidebarHover ?? tint.foregroundExtraMuted,
foregroundSidebarSelected: tint.foregroundSidebarSelected ?? tint.foregroundExtraMuted,
treeGuide: deriveTreeGuide(tint.surfaceSidebar, foreground, "dark"),
surfaceWorkspace: tint.surface1,
interactionHighlight: "rgba(255, 255, 255, 0.08)",
-16
View File
@@ -159,22 +159,6 @@ export function stepContrast(hex: string, toward: string, ratio: number): string
return `#${channels.join("")}`;
}
/**
* `ink` made translucent enough to sit at `ratio` WCAG contrast from `surface` once painted on it.
* Unlike `stepContrast`, the result follows whatever it is painted over, so it keeps its weight on
* neighbouring surfaces too.
*/
export function translucentStep(surface: string, ink: string, ratio: number): string {
let low = 0;
let high = 1;
for (let step = 0; step < 8; step += 1) {
const middle = (low + high) / 2;
if (contrastRatio(surface, mixHexColors(surface, ink, middle)) < ratio) low = middle;
else high = middle;
}
return hexColorWithAlpha(mixHexColors(ink, ink, 0), Number(high.toFixed(3)));
}
/** Blends `hex` toward `toward` by `amount` (0 keeps `hex`, 1 is `toward`) in sRGB. */
export function mixHexColors(hex: string, toward: string, amount: number): string {
const from = requireRgb(hex);
@@ -4508,6 +4508,70 @@ describe("ClaudeAgentSession context window usage", () => {
}
});
test("settles the first tool call after a compaction whose summary is synthetic", async () => {
// Claude Code 2.1.330 sends the compaction summary as a user message marked isSynthetic
// (seen live after /compact), so it is skipped before it can consume the compaction state.
const session = await createSessionForTurns([
[
createCompactingStatus(),
createCompactBoundary({ compact_metadata: { trigger: "auto", pre_tokens: 167_000 } }),
{
type: "user",
parent_tool_use_id: null,
isSynthetic: true,
message: {
role: "user",
content: "This session is being continued from a previous conversation.",
},
uuid: "compact-summary-1",
session_id: "session-1",
},
{
type: "assistant",
parent_tool_use_id: null,
message: {
role: "assistant",
content: [
{
type: "tool_use",
id: "toolu-after-compact",
name: "Bash",
input: { command: "ls" },
},
],
},
uuid: "assistant-after-compact",
session_id: "session-1",
},
{
type: "user",
parent_tool_use_id: null,
message: {
role: "user",
content: [{ type: "tool_result", tool_use_id: "toolu-after-compact", content: "a.go" }],
},
uuid: "tool-result-after-compact",
session_id: "session-1",
},
createSuccessResult(),
],
]);
try {
const events = await collectStreamEvents(session, "keep working");
const statuses = events.flatMap((event) =>
event.type === "timeline" &&
event.item.type === "tool_call" &&
event.item.callId === "toolu-after-compact"
? [event.item.status]
: [],
);
expect(statuses).toEqual(["running", "completed"]);
} finally {
await session.close();
}
});
test("reports the plan mode Claude enters on its own with EnterPlanMode", async () => {
// Claude Code announces a mode it switched to itself as a status message
// carrying the new permissionMode, right after the EnterPlanMode tool call.
@@ -2698,7 +2698,6 @@ class ClaudeAgentSession implements AgentSession {
private lastOptionsModel: string | null = null;
private lastRuntimeModel: string | null = null;
private readonly resultMeter = new ClaudeResultMeter();
private compacting = false;
private compactionMarkerOpen = false;
private queryPumpPromise: Promise<void> | null = null;
private queryRestartNeeded = false;
@@ -5468,7 +5467,6 @@ class ClaudeAgentSession implements AgentSession {
}
const status = toObjectRecord(message)?.status;
if (status === "compacting") {
this.compacting = true;
// Claude Code repeats this status every 30 seconds until the compaction
// finishes. Each repeat used to open its own marker, and the app only ever
// resolves one of them, so the rest stayed on "Compacting..." forever.
@@ -5554,11 +5552,10 @@ class ClaudeAgentSession implements AgentSession {
message: Extract<SDKMessage, { type: "user" }>,
events: AgentStreamEvent[],
): Promise<void> {
if (isSyntheticUserEntry(message)) {
return;
}
if (this.compacting) {
this.compacting = false;
// The compaction summary is skipped by what it is, never by being the next user message:
// Claude marks it synthetic (isCompactSummary in older streams), and a position-based skip
// swallowed the first tool result after every compaction instead.
if (isSyntheticUserEntry(message) || toObjectRecord(message)?.isCompactSummary === true) {
return;
}
const messageId =
@@ -2672,19 +2672,11 @@ it.each([false, true])(
process.stdout.write(Array.from({ length: count }, nextRow).join(""));
}
process.stdout.write("READY\\r\\n");
// A PTY can split one input write across reads (ConPTY does on Windows),
// so match commands against everything read so far, not one chunk.
let input = "";
process.stdin.on("data", data => {
input += data.toString();
if (input.includes("BURST")) {
input = "";
if(data.toString().includes("BURST")) {
for (let i = 0; i < 4000; i++) process.stdout.write(nextRow());
process.stdout.write("BURST-DONE\\r\\n");
} else if (input.includes("AFTER-CATCH-UP")) {
input = "";
process.stdout.write("ECHO:AFTER-CATCH-UP\\r\\n");
}
} else process.stdout.write("ECHO:" + data.toString() + "\\r\\n");
});
setInterval(()=>{},1000);
`),