Files
Codeman/test/mobile/helpers/cdp.ts
T
Codeman maintainer f604deba3e chore: remove backend code nothing references
Found with knip (exports, types, class members) and confirmed by a text
search of src, test, scripts and packages before each removal.

- Per-CLI get<Cli>NotFoundMessage() (nine of them) with their message
  constants: missingCliMessage() builds that text from the registry now.
- Registry leftovers: renderCliCommand, asCliId, cliIds, isCliRunnable,
  createCliResolverForTest, profileExists, and two name lists that only
  repeated schema enums.
- A task-description cache in Session that was written on every chunk of
  terminal output (one regex pass per line) and never read since the
  subagent watcher takes descriptions from transcripts. The cache module,
  its pattern and both parse methods go with it.
- Session.parentAgentId / childAgentIds: never set by anything, so the two
  optional SessionState fields were never on the wire.
- Unreferenced methods on TmuxManager (pipe-pane pair, syncMouseMode),
  RespawnController, StateStore.recoverFromBackup (load() already falls
  back to the .bak file), TeamWatcher, SseStreamManager and the AI
  checkers' getErrorVerdict.
- updateCaseEnvVars: the settings.local.json env path that envOverrides
  replaced.
- Re-exports in the utils, cli-registry, routes and prompts barrels that
  no importer used, and unused test helpers (MockStateStore, the mobile
  throttle helpers and others).

Eight mobile tests imported the WebServer type from a path that does not
exist (../src instead of ../../src); type-only, so nothing failed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-13 13:58:22 +01:00

42 lines
1.3 KiB
TypeScript

import type { Page, CDPSession } from 'playwright';
/** Get or create a CDP session for the page (Chromium only) */
export async function getCDP(page: Page): Promise<CDPSession> {
return page.context().newCDPSession(page);
}
/** Shrink visual viewport to simulate keyboard via device metrics override.
* Triggers REAL visualViewport resize event that KeyboardHandler detects. */
export async function setVisualViewportHeight(
cdp: CDPSession,
width: number,
height: number,
scale: number,
): Promise<void> {
await cdp.send('Emulation.setDeviceMetricsOverride', {
width,
height,
deviceScaleFactor: scale,
mobile: true,
});
}
/** Clear device metrics override, restoring original viewport */
export async function clearDeviceMetricsOverride(cdp: CDPSession): Promise<void> {
await cdp.send('Emulation.clearDeviceMetricsOverride');
}
/** Dispatch a trusted touch event via CDP Input domain.
* Produces isTrusted=true events, unlike synthetic TouchEvent dispatch. */
export async function dispatchTouchEvent(
cdp: CDPSession,
type: 'touchStart' | 'touchMove' | 'touchEnd' | 'touchCancel',
touchPoints: Array<{ x: number; y: number }>,
): Promise<void> {
await cdp.send('Input.dispatchTouchEvent', {
type,
touchPoints: touchPoints.map(p => ({ x: Math.round(p.x), y: Math.round(p.y) })),
});
}