The open source coding agent.
TypeScript
chore: cleanup
Adamed96ae9d4563
diff --git a/packages/desktop/src/components/prompt-input.tsx b/packages/desktop/src/components/prompt-input.tsxindex f3f7581024a..595f0797232 100644--- a/packages/desktop/src/components/prompt-input.tsx+++ b/packages/desktop/src/components/prompt-input.tsx@@ -414,7 +414,6 @@ export const PromptInput: Component<PromptInputProps> = (props) => {const rawText = rawParts.map((p) => ("content" in p ? p.content : "")).join("")const atMatch = rawText.substring(0, cursorPosition).match(/@(\S*)$/)- // Slash commands only trigger when / is at the start of inputconst slashMatch = rawText.match(/^\/(\S*)$/)if (atMatch) {@@ -675,7 +674,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {if (text.startsWith("/")) {const [cmdName, ...args] = text.split(" ")- const commandName = cmdName.slice(1) // Remove leading "/"+ const commandName = cmdName.slice(1)const customCommand = sync.data.command.find((c) => c.name === commandName)if (customCommand) {sdk.client.session.command({diff --git a/packages/desktop/src/pages/layout.tsx b/packages/desktop/src/pages/layout.tsxindex d10eadea9c2..a31a41732a5 100644--- a/packages/desktop/src/pages/layout.tsx+++ b/packages/desktop/src/pages/layout.tsx@@ -100,7 +100,6 @@ export default function Layout(props: ParentProps) {const currentDirectory = params.dir ? base64Decode(params.dir) : undefinedconst projectIndex = currentDirectory ? projects.findIndex((p) => p.worktree === currentDirectory) : -1- // If we're not in any project, navigate to the first/last project based on directionif (projectIndex === -1) {const targetProject = offset > 0 ? projects[0] : projects[projects.length - 1]if (targetProject) navigateToProject(targetProject.worktree)@@ -110,16 +109,13 @@ export default function Layout(props: ParentProps) {const sessions = currentSessions()const sessionIndex = params.id ? sessions.findIndex((s) => s.id === params.id) : -1- // Calculate target index within current projectlet targetIndex: numberif (sessionIndex === -1) {- // Not on a session - go to first session for "next", last session for "prev"targetIndex = offset > 0 ? 0 : sessions.length - 1} else {targetIndex = sessionIndex + offset}- // If target is within bounds, navigate to that sessionif (targetIndex >= 0 && targetIndex < sessions.length) {const session = sessions[targetIndex]navigateToSession(session)@@ -127,19 +123,16 @@ export default function Layout(props: ParentProps) {return}- // Navigate to adjacent projectconst nextProjectIndex = projectIndex + (offset > 0 ? 1 : -1)const nextProject = projects[nextProjectIndex]if (!nextProject) returnconst nextProjectSessions = flattenSessions(globalSync.child(nextProject.worktree)[0].session ?? [])if (nextProjectSessions.length === 0) {- // Navigate to the project's new session page if no sessionsnavigateToProject(nextProject.worktree)return}- // If going down (offset > 0), go to first session; if going up (offset < 0), go to last sessionconst targetSession = offset > 0 ? nextProjectSessions[0] : nextProjectSessions[nextProjectSessions.length - 1]navigate(`/${base64Encode(nextProject.worktree)}/session/${targetSession.id}`)queueMicrotask(() => scrollToSession(targetSession.id))@@ -149,7 +142,6 @@ export default function Layout(props: ParentProps) {const [store, setStore] = globalSync.child(session.directory)const sessions = store.session ?? []const index = sessions.findIndex((s) => s.id === session.id)- // Get next session (prefer next, then prev) before removingconst nextSession = sessions[index + 1] ?? sessions[index - 1]await globalSDK.client.session.update({diff --git a/packages/desktop/src/pages/session.tsx b/packages/desktop/src/pages/session.tsxindex 11056a598c8..9e5435f618f 100644--- a/packages/desktop/src/pages/session.tsx+++ b/packages/desktop/src/pages/session.tsx@@ -145,14 +145,10 @@ export default function Page() {}})- // Auto-navigate to new messages when they're added- // This handles the case after undo + submit where we want to see the new message- // We track the last message ID and only navigate when a NEW message is added (ID increases)createEffect(on(() => visibleUserMessages().at(-1)?.id,(lastId, prevLastId) => {- // Only navigate if a new message was added (lastId is greater/newer than previous)if (lastId && prevLastId && lastId > prevLastId) {setMessageStore("messageId", undefined)}@@ -321,8 +317,7 @@ export default function Page() {])const handleKeyDown = (event: KeyboardEvent) => {- // @ts-expect-error- if (document.activeElement?.dataset?.component === "terminal") return+ if ((document.activeElement as HTMLElement)?.dataset?.component === "terminal") returnif (dialog.stack.length > 0) returnif (event.key === "PageUp" || event.key === "PageDown") {diff --git a/packages/ui/src/components/session-turn.tsx b/packages/ui/src/components/session-turn.tsxindex 2df324eefac..1ea87a84fab 100644--- a/packages/ui/src/components/session-turn.tsx+++ b/packages/ui/src/components/session-turn.tsx@@ -64,9 +64,6 @@ export function SessionTurn(if (!scrollRef) returnif (state.autoScrolling) returnconst { scrollTop, scrollHeight, clientHeight } = scrollRef- // prevents scroll loops - only update scrollY if we have meaningful scroll room- // the gap clamp shrinks by 0.48px per pixel scrolled, hitting min at ~71px scroll- // we need at least that much scroll headroom beyond the current scroll positionconst scrollRoom = scrollHeight - clientHeightif (scrollRoom > 100) {setState("scrollY", scrollTop)