MCPcopy Create free account
hub / github.com/callstack/agent-device / resolveInstallSource

Function resolveInstallSource

src/commands/management/runtime/admin.ts:180–205  ·  view source on GitHub ↗
(
  runtime: AgentDeviceRuntime,
  context: BackendCommandContext,
  source: BackendInstallSource | undefined,
)

Source from the content-addressed store, hash-verified

178}
179
180async function resolveInstallSource(
181 runtime: AgentDeviceRuntime,
182 context: BackendCommandContext,
183 source: BackendInstallSource | undefined,
184): Promise<{ source: BackendInstallSource; cleanup?: () => Promise<void> }> {
185 const normalized = normalizeInstallSource(source);
186 const localResolved = await resolveLocalInstallSource(runtime, normalized);
187 try {
188 const backendResolved = runtime.backend.resolveInstallSource
189 ? await runtime.backend.resolveInstallSource(context, localResolved.source)
190 : localResolved.source;
191 return {
192 source: normalizeInstallSource(backendResolved),
193 ...(localResolved.cleanup ? { cleanup: localResolved.cleanup } : {}),
194 };
195 } catch (error) {
196 if (localResolved.cleanup) {
197 try {
198 await localResolved.cleanup();
199 } catch {
200 // Best-effort cleanup; preserve the original install source resolution failure.
201 }
202 }
203 throw error;
204 }
205}
206
207async function resolveLocalInstallSource(
208 runtime: AgentDeviceRuntime,

Callers 1

runInstallCommandFunction · 0.70

Calls 2

normalizeInstallSourceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…