Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat(web): refine home pet work states (#239)
Jeffrey Deng23713bc26fbd
diff --git a/.github/assets/pet-work-state-animations.svg b/.github/assets/pet-work-state-animations.svgnew file mode 100644index 000000000..1bb42260c--- /dev/null+++ b/.github/assets/pet-work-state-animations.svg@@ -0,0 +1,134 @@+<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="820" viewBox="0 0 1280 820" role="img" aria-labelledby="title desc">+ <title id="title">A-Look PET work-state animation map</title>+ <desc id="desc">A diagram of the PET animations added for platform work state, user typing, notifications, idle, dozing, sleeping, and wake-up transitions.</desc>+ <defs>+ <style>+ .bg { fill: #f7f4ec; }+ .panel { fill: #fffdf8; stroke: #2e2a24; stroke-width: 2; }+ .hub { fill: #2e2a24; }+ .hubText { fill: #fffdf8; font: 700 24px Inter, Arial, sans-serif; }+ .title { fill: #2e2a24; font: 800 34px Inter, Arial, sans-serif; }+ .subtitle { fill: #655d52; font: 500 16px Inter, Arial, sans-serif; }+ .label { fill: #2e2a24; font: 800 18px Inter, Arial, sans-serif; }+ .body { fill: #5b4636; font: 500 13px Inter, Arial, sans-serif; }+ .small { fill: #655d52; font: 600 12px Inter, Arial, sans-serif; }+ .line { stroke: #2e2a24; stroke-width: 2.5; fill: none; }+ .dash { stroke: #9c8f7b; stroke-width: 2; stroke-dasharray: 5 6; fill: none; }+ .chip { fill: #e9dfcc; stroke: #2e2a24; stroke-width: 1.5; }+ .accent1 { fill: #f2b84b; }+ .accent2 { fill: #84b7a5; }+ .accent3 { fill: #d97d54; }+ .accent4 { fill: #8da0cb; }+ .shadow { fill: #000; opacity: 0.08; }+ .petBody { fill: #c98245; stroke: #2e2a24; stroke-width: 3; }+ .petFace { fill: #f5d3a3; stroke: #2e2a24; stroke-width: 3; }+ .eye { fill: #2e2a24; }+ .sleep { fill: none; stroke: #2e2a24; stroke-width: 4; stroke-linecap: round; }+ </style>+ <marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">+ <path d="M 0 0 L 10 5 L 0 10 z" fill="#2e2a24"/>+ </marker>+ </defs>++ <rect class="bg" width="1280" height="820"/>+ <text class="title" x="64" y="62">A-Look PET: platform-driven animation states</text>+ <text class="subtitle" x="64" y="91">Each motion is triggered by A-Look workspace signals, not random behavior.</text>++ <rect class="panel" x="475" y="300" width="330" height="180" rx="22"/>+ <ellipse class="shadow" cx="640" cy="456" rx="86" ry="18"/>+ <circle class="petFace" cx="640" cy="370" r="58"/>+ <ellipse class="petBody" cx="640" cy="440" rx="55" ry="44"/>+ <circle class="eye" cx="618" cy="358" r="7"/>+ <circle class="eye" cx="662" cy="358" r="7"/>+ <path class="sleep" d="M620 390 Q640 402 660 390"/>+ <text class="hubText" x="541" y="332">PET state resolver</text>+ <text class="small" x="526" y="503">Input: agents, typing, unread count, click, quiet time</text>++ <path class="line" marker-end="url(#arrow)" d="M475 352 C390 330 340 300 293 245"/>+ <path class="line" marker-end="url(#arrow)" d="M510 300 C455 224 398 172 310 142"/>+ <path class="line" marker-end="url(#arrow)" d="M616 300 C600 218 570 165 516 124"/>+ <path class="line" marker-end="url(#arrow)" d="M766 300 C817 218 876 168 967 142"/>+ <path class="line" marker-end="url(#arrow)" d="M805 362 C897 340 956 300 1010 238"/>+ <path class="line" marker-end="url(#arrow)" d="M805 434 C902 470 965 518 1014 590"/>+ <path class="line" marker-end="url(#arrow)" d="M650 480 C660 562 690 625 748 678"/>+ <path class="line" marker-end="url(#arrow)" d="M520 474 C430 534 360 598 298 681"/>++ <g transform="translate(64 160)">+ <rect class="panel" width="260" height="132" rx="18"/>+ <circle class="chip accent2" cx="36" cy="38" r="18"/>+ <text class="label" x="68" y="42">Idle breathe</text>+ <text class="body" x="24" y="73">Trigger: no active agent task</text>+ <text class="body" x="24" y="93">and user is not typing.</text>+ <text class="small" x="24" y="116">Eyes follow cursor; body leans lightly.</text>+ </g>++ <g transform="translate(64 42)">+ <rect class="panel" width="260" height="98" rx="18"/>+ <circle class="chip accent1" cx="36" cy="36" r="18"/>+ <text class="label" x="68" y="40">Typing</text>+ <text class="body" x="24" y="72">Trigger: user focuses and types in input.</text>+ </g>++ <g transform="translate(390 48)">+ <rect class="panel" width="282" height="118" rx="18"/>+ <circle class="chip accent4" cx="36" cy="38" r="18"/>+ <text class="label" x="68" y="42">Working</text>+ <text class="body" x="24" y="73">Trigger: any A-Look agent is running.</text>+ <text class="small" x="24" y="96">1 task: coding; 2: juggling; 3+: building.</text>+ </g>++ <g transform="translate(922 42)">+ <rect class="panel" width="294" height="116" rx="18"/>+ <circle class="chip accent3" cx="36" cy="38" r="18"/>+ <text class="label" x="68" y="42">Notification</text>+ <text class="body" x="24" y="73">Trigger: unread count increases.</text>+ <text class="small" x="24" y="96">Uses the original bell animation only.</text>+ </g>++ <g transform="translate(956 172)">+ <rect class="panel" width="260" height="132" rx="18"/>+ <circle class="chip accent1" cx="36" cy="38" r="18"/>+ <text class="label" x="68" y="42">Attention</text>+ <text class="body" x="24" y="73">Trigger: fresh platform event</text>+ <text class="body" x="24" y="93">needs the user's attention.</text>+ <text class="small" x="24" y="116">Short reaction, then returns to state.</text>+ </g>++ <g transform="translate(946 560)">+ <rect class="panel" width="282" height="132" rx="18"/>+ <circle class="chip accent4" cx="36" cy="38" r="18"/>+ <text class="label" x="68" y="42">Waking</text>+ <text class="body" x="24" y="73">Trigger: click sleeping PET, typing,</text>+ <text class="body" x="24" y="93">agent work, or a new notification.</text>+ <text class="small" x="24" y="116">One-shot stand-up animation.</text>+ </g>++ <g transform="translate(644 656)">+ <rect class="panel" width="292" height="124" rx="18"/>+ <circle class="chip accent2" cx="36" cy="38" r="18"/>+ <text class="label" x="68" y="42">Sleeping</text>+ <text class="body" x="24" y="73">Trigger: quiet after dozing.</text>+ <text class="small" x="24" y="96">Closed eyes for special models too.</text>+ </g>++ <g transform="translate(64 640)">+ <rect class="panel" width="282" height="124" rx="18"/>+ <circle class="chip accent3" cx="36" cy="38" r="18"/>+ <text class="label" x="68" y="42">Dozing / Yawning</text>+ <text class="body" x="24" y="73">Trigger: no work and no typing</text>+ <text class="body" x="24" y="93">for the quiet threshold.</text>+ <text class="small" x="24" y="116">One-shot lie-down transition.</text>+ </g>++ <g transform="translate(420 610)">+ <rect class="panel" width="196" height="130" rx="18"/>+ <text class="label" x="24" y="38">Extra work poses</text>+ <text class="body" x="24" y="68">Error: task failure.</text>+ <text class="body" x="24" y="88">Sweeping: cleanup.</text>+ <text class="body" x="24" y="108">Carrying: moving bundle.</text>+ </g>++ <path class="dash" d="M774 682 C850 650 906 624 946 608"/>+ <path class="dash" d="M240 640 C300 566 388 504 518 460"/>+ <text class="small" x="990" y="730">All transitions use the existing SVG PET parts.</text>+</svg>diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet-activity-data.ts b/src/web/src/components/home-pet/cloud-code-monster-pet-activity-data.tsindex 3ead76258..bd069a01a 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet-activity-data.ts+++ b/src/web/src/components/home-pet/cloud-code-monster-pet-activity-data.ts@@ -1,12 +1,31 @@import type { CloudCodeMonsterActivity, CloudCodeMonsterActivityId } from "./cloud-code-monster-pet-types";export const CLOUD_CODE_MONSTER_ACTIVITIES: CloudCodeMonsterActivity[] = [+ { id: "attention", label: "Attention", caption: "Celebrating a finished task" },+ { id: "building", label: "Building", caption: "Coordinating several agents" },+ { id: "carrying", label: "Carrying", caption: "Moving a fresh workspace bundle" },{ id: "coding", label: "Coding", caption: "Tapping through a small patch" },- { id: "sleeping", label: "Sleeping", caption: "Taking a short workspace nap" },+ { id: "dozing", label: "Dozing", caption: "Getting ready to sleep" },+ { id: "error", label: "Error", caption: "A task needs attention" },+ { id: "juggling", label: "Juggling", caption: "Keeping multiple agent tasks in motion" },+ { id: "notification", label: "Notification", caption: "Ringing for a new unread message" },{ id: "reading", label: "Reading", caption: "Flipping through a thick doc" },{ id: "phone", label: "On phone", caption: "Checking a tiny glowing screen" },{ id: "thinking", label: "Thinking", caption: "Processing a background thought" },{ id: "snacking", label: "Snacking", caption: "Chewing on a little energy block" },+ { id: "sweeping", label: "Sweeping", caption: "Tidying up workspace context" },+ { id: "typing", label: "Typing", caption: "Following the user's live input" },+ { id: "waking", label: "Waking", caption: "Coming back online" },+ { id: "yawning", label: "Yawning", caption: "Powering down after quiet time" },+];++export const CLOUD_CODE_MONSTER_WORKING_ACTIVITY_IDS: readonly CloudCodeMonsterActivityId[] = [+ "building",+ "coding",+ "juggling",+ "thinking",+ "reading",+ "typing",];export const CLOUD_CODE_MONSTER_AUTOWALK_ACTIVITY_IDS: readonly CloudCodeMonsterActivityId[] = [diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet-activity.ts b/src/web/src/components/home-pet/cloud-code-monster-pet-activity.tsindex ad5086fbf..3de17ed00 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet-activity.ts+++ b/src/web/src/components/home-pet/cloud-code-monster-pet-activity.ts@@ -1,6 +1,7 @@import {CLOUD_CODE_MONSTER_ACTIVITIES,CLOUD_CODE_MONSTER_AUTOWALK_ACTIVITY_IDS,+ CLOUD_CODE_MONSTER_WORKING_ACTIVITY_IDS,} from "./cloud-code-monster-pet-activity-data";import {CLOUD_CODE_MONSTER_ACTIVITY_REFRESH_MS,@@ -82,6 +83,44 @@ export function shouldCloudCodeMonsterAutoWalk();}+function isCloudCodeMonsterWorkingActivity(+ activityId: CloudCodeMonsterActivityId | null+) {+ return (+ activityId !== null &&+ CLOUD_CODE_MONSTER_WORKING_ACTIVITY_IDS.includes(activityId)+ );+}++export function resolveCloudCodeMonsterAgentWorkState(+ activeTaskCount: number,+ current: StoredCloudCodeMonsterActivity | null,+ now = Date.now()+): StoredCloudCodeMonsterActivity {+ if (activeTaskCount <= 0) {+ return current?.activityId === "sleeping"+ ? current+ : createCloudCodeMonsterIdleState(now);+ }++ if (isCloudCodeMonsterWorkingActivity(current?.activityId ?? null)) {+ return {+ activityId: current!.activityId,+ updatedAt: current!.updatedAt,+ hiddenAt: null,+ };+ }++ const activityId =+ activeTaskCount >= 3 ? "building" : activeTaskCount >= 2 ? "juggling" : "coding";++ return {+ activityId,+ updatedAt: now,+ hiddenAt: null,+ };+}+export function createCloudCodeMonsterWalkVelocity(randomValue = Math.random(),speed = CLOUD_CODE_MONSTER_AUTO_WALK_SPEED@@ -151,8 +190,7 @@ export function reflectCloudCodeMonsterWalk(export function resolveCloudCodeMonsterActivityState(stored: StoredCloudCodeMonsterActivity | null,- now = Date.now(),- randomValue = Math.random()+ now = Date.now()): StoredCloudCodeMonsterActivity {if (stored &&@@ -163,18 +201,24 @@ export function resolveCloudCodeMonsterActivityState(return stored;}+ return createCloudCodeMonsterIdleState(now);+}++export function createCloudCodeMonsterIdleState(+ now = Date.now()+): StoredCloudCodeMonsterActivity {return {- activityId: pickCloudCodeMonsterActivity(randomValue).id,+ activityId: null,updatedAt: now,hiddenAt: null,};}-export function createCloudCodeMonsterIdleState(+export function createCloudCodeMonsterSleepingState(now = Date.now()): StoredCloudCodeMonsterActivity {return {- activityId: null,+ activityId: "sleeping",updatedAt: now,hiddenAt: null,};@@ -205,28 +249,21 @@ export function createCloudCodeMonsterPreviewAwayState(export function resolveCloudCodeMonsterPreviewComebackState(- now = Date.now(),- randomValue = Math.random()+ now = Date.now()) {return resolveCloudCodeMonsterVisibleState(createCloudCodeMonsterPreviewAwayState(now),- now,- randomValue+ now);}export function resolveCloudCodeMonsterVisibleState(stored: StoredCloudCodeMonsterActivity | null,- now = Date.now(),- randomValue = Math.random()+ now = Date.now()): StoredCloudCodeMonsterActivity {if (stored?.hiddenAt) {if (shouldRefreshCloudCodeMonsterActivity(stored.hiddenAt, now)) {- return {- activityId: pickCloudCodeMonsterActivity(randomValue).id,- updatedAt: now,- hiddenAt: null,- };+ return createCloudCodeMonsterIdleState(now);}return {@@ -237,7 +274,7 @@ export function resolveCloudCodeMonsterVisibleState(}if (!stored) {- return resolveCloudCodeMonsterActivityState(stored, now, randomValue);+ return resolveCloudCodeMonsterActivityState(stored, now);}return {@@ -376,7 +413,7 @@ export function getCloudCodeMonsterExpression(return "shocked";}- if (activityId === "sleeping") {+ if (activityId === "sleeping" || activityId === "dozing" || activityId === "yawning") {return "sleeping";}diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet-constants.ts b/src/web/src/components/home-pet/cloud-code-monster-pet-constants.tsindex ffbf5961d..2eee361f1 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet-constants.ts+++ b/src/web/src/components/home-pet/cloud-code-monster-pet-constants.ts@@ -9,6 +9,11 @@ export const CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT =export const CLOUD_CODE_MONSTER_REACTION_MS = 900;export const CLOUD_CODE_MONSTER_SHAKE_REACTION_MS = 680;export const CLOUD_CODE_MONSTER_FAINT_MS = 10_000;+export const CLOUD_CODE_MONSTER_ATTENTION_MS = 4_000;+export const CLOUD_CODE_MONSTER_ERROR_MS = 5_000;+export const CLOUD_CODE_MONSTER_DOZE_MS = 20_000;+export const CLOUD_CODE_MONSTER_NO_WORK_SLEEP_MS = 60_000;+export const CLOUD_CODE_MONSTER_WAKE_MS = 1_500;export const CLOUD_CODE_MONSTER_VIOLENT_DRAG_MIN_DISTANCE = 24;export const CLOUD_CODE_MONSTER_VIOLENT_DRAG_STRONG_DISTANCE = 56;export const CLOUD_CODE_MONSTER_VIOLENT_DRAG_MAX_ELAPSED_MS = 70;diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet-direct-shapes.tsx b/src/web/src/components/home-pet/cloud-code-monster-pet-direct-shapes.tsxindex 45f049bc2..522154f74 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet-direct-shapes.tsx+++ b/src/web/src/components/home-pet/cloud-code-monster-pet-direct-shapes.tsx@@ -4,12 +4,34 @@ import type {CloudCodeMonsterPetPreset,} from "./cloud-code-monster-pet-types";+type DirectPixelEyesProps = {+ activityId: CloudCodeMonsterActivityId | null;+ preset: CloudCodeMonsterPetPreset;+ reacting: boolean;+ shaken: boolean;+ fainted?: boolean;+ eyeOffset?: { x: number; y: number };+ leftX?: number;+ rightX?: number;+ y?: number;+ color?: string;+ highlightColor?: string;+ singleEye?: boolean;+ mouthX?: number;+ mouthY?: number;+ mouthWidth?: number;+ mouthHeight?: number;+ mouthColor?: string;+ mouthStyle?: "flat" | "open" | "smile" | "none";+};+function DirectPixelEyes({activityId,preset,reacting,shaken,fainted = false,+ eyeOffset = { x: 0, y: 0 },leftX = 47,rightX = 78,y = 43,@@ -22,25 +44,7 @@ function DirectPixelEyes({mouthHeight = 4,mouthColor,mouthStyle = "flat",-}: {- activityId: CloudCodeMonsterActivityId | null;- preset: CloudCodeMonsterPetPreset;- reacting: boolean;- shaken: boolean;- fainted?: boolean;- leftX?: number;- rightX?: number;- y?: number;- color?: string;- highlightColor?: string;- singleEye?: boolean;- mouthX?: number;- mouthY?: number;- mouthWidth?: number;- mouthHeight?: number;- mouthColor?: string;- mouthStyle?: "flat" | "open" | "smile" | "none";-}) {+}: DirectPixelEyesProps) {const expression = getCloudCodeMonsterExpression(activityId,reacting,@@ -60,7 +64,7 @@ function DirectPixelEyes({includeHighlight = true) => (<>- <rect x={eyeX} y={eyeY} width={width} height={height} fill={eye} />+ <rect className="cloud-code-monster-pet-eye-blink" x={eyeX} y={eyeY} width={width} height={height} fill={eye} />{includeHighlight ? (<rect x={eyeX + 1} y={eyeY + 1} width="3" height="3" fill={highlight} />) : null}@@ -140,14 +144,18 @@ function DirectPixelEyes({if (expression === "shocked") {return (<>- <rect x={leftX - 3} y={y - 3} width="12" height="13" fill={eye} />- {secondEyeX === null ? null : (- <rect x={secondEyeX - 3} y={y - 3} width="12" height="13" fill={eye} />- )}- <rect x={leftX} y={y} width="4" height="4" fill={highlight} />- {secondEyeX === null ? null : (- <rect x={secondEyeX} y={y} width="4" height="4" fill={highlight} />- )}+ <g className="cloud-code-monster-pet-eyes-track" transform={`translate(${eyeOffset.x} ${eyeOffset.y})`}>+ <rect className="cloud-code-monster-pet-eye-blink" x={leftX - 3} y={y - 3} width="12" height="13" fill={eye} />+ {secondEyeX === null ? null : (+ <rect className="cloud-code-monster-pet-eye-blink" x={secondEyeX - 3} y={y - 3} width="12" height="13" fill={eye} />+ )}+ <g transform={`translate(${eyeOffset.x * 0.45} ${eyeOffset.y * 0.45})`}>+ <rect x={leftX} y={y} width="4" height="4" fill={highlight} />+ {secondEyeX === null ? null : (+ <rect x={secondEyeX} y={y} width="4" height="4" fill={highlight} />+ )}+ </g>+ </g>{renderMouth("open", mouthX, faceMouthY - 3, mouthWidth, mouthHeight + 1)}</>);@@ -167,8 +175,10 @@ function DirectPixelEyes({return (<>- {renderEyeBlock(leftX, y)}- {secondEyeX === null ? null : renderEyeBlock(secondEyeX, y)}+ <g className="cloud-code-monster-pet-eyes-track" transform={`translate(${eyeOffset.x} ${eyeOffset.y})`}>+ {renderEyeBlock(leftX, y)}+ {secondEyeX === null ? null : renderEyeBlock(secondEyeX, y)}+ </g>{renderMouth()}</>);@@ -180,14 +190,22 @@ export function MonsterDirectPixelCharacter({reacting,shaken,fainted,+ eyeOffset,}: {preset: CloudCodeMonsterPetPreset;activityId: CloudCodeMonsterActivityId | null;reacting: boolean;shaken: boolean;fainted: boolean;+ eyeOffset?: { x: number; y: number };}) {const shape = preset.shape;+ const expression = getCloudCodeMonsterExpression(+ activityId,+ reacting,+ shaken,+ fainted+ );switch (shape) {case "gadget-buddy":@@ -201,7 +219,7 @@ export function MonsterDirectPixelCharacter({<rect x="58" y="87" width="13" height="12" fill="#f0bf36" /><rect className="cloud-code-monster-pet-left-foot" x="36" y="103" width="21" height="11" fill="#f8fbff" /><rect className="cloud-code-monster-pet-right-foot" x="72" y="103" width="21" height="11" fill="#f8fbff" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={45} rightX={76} y={44} mouthX={56} mouthY={71} mouthWidth={18} mouthHeight={3} mouthColor="#111318" mouthStyle="smile" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={45} rightX={76} y={44} mouthX={56} mouthY={71} mouthWidth={18} mouthHeight={3} mouthColor="#111318" mouthStyle="smile" /><rect x="62" y="55" width="6" height="6" fill="#d9403f" /><rect x="62" y="61" width="3" height="12" fill="#111318" /><rect x="54" y="73" width="20" height="3" fill="#111318" />@@ -220,7 +238,7 @@ export function MonsterDirectPixelCharacter({<rect x="105" y="49" width="10" height="20" fill="#f1c93b" /><rect className="cloud-code-monster-pet-left-foot" x="37" y="96" width="18" height="15" fill="#d7a72e" /><rect className="cloud-code-monster-pet-right-foot" x="74" y="96" width="18" height="15" fill="#d7a72e" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={45} rightX={77} y={54} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={45} rightX={77} y={54} /><rect x="34" y="68" width="11" height="10" fill="#e84b43" /><rect x="84" y="68" width="11" height="10" fill="#e84b43" /></>@@ -235,7 +253,7 @@ export function MonsterDirectPixelCharacter({<rect x="93" y="57" width="17" height="18" fill="#ee86a7" /><rect className="cloud-code-monster-pet-left-foot" x="35" y="100" width="22" height="12" fill="#c94d62" /><rect className="cloud-code-monster-pet-right-foot" x="72" y="100" width="22" height="12" fill="#c94d62" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={48} rightX={75} y={51} color="#24335b" mouthX={61} mouthY={66} mouthWidth={10} mouthHeight={5} mouthColor="#7c2448" mouthStyle="smile" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={48} rightX={75} y={51} color="#24335b" mouthX={61} mouthY={66} mouthWidth={10} mouthHeight={5} mouthColor="#7c2448" mouthStyle="smile" /><rect x="43" y="69" width="9" height="8" fill="#e95d77" /><rect x="83" y="69" width="9" height="8" fill="#e95d77" /></>@@ -250,7 +268,7 @@ export function MonsterDirectPixelCharacter({<rect x="86" y="64" width="22" height="23" fill="#4c9f92" /><rect className="cloud-code-monster-pet-left-foot" x="29" y="88" width="16" height="16" fill="#4c9f92" /><rect className="cloud-code-monster-pet-right-foot" x="82" y="88" width="16" height="16" fill="#408b80" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={44} rightX={74} y={56} color="#b33b42" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={44} rightX={74} y={56} color="#b33b42" /><rect x="53" y="75" width="7" height="4" fill="#2d5d56" /><rect x="67" y="75" width="7" height="4" fill="#2d5d56" /></>@@ -266,7 +284,7 @@ export function MonsterDirectPixelCharacter({<rect x="103" y="51" width="7" height="9" fill="#e24c38" /><rect className="cloud-code-monster-pet-left-foot" x="36" y="98" width="17" height="14" fill="#b9542c" /><rect className="cloud-code-monster-pet-right-foot" x="75" y="98" width="17" height="14" fill="#b9542c" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={48} rightX={77} y={50} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={48} rightX={77} y={50} /></>);case "shell-sprout":@@ -280,7 +298,7 @@ export function MonsterDirectPixelCharacter({<rect x="92" y="62" width="20" height="16" fill="#6aa4cf" /><rect className="cloud-code-monster-pet-left-foot" x="35" y="101" width="18" height="12" fill="#5c92bd" /><rect className="cloud-code-monster-pet-right-foot" x="76" y="101" width="18" height="12" fill="#5c92bd" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={46} rightX={76} y={48} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={46} rightX={76} y={48} /></>);case "block-builder-shape":@@ -293,7 +311,7 @@ export function MonsterDirectPixelCharacter({<rect x="89" y="78" width="11" height="28" fill="#b98363" /><rect className="cloud-code-monster-pet-left-foot" x="42" y="102" width="18" height="16" fill="#31549a" /><rect className="cloud-code-monster-pet-right-foot" x="68" y="102" width="18" height="16" fill="#31549a" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={48} rightX={73} y={46} color="#2b2018" mouthX={57} mouthY={59} mouthWidth={14} mouthHeight={4} mouthColor="#6c3f2b" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={48} rightX={73} y={46} color="#2b2018" mouthX={57} mouthY={59} mouthWidth={14} mouthHeight={4} mouthColor="#6c3f2b" /><rect x="57" y="59" width="14" height="4" fill="#6c3f2b" /></>);@@ -307,11 +325,21 @@ export function MonsterDirectPixelCharacter({<rect className="cloud-code-monster-pet-left-foot" x="34" y="101" width="18" height="15" fill="#397b35" /><rect className="cloud-code-monster-pet-left-foot" x="54" y="101" width="18" height="15" fill="#397b35" /><rect className="cloud-code-monster-pet-right-foot" x="76" y="101" width="18" height="15" fill="#397b35" />- <rect x="47" y="40" width="11" height="13" fill="#151711" />- <rect x="70" y="40" width="11" height="13" fill="#151711" />- <rect x="59" y="54" width="10" height="18" fill="#151711" />- <rect x="51" y="64" width="10" height="8" fill="#151711" />- <rect x="67" y="64" width="10" height="8" fill="#151711" />+ {expression === "sleeping" ? (+ <>+ <rect x="47" y="46" width="12" height="4" fill="#151711" />+ <rect x="69" y="46" width="12" height="4" fill="#151711" />+ <rect x="58" y="61" width="12" height="4" fill="#151711" />+ </>+ ) : (+ <>+ <rect x="47" y="40" width="11" height="13" fill="#151711" />+ <rect x="70" y="40" width="11" height="13" fill="#151711" />+ <rect x="59" y="54" width="10" height="18" fill="#151711" />+ <rect x="51" y="64" width="10" height="8" fill="#151711" />+ <rect x="67" y="64" width="10" height="8" fill="#151711" />+ </>+ )}</>);case "block-walker-shape":@@ -323,7 +351,7 @@ export function MonsterDirectPixelCharacter({<rect x="89" y="74" width="14" height="30" fill="#77a86c" /><rect className="cloud-code-monster-pet-left-foot" x="41" y="102" width="18" height="16" fill="#5d4aa1" /><rect className="cloud-code-monster-pet-right-foot" x="69" y="102" width="18" height="16" fill="#5d4aa1" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={49} rightX={73} y={43} color="#2b221d" mouthX={57} mouthY={58} mouthWidth={14} mouthHeight={4} mouthColor="#2b221d" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={49} rightX={73} y={43} color="#2b221d" mouthX={57} mouthY={58} mouthWidth={14} mouthHeight={4} mouthColor="#2b221d" /><rect x="57" y="58" width="14" height="4" fill="#2b221d" /></>);@@ -340,7 +368,7 @@ export function MonsterDirectPixelCharacter({<rect x="86" y="80" width="11" height="20" fill="#2d5ca8" /><rect className="cloud-code-monster-pet-left-foot" x="38" y="102" width="17" height="12" fill="#7a5735" /><rect className="cloud-code-monster-pet-right-foot" x="73" y="102" width="17" height="12" fill="#7a5735" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={48} rightX={74} y={54} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={48} rightX={74} y={54} /></>);case "blue-spinner":@@ -354,7 +382,7 @@ export function MonsterDirectPixelCharacter({<rect x="44" y="74" width="39" height="26" fill="#356fc1" /><rect className="cloud-code-monster-pet-left-foot" x="31" y="99" width="26" height="12" fill="#d9463f" /><rect className="cloud-code-monster-pet-right-foot" x="71" y="99" width="26" height="12" fill="#d9463f" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={49} rightX={74} y={42} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={49} rightX={74} y={42} /></>);case "arcade-chomper":@@ -365,7 +393,7 @@ export function MonsterDirectPixelCharacter({<rect x="42" y="88" width="44" height="11" fill="#cfa62a" /><rect x="82" y="52" width="20" height="11" fill="#fff8de" /><rect x="82" y="65" width="15" height="11" fill="#fff8de" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={58} rightX={58} y={43} singleEye mouthX={84} mouthY={62} mouthWidth={15} mouthHeight={7} mouthColor="#15110d" mouthStyle="open" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={58} rightX={58} y={43} singleEye mouthX={84} mouthY={62} mouthWidth={15} mouthHeight={7} mouthColor="#15110d" mouthStyle="open" /></>);case "peek-ghost-shape":@@ -378,7 +406,7 @@ export function MonsterDirectPixelCharacter({<rect x="31" y="86" width="13" height="12" fill="#e0e5f3" /><rect x="56" y="86" width="13" height="12" fill="#e0e5f3" /><rect x="81" y="86" width="13" height="12" fill="#e0e5f3" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={45} rightX={77} y={47} mouthX={56} mouthY={63} mouthWidth={19} mouthHeight={10} mouthColor="#df7198" mouthStyle="open" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={45} rightX={77} y={47} mouthX={56} mouthY={63} mouthWidth={19} mouthHeight={10} mouthColor="#df7198" mouthStyle="open" /><rect x="57" y="63" width="18" height="13" fill="#df7198" /></>);@@ -394,7 +422,7 @@ export function MonsterDirectPixelCharacter({<rect x="84" y="71" width="14" height="28" fill="#d34437" /><rect className="cloud-code-monster-pet-left-foot" x="35" y="101" width="21" height="13" fill="#6c3e27" /><rect className="cloud-code-monster-pet-right-foot" x="72" y="101" width="21" height="13" fill="#6c3e27" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={49} rightX={74} y={41} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={49} rightX={74} y={41} /></>);case "honey-cub-shape":@@ -406,7 +434,7 @@ export function MonsterDirectPixelCharacter({<rect x="32" y="72" width="64" height="29" fill="#c9473c" /><rect className="cloud-code-monster-pet-left-foot" x="37" y="101" width="18" height="14" fill="#b87a2e" /><rect className="cloud-code-monster-pet-right-foot" x="74" y="101" width="18" height="14" fill="#b87a2e" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={48} rightX={75} y={47} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={48} rightX={75} y={47} /><rect x="61" y="59" width="7" height="5" fill="#4a2c1e" /></>);@@ -422,7 +450,7 @@ export function MonsterDirectPixelCharacter({<rect x="39" y="76" width="50" height="26" fill="#d94c5e" /><rect className="cloud-code-monster-pet-left-foot" x="38" y="102" width="18" height="11" fill="#f6f3ea" /><rect className="cloud-code-monster-pet-right-foot" x="72" y="102" width="18" height="11" fill="#f6f3ea" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={46} rightX={78} y={49} color="#25201f" highlightColor="#fffdfa" mouthX={61} mouthY={64} mouthWidth={7} mouthHeight={2} mouthColor="#7b4542" mouthStyle="smile" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={46} rightX={78} y={49} color="#25201f" highlightColor="#fffdfa" mouthX={61} mouthY={64} mouthWidth={7} mouthHeight={2} mouthColor="#7b4542" mouthStyle="smile" /><rect x="61" y="58" width="8" height="6" fill="#e0ad31" /><rect x="63" y="59" width="4" height="3" fill="#f6d75b" /><rect x="39" y="58" width="7" height="2" fill="#25201f" opacity="0.72" />@@ -453,7 +481,7 @@ export function MonsterDirectPixelCharacter({<rect x="38" y="79" width="52" height="25" fill={accent} /><rect className="cloud-code-monster-pet-left-foot" x="39" y="104" width="17" height="10" fill={hood} /><rect className="cloud-code-monster-pet-right-foot" x="72" y="104" width="17" height="10" fill={hood} />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={50} rightX={75} y={49} color="#31232f" highlightColor="#fff5ee" mouthX={60} mouthY={64} mouthWidth={9} mouthHeight={3} mouthColor="#7a3c55" mouthStyle="smile" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={50} rightX={75} y={49} color="#31232f" highlightColor="#fff5ee" mouthX={60} mouthY={64} mouthWidth={9} mouthHeight={3} mouthColor="#7a3c55" mouthStyle="smile" /></>);}@@ -468,7 +496,7 @@ export function MonsterDirectPixelCharacter({<rect x="46" y="72" width="8" height="5" fill="#74766a" /><rect x="61" y="72" width="8" height="5" fill="#74766a" /><rect x="76" y="72" width="8" height="5" fill="#74766a" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={47} rightX={76} y={47} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={47} rightX={76} y={47} /></>);case "dust-puff-shape":@@ -479,10 +507,21 @@ export function MonsterDirectPixelCharacter({<rect x="36" y="83" width="56" height="12" fill="#17181e" /><rect x="22" y="45" width="9" height="9" fill="#1f2026" /><rect x="97" y="48" width="9" height="9" fill="#1f2026" />- <rect x="48" y="52" width="14" height="14" fill="#f5f2dc" />- <rect x="69" y="52" width="14" height="14" fill="#f5f2dc" />- <rect x="53" y="56" width="5" height="6" fill="#17181e" />- <rect x="74" y="56" width="5" height="6" fill="#17181e" />+ {expression === "sleeping" ? (+ <>+ <rect x="48" y="59" width="14" height="3" fill="#f5f2dc" />+ <rect x="69" y="59" width="14" height="3" fill="#f5f2dc" />+ </>+ ) : (+ <>+ <rect x="48" y="52" width="14" height="14" fill="#f5f2dc" />+ <rect x="69" y="52" width="14" height="14" fill="#f5f2dc" />+ <g className="cloud-code-monster-pet-eyes-track" transform={`translate(${eyeOffset?.x ?? 0} ${eyeOffset?.y ?? 0})`}>+ <rect className="cloud-code-monster-pet-eye-blink" x="53" y="56" width="5" height="6" fill="#17181e" />+ <rect className="cloud-code-monster-pet-eye-blink" x="74" y="56" width="5" height="6" fill="#17181e" />+ </g>+ </>+ )}</>);case "straw-voyager-shape":@@ -496,7 +535,7 @@ export function MonsterDirectPixelCharacter({<rect x="45" y="82" width="38" height="20" fill="#2c5ca0" /><rect className="cloud-code-monster-pet-left-foot" x="39" y="102" width="18" height="13" fill="#d89064" /><rect className="cloud-code-monster-pet-right-foot" x="71" y="102" width="18" height="13" fill="#d89064" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={49} rightX={75} y={44} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={49} rightX={75} y={44} /></>);case "leaf-runner-shape":@@ -512,7 +551,7 @@ export function MonsterDirectPixelCharacter({<rect x="34" y="75" width="60" height="31" fill="#e27a31" /><rect className="cloud-code-monster-pet-left-foot" x="39" y="106" width="18" height="10" fill="#2f4560" /><rect className="cloud-code-monster-pet-right-foot" x="72" y="106" width="18" height="10" fill="#2f4560" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={49} rightX={75} y={50} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={49} rightX={75} y={50} /></>);case "energy-pearl-shape":@@ -527,7 +566,7 @@ export function MonsterDirectPixelCharacter({<rect x="52" y="77" width="24" height="29" fill="#244f91" /><rect className="cloud-code-monster-pet-left-foot" x="39" y="104" width="19" height="12" fill="#244f91" /><rect className="cloud-code-monster-pet-right-foot" x="71" y="104" width="19" height="12" fill="#244f91" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={49} rightX={75} y={47} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={49} rightX={75} y={47} /></>);case "moon-wand-shape":@@ -542,7 +581,7 @@ export function MonsterDirectPixelCharacter({<rect x="58" y="80" width="12" height="19" fill="#d9495d" /><rect className="cloud-code-monster-pet-left-foot" x="38" y="104" width="18" height="10" fill="#d9495d" /><rect className="cloud-code-monster-pet-right-foot" x="72" y="104" width="18" height="10" fill="#d9495d" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={49} rightX={75} y={48} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={49} rightX={75} y={48} /></>);case "mecha-guard-shape":@@ -554,7 +593,7 @@ export function MonsterDirectPixelCharacter({<rect x="54" y="17" width="7" height="17" fill="#e8c64c" /><rect x="68" y="17" width="7" height="17" fill="#e8c64c" /><rect x="45" y="44" width="38" height="8" fill="#26344f" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={50} rightX={70} y={44} color="#edf6ff" highlightColor="#7fd7ff" mouthX={58} mouthY={57} mouthWidth={13} mouthHeight={3} mouthColor="#d94b43" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={50} rightX={70} y={44} color="#edf6ff" highlightColor="#7fd7ff" mouthX={58} mouthY={57} mouthWidth={13} mouthHeight={3} mouthColor="#d94b43" /><rect x="34" y="64" width="60" height="39" fill="#eef1f5" /><rect x="48" y="68" width="32" height="19" fill="#315aa8" /><rect x="56" y="70" width="16" height="12" fill="#d94b43" />@@ -569,7 +608,7 @@ export function MonsterDirectPixelCharacter({<rect x="42" y="31" width="44" height="13" fill="#69aee2" /><rect x="29" y="44" width="70" height="43" fill="#5aa0d8" /><rect x="39" y="87" width="50" height="12" fill="#4384ba" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={47} rightX={76} y={55} mouthX={58} mouthY={72} mouthWidth={14} mouthHeight={5} mouthColor="#c4444a" mouthStyle="smile" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={47} rightX={76} y={55} mouthX={58} mouthY={72} mouthWidth={14} mouthHeight={5} mouthColor="#c4444a" mouthStyle="smile" /><rect x="58" y="72" width="14" height="5" fill="#c4444a" /></>);@@ -583,7 +622,7 @@ export function MonsterDirectPixelCharacter({<rect x="56" y="72" width="15" height="29" fill="#3f9188" /><rect x="81" y="72" width="15" height="29" fill="#3f9188" /><rect x="41" y="78" width="46" height="17" fill="#25292f" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={48} rightX={74} y={45} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={48} rightX={74} y={45} /></>);case "little-beagle-shape":@@ -612,7 +651,7 @@ export function MonsterDirectPixelCharacter({<rect className="cloud-code-monster-pet-right-foot" x="70" y="104" width="24" height="10" fill="#fffaf0" /><rect x="36" y="112" width="24" height="4" fill="#e6dfd2" /><rect x="70" y="112" width="24" height="4" fill="#e6dfd2" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={61} rightX={61} y={43} color="#1f1f22" highlightColor="#fffaf0" singleEye mouthX={86} mouthY={59} mouthWidth={11} mouthHeight={3} mouthColor="#1f1f22" mouthStyle="flat" />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={61} rightX={61} y={43} color="#1f1f22" highlightColor="#fffaf0" singleEye mouthX={86} mouthY={59} mouthWidth={11} mouthHeight={3} mouthColor="#1f1f22" mouthStyle="flat" /></>);case "tiny-antler-shape":@@ -629,7 +668,7 @@ export function MonsterDirectPixelCharacter({<rect x="36" y="77" width="56" height="27" fill="#c95b70" /><rect className="cloud-code-monster-pet-left-foot" x="39" y="104" width="18" height="10" fill="#bd7d55" /><rect className="cloud-code-monster-pet-right-foot" x="72" y="104" width="18" height="10" fill="#bd7d55" />- <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} leftX={49} rightX={75} y={49} />+ <DirectPixelEyes activityId={activityId} preset={preset} reacting={reacting} shaken={shaken} fainted={fainted} eyeOffset={eyeOffset} leftX={49} rightX={75} y={49} /></>);default:diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet-drag.ts b/src/web/src/components/home-pet/cloud-code-monster-pet-drag.tsindex 0ab65a9b1..8cf2d46b9 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet-drag.ts+++ b/src/web/src/components/home-pet/cloud-code-monster-pet-drag.ts@@ -26,6 +26,7 @@ import {CLOUD_CODE_MONSTER_SIZE,} from "./cloud-code-monster-pet-constants";import type {+ CloudCodeMonsterActivityId,PetPoint,StoredCloudCodeMonsterActivity,} from "./cloud-code-monster-pet-types";@@ -73,6 +74,10 @@ function getPointerPoint(};}+function isSleepyActivity(activityId: CloudCodeMonsterActivityId | null) {+ return activityId === "sleeping" || activityId === "dozing" || activityId === "yawning";+}+export function usePetDrag({boundaryRef,initialPosition,@@ -117,6 +122,11 @@ export function usePetDrag({return;}+ if (isSleepyActivity(activityState?.activityId ?? null)) {+ wakeMonsterToDefault();+ return;+ }+if (activityState?.activityId) {wakeMonsterToDefault();}@@ -159,6 +169,12 @@ export function usePetDrag({const pointerPoint = getPointerPoint(event, boundaryRef.current);const now = performance.now();+ if (isSleepyActivity(activityState?.activityId ?? null)) {+ stopTemporaryMotion();+ wakeMonsterToDefault();+ return;+ }+dragOffsetRef.current = {x: pointerPoint.x - currentPosition.x,y: pointerPoint.y - currentPosition.y,@@ -175,12 +191,14 @@ export function usePetDrag({},[boundaryRef,+ activityState?.activityId,initialPosition,lastFootstepAtRef,position,setIsDragging,setWalkIntensity,stopTemporaryMotion,+ wakeMonsterToDefault,]);diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet-pixel-parts.tsx b/src/web/src/components/home-pet/cloud-code-monster-pet-pixel-parts.tsxindex 30feb17b9..7afe9ff90 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet-pixel-parts.tsx+++ b/src/web/src/components/home-pet/cloud-code-monster-pet-pixel-parts.tsx@@ -17,12 +17,14 @@ function MonsterEyes({reacting,shaken,fainted = false,+ eyeOffset = { x: 0, y: 0 },}: {activityId: CloudCodeMonsterActivityId | null;preset: CloudCodeMonsterPetPreset;reacting: boolean;shaken: boolean;fainted?: boolean;+ eyeOffset?: { x: number; y: number };}) {const expression = getCloudCodeMonsterExpression(activityId,@@ -66,10 +68,14 @@ function MonsterEyes({if (expression === "shocked") {return (<>- <rect x="44" y="39" width="12" height="13" fill={preset.eye} />- <rect x="76" y="39" width="12" height="13" fill={preset.eye} />- <rect x="47" y="42" width="4" height="4" fill={preset.highlight} />- <rect x="79" y="42" width="4" height="4" fill={preset.highlight} />+ <g className="cloud-code-monster-pet-eyes-track" transform={`translate(${eyeOffset.x} ${eyeOffset.y})`}>+ <rect className="cloud-code-monster-pet-eye-blink" x="44" y="39" width="12" height="13" fill={preset.eye} />+ <rect className="cloud-code-monster-pet-eye-blink" x="76" y="39" width="12" height="13" fill={preset.eye} />+ <g transform={`translate(${eyeOffset.x * 0.45} ${eyeOffset.y * 0.45})`}>+ <rect x="47" y="42" width="4" height="4" fill={preset.highlight} />+ <rect x="79" y="42" width="4" height="4" fill={preset.highlight} />+ </g>+ </g><rect x="60" y="60" width="10" height="12" fill={preset.eye} /><rect x="62" y="62" width="6" height="3" fill="#332520" /></>@@ -86,12 +92,14 @@ function MonsterEyes({}return (- <>- <rect x="47" y="43" width="8" height="9" fill={preset.eye} />- <rect x="78" y="43" width="8" height="9" fill={preset.eye} />- <rect x="48" y="44" width="3" height="3" fill="#2c2521" />- <rect x="79" y="44" width="3" height="3" fill="#2c2521" />- </>+ <g className="cloud-code-monster-pet-eyes-track" transform={`translate(${eyeOffset.x} ${eyeOffset.y})`}>+ <rect className="cloud-code-monster-pet-eye-blink" x="44" y="42" width="11" height="12" fill={preset.eye} />+ <rect className="cloud-code-monster-pet-eye-blink" x="77" y="42" width="11" height="12" fill={preset.eye} />+ <g transform={`translate(${eyeOffset.x * 0.55} ${eyeOffset.y * 0.55})`}>+ <rect x="46" y="44" width="4" height="4" fill="#2c2521" />+ <rect x="79" y="44" width="4" height="4" fill="#2c2521" />+ </g>+ </g>);}@@ -106,7 +114,7 @@ function MonsterActivityAccessory({return null;}- if (activityId === "sleeping") {+ if (activityId === "sleeping" || activityId === "dozing" || activityId === "yawning") {return (<g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-sleep"><g className="cloud-code-monster-pet-sleep-z">@@ -170,6 +178,72 @@ function MonsterActivityAccessory({);}+ if (activityId === "building") {+ return (+ <g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-building">+ <rect x="29" y="72" width="19" height="19" fill={preset.accessory} />+ <rect x="52" y="62" width="20" height="29" fill={preset.accent} />+ <rect x="76" y="70" width="21" height="21" fill={preset.bodyLight} />+ <rect x="34" y="77" width="8" height="4" fill={preset.highlight} />+ <rect x="57" y="68" width="9" height="4" fill={preset.highlight} />+ <rect x="81" y="76" width="9" height="4" fill={preset.highlight} />+ </g>+ );+ }++ if (activityId === "juggling") {+ return (+ <g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-juggling">+ <rect x="33" y="29" width="8" height="8" fill={preset.accessory} />+ <rect x="59" y="17" width="8" height="8" fill={preset.accent} />+ <rect x="86" y="29" width="8" height="8" fill={preset.bodyLight} />+ </g>+ );+ }++ if (activityId === "attention" || activityId === "waking") {+ return (+ <g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-attention">+ <rect x="22" y="22" width="7" height="18" fill={preset.accessory} />+ <rect x="17" y="27" width="17" height="7" fill={preset.accessory} />+ <rect x="99" y="20" width="8" height="20" fill={preset.accent} />+ <rect x="93" y="26" width="20" height="8" fill={preset.accent} />+ <rect x="61" y="5" width="7" height="18" fill={preset.highlight} />+ </g>+ );+ }++ if (activityId === "error") {+ return (+ <g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-error">+ <rect x="92" y="15" width="20" height="20" fill="#2b2112" />+ <rect x="96" y="19" width="12" height="12" fill="#f05f57" />+ <rect x="101" y="21" width="3" height="7" fill="#fff1d6" />+ <rect x="101" y="30" width="3" height="3" fill="#fff1d6" />+ </g>+ );+ }++ if (activityId === "carrying") {+ return (+ <g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-carrying">+ <rect x="39" y="68" width="48" height="25" fill={preset.accessory} />+ <rect x="39" y="68" width="48" height="5" fill={preset.accent} />+ <rect x="61" y="68" width="5" height="25" fill={preset.accent} />+ </g>+ );+ }++ if (activityId === "sweeping") {+ return (+ <g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-sweeping">+ <rect x="72" y="58" width="5" height="42" fill="#8b6538" />+ <rect x="62" y="94" width="27" height="7" fill={preset.accessory} />+ <rect x="58" y="101" width="35" height="5" fill={preset.accent} />+ </g>+ );+ }+if (activityId === "snacking") {return (<g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-snack">@@ -183,9 +257,15 @@ function MonsterActivityAccessory({return (<g className="cloud-code-monster-pet-accessory cloud-code-monster-pet-thought">- <rect x="92" y="25" width="8" height="8" fill={preset.accent} />- <rect x="104" y="17" width="6" height="6" fill={preset.bodyLight} />- <rect x="113" y="9" width="5" height="5" fill={preset.highlight} />+ <rect x="86" y="-8" width="26" height="5" fill="#fffdfa" />+ <rect x="81" y="-3" width="36" height="19" fill="#fffdfa" />+ <rect x="85" y="16" width="27" height="5" fill="#fffdfa" />+ <rect x="77" y="4" width="44" height="8" fill="#fffdfa" />+ <rect x="73" y="24" width="5" height="5" fill="#fffdfa" />+ <rect x="68" y="33" width="3" height="3" fill="#fffdfa" />+ <rect className="cloud-code-monster-pet-thought-dot cloud-code-monster-pet-thought-dot-1" x="88" y="7" width="4" height="4" fill="#34302b" />+ <rect className="cloud-code-monster-pet-thought-dot cloud-code-monster-pet-thought-dot-2" x="97" y="7" width="4" height="4" fill="#34302b" />+ <rect className="cloud-code-monster-pet-thought-dot cloud-code-monster-pet-thought-dot-3" x="106" y="7" width="4" height="4" fill="#34302b" /></g>);}@@ -509,6 +589,7 @@ function MonsterStaticBody({reacting = false,shaken = false,fainted = false,+ eyeOffset,}: {preset: CloudCodeMonsterPetPreset;activityId: CloudCodeMonsterActivityId | null;@@ -516,6 +597,7 @@ function MonsterStaticBody({reacting?: boolean;shaken?: boolean;fainted?: boolean;+ eyeOffset?: { x: number; y: number };}) {const shape = preset.shape ?? "monster";@@ -529,6 +611,7 @@ function MonsterStaticBody({reacting={reacting}shaken={shaken}fainted={fainted}+ eyeOffset={eyeOffset}/></Suspense></g>@@ -538,16 +621,16 @@ function MonsterStaticBody({return (<g className={animated ? "cloud-code-monster-pet-character" : undefined}><MonsterPresetFeature preset={preset} />- <rect x="36" y="27" width="56" height="10" fill={preset.bodyTop} />- <rect x="28" y="37" width="72" height="14" fill={preset.bodyTop} />+ <rect x="32" y="22" width="64" height="12" fill={preset.bodyTop} />+ <rect x="24" y="34" width="80" height="17" fill={preset.bodyTop} /><rect x="16" y="51" width="12" height="24" fill={preset.body} />- <rect x="28" y="51" width="72" height="45" fill={preset.body} />+ <rect x="24" y="51" width="80" height="41" fill={preset.body} /><rect x="100" y="51" width="12" height="24" fill={preset.body} /><rect x="16" y="63" width="12" height="12" fill={preset.bodyDark} />- <rect x="28" y="84" width="72" height="12" fill={preset.bodyDark} />- <rect x="36" y="37" width="56" height="5" fill={preset.bodyLight} />- <rect x="28" y="51" width="8" height="33" fill={preset.bodySideLight} />- <rect x="92" y="51" width="8" height="33" fill={preset.bodySideDark} />+ <rect x="30" y="86" width="68" height="10" fill={preset.bodyDark} />+ <rect x="34" y="34" width="60" height="6" fill={preset.bodyLight} />+ <rect x="24" y="51" width="9" height="35" fill={preset.bodySideLight} />+ <rect x="95" y="51" width="9" height="35" fill={preset.bodySideDark} /><MonsterPresetBodyMarks preset={preset} /><MonsterEyesactivityId={activityId}@@ -555,6 +638,7 @@ function MonsterStaticBody({reacting={reacting}shaken={shaken}fainted={fainted}+ eyeOffset={eyeOffset}/><rect x="36" y="69" width="8" height="8" fill={preset.bodyLight} /><rect x="84" y="69" width="8" height="8" fill={preset.bodySideDark} />@@ -622,12 +706,14 @@ export function MonsterSvg({reacting,shaken,fainted,+ eyeOffset,}: {activityId: CloudCodeMonsterActivityId | null;preset: CloudCodeMonsterPetPreset;reacting: boolean;shaken: boolean;fainted: boolean;+ eyeOffset?: { x: number; y: number };}) {const expression = getCloudCodeMonsterExpression(activityId,@@ -645,8 +731,8 @@ export function MonsterSvg({aria-label={`Claude Code style pixel monster ${activityId ?? "idle"}`}shapeRendering="crispEdges">- <rect x="31" y="116" width="66" height="5" fill="rgba(45,40,36,.14)" />- <rect x="40" y="121" width="48" height="3" fill="rgba(45,40,36,.08)" />+ <rect className="cloud-code-monster-pet-shadow cloud-code-monster-pet-shadow-main" x="31" y="116" width="66" height="5" fill="rgba(45,40,36,.14)" />+ <rect className="cloud-code-monster-pet-shadow cloud-code-monster-pet-shadow-soft" x="40" y="121" width="48" height="3" fill="rgba(45,40,36,.08)" />{isShocked ? (<g className="cloud-code-monster-pet-shock" aria-hidden="true"><rect x="17" y="15" width="7" height="17" fill={preset.accent} />@@ -663,6 +749,7 @@ export function MonsterSvg({reacting={reacting}shaken={shaken}fainted={fainted}+ eyeOffset={eyeOffset}/><MonsterActivityAccessoryactivityId={fainted ? null : activityId}diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet-types.ts b/src/web/src/components/home-pet/cloud-code-monster-pet-types.tsindex bf4570f53..728ac122c 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet-types.ts+++ b/src/web/src/components/home-pet/cloud-code-monster-pet-types.ts@@ -18,12 +18,23 @@ export type CloudCodeMonsterPeekTarget = PetPoint & {};export type CloudCodeMonsterActivityId =+ | "attention"+ | "building"+ | "carrying"| "coding"+ | "dozing"+ | "error"+ | "juggling"+ | "notification"| "sleeping"| "reading"| "phone"| "thinking"- | "snacking";+ | "snacking"+ | "sweeping"+ | "typing"+ | "waking"+ | "yawning";export type CloudCodeMonsterActivity = {id: CloudCodeMonsterActivityId;diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet.module.css b/src/web/src/components/home-pet/cloud-code-monster-pet.module.cssindex 642018646..1008767c5 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet.module.css+++ b/src/web/src/components/home-pet/cloud-code-monster-pet.module.css@@ -90,6 +90,34 @@transform-origin: 50% 80%;}+.petLayer :global(.cloud-code-monster-pet-shadow) {+ transform-box: fill-box;+ transform-origin: 50% 50%;+ transition: transform 120ms ease-out;+}++.petLayer :global(.cloud-code-monster-pet-shadow-main) {+ transform:+ translateX(var(--monster-cursor-shadow-x, 0px))+ scaleX(var(--monster-cursor-shadow-scale-x, 1));+}++.petLayer :global(.cloud-code-monster-pet-shadow-soft) {+ transform:+ translateX(var(--monster-cursor-shadow-x, 0px))+ scaleX(calc(var(--monster-cursor-shadow-scale-x, 1) + 0.025));+}++.petLayer :global(.cloud-code-monster-pet-eyes-track) {+ transform-box: fill-box;+}++.petLayer :global(.cloud-code-monster-pet-eye-blink) {+ animation: cloud-code-monster-eye-blink 3s steps(1, end) infinite;+ transform-box: fill-box;+ transform-origin: 50% 50%;+}+.petLayer :global(.cloud-code-monster-pet-left-foot),.petLayer :global(.cloud-code-monster-pet-right-foot) {transform-box: fill-box;@@ -178,7 +206,19 @@}.pet[data-activity="sleeping"] :global(.cloud-code-monster-pet-character) {- animation: cloud-code-monster-sleep 5.2s steps(2, end) infinite;+ animation: cloud-code-monster-sleep 4.8s ease-in-out infinite;+ transform-origin: 50% 92%;+}++.pet[data-activity="dozing"] :global(.cloud-code-monster-pet-character),+.pet[data-activity="yawning"] :global(.cloud-code-monster-pet-character) {+ animation: cloud-code-monster-fall-asleep 1.5s cubic-bezier(0.22, 1, 0.36, 1) both;+ transform-origin: 50% 92%;+}++.pet[data-activity="waking"] :global(.cloud-code-monster-pet-character) {+ animation: cloud-code-monster-wake 1.5s cubic-bezier(0.22, 1, 0.36, 1) both;+ transform-origin: 50% 92%;}.pet[data-activity="sleeping"] :global(.cloud-code-monster-pet-sleep rect) {@@ -221,17 +261,62 @@animation: cloud-code-monster-keytap 1s steps(2, end) infinite;}-.pet[data-activity="thinking"] :global(.cloud-code-monster-pet-thought rect) {+.pet[data-activity="building"] :global(.cloud-code-monster-pet-building) {+ animation: cloud-code-monster-build 1.25s steps(3, end) infinite;+}++.pet[data-activity="juggling"] :global(.cloud-code-monster-pet-juggling rect) {+ animation: cloud-code-monster-juggle 1.15s ease-in-out infinite;+ transform-box: fill-box;+ transform-origin: center;+}++.pet[data-activity="juggling"] :global(.cloud-code-monster-pet-juggling rect:nth-child(2)) {+ animation-delay: 150ms;+}++.pet[data-activity="juggling"] :global(.cloud-code-monster-pet-juggling rect:nth-child(3)) {+ animation-delay: 300ms;+}++.pet[data-activity="attention"] :global(.cloud-code-monster-pet-attention rect),+.pet[data-activity="waking"] :global(.cloud-code-monster-pet-attention rect) {+ animation: cloud-code-monster-spark 900ms steps(2, end) infinite;+ transform-box: fill-box;+ transform-origin: center;+}++.pet[data-activity="error"] :global(.cloud-code-monster-pet-error) {+ animation: cloud-code-monster-error 280ms steps(2, end) infinite;+}++.pet[data-activity="carrying"] :global(.cloud-code-monster-pet-carrying) {+ animation: cloud-code-monster-carry 1.1s steps(2, end) infinite;+}++.pet[data-activity="sweeping"] :global(.cloud-code-monster-pet-sweeping) {+ animation: cloud-code-monster-sweep 1.4s ease-in-out infinite;+ transform-box: fill-box;+ transform-origin: 72px 100px;+}++.pet[data-activity="thinking"] :global(.cloud-code-monster-pet-thought) {animation: cloud-code-monster-thought 2.8s ease-in-out infinite;transform-box: fill-box;+ transform-origin: center;+}++.pet[data-activity="thinking"] :global(.cloud-code-monster-pet-thought-dot) {+ animation: cloud-code-monster-thought-dot 1.35s steps(1, end) infinite;+ opacity: 0.18;}-.pet[data-activity="thinking"] :global(.cloud-code-monster-pet-thought rect:nth-child(2)) {- animation-delay: 240ms;+.pet[data-activity="thinking"] :global(.cloud-code-monster-pet-thought-dot-2) {+ animation-delay: 180ms;}-.pet[data-activity="thinking"] :global(.cloud-code-monster-pet-thought rect:nth-child(3)) {- animation-delay: 480ms;+.pet[data-activity="thinking"] :global(.cloud-code-monster-pet-thought-dot-3) {+ animation-delay: 360ms;}.pet[data-activity="snacking"] :global(.cloud-code-monster-pet-snack) {@@ -239,13 +324,62 @@}@keyframes cloud-code-monster-breathe {- 0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }- 50% { transform: translateY(-2px) scale(1.015, 0.985); }+ 0%, 100% {+ transform:+ translate(+ var(--monster-cursor-body-x, 0px),+ var(--monster-cursor-body-y, 0px)+ )+ rotate(var(--monster-cursor-lean, 0deg))+ skewX(var(--monster-cursor-skew, 0deg))+ scale(var(--monster-cursor-stretch-x, 1), var(--monster-cursor-stretch-y, 1));+ }+ 45% {+ transform:+ translate(+ var(--monster-cursor-body-x, 0px),+ calc(var(--monster-cursor-body-y, 0px) - 4px)+ )+ rotate(calc(-0.8deg + var(--monster-cursor-lean, 0deg)))+ skewX(var(--monster-cursor-skew, 0deg))+ scale(var(--monster-cursor-stretch-x, 1), var(--monster-cursor-stretch-y, 1))+ scale(1.045, 0.965);+ }+ 70% {+ transform:+ translate(+ var(--monster-cursor-body-x, 0px),+ calc(var(--monster-cursor-body-y, 0px) - 2px)+ )+ rotate(calc(0.6deg + var(--monster-cursor-lean, 0deg)))+ skewX(var(--monster-cursor-skew, 0deg))+ scale(var(--monster-cursor-stretch-x, 1), var(--monster-cursor-stretch-y, 1))+ scale(1.025, 0.982);+ }+}++@keyframes cloud-code-monster-eye-blink {+ 0%, 91%, 100% { transform: scaleY(1); }+ 94%, 96% { transform: scaleY(0.14); }}@keyframes cloud-code-monster-sleep {- 0%, 100% { transform: translateY(1px) rotate(0deg) scale(1.02, 0.98); }- 50% { transform: translateY(3px) rotate(0deg) scale(1.04, 0.96); }+ 0%, 100% { transform: translateY(11px) rotate(-6deg) scale(1.12, 0.78); }+ 50% { transform: translateY(12px) rotate(-6deg) scale(1.14, 0.76); }+}++@keyframes cloud-code-monster-fall-asleep {+ 0% { transform: translateY(0) rotate(0deg) scale(1); }+ 42% { transform: translateY(4px) rotate(-2deg) scale(1.04, 0.92); }+ 72% { transform: translateY(12px) rotate(-6deg) scale(1.13, 0.78); }+ 100% { transform: translateY(11px) rotate(-6deg) scale(1.12, 0.78); }+}++@keyframes cloud-code-monster-wake {+ 0% { transform: translateY(11px) rotate(-6deg) scale(1.12, 0.78); opacity: 0.9; }+ 54% { transform: translateY(-4px) rotate(2deg) scale(0.96, 1.08); opacity: 1; }+ 76% { transform: translateY(2px) rotate(-1deg) scale(1.03, 0.97); opacity: 1; }+ 100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }}@keyframes cloud-code-monster-sleep-pixels {@@ -333,9 +467,46 @@50% { transform: translateY(2px); }}+@keyframes cloud-code-monster-build {+ 0%, 100% { transform: translateY(0); }+ 33% { transform: translateY(-3px); }+ 66% { transform: translateY(2px); }+}++@keyframes cloud-code-monster-juggle {+ 0%, 100% { transform: translateY(7px) scale(0.86); opacity: 0.6; }+ 50% { transform: translateY(-9px) scale(1.08); opacity: 1; }+}++@keyframes cloud-code-monster-spark {+ 0%, 100% { opacity: 0.35; transform: scale(0.82); }+ 50% { opacity: 1; transform: scale(1.18); }+}++@keyframes cloud-code-monster-error {+ 0%, 100% { transform: translateX(-2px); }+ 50% { transform: translateX(2px); }+}++@keyframes cloud-code-monster-carry {+ 0%, 100% { transform: translateY(0) rotate(-1deg); }+ 50% { transform: translateY(-2px) rotate(1deg); }+}++@keyframes cloud-code-monster-sweep {+ 0%, 100% { transform: rotate(-9deg) translateX(-1px); }+ 50% { transform: rotate(10deg) translateX(2px); }+}+@keyframes cloud-code-monster-thought {- 0%, 100% { opacity: 0.22; transform: translateY(3px) scale(0.82); }- 50% { opacity: 0.78; transform: translateY(-2px) scale(1); }+ 0%, 100% { transform: translateY(1px); }+ 50% { transform: translateY(-2px); }+}++@keyframes cloud-code-monster-thought-dot {+ 0%, 28% { opacity: 0.18; }+ 29%, 72% { opacity: 0.78; }+ 73%, 100% { opacity: 0.18; }}@keyframes cloud-code-monster-snack {@@ -360,6 +531,7 @@.petLayer :global(.cloud-code-monster-pet-accessory rect),.petLayer :global(.cloud-code-monster-pet-shock rect),.petLayer :global(.cloud-code-monster-pet-phone-glow),+ .petLayer :global(.cloud-code-monster-pet-eye-blink),.notificationBell,.footprint {animation: none !important;diff --git a/src/web/src/components/home-pet/cloud-code-monster-pet.test.ts b/src/web/src/components/home-pet/cloud-code-monster-pet.test.tsindex 8658e28f6..6c0f6ab86 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet.test.ts+++ b/src/web/src/components/home-pet/cloud-code-monster-pet.test.ts@@ -1,5 +1,7 @@import { readFileSync } from "node:fs";import path from "node:path";+import { createElement } from "react";+import { renderToString } from "react-dom/server";import { describe, expect, it, vi } from "vitest";import {calculateMonsterWalkIntensity,@@ -9,9 +11,11 @@ import {CLOUD_CODE_MONSTER_AUTOWALK_ACTIVITY_IDS,CLOUD_CODE_MONSTER_FAINT_MIN_EVENTS,CLOUD_CODE_MONSTER_FAINT_MS,+ CLOUD_CODE_MONSTER_NO_WORK_SLEEP_MS,CLOUD_CODE_MONSTER_PET_PRESETS,createCloudCodeMonsterHiddenState,createCloudCodeMonsterIdleState,+ createCloudCodeMonsterSleepingState,createCloudCodeMonsterWalkVelocity,createWalkToTargetVelocity,getCloudCodeMonsterExpression,@@ -21,12 +25,20 @@ import {isViolentMonsterDrag,pickCloudCodeMonsterActivity,reflectCloudCodeMonsterWalk,+ resolveCloudCodeMonsterAgentWorkState,+ resolveCloudCodeMonsterActivityState,+ resolveCloudCodeMonsterCursorPose,+ resolveCloudCodeMonsterEyeOffset,+ resolveCloudCodeMonsterMotionPose,resolveCloudCodeMonsterPeekPosition,+ resolveCloudCodeMonsterPreviewComebackState,resolveCloudCodeMonsterVisibleState,shouldCloudCodeMonsterAutoWalk,shouldFaintFromMonsterShake,shouldRefreshCloudCodeMonsterActivity,} from "./cloud-code-monster-pet";+import { usePetDrag } from "./cloud-code-monster-pet-drag";+import type { CloudCodeMonsterActivityId } from "./cloud-code-monster-pet-types";import { readHomePetSettings } from "../../lib/home-pet-settings";vi.mock("./cloud-code-monster-pet.module.css", () => ({@@ -39,6 +51,56 @@ function webRoot() {: path.join(process.cwd(), "src/web");}+function renderDragHarness(activityId: CloudCodeMonsterActivityId | null) {+ let handlers: ReturnType<typeof usePetDrag> | null = null;+ const wakeMonsterToDefault = vi.fn();+ const stopTemporaryMotion = vi.fn();+ const setIsDragging = vi.fn();+ const startShockReaction = vi.fn();++ function DragHarness() {+ handlers = usePetDrag({+ boundaryRef: { current: null },+ position: { x: 120, y: 140 },+ isDragging: false,+ fainted: false,+ activityState: { activityId, updatedAt: 1_000, hiddenAt: null },+ lastFootstepAtRef: { current: 0 },+ violentDragEventsRef: { current: [] },+ setIsDragging,+ setNotificationActive: vi.fn(),+ setFainted: vi.fn(),+ setWalkDirection: vi.fn(),+ setWalkIntensity: vi.fn(),+ setPosition: vi.fn(),+ clearPetTimer: vi.fn(),+ setPetTimer: vi.fn(),+ pushFootprint: vi.fn(),+ stopTemporaryMotion,+ wakeMonsterToDefault,+ startShockReaction,+ startShakeReaction: vi.fn(),+ startFaintReaction: vi.fn(),+ });++ return null;+ }++ renderToString(createElement(DragHarness));++ if (!handlers) {+ throw new Error("drag harness did not render");+ }++ return {+ handlers,+ setIsDragging,+ startShockReaction,+ stopTemporaryMotion,+ wakeMonsterToDefault,+ };+}+describe("Cloud Code monster PET helpers", () => {it("keeps the PET inside the provided bounds", () => {expect(@@ -131,9 +193,30 @@ describe("Cloud Code monster PET helpers", () => {updatedAt,hiddenAt: null,});++ expect(+ resolveCloudCodeMonsterVisibleState(+ { activityId: "coding", updatedAt, hiddenAt: updatedAt },+ updatedAt + CLOUD_CODE_MONSTER_ACTIVITY_REFRESH_MS+ )+ ).toEqual({+ activityId: null,+ updatedAt: updatedAt + CLOUD_CODE_MONSTER_ACTIVITY_REFRESH_MS,+ hiddenAt: null,+ });+ expect(resolveCloudCodeMonsterVisibleState(null, 4_000)).toEqual({+ activityId: null,+ updatedAt: 4_000,+ hiddenAt: null,+ });+ expect(resolveCloudCodeMonsterPreviewComebackState(7_000)).toEqual({+ activityId: null,+ updatedAt: 7_000,+ hiddenAt: null,+ });});- it("tracks idle, hidden, and random activity states", () => {+ it("tracks idle, hidden, and deterministic activity states", () => {expect(createCloudCodeMonsterIdleState(8_000)).toEqual({activityId: null,updatedAt: 8_000,@@ -152,9 +235,112 @@ describe("Cloud Code monster PET helpers", () => {expect(pickCloudCodeMonsterActivity(0).id).toBe(CLOUD_CODE_MONSTER_ACTIVITIES[0]!.id);- expect(pickCloudCodeMonsterActivity(0.999).id).toBe(- CLOUD_CODE_MONSTER_ACTIVITIES.at(-1)!.id+ expect(pickCloudCodeMonsterActivity(0.999).id).toBe("yawning");+ expect(createCloudCodeMonsterSleepingState(9_000)).toEqual({+ activityId: "sleeping",+ updatedAt: 9_000,+ hiddenAt: null,+ });+ expect(+ resolveCloudCodeMonsterActivityState(+ { activityId: "coding", updatedAt: 1_000, hiddenAt: null },+ 1_100+ )+ ).toEqual({ activityId: "coding", updatedAt: 1_000, hiddenAt: null });+ expect(+ resolveCloudCodeMonsterActivityState(+ { activityId: "coding", updatedAt: 1_000, hiddenAt: null },+ 1_000 + CLOUD_CODE_MONSTER_ACTIVITY_REFRESH_MS+ )+ ).toEqual({+ activityId: null,+ updatedAt: 1_000 + CLOUD_CODE_MONSTER_ACTIVITY_REFRESH_MS,+ hiddenAt: null,+ });+ });++ it("maps Alook active agent tasks into working and sleep-ready PET states", () => {+ expect(CLOUD_CODE_MONSTER_NO_WORK_SLEEP_MS).toBe(60_000);+ expect(resolveCloudCodeMonsterAgentWorkState(1, null, 10_000)).toEqual({+ activityId: "coding",+ updatedAt: 10_000,+ hiddenAt: null,+ });+ expect(+ resolveCloudCodeMonsterAgentWorkState(+ 3,+ { activityId: "sleeping", updatedAt: 1_000, hiddenAt: null },+ 10_000+ )+ ).toEqual({+ activityId: "building",+ updatedAt: 10_000,+ hiddenAt: null,+ });+ expect(+ resolveCloudCodeMonsterAgentWorkState(+ 0,+ { activityId: "coding", updatedAt: 1_000, hiddenAt: null },+ 10_000+ )+ ).toEqual({+ activityId: null,+ updatedAt: 10_000,+ hiddenAt: null,+ });+ const sleeping = { activityId: "sleeping" as const, updatedAt: 1_000, hiddenAt: null };+ expect(resolveCloudCodeMonsterAgentWorkState(0, sleeping, 10_000)).toBe(+ sleeping);+ expect(+ resolveCloudCodeMonsterAgentWorkState(+ 2,+ { activityId: null, updatedAt: 1_000, hiddenAt: null },+ 10_000+ )+ ).toEqual({+ activityId: "juggling",+ updatedAt: 10_000,+ hiddenAt: null,+ });+ expect(+ resolveCloudCodeMonsterAgentWorkState(+ 1,+ { activityId: "coding", updatedAt: 1_000, hiddenAt: 900 },+ 10_000+ )+ ).toEqual({+ activityId: "coding",+ updatedAt: 1_000,+ hiddenAt: null,+ });+ });++ it("wakes sleepy PET states from click or pointer down before dragging", () => {+ vi.stubGlobal("window", { innerWidth: 900, innerHeight: 700 });++ const clickHarness = renderDragHarness("sleeping");+ clickHarness.handlers.handlePetClick();++ expect(clickHarness.wakeMonsterToDefault).toHaveBeenCalledTimes(1);+ expect(clickHarness.startShockReaction).not.toHaveBeenCalled();++ const pointerHarness = renderDragHarness("dozing");+ pointerHarness.handlers.handlePointerDown({+ button: 0,+ clientX: 180,+ clientY: 200,+ pointerId: 1,+ currentTarget: {+ setPointerCapture: vi.fn(),+ },+ } as never);++ expect(pointerHarness.stopTemporaryMotion).toHaveBeenCalledTimes(1);+ expect(pointerHarness.wakeMonsterToDefault).toHaveBeenCalledTimes(1);+ expect(pointerHarness.setIsDragging).not.toHaveBeenCalled();++ vi.unstubAllGlobals();});it("limits autonomous walking to selected activities", () => {@@ -199,6 +385,47 @@ describe("Cloud Code monster PET helpers", () => {);});+ it("resolves cursor-following eyes and movement body pose", () => {+ expect(+ resolveCloudCodeMonsterEyeOffset(+ { x: 300, y: 210 },+ { x: 100, y: 100 },+ { width: 82, height: 82 }+ )+ ).toEqual({ x: 3.75, y: 1.25 });+ expect(+ resolveCloudCodeMonsterEyeOffset(+ { x: -80, y: -60 },+ { x: 100, y: 100 },+ { width: 82, height: 82 }+ )+ ).toEqual({ x: -4, y: -2.75 });++ const cursorPose = resolveCloudCodeMonsterCursorPose(+ { x: 300, y: 210 },+ { x: 100, y: 100 },+ { width: 82, height: 82 }+ );+ expect(cursorPose.eyeX).toBeGreaterThan(cursorPose.bodyX);+ expect(cursorPose.bodyX).toBeGreaterThan(0);+ expect(cursorPose.leanDeg).toBeGreaterThan(0);+ expect(cursorPose.shadowScaleX).toBeGreaterThan(1);++ expect(resolveCloudCodeMonsterMotionPose(false, "right", 2)).toEqual({+ leanDeg: 0,+ skewDeg: 0,+ stretchX: 1,+ stretchY: 1,+ });+ const fastRight = resolveCloudCodeMonsterMotionPose(true, "right", 2.4);+ const fastLeft = resolveCloudCodeMonsterMotionPose(true, "left", 2.4);++ expect(fastRight.leanDeg).toBeGreaterThan(0);+ expect(fastLeft.leanDeg).toBeLessThan(0);+ expect(fastRight.stretchX).toBeGreaterThan(1);+ expect(fastRight.stretchY).toBeLessThan(1);+ });+it("creates autonomous walk velocity and reflects from canvas bounds", () => {expect(createCloudCodeMonsterWalkVelocity(0, 3)).toEqual({ x: 3, y: 0 });@@ -398,9 +625,67 @@ describe("production workspace PET mounting", () => {expect(petComponent).toContain("useAgentContextSafe");expect(petComponent).toContain("activeTaskDetails");expect(petComponent).toContain("hasRunningTasks");+ expect(petComponent).toContain("activeAgentTaskCountRef.current");+ expect(petComponent).toContain('clearPetTimer("attention")');+ expect(petComponent).toContain("resolveCloudCodeMonsterAgentWorkState");+ expect(petComponent).toContain("isTextEntryElement");+ expect(petComponent).toContain('setPlatformActivity("thinking")');+ expect(petComponent).toContain("isSleepyActivity");+ expect(petComponent).toContain("noWorkSleep");+ expect(petComponent).toContain("noWorkDoze");+ expect(petComponent).toContain('current.activityId === "dozing"');+ expect(petComponent).not.toContain("isMiniMode");+ expect(petComponent).not.toContain("data-mini=");+ expect(petComponent).toContain("resolveCloudCodeMonsterEyeOffset");+ expect(petComponent).toContain("resolveCloudCodeMonsterCursorPose");+ expect(petComponent).toContain("resolveCloudCodeMonsterMotionPose");+ expect(petComponent).toContain("const isWalkingBasic = isDragging || isAutoWalking");+ expect(petPixelParts).toContain("eyeOffset");+ expect(petPixelParts).toContain("cloud-code-monster-pet-eyes-track");+ expect(petPixelParts).toContain('activityId === "coding"');+ expect(petPixelParts).toContain("cloud-code-monster-pet-thought");+ expect(petPixelParts).toContain('x="81" y="-3" width="36" height="19" fill="#fffdfa"');+ expect(petPixelParts).toContain("cloud-code-monster-pet-thought-dot-3");+ expect(petPixelParts).toContain('<rect x="32" y="22" width="64" height="12" fill={preset.bodyTop} />');+ expect(petPixelParts).toContain('<rect x="16" y="51" width="12" height="24" fill={preset.body} />');+ expect(petPixelParts).toContain('<rect x="100" y="51" width="12" height="24" fill={preset.body} />');+ expect(petPixelParts).toContain('x="44" y="42" width="11" height="12"');+ expect(petDirectShapes).toContain("eyeOffset");+ expect(petDirectShapes).toContain("eyeOffset={eyeOffset}");+ expect(petDirectShapes).toContain('case "dust-puff-shape"');+ expect(petDirectShapes).toContain('expression === "sleeping"');+ expect(petDirectShapes).toContain('<rect x="48" y="59" width="14" height="3" fill="#f5f2dc" />');+ expect(petDirectShapes).toContain('transform={`translate(${eyeOffset?.x ?? 0} ${eyeOffset?.y ?? 0})`}');+ expect(petCssModule).toContain("--monster-cursor-body-x");+ expect(petCssModule).toContain("cloud-code-monster-eye-blink");+ expect(petCssModule).toContain('.pet[data-activity="thinking"] :global(.cloud-code-monster-pet-thought)');+ expect(petCssModule).toContain("cloud-code-monster-thought-dot");+ expect(petCssModule).not.toContain('.pet[data-activity="typing"] :global(.cloud-code-monster-pet-laptop)');+ expect(petCssModule).toContain("cloud-code-monster-fall-asleep 1.5s");+ expect(petCssModule).toContain("cloud-code-monster-wake 1.5s");+ expect(petCssModule).toContain('@keyframes cloud-code-monster-fall-asleep');+ expect(petCssModule).toContain('100% { transform: translateY(11px) rotate(-6deg) scale(1.12, 0.78); }');+ expect(petCssModule).toContain('50% { transform: translateY(12px) rotate(-6deg) scale(1.14, 0.76); }');+ expect(petCssModule).not.toContain('cloud-code-monster-doze 3.2s ease-in-out infinite');+ expect(petPixelParts).not.toContain("function MonsterHands");+ expect(petCssModule).not.toContain("cloud-code-monster-hand-type-left");+ expect(petCssModule).toContain("50% { transform: translateY(var(--monster-walk-lift, -2px)) rotate(2deg) scale(1.03, 0.97); }");+ expect(petComponent).not.toContain("setDragPose");+ expect(petComponent).not.toContain("--monster-drag-");+ expect(petCssModule).not.toContain("--monster-drag-");+ expect(petCssModule).not.toContain("cloud-code-monster-drag-walk");+ expect(petCssModule).not.toContain("cloud-code-monster-mini-peek");+ expect(petCssModule).not.toContain('data-mini="true"');+ expect(petCssModule).not.toContain('.pet[data-dragging="true"] :global(.cloud-code-monster-pet-character)');+ expect(petCssModule).not.toContain('.pet[data-dragging="true"] :global(.cloud-code-monster-pet-left-foot)');+ expect(petPixelParts).toContain("cloud-code-monster-pet-shadow-main");expect(petComponent).not.toContain("activityTriggerMode");expect(petDragHook).toContain("export function usePetDrag");expect(petDragHook).toContain("const handlePointerMove = useCallback");+ expect(petDragHook).toContain("if (isSleepyActivity(activityState?.activityId ?? null))");+ expect(petDragHook).toContain("wakeMonsterToDefault();");+ expect(petDragHook).not.toContain("DragMotionPose");+ expect(petDragHook).not.toContain("setDragPose");expect(petComponent).not.toContain("peekTargets = []");expect(petComponent).not.toContain("TimerRef = useRef");// Walk-to-target hook exists and has correct exportsdiff --git a/src/web/src/components/home-pet/cloud-code-monster-pet.tsx b/src/web/src/components/home-pet/cloud-code-monster-pet.tsxindex 0033c66ee..b1d299fd0 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet.tsx+++ b/src/web/src/components/home-pet/cloud-code-monster-pet.tsx@@ -19,12 +19,14 @@ import {clampPetPosition,createCloudCodeMonsterHiddenState,createCloudCodeMonsterIdleState,+ createCloudCodeMonsterSleepingState,createCloudCodeMonsterWalkVelocity,getBounds,getMonsterFootstepIntervalMs,readStoredActivity,readStoredPosition,reflectCloudCodeMonsterWalk,+ resolveCloudCodeMonsterAgentWorkState,resolveCloudCodeMonsterPeekPosition,resolveCloudCodeMonsterPreviewComebackState,resolveCloudCodeMonsterVisibleState,@@ -34,7 +36,11 @@ import {import { CLOUD_CODE_MONSTER_ACTIVITIES } from "./cloud-code-monster-pet-activity-data";import {CLOUD_CODE_MONSTER_AUTO_WALK_STEP_MS,+ CLOUD_CODE_MONSTER_ATTENTION_MS,+ CLOUD_CODE_MONSTER_DOZE_MS,+ CLOUD_CODE_MONSTER_ERROR_MS,CLOUD_CODE_MONSTER_FAINT_MS,+ CLOUD_CODE_MONSTER_NO_WORK_SLEEP_MS,CLOUD_CODE_MONSTER_PEEK_INTERVAL_MS,CLOUD_CODE_MONSTER_PEEK_MS,CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT,@@ -42,6 +48,7 @@ import {CLOUD_CODE_MONSTER_REACTION_MS,CLOUD_CODE_MONSTER_SHAKE_REACTION_MS,CLOUD_CODE_MONSTER_SIZE,+ CLOUD_CODE_MONSTER_WAKE_MS,} from "./cloud-code-monster-pet-constants";import { usePetDrag } from "./cloud-code-monster-pet-drag";import { useWalkToTarget } from "./cloud-code-monster-pet-walk-target";@@ -65,6 +72,7 @@ export {createCloudCodeMonsterHiddenState,createCloudCodeMonsterIdleState,createCloudCodeMonsterPreviewAwayState,+ createCloudCodeMonsterSleepingState,createCloudCodeMonsterWalkVelocity,createWalkToTargetVelocity,getCloudCodeMonsterExpression,@@ -74,6 +82,7 @@ export {isViolentMonsterDrag,pickCloudCodeMonsterActivity,reflectCloudCodeMonsterWalk,+ resolveCloudCodeMonsterAgentWorkState,resolveCloudCodeMonsterActivityState,resolveCloudCodeMonsterPeekPosition,resolveCloudCodeMonsterPreviewComebackState,@@ -88,10 +97,15 @@ export {} from "./cloud-code-monster-pet-activity-data";export {CLOUD_CODE_MONSTER_ACTIVITY_REFRESH_MS,+ CLOUD_CODE_MONSTER_ATTENTION_MS,+ CLOUD_CODE_MONSTER_DOZE_MS,+ CLOUD_CODE_MONSTER_ERROR_MS,CLOUD_CODE_MONSTER_FAINT_MIN_EVENTS,CLOUD_CODE_MONSTER_FAINT_MS,+ CLOUD_CODE_MONSTER_NO_WORK_SLEEP_MS,CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT,CLOUD_CODE_MONSTER_PRESET_STORAGE_KEY,+ CLOUD_CODE_MONSTER_WAKE_MS,} from "./cloud-code-monster-pet-constants";export { CloudCodeMonsterPresetPreview } from "./cloud-code-monster-pet-pixel-parts";export {@@ -119,6 +133,18 @@ export type CloudCodeMonsterPetProps = {};const EMPTY_PEEK_TARGETS: CloudCodeMonsterPeekTarget[] = [];+const EMPTY_EYE_OFFSET: PetPoint = { x: 0, y: 0 };+const EMPTY_CURSOR_POSE = {+ bodyX: 0,+ bodyY: 0,+ leanDeg: 0,+ shadowScaleX: 1,+ shadowX: 0,+ skewDeg: 0,+ stretchX: 1,+ stretchY: 1,+};+type CloudCodeMonsterCursorPose = typeof EMPTY_CURSOR_POSE;type PetTimerKey =| "reaction"| "shake"@@ -127,6 +153,10 @@ type PetTimerKey =| "peek"| "peekStop"| "notification"+ | "attention"+ | "noWorkDoze"+ | "noWorkSleep"+ | "typing"| "walkSettle"| "walkToTargetPeek";@@ -139,6 +169,10 @@ function createPetTimerRecord(): Record<PetTimerKey, number | null> {peek: null,peekStop: null,notification: null,+ attention: null,+ noWorkDoze: null,+ noWorkSleep: null,+ typing: null,walkSettle: null,walkToTargetPeek: null,};@@ -177,6 +211,129 @@ function usePetTimers() {return { clearAllPetTimers, clearPetTimer, setPetTimer };}+function clampNumber(value: number, min: number, max: number) {+ return Math.min(max, Math.max(min, value));+}++function roundToQuarter(value: number) {+ return Math.round(value * 4) / 4;+}++function isSleepyActivity(activityId: CloudCodeMonsterActivityId | null) {+ return activityId === "sleeping" || activityId === "dozing" || activityId === "yawning";+}++function isTextEntryElement(target: EventTarget | null) {+ if (!(target instanceof HTMLElement)) {+ return false;+ }++ if (target.isContentEditable) {+ return true;+ }++ const tagName = target.tagName.toLowerCase();+ if (tagName === "textarea") {+ return true;+ }++ if (tagName !== "input") {+ return false;+ }++ const input = target as HTMLInputElement;+ const inputType = input.type.toLowerCase();+ return ![+ "button",+ "checkbox",+ "color",+ "file",+ "hidden",+ "image",+ "radio",+ "range",+ "reset",+ "submit",+ ].includes(inputType);+}++export function resolveCloudCodeMonsterCursorPose(+ cursor: PetPoint,+ position: PetPoint,+ size = CLOUD_CODE_MONSTER_SIZE+): CloudCodeMonsterCursorPose & { eyeX: number; eyeY: number } {+ const faceCenter = {+ x: position.x + size.width * 0.5,+ y: position.y + size.height * 0.45,+ };+ const relX = cursor.x - faceCenter.x;+ const relY = cursor.y - faceCenter.y;+ const distance = Math.hypot(relX, relY);++ if (distance <= 1) {+ return { ...EMPTY_CURSOR_POSE, eyeX: 0, eyeY: 0 };+ }++ const directionX = relX / distance;+ const directionY = relY / distance;+ const pull = Math.min(1, distance / 240);+ const eyeMaxX = 5.5;+ const eyeMaxY = 4;+ const bodyMaxX = 2;+ const bodyMaxY = 1.25;++ return {+ eyeX: roundToQuarter(directionX * eyeMaxX * pull),+ eyeY: roundToQuarter(directionY * eyeMaxY * pull),+ bodyX: roundToQuarter(directionX * bodyMaxX * pull),+ bodyY: roundToQuarter(directionY * bodyMaxY * pull),+ leanDeg: Number((directionX * 2.8 * pull).toFixed(2)),+ shadowScaleX: Number((1 + Math.abs(directionX) * 0.08 * pull).toFixed(3)),+ shadowX: roundToQuarter(directionX * 0.8 * pull),+ skewDeg: Number((directionX * 1.6 * pull).toFixed(2)),+ stretchX: Number((1 + Math.abs(directionX) * 0.025 * pull).toFixed(3)),+ stretchY: Number((1 - Math.abs(directionX) * 0.018 * pull).toFixed(3)),+ };+}++export function resolveCloudCodeMonsterEyeOffset(+ cursor: PetPoint,+ position: PetPoint,+ size = CLOUD_CODE_MONSTER_SIZE+): PetPoint {+ const pose = resolveCloudCodeMonsterCursorPose(cursor, position, size);+ return {+ x: pose.eyeX,+ y: pose.eyeY,+ };+}++export function resolveCloudCodeMonsterMotionPose(+ isWalking: boolean,+ direction: "left" | "right",+ intensity: number+) {+ if (!isWalking) {+ return {+ leanDeg: 0,+ skewDeg: 0,+ stretchX: 1,+ stretchY: 1,+ };+ }++ const normalized = clampNumber(intensity, 0.75, 2.4);+ const directionSign = direction === "right" ? 1 : -1;+ const motion = (normalized - 0.75) / 1.65;++ return {+ leanDeg: Number((directionSign * (2.5 + motion * 5)).toFixed(2)),+ skewDeg: Number((directionSign * (1.5 + motion * 4)).toFixed(2)),+ stretchX: Number((1 + motion * 0.07).toFixed(3)),+ stretchY: Number((1 - motion * 0.055).toFixed(3)),+ };+}+export function CloudCodeMonsterPet({boundaryRef,initialPosition,@@ -191,6 +348,7 @@ export function CloudCodeMonsterPet({const [isAutoWalking, setIsAutoWalking] = useState(false);const [isPeeking, setIsPeeking] = useState(false);const [notificationActive, setNotificationActive] = useState(false);+ const [isUserTyping, setIsUserTyping] = useState(false);const [reacting, setReacting] = useState(false);const [shaken, setShaken] = useState(false);const [fainted, setFainted] = useState(false);@@ -199,6 +357,9 @@ export function CloudCodeMonsterPet({);const [walkIntensity, setWalkIntensity] = useState(1);const [walkDirection, setWalkDirection] = useState<"left" | "right">("right");+ const [eyeOffset, setEyeOffset] = useState<PetPoint>(EMPTY_EYE_OFFSET);+ const [cursorPose, setCursorPose] =+ useState<CloudCodeMonsterCursorPose>(EMPTY_CURSOR_POSE);const [footprints, setFootprints] = useState<Footprint[]>([]);const lastFootstepAtRef = useRef(0);const autoWalkVelocityRef = useRef<PetPoint | null>(null);@@ -321,6 +482,41 @@ export function CloudCodeMonsterPet({return clearAllPetTimers;}, [clearAllPetTimers]);+ useEffect(() => {+ const markTyping = (event: Event) => {+ if (!isTextEntryElement(event.target)) {+ return;+ }++ setIsUserTyping(true);+ setPetTimer("typing", () => {+ setIsUserTyping(false);+ }, 2_200);+ };+ const clearTypingIfLeavingText = (event: Event) => {+ if (isTextEntryElement(event.target)) {+ setPetTimer("typing", () => {+ setIsUserTyping(false);+ }, 250);+ }+ };++ window.addEventListener("keydown", markTyping, true);+ window.addEventListener("input", markTyping, true);+ window.addEventListener("compositionstart", markTyping, true);+ window.addEventListener("compositionupdate", markTyping, true);+ window.addEventListener("focusout", clearTypingIfLeavingText, true);++ return () => {+ window.removeEventListener("keydown", markTyping, true);+ window.removeEventListener("input", markTyping, true);+ window.removeEventListener("compositionstart", markTyping, true);+ window.removeEventListener("compositionupdate", markTyping, true);+ window.removeEventListener("focusout", clearTypingIfLeavingText, true);+ clearPetTimer("typing");+ };+ }, [clearPetTimer, setPetTimer]);+const activity = useMemo(() => {if (!activityState?.activityId) {return null;@@ -423,6 +619,7 @@ export function CloudCodeMonsterPet({const isWalkingToTarget = walkToTarget.isWalking || walkToTarget.isIdlingAtTarget;const isWalking = isWalkingBasic || walkToTarget.isWalking;+ const effectiveWalkDirection = isWalkingToTarget ? walkToTarget.walkDirection : walkDirection;const wasWalkingToTargetRef = useRef(false);useEffect(() => {@@ -435,32 +632,149 @@ export function CloudCodeMonsterPet({// --- Working state: lock activity when agents have running tasks ---const agentCtx = useAgentContextSafe();- const hasRunningTasks = (agentCtx?.activeTaskDetails.length ?? 0) > 0;- const workingActivityRef = useRef<CloudCodeMonsterActivityId | null>(null);+ const activeAgentTaskCount = agentCtx?.activeTaskDetails.length ?? 0;+ const activeAgentTaskCountRef = useRef(activeAgentTaskCount);+ const hasRunningTasks = activeAgentTaskCount > 0;+ const subscribeWs = agentCtx?.subscribeWs;++ useEffect(() => {+ activeAgentTaskCountRef.current = activeAgentTaskCount;+ }, [activeAgentTaskCount]);++ const setPlatformActivity = useCallback((activityId: CloudCodeMonsterActivityId | null) => {+ const nextState = {+ activityId,+ updatedAt: Date.now(),+ hiddenAt: null,+ };+ writeStoredActivity(nextState);+ setActivityState(nextState);+ }, []);useEffect(() => {- if (hasRunningTasks && !isWalkingToTarget) {- if (!workingActivityRef.current) {- const workingActivities: CloudCodeMonsterActivityId[] = ["coding", "thinking", "reading"];- workingActivityRef.current =- workingActivities[Math.floor(Math.random() * workingActivities.length)]!;+ if (isUserTyping) {+ clearPetTimer("attention");+ clearPetTimer("noWorkSleep");+ clearPetTimer("noWorkDoze");+ return;+ }++ if (hasRunningTasks) {+ const wasSleeping = isSleepyActivity(activityState?.activityId ?? null);+ clearPetTimer("noWorkSleep");+ clearPetTimer("noWorkDoze");+ if (isWalkingToTarget) {+ return;+ }++ if (wasSleeping) {+ setPlatformActivity("waking");+ setPetTimer("attention", () => {+ setActivityState((current) => {+ const next = resolveCloudCodeMonsterAgentWorkState(+ activeAgentTaskCountRef.current,+ current,+ Date.now()+ );+ writeStoredActivity(next);+ return next;+ });+ }, CLOUD_CODE_MONSTER_WAKE_MS);+ return;}- const lockedActivity = workingActivityRef.current;+setActivityState((current) => {- if (current?.activityId === lockedActivity) return current;- const next = { activityId: lockedActivity, updatedAt: Date.now(), hiddenAt: null };+ const next = resolveCloudCodeMonsterAgentWorkState(+ activeAgentTaskCount,+ current,+ Date.now()+ );+ if (+ current?.activityId === next.activityId &&+ current.hiddenAt === next.hiddenAt+ ) {+ return current;+ }writeStoredActivity(next);return next;});- } else if (!hasRunningTasks) {- if (workingActivityRef.current) {- workingActivityRef.current = null;- const nextState = createCloudCodeMonsterIdleState();- writeStoredActivity(nextState);- setActivityState(nextState);- }+ return;+ }++ if (+ isWalkingToTarget ||+ isDragging ||+ isUserTyping ||+ reacting ||+ shaken ||+ fainted ||+ notificationActive+ ) {+ clearPetTimer("attention");+ clearPetTimer("noWorkDoze");+ clearPetTimer("noWorkSleep");+ return;}- }, [hasRunningTasks, isWalkingToTarget]);++ setActivityState((current) => {+ if (+ !current ||+ current.activityId === "sleeping" ||+ current.activityId === "dozing" ||+ current.activityId === null+ ) {+ return current;+ }+ const nextState = createCloudCodeMonsterIdleState();+ writeStoredActivity(nextState);+ return nextState;+ });++ setPetTimer("noWorkDoze", () => {+ setActivityState((current) => {+ if (current?.activityId === "sleeping" || current?.activityId === "dozing") {+ return current;+ }+ const nextState: StoredCloudCodeMonsterActivity = {+ activityId: "dozing",+ updatedAt: Date.now(),+ hiddenAt: null,+ };+ writeStoredActivity(nextState);+ return nextState;+ });+ }, CLOUD_CODE_MONSTER_DOZE_MS);++ setPetTimer("noWorkSleep", () => {+ setActivityState((current) => {+ if (current?.activityId === "sleeping") {+ return current;+ }+ const nextState = createCloudCodeMonsterSleepingState();+ writeStoredActivity(nextState);+ return nextState;+ });+ }, CLOUD_CODE_MONSTER_NO_WORK_SLEEP_MS);++ return () => {+ clearPetTimer("noWorkDoze");+ clearPetTimer("noWorkSleep");+ };+ }, [+ activeAgentTaskCount,+ activityState?.activityId,+ clearPetTimer,+ fainted,+ hasRunningTasks,+ isDragging,+ isWalkingToTarget,+ isUserTyping,+ notificationActive,+ reacting,+ setPlatformActivity,+ setPetTimer,+ shaken,+ ]);const pushFootprint = useCallback((nextPosition: PetPoint, intensity: number) => {const side = nextFootSideRef.current;@@ -621,6 +935,14 @@ export function CloudCodeMonsterPet({]);const wakeMonsterToDefault = useCallback(() => {+ if (isSleepyActivity(activityState?.activityId ?? null)) {+ setPlatformActivity("waking");+ setPetTimer("attention", () => {+ setPlatformActivity(null);+ }, CLOUD_CODE_MONSTER_WAKE_MS);+ return;+ }+setActivityState((current) => {if (current && !current.activityId && current.hiddenAt === null) {return current;@@ -630,7 +952,7 @@ export function CloudCodeMonsterPet({writeStoredActivity(nextState);return nextState;});- }, []);+ }, [activityState?.activityId, setPetTimer, setPlatformActivity]);const stopTemporaryMotion = useCallback(() => {setIsAutoWalking(false);@@ -644,6 +966,108 @@ export function CloudCodeMonsterPet({clearPetTimer("walkToTargetPeek");}, [clearPetTimer]);+ useEffect(() => {+ if (isDragging || fainted) {+ return;+ }++ if (!isUserTyping) {+ if (activityState?.activityId === "thinking" || activityState?.activityId === "typing") {+ setPlatformActivity(null);+ }+ return;+ }++ clearPetTimer("noWorkDoze");+ clearPetTimer("noWorkSleep");+ stopTemporaryMotion();++ if (activityState?.activityId === "thinking" || activityState?.activityId === "waking") {+ return;+ }++ if (isSleepyActivity(activityState?.activityId ?? null)) {+ setPlatformActivity("waking");+ setPetTimer("attention", () => {+ setPlatformActivity("thinking");+ }, CLOUD_CODE_MONSTER_WAKE_MS);+ return;+ }++ setPlatformActivity("thinking");+ }, [+ activityState?.activityId,+ clearPetTimer,+ fainted,+ isDragging,+ isUserTyping,+ setPetTimer,+ setPlatformActivity,+ stopTemporaryMotion,+ ]);++ useEffect(() => {+ if (!subscribeWs) {+ return;+ }++ const showTransientActivity = (+ activityId: CloudCodeMonsterActivityId,+ durationMs = CLOUD_CODE_MONSTER_ATTENTION_MS+ ) => {+ stopTemporaryMotion();+ const showActivity = () => {+ setPlatformActivity(activityId);+ setPetTimer("attention", () => {+ setActivityState((current) => {+ if (current?.activityId !== activityId) {+ return current;+ }+ const nextState = createCloudCodeMonsterIdleState();+ writeStoredActivity(nextState);+ return nextState;+ });+ }, durationMs);+ };++ if (isSleepyActivity(activityState?.activityId ?? null)) {+ setPlatformActivity("waking");+ setPetTimer("attention", showActivity, CLOUD_CODE_MONSTER_WAKE_MS);+ return;+ }++ showActivity();+ };++ return subscribeWs((msg) => {+ if (msg.type === "task.created" || msg.type === "followup.dispatched") {+ showTransientActivity("carrying", 3_000);+ } else if (msg.type === "artifact.uploaded" || msg.type === "workspace.files") {+ showTransientActivity("carrying", 3_000);+ } else if (msg.type === "followup.deleted") {+ showTransientActivity("sweeping", 3_000);+ } else if (msg.type === "followup.dispatch_failed") {+ showTransientActivity("error", CLOUD_CODE_MONSTER_ERROR_MS);+ } else if (msg.type === "email.received") {+ showTransientActivity("notification", CLOUD_CODE_MONSTER_ATTENTION_MS);+ } else if (msg.type === "task.updated") {+ if (msg.status === "completed") {+ showTransientActivity("attention", CLOUD_CODE_MONSTER_ATTENTION_MS);+ } else if (msg.status === "failed") {+ showTransientActivity("error", CLOUD_CODE_MONSTER_ERROR_MS);+ } else if (msg.status === "cancelled" || msg.status === "superseded") {+ showTransientActivity("sweeping", 3_000);+ }+ }+ });+ }, [+ activityState?.activityId,+ setPetTimer,+ setPlatformActivity,+ stopTemporaryMotion,+ subscribeWs,+ ]);+const startShockReaction = useCallback(() => {setReacting(true);setPetTimer("reaction", () => {@@ -657,18 +1081,38 @@ export function CloudCodeMonsterPet({}stopTemporaryMotion();+ const showNotification = () => {+ startShockReaction();+ setPlatformActivity("notification");+ setNotificationActive(true);++ setPetTimer("notification", () => {+ setNotificationActive(false);+ setActivityState((current) => {+ if (current?.activityId !== "notification") {+ return current;+ }+ const nextState = createCloudCodeMonsterIdleState();+ writeStoredActivity(nextState);+ return nextState;+ });+ }, CLOUD_CODE_MONSTER_REACTION_MS + 1_500);+ };++ if (isSleepyActivity(activityState?.activityId ?? null)) {+ setPlatformActivity("waking");+ setPetTimer("attention", showNotification, CLOUD_CODE_MONSTER_WAKE_MS);+ return;+ }+if (activityState?.activityId) {wakeMonsterToDefault();}- startShockReaction();- setNotificationActive(true);-- setPetTimer("notification", () => {- setNotificationActive(false);- }, CLOUD_CODE_MONSTER_REACTION_MS + 1_500);+ showNotification();}, [activityState?.activityId,notificationToken,+ setPlatformActivity,setPetTimer,startShockReaction,stopTemporaryMotion,@@ -747,11 +1191,62 @@ export function CloudCodeMonsterPet({wakeMonsterToDefault,});+ useEffect(() => {+ if (!position) {+ setEyeOffset(EMPTY_EYE_OFFSET);+ setCursorPose(EMPTY_CURSOR_POSE);+ return;+ }++ const handlePointerLook = (event: PointerEvent) => {+ const boundaryRect = boundaryRef.current?.getBoundingClientRect();+ const cursor = {+ x: event.clientX - (boundaryRect?.left ?? 0),+ y: event.clientY - (boundaryRect?.top ?? 0),+ };+ const nextPose = resolveCloudCodeMonsterCursorPose(cursor, position);+ const nextOffset = { x: nextPose.eyeX, y: nextPose.eyeY };+ setEyeOffset((current) =>+ current.x === nextOffset.x && current.y === nextOffset.y+ ? current+ : nextOffset+ );+ setCursorPose((current) =>+ current.bodyX === nextPose.bodyX &&+ current.bodyY === nextPose.bodyY &&+ current.leanDeg === nextPose.leanDeg &&+ current.shadowScaleX === nextPose.shadowScaleX &&+ current.shadowX === nextPose.shadowX &&+ current.skewDeg === nextPose.skewDeg &&+ current.stretchX === nextPose.stretchX &&+ current.stretchY === nextPose.stretchY+ ? current+ : nextPose+ );+ };++ window.addEventListener("pointermove", handlePointerLook, { passive: true });++ return () => {+ window.removeEventListener("pointermove", handlePointerLook);+ };+ }, [boundaryRef, position]);+if (!position || !activityState) {return null;}const displayedActivity = isPeeking || fainted ? null : activity;+ const motionPose = resolveCloudCodeMonsterMotionPose(+ isWalking,+ effectiveWalkDirection,+ walkIntensity+ );+ const mirrorSign = effectiveWalkDirection === "left" ? -1 : 1;+ const visualEyeOffset = {+ x: eyeOffset.x * mirrorSign,+ y: eyeOffset.y,+ };return (<div className={styles.petLayer}>@@ -790,7 +1285,7 @@ export function CloudCodeMonsterPet({data-activity={displayedActivity?.id ?? "idle"}data-dragging={isDragging}data-walking={isWalking}- data-direction={isWalkingToTarget ? walkToTarget.walkDirection : walkDirection}+ data-direction={effectiveWalkDirection}data-reaction={shaken ? "shake" : reacting ? "shock" : "none"}data-reacting={reacting}data-shaken={shaken}@@ -808,6 +1303,18 @@ export function CloudCodeMonsterPet({2 * Math.max(0.75, walkIntensity))}px`,"--monster-walk-intensity": String(walkIntensity),+ "--monster-motion-lean": `${motionPose.leanDeg * mirrorSign}deg`,+ "--monster-motion-skew": `${motionPose.skewDeg * mirrorSign}deg`,+ "--monster-motion-stretch-x": String(motionPose.stretchX),+ "--monster-motion-stretch-y": String(motionPose.stretchY),+ "--monster-cursor-body-x": `${cursorPose.bodyX * mirrorSign}px`,+ "--monster-cursor-body-y": `${cursorPose.bodyY}px`,+ "--monster-cursor-lean": `${cursorPose.leanDeg * mirrorSign}deg`,+ "--monster-cursor-skew": `${cursorPose.skewDeg * mirrorSign}deg`,+ "--monster-cursor-stretch-x": String(cursorPose.stretchX),+ "--monster-cursor-stretch-y": String(cursorPose.stretchY),+ "--monster-cursor-shadow-x": `${cursorPose.shadowX * mirrorSign}px`,+ "--monster-cursor-shadow-scale-x": String(cursorPose.shadowScaleX),} as CSSProperties}>@@ -859,6 +1366,7 @@ export function CloudCodeMonsterPet({reacting={reacting}shaken={shaken}fainted={fainted}+ eyeOffset={visualEyeOffset}/></button></aside>