MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveRequestTrackingId

Function resolveRequestTrackingId

src/daemon/request-cancel.ts:8–26  ·  view source on GitHub ↗
(
  requestId: string | undefined,
  fallbackSeed?: unknown,
)

Source from the content-addressed store, hash-verified

6const REQUEST_CANCELED_MESSAGE = 'request canceled';
7
8export function resolveRequestTrackingId(
9 requestId: string | undefined,
10 fallbackSeed?: unknown,
11): string {
12 if (typeof requestId === 'string' && requestId.length > 0) return requestId;
13 const rawSeed =
14 typeof fallbackSeed === 'string'
15 ? fallbackSeed
16 : typeof fallbackSeed === 'number' && Number.isFinite(fallbackSeed)
17 ? String(fallbackSeed)
18 : 'generated';
19 const normalizedSeed =
20 rawSeed
21 .trim()
22 .replace(/[^a-zA-Z0-9_-]/g, '_')
23 .slice(0, 32) || 'generated';
24 const nonce = Math.random().toString(36).slice(2, 10);
25 return `req:${normalizedSeed}:${process.pid}:${Date.now()}:${nonce}`;
26}
27
28const COLLECTION_HIGH_WATERMARK = 50_000;
29const COLLECTION_EVICT_COUNT = 10_000;

Callers 4

createSocketServerFunction · 0.90
createDaemonHttpServerFunction · 0.90

Calls 1

isFiniteMethod · 0.80

Tested by

no test coverage detected