Improve IK-style artifact scanner pipeline
This commit is contained in:
Vendored
+76
-1
@@ -3,6 +3,18 @@ import type { StoredArtifactRecord } from "./storage";
|
||||
|
||||
export interface CaptureOptions {
|
||||
skipOcr?: boolean;
|
||||
skipOcrUnlessArtifactDetail?: boolean;
|
||||
ocrMode?: "full" | "artifact";
|
||||
ocrProfile?: "full" | "fast";
|
||||
ocrEngine?: "current" | "native-tesseract" | "benchmark" | "ik-traineddata";
|
||||
scanEntryMode?: "visible-inventory" | "direct-inventory" | "paimon-menu" | "auto-entry";
|
||||
omitFullFrame?: boolean;
|
||||
omitDetailPreview?: boolean;
|
||||
omitInventoryPreview?: boolean;
|
||||
omitCrops?: boolean;
|
||||
omitCropImages?: boolean;
|
||||
omitEquippedOcr?: boolean;
|
||||
omitLockState?: boolean;
|
||||
}
|
||||
|
||||
export interface CaptureSourceInfo {
|
||||
@@ -16,7 +28,7 @@ export interface CaptureCrop {
|
||||
id: string;
|
||||
label: string;
|
||||
rect: { x: number; y: number; width: number; height: number };
|
||||
dataUrl: string;
|
||||
dataUrl?: string;
|
||||
}
|
||||
|
||||
export interface OcrResult {
|
||||
@@ -24,6 +36,7 @@ export interface OcrResult {
|
||||
label: string;
|
||||
text: string;
|
||||
confidence: number;
|
||||
elapsedMs?: number;
|
||||
}
|
||||
|
||||
export type CaptureTarget = "genshin-client" | "primary-screen" | "desktop-source";
|
||||
@@ -38,6 +51,8 @@ export interface CaptureResult {
|
||||
captureTarget?: CaptureTarget;
|
||||
detailDataUrl?: string;
|
||||
inventoryDataUrl?: string;
|
||||
detailFingerprint?: string;
|
||||
inventoryFingerprint?: string;
|
||||
ocrSkipped?: boolean;
|
||||
ocrTimedOut?: boolean;
|
||||
crops?: CaptureCrop[];
|
||||
@@ -49,6 +64,23 @@ export interface CaptureResult {
|
||||
confidence: number;
|
||||
source: "detected" | "fallback" | "missing";
|
||||
};
|
||||
artifactDetail?: {
|
||||
present: boolean;
|
||||
confidence: number;
|
||||
orangeHits: number;
|
||||
greenHits: number;
|
||||
textHits: number;
|
||||
titleOrangeHits?: number;
|
||||
upperTextHits?: number;
|
||||
lowerGreenHits?: number;
|
||||
};
|
||||
paimonMenu?: {
|
||||
present: boolean;
|
||||
confidence: number;
|
||||
profileLightPct: number;
|
||||
profileCreamPct: number;
|
||||
menuTileDarkPct: number;
|
||||
};
|
||||
inventoryCount?: {
|
||||
current: number;
|
||||
total: number;
|
||||
@@ -57,11 +89,23 @@ export interface CaptureResult {
|
||||
text: string;
|
||||
};
|
||||
locked?: boolean;
|
||||
sanctified?: boolean;
|
||||
layout?: {
|
||||
aspect: string;
|
||||
isSixteenNine: boolean;
|
||||
warning: string;
|
||||
};
|
||||
timings?: {
|
||||
totalMs: number;
|
||||
prepareMs: number;
|
||||
ocrMs: number;
|
||||
cropCount: number;
|
||||
ocrEngine: CaptureOptions["ocrEngine"];
|
||||
ocrWorkerPoolSize?: number;
|
||||
ocrProfile?: CaptureOptions["ocrProfile"];
|
||||
ocrFieldMs?: Record<string, number>;
|
||||
ocrSkipped: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface WindowBounds {
|
||||
@@ -97,6 +141,7 @@ export interface RuntimeInfo {
|
||||
ok: boolean;
|
||||
isElevated: boolean;
|
||||
platform: string;
|
||||
appBuild?: AppRuntimeInfo;
|
||||
hotkeys?: Record<string, boolean>;
|
||||
genshinFound?: boolean;
|
||||
genshinHwnd?: number;
|
||||
@@ -106,6 +151,15 @@ export interface RuntimeInfo {
|
||||
helperPid?: number;
|
||||
}
|
||||
|
||||
export interface AppRuntimeInfo {
|
||||
signature: string;
|
||||
pid: number;
|
||||
startedAt: string;
|
||||
cwd: string;
|
||||
isDev: boolean;
|
||||
expectedOcrWorkerPoolSize?: number;
|
||||
}
|
||||
|
||||
export interface FocusGenshinResult {
|
||||
focused: boolean;
|
||||
alreadyForeground: boolean;
|
||||
@@ -132,6 +186,8 @@ export type ScannerCommand =
|
||||
| {
|
||||
type: "start-auto";
|
||||
scanLimit?: number;
|
||||
scanEntryMode?: CaptureOptions["scanEntryMode"];
|
||||
ocrEngine?: CaptureOptions["ocrEngine"];
|
||||
};
|
||||
|
||||
export interface ScannerLearningRulePayload {
|
||||
@@ -184,6 +240,17 @@ export interface ScrollResult {
|
||||
isElevated?: boolean;
|
||||
}
|
||||
|
||||
export interface KeyPressResult {
|
||||
ok: boolean;
|
||||
key: string;
|
||||
focused?: boolean;
|
||||
foregroundProcess?: string;
|
||||
targetProcess?: string;
|
||||
isElevated?: boolean;
|
||||
inputBlocked?: boolean;
|
||||
eventsSent?: number;
|
||||
}
|
||||
|
||||
export type ArtifactSaveResult = ArtifactStoreSaveResult;
|
||||
|
||||
export interface ArtifactStoreLoadResult {
|
||||
@@ -267,9 +334,16 @@ export interface ScannerStatusPayload {
|
||||
snapshotBuilds: number;
|
||||
grid: CaptureResult["inventoryGrid"] | null;
|
||||
automationLog: string[];
|
||||
diagnosticEvents?: unknown[];
|
||||
runtimeInfo: RuntimeInfo | null;
|
||||
appBuild?: AppRuntimeInfo;
|
||||
storedTotal: number | null;
|
||||
learningRuleCount: number;
|
||||
lookupStatus?: unknown;
|
||||
ocrEngine?: CaptureOptions["ocrEngine"];
|
||||
ocrWarmup?: unknown;
|
||||
entryMode?: CaptureOptions["scanEntryMode"];
|
||||
benchmarkSummary?: unknown;
|
||||
updatedAt: string | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
@@ -309,6 +383,7 @@ declare global {
|
||||
captureSource: (sourceId: string, delayMs?: number, focusGenshin?: boolean, options?: CaptureOptions) => Promise<CaptureResult>;
|
||||
clickScreen: (x: number, y: number) => Promise<ClickResult>;
|
||||
scrollScreen: (notches: number, anchorX?: number, anchorY?: number) => Promise<ScrollResult>;
|
||||
keyPress: (key: string) => Promise<KeyPressResult>;
|
||||
getAutomationGuard: () => Promise<AutomationGuard>;
|
||||
focusMainWindow: () => Promise<BooleanResult>;
|
||||
focusGenshin: () => Promise<FocusGenshinResult>;
|
||||
|
||||
Reference in New Issue
Block a user