wip: tool call structure investigation and e2e tests
- Add debug logging for tool call payloads in agent-stream-view - Add e2e tests to verify tool call structure for Claude and Codex agents - Include sidebar toggle and horizontal scroll improvements from previous work 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
351735a71b
commit
4f3b2317ab
@@ -0,0 +1,68 @@
|
||||
import { createContext, useContext, useCallback, useRef, type ReactNode } from "react";
|
||||
import { useSharedValue, type SharedValue } from "react-native-reanimated";
|
||||
|
||||
interface HorizontalScrollContextValue {
|
||||
// Shared value indicating if any registered horizontal scroll is scrolled (offset > 0)
|
||||
isAnyScrolledRight: SharedValue<boolean>;
|
||||
// Register a scroll view's offset - returns an unregister function
|
||||
registerScrollOffset: (id: string, offset: number) => void;
|
||||
unregisterScrollOffset: (id: string) => void;
|
||||
}
|
||||
|
||||
const HorizontalScrollContext = createContext<HorizontalScrollContextValue | null>(null);
|
||||
|
||||
export function HorizontalScrollProvider({ children }: { children: ReactNode }) {
|
||||
const isAnyScrolledRight = useSharedValue(false);
|
||||
const scrollOffsetsRef = useRef<Map<string, number>>(new Map());
|
||||
|
||||
const updateIsAnyScrolled = useCallback(() => {
|
||||
let anyScrolled = false;
|
||||
for (const offset of scrollOffsetsRef.current.values()) {
|
||||
if (offset > 1) {
|
||||
anyScrolled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
isAnyScrolledRight.value = anyScrolled;
|
||||
}, [isAnyScrolledRight]);
|
||||
|
||||
const registerScrollOffset = useCallback(
|
||||
(id: string, offset: number) => {
|
||||
scrollOffsetsRef.current.set(id, offset);
|
||||
updateIsAnyScrolled();
|
||||
},
|
||||
[updateIsAnyScrolled]
|
||||
);
|
||||
|
||||
const unregisterScrollOffset = useCallback(
|
||||
(id: string) => {
|
||||
scrollOffsetsRef.current.delete(id);
|
||||
updateIsAnyScrolled();
|
||||
},
|
||||
[updateIsAnyScrolled]
|
||||
);
|
||||
|
||||
return (
|
||||
<HorizontalScrollContext.Provider
|
||||
value={{
|
||||
isAnyScrolledRight,
|
||||
registerScrollOffset,
|
||||
unregisterScrollOffset,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</HorizontalScrollContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function useHorizontalScroll() {
|
||||
const context = useContext(HorizontalScrollContext);
|
||||
if (!context) {
|
||||
throw new Error("useHorizontalScroll must be used within HorizontalScrollProvider");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
export function useHorizontalScrollOptional() {
|
||||
return useContext(HorizontalScrollContext);
|
||||
}
|
||||
Reference in New Issue
Block a user