Skip to main content

Coordinate Cache Management

Endpoints for managing UI element coordinate caching to improve automation performance.

Cache Inspection

GET /api/coordinate-cache/check

Checks cached coordinates for UI elements.

Query Parameters:

  • deviceId: Filter by device
  • flowId: Filter by flow
  • elementId: Filter by element

Response:

{
"cache": {
"device-123": {
"flow-456": {
"login_button": {
"x": 540,
"y": 1200,
"confidence": 0.95,
"lastUpdated": "2024-01-01T00:00:00.000Z",
"usageCount": 25
},
"username_field": {
"x": 300,
"y": 800,
"confidence": 0.92,
"lastUpdated": "2024-01-01T00:00:00.000Z",
"usageCount": 30
}
}
}
},
"totalEntries": 2,
"lastUpdated": "2024-01-01T00:00:00.000Z"
}

GET /api/coordinate-cache/stats

Gets cache statistics.

Response:

{
"totalEntries": 150,
"totalDevices": 5,
"totalFlows": 12,
"cacheHitRate": 0.85,
"averageConfidence": 0.91,
"oldestEntry": "2024-01-01T00:00:00.000Z",
"newestEntry": "2024-01-01T02:00:00.000Z",
"storageSize": "2.5MB"
}

GET /api/coordinate-cache/flow/:flowId

Gets coordinate cache for a specific flow.

Parameters:

  • flowId: Flow identifier

Response:

{
"flowId": "flow-456",
"devices": {
"device-123": {
"elements": {
"login_button": {
"x": 540,
"y": 1200,
"confidence": 0.95,
"bbox": [500, 1150, 580, 1250],
"lastUpdated": "2024-01-01T00:00:00.000Z"
}
}
}
}
}

Cache Management

POST /api/coordinate-cache/store

Stores coordinates in cache.

Request Body:

{
"deviceId": "device-123",
"flowId": "flow-456",
"elements": {
"login_button": {
"x": 540,
"y": 1200,
"confidence": 0.95,
"bbox": [500, 1150, 580, 1250]
},
"username_field": {
"x": 300,
"y": 800,
"confidence": 0.92,
"bbox": [250, 750, 350, 850]
}
}
}

Response:

{
"success": true,
"stored": 2,
"updated": 0,
"skipped": 0
}

POST /api/coordinate-cache/cleanup

Cleans up old or invalid cache entries.

Request Body:

{
"olderThan": 86400000, // 24 hours in milliseconds
"confidenceThreshold": 0.7,
"unusedThreshold": 604800000 // 7 days in milliseconds
}

Response:

{
"success": true,
"removed": {
"oldEntries": 15,
"lowConfidence": 3,
"unused": 8
},
"totalRemoved": 26
}

POST /api/coordinate-cache/recompute

Recomputes coordinates for cached elements.

Request Body:

{
"deviceId": "device-123",
"flowId": "flow-456",
"force": false
}

Response:

{
"success": true,
"recomputed": 5,
"failed": 1,
"updated": 4
}

POST /api/coordinate-cache/backfill-normalized

Backfills normalized coordinates for existing cache entries.

Request Body:

{
"deviceIds": ["device-123", "device-456"],
"overwrite": false
}

Response:

{
"success": true,
"backfilled": 25,
"skipped": 5,
"errors": 0
}

PUT /api/coordinate-cache/entry/:entryId

Updates a specific cache entry.

Parameters:

  • entryId: Cache entry identifier

Request Body:

{
"x": 550,
"y": 1210,
"confidence": 0.97,
"bbox": [510, 1160, 590, 1260]
}

PUT /api/coordinate-cache/flow/:flowId/validate

Validates cache entries for a flow.

Parameters:

  • flowId: Flow identifier

Request Body:

{
"deviceId": "device-123",
"revalidate": true
}

Cache Deletion

DELETE /api/coordinate-cache/invalidate

Invalidates cached coordinates.

Request Body:

{
"deviceId": "device-123",
"flowId": "flow-456",
"elementId": "login_button"
}

Response:

{
"success": true,
"invalidated": 1
}

DELETE /api/coordinate-cache/entry/:entryId

Deletes a specific cache entry.

Parameters:

  • entryId: Cache entry identifier

DELETE /api/coordinate-cache/device/:deviceId/clear

Clears all cache entries for a device.

Parameters:

  • deviceId: Device identifier

Response:

{
"success": true,
"removed": 15
}

DELETE /api/coordinate-cache/flow/:flowId/clear

Clears all cache entries for a flow.

Parameters:

  • flowId: Flow identifier

Response:

{
"success": true,
"removed": 8
}