MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / instanceIdFromSandboxId

Function instanceIdFromSandboxId

packages/worker-utils/src/instance-id.ts:47–53  ·  view source on GitHub ↗
(sandboxId: string)

Source from the content-addressed store, hash-verified

45 * Throws if the sandboxId is not in the expected format.
46 */
47export function instanceIdFromSandboxId(sandboxId: string): string {
48 if (!isInstanceKeyedSandboxId(sandboxId)) {
49 throw new Error('Not an instance-keyed sandboxId (expected ki_ prefix, 35 chars)');
50 }
51 const hex = sandboxId.slice(3); // strip "ki_"
52 return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
53}
54
55/**
56 * Return the subject used to bucket image-version rollouts.

Callers 14

GETFunction · 0.90
resolveHostRouteDoKeyFunction · 0.90
resolveHostSandboxIdFunction · 0.90
controller.tsFile · 0.90
doKeyFromActiveInstanceFunction · 0.90
getRestoreInstanceFunction · 0.90
getAppKeyFunction · 0.90

Calls 1

isInstanceKeyedSandboxIdFunction · 0.85

Tested by

no test coverage detected