Schema
The shapes Weevar uses internally
This is useful if you're customizing prompt templates or building tooling around Weevar's output.
Element identity#
type ElementIdentity = {
fiberPath?: FiberPathSegment[];
source?: SourceLocation;
domPath: DomPathSegment[];
tag: string;
classList: string[];
contentHash: string;
label: string;
componentName?: string;
testId?: string;
textSnippet?: string;
inPortal?: boolean;
};
type FiberPathSegment = {
componentName?: string;
key?: string | number | null;
index: number;
source?: SourceLocation;
};
type DomPathSegment = {
tag: string;
index: number;
classes?: string[];
};
type SourceLocation = {
file: string;
line: number;
col: number;
};
contentHash is a short fingerprint of the element's text content. It's used as a tie-breaker when DOM paths alone aren't unique.
inPortal is true when the element is rendered through a React portal; useful in prompts because portal children live in a different DOM subtree from their parent.
Layout change#
A single drop produces one of these:
type LayoutChange =
| LayoutChangeReorder
| LayoutChangeMove;
type LayoutChangeReorder = {
kind: "reorder";
target: ElementIdentity;
parent: ElementIdentity;
fromIndex: number;
toIndex: number;
siblings: ElementIdentity[]; // in new order, including the target
layoutType: LayoutType;
};
type LayoutChangeMove = {
kind: "move";
target: ElementIdentity;
fromParent: ElementIdentity;
toParent: ElementIdentity;
fromIndex: number;
toIndex: number;
destinationSiblings?: ElementIdentity[];
fromLayoutType: LayoutType;
toLayoutType: LayoutType;
};
type LayoutType = {
display: string; // "flex" | "grid" | "block" | "inline-flex" | …
flexDirection?: string; // "row" | "column" | "row-reverse" | "column-reverse"
};
Layout type comes from getComputedStyle(parent) at the moment of the drop.
Batched changes#
When you make several moves in one session, they’re grouped:
type BatchedChange = {
ordinal: number;
change: LayoutChange;
badgeAnchor: ElementIdentity;
capturedAt: number;
};
type MoveSession = {
changes: BatchedChange[];
startedAt: number;
};
Repeated moves of the same target are collapsed at prompt-generation time, the prompt describes the net displacement, not every intermediate position.
Generated prompt#
type GeneratedPrompt = {
short: string;
detailed: string;
meta: {
targetTool: "claude-code" | "codex" | "generic";
timestamp: number;
change: LayoutChange;
};
};
type TargetTool = "claude-code" | "codex" | "generic";
type PromptLength = "short" | "detailed";
The Prompt tray copies whichever string matches the user's current Settings.