MCPcopy Create free account
hub / github.com/Noumena-Network/code / downloadVersion

Function downloadVersion

src/utils/nativeInstaller/download.ts:480–510  ·  view source on GitHub ↗
(
  version: string,
  stagingPath: string,
)

Source from the content-addressed store, hash-verified

478}
479
480export async function downloadVersion(
481 version: string,
482 stagingPath: string,
483): Promise<'npm' | 'binary'> {
484 // Test-fixture versions route to the private sentinel bucket. DCE'd in all
485 // shipped builds — the sentinel string and the gcloud call never exist in
486 // compiled binaries. Same gcloud-token pattern as
487 // remoteSkillLoader.ts:175-195.
488 if (feature('ALLOW_TEST_VERSIONS') && /^99\.99\./.test(version)) {
489 const { stdout } = await execFileNoThrowWithCwd('gcloud', [
490 'auth',
491 'print-access-token',
492 ])
493 await downloadVersionFromBinaryRepo(
494 version,
495 stagingPath,
496 'https://storage.googleapis.com/ncode-ci-sentinel',
497 { headers: { Authorization: `Bearer ${stdout.trim()}` } },
498 )
499 return 'binary'
500 }
501
502 const binaryRepoUrl = getPublicBinaryUrl()
503 if (binaryRepoUrl) {
504 await downloadVersionFromBinaryRepo(version, stagingPath, binaryRepoUrl)
505 return 'binary'
506 }
507
508 await downloadVersionFromGithubRelease(version, stagingPath)
509 return 'binary'
510}
511
512// Exported for testing
513export { StallTimeoutError, MAX_DOWNLOAD_RETRIES }

Callers 1

performVersionUpdateFunction · 0.85

Calls 4

execFileNoThrowWithCwdFunction · 0.85
getPublicBinaryUrlFunction · 0.70

Tested by

no test coverage detected